zidane-ui 9.2.3 → 9.4.0
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/live.d.ts +8 -0
- package/dist/adapters/live.js +19 -8
- package/dist/adapters/server-composer-host.js +22 -9
- package/dist/adapters/server-git-host.js +5 -2
- package/dist/adapters/server-host.js +158 -27
- package/dist/adapters/server-machines-host.js +7 -0
- package/dist/adapters/server-media.d.ts +9 -1
- package/dist/adapters/server-media.js +14 -1
- package/dist/adapters/server-session-host.js +49 -0
- package/dist/adapters/server-settings-sections.js +4 -1
- package/dist/adapters/sse-host.js +3 -0
- package/dist/adapters/sse-protocol.d.ts +10 -0
- package/dist/appearance/ZoomIndicator.js +5 -8
- package/dist/chat/HostTranscript.d.ts +0 -12
- package/dist/chat/HostTranscript.js +20 -1
- package/dist/chat/SessionStreamsProvider.d.ts +9 -1
- package/dist/chat/SessionStreamsProvider.js +11 -2
- package/dist/chat/Transcript.d.ts +21 -11
- package/dist/chat/Transcript.js +346 -161
- package/dist/chat/composer/ModelOptionsPicker.js +6 -2
- package/dist/chat/composer/ModelPicker.d.ts +1 -1
- package/dist/chat/composer/PlacePicker.d.ts +3 -1
- package/dist/chat/composer/PlacePicker.js +5 -1
- package/dist/chat/composer/use-draft-target.js +15 -3
- package/dist/chat/headless/block-runs.js +26 -1
- package/dist/chat/headless/chip-views.js +1 -1
- package/dist/chat/headless/draft-target.d.ts +28 -1
- package/dist/chat/headless/draft-target.js +22 -1
- package/dist/chat/headless/host.d.ts +43 -7
- package/dist/chat/headless/hosts.d.ts +4 -0
- package/dist/chat/headless/index.d.ts +27 -26
- package/dist/chat/headless/index.js +15 -14
- package/dist/chat/headless/labels.d.ts +17 -0
- package/dist/chat/headless/labels.js +17 -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 +64 -0
- package/dist/chat/headless/markdown-scan.js +119 -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/prompt-origin.d.ts +2 -0
- package/dist/chat/headless/prompt-origin.js +6 -2
- package/dist/chat/headless/session-list.d.ts +10 -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 +19 -2
- package/dist/chat/headless/sidebar/directory.js +19 -51
- package/dist/chat/headless/sidebar/environment.d.ts +15 -4
- package/dist/chat/headless/sidebar/environment.js +27 -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 +19 -2
- package/dist/chat/headless/sidebar/labels.js +8 -1
- 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 +4 -2
- package/dist/chat/headless/streams/actions.js +2 -1
- package/dist/chat/headless/streams/event-bytes.d.ts +17 -0
- package/dist/chat/headless/streams/event-bytes.js +46 -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 +45 -6
- package/dist/chat/headless/streams/store.js +85 -31
- package/dist/chat/headless/streams/transcript-map.d.ts +57 -0
- package/dist/chat/headless/streams/transcript-map.js +85 -0
- package/dist/chat/headless/streams/transcript.d.ts +4 -2
- package/dist/chat/headless/streams/transcript.js +19 -7
- package/dist/chat/headless/streams/types.d.ts +2 -1
- 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 +35 -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-attachments.d.ts +2 -0
- package/dist/chat/headless/transcript/fold-attachments.js +3 -2
- package/dist/chat/headless/transcript/fold.d.ts +2 -1
- package/dist/chat/headless/transcript/fold.js +16 -6
- 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 -2
- package/dist/chat/headless/transcript/index.js +2 -2
- package/dist/chat/headless/transcript/nesting.js +2 -1
- package/dist/chat/headless/transcript/rail.d.ts +50 -1
- package/dist/chat/headless/transcript/rail.js +165 -23
- package/dist/chat/headless/transcript/rows.d.ts +5 -1
- package/dist/chat/headless/transcript/run-failures.js +2 -1
- 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/index.d.ts +9 -8
- package/dist/chat/index.js +18 -17
- package/dist/chat/sidebar/ProjectIcon.js +1 -1
- package/dist/chat/sidebar/RowChips.js +2 -2
- package/dist/chat/sidebar/SessionSidebar.d.ts +6 -0
- package/dist/chat/sidebar/SessionSidebar.js +23 -16
- package/dist/chat/sidebar/SidebarFilterMenu.js +0 -1
- package/dist/chat/sidebar/SidebarFold.js +17 -16
- package/dist/chat/sidebar/SidebarFooter.d.ts +8 -5
- package/dist/chat/sidebar/SidebarFooter.js +6 -6
- package/dist/chat/sidebar/SidebarSessionRow.d.ts +7 -1
- package/dist/chat/sidebar/SidebarSessionRow.js +11 -8
- package/dist/chat/sidebar/session-menu.d.ts +4 -0
- package/dist/chat/sidebar/session-menu.js +14 -2
- package/dist/chat/sidebar/sidebar-live.js +28 -4
- package/dist/chat/sidebar/useInboxRows.js +6 -6
- package/dist/chat/sidebar/useInboxTriage.js +50 -47
- package/dist/chat/sidebar/useSessionSearch.js +19 -18
- package/dist/chat/testing/contract.d.ts +5 -3
- package/dist/chat/testing/contract.js +66 -1
- 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/FileChip.js +28 -0
- package/dist/chat/transcript/LazyRow.d.ts +40 -40
- package/dist/chat/transcript/LazyRow.js +100 -149
- package/dist/chat/transcript/MermaidDiagram.js +2 -1
- package/dist/chat/transcript/PromptEcho.js +3 -11
- package/dist/chat/transcript/SessionChip.d.ts +11 -0
- package/dist/chat/transcript/SessionChip.js +34 -0
- package/dist/chat/transcript/SubagentBlock.js +3 -2
- package/dist/chat/transcript/TranscriptRail.d.ts +25 -2
- package/dist/chat/transcript/TranscriptRail.js +175 -17
- package/dist/chat/transcript/TranscriptRow.d.ts +4 -7
- package/dist/chat/transcript/TranscriptRow.js +4 -3
- package/dist/chat/transcript/actions.d.ts +37 -1
- package/dist/chat/transcript/actions.js +27 -1
- package/dist/chat/transcript/chip-details.d.ts +11 -0
- package/dist/chat/transcript/chip-details.js +17 -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 +5 -3
- package/dist/chat/transcript/fold.js +13 -4
- package/dist/chat/transcript/index.d.ts +11 -10
- package/dist/chat/transcript/index.js +10 -9
- package/dist/chat/transcript/markdown-cache.d.ts +17 -2
- package/dist/chat/transcript/markdown-cache.js +48 -4
- package/dist/chat/transcript/markdown.js +110 -55
- package/dist/chat/transcript/media-gallery.d.ts +3 -2
- package/dist/chat/transcript/media-gallery.js +19 -19
- package/dist/chat/transcript/messages.js +5 -4
- package/dist/chat/transcript/notices.js +2 -1
- package/dist/chat/transcript/prompt.d.ts +1 -1
- package/dist/chat/transcript/prompt.js +6 -4
- package/dist/chat/transcript/prose.js +2 -1
- 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 +184 -0
- package/dist/chat/transcript/row-mount.js +532 -0
- package/dist/chat/transcript/row-parking.d.ts +152 -0
- package/dist/chat/transcript/row-parking.js +171 -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 +3 -2
- package/dist/chat/transcript/script-input.d.ts +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 -6
- 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 +25 -8
- package/dist/chat/transcript/use-transcript-rows.js +28 -46
- package/dist/chat/transcript/useHistoryBackfill.d.ts +42 -0
- package/dist/chat/transcript/useHistoryBackfill.js +170 -0
- package/dist/chat/transcript/useStickToBottom.js +2 -3
- package/dist/chat/transcript/useTranscriptFind.js +2 -4
- package/dist/chat/transcript/useTranscriptScroll.d.ts +7 -4
- package/dist/chat/transcript/useTranscriptScroll.js +12 -1
- package/dist/chat/transcript/useTranscriptSearch.d.ts +2 -2
- package/dist/chat/transcript/useTranscriptSearch.js +35 -19
- package/dist/chat/transcript/useTranscriptSelectionCopy.d.ts +5 -5
- package/dist/chat/transcript/useTranscriptSelectionCopy.js +28 -7
- package/dist/chat/transcript/view-scope.d.ts +26 -6
- package/dist/chat/transcript/view-scope.js +106 -20
- package/dist/code/editor/FileTree.d.ts +2 -0
- package/dist/code/editor/FileTree.js +1 -1
- package/dist/code/editor/FileView.js +16 -25
- package/dist/code/editor/find/useFind.js +17 -17
- package/dist/code/editor/useCodeDocument.js +22 -19
- package/dist/code/editor/useDetachCleanup.js +4 -3
- package/dist/code/use-highlighted-html.js +12 -13
- package/dist/components/IconButton.d.ts +3 -1
- package/dist/components/IconButton.js +7 -2
- package/dist/components/IconButtonTip.d.ts +3 -1
- package/dist/components/IconButtonTip.js +2 -1
- package/dist/components/RowActionsMenu.js +7 -14
- package/dist/components/Tooltip.d.ts +4 -1
- package/dist/components/Tooltip.js +8 -6
- package/dist/components/assign-ref.d.ts +8 -0
- package/dist/components/assign-ref.js +12 -0
- package/dist/components/floating/FloatingSurface.js +2 -2
- package/dist/components/floating/HoverCard.js +32 -14
- package/dist/components/floating/Popover.js +4 -7
- package/dist/components/floating/useAnchoredPosition.d.ts +5 -3
- package/dist/components/floating/useAnchoredPosition.js +7 -7
- package/dist/components/object-key.d.ts +7 -0
- package/dist/components/object-key.js +18 -0
- package/dist/components/palette/PaletteList.js +2 -7
- package/dist/components/tooltip-arming.d.ts +3 -0
- package/dist/components/tooltip-arming.js +8 -1
- package/dist/core.css +3 -3
- package/dist/dist/{index-E1Z0aPmi.d.ts → index-BheVJOLc.d.ts} +3 -1
- package/dist/dist/index.d.ts +2 -2
- package/dist/files/FilesTab.js +0 -1
- package/dist/files/TreeColumn.d.ts +2 -4
- package/dist/files/TreeColumn.js +0 -5
- package/dist/files/headless/host.d.ts +3 -7
- package/dist/files/headless/labels.d.ts +0 -1
- package/dist/files/headless/labels.js +0 -1
- package/dist/files/headless/workspace-diff.js +1 -1
- package/dist/files/useCodeReview.js +1 -3
- package/dist/files/useFilesDiagnostics.d.ts +1 -1
- package/dist/files/useFilesDiagnostics.js +4 -11
- package/dist/files/useOpenFiles.js +9 -12
- package/dist/files/useWorkspace.d.ts +5 -7
- package/dist/files/useWorkspace.js +4 -15
- package/dist/git/GitBar.js +5 -3
- package/dist/git/MoveSessionDialog.d.ts +18 -8
- package/dist/git/MoveSessionDialog.js +32 -53
- package/dist/git/MoveToDialog.d.ts +61 -0
- package/dist/git/MoveToDialog.js +240 -0
- package/dist/git/SandboxManager.js +9 -4
- package/dist/git/SyncChip.js +11 -4
- package/dist/git/TeleportSessionDialog.d.ts +69 -0
- package/dist/git/TeleportSessionDialog.js +440 -0
- package/dist/git/headless/host.d.ts +14 -0
- package/dist/git/headless/index.d.ts +2 -1
- package/dist/git/headless/index.js +2 -1
- package/dist/git/headless/labels.d.ts +44 -1
- package/dist/git/headless/labels.js +50 -0
- package/dist/git/headless/sandboxes.d.ts +1 -1
- package/dist/git/headless/sandboxes.js +4 -3
- package/dist/git/headless/teleport.d.ts +76 -0
- package/dist/git/headless/teleport.js +19 -0
- package/dist/git/index.d.ts +4 -2
- package/dist/git/index.js +4 -2
- package/dist/git/useEnvironmentChoices.d.ts +5 -2
- package/dist/git/useEnvironmentChoices.js +12 -4
- package/dist/hooks/useLatest.d.ts +8 -0
- package/dist/hooks/useLatest.js +17 -0
- package/dist/hooks/useMinuteTick.d.ts +6 -2
- package/dist/hooks/useMinuteTick.js +12 -6
- package/dist/hooks/useNearViewport.js +11 -8
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/keybindings/KeybindingsProvider.js +3 -4
- package/dist/keybindings/headless/catalog.d.ts +1 -1
- package/dist/keybindings/headless/catalog.js +18 -0
- package/dist/machines/AddServerForm.js +55 -3
- package/dist/machines/Banners.d.ts +2 -2
- package/dist/machines/Banners.js +3 -3
- package/dist/machines/DaemonMenu.js +1 -3
- package/dist/machines/HostsSection.js +5 -1
- package/dist/machines/OrganizationPanel.d.ts +25 -0
- package/dist/machines/OrganizationPanel.js +266 -0
- package/dist/machines/PersonalLayerPanel.d.ts +32 -0
- package/dist/machines/PersonalLayerPanel.js +360 -0
- package/dist/machines/headless/fixture-host.d.ts +10 -0
- package/dist/machines/headless/fixture-host.js +44 -0
- package/dist/machines/headless/host.d.ts +21 -1
- package/dist/machines/headless/index.d.ts +3 -1
- package/dist/machines/headless/index.js +3 -1
- package/dist/machines/headless/labels.d.ts +55 -0
- package/dist/machines/headless/labels.js +58 -1
- package/dist/machines/headless/layer.d.ts +64 -0
- package/dist/machines/headless/layer.js +56 -0
- package/dist/machines/headless/organization.d.ts +38 -0
- package/dist/machines/headless/organization.js +44 -0
- package/dist/machines/index.d.ts +3 -1
- package/dist/machines/index.js +3 -1
- package/dist/machines/testing/contract.d.ts +25 -1
- package/dist/machines/testing/contract.js +97 -1
- package/dist/motion/grow.js +12 -13
- package/dist/motion/swap.js +2 -5
- package/dist/motion/use-flip-list.d.ts +14 -0
- package/dist/motion/use-flip-list.js +17 -12
- package/dist/palette/headless/app-sources.js +37 -0
- package/dist/palette/headless/labels.js +3 -0
- package/dist/server/sse-handler.js +25 -2
- package/dist/session/DiffFileTree.js +1 -4
- package/dist/session/OpenSessionsDialog.d.ts +46 -0
- package/dist/session/OpenSessionsDialog.js +170 -0
- package/dist/session/PlanTracker.js +1 -2
- package/dist/session/ProjectHome.js +10 -9
- package/dist/session/RemindersPanel.js +10 -12
- package/dist/session/SecretsPanel.js +2 -1
- package/dist/session/SessionHeader.js +1 -0
- package/dist/session/SessionPeopleStack.d.ts +23 -0
- package/dist/session/SessionPeopleStack.js +65 -0
- package/dist/session/SessionPlaceMenu.js +5 -4
- package/dist/session/ShareSessionDialog.d.ts +32 -0
- package/dist/session/ShareSessionDialog.js +342 -0
- package/dist/session/TypingLine.d.ts +22 -0
- package/dist/session/TypingLine.js +31 -0
- package/dist/session/headless/host.d.ts +40 -1
- package/dist/session/headless/index.d.ts +4 -2
- package/dist/session/headless/index.js +3 -1
- package/dist/session/headless/labels.d.ts +49 -0
- package/dist/session/headless/labels.js +56 -0
- package/dist/session/headless/people.d.ts +29 -0
- package/dist/session/headless/people.js +53 -0
- package/dist/session/headless/place.d.ts +5 -0
- package/dist/session/headless/place.js +5 -1
- package/dist/session/headless/typing.d.ts +37 -0
- package/dist/session/headless/typing.js +60 -0
- package/dist/session/index.d.ts +5 -1
- package/dist/session/index.js +5 -1
- package/dist/settings/headless/fixture-performance.js +4 -2
- package/dist/settings/headless/performance.d.ts +4 -0
- package/dist/settings/headless/search.d.ts +1 -1
- package/dist/settings/headless/sections-host.d.ts +7 -2
- package/dist/settings/section.d.ts +15 -3
- package/dist/settings/section.js +15 -3
- package/dist/settings/sections/environments/EnvironmentsSection.js +30 -6
- package/dist/settings/sections/keybindings/labels.d.ts +3 -0
- package/dist/settings/sections/keybindings/labels.js +3 -0
- package/dist/settings/sections/keybindings/rows.js +12 -0
- package/dist/settings/sections/logs/LogsSection.js +5 -8
- 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/styles.css +65 -9
- package/dist/terminal/HostTerminalSurface.js +28 -30
- package/dist/terminal/TerminalPanel.js +4 -12
- package/dist/terminal/TerminalProvider.d.ts +10 -2
- package/dist/terminal/TerminalProvider.js +10 -2
- package/dist/terminal/headless/labels.d.ts +0 -1
- package/dist/terminal/headless/labels.js +1 -2
- package/dist/terminal/headless/store.js +5 -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/LayoutBudget.js +1 -7
- package/package.json +2 -2
- package/src/styles/chat.css +3 -1
- package/src/styles/palette.css +3 -3
- package/src/styles/transcript.css +50 -5
- /package/dist/dist/{index-De9AbmxS.d.ts → index-ttmMvjgM.d.ts} +0 -0
package/dist/chat/Transcript.js
CHANGED
|
@@ -3,15 +3,17 @@ import { useExtensionItems } from "../extensions/ExtensionsProvider.js";
|
|
|
3
3
|
import { LinkSessionScope } from "../extensions/links.js";
|
|
4
4
|
import { ViewAnswers } from "../views/headless/answers.js";
|
|
5
5
|
import { eventsMayHoldViews } from "../views/headless/placement.js";
|
|
6
|
-
import {
|
|
7
|
-
import { rowTurnIds, stopForRow } from "./headless/transcript/select-stops.js";
|
|
6
|
+
import { stopForRow } from "./headless/transcript/select-stops.js";
|
|
8
7
|
import { useTranscriptActions } from "./transcript/actions.js";
|
|
9
8
|
import { DiagramsContext } from "./transcript/diagrams-scope.js";
|
|
10
9
|
import { LiveScriptsContext } from "./transcript/fold.js";
|
|
11
10
|
import { RowIconsContext } from "./transcript/frame.js";
|
|
12
|
-
import { CvRow, TranscriptSettling } from "./transcript/LazyRow.js";
|
|
11
|
+
import { CvRow, LazyRow, TranscriptSettling, useForcedRows } from "./transcript/LazyRow.js";
|
|
13
12
|
import { MediaGalleryProvider } from "./transcript/media-gallery.js";
|
|
14
|
-
import {
|
|
13
|
+
import { endsByRow, groupRowId, matchingItems, rootItems } from "./transcript/root-items.js";
|
|
14
|
+
import { rowCvStyle } from "./transcript/row-estimate.js";
|
|
15
|
+
import { RowMountContext, RowMounter } from "./transcript/row-mount.js";
|
|
16
|
+
import { RowUiStateContext, createRowUiState } from "./transcript/row-ui-state.js";
|
|
15
17
|
import { SelectCursor } from "./transcript/SelectCursor.js";
|
|
16
18
|
import { SubagentBlock } from "./transcript/SubagentBlock.js";
|
|
17
19
|
import { RailTint, useRailPublish } from "./transcript/TranscriptRail.js";
|
|
@@ -20,9 +22,61 @@ import { useSelectStops, useTranscriptRows } from "./transcript/use-transcript-r
|
|
|
20
22
|
import { useTranscriptSelectionCopy } from "./transcript/useTranscriptSelectionCopy.js";
|
|
21
23
|
import { CodemodeViewsSlot, ReplyViewPlaces, ViewsScopeContext, useViewsReady, viewsScopeOf } from "./transcript/view-scope.js";
|
|
22
24
|
import { memo, useCallback, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
23
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
24
|
-
import { DEFAULT_SETTINGS, runTailActivity } from "zidane/chat/pure";
|
|
25
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
26
|
+
import { DEFAULT_SETTINGS, chunkFact, runTailActivity, transcriptFromArray, transcriptOfArray } from "zidane/chat/pure";
|
|
25
27
|
// src/chat/Transcript.tsx
|
|
28
|
+
const NO_SLICE = {
|
|
29
|
+
rows: [],
|
|
30
|
+
clusters: []
|
|
31
|
+
};
|
|
32
|
+
const NO_KEYS = [];
|
|
33
|
+
/** The tail that mounts with its first render: `EAGER_SCREENS` views' worth of rows (estimated), never fewer than `EAGER_MIN` rows nor more than `EAGER_MAX`. */
|
|
34
|
+
const EAGER_SCREENS = 1.5;
|
|
35
|
+
const EAGER_MIN = 6;
|
|
36
|
+
const EAGER_MAX = 40;
|
|
37
|
+
/** The keys of the transcript's tail, read from the end (a few items, whatever the length). */
|
|
38
|
+
function tailKeys(settled, open, sizeOf) {
|
|
39
|
+
const budget = (typeof window === "undefined" ? 1e3 : window.innerHeight) * EAGER_SCREENS;
|
|
40
|
+
const out = /* @__PURE__ */ new Set();
|
|
41
|
+
let rows = 0;
|
|
42
|
+
let px = 0;
|
|
43
|
+
for (let i = settled.length + open.length - 1; i >= 0; i--) {
|
|
44
|
+
const item = i >= settled.length ? open[i - settled.length] : settled[i];
|
|
45
|
+
out.add(item.key);
|
|
46
|
+
if (item.kind === "single" || item.kind === "group") {
|
|
47
|
+
rows++;
|
|
48
|
+
px += sizeOf(item.key) ?? item.estimate;
|
|
49
|
+
}
|
|
50
|
+
if (rows >= EAGER_MAX || rows >= EAGER_MIN && px >= budget) break;
|
|
51
|
+
}
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Root rows before the transcript's flat run, behind memoized fibers: a render that changes none of them (a stream
|
|
56
|
+
* tick) never walks them, and a render for one row (it mounts, it parks) walks its run only. React walks every child
|
|
57
|
+
* of a fiber it renders through, and each child it skips looks up its context providers: one run of every history
|
|
58
|
+
* row made each row's mount cost the whole history. The flat run after them starts where the open exchange started
|
|
59
|
+
* when the conversation showed, so a row never moves between the two (that would remount it).
|
|
60
|
+
*/
|
|
61
|
+
const RowRun = memo(({ rows }) => /* @__PURE__ */ jsx(Fragment$1, { children: rows }), (a, b) => a.rows.length === b.rows.length && a.rows.every((row, i) => row === b.rows[i]));
|
|
62
|
+
RowRun.displayName = "RowRun";
|
|
63
|
+
/** Rows per {@link RowRun}. */
|
|
64
|
+
const RUN_ROWS = 64;
|
|
65
|
+
/** The rows in runs of {@link RUN_ROWS}, counted from the end: history prepended adds runs in front, and a row never changes runs. */
|
|
66
|
+
function rowRuns(rows) {
|
|
67
|
+
const runs = [];
|
|
68
|
+
for (let end = rows.length, k = 0; end > 0; end -= RUN_ROWS, k++) runs.push(/* @__PURE__ */ jsx(RowRun, { rows: rows.slice(Math.max(0, end - RUN_ROWS), end) }, `\u0000run${k}`));
|
|
69
|
+
return runs.reverse();
|
|
70
|
+
}
|
|
71
|
+
/** Whether a transcript can hold a view (`eventsMayHoldViews`), each settled exchange read once. */
|
|
72
|
+
function mayHoldViews(transcript) {
|
|
73
|
+
return eventsMayHoldViews(transcript.tail) || transcript.chunks.some((chunk) => chunkFact(chunk, "may-hold-views", eventsMayHoldViews));
|
|
74
|
+
}
|
|
75
|
+
/** `runTailActivity` of the open exchange: its scan stops at the exchange's prompt, so the result is the whole transcript's. */
|
|
76
|
+
function tailActivity(transcript) {
|
|
77
|
+
const tail = transcript.tail.length > 0 || transcript.chunks.length === 0 ? transcript.tail : transcript.chunks.at(-1);
|
|
78
|
+
return runTailActivity(tail);
|
|
79
|
+
}
|
|
26
80
|
/** zidane's defaults for those settings. */
|
|
27
81
|
const DEFAULT_TRANSCRIPT_OPTIONS = {
|
|
28
82
|
showRowIcons: DEFAULT_SETTINGS.showRowIcons,
|
|
@@ -47,45 +101,9 @@ const DEFAULT_TRANSCRIPT_OPTIONS = {
|
|
|
47
101
|
viewsSave: DEFAULT_SETTINGS.viewsSave,
|
|
48
102
|
viewsOrchestration: DEFAULT_SETTINGS.viewsOrchestration
|
|
49
103
|
};
|
|
50
|
-
/**
|
|
51
|
-
* Top-level rows at the end of the transcript that mount at once (the rest
|
|
52
|
-
* mount on approach, `LazyRow`): enough to fill the window when the session
|
|
53
|
-
* opens pinned to the bottom, so the first frame shows real rows. Sized by
|
|
54
|
-
* the rows' estimated heights (`EAGER_SCREENS` windows' worth), never fewer
|
|
55
|
-
* than `EAGER_MIN` rows nor more than `EAGER_MAX`: mounting forty rows when
|
|
56
|
-
* eight fill the window made every conversation switch pay for the other
|
|
57
|
-
* thirty-two in its frame. Rows above mount next, from the viewport
|
|
58
|
-
* observers, and the ones within a viewport of the view mount at once.
|
|
59
|
-
*/
|
|
60
|
-
const EAGER_SCREENS = 1.5;
|
|
61
|
-
const EAGER_MIN = 6;
|
|
62
|
-
const EAGER_MAX = 40;
|
|
63
|
-
/**
|
|
64
|
-
* Index of the first root cluster that mounts at once (`EAGER_SCREENS`).
|
|
65
|
-
*
|
|
66
|
-
* @param list - The root clusters.
|
|
67
|
-
* @param hidden - Rows that render nothing (they take no room).
|
|
68
|
-
*/
|
|
69
|
-
function eagerTailStart(list, hidden) {
|
|
70
|
-
const budget = (typeof window === "undefined" ? 1e3 : window.innerHeight) * EAGER_SCREENS;
|
|
71
|
-
let px = 0;
|
|
72
|
-
let rows = 0;
|
|
73
|
-
for (let i = list.length - 1; i >= 0; i--) {
|
|
74
|
-
const cluster = list[i];
|
|
75
|
-
if (cluster.kind === "single") {
|
|
76
|
-
if (hidden(cluster.row)) continue;
|
|
77
|
-
px += rowEstimatePx(cluster.row);
|
|
78
|
-
}
|
|
79
|
-
rows++;
|
|
80
|
-
if (rows >= EAGER_MAX || rows >= EAGER_MIN && px >= budget) return i;
|
|
81
|
-
}
|
|
82
|
-
return 0;
|
|
83
|
-
}
|
|
84
104
|
/** How long after a conversation first paints its rows count as already there. */
|
|
85
105
|
const SETTLE_MS = 400;
|
|
86
|
-
/**
|
|
87
|
-
const groupRowId = (cluster, index) => `group-${firstRowId(cluster) ?? index}-${cluster.childId}`;
|
|
88
|
-
/** Renders a session's events as transcript rows: messages, tool calls grouped by the display options, subagent blocks, notices, and the select-turn cursor. Rows mount lazily as they near the viewport. */
|
|
106
|
+
/** Renders a session's events as transcript rows: messages, tool calls grouped by the display options, subagent blocks, notices, and the select-turn cursor. Rows mount as they near the view, and stay. */
|
|
89
107
|
const Transcript = memo(({ events, streaming, sessionId, options, selection, turnMenu, runStatus, liveScripts = false, className, style, children }) => {
|
|
90
108
|
const o = options ? {
|
|
91
109
|
...DEFAULT_TRANSCRIPT_OPTIONS,
|
|
@@ -95,6 +113,9 @@ const Transcript = memo(({ events, streaming, sessionId, options, selection, tur
|
|
|
95
113
|
const showFullShellOutput = Boolean(o.showFullShellOutput);
|
|
96
114
|
const collapseSubagents = o.hideSubagentOutput;
|
|
97
115
|
const { openSession, resume } = useTranscriptActions();
|
|
116
|
+
const split = useRef(void 0);
|
|
117
|
+
const transcript = useMemo(() => Array.isArray(events) ? transcriptOfArray(events) ?? transcriptFromArray(events, split.current) : events, [events]);
|
|
118
|
+
split.current = transcript;
|
|
98
119
|
const settle = useRef({
|
|
99
120
|
sessionId: null,
|
|
100
121
|
shown: false,
|
|
@@ -105,13 +126,13 @@ const Transcript = memo(({ events, streaming, sessionId, options, selection, tur
|
|
|
105
126
|
shown: false,
|
|
106
127
|
until: 0
|
|
107
128
|
};
|
|
108
|
-
const viewsReady = useViewsReady(o.views && !settle.current.shown &&
|
|
109
|
-
if (!settle.current.shown &&
|
|
129
|
+
const viewsReady = useViewsReady(o.views && !settle.current.shown && mayHoldViews(transcript), sessionId);
|
|
130
|
+
if (!settle.current.shown && transcript.length > 0 && viewsReady) {
|
|
110
131
|
settle.current.shown = true;
|
|
111
132
|
settle.current.until = performance.now() + SETTLE_MS;
|
|
112
133
|
}
|
|
113
134
|
const settling = useCallback(() => performance.now() < settle.current.until, []);
|
|
114
|
-
const
|
|
135
|
+
const rows = useTranscriptRows(transcript, streaming, {
|
|
115
136
|
showCacheNotices: o.showCacheNotices,
|
|
116
137
|
codemodeShowCalls: o.codemodeShowCalls,
|
|
117
138
|
showEditDiffs,
|
|
@@ -119,26 +140,49 @@ const Transcript = memo(({ events, streaming, sessionId, options, selection, tur
|
|
|
119
140
|
showRunReceipt: o.showRunReceipt,
|
|
120
141
|
compact: o.transcriptDensity === "compact"
|
|
121
142
|
});
|
|
143
|
+
const { receiptByRowId, resumableId, lastStreamingRow } = rows;
|
|
144
|
+
const parts = rows.parts ?? {
|
|
145
|
+
settled: NO_SLICE,
|
|
146
|
+
open: {
|
|
147
|
+
rows: rows.visibleRows,
|
|
148
|
+
clusters: rows.clusters
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const settledClusters = parts.settled.clusters;
|
|
152
|
+
const openClusters = parts.open.clusters;
|
|
122
153
|
const slotEntries = useExtensionItems("slot");
|
|
154
|
+
const turnEndsPrev = useRef(null);
|
|
123
155
|
const turnEnds = useMemo(() => {
|
|
124
156
|
const wanted = /* @__PURE__ */ new Set();
|
|
125
157
|
for (const { item } of slotEntries) if (item.at === "transcript.turn-end" && item.turnId && (item.sessionId === void 0 || item.sessionId === sessionId)) wanted.add(item.turnId);
|
|
126
158
|
if (wanted.size === 0) return null;
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
159
|
+
const ends = endsByRow({
|
|
160
|
+
settled: settledClusters,
|
|
161
|
+
open: openClusters
|
|
162
|
+
}, (at, add) => {
|
|
163
|
+
const byRow = /* @__PURE__ */ new Map();
|
|
164
|
+
for (const turnId of wanted) {
|
|
165
|
+
const where = at(turnId);
|
|
166
|
+
if (!where) continue;
|
|
167
|
+
const entry = byRow.get(where.rowId);
|
|
168
|
+
if (entry) entry.turns.push(turnId);
|
|
169
|
+
else byRow.set(where.rowId, {
|
|
170
|
+
where,
|
|
171
|
+
turns: [turnId]
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
for (const { where, turns } of byRow.values()) add(where, turns);
|
|
175
|
+
}, turnEndsPrev.current);
|
|
176
|
+
turnEndsPrev.current = ends;
|
|
177
|
+
return ends;
|
|
135
178
|
}, [
|
|
136
179
|
slotEntries,
|
|
137
180
|
sessionId,
|
|
138
|
-
|
|
181
|
+
settledClusters,
|
|
182
|
+
openClusters
|
|
139
183
|
]);
|
|
140
184
|
const viewInputs = o.views && o.viewsInputs;
|
|
141
|
-
const viewEvents = o.views ?
|
|
185
|
+
const viewEvents = o.views ? transcript : null;
|
|
142
186
|
const [viewPlaces] = useState(() => new ReplyViewPlaces());
|
|
143
187
|
const [viewAnswers] = useState(() => new ViewAnswers());
|
|
144
188
|
useMemo(() => {
|
|
@@ -170,33 +214,37 @@ const Transcript = memo(({ events, streaming, sessionId, options, selection, tur
|
|
|
170
214
|
o.viewsOrchestration
|
|
171
215
|
]);
|
|
172
216
|
const textless = viewEvents ? viewPlaces.textlessExchanges : null;
|
|
217
|
+
const textlessPrev = useRef(null);
|
|
173
218
|
const textlessEnds = useMemo(() => {
|
|
174
219
|
if (!textless || !sessionId) return null;
|
|
175
220
|
const exchanges = textless.filter((exchange) => exchange.closed || !streaming);
|
|
176
221
|
if (exchanges.length === 0) return null;
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
return
|
|
222
|
+
const ends = endsByRow({
|
|
223
|
+
settled: settledClusters,
|
|
224
|
+
open: openClusters
|
|
225
|
+
}, (at, add) => {
|
|
226
|
+
for (const exchange of exchanges) {
|
|
227
|
+
let where;
|
|
228
|
+
for (const turnId of exchange.turns) where = at(turnId) ?? where;
|
|
229
|
+
if (where) add(where, exchange.turns);
|
|
230
|
+
}
|
|
231
|
+
}, textlessPrev.current);
|
|
232
|
+
textlessPrev.current = ends;
|
|
233
|
+
return ends;
|
|
189
234
|
}, [
|
|
190
235
|
textless,
|
|
191
236
|
sessionId,
|
|
192
237
|
streaming,
|
|
193
|
-
|
|
238
|
+
settledClusters,
|
|
239
|
+
openClusters
|
|
194
240
|
]);
|
|
195
241
|
const selectedTurnId = selection?.selected ?? null;
|
|
196
|
-
const stops = useSelectStops(
|
|
242
|
+
const stops = useSelectStops(rows, transcript, showThinking, selectedTurnId !== null, selection?.registerStops);
|
|
197
243
|
const hiddenRow = useCallback((row) => isHiddenRow(row, showThinking), [showThinking]);
|
|
198
|
-
const rail = useRailPublish(
|
|
244
|
+
const rail = useRailPublish(parts, hiddenRow, receiptByRowId, selectedTurnId);
|
|
199
245
|
const containerRef = useRef(null);
|
|
246
|
+
const timelineRef = useRef(null);
|
|
247
|
+
const [rowUiState] = useState(createRowUiState);
|
|
200
248
|
const rowCtx = useMemo(() => ({
|
|
201
249
|
sessionId,
|
|
202
250
|
settings: {
|
|
@@ -224,11 +272,19 @@ const Transcript = memo(({ events, streaming, sessionId, options, selection, tur
|
|
|
224
272
|
openSession,
|
|
225
273
|
resume
|
|
226
274
|
]);
|
|
227
|
-
const slotCache = useRef(/* @__PURE__ */ new Map());
|
|
228
275
|
const groupCache = useRef(/* @__PURE__ */ new WeakMap());
|
|
229
276
|
const renderClustersRef = useRef(() => []);
|
|
230
277
|
const showRunReceipt = o.showRunReceipt;
|
|
231
|
-
const foldEpoch = useMemo(() => ({
|
|
278
|
+
const foldEpoch = useMemo(() => ({
|
|
279
|
+
rowCtx,
|
|
280
|
+
selectedTurnId,
|
|
281
|
+
stops,
|
|
282
|
+
resumableId,
|
|
283
|
+
showThinking,
|
|
284
|
+
collapseSubagents,
|
|
285
|
+
streaming,
|
|
286
|
+
showRunReceipt
|
|
287
|
+
}), [
|
|
232
288
|
rowCtx,
|
|
233
289
|
selectedTurnId,
|
|
234
290
|
stops,
|
|
@@ -238,8 +294,8 @@ const Transcript = memo(({ events, streaming, sessionId, options, selection, tur
|
|
|
238
294
|
streaming,
|
|
239
295
|
showRunReceipt
|
|
240
296
|
]);
|
|
241
|
-
const renderFoldRows = useMemo(() => (list
|
|
242
|
-
const waiting = runStatus !== void 0 && streaming &&
|
|
297
|
+
const renderFoldRows = useMemo(() => (list) => renderClustersRef.current(list), [foldEpoch]);
|
|
298
|
+
const waiting = runStatus !== void 0 && streaming && tailActivity(transcript) === "waiting";
|
|
243
299
|
const liveStatus = useMemo(() => runStatus && streaming ? {
|
|
244
300
|
retry: runStatus.retry,
|
|
245
301
|
waiting
|
|
@@ -248,27 +304,31 @@ const Transcript = memo(({ events, streaming, sessionId, options, selection, tur
|
|
|
248
304
|
streaming,
|
|
249
305
|
waiting
|
|
250
306
|
]);
|
|
251
|
-
const
|
|
307
|
+
const live = {
|
|
308
|
+
caret: lastStreamingRow,
|
|
309
|
+
receipts: receiptByRowId
|
|
310
|
+
};
|
|
311
|
+
const rowProps = (row, root = false, at = live) => ({
|
|
252
312
|
row,
|
|
253
|
-
showCaret: row ===
|
|
254
|
-
receipt:
|
|
313
|
+
showCaret: row === at.caret,
|
|
314
|
+
receipt: at.receipts.get(row.id),
|
|
255
315
|
resumable: row.id === resumableId,
|
|
256
316
|
ctx: rowCtx,
|
|
257
317
|
renderRows: row.kind === "exchange-fold" || row.kind === "message-group" ? renderFoldRows : void 0,
|
|
258
318
|
status: root && row.kind === "exchange-fold" && row.live ? liveStatus : void 0
|
|
259
319
|
});
|
|
260
|
-
const groupDeps = (cluster, deps) => {
|
|
320
|
+
const groupDeps = (cluster, deps, at) => {
|
|
261
321
|
for (const item of cluster.body) {
|
|
262
322
|
if (item.kind === "group") {
|
|
263
|
-
groupDeps(item, deps);
|
|
323
|
+
groupDeps(item, deps, at);
|
|
264
324
|
continue;
|
|
265
325
|
}
|
|
266
326
|
const row = item.row;
|
|
267
|
-
deps.push(row ===
|
|
327
|
+
deps.push(row === at.caret, at.receipts.get(row.id), row.kind === "exchange-fold" || row.kind === "message-group" ? renderFoldRows : void 0);
|
|
268
328
|
}
|
|
269
329
|
return deps;
|
|
270
330
|
};
|
|
271
|
-
const renderGroup = (cluster, ci, parentDepth) => {
|
|
331
|
+
const renderGroup = (cluster, ci, parentDepth, at = live) => {
|
|
272
332
|
const key = groupRowId(cluster, ci);
|
|
273
333
|
const deps = groupDeps(cluster, [
|
|
274
334
|
key,
|
|
@@ -279,17 +339,17 @@ const Transcript = memo(({ events, streaming, sessionId, options, selection, tur
|
|
|
279
339
|
showThinking,
|
|
280
340
|
rowCtx,
|
|
281
341
|
resumableId
|
|
282
|
-
]);
|
|
342
|
+
], at);
|
|
283
343
|
const hit = groupCache.current.get(cluster);
|
|
284
344
|
if (hit && hit.deps.length === deps.length && hit.deps.every((d, i) => Object.is(d, deps[i]))) return hit.element;
|
|
285
|
-
const element = buildGroup(cluster, key, parentDepth);
|
|
345
|
+
const element = buildGroup(cluster, key, at, parentDepth);
|
|
286
346
|
groupCache.current.set(cluster, {
|
|
287
347
|
deps,
|
|
288
348
|
element
|
|
289
349
|
});
|
|
290
350
|
return element;
|
|
291
351
|
};
|
|
292
|
-
function buildGroup(cluster, key, parentDepth) {
|
|
352
|
+
function buildGroup(cluster, key, at, parentDepth) {
|
|
293
353
|
return /* @__PURE__ */ jsx(SubagentBlock, {
|
|
294
354
|
"data-row": key,
|
|
295
355
|
childId: cluster.childId,
|
|
@@ -300,99 +360,216 @@ const Transcript = memo(({ events, streaming, sessionId, options, selection, tur
|
|
|
300
360
|
defaultCollapsed: collapseSubagents,
|
|
301
361
|
streaming,
|
|
302
362
|
children: cluster.body.map((item, i) => {
|
|
303
|
-
if (item.kind === "group") return renderGroup(item, i, cluster.depth);
|
|
363
|
+
if (item.kind === "group") return renderGroup(item, i, cluster.depth, at);
|
|
304
364
|
const row = item.row;
|
|
305
365
|
if (isHiddenRow(row, showThinking)) return null;
|
|
306
366
|
return /* @__PURE__ */ jsx(CvRow, {
|
|
307
367
|
style: rowCvStyle(row),
|
|
308
368
|
"data-row": row.id,
|
|
309
|
-
children: /* @__PURE__ */ jsx(TranscriptRow, { ...rowProps(row) })
|
|
369
|
+
children: /* @__PURE__ */ jsx(TranscriptRow, { ...rowProps(row, false, at) })
|
|
310
370
|
}, row.id);
|
|
311
371
|
})
|
|
312
372
|
}, key);
|
|
313
373
|
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
374
|
+
/** A fold's or a message group's rows: the same rows, always mounted (their fold is). */
|
|
375
|
+
const renderClusters = (list) => list.map((cluster, ci) => {
|
|
376
|
+
if (cluster.kind === "group") return renderGroup(cluster, ci);
|
|
377
|
+
const row = cluster.row;
|
|
378
|
+
if (isHiddenRow(row, showThinking)) return null;
|
|
379
|
+
const stop = stops ? stopForRow(row, stops) : null;
|
|
380
|
+
return /* @__PURE__ */ jsx(CvRow, {
|
|
381
|
+
style: rowCvStyle(row),
|
|
382
|
+
"data-stop": stop ?? void 0,
|
|
383
|
+
"data-sel": stop !== null && stop === selectedTurnId ? "" : void 0,
|
|
384
|
+
"data-row": row.id,
|
|
385
|
+
children: /* @__PURE__ */ jsx(TranscriptRow, { ...rowProps(row) })
|
|
386
|
+
}, row.id);
|
|
387
|
+
});
|
|
388
|
+
const settledTextless = textlessEnds?.settled ?? null;
|
|
389
|
+
const settledTurnEnds = turnEnds?.settled ?? null;
|
|
390
|
+
const openTextless = textlessEnds?.open ?? null;
|
|
391
|
+
const openTurnEnds = turnEnds?.open ?? null;
|
|
392
|
+
const settledItems = useMemo(() => rootItems(settledClusters, hiddenRow, collapseSubagents, sessionId ? settledTextless : null, sessionId ? settledTurnEnds : null), [
|
|
393
|
+
settledClusters,
|
|
394
|
+
hiddenRow,
|
|
395
|
+
collapseSubagents,
|
|
396
|
+
sessionId,
|
|
397
|
+
settledTextless,
|
|
398
|
+
settledTurnEnds
|
|
399
|
+
]);
|
|
400
|
+
const openItems = useMemo(() => rootItems(openClusters, hiddenRow, collapseSubagents, sessionId ? openTextless : null, sessionId ? openTurnEnds : null, settledClusters.length), [
|
|
401
|
+
openClusters,
|
|
402
|
+
hiddenRow,
|
|
403
|
+
collapseSubagents,
|
|
404
|
+
sessionId,
|
|
405
|
+
openTextless,
|
|
406
|
+
openTurnEnds,
|
|
407
|
+
settledClusters.length
|
|
408
|
+
]);
|
|
409
|
+
const forced = useForcedRows();
|
|
410
|
+
const settledMatches = useMemo(() => matchingItems(settledItems, forced.needles), [settledItems, forced]);
|
|
411
|
+
const openMatches = useMemo(() => matchingItems(openItems, forced.needles), [openItems, forced]);
|
|
412
|
+
const selectKeys = (list) => !stops || selectedTurnId === null ? NO_KEYS : list.filter((item) => item.kind === "single" && stopForRow(item.cluster.row, stops) === selectedTurnId).map((item) => item.key);
|
|
413
|
+
const settledSelect = useMemo(() => selectKeys(settledItems), [
|
|
414
|
+
settledItems,
|
|
415
|
+
stops,
|
|
416
|
+
selectedTurnId
|
|
417
|
+
]);
|
|
418
|
+
const openSelect = useMemo(() => selectKeys(openItems), [
|
|
419
|
+
openItems,
|
|
420
|
+
stops,
|
|
421
|
+
selectedTurnId
|
|
422
|
+
]);
|
|
423
|
+
const held = useMemo(() => [
|
|
424
|
+
...settledMatches,
|
|
425
|
+
...openMatches,
|
|
426
|
+
...settledSelect,
|
|
427
|
+
...openSelect
|
|
428
|
+
], [
|
|
429
|
+
settledMatches,
|
|
430
|
+
openMatches,
|
|
431
|
+
settledSelect,
|
|
432
|
+
openSelect
|
|
433
|
+
]);
|
|
434
|
+
const [mounter] = useState(() => new RowMounter());
|
|
435
|
+
mounter.reset(sessionId);
|
|
436
|
+
const eager = useMemo(() => tailKeys(settledItems, openItems, (key) => mounter.sizeOf(key)), [
|
|
437
|
+
settledItems,
|
|
438
|
+
openItems,
|
|
439
|
+
mounter
|
|
440
|
+
]);
|
|
441
|
+
const liveKeys = useMemo(() => new Set(openItems.map((item) => item.key)), [openItems]);
|
|
442
|
+
mounter.setTail(eager, liveKeys);
|
|
443
|
+
useLayoutEffect(() => mounter.hold(held, forced.all), [
|
|
444
|
+
mounter,
|
|
445
|
+
held,
|
|
446
|
+
forced.all
|
|
447
|
+
]);
|
|
448
|
+
useLayoutEffect(() => () => mounter.dispose(), [mounter]);
|
|
449
|
+
const settledCache = useRef(/* @__PURE__ */ new Map());
|
|
450
|
+
const openCache = useRef(/* @__PURE__ */ new Map());
|
|
451
|
+
const rootElement = (item, at, out) => {
|
|
452
|
+
let deps;
|
|
453
|
+
let make;
|
|
454
|
+
if (item.kind === "group") {
|
|
455
|
+
const group = renderGroup(item.cluster, item.ci, void 0, at);
|
|
456
|
+
deps = [group];
|
|
457
|
+
make = () => /* @__PURE__ */ jsx(LazyRow, {
|
|
458
|
+
itemKey: item.key,
|
|
459
|
+
estimatePx: item.estimate,
|
|
460
|
+
box: true,
|
|
461
|
+
children: group
|
|
462
|
+
}, item.key);
|
|
463
|
+
} else if (item.kind === "views-end") {
|
|
464
|
+
deps = [sessionId, item.turns];
|
|
465
|
+
make = () => /* @__PURE__ */ jsx("div", {
|
|
466
|
+
className: "pl-2 pr-1",
|
|
467
|
+
children: /* @__PURE__ */ jsx(CodemodeViewsSlot, {
|
|
376
468
|
sessionId,
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
469
|
+
turns: item.turns
|
|
470
|
+
})
|
|
471
|
+
}, item.key);
|
|
472
|
+
} else if (item.kind === "turn-end") {
|
|
473
|
+
deps = [sessionId, item.turnId];
|
|
474
|
+
make = () => /* @__PURE__ */ jsx(ExtensionSlot, {
|
|
475
|
+
at: "transcript.turn-end",
|
|
476
|
+
sessionId,
|
|
477
|
+
turnId: item.turnId,
|
|
478
|
+
className: "py-1"
|
|
479
|
+
}, item.key);
|
|
480
|
+
} else {
|
|
481
|
+
const row = item.cluster.row;
|
|
482
|
+
const stop = stops ? stopForRow(row, stops) : null;
|
|
483
|
+
const sel = stop !== null && stop === selectedTurnId ? "" : void 0;
|
|
484
|
+
const props = rowProps(row, true, at);
|
|
485
|
+
deps = [
|
|
486
|
+
props.row,
|
|
487
|
+
props.showCaret,
|
|
488
|
+
props.receipt,
|
|
489
|
+
props.resumable,
|
|
490
|
+
props.ctx,
|
|
491
|
+
props.renderRows,
|
|
492
|
+
props.status,
|
|
493
|
+
stop,
|
|
494
|
+
sel
|
|
495
|
+
];
|
|
496
|
+
make = () => /* @__PURE__ */ jsx(TranscriptRowSlot, {
|
|
497
|
+
style: rowCvStyle(row),
|
|
498
|
+
stop: stop ?? void 0,
|
|
499
|
+
sel,
|
|
500
|
+
...props
|
|
501
|
+
}, row.id);
|
|
502
|
+
}
|
|
503
|
+
const hit = openCache.current.get(item.key) ?? settledCache.current.get(item.key);
|
|
504
|
+
const element = hit && hit.deps.length === deps.length && hit.deps.every((d, i) => Object.is(d, deps[i])) ? hit.element : make();
|
|
505
|
+
out.set(item.key, {
|
|
506
|
+
deps,
|
|
507
|
+
element
|
|
383
508
|
});
|
|
384
|
-
|
|
385
|
-
return out;
|
|
509
|
+
return element;
|
|
386
510
|
};
|
|
511
|
+
const settledRowSet = useMemo(() => new WeakSet(parts.settled.rows), [parts.settled.rows]);
|
|
512
|
+
const settledCaret = lastStreamingRow && settledRowSet.has(lastStreamingRow) ? lastStreamingRow : null;
|
|
513
|
+
const settledReceipts = parts.settled.receipts ?? receiptByRowId;
|
|
514
|
+
const settledLive = useMemo(() => ({
|
|
515
|
+
caret: settledCaret,
|
|
516
|
+
receipts: settledReceipts
|
|
517
|
+
}), [settledCaret, settledReceipts]);
|
|
518
|
+
const settledEls = useMemo(() => {
|
|
519
|
+
const next = /* @__PURE__ */ new Map();
|
|
520
|
+
const els = settledItems.map((item) => rootElement(item, settledLive, next));
|
|
521
|
+
settledCache.current = next;
|
|
522
|
+
return els;
|
|
523
|
+
}, [
|
|
524
|
+
settledItems,
|
|
525
|
+
settledLive,
|
|
526
|
+
rowCtx,
|
|
527
|
+
stops,
|
|
528
|
+
selectedTurnId,
|
|
529
|
+
resumableId,
|
|
530
|
+
renderFoldRows,
|
|
531
|
+
liveStatus,
|
|
532
|
+
sessionId,
|
|
533
|
+
showThinking,
|
|
534
|
+
collapseSubagents,
|
|
535
|
+
streaming
|
|
536
|
+
]);
|
|
537
|
+
const openNext = /* @__PURE__ */ new Map();
|
|
538
|
+
const openEls = openItems.map((item) => rootElement(item, live, openNext));
|
|
539
|
+
openCache.current = openNext;
|
|
540
|
+
const runStart = useRef({
|
|
541
|
+
sessionId,
|
|
542
|
+
key: null
|
|
543
|
+
});
|
|
544
|
+
if (runStart.current.sessionId !== sessionId) runStart.current = {
|
|
545
|
+
sessionId,
|
|
546
|
+
key: null
|
|
547
|
+
};
|
|
548
|
+
if (runStart.current.key === null && openItems.length > 0) runStart.current.key = openItems[0].key;
|
|
549
|
+
const runKey = runStart.current.key;
|
|
550
|
+
const foundAt = useMemo(() => {
|
|
551
|
+
if (runKey !== null) {
|
|
552
|
+
for (let i = settledItems.length - 1; i >= 0; i--) if (settledItems[i].key === runKey) return i;
|
|
553
|
+
}
|
|
554
|
+
return -1;
|
|
555
|
+
}, [settledItems, runKey]);
|
|
556
|
+
if (runKey !== null && foundAt < 0 && !openItems.some((item) => item.key === runKey)) runStart.current.key = openItems[0]?.key ?? null;
|
|
557
|
+
const runAt = foundAt < 0 ? settledItems.length : foundAt;
|
|
558
|
+
const prefixRuns = useMemo(() => rowRuns(runAt === settledEls.length ? settledEls : settledEls.slice(0, runAt)), [settledEls, runAt]);
|
|
559
|
+
const flatSettled = useMemo(() => runAt === settledEls.length ? [] : settledEls.slice(runAt), [settledEls, runAt]);
|
|
387
560
|
renderClustersRef.current = renderClusters;
|
|
388
|
-
const rootRows =
|
|
561
|
+
const rootRows = [
|
|
562
|
+
...prefixRuns,
|
|
563
|
+
...flatSettled,
|
|
564
|
+
...openEls
|
|
565
|
+
];
|
|
389
566
|
useTranscriptSelectionCopy(containerRef);
|
|
390
567
|
return /* @__PURE__ */ jsx(TranscriptSettling.Provider, {
|
|
391
568
|
value: settling,
|
|
392
569
|
children: /* @__PURE__ */ jsx(LiveScriptsContext.Provider, {
|
|
393
570
|
value: liveScripts,
|
|
394
571
|
children: /* @__PURE__ */ jsx(MediaGalleryProvider, {
|
|
395
|
-
events,
|
|
572
|
+
events: transcript,
|
|
396
573
|
children: /* @__PURE__ */ jsx(RowIconsContext.Provider, {
|
|
397
574
|
value: o.showRowIcons,
|
|
398
575
|
children: /* @__PURE__ */ jsx(DiagramsContext.Provider, {
|
|
@@ -407,17 +584,25 @@ const Transcript = memo(({ events, streaming, sessionId, options, selection, tur
|
|
|
407
584
|
style,
|
|
408
585
|
children: [
|
|
409
586
|
/* @__PURE__ */ jsxs("div", {
|
|
587
|
+
ref: timelineRef,
|
|
410
588
|
className: "zg-timeline relative pl-2 pr-1 py-1",
|
|
589
|
+
"data-vitems": settledItems.length + openItems.length,
|
|
411
590
|
children: [
|
|
412
591
|
/* @__PURE__ */ jsx(SelectCursor, {
|
|
413
592
|
selected: selectedTurnId,
|
|
414
593
|
layout: stops
|
|
415
594
|
}),
|
|
416
595
|
rail && /* @__PURE__ */ jsx(RailTint, { store: rail }),
|
|
417
|
-
|
|
596
|
+
/* @__PURE__ */ jsx(RowUiStateContext.Provider, {
|
|
597
|
+
value: rowUiState,
|
|
598
|
+
children: /* @__PURE__ */ jsx(RowMountContext.Provider, {
|
|
599
|
+
value: mounter,
|
|
600
|
+
children: viewsReady || settle.current.shown ? rootRows : null
|
|
601
|
+
})
|
|
602
|
+
})
|
|
418
603
|
]
|
|
419
604
|
}),
|
|
420
|
-
sessionId && !streaming &&
|
|
605
|
+
sessionId && !streaming && transcript.length > 0 && /* @__PURE__ */ jsx(ExtensionSlot, {
|
|
421
606
|
at: "transcript.turn-end",
|
|
422
607
|
sessionId,
|
|
423
608
|
className: "pl-2 pr-1 py-1"
|