summaryrefslogtreecommitdiffhomepage
path: root/src/core/chunks/groups.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-10-21 15:36:54 +0900
committerAdam Malczewski <[email protected]>2026-10-21 15:36:54 +0900
commitac43e92d174ed1f081c387944e9044643ee9efc2 (patch)
tree3110ac7c1fa722ad6c092200ea02aead5384b5d3 /src/core/chunks/groups.ts
parente9786bf1dbf258b68f793870d02378c390939d3d (diff)
downloaddispatch-web-ac43e92d174ed1f081c387944e9044643ee9efc2.tar.gz
dispatch-web-ac43e92d174ed1f081c387944e9044643ee9efc2.zip
fix(review-followup-fee): recover omitted chat payloads through history
Diffstat (limited to 'src/core/chunks/groups.ts')
-rw-r--r--src/core/chunks/groups.ts14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/core/chunks/groups.ts b/src/core/chunks/groups.ts
index c8493cc..6e0f8ea 100644
--- a/src/core/chunks/groups.ts
+++ b/src/core/chunks/groups.ts
@@ -3,6 +3,7 @@ import type { RenderedChunk } from "./types";
/** One tool call and its response. Null call = unloaded history; null result = pending. */
export interface ToolEntry {
+ readonly recovering?: boolean;
readonly toolCallId: string;
readonly toolName: string;
readonly call: ToolCallChunk | null;
@@ -26,7 +27,10 @@ export type RenderGroup =
* the stable t<toolCallId> render keys are always unique, even on corrupt replay.
* Pure: input → output; no DOM, effects, or Svelte.
*/
-export function groupRenderedChunks(rendered: readonly RenderedChunk[]): readonly RenderGroup[] {
+export function groupRenderedChunks(
+ rendered: readonly RenderedChunk[],
+ recovering = false,
+): readonly RenderGroup[] {
const calls = new Map<string, RenderedChunk>();
const results = new Map<string, RenderedChunk>();
for (const rc of rendered) {
@@ -55,7 +59,13 @@ export function groupRenderedChunks(rendered: readonly RenderedChunk[]): readonl
const turnId = callRow?.turnId ?? resultRow?.turnId;
groups.push({
kind: "tool",
- entry: { toolCallId: c.toolCallId, toolName: call?.toolName ?? c.toolName, call, result },
+ entry: {
+ toolCallId: c.toolCallId,
+ toolName: call?.toolName ?? c.toolName,
+ call,
+ result,
+ ...(recovering && call === null && resultRow?.provisional ? { recovering: true } : {}),
+ },
provisional: Boolean(callRow?.provisional || resultRow?.provisional),
...(stepId !== undefined ? { stepId } : {}),
...(turnId !== undefined ? { turnId } : {}),