Skip to content

Type Alias: AgentDocumentEvent

agentmux


agentmux / agent-document-store / AgentDocumentEvent

AgentDocumentEvent = { at: number; type: "session-started"; } | { at: number; type: "session-ended"; } | { addedCount: number; duplicatesDropped: number; type: "history-loaded"; } | { fromSnapshot: true; restoredCount: number; type: "history-restored"; } | { appendedNew: number; collidedAndUpdated: number; type: "stream-flushed"; updateApplied: number; updateDropped: number; } | { clearedCount: number; reason: string; type: "truncate-applied"; } | { activeForMs: number; nodeCount: number; reason: string; type: "truncate-suppressed"; } | { chunkCount: number; toolId: string; type: "tool-chunk-appended"; } | { reason: "unknown-tool-id" | "node-not-tool" | "duplicate"; toolId: string; type: "tool-chunk-dropped"; } | { clearedCount: number; type: "user-cleared"; } | { bytes: number; count: number; type: "tool-results-unloaded"; } | { nodeId: string; type: "tool-result-loaded"; } | { blockedTurns: number; gapsBefore: string[]; prefixTurns: number; removedCount: number; turns: number; type: "turns-rolled-off"; } | { markdownCanceled: number; resolvedToolNodes: object[]; toolsCanceled: number; type: "orphans-scrubbed"; } | { nodeId: string; type: "tool-force-canceled"; } | { nodeId: string; reason: "unknown-tool-id" | "node-not-tool"; type: "tool-force-cancel-skipped"; }

Defined in: agent-document/types.ts:196

Audit events emitted by the reducer. v1 logs them via the dispatcher’s onEvent callback. The diagnostics panel surface is a follow-up.

{ at: number; type: "session-started"; }


{ at: number; type: "session-ended"; }


{ addedCount: number; duplicatesDropped: number; type: "history-loaded"; }


{ fromSnapshot: true; restoredCount: number; type: "history-restored"; }


{ appendedNew: number; collidedAndUpdated: number; type: "stream-flushed"; updateApplied: number; updateDropped: number; }

appendedNew: number

collidedAndUpdated: number

New nodes whose ID already existed → routed to in-place update.

type: "stream-flushed"

updateApplied: number

Updates targeting known IDs.

updateDropped: number

Updates targeting unknown IDs — dropped.


{ clearedCount: number; reason: string; type: "truncate-applied"; }


{ activeForMs: number; nodeCount: number; reason: string; type: "truncate-suppressed"; }

activeForMs: number

ms since SessionStart.

nodeCount: number

Nodes that would have been wiped.

reason: string

type: "truncate-suppressed"


{ chunkCount: number; toolId: string; type: "tool-chunk-appended"; }

chunkCount: number

Chunks attached to this tool AFTER the append (>=1).

toolId: string

type: "tool-chunk-appended"


{ reason: "unknown-tool-id" | "node-not-tool" | "duplicate"; toolId: string; type: "tool-chunk-dropped"; }

reason: "unknown-tool-id" | "node-not-tool" | "duplicate"

Reason the chunk was rejected without touching state.

toolId: string

type: "tool-chunk-dropped"


{ clearedCount: number; type: "user-cleared"; }


{ bytes: number; count: number; type: "tool-results-unloaded"; }

bytes: number

count: number

type: "tool-results-unloaded"

Collapsed tool results left memory (UnloadToolResults).


{ nodeId: string; type: "tool-result-loaded"; }


{ blockedTurns: number; gapsBefore: string[]; prefixTurns: number; removedCount: number; turns: number; type: "turns-rolled-off"; }

blockedTurns: number

Older turns kept only because the transcript can’t rebuild them.

gapsBefore: string[]

For each range removed from the MIDDLE (around a kept turn), the id of the first node after it — where the pane shows a “turns in History” row.

prefixTurns: number

Turns removed from the very front of the feed.

removedCount: number

turns: number

type: "turns-rolled-off"

Finished turns left the live feed (RollOff, spec §6.9).


{ markdownCanceled: number; resolvedToolNodes: object[]; toolsCanceled: number; type: "orphans-scrubbed"; }

markdownCanceled: number

Thinking-markdown nodes flipped to canceled.

resolvedToolNodes: object[]

Every tool node whose status this scrub actually changed — agent-document-store.ts’s dispatch() pushes a final docknodestatus delta for each so the srv-side muxspect dock cache learns about the resolution instead of reporting an already-resolved node as stuck forever (reagentx P1, PR #2432).

toolsCanceled: number

Tool nodes whose status flipped from “running” → “canceled”.

type: "orphans-scrubbed"


{ nodeId: string; type: "tool-force-canceled"; }


{ nodeId: string; reason: "unknown-tool-id" | "node-not-tool"; type: "tool-force-cancel-skipped"; }

nodeId: string

reason: "unknown-tool-id" | "node-not-tool"

Reason the target node wasn’t found — same taxonomy as tool-chunk-dropped.

type: "tool-force-cancel-skipped"