@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,13 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import {
|
|
2
3
|
InteractionInterventionBanner,
|
|
4
|
+
isInteractionControlUnavailable,
|
|
3
5
|
isNonRetryableInteractionError,
|
|
4
6
|
isSourcePlacementChangedError,
|
|
5
7
|
useInteractionInterventions,
|
|
6
|
-
useInteractionInvalidation
|
|
7
|
-
|
|
8
|
+
useInteractionInvalidation,
|
|
9
|
+
useViewerMenuDismiss
|
|
10
|
+
} from "./chunk-JAYYFOOB.js";
|
|
11
|
+
import {
|
|
12
|
+
copyTextToClipboard
|
|
13
|
+
} from "./chunk-PEHTX3V7.js";
|
|
8
14
|
import {
|
|
9
15
|
DesktopViewer
|
|
10
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-EWATYP5L.js";
|
|
17
|
+
import {
|
|
18
|
+
usePageLiveActivity
|
|
19
|
+
} from "./chunk-NAWXARTY.js";
|
|
20
|
+
import {
|
|
21
|
+
useEmbeddedComputerInteraction
|
|
22
|
+
} from "./chunk-ZGFU4LVW.js";
|
|
11
23
|
import {
|
|
12
24
|
STREAM_CLOSE_REASON_NORMAL,
|
|
13
25
|
STREAM_KIND_COMPUTER,
|
|
@@ -16,19 +28,13 @@ import {
|
|
|
16
28
|
decodeStreamOpenAck,
|
|
17
29
|
encodeStreamClose,
|
|
18
30
|
encodeStreamOpen
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import {
|
|
21
|
-
copyTextToClipboard
|
|
22
|
-
} from "./chunk-JVYQRRC4.js";
|
|
23
|
-
import {
|
|
24
|
-
usePageLiveActivity
|
|
25
|
-
} from "./chunk-KZ73RL76.js";
|
|
26
|
-
import {
|
|
27
|
-
useEmbeddedComputerInteraction
|
|
28
|
-
} from "./chunk-NEXLLTP4.js";
|
|
31
|
+
} from "./chunk-TNEZNMSN.js";
|
|
29
32
|
import {
|
|
30
33
|
cn
|
|
31
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-TXS65BB2.js";
|
|
35
|
+
import {
|
|
36
|
+
useOpenGeniText
|
|
37
|
+
} from "./chunk-VU4QUISJ.js";
|
|
32
38
|
|
|
33
39
|
// src/components/computer-viewer.tsx
|
|
34
40
|
import { interactionControlFailureFromError } from "@opengeni/sdk/interaction";
|
|
@@ -46,11 +52,12 @@ import {
|
|
|
46
52
|
RotateCcwIcon
|
|
47
53
|
} from "lucide-react";
|
|
48
54
|
import {
|
|
49
|
-
useCallback as
|
|
50
|
-
useEffect as
|
|
55
|
+
useCallback as useCallback5,
|
|
56
|
+
useEffect as useEffect5,
|
|
57
|
+
useLayoutEffect,
|
|
51
58
|
useMemo as useMemo2,
|
|
52
|
-
useRef as
|
|
53
|
-
useState as
|
|
59
|
+
useRef as useRef5,
|
|
60
|
+
useState as useState5
|
|
54
61
|
} from "react";
|
|
55
62
|
|
|
56
63
|
// src/hooks/use-computer-frame-stream.ts
|
|
@@ -65,6 +72,7 @@ var RELAY_TAG_FRAME = 3;
|
|
|
65
72
|
var RELAY_TAG_CLOSE = 4;
|
|
66
73
|
var MAX_AUTOMATIC_RECONNECTS_WITHOUT_A_FRAME = 2;
|
|
67
74
|
function useComputerFrameStream(options) {
|
|
75
|
+
const t = useOpenGeniText();
|
|
68
76
|
const { client, workspaceId } = useEmbeddedComputerInteraction(options);
|
|
69
77
|
const enabled = options.enabled ?? true;
|
|
70
78
|
const [nonce, setNonce] = useState(0);
|
|
@@ -144,9 +152,18 @@ function useComputerFrameStream(options) {
|
|
|
144
152
|
socketHandlers = null;
|
|
145
153
|
pendingFrame = null;
|
|
146
154
|
};
|
|
155
|
+
const clearRecoveryTimers = () => {
|
|
156
|
+
if (reconnectTimer) clearTimeout(reconnectTimer);
|
|
157
|
+
if (expiryTimer) clearTimeout(expiryTimer);
|
|
158
|
+
reconnectTimer = null;
|
|
159
|
+
expiryTimer = null;
|
|
160
|
+
};
|
|
147
161
|
const scheduleReconnect = () => {
|
|
148
162
|
if (disposed || reconnectTimer) return;
|
|
149
|
-
if (failures >= MAX_AUTOMATIC_RECONNECTS_WITHOUT_A_FRAME)
|
|
163
|
+
if (failures >= MAX_AUTOMATIC_RECONNECTS_WITHOUT_A_FRAME) {
|
|
164
|
+
clearRecoveryTimers();
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
150
167
|
const delay = Math.min(5e3, 250 * 2 ** Math.min(failures, 5));
|
|
151
168
|
failures += 1;
|
|
152
169
|
setResult((current) => ({ ...current, state: "reconnecting" }));
|
|
@@ -161,6 +178,7 @@ function useComputerFrameStream(options) {
|
|
|
161
178
|
setResult((current) => ({ ...current, state: "error", error }));
|
|
162
179
|
clearSocket();
|
|
163
180
|
if (reconnectAutomatically) scheduleReconnect();
|
|
181
|
+
else clearRecoveryTimers();
|
|
164
182
|
};
|
|
165
183
|
const onOpen = (source) => {
|
|
166
184
|
if (disposed || source !== socket) return;
|
|
@@ -260,12 +278,11 @@ function useComputerFrameStream(options) {
|
|
|
260
278
|
};
|
|
261
279
|
const onError = (source) => {
|
|
262
280
|
if (source !== socket) return;
|
|
263
|
-
fail(new Error("
|
|
281
|
+
fail(new Error(t("hooks.useComputerFrameStream.desktopViewLostConnection")));
|
|
264
282
|
};
|
|
265
283
|
const onClose = (source) => {
|
|
266
284
|
if (disposed || source !== socket) return;
|
|
267
|
-
|
|
268
|
-
scheduleReconnect();
|
|
285
|
+
fail(new Error(t("hooks.useComputerFrameStream.desktopViewLostConnection")));
|
|
269
286
|
};
|
|
270
287
|
const connectSocket = () => {
|
|
271
288
|
if (disposed) return;
|
|
@@ -320,13 +337,14 @@ function useComputerFrameStream(options) {
|
|
|
320
337
|
expiresInSeconds: 120,
|
|
321
338
|
...streamRef.current ? { stream: streamRef.current } : {}
|
|
322
339
|
},
|
|
323
|
-
{ signal: attachmentAbort.signal }
|
|
340
|
+
{ signal: attachmentAbort.signal, timeoutMs: 15e3 }
|
|
324
341
|
);
|
|
325
342
|
if (disposed) return;
|
|
326
343
|
if (attachment.computerSessionId !== computerSessionId || attachment.targetId !== targetId) {
|
|
327
344
|
throw new Error("desktop attachment does not match the requested resource");
|
|
328
345
|
}
|
|
329
346
|
controllerGeneration = attachment.controllerGeneration;
|
|
347
|
+
latestRef.current = { key: "", sequence: -1 };
|
|
330
348
|
activeAttachment = attachment;
|
|
331
349
|
activeStream = attachment.stream;
|
|
332
350
|
attachmentExpiresAt = Date.parse(attachment.expiresAt);
|
|
@@ -339,6 +357,7 @@ function useComputerFrameStream(options) {
|
|
|
339
357
|
computerSessionId: attachment.computerSessionId,
|
|
340
358
|
controllerGeneration: attachment.controllerGeneration,
|
|
341
359
|
targetId: attachment.targetId,
|
|
360
|
+
inputAllowed: attachment.inputAllowed,
|
|
342
361
|
stream: attachment.stream,
|
|
343
362
|
expiresAt: attachment.expiresAt
|
|
344
363
|
},
|
|
@@ -364,11 +383,10 @@ function useComputerFrameStream(options) {
|
|
|
364
383
|
disposed = true;
|
|
365
384
|
pendingFrame = null;
|
|
366
385
|
attachmentAbort.abort();
|
|
367
|
-
|
|
368
|
-
if (expiryTimer) clearTimeout(expiryTimer);
|
|
386
|
+
clearRecoveryTimers();
|
|
369
387
|
clearSocket(true);
|
|
370
388
|
};
|
|
371
|
-
}, [client, enabled, nonce, options.computerSessionId, options.targetId, workspaceId]);
|
|
389
|
+
}, [client, enabled, nonce, options.computerSessionId, options.targetId, workspaceId, t]);
|
|
372
390
|
return { ...result, reconnect };
|
|
373
391
|
}
|
|
374
392
|
function relayDatagram(tag, body) {
|
|
@@ -394,27 +412,52 @@ function isPlacementGenerationLossError(cause) {
|
|
|
394
412
|
|
|
395
413
|
// src/hooks/use-computer-session.ts
|
|
396
414
|
import { useCallback as useCallback2, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
415
|
+
var actionResultFences = /* @__PURE__ */ new WeakMap();
|
|
416
|
+
function isStaleComputerActionResult(value) {
|
|
417
|
+
return typeof value === "object" && value !== null && actionResultFences.get(value)?.() === false;
|
|
418
|
+
}
|
|
419
|
+
function computerActionReceiptError(t, receipt) {
|
|
420
|
+
const error = new Error(
|
|
421
|
+
receipt.error?.message ?? t("hooks.useComputerSession.desktopInputDidNotComplete")
|
|
422
|
+
);
|
|
423
|
+
const fence = actionResultFences.get(receipt);
|
|
424
|
+
if (fence) actionResultFences.set(error, fence);
|
|
425
|
+
return error;
|
|
426
|
+
}
|
|
397
427
|
function useComputerSession(options) {
|
|
428
|
+
const t = useOpenGeniText();
|
|
398
429
|
const { client, workspaceId } = useEmbeddedComputerInteraction(options);
|
|
399
430
|
const computerSessionId = options.computerSessionId;
|
|
400
431
|
const enabled = (options.enabled ?? true) && computerSessionId !== null;
|
|
432
|
+
const sourceRef = useRef2({
|
|
433
|
+
client,
|
|
434
|
+
workspaceId,
|
|
435
|
+
computerSessionId,
|
|
436
|
+
enabled
|
|
437
|
+
});
|
|
438
|
+
if (sourceRef.current.client !== client || sourceRef.current.workspaceId !== workspaceId || sourceRef.current.computerSessionId !== computerSessionId || sourceRef.current.enabled !== enabled) {
|
|
439
|
+
sourceRef.current = { client, workspaceId, computerSessionId, enabled };
|
|
440
|
+
}
|
|
441
|
+
const source = sourceRef.current;
|
|
401
442
|
const pageLive = usePageLiveActivity();
|
|
402
443
|
const pollIntervalMs = Math.max(750, options.pollIntervalMs ?? 2e3);
|
|
403
|
-
const [state, setState] = useState2(
|
|
404
|
-
|
|
405
|
-
);
|
|
406
|
-
const visible = state.computerSessionId === computerSessionId ? state : emptyState(computerSessionId, enabled);
|
|
444
|
+
const [state, setState] = useState2(() => emptyState(source, enabled));
|
|
445
|
+
const visible = state.source === source ? state : emptyState(source, enabled);
|
|
407
446
|
const refreshBlocked = isNonRetryableInteractionError(visible.error);
|
|
408
447
|
const selectedTargetIdRef = useRef2(visible.selectedTargetId);
|
|
409
448
|
selectedTargetIdRef.current = visible.selectedTargetId;
|
|
449
|
+
const selectionRevisionRef = useRef2(0);
|
|
450
|
+
const actionResultOrderRef = useRef2({ next: 0, settled: 0 });
|
|
410
451
|
const targetsRef = useRef2({
|
|
452
|
+
source,
|
|
411
453
|
computerSessionId,
|
|
412
454
|
targets: visible.targets
|
|
413
455
|
});
|
|
414
|
-
const observationRef = useRef2({ computerSessionId, observation: visible.observation });
|
|
415
|
-
if (targetsRef.current.
|
|
416
|
-
targetsRef.current = { computerSessionId, targets: visible.targets };
|
|
456
|
+
const observationRef = useRef2({ source, computerSessionId, observation: visible.observation });
|
|
457
|
+
if (targetsRef.current.source !== source) {
|
|
458
|
+
targetsRef.current = { source, computerSessionId, targets: visible.targets };
|
|
417
459
|
observationRef.current = {
|
|
460
|
+
source,
|
|
418
461
|
computerSessionId,
|
|
419
462
|
observation: visible.observation
|
|
420
463
|
};
|
|
@@ -428,20 +471,26 @@ function useComputerSession(options) {
|
|
|
428
471
|
});
|
|
429
472
|
const mutationRef = useRef2({
|
|
430
473
|
computerSessionId,
|
|
474
|
+
source,
|
|
431
475
|
count: 0
|
|
432
476
|
});
|
|
433
477
|
const mountedRef = useRef2(true);
|
|
478
|
+
const isCurrentSource = useCallback2(
|
|
479
|
+
() => mountedRef.current && sourceRef.current === source,
|
|
480
|
+
[source]
|
|
481
|
+
);
|
|
434
482
|
const invalidateRefresh = useCallback2(() => {
|
|
435
483
|
const id = requestRef.current.id + 1;
|
|
436
484
|
requestRef.current.controller?.abort();
|
|
437
485
|
requestRef.current = { id, controller: null };
|
|
438
486
|
}, []);
|
|
439
487
|
const refresh = useCallback2(async () => {
|
|
440
|
-
if (!enabled || !computerSessionId) return;
|
|
488
|
+
if (!enabled || !computerSessionId || !isCurrentSource()) return;
|
|
441
489
|
const id = requestRef.current.id + 1;
|
|
442
490
|
requestRef.current.controller?.abort();
|
|
443
491
|
const controller = new AbortController();
|
|
444
492
|
requestRef.current = { id, controller };
|
|
493
|
+
let discoveryCompleted = false;
|
|
445
494
|
try {
|
|
446
495
|
const [session, targetResponse] = await Promise.all([
|
|
447
496
|
client.getComputerSession(workspaceId, computerSessionId, {
|
|
@@ -451,56 +500,84 @@ function useComputerSession(options) {
|
|
|
451
500
|
signal: controller.signal
|
|
452
501
|
})
|
|
453
502
|
]);
|
|
454
|
-
|
|
503
|
+
discoveryCompleted = true;
|
|
504
|
+
if (!isCurrentSource() || requestRef.current.id !== id) return;
|
|
455
505
|
const targets = sortComputerTargets(targetResponse.targets);
|
|
456
|
-
const selected = chooseTarget(targets, selectedTargetIdRef.current
|
|
506
|
+
const selected = chooseTarget(targets, selectedTargetIdRef.current);
|
|
507
|
+
const selectedId = selected?.id ?? selectedTargetIdRef.current;
|
|
508
|
+
const previous = observationRef.current.source === source ? observationRef.current.observation : null;
|
|
509
|
+
const retainedObservation = selected && previous?.target.id === selected.id && previous.target.controllerGeneration === selected.controllerGeneration && previous.target.targetGeneration === selected.targetGeneration ? previous : null;
|
|
510
|
+
selectedTargetIdRef.current = selectedId;
|
|
511
|
+
targetsRef.current = { source, computerSessionId, targets };
|
|
512
|
+
observationRef.current = { source, computerSessionId, observation: retainedObservation };
|
|
513
|
+
setState(
|
|
514
|
+
(current) => isCurrentSource() && current.source === source && current.computerSessionId === computerSessionId ? {
|
|
515
|
+
...current,
|
|
516
|
+
session,
|
|
517
|
+
targets,
|
|
518
|
+
selectedTargetId: selectedId,
|
|
519
|
+
observation: retainedObservation,
|
|
520
|
+
loading: false,
|
|
521
|
+
error: null,
|
|
522
|
+
controlError: null
|
|
523
|
+
} : current
|
|
524
|
+
);
|
|
457
525
|
const observation = selected ? await client.observeComputerTarget(workspaceId, computerSessionId, selected.id, {
|
|
458
526
|
signal: controller.signal
|
|
459
527
|
}) : null;
|
|
460
|
-
if (!
|
|
461
|
-
selectedTargetIdRef.current =
|
|
462
|
-
targetsRef.current = { computerSessionId, targets };
|
|
463
|
-
observationRef.current = { computerSessionId, observation };
|
|
528
|
+
if (!isCurrentSource() || requestRef.current.id !== id) return;
|
|
529
|
+
selectedTargetIdRef.current = selectedId;
|
|
530
|
+
targetsRef.current = { source, computerSessionId, targets };
|
|
531
|
+
observationRef.current = { source, computerSessionId, observation };
|
|
464
532
|
setState(
|
|
465
|
-
(current) => current.computerSessionId === computerSessionId ? {
|
|
533
|
+
(current) => isCurrentSource() && current.source === source && current.computerSessionId === computerSessionId ? {
|
|
466
534
|
...current,
|
|
467
535
|
session,
|
|
468
536
|
targets,
|
|
469
|
-
selectedTargetId:
|
|
537
|
+
selectedTargetId: selectedId,
|
|
470
538
|
observation,
|
|
471
539
|
loading: false,
|
|
472
540
|
error: null
|
|
473
541
|
} : current
|
|
474
542
|
);
|
|
475
543
|
} catch (cause) {
|
|
476
|
-
if (controller.signal.aborted || !
|
|
544
|
+
if (controller.signal.aborted || !isCurrentSource() || requestRef.current.id !== id) return;
|
|
545
|
+
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
477
546
|
setState(
|
|
478
|
-
(current) => current.computerSessionId === computerSessionId ? {
|
|
547
|
+
(current) => isCurrentSource() && current.source === source && current.computerSessionId === computerSessionId ? {
|
|
479
548
|
...current,
|
|
480
549
|
loading: false,
|
|
481
|
-
error
|
|
550
|
+
error,
|
|
551
|
+
controlError: isInteractionControlUnavailable(
|
|
552
|
+
error,
|
|
553
|
+
discoveryCompleted ? "observation" : "control"
|
|
554
|
+
) ? error : current.controlError
|
|
482
555
|
} : current
|
|
483
556
|
);
|
|
484
557
|
} finally {
|
|
485
558
|
if (requestRef.current.id === id) requestRef.current = { id, controller: null };
|
|
486
559
|
}
|
|
487
|
-
}, [client, computerSessionId, enabled, workspaceId]);
|
|
560
|
+
}, [client, computerSessionId, enabled, isCurrentSource, source, workspaceId]);
|
|
488
561
|
useEffect2(() => {
|
|
489
562
|
mountedRef.current = true;
|
|
490
563
|
if (!enabled) {
|
|
491
564
|
invalidateRefresh();
|
|
492
|
-
setState(emptyState(
|
|
565
|
+
setState(emptyState(source, false));
|
|
493
566
|
return;
|
|
494
567
|
}
|
|
495
568
|
setState(
|
|
496
|
-
(current) => current.
|
|
569
|
+
(current) => current.source === source ? {
|
|
570
|
+
...current,
|
|
571
|
+
loading: true,
|
|
572
|
+
mutating: mutationRef.current.source === source && mutationRef.current.count > 0
|
|
573
|
+
} : emptyState(source, true)
|
|
497
574
|
);
|
|
498
575
|
void refresh();
|
|
499
576
|
return () => {
|
|
500
577
|
mountedRef.current = false;
|
|
501
578
|
invalidateRefresh();
|
|
502
579
|
};
|
|
503
|
-
}, [computerSessionId, enabled, invalidateRefresh, refresh]);
|
|
580
|
+
}, [computerSessionId, enabled, invalidateRefresh, refresh, source]);
|
|
504
581
|
useEffect2(() => {
|
|
505
582
|
if (!enabled || !pageLive || visible.mutating || refreshBlocked) return;
|
|
506
583
|
const timer = setInterval(() => {
|
|
@@ -523,47 +600,48 @@ function useComputerSession(options) {
|
|
|
523
600
|
}, [client, computerSessionId, enabled, pageLive, refresh, refreshBlocked, workspaceId]);
|
|
524
601
|
const runMutation = useCallback2(
|
|
525
602
|
async (scopeComputerSessionId, operation) => {
|
|
603
|
+
if (!isCurrentSource()) throw new Error(t("hooks.useComputerSession.theDesktopSourceIsNo"));
|
|
526
604
|
invalidateRefresh();
|
|
527
|
-
if (mutationRef.current.computerSessionId !== scopeComputerSessionId) {
|
|
605
|
+
if (mutationRef.current.computerSessionId !== scopeComputerSessionId || mutationRef.current.source !== source) {
|
|
528
606
|
mutationRef.current = {
|
|
529
607
|
computerSessionId: scopeComputerSessionId,
|
|
608
|
+
source,
|
|
530
609
|
count: 0
|
|
531
610
|
};
|
|
532
611
|
}
|
|
533
612
|
mutationRef.current.count += 1;
|
|
534
613
|
setState(
|
|
535
|
-
(current) => current.computerSessionId === scopeComputerSessionId ? { ...current, mutating: true, error: null } : current
|
|
614
|
+
(current) => isCurrentSource() && current.source === source && current.computerSessionId === scopeComputerSessionId ? { ...current, mutating: true, error: null } : current
|
|
536
615
|
);
|
|
537
616
|
try {
|
|
538
617
|
return await operation();
|
|
539
|
-
} catch (cause) {
|
|
540
|
-
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
541
|
-
setState(
|
|
542
|
-
(current) => current.computerSessionId === scopeComputerSessionId ? { ...current, error } : current
|
|
543
|
-
);
|
|
544
|
-
throw error;
|
|
545
618
|
} finally {
|
|
546
|
-
if (mutationRef.current.computerSessionId === scopeComputerSessionId) {
|
|
619
|
+
if (mutationRef.current.computerSessionId === scopeComputerSessionId && mutationRef.current.source === source) {
|
|
547
620
|
mutationRef.current.count = Math.max(0, mutationRef.current.count - 1);
|
|
548
621
|
const mutating = mutationRef.current.count > 0;
|
|
549
622
|
setState(
|
|
550
|
-
(current) => current.computerSessionId === scopeComputerSessionId ? { ...current, mutating } : current
|
|
623
|
+
(current) => isCurrentSource() && current.source === source && current.computerSessionId === scopeComputerSessionId ? { ...current, mutating } : current
|
|
551
624
|
);
|
|
552
625
|
}
|
|
553
626
|
}
|
|
554
627
|
},
|
|
555
|
-
[invalidateRefresh]
|
|
628
|
+
[invalidateRefresh, isCurrentSource, source, t]
|
|
556
629
|
);
|
|
557
630
|
const selectTarget = useCallback2(
|
|
558
631
|
async (targetId) => {
|
|
559
|
-
if (!computerSessionId) throw new Error("
|
|
560
|
-
|
|
561
|
-
|
|
632
|
+
if (!computerSessionId) throw new Error(t("hooks.useComputerSession.noDesktopIsSelected"));
|
|
633
|
+
if (!isCurrentSource()) throw new Error(t("hooks.useComputerSession.theDesktopSourceIsNo"));
|
|
634
|
+
const target = targetsRef.current.source === source ? targetsRef.current.targets.find((candidate) => candidate.id === targetId) : null;
|
|
635
|
+
if (!target) throw new Error(t("hooks.useComputerSession.theSelectedDesktopTargetIs"));
|
|
562
636
|
invalidateRefresh();
|
|
637
|
+
const readRequestId = requestRef.current.id;
|
|
638
|
+
const selectionRevision = ++selectionRevisionRef.current;
|
|
639
|
+
const isCurrentSelection = () => isCurrentSource() && selectionRevisionRef.current === selectionRevision;
|
|
640
|
+
const isCurrentSelectionRead = () => isCurrentSelection() && requestRef.current.id === readRequestId;
|
|
563
641
|
selectedTargetIdRef.current = target.id;
|
|
564
|
-
observationRef.current = { computerSessionId, observation: null };
|
|
642
|
+
observationRef.current = { source, computerSessionId, observation: null };
|
|
565
643
|
setState(
|
|
566
|
-
(current) => current.computerSessionId === computerSessionId ? {
|
|
644
|
+
(current) => isCurrentSelection() && current.source === source && current.computerSessionId === computerSessionId ? {
|
|
567
645
|
...current,
|
|
568
646
|
selectedTargetId: target.id,
|
|
569
647
|
observation: null,
|
|
@@ -577,35 +655,49 @@ function useComputerSession(options) {
|
|
|
577
655
|
computerSessionId,
|
|
578
656
|
target.id
|
|
579
657
|
);
|
|
580
|
-
if (selectedTargetIdRef.current !== target.id) return target;
|
|
581
|
-
observationRef.current = { computerSessionId, observation };
|
|
658
|
+
if (!isCurrentSelectionRead() || selectedTargetIdRef.current !== target.id) return target;
|
|
659
|
+
observationRef.current = { source, computerSessionId, observation };
|
|
582
660
|
setState(
|
|
583
|
-
(current) => current.computerSessionId === computerSessionId && current.selectedTargetId === target.id ? { ...current, observation, loading: false, error: null } : current
|
|
661
|
+
(current) => isCurrentSelection() && current.source === source && current.computerSessionId === computerSessionId && current.selectedTargetId === target.id ? { ...current, observation, loading: false, error: null } : current
|
|
584
662
|
);
|
|
585
663
|
return observation.target;
|
|
586
664
|
} catch (cause) {
|
|
587
665
|
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
588
|
-
|
|
589
|
-
(
|
|
590
|
-
|
|
666
|
+
if (isCurrentSelectionRead()) {
|
|
667
|
+
setState(
|
|
668
|
+
(current) => isCurrentSelection() && current.source === source && current.computerSessionId === computerSessionId && current.selectedTargetId === target.id ? {
|
|
669
|
+
...current,
|
|
670
|
+
loading: false,
|
|
671
|
+
error,
|
|
672
|
+
controlError: isInteractionControlUnavailable(error, "observation") ? error : current.controlError
|
|
673
|
+
} : current
|
|
674
|
+
);
|
|
675
|
+
}
|
|
591
676
|
throw error;
|
|
592
677
|
}
|
|
593
678
|
},
|
|
594
|
-
[client, computerSessionId, invalidateRefresh, workspaceId]
|
|
679
|
+
[client, computerSessionId, invalidateRefresh, isCurrentSource, source, workspaceId, t]
|
|
595
680
|
);
|
|
596
681
|
const dispatchAction = useCallback2(
|
|
597
682
|
async (action, operationId, frame) => {
|
|
598
|
-
if (!computerSessionId) throw new Error("
|
|
683
|
+
if (!computerSessionId) throw new Error(t("hooks.useComputerSession.noDesktopIsSelected"));
|
|
684
|
+
if (!isCurrentSource()) throw new Error(t("hooks.useComputerSession.theDesktopSourceIsNo"));
|
|
599
685
|
if (frame && frame.computerSessionId !== computerSessionId) {
|
|
600
686
|
throw new Error("The displayed desktop frame belongs to another desktop session.");
|
|
601
687
|
}
|
|
602
|
-
const currentObservation = observationRef.current.computerSessionId === computerSessionId ? observationRef.current.observation : null;
|
|
603
|
-
const focusTarget = action.type === "focus" ? targetsRef.current.targets.find((candidate) => candidate.id === action.targetId) ?? null : null;
|
|
604
|
-
const frameTarget = frame
|
|
605
|
-
const
|
|
688
|
+
const currentObservation = observationRef.current.source === source && observationRef.current.computerSessionId === computerSessionId ? observationRef.current.observation : null;
|
|
689
|
+
const focusTarget = action.type === "focus" && targetsRef.current.source === source ? targetsRef.current.targets.find((candidate) => candidate.id === action.targetId) ?? null : null;
|
|
690
|
+
const frameTarget = frame && targetsRef.current.source === source ? currentObservation?.target.id === frame.targetId ? currentObservation.target : targetsRef.current.targets.find((candidate) => candidate.id === frame.targetId) ?? null : null;
|
|
691
|
+
const inputTarget = (action.type === "keyboard" || action.type === "clipboard") && targetsRef.current.source === source && targetsRef.current.computerSessionId === computerSessionId ? targetsRef.current.targets.find(
|
|
692
|
+
(candidate) => candidate.id === selectedTargetIdRef.current
|
|
693
|
+
) : null;
|
|
694
|
+
const target = frameTarget ?? focusTarget ?? currentObservation?.target ?? inputTarget ?? null;
|
|
606
695
|
if (!target) throw new Error("The desktop target is not ready for input.");
|
|
607
696
|
if (frame && frame.targetId !== selectedTargetIdRef.current) {
|
|
608
|
-
throw new Error("
|
|
697
|
+
throw new Error(t("hooks.useComputerSession.theDisplayedDesktopFrameIs"));
|
|
698
|
+
}
|
|
699
|
+
if (frame && (frame.controllerGeneration !== target.controllerGeneration || frame.targetGeneration !== target.targetGeneration)) {
|
|
700
|
+
throw new Error("The displayed desktop frame belongs to an earlier target generation.");
|
|
609
701
|
}
|
|
610
702
|
if (action.type === "pointer") {
|
|
611
703
|
const expectedFrameId = frame?.frameId ?? currentObservation?.frameId ?? null;
|
|
@@ -616,34 +708,115 @@ function useComputerSession(options) {
|
|
|
616
708
|
if (action.type === "semantic" && !currentObservation) {
|
|
617
709
|
throw new Error("The desktop accessibility tree is not ready for input.");
|
|
618
710
|
}
|
|
711
|
+
const selectedTargetId = selectedTargetIdRef.current;
|
|
712
|
+
const selectedTarget = targetsRef.current.targets.find(
|
|
713
|
+
(candidate) => candidate.id === selectedTargetId
|
|
714
|
+
);
|
|
715
|
+
const selectedFence = selectedTarget && {
|
|
716
|
+
id: selectedTarget.id,
|
|
717
|
+
computerSessionId: selectedTarget.computerSessionId,
|
|
718
|
+
controllerGeneration: selectedTarget.controllerGeneration,
|
|
719
|
+
targetGeneration: selectedTarget.targetGeneration
|
|
720
|
+
};
|
|
721
|
+
const selectionRevision = selectionRevisionRef.current;
|
|
722
|
+
const isCurrentView = () => isCurrentSource() && selectionRevisionRef.current === selectionRevision && selectedTargetIdRef.current === selectedTargetId && targetsRef.current.source === source && targetsRef.current.computerSessionId === computerSessionId && sameTargetFence(
|
|
723
|
+
selectedFence,
|
|
724
|
+
targetsRef.current.targets.find((candidate) => candidate.id === selectedTargetId)
|
|
725
|
+
);
|
|
726
|
+
const resultOrder = ++actionResultOrderRef.current.next;
|
|
727
|
+
let admitted = false;
|
|
728
|
+
let resultTargetId = selectedTargetId;
|
|
729
|
+
let resultFence = selectedFence;
|
|
730
|
+
const isCurrentResultView = () => isCurrentSource() && selectionRevisionRef.current === selectionRevision && selectedTargetIdRef.current === resultTargetId && targetsRef.current.source === source && sameTargetFence(
|
|
731
|
+
resultFence,
|
|
732
|
+
targetsRef.current.targets.find((candidate) => candidate.id === resultTargetId)
|
|
733
|
+
);
|
|
734
|
+
const canProjectResult = () => {
|
|
735
|
+
if (!admitted) {
|
|
736
|
+
if (!isCurrentView() || resultOrder < actionResultOrderRef.current.settled) return false;
|
|
737
|
+
actionResultOrderRef.current.settled = resultOrder;
|
|
738
|
+
admitted = true;
|
|
739
|
+
invalidateRefresh();
|
|
740
|
+
}
|
|
741
|
+
return isCurrentResultView() && resultOrder === actionResultOrderRef.current.settled;
|
|
742
|
+
};
|
|
743
|
+
const projectState = (update) => {
|
|
744
|
+
setState(
|
|
745
|
+
(current) => admitted && isCurrentResultView() && current.source === source && current.computerSessionId === computerSessionId && current.actionResultOrder <= resultOrder ? { ...update(current), actionResultOrder: resultOrder } : current
|
|
746
|
+
);
|
|
747
|
+
};
|
|
619
748
|
return await runMutation(computerSessionId, async () => {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
const
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
749
|
+
try {
|
|
750
|
+
const receipt = await client.actInComputer(workspaceId, computerSessionId, {
|
|
751
|
+
operationId,
|
|
752
|
+
targetId: target.id,
|
|
753
|
+
expectedTargetGeneration: frame?.targetGeneration ?? target.targetGeneration,
|
|
754
|
+
expectedObservationId: action.type === "pointer" ? null : currentObservation?.observationId ?? null,
|
|
755
|
+
expectedFrameId: action.type === "pointer" ? action.frameId : null,
|
|
756
|
+
action
|
|
757
|
+
});
|
|
758
|
+
const receiptSettled = receipt.state === "completed" || receipt.state === "failed" || receipt.state === "outcome_unknown";
|
|
759
|
+
actionResultFences.set(
|
|
760
|
+
receipt,
|
|
761
|
+
() => admitted ? isCurrentResultView() && resultOrder === actionResultOrderRef.current.settled : isCurrentView() && resultOrder >= actionResultOrderRef.current.settled
|
|
762
|
+
);
|
|
763
|
+
if (!receiptSettled || !canProjectResult()) return receipt;
|
|
764
|
+
if (receipt.observation) {
|
|
765
|
+
const observation = receipt.observation;
|
|
766
|
+
observationRef.current = { source, computerSessionId, observation };
|
|
767
|
+
selectedTargetIdRef.current = observation.target.id;
|
|
768
|
+
targetsRef.current.targets = replaceTarget(
|
|
769
|
+
targetsRef.current.targets,
|
|
770
|
+
observation.target
|
|
771
|
+
);
|
|
772
|
+
resultTargetId = observation.target.id;
|
|
773
|
+
resultFence = {
|
|
774
|
+
id: observation.target.id,
|
|
775
|
+
computerSessionId: observation.target.computerSessionId,
|
|
776
|
+
controllerGeneration: observation.target.controllerGeneration,
|
|
777
|
+
targetGeneration: observation.target.targetGeneration
|
|
778
|
+
};
|
|
779
|
+
projectState((current) => ({
|
|
634
780
|
...current,
|
|
781
|
+
error: null,
|
|
782
|
+
controlError: null,
|
|
635
783
|
observation,
|
|
636
784
|
selectedTargetId: observation.target.id,
|
|
637
785
|
targets: replaceTarget(current.targets, observation.target)
|
|
638
|
-
}
|
|
786
|
+
}));
|
|
787
|
+
} else {
|
|
788
|
+
projectState((current) => ({ ...current, error: null, controlError: null }));
|
|
789
|
+
void refresh();
|
|
790
|
+
}
|
|
791
|
+
return receipt;
|
|
792
|
+
} catch (cause) {
|
|
793
|
+
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
794
|
+
actionResultFences.set(
|
|
795
|
+
error,
|
|
796
|
+
() => admitted && isCurrentResultView() && resultOrder === actionResultOrderRef.current.settled
|
|
639
797
|
);
|
|
640
|
-
|
|
641
|
-
|
|
798
|
+
if (canProjectResult()) {
|
|
799
|
+
projectState((current) => ({
|
|
800
|
+
...current,
|
|
801
|
+
error,
|
|
802
|
+
controlError: isInteractionControlUnavailable(error) ? error : current.controlError
|
|
803
|
+
}));
|
|
804
|
+
}
|
|
805
|
+
throw error;
|
|
642
806
|
}
|
|
643
|
-
return receipt;
|
|
644
807
|
});
|
|
645
808
|
},
|
|
646
|
-
[
|
|
809
|
+
[
|
|
810
|
+
client,
|
|
811
|
+
computerSessionId,
|
|
812
|
+
invalidateRefresh,
|
|
813
|
+
isCurrentSource,
|
|
814
|
+
refresh,
|
|
815
|
+
runMutation,
|
|
816
|
+
source,
|
|
817
|
+
workspaceId,
|
|
818
|
+
t
|
|
819
|
+
]
|
|
647
820
|
);
|
|
648
821
|
const act = useCallback2(
|
|
649
822
|
async (action, operationId = crypto.randomUUID()) => await dispatchAction(action, operationId, null),
|
|
@@ -654,9 +827,40 @@ function useComputerSession(options) {
|
|
|
654
827
|
[dispatchAction]
|
|
655
828
|
);
|
|
656
829
|
const readClipboard = useCallback2(async () => {
|
|
657
|
-
if (!computerSessionId) throw new Error("
|
|
658
|
-
|
|
659
|
-
|
|
830
|
+
if (!computerSessionId) throw new Error(t("hooks.useComputerSession.noDesktopIsSelected"));
|
|
831
|
+
const selectionRevision = selectionRevisionRef.current;
|
|
832
|
+
const settledOrder = actionResultOrderRef.current.settled;
|
|
833
|
+
const selectedTargetId = selectedTargetIdRef.current;
|
|
834
|
+
const selectedTarget = targetsRef.current.targets.find(
|
|
835
|
+
(candidate) => candidate.id === selectedTargetId
|
|
836
|
+
);
|
|
837
|
+
const selectedFence = selectedTarget && {
|
|
838
|
+
id: selectedTarget.id,
|
|
839
|
+
computerSessionId: selectedTarget.computerSessionId,
|
|
840
|
+
controllerGeneration: selectedTarget.controllerGeneration,
|
|
841
|
+
targetGeneration: selectedTarget.targetGeneration
|
|
842
|
+
};
|
|
843
|
+
const isCurrentRead = () => isCurrentSource() && selectionRevisionRef.current === selectionRevision && actionResultOrderRef.current.settled === settledOrder && selectedTargetIdRef.current === selectedTargetId && targetsRef.current.source === source && sameTargetFence(
|
|
844
|
+
selectedFence,
|
|
845
|
+
targetsRef.current.targets.find((candidate) => candidate.id === selectedTargetId)
|
|
846
|
+
);
|
|
847
|
+
try {
|
|
848
|
+
const clipboard = await client.readComputerClipboard(workspaceId, computerSessionId);
|
|
849
|
+
actionResultFences.set(clipboard, isCurrentRead);
|
|
850
|
+
return clipboard;
|
|
851
|
+
} catch (cause) {
|
|
852
|
+
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
853
|
+
actionResultFences.set(error, isCurrentRead);
|
|
854
|
+
setState(
|
|
855
|
+
(current) => isCurrentRead() && current.source === source && current.computerSessionId === computerSessionId ? {
|
|
856
|
+
...current,
|
|
857
|
+
error,
|
|
858
|
+
controlError: isInteractionControlUnavailable(error) ? error : current.controlError
|
|
859
|
+
} : current
|
|
860
|
+
);
|
|
861
|
+
throw error;
|
|
862
|
+
}
|
|
863
|
+
}, [client, computerSessionId, isCurrentSource, source, workspaceId, t]);
|
|
660
864
|
return {
|
|
661
865
|
session: visible.session,
|
|
662
866
|
targets: visible.targets,
|
|
@@ -665,6 +869,7 @@ function useComputerSession(options) {
|
|
|
665
869
|
loading: visible.loading,
|
|
666
870
|
mutating: visible.mutating,
|
|
667
871
|
error: visible.error,
|
|
872
|
+
controlError: visible.controlError,
|
|
668
873
|
refresh,
|
|
669
874
|
readClipboard,
|
|
670
875
|
selectTarget,
|
|
@@ -672,25 +877,24 @@ function useComputerSession(options) {
|
|
|
672
877
|
actFromFrame
|
|
673
878
|
};
|
|
674
879
|
}
|
|
675
|
-
function emptyState(
|
|
880
|
+
function emptyState(source, loading) {
|
|
676
881
|
return {
|
|
677
|
-
|
|
882
|
+
source,
|
|
883
|
+
computerSessionId: source.computerSessionId,
|
|
678
884
|
session: null,
|
|
679
885
|
targets: [],
|
|
680
886
|
selectedTargetId: null,
|
|
681
887
|
observation: null,
|
|
682
888
|
loading,
|
|
683
889
|
mutating: false,
|
|
684
|
-
error: null
|
|
890
|
+
error: null,
|
|
891
|
+
controlError: null,
|
|
892
|
+
actionResultOrder: 0
|
|
685
893
|
};
|
|
686
894
|
}
|
|
687
|
-
function chooseTarget(targets, preferredId
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
if (platform === "linux") {
|
|
691
|
-
return targets.find((target) => target.focused && target.kind === "screen") ?? targets.find((target) => target.kind === "screen") ?? targets.find((target) => target.focused && target.kind === "window") ?? targets.find((target) => target.kind === "window") ?? targets[0] ?? null;
|
|
692
|
-
}
|
|
693
|
-
return targets.find((target) => target.focused && target.kind === "window") ?? targets.find((target) => target.kind === "window") ?? targets.find((target) => target.kind === "screen") ?? targets.find((target) => target.focused && target.kind === "app") ?? targets.find((target) => target.kind === "app") ?? targets[0] ?? null;
|
|
895
|
+
function chooseTarget(targets, preferredId) {
|
|
896
|
+
if (preferredId !== null) return targets.find((target) => target.id === preferredId) ?? null;
|
|
897
|
+
return targets.find((target) => target.focused && target.kind === "screen") ?? targets.find((target) => target.kind === "screen") ?? targets.find((target) => target.focused && target.kind === "window") ?? targets.find((target) => target.kind === "window") ?? targets.find((target) => target.focused && target.kind === "app") ?? targets.find((target) => target.kind === "app") ?? targets[0] ?? null;
|
|
694
898
|
}
|
|
695
899
|
function sortComputerTargets(targets) {
|
|
696
900
|
const rank = { window: 0, app: 1, screen: 2 };
|
|
@@ -704,9 +908,77 @@ function replaceTarget(targets, target) {
|
|
|
704
908
|
target
|
|
705
909
|
]);
|
|
706
910
|
}
|
|
911
|
+
function sameTargetFence(left, right) {
|
|
912
|
+
return left?.id === right?.id && left?.computerSessionId === right?.computerSessionId && left?.controllerGeneration === right?.controllerGeneration && left?.targetGeneration === right?.targetGeneration;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
// src/hooks/use-computer-input-posture.ts
|
|
916
|
+
import { useCallback as useCallback3, useEffect as useEffect3, useRef as useRef3, useState as useState3 } from "react";
|
|
917
|
+
function useComputerInputPosture(options) {
|
|
918
|
+
const t = useOpenGeniText();
|
|
919
|
+
const { client, workspaceId } = useEmbeddedComputerInteraction(options);
|
|
920
|
+
const { computerSessionId, controllerGeneration, enabled } = options;
|
|
921
|
+
const [nonce, setNonce] = useState3(0);
|
|
922
|
+
const [state, setState] = useState3(null);
|
|
923
|
+
const key = JSON.stringify([workspaceId, computerSessionId, controllerGeneration, enabled]);
|
|
924
|
+
const sourceRef = useRef3({ client, key });
|
|
925
|
+
if (sourceRef.current.client !== client || sourceRef.current.key !== key) {
|
|
926
|
+
sourceRef.current = { client, key };
|
|
927
|
+
}
|
|
928
|
+
const source = sourceRef.current;
|
|
929
|
+
const visible = state?.source === source && state.nonce === nonce ? state : null;
|
|
930
|
+
const refresh = useCallback3(() => setNonce((value) => value + 1), []);
|
|
931
|
+
useEffect3(() => {
|
|
932
|
+
if (!enabled || !computerSessionId || !controllerGeneration) return;
|
|
933
|
+
const controller = new AbortController();
|
|
934
|
+
let disposed = false;
|
|
935
|
+
setState({ source, nonce, inputAllowed: null, pending: true, error: null });
|
|
936
|
+
void (async () => {
|
|
937
|
+
try {
|
|
938
|
+
if (!client.getComputerInputPosture) {
|
|
939
|
+
throw new Error(t("hooks.useComputerInputPosture.desktopInputAvailabilityCouldNot"));
|
|
940
|
+
}
|
|
941
|
+
const posture = await client.getComputerInputPosture(workspaceId, computerSessionId, {
|
|
942
|
+
signal: controller.signal,
|
|
943
|
+
timeoutMs: 15e3
|
|
944
|
+
});
|
|
945
|
+
if (disposed || sourceRef.current !== source) return;
|
|
946
|
+
if (posture.computerSessionId !== computerSessionId || posture.controllerGeneration !== controllerGeneration || typeof posture.inputAllowed !== "boolean") {
|
|
947
|
+
throw new Error("Desktop input availability belongs to a different controller.");
|
|
948
|
+
}
|
|
949
|
+
setState({
|
|
950
|
+
source,
|
|
951
|
+
nonce,
|
|
952
|
+
inputAllowed: posture.inputAllowed,
|
|
953
|
+
pending: false,
|
|
954
|
+
error: null
|
|
955
|
+
});
|
|
956
|
+
} catch (cause) {
|
|
957
|
+
if (disposed || controller.signal.aborted || sourceRef.current !== source) return;
|
|
958
|
+
setState({
|
|
959
|
+
source,
|
|
960
|
+
nonce,
|
|
961
|
+
inputAllowed: null,
|
|
962
|
+
pending: false,
|
|
963
|
+
error: cause instanceof Error ? cause : new Error(String(cause))
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
})();
|
|
967
|
+
return () => {
|
|
968
|
+
disposed = true;
|
|
969
|
+
controller.abort();
|
|
970
|
+
};
|
|
971
|
+
}, [client, computerSessionId, controllerGeneration, enabled, nonce, source, workspaceId, t]);
|
|
972
|
+
return {
|
|
973
|
+
inputAllowed: visible?.inputAllowed ?? null,
|
|
974
|
+
pending: enabled && (visible?.pending ?? true),
|
|
975
|
+
error: visible?.error ?? null,
|
|
976
|
+
refresh
|
|
977
|
+
};
|
|
978
|
+
}
|
|
707
979
|
|
|
708
980
|
// src/hooks/use-computer-sessions.ts
|
|
709
|
-
import { useCallback as
|
|
981
|
+
import { useCallback as useCallback4, useEffect as useEffect4, useMemo, useRef as useRef4, useState as useState4 } from "react";
|
|
710
982
|
function useComputerSessions(options = {}) {
|
|
711
983
|
const {
|
|
712
984
|
client,
|
|
@@ -716,19 +988,19 @@ function useComputerSessions(options = {}) {
|
|
|
716
988
|
workspaceInteractionConnectionState
|
|
717
989
|
} = useEmbeddedComputerInteraction(options);
|
|
718
990
|
const enabled = options.enabled ?? true;
|
|
719
|
-
const [state, setState] =
|
|
720
|
-
const requestRef =
|
|
991
|
+
const [state, setState] = useState4(() => emptyState2(workspaceId, enabled));
|
|
992
|
+
const requestRef = useRef4({
|
|
721
993
|
id: 0,
|
|
722
994
|
controller: null
|
|
723
995
|
});
|
|
724
|
-
const mountedRef =
|
|
996
|
+
const mountedRef = useRef4(true);
|
|
725
997
|
const visible = state.workspaceId === workspaceId ? state : emptyState2(workspaceId, enabled);
|
|
726
|
-
const cancelLoad =
|
|
998
|
+
const cancelLoad = useCallback4(() => {
|
|
727
999
|
const id = requestRef.current.id + 1;
|
|
728
1000
|
requestRef.current.controller?.abort();
|
|
729
1001
|
requestRef.current = { id, controller: null };
|
|
730
1002
|
}, []);
|
|
731
|
-
const load =
|
|
1003
|
+
const load = useCallback4(
|
|
732
1004
|
async (foreground) => {
|
|
733
1005
|
if (!enabled) return;
|
|
734
1006
|
const id = requestRef.current.id + 1;
|
|
@@ -771,8 +1043,8 @@ function useComputerSessions(options = {}) {
|
|
|
771
1043
|
},
|
|
772
1044
|
[client, enabled, workspaceId]
|
|
773
1045
|
);
|
|
774
|
-
const refresh =
|
|
775
|
-
|
|
1046
|
+
const refresh = useCallback4(async () => await load(false), [load]);
|
|
1047
|
+
useEffect4(() => {
|
|
776
1048
|
mountedRef.current = true;
|
|
777
1049
|
if (!enabled) {
|
|
778
1050
|
cancelLoad();
|
|
@@ -795,7 +1067,7 @@ function useComputerSessions(options = {}) {
|
|
|
795
1067
|
refresh,
|
|
796
1068
|
fallbackPollIntervalMs: options.pollIntervalMs
|
|
797
1069
|
});
|
|
798
|
-
|
|
1070
|
+
useEffect4(() => {
|
|
799
1071
|
if (!enabled || !options.sessionId) return;
|
|
800
1072
|
return registerSessionReconciler(
|
|
801
1073
|
options.sessionId,
|
|
@@ -803,7 +1075,7 @@ function useComputerSessions(options = {}) {
|
|
|
803
1075
|
refresh
|
|
804
1076
|
);
|
|
805
1077
|
}, [enabled, options.sessionId, refresh, registerSessionReconciler, workspaceId]);
|
|
806
|
-
const create =
|
|
1078
|
+
const create = useCallback4(
|
|
807
1079
|
async (request) => {
|
|
808
1080
|
const response = await client.createComputerSession(workspaceId, {
|
|
809
1081
|
...request,
|
|
@@ -814,7 +1086,7 @@ function useComputerSessions(options = {}) {
|
|
|
814
1086
|
},
|
|
815
1087
|
[client, workspaceId]
|
|
816
1088
|
);
|
|
817
|
-
const end =
|
|
1089
|
+
const end = useCallback4(
|
|
818
1090
|
async (computerSessionId, operationId = crypto.randomUUID()) => {
|
|
819
1091
|
const response = await client.endComputerSession(workspaceId, computerSessionId, {
|
|
820
1092
|
operationId
|
|
@@ -891,6 +1163,7 @@ function ComputerViewer({
|
|
|
891
1163
|
onComputerSessionIdChange,
|
|
892
1164
|
...override
|
|
893
1165
|
}) {
|
|
1166
|
+
const t = useOpenGeniText();
|
|
894
1167
|
const registry = useComputerSessions({ ...override, sessionId, enabled });
|
|
895
1168
|
const createSession = registry.create;
|
|
896
1169
|
const refreshRegistry = registry.refresh;
|
|
@@ -918,10 +1191,10 @@ function ComputerViewer({
|
|
|
918
1191
|
() => liveRelevant.length > 0 ? liveRelevant : recentRelevantFailure ? [recentRelevantFailure] : [],
|
|
919
1192
|
[liveRelevant, recentRelevantFailure]
|
|
920
1193
|
);
|
|
921
|
-
const [selection, setSelection] =
|
|
1194
|
+
const [selection, setSelection] = useState5(
|
|
922
1195
|
() => initialComputerSessionId ? { sessionId: initialComputerSessionId, pinned: true } : null
|
|
923
1196
|
);
|
|
924
|
-
const selectComputerSession =
|
|
1197
|
+
const selectComputerSession = useCallback5(
|
|
925
1198
|
(next) => {
|
|
926
1199
|
setSelection(next);
|
|
927
1200
|
onComputerSessionIdChange?.(next?.sessionId ?? null);
|
|
@@ -933,20 +1206,20 @@ function ComputerViewer({
|
|
|
933
1206
|
enabled,
|
|
934
1207
|
resourceKind: "computer_session"
|
|
935
1208
|
});
|
|
936
|
-
const [creating, setCreating] =
|
|
937
|
-
const [createError, setCreateError] =
|
|
938
|
-
const [showControls, setShowControls] =
|
|
939
|
-
const previousSessionIdRef =
|
|
940
|
-
const handledRequestRef =
|
|
941
|
-
const seenInterventionIdsRef =
|
|
942
|
-
const createInFlightRef =
|
|
943
|
-
const autoCreateSessionRef =
|
|
944
|
-
const emptyCatalogConfirmationRef =
|
|
945
|
-
const endedGenerationLossRef =
|
|
946
|
-
const recreatedPlacementLossRef =
|
|
947
|
-
const [suppressGenericCreate, setSuppressGenericCreate] =
|
|
1209
|
+
const [creating, setCreating] = useState5(false);
|
|
1210
|
+
const [createError, setCreateError] = useState5(null);
|
|
1211
|
+
const [showControls, setShowControls] = useState5(false);
|
|
1212
|
+
const previousSessionIdRef = useRef5(sessionId);
|
|
1213
|
+
const handledRequestRef = useRef5(null);
|
|
1214
|
+
const seenInterventionIdsRef = useRef5(/* @__PURE__ */ new Set());
|
|
1215
|
+
const createInFlightRef = useRef5(false);
|
|
1216
|
+
const autoCreateSessionRef = useRef5(null);
|
|
1217
|
+
const emptyCatalogConfirmationRef = useRef5(null);
|
|
1218
|
+
const endedGenerationLossRef = useRef5(/* @__PURE__ */ new Set());
|
|
1219
|
+
const recreatedPlacementLossRef = useRef5(/* @__PURE__ */ new Set());
|
|
1220
|
+
const [suppressGenericCreate, setSuppressGenericCreate] = useState5(false);
|
|
948
1221
|
const endStaleComputer = registry.end;
|
|
949
|
-
|
|
1222
|
+
useEffect5(() => {
|
|
950
1223
|
if (!enabled) return;
|
|
951
1224
|
for (const session of registry.sessions) {
|
|
952
1225
|
if (!isAttachedChromeGenerationLoss(session)) continue;
|
|
@@ -958,8 +1231,9 @@ function ComputerViewer({
|
|
|
958
1231
|
});
|
|
959
1232
|
}
|
|
960
1233
|
}, [enabled, endStaleComputer, registry.sessions]);
|
|
961
|
-
const notifyError =
|
|
1234
|
+
const notifyError = useCallback5(
|
|
962
1235
|
(cause, fallback) => {
|
|
1236
|
+
if (isStaleComputerActionResult(cause)) return;
|
|
963
1237
|
onNotify?.({
|
|
964
1238
|
kind: "error",
|
|
965
1239
|
message: cause instanceof Error ? cause.message : fallback
|
|
@@ -967,7 +1241,7 @@ function ComputerViewer({
|
|
|
967
1241
|
},
|
|
968
1242
|
[onNotify]
|
|
969
1243
|
);
|
|
970
|
-
|
|
1244
|
+
useEffect5(() => {
|
|
971
1245
|
if (previousSessionIdRef.current === sessionId) return;
|
|
972
1246
|
previousSessionIdRef.current = sessionId;
|
|
973
1247
|
handledRequestRef.current = null;
|
|
@@ -980,7 +1254,7 @@ function ComputerViewer({
|
|
|
980
1254
|
initialComputerSessionId ? { sessionId: initialComputerSessionId, pinned: true } : null
|
|
981
1255
|
);
|
|
982
1256
|
}, [initialComputerSessionId, sessionId]);
|
|
983
|
-
|
|
1257
|
+
useEffect5(() => {
|
|
984
1258
|
if (!enabled || registry.loading) return;
|
|
985
1259
|
const requested = requestedComputerSessionId ? liveSessions.find((session) => session.id === requestedComputerSessionId) ?? null : null;
|
|
986
1260
|
const requestKey = requested ? `${requestedComputerRequestId ?? "default"}:${requested.id}` : null;
|
|
@@ -1031,7 +1305,10 @@ function ComputerViewer({
|
|
|
1031
1305
|
computerSessionId: selection?.sessionId ?? null,
|
|
1032
1306
|
enabled: enabled && selection !== null && controllerReady
|
|
1033
1307
|
});
|
|
1034
|
-
|
|
1308
|
+
useEffect5(() => {
|
|
1309
|
+
setShowControls(computer.selectedTarget?.kind === "app");
|
|
1310
|
+
}, [sessionId, selection?.sessionId, computer.selectedTarget?.id, computer.selectedTarget?.kind]);
|
|
1311
|
+
useEffect5(() => {
|
|
1035
1312
|
if (!isSourcePlacementChangedError(computer.error, "computer_session")) return;
|
|
1036
1313
|
void refreshRegistry();
|
|
1037
1314
|
}, [computer.error, refreshRegistry]);
|
|
@@ -1052,15 +1329,46 @@ function ComputerViewer({
|
|
|
1052
1329
|
},
|
|
1053
1330
|
...webSocketFactory ? { webSocketFactory } : {}
|
|
1054
1331
|
});
|
|
1055
|
-
const displayedFrame = frames.frame && frames.frame.computerSessionId === selection?.sessionId && frames.frame.targetId === computer.selectedTarget?.id ? frames.frame : null;
|
|
1332
|
+
const displayedFrame = frames.frame && frames.frame.computerSessionId === selection?.sessionId && frames.frame.targetId === computer.selectedTarget?.id && frames.frame.targetGeneration === computer.selectedTarget?.targetGeneration ? frames.frame : null;
|
|
1056
1333
|
const rfbStream = frames.attachment?.stream.kind === "direct_rfb" ? frames.attachment.stream : null;
|
|
1334
|
+
const appTarget = computer.selectedTarget?.kind === "app";
|
|
1335
|
+
const appInputPosture = useComputerInputPosture({
|
|
1336
|
+
...override,
|
|
1337
|
+
computerSessionId: selection?.sessionId ?? null,
|
|
1338
|
+
controllerGeneration: computer.session?.controller?.controllerGeneration ?? null,
|
|
1339
|
+
enabled: enabled && controllerReady && appTarget
|
|
1340
|
+
});
|
|
1341
|
+
const inputPostureRef = useRef5({
|
|
1342
|
+
sessionId: selection?.sessionId ?? null,
|
|
1343
|
+
controllerGeneration: computer.session?.controller?.controllerGeneration ?? null,
|
|
1344
|
+
denied: false
|
|
1345
|
+
});
|
|
1346
|
+
const postureSessionId = selection?.sessionId ?? null;
|
|
1347
|
+
const postureController = computer.session?.controller?.controllerGeneration ?? null;
|
|
1348
|
+
if (inputPostureRef.current.sessionId !== postureSessionId || inputPostureRef.current.controllerGeneration !== postureController) {
|
|
1349
|
+
inputPostureRef.current = {
|
|
1350
|
+
sessionId: postureSessionId,
|
|
1351
|
+
controllerGeneration: postureController,
|
|
1352
|
+
denied: false
|
|
1353
|
+
};
|
|
1354
|
+
}
|
|
1355
|
+
if (frames.attachment?.computerSessionId === postureSessionId && frames.attachment.controllerGeneration === postureController) {
|
|
1356
|
+
inputPostureRef.current.denied = frames.attachment.inputAllowed === false;
|
|
1357
|
+
}
|
|
1358
|
+
const inputDenied = appTarget ? appInputPosture.inputAllowed !== true : inputPostureRef.current.denied;
|
|
1359
|
+
const attachmentInputAllowed = frames.attachment !== null && !inputDenied;
|
|
1360
|
+
const inputPosturePending = appTarget ? appInputPosture.pending : inputDenied && (frames.state === "attaching" || frames.state === "reconnecting");
|
|
1361
|
+
const machineLocked = selectedRegistrySession?.failureCode === "machine_locked";
|
|
1362
|
+
const controlUnavailable = computer.controlError !== null;
|
|
1363
|
+
const connectionState = controlUnavailable ? "error" : frames.state;
|
|
1364
|
+
const rfbInputEnabled = rfbStream?.inputAllowed === true && attachmentInputAllowed && !machineLocked && !controlUnavailable && computer.session?.capabilities?.pointerInput === true && computer.session?.capabilities?.keyboardInput === true;
|
|
1057
1365
|
const rfbCapability = useMemo2(() => {
|
|
1058
1366
|
if (!rfbStream || !frames.attachment) return null;
|
|
1059
1367
|
const bounds = computer.selectedTarget?.bounds;
|
|
1060
1368
|
return {
|
|
1061
1369
|
transport: "vnc-ws",
|
|
1062
1370
|
client: "novnc",
|
|
1063
|
-
mode: "interactive",
|
|
1371
|
+
mode: rfbInputEnabled ? "interactive" : "read-only",
|
|
1064
1372
|
url: rfbStream.url,
|
|
1065
1373
|
token: null,
|
|
1066
1374
|
expiresAt: frames.attachment.expiresAt,
|
|
@@ -1072,20 +1380,19 @@ function ComputerViewer({
|
|
|
1072
1380
|
sharedSessionIds: [],
|
|
1073
1381
|
reason: null
|
|
1074
1382
|
};
|
|
1075
|
-
}, [computer.selectedTarget?.bounds, frames.attachment, rfbStream]);
|
|
1076
|
-
const machineLocked = selectedRegistrySession?.failureCode === "machine_locked";
|
|
1383
|
+
}, [computer.selectedTarget?.bounds, frames.attachment, rfbInputEnabled, rfbStream]);
|
|
1077
1384
|
const currentIds = useMemo2(() => new Set(relevant.map((session) => session.id)), [relevant]);
|
|
1078
|
-
|
|
1385
|
+
useEffect5(() => {
|
|
1079
1386
|
for (const intervention of interventions.interventions) {
|
|
1080
1387
|
if (seenInterventionIdsRef.current.has(intervention.id)) continue;
|
|
1081
1388
|
seenInterventionIdsRef.current.add(intervention.id);
|
|
1082
1389
|
onNotify?.({
|
|
1083
1390
|
kind: "info",
|
|
1084
|
-
message: `${interventionTitle(intervention)}: ${intervention.reason}`
|
|
1391
|
+
message: `${interventionTitle(t, intervention)}: ${intervention.reason}`
|
|
1085
1392
|
});
|
|
1086
1393
|
}
|
|
1087
|
-
}, [interventions.interventions, onNotify]);
|
|
1088
|
-
const resolveIntervention =
|
|
1394
|
+
}, [interventions.interventions, onNotify, t]);
|
|
1395
|
+
const resolveIntervention = useCallback5(
|
|
1089
1396
|
(intervention, outcome) => {
|
|
1090
1397
|
void interventions.resolve(intervention.id, {
|
|
1091
1398
|
expectedVersion: intervention.version,
|
|
@@ -1093,13 +1400,13 @@ function ComputerViewer({
|
|
|
1093
1400
|
}).then(() => {
|
|
1094
1401
|
onNotify?.({
|
|
1095
1402
|
kind: "info",
|
|
1096
|
-
message: outcome === "completed" ? "
|
|
1403
|
+
message: outcome === "completed" ? t("computerViewer.agentNotifiedContinuingWork") : t("computerViewer.requestCancelled")
|
|
1097
1404
|
});
|
|
1098
|
-
}).catch((cause) => notifyError(cause, "
|
|
1405
|
+
}).catch((cause) => notifyError(cause, t("computerViewer.couldNotUpdateTheDesktop")));
|
|
1099
1406
|
},
|
|
1100
|
-
[interventions, notifyError, onNotify]
|
|
1407
|
+
[interventions, notifyError, onNotify, t]
|
|
1101
1408
|
);
|
|
1102
|
-
const createComputer =
|
|
1409
|
+
const createComputer = useCallback5(() => {
|
|
1103
1410
|
if (createInFlightRef.current) return;
|
|
1104
1411
|
createInFlightRef.current = true;
|
|
1105
1412
|
setCreateError(null);
|
|
@@ -1107,15 +1414,15 @@ function ComputerViewer({
|
|
|
1107
1414
|
void createSession({ sessionId, name: "Desktop" }).then((response) => {
|
|
1108
1415
|
selectComputerSession({ sessionId: response.session.id, pinned: false });
|
|
1109
1416
|
}).catch((cause) => {
|
|
1110
|
-
const error = cause instanceof Error ? cause : new Error("
|
|
1417
|
+
const error = cause instanceof Error ? cause : new Error(t("computerViewer.couldNotOpenADesktop"));
|
|
1111
1418
|
setCreateError(error);
|
|
1112
|
-
notifyError(error, "
|
|
1419
|
+
notifyError(error, t("computerViewer.couldNotOpenADesktop"));
|
|
1113
1420
|
}).finally(() => {
|
|
1114
1421
|
createInFlightRef.current = false;
|
|
1115
1422
|
setCreating(false);
|
|
1116
1423
|
});
|
|
1117
|
-
}, [createSession, notifyError, selectComputerSession, sessionId]);
|
|
1118
|
-
|
|
1424
|
+
}, [createSession, notifyError, selectComputerSession, sessionId, t]);
|
|
1425
|
+
useEffect5(() => {
|
|
1119
1426
|
if (!enabled || registry.loading || registry.refreshing || liveRelevant.length > 0 || !connectedPlacementLoss || recreatedPlacementLossRef.current.has(connectedPlacementLoss.id)) {
|
|
1120
1427
|
return;
|
|
1121
1428
|
}
|
|
@@ -1132,13 +1439,13 @@ function ComputerViewer({
|
|
|
1132
1439
|
registry.refreshing,
|
|
1133
1440
|
sessionId
|
|
1134
1441
|
]);
|
|
1135
|
-
|
|
1442
|
+
useEffect5(() => {
|
|
1136
1443
|
if (relevant.length > 0) {
|
|
1137
1444
|
autoCreateSessionRef.current = sessionId;
|
|
1138
1445
|
emptyCatalogConfirmationRef.current = null;
|
|
1139
1446
|
}
|
|
1140
1447
|
}, [relevant.length, sessionId]);
|
|
1141
|
-
|
|
1448
|
+
useEffect5(() => {
|
|
1142
1449
|
if (!enabled || registry.loading || registry.refreshing || registry.error || relevant.length > 0 || suppressGenericCreate || autoCreateSessionRef.current === sessionId) {
|
|
1143
1450
|
return;
|
|
1144
1451
|
}
|
|
@@ -1160,41 +1467,62 @@ function ComputerViewer({
|
|
|
1160
1467
|
sessionId,
|
|
1161
1468
|
suppressGenericCreate
|
|
1162
1469
|
]);
|
|
1163
|
-
const perform =
|
|
1164
|
-
async (action, frame) => {
|
|
1470
|
+
const perform = useCallback5(
|
|
1471
|
+
async (action, frame, operationId) => {
|
|
1472
|
+
if (computer.controlError) throw computer.controlError;
|
|
1473
|
+
if (inputDenied) throw new Error(t("computerViewer.desktopIsViewOnlyRefresh"));
|
|
1474
|
+
let receipt;
|
|
1165
1475
|
if (action.type === "pointer") {
|
|
1166
|
-
if (!frame) throw new Error("
|
|
1167
|
-
await actFromFrame(action, frame);
|
|
1476
|
+
if (!frame) throw new Error(t("computerViewer.desktopViewIsNotReady"));
|
|
1477
|
+
receipt = await actFromFrame(action, frame, operationId);
|
|
1168
1478
|
} else {
|
|
1169
|
-
await act(action);
|
|
1479
|
+
receipt = await act(action, operationId);
|
|
1480
|
+
}
|
|
1481
|
+
if (!isStaleComputerActionResult(receipt) && receipt.state !== "completed") {
|
|
1482
|
+
throw computerActionReceiptError(t, receipt);
|
|
1170
1483
|
}
|
|
1484
|
+
return receipt;
|
|
1171
1485
|
},
|
|
1172
|
-
[act, actFromFrame]
|
|
1486
|
+
[act, actFromFrame, computer.controlError, inputDenied, t]
|
|
1173
1487
|
);
|
|
1174
|
-
const
|
|
1488
|
+
const reconnect = () => {
|
|
1489
|
+
void refreshComputer();
|
|
1490
|
+
if (appTarget) appInputPosture.refresh();
|
|
1491
|
+
else frames.reconnect();
|
|
1492
|
+
};
|
|
1493
|
+
const copyFromRfb = useCallback5(
|
|
1175
1494
|
(event) => {
|
|
1176
|
-
if (!rfbStream || computer.session?.capabilities?.clipboard !== true)
|
|
1495
|
+
if (!rfbInputEnabled || !rfbStream || computer.session?.capabilities?.clipboard !== true)
|
|
1496
|
+
return;
|
|
1177
1497
|
event.preventDefault();
|
|
1178
1498
|
event.stopPropagation();
|
|
1179
|
-
void
|
|
1499
|
+
void (async () => {
|
|
1500
|
+
const receipt = await perform({ type: "clipboard", operation: "copy" }, null);
|
|
1501
|
+
if (isStaleComputerActionResult(receipt)) return;
|
|
1502
|
+
const clipboard = await computer.readClipboard();
|
|
1503
|
+
if (isStaleComputerActionResult(receipt) || isStaleComputerActionResult(clipboard)) return;
|
|
1180
1504
|
if (clipboard.text && !await copyTextToClipboard(clipboard.text)) {
|
|
1181
|
-
throw new Error("
|
|
1505
|
+
throw new Error(t("computerViewer.desktopTextCouldNotBe"));
|
|
1182
1506
|
}
|
|
1183
|
-
}).catch((cause) => notifyError(cause, "
|
|
1507
|
+
})().catch((cause) => notifyError(cause, t("computerViewer.couldNotCopyFromThe")));
|
|
1184
1508
|
},
|
|
1185
|
-
[computer, notifyError, perform, rfbStream]
|
|
1509
|
+
[computer, notifyError, perform, rfbInputEnabled, rfbStream, t]
|
|
1186
1510
|
);
|
|
1187
|
-
const pasteIntoRfb =
|
|
1511
|
+
const pasteIntoRfb = useCallback5(
|
|
1188
1512
|
(text) => {
|
|
1189
|
-
if (!rfbStream || computer.session?.capabilities?.clipboard !== true)
|
|
1513
|
+
if (!rfbInputEnabled || !rfbStream || computer.session?.capabilities?.clipboard !== true)
|
|
1514
|
+
return false;
|
|
1190
1515
|
void (async () => {
|
|
1191
|
-
await perform({ type: "clipboard", operation: "write", text }, null);
|
|
1192
|
-
|
|
1516
|
+
const receipt = await perform({ type: "clipboard", operation: "write", text }, null);
|
|
1517
|
+
if (isStaleComputerActionResult(receipt)) return;
|
|
1518
|
+
const clipboard = await computer.readClipboard();
|
|
1519
|
+
if (isStaleComputerActionResult(receipt) || isStaleComputerActionResult(clipboard)) return;
|
|
1520
|
+
assertExactComputerClipboard(t, clipboard, text);
|
|
1193
1521
|
await perform({ type: "clipboard", operation: "paste" }, null);
|
|
1194
|
-
})().catch((cause) => notifyError(cause, "
|
|
1522
|
+
})().catch((cause) => notifyError(cause, t("computerViewer.couldNotPasteIntoThe")));
|
|
1195
1523
|
return true;
|
|
1196
1524
|
},
|
|
1197
|
-
[computer, notifyError, perform, rfbStream]
|
|
1525
|
+
[computer, notifyError, perform, rfbInputEnabled, rfbStream, t]
|
|
1198
1526
|
);
|
|
1199
1527
|
const hideGenericCreate = suppressGenericCreate && liveRelevant.length === 0;
|
|
1200
1528
|
const generationLossSelected = selectedRegistrySession !== null && isAttachedChromeGenerationLoss(selectedRegistrySession);
|
|
@@ -1205,7 +1533,7 @@ function ComputerViewer({
|
|
|
1205
1533
|
ComputerNotice,
|
|
1206
1534
|
{
|
|
1207
1535
|
icon: /* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-4 animate-spin" }),
|
|
1208
|
-
text: "
|
|
1536
|
+
text: t("computerViewer.findingWorkspaceDesktops"),
|
|
1209
1537
|
...className ? { className } : {}
|
|
1210
1538
|
}
|
|
1211
1539
|
);
|
|
@@ -1213,148 +1541,194 @@ function ComputerViewer({
|
|
|
1213
1541
|
if (liveSessions.length === 0) {
|
|
1214
1542
|
if (hideGenericCreate) {
|
|
1215
1543
|
return /* @__PURE__ */ jsx("div", { className: cn("grid h-full place-items-center bg-og-bg p-6", className), children: /* @__PURE__ */ jsxs("div", { className: "max-w-sm text-center", children: [
|
|
1216
|
-
/* @__PURE__ */ jsx(CircleAlertIcon, { className: "mx-auto size-5 text-og-
|
|
1217
|
-
/* @__PURE__ */ jsx("p", { className: "mt-3 text-og-menu font-medium text-og-fg", children: "
|
|
1218
|
-
/* @__PURE__ */ jsx("p", { className: "mt-1 text-og-control leading-5 text-og-muted", children: "
|
|
1544
|
+
/* @__PURE__ */ jsx(CircleAlertIcon, { className: "mx-auto size-5 text-og-danger" }),
|
|
1545
|
+
/* @__PURE__ */ jsx("p", { className: "mt-3 text-og-menu font-medium text-og-fg", children: t("computerViewer.chromeReconnectedOpenAFresh") }),
|
|
1546
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-og-control leading-5 text-og-fg-muted", children: t("computerViewer.thisChromeProfileIsLive") })
|
|
1219
1547
|
] }) });
|
|
1220
1548
|
}
|
|
1221
1549
|
if (renderEmpty) return renderEmpty(createComputer, creating);
|
|
1222
1550
|
const error = createError ?? registry.error;
|
|
1223
1551
|
return /* @__PURE__ */ jsx("div", { className: cn("grid h-full place-items-center bg-og-bg p-6", className), children: /* @__PURE__ */ jsxs("div", { className: "max-w-sm text-center", children: [
|
|
1224
|
-
/* @__PURE__ */ jsx("span", { className: "mx-auto grid size-10 place-items-center rounded-og-lg border border-og-border bg-og-surface-1 text-og-muted", children: error ? /* @__PURE__ */ jsx(CircleAlertIcon, { className: "size-5 text-og-
|
|
1225
|
-
/* @__PURE__ */ jsx("p", { className: "mt-3 text-og-menu font-medium text-og-fg", children: error ? "
|
|
1226
|
-
/* @__PURE__ */ jsx("p", { className: "mt-1 text-og-control leading-5 text-og-muted", children: error?.message ?? "
|
|
1552
|
+
/* @__PURE__ */ jsx("span", { className: "mx-auto grid size-10 place-items-center rounded-og-lg border border-og-border bg-og-surface-1 text-og-fg-muted", children: error ? /* @__PURE__ */ jsx(CircleAlertIcon, { className: "size-5 text-og-danger" }) : /* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-5 animate-spin" }) }),
|
|
1553
|
+
/* @__PURE__ */ jsx("p", { className: "mt-3 text-og-menu font-medium text-og-fg", children: error ? t("computerViewer.desktopDidnTOpen") : t("computerViewer.openingDesktop") }),
|
|
1554
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-og-control leading-5 text-og-fg-muted", children: error?.message ?? t("computerViewer.preparingThisAgentSDesktop") }),
|
|
1227
1555
|
error ? /* @__PURE__ */ jsxs(
|
|
1228
1556
|
"button",
|
|
1229
1557
|
{
|
|
1230
1558
|
type: "button",
|
|
1231
1559
|
onClick: createError ? createComputer : () => void refreshRegistry(),
|
|
1232
1560
|
disabled: creating || registry.refreshing,
|
|
1233
|
-
className: "mt-4 inline-flex h-8 items-center gap-1.5 rounded-og-sm bg-og-
|
|
1561
|
+
className: "mt-4 inline-flex h-8 items-center gap-1.5 rounded-og-sm border border-og-primary-border bg-og-primary text-og-primary-fg px-3 text-og-control font-medium transition hover:bg-og-primary-hover disabled:opacity-50",
|
|
1234
1562
|
children: [
|
|
1235
1563
|
creating || registry.refreshing ? /* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ jsx(RotateCcwIcon, { className: "size-3.5" }),
|
|
1236
|
-
"
|
|
1564
|
+
t("computerViewer.tryAgain")
|
|
1237
1565
|
]
|
|
1238
1566
|
}
|
|
1239
1567
|
) : null
|
|
1240
1568
|
] }) });
|
|
1241
1569
|
}
|
|
1242
|
-
return /* @__PURE__ */ jsxs(
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
selectedSessionId: selection?.sessionId ?? null,
|
|
1249
|
-
creating,
|
|
1250
|
-
refreshing: registry.refreshing,
|
|
1251
|
-
interventionCounts,
|
|
1252
|
-
onSelect: (computerSessionId) => selectComputerSession({ sessionId: computerSessionId, pinned: true }),
|
|
1253
|
-
onFollow: () => {
|
|
1254
|
-
if (relevant[0]) selectComputerSession({ sessionId: relevant[0].id, pinned: false });
|
|
1255
|
-
},
|
|
1256
|
-
onCreate: hideGenericCreate ? void 0 : createComputer,
|
|
1257
|
-
onRefresh: () => void Promise.all([refreshRegistry(), refreshComputer()])
|
|
1258
|
-
}
|
|
1259
|
-
),
|
|
1260
|
-
/* @__PURE__ */ jsx(
|
|
1261
|
-
InteractionInterventionBanner,
|
|
1262
|
-
{
|
|
1263
|
-
interventions: selectedInterventions,
|
|
1264
|
-
activeTargetId: computer.selectedTarget?.id ?? null,
|
|
1265
|
-
mutating: interventions.mutating,
|
|
1266
|
-
onOpen: (intervention) => void computer.selectTarget(intervention.targetId).catch((cause) => notifyError(cause, "Could not open the requested desktop view.")),
|
|
1267
|
-
onResolve: resolveIntervention
|
|
1268
|
-
}
|
|
1269
|
-
),
|
|
1270
|
-
!selectedRegistrySession ? /* @__PURE__ */ jsx(
|
|
1271
|
-
ComputerUnselectedPanel,
|
|
1272
|
-
{
|
|
1273
|
-
peerCount: liveSessions.length,
|
|
1274
|
-
creating,
|
|
1275
|
-
error: createError,
|
|
1276
|
-
generationLoss: suppressGenericCreate,
|
|
1277
|
-
onCreate: createComputer
|
|
1278
|
-
}
|
|
1279
|
-
) : !controllerReady ? /* @__PURE__ */ jsx(
|
|
1280
|
-
ComputerLifecyclePanel,
|
|
1281
|
-
{
|
|
1282
|
-
session: selectedRegistrySession,
|
|
1283
|
-
creating,
|
|
1284
|
-
onRefresh: registry.refresh,
|
|
1285
|
-
onRetry: createComputer
|
|
1286
|
-
}
|
|
1287
|
-
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1288
|
-
/* @__PURE__ */ jsx(
|
|
1289
|
-
ComputerTargetRail,
|
|
1290
|
-
{
|
|
1291
|
-
targets: computer.targets,
|
|
1292
|
-
selectedTargetId: computer.selectedTarget?.id ?? null,
|
|
1293
|
-
loading: computer.loading,
|
|
1294
|
-
onSelect: (targetId) => void computer.selectTarget(targetId).catch((cause) => notifyError(cause, "Could not switch desktop views."))
|
|
1295
|
-
}
|
|
1570
|
+
return /* @__PURE__ */ jsxs(
|
|
1571
|
+
"div",
|
|
1572
|
+
{
|
|
1573
|
+
className: cn(
|
|
1574
|
+
"@container/computer-viewer relative flex h-full min-h-0 min-w-0 flex-col overflow-hidden bg-og-bg",
|
|
1575
|
+
className
|
|
1296
1576
|
),
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1577
|
+
children: [
|
|
1578
|
+
/* @__PURE__ */ jsx(
|
|
1579
|
+
ComputerToolbar,
|
|
1300
1580
|
{
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1581
|
+
sessions: liveSessions,
|
|
1582
|
+
relevantSessionIds: currentIds,
|
|
1583
|
+
selectedSessionId: selection?.sessionId ?? null,
|
|
1584
|
+
creating,
|
|
1585
|
+
refreshing: registry.refreshing || inputPosturePending,
|
|
1586
|
+
interventionCounts,
|
|
1587
|
+
targets: controllerReady ? computer.targets : [],
|
|
1588
|
+
selectedTargetId: computer.selectedTarget?.id ?? null,
|
|
1589
|
+
targetsLoading: controllerReady && computer.loading,
|
|
1590
|
+
onSelectTarget: (targetId) => {
|
|
1591
|
+
void computer.selectTarget(targetId).catch((cause) => notifyError(cause, t("computerViewer.couldNotSwitchDesktopViews")));
|
|
1592
|
+
},
|
|
1593
|
+
onSelect: (computerSessionId) => selectComputerSession({ sessionId: computerSessionId, pinned: true }),
|
|
1594
|
+
onFollow: () => {
|
|
1595
|
+
if (relevant[0]) selectComputerSession({ sessionId: relevant[0].id, pinned: false });
|
|
1596
|
+
},
|
|
1597
|
+
onCreate: hideGenericCreate ? void 0 : createComputer,
|
|
1598
|
+
onRefresh: () => {
|
|
1599
|
+
if (appTarget) {
|
|
1600
|
+
appInputPosture.refresh();
|
|
1601
|
+
} else if ((connectionState === "error" || inputDenied) && !generationLossSelected && !generationLossFrames) {
|
|
1602
|
+
frames.reconnect();
|
|
1603
|
+
}
|
|
1604
|
+
void Promise.all([refreshRegistry(), refreshComputer()]);
|
|
1605
|
+
}
|
|
1308
1606
|
}
|
|
1309
|
-
)
|
|
1310
|
-
|
|
1607
|
+
),
|
|
1608
|
+
/* @__PURE__ */ jsx(
|
|
1609
|
+
InteractionInterventionBanner,
|
|
1311
1610
|
{
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
connectionError: frames.error ?? computer.error,
|
|
1318
|
-
mutating: computer.mutating,
|
|
1319
|
-
backgroundActions: computer.session?.capabilities?.backgroundActions === true,
|
|
1320
|
-
clipboardEnabled: computer.session?.capabilities?.clipboard === true,
|
|
1321
|
-
onAction: perform,
|
|
1322
|
-
onReadClipboard: computer.readClipboard,
|
|
1323
|
-
onReconnect: generationLossSelected || generationLossFrames ? () => void 0 : frames.reconnect,
|
|
1324
|
-
onError: (cause) => notifyError(cause, "Desktop input failed.")
|
|
1611
|
+
interventions: selectedInterventions,
|
|
1612
|
+
activeTargetId: computer.selectedTarget?.id ?? null,
|
|
1613
|
+
mutating: interventions.mutating,
|
|
1614
|
+
onOpen: (intervention) => void computer.selectTarget(intervention.targetId).catch((cause) => notifyError(cause, t("computerViewer.couldNotOpenTheRequested"))),
|
|
1615
|
+
onResolve: resolveIntervention
|
|
1325
1616
|
}
|
|
1326
1617
|
),
|
|
1327
|
-
|
|
1328
|
-
|
|
1618
|
+
!selectedRegistrySession ? /* @__PURE__ */ jsx(
|
|
1619
|
+
ComputerUnselectedPanel,
|
|
1329
1620
|
{
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1621
|
+
peerCount: liveSessions.length,
|
|
1622
|
+
creating,
|
|
1623
|
+
error: createError,
|
|
1624
|
+
generationLoss: suppressGenericCreate,
|
|
1625
|
+
onCreate: createComputer
|
|
1335
1626
|
}
|
|
1336
|
-
) :
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1627
|
+
) : !controllerReady ? /* @__PURE__ */ jsx(
|
|
1628
|
+
ComputerLifecyclePanel,
|
|
1629
|
+
{
|
|
1630
|
+
session: selectedRegistrySession,
|
|
1631
|
+
creating,
|
|
1632
|
+
onRefresh: registry.refresh,
|
|
1633
|
+
onRetry: createComputer
|
|
1634
|
+
}
|
|
1635
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1636
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col @xl/computer-viewer:flex-row", children: [
|
|
1637
|
+
rfbStream ? /* @__PURE__ */ jsxs("div", { className: "relative min-h-0 flex-1 bg-black", onCopyCapture: copyFromRfb, children: [
|
|
1638
|
+
/* @__PURE__ */ jsx(
|
|
1639
|
+
DesktopViewer,
|
|
1640
|
+
{
|
|
1641
|
+
capability: rfbCapability,
|
|
1642
|
+
interactive: rfbInputEnabled,
|
|
1643
|
+
showControlToggle: false,
|
|
1644
|
+
webSocketProtocols: rfbStream.protocols,
|
|
1645
|
+
onPasteText: pasteIntoRfb,
|
|
1646
|
+
targetPlatform: computer.session?.platform ?? null,
|
|
1647
|
+
className: "h-full"
|
|
1648
|
+
}
|
|
1649
|
+
),
|
|
1650
|
+
!rfbInputEnabled ? /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute bottom-3 left-1/2 -translate-x-1/2 rounded-full border border-white/10 bg-black/70 px-3 py-1 text-[11px] text-white/80 backdrop-blur", children: controlUnavailable ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1651
|
+
t("computerViewer.desktopControlsUnavailable"),
|
|
1652
|
+
" ",
|
|
1653
|
+
/* @__PURE__ */ jsx(
|
|
1654
|
+
"button",
|
|
1655
|
+
{
|
|
1656
|
+
type: "button",
|
|
1657
|
+
onClick: reconnect,
|
|
1658
|
+
className: "pointer-events-auto ml-2 font-medium underline",
|
|
1659
|
+
children: t("computerViewer.reconnect")
|
|
1660
|
+
}
|
|
1661
|
+
)
|
|
1662
|
+
] }) : t("computerViewer.viewOnlyDirectInputUnavailable") }) : null
|
|
1663
|
+
] }) : /* @__PURE__ */ jsx(
|
|
1664
|
+
ComputerViewport,
|
|
1665
|
+
{
|
|
1666
|
+
frame: machineLocked ? null : displayedFrame,
|
|
1667
|
+
observation: computer.observation,
|
|
1668
|
+
target: computer.selectedTarget,
|
|
1669
|
+
machineLocked,
|
|
1670
|
+
controlUnavailable,
|
|
1671
|
+
inputAllowed: !inputDenied,
|
|
1672
|
+
connectionState,
|
|
1673
|
+
connectionError: computer.controlError ?? appInputPosture.error ?? frames.error ?? computer.error,
|
|
1674
|
+
mutating: computer.mutating,
|
|
1675
|
+
backgroundActions: computer.session?.capabilities?.backgroundActions === true,
|
|
1676
|
+
backgroundInput: computer.session?.capabilities?.backgroundInput === true,
|
|
1677
|
+
allowForegroundInputWithinOwnedSeat: computer.session?.platform === "linux" && computer.session.adapter === "opengeni.cua.linux.v1" && computer.session.seatId === `linux-virtual:${computer.session.id}` && Boolean(computer.session.displayId),
|
|
1678
|
+
clipboardEnabled: attachmentInputAllowed && computer.session?.capabilities?.clipboard === true,
|
|
1679
|
+
pointerInput: attachmentInputAllowed && computer.session?.capabilities?.pointerInput === true,
|
|
1680
|
+
pointerClickContinuation: attachmentInputAllowed && computer.session?.capabilities?.pointerClickContinuation === true,
|
|
1681
|
+
keyboardInput: attachmentInputAllowed && computer.session?.capabilities?.keyboardInput === true,
|
|
1682
|
+
onAction: perform,
|
|
1683
|
+
onReadClipboard: computer.readClipboard,
|
|
1684
|
+
onReconnect: generationLossSelected || generationLossFrames ? () => void 0 : reconnect,
|
|
1685
|
+
onError: (cause) => notifyError(cause, t("computerViewer.desktopInputFailed"))
|
|
1686
|
+
},
|
|
1687
|
+
JSON.stringify([
|
|
1688
|
+
selection?.sessionId,
|
|
1689
|
+
computer.selectedTarget?.id,
|
|
1690
|
+
computer.selectedTarget?.targetGeneration,
|
|
1691
|
+
frames.attachment?.controllerGeneration
|
|
1692
|
+
])
|
|
1693
|
+
),
|
|
1694
|
+
showControls ? /* @__PURE__ */ jsx(
|
|
1695
|
+
ComputerSemanticPanel,
|
|
1696
|
+
{
|
|
1697
|
+
observation: computer.observation,
|
|
1698
|
+
mutating: computer.mutating || controlUnavailable || inputDenied,
|
|
1699
|
+
controlUnavailable,
|
|
1700
|
+
inputAllowed: !inputDenied,
|
|
1701
|
+
onAction: (action) => void perform(action, null).catch(
|
|
1702
|
+
(cause) => notifyError(cause, t("computerViewer.desktopActionFailed"))
|
|
1703
|
+
)
|
|
1704
|
+
}
|
|
1705
|
+
) : null
|
|
1706
|
+
] }),
|
|
1707
|
+
/* @__PURE__ */ jsx(
|
|
1708
|
+
ComputerStatusBar,
|
|
1709
|
+
{
|
|
1710
|
+
session: computer.session,
|
|
1711
|
+
target: computer.selectedTarget,
|
|
1712
|
+
connectionState,
|
|
1713
|
+
controlUnavailable,
|
|
1714
|
+
inputAllowed: !inputDenied,
|
|
1715
|
+
refreshing: registry.refreshing,
|
|
1716
|
+
showControls,
|
|
1717
|
+
controlCount: semanticControls(t, computer.observation).length,
|
|
1718
|
+
onToggleControls: () => setShowControls((current) => !current)
|
|
1719
|
+
}
|
|
1720
|
+
)
|
|
1721
|
+
] })
|
|
1722
|
+
]
|
|
1723
|
+
}
|
|
1724
|
+
);
|
|
1352
1725
|
}
|
|
1353
1726
|
function ComputerUnselectedPanel(props) {
|
|
1727
|
+
const t = useOpenGeniText();
|
|
1354
1728
|
return /* @__PURE__ */ jsx("div", { className: "grid min-h-0 flex-1 place-items-center bg-og-bg p-6 text-center", children: /* @__PURE__ */ jsxs("div", { className: "max-w-sm", children: [
|
|
1355
|
-
/* @__PURE__ */ jsx("span", { className: "mx-auto grid size-10 place-items-center rounded-og-md border border-og-border bg-og-surface-1 text-og-muted", children: props.error || props.generationLoss ? /* @__PURE__ */ jsx(CircleAlertIcon, { className: "size-4.5 text-og-
|
|
1356
|
-
/* @__PURE__ */ jsx("p", { className: "mt-3 text-og-menu font-medium text-og-fg", children: props.generationLoss ? "
|
|
1357
|
-
/* @__PURE__ */ jsx("p", { className: "mt-1 text-og-control leading-5 text-og-muted", children: props.generationLoss ? "
|
|
1729
|
+
/* @__PURE__ */ jsx("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: props.error || props.generationLoss ? /* @__PURE__ */ jsx(CircleAlertIcon, { className: "size-4.5 text-og-danger" }) : /* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-4.5 animate-spin" }) }),
|
|
1730
|
+
/* @__PURE__ */ jsx("p", { className: "mt-3 text-og-menu font-medium text-og-fg", children: props.generationLoss ? t("computerViewer.chromeReconnectedOpenAFresh") : props.error ? t("computerViewer.desktopDidnTOpen") : t("computerViewer.openingDesktop") }),
|
|
1731
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-og-control leading-5 text-og-fg-muted", children: props.generationLoss ? t("computerViewer.thisChromeProfileIsLive") : props.error?.message ?? (props.peerCount === 1 ? t("computerViewer.preparingThisAgentSDesktop2") : t("computerViewer.preparingThisAgentSDesktop3", { peerCount: props.peerCount })) }),
|
|
1358
1732
|
props.error && !props.generationLoss ? /* @__PURE__ */ jsxs(
|
|
1359
1733
|
"button",
|
|
1360
1734
|
{
|
|
@@ -1364,67 +1738,105 @@ function ComputerUnselectedPanel(props) {
|
|
|
1364
1738
|
className: "mt-4 inline-flex h-8 items-center gap-1.5 rounded-og-sm border border-og-border bg-og-surface-1 px-3 text-og-control font-medium text-og-fg transition hover:bg-og-surface-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
1365
1739
|
children: [
|
|
1366
1740
|
props.creating ? /* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ jsx(RotateCcwIcon, { className: "size-3.5" }),
|
|
1367
|
-
"
|
|
1741
|
+
t("computerViewer.tryAgain")
|
|
1368
1742
|
]
|
|
1369
1743
|
}
|
|
1370
1744
|
) : null
|
|
1371
1745
|
] }) });
|
|
1372
1746
|
}
|
|
1373
1747
|
function ComputerToolbar(props) {
|
|
1374
|
-
const
|
|
1748
|
+
const t = useOpenGeniText();
|
|
1749
|
+
const detailsRef = useViewerMenuDismiss();
|
|
1375
1750
|
const selected = props.sessions.find((session) => session.id === props.selectedSessionId);
|
|
1376
1751
|
const current = props.sessions.filter((session) => props.relevantSessionIds.has(session.id));
|
|
1377
1752
|
const others = props.sessions.filter((session) => !props.relevantSessionIds.has(session.id));
|
|
1378
|
-
const
|
|
1379
|
-
props.onSelect(id);
|
|
1753
|
+
const closeMenu = (restoreFocus) => {
|
|
1380
1754
|
detailsRef.current?.removeAttribute("open");
|
|
1755
|
+
if (restoreFocus) detailsRef.current?.querySelector("summary")?.focus();
|
|
1756
|
+
};
|
|
1757
|
+
const choose = (id, restoreFocus) => {
|
|
1758
|
+
props.onSelect(id);
|
|
1759
|
+
closeMenu(restoreFocus);
|
|
1381
1760
|
};
|
|
1382
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex h-10 shrink-0 items-center gap-1.5 border-b border-og-border bg-og-surface-
|
|
1383
|
-
/* @__PURE__ */ jsxs("details", { ref: detailsRef, className: "
|
|
1384
|
-
/* @__PURE__ */ jsxs("summary", { className: "flex h-7 max-w-
|
|
1385
|
-
/* @__PURE__ */ jsx(MonitorIcon, { className: "size-3.5 shrink-0 text-og-muted" }),
|
|
1386
|
-
/* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: selected?.name === "Computer" ? "
|
|
1761
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex h-10 shrink-0 items-center gap-1.5 border-b border-og-border bg-og-surface-1 px-2", children: [
|
|
1762
|
+
/* @__PURE__ */ jsxs("details", { ref: detailsRef, className: "min-w-0", children: [
|
|
1763
|
+
/* @__PURE__ */ jsxs("summary", { className: "flex h-7 max-w-32 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 @sm/computer-viewer:max-w-52 [&::-webkit-details-marker]:hidden", children: [
|
|
1764
|
+
/* @__PURE__ */ jsx(MonitorIcon, { className: "size-3.5 shrink-0 text-og-fg-muted" }),
|
|
1765
|
+
/* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: selected?.name === "Computer" ? t("computerViewer.desktop") : selected?.name ?? t("computerViewer.desktop") }),
|
|
1387
1766
|
(props.interventionCounts.get(selected?.id ?? "") ?? 0) > 0 ? /* @__PURE__ */ jsx("span", { className: "size-1.5 shrink-0 rounded-full bg-og-status-waiting" }) : null,
|
|
1388
|
-
/* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-3 shrink-0 text-og-subtle" })
|
|
1767
|
+
/* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-3 shrink-0 text-og-fg-subtle" })
|
|
1389
1768
|
] }),
|
|
1390
|
-
/* @__PURE__ */ jsxs("div", { className: "absolute left-
|
|
1391
|
-
/* @__PURE__ */
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1769
|
+
/* @__PURE__ */ jsxs("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: [
|
|
1770
|
+
/* @__PURE__ */ jsxs("div", { className: "min-h-0 max-h-96 overflow-y-auto overscroll-contain", children: [
|
|
1771
|
+
/* @__PURE__ */ jsx(
|
|
1772
|
+
ComputerSessionGroup,
|
|
1773
|
+
{
|
|
1774
|
+
label: t("computerViewer.currentAgent"),
|
|
1775
|
+
sessions: current,
|
|
1776
|
+
selectedId: props.selectedSessionId,
|
|
1777
|
+
interventionCounts: props.interventionCounts,
|
|
1778
|
+
onSelect: choose
|
|
1779
|
+
}
|
|
1780
|
+
),
|
|
1781
|
+
/* @__PURE__ */ jsx(
|
|
1782
|
+
ComputerSessionGroup,
|
|
1783
|
+
{
|
|
1784
|
+
label: t("computerViewer.otherAgents"),
|
|
1785
|
+
sessions: others,
|
|
1786
|
+
selectedId: props.selectedSessionId,
|
|
1787
|
+
interventionCounts: props.interventionCounts,
|
|
1788
|
+
onSelect: choose
|
|
1789
|
+
}
|
|
1790
|
+
)
|
|
1791
|
+
] }),
|
|
1792
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-1 flex shrink-0 gap-1 border-t border-og-border pt-1", children: [
|
|
1793
|
+
current.length > 0 ? /* @__PURE__ */ jsx(
|
|
1794
|
+
MenuButton,
|
|
1795
|
+
{
|
|
1796
|
+
onClick: (event) => {
|
|
1797
|
+
props.onFollow();
|
|
1798
|
+
closeMenu(event.detail === 0);
|
|
1799
|
+
},
|
|
1800
|
+
children: t("computerViewer.followAgent")
|
|
1801
|
+
}
|
|
1802
|
+
) : null,
|
|
1803
|
+
props.onCreate ? /* @__PURE__ */ jsxs(
|
|
1804
|
+
MenuButton,
|
|
1805
|
+
{
|
|
1806
|
+
onClick: (event) => {
|
|
1807
|
+
props.onCreate?.();
|
|
1808
|
+
closeMenu(event.detail === 0);
|
|
1809
|
+
},
|
|
1810
|
+
disabled: props.creating,
|
|
1811
|
+
children: [
|
|
1812
|
+
/* @__PURE__ */ jsx(PlusIcon, { className: "size-3.5" }),
|
|
1813
|
+
" ",
|
|
1814
|
+
t("computerViewer.newDesktop")
|
|
1815
|
+
]
|
|
1816
|
+
}
|
|
1817
|
+
) : null
|
|
1417
1818
|
] })
|
|
1418
1819
|
] })
|
|
1419
1820
|
] }),
|
|
1420
|
-
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-og-xs text-og-subtle", children: selected ? `${platformLabel(selected)} \xB7 ${placementLabel(selected)}` : "" }),
|
|
1821
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-og-xs text-og-fg-subtle", children: selected ? `${platformLabel(t, selected)} \xB7 ${placementLabel(t, selected)}` : "" }),
|
|
1822
|
+
/* @__PURE__ */ jsx(
|
|
1823
|
+
ComputerTargetPicker,
|
|
1824
|
+
{
|
|
1825
|
+
targets: props.targets,
|
|
1826
|
+
selectedTargetId: props.selectedTargetId,
|
|
1827
|
+
loading: props.targetsLoading,
|
|
1828
|
+
onSelect: props.onSelectTarget
|
|
1829
|
+
}
|
|
1830
|
+
),
|
|
1421
1831
|
/* @__PURE__ */ jsx(
|
|
1422
1832
|
"button",
|
|
1423
1833
|
{
|
|
1424
1834
|
type: "button",
|
|
1425
1835
|
onClick: props.onRefresh,
|
|
1426
|
-
|
|
1427
|
-
"aria-
|
|
1836
|
+
disabled: props.refreshing,
|
|
1837
|
+
"aria-busy": props.refreshing,
|
|
1838
|
+
className: "grid size-7 place-items-center rounded-og-sm text-og-fg-muted transition hover:bg-og-surface-2 hover:text-og-fg",
|
|
1839
|
+
"aria-label": t("computerViewer.refreshDesktops"),
|
|
1428
1840
|
children: /* @__PURE__ */ jsx(RefreshCwIcon, { className: cn("size-3.5", props.refreshing && "animate-spin") })
|
|
1429
1841
|
}
|
|
1430
1842
|
),
|
|
@@ -1434,24 +1846,26 @@ function ComputerToolbar(props) {
|
|
|
1434
1846
|
type: "button",
|
|
1435
1847
|
onClick: props.onCreate,
|
|
1436
1848
|
disabled: props.creating,
|
|
1437
|
-
className: "
|
|
1438
|
-
"aria-label": "
|
|
1849
|
+
className: "hidden size-7 place-items-center rounded-og-sm text-og-fg-muted transition hover:bg-og-surface-2 hover:text-og-fg disabled:opacity-40 @sm/computer-viewer:grid",
|
|
1850
|
+
"aria-label": t("computerViewer.openANewDesktop"),
|
|
1439
1851
|
children: props.creating ? /* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ jsx(PlusIcon, { className: "size-3.5" })
|
|
1440
1852
|
}
|
|
1441
1853
|
) : null
|
|
1442
1854
|
] });
|
|
1443
1855
|
}
|
|
1444
1856
|
function ComputerSessionGroup(props) {
|
|
1857
|
+
const t = useOpenGeniText();
|
|
1445
1858
|
if (props.sessions.length === 0) return null;
|
|
1446
1859
|
return /* @__PURE__ */ jsxs("div", { className: "py-1", children: [
|
|
1447
|
-
/* @__PURE__ */ jsx("p", { className: "px-2 pb-1 text-[10px] font-medium uppercase tracking-[0.12em] text-og-subtle", children: props.label }),
|
|
1860
|
+
/* @__PURE__ */ jsx("p", { className: "px-2 pb-1 text-[10px] font-medium uppercase tracking-[0.12em] text-og-fg-subtle", children: props.label }),
|
|
1448
1861
|
props.sessions.map((session) => {
|
|
1449
1862
|
const interventionCount = props.interventionCounts.get(session.id) ?? 0;
|
|
1450
1863
|
return /* @__PURE__ */ jsxs(
|
|
1451
1864
|
"button",
|
|
1452
1865
|
{
|
|
1453
1866
|
type: "button",
|
|
1454
|
-
onClick: () => props.onSelect(session.id),
|
|
1867
|
+
onClick: (event) => props.onSelect(session.id, event.detail === 0),
|
|
1868
|
+
"aria-pressed": session.id === props.selectedId,
|
|
1455
1869
|
className: cn(
|
|
1456
1870
|
"flex w-full items-center gap-2 rounded-og-sm px-2 py-1.5 text-left transition hover:bg-og-surface-2",
|
|
1457
1871
|
session.id === props.selectedId && "bg-og-surface-2"
|
|
@@ -1468,10 +1882,10 @@ function ComputerSessionGroup(props) {
|
|
|
1468
1882
|
),
|
|
1469
1883
|
/* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
1470
1884
|
/* @__PURE__ */ jsx("span", { className: "block truncate text-og-control text-og-fg", children: session.name }),
|
|
1471
|
-
/* @__PURE__ */ jsxs("span", { className: "block truncate text-og-xs text-og-subtle", children: [
|
|
1472
|
-
platformLabel(session),
|
|
1885
|
+
/* @__PURE__ */ jsxs("span", { className: "block truncate text-og-xs text-og-fg-subtle", children: [
|
|
1886
|
+
platformLabel(t, session),
|
|
1473
1887
|
" \xB7 ",
|
|
1474
|
-
placementLabel(session)
|
|
1888
|
+
placementLabel(t, session)
|
|
1475
1889
|
] })
|
|
1476
1890
|
] }),
|
|
1477
1891
|
interventionCount > 0 ? /* @__PURE__ */ jsx("span", { className: "rounded-full bg-og-status-waiting/10 px-1.5 py-0.5 text-[10px] font-medium text-og-status-waiting", children: interventionCount }) : null
|
|
@@ -1489,48 +1903,98 @@ function MenuButton(props) {
|
|
|
1489
1903
|
type: "button",
|
|
1490
1904
|
onClick: props.onClick,
|
|
1491
1905
|
disabled: props.disabled,
|
|
1492
|
-
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",
|
|
1906
|
+
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",
|
|
1493
1907
|
children: props.children
|
|
1494
1908
|
}
|
|
1495
1909
|
);
|
|
1496
1910
|
}
|
|
1497
|
-
function
|
|
1498
|
-
const
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1911
|
+
function ComputerTargetPicker(props) {
|
|
1912
|
+
const t = useOpenGeniText();
|
|
1913
|
+
const screens = props.targets.filter((target) => target.kind === "screen");
|
|
1914
|
+
const advancedTargets = props.targets.filter(
|
|
1915
|
+
(target) => target.kind === "app" || target.kind === "window" && isRenderableComputerView(target)
|
|
1916
|
+
);
|
|
1917
|
+
const advancedRef = useViewerMenuDismiss(advancedTargets.length > 0);
|
|
1918
|
+
const selected = props.targets.find((target) => target.id === props.selectedTargetId);
|
|
1919
|
+
const choose = (id, restoreFocus = false) => {
|
|
1920
|
+
props.onSelect(id);
|
|
1921
|
+
if (advancedRef.current?.open) {
|
|
1922
|
+
advancedRef.current.removeAttribute("open");
|
|
1923
|
+
if (restoreFocus) advancedRef.current.querySelector("summary")?.focus();
|
|
1924
|
+
}
|
|
1925
|
+
};
|
|
1926
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1927
|
+
screens.length > 1 ? /* @__PURE__ */ jsxs(
|
|
1928
|
+
"select",
|
|
1929
|
+
{
|
|
1930
|
+
"aria-label": t("computerViewer.screen"),
|
|
1931
|
+
value: selected?.kind === "screen" ? selected.id : "",
|
|
1932
|
+
onChange: (event) => choose(event.currentTarget.value),
|
|
1933
|
+
className: "h-7 min-w-0 max-w-28 rounded-og-sm border border-og-border bg-og-surface-1 px-1.5 text-og-control text-og-fg outline-hidden focus:border-og-accent @sm/computer-viewer:max-w-40",
|
|
1934
|
+
children: [
|
|
1935
|
+
/* @__PURE__ */ jsx("option", { value: "", disabled: true, hidden: true, children: t("computerViewer.screen") }),
|
|
1936
|
+
screens.map((screen, index) => /* @__PURE__ */ jsx("option", { value: screen.id, children: screen.title || t("computerViewer.screenIndex", { index: index + 1 }) }, screen.id))
|
|
1937
|
+
]
|
|
1938
|
+
}
|
|
1939
|
+
) : screens[0] && selected?.kind !== "screen" ? /* @__PURE__ */ jsxs(
|
|
1940
|
+
"button",
|
|
1941
|
+
{
|
|
1942
|
+
type: "button",
|
|
1943
|
+
onClick: () => choose(screens[0].id),
|
|
1944
|
+
className: "flex h-7 shrink-0 items-center gap-1.5 rounded-og-sm px-2 text-og-control text-og-fg-muted transition hover:bg-og-surface-2 hover:text-og-fg",
|
|
1945
|
+
children: [
|
|
1946
|
+
/* @__PURE__ */ jsx(MonitorIcon, { className: "size-3.5" }),
|
|
1947
|
+
" ",
|
|
1948
|
+
t("computerViewer.fullDesktop")
|
|
1949
|
+
]
|
|
1950
|
+
}
|
|
1951
|
+
) : null,
|
|
1952
|
+
advancedTargets.length > 0 ? /* @__PURE__ */ jsxs("details", { ref: advancedRef, className: "shrink-0", children: [
|
|
1953
|
+
/* @__PURE__ */ jsxs(
|
|
1954
|
+
"summary",
|
|
1955
|
+
{
|
|
1956
|
+
"aria-label": t("computerViewer.advancedDesktopViews"),
|
|
1957
|
+
title: t("computerViewer.advancedDesktopViews"),
|
|
1958
|
+
className: "flex h-7 cursor-pointer list-none items-center gap-1.5 rounded-og-sm px-2 text-og-control text-og-fg-muted transition hover:bg-og-surface-2 hover:text-og-fg [&::-webkit-details-marker]:hidden",
|
|
1959
|
+
children: [
|
|
1960
|
+
/* @__PURE__ */ jsx(PanelsTopLeftIcon, { className: "size-3.5" }),
|
|
1961
|
+
/* @__PURE__ */ jsx("span", { className: "hidden @sm/computer-viewer:inline", children: t("computerViewer.advanced") }),
|
|
1962
|
+
/* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-3" })
|
|
1963
|
+
]
|
|
1964
|
+
}
|
|
1965
|
+
),
|
|
1966
|
+
/* @__PURE__ */ jsxs("div", { className: "absolute right-2 top-10 z-30 flex max-h-[calc(100%-3rem)] w-64 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: [
|
|
1967
|
+
/* @__PURE__ */ jsx("p", { className: "shrink-0 px-2 py-1 text-og-xs text-og-fg-subtle", children: t("computerViewer.appsAndWindows") }),
|
|
1968
|
+
/* @__PURE__ */ jsx("div", { className: "min-h-0 max-h-80 overflow-y-auto overscroll-contain", children: advancedTargets.map((target) => /* @__PURE__ */ jsxs(
|
|
1506
1969
|
"button",
|
|
1507
1970
|
{
|
|
1508
1971
|
type: "button",
|
|
1509
|
-
onClick: () =>
|
|
1972
|
+
onClick: (event) => choose(target.id, event.detail === 0),
|
|
1973
|
+
"aria-pressed": target.id === props.selectedTargetId,
|
|
1510
1974
|
className: cn(
|
|
1511
|
-
"flex
|
|
1512
|
-
target.id === props.selectedTargetId
|
|
1975
|
+
"flex w-full min-w-0 items-center gap-2 rounded-og-sm px-2 py-1.5 text-left transition hover:bg-og-surface-2",
|
|
1976
|
+
target.id === props.selectedTargetId && "bg-og-surface-2"
|
|
1513
1977
|
),
|
|
1514
|
-
"aria-pressed": target.id === props.selectedTargetId,
|
|
1515
1978
|
children: [
|
|
1516
|
-
|
|
1517
|
-
|
|
1979
|
+
/* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
1980
|
+
/* @__PURE__ */ jsx("span", { className: "block truncate text-og-control text-og-fg", children: target.title || target.applicationId || target.kind }),
|
|
1981
|
+
/* @__PURE__ */ jsx("span", { className: "block text-og-xs text-og-fg-subtle", children: target.kind === "app" ? t("computerViewer.appControls") : t("computerViewer.windowView") })
|
|
1982
|
+
] }),
|
|
1518
1983
|
target.focused ? /* @__PURE__ */ jsx(
|
|
1519
1984
|
"span",
|
|
1520
1985
|
{
|
|
1521
1986
|
className: "size-1.5 shrink-0 rounded-full bg-og-status-running",
|
|
1522
|
-
"aria-label": "
|
|
1987
|
+
"aria-label": t("computerViewer.focused")
|
|
1523
1988
|
}
|
|
1524
1989
|
) : null
|
|
1525
1990
|
]
|
|
1526
1991
|
},
|
|
1527
1992
|
target.id
|
|
1528
|
-
))
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
);
|
|
1993
|
+
)) })
|
|
1994
|
+
] })
|
|
1995
|
+
] }) : null,
|
|
1996
|
+
props.loading ? /* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-3.5 shrink-0 animate-spin text-og-fg-muted" }) : null
|
|
1997
|
+
] });
|
|
1534
1998
|
}
|
|
1535
1999
|
function isRenderableComputerView(target) {
|
|
1536
2000
|
if (target.kind === "screen") return true;
|
|
@@ -1541,13 +2005,14 @@ function isComputerFrameTarget(target) {
|
|
|
1541
2005
|
return target.kind === "window" || target.kind === "screen";
|
|
1542
2006
|
}
|
|
1543
2007
|
function ComputerLifecyclePanel(props) {
|
|
2008
|
+
const t = useOpenGeniText();
|
|
1544
2009
|
const generationLoss = isAttachedChromeGenerationLoss(props.session);
|
|
1545
2010
|
const failed = ["failed", "lost", "repair_required"].includes(props.session.lifecycle);
|
|
1546
2011
|
const retryCreatesSession = ["failed", "lost"].includes(props.session.lifecycle);
|
|
1547
2012
|
return /* @__PURE__ */ jsx("div", { className: "grid min-h-0 flex-1 place-items-center bg-og-bg p-6", children: /* @__PURE__ */ jsxs("div", { className: "max-w-sm text-center", children: [
|
|
1548
|
-
failed ? /* @__PURE__ */ jsx(CircleAlertIcon, { className: "mx-auto size-5 text-og-
|
|
1549
|
-
/* @__PURE__ */ jsx("p", { className: "mt-3 text-og-menu font-medium text-og-fg", children: generationLoss ? "
|
|
1550
|
-
/* @__PURE__ */ jsx("p", { className: "mt-1 text-og-control leading-5 text-og-muted", children: generationLoss ? "
|
|
2013
|
+
failed ? /* @__PURE__ */ jsx(CircleAlertIcon, { className: "mx-auto size-5 text-og-danger" }) : /* @__PURE__ */ jsx(LoaderCircleIcon, { className: "mx-auto size-5 animate-spin text-og-fg-muted" }),
|
|
2014
|
+
/* @__PURE__ */ jsx("p", { className: "mt-3 text-og-menu font-medium text-og-fg", children: generationLoss ? t("computerViewer.chromeReconnectedOpenAFresh") : failed ? t("computerViewer.desktopNeedsAttention") : lifecycleLabel(t, props.session.lifecycle) }),
|
|
2015
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-og-control leading-5 text-og-fg-muted", children: generationLoss ? t("computerViewer.thisChromeProfileIsLive") : computerFailureMessage(t, props.session) ?? t("computerViewer.theDesktopIsBeingPrepared") }),
|
|
1551
2016
|
failed && !generationLoss ? /* @__PURE__ */ jsxs(
|
|
1552
2017
|
"button",
|
|
1553
2018
|
{
|
|
@@ -1557,32 +2022,73 @@ function ComputerLifecyclePanel(props) {
|
|
|
1557
2022
|
className: "mt-4 inline-flex h-8 items-center gap-1.5 rounded-og-sm border border-og-border bg-og-surface-1 px-3 text-og-control font-medium text-og-fg transition hover:bg-og-surface-2",
|
|
1558
2023
|
children: [
|
|
1559
2024
|
props.creating ? /* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ jsx(RotateCcwIcon, { className: "size-3.5" }),
|
|
1560
|
-
retryCreatesSession ? "
|
|
2025
|
+
retryCreatesSession ? t("computerViewer.tryAgain") : t("computerViewer.checkAgain")
|
|
1561
2026
|
]
|
|
1562
2027
|
}
|
|
1563
2028
|
) : null
|
|
1564
2029
|
] }) });
|
|
1565
2030
|
}
|
|
1566
2031
|
function ComputerViewport(props) {
|
|
1567
|
-
const
|
|
1568
|
-
const
|
|
1569
|
-
const
|
|
1570
|
-
const
|
|
1571
|
-
const
|
|
1572
|
-
const
|
|
1573
|
-
const
|
|
1574
|
-
const
|
|
1575
|
-
const
|
|
1576
|
-
const
|
|
1577
|
-
const
|
|
1578
|
-
const
|
|
1579
|
-
const
|
|
1580
|
-
const
|
|
2032
|
+
const t = useOpenGeniText();
|
|
2033
|
+
const canvasRef = useRef5(null);
|
|
2034
|
+
const inputRef = useRef5(null);
|
|
2035
|
+
const composingRef = useRef5(false);
|
|
2036
|
+
const pointerStartRef = useRef5(null);
|
|
2037
|
+
const clickTimerRef = useRef5(null);
|
|
2038
|
+
const lastClickRef = useRef5(null);
|
|
2039
|
+
const wheelRef = useRef5(null);
|
|
2040
|
+
const pendingTextRef = useRef5(null);
|
|
2041
|
+
const actionRef = useRef5(props.onAction);
|
|
2042
|
+
const targetRef = useRef5(props.target);
|
|
2043
|
+
const readClipboardRef = useRef5(props.onReadClipboard);
|
|
2044
|
+
const errorRef = useRef5(props.onError);
|
|
2045
|
+
const actionTailRef = useRef5(Promise.resolve());
|
|
2046
|
+
const actionQueueEpochRef = useRef5(0);
|
|
2047
|
+
const queuedTextRef = useRef5(null);
|
|
2048
|
+
const queuedFrameRef = useRef5(null);
|
|
2049
|
+
const currentFrameRef = useRef5(props.frame);
|
|
2050
|
+
const paintedFrameRef = useRef5(null);
|
|
2051
|
+
const [paintedFrame, setPaintedFrame] = useState5(null);
|
|
2052
|
+
const decodingFrameRef = useRef5(false);
|
|
2053
|
+
const mountedRef = useRef5(true);
|
|
1581
2054
|
actionRef.current = props.onAction;
|
|
2055
|
+
targetRef.current = props.target;
|
|
1582
2056
|
readClipboardRef.current = props.onReadClipboard;
|
|
1583
2057
|
errorRef.current = props.onError;
|
|
1584
|
-
const
|
|
1585
|
-
const
|
|
2058
|
+
const streamFailed = props.connectionState === "error";
|
|
2059
|
+
const rawInputEnabled = props.target?.kind !== "app" && !streamFailed && !props.controlUnavailable && !props.machineLocked && (props.backgroundInput || // CUA may activate within its allocated Linux desktop. This does not
|
|
2060
|
+
// grant foreground input to an attached physical desktop.
|
|
2061
|
+
props.allowForegroundInputWithinOwnedSeat || !props.backgroundActions || props.target?.kind === "screen" || props.target?.focused === true);
|
|
2062
|
+
const clearBufferedInput = useCallback5(() => {
|
|
2063
|
+
if (clickTimerRef.current) clearTimeout(clickTimerRef.current);
|
|
2064
|
+
if (wheelRef.current?.timer) clearTimeout(wheelRef.current.timer);
|
|
2065
|
+
if (pendingTextRef.current?.timer) clearTimeout(pendingTextRef.current.timer);
|
|
2066
|
+
clickTimerRef.current = null;
|
|
2067
|
+
wheelRef.current = null;
|
|
2068
|
+
pendingTextRef.current = null;
|
|
2069
|
+
queuedTextRef.current = null;
|
|
2070
|
+
pointerStartRef.current = null;
|
|
2071
|
+
lastClickRef.current = null;
|
|
2072
|
+
composingRef.current = false;
|
|
2073
|
+
if (inputRef.current) inputRef.current.value = "";
|
|
2074
|
+
}, []);
|
|
2075
|
+
const pointerInputEnabled = rawInputEnabled && props.pointerInput;
|
|
2076
|
+
const keyboardInputEnabled = rawInputEnabled && props.keyboardInput;
|
|
2077
|
+
useLayoutEffect(() => {
|
|
2078
|
+
const canvas = canvasRef.current;
|
|
2079
|
+
const viewport = canvas?.parentElement;
|
|
2080
|
+
if (!canvas || !viewport) return;
|
|
2081
|
+
const fit = () => fitComputerCanvas(canvas);
|
|
2082
|
+
fit();
|
|
2083
|
+
if (typeof ResizeObserver === "undefined") {
|
|
2084
|
+
window.addEventListener("resize", fit);
|
|
2085
|
+
return () => window.removeEventListener("resize", fit);
|
|
2086
|
+
}
|
|
2087
|
+
const observer = new ResizeObserver(fit);
|
|
2088
|
+
observer.observe(viewport);
|
|
2089
|
+
return () => observer.disconnect();
|
|
2090
|
+
}, []);
|
|
2091
|
+
const paintQueuedFrames = useCallback5(() => {
|
|
1586
2092
|
if (decodingFrameRef.current) return;
|
|
1587
2093
|
decodingFrameRef.current = true;
|
|
1588
2094
|
void (async () => {
|
|
@@ -1598,8 +2104,10 @@ function ComputerViewport(props) {
|
|
|
1598
2104
|
const bitmap = await createImageBitmap(blob);
|
|
1599
2105
|
try {
|
|
1600
2106
|
const canvas2 = canvasRef.current;
|
|
1601
|
-
if (mountedRef.current && canvas2) {
|
|
2107
|
+
if (mountedRef.current && canvas2 && currentFrameRef.current && sameComputerTarget(frame, currentFrameRef.current)) {
|
|
1602
2108
|
paintCanvas(canvas2, bitmap, frame.width, frame.height);
|
|
2109
|
+
paintedFrameRef.current = frame;
|
|
2110
|
+
setPaintedFrame(frame);
|
|
1603
2111
|
}
|
|
1604
2112
|
} finally {
|
|
1605
2113
|
bitmap.close();
|
|
@@ -1609,11 +2117,14 @@ function ComputerViewport(props) {
|
|
|
1609
2117
|
objectUrl = URL.createObjectURL(blob);
|
|
1610
2118
|
const image = await loadImage(objectUrl);
|
|
1611
2119
|
const canvas = canvasRef.current;
|
|
1612
|
-
if (mountedRef.current && canvas) {
|
|
2120
|
+
if (mountedRef.current && canvas && currentFrameRef.current && sameComputerTarget(frame, currentFrameRef.current)) {
|
|
1613
2121
|
paintCanvas(canvas, image, frame.width, frame.height);
|
|
2122
|
+
paintedFrameRef.current = frame;
|
|
2123
|
+
setPaintedFrame(frame);
|
|
1614
2124
|
}
|
|
1615
2125
|
} catch (cause) {
|
|
1616
|
-
if (mountedRef.current
|
|
2126
|
+
if (mountedRef.current && currentFrameRef.current && sameComputerTarget(frame, currentFrameRef.current))
|
|
2127
|
+
errorRef.current(cause);
|
|
1617
2128
|
} finally {
|
|
1618
2129
|
if (objectUrl) URL.revokeObjectURL(objectUrl);
|
|
1619
2130
|
}
|
|
@@ -1624,52 +2135,109 @@ function ComputerViewport(props) {
|
|
|
1624
2135
|
}
|
|
1625
2136
|
})();
|
|
1626
2137
|
}, []);
|
|
1627
|
-
|
|
2138
|
+
useLayoutEffect(() => {
|
|
1628
2139
|
mountedRef.current = true;
|
|
1629
2140
|
return () => {
|
|
1630
2141
|
mountedRef.current = false;
|
|
2142
|
+
actionQueueEpochRef.current += 1;
|
|
1631
2143
|
queuedFrameRef.current = null;
|
|
2144
|
+
clearBufferedInput();
|
|
1632
2145
|
};
|
|
1633
|
-
}, []);
|
|
1634
|
-
|
|
1635
|
-
if (!props.frame)
|
|
2146
|
+
}, [clearBufferedInput]);
|
|
2147
|
+
useLayoutEffect(() => {
|
|
2148
|
+
if (currentFrameRef.current && !props.frame) {
|
|
2149
|
+
actionQueueEpochRef.current += 1;
|
|
2150
|
+
clearBufferedInput();
|
|
2151
|
+
}
|
|
2152
|
+
currentFrameRef.current = props.frame;
|
|
2153
|
+
if (!props.frame) {
|
|
2154
|
+
queuedFrameRef.current = null;
|
|
2155
|
+
paintedFrameRef.current = null;
|
|
2156
|
+
setPaintedFrame(null);
|
|
2157
|
+
return;
|
|
2158
|
+
}
|
|
1636
2159
|
queuedFrameRef.current = props.frame;
|
|
1637
2160
|
paintQueuedFrames();
|
|
1638
|
-
}, [paintQueuedFrames, props.frame]);
|
|
1639
|
-
|
|
1640
|
-
(
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
2161
|
+
}, [clearBufferedInput, paintQueuedFrames, props.frame]);
|
|
2162
|
+
useLayoutEffect(() => {
|
|
2163
|
+
if (!rawInputEnabled || !props.pointerInput || !props.keyboardInput) {
|
|
2164
|
+
actionQueueEpochRef.current += 1;
|
|
2165
|
+
clearBufferedInput();
|
|
2166
|
+
}
|
|
2167
|
+
}, [clearBufferedInput, props.keyboardInput, props.pointerInput, rawInputEnabled]);
|
|
2168
|
+
const enqueue = useCallback5(
|
|
2169
|
+
(action, frame, after, continuation) => {
|
|
2170
|
+
const epoch = actionQueueEpochRef.current;
|
|
2171
|
+
const plainText = action.type === "keyboard" && action.action === "type";
|
|
2172
|
+
const queuedText = queuedTextRef.current;
|
|
2173
|
+
if (plainText && !frame && !after && !continuation && queuedText?.epoch === epoch && queuedText.delivery.completion === actionTailRef.current && queuedText.action.value.length + action.value.length <= 1e6) {
|
|
2174
|
+
queuedText.action.value += action.value;
|
|
2175
|
+
return queuedText.delivery;
|
|
2176
|
+
}
|
|
2177
|
+
queuedTextRef.current = null;
|
|
2178
|
+
const dispatch = actionRef.current;
|
|
2179
|
+
const admittedTarget = targetRef.current;
|
|
2180
|
+
const isCurrent = () => mountedRef.current && epoch === actionQueueEpochRef.current;
|
|
2181
|
+
const operationId = crypto.randomUUID();
|
|
2182
|
+
let markStarted;
|
|
2183
|
+
const started = new Promise((resolve) => {
|
|
2184
|
+
markStarted = resolve;
|
|
2185
|
+
});
|
|
2186
|
+
const previous = actionTailRef.current;
|
|
2187
|
+
const ready = continuation && previous === continuation.completion ? continuation.started : previous.then(() => true);
|
|
2188
|
+
const delivery = ready.then(async (firstStarted) => {
|
|
2189
|
+
if (queuedTextRef.current?.action === action) queuedTextRef.current = null;
|
|
2190
|
+
if (!firstStarted || !isCurrent()) {
|
|
2191
|
+
markStarted(false);
|
|
2192
|
+
return;
|
|
2193
|
+
}
|
|
2194
|
+
const pending = dispatch(action, frame, operationId);
|
|
2195
|
+
markStarted(true);
|
|
2196
|
+
const receipt = await pending;
|
|
2197
|
+
const isCurrentResult = () => isCurrent() && !isStaleComputerActionResult(receipt);
|
|
2198
|
+
if (!isCurrentResult()) return;
|
|
2199
|
+
const observedTarget = receipt.observation?.target;
|
|
2200
|
+
if (!admittedTarget || receipt.computerSessionId !== admittedTarget.computerSessionId || receipt.controllerGeneration !== admittedTarget.controllerGeneration || receipt.targetId !== admittedTarget.id || observedTarget && (observedTarget.computerSessionId !== admittedTarget.computerSessionId || observedTarget.controllerGeneration !== admittedTarget.controllerGeneration || observedTarget.id !== admittedTarget.id || observedTarget.targetGeneration !== admittedTarget.targetGeneration)) {
|
|
2201
|
+
actionQueueEpochRef.current += 1;
|
|
2202
|
+
clearBufferedInput();
|
|
2203
|
+
return;
|
|
2204
|
+
}
|
|
2205
|
+
await after?.(isCurrentResult);
|
|
2206
|
+
}).catch((cause) => {
|
|
2207
|
+
markStarted(false);
|
|
2208
|
+
if (!isCurrent() || isStaleComputerActionResult(cause)) return;
|
|
2209
|
+
actionQueueEpochRef.current += 1;
|
|
2210
|
+
clearBufferedInput();
|
|
2211
|
+
errorRef.current(cause);
|
|
2212
|
+
});
|
|
2213
|
+
const completion = continuation ? Promise.all([previous, delivery]).then(() => void 0) : delivery;
|
|
2214
|
+
actionTailRef.current = completion;
|
|
2215
|
+
const queued = { operationId, started, completion };
|
|
2216
|
+
if (plainText && !frame && !after && !continuation) {
|
|
2217
|
+
queuedTextRef.current = { action, epoch, delivery: queued };
|
|
2218
|
+
}
|
|
2219
|
+
return queued;
|
|
1653
2220
|
},
|
|
1654
|
-
[]
|
|
2221
|
+
[clearBufferedInput]
|
|
1655
2222
|
);
|
|
1656
|
-
const point =
|
|
2223
|
+
const point = useCallback5(
|
|
1657
2224
|
(frame, clientX, clientY) => computerPoint(canvasRef.current, frame, clientX, clientY),
|
|
1658
2225
|
[]
|
|
1659
2226
|
);
|
|
1660
|
-
const flushPendingText =
|
|
2227
|
+
const flushPendingText = useCallback5(() => {
|
|
1661
2228
|
const pending = pendingTextRef.current;
|
|
1662
2229
|
if (!pending) return;
|
|
1663
2230
|
clearTimeout(pending.timer);
|
|
1664
2231
|
pendingTextRef.current = null;
|
|
1665
2232
|
enqueue({ type: "keyboard", action: "type", value: pending.text }, null);
|
|
1666
2233
|
}, [enqueue]);
|
|
1667
|
-
const flushPendingClick =
|
|
2234
|
+
const flushPendingClick = useCallback5(() => {
|
|
1668
2235
|
const pending = lastClickRef.current;
|
|
1669
2236
|
if (!pending) return;
|
|
1670
2237
|
if (clickTimerRef.current) clearTimeout(clickTimerRef.current);
|
|
1671
2238
|
clickTimerRef.current = null;
|
|
1672
2239
|
lastClickRef.current = null;
|
|
2240
|
+
if (!pending.pending) return;
|
|
1673
2241
|
enqueue(
|
|
1674
2242
|
{
|
|
1675
2243
|
type: "pointer",
|
|
@@ -1681,23 +2249,47 @@ function ComputerViewport(props) {
|
|
|
1681
2249
|
pending.frame
|
|
1682
2250
|
);
|
|
1683
2251
|
}, [enqueue]);
|
|
2252
|
+
const flushPendingWheel = useCallback5(() => {
|
|
2253
|
+
const batch = wheelRef.current;
|
|
2254
|
+
if (!batch) return;
|
|
2255
|
+
if (batch.timer) clearTimeout(batch.timer);
|
|
2256
|
+
wheelRef.current = null;
|
|
2257
|
+
enqueue(
|
|
2258
|
+
{
|
|
2259
|
+
type: "pointer",
|
|
2260
|
+
frameId: batch.frame.frameId,
|
|
2261
|
+
action: "scroll",
|
|
2262
|
+
x: batch.x,
|
|
2263
|
+
y: batch.y,
|
|
2264
|
+
deltaX: batch.deltaX,
|
|
2265
|
+
deltaY: batch.deltaY
|
|
2266
|
+
},
|
|
2267
|
+
batch.frame
|
|
2268
|
+
);
|
|
2269
|
+
}, [enqueue]);
|
|
1684
2270
|
const pointerDown = (event) => {
|
|
1685
|
-
|
|
2271
|
+
const frame = paintedFrameRef.current;
|
|
2272
|
+
if (!frame || !props.pointerClickContinuation && props.mutating || !rawInputEnabled || event.button !== 0)
|
|
2273
|
+
return;
|
|
2274
|
+
event.preventDefault();
|
|
2275
|
+
if (keyboardInputEnabled) inputRef.current?.focus({ preventScroll: true });
|
|
2276
|
+
if (!pointerInputEnabled) return;
|
|
2277
|
+
flushPendingWheel();
|
|
1686
2278
|
flushPendingText();
|
|
1687
2279
|
pointerStartRef.current = {
|
|
1688
2280
|
x: event.clientX,
|
|
1689
2281
|
y: event.clientY,
|
|
1690
2282
|
pointerId: event.pointerId,
|
|
1691
|
-
frame
|
|
2283
|
+
frame
|
|
1692
2284
|
};
|
|
1693
2285
|
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
1694
|
-
inputRef.current?.focus({ preventScroll: true });
|
|
1695
2286
|
};
|
|
1696
2287
|
const pointerUp = (event) => {
|
|
1697
|
-
if (!
|
|
2288
|
+
if (!pointerInputEnabled) return;
|
|
1698
2289
|
const start = pointerStartRef.current;
|
|
1699
2290
|
pointerStartRef.current = null;
|
|
1700
2291
|
if (!start || start.pointerId !== event.pointerId) return;
|
|
2292
|
+
const canvasRect = event.currentTarget.getBoundingClientRect();
|
|
1701
2293
|
const from = point(start.frame, start.x, start.y);
|
|
1702
2294
|
const to = point(start.frame, event.clientX, event.clientY);
|
|
1703
2295
|
if (!from || !to) return;
|
|
@@ -1719,7 +2311,7 @@ function ComputerViewport(props) {
|
|
|
1719
2311
|
}
|
|
1720
2312
|
const now = Date.now();
|
|
1721
2313
|
const previous = lastClickRef.current;
|
|
1722
|
-
if (previous && now - previous.at < 280 && Math.hypot(previous.x - to.x, previous.y - to.y) < 6 && sameFrameFence(previous.frame, start.frame)) {
|
|
2314
|
+
if (previous && now - previous.at < 280 && previous.pending === !props.pointerClickContinuation && (props.pointerClickContinuation ? Math.hypot(previous.clientX - event.clientX, previous.clientY - event.clientY) < 6 && previous.canvasRect.left === canvasRect.left && previous.canvasRect.top === canvasRect.top && previous.canvasRect.width === canvasRect.width && previous.canvasRect.height === canvasRect.height && sameComputerTarget(previous.frame, start.frame) && previous.frame.width === start.frame.width && previous.frame.height === start.frame.height : Math.hypot(previous.x - to.x, previous.y - to.y) < 6 && sameFrameFence(previous.frame, start.frame))) {
|
|
1723
2315
|
if (clickTimerRef.current) clearTimeout(clickTimerRef.current);
|
|
1724
2316
|
clickTimerRef.current = null;
|
|
1725
2317
|
lastClickRef.current = null;
|
|
@@ -1727,15 +2319,45 @@ function ComputerViewport(props) {
|
|
|
1727
2319
|
{
|
|
1728
2320
|
type: "pointer",
|
|
1729
2321
|
frameId: start.frame.frameId,
|
|
1730
|
-
action: "double_click",
|
|
2322
|
+
action: props.pointerClickContinuation ? "click" : "double_click",
|
|
2323
|
+
...props.pointerClickContinuation ? { clickCount: 2 } : {},
|
|
2324
|
+
...previous.delivery ? { continuationOfOperationId: previous.delivery.operationId } : {},
|
|
2325
|
+
x: to.x,
|
|
2326
|
+
y: to.y
|
|
2327
|
+
},
|
|
2328
|
+
start.frame,
|
|
2329
|
+
void 0,
|
|
2330
|
+
previous.delivery ?? void 0
|
|
2331
|
+
);
|
|
2332
|
+
return;
|
|
2333
|
+
}
|
|
2334
|
+
flushPendingClick();
|
|
2335
|
+
lastClickRef.current = {
|
|
2336
|
+
at: now,
|
|
2337
|
+
x: to.x,
|
|
2338
|
+
y: to.y,
|
|
2339
|
+
frame: start.frame,
|
|
2340
|
+
clientX: event.clientX,
|
|
2341
|
+
clientY: event.clientY,
|
|
2342
|
+
canvasRect,
|
|
2343
|
+
pending: !props.pointerClickContinuation,
|
|
2344
|
+
delivery: null
|
|
2345
|
+
};
|
|
2346
|
+
if (props.pointerClickContinuation) {
|
|
2347
|
+
const delivery = enqueue(
|
|
2348
|
+
{
|
|
2349
|
+
type: "pointer",
|
|
2350
|
+
frameId: start.frame.frameId,
|
|
2351
|
+
action: "click",
|
|
2352
|
+
clickCount: 1,
|
|
1731
2353
|
x: to.x,
|
|
1732
2354
|
y: to.y
|
|
1733
2355
|
},
|
|
1734
2356
|
start.frame
|
|
1735
2357
|
);
|
|
2358
|
+
if (lastClickRef.current) lastClickRef.current.delivery = delivery;
|
|
1736
2359
|
return;
|
|
1737
2360
|
}
|
|
1738
|
-
lastClickRef.current = { at: now, x: to.x, y: to.y, frame: start.frame };
|
|
1739
2361
|
clickTimerRef.current = setTimeout(() => {
|
|
1740
2362
|
clickTimerRef.current = null;
|
|
1741
2363
|
lastClickRef.current = null;
|
|
@@ -1753,9 +2375,10 @@ function ComputerViewport(props) {
|
|
|
1753
2375
|
};
|
|
1754
2376
|
const contextMenu = (event) => {
|
|
1755
2377
|
event.preventDefault();
|
|
1756
|
-
if (!
|
|
1757
|
-
const frame =
|
|
2378
|
+
if (!pointerInputEnabled) return;
|
|
2379
|
+
const frame = paintedFrameRef.current;
|
|
1758
2380
|
if (!frame) return;
|
|
2381
|
+
flushPendingWheel();
|
|
1759
2382
|
flushPendingText();
|
|
1760
2383
|
flushPendingClick();
|
|
1761
2384
|
const at = point(frame, event.clientX, event.clientY);
|
|
@@ -1774,44 +2397,34 @@ function ComputerViewport(props) {
|
|
|
1774
2397
|
}
|
|
1775
2398
|
};
|
|
1776
2399
|
const wheel = (event) => {
|
|
1777
|
-
if (!
|
|
1778
|
-
const frame =
|
|
2400
|
+
if (!pointerInputEnabled) return;
|
|
2401
|
+
const frame = paintedFrameRef.current;
|
|
1779
2402
|
if (!frame) return;
|
|
1780
2403
|
const at = point(frame, event.clientX, event.clientY);
|
|
1781
2404
|
if (!at) return;
|
|
1782
2405
|
flushPendingText();
|
|
1783
2406
|
flushPendingClick();
|
|
1784
2407
|
event.preventDefault();
|
|
1785
|
-
|
|
1786
|
-
if (pending
|
|
2408
|
+
let pending = wheelRef.current;
|
|
2409
|
+
if (pending && (!sameComputerTarget(pending.frame, frame) || Math.hypot(pending.x - at.x, pending.y - at.y) > 6)) {
|
|
2410
|
+
flushPendingWheel();
|
|
2411
|
+
pending = null;
|
|
2412
|
+
}
|
|
1787
2413
|
wheelRef.current = {
|
|
1788
2414
|
x: at.x,
|
|
1789
2415
|
y: at.y,
|
|
1790
|
-
deltaX: (pending
|
|
1791
|
-
deltaY: (pending
|
|
2416
|
+
deltaX: (pending?.deltaX ?? 0) + event.deltaX,
|
|
2417
|
+
deltaY: (pending?.deltaY ?? 0) + event.deltaY,
|
|
1792
2418
|
frame,
|
|
1793
|
-
timer: setTimeout(
|
|
1794
|
-
const batch = wheelRef.current;
|
|
1795
|
-
wheelRef.current = null;
|
|
1796
|
-
if (batch) {
|
|
1797
|
-
enqueue(
|
|
1798
|
-
{
|
|
1799
|
-
type: "pointer",
|
|
1800
|
-
frameId: batch.frame.frameId,
|
|
1801
|
-
action: "scroll",
|
|
1802
|
-
x: batch.x,
|
|
1803
|
-
y: batch.y,
|
|
1804
|
-
deltaX: batch.deltaX,
|
|
1805
|
-
deltaY: batch.deltaY
|
|
1806
|
-
},
|
|
1807
|
-
batch.frame
|
|
1808
|
-
);
|
|
1809
|
-
}
|
|
1810
|
-
}, 45)
|
|
2419
|
+
timer: pending?.timer ?? setTimeout(flushPendingWheel, 45)
|
|
1811
2420
|
};
|
|
1812
2421
|
};
|
|
1813
2422
|
const keyDown = (event) => {
|
|
1814
|
-
if (!
|
|
2423
|
+
if (!keyboardInputEnabled) return;
|
|
2424
|
+
if (composingRef.current || event.nativeEvent.isComposing || event.nativeEvent.keyCode === 229) {
|
|
2425
|
+
return;
|
|
2426
|
+
}
|
|
2427
|
+
flushPendingWheel();
|
|
1815
2428
|
const command = event.metaKey || event.ctrlKey;
|
|
1816
2429
|
if (props.clipboardEnabled && command && !event.altKey && ["c", "v"].includes(event.key.toLowerCase())) {
|
|
1817
2430
|
flushPendingText();
|
|
@@ -1825,31 +2438,41 @@ function ComputerViewport(props) {
|
|
|
1825
2438
|
enqueue({ type: "keyboard", action: "press", value: key }, null);
|
|
1826
2439
|
};
|
|
1827
2440
|
const copy = (event) => {
|
|
1828
|
-
if (!props.clipboardEnabled || !
|
|
2441
|
+
if (!props.clipboardEnabled || !keyboardInputEnabled) return;
|
|
1829
2442
|
event.preventDefault();
|
|
2443
|
+
flushPendingWheel();
|
|
1830
2444
|
flushPendingText();
|
|
1831
2445
|
flushPendingClick();
|
|
1832
|
-
|
|
1833
|
-
|
|
2446
|
+
const readClipboard = readClipboardRef.current;
|
|
2447
|
+
enqueue({ type: "clipboard", operation: "copy" }, null, async (isCurrent) => {
|
|
2448
|
+
const clipboard = await readClipboard();
|
|
2449
|
+
if (!isCurrent()) return;
|
|
1834
2450
|
if (!clipboard.text) return;
|
|
1835
2451
|
if (!await copyTextToClipboard(clipboard.text)) {
|
|
1836
|
-
throw new Error("
|
|
2452
|
+
throw new Error(t("computerViewer.desktopTextCouldNotBe"));
|
|
1837
2453
|
}
|
|
1838
2454
|
});
|
|
1839
2455
|
};
|
|
1840
2456
|
const paste = (event) => {
|
|
1841
|
-
if (!props.clipboardEnabled || !
|
|
2457
|
+
if (!props.clipboardEnabled || !keyboardInputEnabled) return;
|
|
1842
2458
|
event.preventDefault();
|
|
2459
|
+
flushPendingWheel();
|
|
1843
2460
|
flushPendingText();
|
|
1844
2461
|
flushPendingClick();
|
|
1845
2462
|
const text = event.clipboardData.getData("text/plain");
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
2463
|
+
const readClipboard = readClipboardRef.current;
|
|
2464
|
+
const dispatch = actionRef.current;
|
|
2465
|
+
enqueue({ type: "clipboard", operation: "write", text }, null, async (isCurrent) => {
|
|
2466
|
+
const clipboard = await readClipboard();
|
|
2467
|
+
if (!isCurrent()) return;
|
|
2468
|
+
assertExactComputerClipboard(t, clipboard, text);
|
|
2469
|
+
await dispatch({ type: "clipboard", operation: "paste" }, null);
|
|
1849
2470
|
});
|
|
1850
2471
|
};
|
|
1851
|
-
const input = (value) => {
|
|
1852
|
-
if (
|
|
2472
|
+
const input = (value, nativeComposing = false) => {
|
|
2473
|
+
if (composingRef.current || nativeComposing) return;
|
|
2474
|
+
if (!value || !keyboardInputEnabled) return;
|
|
2475
|
+
flushPendingWheel();
|
|
1853
2476
|
flushPendingClick();
|
|
1854
2477
|
const pending = pendingTextRef.current;
|
|
1855
2478
|
if (pending) {
|
|
@@ -1864,7 +2487,11 @@ function ComputerViewport(props) {
|
|
|
1864
2487
|
}
|
|
1865
2488
|
if (inputRef.current) inputRef.current.value = "";
|
|
1866
2489
|
};
|
|
1867
|
-
const
|
|
2490
|
+
const compositionEnd = (event) => {
|
|
2491
|
+
composingRef.current = false;
|
|
2492
|
+
input(event.currentTarget.value || event.data);
|
|
2493
|
+
};
|
|
2494
|
+
const showCanvas = props.frame !== null && paintedFrame !== null && sameComputerTarget(props.frame, paintedFrame) && !props.machineLocked && !streamFailed;
|
|
1868
2495
|
return /* @__PURE__ */ jsxs("div", { className: "relative min-h-0 flex-1 overflow-hidden bg-black", children: [
|
|
1869
2496
|
/* @__PURE__ */ jsx(
|
|
1870
2497
|
"canvas",
|
|
@@ -1873,7 +2500,7 @@ function ComputerViewport(props) {
|
|
|
1873
2500
|
className: cn(
|
|
1874
2501
|
"absolute inset-0 m-auto max-h-full max-w-full touch-none focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-og-accent",
|
|
1875
2502
|
!showCanvas && "invisible",
|
|
1876
|
-
!
|
|
2503
|
+
!pointerInputEnabled && "cursor-default"
|
|
1877
2504
|
),
|
|
1878
2505
|
onPointerDown: pointerDown,
|
|
1879
2506
|
onPointerUp: pointerUp,
|
|
@@ -1882,7 +2509,9 @@ function ComputerViewport(props) {
|
|
|
1882
2509
|
},
|
|
1883
2510
|
onContextMenu: contextMenu,
|
|
1884
2511
|
onWheel: wheel,
|
|
1885
|
-
"aria-label":
|
|
2512
|
+
"aria-label": t(
|
|
2513
|
+
props.target?.kind === "app" ? "computerViewer.interactiveAppView" : props.target?.kind === "window" ? "computerViewer.interactiveWindowView" : props.target?.kind === "screen" ? "computerViewer.interactiveScreenView" : "computerViewer.interactiveDesktopView"
|
|
2514
|
+
)
|
|
1886
2515
|
}
|
|
1887
2516
|
),
|
|
1888
2517
|
/* @__PURE__ */ jsx(
|
|
@@ -1890,16 +2519,20 @@ function ComputerViewport(props) {
|
|
|
1890
2519
|
{
|
|
1891
2520
|
ref: inputRef,
|
|
1892
2521
|
defaultValue: "",
|
|
1893
|
-
onInput: (event) => input(event.currentTarget.value),
|
|
2522
|
+
onInput: (event) => input(event.currentTarget.value, event.nativeEvent.isComposing),
|
|
2523
|
+
onCompositionStart: () => {
|
|
2524
|
+
composingRef.current = true;
|
|
2525
|
+
},
|
|
2526
|
+
onCompositionEnd: compositionEnd,
|
|
1894
2527
|
onKeyDown: keyDown,
|
|
1895
2528
|
onCopy: copy,
|
|
1896
2529
|
onPaste: paste,
|
|
1897
2530
|
className: "pointer-events-none absolute left-1/2 top-1/2 size-px resize-none overflow-hidden opacity-0",
|
|
1898
|
-
"aria-label": "
|
|
2531
|
+
"aria-label": t("computerViewer.desktopKeyboardInput"),
|
|
1899
2532
|
autoCapitalize: "off",
|
|
1900
2533
|
autoCorrect: "off",
|
|
1901
2534
|
spellCheck: false,
|
|
1902
|
-
disabled: !
|
|
2535
|
+
disabled: !keyboardInputEnabled
|
|
1903
2536
|
}
|
|
1904
2537
|
),
|
|
1905
2538
|
!showCanvas ? /* @__PURE__ */ jsx(
|
|
@@ -1907,6 +2540,8 @@ function ComputerViewport(props) {
|
|
|
1907
2540
|
{
|
|
1908
2541
|
observation: props.observation,
|
|
1909
2542
|
machineLocked: props.machineLocked,
|
|
2543
|
+
controlUnavailable: props.controlUnavailable,
|
|
2544
|
+
inputAllowed: props.inputAllowed,
|
|
1910
2545
|
connectionState: props.connectionState,
|
|
1911
2546
|
error: props.connectionError,
|
|
1912
2547
|
onAction: (action) => enqueue(action, null),
|
|
@@ -1915,46 +2550,50 @@ function ComputerViewport(props) {
|
|
|
1915
2550
|
) : null,
|
|
1916
2551
|
props.mutating ? /* @__PURE__ */ jsxs("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: [
|
|
1917
2552
|
/* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-3 animate-spin" }),
|
|
1918
|
-
"
|
|
2553
|
+
" ",
|
|
2554
|
+
t("computerViewer.acting")
|
|
1919
2555
|
] }) : null,
|
|
1920
|
-
showCanvas && !rawInputEnabled ? /* @__PURE__ */ jsxs("div", { className: "absolute bottom-3 left-1/2 flex -translate-x-1/2 items-center gap-2 rounded-full border border-white/10 bg-black/70 py-1 pl-3 pr-1 text-[11px] text-white/80 backdrop-blur", children: [
|
|
1921
|
-
/* @__PURE__ */ jsx("span", { children: "
|
|
1922
|
-
props.target ? /* @__PURE__ */ jsx(
|
|
2556
|
+
showCanvas && (!rawInputEnabled || !props.pointerInput || !props.keyboardInput) ? /* @__PURE__ */ jsxs("div", { className: "absolute bottom-3 left-1/2 flex w-max max-w-[calc(100%-1.5rem)] -translate-x-1/2 items-center gap-2 rounded-full border border-white/10 bg-black/70 py-1 pl-3 pr-1 text-[11px] text-white/80 backdrop-blur", children: [
|
|
2557
|
+
/* @__PURE__ */ jsx("span", { children: !rawInputEnabled && (props.pointerInput || props.keyboardInput) ? t("computerViewer.backgroundViewUseAppControls") : !props.pointerInput && !props.keyboardInput ? t("computerViewer.viewOnlyMouseAndKeyboard") : props.keyboardInput ? t("computerViewer.keyboardOnlyMouseUnavailable") : t("computerViewer.mouseOnlyKeyboardUnavailable") }),
|
|
2558
|
+
!rawInputEnabled && props.target && (props.pointerInput || props.keyboardInput) ? /* @__PURE__ */ jsx(
|
|
1923
2559
|
"button",
|
|
1924
2560
|
{
|
|
1925
2561
|
type: "button",
|
|
1926
2562
|
disabled: props.mutating,
|
|
1927
2563
|
onClick: () => enqueue({ type: "focus", targetId: props.target.id }, null),
|
|
1928
|
-
className: "rounded-full bg-white/10 px-2 py-0.5 font-medium text-white transition hover:bg-white/20 disabled:opacity-50",
|
|
1929
|
-
children: "
|
|
2564
|
+
className: "shrink-0 whitespace-nowrap rounded-full bg-white/10 px-2 py-0.5 font-medium text-white transition hover:bg-white/20 disabled:opacity-50",
|
|
2565
|
+
children: t("computerViewer.bringToFront")
|
|
1930
2566
|
}
|
|
1931
2567
|
) : null
|
|
1932
2568
|
] }) : null
|
|
1933
2569
|
] });
|
|
1934
2570
|
}
|
|
1935
|
-
function assertExactComputerClipboard(clipboard, expected) {
|
|
2571
|
+
function assertExactComputerClipboard(t, clipboard, expected) {
|
|
1936
2572
|
if (clipboard.truncated || clipboard.text !== expected) {
|
|
1937
|
-
throw new Error("
|
|
2573
|
+
throw new Error(t("computerViewer.desktopClipboardDidNotAccept"));
|
|
1938
2574
|
}
|
|
1939
2575
|
}
|
|
1940
2576
|
function ComputerViewportFallback(props) {
|
|
2577
|
+
const t = useOpenGeniText();
|
|
1941
2578
|
if (props.machineLocked) {
|
|
1942
2579
|
return /* @__PURE__ */ jsx("div", { className: "absolute inset-0 grid place-items-center bg-og-bg p-6", children: /* @__PURE__ */ jsxs("div", { className: "max-w-sm text-center", children: [
|
|
1943
|
-
/* @__PURE__ */ jsx(LockKeyholeIcon, { className: "mx-auto size-6 text-og-muted" }),
|
|
1944
|
-
/* @__PURE__ */ jsx("p", { className: "mt-3 text-og-menu font-medium text-og-fg", children: "
|
|
1945
|
-
/* @__PURE__ */ jsx("p", { className: "mt-1 text-og-control leading-5 text-og-muted", children: "
|
|
2580
|
+
/* @__PURE__ */ jsx(LockKeyholeIcon, { className: "mx-auto size-6 text-og-fg-muted" }),
|
|
2581
|
+
/* @__PURE__ */ jsx("p", { className: "mt-3 text-og-menu font-medium text-og-fg", children: t("computerViewer.machineLocked") }),
|
|
2582
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-og-control leading-5 text-og-fg-muted", children: t("computerViewer.liveFramesAndInputStay") })
|
|
1946
2583
|
] }) });
|
|
1947
2584
|
}
|
|
2585
|
+
const appControls = props.observation?.target.kind === "app";
|
|
1948
2586
|
const controlFailure = interactionControlFailureFromError(props.error);
|
|
1949
|
-
const interactive =
|
|
1950
|
-
return /* @__PURE__ */ jsx("div", { className: "absolute inset-0 grid place-items-center bg-og-bg p-6", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-md rounded-og-lg border border-og-border bg-og-surface-
|
|
2587
|
+
const interactive = semanticControls(t, props.observation).filter((node) => semanticAction(node) !== null).slice(0, 10);
|
|
2588
|
+
return /* @__PURE__ */ jsx("div", { className: "absolute inset-0 grid place-items-center bg-og-bg p-6", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-md rounded-og-lg border border-og-border bg-og-surface-1 p-4 shadow-lg", children: [
|
|
1951
2589
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1952
|
-
props.error ? /* @__PURE__ */ jsx(CircleAlertIcon, { className: "size-4 text-og-
|
|
1953
|
-
/* @__PURE__ */ jsx("p", { className: "text-og-menu font-medium text-og-fg", children: isAttachedChromeGenerationLossError(props.error) ? "
|
|
2590
|
+
props.error ? /* @__PURE__ */ jsx(CircleAlertIcon, { className: "size-4 text-og-danger" }) : appControls ? /* @__PURE__ */ jsx(PanelsTopLeftIcon, { className: "size-4 text-og-fg-muted" }) : /* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-4 animate-spin text-og-fg-muted" }),
|
|
2591
|
+
/* @__PURE__ */ jsx("p", { className: "text-og-menu font-medium text-og-fg", children: isAttachedChromeGenerationLossError(props.error) ? t("computerViewer.chromeReconnectedOpenAFresh") : !props.inputAllowed ? t("computerViewer.viewOnly") : props.controlUnavailable ? t("computerViewer.desktopControlsUnavailable") : props.error ? t("computerViewer.liveViewDisconnected") : appControls ? t("computerViewer.appControls") : computerConnectionLabel(t, props.connectionState) })
|
|
1954
2592
|
] }),
|
|
1955
|
-
props.error ? /* @__PURE__ */ jsx("p", { className: "mt-2 text-og-control leading-5 text-og-muted", children: isAttachedChromeGenerationLossError(props.error) ? "
|
|
1956
|
-
|
|
1957
|
-
|
|
2593
|
+
props.error ? /* @__PURE__ */ jsx("p", { className: "mt-2 text-og-control leading-5 text-og-fg-muted", children: isAttachedChromeGenerationLossError(props.error) ? t("computerViewer.chromeReconnectedOpenAFresh2") : controlFailure?.message ?? props.error.message }) : null,
|
|
2594
|
+
!props.inputAllowed ? /* @__PURE__ */ jsx("p", { className: "mt-2 text-og-control leading-5 text-og-fg-muted", children: t("computerViewer.refreshToCheckDesktopControls") }) : null,
|
|
2595
|
+
interactive.length > 0 && !props.controlUnavailable && props.inputAllowed ? /* @__PURE__ */ jsxs("div", { className: "mt-3 border-t border-og-border pt-3", children: [
|
|
2596
|
+
/* @__PURE__ */ jsx("p", { className: "mb-2 text-og-xs text-og-fg-subtle", children: t("computerViewer.appControlsRemainAvailable") }),
|
|
1958
2597
|
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", children: interactive.map((node) => /* @__PURE__ */ jsx(
|
|
1959
2598
|
"button",
|
|
1960
2599
|
{
|
|
@@ -1974,20 +2613,23 @@ function ComputerViewportFallback(props) {
|
|
|
1974
2613
|
{
|
|
1975
2614
|
type: "button",
|
|
1976
2615
|
onClick: props.onReconnect,
|
|
1977
|
-
className: "mt-3 text-og-control font-medium
|
|
1978
|
-
children: controlFailure?.retryable === false ? "
|
|
2616
|
+
className: "mt-3 text-og-control font-medium og-link",
|
|
2617
|
+
children: controlFailure?.retryable === false ? t("computerViewer.tryAgain") : t("computerViewer.reconnect")
|
|
1979
2618
|
}
|
|
1980
2619
|
) : null
|
|
1981
2620
|
] }) });
|
|
1982
2621
|
}
|
|
1983
2622
|
function ComputerSemanticPanel(props) {
|
|
1984
|
-
const
|
|
1985
|
-
|
|
1986
|
-
|
|
2623
|
+
const t = useOpenGeniText();
|
|
2624
|
+
const nodes = semanticControls(t, props.observation).slice(0, 100);
|
|
2625
|
+
return /* @__PURE__ */ jsxs("aside", { className: "box-border max-h-[40%] w-full shrink-0 overflow-y-auto border-t border-og-border bg-og-surface-1 p-2 @xl/computer-viewer:max-h-none @xl/computer-viewer:w-64 @xl/computer-viewer:border-t-0 @xl/computer-viewer:border-l", children: [
|
|
2626
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center gap-1.5 px-1 text-og-xs font-medium uppercase tracking-[0.1em] text-og-fg-subtle", children: [
|
|
1987
2627
|
/* @__PURE__ */ jsx(KeyboardIcon, { className: "size-3" }),
|
|
1988
|
-
"
|
|
2628
|
+
" ",
|
|
2629
|
+
t("computerViewer.appControls")
|
|
1989
2630
|
] }),
|
|
1990
|
-
|
|
2631
|
+
!props.inputAllowed ? /* @__PURE__ */ jsx("p", { className: "px-1 py-2 text-og-control leading-5 text-og-fg-muted", children: t("computerViewer.viewOnlyRefreshToCheck") }) : props.controlUnavailable ? /* @__PURE__ */ jsx("p", { className: "px-1 py-2 text-og-control leading-5 text-og-fg-muted", children: t("computerViewer.reconnectToUseAppControls") }) : null,
|
|
2632
|
+
nodes.length === 0 ? props.controlUnavailable ? null : /* @__PURE__ */ jsx("p", { className: "px-1 py-2 text-og-control leading-5 text-og-fg-muted", children: t("computerViewer.thisViewHasNoAccessibility") }) : /* @__PURE__ */ jsx("div", { className: "space-y-0.5", children: nodes.map((node) => /* @__PURE__ */ jsx(
|
|
1991
2633
|
ComputerSemanticControl,
|
|
1992
2634
|
{
|
|
1993
2635
|
node,
|
|
@@ -1999,12 +2641,13 @@ function ComputerSemanticPanel(props) {
|
|
|
1999
2641
|
] });
|
|
2000
2642
|
}
|
|
2001
2643
|
function ComputerSemanticControl(props) {
|
|
2644
|
+
const t = useOpenGeniText();
|
|
2002
2645
|
const { node } = props;
|
|
2003
2646
|
const editable = node.actions.includes("set_value");
|
|
2004
2647
|
const action = semanticAction(node);
|
|
2005
2648
|
const observedValue = semanticValue(node) ?? "";
|
|
2006
|
-
const [value, setValue] =
|
|
2007
|
-
|
|
2649
|
+
const [value, setValue] = useState5(() => observedValue);
|
|
2650
|
+
useEffect5(() => {
|
|
2008
2651
|
setValue(observedValue);
|
|
2009
2652
|
}, [node.ref, observedValue]);
|
|
2010
2653
|
if (editable) {
|
|
@@ -2014,6 +2657,7 @@ function ComputerSemanticControl(props) {
|
|
|
2014
2657
|
className: "rounded-og-sm px-2 py-1.5 hover:bg-og-surface-2",
|
|
2015
2658
|
onSubmit: (event) => {
|
|
2016
2659
|
event.preventDefault();
|
|
2660
|
+
if (props.mutating) return;
|
|
2017
2661
|
props.onAction({
|
|
2018
2662
|
type: "semantic",
|
|
2019
2663
|
locator: { kind: "ref", ref: node.ref },
|
|
@@ -2022,7 +2666,7 @@ function ComputerSemanticControl(props) {
|
|
|
2022
2666
|
});
|
|
2023
2667
|
},
|
|
2024
2668
|
children: [
|
|
2025
|
-
/* @__PURE__ */ jsx("label", { className: "block truncate text-[10px] uppercase text-og-subtle", children: node.name || node.identifier || node.role }),
|
|
2669
|
+
/* @__PURE__ */ jsx("label", { className: "block truncate text-[10px] uppercase text-og-fg-subtle", children: node.name || node.identifier || node.role }),
|
|
2026
2670
|
/* @__PURE__ */ jsxs("div", { className: "mt-1 flex gap-1", children: [
|
|
2027
2671
|
/* @__PURE__ */ jsx(
|
|
2028
2672
|
"input",
|
|
@@ -2031,7 +2675,9 @@ function ComputerSemanticControl(props) {
|
|
|
2031
2675
|
disabled: props.mutating,
|
|
2032
2676
|
onChange: (event) => setValue(event.currentTarget.value),
|
|
2033
2677
|
className: "min-w-0 flex-1 rounded-og-sm border border-og-border bg-og-surface-1 px-1.5 py-1 text-og-control text-og-fg outline-hidden focus:border-og-accent",
|
|
2034
|
-
"aria-label":
|
|
2678
|
+
"aria-label": t("computerViewer.setName", {
|
|
2679
|
+
name: node.name || node.identifier || node.role
|
|
2680
|
+
})
|
|
2035
2681
|
}
|
|
2036
2682
|
),
|
|
2037
2683
|
/* @__PURE__ */ jsx(
|
|
@@ -2040,7 +2686,7 @@ function ComputerSemanticControl(props) {
|
|
|
2040
2686
|
type: "submit",
|
|
2041
2687
|
disabled: props.mutating,
|
|
2042
2688
|
className: "rounded-og-sm border border-og-border bg-og-surface-1 px-2 text-og-control font-medium text-og-fg transition hover:bg-og-surface-2 disabled:opacity-50",
|
|
2043
|
-
children: "
|
|
2689
|
+
children: t("computerViewer.set")
|
|
2044
2690
|
}
|
|
2045
2691
|
)
|
|
2046
2692
|
] })
|
|
@@ -2058,15 +2704,16 @@ function ComputerSemanticControl(props) {
|
|
|
2058
2704
|
},
|
|
2059
2705
|
className: "flex w-full items-start gap-2 rounded-og-sm px-2 py-1.5 text-left transition hover:bg-og-surface-2 disabled:cursor-default disabled:hover:bg-transparent",
|
|
2060
2706
|
children: [
|
|
2061
|
-
/* @__PURE__ */ jsx("span", { className: "mt-0.5 text-[10px] uppercase text-og-subtle", children: node.role }),
|
|
2062
|
-
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-og-control text-og-fg", children: node.name || semanticValue(node) || node.identifier || "
|
|
2707
|
+
/* @__PURE__ */ jsx("span", { className: "mt-0.5 text-[10px] uppercase text-og-fg-subtle", children: node.role }),
|
|
2708
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-og-control text-og-fg", children: node.name || semanticValue(node) || node.identifier || t("computerViewer.unnamedControl") })
|
|
2063
2709
|
]
|
|
2064
2710
|
}
|
|
2065
2711
|
);
|
|
2066
2712
|
}
|
|
2067
2713
|
function ComputerStatusBar(props) {
|
|
2714
|
+
const t = useOpenGeniText();
|
|
2068
2715
|
const screen = props.target?.kind === "screen";
|
|
2069
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex h-8 shrink-0 items-center gap-2 border-t border-og-border bg-og-surface-
|
|
2716
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex h-8 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: [
|
|
2070
2717
|
/* @__PURE__ */ jsx(
|
|
2071
2718
|
"span",
|
|
2072
2719
|
{
|
|
@@ -2076,11 +2723,11 @@ function ComputerStatusBar(props) {
|
|
|
2076
2723
|
)
|
|
2077
2724
|
}
|
|
2078
2725
|
),
|
|
2079
|
-
/* @__PURE__ */ jsx("span", { children: props.connectionState === "live" ? "
|
|
2080
|
-
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children:
|
|
2726
|
+
/* @__PURE__ */ jsx("span", { children: !props.inputAllowed ? t("computerViewer.viewOnly") : props.controlUnavailable ? t("computerViewer.controlsUnavailable") : props.target?.kind === "app" ? t("computerViewer.appControls") : props.connectionState === "live" ? t("computerViewer.live") : computerConnectionLabel(t, props.connectionState) }),
|
|
2727
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: !props.inputAllowed ? t("computerViewer.refreshToCheckDesktopControls2") : props.controlUnavailable ? t("computerViewer.reconnectToUseDesktopInput") : screen ? t("computerViewer.fullScreenInputMayMove") : props.target?.kind === "app" ? props.session?.capabilities?.backgroundActions ? t("computerViewer.appControlsWorkInThe") : t("computerViewer.appControls") : props.session?.capabilities?.backgroundInput ? t("computerViewer.windowClicksAndTypingStay") : props.session?.capabilities?.backgroundActions ? t("computerViewer.windowAppControlsWorkIn") : props.target?.kind ?? t("computerViewer.desktop") }),
|
|
2081
2728
|
screen ? /* @__PURE__ */ jsx(MousePointer2Icon, { className: "size-3", "aria-hidden": true }) : null,
|
|
2082
2729
|
props.refreshing ? /* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-3 animate-spin" }) : null,
|
|
2083
|
-
/* @__PURE__ */
|
|
2730
|
+
props.controlCount > 0 || props.showControls ? /* @__PURE__ */ jsx(
|
|
2084
2731
|
"button",
|
|
2085
2732
|
{
|
|
2086
2733
|
type: "button",
|
|
@@ -2090,12 +2737,9 @@ function ComputerStatusBar(props) {
|
|
|
2090
2737
|
"rounded px-1.5 py-0.5 transition hover:bg-og-surface-2 hover:text-og-fg",
|
|
2091
2738
|
props.showControls && "bg-og-surface-2 text-og-fg"
|
|
2092
2739
|
),
|
|
2093
|
-
children:
|
|
2094
|
-
"Controls ",
|
|
2095
|
-
props.controlCount
|
|
2096
|
-
]
|
|
2740
|
+
children: t("computerViewer.controlsControlcount", { controlCount: props.controlCount })
|
|
2097
2741
|
}
|
|
2098
|
-
)
|
|
2742
|
+
) : null
|
|
2099
2743
|
] });
|
|
2100
2744
|
}
|
|
2101
2745
|
function ComputerNotice(props) {
|
|
@@ -2103,7 +2747,7 @@ function ComputerNotice(props) {
|
|
|
2103
2747
|
"div",
|
|
2104
2748
|
{
|
|
2105
2749
|
className: cn(
|
|
2106
|
-
"grid h-full place-items-center bg-og-bg text-og-control text-og-muted",
|
|
2750
|
+
"grid h-full place-items-center bg-og-bg text-og-control text-og-fg-muted",
|
|
2107
2751
|
props.className
|
|
2108
2752
|
),
|
|
2109
2753
|
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
@@ -2113,11 +2757,30 @@ function ComputerNotice(props) {
|
|
|
2113
2757
|
}
|
|
2114
2758
|
);
|
|
2115
2759
|
}
|
|
2116
|
-
|
|
2760
|
+
var structuralRoles = /* @__PURE__ */ new Set([
|
|
2761
|
+
"frame",
|
|
2762
|
+
"panel",
|
|
2763
|
+
"section",
|
|
2764
|
+
"document",
|
|
2765
|
+
"document web",
|
|
2766
|
+
"static",
|
|
2767
|
+
"static text",
|
|
2768
|
+
"heading",
|
|
2769
|
+
"paragraph",
|
|
2770
|
+
"notification",
|
|
2771
|
+
"separator",
|
|
2772
|
+
"tool bar",
|
|
2773
|
+
"page tab list"
|
|
2774
|
+
]);
|
|
2775
|
+
function semanticControls(t, observation) {
|
|
2117
2776
|
if (observation?.semantic?.kind !== "snapshot") return [];
|
|
2118
2777
|
const result = [];
|
|
2119
2778
|
const visit = (node) => {
|
|
2120
|
-
|
|
2779
|
+
const role = node.role.trim().toLowerCase();
|
|
2780
|
+
const label = node.name?.trim() || node.identifier?.trim();
|
|
2781
|
+
if (node.actions.includes("set_value") || label && label.toLowerCase() !== role && !structuralRoles.has(role) && semanticAction(node) !== null) {
|
|
2782
|
+
result.push(node);
|
|
2783
|
+
}
|
|
2121
2784
|
node.children?.forEach(visit);
|
|
2122
2785
|
};
|
|
2123
2786
|
observation.semantic.roots.forEach(visit);
|
|
@@ -2138,11 +2801,24 @@ function semanticValue(node) {
|
|
|
2138
2801
|
return typeof node.value === "string" ? node.value : null;
|
|
2139
2802
|
}
|
|
2140
2803
|
function paintCanvas(canvas, image, width, height) {
|
|
2804
|
+
const dimensionsChanged = canvas.width !== width || canvas.height !== height;
|
|
2141
2805
|
canvas.width = width;
|
|
2142
2806
|
canvas.height = height;
|
|
2143
2807
|
const context = canvas.getContext("2d", { alpha: false });
|
|
2144
2808
|
if (!context) throw new Error("Desktop canvas is unavailable.");
|
|
2145
2809
|
context.drawImage(image, 0, 0, width, height);
|
|
2810
|
+
if (dimensionsChanged) fitComputerCanvas(canvas);
|
|
2811
|
+
}
|
|
2812
|
+
function fitComputerCanvas(canvas) {
|
|
2813
|
+
const viewport = canvas.parentElement;
|
|
2814
|
+
if (!viewport || canvas.width <= 0 || canvas.height <= 0) return;
|
|
2815
|
+
const scale = Math.min(
|
|
2816
|
+
viewport.clientWidth / canvas.width,
|
|
2817
|
+
viewport.clientHeight / canvas.height
|
|
2818
|
+
);
|
|
2819
|
+
if (!Number.isFinite(scale) || scale <= 0) return;
|
|
2820
|
+
canvas.style.width = `${canvas.width * scale}px`;
|
|
2821
|
+
canvas.style.height = `${canvas.height * scale}px`;
|
|
2146
2822
|
}
|
|
2147
2823
|
function loadImage(url) {
|
|
2148
2824
|
return new Promise((resolve, reject) => {
|
|
@@ -2189,23 +2865,28 @@ function computerKey(event) {
|
|
|
2189
2865
|
return parts.join("+");
|
|
2190
2866
|
}
|
|
2191
2867
|
function sameFrameFence(left, right) {
|
|
2192
|
-
return left.frameId === right.frameId && left
|
|
2868
|
+
return left.frameId === right.frameId && sameComputerTarget(left, right);
|
|
2869
|
+
}
|
|
2870
|
+
function sameComputerTarget(left, right) {
|
|
2871
|
+
return left.computerSessionId === right.computerSessionId && left.controllerGeneration === right.controllerGeneration && left.targetId === right.targetId && left.targetGeneration === right.targetGeneration;
|
|
2193
2872
|
}
|
|
2194
2873
|
function isLiveComputer2(session) {
|
|
2195
2874
|
return !["ending", "ended", "failed", "lost"].includes(session.lifecycle);
|
|
2196
2875
|
}
|
|
2197
|
-
function computerFailureMessage(session) {
|
|
2876
|
+
function computerFailureMessage(t, session) {
|
|
2198
2877
|
switch (session.failureCode) {
|
|
2199
2878
|
case "machine_locked":
|
|
2200
|
-
return "
|
|
2879
|
+
return t("computerViewer.unlockTheConnectedMacThen");
|
|
2201
2880
|
case "controller_heartbeat_expired":
|
|
2202
|
-
return "
|
|
2881
|
+
return t("computerViewer.theDesktopConnectionWasLost");
|
|
2203
2882
|
case "controller_transition_expired":
|
|
2204
|
-
return session.placement.kind === "attached_device" ? "
|
|
2883
|
+
return session.placement.kind === "attached_device" ? t("computerViewer.chromeReconnectedOpenAFresh2") : t("computerViewer.theDesktopConnectionExpiredOpen");
|
|
2884
|
+
case "idle_released":
|
|
2885
|
+
return t("computerViewer.theDesktopStoppedAfterIt");
|
|
2205
2886
|
case null:
|
|
2206
2887
|
return null;
|
|
2207
2888
|
default:
|
|
2208
|
-
return "
|
|
2889
|
+
return t("computerViewer.theDesktopCouldNotBe");
|
|
2209
2890
|
}
|
|
2210
2891
|
}
|
|
2211
2892
|
function isAttachedChromeGenerationLoss(session) {
|
|
@@ -2222,79 +2903,79 @@ function countInterventions(interventions) {
|
|
|
2222
2903
|
}
|
|
2223
2904
|
return counts;
|
|
2224
2905
|
}
|
|
2225
|
-
function interventionTitle(intervention) {
|
|
2906
|
+
function interventionTitle(t, intervention) {
|
|
2226
2907
|
switch (intervention.kind) {
|
|
2227
2908
|
case "manual_login":
|
|
2228
|
-
return "
|
|
2909
|
+
return t("computerViewer.signInNeeded");
|
|
2229
2910
|
case "mfa":
|
|
2230
|
-
return "
|
|
2911
|
+
return t("computerViewer.verificationNeeded");
|
|
2231
2912
|
case "external_action":
|
|
2232
2913
|
case "confirmation":
|
|
2233
|
-
return "
|
|
2914
|
+
return t("computerViewer.actionNeeded");
|
|
2234
2915
|
case "other":
|
|
2235
|
-
return "
|
|
2916
|
+
return t("computerViewer.desktopNeedsYourHelp");
|
|
2236
2917
|
}
|
|
2237
2918
|
}
|
|
2238
|
-
function platformLabel(session) {
|
|
2919
|
+
function platformLabel(t, session) {
|
|
2239
2920
|
switch (session.platform) {
|
|
2240
2921
|
case "macos":
|
|
2241
|
-
return "
|
|
2922
|
+
return t("computerViewer.mac");
|
|
2242
2923
|
case "linux":
|
|
2243
|
-
return "
|
|
2924
|
+
return t("computerViewer.linux");
|
|
2244
2925
|
case "windows":
|
|
2245
|
-
return "
|
|
2926
|
+
return t("computerViewer.windows");
|
|
2246
2927
|
default:
|
|
2247
|
-
return "
|
|
2928
|
+
return t("computerViewer.desktop");
|
|
2248
2929
|
}
|
|
2249
2930
|
}
|
|
2250
|
-
function placementLabel(session) {
|
|
2931
|
+
function placementLabel(t, session) {
|
|
2251
2932
|
switch (session.placement.kind) {
|
|
2252
2933
|
case "sandbox_group":
|
|
2253
|
-
return "
|
|
2934
|
+
return t("computerViewer.agentSandbox");
|
|
2254
2935
|
case "connected_machine":
|
|
2255
|
-
return "
|
|
2936
|
+
return t("computerViewer.connectedMachine");
|
|
2256
2937
|
case "attached_device":
|
|
2257
|
-
return "
|
|
2938
|
+
return t("computerViewer.yourMachine");
|
|
2258
2939
|
case "external_provider":
|
|
2259
|
-
return "
|
|
2940
|
+
return t("computerViewer.cloudDesktop");
|
|
2260
2941
|
}
|
|
2261
2942
|
}
|
|
2262
|
-
function lifecycleLabel(lifecycle) {
|
|
2943
|
+
function lifecycleLabel(t, lifecycle) {
|
|
2263
2944
|
switch (lifecycle) {
|
|
2264
2945
|
case "starting":
|
|
2265
|
-
return "
|
|
2946
|
+
return t("computerViewer.openingDesktop");
|
|
2266
2947
|
case "suspending":
|
|
2267
|
-
return "
|
|
2948
|
+
return t("computerViewer.pausingDesktop");
|
|
2268
2949
|
case "suspended":
|
|
2269
|
-
return "
|
|
2950
|
+
return t("computerViewer.desktopPaused");
|
|
2270
2951
|
case "restoring":
|
|
2271
|
-
return "
|
|
2952
|
+
return t("computerViewer.restoringDesktop");
|
|
2272
2953
|
case "ending":
|
|
2273
|
-
return "
|
|
2954
|
+
return t("computerViewer.closingDesktop");
|
|
2274
2955
|
default:
|
|
2275
|
-
return "
|
|
2956
|
+
return t("computerViewer.connectingToDesktop");
|
|
2276
2957
|
}
|
|
2277
2958
|
}
|
|
2278
|
-
function computerConnectionLabel(state) {
|
|
2959
|
+
function computerConnectionLabel(t, state) {
|
|
2279
2960
|
switch (state) {
|
|
2280
2961
|
case "attaching":
|
|
2281
|
-
return "
|
|
2962
|
+
return t("computerViewer.openingDesktopView");
|
|
2282
2963
|
case "connecting":
|
|
2283
|
-
return "
|
|
2964
|
+
return t("computerViewer.connecting");
|
|
2284
2965
|
case "reconnecting":
|
|
2285
|
-
return "
|
|
2966
|
+
return t("computerViewer.reconnecting");
|
|
2286
2967
|
case "error":
|
|
2287
|
-
return "
|
|
2968
|
+
return t("computerViewer.disconnected");
|
|
2288
2969
|
default:
|
|
2289
|
-
return "
|
|
2970
|
+
return t("computerViewer.waitingForDesktop");
|
|
2290
2971
|
}
|
|
2291
2972
|
}
|
|
2292
2973
|
|
|
2293
2974
|
export {
|
|
2294
|
-
useComputerFrameStream,
|
|
2295
|
-
useComputerSession,
|
|
2296
2975
|
useComputerSessions,
|
|
2976
|
+
useComputerSession,
|
|
2977
|
+
useComputerFrameStream,
|
|
2297
2978
|
ComputerViewer,
|
|
2298
2979
|
computerKey
|
|
2299
2980
|
};
|
|
2300
|
-
//# sourceMappingURL=chunk-
|
|
2981
|
+
//# sourceMappingURL=chunk-MEL6PH2I.js.map
|