Skip to content

A personal assistant that lives on your desktop, remembers what matters, and can use your Mac for you.

TypeScript

fix(chat): show the current model as soon as the engine is ready

Alan Buscaglia7ab0c0a7ca42
diff --git a/packages/daemon/src/bridge.ts b/packages/daemon/src/bridge.ts
index f17e234..b9aadc4 100644
--- a/packages/daemon/src/bridge.ts
+++ b/packages/daemon/src/bridge.ts
@@ -935,7 +935,12 @@ export class DotBridge {
this.stopRequested = false;
this.clearRun();
this.clearQueue();
- } else this.settleModelSwitch();
+ } else {
+ this.settleModelSwitch();
+ // The engine knows its model only once it is ready; windows that connected
+ // earlier (for example while it restarted) would show none until they asked.
+ this.broadcastModels();
+ }
break;
case "interrupted":
this.interrupted = true;
diff --git a/packages/daemon/test/models-gateway.test.ts b/packages/daemon/test/models-gateway.test.ts
index aae9fee..671c432 100644
--- a/packages/daemon/test/models-gateway.test.ts
+++ b/packages/daemon/test/models-gateway.test.ts
@@ -103,6 +103,15 @@ async function connect(d: DotDaemon) {
}
describe("the in-chat model picker (S32)", () => {
+ it("tells connected windows the current model when the engine (re)starts, without being asked", async () => {
+ const { d } = await setup();
+ const client = await connect(d);
+ await d.supervisor.restart();
+ const pushed = await client.find("models", (m) => m.current !== undefined);
+ expect(pushed.current?.provider).toBe("fake");
+ expect(client.messages.some((m) => (m as { type: string }).type === "models_list")).toBe(false);
+ });
+
it("lists the current model and thinking, the models by account, and profiles as quick picks, without secrets", async () => {
const { d } = await setup();
const client = await connect(d);