@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,1552 @@
|
|
|
1
|
+
import type { GitFileDiff } from "@opengeni/sdk";
|
|
2
|
+
import { stringifyPayload, tryParseJson } from "../lib/format";
|
|
3
|
+
import {
|
|
4
|
+
applyPatchOpsFromToolItem,
|
|
5
|
+
controlCaret,
|
|
6
|
+
execTruncated,
|
|
7
|
+
isExecSessionLostBanner,
|
|
8
|
+
looksBinary,
|
|
9
|
+
parseExecBannerSessionId,
|
|
10
|
+
parseToolArgs,
|
|
11
|
+
sandboxCommandExitCode,
|
|
12
|
+
stripExecBanner,
|
|
13
|
+
tailPeek,
|
|
14
|
+
unwrapMcpOutput,
|
|
15
|
+
v4aToGitFileDiff,
|
|
16
|
+
type ApplyPatchOperation,
|
|
17
|
+
} from "./parsers";
|
|
18
|
+
import { invokedToolCall } from "./invoked-tool";
|
|
19
|
+
import { rawTypeOf } from "./registry";
|
|
20
|
+
import { mcpToolLeaf, toolDisplayName } from "./tool-display-name";
|
|
21
|
+
import type { ToolCallItem } from "./types";
|
|
22
|
+
import { type OpenGeniText } from "../messages/runtime";
|
|
23
|
+
|
|
24
|
+
/* ----------------------------------------------------------------------------
|
|
25
|
+
Tool row presentation model (renderer-neutral)
|
|
26
|
+
|
|
27
|
+
The collapsed-row decisions every tool renderer makes — icon, tint, title,
|
|
28
|
+
preview, settle chip and what the expanded body holds — expressed as plain
|
|
29
|
+
data so DOM and non-DOM renderers draw the same row from one source of truth.
|
|
30
|
+
Web renderers consume these functions; a change here changes every surface.
|
|
31
|
+
-------------------------------------------------------------------------- */
|
|
32
|
+
|
|
33
|
+
export type ToolIconKind =
|
|
34
|
+
| "terminal"
|
|
35
|
+
| "keyboard"
|
|
36
|
+
| "file-diff"
|
|
37
|
+
| "search"
|
|
38
|
+
| "question"
|
|
39
|
+
| "target"
|
|
40
|
+
| "brain"
|
|
41
|
+
| "sessions"
|
|
42
|
+
| "server"
|
|
43
|
+
| "server-cog"
|
|
44
|
+
| "calendar"
|
|
45
|
+
| "panels"
|
|
46
|
+
| "share"
|
|
47
|
+
| "message"
|
|
48
|
+
| "git"
|
|
49
|
+
| "box"
|
|
50
|
+
| "key"
|
|
51
|
+
| "file-search"
|
|
52
|
+
| "package-search"
|
|
53
|
+
| "plug"
|
|
54
|
+
| "wrench";
|
|
55
|
+
|
|
56
|
+
export type ToolIconTone = "accent" | "failed" | "running" | "muted";
|
|
57
|
+
|
|
58
|
+
export type ToolChip = {
|
|
59
|
+
tone: "ok" | "bad" | "muted" | "interrupted";
|
|
60
|
+
text: string;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/** The collapsed-row secondary line. `running` previews carry the pulse locus. */
|
|
64
|
+
export type ToolPreview =
|
|
65
|
+
| { kind: "text"; text: string; running?: boolean | undefined }
|
|
66
|
+
| {
|
|
67
|
+
kind: "path";
|
|
68
|
+
path: string;
|
|
69
|
+
add?: number | undefined;
|
|
70
|
+
del?: number | undefined;
|
|
71
|
+
}
|
|
72
|
+
| { kind: "files"; count: number; add: number; del: number }
|
|
73
|
+
| { kind: "malformed"; name: string };
|
|
74
|
+
|
|
75
|
+
export type ToolPatchFile = {
|
|
76
|
+
key: string;
|
|
77
|
+
path: string;
|
|
78
|
+
file: GitFileDiff | null;
|
|
79
|
+
diff: string;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export type WebSearchResult = {
|
|
83
|
+
title: string;
|
|
84
|
+
domain: string;
|
|
85
|
+
snippet: string;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/** What the expanded body holds; renderers draw these with their own primitives. */
|
|
89
|
+
export type ToolBody =
|
|
90
|
+
| {
|
|
91
|
+
kind: "term";
|
|
92
|
+
command: string | null;
|
|
93
|
+
workdir: string | null;
|
|
94
|
+
output: string;
|
|
95
|
+
live?: boolean | undefined;
|
|
96
|
+
failed?: boolean | undefined;
|
|
97
|
+
note?: string | undefined;
|
|
98
|
+
}
|
|
99
|
+
| { kind: "note"; text: string; tone?: "error" | undefined }
|
|
100
|
+
| {
|
|
101
|
+
kind: "payloads";
|
|
102
|
+
/** A short explanation above the payloads. */
|
|
103
|
+
note?: string | undefined;
|
|
104
|
+
blocks: Array<{ label: string; value: unknown; failed?: boolean }>;
|
|
105
|
+
}
|
|
106
|
+
| {
|
|
107
|
+
kind: "patch";
|
|
108
|
+
files: ToolPatchFile[];
|
|
109
|
+
/** A single malformed op renders its raw patch without the path caption. */
|
|
110
|
+
bare?: boolean | undefined;
|
|
111
|
+
}
|
|
112
|
+
| { kind: "web-results"; results: WebSearchResult[] | null }
|
|
113
|
+
| {
|
|
114
|
+
/** A short labelled listing (disclosed tools, search hits) above payloads. */
|
|
115
|
+
kind: "listing";
|
|
116
|
+
note?: string | undefined;
|
|
117
|
+
entries: ToolListingEntry[];
|
|
118
|
+
/** Entries beyond the visible list ("+N more"). */
|
|
119
|
+
more?: number | undefined;
|
|
120
|
+
/** Shown instead of the list when it is known to be empty. */
|
|
121
|
+
empty?: string | undefined;
|
|
122
|
+
blocks: Array<{ label: string; value: unknown; failed?: boolean }>;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export type ToolListingEntry = {
|
|
126
|
+
key: string;
|
|
127
|
+
title: string;
|
|
128
|
+
/** Quiet leading label (the tool's server). */
|
|
129
|
+
eyebrow?: string | null | undefined;
|
|
130
|
+
mono?: boolean | undefined;
|
|
131
|
+
/** Secondary text under the title (a search snippet). */
|
|
132
|
+
snippet?: string | undefined;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export type PresentedToolKind =
|
|
136
|
+
| "exec"
|
|
137
|
+
| "write_stdin"
|
|
138
|
+
| "apply_patch"
|
|
139
|
+
| "web_search"
|
|
140
|
+
| "ask"
|
|
141
|
+
| "run_on"
|
|
142
|
+
| "tool_search"
|
|
143
|
+
| "docs_search"
|
|
144
|
+
| "session_title"
|
|
145
|
+
| "machine"
|
|
146
|
+
| "generic";
|
|
147
|
+
|
|
148
|
+
export type ToolRowPresentation = {
|
|
149
|
+
tool: PresentedToolKind;
|
|
150
|
+
icon: ToolIconKind;
|
|
151
|
+
iconTone: ToolIconTone;
|
|
152
|
+
title: string;
|
|
153
|
+
titleMono?: boolean | undefined;
|
|
154
|
+
running?: boolean | undefined;
|
|
155
|
+
preview?: ToolPreview | undefined;
|
|
156
|
+
chip?: ToolChip | undefined;
|
|
157
|
+
failed?: boolean | undefined;
|
|
158
|
+
cancelled?: boolean | undefined;
|
|
159
|
+
body: ToolBody;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export type ToolPresentationContext = {
|
|
163
|
+
/** Host-supplied active compute label ("on <label> · …" preview prefix). */
|
|
164
|
+
computeLabel?: string | null | undefined;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
/** Prefix a collapsed preview with the host-supplied active compute label. */
|
|
168
|
+
export function withComputePreview(label: string | null | undefined, preview: string): string {
|
|
169
|
+
if (!label) {
|
|
170
|
+
return preview;
|
|
171
|
+
}
|
|
172
|
+
return `on ${label} · ${preview}`;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export function truncatePreview(text: string, max: number): string {
|
|
176
|
+
const cleaned = text.replace(/\s+/g, " ").trim();
|
|
177
|
+
if (!cleaned) {
|
|
178
|
+
return "";
|
|
179
|
+
}
|
|
180
|
+
return cleaned.length > max ? `${cleaned.slice(0, max - 1)}…` : cleaned;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* The readable part of a tool error, for a one-line preview: the message inside
|
|
185
|
+
* a JSON error envelope, without the runtime's "please try again" wrapper, an
|
|
186
|
+
* HTTP status prefix or a trailing support reference. The full error stays in
|
|
187
|
+
* the row body.
|
|
188
|
+
*/
|
|
189
|
+
export function readableToolError(text: string): string {
|
|
190
|
+
const stripTransport = (value: string) =>
|
|
191
|
+
value
|
|
192
|
+
.trim()
|
|
193
|
+
.replace(/^An error occurred while running the tool\. Please try again\.\s*(Error:\s*)?/, "")
|
|
194
|
+
.replace(/^[A-Za-z][\w.-]{0,40} API \d{3}:\s*/, "");
|
|
195
|
+
let message = stripTransport(text);
|
|
196
|
+
const parsed = tryParseJson(message);
|
|
197
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
198
|
+
const envelope = parsed as { error?: unknown; message?: unknown };
|
|
199
|
+
const inner =
|
|
200
|
+
typeof envelope.error === "string"
|
|
201
|
+
? envelope.error
|
|
202
|
+
: envelope.error && typeof envelope.error === "object"
|
|
203
|
+
? (envelope.error as { message?: unknown }).message
|
|
204
|
+
: envelope.message;
|
|
205
|
+
if (typeof inner === "string" && inner.trim()) message = stripTransport(inner);
|
|
206
|
+
}
|
|
207
|
+
return message.replace(/\s*\(?Reference: [\w-]+\)?\.?$/, "").trim();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function textPreview(text: string, running?: boolean): ToolPreview {
|
|
211
|
+
return running ? { kind: "text", text, running: true } : { kind: "text", text };
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/* ---- exec_command ---------------------------------------------------------- */
|
|
215
|
+
|
|
216
|
+
export function execPresentation(
|
|
217
|
+
t: OpenGeniText,
|
|
218
|
+
item: ToolCallItem,
|
|
219
|
+
context: ToolPresentationContext = {},
|
|
220
|
+
): ToolRowPresentation {
|
|
221
|
+
const args = parseToolArgs(item.arguments);
|
|
222
|
+
const cmd = typeof args.cmd === "string" ? args.cmd : "";
|
|
223
|
+
const workdir = typeof args.workdir === "string" ? args.workdir : null;
|
|
224
|
+
const out = item.output;
|
|
225
|
+
const title = `$ ${cmd}`;
|
|
226
|
+
const computeLabel = context.computeLabel ?? null;
|
|
227
|
+
const base = {
|
|
228
|
+
tool: "exec" as const,
|
|
229
|
+
icon: "terminal" as const,
|
|
230
|
+
title,
|
|
231
|
+
titleMono: true,
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
// No output event ever arrived: the turn failed before the output insert —
|
|
235
|
+
// most likely a NUL byte in the command output prevented storage.
|
|
236
|
+
if (item.status === "failed" && out === undefined) {
|
|
237
|
+
return {
|
|
238
|
+
...base,
|
|
239
|
+
iconTone: "failed",
|
|
240
|
+
chip: { tone: "bad", text: t("timeline.chip.failed") },
|
|
241
|
+
preview: textPreview(
|
|
242
|
+
withComputePreview(computeLabel, t("timeline.toolPresentation.outputLostNulByteCould")),
|
|
243
|
+
),
|
|
244
|
+
body: {
|
|
245
|
+
kind: "note",
|
|
246
|
+
tone: "error",
|
|
247
|
+
text: t("timeline.toolPresentation.outputContainedANulByte"),
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (item.status === "failed" && (out == null || out === "")) {
|
|
253
|
+
return {
|
|
254
|
+
...base,
|
|
255
|
+
iconTone: "failed",
|
|
256
|
+
chip: { tone: "bad", text: t("timeline.chip.failed") },
|
|
257
|
+
preview: textPreview(
|
|
258
|
+
withComputePreview(computeLabel, t("timeline.toolPresentation.toolCallFailed")),
|
|
259
|
+
),
|
|
260
|
+
body: {
|
|
261
|
+
kind: "note",
|
|
262
|
+
tone: "error",
|
|
263
|
+
text: t("timeline.toolPresentation.theToolCallFailedWith"),
|
|
264
|
+
},
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (item.status === "running") {
|
|
269
|
+
const streamed = typeof out === "string" ? stripExecBanner(out) : "";
|
|
270
|
+
const runningPreview = streamed ? `${streamed.split("\n").length} lines` : "running…";
|
|
271
|
+
return {
|
|
272
|
+
...base,
|
|
273
|
+
iconTone: "running",
|
|
274
|
+
running: true,
|
|
275
|
+
preview: textPreview(withComputePreview(computeLabel, runningPreview), true),
|
|
276
|
+
body: {
|
|
277
|
+
kind: "term",
|
|
278
|
+
command: null,
|
|
279
|
+
workdir,
|
|
280
|
+
output: streamed,
|
|
281
|
+
live: true,
|
|
282
|
+
},
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
const text = typeof out === "string" ? out : stringifyPayload(out);
|
|
287
|
+
const stripped = stripExecBanner(text);
|
|
288
|
+
const bgSession = parseExecBannerSessionId(text);
|
|
289
|
+
const exitCode = sandboxCommandExitCode(text);
|
|
290
|
+
const binary = looksBinary(stripped);
|
|
291
|
+
|
|
292
|
+
// Color is spent on the exception only: a clean exit earns no chip.
|
|
293
|
+
let chip: ToolChip | undefined;
|
|
294
|
+
let iconTone: ToolIconTone = "muted";
|
|
295
|
+
if (bgSession != null) {
|
|
296
|
+
chip = { tone: "muted", text: `session ${bgSession}` };
|
|
297
|
+
} else if (exitCode != null && exitCode !== 0) {
|
|
298
|
+
chip = { tone: "bad", text: `exit ${exitCode}` };
|
|
299
|
+
iconTone = "failed";
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
const peek = binary
|
|
303
|
+
? t("timeline.toolPresentation.binaryOutput")
|
|
304
|
+
: tailPeek(stripped) || t("timeline.toolPresentation.noOutput");
|
|
305
|
+
const truncated = execTruncated(text);
|
|
306
|
+
const preview = withComputePreview(
|
|
307
|
+
computeLabel,
|
|
308
|
+
truncated ? t("timeline.toolPresentation.truncatedPeek", { peek }) : peek,
|
|
309
|
+
);
|
|
310
|
+
return {
|
|
311
|
+
...base,
|
|
312
|
+
iconTone,
|
|
313
|
+
...(chip ? { chip } : {}),
|
|
314
|
+
failed: item.status === "failed",
|
|
315
|
+
cancelled: item.status === "cancelled",
|
|
316
|
+
preview: textPreview(preview),
|
|
317
|
+
body: {
|
|
318
|
+
kind: "term",
|
|
319
|
+
command: null,
|
|
320
|
+
workdir,
|
|
321
|
+
output: binary ? t("timeline.toolPresentation.binaryOutputSuppressed") : stripped,
|
|
322
|
+
failed: item.status === "failed" || (exitCode != null && exitCode !== 0),
|
|
323
|
+
...(bgSession != null
|
|
324
|
+
? {
|
|
325
|
+
note: t("timeline.toolPresentation.sessionBgsessionALaterWrite", { bgSession }),
|
|
326
|
+
}
|
|
327
|
+
: {}),
|
|
328
|
+
},
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/* ---- write_stdin ----------------------------------------------------------- */
|
|
333
|
+
|
|
334
|
+
export function writeStdinPresentation(t: OpenGeniText, item: ToolCallItem): ToolRowPresentation {
|
|
335
|
+
const args = parseToolArgs(item.arguments);
|
|
336
|
+
const sessionId =
|
|
337
|
+
typeof args.session_id === "string" || typeof args.session_id === "number"
|
|
338
|
+
? args.session_id
|
|
339
|
+
: undefined;
|
|
340
|
+
const text = typeof item.output === "string" ? item.output : stringifyPayload(item.output);
|
|
341
|
+
const lost = isExecSessionLostBanner(text);
|
|
342
|
+
const keys = controlCaret(typeof args.chars === "string" ? args.chars : "");
|
|
343
|
+
const exitCode = sandboxCommandExitCode(text);
|
|
344
|
+
const stripped = stripExecBanner(text);
|
|
345
|
+
const title = `session ${sessionId} ← ${keys || "∅"}`;
|
|
346
|
+
const base = {
|
|
347
|
+
tool: "write_stdin" as const,
|
|
348
|
+
icon: "keyboard" as const,
|
|
349
|
+
title,
|
|
350
|
+
titleMono: true,
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
if (item.status === "running") {
|
|
354
|
+
return {
|
|
355
|
+
...base,
|
|
356
|
+
iconTone: "running",
|
|
357
|
+
running: true,
|
|
358
|
+
preview: textPreview("sending…", true),
|
|
359
|
+
body: {
|
|
360
|
+
kind: "note",
|
|
361
|
+
text: t("timeline.toolPresentation.sendingInputToSessionSessionid", { sessionId }),
|
|
362
|
+
},
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
let chip: ToolChip | undefined;
|
|
367
|
+
if (lost) {
|
|
368
|
+
chip = { tone: "bad", text: t("timeline.chip.lost") };
|
|
369
|
+
} else if (exitCode != null && exitCode !== 0) {
|
|
370
|
+
chip = { tone: "bad", text: `exit ${exitCode}` };
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
return {
|
|
374
|
+
...base,
|
|
375
|
+
iconTone: lost ? "failed" : "muted",
|
|
376
|
+
...(chip ? { chip } : {}),
|
|
377
|
+
failed: item.status === "failed",
|
|
378
|
+
cancelled: item.status === "cancelled",
|
|
379
|
+
preview: textPreview(
|
|
380
|
+
lost
|
|
381
|
+
? t("timeline.toolPresentation.sessionSessionidPtyVanished", { sessionId })
|
|
382
|
+
: tailPeek(stripped) || "sent",
|
|
383
|
+
),
|
|
384
|
+
body: lost
|
|
385
|
+
? { kind: "note", tone: "error", text: stripped || text }
|
|
386
|
+
: {
|
|
387
|
+
kind: "term",
|
|
388
|
+
command: `write_stdin → session ${sessionId}`,
|
|
389
|
+
workdir: null,
|
|
390
|
+
output: stripped,
|
|
391
|
+
},
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/* ---- apply_patch ----------------------------------------------------------- */
|
|
396
|
+
|
|
397
|
+
export function patchVerb(t: OpenGeniText, op: ApplyPatchOperation | undefined): string {
|
|
398
|
+
if (!op) {
|
|
399
|
+
return t("timeline.toolPresentation.edited");
|
|
400
|
+
}
|
|
401
|
+
return op.type === "create_file"
|
|
402
|
+
? t("timeline.toolPresentation.created")
|
|
403
|
+
: op.type === "delete_file"
|
|
404
|
+
? t("timeline.toolPresentation.deleted")
|
|
405
|
+
: op.moveTo
|
|
406
|
+
? t("timeline.toolPresentation.renamed")
|
|
407
|
+
: t("timeline.toolPresentation.edited");
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
export function pathBasename(path: string): string {
|
|
411
|
+
const parts = path.split("/").filter(Boolean);
|
|
412
|
+
return parts.length ? parts[parts.length - 1]! : path;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export function pathDirname(path: string): string {
|
|
416
|
+
const idx = path.lastIndexOf("/");
|
|
417
|
+
return idx >= 0 ? path.slice(0, idx + 1) : "";
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
export function safeParsePatchOp(op: ApplyPatchOperation): GitFileDiff | null {
|
|
421
|
+
try {
|
|
422
|
+
return v4aToGitFileDiff(op);
|
|
423
|
+
} catch {
|
|
424
|
+
return null;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
function patchFiles(
|
|
429
|
+
ops: ApplyPatchOperation[],
|
|
430
|
+
parsed?: Array<GitFileDiff | null>,
|
|
431
|
+
): ToolPatchFile[] {
|
|
432
|
+
return ops.map((op, index) => ({
|
|
433
|
+
key: `${op.type}:${op.path}:${index}`,
|
|
434
|
+
path: op.path,
|
|
435
|
+
file: parsed ? (parsed[index] ?? null) : safeParsePatchOp(op),
|
|
436
|
+
diff: op.diff ?? "",
|
|
437
|
+
}));
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/** Returns null when a settled patch has no op (renderers fall back to generic). */
|
|
441
|
+
export function applyPatchPresentation(
|
|
442
|
+
t: OpenGeniText,
|
|
443
|
+
item: ToolCallItem,
|
|
444
|
+
): ToolRowPresentation | null {
|
|
445
|
+
const ops = applyPatchOpsFromToolItem(item);
|
|
446
|
+
const cancelled = item.status === "cancelled";
|
|
447
|
+
const firstOp = ops[0];
|
|
448
|
+
const base = { tool: "apply_patch" as const, icon: "file-diff" as const };
|
|
449
|
+
|
|
450
|
+
if (item.status === "running") {
|
|
451
|
+
// Show the patch structure from the arguments, marked clearly in-progress.
|
|
452
|
+
const fileCount = ops.length;
|
|
453
|
+
const titleVerb = firstOp
|
|
454
|
+
? t("timeline.toolPresentation.applyingPathbasename", {
|
|
455
|
+
pathBasename: pathBasename(firstOp.path),
|
|
456
|
+
})
|
|
457
|
+
: t("timeline.toolPresentation.applyingPatch");
|
|
458
|
+
return {
|
|
459
|
+
...base,
|
|
460
|
+
iconTone: "running",
|
|
461
|
+
title:
|
|
462
|
+
fileCount > 1
|
|
463
|
+
? t("timeline.toolPresentation.applyingFilecountFiles", { fileCount })
|
|
464
|
+
: titleVerb,
|
|
465
|
+
running: true,
|
|
466
|
+
preview: textPreview(
|
|
467
|
+
fileCount > 1 ? `${fileCount} files` : firstOp ? firstOp.path : "applying…",
|
|
468
|
+
true,
|
|
469
|
+
),
|
|
470
|
+
body: { kind: "patch", files: patchFiles(ops) },
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
if (item.status === "failed") {
|
|
475
|
+
return {
|
|
476
|
+
...base,
|
|
477
|
+
iconTone: "failed",
|
|
478
|
+
title: firstOp ? `${patchVerb(t, firstOp)} ${pathBasename(firstOp.path)}` : "apply_patch",
|
|
479
|
+
chip: { tone: "bad", text: t("timeline.chip.failed") },
|
|
480
|
+
preview: textPreview(
|
|
481
|
+
typeof item.output === "string" ? item.output : t("timeline.toolPresentation.patchFailed"),
|
|
482
|
+
),
|
|
483
|
+
body: {
|
|
484
|
+
kind: "payloads",
|
|
485
|
+
blocks: [{ label: t("timeline.toolPresentation.error"), value: item.output, failed: true }],
|
|
486
|
+
},
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// Multi-file edit: magnitude stays a single muted glyph pair.
|
|
491
|
+
if (ops.length > 1) {
|
|
492
|
+
const parsed = ops.map((op) => safeParsePatchOp(op));
|
|
493
|
+
const goodFiles = parsed.filter((f): f is GitFileDiff => f !== null);
|
|
494
|
+
const add = goodFiles.reduce((n, f) => n + f.additions, 0);
|
|
495
|
+
const del = goodFiles.reduce((n, f) => n + f.deletions, 0);
|
|
496
|
+
return {
|
|
497
|
+
...base,
|
|
498
|
+
iconTone: "accent",
|
|
499
|
+
title: t("timeline.toolPresentation.editedLengthFiles", { length: ops.length }),
|
|
500
|
+
cancelled,
|
|
501
|
+
preview: { kind: "files", count: ops.length, add, del },
|
|
502
|
+
body: { kind: "patch", files: patchFiles(ops, parsed) },
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
if (!firstOp) {
|
|
507
|
+
return null;
|
|
508
|
+
}
|
|
509
|
+
if (firstOp.type === "delete_file") {
|
|
510
|
+
return {
|
|
511
|
+
...base,
|
|
512
|
+
iconTone: "failed",
|
|
513
|
+
title: t("timeline.toolPresentation.deletedPathbasename", {
|
|
514
|
+
pathBasename: pathBasename(firstOp.path),
|
|
515
|
+
}),
|
|
516
|
+
cancelled,
|
|
517
|
+
preview: { kind: "path", path: firstOp.path },
|
|
518
|
+
body: { kind: "note", text: t("timeline.toolPresentation.fileDeletedNoDiffTo") },
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
const file = safeParsePatchOp(firstOp);
|
|
523
|
+
if (!file) {
|
|
524
|
+
return {
|
|
525
|
+
...base,
|
|
526
|
+
iconTone: "accent",
|
|
527
|
+
title: `${patchVerb(t, firstOp)} ${pathBasename(firstOp.path)}`,
|
|
528
|
+
cancelled,
|
|
529
|
+
preview: { kind: "malformed", name: pathBasename(firstOp.path) },
|
|
530
|
+
body: { kind: "patch", files: patchFiles([firstOp], [null]), bare: true },
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
return {
|
|
535
|
+
...base,
|
|
536
|
+
iconTone: "accent",
|
|
537
|
+
title: `${patchVerb(t, firstOp)} ${pathBasename(file.path)}`,
|
|
538
|
+
cancelled,
|
|
539
|
+
preview: {
|
|
540
|
+
kind: "path",
|
|
541
|
+
path: file.path,
|
|
542
|
+
add: file.additions,
|
|
543
|
+
del: file.deletions,
|
|
544
|
+
},
|
|
545
|
+
body: { kind: "patch", files: patchFiles([firstOp], [file]) },
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/* ---- web search ------------------------------------------------------------ */
|
|
550
|
+
|
|
551
|
+
export function webSearchQueryFromArguments(args: unknown): string | null {
|
|
552
|
+
if (typeof args === "string") {
|
|
553
|
+
const trimmed = args.trim();
|
|
554
|
+
if (!trimmed) {
|
|
555
|
+
return null;
|
|
556
|
+
}
|
|
557
|
+
try {
|
|
558
|
+
return webSearchQueryFromArguments(JSON.parse(trimmed));
|
|
559
|
+
} catch {
|
|
560
|
+
return trimmed;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
if (!args || typeof args !== "object") {
|
|
564
|
+
return null;
|
|
565
|
+
}
|
|
566
|
+
const record = args as Record<string, unknown>;
|
|
567
|
+
if (typeof record.query === "string" && record.query.trim().length > 0) {
|
|
568
|
+
return record.query;
|
|
569
|
+
}
|
|
570
|
+
if (Array.isArray(record.queries)) {
|
|
571
|
+
const first = record.queries.find(
|
|
572
|
+
(value): value is string => typeof value === "string" && value.trim().length > 0,
|
|
573
|
+
);
|
|
574
|
+
if (first) {
|
|
575
|
+
return first;
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
return null;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
export function webSearchPresentation(t: OpenGeniText, item: ToolCallItem): ToolRowPresentation {
|
|
582
|
+
const raw = (item.raw ?? {}) as {
|
|
583
|
+
providerData?: {
|
|
584
|
+
action?: {
|
|
585
|
+
type?: string;
|
|
586
|
+
query?: string;
|
|
587
|
+
queries?: string[];
|
|
588
|
+
url?: string;
|
|
589
|
+
pattern?: string;
|
|
590
|
+
};
|
|
591
|
+
};
|
|
592
|
+
};
|
|
593
|
+
const action = raw.providerData?.action ?? {};
|
|
594
|
+
const actionType = action.type ?? "search";
|
|
595
|
+
const queries = (action.queries ?? []).filter(
|
|
596
|
+
(value): value is string => typeof value === "string" && value.trim().length > 0,
|
|
597
|
+
);
|
|
598
|
+
const searchQuery =
|
|
599
|
+
(typeof action.query === "string" && action.query.trim().length > 0 ? action.query : null) ??
|
|
600
|
+
queries[0] ??
|
|
601
|
+
webSearchQueryFromArguments(item.arguments);
|
|
602
|
+
const running = item.status === "running";
|
|
603
|
+
const query =
|
|
604
|
+
actionType === "open_page"
|
|
605
|
+
? (action.url ?? t("timeline.toolPresentation.pageUnavailable"))
|
|
606
|
+
: actionType === "find_in_page"
|
|
607
|
+
? action.pattern && action.url
|
|
608
|
+
? `"${action.pattern}" in ${action.url}`
|
|
609
|
+
: (action.pattern ?? action.url ?? t("timeline.toolPresentation.pageUnavailable"))
|
|
610
|
+
: // Codex often emits the live card before action.query/queries land.
|
|
611
|
+
(searchQuery ?? (running ? "…" : t("timeline.toolPresentation.queryUnavailable")));
|
|
612
|
+
const variants = queries.length > 1 ? ` +${queries.length - 1} variants` : "";
|
|
613
|
+
const base = { tool: "web_search" as const, icon: "search" as const };
|
|
614
|
+
|
|
615
|
+
if (running) {
|
|
616
|
+
return {
|
|
617
|
+
...base,
|
|
618
|
+
iconTone: "running",
|
|
619
|
+
title:
|
|
620
|
+
actionType === "open_page"
|
|
621
|
+
? t("timeline.toolPresentation.openingWebPage")
|
|
622
|
+
: actionType === "find_in_page"
|
|
623
|
+
? t("timeline.toolPresentation.searchingWithinPage")
|
|
624
|
+
: t("timeline.toolPresentation.searchingTheWeb"),
|
|
625
|
+
running: true,
|
|
626
|
+
preview: textPreview(`${query}${variants}`, true),
|
|
627
|
+
body: {
|
|
628
|
+
kind: "note",
|
|
629
|
+
text: t("timeline.toolPresentation.searchingResultsFoldIntoThe"),
|
|
630
|
+
},
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
const rawResults = (item.output as { results?: unknown } | undefined)?.results;
|
|
635
|
+
const results = Array.isArray(rawResults)
|
|
636
|
+
? (rawResults as unknown[]).filter((r): r is WebSearchResult => !!r && typeof r === "object")
|
|
637
|
+
: null;
|
|
638
|
+
return {
|
|
639
|
+
...base,
|
|
640
|
+
iconTone: "muted",
|
|
641
|
+
title:
|
|
642
|
+
actionType === "open_page"
|
|
643
|
+
? t("timeline.toolPresentation.openedWebPage")
|
|
644
|
+
: actionType === "find_in_page"
|
|
645
|
+
? t("timeline.toolPresentation.searchedWithinPage")
|
|
646
|
+
: t("timeline.toolPresentation.searchedTheWeb"),
|
|
647
|
+
preview: textPreview(`${query}${variants}`),
|
|
648
|
+
failed: item.status === "failed",
|
|
649
|
+
cancelled: item.status === "cancelled",
|
|
650
|
+
body: { kind: "web-results", results },
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
/* ---- MCP-shaped tools: ask, run_on, generic -------------------------------- */
|
|
655
|
+
|
|
656
|
+
export function askToolPreview(args: unknown): string | null {
|
|
657
|
+
const record = args && typeof args === "object" ? (args as Record<string, unknown>) : null;
|
|
658
|
+
const questions = Array.isArray(record?.questions) ? record.questions : null;
|
|
659
|
+
if (!questions || questions.length === 0) {
|
|
660
|
+
return null;
|
|
661
|
+
}
|
|
662
|
+
const first = questions[0];
|
|
663
|
+
if (!first || typeof first !== "object") {
|
|
664
|
+
return null;
|
|
665
|
+
}
|
|
666
|
+
const q = first as Record<string, unknown>;
|
|
667
|
+
const text =
|
|
668
|
+
typeof q.label === "string" && q.label.trim()
|
|
669
|
+
? q.label.trim()
|
|
670
|
+
: typeof q.prompt === "string" && q.prompt.trim()
|
|
671
|
+
? q.prompt.trim()
|
|
672
|
+
: null;
|
|
673
|
+
if (!text) {
|
|
674
|
+
return null;
|
|
675
|
+
}
|
|
676
|
+
const preview = truncatePreview(text, 90);
|
|
677
|
+
return questions.length > 1 ? `${preview} · ${questions.length} questions` : preview;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
export function runOnTargetName(output: unknown): string | null {
|
|
681
|
+
const { text } = unwrapMcpOutput(output);
|
|
682
|
+
const parsed = tryParseJson(text);
|
|
683
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
684
|
+
const name = (parsed as { targetName?: unknown }).targetName;
|
|
685
|
+
if (typeof name === "string" && name.trim()) {
|
|
686
|
+
return name.trim();
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
return null;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
export function runOnOpPreview(args: Record<string, unknown>): string | null {
|
|
693
|
+
const op = args.op;
|
|
694
|
+
if (!op || typeof op !== "object" || Array.isArray(op)) {
|
|
695
|
+
return null;
|
|
696
|
+
}
|
|
697
|
+
const record = op as Record<string, unknown>;
|
|
698
|
+
if (record.kind === "exec" && typeof record.cmd === "string" && record.cmd.trim()) {
|
|
699
|
+
return `$ ${record.cmd.trim()}`;
|
|
700
|
+
}
|
|
701
|
+
if (
|
|
702
|
+
(record.kind === "read" || record.kind === "write") &&
|
|
703
|
+
typeof record.path === "string" &&
|
|
704
|
+
record.path.trim()
|
|
705
|
+
) {
|
|
706
|
+
return truncatePreview(record.path.trim(), 72);
|
|
707
|
+
}
|
|
708
|
+
return null;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
export function goalToolPreview(name: string, args: unknown): string | null {
|
|
712
|
+
const leaf = mcpToolLeaf(name);
|
|
713
|
+
if (
|
|
714
|
+
leaf !== "goal_set" &&
|
|
715
|
+
leaf !== "goal_update" &&
|
|
716
|
+
leaf !== "goal_complete" &&
|
|
717
|
+
leaf !== "goal_pause" &&
|
|
718
|
+
leaf !== "wait_for_input"
|
|
719
|
+
) {
|
|
720
|
+
return null;
|
|
721
|
+
}
|
|
722
|
+
const record = args && typeof args === "object" ? (args as Record<string, unknown>) : null;
|
|
723
|
+
if (!record) {
|
|
724
|
+
return null;
|
|
725
|
+
}
|
|
726
|
+
const text =
|
|
727
|
+
typeof record.text === "string"
|
|
728
|
+
? record.text
|
|
729
|
+
: typeof record.evidence === "string"
|
|
730
|
+
? record.evidence
|
|
731
|
+
: typeof record.rationale === "string"
|
|
732
|
+
? record.rationale
|
|
733
|
+
: typeof record.reason === "string"
|
|
734
|
+
? record.reason
|
|
735
|
+
: typeof record.progressNote === "string"
|
|
736
|
+
? record.progressNote
|
|
737
|
+
: null;
|
|
738
|
+
return text ? truncatePreview(text, 90) : null;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
/** Explicit first-party leaf/prefix → canonical product icon kind. */
|
|
742
|
+
export function genericToolIconKind(name: string): ToolIconKind {
|
|
743
|
+
const leaf = mcpToolLeaf(name);
|
|
744
|
+
return leaf === "request_human_input"
|
|
745
|
+
? "question"
|
|
746
|
+
: leaf.startsWith("goal_")
|
|
747
|
+
? "target"
|
|
748
|
+
: leaf.startsWith("memory_") ||
|
|
749
|
+
leaf === "preference_registry_summary" ||
|
|
750
|
+
leaf === "preference_registry_get"
|
|
751
|
+
? "brain"
|
|
752
|
+
: leaf.startsWith("session_") ||
|
|
753
|
+
leaf === "sessions_list" ||
|
|
754
|
+
leaf === "set_session_title" ||
|
|
755
|
+
leaf === "set_other_session_title"
|
|
756
|
+
? "sessions"
|
|
757
|
+
: leaf.startsWith("sandbox") || leaf === "sandboxes_list" || leaf === "run_on"
|
|
758
|
+
? "server"
|
|
759
|
+
: leaf.startsWith("rig_")
|
|
760
|
+
? "server-cog"
|
|
761
|
+
: leaf.startsWith("scheduled_")
|
|
762
|
+
? "calendar"
|
|
763
|
+
: leaf.startsWith("artifacts_")
|
|
764
|
+
? "panels"
|
|
765
|
+
: leaf.startsWith("social_")
|
|
766
|
+
? "share"
|
|
767
|
+
: leaf.startsWith("slack_")
|
|
768
|
+
? "message"
|
|
769
|
+
: leaf.startsWith("github_")
|
|
770
|
+
? "git"
|
|
771
|
+
: leaf.startsWith("variable_")
|
|
772
|
+
? "box"
|
|
773
|
+
: leaf.startsWith("environment_")
|
|
774
|
+
? "key"
|
|
775
|
+
: leaf.includes("document") ||
|
|
776
|
+
leaf.includes("knowledge") ||
|
|
777
|
+
leaf === "list_document_bases"
|
|
778
|
+
? "file-search"
|
|
779
|
+
: leaf === "tool_search"
|
|
780
|
+
? "package-search"
|
|
781
|
+
: leaf.startsWith("skill_")
|
|
782
|
+
? "plug"
|
|
783
|
+
: "wrench";
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
type McpRowOptions = {
|
|
787
|
+
tool: PresentedToolKind;
|
|
788
|
+
icon: ToolIconKind;
|
|
789
|
+
title: string;
|
|
790
|
+
/** Preview while running (falls back to `runningFallback`). */
|
|
791
|
+
runningPreview: string | null;
|
|
792
|
+
runningFallback: string;
|
|
793
|
+
/** Settled preview (null → none); ask/run_on also use it as the error fallback. */
|
|
794
|
+
settledPreview: string | null;
|
|
795
|
+
/** Generic shows "Done" when no settled preview exists and skips the error fallback. */
|
|
796
|
+
settledFallback?: string | undefined;
|
|
797
|
+
/** Ask/run_on omit an empty Result block. */
|
|
798
|
+
omitEmptyResult?: boolean | undefined;
|
|
799
|
+
/** Generic shows a goal preview as plain text (no pulse) while running. */
|
|
800
|
+
plainRunningPreview?: boolean | undefined;
|
|
801
|
+
/** Machine steps say they failed in the title, so the preview stays empty. */
|
|
802
|
+
quietError?: boolean | undefined;
|
|
803
|
+
};
|
|
804
|
+
|
|
805
|
+
function mcpRowPresentation(
|
|
806
|
+
t: OpenGeniText,
|
|
807
|
+
item: ToolCallItem,
|
|
808
|
+
options: McpRowOptions,
|
|
809
|
+
): ToolRowPresentation {
|
|
810
|
+
const args = parseToolArgs(item.arguments);
|
|
811
|
+
const base = { tool: options.tool, icon: options.icon, title: options.title };
|
|
812
|
+
if (item.status === "running") {
|
|
813
|
+
return {
|
|
814
|
+
...base,
|
|
815
|
+
iconTone: "running",
|
|
816
|
+
running: true,
|
|
817
|
+
preview:
|
|
818
|
+
options.runningPreview != null && options.plainRunningPreview
|
|
819
|
+
? textPreview(options.runningPreview)
|
|
820
|
+
: textPreview(options.runningPreview ?? options.runningFallback, true),
|
|
821
|
+
body: {
|
|
822
|
+
kind: "payloads",
|
|
823
|
+
blocks: [{ label: t("timeline.toolPresentation.arguments"), value: args }],
|
|
824
|
+
},
|
|
825
|
+
};
|
|
826
|
+
}
|
|
827
|
+
const { text: outText, isError } = unwrapMcpOutput(item.output);
|
|
828
|
+
// Cancelled is not an error, even if the payload carries an isError flag.
|
|
829
|
+
if ((isError || item.status === "failed") && item.status !== "cancelled") {
|
|
830
|
+
const errorFallback = options.settledFallback === undefined ? options.settledPreview : null;
|
|
831
|
+
return {
|
|
832
|
+
...base,
|
|
833
|
+
iconTone: "failed",
|
|
834
|
+
chip: { tone: "bad", text: t("timeline.chip.error") },
|
|
835
|
+
...(options.quietError
|
|
836
|
+
? {}
|
|
837
|
+
: {
|
|
838
|
+
preview: textPreview(
|
|
839
|
+
truncatePreview(readableToolError(outText), 80) ||
|
|
840
|
+
errorFallback ||
|
|
841
|
+
t("timeline.toolPresentation.error"),
|
|
842
|
+
),
|
|
843
|
+
}),
|
|
844
|
+
body: {
|
|
845
|
+
kind: "payloads",
|
|
846
|
+
blocks: [
|
|
847
|
+
{ label: t("timeline.toolPresentation.arguments"), value: args },
|
|
848
|
+
{ label: t("timeline.toolPresentation.error"), value: outText, failed: true },
|
|
849
|
+
],
|
|
850
|
+
},
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
const settled =
|
|
854
|
+
item.status === "cancelled"
|
|
855
|
+
? null
|
|
856
|
+
: (options.settledPreview ?? options.settledFallback ?? null);
|
|
857
|
+
return {
|
|
858
|
+
...base,
|
|
859
|
+
iconTone: "muted",
|
|
860
|
+
cancelled: item.status === "cancelled",
|
|
861
|
+
...(settled != null ? { preview: textPreview(settled) } : {}),
|
|
862
|
+
body: {
|
|
863
|
+
kind: "payloads",
|
|
864
|
+
blocks:
|
|
865
|
+
options.omitEmptyResult && !outText
|
|
866
|
+
? [{ label: t("timeline.toolPresentation.arguments"), value: args }]
|
|
867
|
+
: [
|
|
868
|
+
{ label: t("timeline.toolPresentation.arguments"), value: args },
|
|
869
|
+
{ label: t("timeline.toolPresentation.result"), value: outText },
|
|
870
|
+
],
|
|
871
|
+
},
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
export function askPresentation(t: OpenGeniText, item: ToolCallItem): ToolRowPresentation {
|
|
876
|
+
const preview = askToolPreview(parseToolArgs(item.arguments));
|
|
877
|
+
return mcpRowPresentation(t, item, {
|
|
878
|
+
tool: "ask",
|
|
879
|
+
icon: "question",
|
|
880
|
+
title: t("timeline.toolPresentation.ask"),
|
|
881
|
+
runningPreview: preview,
|
|
882
|
+
runningFallback: t("timeline.toolPresentation.waiting"),
|
|
883
|
+
settledPreview: preview,
|
|
884
|
+
omitEmptyResult: true,
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
export function runOnPresentation(t: OpenGeniText, item: ToolCallItem): ToolRowPresentation {
|
|
889
|
+
const targetName = runOnTargetName(item.output);
|
|
890
|
+
const opPreview = runOnOpPreview(parseToolArgs(item.arguments));
|
|
891
|
+
return mcpRowPresentation(t, item, {
|
|
892
|
+
tool: "run_on",
|
|
893
|
+
icon: "server",
|
|
894
|
+
title: targetName
|
|
895
|
+
? t("timeline.toolPresentation.runOnTargetname", { targetName })
|
|
896
|
+
: t("timeline.toolPresentation.runOn"),
|
|
897
|
+
runningPreview: opPreview,
|
|
898
|
+
runningFallback: t("timeline.toolPresentation.running"),
|
|
899
|
+
settledPreview: opPreview,
|
|
900
|
+
omitEmptyResult: true,
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* Finding machines, moving onto one and back, and using its screen, said the
|
|
906
|
+
* way a person would describe it: "Looked at the screen", "Typed “hello”".
|
|
907
|
+
*/
|
|
908
|
+
export function machinePresentation(t: OpenGeniText, item: ToolCallItem): ToolRowPresentation {
|
|
909
|
+
const leaf = mcpToolLeaf(item.name);
|
|
910
|
+
const args = parseToolArgs(item.arguments);
|
|
911
|
+
const action = leaf === "computer_act" ? computerActAction(args) : null;
|
|
912
|
+
const preview = (action && computerActPreview(action)) ?? null;
|
|
913
|
+
// A step that didn't work says so in words; the error itself stays one click
|
|
914
|
+
// away in the row body instead of leaking a raw API payload into the preview.
|
|
915
|
+
const failed =
|
|
916
|
+
item.status !== "running" &&
|
|
917
|
+
item.status !== "cancelled" &&
|
|
918
|
+
(item.status === "failed" || unwrapMcpOutput(item.output).isError);
|
|
919
|
+
return mcpRowPresentation(t, item, {
|
|
920
|
+
tool: "machine",
|
|
921
|
+
icon: isScreenTool(leaf) ? "panels" : "server",
|
|
922
|
+
title: failed ? machineFailureTitle(t, leaf) : machineTitle(t, leaf, args, action, item.output),
|
|
923
|
+
runningPreview: preview,
|
|
924
|
+
runningFallback: t("timeline.toolPresentation.running"),
|
|
925
|
+
settledPreview: preview,
|
|
926
|
+
settledFallback: t("timeline.toolPresentation.done"),
|
|
927
|
+
plainRunningPreview: true,
|
|
928
|
+
quietError: true,
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
function isScreenTool(leaf: string): boolean {
|
|
933
|
+
return leaf.startsWith("computer_") || leaf.startsWith("cua_") || leaf === "interaction_discover";
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
function machineFailureTitle(t: OpenGeniText, leaf: string): string {
|
|
937
|
+
switch (leaf) {
|
|
938
|
+
case "sandboxes_list":
|
|
939
|
+
return t("timeline.toolPresentation.couldNotLookForMachines");
|
|
940
|
+
case "sandbox_swap":
|
|
941
|
+
return t("timeline.toolPresentation.couldNotMoveToTheMachine");
|
|
942
|
+
case "computer_open":
|
|
943
|
+
return t("timeline.toolPresentation.couldNotOpenTheScreen");
|
|
944
|
+
default:
|
|
945
|
+
return t("timeline.toolPresentation.couldNotUseTheScreen");
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
/** Direct screen-driver steps, named by what they did on the screen. */
|
|
950
|
+
function cuaTitle(t: OpenGeniText, leaf: string): string {
|
|
951
|
+
if (/^cua_(get_|list_|verify_|parse_|zoom$)/.test(leaf)) {
|
|
952
|
+
return t("timeline.toolPresentation.lookedAtTheScreen");
|
|
953
|
+
}
|
|
954
|
+
if (/^cua_(click|double_click|right_click)$/.test(leaf)) {
|
|
955
|
+
return t("timeline.toolPresentation.clickedOnTheScreen");
|
|
956
|
+
}
|
|
957
|
+
if (/^cua_(type_text|press_key|hotkey)$/.test(leaf)) {
|
|
958
|
+
return t("timeline.toolPresentation.typedOnTheKeyboard");
|
|
959
|
+
}
|
|
960
|
+
return t("timeline.toolPresentation.usedTheScreen");
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
type ComputerActAction = { type?: unknown; value?: unknown; locator?: unknown };
|
|
964
|
+
|
|
965
|
+
function computerActAction(args: Record<string, unknown>): ComputerActAction | null {
|
|
966
|
+
const action = args.action;
|
|
967
|
+
return action && typeof action === "object" ? (action as ComputerActAction) : null;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
function machineTitle(
|
|
971
|
+
t: OpenGeniText,
|
|
972
|
+
leaf: string,
|
|
973
|
+
args: Record<string, unknown>,
|
|
974
|
+
action: ComputerActAction | null,
|
|
975
|
+
output: unknown,
|
|
976
|
+
): string {
|
|
977
|
+
switch (leaf) {
|
|
978
|
+
case "sandboxes_list":
|
|
979
|
+
return t("timeline.toolPresentation.lookedForMachines");
|
|
980
|
+
case "interaction_discover":
|
|
981
|
+
return t("timeline.toolPresentation.lookedForScreens");
|
|
982
|
+
case "sandbox_swap": {
|
|
983
|
+
if (args.target === "session") return t("timeline.toolPresentation.movedBack");
|
|
984
|
+
const targetName = runOnTargetName(output);
|
|
985
|
+
return targetName
|
|
986
|
+
? t("timeline.toolPresentation.movedToTargetname", { targetName })
|
|
987
|
+
: t("timeline.toolPresentation.movedToAMachine");
|
|
988
|
+
}
|
|
989
|
+
case "computer_open":
|
|
990
|
+
return t("timeline.toolPresentation.openedTheScreen");
|
|
991
|
+
case "computer_act":
|
|
992
|
+
return action?.type === "pointer"
|
|
993
|
+
? t("timeline.toolPresentation.clickedOnTheScreen")
|
|
994
|
+
: action?.type === "keyboard"
|
|
995
|
+
? t("timeline.toolPresentation.typedOnTheKeyboard")
|
|
996
|
+
: t("timeline.toolPresentation.usedTheScreen");
|
|
997
|
+
default:
|
|
998
|
+
return leaf.startsWith("cua_")
|
|
999
|
+
? cuaTitle(t, leaf)
|
|
1000
|
+
: t("timeline.toolPresentation.lookedAtTheScreen");
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
/** What a screen action typed or chose, when it says so: “hello”, “Save”. */
|
|
1005
|
+
function computerActPreview(action: ComputerActAction): string | undefined {
|
|
1006
|
+
const locator =
|
|
1007
|
+
action.locator && typeof action.locator === "object"
|
|
1008
|
+
? (action.locator as { name?: unknown; text?: unknown })
|
|
1009
|
+
: undefined;
|
|
1010
|
+
const named =
|
|
1011
|
+
typeof locator?.name === "string"
|
|
1012
|
+
? locator.name
|
|
1013
|
+
: typeof locator?.text === "string"
|
|
1014
|
+
? locator.text
|
|
1015
|
+
: undefined;
|
|
1016
|
+
const shown = (
|
|
1017
|
+
action.type === "keyboard" && typeof action.value === "string" ? action.value : named
|
|
1018
|
+
)?.trim();
|
|
1019
|
+
if (!shown) return undefined;
|
|
1020
|
+
return `\u201c${shown.length > 60 ? `${shown.slice(0, 59)}…` : shown}\u201d`;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
/**
|
|
1024
|
+
* Baseline craft for unmatched tools: family icon + title-cased leaf + honest
|
|
1025
|
+
* status preview (Running… / Done / error snippet).
|
|
1026
|
+
*/
|
|
1027
|
+
export function genericToolPresentation(t: OpenGeniText, item: ToolCallItem): ToolRowPresentation {
|
|
1028
|
+
const goalPreview = goalToolPreview(item.name, parseToolArgs(item.arguments));
|
|
1029
|
+
if (item.status !== "running") {
|
|
1030
|
+
const { text: outText, isError } = unwrapMcpOutput(item.output);
|
|
1031
|
+
const base = {
|
|
1032
|
+
tool: "generic" as const,
|
|
1033
|
+
icon: genericToolIconKind(item.name),
|
|
1034
|
+
title: toolDisplayName(t, item.name, item.display),
|
|
1035
|
+
};
|
|
1036
|
+
const args = parseToolArgs(item.arguments);
|
|
1037
|
+
// A permission Block is a decision, not a tool failure: say so plainly instead
|
|
1038
|
+
// of the generic "error occurred, please try again" wrapper.
|
|
1039
|
+
if (isError && BLOCKED_OUTPUT.test(outText)) {
|
|
1040
|
+
return {
|
|
1041
|
+
...base,
|
|
1042
|
+
iconTone: "muted",
|
|
1043
|
+
chip: { tone: "interrupted", text: t("timeline.chip.blocked") },
|
|
1044
|
+
preview: textPreview(t("timeline.toolPresentation.blockedByYourPermissionSettings")),
|
|
1045
|
+
body: {
|
|
1046
|
+
kind: "payloads",
|
|
1047
|
+
note: t("timeline.toolPresentation.yourPermissionSettingsBlockThis"),
|
|
1048
|
+
blocks: [{ label: t("timeline.toolPresentation.arguments"), value: args }],
|
|
1049
|
+
},
|
|
1050
|
+
};
|
|
1051
|
+
}
|
|
1052
|
+
// An interrupted approved action may have run. Never invite a blind retry.
|
|
1053
|
+
if (isError && UNCERTAIN_OUTPUT.test(outText)) {
|
|
1054
|
+
return {
|
|
1055
|
+
...base,
|
|
1056
|
+
iconTone: "failed",
|
|
1057
|
+
chip: { tone: "bad", text: t("timeline.toolPresentation.outcomeUnknown") },
|
|
1058
|
+
preview: textPreview(t("timeline.toolPresentation.itMayHaveRun")),
|
|
1059
|
+
body: {
|
|
1060
|
+
kind: "payloads",
|
|
1061
|
+
note: t("timeline.toolPresentation.thisActionMayHaveRun"),
|
|
1062
|
+
blocks: [{ label: t("timeline.toolPresentation.arguments"), value: args }],
|
|
1063
|
+
},
|
|
1064
|
+
};
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
return mcpRowPresentation(t, item, {
|
|
1068
|
+
tool: "generic",
|
|
1069
|
+
icon: genericToolIconKind(item.name),
|
|
1070
|
+
title: toolDisplayName(t, item.name, item.display),
|
|
1071
|
+
runningPreview: goalPreview,
|
|
1072
|
+
runningFallback: t("timeline.toolPresentation.running"),
|
|
1073
|
+
settledPreview: goalPreview,
|
|
1074
|
+
settledFallback: t("timeline.toolPresentation.done"),
|
|
1075
|
+
plainRunningPreview: true,
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
/** The runtime's exact refusal for a tool whose effective permission is Block. */
|
|
1080
|
+
const BLOCKED_OUTPUT = /Connector action was not executed: blocked\b/;
|
|
1081
|
+
/** The runtime's refusal to guess whether an approved action ran. */
|
|
1082
|
+
const UNCERTAIN_OUTPUT = /Connector action outcome is uncertain\b/;
|
|
1083
|
+
|
|
1084
|
+
/* ---- tool_search (progressive MCP disclosure) ------------------------------ */
|
|
1085
|
+
|
|
1086
|
+
export type DisclosedTool = {
|
|
1087
|
+
/** Full wire name (`server__leaf` or bare). */
|
|
1088
|
+
name: string;
|
|
1089
|
+
/** Server / namespace prefix before `__`, when present. */
|
|
1090
|
+
source: string | null;
|
|
1091
|
+
/** Leaf tool name after `__`. */
|
|
1092
|
+
leaf: string;
|
|
1093
|
+
};
|
|
1094
|
+
|
|
1095
|
+
export function splitToolWireName(name: string): DisclosedTool {
|
|
1096
|
+
const boundary = name.indexOf("__");
|
|
1097
|
+
if (boundary <= 0) {
|
|
1098
|
+
return { name, source: null, leaf: name };
|
|
1099
|
+
}
|
|
1100
|
+
return {
|
|
1101
|
+
name,
|
|
1102
|
+
source: name.slice(0, boundary),
|
|
1103
|
+
leaf: name.slice(boundary + 2),
|
|
1104
|
+
};
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
/** Capability query from live tool_search args (object or JSON string). */
|
|
1108
|
+
export function toolSearchQuery(item: ToolCallItem): string {
|
|
1109
|
+
const fromArgs = parseToolArgs(item.arguments);
|
|
1110
|
+
if (typeof fromArgs.query === "string" && fromArgs.query.trim()) {
|
|
1111
|
+
return fromArgs.query.trim();
|
|
1112
|
+
}
|
|
1113
|
+
const raw = item.raw;
|
|
1114
|
+
if (raw && typeof raw === "object") {
|
|
1115
|
+
const rawArgs = (raw as { arguments?: unknown }).arguments;
|
|
1116
|
+
if (typeof rawArgs === "string" && rawArgs.trim()) {
|
|
1117
|
+
const parsed = tryParseJson(rawArgs);
|
|
1118
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
1119
|
+
const query = (parsed as { query?: unknown }).query;
|
|
1120
|
+
if (typeof query === "string" && query.trim()) {
|
|
1121
|
+
return query.trim();
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
} else if (rawArgs && typeof rawArgs === "object" && !Array.isArray(rawArgs)) {
|
|
1125
|
+
const query = (rawArgs as { query?: unknown }).query;
|
|
1126
|
+
if (typeof query === "string" && query.trim()) {
|
|
1127
|
+
return query.trim();
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
return "";
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
/**
|
|
1135
|
+
* Parse disclosed tools from the runtime event shape.
|
|
1136
|
+
* `normalizeSdkEvent` collapses `tool_search_output.tools[]` into text:
|
|
1137
|
+
* "Disclosed tools: a, b" | "No matching tools found."
|
|
1138
|
+
* Also accept a structured `tools` array when a host/enricher preserves it.
|
|
1139
|
+
*/
|
|
1140
|
+
export function parseDisclosedTools(output: unknown): DisclosedTool[] | null {
|
|
1141
|
+
if (output && typeof output === "object" && !Array.isArray(output)) {
|
|
1142
|
+
const tools = (output as { tools?: unknown }).tools;
|
|
1143
|
+
if (Array.isArray(tools)) {
|
|
1144
|
+
return tools
|
|
1145
|
+
.map((tool) => {
|
|
1146
|
+
if (typeof tool === "string" && tool.trim()) {
|
|
1147
|
+
return splitToolWireName(tool.trim());
|
|
1148
|
+
}
|
|
1149
|
+
if (
|
|
1150
|
+
tool &&
|
|
1151
|
+
typeof tool === "object" &&
|
|
1152
|
+
typeof (tool as { name?: unknown }).name === "string"
|
|
1153
|
+
) {
|
|
1154
|
+
const name = (tool as { name: string }).name.trim();
|
|
1155
|
+
return name ? splitToolWireName(name) : null;
|
|
1156
|
+
}
|
|
1157
|
+
return null;
|
|
1158
|
+
})
|
|
1159
|
+
.filter((tool): tool is DisclosedTool => tool != null);
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
const { text } = unwrapMcpOutput(output);
|
|
1164
|
+
const trimmed = text.trim();
|
|
1165
|
+
if (!trimmed) {
|
|
1166
|
+
return null;
|
|
1167
|
+
}
|
|
1168
|
+
if (/^no matching tools found\.?$/i.test(trimmed)) {
|
|
1169
|
+
return [];
|
|
1170
|
+
}
|
|
1171
|
+
const disclosed = trimmed.match(/^disclosed tools:\s*(.+)$/i);
|
|
1172
|
+
if (disclosed?.[1]) {
|
|
1173
|
+
return disclosed[1]
|
|
1174
|
+
.split(",")
|
|
1175
|
+
.map((part) => part.trim())
|
|
1176
|
+
.filter(Boolean)
|
|
1177
|
+
.map(splitToolWireName);
|
|
1178
|
+
}
|
|
1179
|
+
const parsed = tryParseJson(trimmed);
|
|
1180
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
1181
|
+
return parseDisclosedTools(parsed);
|
|
1182
|
+
}
|
|
1183
|
+
return null;
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
export function toolSearchPreview(
|
|
1187
|
+
t: OpenGeniText,
|
|
1188
|
+
tools: DisclosedTool[] | null,
|
|
1189
|
+
cancelled: boolean,
|
|
1190
|
+
): string | undefined {
|
|
1191
|
+
if (cancelled) {
|
|
1192
|
+
return undefined;
|
|
1193
|
+
}
|
|
1194
|
+
if (!tools) {
|
|
1195
|
+
return t("timeline.toolPresentation.done");
|
|
1196
|
+
}
|
|
1197
|
+
if (tools.length === 0) {
|
|
1198
|
+
return t("timeline.toolPresentation.noMatches");
|
|
1199
|
+
}
|
|
1200
|
+
if (tools.length === 1) {
|
|
1201
|
+
return tools[0]!.leaf;
|
|
1202
|
+
}
|
|
1203
|
+
const head = tools[0]!.leaf;
|
|
1204
|
+
return t("timeline.toolPresentation.lengthToolsTruncatepreview", {
|
|
1205
|
+
length: tools.length,
|
|
1206
|
+
truncatePreview: truncatePreview(head, 28),
|
|
1207
|
+
});
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
export function toolSearchPresentation(t: OpenGeniText, item: ToolCallItem): ToolRowPresentation {
|
|
1211
|
+
const query = toolSearchQuery(item);
|
|
1212
|
+
const queryPreview = query ? truncatePreview(query, 64) : "";
|
|
1213
|
+
const note = query ? `capability query: ${query}` : undefined;
|
|
1214
|
+
const args = parseToolArgs(item.arguments);
|
|
1215
|
+
const base = { tool: "tool_search" as const, icon: "package-search" as const };
|
|
1216
|
+
if (item.status === "running") {
|
|
1217
|
+
return {
|
|
1218
|
+
...base,
|
|
1219
|
+
iconTone: "running",
|
|
1220
|
+
title: t("timeline.toolPresentation.lookingUpTools"),
|
|
1221
|
+
running: true,
|
|
1222
|
+
preview: textPreview(
|
|
1223
|
+
queryPreview || t("timeline.toolPresentation.matchingCapabilities"),
|
|
1224
|
+
true,
|
|
1225
|
+
),
|
|
1226
|
+
body: {
|
|
1227
|
+
kind: "listing",
|
|
1228
|
+
note,
|
|
1229
|
+
entries: [],
|
|
1230
|
+
blocks: [{ label: t("timeline.toolPresentation.arguments"), value: args }],
|
|
1231
|
+
},
|
|
1232
|
+
};
|
|
1233
|
+
}
|
|
1234
|
+
const { text: outText, isError } = unwrapMcpOutput(item.output);
|
|
1235
|
+
if ((isError || item.status === "failed") && item.status !== "cancelled") {
|
|
1236
|
+
return {
|
|
1237
|
+
...base,
|
|
1238
|
+
iconTone: "failed",
|
|
1239
|
+
title: t("timeline.toolPresentation.toolLookupFailed"),
|
|
1240
|
+
failed: true,
|
|
1241
|
+
preview: textPreview(
|
|
1242
|
+
truncatePreview(outText, 80) || queryPreview || t("timeline.toolPresentation.lookupFailed"),
|
|
1243
|
+
),
|
|
1244
|
+
body: {
|
|
1245
|
+
kind: "listing",
|
|
1246
|
+
note,
|
|
1247
|
+
entries: [],
|
|
1248
|
+
blocks: [
|
|
1249
|
+
{ label: t("timeline.toolPresentation.arguments"), value: args },
|
|
1250
|
+
{ label: t("timeline.toolPresentation.error"), value: outText, failed: true },
|
|
1251
|
+
],
|
|
1252
|
+
},
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
const tools = parseDisclosedTools(item.output);
|
|
1256
|
+
const preview = toolSearchPreview(t, tools, item.status === "cancelled");
|
|
1257
|
+
return {
|
|
1258
|
+
...base,
|
|
1259
|
+
iconTone: "muted",
|
|
1260
|
+
title: t("timeline.toolPresentation.lookedUpTools"),
|
|
1261
|
+
cancelled: item.status === "cancelled",
|
|
1262
|
+
...(preview ? { preview: textPreview(preview) } : {}),
|
|
1263
|
+
body: {
|
|
1264
|
+
kind: "listing",
|
|
1265
|
+
note,
|
|
1266
|
+
entries: (tools ?? []).slice(0, 12).map((tool) => ({
|
|
1267
|
+
key: tool.name,
|
|
1268
|
+
title: tool.leaf,
|
|
1269
|
+
eyebrow: tool.source,
|
|
1270
|
+
mono: true,
|
|
1271
|
+
})),
|
|
1272
|
+
more: tools && tools.length > 12 ? tools.length - 12 : undefined,
|
|
1273
|
+
empty:
|
|
1274
|
+
tools && tools.length === 0
|
|
1275
|
+
? t("timeline.toolPresentation.noDeferredToolsMatchedThis")
|
|
1276
|
+
: undefined,
|
|
1277
|
+
blocks:
|
|
1278
|
+
tools == null && outText
|
|
1279
|
+
? [
|
|
1280
|
+
{ label: t("timeline.toolPresentation.arguments"), value: args },
|
|
1281
|
+
{ label: t("timeline.toolPresentation.result"), value: outText },
|
|
1282
|
+
]
|
|
1283
|
+
: [{ label: t("timeline.toolPresentation.arguments"), value: args }],
|
|
1284
|
+
},
|
|
1285
|
+
};
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
/* ---- docs / knowledge search ----------------------------------------------- */
|
|
1289
|
+
|
|
1290
|
+
export type SearchHit = { title: string; snippet: string };
|
|
1291
|
+
|
|
1292
|
+
export function parseSearchHits(t: OpenGeniText, outText: string): SearchHit[] | null {
|
|
1293
|
+
const parsed = tryParseJson(outText);
|
|
1294
|
+
if (parsed == null) {
|
|
1295
|
+
return null;
|
|
1296
|
+
}
|
|
1297
|
+
const list = Array.isArray(parsed)
|
|
1298
|
+
? parsed
|
|
1299
|
+
: parsed &&
|
|
1300
|
+
typeof parsed === "object" &&
|
|
1301
|
+
Array.isArray((parsed as { results?: unknown }).results)
|
|
1302
|
+
? (parsed as { results: unknown[] }).results
|
|
1303
|
+
: parsed && typeof parsed === "object" && Array.isArray((parsed as { hits?: unknown }).hits)
|
|
1304
|
+
? (parsed as { hits: unknown[] }).hits
|
|
1305
|
+
: null;
|
|
1306
|
+
if (!list) {
|
|
1307
|
+
return null;
|
|
1308
|
+
}
|
|
1309
|
+
return list.map((row) => {
|
|
1310
|
+
const r = row && typeof row === "object" ? (row as Record<string, unknown>) : {};
|
|
1311
|
+
const title =
|
|
1312
|
+
(typeof r.title === "string" && r.title) ||
|
|
1313
|
+
(typeof r.name === "string" && r.name) ||
|
|
1314
|
+
(typeof r.documentTitle === "string" && r.documentTitle) ||
|
|
1315
|
+
(typeof r.path === "string" && r.path) ||
|
|
1316
|
+
(typeof r.id === "string" && r.id) ||
|
|
1317
|
+
t("timeline.toolPresentation.result");
|
|
1318
|
+
const snippet =
|
|
1319
|
+
(typeof r.snippet === "string" && r.snippet) ||
|
|
1320
|
+
(typeof r.text === "string" && r.text) ||
|
|
1321
|
+
(typeof r.content === "string" && r.content) ||
|
|
1322
|
+
"";
|
|
1323
|
+
return { title, snippet: truncatePreview(snippet, 160) };
|
|
1324
|
+
});
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
export function docsSearchPresentation(t: OpenGeniText, item: ToolCallItem): ToolRowPresentation {
|
|
1328
|
+
const args = parseToolArgs(item.arguments);
|
|
1329
|
+
const query = typeof args.query === "string" ? args.query.trim() : "";
|
|
1330
|
+
const base = {
|
|
1331
|
+
tool: "docs_search" as const,
|
|
1332
|
+
icon: "file-search" as const,
|
|
1333
|
+
title: query
|
|
1334
|
+
? t("timeline.toolPresentation.searchTruncatepreview", {
|
|
1335
|
+
truncatePreview: truncatePreview(query, 48),
|
|
1336
|
+
})
|
|
1337
|
+
: toolDisplayName(t, item.name, item.display),
|
|
1338
|
+
};
|
|
1339
|
+
if (item.status === "running") {
|
|
1340
|
+
return {
|
|
1341
|
+
...base,
|
|
1342
|
+
iconTone: "running",
|
|
1343
|
+
running: true,
|
|
1344
|
+
preview: textPreview(t("timeline.toolPresentation.searching"), true),
|
|
1345
|
+
body: {
|
|
1346
|
+
kind: "payloads",
|
|
1347
|
+
blocks: [{ label: t("timeline.toolPresentation.arguments"), value: args }],
|
|
1348
|
+
},
|
|
1349
|
+
};
|
|
1350
|
+
}
|
|
1351
|
+
const { text: outText, isError } = unwrapMcpOutput(item.output);
|
|
1352
|
+
if ((isError || item.status === "failed") && item.status !== "cancelled") {
|
|
1353
|
+
return {
|
|
1354
|
+
...base,
|
|
1355
|
+
iconTone: "failed",
|
|
1356
|
+
failed: true,
|
|
1357
|
+
preview: textPreview(
|
|
1358
|
+
truncatePreview(outText, 80) || t("timeline.toolPresentation.searchFailed"),
|
|
1359
|
+
),
|
|
1360
|
+
body: {
|
|
1361
|
+
kind: "payloads",
|
|
1362
|
+
blocks: [
|
|
1363
|
+
{ label: t("timeline.toolPresentation.arguments"), value: args },
|
|
1364
|
+
{ label: t("timeline.toolPresentation.error"), value: outText, failed: true },
|
|
1365
|
+
],
|
|
1366
|
+
},
|
|
1367
|
+
};
|
|
1368
|
+
}
|
|
1369
|
+
const hits = parseSearchHits(t, outText);
|
|
1370
|
+
const preview =
|
|
1371
|
+
item.status === "cancelled"
|
|
1372
|
+
? undefined
|
|
1373
|
+
: hits
|
|
1374
|
+
? hits.length === 0
|
|
1375
|
+
? t("timeline.toolPresentation.noHits")
|
|
1376
|
+
: t("counts.hits", { count: hits.length })
|
|
1377
|
+
: t("timeline.toolPresentation.done");
|
|
1378
|
+
return {
|
|
1379
|
+
...base,
|
|
1380
|
+
iconTone: "muted",
|
|
1381
|
+
cancelled: item.status === "cancelled",
|
|
1382
|
+
...(preview ? { preview: textPreview(preview) } : {}),
|
|
1383
|
+
body: {
|
|
1384
|
+
kind: "listing",
|
|
1385
|
+
entries: (hits ?? []).slice(0, 8).map((hit) => ({
|
|
1386
|
+
key: `${hit.title}\u0000${hit.snippet}`,
|
|
1387
|
+
title: hit.title,
|
|
1388
|
+
snippet: hit.snippet || undefined,
|
|
1389
|
+
})),
|
|
1390
|
+
blocks: [
|
|
1391
|
+
{ label: t("timeline.toolPresentation.arguments"), value: args },
|
|
1392
|
+
{ label: t("timeline.toolPresentation.result"), value: outText },
|
|
1393
|
+
],
|
|
1394
|
+
},
|
|
1395
|
+
};
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
/* ---- set_session_title / set_other_session_title --------------------------- */
|
|
1399
|
+
|
|
1400
|
+
export function sessionTitlePresentation(t: OpenGeniText, item: ToolCallItem): ToolRowPresentation {
|
|
1401
|
+
const args = parseToolArgs(item.arguments);
|
|
1402
|
+
const titleArg = typeof args.title === "string" ? args.title.trim() : "";
|
|
1403
|
+
const previewTitle = titleArg ? truncatePreview(titleArg, 72) : "";
|
|
1404
|
+
const base = {
|
|
1405
|
+
tool: "session_title" as const,
|
|
1406
|
+
icon: "sessions" as const,
|
|
1407
|
+
title: toolDisplayName(t, item.name, item.display),
|
|
1408
|
+
};
|
|
1409
|
+
if (item.status === "running") {
|
|
1410
|
+
return {
|
|
1411
|
+
...base,
|
|
1412
|
+
iconTone: "running",
|
|
1413
|
+
running: true,
|
|
1414
|
+
preview: textPreview(previewTitle || t("timeline.toolPresentation.settingTitle"), true),
|
|
1415
|
+
body: {
|
|
1416
|
+
kind: "payloads",
|
|
1417
|
+
blocks: [{ label: t("timeline.toolPresentation.arguments"), value: args }],
|
|
1418
|
+
},
|
|
1419
|
+
};
|
|
1420
|
+
}
|
|
1421
|
+
const { text: outText, isError } = unwrapMcpOutput(item.output);
|
|
1422
|
+
if ((isError || item.status === "failed") && item.status !== "cancelled") {
|
|
1423
|
+
return {
|
|
1424
|
+
...base,
|
|
1425
|
+
iconTone: "failed",
|
|
1426
|
+
failed: true,
|
|
1427
|
+
preview: textPreview(
|
|
1428
|
+
truncatePreview(outText, 80) || t("timeline.toolPresentation.renameFailed"),
|
|
1429
|
+
),
|
|
1430
|
+
body: {
|
|
1431
|
+
kind: "payloads",
|
|
1432
|
+
blocks: [
|
|
1433
|
+
{ label: t("timeline.toolPresentation.arguments"), value: args },
|
|
1434
|
+
{ label: t("timeline.toolPresentation.error"), value: outText, failed: true },
|
|
1435
|
+
],
|
|
1436
|
+
},
|
|
1437
|
+
};
|
|
1438
|
+
}
|
|
1439
|
+
// Prefer the submitted title; fall back to a title field in the tool result.
|
|
1440
|
+
let settledTitle = previewTitle;
|
|
1441
|
+
if (!settledTitle) {
|
|
1442
|
+
const parsed = tryParseJson(outText);
|
|
1443
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
1444
|
+
const fromResult = (parsed as { title?: unknown }).title;
|
|
1445
|
+
if (typeof fromResult === "string" && fromResult.trim()) {
|
|
1446
|
+
settledTitle = truncatePreview(fromResult.trim(), 72);
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
return {
|
|
1451
|
+
...base,
|
|
1452
|
+
iconTone: "muted",
|
|
1453
|
+
cancelled: item.status === "cancelled",
|
|
1454
|
+
...(item.status !== "cancelled" && settledTitle ? { preview: textPreview(settledTitle) } : {}),
|
|
1455
|
+
body: {
|
|
1456
|
+
kind: "payloads",
|
|
1457
|
+
blocks: outText
|
|
1458
|
+
? [
|
|
1459
|
+
{ label: t("timeline.toolPresentation.arguments"), value: args },
|
|
1460
|
+
{ label: t("timeline.toolPresentation.result"), value: outText },
|
|
1461
|
+
]
|
|
1462
|
+
: [{ label: t("timeline.toolPresentation.arguments"), value: args }],
|
|
1463
|
+
},
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
/* ---- resolution ------------------------------------------------------------ */
|
|
1468
|
+
|
|
1469
|
+
const PRESENTERS_BY_RAW_TYPE: Record<string, PresentedToolKind> = {
|
|
1470
|
+
apply_patch_call: "apply_patch",
|
|
1471
|
+
// Web renders these with richer media renderers; keep them off name matches.
|
|
1472
|
+
computer_call: "generic",
|
|
1473
|
+
tool_search_call: "tool_search",
|
|
1474
|
+
};
|
|
1475
|
+
|
|
1476
|
+
const PRESENTERS_BY_NAME: Record<string, PresentedToolKind> = {
|
|
1477
|
+
exec_command: "exec",
|
|
1478
|
+
request_human_input: "ask",
|
|
1479
|
+
run_on: "run_on",
|
|
1480
|
+
write_stdin: "write_stdin",
|
|
1481
|
+
apply_patch_call: "apply_patch",
|
|
1482
|
+
apply_patch: "apply_patch",
|
|
1483
|
+
web_search_call: "web_search",
|
|
1484
|
+
tool_search: "tool_search",
|
|
1485
|
+
search_documents: "docs_search",
|
|
1486
|
+
knowledge_search: "docs_search",
|
|
1487
|
+
set_session_title: "session_title",
|
|
1488
|
+
set_other_session_title: "session_title",
|
|
1489
|
+
sandboxes_list: "machine",
|
|
1490
|
+
sandbox_swap: "machine",
|
|
1491
|
+
computer_open: "machine",
|
|
1492
|
+
computer_observe: "machine",
|
|
1493
|
+
computer_act: "machine",
|
|
1494
|
+
interaction_discover: "machine",
|
|
1495
|
+
};
|
|
1496
|
+
|
|
1497
|
+
/**
|
|
1498
|
+
* Resolve the shared presenter for a call with the web registry's precedence
|
|
1499
|
+
* (raw.type, exact name, MCP leaf). Tools whose web renderer is richer than the
|
|
1500
|
+
* shared model (computer use, media, knowledge receipts, …) resolve to
|
|
1501
|
+
* `generic`; non-DOM renderers may layer their own presenters on top.
|
|
1502
|
+
*/
|
|
1503
|
+
export function presentedToolKind(item: ToolCallItem): PresentedToolKind {
|
|
1504
|
+
const rawType = rawTypeOf(item);
|
|
1505
|
+
if (rawType && PRESENTERS_BY_RAW_TYPE[rawType]) {
|
|
1506
|
+
return PRESENTERS_BY_RAW_TYPE[rawType];
|
|
1507
|
+
}
|
|
1508
|
+
const exact = PRESENTERS_BY_NAME[item.name];
|
|
1509
|
+
if (exact) {
|
|
1510
|
+
return exact;
|
|
1511
|
+
}
|
|
1512
|
+
const leaf = mcpToolLeaf(item.name);
|
|
1513
|
+
if (leaf !== item.name && PRESENTERS_BY_NAME[leaf]) {
|
|
1514
|
+
return PRESENTERS_BY_NAME[leaf];
|
|
1515
|
+
}
|
|
1516
|
+
if (leaf.startsWith("cua_")) {
|
|
1517
|
+
return "machine";
|
|
1518
|
+
}
|
|
1519
|
+
return "generic";
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
export function toolRowPresentation(
|
|
1523
|
+
t: OpenGeniText,
|
|
1524
|
+
item: ToolCallItem,
|
|
1525
|
+
context: ToolPresentationContext = {},
|
|
1526
|
+
): ToolRowPresentation {
|
|
1527
|
+
item = invokedToolCall(item);
|
|
1528
|
+
switch (presentedToolKind(item)) {
|
|
1529
|
+
case "exec":
|
|
1530
|
+
return execPresentation(t, item, context);
|
|
1531
|
+
case "write_stdin":
|
|
1532
|
+
return writeStdinPresentation(t, item);
|
|
1533
|
+
case "apply_patch":
|
|
1534
|
+
return applyPatchPresentation(t, item) ?? genericToolPresentation(t, item);
|
|
1535
|
+
case "web_search":
|
|
1536
|
+
return webSearchPresentation(t, item);
|
|
1537
|
+
case "ask":
|
|
1538
|
+
return askPresentation(t, item);
|
|
1539
|
+
case "run_on":
|
|
1540
|
+
return runOnPresentation(t, item);
|
|
1541
|
+
case "tool_search":
|
|
1542
|
+
return toolSearchPresentation(t, item);
|
|
1543
|
+
case "docs_search":
|
|
1544
|
+
return docsSearchPresentation(t, item);
|
|
1545
|
+
case "session_title":
|
|
1546
|
+
return sessionTitlePresentation(t, item);
|
|
1547
|
+
case "machine":
|
|
1548
|
+
return machinePresentation(t, item);
|
|
1549
|
+
default:
|
|
1550
|
+
return genericToolPresentation(t, item);
|
|
1551
|
+
}
|
|
1552
|
+
}
|