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
package/dist/chat/Transcript.js
CHANGED
|
@@ -3,25 +3,70 @@ 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";
|
|
19
|
+
import { RailTint, useRailPublish } from "./transcript/TranscriptRail.js";
|
|
17
20
|
import { TranscriptRow, TranscriptRowSlot, isHiddenRow } from "./transcript/TranscriptRow.js";
|
|
18
21
|
import { useSelectStops, useTranscriptRows } from "./transcript/use-transcript-rows.js";
|
|
19
22
|
import { useTranscriptSelectionCopy } from "./transcript/useTranscriptSelectionCopy.js";
|
|
20
23
|
import { CodemodeViewsSlot, ReplyViewPlaces, ViewsScopeContext, useViewsReady, viewsScopeOf } from "./transcript/view-scope.js";
|
|
21
24
|
import { memo, useCallback, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
22
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
-
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";
|
|
24
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
|
+
* The root rows before the transcript's flat run, behind one memoized fiber: a render that changes none of them
|
|
56
|
+
* (a stream tick) never walks them. The flat run after them starts where the open exchange started when the
|
|
57
|
+
* conversation showed, so a row never moves between the two (that would remount it).
|
|
58
|
+
*/
|
|
59
|
+
const RowRun = memo(({ rows }) => /* @__PURE__ */ jsx(Fragment$1, { children: rows }));
|
|
60
|
+
RowRun.displayName = "RowRun";
|
|
61
|
+
/** Whether a transcript can hold a view (`eventsMayHoldViews`), each settled exchange read once. */
|
|
62
|
+
function mayHoldViews(transcript) {
|
|
63
|
+
return eventsMayHoldViews(transcript.tail) || transcript.chunks.some((chunk) => chunkFact(chunk, "may-hold-views", eventsMayHoldViews));
|
|
64
|
+
}
|
|
65
|
+
/** `runTailActivity` of the open exchange: its scan stops at the exchange's prompt, so the result is the whole transcript's. */
|
|
66
|
+
function tailActivity(transcript) {
|
|
67
|
+
const tail = transcript.tail.length > 0 || transcript.chunks.length === 0 ? transcript.tail : transcript.chunks.at(-1);
|
|
68
|
+
return runTailActivity(tail);
|
|
69
|
+
}
|
|
25
70
|
/** zidane's defaults for those settings. */
|
|
26
71
|
const DEFAULT_TRANSCRIPT_OPTIONS = {
|
|
27
72
|
showRowIcons: DEFAULT_SETTINGS.showRowIcons,
|
|
@@ -46,45 +91,9 @@ const DEFAULT_TRANSCRIPT_OPTIONS = {
|
|
|
46
91
|
viewsSave: DEFAULT_SETTINGS.viewsSave,
|
|
47
92
|
viewsOrchestration: DEFAULT_SETTINGS.viewsOrchestration
|
|
48
93
|
};
|
|
49
|
-
/**
|
|
50
|
-
* Top-level rows at the end of the transcript that mount at once (the rest
|
|
51
|
-
* mount on approach, `LazyRow`): enough to fill the window when the session
|
|
52
|
-
* opens pinned to the bottom, so the first frame shows real rows. Sized by
|
|
53
|
-
* the rows' estimated heights (`EAGER_SCREENS` windows' worth), never fewer
|
|
54
|
-
* than `EAGER_MIN` rows nor more than `EAGER_MAX`: mounting forty rows when
|
|
55
|
-
* eight fill the window made every conversation switch pay for the other
|
|
56
|
-
* thirty-two in its frame. Rows above mount next, from the viewport
|
|
57
|
-
* observers, and the ones within a viewport of the view mount at once.
|
|
58
|
-
*/
|
|
59
|
-
const EAGER_SCREENS = 1.5;
|
|
60
|
-
const EAGER_MIN = 6;
|
|
61
|
-
const EAGER_MAX = 40;
|
|
62
|
-
/**
|
|
63
|
-
* Index of the first root cluster that mounts at once (`EAGER_SCREENS`).
|
|
64
|
-
*
|
|
65
|
-
* @param list - The root clusters.
|
|
66
|
-
* @param hidden - Rows that render nothing (they take no room).
|
|
67
|
-
*/
|
|
68
|
-
function eagerTailStart(list, hidden) {
|
|
69
|
-
const budget = (typeof window === "undefined" ? 1e3 : window.innerHeight) * EAGER_SCREENS;
|
|
70
|
-
let px = 0;
|
|
71
|
-
let rows = 0;
|
|
72
|
-
for (let i = list.length - 1; i >= 0; i--) {
|
|
73
|
-
const cluster = list[i];
|
|
74
|
-
if (cluster.kind === "single") {
|
|
75
|
-
if (hidden(cluster.row)) continue;
|
|
76
|
-
px += rowEstimatePx(cluster.row);
|
|
77
|
-
}
|
|
78
|
-
rows++;
|
|
79
|
-
if (rows >= EAGER_MAX || rows >= EAGER_MIN && px >= budget) return i;
|
|
80
|
-
}
|
|
81
|
-
return 0;
|
|
82
|
-
}
|
|
83
94
|
/** How long after a conversation first paints its rows count as already there. */
|
|
84
95
|
const SETTLE_MS = 400;
|
|
85
|
-
/**
|
|
86
|
-
const groupRowId = (cluster, index) => `group-${firstRowId(cluster) ?? index}-${cluster.childId}`;
|
|
87
|
-
/** 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. */
|
|
96
|
+
/** 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. */
|
|
88
97
|
const Transcript = memo(({ events, streaming, sessionId, options, selection, turnMenu, runStatus, liveScripts = false, className, style, children }) => {
|
|
89
98
|
const o = options ? {
|
|
90
99
|
...DEFAULT_TRANSCRIPT_OPTIONS,
|
|
@@ -94,6 +103,9 @@ const Transcript = memo(({ events, streaming, sessionId, options, selection, tur
|
|
|
94
103
|
const showFullShellOutput = Boolean(o.showFullShellOutput);
|
|
95
104
|
const collapseSubagents = o.hideSubagentOutput;
|
|
96
105
|
const { openSession, resume } = useTranscriptActions();
|
|
106
|
+
const split = useRef(void 0);
|
|
107
|
+
const transcript = useMemo(() => Array.isArray(events) ? transcriptOfArray(events) ?? transcriptFromArray(events, split.current) : events, [events]);
|
|
108
|
+
split.current = transcript;
|
|
97
109
|
const settle = useRef({
|
|
98
110
|
sessionId: null,
|
|
99
111
|
shown: false,
|
|
@@ -104,13 +116,13 @@ const Transcript = memo(({ events, streaming, sessionId, options, selection, tur
|
|
|
104
116
|
shown: false,
|
|
105
117
|
until: 0
|
|
106
118
|
};
|
|
107
|
-
const viewsReady = useViewsReady(o.views && !settle.current.shown &&
|
|
108
|
-
if (!settle.current.shown &&
|
|
119
|
+
const viewsReady = useViewsReady(o.views && !settle.current.shown && mayHoldViews(transcript), sessionId);
|
|
120
|
+
if (!settle.current.shown && transcript.length > 0 && viewsReady) {
|
|
109
121
|
settle.current.shown = true;
|
|
110
122
|
settle.current.until = performance.now() + SETTLE_MS;
|
|
111
123
|
}
|
|
112
124
|
const settling = useCallback(() => performance.now() < settle.current.until, []);
|
|
113
|
-
const
|
|
125
|
+
const rows = useTranscriptRows(transcript, streaming, {
|
|
114
126
|
showCacheNotices: o.showCacheNotices,
|
|
115
127
|
codemodeShowCalls: o.codemodeShowCalls,
|
|
116
128
|
showEditDiffs,
|
|
@@ -118,26 +130,49 @@ const Transcript = memo(({ events, streaming, sessionId, options, selection, tur
|
|
|
118
130
|
showRunReceipt: o.showRunReceipt,
|
|
119
131
|
compact: o.transcriptDensity === "compact"
|
|
120
132
|
});
|
|
133
|
+
const { receiptByRowId, resumableId, lastStreamingRow } = rows;
|
|
134
|
+
const parts = rows.parts ?? {
|
|
135
|
+
settled: NO_SLICE,
|
|
136
|
+
open: {
|
|
137
|
+
rows: rows.visibleRows,
|
|
138
|
+
clusters: rows.clusters
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
const settledClusters = parts.settled.clusters;
|
|
142
|
+
const openClusters = parts.open.clusters;
|
|
121
143
|
const slotEntries = useExtensionItems("slot");
|
|
144
|
+
const turnEndsPrev = useRef(null);
|
|
122
145
|
const turnEnds = useMemo(() => {
|
|
123
146
|
const wanted = /* @__PURE__ */ new Set();
|
|
124
147
|
for (const { item } of slotEntries) if (item.at === "transcript.turn-end" && item.turnId && (item.sessionId === void 0 || item.sessionId === sessionId)) wanted.add(item.turnId);
|
|
125
148
|
if (wanted.size === 0) return null;
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
149
|
+
const ends = endsByRow({
|
|
150
|
+
settled: settledClusters,
|
|
151
|
+
open: openClusters
|
|
152
|
+
}, (at, add) => {
|
|
153
|
+
const byRow = /* @__PURE__ */ new Map();
|
|
154
|
+
for (const turnId of wanted) {
|
|
155
|
+
const where = at(turnId);
|
|
156
|
+
if (!where) continue;
|
|
157
|
+
const entry = byRow.get(where.rowId);
|
|
158
|
+
if (entry) entry.turns.push(turnId);
|
|
159
|
+
else byRow.set(where.rowId, {
|
|
160
|
+
where,
|
|
161
|
+
turns: [turnId]
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
for (const { where, turns } of byRow.values()) add(where, turns);
|
|
165
|
+
}, turnEndsPrev.current);
|
|
166
|
+
turnEndsPrev.current = ends;
|
|
167
|
+
return ends;
|
|
134
168
|
}, [
|
|
135
169
|
slotEntries,
|
|
136
170
|
sessionId,
|
|
137
|
-
|
|
171
|
+
settledClusters,
|
|
172
|
+
openClusters
|
|
138
173
|
]);
|
|
139
174
|
const viewInputs = o.views && o.viewsInputs;
|
|
140
|
-
const viewEvents = o.views ?
|
|
175
|
+
const viewEvents = o.views ? transcript : null;
|
|
141
176
|
const [viewPlaces] = useState(() => new ReplyViewPlaces());
|
|
142
177
|
const [viewAnswers] = useState(() => new ViewAnswers());
|
|
143
178
|
useMemo(() => {
|
|
@@ -169,31 +204,37 @@ const Transcript = memo(({ events, streaming, sessionId, options, selection, tur
|
|
|
169
204
|
o.viewsOrchestration
|
|
170
205
|
]);
|
|
171
206
|
const textless = viewEvents ? viewPlaces.textlessExchanges : null;
|
|
207
|
+
const textlessPrev = useRef(null);
|
|
172
208
|
const textlessEnds = useMemo(() => {
|
|
173
209
|
if (!textless || !sessionId) return null;
|
|
174
210
|
const exchanges = textless.filter((exchange) => exchange.closed || !streaming);
|
|
175
211
|
if (exchanges.length === 0) return null;
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
return
|
|
212
|
+
const ends = endsByRow({
|
|
213
|
+
settled: settledClusters,
|
|
214
|
+
open: openClusters
|
|
215
|
+
}, (at, add) => {
|
|
216
|
+
for (const exchange of exchanges) {
|
|
217
|
+
let where;
|
|
218
|
+
for (const turnId of exchange.turns) where = at(turnId) ?? where;
|
|
219
|
+
if (where) add(where, exchange.turns);
|
|
220
|
+
}
|
|
221
|
+
}, textlessPrev.current);
|
|
222
|
+
textlessPrev.current = ends;
|
|
223
|
+
return ends;
|
|
188
224
|
}, [
|
|
189
225
|
textless,
|
|
190
226
|
sessionId,
|
|
191
227
|
streaming,
|
|
192
|
-
|
|
228
|
+
settledClusters,
|
|
229
|
+
openClusters
|
|
193
230
|
]);
|
|
194
231
|
const selectedTurnId = selection?.selected ?? null;
|
|
195
|
-
const stops = useSelectStops(
|
|
232
|
+
const stops = useSelectStops(rows, transcript, showThinking, selectedTurnId !== null, selection?.registerStops);
|
|
233
|
+
const hiddenRow = useCallback((row) => isHiddenRow(row, showThinking), [showThinking]);
|
|
234
|
+
const rail = useRailPublish(parts, hiddenRow, receiptByRowId, selectedTurnId);
|
|
196
235
|
const containerRef = useRef(null);
|
|
236
|
+
const timelineRef = useRef(null);
|
|
237
|
+
const [rowUiState] = useState(createRowUiState);
|
|
197
238
|
const rowCtx = useMemo(() => ({
|
|
198
239
|
sessionId,
|
|
199
240
|
settings: {
|
|
@@ -221,7 +262,6 @@ const Transcript = memo(({ events, streaming, sessionId, options, selection, tur
|
|
|
221
262
|
openSession,
|
|
222
263
|
resume
|
|
223
264
|
]);
|
|
224
|
-
const slotCache = useRef(/* @__PURE__ */ new Map());
|
|
225
265
|
const groupCache = useRef(/* @__PURE__ */ new WeakMap());
|
|
226
266
|
const renderClustersRef = useRef(() => []);
|
|
227
267
|
const showRunReceipt = o.showRunReceipt;
|
|
@@ -235,8 +275,8 @@ const Transcript = memo(({ events, streaming, sessionId, options, selection, tur
|
|
|
235
275
|
streaming,
|
|
236
276
|
showRunReceipt
|
|
237
277
|
]);
|
|
238
|
-
const renderFoldRows = useMemo(() => (list
|
|
239
|
-
const waiting = runStatus !== void 0 && streaming &&
|
|
278
|
+
const renderFoldRows = useMemo(() => (list) => renderClustersRef.current(list), [foldEpoch]);
|
|
279
|
+
const waiting = runStatus !== void 0 && streaming && tailActivity(transcript) === "waiting";
|
|
240
280
|
const liveStatus = useMemo(() => runStatus && streaming ? {
|
|
241
281
|
retry: runStatus.retry,
|
|
242
282
|
waiting
|
|
@@ -245,27 +285,31 @@ const Transcript = memo(({ events, streaming, sessionId, options, selection, tur
|
|
|
245
285
|
streaming,
|
|
246
286
|
waiting
|
|
247
287
|
]);
|
|
248
|
-
const
|
|
288
|
+
const live = {
|
|
289
|
+
caret: lastStreamingRow,
|
|
290
|
+
receipts: receiptByRowId
|
|
291
|
+
};
|
|
292
|
+
const rowProps = (row, root = false, at = live) => ({
|
|
249
293
|
row,
|
|
250
|
-
showCaret: row ===
|
|
251
|
-
receipt:
|
|
294
|
+
showCaret: row === at.caret,
|
|
295
|
+
receipt: at.receipts.get(row.id),
|
|
252
296
|
resumable: row.id === resumableId,
|
|
253
297
|
ctx: rowCtx,
|
|
254
298
|
renderRows: row.kind === "exchange-fold" || row.kind === "message-group" ? renderFoldRows : void 0,
|
|
255
299
|
status: root && row.kind === "exchange-fold" && row.live ? liveStatus : void 0
|
|
256
300
|
});
|
|
257
|
-
const groupDeps = (cluster, deps) => {
|
|
301
|
+
const groupDeps = (cluster, deps, at) => {
|
|
258
302
|
for (const item of cluster.body) {
|
|
259
303
|
if (item.kind === "group") {
|
|
260
|
-
groupDeps(item, deps);
|
|
304
|
+
groupDeps(item, deps, at);
|
|
261
305
|
continue;
|
|
262
306
|
}
|
|
263
307
|
const row = item.row;
|
|
264
|
-
deps.push(row ===
|
|
308
|
+
deps.push(row === at.caret, at.receipts.get(row.id), row.kind === "exchange-fold" || row.kind === "message-group" ? renderFoldRows : void 0);
|
|
265
309
|
}
|
|
266
310
|
return deps;
|
|
267
311
|
};
|
|
268
|
-
const renderGroup = (cluster, ci, parentDepth) => {
|
|
312
|
+
const renderGroup = (cluster, ci, parentDepth, at = live) => {
|
|
269
313
|
const key = groupRowId(cluster, ci);
|
|
270
314
|
const deps = groupDeps(cluster, [
|
|
271
315
|
key,
|
|
@@ -276,17 +320,17 @@ const Transcript = memo(({ events, streaming, sessionId, options, selection, tur
|
|
|
276
320
|
showThinking,
|
|
277
321
|
rowCtx,
|
|
278
322
|
resumableId
|
|
279
|
-
]);
|
|
323
|
+
], at);
|
|
280
324
|
const hit = groupCache.current.get(cluster);
|
|
281
325
|
if (hit && hit.deps.length === deps.length && hit.deps.every((d, i) => Object.is(d, deps[i]))) return hit.element;
|
|
282
|
-
const element = buildGroup(cluster, key, parentDepth);
|
|
326
|
+
const element = buildGroup(cluster, key, at, parentDepth);
|
|
283
327
|
groupCache.current.set(cluster, {
|
|
284
328
|
deps,
|
|
285
329
|
element
|
|
286
330
|
});
|
|
287
331
|
return element;
|
|
288
332
|
};
|
|
289
|
-
function buildGroup(cluster, key, parentDepth) {
|
|
333
|
+
function buildGroup(cluster, key, at, parentDepth) {
|
|
290
334
|
return /* @__PURE__ */ jsx(SubagentBlock, {
|
|
291
335
|
"data-row": key,
|
|
292
336
|
childId: cluster.childId,
|
|
@@ -297,99 +341,216 @@ const Transcript = memo(({ events, streaming, sessionId, options, selection, tur
|
|
|
297
341
|
defaultCollapsed: collapseSubagents,
|
|
298
342
|
streaming,
|
|
299
343
|
children: cluster.body.map((item, i) => {
|
|
300
|
-
if (item.kind === "group") return renderGroup(item, i, cluster.depth);
|
|
344
|
+
if (item.kind === "group") return renderGroup(item, i, cluster.depth, at);
|
|
301
345
|
const row = item.row;
|
|
302
346
|
if (isHiddenRow(row, showThinking)) return null;
|
|
303
347
|
return /* @__PURE__ */ jsx(CvRow, {
|
|
304
348
|
style: rowCvStyle(row),
|
|
305
349
|
"data-row": row.id,
|
|
306
|
-
children: /* @__PURE__ */ jsx(TranscriptRow, { ...rowProps(row) })
|
|
350
|
+
children: /* @__PURE__ */ jsx(TranscriptRow, { ...rowProps(row, false, at) })
|
|
307
351
|
}, row.id);
|
|
308
352
|
})
|
|
309
353
|
}, key);
|
|
310
354
|
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
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
|
-
|
|
355
|
+
/** A fold's or a message group's rows: the same rows, always mounted (their fold is). */
|
|
356
|
+
const renderClusters = (list) => list.map((cluster, ci) => {
|
|
357
|
+
if (cluster.kind === "group") return renderGroup(cluster, ci);
|
|
358
|
+
const row = cluster.row;
|
|
359
|
+
if (isHiddenRow(row, showThinking)) return null;
|
|
360
|
+
const stop = stops ? stopForRow(row, stops) : null;
|
|
361
|
+
return /* @__PURE__ */ jsx(CvRow, {
|
|
362
|
+
style: rowCvStyle(row),
|
|
363
|
+
"data-stop": stop ?? void 0,
|
|
364
|
+
"data-sel": stop !== null && stop === selectedTurnId ? "" : void 0,
|
|
365
|
+
"data-row": row.id,
|
|
366
|
+
children: /* @__PURE__ */ jsx(TranscriptRow, { ...rowProps(row) })
|
|
367
|
+
}, row.id);
|
|
368
|
+
});
|
|
369
|
+
const settledTextless = textlessEnds?.settled ?? null;
|
|
370
|
+
const settledTurnEnds = turnEnds?.settled ?? null;
|
|
371
|
+
const openTextless = textlessEnds?.open ?? null;
|
|
372
|
+
const openTurnEnds = turnEnds?.open ?? null;
|
|
373
|
+
const settledItems = useMemo(() => rootItems(settledClusters, hiddenRow, collapseSubagents, sessionId ? settledTextless : null, sessionId ? settledTurnEnds : null), [
|
|
374
|
+
settledClusters,
|
|
375
|
+
hiddenRow,
|
|
376
|
+
collapseSubagents,
|
|
377
|
+
sessionId,
|
|
378
|
+
settledTextless,
|
|
379
|
+
settledTurnEnds
|
|
380
|
+
]);
|
|
381
|
+
const openItems = useMemo(() => rootItems(openClusters, hiddenRow, collapseSubagents, sessionId ? openTextless : null, sessionId ? openTurnEnds : null, settledClusters.length), [
|
|
382
|
+
openClusters,
|
|
383
|
+
hiddenRow,
|
|
384
|
+
collapseSubagents,
|
|
385
|
+
sessionId,
|
|
386
|
+
openTextless,
|
|
387
|
+
openTurnEnds,
|
|
388
|
+
settledClusters.length
|
|
389
|
+
]);
|
|
390
|
+
const forced = useForcedRows();
|
|
391
|
+
const settledMatches = useMemo(() => matchingItems(settledItems, forced.needles), [settledItems, forced]);
|
|
392
|
+
const openMatches = useMemo(() => matchingItems(openItems, forced.needles), [openItems, forced]);
|
|
393
|
+
const selectKeys = (list) => !stops || selectedTurnId === null ? NO_KEYS : list.filter((item) => item.kind === "single" && stopForRow(item.cluster.row, stops) === selectedTurnId).map((item) => item.key);
|
|
394
|
+
const settledSelect = useMemo(() => selectKeys(settledItems), [
|
|
395
|
+
settledItems,
|
|
396
|
+
stops,
|
|
397
|
+
selectedTurnId
|
|
398
|
+
]);
|
|
399
|
+
const openSelect = useMemo(() => selectKeys(openItems), [
|
|
400
|
+
openItems,
|
|
401
|
+
stops,
|
|
402
|
+
selectedTurnId
|
|
403
|
+
]);
|
|
404
|
+
const held = useMemo(() => [
|
|
405
|
+
...settledMatches,
|
|
406
|
+
...openMatches,
|
|
407
|
+
...settledSelect,
|
|
408
|
+
...openSelect
|
|
409
|
+
], [
|
|
410
|
+
settledMatches,
|
|
411
|
+
openMatches,
|
|
412
|
+
settledSelect,
|
|
413
|
+
openSelect
|
|
414
|
+
]);
|
|
415
|
+
const [mounter] = useState(() => new RowMounter());
|
|
416
|
+
mounter.reset(sessionId);
|
|
417
|
+
const eager = useMemo(() => tailKeys(settledItems, openItems, (key) => mounter.sizeOf(key)), [
|
|
418
|
+
settledItems,
|
|
419
|
+
openItems,
|
|
420
|
+
mounter
|
|
421
|
+
]);
|
|
422
|
+
const liveKeys = useMemo(() => new Set(openItems.map((item) => item.key)), [openItems]);
|
|
423
|
+
mounter.setTail(eager, liveKeys);
|
|
424
|
+
useLayoutEffect(() => mounter.hold(held, forced.all), [
|
|
425
|
+
mounter,
|
|
426
|
+
held,
|
|
427
|
+
forced.all
|
|
428
|
+
]);
|
|
429
|
+
useLayoutEffect(() => () => mounter.dispose(), [mounter]);
|
|
430
|
+
const settledCache = useRef(/* @__PURE__ */ new Map());
|
|
431
|
+
const openCache = useRef(/* @__PURE__ */ new Map());
|
|
432
|
+
const rootElement = (item, at, out) => {
|
|
433
|
+
let deps;
|
|
434
|
+
let make;
|
|
435
|
+
if (item.kind === "group") {
|
|
436
|
+
const group = renderGroup(item.cluster, item.ci, void 0, at);
|
|
437
|
+
deps = [group];
|
|
438
|
+
make = () => /* @__PURE__ */ jsx(LazyRow, {
|
|
439
|
+
itemKey: item.key,
|
|
440
|
+
estimatePx: item.estimate,
|
|
441
|
+
box: true,
|
|
442
|
+
children: group
|
|
443
|
+
}, item.key);
|
|
444
|
+
} else if (item.kind === "views-end") {
|
|
445
|
+
deps = [sessionId, item.turns];
|
|
446
|
+
make = () => /* @__PURE__ */ jsx("div", {
|
|
447
|
+
className: "pl-2 pr-1",
|
|
448
|
+
children: /* @__PURE__ */ jsx(CodemodeViewsSlot, {
|
|
373
449
|
sessionId,
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
450
|
+
turns: item.turns
|
|
451
|
+
})
|
|
452
|
+
}, item.key);
|
|
453
|
+
} else if (item.kind === "turn-end") {
|
|
454
|
+
deps = [sessionId, item.turnId];
|
|
455
|
+
make = () => /* @__PURE__ */ jsx(ExtensionSlot, {
|
|
456
|
+
at: "transcript.turn-end",
|
|
457
|
+
sessionId,
|
|
458
|
+
turnId: item.turnId,
|
|
459
|
+
className: "py-1"
|
|
460
|
+
}, item.key);
|
|
461
|
+
} else {
|
|
462
|
+
const row = item.cluster.row;
|
|
463
|
+
const stop = stops ? stopForRow(row, stops) : null;
|
|
464
|
+
const sel = stop !== null && stop === selectedTurnId ? "" : void 0;
|
|
465
|
+
const props = rowProps(row, true, at);
|
|
466
|
+
deps = [
|
|
467
|
+
props.row,
|
|
468
|
+
props.showCaret,
|
|
469
|
+
props.receipt,
|
|
470
|
+
props.resumable,
|
|
471
|
+
props.ctx,
|
|
472
|
+
props.renderRows,
|
|
473
|
+
props.status,
|
|
474
|
+
stop,
|
|
475
|
+
sel
|
|
476
|
+
];
|
|
477
|
+
make = () => /* @__PURE__ */ jsx(TranscriptRowSlot, {
|
|
478
|
+
style: rowCvStyle(row),
|
|
479
|
+
stop: stop ?? void 0,
|
|
480
|
+
sel,
|
|
481
|
+
...props
|
|
482
|
+
}, row.id);
|
|
483
|
+
}
|
|
484
|
+
const hit = openCache.current.get(item.key) ?? settledCache.current.get(item.key);
|
|
485
|
+
const element = hit && hit.deps.length === deps.length && hit.deps.every((d, i) => Object.is(d, deps[i])) ? hit.element : make();
|
|
486
|
+
out.set(item.key, {
|
|
487
|
+
deps,
|
|
488
|
+
element
|
|
380
489
|
});
|
|
381
|
-
|
|
382
|
-
|
|
490
|
+
return element;
|
|
491
|
+
};
|
|
492
|
+
const settledRowSet = useMemo(() => new WeakSet(parts.settled.rows), [parts.settled.rows]);
|
|
493
|
+
const settledCaret = lastStreamingRow && settledRowSet.has(lastStreamingRow) ? lastStreamingRow : null;
|
|
494
|
+
const settledReceipts = parts.settled.receipts ?? receiptByRowId;
|
|
495
|
+
const settledLive = useMemo(() => ({
|
|
496
|
+
caret: settledCaret,
|
|
497
|
+
receipts: settledReceipts
|
|
498
|
+
}), [settledCaret, settledReceipts]);
|
|
499
|
+
const settledEls = useMemo(() => {
|
|
500
|
+
const next = /* @__PURE__ */ new Map();
|
|
501
|
+
const els = settledItems.map((item) => rootElement(item, settledLive, next));
|
|
502
|
+
settledCache.current = next;
|
|
503
|
+
return els;
|
|
504
|
+
}, [
|
|
505
|
+
settledItems,
|
|
506
|
+
settledLive,
|
|
507
|
+
rowCtx,
|
|
508
|
+
stops,
|
|
509
|
+
selectedTurnId,
|
|
510
|
+
resumableId,
|
|
511
|
+
renderFoldRows,
|
|
512
|
+
liveStatus,
|
|
513
|
+
sessionId,
|
|
514
|
+
showThinking,
|
|
515
|
+
collapseSubagents,
|
|
516
|
+
streaming
|
|
517
|
+
]);
|
|
518
|
+
const openNext = /* @__PURE__ */ new Map();
|
|
519
|
+
const openEls = openItems.map((item) => rootElement(item, live, openNext));
|
|
520
|
+
openCache.current = openNext;
|
|
521
|
+
const runStart = useRef({
|
|
522
|
+
sessionId,
|
|
523
|
+
key: null
|
|
524
|
+
});
|
|
525
|
+
if (runStart.current.sessionId !== sessionId) runStart.current = {
|
|
526
|
+
sessionId,
|
|
527
|
+
key: null
|
|
383
528
|
};
|
|
529
|
+
if (runStart.current.key === null && openItems.length > 0) runStart.current.key = openItems[0].key;
|
|
530
|
+
const runKey = runStart.current.key;
|
|
531
|
+
const foundAt = useMemo(() => {
|
|
532
|
+
if (runKey !== null) {
|
|
533
|
+
for (let i = settledItems.length - 1; i >= 0; i--) if (settledItems[i].key === runKey) return i;
|
|
534
|
+
}
|
|
535
|
+
return -1;
|
|
536
|
+
}, [settledItems, runKey]);
|
|
537
|
+
if (runKey !== null && foundAt < 0 && !openItems.some((item) => item.key === runKey)) runStart.current.key = openItems[0]?.key ?? null;
|
|
538
|
+
const runAt = foundAt < 0 ? settledItems.length : foundAt;
|
|
539
|
+
const prefixEls = useMemo(() => runAt === settledEls.length ? settledEls : settledEls.slice(0, runAt), [settledEls, runAt]);
|
|
540
|
+
const flatSettled = useMemo(() => runAt === settledEls.length ? [] : settledEls.slice(runAt), [settledEls, runAt]);
|
|
384
541
|
renderClustersRef.current = renderClusters;
|
|
385
|
-
const rootRows =
|
|
542
|
+
const rootRows = [
|
|
543
|
+
/* @__PURE__ */ jsx(RowRun, { rows: prefixEls }, "\0run"),
|
|
544
|
+
...flatSettled,
|
|
545
|
+
...openEls
|
|
546
|
+
];
|
|
386
547
|
useTranscriptSelectionCopy(containerRef);
|
|
387
548
|
return /* @__PURE__ */ jsx(TranscriptSettling.Provider, {
|
|
388
549
|
value: settling,
|
|
389
550
|
children: /* @__PURE__ */ jsx(LiveScriptsContext.Provider, {
|
|
390
551
|
value: liveScripts,
|
|
391
552
|
children: /* @__PURE__ */ jsx(MediaGalleryProvider, {
|
|
392
|
-
events,
|
|
553
|
+
events: transcript,
|
|
393
554
|
children: /* @__PURE__ */ jsx(RowIconsContext.Provider, {
|
|
394
555
|
value: o.showRowIcons,
|
|
395
556
|
children: /* @__PURE__ */ jsx(DiagramsContext.Provider, {
|
|
@@ -404,13 +565,25 @@ const Transcript = memo(({ events, streaming, sessionId, options, selection, tur
|
|
|
404
565
|
style,
|
|
405
566
|
children: [
|
|
406
567
|
/* @__PURE__ */ jsxs("div", {
|
|
568
|
+
ref: timelineRef,
|
|
407
569
|
className: "zg-timeline relative pl-2 pr-1 py-1",
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
570
|
+
"data-vitems": settledItems.length + openItems.length,
|
|
571
|
+
children: [
|
|
572
|
+
/* @__PURE__ */ jsx(SelectCursor, {
|
|
573
|
+
selected: selectedTurnId,
|
|
574
|
+
layout: stops
|
|
575
|
+
}),
|
|
576
|
+
rail && /* @__PURE__ */ jsx(RailTint, { store: rail }),
|
|
577
|
+
/* @__PURE__ */ jsx(RowUiStateContext.Provider, {
|
|
578
|
+
value: rowUiState,
|
|
579
|
+
children: /* @__PURE__ */ jsx(RowMountContext.Provider, {
|
|
580
|
+
value: mounter,
|
|
581
|
+
children: viewsReady || settle.current.shown ? rootRows : null
|
|
582
|
+
})
|
|
583
|
+
})
|
|
584
|
+
]
|
|
412
585
|
}),
|
|
413
|
-
sessionId && !streaming &&
|
|
586
|
+
sessionId && !streaming && transcript.length > 0 && /* @__PURE__ */ jsx(ExtensionSlot, {
|
|
414
587
|
at: "transcript.turn-end",
|
|
415
588
|
sessionId,
|
|
416
589
|
className: "pl-2 pr-1 py-1"
|