summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-05-22 00:23:57 +0900
committerAdam Malczewski <[email protected]>2026-05-22 00:23:57 +0900
commite43df9a50ed9ad25dc07a7d5ee90c66d14e8a16f (patch)
tree62cb73fce55e8ffe5352619c2751cc307ceb6fd3
parentfb97d4cb72d0a90dde102b7001603716ee6e4c3b (diff)
downloaddispatch-e43df9a50ed9ad25dc07a7d5ee90c66d14e8a16f.tar.gz
dispatch-e43df9a50ed9ad25dc07a7d5ee90c66d14e8a16f.zip
fix: child tabs now show correct key/model in Model Choice view
Include keyId and modelId in the tab-created WebSocket event so child agent tabs inherit the parent's model selection on the frontend.
-rw-r--r--packages/api/src/agent-manager.ts5
-rw-r--r--packages/core/src/types/index.ts8
-rw-r--r--packages/frontend/src/lib/tabs.svelte.ts11
-rw-r--r--packages/frontend/src/lib/types.ts8
4 files changed, 26 insertions, 6 deletions
diff --git a/packages/api/src/agent-manager.ts b/packages/api/src/agent-manager.ts
index e1d9bad..e4f284d 100644
--- a/packages/api/src/agent-manager.ts
+++ b/packages/api/src/agent-manager.ts
@@ -611,7 +611,10 @@ export class AgentManager {
}
// Notify the frontend about the new tab
- this.emit({ type: "tab-created", id: tabId, title }, tabId);
+ this.emit(
+ { type: "tab-created", id: tabId, title, keyId: tabAgent.keyId, modelId: tabAgent.modelId },
+ tabId,
+ );
// Start the child agent in the background
this.processMessage(
diff --git a/packages/core/src/types/index.ts b/packages/core/src/types/index.ts
index bf312ae..8745bc7 100644
--- a/packages/core/src/types/index.ts
+++ b/packages/core/src/types/index.ts
@@ -40,7 +40,13 @@ export type AgentEvent =
| { type: "done"; message: ChatMessage }
| { type: "task-list-update"; tasks: TaskItem[] }
| { type: "config-reload" }
- | { type: "tab-created"; id: string; title: string };
+ | {
+ type: "tab-created";
+ id: string;
+ title: string;
+ keyId: string | null;
+ modelId: string | null;
+ };
// ─── Tool Types ──────────────────────────────────────────────────
diff --git a/packages/frontend/src/lib/tabs.svelte.ts b/packages/frontend/src/lib/tabs.svelte.ts
index 119df2d..9615c3d 100644
--- a/packages/frontend/src/lib/tabs.svelte.ts
+++ b/packages/frontend/src/lib/tabs.svelte.ts
@@ -334,7 +334,12 @@ function createTabStore() {
break;
}
case "tab-created": {
- const newTabEvent = event as AgentEvent & { id: string; title: string };
+ const newTabEvent = event as AgentEvent & {
+ id: string;
+ title: string;
+ keyId: string | null;
+ modelId: string | null;
+ };
// Only add if we don't already have this tab
if (!getTabById(newTabEvent.id)) {
const tab: Tab = {
@@ -342,8 +347,8 @@ function createTabStore() {
title: newTabEvent.title,
messages: [],
agentStatus: "running",
- keyId: null,
- modelId: null,
+ keyId: newTabEvent.keyId ?? null,
+ modelId: newTabEvent.modelId ?? null,
reasoningEffort: "max",
currentAssistantId: null,
tasks: [],
diff --git a/packages/frontend/src/lib/types.ts b/packages/frontend/src/lib/types.ts
index a1ec24b..e810864 100644
--- a/packages/frontend/src/lib/types.ts
+++ b/packages/frontend/src/lib/types.ts
@@ -64,7 +64,13 @@ export type AgentEvent =
}
| { type: "permission-prompt"; pending: PermissionPrompt[] }
| { type: "shell-output"; data: string; stream: "stdout" | "stderr" }
- | { type: "tab-created"; id: string; title: string };
+ | {
+ type: "tab-created";
+ id: string;
+ title: string;
+ keyId: string | null;
+ modelId: string | null;
+ };
export interface TaskItem {
id: string;