@opengeni/react 6.5.2-canary.41607687019001 → 6.7.0
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/dist/app/app-state.d.ts +4 -0
- package/dist/app/app-state.js +19 -14
- package/dist/app/components/Composer.js +25 -23
- package/dist/app/components/agent/agent-capability-picker.js +10 -8
- package/dist/app/components/artifacts/artifact-browse-controls.js +4 -4
- package/dist/app/components/artifacts/artifact-library.js +21 -19
- package/dist/app/components/artifacts/artifact-page-chrome.js +3 -3
- package/dist/app/components/artifacts/artifact-viewer.js +23 -22
- package/dist/app/components/artifacts/artifact-viewer.js.map +1 -1
- package/dist/app/components/artifacts/chat-interactive-block.js +12 -12
- package/dist/app/components/artifacts/copy-artifact-link.js +7 -5
- package/dist/app/components/artifacts/file-reach-dialog.js +11 -9
- package/dist/app/components/artifacts/inline-chat-image.js +18 -18
- package/dist/app/components/artifacts/retained-file-preview.js +24 -23
- package/dist/app/components/artifacts/retained-text-preview.js +3 -3
- package/dist/app/components/artifacts/site-audience.js +6 -5
- package/dist/app/components/artifacts/site-conversations.js +16 -14
- package/dist/app/components/artifacts/site-data.js +18 -16
- package/dist/app/components/artifacts/site-public-link.js +3 -2
- package/dist/app/components/artifacts/site-publishing-page.js +39 -37
- package/dist/app/components/artifacts/site-publishing.js +34 -32
- package/dist/app/components/artifacts/site-settings.js +38 -36
- package/dist/app/components/artifacts/site-version-menu.js +8 -7
- package/dist/app/components/billing-class-mark.js +3 -3
- package/dist/app/components/bots/bot-launch-strip.js +17 -17
- package/dist/app/components/bots/bot-template-dialog.js +30 -28
- package/dist/app/components/bots/bot-template-shortcuts.js +19 -19
- package/dist/app/components/bots/bot-templates-page.js +38 -36
- package/dist/app/components/bots/bot-templates-page.js.map +1 -1
- package/dist/app/components/capabilities/capability-detail-sheet.js +13 -11
- package/dist/app/components/capabilities/capability-logo-source.js +13 -13
- package/dist/app/components/capabilities/capability-logo.js +4 -3
- package/dist/app/components/capabilities/connector-tool-permissions.js +8 -6
- package/dist/app/components/capabilities/native-connect-setup.js +14 -14
- package/dist/app/components/capabilities/own-logins-shared-heads-up.js +7 -6
- package/dist/app/components/capabilities/perform-capability-action.js +7 -6
- package/dist/app/components/capabilities/prepared-mcp-setup-card.js +17 -17
- package/dist/app/components/capabilities/session-capability-card.js +72 -70
- package/dist/app/components/capabilities/session-capability-card.js.map +1 -1
- package/dist/app/components/capabilities/session-chrome-card.js +28 -26
- package/dist/app/components/capabilities/session-connection-accounts.js +4 -3
- package/dist/app/components/capabilities/session-custom-mcp-card.js +20 -19
- package/dist/app/components/capabilities/session-github-card.js +22 -20
- package/dist/app/components/capabilities/session-machine-card.js +27 -25
- package/dist/app/components/capabilities/session-personal-github-card.js +16 -16
- package/dist/app/components/capabilities/session-plugin-card.js +10 -9
- package/dist/app/components/capabilities/use-capabilities-catalog.js +4 -3
- package/dist/app/components/capabilities/use-connection-accounts.js +5 -4
- package/dist/app/components/command-menu/chat-status.js +15 -13
- package/dist/app/components/command-menu/chat-switcher.js +35 -33
- package/dist/app/components/command-menu/chat-switcher.js.map +1 -1
- package/dist/app/components/command-menu/command-menu.js +53 -50
- package/dist/app/components/command-menu/command-menu.js.map +1 -1
- package/dist/app/components/command-menu/shortcut-sheet.js +18 -16
- package/dist/app/components/command-menu/shortcut-sheet.js.map +1 -1
- package/dist/app/components/common.js +4 -3
- package/dist/app/components/composer-capabilities-menu-body.js +4 -4
- package/dist/app/components/composer-mobile-plus-panel.js +8 -8
- package/dist/app/components/composer-mobile-plus.js +1 -1
- package/dist/app/components/credit-required-gate.js +3 -3
- package/dist/app/components/credit-required-prompt.js +10 -8
- package/dist/app/components/credit-required-prompt.js.map +1 -1
- package/dist/app/components/credits/checkout-credits-celebration.js +3 -2
- package/dist/app/components/credits/checkout-return.js +3 -2
- package/dist/app/components/credits/checkout-return.js.map +1 -1
- package/dist/app/components/credits/coupon-redeem.js +5 -4
- package/dist/app/components/credits/credit-refusal-notice.js +7 -5
- package/dist/app/components/cross-slot-deep-link-recovery.js +5 -4
- package/dist/app/components/desktop/app-shots.js +13 -11
- package/dist/app/components/desktop/computer-use.js +6 -4
- package/dist/app/components/desktop/this-computer.js +9 -7
- package/dist/app/components/feedback.js +5 -4
- package/dist/app/components/follow-up-repository-menu-body.js +8 -6
- package/dist/app/components/follow-up-repository-menu-body.js.map +1 -1
- package/dist/app/components/follow-up-repository-picker.js +1 -1
- package/dist/app/components/github-app-connect-launcher.js +5 -4
- package/dist/app/components/in-app-help-link.js +3 -3
- package/dist/app/components/knowledge/agent-learning-settings.js +3 -2
- package/dist/app/components/knowledge/agent-learning-settings.js.map +1 -1
- package/dist/app/components/machines/connect-machine-dialog.js +18 -16
- package/dist/app/components/manual-repository-editor.js +3 -2
- package/dist/app/components/markdown.js +6 -6
- package/dist/app/components/models/models-ui.js +12 -10
- package/dist/app/components/my-things.js +12 -10
- package/dist/app/components/my-things.js.map +1 -1
- package/dist/app/components/new-session-starters.js +3 -3
- package/dist/app/components/own-where-it-works.js +9 -7
- package/dist/app/components/personal-resource-attachment-surface.js +4 -4
- package/dist/app/components/pickers.js +5 -5
- package/dist/app/components/rail/channel-create-dialog.js +7 -5
- package/dist/app/components/rail/project-glyph.js +17 -17
- package/dist/app/components/rail/project-profile.js +31 -29
- package/dist/app/components/rail/rail-context.js +3 -3
- package/dist/app/components/rail/rail-sections.js +68 -66
- package/dist/app/components/rail/session-header.js +59 -57
- package/dist/app/components/rail/session-list.js +66 -64
- package/dist/app/components/rail/session-row-content.js +4 -4
- package/dist/app/components/rail/session-row-hover-details.js +14 -12
- package/dist/app/components/rail/session-shell.js +90 -88
- package/dist/app/components/rail/site-session-group-heading.js +8 -8
- package/dist/app/components/repository-picker.js +8 -6
- package/dist/app/components/secrets/session-secrets-panel.js +4 -3
- package/dist/app/components/secrets/vault-model.js +3 -2
- package/dist/app/components/session/agent-configuration-panel.js +25 -23
- package/dist/app/components/session/agent-configuration-panel.js.map +1 -1
- package/dist/app/components/session/artifact-link-boundary.js +3 -3
- package/dist/app/components/session/artifact-session-page.js +11 -9
- package/dist/app/components/session/banners.js +8 -8
- package/dist/app/components/session/codex-usage-notice.js +5 -3
- package/dist/app/components/session/console-new-conversation.js +42 -40
- package/dist/app/components/session/context-text-reader.js +3 -2
- package/dist/app/components/session/descendant-requests.js +39 -37
- package/dist/app/components/session/descendant-requests.js.map +1 -1
- package/dist/app/components/session/editable-artifacts-workspace.js +36 -34
- package/dist/app/components/session/editable-artifacts-workspace.js.map +1 -1
- package/dist/app/components/session/failed-session-banner.js +13 -11
- package/dist/app/components/session/failed-session-banner.js.map +1 -1
- package/dist/app/components/session/failure-recovery-boundary.js +3 -3
- package/dist/app/components/session/human-input-delegation-record.js +2 -2
- package/dist/app/components/session/human-input.js +33 -31
- package/dist/app/components/session/inspector.js +57 -55
- package/dist/app/components/session/inspector.js.map +1 -1
- package/dist/app/components/session/message-actions.js +5 -4
- package/dist/app/components/session/message-actions.js.map +1 -1
- package/dist/app/components/session/message-resource-attachments.js +12 -11
- package/dist/app/components/session/message-resource-attachments.js.map +1 -1
- package/dist/app/components/session/model-context-inspector.js +6 -4
- package/dist/app/components/session/model-recovery-notice.js +3 -3
- package/dist/app/components/session/new-session-settings-menu.js +11 -9
- package/dist/app/components/session/new-session-setup-strip.js +18 -18
- package/dist/app/components/session/sandbox-recovery-actions.js +3 -3
- package/dist/app/components/session/sandbox-switcher.js +10 -9
- package/dist/app/components/session/sandbox-workspace.js +47 -46
- package/dist/app/components/session/search-markdown-highlight.js +7 -7
- package/dist/app/components/session/search-results-view.js +8 -8
- package/dist/app/components/session/session-admin-access.js +13 -11
- package/dist/app/components/session/session-admission-notice.js +7 -5
- package/dist/app/components/session/session-avatar-picker.js +22 -20
- package/dist/app/components/session/session-avatar.js +16 -16
- package/dist/app/components/session/session-machine-access-notice.js +7 -5
- package/dist/app/components/session/session-profile-dialog.js +29 -27
- package/dist/app/components/session/session-profile-editor.js +30 -28
- package/dist/app/components/session/session-retention.js +10 -8
- package/dist/app/components/session/session-search-dialog.js +10 -10
- package/dist/app/components/session/session-skill-reviews.js +2 -1
- package/dist/app/components/session/session-skill-reviews.js.map +1 -1
- package/dist/app/components/session/session-tenancy-control.js +13 -11
- package/dist/app/components/session/session-tenancy-control.js.map +1 -1
- package/dist/app/components/session/session-unattended-setting.js +7 -5
- package/dist/app/components/session/session-usage-limit-section.js +11 -9
- package/dist/app/components/session/share-chat-dialog.js +9 -7
- package/dist/app/components/session/site-origin-link.js +3 -3
- package/dist/app/components/session/subagents.js +8 -8
- package/dist/app/components/session/subscription-account-indicator.js +6 -6
- package/dist/app/components/session-connectors-menu-body.js +4 -3
- package/dist/app/components/session-connectors-menu-body.js.map +1 -1
- package/dist/app/components/settings/row-select.js +7 -5
- package/dist/app/components/toaster.js +3 -2
- package/dist/app/components/transcription-settings.js +11 -9
- package/dist/app/components/ui/destructive-confirm.js +11 -9
- package/dist/app/components/usage/usage-entry.js +5 -5
- package/dist/app/components/window-bar.js +16 -14
- package/dist/app/components/workspace-composer-plus.js +22 -21
- package/dist/app/components/workspace-reach.js +6 -4
- package/dist/app/components/workspace-tenant-boundary.js +5 -4
- package/dist/app/embed/memory-navigation.js +3 -3
- package/dist/app/embed/session-app.js +211 -209
- package/dist/app/lib/actions/actions-provider.js +15 -13
- package/dist/app/lib/agent-capabilities.js +3 -3
- package/dist/app/lib/app-surfaces.js +7 -6
- package/dist/app/lib/archive-session.d.ts +9 -4
- package/dist/app/lib/archive-session.js +4 -2
- package/dist/app/lib/bot-templates.js +3 -2
- package/dist/app/lib/capabilities.js +3 -2
- package/dist/app/lib/codex-usage-query.js +2 -2
- package/dist/app/lib/composer-connectors.js +17 -16
- package/dist/app/lib/console-site.js +2 -2
- package/dist/app/lib/console-text.js +2 -2
- package/dist/app/lib/events.js +9 -9
- package/dist/app/lib/failed-session-copy.js +3 -3
- package/dist/app/lib/inbox.js +4 -2
- package/dist/app/lib/model-access-onboarding.js +3 -3
- package/dist/app/lib/move-chat-to-machine.js +3 -3
- package/dist/app/lib/navigation.js +2 -2
- package/dist/app/lib/session-branch-cache.js +6 -6
- package/dist/app/lib/session-create.js +4 -4
- package/dist/app/lib/session-group-pagination.js +6 -6
- package/dist/app/lib/session-hover-facts.js +13 -11
- package/dist/app/lib/session-model.js +2 -2
- package/dist/app/lib/session-rail.js +3 -3
- package/dist/app/lib/session-rename.js +3 -3
- package/dist/app/lib/session-restart-operation-controller.js +4 -3
- package/dist/app/lib/session-tenancy.js +3 -2
- package/dist/app/lib/session-usage-limit.js +3 -2
- package/dist/app/lib/sessions-group.js +5 -5
- package/dist/app/lib/site-publishing.js +3 -2
- package/dist/app/lib/site-tool-consent-dialog.js +9 -7
- package/dist/app/lib/site-tool-consent-dialog.js.map +1 -1
- package/dist/app/lib/site-tool-consent.js +1 -1
- package/dist/app/lib/subscription-plans.js +3 -2
- package/dist/app/lib/toast.js +2 -1
- package/dist/app/lib/turn-failure-analytics.js +4 -4
- package/dist/app/lib/use-duplicate-site.js +6 -5
- package/dist/app/lib/use-follow-up-repositories.js +6 -5
- package/dist/app/lib/use-workspace-integrations.js +4 -3
- package/dist/app/lib/use-workspace-machines.js +4 -4
- package/dist/app/lib/use-workspace-model-catalog.js +5 -4
- package/dist/app/lib/use-workspace-rigs.js +2 -2
- package/dist/app/lib/workspace-navigation-preference.js +4 -4
- package/dist/app/lib/workspace-scope-context.js +3 -3
- package/dist/app/routes/artifacts.js +67 -66
- package/dist/app/routes/artifacts.js.map +1 -1
- package/dist/app/routes/retained-artifact.js +42 -40
- package/dist/app/routes/retained-artifact.js.map +1 -1
- package/dist/app/routes/session-unavailable.js +8 -7
- package/dist/app/routes/session.js +119 -117
- package/dist/app/routes/sessions-index-hydration.js +5 -5
- package/dist/app/routes/sessions-index.js +104 -102
- package/dist/app/routes/site-view.js +67 -65
- package/dist/app/routes/site-view.js.map +1 -1
- package/dist/artifacts-document.js +4 -4
- package/dist/artifacts-presentation.js +4 -4
- package/dist/artifacts-spreadsheet.js +4 -4
- package/dist/artifacts.js +10 -10
- package/dist/automations.js +17 -15
- package/dist/automations.js.map +1 -1
- package/dist/browser-viewer-TC27OCIP.js +23 -0
- package/dist/chat-interactive-block-RWPQBHVS.js +18 -0
- package/dist/chunk-2BDT3UZQ.js +229 -0
- package/dist/chunk-2CLNIEK4.js +373 -0
- package/dist/chunk-2FSBSCZJ.js +451 -0
- package/dist/chunk-2I7HDP53.js +199 -0
- package/dist/chunk-2INLDVK3.js +15 -0
- package/dist/chunk-2KALVELR.js +126 -0
- package/dist/chunk-2M3J7ZWQ.js +418 -0
- package/dist/chunk-2OP6WLGV.js +708 -0
- package/dist/chunk-2RG7NIAS.js +2936 -0
- package/dist/chunk-2STUPWEL.js +135 -0
- package/dist/chunk-2YUOVM3G.js +271 -0
- package/dist/chunk-2Z3NQNTM.js +3670 -0
- package/dist/chunk-3CPWWGNK.js +920 -0
- package/dist/chunk-3ED2U6XE.js +37 -0
- package/dist/chunk-3GZA4BUW.js +216 -0
- package/dist/chunk-3IK6UYO6.js +1022 -0
- package/dist/chunk-3PZ7JZI2.js +431 -0
- package/dist/chunk-4DVJ6ONS.js +50 -0
- package/dist/chunk-4DVNUCRR.js +2386 -0
- package/dist/chunk-4DVNUCRR.js.map +1 -0
- package/dist/chunk-4E3ZJRTZ.js +41 -0
- package/dist/chunk-4SAWSRAA.js +141 -0
- package/dist/chunk-53AGXXZM.js +307 -0
- package/dist/chunk-54YW6SZZ.js +818 -0
- package/dist/chunk-57AZS3IE.js +2317 -0
- package/dist/chunk-5CPEEAFD.js +143 -0
- package/dist/chunk-5EWSRZ2Y.js +340 -0
- package/dist/chunk-5IE76VCY.js +387 -0
- package/dist/chunk-5NWEKLDZ.js +170 -0
- package/dist/chunk-5O2FCCHZ.js +198 -0
- package/dist/chunk-5QAY6K77.js +399 -0
- package/dist/chunk-5YKW2K6I.js +625 -0
- package/dist/chunk-5YKW2K6I.js.map +1 -0
- package/dist/chunk-6BCXNDEI.js +4116 -0
- package/dist/chunk-6BCXNDEI.js.map +1 -0
- package/dist/chunk-6DK6Z4UN.js +2599 -0
- package/dist/chunk-6DVCC7QS.js +702 -0
- package/dist/chunk-6JHU2UBS.js +2058 -0
- package/dist/chunk-6PZ7OBYU.js +490 -0
- package/dist/chunk-6WD2INST.js +539 -0
- package/dist/chunk-6WD2INST.js.map +1 -0
- package/dist/chunk-6WGRDRMA.js +163 -0
- package/dist/chunk-77WAKEAH.js +186 -0
- package/dist/chunk-7T2ZE3VT.js +5558 -0
- package/dist/chunk-7T2ZE3VT.js.map +1 -0
- package/dist/chunk-7TDO3CUM.js +393 -0
- package/dist/chunk-7TIX2UAR.js +247 -0
- package/dist/chunk-7V5REBCP.js +148 -0
- package/dist/chunk-7VMZGLYI.js +339 -0
- package/dist/chunk-7W37NS3I.js +236 -0
- package/dist/chunk-7X6SDK2C.js +111 -0
- package/dist/chunk-7ZNUHRP5.js +95 -0
- package/dist/chunk-A36PZALD.js +84 -0
- package/dist/chunk-AUI6VA63.js +107 -0
- package/dist/chunk-AW2MQB37.js +24 -0
- package/dist/chunk-AWKES45Y.js +198 -0
- package/dist/chunk-AXHZYXUV.js +132 -0
- package/dist/chunk-BHNSJVBC.js +129 -0
- package/dist/chunk-BJEJFISW.js +50 -0
- package/dist/chunk-BJFH6JI5.js +422 -0
- package/dist/chunk-BMICEQZQ.js +960 -0
- package/dist/chunk-BTLBYBLU.js +29 -0
- package/dist/chunk-BXBDYNRP.js +89 -0
- package/dist/chunk-C372BFOV.js +357 -0
- package/dist/chunk-C43KRXGA.js +234 -0
- package/dist/chunk-C43KRXGA.js.map +1 -0
- package/dist/chunk-CMKGILJK.js +4824 -0
- package/dist/chunk-CRAOSVHC.js +50 -0
- package/dist/chunk-CRU35QQH.js +281 -0
- package/dist/chunk-CUIWCGMA.js +172 -0
- package/dist/chunk-D5TWNFFE.js +38 -0
- package/dist/chunk-DF5EAHDN.js +4461 -0
- package/dist/chunk-DJAXC5OK.js +56 -0
- package/dist/chunk-DXBYWSL5.js +3550 -0
- package/dist/chunk-DXR5PDFP.js +84 -0
- package/dist/chunk-DZWARC4M.js +267 -0
- package/dist/chunk-DZXEDSQI.js +106 -0
- package/dist/chunk-E7XERZWC.js +48 -0
- package/dist/chunk-ECJBYNLJ.js +79 -0
- package/dist/chunk-EDI6SJ2N.js +43 -0
- package/dist/chunk-EWSOC6WF.js +114 -0
- package/dist/chunk-F2OPHAUN.js +103 -0
- package/dist/chunk-F4ISQGGM.js +81 -0
- package/dist/chunk-FO4LYKJL.js +197 -0
- package/dist/chunk-FPXASDG5.js +73 -0
- package/dist/chunk-FSOQDUCG.js +117 -0
- package/dist/chunk-FSOQDUCG.js.map +1 -0
- package/dist/chunk-FVXBNBHO.js +157 -0
- package/dist/chunk-FYWT2O76.js +34 -0
- package/dist/chunk-FYWT2O76.js.map +1 -0
- package/dist/chunk-FZC5N55X.js +981 -0
- package/dist/chunk-GAVYGBFI.js +99 -0
- package/dist/chunk-GFIMOUDT.js +846 -0
- package/dist/chunk-GFIMOUDT.js.map +1 -0
- package/dist/chunk-GKVJIDHF.js +33 -0
- package/dist/chunk-GVN5SZLX.js +212 -0
- package/dist/chunk-H3T7IWNA.js +134 -0
- package/dist/chunk-HAX4LCR5.js +261 -0
- package/dist/chunk-HC4JFZVU.js +121 -0
- package/dist/chunk-HEFPPMBQ.js +581 -0
- package/dist/chunk-HGKTHF2U.js +1356 -0
- package/dist/chunk-HGKTHF2U.js.map +1 -0
- package/dist/chunk-HNLR7Q4Z.js +83 -0
- package/dist/chunk-HSOXMJOT.js +12 -0
- package/dist/chunk-I4MRDSUF.js +281 -0
- package/dist/chunk-I4QEJ62Y.js +202 -0
- package/dist/chunk-I5B5L6Q4.js +56 -0
- package/dist/chunk-I5QZJODL.js +264 -0
- package/dist/chunk-I7ITSXSJ.js +603 -0
- package/dist/chunk-I7XIZRFD.js +390 -0
- package/dist/chunk-IDANQPRH.js +82 -0
- package/dist/chunk-IFB3WJ36.js +212 -0
- package/dist/chunk-IHTAKKTK.js +264 -0
- package/dist/chunk-IKXNLWAL.js +205 -0
- package/dist/chunk-IKXNLWAL.js.map +1 -0
- package/dist/chunk-ILDXWY37.js +173 -0
- package/dist/chunk-IMDQUHBJ.js +570 -0
- package/dist/chunk-IMZCQBOT.js +119 -0
- package/dist/chunk-IXPTECSC.js +403 -0
- package/dist/chunk-J255A3N5.js +71 -0
- package/dist/chunk-J5F5HPPW.js +141 -0
- package/dist/chunk-JDTGRRNU.js +5045 -0
- package/dist/chunk-JDTGRRNU.js.map +1 -0
- package/dist/chunk-JEA3QDX7.js +2469 -0
- package/dist/chunk-JEUPAVYY.js +156 -0
- package/dist/chunk-JKHKLL5W.js +194 -0
- package/dist/chunk-JQL7ZH6C.js +650 -0
- package/dist/chunk-JWB44UGJ.js +57 -0
- package/dist/chunk-JZ4NLCAP.js +333 -0
- package/dist/chunk-K2A5PXQ5.js +412 -0
- package/dist/chunk-K56XV3C3.js +623 -0
- package/dist/chunk-K6GAXXVA.js +23 -0
- package/dist/chunk-KCBMFSMS.js +199 -0
- package/dist/chunk-KF2FV3ZJ.js +268 -0
- package/dist/chunk-KJD65EJP.js +278 -0
- package/dist/chunk-KLEUWIMZ.js +386 -0
- package/dist/chunk-KODELWYT.js +309 -0
- package/dist/chunk-KRDR5RJD.js +83 -0
- package/dist/chunk-KUDGXAF7.js +914 -0
- package/dist/chunk-KY2R73CG.js +171 -0
- package/dist/chunk-KY2R73CG.js.map +1 -0
- package/dist/chunk-KYS77RPN.js +85 -0
- package/dist/chunk-L7YTNTIK.js +368 -0
- package/dist/chunk-LHPNABDH.js +686 -0
- package/dist/chunk-MFROMEKA.js +401 -0
- package/dist/chunk-MIHN76LX.js +2656 -0
- package/dist/chunk-MIYFS2XN.js +42 -0
- package/dist/chunk-MJUCFQMS.js +65 -0
- package/dist/chunk-MM4FNWI4.js +3064 -0
- package/dist/chunk-MNZG4OHU.js +790 -0
- package/dist/chunk-MVW6HNPI.js +250 -0
- package/dist/chunk-MVW6HNPI.js.map +1 -0
- package/dist/chunk-N6AACDUW.js +200 -0
- package/dist/chunk-NC55IFN3.js +781 -0
- package/dist/chunk-NC7PVOEK.js +98 -0
- package/dist/chunk-NCYMNCJO.js +70 -0
- package/dist/chunk-ND2BXV3P.js +259 -0
- package/dist/chunk-NDBTFUO6.js +272 -0
- package/dist/chunk-NDQJZ7HF.js +206 -0
- package/dist/chunk-NGJJJPZZ.js +162 -0
- package/dist/chunk-NJTSNNE7.js +251 -0
- package/dist/chunk-NPGISCU6.js +4159 -0
- package/dist/chunk-NPGISCU6.js.map +1 -0
- package/dist/chunk-NRTE7DNV.js +1270 -0
- package/dist/chunk-NULUNM7H.js +290 -0
- package/dist/chunk-NUNZS36W.js +227 -0
- package/dist/chunk-NW53H5RW.js +2424 -0
- package/dist/chunk-NXCMHIKI.js +263 -0
- package/dist/chunk-O3LKCBP5.js +159 -0
- package/dist/chunk-O4EA4F3W.js +103 -0
- package/dist/chunk-O4EA4F3W.js.map +1 -0
- package/dist/chunk-O4OOG3D6.js +116 -0
- package/dist/chunk-O4OOG3D6.js.map +1 -0
- package/dist/chunk-O6N4ABCA.js +376 -0
- package/dist/chunk-O732GAFC.js +112 -0
- package/dist/chunk-OF4TIKYC.js +690 -0
- package/dist/chunk-OMPVOMPP.js +70 -0
- package/dist/chunk-OPJJSKUK.js +118 -0
- package/dist/chunk-OPWCMA4D.js +196 -0
- package/dist/chunk-ORJPS5VN.js +1193 -0
- package/dist/chunk-OSY5K7L7.js +187 -0
- package/dist/chunk-OV6QJRT4.js +45 -0
- package/dist/chunk-OVKYVZMW.js +108 -0
- package/dist/chunk-OZCBM3UC.js +171 -0
- package/dist/chunk-P3A2EINJ.js +61 -0
- package/dist/chunk-PTAG4PDC.js +27 -0
- package/dist/chunk-PTF5B7TJ.js +298 -0
- package/dist/chunk-Q3DPEYX4.js +848 -0
- package/dist/chunk-Q6CGOPJD.js +215 -0
- package/dist/chunk-Q6CGOPJD.js.map +1 -0
- package/dist/chunk-QB2KMIDP.js +100 -0
- package/dist/chunk-QCSJ4CWE.js +1067 -0
- package/dist/chunk-QIOQ2NPQ.js +414 -0
- package/dist/chunk-QK5EFEUT.js +353 -0
- package/dist/chunk-QPQBLYQJ.js +41 -0
- package/dist/chunk-QPSGCC5D.js +184 -0
- package/dist/chunk-QZAAUQRN.js +474 -0
- package/dist/chunk-QZM6YDJW.js +489 -0
- package/dist/chunk-QZM6YDJW.js.map +1 -0
- package/dist/chunk-RGBI63KJ.js +188 -0
- package/dist/chunk-RLBKLAEY.js +138 -0
- package/dist/chunk-RMFKVOM7.js +304 -0
- package/dist/chunk-ROKQU7WG.js +258 -0
- package/dist/chunk-RPVREAU7.js +251 -0
- package/dist/chunk-RQKLF42C.js +723 -0
- package/dist/chunk-SC6RRD2D.js +38 -0
- package/dist/chunk-SC6RRD2D.js.map +1 -0
- package/dist/chunk-SEO7TICN.js +94 -0
- package/dist/chunk-SHHJCL7X.js +432 -0
- package/dist/chunk-SIRLACNZ.js +114 -0
- package/dist/chunk-SKPHMYAA.js +237 -0
- package/dist/chunk-SODC7T6L.js +1583 -0
- package/dist/chunk-SQJIKMN3.js +366 -0
- package/dist/chunk-SVINDKVW.js +26 -0
- package/dist/chunk-SYCDHPZF.js +335 -0
- package/dist/chunk-T2QX3FDP.js +133 -0
- package/dist/chunk-T3OWFVMS.js +1187 -0
- package/dist/chunk-T6XI5FLY.js +61 -0
- package/dist/chunk-T7OXJZCX.js +62 -0
- package/dist/chunk-TAT5USZN.js +353 -0
- package/dist/chunk-TPQTRNER.js +172 -0
- package/dist/chunk-TUIN4MB7.js +266 -0
- package/dist/chunk-TX3VECZU.js +71 -0
- package/dist/chunk-TXLIEOJX.js +9624 -0
- package/dist/chunk-U3DN4HEY.js +27 -0
- package/dist/chunk-U7XM7CB4.js +191 -0
- package/dist/chunk-UJK53QFL.js +140 -0
- package/dist/chunk-UMTXA2TH.js +319 -0
- package/dist/chunk-UPDSXFK5.js +199 -0
- package/dist/chunk-UTIAXH52.js +269 -0
- package/dist/chunk-UVN5TMHU.js +1184 -0
- package/dist/chunk-V4Z4B2E3.js +52 -0
- package/dist/chunk-V4Z4B2E3.js.map +1 -0
- package/dist/chunk-VGYXW3VG.js +246 -0
- package/dist/chunk-VS7AHPCZ.js +255 -0
- package/dist/chunk-VTTAJOQ7.js +121 -0
- package/dist/chunk-VWPOLUAO.js +99 -0
- package/dist/chunk-X3MWB2QU.js +3851 -0
- package/dist/chunk-X6KAJI3V.js +211 -0
- package/dist/chunk-XBLRHV5R.js +50 -0
- package/dist/chunk-XDFP2LMW.js +605 -0
- package/dist/chunk-XEQMZB3C.js +525 -0
- package/dist/chunk-XEYLT5VA.js +223 -0
- package/dist/chunk-XHIQ5I6N.js +918 -0
- package/dist/chunk-XLH7QY2R.js +378 -0
- package/dist/chunk-XWFAMUZQ.js +113 -0
- package/dist/chunk-Y4BB2KS2.js +294 -0
- package/dist/chunk-Y4BB2KS2.js.map +1 -0
- package/dist/chunk-Y4OBB2VN.js +84 -0
- package/dist/chunk-YCVD6CI3.js +234 -0
- package/dist/chunk-YENLNISG.js +270 -0
- package/dist/chunk-YIRVLKAX.js +351 -0
- package/dist/chunk-YL73CVNK.js +390 -0
- package/dist/chunk-YLS6QE5G.js +288 -0
- package/dist/chunk-YNF2OC54.js +366 -0
- package/dist/chunk-YNF2OC54.js.map +1 -0
- package/dist/chunk-YPWU5KPE.js +147 -0
- package/dist/chunk-YQXTDZSU.js +2984 -0
- package/dist/chunk-YSJEAAOL.js +178 -0
- package/dist/chunk-YWIFM7D7.js +499 -0
- package/dist/chunk-YWVI6ZMK.js +103 -0
- package/dist/chunk-Z4FMAFNH.js +847 -0
- package/dist/chunk-Z654FWNU.js +136 -0
- package/dist/chunk-Z7Y523PS.js +130 -0
- package/dist/chunk-ZD67RM6G.js +60 -0
- package/dist/chunk-ZEG4VPBL.js +187 -0
- package/dist/chunk-ZHDFQITM.js +283 -0
- package/dist/chunk-ZHDFQITM.js.map +1 -0
- package/dist/chunk-ZLYCOBHW.js +75 -0
- package/dist/chunk-ZNJ5MTXV.js +89 -0
- package/dist/chunk-ZSGY3H53.js +155 -0
- package/dist/chunk-ZTPXACWB.js +1788 -0
- package/dist/chunk-ZUA3JMI6.js +107 -0
- package/dist/chunk-ZYAZUPPV.js +559 -0
- package/dist/composer.js +8 -8
- package/dist/computer-viewer-TDDO25AV.js +21 -0
- package/dist/connect.js +12 -12
- package/dist/desktop-dictation.js +12 -10
- package/dist/desktop-dictation.js.map +1 -1
- package/dist/desktop.js +2 -2
- package/dist/editor.js +2 -2
- package/dist/embedded-new-voice-2G3VLPVQ.js +24 -0
- package/dist/embedded-voice-T5IWOWGD.js +24 -0
- package/dist/fleet-decision-row-WM64KXP3.js +361 -0
- package/dist/in-chat-connect-model.js +5 -5
- package/dist/index.js +51 -51
- package/dist/interaction.js +5 -5
- package/dist/machines.js +3 -3
- package/dist/meetings-recorder.js +1 -1
- package/dist/meetings.js +40 -32
- package/dist/meetings.js.map +1 -1
- package/dist/messages/en.d.ts +3 -0
- package/dist/messages.js +1 -1
- package/dist/model-policy-picker-menu-SMC6J6QN.js +22 -0
- package/dist/payment-page-card-G4U63KUV.js +223 -0
- package/dist/platform-activity-row-BUZGZAKZ.js +128 -0
- package/dist/queue-surface-implementation-4KUZ4PJV.js +908 -0
- package/dist/realtime.js +4 -4
- package/dist/recorder-host-WF2RRR56.js +69 -0
- package/dist/recorder-host-WF2RRR56.js.map +1 -0
- package/dist/recordings.js +3 -3
- package/dist/sandbox-files-ESDMOFSD.js +27 -0
- package/dist/session-app.js +211 -209
- package/dist/session-connect-cards-Q53KMMYY.js +25 -0
- package/dist/session-list-model.js +2 -2
- package/dist/session-realtime-CF3I35WJ.js +30 -0
- package/dist/session-realtime.js +2 -2
- package/dist/session-ui.js +33 -31
- package/dist/session.js +5 -5
- package/dist/sites.js +2 -2
- package/dist/terminal.js +2 -2
- package/dist/this-computer.js +3 -3
- package/dist/timeline-annotation-markers-CJK4RYZ4.js +157 -0
- package/dist/timeline-annotation-selection-67GF5H26.js +208 -0
- package/dist/timeline-annotations-dialog-ONJPQDJQ.js +283 -0
- package/dist/ui/access-list.js +11 -9
- package/dist/ui/access-list.js.map +1 -1
- package/dist/ui/api-error.d.ts +6 -3
- package/dist/ui/api-error.js +2 -1
- package/dist/ui/cadence-picker.js +6 -4
- package/dist/ui/choice-cards.js +5 -3
- package/dist/ui/confirm-dialog.js +2 -2
- package/dist/ui/copy-field.js +5 -3
- package/dist/ui/detail-page.js +2 -2
- package/dist/ui/detail-sheet.js +2 -2
- package/dist/ui/diff-view.js +4 -3
- package/dist/ui/disclosure.js +3 -3
- package/dist/ui/email-chips-input.js +5 -3
- package/dist/ui/error-message.js +2 -1
- package/dist/ui/error-reference.d.ts +15 -0
- package/dist/ui/error-text.d.ts +10 -0
- package/dist/ui/error-text.js +9 -0
- package/dist/ui/error-text.js.map +1 -0
- package/dist/ui/field.js +4 -2
- package/dist/ui/flush-form-page.js +8 -6
- package/dist/ui/form-dialog.js +7 -5
- package/dist/ui/list-row.js +3 -3
- package/dist/ui/load-failure.js +3 -2
- package/dist/ui/load-failure.js.map +1 -1
- package/dist/ui/notice.js +3 -1
- package/dist/ui/relative-time.js +2 -2
- package/dist/ui/revision-history.js +9 -7
- package/dist/ui/revision-history.js.map +1 -1
- package/dist/ui/role-select.js +10 -8
- package/dist/ui/segmented-control.js +4 -2
- package/dist/ui/select-menu.js +5 -3
- package/dist/ui/setting-row.js +3 -1
- package/dist/ui/switch.js +4 -2
- package/dist/ui/usage-meter.js +3 -3
- package/dist/ui/word-list-row.js +4 -2
- package/dist/usage.js +2 -2
- package/dist/workbench.js +4 -4
- package/package.json +5 -6
- package/src/app/app-state.tsx +126 -14
- package/src/app/components/artifacts/site-data.tsx +2 -2
- package/src/app/components/artifacts/site-settings.tsx +2 -2
- package/src/app/components/rail/session-list.tsx +7 -8
- package/src/app/components/rail/session-shell.tsx +3 -3
- package/src/app/components/repository-picker.tsx +8 -1
- package/src/app/components/session/model-context-inspector.tsx +2 -1
- package/src/app/components/session/session-admin-access.tsx +2 -2
- package/src/app/lib/actions/chat-operations.ts +4 -4
- package/src/app/lib/archive-session.test.tsx +265 -2
- package/src/app/lib/archive-session.tsx +175 -9
- package/src/app/lib/copy-link.ts +2 -2
- package/src/app/lib/inbox.tsx +2 -2
- package/src/app/lib/session-failure-toasts.ts +3 -2
- package/src/app/lib/toast.test.tsx +215 -0
- package/src/app/lib/toast.tsx +67 -2
- package/src/app/personal-github-reconnect.test.tsx +356 -0
- package/src/app/routes/artifacts.tsx +1 -2
- package/src/components/tool-action-review.tsx +14 -1
- package/src/meetings/delete-meeting-dialog.tsx +2 -1
- package/src/meetings/meeting-ask.tsx +2 -1
- package/src/meetings/meeting-detail-page.tsx +2 -1
- package/src/meetings/meeting-notes.tsx +2 -1
- package/src/meetings/meeting-settings.tsx +4 -1
- package/src/meetings/meeting-transcript.tsx +4 -1
- package/src/meetings/recorder-context.tsx +10 -0
- package/src/meetings/recorder-host.test.tsx +60 -2
- package/src/meetings/recorder-host.tsx +16 -3
- package/src/meetings/recorder-panel.tsx +2 -1
- package/src/meetings/recorder-workspace.test.tsx +26 -1
- package/src/messages/en.ts +6 -0
- package/src/ui/api-error.test.ts +29 -5
- package/src/ui/api-error.tsx +10 -4
- package/src/ui/error-message.tsx +8 -0
- package/src/ui/error-reference.test.ts +54 -0
- package/src/ui/error-reference.ts +51 -0
- package/src/ui/error-text.test.tsx +66 -0
- package/src/ui/error-text.tsx +49 -0
- package/src/ui/field.tsx +4 -1
- package/src/ui/notice.tsx +7 -2
- package/src/ui/setting-row.tsx +4 -1
- package/styles/app.css +12 -0
- package/styles/compiled.css +9 -0
- package/dist/browser-viewer-NOP5EAUO.js +0 -23
- package/dist/chat-interactive-block-G7O44JHR.js +0 -18
- package/dist/chunk-26RWVLRD.js +0 -135
- package/dist/chunk-2AHTY7OT.js +0 -247
- package/dist/chunk-2GDNWKSC.js +0 -3670
- package/dist/chunk-2JENKGCE.js +0 -339
- package/dist/chunk-2KYQC4T5.js +0 -155
- package/dist/chunk-2RREGDQH.js +0 -708
- package/dist/chunk-2T7DX6KR.js +0 -353
- package/dist/chunk-2VB2O4FQ.js +0 -920
- package/dist/chunk-2VTTKH23.js +0 -94
- package/dist/chunk-2XNG2KNT.js +0 -172
- package/dist/chunk-2YC6JQRO.js +0 -399
- package/dist/chunk-2ZVRJRXC.js +0 -27
- package/dist/chunk-35737UT4.js +0 -162
- package/dist/chunk-366XZ4PM.js +0 -41
- package/dist/chunk-36MIDGAH.js +0 -199
- package/dist/chunk-3FD76LXM.js +0 -212
- package/dist/chunk-3OVIXY4O.js +0 -213
- package/dist/chunk-3OVIXY4O.js.map +0 -1
- package/dist/chunk-3QNRBEYH.js +0 -432
- package/dist/chunk-3QX55WLC.js +0 -15
- package/dist/chunk-3USJPT2S.js +0 -1022
- package/dist/chunk-42CMQ5VR.js +0 -251
- package/dist/chunk-4LPOWQJY.js +0 -42
- package/dist/chunk-4NBTZRKT.js +0 -79
- package/dist/chunk-4OXI6HCV.js +0 -118
- package/dist/chunk-4SZZAFYQ.js +0 -2317
- package/dist/chunk-4TQL3WP2.js +0 -140
- package/dist/chunk-4Y6BK7IU.js +0 -196
- package/dist/chunk-4YD7YZC5.js +0 -373
- package/dist/chunk-5DTST3TP.js +0 -81
- package/dist/chunk-5FH5LQVS.js +0 -130
- package/dist/chunk-5KWMYPJV.js +0 -847
- package/dist/chunk-5MUJDC6C.js +0 -84
- package/dist/chunk-5QM2WPKV.js +0 -41
- package/dist/chunk-5WUN7XPD.js +0 -1184
- package/dist/chunk-64PO2WXU.js +0 -1067
- package/dist/chunk-6AHATAAY.js +0 -431
- package/dist/chunk-6ED2YWBT.js +0 -56
- package/dist/chunk-6GXVYAGR.js +0 -170
- package/dist/chunk-6H4SJBPE.js +0 -85
- package/dist/chunk-6MT3HHUB.js +0 -84
- package/dist/chunk-6UHCBH4G.js +0 -198
- package/dist/chunk-6WLX3NR3.js +0 -198
- package/dist/chunk-73NXYYWE.js +0 -112
- package/dist/chunk-76ERNKIZ.js +0 -603
- package/dist/chunk-776QZ573.js +0 -57
- package/dist/chunk-7BYWOFVH.js +0 -171
- package/dist/chunk-7O5CGGIQ.js +0 -108
- package/dist/chunk-7QOHRZ67.js +0 -251
- package/dist/chunk-7WIDB4PL.js +0 -2058
- package/dist/chunk-7WKP3DYJ.js +0 -37
- package/dist/chunk-7XOVTPDI.js +0 -227
- package/dist/chunk-AB5MBIXY.js +0 -281
- package/dist/chunk-ADNMXBCX.js +0 -1193
- package/dist/chunk-AFBJTUFK.js +0 -202
- package/dist/chunk-ALVRWCXE.js +0 -61
- package/dist/chunk-AOHU6O3M.js +0 -247
- package/dist/chunk-AOHU6O3M.js.map +0 -1
- package/dist/chunk-APW4T4SW.js +0 -270
- package/dist/chunk-AXBSYWKX.js +0 -2656
- package/dist/chunk-B2I5ZW35.js +0 -422
- package/dist/chunk-B3LMRTRF.js +0 -223
- package/dist/chunk-BE2XENG2.js +0 -292
- package/dist/chunk-BE2XENG2.js.map +0 -1
- package/dist/chunk-BF4SADKX.js +0 -29
- package/dist/chunk-BKP43KK4.js +0 -1788
- package/dist/chunk-BM3NEZ6X.js +0 -781
- package/dist/chunk-BT3BAGB5.js +0 -216
- package/dist/chunk-BTSYDIVJ.js +0 -357
- package/dist/chunk-BUBNGKWG.js +0 -70
- package/dist/chunk-BVUJV5WR.js +0 -126
- package/dist/chunk-BZO5ZMUP.js +0 -27
- package/dist/chunk-C3HUF3M2.js +0 -157
- package/dist/chunk-C5QCAOES.js +0 -264
- package/dist/chunk-CGK6ALQU.js +0 -159
- package/dist/chunk-CPYGO76Q.js +0 -335
- package/dist/chunk-CQH4FWYA.js +0 -490
- package/dist/chunk-CZP5QXNB.js +0 -234
- package/dist/chunk-D2TOWEYH.js +0 -266
- package/dist/chunk-D6L4GHRH.js +0 -340
- package/dist/chunk-DKT3N37I.js +0 -50
- package/dist/chunk-DMMJIFKA.js +0 -84
- package/dist/chunk-DO74DQC7.js +0 -26
- package/dist/chunk-DOFJZ2JU.js +0 -83
- package/dist/chunk-DSXVY5WZ.js +0 -119
- package/dist/chunk-E337C2VK.js +0 -82
- package/dist/chunk-E6NRSRBE.js +0 -114
- package/dist/chunk-E6SQKHAU.js +0 -114
- package/dist/chunk-E7UIVD7F.js +0 -236
- package/dist/chunk-EGBII4CP.js +0 -229
- package/dist/chunk-EILSAQVJ.js +0 -200
- package/dist/chunk-ELL6HSYR.js +0 -307
- package/dist/chunk-EUBGLFFR.js +0 -73
- package/dist/chunk-EW6RNWSH.js +0 -212
- package/dist/chunk-EYUT5Y6V.js +0 -2599
- package/dist/chunk-F7U3QPZ3.js +0 -304
- package/dist/chunk-FBTJKSTM.js +0 -1270
- package/dist/chunk-FC2FTSK3.js +0 -2424
- package/dist/chunk-FOGNA3BU.js +0 -148
- package/dist/chunk-FQFKHNC7.js +0 -650
- package/dist/chunk-FTCHM755.js +0 -50
- package/dist/chunk-FXSHP4JZ.js +0 -3550
- package/dist/chunk-G6ZZC543.js +0 -818
- package/dist/chunk-G7FU6PUA.js +0 -100
- package/dist/chunk-GA4YEAMX.js +0 -3851
- package/dist/chunk-GE33BGB7.js +0 -12
- package/dist/chunk-GQ67HSJY.js +0 -570
- package/dist/chunk-GXXZ3WAK.js +0 -106
- package/dist/chunk-H2TCRX3H.js +0 -237
- package/dist/chunk-HLL4PBO7.js +0 -60
- package/dist/chunk-HLOEPV5C.js +0 -259
- package/dist/chunk-HUAGBS4O.js +0 -56
- package/dist/chunk-I36GSRUJ.js +0 -211
- package/dist/chunk-I6VBHT7S.js +0 -261
- package/dist/chunk-ICNNNOXE.js +0 -333
- package/dist/chunk-ICX64J4U.js +0 -172
- package/dist/chunk-ID36Y46W.js +0 -5046
- package/dist/chunk-ID36Y46W.js.map +0 -1
- package/dist/chunk-IGVVXLKJ.js +0 -559
- package/dist/chunk-IKJLSBUI.js +0 -2984
- package/dist/chunk-IKMUFDVS.js +0 -50
- package/dist/chunk-IKUNOX7F.js +0 -255
- package/dist/chunk-ILKDYBON.js +0 -288
- package/dist/chunk-IVYJX3OY.js +0 -187
- package/dist/chunk-JCY4CMDH.js +0 -107
- package/dist/chunk-JJZPLGIP.js +0 -474
- package/dist/chunk-JW33RV4V.js +0 -143
- package/dist/chunk-JWPA6ZPZ.js +0 -351
- package/dist/chunk-JZ4QXS6D.js +0 -50
- package/dist/chunk-K42OUZQ3.js +0 -386
- package/dist/chunk-K5TOVX5A.js +0 -206
- package/dist/chunk-K63HGHZX.js +0 -99
- package/dist/chunk-K6R5T44I.js +0 -75
- package/dist/chunk-KHJ5PXFM.js +0 -914
- package/dist/chunk-KJZRQ55O.js +0 -2319
- package/dist/chunk-KJZRQ55O.js.map +0 -1
- package/dist/chunk-KKI55ZMW.js +0 -65
- package/dist/chunk-KRPLAAFP.js +0 -199
- package/dist/chunk-KVFEZDBO.js +0 -134
- package/dist/chunk-L4I665WK.js +0 -45
- package/dist/chunk-L4OF77LE.js +0 -110
- package/dist/chunk-L4OF77LE.js.map +0 -1
- package/dist/chunk-LA5T52RM.js +0 -70
- package/dist/chunk-LM2W5YAT.js +0 -401
- package/dist/chunk-LQ62ECE6.js +0 -390
- package/dist/chunk-LQDUHU3Y.js +0 -71
- package/dist/chunk-LRJIYTZW.js +0 -4157
- package/dist/chunk-LRJIYTZW.js.map +0 -1
- package/dist/chunk-LRN6GYAZ.js +0 -138
- package/dist/chunk-M4SDVTKJ.js +0 -790
- package/dist/chunk-MA6O7CM6.js +0 -99
- package/dist/chunk-MBIBB6GI.js +0 -197
- package/dist/chunk-MF3ZFB4H.js +0 -199
- package/dist/chunk-MJJGJMYJ.js +0 -98
- package/dist/chunk-MLJADQFI.js +0 -4824
- package/dist/chunk-MQG7RV3B.js +0 -62
- package/dist/chunk-MTTGSQA5.js +0 -186
- package/dist/chunk-MW7Y3T55.js +0 -525
- package/dist/chunk-MYUFMVCH.js +0 -121
- package/dist/chunk-N3OARGH2.js +0 -61
- package/dist/chunk-NB2HMRT2.js +0 -353
- package/dist/chunk-NFDFYWMV.js +0 -141
- package/dist/chunk-NWGNFN3N.js +0 -1187
- package/dist/chunk-NWJRPDIO.js +0 -840
- package/dist/chunk-NWJRPDIO.js.map +0 -1
- package/dist/chunk-NXWBBZJV.js +0 -267
- package/dist/chunk-NY2QWROL.js +0 -71
- package/dist/chunk-O2IOPP3R.js +0 -848
- package/dist/chunk-O2UWH5RG.js +0 -141
- package/dist/chunk-O5YWDLYF.js +0 -393
- package/dist/chunk-OBMCZO7E.js +0 -121
- package/dist/chunk-OD3DCCCB.js +0 -132
- package/dist/chunk-OMH7R6I3.js +0 -390
- package/dist/chunk-OSA5EQG5.js +0 -113
- package/dist/chunk-OSJ3MUTZ.js +0 -2936
- package/dist/chunk-OWAYJ2OV.js +0 -368
- package/dist/chunk-OYXBFSGK.js +0 -269
- package/dist/chunk-PC2EBA5G.js +0 -4116
- package/dist/chunk-PC2EBA5G.js.map +0 -1
- package/dist/chunk-PC2MVXIP.js +0 -363
- package/dist/chunk-PC2MVXIP.js.map +0 -1
- package/dist/chunk-PENGLDR5.js +0 -309
- package/dist/chunk-PSMAWRPL.js +0 -191
- package/dist/chunk-PW4IMTYR.js +0 -702
- package/dist/chunk-PW54V7T5.js +0 -387
- package/dist/chunk-Q2EXYSMO.js +0 -24
- package/dist/chunk-Q2XJK5I4.js +0 -51
- package/dist/chunk-Q2XJK5I4.js.map +0 -1
- package/dist/chunk-Q4EFRI6X.js +0 -258
- package/dist/chunk-Q52CXW6C.js +0 -48
- package/dist/chunk-Q6XQ2R37.js +0 -184
- package/dist/chunk-QAJ53XBW.js +0 -23
- package/dist/chunk-QDTKECT4.js +0 -129
- package/dist/chunk-QE3ZFGI3.js +0 -43
- package/dist/chunk-QHHSUR2Y.js +0 -298
- package/dist/chunk-QHNVNR7B.js +0 -173
- package/dist/chunk-QIK2Q6N5.js +0 -376
- package/dist/chunk-QWL4L366.js +0 -38
- package/dist/chunk-R3J2PTVQ.js +0 -690
- package/dist/chunk-RBRX5ZS3.js +0 -319
- package/dist/chunk-REX6JIC7.js +0 -33
- package/dist/chunk-RGZ7EEC3.js +0 -537
- package/dist/chunk-RGZ7EEC3.js.map +0 -1
- package/dist/chunk-RIPS7GFR.js +0 -960
- package/dist/chunk-RTBZNFNV.js +0 -1354
- package/dist/chunk-RTBZNFNV.js.map +0 -1
- package/dist/chunk-SKMNW4SW.js +0 -187
- package/dist/chunk-SRFARKXC.js +0 -623
- package/dist/chunk-SWIHWCTW.js +0 -4461
- package/dist/chunk-TA5CFTO4.js +0 -103
- package/dist/chunk-TF4ZVJLI.js +0 -156
- package/dist/chunk-TG7DADJR.js +0 -9624
- package/dist/chunk-TI4R2ZD5.js +0 -623
- package/dist/chunk-TI4R2ZD5.js.map +0 -1
- package/dist/chunk-TNKWOUWP.js +0 -412
- package/dist/chunk-TNUSPXPW.js +0 -5555
- package/dist/chunk-TNUSPXPW.js.map +0 -1
- package/dist/chunk-TNYFHKVV.js +0 -366
- package/dist/chunk-TPMZBOFH.js +0 -178
- package/dist/chunk-TW3LKRJF.js +0 -263
- package/dist/chunk-TZAO65I4.js +0 -83
- package/dist/chunk-U5EFEMYU.js +0 -89
- package/dist/chunk-U6M4LS3M.js +0 -378
- package/dist/chunk-UI4HI5QK.js +0 -918
- package/dist/chunk-UJDOWCQ3.js +0 -272
- package/dist/chunk-UJUQ2QOX.js +0 -581
- package/dist/chunk-UQ3IM6FY.js +0 -133
- package/dist/chunk-UYE47LO6.js +0 -246
- package/dist/chunk-VADHIT26.js +0 -89
- package/dist/chunk-VFQ3H6CO.js +0 -163
- package/dist/chunk-VGUN6VB2.js +0 -188
- package/dist/chunk-VGWWEVSD.js +0 -723
- package/dist/chunk-VIEFJ2DM.js +0 -2469
- package/dist/chunk-VLXM36VS.js +0 -268
- package/dist/chunk-W3BFRR2G.js +0 -499
- package/dist/chunk-W5MPXR3A.js +0 -981
- package/dist/chunk-W5OWKVZG.js +0 -136
- package/dist/chunk-W6FRORMX.js +0 -486
- package/dist/chunk-W6FRORMX.js.map +0 -1
- package/dist/chunk-W7XROSZO.js +0 -232
- package/dist/chunk-W7XROSZO.js.map +0 -1
- package/dist/chunk-WEZ5PXZP.js +0 -403
- package/dist/chunk-WHWUWN2X.js +0 -197
- package/dist/chunk-WHWUWN2X.js.map +0 -1
- package/dist/chunk-WLEDGIVS.js +0 -114
- package/dist/chunk-WLEDGIVS.js.map +0 -1
- package/dist/chunk-WNDAKLHG.js +0 -281
- package/dist/chunk-WTJ4PLMU.js +0 -103
- package/dist/chunk-WV2KPJUW.js +0 -107
- package/dist/chunk-X3VY5EGY.js +0 -277
- package/dist/chunk-X3VY5EGY.js.map +0 -1
- package/dist/chunk-XDBYWVCW.js +0 -418
- package/dist/chunk-XF7MA4U5.js +0 -36
- package/dist/chunk-XF7MA4U5.js.map +0 -1
- package/dist/chunk-XOSQP3YA.js +0 -605
- package/dist/chunk-XYBV4ZJQ.js +0 -271
- package/dist/chunk-YBKVGLQR.js +0 -147
- package/dist/chunk-YDCUBUWH.js +0 -1583
- package/dist/chunk-YG6NARQY.js +0 -51
- package/dist/chunk-YG6NARQY.js.map +0 -1
- package/dist/chunk-YSVD5HI4.js +0 -278
- package/dist/chunk-YT3WGNG6.js +0 -290
- package/dist/chunk-YYICQDK4.js +0 -414
- package/dist/chunk-YYLMZLI6.js +0 -686
- package/dist/chunk-ZAMTKG5U.js +0 -95
- package/dist/chunk-ZDLYSXKN.js +0 -111
- package/dist/chunk-ZG447FSS.js +0 -194
- package/dist/chunk-ZIT5KD4Q.js +0 -264
- package/dist/chunk-ZUDOVDKR.js +0 -3064
- package/dist/chunk-ZW2ECJ3A.js +0 -451
- package/dist/computer-viewer-LPZ763KF.js +0 -21
- package/dist/embedded-new-voice-YVMKSLKJ.js +0 -24
- package/dist/embedded-voice-BJPQFXSU.js +0 -24
- package/dist/fleet-decision-row-AA4H5CDT.js +0 -361
- package/dist/model-policy-picker-menu-HSMWVO4P.js +0 -22
- package/dist/payment-page-card-3LTSFJGN.js +0 -223
- package/dist/platform-activity-row-5VYV6TX4.js +0 -128
- package/dist/queue-surface-implementation-NXHZUKD2.js +0 -908
- package/dist/recorder-host-ZKRWTDBM.js +0 -57
- package/dist/recorder-host-ZKRWTDBM.js.map +0 -1
- package/dist/sandbox-files-YCMLQUFU.js +0 -27
- package/dist/session-connect-cards-KSQLMRM5.js +0 -25
- package/dist/session-realtime-ZR6JLG3Y.js +0 -30
- package/dist/timeline-annotation-markers-YAHDPWVG.js +0 -157
- package/dist/timeline-annotation-selection-KHXNCEJP.js +0 -208
- package/dist/timeline-annotations-dialog-Y4XD3N7B.js +0 -283
- /package/dist/{browser-viewer-NOP5EAUO.js.map → browser-viewer-TC27OCIP.js.map} +0 -0
- /package/dist/{chat-interactive-block-G7O44JHR.js.map → chat-interactive-block-RWPQBHVS.js.map} +0 -0
- /package/dist/{chunk-EGBII4CP.js.map → chunk-2BDT3UZQ.js.map} +0 -0
- /package/dist/{chunk-4YD7YZC5.js.map → chunk-2CLNIEK4.js.map} +0 -0
- /package/dist/{chunk-ZW2ECJ3A.js.map → chunk-2FSBSCZJ.js.map} +0 -0
- /package/dist/{chunk-KRPLAAFP.js.map → chunk-2I7HDP53.js.map} +0 -0
- /package/dist/{chunk-3QX55WLC.js.map → chunk-2INLDVK3.js.map} +0 -0
- /package/dist/{chunk-BVUJV5WR.js.map → chunk-2KALVELR.js.map} +0 -0
- /package/dist/{chunk-XDBYWVCW.js.map → chunk-2M3J7ZWQ.js.map} +0 -0
- /package/dist/{chunk-2RREGDQH.js.map → chunk-2OP6WLGV.js.map} +0 -0
- /package/dist/{chunk-OSJ3MUTZ.js.map → chunk-2RG7NIAS.js.map} +0 -0
- /package/dist/{chunk-26RWVLRD.js.map → chunk-2STUPWEL.js.map} +0 -0
- /package/dist/{chunk-XYBV4ZJQ.js.map → chunk-2YUOVM3G.js.map} +0 -0
- /package/dist/{chunk-2GDNWKSC.js.map → chunk-2Z3NQNTM.js.map} +0 -0
- /package/dist/{chunk-2VB2O4FQ.js.map → chunk-3CPWWGNK.js.map} +0 -0
- /package/dist/{chunk-7WKP3DYJ.js.map → chunk-3ED2U6XE.js.map} +0 -0
- /package/dist/{chunk-BT3BAGB5.js.map → chunk-3GZA4BUW.js.map} +0 -0
- /package/dist/{chunk-3USJPT2S.js.map → chunk-3IK6UYO6.js.map} +0 -0
- /package/dist/{chunk-6AHATAAY.js.map → chunk-3PZ7JZI2.js.map} +0 -0
- /package/dist/{chunk-JZ4QXS6D.js.map → chunk-4DVJ6ONS.js.map} +0 -0
- /package/dist/{chunk-5QM2WPKV.js.map → chunk-4E3ZJRTZ.js.map} +0 -0
- /package/dist/{chunk-NFDFYWMV.js.map → chunk-4SAWSRAA.js.map} +0 -0
- /package/dist/{chunk-ELL6HSYR.js.map → chunk-53AGXXZM.js.map} +0 -0
- /package/dist/{chunk-G6ZZC543.js.map → chunk-54YW6SZZ.js.map} +0 -0
- /package/dist/{chunk-4SZZAFYQ.js.map → chunk-57AZS3IE.js.map} +0 -0
- /package/dist/{chunk-JW33RV4V.js.map → chunk-5CPEEAFD.js.map} +0 -0
- /package/dist/{chunk-D6L4GHRH.js.map → chunk-5EWSRZ2Y.js.map} +0 -0
- /package/dist/{chunk-PW54V7T5.js.map → chunk-5IE76VCY.js.map} +0 -0
- /package/dist/{chunk-6GXVYAGR.js.map → chunk-5NWEKLDZ.js.map} +0 -0
- /package/dist/{chunk-6UHCBH4G.js.map → chunk-5O2FCCHZ.js.map} +0 -0
- /package/dist/{chunk-2YC6JQRO.js.map → chunk-5QAY6K77.js.map} +0 -0
- /package/dist/{chunk-EYUT5Y6V.js.map → chunk-6DK6Z4UN.js.map} +0 -0
- /package/dist/{chunk-PW4IMTYR.js.map → chunk-6DVCC7QS.js.map} +0 -0
- /package/dist/{chunk-7WIDB4PL.js.map → chunk-6JHU2UBS.js.map} +0 -0
- /package/dist/{chunk-CQH4FWYA.js.map → chunk-6PZ7OBYU.js.map} +0 -0
- /package/dist/{chunk-VFQ3H6CO.js.map → chunk-6WGRDRMA.js.map} +0 -0
- /package/dist/{chunk-MTTGSQA5.js.map → chunk-77WAKEAH.js.map} +0 -0
- /package/dist/{chunk-O5YWDLYF.js.map → chunk-7TDO3CUM.js.map} +0 -0
- /package/dist/{chunk-2AHTY7OT.js.map → chunk-7TIX2UAR.js.map} +0 -0
- /package/dist/{chunk-FOGNA3BU.js.map → chunk-7V5REBCP.js.map} +0 -0
- /package/dist/{chunk-2JENKGCE.js.map → chunk-7VMZGLYI.js.map} +0 -0
- /package/dist/{chunk-E7UIVD7F.js.map → chunk-7W37NS3I.js.map} +0 -0
- /package/dist/{chunk-ZDLYSXKN.js.map → chunk-7X6SDK2C.js.map} +0 -0
- /package/dist/{chunk-ZAMTKG5U.js.map → chunk-7ZNUHRP5.js.map} +0 -0
- /package/dist/{chunk-DMMJIFKA.js.map → chunk-A36PZALD.js.map} +0 -0
- /package/dist/{chunk-WV2KPJUW.js.map → chunk-AUI6VA63.js.map} +0 -0
- /package/dist/{chunk-Q2EXYSMO.js.map → chunk-AW2MQB37.js.map} +0 -0
- /package/dist/{chunk-6WLX3NR3.js.map → chunk-AWKES45Y.js.map} +0 -0
- /package/dist/{chunk-OD3DCCCB.js.map → chunk-AXHZYXUV.js.map} +0 -0
- /package/dist/{chunk-QDTKECT4.js.map → chunk-BHNSJVBC.js.map} +0 -0
- /package/dist/{chunk-FTCHM755.js.map → chunk-BJEJFISW.js.map} +0 -0
- /package/dist/{chunk-B2I5ZW35.js.map → chunk-BJFH6JI5.js.map} +0 -0
- /package/dist/{chunk-RIPS7GFR.js.map → chunk-BMICEQZQ.js.map} +0 -0
- /package/dist/{chunk-BF4SADKX.js.map → chunk-BTLBYBLU.js.map} +0 -0
- /package/dist/{chunk-U5EFEMYU.js.map → chunk-BXBDYNRP.js.map} +0 -0
- /package/dist/{chunk-BTSYDIVJ.js.map → chunk-C372BFOV.js.map} +0 -0
- /package/dist/{chunk-MLJADQFI.js.map → chunk-CMKGILJK.js.map} +0 -0
- /package/dist/{chunk-DKT3N37I.js.map → chunk-CRAOSVHC.js.map} +0 -0
- /package/dist/{chunk-WNDAKLHG.js.map → chunk-CRU35QQH.js.map} +0 -0
- /package/dist/{chunk-2XNG2KNT.js.map → chunk-CUIWCGMA.js.map} +0 -0
- /package/dist/{chunk-QWL4L366.js.map → chunk-D5TWNFFE.js.map} +0 -0
- /package/dist/{chunk-SWIHWCTW.js.map → chunk-DF5EAHDN.js.map} +0 -0
- /package/dist/{chunk-HUAGBS4O.js.map → chunk-DJAXC5OK.js.map} +0 -0
- /package/dist/{chunk-FXSHP4JZ.js.map → chunk-DXBYWSL5.js.map} +0 -0
- /package/dist/{chunk-5MUJDC6C.js.map → chunk-DXR5PDFP.js.map} +0 -0
- /package/dist/{chunk-NXWBBZJV.js.map → chunk-DZWARC4M.js.map} +0 -0
- /package/dist/{chunk-GXXZ3WAK.js.map → chunk-DZXEDSQI.js.map} +0 -0
- /package/dist/{chunk-Q52CXW6C.js.map → chunk-E7XERZWC.js.map} +0 -0
- /package/dist/{chunk-4NBTZRKT.js.map → chunk-ECJBYNLJ.js.map} +0 -0
- /package/dist/{chunk-QE3ZFGI3.js.map → chunk-EDI6SJ2N.js.map} +0 -0
- /package/dist/{chunk-E6NRSRBE.js.map → chunk-EWSOC6WF.js.map} +0 -0
- /package/dist/{chunk-TA5CFTO4.js.map → chunk-F2OPHAUN.js.map} +0 -0
- /package/dist/{chunk-5DTST3TP.js.map → chunk-F4ISQGGM.js.map} +0 -0
- /package/dist/{chunk-MBIBB6GI.js.map → chunk-FO4LYKJL.js.map} +0 -0
- /package/dist/{chunk-EUBGLFFR.js.map → chunk-FPXASDG5.js.map} +0 -0
- /package/dist/{chunk-C3HUF3M2.js.map → chunk-FVXBNBHO.js.map} +0 -0
- /package/dist/{chunk-W5MPXR3A.js.map → chunk-FZC5N55X.js.map} +0 -0
- /package/dist/{chunk-MA6O7CM6.js.map → chunk-GAVYGBFI.js.map} +0 -0
- /package/dist/{chunk-REX6JIC7.js.map → chunk-GKVJIDHF.js.map} +0 -0
- /package/dist/{chunk-EW6RNWSH.js.map → chunk-GVN5SZLX.js.map} +0 -0
- /package/dist/{chunk-KVFEZDBO.js.map → chunk-H3T7IWNA.js.map} +0 -0
- /package/dist/{chunk-I6VBHT7S.js.map → chunk-HAX4LCR5.js.map} +0 -0
- /package/dist/{chunk-OBMCZO7E.js.map → chunk-HC4JFZVU.js.map} +0 -0
- /package/dist/{chunk-UJUQ2QOX.js.map → chunk-HEFPPMBQ.js.map} +0 -0
- /package/dist/{chunk-DOFJZ2JU.js.map → chunk-HNLR7Q4Z.js.map} +0 -0
- /package/dist/{chunk-GE33BGB7.js.map → chunk-HSOXMJOT.js.map} +0 -0
- /package/dist/{chunk-AB5MBIXY.js.map → chunk-I4MRDSUF.js.map} +0 -0
- /package/dist/{chunk-AFBJTUFK.js.map → chunk-I4QEJ62Y.js.map} +0 -0
- /package/dist/{chunk-6ED2YWBT.js.map → chunk-I5B5L6Q4.js.map} +0 -0
- /package/dist/{chunk-C5QCAOES.js.map → chunk-I5QZJODL.js.map} +0 -0
- /package/dist/{chunk-76ERNKIZ.js.map → chunk-I7ITSXSJ.js.map} +0 -0
- /package/dist/{chunk-OMH7R6I3.js.map → chunk-I7XIZRFD.js.map} +0 -0
- /package/dist/{chunk-E337C2VK.js.map → chunk-IDANQPRH.js.map} +0 -0
- /package/dist/{chunk-3FD76LXM.js.map → chunk-IFB3WJ36.js.map} +0 -0
- /package/dist/{chunk-ZIT5KD4Q.js.map → chunk-IHTAKKTK.js.map} +0 -0
- /package/dist/{chunk-QHNVNR7B.js.map → chunk-ILDXWY37.js.map} +0 -0
- /package/dist/{chunk-GQ67HSJY.js.map → chunk-IMDQUHBJ.js.map} +0 -0
- /package/dist/{chunk-DSXVY5WZ.js.map → chunk-IMZCQBOT.js.map} +0 -0
- /package/dist/{chunk-WEZ5PXZP.js.map → chunk-IXPTECSC.js.map} +0 -0
- /package/dist/{chunk-NY2QWROL.js.map → chunk-J255A3N5.js.map} +0 -0
- /package/dist/{chunk-O2UWH5RG.js.map → chunk-J5F5HPPW.js.map} +0 -0
- /package/dist/{chunk-VIEFJ2DM.js.map → chunk-JEA3QDX7.js.map} +0 -0
- /package/dist/{chunk-TF4ZVJLI.js.map → chunk-JEUPAVYY.js.map} +0 -0
- /package/dist/{chunk-ZG447FSS.js.map → chunk-JKHKLL5W.js.map} +0 -0
- /package/dist/{chunk-FQFKHNC7.js.map → chunk-JQL7ZH6C.js.map} +0 -0
- /package/dist/{chunk-776QZ573.js.map → chunk-JWB44UGJ.js.map} +0 -0
- /package/dist/{chunk-ICNNNOXE.js.map → chunk-JZ4NLCAP.js.map} +0 -0
- /package/dist/{chunk-TNKWOUWP.js.map → chunk-K2A5PXQ5.js.map} +0 -0
- /package/dist/{chunk-SRFARKXC.js.map → chunk-K56XV3C3.js.map} +0 -0
- /package/dist/{chunk-QAJ53XBW.js.map → chunk-K6GAXXVA.js.map} +0 -0
- /package/dist/{chunk-MF3ZFB4H.js.map → chunk-KCBMFSMS.js.map} +0 -0
- /package/dist/{chunk-VLXM36VS.js.map → chunk-KF2FV3ZJ.js.map} +0 -0
- /package/dist/{chunk-YSVD5HI4.js.map → chunk-KJD65EJP.js.map} +0 -0
- /package/dist/{chunk-K42OUZQ3.js.map → chunk-KLEUWIMZ.js.map} +0 -0
- /package/dist/{chunk-PENGLDR5.js.map → chunk-KODELWYT.js.map} +0 -0
- /package/dist/{chunk-TZAO65I4.js.map → chunk-KRDR5RJD.js.map} +0 -0
- /package/dist/{chunk-KHJ5PXFM.js.map → chunk-KUDGXAF7.js.map} +0 -0
- /package/dist/{chunk-6H4SJBPE.js.map → chunk-KYS77RPN.js.map} +0 -0
- /package/dist/{chunk-OWAYJ2OV.js.map → chunk-L7YTNTIK.js.map} +0 -0
- /package/dist/{chunk-YYLMZLI6.js.map → chunk-LHPNABDH.js.map} +0 -0
- /package/dist/{chunk-LM2W5YAT.js.map → chunk-MFROMEKA.js.map} +0 -0
- /package/dist/{chunk-AXBSYWKX.js.map → chunk-MIHN76LX.js.map} +0 -0
- /package/dist/{chunk-4LPOWQJY.js.map → chunk-MIYFS2XN.js.map} +0 -0
- /package/dist/{chunk-KKI55ZMW.js.map → chunk-MJUCFQMS.js.map} +0 -0
- /package/dist/{chunk-ZUDOVDKR.js.map → chunk-MM4FNWI4.js.map} +0 -0
- /package/dist/{chunk-M4SDVTKJ.js.map → chunk-MNZG4OHU.js.map} +0 -0
- /package/dist/{chunk-EILSAQVJ.js.map → chunk-N6AACDUW.js.map} +0 -0
- /package/dist/{chunk-BM3NEZ6X.js.map → chunk-NC55IFN3.js.map} +0 -0
- /package/dist/{chunk-MJJGJMYJ.js.map → chunk-NC7PVOEK.js.map} +0 -0
- /package/dist/{chunk-LA5T52RM.js.map → chunk-NCYMNCJO.js.map} +0 -0
- /package/dist/{chunk-HLOEPV5C.js.map → chunk-ND2BXV3P.js.map} +0 -0
- /package/dist/{chunk-UJDOWCQ3.js.map → chunk-NDBTFUO6.js.map} +0 -0
- /package/dist/{chunk-K5TOVX5A.js.map → chunk-NDQJZ7HF.js.map} +0 -0
- /package/dist/{chunk-35737UT4.js.map → chunk-NGJJJPZZ.js.map} +0 -0
- /package/dist/{chunk-42CMQ5VR.js.map → chunk-NJTSNNE7.js.map} +0 -0
- /package/dist/{chunk-FBTJKSTM.js.map → chunk-NRTE7DNV.js.map} +0 -0
- /package/dist/{chunk-YT3WGNG6.js.map → chunk-NULUNM7H.js.map} +0 -0
- /package/dist/{chunk-7XOVTPDI.js.map → chunk-NUNZS36W.js.map} +0 -0
- /package/dist/{chunk-FC2FTSK3.js.map → chunk-NW53H5RW.js.map} +0 -0
- /package/dist/{chunk-TW3LKRJF.js.map → chunk-NXCMHIKI.js.map} +0 -0
- /package/dist/{chunk-CGK6ALQU.js.map → chunk-O3LKCBP5.js.map} +0 -0
- /package/dist/{chunk-QIK2Q6N5.js.map → chunk-O6N4ABCA.js.map} +0 -0
- /package/dist/{chunk-73NXYYWE.js.map → chunk-O732GAFC.js.map} +0 -0
- /package/dist/{chunk-R3J2PTVQ.js.map → chunk-OF4TIKYC.js.map} +0 -0
- /package/dist/{chunk-BUBNGKWG.js.map → chunk-OMPVOMPP.js.map} +0 -0
- /package/dist/{chunk-4OXI6HCV.js.map → chunk-OPJJSKUK.js.map} +0 -0
- /package/dist/{chunk-4Y6BK7IU.js.map → chunk-OPWCMA4D.js.map} +0 -0
- /package/dist/{chunk-ADNMXBCX.js.map → chunk-ORJPS5VN.js.map} +0 -0
- /package/dist/{chunk-SKMNW4SW.js.map → chunk-OSY5K7L7.js.map} +0 -0
- /package/dist/{chunk-L4I665WK.js.map → chunk-OV6QJRT4.js.map} +0 -0
- /package/dist/{chunk-7O5CGGIQ.js.map → chunk-OVKYVZMW.js.map} +0 -0
- /package/dist/{chunk-7BYWOFVH.js.map → chunk-OZCBM3UC.js.map} +0 -0
- /package/dist/{chunk-ALVRWCXE.js.map → chunk-P3A2EINJ.js.map} +0 -0
- /package/dist/{chunk-BZO5ZMUP.js.map → chunk-PTAG4PDC.js.map} +0 -0
- /package/dist/{chunk-QHHSUR2Y.js.map → chunk-PTF5B7TJ.js.map} +0 -0
- /package/dist/{chunk-O2IOPP3R.js.map → chunk-Q3DPEYX4.js.map} +0 -0
- /package/dist/{chunk-G7FU6PUA.js.map → chunk-QB2KMIDP.js.map} +0 -0
- /package/dist/{chunk-64PO2WXU.js.map → chunk-QCSJ4CWE.js.map} +0 -0
- /package/dist/{chunk-YYICQDK4.js.map → chunk-QIOQ2NPQ.js.map} +0 -0
- /package/dist/{chunk-NB2HMRT2.js.map → chunk-QK5EFEUT.js.map} +0 -0
- /package/dist/{chunk-366XZ4PM.js.map → chunk-QPQBLYQJ.js.map} +0 -0
- /package/dist/{chunk-Q6XQ2R37.js.map → chunk-QPSGCC5D.js.map} +0 -0
- /package/dist/{chunk-JJZPLGIP.js.map → chunk-QZAAUQRN.js.map} +0 -0
- /package/dist/{chunk-VGUN6VB2.js.map → chunk-RGBI63KJ.js.map} +0 -0
- /package/dist/{chunk-LRN6GYAZ.js.map → chunk-RLBKLAEY.js.map} +0 -0
- /package/dist/{chunk-F7U3QPZ3.js.map → chunk-RMFKVOM7.js.map} +0 -0
- /package/dist/{chunk-Q4EFRI6X.js.map → chunk-ROKQU7WG.js.map} +0 -0
- /package/dist/{chunk-7QOHRZ67.js.map → chunk-RPVREAU7.js.map} +0 -0
- /package/dist/{chunk-VGWWEVSD.js.map → chunk-RQKLF42C.js.map} +0 -0
- /package/dist/{chunk-2VTTKH23.js.map → chunk-SEO7TICN.js.map} +0 -0
- /package/dist/{chunk-3QNRBEYH.js.map → chunk-SHHJCL7X.js.map} +0 -0
- /package/dist/{chunk-E6SQKHAU.js.map → chunk-SIRLACNZ.js.map} +0 -0
- /package/dist/{chunk-H2TCRX3H.js.map → chunk-SKPHMYAA.js.map} +0 -0
- /package/dist/{chunk-YDCUBUWH.js.map → chunk-SODC7T6L.js.map} +0 -0
- /package/dist/{chunk-TNYFHKVV.js.map → chunk-SQJIKMN3.js.map} +0 -0
- /package/dist/{chunk-DO74DQC7.js.map → chunk-SVINDKVW.js.map} +0 -0
- /package/dist/{chunk-CPYGO76Q.js.map → chunk-SYCDHPZF.js.map} +0 -0
- /package/dist/{chunk-UQ3IM6FY.js.map → chunk-T2QX3FDP.js.map} +0 -0
- /package/dist/{chunk-NWGNFN3N.js.map → chunk-T3OWFVMS.js.map} +0 -0
- /package/dist/{chunk-N3OARGH2.js.map → chunk-T6XI5FLY.js.map} +0 -0
- /package/dist/{chunk-MQG7RV3B.js.map → chunk-T7OXJZCX.js.map} +0 -0
- /package/dist/{chunk-2T7DX6KR.js.map → chunk-TAT5USZN.js.map} +0 -0
- /package/dist/{chunk-ICX64J4U.js.map → chunk-TPQTRNER.js.map} +0 -0
- /package/dist/{chunk-D2TOWEYH.js.map → chunk-TUIN4MB7.js.map} +0 -0
- /package/dist/{chunk-LQDUHU3Y.js.map → chunk-TX3VECZU.js.map} +0 -0
- /package/dist/{chunk-TG7DADJR.js.map → chunk-TXLIEOJX.js.map} +0 -0
- /package/dist/{chunk-2ZVRJRXC.js.map → chunk-U3DN4HEY.js.map} +0 -0
- /package/dist/{chunk-PSMAWRPL.js.map → chunk-U7XM7CB4.js.map} +0 -0
- /package/dist/{chunk-4TQL3WP2.js.map → chunk-UJK53QFL.js.map} +0 -0
- /package/dist/{chunk-RBRX5ZS3.js.map → chunk-UMTXA2TH.js.map} +0 -0
- /package/dist/{chunk-36MIDGAH.js.map → chunk-UPDSXFK5.js.map} +0 -0
- /package/dist/{chunk-OYXBFSGK.js.map → chunk-UTIAXH52.js.map} +0 -0
- /package/dist/{chunk-5WUN7XPD.js.map → chunk-UVN5TMHU.js.map} +0 -0
- /package/dist/{chunk-UYE47LO6.js.map → chunk-VGYXW3VG.js.map} +0 -0
- /package/dist/{chunk-IKUNOX7F.js.map → chunk-VS7AHPCZ.js.map} +0 -0
- /package/dist/{chunk-MYUFMVCH.js.map → chunk-VTTAJOQ7.js.map} +0 -0
- /package/dist/{chunk-K63HGHZX.js.map → chunk-VWPOLUAO.js.map} +0 -0
- /package/dist/{chunk-GA4YEAMX.js.map → chunk-X3MWB2QU.js.map} +0 -0
- /package/dist/{chunk-I36GSRUJ.js.map → chunk-X6KAJI3V.js.map} +0 -0
- /package/dist/{chunk-IKMUFDVS.js.map → chunk-XBLRHV5R.js.map} +0 -0
- /package/dist/{chunk-XOSQP3YA.js.map → chunk-XDFP2LMW.js.map} +0 -0
- /package/dist/{chunk-MW7Y3T55.js.map → chunk-XEQMZB3C.js.map} +0 -0
- /package/dist/{chunk-B3LMRTRF.js.map → chunk-XEYLT5VA.js.map} +0 -0
- /package/dist/{chunk-UI4HI5QK.js.map → chunk-XHIQ5I6N.js.map} +0 -0
- /package/dist/{chunk-U6M4LS3M.js.map → chunk-XLH7QY2R.js.map} +0 -0
- /package/dist/{chunk-OSA5EQG5.js.map → chunk-XWFAMUZQ.js.map} +0 -0
- /package/dist/{chunk-6MT3HHUB.js.map → chunk-Y4OBB2VN.js.map} +0 -0
- /package/dist/{chunk-CZP5QXNB.js.map → chunk-YCVD6CI3.js.map} +0 -0
- /package/dist/{chunk-APW4T4SW.js.map → chunk-YENLNISG.js.map} +0 -0
- /package/dist/{chunk-JWPA6ZPZ.js.map → chunk-YIRVLKAX.js.map} +0 -0
- /package/dist/{chunk-LQ62ECE6.js.map → chunk-YL73CVNK.js.map} +0 -0
- /package/dist/{chunk-ILKDYBON.js.map → chunk-YLS6QE5G.js.map} +0 -0
- /package/dist/{chunk-YBKVGLQR.js.map → chunk-YPWU5KPE.js.map} +0 -0
- /package/dist/{chunk-IKJLSBUI.js.map → chunk-YQXTDZSU.js.map} +0 -0
- /package/dist/{chunk-TPMZBOFH.js.map → chunk-YSJEAAOL.js.map} +0 -0
- /package/dist/{chunk-W3BFRR2G.js.map → chunk-YWIFM7D7.js.map} +0 -0
- /package/dist/{chunk-WTJ4PLMU.js.map → chunk-YWVI6ZMK.js.map} +0 -0
- /package/dist/{chunk-5KWMYPJV.js.map → chunk-Z4FMAFNH.js.map} +0 -0
- /package/dist/{chunk-W5OWKVZG.js.map → chunk-Z654FWNU.js.map} +0 -0
- /package/dist/{chunk-5FH5LQVS.js.map → chunk-Z7Y523PS.js.map} +0 -0
- /package/dist/{chunk-HLL4PBO7.js.map → chunk-ZD67RM6G.js.map} +0 -0
- /package/dist/{chunk-IVYJX3OY.js.map → chunk-ZEG4VPBL.js.map} +0 -0
- /package/dist/{chunk-K6R5T44I.js.map → chunk-ZLYCOBHW.js.map} +0 -0
- /package/dist/{chunk-VADHIT26.js.map → chunk-ZNJ5MTXV.js.map} +0 -0
- /package/dist/{chunk-2KYQC4T5.js.map → chunk-ZSGY3H53.js.map} +0 -0
- /package/dist/{chunk-BKP43KK4.js.map → chunk-ZTPXACWB.js.map} +0 -0
- /package/dist/{chunk-JCY4CMDH.js.map → chunk-ZUA3JMI6.js.map} +0 -0
- /package/dist/{chunk-IGVVXLKJ.js.map → chunk-ZYAZUPPV.js.map} +0 -0
- /package/dist/{computer-viewer-LPZ763KF.js.map → computer-viewer-TDDO25AV.js.map} +0 -0
- /package/dist/{embedded-new-voice-YVMKSLKJ.js.map → embedded-new-voice-2G3VLPVQ.js.map} +0 -0
- /package/dist/{embedded-voice-BJPQFXSU.js.map → embedded-voice-T5IWOWGD.js.map} +0 -0
- /package/dist/{fleet-decision-row-AA4H5CDT.js.map → fleet-decision-row-WM64KXP3.js.map} +0 -0
- /package/dist/{model-policy-picker-menu-HSMWVO4P.js.map → model-policy-picker-menu-SMC6J6QN.js.map} +0 -0
- /package/dist/{payment-page-card-3LTSFJGN.js.map → payment-page-card-G4U63KUV.js.map} +0 -0
- /package/dist/{platform-activity-row-5VYV6TX4.js.map → platform-activity-row-BUZGZAKZ.js.map} +0 -0
- /package/dist/{queue-surface-implementation-NXHZUKD2.js.map → queue-surface-implementation-4KUZ4PJV.js.map} +0 -0
- /package/dist/{sandbox-files-YCMLQUFU.js.map → sandbox-files-ESDMOFSD.js.map} +0 -0
- /package/dist/{session-connect-cards-KSQLMRM5.js.map → session-connect-cards-Q53KMMYY.js.map} +0 -0
- /package/dist/{session-realtime-ZR6JLG3Y.js.map → session-realtime-CF3I35WJ.js.map} +0 -0
- /package/dist/{timeline-annotation-markers-YAHDPWVG.js.map → timeline-annotation-markers-CJK4RYZ4.js.map} +0 -0
- /package/dist/{timeline-annotation-selection-KHXNCEJP.js.map → timeline-annotation-selection-67GF5H26.js.map} +0 -0
- /package/dist/{timeline-annotations-dialog-Y4XD3N7B.js.map → timeline-annotations-dialog-ONJPQDJQ.js.map} +0 -0
|
@@ -0,0 +1,2984 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
InteractionInterventionBanner,
|
|
4
|
+
isInteractionControlUnavailable,
|
|
5
|
+
isNonRetryableInteractionError,
|
|
6
|
+
isSourcePlacementChangedError,
|
|
7
|
+
useInteractionInterventions,
|
|
8
|
+
useInteractionInvalidation,
|
|
9
|
+
useViewerMenuDismiss
|
|
10
|
+
} from "./chunk-O6N4ABCA.js";
|
|
11
|
+
import {
|
|
12
|
+
copyTextToClipboard
|
|
13
|
+
} from "./chunk-PEHTX3V7.js";
|
|
14
|
+
import {
|
|
15
|
+
usePageLiveActivity
|
|
16
|
+
} from "./chunk-RV3O5OCQ.js";
|
|
17
|
+
import {
|
|
18
|
+
DesktopViewer
|
|
19
|
+
} from "./chunk-Z4FMAFNH.js";
|
|
20
|
+
import {
|
|
21
|
+
STREAM_CLOSE_REASON_NORMAL,
|
|
22
|
+
STREAM_KIND_COMPUTER,
|
|
23
|
+
STREAM_ROLE_CLIENT,
|
|
24
|
+
decodeStreamFrame,
|
|
25
|
+
decodeStreamOpenAck,
|
|
26
|
+
encodeStreamClose,
|
|
27
|
+
encodeStreamOpen
|
|
28
|
+
} from "./chunk-TNEZNMSN.js";
|
|
29
|
+
import {
|
|
30
|
+
useEmbeddedComputerInteraction
|
|
31
|
+
} from "./chunk-TVQCDDSZ.js";
|
|
32
|
+
import {
|
|
33
|
+
cn
|
|
34
|
+
} from "./chunk-TXS65BB2.js";
|
|
35
|
+
import {
|
|
36
|
+
useOpenGeniText
|
|
37
|
+
} from "./chunk-7T2ZE3VT.js";
|
|
38
|
+
|
|
39
|
+
// src/components/computer-viewer.tsx
|
|
40
|
+
import { interactionControlFailureFromError } from "@opengeni/sdk/interaction";
|
|
41
|
+
import {
|
|
42
|
+
ChevronDownIcon,
|
|
43
|
+
CircleAlertIcon,
|
|
44
|
+
KeyboardIcon,
|
|
45
|
+
LoaderCircleIcon,
|
|
46
|
+
LockKeyholeIcon,
|
|
47
|
+
MonitorIcon,
|
|
48
|
+
MousePointer2Icon,
|
|
49
|
+
PanelsTopLeftIcon,
|
|
50
|
+
PlusIcon,
|
|
51
|
+
RefreshCwIcon,
|
|
52
|
+
RotateCcwIcon
|
|
53
|
+
} from "lucide-react";
|
|
54
|
+
import {
|
|
55
|
+
useCallback as useCallback5,
|
|
56
|
+
useEffect as useEffect5,
|
|
57
|
+
useLayoutEffect,
|
|
58
|
+
useMemo as useMemo2,
|
|
59
|
+
useRef as useRef5,
|
|
60
|
+
useState as useState5
|
|
61
|
+
} from "react";
|
|
62
|
+
|
|
63
|
+
// src/hooks/use-computer-frame-stream.ts
|
|
64
|
+
import {
|
|
65
|
+
computerFrameSocketUrl,
|
|
66
|
+
decodeComputerFrameMessage
|
|
67
|
+
} from "@opengeni/sdk/interaction";
|
|
68
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
69
|
+
import { errorMessage } from "@opengeni/contracts/values";
|
|
70
|
+
var RELAY_TAG_OPEN = 1;
|
|
71
|
+
var RELAY_TAG_OPEN_ACK = 2;
|
|
72
|
+
var RELAY_TAG_FRAME = 3;
|
|
73
|
+
var RELAY_TAG_CLOSE = 4;
|
|
74
|
+
var MAX_AUTOMATIC_RECONNECTS_WITHOUT_A_FRAME = 2;
|
|
75
|
+
function useComputerFrameStream(options) {
|
|
76
|
+
const t = useOpenGeniText();
|
|
77
|
+
const { client, workspaceId } = useEmbeddedComputerInteraction(options);
|
|
78
|
+
const enabled = options.enabled ?? true;
|
|
79
|
+
const [nonce, setNonce] = useState(0);
|
|
80
|
+
const [result, setResult] = useState({
|
|
81
|
+
state: "idle",
|
|
82
|
+
frame: null,
|
|
83
|
+
attachment: null,
|
|
84
|
+
error: null
|
|
85
|
+
});
|
|
86
|
+
const latestRef = useRef({
|
|
87
|
+
key: "",
|
|
88
|
+
sequence: -1
|
|
89
|
+
});
|
|
90
|
+
const factoryRef = useRef(options.webSocketFactory);
|
|
91
|
+
const streamRef = useRef(options.stream);
|
|
92
|
+
factoryRef.current = options.webSocketFactory;
|
|
93
|
+
streamRef.current = options.stream;
|
|
94
|
+
const reconnect = useCallback(() => setNonce((value) => value + 1), []);
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
const computerSessionId = options.computerSessionId;
|
|
97
|
+
const targetId = options.targetId;
|
|
98
|
+
if (!enabled || !computerSessionId || !targetId || typeof window === "undefined") {
|
|
99
|
+
setResult({ state: "idle", frame: null, attachment: null, error: null });
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
latestRef.current = { key: "", sequence: -1 };
|
|
103
|
+
setResult({
|
|
104
|
+
state: "attaching",
|
|
105
|
+
frame: null,
|
|
106
|
+
attachment: null,
|
|
107
|
+
error: null
|
|
108
|
+
});
|
|
109
|
+
let disposed = false;
|
|
110
|
+
let socket = null;
|
|
111
|
+
let socketHandlers = null;
|
|
112
|
+
let reconnectTimer = null;
|
|
113
|
+
let expiryTimer = null;
|
|
114
|
+
let failures = 0;
|
|
115
|
+
let controllerGeneration = null;
|
|
116
|
+
let activeAttachment = null;
|
|
117
|
+
let activeStream = null;
|
|
118
|
+
let attachmentExpiresAt = 0;
|
|
119
|
+
let lastRelaySequence = null;
|
|
120
|
+
let relayAccepted = false;
|
|
121
|
+
let pendingFrame = null;
|
|
122
|
+
let decodingFrame = false;
|
|
123
|
+
const attachmentAbort = new AbortController();
|
|
124
|
+
const clearSocket = (terminateProducer = false) => {
|
|
125
|
+
if (!socket) return;
|
|
126
|
+
const current = socket;
|
|
127
|
+
const handlers = socketHandlers;
|
|
128
|
+
if (terminateProducer && activeStream?.kind === "relay" && socket.readyState === 1) {
|
|
129
|
+
try {
|
|
130
|
+
socket.send(
|
|
131
|
+
relayDatagram(
|
|
132
|
+
RELAY_TAG_CLOSE,
|
|
133
|
+
encodeStreamClose({
|
|
134
|
+
channelId: activeStream.channel.channelId,
|
|
135
|
+
reason: STREAM_CLOSE_REASON_NORMAL,
|
|
136
|
+
message: "viewer detached"
|
|
137
|
+
})
|
|
138
|
+
)
|
|
139
|
+
);
|
|
140
|
+
} catch {
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (handlers) {
|
|
144
|
+
current.removeEventListener("open", handlers.open);
|
|
145
|
+
current.removeEventListener("message", handlers.message);
|
|
146
|
+
current.removeEventListener("error", handlers.error);
|
|
147
|
+
current.removeEventListener("close", handlers.close);
|
|
148
|
+
}
|
|
149
|
+
if (current.readyState === 0 || current.readyState === 1) {
|
|
150
|
+
current.close(1e3, "viewer detached");
|
|
151
|
+
}
|
|
152
|
+
socket = null;
|
|
153
|
+
socketHandlers = null;
|
|
154
|
+
pendingFrame = null;
|
|
155
|
+
};
|
|
156
|
+
const clearRecoveryTimers = () => {
|
|
157
|
+
if (reconnectTimer) clearTimeout(reconnectTimer);
|
|
158
|
+
if (expiryTimer) clearTimeout(expiryTimer);
|
|
159
|
+
reconnectTimer = null;
|
|
160
|
+
expiryTimer = null;
|
|
161
|
+
};
|
|
162
|
+
const scheduleReconnect = () => {
|
|
163
|
+
if (disposed || reconnectTimer) return;
|
|
164
|
+
if (failures >= MAX_AUTOMATIC_RECONNECTS_WITHOUT_A_FRAME) {
|
|
165
|
+
clearRecoveryTimers();
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const delay = Math.min(5e3, 250 * 2 ** Math.min(failures, 5));
|
|
169
|
+
failures += 1;
|
|
170
|
+
setResult((current) => ({ ...current, state: "reconnecting" }));
|
|
171
|
+
reconnectTimer = setTimeout(() => {
|
|
172
|
+
reconnectTimer = null;
|
|
173
|
+
connectSocket();
|
|
174
|
+
}, delay);
|
|
175
|
+
};
|
|
176
|
+
const fail = (cause, reconnectAutomatically = true) => {
|
|
177
|
+
if (disposed) return;
|
|
178
|
+
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
179
|
+
setResult((current) => ({ ...current, state: "error", error }));
|
|
180
|
+
clearSocket();
|
|
181
|
+
if (reconnectAutomatically) scheduleReconnect();
|
|
182
|
+
else clearRecoveryTimers();
|
|
183
|
+
};
|
|
184
|
+
const onOpen = (source) => {
|
|
185
|
+
if (disposed || source !== socket) return;
|
|
186
|
+
if (activeStream?.kind === "relay") {
|
|
187
|
+
const body = encodeStreamOpen({
|
|
188
|
+
channel: { ...activeStream.channel, kind: STREAM_KIND_COMPUTER },
|
|
189
|
+
token: activeStream.token,
|
|
190
|
+
role: STREAM_ROLE_CLIENT,
|
|
191
|
+
resumeFromSeq: lastRelaySequence === null ? "0" : (BigInt(lastRelaySequence) + 1n).toString()
|
|
192
|
+
});
|
|
193
|
+
try {
|
|
194
|
+
source.send(relayDatagram(RELAY_TAG_OPEN, body));
|
|
195
|
+
} catch (error) {
|
|
196
|
+
fail(error);
|
|
197
|
+
}
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
setResult((current) => ({ ...current, state: "live", error: null }));
|
|
201
|
+
};
|
|
202
|
+
const drainLatestFrame = async () => {
|
|
203
|
+
if (decodingFrame) return;
|
|
204
|
+
decodingFrame = true;
|
|
205
|
+
try {
|
|
206
|
+
while (pendingFrame) {
|
|
207
|
+
if (disposed) break;
|
|
208
|
+
const pending = pendingFrame;
|
|
209
|
+
pendingFrame = null;
|
|
210
|
+
const { bytes, source } = pending;
|
|
211
|
+
const frame = await decodeComputerFrameMessage(bytes);
|
|
212
|
+
if (disposed || source !== socket) continue;
|
|
213
|
+
if (frame.computerSessionId !== computerSessionId || frame.targetId !== targetId) {
|
|
214
|
+
throw new Error("desktop frame belongs to another resource");
|
|
215
|
+
}
|
|
216
|
+
if (!controllerGeneration || frame.controllerGeneration !== controllerGeneration) {
|
|
217
|
+
throw new Error("desktop frame belongs to a stale controller");
|
|
218
|
+
}
|
|
219
|
+
const key = `${computerSessionId}:${targetId}:${frame.controllerGeneration}:${frame.targetGeneration}`;
|
|
220
|
+
if (latestRef.current.key === key && frame.sequence <= latestRef.current.sequence)
|
|
221
|
+
continue;
|
|
222
|
+
latestRef.current = { key, sequence: frame.sequence };
|
|
223
|
+
failures = 0;
|
|
224
|
+
setResult((current) => ({
|
|
225
|
+
...current,
|
|
226
|
+
state: "live",
|
|
227
|
+
frame,
|
|
228
|
+
error: null
|
|
229
|
+
}));
|
|
230
|
+
}
|
|
231
|
+
} catch (cause) {
|
|
232
|
+
fail(cause);
|
|
233
|
+
} finally {
|
|
234
|
+
decodingFrame = false;
|
|
235
|
+
if (!disposed && pendingFrame) void drainLatestFrame();
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
const onMessage = (source, event) => {
|
|
239
|
+
void (async () => {
|
|
240
|
+
try {
|
|
241
|
+
const bytes = await messageBytes(event.data);
|
|
242
|
+
if (disposed || source !== socket) return;
|
|
243
|
+
let frameBytes = bytes;
|
|
244
|
+
if (activeStream?.kind === "relay") {
|
|
245
|
+
if (bytes.length < 1) throw new Error("desktop relay returned an empty message");
|
|
246
|
+
const tag = bytes[0];
|
|
247
|
+
const body = bytes.subarray(1);
|
|
248
|
+
if (tag === RELAY_TAG_OPEN_ACK) {
|
|
249
|
+
const ack = decodeStreamOpenAck(body);
|
|
250
|
+
if (!ack.accepted) {
|
|
251
|
+
activeAttachment = null;
|
|
252
|
+
activeStream = null;
|
|
253
|
+
attachmentExpiresAt = 0;
|
|
254
|
+
throw new Error(ack.error?.message ?? "desktop stream was rejected by the relay");
|
|
255
|
+
}
|
|
256
|
+
relayAccepted = true;
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
if (tag === RELAY_TAG_CLOSE) {
|
|
260
|
+
activeAttachment = null;
|
|
261
|
+
activeStream = null;
|
|
262
|
+
attachmentExpiresAt = 0;
|
|
263
|
+
lastRelaySequence = null;
|
|
264
|
+
relayAccepted = false;
|
|
265
|
+
fail(new Error("Desktop frame source ended."), false);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
if (tag !== RELAY_TAG_FRAME || !relayAccepted) return;
|
|
269
|
+
const relayFrame = decodeStreamFrame(body);
|
|
270
|
+
lastRelaySequence = relayFrame.seq;
|
|
271
|
+
frameBytes = relayFrame.data;
|
|
272
|
+
}
|
|
273
|
+
pendingFrame = { bytes: frameBytes, source };
|
|
274
|
+
void drainLatestFrame();
|
|
275
|
+
} catch (cause) {
|
|
276
|
+
fail(cause);
|
|
277
|
+
}
|
|
278
|
+
})();
|
|
279
|
+
};
|
|
280
|
+
const onError = (source) => {
|
|
281
|
+
if (source !== socket) return;
|
|
282
|
+
fail(new Error(t("hooks.useComputerFrameStream.desktopViewLostConnection")));
|
|
283
|
+
};
|
|
284
|
+
const onClose = (source) => {
|
|
285
|
+
if (disposed || source !== socket) return;
|
|
286
|
+
fail(new Error(t("hooks.useComputerFrameStream.desktopViewLostConnection")));
|
|
287
|
+
};
|
|
288
|
+
const connectSocket = () => {
|
|
289
|
+
if (disposed) return;
|
|
290
|
+
clearSocket();
|
|
291
|
+
if (!activeAttachment || !activeStream || attachmentExpiresAt <= Date.now() + 1e3) {
|
|
292
|
+
void attach();
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (activeStream.kind === "direct_rfb") {
|
|
296
|
+
setResult((current) => ({ ...current, state: "live", error: null }));
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
relayAccepted = false;
|
|
300
|
+
setResult((current) => ({
|
|
301
|
+
...current,
|
|
302
|
+
state: "connecting",
|
|
303
|
+
error: null
|
|
304
|
+
}));
|
|
305
|
+
const createSocket = factoryRef.current ?? ((url, protocols) => new WebSocket(url, protocols));
|
|
306
|
+
const openedSocket = createSocket(
|
|
307
|
+
activeStream.kind === "relay" ? activeStream.url : computerFrameSocketUrl(activeAttachment, streamRef.current),
|
|
308
|
+
activeStream.kind === "direct_websocket" ? [...activeStream.protocols] : []
|
|
309
|
+
);
|
|
310
|
+
socket = openedSocket;
|
|
311
|
+
socketHandlers = {
|
|
312
|
+
open: () => onOpen(openedSocket),
|
|
313
|
+
message: (event) => onMessage(openedSocket, event),
|
|
314
|
+
error: () => onError(openedSocket),
|
|
315
|
+
close: () => onClose(openedSocket)
|
|
316
|
+
};
|
|
317
|
+
openedSocket.binaryType = "arraybuffer";
|
|
318
|
+
openedSocket.addEventListener("open", socketHandlers.open);
|
|
319
|
+
openedSocket.addEventListener("message", socketHandlers.message);
|
|
320
|
+
openedSocket.addEventListener("error", socketHandlers.error);
|
|
321
|
+
openedSocket.addEventListener("close", socketHandlers.close);
|
|
322
|
+
};
|
|
323
|
+
const attach = async () => {
|
|
324
|
+
if (disposed) return;
|
|
325
|
+
clearSocket();
|
|
326
|
+
if (expiryTimer) clearTimeout(expiryTimer);
|
|
327
|
+
setResult((current) => ({
|
|
328
|
+
...current,
|
|
329
|
+
state: current.attachment ? "reconnecting" : "attaching",
|
|
330
|
+
error: null
|
|
331
|
+
}));
|
|
332
|
+
try {
|
|
333
|
+
const attachment = await client.attachComputerSession(
|
|
334
|
+
workspaceId,
|
|
335
|
+
computerSessionId,
|
|
336
|
+
{
|
|
337
|
+
targetId,
|
|
338
|
+
expiresInSeconds: 120,
|
|
339
|
+
...streamRef.current ? { stream: streamRef.current } : {}
|
|
340
|
+
},
|
|
341
|
+
{ signal: attachmentAbort.signal, timeoutMs: 15e3 }
|
|
342
|
+
);
|
|
343
|
+
if (disposed) return;
|
|
344
|
+
if (attachment.computerSessionId !== computerSessionId || attachment.targetId !== targetId) {
|
|
345
|
+
throw new Error("desktop attachment does not match the requested resource");
|
|
346
|
+
}
|
|
347
|
+
controllerGeneration = attachment.controllerGeneration;
|
|
348
|
+
latestRef.current = { key: "", sequence: -1 };
|
|
349
|
+
activeAttachment = attachment;
|
|
350
|
+
activeStream = attachment.stream;
|
|
351
|
+
attachmentExpiresAt = Date.parse(attachment.expiresAt);
|
|
352
|
+
lastRelaySequence = null;
|
|
353
|
+
relayAccepted = false;
|
|
354
|
+
setResult((current) => ({
|
|
355
|
+
...current,
|
|
356
|
+
state: "connecting",
|
|
357
|
+
attachment: {
|
|
358
|
+
computerSessionId: attachment.computerSessionId,
|
|
359
|
+
controllerGeneration: attachment.controllerGeneration,
|
|
360
|
+
targetId: attachment.targetId,
|
|
361
|
+
inputAllowed: attachment.inputAllowed,
|
|
362
|
+
stream: attachment.stream,
|
|
363
|
+
expiresAt: attachment.expiresAt
|
|
364
|
+
},
|
|
365
|
+
error: null
|
|
366
|
+
}));
|
|
367
|
+
const refreshIn = Number.isFinite(attachmentExpiresAt) ? Math.max(1e3, attachmentExpiresAt - Date.now() - 5e3) : 6e4;
|
|
368
|
+
expiryTimer = setTimeout(() => {
|
|
369
|
+
if (disposed) return;
|
|
370
|
+
clearSocket(true);
|
|
371
|
+
activeAttachment = null;
|
|
372
|
+
activeStream = null;
|
|
373
|
+
attachmentExpiresAt = 0;
|
|
374
|
+
void attach();
|
|
375
|
+
}, refreshIn);
|
|
376
|
+
connectSocket();
|
|
377
|
+
} catch (cause) {
|
|
378
|
+
if (attachmentAbort.signal.aborted || disposed) return;
|
|
379
|
+
fail(cause, !isPlacementGenerationLossError(cause));
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
void attach();
|
|
383
|
+
return () => {
|
|
384
|
+
disposed = true;
|
|
385
|
+
pendingFrame = null;
|
|
386
|
+
attachmentAbort.abort();
|
|
387
|
+
clearRecoveryTimers();
|
|
388
|
+
clearSocket(true);
|
|
389
|
+
};
|
|
390
|
+
}, [client, enabled, nonce, options.computerSessionId, options.targetId, workspaceId, t]);
|
|
391
|
+
return { ...result, reconnect };
|
|
392
|
+
}
|
|
393
|
+
function relayDatagram(tag, body) {
|
|
394
|
+
const message = new Uint8Array(body.length + 1);
|
|
395
|
+
message[0] = tag;
|
|
396
|
+
message.set(body, 1);
|
|
397
|
+
return message.buffer;
|
|
398
|
+
}
|
|
399
|
+
async function messageBytes(value) {
|
|
400
|
+
if (value instanceof ArrayBuffer) return new Uint8Array(value);
|
|
401
|
+
if (ArrayBuffer.isView(value)) {
|
|
402
|
+
return new Uint8Array(value.buffer, value.byteOffset, value.byteLength).slice();
|
|
403
|
+
}
|
|
404
|
+
if (typeof Blob !== "undefined" && value instanceof Blob) {
|
|
405
|
+
return new Uint8Array(await value.arrayBuffer());
|
|
406
|
+
}
|
|
407
|
+
throw new Error("desktop frame stream returned a non-binary message");
|
|
408
|
+
}
|
|
409
|
+
function isPlacementGenerationLossError(cause) {
|
|
410
|
+
const message = errorMessage(cause);
|
|
411
|
+
return /placement instance changed|controller authority changed/i.test(message);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// src/hooks/use-computer-session.ts
|
|
415
|
+
import { useCallback as useCallback2, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
416
|
+
var actionResultFences = /* @__PURE__ */ new WeakMap();
|
|
417
|
+
function isStaleComputerActionResult(value) {
|
|
418
|
+
return typeof value === "object" && value !== null && actionResultFences.get(value)?.() === false;
|
|
419
|
+
}
|
|
420
|
+
function computerActionReceiptError(t, receipt) {
|
|
421
|
+
const error = new Error(
|
|
422
|
+
receipt.error?.message ?? t("hooks.useComputerSession.desktopInputDidNotComplete")
|
|
423
|
+
);
|
|
424
|
+
const fence = actionResultFences.get(receipt);
|
|
425
|
+
if (fence) actionResultFences.set(error, fence);
|
|
426
|
+
return error;
|
|
427
|
+
}
|
|
428
|
+
function useComputerSession(options) {
|
|
429
|
+
const t = useOpenGeniText();
|
|
430
|
+
const { client, workspaceId } = useEmbeddedComputerInteraction(options);
|
|
431
|
+
const computerSessionId = options.computerSessionId;
|
|
432
|
+
const enabled = (options.enabled ?? true) && computerSessionId !== null;
|
|
433
|
+
const sourceRef = useRef2({
|
|
434
|
+
client,
|
|
435
|
+
workspaceId,
|
|
436
|
+
computerSessionId,
|
|
437
|
+
enabled
|
|
438
|
+
});
|
|
439
|
+
if (sourceRef.current.client !== client || sourceRef.current.workspaceId !== workspaceId || sourceRef.current.computerSessionId !== computerSessionId || sourceRef.current.enabled !== enabled) {
|
|
440
|
+
sourceRef.current = { client, workspaceId, computerSessionId, enabled };
|
|
441
|
+
}
|
|
442
|
+
const source = sourceRef.current;
|
|
443
|
+
const pageLive = usePageLiveActivity();
|
|
444
|
+
const pollIntervalMs = Math.max(750, options.pollIntervalMs ?? 2e3);
|
|
445
|
+
const [state, setState] = useState2(() => emptyState(source, enabled));
|
|
446
|
+
const visible = state.source === source ? state : emptyState(source, enabled);
|
|
447
|
+
const refreshBlocked = isNonRetryableInteractionError(visible.error);
|
|
448
|
+
const selectedTargetIdRef = useRef2(visible.selectedTargetId);
|
|
449
|
+
selectedTargetIdRef.current = visible.selectedTargetId;
|
|
450
|
+
const selectionRevisionRef = useRef2(0);
|
|
451
|
+
const actionResultOrderRef = useRef2({ next: 0, settled: 0 });
|
|
452
|
+
const targetsRef = useRef2({
|
|
453
|
+
source,
|
|
454
|
+
computerSessionId,
|
|
455
|
+
targets: visible.targets
|
|
456
|
+
});
|
|
457
|
+
const observationRef = useRef2({ source, computerSessionId, observation: visible.observation });
|
|
458
|
+
if (targetsRef.current.source !== source) {
|
|
459
|
+
targetsRef.current = { source, computerSessionId, targets: visible.targets };
|
|
460
|
+
observationRef.current = {
|
|
461
|
+
source,
|
|
462
|
+
computerSessionId,
|
|
463
|
+
observation: visible.observation
|
|
464
|
+
};
|
|
465
|
+
} else {
|
|
466
|
+
targetsRef.current.targets = visible.targets;
|
|
467
|
+
observationRef.current.observation = visible.observation;
|
|
468
|
+
}
|
|
469
|
+
const requestRef = useRef2({
|
|
470
|
+
id: 0,
|
|
471
|
+
controller: null
|
|
472
|
+
});
|
|
473
|
+
const mutationRef = useRef2({
|
|
474
|
+
computerSessionId,
|
|
475
|
+
source,
|
|
476
|
+
count: 0
|
|
477
|
+
});
|
|
478
|
+
const mountedRef = useRef2(true);
|
|
479
|
+
const isCurrentSource = useCallback2(
|
|
480
|
+
() => mountedRef.current && sourceRef.current === source,
|
|
481
|
+
[source]
|
|
482
|
+
);
|
|
483
|
+
const invalidateRefresh = useCallback2(() => {
|
|
484
|
+
const id = requestRef.current.id + 1;
|
|
485
|
+
requestRef.current.controller?.abort();
|
|
486
|
+
requestRef.current = { id, controller: null };
|
|
487
|
+
}, []);
|
|
488
|
+
const refresh = useCallback2(async () => {
|
|
489
|
+
if (!enabled || !computerSessionId || !isCurrentSource()) return;
|
|
490
|
+
const id = requestRef.current.id + 1;
|
|
491
|
+
requestRef.current.controller?.abort();
|
|
492
|
+
const controller = new AbortController();
|
|
493
|
+
requestRef.current = { id, controller };
|
|
494
|
+
let discoveryCompleted = false;
|
|
495
|
+
try {
|
|
496
|
+
const [session, targetResponse] = await Promise.all([
|
|
497
|
+
client.getComputerSession(workspaceId, computerSessionId, {
|
|
498
|
+
signal: controller.signal
|
|
499
|
+
}),
|
|
500
|
+
client.listComputerTargets(workspaceId, computerSessionId, {
|
|
501
|
+
signal: controller.signal
|
|
502
|
+
})
|
|
503
|
+
]);
|
|
504
|
+
discoveryCompleted = true;
|
|
505
|
+
if (!isCurrentSource() || requestRef.current.id !== id) return;
|
|
506
|
+
const targets = sortComputerTargets(targetResponse.targets);
|
|
507
|
+
const selected = chooseTarget(targets, selectedTargetIdRef.current);
|
|
508
|
+
const selectedId = selected?.id ?? selectedTargetIdRef.current;
|
|
509
|
+
const previous = observationRef.current.source === source ? observationRef.current.observation : null;
|
|
510
|
+
const retainedObservation = selected && previous?.target.id === selected.id && previous.target.controllerGeneration === selected.controllerGeneration && previous.target.targetGeneration === selected.targetGeneration ? previous : null;
|
|
511
|
+
selectedTargetIdRef.current = selectedId;
|
|
512
|
+
targetsRef.current = { source, computerSessionId, targets };
|
|
513
|
+
observationRef.current = { source, computerSessionId, observation: retainedObservation };
|
|
514
|
+
setState(
|
|
515
|
+
(current) => isCurrentSource() && current.source === source && current.computerSessionId === computerSessionId ? {
|
|
516
|
+
...current,
|
|
517
|
+
session,
|
|
518
|
+
targets,
|
|
519
|
+
selectedTargetId: selectedId,
|
|
520
|
+
observation: retainedObservation,
|
|
521
|
+
loading: false,
|
|
522
|
+
error: null,
|
|
523
|
+
controlError: null
|
|
524
|
+
} : current
|
|
525
|
+
);
|
|
526
|
+
const observation = selected ? await client.observeComputerTarget(workspaceId, computerSessionId, selected.id, {
|
|
527
|
+
signal: controller.signal
|
|
528
|
+
}) : null;
|
|
529
|
+
if (!isCurrentSource() || requestRef.current.id !== id) return;
|
|
530
|
+
selectedTargetIdRef.current = selectedId;
|
|
531
|
+
targetsRef.current = { source, computerSessionId, targets };
|
|
532
|
+
observationRef.current = { source, computerSessionId, observation };
|
|
533
|
+
setState(
|
|
534
|
+
(current) => isCurrentSource() && current.source === source && current.computerSessionId === computerSessionId ? {
|
|
535
|
+
...current,
|
|
536
|
+
session,
|
|
537
|
+
targets,
|
|
538
|
+
selectedTargetId: selectedId,
|
|
539
|
+
observation,
|
|
540
|
+
loading: false,
|
|
541
|
+
error: null
|
|
542
|
+
} : current
|
|
543
|
+
);
|
|
544
|
+
} catch (cause) {
|
|
545
|
+
if (controller.signal.aborted || !isCurrentSource() || requestRef.current.id !== id) return;
|
|
546
|
+
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
547
|
+
setState(
|
|
548
|
+
(current) => isCurrentSource() && current.source === source && current.computerSessionId === computerSessionId ? {
|
|
549
|
+
...current,
|
|
550
|
+
loading: false,
|
|
551
|
+
error,
|
|
552
|
+
controlError: isInteractionControlUnavailable(
|
|
553
|
+
error,
|
|
554
|
+
discoveryCompleted ? "observation" : "control"
|
|
555
|
+
) ? error : current.controlError
|
|
556
|
+
} : current
|
|
557
|
+
);
|
|
558
|
+
} finally {
|
|
559
|
+
if (requestRef.current.id === id) requestRef.current = { id, controller: null };
|
|
560
|
+
}
|
|
561
|
+
}, [client, computerSessionId, enabled, isCurrentSource, source, workspaceId]);
|
|
562
|
+
useEffect2(() => {
|
|
563
|
+
mountedRef.current = true;
|
|
564
|
+
if (!enabled) {
|
|
565
|
+
invalidateRefresh();
|
|
566
|
+
setState(emptyState(source, false));
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
setState(
|
|
570
|
+
(current) => current.source === source ? {
|
|
571
|
+
...current,
|
|
572
|
+
loading: true,
|
|
573
|
+
mutating: mutationRef.current.source === source && mutationRef.current.count > 0
|
|
574
|
+
} : emptyState(source, true)
|
|
575
|
+
);
|
|
576
|
+
void refresh();
|
|
577
|
+
return () => {
|
|
578
|
+
mountedRef.current = false;
|
|
579
|
+
invalidateRefresh();
|
|
580
|
+
};
|
|
581
|
+
}, [computerSessionId, enabled, invalidateRefresh, refresh, source]);
|
|
582
|
+
useEffect2(() => {
|
|
583
|
+
if (!enabled || !pageLive || visible.mutating || refreshBlocked) return;
|
|
584
|
+
const timer = setInterval(() => {
|
|
585
|
+
if (!requestRef.current.controller) void refresh();
|
|
586
|
+
}, pollIntervalMs);
|
|
587
|
+
return () => clearInterval(timer);
|
|
588
|
+
}, [enabled, pageLive, pollIntervalMs, refresh, refreshBlocked, visible.mutating]);
|
|
589
|
+
useEffect2(() => {
|
|
590
|
+
if (!enabled || !computerSessionId || !pageLive || refreshBlocked) return;
|
|
591
|
+
let disposed = false;
|
|
592
|
+
const timer = setInterval(() => {
|
|
593
|
+
void client.heartbeatComputerSession(workspaceId, computerSessionId).catch(() => {
|
|
594
|
+
if (!disposed) void refresh();
|
|
595
|
+
});
|
|
596
|
+
}, 3e4);
|
|
597
|
+
return () => {
|
|
598
|
+
disposed = true;
|
|
599
|
+
clearInterval(timer);
|
|
600
|
+
};
|
|
601
|
+
}, [client, computerSessionId, enabled, pageLive, refresh, refreshBlocked, workspaceId]);
|
|
602
|
+
const runMutation = useCallback2(
|
|
603
|
+
async (scopeComputerSessionId, operation) => {
|
|
604
|
+
if (!isCurrentSource()) throw new Error(t("hooks.useComputerSession.theDesktopSourceIsNo"));
|
|
605
|
+
invalidateRefresh();
|
|
606
|
+
if (mutationRef.current.computerSessionId !== scopeComputerSessionId || mutationRef.current.source !== source) {
|
|
607
|
+
mutationRef.current = {
|
|
608
|
+
computerSessionId: scopeComputerSessionId,
|
|
609
|
+
source,
|
|
610
|
+
count: 0
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
mutationRef.current.count += 1;
|
|
614
|
+
setState(
|
|
615
|
+
(current) => isCurrentSource() && current.source === source && current.computerSessionId === scopeComputerSessionId ? { ...current, mutating: true, error: null } : current
|
|
616
|
+
);
|
|
617
|
+
try {
|
|
618
|
+
return await operation();
|
|
619
|
+
} finally {
|
|
620
|
+
if (mutationRef.current.computerSessionId === scopeComputerSessionId && mutationRef.current.source === source) {
|
|
621
|
+
mutationRef.current.count = Math.max(0, mutationRef.current.count - 1);
|
|
622
|
+
const mutating = mutationRef.current.count > 0;
|
|
623
|
+
setState(
|
|
624
|
+
(current) => isCurrentSource() && current.source === source && current.computerSessionId === scopeComputerSessionId ? { ...current, mutating } : current
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
},
|
|
629
|
+
[invalidateRefresh, isCurrentSource, source, t]
|
|
630
|
+
);
|
|
631
|
+
const selectTarget = useCallback2(
|
|
632
|
+
async (targetId) => {
|
|
633
|
+
if (!computerSessionId) throw new Error(t("hooks.useComputerSession.noDesktopIsSelected"));
|
|
634
|
+
if (!isCurrentSource()) throw new Error(t("hooks.useComputerSession.theDesktopSourceIsNo"));
|
|
635
|
+
const target = targetsRef.current.source === source ? targetsRef.current.targets.find((candidate) => candidate.id === targetId) : null;
|
|
636
|
+
if (!target) throw new Error(t("hooks.useComputerSession.theSelectedDesktopTargetIs"));
|
|
637
|
+
invalidateRefresh();
|
|
638
|
+
const readRequestId = requestRef.current.id;
|
|
639
|
+
const selectionRevision = ++selectionRevisionRef.current;
|
|
640
|
+
const isCurrentSelection = () => isCurrentSource() && selectionRevisionRef.current === selectionRevision;
|
|
641
|
+
const isCurrentSelectionRead = () => isCurrentSelection() && requestRef.current.id === readRequestId;
|
|
642
|
+
selectedTargetIdRef.current = target.id;
|
|
643
|
+
observationRef.current = { source, computerSessionId, observation: null };
|
|
644
|
+
setState(
|
|
645
|
+
(current) => isCurrentSelection() && current.source === source && current.computerSessionId === computerSessionId ? {
|
|
646
|
+
...current,
|
|
647
|
+
selectedTargetId: target.id,
|
|
648
|
+
observation: null,
|
|
649
|
+
loading: true,
|
|
650
|
+
error: null
|
|
651
|
+
} : current
|
|
652
|
+
);
|
|
653
|
+
try {
|
|
654
|
+
const observation = await client.observeComputerTarget(
|
|
655
|
+
workspaceId,
|
|
656
|
+
computerSessionId,
|
|
657
|
+
target.id
|
|
658
|
+
);
|
|
659
|
+
if (!isCurrentSelectionRead() || selectedTargetIdRef.current !== target.id) return target;
|
|
660
|
+
observationRef.current = { source, computerSessionId, observation };
|
|
661
|
+
setState(
|
|
662
|
+
(current) => isCurrentSelection() && current.source === source && current.computerSessionId === computerSessionId && current.selectedTargetId === target.id ? { ...current, observation, loading: false, error: null } : current
|
|
663
|
+
);
|
|
664
|
+
return observation.target;
|
|
665
|
+
} catch (cause) {
|
|
666
|
+
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
667
|
+
if (isCurrentSelectionRead()) {
|
|
668
|
+
setState(
|
|
669
|
+
(current) => isCurrentSelection() && current.source === source && current.computerSessionId === computerSessionId && current.selectedTargetId === target.id ? {
|
|
670
|
+
...current,
|
|
671
|
+
loading: false,
|
|
672
|
+
error,
|
|
673
|
+
controlError: isInteractionControlUnavailable(error, "observation") ? error : current.controlError
|
|
674
|
+
} : current
|
|
675
|
+
);
|
|
676
|
+
}
|
|
677
|
+
throw error;
|
|
678
|
+
}
|
|
679
|
+
},
|
|
680
|
+
[client, computerSessionId, invalidateRefresh, isCurrentSource, source, workspaceId, t]
|
|
681
|
+
);
|
|
682
|
+
const dispatchAction = useCallback2(
|
|
683
|
+
async (action, operationId, frame) => {
|
|
684
|
+
if (!computerSessionId) throw new Error(t("hooks.useComputerSession.noDesktopIsSelected"));
|
|
685
|
+
if (!isCurrentSource()) throw new Error(t("hooks.useComputerSession.theDesktopSourceIsNo"));
|
|
686
|
+
if (frame && frame.computerSessionId !== computerSessionId) {
|
|
687
|
+
throw new Error("The displayed desktop frame belongs to another desktop session.");
|
|
688
|
+
}
|
|
689
|
+
const currentObservation = observationRef.current.source === source && observationRef.current.computerSessionId === computerSessionId ? observationRef.current.observation : null;
|
|
690
|
+
const focusTarget = action.type === "focus" && targetsRef.current.source === source ? targetsRef.current.targets.find((candidate) => candidate.id === action.targetId) ?? null : null;
|
|
691
|
+
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;
|
|
692
|
+
const inputTarget = (action.type === "keyboard" || action.type === "clipboard") && targetsRef.current.source === source && targetsRef.current.computerSessionId === computerSessionId ? targetsRef.current.targets.find(
|
|
693
|
+
(candidate) => candidate.id === selectedTargetIdRef.current
|
|
694
|
+
) : null;
|
|
695
|
+
const target = frameTarget ?? focusTarget ?? currentObservation?.target ?? inputTarget ?? null;
|
|
696
|
+
if (!target) throw new Error("The desktop target is not ready for input.");
|
|
697
|
+
if (frame && frame.targetId !== selectedTargetIdRef.current) {
|
|
698
|
+
throw new Error(t("hooks.useComputerSession.theDisplayedDesktopFrameIs"));
|
|
699
|
+
}
|
|
700
|
+
if (frame && (frame.controllerGeneration !== target.controllerGeneration || frame.targetGeneration !== target.targetGeneration)) {
|
|
701
|
+
throw new Error("The displayed desktop frame belongs to an earlier target generation.");
|
|
702
|
+
}
|
|
703
|
+
if (action.type === "pointer") {
|
|
704
|
+
const expectedFrameId = frame?.frameId ?? currentObservation?.frameId ?? null;
|
|
705
|
+
if (!expectedFrameId || action.frameId !== expectedFrameId) {
|
|
706
|
+
throw new Error("Pointer input must reference the exact displayed desktop frame.");
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
if (action.type === "semantic" && !currentObservation) {
|
|
710
|
+
throw new Error("The desktop accessibility tree is not ready for input.");
|
|
711
|
+
}
|
|
712
|
+
const selectedTargetId = selectedTargetIdRef.current;
|
|
713
|
+
const selectedTarget = targetsRef.current.targets.find(
|
|
714
|
+
(candidate) => candidate.id === selectedTargetId
|
|
715
|
+
);
|
|
716
|
+
const selectedFence = selectedTarget && {
|
|
717
|
+
id: selectedTarget.id,
|
|
718
|
+
computerSessionId: selectedTarget.computerSessionId,
|
|
719
|
+
controllerGeneration: selectedTarget.controllerGeneration,
|
|
720
|
+
targetGeneration: selectedTarget.targetGeneration
|
|
721
|
+
};
|
|
722
|
+
const selectionRevision = selectionRevisionRef.current;
|
|
723
|
+
const isCurrentView = () => isCurrentSource() && selectionRevisionRef.current === selectionRevision && selectedTargetIdRef.current === selectedTargetId && targetsRef.current.source === source && targetsRef.current.computerSessionId === computerSessionId && sameTargetFence(
|
|
724
|
+
selectedFence,
|
|
725
|
+
targetsRef.current.targets.find((candidate) => candidate.id === selectedTargetId)
|
|
726
|
+
);
|
|
727
|
+
const resultOrder = ++actionResultOrderRef.current.next;
|
|
728
|
+
let admitted = false;
|
|
729
|
+
let resultTargetId = selectedTargetId;
|
|
730
|
+
let resultFence = selectedFence;
|
|
731
|
+
const isCurrentResultView = () => isCurrentSource() && selectionRevisionRef.current === selectionRevision && selectedTargetIdRef.current === resultTargetId && targetsRef.current.source === source && sameTargetFence(
|
|
732
|
+
resultFence,
|
|
733
|
+
targetsRef.current.targets.find((candidate) => candidate.id === resultTargetId)
|
|
734
|
+
);
|
|
735
|
+
const canProjectResult = () => {
|
|
736
|
+
if (!admitted) {
|
|
737
|
+
if (!isCurrentView() || resultOrder < actionResultOrderRef.current.settled) return false;
|
|
738
|
+
actionResultOrderRef.current.settled = resultOrder;
|
|
739
|
+
admitted = true;
|
|
740
|
+
invalidateRefresh();
|
|
741
|
+
}
|
|
742
|
+
return isCurrentResultView() && resultOrder === actionResultOrderRef.current.settled;
|
|
743
|
+
};
|
|
744
|
+
const projectState = (update) => {
|
|
745
|
+
setState(
|
|
746
|
+
(current) => admitted && isCurrentResultView() && current.source === source && current.computerSessionId === computerSessionId && current.actionResultOrder <= resultOrder ? { ...update(current), actionResultOrder: resultOrder } : current
|
|
747
|
+
);
|
|
748
|
+
};
|
|
749
|
+
return await runMutation(computerSessionId, async () => {
|
|
750
|
+
try {
|
|
751
|
+
const receipt = await client.actInComputer(workspaceId, computerSessionId, {
|
|
752
|
+
operationId,
|
|
753
|
+
targetId: target.id,
|
|
754
|
+
expectedTargetGeneration: frame?.targetGeneration ?? target.targetGeneration,
|
|
755
|
+
expectedObservationId: action.type === "pointer" ? null : currentObservation?.observationId ?? null,
|
|
756
|
+
expectedFrameId: action.type === "pointer" ? action.frameId : null,
|
|
757
|
+
action
|
|
758
|
+
});
|
|
759
|
+
const receiptSettled = receipt.state === "completed" || receipt.state === "failed" || receipt.state === "outcome_unknown";
|
|
760
|
+
actionResultFences.set(
|
|
761
|
+
receipt,
|
|
762
|
+
() => admitted ? isCurrentResultView() && resultOrder === actionResultOrderRef.current.settled : isCurrentView() && resultOrder >= actionResultOrderRef.current.settled
|
|
763
|
+
);
|
|
764
|
+
if (!receiptSettled || !canProjectResult()) return receipt;
|
|
765
|
+
if (receipt.observation) {
|
|
766
|
+
const observation = receipt.observation;
|
|
767
|
+
observationRef.current = { source, computerSessionId, observation };
|
|
768
|
+
selectedTargetIdRef.current = observation.target.id;
|
|
769
|
+
targetsRef.current.targets = replaceTarget(
|
|
770
|
+
targetsRef.current.targets,
|
|
771
|
+
observation.target
|
|
772
|
+
);
|
|
773
|
+
resultTargetId = observation.target.id;
|
|
774
|
+
resultFence = {
|
|
775
|
+
id: observation.target.id,
|
|
776
|
+
computerSessionId: observation.target.computerSessionId,
|
|
777
|
+
controllerGeneration: observation.target.controllerGeneration,
|
|
778
|
+
targetGeneration: observation.target.targetGeneration
|
|
779
|
+
};
|
|
780
|
+
projectState((current) => ({
|
|
781
|
+
...current,
|
|
782
|
+
error: null,
|
|
783
|
+
controlError: null,
|
|
784
|
+
observation,
|
|
785
|
+
selectedTargetId: observation.target.id,
|
|
786
|
+
targets: replaceTarget(current.targets, observation.target)
|
|
787
|
+
}));
|
|
788
|
+
} else {
|
|
789
|
+
projectState((current) => ({ ...current, error: null, controlError: null }));
|
|
790
|
+
void refresh();
|
|
791
|
+
}
|
|
792
|
+
return receipt;
|
|
793
|
+
} catch (cause) {
|
|
794
|
+
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
795
|
+
actionResultFences.set(
|
|
796
|
+
error,
|
|
797
|
+
() => admitted && isCurrentResultView() && resultOrder === actionResultOrderRef.current.settled
|
|
798
|
+
);
|
|
799
|
+
if (canProjectResult()) {
|
|
800
|
+
projectState((current) => ({
|
|
801
|
+
...current,
|
|
802
|
+
error,
|
|
803
|
+
controlError: isInteractionControlUnavailable(error) ? error : current.controlError
|
|
804
|
+
}));
|
|
805
|
+
}
|
|
806
|
+
throw error;
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
},
|
|
810
|
+
[
|
|
811
|
+
client,
|
|
812
|
+
computerSessionId,
|
|
813
|
+
invalidateRefresh,
|
|
814
|
+
isCurrentSource,
|
|
815
|
+
refresh,
|
|
816
|
+
runMutation,
|
|
817
|
+
source,
|
|
818
|
+
workspaceId,
|
|
819
|
+
t
|
|
820
|
+
]
|
|
821
|
+
);
|
|
822
|
+
const act = useCallback2(
|
|
823
|
+
async (action, operationId = crypto.randomUUID()) => await dispatchAction(action, operationId, null),
|
|
824
|
+
[dispatchAction]
|
|
825
|
+
);
|
|
826
|
+
const actFromFrame = useCallback2(
|
|
827
|
+
async (action, frame, operationId = crypto.randomUUID()) => await dispatchAction(action, operationId, frame),
|
|
828
|
+
[dispatchAction]
|
|
829
|
+
);
|
|
830
|
+
const readClipboard = useCallback2(async () => {
|
|
831
|
+
if (!computerSessionId) throw new Error(t("hooks.useComputerSession.noDesktopIsSelected"));
|
|
832
|
+
const selectionRevision = selectionRevisionRef.current;
|
|
833
|
+
const settledOrder = actionResultOrderRef.current.settled;
|
|
834
|
+
const selectedTargetId = selectedTargetIdRef.current;
|
|
835
|
+
const selectedTarget = targetsRef.current.targets.find(
|
|
836
|
+
(candidate) => candidate.id === selectedTargetId
|
|
837
|
+
);
|
|
838
|
+
const selectedFence = selectedTarget && {
|
|
839
|
+
id: selectedTarget.id,
|
|
840
|
+
computerSessionId: selectedTarget.computerSessionId,
|
|
841
|
+
controllerGeneration: selectedTarget.controllerGeneration,
|
|
842
|
+
targetGeneration: selectedTarget.targetGeneration
|
|
843
|
+
};
|
|
844
|
+
const isCurrentRead = () => isCurrentSource() && selectionRevisionRef.current === selectionRevision && actionResultOrderRef.current.settled === settledOrder && selectedTargetIdRef.current === selectedTargetId && targetsRef.current.source === source && sameTargetFence(
|
|
845
|
+
selectedFence,
|
|
846
|
+
targetsRef.current.targets.find((candidate) => candidate.id === selectedTargetId)
|
|
847
|
+
);
|
|
848
|
+
try {
|
|
849
|
+
const clipboard = await client.readComputerClipboard(workspaceId, computerSessionId);
|
|
850
|
+
actionResultFences.set(clipboard, isCurrentRead);
|
|
851
|
+
return clipboard;
|
|
852
|
+
} catch (cause) {
|
|
853
|
+
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
854
|
+
actionResultFences.set(error, isCurrentRead);
|
|
855
|
+
setState(
|
|
856
|
+
(current) => isCurrentRead() && current.source === source && current.computerSessionId === computerSessionId ? {
|
|
857
|
+
...current,
|
|
858
|
+
error,
|
|
859
|
+
controlError: isInteractionControlUnavailable(error) ? error : current.controlError
|
|
860
|
+
} : current
|
|
861
|
+
);
|
|
862
|
+
throw error;
|
|
863
|
+
}
|
|
864
|
+
}, [client, computerSessionId, isCurrentSource, source, workspaceId, t]);
|
|
865
|
+
return {
|
|
866
|
+
session: visible.session,
|
|
867
|
+
targets: visible.targets,
|
|
868
|
+
selectedTarget: visible.targets.find((target) => target.id === visible.selectedTargetId) ?? null,
|
|
869
|
+
observation: visible.observation,
|
|
870
|
+
loading: visible.loading,
|
|
871
|
+
mutating: visible.mutating,
|
|
872
|
+
error: visible.error,
|
|
873
|
+
controlError: visible.controlError,
|
|
874
|
+
refresh,
|
|
875
|
+
readClipboard,
|
|
876
|
+
selectTarget,
|
|
877
|
+
act,
|
|
878
|
+
actFromFrame
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
function emptyState(source, loading) {
|
|
882
|
+
return {
|
|
883
|
+
source,
|
|
884
|
+
computerSessionId: source.computerSessionId,
|
|
885
|
+
session: null,
|
|
886
|
+
targets: [],
|
|
887
|
+
selectedTargetId: null,
|
|
888
|
+
observation: null,
|
|
889
|
+
loading,
|
|
890
|
+
mutating: false,
|
|
891
|
+
error: null,
|
|
892
|
+
controlError: null,
|
|
893
|
+
actionResultOrder: 0
|
|
894
|
+
};
|
|
895
|
+
}
|
|
896
|
+
function chooseTarget(targets, preferredId) {
|
|
897
|
+
if (preferredId !== null) return targets.find((target) => target.id === preferredId) ?? null;
|
|
898
|
+
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;
|
|
899
|
+
}
|
|
900
|
+
function sortComputerTargets(targets) {
|
|
901
|
+
const rank = { window: 0, app: 1, screen: 2 };
|
|
902
|
+
return [...targets].sort(
|
|
903
|
+
(left, right) => Number(right.focused) - Number(left.focused) || rank[left.kind] - rank[right.kind] || left.title.localeCompare(right.title) || left.id.localeCompare(right.id)
|
|
904
|
+
);
|
|
905
|
+
}
|
|
906
|
+
function replaceTarget(targets, target) {
|
|
907
|
+
return sortComputerTargets([
|
|
908
|
+
...targets.filter((candidate) => candidate.id !== target.id),
|
|
909
|
+
target
|
|
910
|
+
]);
|
|
911
|
+
}
|
|
912
|
+
function sameTargetFence(left, right) {
|
|
913
|
+
return left?.id === right?.id && left?.computerSessionId === right?.computerSessionId && left?.controllerGeneration === right?.controllerGeneration && left?.targetGeneration === right?.targetGeneration;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
// src/hooks/use-computer-input-posture.ts
|
|
917
|
+
import { useCallback as useCallback3, useEffect as useEffect3, useRef as useRef3, useState as useState3 } from "react";
|
|
918
|
+
function useComputerInputPosture(options) {
|
|
919
|
+
const t = useOpenGeniText();
|
|
920
|
+
const { client, workspaceId } = useEmbeddedComputerInteraction(options);
|
|
921
|
+
const { computerSessionId, controllerGeneration, enabled } = options;
|
|
922
|
+
const [nonce, setNonce] = useState3(0);
|
|
923
|
+
const [state, setState] = useState3(null);
|
|
924
|
+
const key = JSON.stringify([workspaceId, computerSessionId, controllerGeneration, enabled]);
|
|
925
|
+
const sourceRef = useRef3({ client, key });
|
|
926
|
+
if (sourceRef.current.client !== client || sourceRef.current.key !== key) {
|
|
927
|
+
sourceRef.current = { client, key };
|
|
928
|
+
}
|
|
929
|
+
const source = sourceRef.current;
|
|
930
|
+
const visible = state?.source === source && state.nonce === nonce ? state : null;
|
|
931
|
+
const refresh = useCallback3(() => setNonce((value) => value + 1), []);
|
|
932
|
+
useEffect3(() => {
|
|
933
|
+
if (!enabled || !computerSessionId || !controllerGeneration) return;
|
|
934
|
+
const controller = new AbortController();
|
|
935
|
+
let disposed = false;
|
|
936
|
+
setState({ source, nonce, inputAllowed: null, pending: true, error: null });
|
|
937
|
+
void (async () => {
|
|
938
|
+
try {
|
|
939
|
+
if (!client.getComputerInputPosture) {
|
|
940
|
+
throw new Error(t("hooks.useComputerInputPosture.desktopInputAvailabilityCouldNot"));
|
|
941
|
+
}
|
|
942
|
+
const posture = await client.getComputerInputPosture(workspaceId, computerSessionId, {
|
|
943
|
+
signal: controller.signal,
|
|
944
|
+
timeoutMs: 15e3
|
|
945
|
+
});
|
|
946
|
+
if (disposed || sourceRef.current !== source) return;
|
|
947
|
+
if (posture.computerSessionId !== computerSessionId || posture.controllerGeneration !== controllerGeneration || typeof posture.inputAllowed !== "boolean") {
|
|
948
|
+
throw new Error("Desktop input availability belongs to a different controller.");
|
|
949
|
+
}
|
|
950
|
+
setState({
|
|
951
|
+
source,
|
|
952
|
+
nonce,
|
|
953
|
+
inputAllowed: posture.inputAllowed,
|
|
954
|
+
pending: false,
|
|
955
|
+
error: null
|
|
956
|
+
});
|
|
957
|
+
} catch (cause) {
|
|
958
|
+
if (disposed || controller.signal.aborted || sourceRef.current !== source) return;
|
|
959
|
+
setState({
|
|
960
|
+
source,
|
|
961
|
+
nonce,
|
|
962
|
+
inputAllowed: null,
|
|
963
|
+
pending: false,
|
|
964
|
+
error: cause instanceof Error ? cause : new Error(String(cause))
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
})();
|
|
968
|
+
return () => {
|
|
969
|
+
disposed = true;
|
|
970
|
+
controller.abort();
|
|
971
|
+
};
|
|
972
|
+
}, [client, computerSessionId, controllerGeneration, enabled, nonce, source, workspaceId, t]);
|
|
973
|
+
return {
|
|
974
|
+
inputAllowed: visible?.inputAllowed ?? null,
|
|
975
|
+
pending: enabled && (visible?.pending ?? true),
|
|
976
|
+
error: visible?.error ?? null,
|
|
977
|
+
refresh
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
// src/hooks/use-computer-sessions.ts
|
|
982
|
+
import { useCallback as useCallback4, useEffect as useEffect4, useMemo, useRef as useRef4, useState as useState4 } from "react";
|
|
983
|
+
function useComputerSessions(options = {}) {
|
|
984
|
+
const {
|
|
985
|
+
client,
|
|
986
|
+
workspaceId,
|
|
987
|
+
registerSessionReconciler,
|
|
988
|
+
workspaceInteractionEvent,
|
|
989
|
+
workspaceInteractionConnectionState
|
|
990
|
+
} = useEmbeddedComputerInteraction(options);
|
|
991
|
+
const enabled = options.enabled ?? true;
|
|
992
|
+
const [state, setState] = useState4(() => emptyState2(workspaceId, enabled));
|
|
993
|
+
const requestRef = useRef4({
|
|
994
|
+
id: 0,
|
|
995
|
+
controller: null
|
|
996
|
+
});
|
|
997
|
+
const mountedRef = useRef4(true);
|
|
998
|
+
const visible = state.workspaceId === workspaceId ? state : emptyState2(workspaceId, enabled);
|
|
999
|
+
const cancelLoad = useCallback4(() => {
|
|
1000
|
+
const id = requestRef.current.id + 1;
|
|
1001
|
+
requestRef.current.controller?.abort();
|
|
1002
|
+
requestRef.current = { id, controller: null };
|
|
1003
|
+
}, []);
|
|
1004
|
+
const load = useCallback4(
|
|
1005
|
+
async (foreground) => {
|
|
1006
|
+
if (!enabled) return;
|
|
1007
|
+
const id = requestRef.current.id + 1;
|
|
1008
|
+
requestRef.current.controller?.abort();
|
|
1009
|
+
const controller = new AbortController();
|
|
1010
|
+
requestRef.current = { id, controller };
|
|
1011
|
+
setState((current) => ({
|
|
1012
|
+
...current.workspaceId === workspaceId ? current : emptyState2(workspaceId, true),
|
|
1013
|
+
active: true,
|
|
1014
|
+
loading: foreground,
|
|
1015
|
+
refreshing: !foreground,
|
|
1016
|
+
error: foreground || current.workspaceId !== workspaceId ? null : current.error
|
|
1017
|
+
}));
|
|
1018
|
+
try {
|
|
1019
|
+
const response = await client.listComputerSessions(workspaceId, {
|
|
1020
|
+
signal: controller.signal
|
|
1021
|
+
});
|
|
1022
|
+
if (!mountedRef.current || requestRef.current.id !== id) return;
|
|
1023
|
+
setState({
|
|
1024
|
+
workspaceId,
|
|
1025
|
+
active: true,
|
|
1026
|
+
revision: response.revision,
|
|
1027
|
+
sessions: sortComputerSessions(response.sessions),
|
|
1028
|
+
loading: false,
|
|
1029
|
+
refreshing: false,
|
|
1030
|
+
error: null
|
|
1031
|
+
});
|
|
1032
|
+
} catch (cause) {
|
|
1033
|
+
if (controller.signal.aborted || !mountedRef.current || requestRef.current.id !== id)
|
|
1034
|
+
return;
|
|
1035
|
+
setState((current) => ({
|
|
1036
|
+
...current.workspaceId === workspaceId ? current : emptyState2(workspaceId, true),
|
|
1037
|
+
loading: false,
|
|
1038
|
+
refreshing: false,
|
|
1039
|
+
error: cause instanceof Error ? cause : new Error(String(cause))
|
|
1040
|
+
}));
|
|
1041
|
+
} finally {
|
|
1042
|
+
if (requestRef.current.id === id) requestRef.current = { id, controller: null };
|
|
1043
|
+
}
|
|
1044
|
+
},
|
|
1045
|
+
[client, enabled, workspaceId]
|
|
1046
|
+
);
|
|
1047
|
+
const refresh = useCallback4(async () => await load(false), [load]);
|
|
1048
|
+
useEffect4(() => {
|
|
1049
|
+
mountedRef.current = true;
|
|
1050
|
+
if (!enabled) {
|
|
1051
|
+
cancelLoad();
|
|
1052
|
+
setState(emptyState2(workspaceId, false));
|
|
1053
|
+
return;
|
|
1054
|
+
}
|
|
1055
|
+
void load(true);
|
|
1056
|
+
return () => {
|
|
1057
|
+
mountedRef.current = false;
|
|
1058
|
+
cancelLoad();
|
|
1059
|
+
};
|
|
1060
|
+
}, [cancelLoad, enabled, load, workspaceId]);
|
|
1061
|
+
useInteractionInvalidation({
|
|
1062
|
+
workspaceId,
|
|
1063
|
+
key: workspaceId,
|
|
1064
|
+
enabled,
|
|
1065
|
+
event: workspaceInteractionEvent,
|
|
1066
|
+
connectionState: workspaceInteractionConnectionState,
|
|
1067
|
+
knownRevision: visible.revision,
|
|
1068
|
+
refresh,
|
|
1069
|
+
fallbackPollIntervalMs: options.pollIntervalMs
|
|
1070
|
+
});
|
|
1071
|
+
useEffect4(() => {
|
|
1072
|
+
if (!enabled || !options.sessionId) return;
|
|
1073
|
+
return registerSessionReconciler(
|
|
1074
|
+
options.sessionId,
|
|
1075
|
+
`computer-sessions:${workspaceId}`,
|
|
1076
|
+
refresh
|
|
1077
|
+
);
|
|
1078
|
+
}, [enabled, options.sessionId, refresh, registerSessionReconciler, workspaceId]);
|
|
1079
|
+
const create = useCallback4(
|
|
1080
|
+
async (request) => {
|
|
1081
|
+
const response = await client.createComputerSession(workspaceId, {
|
|
1082
|
+
...request,
|
|
1083
|
+
operationId: request.operationId ?? crypto.randomUUID()
|
|
1084
|
+
});
|
|
1085
|
+
setState((current) => mergeSession(current, workspaceId, response.session));
|
|
1086
|
+
return response;
|
|
1087
|
+
},
|
|
1088
|
+
[client, workspaceId]
|
|
1089
|
+
);
|
|
1090
|
+
const end = useCallback4(
|
|
1091
|
+
async (computerSessionId, operationId = crypto.randomUUID()) => {
|
|
1092
|
+
const response = await client.endComputerSession(workspaceId, computerSessionId, {
|
|
1093
|
+
operationId
|
|
1094
|
+
});
|
|
1095
|
+
setState((current) => mergeSession(current, workspaceId, response.session));
|
|
1096
|
+
return response;
|
|
1097
|
+
},
|
|
1098
|
+
[client, workspaceId]
|
|
1099
|
+
);
|
|
1100
|
+
const relevantSessions = useMemo(
|
|
1101
|
+
() => options.sessionId ? visible.sessions.filter(
|
|
1102
|
+
(session) => session.associations.some((association) => association.sessionId === options.sessionId)
|
|
1103
|
+
) : [],
|
|
1104
|
+
[options.sessionId, visible.sessions]
|
|
1105
|
+
);
|
|
1106
|
+
return {
|
|
1107
|
+
revision: visible.revision,
|
|
1108
|
+
sessions: visible.sessions,
|
|
1109
|
+
relevantSessions,
|
|
1110
|
+
// A disabled registry is deliberately empty. When its surface becomes
|
|
1111
|
+
// visible again, expose that transition as loading in the same render so
|
|
1112
|
+
// consumers cannot mistake the stale empty snapshot for a completed list.
|
|
1113
|
+
loading: enabled ? !visible.active || visible.loading : false,
|
|
1114
|
+
refreshing: visible.refreshing,
|
|
1115
|
+
error: visible.error,
|
|
1116
|
+
refresh,
|
|
1117
|
+
create,
|
|
1118
|
+
end
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
1121
|
+
function emptyState2(workspaceId, loading) {
|
|
1122
|
+
return {
|
|
1123
|
+
workspaceId,
|
|
1124
|
+
active: loading,
|
|
1125
|
+
revision: 0,
|
|
1126
|
+
sessions: [],
|
|
1127
|
+
loading,
|
|
1128
|
+
refreshing: false,
|
|
1129
|
+
error: null
|
|
1130
|
+
};
|
|
1131
|
+
}
|
|
1132
|
+
function sortComputerSessions(sessions) {
|
|
1133
|
+
return [...sessions].sort((left, right) => {
|
|
1134
|
+
const live = Number(isLiveComputer(right)) - Number(isLiveComputer(left));
|
|
1135
|
+
return live || timestamp(right.lastUsedAt) - timestamp(left.lastUsedAt) || left.id.localeCompare(right.id);
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1138
|
+
function isLiveComputer(session) {
|
|
1139
|
+
return !["ending", "ended", "failed", "lost"].includes(session.lifecycle);
|
|
1140
|
+
}
|
|
1141
|
+
function timestamp(value) {
|
|
1142
|
+
const parsed = Date.parse(value);
|
|
1143
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
1144
|
+
}
|
|
1145
|
+
function mergeSession(current, workspaceId, session) {
|
|
1146
|
+
if (current.workspaceId !== workspaceId) return current;
|
|
1147
|
+
const sessions = current.sessions.filter((candidate) => candidate.id !== session.id);
|
|
1148
|
+
sessions.push(session);
|
|
1149
|
+
return { ...current, sessions: sortComputerSessions(sessions), error: null };
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
// src/components/computer-viewer.tsx
|
|
1153
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
1154
|
+
function ComputerViewer({
|
|
1155
|
+
sessionId,
|
|
1156
|
+
enabled = true,
|
|
1157
|
+
className,
|
|
1158
|
+
onNotify,
|
|
1159
|
+
webSocketFactory,
|
|
1160
|
+
renderEmpty,
|
|
1161
|
+
requestedComputerSessionId,
|
|
1162
|
+
requestedComputerRequestId,
|
|
1163
|
+
initialComputerSessionId,
|
|
1164
|
+
onComputerSessionIdChange,
|
|
1165
|
+
...override
|
|
1166
|
+
}) {
|
|
1167
|
+
const t = useOpenGeniText();
|
|
1168
|
+
const registry = useComputerSessions({ ...override, sessionId, enabled });
|
|
1169
|
+
const createSession = registry.create;
|
|
1170
|
+
const refreshRegistry = registry.refresh;
|
|
1171
|
+
const liveRelevant = useMemo2(
|
|
1172
|
+
() => registry.relevantSessions.filter((session) => isLiveComputer2(session)),
|
|
1173
|
+
[registry.relevantSessions]
|
|
1174
|
+
);
|
|
1175
|
+
const connectedPlacementLoss = useMemo2(
|
|
1176
|
+
() => registry.relevantSessions.find(
|
|
1177
|
+
(session) => session.lifecycle === "lost" && session.failureCode === "source_placement_changed" && session.placement.kind === "connected_machine"
|
|
1178
|
+
) ?? null,
|
|
1179
|
+
[registry.relevantSessions]
|
|
1180
|
+
);
|
|
1181
|
+
const recentRelevantFailure = useMemo2(
|
|
1182
|
+
() => liveRelevant.length === 0 ? registry.relevantSessions.find(
|
|
1183
|
+
(session) => ["failed", "lost"].includes(session.lifecycle) && !(session.failureCode === "source_placement_changed" && session.placement.kind === "connected_machine")
|
|
1184
|
+
) ?? null : null,
|
|
1185
|
+
[liveRelevant.length, registry.relevantSessions]
|
|
1186
|
+
);
|
|
1187
|
+
const liveSessions = useMemo2(() => {
|
|
1188
|
+
const sessions = registry.sessions.filter((session) => isLiveComputer2(session));
|
|
1189
|
+
return recentRelevantFailure ? [...sessions, recentRelevantFailure] : sessions;
|
|
1190
|
+
}, [recentRelevantFailure, registry.sessions]);
|
|
1191
|
+
const relevant = useMemo2(
|
|
1192
|
+
() => liveRelevant.length > 0 ? liveRelevant : recentRelevantFailure ? [recentRelevantFailure] : [],
|
|
1193
|
+
[liveRelevant, recentRelevantFailure]
|
|
1194
|
+
);
|
|
1195
|
+
const [selection, setSelection] = useState5(
|
|
1196
|
+
() => initialComputerSessionId ? { sessionId: initialComputerSessionId, pinned: true } : null
|
|
1197
|
+
);
|
|
1198
|
+
const selectComputerSession = useCallback5(
|
|
1199
|
+
(next) => {
|
|
1200
|
+
setSelection(next);
|
|
1201
|
+
onComputerSessionIdChange?.(next?.sessionId ?? null);
|
|
1202
|
+
},
|
|
1203
|
+
[onComputerSessionIdChange]
|
|
1204
|
+
);
|
|
1205
|
+
const interventions = useInteractionInterventions({
|
|
1206
|
+
...override,
|
|
1207
|
+
enabled,
|
|
1208
|
+
resourceKind: "computer_session"
|
|
1209
|
+
});
|
|
1210
|
+
const [creating, setCreating] = useState5(false);
|
|
1211
|
+
const [createError, setCreateError] = useState5(null);
|
|
1212
|
+
const [showControls, setShowControls] = useState5(false);
|
|
1213
|
+
const previousSessionIdRef = useRef5(sessionId);
|
|
1214
|
+
const handledRequestRef = useRef5(null);
|
|
1215
|
+
const seenInterventionIdsRef = useRef5(/* @__PURE__ */ new Set());
|
|
1216
|
+
const createInFlightRef = useRef5(false);
|
|
1217
|
+
const autoCreateSessionRef = useRef5(null);
|
|
1218
|
+
const emptyCatalogConfirmationRef = useRef5(null);
|
|
1219
|
+
const endedGenerationLossRef = useRef5(/* @__PURE__ */ new Set());
|
|
1220
|
+
const recreatedPlacementLossRef = useRef5(/* @__PURE__ */ new Set());
|
|
1221
|
+
const [suppressGenericCreate, setSuppressGenericCreate] = useState5(false);
|
|
1222
|
+
const endStaleComputer = registry.end;
|
|
1223
|
+
useEffect5(() => {
|
|
1224
|
+
if (!enabled) return;
|
|
1225
|
+
for (const session of registry.sessions) {
|
|
1226
|
+
if (!isAttachedChromeGenerationLoss(session)) continue;
|
|
1227
|
+
setSuppressGenericCreate(true);
|
|
1228
|
+
if (endedGenerationLossRef.current.has(session.id)) continue;
|
|
1229
|
+
endedGenerationLossRef.current.add(session.id);
|
|
1230
|
+
void endStaleComputer(session.id).catch(() => {
|
|
1231
|
+
endedGenerationLossRef.current.delete(session.id);
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
}, [enabled, endStaleComputer, registry.sessions]);
|
|
1235
|
+
const notifyError = useCallback5(
|
|
1236
|
+
(cause, fallback) => {
|
|
1237
|
+
if (isStaleComputerActionResult(cause)) return;
|
|
1238
|
+
onNotify?.({
|
|
1239
|
+
kind: "error",
|
|
1240
|
+
message: cause instanceof Error ? cause.message : fallback
|
|
1241
|
+
});
|
|
1242
|
+
},
|
|
1243
|
+
[onNotify]
|
|
1244
|
+
);
|
|
1245
|
+
useEffect5(() => {
|
|
1246
|
+
if (previousSessionIdRef.current === sessionId) return;
|
|
1247
|
+
previousSessionIdRef.current = sessionId;
|
|
1248
|
+
handledRequestRef.current = null;
|
|
1249
|
+
autoCreateSessionRef.current = null;
|
|
1250
|
+
emptyCatalogConfirmationRef.current = null;
|
|
1251
|
+
recreatedPlacementLossRef.current.clear();
|
|
1252
|
+
setSuppressGenericCreate(false);
|
|
1253
|
+
setCreateError(null);
|
|
1254
|
+
setSelection(
|
|
1255
|
+
initialComputerSessionId ? { sessionId: initialComputerSessionId, pinned: true } : null
|
|
1256
|
+
);
|
|
1257
|
+
}, [initialComputerSessionId, sessionId]);
|
|
1258
|
+
useEffect5(() => {
|
|
1259
|
+
if (!enabled || registry.loading) return;
|
|
1260
|
+
const requested = requestedComputerSessionId ? liveSessions.find((session) => session.id === requestedComputerSessionId) ?? null : null;
|
|
1261
|
+
const requestKey = requested ? `${requestedComputerRequestId ?? "default"}:${requested.id}` : null;
|
|
1262
|
+
if (requested && requestKey && handledRequestRef.current !== requestKey) {
|
|
1263
|
+
handledRequestRef.current = requestKey;
|
|
1264
|
+
selectComputerSession({ sessionId: requested.id, pinned: true });
|
|
1265
|
+
return;
|
|
1266
|
+
}
|
|
1267
|
+
const selectedStillLive = liveSessions.some((session) => session.id === selection?.sessionId);
|
|
1268
|
+
if (selection?.pinned && selectedStillLive) return;
|
|
1269
|
+
const preferred = relevant[0] ?? null;
|
|
1270
|
+
if (!preferred) {
|
|
1271
|
+
if (selection) selectComputerSession(null);
|
|
1272
|
+
return;
|
|
1273
|
+
}
|
|
1274
|
+
if (!selectedStillLive || !selection?.pinned) {
|
|
1275
|
+
if (selection?.sessionId !== preferred.id || selection.pinned) {
|
|
1276
|
+
selectComputerSession({ sessionId: preferred.id, pinned: false });
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
}, [
|
|
1280
|
+
liveSessions,
|
|
1281
|
+
enabled,
|
|
1282
|
+
registry.loading,
|
|
1283
|
+
relevant,
|
|
1284
|
+
requestedComputerRequestId,
|
|
1285
|
+
requestedComputerSessionId,
|
|
1286
|
+
selectComputerSession,
|
|
1287
|
+
selection
|
|
1288
|
+
]);
|
|
1289
|
+
const selectedRegistrySession = useMemo2(
|
|
1290
|
+
() => liveSessions.find((session) => session.id === selection?.sessionId) ?? null,
|
|
1291
|
+
[liveSessions, selection?.sessionId]
|
|
1292
|
+
);
|
|
1293
|
+
const interventionCounts = useMemo2(
|
|
1294
|
+
() => countInterventions(interventions.interventions),
|
|
1295
|
+
[interventions.interventions]
|
|
1296
|
+
);
|
|
1297
|
+
const selectedInterventions = useMemo2(
|
|
1298
|
+
() => interventions.interventions.filter(
|
|
1299
|
+
(intervention) => intervention.resourceId === selection?.sessionId
|
|
1300
|
+
),
|
|
1301
|
+
[interventions.interventions, selection?.sessionId]
|
|
1302
|
+
);
|
|
1303
|
+
const controllerReady = selectedRegistrySession?.lifecycle === "active";
|
|
1304
|
+
const computer = useComputerSession({
|
|
1305
|
+
...override,
|
|
1306
|
+
computerSessionId: selection?.sessionId ?? null,
|
|
1307
|
+
enabled: enabled && selection !== null && controllerReady
|
|
1308
|
+
});
|
|
1309
|
+
useEffect5(() => {
|
|
1310
|
+
setShowControls(computer.selectedTarget?.kind === "app");
|
|
1311
|
+
}, [sessionId, selection?.sessionId, computer.selectedTarget?.id, computer.selectedTarget?.kind]);
|
|
1312
|
+
useEffect5(() => {
|
|
1313
|
+
if (!isSourcePlacementChangedError(computer.error, "computer_session")) return;
|
|
1314
|
+
void refreshRegistry();
|
|
1315
|
+
}, [computer.error, refreshRegistry]);
|
|
1316
|
+
const act = computer.act;
|
|
1317
|
+
const actFromFrame = computer.actFromFrame;
|
|
1318
|
+
const refreshComputer = computer.refresh;
|
|
1319
|
+
const frames = useComputerFrameStream({
|
|
1320
|
+
...override,
|
|
1321
|
+
computerSessionId: selection?.sessionId ?? null,
|
|
1322
|
+
targetId: computer.selectedTarget?.id ?? null,
|
|
1323
|
+
enabled: enabled && selection !== null && controllerReady && computer.selectedTarget !== null && isComputerFrameTarget(computer.selectedTarget),
|
|
1324
|
+
stream: {
|
|
1325
|
+
format: "jpeg",
|
|
1326
|
+
quality: 78,
|
|
1327
|
+
maxWidth: 1920,
|
|
1328
|
+
maxHeight: 1200,
|
|
1329
|
+
everyNthFrame: 1
|
|
1330
|
+
},
|
|
1331
|
+
...webSocketFactory ? { webSocketFactory } : {}
|
|
1332
|
+
});
|
|
1333
|
+
const displayedFrame = frames.frame && frames.frame.computerSessionId === selection?.sessionId && frames.frame.targetId === computer.selectedTarget?.id && frames.frame.targetGeneration === computer.selectedTarget?.targetGeneration ? frames.frame : null;
|
|
1334
|
+
const rfbStream = frames.attachment?.stream.kind === "direct_rfb" ? frames.attachment.stream : null;
|
|
1335
|
+
const appTarget = computer.selectedTarget?.kind === "app";
|
|
1336
|
+
const appInputPosture = useComputerInputPosture({
|
|
1337
|
+
...override,
|
|
1338
|
+
computerSessionId: selection?.sessionId ?? null,
|
|
1339
|
+
controllerGeneration: computer.session?.controller?.controllerGeneration ?? null,
|
|
1340
|
+
enabled: enabled && controllerReady && appTarget
|
|
1341
|
+
});
|
|
1342
|
+
const inputPostureRef = useRef5({
|
|
1343
|
+
sessionId: selection?.sessionId ?? null,
|
|
1344
|
+
controllerGeneration: computer.session?.controller?.controllerGeneration ?? null,
|
|
1345
|
+
denied: false
|
|
1346
|
+
});
|
|
1347
|
+
const postureSessionId = selection?.sessionId ?? null;
|
|
1348
|
+
const postureController = computer.session?.controller?.controllerGeneration ?? null;
|
|
1349
|
+
if (inputPostureRef.current.sessionId !== postureSessionId || inputPostureRef.current.controllerGeneration !== postureController) {
|
|
1350
|
+
inputPostureRef.current = {
|
|
1351
|
+
sessionId: postureSessionId,
|
|
1352
|
+
controllerGeneration: postureController,
|
|
1353
|
+
denied: false
|
|
1354
|
+
};
|
|
1355
|
+
}
|
|
1356
|
+
if (frames.attachment?.computerSessionId === postureSessionId && frames.attachment.controllerGeneration === postureController) {
|
|
1357
|
+
inputPostureRef.current.denied = frames.attachment.inputAllowed === false;
|
|
1358
|
+
}
|
|
1359
|
+
const inputDenied = appTarget ? appInputPosture.inputAllowed !== true : inputPostureRef.current.denied;
|
|
1360
|
+
const attachmentInputAllowed = frames.attachment !== null && !inputDenied;
|
|
1361
|
+
const inputPosturePending = appTarget ? appInputPosture.pending : inputDenied && (frames.state === "attaching" || frames.state === "reconnecting");
|
|
1362
|
+
const machineLocked = selectedRegistrySession?.failureCode === "machine_locked";
|
|
1363
|
+
const controlUnavailable = computer.controlError !== null;
|
|
1364
|
+
const connectionState = controlUnavailable ? "error" : frames.state;
|
|
1365
|
+
const rfbInputEnabled = rfbStream?.inputAllowed === true && attachmentInputAllowed && !machineLocked && !controlUnavailable && computer.session?.capabilities?.pointerInput === true && computer.session?.capabilities?.keyboardInput === true;
|
|
1366
|
+
const rfbCapability = useMemo2(() => {
|
|
1367
|
+
if (!rfbStream || !frames.attachment) return null;
|
|
1368
|
+
const bounds = computer.selectedTarget?.bounds;
|
|
1369
|
+
return {
|
|
1370
|
+
transport: "vnc-ws",
|
|
1371
|
+
client: "novnc",
|
|
1372
|
+
mode: rfbInputEnabled ? "interactive" : "read-only",
|
|
1373
|
+
url: rfbStream.url,
|
|
1374
|
+
token: null,
|
|
1375
|
+
expiresAt: frames.attachment.expiresAt,
|
|
1376
|
+
resolution: [bounds?.width ?? 1440, bounds?.height ?? 900],
|
|
1377
|
+
unredacted: true,
|
|
1378
|
+
requiresAcknowledgment: false,
|
|
1379
|
+
acknowledged: true,
|
|
1380
|
+
shared: false,
|
|
1381
|
+
sharedSessionIds: [],
|
|
1382
|
+
reason: null
|
|
1383
|
+
};
|
|
1384
|
+
}, [computer.selectedTarget?.bounds, frames.attachment, rfbInputEnabled, rfbStream]);
|
|
1385
|
+
const currentIds = useMemo2(() => new Set(relevant.map((session) => session.id)), [relevant]);
|
|
1386
|
+
useEffect5(() => {
|
|
1387
|
+
for (const intervention of interventions.interventions) {
|
|
1388
|
+
if (seenInterventionIdsRef.current.has(intervention.id)) continue;
|
|
1389
|
+
seenInterventionIdsRef.current.add(intervention.id);
|
|
1390
|
+
onNotify?.({
|
|
1391
|
+
kind: "info",
|
|
1392
|
+
message: `${interventionTitle(t, intervention)}: ${intervention.reason}`
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1395
|
+
}, [interventions.interventions, onNotify, t]);
|
|
1396
|
+
const resolveIntervention = useCallback5(
|
|
1397
|
+
(intervention, outcome) => {
|
|
1398
|
+
void interventions.resolve(intervention.id, {
|
|
1399
|
+
expectedVersion: intervention.version,
|
|
1400
|
+
outcome
|
|
1401
|
+
}).then(() => {
|
|
1402
|
+
onNotify?.({
|
|
1403
|
+
kind: "info",
|
|
1404
|
+
message: outcome === "completed" ? t("computerViewer.agentNotifiedContinuingWork") : t("computerViewer.requestCancelled")
|
|
1405
|
+
});
|
|
1406
|
+
}).catch((cause) => notifyError(cause, t("computerViewer.couldNotUpdateTheDesktop")));
|
|
1407
|
+
},
|
|
1408
|
+
[interventions, notifyError, onNotify, t]
|
|
1409
|
+
);
|
|
1410
|
+
const createComputer = useCallback5(() => {
|
|
1411
|
+
if (createInFlightRef.current) return;
|
|
1412
|
+
createInFlightRef.current = true;
|
|
1413
|
+
setCreateError(null);
|
|
1414
|
+
setCreating(true);
|
|
1415
|
+
void createSession({ sessionId, name: "Desktop" }).then((response) => {
|
|
1416
|
+
selectComputerSession({ sessionId: response.session.id, pinned: false });
|
|
1417
|
+
}).catch((cause) => {
|
|
1418
|
+
const error = cause instanceof Error ? cause : new Error(t("computerViewer.couldNotOpenADesktop"));
|
|
1419
|
+
setCreateError(error);
|
|
1420
|
+
notifyError(error, t("computerViewer.couldNotOpenADesktop"));
|
|
1421
|
+
}).finally(() => {
|
|
1422
|
+
createInFlightRef.current = false;
|
|
1423
|
+
setCreating(false);
|
|
1424
|
+
});
|
|
1425
|
+
}, [createSession, notifyError, selectComputerSession, sessionId, t]);
|
|
1426
|
+
useEffect5(() => {
|
|
1427
|
+
if (!enabled || registry.loading || registry.refreshing || liveRelevant.length > 0 || !connectedPlacementLoss || recreatedPlacementLossRef.current.has(connectedPlacementLoss.id)) {
|
|
1428
|
+
return;
|
|
1429
|
+
}
|
|
1430
|
+
recreatedPlacementLossRef.current.add(connectedPlacementLoss.id);
|
|
1431
|
+
autoCreateSessionRef.current = sessionId;
|
|
1432
|
+
emptyCatalogConfirmationRef.current = null;
|
|
1433
|
+
createComputer();
|
|
1434
|
+
}, [
|
|
1435
|
+
connectedPlacementLoss,
|
|
1436
|
+
createComputer,
|
|
1437
|
+
enabled,
|
|
1438
|
+
liveRelevant.length,
|
|
1439
|
+
registry.loading,
|
|
1440
|
+
registry.refreshing,
|
|
1441
|
+
sessionId
|
|
1442
|
+
]);
|
|
1443
|
+
useEffect5(() => {
|
|
1444
|
+
if (relevant.length > 0) {
|
|
1445
|
+
autoCreateSessionRef.current = sessionId;
|
|
1446
|
+
emptyCatalogConfirmationRef.current = null;
|
|
1447
|
+
}
|
|
1448
|
+
}, [relevant.length, sessionId]);
|
|
1449
|
+
useEffect5(() => {
|
|
1450
|
+
if (!enabled || registry.loading || registry.refreshing || registry.error || relevant.length > 0 || suppressGenericCreate || autoCreateSessionRef.current === sessionId) {
|
|
1451
|
+
return;
|
|
1452
|
+
}
|
|
1453
|
+
if (emptyCatalogConfirmationRef.current !== sessionId) {
|
|
1454
|
+
emptyCatalogConfirmationRef.current = sessionId;
|
|
1455
|
+
void refreshRegistry();
|
|
1456
|
+
return;
|
|
1457
|
+
}
|
|
1458
|
+
autoCreateSessionRef.current = sessionId;
|
|
1459
|
+
createComputer();
|
|
1460
|
+
}, [
|
|
1461
|
+
createComputer,
|
|
1462
|
+
enabled,
|
|
1463
|
+
refreshRegistry,
|
|
1464
|
+
registry.error,
|
|
1465
|
+
registry.loading,
|
|
1466
|
+
registry.refreshing,
|
|
1467
|
+
relevant.length,
|
|
1468
|
+
sessionId,
|
|
1469
|
+
suppressGenericCreate
|
|
1470
|
+
]);
|
|
1471
|
+
const perform = useCallback5(
|
|
1472
|
+
async (action, frame, operationId) => {
|
|
1473
|
+
if (computer.controlError) throw computer.controlError;
|
|
1474
|
+
if (inputDenied) throw new Error(t("computerViewer.desktopIsViewOnlyRefresh"));
|
|
1475
|
+
let receipt;
|
|
1476
|
+
if (action.type === "pointer") {
|
|
1477
|
+
if (!frame) throw new Error(t("computerViewer.desktopViewIsNotReady"));
|
|
1478
|
+
receipt = await actFromFrame(action, frame, operationId);
|
|
1479
|
+
} else {
|
|
1480
|
+
receipt = await act(action, operationId);
|
|
1481
|
+
}
|
|
1482
|
+
if (!isStaleComputerActionResult(receipt) && receipt.state !== "completed") {
|
|
1483
|
+
throw computerActionReceiptError(t, receipt);
|
|
1484
|
+
}
|
|
1485
|
+
return receipt;
|
|
1486
|
+
},
|
|
1487
|
+
[act, actFromFrame, computer.controlError, inputDenied, t]
|
|
1488
|
+
);
|
|
1489
|
+
const reconnect = () => {
|
|
1490
|
+
void refreshComputer();
|
|
1491
|
+
if (appTarget) appInputPosture.refresh();
|
|
1492
|
+
else frames.reconnect();
|
|
1493
|
+
};
|
|
1494
|
+
const copyFromRfb = useCallback5(
|
|
1495
|
+
(event) => {
|
|
1496
|
+
if (!rfbInputEnabled || !rfbStream || computer.session?.capabilities?.clipboard !== true)
|
|
1497
|
+
return;
|
|
1498
|
+
event.preventDefault();
|
|
1499
|
+
event.stopPropagation();
|
|
1500
|
+
void (async () => {
|
|
1501
|
+
const receipt = await perform({ type: "clipboard", operation: "copy" }, null);
|
|
1502
|
+
if (isStaleComputerActionResult(receipt)) return;
|
|
1503
|
+
const clipboard = await computer.readClipboard();
|
|
1504
|
+
if (isStaleComputerActionResult(receipt) || isStaleComputerActionResult(clipboard)) return;
|
|
1505
|
+
if (clipboard.text && !await copyTextToClipboard(clipboard.text)) {
|
|
1506
|
+
throw new Error(t("computerViewer.desktopTextCouldNotBe"));
|
|
1507
|
+
}
|
|
1508
|
+
})().catch((cause) => notifyError(cause, t("computerViewer.couldNotCopyFromThe")));
|
|
1509
|
+
},
|
|
1510
|
+
[computer, notifyError, perform, rfbInputEnabled, rfbStream, t]
|
|
1511
|
+
);
|
|
1512
|
+
const pasteIntoRfb = useCallback5(
|
|
1513
|
+
(text) => {
|
|
1514
|
+
if (!rfbInputEnabled || !rfbStream || computer.session?.capabilities?.clipboard !== true)
|
|
1515
|
+
return false;
|
|
1516
|
+
void (async () => {
|
|
1517
|
+
const receipt = await perform({ type: "clipboard", operation: "write", text }, null);
|
|
1518
|
+
if (isStaleComputerActionResult(receipt)) return;
|
|
1519
|
+
const clipboard = await computer.readClipboard();
|
|
1520
|
+
if (isStaleComputerActionResult(receipt) || isStaleComputerActionResult(clipboard)) return;
|
|
1521
|
+
assertExactComputerClipboard(t, clipboard, text);
|
|
1522
|
+
await perform({ type: "clipboard", operation: "paste" }, null);
|
|
1523
|
+
})().catch((cause) => notifyError(cause, t("computerViewer.couldNotPasteIntoThe")));
|
|
1524
|
+
return true;
|
|
1525
|
+
},
|
|
1526
|
+
[computer, notifyError, perform, rfbInputEnabled, rfbStream, t]
|
|
1527
|
+
);
|
|
1528
|
+
const hideGenericCreate = suppressGenericCreate && liveRelevant.length === 0;
|
|
1529
|
+
const generationLossSelected = selectedRegistrySession !== null && isAttachedChromeGenerationLoss(selectedRegistrySession);
|
|
1530
|
+
const generationLossFrames = isAttachedChromeGenerationLossError(frames.error);
|
|
1531
|
+
if (!enabled) return null;
|
|
1532
|
+
if (registry.loading && liveSessions.length === 0) {
|
|
1533
|
+
return /* @__PURE__ */ jsx(
|
|
1534
|
+
ComputerNotice,
|
|
1535
|
+
{
|
|
1536
|
+
icon: /* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-4 animate-spin" }),
|
|
1537
|
+
text: t("computerViewer.findingWorkspaceDesktops"),
|
|
1538
|
+
...className ? { className } : {}
|
|
1539
|
+
}
|
|
1540
|
+
);
|
|
1541
|
+
}
|
|
1542
|
+
if (liveSessions.length === 0) {
|
|
1543
|
+
if (hideGenericCreate) {
|
|
1544
|
+
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: [
|
|
1545
|
+
/* @__PURE__ */ jsx(CircleAlertIcon, { className: "mx-auto size-5 text-og-danger" }),
|
|
1546
|
+
/* @__PURE__ */ jsx("p", { className: "mt-3 text-og-menu font-medium text-og-fg", children: t("computerViewer.chromeReconnectedOpenAFresh") }),
|
|
1547
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-og-control leading-5 text-og-fg-muted", children: t("computerViewer.thisChromeProfileIsLive") })
|
|
1548
|
+
] }) });
|
|
1549
|
+
}
|
|
1550
|
+
if (renderEmpty) return renderEmpty(createComputer, creating);
|
|
1551
|
+
const error = createError ?? registry.error;
|
|
1552
|
+
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: [
|
|
1553
|
+
/* @__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" }) }),
|
|
1554
|
+
/* @__PURE__ */ jsx("p", { className: "mt-3 text-og-menu font-medium text-og-fg", children: error ? t("computerViewer.desktopDidnTOpen") : t("computerViewer.openingDesktop") }),
|
|
1555
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-og-control leading-5 text-og-fg-muted", children: error?.message ?? t("computerViewer.preparingThisAgentSDesktop") }),
|
|
1556
|
+
error ? /* @__PURE__ */ jsxs(
|
|
1557
|
+
"button",
|
|
1558
|
+
{
|
|
1559
|
+
type: "button",
|
|
1560
|
+
onClick: createError ? createComputer : () => void refreshRegistry(),
|
|
1561
|
+
disabled: creating || registry.refreshing,
|
|
1562
|
+
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",
|
|
1563
|
+
children: [
|
|
1564
|
+
creating || registry.refreshing ? /* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ jsx(RotateCcwIcon, { className: "size-3.5" }),
|
|
1565
|
+
t("computerViewer.tryAgain")
|
|
1566
|
+
]
|
|
1567
|
+
}
|
|
1568
|
+
) : null
|
|
1569
|
+
] }) });
|
|
1570
|
+
}
|
|
1571
|
+
return /* @__PURE__ */ jsxs(
|
|
1572
|
+
"div",
|
|
1573
|
+
{
|
|
1574
|
+
className: cn(
|
|
1575
|
+
"@container/computer-viewer relative flex h-full min-h-0 min-w-0 flex-col overflow-hidden bg-og-bg",
|
|
1576
|
+
className
|
|
1577
|
+
),
|
|
1578
|
+
children: [
|
|
1579
|
+
/* @__PURE__ */ jsx(
|
|
1580
|
+
ComputerToolbar,
|
|
1581
|
+
{
|
|
1582
|
+
sessions: liveSessions,
|
|
1583
|
+
relevantSessionIds: currentIds,
|
|
1584
|
+
selectedSessionId: selection?.sessionId ?? null,
|
|
1585
|
+
creating,
|
|
1586
|
+
refreshing: registry.refreshing || inputPosturePending,
|
|
1587
|
+
interventionCounts,
|
|
1588
|
+
targets: controllerReady ? computer.targets : [],
|
|
1589
|
+
selectedTargetId: computer.selectedTarget?.id ?? null,
|
|
1590
|
+
targetsLoading: controllerReady && computer.loading,
|
|
1591
|
+
onSelectTarget: (targetId) => {
|
|
1592
|
+
void computer.selectTarget(targetId).catch((cause) => notifyError(cause, t("computerViewer.couldNotSwitchDesktopViews")));
|
|
1593
|
+
},
|
|
1594
|
+
onSelect: (computerSessionId) => selectComputerSession({ sessionId: computerSessionId, pinned: true }),
|
|
1595
|
+
onFollow: () => {
|
|
1596
|
+
if (relevant[0]) selectComputerSession({ sessionId: relevant[0].id, pinned: false });
|
|
1597
|
+
},
|
|
1598
|
+
onCreate: hideGenericCreate ? void 0 : createComputer,
|
|
1599
|
+
onRefresh: () => {
|
|
1600
|
+
if (appTarget) {
|
|
1601
|
+
appInputPosture.refresh();
|
|
1602
|
+
} else if ((connectionState === "error" || inputDenied) && !generationLossSelected && !generationLossFrames) {
|
|
1603
|
+
frames.reconnect();
|
|
1604
|
+
}
|
|
1605
|
+
void Promise.all([refreshRegistry(), refreshComputer()]);
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
),
|
|
1609
|
+
/* @__PURE__ */ jsx(
|
|
1610
|
+
InteractionInterventionBanner,
|
|
1611
|
+
{
|
|
1612
|
+
interventions: selectedInterventions,
|
|
1613
|
+
activeTargetId: computer.selectedTarget?.id ?? null,
|
|
1614
|
+
mutating: interventions.mutating,
|
|
1615
|
+
onOpen: (intervention) => void computer.selectTarget(intervention.targetId).catch((cause) => notifyError(cause, t("computerViewer.couldNotOpenTheRequested"))),
|
|
1616
|
+
onResolve: resolveIntervention
|
|
1617
|
+
}
|
|
1618
|
+
),
|
|
1619
|
+
!selectedRegistrySession ? /* @__PURE__ */ jsx(
|
|
1620
|
+
ComputerUnselectedPanel,
|
|
1621
|
+
{
|
|
1622
|
+
peerCount: liveSessions.length,
|
|
1623
|
+
creating,
|
|
1624
|
+
error: createError,
|
|
1625
|
+
generationLoss: suppressGenericCreate,
|
|
1626
|
+
onCreate: createComputer
|
|
1627
|
+
}
|
|
1628
|
+
) : !controllerReady ? /* @__PURE__ */ jsx(
|
|
1629
|
+
ComputerLifecyclePanel,
|
|
1630
|
+
{
|
|
1631
|
+
session: selectedRegistrySession,
|
|
1632
|
+
creating,
|
|
1633
|
+
onRefresh: registry.refresh,
|
|
1634
|
+
onRetry: createComputer
|
|
1635
|
+
}
|
|
1636
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1637
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col @xl/computer-viewer:flex-row", children: [
|
|
1638
|
+
rfbStream ? /* @__PURE__ */ jsxs("div", { className: "relative min-h-0 flex-1 bg-black", onCopyCapture: copyFromRfb, children: [
|
|
1639
|
+
/* @__PURE__ */ jsx(
|
|
1640
|
+
DesktopViewer,
|
|
1641
|
+
{
|
|
1642
|
+
capability: rfbCapability,
|
|
1643
|
+
interactive: rfbInputEnabled,
|
|
1644
|
+
showControlToggle: false,
|
|
1645
|
+
webSocketProtocols: rfbStream.protocols,
|
|
1646
|
+
onPasteText: pasteIntoRfb,
|
|
1647
|
+
targetPlatform: computer.session?.platform ?? null,
|
|
1648
|
+
className: "h-full"
|
|
1649
|
+
}
|
|
1650
|
+
),
|
|
1651
|
+
!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: [
|
|
1652
|
+
t("computerViewer.desktopControlsUnavailable"),
|
|
1653
|
+
" ",
|
|
1654
|
+
/* @__PURE__ */ jsx(
|
|
1655
|
+
"button",
|
|
1656
|
+
{
|
|
1657
|
+
type: "button",
|
|
1658
|
+
onClick: reconnect,
|
|
1659
|
+
className: "pointer-events-auto ml-2 font-medium underline",
|
|
1660
|
+
children: t("computerViewer.reconnect")
|
|
1661
|
+
}
|
|
1662
|
+
)
|
|
1663
|
+
] }) : t("computerViewer.viewOnlyDirectInputUnavailable") }) : null
|
|
1664
|
+
] }) : /* @__PURE__ */ jsx(
|
|
1665
|
+
ComputerViewport,
|
|
1666
|
+
{
|
|
1667
|
+
frame: machineLocked ? null : displayedFrame,
|
|
1668
|
+
observation: computer.observation,
|
|
1669
|
+
target: computer.selectedTarget,
|
|
1670
|
+
machineLocked,
|
|
1671
|
+
controlUnavailable,
|
|
1672
|
+
inputAllowed: !inputDenied,
|
|
1673
|
+
connectionState,
|
|
1674
|
+
connectionError: computer.controlError ?? appInputPosture.error ?? frames.error ?? computer.error,
|
|
1675
|
+
mutating: computer.mutating,
|
|
1676
|
+
backgroundActions: computer.session?.capabilities?.backgroundActions === true,
|
|
1677
|
+
backgroundInput: computer.session?.capabilities?.backgroundInput === true,
|
|
1678
|
+
allowForegroundInputWithinOwnedSeat: computer.session?.platform === "linux" && computer.session.adapter === "opengeni.cua.linux.v1" && computer.session.seatId === `linux-virtual:${computer.session.id}` && Boolean(computer.session.displayId),
|
|
1679
|
+
clipboardEnabled: attachmentInputAllowed && computer.session?.capabilities?.clipboard === true,
|
|
1680
|
+
pointerInput: attachmentInputAllowed && computer.session?.capabilities?.pointerInput === true,
|
|
1681
|
+
pointerClickContinuation: attachmentInputAllowed && computer.session?.capabilities?.pointerClickContinuation === true,
|
|
1682
|
+
keyboardInput: attachmentInputAllowed && computer.session?.capabilities?.keyboardInput === true,
|
|
1683
|
+
onAction: perform,
|
|
1684
|
+
onReadClipboard: computer.readClipboard,
|
|
1685
|
+
onReconnect: generationLossSelected || generationLossFrames ? () => void 0 : reconnect,
|
|
1686
|
+
onError: (cause) => notifyError(cause, t("computerViewer.desktopInputFailed"))
|
|
1687
|
+
},
|
|
1688
|
+
JSON.stringify([
|
|
1689
|
+
selection?.sessionId,
|
|
1690
|
+
computer.selectedTarget?.id,
|
|
1691
|
+
computer.selectedTarget?.targetGeneration,
|
|
1692
|
+
frames.attachment?.controllerGeneration
|
|
1693
|
+
])
|
|
1694
|
+
),
|
|
1695
|
+
showControls ? /* @__PURE__ */ jsx(
|
|
1696
|
+
ComputerSemanticPanel,
|
|
1697
|
+
{
|
|
1698
|
+
observation: computer.observation,
|
|
1699
|
+
mutating: computer.mutating || controlUnavailable || inputDenied,
|
|
1700
|
+
controlUnavailable,
|
|
1701
|
+
inputAllowed: !inputDenied,
|
|
1702
|
+
onAction: (action) => void perform(action, null).catch(
|
|
1703
|
+
(cause) => notifyError(cause, t("computerViewer.desktopActionFailed"))
|
|
1704
|
+
)
|
|
1705
|
+
}
|
|
1706
|
+
) : null
|
|
1707
|
+
] }),
|
|
1708
|
+
/* @__PURE__ */ jsx(
|
|
1709
|
+
ComputerStatusBar,
|
|
1710
|
+
{
|
|
1711
|
+
session: computer.session,
|
|
1712
|
+
target: computer.selectedTarget,
|
|
1713
|
+
connectionState,
|
|
1714
|
+
controlUnavailable,
|
|
1715
|
+
inputAllowed: !inputDenied,
|
|
1716
|
+
refreshing: registry.refreshing,
|
|
1717
|
+
showControls,
|
|
1718
|
+
controlCount: semanticControls(t, computer.observation).length,
|
|
1719
|
+
onToggleControls: () => setShowControls((current) => !current)
|
|
1720
|
+
}
|
|
1721
|
+
)
|
|
1722
|
+
] })
|
|
1723
|
+
]
|
|
1724
|
+
}
|
|
1725
|
+
);
|
|
1726
|
+
}
|
|
1727
|
+
function ComputerUnselectedPanel(props) {
|
|
1728
|
+
const t = useOpenGeniText();
|
|
1729
|
+
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: [
|
|
1730
|
+
/* @__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" }) }),
|
|
1731
|
+
/* @__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") }),
|
|
1732
|
+
/* @__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 })) }),
|
|
1733
|
+
props.error && !props.generationLoss ? /* @__PURE__ */ jsxs(
|
|
1734
|
+
"button",
|
|
1735
|
+
{
|
|
1736
|
+
type: "button",
|
|
1737
|
+
disabled: props.creating,
|
|
1738
|
+
onClick: props.onCreate,
|
|
1739
|
+
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",
|
|
1740
|
+
children: [
|
|
1741
|
+
props.creating ? /* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ jsx(RotateCcwIcon, { className: "size-3.5" }),
|
|
1742
|
+
t("computerViewer.tryAgain")
|
|
1743
|
+
]
|
|
1744
|
+
}
|
|
1745
|
+
) : null
|
|
1746
|
+
] }) });
|
|
1747
|
+
}
|
|
1748
|
+
function ComputerToolbar(props) {
|
|
1749
|
+
const t = useOpenGeniText();
|
|
1750
|
+
const detailsRef = useViewerMenuDismiss();
|
|
1751
|
+
const selected = props.sessions.find((session) => session.id === props.selectedSessionId);
|
|
1752
|
+
const current = props.sessions.filter((session) => props.relevantSessionIds.has(session.id));
|
|
1753
|
+
const others = props.sessions.filter((session) => !props.relevantSessionIds.has(session.id));
|
|
1754
|
+
const closeMenu = (restoreFocus) => {
|
|
1755
|
+
detailsRef.current?.removeAttribute("open");
|
|
1756
|
+
if (restoreFocus) detailsRef.current?.querySelector("summary")?.focus();
|
|
1757
|
+
};
|
|
1758
|
+
const choose = (id, restoreFocus) => {
|
|
1759
|
+
props.onSelect(id);
|
|
1760
|
+
closeMenu(restoreFocus);
|
|
1761
|
+
};
|
|
1762
|
+
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: [
|
|
1763
|
+
/* @__PURE__ */ jsxs("details", { ref: detailsRef, className: "min-w-0", children: [
|
|
1764
|
+
/* @__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: [
|
|
1765
|
+
/* @__PURE__ */ jsx(MonitorIcon, { className: "size-3.5 shrink-0 text-og-fg-muted" }),
|
|
1766
|
+
/* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: selected?.name === "Computer" ? t("computerViewer.desktop") : selected?.name ?? t("computerViewer.desktop") }),
|
|
1767
|
+
(props.interventionCounts.get(selected?.id ?? "") ?? 0) > 0 ? /* @__PURE__ */ jsx("span", { className: "size-1.5 shrink-0 rounded-full bg-og-status-waiting" }) : null,
|
|
1768
|
+
/* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-3 shrink-0 text-og-fg-subtle" })
|
|
1769
|
+
] }),
|
|
1770
|
+
/* @__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: [
|
|
1771
|
+
/* @__PURE__ */ jsxs("div", { className: "min-h-0 max-h-96 overflow-y-auto overscroll-contain", children: [
|
|
1772
|
+
/* @__PURE__ */ jsx(
|
|
1773
|
+
ComputerSessionGroup,
|
|
1774
|
+
{
|
|
1775
|
+
label: t("computerViewer.currentAgent"),
|
|
1776
|
+
sessions: current,
|
|
1777
|
+
selectedId: props.selectedSessionId,
|
|
1778
|
+
interventionCounts: props.interventionCounts,
|
|
1779
|
+
onSelect: choose
|
|
1780
|
+
}
|
|
1781
|
+
),
|
|
1782
|
+
/* @__PURE__ */ jsx(
|
|
1783
|
+
ComputerSessionGroup,
|
|
1784
|
+
{
|
|
1785
|
+
label: t("computerViewer.otherAgents"),
|
|
1786
|
+
sessions: others,
|
|
1787
|
+
selectedId: props.selectedSessionId,
|
|
1788
|
+
interventionCounts: props.interventionCounts,
|
|
1789
|
+
onSelect: choose
|
|
1790
|
+
}
|
|
1791
|
+
)
|
|
1792
|
+
] }),
|
|
1793
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-1 flex shrink-0 gap-1 border-t border-og-border pt-1", children: [
|
|
1794
|
+
current.length > 0 ? /* @__PURE__ */ jsx(
|
|
1795
|
+
MenuButton,
|
|
1796
|
+
{
|
|
1797
|
+
onClick: (event) => {
|
|
1798
|
+
props.onFollow();
|
|
1799
|
+
closeMenu(event.detail === 0);
|
|
1800
|
+
},
|
|
1801
|
+
children: t("computerViewer.followAgent")
|
|
1802
|
+
}
|
|
1803
|
+
) : null,
|
|
1804
|
+
props.onCreate ? /* @__PURE__ */ jsxs(
|
|
1805
|
+
MenuButton,
|
|
1806
|
+
{
|
|
1807
|
+
onClick: (event) => {
|
|
1808
|
+
props.onCreate?.();
|
|
1809
|
+
closeMenu(event.detail === 0);
|
|
1810
|
+
},
|
|
1811
|
+
disabled: props.creating,
|
|
1812
|
+
children: [
|
|
1813
|
+
/* @__PURE__ */ jsx(PlusIcon, { className: "size-3.5" }),
|
|
1814
|
+
" ",
|
|
1815
|
+
t("computerViewer.newDesktop")
|
|
1816
|
+
]
|
|
1817
|
+
}
|
|
1818
|
+
) : null
|
|
1819
|
+
] })
|
|
1820
|
+
] })
|
|
1821
|
+
] }),
|
|
1822
|
+
/* @__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)}` : "" }),
|
|
1823
|
+
/* @__PURE__ */ jsx(
|
|
1824
|
+
ComputerTargetPicker,
|
|
1825
|
+
{
|
|
1826
|
+
targets: props.targets,
|
|
1827
|
+
selectedTargetId: props.selectedTargetId,
|
|
1828
|
+
loading: props.targetsLoading,
|
|
1829
|
+
onSelect: props.onSelectTarget
|
|
1830
|
+
}
|
|
1831
|
+
),
|
|
1832
|
+
/* @__PURE__ */ jsx(
|
|
1833
|
+
"button",
|
|
1834
|
+
{
|
|
1835
|
+
type: "button",
|
|
1836
|
+
onClick: props.onRefresh,
|
|
1837
|
+
disabled: props.refreshing,
|
|
1838
|
+
"aria-busy": props.refreshing,
|
|
1839
|
+
className: "grid size-7 place-items-center rounded-og-sm text-og-fg-muted transition hover:bg-og-surface-2 hover:text-og-fg",
|
|
1840
|
+
"aria-label": t("computerViewer.refreshDesktops"),
|
|
1841
|
+
children: /* @__PURE__ */ jsx(RefreshCwIcon, { className: cn("size-3.5", props.refreshing && "animate-spin") })
|
|
1842
|
+
}
|
|
1843
|
+
),
|
|
1844
|
+
props.onCreate ? /* @__PURE__ */ jsx(
|
|
1845
|
+
"button",
|
|
1846
|
+
{
|
|
1847
|
+
type: "button",
|
|
1848
|
+
onClick: props.onCreate,
|
|
1849
|
+
disabled: props.creating,
|
|
1850
|
+
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",
|
|
1851
|
+
"aria-label": t("computerViewer.openANewDesktop"),
|
|
1852
|
+
children: props.creating ? /* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ jsx(PlusIcon, { className: "size-3.5" })
|
|
1853
|
+
}
|
|
1854
|
+
) : null
|
|
1855
|
+
] });
|
|
1856
|
+
}
|
|
1857
|
+
function ComputerSessionGroup(props) {
|
|
1858
|
+
const t = useOpenGeniText();
|
|
1859
|
+
if (props.sessions.length === 0) return null;
|
|
1860
|
+
return /* @__PURE__ */ jsxs("div", { className: "py-1", children: [
|
|
1861
|
+
/* @__PURE__ */ jsx("p", { className: "px-2 pb-1 text-[10px] font-medium uppercase tracking-[0.12em] text-og-fg-subtle", children: props.label }),
|
|
1862
|
+
props.sessions.map((session) => {
|
|
1863
|
+
const interventionCount = props.interventionCounts.get(session.id) ?? 0;
|
|
1864
|
+
return /* @__PURE__ */ jsxs(
|
|
1865
|
+
"button",
|
|
1866
|
+
{
|
|
1867
|
+
type: "button",
|
|
1868
|
+
onClick: (event) => props.onSelect(session.id, event.detail === 0),
|
|
1869
|
+
"aria-pressed": session.id === props.selectedId,
|
|
1870
|
+
className: cn(
|
|
1871
|
+
"flex w-full items-center gap-2 rounded-og-sm px-2 py-1.5 text-left transition hover:bg-og-surface-2",
|
|
1872
|
+
session.id === props.selectedId && "bg-og-surface-2"
|
|
1873
|
+
),
|
|
1874
|
+
children: [
|
|
1875
|
+
/* @__PURE__ */ jsx(
|
|
1876
|
+
"span",
|
|
1877
|
+
{
|
|
1878
|
+
className: cn(
|
|
1879
|
+
"size-1.5 rounded-full",
|
|
1880
|
+
session.lifecycle === "active" ? "bg-og-status-running" : "bg-og-fg-subtle"
|
|
1881
|
+
)
|
|
1882
|
+
}
|
|
1883
|
+
),
|
|
1884
|
+
/* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
1885
|
+
/* @__PURE__ */ jsx("span", { className: "block truncate text-og-control text-og-fg", children: session.name }),
|
|
1886
|
+
/* @__PURE__ */ jsxs("span", { className: "block truncate text-og-xs text-og-fg-subtle", children: [
|
|
1887
|
+
platformLabel(t, session),
|
|
1888
|
+
" \xB7 ",
|
|
1889
|
+
placementLabel(t, session)
|
|
1890
|
+
] })
|
|
1891
|
+
] }),
|
|
1892
|
+
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
|
|
1893
|
+
]
|
|
1894
|
+
},
|
|
1895
|
+
session.id
|
|
1896
|
+
);
|
|
1897
|
+
})
|
|
1898
|
+
] });
|
|
1899
|
+
}
|
|
1900
|
+
function MenuButton(props) {
|
|
1901
|
+
return /* @__PURE__ */ jsx(
|
|
1902
|
+
"button",
|
|
1903
|
+
{
|
|
1904
|
+
type: "button",
|
|
1905
|
+
onClick: props.onClick,
|
|
1906
|
+
disabled: props.disabled,
|
|
1907
|
+
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",
|
|
1908
|
+
children: props.children
|
|
1909
|
+
}
|
|
1910
|
+
);
|
|
1911
|
+
}
|
|
1912
|
+
function ComputerTargetPicker(props) {
|
|
1913
|
+
const t = useOpenGeniText();
|
|
1914
|
+
const screens = props.targets.filter((target) => target.kind === "screen");
|
|
1915
|
+
const advancedTargets = props.targets.filter(
|
|
1916
|
+
(target) => target.kind === "app" || target.kind === "window" && isRenderableComputerView(target)
|
|
1917
|
+
);
|
|
1918
|
+
const advancedRef = useViewerMenuDismiss(advancedTargets.length > 0);
|
|
1919
|
+
const selected = props.targets.find((target) => target.id === props.selectedTargetId);
|
|
1920
|
+
const choose = (id, restoreFocus = false) => {
|
|
1921
|
+
props.onSelect(id);
|
|
1922
|
+
if (advancedRef.current?.open) {
|
|
1923
|
+
advancedRef.current.removeAttribute("open");
|
|
1924
|
+
if (restoreFocus) advancedRef.current.querySelector("summary")?.focus();
|
|
1925
|
+
}
|
|
1926
|
+
};
|
|
1927
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1928
|
+
screens.length > 1 ? /* @__PURE__ */ jsxs(
|
|
1929
|
+
"select",
|
|
1930
|
+
{
|
|
1931
|
+
"aria-label": t("computerViewer.screen"),
|
|
1932
|
+
value: selected?.kind === "screen" ? selected.id : "",
|
|
1933
|
+
onChange: (event) => choose(event.currentTarget.value),
|
|
1934
|
+
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",
|
|
1935
|
+
children: [
|
|
1936
|
+
/* @__PURE__ */ jsx("option", { value: "", disabled: true, hidden: true, children: t("computerViewer.screen") }),
|
|
1937
|
+
screens.map((screen, index) => /* @__PURE__ */ jsx("option", { value: screen.id, children: screen.title || t("computerViewer.screenIndex", { index: index + 1 }) }, screen.id))
|
|
1938
|
+
]
|
|
1939
|
+
}
|
|
1940
|
+
) : screens[0] && selected?.kind !== "screen" ? /* @__PURE__ */ jsxs(
|
|
1941
|
+
"button",
|
|
1942
|
+
{
|
|
1943
|
+
type: "button",
|
|
1944
|
+
onClick: () => choose(screens[0].id),
|
|
1945
|
+
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",
|
|
1946
|
+
children: [
|
|
1947
|
+
/* @__PURE__ */ jsx(MonitorIcon, { className: "size-3.5" }),
|
|
1948
|
+
" ",
|
|
1949
|
+
t("computerViewer.fullDesktop")
|
|
1950
|
+
]
|
|
1951
|
+
}
|
|
1952
|
+
) : null,
|
|
1953
|
+
advancedTargets.length > 0 ? /* @__PURE__ */ jsxs("details", { ref: advancedRef, className: "shrink-0", children: [
|
|
1954
|
+
/* @__PURE__ */ jsxs(
|
|
1955
|
+
"summary",
|
|
1956
|
+
{
|
|
1957
|
+
"aria-label": t("computerViewer.advancedDesktopViews"),
|
|
1958
|
+
title: t("computerViewer.advancedDesktopViews"),
|
|
1959
|
+
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",
|
|
1960
|
+
children: [
|
|
1961
|
+
/* @__PURE__ */ jsx(PanelsTopLeftIcon, { className: "size-3.5" }),
|
|
1962
|
+
/* @__PURE__ */ jsx("span", { className: "hidden @sm/computer-viewer:inline", children: t("computerViewer.advanced") }),
|
|
1963
|
+
/* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-3" })
|
|
1964
|
+
]
|
|
1965
|
+
}
|
|
1966
|
+
),
|
|
1967
|
+
/* @__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: [
|
|
1968
|
+
/* @__PURE__ */ jsx("p", { className: "shrink-0 px-2 py-1 text-og-xs text-og-fg-subtle", children: t("computerViewer.appsAndWindows") }),
|
|
1969
|
+
/* @__PURE__ */ jsx("div", { className: "min-h-0 max-h-80 overflow-y-auto overscroll-contain", children: advancedTargets.map((target) => /* @__PURE__ */ jsxs(
|
|
1970
|
+
"button",
|
|
1971
|
+
{
|
|
1972
|
+
type: "button",
|
|
1973
|
+
onClick: (event) => choose(target.id, event.detail === 0),
|
|
1974
|
+
"aria-pressed": target.id === props.selectedTargetId,
|
|
1975
|
+
className: cn(
|
|
1976
|
+
"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",
|
|
1977
|
+
target.id === props.selectedTargetId && "bg-og-surface-2"
|
|
1978
|
+
),
|
|
1979
|
+
children: [
|
|
1980
|
+
/* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
1981
|
+
/* @__PURE__ */ jsx("span", { className: "block truncate text-og-control text-og-fg", children: target.title || target.applicationId || target.kind }),
|
|
1982
|
+
/* @__PURE__ */ jsx("span", { className: "block text-og-xs text-og-fg-subtle", children: target.kind === "app" ? t("computerViewer.appControls") : t("computerViewer.windowView") })
|
|
1983
|
+
] }),
|
|
1984
|
+
target.focused ? /* @__PURE__ */ jsx(
|
|
1985
|
+
"span",
|
|
1986
|
+
{
|
|
1987
|
+
className: "size-1.5 shrink-0 rounded-full bg-og-status-running",
|
|
1988
|
+
"aria-label": t("computerViewer.focused")
|
|
1989
|
+
}
|
|
1990
|
+
) : null
|
|
1991
|
+
]
|
|
1992
|
+
},
|
|
1993
|
+
target.id
|
|
1994
|
+
)) })
|
|
1995
|
+
] })
|
|
1996
|
+
] }) : null,
|
|
1997
|
+
props.loading ? /* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-3.5 shrink-0 animate-spin text-og-fg-muted" }) : null
|
|
1998
|
+
] });
|
|
1999
|
+
}
|
|
2000
|
+
function isRenderableComputerView(target) {
|
|
2001
|
+
if (target.kind === "screen") return true;
|
|
2002
|
+
if (target.kind !== "window" || !target.bounds) return false;
|
|
2003
|
+
return target.bounds.width >= 160 && target.bounds.height >= 90;
|
|
2004
|
+
}
|
|
2005
|
+
function isComputerFrameTarget(target) {
|
|
2006
|
+
return target.kind === "window" || target.kind === "screen";
|
|
2007
|
+
}
|
|
2008
|
+
function ComputerLifecyclePanel(props) {
|
|
2009
|
+
const t = useOpenGeniText();
|
|
2010
|
+
const generationLoss = isAttachedChromeGenerationLoss(props.session);
|
|
2011
|
+
const failed = ["failed", "lost", "repair_required"].includes(props.session.lifecycle);
|
|
2012
|
+
const retryCreatesSession = ["failed", "lost"].includes(props.session.lifecycle);
|
|
2013
|
+
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: [
|
|
2014
|
+
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" }),
|
|
2015
|
+
/* @__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) }),
|
|
2016
|
+
/* @__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") }),
|
|
2017
|
+
failed && !generationLoss ? /* @__PURE__ */ jsxs(
|
|
2018
|
+
"button",
|
|
2019
|
+
{
|
|
2020
|
+
type: "button",
|
|
2021
|
+
onClick: () => retryCreatesSession ? props.onRetry() : void props.onRefresh(),
|
|
2022
|
+
disabled: props.creating,
|
|
2023
|
+
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",
|
|
2024
|
+
children: [
|
|
2025
|
+
props.creating ? /* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ jsx(RotateCcwIcon, { className: "size-3.5" }),
|
|
2026
|
+
retryCreatesSession ? t("computerViewer.tryAgain") : t("computerViewer.checkAgain")
|
|
2027
|
+
]
|
|
2028
|
+
}
|
|
2029
|
+
) : null
|
|
2030
|
+
] }) });
|
|
2031
|
+
}
|
|
2032
|
+
function ComputerViewport(props) {
|
|
2033
|
+
const t = useOpenGeniText();
|
|
2034
|
+
const canvasRef = useRef5(null);
|
|
2035
|
+
const inputRef = useRef5(null);
|
|
2036
|
+
const composingRef = useRef5(false);
|
|
2037
|
+
const pointerStartRef = useRef5(null);
|
|
2038
|
+
const clickTimerRef = useRef5(null);
|
|
2039
|
+
const lastClickRef = useRef5(null);
|
|
2040
|
+
const wheelRef = useRef5(null);
|
|
2041
|
+
const pendingTextRef = useRef5(null);
|
|
2042
|
+
const actionRef = useRef5(props.onAction);
|
|
2043
|
+
const targetRef = useRef5(props.target);
|
|
2044
|
+
const readClipboardRef = useRef5(props.onReadClipboard);
|
|
2045
|
+
const errorRef = useRef5(props.onError);
|
|
2046
|
+
const actionTailRef = useRef5(Promise.resolve());
|
|
2047
|
+
const actionQueueEpochRef = useRef5(0);
|
|
2048
|
+
const queuedTextRef = useRef5(null);
|
|
2049
|
+
const queuedFrameRef = useRef5(null);
|
|
2050
|
+
const currentFrameRef = useRef5(props.frame);
|
|
2051
|
+
const paintedFrameRef = useRef5(null);
|
|
2052
|
+
const [paintedFrame, setPaintedFrame] = useState5(null);
|
|
2053
|
+
const decodingFrameRef = useRef5(false);
|
|
2054
|
+
const mountedRef = useRef5(true);
|
|
2055
|
+
actionRef.current = props.onAction;
|
|
2056
|
+
targetRef.current = props.target;
|
|
2057
|
+
readClipboardRef.current = props.onReadClipboard;
|
|
2058
|
+
errorRef.current = props.onError;
|
|
2059
|
+
const streamFailed = props.connectionState === "error";
|
|
2060
|
+
const rawInputEnabled = props.target?.kind !== "app" && !streamFailed && !props.controlUnavailable && !props.machineLocked && (props.backgroundInput || // CUA may activate within its allocated Linux desktop. This does not
|
|
2061
|
+
// grant foreground input to an attached physical desktop.
|
|
2062
|
+
props.allowForegroundInputWithinOwnedSeat || !props.backgroundActions || props.target?.kind === "screen" || props.target?.focused === true);
|
|
2063
|
+
const clearBufferedInput = useCallback5(() => {
|
|
2064
|
+
if (clickTimerRef.current) clearTimeout(clickTimerRef.current);
|
|
2065
|
+
if (wheelRef.current?.timer) clearTimeout(wheelRef.current.timer);
|
|
2066
|
+
if (pendingTextRef.current?.timer) clearTimeout(pendingTextRef.current.timer);
|
|
2067
|
+
clickTimerRef.current = null;
|
|
2068
|
+
wheelRef.current = null;
|
|
2069
|
+
pendingTextRef.current = null;
|
|
2070
|
+
queuedTextRef.current = null;
|
|
2071
|
+
pointerStartRef.current = null;
|
|
2072
|
+
lastClickRef.current = null;
|
|
2073
|
+
composingRef.current = false;
|
|
2074
|
+
if (inputRef.current) inputRef.current.value = "";
|
|
2075
|
+
}, []);
|
|
2076
|
+
const pointerInputEnabled = rawInputEnabled && props.pointerInput;
|
|
2077
|
+
const keyboardInputEnabled = rawInputEnabled && props.keyboardInput;
|
|
2078
|
+
useLayoutEffect(() => {
|
|
2079
|
+
const canvas = canvasRef.current;
|
|
2080
|
+
const viewport = canvas?.parentElement;
|
|
2081
|
+
if (!canvas || !viewport) return;
|
|
2082
|
+
const fit = () => fitComputerCanvas(canvas);
|
|
2083
|
+
fit();
|
|
2084
|
+
if (typeof ResizeObserver === "undefined") {
|
|
2085
|
+
window.addEventListener("resize", fit);
|
|
2086
|
+
return () => window.removeEventListener("resize", fit);
|
|
2087
|
+
}
|
|
2088
|
+
const observer = new ResizeObserver(fit);
|
|
2089
|
+
observer.observe(viewport);
|
|
2090
|
+
return () => observer.disconnect();
|
|
2091
|
+
}, []);
|
|
2092
|
+
const paintQueuedFrames = useCallback5(() => {
|
|
2093
|
+
if (decodingFrameRef.current) return;
|
|
2094
|
+
decodingFrameRef.current = true;
|
|
2095
|
+
void (async () => {
|
|
2096
|
+
try {
|
|
2097
|
+
while (mountedRef.current) {
|
|
2098
|
+
const frame = queuedFrameRef.current;
|
|
2099
|
+
queuedFrameRef.current = null;
|
|
2100
|
+
if (!frame) break;
|
|
2101
|
+
let objectUrl = null;
|
|
2102
|
+
try {
|
|
2103
|
+
const blob = new Blob([frame.data.slice().buffer], { type: frame.mediaType });
|
|
2104
|
+
if (typeof createImageBitmap === "function") {
|
|
2105
|
+
const bitmap = await createImageBitmap(blob);
|
|
2106
|
+
try {
|
|
2107
|
+
const canvas2 = canvasRef.current;
|
|
2108
|
+
if (mountedRef.current && canvas2 && currentFrameRef.current && sameComputerTarget(frame, currentFrameRef.current)) {
|
|
2109
|
+
paintCanvas(canvas2, bitmap, frame.width, frame.height);
|
|
2110
|
+
paintedFrameRef.current = frame;
|
|
2111
|
+
setPaintedFrame(frame);
|
|
2112
|
+
}
|
|
2113
|
+
} finally {
|
|
2114
|
+
bitmap.close();
|
|
2115
|
+
}
|
|
2116
|
+
continue;
|
|
2117
|
+
}
|
|
2118
|
+
objectUrl = URL.createObjectURL(blob);
|
|
2119
|
+
const image = await loadImage(objectUrl);
|
|
2120
|
+
const canvas = canvasRef.current;
|
|
2121
|
+
if (mountedRef.current && canvas && currentFrameRef.current && sameComputerTarget(frame, currentFrameRef.current)) {
|
|
2122
|
+
paintCanvas(canvas, image, frame.width, frame.height);
|
|
2123
|
+
paintedFrameRef.current = frame;
|
|
2124
|
+
setPaintedFrame(frame);
|
|
2125
|
+
}
|
|
2126
|
+
} catch (cause) {
|
|
2127
|
+
if (mountedRef.current && currentFrameRef.current && sameComputerTarget(frame, currentFrameRef.current))
|
|
2128
|
+
errorRef.current(cause);
|
|
2129
|
+
} finally {
|
|
2130
|
+
if (objectUrl) URL.revokeObjectURL(objectUrl);
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
} finally {
|
|
2134
|
+
decodingFrameRef.current = false;
|
|
2135
|
+
if (mountedRef.current && queuedFrameRef.current) paintQueuedFrames();
|
|
2136
|
+
}
|
|
2137
|
+
})();
|
|
2138
|
+
}, []);
|
|
2139
|
+
useLayoutEffect(() => {
|
|
2140
|
+
mountedRef.current = true;
|
|
2141
|
+
return () => {
|
|
2142
|
+
mountedRef.current = false;
|
|
2143
|
+
actionQueueEpochRef.current += 1;
|
|
2144
|
+
queuedFrameRef.current = null;
|
|
2145
|
+
clearBufferedInput();
|
|
2146
|
+
};
|
|
2147
|
+
}, [clearBufferedInput]);
|
|
2148
|
+
useLayoutEffect(() => {
|
|
2149
|
+
if (currentFrameRef.current && !props.frame) {
|
|
2150
|
+
actionQueueEpochRef.current += 1;
|
|
2151
|
+
clearBufferedInput();
|
|
2152
|
+
}
|
|
2153
|
+
currentFrameRef.current = props.frame;
|
|
2154
|
+
if (!props.frame) {
|
|
2155
|
+
queuedFrameRef.current = null;
|
|
2156
|
+
paintedFrameRef.current = null;
|
|
2157
|
+
setPaintedFrame(null);
|
|
2158
|
+
return;
|
|
2159
|
+
}
|
|
2160
|
+
queuedFrameRef.current = props.frame;
|
|
2161
|
+
paintQueuedFrames();
|
|
2162
|
+
}, [clearBufferedInput, paintQueuedFrames, props.frame]);
|
|
2163
|
+
useLayoutEffect(() => {
|
|
2164
|
+
if (!rawInputEnabled || !props.pointerInput || !props.keyboardInput) {
|
|
2165
|
+
actionQueueEpochRef.current += 1;
|
|
2166
|
+
clearBufferedInput();
|
|
2167
|
+
}
|
|
2168
|
+
}, [clearBufferedInput, props.keyboardInput, props.pointerInput, rawInputEnabled]);
|
|
2169
|
+
const enqueue = useCallback5(
|
|
2170
|
+
(action, frame, after, continuation) => {
|
|
2171
|
+
const epoch = actionQueueEpochRef.current;
|
|
2172
|
+
const plainText = action.type === "keyboard" && action.action === "type";
|
|
2173
|
+
const queuedText = queuedTextRef.current;
|
|
2174
|
+
if (plainText && !frame && !after && !continuation && queuedText?.epoch === epoch && queuedText.delivery.completion === actionTailRef.current && queuedText.action.value.length + action.value.length <= 1e6) {
|
|
2175
|
+
queuedText.action.value += action.value;
|
|
2176
|
+
return queuedText.delivery;
|
|
2177
|
+
}
|
|
2178
|
+
queuedTextRef.current = null;
|
|
2179
|
+
const dispatch = actionRef.current;
|
|
2180
|
+
const admittedTarget = targetRef.current;
|
|
2181
|
+
const isCurrent = () => mountedRef.current && epoch === actionQueueEpochRef.current;
|
|
2182
|
+
const operationId = crypto.randomUUID();
|
|
2183
|
+
let markStarted;
|
|
2184
|
+
const started = new Promise((resolve) => {
|
|
2185
|
+
markStarted = resolve;
|
|
2186
|
+
});
|
|
2187
|
+
const previous = actionTailRef.current;
|
|
2188
|
+
const ready = continuation && previous === continuation.completion ? continuation.started : previous.then(() => true);
|
|
2189
|
+
const delivery = ready.then(async (firstStarted) => {
|
|
2190
|
+
if (queuedTextRef.current?.action === action) queuedTextRef.current = null;
|
|
2191
|
+
if (!firstStarted || !isCurrent()) {
|
|
2192
|
+
markStarted(false);
|
|
2193
|
+
return;
|
|
2194
|
+
}
|
|
2195
|
+
const pending = dispatch(action, frame, operationId);
|
|
2196
|
+
markStarted(true);
|
|
2197
|
+
const receipt = await pending;
|
|
2198
|
+
const isCurrentResult = () => isCurrent() && !isStaleComputerActionResult(receipt);
|
|
2199
|
+
if (!isCurrentResult()) return;
|
|
2200
|
+
const observedTarget = receipt.observation?.target;
|
|
2201
|
+
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)) {
|
|
2202
|
+
actionQueueEpochRef.current += 1;
|
|
2203
|
+
clearBufferedInput();
|
|
2204
|
+
return;
|
|
2205
|
+
}
|
|
2206
|
+
await after?.(isCurrentResult);
|
|
2207
|
+
}).catch((cause) => {
|
|
2208
|
+
markStarted(false);
|
|
2209
|
+
if (!isCurrent() || isStaleComputerActionResult(cause)) return;
|
|
2210
|
+
actionQueueEpochRef.current += 1;
|
|
2211
|
+
clearBufferedInput();
|
|
2212
|
+
errorRef.current(cause);
|
|
2213
|
+
});
|
|
2214
|
+
const completion = continuation ? Promise.all([previous, delivery]).then(() => void 0) : delivery;
|
|
2215
|
+
actionTailRef.current = completion;
|
|
2216
|
+
const queued = { operationId, started, completion };
|
|
2217
|
+
if (plainText && !frame && !after && !continuation) {
|
|
2218
|
+
queuedTextRef.current = { action, epoch, delivery: queued };
|
|
2219
|
+
}
|
|
2220
|
+
return queued;
|
|
2221
|
+
},
|
|
2222
|
+
[clearBufferedInput]
|
|
2223
|
+
);
|
|
2224
|
+
const point = useCallback5(
|
|
2225
|
+
(frame, clientX, clientY) => computerPoint(canvasRef.current, frame, clientX, clientY),
|
|
2226
|
+
[]
|
|
2227
|
+
);
|
|
2228
|
+
const flushPendingText = useCallback5(() => {
|
|
2229
|
+
const pending = pendingTextRef.current;
|
|
2230
|
+
if (!pending) return;
|
|
2231
|
+
clearTimeout(pending.timer);
|
|
2232
|
+
pendingTextRef.current = null;
|
|
2233
|
+
enqueue({ type: "keyboard", action: "type", value: pending.text }, null);
|
|
2234
|
+
}, [enqueue]);
|
|
2235
|
+
const flushPendingClick = useCallback5(() => {
|
|
2236
|
+
const pending = lastClickRef.current;
|
|
2237
|
+
if (!pending) return;
|
|
2238
|
+
if (clickTimerRef.current) clearTimeout(clickTimerRef.current);
|
|
2239
|
+
clickTimerRef.current = null;
|
|
2240
|
+
lastClickRef.current = null;
|
|
2241
|
+
if (!pending.pending) return;
|
|
2242
|
+
enqueue(
|
|
2243
|
+
{
|
|
2244
|
+
type: "pointer",
|
|
2245
|
+
frameId: pending.frame.frameId,
|
|
2246
|
+
action: "click",
|
|
2247
|
+
x: pending.x,
|
|
2248
|
+
y: pending.y
|
|
2249
|
+
},
|
|
2250
|
+
pending.frame
|
|
2251
|
+
);
|
|
2252
|
+
}, [enqueue]);
|
|
2253
|
+
const flushPendingWheel = useCallback5(() => {
|
|
2254
|
+
const batch = wheelRef.current;
|
|
2255
|
+
if (!batch) return;
|
|
2256
|
+
if (batch.timer) clearTimeout(batch.timer);
|
|
2257
|
+
wheelRef.current = null;
|
|
2258
|
+
enqueue(
|
|
2259
|
+
{
|
|
2260
|
+
type: "pointer",
|
|
2261
|
+
frameId: batch.frame.frameId,
|
|
2262
|
+
action: "scroll",
|
|
2263
|
+
x: batch.x,
|
|
2264
|
+
y: batch.y,
|
|
2265
|
+
deltaX: batch.deltaX,
|
|
2266
|
+
deltaY: batch.deltaY
|
|
2267
|
+
},
|
|
2268
|
+
batch.frame
|
|
2269
|
+
);
|
|
2270
|
+
}, [enqueue]);
|
|
2271
|
+
const pointerDown = (event) => {
|
|
2272
|
+
const frame = paintedFrameRef.current;
|
|
2273
|
+
if (!frame || !props.pointerClickContinuation && props.mutating || !rawInputEnabled || event.button !== 0)
|
|
2274
|
+
return;
|
|
2275
|
+
event.preventDefault();
|
|
2276
|
+
if (keyboardInputEnabled) inputRef.current?.focus({ preventScroll: true });
|
|
2277
|
+
if (!pointerInputEnabled) return;
|
|
2278
|
+
flushPendingWheel();
|
|
2279
|
+
flushPendingText();
|
|
2280
|
+
pointerStartRef.current = {
|
|
2281
|
+
x: event.clientX,
|
|
2282
|
+
y: event.clientY,
|
|
2283
|
+
pointerId: event.pointerId,
|
|
2284
|
+
frame
|
|
2285
|
+
};
|
|
2286
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
2287
|
+
};
|
|
2288
|
+
const pointerUp = (event) => {
|
|
2289
|
+
if (!pointerInputEnabled) return;
|
|
2290
|
+
const start = pointerStartRef.current;
|
|
2291
|
+
pointerStartRef.current = null;
|
|
2292
|
+
if (!start || start.pointerId !== event.pointerId) return;
|
|
2293
|
+
const canvasRect = event.currentTarget.getBoundingClientRect();
|
|
2294
|
+
const from = point(start.frame, start.x, start.y);
|
|
2295
|
+
const to = point(start.frame, event.clientX, event.clientY);
|
|
2296
|
+
if (!from || !to) return;
|
|
2297
|
+
if (Math.hypot(event.clientX - start.x, event.clientY - start.y) > 5) {
|
|
2298
|
+
flushPendingClick();
|
|
2299
|
+
enqueue(
|
|
2300
|
+
{
|
|
2301
|
+
type: "pointer",
|
|
2302
|
+
frameId: start.frame.frameId,
|
|
2303
|
+
action: "drag",
|
|
2304
|
+
x: from.x,
|
|
2305
|
+
y: from.y,
|
|
2306
|
+
endX: to.x,
|
|
2307
|
+
endY: to.y
|
|
2308
|
+
},
|
|
2309
|
+
start.frame
|
|
2310
|
+
);
|
|
2311
|
+
return;
|
|
2312
|
+
}
|
|
2313
|
+
const now = Date.now();
|
|
2314
|
+
const previous = lastClickRef.current;
|
|
2315
|
+
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))) {
|
|
2316
|
+
if (clickTimerRef.current) clearTimeout(clickTimerRef.current);
|
|
2317
|
+
clickTimerRef.current = null;
|
|
2318
|
+
lastClickRef.current = null;
|
|
2319
|
+
enqueue(
|
|
2320
|
+
{
|
|
2321
|
+
type: "pointer",
|
|
2322
|
+
frameId: start.frame.frameId,
|
|
2323
|
+
action: props.pointerClickContinuation ? "click" : "double_click",
|
|
2324
|
+
...props.pointerClickContinuation ? { clickCount: 2 } : {},
|
|
2325
|
+
...previous.delivery ? { continuationOfOperationId: previous.delivery.operationId } : {},
|
|
2326
|
+
x: to.x,
|
|
2327
|
+
y: to.y
|
|
2328
|
+
},
|
|
2329
|
+
start.frame,
|
|
2330
|
+
void 0,
|
|
2331
|
+
previous.delivery ?? void 0
|
|
2332
|
+
);
|
|
2333
|
+
return;
|
|
2334
|
+
}
|
|
2335
|
+
flushPendingClick();
|
|
2336
|
+
lastClickRef.current = {
|
|
2337
|
+
at: now,
|
|
2338
|
+
x: to.x,
|
|
2339
|
+
y: to.y,
|
|
2340
|
+
frame: start.frame,
|
|
2341
|
+
clientX: event.clientX,
|
|
2342
|
+
clientY: event.clientY,
|
|
2343
|
+
canvasRect,
|
|
2344
|
+
pending: !props.pointerClickContinuation,
|
|
2345
|
+
delivery: null
|
|
2346
|
+
};
|
|
2347
|
+
if (props.pointerClickContinuation) {
|
|
2348
|
+
const delivery = enqueue(
|
|
2349
|
+
{
|
|
2350
|
+
type: "pointer",
|
|
2351
|
+
frameId: start.frame.frameId,
|
|
2352
|
+
action: "click",
|
|
2353
|
+
clickCount: 1,
|
|
2354
|
+
x: to.x,
|
|
2355
|
+
y: to.y
|
|
2356
|
+
},
|
|
2357
|
+
start.frame
|
|
2358
|
+
);
|
|
2359
|
+
if (lastClickRef.current) lastClickRef.current.delivery = delivery;
|
|
2360
|
+
return;
|
|
2361
|
+
}
|
|
2362
|
+
clickTimerRef.current = setTimeout(() => {
|
|
2363
|
+
clickTimerRef.current = null;
|
|
2364
|
+
lastClickRef.current = null;
|
|
2365
|
+
enqueue(
|
|
2366
|
+
{
|
|
2367
|
+
type: "pointer",
|
|
2368
|
+
frameId: start.frame.frameId,
|
|
2369
|
+
action: "click",
|
|
2370
|
+
x: to.x,
|
|
2371
|
+
y: to.y
|
|
2372
|
+
},
|
|
2373
|
+
start.frame
|
|
2374
|
+
);
|
|
2375
|
+
}, 280);
|
|
2376
|
+
};
|
|
2377
|
+
const contextMenu = (event) => {
|
|
2378
|
+
event.preventDefault();
|
|
2379
|
+
if (!pointerInputEnabled) return;
|
|
2380
|
+
const frame = paintedFrameRef.current;
|
|
2381
|
+
if (!frame) return;
|
|
2382
|
+
flushPendingWheel();
|
|
2383
|
+
flushPendingText();
|
|
2384
|
+
flushPendingClick();
|
|
2385
|
+
const at = point(frame, event.clientX, event.clientY);
|
|
2386
|
+
if (at) {
|
|
2387
|
+
enqueue(
|
|
2388
|
+
{
|
|
2389
|
+
type: "pointer",
|
|
2390
|
+
frameId: frame.frameId,
|
|
2391
|
+
action: "click",
|
|
2392
|
+
x: at.x,
|
|
2393
|
+
y: at.y,
|
|
2394
|
+
button: "right"
|
|
2395
|
+
},
|
|
2396
|
+
frame
|
|
2397
|
+
);
|
|
2398
|
+
}
|
|
2399
|
+
};
|
|
2400
|
+
const wheel = (event) => {
|
|
2401
|
+
if (!pointerInputEnabled) return;
|
|
2402
|
+
const frame = paintedFrameRef.current;
|
|
2403
|
+
if (!frame) return;
|
|
2404
|
+
const at = point(frame, event.clientX, event.clientY);
|
|
2405
|
+
if (!at) return;
|
|
2406
|
+
flushPendingText();
|
|
2407
|
+
flushPendingClick();
|
|
2408
|
+
event.preventDefault();
|
|
2409
|
+
let pending = wheelRef.current;
|
|
2410
|
+
if (pending && (!sameComputerTarget(pending.frame, frame) || Math.hypot(pending.x - at.x, pending.y - at.y) > 6)) {
|
|
2411
|
+
flushPendingWheel();
|
|
2412
|
+
pending = null;
|
|
2413
|
+
}
|
|
2414
|
+
wheelRef.current = {
|
|
2415
|
+
x: at.x,
|
|
2416
|
+
y: at.y,
|
|
2417
|
+
deltaX: (pending?.deltaX ?? 0) + event.deltaX,
|
|
2418
|
+
deltaY: (pending?.deltaY ?? 0) + event.deltaY,
|
|
2419
|
+
frame,
|
|
2420
|
+
timer: pending?.timer ?? setTimeout(flushPendingWheel, 45)
|
|
2421
|
+
};
|
|
2422
|
+
};
|
|
2423
|
+
const keyDown = (event) => {
|
|
2424
|
+
if (!keyboardInputEnabled) return;
|
|
2425
|
+
if (composingRef.current || event.nativeEvent.isComposing || event.nativeEvent.keyCode === 229) {
|
|
2426
|
+
return;
|
|
2427
|
+
}
|
|
2428
|
+
flushPendingWheel();
|
|
2429
|
+
const command = event.metaKey || event.ctrlKey;
|
|
2430
|
+
if (props.clipboardEnabled && command && !event.altKey && ["c", "v"].includes(event.key.toLowerCase())) {
|
|
2431
|
+
flushPendingText();
|
|
2432
|
+
return;
|
|
2433
|
+
}
|
|
2434
|
+
const key = computerKey(event);
|
|
2435
|
+
if (!key) return;
|
|
2436
|
+
event.preventDefault();
|
|
2437
|
+
flushPendingText();
|
|
2438
|
+
flushPendingClick();
|
|
2439
|
+
enqueue({ type: "keyboard", action: "press", value: key }, null);
|
|
2440
|
+
};
|
|
2441
|
+
const copy = (event) => {
|
|
2442
|
+
if (!props.clipboardEnabled || !keyboardInputEnabled) return;
|
|
2443
|
+
event.preventDefault();
|
|
2444
|
+
flushPendingWheel();
|
|
2445
|
+
flushPendingText();
|
|
2446
|
+
flushPendingClick();
|
|
2447
|
+
const readClipboard = readClipboardRef.current;
|
|
2448
|
+
enqueue({ type: "clipboard", operation: "copy" }, null, async (isCurrent) => {
|
|
2449
|
+
const clipboard = await readClipboard();
|
|
2450
|
+
if (!isCurrent()) return;
|
|
2451
|
+
if (!clipboard.text) return;
|
|
2452
|
+
if (!await copyTextToClipboard(clipboard.text)) {
|
|
2453
|
+
throw new Error(t("computerViewer.desktopTextCouldNotBe"));
|
|
2454
|
+
}
|
|
2455
|
+
});
|
|
2456
|
+
};
|
|
2457
|
+
const paste = (event) => {
|
|
2458
|
+
if (!props.clipboardEnabled || !keyboardInputEnabled) return;
|
|
2459
|
+
event.preventDefault();
|
|
2460
|
+
flushPendingWheel();
|
|
2461
|
+
flushPendingText();
|
|
2462
|
+
flushPendingClick();
|
|
2463
|
+
const text = event.clipboardData.getData("text/plain");
|
|
2464
|
+
const readClipboard = readClipboardRef.current;
|
|
2465
|
+
const dispatch = actionRef.current;
|
|
2466
|
+
enqueue({ type: "clipboard", operation: "write", text }, null, async (isCurrent) => {
|
|
2467
|
+
const clipboard = await readClipboard();
|
|
2468
|
+
if (!isCurrent()) return;
|
|
2469
|
+
assertExactComputerClipboard(t, clipboard, text);
|
|
2470
|
+
await dispatch({ type: "clipboard", operation: "paste" }, null);
|
|
2471
|
+
});
|
|
2472
|
+
};
|
|
2473
|
+
const input = (value, nativeComposing = false) => {
|
|
2474
|
+
if (composingRef.current || nativeComposing) return;
|
|
2475
|
+
if (!value || !keyboardInputEnabled) return;
|
|
2476
|
+
flushPendingWheel();
|
|
2477
|
+
flushPendingClick();
|
|
2478
|
+
const pending = pendingTextRef.current;
|
|
2479
|
+
if (pending) {
|
|
2480
|
+
clearTimeout(pending.timer);
|
|
2481
|
+
pending.text += value;
|
|
2482
|
+
pending.timer = setTimeout(flushPendingText, 16);
|
|
2483
|
+
} else {
|
|
2484
|
+
pendingTextRef.current = {
|
|
2485
|
+
text: value,
|
|
2486
|
+
timer: setTimeout(flushPendingText, 16)
|
|
2487
|
+
};
|
|
2488
|
+
}
|
|
2489
|
+
if (inputRef.current) inputRef.current.value = "";
|
|
2490
|
+
};
|
|
2491
|
+
const compositionEnd = (event) => {
|
|
2492
|
+
composingRef.current = false;
|
|
2493
|
+
input(event.currentTarget.value || event.data);
|
|
2494
|
+
};
|
|
2495
|
+
const showCanvas = props.frame !== null && paintedFrame !== null && sameComputerTarget(props.frame, paintedFrame) && !props.machineLocked && !streamFailed;
|
|
2496
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative min-h-0 flex-1 overflow-hidden bg-black", children: [
|
|
2497
|
+
/* @__PURE__ */ jsx(
|
|
2498
|
+
"canvas",
|
|
2499
|
+
{
|
|
2500
|
+
ref: canvasRef,
|
|
2501
|
+
className: cn(
|
|
2502
|
+
"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",
|
|
2503
|
+
!showCanvas && "invisible",
|
|
2504
|
+
!pointerInputEnabled && "cursor-default"
|
|
2505
|
+
),
|
|
2506
|
+
onPointerDown: pointerDown,
|
|
2507
|
+
onPointerUp: pointerUp,
|
|
2508
|
+
onPointerCancel: () => {
|
|
2509
|
+
pointerStartRef.current = null;
|
|
2510
|
+
},
|
|
2511
|
+
onContextMenu: contextMenu,
|
|
2512
|
+
onWheel: wheel,
|
|
2513
|
+
"aria-label": t(
|
|
2514
|
+
props.target?.kind === "app" ? "computerViewer.interactiveAppView" : props.target?.kind === "window" ? "computerViewer.interactiveWindowView" : props.target?.kind === "screen" ? "computerViewer.interactiveScreenView" : "computerViewer.interactiveDesktopView"
|
|
2515
|
+
)
|
|
2516
|
+
}
|
|
2517
|
+
),
|
|
2518
|
+
/* @__PURE__ */ jsx(
|
|
2519
|
+
"textarea",
|
|
2520
|
+
{
|
|
2521
|
+
ref: inputRef,
|
|
2522
|
+
defaultValue: "",
|
|
2523
|
+
onInput: (event) => input(event.currentTarget.value, event.nativeEvent.isComposing),
|
|
2524
|
+
onCompositionStart: () => {
|
|
2525
|
+
composingRef.current = true;
|
|
2526
|
+
},
|
|
2527
|
+
onCompositionEnd: compositionEnd,
|
|
2528
|
+
onKeyDown: keyDown,
|
|
2529
|
+
onCopy: copy,
|
|
2530
|
+
onPaste: paste,
|
|
2531
|
+
className: "pointer-events-none absolute left-1/2 top-1/2 size-px resize-none overflow-hidden opacity-0",
|
|
2532
|
+
"aria-label": t("computerViewer.desktopKeyboardInput"),
|
|
2533
|
+
autoCapitalize: "off",
|
|
2534
|
+
autoCorrect: "off",
|
|
2535
|
+
spellCheck: false,
|
|
2536
|
+
disabled: !keyboardInputEnabled
|
|
2537
|
+
}
|
|
2538
|
+
),
|
|
2539
|
+
!showCanvas ? /* @__PURE__ */ jsx(
|
|
2540
|
+
ComputerViewportFallback,
|
|
2541
|
+
{
|
|
2542
|
+
observation: props.observation,
|
|
2543
|
+
machineLocked: props.machineLocked,
|
|
2544
|
+
controlUnavailable: props.controlUnavailable,
|
|
2545
|
+
inputAllowed: props.inputAllowed,
|
|
2546
|
+
connectionState: props.connectionState,
|
|
2547
|
+
error: props.connectionError,
|
|
2548
|
+
onAction: (action) => enqueue(action, null),
|
|
2549
|
+
onReconnect: props.onReconnect
|
|
2550
|
+
}
|
|
2551
|
+
) : null,
|
|
2552
|
+
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: [
|
|
2553
|
+
/* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-3 animate-spin" }),
|
|
2554
|
+
" ",
|
|
2555
|
+
t("computerViewer.acting")
|
|
2556
|
+
] }) : null,
|
|
2557
|
+
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: [
|
|
2558
|
+
/* @__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") }),
|
|
2559
|
+
!rawInputEnabled && props.target && (props.pointerInput || props.keyboardInput) ? /* @__PURE__ */ jsx(
|
|
2560
|
+
"button",
|
|
2561
|
+
{
|
|
2562
|
+
type: "button",
|
|
2563
|
+
disabled: props.mutating,
|
|
2564
|
+
onClick: () => enqueue({ type: "focus", targetId: props.target.id }, null),
|
|
2565
|
+
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",
|
|
2566
|
+
children: t("computerViewer.bringToFront")
|
|
2567
|
+
}
|
|
2568
|
+
) : null
|
|
2569
|
+
] }) : null
|
|
2570
|
+
] });
|
|
2571
|
+
}
|
|
2572
|
+
function assertExactComputerClipboard(t, clipboard, expected) {
|
|
2573
|
+
if (clipboard.truncated || clipboard.text !== expected) {
|
|
2574
|
+
throw new Error(t("computerViewer.desktopClipboardDidNotAccept"));
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
function ComputerViewportFallback(props) {
|
|
2578
|
+
const t = useOpenGeniText();
|
|
2579
|
+
if (props.machineLocked) {
|
|
2580
|
+
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: [
|
|
2581
|
+
/* @__PURE__ */ jsx(LockKeyholeIcon, { className: "mx-auto size-6 text-og-fg-muted" }),
|
|
2582
|
+
/* @__PURE__ */ jsx("p", { className: "mt-3 text-og-menu font-medium text-og-fg", children: t("computerViewer.machineLocked") }),
|
|
2583
|
+
/* @__PURE__ */ jsx("p", { className: "mt-1 text-og-control leading-5 text-og-fg-muted", children: t("computerViewer.liveFramesAndInputStay") })
|
|
2584
|
+
] }) });
|
|
2585
|
+
}
|
|
2586
|
+
const appControls = props.observation?.target.kind === "app";
|
|
2587
|
+
const controlFailure = interactionControlFailureFromError(props.error);
|
|
2588
|
+
const interactive = semanticControls(t, props.observation).filter((node) => semanticAction(node) !== null).slice(0, 10);
|
|
2589
|
+
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: [
|
|
2590
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2591
|
+
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" }),
|
|
2592
|
+
/* @__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) })
|
|
2593
|
+
] }),
|
|
2594
|
+
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,
|
|
2595
|
+
!props.inputAllowed ? /* @__PURE__ */ jsx("p", { className: "mt-2 text-og-control leading-5 text-og-fg-muted", children: t("computerViewer.refreshToCheckDesktopControls") }) : null,
|
|
2596
|
+
interactive.length > 0 && !props.controlUnavailable && props.inputAllowed ? /* @__PURE__ */ jsxs("div", { className: "mt-3 border-t border-og-border pt-3", children: [
|
|
2597
|
+
/* @__PURE__ */ jsx("p", { className: "mb-2 text-og-xs text-og-fg-subtle", children: t("computerViewer.appControlsRemainAvailable") }),
|
|
2598
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", children: interactive.map((node) => /* @__PURE__ */ jsx(
|
|
2599
|
+
"button",
|
|
2600
|
+
{
|
|
2601
|
+
type: "button",
|
|
2602
|
+
onClick: () => {
|
|
2603
|
+
const action = semanticAction(node);
|
|
2604
|
+
if (action) props.onAction(action);
|
|
2605
|
+
},
|
|
2606
|
+
className: "rounded-og-sm border border-og-border bg-og-surface-1 px-2 py-1 text-og-control text-og-fg transition hover:bg-og-surface-2",
|
|
2607
|
+
children: node.name || node.role
|
|
2608
|
+
},
|
|
2609
|
+
node.ref
|
|
2610
|
+
)) })
|
|
2611
|
+
] }) : null,
|
|
2612
|
+
props.error && !isAttachedChromeGenerationLossError(props.error) ? /* @__PURE__ */ jsx(
|
|
2613
|
+
"button",
|
|
2614
|
+
{
|
|
2615
|
+
type: "button",
|
|
2616
|
+
onClick: props.onReconnect,
|
|
2617
|
+
className: "mt-3 text-og-control font-medium og-link",
|
|
2618
|
+
children: controlFailure?.retryable === false ? t("computerViewer.tryAgain") : t("computerViewer.reconnect")
|
|
2619
|
+
}
|
|
2620
|
+
) : null
|
|
2621
|
+
] }) });
|
|
2622
|
+
}
|
|
2623
|
+
function ComputerSemanticPanel(props) {
|
|
2624
|
+
const t = useOpenGeniText();
|
|
2625
|
+
const nodes = semanticControls(t, props.observation).slice(0, 100);
|
|
2626
|
+
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: [
|
|
2627
|
+
/* @__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: [
|
|
2628
|
+
/* @__PURE__ */ jsx(KeyboardIcon, { className: "size-3" }),
|
|
2629
|
+
" ",
|
|
2630
|
+
t("computerViewer.appControls")
|
|
2631
|
+
] }),
|
|
2632
|
+
!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,
|
|
2633
|
+
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(
|
|
2634
|
+
ComputerSemanticControl,
|
|
2635
|
+
{
|
|
2636
|
+
node,
|
|
2637
|
+
mutating: props.mutating,
|
|
2638
|
+
onAction: props.onAction
|
|
2639
|
+
},
|
|
2640
|
+
node.ref
|
|
2641
|
+
)) })
|
|
2642
|
+
] });
|
|
2643
|
+
}
|
|
2644
|
+
function ComputerSemanticControl(props) {
|
|
2645
|
+
const t = useOpenGeniText();
|
|
2646
|
+
const { node } = props;
|
|
2647
|
+
const editable = node.actions.includes("set_value");
|
|
2648
|
+
const action = semanticAction(node);
|
|
2649
|
+
const observedValue = semanticValue(node) ?? "";
|
|
2650
|
+
const [value, setValue] = useState5(() => observedValue);
|
|
2651
|
+
useEffect5(() => {
|
|
2652
|
+
setValue(observedValue);
|
|
2653
|
+
}, [node.ref, observedValue]);
|
|
2654
|
+
if (editable) {
|
|
2655
|
+
return /* @__PURE__ */ jsxs(
|
|
2656
|
+
"form",
|
|
2657
|
+
{
|
|
2658
|
+
className: "rounded-og-sm px-2 py-1.5 hover:bg-og-surface-2",
|
|
2659
|
+
onSubmit: (event) => {
|
|
2660
|
+
event.preventDefault();
|
|
2661
|
+
if (props.mutating) return;
|
|
2662
|
+
props.onAction({
|
|
2663
|
+
type: "semantic",
|
|
2664
|
+
locator: { kind: "ref", ref: node.ref },
|
|
2665
|
+
action: "set_value",
|
|
2666
|
+
value
|
|
2667
|
+
});
|
|
2668
|
+
},
|
|
2669
|
+
children: [
|
|
2670
|
+
/* @__PURE__ */ jsx("label", { className: "block truncate text-[10px] uppercase text-og-fg-subtle", children: node.name || node.identifier || node.role }),
|
|
2671
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-1 flex gap-1", children: [
|
|
2672
|
+
/* @__PURE__ */ jsx(
|
|
2673
|
+
"input",
|
|
2674
|
+
{
|
|
2675
|
+
value,
|
|
2676
|
+
disabled: props.mutating,
|
|
2677
|
+
onChange: (event) => setValue(event.currentTarget.value),
|
|
2678
|
+
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",
|
|
2679
|
+
"aria-label": t("computerViewer.setName", {
|
|
2680
|
+
name: node.name || node.identifier || node.role
|
|
2681
|
+
})
|
|
2682
|
+
}
|
|
2683
|
+
),
|
|
2684
|
+
/* @__PURE__ */ jsx(
|
|
2685
|
+
"button",
|
|
2686
|
+
{
|
|
2687
|
+
type: "submit",
|
|
2688
|
+
disabled: props.mutating,
|
|
2689
|
+
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",
|
|
2690
|
+
children: t("computerViewer.set")
|
|
2691
|
+
}
|
|
2692
|
+
)
|
|
2693
|
+
] })
|
|
2694
|
+
]
|
|
2695
|
+
}
|
|
2696
|
+
);
|
|
2697
|
+
}
|
|
2698
|
+
return /* @__PURE__ */ jsxs(
|
|
2699
|
+
"button",
|
|
2700
|
+
{
|
|
2701
|
+
type: "button",
|
|
2702
|
+
disabled: !action || props.mutating,
|
|
2703
|
+
onClick: () => {
|
|
2704
|
+
if (action) props.onAction(action);
|
|
2705
|
+
},
|
|
2706
|
+
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",
|
|
2707
|
+
children: [
|
|
2708
|
+
/* @__PURE__ */ jsx("span", { className: "mt-0.5 text-[10px] uppercase text-og-fg-subtle", children: node.role }),
|
|
2709
|
+
/* @__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") })
|
|
2710
|
+
]
|
|
2711
|
+
}
|
|
2712
|
+
);
|
|
2713
|
+
}
|
|
2714
|
+
function ComputerStatusBar(props) {
|
|
2715
|
+
const t = useOpenGeniText();
|
|
2716
|
+
const screen = props.target?.kind === "screen";
|
|
2717
|
+
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: [
|
|
2718
|
+
/* @__PURE__ */ jsx(
|
|
2719
|
+
"span",
|
|
2720
|
+
{
|
|
2721
|
+
className: cn(
|
|
2722
|
+
"size-1.5 rounded-full",
|
|
2723
|
+
props.connectionState === "live" ? "bg-og-status-running" : "bg-og-fg-subtle"
|
|
2724
|
+
)
|
|
2725
|
+
}
|
|
2726
|
+
),
|
|
2727
|
+
/* @__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) }),
|
|
2728
|
+
/* @__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") }),
|
|
2729
|
+
screen ? /* @__PURE__ */ jsx(MousePointer2Icon, { className: "size-3", "aria-hidden": true }) : null,
|
|
2730
|
+
props.refreshing ? /* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-3 animate-spin" }) : null,
|
|
2731
|
+
props.controlCount > 0 || props.showControls ? /* @__PURE__ */ jsx(
|
|
2732
|
+
"button",
|
|
2733
|
+
{
|
|
2734
|
+
type: "button",
|
|
2735
|
+
onClick: props.onToggleControls,
|
|
2736
|
+
"aria-pressed": props.showControls,
|
|
2737
|
+
className: cn(
|
|
2738
|
+
"rounded px-1.5 py-0.5 transition hover:bg-og-surface-2 hover:text-og-fg",
|
|
2739
|
+
props.showControls && "bg-og-surface-2 text-og-fg"
|
|
2740
|
+
),
|
|
2741
|
+
children: t("computerViewer.controlsControlcount", { controlCount: props.controlCount })
|
|
2742
|
+
}
|
|
2743
|
+
) : null
|
|
2744
|
+
] });
|
|
2745
|
+
}
|
|
2746
|
+
function ComputerNotice(props) {
|
|
2747
|
+
return /* @__PURE__ */ jsx(
|
|
2748
|
+
"div",
|
|
2749
|
+
{
|
|
2750
|
+
className: cn(
|
|
2751
|
+
"grid h-full place-items-center bg-og-bg text-og-control text-og-fg-muted",
|
|
2752
|
+
props.className
|
|
2753
|
+
),
|
|
2754
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2755
|
+
props.icon,
|
|
2756
|
+
props.text
|
|
2757
|
+
] })
|
|
2758
|
+
}
|
|
2759
|
+
);
|
|
2760
|
+
}
|
|
2761
|
+
var structuralRoles = /* @__PURE__ */ new Set([
|
|
2762
|
+
"frame",
|
|
2763
|
+
"panel",
|
|
2764
|
+
"section",
|
|
2765
|
+
"document",
|
|
2766
|
+
"document web",
|
|
2767
|
+
"static",
|
|
2768
|
+
"static text",
|
|
2769
|
+
"heading",
|
|
2770
|
+
"paragraph",
|
|
2771
|
+
"notification",
|
|
2772
|
+
"separator",
|
|
2773
|
+
"tool bar",
|
|
2774
|
+
"page tab list"
|
|
2775
|
+
]);
|
|
2776
|
+
function semanticControls(t, observation) {
|
|
2777
|
+
if (observation?.semantic?.kind !== "snapshot") return [];
|
|
2778
|
+
const result = [];
|
|
2779
|
+
const visit = (node) => {
|
|
2780
|
+
const role = node.role.trim().toLowerCase();
|
|
2781
|
+
const label = node.name?.trim() || node.identifier?.trim();
|
|
2782
|
+
if (node.actions.includes("set_value") || label && label.toLowerCase() !== role && !structuralRoles.has(role) && semanticAction(node) !== null) {
|
|
2783
|
+
result.push(node);
|
|
2784
|
+
}
|
|
2785
|
+
node.children?.forEach(visit);
|
|
2786
|
+
};
|
|
2787
|
+
observation.semantic.roots.forEach(visit);
|
|
2788
|
+
return result;
|
|
2789
|
+
}
|
|
2790
|
+
function semanticAction(node) {
|
|
2791
|
+
const invoke = ["invoke", "press", "click"].some((action) => node.actions.includes(action));
|
|
2792
|
+
if (invoke) {
|
|
2793
|
+
return {
|
|
2794
|
+
type: "semantic",
|
|
2795
|
+
locator: { kind: "ref", ref: node.ref },
|
|
2796
|
+
action: "invoke"
|
|
2797
|
+
};
|
|
2798
|
+
}
|
|
2799
|
+
return null;
|
|
2800
|
+
}
|
|
2801
|
+
function semanticValue(node) {
|
|
2802
|
+
return typeof node.value === "string" ? node.value : null;
|
|
2803
|
+
}
|
|
2804
|
+
function paintCanvas(canvas, image, width, height) {
|
|
2805
|
+
const dimensionsChanged = canvas.width !== width || canvas.height !== height;
|
|
2806
|
+
canvas.width = width;
|
|
2807
|
+
canvas.height = height;
|
|
2808
|
+
const context = canvas.getContext("2d", { alpha: false });
|
|
2809
|
+
if (!context) throw new Error("Desktop canvas is unavailable.");
|
|
2810
|
+
context.drawImage(image, 0, 0, width, height);
|
|
2811
|
+
if (dimensionsChanged) fitComputerCanvas(canvas);
|
|
2812
|
+
}
|
|
2813
|
+
function fitComputerCanvas(canvas) {
|
|
2814
|
+
const viewport = canvas.parentElement;
|
|
2815
|
+
if (!viewport || canvas.width <= 0 || canvas.height <= 0) return;
|
|
2816
|
+
const scale = Math.min(
|
|
2817
|
+
viewport.clientWidth / canvas.width,
|
|
2818
|
+
viewport.clientHeight / canvas.height
|
|
2819
|
+
);
|
|
2820
|
+
if (!Number.isFinite(scale) || scale <= 0) return;
|
|
2821
|
+
canvas.style.width = `${canvas.width * scale}px`;
|
|
2822
|
+
canvas.style.height = `${canvas.height * scale}px`;
|
|
2823
|
+
}
|
|
2824
|
+
function loadImage(url) {
|
|
2825
|
+
return new Promise((resolve, reject) => {
|
|
2826
|
+
const image = new Image();
|
|
2827
|
+
image.onload = () => resolve(image);
|
|
2828
|
+
image.onerror = () => reject(new Error("Desktop frame image could not be decoded."));
|
|
2829
|
+
image.src = url;
|
|
2830
|
+
});
|
|
2831
|
+
}
|
|
2832
|
+
function computerPoint(canvas, frame, clientX, clientY) {
|
|
2833
|
+
if (!canvas) return null;
|
|
2834
|
+
const rect = canvas.getBoundingClientRect();
|
|
2835
|
+
if (rect.width <= 0 || rect.height <= 0) return null;
|
|
2836
|
+
return {
|
|
2837
|
+
x: Math.max(0, Math.min(frame.width - 1, (clientX - rect.left) / rect.width * frame.width)),
|
|
2838
|
+
y: Math.max(0, Math.min(frame.height - 1, (clientY - rect.top) / rect.height * frame.height))
|
|
2839
|
+
};
|
|
2840
|
+
}
|
|
2841
|
+
function computerKey(event) {
|
|
2842
|
+
if (["Alt", "AltGraph", "Control", "Meta", "Shift"].includes(event.key)) return null;
|
|
2843
|
+
const special = /* @__PURE__ */ new Set([
|
|
2844
|
+
"Enter",
|
|
2845
|
+
"Tab",
|
|
2846
|
+
"Escape",
|
|
2847
|
+
"Backspace",
|
|
2848
|
+
"Delete",
|
|
2849
|
+
"ArrowUp",
|
|
2850
|
+
"ArrowDown",
|
|
2851
|
+
"ArrowLeft",
|
|
2852
|
+
"ArrowRight",
|
|
2853
|
+
"Home",
|
|
2854
|
+
"End",
|
|
2855
|
+
"PageUp",
|
|
2856
|
+
"PageDown"
|
|
2857
|
+
]);
|
|
2858
|
+
const modified = event.altKey || event.ctrlKey || event.metaKey;
|
|
2859
|
+
if (!modified && !special.has(event.key)) return null;
|
|
2860
|
+
const parts = [];
|
|
2861
|
+
if (event.ctrlKey) parts.push("Control");
|
|
2862
|
+
if (event.altKey) parts.push("Alt");
|
|
2863
|
+
if (event.metaKey) parts.push("Meta");
|
|
2864
|
+
if (event.shiftKey) parts.push("Shift");
|
|
2865
|
+
parts.push(event.key === " " ? "Space" : event.key);
|
|
2866
|
+
return parts.join("+");
|
|
2867
|
+
}
|
|
2868
|
+
function sameFrameFence(left, right) {
|
|
2869
|
+
return left.frameId === right.frameId && sameComputerTarget(left, right);
|
|
2870
|
+
}
|
|
2871
|
+
function sameComputerTarget(left, right) {
|
|
2872
|
+
return left.computerSessionId === right.computerSessionId && left.controllerGeneration === right.controllerGeneration && left.targetId === right.targetId && left.targetGeneration === right.targetGeneration;
|
|
2873
|
+
}
|
|
2874
|
+
function isLiveComputer2(session) {
|
|
2875
|
+
return !["ending", "ended", "failed", "lost"].includes(session.lifecycle);
|
|
2876
|
+
}
|
|
2877
|
+
function computerFailureMessage(t, session) {
|
|
2878
|
+
switch (session.failureCode) {
|
|
2879
|
+
case "machine_locked":
|
|
2880
|
+
return t("computerViewer.unlockTheConnectedMacThen");
|
|
2881
|
+
case "controller_heartbeat_expired":
|
|
2882
|
+
// The sandbox it ran in was lost or replaced.
|
|
2883
|
+
case "placement_instance_lost":
|
|
2884
|
+
return t("computerViewer.theDesktopConnectionWasLost");
|
|
2885
|
+
case "controller_transition_expired":
|
|
2886
|
+
return session.placement.kind === "attached_device" ? t("computerViewer.chromeReconnectedOpenAFresh2") : t("computerViewer.theDesktopConnectionExpiredOpen");
|
|
2887
|
+
case "idle_released":
|
|
2888
|
+
return t("computerViewer.theDesktopStoppedAfterIt");
|
|
2889
|
+
case null:
|
|
2890
|
+
return null;
|
|
2891
|
+
default:
|
|
2892
|
+
return t("computerViewer.theDesktopCouldNotBe");
|
|
2893
|
+
}
|
|
2894
|
+
}
|
|
2895
|
+
function isAttachedChromeGenerationLoss(session) {
|
|
2896
|
+
return session.lifecycle === "lost" && session.failureCode === "controller_transition_expired" && session.placement.kind === "attached_device";
|
|
2897
|
+
}
|
|
2898
|
+
function isAttachedChromeGenerationLossError(error) {
|
|
2899
|
+
if (!error) return false;
|
|
2900
|
+
return /placement instance changed|controller authority changed/i.test(error.message);
|
|
2901
|
+
}
|
|
2902
|
+
function countInterventions(interventions) {
|
|
2903
|
+
const counts = /* @__PURE__ */ new Map();
|
|
2904
|
+
for (const intervention of interventions) {
|
|
2905
|
+
counts.set(intervention.resourceId, (counts.get(intervention.resourceId) ?? 0) + 1);
|
|
2906
|
+
}
|
|
2907
|
+
return counts;
|
|
2908
|
+
}
|
|
2909
|
+
function interventionTitle(t, intervention) {
|
|
2910
|
+
switch (intervention.kind) {
|
|
2911
|
+
case "manual_login":
|
|
2912
|
+
return t("computerViewer.signInNeeded");
|
|
2913
|
+
case "mfa":
|
|
2914
|
+
return t("computerViewer.verificationNeeded");
|
|
2915
|
+
case "external_action":
|
|
2916
|
+
case "confirmation":
|
|
2917
|
+
return t("computerViewer.actionNeeded");
|
|
2918
|
+
case "other":
|
|
2919
|
+
return t("computerViewer.desktopNeedsYourHelp");
|
|
2920
|
+
}
|
|
2921
|
+
}
|
|
2922
|
+
function platformLabel(t, session) {
|
|
2923
|
+
switch (session.platform) {
|
|
2924
|
+
case "macos":
|
|
2925
|
+
return t("computerViewer.mac");
|
|
2926
|
+
case "linux":
|
|
2927
|
+
return t("computerViewer.linux");
|
|
2928
|
+
case "windows":
|
|
2929
|
+
return t("computerViewer.windows");
|
|
2930
|
+
default:
|
|
2931
|
+
return t("computerViewer.desktop");
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
function placementLabel(t, session) {
|
|
2935
|
+
switch (session.placement.kind) {
|
|
2936
|
+
case "sandbox_group":
|
|
2937
|
+
return t("computerViewer.agentSandbox");
|
|
2938
|
+
case "connected_machine":
|
|
2939
|
+
return t("computerViewer.connectedMachine");
|
|
2940
|
+
case "attached_device":
|
|
2941
|
+
return t("computerViewer.yourMachine");
|
|
2942
|
+
case "external_provider":
|
|
2943
|
+
return t("computerViewer.cloudDesktop");
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
function lifecycleLabel(t, lifecycle) {
|
|
2947
|
+
switch (lifecycle) {
|
|
2948
|
+
case "starting":
|
|
2949
|
+
return t("computerViewer.openingDesktop");
|
|
2950
|
+
case "suspending":
|
|
2951
|
+
return t("computerViewer.pausingDesktop");
|
|
2952
|
+
case "suspended":
|
|
2953
|
+
return t("computerViewer.desktopPaused");
|
|
2954
|
+
case "restoring":
|
|
2955
|
+
return t("computerViewer.restoringDesktop");
|
|
2956
|
+
case "ending":
|
|
2957
|
+
return t("computerViewer.closingDesktop");
|
|
2958
|
+
default:
|
|
2959
|
+
return t("computerViewer.connectingToDesktop");
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
function computerConnectionLabel(t, state) {
|
|
2963
|
+
switch (state) {
|
|
2964
|
+
case "attaching":
|
|
2965
|
+
return t("computerViewer.openingDesktopView");
|
|
2966
|
+
case "connecting":
|
|
2967
|
+
return t("computerViewer.connecting");
|
|
2968
|
+
case "reconnecting":
|
|
2969
|
+
return t("computerViewer.reconnecting");
|
|
2970
|
+
case "error":
|
|
2971
|
+
return t("computerViewer.disconnected");
|
|
2972
|
+
default:
|
|
2973
|
+
return t("computerViewer.waitingForDesktop");
|
|
2974
|
+
}
|
|
2975
|
+
}
|
|
2976
|
+
|
|
2977
|
+
export {
|
|
2978
|
+
useComputerFrameStream,
|
|
2979
|
+
useComputerSession,
|
|
2980
|
+
useComputerSessions,
|
|
2981
|
+
ComputerViewer,
|
|
2982
|
+
computerKey
|
|
2983
|
+
};
|
|
2984
|
+
//# sourceMappingURL=chunk-YQXTDZSU.js.map
|