diff options
Diffstat (limited to 'src/app')
| -rw-r--r-- | src/app/App.svelte | 1 | ||||
| -rw-r--r-- | src/app/store.svelte.ts | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/app/App.svelte b/src/app/App.svelte index ae09bd5..9225cc7 100644 --- a/src/app/App.svelte +++ b/src/app/App.svelte @@ -309,6 +309,7 @@ onSelect={(id) => store.selectTab(id)} onClose={(id) => store.closeTab(id)} onNewDraft={() => store.newDraft()} + onRename={(id, title) => store.renameTab(id, title)} /> <span class="shrink-0 select-none px-1 font-mono text-[10px] leading-none text-base-content/30" diff --git a/src/app/store.svelte.ts b/src/app/store.svelte.ts index 3f78a97..6cff5f8 100644 --- a/src/app/store.svelte.ts +++ b/src/app/store.svelte.ts @@ -18,6 +18,7 @@ import type { SetCompactPercentRequest, SetCwdRequest, SetReasoningEffortRequest, + SetTitleRequest, WarmRequest, WarmResponse, } from "@dispatch/transport-contract"; @@ -114,6 +115,7 @@ export interface AppStore { newDraft(): void; selectTab(conversationId: string): void; closeTab(conversationId: string): void; + renameTab(conversationId: string, title: string): void; invoke(surfaceId: string, actionId: string, payload?: unknown): void; /** * Manually warm the focused conversation's prompt cache (`POST /chat/warm`). @@ -869,6 +871,17 @@ export function createAppStore(opts?: CreateAppStoreOptions): AppStore { removeTabLocally(conversationId); }, + renameTab(conversationId: string, title: string): void { + tabsStore.setTitle(conversationId, title); + void fetchImpl(`${httpBase}/conversations/${encodeURIComponent(conversationId)}/title`, { + method: "PUT", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ title } satisfies SetTitleRequest), + }).catch(() => { + // Best-effort — the local tab is already renamed. + }); + }, + invoke(surfaceId: string, actionId: string, payload?: unknown): void { const result = protocolInvoke( protocol, |
