zidane-ui 9.2.2 → 9.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/browser-keybindings-host.js +3 -1
- package/dist/adapters/live.d.ts +6 -0
- package/dist/adapters/live.js +16 -8
- package/dist/adapters/server-composer-host.js +22 -9
- package/dist/adapters/server-host.js +143 -18
- package/dist/adapters/server-media.d.ts +9 -1
- package/dist/adapters/server-media.js +14 -1
- package/dist/adapters/server-settings-host.js +30 -3
- package/dist/adapters/server-settings-sections.js +23 -1
- package/dist/adapters/server-sidebar-host.d.ts +3 -1
- package/dist/adapters/server-sidebar-host.js +10 -1
- package/dist/app/ModalProvider.js +1 -1
- package/dist/approvals/ApprovalShell.js +1 -1
- package/dist/chat/DaemonOrb.d.ts +29 -1
- package/dist/chat/DaemonOrb.js +25 -12
- package/dist/chat/HostTranscript.d.ts +0 -12
- package/dist/chat/HostTranscript.js +6 -1
- package/dist/chat/SessionStreamsProvider.d.ts +8 -0
- package/dist/chat/SessionStreamsProvider.js +11 -2
- package/dist/chat/StatusDot.js +8 -2
- package/dist/chat/Transcript.d.ts +20 -11
- package/dist/chat/Transcript.js +335 -162
- package/dist/chat/composer/ComposerEditor.js +1 -1
- package/dist/chat/headless/host.d.ts +43 -7
- package/dist/chat/headless/index.d.ts +8 -6
- package/dist/chat/headless/index.js +11 -9
- package/dist/chat/headless/labels.d.ts +30 -0
- package/dist/chat/headless/labels.js +29 -0
- package/dist/chat/headless/markdown-chunks.d.ts +2 -1
- package/dist/chat/headless/markdown-chunks.js +12 -20
- package/dist/chat/headless/markdown-scan.d.ts +66 -0
- package/dist/chat/headless/markdown-scan.js +124 -0
- package/dist/chat/headless/markdown-stream.d.ts +64 -0
- package/dist/chat/headless/markdown-stream.js +143 -0
- package/dist/chat/headless/output-pager.d.ts +68 -0
- package/dist/chat/headless/output-pager.js +113 -0
- package/dist/chat/headless/session-list.d.ts +20 -0
- package/dist/chat/headless/sidebar/activity.d.ts +14 -0
- package/dist/chat/headless/sidebar/activity.js +32 -0
- package/dist/chat/headless/sidebar/directory.d.ts +17 -2
- package/dist/chat/headless/sidebar/directory.js +50 -54
- package/dist/chat/headless/sidebar/environment.d.ts +5 -2
- package/dist/chat/headless/sidebar/environment.js +11 -2
- package/dist/chat/headless/sidebar/host.d.ts +15 -0
- package/dist/chat/headless/sidebar/inbox.d.ts +12 -3
- package/dist/chat/headless/sidebar/inbox.js +18 -9
- package/dist/chat/headless/sidebar/index.d.ts +2 -2
- package/dist/chat/headless/sidebar/index.js +2 -2
- package/dist/chat/headless/sidebar/labels.d.ts +38 -2
- package/dist/chat/headless/sidebar/labels.js +16 -0
- package/dist/chat/headless/sidebar/prewarm.d.ts +68 -0
- package/dist/chat/headless/sidebar/prewarm.js +114 -0
- package/dist/chat/headless/streams/actions.d.ts +2 -0
- package/dist/chat/headless/streams/actions.js +1 -0
- package/dist/chat/headless/streams/event-bytes.d.ts +6 -0
- package/dist/chat/headless/streams/event-bytes.js +34 -0
- package/dist/chat/headless/streams/live-events.d.ts +25 -1
- package/dist/chat/headless/streams/live-events.js +53 -2
- package/dist/chat/headless/streams/selectors.d.ts +3 -0
- package/dist/chat/headless/streams/selectors.js +8 -1
- package/dist/chat/headless/streams/session-streams.d.ts +15 -3
- package/dist/chat/headless/streams/session-streams.js +31 -3
- package/dist/chat/headless/streams/store.d.ts +24 -1
- package/dist/chat/headless/streams/store.js +51 -26
- package/dist/chat/headless/streams/transcript-map.d.ts +57 -0
- package/dist/chat/headless/streams/transcript-map.js +88 -0
- package/dist/chat/headless/streams/transcript.d.ts +4 -2
- package/dist/chat/headless/streams/transcript.js +19 -7
- package/dist/chat/headless/transcript/batch.js +5 -1
- package/dist/chat/headless/transcript/blob-media.d.ts +15 -0
- package/dist/chat/headless/transcript/blob-media.js +23 -0
- package/dist/chat/headless/transcript/collapse.d.ts +10 -0
- package/dist/chat/headless/transcript/collapse.js +32 -6
- package/dist/chat/headless/transcript/derive.d.ts +98 -0
- package/dist/chat/headless/transcript/derive.js +89 -0
- package/dist/chat/headless/transcript/exchange-media.d.ts +3 -1
- package/dist/chat/headless/transcript/exchange-media.js +8 -5
- package/dist/chat/headless/transcript/fold-actions.d.ts +8 -3
- package/dist/chat/headless/transcript/fold-actions.js +16 -0
- package/dist/chat/headless/transcript/fold-attachments.d.ts +2 -0
- package/dist/chat/headless/transcript/fold-attachments.js +3 -2
- package/dist/chat/headless/transcript/fold.d.ts +4 -2
- package/dist/chat/headless/transcript/fold.js +37 -7
- package/dist/chat/headless/transcript/incremental.d.ts +53 -0
- package/dist/chat/headless/transcript/incremental.js +181 -0
- package/dist/chat/headless/transcript/index.d.ts +2 -1
- package/dist/chat/headless/transcript/index.js +2 -1
- package/dist/chat/headless/transcript/nesting.js +2 -1
- package/dist/chat/headless/transcript/rail.d.ts +142 -0
- package/dist/chat/headless/transcript/rail.js +290 -0
- package/dist/chat/headless/transcript/rows.d.ts +11 -1
- package/dist/chat/headless/transcript/run-failures.d.ts +4 -0
- package/dist/chat/headless/transcript/run-failures.js +31 -2
- package/dist/chat/headless/transcript/seams.d.ts +78 -0
- package/dist/chat/headless/transcript/seams.js +116 -0
- package/dist/chat/headless/transcript/tool-media.d.ts +6 -7
- package/dist/chat/headless/transcript/tool-media.js +27 -9
- package/dist/chat/headless/transcript-labels.d.ts +1 -0
- package/dist/chat/headless/turn-labels.d.ts +1 -0
- package/dist/chat/headless/turn-labels.js +2 -1
- package/dist/chat/index.d.ts +10 -8
- package/dist/chat/index.js +9 -7
- package/dist/chat/interactions/ElicitationCard.js +1 -1
- package/dist/chat/interactions/InteractionCard.js +1 -1
- package/dist/chat/interactions/PlanCard.js +3 -3
- package/dist/chat/interactions/QuestionField.js +4 -4
- package/dist/chat/interactions/QuestionForm.js +3 -3
- package/dist/chat/interactions/SecretInput.js +1 -1
- package/dist/chat/sidebar/ProjectIcon.d.ts +1 -1
- package/dist/chat/sidebar/ProjectIcon.js +1 -1
- package/dist/chat/sidebar/RowChips.d.ts +3 -2
- package/dist/chat/sidebar/RowChips.js +6 -3
- package/dist/chat/sidebar/SessionSidebar.js +13 -14
- package/dist/chat/sidebar/SidebarFooter.d.ts +8 -5
- package/dist/chat/sidebar/SidebarFooter.js +6 -6
- package/dist/chat/sidebar/SidebarFrame.d.ts +2 -0
- package/dist/chat/sidebar/SidebarFrame.js +5 -2
- package/dist/chat/sidebar/SidebarSessionRow.d.ts +3 -1
- package/dist/chat/sidebar/SidebarSessionRow.js +3 -1
- package/dist/chat/sidebar/SpacesSection.d.ts +20 -1
- package/dist/chat/sidebar/SpacesSection.js +34 -13
- package/dist/chat/sidebar/index.d.ts +2 -2
- package/dist/chat/sidebar/session-menu.d.ts +11 -2
- package/dist/chat/sidebar/session-menu.js +50 -5
- package/dist/chat/sidebar/sidebar-live.js +1 -1
- package/dist/chat/sidebar/useInboxRows.js +43 -2
- package/dist/chat/sidebar/useInboxTriage.js +19 -14
- package/dist/chat/testing/contract.d.ts +5 -3
- package/dist/chat/testing/contract.js +66 -1
- package/dist/chat/testing/fixture-sidebar-host.d.ts +7 -1
- package/dist/chat/testing/fixture-sidebar-host.js +12 -0
- package/dist/chat/testing/sidebar.contract.d.ts +6 -0
- package/dist/chat/testing/sidebar.contract.js +24 -0
- package/dist/chat/transcript/DiffLines.d.ts +6 -1
- package/dist/chat/transcript/DiffLines.js +35 -20
- package/dist/chat/transcript/EditDiffBlock.d.ts +5 -1
- package/dist/chat/transcript/EditDiffBlock.js +89 -30
- package/dist/chat/transcript/InteractionToolBody.js +1 -1
- package/dist/chat/transcript/LazyRow.d.ts +40 -40
- package/dist/chat/transcript/LazyRow.js +101 -149
- package/dist/chat/transcript/MermaidDiagram.js +2 -1
- package/dist/chat/transcript/SelectCursor.d.ts +11 -1
- package/dist/chat/transcript/SelectCursor.js +10 -5
- package/dist/chat/transcript/SubagentBlock.js +3 -2
- package/dist/chat/transcript/TranscriptRail.d.ts +109 -0
- package/dist/chat/transcript/TranscriptRail.js +579 -0
- package/dist/chat/transcript/TranscriptRow.d.ts +4 -7
- package/dist/chat/transcript/TranscriptRow.js +9 -5
- package/dist/chat/transcript/actions.d.ts +43 -3
- package/dist/chat/transcript/actions.js +27 -1
- package/dist/chat/transcript/clipped-output.d.ts +58 -0
- package/dist/chat/transcript/clipped-output.js +131 -0
- package/dist/chat/transcript/fold-attachments.js +10 -5
- package/dist/chat/transcript/fold-worker.js +3 -2
- package/dist/chat/transcript/fold.js +21 -2
- package/dist/chat/transcript/index.d.ts +11 -9
- package/dist/chat/transcript/index.js +10 -8
- package/dist/chat/transcript/markdown-cache.d.ts +7 -1
- package/dist/chat/transcript/markdown-cache.js +12 -1
- package/dist/chat/transcript/markdown.js +116 -54
- package/dist/chat/transcript/media-gallery.d.ts +3 -2
- package/dist/chat/transcript/media-gallery.js +10 -7
- package/dist/chat/transcript/notices.d.ts +23 -1
- package/dist/chat/transcript/notices.js +110 -28
- package/dist/chat/transcript/prompt.js +6 -4
- package/dist/chat/transcript/prose.js +3 -1
- package/dist/chat/transcript/receipt-parts.d.ts +22 -0
- package/dist/chat/transcript/receipt-parts.js +87 -0
- package/dist/chat/transcript/root-items.d.ts +96 -0
- package/dist/chat/transcript/root-items.js +180 -0
- package/dist/chat/transcript/row-mount.d.ts +165 -0
- package/dist/chat/transcript/row-mount.js +498 -0
- package/dist/chat/transcript/row-parking.d.ts +125 -0
- package/dist/chat/transcript/row-parking.js +135 -0
- package/dist/chat/transcript/row-ui-state.d.ts +37 -0
- package/dist/chat/transcript/row-ui-state.js +53 -0
- package/dist/chat/transcript/run-rows.js +6 -78
- package/dist/chat/transcript/script-input.d.ts +1 -1
- package/dist/chat/transcript/scroll-clamp.js +1 -1
- package/dist/chat/transcript/tasks.js +3 -2
- package/dist/chat/transcript/tool-media.d.ts +4 -2
- package/dist/chat/transcript/tool-media.js +15 -7
- package/dist/chat/transcript/tool-parts.d.ts +27 -4
- package/dist/chat/transcript/tool-parts.js +31 -5
- package/dist/chat/transcript/tool-payload.js +26 -11
- package/dist/chat/transcript/tool-row.d.ts +2 -1
- package/dist/chat/transcript/tool-row.js +38 -19
- package/dist/chat/transcript/use-transcript-rows.d.ts +24 -7
- package/dist/chat/transcript/use-transcript-rows.js +28 -46
- package/dist/chat/transcript/useSettledReveal.js +15 -3
- package/dist/chat/transcript/useStickToBottom.js +4 -4
- package/dist/chat/transcript/useTranscriptSearch.js +30 -14
- package/dist/chat/transcript/view-scope.d.ts +26 -6
- package/dist/chat/transcript/view-scope.js +106 -20
- package/dist/components/ChoiceCards.js +1 -1
- package/dist/components/ConfirmDialog.js +1 -1
- package/dist/components/CopyValue.d.ts +33 -0
- package/dist/components/CopyValue.js +54 -0
- package/dist/components/Form.js +1 -1
- package/dist/components/HowItWorks.js +1 -1
- package/dist/components/Menu.js +1 -1
- package/dist/components/StepFrame.js +2 -2
- package/dist/components/SwatchPicker.js +1 -1
- package/dist/components/ToggleCard.js +1 -1
- package/dist/components/floating/HoverCard.js +2 -3
- package/dist/components/floating/hover-delay.d.ts +4 -0
- package/dist/components/floating/hover-delay.js +6 -0
- package/dist/core.css +14 -12
- package/dist/dist/{index-Betz0OWq.d.ts → index-C6-t1SS9.d.ts} +21 -2
- package/dist/dist/index-De9AbmxS.d.ts +1 -0
- package/dist/dist/index.d.ts +5 -5
- package/dist/dist/sandbox-CSUihARm.d.ts +2 -0
- package/dist/dist/{timeout-CyU7HLyz.d.ts → timeout-CmTx6V9y.d.ts} +1 -0
- package/dist/extensions/ExtensionDialogHost.js +1 -1
- package/dist/files/TreeColumn.js +3 -1
- package/dist/files/headless/host.d.ts +2 -2
- package/dist/git/ImportRepoDialog.js +1 -1
- package/dist/git/MoveSessionDialog.js +2 -2
- package/dist/git/SandboxManager.d.ts +42 -0
- package/dist/git/SandboxManager.js +297 -0
- package/dist/git/SyncChip.js +1 -1
- package/dist/git/headless/index.d.ts +2 -1
- package/dist/git/headless/index.js +2 -1
- package/dist/git/headless/labels.d.ts +29 -0
- package/dist/git/headless/labels.js +34 -1
- package/dist/git/headless/sandboxes.d.ts +43 -0
- package/dist/git/headless/sandboxes.js +52 -0
- package/dist/git/index.d.ts +2 -1
- package/dist/git/index.js +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/keybindings/headless/catalog.d.ts +1 -1
- package/dist/keybindings/headless/catalog.js +12 -0
- package/dist/machines/HostsSection.d.ts +1 -1
- package/dist/machines/headless/labels.js +2 -2
- package/dist/motion/flip-list.js +3 -10
- package/dist/motion/presence.d.ts +10 -0
- package/dist/motion/presence.js +20 -1
- package/dist/motion/swap.d.ts +8 -2
- package/dist/motion/swap.js +5 -2
- package/dist/onboarding/conversation.js +27 -15
- package/dist/onboarding/demos/how-it-works.js +1 -1
- package/dist/onboarding/skills/parts.js +4 -4
- package/dist/onboarding/sources/SourceBrowser.js +1 -1
- package/dist/onboarding/steps/ReadyStep.js +1 -1
- package/dist/onboarding/steps/connect/KeyForm.js +1 -1
- package/dist/palette/headless/app-sources.js +20 -0
- package/dist/palette/headless/labels.js +2 -0
- package/dist/session/PlanTracker.js +3 -3
- package/dist/session/SecretsPanel.js +1 -1
- package/dist/session/SessionHeader.d.ts +18 -6
- package/dist/session/SessionHeader.js +68 -12
- package/dist/session/SessionPlaceMenu.d.ts +35 -0
- package/dist/session/SessionPlaceMenu.js +299 -0
- package/dist/session/SessionShell.js +1 -1
- package/dist/session/TurnDetailsDialog.js +1 -1
- package/dist/session/headless/index.d.ts +2 -1
- package/dist/session/headless/index.js +2 -1
- package/dist/session/headless/labels.d.ts +73 -0
- package/dist/session/headless/labels.js +73 -0
- package/dist/session/headless/place.d.ts +49 -0
- package/dist/session/headless/place.js +57 -0
- package/dist/session/index.d.ts +2 -1
- package/dist/session/index.js +2 -1
- package/dist/settings/ConversationPresetsCard.js +1 -1
- package/dist/settings/SettingCard.js +2 -2
- package/dist/settings/SettingsRowsPage.js +1 -1
- package/dist/settings/headless/fixture-performance.js +4 -2
- package/dist/settings/headless/fixture-sections.js +7 -0
- package/dist/settings/headless/labels.d.ts +1 -1
- package/dist/settings/headless/labels.js +1 -1
- package/dist/settings/headless/layout.d.ts +4 -4
- package/dist/settings/headless/layout.js +1 -1
- package/dist/settings/headless/performance.d.ts +4 -0
- package/dist/settings/headless/search.d.ts +2 -2
- package/dist/settings/headless/sections-host.d.ts +20 -2
- package/dist/settings/sections/claude-import/ClaudeImportDialog.js +1 -1
- package/dist/settings/sections/enabled-list/EnabledListSection.js +2 -2
- package/dist/settings/sections/environments/EnvironmentsSection.d.ts +9 -3
- package/dist/settings/sections/environments/EnvironmentsSection.js +292 -52
- package/dist/settings/sections/environments/labels.d.ts +15 -0
- package/dist/settings/sections/environments/labels.js +18 -3
- package/dist/settings/sections/extensions/ChangeOriginDialog.js +1 -1
- package/dist/settings/sections/extensions/ExtensionSourceBrowser.js +1 -1
- package/dist/settings/sections/extensions/ExtensionsSection.d.ts +3 -2
- package/dist/settings/sections/extensions/ExtensionsSection.js +9 -3
- package/dist/settings/sections/host-catalog/HostCatalogSection.js +15 -5
- package/dist/settings/sections/keybindings/labels.d.ts +2 -0
- package/dist/settings/sections/keybindings/labels.js +2 -0
- package/dist/settings/sections/keybindings/rows.js +8 -0
- package/dist/settings/sections/models/SpacesDefaultsSection.d.ts +7 -3
- package/dist/settings/sections/models/SpacesDefaultsSection.js +11 -5
- package/dist/settings/sections/performance/PerformanceSection.js +8 -1
- package/dist/settings/sections/performance/labels.d.ts +2 -0
- package/dist/settings/sections/performance/labels.js +2 -0
- package/dist/settings/sections/skills/SkillGroups.js +1 -1
- package/dist/settings/server-app.d.ts +4 -2
- package/dist/settings/server-app.js +7 -3
- package/dist/settings/testing/sections.contract.d.ts +7 -1
- package/dist/settings/testing/sections.contract.js +37 -0
- package/dist/styles.css +243 -19
- package/dist/terminal/TerminalDrawer.js +3 -1
- package/dist/views/headless/answers.d.ts +8 -2
- package/dist/views/headless/answers.js +58 -1
- package/dist/views/headless/placement.d.ts +78 -0
- package/dist/views/headless/placement.js +154 -44
- package/dist/workspace/SidePanel.js +3 -1
- package/package.json +2 -2
- package/src/styles/base.css +13 -0
- package/src/styles/chat.css +30 -0
- package/src/styles/components.css +0 -10
- package/src/styles/files.css +5 -0
- package/src/styles/sidebar.css +29 -7
- package/src/styles/terminal.css +6 -0
- package/src/styles/tokens.css +5 -0
- package/src/styles/transcript.css +138 -0
- package/src/styles/workspace.css +6 -0
- package/dist/dist/index-QcFzZlao.d.ts +0 -1
- package/dist/dist/sandbox-D0zsW8I1.d.ts +0 -2
- /package/dist/dist/{types-_Dtoq_No.d.ts → execution-failure-SREfl-EZ.d.ts} +0 -0
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const MAX_CHARS = 4e5;
|
|
4
4
|
const entries = /* @__PURE__ */ new Map();
|
|
5
5
|
let chars = 0;
|
|
6
|
+
let inserts = 0;
|
|
6
7
|
const ids = /* @__PURE__ */ new WeakMap();
|
|
7
8
|
let nextId = 1;
|
|
8
9
|
function idOf(value) {
|
|
@@ -37,6 +38,7 @@ function cachedMarkdown(text, key, parse) {
|
|
|
37
38
|
chars -= hit.text.length;
|
|
38
39
|
}
|
|
39
40
|
const element = parse();
|
|
41
|
+
inserts++;
|
|
40
42
|
entries.set(id, {
|
|
41
43
|
element,
|
|
42
44
|
text
|
|
@@ -53,5 +55,14 @@ function cachedMarkdown(text, key, parse) {
|
|
|
53
55
|
function clearMarkdownCache() {
|
|
54
56
|
entries.clear();
|
|
55
57
|
chars = 0;
|
|
58
|
+
inserts = 0;
|
|
56
59
|
}
|
|
57
|
-
|
|
60
|
+
/** What the cache holds, and how many parses it took in since it was last emptied (tests, benches). */
|
|
61
|
+
function markdownCacheStats() {
|
|
62
|
+
return {
|
|
63
|
+
entries: entries.size,
|
|
64
|
+
chars,
|
|
65
|
+
inserts
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export { cachedMarkdown, clearMarkdownCache, markdownCacheStats };
|
|
@@ -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
10
|
import { cachedMarkdown } 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, useRef, 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,55 @@ const documentComponents = {
|
|
|
246
247
|
em: ({ children }) => /* @__PURE__ */ jsx("em", { children })
|
|
247
248
|
};
|
|
248
249
|
const REMARK_PLUGINS = [remarkGfm];
|
|
249
|
-
|
|
250
|
-
document
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
250
|
+
function sameParseKey(a, b) {
|
|
251
|
+
return a.document === b.document && a.plugins === b.plugins && a.urlTransform === b.urlTransform;
|
|
252
|
+
}
|
|
253
|
+
const MarkdownChunk = memo(({ text, document, plugins, urlTransform, live = false }) => {
|
|
254
|
+
const key = {
|
|
255
|
+
document: Boolean(document),
|
|
256
|
+
plugins: plugins ?? void 0,
|
|
257
|
+
urlTransform
|
|
258
|
+
};
|
|
259
|
+
const last = useRef(null);
|
|
260
|
+
const parse = () => ReactMarkdown({
|
|
261
|
+
remarkPlugins: plugins,
|
|
262
|
+
components: document ? documentComponents : components,
|
|
263
|
+
...urlTransform ? { urlTransform } : {},
|
|
264
|
+
children: text
|
|
265
|
+
});
|
|
266
|
+
const held = last.current;
|
|
267
|
+
const element = live ? parse() : cachedMarkdown(text, key, () => held && held.text === text && sameParseKey(held.key, key) ? held.element : parse());
|
|
268
|
+
last.current = {
|
|
269
|
+
text,
|
|
270
|
+
key,
|
|
271
|
+
element
|
|
272
|
+
};
|
|
273
|
+
return element;
|
|
274
|
+
});
|
|
275
|
+
/** One chunk: its parse, in its view fences' scope with views on. */
|
|
276
|
+
function ChunkPart({ text, fences, document, plugins, urlTransform, live = false }) {
|
|
277
|
+
const parsed = /* @__PURE__ */ jsx(MarkdownChunk, {
|
|
278
|
+
text,
|
|
279
|
+
document,
|
|
280
|
+
plugins,
|
|
281
|
+
urlTransform,
|
|
282
|
+
live
|
|
283
|
+
});
|
|
284
|
+
return fences ? /* @__PURE__ */ jsx(ChunkFencesScope, {
|
|
285
|
+
base: fences.base,
|
|
286
|
+
starts: fences.starts,
|
|
287
|
+
children: parsed
|
|
288
|
+
}) : parsed;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* The chunks that no longer change, as siblings in the prose box. It renders again only when one more closes (the
|
|
292
|
+
* stream keeps the array until then), so a frame of a long streaming reply reconciles its tail, not every chunk.
|
|
293
|
+
*/
|
|
294
|
+
const SettledChunks = memo(({ chunks, count, fences, ...rest }) => /* @__PURE__ */ jsx(Fragment$1, { children: chunks.slice(0, count).map((chunk, i) => /* @__PURE__ */ jsx(ChunkPart, {
|
|
295
|
+
text: chunk,
|
|
296
|
+
fences: fences?.[i],
|
|
297
|
+
...rest
|
|
298
|
+
}, i)) }));
|
|
259
299
|
/** Chunks rendered in a long text's first commit, then per frame until all are in. */
|
|
260
300
|
const CHUNKS_PER_FRAME = 2;
|
|
261
301
|
/**
|
|
@@ -270,16 +310,35 @@ const CHUNKS_PER_FRAME = 2;
|
|
|
270
310
|
* @param props - The {@link MarkdownProps}.
|
|
271
311
|
*/
|
|
272
312
|
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;
|
|
313
|
+
const stream = useRef(null);
|
|
314
|
+
if (streaming) stream.current ??= new MarkdownStream();
|
|
276
315
|
const views = useViewsEnabled();
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
316
|
+
const { closed, tail, fence } = useMemo(() => {
|
|
317
|
+
if (!stream.current) {
|
|
318
|
+
const chunks = splitMarkdown(children);
|
|
319
|
+
return {
|
|
320
|
+
closed: chunks.slice(0, -1),
|
|
321
|
+
tail: chunks.at(-1),
|
|
322
|
+
fence: null
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
return stream.current.frame(children, streaming);
|
|
326
|
+
}, [children, streaming]);
|
|
327
|
+
const fencesMemo = useRef(null);
|
|
328
|
+
const closedFences = useMemo(() => {
|
|
329
|
+
if (!views) return null;
|
|
330
|
+
const fences = chunkFencesFor(closed, fencesMemo.current);
|
|
331
|
+
fencesMemo.current = {
|
|
332
|
+
chunks: closed,
|
|
333
|
+
fences
|
|
334
|
+
};
|
|
335
|
+
return fences;
|
|
336
|
+
}, [closed, views]);
|
|
337
|
+
const lastFences = closedFences?.at(-1);
|
|
338
|
+
const tailFences = views ? {
|
|
339
|
+
base: lastFences ? lastFences.base + lastFences.starts.length : 0,
|
|
340
|
+
starts: viewFenceStarts(tail)
|
|
341
|
+
} : null;
|
|
283
342
|
const parts = useMemo(() => ({
|
|
284
343
|
CodeBlock,
|
|
285
344
|
Link,
|
|
@@ -291,16 +350,16 @@ const Markdown = memo(({ children, className, style, document, streaming = false
|
|
|
291
350
|
InlineCode,
|
|
292
351
|
Image
|
|
293
352
|
]);
|
|
294
|
-
const tail = streaming ? openFenceOf(chunks[chunks.length - 1]) : null;
|
|
295
353
|
const searching = useForceMountRows();
|
|
296
354
|
const renderers = useExtensionItems("renderer");
|
|
297
355
|
const diagrams = useContext(DiagramsContext) && !claimsLanguage(renderers, "mermaid");
|
|
298
|
-
if (views && streaming && mayHoldViewFence(
|
|
356
|
+
if (views && streaming && mayHoldViewFence(tail) && !claimsLanguage(renderers, "view")) preloadViews();
|
|
299
357
|
const background = useBackgroundMount();
|
|
300
358
|
const [shown, setShown] = useState(CHUNKS_PER_FRAME);
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
359
|
+
const total = closed.length + 1;
|
|
360
|
+
const complete = useRef(!background || total <= CHUNKS_PER_FRAME);
|
|
361
|
+
if (searching || shown >= total) complete.current = true;
|
|
362
|
+
const visible = complete.current ? total : shown;
|
|
304
363
|
useEffect(() => {
|
|
305
364
|
if (complete.current) return void 0;
|
|
306
365
|
let timer = 0;
|
|
@@ -312,38 +371,41 @@ const Markdown = memo(({ children, className, style, document, streaming = false
|
|
|
312
371
|
window.clearTimeout(timer);
|
|
313
372
|
};
|
|
314
373
|
}, [visible]);
|
|
374
|
+
const plugins = remarkPlugins;
|
|
375
|
+
const transform = Image ? withMediaSources(urlTransform) : urlTransform;
|
|
376
|
+
const tailText = fence ? fence.before : tail;
|
|
377
|
+
const tailShown = closed.length < visible;
|
|
315
378
|
return /* @__PURE__ */ jsx(PartsContext.Provider, {
|
|
316
379
|
value: parts,
|
|
317
|
-
children: /* @__PURE__ */
|
|
380
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
318
381
|
className: `zg-md${views ? " zg-md-views" : ""} ${className ?? ""}`,
|
|
319
382
|
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
|
-
})
|
|
383
|
+
children: [/* @__PURE__ */ jsx(SettledChunks, {
|
|
384
|
+
chunks: closed,
|
|
385
|
+
count: Math.min(visible, closed.length),
|
|
386
|
+
fences: closedFences,
|
|
387
|
+
document,
|
|
388
|
+
plugins,
|
|
389
|
+
urlTransform: transform
|
|
390
|
+
}), tailShown ? /* @__PURE__ */ jsxs(Fragment$1, { children: [tailText ? /* @__PURE__ */ jsx(ChunkPart, {
|
|
391
|
+
text: tailText,
|
|
392
|
+
fences: tailFences,
|
|
393
|
+
document,
|
|
394
|
+
plugins,
|
|
395
|
+
urlTransform: transform,
|
|
396
|
+
live: streaming
|
|
397
|
+
}) : null, fence ? diagrams && fence.language === "mermaid" && fence.code.trim() ? /* @__PURE__ */ jsx(DiagramFence, {
|
|
398
|
+
code: fence.code,
|
|
399
|
+
streaming: true
|
|
400
|
+
}) : views && fence.language === "view" ? /* @__PURE__ */ jsx(ViewFenceBlock, {
|
|
401
|
+
code: fence.code,
|
|
402
|
+
index: (tailFences?.base ?? 0) + viewFenceStarts(fence.before).length,
|
|
403
|
+
streaming: true,
|
|
404
|
+
CodeBlock
|
|
405
|
+
}) : /* @__PURE__ */ jsx(CodeBlock, {
|
|
406
|
+
code: fence.code,
|
|
407
|
+
language: fence.language
|
|
408
|
+
}) : null] }) : null]
|
|
347
409
|
})
|
|
348
410
|
});
|
|
349
411
|
});
|
|
@@ -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
|
/**
|
|
@@ -5,11 +5,11 @@ import { exchangesMedia } from "../headless/transcript/exchange-media.js";
|
|
|
5
5
|
import { PdfPreview } from "../PdfPreview.js";
|
|
6
6
|
import { TextPreview } from "../TextPreview.js";
|
|
7
7
|
import { useChatLabels } from "../useChatLabels.js";
|
|
8
|
-
import { useTranscriptActions } from "./actions.js";
|
|
8
|
+
import { attachmentSrcOf, toolMediaSrcOf, useTranscriptActions } from "./actions.js";
|
|
9
9
|
import { useTranscriptRenderers } from "./renderers.js";
|
|
10
10
|
import { Suspense, createContext, lazy, useCallback, useContext, useMemo, useRef, useState } from "react";
|
|
11
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
import { messageMediaOf } from "zidane/chat/pure";
|
|
12
|
+
import { messageMediaOf, transcriptArray } from "zidane/chat/pure";
|
|
13
13
|
// src/chat/transcript/media-gallery.tsx
|
|
14
14
|
const RowActionsMenu = lazy(() => import("../../components/RowActionsMenu.js").then((m) => ({ default: m.RowActionsMenu })));
|
|
15
15
|
const GalleryContext = createContext(null);
|
|
@@ -170,7 +170,7 @@ function lightboxItemOf(medium, { actions, mediumActions, TextPreview, isLoaded
|
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
172
|
if (medium.from === "tool") {
|
|
173
|
-
const url = actions
|
|
173
|
+
const url = toolMediaSrcOf(actions, medium.callId, medium);
|
|
174
174
|
if (!url) return null;
|
|
175
175
|
return {
|
|
176
176
|
key: medium.key,
|
|
@@ -257,17 +257,20 @@ function MediaGalleryProvider({ events, children }) {
|
|
|
257
257
|
const live = useRef({
|
|
258
258
|
itemOf,
|
|
259
259
|
lightbox,
|
|
260
|
-
mediumActions
|
|
260
|
+
mediumActions,
|
|
261
|
+
actions
|
|
261
262
|
});
|
|
262
263
|
live.current = {
|
|
263
264
|
itemOf,
|
|
264
265
|
lightbox,
|
|
265
|
-
mediumActions
|
|
266
|
+
mediumActions,
|
|
267
|
+
actions
|
|
266
268
|
};
|
|
267
269
|
const gallery = useMemo(() => ({
|
|
268
270
|
open(key, origin) {
|
|
269
|
-
const { itemOf, lightbox } = live.current;
|
|
270
|
-
const
|
|
271
|
+
const { itemOf, lightbox, actions: current } = live.current;
|
|
272
|
+
const source = eventsRef.current;
|
|
273
|
+
const exchanges = exchangesMedia(Array.isArray(source) ? source : transcriptArray(source), (att) => attachmentSrcOf(current, att));
|
|
271
274
|
const row = origin.closest("[data-row]");
|
|
272
275
|
const prompts = rootRef.current ? [...rootRef.current.querySelectorAll("[data-prompt]")] : [];
|
|
273
276
|
const at = row ? prompts.filter((p) => p === row || p.compareDocumentPosition(row) & Node.DOCUMENT_POSITION_FOLLOWING).length : -1;
|
|
@@ -67,6 +67,24 @@ export interface ErrorRowProps {
|
|
|
67
67
|
}
|
|
68
68
|
/** Renders an error line in the transcript's error tone. */
|
|
69
69
|
export declare const ErrorRow: import("react").MemoExoticComponent<({ text, className, style }: ErrorRowProps) => import("react").JSX.Element>;
|
|
70
|
+
/** Props for {@link RepairedRow}. */
|
|
71
|
+
export interface RepairedRowProps {
|
|
72
|
+
/** The error the run stopped on, for the tooltip. */
|
|
73
|
+
text: string;
|
|
74
|
+
/** Its detail: `environment.failure` picks the words. */
|
|
75
|
+
detail?: StreamEvent['detail'];
|
|
76
|
+
/** Extra classes on the root element. */
|
|
77
|
+
className?: string;
|
|
78
|
+
/** Inline styles on the root element, merged after the component's own. */
|
|
79
|
+
style?: CSSProperties;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* An error on a broken environment that was fixed since (a later setup or
|
|
83
|
+
* reply, `markRunFailures`' `repaired`): one quiet line, "Environment set up
|
|
84
|
+
* again" or "answered again", the error kept for its tooltip. No button:
|
|
85
|
+
* there is nothing left to do.
|
|
86
|
+
*/
|
|
87
|
+
export declare const RepairedRow: import("react").MemoExoticComponent<({ text, detail, className, style }: RepairedRowProps) => import("react").JSX.Element>;
|
|
70
88
|
/** Props for {@link FailureRow}. */
|
|
71
89
|
export interface FailureRowProps {
|
|
72
90
|
/** The reason the run stopped, in muted text after `Stopped`. */
|
|
@@ -91,7 +109,11 @@ export interface FailureRowProps {
|
|
|
91
109
|
* had done something, Retry (the same prompt) when it had not. Both hand
|
|
92
110
|
* their prompt to `onResume` (the desktop app: the composer's send); without
|
|
93
111
|
* it there is no button. A run stopped by a failed sign-in (`detail.auth`)
|
|
94
|
-
* shows the sign-in's card instead (`AuthFailureCard`).
|
|
112
|
+
* shows the sign-in's card instead (`AuthFailureCard`). A run stopped by a
|
|
113
|
+
* broken environment (`detail.environment`) repairs it first
|
|
114
|
+
* (`TranscriptActions.retryEnvironment`), then sends: the prompt waits in the
|
|
115
|
+
* host's queue until it is back. Setting a gone one up anew asks first (the
|
|
116
|
+
* app's confirm dialog), as it can cost work.
|
|
95
117
|
*/
|
|
96
118
|
export declare const FailureRow: import("react").MemoExoticComponent<({ text, detail, failure, resumable, onResume, className, style }: FailureRowProps) => import("react").JSX.Element>;
|
|
97
119
|
/** Props for {@link SessionEventRow}. */
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { useOptionalConfirm } from "../../app/useConfirm.js";
|
|
2
|
+
import { useTooltip } from "../../components/Tooltip.js";
|
|
1
3
|
import { useStaysMounted } from "../../motion/collapse.js";
|
|
2
4
|
import { failureTooltip } from "../headless/transcript/run-failures.js";
|
|
3
5
|
import { useChatLabels } from "../useChatLabels.js";
|
|
6
|
+
import { useTranscriptActions } from "./actions.js";
|
|
4
7
|
import { AuthFailureCard } from "./AuthFailureCard.js";
|
|
5
8
|
import { Caret } from "./frame.js";
|
|
6
9
|
import { useTranscriptRenderers } from "./renderers.js";
|
|
10
|
+
import { useRowPartKey, useRowUiState } from "./row-ui-state.js";
|
|
7
11
|
import { memo, useId, useState } from "react";
|
|
8
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
13
|
import { CONTINUE_PROMPT, SESSION_EVENT_STATUS_STYLE, describeSpawnEnd, sessionDirLabel, sessionEventExcerpt, sessionEventMeta, shortSessionId, spawnStartParts } from "zidane/chat/pure";
|
|
10
14
|
// src/chat/transcript/notices.tsx
|
|
11
15
|
/**
|
|
@@ -67,13 +71,17 @@ const NoticeRow = memo(({ notice, text, className, style }) => {
|
|
|
67
71
|
style,
|
|
68
72
|
title: notice.label,
|
|
69
73
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
70
|
-
className: `inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full shadow-[inset_0_0_0_1px_var(--zg-hairline)] font-medium ${tone}`,
|
|
74
|
+
className: `inline-flex max-w-full items-center gap-1.5 px-2 py-0.5 rounded-full shadow-[inset_0_0_0_1px_var(--zg-hairline)] font-medium ${tone}`,
|
|
71
75
|
children: [/* @__PURE__ */ jsx("span", {
|
|
72
76
|
"aria-hidden": true,
|
|
73
77
|
className: `${icon} shrink-0`
|
|
74
|
-
}),
|
|
78
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
79
|
+
className: "min-w-0 truncate",
|
|
80
|
+
title: head,
|
|
81
|
+
children: head
|
|
82
|
+
})]
|
|
75
83
|
}), details.length > 0 && /* @__PURE__ */ jsx("span", {
|
|
76
|
-
className: "min-w-0 flex flex-col gap-0.5
|
|
84
|
+
className: "min-w-0 max-w-full flex flex-col gap-0.5 px-2 break-words text-[var(--zg-text-muted)]",
|
|
77
85
|
children: details.map((line, i) => /* @__PURE__ */ jsx("span", { children: line }, i))
|
|
78
86
|
})]
|
|
79
87
|
});
|
|
@@ -89,16 +97,64 @@ const ErrorRow = memo(({ text, className, style }) => {
|
|
|
89
97
|
});
|
|
90
98
|
});
|
|
91
99
|
/**
|
|
100
|
+
* An error on a broken environment that was fixed since (a later setup or
|
|
101
|
+
* reply, `markRunFailures`' `repaired`): one quiet line, "Environment set up
|
|
102
|
+
* again" or "answered again", the error kept for its tooltip. No button:
|
|
103
|
+
* there is nothing left to do.
|
|
104
|
+
*/
|
|
105
|
+
const RepairedRow = memo(({ text, detail, className, style }) => {
|
|
106
|
+
const labels = useChatLabels();
|
|
107
|
+
const why = failureTooltip(text, detail, labels.resetsAt);
|
|
108
|
+
const tip = useTooltip(why ? /* @__PURE__ */ jsx("span", {
|
|
109
|
+
className: "whitespace-pre-line",
|
|
110
|
+
children: why
|
|
111
|
+
}) : null, { maxWidth: 360 });
|
|
112
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
113
|
+
className: [`flex items-center gap-1.5 min-w-0 ${BODY_TEXT} text-[var(--zg-text-muted)]`, className].filter(Boolean).join(" "),
|
|
114
|
+
style,
|
|
115
|
+
"data-testid": "environment-repaired",
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ jsx("span", {
|
|
118
|
+
"aria-hidden": true,
|
|
119
|
+
className: "i-ph-arrow-counter-clockwise text-zg-ui shrink-0"
|
|
120
|
+
}),
|
|
121
|
+
/* @__PURE__ */ jsx("span", {
|
|
122
|
+
...tip.anchorProps,
|
|
123
|
+
className: "min-w-0 truncate",
|
|
124
|
+
children: labels.environmentRepaired[detail?.environment?.failure ?? "lost"]
|
|
125
|
+
}),
|
|
126
|
+
tip.tip
|
|
127
|
+
]
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
RepairedRow.displayName = "RepairedRow";
|
|
131
|
+
/**
|
|
92
132
|
* How a run that ended early reads: one quiet line (`Stopped`, then the
|
|
93
133
|
* reason in muted text, for a failure; `Stopped by you` for a stop), and on the transcript's last
|
|
94
134
|
* word a small button that picks the work back up: Continue when the run
|
|
95
135
|
* had done something, Retry (the same prompt) when it had not. Both hand
|
|
96
136
|
* their prompt to `onResume` (the desktop app: the composer's send); without
|
|
97
137
|
* it there is no button. A run stopped by a failed sign-in (`detail.auth`)
|
|
98
|
-
* shows the sign-in's card instead (`AuthFailureCard`).
|
|
138
|
+
* shows the sign-in's card instead (`AuthFailureCard`). A run stopped by a
|
|
139
|
+
* broken environment (`detail.environment`) repairs it first
|
|
140
|
+
* (`TranscriptActions.retryEnvironment`), then sends: the prompt waits in the
|
|
141
|
+
* host's queue until it is back. Setting a gone one up anew asks first (the
|
|
142
|
+
* app's confirm dialog), as it can cost work.
|
|
99
143
|
*/
|
|
100
144
|
const FailureRow = memo(({ text, detail, failure, resumable, onResume, className, style }) => {
|
|
101
145
|
const labels = useChatLabels();
|
|
146
|
+
const { retryEnvironment } = useTranscriptActions();
|
|
147
|
+
const confirm = useOptionalConfirm();
|
|
148
|
+
const [repairing, setRepairing] = useState(false);
|
|
149
|
+
const broken = detail?.environment;
|
|
150
|
+
const repairs = broken !== void 0 && retryEnvironment !== void 0;
|
|
151
|
+
const retry = failure.resume === "retry" && failure.prompt;
|
|
152
|
+
const tip = useTooltip(repairs ? labels.retryEnvironmentHint : retry ? labels.retryHint : labels.continueHint);
|
|
153
|
+
const whyText = failureTooltip(text, detail, labels.resetsAt);
|
|
154
|
+
const why = useTooltip(whyText ? /* @__PURE__ */ jsx("span", {
|
|
155
|
+
className: "whitespace-pre-line",
|
|
156
|
+
children: whyText
|
|
157
|
+
}) : null, { maxWidth: 360 });
|
|
102
158
|
if (detail?.auth && failure.cause === "error") return /* @__PURE__ */ jsx(AuthFailureCard, {
|
|
103
159
|
auth: detail.auth,
|
|
104
160
|
text,
|
|
@@ -109,33 +165,59 @@ const FailureRow = memo(({ text, detail, failure, resumable, onResume, className
|
|
|
109
165
|
className,
|
|
110
166
|
style
|
|
111
167
|
});
|
|
112
|
-
const retry = failure.resume === "retry" && failure.prompt;
|
|
113
168
|
const byUser = failure.cause === "aborted";
|
|
169
|
+
const resume = async (send) => {
|
|
170
|
+
const prompt = retry ? failure.prompt : CONTINUE_PROMPT;
|
|
171
|
+
if (!broken || !retryEnvironment) {
|
|
172
|
+
send(prompt);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (broken.failure === "lost" && confirm) {
|
|
176
|
+
if (!await confirm({
|
|
177
|
+
title: labels.retryEnvironmentLostTitle,
|
|
178
|
+
message: broken.context === "sandbox" ? labels.retryEnvironmentLostSandboxDetail : labels.retryEnvironmentLostDetail,
|
|
179
|
+
confirmLabel: labels.retryEnvironmentLostConfirm,
|
|
180
|
+
destructive: true
|
|
181
|
+
})) return;
|
|
182
|
+
}
|
|
183
|
+
setRepairing(true);
|
|
184
|
+
try {
|
|
185
|
+
await Promise.resolve(retryEnvironment()).catch(() => void 0);
|
|
186
|
+
} finally {
|
|
187
|
+
setRepairing(false);
|
|
188
|
+
}
|
|
189
|
+
send(prompt);
|
|
190
|
+
};
|
|
114
191
|
return /* @__PURE__ */ jsxs("div", {
|
|
115
192
|
className: [`flex items-center gap-2 min-w-0 ${BODY_TEXT}`, className].filter(Boolean).join(" "),
|
|
116
193
|
style,
|
|
117
194
|
"data-testid": "run-failure",
|
|
118
195
|
"data-cause": failure.cause,
|
|
119
|
-
children: [
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
196
|
+
children: [
|
|
197
|
+
/* @__PURE__ */ jsxs("span", {
|
|
198
|
+
...why.anchorProps,
|
|
199
|
+
className: "min-w-0 truncate",
|
|
200
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
201
|
+
className: byUser ? "text-[var(--zg-text-muted)]" : ERROR_TONE,
|
|
202
|
+
children: byUser ? labels.stoppedByYou : labels.stopped
|
|
203
|
+
}), text && /* @__PURE__ */ jsxs("span", {
|
|
204
|
+
className: "text-[var(--zg-text-muted)]",
|
|
205
|
+
children: [" ", text]
|
|
206
|
+
})]
|
|
207
|
+
}),
|
|
208
|
+
why.tip,
|
|
209
|
+
resumable && onResume && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("button", {
|
|
210
|
+
...tip.anchorProps,
|
|
211
|
+
type: "button",
|
|
212
|
+
disabled: repairing,
|
|
213
|
+
onClick: () => void resume(onResume),
|
|
214
|
+
className: "zg-segment-item zg-press-soft shrink-0 inline-flex items-center gap-1 h-6 px-2 -my-px rounded-full border-0 bg-transparent cursor-pointer text-[var(--zg-text-muted)] zg-focus-ring",
|
|
215
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
216
|
+
className: "i-ph-arrow-clockwise text-zg-ui",
|
|
217
|
+
"aria-hidden": true
|
|
218
|
+
}), retry ? labels.retry : labels.continueRun]
|
|
219
|
+
}), tip.tip] })
|
|
220
|
+
]
|
|
139
221
|
});
|
|
140
222
|
});
|
|
141
223
|
/**
|
|
@@ -254,7 +336,7 @@ const COMMAND_DETAIL_LINE = "26.4px";
|
|
|
254
336
|
* monospace `<pre>` would misrender them as a wall of mono.
|
|
255
337
|
*/
|
|
256
338
|
const CommandDetailRow = memo(({ label, text, syntax, className, style }) => {
|
|
257
|
-
const [open, setOpen] =
|
|
339
|
+
const [open, setOpen] = useRowUiState(useRowPartKey("command-detail"), false);
|
|
258
340
|
const mounted = useStaysMounted(open);
|
|
259
341
|
const labels = useChatLabels();
|
|
260
342
|
const { Markdown, CodeBlock } = useTranscriptRenderers();
|
|
@@ -344,4 +426,4 @@ const SpawnEndRow = memo(({ row, className, style }) => {
|
|
|
344
426
|
}, value))]
|
|
345
427
|
});
|
|
346
428
|
});
|
|
347
|
-
export { COMMAND_DETAIL_LINE, CommandDetailRow, CommandNoteRow, ErrorRow, FailureRow, InfoRow, NoticeRow, SessionEventRow, SpawnEndRow, SpawnStartRow };
|
|
429
|
+
export { COMMAND_DETAIL_LINE, CommandDetailRow, CommandNoteRow, ErrorRow, FailureRow, InfoRow, NoticeRow, RepairedRow, SessionEventRow, SpawnEndRow, SpawnStartRow };
|
|
@@ -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";
|
|
@@ -56,6 +57,7 @@ const ThinkingRow = memo(({ text, thinkingMs, live, autoExpand = false, classNam
|
|
|
56
57
|
children: mounted && /* @__PURE__ */ jsx("div", {
|
|
57
58
|
className: "pt-1 text-sm italic text-[var(--zg-text-muted)] leading-relaxed",
|
|
58
59
|
children: /* @__PURE__ */ jsx(Markdown, {
|
|
60
|
+
className: live ? "zg-streaming" : void 0,
|
|
59
61
|
streaming: live,
|
|
60
62
|
children: text
|
|
61
63
|
})
|
|
@@ -73,7 +75,7 @@ const ThinkingRow = memo(({ text, thinkingMs, live, autoExpand = false, classNam
|
|
|
73
75
|
* groups); replayed groups render a bare count.
|
|
74
76
|
*/
|
|
75
77
|
const ThinkingBatchRow = memo(({ thoughts, totalMs, autoExpand = false, className, style }) => {
|
|
76
|
-
const [open, setOpen] =
|
|
78
|
+
const [open, setOpen] = useRowUiState(useRowPartKey("thoughts"), false);
|
|
77
79
|
const labels = useChatLabels();
|
|
78
80
|
return /* @__PURE__ */ jsxs("div", {
|
|
79
81
|
className: ["text-xs", className].filter(Boolean).join(" "),
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The receipt's cells, shared by the run receipt and the compaction line
|
|
3
|
+
* (`run-rows.tsx`, the fold's compaction step). Internal: not re-exported.
|
|
4
|
+
*/
|
|
5
|
+
import { RunReceiptCell, RunReceiptSegment } from "zidane/chat/pure";
|
|
6
|
+
import { StreamEvent } from "zidane/chat";
|
|
7
|
+
export declare const RUN_RECEIPT_TINT: Record<RunReceiptCell['kind'], string>;
|
|
8
|
+
export declare const RUN_RECEIPT_SEGMENT_TINT: Record<RunReceiptSegment['kind'], string>;
|
|
9
|
+
/** A receipt value (`↻3`, `↑520k`), its leading glyph as an icon. */
|
|
10
|
+
export declare function ReceiptValue({ text, className }: {
|
|
11
|
+
text: string;
|
|
12
|
+
className: string;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* A compaction's facts as one quiet line: the summary call's model, its cost
|
|
16
|
+
* when priced, and the tokens it sent and received. The compaction card and
|
|
17
|
+
* the run's fold step (`fold.tsx`) both show it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function CompactMeta({ meta, className }: {
|
|
20
|
+
meta: NonNullable<StreamEvent['compact']>;
|
|
21
|
+
className?: string;
|
|
22
|
+
}): import("react").JSX.Element;
|