|
@@ -18,6 +18,7 @@ import {
|
|
|
} from "@opencode-ai/sdk/v2/client"
|
|
} from "@opencode-ai/sdk/v2/client"
|
|
|
import { createStore, produce, reconcile } from "solid-js/store"
|
|
import { createStore, produce, reconcile } from "solid-js/store"
|
|
|
import { Binary } from "@opencode-ai/util/binary"
|
|
import { Binary } from "@opencode-ai/util/binary"
|
|
|
|
|
+import { retry } from "@opencode-ai/util/retry"
|
|
|
import { useGlobalSDK } from "./global-sdk"
|
|
import { useGlobalSDK } from "./global-sdk"
|
|
|
import { ErrorPage, type InitError } from "../pages/error"
|
|
import { ErrorPage, type InitError } from "../pages/error"
|
|
|
import { createContext, useContext, onMount, type ParentProps, Switch, Match } from "solid-js"
|
|
import { createContext, useContext, onMount, type ParentProps, Switch, Match } from "solid-js"
|
|
@@ -145,7 +146,7 @@ function createGlobalSync() {
|
|
|
changes: () => sdk.file.status().then((x) => setStore("changes", x.data!)),
|
|
changes: () => sdk.file.status().then((x) => setStore("changes", x.data!)),
|
|
|
node: () => sdk.file.list({ path: "/" }).then((x) => setStore("node", x.data!)),
|
|
node: () => sdk.file.list({ path: "/" }).then((x) => setStore("node", x.data!)),
|
|
|
}
|
|
}
|
|
|
- await Promise.all(Object.values(load).map((p) => p().catch((e) => setGlobalStore("error", e))))
|
|
|
|
|
|
|
+ await Promise.all(Object.values(load).map((p) => retry(p).catch((e) => setGlobalStore("error", e))))
|
|
|
.then(() => setStore("ready", true))
|
|
.then(() => setStore("ready", true))
|
|
|
.catch((e) => setGlobalStore("error", e))
|
|
.catch((e) => setGlobalStore("error", e))
|
|
|
}
|
|
}
|
|
@@ -295,21 +296,29 @@ function createGlobalSync() {
|
|
|
|
|
|
|
|
async function bootstrap() {
|
|
async function bootstrap() {
|
|
|
return Promise.all([
|
|
return Promise.all([
|
|
|
- globalSDK.client.path.get().then((x) => {
|
|
|
|
|
- setGlobalStore("path", x.data!)
|
|
|
|
|
- }),
|
|
|
|
|
- globalSDK.client.project.list().then(async (x) => {
|
|
|
|
|
- setGlobalStore(
|
|
|
|
|
- "project",
|
|
|
|
|
- x.data!.filter((p) => !p.worktree.includes("opencode-test")).sort((a, b) => a.id.localeCompare(b.id)),
|
|
|
|
|
- )
|
|
|
|
|
- }),
|
|
|
|
|
- globalSDK.client.provider.list().then((x) => {
|
|
|
|
|
- setGlobalStore("provider", x.data ?? {})
|
|
|
|
|
- }),
|
|
|
|
|
- globalSDK.client.provider.auth().then((x) => {
|
|
|
|
|
- setGlobalStore("provider_auth", x.data ?? {})
|
|
|
|
|
- }),
|
|
|
|
|
|
|
+ retry(() =>
|
|
|
|
|
+ globalSDK.client.path.get().then((x) => {
|
|
|
|
|
+ setGlobalStore("path", x.data!)
|
|
|
|
|
+ }),
|
|
|
|
|
+ ),
|
|
|
|
|
+ retry(() =>
|
|
|
|
|
+ globalSDK.client.project.list().then(async (x) => {
|
|
|
|
|
+ setGlobalStore(
|
|
|
|
|
+ "project",
|
|
|
|
|
+ x.data!.filter((p) => !p.worktree.includes("opencode-test")).sort((a, b) => a.id.localeCompare(b.id)),
|
|
|
|
|
+ )
|
|
|
|
|
+ }),
|
|
|
|
|
+ ),
|
|
|
|
|
+ retry(() =>
|
|
|
|
|
+ globalSDK.client.provider.list().then((x) => {
|
|
|
|
|
+ setGlobalStore("provider", x.data ?? {})
|
|
|
|
|
+ }),
|
|
|
|
|
+ ),
|
|
|
|
|
+ retry(() =>
|
|
|
|
|
+ globalSDK.client.provider.auth().then((x) => {
|
|
|
|
|
+ setGlobalStore("provider_auth", x.data ?? {})
|
|
|
|
|
+ }),
|
|
|
|
|
+ ),
|
|
|
])
|
|
])
|
|
|
.then(() => setGlobalStore("ready", true))
|
|
.then(() => setGlobalStore("ready", true))
|
|
|
.catch((e) => setGlobalStore("error", e))
|
|
.catch((e) => setGlobalStore("error", e))
|