@ai-matrx/chat 0.7.5 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/dist/agents/api/fetch-pending-calls.js +4 -3
- package/dist/agents/api/submit-tool-results.js +3 -6
- package/dist/agents/components/ambient-assistant/ScrollAssistantLauncherImpl.js +13 -6
- package/dist/agents/components/chat/begin-fresh-chat.js +2 -2
- package/dist/agents/components/identity-refs/AiIdentityRef.js +2 -2
- package/dist/agents/components/inputs/smart-input/composer/ComposerSplash.js +2 -3
- package/dist/agents/components/inputs/smart-input/composer/useComposerMode.js +4 -2
- package/dist/agents/components/live-run/LiveRunDisplay.d.ts +7 -1
- package/dist/agents/components/live-run/LiveRunDisplay.js +3 -1
- package/dist/agents/components/messages-display/AgentConversationDisplay.js +1 -1
- package/dist/agents/components/messages-display/assistant/AgentEmptyMessageDisplay.js +4 -4
- package/dist/agents/components/messages-display/assistant/AssistantNoAnswer.js +1 -1
- package/dist/agents/components/messages-display/assistant/BreathingOrb.js +1 -1
- package/dist/agents/components/messages-display/assistant/InPlaceAnswerEditor.js +1 -1
- package/dist/agents/components/messages-display/citations/MessageSourcesRow.js +1 -1
- package/dist/agents/components/messages-display/conversation-tools/ConversationFindBar.js +4 -4
- package/dist/agents/components/messages-display/message-options/EditHistoryDialog.js +7 -7
- package/dist/agents/components/messages-display/user/AgentUserMessage.js +4 -4
- package/dist/agents/components/messages-display/user/CollabNoteMessage.js +2 -2
- package/dist/agents/components/messages-display/user/FirstTurnVariables.js +3 -3
- package/dist/agents/components/messages-display/user/PendingSendMessage.js +4 -4
- package/dist/agents/components/messages-display/user/RemarksTranscriptView.js +7 -7
- package/dist/agents/components/messages-display/user/ResourceAttachmentTile.js +9 -9
- package/dist/agents/components/messages-display/user/ResourceEditableToggleSamples.js +4 -4
- package/dist/agents/components/messages-display/user/UserActionBar.js +3 -3
- package/dist/agents/components/messages-display/user/UserMessageAttachmentStyleComparison.js +12 -12
- package/dist/agents/components/messages-display/user/UserMessageChipsDemo.js +19 -19
- package/dist/agents/components/messages-display/user/UserMessageHybridTileSamples.js +22 -22
- package/dist/agents/components/run/AgentRunnerPage.js +4 -4
- package/dist/agents/components/run/AssistantError.js +1 -1
- package/dist/agents/components/run/AssistantWarning.js +1 -1
- package/dist/agents/components/run/GenerationJobCard.js +5 -5
- package/dist/agents/components/run/IncompleteNote.js +1 -1
- package/dist/agents/components/run/RunJobWorkingLine.js +1 -1
- package/dist/agents/components/shared/AgentConversationColumn.js +1 -1
- package/dist/agents/components/shared/AgentHeaderMobile.js +6 -6
- package/dist/agents/components/shared/AgentModeController.js +1 -1
- package/dist/agents/components/shared/AutoInjectionSwitch.js +6 -6
- package/dist/agents/components/shared/DesktopFilterPanel.js +8 -8
- package/dist/agents/components/smart/AgentRunner.js +1 -1
- package/dist/agents/components/smart/CreateWithAiTabs.js +1 -1
- package/dist/agents/redux/agent-definition/agent-cache-bust-request.js +7 -7
- package/dist/agents/redux/execution-system/context-rules/receipt-check.js +2 -2
- package/dist/agents/redux/execution-system/inbox/inbox.thunks.d.ts +2 -2
- package/dist/agents/redux/execution-system/inbox/inbox.thunks.js +7 -15
- package/dist/agents/redux/execution-system/observational-memory/fetch-memory-cost.thunk.d.ts +1 -1
- package/dist/agents/redux/execution-system/observational-memory/fetch-memory-cost.thunk.js +7 -4
- package/dist/agents/redux/execution-system/selectors/aggregate.selectors.d.ts +1 -114
- package/dist/agents/redux/execution-system/selectors/aggregate.selectors.js +28 -43
- package/dist/agents/redux/execution-system/thunks/call-conversation-api.d.ts +44 -0
- package/dist/agents/redux/execution-system/thunks/call-conversation-api.js +78 -0
- package/dist/agents/redux/execution-system/thunks/continue-agent-json.d.ts +41 -0
- package/dist/agents/redux/execution-system/thunks/continue-agent-json.js +66 -0
- package/dist/agents/redux/execution-system/thunks/execute-instance.thunk.d.ts +20 -0
- package/dist/agents/redux/execution-system/thunks/execute-instance.thunk.js +9 -2
- package/dist/agents/redux/execution-system/thunks/launch-agent-execution.thunk.js +4 -6
- package/dist/agents/redux/execution-system/thunks/notify-and-play-dispatcher.d.ts +1 -5
- package/dist/agents/redux/execution-system/thunks/notify-and-play-dispatcher.js +2 -1
- package/dist/agents/redux/execution-system/thunks/resolve-base-url.js +7 -17
- package/dist/agents/redux/execution-system/thunks/settle-after-stop.thunk.js +2 -2
- package/dist/agents/redux/execution-system/thunks/smart-execute.thunk.js +3 -3
- package/dist/agents/redux/execution-system/utils/continuation-body.d.ts +8 -2
- package/dist/agents/redux/execution-system/utils/continuation-body.js +3 -3
- package/dist/agents/redux/execution-system/utils/required-organization.d.ts +18 -0
- package/dist/agents/redux/execution-system/utils/required-organization.js +14 -10
- package/dist/agents/redux/execution-system/utils/stream-block-accumulator.d.ts +69 -333
- package/dist/agents/redux/execution-system/utils/stream-block-accumulator.js +268 -1896
- package/dist/agents/services/mcp-connections.service.js +5 -8
- package/dist/agents/ui-first-tools/dispatcher/dispatch-ui-first-tool.thunk.js +2 -1
- package/dist/host/defaults/files-host.js +11 -1
- package/dist/host/defaults/files-ui.js +2 -1
- package/dist/host/defaults/server-api.d.ts +1 -15
- package/dist/host/defaults/server-api.js +0 -21
- package/dist/host/defaults/server.d.ts +2 -1
- package/dist/host/defaults/server.js +8 -6
- package/dist/host/request-headers.d.ts +26 -0
- package/dist/host/request-headers.js +15 -0
- package/dist/host/server/call-api.d.ts +0 -13
- package/dist/host/server/call-api.js +0 -2
- package/dist/host/server/matrx-transport.d.ts +0 -1
- package/dist/host/server/matrx-transport.js +0 -2
- package/dist/store/root-state.d.ts +4 -21
- package/dist/surfaces/hooks/useSurfaceConfig.js +2 -1
- package/dist/surfaces/runtime/surface-feedback.js +2 -2
- package/dist/tool-call-visualization/components/ArtifactResultBar.js +4 -4
- package/dist/tool-call-visualization/components/ChatResultColumn.d.ts +1 -1
- package/dist/tool-call-visualization/components/ToolCallBatch.js +2 -2
- package/dist/tool-call-visualization/components/ToolCallVisualization.js +5 -5
- package/dist/tool-call-visualization/components/ToolTabBodies.js +12 -12
- package/dist/tool-call-visualization/components/ToolUpdatesOverlay.js +4 -4
- package/dist/tool-call-visualization/configured-rows/ConfiguredToolRow.js +8 -8
- package/dist/tool-call-visualization/configured-rows/CopyToolButton.js +1 -1
- package/dist/tool-call-visualization/configured-rows/ToolProgressView.js +7 -7
- package/dist/tool-call-visualization/configured-rows/field-components.js +28 -50
- package/dist/tool-call-visualization/registry/GenericRenderer.js +4 -4
- package/dist/tool-call-visualization/renderers/_shared-entity/EmptyResultCard.js +1 -1
- package/dist/tool-call-visualization/renderers/_shared-entity/EntityCard.js +5 -5
- package/dist/tool-call-visualization/renderers/_shared-entity/PartPeekPopover.js +2 -2
- package/dist/tool-call-visualization/renderers/_shared-entity/ToolGlyph.js +1 -1
- package/dist/tool-call-visualization/renderers/_shared-entity/ToolResultCard.js +6 -6
- package/dist/tool-call-visualization/renderers/agent-call/AgentCallInline.js +5 -5
- package/dist/tool-call-visualization/renderers/agent-call/CollabCallCard.js +4 -4
- package/dist/tool-call-visualization/renderers/agent-call/ImageGenerationResult.js +1 -1
- package/dist/tool-call-visualization/renderers/ask/AskInline.js +3 -3
- package/dist/tool-call-visualization/renderers/ask-person/AskPersonInline.js +2 -2
- package/dist/tool-call-visualization/renderers/cloud-browser/CloudBrowserRunCard.js +5 -5
- package/dist/tool-call-visualization/renderers/ctx/CtxBatchInline.js +3 -3
- package/dist/tool-call-visualization/renderers/ctx/CtxGetInline.js +2 -2
- package/dist/tool-call-visualization/renderers/ctx/CtxItemCard.js +3 -3
- package/dist/tool-call-visualization/renderers/ctx/CtxPatchInline.js +6 -6
- package/dist/tool-call-visualization/renderers/dictionary/DictEntryList.js +12 -12
- package/dist/tool-call-visualization/renderers/dictionary/DictionaryOverlay.js +5 -5
- package/dist/tool-call-visualization/renderers/fs/FsInline.js +7 -7
- package/dist/tool-call-visualization/renderers/news-api/NewsInline.js +17 -17
- package/dist/tool-call-visualization/renderers/news-api/NewsOverlay.js +12 -12
- package/dist/tool-call-visualization/renderers/random-wheel/RandomWheelInline.js +34 -34
- package/dist/tool-call-visualization/renderers/records/RecordsInline.js +1 -1
- package/dist/tool-call-visualization/renderers/research/ResearchInline.js +10 -10
- package/dist/tool-call-visualization/renderers/research/ResearchOverlay.js +19 -19
- package/dist/tool-call-visualization/renderers/research/SubagentReportBlock.js +11 -11
- package/dist/tool-call-visualization/renderers/scrape/ScrapeInline.js +18 -18
- package/dist/tool-call-visualization/renderers/scrape/ScrapeOverlay.js +17 -17
- package/dist/tool-call-visualization/renderers/search/SearchInline.js +30 -30
- package/dist/tool-call-visualization/renderers/search/SearchOverlay.js +40 -40
- package/dist/tool-call-visualization/renderers/shell/ShellInline.js +3 -3
- package/dist/tool-call-visualization/renderers/skill/SkillInline.js +5 -5
- package/dist/tool-call-visualization/renderers/sql/DbSchemaInline.js +7 -7
- package/dist/tool-call-visualization/renderers/sql/SqlInline.js +4 -4
- package/dist/tool-call-visualization/renderers/workbook/WorkbookGrid.js +4 -4
- package/dist/tool-call-visualization/renderers/workbook/WorkbookInline.js +2 -2
- package/dist/tool-call-visualization/renderers/workbook/WorkbookOverlay.js +7 -7
- package/dist/tool-call-visualization/renderers/working-document/PatchDiffInline.js +3 -3
- package/dist/tool-call-visualization/result-fields/EmptyResult.js +1 -1
- package/dist/tool-call-visualization/result-fields/KeyValueGrid.js +9 -9
- package/dist/tool-call-visualization/result-fields/ResultFile.js +4 -4
- package/dist/tool-call-visualization/result-fields/ResultJson.js +1 -1
- package/dist/tool-call-visualization/result-fields/ResultMedia.js +2 -2
- package/dist/tool-call-visualization/result-fields/ResultScalar.js +2 -2
- package/dist/tool-call-visualization/result-fields/ResultTable.js +10 -10
- package/dist/tool-call-visualization/result-fields/ResultValue.js +7 -7
- package/dist/tool-call-visualization/result-fields/ShortId.js +3 -3
- package/dist/tool-call-visualization/result-fields/ToolErrorCard.js +4 -4
- package/dist/tool-call-visualization/result-fields/UrlChips.js +3 -3
- package/dist/tool-call-visualization/surface-write/SurfaceWriteDiff.js +2 -2
- package/dist/tool-call-visualization/surface-write/SurfaceWriteStress.js +1 -1
- package/dist/tool-call-visualization/window-panel/ToolCallWindowPanel.js +9 -9
- package/dist/ui/mandates-storage/mandateStorage.d.ts +36 -0
- package/dist/ui/mandates-storage/shortcutStorage.d.ts +9 -0
- package/dist/ui/markdown-stream/EnhancedChatMarkdown.js +22 -0
- package/dist/ui/markdown-stream/MarkdownStreamImpl.js +3 -3
- package/dist/ui/markdown-stream/StreamTextFallback.d.ts +6 -0
- package/dist/ui/markdown-stream/StreamTextFallback.js +23 -0
- package/dist/ui/markdown-stream/merge-thinking-across-hidden.d.ts +19 -0
- package/dist/ui/markdown-stream/merge-thinking-across-hidden.js +21 -0
- package/package.json +14 -9
- package/dist/agents/redux/execution-system/utils/content-prefilter.d.ts +0 -50
- package/dist/agents/redux/execution-system/utils/content-prefilter.js +0 -243
|
@@ -1,357 +1,93 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* StreamBlockAccumulator —
|
|
2
|
+
* StreamBlockAccumulator — the LIVE DRIVER over the one block splitter.
|
|
3
3
|
*
|
|
4
|
-
* Sits inside the processStream() closure and ingests rAF-batched text
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Sits inside the processStream() closure and ingests rAF-batched text deltas. It owns no
|
|
5
|
+
* splitting rules of its own: every delta goes to rich-content's `BlockSplitter` — the same
|
|
6
|
+
* reading a reload of the stored text draws — and the driver turns the blocks into
|
|
7
|
+
* `upsertRenderBlock` dispatches (Audit B family 1, chair ruling 2026-10-08: live and reload
|
|
8
|
+
* always draw the same blocks).
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* What the driver adds is only what a STREAM has and a reload does not:
|
|
11
|
+
* - status: every block but the last is `complete`; the last is `streaming` until finalize;
|
|
12
|
+
* - stable ids (`client_block_<n>`) and retraction of a block a later reading no longer has;
|
|
13
|
+
* - a LIVE kind envelope for the open JSON region (a content-ir parse session), so a kind
|
|
14
|
+
* draws as its card while it arrives — a closed region carries the splitter's own envelope;
|
|
15
|
+
* - holds: a nascent JSON object (`{` with no key yet) and an open front matter are not drawn;
|
|
16
|
+
* - tool boundaries (`breakTextBlock`): each text run is split on its own, as reload splits
|
|
17
|
+
* each run's stored text;
|
|
18
|
+
* - provider-retry rewind and the reasoning-boundary diagnostics.
|
|
15
19
|
*/
|
|
16
20
|
import type { RenderBlockPayload } from "@ai-matrx/agents/generated/stream-events";
|
|
17
21
|
type DispatchFn = (action: unknown) => unknown;
|
|
22
|
+
type UpsertAction = (payload: {
|
|
23
|
+
requestId: string;
|
|
24
|
+
block: RenderBlockPayload;
|
|
25
|
+
}) => unknown;
|
|
18
26
|
export declare class StreamBlockAccumulator {
|
|
19
|
-
private requestId;
|
|
20
|
-
private
|
|
21
|
-
private
|
|
22
|
-
private
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
private
|
|
32
|
-
private
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* (see `emitCurrentBlock`). Reset whenever a new block is opened. Used by
|
|
37
|
-
* `closeCurrentBlock` to retract a speculative block whose line turned out
|
|
38
|
-
* to be a different typed block (see the bare-JSON duplication note there).
|
|
39
|
-
*/
|
|
40
|
-
private currentBlockEmitted;
|
|
41
|
-
/**
|
|
42
|
-
* THE DATA KEEPS ITS KINDS. A JSON wrapper that holds kinds is drawn as its
|
|
43
|
-
* kinds plus a residual (A7) — the residual is the wrapper's data WITH ITS
|
|
44
|
-
* KINDS REMOVED, so it is a display projection, never the answer. Every
|
|
45
|
-
* such split remembers the bytes it was cut from, keyed by its first block
|
|
46
|
-
* index, so data capture (`deriveAnswerDataText`) reads what the model wrote.
|
|
47
|
-
* Live only; a rewind forgets every split at or past its boundary.
|
|
48
|
-
*/
|
|
27
|
+
private readonly requestId;
|
|
28
|
+
private readonly upsertAction;
|
|
29
|
+
private readonly envelopes;
|
|
30
|
+
private splitter;
|
|
31
|
+
/** Absolute index of the current text run's first block (tool boundaries start a new run). */
|
|
32
|
+
private base;
|
|
33
|
+
/** How many blocks the current run has drawn (retraction bookkeeping). */
|
|
34
|
+
private drawn;
|
|
35
|
+
/** Last dispatched signature per absolute block index. */
|
|
36
|
+
private signatures;
|
|
37
|
+
private region;
|
|
38
|
+
/** Final envelope of a region closed at a run's end (stream death or tool boundary). */
|
|
39
|
+
private closedEnvelopes;
|
|
40
|
+
private identities;
|
|
41
|
+
private unclosedReasoningReported;
|
|
42
|
+
private orphanReasoningCloseReported;
|
|
43
|
+
/** A7: the bytes each JSON-wrapper split was cut from, keyed by its first block index. */
|
|
49
44
|
private wrapperSplits;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* URL + label for the current `audio` block. The accumulator's single-line
|
|
53
|
-
* media blocks (image/video) leave `data` null, which is why the legacy
|
|
54
|
-
* client image/video markdown path never populated `src`. Audio MUST carry
|
|
55
|
-
* its URL on `data.src` or BlockRenderer's `audio` case renders nothing —
|
|
56
|
-
* so we stash the extracted link here and emit it via buildBlockData.
|
|
57
|
-
*/
|
|
58
|
-
private pendingMediaData;
|
|
59
|
-
private ingestCount;
|
|
60
|
-
private emitCount;
|
|
61
|
-
/** Live kind-parser session for the OPEN JSON region (fence or bare). */
|
|
62
|
-
private irSession;
|
|
63
|
-
/** Lines fed to the session for this region (drives the "\n" separators). */
|
|
64
|
-
private irRegionLineCount;
|
|
65
|
-
/** How many chars of the current pendingLineFragment were already fed. */
|
|
66
|
-
private irFedFragmentLen;
|
|
67
|
-
/** Final envelope of the region being closed — consumed by the complete emit. */
|
|
68
|
-
private irEnvelope;
|
|
69
|
-
/**
|
|
70
|
-
* True only between seeing a LITERAL closing fence line and the block's
|
|
71
|
-
* emit (set in the code_fence close branch). Stream-death finalize never
|
|
72
|
-
* sets it, so the fence-surface convergence hook fires exclusively on
|
|
73
|
-
* genuinely completed fence regions.
|
|
74
|
-
*/
|
|
75
|
-
private fenceClosedCleanly;
|
|
76
|
-
/**
|
|
77
|
-
* True once a simple-XML region's LITERAL closing tag has been seen — the twin
|
|
78
|
-
* of `fenceClosedCleanly`. Never set by stream-death `finalize()`, so a
|
|
79
|
-
* truncated region keeps today's legacy rendering (no envelope).
|
|
80
|
-
*
|
|
81
|
-
* MUST NOT be re-derived by scanning `currentBlockContent` for the closing
|
|
82
|
-
* tag: the accumulator STRIPS the literal tag text out of a simple-XML
|
|
83
|
-
* block's content (so `</reasoning>` can't leak into visible chat), which
|
|
84
|
-
* silently killed the XML keystone once already. The state machine already
|
|
85
|
-
* knows when the region closed; ask it, don't re-parse its output.
|
|
86
|
-
*/
|
|
87
|
-
private xmlClosedCleanly;
|
|
88
|
-
/**
|
|
89
|
-
* True while the OPEN ir region is the JSON BODY of an attribute-XML block
|
|
90
|
-
* (`<artifact …>{"__kind":…}</artifact>`) rather than a block that IS the
|
|
91
|
-
* JSON region. Two consequences, both required:
|
|
92
|
-
*
|
|
93
|
-
* - the parity check is skipped — it compares the envelope against
|
|
94
|
-
* `JSON.parse(currentBlockContent)`, and an attr-XML block's content is
|
|
95
|
-
* the tag chrome PLUS the body, which never parses as JSON. Without this
|
|
96
|
-
* every wrapped payload would fire a false "stream parity" alarm.
|
|
97
|
-
* - the fragment feed stays off the closing-tag line (see `ingest`).
|
|
98
|
-
*/
|
|
99
|
-
private irRegionIsXmlBody;
|
|
100
|
-
/** Every session identity opened during this stream (disposed at finalize). */
|
|
101
|
-
private irIdentities;
|
|
102
|
-
/**
|
|
103
|
-
* True only for the closeCurrentBlock call that closes the FIRST HALF of a
|
|
104
|
-
* region split by a tool boundary (breakTextBlock keeps the region open in
|
|
105
|
-
* a fresh block). Metadata built during that close must not report
|
|
106
|
-
* `isComplete: true` — the region genuinely continues.
|
|
107
|
-
*/
|
|
108
|
-
private regionContinuesAfterClose;
|
|
109
|
-
private upsertAction;
|
|
110
|
-
/** Same-line remainders are queued, never recursively reclassified. */
|
|
111
|
-
private lineQueue;
|
|
112
|
-
/**
|
|
113
|
-
* The current line held a kind object that broke into prose
|
|
114
|
-
* (`{"__kind":"note","title":"Hi" and then…`, L-4 round 9): it is prose to
|
|
115
|
-
* its end — no opener re-reads it as JSON — and the prose leaf reads the
|
|
116
|
-
* broken object as its one-line label, exactly as a reload does.
|
|
117
|
-
*/
|
|
118
|
-
private kindLineIsProse;
|
|
119
|
-
private isProcessingLineQueue;
|
|
120
|
-
/** Incomplete generic XML must never promote embedded JSON on finalize. */
|
|
121
|
-
private genericXmlRecoverySuppressed;
|
|
122
|
-
/**
|
|
123
|
-
* The unused text slot opened after a clean container close is omitted.
|
|
124
|
-
*
|
|
125
|
-
* A completed bare JSON root opens a fresh text slot so subsequent source
|
|
126
|
-
* can continue in document order. If the stream ends there, emitting that
|
|
127
|
-
* slot creates a second, empty terminal block after the actual answer.
|
|
128
|
-
*/
|
|
129
|
-
private suppressEmptyTrailingSlot;
|
|
130
|
-
/** Lifts JSON regions out of blockquotes before the line machine (V1). */
|
|
131
|
-
private quoteLift;
|
|
132
|
-
/** Un-escapes a markdown-escaped kind (`"\_\_kind"`) before the quote lift (P8). */
|
|
133
|
-
private kindUnescape;
|
|
134
|
-
/** Drops the `` wrapper of a kind written as image alt text (P9). */
|
|
135
|
-
private imageAlt;
|
|
136
|
-
constructor(requestId: string, upsertAction: (payload: {
|
|
137
|
-
requestId: string;
|
|
138
|
-
block: RenderBlockPayload;
|
|
139
|
-
}) => unknown);
|
|
140
|
-
/**
|
|
141
|
-
* Ingest a text delta (the rAF-batched textBuffer content).
|
|
142
|
-
* Processes only complete lines; the trailing fragment is held until the
|
|
143
|
-
* next call or finalize().
|
|
144
|
-
*/
|
|
45
|
+
constructor(requestId: string, upsertAction: UpsertAction);
|
|
46
|
+
/** Ingest a text delta (the rAF-batched textBuffer content). */
|
|
145
47
|
ingest(delta: string, dispatch: DispatchFn): void;
|
|
146
|
-
/**
|
|
147
|
-
private flushQuoteLift;
|
|
148
|
-
private ingestText;
|
|
149
|
-
/**
|
|
150
|
-
* Flush remaining content and mark the final block as complete.
|
|
151
|
-
* Called once after the stream loop ends.
|
|
152
|
-
*/
|
|
48
|
+
/** The stream ended: every block becomes complete. Called once after the stream loop. */
|
|
153
49
|
finalize(dispatch: DispatchFn): void;
|
|
154
50
|
/**
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
* the local streaming state so the replacement provider attempt cannot
|
|
158
|
-
* concatenate onto or resurrect the failed attempt.
|
|
51
|
+
* The source bytes behind every live A7 wrapper split. The splitter's reading of the stored
|
|
52
|
+
* text is the reading every surface draws, so no live block stands for bytes it does not hold.
|
|
159
53
|
*/
|
|
160
|
-
/** The source bytes behind every live A7 wrapper split (see `wrapperSplits`). */
|
|
161
54
|
getWrapperSplitSources(): Array<{
|
|
162
55
|
blockIds: string[];
|
|
163
56
|
source: string;
|
|
164
57
|
}>;
|
|
58
|
+
/**
|
|
59
|
+
* Forget every in-flight byte at and after a durable content boundary (a provider retry).
|
|
60
|
+
* Redux owns removal of the already-dispatched suffix; the replacement attempt starts a fresh
|
|
61
|
+
* run at `blockCount`.
|
|
62
|
+
*/
|
|
165
63
|
rewindToBlockCount(blockCount: number): void;
|
|
166
64
|
/**
|
|
167
|
-
* Close the current text
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
* Why this exists: the accumulator lives for the whole stream and is never
|
|
173
|
-
* otherwise told about tool calls. Without this break, "text → tool → text"
|
|
174
|
-
* collapses both runs into a single `client_block_N`. The timeline still
|
|
175
|
-
* records a `text_end` for the second run, but its
|
|
176
|
-
* `[blockStartIndex, blockEndIndex)` range comes out EMPTY (no new blockId
|
|
177
|
-
* was pushed), so `selectUnifiedSlots` emits `[merged_text, tool]` — the
|
|
178
|
-
* tool card renders AFTER all the text, destroying chronological order.
|
|
179
|
-
* (The persisted/DB path is unaffected because it rebuilds each run's text
|
|
180
|
-
* from `text_end.rawText`, which is why a reload renders correctly.)
|
|
181
|
-
*
|
|
182
|
-
* Call this once per tool event, BEFORE the tool's `appendTimeline` dispatch
|
|
183
|
-
* and AFTER the pre-tool text has been flushed into the accumulator
|
|
184
|
-
* (process-stream's `dispatchBatch()` does that flush). It is a no-op when
|
|
185
|
-
* there is nothing open to break (back-to-back tool events, a tool with no
|
|
186
|
-
* preceding text, a tool right after a media block), so it is always safe.
|
|
65
|
+
* Close the current text run at an interleaved-content boundary (a tool call between two text
|
|
66
|
+
* runs): the next text opens fresh blocks after this run's, so "text → tool → text" keeps its
|
|
67
|
+
* chronological order. Reload splits each run's stored text on its own, and so does this.
|
|
68
|
+
* A no-op when nothing is open.
|
|
187
69
|
*/
|
|
188
70
|
breakTextBlock(dispatch: DispatchFn): void;
|
|
189
|
-
private
|
|
190
|
-
private
|
|
71
|
+
private endRun;
|
|
72
|
+
private sync;
|
|
73
|
+
private recordWrapperSplits;
|
|
74
|
+
private metadataFor;
|
|
75
|
+
/** Feed the open region's new bytes; reopen when the block is a different region. */
|
|
76
|
+
private feedRegion;
|
|
77
|
+
private openRegion;
|
|
78
|
+
/** End the open region; its final envelope is kept for the block it belongs to. */
|
|
79
|
+
private closeRegion;
|
|
80
|
+
private dropRegion;
|
|
81
|
+
private disposeAll;
|
|
82
|
+
/** `{` (or `[{`) with no key yet may become a JSON region next frame: draw nothing yet. */
|
|
83
|
+
private holdsNascentJson;
|
|
84
|
+
private frontMatterStillOpen;
|
|
85
|
+
private emit;
|
|
86
|
+
/** `data` as the renderer has always read it: a code block's language, a media block's link. */
|
|
87
|
+
private dataFor;
|
|
88
|
+
private signatureOf;
|
|
89
|
+
private retract;
|
|
191
90
|
private reportOrphanReasoningClose;
|
|
192
91
|
private reportUnclosedReasoningRegion;
|
|
193
|
-
private get currentBlockId();
|
|
194
|
-
private processLine;
|
|
195
|
-
/** The open bare-JSON region on this line is prose after all: drop its parse, keep its block as text. */
|
|
196
|
-
private demoteKindLineToProse;
|
|
197
|
-
/** Process queued lines in order (re-entrant calls return; the outer loop drains). */
|
|
198
|
-
private drainLineQueue;
|
|
199
|
-
/** Lines this accumulator has read (the first may open front matter). */
|
|
200
|
-
private linesRead;
|
|
201
|
-
private processLineNow;
|
|
202
|
-
/** Set while the next bare-JSON region opens as an array element (A6). */
|
|
203
|
-
private nextBareJsonInArray;
|
|
204
|
-
/** Set while the next bare-JSON region is a kind split out of a section (A8). */
|
|
205
|
-
private nextBareJsonResumeXml;
|
|
206
|
-
/** True while a split kind's earlier lines replay into its region (the XML tracker already saw them). */
|
|
207
|
-
private replayingSplitKind;
|
|
208
|
-
/**
|
|
209
|
-
* Track a JSON object inside a simple XML section; split it out the moment
|
|
210
|
-
* it carries a `__kind` key (A8). `line` is the section body part of a
|
|
211
|
-
* line. Returns true when the line was consumed by the split.
|
|
212
|
-
*/
|
|
213
|
-
private trackXmlKindCandidate;
|
|
214
|
-
/**
|
|
215
|
-
* Close the section's part before the kind (trimmed, like the reload's
|
|
216
|
-
* piece), then replay the kind's lines so far as a bare-JSON region that
|
|
217
|
-
* resumes the section when it balances (A8).
|
|
218
|
-
*/
|
|
219
|
-
private splitKindOutOfXmlSection;
|
|
220
|
-
/** The section a kind was split out of continues in a fresh block (A8). */
|
|
221
|
-
private resumeXmlSection;
|
|
222
|
-
/**
|
|
223
|
-
* Track a JSON object or JSON-family fence inside a generic XML container
|
|
224
|
-
* (an XML TAG — structure, ruling (b), round 3); split it out the moment its
|
|
225
|
-
* text carries a `__kind` key (X1). Returns true when the line was consumed.
|
|
226
|
-
*/
|
|
227
|
-
private trackGenericXmlKindCandidate;
|
|
228
|
-
/**
|
|
229
|
-
* Close the XML card's part before the kind, then replay the kind's lines
|
|
230
|
-
* so far as its own region (bare JSON or the JSON fence) that resumes the
|
|
231
|
-
* container when it closes (X1). The reload's recovery splits the same bytes.
|
|
232
|
-
*/
|
|
233
|
-
private splitKindOutOfGenericXml;
|
|
234
|
-
/** The fragment twin of the generic-XML split (X1): `<output>\n{"__kind":…` with no newline yet. */
|
|
235
|
-
private maybeSplitKindFromGenericXmlFragment;
|
|
236
|
-
/**
|
|
237
|
-
* The fragment twin of the section split: a newline-less kind object inside
|
|
238
|
-
* a simple section (`<info>{"__kind":…`) leaves it as soon as `__kind` is
|
|
239
|
-
* visible, and the fragment opens the region below (A8).
|
|
240
|
-
*/
|
|
241
|
-
private maybeSplitKindFromXmlFragment;
|
|
242
|
-
/**
|
|
243
|
-
* The held array start is a kind array: close the prose before it, drop the
|
|
244
|
-
* `[`, and replay the held lines as array content (A6).
|
|
245
|
-
*/
|
|
246
|
-
private commitKindArray;
|
|
247
|
-
/** Not a kind array after all: the held lines are ordinary lines, in order. */
|
|
248
|
-
private releaseHeldArray;
|
|
249
|
-
/**
|
|
250
|
-
* Array content between (or opening) elements: `,` and whitespace are
|
|
251
|
-
* chrome, `]` ends the array, `{` opens the next element as its own
|
|
252
|
-
* bare-JSON region. Anything else ends the array as ordinary source.
|
|
253
|
-
*/
|
|
254
|
-
private continueKindArray;
|
|
255
|
-
/**
|
|
256
|
-
* The fragment twin of the array entry in processLineNow: a newline-less
|
|
257
|
-
* `[{"__kind":…` decides on its first key while it streams (A6).
|
|
258
|
-
*/
|
|
259
|
-
private maybeEnterKindArrayFromFragment;
|
|
260
|
-
/** The fragment twin of the complete-line split in processLineNow (A5). */
|
|
261
|
-
private maybeSplitProseBeforeKindFragment;
|
|
262
|
-
/**
|
|
263
|
-
* Open a bare_json region directly from the trailing line fragment — the
|
|
264
|
-
* newline-less minified JSON case (`{"__kind":…}` streamed as one line with
|
|
265
|
-
* no `\n` until the end). Without this, processLine (which only sees COMPLETE
|
|
266
|
-
* lines) never opens the region and the raw JSON projects as a text block
|
|
267
|
-
* until finalize — the "shows the whole JSON, converts only when done" bug.
|
|
268
|
-
*
|
|
269
|
-
* Mirrors processLine's bare-JSON branch but fragment-driven: it commits the
|
|
270
|
-
* moment the fragment reveals `{ "key":` (unambiguous JSON), retracting the
|
|
271
|
-
* speculative text projection of those same chars, and lets the existing
|
|
272
|
-
* fragment-feed path (in ingest) and finalize/newline completion carry the
|
|
273
|
-
* region the rest of the way. openBraces/closeBraces start at 0 — the
|
|
274
|
-
* completing line counts them exactly once (see the bare_json substate case).
|
|
275
|
-
*/
|
|
276
|
-
private maybeOpenBareJsonFromFragment;
|
|
277
|
-
private processSubStateLine;
|
|
278
|
-
private openXmlTagBlock;
|
|
279
|
-
private irOpenRegion;
|
|
280
|
-
/**
|
|
281
|
-
* Feed region text. `part` is either the unfed remainder of a completing
|
|
282
|
-
* line (isLineComplete) or a pendingLineFragment delta (streaming chars of
|
|
283
|
-
* a line that hasn't finished — how minified single-line JSON gets live
|
|
284
|
-
* parsing instead of waiting for a newline).
|
|
285
|
-
*/
|
|
286
|
-
private irWriteLinePart;
|
|
287
|
-
/** Complete a region line, accounting for any fragment chars already fed. */
|
|
288
|
-
private irFeedLine;
|
|
289
|
-
/** End the open region: final envelope + shadow parity telemetry. */
|
|
290
|
-
private irCloseRegion;
|
|
291
|
-
/**
|
|
292
|
-
* Open an ir region for the JSON BODY of an attribute-XML block.
|
|
293
|
-
*
|
|
294
|
-
* THE WRAPPED-PAYLOAD CLASS. A structured-output agent whose answer is
|
|
295
|
-
* wrapped by the artifact system arrives as
|
|
296
|
-
*
|
|
297
|
-
* <artifact type="flashcards" id="…" title="…">
|
|
298
|
-
* {"__kind":"flashcard_set","cards":[…]}
|
|
299
|
-
* </artifact>
|
|
300
|
-
*
|
|
301
|
-
* The accumulator opens ir regions for fences and for bare JSON, but an
|
|
302
|
-
* attr-XML region swallowed every body line whole — no region, no
|
|
303
|
-
* `metadata.__ir`, so `selectKindEnvelope` answered null for the entire run
|
|
304
|
-
* AND after it. Every surface reading the envelope (the flashcard
|
|
305
|
-
* card-by-card preview, D170's `<image_prompt>` step) therefore showed a
|
|
306
|
-
* spinner over a stream that was arriving perfectly. The wrapper is not the
|
|
307
|
-
* payload: parse the body exactly as a bare JSON region.
|
|
308
|
-
*
|
|
309
|
-
* Rendering is deliberately UNCHANGED — the artifact block keeps the
|
|
310
|
-
* artifact renderer (kind-route.ts refuses to re-type an artifact); the
|
|
311
|
-
* envelope is attached for selectors, which is what was missing.
|
|
312
|
-
*
|
|
313
|
-
* `part` is a whole body line (isLineComplete) or the streaming fragment of
|
|
314
|
-
* one, so a minified single-line body parses live instead of at the close.
|
|
315
|
-
*/
|
|
316
|
-
private maybeOpenXmlBodyIrRegion;
|
|
317
|
-
private irParityCheck;
|
|
318
|
-
/** Dispose all sessions this stream opened (finalize-time cleanup). */
|
|
319
|
-
private irDisposeAll;
|
|
320
|
-
private appendToCurrentBlock;
|
|
321
|
-
private closeCurrentBlock;
|
|
322
|
-
/**
|
|
323
|
-
* A surrounding Markdown/code/XML classification never outranks an inner
|
|
324
|
-
* complete object carrying `__kind`. Replace the formerly monolithic Redux
|
|
325
|
-
* block with lossless container fragments plus independently routable JSON
|
|
326
|
-
* blocks. The first fragment reuses the already-streamed block id; later
|
|
327
|
-
* fragments take consecutive ids, so the next ordinary openBlock continues
|
|
328
|
-
* at the correct document position.
|
|
329
|
-
*/
|
|
330
|
-
private emitRecoveredEmbeddedKindBlocks;
|
|
331
|
-
/**
|
|
332
|
-
* Overwrites the block at the current index with an empty, completed payload
|
|
333
|
-
* so a previously-projected speculative streaming block is removed from the
|
|
334
|
-
* rendered output. Keyed by `currentBlockId`, so it replaces the exact
|
|
335
|
-
* Redux entry the speculative projection created.
|
|
336
|
-
*/
|
|
337
|
-
private retractCurrentBlock;
|
|
338
|
-
private openBlock;
|
|
339
|
-
private emitCurrentBlock;
|
|
340
|
-
/**
|
|
341
|
-
* Builds metadata for the block currently being emitted.
|
|
342
|
-
*
|
|
343
|
-
* Critical for attribute-XML tags (`<decision>`, `<artifact>`, `<editor_*>`):
|
|
344
|
-
* BlockRenderer reads `metadata.decision` / `metadata.artifactId` /
|
|
345
|
-
* `metadata.rawXml` etc. and falls back to raw-markdown rendering when those
|
|
346
|
-
* are missing — which is exactly the bug we're fixing (decision tags
|
|
347
|
-
* appearing as plain text mid-stream because metadata was hard-coded to
|
|
348
|
-
* `undefined` here previously).
|
|
349
|
-
*
|
|
350
|
-
* For simple XML tags we emit `{ isComplete, rawXml }` so consumers (loaders,
|
|
351
|
-
* inline-edit flows) can both gate on completion and round-trip the source.
|
|
352
|
-
*/
|
|
353
|
-
private buildBlockMetadata;
|
|
354
|
-
private buildXmlBlockMetadata;
|
|
355
|
-
private buildBlockData;
|
|
356
92
|
}
|
|
357
93
|
export {};
|