@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
|
@@ -18,11 +18,30 @@ import {
|
|
|
18
18
|
} from "../session-context";
|
|
19
19
|
import { isNonRetryableInteractionError } from "../lib/interaction-errors";
|
|
20
20
|
import { usePageLiveActivity } from "./internal";
|
|
21
|
+
import { useOpenGeniText } from "../messages/runtime";
|
|
22
|
+
|
|
23
|
+
/** Immutable input fence; queued actions never need the encoded screenshot. */
|
|
24
|
+
export type BrowserFrameInputFence = Pick<
|
|
25
|
+
BrowserFrame,
|
|
26
|
+
| "browserSessionId"
|
|
27
|
+
| "controllerGeneration"
|
|
28
|
+
| "targetId"
|
|
29
|
+
| "targetGeneration"
|
|
30
|
+
| "documentGeneration"
|
|
31
|
+
| "frameId"
|
|
32
|
+
>;
|
|
33
|
+
|
|
34
|
+
export type BrowserInputFailure = Pick<BrowserActionReceipt, "operationId" | "error"> & {
|
|
35
|
+
state: Exclude<BrowserActionReceipt["state"], "completed">;
|
|
36
|
+
};
|
|
21
37
|
|
|
22
38
|
export type UseBrowserSessionOptions = EmbeddedBrowserInteractionClientOverride & {
|
|
23
39
|
browserSessionId: string | null;
|
|
24
40
|
enabled?: boolean | undefined;
|
|
25
41
|
pollIntervalMs?: number | undefined;
|
|
42
|
+
/** Keep session/tab inventory current without repeatedly fetching the full
|
|
43
|
+
* accessibility tree while a live frame is available or the viewer is hidden. */
|
|
44
|
+
semanticObservationEnabled?: boolean | undefined;
|
|
26
45
|
};
|
|
27
46
|
|
|
28
47
|
export type UseBrowserSessionResult = {
|
|
@@ -33,7 +52,13 @@ export type UseBrowserSessionResult = {
|
|
|
33
52
|
loading: boolean;
|
|
34
53
|
mutating: boolean;
|
|
35
54
|
error: Error | null;
|
|
55
|
+
inputFailure: BrowserInputFailure | null;
|
|
36
56
|
refresh: () => Promise<void>;
|
|
57
|
+
observeForInput: () => Promise<BrowserObservation>;
|
|
58
|
+
actFromObservation: (
|
|
59
|
+
action: BrowserAction,
|
|
60
|
+
observation: BrowserObservation,
|
|
61
|
+
) => Promise<BrowserActionReceipt>;
|
|
37
62
|
selectTarget: (targetId: string) => Promise<BrowserTarget>;
|
|
38
63
|
openTarget: (url?: string) => Promise<BrowserTarget>;
|
|
39
64
|
closeTarget: (targetId: string) => Promise<void>;
|
|
@@ -45,8 +70,9 @@ export type UseBrowserSessionResult = {
|
|
|
45
70
|
* the controller fence instead of targeting a newer page. */
|
|
46
71
|
actFromFrame: (
|
|
47
72
|
action: BrowserAction | BrowserActionBatch,
|
|
48
|
-
frame:
|
|
73
|
+
frame: BrowserFrameInputFence,
|
|
49
74
|
operationId?: string,
|
|
75
|
+
observationMode?: "none" | "input",
|
|
50
76
|
) => Promise<BrowserActionReceipt>;
|
|
51
77
|
readClipboard: () => Promise<BrowserClipboard>;
|
|
52
78
|
diagnostics: (options?: BrowserDiagnosticsOptions) => Promise<BrowserDiagnosticBatch>;
|
|
@@ -55,12 +81,31 @@ export type UseBrowserSessionResult = {
|
|
|
55
81
|
/** Selected BrowserSession control state. All human actions use the same
|
|
56
82
|
* generation-fenced controller operation stream as agent actions. */
|
|
57
83
|
export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowserSessionResult {
|
|
84
|
+
const t = useOpenGeniText();
|
|
58
85
|
const { client, workspaceId } = useEmbeddedBrowserInteraction(options);
|
|
59
86
|
const browserSessionId = options.browserSessionId;
|
|
60
87
|
const enabled = (options.enabled ?? true) && browserSessionId !== null;
|
|
88
|
+
const sourceRef = useRef({ client, workspaceId, browserSessionId, enabled });
|
|
89
|
+
if (
|
|
90
|
+
sourceRef.current.client !== client ||
|
|
91
|
+
sourceRef.current.workspaceId !== workspaceId ||
|
|
92
|
+
sourceRef.current.browserSessionId !== browserSessionId ||
|
|
93
|
+
sourceRef.current.enabled !== enabled
|
|
94
|
+
) {
|
|
95
|
+
sourceRef.current = { client, workspaceId, browserSessionId, enabled };
|
|
96
|
+
}
|
|
97
|
+
const source = sourceRef.current;
|
|
98
|
+
const semanticObservationEnabled = options.semanticObservationEnabled ?? true;
|
|
99
|
+
const semanticObservationEnabledRef = useRef(semanticObservationEnabled);
|
|
100
|
+
semanticObservationEnabledRef.current = semanticObservationEnabled;
|
|
101
|
+
const previousSemanticObservationRef = useRef({
|
|
102
|
+
browserSessionId,
|
|
103
|
+
enabled: semanticObservationEnabled,
|
|
104
|
+
});
|
|
61
105
|
const pageLive = usePageLiveActivity();
|
|
62
106
|
const pollIntervalMs = Math.max(750, options.pollIntervalMs ?? 2_000);
|
|
63
107
|
const [state, setState] = useState<{
|
|
108
|
+
source: typeof source;
|
|
64
109
|
browserSessionId: string | null;
|
|
65
110
|
session: BrowserSession | null;
|
|
66
111
|
targets: BrowserTarget[];
|
|
@@ -69,16 +114,30 @@ export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowser
|
|
|
69
114
|
loading: boolean;
|
|
70
115
|
mutating: boolean;
|
|
71
116
|
error: Error | null;
|
|
72
|
-
|
|
117
|
+
inputFailure: BrowserInputFailure | null;
|
|
118
|
+
actionResultOrder: number;
|
|
119
|
+
}>(() => ({ ...emptyState(browserSessionId, enabled), source }));
|
|
73
120
|
const visible =
|
|
74
|
-
state.
|
|
121
|
+
state.source === source && state.browserSessionId === browserSessionId
|
|
122
|
+
? state
|
|
123
|
+
: { ...emptyState(browserSessionId, enabled), source };
|
|
75
124
|
const refreshBlocked = isNonRetryableInteractionError(visible.error);
|
|
125
|
+
const inputFailureRef = useRef(visible.inputFailure);
|
|
126
|
+
inputFailureRef.current = visible.inputFailure;
|
|
76
127
|
const selectedTargetIdRef = useRef<string | null>(visible.selectedTargetId);
|
|
77
128
|
selectedTargetIdRef.current = visible.selectedTargetId;
|
|
129
|
+
const selectionRevisionRef = useRef(0);
|
|
130
|
+
const actionResultOrderRef = useRef({ next: 0, settled: 0 });
|
|
131
|
+
const selectedTargetRef = useRef<BrowserTarget | null>(
|
|
132
|
+
visible.targets.find((target) => target.id === visible.selectedTargetId) ?? null,
|
|
133
|
+
);
|
|
134
|
+
selectedTargetRef.current =
|
|
135
|
+
visible.targets.find((target) => target.id === visible.selectedTargetId) ?? null;
|
|
78
136
|
const observationRef = useRef<{
|
|
79
137
|
browserSessionId: string | null;
|
|
80
138
|
observation: BrowserObservation | null;
|
|
81
139
|
}>({ browserSessionId, observation: visible.observation });
|
|
140
|
+
const lastObservationAtRef = useRef(0);
|
|
82
141
|
if (observationRef.current.browserSessionId !== browserSessionId) {
|
|
83
142
|
observationRef.current = {
|
|
84
143
|
browserSessionId,
|
|
@@ -93,12 +152,20 @@ export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowser
|
|
|
93
152
|
});
|
|
94
153
|
const mutationRef = useRef<{
|
|
95
154
|
browserSessionId: string | null;
|
|
155
|
+
source: typeof source;
|
|
96
156
|
count: number;
|
|
157
|
+
needsInventoryReconcile: boolean;
|
|
97
158
|
}>({
|
|
98
159
|
browserSessionId,
|
|
160
|
+
source,
|
|
99
161
|
count: 0,
|
|
162
|
+
needsInventoryReconcile: false,
|
|
100
163
|
});
|
|
101
164
|
const mountedRef = useRef(true);
|
|
165
|
+
const isCurrentSource = useCallback(
|
|
166
|
+
() => mountedRef.current && sourceRef.current === source,
|
|
167
|
+
[source],
|
|
168
|
+
);
|
|
102
169
|
|
|
103
170
|
const invalidateRefresh = useCallback(() => {
|
|
104
171
|
const id = requestRef.current.id + 1;
|
|
@@ -106,113 +173,244 @@ export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowser
|
|
|
106
173
|
requestRef.current = { id, controller: null };
|
|
107
174
|
}, []);
|
|
108
175
|
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
client.getBrowserSession(workspaceId, browserSessionId, {
|
|
118
|
-
signal: controller.signal,
|
|
119
|
-
}),
|
|
120
|
-
client.listBrowserTargets(workspaceId, browserSessionId, {
|
|
121
|
-
signal: controller.signal,
|
|
122
|
-
}),
|
|
123
|
-
]);
|
|
124
|
-
if (!mountedRef.current || requestRef.current.id !== id) return;
|
|
125
|
-
const selected = chooseTarget(targetResponse.targets, selectedTargetIdRef.current);
|
|
126
|
-
selectedTargetIdRef.current = selected?.id ?? null;
|
|
127
|
-
observationRef.current = { browserSessionId, observation: null };
|
|
128
|
-
setState((current) =>
|
|
129
|
-
current.browserSessionId === browserSessionId
|
|
130
|
-
? {
|
|
131
|
-
...current,
|
|
132
|
-
session,
|
|
133
|
-
targets: targetResponse.targets,
|
|
134
|
-
selectedTargetId: selected?.id ?? null,
|
|
135
|
-
observation: null,
|
|
136
|
-
loading: false,
|
|
137
|
-
error: null,
|
|
138
|
-
}
|
|
139
|
-
: current,
|
|
140
|
-
);
|
|
141
|
-
if (!selected) return;
|
|
176
|
+
const refreshInventory = useCallback(
|
|
177
|
+
async (checkInput = false, observeSelectedTarget = true) => {
|
|
178
|
+
if (!enabled || !browserSessionId || !isCurrentSource()) return;
|
|
179
|
+
const checkedInputFailure = inputFailureRef.current;
|
|
180
|
+
const id = requestRef.current.id + 1;
|
|
181
|
+
requestRef.current.controller?.abort();
|
|
182
|
+
const controller = new AbortController();
|
|
183
|
+
requestRef.current = { id, controller };
|
|
142
184
|
try {
|
|
143
|
-
const
|
|
144
|
-
workspaceId,
|
|
185
|
+
const [session, targetResponse] = await Promise.all([
|
|
186
|
+
client.getBrowserSession(workspaceId, browserSessionId, {
|
|
187
|
+
signal: controller.signal,
|
|
188
|
+
}),
|
|
189
|
+
client.listBrowserTargets(workspaceId, browserSessionId, {
|
|
190
|
+
signal: controller.signal,
|
|
191
|
+
}),
|
|
192
|
+
]);
|
|
193
|
+
if (!isCurrentSource() || requestRef.current.id !== id) return;
|
|
194
|
+
const selected = chooseTarget(targetResponse.targets, selectedTargetIdRef.current);
|
|
195
|
+
selectedTargetIdRef.current = selected?.id ?? null;
|
|
196
|
+
selectedTargetRef.current = selected;
|
|
197
|
+
const previousObservation =
|
|
198
|
+
observationRef.current.browserSessionId === browserSessionId
|
|
199
|
+
? observationRef.current.observation
|
|
200
|
+
: null;
|
|
201
|
+
const retainedObservation =
|
|
202
|
+
selected && previousObservation && sameObservationTarget(previousObservation, selected)
|
|
203
|
+
? previousObservation
|
|
204
|
+
: null;
|
|
205
|
+
observationRef.current = {
|
|
145
206
|
browserSessionId,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
);
|
|
149
|
-
if (!mountedRef.current || requestRef.current.id !== id) return;
|
|
150
|
-
observationRef.current = { browserSessionId, observation };
|
|
207
|
+
observation: retainedObservation,
|
|
208
|
+
};
|
|
151
209
|
setState((current) =>
|
|
152
|
-
|
|
153
|
-
current.
|
|
154
|
-
|
|
210
|
+
isCurrentSource() &&
|
|
211
|
+
current.source === source &&
|
|
212
|
+
current.browserSessionId === browserSessionId
|
|
213
|
+
? {
|
|
214
|
+
...current,
|
|
215
|
+
session,
|
|
216
|
+
targets: targetResponse.targets,
|
|
217
|
+
selectedTargetId: selected?.id ?? null,
|
|
218
|
+
observation: retainedObservation,
|
|
219
|
+
loading: false,
|
|
220
|
+
error: null,
|
|
221
|
+
// Media and background polling cannot confirm an input outcome.
|
|
222
|
+
// Only an explicit fresh check clears the notice it began with.
|
|
223
|
+
inputFailure:
|
|
224
|
+
checkInput &&
|
|
225
|
+
session.id === browserSessionId &&
|
|
226
|
+
targetResponse.browserSessionId === browserSessionId &&
|
|
227
|
+
current.inputFailure === checkedInputFailure
|
|
228
|
+
? null
|
|
229
|
+
: current.inputFailure,
|
|
230
|
+
}
|
|
155
231
|
: current,
|
|
156
232
|
);
|
|
233
|
+
if (!selected || !observeSelectedTarget || !semanticObservationEnabledRef.current) return;
|
|
234
|
+
try {
|
|
235
|
+
const observation = await client.observeBrowserTarget(
|
|
236
|
+
workspaceId,
|
|
237
|
+
browserSessionId,
|
|
238
|
+
selected.id,
|
|
239
|
+
{ signal: controller.signal },
|
|
240
|
+
);
|
|
241
|
+
if (!isCurrentSource() || requestRef.current.id !== id) return;
|
|
242
|
+
const currentSelected = selectedTargetRef.current;
|
|
243
|
+
if (
|
|
244
|
+
observationRef.current.browserSessionId !== browserSessionId ||
|
|
245
|
+
currentSelected?.id !== selected.id ||
|
|
246
|
+
observation.browserSessionId !== browserSessionId ||
|
|
247
|
+
observation.target.id !== selected.id ||
|
|
248
|
+
observation.target.controllerGeneration !== currentSelected.controllerGeneration ||
|
|
249
|
+
observation.target.targetGeneration !== currentSelected.targetGeneration
|
|
250
|
+
)
|
|
251
|
+
return;
|
|
252
|
+
// Navigation may complete between the inventory and its selected-page
|
|
253
|
+
// observation. Keep both the selected target and input fence coherent.
|
|
254
|
+
selectedTargetRef.current = observation.target;
|
|
255
|
+
observationRef.current = { browserSessionId, observation };
|
|
256
|
+
lastObservationAtRef.current = Date.now();
|
|
257
|
+
setState((current) =>
|
|
258
|
+
isCurrentSource() &&
|
|
259
|
+
current.source === source &&
|
|
260
|
+
current.browserSessionId === browserSessionId &&
|
|
261
|
+
current.selectedTargetId === observation.target.id
|
|
262
|
+
? {
|
|
263
|
+
...current,
|
|
264
|
+
observation,
|
|
265
|
+
targets: replaceTarget(current.targets, observation.target),
|
|
266
|
+
}
|
|
267
|
+
: current,
|
|
268
|
+
);
|
|
269
|
+
} catch (cause) {
|
|
270
|
+
if (controller.signal.aborted || !isCurrentSource() || requestRef.current.id !== id)
|
|
271
|
+
return;
|
|
272
|
+
// Target inventory and the media plane remain authoritative for the
|
|
273
|
+
// human-facing browser. A failed semantic snapshot must not blank or
|
|
274
|
+
// disable an otherwise live visual browser.
|
|
275
|
+
void cause;
|
|
276
|
+
}
|
|
157
277
|
} catch (cause) {
|
|
158
|
-
if (controller.signal.aborted || !
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
278
|
+
if (controller.signal.aborted || !isCurrentSource() || requestRef.current.id !== id) return;
|
|
279
|
+
setState((current) =>
|
|
280
|
+
isCurrentSource() &&
|
|
281
|
+
current.source === source &&
|
|
282
|
+
current.browserSessionId === browserSessionId
|
|
283
|
+
? {
|
|
284
|
+
...current,
|
|
285
|
+
loading: false,
|
|
286
|
+
error: cause instanceof Error ? cause : new Error(String(cause)),
|
|
287
|
+
}
|
|
288
|
+
: current,
|
|
289
|
+
);
|
|
290
|
+
} finally {
|
|
291
|
+
if (requestRef.current.id === id) {
|
|
292
|
+
requestRef.current = { id, controller: null };
|
|
293
|
+
}
|
|
164
294
|
}
|
|
165
|
-
}
|
|
166
|
-
|
|
295
|
+
},
|
|
296
|
+
[browserSessionId, client, enabled, isCurrentSource, source, workspaceId],
|
|
297
|
+
);
|
|
298
|
+
|
|
299
|
+
const refresh = useCallback(async () => await refreshInventory(true), [refreshInventory]);
|
|
300
|
+
|
|
301
|
+
const refreshSemantic = useCallback(async (): Promise<void> => {
|
|
302
|
+
if (!enabled || !browserSessionId || !isCurrentSource()) return;
|
|
303
|
+
const target = selectedTargetRef.current;
|
|
304
|
+
if (!target) return;
|
|
305
|
+
const id = requestRef.current.id + 1;
|
|
306
|
+
requestRef.current.controller?.abort();
|
|
307
|
+
const controller = new AbortController();
|
|
308
|
+
requestRef.current = { id, controller };
|
|
309
|
+
try {
|
|
310
|
+
const observation = await client.observeBrowserTarget(
|
|
311
|
+
workspaceId,
|
|
312
|
+
browserSessionId,
|
|
313
|
+
target.id,
|
|
314
|
+
{ signal: controller.signal },
|
|
315
|
+
);
|
|
316
|
+
if (!isCurrentSource() || requestRef.current.id !== id) return;
|
|
317
|
+
if (!sameObservationTarget(observation, selectedTargetRef.current)) return;
|
|
318
|
+
observationRef.current = { browserSessionId, observation };
|
|
319
|
+
lastObservationAtRef.current = Date.now();
|
|
167
320
|
setState((current) =>
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
321
|
+
isCurrentSource() &&
|
|
322
|
+
current.source === source &&
|
|
323
|
+
current.browserSessionId === browserSessionId &&
|
|
324
|
+
current.selectedTargetId === target.id
|
|
325
|
+
? { ...current, observation }
|
|
174
326
|
: current,
|
|
175
327
|
);
|
|
328
|
+
} catch {
|
|
329
|
+
// A failed semantic fallback cannot disable an otherwise live browser.
|
|
176
330
|
} finally {
|
|
177
|
-
if (requestRef.current.id === id) {
|
|
178
|
-
requestRef.current = { id, controller: null };
|
|
179
|
-
}
|
|
331
|
+
if (requestRef.current.id === id) requestRef.current = { id, controller: null };
|
|
180
332
|
}
|
|
181
|
-
}, [browserSessionId, client, enabled, workspaceId]);
|
|
333
|
+
}, [browserSessionId, client, enabled, isCurrentSource, source, workspaceId]);
|
|
182
334
|
|
|
183
335
|
useEffect(() => {
|
|
184
336
|
mountedRef.current = true;
|
|
185
337
|
if (!enabled) {
|
|
186
338
|
invalidateRefresh();
|
|
187
|
-
setState(emptyState(browserSessionId, false));
|
|
339
|
+
setState({ ...emptyState(browserSessionId, false), source });
|
|
188
340
|
return;
|
|
189
341
|
}
|
|
190
342
|
setState((current) =>
|
|
343
|
+
isCurrentSource() &&
|
|
344
|
+
current.source === source &&
|
|
191
345
|
current.browserSessionId === browserSessionId
|
|
192
346
|
? { ...current, loading: true }
|
|
193
|
-
: emptyState(browserSessionId, true),
|
|
347
|
+
: { ...emptyState(browserSessionId, true), source },
|
|
194
348
|
);
|
|
195
|
-
void
|
|
349
|
+
void refreshInventory();
|
|
196
350
|
return () => {
|
|
197
351
|
mountedRef.current = false;
|
|
198
352
|
invalidateRefresh();
|
|
199
353
|
};
|
|
200
|
-
}, [browserSessionId, enabled, invalidateRefresh,
|
|
354
|
+
}, [browserSessionId, enabled, invalidateRefresh, isCurrentSource, refreshInventory, source]);
|
|
355
|
+
|
|
356
|
+
useEffect(() => {
|
|
357
|
+
const previous = previousSemanticObservationRef.current;
|
|
358
|
+
previousSemanticObservationRef.current = {
|
|
359
|
+
browserSessionId,
|
|
360
|
+
enabled: semanticObservationEnabled,
|
|
361
|
+
};
|
|
362
|
+
if (
|
|
363
|
+
enabled &&
|
|
364
|
+
semanticObservationEnabled &&
|
|
365
|
+
previous.browserSessionId === browserSessionId &&
|
|
366
|
+
!previous.enabled
|
|
367
|
+
) {
|
|
368
|
+
// The media stream disappeared or the user returned to the Browser tab.
|
|
369
|
+
// A just-returned action/tab observation is already a fresh fallback.
|
|
370
|
+
// Otherwise drop the old tree/fence until a new read settles.
|
|
371
|
+
const currentObservation = observationRef.current.observation;
|
|
372
|
+
if (
|
|
373
|
+
currentObservation &&
|
|
374
|
+
sameObservationTarget(currentObservation, selectedTargetRef.current) &&
|
|
375
|
+
Date.now() - lastObservationAtRef.current < pollIntervalMs
|
|
376
|
+
) {
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
observationRef.current = { browserSessionId, observation: null };
|
|
380
|
+
setState((current) =>
|
|
381
|
+
isCurrentSource() &&
|
|
382
|
+
current.source === source &&
|
|
383
|
+
current.browserSessionId === browserSessionId
|
|
384
|
+
? { ...current, observation: null }
|
|
385
|
+
: current,
|
|
386
|
+
);
|
|
387
|
+
void refreshSemantic();
|
|
388
|
+
}
|
|
389
|
+
}, [
|
|
390
|
+
browserSessionId,
|
|
391
|
+
enabled,
|
|
392
|
+
isCurrentSource,
|
|
393
|
+
pollIntervalMs,
|
|
394
|
+
refreshSemantic,
|
|
395
|
+
semanticObservationEnabled,
|
|
396
|
+
source,
|
|
397
|
+
]);
|
|
201
398
|
|
|
202
399
|
useEffect(() => {
|
|
203
400
|
if (!enabled || !pageLive || visible.mutating || refreshBlocked) return;
|
|
204
401
|
const timer = setInterval(() => {
|
|
205
|
-
if (!requestRef.current.controller) void
|
|
402
|
+
if (!requestRef.current.controller) void refreshInventory();
|
|
206
403
|
}, pollIntervalMs);
|
|
207
404
|
return () => clearInterval(timer);
|
|
208
|
-
}, [enabled, pageLive, pollIntervalMs,
|
|
405
|
+
}, [enabled, pageLive, pollIntervalMs, refreshInventory, refreshBlocked, visible.mutating]);
|
|
209
406
|
|
|
210
407
|
useEffect(() => {
|
|
211
408
|
if (!enabled || !browserSessionId || !pageLive || refreshBlocked) return;
|
|
212
409
|
let disposed = false;
|
|
213
410
|
const heartbeat = () => {
|
|
411
|
+
if (!isCurrentSource()) return;
|
|
214
412
|
void client.heartbeatBrowserSession(workspaceId, browserSessionId).catch(() => {
|
|
215
|
-
if (!disposed) void
|
|
413
|
+
if (!disposed) void refreshInventory();
|
|
216
414
|
});
|
|
217
415
|
};
|
|
218
416
|
const timer = setInterval(heartbeat, 30_000);
|
|
@@ -220,173 +418,306 @@ export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowser
|
|
|
220
418
|
disposed = true;
|
|
221
419
|
clearInterval(timer);
|
|
222
420
|
};
|
|
223
|
-
}, [
|
|
421
|
+
}, [
|
|
422
|
+
browserSessionId,
|
|
423
|
+
client,
|
|
424
|
+
enabled,
|
|
425
|
+
isCurrentSource,
|
|
426
|
+
pageLive,
|
|
427
|
+
refreshInventory,
|
|
428
|
+
refreshBlocked,
|
|
429
|
+
workspaceId,
|
|
430
|
+
]);
|
|
224
431
|
|
|
225
432
|
const runMutation = useCallback(
|
|
226
|
-
async <T>(
|
|
433
|
+
async <T>(
|
|
434
|
+
scopeBrowserSessionId: string,
|
|
435
|
+
operation: (selectionRevision: number, readRequestId: number) => Promise<T>,
|
|
436
|
+
selectionRead = false,
|
|
437
|
+
changesInventory = false,
|
|
438
|
+
): Promise<T> => {
|
|
439
|
+
if (!enabled || !isCurrentSource()) {
|
|
440
|
+
throw new Error(t("hooks.useBrowserSession.theBrowserSourceIsNo"));
|
|
441
|
+
}
|
|
442
|
+
const selectionRevision = ++selectionRevisionRef.current;
|
|
227
443
|
invalidateRefresh();
|
|
228
|
-
|
|
444
|
+
const readRequestId = requestRef.current.id;
|
|
445
|
+
if (
|
|
446
|
+
mutationRef.current.browserSessionId !== scopeBrowserSessionId ||
|
|
447
|
+
mutationRef.current.source !== source
|
|
448
|
+
) {
|
|
229
449
|
mutationRef.current = {
|
|
230
450
|
browserSessionId: scopeBrowserSessionId,
|
|
451
|
+
source,
|
|
231
452
|
count: 0,
|
|
453
|
+
needsInventoryReconcile: false,
|
|
232
454
|
};
|
|
233
455
|
}
|
|
234
456
|
mutationRef.current.count += 1;
|
|
235
457
|
setState((current) =>
|
|
458
|
+
isCurrentSource() &&
|
|
459
|
+
current.source === source &&
|
|
236
460
|
current.browserSessionId === scopeBrowserSessionId
|
|
237
461
|
? { ...current, mutating: true, error: null }
|
|
238
462
|
: current,
|
|
239
463
|
);
|
|
240
464
|
try {
|
|
241
|
-
return await operation();
|
|
465
|
+
return await operation(selectionRevision, readRequestId);
|
|
242
466
|
} catch (cause) {
|
|
243
467
|
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
)
|
|
468
|
+
// Selection observations share refresh ordering; physical mutations
|
|
469
|
+
// keep their existing outcome admission.
|
|
470
|
+
if (!selectionRead || requestRef.current.id === readRequestId) {
|
|
471
|
+
setState((current) =>
|
|
472
|
+
isCurrentSource() &&
|
|
473
|
+
selectionRevisionRef.current === selectionRevision &&
|
|
474
|
+
current.source === source &&
|
|
475
|
+
current.browserSessionId === scopeBrowserSessionId
|
|
476
|
+
? { ...current, error }
|
|
477
|
+
: current,
|
|
478
|
+
);
|
|
479
|
+
}
|
|
247
480
|
throw error;
|
|
248
481
|
} finally {
|
|
249
|
-
if (
|
|
482
|
+
if (
|
|
483
|
+
mutationRef.current.browserSessionId === scopeBrowserSessionId &&
|
|
484
|
+
mutationRef.current.source === source
|
|
485
|
+
) {
|
|
486
|
+
if (
|
|
487
|
+
changesInventory &&
|
|
488
|
+
(selectionRevisionRef.current !== selectionRevision ||
|
|
489
|
+
requestRef.current.id !== readRequestId)
|
|
490
|
+
) {
|
|
491
|
+
mutationRef.current.needsInventoryReconcile = true;
|
|
492
|
+
}
|
|
250
493
|
mutationRef.current.count = Math.max(0, mutationRef.current.count - 1);
|
|
251
494
|
const mutating = mutationRef.current.count > 0;
|
|
252
495
|
setState((current) =>
|
|
253
|
-
|
|
496
|
+
isCurrentSource() &&
|
|
497
|
+
current.source === source &&
|
|
498
|
+
current.browserSessionId === scopeBrowserSessionId
|
|
499
|
+
? { ...current, mutating }
|
|
500
|
+
: current,
|
|
254
501
|
);
|
|
502
|
+
if (!mutating && mutationRef.current.needsInventoryReconcile && isCurrentSource()) {
|
|
503
|
+
mutationRef.current.needsInventoryReconcile = false;
|
|
504
|
+
// A superseded tab mutation still changed the real inventory. Wait
|
|
505
|
+
// for all selections to settle, then reconcile without replacing
|
|
506
|
+
// the latest selected-page observation or cancelling its read.
|
|
507
|
+
void refreshInventory(false, false);
|
|
508
|
+
}
|
|
255
509
|
}
|
|
256
510
|
}
|
|
257
511
|
},
|
|
258
|
-
[invalidateRefresh],
|
|
512
|
+
[enabled, invalidateRefresh, isCurrentSource, refreshInventory, source, t],
|
|
259
513
|
);
|
|
260
514
|
|
|
261
515
|
const selectTarget = useCallback(
|
|
262
516
|
async (targetId: string): Promise<BrowserTarget> => {
|
|
263
517
|
if (!browserSessionId) throw new Error("No BrowserSession is selected.");
|
|
264
|
-
return await runMutation(
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
observation
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
518
|
+
return await runMutation(
|
|
519
|
+
browserSessionId,
|
|
520
|
+
async (selectionRevision, readRequestId) => {
|
|
521
|
+
const isCurrentSelection = () =>
|
|
522
|
+
isCurrentSource() && selectionRevisionRef.current === selectionRevision;
|
|
523
|
+
// Once admitted, a queued observation survives immediate input.
|
|
524
|
+
const isCurrentSelectionRead = () =>
|
|
525
|
+
isCurrentSelection() && requestRef.current.id === readRequestId;
|
|
526
|
+
let targets = visible.targets;
|
|
527
|
+
let target: BrowserTarget;
|
|
528
|
+
let observation: BrowserObservation;
|
|
529
|
+
try {
|
|
530
|
+
observation = await client.selectBrowserTarget(workspaceId, browserSessionId, targetId);
|
|
531
|
+
target = observation.target;
|
|
532
|
+
} catch (cause) {
|
|
533
|
+
if (!isCurrentSelectionRead() || !isMissingBrowserTarget(cause)) throw cause;
|
|
534
|
+
// A physical/attached tab may disappear between inventory and click.
|
|
535
|
+
// Reconcile once from the authoritative controller inventory and move
|
|
536
|
+
// to its live selected/first page instead of leaving a dead tab ID in
|
|
537
|
+
// React state. Session-level 404s are deliberately not swallowed.
|
|
538
|
+
const response = await client.listBrowserTargets(workspaceId, browserSessionId);
|
|
539
|
+
if (!isCurrentSelectionRead()) throw cause;
|
|
540
|
+
targets = response.targets;
|
|
541
|
+
const fallback = chooseTarget(targets, null);
|
|
542
|
+
if (!fallback) {
|
|
543
|
+
selectedTargetIdRef.current = null;
|
|
544
|
+
selectedTargetRef.current = null;
|
|
545
|
+
observationRef.current = { browserSessionId, observation: null };
|
|
546
|
+
setState((current) =>
|
|
547
|
+
isCurrentSelection() &&
|
|
548
|
+
current.source === source &&
|
|
549
|
+
current.browserSessionId === browserSessionId
|
|
550
|
+
? {
|
|
551
|
+
...current,
|
|
552
|
+
targets,
|
|
553
|
+
selectedTargetId: null,
|
|
554
|
+
observation: null,
|
|
555
|
+
}
|
|
556
|
+
: current,
|
|
557
|
+
);
|
|
558
|
+
throw cause;
|
|
559
|
+
}
|
|
560
|
+
observation = await client.selectBrowserTarget(
|
|
561
|
+
workspaceId,
|
|
562
|
+
browserSessionId,
|
|
563
|
+
fallback.id,
|
|
292
564
|
);
|
|
293
|
-
|
|
565
|
+
target = observation.target;
|
|
294
566
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
567
|
+
if (!isCurrentSelectionRead()) return target;
|
|
568
|
+
selectedTargetIdRef.current = target.id;
|
|
569
|
+
selectedTargetRef.current = target;
|
|
570
|
+
observationRef.current = { browserSessionId, observation };
|
|
571
|
+
lastObservationAtRef.current = Date.now();
|
|
572
|
+
setState((current) =>
|
|
573
|
+
isCurrentSelection() &&
|
|
574
|
+
current.source === source &&
|
|
575
|
+
current.browserSessionId === browserSessionId
|
|
576
|
+
? {
|
|
577
|
+
...current,
|
|
578
|
+
targets: replaceTarget(targets, target).map((candidate) => ({
|
|
579
|
+
...candidate,
|
|
580
|
+
selected: candidate.id === target.id,
|
|
581
|
+
})),
|
|
582
|
+
selectedTargetId: target.id,
|
|
583
|
+
observation,
|
|
584
|
+
}
|
|
585
|
+
: current,
|
|
299
586
|
);
|
|
300
|
-
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
setState((current) =>
|
|
305
|
-
current.browserSessionId === browserSessionId
|
|
306
|
-
? {
|
|
307
|
-
...current,
|
|
308
|
-
targets: targets.map((candidate) => ({
|
|
309
|
-
...candidate,
|
|
310
|
-
selected: candidate.id === target.id,
|
|
311
|
-
})),
|
|
312
|
-
selectedTargetId: target.id,
|
|
313
|
-
observation,
|
|
314
|
-
}
|
|
315
|
-
: current,
|
|
316
|
-
);
|
|
317
|
-
return target;
|
|
318
|
-
});
|
|
587
|
+
return target;
|
|
588
|
+
},
|
|
589
|
+
true,
|
|
590
|
+
);
|
|
319
591
|
},
|
|
320
|
-
[browserSessionId, client, runMutation, visible.targets, workspaceId],
|
|
592
|
+
[browserSessionId, client, isCurrentSource, runMutation, source, visible.targets, workspaceId],
|
|
321
593
|
);
|
|
322
594
|
|
|
323
595
|
const openTarget = useCallback(
|
|
324
596
|
async (url?: string): Promise<BrowserTarget> => {
|
|
325
597
|
if (!browserSessionId) throw new Error("No BrowserSession is selected.");
|
|
326
|
-
return await runMutation(
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
598
|
+
return await runMutation(
|
|
599
|
+
browserSessionId,
|
|
600
|
+
async (selectionRevision, readRequestId) => {
|
|
601
|
+
const isCurrentSelection = () =>
|
|
602
|
+
isCurrentSource() && selectionRevisionRef.current === selectionRevision;
|
|
603
|
+
const isCurrentSelectionRead = () =>
|
|
604
|
+
isCurrentSelection() && requestRef.current.id === readRequestId;
|
|
605
|
+
const observation = await client.openBrowserTarget(
|
|
606
|
+
workspaceId,
|
|
607
|
+
browserSessionId,
|
|
608
|
+
url === undefined ? {} : { url },
|
|
609
|
+
);
|
|
610
|
+
const target = observation.target;
|
|
611
|
+
if (!isCurrentSource()) return target;
|
|
612
|
+
if (!isCurrentSelectionRead()) return target;
|
|
613
|
+
selectedTargetIdRef.current = target.id;
|
|
614
|
+
selectedTargetRef.current = target;
|
|
615
|
+
observationRef.current = { browserSessionId, observation };
|
|
616
|
+
lastObservationAtRef.current = Date.now();
|
|
617
|
+
setState((current) =>
|
|
618
|
+
isCurrentSelection() &&
|
|
619
|
+
current.source === source &&
|
|
620
|
+
current.browserSessionId === browserSessionId
|
|
621
|
+
? {
|
|
622
|
+
...current,
|
|
623
|
+
targets: [
|
|
624
|
+
...current.targets.map((candidate) => ({
|
|
625
|
+
...candidate,
|
|
626
|
+
selected: false,
|
|
627
|
+
})),
|
|
628
|
+
target,
|
|
629
|
+
],
|
|
630
|
+
selectedTargetId: target.id,
|
|
631
|
+
observation,
|
|
632
|
+
}
|
|
633
|
+
: current,
|
|
634
|
+
);
|
|
635
|
+
return target;
|
|
636
|
+
},
|
|
637
|
+
false,
|
|
638
|
+
true,
|
|
639
|
+
);
|
|
353
640
|
},
|
|
354
|
-
[browserSessionId, client, runMutation, workspaceId],
|
|
641
|
+
[browserSessionId, client, isCurrentSource, runMutation, source, workspaceId],
|
|
355
642
|
);
|
|
356
643
|
|
|
357
644
|
const closeTarget = useCallback(
|
|
358
645
|
async (targetId: string): Promise<void> => {
|
|
359
646
|
if (!browserSessionId) throw new Error("No BrowserSession is selected.");
|
|
360
|
-
await runMutation(
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
647
|
+
await runMutation(
|
|
648
|
+
browserSessionId,
|
|
649
|
+
async (selectionRevision, readRequestId) => {
|
|
650
|
+
const isCurrentSelection = () =>
|
|
651
|
+
isCurrentSource() && selectionRevisionRef.current === selectionRevision;
|
|
652
|
+
const isCurrentSelectionRead = () =>
|
|
653
|
+
isCurrentSelection() && requestRef.current.id === readRequestId;
|
|
654
|
+
const response = await client.closeBrowserTarget(workspaceId, browserSessionId, targetId);
|
|
655
|
+
if (!isCurrentSource()) return;
|
|
656
|
+
if (!isCurrentSelectionRead()) return;
|
|
657
|
+
const selected = chooseTarget(response.targets, selectedTargetIdRef.current);
|
|
658
|
+
const observed = selected
|
|
659
|
+
? await client.observeBrowserTarget(workspaceId, browserSessionId, selected.id)
|
|
660
|
+
: null;
|
|
661
|
+
if (!isCurrentSource()) return;
|
|
662
|
+
if (!isCurrentSelectionRead()) return;
|
|
663
|
+
const observation =
|
|
664
|
+
observed &&
|
|
665
|
+
selected &&
|
|
666
|
+
observed.browserSessionId === browserSessionId &&
|
|
667
|
+
observed.target.id === selected.id &&
|
|
668
|
+
observed.target.controllerGeneration === selected.controllerGeneration &&
|
|
669
|
+
observed.target.targetGeneration === selected.targetGeneration
|
|
670
|
+
? observed
|
|
671
|
+
: null;
|
|
672
|
+
const currentTarget = observation?.target ?? selected;
|
|
673
|
+
selectedTargetIdRef.current = currentTarget?.id ?? null;
|
|
674
|
+
selectedTargetRef.current = currentTarget;
|
|
675
|
+
observationRef.current = { browserSessionId, observation };
|
|
676
|
+
if (observation) lastObservationAtRef.current = Date.now();
|
|
677
|
+
setState((current) =>
|
|
678
|
+
isCurrentSelection() &&
|
|
679
|
+
current.source === source &&
|
|
680
|
+
current.browserSessionId === browserSessionId
|
|
681
|
+
? {
|
|
682
|
+
...current,
|
|
683
|
+
targets: currentTarget
|
|
684
|
+
? replaceTarget(response.targets, currentTarget)
|
|
685
|
+
: response.targets,
|
|
686
|
+
selectedTargetId: currentTarget?.id ?? null,
|
|
687
|
+
observation,
|
|
688
|
+
}
|
|
689
|
+
: current,
|
|
690
|
+
);
|
|
691
|
+
},
|
|
692
|
+
false,
|
|
693
|
+
true,
|
|
694
|
+
);
|
|
379
695
|
},
|
|
380
|
-
[browserSessionId, client, runMutation, workspaceId],
|
|
696
|
+
[browserSessionId, client, isCurrentSource, runMutation, source, workspaceId],
|
|
381
697
|
);
|
|
382
698
|
|
|
383
699
|
const dispatchAction = useCallback(
|
|
384
700
|
async (
|
|
385
701
|
action: BrowserAction | BrowserActionBatch,
|
|
386
702
|
operationId: string,
|
|
387
|
-
frame:
|
|
703
|
+
frame:
|
|
704
|
+
| (Pick<
|
|
705
|
+
BrowserFrame,
|
|
706
|
+
"browserSessionId" | "controllerGeneration" | "targetId" | "targetGeneration"
|
|
707
|
+
> & {
|
|
708
|
+
frameId: string | null;
|
|
709
|
+
documentGeneration: string | null;
|
|
710
|
+
})
|
|
711
|
+
| null,
|
|
712
|
+
observationMode: "none" | "input" = "none",
|
|
388
713
|
): Promise<BrowserActionReceipt> => {
|
|
389
714
|
if (!browserSessionId) throw new Error("No BrowserSession is selected.");
|
|
715
|
+
if (!enabled || !isCurrentSource()) {
|
|
716
|
+
throw new Error(t("hooks.useBrowserSession.theBrowserSourceIsNo"));
|
|
717
|
+
}
|
|
718
|
+
if (!selectedTargetRef.current) {
|
|
719
|
+
throw new Error("The browser page is not ready for input.");
|
|
720
|
+
}
|
|
390
721
|
if (frame && frame.browserSessionId !== browserSessionId) {
|
|
391
722
|
throw new Error("The displayed browser frame belongs to another BrowserSession.");
|
|
392
723
|
}
|
|
@@ -401,7 +732,7 @@ export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowser
|
|
|
401
732
|
expectedDocumentGeneration: frame.documentGeneration,
|
|
402
733
|
expectedFrameId: frame.frameId,
|
|
403
734
|
}
|
|
404
|
-
: currentObservation
|
|
735
|
+
: currentObservation && sameObservationTarget(currentObservation, selectedTargetRef.current)
|
|
405
736
|
? {
|
|
406
737
|
targetId: currentObservation.target.id,
|
|
407
738
|
expectedTargetGeneration: currentObservation.target.targetGeneration,
|
|
@@ -412,38 +743,123 @@ export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowser
|
|
|
412
743
|
if (!fence) {
|
|
413
744
|
throw new Error("The browser page is not ready for input.");
|
|
414
745
|
}
|
|
746
|
+
const expectedControllerGeneration =
|
|
747
|
+
frame?.controllerGeneration ?? currentObservation!.target.controllerGeneration;
|
|
748
|
+
const selectionRevision = selectionRevisionRef.current;
|
|
749
|
+
const resultOrder = ++actionResultOrderRef.current.next;
|
|
750
|
+
let resultDocumentGeneration = fence.expectedDocumentGeneration;
|
|
751
|
+
const isCurrentResultView = () => {
|
|
752
|
+
const selected = selectedTargetRef.current;
|
|
753
|
+
return (
|
|
754
|
+
isCurrentSource() &&
|
|
755
|
+
selectionRevisionRef.current === selectionRevision &&
|
|
756
|
+
selected?.browserSessionId === browserSessionId &&
|
|
757
|
+
selected.id === fence.targetId &&
|
|
758
|
+
selected.controllerGeneration === expectedControllerGeneration &&
|
|
759
|
+
selected.targetGeneration === fence.expectedTargetGeneration &&
|
|
760
|
+
(selected.documentGeneration === fence.expectedDocumentGeneration ||
|
|
761
|
+
selected.documentGeneration === resultDocumentGeneration)
|
|
762
|
+
);
|
|
763
|
+
};
|
|
764
|
+
const canProjectResult = () =>
|
|
765
|
+
isCurrentResultView() && resultOrder >= actionResultOrderRef.current.settled;
|
|
766
|
+
const settleResult = () => {
|
|
767
|
+
if (!canProjectResult()) return false;
|
|
768
|
+
actionResultOrderRef.current.settled = resultOrder;
|
|
769
|
+
invalidateRefresh();
|
|
770
|
+
return true;
|
|
771
|
+
};
|
|
415
772
|
try {
|
|
416
773
|
const receipt = await client.actInBrowser(workspaceId, browserSessionId, {
|
|
417
774
|
operationId,
|
|
418
775
|
...fence,
|
|
419
|
-
observationMode
|
|
776
|
+
observationMode,
|
|
420
777
|
action,
|
|
421
778
|
});
|
|
422
|
-
|
|
779
|
+
resultDocumentGeneration =
|
|
780
|
+
receipt.observation?.target.documentGeneration ?? fence.expectedDocumentGeneration;
|
|
781
|
+
const settled =
|
|
782
|
+
receipt.state === "completed" ||
|
|
783
|
+
receipt.state === "failed" ||
|
|
784
|
+
receipt.state === "outcome_unknown";
|
|
785
|
+
// Keep the operation result available to its caller, but an older
|
|
786
|
+
// delivery cannot replace a newer settled view or input failure.
|
|
787
|
+
if (!canProjectResult() || (settled && !settleResult())) return receipt;
|
|
788
|
+
const receivedObservation = receipt.observation;
|
|
789
|
+
const selectedTarget = selectedTargetRef.current;
|
|
790
|
+
let projectedObservation: BrowserObservation | null = null;
|
|
791
|
+
if (
|
|
792
|
+
settled &&
|
|
793
|
+
receivedObservation &&
|
|
794
|
+
canProjectResult() &&
|
|
795
|
+
receipt.browserSessionId === browserSessionId &&
|
|
796
|
+
receipt.controllerGeneration === expectedControllerGeneration &&
|
|
797
|
+
receipt.targetId === fence.targetId &&
|
|
798
|
+
observationRef.current.browserSessionId === browserSessionId &&
|
|
799
|
+
receivedObservation.browserSessionId === browserSessionId &&
|
|
800
|
+
selectedTarget?.browserSessionId === browserSessionId &&
|
|
801
|
+
selectedTarget.id === fence.targetId &&
|
|
802
|
+
receivedObservation.target.id === fence.targetId &&
|
|
803
|
+
selectedTarget.controllerGeneration === expectedControllerGeneration &&
|
|
804
|
+
receivedObservation.target.controllerGeneration === expectedControllerGeneration &&
|
|
805
|
+
selectedTarget.targetGeneration === fence.expectedTargetGeneration &&
|
|
806
|
+
receivedObservation.target.targetGeneration === fence.expectedTargetGeneration &&
|
|
807
|
+
(selectedTarget.documentGeneration === fence.expectedDocumentGeneration ||
|
|
808
|
+
selectedTarget.documentGeneration === receivedObservation.target.documentGeneration)
|
|
809
|
+
) {
|
|
810
|
+
// A receipt updates its own selected page only. Its operation outcome
|
|
811
|
+
// remains available even when the human has moved to another page.
|
|
812
|
+
projectedObservation = receivedObservation;
|
|
423
813
|
observationRef.current = {
|
|
424
814
|
browserSessionId,
|
|
425
|
-
observation:
|
|
815
|
+
observation: receivedObservation,
|
|
426
816
|
};
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
? {
|
|
430
|
-
...current,
|
|
431
|
-
observation: receipt.observation,
|
|
432
|
-
targets: replaceTarget(current.targets, receipt.observation!.target),
|
|
433
|
-
}
|
|
434
|
-
: current,
|
|
435
|
-
);
|
|
817
|
+
selectedTargetRef.current = receivedObservation.target;
|
|
818
|
+
lastObservationAtRef.current = Date.now();
|
|
436
819
|
}
|
|
820
|
+
setState((current) =>
|
|
821
|
+
isCurrentResultView() &&
|
|
822
|
+
current.source === source &&
|
|
823
|
+
current.browserSessionId === browserSessionId &&
|
|
824
|
+
current.actionResultOrder <= resultOrder
|
|
825
|
+
? {
|
|
826
|
+
...current,
|
|
827
|
+
actionResultOrder: settled ? resultOrder : current.actionResultOrder,
|
|
828
|
+
error: receipt.state === "completed" ? null : current.error,
|
|
829
|
+
inputFailure:
|
|
830
|
+
receipt.state === "completed"
|
|
831
|
+
? current.inputFailure
|
|
832
|
+
: {
|
|
833
|
+
operationId: receipt.operationId,
|
|
834
|
+
state: receipt.state,
|
|
835
|
+
error: receipt.error,
|
|
836
|
+
},
|
|
837
|
+
...(projectedObservation
|
|
838
|
+
? {
|
|
839
|
+
observation: projectedObservation,
|
|
840
|
+
targets: replaceTarget(current.targets, projectedObservation.target),
|
|
841
|
+
}
|
|
842
|
+
: {}),
|
|
843
|
+
}
|
|
844
|
+
: current,
|
|
845
|
+
);
|
|
437
846
|
return receipt;
|
|
438
847
|
} catch (cause) {
|
|
439
848
|
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
440
|
-
|
|
441
|
-
current
|
|
442
|
-
|
|
849
|
+
if (settleResult()) {
|
|
850
|
+
setState((current) =>
|
|
851
|
+
isCurrentResultView() &&
|
|
852
|
+
current.source === source &&
|
|
853
|
+
current.browserSessionId === browserSessionId &&
|
|
854
|
+
current.actionResultOrder <= resultOrder
|
|
855
|
+
? { ...current, error, actionResultOrder: resultOrder }
|
|
856
|
+
: current,
|
|
857
|
+
);
|
|
858
|
+
}
|
|
443
859
|
throw error;
|
|
444
860
|
}
|
|
445
861
|
},
|
|
446
|
-
[browserSessionId, client, workspaceId],
|
|
862
|
+
[browserSessionId, client, enabled, invalidateRefresh, isCurrentSource, source, workspaceId, t],
|
|
447
863
|
);
|
|
448
864
|
|
|
449
865
|
const act = useCallback(
|
|
@@ -457,17 +873,57 @@ export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowser
|
|
|
457
873
|
const actFromFrame = useCallback(
|
|
458
874
|
async (
|
|
459
875
|
action: BrowserAction | BrowserActionBatch,
|
|
460
|
-
frame:
|
|
876
|
+
frame: BrowserFrameInputFence,
|
|
461
877
|
operationId: string = crypto.randomUUID(),
|
|
462
|
-
|
|
878
|
+
observationMode: "none" | "input" = "none",
|
|
879
|
+
): Promise<BrowserActionReceipt> =>
|
|
880
|
+
await dispatchAction(action, operationId, frame, observationMode),
|
|
463
881
|
[dispatchAction],
|
|
464
882
|
);
|
|
465
883
|
|
|
884
|
+
const observeForInput = useCallback(async (): Promise<BrowserObservation> => {
|
|
885
|
+
const target = selectedTargetRef.current;
|
|
886
|
+
if (!enabled || !isCurrentSource()) {
|
|
887
|
+
throw new Error(t("hooks.useBrowserSession.theBrowserSourceIsNo"));
|
|
888
|
+
}
|
|
889
|
+
if (!browserSessionId || !target)
|
|
890
|
+
throw new Error(t("hooks.useBrowserSession.noBrowserTabIsSelected"));
|
|
891
|
+
const observation = await client.observeBrowserTarget(workspaceId, browserSessionId, target.id);
|
|
892
|
+
if (
|
|
893
|
+
!isCurrentSource() ||
|
|
894
|
+
observation.browserSessionId !== browserSessionId ||
|
|
895
|
+
!sameObservationTarget(observation, selectedTargetRef.current)
|
|
896
|
+
) {
|
|
897
|
+
throw new Error(t("hooks.useBrowserSession.theBrowserPageChangedOpen"));
|
|
898
|
+
}
|
|
899
|
+
return observation;
|
|
900
|
+
}, [browserSessionId, client, enabled, isCurrentSource, workspaceId, t]);
|
|
901
|
+
|
|
902
|
+
const actFromObservation = useCallback(
|
|
903
|
+
async (action: BrowserAction, observation: BrowserObservation) => {
|
|
904
|
+
if (!sameObservationTarget(observation, selectedTargetRef.current)) {
|
|
905
|
+
throw new Error(t("hooks.useBrowserSession.theBrowserPageChangedOpen"));
|
|
906
|
+
}
|
|
907
|
+
return await dispatchAction(action, crypto.randomUUID(), {
|
|
908
|
+
browserSessionId: observation.browserSessionId,
|
|
909
|
+
controllerGeneration: observation.target.controllerGeneration,
|
|
910
|
+
targetId: observation.target.id,
|
|
911
|
+
targetGeneration: observation.target.targetGeneration,
|
|
912
|
+
documentGeneration: observation.target.documentGeneration,
|
|
913
|
+
frameId: observation.frameId,
|
|
914
|
+
});
|
|
915
|
+
},
|
|
916
|
+
[dispatchAction, t],
|
|
917
|
+
);
|
|
918
|
+
|
|
466
919
|
const diagnostics = useCallback(
|
|
467
920
|
async (diagnosticOptions: BrowserDiagnosticsOptions = {}): Promise<BrowserDiagnosticBatch> => {
|
|
921
|
+
if (!enabled || !isCurrentSource()) {
|
|
922
|
+
throw new Error(t("hooks.useBrowserSession.theBrowserSourceIsNo"));
|
|
923
|
+
}
|
|
468
924
|
const targetId = selectedTargetIdRef.current;
|
|
469
925
|
if (!browserSessionId || !targetId) {
|
|
470
|
-
throw new Error("
|
|
926
|
+
throw new Error(t("hooks.useBrowserSession.noBrowserTabIsSelected"));
|
|
471
927
|
}
|
|
472
928
|
return await client.listBrowserDiagnostics(
|
|
473
929
|
workspaceId,
|
|
@@ -476,17 +932,20 @@ export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowser
|
|
|
476
932
|
diagnosticOptions,
|
|
477
933
|
);
|
|
478
934
|
},
|
|
479
|
-
[browserSessionId, client, workspaceId],
|
|
935
|
+
[browserSessionId, client, enabled, isCurrentSource, workspaceId, t],
|
|
480
936
|
);
|
|
481
937
|
|
|
482
938
|
const readClipboard = useCallback(async (): Promise<BrowserClipboard> => {
|
|
939
|
+
if (!enabled || !isCurrentSource()) {
|
|
940
|
+
throw new Error(t("hooks.useBrowserSession.theBrowserSourceIsNo"));
|
|
941
|
+
}
|
|
483
942
|
if (!browserSessionId) throw new Error("No BrowserSession is selected.");
|
|
484
943
|
const clipboard = await client.readBrowserClipboard(workspaceId, browserSessionId);
|
|
485
|
-
if (clipboard.browserSessionId !== browserSessionId) {
|
|
944
|
+
if (!isCurrentSource() || clipboard.browserSessionId !== browserSessionId) {
|
|
486
945
|
throw new Error("Browser clipboard belongs to another BrowserSession.");
|
|
487
946
|
}
|
|
488
947
|
return clipboard;
|
|
489
|
-
}, [browserSessionId, client, workspaceId]);
|
|
948
|
+
}, [browserSessionId, client, enabled, isCurrentSource, workspaceId, t]);
|
|
490
949
|
|
|
491
950
|
return {
|
|
492
951
|
session: visible.session,
|
|
@@ -497,7 +956,10 @@ export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowser
|
|
|
497
956
|
loading: visible.loading,
|
|
498
957
|
mutating: visible.mutating,
|
|
499
958
|
error: visible.error,
|
|
959
|
+
inputFailure: visible.inputFailure,
|
|
500
960
|
refresh,
|
|
961
|
+
observeForInput,
|
|
962
|
+
actFromObservation,
|
|
501
963
|
selectTarget,
|
|
502
964
|
openTarget,
|
|
503
965
|
closeTarget,
|
|
@@ -518,6 +980,8 @@ function emptyState(browserSessionId: string | null, loading: boolean) {
|
|
|
518
980
|
loading,
|
|
519
981
|
mutating: false,
|
|
520
982
|
error: null as Error | null,
|
|
983
|
+
inputFailure: null as BrowserInputFailure | null,
|
|
984
|
+
actionResultOrder: 0,
|
|
521
985
|
};
|
|
522
986
|
}
|
|
523
987
|
|
|
@@ -540,6 +1004,20 @@ function replaceTarget(targets: readonly BrowserTarget[], target: BrowserTarget)
|
|
|
540
1004
|
return next.sort((left, right) => left.createdAt.localeCompare(right.createdAt));
|
|
541
1005
|
}
|
|
542
1006
|
|
|
1007
|
+
function sameObservationTarget(
|
|
1008
|
+
observation: BrowserObservation,
|
|
1009
|
+
target: BrowserTarget | null,
|
|
1010
|
+
): boolean {
|
|
1011
|
+
return (
|
|
1012
|
+
target !== null &&
|
|
1013
|
+
observation.browserSessionId === target.browserSessionId &&
|
|
1014
|
+
observation.target.id === target.id &&
|
|
1015
|
+
observation.target.controllerGeneration === target.controllerGeneration &&
|
|
1016
|
+
observation.target.targetGeneration === target.targetGeneration &&
|
|
1017
|
+
observation.target.documentGeneration === target.documentGeneration
|
|
1018
|
+
);
|
|
1019
|
+
}
|
|
1020
|
+
|
|
543
1021
|
function isMissingBrowserTarget(error: unknown): boolean {
|
|
544
1022
|
return error instanceof OpenGeniApiError && error.code === "target_not_found";
|
|
545
1023
|
}
|