* fix(webui): stream model status and usage during active turns * fix(webui): keep live rounds and active-run status consistent * fix(webui): reuse existing run indicators without extra status text * fix(webui): preserve live activity and batch durable delivery Cancel and drain sibling tools when progress notifications fail, retain balanced checkpoints, and keep model telemetry separate from answer provenance. Group-commit already queued activity at the channel delivery boundary while preserving FIFO, generation ownership, per-envelope admission, and commit-before-fanout semantics. Isolate invalid members without dropping valid neighboring events. Retain tool detail lazy grouping and cover scheduling, cancellation, persistence, encoding failures, and projection regressions. * test(webui): separate standard-library imports in batch regression * test: tighten live execution checks and clarify contracts * refactor: remove redundant live execution comments * refactor: settle tool results through one output path
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { createThreadProjectionState, type ThreadProjectionState } from "./thread-event-projection";
|
|
import type { UIMessage } from "./types";
|
|
|
|
/** Resumable, memory-only state. Visible rows alone are not a projection cursor. */
|
|
export interface ThreadCheckpoint {
|
|
projection: ThreadProjectionState;
|
|
sideChannelTurnIds: Set<string>;
|
|
}
|
|
|
|
export function createThreadCheckpoint(messages: UIMessage[] = []): ThreadCheckpoint {
|
|
return { projection: createThreadProjectionState(messages), sideChannelTurnIds: new Set() };
|
|
}
|
|
|
|
export function copyThreadCheckpoint(
|
|
checkpoint: ThreadCheckpoint,
|
|
messages = checkpoint.projection.messages,
|
|
): ThreadCheckpoint {
|
|
return {
|
|
projection: {
|
|
...checkpoint.projection,
|
|
messages,
|
|
modelRequests: new Map(checkpoint.projection.modelRequests),
|
|
closedAssistantIds: new Set(checkpoint.projection.closedAssistantIds),
|
|
closedAnswerStreamIds: new Set(checkpoint.projection.closedAnswerStreamIds),
|
|
closedTurnIds: new Set(checkpoint.projection.closedTurnIds),
|
|
turnAliases: new Map(checkpoint.projection.turnAliases),
|
|
},
|
|
sideChannelTurnIds: new Set(checkpoint.sideChannelTurnIds),
|
|
};
|
|
}
|