fix: restore remote OpenCode providers and startup errors

- Fix OpenChamber proxying to the correct OpenCode host for remote VPS setups
- Show a clear empty-state error when OpenCode is not reachable
- Harden session event routing for early or mismatched directory events
This commit is contained in:
Bohdan Triapitsyn
2026-04-07 01:17:12 +03:00
parent 16a4157440
commit db19f83f46
7 changed files with 164 additions and 19 deletions
+6
View File
@@ -11,6 +11,7 @@ import type { DirectoryStore } from "./child-store"
import type { StoreApi } from "zustand"
import { opencodeClient } from "@/lib/opencode/client"
import { useGlobalSessionsStore } from "@/stores/useGlobalSessionsStore"
import { registerSessionDirectory } from "./sync-refs"
// Reference set by SyncProvider — allows actions to access SDK and stores
let _sdk: OpencodeClient | null = null
@@ -93,6 +94,11 @@ export async function createSession(
if (!session) return null
const sessionDirectory = (session as { directory?: string }).directory ?? directoryOverride ?? null
// Pre-populate routing index so SSE events arriving before session.created
// can be routed to the correct child store
if (sessionDirectory) {
registerSessionDirectory(session.id, sessionDirectory)
}
useSessionUIStore.getState().setCurrentSession(session.id, sessionDirectory)
useSessionUIStore.getState().markSessionAsOpenChamberCreated(session.id)
useGlobalSessionsStore.getState().upsertSession(session)