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
|
@@ -3,13 +3,14 @@ import { CodeFrame } from "../../components/CodeFrame.js";
|
|
|
3
3
|
import { useExtensionItems } from "../../extensions/ExtensionsProvider.js";
|
|
4
4
|
import { renderersFor } from "../../extensions/headless/select.js";
|
|
5
5
|
import { useLinkRouter } from "../../extensions/links.js";
|
|
6
|
-
import {
|
|
6
|
+
import { splitMarkdown } from "../headless/markdown-chunks.js";
|
|
7
|
+
import { MarkdownStream } from "../headless/markdown-stream.js";
|
|
7
8
|
import { DiagramsContext } from "./diagrams-scope.js";
|
|
8
9
|
import { useBackgroundMount, useForceMountRows } from "./LazyRow.js";
|
|
9
|
-
import { cachedMarkdown } from "./markdown-cache.js";
|
|
10
|
+
import { cachedMarkdown, liveMarkdown } from "./markdown-cache.js";
|
|
10
11
|
import { useShellBlockRunner } from "./shell-block-scope.js";
|
|
11
12
|
import { ChunkFencesContext, ChunkFencesScope, ViewFencePart, chunkFencesFor, fenceIndexIn, preloadViews, useViewTurn, useViewsEnabled, viewFenceStarts } from "./view-scope.js";
|
|
12
|
-
import {
|
|
13
|
+
import { Suspense, createContext, lazy, memo, useContext, useEffect, useMemo, useState } from "react";
|
|
13
14
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
14
15
|
import { isShellFence, mayHoldViewFence } from "zidane/chat/pure";
|
|
15
16
|
import ReactMarkdown, { defaultUrlTransform } from "react-markdown";
|
|
@@ -246,16 +247,44 @@ const documentComponents = {
|
|
|
246
247
|
em: ({ children }) => /* @__PURE__ */ jsx("em", { children })
|
|
247
248
|
};
|
|
248
249
|
const REMARK_PLUGINS = [remarkGfm];
|
|
249
|
-
const MarkdownChunk = memo(({ text, document, plugins, urlTransform }) =>
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}
|
|
250
|
+
const MarkdownChunk = memo(({ text, document, plugins, urlTransform, live = false }) => {
|
|
251
|
+
const key = {
|
|
252
|
+
document: Boolean(document),
|
|
253
|
+
plugins: plugins ?? void 0,
|
|
254
|
+
urlTransform
|
|
255
|
+
};
|
|
256
|
+
const parse = () => ReactMarkdown({
|
|
257
|
+
remarkPlugins: plugins,
|
|
258
|
+
components: document ? documentComponents : components,
|
|
259
|
+
...urlTransform ? { urlTransform } : {},
|
|
260
|
+
children: text
|
|
261
|
+
});
|
|
262
|
+
return live ? liveMarkdown(text, key, parse) : cachedMarkdown(text, key, parse);
|
|
263
|
+
});
|
|
264
|
+
/** One chunk: its parse, in its view fences' scope with views on. */
|
|
265
|
+
function ChunkPart({ text, fences, document, plugins, urlTransform, live = false }) {
|
|
266
|
+
const parsed = /* @__PURE__ */ jsx(MarkdownChunk, {
|
|
267
|
+
text,
|
|
268
|
+
document,
|
|
269
|
+
plugins,
|
|
270
|
+
urlTransform,
|
|
271
|
+
live
|
|
272
|
+
});
|
|
273
|
+
return fences ? /* @__PURE__ */ jsx(ChunkFencesScope, {
|
|
274
|
+
base: fences.base,
|
|
275
|
+
starts: fences.starts,
|
|
276
|
+
children: parsed
|
|
277
|
+
}) : parsed;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* The chunks that no longer change, as siblings in the prose box. It renders again only when one more closes (the
|
|
281
|
+
* stream keeps the array until then), so a frame of a long streaming reply reconciles its tail, not every chunk.
|
|
282
|
+
*/
|
|
283
|
+
const SettledChunks = memo(({ chunks, count, fences, ...rest }) => /* @__PURE__ */ jsx(Fragment$1, { children: chunks.slice(0, count).map((chunk, i) => /* @__PURE__ */ jsx(ChunkPart, {
|
|
284
|
+
text: chunk,
|
|
285
|
+
fences: fences?.[i],
|
|
286
|
+
...rest
|
|
287
|
+
}, i)) }));
|
|
259
288
|
/** Chunks rendered in a long text's first commit, then per frame until all are in. */
|
|
260
289
|
const CHUNKS_PER_FRAME = 2;
|
|
261
290
|
/**
|
|
@@ -270,16 +299,39 @@ const CHUNKS_PER_FRAME = 2;
|
|
|
270
299
|
* @param props - The {@link MarkdownProps}.
|
|
271
300
|
*/
|
|
272
301
|
const Markdown = memo(({ children, className, style, document, streaming = false, remarkPlugins = REMARK_PLUGINS, urlTransform, CodeBlock = HighlightedCode, Link = PlainLink, InlineCode, Image }) => {
|
|
273
|
-
const
|
|
274
|
-
if (streaming)
|
|
275
|
-
const fine = streamed.current;
|
|
302
|
+
const [stream, setStream] = useState(() => streaming ? new MarkdownStream() : null);
|
|
303
|
+
if (streaming && stream === null) setStream(new MarkdownStream());
|
|
276
304
|
const views = useViewsEnabled();
|
|
277
|
-
const
|
|
305
|
+
const { closed, tail, fence } = useMemo(() => {
|
|
306
|
+
if (!stream) {
|
|
307
|
+
const chunks = splitMarkdown(children);
|
|
308
|
+
return {
|
|
309
|
+
closed: chunks.slice(0, -1),
|
|
310
|
+
tail: chunks.at(-1),
|
|
311
|
+
fence: null
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
return stream.frame(children, streaming);
|
|
315
|
+
}, [
|
|
316
|
+
stream,
|
|
278
317
|
children,
|
|
279
|
-
streaming
|
|
280
|
-
|
|
318
|
+
streaming
|
|
319
|
+
]);
|
|
320
|
+
const [fencesMemo, setFencesMemo] = useState(null);
|
|
321
|
+
const closedFences = useMemo(() => views ? chunkFencesFor(closed, fencesMemo) : null, [
|
|
322
|
+
closed,
|
|
323
|
+
views,
|
|
324
|
+
fencesMemo
|
|
281
325
|
]);
|
|
282
|
-
|
|
326
|
+
if (closedFences && fencesMemo?.chunks !== closed) setFencesMemo({
|
|
327
|
+
chunks: closed,
|
|
328
|
+
fences: closedFences
|
|
329
|
+
});
|
|
330
|
+
const lastFences = closedFences?.at(-1);
|
|
331
|
+
const tailFences = views ? {
|
|
332
|
+
base: lastFences ? lastFences.base + lastFences.starts.length : 0,
|
|
333
|
+
starts: viewFenceStarts(tail)
|
|
334
|
+
} : null;
|
|
283
335
|
const parts = useMemo(() => ({
|
|
284
336
|
CodeBlock,
|
|
285
337
|
Link,
|
|
@@ -291,18 +343,18 @@ const Markdown = memo(({ children, className, style, document, streaming = false
|
|
|
291
343
|
InlineCode,
|
|
292
344
|
Image
|
|
293
345
|
]);
|
|
294
|
-
const tail = streaming ? openFenceOf(chunks[chunks.length - 1]) : null;
|
|
295
346
|
const searching = useForceMountRows();
|
|
296
347
|
const renderers = useExtensionItems("renderer");
|
|
297
348
|
const diagrams = useContext(DiagramsContext) && !claimsLanguage(renderers, "mermaid");
|
|
298
|
-
if (views && streaming && mayHoldViewFence(
|
|
349
|
+
if (views && streaming && mayHoldViewFence(tail) && !claimsLanguage(renderers, "view")) preloadViews();
|
|
299
350
|
const background = useBackgroundMount();
|
|
300
351
|
const [shown, setShown] = useState(CHUNKS_PER_FRAME);
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
352
|
+
const total = closed.length + 1;
|
|
353
|
+
const [complete, setComplete] = useState(!background || total <= CHUNKS_PER_FRAME);
|
|
354
|
+
if (!complete && (searching || shown >= total)) setComplete(true);
|
|
355
|
+
const visible = complete ? total : shown;
|
|
304
356
|
useEffect(() => {
|
|
305
|
-
if (complete
|
|
357
|
+
if (complete) return void 0;
|
|
306
358
|
let timer = 0;
|
|
307
359
|
const frame = requestAnimationFrame(() => {
|
|
308
360
|
timer = window.setTimeout(() => setShown((n) => n + CHUNKS_PER_FRAME), 0);
|
|
@@ -311,39 +363,42 @@ const Markdown = memo(({ children, className, style, document, streaming = false
|
|
|
311
363
|
cancelAnimationFrame(frame);
|
|
312
364
|
window.clearTimeout(timer);
|
|
313
365
|
};
|
|
314
|
-
}, [visible]);
|
|
366
|
+
}, [visible, complete]);
|
|
367
|
+
const plugins = remarkPlugins;
|
|
368
|
+
const transform = Image ? withMediaSources(urlTransform) : urlTransform;
|
|
369
|
+
const tailText = fence ? fence.before : tail;
|
|
370
|
+
const tailShown = closed.length < visible;
|
|
315
371
|
return /* @__PURE__ */ jsx(PartsContext.Provider, {
|
|
316
372
|
value: parts,
|
|
317
|
-
children: /* @__PURE__ */
|
|
373
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
318
374
|
className: `zg-md${views ? " zg-md-views" : ""} ${className ?? ""}`,
|
|
319
375
|
style,
|
|
320
|
-
children:
|
|
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
|
-
})
|
|
376
|
+
children: [/* @__PURE__ */ jsx(SettledChunks, {
|
|
377
|
+
chunks: closed,
|
|
378
|
+
count: Math.min(visible, closed.length),
|
|
379
|
+
fences: closedFences,
|
|
380
|
+
document,
|
|
381
|
+
plugins,
|
|
382
|
+
urlTransform: transform
|
|
383
|
+
}), tailShown ? /* @__PURE__ */ jsxs(Fragment$1, { children: [tailText ? /* @__PURE__ */ jsx(ChunkPart, {
|
|
384
|
+
text: tailText,
|
|
385
|
+
fences: tailFences,
|
|
386
|
+
document,
|
|
387
|
+
plugins,
|
|
388
|
+
urlTransform: transform,
|
|
389
|
+
live: streaming
|
|
390
|
+
}) : null, fence ? diagrams && fence.language === "mermaid" && fence.code.trim() ? /* @__PURE__ */ jsx(DiagramFence, {
|
|
391
|
+
code: fence.code,
|
|
392
|
+
streaming: true
|
|
393
|
+
}) : views && fence.language === "view" ? /* @__PURE__ */ jsx(ViewFenceBlock, {
|
|
394
|
+
code: fence.code,
|
|
395
|
+
index: (tailFences?.base ?? 0) + viewFenceStarts(fence.before).length,
|
|
396
|
+
streaming: true,
|
|
397
|
+
CodeBlock
|
|
398
|
+
}) : /* @__PURE__ */ jsx(CodeBlock, {
|
|
399
|
+
code: fence.code,
|
|
400
|
+
language: fence.language
|
|
401
|
+
}) : null] }) : null]
|
|
347
402
|
})
|
|
348
403
|
});
|
|
349
404
|
});
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import { ChatEvent } from "../headless/host.js";
|
|
14
14
|
import { TranscriptActions } from "./actions.js";
|
|
15
15
|
import { MouseEvent, ReactNode } from "react";
|
|
16
|
+
import { TranscriptEvents } from "zidane/chat/pure";
|
|
16
17
|
/** What a medium's component hands the gallery: its key, and for the menu what it is and where it loads from. */
|
|
17
18
|
export interface GalleryMedium {
|
|
18
19
|
/** Its key in its exchange (`mediumKey`). */
|
|
@@ -43,8 +44,8 @@ export declare function useMediaGallery(): MediaGallery | null;
|
|
|
43
44
|
export declare function messageMediaUrlOf(actions: Pick<TranscriptActions, 'messageMediaUrl'>, src: string): string | undefined;
|
|
44
45
|
/** Props for {@link MediaGalleryProvider}. */
|
|
45
46
|
export interface MediaGalleryProviderProps {
|
|
46
|
-
/** The transcript's events, whose media the gallery steps through. */
|
|
47
|
-
events: readonly ChatEvent[]
|
|
47
|
+
/** The transcript's events, whose media the gallery steps through, or its transcript store (read when a medium opens). */
|
|
48
|
+
events: readonly ChatEvent[] | TranscriptEvents<ChatEvent>;
|
|
48
49
|
children?: ReactNode;
|
|
49
50
|
}
|
|
50
51
|
/**
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { copyImage, copyImageBase64, copyImageDataUrl } from "../../components/image-clipboard.js";
|
|
2
2
|
import { useLightbox } from "../../components/Lightbox.js";
|
|
3
|
+
import { useLatest } from "../../hooks/useLatest.js";
|
|
3
4
|
import { useLabels } from "../../labels.js";
|
|
4
5
|
import { exchangesMedia } from "../headless/transcript/exchange-media.js";
|
|
5
6
|
import { PdfPreview } from "../PdfPreview.js";
|
|
6
7
|
import { TextPreview } from "../TextPreview.js";
|
|
7
8
|
import { useChatLabels } from "../useChatLabels.js";
|
|
8
|
-
import { useTranscriptActions } from "./actions.js";
|
|
9
|
+
import { attachmentSrcOf, toolMediaSrcOf, useTranscriptActions } from "./actions.js";
|
|
9
10
|
import { useTranscriptRenderers } from "./renderers.js";
|
|
10
11
|
import { Suspense, createContext, lazy, useCallback, useContext, useMemo, useRef, useState } from "react";
|
|
11
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
import { messageMediaOf } from "zidane/chat/pure";
|
|
13
|
+
import { messageMediaOf, transcriptArray } from "zidane/chat/pure";
|
|
13
14
|
// src/chat/transcript/media-gallery.tsx
|
|
14
15
|
const RowActionsMenu = lazy(() => import("../../components/RowActionsMenu.js").then((m) => ({ default: m.RowActionsMenu })));
|
|
15
16
|
const GalleryContext = createContext(null);
|
|
@@ -170,7 +171,7 @@ function lightboxItemOf(medium, { actions, mediumActions, TextPreview, isLoaded
|
|
|
170
171
|
};
|
|
171
172
|
}
|
|
172
173
|
if (medium.from === "tool") {
|
|
173
|
-
const url = actions
|
|
174
|
+
const url = toolMediaSrcOf(actions, medium.callId, medium);
|
|
174
175
|
if (!url) return null;
|
|
175
176
|
return {
|
|
176
177
|
key: medium.key,
|
|
@@ -230,12 +231,10 @@ function MediaGalleryProvider({ events, children }) {
|
|
|
230
231
|
const rootRef = useRef(null);
|
|
231
232
|
const [loaded, setLoaded] = useState(() => /* @__PURE__ */ new Set());
|
|
232
233
|
const [menu, setMenu] = useState(null);
|
|
233
|
-
const
|
|
234
|
-
eventsRef.current = events;
|
|
234
|
+
const getEvents = useLatest(events);
|
|
235
235
|
const failedRef = useRef(/* @__PURE__ */ new Set());
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
const isLoaded = useCallback((src) => loadedRef.current.has(src), []);
|
|
236
|
+
const getLoaded = useLatest(loaded);
|
|
237
|
+
const isLoaded = useCallback((src) => getLoaded().has(src), [getLoaded]);
|
|
239
238
|
const itemOf = useCallback((medium) => {
|
|
240
239
|
const item = lightboxItemOf(medium, {
|
|
241
240
|
actions,
|
|
@@ -254,20 +253,17 @@ function MediaGalleryProvider({ events, children }) {
|
|
|
254
253
|
TextPreview$1,
|
|
255
254
|
isLoaded
|
|
256
255
|
]);
|
|
257
|
-
const live =
|
|
256
|
+
const live = useLatest({
|
|
258
257
|
itemOf,
|
|
259
258
|
lightbox,
|
|
260
|
-
mediumActions
|
|
259
|
+
mediumActions,
|
|
260
|
+
actions
|
|
261
261
|
});
|
|
262
|
-
live.current = {
|
|
263
|
-
itemOf,
|
|
264
|
-
lightbox,
|
|
265
|
-
mediumActions
|
|
266
|
-
};
|
|
267
262
|
const gallery = useMemo(() => ({
|
|
268
263
|
open(key, origin) {
|
|
269
|
-
const { itemOf, lightbox } = live
|
|
270
|
-
const
|
|
264
|
+
const { itemOf, lightbox, actions: current } = live();
|
|
265
|
+
const source = getEvents();
|
|
266
|
+
const exchanges = exchangesMedia(Array.isArray(source) ? source : transcriptArray(source), (att) => attachmentSrcOf(current, att));
|
|
271
267
|
const row = origin.closest("[data-row]");
|
|
272
268
|
const prompts = rootRef.current ? [...rootRef.current.querySelectorAll("[data-prompt]")] : [];
|
|
273
269
|
const at = row ? prompts.filter((p) => p === row || p.compareDocumentPosition(row) & Node.DOCUMENT_POSITION_FOLLOWING).length : -1;
|
|
@@ -280,7 +276,7 @@ function MediaGalleryProvider({ events, children }) {
|
|
|
280
276
|
return true;
|
|
281
277
|
},
|
|
282
278
|
menu(event, medium) {
|
|
283
|
-
const items = live.
|
|
279
|
+
const items = live().mediumActions(medium, (src) => loaded.has(src));
|
|
284
280
|
if (items.length === 0) return;
|
|
285
281
|
event.preventDefault();
|
|
286
282
|
event.stopPropagation();
|
|
@@ -295,7 +291,11 @@ function MediaGalleryProvider({ events, children }) {
|
|
|
295
291
|
remoteLoaded: (src) => loaded.has(src),
|
|
296
292
|
loadRemote: (src) => setLoaded((prev) => prev.has(src) ? prev : new Set(prev).add(src)),
|
|
297
293
|
failed: (key) => void failedRef.current.add(key)
|
|
298
|
-
}), [
|
|
294
|
+
}), [
|
|
295
|
+
loaded,
|
|
296
|
+
live,
|
|
297
|
+
getEvents
|
|
298
|
+
]);
|
|
299
299
|
return /* @__PURE__ */ jsxs(GalleryContext.Provider, {
|
|
300
300
|
value: gallery,
|
|
301
301
|
children: [
|
|
@@ -57,23 +57,24 @@ const MessageGroupRow = memo(({ row, renderRows, className, style }) => {
|
|
|
57
57
|
...row.between.map((m) => m.id),
|
|
58
58
|
...count > 0 ? ["header"] : []
|
|
59
59
|
]));
|
|
60
|
+
const { between, current: currentRow } = row;
|
|
60
61
|
const entries = useMemo(() => [
|
|
61
62
|
...stack.map((m) => ({
|
|
62
63
|
row: m,
|
|
63
64
|
slot: "earlier"
|
|
64
65
|
})),
|
|
65
|
-
...
|
|
66
|
+
...between.map((m) => ({
|
|
66
67
|
row: m,
|
|
67
68
|
slot: "between"
|
|
68
69
|
})),
|
|
69
70
|
{
|
|
70
|
-
row:
|
|
71
|
+
row: currentRow,
|
|
71
72
|
slot: count > 0 ? "current" : "only"
|
|
72
73
|
}
|
|
73
74
|
], [
|
|
74
75
|
stack,
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
between,
|
|
77
|
+
currentRow,
|
|
77
78
|
count
|
|
78
79
|
]);
|
|
79
80
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -7,6 +7,7 @@ import { useTranscriptActions } from "./actions.js";
|
|
|
7
7
|
import { AuthFailureCard } from "./AuthFailureCard.js";
|
|
8
8
|
import { Caret } from "./frame.js";
|
|
9
9
|
import { useTranscriptRenderers } from "./renderers.js";
|
|
10
|
+
import { useRowPartKey, useRowUiState } from "./row-ui-state.js";
|
|
10
11
|
import { memo, useId, useState } from "react";
|
|
11
12
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
13
|
import { CONTINUE_PROMPT, SESSION_EVENT_STATUS_STYLE, describeSpawnEnd, sessionDirLabel, sessionEventExcerpt, sessionEventMeta, shortSessionId, spawnStartParts } from "zidane/chat/pure";
|
|
@@ -335,7 +336,7 @@ const COMMAND_DETAIL_LINE = "26.4px";
|
|
|
335
336
|
* monospace `<pre>` would misrender them as a wall of mono.
|
|
336
337
|
*/
|
|
337
338
|
const CommandDetailRow = memo(({ label, text, syntax, className, style }) => {
|
|
338
|
-
const [open, setOpen] =
|
|
339
|
+
const [open, setOpen] = useRowUiState(useRowPartKey("command-detail"), false);
|
|
339
340
|
const mounted = useStaysMounted(open);
|
|
340
341
|
const labels = useChatLabels();
|
|
341
342
|
const { Markdown, CodeBlock } = useTranscriptRenderers();
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* commands; by default the plain text). A file chip's icon and name come
|
|
7
7
|
* from the `attachmentLabel` slot.
|
|
8
8
|
*/
|
|
9
|
-
import { ChatAttachment } from "../headless/host.js";
|
|
10
9
|
import { Row } from "../headless/transcript/rows.js";
|
|
10
|
+
import { ChatAttachment } from "../headless/host.js";
|
|
11
11
|
import "../headless/transcript/index.js";
|
|
12
12
|
import { AttachmentLabelParts } from "./renderers.js";
|
|
13
13
|
import { CSSProperties } from "react";
|
|
@@ -4,6 +4,7 @@ import { mediumKey } from "../headless/transcript/exchange-media.js";
|
|
|
4
4
|
import { PdfPreview } from "../PdfPreview.js";
|
|
5
5
|
import { TextPreview } from "../TextPreview.js";
|
|
6
6
|
import { useChatLabels } from "../useChatLabels.js";
|
|
7
|
+
import { attachmentSrcOf, useTranscriptActions } from "./actions.js";
|
|
7
8
|
import { Dot, useRowIcons } from "./frame.js";
|
|
8
9
|
import { useMediaGallery } from "./media-gallery.js";
|
|
9
10
|
import { MessageMedia, promptMediaOf } from "./message-media.js";
|
|
@@ -65,13 +66,14 @@ function UserPromptAttachments({ items, className, style }) {
|
|
|
65
66
|
const labels = useChatLabels();
|
|
66
67
|
const lightbox = useLightbox();
|
|
67
68
|
const mediaGallery = useMediaGallery();
|
|
69
|
+
const actions = useTranscriptActions();
|
|
68
70
|
const { TextPreview: TextPreview$1 = TextPreview } = useTranscriptRenderers();
|
|
69
71
|
const [failed, setFailed] = useState(() => /* @__PURE__ */ new Set());
|
|
70
72
|
const isImage = (att) => att.mediaType.startsWith("image/");
|
|
71
73
|
const gallery = items.map((att, idx) => ({
|
|
72
74
|
att,
|
|
73
75
|
idx,
|
|
74
|
-
src: att
|
|
76
|
+
src: attachmentSrcOf(actions, att)
|
|
75
77
|
})).filter((entry) => entry.src !== void 0 && (isImage(entry.att) ? !failed.has(entry.idx) : isPdfAttachment(entry.att) || isTextLike(entry.att)));
|
|
76
78
|
const galleryItems = gallery.map(({ att, idx, src }) => isImage(att) ? {
|
|
77
79
|
key: String(idx),
|
|
@@ -115,14 +117,14 @@ function UserPromptAttachments({ items, className, style }) {
|
|
|
115
117
|
title: att.name,
|
|
116
118
|
"aria-label": labels.viewAttachment(att.name),
|
|
117
119
|
onClick: (event) => openAt(idx, position, event.currentTarget),
|
|
118
|
-
onContextMenu: mediaGallery
|
|
120
|
+
onContextMenu: mediaGallery ? (event) => mediaGallery.menu(event, {
|
|
119
121
|
key: mediumKey.attachment(idx),
|
|
120
122
|
kind: "image",
|
|
121
|
-
url:
|
|
123
|
+
url: gallery[position].src
|
|
122
124
|
}) : void 0,
|
|
123
125
|
className: "zg-press-subtle block p-0 border-0 bg-transparent cursor-zoom-in rounded-zg-md focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--zg-ring)]",
|
|
124
126
|
children: /* @__PURE__ */ jsx("img", {
|
|
125
|
-
src:
|
|
127
|
+
src: gallery[position].src,
|
|
126
128
|
alt: att.name,
|
|
127
129
|
onError: () => setFailed((prev) => new Set(prev).add(idx)),
|
|
128
130
|
className: "block w-16 h-16 object-cover rounded-zg-md bg-[var(--zg-tray)] shadow-[inset_0_0_0_1px_var(--zg-hairline)]"
|
|
@@ -2,6 +2,7 @@ import { useStaysMounted } from "../../motion/collapse.js";
|
|
|
2
2
|
import { useChatLabels } from "../useChatLabels.js";
|
|
3
3
|
import { Caret } from "./frame.js";
|
|
4
4
|
import { useTranscriptRenderers } from "./renderers.js";
|
|
5
|
+
import { useRowPartKey, useRowUiState } from "./row-ui-state.js";
|
|
5
6
|
import { ToolTiming } from "./tool-parts.js";
|
|
6
7
|
import { memo, useState } from "react";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -74,7 +75,7 @@ const ThinkingRow = memo(({ text, thinkingMs, live, autoExpand = false, classNam
|
|
|
74
75
|
* groups); replayed groups render a bare count.
|
|
75
76
|
*/
|
|
76
77
|
const ThinkingBatchRow = memo(({ thoughts, totalMs, autoExpand = false, className, style }) => {
|
|
77
|
-
const [open, setOpen] =
|
|
78
|
+
const [open, setOpen] = useRowUiState(useRowPartKey("thoughts"), false);
|
|
78
79
|
const labels = useChatLabels();
|
|
79
80
|
return /* @__PURE__ */ jsxs("div", {
|
|
80
81
|
className: ["text-xs", className].filter(Boolean).join(" "),
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The transcript's root items: each root row, each worker's block, and what
|
|
3
|
+
* follows a turn (the codemode views of an exchange with no reply text, the
|
|
4
|
+
* extensions' `transcript.turn-end` items), keyed and estimated. And the
|
|
5
|
+
* text a search reads from a row's data, to know which unmounted rows to
|
|
6
|
+
* mount for it.
|
|
7
|
+
*/
|
|
8
|
+
import { Cluster, GroupCluster, Row } from "../headless/transcript/rows.js";
|
|
9
|
+
import "../headless/transcript/index.js";
|
|
10
|
+
/** A root item's key and first-pass height. */
|
|
11
|
+
export interface RootItemSpec {
|
|
12
|
+
/** Its id among the root items: the row's id for a row. */
|
|
13
|
+
key: string;
|
|
14
|
+
/** Its height before it is measured (px). */
|
|
15
|
+
estimate: number;
|
|
16
|
+
}
|
|
17
|
+
/** A root item and what it renders. */
|
|
18
|
+
export type RootItem = RootItemSpec & ({
|
|
19
|
+
kind: 'single';
|
|
20
|
+
cluster: Extract<Cluster, {
|
|
21
|
+
kind: 'single';
|
|
22
|
+
}>;
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'group';
|
|
25
|
+
cluster: GroupCluster;
|
|
26
|
+
ci: number;
|
|
27
|
+
} | {
|
|
28
|
+
kind: 'views-end';
|
|
29
|
+
rowId: string;
|
|
30
|
+
turns: readonly string[];
|
|
31
|
+
} | {
|
|
32
|
+
kind: 'turn-end';
|
|
33
|
+
turnId: string;
|
|
34
|
+
});
|
|
35
|
+
/** A subagent block's id among the rows: its first row's, not its position (a prepended page shifts every position). */
|
|
36
|
+
export declare function groupRowId(cluster: GroupCluster, index: number): string;
|
|
37
|
+
/**
|
|
38
|
+
* The root items, in order.
|
|
39
|
+
*
|
|
40
|
+
* @param clusters - The transcript's root clusters.
|
|
41
|
+
* @param hidden - Rows that render nothing (no item).
|
|
42
|
+
* @param collapsedGroups - Worker blocks start collapsed.
|
|
43
|
+
* @param textlessEnds - After which row the codemode views of an exchange with no reply text go, or null.
|
|
44
|
+
* @param turnEnds - After which row the extensions' items for which turns go, or null.
|
|
45
|
+
* @param offset - Where `clusters` start among the transcript's clusters (the open part's, after the settled ones).
|
|
46
|
+
*/
|
|
47
|
+
export declare function rootItems(clusters: readonly Cluster[], hidden: (row: Row) => boolean, collapsedGroups: boolean, textlessEnds: ReadonlyMap<string, readonly string[]> | null, turnEnds: ReadonlyMap<string, readonly string[]> | null, offset?: number): RootItem[];
|
|
48
|
+
/**
|
|
49
|
+
* Every string a row holds, lowercased: what it shows (and some it does not, ids and paths). Cached per row object.
|
|
50
|
+
* A search mounts the rows whose text holds its needle; the DOM walk then finds what they really show.
|
|
51
|
+
*
|
|
52
|
+
* @param row - A row, or a block's cluster.
|
|
53
|
+
*/
|
|
54
|
+
export declare function rowSearchText(row: object): string;
|
|
55
|
+
/**
|
|
56
|
+
* The id of the last root row holding each turn among `clusters`: once per clusters array (a settled part's, read
|
|
57
|
+
* every tick, is walked once).
|
|
58
|
+
*
|
|
59
|
+
* @param clusters - Root clusters.
|
|
60
|
+
*/
|
|
61
|
+
export declare function lastRowByTurn(clusters: readonly Cluster[]): ReadonlyMap<string, string>;
|
|
62
|
+
/** What follows rows, split by the part their row is in: an item list per part derives from its own. */
|
|
63
|
+
export interface PartEnds {
|
|
64
|
+
settled: ReadonlyMap<string, readonly string[]> | null;
|
|
65
|
+
open: ReadonlyMap<string, readonly string[]> | null;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Places groups of turns after the last root row holding one of them, in the part that row is in.
|
|
69
|
+
* Each part's map is `previous`'s while it holds the same: the settled items then stay.
|
|
70
|
+
*
|
|
71
|
+
* @param parts - The settled and the open root clusters.
|
|
72
|
+
* @param parts.settled - The settled clusters.
|
|
73
|
+
* @param parts.open - The open clusters.
|
|
74
|
+
* @param place - Calls `at` for each group: `at(turnId)` is where a turn's last row is.
|
|
75
|
+
* @param previous - The last result.
|
|
76
|
+
*/
|
|
77
|
+
export declare function endsByRow(parts: {
|
|
78
|
+
settled: readonly Cluster[];
|
|
79
|
+
open: readonly Cluster[];
|
|
80
|
+
}, place: (at: (turnId: string) => {
|
|
81
|
+
rowId: string;
|
|
82
|
+
open: boolean;
|
|
83
|
+
} | undefined, add: (where: {
|
|
84
|
+
rowId: string;
|
|
85
|
+
open: boolean;
|
|
86
|
+
}, turns: readonly string[]) => void) => void, previous: PartEnds | null): PartEnds;
|
|
87
|
+
/**
|
|
88
|
+
* The keys of the items whose data holds one of `needles` (lowercased).
|
|
89
|
+
*
|
|
90
|
+
* @param items - The root items, or their settled and open parts.
|
|
91
|
+
* @param needles - What the search looks for.
|
|
92
|
+
*/
|
|
93
|
+
export declare function matchingItems(items: readonly RootItem[] | {
|
|
94
|
+
settled: readonly RootItem[];
|
|
95
|
+
open: readonly RootItem[];
|
|
96
|
+
}, needles: readonly string[]): string[];
|