diff options
| author | Adam Malczewski <[email protected]> | 2026-06-07 00:39:31 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-07 00:39:31 +0900 |
| commit | d96e504d197140e83c379a02527cf8148925ea67 (patch) | |
| tree | 8e94ca913c93e279fb0a2b9fb8ef2d78220dd57f /src/app/App.svelte | |
| parent | 979fd1aac559805e05b36369e0fb756a8ec517dd (diff) | |
| download | dispatch-web-d96e504d197140e83c379a02527cf8148925ea67.tar.gz dispatch-web-d96e504d197140e83c379a02527cf8148925ea67.zip | |
Slice 2 wave 3: wire chat end-to-end at the composition root
- app/store.svelte.ts: one WebSocket carries surfaces AND chat (onChat ->
chatStore.handleDelta); build the conversation cache over the IndexedDB
adapter; createChatStore wired to transport (socket.send), injected HTTP
historySync, and the cache; load() on construct
- app/resolve-http-url.ts: host-relative HTTP base (port 24203), mirrors
resolve-ws-url; injected fetch
- App.svelte: render ChatView + Composer alongside the surface picker
- createAppStore gains optional injection points (httpUrl/fetchImpl/indexedDB/
conversationId) for tests
- vitest-setup.ts: fake-indexeddb/auto for jsdom IndexedDB (orchestrator-owned
config; agent change adopted)
Verified green (x2, stable): svelte-check 0/0, vitest 218, biome clean, build ok.
Slice 2 (conversation transcript: cache + delta streaming) feature-complete.
Diffstat (limited to 'src/app/App.svelte')
| -rw-r--r-- | src/app/App.svelte | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/app/App.svelte b/src/app/App.svelte index 2619a39..92939c2 100644 --- a/src/app/App.svelte +++ b/src/app/App.svelte @@ -1,6 +1,7 @@ <script lang="ts"> import type { InvokeMessage } from "@dispatch/ui-contract"; import { SurfaceView } from "../features/surface-host"; + import { ChatView, Composer } from "../features/chat"; import type { AppStore } from "./store.svelte"; let { store }: { store: AppStore } = $props(); @@ -12,6 +13,10 @@ function handleInvoke(msg: InvokeMessage) { store.invoke(msg.surfaceId, msg.actionId, msg.payload); } + + function handleSend(text: string) { + store.chat.send(text); + } </script> <main> @@ -24,6 +29,19 @@ </div> {/if} + {#if store.chat.error} + <div role="alert"> + <strong>Chat error:</strong> + {store.chat.error} + </div> + {/if} + + <section> + <h2>Chat</h2> + <ChatView chunks={store.chat.chunks} /> + <Composer onSend={handleSend} /> + </section> + <section> <h2>Surfaces</h2> {#if store.catalog.length === 0} |
