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
|
@@ -19,9 +19,9 @@ import { ChatCommandFacts, ChatCommit, ChatContextFacts, ChatResolvedPath, ChatS
|
|
|
19
19
|
import { ComposerContractSession, ComposerHostCapability, ComposerHostContractBackend, ComposerHostContractControl, ComposerHostHarness, ComposerHostHarnessFactory, describeComposerHostContract } from "./composer.contract.js";
|
|
20
20
|
import { SidebarHostCapability, SidebarHostContractBackend, SidebarHostContractControl, SidebarHostHarness, SidebarHostHarnessFactory, describeSidebarHostContract } from "./sidebar.contract.js";
|
|
21
21
|
import { BadgeActionEffect, BadgeMenuItem, ExtensionReferenceView, ReferenceProviderWire } from "zidane/chat/pure";
|
|
22
|
-
import { InteractionRequest } from "zidane/chat";
|
|
22
|
+
import { InteractionRequest, ToolCallDetail as ToolCallDetail$1 } from "zidane/chat";
|
|
23
23
|
/** An optional `ChatHost` member, by its path. */
|
|
24
|
-
export type ChatHostCapability = 'sessions' | 'sessions.create' | 'sessions.rename' | 'sessions.setArchived' | 'sessions.setFavorite' | 'sessions.setInboxState' | 'sessions.remove' | 'sessions.query' | 'sessions.setSpace' | 'sessions.search' | 'sessions.onChanged' | 'sessions.views' | 'sessions.main' | 'send' | 'interrupt' | 'shell' | 'providerReady' | 'interactions' | 'interactions.cancel' | 'interactions.all' | 'models' | 'toolOutput' | 'cancelTool' | 'searchSync' | 'references' | 'paths' | 'chips' | 'chips.commit' | 'chips.sessions' | 'chips.context' | 'chips.skills' | 'chips.commands' | 'badges' | 'siteIcons' | 'blockRuns';
|
|
24
|
+
export type ChatHostCapability = 'sessions' | 'sessions.create' | 'sessions.rename' | 'sessions.setArchived' | 'sessions.setFavorite' | 'sessions.setInboxState' | 'sessions.remove' | 'sessions.query' | 'sessions.setSpace' | 'sessions.search' | 'sessions.onChanged' | 'sessions.views' | 'sessions.main' | 'send' | 'interrupt' | 'shell' | 'providerReady' | 'interactions' | 'interactions.cancel' | 'interactions.all' | 'models' | 'toolOutput' | 'toolOutputRange' | 'toolCall' | 'cancelTool' | 'searchSync' | 'references' | 'paths' | 'chips' | 'chips.commit' | 'chips.sessions' | 'chips.context' | 'chips.skills' | 'chips.commands' | 'badges' | 'siteIcons' | 'blockRuns';
|
|
25
25
|
/** One thing the backend does while it runs a prompt, in order. */
|
|
26
26
|
export type ChatHostScriptStep = {
|
|
27
27
|
kind: 'reply';
|
|
@@ -42,8 +42,10 @@ export interface ChatHostContractBackend {
|
|
|
42
42
|
sessions: readonly ChatSession[];
|
|
43
43
|
/** Stored events per session id (a session missing here has none). */
|
|
44
44
|
transcripts: Readonly<Record<string, readonly ChatEvent[]>>;
|
|
45
|
-
/** A tool call's full output, by call id (any session). */
|
|
45
|
+
/** A tool call's full output, by call id (any session). A range of it (`toolOutputRange`) is `{ text, offset, total }` in UTF-16 code units. */
|
|
46
46
|
toolOutputs: Readonly<Record<string, string>>;
|
|
47
|
+
/** The whole of a tool call (its input, its edit), by call id (any session). */
|
|
48
|
+
toolCalls?: Readonly<Record<string, ToolCallDetail$1>>;
|
|
47
49
|
/**
|
|
48
50
|
* What a run does with a sent prompt. The backend echoes the prompt into the transcript, starts the
|
|
49
51
|
* run, plays these steps, and ends the run when they are done (unless a step holds it).
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createToolOutputPager } from "../headless/output-pager.js";
|
|
1
2
|
import { describeComposerHostContract } from "./composer.contract.js";
|
|
2
3
|
import { describeSidebarHostContract } from "./sidebar.contract.js";
|
|
3
4
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
@@ -25,6 +26,8 @@ const CAPABILITIES = [
|
|
|
25
26
|
"interactions.all",
|
|
26
27
|
"models",
|
|
27
28
|
"toolOutput",
|
|
29
|
+
"toolOutputRange",
|
|
30
|
+
"toolCall",
|
|
28
31
|
"cancelTool",
|
|
29
32
|
"searchSync",
|
|
30
33
|
"references",
|
|
@@ -78,6 +81,8 @@ const SESSIONS = [{
|
|
|
78
81
|
createdAt: 3,
|
|
79
82
|
updatedAt: 4
|
|
80
83
|
}];
|
|
84
|
+
/** A result longer than a few pages, with characters of two code units (a page edge can split one). */
|
|
85
|
+
const LONG_OUTPUT = Array.from({ length: 300 }, (_, i) => `line ${i} é 🙂\n`).join("");
|
|
81
86
|
const CONTRACT_SHA = "abc1234def5678abc1234def5678abc1234def56";
|
|
82
87
|
function contractBackend() {
|
|
83
88
|
return {
|
|
@@ -89,7 +94,24 @@ function contractBackend() {
|
|
|
89
94
|
kind: "markdown",
|
|
90
95
|
text: "earlier reply"
|
|
91
96
|
}] },
|
|
92
|
-
toolOutputs: {
|
|
97
|
+
toolOutputs: {
|
|
98
|
+
"call-1": "the full output",
|
|
99
|
+
"call-long": LONG_OUTPUT
|
|
100
|
+
},
|
|
101
|
+
toolCalls: { "call-1": {
|
|
102
|
+
input: {
|
|
103
|
+
path: "a.ts",
|
|
104
|
+
content: "the whole file"
|
|
105
|
+
},
|
|
106
|
+
edit: {
|
|
107
|
+
tool: "write_file",
|
|
108
|
+
path: "a.ts",
|
|
109
|
+
hunks: [{
|
|
110
|
+
oldString: "",
|
|
111
|
+
newString: "the whole file"
|
|
112
|
+
}]
|
|
113
|
+
}
|
|
114
|
+
} },
|
|
93
115
|
script(prompt) {
|
|
94
116
|
if (prompt === "hold") return [{ kind: "hold" }];
|
|
95
117
|
if (prompt === "ask") return [{
|
|
@@ -443,6 +465,49 @@ function describeChatHostContract(name, makeHarness, capabilities) {
|
|
|
443
465
|
expect(await host.toolOutput("c-1", "call-1")).toBe("the full output");
|
|
444
466
|
expect(await host.toolOutput("c-1", "call-unknown")).toBeNull();
|
|
445
467
|
});
|
|
468
|
+
it.skipIf(!has("toolOutputRange"))("reads a tool call's output a range at a time", async () => {
|
|
469
|
+
const { host } = await setup();
|
|
470
|
+
const total = LONG_OUTPUT.length;
|
|
471
|
+
expect(await host.toolOutputRange("c-1", "call-long", {
|
|
472
|
+
offset: 0,
|
|
473
|
+
length: 10
|
|
474
|
+
})).toEqual({
|
|
475
|
+
text: LONG_OUTPUT.slice(0, 10),
|
|
476
|
+
offset: 0,
|
|
477
|
+
total
|
|
478
|
+
});
|
|
479
|
+
expect(await host.toolOutputRange("c-1", "call-long", {
|
|
480
|
+
offset: total - 5,
|
|
481
|
+
length: 100
|
|
482
|
+
})).toEqual({
|
|
483
|
+
text: LONG_OUTPUT.slice(total - 5),
|
|
484
|
+
offset: total - 5,
|
|
485
|
+
total
|
|
486
|
+
});
|
|
487
|
+
expect(await host.toolOutputRange("c-1", "call-unknown", {
|
|
488
|
+
offset: 0,
|
|
489
|
+
length: 10
|
|
490
|
+
})).toBeNull();
|
|
491
|
+
const pager = createToolOutputPager((range) => host.toolOutputRange("c-1", "call-long", range), { pageSize: 1e3 });
|
|
492
|
+
await pager.loadMore();
|
|
493
|
+
expect(pager.get()).toMatchObject({
|
|
494
|
+
text: LONG_OUTPUT.slice(0, 1e3),
|
|
495
|
+
total,
|
|
496
|
+
error: null
|
|
497
|
+
});
|
|
498
|
+
await pager.loadAll();
|
|
499
|
+
expect(pager.get()).toMatchObject({
|
|
500
|
+
text: LONG_OUTPUT,
|
|
501
|
+
total,
|
|
502
|
+
loading: false,
|
|
503
|
+
error: null
|
|
504
|
+
});
|
|
505
|
+
});
|
|
506
|
+
it.skipIf(!has("toolCall"))("reads the whole of a tool call", async () => {
|
|
507
|
+
const { host } = await setup();
|
|
508
|
+
expect(await host.toolCall("c-1", "call-1")).toEqual(contractBackend().toolCalls["call-1"]);
|
|
509
|
+
expect(await host.toolCall("c-1", "call-unknown")).toBeNull();
|
|
510
|
+
});
|
|
446
511
|
it.skipIf(!has("searchSync"))("shares a session's search with its other windows", async () => {
|
|
447
512
|
const harness = await makeHarness(contractBackend());
|
|
448
513
|
cleanup.push(() => harness.dispose?.());
|
|
@@ -35,6 +35,11 @@ export interface DiffLinesProps {
|
|
|
35
35
|
* ones) highlights as one text, so a token that spans lines colors right. Absent: plain text.
|
|
36
36
|
*/
|
|
37
37
|
language?: string;
|
|
38
|
+
/**
|
|
39
|
+
* A line number per line, 1:1 with `lines` (`null`: none for that line).
|
|
40
|
+
* Set, a gutter shows them before the `+` / `−` markers.
|
|
41
|
+
*/
|
|
42
|
+
lineNumbers?: readonly (number | null)[];
|
|
38
43
|
/** Extra classes on the root element. */
|
|
39
44
|
className?: string;
|
|
40
45
|
/** Inline styles on the root element, merged after the component's own. */
|
|
@@ -47,4 +52,4 @@ export interface DiffLinesProps {
|
|
|
47
52
|
* a 500-line hunk would otherwise be 1,500 elements to build, style and lay
|
|
48
53
|
* out every time its row scrolled into a long transcript.
|
|
49
54
|
*/
|
|
50
|
-
export declare const DiffLines: import("react").MemoExoticComponent<({ lines, maxHeight, language, className, style: styleProp }: DiffLinesProps) => import("react").JSX.Element>;
|
|
55
|
+
export declare const DiffLines: import("react").MemoExoticComponent<({ lines, maxHeight, language, lineNumbers, className, style: styleProp }: DiffLinesProps) => import("react").JSX.Element>;
|
|
@@ -12,28 +12,38 @@ const MARKER = {
|
|
|
12
12
|
};
|
|
13
13
|
/** Past this many lines a diff stays plain: two highlights of a huge hunk cost more than its colors give. */
|
|
14
14
|
const HIGHLIGHT_MAX_LINES = 2e3;
|
|
15
|
-
const DiffRun = memo(({ op, text, count, tokens }) => {
|
|
15
|
+
const DiffRun = memo(({ op, text, count, tokens, numbers, gutter }) => {
|
|
16
|
+
const bg = op === "add" ? "var(--zg-diff-add-bg)" : op === "remove" ? "var(--zg-diff-remove-bg)" : "transparent";
|
|
17
|
+
const markerColor = op === "add" ? "var(--zg-success)" : op === "remove" ? "var(--zg-danger)" : "var(--zg-text-muted)";
|
|
16
18
|
return /* @__PURE__ */ jsxs("div", {
|
|
17
19
|
className: "flex items-start gap-2 px-2",
|
|
18
|
-
style: { background:
|
|
19
|
-
children: [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
27
|
-
className: "flex-1 whitespace-pre",
|
|
28
|
-
children: tokens ? tokens.map((line, i) => /* @__PURE__ */ jsxs("span", { children: [line.map((t, j) => /* @__PURE__ */ jsx("span", {
|
|
20
|
+
style: { background: bg },
|
|
21
|
+
children: [
|
|
22
|
+
numbers !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
23
|
+
style: { width: `${gutter}ch` },
|
|
24
|
+
className: "select-none shrink-0 whitespace-pre text-right text-[var(--zg-text-muted)]",
|
|
25
|
+
children: numbers
|
|
26
|
+
}),
|
|
27
|
+
/* @__PURE__ */ jsx("span", {
|
|
29
28
|
style: {
|
|
30
|
-
color:
|
|
31
|
-
|
|
32
|
-
fontWeight: t.fontWeight
|
|
29
|
+
color: markerColor,
|
|
30
|
+
width: "1ch"
|
|
33
31
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
className: "select-none shrink-0 whitespace-pre",
|
|
33
|
+
children: Array.from({ length: count }).fill(MARKER[op]).join("\n")
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ jsx("span", {
|
|
36
|
+
className: "flex-1 whitespace-pre",
|
|
37
|
+
children: tokens ? tokens.map((line, i) => /* @__PURE__ */ jsxs("span", { children: [line.map((t, j) => /* @__PURE__ */ jsx("span", {
|
|
38
|
+
style: {
|
|
39
|
+
color: t.color,
|
|
40
|
+
fontStyle: t.fontStyle,
|
|
41
|
+
fontWeight: t.fontWeight
|
|
42
|
+
},
|
|
43
|
+
children: t.text
|
|
44
|
+
}, j)), i < tokens.length - 1 ? "\n" : line.length === 0 ? " " : ""] }, i)) : text.endsWith("\n") || text === "" ? `${text} ` : text
|
|
45
|
+
})
|
|
46
|
+
]
|
|
37
47
|
});
|
|
38
48
|
});
|
|
39
49
|
/**
|
|
@@ -43,9 +53,10 @@ const DiffRun = memo(({ op, text, count, tokens }) => {
|
|
|
43
53
|
* a 500-line hunk would otherwise be 1,500 elements to build, style and lay
|
|
44
54
|
* out every time its row scrolled into a long transcript.
|
|
45
55
|
*/
|
|
46
|
-
const DiffLines = memo(({ lines, maxHeight, language, className, style: styleProp }) => {
|
|
56
|
+
const DiffLines = memo(({ lines, maxHeight, language, lineNumbers, className, style: styleProp }) => {
|
|
47
57
|
const style = maxHeight ? { maxHeight: `${maxHeight}px` } : BASE_NO_CLAMP;
|
|
48
58
|
const runs = useMemo(() => toRuns(lines), [lines]);
|
|
59
|
+
const gutter = useMemo(() => lineNumbers?.reduce((width, n) => Math.max(width, n === null ? 0 : String(n).length), 0) ?? 0, [lineNumbers]);
|
|
49
60
|
const frameRef = useRef(null);
|
|
50
61
|
const tokens = useDiffTokens(lines, language, frameRef);
|
|
51
62
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -61,7 +72,11 @@ const DiffLines = memo(({ lines, maxHeight, language, className, style: stylePro
|
|
|
61
72
|
op: run.op,
|
|
62
73
|
text: run.text,
|
|
63
74
|
count: run.count,
|
|
64
|
-
...tokens ? { tokens: tokens.slice(run.start, run.start + run.count) } : {}
|
|
75
|
+
...tokens ? { tokens: tokens.slice(run.start, run.start + run.count) } : {},
|
|
76
|
+
...lineNumbers && gutter > 0 ? {
|
|
77
|
+
numbers: lineNumbers.slice(run.start, run.start + run.count).map((n) => n ?? "").join("\n"),
|
|
78
|
+
gutter
|
|
79
|
+
} : {}
|
|
65
80
|
}, run.start))
|
|
66
81
|
})
|
|
67
82
|
});
|
|
@@ -4,6 +4,10 @@ import { StreamEvent } from "zidane/chat";
|
|
|
4
4
|
export interface EditDiffBlockProps {
|
|
5
5
|
/** The edit to draw: its path, hunks and per-hunk approval outcomes. */
|
|
6
6
|
edit: NonNullable<StreamEvent['edit']>;
|
|
7
|
+
/** The call's id: with it, a diff the host cut (`edit.clipped`) offers to load the rest (`TranscriptActions.toolCall`). */
|
|
8
|
+
callId?: string;
|
|
9
|
+
/** The call's turn, a hint where the host looks first. */
|
|
10
|
+
turnId?: string;
|
|
7
11
|
/** Extra classes on the root element. */
|
|
8
12
|
className?: string;
|
|
9
13
|
/** Inline styles on the root element, merged after the component's own. */
|
|
@@ -17,4 +21,4 @@ export interface EditDiffBlockProps {
|
|
|
17
21
|
* edits with all-applied outcomes collapse back to the flat layout so
|
|
18
22
|
* the common case doesn't grow extra chrome.
|
|
19
23
|
*/
|
|
20
|
-
export declare const EditDiffBlock: import("react").MemoExoticComponent<({ edit, className, style }: EditDiffBlockProps) => import("react").JSX.Element>;
|
|
24
|
+
export declare const EditDiffBlock: import("react").MemoExoticComponent<({ edit: lean, callId, turnId, className, style }: EditDiffBlockProps) => import("react").JSX.Element>;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { CopyButton } from "../../components/CopyButton.js";
|
|
2
2
|
import { useDisplayPath } from "../../hooks/useDisplayPath.js";
|
|
3
|
+
import { useChatLabels } from "../useChatLabels.js";
|
|
3
4
|
import { DiffLines } from "./DiffLines.js";
|
|
5
|
+
import { LoadFullOutputButton, useFullToolCall } from "./tool-parts.js";
|
|
4
6
|
import { memo, useMemo } from "react";
|
|
5
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { computeLineDiff, summarizeOutcomes } from "zidane/chat/pure";
|
|
8
|
+
import { computeLineDiff, formatBytes, summarizeOutcomes } from "zidane/chat/pure";
|
|
7
9
|
// src/chat/transcript/EditDiffBlock.tsx
|
|
8
10
|
const HUNK_DIM_STYLE = { opacity: .55 };
|
|
9
11
|
const HUNK_FULL_STYLE = { opacity: 1 };
|
|
10
|
-
const HunkDiffCard = memo(({ language, index, total, lines, outcome }) => {
|
|
12
|
+
const HunkDiffCard = memo(({ language, index, total, lines, lineNumbers, outcome }) => {
|
|
11
13
|
const kind = outcome?.kind ?? "applied";
|
|
12
14
|
return /* @__PURE__ */ jsxs("div", {
|
|
13
15
|
className: "bg-[var(--zg-code-bg)]",
|
|
@@ -33,11 +35,43 @@ const HunkDiffCard = memo(({ language, index, total, lines, outcome }) => {
|
|
|
33
35
|
}), /* @__PURE__ */ jsx(DiffLines, {
|
|
34
36
|
lines,
|
|
35
37
|
maxHeight: 360,
|
|
36
|
-
language
|
|
38
|
+
language,
|
|
39
|
+
...lineNumbers ? { lineNumbers } : {}
|
|
37
40
|
})]
|
|
38
41
|
});
|
|
39
42
|
});
|
|
40
43
|
/**
|
|
44
|
+
* Each hunk's diff lines and, for a hunk the host placed in the file
|
|
45
|
+
* (`oldLine`), a line number per line: a removed line's in the old file,
|
|
46
|
+
* the others' in the new one. A `write_file`'s hunks are regions of one
|
|
47
|
+
* file, so each shifts the next one's new numbers by the lines it added or
|
|
48
|
+
* removed; an edit step's `oldLine` is in the file the earlier steps left.
|
|
49
|
+
*/
|
|
50
|
+
function hunkLines(edit) {
|
|
51
|
+
const lines = [];
|
|
52
|
+
const numbers = [];
|
|
53
|
+
let shift = 0;
|
|
54
|
+
for (const hunk of edit.hunks) {
|
|
55
|
+
const diff = computeLineDiff(hunk.oldString, hunk.newString);
|
|
56
|
+
lines.push(diff);
|
|
57
|
+
let delta = 0;
|
|
58
|
+
for (const line of diff) delta += line.op === "add" ? 1 : line.op === "remove" ? -1 : 0;
|
|
59
|
+
if (hunk.oldLine === void 0) {
|
|
60
|
+
numbers.push(void 0);
|
|
61
|
+
shift += delta;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
let oldNo = hunk.oldLine;
|
|
65
|
+
let newNo = hunk.oldLine + (edit.tool === "write_file" ? shift : 0);
|
|
66
|
+
numbers.push(diff.map((line) => line.op === "remove" ? oldNo++ : line.op === "add" ? newNo++ : (oldNo++, newNo++)));
|
|
67
|
+
shift += delta;
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
lines,
|
|
71
|
+
numbers
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
41
75
|
* Per-hunk diff renderer with approval-outcome badges. When `edit.outcomes`
|
|
42
76
|
* is set (per-edit approval landed live, or replay re-parsed it off the
|
|
43
77
|
* tool result body), each hunk gets its own card with a ✓/✕/⊘/⚠/⋯ badge;
|
|
@@ -45,45 +79,70 @@ const HunkDiffCard = memo(({ language, index, total, lines, outcome }) => {
|
|
|
45
79
|
* edits with all-applied outcomes collapse back to the flat layout so
|
|
46
80
|
* the common case doesn't grow extra chrome.
|
|
47
81
|
*/
|
|
48
|
-
const EditDiffBlock = memo(({ edit, className, style }) => {
|
|
82
|
+
const EditDiffBlock = memo(({ edit: lean, callId, turnId, className, style }) => {
|
|
83
|
+
const labels = useChatLabels();
|
|
84
|
+
const { full, load, available, ready } = useFullToolCall({
|
|
85
|
+
...callId ? { callId } : {},
|
|
86
|
+
...turnId ? { turnId } : {}
|
|
87
|
+
});
|
|
88
|
+
const edit = full !== "loading" && full?.edit ? full.edit : lean;
|
|
49
89
|
const outcomes = edit.outcomes;
|
|
50
90
|
const counts = useMemo(() => summarizeOutcomes(outcomes), [outcomes]);
|
|
51
91
|
const hunks = edit.hunks;
|
|
52
92
|
const shownPath = useDisplayPath().path(edit.path);
|
|
53
93
|
const base = edit.path.split("/").pop() ?? "";
|
|
54
94
|
const language = base.includes(".") ? base.split(".").pop().toLowerCase() : "";
|
|
55
|
-
const perHunkLines = useMemo(() =>
|
|
95
|
+
const { lines: perHunkLines, numbers: perHunkNumbers } = useMemo(() => hunkLines(edit), [edit]);
|
|
96
|
+
const flatLines = useMemo(() => perHunkLines.flat(), [perHunkLines]);
|
|
97
|
+
const flatNumbers = useMemo(() => perHunkNumbers.some(Boolean) ? perHunkNumbers.flatMap((numbers, i) => numbers ?? perHunkLines[i].map(() => null)) : void 0, [perHunkLines, perHunkNumbers]);
|
|
98
|
+
const clipped = edit.clipped;
|
|
56
99
|
const hasMixedOutcomes = outcomes != null && (counts.denied > 0 || counts.skipped > 0 || counts.failed > 0 || counts.pending > 0);
|
|
57
100
|
const usePerHunkLayout = outcomes != null && (hunks.length > 1 || hasMixedOutcomes);
|
|
58
101
|
return /* @__PURE__ */ jsxs("div", {
|
|
59
102
|
className: ["group zg-tray mt-2 rounded-zg-md overflow-hidden", className].filter(Boolean).join(" "),
|
|
60
103
|
style,
|
|
61
|
-
children: [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ jsxs("div", {
|
|
106
|
+
className: `pl-2.5 border-b border-[var(--zg-hairline)] flex items-center gap-3 text-zg-meta ${hasMixedOutcomes ? "py-1.5 pr-2.5" : "h-8 pr-1"}`,
|
|
107
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
108
|
+
className: "zg-meta text-[var(--zg-text)] truncate",
|
|
109
|
+
title: edit.path,
|
|
110
|
+
children: shownPath
|
|
111
|
+
}), hasMixedOutcomes ? /* @__PURE__ */ jsx(OutcomeSummary, { counts }) : /* @__PURE__ */ jsx(CopyButton, {
|
|
112
|
+
text: edit.path,
|
|
113
|
+
label: "Copy file path",
|
|
114
|
+
reveal: true,
|
|
115
|
+
className: "ml-auto"
|
|
116
|
+
})]
|
|
117
|
+
}),
|
|
118
|
+
usePerHunkLayout ? /* @__PURE__ */ jsx("div", {
|
|
119
|
+
className: "flex flex-col gap-px bg-[var(--zg-hairline)]",
|
|
120
|
+
children: hunks.map((_hunk, idx) => /* @__PURE__ */ jsx(HunkDiffCard, {
|
|
121
|
+
language,
|
|
122
|
+
index: idx,
|
|
123
|
+
total: hunks.length,
|
|
124
|
+
lines: perHunkLines[idx] ?? [],
|
|
125
|
+
lineNumbers: perHunkNumbers[idx],
|
|
126
|
+
outcome: outcomes?.[idx]
|
|
127
|
+
}, idx))
|
|
128
|
+
}) : /* @__PURE__ */ jsx(DiffLines, {
|
|
129
|
+
lines: flatLines,
|
|
130
|
+
maxHeight: 420,
|
|
76
131
|
language,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
132
|
+
...flatNumbers ? { lineNumbers: flatNumbers } : {}
|
|
133
|
+
}),
|
|
134
|
+
clipped && /* @__PURE__ */ jsxs("div", {
|
|
135
|
+
className: "px-2.5 py-1.5 border-t border-[var(--zg-hairline)] flex items-center gap-3 text-zg-meta text-[var(--zg-text-muted)]",
|
|
136
|
+
children: [/* @__PURE__ */ jsx("span", { children: labels.diffNotShown(clipped.hunks - hunks.length, formatBytes(clipped.bytes)) }), available && /* @__PURE__ */ jsx(LoadFullOutputButton, {
|
|
137
|
+
loading: full === "loading",
|
|
138
|
+
disabled: !ready,
|
|
139
|
+
onClick: load,
|
|
140
|
+
className: "ml-auto",
|
|
141
|
+
label: labels.loadFullDiff,
|
|
142
|
+
loadingLabel: labels.loadingFullDiff
|
|
143
|
+
})]
|
|
144
|
+
})
|
|
145
|
+
]
|
|
87
146
|
});
|
|
88
147
|
});
|
|
89
148
|
const OUTCOME_GLYPH = {
|
|
@@ -4,12 +4,14 @@ import { classifyInlineCode, resolveChipPath } from "../headless/file-chip.js";
|
|
|
4
4
|
import { useChatLabels } from "../useChatLabels.js";
|
|
5
5
|
import { useBadgeMenu } from "./BadgeMenu.js";
|
|
6
6
|
import { FileBadgeIcon, fileBadgeName } from "./badges.js";
|
|
7
|
+
import { useTokenSession } from "./chip-details.js";
|
|
7
8
|
import { useChipResolution, useResolveChipNow } from "./chip-resolve.js";
|
|
8
9
|
import { ChipHover } from "./ChipCard.js";
|
|
9
10
|
import { CommitCard } from "./ChipCards.js";
|
|
10
11
|
import { INLINE_CODE_CLASS, MarkdownContext } from "./markdown-context.js";
|
|
11
12
|
import { ReferenceChip } from "./ReferenceText.js";
|
|
12
13
|
import { classifyInlineRef, refHref } from "./remark-refs.js";
|
|
14
|
+
import { SessionChip } from "./SessionChip.js";
|
|
13
15
|
import { useContext, useRef, useState } from "react";
|
|
14
16
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
15
17
|
import { GITHUB_ISSUE_PROVIDER_ID, GITHUB_PULL_PROVIDER_ID, githubRefKey } from "zidane/chat/pure";
|
|
@@ -20,6 +22,8 @@ function useChipMenu(target) {
|
|
|
20
22
|
const { cwd } = useContext(MarkdownContext);
|
|
21
23
|
return open && target ? (e) => open(e, target, cwd) : void 0;
|
|
22
24
|
}
|
|
25
|
+
/** A full session id (a UUID). */
|
|
26
|
+
const SESSION_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
23
27
|
/** Prose chips are the shared inline badge (the `zg-badge` class); `zg-file-chip` marks them. */
|
|
24
28
|
const CHIP_CLASS = "zg-file-chip zg-badge";
|
|
25
29
|
/** An issue or PR link on GitHub: `owner` / `repo` / `pull` or `issues` / number. */
|
|
@@ -128,6 +132,10 @@ function displayPath(abs, cwd) {
|
|
|
128
132
|
function InlineCode({ text }) {
|
|
129
133
|
const { host } = useContext(MarkdownContext);
|
|
130
134
|
const ref = classifyInlineRef(text);
|
|
135
|
+
if ((ref?.kind === "sha" || SESSION_ID.test(text.trim())) && !host) return /* @__PURE__ */ jsx(IdOrCommit, {
|
|
136
|
+
text,
|
|
137
|
+
commit: ref?.kind === "sha" ? ref : null
|
|
138
|
+
});
|
|
131
139
|
if (ref) return /* @__PURE__ */ jsx(RefChip, {
|
|
132
140
|
parsed: ref,
|
|
133
141
|
label: text.trim()
|
|
@@ -148,6 +156,26 @@ function InlineCode({ text }) {
|
|
|
148
156
|
children: text
|
|
149
157
|
});
|
|
150
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Inline code that may be a session's id: the session's chip when one matches it (an answer naming a chat by id,
|
|
161
|
+
* as `3f5cf5fc`), else the commit chip a sha gets, else code. Code while the sessions are read: never a commit
|
|
162
|
+
* that turns into a chat.
|
|
163
|
+
*/
|
|
164
|
+
function IdOrCommit({ text, commit }) {
|
|
165
|
+
const { session, loading, listed } = useTokenSession(text.trim());
|
|
166
|
+
if (session) return /* @__PURE__ */ jsx(SessionChip, { token: text.trim() });
|
|
167
|
+
if (listed && loading) return /* @__PURE__ */ jsx("code", {
|
|
168
|
+
className: INLINE_CODE_CLASS,
|
|
169
|
+
children: text
|
|
170
|
+
});
|
|
171
|
+
return commit ? /* @__PURE__ */ jsx(RefChip, {
|
|
172
|
+
parsed: commit,
|
|
173
|
+
label: text.trim()
|
|
174
|
+
}) : /* @__PURE__ */ jsx("code", {
|
|
175
|
+
className: INLINE_CODE_CLASS,
|
|
176
|
+
children: text
|
|
177
|
+
});
|
|
178
|
+
}
|
|
151
179
|
/** Could `text` name a branch (`main`, `feat/x`, `origin/main`): the characters branch names use, not a number. */
|
|
152
180
|
function branchShaped(text) {
|
|
153
181
|
const t = text.trim();
|
|
@@ -1,43 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The wrappers of transcript rows, and what the active searches hold mounted.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* its
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* an empty box at its estimated height; once mounted it stays mounted
|
|
10
|
-
* (expanded state, selection and the browser's remembered size survive).
|
|
4
|
+
* A root row renders through `LazyRow`: a placeholder at the row's height
|
|
5
|
+
* until it nears the view, then its content, for good (`row-mount.ts`: the
|
|
6
|
+
* mounter of its transcript decides, and parks far rows only past a budget
|
|
7
|
+
* while the reader is idle). What the reader did to a row lives in
|
|
8
|
+
* `useRowUiState`, so a parked row comes back as it was left.
|
|
11
9
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* Two distances. Rows entering the far margin queue up, and each frame
|
|
19
|
-
* mounts the nearest until `BUDGET_MS` is spent: a flick that brings twenty
|
|
20
|
-
* rows into the margin spreads them over a few frames. Rows within a
|
|
21
|
-
* viewport of the view mount at once, whatever the budget: a row must never
|
|
22
|
-
* reach the screen as a blank placeholder, nor change height in view (the
|
|
23
|
-
* view would reflow under the reader). Rows mounted from the queue tell
|
|
24
|
-
* their content (`useBackgroundMount`) so long text may reveal over a few
|
|
25
|
-
* frames; rows mounted near the view render whole.
|
|
10
|
+
* Rows mounted ahead of the view (`useBackgroundMount`) may reveal long
|
|
11
|
+
* text over a few frames; rows mounted near the view render whole. A row
|
|
12
|
+
* that mounts because the reader scrolled to it, or with the conversation, is
|
|
13
|
+
* quiet: no enter animation. Only a row new at the end of the transcript (its
|
|
14
|
+
* tail) plays it.
|
|
26
15
|
*/
|
|
27
16
|
import { CSSProperties, ReactNode } from "react";
|
|
17
|
+
/** What the active searches want mounted: every row, or the rows holding any of these needles (lowercased). */
|
|
18
|
+
export interface ForcedRows {
|
|
19
|
+
/** Every row (a hold with no needles). */
|
|
20
|
+
all: boolean;
|
|
21
|
+
/** The needles of the holds that named some. */
|
|
22
|
+
needles: readonly string[];
|
|
23
|
+
}
|
|
28
24
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* it outside React's render and effects: it commits synchronously.
|
|
25
|
+
* Holds rows mounted while a search is active: the rows whose text holds one
|
|
26
|
+
* of `needles` (lowercased), or every row without them. The transcript mounts
|
|
27
|
+
* them wherever they are, so a walk of the DOM finds their text. Returns the release.
|
|
33
28
|
*
|
|
34
|
-
* @param
|
|
29
|
+
* @param needles - What the search looks for, lowercased; absent, every row.
|
|
35
30
|
*/
|
|
36
|
-
export declare function
|
|
37
|
-
/**
|
|
38
|
-
export declare function holdForceMountRows(): () => void;
|
|
39
|
-
/** Returns whether every lazy row must be mounted now, for example while a search needle is active. */
|
|
31
|
+
export declare function holdForceMountRows(needles?: readonly string[]): () => void;
|
|
32
|
+
/** Returns whether a search holds rows mounted now (rows then render whole: no reveal over frames, groups open). */
|
|
40
33
|
export declare function useForceMountRows(): boolean;
|
|
34
|
+
/** What the active searches hold mounted ({@link holdForceMountRows}); a new object on every change. */
|
|
35
|
+
export declare function useForcedRows(): ForcedRows;
|
|
41
36
|
/**
|
|
42
37
|
* True while the transcript is first painting a conversation (switching to
|
|
43
38
|
* it, or its history landing). Rows mounted then were already there: they
|
|
@@ -69,26 +64,31 @@ export declare function CvRow({ style, children, className, ...rest }: CvRowProp
|
|
|
69
64
|
export declare function useBackgroundMount(): boolean;
|
|
70
65
|
/** Props for {@link LazyRow}. */
|
|
71
66
|
export interface LazyRowProps {
|
|
72
|
-
/**
|
|
73
|
-
'
|
|
74
|
-
/**
|
|
67
|
+
/** The root item's key: the row's id, or a worker block's. */
|
|
68
|
+
'itemKey': string;
|
|
69
|
+
/** The placeholder's height before the row was ever measured (px). */
|
|
75
70
|
'estimatePx': number;
|
|
76
71
|
/** Inline style for the row's wrapper, usually its content-visibility sizing. */
|
|
77
|
-
'style'
|
|
72
|
+
'style'?: CSSProperties;
|
|
78
73
|
/** The row's content. */
|
|
79
74
|
'children': ReactNode;
|
|
75
|
+
/** A plain box (a worker's block): no content-visibility, no row id on the wrapper. */
|
|
76
|
+
'box'?: boolean;
|
|
77
|
+
/** The row's id (`Row.id`): how a view that left the transcript finds its place again (`useStickToBottom`'s `restorePosition`). */
|
|
78
|
+
'data-row'?: string;
|
|
80
79
|
/** The select-turn stop the row belongs to. Set only in select mode; makes the row a hover and click target. */
|
|
81
80
|
'data-stop'?: string;
|
|
82
81
|
/** Marks the row as part of the selected stop, so the select cursor can find it. */
|
|
83
82
|
'data-sel'?: string;
|
|
84
|
-
/**
|
|
85
|
-
'data-
|
|
83
|
+
/** A user's prompt: what an app's scrollback fill and the media gallery count (mounted or not). */
|
|
84
|
+
'data-prompt'?: string;
|
|
86
85
|
/** Extra classes on the root element. */
|
|
87
86
|
'className'?: string;
|
|
88
87
|
}
|
|
89
88
|
/**
|
|
90
|
-
* Renders a transcript row that mounts its content
|
|
89
|
+
* Renders a root transcript row that mounts its content when it nears the view, and keeps it: until then (and
|
|
90
|
+
* parked) an empty box of the row's height, its last measured height when known, without `content-visibility`.
|
|
91
91
|
*
|
|
92
|
-
* @param props - Row props: `
|
|
92
|
+
* @param props - Row props: `itemKey`, `estimatePx`, `style`, `children`, the row's id and the select-mode data attributes.
|
|
93
93
|
*/
|
|
94
|
-
export declare function LazyRow({
|
|
94
|
+
export declare function LazyRow({ itemKey, estimatePx, style, children, className, box, ...rest }: LazyRowProps): import("react").JSX.Element;
|