@opengeni/react 4.0.2 → 4.0.5-canary.39120434730001
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-FVROZ7HR.js +14396 -0
- package/dist/chunk-FVROZ7HR.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-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 +1019 -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
|
@@ -1,41 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import {
|
|
2
3
|
InteractionInterventionBanner,
|
|
4
|
+
isInteractionControlUnavailable,
|
|
3
5
|
isNonRetryableInteractionError,
|
|
4
6
|
isSourcePlacementChangedError,
|
|
5
7
|
useInteractionInterventions,
|
|
6
|
-
useInteractionInvalidation
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
STREAM_CLOSE_REASON_NORMAL,
|
|
10
|
-
STREAM_KIND_BROWSER,
|
|
11
|
-
STREAM_ROLE_CLIENT,
|
|
12
|
-
decodeStreamFrame,
|
|
13
|
-
decodeStreamOpenAck,
|
|
14
|
-
encodeStreamClose,
|
|
15
|
-
encodeStreamOpen,
|
|
16
|
-
interactionHostPlatform
|
|
17
|
-
} from "./chunk-5YK2ZDIG.js";
|
|
8
|
+
useInteractionInvalidation,
|
|
9
|
+
useViewerMenuDismiss
|
|
10
|
+
} from "./chunk-JAYYFOOB.js";
|
|
18
11
|
import {
|
|
19
12
|
copyTextToClipboard
|
|
20
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-PEHTX3V7.js";
|
|
21
14
|
import {
|
|
22
|
-
|
|
23
|
-
} from "./chunk-
|
|
15
|
+
interactionHostPlatform
|
|
16
|
+
} from "./chunk-ZUWF4NF7.js";
|
|
24
17
|
import {
|
|
25
18
|
usePageLiveActivity
|
|
26
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-NAWXARTY.js";
|
|
27
20
|
import {
|
|
28
21
|
useEmbeddedBrowserInteraction
|
|
29
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-ZGFU4LVW.js";
|
|
23
|
+
import {
|
|
24
|
+
formatBytes
|
|
25
|
+
} from "./chunk-AIX25FIQ.js";
|
|
26
|
+
import {
|
|
27
|
+
STREAM_CLOSE_REASON_NORMAL,
|
|
28
|
+
STREAM_KIND_BROWSER,
|
|
29
|
+
STREAM_ROLE_CLIENT,
|
|
30
|
+
decodeStreamFrame,
|
|
31
|
+
decodeStreamOpenAck,
|
|
32
|
+
encodeStreamClose,
|
|
33
|
+
encodeStreamOpen
|
|
34
|
+
} from "./chunk-TNEZNMSN.js";
|
|
30
35
|
import {
|
|
31
36
|
cn
|
|
32
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-TXS65BB2.js";
|
|
38
|
+
import {
|
|
39
|
+
useOpenGeniText
|
|
40
|
+
} from "./chunk-VU4QUISJ.js";
|
|
33
41
|
|
|
34
42
|
// src/components/browser-viewer.tsx
|
|
35
43
|
import { interactionControlFailureFromError } from "@opengeni/sdk/interaction";
|
|
36
44
|
import {
|
|
37
45
|
BugIcon,
|
|
38
46
|
ArchiveIcon,
|
|
47
|
+
ArrowLeftIcon,
|
|
48
|
+
ArrowRightIcon,
|
|
39
49
|
CheckIcon,
|
|
40
50
|
ChevronDownIcon,
|
|
41
51
|
CircleAlertIcon,
|
|
@@ -54,11 +64,12 @@ import {
|
|
|
54
64
|
} from "lucide-react";
|
|
55
65
|
import {
|
|
56
66
|
useCallback as useCallback8,
|
|
57
|
-
useEffect as
|
|
67
|
+
useEffect as useEffect9,
|
|
58
68
|
useId,
|
|
69
|
+
useLayoutEffect as useLayoutEffect2,
|
|
59
70
|
useMemo as useMemo2,
|
|
60
|
-
useRef as
|
|
61
|
-
useState as
|
|
71
|
+
useRef as useRef9,
|
|
72
|
+
useState as useState9
|
|
62
73
|
} from "react";
|
|
63
74
|
|
|
64
75
|
// src/hooks/use-browser-frame-stream.ts
|
|
@@ -73,8 +84,10 @@ var RELAY_TAG_FRAME = 3;
|
|
|
73
84
|
var RELAY_TAG_CLOSE = 4;
|
|
74
85
|
var MAX_AUTOMATIC_RECONNECTS_WITHOUT_A_FRAME = 2;
|
|
75
86
|
function useBrowserFrameStream(options) {
|
|
87
|
+
const t = useOpenGeniText();
|
|
76
88
|
const { client, workspaceId } = useEmbeddedBrowserInteraction(options);
|
|
77
|
-
const
|
|
89
|
+
const pageLive = usePageLiveActivity();
|
|
90
|
+
const enabled = (options.enabled ?? true) && pageLive;
|
|
78
91
|
const [nonce, setNonce] = useState(0);
|
|
79
92
|
const [result, setResult] = useState({
|
|
80
93
|
state: "idle",
|
|
@@ -271,7 +284,7 @@ function useBrowserFrameStream(options) {
|
|
|
271
284
|
};
|
|
272
285
|
const onError = (source) => {
|
|
273
286
|
if (source !== socket) return;
|
|
274
|
-
fail(new Error("
|
|
287
|
+
fail(new Error(t("hooks.useBrowserFrameStream.browserViewLostConnection")));
|
|
275
288
|
};
|
|
276
289
|
const onClose = (source) => {
|
|
277
290
|
if (disposed || source !== socket) return;
|
|
@@ -296,6 +309,7 @@ function useBrowserFrameStream(options) {
|
|
|
296
309
|
activeStream.kind === "relay" ? activeStream.url : browserFrameSocketUrl(activeAttachment, streamRef.current),
|
|
297
310
|
activeStream.kind === "direct_websocket" ? [...activeStream.protocols] : []
|
|
298
311
|
);
|
|
312
|
+
latestRef.current = { key: "", sequence: -1 };
|
|
299
313
|
socket = openedSocket;
|
|
300
314
|
socketHandlers = {
|
|
301
315
|
open: () => onOpen(openedSocket),
|
|
@@ -346,7 +360,9 @@ function useBrowserFrameStream(options) {
|
|
|
346
360
|
browserSessionId: attachment.browserSessionId,
|
|
347
361
|
controllerGeneration: attachment.controllerGeneration,
|
|
348
362
|
targetId: attachment.targetId,
|
|
349
|
-
expiresAt: attachment.expiresAt
|
|
363
|
+
expiresAt: attachment.expiresAt,
|
|
364
|
+
...attachment.fencedInputBatches === true ? { fencedInputBatches: true } : {},
|
|
365
|
+
...attachment.focusedInputObservations === true ? { focusedInputObservations: true } : {}
|
|
350
366
|
},
|
|
351
367
|
error: null
|
|
352
368
|
}));
|
|
@@ -373,7 +389,7 @@ function useBrowserFrameStream(options) {
|
|
|
373
389
|
if (expiryTimer) clearTimeout(expiryTimer);
|
|
374
390
|
clearSocket(true);
|
|
375
391
|
};
|
|
376
|
-
}, [client, enabled, nonce, options.browserSessionId, options.targetId, workspaceId]);
|
|
392
|
+
}, [client, enabled, nonce, options.browserSessionId, options.targetId, workspaceId, t]);
|
|
377
393
|
return { ...result, reconnect };
|
|
378
394
|
}
|
|
379
395
|
function relayDatagram(tag, body) {
|
|
@@ -852,17 +868,39 @@ function asError(cause) {
|
|
|
852
868
|
import { OpenGeniApiError } from "@opengeni/sdk";
|
|
853
869
|
import { useCallback as useCallback5, useEffect as useEffect5, useRef as useRef5, useState as useState5 } from "react";
|
|
854
870
|
function useBrowserSession(options) {
|
|
871
|
+
const t = useOpenGeniText();
|
|
855
872
|
const { client, workspaceId } = useEmbeddedBrowserInteraction(options);
|
|
856
873
|
const browserSessionId = options.browserSessionId;
|
|
857
874
|
const enabled = (options.enabled ?? true) && browserSessionId !== null;
|
|
875
|
+
const sourceRef = useRef5({ client, workspaceId, browserSessionId, enabled });
|
|
876
|
+
if (sourceRef.current.client !== client || sourceRef.current.workspaceId !== workspaceId || sourceRef.current.browserSessionId !== browserSessionId || sourceRef.current.enabled !== enabled) {
|
|
877
|
+
sourceRef.current = { client, workspaceId, browserSessionId, enabled };
|
|
878
|
+
}
|
|
879
|
+
const source = sourceRef.current;
|
|
880
|
+
const semanticObservationEnabled = options.semanticObservationEnabled ?? true;
|
|
881
|
+
const semanticObservationEnabledRef = useRef5(semanticObservationEnabled);
|
|
882
|
+
semanticObservationEnabledRef.current = semanticObservationEnabled;
|
|
883
|
+
const previousSemanticObservationRef = useRef5({
|
|
884
|
+
browserSessionId,
|
|
885
|
+
enabled: semanticObservationEnabled
|
|
886
|
+
});
|
|
858
887
|
const pageLive = usePageLiveActivity();
|
|
859
888
|
const pollIntervalMs = Math.max(750, options.pollIntervalMs ?? 2e3);
|
|
860
|
-
const [state, setState] = useState5(() => emptyState4(browserSessionId, enabled));
|
|
861
|
-
const visible = state.browserSessionId === browserSessionId ? state : emptyState4(browserSessionId, enabled);
|
|
889
|
+
const [state, setState] = useState5(() => ({ ...emptyState4(browserSessionId, enabled), source }));
|
|
890
|
+
const visible = state.source === source && state.browserSessionId === browserSessionId ? state : { ...emptyState4(browserSessionId, enabled), source };
|
|
862
891
|
const refreshBlocked = isNonRetryableInteractionError(visible.error);
|
|
892
|
+
const inputFailureRef = useRef5(visible.inputFailure);
|
|
893
|
+
inputFailureRef.current = visible.inputFailure;
|
|
863
894
|
const selectedTargetIdRef = useRef5(visible.selectedTargetId);
|
|
864
895
|
selectedTargetIdRef.current = visible.selectedTargetId;
|
|
896
|
+
const selectionRevisionRef = useRef5(0);
|
|
897
|
+
const actionResultOrderRef = useRef5({ next: 0, settled: 0 });
|
|
898
|
+
const selectedTargetRef = useRef5(
|
|
899
|
+
visible.targets.find((target) => target.id === visible.selectedTargetId) ?? null
|
|
900
|
+
);
|
|
901
|
+
selectedTargetRef.current = visible.targets.find((target) => target.id === visible.selectedTargetId) ?? null;
|
|
865
902
|
const observationRef = useRef5({ browserSessionId, observation: visible.observation });
|
|
903
|
+
const lastObservationAtRef = useRef5(0);
|
|
866
904
|
if (observationRef.current.browserSessionId !== browserSessionId) {
|
|
867
905
|
observationRef.current = {
|
|
868
906
|
browserSessionId,
|
|
@@ -877,106 +915,189 @@ function useBrowserSession(options) {
|
|
|
877
915
|
});
|
|
878
916
|
const mutationRef = useRef5({
|
|
879
917
|
browserSessionId,
|
|
880
|
-
|
|
918
|
+
source,
|
|
919
|
+
count: 0,
|
|
920
|
+
needsInventoryReconcile: false
|
|
881
921
|
});
|
|
882
922
|
const mountedRef = useRef5(true);
|
|
923
|
+
const isCurrentSource = useCallback5(
|
|
924
|
+
() => mountedRef.current && sourceRef.current === source,
|
|
925
|
+
[source]
|
|
926
|
+
);
|
|
883
927
|
const invalidateRefresh = useCallback5(() => {
|
|
884
928
|
const id = requestRef.current.id + 1;
|
|
885
929
|
requestRef.current.controller?.abort();
|
|
886
930
|
requestRef.current = { id, controller: null };
|
|
887
931
|
}, []);
|
|
888
|
-
const
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
client.getBrowserSession(workspaceId, browserSessionId, {
|
|
897
|
-
signal: controller.signal
|
|
898
|
-
}),
|
|
899
|
-
client.listBrowserTargets(workspaceId, browserSessionId, {
|
|
900
|
-
signal: controller.signal
|
|
901
|
-
})
|
|
902
|
-
]);
|
|
903
|
-
if (!mountedRef.current || requestRef.current.id !== id) return;
|
|
904
|
-
const selected = chooseTarget(targetResponse.targets, selectedTargetIdRef.current);
|
|
905
|
-
selectedTargetIdRef.current = selected?.id ?? null;
|
|
906
|
-
observationRef.current = { browserSessionId, observation: null };
|
|
907
|
-
setState(
|
|
908
|
-
(current) => current.browserSessionId === browserSessionId ? {
|
|
909
|
-
...current,
|
|
910
|
-
session,
|
|
911
|
-
targets: targetResponse.targets,
|
|
912
|
-
selectedTargetId: selected?.id ?? null,
|
|
913
|
-
observation: null,
|
|
914
|
-
loading: false,
|
|
915
|
-
error: null
|
|
916
|
-
} : current
|
|
917
|
-
);
|
|
918
|
-
if (!selected) return;
|
|
932
|
+
const refreshInventory = useCallback5(
|
|
933
|
+
async (checkInput = false, observeSelectedTarget = true) => {
|
|
934
|
+
if (!enabled || !browserSessionId || !isCurrentSource()) return;
|
|
935
|
+
const checkedInputFailure = inputFailureRef.current;
|
|
936
|
+
const id = requestRef.current.id + 1;
|
|
937
|
+
requestRef.current.controller?.abort();
|
|
938
|
+
const controller = new AbortController();
|
|
939
|
+
requestRef.current = { id, controller };
|
|
919
940
|
try {
|
|
920
|
-
const
|
|
921
|
-
workspaceId,
|
|
941
|
+
const [session, targetResponse] = await Promise.all([
|
|
942
|
+
client.getBrowserSession(workspaceId, browserSessionId, {
|
|
943
|
+
signal: controller.signal
|
|
944
|
+
}),
|
|
945
|
+
client.listBrowserTargets(workspaceId, browserSessionId, {
|
|
946
|
+
signal: controller.signal
|
|
947
|
+
})
|
|
948
|
+
]);
|
|
949
|
+
if (!isCurrentSource() || requestRef.current.id !== id) return;
|
|
950
|
+
const selected = chooseTarget(targetResponse.targets, selectedTargetIdRef.current);
|
|
951
|
+
selectedTargetIdRef.current = selected?.id ?? null;
|
|
952
|
+
selectedTargetRef.current = selected;
|
|
953
|
+
const previousObservation = observationRef.current.browserSessionId === browserSessionId ? observationRef.current.observation : null;
|
|
954
|
+
const retainedObservation = selected && previousObservation && sameObservationTarget(previousObservation, selected) ? previousObservation : null;
|
|
955
|
+
observationRef.current = {
|
|
922
956
|
browserSessionId,
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
);
|
|
926
|
-
if (!mountedRef.current || requestRef.current.id !== id) return;
|
|
927
|
-
observationRef.current = { browserSessionId, observation };
|
|
957
|
+
observation: retainedObservation
|
|
958
|
+
};
|
|
928
959
|
setState(
|
|
929
|
-
(current) => current.
|
|
960
|
+
(current) => isCurrentSource() && current.source === source && current.browserSessionId === browserSessionId ? {
|
|
961
|
+
...current,
|
|
962
|
+
session,
|
|
963
|
+
targets: targetResponse.targets,
|
|
964
|
+
selectedTargetId: selected?.id ?? null,
|
|
965
|
+
observation: retainedObservation,
|
|
966
|
+
loading: false,
|
|
967
|
+
error: null,
|
|
968
|
+
// Media and background polling cannot confirm an input outcome.
|
|
969
|
+
// Only an explicit fresh check clears the notice it began with.
|
|
970
|
+
inputFailure: checkInput && session.id === browserSessionId && targetResponse.browserSessionId === browserSessionId && current.inputFailure === checkedInputFailure ? null : current.inputFailure
|
|
971
|
+
} : current
|
|
930
972
|
);
|
|
973
|
+
if (!selected || !observeSelectedTarget || !semanticObservationEnabledRef.current) return;
|
|
974
|
+
try {
|
|
975
|
+
const observation = await client.observeBrowserTarget(
|
|
976
|
+
workspaceId,
|
|
977
|
+
browserSessionId,
|
|
978
|
+
selected.id,
|
|
979
|
+
{ signal: controller.signal }
|
|
980
|
+
);
|
|
981
|
+
if (!isCurrentSource() || requestRef.current.id !== id) return;
|
|
982
|
+
const currentSelected = selectedTargetRef.current;
|
|
983
|
+
if (observationRef.current.browserSessionId !== browserSessionId || currentSelected?.id !== selected.id || observation.browserSessionId !== browserSessionId || observation.target.id !== selected.id || observation.target.controllerGeneration !== currentSelected.controllerGeneration || observation.target.targetGeneration !== currentSelected.targetGeneration)
|
|
984
|
+
return;
|
|
985
|
+
selectedTargetRef.current = observation.target;
|
|
986
|
+
observationRef.current = { browserSessionId, observation };
|
|
987
|
+
lastObservationAtRef.current = Date.now();
|
|
988
|
+
setState(
|
|
989
|
+
(current) => isCurrentSource() && current.source === source && current.browserSessionId === browserSessionId && current.selectedTargetId === observation.target.id ? {
|
|
990
|
+
...current,
|
|
991
|
+
observation,
|
|
992
|
+
targets: replaceTarget(current.targets, observation.target)
|
|
993
|
+
} : current
|
|
994
|
+
);
|
|
995
|
+
} catch (cause) {
|
|
996
|
+
if (controller.signal.aborted || !isCurrentSource() || requestRef.current.id !== id)
|
|
997
|
+
return;
|
|
998
|
+
void cause;
|
|
999
|
+
}
|
|
931
1000
|
} catch (cause) {
|
|
932
|
-
if (controller.signal.aborted || !
|
|
933
|
-
|
|
934
|
-
|
|
1001
|
+
if (controller.signal.aborted || !isCurrentSource() || requestRef.current.id !== id) return;
|
|
1002
|
+
setState(
|
|
1003
|
+
(current) => isCurrentSource() && current.source === source && current.browserSessionId === browserSessionId ? {
|
|
1004
|
+
...current,
|
|
1005
|
+
loading: false,
|
|
1006
|
+
error: cause instanceof Error ? cause : new Error(String(cause))
|
|
1007
|
+
} : current
|
|
1008
|
+
);
|
|
1009
|
+
} finally {
|
|
1010
|
+
if (requestRef.current.id === id) {
|
|
1011
|
+
requestRef.current = { id, controller: null };
|
|
1012
|
+
}
|
|
935
1013
|
}
|
|
936
|
-
}
|
|
937
|
-
|
|
1014
|
+
},
|
|
1015
|
+
[browserSessionId, client, enabled, isCurrentSource, source, workspaceId]
|
|
1016
|
+
);
|
|
1017
|
+
const refresh = useCallback5(async () => await refreshInventory(true), [refreshInventory]);
|
|
1018
|
+
const refreshSemantic = useCallback5(async () => {
|
|
1019
|
+
if (!enabled || !browserSessionId || !isCurrentSource()) return;
|
|
1020
|
+
const target = selectedTargetRef.current;
|
|
1021
|
+
if (!target) return;
|
|
1022
|
+
const id = requestRef.current.id + 1;
|
|
1023
|
+
requestRef.current.controller?.abort();
|
|
1024
|
+
const controller = new AbortController();
|
|
1025
|
+
requestRef.current = { id, controller };
|
|
1026
|
+
try {
|
|
1027
|
+
const observation = await client.observeBrowserTarget(
|
|
1028
|
+
workspaceId,
|
|
1029
|
+
browserSessionId,
|
|
1030
|
+
target.id,
|
|
1031
|
+
{ signal: controller.signal }
|
|
1032
|
+
);
|
|
1033
|
+
if (!isCurrentSource() || requestRef.current.id !== id) return;
|
|
1034
|
+
if (!sameObservationTarget(observation, selectedTargetRef.current)) return;
|
|
1035
|
+
observationRef.current = { browserSessionId, observation };
|
|
1036
|
+
lastObservationAtRef.current = Date.now();
|
|
938
1037
|
setState(
|
|
939
|
-
(current) => current.browserSessionId === browserSessionId ? {
|
|
940
|
-
...current,
|
|
941
|
-
loading: false,
|
|
942
|
-
error: cause instanceof Error ? cause : new Error(String(cause))
|
|
943
|
-
} : current
|
|
1038
|
+
(current) => isCurrentSource() && current.source === source && current.browserSessionId === browserSessionId && current.selectedTargetId === target.id ? { ...current, observation } : current
|
|
944
1039
|
);
|
|
1040
|
+
} catch {
|
|
945
1041
|
} finally {
|
|
946
|
-
if (requestRef.current.id === id) {
|
|
947
|
-
requestRef.current = { id, controller: null };
|
|
948
|
-
}
|
|
1042
|
+
if (requestRef.current.id === id) requestRef.current = { id, controller: null };
|
|
949
1043
|
}
|
|
950
|
-
}, [browserSessionId, client, enabled, workspaceId]);
|
|
1044
|
+
}, [browserSessionId, client, enabled, isCurrentSource, source, workspaceId]);
|
|
951
1045
|
useEffect5(() => {
|
|
952
1046
|
mountedRef.current = true;
|
|
953
1047
|
if (!enabled) {
|
|
954
1048
|
invalidateRefresh();
|
|
955
|
-
setState(emptyState4(browserSessionId, false));
|
|
1049
|
+
setState({ ...emptyState4(browserSessionId, false), source });
|
|
956
1050
|
return;
|
|
957
1051
|
}
|
|
958
1052
|
setState(
|
|
959
|
-
(current) => current.browserSessionId === browserSessionId ? { ...current, loading: true } : emptyState4(browserSessionId, true)
|
|
1053
|
+
(current) => isCurrentSource() && current.source === source && current.browserSessionId === browserSessionId ? { ...current, loading: true } : { ...emptyState4(browserSessionId, true), source }
|
|
960
1054
|
);
|
|
961
|
-
void
|
|
1055
|
+
void refreshInventory();
|
|
962
1056
|
return () => {
|
|
963
1057
|
mountedRef.current = false;
|
|
964
1058
|
invalidateRefresh();
|
|
965
1059
|
};
|
|
966
|
-
}, [browserSessionId, enabled, invalidateRefresh,
|
|
1060
|
+
}, [browserSessionId, enabled, invalidateRefresh, isCurrentSource, refreshInventory, source]);
|
|
1061
|
+
useEffect5(() => {
|
|
1062
|
+
const previous = previousSemanticObservationRef.current;
|
|
1063
|
+
previousSemanticObservationRef.current = {
|
|
1064
|
+
browserSessionId,
|
|
1065
|
+
enabled: semanticObservationEnabled
|
|
1066
|
+
};
|
|
1067
|
+
if (enabled && semanticObservationEnabled && previous.browserSessionId === browserSessionId && !previous.enabled) {
|
|
1068
|
+
const currentObservation = observationRef.current.observation;
|
|
1069
|
+
if (currentObservation && sameObservationTarget(currentObservation, selectedTargetRef.current) && Date.now() - lastObservationAtRef.current < pollIntervalMs) {
|
|
1070
|
+
return;
|
|
1071
|
+
}
|
|
1072
|
+
observationRef.current = { browserSessionId, observation: null };
|
|
1073
|
+
setState(
|
|
1074
|
+
(current) => isCurrentSource() && current.source === source && current.browserSessionId === browserSessionId ? { ...current, observation: null } : current
|
|
1075
|
+
);
|
|
1076
|
+
void refreshSemantic();
|
|
1077
|
+
}
|
|
1078
|
+
}, [
|
|
1079
|
+
browserSessionId,
|
|
1080
|
+
enabled,
|
|
1081
|
+
isCurrentSource,
|
|
1082
|
+
pollIntervalMs,
|
|
1083
|
+
refreshSemantic,
|
|
1084
|
+
semanticObservationEnabled,
|
|
1085
|
+
source
|
|
1086
|
+
]);
|
|
967
1087
|
useEffect5(() => {
|
|
968
1088
|
if (!enabled || !pageLive || visible.mutating || refreshBlocked) return;
|
|
969
1089
|
const timer = setInterval(() => {
|
|
970
|
-
if (!requestRef.current.controller) void
|
|
1090
|
+
if (!requestRef.current.controller) void refreshInventory();
|
|
971
1091
|
}, pollIntervalMs);
|
|
972
1092
|
return () => clearInterval(timer);
|
|
973
|
-
}, [enabled, pageLive, pollIntervalMs,
|
|
1093
|
+
}, [enabled, pageLive, pollIntervalMs, refreshInventory, refreshBlocked, visible.mutating]);
|
|
974
1094
|
useEffect5(() => {
|
|
975
1095
|
if (!enabled || !browserSessionId || !pageLive || refreshBlocked) return;
|
|
976
1096
|
let disposed = false;
|
|
977
1097
|
const heartbeat = () => {
|
|
1098
|
+
if (!isCurrentSource()) return;
|
|
978
1099
|
void client.heartbeatBrowserSession(workspaceId, browserSessionId).catch(() => {
|
|
979
|
-
if (!disposed) void
|
|
1100
|
+
if (!disposed) void refreshInventory();
|
|
980
1101
|
});
|
|
981
1102
|
};
|
|
982
1103
|
const timer = setInterval(heartbeat, 3e4);
|
|
@@ -984,148 +1105,216 @@ function useBrowserSession(options) {
|
|
|
984
1105
|
disposed = true;
|
|
985
1106
|
clearInterval(timer);
|
|
986
1107
|
};
|
|
987
|
-
}, [
|
|
1108
|
+
}, [
|
|
1109
|
+
browserSessionId,
|
|
1110
|
+
client,
|
|
1111
|
+
enabled,
|
|
1112
|
+
isCurrentSource,
|
|
1113
|
+
pageLive,
|
|
1114
|
+
refreshInventory,
|
|
1115
|
+
refreshBlocked,
|
|
1116
|
+
workspaceId
|
|
1117
|
+
]);
|
|
988
1118
|
const runMutation = useCallback5(
|
|
989
|
-
async (scopeBrowserSessionId, operation) => {
|
|
1119
|
+
async (scopeBrowserSessionId, operation, selectionRead = false, changesInventory = false) => {
|
|
1120
|
+
if (!enabled || !isCurrentSource()) {
|
|
1121
|
+
throw new Error(t("hooks.useBrowserSession.theBrowserSourceIsNo"));
|
|
1122
|
+
}
|
|
1123
|
+
const selectionRevision = ++selectionRevisionRef.current;
|
|
990
1124
|
invalidateRefresh();
|
|
991
|
-
|
|
1125
|
+
const readRequestId = requestRef.current.id;
|
|
1126
|
+
if (mutationRef.current.browserSessionId !== scopeBrowserSessionId || mutationRef.current.source !== source) {
|
|
992
1127
|
mutationRef.current = {
|
|
993
1128
|
browserSessionId: scopeBrowserSessionId,
|
|
994
|
-
|
|
1129
|
+
source,
|
|
1130
|
+
count: 0,
|
|
1131
|
+
needsInventoryReconcile: false
|
|
995
1132
|
};
|
|
996
1133
|
}
|
|
997
1134
|
mutationRef.current.count += 1;
|
|
998
1135
|
setState(
|
|
999
|
-
(current) => current.browserSessionId === scopeBrowserSessionId ? { ...current, mutating: true, error: null } : current
|
|
1136
|
+
(current) => isCurrentSource() && current.source === source && current.browserSessionId === scopeBrowserSessionId ? { ...current, mutating: true, error: null } : current
|
|
1000
1137
|
);
|
|
1001
1138
|
try {
|
|
1002
|
-
return await operation();
|
|
1139
|
+
return await operation(selectionRevision, readRequestId);
|
|
1003
1140
|
} catch (cause) {
|
|
1004
1141
|
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
1005
|
-
|
|
1006
|
-
(
|
|
1007
|
-
|
|
1142
|
+
if (!selectionRead || requestRef.current.id === readRequestId) {
|
|
1143
|
+
setState(
|
|
1144
|
+
(current) => isCurrentSource() && selectionRevisionRef.current === selectionRevision && current.source === source && current.browserSessionId === scopeBrowserSessionId ? { ...current, error } : current
|
|
1145
|
+
);
|
|
1146
|
+
}
|
|
1008
1147
|
throw error;
|
|
1009
1148
|
} finally {
|
|
1010
|
-
if (mutationRef.current.browserSessionId === scopeBrowserSessionId) {
|
|
1149
|
+
if (mutationRef.current.browserSessionId === scopeBrowserSessionId && mutationRef.current.source === source) {
|
|
1150
|
+
if (changesInventory && (selectionRevisionRef.current !== selectionRevision || requestRef.current.id !== readRequestId)) {
|
|
1151
|
+
mutationRef.current.needsInventoryReconcile = true;
|
|
1152
|
+
}
|
|
1011
1153
|
mutationRef.current.count = Math.max(0, mutationRef.current.count - 1);
|
|
1012
1154
|
const mutating = mutationRef.current.count > 0;
|
|
1013
1155
|
setState(
|
|
1014
|
-
(current) => current.browserSessionId === scopeBrowserSessionId ? { ...current, mutating } : current
|
|
1156
|
+
(current) => isCurrentSource() && current.source === source && current.browserSessionId === scopeBrowserSessionId ? { ...current, mutating } : current
|
|
1015
1157
|
);
|
|
1158
|
+
if (!mutating && mutationRef.current.needsInventoryReconcile && isCurrentSource()) {
|
|
1159
|
+
mutationRef.current.needsInventoryReconcile = false;
|
|
1160
|
+
void refreshInventory(false, false);
|
|
1161
|
+
}
|
|
1016
1162
|
}
|
|
1017
1163
|
}
|
|
1018
1164
|
},
|
|
1019
|
-
[invalidateRefresh]
|
|
1165
|
+
[enabled, invalidateRefresh, isCurrentSource, refreshInventory, source, t]
|
|
1020
1166
|
);
|
|
1021
1167
|
const selectTarget = useCallback5(
|
|
1022
1168
|
async (targetId) => {
|
|
1023
1169
|
if (!browserSessionId) throw new Error("No BrowserSession is selected.");
|
|
1024
|
-
return await runMutation(
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1170
|
+
return await runMutation(
|
|
1171
|
+
browserSessionId,
|
|
1172
|
+
async (selectionRevision, readRequestId) => {
|
|
1173
|
+
const isCurrentSelection = () => isCurrentSource() && selectionRevisionRef.current === selectionRevision;
|
|
1174
|
+
const isCurrentSelectionRead = () => isCurrentSelection() && requestRef.current.id === readRequestId;
|
|
1175
|
+
let targets = visible.targets;
|
|
1176
|
+
let target;
|
|
1177
|
+
let observation;
|
|
1178
|
+
try {
|
|
1179
|
+
observation = await client.selectBrowserTarget(workspaceId, browserSessionId, targetId);
|
|
1180
|
+
target = observation.target;
|
|
1181
|
+
} catch (cause) {
|
|
1182
|
+
if (!isCurrentSelectionRead() || !isMissingBrowserTarget(cause)) throw cause;
|
|
1183
|
+
const response = await client.listBrowserTargets(workspaceId, browserSessionId);
|
|
1184
|
+
if (!isCurrentSelectionRead()) throw cause;
|
|
1185
|
+
targets = response.targets;
|
|
1186
|
+
const fallback = chooseTarget(targets, null);
|
|
1187
|
+
if (!fallback) {
|
|
1188
|
+
selectedTargetIdRef.current = null;
|
|
1189
|
+
selectedTargetRef.current = null;
|
|
1190
|
+
observationRef.current = { browserSessionId, observation: null };
|
|
1191
|
+
setState(
|
|
1192
|
+
(current) => isCurrentSelection() && current.source === source && current.browserSessionId === browserSessionId ? {
|
|
1193
|
+
...current,
|
|
1194
|
+
targets,
|
|
1195
|
+
selectedTargetId: null,
|
|
1196
|
+
observation: null
|
|
1197
|
+
} : current
|
|
1198
|
+
);
|
|
1199
|
+
throw cause;
|
|
1200
|
+
}
|
|
1201
|
+
observation = await client.selectBrowserTarget(
|
|
1202
|
+
workspaceId,
|
|
1203
|
+
browserSessionId,
|
|
1204
|
+
fallback.id
|
|
1046
1205
|
);
|
|
1047
|
-
|
|
1206
|
+
target = observation.target;
|
|
1048
1207
|
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1208
|
+
if (!isCurrentSelectionRead()) return target;
|
|
1209
|
+
selectedTargetIdRef.current = target.id;
|
|
1210
|
+
selectedTargetRef.current = target;
|
|
1211
|
+
observationRef.current = { browserSessionId, observation };
|
|
1212
|
+
lastObservationAtRef.current = Date.now();
|
|
1213
|
+
setState(
|
|
1214
|
+
(current) => isCurrentSelection() && current.source === source && current.browserSessionId === browserSessionId ? {
|
|
1215
|
+
...current,
|
|
1216
|
+
targets: replaceTarget(targets, target).map((candidate) => ({
|
|
1217
|
+
...candidate,
|
|
1218
|
+
selected: candidate.id === target.id
|
|
1219
|
+
})),
|
|
1220
|
+
selectedTargetId: target.id,
|
|
1221
|
+
observation
|
|
1222
|
+
} : current
|
|
1053
1223
|
);
|
|
1054
|
-
|
|
1055
|
-
}
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
setState(
|
|
1059
|
-
(current) => current.browserSessionId === browserSessionId ? {
|
|
1060
|
-
...current,
|
|
1061
|
-
targets: targets.map((candidate) => ({
|
|
1062
|
-
...candidate,
|
|
1063
|
-
selected: candidate.id === target.id
|
|
1064
|
-
})),
|
|
1065
|
-
selectedTargetId: target.id,
|
|
1066
|
-
observation
|
|
1067
|
-
} : current
|
|
1068
|
-
);
|
|
1069
|
-
return target;
|
|
1070
|
-
});
|
|
1224
|
+
return target;
|
|
1225
|
+
},
|
|
1226
|
+
true
|
|
1227
|
+
);
|
|
1071
1228
|
},
|
|
1072
|
-
[browserSessionId, client, runMutation, visible.targets, workspaceId]
|
|
1229
|
+
[browserSessionId, client, isCurrentSource, runMutation, source, visible.targets, workspaceId]
|
|
1073
1230
|
);
|
|
1074
1231
|
const openTarget = useCallback5(
|
|
1075
1232
|
async (url) => {
|
|
1076
1233
|
if (!browserSessionId) throw new Error("No BrowserSession is selected.");
|
|
1077
|
-
return await runMutation(
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1234
|
+
return await runMutation(
|
|
1235
|
+
browserSessionId,
|
|
1236
|
+
async (selectionRevision, readRequestId) => {
|
|
1237
|
+
const isCurrentSelection = () => isCurrentSource() && selectionRevisionRef.current === selectionRevision;
|
|
1238
|
+
const isCurrentSelectionRead = () => isCurrentSelection() && requestRef.current.id === readRequestId;
|
|
1239
|
+
const observation = await client.openBrowserTarget(
|
|
1240
|
+
workspaceId,
|
|
1241
|
+
browserSessionId,
|
|
1242
|
+
url === void 0 ? {} : { url }
|
|
1243
|
+
);
|
|
1244
|
+
const target = observation.target;
|
|
1245
|
+
if (!isCurrentSource()) return target;
|
|
1246
|
+
if (!isCurrentSelectionRead()) return target;
|
|
1247
|
+
selectedTargetIdRef.current = target.id;
|
|
1248
|
+
selectedTargetRef.current = target;
|
|
1249
|
+
observationRef.current = { browserSessionId, observation };
|
|
1250
|
+
lastObservationAtRef.current = Date.now();
|
|
1251
|
+
setState(
|
|
1252
|
+
(current) => isCurrentSelection() && current.source === source && current.browserSessionId === browserSessionId ? {
|
|
1253
|
+
...current,
|
|
1254
|
+
targets: [
|
|
1255
|
+
...current.targets.map((candidate) => ({
|
|
1256
|
+
...candidate,
|
|
1257
|
+
selected: false
|
|
1258
|
+
})),
|
|
1259
|
+
target
|
|
1260
|
+
],
|
|
1261
|
+
selectedTargetId: target.id,
|
|
1262
|
+
observation
|
|
1263
|
+
} : current
|
|
1264
|
+
);
|
|
1265
|
+
return target;
|
|
1266
|
+
},
|
|
1267
|
+
false,
|
|
1268
|
+
true
|
|
1269
|
+
);
|
|
1102
1270
|
},
|
|
1103
|
-
[browserSessionId, client, runMutation, workspaceId]
|
|
1271
|
+
[browserSessionId, client, isCurrentSource, runMutation, source, workspaceId]
|
|
1104
1272
|
);
|
|
1105
1273
|
const closeTarget = useCallback5(
|
|
1106
1274
|
async (targetId) => {
|
|
1107
1275
|
if (!browserSessionId) throw new Error("No BrowserSession is selected.");
|
|
1108
|
-
await runMutation(
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
(
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1276
|
+
await runMutation(
|
|
1277
|
+
browserSessionId,
|
|
1278
|
+
async (selectionRevision, readRequestId) => {
|
|
1279
|
+
const isCurrentSelection = () => isCurrentSource() && selectionRevisionRef.current === selectionRevision;
|
|
1280
|
+
const isCurrentSelectionRead = () => isCurrentSelection() && requestRef.current.id === readRequestId;
|
|
1281
|
+
const response = await client.closeBrowserTarget(workspaceId, browserSessionId, targetId);
|
|
1282
|
+
if (!isCurrentSource()) return;
|
|
1283
|
+
if (!isCurrentSelectionRead()) return;
|
|
1284
|
+
const selected = chooseTarget(response.targets, selectedTargetIdRef.current);
|
|
1285
|
+
const observed = selected ? await client.observeBrowserTarget(workspaceId, browserSessionId, selected.id) : null;
|
|
1286
|
+
if (!isCurrentSource()) return;
|
|
1287
|
+
if (!isCurrentSelectionRead()) return;
|
|
1288
|
+
const observation = observed && selected && observed.browserSessionId === browserSessionId && observed.target.id === selected.id && observed.target.controllerGeneration === selected.controllerGeneration && observed.target.targetGeneration === selected.targetGeneration ? observed : null;
|
|
1289
|
+
const currentTarget = observation?.target ?? selected;
|
|
1290
|
+
selectedTargetIdRef.current = currentTarget?.id ?? null;
|
|
1291
|
+
selectedTargetRef.current = currentTarget;
|
|
1292
|
+
observationRef.current = { browserSessionId, observation };
|
|
1293
|
+
if (observation) lastObservationAtRef.current = Date.now();
|
|
1294
|
+
setState(
|
|
1295
|
+
(current) => isCurrentSelection() && current.source === source && current.browserSessionId === browserSessionId ? {
|
|
1296
|
+
...current,
|
|
1297
|
+
targets: currentTarget ? replaceTarget(response.targets, currentTarget) : response.targets,
|
|
1298
|
+
selectedTargetId: currentTarget?.id ?? null,
|
|
1299
|
+
observation
|
|
1300
|
+
} : current
|
|
1301
|
+
);
|
|
1302
|
+
},
|
|
1303
|
+
false,
|
|
1304
|
+
true
|
|
1305
|
+
);
|
|
1123
1306
|
},
|
|
1124
|
-
[browserSessionId, client, runMutation, workspaceId]
|
|
1307
|
+
[browserSessionId, client, isCurrentSource, runMutation, source, workspaceId]
|
|
1125
1308
|
);
|
|
1126
1309
|
const dispatchAction = useCallback5(
|
|
1127
|
-
async (action, operationId, frame) => {
|
|
1310
|
+
async (action, operationId, frame, observationMode = "none") => {
|
|
1128
1311
|
if (!browserSessionId) throw new Error("No BrowserSession is selected.");
|
|
1312
|
+
if (!enabled || !isCurrentSource()) {
|
|
1313
|
+
throw new Error(t("hooks.useBrowserSession.theBrowserSourceIsNo"));
|
|
1314
|
+
}
|
|
1315
|
+
if (!selectedTargetRef.current) {
|
|
1316
|
+
throw new Error("The browser page is not ready for input.");
|
|
1317
|
+
}
|
|
1129
1318
|
if (frame && frame.browserSessionId !== browserSessionId) {
|
|
1130
1319
|
throw new Error("The displayed browser frame belongs to another BrowserSession.");
|
|
1131
1320
|
}
|
|
@@ -1135,7 +1324,7 @@ function useBrowserSession(options) {
|
|
|
1135
1324
|
expectedTargetGeneration: frame.targetGeneration,
|
|
1136
1325
|
expectedDocumentGeneration: frame.documentGeneration,
|
|
1137
1326
|
expectedFrameId: frame.frameId
|
|
1138
|
-
} : currentObservation ? {
|
|
1327
|
+
} : currentObservation && sameObservationTarget(currentObservation, selectedTargetRef.current) ? {
|
|
1139
1328
|
targetId: currentObservation.target.id,
|
|
1140
1329
|
expectedTargetGeneration: currentObservation.target.targetGeneration,
|
|
1141
1330
|
expectedDocumentGeneration: currentObservation.target.documentGeneration,
|
|
@@ -1144,50 +1333,117 @@ function useBrowserSession(options) {
|
|
|
1144
1333
|
if (!fence) {
|
|
1145
1334
|
throw new Error("The browser page is not ready for input.");
|
|
1146
1335
|
}
|
|
1336
|
+
const expectedControllerGeneration = frame?.controllerGeneration ?? currentObservation.target.controllerGeneration;
|
|
1337
|
+
const selectionRevision = selectionRevisionRef.current;
|
|
1338
|
+
const resultOrder = ++actionResultOrderRef.current.next;
|
|
1339
|
+
let resultDocumentGeneration = fence.expectedDocumentGeneration;
|
|
1340
|
+
const isCurrentResultView = () => {
|
|
1341
|
+
const selected = selectedTargetRef.current;
|
|
1342
|
+
return isCurrentSource() && selectionRevisionRef.current === selectionRevision && selected?.browserSessionId === browserSessionId && selected.id === fence.targetId && selected.controllerGeneration === expectedControllerGeneration && selected.targetGeneration === fence.expectedTargetGeneration && (selected.documentGeneration === fence.expectedDocumentGeneration || selected.documentGeneration === resultDocumentGeneration);
|
|
1343
|
+
};
|
|
1344
|
+
const canProjectResult = () => isCurrentResultView() && resultOrder >= actionResultOrderRef.current.settled;
|
|
1345
|
+
const settleResult = () => {
|
|
1346
|
+
if (!canProjectResult()) return false;
|
|
1347
|
+
actionResultOrderRef.current.settled = resultOrder;
|
|
1348
|
+
invalidateRefresh();
|
|
1349
|
+
return true;
|
|
1350
|
+
};
|
|
1147
1351
|
try {
|
|
1148
1352
|
const receipt = await client.actInBrowser(workspaceId, browserSessionId, {
|
|
1149
1353
|
operationId,
|
|
1150
1354
|
...fence,
|
|
1151
|
-
observationMode
|
|
1355
|
+
observationMode,
|
|
1152
1356
|
action
|
|
1153
1357
|
});
|
|
1154
|
-
|
|
1358
|
+
resultDocumentGeneration = receipt.observation?.target.documentGeneration ?? fence.expectedDocumentGeneration;
|
|
1359
|
+
const settled = receipt.state === "completed" || receipt.state === "failed" || receipt.state === "outcome_unknown";
|
|
1360
|
+
if (!canProjectResult() || settled && !settleResult()) return receipt;
|
|
1361
|
+
const receivedObservation = receipt.observation;
|
|
1362
|
+
const selectedTarget = selectedTargetRef.current;
|
|
1363
|
+
let projectedObservation = null;
|
|
1364
|
+
if (settled && receivedObservation && canProjectResult() && receipt.browserSessionId === browserSessionId && receipt.controllerGeneration === expectedControllerGeneration && receipt.targetId === fence.targetId && observationRef.current.browserSessionId === browserSessionId && receivedObservation.browserSessionId === browserSessionId && selectedTarget?.browserSessionId === browserSessionId && selectedTarget.id === fence.targetId && receivedObservation.target.id === fence.targetId && selectedTarget.controllerGeneration === expectedControllerGeneration && receivedObservation.target.controllerGeneration === expectedControllerGeneration && selectedTarget.targetGeneration === fence.expectedTargetGeneration && receivedObservation.target.targetGeneration === fence.expectedTargetGeneration && (selectedTarget.documentGeneration === fence.expectedDocumentGeneration || selectedTarget.documentGeneration === receivedObservation.target.documentGeneration)) {
|
|
1365
|
+
projectedObservation = receivedObservation;
|
|
1155
1366
|
observationRef.current = {
|
|
1156
1367
|
browserSessionId,
|
|
1157
|
-
observation:
|
|
1368
|
+
observation: receivedObservation
|
|
1158
1369
|
};
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
...current,
|
|
1162
|
-
observation: receipt.observation,
|
|
1163
|
-
targets: replaceTarget(current.targets, receipt.observation.target)
|
|
1164
|
-
} : current
|
|
1165
|
-
);
|
|
1370
|
+
selectedTargetRef.current = receivedObservation.target;
|
|
1371
|
+
lastObservationAtRef.current = Date.now();
|
|
1166
1372
|
}
|
|
1373
|
+
setState(
|
|
1374
|
+
(current) => isCurrentResultView() && current.source === source && current.browserSessionId === browserSessionId && current.actionResultOrder <= resultOrder ? {
|
|
1375
|
+
...current,
|
|
1376
|
+
actionResultOrder: settled ? resultOrder : current.actionResultOrder,
|
|
1377
|
+
error: receipt.state === "completed" ? null : current.error,
|
|
1378
|
+
inputFailure: receipt.state === "completed" ? current.inputFailure : {
|
|
1379
|
+
operationId: receipt.operationId,
|
|
1380
|
+
state: receipt.state,
|
|
1381
|
+
error: receipt.error
|
|
1382
|
+
},
|
|
1383
|
+
...projectedObservation ? {
|
|
1384
|
+
observation: projectedObservation,
|
|
1385
|
+
targets: replaceTarget(current.targets, projectedObservation.target)
|
|
1386
|
+
} : {}
|
|
1387
|
+
} : current
|
|
1388
|
+
);
|
|
1167
1389
|
return receipt;
|
|
1168
1390
|
} catch (cause) {
|
|
1169
1391
|
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
1170
|
-
|
|
1171
|
-
(
|
|
1172
|
-
|
|
1392
|
+
if (settleResult()) {
|
|
1393
|
+
setState(
|
|
1394
|
+
(current) => isCurrentResultView() && current.source === source && current.browserSessionId === browserSessionId && current.actionResultOrder <= resultOrder ? { ...current, error, actionResultOrder: resultOrder } : current
|
|
1395
|
+
);
|
|
1396
|
+
}
|
|
1173
1397
|
throw error;
|
|
1174
1398
|
}
|
|
1175
1399
|
},
|
|
1176
|
-
[browserSessionId, client, workspaceId]
|
|
1400
|
+
[browserSessionId, client, enabled, invalidateRefresh, isCurrentSource, source, workspaceId, t]
|
|
1177
1401
|
);
|
|
1178
1402
|
const act = useCallback5(
|
|
1179
1403
|
async (action, operationId = crypto.randomUUID()) => await dispatchAction(action, operationId, null),
|
|
1180
1404
|
[dispatchAction]
|
|
1181
1405
|
);
|
|
1182
1406
|
const actFromFrame = useCallback5(
|
|
1183
|
-
async (action, frame, operationId = crypto.randomUUID()) => await dispatchAction(action, operationId, frame),
|
|
1407
|
+
async (action, frame, operationId = crypto.randomUUID(), observationMode = "none") => await dispatchAction(action, operationId, frame, observationMode),
|
|
1184
1408
|
[dispatchAction]
|
|
1185
1409
|
);
|
|
1410
|
+
const observeForInput = useCallback5(async () => {
|
|
1411
|
+
const target = selectedTargetRef.current;
|
|
1412
|
+
if (!enabled || !isCurrentSource()) {
|
|
1413
|
+
throw new Error(t("hooks.useBrowserSession.theBrowserSourceIsNo"));
|
|
1414
|
+
}
|
|
1415
|
+
if (!browserSessionId || !target)
|
|
1416
|
+
throw new Error(t("hooks.useBrowserSession.noBrowserTabIsSelected"));
|
|
1417
|
+
const observation = await client.observeBrowserTarget(workspaceId, browserSessionId, target.id);
|
|
1418
|
+
if (!isCurrentSource() || observation.browserSessionId !== browserSessionId || !sameObservationTarget(observation, selectedTargetRef.current)) {
|
|
1419
|
+
throw new Error(t("hooks.useBrowserSession.theBrowserPageChangedOpen"));
|
|
1420
|
+
}
|
|
1421
|
+
return observation;
|
|
1422
|
+
}, [browserSessionId, client, enabled, isCurrentSource, workspaceId, t]);
|
|
1423
|
+
const actFromObservation = useCallback5(
|
|
1424
|
+
async (action, observation) => {
|
|
1425
|
+
if (!sameObservationTarget(observation, selectedTargetRef.current)) {
|
|
1426
|
+
throw new Error(t("hooks.useBrowserSession.theBrowserPageChangedOpen"));
|
|
1427
|
+
}
|
|
1428
|
+
return await dispatchAction(action, crypto.randomUUID(), {
|
|
1429
|
+
browserSessionId: observation.browserSessionId,
|
|
1430
|
+
controllerGeneration: observation.target.controllerGeneration,
|
|
1431
|
+
targetId: observation.target.id,
|
|
1432
|
+
targetGeneration: observation.target.targetGeneration,
|
|
1433
|
+
documentGeneration: observation.target.documentGeneration,
|
|
1434
|
+
frameId: observation.frameId
|
|
1435
|
+
});
|
|
1436
|
+
},
|
|
1437
|
+
[dispatchAction, t]
|
|
1438
|
+
);
|
|
1186
1439
|
const diagnostics = useCallback5(
|
|
1187
1440
|
async (diagnosticOptions = {}) => {
|
|
1441
|
+
if (!enabled || !isCurrentSource()) {
|
|
1442
|
+
throw new Error(t("hooks.useBrowserSession.theBrowserSourceIsNo"));
|
|
1443
|
+
}
|
|
1188
1444
|
const targetId = selectedTargetIdRef.current;
|
|
1189
1445
|
if (!browserSessionId || !targetId) {
|
|
1190
|
-
throw new Error("
|
|
1446
|
+
throw new Error(t("hooks.useBrowserSession.noBrowserTabIsSelected"));
|
|
1191
1447
|
}
|
|
1192
1448
|
return await client.listBrowserDiagnostics(
|
|
1193
1449
|
workspaceId,
|
|
@@ -1196,16 +1452,19 @@ function useBrowserSession(options) {
|
|
|
1196
1452
|
diagnosticOptions
|
|
1197
1453
|
);
|
|
1198
1454
|
},
|
|
1199
|
-
[browserSessionId, client, workspaceId]
|
|
1455
|
+
[browserSessionId, client, enabled, isCurrentSource, workspaceId, t]
|
|
1200
1456
|
);
|
|
1201
1457
|
const readClipboard = useCallback5(async () => {
|
|
1458
|
+
if (!enabled || !isCurrentSource()) {
|
|
1459
|
+
throw new Error(t("hooks.useBrowserSession.theBrowserSourceIsNo"));
|
|
1460
|
+
}
|
|
1202
1461
|
if (!browserSessionId) throw new Error("No BrowserSession is selected.");
|
|
1203
1462
|
const clipboard = await client.readBrowserClipboard(workspaceId, browserSessionId);
|
|
1204
|
-
if (clipboard.browserSessionId !== browserSessionId) {
|
|
1463
|
+
if (!isCurrentSource() || clipboard.browserSessionId !== browserSessionId) {
|
|
1205
1464
|
throw new Error("Browser clipboard belongs to another BrowserSession.");
|
|
1206
1465
|
}
|
|
1207
1466
|
return clipboard;
|
|
1208
|
-
}, [browserSessionId, client, workspaceId]);
|
|
1467
|
+
}, [browserSessionId, client, enabled, isCurrentSource, workspaceId, t]);
|
|
1209
1468
|
return {
|
|
1210
1469
|
session: visible.session,
|
|
1211
1470
|
targets: visible.targets,
|
|
@@ -1214,7 +1473,10 @@ function useBrowserSession(options) {
|
|
|
1214
1473
|
loading: visible.loading,
|
|
1215
1474
|
mutating: visible.mutating,
|
|
1216
1475
|
error: visible.error,
|
|
1476
|
+
inputFailure: visible.inputFailure,
|
|
1217
1477
|
refresh,
|
|
1478
|
+
observeForInput,
|
|
1479
|
+
actFromObservation,
|
|
1218
1480
|
selectTarget,
|
|
1219
1481
|
openTarget,
|
|
1220
1482
|
closeTarget,
|
|
@@ -1233,7 +1495,9 @@ function emptyState4(browserSessionId, loading) {
|
|
|
1233
1495
|
observation: null,
|
|
1234
1496
|
loading,
|
|
1235
1497
|
mutating: false,
|
|
1236
|
-
error: null
|
|
1498
|
+
error: null,
|
|
1499
|
+
inputFailure: null,
|
|
1500
|
+
actionResultOrder: 0
|
|
1237
1501
|
};
|
|
1238
1502
|
}
|
|
1239
1503
|
function chooseTarget(targets, preferredId) {
|
|
@@ -1244,6 +1508,9 @@ function replaceTarget(targets, target) {
|
|
|
1244
1508
|
next.push(target);
|
|
1245
1509
|
return next.sort((left, right) => left.createdAt.localeCompare(right.createdAt));
|
|
1246
1510
|
}
|
|
1511
|
+
function sameObservationTarget(observation, target) {
|
|
1512
|
+
return target !== null && observation.browserSessionId === target.browserSessionId && observation.target.id === target.id && observation.target.controllerGeneration === target.controllerGeneration && observation.target.targetGeneration === target.targetGeneration && observation.target.documentGeneration === target.documentGeneration;
|
|
1513
|
+
}
|
|
1247
1514
|
function isMissingBrowserTarget(error) {
|
|
1248
1515
|
return error instanceof OpenGeniApiError && error.code === "target_not_found";
|
|
1249
1516
|
}
|
|
@@ -1264,14 +1531,16 @@ function useBrowserSessions(options = {}) {
|
|
|
1264
1531
|
id: 0,
|
|
1265
1532
|
controller: null
|
|
1266
1533
|
});
|
|
1534
|
+
const loadQueueRef = useRef6(null);
|
|
1267
1535
|
const mountedRef = useRef6(true);
|
|
1268
1536
|
const visibleState = state.workspaceId === workspaceId ? state : emptyState5(workspaceId, enabled);
|
|
1269
1537
|
const cancelLoad = useCallback6(() => {
|
|
1538
|
+
loadQueueRef.current = null;
|
|
1270
1539
|
const id = requestRef.current.id + 1;
|
|
1271
1540
|
requestRef.current.controller?.abort();
|
|
1272
1541
|
requestRef.current = { id, controller: null };
|
|
1273
1542
|
}, []);
|
|
1274
|
-
const
|
|
1543
|
+
const loadOnce = useCallback6(
|
|
1275
1544
|
async (foreground) => {
|
|
1276
1545
|
if (!enabled) return;
|
|
1277
1546
|
const id = requestRef.current.id + 1;
|
|
@@ -1317,6 +1586,30 @@ function useBrowserSessions(options = {}) {
|
|
|
1317
1586
|
},
|
|
1318
1587
|
[client, enabled, workspaceId]
|
|
1319
1588
|
);
|
|
1589
|
+
const load = useCallback6(
|
|
1590
|
+
(foreground) => {
|
|
1591
|
+
const current = loadQueueRef.current;
|
|
1592
|
+
if (current) {
|
|
1593
|
+
current.pending = true;
|
|
1594
|
+
return current.promise;
|
|
1595
|
+
}
|
|
1596
|
+
const queue = { pending: false, promise: Promise.resolve() };
|
|
1597
|
+
loadQueueRef.current = queue;
|
|
1598
|
+
queue.promise = Promise.resolve().then(async () => {
|
|
1599
|
+
while (loadQueueRef.current === queue) {
|
|
1600
|
+
queue.pending = false;
|
|
1601
|
+
await loadOnce(foreground);
|
|
1602
|
+
foreground = false;
|
|
1603
|
+
if (!queue.pending) break;
|
|
1604
|
+
}
|
|
1605
|
+
if (loadQueueRef.current === queue) loadQueueRef.current = null;
|
|
1606
|
+
}).finally(() => {
|
|
1607
|
+
if (loadQueueRef.current === queue) loadQueueRef.current = null;
|
|
1608
|
+
});
|
|
1609
|
+
return queue.promise;
|
|
1610
|
+
},
|
|
1611
|
+
[loadOnce]
|
|
1612
|
+
);
|
|
1320
1613
|
const refresh = useCallback6(async () => await load(false), [load]);
|
|
1321
1614
|
useEffect6(() => {
|
|
1322
1615
|
mountedRef.current = true;
|
|
@@ -1644,11 +1937,275 @@ function browserKey(event, hostPlatform = interactionHostPlatform()) {
|
|
|
1644
1937
|
return parts.join("+");
|
|
1645
1938
|
}
|
|
1646
1939
|
|
|
1647
|
-
// src/components/browser-
|
|
1940
|
+
// src/components/browser-select-control.tsx
|
|
1941
|
+
import { useEffect as useEffect8, useLayoutEffect, useRef as useRef8, useState as useState8 } from "react";
|
|
1648
1942
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
1943
|
+
function focusedSelect(observation) {
|
|
1944
|
+
if (observation.semantic?.kind !== "snapshot") return null;
|
|
1945
|
+
const pending = [...observation.semantic.roots];
|
|
1946
|
+
while (pending.length) {
|
|
1947
|
+
const node = pending.pop();
|
|
1948
|
+
if (node.children) pending.push(...node.children);
|
|
1949
|
+
if (node.ref !== observation.focusedRef || !node.actions.includes("select") || node.native?.platform !== "dom")
|
|
1950
|
+
continue;
|
|
1951
|
+
const data = node.native.data;
|
|
1952
|
+
if (!data || data.kind !== "native-select" || typeof data.multiple !== "boolean" || typeof data.disabled !== "boolean" || !Array.isArray(data.options) || data.options.length > 200)
|
|
1953
|
+
return null;
|
|
1954
|
+
if (data.options.some(
|
|
1955
|
+
(option) => !option || typeof option.value !== "string" || typeof option.label !== "string" || typeof option.selected !== "boolean" || typeof option.disabled !== "boolean"
|
|
1956
|
+
))
|
|
1957
|
+
return null;
|
|
1958
|
+
return { node, control: data };
|
|
1959
|
+
}
|
|
1960
|
+
return null;
|
|
1961
|
+
}
|
|
1962
|
+
function BrowserSelectControl(props) {
|
|
1963
|
+
const t = useOpenGeniText();
|
|
1964
|
+
const [snapshot, setSnapshot] = useState8(null);
|
|
1965
|
+
const [open, setOpen] = useState8(false);
|
|
1966
|
+
const [busy, setBusy] = useState8(false);
|
|
1967
|
+
const [error, setError] = useState8(null);
|
|
1968
|
+
const [values, setValues] = useState8([]);
|
|
1969
|
+
const [anchor, setAnchor] = useState8(null);
|
|
1970
|
+
const popupRef = useRef8(null);
|
|
1971
|
+
const [position, setPosition] = useState8(null);
|
|
1972
|
+
const panelRef = useRef8(null);
|
|
1973
|
+
const request = useRef8(0);
|
|
1974
|
+
const optionKeys = useRef8(/* @__PURE__ */ new WeakMap());
|
|
1975
|
+
const nextOptionKey = useRef8(0);
|
|
1976
|
+
const optionKey = (option) => {
|
|
1977
|
+
let key = optionKeys.current.get(option);
|
|
1978
|
+
if (key === void 0) {
|
|
1979
|
+
key = ++nextOptionKey.current;
|
|
1980
|
+
optionKeys.current.set(option, key);
|
|
1981
|
+
}
|
|
1982
|
+
return key;
|
|
1983
|
+
};
|
|
1984
|
+
useEffect8(
|
|
1985
|
+
() => () => {
|
|
1986
|
+
request.current += 1;
|
|
1987
|
+
},
|
|
1988
|
+
[]
|
|
1989
|
+
);
|
|
1990
|
+
useEffect8(() => {
|
|
1991
|
+
if (props.activation === void 0) return;
|
|
1992
|
+
++request.current;
|
|
1993
|
+
const observation = props.activation?.observation;
|
|
1994
|
+
const selected2 = observation ? focusedSelect(observation) : null;
|
|
1995
|
+
setSnapshot(selected2 && observation ? observation : null);
|
|
1996
|
+
setAnchor(selected2 ? props.activation.anchor : null);
|
|
1997
|
+
setOpen(Boolean(selected2));
|
|
1998
|
+
setBusy(false);
|
|
1999
|
+
setError(null);
|
|
2000
|
+
setValues(
|
|
2001
|
+
selected2?.control.options.filter((option) => option.selected).map((option) => option.value) ?? []
|
|
2002
|
+
);
|
|
2003
|
+
}, [props.activation]);
|
|
2004
|
+
useEffect8(() => {
|
|
2005
|
+
if (open && !busy) panelRef.current?.focus({ preventScroll: true });
|
|
2006
|
+
}, [open, busy]);
|
|
2007
|
+
useLayoutEffect(() => {
|
|
2008
|
+
if (!anchor || !open) {
|
|
2009
|
+
setPosition(null);
|
|
2010
|
+
return;
|
|
2011
|
+
}
|
|
2012
|
+
const place = () => {
|
|
2013
|
+
const popup = popupRef.current;
|
|
2014
|
+
const parent = popup?.parentElement;
|
|
2015
|
+
if (!popup || !parent) return;
|
|
2016
|
+
setPosition({
|
|
2017
|
+
x: Math.max(12, Math.min(anchor.x, parent.clientWidth - popup.offsetWidth - 12)),
|
|
2018
|
+
y: Math.max(12, Math.min(anchor.y, parent.clientHeight - popup.offsetHeight - 12)),
|
|
2019
|
+
height: Math.max(48, parent.clientHeight - 60)
|
|
2020
|
+
});
|
|
2021
|
+
};
|
|
2022
|
+
place();
|
|
2023
|
+
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(place);
|
|
2024
|
+
if (popupRef.current?.parentElement) observer?.observe(popupRef.current.parentElement);
|
|
2025
|
+
if (popupRef.current) observer?.observe(popupRef.current);
|
|
2026
|
+
return () => observer?.disconnect();
|
|
2027
|
+
}, [anchor, open, busy, snapshot, error]);
|
|
2028
|
+
const selected = snapshot ? focusedSelect(snapshot) : null;
|
|
2029
|
+
const ambiguousValue = (value) => (selected?.control.options.filter((option) => option.value === value || option.label === value).length ?? 0) !== 1;
|
|
2030
|
+
const load = async () => {
|
|
2031
|
+
const current = ++request.current;
|
|
2032
|
+
setOpen(true);
|
|
2033
|
+
setBusy(true);
|
|
2034
|
+
setSnapshot(null);
|
|
2035
|
+
setError(null);
|
|
2036
|
+
setAnchor(null);
|
|
2037
|
+
try {
|
|
2038
|
+
const observation = await props.observe();
|
|
2039
|
+
if (current !== request.current) return;
|
|
2040
|
+
setSnapshot(observation);
|
|
2041
|
+
setValues(
|
|
2042
|
+
focusedSelect(observation)?.control.options.filter((option) => option.selected).map((option) => option.value) ?? []
|
|
2043
|
+
);
|
|
2044
|
+
} catch (cause) {
|
|
2045
|
+
if (current === request.current)
|
|
2046
|
+
setError(
|
|
2047
|
+
cause instanceof Error ? cause.message : t("browserSelectControl.couldNotReadOptions")
|
|
2048
|
+
);
|
|
2049
|
+
} finally {
|
|
2050
|
+
if (current === request.current) setBusy(false);
|
|
2051
|
+
}
|
|
2052
|
+
};
|
|
2053
|
+
const apply = async (next) => {
|
|
2054
|
+
if (!snapshot || !selected || busy) return;
|
|
2055
|
+
const current = ++request.current;
|
|
2056
|
+
setBusy(true);
|
|
2057
|
+
setError(null);
|
|
2058
|
+
try {
|
|
2059
|
+
const receipt = await props.act(
|
|
2060
|
+
{ type: "select", locator: { kind: "ref", ref: selected.node.ref }, values: next },
|
|
2061
|
+
snapshot
|
|
2062
|
+
);
|
|
2063
|
+
if (receipt.state !== "completed")
|
|
2064
|
+
throw new Error(
|
|
2065
|
+
receipt.error?.message ?? t("browserSelectControl.selectionDidNotComplete")
|
|
2066
|
+
);
|
|
2067
|
+
if (current === request.current) {
|
|
2068
|
+
setOpen(false);
|
|
2069
|
+
setSnapshot(null);
|
|
2070
|
+
props.onDismiss?.();
|
|
2071
|
+
}
|
|
2072
|
+
} catch (cause) {
|
|
2073
|
+
if (current === request.current) {
|
|
2074
|
+
setError(
|
|
2075
|
+
cause instanceof Error ? cause.message : t("browserSelectControl.selectionFailedReadTheOptions")
|
|
2076
|
+
);
|
|
2077
|
+
setSnapshot(null);
|
|
2078
|
+
}
|
|
2079
|
+
} finally {
|
|
2080
|
+
if (current === request.current) setBusy(false);
|
|
2081
|
+
}
|
|
2082
|
+
};
|
|
2083
|
+
if (props.manualFallback === false && !open) return null;
|
|
2084
|
+
return /* @__PURE__ */ jsxs(
|
|
2085
|
+
"div",
|
|
2086
|
+
{
|
|
2087
|
+
ref: popupRef,
|
|
2088
|
+
className: "absolute z-10 max-w-[calc(100%-1.5rem)] text-og-control",
|
|
2089
|
+
style: anchor && open ? {
|
|
2090
|
+
left: position?.x ?? anchor.x,
|
|
2091
|
+
top: position?.y ?? anchor.y
|
|
2092
|
+
} : { bottom: 12, left: 12 },
|
|
2093
|
+
children: [
|
|
2094
|
+
props.manualFallback !== false && (!anchor || !open) || error ? /* @__PURE__ */ jsx(
|
|
2095
|
+
"button",
|
|
2096
|
+
{
|
|
2097
|
+
type: "button",
|
|
2098
|
+
className: "rounded-og-sm border border-og-border bg-og-bg px-2 py-1 text-og-fg",
|
|
2099
|
+
disabled: busy,
|
|
2100
|
+
onClick: () => void load(),
|
|
2101
|
+
"aria-expanded": open,
|
|
2102
|
+
children: t("browserSelectControl.chooseOption")
|
|
2103
|
+
}
|
|
2104
|
+
) : null,
|
|
2105
|
+
open ? /* @__PURE__ */ jsxs(
|
|
2106
|
+
"section",
|
|
2107
|
+
{
|
|
2108
|
+
ref: panelRef,
|
|
2109
|
+
tabIndex: -1,
|
|
2110
|
+
"aria-label": t("browserSelectControl.pageSelectionOptions"),
|
|
2111
|
+
style: position ? { maxHeight: Math.min(288, position.height) } : void 0,
|
|
2112
|
+
onKeyDown: (event) => {
|
|
2113
|
+
if (event.key !== "Escape") return;
|
|
2114
|
+
event.preventDefault();
|
|
2115
|
+
event.stopPropagation();
|
|
2116
|
+
++request.current;
|
|
2117
|
+
setOpen(false);
|
|
2118
|
+
setSnapshot(null);
|
|
2119
|
+
setBusy(false);
|
|
2120
|
+
props.onDismiss?.();
|
|
2121
|
+
},
|
|
2122
|
+
className: "mt-1 max-h-72 w-72 max-w-full overflow-auto rounded-og-sm border border-og-border bg-og-bg p-3 text-og-fg shadow-lg",
|
|
2123
|
+
children: [
|
|
2124
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2125
|
+
/* @__PURE__ */ jsx("strong", { children: selected?.node.name || t("browserSelectControl.pageOptions") }),
|
|
2126
|
+
/* @__PURE__ */ jsx(
|
|
2127
|
+
"button",
|
|
2128
|
+
{
|
|
2129
|
+
type: "button",
|
|
2130
|
+
disabled: busy,
|
|
2131
|
+
onClick: () => {
|
|
2132
|
+
++request.current;
|
|
2133
|
+
setOpen(false);
|
|
2134
|
+
setSnapshot(null);
|
|
2135
|
+
props.onDismiss?.();
|
|
2136
|
+
},
|
|
2137
|
+
"aria-label": t("browserSelectControl.closePageOptions"),
|
|
2138
|
+
children: t("browserSelectControl.close")
|
|
2139
|
+
}
|
|
2140
|
+
)
|
|
2141
|
+
] }),
|
|
2142
|
+
busy ? /* @__PURE__ */ jsx("p", { role: "status", children: t("browserSelectControl.loading") }) : error ? /* @__PURE__ */ jsx("p", { role: "alert", children: error }) : !selected ? /* @__PURE__ */ jsx("p", { children: t("browserSelectControl.clickADropdownInThe") }) : selected.control.disabled ? /* @__PURE__ */ jsx("p", { children: t("browserSelectControl.thisControlIsDisabled") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2143
|
+
selected.control.options.map((option) => {
|
|
2144
|
+
const ambiguous = ambiguousValue(option.value);
|
|
2145
|
+
const disabled = busy || option.disabled || ambiguous;
|
|
2146
|
+
return selected.control.multiple ? /* @__PURE__ */ jsxs("label", { className: "my-1 flex items-center gap-2", children: [
|
|
2147
|
+
/* @__PURE__ */ jsx(
|
|
2148
|
+
"input",
|
|
2149
|
+
{
|
|
2150
|
+
type: "checkbox",
|
|
2151
|
+
disabled,
|
|
2152
|
+
checked: values.includes(option.value),
|
|
2153
|
+
onChange: (event) => setValues(
|
|
2154
|
+
event.target.checked ? [...values, option.value] : values.filter((value) => value !== option.value)
|
|
2155
|
+
)
|
|
2156
|
+
}
|
|
2157
|
+
),
|
|
2158
|
+
option.label || t("browserSelectControl.empty"),
|
|
2159
|
+
ambiguous ? ` ${t("browserSelectControl.ambiguousValue")}` : ""
|
|
2160
|
+
] }, optionKey(option)) : /* @__PURE__ */ jsxs(
|
|
2161
|
+
"button",
|
|
2162
|
+
{
|
|
2163
|
+
type: "button",
|
|
2164
|
+
disabled,
|
|
2165
|
+
"aria-pressed": option.selected,
|
|
2166
|
+
className: "my-1 block w-full rounded-og-sm border border-og-border px-2 py-1 text-left disabled:opacity-50",
|
|
2167
|
+
onClick: () => void apply([option.value]),
|
|
2168
|
+
children: [
|
|
2169
|
+
option.label || t("browserSelectControl.empty"),
|
|
2170
|
+
option.selected ? " \u2713" : "",
|
|
2171
|
+
ambiguous ? ` ${t("browserSelectControl.ambiguousValue")}` : ""
|
|
2172
|
+
]
|
|
2173
|
+
},
|
|
2174
|
+
optionKey(option)
|
|
2175
|
+
);
|
|
2176
|
+
}),
|
|
2177
|
+
selected.control.multiple ? /* @__PURE__ */ jsx(
|
|
2178
|
+
"button",
|
|
2179
|
+
{
|
|
2180
|
+
type: "button",
|
|
2181
|
+
disabled: busy || values.some(ambiguousValue),
|
|
2182
|
+
onClick: () => void apply(values),
|
|
2183
|
+
children: t("browserSelectControl.applySelection")
|
|
2184
|
+
}
|
|
2185
|
+
) : null
|
|
2186
|
+
] })
|
|
2187
|
+
]
|
|
2188
|
+
}
|
|
2189
|
+
) : null
|
|
2190
|
+
]
|
|
2191
|
+
}
|
|
2192
|
+
);
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
// src/components/browser-viewer.tsx
|
|
2196
|
+
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2197
|
+
var STALE_BROWSER_END_MAX_ATTEMPTS = 3;
|
|
2198
|
+
var STALE_BROWSER_END_RETRY_BASE_MS = 5e3;
|
|
2199
|
+
function staleBrowserEndRetryDelayMs(cause, failedAttempts) {
|
|
2200
|
+
const status = cause?.status;
|
|
2201
|
+
if (typeof status === "number" && status >= 400 && status < 500) return null;
|
|
2202
|
+
if (failedAttempts >= STALE_BROWSER_END_MAX_ATTEMPTS) return null;
|
|
2203
|
+
return STALE_BROWSER_END_RETRY_BASE_MS * 2 ** (failedAttempts - 1);
|
|
2204
|
+
}
|
|
1649
2205
|
function BrowserViewer({
|
|
1650
2206
|
sessionId,
|
|
1651
2207
|
enabled = true,
|
|
2208
|
+
active = true,
|
|
1652
2209
|
className,
|
|
1653
2210
|
onNotify,
|
|
1654
2211
|
webSocketFactory,
|
|
@@ -1660,6 +2217,7 @@ function BrowserViewer({
|
|
|
1660
2217
|
browserExtensionSetupUrl,
|
|
1661
2218
|
...override
|
|
1662
2219
|
}) {
|
|
2220
|
+
const t = useOpenGeniText();
|
|
1663
2221
|
const registry = useBrowserSessions({ ...override, sessionId, enabled });
|
|
1664
2222
|
const attached = useAttachedBrowsers({ ...override, enabled });
|
|
1665
2223
|
const onlineAttachedBridges = useMemo2(
|
|
@@ -1682,9 +2240,10 @@ function BrowserViewer({
|
|
|
1682
2240
|
() => attachedChromeGenerationLoss(registry.sessions),
|
|
1683
2241
|
[registry.sessions]
|
|
1684
2242
|
);
|
|
1685
|
-
const endedGenerationLossRef =
|
|
2243
|
+
const endedGenerationLossRef = useRef9(/* @__PURE__ */ new Set());
|
|
2244
|
+
const endStaleBrowserAttemptsRef = useRef9(/* @__PURE__ */ new Map());
|
|
1686
2245
|
const endStaleBrowser = registry.end;
|
|
1687
|
-
|
|
2246
|
+
useEffect9(() => {
|
|
1688
2247
|
if (!enabled) return;
|
|
1689
2248
|
for (const session of registry.sessions) {
|
|
1690
2249
|
if (session.lifecycle !== "lost" || session.failureCode !== "controller_transition_expired" || session.placement.kind !== "attached_device") {
|
|
@@ -1692,20 +2251,22 @@ function BrowserViewer({
|
|
|
1692
2251
|
}
|
|
1693
2252
|
if (endedGenerationLossRef.current.has(session.id)) continue;
|
|
1694
2253
|
endedGenerationLossRef.current.add(session.id);
|
|
1695
|
-
void endStaleBrowser(session.id).catch(() => {
|
|
1696
|
-
|
|
2254
|
+
void endStaleBrowser(session.id).catch((cause) => {
|
|
2255
|
+
const attempts = (endStaleBrowserAttemptsRef.current.get(session.id) ?? 0) + 1;
|
|
2256
|
+
endStaleBrowserAttemptsRef.current.set(session.id, attempts);
|
|
2257
|
+
const delay = staleBrowserEndRetryDelayMs(cause, attempts);
|
|
2258
|
+
if (delay === null) return;
|
|
2259
|
+
setTimeout(() => endedGenerationLossRef.current.delete(session.id), delay);
|
|
1697
2260
|
});
|
|
1698
2261
|
}
|
|
1699
2262
|
}, [enabled, endStaleBrowser, registry.sessions]);
|
|
1700
|
-
const replacementChromeDevice = useMemo2(() => {
|
|
1701
|
-
if (!attachedGenerationLoss) return null;
|
|
1702
|
-
return attached.devices.find((candidate) => candidate.id === attachedGenerationLoss.deviceId) ?? null;
|
|
1703
|
-
}, [attached.devices, attachedGenerationLoss]);
|
|
1704
2263
|
const relevant = useMemo2(
|
|
1705
2264
|
() => registry.relevantSessions.filter((session) => isLiveBrowser2(session)),
|
|
1706
2265
|
[registry.relevantSessions]
|
|
1707
2266
|
);
|
|
1708
|
-
const
|
|
2267
|
+
const latestRelevantBrowser = registry.relevantSessions[0];
|
|
2268
|
+
const unavailableBrowser = latestRelevantBrowser?.lifecycle === "lost" || latestRelevantBrowser?.lifecycle === "failed" ? latestRelevantBrowser : void 0;
|
|
2269
|
+
const [selection, setSelection] = useState9(
|
|
1709
2270
|
() => initialBrowserSessionId ? { sessionId: initialBrowserSessionId, pinned: true } : null
|
|
1710
2271
|
);
|
|
1711
2272
|
const selectBrowserSession = useCallback8(
|
|
@@ -1720,16 +2281,17 @@ function BrowserViewer({
|
|
|
1720
2281
|
enabled,
|
|
1721
2282
|
resourceKind: "browser_session"
|
|
1722
2283
|
});
|
|
1723
|
-
const [creating, setCreating] =
|
|
1724
|
-
const [savingProfile, setSavingProfile] =
|
|
1725
|
-
const [baseRevisionOrdinal, setBaseRevisionOrdinal] =
|
|
1726
|
-
const [profileHistory, setProfileHistory] =
|
|
1727
|
-
const [resumeAttempt, setResumeAttempt] =
|
|
1728
|
-
const resumeAttemptsRef =
|
|
1729
|
-
const previousSessionIdRef =
|
|
1730
|
-
const seenInterventionIdsRef =
|
|
1731
|
-
const diagnosticRequestRef =
|
|
1732
|
-
const
|
|
2284
|
+
const [creating, setCreating] = useState9(false);
|
|
2285
|
+
const [savingProfile, setSavingProfile] = useState9(false);
|
|
2286
|
+
const [baseRevisionOrdinal, setBaseRevisionOrdinal] = useState9(null);
|
|
2287
|
+
const [profileHistory, setProfileHistory] = useState9(null);
|
|
2288
|
+
const [resumeAttempt, setResumeAttempt] = useState9(null);
|
|
2289
|
+
const resumeAttemptsRef = useRef9(/* @__PURE__ */ new Map());
|
|
2290
|
+
const previousSessionIdRef = useRef9(sessionId);
|
|
2291
|
+
const seenInterventionIdsRef = useRef9(/* @__PURE__ */ new Set());
|
|
2292
|
+
const diagnosticRequestRef = useRef9(0);
|
|
2293
|
+
const viewportFocusHandoffRef = useRef9(null);
|
|
2294
|
+
const [diagnosticsView, setDiagnosticsView] = useState9(null);
|
|
1733
2295
|
const notifyError = useCallback8(
|
|
1734
2296
|
(cause, fallback) => {
|
|
1735
2297
|
const message = cause instanceof Error ? cause.message : fallback;
|
|
@@ -1737,7 +2299,7 @@ function BrowserViewer({
|
|
|
1737
2299
|
},
|
|
1738
2300
|
[onNotify]
|
|
1739
2301
|
);
|
|
1740
|
-
|
|
2302
|
+
useEffect9(() => {
|
|
1741
2303
|
if (previousSessionIdRef.current !== sessionId) {
|
|
1742
2304
|
previousSessionIdRef.current = sessionId;
|
|
1743
2305
|
setSelection(
|
|
@@ -1745,7 +2307,7 @@ function BrowserViewer({
|
|
|
1745
2307
|
);
|
|
1746
2308
|
}
|
|
1747
2309
|
}, [initialBrowserSessionId, sessionId]);
|
|
1748
|
-
|
|
2310
|
+
useEffect9(() => {
|
|
1749
2311
|
if (!enabled || registry.loading) return;
|
|
1750
2312
|
const selectedStillLive = liveSessions.some((session) => session.id === selection?.sessionId);
|
|
1751
2313
|
if (selection?.pinned && selectedStillLive) return;
|
|
@@ -1776,6 +2338,7 @@ function BrowserViewer({
|
|
|
1776
2338
|
);
|
|
1777
2339
|
const controllerReady = selectedRegistrySession?.lifecycle === "active";
|
|
1778
2340
|
const resumeSession = registry.resume;
|
|
2341
|
+
const [hasLiveFrame, setHasLiveFrame] = useState9(false);
|
|
1779
2342
|
const wakeBrowser = useCallback8(
|
|
1780
2343
|
async (session, retry = false) => {
|
|
1781
2344
|
const current = resumeAttemptsRef.current.get(session.id);
|
|
@@ -1793,7 +2356,9 @@ function BrowserViewer({
|
|
|
1793
2356
|
const response = await resumeSession(session.id, operationId);
|
|
1794
2357
|
if (response.operation.state !== "completed") {
|
|
1795
2358
|
throw Object.assign(
|
|
1796
|
-
new Error(
|
|
2359
|
+
new Error(
|
|
2360
|
+
response.operation.error?.message ?? t("browserViewer.browserCouldNotReopen2")
|
|
2361
|
+
),
|
|
1797
2362
|
{ terminal: true }
|
|
1798
2363
|
);
|
|
1799
2364
|
}
|
|
@@ -1809,30 +2374,27 @@ function BrowserViewer({
|
|
|
1809
2374
|
};
|
|
1810
2375
|
resumeAttemptsRef.current.set(session.id, failed);
|
|
1811
2376
|
setResumeAttempt({ sessionId: session.id, attempt: failed });
|
|
1812
|
-
notifyError(error, "
|
|
2377
|
+
notifyError(error, t("browserViewer.couldNotReopenThisBrowser"));
|
|
1813
2378
|
}
|
|
1814
2379
|
},
|
|
1815
|
-
[notifyError, resumeSession]
|
|
2380
|
+
[notifyError, resumeSession, t]
|
|
1816
2381
|
);
|
|
1817
|
-
|
|
2382
|
+
useEffect9(() => {
|
|
1818
2383
|
if (!selectedRegistrySession) return;
|
|
1819
2384
|
if (selectedRegistrySession.lifecycle === "active") {
|
|
1820
2385
|
resumeAttemptsRef.current.delete(selectedRegistrySession.id);
|
|
1821
2386
|
setResumeAttempt(
|
|
1822
2387
|
(visible) => visible?.sessionId === selectedRegistrySession.id ? null : visible
|
|
1823
2388
|
);
|
|
1824
|
-
return;
|
|
1825
|
-
}
|
|
1826
|
-
if (selectedRegistrySession.lifecycle === "suspended") {
|
|
1827
|
-
void wakeBrowser(selectedRegistrySession);
|
|
1828
2389
|
}
|
|
1829
|
-
}, [selectedRegistrySession
|
|
2390
|
+
}, [selectedRegistrySession]);
|
|
1830
2391
|
const browser = useBrowserSession({
|
|
1831
2392
|
...override,
|
|
1832
2393
|
browserSessionId: selection?.sessionId ?? null,
|
|
1833
|
-
enabled: enabled && selection !== null && controllerReady
|
|
2394
|
+
enabled: enabled && selection !== null && controllerReady,
|
|
2395
|
+
semanticObservationEnabled: active && !hasLiveFrame
|
|
1834
2396
|
});
|
|
1835
|
-
|
|
2397
|
+
useEffect9(() => {
|
|
1836
2398
|
if (!isSourcePlacementChangedError(browser.error, "browser_session")) return;
|
|
1837
2399
|
void refreshRegistry();
|
|
1838
2400
|
}, [browser.error, refreshRegistry]);
|
|
@@ -1842,16 +2404,16 @@ function BrowserViewer({
|
|
|
1842
2404
|
enabled: enabled && diagnosticsView !== null && controllerReady && browser.session?.capabilities.downloads === true
|
|
1843
2405
|
});
|
|
1844
2406
|
const loadBrowserDiagnostics = browser.diagnostics;
|
|
1845
|
-
|
|
2407
|
+
useEffect9(() => {
|
|
1846
2408
|
for (const intervention of interventions.interventions) {
|
|
1847
2409
|
if (seenInterventionIdsRef.current.has(intervention.id)) continue;
|
|
1848
2410
|
seenInterventionIdsRef.current.add(intervention.id);
|
|
1849
2411
|
onNotify?.({
|
|
1850
2412
|
kind: "info",
|
|
1851
|
-
message: `${interventionTitle(intervention)}: ${intervention.reason}`
|
|
2413
|
+
message: `${interventionTitle(t, intervention)}: ${intervention.reason}`
|
|
1852
2414
|
});
|
|
1853
2415
|
}
|
|
1854
|
-
}, [interventions.interventions, onNotify]);
|
|
2416
|
+
}, [interventions.interventions, onNotify, t]);
|
|
1855
2417
|
const resolveIntervention = useCallback8(
|
|
1856
2418
|
(intervention, outcome) => {
|
|
1857
2419
|
void interventions.resolve(intervention.id, {
|
|
@@ -1860,11 +2422,11 @@ function BrowserViewer({
|
|
|
1860
2422
|
}).then(() => {
|
|
1861
2423
|
onNotify?.({
|
|
1862
2424
|
kind: "info",
|
|
1863
|
-
message: outcome === "completed" ? "
|
|
2425
|
+
message: outcome === "completed" ? t("browserViewer.agentNotifiedContinuingWork") : t("browserViewer.requestCancelled")
|
|
1864
2426
|
});
|
|
1865
|
-
}).catch((cause) => notifyError(cause, "
|
|
2427
|
+
}).catch((cause) => notifyError(cause, t("browserViewer.couldNotUpdateTheBrowser")));
|
|
1866
2428
|
},
|
|
1867
|
-
[interventions, notifyError, onNotify]
|
|
2429
|
+
[interventions, notifyError, onNotify, t]
|
|
1868
2430
|
);
|
|
1869
2431
|
const frames = useBrowserFrameStream({
|
|
1870
2432
|
...override,
|
|
@@ -1874,13 +2436,26 @@ function BrowserViewer({
|
|
|
1874
2436
|
stream: { format: "jpeg", quality: 76, maxWidth: 1920, maxHeight: 1200 },
|
|
1875
2437
|
...webSocketFactory ? { webSocketFactory } : {}
|
|
1876
2438
|
});
|
|
1877
|
-
const
|
|
2439
|
+
const receivedFrame = frameMatchesSelectedTarget(
|
|
1878
2440
|
frames.frame,
|
|
1879
2441
|
browser.session,
|
|
1880
2442
|
browser.selectedTarget
|
|
1881
2443
|
) ? frames.frame : null;
|
|
1882
|
-
const
|
|
1883
|
-
|
|
2444
|
+
const displayedFrame = useMemo2(
|
|
2445
|
+
() => receivedFrame ? { ...receivedFrame, data: receivedFrame.data.slice().buffer } : null,
|
|
2446
|
+
[receivedFrame]
|
|
2447
|
+
);
|
|
2448
|
+
const frameIsLive = frames.state === "live" && displayedFrame !== null;
|
|
2449
|
+
useEffect9(() => {
|
|
2450
|
+
setHasLiveFrame(frameIsLive);
|
|
2451
|
+
}, [frameIsLive]);
|
|
2452
|
+
const supportsLiveFrames = (browser.session ?? selectedRegistrySession)?.capabilities.liveFrames === true;
|
|
2453
|
+
const controlUnavailable = isInteractionControlUnavailable(browser.error);
|
|
2454
|
+
const connectionError = controlUnavailable ? browser.error : frames.error ?? browser.error;
|
|
2455
|
+
const selectedPlacement = (browser.session ?? selectedRegistrySession)?.placement;
|
|
2456
|
+
const selectedChromeGenerationLoss = selectedPlacement?.kind === "attached_device" && isAttachedChromeGenerationLossError(connectionError);
|
|
2457
|
+
const replacementChromeDevice = selectedChromeGenerationLoss && selectedPlacement.kind === "attached_device" ? attached.devices.find((candidate) => candidate.id === selectedPlacement.deviceId) : null;
|
|
2458
|
+
const displayConnectionState = connectionError && (!frameIsLive || controlUnavailable) ? "error" : !browser.session ? "connecting" : supportsLiveFrames ? frames.state === "live" && !displayedFrame ? "connecting" : frames.state : "semantic";
|
|
1884
2459
|
const selectedProfile = useMemo2(
|
|
1885
2460
|
() => profiles.identities.find(
|
|
1886
2461
|
(identity) => identity.id === (browser.session?.identityId ?? selectedRegistrySession?.identityId)
|
|
@@ -1893,7 +2468,7 @@ function BrowserViewer({
|
|
|
1893
2468
|
) : [],
|
|
1894
2469
|
[selectedProfile, siteAuth.connections]
|
|
1895
2470
|
);
|
|
1896
|
-
|
|
2471
|
+
useEffect9(() => {
|
|
1897
2472
|
diagnosticRequestRef.current += 1;
|
|
1898
2473
|
setDiagnosticsView(null);
|
|
1899
2474
|
}, [browser.session?.id, browser.selectedTarget?.id]);
|
|
@@ -1937,13 +2512,16 @@ function BrowserViewer({
|
|
|
1937
2512
|
const response = await downloads.saveToWorkspace(downloadId, destinationPath, { overwrite });
|
|
1938
2513
|
onNotify?.({
|
|
1939
2514
|
kind: "info",
|
|
1940
|
-
message:
|
|
2515
|
+
message: t("browserViewer.filenameSavedToDestinationpath", {
|
|
2516
|
+
filename: response.download.filename,
|
|
2517
|
+
destinationPath: response.destinationPath
|
|
2518
|
+
})
|
|
1941
2519
|
});
|
|
1942
2520
|
return response;
|
|
1943
2521
|
},
|
|
1944
|
-
[downloads, onNotify]
|
|
2522
|
+
[downloads, onNotify, t]
|
|
1945
2523
|
);
|
|
1946
|
-
|
|
2524
|
+
useEffect9(() => {
|
|
1947
2525
|
const identityId = browser.session?.identityId ?? selectedRegistrySession?.identityId;
|
|
1948
2526
|
const revisionId = browser.session?.baseRevisionId ?? selectedRegistrySession?.baseRevisionId;
|
|
1949
2527
|
if (!identityId) {
|
|
@@ -1981,12 +2559,12 @@ function BrowserViewer({
|
|
|
1981
2559
|
if (choice.kind === "profile" && (!identity || identity.status !== "active")) {
|
|
1982
2560
|
onNotify?.({
|
|
1983
2561
|
kind: "error",
|
|
1984
|
-
message: "
|
|
2562
|
+
message: t("browserViewer.thisBrowserProfileIsNo")
|
|
1985
2563
|
});
|
|
1986
2564
|
return;
|
|
1987
2565
|
}
|
|
1988
2566
|
const device = choice.kind === "attached" ? choice.device : null;
|
|
1989
|
-
const browserName = device?.profileLabel ?? device?.name ?? (identity ? `${identity.name} browser` : "
|
|
2567
|
+
const browserName = device?.profileLabel ?? device?.name ?? (identity ? `${identity.name} browser` : t("browserViewer.browser"));
|
|
1990
2568
|
setCreating(true);
|
|
1991
2569
|
void (async () => {
|
|
1992
2570
|
let linkedComputer = null;
|
|
@@ -2029,10 +2607,10 @@ function BrowserViewer({
|
|
|
2029
2607
|
if (computerViewUnavailable) {
|
|
2030
2608
|
onNotify?.({
|
|
2031
2609
|
kind: "info",
|
|
2032
|
-
message: "
|
|
2610
|
+
message: t("browserViewer.browserOpenedDesktopViewIs")
|
|
2033
2611
|
});
|
|
2034
2612
|
}
|
|
2035
|
-
})().catch((cause) => notifyError(cause, "
|
|
2613
|
+
})().catch((cause) => notifyError(cause, t("browserViewer.couldNotOpenABrowser"))).finally(() => setCreating(false));
|
|
2036
2614
|
},
|
|
2037
2615
|
[
|
|
2038
2616
|
createLinkedComputer,
|
|
@@ -2042,7 +2620,8 @@ function BrowserViewer({
|
|
|
2042
2620
|
onNotify,
|
|
2043
2621
|
selectBrowserSession,
|
|
2044
2622
|
profiles.identities,
|
|
2045
|
-
sessionId
|
|
2623
|
+
sessionId,
|
|
2624
|
+
t
|
|
2046
2625
|
]
|
|
2047
2626
|
);
|
|
2048
2627
|
const saveProfileVersion = useCallback8(
|
|
@@ -2076,17 +2655,23 @@ function BrowserViewer({
|
|
|
2076
2655
|
await Promise.all([browser.refresh(), registry.refresh()]);
|
|
2077
2656
|
onNotify?.({
|
|
2078
2657
|
kind: "info",
|
|
2079
|
-
message: response.outcome === "saved_as_default" ?
|
|
2658
|
+
message: response.outcome === "saved_as_default" ? t("browserViewer.nameVersionOrdinalSavedFor", {
|
|
2659
|
+
name: response.identity.name,
|
|
2660
|
+
ordinal: response.revision.ordinal
|
|
2661
|
+
}) : t("browserViewer.nameVersionOrdinalSavedAnother", {
|
|
2662
|
+
name: response.identity.name,
|
|
2663
|
+
ordinal: response.revision.ordinal
|
|
2664
|
+
})
|
|
2080
2665
|
});
|
|
2081
2666
|
return true;
|
|
2082
2667
|
} catch (cause) {
|
|
2083
|
-
notifyError(cause, "
|
|
2668
|
+
notifyError(cause, t("browserViewer.couldNotSaveThisBrowser"));
|
|
2084
2669
|
return false;
|
|
2085
2670
|
} finally {
|
|
2086
2671
|
setSavingProfile(false);
|
|
2087
2672
|
}
|
|
2088
2673
|
},
|
|
2089
|
-
[browser, notifyError, onNotify, profiles, registry, savingProfile, selectedProfile]
|
|
2674
|
+
[browser, notifyError, onNotify, profiles, registry, savingProfile, selectedProfile, t]
|
|
2090
2675
|
);
|
|
2091
2676
|
const updateProfile = useCallback8(
|
|
2092
2677
|
async (identity, update) => {
|
|
@@ -2103,49 +2688,55 @@ function BrowserViewer({
|
|
|
2103
2688
|
)?.ordinal;
|
|
2104
2689
|
onNotify?.({
|
|
2105
2690
|
kind: "info",
|
|
2106
|
-
message:
|
|
2691
|
+
message: ordinal ? t("browserViewer.nameVersionOpensByDefault", {
|
|
2692
|
+
name: response.identity.name,
|
|
2693
|
+
ordinal
|
|
2694
|
+
}) : t("browserViewer.nameOpensByDefault", { name: response.identity.name })
|
|
2107
2695
|
});
|
|
2108
2696
|
} else if (update.status === "archived") {
|
|
2109
2697
|
onNotify?.({
|
|
2110
2698
|
kind: "info",
|
|
2111
|
-
message:
|
|
2699
|
+
message: t("browserViewer.nameHiddenFromNewBrowsers", { name: response.identity.name })
|
|
2112
2700
|
});
|
|
2113
2701
|
} else if (update.status === "active") {
|
|
2114
2702
|
onNotify?.({ kind: "info", message: `${response.identity.name} restored.` });
|
|
2115
2703
|
}
|
|
2116
2704
|
return true;
|
|
2117
2705
|
} catch (cause) {
|
|
2118
|
-
notifyError(cause, "
|
|
2706
|
+
notifyError(cause, t("browserViewer.couldNotUpdateThisBrowser"));
|
|
2119
2707
|
await profiles.refresh().catch(() => void 0);
|
|
2120
2708
|
return false;
|
|
2121
2709
|
} finally {
|
|
2122
2710
|
setSavingProfile(false);
|
|
2123
2711
|
}
|
|
2124
2712
|
},
|
|
2125
|
-
[notifyError, onNotify, profileHistory?.revisions, profiles, savingProfile]
|
|
2713
|
+
[notifyError, onNotify, profileHistory?.revisions, profiles, savingProfile, t]
|
|
2126
2714
|
);
|
|
2127
2715
|
if (!enabled) return null;
|
|
2128
2716
|
if (registry.loading && liveSessions.length === 0) {
|
|
2129
|
-
return /* @__PURE__ */
|
|
2717
|
+
return /* @__PURE__ */ jsx2(
|
|
2130
2718
|
BrowserNotice,
|
|
2131
2719
|
{
|
|
2132
|
-
icon: /* @__PURE__ */
|
|
2133
|
-
text: "
|
|
2720
|
+
icon: /* @__PURE__ */ jsx2(LoaderCircleIcon, { className: "animate-spin" }),
|
|
2721
|
+
text: t("browserViewer.findingBrowsers"),
|
|
2134
2722
|
...className ? { className } : {}
|
|
2135
2723
|
}
|
|
2136
2724
|
);
|
|
2137
2725
|
}
|
|
2138
2726
|
if (liveSessions.length === 0) {
|
|
2139
|
-
if (renderEmpty
|
|
2140
|
-
|
|
2727
|
+
if (renderEmpty && !unavailableBrowser)
|
|
2728
|
+
return /* @__PURE__ */ jsx2(Fragment2, { children: renderEmpty(() => createBrowser(), creating) });
|
|
2729
|
+
return /* @__PURE__ */ jsx2(
|
|
2141
2730
|
"div",
|
|
2142
2731
|
{
|
|
2143
2732
|
className: cn("flex h-full min-h-0 items-center justify-center bg-og-bg p-6", className),
|
|
2144
|
-
children: /* @__PURE__ */
|
|
2145
|
-
/* @__PURE__ */
|
|
2146
|
-
/* @__PURE__ */
|
|
2147
|
-
|
|
2148
|
-
|
|
2733
|
+
children: /* @__PURE__ */ jsxs2("div", { className: "max-w-sm text-center", children: [
|
|
2734
|
+
/* @__PURE__ */ jsx2("span", { className: "mx-auto grid size-10 place-items-center rounded-og-md border border-og-border bg-og-surface-1 text-og-fg-muted", children: /* @__PURE__ */ jsx2(Globe2Icon, { className: "size-4.5" }) }),
|
|
2735
|
+
unavailableBrowser && !attachedGenerationLoss ? /* @__PURE__ */ jsx2(BrowserUnavailableNotice, { session: unavailableBrowser }) : /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
2736
|
+
/* @__PURE__ */ jsx2("p", { className: "mt-3 text-og-menu font-medium text-og-fg", children: attachedGenerationLoss ? t("browserViewer.chromeReconnectedOpenAFresh") : t("browserViewer.noBrowserOpen") }),
|
|
2737
|
+
/* @__PURE__ */ jsx2("p", { className: "mt-1 text-og-control leading-5 text-og-fg-muted", children: attachedGenerationLoss ? t("browserViewer.thisChromeProfileIsLive") : t("browserViewer.aBrowserAppearsHereWhen") })
|
|
2738
|
+
] }),
|
|
2739
|
+
/* @__PURE__ */ jsx2(
|
|
2149
2740
|
BrowserLaunchMenu,
|
|
2150
2741
|
{
|
|
2151
2742
|
attachedBridges: onlineAttachedBridges,
|
|
@@ -2159,17 +2750,17 @@ function BrowserViewer({
|
|
|
2159
2750
|
prominent: true
|
|
2160
2751
|
}
|
|
2161
2752
|
),
|
|
2162
|
-
registry.error ? /* @__PURE__ */
|
|
2753
|
+
registry.error ? /* @__PURE__ */ jsx2("p", { className: "mt-3 text-og-control text-og-danger", children: registry.error.message }) : null
|
|
2163
2754
|
] })
|
|
2164
2755
|
}
|
|
2165
2756
|
);
|
|
2166
2757
|
}
|
|
2167
|
-
return /* @__PURE__ */
|
|
2758
|
+
return /* @__PURE__ */ jsxs2(
|
|
2168
2759
|
"div",
|
|
2169
2760
|
{
|
|
2170
2761
|
className: cn("relative flex h-full min-h-0 flex-col overflow-hidden bg-og-bg", className),
|
|
2171
2762
|
children: [
|
|
2172
|
-
/* @__PURE__ */
|
|
2763
|
+
/* @__PURE__ */ jsx2(
|
|
2173
2764
|
BrowserToolbar,
|
|
2174
2765
|
{
|
|
2175
2766
|
sessions: liveSessions,
|
|
@@ -2199,92 +2790,185 @@ function BrowserViewer({
|
|
|
2199
2790
|
setupUrl: browserExtensionSetupUrl
|
|
2200
2791
|
}
|
|
2201
2792
|
),
|
|
2202
|
-
/* @__PURE__ */
|
|
2793
|
+
/* @__PURE__ */ jsx2(
|
|
2203
2794
|
InteractionInterventionBanner,
|
|
2204
2795
|
{
|
|
2205
2796
|
interventions: selectedInterventions,
|
|
2206
2797
|
activeTargetId: browser.selectedTarget?.id ?? null,
|
|
2207
2798
|
mutating: interventions.mutating,
|
|
2208
|
-
onOpen: (intervention) => void browser.selectTarget(intervention.targetId).catch((cause) => notifyError(cause, "
|
|
2799
|
+
onOpen: (intervention) => void browser.selectTarget(intervention.targetId).catch((cause) => notifyError(cause, t("browserViewer.couldNotOpenTheRequested"))),
|
|
2209
2800
|
onResolve: resolveIntervention
|
|
2210
2801
|
}
|
|
2211
2802
|
),
|
|
2212
|
-
!selectedRegistrySession ? /* @__PURE__ */
|
|
2803
|
+
!selectedRegistrySession ? /* @__PURE__ */ jsx2(
|
|
2213
2804
|
BrowserUnselectedPanel,
|
|
2214
2805
|
{
|
|
2806
|
+
unavailableBrowser,
|
|
2215
2807
|
peerCount: liveSessions.length,
|
|
2216
2808
|
creating,
|
|
2217
2809
|
onCreate: () => createBrowser()
|
|
2218
2810
|
}
|
|
2219
|
-
) : !controllerReady ? /* @__PURE__ */
|
|
2811
|
+
) : !controllerReady ? /* @__PURE__ */ jsx2(
|
|
2220
2812
|
BrowserLifecyclePanel,
|
|
2221
2813
|
{
|
|
2222
2814
|
session: selectedRegistrySession,
|
|
2223
2815
|
attempt: resumeAttempt?.sessionId === selectedRegistrySession.id ? resumeAttempt.attempt : null,
|
|
2224
2816
|
onResume: () => void wakeBrowser(selectedRegistrySession, true)
|
|
2225
2817
|
}
|
|
2226
|
-
) : /* @__PURE__ */
|
|
2227
|
-
/* @__PURE__ */
|
|
2818
|
+
) : /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
2819
|
+
/* @__PURE__ */ jsx2(
|
|
2228
2820
|
BrowserTabs,
|
|
2229
2821
|
{
|
|
2230
2822
|
targets: browser.targets,
|
|
2231
2823
|
selectedTargetId: browser.selectedTarget?.id ?? null,
|
|
2232
2824
|
mutating: savingProfile,
|
|
2233
2825
|
tabControl: browser.session?.capabilities.tabs === true,
|
|
2234
|
-
onSelect: (targetId) => void browser.selectTarget(targetId).catch((cause) => notifyError(cause, "
|
|
2235
|
-
onClose: (targetId) => void browser.closeTarget(targetId).catch((cause) => notifyError(cause, "
|
|
2236
|
-
onOpen: () => void browser.openTarget(HUMAN_BROWSER_HOME_URL).catch((cause) => notifyError(cause, "
|
|
2826
|
+
onSelect: (targetId) => void browser.selectTarget(targetId).catch((cause) => notifyError(cause, t("browserViewer.couldNotSwitchTabs"))),
|
|
2827
|
+
onClose: (targetId) => void browser.closeTarget(targetId).catch((cause) => notifyError(cause, t("browserViewer.couldNotCloseTheTab"))),
|
|
2828
|
+
onOpen: () => void browser.openTarget(HUMAN_BROWSER_HOME_URL).catch((cause) => notifyError(cause, t("browserViewer.couldNotOpenATab")))
|
|
2237
2829
|
}
|
|
2238
2830
|
),
|
|
2239
|
-
/* @__PURE__ */
|
|
2831
|
+
/* @__PURE__ */ jsx2(
|
|
2240
2832
|
BrowserAddressBar,
|
|
2241
2833
|
{
|
|
2242
2834
|
target: browser.selectedTarget,
|
|
2243
2835
|
loading: browser.loading || browser.mutating || savingProfile,
|
|
2244
|
-
onNavigate: (url) => void browser.act({ type: "navigate", url }).catch((cause) => notifyError(cause, "
|
|
2836
|
+
onNavigate: (url) => void browser.act({ type: "navigate", url }).catch((cause) => notifyError(cause, t("browserViewer.couldNotNavigate"))),
|
|
2837
|
+
onHistory: async (direction) => {
|
|
2838
|
+
try {
|
|
2839
|
+
const action = { type: "history", direction };
|
|
2840
|
+
if (receivedFrame) await browser.actFromFrame(action, receivedFrame);
|
|
2841
|
+
else {
|
|
2842
|
+
if (!browser.observation)
|
|
2843
|
+
throw new Error("The browser page is not ready for input.");
|
|
2844
|
+
await browser.actFromObservation(action, browser.observation);
|
|
2845
|
+
}
|
|
2846
|
+
} catch (cause) {
|
|
2847
|
+
notifyError(
|
|
2848
|
+
cause,
|
|
2849
|
+
direction === "back" ? t("browserViewer.couldNotGoBack") : t("browserViewer.couldNotGoForward")
|
|
2850
|
+
);
|
|
2851
|
+
}
|
|
2852
|
+
},
|
|
2245
2853
|
onReload: () => {
|
|
2246
2854
|
const url = browser.selectedTarget?.url;
|
|
2247
2855
|
if (url)
|
|
2248
|
-
void browser.act({ type: "navigate", url }).catch((cause) => notifyError(cause, "
|
|
2856
|
+
void browser.act({ type: "navigate", url }).catch((cause) => notifyError(cause, t("browserViewer.couldNotReload")));
|
|
2249
2857
|
}
|
|
2250
2858
|
}
|
|
2251
2859
|
),
|
|
2252
|
-
/* @__PURE__ */
|
|
2253
|
-
|
|
2860
|
+
browser.inputFailure ? /* @__PURE__ */ jsxs2(
|
|
2861
|
+
"div",
|
|
2254
2862
|
{
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
}
|
|
2275
|
-
} : frames.reconnect,
|
|
2276
|
-
reconnectLabel: (attachedGenerationLoss || isAttachedChromeGenerationLossError(frames.error)) && replacementChromeDevice ? "Open a fresh Connected Chrome" : void 0,
|
|
2277
|
-
reconnectMessage: attachedGenerationLoss || isAttachedChromeGenerationLossError(frames.error) ? "Chrome reconnected\u2014open a fresh browser/desktop." : void 0,
|
|
2278
|
-
onError: (cause) => notifyError(cause, "Browser input failed.")
|
|
2863
|
+
role: "alert",
|
|
2864
|
+
"aria-label": t("browserViewer.browserInputStatus"),
|
|
2865
|
+
className: "flex shrink-0 items-center gap-2 border-t border-og-border bg-og-surface-1 px-3 py-2 text-og-xs",
|
|
2866
|
+
children: [
|
|
2867
|
+
/* @__PURE__ */ jsx2(CircleAlertIcon, { className: "size-4 shrink-0 text-og-status-failed" }),
|
|
2868
|
+
/* @__PURE__ */ jsxs2("div", { className: "min-w-0 flex-1", children: [
|
|
2869
|
+
/* @__PURE__ */ jsx2("span", { className: "font-medium", children: browser.inputFailure.state === "failed" ? t("browserViewer.browserInputFailed") : t("browserViewer.inputResultUnknown") }),
|
|
2870
|
+
/* @__PURE__ */ jsx2("p", { className: "text-og-fg-subtle", children: browser.inputFailure.error?.message ?? t("browserViewer.inspectThePageBeforeContinuing") })
|
|
2871
|
+
] }),
|
|
2872
|
+
/* @__PURE__ */ jsx2(
|
|
2873
|
+
"button",
|
|
2874
|
+
{
|
|
2875
|
+
type: "button",
|
|
2876
|
+
onClick: () => void browser.refresh(),
|
|
2877
|
+
className: "shrink-0 rounded border border-og-border px-2 py-1 transition hover:bg-og-surface-2",
|
|
2878
|
+
children: t("browserViewer.checkBrowser")
|
|
2879
|
+
}
|
|
2880
|
+
)
|
|
2881
|
+
]
|
|
2279
2882
|
}
|
|
2280
|
-
),
|
|
2281
|
-
/* @__PURE__ */
|
|
2883
|
+
) : null,
|
|
2884
|
+
/* @__PURE__ */ jsxs2("div", { className: "relative flex min-h-0 min-w-0 flex-1 overflow-hidden", children: [
|
|
2885
|
+
/* @__PURE__ */ jsx2(
|
|
2886
|
+
BrowserViewport,
|
|
2887
|
+
{
|
|
2888
|
+
focusHandoffRef: viewportFocusHandoffRef,
|
|
2889
|
+
focusScope: JSON.stringify([
|
|
2890
|
+
selection?.sessionId,
|
|
2891
|
+
browser.selectedTarget?.id,
|
|
2892
|
+
browser.selectedTarget?.targetGeneration
|
|
2893
|
+
]),
|
|
2894
|
+
frame: displayedFrame,
|
|
2895
|
+
connectionState: displayConnectionState,
|
|
2896
|
+
supportsLiveFrames,
|
|
2897
|
+
connectionError,
|
|
2898
|
+
controlUnavailable,
|
|
2899
|
+
observation: browser.observation,
|
|
2900
|
+
mutating: browser.mutating || savingProfile,
|
|
2901
|
+
activityLabel: savingProfile ? t("browserViewer.savingBrowserVersion") : void 0,
|
|
2902
|
+
clipboardEnabled: browser.session?.capabilities.clipboard === true,
|
|
2903
|
+
inputBatchAttachment: frames.attachment,
|
|
2904
|
+
onAction: async (action, frame) => {
|
|
2905
|
+
const focusedInput = frame && action.type === "pointer" && action.action === "click" && (action.button === void 0 || action.button === "left") && frames.attachment?.focusedInputObservations === true && frames.attachment.browserSessionId === frame.browserSessionId && frames.attachment.controllerGeneration === frame.controllerGeneration && frames.attachment.targetId === frame.targetId && Date.parse(frames.attachment.expiresAt) > Date.now();
|
|
2906
|
+
const receipt = frame ? await browser.actFromFrame(
|
|
2907
|
+
action,
|
|
2908
|
+
frame,
|
|
2909
|
+
void 0,
|
|
2910
|
+
focusedInput ? "input" : "none"
|
|
2911
|
+
) : await browser.act(action);
|
|
2912
|
+
if (receipt.state !== "completed") {
|
|
2913
|
+
throw new Error(
|
|
2914
|
+
receipt.error?.message ?? t("browserViewer.browserInputDidNotComplete")
|
|
2915
|
+
);
|
|
2916
|
+
}
|
|
2917
|
+
return receipt;
|
|
2918
|
+
},
|
|
2919
|
+
onReadClipboard: browser.readClipboard,
|
|
2920
|
+
onObserveForInput: browser.observeForInput,
|
|
2921
|
+
onSelectFromObservation: browser.actFromObservation,
|
|
2922
|
+
onReconnect: selectedChromeGenerationLoss ? () => {
|
|
2923
|
+
if (replacementChromeDevice) {
|
|
2924
|
+
createBrowser({ kind: "attached", device: replacementChromeDevice });
|
|
2925
|
+
}
|
|
2926
|
+
} : () => {
|
|
2927
|
+
void browser.refresh();
|
|
2928
|
+
frames.reconnect();
|
|
2929
|
+
},
|
|
2930
|
+
reconnectLabel: selectedChromeGenerationLoss && replacementChromeDevice ? t("browserViewer.openAFreshConnectedChrome") : void 0,
|
|
2931
|
+
reconnectMessage: selectedChromeGenerationLoss ? t("browserViewer.chromeReconnectedOpenAFresh") : void 0,
|
|
2932
|
+
onError: (cause) => notifyError(cause, t("browserViewer.browserInputFailed2"))
|
|
2933
|
+
},
|
|
2934
|
+
JSON.stringify([
|
|
2935
|
+
selection?.sessionId,
|
|
2936
|
+
browser.selectedTarget?.id,
|
|
2937
|
+
browser.selectedTarget?.targetGeneration,
|
|
2938
|
+
browser.selectedTarget?.documentGeneration,
|
|
2939
|
+
frames.attachment?.controllerGeneration
|
|
2940
|
+
])
|
|
2941
|
+
),
|
|
2942
|
+
diagnosticsView ? /* @__PURE__ */ jsx2(
|
|
2943
|
+
BrowserDiagnosticsDrawer,
|
|
2944
|
+
{
|
|
2945
|
+
session: browser.session,
|
|
2946
|
+
profile: selectedProfile,
|
|
2947
|
+
target: browser.selectedTarget,
|
|
2948
|
+
observation: browser.observation,
|
|
2949
|
+
baseRevisionOrdinal,
|
|
2950
|
+
state: diagnosticsView,
|
|
2951
|
+
downloads: downloads.downloads,
|
|
2952
|
+
downloadsEnabled: browser.session?.capabilities.downloads === true,
|
|
2953
|
+
downloadsLoading: downloads.loading,
|
|
2954
|
+
downloadsRefreshing: downloads.refreshing,
|
|
2955
|
+
downloadsError: downloads.error,
|
|
2956
|
+
savingDownloadIds: downloads.savingDownloadIds,
|
|
2957
|
+
onSaveDownload: saveDownload,
|
|
2958
|
+
onRefreshDownloads: () => void downloads.refresh(),
|
|
2959
|
+
onRefresh: refreshDiagnostics,
|
|
2960
|
+
onClose: closeDiagnostics
|
|
2961
|
+
}
|
|
2962
|
+
) : null
|
|
2963
|
+
] }),
|
|
2964
|
+
/* @__PURE__ */ jsx2(
|
|
2282
2965
|
BrowserStatusBar,
|
|
2283
2966
|
{
|
|
2284
2967
|
session: browser.session,
|
|
2285
2968
|
profile: selectedProfile,
|
|
2286
2969
|
target: browser.selectedTarget,
|
|
2287
2970
|
observation: browser.observation,
|
|
2971
|
+
inputFailure: browser.inputFailure,
|
|
2288
2972
|
connectionState: displayConnectionState,
|
|
2289
2973
|
refreshing: registry.refreshing,
|
|
2290
2974
|
diagnosticsOpen: diagnosticsView !== null,
|
|
@@ -2295,53 +2979,34 @@ function BrowserViewer({
|
|
|
2295
2979
|
onDiagnostics: diagnosticsView ? closeDiagnostics : loadDiagnostics
|
|
2296
2980
|
}
|
|
2297
2981
|
)
|
|
2298
|
-
] })
|
|
2299
|
-
diagnosticsView ? /* @__PURE__ */ jsx(
|
|
2300
|
-
BrowserDiagnosticsDrawer,
|
|
2301
|
-
{
|
|
2302
|
-
session: browser.session,
|
|
2303
|
-
profile: selectedProfile,
|
|
2304
|
-
target: browser.selectedTarget,
|
|
2305
|
-
observation: browser.observation,
|
|
2306
|
-
baseRevisionOrdinal,
|
|
2307
|
-
state: diagnosticsView,
|
|
2308
|
-
downloads: downloads.downloads,
|
|
2309
|
-
downloadsEnabled: browser.session?.capabilities.downloads === true,
|
|
2310
|
-
downloadsLoading: downloads.loading,
|
|
2311
|
-
downloadsRefreshing: downloads.refreshing,
|
|
2312
|
-
downloadsError: downloads.error,
|
|
2313
|
-
savingDownloadIds: downloads.savingDownloadIds,
|
|
2314
|
-
onSaveDownload: saveDownload,
|
|
2315
|
-
onRefreshDownloads: () => void downloads.refresh(),
|
|
2316
|
-
onRefresh: refreshDiagnostics,
|
|
2317
|
-
onClose: closeDiagnostics
|
|
2318
|
-
}
|
|
2319
|
-
) : null
|
|
2982
|
+
] })
|
|
2320
2983
|
]
|
|
2321
2984
|
}
|
|
2322
2985
|
);
|
|
2323
2986
|
}
|
|
2324
2987
|
function BrowserLifecyclePanel(props) {
|
|
2988
|
+
const t = useOpenGeniText();
|
|
2325
2989
|
const failed = props.attempt?.error ?? null;
|
|
2326
|
-
const label = failed ? "
|
|
2327
|
-
const detail = failed ? failed.message : props.session.lifecycle === "suspended" ? "
|
|
2328
|
-
return /* @__PURE__ */
|
|
2329
|
-
/* @__PURE__ */
|
|
2330
|
-
/* @__PURE__ */
|
|
2331
|
-
/* @__PURE__ */
|
|
2332
|
-
failed || props.session.lifecycle === "suspended" && !props.attempt?.running ? /* @__PURE__ */
|
|
2990
|
+
const label = failed ? t("browserViewer.browserCouldNotReopen") : props.session.lifecycle === "suspending" ? t("browserViewer.savingBrowserState") : props.session.lifecycle === "restoring" || props.attempt?.running ? t("browserViewer.openingBrowser") : props.session.lifecycle === "starting" ? t("browserViewer.startingBrowser") : t("browserViewer.browserIsSleeping");
|
|
2991
|
+
const detail = failed ? failed.message : props.session.lifecycle === "suspended" ? t("browserViewer.itsPrivateStateIsSaved") : t("browserViewer.theBrowserWillReconnectHere");
|
|
2992
|
+
return /* @__PURE__ */ jsx2("div", { className: "grid min-h-0 flex-1 place-items-center bg-og-bg p-6 text-center", children: /* @__PURE__ */ jsxs2("div", { className: "max-w-sm", children: [
|
|
2993
|
+
/* @__PURE__ */ jsx2("span", { className: "mx-auto grid size-10 place-items-center rounded-og-md border border-og-border bg-og-surface-1 text-og-fg-muted", children: failed ? /* @__PURE__ */ jsx2(CircleAlertIcon, { className: "size-4.5 text-og-danger" }) : /* @__PURE__ */ jsx2(LoaderCircleIcon, { className: "size-4.5 animate-spin" }) }),
|
|
2994
|
+
/* @__PURE__ */ jsx2("p", { className: "mt-3 text-og-menu font-medium text-og-fg", children: label }),
|
|
2995
|
+
/* @__PURE__ */ jsx2("p", { className: "mt-1 text-og-control leading-5 text-og-fg-muted", children: detail }),
|
|
2996
|
+
failed || props.session.lifecycle === "suspended" && !props.attempt?.running ? /* @__PURE__ */ jsx2(
|
|
2333
2997
|
"button",
|
|
2334
2998
|
{
|
|
2335
2999
|
type: "button",
|
|
2336
3000
|
onClick: props.onResume,
|
|
2337
|
-
className: "mt-4 inline-flex h-8 items-center rounded-og-sm border border-og-border bg-og-
|
|
2338
|
-
children: "
|
|
3001
|
+
className: "mt-4 inline-flex h-8 items-center rounded-og-sm border border-og-primary-border bg-og-primary px-3 text-og-control font-medium text-og-primary-fg transition hover:bg-og-primary-hover",
|
|
3002
|
+
children: t("browserViewer.openBrowser")
|
|
2339
3003
|
}
|
|
2340
3004
|
) : null
|
|
2341
3005
|
] }) });
|
|
2342
3006
|
}
|
|
2343
3007
|
function BrowserToolbar(props) {
|
|
2344
|
-
const
|
|
3008
|
+
const t = useOpenGeniText();
|
|
3009
|
+
const detailsRef = useViewerMenuDismiss();
|
|
2345
3010
|
const selected = props.sessions.find((session) => session.id === props.selectedSessionId);
|
|
2346
3011
|
const current = props.sessions.filter((session) => props.relevantSessionIds.has(session.id));
|
|
2347
3012
|
const others = props.sessions.filter((session) => !props.relevantSessionIds.has(session.id));
|
|
@@ -2349,48 +3014,51 @@ function BrowserToolbar(props) {
|
|
|
2349
3014
|
props.onSelect(id);
|
|
2350
3015
|
detailsRef.current?.removeAttribute("open");
|
|
2351
3016
|
};
|
|
2352
|
-
return /* @__PURE__ */
|
|
2353
|
-
/* @__PURE__ */
|
|
2354
|
-
/* @__PURE__ */
|
|
2355
|
-
/* @__PURE__ */
|
|
2356
|
-
/* @__PURE__ */
|
|
2357
|
-
(props.interventionCounts.get(selected?.id ?? "") ?? 0) > 0 ? /* @__PURE__ */
|
|
2358
|
-
/* @__PURE__ */
|
|
3017
|
+
return /* @__PURE__ */ jsxs2("div", { className: "flex h-10 shrink-0 items-center gap-1.5 border-b border-og-border bg-og-surface-1 px-2", children: [
|
|
3018
|
+
/* @__PURE__ */ jsxs2("details", { ref: detailsRef, className: "min-w-0", children: [
|
|
3019
|
+
/* @__PURE__ */ jsxs2("summary", { className: "flex h-7 max-w-52 cursor-pointer list-none items-center gap-2 rounded-og-sm px-2 text-og-control text-og-fg transition hover:bg-og-surface-2 [&::-webkit-details-marker]:hidden", children: [
|
|
3020
|
+
/* @__PURE__ */ jsx2(Globe2Icon, { className: "size-3.5 shrink-0 text-og-fg-muted" }),
|
|
3021
|
+
/* @__PURE__ */ jsx2("span", { className: "truncate font-medium", children: selected?.name ?? t("browserViewer.browser") }),
|
|
3022
|
+
(props.interventionCounts.get(selected?.id ?? "") ?? 0) > 0 ? /* @__PURE__ */ jsx2("span", { className: "size-1.5 shrink-0 rounded-full bg-og-status-waiting" }) : null,
|
|
3023
|
+
/* @__PURE__ */ jsx2(ChevronDownIcon, { className: "size-3 shrink-0 text-og-fg-subtle" })
|
|
2359
3024
|
] }),
|
|
2360
|
-
/* @__PURE__ */
|
|
2361
|
-
/* @__PURE__ */
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
3025
|
+
/* @__PURE__ */ jsxs2("div", { className: "absolute left-2 top-10 z-30 flex max-h-[calc(100%-3rem)] w-72 max-w-[calc(100%-1rem)] flex-col overflow-hidden rounded-og-md border border-og-border bg-og-surface-1 p-1 shadow-xl", children: [
|
|
3026
|
+
/* @__PURE__ */ jsxs2("div", { className: "min-h-0 max-h-96 overflow-y-auto overscroll-contain", children: [
|
|
3027
|
+
/* @__PURE__ */ jsx2(
|
|
3028
|
+
BrowserSessionGroup,
|
|
3029
|
+
{
|
|
3030
|
+
label: t("browserViewer.currentAgent"),
|
|
3031
|
+
sessions: current,
|
|
3032
|
+
identities: props.identities,
|
|
3033
|
+
selectedId: props.selectedSessionId,
|
|
3034
|
+
interventionCounts: props.interventionCounts,
|
|
3035
|
+
onSelect: choose
|
|
3036
|
+
}
|
|
3037
|
+
),
|
|
3038
|
+
/* @__PURE__ */ jsx2(
|
|
3039
|
+
BrowserSessionGroup,
|
|
3040
|
+
{
|
|
3041
|
+
label: t("browserViewer.workspaceBrowsers"),
|
|
3042
|
+
sessions: others,
|
|
3043
|
+
identities: props.identities,
|
|
3044
|
+
selectedId: props.selectedSessionId,
|
|
3045
|
+
interventionCounts: props.interventionCounts,
|
|
3046
|
+
onSelect: choose
|
|
3047
|
+
}
|
|
3048
|
+
)
|
|
3049
|
+
] }),
|
|
3050
|
+
/* @__PURE__ */ jsxs2("div", { className: "mt-1 flex shrink-0 gap-1 border-t border-og-border pt-1", children: [
|
|
3051
|
+
current.length > 0 ? /* @__PURE__ */ jsx2(MenuButton, { onClick: props.onFollow, children: t("browserViewer.followAgent") }) : null,
|
|
3052
|
+
/* @__PURE__ */ jsxs2(MenuButton, { onClick: () => props.onCreate(), disabled: props.creating, children: [
|
|
3053
|
+
/* @__PURE__ */ jsx2(PlusIcon, { className: "size-3.5" }),
|
|
3054
|
+
" ",
|
|
3055
|
+
t("browserViewer.newBrowser")
|
|
2388
3056
|
] })
|
|
2389
3057
|
] })
|
|
2390
3058
|
] })
|
|
2391
3059
|
] }),
|
|
2392
|
-
/* @__PURE__ */
|
|
2393
|
-
/* @__PURE__ */
|
|
3060
|
+
/* @__PURE__ */ jsx2("span", { className: "min-w-0 flex-1 truncate text-og-xs text-og-fg-subtle", children: placementLabel(t, selected) }),
|
|
3061
|
+
/* @__PURE__ */ jsx2(
|
|
2394
3062
|
BrowserProfileMenu,
|
|
2395
3063
|
{
|
|
2396
3064
|
session: selected ?? null,
|
|
@@ -2404,17 +3072,17 @@ function BrowserToolbar(props) {
|
|
|
2404
3072
|
onOpenVersion: props.onOpenProfileVersion
|
|
2405
3073
|
}
|
|
2406
3074
|
),
|
|
2407
|
-
/* @__PURE__ */
|
|
3075
|
+
/* @__PURE__ */ jsx2(
|
|
2408
3076
|
"button",
|
|
2409
3077
|
{
|
|
2410
3078
|
type: "button",
|
|
2411
3079
|
onClick: props.onRefresh,
|
|
2412
|
-
className: "grid size-7 place-items-center rounded-og-sm text-og-muted transition hover:bg-og-surface-2 hover:text-og-fg",
|
|
2413
|
-
"aria-label": "
|
|
2414
|
-
children: /* @__PURE__ */
|
|
3080
|
+
className: "grid size-7 shrink-0 place-items-center rounded-og-sm text-og-fg-muted transition hover:bg-og-surface-2 hover:text-og-fg",
|
|
3081
|
+
"aria-label": t("browserViewer.refreshBrowsers"),
|
|
3082
|
+
children: /* @__PURE__ */ jsx2(RefreshCwIcon, { className: cn("size-3.5", props.refreshing && "animate-spin") })
|
|
2415
3083
|
}
|
|
2416
3084
|
),
|
|
2417
|
-
/* @__PURE__ */
|
|
3085
|
+
/* @__PURE__ */ jsx2(
|
|
2418
3086
|
BrowserLaunchMenu,
|
|
2419
3087
|
{
|
|
2420
3088
|
attachedBridges: props.attachedBridges,
|
|
@@ -2430,43 +3098,57 @@ function BrowserToolbar(props) {
|
|
|
2430
3098
|
] });
|
|
2431
3099
|
}
|
|
2432
3100
|
function BrowserUnselectedPanel(props) {
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
/* @__PURE__ */
|
|
2436
|
-
/* @__PURE__ */
|
|
2437
|
-
/* @__PURE__ */
|
|
3101
|
+
const t = useOpenGeniText();
|
|
3102
|
+
return /* @__PURE__ */ jsx2("div", { className: "grid min-h-0 flex-1 place-items-center bg-og-bg p-6 text-center", children: /* @__PURE__ */ jsxs2("div", { className: "max-w-sm", children: [
|
|
3103
|
+
/* @__PURE__ */ jsx2("span", { className: "mx-auto grid size-10 place-items-center rounded-og-md border border-og-border bg-og-surface-1 text-og-fg-muted", children: /* @__PURE__ */ jsx2(Globe2Icon, { className: "size-4.5" }) }),
|
|
3104
|
+
props.unavailableBrowser ? /* @__PURE__ */ jsx2(BrowserUnavailableNotice, { session: props.unavailableBrowser }) : /* @__PURE__ */ jsx2("p", { className: "mt-3 text-og-menu font-medium text-og-fg", children: t("browserViewer.noBrowserForThisAgent") }),
|
|
3105
|
+
/* @__PURE__ */ jsx2("p", { className: "mt-1 text-og-control leading-5 text-og-fg-muted", children: props.peerCount === 1 ? t("browserViewer.oneWorkspaceBrowserIsAvailable") : t("browserViewer.peercountWorkspaceBrowsersAreAvailable", {
|
|
3106
|
+
peerCount: props.peerCount
|
|
3107
|
+
}) }),
|
|
3108
|
+
/* @__PURE__ */ jsxs2(
|
|
2438
3109
|
"button",
|
|
2439
3110
|
{
|
|
2440
3111
|
type: "button",
|
|
2441
3112
|
disabled: props.creating,
|
|
2442
3113
|
onClick: props.onCreate,
|
|
2443
|
-
className: "mt-4 inline-flex h-8 items-center gap-1.5 rounded-og-sm border border-og-border bg-og-
|
|
3114
|
+
className: "mt-4 inline-flex h-8 items-center gap-1.5 rounded-og-sm border border-og-primary-border bg-og-primary px-3 text-og-control font-medium text-og-primary-fg transition hover:bg-og-primary-hover disabled:cursor-not-allowed disabled:opacity-50",
|
|
2444
3115
|
children: [
|
|
2445
|
-
/* @__PURE__ */
|
|
2446
|
-
props.creating ? "
|
|
3116
|
+
/* @__PURE__ */ jsx2(PlusIcon, { className: "size-3.5" }),
|
|
3117
|
+
props.creating ? t("browserViewer.opening") : t("browserViewer.newBrowser")
|
|
2447
3118
|
]
|
|
2448
3119
|
}
|
|
2449
3120
|
)
|
|
2450
3121
|
] }) });
|
|
2451
3122
|
}
|
|
3123
|
+
function BrowserUnavailableNotice({ session }) {
|
|
3124
|
+
const t = useOpenGeniText();
|
|
3125
|
+
const reason = session.failureCode === "provider_deadline_rotation" ? t("browserViewer.theComputerRunningItReached") : session.failureCode === "source_placement_changed" ? t("browserViewer.thisChatMovedToAnother") : session.failureCode === "idle_released" ? t("browserViewer.itStoppedAfterItWent") : session.lifecycle === "failed" ? t("browserViewer.itStoppedUnexpectedly") : t("browserViewer.theConnectionToItWas");
|
|
3126
|
+
return /* @__PURE__ */ jsxs2("div", { role: "status", children: [
|
|
3127
|
+
/* @__PURE__ */ jsx2("p", { className: "mt-3 text-og-menu font-medium text-og-fg", children: t("browserViewer.browserUnavailable") }),
|
|
3128
|
+
/* @__PURE__ */ jsx2("p", { className: "mt-1 break-words text-og-control leading-5 text-og-fg-muted", children: t("browserViewer.nameReasonOpenANew", { name: session.name, reason }) })
|
|
3129
|
+
] });
|
|
3130
|
+
}
|
|
2452
3131
|
function BrowserSessionGroup(props) {
|
|
3132
|
+
const t = useOpenGeniText();
|
|
2453
3133
|
if (props.sessions.length === 0) return null;
|
|
2454
|
-
return /* @__PURE__ */
|
|
2455
|
-
/* @__PURE__ */
|
|
3134
|
+
return /* @__PURE__ */ jsxs2("div", { className: "py-1", children: [
|
|
3135
|
+
/* @__PURE__ */ jsx2("p", { className: "px-2 pb-1 text-[10px] font-medium uppercase tracking-[0.12em] text-og-fg-subtle", children: props.label }),
|
|
2456
3136
|
props.sessions.map((session) => {
|
|
2457
3137
|
const identity = props.identities.find((candidate) => candidate.id === session.identityId);
|
|
2458
3138
|
const interventionCount = props.interventionCounts.get(session.id) ?? 0;
|
|
2459
|
-
return /* @__PURE__ */
|
|
3139
|
+
return /* @__PURE__ */ jsxs2(
|
|
2460
3140
|
"button",
|
|
2461
3141
|
{
|
|
2462
3142
|
type: "button",
|
|
3143
|
+
"aria-label": `${session.name}${identity ? ` \xB7 ${identity.name}` : ""} \xB7 ${placementLabel(t, session)}`,
|
|
3144
|
+
"aria-pressed": session.id === props.selectedId,
|
|
2463
3145
|
onClick: () => props.onSelect(session.id),
|
|
2464
3146
|
className: cn(
|
|
2465
3147
|
"flex w-full items-center gap-2 rounded-og-sm px-2 py-1.5 text-left transition hover:bg-og-surface-2",
|
|
2466
3148
|
session.id === props.selectedId && "bg-og-surface-2"
|
|
2467
3149
|
),
|
|
2468
3150
|
children: [
|
|
2469
|
-
/* @__PURE__ */
|
|
3151
|
+
/* @__PURE__ */ jsx2(
|
|
2470
3152
|
"span",
|
|
2471
3153
|
{
|
|
2472
3154
|
className: cn(
|
|
@@ -2475,14 +3157,14 @@ function BrowserSessionGroup(props) {
|
|
|
2475
3157
|
)
|
|
2476
3158
|
}
|
|
2477
3159
|
),
|
|
2478
|
-
/* @__PURE__ */
|
|
2479
|
-
/* @__PURE__ */
|
|
2480
|
-
/* @__PURE__ */
|
|
3160
|
+
/* @__PURE__ */ jsxs2("span", { className: "min-w-0 flex-1", children: [
|
|
3161
|
+
/* @__PURE__ */ jsx2("span", { className: "block truncate text-og-control text-og-fg", children: session.name }),
|
|
3162
|
+
/* @__PURE__ */ jsxs2("span", { className: "block truncate text-og-xs text-og-fg-subtle", children: [
|
|
2481
3163
|
identity ? `${identity.name} \xB7 ` : "",
|
|
2482
|
-
placementLabel(session)
|
|
3164
|
+
placementLabel(t, session)
|
|
2483
3165
|
] })
|
|
2484
3166
|
] }),
|
|
2485
|
-
interventionCount > 0 ? /* @__PURE__ */
|
|
3167
|
+
interventionCount > 0 ? /* @__PURE__ */ jsx2("span", { className: "rounded-full bg-og-status-waiting/12 px-1.5 py-0.5 text-[10px] font-medium text-og-status-waiting", children: interventionCount }) : null
|
|
2486
3168
|
]
|
|
2487
3169
|
},
|
|
2488
3170
|
session.id
|
|
@@ -2491,7 +3173,8 @@ function BrowserSessionGroup(props) {
|
|
|
2491
3173
|
] });
|
|
2492
3174
|
}
|
|
2493
3175
|
function BrowserLaunchMenu(props) {
|
|
2494
|
-
const
|
|
3176
|
+
const t = useOpenGeniText();
|
|
3177
|
+
const detailsRef = useViewerMenuDismiss();
|
|
2495
3178
|
const choose = (choice) => {
|
|
2496
3179
|
detailsRef.current?.removeAttribute("open");
|
|
2497
3180
|
props.onCreate(choice);
|
|
@@ -2502,61 +3185,57 @@ function BrowserLaunchMenu(props) {
|
|
|
2502
3185
|
const busy = props.creating || props.mutatingProfile;
|
|
2503
3186
|
const activeIdentities = props.identities.filter((identity) => identity.status === "active");
|
|
2504
3187
|
const archivedIdentities = props.identities.filter((identity) => identity.status === "archived");
|
|
2505
|
-
return /* @__PURE__ */
|
|
2506
|
-
/* @__PURE__ */
|
|
3188
|
+
return /* @__PURE__ */ jsxs2("details", { ref: detailsRef, className: cn(props.prominent && "mt-4 inline-block"), children: [
|
|
3189
|
+
/* @__PURE__ */ jsxs2(
|
|
2507
3190
|
"summary",
|
|
2508
3191
|
{
|
|
2509
3192
|
onClick: (event) => {
|
|
2510
3193
|
if (busy) event.preventDefault();
|
|
2511
3194
|
},
|
|
2512
3195
|
className: cn(
|
|
2513
|
-
"cursor-pointer list-none items-center justify-center gap-1.5 text-og-muted transition hover:bg-og-surface-2 hover:text-og-fg [&::-webkit-details-marker]:hidden",
|
|
3196
|
+
"cursor-pointer list-none items-center justify-center gap-1.5 text-og-fg-muted transition hover:bg-og-surface-2 hover:text-og-fg [&::-webkit-details-marker]:hidden",
|
|
2514
3197
|
props.prominent ? "inline-flex h-8 rounded-og-sm border border-og-border bg-og-surface-1 px-3 text-og-control font-medium text-og-fg" : "grid size-7 place-items-center rounded-og-sm",
|
|
2515
3198
|
busy && "pointer-events-none opacity-50"
|
|
2516
3199
|
),
|
|
2517
|
-
"aria-label": "
|
|
3200
|
+
"aria-label": t("browserViewer.newBrowser"),
|
|
2518
3201
|
children: [
|
|
2519
|
-
busy ? /* @__PURE__ */
|
|
2520
|
-
props.prominent ? "
|
|
2521
|
-
props.prominent ? /* @__PURE__ */
|
|
3202
|
+
busy ? /* @__PURE__ */ jsx2(LoaderCircleIcon, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ jsx2(PlusIcon, { className: "size-3.5" }),
|
|
3203
|
+
props.prominent ? t("browserViewer.newBrowser") : null,
|
|
3204
|
+
props.prominent ? /* @__PURE__ */ jsx2(ChevronDownIcon, { className: "size-3" }) : null
|
|
2522
3205
|
]
|
|
2523
3206
|
}
|
|
2524
3207
|
),
|
|
2525
|
-
/* @__PURE__ */
|
|
3208
|
+
/* @__PURE__ */ jsxs2(
|
|
2526
3209
|
"div",
|
|
2527
3210
|
{
|
|
2528
3211
|
className: cn(
|
|
2529
|
-
"absolute z-40 w-72 overflow-
|
|
2530
|
-
props.prominent ? "left-1/2 top-
|
|
3212
|
+
"absolute z-40 max-h-[calc(100%-3rem)] w-72 max-w-[calc(100%-1rem)] overflow-y-auto rounded-og-md border border-og-border bg-og-surface-1 p-1 text-left shadow-xl",
|
|
3213
|
+
props.prominent ? "left-1/2 top-2 -translate-x-1/2" : "right-2 top-10"
|
|
2531
3214
|
),
|
|
2532
3215
|
children: [
|
|
2533
|
-
props.attachedDevices.length > 0 || props.attachedBridges.length > 0 ? /* @__PURE__ */
|
|
2534
|
-
/* @__PURE__ */
|
|
2535
|
-
props.attachedDevices.map((device) => /* @__PURE__ */
|
|
3216
|
+
props.attachedDevices.length > 0 || props.attachedBridges.length > 0 ? /* @__PURE__ */ jsxs2("div", { className: "pb-1", children: [
|
|
3217
|
+
/* @__PURE__ */ jsx2("p", { className: "px-2 pb-1 pt-1 text-[10px] font-medium uppercase tracking-[0.12em] text-og-fg-subtle", children: t("browserViewer.connectedChrome") }),
|
|
3218
|
+
props.attachedDevices.map((device) => /* @__PURE__ */ jsxs2(
|
|
2536
3219
|
"button",
|
|
2537
3220
|
{
|
|
2538
3221
|
type: "button",
|
|
2539
3222
|
onClick: () => choose({ kind: "attached", device }),
|
|
2540
3223
|
className: "flex w-full items-center gap-2 rounded-og-sm px-2 py-2 text-left transition hover:bg-og-surface-2",
|
|
2541
3224
|
children: [
|
|
2542
|
-
/* @__PURE__ */
|
|
2543
|
-
/* @__PURE__ */
|
|
2544
|
-
/* @__PURE__ */
|
|
2545
|
-
/* @__PURE__ */
|
|
2546
|
-
device.browserName,
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
" open",
|
|
2550
|
-
" ",
|
|
2551
|
-
device.tabCount === 1 ? "tab" : "tabs"
|
|
2552
|
-
] })
|
|
3225
|
+
/* @__PURE__ */ jsx2(MonitorIcon, { className: "size-3.5 shrink-0 text-og-fg-muted" }),
|
|
3226
|
+
/* @__PURE__ */ jsxs2("span", { className: "min-w-0 flex-1", children: [
|
|
3227
|
+
/* @__PURE__ */ jsx2("span", { className: "block truncate text-og-control text-og-fg", children: device.profileLabel ?? device.name }),
|
|
3228
|
+
/* @__PURE__ */ jsx2("span", { className: "block truncate text-og-xs text-og-fg-subtle", children: t("browserViewer.openTabs", {
|
|
3229
|
+
browserName: device.browserName,
|
|
3230
|
+
count: device.tabCount
|
|
3231
|
+
}) })
|
|
2553
3232
|
] }),
|
|
2554
|
-
/* @__PURE__ */
|
|
3233
|
+
/* @__PURE__ */ jsx2("span", { className: "size-1.5 shrink-0 rounded-full bg-og-status-running" })
|
|
2555
3234
|
]
|
|
2556
3235
|
},
|
|
2557
3236
|
device.id
|
|
2558
3237
|
)),
|
|
2559
|
-
props.attachedBridges.length > 0 ? props.setupUrl ? /* @__PURE__ */
|
|
3238
|
+
props.attachedBridges.length > 0 ? props.setupUrl ? /* @__PURE__ */ jsxs2(
|
|
2560
3239
|
"a",
|
|
2561
3240
|
{
|
|
2562
3241
|
href: props.setupUrl,
|
|
@@ -2565,70 +3244,70 @@ function BrowserLaunchMenu(props) {
|
|
|
2565
3244
|
onClick: () => detailsRef.current?.removeAttribute("open"),
|
|
2566
3245
|
className: "flex w-full items-center gap-2 rounded-og-sm px-2 py-2 text-left transition hover:bg-og-surface-2",
|
|
2567
3246
|
children: [
|
|
2568
|
-
/* @__PURE__ */
|
|
2569
|
-
/* @__PURE__ */
|
|
2570
|
-
/* @__PURE__ */
|
|
2571
|
-
/* @__PURE__ */
|
|
3247
|
+
/* @__PURE__ */ jsx2(PlusIcon, { className: "size-3.5 shrink-0 text-og-fg-muted" }),
|
|
3248
|
+
/* @__PURE__ */ jsxs2("span", { className: "min-w-0 flex-1", children: [
|
|
3249
|
+
/* @__PURE__ */ jsx2("span", { className: "block truncate text-og-control text-og-fg", children: props.attachedDevices.length > 0 ? t("browserViewer.connectAnotherChromeProfile") : t("browserViewer.connectThisChromeProfile") }),
|
|
3250
|
+
/* @__PURE__ */ jsx2("span", { className: "block truncate text-og-xs text-og-fg-subtle", children: t("browserViewer.machineConnectedChromeExtensionMissing") })
|
|
2572
3251
|
] })
|
|
2573
3252
|
]
|
|
2574
3253
|
}
|
|
2575
|
-
) : /* @__PURE__ */
|
|
2576
|
-
/* @__PURE__ */
|
|
2577
|
-
/* @__PURE__ */
|
|
2578
|
-
/* @__PURE__ */
|
|
2579
|
-
/* @__PURE__ */
|
|
3254
|
+
) : /* @__PURE__ */ jsxs2("div", { className: "flex w-full items-center gap-2 px-2 py-2 text-left", children: [
|
|
3255
|
+
/* @__PURE__ */ jsx2(MonitorIcon, { className: "size-3.5 shrink-0 text-og-fg-muted" }),
|
|
3256
|
+
/* @__PURE__ */ jsxs2("span", { className: "min-w-0 flex-1", children: [
|
|
3257
|
+
/* @__PURE__ */ jsx2("span", { className: "block truncate text-og-control text-og-fg", children: t("browserViewer.chromeConnectionReady") }),
|
|
3258
|
+
/* @__PURE__ */ jsx2("span", { className: "block text-og-xs leading-4 text-og-fg-subtle", children: t("browserViewer.installTheOpengeniBrowserExtension") })
|
|
2580
3259
|
] })
|
|
2581
3260
|
] }) : null
|
|
2582
3261
|
] }) : null,
|
|
2583
|
-
/* @__PURE__ */
|
|
3262
|
+
/* @__PURE__ */ jsx2(
|
|
2584
3263
|
"p",
|
|
2585
3264
|
{
|
|
2586
3265
|
className: cn(
|
|
2587
|
-
"px-2 pb-1 pt-1 text-[10px] font-medium uppercase tracking-[0.12em] text-og-subtle",
|
|
3266
|
+
"px-2 pb-1 pt-1 text-[10px] font-medium uppercase tracking-[0.12em] text-og-fg-subtle",
|
|
2588
3267
|
(props.attachedDevices.length > 0 || props.attachedBridges.length > 0) && "border-t border-og-border"
|
|
2589
3268
|
),
|
|
2590
|
-
children: "
|
|
3269
|
+
children: t("browserViewer.openIsolatedBrowser")
|
|
2591
3270
|
}
|
|
2592
3271
|
),
|
|
2593
|
-
/* @__PURE__ */
|
|
3272
|
+
/* @__PURE__ */ jsxs2(
|
|
2594
3273
|
"button",
|
|
2595
3274
|
{
|
|
2596
3275
|
type: "button",
|
|
2597
3276
|
onClick: () => choose({ kind: "clean" }),
|
|
2598
3277
|
className: "flex w-full items-center gap-2 rounded-og-sm px-2 py-2 text-left transition hover:bg-og-surface-2",
|
|
2599
3278
|
children: [
|
|
2600
|
-
/* @__PURE__ */
|
|
2601
|
-
/* @__PURE__ */
|
|
2602
|
-
/* @__PURE__ */
|
|
2603
|
-
/* @__PURE__ */
|
|
3279
|
+
/* @__PURE__ */ jsx2(Globe2Icon, { className: "size-3.5 text-og-fg-muted" }),
|
|
3280
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
3281
|
+
/* @__PURE__ */ jsx2("span", { className: "block text-og-control text-og-fg", children: t("browserViewer.freshBrowser") }),
|
|
3282
|
+
/* @__PURE__ */ jsx2("span", { className: "block text-og-xs text-og-fg-subtle", children: t("browserViewer.visualBrowserNoSavedState") })
|
|
2604
3283
|
] })
|
|
2605
3284
|
]
|
|
2606
3285
|
}
|
|
2607
3286
|
),
|
|
2608
|
-
activeIdentities.length > 0 ? /* @__PURE__ */
|
|
3287
|
+
activeIdentities.length > 0 ? /* @__PURE__ */ jsx2("div", { className: "mt-1 border-t border-og-border pt-1", children: activeIdentities.map((identity) => /* @__PURE__ */ jsxs2(
|
|
2609
3288
|
"button",
|
|
2610
3289
|
{
|
|
2611
3290
|
type: "button",
|
|
2612
3291
|
onClick: () => choose({ kind: "profile", identityId: identity.id }),
|
|
2613
3292
|
className: "flex w-full items-center gap-2 rounded-og-sm px-2 py-2 text-left transition hover:bg-og-surface-2",
|
|
2614
3293
|
children: [
|
|
2615
|
-
/* @__PURE__ */
|
|
2616
|
-
/* @__PURE__ */
|
|
2617
|
-
/* @__PURE__ */
|
|
2618
|
-
/* @__PURE__ */
|
|
3294
|
+
/* @__PURE__ */ jsx2(UserRoundIcon, { className: "size-3.5 text-og-fg-muted" }),
|
|
3295
|
+
/* @__PURE__ */ jsxs2("span", { className: "min-w-0", children: [
|
|
3296
|
+
/* @__PURE__ */ jsx2("span", { className: "block truncate text-og-control text-og-fg", children: identity.name }),
|
|
3297
|
+
/* @__PURE__ */ jsx2("span", { className: "block text-og-xs text-og-fg-subtle", children: identity.defaultRevisionId ? t("browserViewer.savedVersions", { count: identity.revisionCount }) : t("browserViewer.readyForFirstSignIn") })
|
|
2619
3298
|
] })
|
|
2620
3299
|
]
|
|
2621
3300
|
},
|
|
2622
3301
|
identity.id
|
|
2623
3302
|
)) }) : null,
|
|
2624
|
-
archivedIdentities.length > 0 ? /* @__PURE__ */
|
|
2625
|
-
/* @__PURE__ */
|
|
2626
|
-
/* @__PURE__ */
|
|
2627
|
-
"
|
|
2628
|
-
archivedIdentities.length,
|
|
2629
|
-
/* @__PURE__ */
|
|
3303
|
+
archivedIdentities.length > 0 ? /* @__PURE__ */ jsxs2("details", { className: "mt-1 border-t border-og-border pt-1", children: [
|
|
3304
|
+
/* @__PURE__ */ jsxs2("summary", { className: "flex cursor-pointer list-none items-center gap-1.5 rounded-og-sm px-2 py-1.5 text-og-xs text-og-fg-subtle transition hover:bg-og-surface-2 hover:text-og-fg [&::-webkit-details-marker]:hidden", children: [
|
|
3305
|
+
/* @__PURE__ */ jsx2(ArchiveIcon, { className: "size-3" }),
|
|
3306
|
+
" ",
|
|
3307
|
+
t("browserViewer.hiddenProfilesLength", { length: archivedIdentities.length }),
|
|
3308
|
+
/* @__PURE__ */ jsx2(ChevronDownIcon, { className: "ml-auto size-3" })
|
|
2630
3309
|
] }),
|
|
2631
|
-
archivedIdentities.map((identity) => /* @__PURE__ */
|
|
3310
|
+
archivedIdentities.map((identity) => /* @__PURE__ */ jsxs2(
|
|
2632
3311
|
"button",
|
|
2633
3312
|
{
|
|
2634
3313
|
type: "button",
|
|
@@ -2636,11 +3315,8 @@ function BrowserLaunchMenu(props) {
|
|
|
2636
3315
|
onClick: () => void restore(identity),
|
|
2637
3316
|
className: "flex w-full items-center gap-2 rounded-og-sm px-2 py-2 text-left transition hover:bg-og-surface-2 disabled:opacity-50",
|
|
2638
3317
|
children: [
|
|
2639
|
-
/* @__PURE__ */
|
|
2640
|
-
/* @__PURE__ */
|
|
2641
|
-
"Restore ",
|
|
2642
|
-
identity.name
|
|
2643
|
-
] })
|
|
3318
|
+
/* @__PURE__ */ jsx2(RotateCcwIcon, { className: "size-3.5 text-og-fg-muted" }),
|
|
3319
|
+
/* @__PURE__ */ jsx2("span", { className: "min-w-0 flex-1 truncate text-og-control text-og-fg", children: t("browserViewer.restoreName", { name: identity.name }) })
|
|
2644
3320
|
]
|
|
2645
3321
|
},
|
|
2646
3322
|
identity.id
|
|
@@ -2652,9 +3328,10 @@ function BrowserLaunchMenu(props) {
|
|
|
2652
3328
|
] });
|
|
2653
3329
|
}
|
|
2654
3330
|
function BrowserProfileMenu(props) {
|
|
2655
|
-
const
|
|
3331
|
+
const t = useOpenGeniText();
|
|
3332
|
+
const detailsRef = useViewerMenuDismiss();
|
|
2656
3333
|
const nameInputId = useId();
|
|
2657
|
-
const [name, setName] =
|
|
3334
|
+
const [name, setName] = useState9("");
|
|
2658
3335
|
const attached = props.session?.placement.kind === "attached_device";
|
|
2659
3336
|
const canSave = (props.session?.capabilities.identityPublication ?? false) && props.identity?.status !== "archived";
|
|
2660
3337
|
const revisions = props.identity && props.history?.identityId === props.identity.id ? [...props.history.revisions].sort((left, right) => right.ordinal - left.ordinal) : [];
|
|
@@ -2669,66 +3346,74 @@ function BrowserProfileMenu(props) {
|
|
|
2669
3346
|
props.onOpenVersion(identityId, baseRevisionId);
|
|
2670
3347
|
};
|
|
2671
3348
|
const versionLabel = attached ? "live" : props.identity ? props.baseRevisionOrdinal ? `v${props.baseRevisionOrdinal}` : props.session?.baseRevisionId ? "saved" : "unsaved" : "temporary";
|
|
2672
|
-
return /* @__PURE__ */
|
|
2673
|
-
/* @__PURE__ */
|
|
2674
|
-
props.saving ? /* @__PURE__ */
|
|
2675
|
-
/* @__PURE__ */
|
|
2676
|
-
attached || props.identity ? /* @__PURE__ */
|
|
3349
|
+
return /* @__PURE__ */ jsxs2("details", { ref: detailsRef, className: "min-w-0", children: [
|
|
3350
|
+
/* @__PURE__ */ jsxs2("summary", { className: "flex h-7 max-w-40 cursor-pointer list-none items-center gap-1.5 rounded-og-sm px-2 text-og-xs text-og-fg-muted transition hover:bg-og-surface-2 hover:text-og-fg [&::-webkit-details-marker]:hidden", children: [
|
|
3351
|
+
props.saving ? /* @__PURE__ */ jsx2(LoaderCircleIcon, { className: "size-3 animate-spin" }) : attached ? /* @__PURE__ */ jsx2(MonitorIcon, { className: "size-3" }) : /* @__PURE__ */ jsx2(UserRoundIcon, { className: "size-3" }),
|
|
3352
|
+
/* @__PURE__ */ jsx2("span", { className: "truncate", children: attached ? props.session?.name : props.identity?.name ?? t("browserViewer.temporary") }),
|
|
3353
|
+
attached || props.identity ? /* @__PURE__ */ jsxs2("span", { className: "shrink-0 text-og-fg-subtle", children: [
|
|
2677
3354
|
"\xB7 ",
|
|
2678
3355
|
versionLabel
|
|
2679
3356
|
] }) : null,
|
|
2680
|
-
/* @__PURE__ */
|
|
3357
|
+
/* @__PURE__ */ jsx2(ChevronDownIcon, { className: "size-3 shrink-0 text-og-fg-subtle" })
|
|
2681
3358
|
] }),
|
|
2682
|
-
/* @__PURE__ */
|
|
2683
|
-
/* @__PURE__ */
|
|
2684
|
-
/* @__PURE__ */
|
|
2685
|
-
/* @__PURE__ */
|
|
2686
|
-
/* @__PURE__ */
|
|
2687
|
-
/* @__PURE__ */
|
|
3359
|
+
/* @__PURE__ */ jsxs2("div", { className: "absolute right-2 top-10 z-40 max-h-[calc(100%-3rem)] w-72 max-w-[calc(100%-1rem)] overflow-y-auto rounded-og-md border border-og-border bg-og-surface-1 p-3 shadow-xl", children: [
|
|
3360
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-start gap-2", children: [
|
|
3361
|
+
/* @__PURE__ */ jsx2("span", { className: "grid size-7 shrink-0 place-items-center rounded-og-sm bg-og-surface-2 text-og-fg-muted", children: attached ? /* @__PURE__ */ jsx2(MonitorIcon, { className: "size-3.5" }) : /* @__PURE__ */ jsx2(UserRoundIcon, { className: "size-3.5" }) }),
|
|
3362
|
+
/* @__PURE__ */ jsxs2("div", { className: "min-w-0", children: [
|
|
3363
|
+
/* @__PURE__ */ jsx2("p", { className: "truncate text-og-control font-medium text-og-fg", children: attached ? props.session?.name : props.identity?.name ?? t("browserViewer.temporaryBrowser") }),
|
|
3364
|
+
/* @__PURE__ */ jsx2("p", { className: "mt-0.5 text-og-xs leading-4 text-og-fg-subtle", children: attached ? t("browserViewer.thisSessionDrivesTheExisting") : props.identity?.status === "archived" ? t("browserViewer.hiddenFromNewBrowsersThis") : props.identity ? props.baseRevisionOrdinal ? t("browserViewer.startedFromVersionBaserevisionordinal", {
|
|
3365
|
+
baseRevisionOrdinal: props.baseRevisionOrdinal
|
|
3366
|
+
}) : t("browserViewer.notSavedYet") : t("browserViewer.thisBrowserIsNotReusable") })
|
|
2688
3367
|
] })
|
|
2689
3368
|
] }),
|
|
2690
|
-
props.identity && revisions.length > 0 ? /* @__PURE__ */
|
|
2691
|
-
/* @__PURE__ */
|
|
2692
|
-
/* @__PURE__ */
|
|
3369
|
+
props.identity && revisions.length > 0 ? /* @__PURE__ */ jsxs2("div", { className: "mt-3 border-t border-og-border pt-2", children: [
|
|
3370
|
+
/* @__PURE__ */ jsx2("p", { className: "px-1 text-[10px] font-medium uppercase tracking-[0.12em] text-og-fg-subtle", children: t("browserViewer.savedVersions2") }),
|
|
3371
|
+
/* @__PURE__ */ jsx2("div", { className: "mt-1 max-h-40 overflow-y-auto", children: revisions.map((revision) => {
|
|
2693
3372
|
const isDefault = revision.id === props.identity?.defaultRevisionId;
|
|
2694
3373
|
const isCurrent = revision.ordinal === props.baseRevisionOrdinal;
|
|
2695
|
-
const materialization = revisionMaterializationSummary(revision);
|
|
2696
|
-
return /* @__PURE__ */
|
|
3374
|
+
const materialization = revisionMaterializationSummary(t, revision);
|
|
3375
|
+
return /* @__PURE__ */ jsxs2(
|
|
2697
3376
|
"div",
|
|
2698
3377
|
{
|
|
2699
3378
|
className: "flex w-full items-center gap-1 rounded-og-sm transition hover:bg-og-surface-2",
|
|
2700
3379
|
children: [
|
|
2701
|
-
/* @__PURE__ */
|
|
3380
|
+
/* @__PURE__ */ jsxs2(
|
|
2702
3381
|
"button",
|
|
2703
3382
|
{
|
|
2704
3383
|
type: "button",
|
|
2705
3384
|
disabled: props.saving || props.identity?.status === "archived",
|
|
2706
|
-
"aria-label":
|
|
3385
|
+
"aria-label": t("browserViewer.openNameVersionOrdinal", {
|
|
3386
|
+
name: props.identity.name,
|
|
3387
|
+
ordinal: revision.ordinal
|
|
3388
|
+
}),
|
|
2707
3389
|
onClick: () => openVersion(props.identity.id, revision.id),
|
|
2708
3390
|
className: "flex min-w-0 flex-1 items-center gap-2 px-2 py-1.5 text-left disabled:opacity-50",
|
|
2709
3391
|
children: [
|
|
2710
|
-
/* @__PURE__ */
|
|
2711
|
-
/* @__PURE__ */
|
|
2712
|
-
/* @__PURE__ */
|
|
2713
|
-
|
|
2714
|
-
revision.ordinal
|
|
2715
|
-
] }),
|
|
2716
|
-
/* @__PURE__ */ jsx("span", { className: "block truncate text-[10px] text-og-subtle", children: materialization.label })
|
|
3392
|
+
/* @__PURE__ */ jsx2("span", { className: "grid size-4 place-items-center text-og-fg-muted", children: isCurrent ? /* @__PURE__ */ jsx2(CheckIcon, { className: "size-3.5 text-og-accent" }) : null }),
|
|
3393
|
+
/* @__PURE__ */ jsxs2("span", { className: "min-w-0 flex-1", children: [
|
|
3394
|
+
/* @__PURE__ */ jsx2("span", { className: "block text-og-control text-og-fg", children: t("browserViewer.versionOrdinal", { ordinal: revision.ordinal }) }),
|
|
3395
|
+
/* @__PURE__ */ jsx2("span", { className: "block truncate text-[10px] text-og-fg-subtle", children: materialization.label })
|
|
2717
3396
|
] }),
|
|
2718
|
-
isCurrent ? /* @__PURE__ */
|
|
3397
|
+
isCurrent ? /* @__PURE__ */ jsx2("span", { className: "text-[10px] text-og-fg-subtle", children: t("browserViewer.current") }) : null
|
|
2719
3398
|
]
|
|
2720
3399
|
}
|
|
2721
3400
|
),
|
|
2722
|
-
/* @__PURE__ */
|
|
3401
|
+
/* @__PURE__ */ jsx2(
|
|
2723
3402
|
"button",
|
|
2724
3403
|
{
|
|
2725
3404
|
type: "button",
|
|
2726
3405
|
disabled: isDefault || props.saving || props.identity?.status === "archived",
|
|
2727
|
-
"aria-label": isDefault ?
|
|
2728
|
-
|
|
3406
|
+
"aria-label": isDefault ? t("browserViewer.nameVersionOrdinalIsThe", {
|
|
3407
|
+
name: props.identity.name,
|
|
3408
|
+
ordinal: revision.ordinal
|
|
3409
|
+
}) : t("browserViewer.useNameVersionOrdinalBy", {
|
|
3410
|
+
name: props.identity.name,
|
|
3411
|
+
ordinal: revision.ordinal
|
|
3412
|
+
}),
|
|
3413
|
+
title: isDefault ? t("browserViewer.defaultVersion") : t("browserViewer.useByDefault"),
|
|
2729
3414
|
onClick: () => void props.onUpdate(props.identity, { defaultRevisionId: revision.id }),
|
|
2730
|
-
className: "mr-1 shrink-0 rounded-og-sm px-2 py-1 text-[10px] text-og-subtle transition hover:bg-og-surface-3 hover:text-og-fg disabled:cursor-default disabled:opacity-70",
|
|
2731
|
-
children: isDefault ? "
|
|
3415
|
+
className: "mr-1 shrink-0 rounded-og-sm px-2 py-1 text-[10px] text-og-fg-subtle transition hover:bg-og-surface-3 hover:text-og-fg disabled:cursor-default disabled:opacity-70",
|
|
3416
|
+
children: isDefault ? t("browserViewer.default") : t("browserViewer.makeDefault")
|
|
2732
3417
|
}
|
|
2733
3418
|
)
|
|
2734
3419
|
]
|
|
@@ -2736,24 +3421,25 @@ function BrowserProfileMenu(props) {
|
|
|
2736
3421
|
revision.id
|
|
2737
3422
|
);
|
|
2738
3423
|
}) }),
|
|
2739
|
-
/* @__PURE__ */
|
|
2740
|
-
] }) : props.identity && props.history?.identityId === props.identity.id && props.history.loading ? /* @__PURE__ */
|
|
2741
|
-
/* @__PURE__ */
|
|
2742
|
-
"
|
|
3424
|
+
/* @__PURE__ */ jsx2("p", { className: "mt-1 px-2 text-[10px] leading-4 text-og-fg-subtle", children: t("browserViewer.changingTheDefaultAffectsOnly") })
|
|
3425
|
+
] }) : props.identity && props.history?.identityId === props.identity.id && props.history.loading ? /* @__PURE__ */ jsxs2("p", { className: "mt-3 flex items-center gap-1.5 border-t border-og-border px-2 pt-2 text-og-xs text-og-fg-subtle", children: [
|
|
3426
|
+
/* @__PURE__ */ jsx2(LoaderCircleIcon, { className: "size-3 animate-spin" }),
|
|
3427
|
+
" ",
|
|
3428
|
+
t("browserViewer.loadingSavedVersions")
|
|
2743
3429
|
] }) : null,
|
|
2744
|
-
props.identity && props.authConnections.length > 0 ? /* @__PURE__ */
|
|
2745
|
-
/* @__PURE__ */
|
|
2746
|
-
/* @__PURE__ */
|
|
2747
|
-
const health = siteAuthHealth(connection);
|
|
2748
|
-
return /* @__PURE__ */
|
|
3430
|
+
props.identity && props.authConnections.length > 0 ? /* @__PURE__ */ jsxs2("div", { className: "mt-3 border-t border-og-border pt-2", children: [
|
|
3431
|
+
/* @__PURE__ */ jsx2("p", { className: "px-1 text-[10px] font-medium uppercase tracking-[0.12em] text-og-fg-subtle", children: t("browserViewer.loginHealth") }),
|
|
3432
|
+
/* @__PURE__ */ jsx2("div", { className: "mt-1 space-y-1", children: props.authConnections.map((connection) => {
|
|
3433
|
+
const health = siteAuthHealth(t, connection);
|
|
3434
|
+
return /* @__PURE__ */ jsxs2(
|
|
2749
3435
|
"div",
|
|
2750
3436
|
{
|
|
2751
3437
|
className: "flex items-start gap-2 rounded-og-sm px-2 py-1.5",
|
|
2752
3438
|
children: [
|
|
2753
|
-
/* @__PURE__ */
|
|
2754
|
-
/* @__PURE__ */
|
|
2755
|
-
/* @__PURE__ */
|
|
2756
|
-
/* @__PURE__ */
|
|
3439
|
+
/* @__PURE__ */ jsx2("span", { className: cn("mt-1 size-1.5 shrink-0 rounded-full", health.dotClass) }),
|
|
3440
|
+
/* @__PURE__ */ jsxs2("span", { className: "min-w-0 flex-1", children: [
|
|
3441
|
+
/* @__PURE__ */ jsx2("span", { className: "block truncate text-og-control text-og-fg", children: connection.name }),
|
|
3442
|
+
/* @__PURE__ */ jsxs2("span", { className: "block truncate text-[10px] text-og-fg-subtle", children: [
|
|
2757
3443
|
connection.accountLabel,
|
|
2758
3444
|
" \xB7 ",
|
|
2759
3445
|
health.label
|
|
@@ -2765,7 +3451,7 @@ function BrowserProfileMenu(props) {
|
|
|
2765
3451
|
);
|
|
2766
3452
|
}) })
|
|
2767
3453
|
] }) : null,
|
|
2768
|
-
canSave ? props.identity ? /* @__PURE__ */
|
|
3454
|
+
canSave ? props.identity ? /* @__PURE__ */ jsxs2(
|
|
2769
3455
|
"button",
|
|
2770
3456
|
{
|
|
2771
3457
|
type: "button",
|
|
@@ -2773,11 +3459,11 @@ function BrowserProfileMenu(props) {
|
|
|
2773
3459
|
disabled: props.saving,
|
|
2774
3460
|
className: "mt-3 flex h-8 w-full items-center justify-center gap-1.5 rounded-og-sm border border-og-border bg-og-surface-2 px-3 text-og-control font-medium text-og-fg transition hover:bg-og-surface-3 disabled:opacity-50",
|
|
2775
3461
|
children: [
|
|
2776
|
-
props.saving ? /* @__PURE__ */
|
|
2777
|
-
props.saving ? "
|
|
3462
|
+
props.saving ? /* @__PURE__ */ jsx2(LoaderCircleIcon, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ jsx2(SaveIcon, { className: "size-3.5" }),
|
|
3463
|
+
props.saving ? t("browserViewer.savingBrowserVersion") : t("browserViewer.saveNewVersion")
|
|
2778
3464
|
]
|
|
2779
3465
|
}
|
|
2780
|
-
) : /* @__PURE__ */
|
|
3466
|
+
) : /* @__PURE__ */ jsxs2(
|
|
2781
3467
|
"form",
|
|
2782
3468
|
{
|
|
2783
3469
|
className: "mt-3",
|
|
@@ -2786,36 +3472,36 @@ function BrowserProfileMenu(props) {
|
|
|
2786
3472
|
if (name.trim()) void save(name);
|
|
2787
3473
|
},
|
|
2788
3474
|
children: [
|
|
2789
|
-
/* @__PURE__ */
|
|
2790
|
-
/* @__PURE__ */
|
|
2791
|
-
/* @__PURE__ */
|
|
3475
|
+
/* @__PURE__ */ jsx2("label", { className: "text-og-xs font-medium text-og-fg-muted", htmlFor: nameInputId, children: t("browserViewer.profileName") }),
|
|
3476
|
+
/* @__PURE__ */ jsxs2("div", { className: "mt-1 flex gap-1.5", children: [
|
|
3477
|
+
/* @__PURE__ */ jsx2(
|
|
2792
3478
|
"input",
|
|
2793
3479
|
{
|
|
2794
3480
|
id: nameInputId,
|
|
2795
3481
|
value: name,
|
|
2796
3482
|
onInput: (event) => setName(event.currentTarget.value),
|
|
2797
3483
|
maxLength: 200,
|
|
2798
|
-
placeholder: "
|
|
2799
|
-
className: "h-8 min-w-0 flex-1 rounded-og-sm border border-og-border bg-og-bg px-2 text-og-control text-og-fg placeholder:text-og-subtle focus:border-og-accent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent"
|
|
3484
|
+
placeholder: t("browserViewer.work"),
|
|
3485
|
+
className: "h-8 min-w-0 flex-1 rounded-og-sm border border-og-border bg-og-bg px-2 text-og-control text-og-fg placeholder:text-og-fg-subtle focus:border-og-accent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent"
|
|
2800
3486
|
}
|
|
2801
3487
|
),
|
|
2802
|
-
/* @__PURE__ */
|
|
3488
|
+
/* @__PURE__ */ jsxs2(
|
|
2803
3489
|
"button",
|
|
2804
3490
|
{
|
|
2805
3491
|
type: "submit",
|
|
2806
3492
|
disabled: !name.trim() || props.saving,
|
|
2807
|
-
className: "inline-flex h-8 items-center gap-1 rounded-og-sm bg-og-
|
|
3493
|
+
className: "inline-flex h-8 items-center gap-1 rounded-og-sm border border-og-primary-border bg-og-primary text-og-primary-fg px-2.5 text-og-control font-medium transition hover:bg-og-primary-hover disabled:opacity-50",
|
|
2808
3494
|
children: [
|
|
2809
|
-
props.saving ? /* @__PURE__ */
|
|
2810
|
-
"
|
|
3495
|
+
props.saving ? /* @__PURE__ */ jsx2(LoaderCircleIcon, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ jsx2(SaveIcon, { className: "size-3.5" }),
|
|
3496
|
+
t("browserViewer.save")
|
|
2811
3497
|
]
|
|
2812
3498
|
}
|
|
2813
3499
|
)
|
|
2814
3500
|
] })
|
|
2815
3501
|
]
|
|
2816
3502
|
}
|
|
2817
|
-
) : /* @__PURE__ */
|
|
2818
|
-
!attached && props.identity ? /* @__PURE__ */
|
|
3503
|
+
) : /* @__PURE__ */ jsx2("p", { className: "mt-3 rounded-og-sm bg-og-surface-2 px-2.5 py-2 text-og-xs text-og-fg-subtle", children: attached ? t("browserViewer.chromeKeepsThisProfileS") : props.identity?.status === "archived" ? t("browserViewer.restoreThisProfileBeforeSaving") : t("browserViewer.thisBrowserCannotSaveReusable") }),
|
|
3504
|
+
!attached && props.identity ? /* @__PURE__ */ jsxs2(
|
|
2819
3505
|
"button",
|
|
2820
3506
|
{
|
|
2821
3507
|
type: "button",
|
|
@@ -2823,25 +3509,25 @@ function BrowserProfileMenu(props) {
|
|
|
2823
3509
|
onClick: () => void props.onUpdate(props.identity, {
|
|
2824
3510
|
status: props.identity.status === "active" ? "archived" : "active"
|
|
2825
3511
|
}),
|
|
2826
|
-
className: "mt-2 flex h-8 w-full items-center justify-center gap-1.5 rounded-og-sm px-3 text-og-control text-og-muted transition hover:bg-og-surface-2 hover:text-og-fg disabled:opacity-50",
|
|
3512
|
+
className: "mt-2 flex h-8 w-full items-center justify-center gap-1.5 rounded-og-sm px-3 text-og-control text-og-fg-muted transition hover:bg-og-surface-2 hover:text-og-fg disabled:opacity-50",
|
|
2827
3513
|
children: [
|
|
2828
|
-
props.identity.status === "active" ? /* @__PURE__ */
|
|
2829
|
-
props.identity.status === "active" ? "
|
|
3514
|
+
props.identity.status === "active" ? /* @__PURE__ */ jsx2(ArchiveIcon, { className: "size-3.5" }) : /* @__PURE__ */ jsx2(RotateCcwIcon, { className: "size-3.5" }),
|
|
3515
|
+
props.identity.status === "active" ? t("browserViewer.hideFromNewBrowsers") : t("browserViewer.restoreProfile")
|
|
2830
3516
|
]
|
|
2831
3517
|
}
|
|
2832
3518
|
) : null,
|
|
2833
|
-
canSave ? /* @__PURE__ */
|
|
3519
|
+
canSave ? /* @__PURE__ */ jsx2("p", { className: "mt-2 text-[10px] leading-4 text-og-fg-subtle", children: t("browserViewer.savingRestartsThisBrowserSave") }) : null
|
|
2834
3520
|
] })
|
|
2835
3521
|
] });
|
|
2836
3522
|
}
|
|
2837
|
-
function revisionMaterializationSummary(revision) {
|
|
3523
|
+
function revisionMaterializationSummary(t, revision) {
|
|
2838
3524
|
const materializations = revision.components.map((component) => component.materialization);
|
|
2839
3525
|
const placementBound = materializations.find(
|
|
2840
3526
|
(materialization) => materialization.portability === "placement_bound"
|
|
2841
3527
|
);
|
|
2842
3528
|
if (placementBound) {
|
|
2843
3529
|
return {
|
|
2844
|
-
label: placementBound.reason ?
|
|
3530
|
+
label: placementBound.reason ? t("browserViewer.thisMachineOnlyReason", { reason: placementBound.reason }) : t("browserViewer.thisMachineOnly")
|
|
2845
3531
|
};
|
|
2846
3532
|
}
|
|
2847
3533
|
const providerBound = materializations.find(
|
|
@@ -2849,47 +3535,48 @@ function revisionMaterializationSummary(revision) {
|
|
|
2849
3535
|
);
|
|
2850
3536
|
if (providerBound) {
|
|
2851
3537
|
return {
|
|
2852
|
-
label: providerBound.reason ?
|
|
3538
|
+
label: providerBound.reason ? t("browserViewer.providerBoundReason", { reason: providerBound.reason }) : t("browserViewer.providerBound")
|
|
2853
3539
|
};
|
|
2854
3540
|
}
|
|
2855
|
-
return { label: "
|
|
3541
|
+
return { label: t("browserViewer.portableBrowserData") };
|
|
2856
3542
|
}
|
|
2857
|
-
function siteAuthHealth(connection) {
|
|
3543
|
+
function siteAuthHealth(t, connection) {
|
|
2858
3544
|
switch (connection.verificationState) {
|
|
2859
3545
|
case "verified":
|
|
2860
|
-
return { label: "
|
|
3546
|
+
return { label: t("browserViewer.verified"), dotClass: "bg-og-status-running" };
|
|
2861
3547
|
case "needs_repair":
|
|
2862
|
-
return { label: "
|
|
3548
|
+
return { label: t("browserViewer.signInNeedsAttention"), dotClass: "bg-og-status-waiting" };
|
|
2863
3549
|
case "failed":
|
|
2864
|
-
return { label: "
|
|
3550
|
+
return { label: t("browserViewer.verificationFailed"), dotClass: "bg-og-status-error" };
|
|
2865
3551
|
case "unknown":
|
|
2866
|
-
return { label: "
|
|
3552
|
+
return { label: t("browserViewer.notCheckedYet"), dotClass: "bg-og-muted" };
|
|
2867
3553
|
}
|
|
2868
3554
|
}
|
|
2869
3555
|
function MenuButton(props) {
|
|
2870
|
-
return /* @__PURE__ */
|
|
3556
|
+
return /* @__PURE__ */ jsx2(
|
|
2871
3557
|
"button",
|
|
2872
3558
|
{
|
|
2873
3559
|
type: "button",
|
|
2874
3560
|
onClick: props.onClick,
|
|
2875
3561
|
disabled: props.disabled,
|
|
2876
|
-
className: "flex h-7 flex-1 items-center justify-center gap-1 rounded-og-sm px-2 text-og-control text-og-muted transition hover:bg-og-surface-2 hover:text-og-fg disabled:opacity-50",
|
|
3562
|
+
className: "flex h-7 flex-1 items-center justify-center gap-1 rounded-og-sm px-2 text-og-control text-og-fg-muted transition hover:bg-og-surface-2 hover:text-og-fg disabled:opacity-50",
|
|
2877
3563
|
children: props.children
|
|
2878
3564
|
}
|
|
2879
3565
|
);
|
|
2880
3566
|
}
|
|
2881
3567
|
function BrowserTabs(props) {
|
|
3568
|
+
const t = useOpenGeniText();
|
|
2882
3569
|
const pages = props.targets.filter((target) => target.kind === "page" || target.kind === "popup");
|
|
2883
|
-
return /* @__PURE__ */
|
|
2884
|
-
pages.map((target) => /* @__PURE__ */
|
|
3570
|
+
return /* @__PURE__ */ jsxs2("div", { className: "flex h-9 shrink-0 items-end gap-px overflow-x-auto border-b border-og-border bg-og-surface-1 px-1 pt-1", children: [
|
|
3571
|
+
pages.map((target) => /* @__PURE__ */ jsxs2(
|
|
2885
3572
|
"div",
|
|
2886
3573
|
{
|
|
2887
3574
|
className: cn(
|
|
2888
3575
|
"group flex h-8 min-w-24 max-w-48 items-center rounded-t-og-sm border border-b-0 border-transparent px-2",
|
|
2889
|
-
target.id === props.selectedTargetId ? "border-og-border bg-og-bg text-og-fg" : "text-og-muted hover:bg-og-surface-1"
|
|
3576
|
+
target.id === props.selectedTargetId ? "border-og-border bg-og-bg text-og-fg" : "text-og-fg-muted hover:bg-og-surface-1"
|
|
2890
3577
|
),
|
|
2891
3578
|
children: [
|
|
2892
|
-
/* @__PURE__ */
|
|
3579
|
+
/* @__PURE__ */ jsx2(
|
|
2893
3580
|
"button",
|
|
2894
3581
|
{
|
|
2895
3582
|
type: "button",
|
|
@@ -2898,65 +3585,103 @@ function BrowserTabs(props) {
|
|
|
2898
3585
|
children: target.title || shortUrl(target.url)
|
|
2899
3586
|
}
|
|
2900
3587
|
),
|
|
2901
|
-
props.tabControl ? /* @__PURE__ */
|
|
3588
|
+
props.tabControl ? /* @__PURE__ */ jsx2(
|
|
2902
3589
|
"button",
|
|
2903
3590
|
{
|
|
2904
3591
|
type: "button",
|
|
2905
3592
|
onClick: () => props.onClose(target.id),
|
|
2906
3593
|
disabled: props.mutating,
|
|
2907
3594
|
className: "ml-1 grid size-4 shrink-0 place-items-center rounded opacity-0 transition hover:bg-og-surface-3 group-hover:opacity-100 focus:opacity-100 disabled:opacity-30",
|
|
2908
|
-
"aria-label":
|
|
2909
|
-
children: /* @__PURE__ */
|
|
3595
|
+
"aria-label": t("browserViewer.closeTitle", { title: target.title || "tab" }),
|
|
3596
|
+
children: /* @__PURE__ */ jsx2(XIcon, { className: "size-3" })
|
|
2910
3597
|
}
|
|
2911
3598
|
) : null
|
|
2912
3599
|
]
|
|
2913
3600
|
},
|
|
2914
3601
|
target.id
|
|
2915
3602
|
)),
|
|
2916
|
-
props.tabControl ? /* @__PURE__ */
|
|
3603
|
+
props.tabControl ? /* @__PURE__ */ jsx2(
|
|
2917
3604
|
"button",
|
|
2918
3605
|
{
|
|
2919
3606
|
type: "button",
|
|
2920
3607
|
onClick: props.onOpen,
|
|
2921
3608
|
disabled: props.mutating,
|
|
2922
|
-
className: "mb-1 grid size-6 shrink-0 place-items-center rounded-og-sm text-og-muted transition hover:bg-og-surface-2 hover:text-og-fg disabled:opacity-40",
|
|
2923
|
-
"aria-label": "
|
|
2924
|
-
children: /* @__PURE__ */
|
|
3609
|
+
className: "mb-1 grid size-6 shrink-0 place-items-center rounded-og-sm text-og-fg-muted transition hover:bg-og-surface-2 hover:text-og-fg disabled:opacity-40",
|
|
3610
|
+
"aria-label": t("browserViewer.newTab"),
|
|
3611
|
+
children: /* @__PURE__ */ jsx2(PlusIcon, { className: "size-3.5" })
|
|
2925
3612
|
}
|
|
2926
3613
|
) : null
|
|
2927
3614
|
] });
|
|
2928
3615
|
}
|
|
2929
3616
|
function BrowserAddressBar(props) {
|
|
2930
|
-
const
|
|
2931
|
-
const
|
|
2932
|
-
|
|
3617
|
+
const t = useOpenGeniText();
|
|
3618
|
+
const [draft, setDraft] = useState9(props.target?.url ?? "");
|
|
3619
|
+
const focusedRef = useRef9(false);
|
|
3620
|
+
const historyPendingRef = useRef9(false);
|
|
3621
|
+
const [historyPending, setHistoryPending] = useState9(false);
|
|
3622
|
+
useEffect9(() => {
|
|
2933
3623
|
if (!focusedRef.current) setDraft(props.target?.url ?? "");
|
|
2934
3624
|
}, [props.target?.id, props.target?.url]);
|
|
2935
3625
|
const submit = (event) => {
|
|
2936
3626
|
event.preventDefault();
|
|
3627
|
+
if (historyPendingRef.current) return;
|
|
2937
3628
|
const normalized = normalizeBrowserAddress(draft);
|
|
2938
3629
|
if (normalized) props.onNavigate(normalized);
|
|
2939
3630
|
};
|
|
2940
|
-
|
|
3631
|
+
const navigateHistory = async (direction) => {
|
|
3632
|
+
if (!props.target || props.loading || historyPendingRef.current) return;
|
|
3633
|
+
historyPendingRef.current = true;
|
|
3634
|
+
setHistoryPending(true);
|
|
3635
|
+
try {
|
|
3636
|
+
await props.onHistory(direction);
|
|
3637
|
+
} finally {
|
|
3638
|
+
historyPendingRef.current = false;
|
|
3639
|
+
setHistoryPending(false);
|
|
3640
|
+
}
|
|
3641
|
+
};
|
|
3642
|
+
return /* @__PURE__ */ jsxs2(
|
|
2941
3643
|
"form",
|
|
2942
3644
|
{
|
|
2943
3645
|
onSubmit: submit,
|
|
3646
|
+
"aria-busy": historyPending || void 0,
|
|
2944
3647
|
className: "flex h-10 shrink-0 items-center gap-1.5 border-b border-og-border bg-og-bg px-2",
|
|
2945
3648
|
children: [
|
|
2946
|
-
/* @__PURE__ */
|
|
3649
|
+
["back", "forward"].map((direction) => /* @__PURE__ */ jsx2(
|
|
2947
3650
|
"button",
|
|
2948
3651
|
{
|
|
2949
3652
|
type: "button",
|
|
2950
|
-
onClick:
|
|
3653
|
+
onClick: () => void navigateHistory(direction),
|
|
2951
3654
|
disabled: !props.target || props.loading,
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
3655
|
+
"aria-disabled": historyPending || void 0,
|
|
3656
|
+
className: cn(
|
|
3657
|
+
"grid size-7 shrink-0 place-items-center rounded-og-sm text-og-fg-muted transition hover:bg-og-surface-2 hover:text-og-fg focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent disabled:opacity-35",
|
|
3658
|
+
historyPending && "opacity-50"
|
|
3659
|
+
),
|
|
3660
|
+
"aria-label": direction === "back" ? t("browserViewer.back") : t("browserViewer.forward"),
|
|
3661
|
+
title: direction === "back" ? t("browserViewer.back") : t("browserViewer.forward"),
|
|
3662
|
+
children: direction === "back" ? /* @__PURE__ */ jsx2(ArrowLeftIcon, { className: "size-3.5" }) : /* @__PURE__ */ jsx2(ArrowRightIcon, { className: "size-3.5" })
|
|
3663
|
+
},
|
|
3664
|
+
direction
|
|
3665
|
+
)),
|
|
3666
|
+
/* @__PURE__ */ jsx2(
|
|
3667
|
+
"button",
|
|
3668
|
+
{
|
|
3669
|
+
type: "button",
|
|
3670
|
+
onClick: props.onReload,
|
|
3671
|
+
disabled: !props.target || props.loading || historyPending,
|
|
3672
|
+
className: "grid size-7 shrink-0 place-items-center rounded-og-sm text-og-fg-muted transition hover:bg-og-surface-2 hover:text-og-fg disabled:opacity-35",
|
|
3673
|
+
"aria-label": t("browserViewer.reload"),
|
|
3674
|
+
children: /* @__PURE__ */ jsx2(
|
|
3675
|
+
RefreshCwIcon,
|
|
3676
|
+
{
|
|
3677
|
+
className: cn("size-3.5", (props.loading || historyPending) && "animate-spin")
|
|
3678
|
+
}
|
|
3679
|
+
)
|
|
2955
3680
|
}
|
|
2956
3681
|
),
|
|
2957
|
-
/* @__PURE__ */
|
|
2958
|
-
/* @__PURE__ */
|
|
2959
|
-
/* @__PURE__ */
|
|
3682
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex h-7 min-w-0 flex-1 items-center gap-2 rounded-og-sm border border-og-border bg-og-surface-1 px-2 focus-within:border-og-accent/60", children: [
|
|
3683
|
+
/* @__PURE__ */ jsx2(Globe2Icon, { className: "size-3 shrink-0 text-og-fg-subtle" }),
|
|
3684
|
+
/* @__PURE__ */ jsx2(
|
|
2960
3685
|
"input",
|
|
2961
3686
|
{
|
|
2962
3687
|
value: draft,
|
|
@@ -2970,14 +3695,15 @@ function BrowserAddressBar(props) {
|
|
|
2970
3695
|
onKeyDown: (event) => {
|
|
2971
3696
|
if (event.key !== "Enter") return;
|
|
2972
3697
|
event.preventDefault();
|
|
3698
|
+
if (historyPendingRef.current) return;
|
|
2973
3699
|
const normalized = normalizeBrowserAddress(draft);
|
|
2974
3700
|
if (normalized) props.onNavigate(normalized);
|
|
2975
3701
|
},
|
|
2976
3702
|
disabled: !props.target,
|
|
2977
|
-
className: "min-w-0 flex-1 bg-transparent text-og-control text-og-fg placeholder:text-og-subtle focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent disabled:opacity-50",
|
|
2978
|
-
"aria-label": "
|
|
3703
|
+
className: "min-w-0 flex-1 bg-transparent text-og-control text-og-fg placeholder:text-og-fg-subtle focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent disabled:opacity-50",
|
|
3704
|
+
"aria-label": t("browserViewer.address"),
|
|
2979
3705
|
spellCheck: false,
|
|
2980
|
-
placeholder: "
|
|
3706
|
+
placeholder: t("browserViewer.searchOrEnterAddress")
|
|
2981
3707
|
}
|
|
2982
3708
|
)
|
|
2983
3709
|
] })
|
|
@@ -2986,24 +3712,49 @@ function BrowserAddressBar(props) {
|
|
|
2986
3712
|
);
|
|
2987
3713
|
}
|
|
2988
3714
|
function BrowserViewport(props) {
|
|
2989
|
-
const
|
|
2990
|
-
const
|
|
2991
|
-
const
|
|
2992
|
-
const
|
|
2993
|
-
const
|
|
2994
|
-
const
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
const
|
|
2999
|
-
const
|
|
3000
|
-
const
|
|
3001
|
-
const
|
|
3002
|
-
const
|
|
3003
|
-
const
|
|
3715
|
+
const t = useOpenGeniText();
|
|
3716
|
+
const canvasRef = useRef9(null);
|
|
3717
|
+
const inputRef = useRef9(null);
|
|
3718
|
+
const [selectPopup, setSelectPopup] = useState9(null);
|
|
3719
|
+
const inputSequenceRef = useRef9(0);
|
|
3720
|
+
const dismissSelectPopup = useCallback8(() => {
|
|
3721
|
+
inputSequenceRef.current += 1;
|
|
3722
|
+
setSelectPopup({ observation: null, anchor: null });
|
|
3723
|
+
}, []);
|
|
3724
|
+
const composingRef = useRef9(false);
|
|
3725
|
+
const pointerStartRef = useRef9(null);
|
|
3726
|
+
const lastClickRef = useRef9(null);
|
|
3727
|
+
const wheelRef = useRef9(null);
|
|
3728
|
+
const pendingTextRef = useRef9(null);
|
|
3729
|
+
const actionRef = useRef9(props.onAction);
|
|
3730
|
+
const readClipboardRef = useRef9(props.onReadClipboard);
|
|
3731
|
+
const observeInputRef = useRef9(props.onObserveForInput);
|
|
3732
|
+
const errorRef = useRef9(props.onError);
|
|
3733
|
+
const actionTailRef = useRef9(Promise.resolve());
|
|
3734
|
+
const actionQueueEpochRef = useRef9(0);
|
|
3735
|
+
const queuedTypingRef = useRef9(null);
|
|
3736
|
+
const queuedFrameRef = useRef9(null);
|
|
3737
|
+
const currentFrameRef = useRef9(props.frame);
|
|
3738
|
+
const paintedFrameRef = useRef9(null);
|
|
3739
|
+
const [paintedFrame, setPaintedFrame] = useState9(null);
|
|
3740
|
+
const decodingFrameRef = useRef9(false);
|
|
3741
|
+
const mountedRef = useRef9(true);
|
|
3004
3742
|
actionRef.current = props.onAction;
|
|
3005
3743
|
readClipboardRef.current = props.onReadClipboard;
|
|
3744
|
+
observeInputRef.current = props.onObserveForInput;
|
|
3006
3745
|
errorRef.current = props.onError;
|
|
3746
|
+
const clearBufferedInput = useCallback8(() => {
|
|
3747
|
+
dismissSelectPopup();
|
|
3748
|
+
if (wheelRef.current?.timer) clearTimeout(wheelRef.current.timer);
|
|
3749
|
+
if (pendingTextRef.current?.timer) clearTimeout(pendingTextRef.current.timer);
|
|
3750
|
+
wheelRef.current = null;
|
|
3751
|
+
pendingTextRef.current = null;
|
|
3752
|
+
queuedTypingRef.current = null;
|
|
3753
|
+
pointerStartRef.current = null;
|
|
3754
|
+
lastClickRef.current = null;
|
|
3755
|
+
composingRef.current = false;
|
|
3756
|
+
if (inputRef.current) inputRef.current.value = "";
|
|
3757
|
+
}, [dismissSelectPopup]);
|
|
3007
3758
|
const paintQueuedFrames = useCallback8(() => {
|
|
3008
3759
|
if (decodingFrameRef.current) return;
|
|
3009
3760
|
decodingFrameRef.current = true;
|
|
@@ -3015,15 +3766,17 @@ function BrowserViewport(props) {
|
|
|
3015
3766
|
if (!frame) break;
|
|
3016
3767
|
let objectUrl = null;
|
|
3017
3768
|
try {
|
|
3018
|
-
const blob = new Blob([frame.data
|
|
3769
|
+
const blob = new Blob([frame.data], {
|
|
3019
3770
|
type: frame.mediaType
|
|
3020
3771
|
});
|
|
3021
3772
|
if (typeof createImageBitmap === "function") {
|
|
3022
3773
|
const bitmap = await createImageBitmap(blob);
|
|
3023
3774
|
try {
|
|
3024
3775
|
const canvas2 = canvasRef.current;
|
|
3025
|
-
if (mountedRef.current && canvas2) {
|
|
3776
|
+
if (mountedRef.current && canvas2 && currentFrameRef.current && sameBrowserDocument(frame, currentFrameRef.current)) {
|
|
3026
3777
|
paintCanvas(canvas2, bitmap, frame.width, frame.height);
|
|
3778
|
+
paintedFrameRef.current = frame;
|
|
3779
|
+
setPaintedFrame(frame);
|
|
3027
3780
|
}
|
|
3028
3781
|
} finally {
|
|
3029
3782
|
bitmap.close();
|
|
@@ -3033,11 +3786,14 @@ function BrowserViewport(props) {
|
|
|
3033
3786
|
objectUrl = URL.createObjectURL(blob);
|
|
3034
3787
|
const image = await loadImage(objectUrl);
|
|
3035
3788
|
const canvas = canvasRef.current;
|
|
3036
|
-
if (mountedRef.current && canvas) {
|
|
3789
|
+
if (mountedRef.current && canvas && currentFrameRef.current && sameBrowserDocument(frame, currentFrameRef.current)) {
|
|
3037
3790
|
paintCanvas(canvas, image, frame.width, frame.height);
|
|
3791
|
+
paintedFrameRef.current = frame;
|
|
3792
|
+
setPaintedFrame(frame);
|
|
3038
3793
|
}
|
|
3039
3794
|
} catch (cause) {
|
|
3040
|
-
if (mountedRef.current
|
|
3795
|
+
if (mountedRef.current && currentFrameRef.current && sameBrowserDocument(frame, currentFrameRef.current))
|
|
3796
|
+
errorRef.current(cause);
|
|
3041
3797
|
} finally {
|
|
3042
3798
|
if (objectUrl) URL.revokeObjectURL(objectUrl);
|
|
3043
3799
|
}
|
|
@@ -3048,38 +3804,83 @@ function BrowserViewport(props) {
|
|
|
3048
3804
|
}
|
|
3049
3805
|
})();
|
|
3050
3806
|
}, []);
|
|
3051
|
-
|
|
3807
|
+
useLayoutEffect2(() => {
|
|
3808
|
+
const keyboardInput = inputRef.current;
|
|
3809
|
+
const focusHandoff = props.focusHandoffRef;
|
|
3052
3810
|
mountedRef.current = true;
|
|
3811
|
+
if (focusHandoff.current === props.focusScope) {
|
|
3812
|
+
keyboardInput?.focus({ preventScroll: true });
|
|
3813
|
+
}
|
|
3814
|
+
focusHandoff.current = null;
|
|
3053
3815
|
return () => {
|
|
3816
|
+
if (document.activeElement === keyboardInput) {
|
|
3817
|
+
focusHandoff.current = props.focusScope;
|
|
3818
|
+
}
|
|
3054
3819
|
mountedRef.current = false;
|
|
3820
|
+
actionQueueEpochRef.current += 1;
|
|
3055
3821
|
queuedFrameRef.current = null;
|
|
3822
|
+
clearBufferedInput();
|
|
3056
3823
|
};
|
|
3057
|
-
}, []);
|
|
3058
|
-
|
|
3059
|
-
if (!props.frame)
|
|
3824
|
+
}, [clearBufferedInput, props.focusHandoffRef, props.focusScope]);
|
|
3825
|
+
useLayoutEffect2(() => {
|
|
3826
|
+
if (currentFrameRef.current && !props.frame) {
|
|
3827
|
+
actionQueueEpochRef.current += 1;
|
|
3828
|
+
clearBufferedInput();
|
|
3829
|
+
}
|
|
3830
|
+
currentFrameRef.current = props.frame;
|
|
3831
|
+
if (!props.frame) {
|
|
3832
|
+
queuedFrameRef.current = null;
|
|
3833
|
+
paintedFrameRef.current = null;
|
|
3834
|
+
setPaintedFrame(null);
|
|
3835
|
+
return;
|
|
3836
|
+
}
|
|
3060
3837
|
queuedFrameRef.current = props.frame;
|
|
3061
3838
|
paintQueuedFrames();
|
|
3062
|
-
}, [paintQueuedFrames, props.frame]);
|
|
3063
|
-
useEffect8(
|
|
3064
|
-
() => () => {
|
|
3065
|
-
if (wheelRef.current?.timer) clearTimeout(wheelRef.current.timer);
|
|
3066
|
-
if (pendingTextRef.current?.timer) clearTimeout(pendingTextRef.current.timer);
|
|
3067
|
-
},
|
|
3068
|
-
[]
|
|
3069
|
-
);
|
|
3839
|
+
}, [clearBufferedInput, paintQueuedFrames, props.frame]);
|
|
3070
3840
|
const enqueue = useCallback8(
|
|
3071
|
-
(action, frame, after) => {
|
|
3841
|
+
(action, frame, after, selectAnchor) => {
|
|
3842
|
+
const inputSequence = ++inputSequenceRef.current;
|
|
3843
|
+
setSelectPopup({ observation: null, anchor: null });
|
|
3844
|
+
frame = frame ? {
|
|
3845
|
+
browserSessionId: frame.browserSessionId,
|
|
3846
|
+
controllerGeneration: frame.controllerGeneration,
|
|
3847
|
+
targetId: frame.targetId,
|
|
3848
|
+
targetGeneration: frame.targetGeneration,
|
|
3849
|
+
documentGeneration: frame.documentGeneration,
|
|
3850
|
+
frameId: frame.frameId
|
|
3851
|
+
} : null;
|
|
3072
3852
|
const epoch = actionQueueEpochRef.current;
|
|
3853
|
+
const attachment = props.inputBatchAttachment;
|
|
3854
|
+
const canBatchTyping = action.type === "type" && !after && frame && attachment?.fencedInputBatches === true && attachment.browserSessionId === frame.browserSessionId && attachment.controllerGeneration === frame.controllerGeneration && attachment.targetId === frame.targetId && Date.parse(attachment.expiresAt) > Date.now();
|
|
3855
|
+
const previous = queuedTypingRef.current;
|
|
3856
|
+
if (canBatchTyping && frame && previous && previous.epoch === epoch && sameFrameFence(previous.frame, frame) && previous.actions.length < 16) {
|
|
3857
|
+
previous.actions.push(action);
|
|
3858
|
+
return;
|
|
3859
|
+
}
|
|
3860
|
+
const typing = canBatchTyping && frame ? { actions: [action], frame, epoch } : null;
|
|
3861
|
+
queuedTypingRef.current = typing;
|
|
3073
3862
|
actionTailRef.current = actionTailRef.current.catch(() => void 0).then(async () => {
|
|
3074
|
-
if (epoch !== actionQueueEpochRef.current) return;
|
|
3075
|
-
|
|
3863
|
+
if (!mountedRef.current || epoch !== actionQueueEpochRef.current) return;
|
|
3864
|
+
if (queuedTypingRef.current === typing) queuedTypingRef.current = null;
|
|
3865
|
+
const dispatchedAction = typing && typing.actions.length > 1 ? { type: "batch", actions: typing.actions, fenceEachAction: true } : action;
|
|
3866
|
+
const receipt = await actionRef.current(dispatchedAction, frame);
|
|
3867
|
+
if (!mountedRef.current || epoch !== actionQueueEpochRef.current) return;
|
|
3868
|
+
const keyboardSelect = dispatchedAction.type === "press" && dispatchedAction.key === "Alt+ArrowDown";
|
|
3869
|
+
if ((selectAnchor || keyboardSelect) && inputSequence === inputSequenceRef.current) {
|
|
3870
|
+
const observation = keyboardSelect ? await observeInputRef.current() : receipt.observation;
|
|
3871
|
+
if (mountedRef.current && epoch === actionQueueEpochRef.current && inputSequence === inputSequenceRef.current && observation) {
|
|
3872
|
+
setSelectPopup({ observation, anchor: selectAnchor ?? null });
|
|
3873
|
+
}
|
|
3874
|
+
}
|
|
3076
3875
|
await after?.(receipt);
|
|
3077
3876
|
}).catch((cause) => {
|
|
3877
|
+
if (!mountedRef.current || epoch !== actionQueueEpochRef.current) return;
|
|
3078
3878
|
actionQueueEpochRef.current += 1;
|
|
3879
|
+
clearBufferedInput();
|
|
3079
3880
|
errorRef.current(cause);
|
|
3080
3881
|
});
|
|
3081
3882
|
},
|
|
3082
|
-
[]
|
|
3883
|
+
[clearBufferedInput, props.inputBatchAttachment]
|
|
3083
3884
|
);
|
|
3084
3885
|
const point = useCallback8(
|
|
3085
3886
|
(frame, clientX, clientY) => browserPoint(canvasRef.current, frame, clientX, clientY),
|
|
@@ -3095,15 +3896,35 @@ function BrowserViewport(props) {
|
|
|
3095
3896
|
const flushPendingClick = useCallback8(() => {
|
|
3096
3897
|
lastClickRef.current = null;
|
|
3097
3898
|
}, []);
|
|
3899
|
+
const flushPendingWheel = useCallback8(() => {
|
|
3900
|
+
const batch = wheelRef.current;
|
|
3901
|
+
if (!batch) return;
|
|
3902
|
+
if (batch.timer) clearTimeout(batch.timer);
|
|
3903
|
+
wheelRef.current = null;
|
|
3904
|
+
enqueue(
|
|
3905
|
+
{
|
|
3906
|
+
type: "pointer",
|
|
3907
|
+
action: "scroll",
|
|
3908
|
+
x: batch.x,
|
|
3909
|
+
y: batch.y,
|
|
3910
|
+
deltaX: batch.deltaX,
|
|
3911
|
+
deltaY: batch.deltaY
|
|
3912
|
+
},
|
|
3913
|
+
batch.frame
|
|
3914
|
+
);
|
|
3915
|
+
}, [enqueue]);
|
|
3098
3916
|
const pointerDown = (event) => {
|
|
3099
|
-
|
|
3917
|
+
const frame = paintedFrameRef.current;
|
|
3918
|
+
if (!frame || event.button !== 0) return;
|
|
3100
3919
|
event.preventDefault();
|
|
3920
|
+
dismissSelectPopup();
|
|
3921
|
+
flushPendingWheel();
|
|
3101
3922
|
flushPendingText();
|
|
3102
3923
|
pointerStartRef.current = {
|
|
3103
3924
|
x: event.clientX,
|
|
3104
3925
|
y: event.clientY,
|
|
3105
3926
|
pointerId: event.pointerId,
|
|
3106
|
-
frame
|
|
3927
|
+
frame
|
|
3107
3928
|
};
|
|
3108
3929
|
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
3109
3930
|
inputRef.current?.focus({ preventScroll: true });
|
|
@@ -3138,52 +3959,54 @@ function BrowserViewport(props) {
|
|
|
3138
3959
|
return;
|
|
3139
3960
|
}
|
|
3140
3961
|
lastClickRef.current = { at: now, x: to.x, y: to.y, frame: start.frame };
|
|
3141
|
-
|
|
3962
|
+
const viewportBounds = canvasRef.current?.parentElement?.getBoundingClientRect();
|
|
3963
|
+
enqueue(
|
|
3964
|
+
{ type: "pointer", action: "click", x: to.x, y: to.y },
|
|
3965
|
+
start.frame,
|
|
3966
|
+
void 0,
|
|
3967
|
+
viewportBounds ? { x: event.clientX - viewportBounds.left, y: event.clientY - viewportBounds.top + 8 } : void 0
|
|
3968
|
+
);
|
|
3142
3969
|
};
|
|
3143
3970
|
const contextMenu = (event) => {
|
|
3144
3971
|
event.preventDefault();
|
|
3145
|
-
const frame =
|
|
3972
|
+
const frame = paintedFrameRef.current;
|
|
3146
3973
|
if (!frame) return;
|
|
3974
|
+
flushPendingWheel();
|
|
3147
3975
|
flushPendingText();
|
|
3148
3976
|
flushPendingClick();
|
|
3149
3977
|
const at = point(frame, event.clientX, event.clientY);
|
|
3150
3978
|
if (at) enqueue({ type: "pointer", action: "click", x: at.x, y: at.y, button: "right" }, frame);
|
|
3151
3979
|
};
|
|
3152
3980
|
const wheel = (event) => {
|
|
3153
|
-
|
|
3981
|
+
dismissSelectPopup();
|
|
3982
|
+
const frame = paintedFrameRef.current;
|
|
3154
3983
|
if (!frame) return;
|
|
3155
3984
|
const at = point(frame, event.clientX, event.clientY);
|
|
3156
3985
|
if (!at) return;
|
|
3157
3986
|
flushPendingText();
|
|
3158
3987
|
flushPendingClick();
|
|
3159
3988
|
event.preventDefault();
|
|
3160
|
-
|
|
3161
|
-
if (pending
|
|
3989
|
+
let pending = wheelRef.current;
|
|
3990
|
+
if (pending && (!sameBrowserDocument(pending.frame, frame) || Math.hypot(pending.x - at.x, pending.y - at.y) > 6)) {
|
|
3991
|
+
flushPendingWheel();
|
|
3992
|
+
pending = null;
|
|
3993
|
+
}
|
|
3162
3994
|
wheelRef.current = {
|
|
3163
3995
|
x: at.x,
|
|
3164
3996
|
y: at.y,
|
|
3165
|
-
deltaX: (pending
|
|
3166
|
-
deltaY: (pending
|
|
3997
|
+
deltaX: (pending?.deltaX ?? 0) + event.deltaX,
|
|
3998
|
+
deltaY: (pending?.deltaY ?? 0) + event.deltaY,
|
|
3167
3999
|
frame,
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
wheelRef.current = null;
|
|
3171
|
-
if (batch)
|
|
3172
|
-
enqueue(
|
|
3173
|
-
{
|
|
3174
|
-
type: "pointer",
|
|
3175
|
-
action: "scroll",
|
|
3176
|
-
x: batch.x,
|
|
3177
|
-
y: batch.y,
|
|
3178
|
-
deltaX: batch.deltaX,
|
|
3179
|
-
deltaY: batch.deltaY
|
|
3180
|
-
},
|
|
3181
|
-
batch.frame
|
|
3182
|
-
);
|
|
3183
|
-
}, 45)
|
|
4000
|
+
// Retain the first event's deadline so a continuous gesture keeps moving.
|
|
4001
|
+
timer: pending?.timer ?? setTimeout(flushPendingWheel, 45)
|
|
3184
4002
|
};
|
|
3185
4003
|
};
|
|
3186
4004
|
const keyDown = (event) => {
|
|
4005
|
+
if (composingRef.current || event.nativeEvent.isComposing || event.nativeEvent.keyCode === 229) {
|
|
4006
|
+
return;
|
|
4007
|
+
}
|
|
4008
|
+
dismissSelectPopup();
|
|
4009
|
+
flushPendingWheel();
|
|
3187
4010
|
const command = event.metaKey || event.ctrlKey;
|
|
3188
4011
|
if (props.clipboardEnabled && command && !event.altKey && ["c", "v"].includes(event.key.toLowerCase())) {
|
|
3189
4012
|
flushPendingText();
|
|
@@ -3194,24 +4017,28 @@ function BrowserViewport(props) {
|
|
|
3194
4017
|
event.preventDefault();
|
|
3195
4018
|
flushPendingText();
|
|
3196
4019
|
flushPendingClick();
|
|
3197
|
-
enqueue({ type: "press", key },
|
|
4020
|
+
enqueue({ type: "press", key }, paintedFrameRef.current);
|
|
3198
4021
|
};
|
|
4022
|
+
const finishCopy = useCallback8(async () => {
|
|
4023
|
+
const clipboard = await readClipboardRef.current();
|
|
4024
|
+
if (!mountedRef.current) return;
|
|
4025
|
+
if (clipboard.text.length === 0) return;
|
|
4026
|
+
if (!await copyTextToClipboard(clipboard.text)) {
|
|
4027
|
+
throw new Error(t("browserViewer.browserTextCouldNotBe"));
|
|
4028
|
+
}
|
|
4029
|
+
}, [t]);
|
|
3199
4030
|
const copy = (event) => {
|
|
3200
4031
|
if (!props.clipboardEnabled) return;
|
|
3201
4032
|
event.preventDefault();
|
|
4033
|
+
flushPendingWheel();
|
|
3202
4034
|
flushPendingText();
|
|
3203
4035
|
flushPendingClick();
|
|
3204
|
-
enqueue({ type: "clipboard", operation: "copy" },
|
|
3205
|
-
const clipboard = await readClipboardRef.current();
|
|
3206
|
-
if (clipboard.text.length === 0) return;
|
|
3207
|
-
if (!await copyTextToClipboard(clipboard.text)) {
|
|
3208
|
-
throw new Error("Browser text could not be copied to the local clipboard");
|
|
3209
|
-
}
|
|
3210
|
-
});
|
|
4036
|
+
enqueue({ type: "clipboard", operation: "copy" }, paintedFrameRef.current, finishCopy);
|
|
3211
4037
|
};
|
|
3212
4038
|
const paste = (event) => {
|
|
3213
4039
|
if (!props.clipboardEnabled) return;
|
|
3214
4040
|
event.preventDefault();
|
|
4041
|
+
flushPendingWheel();
|
|
3215
4042
|
flushPendingText();
|
|
3216
4043
|
flushPendingClick();
|
|
3217
4044
|
enqueue(
|
|
@@ -3220,15 +4047,17 @@ function BrowserViewport(props) {
|
|
|
3220
4047
|
operation: "paste",
|
|
3221
4048
|
text: event.clipboardData.getData("text/plain")
|
|
3222
4049
|
},
|
|
3223
|
-
|
|
4050
|
+
paintedFrameRef.current
|
|
3224
4051
|
);
|
|
3225
4052
|
};
|
|
3226
4053
|
const input = (value, nativeComposing = false) => {
|
|
4054
|
+
dismissSelectPopup();
|
|
3227
4055
|
if (composingRef.current || nativeComposing) return;
|
|
3228
4056
|
if (!value) return;
|
|
4057
|
+
flushPendingWheel();
|
|
3229
4058
|
flushPendingClick();
|
|
3230
4059
|
const pending = pendingTextRef.current;
|
|
3231
|
-
if (pending && sameOptionalBrowserFrame(pending.frame,
|
|
4060
|
+
if (pending && sameOptionalBrowserFrame(pending.frame, paintedFrameRef.current)) {
|
|
3232
4061
|
clearTimeout(pending.timer);
|
|
3233
4062
|
pending.text += value;
|
|
3234
4063
|
pending.timer = setTimeout(flushPendingText, 16);
|
|
@@ -3236,7 +4065,7 @@ function BrowserViewport(props) {
|
|
|
3236
4065
|
flushPendingText();
|
|
3237
4066
|
pendingTextRef.current = {
|
|
3238
4067
|
text: value,
|
|
3239
|
-
frame:
|
|
4068
|
+
frame: paintedFrameRef.current,
|
|
3240
4069
|
timer: setTimeout(flushPendingText, 16)
|
|
3241
4070
|
};
|
|
3242
4071
|
}
|
|
@@ -3249,9 +4078,9 @@ function BrowserViewport(props) {
|
|
|
3249
4078
|
composingRef.current = false;
|
|
3250
4079
|
input(event.currentTarget.value || event.data);
|
|
3251
4080
|
};
|
|
3252
|
-
const showCanvas = props.frame !== null;
|
|
3253
|
-
return /* @__PURE__ */
|
|
3254
|
-
/* @__PURE__ */
|
|
4081
|
+
const showCanvas = !props.controlUnavailable && props.frame !== null && paintedFrame !== null && sameBrowserDocument(props.frame, paintedFrame);
|
|
4082
|
+
return /* @__PURE__ */ jsxs2("div", { className: "relative min-h-0 flex-1 overflow-hidden bg-black", children: [
|
|
4083
|
+
/* @__PURE__ */ jsx2(
|
|
3255
4084
|
"canvas",
|
|
3256
4085
|
{
|
|
3257
4086
|
ref: canvasRef,
|
|
@@ -3266,13 +4095,14 @@ function BrowserViewport(props) {
|
|
|
3266
4095
|
},
|
|
3267
4096
|
onContextMenu: contextMenu,
|
|
3268
4097
|
onWheel: wheel,
|
|
3269
|
-
"aria-label": "
|
|
4098
|
+
"aria-label": t("browserViewer.interactiveBrowserPage")
|
|
3270
4099
|
}
|
|
3271
4100
|
),
|
|
3272
|
-
/* @__PURE__ */
|
|
4101
|
+
/* @__PURE__ */ jsx2(
|
|
3273
4102
|
"textarea",
|
|
3274
4103
|
{
|
|
3275
4104
|
ref: inputRef,
|
|
4105
|
+
disabled: props.controlUnavailable,
|
|
3276
4106
|
defaultValue: "",
|
|
3277
4107
|
onInput: (event) => input(event.currentTarget.value, event.nativeEvent.isComposing),
|
|
3278
4108
|
onCompositionStart: compositionStart,
|
|
@@ -3281,48 +4111,68 @@ function BrowserViewport(props) {
|
|
|
3281
4111
|
onCopy: copy,
|
|
3282
4112
|
onPaste: paste,
|
|
3283
4113
|
className: "pointer-events-none absolute left-1/2 top-1/2 size-px resize-none overflow-hidden opacity-0",
|
|
3284
|
-
"aria-label": "
|
|
4114
|
+
"aria-label": t("browserViewer.browserKeyboardInput"),
|
|
4115
|
+
"aria-keyshortcuts": "Alt+ArrowDown",
|
|
3285
4116
|
autoCapitalize: "off",
|
|
3286
4117
|
autoCorrect: "off",
|
|
3287
4118
|
spellCheck: false
|
|
3288
4119
|
}
|
|
3289
4120
|
),
|
|
3290
|
-
!showCanvas ? /* @__PURE__ */
|
|
4121
|
+
!showCanvas ? /* @__PURE__ */ jsx2(
|
|
3291
4122
|
SemanticBrowserFallback,
|
|
3292
4123
|
{
|
|
3293
4124
|
observation: props.observation,
|
|
3294
4125
|
connectionState: props.connectionState,
|
|
3295
4126
|
supportsLiveFrames: props.supportsLiveFrames,
|
|
3296
4127
|
error: props.connectionError,
|
|
4128
|
+
controlUnavailable: props.controlUnavailable,
|
|
3297
4129
|
onAction: (action) => enqueue(action, null),
|
|
3298
4130
|
onReconnect: props.onReconnect,
|
|
3299
4131
|
reconnectLabel: props.reconnectLabel,
|
|
3300
4132
|
reconnectMessage: props.reconnectMessage
|
|
3301
4133
|
}
|
|
3302
4134
|
) : null,
|
|
3303
|
-
|
|
3304
|
-
|
|
4135
|
+
showCanvas ? /* @__PURE__ */ jsx2(
|
|
4136
|
+
BrowserSelectControl,
|
|
4137
|
+
{
|
|
4138
|
+
manualFallback: props.inputBatchAttachment?.focusedInputObservations !== true,
|
|
4139
|
+
activation: selectPopup,
|
|
4140
|
+
onDismiss: () => inputRef.current?.focus({ preventScroll: true }),
|
|
4141
|
+
observe: async () => {
|
|
4142
|
+
flushPendingText();
|
|
4143
|
+
flushPendingWheel();
|
|
4144
|
+
await actionTailRef.current;
|
|
4145
|
+
if (!mountedRef.current) throw new Error(t("browserViewer.theBrowserPageChanged"));
|
|
4146
|
+
return await props.onObserveForInput();
|
|
4147
|
+
},
|
|
4148
|
+
act: props.onSelectFromObservation
|
|
4149
|
+
}
|
|
4150
|
+
) : null,
|
|
4151
|
+
props.mutating ? /* @__PURE__ */ jsxs2("div", { className: "pointer-events-none absolute right-3 top-3 flex items-center gap-1.5 rounded-full border border-white/10 bg-black/65 px-2.5 py-1 text-[11px] text-white/80 backdrop-blur", children: [
|
|
4152
|
+
/* @__PURE__ */ jsx2(LoaderCircleIcon, { className: "size-3 animate-spin" }),
|
|
3305
4153
|
" ",
|
|
3306
|
-
props.activityLabel ?? "
|
|
4154
|
+
props.activityLabel ?? t("browserViewer.acting")
|
|
3307
4155
|
] }) : null
|
|
3308
4156
|
] });
|
|
3309
4157
|
}
|
|
3310
4158
|
function SemanticBrowserFallback(props) {
|
|
4159
|
+
const t = useOpenGeniText();
|
|
3311
4160
|
const controlFailure = interactionControlFailureFromError(props.error);
|
|
3312
|
-
const
|
|
4161
|
+
const { controlUnavailable } = props;
|
|
4162
|
+
const generationLoss = Boolean(props.reconnectMessage);
|
|
3313
4163
|
const nodes = semanticNodes(
|
|
3314
4164
|
props.observation?.semantic?.kind === "snapshot" ? props.observation.semantic.roots : []
|
|
3315
4165
|
);
|
|
3316
4166
|
const interactive = nodes.filter((node) => node.actions.includes("click")).slice(0, 8);
|
|
3317
|
-
return /* @__PURE__ */
|
|
3318
|
-
/* @__PURE__ */
|
|
3319
|
-
props.error ? /* @__PURE__ */
|
|
3320
|
-
/* @__PURE__ */
|
|
4167
|
+
return /* @__PURE__ */ jsx2("div", { className: "absolute inset-0 grid place-items-center bg-og-bg p-6", children: /* @__PURE__ */ jsxs2("div", { className: "w-full max-w-md rounded-og-lg border border-og-border bg-og-surface-1 p-4 shadow-lg", children: [
|
|
4168
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
|
|
4169
|
+
props.error ? /* @__PURE__ */ jsx2(CircleAlertIcon, { className: "size-4 text-og-danger" }) : props.connectionState === "semantic" ? /* @__PURE__ */ jsx2(ZapIcon, { className: "size-4 text-og-fg-muted" }) : /* @__PURE__ */ jsx2(LoaderCircleIcon, { className: "size-4 animate-spin text-og-fg-muted" }),
|
|
4170
|
+
/* @__PURE__ */ jsx2("p", { className: "text-og-menu font-medium text-og-fg", children: generationLoss ? t("browserViewer.chromeReconnectedOpenAFresh") : controlUnavailable ? t("browserViewer.browserControlsUnavailable") : props.error ? props.supportsLiveFrames ? t("browserViewer.liveViewDisconnected") : t("browserViewer.browserUnavailable") : props.connectionState === "semantic" ? t("browserViewer.semanticBrowser") : browserConnectionLabel(t, props.connectionState) })
|
|
3321
4171
|
] }),
|
|
3322
|
-
props.error || props.reconnectMessage ? /* @__PURE__ */
|
|
3323
|
-
interactive.length > 0 ? /* @__PURE__ */
|
|
3324
|
-
/* @__PURE__ */
|
|
3325
|
-
/* @__PURE__ */
|
|
4172
|
+
props.error || props.reconnectMessage ? /* @__PURE__ */ jsx2("p", { className: "mt-2 text-og-control leading-5 text-og-fg-muted", children: props.reconnectMessage ?? controlFailure?.message ?? props.error?.message }) : null,
|
|
4173
|
+
interactive.length > 0 && !controlUnavailable ? /* @__PURE__ */ jsxs2("div", { className: "mt-3 border-t border-og-border pt-3", children: [
|
|
4174
|
+
/* @__PURE__ */ jsx2("p", { className: "mb-2 text-og-xs text-og-fg-subtle", children: props.supportsLiveFrames ? t("browserViewer.pageControlsRemainAvailable") : t("browserViewer.availablePageControls") }),
|
|
4175
|
+
/* @__PURE__ */ jsx2("div", { className: "flex flex-wrap gap-1.5", children: interactive.map((node) => /* @__PURE__ */ jsx2(
|
|
3326
4176
|
"button",
|
|
3327
4177
|
{
|
|
3328
4178
|
type: "button",
|
|
@@ -3336,22 +4186,23 @@ function SemanticBrowserFallback(props) {
|
|
|
3336
4186
|
node.ref
|
|
3337
4187
|
)) })
|
|
3338
4188
|
] }) : null,
|
|
3339
|
-
props.error &&
|
|
4189
|
+
props.error && (!generationLoss || props.reconnectLabel) ? /* @__PURE__ */ jsx2(
|
|
3340
4190
|
"button",
|
|
3341
4191
|
{
|
|
3342
4192
|
type: "button",
|
|
3343
4193
|
onClick: props.onReconnect,
|
|
3344
|
-
className: "mt-3 text-og-control font-medium
|
|
3345
|
-
children: props.reconnectLabel ?? (controlFailure?.retryable === false ? "
|
|
4194
|
+
className: "mt-3 text-og-control font-medium og-link",
|
|
4195
|
+
children: props.reconnectLabel ?? (controlFailure?.retryable === false ? t("browserViewer.tryAgain") : t("browserViewer.reconnect"))
|
|
3346
4196
|
}
|
|
3347
4197
|
) : null
|
|
3348
4198
|
] }) });
|
|
3349
4199
|
}
|
|
3350
4200
|
function BrowserStatusBar(props) {
|
|
4201
|
+
const t = useOpenGeniText();
|
|
3351
4202
|
const errors = (props.observation?.diagnostics.consoleErrorCount ?? 0) + (props.observation?.diagnostics.pageErrorCount ?? 0);
|
|
3352
4203
|
const failed = props.observation?.diagnostics.failedRequestCount ?? 0;
|
|
3353
|
-
return /* @__PURE__ */
|
|
3354
|
-
/* @__PURE__ */
|
|
4204
|
+
return /* @__PURE__ */ jsxs2("div", { className: "flex h-7 shrink-0 items-center gap-2 border-t border-og-border bg-og-surface-1 px-2 text-og-xs text-og-fg-subtle", children: [
|
|
4205
|
+
/* @__PURE__ */ jsx2(
|
|
3355
4206
|
"span",
|
|
3356
4207
|
{
|
|
3357
4208
|
className: cn(
|
|
@@ -3360,24 +4211,25 @@ function BrowserStatusBar(props) {
|
|
|
3360
4211
|
)
|
|
3361
4212
|
}
|
|
3362
4213
|
),
|
|
3363
|
-
/* @__PURE__ */
|
|
3364
|
-
/* @__PURE__ */
|
|
3365
|
-
/* @__PURE__ */
|
|
3366
|
-
|
|
3367
|
-
props.
|
|
4214
|
+
/* @__PURE__ */ jsx2("span", { children: props.connectionState === "live" ? t("browserViewer.live") : props.connectionState === "semantic" ? t("browserViewer.semantic") : browserConnectionLabel(t, props.connectionState) }),
|
|
4215
|
+
props.inputFailure ? /* @__PURE__ */ jsx2("span", { className: "text-og-status-failed", children: props.inputFailure.state === "failed" ? t("browserViewer.inputFailed") : t("browserViewer.inputResultUnknown") }) : null,
|
|
4216
|
+
/* @__PURE__ */ jsx2("span", { children: props.profile?.name ?? t("browserViewer.temporaryBrowser") }),
|
|
4217
|
+
/* @__PURE__ */ jsx2("span", { className: "min-w-0 flex-1 truncate", children: props.target?.title }),
|
|
4218
|
+
props.refreshing ? /* @__PURE__ */ jsx2(LoaderCircleIcon, { className: "size-3 animate-spin" }) : null,
|
|
4219
|
+
props.onOpenComputer ? /* @__PURE__ */ jsxs2(
|
|
3368
4220
|
"button",
|
|
3369
4221
|
{
|
|
3370
4222
|
type: "button",
|
|
3371
4223
|
onClick: props.onOpenComputer,
|
|
3372
4224
|
className: "flex items-center gap-1 rounded px-1.5 py-0.5 transition hover:bg-og-surface-2 hover:text-og-fg",
|
|
3373
|
-
"aria-label": "
|
|
4225
|
+
"aria-label": t("browserViewer.openThisBrowserWindowIn"),
|
|
3374
4226
|
children: [
|
|
3375
|
-
/* @__PURE__ */
|
|
3376
|
-
"
|
|
4227
|
+
/* @__PURE__ */ jsx2(MonitorIcon, { className: "size-3" }),
|
|
4228
|
+
t("browserViewer.desktop")
|
|
3377
4229
|
]
|
|
3378
4230
|
}
|
|
3379
4231
|
) : null,
|
|
3380
|
-
/* @__PURE__ */
|
|
4232
|
+
/* @__PURE__ */ jsxs2(
|
|
3381
4233
|
"button",
|
|
3382
4234
|
{
|
|
3383
4235
|
type: "button",
|
|
@@ -3389,112 +4241,153 @@ function BrowserStatusBar(props) {
|
|
|
3389
4241
|
props.diagnosticsOpen && "bg-og-surface-2 text-og-fg"
|
|
3390
4242
|
),
|
|
3391
4243
|
children: [
|
|
3392
|
-
/* @__PURE__ */
|
|
3393
|
-
errors + failed > 0 ? errors + failed : "
|
|
4244
|
+
/* @__PURE__ */ jsx2(BugIcon, { className: "size-3" }),
|
|
4245
|
+
errors + failed > 0 ? errors + failed : t("browserViewer.debug")
|
|
3394
4246
|
]
|
|
3395
4247
|
}
|
|
3396
4248
|
)
|
|
3397
4249
|
] });
|
|
3398
4250
|
}
|
|
3399
4251
|
function BrowserDiagnosticsDrawer(props) {
|
|
4252
|
+
const t = useOpenGeniText();
|
|
3400
4253
|
const session = props.session;
|
|
3401
4254
|
const diagnostics = props.observation?.diagnostics;
|
|
3402
|
-
const semanticMode = props.observation?.semantic ? "
|
|
3403
|
-
return /* @__PURE__ */
|
|
4255
|
+
const semanticMode = props.observation?.semantic ? t("browserViewer.semanticPageStructureAvailable") : props.observation?.screenshot ? t("browserViewer.visualFallbackInUse") : t("browserViewer.waitingForPageObservation");
|
|
4256
|
+
return /* @__PURE__ */ jsxs2(
|
|
3404
4257
|
"aside",
|
|
3405
4258
|
{
|
|
3406
4259
|
id: "browser-diagnostics-drawer",
|
|
3407
4260
|
role: "region",
|
|
3408
|
-
"aria-label": "
|
|
3409
|
-
className: "absolute
|
|
4261
|
+
"aria-label": t("browserViewer.browserDiagnostics"),
|
|
4262
|
+
className: "absolute inset-y-0 right-0 z-40 flex min-h-0 w-full max-w-md flex-col border-l border-og-border bg-og-surface-1 shadow-2xl",
|
|
3410
4263
|
children: [
|
|
3411
|
-
/* @__PURE__ */
|
|
3412
|
-
/* @__PURE__ */
|
|
3413
|
-
/* @__PURE__ */
|
|
3414
|
-
/* @__PURE__ */
|
|
3415
|
-
/* @__PURE__ */
|
|
4264
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex min-h-11 shrink-0 items-center gap-2 border-b border-og-border px-3 py-2", children: [
|
|
4265
|
+
/* @__PURE__ */ jsx2(BugIcon, { className: "size-4 shrink-0 text-og-fg-muted" }),
|
|
4266
|
+
/* @__PURE__ */ jsxs2("div", { className: "min-w-0 flex-1", children: [
|
|
4267
|
+
/* @__PURE__ */ jsx2("p", { className: "text-og-control font-semibold text-og-fg", children: t("browserViewer.browserDiagnostics") }),
|
|
4268
|
+
/* @__PURE__ */ jsx2("p", { className: "truncate text-og-xs text-og-fg-subtle", children: props.target?.title || shortUrl(props.target?.url ?? "") || t("browserViewer.currentTab") })
|
|
3416
4269
|
] }),
|
|
3417
|
-
/* @__PURE__ */
|
|
4270
|
+
/* @__PURE__ */ jsx2(
|
|
3418
4271
|
"button",
|
|
3419
4272
|
{
|
|
3420
4273
|
type: "button",
|
|
3421
4274
|
onClick: props.onRefresh,
|
|
3422
4275
|
disabled: props.state.loading,
|
|
3423
|
-
className: "grid size-7 place-items-center rounded-og-sm text-og-muted transition hover:bg-og-surface-2 hover:text-og-fg disabled:opacity-40",
|
|
3424
|
-
"aria-label": "
|
|
3425
|
-
children: /* @__PURE__ */
|
|
4276
|
+
className: "grid size-7 shrink-0 place-items-center rounded-og-sm text-og-fg-muted transition hover:bg-og-surface-2 hover:text-og-fg disabled:opacity-40",
|
|
4277
|
+
"aria-label": t("browserViewer.refreshBrowserDiagnostics"),
|
|
4278
|
+
children: /* @__PURE__ */ jsx2(RefreshCwIcon, { className: cn("size-3.5", props.state.loading && "animate-spin") })
|
|
3426
4279
|
}
|
|
3427
4280
|
),
|
|
3428
|
-
/* @__PURE__ */
|
|
4281
|
+
/* @__PURE__ */ jsx2(
|
|
3429
4282
|
"button",
|
|
3430
4283
|
{
|
|
3431
4284
|
type: "button",
|
|
3432
4285
|
onClick: props.onClose,
|
|
3433
|
-
className: "grid size-7 place-items-center rounded-og-sm text-og-muted transition hover:bg-og-surface-2 hover:text-og-fg",
|
|
3434
|
-
"aria-label": "
|
|
3435
|
-
children: /* @__PURE__ */
|
|
4286
|
+
className: "grid size-7 shrink-0 place-items-center rounded-og-sm text-og-fg-muted transition hover:bg-og-surface-2 hover:text-og-fg",
|
|
4287
|
+
"aria-label": t("browserViewer.closeBrowserDiagnostics"),
|
|
4288
|
+
children: /* @__PURE__ */ jsx2(XIcon, { className: "size-3.5" })
|
|
3436
4289
|
}
|
|
3437
4290
|
)
|
|
3438
4291
|
] }),
|
|
3439
|
-
/* @__PURE__ */
|
|
3440
|
-
/* @__PURE__ */
|
|
3441
|
-
/* @__PURE__ */
|
|
4292
|
+
/* @__PURE__ */ jsxs2("div", { className: "min-h-0 flex-1 overflow-y-auto", children: [
|
|
4293
|
+
/* @__PURE__ */ jsxs2("section", { className: "border-b border-og-border p-3", "aria-labelledby": "browser-runtime-title", children: [
|
|
4294
|
+
/* @__PURE__ */ jsx2(
|
|
3442
4295
|
"h3",
|
|
3443
4296
|
{
|
|
3444
4297
|
id: "browser-runtime-title",
|
|
3445
|
-
className: "text-[10px] font-semibold uppercase tracking-[0.14em] text-og-subtle",
|
|
3446
|
-
children: "
|
|
4298
|
+
className: "text-[10px] font-semibold uppercase tracking-[0.14em] text-og-fg-subtle",
|
|
4299
|
+
children: t("browserViewer.runtime")
|
|
3447
4300
|
}
|
|
3448
4301
|
),
|
|
3449
|
-
/* @__PURE__ */
|
|
3450
|
-
/* @__PURE__ */
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
4302
|
+
/* @__PURE__ */ jsxs2("dl", { className: "mt-2 grid grid-cols-[7rem_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-og-xs", children: [
|
|
4303
|
+
/* @__PURE__ */ jsx2(
|
|
4304
|
+
DiagnosticFact,
|
|
4305
|
+
{
|
|
4306
|
+
label: t("browserViewer.engine"),
|
|
4307
|
+
value: browserEngineLabel(t, session)
|
|
4308
|
+
}
|
|
4309
|
+
),
|
|
4310
|
+
/* @__PURE__ */ jsx2(
|
|
4311
|
+
DiagnosticFact,
|
|
4312
|
+
{
|
|
4313
|
+
label: t("browserViewer.driver"),
|
|
4314
|
+
value: session?.driverId ?? t("browserViewer.unavailable")
|
|
4315
|
+
}
|
|
4316
|
+
),
|
|
4317
|
+
/* @__PURE__ */ jsx2(
|
|
4318
|
+
DiagnosticFact,
|
|
4319
|
+
{
|
|
4320
|
+
label: t("browserViewer.placement"),
|
|
4321
|
+
value: placementLabel(t, session ?? void 0)
|
|
4322
|
+
}
|
|
4323
|
+
),
|
|
4324
|
+
/* @__PURE__ */ jsx2(
|
|
3454
4325
|
DiagnosticFact,
|
|
3455
4326
|
{
|
|
3456
|
-
label: "
|
|
3457
|
-
value: props.profile ? `${props.profile.name}${props.baseRevisionOrdinal ? ` \xB7 v${props.baseRevisionOrdinal}` : ""}` : "
|
|
4327
|
+
label: t("browserViewer.profile"),
|
|
4328
|
+
value: props.profile ? `${props.profile.name}${props.baseRevisionOrdinal ? ` \xB7 v${props.baseRevisionOrdinal}` : ""}` : t("browserViewer.temporary")
|
|
3458
4329
|
}
|
|
3459
4330
|
),
|
|
3460
|
-
/* @__PURE__ */
|
|
4331
|
+
/* @__PURE__ */ jsx2(
|
|
3461
4332
|
DiagnosticFact,
|
|
3462
4333
|
{
|
|
3463
|
-
label: "
|
|
3464
|
-
value: shortGeneration(session?.controller?.controllerGeneration)
|
|
4334
|
+
label: t("browserViewer.controller"),
|
|
4335
|
+
value: shortGeneration(t, session?.controller?.controllerGeneration)
|
|
3465
4336
|
}
|
|
3466
4337
|
),
|
|
3467
|
-
/* @__PURE__ */
|
|
4338
|
+
/* @__PURE__ */ jsx2(
|
|
3468
4339
|
DiagnosticFact,
|
|
3469
4340
|
{
|
|
3470
|
-
label: "
|
|
3471
|
-
value: session?.networkRouteId ? "
|
|
4341
|
+
label: t("browserViewer.network"),
|
|
4342
|
+
value: session?.networkRouteId ? t("browserViewer.customRoute") : t("browserViewer.placementDefault")
|
|
3472
4343
|
}
|
|
3473
4344
|
),
|
|
3474
|
-
/* @__PURE__ */
|
|
4345
|
+
/* @__PURE__ */ jsx2(DiagnosticFact, { label: t("browserViewer.observation"), value: semanticMode })
|
|
3475
4346
|
] })
|
|
3476
4347
|
] }),
|
|
3477
|
-
/* @__PURE__ */
|
|
3478
|
-
/* @__PURE__ */
|
|
4348
|
+
/* @__PURE__ */ jsxs2("section", { className: "border-b border-og-border p-3", "aria-labelledby": "browser-page-title", children: [
|
|
4349
|
+
/* @__PURE__ */ jsx2(
|
|
3479
4350
|
"h3",
|
|
3480
4351
|
{
|
|
3481
4352
|
id: "browser-page-title",
|
|
3482
|
-
className: "text-[10px] font-semibold uppercase tracking-[0.14em] text-og-subtle",
|
|
3483
|
-
children: "
|
|
4353
|
+
className: "text-[10px] font-semibold uppercase tracking-[0.14em] text-og-fg-subtle",
|
|
4354
|
+
children: t("browserViewer.tabDiagnostics")
|
|
3484
4355
|
}
|
|
3485
4356
|
),
|
|
3486
|
-
/* @__PURE__ */
|
|
3487
|
-
|
|
3488
|
-
/* @__PURE__ */
|
|
3489
|
-
|
|
3490
|
-
|
|
4357
|
+
/* @__PURE__ */ jsx2("p", { className: "mt-1 text-og-xs text-og-fg-subtle", children: t("browserViewer.includesEarlierPagesInThis") }),
|
|
4358
|
+
/* @__PURE__ */ jsxs2("dl", { className: "mt-2 grid grid-cols-2 gap-2", children: [
|
|
4359
|
+
/* @__PURE__ */ jsx2(
|
|
4360
|
+
DiagnosticCount,
|
|
4361
|
+
{
|
|
4362
|
+
label: t("browserViewer.consoleErrors"),
|
|
4363
|
+
value: diagnostics?.consoleErrorCount
|
|
4364
|
+
}
|
|
4365
|
+
),
|
|
4366
|
+
/* @__PURE__ */ jsx2(
|
|
4367
|
+
DiagnosticCount,
|
|
4368
|
+
{
|
|
4369
|
+
label: t("browserViewer.pageErrors"),
|
|
4370
|
+
value: diagnostics?.pageErrorCount
|
|
4371
|
+
}
|
|
4372
|
+
),
|
|
4373
|
+
/* @__PURE__ */ jsx2(
|
|
4374
|
+
DiagnosticCount,
|
|
4375
|
+
{
|
|
4376
|
+
label: t("browserViewer.failedRequests"),
|
|
4377
|
+
value: diagnostics?.failedRequestCount
|
|
4378
|
+
}
|
|
4379
|
+
),
|
|
4380
|
+
/* @__PURE__ */ jsx2(
|
|
4381
|
+
DiagnosticCount,
|
|
4382
|
+
{
|
|
4383
|
+
label: t("browserViewer.downloads"),
|
|
4384
|
+
value: diagnostics?.downloadCount
|
|
4385
|
+
}
|
|
4386
|
+
)
|
|
3491
4387
|
] }),
|
|
3492
|
-
session?.failureCode ? /* @__PURE__ */
|
|
3493
|
-
"Browser state: ",
|
|
3494
|
-
session.failureCode
|
|
3495
|
-
] }) : null
|
|
4388
|
+
session?.failureCode ? /* @__PURE__ */ jsx2("p", { className: "mt-2 rounded-og-sm border border-og-status-error/30 bg-og-status-error/5 px-2.5 py-2 text-og-xs text-og-danger", children: t("browserViewer.browserStateFailurecode", { failureCode: session.failureCode }) }) : null
|
|
3496
4389
|
] }),
|
|
3497
|
-
props.downloadsEnabled ? /* @__PURE__ */
|
|
4390
|
+
props.downloadsEnabled ? /* @__PURE__ */ jsx2(
|
|
3498
4391
|
BrowserDownloadsPanel,
|
|
3499
4392
|
{
|
|
3500
4393
|
downloads: props.downloads,
|
|
@@ -3506,56 +4399,57 @@ function BrowserDiagnosticsDrawer(props) {
|
|
|
3506
4399
|
onRefresh: props.onRefreshDownloads
|
|
3507
4400
|
}
|
|
3508
4401
|
) : null,
|
|
3509
|
-
/* @__PURE__ */
|
|
3510
|
-
/* @__PURE__ */
|
|
3511
|
-
/* @__PURE__ */
|
|
4402
|
+
/* @__PURE__ */ jsxs2("section", { className: "p-3", "aria-labelledby": "browser-events-title", children: [
|
|
4403
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between gap-2", children: [
|
|
4404
|
+
/* @__PURE__ */ jsx2(
|
|
3512
4405
|
"h3",
|
|
3513
4406
|
{
|
|
3514
4407
|
id: "browser-events-title",
|
|
3515
|
-
className: "text-[10px] font-semibold uppercase tracking-[0.14em] text-og-subtle",
|
|
3516
|
-
children: "
|
|
4408
|
+
className: "text-[10px] font-semibold uppercase tracking-[0.14em] text-og-fg-subtle",
|
|
4409
|
+
children: t("browserViewer.recentEvents")
|
|
3517
4410
|
}
|
|
3518
4411
|
),
|
|
3519
|
-
props.state.batch?.truncated ? /* @__PURE__ */
|
|
4412
|
+
props.state.batch?.truncated ? /* @__PURE__ */ jsx2("span", { className: "text-[10px] text-og-fg-subtle", children: t("browserViewer.newest100") }) : null
|
|
3520
4413
|
] }),
|
|
3521
|
-
props.state.loading && !props.state.batch ? /* @__PURE__ */
|
|
3522
|
-
/* @__PURE__ */
|
|
3523
|
-
"
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
/* @__PURE__ */
|
|
4414
|
+
props.state.loading && !props.state.batch ? /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 py-6 text-og-control text-og-fg-muted", children: [
|
|
4415
|
+
/* @__PURE__ */ jsx2(LoaderCircleIcon, { className: "size-3.5 animate-spin" }),
|
|
4416
|
+
" ",
|
|
4417
|
+
t("browserViewer.loadingDiagnostics")
|
|
4418
|
+
] }) : props.state.error ? /* @__PURE__ */ jsxs2("div", { className: "py-5", children: [
|
|
4419
|
+
/* @__PURE__ */ jsx2("p", { className: "text-og-control text-og-danger", children: props.state.error.message }),
|
|
4420
|
+
/* @__PURE__ */ jsx2(
|
|
3527
4421
|
"button",
|
|
3528
4422
|
{
|
|
3529
4423
|
type: "button",
|
|
3530
4424
|
onClick: props.onRefresh,
|
|
3531
|
-
className: "mt-2 text-og-control font-medium
|
|
3532
|
-
children: "
|
|
4425
|
+
className: "mt-2 text-og-control font-medium og-link",
|
|
4426
|
+
children: t("browserViewer.tryAgain")
|
|
3533
4427
|
}
|
|
3534
4428
|
)
|
|
3535
|
-
] }) : props.state.batch?.entries.length ? /* @__PURE__ */
|
|
4429
|
+
] }) : props.state.batch?.entries.length ? /* @__PURE__ */ jsx2("ol", { className: "mt-2 space-y-2", children: props.state.batch.entries.map((entry) => /* @__PURE__ */ jsxs2(
|
|
3536
4430
|
"li",
|
|
3537
4431
|
{
|
|
3538
4432
|
className: "rounded-og-sm border border-og-border bg-og-bg p-2.5",
|
|
3539
4433
|
children: [
|
|
3540
|
-
/* @__PURE__ */
|
|
3541
|
-
/* @__PURE__ */
|
|
4434
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 text-[10px] text-og-fg-subtle", children: [
|
|
4435
|
+
/* @__PURE__ */ jsx2(
|
|
3542
4436
|
"span",
|
|
3543
4437
|
{
|
|
3544
4438
|
className: cn(
|
|
3545
4439
|
"font-semibold uppercase tracking-wide",
|
|
3546
4440
|
diagnosticTone(entry.level)
|
|
3547
4441
|
),
|
|
3548
|
-
children: diagnosticKindLabel(entry.kind)
|
|
4442
|
+
children: diagnosticKindLabel(t, entry.kind)
|
|
3549
4443
|
}
|
|
3550
4444
|
),
|
|
3551
|
-
/* @__PURE__ */
|
|
4445
|
+
/* @__PURE__ */ jsx2("span", { className: "ml-auto", children: formatDiagnosticTime(t, entry.occurredAt) })
|
|
3552
4446
|
] }),
|
|
3553
|
-
/* @__PURE__ */
|
|
3554
|
-
entry.url || entry.filename || entry.method || entry.status ? /* @__PURE__ */
|
|
4447
|
+
/* @__PURE__ */ jsx2("p", { className: "mt-1 whitespace-pre-wrap break-words text-og-xs leading-5 text-og-fg", children: entry.message }),
|
|
4448
|
+
entry.url || entry.filename || entry.method || entry.status ? /* @__PURE__ */ jsx2("p", { className: "mt-1 truncate font-og-mono text-[10px] text-og-fg-subtle", children: [entry.method, entry.status, entry.filename, entry.url].filter((value) => value !== null).join(" \xB7 ") }) : null
|
|
3555
4449
|
]
|
|
3556
4450
|
},
|
|
3557
4451
|
entry.sequence
|
|
3558
|
-
)) }) : /* @__PURE__ */
|
|
4452
|
+
)) }) : /* @__PURE__ */ jsx2("p", { className: "py-6 text-og-control text-og-fg-muted", children: t("browserViewer.noDiagnosticsForThisTab") })
|
|
3559
4453
|
] })
|
|
3560
4454
|
] })
|
|
3561
4455
|
]
|
|
@@ -3563,10 +4457,11 @@ function BrowserDiagnosticsDrawer(props) {
|
|
|
3563
4457
|
);
|
|
3564
4458
|
}
|
|
3565
4459
|
function BrowserDownloadsPanel(props) {
|
|
3566
|
-
const
|
|
3567
|
-
const [
|
|
3568
|
-
const [
|
|
3569
|
-
const [
|
|
4460
|
+
const t = useOpenGeniText();
|
|
4461
|
+
const [paths, setPaths] = useState9({});
|
|
4462
|
+
const [overwrite, setOverwrite] = useState9({});
|
|
4463
|
+
const [savedPaths, setSavedPaths] = useState9({});
|
|
4464
|
+
const [errors, setErrors] = useState9({});
|
|
3570
4465
|
const saving = useMemo2(() => new Set(props.savingDownloadIds), [props.savingDownloadIds]);
|
|
3571
4466
|
const save = (download) => {
|
|
3572
4467
|
const destinationPath = (paths[download.id] ?? defaultDownloadDestination(download)).trim();
|
|
@@ -3577,50 +4472,51 @@ function BrowserDownloadsPanel(props) {
|
|
|
3577
4472
|
}).catch((cause) => {
|
|
3578
4473
|
setErrors((current) => ({
|
|
3579
4474
|
...current,
|
|
3580
|
-
[download.id]: cause instanceof Error ? cause.message : "
|
|
4475
|
+
[download.id]: cause instanceof Error ? cause.message : t("browserViewer.couldNotSaveThisDownload")
|
|
3581
4476
|
}));
|
|
3582
4477
|
});
|
|
3583
4478
|
};
|
|
3584
|
-
return /* @__PURE__ */
|
|
3585
|
-
/* @__PURE__ */
|
|
3586
|
-
/* @__PURE__ */
|
|
3587
|
-
/* @__PURE__ */
|
|
4479
|
+
return /* @__PURE__ */ jsxs2("section", { className: "border-b border-og-border p-3", "aria-labelledby": "browser-downloads-title", children: [
|
|
4480
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
|
|
4481
|
+
/* @__PURE__ */ jsx2(DownloadIcon, { className: "size-3.5 text-og-fg-muted" }),
|
|
4482
|
+
/* @__PURE__ */ jsx2(
|
|
3588
4483
|
"h3",
|
|
3589
4484
|
{
|
|
3590
4485
|
id: "browser-downloads-title",
|
|
3591
|
-
className: "text-[10px] font-semibold uppercase tracking-[0.14em] text-og-subtle",
|
|
3592
|
-
children: "
|
|
4486
|
+
className: "text-[10px] font-semibold uppercase tracking-[0.14em] text-og-fg-subtle",
|
|
4487
|
+
children: t("browserViewer.downloads")
|
|
3593
4488
|
}
|
|
3594
4489
|
),
|
|
3595
|
-
props.refreshing ? /* @__PURE__ */
|
|
4490
|
+
props.refreshing ? /* @__PURE__ */ jsx2(LoaderCircleIcon, { className: "ml-auto size-3 animate-spin text-og-fg-muted" }) : null
|
|
3596
4491
|
] }),
|
|
3597
|
-
props.loading ? /* @__PURE__ */
|
|
3598
|
-
/* @__PURE__ */
|
|
3599
|
-
"
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
/* @__PURE__ */
|
|
4492
|
+
props.loading ? /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 py-5 text-og-control text-og-fg-muted", children: [
|
|
4493
|
+
/* @__PURE__ */ jsx2(LoaderCircleIcon, { className: "size-3.5 animate-spin" }),
|
|
4494
|
+
" ",
|
|
4495
|
+
t("browserViewer.loadingDownloads")
|
|
4496
|
+
] }) : props.error ? /* @__PURE__ */ jsxs2("div", { className: "py-4", children: [
|
|
4497
|
+
/* @__PURE__ */ jsx2("p", { className: "text-og-control text-og-danger", children: props.error.message }),
|
|
4498
|
+
/* @__PURE__ */ jsx2(
|
|
3603
4499
|
"button",
|
|
3604
4500
|
{
|
|
3605
4501
|
type: "button",
|
|
3606
4502
|
onClick: props.onRefresh,
|
|
3607
|
-
className: "mt-2 text-og-control font-medium
|
|
3608
|
-
children: "
|
|
4503
|
+
className: "mt-2 text-og-control font-medium og-link",
|
|
4504
|
+
children: t("browserViewer.tryAgain")
|
|
3609
4505
|
}
|
|
3610
4506
|
)
|
|
3611
|
-
] }) : props.downloads.length === 0 ? /* @__PURE__ */
|
|
4507
|
+
] }) : props.downloads.length === 0 ? /* @__PURE__ */ jsx2("p", { className: "py-4 text-og-control text-og-fg-muted", children: t("browserViewer.noFilesDownloadedYet") }) : /* @__PURE__ */ jsx2("ol", { className: "mt-2 space-y-2", children: props.downloads.map((download) => {
|
|
3612
4508
|
const destinationPath = paths[download.id] ?? defaultDownloadDestination(download);
|
|
3613
4509
|
const isSaving = saving.has(download.id);
|
|
3614
4510
|
const isSaved = savedPaths[download.id] === destinationPath;
|
|
3615
|
-
return /* @__PURE__ */
|
|
4511
|
+
return /* @__PURE__ */ jsxs2(
|
|
3616
4512
|
"li",
|
|
3617
4513
|
{
|
|
3618
4514
|
className: "rounded-og-sm border border-og-border bg-og-bg p-2.5",
|
|
3619
4515
|
children: [
|
|
3620
|
-
/* @__PURE__ */
|
|
3621
|
-
/* @__PURE__ */
|
|
3622
|
-
/* @__PURE__ */
|
|
3623
|
-
/* @__PURE__ */
|
|
4516
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex min-w-0 items-start gap-2", children: [
|
|
4517
|
+
/* @__PURE__ */ jsx2("span", { className: "mt-0.5 grid size-6 shrink-0 place-items-center rounded bg-og-surface-2 text-og-fg-muted", children: isSaved ? /* @__PURE__ */ jsx2(FileCheck2Icon, { className: "size-3.5 text-og-status-idle" }) : /* @__PURE__ */ jsx2(DownloadIcon, { className: "size-3.5" }) }),
|
|
4518
|
+
/* @__PURE__ */ jsxs2("div", { className: "min-w-0 flex-1", children: [
|
|
4519
|
+
/* @__PURE__ */ jsx2(
|
|
3624
4520
|
"p",
|
|
3625
4521
|
{
|
|
3626
4522
|
className: "truncate text-og-xs font-medium text-og-fg",
|
|
@@ -3628,12 +4524,12 @@ function BrowserDownloadsPanel(props) {
|
|
|
3628
4524
|
children: download.filename
|
|
3629
4525
|
}
|
|
3630
4526
|
),
|
|
3631
|
-
/* @__PURE__ */
|
|
4527
|
+
/* @__PURE__ */ jsx2("p", { className: "mt-0.5 text-[10px] text-og-fg-subtle", children: downloadStatusLabel(t, download) })
|
|
3632
4528
|
] })
|
|
3633
4529
|
] }),
|
|
3634
|
-
download.status === "completed" ? /* @__PURE__ */
|
|
3635
|
-
/* @__PURE__ */
|
|
3636
|
-
/* @__PURE__ */
|
|
4530
|
+
download.status === "completed" ? /* @__PURE__ */ jsxs2("div", { className: "mt-2", children: [
|
|
4531
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex gap-1.5", children: [
|
|
4532
|
+
/* @__PURE__ */ jsx2(
|
|
3637
4533
|
"input",
|
|
3638
4534
|
{
|
|
3639
4535
|
type: "text",
|
|
@@ -3647,11 +4543,13 @@ function BrowserDownloadsPanel(props) {
|
|
|
3647
4543
|
if (event.key === "Enter") save(download);
|
|
3648
4544
|
},
|
|
3649
4545
|
disabled: isSaving,
|
|
3650
|
-
"aria-label":
|
|
3651
|
-
|
|
4546
|
+
"aria-label": t("browserViewer.workspacePathForFilename", {
|
|
4547
|
+
filename: download.filename
|
|
4548
|
+
}),
|
|
4549
|
+
className: "h-7 min-w-0 flex-1 rounded-og-sm border border-og-border bg-og-surface-1 px-2 font-og-mono text-[10px] text-og-fg transition focus:border-og-accent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent disabled:opacity-50"
|
|
3652
4550
|
}
|
|
3653
4551
|
),
|
|
3654
|
-
/* @__PURE__ */
|
|
4552
|
+
/* @__PURE__ */ jsxs2(
|
|
3655
4553
|
"button",
|
|
3656
4554
|
{
|
|
3657
4555
|
type: "button",
|
|
@@ -3659,14 +4557,14 @@ function BrowserDownloadsPanel(props) {
|
|
|
3659
4557
|
disabled: isSaving || !destinationPath.trim() || isSaved && !overwrite[download.id],
|
|
3660
4558
|
className: "inline-flex h-7 shrink-0 items-center gap-1 rounded-og-sm border border-og-border bg-og-surface-1 px-2 text-[10px] font-medium text-og-fg transition hover:bg-og-surface-2 disabled:opacity-40",
|
|
3661
4559
|
children: [
|
|
3662
|
-
isSaving ? /* @__PURE__ */
|
|
3663
|
-
isSaving ? "
|
|
4560
|
+
isSaving ? /* @__PURE__ */ jsx2(LoaderCircleIcon, { className: "size-3 animate-spin" }) : /* @__PURE__ */ jsx2(SaveIcon, { className: "size-3" }),
|
|
4561
|
+
isSaving ? t("browserViewer.saving") : isSaved ? t("browserViewer.saved") : overwrite[download.id] ? t("browserViewer.replace") : t("browserViewer.save")
|
|
3664
4562
|
]
|
|
3665
4563
|
}
|
|
3666
4564
|
)
|
|
3667
4565
|
] }),
|
|
3668
|
-
/* @__PURE__ */
|
|
3669
|
-
/* @__PURE__ */
|
|
4566
|
+
/* @__PURE__ */ jsxs2("label", { className: "mt-1.5 flex w-fit items-center gap-1.5 text-[10px] text-og-fg-subtle", children: [
|
|
4567
|
+
/* @__PURE__ */ jsx2(
|
|
3670
4568
|
"input",
|
|
3671
4569
|
{
|
|
3672
4570
|
type: "checkbox",
|
|
@@ -3682,9 +4580,9 @@ function BrowserDownloadsPanel(props) {
|
|
|
3682
4580
|
className: "size-3 accent-og-accent"
|
|
3683
4581
|
}
|
|
3684
4582
|
),
|
|
3685
|
-
"
|
|
4583
|
+
t("browserViewer.replaceAnExistingWorkspaceFile")
|
|
3686
4584
|
] }),
|
|
3687
|
-
errors[download.id] ? /* @__PURE__ */
|
|
4585
|
+
errors[download.id] ? /* @__PURE__ */ jsx2("p", { className: "mt-1.5 break-words text-[10px] text-og-danger", children: errors[download.id] }) : null
|
|
3688
4586
|
] }) : null
|
|
3689
4587
|
]
|
|
3690
4588
|
},
|
|
@@ -3693,15 +4591,18 @@ function BrowserDownloadsPanel(props) {
|
|
|
3693
4591
|
}) })
|
|
3694
4592
|
] });
|
|
3695
4593
|
}
|
|
3696
|
-
function downloadStatusLabel(download) {
|
|
4594
|
+
function downloadStatusLabel(t, download) {
|
|
3697
4595
|
if (download.status === "completed") return formatBytes(download.receivedBytes);
|
|
3698
4596
|
if (download.status === "in_progress") {
|
|
3699
4597
|
const received = formatBytes(download.receivedBytes);
|
|
3700
|
-
return download.totalBytes === null ?
|
|
4598
|
+
return download.totalBytes === null ? t("browserViewer.downloadingReceived", { received }) : t("browserViewer.downloadingReceivedOfBytes", {
|
|
4599
|
+
received,
|
|
4600
|
+
bytes: formatBytes(download.totalBytes)
|
|
4601
|
+
});
|
|
3701
4602
|
}
|
|
3702
|
-
if (download.status === "cancelled") return "
|
|
3703
|
-
if (download.status === "unavailable") return "
|
|
3704
|
-
return "
|
|
4603
|
+
if (download.status === "cancelled") return t("browserViewer.cancelled");
|
|
4604
|
+
if (download.status === "unavailable") return t("browserViewer.noLongerAvailable");
|
|
4605
|
+
return t("browserViewer.downloadFailed");
|
|
3705
4606
|
}
|
|
3706
4607
|
function defaultDownloadDestination(download) {
|
|
3707
4608
|
const leaf = download.filename.split(/[\\/]/u).at(-1)?.trim() ?? "";
|
|
@@ -3712,65 +4613,66 @@ function defaultDownloadDestination(download) {
|
|
|
3712
4613
|
return portable;
|
|
3713
4614
|
}
|
|
3714
4615
|
function DiagnosticFact(props) {
|
|
3715
|
-
return /* @__PURE__ */
|
|
3716
|
-
/* @__PURE__ */
|
|
3717
|
-
/* @__PURE__ */
|
|
4616
|
+
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
4617
|
+
/* @__PURE__ */ jsx2("dt", { className: "text-og-fg-subtle", children: props.label }),
|
|
4618
|
+
/* @__PURE__ */ jsx2("dd", { className: "min-w-0 truncate text-og-fg", title: props.value, children: props.value })
|
|
3718
4619
|
] });
|
|
3719
4620
|
}
|
|
3720
4621
|
function DiagnosticCount(props) {
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
/* @__PURE__ */
|
|
4622
|
+
const t = useOpenGeniText();
|
|
4623
|
+
return /* @__PURE__ */ jsxs2("div", { className: "rounded-og-sm border border-og-border bg-og-bg px-2.5 py-2", children: [
|
|
4624
|
+
/* @__PURE__ */ jsx2("dt", { className: "text-[10px] text-og-fg-subtle", children: props.label }),
|
|
4625
|
+
/* @__PURE__ */ jsx2(
|
|
3724
4626
|
"dd",
|
|
3725
4627
|
{
|
|
3726
4628
|
className: cn(
|
|
3727
4629
|
"mt-0.5 text-og-sm font-semibold",
|
|
3728
|
-
props.value ? "text-og-fg" : "text-og-muted"
|
|
4630
|
+
props.value ? "text-og-fg" : "text-og-fg-muted"
|
|
3729
4631
|
),
|
|
3730
|
-
children: props.value
|
|
4632
|
+
children: props.value ?? t("browserViewer.unavailable")
|
|
3731
4633
|
}
|
|
3732
4634
|
)
|
|
3733
4635
|
] });
|
|
3734
4636
|
}
|
|
3735
|
-
function browserEngineLabel(session) {
|
|
3736
|
-
if (!session) return "
|
|
4637
|
+
function browserEngineLabel(t, session) {
|
|
4638
|
+
if (!session) return t("browserViewer.unavailable");
|
|
3737
4639
|
const version = session.engineVersion ? ` ${session.engineVersion}` : "";
|
|
3738
4640
|
return `${session.engine}${version} \xB7 ${session.headless ? "headless" : "headed"}`;
|
|
3739
4641
|
}
|
|
3740
|
-
function shortGeneration(value) {
|
|
3741
|
-
if (!value) return "
|
|
4642
|
+
function shortGeneration(t, value) {
|
|
4643
|
+
if (!value) return t("browserViewer.unavailable");
|
|
3742
4644
|
return value.length > 16 ? `${value.slice(0, 8)}\u2026${value.slice(-6)}` : value;
|
|
3743
4645
|
}
|
|
3744
|
-
function diagnosticKindLabel(kind) {
|
|
4646
|
+
function diagnosticKindLabel(t, kind) {
|
|
3745
4647
|
switch (kind) {
|
|
3746
4648
|
case "console":
|
|
3747
|
-
return "
|
|
4649
|
+
return t("browserViewer.console");
|
|
3748
4650
|
case "page_error":
|
|
3749
|
-
return "
|
|
4651
|
+
return t("browserViewer.pageError");
|
|
3750
4652
|
case "failed_request":
|
|
3751
|
-
return "
|
|
4653
|
+
return t("browserViewer.request");
|
|
3752
4654
|
case "download":
|
|
3753
|
-
return "
|
|
4655
|
+
return t("browserViewer.download");
|
|
3754
4656
|
}
|
|
3755
4657
|
}
|
|
3756
4658
|
function diagnosticTone(level) {
|
|
3757
|
-
if (level === "error") return "text-og-
|
|
4659
|
+
if (level === "error") return "text-og-danger";
|
|
3758
4660
|
if (level === "warning") return "text-og-status-waiting";
|
|
3759
|
-
return "text-og-muted";
|
|
4661
|
+
return "text-og-fg-muted";
|
|
3760
4662
|
}
|
|
3761
|
-
function formatDiagnosticTime(value) {
|
|
4663
|
+
function formatDiagnosticTime(t, value) {
|
|
3762
4664
|
const date = new Date(value);
|
|
3763
|
-
return Number.isNaN(date.getTime()) ? "" : date.toLocaleTimeString(
|
|
4665
|
+
return Number.isNaN(date.getTime()) ? "" : date.toLocaleTimeString(t.locale, { hour: "2-digit", minute: "2-digit", second: "2-digit" });
|
|
3764
4666
|
}
|
|
3765
4667
|
function BrowserNotice(props) {
|
|
3766
|
-
return /* @__PURE__ */
|
|
4668
|
+
return /* @__PURE__ */ jsx2(
|
|
3767
4669
|
"div",
|
|
3768
4670
|
{
|
|
3769
4671
|
className: cn(
|
|
3770
|
-
"grid h-full place-items-center bg-og-bg text-og-control text-og-muted",
|
|
4672
|
+
"grid h-full place-items-center bg-og-bg text-og-control text-og-fg-muted",
|
|
3771
4673
|
props.className
|
|
3772
4674
|
),
|
|
3773
|
-
children: /* @__PURE__ */
|
|
4675
|
+
children: /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
|
|
3774
4676
|
props.icon,
|
|
3775
4677
|
props.text
|
|
3776
4678
|
] })
|
|
@@ -3819,7 +4721,10 @@ function frameMatchesSelectedTarget(frame, session, target) {
|
|
|
3819
4721
|
);
|
|
3820
4722
|
}
|
|
3821
4723
|
function sameFrameFence(left, right) {
|
|
3822
|
-
return left
|
|
4724
|
+
return sameBrowserDocument(left, right) && left.frameId === right.frameId;
|
|
4725
|
+
}
|
|
4726
|
+
function sameBrowserDocument(left, right) {
|
|
4727
|
+
return left.browserSessionId === right.browserSessionId && left.controllerGeneration === right.controllerGeneration && left.targetId === right.targetId && left.targetGeneration === right.targetGeneration && left.documentGeneration === right.documentGeneration;
|
|
3823
4728
|
}
|
|
3824
4729
|
function sameOptionalBrowserFrame(left, right) {
|
|
3825
4730
|
return left === null || right === null ? left === right : sameFrameFence(left, right);
|
|
@@ -3844,46 +4749,46 @@ function countInterventions(interventions) {
|
|
|
3844
4749
|
}
|
|
3845
4750
|
return counts;
|
|
3846
4751
|
}
|
|
3847
|
-
function interventionTitle(intervention) {
|
|
4752
|
+
function interventionTitle(t, intervention) {
|
|
3848
4753
|
switch (intervention.kind) {
|
|
3849
4754
|
case "manual_login":
|
|
3850
|
-
return "
|
|
4755
|
+
return t("browserViewer.signInNeeded");
|
|
3851
4756
|
case "mfa":
|
|
3852
|
-
return "
|
|
4757
|
+
return t("browserViewer.verificationNeeded");
|
|
3853
4758
|
case "external_action":
|
|
3854
4759
|
case "confirmation":
|
|
3855
|
-
return "
|
|
4760
|
+
return t("browserViewer.actionNeeded");
|
|
3856
4761
|
case "other":
|
|
3857
|
-
return "
|
|
4762
|
+
return t("browserViewer.browserNeedsYourHelp");
|
|
3858
4763
|
}
|
|
3859
4764
|
}
|
|
3860
|
-
function placementLabel(session) {
|
|
4765
|
+
function placementLabel(t, session) {
|
|
3861
4766
|
if (!session) return "";
|
|
3862
4767
|
switch (session.placement.kind) {
|
|
3863
4768
|
case "sandbox_group":
|
|
3864
|
-
return "
|
|
4769
|
+
return t("browserViewer.agentSandbox");
|
|
3865
4770
|
case "connected_machine":
|
|
3866
|
-
return "
|
|
4771
|
+
return t("browserViewer.connectedMachine");
|
|
3867
4772
|
case "attached_device":
|
|
3868
|
-
return "
|
|
4773
|
+
return t("browserViewer.yourBrowser");
|
|
3869
4774
|
case "external_provider":
|
|
3870
|
-
return "
|
|
4775
|
+
return t("browserViewer.cloudBrowser");
|
|
3871
4776
|
}
|
|
3872
4777
|
}
|
|
3873
|
-
function browserConnectionLabel(state) {
|
|
4778
|
+
function browserConnectionLabel(t, state) {
|
|
3874
4779
|
switch (state) {
|
|
3875
4780
|
case "attaching":
|
|
3876
|
-
return "
|
|
4781
|
+
return t("browserViewer.openingBrowser");
|
|
3877
4782
|
case "connecting":
|
|
3878
|
-
return "
|
|
4783
|
+
return t("browserViewer.connecting");
|
|
3879
4784
|
case "reconnecting":
|
|
3880
|
-
return "
|
|
4785
|
+
return t("browserViewer.reconnecting");
|
|
3881
4786
|
case "error":
|
|
3882
|
-
return "
|
|
4787
|
+
return t("browserViewer.disconnected");
|
|
3883
4788
|
case "semantic":
|
|
3884
|
-
return "
|
|
4789
|
+
return t("browserViewer.semantic");
|
|
3885
4790
|
default:
|
|
3886
|
-
return "
|
|
4791
|
+
return t("browserViewer.waitingForBrowser");
|
|
3887
4792
|
}
|
|
3888
4793
|
}
|
|
3889
4794
|
function shortUrl(value) {
|
|
@@ -3895,13 +4800,14 @@ function shortUrl(value) {
|
|
|
3895
4800
|
}
|
|
3896
4801
|
|
|
3897
4802
|
export {
|
|
3898
|
-
|
|
4803
|
+
useSiteAuthConnections,
|
|
3899
4804
|
useAttachedBrowsers,
|
|
4805
|
+
useBrowserSessions,
|
|
3900
4806
|
useBrowserIdentities,
|
|
3901
|
-
useBrowserDownloads,
|
|
3902
4807
|
useBrowserSession,
|
|
3903
|
-
|
|
3904
|
-
|
|
4808
|
+
useBrowserDownloads,
|
|
4809
|
+
useBrowserFrameStream,
|
|
4810
|
+
staleBrowserEndRetryDelayMs,
|
|
3905
4811
|
BrowserViewer
|
|
3906
4812
|
};
|
|
3907
|
-
//# sourceMappingURL=chunk-
|
|
4813
|
+
//# sourceMappingURL=chunk-62XZ3IX3.js.map
|