@opengeni/react 4.0.2 → 4.0.5-canary.39118806767001
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/README.md +787 -26
- package/dist/accounts.js +2 -0
- package/dist/accounts.js.map +1 -1
- package/dist/approvals.d.ts +2 -1
- package/dist/artifacts-document.js +6 -3
- package/dist/artifacts-presentation.js +6 -3
- package/dist/artifacts-spreadsheet.d.ts +1 -1
- package/dist/artifacts-spreadsheet.js +6 -3
- package/dist/artifacts.d.ts +5 -1
- package/dist/artifacts.js +542 -278
- package/dist/artifacts.js.map +1 -1
- package/dist/browser-viewer-GEHX3KYE.js +20 -0
- package/dist/capability-catalog-row.d.ts +20 -0
- package/dist/capability-logo-fallback.d.ts +3 -0
- package/dist/chat-interactive-block-5V3BGLXT.js +15 -0
- package/dist/chunk-2DDJ6YH6.js +41 -0
- package/dist/chunk-2DDJ6YH6.js.map +1 -0
- package/dist/chunk-2EGXXUG4.js +1161 -0
- package/dist/chunk-2EGXXUG4.js.map +1 -0
- package/dist/chunk-2XKRY4GF.js +302 -0
- package/dist/chunk-2XKRY4GF.js.map +1 -0
- package/dist/chunk-2ZUUIMBY.js +343 -0
- package/dist/chunk-2ZUUIMBY.js.map +1 -0
- package/dist/chunk-4F4FGCH2.js +34 -0
- package/dist/chunk-4F4FGCH2.js.map +1 -0
- package/dist/{chunk-Z7WBDB4E.js → chunk-4M2MJLY3.js} +848 -867
- package/dist/chunk-4M2MJLY3.js.map +1 -0
- package/dist/chunk-4U7SHFQ2.js +193 -0
- package/dist/chunk-4U7SHFQ2.js.map +1 -0
- package/dist/chunk-5I4VRWBB.js +56 -0
- package/dist/chunk-5I4VRWBB.js.map +1 -0
- package/dist/{chunk-24M4YBCL.js → chunk-62XZ3IX3.js} +1751 -845
- package/dist/chunk-62XZ3IX3.js.map +1 -0
- package/dist/chunk-77THWHSU.js +308 -0
- package/dist/chunk-77THWHSU.js.map +1 -0
- package/dist/chunk-7CZLTFXF.js +466 -0
- package/dist/chunk-7CZLTFXF.js.map +1 -0
- package/dist/chunk-7N5AD2TC.js +327 -0
- package/dist/chunk-7N5AD2TC.js.map +1 -0
- package/dist/chunk-7SZ7MMCY.js +325 -0
- package/dist/chunk-7SZ7MMCY.js.map +1 -0
- package/dist/chunk-7TG6KTR2.js +3153 -0
- package/dist/chunk-7TG6KTR2.js.map +1 -0
- package/dist/chunk-AIX25FIQ.js +409 -0
- package/dist/chunk-AIX25FIQ.js.map +1 -0
- package/dist/chunk-AT2HD6RQ.js +1936 -0
- package/dist/chunk-AT2HD6RQ.js.map +1 -0
- package/dist/chunk-B27E3V37.js +29 -0
- package/dist/chunk-B27E3V37.js.map +1 -0
- package/dist/{chunk-5M6VTFJ5.js → chunk-B4EDAXMC.js} +37 -13
- package/dist/chunk-B4EDAXMC.js.map +1 -0
- package/dist/chunk-BOG2FED3.js +35 -0
- package/dist/chunk-BOG2FED3.js.map +1 -0
- package/dist/chunk-BQYQU5QW.js +109 -0
- package/dist/chunk-BQYQU5QW.js.map +1 -0
- package/dist/{chunk-PAJU5KKL.js → chunk-BRIOXCLH.js} +68 -25
- package/dist/chunk-BRIOXCLH.js.map +1 -0
- package/dist/chunk-CM7LVUKC.js +35 -0
- package/dist/chunk-CM7LVUKC.js.map +1 -0
- package/dist/{chunk-KCGXPP5V.js → chunk-CXIGFHVL.js} +35 -23
- package/dist/chunk-CXIGFHVL.js.map +1 -0
- package/dist/chunk-DHXKEJBH.js +71 -0
- package/dist/chunk-DHXKEJBH.js.map +1 -0
- package/dist/{chunk-NOSYBS2D.js → chunk-DN3TKURW.js} +12 -9
- package/dist/chunk-DN3TKURW.js.map +1 -0
- package/dist/chunk-DNJ23AWQ.js +35 -0
- package/dist/chunk-DNJ23AWQ.js.map +1 -0
- package/dist/chunk-ESAMXNBZ.js +3237 -0
- package/dist/chunk-ESAMXNBZ.js.map +1 -0
- package/dist/{chunk-4MDLEHXL.js → chunk-EWATYP5L.js} +64 -44
- package/dist/chunk-EWATYP5L.js.map +1 -0
- package/dist/{chunk-YBM6CQRU.js → chunk-FQ5CXNUG.js} +65 -42
- package/dist/chunk-FQ5CXNUG.js.map +1 -0
- package/dist/chunk-HEVQKE27.js +150 -0
- package/dist/chunk-HEVQKE27.js.map +1 -0
- package/dist/chunk-HZ47S3DP.js +1086 -0
- package/dist/chunk-HZ47S3DP.js.map +1 -0
- package/dist/chunk-I5BJ7ENY.js +174 -0
- package/dist/chunk-I5BJ7ENY.js.map +1 -0
- package/dist/chunk-IGFZFLI2.js +1390 -0
- package/dist/chunk-IGFZFLI2.js.map +1 -0
- package/dist/chunk-IGVL3ELX.js +46 -0
- package/dist/chunk-IGVL3ELX.js.map +1 -0
- package/dist/chunk-IOD24LGR.js +384 -0
- package/dist/chunk-IOD24LGR.js.map +1 -0
- package/dist/chunk-IOYHDEP3.js +38 -0
- package/dist/chunk-IOYHDEP3.js.map +1 -0
- package/dist/chunk-IQL77TMM.js +803 -0
- package/dist/chunk-IQL77TMM.js.map +1 -0
- package/dist/chunk-IZV5FTJC.js +55 -0
- package/dist/chunk-IZV5FTJC.js.map +1 -0
- package/dist/{chunk-H5YGYNXS.js → chunk-JAYYFOOB.js} +75 -28
- package/dist/chunk-JAYYFOOB.js.map +1 -0
- package/dist/chunk-KN2MYSCC.js +409 -0
- package/dist/chunk-KN2MYSCC.js.map +1 -0
- package/dist/{chunk-PEI6RANI.js → chunk-KYVJMTXL.js} +434 -145
- package/dist/chunk-KYVJMTXL.js.map +1 -0
- package/dist/{chunk-ZYRGEKWS.js → chunk-LJUMYUBO.js} +3 -1
- package/dist/{chunk-ZYRGEKWS.js.map → chunk-LJUMYUBO.js.map} +1 -1
- package/dist/{chunk-ICA6R6TW.js → chunk-LNUD3JNI.js} +1532 -395
- package/dist/chunk-LNUD3JNI.js.map +1 -0
- package/dist/chunk-M357MHH3.js +2 -0
- package/dist/{chunk-BV5A4OTE.js → chunk-MEL6PH2I.js} +1218 -537
- package/dist/chunk-MEL6PH2I.js.map +1 -0
- package/dist/chunk-MF6WS2XF.js +386 -0
- package/dist/chunk-MF6WS2XF.js.map +1 -0
- package/dist/chunk-MK2TQO4Y.js +24 -0
- package/dist/chunk-MK2TQO4Y.js.map +1 -0
- package/dist/chunk-N7S72EXK.js +25 -0
- package/dist/chunk-N7S72EXK.js.map +1 -0
- package/dist/{chunk-KZ73RL76.js → chunk-NAWXARTY.js} +58 -9
- package/dist/chunk-NAWXARTY.js.map +1 -0
- package/dist/chunk-NX4ADH73.js +14 -0
- package/dist/chunk-NX4ADH73.js.map +1 -0
- package/dist/chunk-OYQQJL3J.js +16 -0
- package/dist/chunk-OYQQJL3J.js.map +1 -0
- package/dist/chunk-P4MKPCTC.js +51 -0
- package/dist/chunk-P4MKPCTC.js.map +1 -0
- package/dist/{chunk-JVYQRRC4.js → chunk-PEHTX3V7.js} +21 -1
- package/dist/chunk-PEHTX3V7.js.map +1 -0
- package/dist/chunk-PMV53IMM.js +26 -0
- package/dist/chunk-PMV53IMM.js.map +1 -0
- package/dist/chunk-PYSEGV5X.js +14396 -0
- package/dist/chunk-PYSEGV5X.js.map +1 -0
- package/dist/{chunk-HUIKIDM5.js → chunk-QOEWDOFW.js} +295 -156
- package/dist/chunk-QOEWDOFW.js.map +1 -0
- package/dist/chunk-QV3DJVRZ.js +11 -0
- package/dist/chunk-QV3DJVRZ.js.map +1 -0
- package/dist/{chunk-HUMIRRYI.js → chunk-QYUYVSNG.js} +1103 -1699
- package/dist/chunk-QYUYVSNG.js.map +1 -0
- package/dist/{chunk-6J56T3MG.js → chunk-RRAQ5FV5.js} +186 -60
- package/dist/chunk-RRAQ5FV5.js.map +1 -0
- package/dist/{chunk-5YK2ZDIG.js → chunk-TNEZNMSN.js} +4 -10
- package/dist/chunk-TNEZNMSN.js.map +1 -0
- package/dist/{chunk-22KP6LR5.js → chunk-TXS65BB2.js} +3 -1
- package/dist/{chunk-22KP6LR5.js.map → chunk-TXS65BB2.js.map} +1 -1
- package/dist/chunk-UIWIOB4U.js +2215 -0
- package/dist/chunk-UIWIOB4U.js.map +1 -0
- package/dist/chunk-UNJPZGNK.js +63 -0
- package/dist/chunk-UNJPZGNK.js.map +1 -0
- package/dist/chunk-V7UGCQHQ.js +86 -0
- package/dist/chunk-V7UGCQHQ.js.map +1 -0
- package/dist/chunk-VU4QUISJ.js +3405 -0
- package/dist/chunk-VU4QUISJ.js.map +1 -0
- package/dist/chunk-WEY5J52U.js +467 -0
- package/dist/chunk-WEY5J52U.js.map +1 -0
- package/dist/chunk-WH2CBESG.js +409 -0
- package/dist/chunk-WH2CBESG.js.map +1 -0
- package/dist/{chunk-VZTQ73XT.js → chunk-XEA5BCMA.js} +3 -1
- package/dist/{chunk-VZTQ73XT.js.map → chunk-XEA5BCMA.js.map} +1 -1
- package/dist/{chunk-NLTS7JHI.js → chunk-XEIHS3RN.js} +834 -403
- package/dist/chunk-XEIHS3RN.js.map +1 -0
- package/dist/chunk-YNXZRE3F.js +408 -0
- package/dist/chunk-YNXZRE3F.js.map +1 -0
- package/dist/chunk-YSRBFJMQ.js +43 -0
- package/dist/chunk-YSRBFJMQ.js.map +1 -0
- package/dist/{chunk-NEXLLTP4.js → chunk-ZGFU4LVW.js} +6 -5
- package/dist/chunk-ZGFU4LVW.js.map +1 -0
- package/dist/chunk-ZO35BAMO.js +172 -0
- package/dist/chunk-ZO35BAMO.js.map +1 -0
- package/dist/chunk-ZUWF4NF7.js +13 -0
- package/dist/chunk-ZUWF4NF7.js.map +1 -0
- package/dist/client.d.ts +15 -6
- package/dist/clipboard.js +3 -1
- package/dist/commands/registry.d.ts +2 -1
- package/dist/commands/types.d.ts +2 -0
- package/dist/components/anthropic-mark.d.ts +3 -0
- package/dist/components/approval-surface.d.ts +21 -7
- package/dist/components/artifacts/artifact-chrome.d.ts +121 -0
- package/dist/components/artifacts/artifact-sandbox.d.ts +30 -0
- package/dist/components/artifacts/artifact-surface.d.ts +4 -2
- package/dist/components/artifacts/chat-interactive-block.d.ts +29 -0
- package/dist/components/artifacts/deferred-chat-media.d.ts +15 -0
- package/dist/components/artifacts/document-editor.d.ts +4 -2
- package/dist/components/artifacts/editable-artifact-ui.d.ts +4 -2
- package/dist/components/artifacts/editable-artifact-view.d.ts +48 -0
- package/dist/components/artifacts/editable-document.d.ts +3 -2
- package/dist/components/artifacts/editable-presentation.d.ts +4 -3
- package/dist/components/artifacts/editable-spreadsheet.d.ts +8 -3
- package/dist/components/artifacts/index.d.ts +8 -1
- package/dist/components/artifacts/inline-html-document.d.ts +2 -0
- package/dist/components/artifacts/latest-task-runner.d.ts +15 -0
- package/dist/components/artifacts/presentation-editor.d.ts +6 -2
- package/dist/components/artifacts/published-html-artifact-frame.d.ts +17 -40
- package/dist/components/artifacts/session-artifact-viewer.d.ts +39 -0
- package/dist/components/artifacts/site-view.d.ts +26 -0
- package/dist/components/artifacts/spreadsheet-command-queue.d.ts +20 -0
- package/dist/components/artifacts/spreadsheet-download.d.ts +7 -0
- package/dist/components/artifacts/spreadsheet-general-display.d.ts +24 -0
- package/dist/components/artifacts/spreadsheet-grid.d.ts +11 -4
- package/dist/components/artifacts/spreadsheet-resize.d.ts +50 -0
- package/dist/components/artifacts/spreadsheet-submissions.d.ts +9 -0
- package/dist/components/artifacts/visualization-assets.gen.d.ts +2 -0
- package/dist/components/browser-select-control.d.ts +16 -0
- package/dist/components/browser-viewer.d.ts +11 -2
- package/dist/components/chat-composer.d.ts +21 -3
- package/dist/components/child-session-link.d.ts +5 -1
- package/dist/components/claude-mark.d.ts +3 -0
- package/dist/components/code-editor.d.ts +1 -4
- package/dist/components/command-palette.d.ts +1 -1
- package/dist/components/composer-transcription-control.d.ts +7 -0
- package/dist/components/composer.d.ts +30 -67
- package/dist/components/computer-viewer.d.ts +1 -1
- package/dist/components/copy-button.d.ts +3 -1
- package/dist/components/desktop-viewer.d.ts +1 -1
- package/dist/components/generated-video-player.d.ts +1 -1
- package/dist/components/grok-mark.d.ts +26 -0
- package/dist/components/human-input-form.d.ts +26 -32
- package/dist/components/human-input-surface.d.ts +5 -1
- package/dist/components/linkified-text.d.ts +18 -0
- package/dist/components/machine-input-display.d.ts +25 -3
- package/dist/components/machine-status-pill.d.ts +3 -2
- package/dist/components/machines/agent-status-icon.d.ts +6 -0
- package/dist/components/machines/health.d.ts +2 -1
- package/dist/components/machines/machine-detail.d.ts +7 -1
- package/dist/components/machines/machine-status.d.ts +49 -0
- package/dist/components/machines/metric-history-chart.d.ts +1 -1
- package/dist/components/machines/series.d.ts +3 -2
- package/dist/components/markdown-table-layout.d.ts +11 -2
- package/dist/components/markdown.d.ts +37 -4
- package/dist/components/message-timeline.d.ts +79 -7
- package/dist/components/model-mark.d.ts +29 -0
- package/dist/components/model-picker.d.ts +1 -1
- package/dist/components/model-policy-picker.d.ts +31 -22
- package/dist/components/new-conversation.d.ts +32 -0
- package/dist/components/open-geni-chat.d.ts +73 -0
- package/dist/components/open-geni-links.d.ts +69 -0
- package/dist/components/openrouter-mark.d.ts +6 -0
- package/dist/components/opper-mark.d.ts +7 -0
- package/dist/components/preview-loading.d.ts +2 -0
- package/dist/components/provider-recovery-notice.d.ts +17 -0
- package/dist/components/queue-item-content.d.ts +10 -0
- package/dist/components/rehype-secret-refs.d.ts +23 -0
- package/dist/components/remark-soft-line-breaks.d.ts +38 -0
- package/dist/components/sandbox-workspace.d.ts +18 -0
- package/dist/components/secret-question-field.d.ts +31 -0
- package/dist/components/secret-ref-chip.d.ts +35 -0
- package/dist/components/session-capability-frame.d.ts +37 -0
- package/dist/components/session-chrome.d.ts +20 -7
- package/dist/components/session-commands.d.ts +6 -0
- package/dist/components/session-connection-request.d.ts +8 -0
- package/dist/components/session-conversation.d.ts +147 -6
- package/dist/components/session-list.d.ts +39 -0
- package/dist/components/session-mcp-capability-card.d.ts +41 -0
- package/dist/components/session-proxy-scope.d.ts +35 -0
- package/dist/components/session-status.d.ts +6 -2
- package/dist/components/session-usage-limit-notice.d.ts +39 -0
- package/dist/components/this-computer/illustrations.d.ts +38 -0
- package/dist/components/this-computer/labels.d.ts +111 -0
- package/dist/components/this-computer/this-computer-card.d.ts +40 -0
- package/dist/components/this-computer/this-computer-setup.d.ts +35 -0
- package/dist/components/this-computer/this-computer-status.d.ts +42 -0
- package/dist/components/this-computer/use-this-computer.d.ts +29 -0
- package/dist/components/timeline-anchor.d.ts +3 -0
- package/dist/components/timeline-annotation-shared.d.ts +3 -2
- package/dist/components/timeline-annotations-dialog.d.ts +2 -1
- package/dist/components/timeline-annotations.d.ts +5 -1
- package/dist/components/timeline-reading-progress.d.ts +11 -0
- package/dist/components/timeline-search.d.ts +34 -0
- package/dist/components/timeline-settlement.d.ts +16 -0
- package/dist/components/tool-action-review.d.ts +48 -0
- package/dist/components/tool-review-history.d.ts +25 -0
- package/dist/components/usage-limit-notice.d.ts +50 -0
- package/dist/components/usage-member-list.d.ts +92 -0
- package/dist/components/usage-meter.d.ts +74 -0
- package/dist/components/use-viewer-menu-dismiss.d.ts +2 -0
- package/dist/components/user-message-body.d.ts +10 -1
- package/dist/components/workbench-changes.d.ts +2 -1
- package/dist/composer-messages.d.ts +75 -0
- package/dist/composer-messages.js +9 -0
- package/dist/composer-messages.js.map +1 -0
- package/dist/composer-voice-events.d.ts +8 -0
- package/dist/composer.d.ts +3 -3
- package/dist/composer.js +25 -12
- package/dist/computer-viewer-VOIOZGVZ.js +21 -0
- package/dist/computer-viewer-VOIOZGVZ.js.map +1 -0
- package/dist/connect-account-identity.d.ts +8 -0
- package/dist/connect-accounts.d.ts +15 -0
- package/dist/connect-chooser.d.ts +18 -0
- package/dist/connect-panel.d.ts +18 -0
- package/dist/connect-setup.d.ts +18 -0
- package/dist/connect.d.ts +21 -0
- package/dist/connect.js +2216 -0
- package/dist/connect.js.map +1 -0
- package/dist/connection-catalog.d.ts +38 -0
- package/dist/connection-discovery.d.ts +12 -0
- package/dist/connection-installed.d.ts +17 -0
- package/dist/connection-logo.d.ts +9 -0
- package/dist/connection-service-logo.d.ts +8 -0
- package/dist/connection-service-presentation.d.ts +13 -0
- package/dist/connection-skeleton.d.ts +5 -0
- package/dist/connection-type-picker.d.ts +6 -0
- package/dist/conversation-timeline.d.ts +1 -1
- package/dist/desktop.d.ts +7 -0
- package/dist/desktop.js +28 -0
- package/dist/desktop.js.map +1 -0
- package/dist/device-authorization.d.ts +23 -0
- package/dist/diffs.d.ts +8 -0
- package/dist/diffs.js +15 -0
- package/dist/diffs.js.map +1 -0
- package/dist/discovery-cache.d.ts +5 -0
- package/dist/editor.d.ts +7 -0
- package/dist/editor.js +23 -0
- package/dist/editor.js.map +1 -0
- package/dist/embedded-new-voice-KPLC5UJZ.js +19 -0
- package/dist/embedded-new-voice-KPLC5UJZ.js.map +1 -0
- package/dist/embedded-voice-V2RFSLIU.js +19 -0
- package/dist/embedded-voice-V2RFSLIU.js.map +1 -0
- package/dist/fleet-decision-row-FE73NSQ6.js +361 -0
- package/dist/fleet-decision-row-FE73NSQ6.js.map +1 -0
- package/dist/hooks/internal.d.ts +27 -2
- package/dist/hooks/latest-question.d.ts +26 -0
- package/dist/hooks/session-view-cache.d.ts +38 -0
- package/dist/hooks/shared-machines-list.d.ts +4 -0
- package/dist/hooks/shared-query.d.ts +123 -0
- package/dist/hooks/use-attached-browsers.d.ts +1 -1
- package/dist/hooks/use-auth-runs.d.ts +1 -4
- package/dist/hooks/use-available-models.d.ts +8 -3
- package/dist/hooks/use-browser-frame-stream.d.ts +1 -1
- package/dist/hooks/use-browser-session.d.ts +12 -1
- package/dist/hooks/use-client-config-flags.d.ts +49 -0
- package/dist/hooks/use-codex-accounts.d.ts +48 -9
- package/dist/hooks/use-composer.d.ts +24 -3
- package/dist/hooks/use-computer-frame-stream.d.ts +1 -1
- package/dist/hooks/use-computer-input-posture.d.ts +13 -0
- package/dist/hooks/use-computer-session.d.ts +5 -0
- package/dist/hooks/use-connect.d.ts +23 -0
- package/dist/hooks/use-desktop-stream.d.ts +1 -1
- package/dist/hooks/use-file-attachments.d.ts +4 -0
- package/dist/hooks/use-goal.d.ts +2 -1
- package/dist/hooks/use-last-started-turn-policy.d.ts +5 -1
- package/dist/hooks/use-machine-chip.d.ts +3 -2
- package/dist/hooks/use-new-conversation.d.ts +56 -0
- package/dist/hooks/use-new-session-draft.d.ts +74 -0
- package/dist/hooks/use-realtime-voice-models.d.ts +7 -0
- package/dist/hooks/use-sandbox-files.d.ts +3 -2
- package/dist/hooks/use-session-conversation.d.ts +49 -0
- package/dist/hooks/use-session-events.d.ts +21 -2
- package/dist/hooks/use-session-mcp-approval-policy.d.ts +2 -2
- package/dist/hooks/use-session-model-account.d.ts +48 -0
- package/dist/hooks/use-supergrok-accounts.d.ts +7 -1
- package/dist/hooks/use-terminal-stream.d.ts +11 -5
- package/dist/hooks/use-transcription.d.ts +2 -1
- package/dist/hooks/use-usage.d.ts +40 -0
- package/dist/hooks/use-vaults.d.ts +53 -0
- package/dist/hooks/use-voice-input.d.ts +8 -1
- package/dist/hooks/use-workspace-sessions.d.ts +24 -5
- package/dist/human-input-model.d.ts +123 -0
- package/dist/identity-link-accounts.d.ts +11 -0
- package/dist/identity-link-consent.d.ts +18 -0
- package/dist/index.d.ts +83 -18
- package/dist/index.js +2317 -6453
- package/dist/index.js.map +1 -1
- package/dist/interaction.d.ts +1 -1
- package/dist/interaction.js +20 -29
- package/dist/interaction.js.map +1 -1
- package/dist/latest-question-SXBXROBT.js +118 -0
- package/dist/latest-question-SXBXROBT.js.map +1 -0
- package/dist/lib/client-config-read.d.ts +31 -0
- package/dist/lib/clipboard.d.ts +7 -0
- package/dist/lib/error-message.d.ts +7 -0
- package/dist/lib/format.d.ts +59 -9
- package/dist/lib/host-theme.d.ts +77 -0
- package/dist/lib/interaction-errors.d.ts +3 -0
- package/dist/lib/menu-styles.d.ts +22 -0
- package/dist/lib/notify-observer.d.ts +2 -0
- package/dist/lib/pierre-diffs-loader.d.ts +20 -0
- package/dist/lib/provider-recovery.d.ts +56 -0
- package/dist/lib/scrollbars.d.ts +11 -0
- package/dist/lib/terminal-input-readiness.d.ts +11 -0
- package/dist/lib/transient-retry.d.ts +26 -0
- package/dist/lib/workbench-peers.d.ts +36 -0
- package/dist/lib/xterm-theme.d.ts +7 -5
- package/dist/machines.js +12 -6
- package/dist/{markdown-table-layout-3Z3AWBY7.js → markdown-table-layout-3PV2UAAH.js} +51 -9
- package/dist/markdown-table-layout-3PV2UAAH.js.map +1 -0
- package/dist/mcp-connection-status.d.ts +15 -0
- package/dist/messages/en.d.ts +3328 -0
- package/dist/messages/runtime.d.ts +69 -0
- package/dist/messages.d.ts +3 -0
- package/dist/messages.js +16 -0
- package/dist/messages.js.map +1 -0
- package/dist/model-mark-paths.d.ts +34 -0
- package/dist/model-mark-paths.js +16 -0
- package/dist/model-mark-paths.js.map +1 -0
- package/dist/model-picker-model.d.ts +112 -0
- package/dist/model-picker-model.js +25 -0
- package/dist/model-picker-model.js.map +1 -0
- package/dist/model-policy-picker-menu-NWIETWSR.js +18 -0
- package/dist/model-policy-picker-menu-NWIETWSR.js.map +1 -0
- package/dist/model-policy.d.ts +35 -10
- package/dist/model-policy.js +12 -1
- package/dist/native-previews.d.ts +29 -0
- package/dist/native-previews.js +82 -0
- package/dist/native-previews.js.map +1 -0
- package/dist/new-session-draft.d.ts +7 -0
- package/dist/new-session-draft.js +639 -0
- package/dist/new-session-draft.js.map +1 -0
- package/dist/notification-text.d.ts +27 -0
- package/dist/{noto-sans-arabic-loader-IA2T4X2A.js → noto-sans-arabic-loader-XSH2KYWJ.js} +3 -1
- package/dist/{noto-sans-arabic-loader-IA2T4X2A.js.map → noto-sans-arabic-loader-XSH2KYWJ.js.map} +1 -1
- package/dist/{noto-sans-jp-loader.generated-HFGLYBR3.js → noto-sans-jp-loader.generated-MR5L6V7K.js} +3 -1
- package/dist/{noto-sans-jp-loader.generated-HFGLYBR3.js.map → noto-sans-jp-loader.generated-MR5L6V7K.js.map} +1 -1
- package/dist/organization-model.d.ts +33 -0
- package/dist/organization-model.js +65 -0
- package/dist/organization-model.js.map +1 -0
- package/dist/platform-activity-row-VSQ2FZ5T.js +119 -0
- package/dist/platform-activity-row-VSQ2FZ5T.js.map +1 -0
- package/dist/plugin-details.d.ts +14 -0
- package/dist/plugin-discovery.d.ts +25 -0
- package/dist/preview-loading-paint.d.ts +20 -0
- package/dist/provider.d.ts +37 -2
- package/dist/queue-presentation-model.d.ts +73 -0
- package/dist/queue-presentation-model.js +38 -0
- package/dist/queue-presentation-model.js.map +1 -0
- package/dist/{queue-surface-implementation-LK3S4BIW.js → queue-surface-implementation-MEKXXWGR.js} +189 -343
- package/dist/queue-surface-implementation-MEKXXWGR.js.map +1 -0
- package/dist/realtime/embedded-new-voice.d.ts +1 -0
- package/dist/realtime/embedded-voice.d.ts +1 -0
- package/dist/realtime/realtime-control.d.ts +4 -65
- package/dist/realtime/session-realtime.d.ts +79 -0
- package/dist/realtime.js +26 -1333
- package/dist/realtime.js.map +1 -1
- package/dist/sandbox-files-5NRC2QUT.js +24 -0
- package/dist/sandbox-files-5NRC2QUT.js.map +1 -0
- package/dist/sandbox-label-model.d.ts +31 -0
- package/dist/sandbox-label-model.js +20 -0
- package/dist/sandbox-label-model.js.map +1 -0
- package/dist/scrollbars.d.ts +1 -0
- package/dist/scrollbars.js +10 -0
- package/dist/scrollbars.js.map +1 -0
- package/dist/secret-reference-label.d.ts +15 -0
- package/dist/secrets-ui.d.ts +57 -0
- package/dist/session-agents-model.d.ts +11 -0
- package/dist/session-agents-model.js +25 -0
- package/dist/session-agents-model.js.map +1 -0
- package/dist/session-attention-model.d.ts +8 -0
- package/dist/session-attention-model.js +47 -0
- package/dist/session-attention-model.js.map +1 -0
- package/dist/session-auth-recommendation.d.ts +6 -0
- package/dist/session-capability-policy.d.ts +32 -0
- package/dist/session-context.d.ts +9 -1
- package/dist/session-feedback-model.d.ts +21 -0
- package/dist/session-feedback-model.js +56 -0
- package/dist/session-feedback-model.js.map +1 -0
- package/dist/session-list-model.d.ts +139 -0
- package/dist/session-list-model.js +274 -0
- package/dist/session-list-model.js.map +1 -0
- package/dist/session-realtime-OZCE6IKP.js +22 -0
- package/dist/session-realtime-OZCE6IKP.js.map +1 -0
- package/dist/session-realtime.d.ts +7 -0
- package/dist/session-realtime.js +20 -0
- package/dist/session-realtime.js.map +1 -0
- package/dist/session-status-model.d.ts +37 -0
- package/dist/session-ui.d.ts +40 -3
- package/dist/session-ui.js +127 -21
- package/dist/session-ui.js.map +1 -1
- package/dist/session.d.ts +10 -2
- package/dist/session.js +44 -20
- package/dist/site-snapshot.d.ts +14 -0
- package/dist/sites-ui.d.ts +24 -0
- package/dist/sites.d.ts +3 -0
- package/dist/sites.js +15 -0
- package/dist/sites.js.map +1 -0
- package/dist/skill-discovery.d.ts +47 -0
- package/dist/terminal.d.ts +8 -0
- package/dist/terminal.js +33 -0
- package/dist/terminal.js.map +1 -0
- package/dist/testing/session-scenarios.d.ts +10 -0
- package/dist/testing/session-scenarios.js +367 -0
- package/dist/testing/session-scenarios.js.map +1 -0
- package/dist/this-computer.d.ts +8 -0
- package/dist/this-computer.js +1042 -0
- package/dist/this-computer.js.map +1 -0
- package/dist/timeline/activity-rail.d.ts +12 -2
- package/dist/timeline/agent-identity.d.ts +30 -0
- package/dist/timeline/agent-row.d.ts +31 -0
- package/dist/timeline/allowance-exhausted-row.d.ts +24 -0
- package/dist/timeline/compaction-copy.d.ts +47 -0
- package/dist/timeline/focus-sequence.d.ts +9 -0
- package/dist/timeline/genie-copy.d.ts +4 -0
- package/dist/timeline/genie-loading.d.ts +48 -0
- package/dist/timeline/index.d.ts +12 -5
- package/dist/timeline/invoked-tool.d.ts +6 -0
- package/dist/timeline/knowledge-receipt.d.ts +17 -0
- package/dist/timeline/learning-refusal-copy.d.ts +23 -0
- package/dist/timeline/learning-refusal-row.d.ts +19 -0
- package/dist/timeline/message-sender.d.ts +19 -0
- package/dist/timeline/notice-presentation.d.ts +14 -0
- package/dist/timeline/parsers.d.ts +11 -0
- package/dist/timeline/patch-apply-command.d.ts +19 -0
- package/dist/timeline/platform-activity-presentation.d.ts +26 -0
- package/dist/timeline/platform-activity-row.d.ts +1 -2
- package/dist/timeline/presented-image.d.ts +11 -0
- package/dist/timeline/projection.d.ts +32 -2
- package/dist/timeline/provider-logo.d.ts +15 -0
- package/dist/timeline/question-nav-model.d.ts +23 -0
- package/dist/timeline/registry.d.ts +10 -1
- package/dist/timeline/retained-image.d.ts +18 -0
- package/dist/timeline/retained-loaders.d.ts +27 -0
- package/dist/timeline/rolling-activity.d.ts +11 -0
- package/dist/timeline/screenshot-lightbox.d.ts +23 -1
- package/dist/timeline/session-usage-limit-row.d.ts +11 -0
- package/dist/timeline/shared.d.ts +8 -3
- package/dist/timeline/startup-dispatch-details.d.ts +5 -0
- package/dist/timeline/startup-preference.d.ts +3 -0
- package/dist/timeline/startup-timings.d.ts +4 -0
- package/dist/timeline/tool-display-name.d.ts +6 -2
- package/dist/timeline/tool-presentation.d.ts +185 -0
- package/dist/timeline/turn-summary-model.d.ts +102 -0
- package/dist/timeline/turn-summary.d.ts +20 -54
- package/dist/timeline/types.d.ts +184 -7
- package/dist/timeline/work-presentation.d.ts +61 -0
- package/dist/{timeline-annotation-markers-DRSTLEM6.js → timeline-annotation-markers-HYLRTT6S.js} +11 -6
- package/dist/timeline-annotation-markers-HYLRTT6S.js.map +1 -0
- package/dist/{timeline-annotation-selection-IHLUGVND.js → timeline-annotation-selection-LBKW5GHA.js} +15 -5
- package/dist/timeline-annotation-selection-LBKW5GHA.js.map +1 -0
- package/dist/{timeline-annotations-dialog-6Q53N5FG.js → timeline-annotations-dialog-JKVINC42.js} +34 -19
- package/dist/timeline-annotations-dialog-JKVINC42.js.map +1 -0
- package/dist/timeline-model.d.ts +29 -0
- package/dist/timeline-model.js +254 -0
- package/dist/timeline-model.js.map +1 -0
- package/dist/usage/allowance-copy.d.ts +26 -0
- package/dist/usage/session-usage-limit.d.ts +89 -0
- package/dist/usage/summary.d.ts +35 -0
- package/dist/usage.d.ts +17 -0
- package/dist/usage.js +1201 -0
- package/dist/usage.js.map +1 -0
- package/dist/voice-recording-owner.d.ts +7 -0
- package/package.json +119 -7
- package/src/approvals.ts +8 -1
- package/src/artifacts-spreadsheet.ts +1 -0
- package/src/artifacts.ts +41 -0
- package/src/assets/README.md +8 -0
- package/src/assets/gmail.ico +0 -0
- package/src/assets/outlook.ico +0 -0
- package/src/capability-catalog-row.tsx +96 -0
- package/src/capability-logo-fallback.ts +22 -0
- package/src/client.ts +18 -30
- package/src/commands/registry.ts +46 -36
- package/src/commands/types.ts +2 -0
- package/src/components/anthropic-mark.tsx +10 -0
- package/src/components/approval-surface.tsx +407 -142
- package/src/components/artifacts/artifact-chrome.tsx +425 -0
- package/src/components/artifacts/artifact-sandbox.tsx +193 -0
- package/src/components/artifacts/artifact-surface.tsx +48 -26
- package/src/components/artifacts/chat-interactive-block.tsx +260 -0
- package/src/components/artifacts/deferred-chat-media.tsx +72 -0
- package/src/components/artifacts/document-editor.tsx +193 -45
- package/src/components/artifacts/editable-artifact-ui.tsx +23 -11
- package/src/components/artifacts/editable-artifact-view.tsx +199 -0
- package/src/components/artifacts/editable-artifact-workbench.tsx +8 -3
- package/src/components/artifacts/editable-document.tsx +76 -54
- package/src/components/artifacts/editable-presentation.tsx +86 -40
- package/src/components/artifacts/editable-spreadsheet.tsx +581 -121
- package/src/components/artifacts/index.ts +42 -0
- package/src/components/artifacts/inline-html-document.ts +24 -0
- package/src/components/artifacts/latest-task-runner.ts +49 -0
- package/src/components/artifacts/presentation-editor.tsx +422 -122
- package/src/components/artifacts/published-html-artifact-frame.tsx +79 -265
- package/src/components/artifacts/session-artifact-viewer.tsx +381 -0
- package/src/components/artifacts/site-view.tsx +129 -0
- package/src/components/artifacts/spreadsheet-canvas.ts +5 -10
- package/src/components/artifacts/spreadsheet-command-queue.ts +190 -0
- package/src/components/artifacts/spreadsheet-download.tsx +117 -0
- package/src/components/artifacts/spreadsheet-general-display.ts +43 -0
- package/src/components/artifacts/spreadsheet-grid.tsx +390 -172
- package/src/components/artifacts/spreadsheet-resize.tsx +432 -0
- package/src/components/artifacts/spreadsheet-submissions.tsx +46 -0
- package/src/components/artifacts/visualization-assets/base.css +1015 -0
- package/src/components/artifacts/visualization-assets/helpers.html +349 -0
- package/src/components/artifacts/visualization-assets.gen.ts +3 -0
- package/src/components/browser-select-control.tsx +320 -0
- package/src/components/browser-viewer.tsx +1102 -505
- package/src/components/chat-composer.tsx +42 -3
- package/src/components/child-session-link.tsx +16 -5
- package/src/components/claude-mark.tsx +11 -0
- package/src/components/code-editor.tsx +38 -27
- package/src/components/command-palette.tsx +4 -1
- package/src/components/composer-transcription-control.tsx +151 -50
- package/src/components/composer.tsx +281 -176
- package/src/components/computer-viewer.tsx +1013 -341
- package/src/components/copy-button.tsx +17 -7
- package/src/components/desktop-viewer.tsx +42 -33
- package/src/components/diff-view.tsx +3 -1
- package/src/components/enrollment-consent.tsx +39 -34
- package/src/components/enrollment-device-flow.tsx +31 -19
- package/src/components/file-browser.tsx +47 -35
- package/src/components/fleet-tile.tsx +8 -4
- package/src/components/generated-video-player.tsx +10 -5
- package/src/components/grok-mark.tsx +34 -0
- package/src/components/human-input-form.tsx +438 -251
- package/src/components/human-input-surface.tsx +8 -0
- package/src/components/interaction-intervention-banner.tsx +15 -13
- package/src/components/linkified-text.tsx +79 -0
- package/src/components/machine-card.tsx +56 -89
- package/src/components/machine-dock-bar.tsx +10 -4
- package/src/components/machine-health-pill.tsx +4 -2
- package/src/components/machine-input-display.ts +309 -34
- package/src/components/machine-metrics.tsx +10 -7
- package/src/components/machine-status-pill.tsx +23 -15
- package/src/components/machines/agent-status-icon.tsx +31 -0
- package/src/components/machines/health.ts +53 -10
- package/src/components/machines/machine-detail.tsx +230 -42
- package/src/components/machines/machine-operation-policy.tsx +36 -29
- package/src/components/machines/machine-status.ts +264 -0
- package/src/components/machines/metric-history-chart.tsx +8 -2
- package/src/components/machines/series.ts +12 -11
- package/src/components/machines-dashboard.tsx +16 -9
- package/src/components/markdown-table-layout.ts +67 -9
- package/src/components/markdown.tsx +470 -133
- package/src/components/message-timeline.tsx +2290 -752
- package/src/components/model-mark.tsx +102 -0
- package/src/components/model-picker.tsx +27 -9
- package/src/components/model-policy-picker-menu.tsx +204 -100
- package/src/components/model-policy-picker.tsx +215 -152
- package/src/components/new-conversation.tsx +223 -0
- package/src/components/open-geni-chat.tsx +311 -0
- package/src/components/open-geni-links.tsx +183 -0
- package/src/components/openrouter-mark.tsx +13 -0
- package/src/components/opper-mark.tsx +18 -0
- package/src/components/pierre-diff.tsx +47 -19
- package/src/components/pierre-file.tsx +38 -11
- package/src/components/preview-loading.tsx +111 -0
- package/src/components/provider-recovery-notice.tsx +51 -0
- package/src/components/queue-item-content.ts +16 -0
- package/src/components/queue-surface-implementation.tsx +185 -420
- package/src/components/queue-surface-state.tsx +13 -8
- package/src/components/queue-surface.tsx +3 -1
- package/src/components/rehype-secret-refs.ts +98 -0
- package/src/components/remark-soft-line-breaks.ts +166 -0
- package/src/components/sandbox-files.tsx +75 -44
- package/src/components/sandbox-terminal.tsx +103 -22
- package/src/components/sandbox-workspace.tsx +168 -78
- package/src/components/secret-question-field.tsx +326 -0
- package/src/components/secret-ref-chip.tsx +187 -0
- package/src/components/session-capability-frame.tsx +203 -0
- package/src/components/session-chrome.tsx +559 -328
- package/src/components/session-commands-panel.tsx +34 -17
- package/src/components/session-commands.tsx +18 -0
- package/src/components/session-connection-request.tsx +99 -0
- package/src/components/session-conversation.tsx +853 -118
- package/src/components/session-list.tsx +259 -0
- package/src/components/session-mcp-capability-card.tsx +681 -0
- package/src/components/session-proxy-scope.tsx +160 -0
- package/src/components/session-status.tsx +35 -21
- package/src/components/session-usage-limit-notice.tsx +176 -0
- package/src/components/this-computer/illustrations.tsx +164 -0
- package/src/components/this-computer/labels.ts +234 -0
- package/src/components/this-computer/this-computer-card.tsx +203 -0
- package/src/components/this-computer/this-computer-setup.tsx +433 -0
- package/src/components/this-computer/this-computer-status.tsx +329 -0
- package/src/components/this-computer/use-this-computer.ts +183 -0
- package/src/components/timeline-anchor.tsx +43 -15
- package/src/components/timeline-annotation-chrome.tsx +33 -9
- package/src/components/timeline-annotation-markers.tsx +4 -2
- package/src/components/timeline-annotation-selection.tsx +11 -2
- package/src/components/timeline-annotation-shared.ts +9 -8
- package/src/components/timeline-annotations-dialog.tsx +30 -9
- package/src/components/timeline-annotations.tsx +24 -7
- package/src/components/timeline-reading-progress.ts +80 -0
- package/src/components/timeline-search.tsx +168 -0
- package/src/components/timeline-settlement.ts +60 -0
- package/src/components/tool-action-review.tsx +670 -0
- package/src/components/tool-review-history.tsx +88 -0
- package/src/components/usage-limit-notice.tsx +183 -0
- package/src/components/usage-member-list.tsx +797 -0
- package/src/components/usage-meter.tsx +386 -0
- package/src/components/use-viewer-menu-dismiss.ts +33 -0
- package/src/components/user-message-body.tsx +33 -2
- package/src/components/workbench-changes.tsx +28 -16
- package/src/components/workspace-dock.tsx +45 -13
- package/src/composer-messages.ts +153 -0
- package/src/composer-voice-events.ts +12 -0
- package/src/composer.ts +4 -0
- package/src/connect-account-identity.tsx +38 -0
- package/src/connect-accounts.tsx +233 -0
- package/src/connect-chooser.tsx +339 -0
- package/src/connect-panel.tsx +104 -0
- package/src/connect-setup.tsx +354 -0
- package/src/connect.ts +60 -0
- package/src/connection-assets.d.ts +4 -0
- package/src/connection-catalog.tsx +175 -0
- package/src/connection-discovery.tsx +251 -0
- package/src/connection-installed.tsx +56 -0
- package/src/connection-logo.tsx +37 -0
- package/src/connection-service-logo.tsx +55 -0
- package/src/connection-service-presentation.ts +46 -0
- package/src/connection-skeleton.tsx +16 -0
- package/src/connection-type-picker.tsx +38 -0
- package/src/conversation-timeline.ts +11 -2
- package/src/desktop.ts +24 -0
- package/src/device-authorization.tsx +111 -0
- package/src/diffs.ts +16 -0
- package/src/discovery-cache.ts +42 -0
- package/src/editor.ts +13 -0
- package/src/hooks/internal.ts +93 -10
- package/src/hooks/latest-question.ts +168 -0
- package/src/hooks/session-view-cache.ts +167 -0
- package/src/hooks/shared-machines-list.ts +34 -1
- package/src/hooks/shared-query.ts +744 -0
- package/src/hooks/use-attached-browsers.ts +1 -1
- package/src/hooks/use-auth-runs.ts +0 -27
- package/src/hooks/use-available-models.ts +20 -10
- package/src/hooks/use-browser-frame-stream.ts +23 -4
- package/src/hooks/use-browser-session.ts +684 -206
- package/src/hooks/use-browser-sessions.ts +32 -1
- package/src/hooks/use-client-config-flags.ts +102 -0
- package/src/hooks/use-codex-accounts.ts +216 -43
- package/src/hooks/use-composer.ts +240 -59
- package/src/hooks/use-computer-frame-stream.ts +29 -9
- package/src/hooks/use-computer-input-posture.ts +96 -0
- package/src/hooks/use-computer-session.ts +419 -100
- package/src/hooks/use-connect.ts +23 -0
- package/src/hooks/use-desktop-stream.ts +19 -28
- package/src/hooks/use-file-attachments.ts +19 -3
- package/src/hooks/use-goal.ts +172 -21
- package/src/hooks/use-human-input.ts +16 -2
- package/src/hooks/use-last-started-turn-policy.ts +37 -11
- package/src/hooks/use-machine-chip.ts +13 -8
- package/src/hooks/use-machines.ts +24 -10
- package/src/hooks/use-new-conversation.ts +377 -0
- package/src/hooks/use-new-session-draft.ts +813 -0
- package/src/hooks/use-realtime-voice-models.ts +46 -0
- package/src/hooks/use-sandbox-files.ts +22 -16
- package/src/hooks/use-session-background-commands.ts +2 -2
- package/src/hooks/use-session-capabilities.ts +3 -2
- package/src/hooks/use-session-conversation.ts +150 -0
- package/src/hooks/use-session-events.ts +403 -64
- package/src/hooks/use-session-lineage.ts +47 -9
- package/src/hooks/use-session-mcp-approval-policy.ts +13 -5
- package/src/hooks/use-session-model-account.ts +174 -0
- package/src/hooks/use-session.ts +19 -3
- package/src/hooks/use-slash-commands.ts +6 -11
- package/src/hooks/use-supergrok-accounts.ts +22 -8
- package/src/hooks/use-terminal-stream.ts +153 -27
- package/src/hooks/use-transcription.ts +45 -19
- package/src/hooks/use-turn-queue.ts +25 -5
- package/src/hooks/use-usage.ts +100 -0
- package/src/hooks/use-vaults.ts +153 -0
- package/src/hooks/use-video-artifact-playback.ts +1 -1
- package/src/hooks/use-voice-input.ts +127 -19
- package/src/hooks/use-workspace-capture.ts +3 -2
- package/src/hooks/use-workspace-sessions.ts +74 -7
- package/src/human-input-model.ts +374 -0
- package/src/identity-link-accounts.tsx +149 -0
- package/src/identity-link-consent.tsx +193 -0
- package/src/index.ts +282 -16
- package/src/interaction.ts +1 -0
- package/src/lib/client-config-read.ts +76 -0
- package/src/lib/clipboard.ts +29 -0
- package/src/lib/error-message.ts +37 -0
- package/src/lib/format.ts +231 -36
- package/src/lib/host-theme.ts +529 -0
- package/src/lib/interaction-errors.ts +15 -0
- package/src/lib/menu-styles.ts +44 -0
- package/src/lib/notify-observer.ts +15 -0
- package/src/lib/pierre-diffs-loader.ts +53 -0
- package/src/lib/provider-recovery.ts +255 -0
- package/src/lib/scrollbars.ts +30 -0
- package/src/lib/terminal-input-readiness.ts +51 -0
- package/src/lib/transient-retry.ts +101 -0
- package/src/lib/workbench-peers.ts +62 -0
- package/src/lib/xterm-theme.ts +23 -21
- package/src/mcp-connection-status.ts +39 -0
- package/src/messages/en.ts +3810 -0
- package/src/messages/runtime.tsx +175 -0
- package/src/messages.ts +19 -0
- package/src/model-mark-paths.ts +53 -0
- package/src/model-picker-model.ts +343 -0
- package/src/model-policy.ts +301 -79
- package/src/native-previews.ts +104 -0
- package/src/new-session-draft.ts +22 -0
- package/src/notification-text.ts +81 -0
- package/src/organization-model.ts +123 -0
- package/src/plugin-details.tsx +192 -0
- package/src/plugin-discovery.tsx +209 -0
- package/src/preview-loading-paint.ts +68 -0
- package/src/provider.tsx +105 -21
- package/src/queue-presentation-model.ts +475 -0
- package/src/realtime/dropdown-menu.tsx +19 -12
- package/src/realtime/embedded-new-voice.tsx +1 -0
- package/src/realtime/embedded-voice.tsx +3 -0
- package/src/realtime/realtime-control.tsx +240 -609
- package/src/realtime/session-realtime.ts +582 -0
- package/src/sandbox-label-model.ts +56 -0
- package/src/scrollbars.ts +3 -0
- package/src/secret-reference-label.ts +47 -0
- package/src/secrets-ui.tsx +59 -0
- package/src/session-agents-model.ts +40 -0
- package/src/session-attention-model.ts +62 -0
- package/src/session-auth-recommendation.ts +50 -0
- package/src/session-capability-policy.ts +200 -0
- package/src/session-context.ts +13 -5
- package/src/session-feedback-model.ts +101 -0
- package/src/session-list-model.ts +437 -0
- package/src/session-realtime.ts +18 -0
- package/src/session-status-model.ts +99 -0
- package/src/session-ui.ts +102 -3
- package/src/session.ts +19 -1
- package/src/site-snapshot.ts +74 -0
- package/src/sites-ui.tsx +350 -0
- package/src/sites.ts +3 -0
- package/src/skill-discovery.tsx +221 -0
- package/src/terminal.ts +26 -0
- package/src/testing/session-scenarios.ts +404 -0
- package/src/this-computer.ts +62 -0
- package/src/timeline/activity-rail.tsx +289 -119
- package/src/timeline/agent-identity.tsx +84 -0
- package/src/timeline/agent-row.tsx +235 -0
- package/src/timeline/allowance-exhausted-row.tsx +90 -0
- package/src/timeline/compaction-copy.ts +125 -0
- package/src/timeline/fleet-decision-row.tsx +120 -101
- package/src/timeline/focus-sequence.ts +44 -0
- package/src/timeline/genie-copy.ts +22 -0
- package/src/timeline/genie-loading.tsx +158 -0
- package/src/timeline/index.ts +37 -2
- package/src/timeline/invoked-tool.ts +15 -0
- package/src/timeline/knowledge-receipt.tsx +104 -0
- package/src/timeline/learning-refusal-copy.ts +67 -0
- package/src/timeline/learning-refusal-row.tsx +70 -0
- package/src/timeline/message-sender.tsx +71 -0
- package/src/timeline/notice-presentation.ts +67 -0
- package/src/timeline/parsers.ts +42 -2
- package/src/timeline/patch-apply-command.tsx +139 -0
- package/src/timeline/platform-activity-presentation.ts +219 -0
- package/src/timeline/platform-activity-row.tsx +34 -98
- package/src/timeline/presented-image.ts +63 -0
- package/src/timeline/projection.ts +1556 -71
- package/src/timeline/provider-logo.tsx +53 -0
- package/src/timeline/question-nav-model.ts +28 -0
- package/src/timeline/registry.ts +11 -1
- package/src/timeline/retained-image.ts +102 -0
- package/src/timeline/retained-loaders.ts +91 -0
- package/src/timeline/rolling-activity.tsx +84 -0
- package/src/timeline/screenshot-lightbox.tsx +250 -10
- package/src/timeline/session-usage-limit-row.tsx +44 -0
- package/src/timeline/shared.tsx +76 -29
- package/src/timeline/startup-dispatch-details.tsx +43 -0
- package/src/timeline/startup-preference.ts +33 -0
- package/src/timeline/startup-timings.tsx +164 -0
- package/src/timeline/tool-diff.tsx +3 -1
- package/src/timeline/tool-display-name.ts +38 -6
- package/src/timeline/tool-presentation.ts +1552 -0
- package/src/timeline/tool-renderers.tsx +1023 -1265
- package/src/timeline/turn-summary-model.ts +363 -0
- package/src/timeline/turn-summary.tsx +288 -367
- package/src/timeline/types.ts +191 -7
- package/src/timeline/work-presentation.ts +196 -0
- package/src/timeline-model.ts +143 -0
- package/src/usage/allowance-copy.ts +70 -0
- package/src/usage/session-usage-limit.ts +270 -0
- package/src/usage/summary.ts +93 -0
- package/src/usage.ts +70 -0
- package/src/voice-recording-owner.ts +22 -0
- package/styles/compiled.css +2010 -651
- package/styles/connect.css +290 -0
- package/styles/connect.d.ts +1 -0
- package/styles/effective-tokens.css +1 -0
- package/styles/index.css +286 -9
- package/styles/responsive.css +98 -6
- package/styles/session-capability.css +44 -0
- package/styles/this-computer.css +1042 -0
- package/styles/this-computer.d.ts +1 -0
- package/styles/tokens.css +132 -64
- package/dist/browser-viewer-NTD6UIPR.js +0 -14
- package/dist/chunk-24M4YBCL.js.map +0 -1
- package/dist/chunk-4MDLEHXL.js.map +0 -1
- package/dist/chunk-5M6VTFJ5.js.map +0 -1
- package/dist/chunk-5PQJOCX5.js +0 -902
- package/dist/chunk-5PQJOCX5.js.map +0 -1
- package/dist/chunk-5YK2ZDIG.js.map +0 -1
- package/dist/chunk-6J56T3MG.js.map +0 -1
- package/dist/chunk-BV5A4OTE.js.map +0 -1
- package/dist/chunk-CQG7YUJB.js +0 -10883
- package/dist/chunk-CQG7YUJB.js.map +0 -1
- package/dist/chunk-H5YGYNXS.js.map +0 -1
- package/dist/chunk-HUIKIDM5.js.map +0 -1
- package/dist/chunk-HUMIRRYI.js.map +0 -1
- package/dist/chunk-ICA6R6TW.js.map +0 -1
- package/dist/chunk-JVYQRRC4.js.map +0 -1
- package/dist/chunk-KCGXPP5V.js.map +0 -1
- package/dist/chunk-KZ73RL76.js.map +0 -1
- package/dist/chunk-NEXLLTP4.js.map +0 -1
- package/dist/chunk-NLTS7JHI.js.map +0 -1
- package/dist/chunk-NOSYBS2D.js.map +0 -1
- package/dist/chunk-PAJU5KKL.js.map +0 -1
- package/dist/chunk-PEI6RANI.js.map +0 -1
- package/dist/chunk-PLYRL5ER.js +0 -164
- package/dist/chunk-PLYRL5ER.js.map +0 -1
- package/dist/chunk-R4KRSFGA.js +0 -290
- package/dist/chunk-R4KRSFGA.js.map +0 -1
- package/dist/chunk-UMECRJRV.js +0 -223
- package/dist/chunk-UMECRJRV.js.map +0 -1
- package/dist/chunk-VRBL3F5E.js +0 -241
- package/dist/chunk-VRBL3F5E.js.map +0 -1
- package/dist/chunk-YBM6CQRU.js.map +0 -1
- package/dist/chunk-Z7WBDB4E.js.map +0 -1
- package/dist/computer-viewer-7TEZC6Y2.js +0 -16
- package/dist/fleet-decision-row-YZ3ZKWMM.js +0 -352
- package/dist/fleet-decision-row-YZ3ZKWMM.js.map +0 -1
- package/dist/hooks/use-environments.d.ts +0 -41
- package/dist/hooks/use-packs.d.ts +0 -32
- package/dist/markdown-table-layout-3Z3AWBY7.js.map +0 -1
- package/dist/model-policy-picker-menu-3R336DP2.js +0 -13
- package/dist/platform-activity-row-27LKAWZD.js +0 -169
- package/dist/platform-activity-row-27LKAWZD.js.map +0 -1
- package/dist/queue-surface-implementation-LK3S4BIW.js.map +0 -1
- package/dist/timeline-annotation-markers-DRSTLEM6.js.map +0 -1
- package/dist/timeline-annotation-selection-IHLUGVND.js.map +0 -1
- package/dist/timeline-annotations-dialog-6Q53N5FG.js.map +0 -1
- package/src/hooks/use-environments.ts +0 -182
- package/src/hooks/use-packs.ts +0 -157
- /package/dist/{browser-viewer-NTD6UIPR.js.map → browser-viewer-GEHX3KYE.js.map} +0 -0
- /package/dist/{computer-viewer-7TEZC6Y2.js.map → chat-interactive-block-5V3BGLXT.js.map} +0 -0
- /package/dist/{model-policy-picker-menu-3R336DP2.js.map → chunk-M357MHH3.js.map} +0 -0
|
@@ -0,0 +1,2215 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
timelineGroupContainsPresentedImage
|
|
4
|
+
} from "./chunk-P4MKPCTC.js";
|
|
5
|
+
import {
|
|
6
|
+
mcpToolLeaf,
|
|
7
|
+
toolDisplayName
|
|
8
|
+
} from "./chunk-4F4FGCH2.js";
|
|
9
|
+
import {
|
|
10
|
+
formatClockTime,
|
|
11
|
+
stringifyPayload,
|
|
12
|
+
tryParseJson
|
|
13
|
+
} from "./chunk-AIX25FIQ.js";
|
|
14
|
+
|
|
15
|
+
// src/timeline/parsers.ts
|
|
16
|
+
import {
|
|
17
|
+
normalizeMcpOutput,
|
|
18
|
+
parseGeneratedImageReceipt
|
|
19
|
+
} from "@opengeni/sdk";
|
|
20
|
+
function sandboxCommandExitCode(out) {
|
|
21
|
+
const match = String(out ?? "").match(/Process exited with code (-?\d+)/);
|
|
22
|
+
return match ? Number(match[1]) : null;
|
|
23
|
+
}
|
|
24
|
+
function parseExecBannerSessionId(out) {
|
|
25
|
+
const text = String(out ?? "");
|
|
26
|
+
const outputIdx = text.indexOf("\nOutput:\n");
|
|
27
|
+
const banner = outputIdx >= 0 ? text.slice(0, outputIdx) : text.startsWith("Output:\n") ? "" : text;
|
|
28
|
+
const match = banner.match(/Process running with session ID (\d+)/);
|
|
29
|
+
if (!match) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const n = Number.parseInt(match[1], 10);
|
|
33
|
+
return Number.isFinite(n) ? n : null;
|
|
34
|
+
}
|
|
35
|
+
function stripExecBanner(out) {
|
|
36
|
+
const text = String(out ?? "");
|
|
37
|
+
const marker = text.indexOf("\nOutput:\n");
|
|
38
|
+
if (marker >= 0) {
|
|
39
|
+
return text.slice(marker + "\nOutput:\n".length);
|
|
40
|
+
}
|
|
41
|
+
if (text.startsWith("Output:\n")) {
|
|
42
|
+
return text.slice("Output:\n".length);
|
|
43
|
+
}
|
|
44
|
+
return text;
|
|
45
|
+
}
|
|
46
|
+
function execTruncated(out) {
|
|
47
|
+
return /Total output lines:|\.{3}\d+ tokens truncated\.{3}|\[\.{3}\d+ characters truncated/.test(
|
|
48
|
+
String(out ?? "")
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
function isExecSessionLostBanner(out) {
|
|
52
|
+
return /write_stdin failed: session not found: \d+/.test(String(out ?? ""));
|
|
53
|
+
}
|
|
54
|
+
function looksBinary(text) {
|
|
55
|
+
return text.includes("\0") || text.startsWith("\x7FELF");
|
|
56
|
+
}
|
|
57
|
+
function controlCaret(printable) {
|
|
58
|
+
return String(printable).replace(
|
|
59
|
+
/[\u0000-\u001f]/g,
|
|
60
|
+
(c) => `^${String.fromCharCode(c.charCodeAt(0) + 64)}`
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
function v4aToGitFileDiff(op) {
|
|
64
|
+
const status = op.type === "create_file" ? "added" : op.type === "delete_file" ? "deleted" : op.moveTo ? "renamed" : "modified";
|
|
65
|
+
const oldPath = op.moveTo ? op.path : null;
|
|
66
|
+
const path = op.moveTo || op.path;
|
|
67
|
+
const hunks = [];
|
|
68
|
+
let additions = 0;
|
|
69
|
+
let deletions = 0;
|
|
70
|
+
let sawHunkAnchor = false;
|
|
71
|
+
if (op.type !== "delete_file") {
|
|
72
|
+
const lines = (op.diff ?? "").split("\n");
|
|
73
|
+
let cur = null;
|
|
74
|
+
let oldNo = 1;
|
|
75
|
+
let newNo = 1;
|
|
76
|
+
for (const raw of lines) {
|
|
77
|
+
if (raw.startsWith("@@")) {
|
|
78
|
+
sawHunkAnchor = true;
|
|
79
|
+
const match = raw.match(/-(\d+)(?:,\d+)?\s+\+(\d+)/);
|
|
80
|
+
oldNo = match ? Number(match[1]) : 1;
|
|
81
|
+
newNo = match ? Number(match[2]) : 1;
|
|
82
|
+
cur = {
|
|
83
|
+
oldStart: oldNo,
|
|
84
|
+
oldLines: 0,
|
|
85
|
+
newStart: newNo,
|
|
86
|
+
newLines: 0,
|
|
87
|
+
header: raw,
|
|
88
|
+
lines: [{ type: "meta", oldNo: null, newNo: null, text: raw }]
|
|
89
|
+
};
|
|
90
|
+
hunks.push(cur);
|
|
91
|
+
} else if (cur || op.type === "create_file") {
|
|
92
|
+
if (!cur) {
|
|
93
|
+
cur = {
|
|
94
|
+
oldStart: 0,
|
|
95
|
+
oldLines: 0,
|
|
96
|
+
newStart: 1,
|
|
97
|
+
newLines: 0,
|
|
98
|
+
header: "",
|
|
99
|
+
lines: []
|
|
100
|
+
};
|
|
101
|
+
hunks.push(cur);
|
|
102
|
+
oldNo = 0;
|
|
103
|
+
newNo = 1;
|
|
104
|
+
}
|
|
105
|
+
if (raw.startsWith("+")) {
|
|
106
|
+
cur.lines.push({
|
|
107
|
+
type: "add",
|
|
108
|
+
oldNo: null,
|
|
109
|
+
newNo: newNo++,
|
|
110
|
+
text: raw.slice(1)
|
|
111
|
+
});
|
|
112
|
+
cur.newLines += 1;
|
|
113
|
+
additions += 1;
|
|
114
|
+
} else if (raw.startsWith("-")) {
|
|
115
|
+
cur.lines.push({
|
|
116
|
+
type: "del",
|
|
117
|
+
oldNo: oldNo++,
|
|
118
|
+
newNo: null,
|
|
119
|
+
text: raw.slice(1)
|
|
120
|
+
});
|
|
121
|
+
cur.oldLines += 1;
|
|
122
|
+
deletions += 1;
|
|
123
|
+
} else {
|
|
124
|
+
cur.lines.push({
|
|
125
|
+
type: "context",
|
|
126
|
+
oldNo: oldNo++,
|
|
127
|
+
newNo: newNo++,
|
|
128
|
+
text: raw.replace(/^ /, "")
|
|
129
|
+
});
|
|
130
|
+
cur.oldLines += 1;
|
|
131
|
+
cur.newLines += 1;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (op.type === "update_file" && !sawHunkAnchor && lines.some((l) => l.trim().length > 0)) {
|
|
136
|
+
throw new Error("malformed V4A: no @@ hunk anchor");
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
path,
|
|
141
|
+
oldPath,
|
|
142
|
+
status,
|
|
143
|
+
isBinary: false,
|
|
144
|
+
isImage: false,
|
|
145
|
+
additions,
|
|
146
|
+
deletions,
|
|
147
|
+
hunks,
|
|
148
|
+
truncated: false
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
var BEGIN_PATCH = "*** Begin Patch";
|
|
152
|
+
var END_PATCH = "*** End Patch";
|
|
153
|
+
var ADD_FILE = "*** Add File: ";
|
|
154
|
+
var DELETE_FILE = "*** Delete File: ";
|
|
155
|
+
var UPDATE_FILE = "*** Update File: ";
|
|
156
|
+
var MOVE_TO = "*** Move to: ";
|
|
157
|
+
var APPLY_PATCH_OP_TYPES = /* @__PURE__ */ new Set(["create_file", "update_file", "delete_file"]);
|
|
158
|
+
function isRecord(value) {
|
|
159
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
160
|
+
}
|
|
161
|
+
function freeformApplyPatchOps(rawPatch) {
|
|
162
|
+
return parseFreeformApplyPatch(rawPatch.trimStart());
|
|
163
|
+
}
|
|
164
|
+
function asApplyPatchOperation(value) {
|
|
165
|
+
if (!isRecord(value)) return null;
|
|
166
|
+
if (typeof value.type !== "string" || !APPLY_PATCH_OP_TYPES.has(value.type)) {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
if (typeof value.path !== "string" || !value.path) {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
const op = {
|
|
173
|
+
type: value.type,
|
|
174
|
+
path: value.path
|
|
175
|
+
};
|
|
176
|
+
if (typeof value.diff === "string") op.diff = value.diff;
|
|
177
|
+
if (typeof value.moveTo === "string" && value.moveTo.length > 0) op.moveTo = value.moveTo;
|
|
178
|
+
return op;
|
|
179
|
+
}
|
|
180
|
+
function parseStructuredOperations(payloads) {
|
|
181
|
+
if (payloads.length === 0) return [];
|
|
182
|
+
const operations = [];
|
|
183
|
+
for (const payload of payloads) {
|
|
184
|
+
const op = asApplyPatchOperation(payload);
|
|
185
|
+
if (!op) return [];
|
|
186
|
+
operations.push(op);
|
|
187
|
+
}
|
|
188
|
+
return operations;
|
|
189
|
+
}
|
|
190
|
+
function parseFreeformApplyPatch(rawPatch) {
|
|
191
|
+
const lines = rawPatch.split(/\r?\n/);
|
|
192
|
+
if (lines.at(-1) === "") lines.pop();
|
|
193
|
+
if (lines[0] !== BEGIN_PATCH) return [];
|
|
194
|
+
if (lines.length < 2 || lines.at(-1) !== END_PATCH) return [];
|
|
195
|
+
const operations = [];
|
|
196
|
+
let index = 1;
|
|
197
|
+
while (index < lines.length - 1) {
|
|
198
|
+
const line = lines[index];
|
|
199
|
+
let parsed = null;
|
|
200
|
+
if (line.startsWith(ADD_FILE)) parsed = parseAddFilePatch(lines, index);
|
|
201
|
+
else if (line.startsWith(DELETE_FILE)) parsed = parseDeleteFilePatch(lines, index);
|
|
202
|
+
else if (line.startsWith(UPDATE_FILE)) parsed = parseUpdateFilePatch(lines, index);
|
|
203
|
+
else return [];
|
|
204
|
+
if (!parsed || "error" in parsed) return [];
|
|
205
|
+
operations.push(parsed.operation);
|
|
206
|
+
index = parsed.nextIndex;
|
|
207
|
+
}
|
|
208
|
+
return operations.length > 0 ? operations : [];
|
|
209
|
+
}
|
|
210
|
+
function parsePatchHeader(line, prefix) {
|
|
211
|
+
const path = line.slice(prefix.length).trim();
|
|
212
|
+
return path || null;
|
|
213
|
+
}
|
|
214
|
+
function isFileOperationHeader(line) {
|
|
215
|
+
return line.startsWith(ADD_FILE) || line.startsWith(DELETE_FILE) || line.startsWith(UPDATE_FILE);
|
|
216
|
+
}
|
|
217
|
+
function joinDiff(lines) {
|
|
218
|
+
return `${lines.join("\n")}
|
|
219
|
+
`;
|
|
220
|
+
}
|
|
221
|
+
function parseAddFilePatch(lines, index) {
|
|
222
|
+
const path = parsePatchHeader(lines[index], ADD_FILE);
|
|
223
|
+
if (!path) return { error: true };
|
|
224
|
+
index += 1;
|
|
225
|
+
const diffLines = [];
|
|
226
|
+
while (index < lines.length - 1 && !isFileOperationHeader(lines[index])) {
|
|
227
|
+
const line = lines[index];
|
|
228
|
+
if (!line.startsWith("+")) return { error: true };
|
|
229
|
+
diffLines.push(line);
|
|
230
|
+
index += 1;
|
|
231
|
+
}
|
|
232
|
+
if (diffLines.length === 0) return { error: true };
|
|
233
|
+
return {
|
|
234
|
+
operation: { type: "create_file", path, diff: joinDiff(diffLines) },
|
|
235
|
+
nextIndex: index
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function parseDeleteFilePatch(lines, index) {
|
|
239
|
+
const path = parsePatchHeader(lines[index], DELETE_FILE);
|
|
240
|
+
if (!path) return { error: true };
|
|
241
|
+
index += 1;
|
|
242
|
+
if (index < lines.length - 1 && !isFileOperationHeader(lines[index])) {
|
|
243
|
+
return { error: true };
|
|
244
|
+
}
|
|
245
|
+
return { operation: { type: "delete_file", path }, nextIndex: index };
|
|
246
|
+
}
|
|
247
|
+
function parseUpdateFilePatch(lines, index) {
|
|
248
|
+
const path = parsePatchHeader(lines[index], UPDATE_FILE);
|
|
249
|
+
if (!path) return { error: true };
|
|
250
|
+
index += 1;
|
|
251
|
+
let moveTo;
|
|
252
|
+
if (index < lines.length - 1 && lines[index].startsWith(MOVE_TO)) {
|
|
253
|
+
const parsedMoveTo = parsePatchHeader(lines[index], MOVE_TO);
|
|
254
|
+
if (!parsedMoveTo) return { error: true };
|
|
255
|
+
moveTo = parsedMoveTo;
|
|
256
|
+
index += 1;
|
|
257
|
+
}
|
|
258
|
+
const diffLines = [];
|
|
259
|
+
while (index < lines.length - 1 && !isFileOperationHeader(lines[index])) {
|
|
260
|
+
diffLines.push(lines[index]);
|
|
261
|
+
index += 1;
|
|
262
|
+
}
|
|
263
|
+
if (diffLines.length === 0 && !moveTo) return { error: true };
|
|
264
|
+
return {
|
|
265
|
+
operation: {
|
|
266
|
+
type: "update_file",
|
|
267
|
+
path,
|
|
268
|
+
diff: diffLines.length > 0 ? joinDiff(diffLines) : "",
|
|
269
|
+
...moveTo ? { moveTo } : {}
|
|
270
|
+
},
|
|
271
|
+
nextIndex: index
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
function applyPatchOps(raw) {
|
|
275
|
+
if (raw == null) return [];
|
|
276
|
+
if (typeof raw === "string") {
|
|
277
|
+
const trimmed = raw.trimStart();
|
|
278
|
+
if (trimmed.startsWith(BEGIN_PATCH)) return freeformApplyPatchOps(trimmed);
|
|
279
|
+
const parsed = tryParseJson(trimmed);
|
|
280
|
+
return parsed === void 0 ? [] : applyPatchOps(parsed);
|
|
281
|
+
}
|
|
282
|
+
if (Array.isArray(raw)) return parseStructuredOperations(raw);
|
|
283
|
+
if (!isRecord(raw)) return [];
|
|
284
|
+
if (typeof raw.patch === "string") return freeformApplyPatchOps(raw.patch);
|
|
285
|
+
if (Array.isArray(raw.command)) {
|
|
286
|
+
const [commandName, patch] = raw.command;
|
|
287
|
+
if (commandName === "apply_patch" && typeof patch === "string") {
|
|
288
|
+
return freeformApplyPatchOps(patch);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (Array.isArray(raw.operations) && raw.operations.length > 0) {
|
|
292
|
+
return parseStructuredOperations(raw.operations);
|
|
293
|
+
}
|
|
294
|
+
if (raw.operation !== void 0) {
|
|
295
|
+
const op = asApplyPatchOperation(raw.operation);
|
|
296
|
+
return op ? [op] : [];
|
|
297
|
+
}
|
|
298
|
+
const flat = asApplyPatchOperation(raw);
|
|
299
|
+
return flat ? [flat] : [];
|
|
300
|
+
}
|
|
301
|
+
function applyPatchOpsFromToolItem(item) {
|
|
302
|
+
const fromRaw = applyPatchOps(item.raw);
|
|
303
|
+
if (fromRaw.length > 0) return fromRaw;
|
|
304
|
+
if (isRecord(item.raw)) {
|
|
305
|
+
const nested = item.raw.arguments ?? item.raw.input;
|
|
306
|
+
if (nested !== void 0 && nested !== item.arguments) {
|
|
307
|
+
const fromNested = applyPatchOps(nested);
|
|
308
|
+
if (fromNested.length > 0) return fromNested;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
if (item.arguments !== void 0 && item.arguments !== null) {
|
|
312
|
+
return applyPatchOps(item.arguments);
|
|
313
|
+
}
|
|
314
|
+
return [];
|
|
315
|
+
}
|
|
316
|
+
function isApplyPatch(item) {
|
|
317
|
+
const type = item.raw && typeof item.raw === "object" ? item.raw.type : void 0;
|
|
318
|
+
if (type === "apply_patch_call") {
|
|
319
|
+
return true;
|
|
320
|
+
}
|
|
321
|
+
const name = item.name;
|
|
322
|
+
return name === "apply_patch_call" || name === "apply_patch" || name.endsWith("__apply_patch");
|
|
323
|
+
}
|
|
324
|
+
function parseToolArgs(args) {
|
|
325
|
+
if (args == null) {
|
|
326
|
+
return {};
|
|
327
|
+
}
|
|
328
|
+
if (typeof args === "string") {
|
|
329
|
+
const parsed = tryParseJson(args);
|
|
330
|
+
return parsed && typeof parsed === "object" ? parsed : {};
|
|
331
|
+
}
|
|
332
|
+
return typeof args === "object" ? args : {};
|
|
333
|
+
}
|
|
334
|
+
function tailPeek(text) {
|
|
335
|
+
const trimmed = text.trim();
|
|
336
|
+
if (!trimmed) {
|
|
337
|
+
return "";
|
|
338
|
+
}
|
|
339
|
+
const lines = trimmed.split("\n");
|
|
340
|
+
return lines[lines.length - 1] ?? "";
|
|
341
|
+
}
|
|
342
|
+
function unwrapMcpOutput(output) {
|
|
343
|
+
const normalized = normalizeMcpOutput(output);
|
|
344
|
+
return { text: normalized.text, isError: normalized.isError };
|
|
345
|
+
}
|
|
346
|
+
function screenshotDataUrl(out) {
|
|
347
|
+
if (typeof out === "string") {
|
|
348
|
+
if (out.startsWith("data:image")) {
|
|
349
|
+
return out;
|
|
350
|
+
}
|
|
351
|
+
if (out.startsWith("{") || out.startsWith("[")) {
|
|
352
|
+
const parsed = tryParseJson(out);
|
|
353
|
+
if (parsed !== void 0 && parsed !== out) {
|
|
354
|
+
return screenshotDataUrl(parsed);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return null;
|
|
358
|
+
}
|
|
359
|
+
if (Array.isArray(out)) {
|
|
360
|
+
for (const entry of out) {
|
|
361
|
+
const url = screenshotDataUrl(entry);
|
|
362
|
+
if (url) {
|
|
363
|
+
return url;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
if (out === null || typeof out !== "object") {
|
|
369
|
+
return null;
|
|
370
|
+
}
|
|
371
|
+
const record = out;
|
|
372
|
+
const imageUrl = record.image_url ?? record.imageUrl;
|
|
373
|
+
if (typeof imageUrl === "string" && imageUrl.startsWith("data:image")) {
|
|
374
|
+
return imageUrl;
|
|
375
|
+
}
|
|
376
|
+
if (imageUrl && typeof imageUrl === "object") {
|
|
377
|
+
const url = imageUrl.url;
|
|
378
|
+
if (typeof url === "string" && url.startsWith("data:image")) {
|
|
379
|
+
return url;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
const image = record.image;
|
|
383
|
+
if (image && typeof image === "object") {
|
|
384
|
+
const mediaType = typeof image.mediaType === "string" ? image.mediaType : "image/png";
|
|
385
|
+
const base64 = bytesToBase64(image.data);
|
|
386
|
+
if (base64) {
|
|
387
|
+
return `data:${mediaType};base64,${base64}`;
|
|
388
|
+
}
|
|
389
|
+
if (typeof image.data === "string" && image.data.length > 0) {
|
|
390
|
+
return `data:${mediaType};base64,${image.data}`;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
return null;
|
|
394
|
+
}
|
|
395
|
+
function retainedScreenshotMetadata(out) {
|
|
396
|
+
if (typeof out === "string" && (out.startsWith("{") || out.startsWith("["))) {
|
|
397
|
+
const parsed = tryParseJson(out);
|
|
398
|
+
if (parsed !== void 0 && parsed !== out) return retainedScreenshotMetadata(parsed);
|
|
399
|
+
}
|
|
400
|
+
if (Array.isArray(out)) {
|
|
401
|
+
for (const entry of out) {
|
|
402
|
+
const metadata = retainedScreenshotMetadata(entry);
|
|
403
|
+
if (metadata) return metadata;
|
|
404
|
+
}
|
|
405
|
+
return null;
|
|
406
|
+
}
|
|
407
|
+
if (!out || typeof out !== "object") return null;
|
|
408
|
+
const value = out;
|
|
409
|
+
if (typeof value.artifactId !== "string" || typeof value.available !== "boolean") return null;
|
|
410
|
+
if (!value.available) {
|
|
411
|
+
return typeof value.reason === "string" ? value : null;
|
|
412
|
+
}
|
|
413
|
+
return (value.kind === "computer_screenshot" || value.kind === "browser_screenshot") && ["image/png", "image/jpeg", "image/webp"].includes(String(value.contentType)) && typeof value.originalBytes === "number" && typeof value.sha256 === "string" && value.dimensions !== null && typeof value.dimensions === "object" && value.retention !== null && typeof value.retention === "object" && value.retention.policy === "session_screenshot" ? value : null;
|
|
414
|
+
}
|
|
415
|
+
function generatedImageReceipt(out) {
|
|
416
|
+
return parseGeneratedImageReceipt(out);
|
|
417
|
+
}
|
|
418
|
+
function retainedToolResultImages(out) {
|
|
419
|
+
const parsed = typeof out === "string" && (out.startsWith("{") || out.startsWith("[")) ? tryParseJson(out) : out;
|
|
420
|
+
const split = (entries) => {
|
|
421
|
+
const images = [];
|
|
422
|
+
const rest = entries.filter((entry) => {
|
|
423
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return true;
|
|
424
|
+
const receipt = retainedScreenshotMetadata(entry);
|
|
425
|
+
if (!receipt?.available) return true;
|
|
426
|
+
images.push(receipt);
|
|
427
|
+
return false;
|
|
428
|
+
});
|
|
429
|
+
return { images, rest };
|
|
430
|
+
};
|
|
431
|
+
if (Array.isArray(parsed)) {
|
|
432
|
+
const { images, rest } = split(parsed);
|
|
433
|
+
return images.length ? { images, output: rest } : { images, output: out };
|
|
434
|
+
}
|
|
435
|
+
if (parsed && typeof parsed === "object") {
|
|
436
|
+
const record = parsed;
|
|
437
|
+
if (Array.isArray(record.content)) {
|
|
438
|
+
const { images, rest } = split(record.content);
|
|
439
|
+
return images.length ? { images, output: { ...record, content: rest } } : { images, output: out };
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
return { images: [], output: out };
|
|
443
|
+
}
|
|
444
|
+
function mediaPreviewFact(out) {
|
|
445
|
+
if (typeof out === "string" && (out.startsWith("{") || out.startsWith("["))) {
|
|
446
|
+
const parsed = tryParseJson(out);
|
|
447
|
+
if (parsed !== void 0 && parsed !== out) return mediaPreviewFact(parsed);
|
|
448
|
+
}
|
|
449
|
+
if (Array.isArray(out)) {
|
|
450
|
+
for (const entry of out) {
|
|
451
|
+
const preview = mediaPreviewFact(entry);
|
|
452
|
+
if (preview) return preview;
|
|
453
|
+
}
|
|
454
|
+
return null;
|
|
455
|
+
}
|
|
456
|
+
if (!out || typeof out !== "object") return null;
|
|
457
|
+
const record = out;
|
|
458
|
+
if (record.type !== "media_preview" || typeof record.mediaType !== "string" || record.fullOutputAvailable !== false || typeof record.preview !== "string" || record.inlineBytes !== null && typeof record.inlineBytes !== "number") {
|
|
459
|
+
return null;
|
|
460
|
+
}
|
|
461
|
+
return record;
|
|
462
|
+
}
|
|
463
|
+
function bytesToBase64(data) {
|
|
464
|
+
const isByte = (n) => typeof n === "number" && Number.isInteger(n) && n >= 0 && n <= 255;
|
|
465
|
+
let bytes = null;
|
|
466
|
+
if (Array.isArray(data) && data.every(isByte)) {
|
|
467
|
+
bytes = data;
|
|
468
|
+
} else if (data && typeof data === "object") {
|
|
469
|
+
const record = data;
|
|
470
|
+
if (record.type === "Buffer" && Array.isArray(record.data) && record.data.every(isByte)) {
|
|
471
|
+
bytes = record.data;
|
|
472
|
+
} else {
|
|
473
|
+
const keys = Object.keys(record);
|
|
474
|
+
if (keys.length > 0 && keys.every((key) => /^\d+$/.test(key))) {
|
|
475
|
+
const values = keys.sort((a, b) => Number(a) - Number(b)).map((key) => record[key]);
|
|
476
|
+
if (values.every(isByte)) {
|
|
477
|
+
bytes = values;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
if (!bytes || bytes.length === 0) {
|
|
483
|
+
return null;
|
|
484
|
+
}
|
|
485
|
+
try {
|
|
486
|
+
let binary = "";
|
|
487
|
+
const CHUNK = 32768;
|
|
488
|
+
for (let i = 0; i < bytes.length; i += CHUNK) {
|
|
489
|
+
binary += String.fromCharCode(...bytes.slice(i, i + CHUNK));
|
|
490
|
+
}
|
|
491
|
+
return typeof btoa === "function" ? btoa(binary) : Buffer.from(binary, "binary").toString("base64");
|
|
492
|
+
} catch {
|
|
493
|
+
return null;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// src/timeline/registry.ts
|
|
498
|
+
function rawTypeOf(item) {
|
|
499
|
+
const raw = item.raw;
|
|
500
|
+
if (raw && typeof raw === "object" && typeof raw.type === "string") {
|
|
501
|
+
return raw.type;
|
|
502
|
+
}
|
|
503
|
+
return null;
|
|
504
|
+
}
|
|
505
|
+
function createToolRegistry(baseEntries, baseFallback, options = {}) {
|
|
506
|
+
const entries = [...options.entries ?? [], ...baseEntries];
|
|
507
|
+
const fallback = options.fallback ?? baseFallback;
|
|
508
|
+
const byRawType = /* @__PURE__ */ new Map();
|
|
509
|
+
const byName = /* @__PURE__ */ new Map();
|
|
510
|
+
const byPrefixedLeaf = /* @__PURE__ */ new Map();
|
|
511
|
+
for (const entry of entries) {
|
|
512
|
+
if (entry.match === "rawType") {
|
|
513
|
+
if (!byRawType.has(entry.type)) {
|
|
514
|
+
byRawType.set(entry.type, entry.render);
|
|
515
|
+
}
|
|
516
|
+
} else if (!byName.has(entry.name)) {
|
|
517
|
+
byName.set(entry.name, entry.render);
|
|
518
|
+
}
|
|
519
|
+
if (entry.match === "name" && entry.matchPrefixedLeaf !== false) {
|
|
520
|
+
if (!byPrefixedLeaf.has(entry.name)) {
|
|
521
|
+
byPrefixedLeaf.set(entry.name, entry.render);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
const resolve = (item) => {
|
|
526
|
+
const rawType = rawTypeOf(item);
|
|
527
|
+
if (rawType) {
|
|
528
|
+
const byType = byRawType.get(rawType);
|
|
529
|
+
if (byType) {
|
|
530
|
+
return byType;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
const exact = byName.get(item.name);
|
|
534
|
+
if (exact) {
|
|
535
|
+
return exact;
|
|
536
|
+
}
|
|
537
|
+
const leaf = mcpToolLeaf(item.name);
|
|
538
|
+
if (leaf !== item.name) {
|
|
539
|
+
const byLeaf = byPrefixedLeaf.get(leaf);
|
|
540
|
+
if (byLeaf) {
|
|
541
|
+
return byLeaf;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
return fallback;
|
|
545
|
+
};
|
|
546
|
+
return { resolve, fallback };
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
// src/timeline/turn-summary-model.ts
|
|
550
|
+
var BUILT_IN_TURN_SUMMARY_FACET_IDS = [
|
|
551
|
+
"steps",
|
|
552
|
+
"files",
|
|
553
|
+
"commands",
|
|
554
|
+
"screenshots",
|
|
555
|
+
"memories",
|
|
556
|
+
"compacted",
|
|
557
|
+
"duration"
|
|
558
|
+
];
|
|
559
|
+
function formatElapsed(t, durationMs) {
|
|
560
|
+
const totalSeconds = Math.max(0, Math.floor(durationMs / 1e3));
|
|
561
|
+
if (totalSeconds < 60) {
|
|
562
|
+
return t("timeline.turnSummaryModel.seconds", { count: totalSeconds });
|
|
563
|
+
}
|
|
564
|
+
const totalMinutes = Math.floor(totalSeconds / 60);
|
|
565
|
+
if (totalMinutes < 60) {
|
|
566
|
+
const seconds = totalSeconds % 60;
|
|
567
|
+
return seconds ? t("timeline.turnSummaryModel.minutesSeconds", { minutes: totalMinutes, seconds }) : t("timeline.turnSummaryModel.minutes", { count: totalMinutes });
|
|
568
|
+
}
|
|
569
|
+
const hours = Math.floor(totalMinutes / 60);
|
|
570
|
+
return t("timeline.turnSummaryModel.hoursMinutes", {
|
|
571
|
+
hours,
|
|
572
|
+
minutes: String(totalMinutes % 60).padStart(2, "0")
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
function createTurnSummaryContext(t, items, outcome, failureText, durationMs, contextCompactionCount) {
|
|
576
|
+
const itemSnapshot = Object.freeze([...items]);
|
|
577
|
+
const toolCalls = Object.freeze(
|
|
578
|
+
itemSnapshot.filter((item) => item.kind === "tool-call")
|
|
579
|
+
);
|
|
580
|
+
const settled = itemSnapshot.every((item) => {
|
|
581
|
+
if (item.kind === "reasoning" || item.kind === "agent-message") {
|
|
582
|
+
return !item.streaming;
|
|
583
|
+
}
|
|
584
|
+
if (item.kind === "tool-call" || item.kind === "worker" || item.kind === "sandbox" || item.kind === "startup-phase") {
|
|
585
|
+
return item.status !== "running";
|
|
586
|
+
}
|
|
587
|
+
return true;
|
|
588
|
+
});
|
|
589
|
+
return Object.freeze({
|
|
590
|
+
t,
|
|
591
|
+
items: itemSnapshot,
|
|
592
|
+
toolCalls,
|
|
593
|
+
outcome,
|
|
594
|
+
failureText,
|
|
595
|
+
durationMs,
|
|
596
|
+
settled,
|
|
597
|
+
contextCompactionCount: Math.max(0, Math.floor(contextCompactionCount))
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
var BUILT_IN_TURN_SUMMARY_FACETS = Object.freeze([
|
|
601
|
+
{
|
|
602
|
+
id: "steps",
|
|
603
|
+
summarize: ({ items, t }) => {
|
|
604
|
+
const count = items.filter(
|
|
605
|
+
(item) => item.kind !== "startup-phase" && item.kind !== "agent-message"
|
|
606
|
+
).length;
|
|
607
|
+
return count ? { content: t("timeline.turnSummaryModel.steps", { count }) } : items.some((item) => item.kind === "startup-phase") ? { content: t("timeline.turnSummaryModel.preparation") } : null;
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
id: "files",
|
|
612
|
+
summarize: ({ toolCalls, t }) => {
|
|
613
|
+
let files = 0;
|
|
614
|
+
for (const item of toolCalls) {
|
|
615
|
+
if (isApplyPatch(item)) {
|
|
616
|
+
files += applyPatchOpsFromToolItem(item).length;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
return files ? { content: t("timeline.turnSummaryModel.filesEdited", { count: files }) } : null;
|
|
620
|
+
}
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
id: "commands",
|
|
624
|
+
summarize: ({ toolCalls, t }) => {
|
|
625
|
+
const commands = toolCalls.filter((item) => item.name === "exec_command").length;
|
|
626
|
+
return commands ? { content: t("timeline.turnSummaryModel.commands", { count: commands }) } : null;
|
|
627
|
+
}
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
id: "screenshots",
|
|
631
|
+
summarize: ({ toolCalls, t }) => {
|
|
632
|
+
let screenshots = 0;
|
|
633
|
+
for (const item of toolCalls) {
|
|
634
|
+
const leaf = mcpToolLeaf(item.name);
|
|
635
|
+
if ((rawTypeOf(item) === "computer_call" || item.name === "computer_call" || item.name === "computer_screenshot" || leaf === "browser_screenshot" || leaf === "browser_observe" || leaf === "browser_act") && (retainedScreenshotMetadata(item.output) !== null || screenshotDataUrl(item.output) !== null || mediaPreviewFact(item.output) !== null)) {
|
|
636
|
+
screenshots += 1;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
return screenshots ? {
|
|
640
|
+
content: t("timeline.turnSummaryModel.screenshots", { count: screenshots })
|
|
641
|
+
} : null;
|
|
642
|
+
}
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
id: "memories",
|
|
646
|
+
summarize: ({ items, t }) => {
|
|
647
|
+
let saved = 0;
|
|
648
|
+
let updated = 0;
|
|
649
|
+
for (const item of items) {
|
|
650
|
+
if (item.kind !== "memory") {
|
|
651
|
+
continue;
|
|
652
|
+
}
|
|
653
|
+
if (item.variant === "corrected") {
|
|
654
|
+
updated += 1;
|
|
655
|
+
} else {
|
|
656
|
+
saved += 1;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
const parts = [];
|
|
660
|
+
if (saved) {
|
|
661
|
+
parts.push(t("timeline.turnSummaryModel.memoriesSaved", { count: saved }));
|
|
662
|
+
}
|
|
663
|
+
if (updated) {
|
|
664
|
+
parts.push(t("timeline.turnSummaryModel.memoriesUpdated", { count: updated }));
|
|
665
|
+
}
|
|
666
|
+
return parts.length > 0 ? { content: parts.join(" \xB7 ") } : null;
|
|
667
|
+
}
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
id: "compacted",
|
|
671
|
+
summarize: ({ contextCompactionCount, t }) => contextCompactionCount > 0 ? {
|
|
672
|
+
content: t("timeline.turnSummaryModel.compacts", { count: contextCompactionCount }),
|
|
673
|
+
ariaLabel: t("timeline.turnSummaryModel.compactions", {
|
|
674
|
+
count: contextCompactionCount
|
|
675
|
+
})
|
|
676
|
+
} : null
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
id: "duration",
|
|
680
|
+
summarize: ({ durationMs, t }) => {
|
|
681
|
+
const duration = formatDurationFacet(t, durationMs);
|
|
682
|
+
return duration ? { content: duration } : null;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
]);
|
|
686
|
+
function resolveTurnSummaryFacets(configuration) {
|
|
687
|
+
const requested = configuration?.replace ?? [
|
|
688
|
+
...BUILT_IN_TURN_SUMMARY_FACETS.filter(
|
|
689
|
+
(facet) => !configuration?.remove?.includes(facet.id)
|
|
690
|
+
),
|
|
691
|
+
...configuration?.add ?? []
|
|
692
|
+
];
|
|
693
|
+
const seen = /* @__PURE__ */ new Set();
|
|
694
|
+
return requested.filter((facet) => {
|
|
695
|
+
if (!facet.id || seen.has(facet.id)) {
|
|
696
|
+
return false;
|
|
697
|
+
}
|
|
698
|
+
seen.add(facet.id);
|
|
699
|
+
return true;
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
function formatDurationFacet(t, durationMs) {
|
|
703
|
+
if (durationMs === void 0 || !Number.isFinite(durationMs) || durationMs < 1e3) {
|
|
704
|
+
return null;
|
|
705
|
+
}
|
|
706
|
+
const totalSeconds = Math.floor(durationMs / 1e3);
|
|
707
|
+
if (totalSeconds < 60) {
|
|
708
|
+
return t("timeline.turnSummaryModel.seconds", { count: totalSeconds });
|
|
709
|
+
}
|
|
710
|
+
const totalMinutes = Math.floor(totalSeconds / 60);
|
|
711
|
+
if (totalMinutes < 60) {
|
|
712
|
+
return t("timeline.turnSummaryModel.minutes", { count: totalMinutes });
|
|
713
|
+
}
|
|
714
|
+
const hours = Math.floor(totalMinutes / 60);
|
|
715
|
+
const minutes = totalMinutes % 60;
|
|
716
|
+
return t("timeline.turnSummaryModel.hoursMinutes", {
|
|
717
|
+
hours,
|
|
718
|
+
minutes: String(minutes).padStart(2, "0")
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
function hasFacetContent(content) {
|
|
722
|
+
return content !== null && content !== void 0 && content !== false && content !== "";
|
|
723
|
+
}
|
|
724
|
+
function selectTurnSummaryFacets(definitions, context, statusKind) {
|
|
725
|
+
return definitions.flatMap((facet) => {
|
|
726
|
+
if (statusKind && (facet.id === "duration" || facet === BUILT_IN_TURN_SUMMARY_FACETS[0] && context.items.every(
|
|
727
|
+
(item) => item.kind === "startup-phase" || item.kind === "agent-message"
|
|
728
|
+
) || statusKind !== "worked" && facet.id !== "steps" && BUILT_IN_TURN_SUMMARY_FACET_IDS.includes(facet.id))) {
|
|
729
|
+
return [];
|
|
730
|
+
}
|
|
731
|
+
try {
|
|
732
|
+
const result = facet.summarize(context);
|
|
733
|
+
return result && hasFacetContent(result.content) ? [{ facet, result }] : [];
|
|
734
|
+
} catch {
|
|
735
|
+
return [];
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
// src/timeline/work-presentation.ts
|
|
741
|
+
function durationBetween(startedAt, endedAt) {
|
|
742
|
+
const started = Date.parse(startedAt);
|
|
743
|
+
const ended = Date.parse(endedAt);
|
|
744
|
+
if (!Number.isFinite(started) || !Number.isFinite(ended) || ended < started) {
|
|
745
|
+
return void 0;
|
|
746
|
+
}
|
|
747
|
+
return ended - started;
|
|
748
|
+
}
|
|
749
|
+
function compactedLandmarkCount(groups) {
|
|
750
|
+
return groups.filter(
|
|
751
|
+
(group) => group.kind === "item" && group.item.kind === "context-compaction" && group.item.phase === "compacted"
|
|
752
|
+
).length;
|
|
753
|
+
}
|
|
754
|
+
function clusterIsSettled(group) {
|
|
755
|
+
return group.items.every((item) => {
|
|
756
|
+
if (item.kind === "reasoning" || item.kind === "agent-message") {
|
|
757
|
+
return !item.streaming;
|
|
758
|
+
}
|
|
759
|
+
if (item.kind === "memory" || item.kind === "fleet-decision") {
|
|
760
|
+
return true;
|
|
761
|
+
}
|
|
762
|
+
return item.status !== "running";
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
function flattenActivityItems(groups) {
|
|
766
|
+
const items = [];
|
|
767
|
+
for (const group of groups) {
|
|
768
|
+
if (group.kind === "activity") {
|
|
769
|
+
items.push(...flattenActivityItems(group.work?.details ?? []), ...group.items);
|
|
770
|
+
} else if (group.kind === "turn") {
|
|
771
|
+
items.push(...flattenActivityItems(group.groups));
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
return items;
|
|
775
|
+
}
|
|
776
|
+
function isPreparingWork(group, options) {
|
|
777
|
+
if (!group.work) return false;
|
|
778
|
+
const phases = group.items.filter((item) => item.kind === "startup-phase");
|
|
779
|
+
return !options.startupDetails && !options.startupDismissed && !group.work.endedAt && !group.work.waiting && phases.length > 0 && group.items.every(
|
|
780
|
+
(item) => item.kind === "startup-phase" || item.kind === "reasoning" && !item.text.trim()
|
|
781
|
+
) && !phases.some((item) => item.status === "failed" || item.status === "cancelled");
|
|
782
|
+
}
|
|
783
|
+
function readableWorkHasDetails(group, options) {
|
|
784
|
+
return group.work.details.some(
|
|
785
|
+
(detail) => options.startupDetails || detail.kind !== "activity" || Boolean(detail.work) || !detail.items.every(
|
|
786
|
+
(item) => item.kind === "startup-phase" && item.status !== "failed" && item.status !== "cancelled" || item.kind === "reasoning" && !item.text.trim()
|
|
787
|
+
)
|
|
788
|
+
);
|
|
789
|
+
}
|
|
790
|
+
function readableWorkStatus(t, group) {
|
|
791
|
+
const end = group.work.endedAt;
|
|
792
|
+
const pausedMs = group.work.pausedMs ?? 0;
|
|
793
|
+
if (end) {
|
|
794
|
+
const durationMs = durationBetween(group.work.startedAt, end);
|
|
795
|
+
const cycles = group.work.cycles;
|
|
796
|
+
if (cycles)
|
|
797
|
+
return {
|
|
798
|
+
kind: "worked",
|
|
799
|
+
label: t("timeline.workPresentation.countUpdatesOver", { count: cycles.count }),
|
|
800
|
+
durationMs
|
|
801
|
+
};
|
|
802
|
+
return {
|
|
803
|
+
kind: "worked",
|
|
804
|
+
durationMs: durationMs === void 0 ? void 0 : Math.max(0, durationMs - pausedMs)
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
if (group.work.waiting) {
|
|
808
|
+
const { untimed, since, ...waiting } = group.work.waiting;
|
|
809
|
+
return { kind: "waiting", ...waiting, ...untimed ? {} : { since } };
|
|
810
|
+
}
|
|
811
|
+
const started = Date.parse(group.work.startedAt);
|
|
812
|
+
return {
|
|
813
|
+
kind: "working",
|
|
814
|
+
since: pausedMs > 0 && Number.isFinite(started) ? new Date(started + pausedMs).toISOString() : group.work.startedAt
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
function readableWorkDefaultOpen(group) {
|
|
818
|
+
const phases = group.items.filter((item) => item.kind === "startup-phase");
|
|
819
|
+
return timelineGroupContainsPresentedImage(group) || group.outcome === "failed" || phases.some((item) => item.status === "failed" || item.status === "cancelled") ? true : void 0;
|
|
820
|
+
}
|
|
821
|
+
function readableWorkShowsPreview(group) {
|
|
822
|
+
return !timelineGroupContainsPresentedImage(group);
|
|
823
|
+
}
|
|
824
|
+
function rollingActivityItem(items, previousItem, mounted = true) {
|
|
825
|
+
const work = items.filter(
|
|
826
|
+
(item2) => item2.kind !== "startup-phase" && item2.kind !== "agent-message"
|
|
827
|
+
);
|
|
828
|
+
const active = work.filter(
|
|
829
|
+
(item2) => item2.kind === "reasoning" ? item2.streaming : "status" in item2 && item2.status === "running"
|
|
830
|
+
);
|
|
831
|
+
const item = !mounted && previousItem && previousItem.kind !== "agent-message" ? previousItem : work.at(-1);
|
|
832
|
+
if (!item) return null;
|
|
833
|
+
return {
|
|
834
|
+
item,
|
|
835
|
+
running: active.some((entry) => entry.id === item.id),
|
|
836
|
+
earlierCount: Math.max(
|
|
837
|
+
0,
|
|
838
|
+
work.findIndex((entry) => entry.id === item.id)
|
|
839
|
+
)
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
// src/timeline/invoked-tool.ts
|
|
844
|
+
function invokedToolCall(item) {
|
|
845
|
+
if (mcpToolLeaf(item.name) !== "tool_invoke") return item;
|
|
846
|
+
const args = parseToolArgs(item.arguments);
|
|
847
|
+
if (typeof args.name !== "string" || !args.name.trim()) return item;
|
|
848
|
+
const { display: _display, ...rest } = item;
|
|
849
|
+
return { ...rest, name: args.name, arguments: args.arguments ?? {} };
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
// src/timeline/tool-presentation.ts
|
|
853
|
+
function withComputePreview(label, preview) {
|
|
854
|
+
if (!label) {
|
|
855
|
+
return preview;
|
|
856
|
+
}
|
|
857
|
+
return `on ${label} \xB7 ${preview}`;
|
|
858
|
+
}
|
|
859
|
+
function truncatePreview(text, max) {
|
|
860
|
+
const cleaned = text.replace(/\s+/g, " ").trim();
|
|
861
|
+
if (!cleaned) {
|
|
862
|
+
return "";
|
|
863
|
+
}
|
|
864
|
+
return cleaned.length > max ? `${cleaned.slice(0, max - 1)}\u2026` : cleaned;
|
|
865
|
+
}
|
|
866
|
+
function readableToolError(text) {
|
|
867
|
+
const stripTransport = (value) => value.trim().replace(/^An error occurred while running the tool\. Please try again\.\s*(Error:\s*)?/, "").replace(/^[A-Za-z][\w.-]{0,40} API \d{3}:\s*/, "");
|
|
868
|
+
let message = stripTransport(text);
|
|
869
|
+
const parsed = tryParseJson(message);
|
|
870
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
871
|
+
const envelope = parsed;
|
|
872
|
+
const inner = typeof envelope.error === "string" ? envelope.error : envelope.error && typeof envelope.error === "object" ? envelope.error.message : envelope.message;
|
|
873
|
+
if (typeof inner === "string" && inner.trim()) message = stripTransport(inner);
|
|
874
|
+
}
|
|
875
|
+
return message.replace(/\s*\(?Reference: [\w-]+\)?\.?$/, "").trim();
|
|
876
|
+
}
|
|
877
|
+
function textPreview(text, running) {
|
|
878
|
+
return running ? { kind: "text", text, running: true } : { kind: "text", text };
|
|
879
|
+
}
|
|
880
|
+
function execPresentation(t, item, context = {}) {
|
|
881
|
+
const args = parseToolArgs(item.arguments);
|
|
882
|
+
const cmd = typeof args.cmd === "string" ? args.cmd : "";
|
|
883
|
+
const workdir = typeof args.workdir === "string" ? args.workdir : null;
|
|
884
|
+
const out = item.output;
|
|
885
|
+
const title = `$ ${cmd}`;
|
|
886
|
+
const computeLabel = context.computeLabel ?? null;
|
|
887
|
+
const base = {
|
|
888
|
+
tool: "exec",
|
|
889
|
+
icon: "terminal",
|
|
890
|
+
title,
|
|
891
|
+
titleMono: true
|
|
892
|
+
};
|
|
893
|
+
if (item.status === "failed" && out === void 0) {
|
|
894
|
+
return {
|
|
895
|
+
...base,
|
|
896
|
+
iconTone: "failed",
|
|
897
|
+
chip: { tone: "bad", text: t("timeline.chip.failed") },
|
|
898
|
+
preview: textPreview(
|
|
899
|
+
withComputePreview(computeLabel, t("timeline.toolPresentation.outputLostNulByteCould"))
|
|
900
|
+
),
|
|
901
|
+
body: {
|
|
902
|
+
kind: "note",
|
|
903
|
+
tone: "error",
|
|
904
|
+
text: t("timeline.toolPresentation.outputContainedANulByte")
|
|
905
|
+
}
|
|
906
|
+
};
|
|
907
|
+
}
|
|
908
|
+
if (item.status === "failed" && (out == null || out === "")) {
|
|
909
|
+
return {
|
|
910
|
+
...base,
|
|
911
|
+
iconTone: "failed",
|
|
912
|
+
chip: { tone: "bad", text: t("timeline.chip.failed") },
|
|
913
|
+
preview: textPreview(
|
|
914
|
+
withComputePreview(computeLabel, t("timeline.toolPresentation.toolCallFailed"))
|
|
915
|
+
),
|
|
916
|
+
body: {
|
|
917
|
+
kind: "note",
|
|
918
|
+
tone: "error",
|
|
919
|
+
text: t("timeline.toolPresentation.theToolCallFailedWith")
|
|
920
|
+
}
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
if (item.status === "running") {
|
|
924
|
+
const streamed = typeof out === "string" ? stripExecBanner(out) : "";
|
|
925
|
+
const runningPreview = streamed ? `${streamed.split("\n").length} lines` : "running\u2026";
|
|
926
|
+
return {
|
|
927
|
+
...base,
|
|
928
|
+
iconTone: "running",
|
|
929
|
+
running: true,
|
|
930
|
+
preview: textPreview(withComputePreview(computeLabel, runningPreview), true),
|
|
931
|
+
body: {
|
|
932
|
+
kind: "term",
|
|
933
|
+
command: null,
|
|
934
|
+
workdir,
|
|
935
|
+
output: streamed,
|
|
936
|
+
live: true
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
}
|
|
940
|
+
const text = typeof out === "string" ? out : stringifyPayload(out);
|
|
941
|
+
const stripped = stripExecBanner(text);
|
|
942
|
+
const bgSession = parseExecBannerSessionId(text);
|
|
943
|
+
const exitCode = sandboxCommandExitCode(text);
|
|
944
|
+
const binary = looksBinary(stripped);
|
|
945
|
+
let chip;
|
|
946
|
+
let iconTone = "muted";
|
|
947
|
+
if (bgSession != null) {
|
|
948
|
+
chip = { tone: "muted", text: `session ${bgSession}` };
|
|
949
|
+
} else if (exitCode != null && exitCode !== 0) {
|
|
950
|
+
chip = { tone: "bad", text: `exit ${exitCode}` };
|
|
951
|
+
iconTone = "failed";
|
|
952
|
+
}
|
|
953
|
+
const peek = binary ? t("timeline.toolPresentation.binaryOutput") : tailPeek(stripped) || t("timeline.toolPresentation.noOutput");
|
|
954
|
+
const truncated = execTruncated(text);
|
|
955
|
+
const preview = withComputePreview(
|
|
956
|
+
computeLabel,
|
|
957
|
+
truncated ? t("timeline.toolPresentation.truncatedPeek", { peek }) : peek
|
|
958
|
+
);
|
|
959
|
+
return {
|
|
960
|
+
...base,
|
|
961
|
+
iconTone,
|
|
962
|
+
...chip ? { chip } : {},
|
|
963
|
+
failed: item.status === "failed",
|
|
964
|
+
cancelled: item.status === "cancelled",
|
|
965
|
+
preview: textPreview(preview),
|
|
966
|
+
body: {
|
|
967
|
+
kind: "term",
|
|
968
|
+
command: null,
|
|
969
|
+
workdir,
|
|
970
|
+
output: binary ? t("timeline.toolPresentation.binaryOutputSuppressed") : stripped,
|
|
971
|
+
failed: item.status === "failed" || exitCode != null && exitCode !== 0,
|
|
972
|
+
...bgSession != null ? {
|
|
973
|
+
note: t("timeline.toolPresentation.sessionBgsessionALaterWrite", { bgSession })
|
|
974
|
+
} : {}
|
|
975
|
+
}
|
|
976
|
+
};
|
|
977
|
+
}
|
|
978
|
+
function writeStdinPresentation(t, item) {
|
|
979
|
+
const args = parseToolArgs(item.arguments);
|
|
980
|
+
const sessionId = typeof args.session_id === "string" || typeof args.session_id === "number" ? args.session_id : void 0;
|
|
981
|
+
const text = typeof item.output === "string" ? item.output : stringifyPayload(item.output);
|
|
982
|
+
const lost = isExecSessionLostBanner(text);
|
|
983
|
+
const keys = controlCaret(typeof args.chars === "string" ? args.chars : "");
|
|
984
|
+
const exitCode = sandboxCommandExitCode(text);
|
|
985
|
+
const stripped = stripExecBanner(text);
|
|
986
|
+
const title = `session ${sessionId} \u2190 ${keys || "\u2205"}`;
|
|
987
|
+
const base = {
|
|
988
|
+
tool: "write_stdin",
|
|
989
|
+
icon: "keyboard",
|
|
990
|
+
title,
|
|
991
|
+
titleMono: true
|
|
992
|
+
};
|
|
993
|
+
if (item.status === "running") {
|
|
994
|
+
return {
|
|
995
|
+
...base,
|
|
996
|
+
iconTone: "running",
|
|
997
|
+
running: true,
|
|
998
|
+
preview: textPreview("sending\u2026", true),
|
|
999
|
+
body: {
|
|
1000
|
+
kind: "note",
|
|
1001
|
+
text: t("timeline.toolPresentation.sendingInputToSessionSessionid", { sessionId })
|
|
1002
|
+
}
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
let chip;
|
|
1006
|
+
if (lost) {
|
|
1007
|
+
chip = { tone: "bad", text: t("timeline.chip.lost") };
|
|
1008
|
+
} else if (exitCode != null && exitCode !== 0) {
|
|
1009
|
+
chip = { tone: "bad", text: `exit ${exitCode}` };
|
|
1010
|
+
}
|
|
1011
|
+
return {
|
|
1012
|
+
...base,
|
|
1013
|
+
iconTone: lost ? "failed" : "muted",
|
|
1014
|
+
...chip ? { chip } : {},
|
|
1015
|
+
failed: item.status === "failed",
|
|
1016
|
+
cancelled: item.status === "cancelled",
|
|
1017
|
+
preview: textPreview(
|
|
1018
|
+
lost ? t("timeline.toolPresentation.sessionSessionidPtyVanished", { sessionId }) : tailPeek(stripped) || "sent"
|
|
1019
|
+
),
|
|
1020
|
+
body: lost ? { kind: "note", tone: "error", text: stripped || text } : {
|
|
1021
|
+
kind: "term",
|
|
1022
|
+
command: `write_stdin \u2192 session ${sessionId}`,
|
|
1023
|
+
workdir: null,
|
|
1024
|
+
output: stripped
|
|
1025
|
+
}
|
|
1026
|
+
};
|
|
1027
|
+
}
|
|
1028
|
+
function patchVerb(t, op) {
|
|
1029
|
+
if (!op) {
|
|
1030
|
+
return t("timeline.toolPresentation.edited");
|
|
1031
|
+
}
|
|
1032
|
+
return op.type === "create_file" ? t("timeline.toolPresentation.created") : op.type === "delete_file" ? t("timeline.toolPresentation.deleted") : op.moveTo ? t("timeline.toolPresentation.renamed") : t("timeline.toolPresentation.edited");
|
|
1033
|
+
}
|
|
1034
|
+
function pathBasename(path) {
|
|
1035
|
+
const parts = path.split("/").filter(Boolean);
|
|
1036
|
+
return parts.length ? parts[parts.length - 1] : path;
|
|
1037
|
+
}
|
|
1038
|
+
function pathDirname(path) {
|
|
1039
|
+
const idx = path.lastIndexOf("/");
|
|
1040
|
+
return idx >= 0 ? path.slice(0, idx + 1) : "";
|
|
1041
|
+
}
|
|
1042
|
+
function safeParsePatchOp(op) {
|
|
1043
|
+
try {
|
|
1044
|
+
return v4aToGitFileDiff(op);
|
|
1045
|
+
} catch {
|
|
1046
|
+
return null;
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
function patchFiles(ops, parsed) {
|
|
1050
|
+
return ops.map((op, index) => ({
|
|
1051
|
+
key: `${op.type}:${op.path}:${index}`,
|
|
1052
|
+
path: op.path,
|
|
1053
|
+
file: parsed ? parsed[index] ?? null : safeParsePatchOp(op),
|
|
1054
|
+
diff: op.diff ?? ""
|
|
1055
|
+
}));
|
|
1056
|
+
}
|
|
1057
|
+
function applyPatchPresentation(t, item) {
|
|
1058
|
+
const ops = applyPatchOpsFromToolItem(item);
|
|
1059
|
+
const cancelled = item.status === "cancelled";
|
|
1060
|
+
const firstOp = ops[0];
|
|
1061
|
+
const base = { tool: "apply_patch", icon: "file-diff" };
|
|
1062
|
+
if (item.status === "running") {
|
|
1063
|
+
const fileCount = ops.length;
|
|
1064
|
+
const titleVerb = firstOp ? t("timeline.toolPresentation.applyingPathbasename", {
|
|
1065
|
+
pathBasename: pathBasename(firstOp.path)
|
|
1066
|
+
}) : t("timeline.toolPresentation.applyingPatch");
|
|
1067
|
+
return {
|
|
1068
|
+
...base,
|
|
1069
|
+
iconTone: "running",
|
|
1070
|
+
title: fileCount > 1 ? t("timeline.toolPresentation.applyingFilecountFiles", { fileCount }) : titleVerb,
|
|
1071
|
+
running: true,
|
|
1072
|
+
preview: textPreview(
|
|
1073
|
+
fileCount > 1 ? `${fileCount} files` : firstOp ? firstOp.path : "applying\u2026",
|
|
1074
|
+
true
|
|
1075
|
+
),
|
|
1076
|
+
body: { kind: "patch", files: patchFiles(ops) }
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
if (item.status === "failed") {
|
|
1080
|
+
return {
|
|
1081
|
+
...base,
|
|
1082
|
+
iconTone: "failed",
|
|
1083
|
+
title: firstOp ? `${patchVerb(t, firstOp)} ${pathBasename(firstOp.path)}` : "apply_patch",
|
|
1084
|
+
chip: { tone: "bad", text: t("timeline.chip.failed") },
|
|
1085
|
+
preview: textPreview(
|
|
1086
|
+
typeof item.output === "string" ? item.output : t("timeline.toolPresentation.patchFailed")
|
|
1087
|
+
),
|
|
1088
|
+
body: {
|
|
1089
|
+
kind: "payloads",
|
|
1090
|
+
blocks: [{ label: t("timeline.toolPresentation.error"), value: item.output, failed: true }]
|
|
1091
|
+
}
|
|
1092
|
+
};
|
|
1093
|
+
}
|
|
1094
|
+
if (ops.length > 1) {
|
|
1095
|
+
const parsed = ops.map((op) => safeParsePatchOp(op));
|
|
1096
|
+
const goodFiles = parsed.filter((f) => f !== null);
|
|
1097
|
+
const add = goodFiles.reduce((n, f) => n + f.additions, 0);
|
|
1098
|
+
const del = goodFiles.reduce((n, f) => n + f.deletions, 0);
|
|
1099
|
+
return {
|
|
1100
|
+
...base,
|
|
1101
|
+
iconTone: "accent",
|
|
1102
|
+
title: t("timeline.toolPresentation.editedLengthFiles", { length: ops.length }),
|
|
1103
|
+
cancelled,
|
|
1104
|
+
preview: { kind: "files", count: ops.length, add, del },
|
|
1105
|
+
body: { kind: "patch", files: patchFiles(ops, parsed) }
|
|
1106
|
+
};
|
|
1107
|
+
}
|
|
1108
|
+
if (!firstOp) {
|
|
1109
|
+
return null;
|
|
1110
|
+
}
|
|
1111
|
+
if (firstOp.type === "delete_file") {
|
|
1112
|
+
return {
|
|
1113
|
+
...base,
|
|
1114
|
+
iconTone: "failed",
|
|
1115
|
+
title: t("timeline.toolPresentation.deletedPathbasename", {
|
|
1116
|
+
pathBasename: pathBasename(firstOp.path)
|
|
1117
|
+
}),
|
|
1118
|
+
cancelled,
|
|
1119
|
+
preview: { kind: "path", path: firstOp.path },
|
|
1120
|
+
body: { kind: "note", text: t("timeline.toolPresentation.fileDeletedNoDiffTo") }
|
|
1121
|
+
};
|
|
1122
|
+
}
|
|
1123
|
+
const file = safeParsePatchOp(firstOp);
|
|
1124
|
+
if (!file) {
|
|
1125
|
+
return {
|
|
1126
|
+
...base,
|
|
1127
|
+
iconTone: "accent",
|
|
1128
|
+
title: `${patchVerb(t, firstOp)} ${pathBasename(firstOp.path)}`,
|
|
1129
|
+
cancelled,
|
|
1130
|
+
preview: { kind: "malformed", name: pathBasename(firstOp.path) },
|
|
1131
|
+
body: { kind: "patch", files: patchFiles([firstOp], [null]), bare: true }
|
|
1132
|
+
};
|
|
1133
|
+
}
|
|
1134
|
+
return {
|
|
1135
|
+
...base,
|
|
1136
|
+
iconTone: "accent",
|
|
1137
|
+
title: `${patchVerb(t, firstOp)} ${pathBasename(file.path)}`,
|
|
1138
|
+
cancelled,
|
|
1139
|
+
preview: {
|
|
1140
|
+
kind: "path",
|
|
1141
|
+
path: file.path,
|
|
1142
|
+
add: file.additions,
|
|
1143
|
+
del: file.deletions
|
|
1144
|
+
},
|
|
1145
|
+
body: { kind: "patch", files: patchFiles([firstOp], [file]) }
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
function webSearchQueryFromArguments(args) {
|
|
1149
|
+
if (typeof args === "string") {
|
|
1150
|
+
const trimmed = args.trim();
|
|
1151
|
+
if (!trimmed) {
|
|
1152
|
+
return null;
|
|
1153
|
+
}
|
|
1154
|
+
try {
|
|
1155
|
+
return webSearchQueryFromArguments(JSON.parse(trimmed));
|
|
1156
|
+
} catch {
|
|
1157
|
+
return trimmed;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
if (!args || typeof args !== "object") {
|
|
1161
|
+
return null;
|
|
1162
|
+
}
|
|
1163
|
+
const record = args;
|
|
1164
|
+
if (typeof record.query === "string" && record.query.trim().length > 0) {
|
|
1165
|
+
return record.query;
|
|
1166
|
+
}
|
|
1167
|
+
if (Array.isArray(record.queries)) {
|
|
1168
|
+
const first = record.queries.find(
|
|
1169
|
+
(value) => typeof value === "string" && value.trim().length > 0
|
|
1170
|
+
);
|
|
1171
|
+
if (first) {
|
|
1172
|
+
return first;
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
return null;
|
|
1176
|
+
}
|
|
1177
|
+
function webSearchPresentation(t, item) {
|
|
1178
|
+
const raw = item.raw ?? {};
|
|
1179
|
+
const action = raw.providerData?.action ?? {};
|
|
1180
|
+
const actionType = action.type ?? "search";
|
|
1181
|
+
const queries = (action.queries ?? []).filter(
|
|
1182
|
+
(value) => typeof value === "string" && value.trim().length > 0
|
|
1183
|
+
);
|
|
1184
|
+
const searchQuery = (typeof action.query === "string" && action.query.trim().length > 0 ? action.query : null) ?? queries[0] ?? webSearchQueryFromArguments(item.arguments);
|
|
1185
|
+
const running = item.status === "running";
|
|
1186
|
+
const query = actionType === "open_page" ? action.url ?? t("timeline.toolPresentation.pageUnavailable") : actionType === "find_in_page" ? action.pattern && action.url ? `"${action.pattern}" in ${action.url}` : action.pattern ?? action.url ?? t("timeline.toolPresentation.pageUnavailable") : (
|
|
1187
|
+
// Codex often emits the live card before action.query/queries land.
|
|
1188
|
+
searchQuery ?? (running ? "\u2026" : t("timeline.toolPresentation.queryUnavailable"))
|
|
1189
|
+
);
|
|
1190
|
+
const variants = queries.length > 1 ? ` +${queries.length - 1} variants` : "";
|
|
1191
|
+
const base = { tool: "web_search", icon: "search" };
|
|
1192
|
+
if (running) {
|
|
1193
|
+
return {
|
|
1194
|
+
...base,
|
|
1195
|
+
iconTone: "running",
|
|
1196
|
+
title: actionType === "open_page" ? t("timeline.toolPresentation.openingWebPage") : actionType === "find_in_page" ? t("timeline.toolPresentation.searchingWithinPage") : t("timeline.toolPresentation.searchingTheWeb"),
|
|
1197
|
+
running: true,
|
|
1198
|
+
preview: textPreview(`${query}${variants}`, true),
|
|
1199
|
+
body: {
|
|
1200
|
+
kind: "note",
|
|
1201
|
+
text: t("timeline.toolPresentation.searchingResultsFoldIntoThe")
|
|
1202
|
+
}
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
const rawResults = item.output?.results;
|
|
1206
|
+
const results = Array.isArray(rawResults) ? rawResults.filter((r) => !!r && typeof r === "object") : null;
|
|
1207
|
+
return {
|
|
1208
|
+
...base,
|
|
1209
|
+
iconTone: "muted",
|
|
1210
|
+
title: actionType === "open_page" ? t("timeline.toolPresentation.openedWebPage") : actionType === "find_in_page" ? t("timeline.toolPresentation.searchedWithinPage") : t("timeline.toolPresentation.searchedTheWeb"),
|
|
1211
|
+
preview: textPreview(`${query}${variants}`),
|
|
1212
|
+
failed: item.status === "failed",
|
|
1213
|
+
cancelled: item.status === "cancelled",
|
|
1214
|
+
body: { kind: "web-results", results }
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
function askToolPreview(args) {
|
|
1218
|
+
const record = args && typeof args === "object" ? args : null;
|
|
1219
|
+
const questions = Array.isArray(record?.questions) ? record.questions : null;
|
|
1220
|
+
if (!questions || questions.length === 0) {
|
|
1221
|
+
return null;
|
|
1222
|
+
}
|
|
1223
|
+
const first = questions[0];
|
|
1224
|
+
if (!first || typeof first !== "object") {
|
|
1225
|
+
return null;
|
|
1226
|
+
}
|
|
1227
|
+
const q = first;
|
|
1228
|
+
const text = typeof q.label === "string" && q.label.trim() ? q.label.trim() : typeof q.prompt === "string" && q.prompt.trim() ? q.prompt.trim() : null;
|
|
1229
|
+
if (!text) {
|
|
1230
|
+
return null;
|
|
1231
|
+
}
|
|
1232
|
+
const preview = truncatePreview(text, 90);
|
|
1233
|
+
return questions.length > 1 ? `${preview} \xB7 ${questions.length} questions` : preview;
|
|
1234
|
+
}
|
|
1235
|
+
function runOnTargetName(output) {
|
|
1236
|
+
const { text } = unwrapMcpOutput(output);
|
|
1237
|
+
const parsed = tryParseJson(text);
|
|
1238
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
1239
|
+
const name = parsed.targetName;
|
|
1240
|
+
if (typeof name === "string" && name.trim()) {
|
|
1241
|
+
return name.trim();
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
return null;
|
|
1245
|
+
}
|
|
1246
|
+
function runOnOpPreview(args) {
|
|
1247
|
+
const op = args.op;
|
|
1248
|
+
if (!op || typeof op !== "object" || Array.isArray(op)) {
|
|
1249
|
+
return null;
|
|
1250
|
+
}
|
|
1251
|
+
const record = op;
|
|
1252
|
+
if (record.kind === "exec" && typeof record.cmd === "string" && record.cmd.trim()) {
|
|
1253
|
+
return `$ ${record.cmd.trim()}`;
|
|
1254
|
+
}
|
|
1255
|
+
if ((record.kind === "read" || record.kind === "write") && typeof record.path === "string" && record.path.trim()) {
|
|
1256
|
+
return truncatePreview(record.path.trim(), 72);
|
|
1257
|
+
}
|
|
1258
|
+
return null;
|
|
1259
|
+
}
|
|
1260
|
+
function goalToolPreview(name, args) {
|
|
1261
|
+
const leaf = mcpToolLeaf(name);
|
|
1262
|
+
if (leaf !== "goal_set" && leaf !== "goal_update" && leaf !== "goal_complete" && leaf !== "goal_pause" && leaf !== "wait_for_input") {
|
|
1263
|
+
return null;
|
|
1264
|
+
}
|
|
1265
|
+
const record = args && typeof args === "object" ? args : null;
|
|
1266
|
+
if (!record) {
|
|
1267
|
+
return null;
|
|
1268
|
+
}
|
|
1269
|
+
const text = typeof record.text === "string" ? record.text : typeof record.evidence === "string" ? record.evidence : typeof record.rationale === "string" ? record.rationale : typeof record.reason === "string" ? record.reason : typeof record.progressNote === "string" ? record.progressNote : null;
|
|
1270
|
+
return text ? truncatePreview(text, 90) : null;
|
|
1271
|
+
}
|
|
1272
|
+
function genericToolIconKind(name) {
|
|
1273
|
+
const leaf = mcpToolLeaf(name);
|
|
1274
|
+
return leaf === "request_human_input" ? "question" : leaf.startsWith("goal_") ? "target" : leaf.startsWith("memory_") || leaf === "preference_registry_summary" || leaf === "preference_registry_get" ? "brain" : leaf.startsWith("session_") || leaf === "sessions_list" || leaf === "set_session_title" || leaf === "set_other_session_title" ? "sessions" : leaf.startsWith("sandbox") || leaf === "sandboxes_list" || leaf === "run_on" ? "server" : leaf.startsWith("rig_") ? "server-cog" : leaf.startsWith("scheduled_") ? "calendar" : leaf.startsWith("artifacts_") ? "panels" : leaf.startsWith("social_") ? "share" : leaf.startsWith("slack_") ? "message" : leaf.startsWith("github_") ? "git" : leaf.startsWith("variable_") ? "box" : leaf.startsWith("environment_") ? "key" : leaf.includes("document") || leaf.includes("knowledge") || leaf === "list_document_bases" ? "file-search" : leaf === "tool_search" ? "package-search" : leaf.startsWith("skill_") ? "plug" : "wrench";
|
|
1275
|
+
}
|
|
1276
|
+
function mcpRowPresentation(t, item, options) {
|
|
1277
|
+
const args = parseToolArgs(item.arguments);
|
|
1278
|
+
const base = { tool: options.tool, icon: options.icon, title: options.title };
|
|
1279
|
+
if (item.status === "running") {
|
|
1280
|
+
return {
|
|
1281
|
+
...base,
|
|
1282
|
+
iconTone: "running",
|
|
1283
|
+
running: true,
|
|
1284
|
+
preview: options.runningPreview != null && options.plainRunningPreview ? textPreview(options.runningPreview) : textPreview(options.runningPreview ?? options.runningFallback, true),
|
|
1285
|
+
body: {
|
|
1286
|
+
kind: "payloads",
|
|
1287
|
+
blocks: [{ label: t("timeline.toolPresentation.arguments"), value: args }]
|
|
1288
|
+
}
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
const { text: outText, isError } = unwrapMcpOutput(item.output);
|
|
1292
|
+
if ((isError || item.status === "failed") && item.status !== "cancelled") {
|
|
1293
|
+
const errorFallback = options.settledFallback === void 0 ? options.settledPreview : null;
|
|
1294
|
+
return {
|
|
1295
|
+
...base,
|
|
1296
|
+
iconTone: "failed",
|
|
1297
|
+
chip: { tone: "bad", text: t("timeline.chip.error") },
|
|
1298
|
+
...options.quietError ? {} : {
|
|
1299
|
+
preview: textPreview(
|
|
1300
|
+
truncatePreview(readableToolError(outText), 80) || errorFallback || t("timeline.toolPresentation.error")
|
|
1301
|
+
)
|
|
1302
|
+
},
|
|
1303
|
+
body: {
|
|
1304
|
+
kind: "payloads",
|
|
1305
|
+
blocks: [
|
|
1306
|
+
{ label: t("timeline.toolPresentation.arguments"), value: args },
|
|
1307
|
+
{ label: t("timeline.toolPresentation.error"), value: outText, failed: true }
|
|
1308
|
+
]
|
|
1309
|
+
}
|
|
1310
|
+
};
|
|
1311
|
+
}
|
|
1312
|
+
const settled = item.status === "cancelled" ? null : options.settledPreview ?? options.settledFallback ?? null;
|
|
1313
|
+
return {
|
|
1314
|
+
...base,
|
|
1315
|
+
iconTone: "muted",
|
|
1316
|
+
cancelled: item.status === "cancelled",
|
|
1317
|
+
...settled != null ? { preview: textPreview(settled) } : {},
|
|
1318
|
+
body: {
|
|
1319
|
+
kind: "payloads",
|
|
1320
|
+
blocks: options.omitEmptyResult && !outText ? [{ label: t("timeline.toolPresentation.arguments"), value: args }] : [
|
|
1321
|
+
{ label: t("timeline.toolPresentation.arguments"), value: args },
|
|
1322
|
+
{ label: t("timeline.toolPresentation.result"), value: outText }
|
|
1323
|
+
]
|
|
1324
|
+
}
|
|
1325
|
+
};
|
|
1326
|
+
}
|
|
1327
|
+
function askPresentation(t, item) {
|
|
1328
|
+
const preview = askToolPreview(parseToolArgs(item.arguments));
|
|
1329
|
+
return mcpRowPresentation(t, item, {
|
|
1330
|
+
tool: "ask",
|
|
1331
|
+
icon: "question",
|
|
1332
|
+
title: t("timeline.toolPresentation.ask"),
|
|
1333
|
+
runningPreview: preview,
|
|
1334
|
+
runningFallback: t("timeline.toolPresentation.waiting"),
|
|
1335
|
+
settledPreview: preview,
|
|
1336
|
+
omitEmptyResult: true
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
function runOnPresentation(t, item) {
|
|
1340
|
+
const targetName = runOnTargetName(item.output);
|
|
1341
|
+
const opPreview = runOnOpPreview(parseToolArgs(item.arguments));
|
|
1342
|
+
return mcpRowPresentation(t, item, {
|
|
1343
|
+
tool: "run_on",
|
|
1344
|
+
icon: "server",
|
|
1345
|
+
title: targetName ? t("timeline.toolPresentation.runOnTargetname", { targetName }) : t("timeline.toolPresentation.runOn"),
|
|
1346
|
+
runningPreview: opPreview,
|
|
1347
|
+
runningFallback: t("timeline.toolPresentation.running"),
|
|
1348
|
+
settledPreview: opPreview,
|
|
1349
|
+
omitEmptyResult: true
|
|
1350
|
+
});
|
|
1351
|
+
}
|
|
1352
|
+
function machinePresentation(t, item) {
|
|
1353
|
+
const leaf = mcpToolLeaf(item.name);
|
|
1354
|
+
const args = parseToolArgs(item.arguments);
|
|
1355
|
+
const action = leaf === "computer_act" ? computerActAction(args) : null;
|
|
1356
|
+
const preview = (action && computerActPreview(action)) ?? null;
|
|
1357
|
+
const failed = item.status !== "running" && item.status !== "cancelled" && (item.status === "failed" || unwrapMcpOutput(item.output).isError);
|
|
1358
|
+
return mcpRowPresentation(t, item, {
|
|
1359
|
+
tool: "machine",
|
|
1360
|
+
icon: isScreenTool(leaf) ? "panels" : "server",
|
|
1361
|
+
title: failed ? machineFailureTitle(t, leaf) : machineTitle(t, leaf, args, action, item.output),
|
|
1362
|
+
runningPreview: preview,
|
|
1363
|
+
runningFallback: t("timeline.toolPresentation.running"),
|
|
1364
|
+
settledPreview: preview,
|
|
1365
|
+
settledFallback: t("timeline.toolPresentation.done"),
|
|
1366
|
+
plainRunningPreview: true,
|
|
1367
|
+
quietError: true
|
|
1368
|
+
});
|
|
1369
|
+
}
|
|
1370
|
+
function isScreenTool(leaf) {
|
|
1371
|
+
return leaf.startsWith("computer_") || leaf.startsWith("cua_") || leaf === "interaction_discover";
|
|
1372
|
+
}
|
|
1373
|
+
function machineFailureTitle(t, leaf) {
|
|
1374
|
+
switch (leaf) {
|
|
1375
|
+
case "sandboxes_list":
|
|
1376
|
+
return t("timeline.toolPresentation.couldNotLookForMachines");
|
|
1377
|
+
case "sandbox_swap":
|
|
1378
|
+
return t("timeline.toolPresentation.couldNotMoveToTheMachine");
|
|
1379
|
+
case "computer_open":
|
|
1380
|
+
return t("timeline.toolPresentation.couldNotOpenTheScreen");
|
|
1381
|
+
default:
|
|
1382
|
+
return t("timeline.toolPresentation.couldNotUseTheScreen");
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
function cuaTitle(t, leaf) {
|
|
1386
|
+
if (/^cua_(get_|list_|verify_|parse_|zoom$)/.test(leaf)) {
|
|
1387
|
+
return t("timeline.toolPresentation.lookedAtTheScreen");
|
|
1388
|
+
}
|
|
1389
|
+
if (/^cua_(click|double_click|right_click)$/.test(leaf)) {
|
|
1390
|
+
return t("timeline.toolPresentation.clickedOnTheScreen");
|
|
1391
|
+
}
|
|
1392
|
+
if (/^cua_(type_text|press_key|hotkey)$/.test(leaf)) {
|
|
1393
|
+
return t("timeline.toolPresentation.typedOnTheKeyboard");
|
|
1394
|
+
}
|
|
1395
|
+
return t("timeline.toolPresentation.usedTheScreen");
|
|
1396
|
+
}
|
|
1397
|
+
function computerActAction(args) {
|
|
1398
|
+
const action = args.action;
|
|
1399
|
+
return action && typeof action === "object" ? action : null;
|
|
1400
|
+
}
|
|
1401
|
+
function machineTitle(t, leaf, args, action, output) {
|
|
1402
|
+
switch (leaf) {
|
|
1403
|
+
case "sandboxes_list":
|
|
1404
|
+
return t("timeline.toolPresentation.lookedForMachines");
|
|
1405
|
+
case "interaction_discover":
|
|
1406
|
+
return t("timeline.toolPresentation.lookedForScreens");
|
|
1407
|
+
case "sandbox_swap": {
|
|
1408
|
+
if (args.target === "session") return t("timeline.toolPresentation.movedBack");
|
|
1409
|
+
const targetName = runOnTargetName(output);
|
|
1410
|
+
return targetName ? t("timeline.toolPresentation.movedToTargetname", { targetName }) : t("timeline.toolPresentation.movedToAMachine");
|
|
1411
|
+
}
|
|
1412
|
+
case "computer_open":
|
|
1413
|
+
return t("timeline.toolPresentation.openedTheScreen");
|
|
1414
|
+
case "computer_act":
|
|
1415
|
+
return action?.type === "pointer" ? t("timeline.toolPresentation.clickedOnTheScreen") : action?.type === "keyboard" ? t("timeline.toolPresentation.typedOnTheKeyboard") : t("timeline.toolPresentation.usedTheScreen");
|
|
1416
|
+
default:
|
|
1417
|
+
return leaf.startsWith("cua_") ? cuaTitle(t, leaf) : t("timeline.toolPresentation.lookedAtTheScreen");
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
function computerActPreview(action) {
|
|
1421
|
+
const locator = action.locator && typeof action.locator === "object" ? action.locator : void 0;
|
|
1422
|
+
const named = typeof locator?.name === "string" ? locator.name : typeof locator?.text === "string" ? locator.text : void 0;
|
|
1423
|
+
const shown = (action.type === "keyboard" && typeof action.value === "string" ? action.value : named)?.trim();
|
|
1424
|
+
if (!shown) return void 0;
|
|
1425
|
+
return `\u201C${shown.length > 60 ? `${shown.slice(0, 59)}\u2026` : shown}\u201D`;
|
|
1426
|
+
}
|
|
1427
|
+
function genericToolPresentation(t, item) {
|
|
1428
|
+
const goalPreview = goalToolPreview(item.name, parseToolArgs(item.arguments));
|
|
1429
|
+
if (item.status !== "running") {
|
|
1430
|
+
const { text: outText, isError } = unwrapMcpOutput(item.output);
|
|
1431
|
+
const base = {
|
|
1432
|
+
tool: "generic",
|
|
1433
|
+
icon: genericToolIconKind(item.name),
|
|
1434
|
+
title: toolDisplayName(t, item.name, item.display)
|
|
1435
|
+
};
|
|
1436
|
+
const args = parseToolArgs(item.arguments);
|
|
1437
|
+
if (isError && BLOCKED_OUTPUT.test(outText)) {
|
|
1438
|
+
return {
|
|
1439
|
+
...base,
|
|
1440
|
+
iconTone: "muted",
|
|
1441
|
+
chip: { tone: "interrupted", text: t("timeline.chip.blocked") },
|
|
1442
|
+
preview: textPreview(t("timeline.toolPresentation.blockedByYourPermissionSettings")),
|
|
1443
|
+
body: {
|
|
1444
|
+
kind: "payloads",
|
|
1445
|
+
note: t("timeline.toolPresentation.yourPermissionSettingsBlockThis"),
|
|
1446
|
+
blocks: [{ label: t("timeline.toolPresentation.arguments"), value: args }]
|
|
1447
|
+
}
|
|
1448
|
+
};
|
|
1449
|
+
}
|
|
1450
|
+
if (isError && UNCERTAIN_OUTPUT.test(outText)) {
|
|
1451
|
+
return {
|
|
1452
|
+
...base,
|
|
1453
|
+
iconTone: "failed",
|
|
1454
|
+
chip: { tone: "bad", text: t("timeline.toolPresentation.outcomeUnknown") },
|
|
1455
|
+
preview: textPreview(t("timeline.toolPresentation.itMayHaveRun")),
|
|
1456
|
+
body: {
|
|
1457
|
+
kind: "payloads",
|
|
1458
|
+
note: t("timeline.toolPresentation.thisActionMayHaveRun"),
|
|
1459
|
+
blocks: [{ label: t("timeline.toolPresentation.arguments"), value: args }]
|
|
1460
|
+
}
|
|
1461
|
+
};
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
return mcpRowPresentation(t, item, {
|
|
1465
|
+
tool: "generic",
|
|
1466
|
+
icon: genericToolIconKind(item.name),
|
|
1467
|
+
title: toolDisplayName(t, item.name, item.display),
|
|
1468
|
+
runningPreview: goalPreview,
|
|
1469
|
+
runningFallback: t("timeline.toolPresentation.running"),
|
|
1470
|
+
settledPreview: goalPreview,
|
|
1471
|
+
settledFallback: t("timeline.toolPresentation.done"),
|
|
1472
|
+
plainRunningPreview: true
|
|
1473
|
+
});
|
|
1474
|
+
}
|
|
1475
|
+
var BLOCKED_OUTPUT = /Connector action was not executed: blocked\b/;
|
|
1476
|
+
var UNCERTAIN_OUTPUT = /Connector action outcome is uncertain\b/;
|
|
1477
|
+
function splitToolWireName(name) {
|
|
1478
|
+
const boundary = name.indexOf("__");
|
|
1479
|
+
if (boundary <= 0) {
|
|
1480
|
+
return { name, source: null, leaf: name };
|
|
1481
|
+
}
|
|
1482
|
+
return {
|
|
1483
|
+
name,
|
|
1484
|
+
source: name.slice(0, boundary),
|
|
1485
|
+
leaf: name.slice(boundary + 2)
|
|
1486
|
+
};
|
|
1487
|
+
}
|
|
1488
|
+
function toolSearchQuery(item) {
|
|
1489
|
+
const fromArgs = parseToolArgs(item.arguments);
|
|
1490
|
+
if (typeof fromArgs.query === "string" && fromArgs.query.trim()) {
|
|
1491
|
+
return fromArgs.query.trim();
|
|
1492
|
+
}
|
|
1493
|
+
const raw = item.raw;
|
|
1494
|
+
if (raw && typeof raw === "object") {
|
|
1495
|
+
const rawArgs = raw.arguments;
|
|
1496
|
+
if (typeof rawArgs === "string" && rawArgs.trim()) {
|
|
1497
|
+
const parsed = tryParseJson(rawArgs);
|
|
1498
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
1499
|
+
const query = parsed.query;
|
|
1500
|
+
if (typeof query === "string" && query.trim()) {
|
|
1501
|
+
return query.trim();
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
} else if (rawArgs && typeof rawArgs === "object" && !Array.isArray(rawArgs)) {
|
|
1505
|
+
const query = rawArgs.query;
|
|
1506
|
+
if (typeof query === "string" && query.trim()) {
|
|
1507
|
+
return query.trim();
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
return "";
|
|
1512
|
+
}
|
|
1513
|
+
function parseDisclosedTools(output) {
|
|
1514
|
+
if (output && typeof output === "object" && !Array.isArray(output)) {
|
|
1515
|
+
const tools = output.tools;
|
|
1516
|
+
if (Array.isArray(tools)) {
|
|
1517
|
+
return tools.map((tool) => {
|
|
1518
|
+
if (typeof tool === "string" && tool.trim()) {
|
|
1519
|
+
return splitToolWireName(tool.trim());
|
|
1520
|
+
}
|
|
1521
|
+
if (tool && typeof tool === "object" && typeof tool.name === "string") {
|
|
1522
|
+
const name = tool.name.trim();
|
|
1523
|
+
return name ? splitToolWireName(name) : null;
|
|
1524
|
+
}
|
|
1525
|
+
return null;
|
|
1526
|
+
}).filter((tool) => tool != null);
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
const { text } = unwrapMcpOutput(output);
|
|
1530
|
+
const trimmed = text.trim();
|
|
1531
|
+
if (!trimmed) {
|
|
1532
|
+
return null;
|
|
1533
|
+
}
|
|
1534
|
+
if (/^no matching tools found\.?$/i.test(trimmed)) {
|
|
1535
|
+
return [];
|
|
1536
|
+
}
|
|
1537
|
+
const disclosed = trimmed.match(/^disclosed tools:\s*(.+)$/i);
|
|
1538
|
+
if (disclosed?.[1]) {
|
|
1539
|
+
return disclosed[1].split(",").map((part) => part.trim()).filter(Boolean).map(splitToolWireName);
|
|
1540
|
+
}
|
|
1541
|
+
const parsed = tryParseJson(trimmed);
|
|
1542
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
1543
|
+
return parseDisclosedTools(parsed);
|
|
1544
|
+
}
|
|
1545
|
+
return null;
|
|
1546
|
+
}
|
|
1547
|
+
function toolSearchPreview(t, tools, cancelled) {
|
|
1548
|
+
if (cancelled) {
|
|
1549
|
+
return void 0;
|
|
1550
|
+
}
|
|
1551
|
+
if (!tools) {
|
|
1552
|
+
return t("timeline.toolPresentation.done");
|
|
1553
|
+
}
|
|
1554
|
+
if (tools.length === 0) {
|
|
1555
|
+
return t("timeline.toolPresentation.noMatches");
|
|
1556
|
+
}
|
|
1557
|
+
if (tools.length === 1) {
|
|
1558
|
+
return tools[0].leaf;
|
|
1559
|
+
}
|
|
1560
|
+
const head = tools[0].leaf;
|
|
1561
|
+
return t("timeline.toolPresentation.lengthToolsTruncatepreview", {
|
|
1562
|
+
length: tools.length,
|
|
1563
|
+
truncatePreview: truncatePreview(head, 28)
|
|
1564
|
+
});
|
|
1565
|
+
}
|
|
1566
|
+
function toolSearchPresentation(t, item) {
|
|
1567
|
+
const query = toolSearchQuery(item);
|
|
1568
|
+
const queryPreview = query ? truncatePreview(query, 64) : "";
|
|
1569
|
+
const note = query ? `capability query: ${query}` : void 0;
|
|
1570
|
+
const args = parseToolArgs(item.arguments);
|
|
1571
|
+
const base = { tool: "tool_search", icon: "package-search" };
|
|
1572
|
+
if (item.status === "running") {
|
|
1573
|
+
return {
|
|
1574
|
+
...base,
|
|
1575
|
+
iconTone: "running",
|
|
1576
|
+
title: t("timeline.toolPresentation.lookingUpTools"),
|
|
1577
|
+
running: true,
|
|
1578
|
+
preview: textPreview(
|
|
1579
|
+
queryPreview || t("timeline.toolPresentation.matchingCapabilities"),
|
|
1580
|
+
true
|
|
1581
|
+
),
|
|
1582
|
+
body: {
|
|
1583
|
+
kind: "listing",
|
|
1584
|
+
note,
|
|
1585
|
+
entries: [],
|
|
1586
|
+
blocks: [{ label: t("timeline.toolPresentation.arguments"), value: args }]
|
|
1587
|
+
}
|
|
1588
|
+
};
|
|
1589
|
+
}
|
|
1590
|
+
const { text: outText, isError } = unwrapMcpOutput(item.output);
|
|
1591
|
+
if ((isError || item.status === "failed") && item.status !== "cancelled") {
|
|
1592
|
+
return {
|
|
1593
|
+
...base,
|
|
1594
|
+
iconTone: "failed",
|
|
1595
|
+
title: t("timeline.toolPresentation.toolLookupFailed"),
|
|
1596
|
+
failed: true,
|
|
1597
|
+
preview: textPreview(
|
|
1598
|
+
truncatePreview(outText, 80) || queryPreview || t("timeline.toolPresentation.lookupFailed")
|
|
1599
|
+
),
|
|
1600
|
+
body: {
|
|
1601
|
+
kind: "listing",
|
|
1602
|
+
note,
|
|
1603
|
+
entries: [],
|
|
1604
|
+
blocks: [
|
|
1605
|
+
{ label: t("timeline.toolPresentation.arguments"), value: args },
|
|
1606
|
+
{ label: t("timeline.toolPresentation.error"), value: outText, failed: true }
|
|
1607
|
+
]
|
|
1608
|
+
}
|
|
1609
|
+
};
|
|
1610
|
+
}
|
|
1611
|
+
const tools = parseDisclosedTools(item.output);
|
|
1612
|
+
const preview = toolSearchPreview(t, tools, item.status === "cancelled");
|
|
1613
|
+
return {
|
|
1614
|
+
...base,
|
|
1615
|
+
iconTone: "muted",
|
|
1616
|
+
title: t("timeline.toolPresentation.lookedUpTools"),
|
|
1617
|
+
cancelled: item.status === "cancelled",
|
|
1618
|
+
...preview ? { preview: textPreview(preview) } : {},
|
|
1619
|
+
body: {
|
|
1620
|
+
kind: "listing",
|
|
1621
|
+
note,
|
|
1622
|
+
entries: (tools ?? []).slice(0, 12).map((tool) => ({
|
|
1623
|
+
key: tool.name,
|
|
1624
|
+
title: tool.leaf,
|
|
1625
|
+
eyebrow: tool.source,
|
|
1626
|
+
mono: true
|
|
1627
|
+
})),
|
|
1628
|
+
more: tools && tools.length > 12 ? tools.length - 12 : void 0,
|
|
1629
|
+
empty: tools && tools.length === 0 ? t("timeline.toolPresentation.noDeferredToolsMatchedThis") : void 0,
|
|
1630
|
+
blocks: tools == null && outText ? [
|
|
1631
|
+
{ label: t("timeline.toolPresentation.arguments"), value: args },
|
|
1632
|
+
{ label: t("timeline.toolPresentation.result"), value: outText }
|
|
1633
|
+
] : [{ label: t("timeline.toolPresentation.arguments"), value: args }]
|
|
1634
|
+
}
|
|
1635
|
+
};
|
|
1636
|
+
}
|
|
1637
|
+
function parseSearchHits(t, outText) {
|
|
1638
|
+
const parsed = tryParseJson(outText);
|
|
1639
|
+
if (parsed == null) {
|
|
1640
|
+
return null;
|
|
1641
|
+
}
|
|
1642
|
+
const list = Array.isArray(parsed) ? parsed : parsed && typeof parsed === "object" && Array.isArray(parsed.results) ? parsed.results : parsed && typeof parsed === "object" && Array.isArray(parsed.hits) ? parsed.hits : null;
|
|
1643
|
+
if (!list) {
|
|
1644
|
+
return null;
|
|
1645
|
+
}
|
|
1646
|
+
return list.map((row) => {
|
|
1647
|
+
const r = row && typeof row === "object" ? row : {};
|
|
1648
|
+
const title = typeof r.title === "string" && r.title || typeof r.name === "string" && r.name || typeof r.documentTitle === "string" && r.documentTitle || typeof r.path === "string" && r.path || typeof r.id === "string" && r.id || t("timeline.toolPresentation.result");
|
|
1649
|
+
const snippet = typeof r.snippet === "string" && r.snippet || typeof r.text === "string" && r.text || typeof r.content === "string" && r.content || "";
|
|
1650
|
+
return { title, snippet: truncatePreview(snippet, 160) };
|
|
1651
|
+
});
|
|
1652
|
+
}
|
|
1653
|
+
function docsSearchPresentation(t, item) {
|
|
1654
|
+
const args = parseToolArgs(item.arguments);
|
|
1655
|
+
const query = typeof args.query === "string" ? args.query.trim() : "";
|
|
1656
|
+
const base = {
|
|
1657
|
+
tool: "docs_search",
|
|
1658
|
+
icon: "file-search",
|
|
1659
|
+
title: query ? t("timeline.toolPresentation.searchTruncatepreview", {
|
|
1660
|
+
truncatePreview: truncatePreview(query, 48)
|
|
1661
|
+
}) : toolDisplayName(t, item.name, item.display)
|
|
1662
|
+
};
|
|
1663
|
+
if (item.status === "running") {
|
|
1664
|
+
return {
|
|
1665
|
+
...base,
|
|
1666
|
+
iconTone: "running",
|
|
1667
|
+
running: true,
|
|
1668
|
+
preview: textPreview(t("timeline.toolPresentation.searching"), true),
|
|
1669
|
+
body: {
|
|
1670
|
+
kind: "payloads",
|
|
1671
|
+
blocks: [{ label: t("timeline.toolPresentation.arguments"), value: args }]
|
|
1672
|
+
}
|
|
1673
|
+
};
|
|
1674
|
+
}
|
|
1675
|
+
const { text: outText, isError } = unwrapMcpOutput(item.output);
|
|
1676
|
+
if ((isError || item.status === "failed") && item.status !== "cancelled") {
|
|
1677
|
+
return {
|
|
1678
|
+
...base,
|
|
1679
|
+
iconTone: "failed",
|
|
1680
|
+
failed: true,
|
|
1681
|
+
preview: textPreview(
|
|
1682
|
+
truncatePreview(outText, 80) || t("timeline.toolPresentation.searchFailed")
|
|
1683
|
+
),
|
|
1684
|
+
body: {
|
|
1685
|
+
kind: "payloads",
|
|
1686
|
+
blocks: [
|
|
1687
|
+
{ label: t("timeline.toolPresentation.arguments"), value: args },
|
|
1688
|
+
{ label: t("timeline.toolPresentation.error"), value: outText, failed: true }
|
|
1689
|
+
]
|
|
1690
|
+
}
|
|
1691
|
+
};
|
|
1692
|
+
}
|
|
1693
|
+
const hits = parseSearchHits(t, outText);
|
|
1694
|
+
const preview = item.status === "cancelled" ? void 0 : hits ? hits.length === 0 ? t("timeline.toolPresentation.noHits") : t("counts.hits", { count: hits.length }) : t("timeline.toolPresentation.done");
|
|
1695
|
+
return {
|
|
1696
|
+
...base,
|
|
1697
|
+
iconTone: "muted",
|
|
1698
|
+
cancelled: item.status === "cancelled",
|
|
1699
|
+
...preview ? { preview: textPreview(preview) } : {},
|
|
1700
|
+
body: {
|
|
1701
|
+
kind: "listing",
|
|
1702
|
+
entries: (hits ?? []).slice(0, 8).map((hit) => ({
|
|
1703
|
+
key: `${hit.title}\0${hit.snippet}`,
|
|
1704
|
+
title: hit.title,
|
|
1705
|
+
snippet: hit.snippet || void 0
|
|
1706
|
+
})),
|
|
1707
|
+
blocks: [
|
|
1708
|
+
{ label: t("timeline.toolPresentation.arguments"), value: args },
|
|
1709
|
+
{ label: t("timeline.toolPresentation.result"), value: outText }
|
|
1710
|
+
]
|
|
1711
|
+
}
|
|
1712
|
+
};
|
|
1713
|
+
}
|
|
1714
|
+
function sessionTitlePresentation(t, item) {
|
|
1715
|
+
const args = parseToolArgs(item.arguments);
|
|
1716
|
+
const titleArg = typeof args.title === "string" ? args.title.trim() : "";
|
|
1717
|
+
const previewTitle = titleArg ? truncatePreview(titleArg, 72) : "";
|
|
1718
|
+
const base = {
|
|
1719
|
+
tool: "session_title",
|
|
1720
|
+
icon: "sessions",
|
|
1721
|
+
title: toolDisplayName(t, item.name, item.display)
|
|
1722
|
+
};
|
|
1723
|
+
if (item.status === "running") {
|
|
1724
|
+
return {
|
|
1725
|
+
...base,
|
|
1726
|
+
iconTone: "running",
|
|
1727
|
+
running: true,
|
|
1728
|
+
preview: textPreview(previewTitle || t("timeline.toolPresentation.settingTitle"), true),
|
|
1729
|
+
body: {
|
|
1730
|
+
kind: "payloads",
|
|
1731
|
+
blocks: [{ label: t("timeline.toolPresentation.arguments"), value: args }]
|
|
1732
|
+
}
|
|
1733
|
+
};
|
|
1734
|
+
}
|
|
1735
|
+
const { text: outText, isError } = unwrapMcpOutput(item.output);
|
|
1736
|
+
if ((isError || item.status === "failed") && item.status !== "cancelled") {
|
|
1737
|
+
return {
|
|
1738
|
+
...base,
|
|
1739
|
+
iconTone: "failed",
|
|
1740
|
+
failed: true,
|
|
1741
|
+
preview: textPreview(
|
|
1742
|
+
truncatePreview(outText, 80) || t("timeline.toolPresentation.renameFailed")
|
|
1743
|
+
),
|
|
1744
|
+
body: {
|
|
1745
|
+
kind: "payloads",
|
|
1746
|
+
blocks: [
|
|
1747
|
+
{ label: t("timeline.toolPresentation.arguments"), value: args },
|
|
1748
|
+
{ label: t("timeline.toolPresentation.error"), value: outText, failed: true }
|
|
1749
|
+
]
|
|
1750
|
+
}
|
|
1751
|
+
};
|
|
1752
|
+
}
|
|
1753
|
+
let settledTitle = previewTitle;
|
|
1754
|
+
if (!settledTitle) {
|
|
1755
|
+
const parsed = tryParseJson(outText);
|
|
1756
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
1757
|
+
const fromResult = parsed.title;
|
|
1758
|
+
if (typeof fromResult === "string" && fromResult.trim()) {
|
|
1759
|
+
settledTitle = truncatePreview(fromResult.trim(), 72);
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
return {
|
|
1764
|
+
...base,
|
|
1765
|
+
iconTone: "muted",
|
|
1766
|
+
cancelled: item.status === "cancelled",
|
|
1767
|
+
...item.status !== "cancelled" && settledTitle ? { preview: textPreview(settledTitle) } : {},
|
|
1768
|
+
body: {
|
|
1769
|
+
kind: "payloads",
|
|
1770
|
+
blocks: outText ? [
|
|
1771
|
+
{ label: t("timeline.toolPresentation.arguments"), value: args },
|
|
1772
|
+
{ label: t("timeline.toolPresentation.result"), value: outText }
|
|
1773
|
+
] : [{ label: t("timeline.toolPresentation.arguments"), value: args }]
|
|
1774
|
+
}
|
|
1775
|
+
};
|
|
1776
|
+
}
|
|
1777
|
+
var PRESENTERS_BY_RAW_TYPE = {
|
|
1778
|
+
apply_patch_call: "apply_patch",
|
|
1779
|
+
// Web renders these with richer media renderers; keep them off name matches.
|
|
1780
|
+
computer_call: "generic",
|
|
1781
|
+
tool_search_call: "tool_search"
|
|
1782
|
+
};
|
|
1783
|
+
var PRESENTERS_BY_NAME = {
|
|
1784
|
+
exec_command: "exec",
|
|
1785
|
+
request_human_input: "ask",
|
|
1786
|
+
run_on: "run_on",
|
|
1787
|
+
write_stdin: "write_stdin",
|
|
1788
|
+
apply_patch_call: "apply_patch",
|
|
1789
|
+
apply_patch: "apply_patch",
|
|
1790
|
+
web_search_call: "web_search",
|
|
1791
|
+
tool_search: "tool_search",
|
|
1792
|
+
search_documents: "docs_search",
|
|
1793
|
+
knowledge_search: "docs_search",
|
|
1794
|
+
set_session_title: "session_title",
|
|
1795
|
+
set_other_session_title: "session_title",
|
|
1796
|
+
sandboxes_list: "machine",
|
|
1797
|
+
sandbox_swap: "machine",
|
|
1798
|
+
computer_open: "machine",
|
|
1799
|
+
computer_observe: "machine",
|
|
1800
|
+
computer_act: "machine",
|
|
1801
|
+
interaction_discover: "machine"
|
|
1802
|
+
};
|
|
1803
|
+
function presentedToolKind(item) {
|
|
1804
|
+
const rawType = rawTypeOf(item);
|
|
1805
|
+
if (rawType && PRESENTERS_BY_RAW_TYPE[rawType]) {
|
|
1806
|
+
return PRESENTERS_BY_RAW_TYPE[rawType];
|
|
1807
|
+
}
|
|
1808
|
+
const exact = PRESENTERS_BY_NAME[item.name];
|
|
1809
|
+
if (exact) {
|
|
1810
|
+
return exact;
|
|
1811
|
+
}
|
|
1812
|
+
const leaf = mcpToolLeaf(item.name);
|
|
1813
|
+
if (leaf !== item.name && PRESENTERS_BY_NAME[leaf]) {
|
|
1814
|
+
return PRESENTERS_BY_NAME[leaf];
|
|
1815
|
+
}
|
|
1816
|
+
if (leaf.startsWith("cua_")) {
|
|
1817
|
+
return "machine";
|
|
1818
|
+
}
|
|
1819
|
+
return "generic";
|
|
1820
|
+
}
|
|
1821
|
+
function toolRowPresentation(t, item, context = {}) {
|
|
1822
|
+
item = invokedToolCall(item);
|
|
1823
|
+
switch (presentedToolKind(item)) {
|
|
1824
|
+
case "exec":
|
|
1825
|
+
return execPresentation(t, item, context);
|
|
1826
|
+
case "write_stdin":
|
|
1827
|
+
return writeStdinPresentation(t, item);
|
|
1828
|
+
case "apply_patch":
|
|
1829
|
+
return applyPatchPresentation(t, item) ?? genericToolPresentation(t, item);
|
|
1830
|
+
case "web_search":
|
|
1831
|
+
return webSearchPresentation(t, item);
|
|
1832
|
+
case "ask":
|
|
1833
|
+
return askPresentation(t, item);
|
|
1834
|
+
case "run_on":
|
|
1835
|
+
return runOnPresentation(t, item);
|
|
1836
|
+
case "tool_search":
|
|
1837
|
+
return toolSearchPresentation(t, item);
|
|
1838
|
+
case "docs_search":
|
|
1839
|
+
return docsSearchPresentation(t, item);
|
|
1840
|
+
case "session_title":
|
|
1841
|
+
return sessionTitlePresentation(t, item);
|
|
1842
|
+
case "machine":
|
|
1843
|
+
return machinePresentation(t, item);
|
|
1844
|
+
default:
|
|
1845
|
+
return genericToolPresentation(t, item);
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
// src/timeline/genie-copy.ts
|
|
1850
|
+
var GENIE_PREPARING_PHRASES = (t) => [
|
|
1851
|
+
t("timeline.genieCopy.polishingTheLamp"),
|
|
1852
|
+
t("timeline.genieCopy.consultingTheCarpet"),
|
|
1853
|
+
t("timeline.genieCopy.untanglingWishes"),
|
|
1854
|
+
t("timeline.genieCopy.summoningALittleCleverness"),
|
|
1855
|
+
t("timeline.genieCopy.checkingTheFinePrintOn"),
|
|
1856
|
+
t("timeline.genieCopy.warmingUpTheAbracadabra"),
|
|
1857
|
+
t("timeline.genieCopy.rearrangingTheStars"),
|
|
1858
|
+
t("timeline.genieCopy.negotiatingWithTheLamp"),
|
|
1859
|
+
t("timeline.genieCopy.dustingOffAThousandYears"),
|
|
1860
|
+
t("timeline.genieCopy.wishfulThinking"),
|
|
1861
|
+
t("timeline.genieCopy.decantingALittleMagic"),
|
|
1862
|
+
t("timeline.genieCopy.findingTheGoodStardust"),
|
|
1863
|
+
t("timeline.genieCopy.fluffingTheMagicCarpet"),
|
|
1864
|
+
t("timeline.genieCopy.puttingAWishIntoMotion"),
|
|
1865
|
+
t("timeline.genieCopy.aLittleHocusALittle")
|
|
1866
|
+
];
|
|
1867
|
+
var GENIE_WAITING_PHRASES = (t) => [
|
|
1868
|
+
t("timeline.genieCopy.waitingForAResponse")
|
|
1869
|
+
];
|
|
1870
|
+
|
|
1871
|
+
// src/human-input-model.ts
|
|
1872
|
+
var SAVE_TO_IN_SENTENCE = (t) => ({
|
|
1873
|
+
user: t("humanInputModel.onlyMe"),
|
|
1874
|
+
task: t("humanInputModel.thisTask"),
|
|
1875
|
+
workspace: t("humanInputModel.thisWorkspace")
|
|
1876
|
+
});
|
|
1877
|
+
var defaultHumanInputFormMessages = (t) => ({
|
|
1878
|
+
title: t("humanInputModel.inputRequired"),
|
|
1879
|
+
/** Multi-question chrome has no default subtitle; hosts may still override. */
|
|
1880
|
+
description: "",
|
|
1881
|
+
submit: t("humanInputModel.sendAnswers"),
|
|
1882
|
+
skip: t("humanInputModel.skip"),
|
|
1883
|
+
submitting: t("humanInputModel.submitting"),
|
|
1884
|
+
other: t("humanInputModel.other"),
|
|
1885
|
+
deadlineLabel: t("humanInputModel.expires"),
|
|
1886
|
+
formatDeadline: (value) => formatDeadline(t, value),
|
|
1887
|
+
required: t("humanInputModel.thisQuestionIsRequired"),
|
|
1888
|
+
otherRequired: t("humanInputModel.enterAValueForOther"),
|
|
1889
|
+
minSelections: (count) => t("humanInputModel.chooseAtLeastOptions", { count }),
|
|
1890
|
+
maxSelections: (count) => t("humanInputModel.chooseNoMoreThanOptions", { count }),
|
|
1891
|
+
optional: t("humanInputModel.optional"),
|
|
1892
|
+
moreBelow: t("humanInputModel.moreBelow"),
|
|
1893
|
+
questionCount: (count) => `${count} questions`,
|
|
1894
|
+
collapse: t("humanInputModel.collapse"),
|
|
1895
|
+
expand: t("humanInputModel.expand"),
|
|
1896
|
+
selectionHint: (min, max) => {
|
|
1897
|
+
if (min != null && max != null) return t("humanInputModel.chooseMinMax", { min, max });
|
|
1898
|
+
if (min != null) return t("humanInputModel.chooseAtLeastMin", { min });
|
|
1899
|
+
if (max != null) return t("humanInputModel.chooseUpToMax", { max });
|
|
1900
|
+
return null;
|
|
1901
|
+
},
|
|
1902
|
+
secretShow: t("humanInputModel.show"),
|
|
1903
|
+
secretHide: t("humanInputModel.hide"),
|
|
1904
|
+
secretGenerate: t("humanInputModel.generate"),
|
|
1905
|
+
secretWillGenerate: t("humanInputModel.aStrongPasswordWillBe"),
|
|
1906
|
+
secretUndo: t("humanInputModel.undo"),
|
|
1907
|
+
secretSaveTo: t("humanInputModel.saveTo"),
|
|
1908
|
+
secretSaveToOptions: {
|
|
1909
|
+
user: t("humanInputModel.onlyMe"),
|
|
1910
|
+
task: t("humanInputModel.thisTask2"),
|
|
1911
|
+
workspace: t("humanInputModel.thisWorkspace2")
|
|
1912
|
+
},
|
|
1913
|
+
secretVaultHint: (saveTo, vault) => vault ? t("humanInputModel.savesToTheVaultVault", { vault }) : saveTo === "user" ? t("humanInputModel.savesToYourPrivateVault") : saveTo === "task" ? t("humanInputModel.savesToThisTask") : t("humanInputModel.savesToTheWorkspaceVault"),
|
|
1914
|
+
secretSaveToDowngraded: (requested, actual) => t("humanInputModel.youCanTSaveTo", {
|
|
1915
|
+
requested: SAVE_TO_IN_SENTENCE(t)[requested],
|
|
1916
|
+
actual: SAVE_TO_IN_SENTENCE(t)[actual]
|
|
1917
|
+
}),
|
|
1918
|
+
secretLooksLike: (example) => t("humanInputModel.looksLikeExample", { example }),
|
|
1919
|
+
secretPatternWarning: (looksLike) => looksLike ? t("humanInputModel.thisDoesnTLookLike", { looksLike }) : t("humanInputModel.thisDoesnTMatchThe"),
|
|
1920
|
+
secretSaved: (vaultName, itemName) => t("humanInputModel.savedToVaultnameItemname", { vaultName, itemName })
|
|
1921
|
+
});
|
|
1922
|
+
function answersFromDrafts(t, questions, drafts, messageOverrides = {}) {
|
|
1923
|
+
const messages = { ...defaultHumanInputFormMessages(t), ...messageOverrides };
|
|
1924
|
+
const answers = [];
|
|
1925
|
+
const errors = {};
|
|
1926
|
+
for (const question of questions) {
|
|
1927
|
+
if (question.kind === "secret") continue;
|
|
1928
|
+
const draft = drafts[question.id] ?? emptyDraft();
|
|
1929
|
+
const values = question.kind === "text" ? draft.values.filter(Boolean) : draft.values;
|
|
1930
|
+
const other = draft.otherSelected ? draft.other : "";
|
|
1931
|
+
const hasOther = Boolean(other.trim());
|
|
1932
|
+
const supplied = values.length + (hasOther ? 1 : 0);
|
|
1933
|
+
if (question.kind !== "text" && draft.otherSelected && !hasOther) {
|
|
1934
|
+
errors[question.id] = messages.otherRequired;
|
|
1935
|
+
continue;
|
|
1936
|
+
}
|
|
1937
|
+
if (question.required && supplied === 0) {
|
|
1938
|
+
errors[question.id] = messages.required;
|
|
1939
|
+
continue;
|
|
1940
|
+
}
|
|
1941
|
+
if (question.kind !== "text") {
|
|
1942
|
+
const min = question.validation?.minSelections;
|
|
1943
|
+
const max = question.kind === "single_select" ? 1 : question.validation?.maxSelections;
|
|
1944
|
+
if (min != null && supplied < min) {
|
|
1945
|
+
errors[question.id] = messages.minSelections(min);
|
|
1946
|
+
continue;
|
|
1947
|
+
}
|
|
1948
|
+
if (max != null && supplied > max) {
|
|
1949
|
+
errors[question.id] = messages.maxSelections(max);
|
|
1950
|
+
continue;
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
if (supplied > 0) {
|
|
1954
|
+
answers.push({
|
|
1955
|
+
questionId: question.id,
|
|
1956
|
+
values,
|
|
1957
|
+
...hasOther ? { other } : {}
|
|
1958
|
+
});
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
return { answers, errors };
|
|
1962
|
+
}
|
|
1963
|
+
function initialDrafts(questions) {
|
|
1964
|
+
return Object.fromEntries(questions.map((question) => [question.id, emptyDraft()]));
|
|
1965
|
+
}
|
|
1966
|
+
function emptyDraft() {
|
|
1967
|
+
return { values: [], other: "", otherSelected: false };
|
|
1968
|
+
}
|
|
1969
|
+
function formatDeadline(t, value) {
|
|
1970
|
+
const date = new Date(value);
|
|
1971
|
+
if (Number.isNaN(date.getTime())) return value;
|
|
1972
|
+
const ms = date.getTime() - Date.now();
|
|
1973
|
+
if (ms <= 0) return t("humanInputModel.deadlinePassed");
|
|
1974
|
+
const minutes = Math.round(ms / 6e4);
|
|
1975
|
+
if (minutes < 1) return t("humanInputModel.inUnderAMinute");
|
|
1976
|
+
if (minutes < 60) return `in ${minutes}m`;
|
|
1977
|
+
const hours = Math.round(minutes / 60);
|
|
1978
|
+
if (hours < 48) return `in ${hours}h`;
|
|
1979
|
+
return date.toLocaleString(t.locale);
|
|
1980
|
+
}
|
|
1981
|
+
function humanInputHeading(questions, messages) {
|
|
1982
|
+
const single = questions.length === 1 ? questions[0] : null;
|
|
1983
|
+
return {
|
|
1984
|
+
title: single ? single.label ?? single.prompt : messages.title,
|
|
1985
|
+
description: single ? single.label ? single.prompt : single.helpText ?? null : messages.description || null
|
|
1986
|
+
};
|
|
1987
|
+
}
|
|
1988
|
+
var SECRET_SAVE_TO_ORDER = [
|
|
1989
|
+
"user",
|
|
1990
|
+
"task",
|
|
1991
|
+
"workspace"
|
|
1992
|
+
];
|
|
1993
|
+
function secretAutocomplete(spec) {
|
|
1994
|
+
if (spec.autocomplete && spec.autocomplete !== "current-password") return spec.autocomplete;
|
|
1995
|
+
if (spec.fieldKind === "totp") return "one-time-code";
|
|
1996
|
+
if (spec.allowGenerate || spec.generate) return "new-password";
|
|
1997
|
+
return "current-password";
|
|
1998
|
+
}
|
|
1999
|
+
function secretInputMode(spec) {
|
|
2000
|
+
return secretAutocomplete(spec) === "one-time-code" ? "numeric" : void 0;
|
|
2001
|
+
}
|
|
2002
|
+
function secretConcealed(spec) {
|
|
2003
|
+
return spec.fieldKind !== "text";
|
|
2004
|
+
}
|
|
2005
|
+
function secretCanGenerate(spec) {
|
|
2006
|
+
return Boolean(spec.allowGenerate || spec.generate) && spec.fieldKind !== "totp";
|
|
2007
|
+
}
|
|
2008
|
+
function secretFieldLabel(t, spec) {
|
|
2009
|
+
const field = spec.field?.trim() || "password";
|
|
2010
|
+
if (spec.fieldKind === "totp" && field.toLowerCase() === "password")
|
|
2011
|
+
return t("humanInputModel.oneTimeCode");
|
|
2012
|
+
if (spec.itemType === "api_key" && field.toLowerCase() === "password")
|
|
2013
|
+
return t("humanInputModel.apiKey");
|
|
2014
|
+
if (spec.itemType === "note" && field.toLowerCase() === "password")
|
|
2015
|
+
return t("humanInputModel.note");
|
|
2016
|
+
const words = field.replace(/[_-]+/g, " ").replace(/\s+/g, " ").trim();
|
|
2017
|
+
return words.charAt(0).toUpperCase() + words.slice(1);
|
|
2018
|
+
}
|
|
2019
|
+
function resolveSecretSaveTo(spec, allowed = SECRET_SAVE_TO_ORDER) {
|
|
2020
|
+
const requested = spec.saveTo ?? "user";
|
|
2021
|
+
const options = SECRET_SAVE_TO_ORDER.filter((target) => allowed.includes(target));
|
|
2022
|
+
if (options.includes(requested)) {
|
|
2023
|
+
return { requested, initial: requested, downgraded: false, options };
|
|
2024
|
+
}
|
|
2025
|
+
if (options.length === 0) {
|
|
2026
|
+
return { requested, initial: requested, downgraded: false, options: [requested] };
|
|
2027
|
+
}
|
|
2028
|
+
return { requested, initial: options[0], downgraded: true, options };
|
|
2029
|
+
}
|
|
2030
|
+
function secretVaultForTarget(spec, saveTo) {
|
|
2031
|
+
return spec.vault && saveTo === (spec.saveTo ?? "user") ? spec.vault : null;
|
|
2032
|
+
}
|
|
2033
|
+
function secretPatternMismatch(pattern, value) {
|
|
2034
|
+
if (!pattern || !value) return false;
|
|
2035
|
+
let expression;
|
|
2036
|
+
try {
|
|
2037
|
+
expression = new RegExp(pattern, "u");
|
|
2038
|
+
} catch {
|
|
2039
|
+
try {
|
|
2040
|
+
expression = new RegExp(pattern);
|
|
2041
|
+
} catch {
|
|
2042
|
+
return false;
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
return !expression.test(value);
|
|
2046
|
+
}
|
|
2047
|
+
function secretAnswerFromReading(t, question, reading, messageOverrides = {}) {
|
|
2048
|
+
const messages = { ...defaultHumanInputFormMessages(t), ...messageOverrides };
|
|
2049
|
+
const value = reading.generate ? null : reading.value || null;
|
|
2050
|
+
if (!reading.generate && value === null) {
|
|
2051
|
+
return question.required ? { error: messages.required } : null;
|
|
2052
|
+
}
|
|
2053
|
+
const username = reading.username?.trim() || null;
|
|
2054
|
+
const secretAnswer = {
|
|
2055
|
+
questionId: question.id,
|
|
2056
|
+
...reading.generate ? { generate: reading.generate } : { value },
|
|
2057
|
+
...username ? { username } : {},
|
|
2058
|
+
saveTo: reading.saveTo
|
|
2059
|
+
};
|
|
2060
|
+
return { answer: { questionId: question.id, values: [] }, secretAnswer };
|
|
2061
|
+
}
|
|
2062
|
+
function secretAnswerLabel(t, result, messageOverrides = {}) {
|
|
2063
|
+
const messages = { ...defaultHumanInputFormMessages(t), ...messageOverrides };
|
|
2064
|
+
return messages.secretSaved(result.vaultName, result.itemName);
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
// src/timeline/notice-presentation.ts
|
|
2068
|
+
function noticeIsResolvedApproval(item) {
|
|
2069
|
+
return Boolean(item.resolvedAt && item.approval);
|
|
2070
|
+
}
|
|
2071
|
+
function noticeDisplayText(t, item) {
|
|
2072
|
+
return noticeIsResolvedApproval(item) ? t("timeline.noticePresentation.youRespondedToThisApproval") : item.text;
|
|
2073
|
+
}
|
|
2074
|
+
function noticeTone(item) {
|
|
2075
|
+
return item.tone === "failed" ? "failed" : item.tone === "waiting" && !item.resolvedAt ? "waiting" : "neutral";
|
|
2076
|
+
}
|
|
2077
|
+
function recordedWaitSummaryText(t, item, now = /* @__PURE__ */ new Date()) {
|
|
2078
|
+
const agents = item.waitingAgents ?? 0;
|
|
2079
|
+
const waitedMs = item.waitEndedAt ? durationBetween(item.occurredAt, item.waitEndedAt) : void 0;
|
|
2080
|
+
if (waitedMs !== void 0) {
|
|
2081
|
+
const elapsed = formatElapsed(t, waitedMs);
|
|
2082
|
+
return agents > 0 ? t("timeline.noticePresentation.waitedForAgentsElapsed", { count: agents, elapsed }) : t("timeline.noticePresentation.waitedElapsed", { elapsed });
|
|
2083
|
+
}
|
|
2084
|
+
const started = new Date(item.occurredAt);
|
|
2085
|
+
const since = started.toDateString() === now.toDateString() ? formatClockTime(t, item.occurredAt) : started.toLocaleString(t.locale, { dateStyle: "medium", timeStyle: "short" });
|
|
2086
|
+
if (item.waitEndedAt)
|
|
2087
|
+
return agents > 0 ? t("timeline.noticePresentation.waitedForAgentsSince", { count: agents, since }) : t("timeline.noticePresentation.waitedSince", { since });
|
|
2088
|
+
return agents > 0 ? t("timeline.noticePresentation.waitingForAgentsSince", { count: agents, since }) : t("timeline.noticePresentation.waitingSince", { since });
|
|
2089
|
+
}
|
|
2090
|
+
|
|
2091
|
+
// src/timeline/question-nav-model.ts
|
|
2092
|
+
var QUESTION_NAV_HIDDEN_PX = 24;
|
|
2093
|
+
var QUESTION_NAV_MARGIN_PX = 12;
|
|
2094
|
+
function questionNavTarget(prompts, view) {
|
|
2095
|
+
const middle = view.top + view.height / 2;
|
|
2096
|
+
const prompt = [...prompts].reverse().find((candidate) => candidate.top <= middle);
|
|
2097
|
+
if (!prompt) return null;
|
|
2098
|
+
if (prompt.top >= view.top - QUESTION_NAV_HIDDEN_PX || prompt.bottom > view.top) return null;
|
|
2099
|
+
return prompt.key;
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
// src/timeline/focus-sequence.ts
|
|
2103
|
+
function itemSequences(item) {
|
|
2104
|
+
const sources = item.sourceEvents ?? ("annotationSource" in item && item.annotationSource ? [item.annotationSource] : []);
|
|
2105
|
+
return sources.map((source) => source.sequence);
|
|
2106
|
+
}
|
|
2107
|
+
function timelineGroupSequences(group) {
|
|
2108
|
+
if (group.kind === "item") return itemSequences(group.item);
|
|
2109
|
+
if (group.kind === "turn") return group.groups.flatMap(timelineGroupSequences);
|
|
2110
|
+
return [
|
|
2111
|
+
...group.items.flatMap((item) => itemSequences(item)),
|
|
2112
|
+
...group.work?.details.flatMap(timelineGroupSequences) ?? []
|
|
2113
|
+
];
|
|
2114
|
+
}
|
|
2115
|
+
function timelineGroupIndexAtSequence(groups, sequence) {
|
|
2116
|
+
let landing = -1;
|
|
2117
|
+
for (let index = 0; index < groups.length; index += 1) {
|
|
2118
|
+
const sequences = timelineGroupSequences(groups[index]);
|
|
2119
|
+
if (sequences.length === 0) continue;
|
|
2120
|
+
if (sequences.includes(sequence)) return index;
|
|
2121
|
+
if (Math.min(...sequences) <= sequence) landing = index;
|
|
2122
|
+
}
|
|
2123
|
+
return landing;
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
export {
|
|
2127
|
+
sandboxCommandExitCode,
|
|
2128
|
+
parseExecBannerSessionId,
|
|
2129
|
+
stripExecBanner,
|
|
2130
|
+
execTruncated,
|
|
2131
|
+
isExecSessionLostBanner,
|
|
2132
|
+
looksBinary,
|
|
2133
|
+
controlCaret,
|
|
2134
|
+
v4aToGitFileDiff,
|
|
2135
|
+
parseFreeformApplyPatch,
|
|
2136
|
+
applyPatchOps,
|
|
2137
|
+
applyPatchOpsFromToolItem,
|
|
2138
|
+
isApplyPatch,
|
|
2139
|
+
parseToolArgs,
|
|
2140
|
+
tailPeek,
|
|
2141
|
+
unwrapMcpOutput,
|
|
2142
|
+
screenshotDataUrl,
|
|
2143
|
+
retainedScreenshotMetadata,
|
|
2144
|
+
generatedImageReceipt,
|
|
2145
|
+
retainedToolResultImages,
|
|
2146
|
+
mediaPreviewFact,
|
|
2147
|
+
rawTypeOf,
|
|
2148
|
+
createToolRegistry,
|
|
2149
|
+
BUILT_IN_TURN_SUMMARY_FACET_IDS,
|
|
2150
|
+
formatElapsed,
|
|
2151
|
+
createTurnSummaryContext,
|
|
2152
|
+
BUILT_IN_TURN_SUMMARY_FACETS,
|
|
2153
|
+
resolveTurnSummaryFacets,
|
|
2154
|
+
formatDurationFacet,
|
|
2155
|
+
selectTurnSummaryFacets,
|
|
2156
|
+
durationBetween,
|
|
2157
|
+
compactedLandmarkCount,
|
|
2158
|
+
clusterIsSettled,
|
|
2159
|
+
flattenActivityItems,
|
|
2160
|
+
isPreparingWork,
|
|
2161
|
+
readableWorkHasDetails,
|
|
2162
|
+
readableWorkStatus,
|
|
2163
|
+
readableWorkDefaultOpen,
|
|
2164
|
+
readableWorkShowsPreview,
|
|
2165
|
+
rollingActivityItem,
|
|
2166
|
+
invokedToolCall,
|
|
2167
|
+
withComputePreview,
|
|
2168
|
+
truncatePreview,
|
|
2169
|
+
execPresentation,
|
|
2170
|
+
writeStdinPresentation,
|
|
2171
|
+
pathBasename,
|
|
2172
|
+
pathDirname,
|
|
2173
|
+
applyPatchPresentation,
|
|
2174
|
+
webSearchPresentation,
|
|
2175
|
+
genericToolIconKind,
|
|
2176
|
+
askPresentation,
|
|
2177
|
+
runOnPresentation,
|
|
2178
|
+
machinePresentation,
|
|
2179
|
+
genericToolPresentation,
|
|
2180
|
+
toolSearchQuery,
|
|
2181
|
+
parseDisclosedTools,
|
|
2182
|
+
toolSearchPreview,
|
|
2183
|
+
parseSearchHits,
|
|
2184
|
+
presentedToolKind,
|
|
2185
|
+
toolRowPresentation,
|
|
2186
|
+
GENIE_PREPARING_PHRASES,
|
|
2187
|
+
GENIE_WAITING_PHRASES,
|
|
2188
|
+
defaultHumanInputFormMessages,
|
|
2189
|
+
answersFromDrafts,
|
|
2190
|
+
initialDrafts,
|
|
2191
|
+
emptyDraft,
|
|
2192
|
+
formatDeadline,
|
|
2193
|
+
humanInputHeading,
|
|
2194
|
+
SECRET_SAVE_TO_ORDER,
|
|
2195
|
+
secretAutocomplete,
|
|
2196
|
+
secretInputMode,
|
|
2197
|
+
secretConcealed,
|
|
2198
|
+
secretCanGenerate,
|
|
2199
|
+
secretFieldLabel,
|
|
2200
|
+
resolveSecretSaveTo,
|
|
2201
|
+
secretVaultForTarget,
|
|
2202
|
+
secretPatternMismatch,
|
|
2203
|
+
secretAnswerFromReading,
|
|
2204
|
+
secretAnswerLabel,
|
|
2205
|
+
noticeIsResolvedApproval,
|
|
2206
|
+
noticeDisplayText,
|
|
2207
|
+
noticeTone,
|
|
2208
|
+
recordedWaitSummaryText,
|
|
2209
|
+
QUESTION_NAV_HIDDEN_PX,
|
|
2210
|
+
QUESTION_NAV_MARGIN_PX,
|
|
2211
|
+
questionNavTarget,
|
|
2212
|
+
timelineGroupSequences,
|
|
2213
|
+
timelineGroupIndexAtSequence
|
|
2214
|
+
};
|
|
2215
|
+
//# sourceMappingURL=chunk-UIWIOB4U.js.map
|