fix: close browser session lifecycle gaps

This commit is contained in:
Wenxin Duan
2026-09-08 11:12:12 +08:00
parent 8fa006344d
commit ba45382747
12 changed files with 149 additions and 11 deletions
+12 -1
View File
@@ -14,6 +14,7 @@ import { HarnessClientStore } from "./store/harness-client-store.js";
type AppStore = HarnessRuntimeStore & {
start(): Promise<void>;
dispose?: () => Promise<void>;
getModelConfig(): Promise<{ modelConfig: ModelView }>;
putModelConfig?: (input: ModelConnectionInput) => Promise<{ modelConfig: ModelView }>;
testModelConfig?: () => Promise<{ status: "ok" | "deferred"; message: string }>;
@@ -87,7 +88,17 @@ export function App({ store: suppliedStore, autoStart = true, modelConfigured: s
modelLabel: model.modelId ?? "No model",
supportsImages: model.supportsImages ?? false,
onOpenSettings: () => setSettingsOpen(true),
onReset: () => window.location.reload(),
onReset: () => {
if (store.dispose === undefined) {
window.location.reload();
return;
}
void store.dispose()
.then(() => store.start())
.then(() => store.getModelConfig())
.then((response) => setModel(response.modelConfig))
.catch(() => undefined);
},
}}
skills={<SkillsPanel skills={snapshot.skills} />}
chat={<Thread