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
|
@@ -1,43 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The wrappers of transcript rows, and what the active searches hold mounted.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* its
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* an empty box at its estimated height; once mounted it stays mounted
|
|
10
|
-
* (expanded state, selection and the browser's remembered size survive).
|
|
4
|
+
* A root row renders through `LazyRow`: a placeholder at the row's height
|
|
5
|
+
* until it nears the view, then its content, for good (`row-mount.ts`: the
|
|
6
|
+
* mounter of its transcript decides, and parks far rows only past a budget
|
|
7
|
+
* while the reader is idle). What the reader did to a row lives in
|
|
8
|
+
* `useRowUiState`, so a parked row comes back as it was left.
|
|
11
9
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* Two distances. Rows entering the far margin queue up, and each frame
|
|
19
|
-
* mounts the nearest until `BUDGET_MS` is spent: a flick that brings twenty
|
|
20
|
-
* rows into the margin spreads them over a few frames. Rows within a
|
|
21
|
-
* viewport of the view mount at once, whatever the budget: a row must never
|
|
22
|
-
* reach the screen as a blank placeholder, nor change height in view (the
|
|
23
|
-
* view would reflow under the reader). Rows mounted from the queue tell
|
|
24
|
-
* their content (`useBackgroundMount`) so long text may reveal over a few
|
|
25
|
-
* frames; rows mounted near the view render whole.
|
|
10
|
+
* Rows mounted ahead of the view (`useBackgroundMount`) may reveal long
|
|
11
|
+
* text over a few frames; rows mounted near the view render whole. A row
|
|
12
|
+
* that mounts because the reader scrolled to it, or with the conversation, is
|
|
13
|
+
* quiet: no enter animation. Only a row new at the end of the transcript (its
|
|
14
|
+
* tail) plays it.
|
|
26
15
|
*/
|
|
27
16
|
import { CSSProperties, ReactNode } from "react";
|
|
17
|
+
/** What the active searches want mounted: every row, or the rows holding any of these needles (lowercased). */
|
|
18
|
+
export interface ForcedRows {
|
|
19
|
+
/** Every row (a hold with no needles). */
|
|
20
|
+
all: boolean;
|
|
21
|
+
/** The needles of the holds that named some. */
|
|
22
|
+
needles: readonly string[];
|
|
23
|
+
}
|
|
28
24
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* it outside React's render and effects: it commits synchronously.
|
|
25
|
+
* Holds rows mounted while a search is active: the rows whose text holds one
|
|
26
|
+
* of `needles` (lowercased), or every row without them. The transcript mounts
|
|
27
|
+
* them wherever they are, so a walk of the DOM finds their text. Returns the release.
|
|
33
28
|
*
|
|
34
|
-
* @param
|
|
29
|
+
* @param needles - What the search looks for, lowercased; absent, every row.
|
|
35
30
|
*/
|
|
36
|
-
export declare function
|
|
37
|
-
/**
|
|
38
|
-
export declare function holdForceMountRows(): () => void;
|
|
39
|
-
/** Returns whether every lazy row must be mounted now, for example while a search needle is active. */
|
|
31
|
+
export declare function holdForceMountRows(needles?: readonly string[]): () => void;
|
|
32
|
+
/** Returns whether a search holds rows mounted now (rows then render whole: no reveal over frames, groups open). */
|
|
40
33
|
export declare function useForceMountRows(): boolean;
|
|
34
|
+
/** What the active searches hold mounted ({@link holdForceMountRows}); a new object on every change. */
|
|
35
|
+
export declare function useForcedRows(): ForcedRows;
|
|
41
36
|
/**
|
|
42
37
|
* True while the transcript is first painting a conversation (switching to
|
|
43
38
|
* it, or its history landing). Rows mounted then were already there: they
|
|
@@ -69,26 +64,31 @@ export declare function CvRow({ style, children, className, ...rest }: CvRowProp
|
|
|
69
64
|
export declare function useBackgroundMount(): boolean;
|
|
70
65
|
/** Props for {@link LazyRow}. */
|
|
71
66
|
export interface LazyRowProps {
|
|
72
|
-
/**
|
|
73
|
-
'
|
|
74
|
-
/**
|
|
67
|
+
/** The root item's key: the row's id, or a worker block's. */
|
|
68
|
+
'itemKey': string;
|
|
69
|
+
/** The placeholder's height before the row was ever measured (px). */
|
|
75
70
|
'estimatePx': number;
|
|
76
71
|
/** Inline style for the row's wrapper, usually its content-visibility sizing. */
|
|
77
|
-
'style'
|
|
72
|
+
'style'?: CSSProperties;
|
|
78
73
|
/** The row's content. */
|
|
79
74
|
'children': ReactNode;
|
|
75
|
+
/** A plain box (a worker's block): no content-visibility, no row id on the wrapper. */
|
|
76
|
+
'box'?: boolean;
|
|
77
|
+
/** The row's id (`Row.id`): how a view that left the transcript finds its place again (`useStickToBottom`'s `restorePosition`). */
|
|
78
|
+
'data-row'?: string;
|
|
80
79
|
/** The select-turn stop the row belongs to. Set only in select mode; makes the row a hover and click target. */
|
|
81
80
|
'data-stop'?: string;
|
|
82
81
|
/** Marks the row as part of the selected stop, so the select cursor can find it. */
|
|
83
82
|
'data-sel'?: string;
|
|
84
|
-
/**
|
|
85
|
-
'data-
|
|
83
|
+
/** A user's prompt: what an app's scrollback fill and the media gallery count (mounted or not). */
|
|
84
|
+
'data-prompt'?: string;
|
|
86
85
|
/** Extra classes on the root element. */
|
|
87
86
|
'className'?: string;
|
|
88
87
|
}
|
|
89
88
|
/**
|
|
90
|
-
* Renders a transcript row that mounts its content
|
|
89
|
+
* Renders a root transcript row that mounts its content when it nears the view, and keeps it: until then (and
|
|
90
|
+
* parked) an empty box of the row's height, its last measured height when known.
|
|
91
91
|
*
|
|
92
|
-
* @param props - Row props: `
|
|
92
|
+
* @param props - Row props: `itemKey`, `estimatePx`, `style`, `children`, the row's id and the select-mode data attributes.
|
|
93
93
|
*/
|
|
94
|
-
export declare function LazyRow({
|
|
94
|
+
export declare function LazyRow({ itemKey, estimatePx, style, children, className, box, ...rest }: LazyRowProps): import("react").JSX.Element;
|
|
@@ -1,132 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { RowMountContext } from "./row-mount.js";
|
|
2
|
+
import { RowKeyContext } from "./row-ui-state.js";
|
|
3
|
+
import { createContext, useContext, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { flushSync } from "react-dom";
|
|
5
5
|
// src/chat/transcript/LazyRow.tsx
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (!mount) continue;
|
|
24
|
-
forget(target);
|
|
25
|
-
mounts.push(mount);
|
|
26
|
-
}
|
|
27
|
-
if (mounts.length > 0) flushSync(() => mounts.forEach((mount) => mount(false)));
|
|
28
|
-
}
|
|
29
|
-
function lazyObservers(root) {
|
|
30
|
-
const key = root ?? document;
|
|
31
|
-
const hit = observersByRoot.get(key);
|
|
32
|
-
if (hit) return hit;
|
|
33
|
-
const pair = [new IntersectionObserver((entries) => {
|
|
34
|
-
for (const entry of entries) {
|
|
35
|
-
if (!entry.isIntersecting) continue;
|
|
36
|
-
const mount = pendingMounts.get(entry.target);
|
|
37
|
-
if (mount) queue.set(entry.target, mount);
|
|
38
|
-
}
|
|
39
|
-
schedulePump();
|
|
40
|
-
}, {
|
|
41
|
-
root,
|
|
42
|
-
rootMargin: MARGIN
|
|
43
|
-
}), new IntersectionObserver((entries) => mountNow(entries.filter((entry) => entry.isIntersecting).map((entry) => entry.target)), {
|
|
44
|
-
root,
|
|
45
|
-
rootMargin: NEAR_MARGIN
|
|
46
|
-
})];
|
|
47
|
-
observersByRoot.set(key, pair);
|
|
48
|
-
return pair;
|
|
49
|
-
}
|
|
50
|
-
function forget(target) {
|
|
51
|
-
pendingMounts.delete(target);
|
|
52
|
-
queue.delete(target);
|
|
53
|
-
const pair = observedBy.get(target);
|
|
54
|
-
observedBy.delete(target);
|
|
55
|
-
pair?.[0].unobserve(target);
|
|
56
|
-
pair?.[1].unobserve(target);
|
|
6
|
+
const NO_FORCE = {
|
|
7
|
+
all: false,
|
|
8
|
+
needles: []
|
|
9
|
+
};
|
|
10
|
+
const holds = /* @__PURE__ */ new Set();
|
|
11
|
+
let forced = NO_FORCE;
|
|
12
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
13
|
+
function publish() {
|
|
14
|
+
const needles = /* @__PURE__ */ new Set();
|
|
15
|
+
let all = false;
|
|
16
|
+
for (const hold of holds) if (!hold.needles) all = true;
|
|
17
|
+
else hold.needles.forEach((n) => needles.add(n));
|
|
18
|
+
forced = holds.size === 0 ? NO_FORCE : {
|
|
19
|
+
all,
|
|
20
|
+
needles: [...needles]
|
|
21
|
+
};
|
|
22
|
+
for (const notify of subscribers) notify();
|
|
57
23
|
}
|
|
58
24
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* it outside React's render and effects: it commits synchronously.
|
|
25
|
+
* Holds rows mounted while a search is active: the rows whose text holds one
|
|
26
|
+
* of `needles` (lowercased), or every row without them. The transcript mounts
|
|
27
|
+
* them wherever they are, so a walk of the DOM finds their text. Returns the release.
|
|
63
28
|
*
|
|
64
|
-
* @param
|
|
65
|
-
*/
|
|
66
|
-
function mountRowNow(row) {
|
|
67
|
-
mountNow([row]);
|
|
68
|
-
}
|
|
69
|
-
function schedulePump() {
|
|
70
|
-
if (pumpScheduled || queue.size === 0) return;
|
|
71
|
-
pumpScheduled = true;
|
|
72
|
-
requestAnimationFrame(() => setTimeout(pump, 0));
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Distance from the visible part of the row's scroll root (0 = in view), and that view's height.
|
|
76
|
-
* `views` keeps each root's top and bottom for one pump: a root is measured once, not per row.
|
|
29
|
+
* @param needles - What the search looks for, lowercased; absent, every row.
|
|
77
30
|
*/
|
|
78
|
-
function
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (!view) {
|
|
83
|
-
const rect = root?.getBoundingClientRect();
|
|
84
|
-
view = rect ? [rect.top, rect.bottom] : [0, window.innerHeight];
|
|
85
|
-
views.set(root, view);
|
|
86
|
-
}
|
|
87
|
-
const [top, bottom] = view;
|
|
88
|
-
return [r.bottom >= top && r.top <= bottom ? 0 : r.top > bottom ? r.top - bottom : top - r.bottom, bottom - top];
|
|
89
|
-
}
|
|
90
|
-
function pump() {
|
|
91
|
-
pumpScheduled = false;
|
|
92
|
-
const views = /* @__PURE__ */ new Map();
|
|
93
|
-
const order = [...queue.keys()].filter((el) => el.isConnected).map((el) => [el, ...distanceToView(el, views)]).sort((a, b) => a[1] - b[1]);
|
|
94
|
-
const isNear = ([, distance, view]) => distance <= view;
|
|
95
|
-
mountNow(order.filter(isNear).map(([el]) => el));
|
|
96
|
-
const start = performance.now();
|
|
97
|
-
for (const entry of order) {
|
|
98
|
-
if (isNear(entry)) continue;
|
|
99
|
-
const el = entry[0];
|
|
100
|
-
if (performance.now() - start > BUDGET_MS) break;
|
|
101
|
-
const mount = queue.get(el);
|
|
102
|
-
forget(el);
|
|
103
|
-
if (mount) flushSync(() => mount(true));
|
|
104
|
-
}
|
|
105
|
-
for (const el of queue.keys()) if (!el.isConnected) queue.delete(el);
|
|
106
|
-
schedulePump();
|
|
107
|
-
}
|
|
108
|
-
/** How many active searches want every row mounted; any one is enough. */
|
|
109
|
-
let forceHolds = 0;
|
|
110
|
-
const subscribers = /* @__PURE__ */ new Set();
|
|
111
|
-
/** Every lazy row mounts while held (and stays mounted after release). Returns the release. */
|
|
112
|
-
function holdForceMountRows() {
|
|
113
|
-
forceHolds++;
|
|
114
|
-
if (forceHolds === 1) for (const notify of subscribers) notify();
|
|
31
|
+
function holdForceMountRows(needles) {
|
|
32
|
+
const hold = { needles: needles ?? null };
|
|
33
|
+
holds.add(hold);
|
|
34
|
+
publish();
|
|
115
35
|
let released = false;
|
|
116
36
|
return () => {
|
|
117
37
|
if (released) return;
|
|
118
38
|
released = true;
|
|
119
|
-
|
|
120
|
-
|
|
39
|
+
holds.delete(hold);
|
|
40
|
+
publish();
|
|
121
41
|
};
|
|
122
42
|
}
|
|
123
43
|
function subscribe(notify) {
|
|
124
44
|
subscribers.add(notify);
|
|
125
45
|
return () => subscribers.delete(notify);
|
|
126
46
|
}
|
|
127
|
-
const getForced = () =>
|
|
128
|
-
|
|
47
|
+
const getForced = () => forced;
|
|
48
|
+
const getForcing = () => forced !== NO_FORCE;
|
|
49
|
+
/** Returns whether a search holds rows mounted now (rows then render whole: no reveal over frames, groups open). */
|
|
129
50
|
function useForceMountRows() {
|
|
51
|
+
return useSyncExternalStore(subscribe, getForcing, getForcing);
|
|
52
|
+
}
|
|
53
|
+
/** What the active searches hold mounted ({@link holdForceMountRows}); a new object on every change. */
|
|
54
|
+
function useForcedRows() {
|
|
130
55
|
return useSyncExternalStore(subscribe, getForced, getForced);
|
|
131
56
|
}
|
|
132
57
|
/**
|
|
@@ -148,7 +73,10 @@ function CvRow({ style, children, className, ...rest }) {
|
|
|
148
73
|
style,
|
|
149
74
|
"data-quiet": quiet ? "" : void 0,
|
|
150
75
|
...rest,
|
|
151
|
-
children
|
|
76
|
+
children: rest["data-row"] === void 0 ? children : /* @__PURE__ */ jsx(RowKeyContext.Provider, {
|
|
77
|
+
value: rest["data-row"],
|
|
78
|
+
children
|
|
79
|
+
})
|
|
152
80
|
});
|
|
153
81
|
}
|
|
154
82
|
const BackgroundMount = createContext(false);
|
|
@@ -157,51 +85,75 @@ function useBackgroundMount() {
|
|
|
157
85
|
return useContext(BackgroundMount);
|
|
158
86
|
}
|
|
159
87
|
/**
|
|
160
|
-
* Renders a transcript row that mounts its content
|
|
88
|
+
* Renders a root transcript row that mounts its content when it nears the view, and keeps it: until then (and
|
|
89
|
+
* parked) an empty box of the row's height, its last measured height when known.
|
|
161
90
|
*
|
|
162
|
-
* @param props - Row props: `
|
|
91
|
+
* @param props - Row props: `itemKey`, `estimatePx`, `style`, `children`, the row's id and the select-mode data attributes.
|
|
163
92
|
*/
|
|
164
|
-
function LazyRow({
|
|
165
|
-
const
|
|
166
|
-
const force = useForceMountRows();
|
|
167
|
-
const [near, setNear] = useState(eager);
|
|
168
|
-
const [background, setBackground] = useState(false);
|
|
93
|
+
function LazyRow({ itemKey, estimatePx, style, children, className, box = false, ...rest }) {
|
|
94
|
+
const mounter = useContext(RowMountContext);
|
|
169
95
|
const settling = useContext(TranscriptSettling);
|
|
170
|
-
const [
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
96
|
+
const [state, setState] = useState(() => {
|
|
97
|
+
const start = mounter?.start(itemKey) ?? {
|
|
98
|
+
mounted: true,
|
|
99
|
+
eager: true,
|
|
100
|
+
seen: false
|
|
101
|
+
};
|
|
102
|
+
return {
|
|
103
|
+
phase: start.mounted ? "mounted" : "lazy",
|
|
104
|
+
background: false,
|
|
105
|
+
parkedPx: void 0,
|
|
106
|
+
quiet: settling() || !start.eager || start.seen
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
const ref = useRef(null);
|
|
110
|
+
const phase = useRef(state.phase);
|
|
111
|
+
phase.current = state.phase;
|
|
112
|
+
useLayoutEffect(() => {
|
|
174
113
|
const el = ref.current;
|
|
175
|
-
if (!
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
114
|
+
if (!mounter || !el) return void 0;
|
|
115
|
+
return mounter.register({
|
|
116
|
+
key: itemKey,
|
|
117
|
+
el,
|
|
118
|
+
cv: !box,
|
|
119
|
+
phase: phase.current,
|
|
120
|
+
set: (next, background, parkedPx) => setState((s) => ({
|
|
121
|
+
...s,
|
|
122
|
+
phase: next,
|
|
123
|
+
background,
|
|
124
|
+
parkedPx
|
|
125
|
+
}))
|
|
186
126
|
});
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
127
|
+
}, [
|
|
128
|
+
mounter,
|
|
129
|
+
itemKey,
|
|
130
|
+
box
|
|
131
|
+
]);
|
|
132
|
+
const mounted = state.phase === "mounted";
|
|
133
|
+
const known = mounter?.sizeOf(itemKey);
|
|
134
|
+
const px = state.parkedPx ?? known ?? estimatePx;
|
|
135
|
+
const wrapperStyle = box ? mounted ? void 0 : { height: px } : {
|
|
136
|
+
...style,
|
|
137
|
+
containIntrinsicSize: `auto ${Math.round(known ?? estimatePx)}px`,
|
|
138
|
+
...mounted ? null : { height: px }
|
|
139
|
+
};
|
|
140
|
+
const rowKey = rest["data-row"];
|
|
191
141
|
return /* @__PURE__ */ jsx("div", {
|
|
192
142
|
ref,
|
|
193
|
-
className: ["zg-cv-row", className].filter(Boolean).join(" "),
|
|
194
|
-
style:
|
|
195
|
-
|
|
196
|
-
height: estimatePx
|
|
197
|
-
},
|
|
143
|
+
className: box ? className : ["zg-cv-row", className].filter(Boolean).join(" "),
|
|
144
|
+
style: wrapperStyle,
|
|
145
|
+
"data-item": itemKey,
|
|
198
146
|
"data-lazy": mounted ? void 0 : "",
|
|
199
|
-
"data-
|
|
147
|
+
"data-parked": state.phase === "parked" ? "" : void 0,
|
|
148
|
+
"data-quiet": state.quiet ? "" : void 0,
|
|
200
149
|
...rest,
|
|
201
|
-
children: mounted ? /* @__PURE__ */ jsx(
|
|
202
|
-
value:
|
|
203
|
-
children
|
|
150
|
+
children: mounted ? /* @__PURE__ */ jsx(RowKeyContext.Provider, {
|
|
151
|
+
value: rowKey,
|
|
152
|
+
children: /* @__PURE__ */ jsx(BackgroundMount.Provider, {
|
|
153
|
+
value: state.background,
|
|
154
|
+
children
|
|
155
|
+
})
|
|
204
156
|
}) : null
|
|
205
157
|
});
|
|
206
158
|
}
|
|
207
|
-
export { CvRow, LazyRow, TranscriptSettling, holdForceMountRows,
|
|
159
|
+
export { CvRow, LazyRow, TranscriptSettling, holdForceMountRows, useBackgroundMount, useForceMountRows, useForcedRows };
|
|
@@ -3,6 +3,7 @@ import { CodeFrame } from "../../components/CodeFrame.js";
|
|
|
3
3
|
import { Notice } from "../../components/Notice.js";
|
|
4
4
|
import { useNearViewport } from "../../hooks/useNearViewport.js";
|
|
5
5
|
import { useChatLabels } from "../useChatLabels.js";
|
|
6
|
+
import { textKey, useRowPartKey, useRowUiState } from "./row-ui-state.js";
|
|
6
7
|
import { memo, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
7
8
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
// src/chat/transcript/MermaidDiagram.tsx
|
|
@@ -321,7 +322,7 @@ function failureOf(code, error) {
|
|
|
321
322
|
*/
|
|
322
323
|
const MermaidDiagram = memo(({ code, streaming = false, className, style, view = false, still = false, highlight }) => {
|
|
323
324
|
const labels = useChatLabels();
|
|
324
|
-
const [showSource, setShowSource] =
|
|
325
|
+
const [showSource, setShowSource] = useRowUiState(useRowPartKey(`mermaid:${textKey(code)}`), false);
|
|
325
326
|
const [failure, setFailure] = useState(null);
|
|
326
327
|
const failed = !streaming && failure?.code === code ? failure : null;
|
|
327
328
|
const sourceToggle = (buttonClass) => {
|
|
@@ -5,6 +5,16 @@ export interface SelectCursorProps {
|
|
|
5
5
|
selected: string | null;
|
|
6
6
|
/** Any value that changes when rows reflow, such as the stops. A change re-measures the highlight. */
|
|
7
7
|
layout: unknown;
|
|
8
|
+
/**
|
|
9
|
+
* The span to tint by its first and last root rows (`data-row`), instead of the rows marked `data-sel`: the
|
|
10
|
+
* prompt rail's hovered exchange.
|
|
11
|
+
*/
|
|
12
|
+
span?: {
|
|
13
|
+
first: string;
|
|
14
|
+
last: string;
|
|
15
|
+
} | null;
|
|
16
|
+
/** Scrolls the selection into view after each move. Off for a tint that only shows where something is. */
|
|
17
|
+
follow?: boolean;
|
|
8
18
|
/** Extra classes on the root element. */
|
|
9
19
|
className?: string;
|
|
10
20
|
/** Inline styles on the root element, merged after the component's own. */
|
|
@@ -15,4 +25,4 @@ export interface SelectCursorProps {
|
|
|
15
25
|
*
|
|
16
26
|
* @param props - Cursor props: the `selected` stop and a `layout` token.
|
|
17
27
|
*/
|
|
18
|
-
export declare function SelectCursor({ selected, layout, className, style }: SelectCursorProps): import("react").JSX.Element;
|
|
28
|
+
export declare function SelectCursor({ selected, layout, span, follow, className, style }: SelectCursorProps): import("react").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useReducedMotion } from "../../motion/reduced.js";
|
|
2
|
+
import { dataRowSelector } from "../headless/transcript/rail.js";
|
|
2
3
|
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
// src/chat/transcript/SelectCursor.tsx
|
|
@@ -10,7 +11,7 @@ const SELECT_BLEED_TOP_PX = 8;
|
|
|
10
11
|
*
|
|
11
12
|
* @param props - Cursor props: the `selected` stop and a `layout` token.
|
|
12
13
|
*/
|
|
13
|
-
function SelectCursor({ selected, layout, className, style }) {
|
|
14
|
+
function SelectCursor({ selected, layout, span = null, follow = true, className, style }) {
|
|
14
15
|
const ref = useRef(null);
|
|
15
16
|
const reduced = useReducedMotion();
|
|
16
17
|
const [box, setBox] = useState(null);
|
|
@@ -24,8 +25,10 @@ function SelectCursor({ selected, layout, className, style }) {
|
|
|
24
25
|
followed.current = null;
|
|
25
26
|
return;
|
|
26
27
|
}
|
|
28
|
+
const rowSel = (id) => `:scope > ${dataRowSelector(id)}`;
|
|
29
|
+
const pick = () => span ? [span.first, span.last].flatMap((id) => timeline.querySelector(rowSel(id)) ?? []) : [...timeline.querySelectorAll("[data-sel]")];
|
|
27
30
|
const measure = () => {
|
|
28
|
-
const marked =
|
|
31
|
+
const marked = pick();
|
|
29
32
|
if (marked.length === 0) return null;
|
|
30
33
|
const base = timeline.getBoundingClientRect().top;
|
|
31
34
|
let top = Number.POSITIVE_INFINITY;
|
|
@@ -43,7 +46,7 @@ function SelectCursor({ selected, layout, className, style }) {
|
|
|
43
46
|
const next = measure();
|
|
44
47
|
setBox(next);
|
|
45
48
|
const scroller = timeline.closest(".overflow-y-auto");
|
|
46
|
-
if (next && scroller && followed.current !== selected) {
|
|
49
|
+
if (follow && next && scroller && followed.current !== selected) {
|
|
47
50
|
followed.current = selected;
|
|
48
51
|
const view = scroller.getBoundingClientRect();
|
|
49
52
|
const top = timeline.getBoundingClientRect().top + next.top;
|
|
@@ -65,12 +68,14 @@ function SelectCursor({ selected, layout, className, style }) {
|
|
|
65
68
|
const box = measure();
|
|
66
69
|
setBox((prev) => prev && box && prev.top === box.top && prev.height === box.height ? prev : box);
|
|
67
70
|
});
|
|
68
|
-
for (const node of
|
|
71
|
+
for (const node of pick()) ro.observe(node);
|
|
69
72
|
return () => ro.disconnect();
|
|
70
73
|
}, [
|
|
71
74
|
selected,
|
|
72
75
|
layout,
|
|
73
|
-
reduced
|
|
76
|
+
reduced,
|
|
77
|
+
span,
|
|
78
|
+
follow
|
|
74
79
|
]);
|
|
75
80
|
useEffect(() => {
|
|
76
81
|
if (box === null || sliding) return void 0;
|
|
@@ -2,8 +2,9 @@ import { useStaysMounted } from "../../motion/collapse.js";
|
|
|
2
2
|
import { RunEstimateChip, useRunEstimate } from "../RunEstimateChip.js";
|
|
3
3
|
import { useChatLabels } from "../useChatLabels.js";
|
|
4
4
|
import { Caret, Dot, FailedMark, lineStateOf, useRowIcons } from "./frame.js";
|
|
5
|
+
import { useRowUiState } from "./row-ui-state.js";
|
|
5
6
|
import { ToolTiming } from "./tool-parts.js";
|
|
6
|
-
import { useMemo
|
|
7
|
+
import { useMemo } from "react";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
import { previewLine, spawnStartParts } from "zidane/chat/pure";
|
|
9
10
|
// src/chat/transcript/SubagentBlock.tsx
|
|
@@ -69,7 +70,7 @@ function subagentDot(status, streaming) {
|
|
|
69
70
|
*/
|
|
70
71
|
function SubagentBlock({ childId, sessionId, depth, parentDepth, rows, defaultCollapsed, streaming, children, "data-row": rowId, className, style }) {
|
|
71
72
|
const labels = useChatLabels();
|
|
72
|
-
const [userOpen, setUserOpen] =
|
|
73
|
+
const [userOpen, setUserOpen] = useRowUiState(`worker-block:${childId}`, null);
|
|
73
74
|
const open = userOpen ?? !defaultCollapsed;
|
|
74
75
|
const mounted = useStaysMounted(open);
|
|
75
76
|
const { task, status, durationMs, turns } = useMemo(() => subagentHeaderMeta(rows), [rows]);
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The prompt rail: one tick per prompt the user typed, left of the
|
|
3
|
+
* transcript's column (`.zg-transcript-column`, `--zg-transcript-gutter`):
|
|
4
|
+
* centred in the space between the pane's edge and the text, and once that
|
|
5
|
+
* space is wide, held near the pane's edge (`RAIL_EDGE_INSET_PX`), clear of
|
|
6
|
+
* the conversation.
|
|
7
|
+
* The tick of the exchange in view is raised as the transcript scrolls (or
|
|
8
|
+
* the one holding select-turn mode's cursor). Hovering a tick tints that
|
|
9
|
+
* exchange's rows and opens a card with the prompt and the start of its
|
|
10
|
+
* answer; moving along the rail moves the card, with no new delay, and Esc
|
|
11
|
+
* closes it. A click, or the previous / next message keys, glides the prompt
|
|
12
|
+
* to the top; next past the last prompt glides to the end of its answer.
|
|
13
|
+
*
|
|
14
|
+
* Every prompt of the session has a tick, loaded or not: the transcript's
|
|
15
|
+
* host gives the session's outline (`Transcript.outline`), and a tick whose
|
|
16
|
+
* history is not loaded yet loads up to it (`Transcript.loadThrough`) when
|
|
17
|
+
* picked, pulsing meanwhile, then lands there.
|
|
18
|
+
*
|
|
19
|
+
* A tick is 8px tall. Past `RAIL_MAX_TICKS` of them (or the view's height,
|
|
20
|
+
* less `RAIL_FIT_INSET_PX` above and below) the list scrolls: the edges with
|
|
21
|
+
* more ticks fade, and the tick in view is kept in sight.
|
|
22
|
+
*
|
|
23
|
+
* The rail floats over that space: showing, hiding or growing it never moves
|
|
24
|
+
* the layout. It hides with fewer than two prompts, where the space has no
|
|
25
|
+
* room for it, and on touch screens.
|
|
26
|
+
*
|
|
27
|
+
* <TranscriptRailProvider>
|
|
28
|
+
* <div className="relative">
|
|
29
|
+
* <section ref={scroller} className="overflow-y-auto">
|
|
30
|
+
* <div className="zg-transcript-column"><Transcript … /></div>
|
|
31
|
+
* </section>
|
|
32
|
+
* <TranscriptRail scroller={scroller} keys />
|
|
33
|
+
* </div>
|
|
34
|
+
* </TranscriptRailProvider>
|
|
35
|
+
*
|
|
36
|
+
* The transcript under the provider publishes its exchanges to it; one
|
|
37
|
+
* provider holds one transcript.
|
|
38
|
+
*/
|
|
39
|
+
import { Transcript } from "../headless/host.js";
|
|
40
|
+
import { Cluster, Row } from "../headless/transcript/rows.js";
|
|
41
|
+
import { TranscriptRailStore } from "../headless/transcript/rail.js";
|
|
42
|
+
import "../headless/transcript/index.js";
|
|
43
|
+
import { TranscriptRowsSlice } from "../headless/transcript/incremental.js";
|
|
44
|
+
import { CSSProperties, ReactNode, RefObject } from "react";
|
|
45
|
+
import { RunReceipt } from "zidane/chat/pure";
|
|
46
|
+
/** Props for {@link TranscriptRailProvider}. */
|
|
47
|
+
export interface TranscriptRailProviderProps {
|
|
48
|
+
/** The transcript and its rail. */
|
|
49
|
+
children: ReactNode;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Holds the rail's store for the transcript and the rail below it.
|
|
53
|
+
*
|
|
54
|
+
* @param props - The {@link TranscriptRailProviderProps}.
|
|
55
|
+
*/
|
|
56
|
+
export declare function TranscriptRailProvider({ children }: TranscriptRailProviderProps): import("react").JSX.Element;
|
|
57
|
+
/** The rail store of the nearest {@link TranscriptRailProvider}, or `null` outside one. */
|
|
58
|
+
export declare function useTranscriptRailStore(): TranscriptRailStore | null;
|
|
59
|
+
/**
|
|
60
|
+
* The transcript's side of the rail: publishes its exchanges and the cursor's exchange to the provider's store.
|
|
61
|
+
* Outside a provider it computes nothing.
|
|
62
|
+
*
|
|
63
|
+
* @param clusters - The root clusters the transcript paints, or their settled and open parts (the settled ones fold once).
|
|
64
|
+
* @param isHidden - Whether a row paints nothing.
|
|
65
|
+
* @param receipts - The receipts docked on reply rows.
|
|
66
|
+
* @param selectedTurn - Select-turn mode's selected stop (a turn id), or `null`.
|
|
67
|
+
*/
|
|
68
|
+
export declare function useRailPublish(clusters: readonly Cluster[] | {
|
|
69
|
+
settled: TranscriptRowsSlice;
|
|
70
|
+
open: TranscriptRowsSlice;
|
|
71
|
+
}, isHidden: (row: Row) => boolean, receipts: ReadonlyMap<string, RunReceipt>, selectedTurn: string | null): TranscriptRailStore | null;
|
|
72
|
+
/**
|
|
73
|
+
* The transcript host's side of the rail: hands it the session's prompt outline while part of the history is not
|
|
74
|
+
* loaded, and how to load up to one of them. Read again when the session changes, when more history becomes
|
|
75
|
+
* loadable, and when the outline no longer matches the loaded rows (the history was rewritten).
|
|
76
|
+
*
|
|
77
|
+
* @param transcript - The session's transcript, from its host.
|
|
78
|
+
* @param hasEarlier - Older history is not loaded yet.
|
|
79
|
+
*/
|
|
80
|
+
export declare function useRailOutline(transcript: Transcript, hasEarlier: boolean): void;
|
|
81
|
+
/** Props for {@link RailTint}. */
|
|
82
|
+
interface RailTintProps {
|
|
83
|
+
store: TranscriptRailStore;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The hovered exchange's tint, behind the transcript's rows (the select cursor's element, without following).
|
|
87
|
+
*
|
|
88
|
+
* @param props - The rail's store.
|
|
89
|
+
*/
|
|
90
|
+
export declare const RailTint: import("react").MemoExoticComponent<({ store }: RailTintProps) => import("react").JSX.Element>;
|
|
91
|
+
/** Props for {@link TranscriptRail}. */
|
|
92
|
+
export interface TranscriptRailProps {
|
|
93
|
+
/** The transcript's scroll area. The rail sits left of its `.zg-transcript-column`, in the rail's offset parent. */
|
|
94
|
+
scroller: RefObject<HTMLElement | null>;
|
|
95
|
+
/** Binds the previous / next prompt keys (`previousPrompt`, `nextPrompt`) to this rail: the conversation on show. */
|
|
96
|
+
keys?: boolean;
|
|
97
|
+
/** Extra classes on the rail's root element. */
|
|
98
|
+
className?: string;
|
|
99
|
+
/** Inline styles on the root element, merged after the component's own. */
|
|
100
|
+
style?: CSSProperties;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Renders the prompt rail left of a transcript's column: a tick per prompt, the one in view raised, a card on hover,
|
|
104
|
+
* a jump on click.
|
|
105
|
+
*
|
|
106
|
+
* @param props - The {@link TranscriptRailProps}.
|
|
107
|
+
*/
|
|
108
|
+
export declare function TranscriptRail({ scroller, keys, className, style }: TranscriptRailProps): import("react").JSX.Element;
|
|
109
|
+
export {};
|