@arbidocs/blocks 0.5.129 → 0.5.130
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/{ConnectedCallDock-XJOYVVAH.cjs → ConnectedCallDock-CJ7RWP5B.cjs} +12 -12
- package/dist/{ConnectedCallDock-XJOYVVAH.cjs.map → ConnectedCallDock-CJ7RWP5B.cjs.map} +1 -1
- package/dist/{ConnectedCallRoom-CUDYAPQK.cjs → ConnectedCallRoom-JPJCXP6X.cjs} +12 -12
- package/dist/{ConnectedCallRoom-CUDYAPQK.cjs.map → ConnectedCallRoom-JPJCXP6X.cjs.map} +1 -1
- package/dist/{ConnectedNativeDocxComparison-7KTAOUE3.cjs → ConnectedNativeDocxComparison-5TZAIR4V.cjs} +13 -13
- package/dist/{ConnectedNativeDocxComparison-7KTAOUE3.cjs.map → ConnectedNativeDocxComparison-5TZAIR4V.cjs.map} +1 -1
- package/dist/{ConnectedPresentation-SI3L77J4.cjs → ConnectedPresentation-SEUUNFUA.cjs} +13 -13
- package/dist/{ConnectedPresentation-SI3L77J4.cjs.map → ConnectedPresentation-SEUUNFUA.cjs.map} +1 -1
- package/dist/{ConnectedProductionSetDialog-4EAY6KAZ.cjs → ConnectedProductionSetDialog-LHB4VQWC.cjs} +3 -3
- package/dist/{ConnectedProductionSetDialog-4EAY6KAZ.cjs.map → ConnectedProductionSetDialog-LHB4VQWC.cjs.map} +1 -1
- package/dist/{ConnectedSlidesTab-E76OVY34.cjs → ConnectedSlidesTab-3ATAKNSJ.cjs} +13 -13
- package/dist/{ConnectedSlidesTab-E76OVY34.cjs.map → ConnectedSlidesTab-3ATAKNSJ.cjs.map} +1 -1
- package/dist/{ConnectedStreamedWordArtifact-J4MYBABA.cjs → ConnectedStreamedWordArtifact-BKPOMQ6G.cjs} +13 -13
- package/dist/{ConnectedStreamedWordArtifact-J4MYBABA.cjs.map → ConnectedStreamedWordArtifact-BKPOMQ6G.cjs.map} +1 -1
- package/dist/DocumentReviewCard-M53XFLI2.cjs +1 -1
- package/dist/{FilesViewerDialog-GGF4WMU4.cjs → FilesViewerDialog-EFRMXIM5.cjs} +27 -27
- package/dist/{FilesViewerDialog-GGF4WMU4.cjs.map → FilesViewerDialog-EFRMXIM5.cjs.map} +1 -1
- package/dist/{StreamedArtifactEditor-7KJ2HLLU.cjs → StreamedArtifactEditor-RSPUSZ2B.cjs} +5 -5
- package/dist/{StreamedArtifactEditor-7KJ2HLLU.cjs.map → StreamedArtifactEditor-RSPUSZ2B.cjs.map} +1 -1
- package/dist/{WorkspaceTableView-CUCTCA2O.cjs → WorkspaceTableView-QPROJRCF.cjs} +3 -3
- package/dist/{WorkspaceTableView-CUCTCA2O.cjs.map → WorkspaceTableView-QPROJRCF.cjs.map} +1 -1
- package/dist/agents/index.cjs +363 -363
- package/dist/agents/workflows/StepParts.d.ts +3 -0
- package/dist/agents/workflows/StepParts.js +20 -3
- package/dist/agents/workflows/StepParts.js.map +2 -2
- package/dist/agents/workflows/WorkflowStepAction.js +14 -3
- package/dist/agents/workflows/WorkflowStepAction.js.map +2 -2
- package/dist/agents/workflows/planSteps.js +6 -1
- package/dist/agents/workflows/planSteps.js.map +2 -2
- package/dist/agents/workflows/workflow.d.ts +11 -2
- package/dist/agents/workflows/workflow.js +16 -1
- package/dist/agents/workflows/workflow.js.map +2 -2
- package/dist/{ai-IEIR7SC2.cjs → ai-4XJ2VFNS.cjs} +24 -24
- package/dist/ai-4XJ2VFNS.cjs.map +1 -0
- package/dist/artifacts/VersionTimeline.d.ts +5 -1
- package/dist/artifacts/VersionTimeline.js +15 -0
- package/dist/artifacts/VersionTimeline.js.map +2 -2
- package/dist/artifacts/index.cjs +24 -24
- package/dist/calls/index.cjs +3 -3
- package/dist/chat/index.cjs +59 -59
- package/dist/{chunk-XF355M7O.cjs → chunk-2Z25MUAY.cjs} +17 -17
- package/dist/{chunk-XF355M7O.cjs.map → chunk-2Z25MUAY.cjs.map} +1 -1
- package/dist/{chunk-7JLJH5CW.cjs → chunk-5A6T4W46.cjs} +7 -7
- package/dist/{chunk-7JLJH5CW.cjs.map → chunk-5A6T4W46.cjs.map} +1 -1
- package/dist/{chunk-L4CIFLCU.cjs → chunk-7LEN65YI.cjs} +9 -9
- package/dist/{chunk-L4CIFLCU.cjs.map → chunk-7LEN65YI.cjs.map} +1 -1
- package/dist/{chunk-IDCD5TEZ.cjs → chunk-A6GBPE5E.cjs} +18 -18
- package/dist/{chunk-IDCD5TEZ.cjs.map → chunk-A6GBPE5E.cjs.map} +1 -1
- package/dist/{chunk-XGTMC54Q.cjs → chunk-AFXLRO6E.cjs} +4 -4
- package/dist/{chunk-XGTMC54Q.cjs.map → chunk-AFXLRO6E.cjs.map} +1 -1
- package/dist/{chunk-KNGZZC4O.cjs → chunk-B3BZ6MNI.cjs} +6 -6
- package/dist/{chunk-KNGZZC4O.cjs.map → chunk-B3BZ6MNI.cjs.map} +1 -1
- package/dist/{chunk-WAV762GP.cjs → chunk-DBN6GBRQ.cjs} +6 -6
- package/dist/{chunk-WAV762GP.cjs.map → chunk-DBN6GBRQ.cjs.map} +1 -1
- package/dist/{chunk-QGVOT7E4.cjs → chunk-EQTZQD66.cjs} +8 -8
- package/dist/{chunk-QGVOT7E4.cjs.map → chunk-EQTZQD66.cjs.map} +1 -1
- package/dist/{chunk-CNLIXB6S.cjs → chunk-ERRXU2HL.cjs} +3 -3
- package/dist/{chunk-CNLIXB6S.cjs.map → chunk-ERRXU2HL.cjs.map} +1 -1
- package/dist/{chunk-M2FOXGJU.cjs → chunk-F6CEPWIF.cjs} +7 -7
- package/dist/{chunk-M2FOXGJU.cjs.map → chunk-F6CEPWIF.cjs.map} +1 -1
- package/dist/{chunk-VWBYE3XY.cjs → chunk-FQRJCAT2.cjs} +6 -6
- package/dist/{chunk-VWBYE3XY.cjs.map → chunk-FQRJCAT2.cjs.map} +1 -1
- package/dist/{chunk-HH5RDNO5.cjs → chunk-GOQV6NOK.cjs} +74 -74
- package/dist/{chunk-HH5RDNO5.cjs.map → chunk-GOQV6NOK.cjs.map} +1 -1
- package/dist/{chunk-XCKHOXRP.cjs → chunk-H4ID6S4P.cjs} +6 -6
- package/dist/{chunk-XCKHOXRP.cjs.map → chunk-H4ID6S4P.cjs.map} +1 -1
- package/dist/{chunk-UFT22LAB.cjs → chunk-HBUHOCWF.cjs} +16 -16
- package/dist/{chunk-UFT22LAB.cjs.map → chunk-HBUHOCWF.cjs.map} +1 -1
- package/dist/{chunk-U7D6ZDR2.cjs → chunk-HORAMB52.cjs} +96 -36
- package/dist/chunk-HORAMB52.cjs.map +1 -0
- package/dist/{chunk-3IH55CDE.cjs → chunk-IZBAWZTB.cjs} +16 -2
- package/dist/chunk-IZBAWZTB.cjs.map +1 -0
- package/dist/{chunk-QRAQZTJE.cjs → chunk-JN5YMHGI.cjs} +18 -3
- package/dist/chunk-JN5YMHGI.cjs.map +1 -0
- package/dist/{chunk-LXFCED4Z.cjs → chunk-KWHGYHRC.cjs} +7 -7
- package/dist/{chunk-LXFCED4Z.cjs.map → chunk-KWHGYHRC.cjs.map} +1 -1
- package/dist/{chunk-EG7EJFUE.cjs → chunk-MHIG6GGS.cjs} +17 -2
- package/dist/chunk-MHIG6GGS.cjs.map +1 -0
- package/dist/{chunk-I3A6KKWY.cjs → chunk-MI3N3ZOT.cjs} +86 -76
- package/dist/chunk-MI3N3ZOT.cjs.map +1 -0
- package/dist/{chunk-ENOPKX7E.cjs → chunk-MXBXZXXQ.cjs} +3 -3
- package/dist/{chunk-ENOPKX7E.cjs.map → chunk-MXBXZXXQ.cjs.map} +1 -1
- package/dist/{chunk-7NLO7ASW.cjs → chunk-MXGXKUSW.cjs} +17 -17
- package/dist/{chunk-7NLO7ASW.cjs.map → chunk-MXGXKUSW.cjs.map} +1 -1
- package/dist/{chunk-ZCU72Q76.cjs → chunk-NM7RWZ4E.cjs} +10 -10
- package/dist/{chunk-ZCU72Q76.cjs.map → chunk-NM7RWZ4E.cjs.map} +1 -1
- package/dist/{chunk-NQML7IUC.cjs → chunk-OD6NGGL3.cjs} +134 -107
- package/dist/chunk-OD6NGGL3.cjs.map +1 -0
- package/dist/{chunk-TP5PGWIO.cjs → chunk-QFXOTJ6G.cjs} +20 -15
- package/dist/chunk-QFXOTJ6G.cjs.map +1 -0
- package/dist/{chunk-7L4X6QN2.cjs → chunk-QXMPATG6.cjs} +8 -8
- package/dist/{chunk-7L4X6QN2.cjs.map → chunk-QXMPATG6.cjs.map} +1 -1
- package/dist/{chunk-WXUU3COI.cjs → chunk-SUOHAB7N.cjs} +11 -11
- package/dist/{chunk-WXUU3COI.cjs.map → chunk-SUOHAB7N.cjs.map} +1 -1
- package/dist/{chunk-I7J3ED6P.cjs → chunk-TDA6KESI.cjs} +4 -4
- package/dist/{chunk-I7J3ED6P.cjs.map → chunk-TDA6KESI.cjs.map} +1 -1
- package/dist/{chunk-5GA65VBW.cjs → chunk-TZYB22FM.cjs} +9 -9
- package/dist/{chunk-5GA65VBW.cjs.map → chunk-TZYB22FM.cjs.map} +1 -1
- package/dist/{chunk-HSLPFBK2.cjs → chunk-VL7ZX4KQ.cjs} +6 -6
- package/dist/{chunk-HSLPFBK2.cjs.map → chunk-VL7ZX4KQ.cjs.map} +1 -1
- package/dist/{chunk-2F57IO7S.cjs → chunk-XCW6OY7E.cjs} +27 -27
- package/dist/{chunk-2F57IO7S.cjs.map → chunk-XCW6OY7E.cjs.map} +1 -1
- package/dist/{chunk-NG2EE7HR.cjs → chunk-YWHUWIHP.cjs} +9 -9
- package/dist/{chunk-NG2EE7HR.cjs.map → chunk-YWHUWIHP.cjs.map} +1 -1
- package/dist/connect/docx.cjs +16 -16
- package/dist/connect/index.cjs +1168 -416
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.ts +2 -0
- package/dist/connect/index.js +12 -0
- package/dist/connect/index.js.map +2 -2
- package/dist/connect/viewer.cjs +16 -16
- package/dist/connection/ConnectedWorkflowBuilder.d.ts +12 -0
- package/dist/connection/ConnectedWorkflowBuilder.js +6 -1
- package/dist/connection/ConnectedWorkflowBuilder.js.map +2 -2
- package/dist/connection/assistant/AssistantDrafts.d.ts +21 -0
- package/dist/connection/assistant/AssistantDrafts.js +158 -0
- package/dist/connection/assistant/AssistantDrafts.js.map +7 -0
- package/dist/connection/assistant/AssistantPlan.d.ts +16 -0
- package/dist/connection/assistant/AssistantPlan.js +72 -0
- package/dist/connection/assistant/AssistantPlan.js.map +7 -0
- package/dist/connection/assistant/AssistantStatusPanel.d.ts +28 -0
- package/dist/connection/assistant/AssistantStatusPanel.js +206 -0
- package/dist/connection/assistant/AssistantStatusPanel.js.map +7 -0
- package/dist/connection/assistant/ConnectedAssistantPage.d.ts +39 -0
- package/dist/connection/assistant/ConnectedAssistantPage.js +377 -0
- package/dist/connection/assistant/ConnectedAssistantPage.js.map +7 -0
- package/dist/connection/conversation/AgentSteps.js +19 -2
- package/dist/connection/conversation/AgentSteps.js.map +2 -2
- package/dist/connection/viewer/ConnectedDocumentViewer.js +22 -2
- package/dist/connection/viewer/ConnectedDocumentViewer.js.map +2 -2
- package/dist/connection/viewer/useDocumentVersionRestore.d.ts +14 -0
- package/dist/connection/viewer/useDocumentVersionRestore.js +48 -0
- package/dist/connection/viewer/useDocumentVersionRestore.js.map +7 -0
- package/dist/connection/viewer/useViewerTabs.d.ts +1 -1
- package/dist/connection/viewer/useViewerTabs.js +6 -3
- package/dist/connection/viewer/useViewerTabs.js.map +2 -2
- package/dist/document-tools/VersionSnapshotBar.d.ts +4 -1
- package/dist/document-tools/VersionSnapshotBar.js +14 -0
- package/dist/document-tools/VersionSnapshotBar.js.map +2 -2
- package/dist/document-tools/index.cjs +13 -13
- package/dist/embed/index.cjs +25 -25
- package/dist/facts/index.cjs +43 -43
- package/dist/index.cjs +530 -530
- package/dist/office/index.cjs +5 -5
- package/dist/settings/index.cjs +1 -1
- package/dist/site/index.cjs +5 -5
- package/dist/studio/index.cjs +16 -16
- package/dist/styles.css +1 -1
- package/dist/workflow-canvas/TriggerInspector.d.ts +7 -0
- package/dist/workflow-canvas/TriggerInspector.js +56 -0
- package/dist/workflow-canvas/TriggerInspector.js.map +2 -2
- package/dist/workflow-canvas/index.cjs +142 -81
- package/dist/workflow-canvas/index.cjs.map +1 -1
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/dist/ai-IEIR7SC2.cjs.map +0 -1
- package/dist/chunk-3IH55CDE.cjs.map +0 -1
- package/dist/chunk-EG7EJFUE.cjs.map +0 -1
- package/dist/chunk-I3A6KKWY.cjs.map +0 -1
- package/dist/chunk-NQML7IUC.cjs.map +0 -1
- package/dist/chunk-QRAQZTJE.cjs.map +0 -1
- package/dist/chunk-TP5PGWIO.cjs.map +0 -1
- package/dist/chunk-U7D6ZDR2.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/conversation/AgentSteps.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * A turn's agent steps, bound to the session: the step trace (`StepTrace` and its rows) filled\n * from the step stream, with the workspace's document names, the model tiers, the developer\n * details and the live duration of the running step.\n */\n\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n getDocumentTitle,\n ProviderIcon,\n} from '@arbidocs/react/ui'\nimport { formatGbp, useAvailableModels, useDocuments, useUserSettings } from '@arbidocs/react'\nimport React, { useMemo } from 'react'\nimport {\n GoalCriteria,\n StepDetail,\n StepNarration,\n StepOutcome,\n StepParams,\n StepRow,\n StepSummary,\n StepTrace,\n StepTraceSummary,\n SubAgentLane,\n SubStepGroup,\n type GoalCriterionView,\n} from '../../agents/runs/AgentSteps'\nimport {\n getAgentStepPresentation,\n getModelIcon,\n MODEL_TIER_ICON_MAP,\n MODEL_TIER_LABELS,\n stepAccent,\n} from '../../agents/runs/step-presentation'\nimport { MessageLiveSeconds, type MessageTimerSubscription } from './MessageLiveSeconds'\nimport { ConnectedMarkdown } from './ConnectedMarkdown'\nimport {\n computeRunStats,\n extractSubagentLanes,\n formatTokens,\n getAgentStepLabel,\n getCurrentStep,\n getStepDisplay,\n getStepTool,\n isNearAiUsageBudget,\n mergeAgentSteps,\n subagentJobLabel,\n type AgentStepEvent,\n type ContextUsage,\n type DocInfoMap,\n} from '@arbidocs/sdk/browser'\n\n/** A workspace document, as the step trace names it. */\ntype StepDocument = { external_id: string; file_name?: string | null; n_pages?: number | null }\n\n/** Fields injected by the backend for display \u2014 excluded from param rendering */\nconst DISPLAY_FIELDS = new Set(['tool', 'label', 'icon', 'summary'])\n\n/**\n * Extract tool parameters from a detail entry, excluding display fields.\n * Returns key-value pairs for inline rendering.\n */\nfunction getToolParams(detail: Record<string, unknown>): Array<{ key: string; value: string }> {\n const params: Array<{ key: string; value: string }> = []\n for (const [key, value] of Object.entries(detail)) {\n if (DISPLAY_FIELDS.has(key) || value == null) continue\n const strValue = typeof value === 'string' ? value : JSON.stringify(value)\n params.push({ key, value: strValue })\n }\n return params\n}\n\nfunction StepModelIcon({ modelName, tag }: { modelName?: string | null; tag: string | null }) {\n // Premium \u2192 brand mark; Fast/Wise \u2192 their name icon; otherwise the tag icon.\n const cfg = tag === 'Premium' ? null : getModelIcon(modelName, tag)\n if (tag !== 'Premium' && !cfg) return null\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <span className=\"flex-shrink-0\">\n {tag === 'Premium' ? (\n <ProviderIcon modelName={modelName ?? undefined} size={11} />\n ) : (\n cfg && <cfg.icon className={cfg.className} style={{ width: 11, height: 11 }} />\n )}\n </span>\n </TooltipTrigger>\n <TooltipContent>{modelName}</TooltipContent>\n </Tooltip>\n )\n}\n\ninterface AgentStepsProps {\n steps: AgentStepEvent[]\n isStreaming: boolean\n className?: string\n /**\n * Total elapsed seconds for the message \u2014 used as a static fallback for the\n * last step's duration when `liveTimer` is not provided (e.g. messages\n * loaded from history). When `liveTimer` is provided this prop is forwarded\n * to the leaf as the post-generation fallback.\n */\n totalElapsedTime?: number\n /**\n * Optional live-timer subscription. When provided, the last step's duration\n * is rendered by a leaf component so the parent does not re-render at the\n * 100 ms timer cadence.\n */\n liveTimer?: MessageTimerSubscription\n /**\n * When true (the live bar's expander), hide what the bar already shows live \u2014\n * the agent's current step and any still-running sub-agents \u2014 so the expander\n * is purely \"what came before\", never a duplicate of the footer. Finished\n * sub-agents stay (they're history). No effect once settled.\n */\n hideLive?: boolean\n /**\n * This turn's settled context/AI usage (\u00A3) (`message.finalContextUsage`).\n * \u00A3 spent belongs here, on the turn that spent them \u2014 not on the\n * composer's forward-looking context bar, which is about future messages.\n */\n contextUsage?: ContextUsage | null\n}\n\nconst AgentStepsComponent: React.FC<AgentStepsProps> = ({\n steps,\n isStreaming,\n className,\n totalElapsedTime,\n liveTimer,\n hideLive = false,\n contextUsage,\n}) => {\n const { data: userSettings } = useUserSettings()\n const isDeveloper = userSettings?.developer === true\n\n // Build doc_ext_id \u2192 {name, pages} map from workspace documents (cached by React Query)\n const { data: documents = [] } = useDocuments()\n const docInfo = useMemo(() => {\n const map: DocInfoMap = {}\n const docArray = Array.isArray(documents) ? documents : []\n for (const doc of docArray) {\n if (doc && 'external_id' in doc) {\n const d = doc as StepDocument\n // Use the canonical document entity label (doc_metadata.title ?? file\n // name), not the raw file name, so references resolve to the same name\n // the rest of the app shows.\n map[d.external_id] = {\n name: getDocumentTitle(d, d.file_name ?? d.external_id),\n pages: d.n_pages ?? null,\n }\n }\n }\n return map\n }, [documents])\n\n // Resolve model name \u2192 tag for looking up tier icons\n const { data: availableModels } = useAvailableModels()\n const getModelTag = useMemo(() => {\n return (modelName?: string | null): string | null => {\n if (!modelName || !availableModels?.models) return null\n return availableModels.models.find((m) => m.model_name === modelName)?.tags?.[0] || null\n }\n }, [availableModels])\n\n // Raw SSE events \u2192 the logical steps a reader sees. Shared with the `Step N`\n // counter so the count always matches the rows rendered below.\n //\n // When `hideLive` (the live bar's expander), the current step STAYS \u2014 the\n // drawer is a complete, correctly-numbered list with the active step\n // highlighted as the last row, matching the \"Step N\" position on the bar.\n // (Dropping it made the drawer show N-1 rows while the bar said N, and marked\n // the *previous* step active.) Still-running sub-agents are the one thing\n // dropped: they have their own live lanes in the roster beneath the bar, so\n // showing them here too would double-render them.\n const mergedSteps = useMemo(() => {\n const merged = mergeAgentSteps(steps)\n if (!hideLive) return merged\n const runningHandles = new Set(\n extractSubagentLanes(merged)\n .filter((l) => l.status === 'running')\n .map((l) => l.handle)\n )\n return merged.filter((s) => !(s.subagent && runningHandles.has(s.subagent)))\n }, [steps, hideLive])\n\n // Compute step durations: duration = next_step.t - current_step.t\n // For the last step, use totalElapsedTime (frontend timer) if available\n const stepDurations = useMemo(() => {\n const durations: (number | null)[] = []\n for (let i = 0; i < mergedSteps.length; i++) {\n const currentT = mergedSteps[i].t\n if (currentT == null) {\n durations.push(null)\n continue\n }\n if (i + 1 < mergedSteps.length) {\n const nextT = mergedSteps[i + 1].t\n durations.push(nextT != null ? nextT - currentT : null)\n } else {\n // Last step: close it with the turn's total elapsed time.\n //\n // This is the one place two clocks meet \u2014 `totalElapsedTime` is the\n // client's wall-clock for a live turn, while `t` is the backend's\n // seconds-since-stream-start. They agree when the client watched the\n // whole stream, but a client that started late (a reconnect, or a\n // background conversation opened mid-run) measures less than the\n // backend, and the subtraction goes negative: the trace rendered\n // \"Answered \u221221.9s\". Show nothing rather than a duration we know is\n // wrong \u2014 a settled turn re-read from history uses the backend's own\n // completed `t`, so it stays consistent there.\n const remaining = totalElapsedTime != null ? totalElapsedTime - currentT : null\n durations.push(remaining != null && remaining >= 0 ? remaining : null)\n }\n }\n return durations\n }, [mergedSteps, totalElapsedTime])\n\n // Display step_tokens (per-step cost) directly from the backend.\n const stepTokens = useMemo(() => {\n return mergedSteps.map((step) => step.step_tokens ?? null)\n }, [mergedSteps])\n\n // Per-step \u00A3 cost \u2014 an estimate (cached model pricing, not the\n // authoritative LiteLLM cost), but useful to see which step is expensive\n // while the turn is still streaming. User-facing (unlike step_tokens,\n // which is raw and developer-gated) since \u00A3 is the budget unit the\n // user actually spends against.\n const stepGbp = useMemo(() => {\n return mergedSteps.map((step) => step.step_gbp ?? null)\n }, [mergedSteps])\n\n // Following the run is the HOST's job, not this list's: AgentBarShell pins\n // its drawer to the bottom while the user hasn't scrolled away. A\n // scrollIntoView here looked like it nudged \"the nearest scroll container\",\n // but it scrolls EVERY ancestor short of the viewport \u2014 each streamed tick\n // yanked the whole conversation back to this list while the user was\n // reading elsewhere on the page.\n const currentStepIndex = isStreaming ? getCurrentStep(mergedSteps)?.index : undefined\n\n if (mergedSteps.length === 0) return null\n\n // Two groupings run in one pass:\n // \u2022 Concurrent sub-agent LANES \u2014 steps carrying a `subagent` handle are pulled\n // into their own live lane (spawn marker \u2192 intermediate steps \u2192 done marker),\n // rendered as a card at the position of the lane's spawn. Multiple children\n // running at once each get their own lane, so fan-out reads as parallel work.\n // \u2022 Legacy parent_index NESTING \u2014 a handle-less sub-step (older single-child\n // relays) still indents under the parent tool step that spawned it.\n const posByIndex = new Map(mergedSteps.map((s, idx) => [s.index, idx]))\n const childrenByParent = new Map<number, AgentStepEvent[]>()\n const topLevelSteps: AgentStepEvent[] = []\n const laneStepsByHandle = new Map<string, AgentStepEvent[]>()\n const laneSpawnIndex = new Map<string, number>()\n for (const step of mergedSteps) {\n const handle = step.subagent\n if (handle) {\n const arr = laneStepsByHandle.get(handle)\n if (arr) arr.push(step)\n else {\n laneStepsByHandle.set(handle, [step])\n laneSpawnIndex.set(handle, step.index)\n }\n continue\n }\n const parent = step.parent_index\n if (parent != null && parent !== step.index && posByIndex.has(parent)) {\n const siblings = childrenByParent.get(parent) ?? []\n siblings.push(step)\n childrenByParent.set(parent, siblings)\n } else {\n topLevelSteps.push(step)\n }\n }\n\n // Interleave top-level steps and lanes by index, so a lane appears exactly where\n // its child was spawned in the parent's timeline.\n type DisplayRow = { index: number; step?: AgentStepEvent; lane?: string }\n const displayRows: DisplayRow[] = [\n ...topLevelSteps.map((s) => ({ index: s.index, step: s })),\n ...[...laneStepsByHandle.keys()].map((h) => ({ index: laneSpawnIndex.get(h) ?? 0, lane: h })),\n ].sort((a, b) => a.index - b.index)\n\n // Display numbers: top-level rows read 1..N (lanes count as a row); a fold's\n // inner rows read \"<parent>.<n>\".\n const displayNumber = new Map<number, string>()\n displayRows.forEach((r, i) => {\n if (r.lane) {\n // Lane inner steps read \"<lane>.<n>\".\n laneStepsByHandle\n .get(r.lane)\n ?.filter((s) => !s.subagent_status)\n .forEach((c, ci) => displayNumber.set(c.index, `${i + 1}.${ci + 1}`))\n return\n }\n displayNumber.set(r.step!.index, String(i + 1))\n childrenByParent\n .get(r.step!.index)\n ?.forEach((c, ci) => displayNumber.set(c.index, `${i + 1}.${ci + 1}`))\n })\n\n const lastStepIndex = mergedSteps[mergedSteps.length - 1].index\n\n const renderRow = (step: AgentStepEvent, depth: number, isLastInList: boolean) => {\n const i = posByIndex.get(step.index)!\n const presentation = getAgentStepPresentation(step, docInfo)\n const { tool, Icon } = presentation\n const { label, summary, isMultiLine, details } = getStepDisplay(step, docInfo)\n const accent = stepAccent(step, tool)\n const duration = stepDurations[i]\n const isLastStep = step.index === lastStepIndex\n const isActive = step.index === currentStepIndex\n\n // Goal-step model tier icon (auto mode) \u2014 the tier the router picked. It\n // stands in for the goal step's raw outcome (\"fast, all 0 docs\"), so it\n // carries a tooltip: an unlabelled glyph would just be cryptic noise.\n const tier = step.step === 'goal' ? step.model_recommendation : null\n const TierIcon = tier ? MODEL_TIER_ICON_MAP[tier] : null\n\n // The last step during streaming renders its duration through a leaf that\n // subscribes to the message timer directly, keeping the 10 Hz tick\n // contained so AgentSteps and its parent stay stable across timer updates.\n const useLiveDuration = isLastStep && liveTimer != null && step.t != null\n const durationNode: React.ReactNode = useLiveDuration ? (\n <MessageLiveSeconds\n {...liveTimer!}\n offsetSeconds={step.t!}\n fallbackSeconds={totalElapsedTime ?? null}\n minDisplaySeconds={0.05}\n />\n ) : duration != null ? (\n `${duration.toFixed(1)}s`\n ) : null\n\n // The goal step's outcome is internal routing (\"fast, all 0 docs\") \u2014 cryptic\n // to a reader and redundant with the model-tier icon beside the label. Tool\n // outcomes (\"15 passages retrieved\") are real feedback, so those stay.\n const showOutcome = step.outcome && step.step !== 'goal'\n // A green tick on \"exit 1\" claims the step succeeded when it didn't \u2014 the\n // code agent's first attempt failing then retrying is exactly the story the\n // trace should tell honestly.\n const outcomeFailed = !!step.outcome && isFailureOutcome(step.outcome)\n\n // Raw tool params are a developer affordance, and only when the backend\n // gave us no summary to show instead.\n const hasSummary = step.detail?.some((d) => (d as { summary?: string }).summary)\n const toolParams =\n isDeveloper && step.detail && !step.step && !hasSummary\n ? step.detail.flatMap((d) => getToolParams(d as Record<string, unknown>))\n : []\n\n const criteria =\n step.step === 'goal_progress' && step.detail && step.detail.length > 0\n ? (step.detail as Array<{\n criterion?: string\n text?: string\n status?: string\n note?: string\n }>)\n : null\n\n const criteriaView: GoalCriterionView[] | null = criteria\n ? criteria.map((c, idx) => ({\n key: c.criterion ?? String(idx),\n text: c.text || c.criterion || '',\n note: c.note,\n met: isCriterionMet(c.status),\n }))\n : null\n const folded = childrenByParent.get(step.index)\n\n return (\n <StepRow\n key={step.index}\n index={step.index}\n number={displayNumber.get(step.index) ?? String(i + 1)}\n depth={depth}\n isLast={isLastInList}\n isActive={isActive}\n accent={accent}\n icon={<Icon size={12} strokeWidth={2.25} />}\n kind={step.narration ? 'narration' : (step.step ?? 'tool')}\n title={isActive ? presentation.description : label}\n titleTestId={isActive ? 'agent-expanded-current-step-description' : undefined}\n badge={\n TierIcon ? (\n <Tooltip>\n <TooltipTrigger asChild>\n <span className=\"flex shrink-0 items-center self-center\">\n <TierIcon size={12} className={accent.fg} aria-hidden />\n </span>\n </TooltipTrigger>\n <TooltipContent side=\"top\">{MODEL_TIER_LABELS[tier!] ?? tier}</TooltipContent>\n </Tooltip>\n ) : undefined\n }\n meta={\n <>\n {isDeveloper && (\n <StepModelIcon modelName={step.usage?.model} tag={getModelTag(step.usage?.model)} />\n )}\n {isDeveloper && stepTokens[i] != null && (\n <span>{formatTokens(stepTokens[i]!)} tok</span>\n )}\n {/* Not on the active row: this step's cost is a frozen snapshot of the ONE LLM call\n that produced it; next to a spinner it would read as \"still counting\". */}\n {!isActive && stepGbp[i] != null && <span>{formatGbp(stepGbp[i]!)}</span>}\n {durationNode != null && <span>{durationNode}</span>}\n </>\n }\n >\n {summary &&\n !isActive &&\n (step.narration ? (\n /* Narration is PROSE (headings, bold, lists): render markdown, not raw asterisks.\n Tool summaries stay plain text: one-line headlines where a clamp matters. */\n <StepNarration index={step.index}>\n <ConnectedMarkdown isStreaming={false}>{summary}</ConnectedMarkdown>\n </StepNarration>\n ) : (\n <StepSummary index={step.index} multiLine={isMultiLine}>\n {summary}\n </StepSummary>\n ))}\n\n {/* What the narrative displaced: the tool's target or a plan's checklist. Dimmer than\n the summary: it answers \"on what?\", not \"doing what?\". */}\n {details.map((d, di) => (\n <StepDetail key={di} index={step.index}>\n {d}\n </StepDetail>\n ))}\n\n {showOutcome && (\n <StepOutcome index={step.index} failed={outcomeFailed}>\n {step.outcome}\n </StepOutcome>\n )}\n\n {toolParams.length > 0 && (\n <StepParams>{toolParams.map((p) => `${p.key}=${p.value}`).join(' ')}</StepParams>\n )}\n\n {step.routing && (\n <details className=\"mt-1 text-xs text-muted-foreground\" data-testid=\"routing-details\">\n <summary className=\"cursor-pointer\">Routing details</summary>\n <dl className=\"mt-2 space-y-2\">\n <div>\n <dt className=\"font-medium\">Answer model</dt>\n <dd>\n {step.routing.selected_model}\n {step.routing.model_recommendation\n ? ` (${step.routing.model_recommendation})`\n : ''}\n </dd>\n </div>\n <div>\n <dt className=\"font-medium\">Default document search</dt>\n <dd>\n {step.routing.selected_doc_ext_ids.length\n ? step.routing.selected_doc_ext_ids\n .map((id) => docInfo[id]?.name ?? step.routing!.document_titles[id] ?? id)\n .join(', ')\n : 'No documents selected'}\n </dd>\n <dd>The complete document catalogue remains available for direct reading.</dd>\n </div>\n <div>\n <dt className=\"font-medium\">Always available tools</dt>\n <dd>\n {step.routing.always_available_tool_names\n .map((name) => name.replaceAll('_', ' '))\n .join(', ') || 'None'}\n </dd>\n </div>\n <div>\n <dt className=\"font-medium\">Additional tools</dt>\n <dd>\n {step.routing.selected_tool_names == null\n ? 'All enabled tools retained'\n : step.routing.selected_tool_names\n .filter((name) => !step.routing!.always_available_tool_names.includes(name))\n .map((name) => name.replaceAll('_', ' '))\n .join(', ') || 'None'}\n </dd>\n </div>\n <div>\n <dt className=\"font-medium\">History</dt>\n <dd>\n {step.routing.retained_message_ext_ids.length} messages retained\n {step.routing.history_retained_by_policy\n ? '; full history preserved by policy'\n : ''}\n </dd>\n </div>\n <div>\n <dt className=\"font-medium\">Router</dt>\n <dd>\n {step.routing.router_model} \u00B7 {step.routing.elapsed_seconds.toFixed(3)}s\n {step.routing.input_tokens != null\n ? ` \u00B7 ${step.routing.input_tokens.toLocaleString()} input tokens`\n : ''}\n </dd>\n </div>\n {step.routing.status === 'fallback' && (\n <div>\n <dt className=\"font-medium\">Fallback</dt>\n <dd>\n Context and authorized tools retained (\n {step.routing.fallback_reason ?? 'router unavailable'}).\n </dd>\n </div>\n )}\n </dl>\n </details>\n )}\n\n {criteriaView && <GoalCriteria criteria={criteriaView} />}\n\n {/* Sub-agent steps nest under the tool step that spawned them, COLLAPSED: a\n deep_research run emits a dozen inner rows that buried the parent trace. The parent\n keeps the count so the work is never hidden, just folded. */}\n {folded && folded.length > 0 && (\n <SubStepGroup\n parentIndex={step.index}\n summary={summariseSubSteps(folded)}\n openClassName={accent.fg}\n renderSteps={() =>\n folded.map((c, ci, arr) => renderRow(c, depth + 1, ci === arr.length - 1))\n }\n />\n )}\n </StepRow>\n )\n }\n\n let summaryNode: React.ReactNode = null\n if (contextUsage?.spent_gbp != null) {\n const runStats = computeRunStats(steps)\n // Prefer the run's true cumulative totals (summed across every LLM call this turn made) over\n // total_input/total_output, which mirror only the last call's context.\n const totalInputTokens = contextUsage.all_llm_calls?.input_tokens ?? contextUsage.total_input\n const totalOutputTokens = contextUsage.all_llm_calls?.output_tokens ?? contextUsage.total_output\n const leftParts = [\n `${displayRows.length} step${displayRows.length !== 1 ? 's' : ''}`,\n `${runStats.toolCalls} tool call${runStats.toolCalls !== 1 ? 's' : ''}`,\n ]\n if (totalElapsedTime != null) leftParts.push(`${totalElapsedTime.toFixed(1)}s`)\n leftParts.push(`${formatTokens(totalInputTokens)} in`)\n if (totalOutputTokens > 0) leftParts.push(`${formatTokens(totalOutputTokens)} out`)\n summaryNode = (\n <StepTraceSummary\n left={leftParts.join(' \u00B7 ')}\n isNearBudget={isNearAiUsageBudget(contextUsage)}\n total={`Total: ${formatGbp(contextUsage.spent_gbp)}`}\n />\n )\n }\n\n return (\n <StepTrace className={className} summary={summaryNode}>\n {displayRows.map((row, i) => {\n if (row.lane) {\n return (\n <LaneBinding\n key={`lane-${row.lane}`}\n handle={row.lane}\n steps={laneStepsByHandle.get(row.lane)!}\n number={i + 1}\n renderRow={renderRow}\n isStreaming={isStreaming}\n />\n )\n }\n const parent = row.step!\n return renderRow(\n parent,\n 0,\n i === displayRows.length - 1 && !childrenByParent.has(parent.index)\n )\n })}\n </StepTrace>\n )\n}\n\n/** Binds a sub-agent's lifecycle steps to the `SubAgentLane` block. */\nfunction LaneBinding({\n handle,\n steps,\n number,\n renderRow,\n isStreaming,\n}: {\n handle: string\n steps: AgentStepEvent[]\n number: number\n renderRow: (step: AgentStepEvent, depth: number, isLastInList: boolean) => React.ReactNode\n isStreaming: boolean\n}) {\n // The spawn marker (`subagent_status: \"running\"`) carries the child's task; a `done`/`failed`\n // marker closes it; in between are the child's own steps.\n const spawn = steps.find((s) => s.subagent_status === 'running')\n const closed = steps.find((s) => s.subagent_status === 'done' || s.subagent_status === 'failed')\n const failed = steps.some((s) => s.subagent_status === 'failed')\n const inner = steps.filter((s) => !s.subagent_status)\n const task = (spawn?.content || spawn?.focus || '').trim()\n const running = !closed && isStreaming\n // What the child is doing RIGHT NOW: its latest step's focus/label.\n const latest = inner[inner.length - 1]\n return (\n <SubAgentLane\n handle={handle}\n number={number}\n // Name the lane by its JOB, never \"sub-1\": the handle is only a stable key.\n job={subagentJobLabel(task) || `Sub-agent ${handle}`}\n task={task}\n status={running ? 'running' : failed ? 'failed' : 'done'}\n innerCount={inner.length}\n liveFocus={latest ? latest.focus?.trim() || getAgentStepLabel(latest) : ''}\n renderSteps={() => inner.map((s, i) => renderRow(s, 1, i === inner.length - 1))}\n />\n )\n}\n\n/** Summarise folded sub-steps by what they did, e.g. \"3 searches, 2 reads\". */\nfunction summariseSubSteps(steps: AgentStepEvent[]): string {\n const counts = new Map<string, number>()\n for (const s of steps) {\n const noun = subStepNoun(getStepTool(s))\n counts.set(noun, (counts.get(noun) ?? 0) + 1)\n }\n return [...counts.entries()]\n .map(([noun, n]) => `${n} ${n === 1 ? noun : pluralise(noun)}`)\n .join(', ')\n}\n\n/** `met` (and `absent_from_corpus`, which the gate accepts) tick; anything else stays open. */\nfunction isCriterionMet(status?: string): boolean {\n return status === 'met' || status === 'absent_from_corpus'\n}\n\n/**\n * Does this outcome describe a failure?\n *\n * Outcomes are free text from the backend (\"exit 0 \u00B7 1.2s\", \"15 passages\n * retrieved\", \"timed out \u00B7 30.0s\"), so this reads the few shapes that carry a\n * verdict and defaults to \"not a failure\" for the rest \u2014 a false alarm on a\n * successful step is worse than a neutral chip.\n */\nfunction isFailureOutcome(outcome: string): boolean {\n const o = outcome.toLowerCase()\n if (/\\bexit\\s+0\\b/.test(o)) return false\n return /\\bexit\\s+[1-9]/.test(o) || /timed out|timeout|failed|error\\b/.test(o)\n}\n\n/** What one inner step *is*, for the collapsed summary line. */\nfunction subStepNoun(tool: string | undefined): string {\n switch (tool) {\n case 'search_inside_documents':\n case 'search_conversations':\n case 'web_search':\n return 'search'\n case 'read_document':\n case 'read_url':\n case 'view_document_pages':\n case 'get_table_of_contents':\n return 'read'\n case 'execute_code':\n case 'spawn_coding_agent':\n return 'run'\n case 'create_plan':\n return 'plan'\n default:\n return 'step'\n }\n}\n\nfunction pluralise(noun: string): string {\n return noun.endsWith('h') ? `${noun}es` : `${noun}s`\n}\n\nexport const AgentSteps = React.memo(AgentStepsComponent, (prev, next) => {\n return (\n prev.isStreaming === next.isStreaming &&\n prev.className === next.className &&\n prev.totalElapsedTime === next.totalElapsedTime &&\n prev.steps === next.steps &&\n prev.liveTimer === next.liveTimer &&\n prev.hideLive === next.hideLive\n )\n})\n"],
|
|
5
|
-
"mappings": ";AA+EI,SAgUM,UA5TE,KAJR;AAzEJ;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,WAAW,oBAAoB,cAAc,uBAAuB;AAC7E,OAAO,SAAS,eAAe;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAAyD;AAClE,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAMP,MAAM,iBAAiB,oBAAI,IAAI,CAAC,QAAQ,SAAS,QAAQ,SAAS,CAAC;AAMnE,SAAS,cAAc,QAAwE;AAC7F,QAAM,SAAgD,CAAC;AACvD,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACjD,QAAI,eAAe,IAAI,GAAG,KAAK,SAAS,KAAM;AAC9C,UAAM,WAAW,OAAO,UAAU,WAAW,QAAQ,KAAK,UAAU,KAAK;AACzE,WAAO,KAAK,EAAE,KAAK,OAAO,SAAS,CAAC;AAAA,EACtC;AACA,SAAO;AACT;AAEA,SAAS,cAAc,EAAE,WAAW,IAAI,GAAsD;AAE5F,QAAM,MAA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aAAa,MAAM,KAAK,qBAAqB,CAAC,MAAM,SAAS;AACxE,SACE,KAAK,gBAAgB,KAAK,eAC1B,KAAK,cAAc,KAAK,aACxB,KAAK,qBAAqB,KAAK,oBAC/B,KAAK,UAAU,KAAK,SACpB,KAAK,cAAc,KAAK,aACxB,KAAK,aAAa,KAAK;AAE3B,CAAC;",
|
|
4
|
+
"sourcesContent": ["/**\n * A turn's agent steps, bound to the session: the step trace (`StepTrace` and its rows) filled\n * from the step stream, with the workspace's document names, the model tiers, the developer\n * details and the live duration of the running step.\n */\n\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n getDocumentTitle,\n ProviderIcon,\n} from '@arbidocs/react/ui'\nimport {\n formatGbp,\n useAvailableModels,\n useDocuments,\n useInvalidateWorkflows,\n useInvalidateAssistant,\n useUserSettings,\n} from '@arbidocs/react'\nimport React, { useEffect, useMemo } from 'react'\nimport {\n GoalCriteria,\n StepDetail,\n StepNarration,\n StepOutcome,\n StepParams,\n StepRow,\n StepSummary,\n StepTrace,\n StepTraceSummary,\n SubAgentLane,\n SubStepGroup,\n type GoalCriterionView,\n} from '../../agents/runs/AgentSteps'\nimport {\n getAgentStepPresentation,\n getModelIcon,\n MODEL_TIER_ICON_MAP,\n MODEL_TIER_LABELS,\n stepAccent,\n} from '../../agents/runs/step-presentation'\nimport { MessageLiveSeconds, type MessageTimerSubscription } from './MessageLiveSeconds'\nimport { ConnectedMarkdown } from './ConnectedMarkdown'\nimport {\n computeRunStats,\n extractSubagentLanes,\n formatTokens,\n getAgentStepLabel,\n getCurrentStep,\n getStepDisplay,\n getStepTool,\n isNearAiUsageBudget,\n mergeAgentSteps,\n subagentJobLabel,\n type AgentStepEvent,\n type ContextUsage,\n type DocInfoMap,\n} from '@arbidocs/sdk/browser'\n\n/** A workspace document, as the step trace names it. */\ntype StepDocument = { external_id: string; file_name?: string | null; n_pages?: number | null }\n\n/** Fields injected by the backend for display \u2014 excluded from param rendering */\nconst DISPLAY_FIELDS = new Set(['tool', 'label', 'icon', 'summary'])\n\n/**\n * Extract tool parameters from a detail entry, excluding display fields.\n * Returns key-value pairs for inline rendering.\n */\nfunction getToolParams(detail: Record<string, unknown>): Array<{ key: string; value: string }> {\n const params: Array<{ key: string; value: string }> = []\n for (const [key, value] of Object.entries(detail)) {\n if (DISPLAY_FIELDS.has(key) || value == null) continue\n const strValue = typeof value === 'string' ? value : JSON.stringify(value)\n params.push({ key, value: strValue })\n }\n return params\n}\n\nfunction StepModelIcon({ modelName, tag }: { modelName?: string | null; tag: string | null }) {\n // Premium \u2192 brand mark; Fast/Wise \u2192 their name icon; otherwise the tag icon.\n const cfg = tag === 'Premium' ? null : getModelIcon(modelName, tag)\n if (tag !== 'Premium' && !cfg) return null\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <span className=\"flex-shrink-0\">\n {tag === 'Premium' ? (\n <ProviderIcon modelName={modelName ?? undefined} size={11} />\n ) : (\n cfg && <cfg.icon className={cfg.className} style={{ width: 11, height: 11 }} />\n )}\n </span>\n </TooltipTrigger>\n <TooltipContent>{modelName}</TooltipContent>\n </Tooltip>\n )\n}\n\ninterface AgentStepsProps {\n steps: AgentStepEvent[]\n isStreaming: boolean\n className?: string\n /**\n * Total elapsed seconds for the message \u2014 used as a static fallback for the\n * last step's duration when `liveTimer` is not provided (e.g. messages\n * loaded from history). When `liveTimer` is provided this prop is forwarded\n * to the leaf as the post-generation fallback.\n */\n totalElapsedTime?: number\n /**\n * Optional live-timer subscription. When provided, the last step's duration\n * is rendered by a leaf component so the parent does not re-render at the\n * 100 ms timer cadence.\n */\n liveTimer?: MessageTimerSubscription\n /**\n * When true (the live bar's expander), hide what the bar already shows live \u2014\n * the agent's current step and any still-running sub-agents \u2014 so the expander\n * is purely \"what came before\", never a duplicate of the footer. Finished\n * sub-agents stay (they're history). No effect once settled.\n */\n hideLive?: boolean\n /**\n * This turn's settled context/AI usage (\u00A3) (`message.finalContextUsage`).\n * \u00A3 spent belongs here, on the turn that spent them \u2014 not on the\n * composer's forward-looking context bar, which is about future messages.\n */\n contextUsage?: ContextUsage | null\n}\n\nconst AgentStepsComponent: React.FC<AgentStepsProps> = ({\n steps,\n isStreaming,\n className,\n totalElapsedTime,\n liveTimer,\n hideLive = false,\n contextUsage,\n}) => {\n const { data: userSettings } = useUserSettings()\n const isDeveloper = userSettings?.developer === true\n\n // The agent saved a workflow (create_workflow): refresh the workflow list once the turn ends, so it\n // shows without a reload.\n const invalidateWorkflows = useInvalidateWorkflows()\n const createdWorkflow = steps.some((step) => getStepTool(step) === 'create_workflow')\n useEffect(() => {\n if (createdWorkflow && !isStreaming) void invalidateWorkflows()\n // invalidateWorkflows is a new function each render; the effect runs on the turn's state only.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [createdWorkflow, isStreaming])\n\n // The person changed the Assistant's instructions (set_assistant_brief): an Assistant page open beside\n // the chat shows the new brief once the turn ends.\n const invalidateAssistant = useInvalidateAssistant()\n const setBrief = steps.some((step) => getStepTool(step) === 'set_assistant_brief')\n useEffect(() => {\n if (setBrief && !isStreaming) void invalidateAssistant()\n // invalidateAssistant is a new function each render; the effect runs on the turn's state only.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [setBrief, isStreaming])\n\n // Build doc_ext_id \u2192 {name, pages} map from workspace documents (cached by React Query)\n const { data: documents = [] } = useDocuments()\n const docInfo = useMemo(() => {\n const map: DocInfoMap = {}\n const docArray = Array.isArray(documents) ? documents : []\n for (const doc of docArray) {\n if (doc && 'external_id' in doc) {\n const d = doc as StepDocument\n // Use the canonical document entity label (doc_metadata.title ?? file\n // name), not the raw file name, so references resolve to the same name\n // the rest of the app shows.\n map[d.external_id] = {\n name: getDocumentTitle(d, d.file_name ?? d.external_id),\n pages: d.n_pages ?? null,\n }\n }\n }\n return map\n }, [documents])\n\n // Resolve model name \u2192 tag for looking up tier icons\n const { data: availableModels } = useAvailableModels()\n const getModelTag = useMemo(() => {\n return (modelName?: string | null): string | null => {\n if (!modelName || !availableModels?.models) return null\n return availableModels.models.find((m) => m.model_name === modelName)?.tags?.[0] || null\n }\n }, [availableModels])\n\n // Raw SSE events \u2192 the logical steps a reader sees. Shared with the `Step N`\n // counter so the count always matches the rows rendered below.\n //\n // When `hideLive` (the live bar's expander), the current step STAYS \u2014 the\n // drawer is a complete, correctly-numbered list with the active step\n // highlighted as the last row, matching the \"Step N\" position on the bar.\n // (Dropping it made the drawer show N-1 rows while the bar said N, and marked\n // the *previous* step active.) Still-running sub-agents are the one thing\n // dropped: they have their own live lanes in the roster beneath the bar, so\n // showing them here too would double-render them.\n const mergedSteps = useMemo(() => {\n const merged = mergeAgentSteps(steps)\n if (!hideLive) return merged\n const runningHandles = new Set(\n extractSubagentLanes(merged)\n .filter((l) => l.status === 'running')\n .map((l) => l.handle)\n )\n return merged.filter((s) => !(s.subagent && runningHandles.has(s.subagent)))\n }, [steps, hideLive])\n\n // Compute step durations: duration = next_step.t - current_step.t\n // For the last step, use totalElapsedTime (frontend timer) if available\n const stepDurations = useMemo(() => {\n const durations: (number | null)[] = []\n for (let i = 0; i < mergedSteps.length; i++) {\n const currentT = mergedSteps[i].t\n if (currentT == null) {\n durations.push(null)\n continue\n }\n if (i + 1 < mergedSteps.length) {\n const nextT = mergedSteps[i + 1].t\n durations.push(nextT != null ? nextT - currentT : null)\n } else {\n // Last step: close it with the turn's total elapsed time.\n //\n // This is the one place two clocks meet \u2014 `totalElapsedTime` is the\n // client's wall-clock for a live turn, while `t` is the backend's\n // seconds-since-stream-start. They agree when the client watched the\n // whole stream, but a client that started late (a reconnect, or a\n // background conversation opened mid-run) measures less than the\n // backend, and the subtraction goes negative: the trace rendered\n // \"Answered \u221221.9s\". Show nothing rather than a duration we know is\n // wrong \u2014 a settled turn re-read from history uses the backend's own\n // completed `t`, so it stays consistent there.\n const remaining = totalElapsedTime != null ? totalElapsedTime - currentT : null\n durations.push(remaining != null && remaining >= 0 ? remaining : null)\n }\n }\n return durations\n }, [mergedSteps, totalElapsedTime])\n\n // Display step_tokens (per-step cost) directly from the backend.\n const stepTokens = useMemo(() => {\n return mergedSteps.map((step) => step.step_tokens ?? null)\n }, [mergedSteps])\n\n // Per-step \u00A3 cost \u2014 an estimate (cached model pricing, not the\n // authoritative LiteLLM cost), but useful to see which step is expensive\n // while the turn is still streaming. User-facing (unlike step_tokens,\n // which is raw and developer-gated) since \u00A3 is the budget unit the\n // user actually spends against.\n const stepGbp = useMemo(() => {\n return mergedSteps.map((step) => step.step_gbp ?? null)\n }, [mergedSteps])\n\n // Following the run is the HOST's job, not this list's: AgentBarShell pins\n // its drawer to the bottom while the user hasn't scrolled away. A\n // scrollIntoView here looked like it nudged \"the nearest scroll container\",\n // but it scrolls EVERY ancestor short of the viewport \u2014 each streamed tick\n // yanked the whole conversation back to this list while the user was\n // reading elsewhere on the page.\n const currentStepIndex = isStreaming ? getCurrentStep(mergedSteps)?.index : undefined\n\n if (mergedSteps.length === 0) return null\n\n // Two groupings run in one pass:\n // \u2022 Concurrent sub-agent LANES \u2014 steps carrying a `subagent` handle are pulled\n // into their own live lane (spawn marker \u2192 intermediate steps \u2192 done marker),\n // rendered as a card at the position of the lane's spawn. Multiple children\n // running at once each get their own lane, so fan-out reads as parallel work.\n // \u2022 Legacy parent_index NESTING \u2014 a handle-less sub-step (older single-child\n // relays) still indents under the parent tool step that spawned it.\n const posByIndex = new Map(mergedSteps.map((s, idx) => [s.index, idx]))\n const childrenByParent = new Map<number, AgentStepEvent[]>()\n const topLevelSteps: AgentStepEvent[] = []\n const laneStepsByHandle = new Map<string, AgentStepEvent[]>()\n const laneSpawnIndex = new Map<string, number>()\n for (const step of mergedSteps) {\n const handle = step.subagent\n if (handle) {\n const arr = laneStepsByHandle.get(handle)\n if (arr) arr.push(step)\n else {\n laneStepsByHandle.set(handle, [step])\n laneSpawnIndex.set(handle, step.index)\n }\n continue\n }\n const parent = step.parent_index\n if (parent != null && parent !== step.index && posByIndex.has(parent)) {\n const siblings = childrenByParent.get(parent) ?? []\n siblings.push(step)\n childrenByParent.set(parent, siblings)\n } else {\n topLevelSteps.push(step)\n }\n }\n\n // Interleave top-level steps and lanes by index, so a lane appears exactly where\n // its child was spawned in the parent's timeline.\n type DisplayRow = { index: number; step?: AgentStepEvent; lane?: string }\n const displayRows: DisplayRow[] = [\n ...topLevelSteps.map((s) => ({ index: s.index, step: s })),\n ...[...laneStepsByHandle.keys()].map((h) => ({ index: laneSpawnIndex.get(h) ?? 0, lane: h })),\n ].sort((a, b) => a.index - b.index)\n\n // Display numbers: top-level rows read 1..N (lanes count as a row); a fold's\n // inner rows read \"<parent>.<n>\".\n const displayNumber = new Map<number, string>()\n displayRows.forEach((r, i) => {\n if (r.lane) {\n // Lane inner steps read \"<lane>.<n>\".\n laneStepsByHandle\n .get(r.lane)\n ?.filter((s) => !s.subagent_status)\n .forEach((c, ci) => displayNumber.set(c.index, `${i + 1}.${ci + 1}`))\n return\n }\n displayNumber.set(r.step!.index, String(i + 1))\n childrenByParent\n .get(r.step!.index)\n ?.forEach((c, ci) => displayNumber.set(c.index, `${i + 1}.${ci + 1}`))\n })\n\n const lastStepIndex = mergedSteps[mergedSteps.length - 1].index\n\n const renderRow = (step: AgentStepEvent, depth: number, isLastInList: boolean) => {\n const i = posByIndex.get(step.index)!\n const presentation = getAgentStepPresentation(step, docInfo)\n const { tool, Icon } = presentation\n const { label, summary, isMultiLine, details } = getStepDisplay(step, docInfo)\n const accent = stepAccent(step, tool)\n const duration = stepDurations[i]\n const isLastStep = step.index === lastStepIndex\n const isActive = step.index === currentStepIndex\n\n // Goal-step model tier icon (auto mode) \u2014 the tier the router picked. It\n // stands in for the goal step's raw outcome (\"fast, all 0 docs\"), so it\n // carries a tooltip: an unlabelled glyph would just be cryptic noise.\n const tier = step.step === 'goal' ? step.model_recommendation : null\n const TierIcon = tier ? MODEL_TIER_ICON_MAP[tier] : null\n\n // The last step during streaming renders its duration through a leaf that\n // subscribes to the message timer directly, keeping the 10 Hz tick\n // contained so AgentSteps and its parent stay stable across timer updates.\n const useLiveDuration = isLastStep && liveTimer != null && step.t != null\n const durationNode: React.ReactNode = useLiveDuration ? (\n <MessageLiveSeconds\n {...liveTimer!}\n offsetSeconds={step.t!}\n fallbackSeconds={totalElapsedTime ?? null}\n minDisplaySeconds={0.05}\n />\n ) : duration != null ? (\n `${duration.toFixed(1)}s`\n ) : null\n\n // The goal step's outcome is internal routing (\"fast, all 0 docs\") \u2014 cryptic\n // to a reader and redundant with the model-tier icon beside the label. Tool\n // outcomes (\"15 passages retrieved\") are real feedback, so those stay.\n const showOutcome = step.outcome && step.step !== 'goal'\n // A green tick on \"exit 1\" claims the step succeeded when it didn't \u2014 the\n // code agent's first attempt failing then retrying is exactly the story the\n // trace should tell honestly.\n const outcomeFailed = !!step.outcome && isFailureOutcome(step.outcome)\n\n // Raw tool params are a developer affordance, and only when the backend\n // gave us no summary to show instead.\n const hasSummary = step.detail?.some((d) => (d as { summary?: string }).summary)\n const toolParams =\n isDeveloper && step.detail && !step.step && !hasSummary\n ? step.detail.flatMap((d) => getToolParams(d as Record<string, unknown>))\n : []\n\n const criteria =\n step.step === 'goal_progress' && step.detail && step.detail.length > 0\n ? (step.detail as Array<{\n criterion?: string\n text?: string\n status?: string\n note?: string\n }>)\n : null\n\n const criteriaView: GoalCriterionView[] | null = criteria\n ? criteria.map((c, idx) => ({\n key: c.criterion ?? String(idx),\n text: c.text || c.criterion || '',\n note: c.note,\n met: isCriterionMet(c.status),\n }))\n : null\n const folded = childrenByParent.get(step.index)\n\n return (\n <StepRow\n key={step.index}\n index={step.index}\n number={displayNumber.get(step.index) ?? String(i + 1)}\n depth={depth}\n isLast={isLastInList}\n isActive={isActive}\n accent={accent}\n icon={<Icon size={12} strokeWidth={2.25} />}\n kind={step.narration ? 'narration' : (step.step ?? 'tool')}\n title={isActive ? presentation.description : label}\n titleTestId={isActive ? 'agent-expanded-current-step-description' : undefined}\n badge={\n TierIcon ? (\n <Tooltip>\n <TooltipTrigger asChild>\n <span className=\"flex shrink-0 items-center self-center\">\n <TierIcon size={12} className={accent.fg} aria-hidden />\n </span>\n </TooltipTrigger>\n <TooltipContent side=\"top\">{MODEL_TIER_LABELS[tier!] ?? tier}</TooltipContent>\n </Tooltip>\n ) : undefined\n }\n meta={\n <>\n {isDeveloper && (\n <StepModelIcon modelName={step.usage?.model} tag={getModelTag(step.usage?.model)} />\n )}\n {isDeveloper && stepTokens[i] != null && (\n <span>{formatTokens(stepTokens[i]!)} tok</span>\n )}\n {/* Not on the active row: this step's cost is a frozen snapshot of the ONE LLM call\n that produced it; next to a spinner it would read as \"still counting\". */}\n {!isActive && stepGbp[i] != null && <span>{formatGbp(stepGbp[i]!)}</span>}\n {durationNode != null && <span>{durationNode}</span>}\n </>\n }\n >\n {summary &&\n !isActive &&\n (step.narration ? (\n /* Narration is PROSE (headings, bold, lists): render markdown, not raw asterisks.\n Tool summaries stay plain text: one-line headlines where a clamp matters. */\n <StepNarration index={step.index}>\n <ConnectedMarkdown isStreaming={false}>{summary}</ConnectedMarkdown>\n </StepNarration>\n ) : (\n <StepSummary index={step.index} multiLine={isMultiLine}>\n {summary}\n </StepSummary>\n ))}\n\n {/* What the narrative displaced: the tool's target or a plan's checklist. Dimmer than\n the summary: it answers \"on what?\", not \"doing what?\". */}\n {details.map((d, di) => (\n <StepDetail key={di} index={step.index}>\n {d}\n </StepDetail>\n ))}\n\n {showOutcome && (\n <StepOutcome index={step.index} failed={outcomeFailed}>\n {step.outcome}\n </StepOutcome>\n )}\n\n {toolParams.length > 0 && (\n <StepParams>{toolParams.map((p) => `${p.key}=${p.value}`).join(' ')}</StepParams>\n )}\n\n {step.routing && (\n <details className=\"mt-1 text-xs text-muted-foreground\" data-testid=\"routing-details\">\n <summary className=\"cursor-pointer\">Routing details</summary>\n <dl className=\"mt-2 space-y-2\">\n <div>\n <dt className=\"font-medium\">Answer model</dt>\n <dd>\n {step.routing.selected_model}\n {step.routing.model_recommendation\n ? ` (${step.routing.model_recommendation})`\n : ''}\n </dd>\n </div>\n <div>\n <dt className=\"font-medium\">Default document search</dt>\n <dd>\n {step.routing.selected_doc_ext_ids.length\n ? step.routing.selected_doc_ext_ids\n .map((id) => docInfo[id]?.name ?? step.routing!.document_titles[id] ?? id)\n .join(', ')\n : 'No documents selected'}\n </dd>\n <dd>The complete document catalogue remains available for direct reading.</dd>\n </div>\n <div>\n <dt className=\"font-medium\">Always available tools</dt>\n <dd>\n {step.routing.always_available_tool_names\n .map((name) => name.replaceAll('_', ' '))\n .join(', ') || 'None'}\n </dd>\n </div>\n <div>\n <dt className=\"font-medium\">Additional tools</dt>\n <dd>\n {step.routing.selected_tool_names == null\n ? 'All enabled tools retained'\n : step.routing.selected_tool_names\n .filter((name) => !step.routing!.always_available_tool_names.includes(name))\n .map((name) => name.replaceAll('_', ' '))\n .join(', ') || 'None'}\n </dd>\n </div>\n <div>\n <dt className=\"font-medium\">History</dt>\n <dd>\n {step.routing.retained_message_ext_ids.length} messages retained\n {step.routing.history_retained_by_policy\n ? '; full history preserved by policy'\n : ''}\n </dd>\n </div>\n <div>\n <dt className=\"font-medium\">Router</dt>\n <dd>\n {step.routing.router_model} \u00B7 {step.routing.elapsed_seconds.toFixed(3)}s\n {step.routing.input_tokens != null\n ? ` \u00B7 ${step.routing.input_tokens.toLocaleString()} input tokens`\n : ''}\n </dd>\n </div>\n {step.routing.status === 'fallback' && (\n <div>\n <dt className=\"font-medium\">Fallback</dt>\n <dd>\n Context and authorized tools retained (\n {step.routing.fallback_reason ?? 'router unavailable'}).\n </dd>\n </div>\n )}\n </dl>\n </details>\n )}\n\n {criteriaView && <GoalCriteria criteria={criteriaView} />}\n\n {/* Sub-agent steps nest under the tool step that spawned them, COLLAPSED: a\n deep_research run emits a dozen inner rows that buried the parent trace. The parent\n keeps the count so the work is never hidden, just folded. */}\n {folded && folded.length > 0 && (\n <SubStepGroup\n parentIndex={step.index}\n summary={summariseSubSteps(folded)}\n openClassName={accent.fg}\n renderSteps={() =>\n folded.map((c, ci, arr) => renderRow(c, depth + 1, ci === arr.length - 1))\n }\n />\n )}\n </StepRow>\n )\n }\n\n let summaryNode: React.ReactNode = null\n if (contextUsage?.spent_gbp != null) {\n const runStats = computeRunStats(steps)\n // Prefer the run's true cumulative totals (summed across every LLM call this turn made) over\n // total_input/total_output, which mirror only the last call's context.\n const totalInputTokens = contextUsage.all_llm_calls?.input_tokens ?? contextUsage.total_input\n const totalOutputTokens = contextUsage.all_llm_calls?.output_tokens ?? contextUsage.total_output\n const leftParts = [\n `${displayRows.length} step${displayRows.length !== 1 ? 's' : ''}`,\n `${runStats.toolCalls} tool call${runStats.toolCalls !== 1 ? 's' : ''}`,\n ]\n if (totalElapsedTime != null) leftParts.push(`${totalElapsedTime.toFixed(1)}s`)\n leftParts.push(`${formatTokens(totalInputTokens)} in`)\n if (totalOutputTokens > 0) leftParts.push(`${formatTokens(totalOutputTokens)} out`)\n summaryNode = (\n <StepTraceSummary\n left={leftParts.join(' \u00B7 ')}\n isNearBudget={isNearAiUsageBudget(contextUsage)}\n total={`Total: ${formatGbp(contextUsage.spent_gbp)}`}\n />\n )\n }\n\n return (\n <StepTrace className={className} summary={summaryNode}>\n {displayRows.map((row, i) => {\n if (row.lane) {\n return (\n <LaneBinding\n key={`lane-${row.lane}`}\n handle={row.lane}\n steps={laneStepsByHandle.get(row.lane)!}\n number={i + 1}\n renderRow={renderRow}\n isStreaming={isStreaming}\n />\n )\n }\n const parent = row.step!\n return renderRow(\n parent,\n 0,\n i === displayRows.length - 1 && !childrenByParent.has(parent.index)\n )\n })}\n </StepTrace>\n )\n}\n\n/** Binds a sub-agent's lifecycle steps to the `SubAgentLane` block. */\nfunction LaneBinding({\n handle,\n steps,\n number,\n renderRow,\n isStreaming,\n}: {\n handle: string\n steps: AgentStepEvent[]\n number: number\n renderRow: (step: AgentStepEvent, depth: number, isLastInList: boolean) => React.ReactNode\n isStreaming: boolean\n}) {\n // The spawn marker (`subagent_status: \"running\"`) carries the child's task; a `done`/`failed`\n // marker closes it; in between are the child's own steps.\n const spawn = steps.find((s) => s.subagent_status === 'running')\n const closed = steps.find((s) => s.subagent_status === 'done' || s.subagent_status === 'failed')\n const failed = steps.some((s) => s.subagent_status === 'failed')\n const inner = steps.filter((s) => !s.subagent_status)\n const task = (spawn?.content || spawn?.focus || '').trim()\n const running = !closed && isStreaming\n // What the child is doing RIGHT NOW: its latest step's focus/label.\n const latest = inner[inner.length - 1]\n return (\n <SubAgentLane\n handle={handle}\n number={number}\n // Name the lane by its JOB, never \"sub-1\": the handle is only a stable key.\n job={subagentJobLabel(task) || `Sub-agent ${handle}`}\n task={task}\n status={running ? 'running' : failed ? 'failed' : 'done'}\n innerCount={inner.length}\n liveFocus={latest ? latest.focus?.trim() || getAgentStepLabel(latest) : ''}\n renderSteps={() => inner.map((s, i) => renderRow(s, 1, i === inner.length - 1))}\n />\n )\n}\n\n/** Summarise folded sub-steps by what they did, e.g. \"3 searches, 2 reads\". */\nfunction summariseSubSteps(steps: AgentStepEvent[]): string {\n const counts = new Map<string, number>()\n for (const s of steps) {\n const noun = subStepNoun(getStepTool(s))\n counts.set(noun, (counts.get(noun) ?? 0) + 1)\n }\n return [...counts.entries()]\n .map(([noun, n]) => `${n} ${n === 1 ? noun : pluralise(noun)}`)\n .join(', ')\n}\n\n/** `met` (and `absent_from_corpus`, which the gate accepts) tick; anything else stays open. */\nfunction isCriterionMet(status?: string): boolean {\n return status === 'met' || status === 'absent_from_corpus'\n}\n\n/**\n * Does this outcome describe a failure?\n *\n * Outcomes are free text from the backend (\"exit 0 \u00B7 1.2s\", \"15 passages\n * retrieved\", \"timed out \u00B7 30.0s\"), so this reads the few shapes that carry a\n * verdict and defaults to \"not a failure\" for the rest \u2014 a false alarm on a\n * successful step is worse than a neutral chip.\n */\nfunction isFailureOutcome(outcome: string): boolean {\n const o = outcome.toLowerCase()\n if (/\\bexit\\s+0\\b/.test(o)) return false\n return /\\bexit\\s+[1-9]/.test(o) || /timed out|timeout|failed|error\\b/.test(o)\n}\n\n/** What one inner step *is*, for the collapsed summary line. */\nfunction subStepNoun(tool: string | undefined): string {\n switch (tool) {\n case 'search_inside_documents':\n case 'search_conversations':\n case 'web_search':\n return 'search'\n case 'read_document':\n case 'read_url':\n case 'view_document_pages':\n case 'get_table_of_contents':\n return 'read'\n case 'execute_code':\n case 'spawn_coding_agent':\n return 'run'\n case 'create_plan':\n return 'plan'\n default:\n return 'step'\n }\n}\n\nfunction pluralise(noun: string): string {\n return noun.endsWith('h') ? `${noun}es` : `${noun}s`\n}\n\nexport const AgentSteps = React.memo(AgentStepsComponent, (prev, next) => {\n return (\n prev.isStreaming === next.isStreaming &&\n prev.className === next.className &&\n prev.totalElapsedTime === next.totalElapsedTime &&\n prev.steps === next.steps &&\n prev.liveTimer === next.liveTimer &&\n prev.hideLive === next.hideLive\n )\n})\n"],
|
|
5
|
+
"mappings": ";AAsFI,SAoVM,UAhVE,KAJR;AAhFJ;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,SAAS,WAAW,eAAe;AAC1C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAAyD;AAClE,SAAS,yBAAyB;AAClC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAMP,MAAM,iBAAiB,oBAAI,IAAI,CAAC,QAAQ,SAAS,QAAQ,SAAS,CAAC;AAMnE,SAAS,cAAc,QAAwE;AAC7F,QAAM,SAAgD,CAAC;AACvD,aAAW,CAAC,KAAK,KAAK,KAA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OAAO,UAAU,IAAI,CAAC,EAAE,EAC7D,KAAK,IAAI;AACd;AAGA,SAAS,eAAe,QAA0B;AAChD,SAAO,WAAW,SAAS,WAAW;AACxC;AAUA,SAAS,iBAAiB,SAA0B;AAClD,QAAM,IAAI,QAAQ,YAAY;AAC9B,MAAI,eAAe,KAAK,CAAC,EAAG,QAAO;AACnC,SAAO,iBAAiB,KAAK,CAAC,KAAK,mCAAmC,KAAK,CAAC;AAC9E;AAGA,SAAS,YAAY,MAAkC;AACrD,UAAQ,MAAM;AAAA,IACZ,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEA,SAAS,UAAU,MAAsB;AACvC,SAAO,KAAK,SAAS,GAAG,IAAI,GAAG,IAAI,OAAO,GAAG,IAAI;AACnD;AAEO,MAAM,aAAa,MAAM,KAAK,qBAAqB,CAAC,MAAM,SAAS;AACxE,SACE,KAAK,gBAAgB,KAAK,eAC1B,KAAK,cAAc,KAAK,aACxB,KAAK,qBAAqB,KAAK,oBAC/B,KAAK,UAAU,KAAK,SACpB,KAAK,cAAc,KAAK,aACxB,KAAK,aAAa,KAAK;AAE3B,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -94,6 +94,7 @@ import { useViewerBlobs } from "./useViewerBlobs.js";
|
|
|
94
94
|
import { useViewerTabs } from "./useViewerTabs.js";
|
|
95
95
|
import { useViewerVersions } from "./useViewerVersions.js";
|
|
96
96
|
import { VersionDropdown } from "./VersionDropdown.js";
|
|
97
|
+
import { useDocumentVersionRestore } from "./useDocumentVersionRestore.js";
|
|
97
98
|
import { ParsedTextView } from "./parsed/ParsedTextView.js";
|
|
98
99
|
import { ViewerPdfPane } from "./ViewerPdfPane.js";
|
|
99
100
|
import { ConnectedNativeDocxEditor as NativeDocxEditor } from "../docx/ConnectedNativeDocxEditor.js";
|
|
@@ -229,7 +230,7 @@ function DocumentViewerContent({
|
|
|
229
230
|
activeTab,
|
|
230
231
|
handleTabChange: changeTab,
|
|
231
232
|
viewerTabs
|
|
232
|
-
} = useViewerTabs(doc, isCompact, hasHistory);
|
|
233
|
+
} = useViewerTabs(doc, isCompact, hasHistory, !!snapshotDocumentId);
|
|
233
234
|
const saveWordRef = useRef(null);
|
|
234
235
|
const transitionPending = useRef(false);
|
|
235
236
|
const transitionKey = JSON.stringify([openedId, doc.workspaceId]);
|
|
@@ -455,6 +456,21 @@ function DocumentViewerContent({
|
|
|
455
456
|
}
|
|
456
457
|
void arbi.documents.update([{ external_id: documentId, shared: !documentData?.shared }]).then(() => tools.onDocumentsChanged?.([documentId], "markup")).catch(() => notify("Couldn't change who can see this document", "error"));
|
|
457
458
|
};
|
|
459
|
+
const {
|
|
460
|
+
canRestore,
|
|
461
|
+
restoring: restoringVersion,
|
|
462
|
+
restoreVersion: restoreSnapshot
|
|
463
|
+
} = useDocumentVersionRestore({
|
|
464
|
+
documentId,
|
|
465
|
+
document: documentData,
|
|
466
|
+
currentUserId,
|
|
467
|
+
onDocumentsChanged: tools.onDocumentsChanged,
|
|
468
|
+
onRestored: () => {
|
|
469
|
+
if (parseVersionRef(session.getState().viewingDocument?.id).docId !== documentId) return;
|
|
470
|
+
setSnapshotDocumentId(null);
|
|
471
|
+
setActiveTab(isPresentation ? "slides" : isDocx ? "docx" : isArtifact ? "edit" : "pdf");
|
|
472
|
+
}
|
|
473
|
+
});
|
|
458
474
|
const shownRef = snapshotDocumentId || documentId;
|
|
459
475
|
const rightContent = /* @__PURE__ */ jsxs(ViewerHeaderEnd, { isCompact, children: [
|
|
460
476
|
annotatable && /* @__PURE__ */ jsx(
|
|
@@ -714,6 +730,8 @@ function DocumentViewerContent({
|
|
|
714
730
|
versionNumber: snapshotNumber,
|
|
715
731
|
live: isDocx || isArtifact,
|
|
716
732
|
onAsk: support.askAboutVersion ? () => support.askAboutVersion(snapshotDocumentId) : void 0,
|
|
733
|
+
onRestore: canRestore ? () => void restoreSnapshot(snapshotDocumentId) : void 0,
|
|
734
|
+
restoring: restoringVersion,
|
|
717
735
|
onReturn: () => setSnapshotDocumentId(null)
|
|
718
736
|
}
|
|
719
737
|
)
|
|
@@ -827,12 +845,14 @@ function DocumentViewerContent({
|
|
|
827
845
|
setActiveTab(isArtifact ? "edit" : isDocx ? "docx" : "pdf");
|
|
828
846
|
},
|
|
829
847
|
onCompare: (id) => session.setDocumentViewer({ compareId: id, tab: "html" }),
|
|
848
|
+
restoring: restoringVersion,
|
|
849
|
+
onRestore: canRestore ? (id) => void restoreSnapshot(id) : void 0,
|
|
830
850
|
translations,
|
|
831
851
|
onOpenTranslation: (id) => setViewingDocumentId(id)
|
|
832
852
|
}
|
|
833
853
|
),
|
|
834
854
|
activeTab === "xlsx" && isXlsx && (xlsxBlob ? /* @__PURE__ */ jsx(XlsxViewer, { blob: xlsxBlob }) : /* @__PURE__ */ jsx(ViewerMessage, { children: xlsxError ? "Failed to load spreadsheet" : "Loading spreadsheet..." })),
|
|
835
|
-
activeTab === "slides" && isPresentation && /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(ViewerMessage, { children: "Loading slides\u2026" }), children: /* @__PURE__ */ jsx(
|
|
855
|
+
activeTab === "slides" && !snapshotDocumentId && isPresentation && /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(ViewerMessage, { children: "Loading slides\u2026" }), children: /* @__PURE__ */ jsx(
|
|
836
856
|
SlidesTab,
|
|
837
857
|
{
|
|
838
858
|
documentId,
|