diff options
| author | Adam Malczewski <[email protected]> | 2026-06-22 01:31:29 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-22 01:31:29 +0900 |
| commit | 8a04c21b718f5e88583f82d0604902e0cf411041 (patch) | |
| tree | 28508f5697c35a9d0c8b71b71d71f95dd7a50297 /src/adapters/ws | |
| parent | 250575df308469c58477a53865f8763084612e5f (diff) | |
| download | dispatch-web-8a04c21b718f5e88583f82d0604902e0cf411041.tar.gz dispatch-web-8a04c21b718f5e88583f82d0604902e0cf411041.zip | |
feat(compaction): conversation compacting + auto-compact threshold
Consume the compaction handoff ([email protected], [email protected]).
Re-pinned file: deps + re-mirrored .dispatch/*.reference.md.
- New 'Compaction' sidebar view (CompactionView.svelte):
- 'Compact now' button → POST /conversations/:id/compact (loading indicator
+ result: 'N messages summarized, M kept')
- Auto-compact threshold number input → GET/PUT
/conversations/:id/compact-threshold (0 = disabled, default 350000)
- Re-mounts per conversation via {#key}
- App store: compactNow() + compactThreshold reactive state +
setCompactThreshold(), seeded on focus change (like reasoning-effort + cwd)
- conversation.compacted WS handler: reloads the SAME conversation's history
(ID unchanged — old history forked to an archive, not a tab switch)
- WS adapter parses newConversationId field on ConversationCompactedMessage
- conformance guards + tests cover the new type
686 tests green.
Diffstat (limited to 'src/adapters/ws')
| -rw-r--r-- | src/adapters/ws/logic.ts | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/adapters/ws/logic.ts b/src/adapters/ws/logic.ts index 53955f8..b11c5c4 100644 --- a/src/adapters/ws/logic.ts +++ b/src/adapters/ws/logic.ts @@ -136,11 +136,13 @@ export function parseServerMessage(data: string): WsServerMessage | null { } case "conversation.compacted": { if (typeof parsed.conversationId !== "string") return null; + if (typeof parsed.newConversationId !== "string") return null; if (typeof parsed.messagesSummarized !== "number") return null; if (typeof parsed.messagesKept !== "number") return null; const msg: ConversationCompactedMessage = { type: "conversation.compacted", conversationId: parsed.conversationId, + newConversationId: parsed.newConversationId, messagesSummarized: parsed.messagesSummarized, messagesKept: parsed.messagesKept, }; |
