zidane-ui 9.2.2 → 9.3.1
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/dist/adapters/browser-keybindings-host.js +3 -1
- package/dist/adapters/live.d.ts +6 -0
- package/dist/adapters/live.js +16 -8
- package/dist/adapters/server-composer-host.js +22 -9
- package/dist/adapters/server-host.js +143 -18
- package/dist/adapters/server-media.d.ts +9 -1
- package/dist/adapters/server-media.js +14 -1
- package/dist/adapters/server-settings-host.js +30 -3
- package/dist/adapters/server-settings-sections.js +23 -1
- package/dist/adapters/server-sidebar-host.d.ts +3 -1
- package/dist/adapters/server-sidebar-host.js +10 -1
- package/dist/app/ModalProvider.js +1 -1
- package/dist/approvals/ApprovalShell.js +1 -1
- package/dist/chat/DaemonOrb.d.ts +29 -1
- package/dist/chat/DaemonOrb.js +25 -12
- package/dist/chat/HostTranscript.d.ts +0 -12
- package/dist/chat/HostTranscript.js +6 -1
- package/dist/chat/SessionStreamsProvider.d.ts +8 -0
- package/dist/chat/SessionStreamsProvider.js +11 -2
- package/dist/chat/StatusDot.js +8 -2
- package/dist/chat/Transcript.d.ts +20 -11
- package/dist/chat/Transcript.js +335 -162
- package/dist/chat/composer/ComposerEditor.js +1 -1
- package/dist/chat/headless/host.d.ts +43 -7
- package/dist/chat/headless/index.d.ts +8 -6
- package/dist/chat/headless/index.js +11 -9
- package/dist/chat/headless/labels.d.ts +30 -0
- package/dist/chat/headless/labels.js +29 -0
- package/dist/chat/headless/markdown-chunks.d.ts +2 -1
- package/dist/chat/headless/markdown-chunks.js +12 -20
- package/dist/chat/headless/markdown-scan.d.ts +66 -0
- package/dist/chat/headless/markdown-scan.js +124 -0
- package/dist/chat/headless/markdown-stream.d.ts +64 -0
- package/dist/chat/headless/markdown-stream.js +143 -0
- package/dist/chat/headless/output-pager.d.ts +68 -0
- package/dist/chat/headless/output-pager.js +113 -0
- package/dist/chat/headless/session-list.d.ts +20 -0
- package/dist/chat/headless/sidebar/activity.d.ts +14 -0
- package/dist/chat/headless/sidebar/activity.js +32 -0
- package/dist/chat/headless/sidebar/directory.d.ts +17 -2
- package/dist/chat/headless/sidebar/directory.js +50 -54
- package/dist/chat/headless/sidebar/environment.d.ts +5 -2
- package/dist/chat/headless/sidebar/environment.js +11 -2
- package/dist/chat/headless/sidebar/host.d.ts +15 -0
- package/dist/chat/headless/sidebar/inbox.d.ts +12 -3
- package/dist/chat/headless/sidebar/inbox.js +18 -9
- package/dist/chat/headless/sidebar/index.d.ts +2 -2
- package/dist/chat/headless/sidebar/index.js +2 -2
- package/dist/chat/headless/sidebar/labels.d.ts +38 -2
- package/dist/chat/headless/sidebar/labels.js +16 -0
- package/dist/chat/headless/sidebar/prewarm.d.ts +68 -0
- package/dist/chat/headless/sidebar/prewarm.js +114 -0
- package/dist/chat/headless/streams/actions.d.ts +2 -0
- package/dist/chat/headless/streams/actions.js +1 -0
- package/dist/chat/headless/streams/event-bytes.d.ts +6 -0
- package/dist/chat/headless/streams/event-bytes.js +34 -0
- package/dist/chat/headless/streams/live-events.d.ts +25 -1
- package/dist/chat/headless/streams/live-events.js +53 -2
- package/dist/chat/headless/streams/selectors.d.ts +3 -0
- package/dist/chat/headless/streams/selectors.js +8 -1
- package/dist/chat/headless/streams/session-streams.d.ts +15 -3
- package/dist/chat/headless/streams/session-streams.js +31 -3
- package/dist/chat/headless/streams/store.d.ts +24 -1
- package/dist/chat/headless/streams/store.js +51 -26
- package/dist/chat/headless/streams/transcript-map.d.ts +57 -0
- package/dist/chat/headless/streams/transcript-map.js +88 -0
- package/dist/chat/headless/streams/transcript.d.ts +4 -2
- package/dist/chat/headless/streams/transcript.js +19 -7
- package/dist/chat/headless/transcript/batch.js +5 -1
- package/dist/chat/headless/transcript/blob-media.d.ts +15 -0
- package/dist/chat/headless/transcript/blob-media.js +23 -0
- package/dist/chat/headless/transcript/collapse.d.ts +10 -0
- package/dist/chat/headless/transcript/collapse.js +32 -6
- package/dist/chat/headless/transcript/derive.d.ts +98 -0
- package/dist/chat/headless/transcript/derive.js +89 -0
- package/dist/chat/headless/transcript/exchange-media.d.ts +3 -1
- package/dist/chat/headless/transcript/exchange-media.js +8 -5
- package/dist/chat/headless/transcript/fold-actions.d.ts +8 -3
- package/dist/chat/headless/transcript/fold-actions.js +16 -0
- package/dist/chat/headless/transcript/fold-attachments.d.ts +2 -0
- package/dist/chat/headless/transcript/fold-attachments.js +3 -2
- package/dist/chat/headless/transcript/fold.d.ts +4 -2
- package/dist/chat/headless/transcript/fold.js +37 -7
- package/dist/chat/headless/transcript/incremental.d.ts +53 -0
- package/dist/chat/headless/transcript/incremental.js +181 -0
- package/dist/chat/headless/transcript/index.d.ts +2 -1
- package/dist/chat/headless/transcript/index.js +2 -1
- package/dist/chat/headless/transcript/nesting.js +2 -1
- package/dist/chat/headless/transcript/rail.d.ts +142 -0
- package/dist/chat/headless/transcript/rail.js +290 -0
- package/dist/chat/headless/transcript/rows.d.ts +11 -1
- package/dist/chat/headless/transcript/run-failures.d.ts +4 -0
- package/dist/chat/headless/transcript/run-failures.js +31 -2
- package/dist/chat/headless/transcript/seams.d.ts +78 -0
- package/dist/chat/headless/transcript/seams.js +116 -0
- package/dist/chat/headless/transcript/tool-media.d.ts +6 -7
- package/dist/chat/headless/transcript/tool-media.js +27 -9
- package/dist/chat/headless/transcript-labels.d.ts +1 -0
- package/dist/chat/headless/turn-labels.d.ts +1 -0
- package/dist/chat/headless/turn-labels.js +2 -1
- package/dist/chat/index.d.ts +10 -8
- package/dist/chat/index.js +9 -7
- package/dist/chat/interactions/ElicitationCard.js +1 -1
- package/dist/chat/interactions/InteractionCard.js +1 -1
- package/dist/chat/interactions/PlanCard.js +3 -3
- package/dist/chat/interactions/QuestionField.js +4 -4
- package/dist/chat/interactions/QuestionForm.js +3 -3
- package/dist/chat/interactions/SecretInput.js +1 -1
- package/dist/chat/sidebar/ProjectIcon.d.ts +1 -1
- package/dist/chat/sidebar/ProjectIcon.js +1 -1
- package/dist/chat/sidebar/RowChips.d.ts +3 -2
- package/dist/chat/sidebar/RowChips.js +6 -3
- package/dist/chat/sidebar/SessionSidebar.js +13 -14
- package/dist/chat/sidebar/SidebarFooter.d.ts +8 -5
- package/dist/chat/sidebar/SidebarFooter.js +6 -6
- package/dist/chat/sidebar/SidebarFrame.d.ts +2 -0
- package/dist/chat/sidebar/SidebarFrame.js +5 -2
- package/dist/chat/sidebar/SidebarSessionRow.d.ts +3 -1
- package/dist/chat/sidebar/SidebarSessionRow.js +3 -1
- package/dist/chat/sidebar/SpacesSection.d.ts +20 -1
- package/dist/chat/sidebar/SpacesSection.js +34 -13
- package/dist/chat/sidebar/index.d.ts +2 -2
- package/dist/chat/sidebar/session-menu.d.ts +11 -2
- package/dist/chat/sidebar/session-menu.js +50 -5
- package/dist/chat/sidebar/sidebar-live.js +1 -1
- package/dist/chat/sidebar/useInboxRows.js +43 -2
- package/dist/chat/sidebar/useInboxTriage.js +19 -14
- package/dist/chat/testing/contract.d.ts +5 -3
- package/dist/chat/testing/contract.js +66 -1
- package/dist/chat/testing/fixture-sidebar-host.d.ts +7 -1
- package/dist/chat/testing/fixture-sidebar-host.js +12 -0
- package/dist/chat/testing/sidebar.contract.d.ts +6 -0
- package/dist/chat/testing/sidebar.contract.js +24 -0
- package/dist/chat/transcript/DiffLines.d.ts +6 -1
- package/dist/chat/transcript/DiffLines.js +35 -20
- package/dist/chat/transcript/EditDiffBlock.d.ts +5 -1
- package/dist/chat/transcript/EditDiffBlock.js +89 -30
- package/dist/chat/transcript/InteractionToolBody.js +1 -1
- package/dist/chat/transcript/LazyRow.d.ts +40 -40
- package/dist/chat/transcript/LazyRow.js +101 -149
- package/dist/chat/transcript/MermaidDiagram.js +2 -1
- package/dist/chat/transcript/SelectCursor.d.ts +11 -1
- package/dist/chat/transcript/SelectCursor.js +10 -5
- package/dist/chat/transcript/SubagentBlock.js +3 -2
- package/dist/chat/transcript/TranscriptRail.d.ts +109 -0
- package/dist/chat/transcript/TranscriptRail.js +579 -0
- package/dist/chat/transcript/TranscriptRow.d.ts +4 -7
- package/dist/chat/transcript/TranscriptRow.js +9 -5
- package/dist/chat/transcript/actions.d.ts +43 -3
- package/dist/chat/transcript/actions.js +27 -1
- package/dist/chat/transcript/clipped-output.d.ts +58 -0
- package/dist/chat/transcript/clipped-output.js +131 -0
- package/dist/chat/transcript/fold-attachments.js +10 -5
- package/dist/chat/transcript/fold-worker.js +3 -2
- package/dist/chat/transcript/fold.js +21 -2
- package/dist/chat/transcript/index.d.ts +11 -9
- package/dist/chat/transcript/index.js +10 -8
- package/dist/chat/transcript/markdown-cache.d.ts +7 -1
- package/dist/chat/transcript/markdown-cache.js +12 -1
- package/dist/chat/transcript/markdown.js +116 -54
- package/dist/chat/transcript/media-gallery.d.ts +3 -2
- package/dist/chat/transcript/media-gallery.js +10 -7
- package/dist/chat/transcript/notices.d.ts +23 -1
- package/dist/chat/transcript/notices.js +110 -28
- package/dist/chat/transcript/prompt.js +6 -4
- package/dist/chat/transcript/prose.js +3 -1
- package/dist/chat/transcript/receipt-parts.d.ts +22 -0
- package/dist/chat/transcript/receipt-parts.js +87 -0
- package/dist/chat/transcript/root-items.d.ts +96 -0
- package/dist/chat/transcript/root-items.js +180 -0
- package/dist/chat/transcript/row-mount.d.ts +165 -0
- package/dist/chat/transcript/row-mount.js +498 -0
- package/dist/chat/transcript/row-parking.d.ts +125 -0
- package/dist/chat/transcript/row-parking.js +135 -0
- package/dist/chat/transcript/row-ui-state.d.ts +37 -0
- package/dist/chat/transcript/row-ui-state.js +53 -0
- package/dist/chat/transcript/run-rows.js +6 -78
- package/dist/chat/transcript/script-input.d.ts +1 -1
- package/dist/chat/transcript/scroll-clamp.js +1 -1
- package/dist/chat/transcript/tasks.js +3 -2
- package/dist/chat/transcript/tool-media.d.ts +4 -2
- package/dist/chat/transcript/tool-media.js +15 -7
- package/dist/chat/transcript/tool-parts.d.ts +27 -4
- package/dist/chat/transcript/tool-parts.js +31 -5
- package/dist/chat/transcript/tool-payload.js +26 -11
- package/dist/chat/transcript/tool-row.d.ts +2 -1
- package/dist/chat/transcript/tool-row.js +38 -19
- package/dist/chat/transcript/use-transcript-rows.d.ts +24 -7
- package/dist/chat/transcript/use-transcript-rows.js +28 -46
- package/dist/chat/transcript/useSettledReveal.js +15 -3
- package/dist/chat/transcript/useStickToBottom.js +4 -4
- package/dist/chat/transcript/useTranscriptSearch.js +30 -14
- package/dist/chat/transcript/view-scope.d.ts +26 -6
- package/dist/chat/transcript/view-scope.js +106 -20
- package/dist/components/ChoiceCards.js +1 -1
- package/dist/components/ConfirmDialog.js +1 -1
- package/dist/components/CopyValue.d.ts +33 -0
- package/dist/components/CopyValue.js +54 -0
- package/dist/components/Form.js +1 -1
- package/dist/components/HowItWorks.js +1 -1
- package/dist/components/Menu.js +1 -1
- package/dist/components/StepFrame.js +2 -2
- package/dist/components/SwatchPicker.js +1 -1
- package/dist/components/ToggleCard.js +1 -1
- package/dist/components/floating/HoverCard.js +2 -3
- package/dist/components/floating/hover-delay.d.ts +4 -0
- package/dist/components/floating/hover-delay.js +6 -0
- package/dist/core.css +14 -12
- package/dist/dist/{index-Betz0OWq.d.ts → index-C6-t1SS9.d.ts} +21 -2
- package/dist/dist/index-De9AbmxS.d.ts +1 -0
- package/dist/dist/index.d.ts +5 -5
- package/dist/dist/sandbox-CSUihARm.d.ts +2 -0
- package/dist/dist/{timeout-CyU7HLyz.d.ts → timeout-CmTx6V9y.d.ts} +1 -0
- package/dist/extensions/ExtensionDialogHost.js +1 -1
- package/dist/files/TreeColumn.js +3 -1
- package/dist/files/headless/host.d.ts +2 -2
- package/dist/git/ImportRepoDialog.js +1 -1
- package/dist/git/MoveSessionDialog.js +2 -2
- package/dist/git/SandboxManager.d.ts +42 -0
- package/dist/git/SandboxManager.js +297 -0
- package/dist/git/SyncChip.js +1 -1
- package/dist/git/headless/index.d.ts +2 -1
- package/dist/git/headless/index.js +2 -1
- package/dist/git/headless/labels.d.ts +29 -0
- package/dist/git/headless/labels.js +34 -1
- package/dist/git/headless/sandboxes.d.ts +43 -0
- package/dist/git/headless/sandboxes.js +52 -0
- package/dist/git/index.d.ts +2 -1
- package/dist/git/index.js +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/keybindings/headless/catalog.d.ts +1 -1
- package/dist/keybindings/headless/catalog.js +12 -0
- package/dist/machines/HostsSection.d.ts +1 -1
- package/dist/machines/headless/labels.js +2 -2
- package/dist/motion/flip-list.js +3 -10
- package/dist/motion/presence.d.ts +10 -0
- package/dist/motion/presence.js +20 -1
- package/dist/motion/swap.d.ts +8 -2
- package/dist/motion/swap.js +5 -2
- package/dist/onboarding/conversation.js +27 -15
- package/dist/onboarding/demos/how-it-works.js +1 -1
- package/dist/onboarding/skills/parts.js +4 -4
- package/dist/onboarding/sources/SourceBrowser.js +1 -1
- package/dist/onboarding/steps/ReadyStep.js +1 -1
- package/dist/onboarding/steps/connect/KeyForm.js +1 -1
- package/dist/palette/headless/app-sources.js +20 -0
- package/dist/palette/headless/labels.js +2 -0
- package/dist/session/PlanTracker.js +3 -3
- package/dist/session/SecretsPanel.js +1 -1
- package/dist/session/SessionHeader.d.ts +18 -6
- package/dist/session/SessionHeader.js +68 -12
- package/dist/session/SessionPlaceMenu.d.ts +35 -0
- package/dist/session/SessionPlaceMenu.js +299 -0
- package/dist/session/SessionShell.js +1 -1
- package/dist/session/TurnDetailsDialog.js +1 -1
- package/dist/session/headless/index.d.ts +2 -1
- package/dist/session/headless/index.js +2 -1
- package/dist/session/headless/labels.d.ts +73 -0
- package/dist/session/headless/labels.js +73 -0
- package/dist/session/headless/place.d.ts +49 -0
- package/dist/session/headless/place.js +57 -0
- package/dist/session/index.d.ts +2 -1
- package/dist/session/index.js +2 -1
- package/dist/settings/ConversationPresetsCard.js +1 -1
- package/dist/settings/SettingCard.js +2 -2
- package/dist/settings/SettingsRowsPage.js +1 -1
- package/dist/settings/headless/fixture-performance.js +4 -2
- package/dist/settings/headless/fixture-sections.js +7 -0
- package/dist/settings/headless/labels.d.ts +1 -1
- package/dist/settings/headless/labels.js +1 -1
- package/dist/settings/headless/layout.d.ts +4 -4
- package/dist/settings/headless/layout.js +1 -1
- package/dist/settings/headless/performance.d.ts +4 -0
- package/dist/settings/headless/search.d.ts +2 -2
- package/dist/settings/headless/sections-host.d.ts +20 -2
- package/dist/settings/sections/claude-import/ClaudeImportDialog.js +1 -1
- package/dist/settings/sections/enabled-list/EnabledListSection.js +2 -2
- package/dist/settings/sections/environments/EnvironmentsSection.d.ts +9 -3
- package/dist/settings/sections/environments/EnvironmentsSection.js +292 -52
- package/dist/settings/sections/environments/labels.d.ts +15 -0
- package/dist/settings/sections/environments/labels.js +18 -3
- package/dist/settings/sections/extensions/ChangeOriginDialog.js +1 -1
- package/dist/settings/sections/extensions/ExtensionSourceBrowser.js +1 -1
- package/dist/settings/sections/extensions/ExtensionsSection.d.ts +3 -2
- package/dist/settings/sections/extensions/ExtensionsSection.js +9 -3
- package/dist/settings/sections/host-catalog/HostCatalogSection.js +15 -5
- package/dist/settings/sections/keybindings/labels.d.ts +2 -0
- package/dist/settings/sections/keybindings/labels.js +2 -0
- package/dist/settings/sections/keybindings/rows.js +8 -0
- package/dist/settings/sections/models/SpacesDefaultsSection.d.ts +7 -3
- package/dist/settings/sections/models/SpacesDefaultsSection.js +11 -5
- package/dist/settings/sections/performance/PerformanceSection.js +8 -1
- package/dist/settings/sections/performance/labels.d.ts +2 -0
- package/dist/settings/sections/performance/labels.js +2 -0
- package/dist/settings/sections/skills/SkillGroups.js +1 -1
- package/dist/settings/server-app.d.ts +4 -2
- package/dist/settings/server-app.js +7 -3
- package/dist/settings/testing/sections.contract.d.ts +7 -1
- package/dist/settings/testing/sections.contract.js +37 -0
- package/dist/styles.css +243 -19
- package/dist/terminal/TerminalDrawer.js +3 -1
- package/dist/views/headless/answers.d.ts +8 -2
- package/dist/views/headless/answers.js +58 -1
- package/dist/views/headless/placement.d.ts +78 -0
- package/dist/views/headless/placement.js +154 -44
- package/dist/workspace/SidePanel.js +3 -1
- package/package.json +2 -2
- package/src/styles/base.css +13 -0
- package/src/styles/chat.css +30 -0
- package/src/styles/components.css +0 -10
- package/src/styles/files.css +5 -0
- package/src/styles/sidebar.css +29 -7
- package/src/styles/terminal.css +6 -0
- package/src/styles/tokens.css +5 -0
- package/src/styles/transcript.css +138 -0
- package/src/styles/workspace.css +6 -0
- package/dist/dist/index-QcFzZlao.d.ts +0 -1
- package/dist/dist/sandbox-D0zsW8I1.d.ts +0 -2
- /package/dist/dist/{types-_Dtoq_No.d.ts → execution-failure-SREfl-EZ.d.ts} +0 -0
|
@@ -3,14 +3,16 @@ import { useStaysMounted } from "../../motion/collapse.js";
|
|
|
3
3
|
import { useChatLabels } from "../useChatLabels.js";
|
|
4
4
|
import { useModelName } from "./actions.js";
|
|
5
5
|
import { AnsiText } from "./AnsiText.js";
|
|
6
|
+
import { ClippedOutputControls, useClippedOutput } from "./clipped-output.js";
|
|
6
7
|
import { EditDiffBlock } from "./EditDiffBlock.js";
|
|
7
8
|
import { Caret, FailedMark } from "./frame.js";
|
|
8
9
|
import { ImageGenerationBlock, drawsImageGeneration } from "./ImageGenerationBlock.js";
|
|
9
10
|
import { useTranscriptRenderers } from "./renderers.js";
|
|
10
11
|
import { Rolling } from "./rolling.js";
|
|
12
|
+
import { useRowUiState } from "./row-ui-state.js";
|
|
11
13
|
import { scriptInputProps } from "./script-input.js";
|
|
12
14
|
import { ToolMedia, useToolMedia } from "./tool-media.js";
|
|
13
|
-
import { CODE_PANEL, LoadFullOutputButton, ReadFileBlock, ToolGlyph, ToolInput, ToolTiming,
|
|
15
|
+
import { CODE_PANEL, LoadFullOutputButton, ReadFileBlock, ToolGlyph, ToolInput, ToolTiming, useFullToolCall } from "./tool-parts.js";
|
|
14
16
|
import { Fragment, memo, useEffect, useMemo, useState } from "react";
|
|
15
17
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
16
18
|
import { computeLineDiff, isMcpJobDone, scriptProgressView } from "zidane/chat/pure";
|
|
@@ -27,7 +29,7 @@ function toolRowPropsEqual(prev, next) {
|
|
|
27
29
|
if (prev.mode !== next.mode || prev.showResult !== next.showResult || prev.showDiff !== next.showDiff || prev.lineState !== next.lineState || prev.className !== next.className || prev.style !== next.style) return false;
|
|
28
30
|
const a = prev.tool;
|
|
29
31
|
const b = next.tool;
|
|
30
|
-
return a.name === b.name && a.displayName === b.displayName && a.result === b.result && a.ok === b.ok && a.edit === b.edit && a.rawInput === b.rawInput && a.resultClipped === b.resultClipped && a.callId === b.callId && a.startedAt === b.startedAt && a.durationMs === b.durationMs && a.waitingFor === b.waitingFor && a.resuming === b.resuming && a.scriptProgress === b.scriptProgress && a.mcpJob === b.mcpJob && a.approval === b.approval && formattedEqual(a.formatted, b.formatted);
|
|
32
|
+
return a.name === b.name && a.displayName === b.displayName && a.result === b.result && a.ok === b.ok && a.edit === b.edit && a.rawInput === b.rawInput && a.resultClipped === b.resultClipped && a.inputClipped === b.inputClipped && a.callId === b.callId && a.turnId === b.turnId && a.startedAt === b.startedAt && a.durationMs === b.durationMs && a.waitingFor === b.waitingFor && a.resuming === b.resuming && a.scriptProgress === b.scriptProgress && a.mcpJob === b.mcpJob && a.approval === b.approval && formattedEqual(a.formatted, b.formatted);
|
|
31
33
|
}
|
|
32
34
|
function formattedEqual(a, b) {
|
|
33
35
|
if (a === b) return true;
|
|
@@ -89,10 +91,21 @@ const ToolRow = memo(({ tool, mode, showResult, showDiff, lineState, className,
|
|
|
89
91
|
const labels = useChatLabels();
|
|
90
92
|
const display = useDisplayPath();
|
|
91
93
|
const { SessionTitle, ToolBody, hasToolBody } = useTranscriptRenderers();
|
|
92
|
-
const [open, setOpen] =
|
|
94
|
+
const [open, setOpen] = useRowUiState(`tool:${tool.id}`, false);
|
|
93
95
|
/** Output revealed on demand while the "Tool outputs" setting is off. */
|
|
94
|
-
const [revealOutput, setRevealOutput] =
|
|
95
|
-
const
|
|
96
|
+
const [revealOutput, setRevealOutput] = useRowUiState(`tool-output:${tool.id}`, false);
|
|
97
|
+
const clippedOutput = useClippedOutput(tool);
|
|
98
|
+
const fullResult = clippedOutput.text;
|
|
99
|
+
const { full: fullCall, load: loadFullCall, available: canLoadCall, ready: callReady } = useFullToolCall(tool);
|
|
100
|
+
const input = fullCall !== "loading" && fullCall?.input ? fullCall.input : tool.rawInput;
|
|
101
|
+
const loadInputButton = tool.inputClipped && canLoadCall && (fullCall === null || fullCall === "loading") && /* @__PURE__ */ jsx(LoadFullOutputButton, {
|
|
102
|
+
loading: fullCall === "loading",
|
|
103
|
+
disabled: !callReady,
|
|
104
|
+
onClick: loadFullCall,
|
|
105
|
+
className: "mt-1.5",
|
|
106
|
+
label: labels.loadFullInput,
|
|
107
|
+
loadingLabel: labels.loadingFullInput
|
|
108
|
+
});
|
|
96
109
|
const bodyMounted = useStaysMounted(open);
|
|
97
110
|
const media = useToolMedia(tool, typeof fullResult === "string" ? fullResult : tool.result);
|
|
98
111
|
const hasDiff = showDiff && tool.edit;
|
|
@@ -119,10 +132,8 @@ const ToolRow = memo(({ tool, mode, showResult, showDiff, lineState, className,
|
|
|
119
132
|
const scriptInline = showInputPanel && tool.name === "codemode" && tool.scriptProgress !== void 0;
|
|
120
133
|
const hasExpandable = interaction || showInputPanel || hasOutput || mode === "full" && tool.rawInput || hasDiff;
|
|
121
134
|
const sweep = lineState === "running" && !tool.waitingFor;
|
|
122
|
-
const outputBody = showOutputPanel ? /* @__PURE__ */ jsxs(Fragment$1, { children: [bodyMounted &&
|
|
123
|
-
|
|
124
|
-
disabled: !fullReady,
|
|
125
|
-
onClick: loadFullResult,
|
|
135
|
+
const outputBody = showOutputPanel ? /* @__PURE__ */ jsxs(Fragment$1, { children: [bodyMounted && tool.resultClipped && /* @__PURE__ */ jsx(ClippedOutputControls, {
|
|
136
|
+
output: clippedOutput,
|
|
126
137
|
className: "mt-1.5"
|
|
127
138
|
}), !bodyMounted ? null : media ? /* @__PURE__ */ jsxs("div", {
|
|
128
139
|
className: "mt-1.5 flex flex-col gap-1.5",
|
|
@@ -230,7 +241,11 @@ const ToolRow = memo(({ tool, mode, showResult, showDiff, lineState, className,
|
|
|
230
241
|
"data-open": open,
|
|
231
242
|
children: /* @__PURE__ */ jsx("div", {
|
|
232
243
|
className: "zg-collapsible-inner",
|
|
233
|
-
children: bodyMounted && /* @__PURE__ */ jsx(EditDiffBlock, {
|
|
244
|
+
children: bodyMounted && /* @__PURE__ */ jsx(EditDiffBlock, {
|
|
245
|
+
edit: tool.edit,
|
|
246
|
+
...tool.callId ? { callId: tool.callId } : {},
|
|
247
|
+
...tool.turnId ? { turnId: tool.turnId } : {}
|
|
248
|
+
})
|
|
234
249
|
})
|
|
235
250
|
}),
|
|
236
251
|
interaction && ToolBody && /* @__PURE__ */ jsx("div", {
|
|
@@ -249,12 +264,16 @@ const ToolRow = memo(({ tool, mode, showResult, showDiff, lineState, className,
|
|
|
249
264
|
"data-open": open,
|
|
250
265
|
children: /* @__PURE__ */ jsx("div", {
|
|
251
266
|
className: "zg-collapsible-inner",
|
|
252
|
-
children: bodyMounted && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
267
|
+
children: bodyMounted && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
268
|
+
showOutputPanel && !scriptInline && /* @__PURE__ */ jsx(PanelCaption, { children: labels.inputCaption }),
|
|
269
|
+
/* @__PURE__ */ jsx(ToolInput, {
|
|
270
|
+
name: tool.name,
|
|
271
|
+
input,
|
|
272
|
+
...scriptInputProps(tool),
|
|
273
|
+
...scriptInline && outputBody ? { output: outputBody } : {}
|
|
274
|
+
}),
|
|
275
|
+
loadInputButton
|
|
276
|
+
] })
|
|
258
277
|
})
|
|
259
278
|
}),
|
|
260
279
|
hasOutput && !showOutputPanel && /* @__PURE__ */ jsx("div", {
|
|
@@ -283,11 +302,11 @@ const ToolRow = memo(({ tool, mode, showResult, showDiff, lineState, className,
|
|
|
283
302
|
"data-open": open,
|
|
284
303
|
children: /* @__PURE__ */ jsx("div", {
|
|
285
304
|
className: "zg-collapsible-inner",
|
|
286
|
-
children: bodyMounted && /* @__PURE__ */ jsx(ToolInput, {
|
|
305
|
+
children: bodyMounted && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ToolInput, {
|
|
287
306
|
name: tool.name,
|
|
288
|
-
input: tool.rawInput,
|
|
307
|
+
input: input ?? tool.rawInput,
|
|
289
308
|
...scriptInputProps(tool)
|
|
290
|
-
})
|
|
309
|
+
}), loadInputButton] })
|
|
291
310
|
})
|
|
292
311
|
})
|
|
293
312
|
]
|
|
@@ -2,7 +2,8 @@ import { ChatEvent } from "../headless/host.js";
|
|
|
2
2
|
import { Cluster, Row } from "../headless/transcript/rows.js";
|
|
3
3
|
import { SelectStops } from "../headless/transcript/select-stops.js";
|
|
4
4
|
import "../headless/transcript/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { TranscriptRowsSlice } from "../headless/transcript/incremental.js";
|
|
6
|
+
import { RunReceipt, TranscriptEvents } from "zidane/chat/pure";
|
|
6
7
|
/** The display options that shape the rows. */
|
|
7
8
|
export interface TranscriptRowsInput {
|
|
8
9
|
/** Show cache notices (cache expired / break, dropped reasoning). */
|
|
@@ -30,15 +31,30 @@ export interface TranscriptRows {
|
|
|
30
31
|
clusters: readonly Cluster[];
|
|
31
32
|
/** The reply still streaming: the only row with a caret. */
|
|
32
33
|
lastStreamingRow: Row | null | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* `visibleRows` and `clusters` split at the open exchange: `settled` keeps
|
|
36
|
+
* its arrays (and every row and cluster in them) while only the open
|
|
37
|
+
* exchange streams. A renderer can read these instead of the joined arrays.
|
|
38
|
+
*/
|
|
39
|
+
parts?: {
|
|
40
|
+
settled: TranscriptRowsSlice;
|
|
41
|
+
open: TranscriptRowsSlice;
|
|
42
|
+
};
|
|
33
43
|
}
|
|
44
|
+
/** A transcript's events: an array, or the transcript store a session stream store holds (`TranscriptEvents`). */
|
|
45
|
+
export type TranscriptSource = readonly ChatEvent[] | TranscriptEvents<ChatEvent>;
|
|
46
|
+
/** Rows, or what holds them (read only when needed: `useTranscriptRows`' result joins its parts on first read). */
|
|
47
|
+
type RowsSource = readonly Row[] | {
|
|
48
|
+
readonly visibleRows: readonly Row[];
|
|
49
|
+
};
|
|
34
50
|
/**
|
|
35
|
-
* Runs the headless pipeline over a transcript's events,
|
|
51
|
+
* Runs the headless pipeline over a transcript's events, incrementally (only the open exchange re-derives per tick), and returns the rows to paint.
|
|
36
52
|
*
|
|
37
|
-
* @param events - The session's events, oldest first.
|
|
53
|
+
* @param events - The session's events, oldest first, or its transcript store (then nothing walks the settled exchanges per tick).
|
|
38
54
|
* @param streaming - A run is in flight, so the last reply may still be streaming.
|
|
39
55
|
* @param input - The display options that shape the rows.
|
|
40
56
|
*/
|
|
41
|
-
export declare function useTranscriptRows(events:
|
|
57
|
+
export declare function useTranscriptRows(events: TranscriptSource, streaming: boolean, { showCacheNotices, codemodeShowCalls, showEditDiffs, groupToolCalls, showRunReceipt, compact }: TranscriptRowsInput): TranscriptRows;
|
|
42
58
|
/**
|
|
43
59
|
* Select-turn stops (`computeSelectStops`): which turns the cursor walks
|
|
44
60
|
* and which rows light up. Derived per transcript change while the mode is
|
|
@@ -47,10 +63,11 @@ export declare function useTranscriptRows(events: readonly ChatEvent[], streamin
|
|
|
47
63
|
* before the mode is on, and on every arrow), cached per input so a burst
|
|
48
64
|
* of arrows computes once.
|
|
49
65
|
*
|
|
50
|
-
* @param visibleRows - The rows painted,
|
|
51
|
-
* @param events - The session's events, oldest first.
|
|
66
|
+
* @param visibleRows - The rows painted, or {@link useTranscriptRows}' result (its rows are read only while the mode is on or asked).
|
|
67
|
+
* @param events - The session's events, oldest first, or its transcript store (read as one array only while the mode is on or asked).
|
|
52
68
|
* @param showThinking - Reasoning rows are shown, so they can be stops.
|
|
53
69
|
* @param selecting - Select-turn mode is on.
|
|
54
70
|
* @param registerStops - Hands the app the stops source; returns its unregister function.
|
|
55
71
|
*/
|
|
56
|
-
export declare function useSelectStops(visibleRows:
|
|
72
|
+
export declare function useSelectStops(visibleRows: RowsSource, events: TranscriptSource, showThinking: boolean, selecting: boolean, registerStops: ((source: () => SelectStops) => () => void) | undefined): SelectStops | null;
|
|
73
|
+
export {};
|
|
@@ -1,58 +1,40 @@
|
|
|
1
|
-
import { batchTaskRuns, batchThinkingRuns, batchToolRuns, clusterByOwner } from "../headless/transcript/batch.js";
|
|
2
|
-
import { collapseEvents } from "../headless/transcript/collapse.js";
|
|
3
1
|
import { computeSelectStops } from "../headless/transcript/select-stops.js";
|
|
4
|
-
import {
|
|
5
|
-
import { markRunFailures } from "../headless/transcript/run-failures.js";
|
|
6
|
-
import { nestToolCalls, nestedCallVisible } from "../headless/transcript/nesting.js";
|
|
2
|
+
import { createTranscriptRowsDeriver } from "../headless/transcript/incremental.js";
|
|
7
3
|
import { isHiddenRow } from "./TranscriptRow.js";
|
|
8
|
-
import { useEffect, useLayoutEffect, useMemo, useRef } from "react";
|
|
9
|
-
import {
|
|
4
|
+
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { transcriptArray, turnSelectionOwnership } from "zidane/chat/pure";
|
|
10
6
|
// src/chat/transcript/use-transcript-rows.ts
|
|
11
|
-
|
|
7
|
+
function asStream(events) {
|
|
8
|
+
return Array.isArray(events) ? events : transcriptArray(events);
|
|
9
|
+
}
|
|
10
|
+
const rowsOf = (rows) => Array.isArray(rows) ? rows : rows.visibleRows;
|
|
12
11
|
/**
|
|
13
|
-
* Runs the headless pipeline over a transcript's events,
|
|
12
|
+
* Runs the headless pipeline over a transcript's events, incrementally (only the open exchange re-derives per tick), and returns the rows to paint.
|
|
14
13
|
*
|
|
15
|
-
* @param events - The session's events, oldest first.
|
|
14
|
+
* @param events - The session's events, oldest first, or its transcript store (then nothing walks the settled exchanges per tick).
|
|
16
15
|
* @param streaming - A run is in flight, so the last reply may still be streaming.
|
|
17
16
|
* @param input - The display options that shape the rows.
|
|
18
17
|
*/
|
|
19
18
|
function useTranscriptRows(events, streaming, { showCacheNotices, codemodeShowCalls, showEditDiffs, groupToolCalls, showRunReceipt, compact }) {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
const [deriver] = useState(createTranscriptRowsDeriver);
|
|
20
|
+
return useMemo(() => deriver.derive(events, streaming, {
|
|
21
|
+
showCacheNotices,
|
|
22
|
+
codemodeShowCalls,
|
|
23
|
+
showEditDiffs,
|
|
24
|
+
groupToolCalls,
|
|
25
|
+
showRunReceipt,
|
|
26
|
+
compact
|
|
27
|
+
}), [
|
|
28
|
+
deriver,
|
|
24
29
|
events,
|
|
30
|
+
streaming,
|
|
25
31
|
showCacheNotices,
|
|
26
|
-
codemodeShowCalls
|
|
27
|
-
]);
|
|
28
|
-
const rows = useMemo(() => nestToolCalls(collapseEvents(shownEvents, showEditDiffs, streaming)), [
|
|
29
|
-
shownEvents,
|
|
32
|
+
codemodeShowCalls,
|
|
30
33
|
showEditDiffs,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const failed = useMemo(() => markRunFailures(batched), [batched]);
|
|
35
|
-
const { visibleRows: dockedRows, receiptByRowId } = useMemo(() => dockRunReceipts(failed, showRunReceipt), [failed, showRunReceipt]);
|
|
36
|
-
const visibleRows = useMemo(() => compact ? foldExchanges(dockedRows, streaming) : dockedRows, [
|
|
37
|
-
dockedRows,
|
|
38
|
-
compact,
|
|
39
|
-
streaming
|
|
34
|
+
groupToolCalls,
|
|
35
|
+
showRunReceipt,
|
|
36
|
+
compact
|
|
40
37
|
]);
|
|
41
|
-
return {
|
|
42
|
-
visibleRows,
|
|
43
|
-
receiptByRowId,
|
|
44
|
-
resumableId: useMemo(() => {
|
|
45
|
-
if (streaming) return null;
|
|
46
|
-
for (let i = visibleRows.length - 1; i >= 0; i--) {
|
|
47
|
-
const row = visibleRows[i];
|
|
48
|
-
if (row.kind === "separator" || row.kind === "run-summary") continue;
|
|
49
|
-
return row.kind === "error" && row.failure ? row.id : null;
|
|
50
|
-
}
|
|
51
|
-
return null;
|
|
52
|
-
}, [visibleRows, streaming]),
|
|
53
|
-
clusters: useMemo(() => clusterByOwner(visibleRows), [visibleRows]),
|
|
54
|
-
lastStreamingRow: findLastStreamingRow(visibleRows)
|
|
55
|
-
};
|
|
56
38
|
}
|
|
57
39
|
/**
|
|
58
40
|
* Select-turn stops (`computeSelectStops`): which turns the cursor walks
|
|
@@ -62,14 +44,14 @@ function useTranscriptRows(events, streaming, { showCacheNotices, codemodeShowCa
|
|
|
62
44
|
* before the mode is on, and on every arrow), cached per input so a burst
|
|
63
45
|
* of arrows computes once.
|
|
64
46
|
*
|
|
65
|
-
* @param visibleRows - The rows painted,
|
|
66
|
-
* @param events - The session's events, oldest first.
|
|
47
|
+
* @param visibleRows - The rows painted, or {@link useTranscriptRows}' result (its rows are read only while the mode is on or asked).
|
|
48
|
+
* @param events - The session's events, oldest first, or its transcript store (read as one array only while the mode is on or asked).
|
|
67
49
|
* @param showThinking - Reasoning rows are shown, so they can be stops.
|
|
68
50
|
* @param selecting - Select-turn mode is on.
|
|
69
51
|
* @param registerStops - Hands the app the stops source; returns its unregister function.
|
|
70
52
|
*/
|
|
71
53
|
function useSelectStops(visibleRows, events, showThinking, selecting, registerStops) {
|
|
72
|
-
const stops = useMemo(() => selecting ? computeSelectStops(visibleRows, turnSelectionOwnership(asStream(events)), (row) => isHiddenRow(row, showThinking)) : null, [
|
|
54
|
+
const stops = useMemo(() => selecting ? computeSelectStops(rowsOf(visibleRows), turnSelectionOwnership(asStream(events)), (row) => isHiddenRow(row, showThinking)) : null, [
|
|
73
55
|
selecting,
|
|
74
56
|
visibleRows,
|
|
75
57
|
events,
|
|
@@ -94,7 +76,7 @@ function useSelectStops(visibleRows, events, showThinking, selecting, registerSt
|
|
|
94
76
|
const { rows, events: evts, showThinking: show } = stopsInput.current;
|
|
95
77
|
const hit = stopsCache.current;
|
|
96
78
|
if (hit && hit.rows === rows && hit.events === evts && hit.show === show) return hit.stops;
|
|
97
|
-
const fresh = computeSelectStops(rows, turnSelectionOwnership(asStream(evts)), (row) => isHiddenRow(row, show));
|
|
79
|
+
const fresh = computeSelectStops(rowsOf(rows), turnSelectionOwnership(asStream(evts)), (row) => isHiddenRow(row, show));
|
|
98
80
|
stopsCache.current = {
|
|
99
81
|
rows,
|
|
100
82
|
events: evts,
|
|
@@ -10,7 +10,9 @@ import { useLayoutEffect, useState } from "react";
|
|
|
10
10
|
* visibly jumps while it loads.
|
|
11
11
|
*
|
|
12
12
|
* Veiled from the frame `ready` (the transcript hydrated) holds for `key`,
|
|
13
|
-
* before paint
|
|
13
|
+
* before paint, only when it loads after the thread opened: a thread already
|
|
14
|
+
* loaded when it opens (switching back to it) shows at once. Its chips are
|
|
15
|
+
* known, and hiding it to fade it back in is the blink this exists to avoid. Revealed once no lookup has been in flight for two frames
|
|
14
16
|
* (a lookup's answer re-renders rows, which may start the next one), or at
|
|
15
17
|
* `maxMs`, so a slow server (a Linear MCP call) never holds a thread back
|
|
16
18
|
* for long: what lands later still moves, but that is the rare cold read;
|
|
@@ -37,8 +39,17 @@ async function settled(deadline) {
|
|
|
37
39
|
*/
|
|
38
40
|
function useSettledReveal(key, ready, maxMs = REVEAL_MAX_MS) {
|
|
39
41
|
const [veiledFor, setVeiledFor] = useState(null);
|
|
42
|
+
const [opened, setOpened] = useState({
|
|
43
|
+
key,
|
|
44
|
+
loaded: ready
|
|
45
|
+
});
|
|
46
|
+
if (opened.key !== key) setOpened({
|
|
47
|
+
key,
|
|
48
|
+
loaded: ready
|
|
49
|
+
});
|
|
50
|
+
const loadedAtOpen = opened.key === key ? opened.loaded : ready;
|
|
40
51
|
useLayoutEffect(() => {
|
|
41
|
-
if (!key || !ready) return void 0;
|
|
52
|
+
if (!key || !ready || loadedAtOpen) return void 0;
|
|
42
53
|
setVeiledFor(key);
|
|
43
54
|
let live = true;
|
|
44
55
|
settled(performance.now() + maxMs).then(() => {
|
|
@@ -50,7 +61,8 @@ function useSettledReveal(key, ready, maxMs = REVEAL_MAX_MS) {
|
|
|
50
61
|
}, [
|
|
51
62
|
key,
|
|
52
63
|
ready,
|
|
53
|
-
maxMs
|
|
64
|
+
maxMs,
|
|
65
|
+
loadedAtOpen
|
|
54
66
|
]);
|
|
55
67
|
return key !== null && veiledFor === key;
|
|
56
68
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { currentMotionTransition } from "../../motion/springs.js";
|
|
2
|
-
import {
|
|
2
|
+
import { dataRowSelector } from "../headless/transcript/rail.js";
|
|
3
|
+
import { revealRow } from "./row-mount.js";
|
|
3
4
|
import { mayShrink } from "./scroll-clamp.js";
|
|
4
5
|
import { viewAbove } from "./view-anchor.js";
|
|
5
6
|
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
@@ -358,9 +359,8 @@ function useStickToBottom(scrollRef, { paused = false, rowSelector = ".zg-cv-row
|
|
|
358
359
|
settle();
|
|
359
360
|
};
|
|
360
361
|
restoreRows.current = (rows) => {
|
|
361
|
-
const find = (id) => el.querySelector(
|
|
362
|
-
|
|
363
|
-
if (outer) mountRowNow(outer);
|
|
362
|
+
const find = (id) => el.querySelector(dataRowSelector(id));
|
|
363
|
+
if (rows.length > 0) revealRow(el, rows[rows.length - 1].id);
|
|
364
364
|
for (const [i, place] of rows.entries()) {
|
|
365
365
|
const target = find(place.id);
|
|
366
366
|
if (!target) continue;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useHydrated } from "../../hooks/useHydrated.js";
|
|
2
|
-
import { holdForceMountRows,
|
|
2
|
+
import { holdForceMountRows, useForcedRows } from "./LazyRow.js";
|
|
3
|
+
import { mountAround } from "./row-mount.js";
|
|
3
4
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
6
|
// src/chat/transcript/useTranscriptSearch.tsx
|
|
@@ -14,9 +15,10 @@ import { jsx } from "react/jsx-runtime";
|
|
|
14
15
|
* re-deriving text from stream events — the DOM is the source of truth
|
|
15
16
|
* for "what the user can see" (markdown rendering, tool-row formatting,
|
|
16
17
|
* masking all live there). `content-visibility: auto` rows keep their
|
|
17
|
-
* text in the DOM even when paint is skipped, and
|
|
18
|
-
*
|
|
19
|
-
* walk still finds
|
|
18
|
+
* text in the DOM even when paint is skipped, and while a needle is
|
|
19
|
+
* active the transcript mounts the rows whose data holds it wherever they
|
|
20
|
+
* are (`holdForceMountRows`), so the walk still finds matches in rows
|
|
21
|
+
* that never mounted or parked. Highlighting uses the CSS Custom Highlight API
|
|
20
22
|
* (`CSS.highlights`) so we never mutate the transcript's DOM — wrapping
|
|
21
23
|
* matches in `<mark>` would fight React's reconciler on the next
|
|
22
24
|
* streaming tick.
|
|
@@ -121,10 +123,16 @@ function releaseHighlights(owner) {
|
|
|
121
123
|
/**
|
|
122
124
|
* Jump to a match's row. `block: 'center'` keeps context visible above
|
|
123
125
|
* and below; on a `content-visibility: auto` row this forces render,
|
|
124
|
-
* which is exactly what we want before the user reads the match.
|
|
126
|
+
* which is exactly what we want before the user reads the match. The rows
|
|
127
|
+
* around it that have not mounted mount first (`mountAround`), at their
|
|
128
|
+
* real heights: mounting after the jump, they would push the match out of
|
|
129
|
+
* view. Their render lands with the next commit, so the jump waits for it.
|
|
125
130
|
*/
|
|
126
|
-
function scrollToRange(range) {
|
|
127
|
-
range.startContainer.parentElement
|
|
131
|
+
function scrollToRange(range, root) {
|
|
132
|
+
const target = range.startContainer.parentElement;
|
|
133
|
+
if (!target) return;
|
|
134
|
+
if (root && mountAround(root, target, root.clientHeight)) queueMicrotask(() => target.isConnected && target.scrollIntoView({ block: "center" }));
|
|
135
|
+
else target.scrollIntoView({ block: "center" });
|
|
128
136
|
}
|
|
129
137
|
/**
|
|
130
138
|
* `revision` is any value whose identity changes when the transcript
|
|
@@ -174,9 +182,10 @@ function useTranscriptSearch(container, query, revision, { terms, revealFirstMat
|
|
|
174
182
|
* sees the freshly-rendered rows.
|
|
175
183
|
*/
|
|
176
184
|
const prevNeedleRef = useRef("");
|
|
177
|
-
const
|
|
185
|
+
const forced = useForcedRows();
|
|
178
186
|
const searching = needle.key !== "";
|
|
179
|
-
useEffect(() => searching ? holdForceMountRows() : void 0, [searching]);
|
|
187
|
+
useEffect(() => searching ? holdForceMountRows(needle.needles) : void 0, [searching, needle]);
|
|
188
|
+
const rowsMounted = forced.all || needle.needles.every((n) => forced.needles.includes(n));
|
|
180
189
|
/** A rescan the transcript changing asked for, waiting out a burst of stream updates. */
|
|
181
190
|
const rescanTimer = useRef(null);
|
|
182
191
|
useEffect(() => () => {
|
|
@@ -188,12 +197,12 @@ function useTranscriptSearch(container, query, revision, { terms, revealFirstMat
|
|
|
188
197
|
if (searching && !rowsMounted) return;
|
|
189
198
|
const needleChanged = prevNeedleRef.current !== needle.key;
|
|
190
199
|
if (needleChanged && prevNeedleRef.current !== "") revealArmed.current = false;
|
|
191
|
-
prevNeedleRef.current = needle.key;
|
|
192
200
|
if (rescanTimer.current) {
|
|
193
201
|
clearTimeout(rescanTimer.current);
|
|
194
202
|
rescanTimer.current = null;
|
|
195
203
|
}
|
|
196
204
|
if (!root || !searching) {
|
|
205
|
+
prevNeedleRef.current = needle.key;
|
|
197
206
|
if (rangesRef.current.length === 0 && !needleChanged) return;
|
|
198
207
|
rangesRef.current = [];
|
|
199
208
|
setMatches((prev) => prev.count === 0 && !prev.capped ? prev : {
|
|
@@ -206,6 +215,7 @@ function useTranscriptSearch(container, query, revision, { terms, revealFirstMat
|
|
|
206
215
|
}
|
|
207
216
|
const scan = () => {
|
|
208
217
|
rescanTimer.current = null;
|
|
218
|
+
prevNeedleRef.current = needle.key;
|
|
209
219
|
const ranges = collectMatches(root, needle.needles);
|
|
210
220
|
const jump = needleChanged || revealArmed.current;
|
|
211
221
|
const nextIndex = needleChanged ? 0 : Math.min(activeIndexRef.current, Math.max(0, ranges.length - 1));
|
|
@@ -218,11 +228,17 @@ function useTranscriptSearch(container, query, revision, { terms, revealFirstMat
|
|
|
218
228
|
setHighlights(owner, ranges, nextIndex);
|
|
219
229
|
if (jump && ranges.length > 0) {
|
|
220
230
|
revealArmed.current = false;
|
|
221
|
-
scrollToRange(ranges[nextIndex]);
|
|
231
|
+
scrollToRange(ranges[nextIndex], root);
|
|
222
232
|
}
|
|
223
233
|
};
|
|
224
|
-
if (needleChanged)
|
|
225
|
-
|
|
234
|
+
if (needleChanged) {
|
|
235
|
+
let live = true;
|
|
236
|
+
queueMicrotask(() => live && scan());
|
|
237
|
+
return () => {
|
|
238
|
+
live = false;
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
rescanTimer.current = setTimeout(scan, RESCAN_MS);
|
|
226
242
|
}, [
|
|
227
243
|
needle,
|
|
228
244
|
searching,
|
|
@@ -241,7 +257,7 @@ function useTranscriptSearch(container, query, revision, { terms, revealFirstMat
|
|
|
241
257
|
const next = (activeIndexRef.current + direction + ranges.length) % ranges.length;
|
|
242
258
|
setActiveIndex(next);
|
|
243
259
|
setHighlights(ownerRef.current, ranges, next);
|
|
244
|
-
scrollToRange(ranges[next]);
|
|
260
|
+
scrollToRange(ranges[next], container.current);
|
|
245
261
|
}, []);
|
|
246
262
|
return {
|
|
247
263
|
count: matches.count,
|
|
@@ -10,7 +10,7 @@ import { ViewAnswer, ViewAnswers } from "../../views/headless/answers.js";
|
|
|
10
10
|
import { ReplyViewPlace, TextlessExchange } from "../../views/headless/placement.js";
|
|
11
11
|
import { ChatEvent } from "../headless/host.js";
|
|
12
12
|
import { ReactNode } from "react";
|
|
13
|
-
import { ViewsOrchestrationMode } from "zidane/chat/pure";
|
|
13
|
+
import { TranscriptEvents, ViewsOrchestrationMode } from "zidane/chat/pure";
|
|
14
14
|
/** Props of the views chunk's fence: see `ui/src/views/TranscriptViews.tsx`. */
|
|
15
15
|
export interface ViewFencePartProps {
|
|
16
16
|
/** The fence body. */
|
|
@@ -143,8 +143,13 @@ export declare function viewFenceStarts(text: string): readonly number[];
|
|
|
143
143
|
* The fences of each chunk of a reply.
|
|
144
144
|
*
|
|
145
145
|
* @param chunks - The reply's chunks.
|
|
146
|
+
* @param previous - The last call's chunks and result: a chunk still the same string is not read again (a streaming
|
|
147
|
+
* reply's closed chunks keep theirs), and keeps its value while its base does.
|
|
146
148
|
*/
|
|
147
|
-
export declare function chunkFencesFor(chunks: readonly string[]
|
|
149
|
+
export declare function chunkFencesFor(chunks: readonly string[], previous?: {
|
|
150
|
+
chunks: readonly string[];
|
|
151
|
+
fences: readonly ChunkFences[];
|
|
152
|
+
} | null): ChunkFences[];
|
|
148
153
|
/**
|
|
149
154
|
* Provides one chunk's fences. The value stays while its base and starts do: a streamed chunk
|
|
150
155
|
* that grows with no new fence changes nothing below it.
|
|
@@ -163,21 +168,36 @@ export declare function ChunkFencesScope({ base, starts, children }: ChunkFences
|
|
|
163
168
|
export declare function fenceIndexIn(chunk: ChunkFences, offset: number): number;
|
|
164
169
|
/** Where each reply row's views go, read per row: a row draws again only when its own place changes. */
|
|
165
170
|
export declare class ReplyViewPlaces {
|
|
166
|
-
|
|
171
|
+
/** The places of the settled exchanges (or of a whole array). */
|
|
172
|
+
private base;
|
|
173
|
+
/** The places the open exchange sets, over `base`. */
|
|
174
|
+
private top;
|
|
175
|
+
private source;
|
|
167
176
|
private events;
|
|
177
|
+
/** The folds of a transcript store's settled exchanges, per chunk list. */
|
|
178
|
+
private settled;
|
|
168
179
|
private textless;
|
|
180
|
+
private textlessKey;
|
|
169
181
|
private readonly changed;
|
|
170
182
|
private readonly listeners;
|
|
171
183
|
/**
|
|
172
184
|
* Reads the events: the places (`viewPlacements`) and the exchanges with no reply text
|
|
173
185
|
* (`textlessExchanges`). A stream tick changes neither, so it reads nothing. Rows rendering
|
|
174
|
-
* after it read the places; {@link flush} tells the others.
|
|
186
|
+
* after it read the places; {@link flush} tells the others. A transcript store's settled
|
|
187
|
+
* exchanges are read once: a tick reads its open exchange.
|
|
175
188
|
*
|
|
176
|
-
* @param events - The session's events, oldest first.
|
|
189
|
+
* @param events - The session's events, oldest first, or its transcript store.
|
|
177
190
|
*/
|
|
178
|
-
update(events: readonly ChatEvent[]): void;
|
|
191
|
+
update(events: readonly ChatEvent[] | TranscriptEvents<ChatEvent>): void;
|
|
192
|
+
private updateTranscript;
|
|
179
193
|
/** The exchanges with no reply text, as of the last {@link update}. */
|
|
180
194
|
get textlessExchanges(): readonly TextlessExchange[];
|
|
195
|
+
/** The places as one map (the array path's `previous`). */
|
|
196
|
+
private flat;
|
|
197
|
+
/**
|
|
198
|
+
* Sets the places, noting the rows whose place changed: every row when `whole`, else those the
|
|
199
|
+
* open exchange set before or sets now (the base is the same).
|
|
200
|
+
*/
|
|
181
201
|
private replace;
|
|
182
202
|
/** Tells the rows whose place changed since the last flush. */
|
|
183
203
|
flush(): void;
|