@opengeni/react 0.57.0 → 1.0.2-canary.37191796234001
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +654 -22
- package/dist/accounts.d.ts +64 -0
- package/dist/accounts.js +822 -0
- package/dist/accounts.js.map +1 -0
- package/dist/approvals.d.ts +2 -1
- package/dist/artifacts-document.js +3 -2
- package/dist/artifacts-presentation.js +3 -2
- package/dist/artifacts-spreadsheet.js +2 -2
- package/dist/artifacts.d.ts +4 -1
- package/dist/artifacts.js +518 -42
- package/dist/artifacts.js.map +1 -1
- package/dist/browser-viewer-GTR5XQ7X.js +16 -0
- package/dist/capability-catalog-row.d.ts +20 -0
- package/dist/capability-logo-fallback.d.ts +3 -0
- package/dist/chat-interactive-block-UGBTNB3L.js +11 -0
- package/dist/chat-interactive-block-UGBTNB3L.js.map +1 -0
- package/dist/{chunk-5UQPNLIO.js → chunk-23J2ZNXT.js} +4117 -3896
- package/dist/chunk-23J2ZNXT.js.map +1 -0
- package/dist/chunk-447JLCBU.js +209 -0
- package/dist/chunk-447JLCBU.js.map +1 -0
- package/dist/chunk-4RVYOY4O.js +379 -0
- package/dist/chunk-4RVYOY4O.js.map +1 -0
- package/dist/chunk-5CVXZA3Y.js +292 -0
- package/dist/chunk-5CVXZA3Y.js.map +1 -0
- package/dist/chunk-5J4FOW6Q.js +108 -0
- package/dist/chunk-5J4FOW6Q.js.map +1 -0
- package/dist/chunk-A2PI6UMY.js +41 -0
- package/dist/chunk-A2PI6UMY.js.map +1 -0
- package/dist/{chunk-7WCLAEFV.js → chunk-A4UJB2MM.js} +37 -27
- package/dist/chunk-A4UJB2MM.js.map +1 -0
- package/dist/chunk-B3V6TG77.js +41 -0
- package/dist/chunk-B3V6TG77.js.map +1 -0
- package/dist/chunk-BRM6FVZA.js +302 -0
- package/dist/chunk-BRM6FVZA.js.map +1 -0
- package/dist/chunk-C5X5AJXK.js +182 -0
- package/dist/chunk-C5X5AJXK.js.map +1 -0
- package/dist/chunk-CR7U7HAR.js +453 -0
- package/dist/chunk-CR7U7HAR.js.map +1 -0
- package/dist/{chunk-R3AZOAB5.js → chunk-DYWBUX5Q.js} +29 -123
- package/dist/chunk-DYWBUX5Q.js.map +1 -0
- package/dist/chunk-E3G7SAYZ.js +3124 -0
- package/dist/chunk-E3G7SAYZ.js.map +1 -0
- package/dist/chunk-ELCE5SXV.js +359 -0
- package/dist/chunk-ELCE5SXV.js.map +1 -0
- package/dist/chunk-ERGYJIBB.js +21 -0
- package/dist/chunk-ERGYJIBB.js.map +1 -0
- package/dist/chunk-FFA2OVOV.js +319 -0
- package/dist/chunk-FFA2OVOV.js.map +1 -0
- package/dist/chunk-FZCP527Y.js +116 -0
- package/dist/chunk-FZCP527Y.js.map +1 -0
- package/dist/chunk-GIMRELBW.js +14 -0
- package/dist/chunk-GIMRELBW.js.map +1 -0
- package/dist/{chunk-6KLX2RH5.js → chunk-H2NJQORO.js} +1069 -79
- package/dist/chunk-H2NJQORO.js.map +1 -0
- package/dist/chunk-I7IWRQLN.js +1608 -0
- package/dist/chunk-I7IWRQLN.js.map +1 -0
- package/dist/{chunk-HA46CYQK.js → chunk-IQUCRAT7.js} +792 -537
- package/dist/chunk-IQUCRAT7.js.map +1 -0
- package/dist/chunk-IWIDV7SB.js +1 -0
- package/dist/chunk-IWIDV7SB.js.map +1 -0
- package/dist/chunk-J2QWVSQY.js +312 -0
- package/dist/chunk-J2QWVSQY.js.map +1 -0
- package/dist/chunk-JFNEV4LU.js +2733 -0
- package/dist/chunk-JFNEV4LU.js.map +1 -0
- package/dist/chunk-JT4JW7BC.js +54 -0
- package/dist/chunk-JT4JW7BC.js.map +1 -0
- package/dist/chunk-K3HQAKQX.js +24 -0
- package/dist/chunk-K3HQAKQX.js.map +1 -0
- package/dist/{chunk-C5ZPSSS5.js → chunk-NEXLLTP4.js} +2 -1
- package/dist/{chunk-C5ZPSSS5.js.map → chunk-NEXLLTP4.js.map} +1 -1
- package/dist/chunk-NZUI76EM.js +371 -0
- package/dist/chunk-NZUI76EM.js.map +1 -0
- package/dist/{chunk-PEI6RANI.js → chunk-PNY3JKBJ.js} +309 -74
- package/dist/chunk-PNY3JKBJ.js.map +1 -0
- package/dist/{chunk-IGC6A2ZI.js → chunk-Q5QBEZIQ.js} +777 -246
- package/dist/chunk-Q5QBEZIQ.js.map +1 -0
- package/dist/chunk-RHREZ7BO.js +11 -0
- package/dist/chunk-RHREZ7BO.js.map +1 -0
- package/dist/chunk-SCOTPE2I.js +589 -0
- package/dist/chunk-SCOTPE2I.js.map +1 -0
- package/dist/{chunk-B6WPZSTT.js → chunk-SJZDKVW2.js} +1331 -1163
- package/dist/chunk-SJZDKVW2.js.map +1 -0
- package/dist/chunk-TMJRG4YC.js +12803 -0
- package/dist/chunk-TMJRG4YC.js.map +1 -0
- package/dist/chunk-TMYGL6X5.js +742 -0
- package/dist/chunk-TMYGL6X5.js.map +1 -0
- package/dist/chunk-UGLEYEMP.js +33 -0
- package/dist/chunk-UGLEYEMP.js.map +1 -0
- package/dist/chunk-UK4TINKT.js +27 -0
- package/dist/chunk-UK4TINKT.js.map +1 -0
- package/dist/chunk-UTRTG6LH.js +220 -0
- package/dist/chunk-UTRTG6LH.js.map +1 -0
- package/dist/chunk-WEHMPOXK.js +39 -0
- package/dist/chunk-WEHMPOXK.js.map +1 -0
- package/dist/chunk-WRHIZYZF.js +988 -0
- package/dist/chunk-WRHIZYZF.js.map +1 -0
- package/dist/{chunk-HUIKIDM5.js → chunk-WUISZ3WU.js} +223 -115
- package/dist/chunk-WUISZ3WU.js.map +1 -0
- package/dist/chunk-XCHWDJ22.js +107 -0
- package/dist/chunk-XCHWDJ22.js.map +1 -0
- package/dist/chunk-XOAMRDDK.js +481 -0
- package/dist/chunk-XOAMRDDK.js.map +1 -0
- package/dist/chunk-XUW2UWQM.js +299 -0
- package/dist/chunk-XUW2UWQM.js.map +1 -0
- package/dist/{chunk-KCGXPP5V.js → chunk-Y2PRMYLC.js} +11 -6
- package/dist/chunk-Y2PRMYLC.js.map +1 -0
- package/dist/chunk-YBXQDQFX.js +1772 -0
- package/dist/chunk-YBXQDQFX.js.map +1 -0
- package/dist/{chunk-KZ73RL76.js → chunk-YQEAA6LT.js} +7 -3
- package/dist/chunk-YQEAA6LT.js.map +1 -0
- package/dist/chunk-YV4L3ILF.js +9 -0
- package/dist/chunk-YV4L3ILF.js.map +1 -0
- package/dist/{chunk-LLOLUHVG.js → chunk-YWFG7ZX7.js} +1358 -2746
- package/dist/chunk-YWFG7ZX7.js.map +1 -0
- package/dist/chunk-ZYRGEKWS.js +216 -0
- package/dist/chunk-ZYRGEKWS.js.map +1 -0
- package/dist/client.d.ts +7 -4
- package/dist/clipboard.js +1 -0
- package/dist/commands/types.d.ts +2 -0
- package/dist/components/anthropic-mark.d.ts +3 -0
- package/dist/components/approval-surface.d.ts +15 -0
- package/dist/components/artifacts/artifact-chrome.d.ts +120 -0
- package/dist/components/artifacts/artifact-sandbox.d.ts +27 -0
- package/dist/components/artifacts/artifact-surface.d.ts +3 -1
- package/dist/components/artifacts/chat-interactive-block.d.ts +29 -0
- package/dist/components/artifacts/deferred-chat-media.d.ts +15 -0
- package/dist/components/artifacts/document-editor.d.ts +4 -2
- package/dist/components/artifacts/editable-artifact-ui.d.ts +2 -1
- package/dist/components/artifacts/editable-artifact-view.d.ts +46 -0
- package/dist/components/artifacts/editable-document.d.ts +1 -1
- package/dist/components/artifacts/editable-presentation.d.ts +2 -2
- package/dist/components/artifacts/editable-spreadsheet.d.ts +2 -1
- package/dist/components/artifacts/index.d.ts +8 -1
- package/dist/components/artifacts/inline-html-document.d.ts +2 -0
- package/dist/components/artifacts/latest-task-runner.d.ts +15 -0
- package/dist/components/artifacts/presentation-editor.d.ts +6 -2
- package/dist/components/artifacts/published-html-artifact-frame.d.ts +48 -3
- package/dist/components/artifacts/session-artifact-viewer.d.ts +39 -0
- package/dist/components/artifacts/site-view.d.ts +23 -0
- package/dist/components/artifacts/spreadsheet-general-display.d.ts +24 -0
- package/dist/components/artifacts/visualization-assets.gen.d.ts +2 -0
- package/dist/components/browser-select-control.d.ts +16 -0
- package/dist/components/browser-viewer.d.ts +10 -1
- package/dist/components/chat-composer.d.ts +21 -3
- package/dist/components/child-session-link.d.ts +5 -0
- package/dist/components/claude-mark.d.ts +3 -0
- package/dist/components/code-editor.d.ts +1 -4
- package/dist/components/composer.d.ts +45 -4
- package/dist/components/computer-viewer.d.ts +4 -1
- package/dist/components/copy-button.d.ts +3 -1
- package/dist/components/desktop-viewer.d.ts +1 -1
- package/dist/components/enrollment-consent.d.ts +6 -3
- package/dist/components/file-browser.d.ts +10 -1
- package/dist/components/fleet-tile.d.ts +2 -2
- package/dist/components/grok-mark.d.ts +26 -0
- package/dist/components/human-input-form.d.ts +21 -2
- package/dist/components/human-input-surface.d.ts +6 -3
- package/dist/components/machine-card.d.ts +4 -1
- package/dist/components/machines/machine-detail.d.ts +4 -1
- package/dist/components/machines/machine-operation-policy.d.ts +11 -0
- package/dist/components/machines-dashboard.d.ts +3 -1
- package/dist/components/markdown-table-layout.d.ts +12 -0
- package/dist/components/markdown.d.ts +47 -3
- package/dist/components/message-timeline.d.ts +72 -9
- package/dist/components/model-mark.d.ts +29 -0
- package/dist/components/model-policy-picker-menu.d.ts +9 -0
- package/dist/components/model-policy-picker.d.ts +62 -13
- package/dist/components/open-geni-chat.d.ts +55 -0
- package/dist/components/open-geni-links.d.ts +68 -0
- package/dist/components/openrouter-mark.d.ts +6 -0
- package/dist/components/pierre-file.d.ts +1 -1
- package/dist/components/preview-loading.d.ts +2 -0
- package/dist/components/queue-item-content.d.ts +9 -0
- package/dist/components/sandbox-files.d.ts +13 -2
- package/dist/components/sandbox-workspace.d.ts +43 -3
- package/dist/components/session-capability-frame.d.ts +35 -0
- package/dist/components/session-chrome.d.ts +66 -8
- package/dist/components/session-commands-panel.d.ts +6 -0
- package/dist/components/session-commands.d.ts +6 -0
- package/dist/components/session-connection-request.d.ts +8 -0
- package/dist/components/session-conversation.d.ts +86 -0
- package/dist/components/session-list.d.ts +36 -0
- package/dist/components/session-mcp-capability-card.d.ts +41 -0
- package/dist/components/timeline-anchor.d.ts +24 -0
- package/dist/components/timeline-annotation-chrome.d.ts +25 -0
- package/dist/components/timeline-annotation-layout.d.ts +42 -0
- package/dist/components/timeline-annotation-markers.d.ts +8 -0
- package/dist/components/timeline-annotation-reveal-context.d.ts +4 -0
- package/dist/components/timeline-annotation-shared.d.ts +31 -0
- package/dist/components/timeline-annotations-dialog.d.ts +3 -2
- package/dist/components/timeline-annotations.d.ts +13 -3
- package/dist/components/timeline-reading-progress.d.ts +11 -0
- package/dist/components/timeline-search.d.ts +34 -0
- package/dist/components/timeline-settlement.d.ts +16 -0
- package/dist/components/tip-follow.d.ts +16 -0
- package/dist/components/usage-limit-notice.d.ts +49 -0
- package/dist/components/usage-member-list.d.ts +91 -0
- package/dist/components/usage-meter.d.ts +73 -0
- package/dist/components/use-viewer-menu-dismiss.d.ts +2 -0
- package/dist/components/user-message-body.d.ts +10 -1
- package/dist/components/workspace-dock.d.ts +6 -2
- package/dist/composer.d.ts +5 -4
- package/dist/composer.js +15 -9
- package/dist/computer-viewer-ENHVAZ2Q.js +19 -0
- package/dist/computer-viewer-ENHVAZ2Q.js.map +1 -0
- package/dist/connect-account-identity.d.ts +8 -0
- package/dist/connect-accounts.d.ts +15 -0
- package/dist/connect-chooser.d.ts +18 -0
- package/dist/connect-panel.d.ts +18 -0
- package/dist/connect-setup.d.ts +16 -0
- package/dist/connect.d.ts +21 -0
- package/dist/connect.js +2129 -0
- package/dist/connect.js.map +1 -0
- package/dist/connection-catalog.d.ts +38 -0
- package/dist/connection-discovery.d.ts +12 -0
- package/dist/connection-installed.d.ts +17 -0
- package/dist/connection-logo.d.ts +9 -0
- package/dist/connection-service-logo.d.ts +8 -0
- package/dist/connection-service-presentation.d.ts +13 -0
- package/dist/connection-skeleton.d.ts +5 -0
- package/dist/connection-type-picker.d.ts +6 -0
- package/dist/conversation-timeline.d.ts +5 -0
- package/dist/desktop.d.ts +7 -0
- package/dist/desktop.js +26 -0
- package/dist/desktop.js.map +1 -0
- package/dist/device-authorization.d.ts +23 -0
- package/dist/diffs.d.ts +8 -0
- package/dist/diffs.js +14 -0
- package/dist/diffs.js.map +1 -0
- package/dist/discovery-cache.d.ts +5 -0
- package/dist/editor.d.ts +7 -0
- package/dist/editor.js +21 -0
- package/dist/editor.js.map +1 -0
- package/dist/embedded-session-client.d.ts +23 -0
- package/dist/file-node-visibility.d.ts +15 -0
- package/dist/{fleet-decision-row-GGCAT4E4.js → fleet-decision-row-YZ3ZKWMM.js} +2 -1
- package/dist/fleet-decision-row-YZ3ZKWMM.js.map +1 -0
- package/dist/hooks/channel-cache.d.ts +23 -0
- package/dist/hooks/latest-question.d.ts +25 -0
- package/dist/hooks/shared-machines-list.d.ts +14 -0
- package/dist/hooks/use-attached-browsers.d.ts +2 -1
- package/dist/hooks/use-browser-frame-stream.d.ts +1 -1
- package/dist/hooks/use-browser-session.d.ts +12 -1
- package/dist/hooks/use-channels.d.ts +1 -0
- package/dist/hooks/use-codex-accounts.d.ts +25 -7
- package/dist/hooks/use-composer.d.ts +45 -9
- package/dist/hooks/use-computer-frame-stream.d.ts +1 -1
- package/dist/hooks/use-computer-input-posture.d.ts +13 -0
- package/dist/hooks/use-computer-session.d.ts +2 -0
- package/dist/hooks/use-connect.d.ts +22 -0
- package/dist/hooks/use-desktop-stream.d.ts +1 -1
- package/dist/hooks/use-file-attachments.d.ts +21 -2
- package/dist/hooks/use-machine-chip.d.ts +3 -3
- package/dist/hooks/use-machines.d.ts +19 -1
- package/dist/hooks/use-sandbox-files.d.ts +5 -1
- package/dist/hooks/use-session-background-commands.d.ts +14 -0
- package/dist/hooks/use-session-events.d.ts +30 -8
- package/dist/hooks/use-session-lineage.d.ts +4 -0
- package/dist/hooks/use-session-mcp-approval-policy.d.ts +2 -2
- package/dist/hooks/use-session.d.ts +6 -0
- package/dist/hooks/use-turn-queue.d.ts +12 -0
- package/dist/hooks/use-usage.d.ts +40 -0
- package/dist/hooks/use-workspace-edit.d.ts +4 -0
- package/dist/hooks/use-workspace-sessions.d.ts +27 -5
- package/dist/human-input.d.ts +3 -1
- package/dist/identity-link-accounts.d.ts +11 -0
- package/dist/identity-link-consent.d.ts +18 -0
- package/dist/index.d.ts +60 -17
- package/dist/index.js +2237 -6200
- package/dist/index.js.map +1 -1
- package/dist/interaction.d.ts +1 -1
- package/dist/interaction.js +35 -184
- package/dist/interaction.js.map +1 -1
- package/dist/latest-question-755OW5DS.js +117 -0
- package/dist/latest-question-755OW5DS.js.map +1 -0
- package/dist/lib/error-message.d.ts +7 -0
- package/dist/lib/format.d.ts +36 -2
- package/dist/lib/host-theme.d.ts +70 -0
- package/dist/lib/interaction-errors.d.ts +6 -0
- package/dist/lib/menu-styles.d.ts +22 -0
- package/dist/lib/pierre-diffs-loader.d.ts +20 -0
- package/dist/lib/workbench-peers.d.ts +36 -0
- package/dist/lib/xterm-theme.d.ts +7 -5
- package/dist/machines.d.ts +4 -2
- package/dist/machines.js +14 -4
- package/dist/markdown-table-layout-QXSLK4BY.js +106 -0
- package/dist/markdown-table-layout-QXSLK4BY.js.map +1 -0
- package/dist/mcp-connection-status.d.ts +14 -0
- package/dist/model-policy-picker-menu-PWRI7R2X.js +14 -0
- package/dist/model-policy-picker-menu-PWRI7R2X.js.map +1 -0
- package/dist/model-policy.d.ts +19 -3
- package/dist/model-policy.js +9 -1
- package/dist/older-history.d.ts +30 -0
- package/dist/platform-activity-row-627BFZ46.js +182 -0
- package/dist/platform-activity-row-627BFZ46.js.map +1 -0
- package/dist/plugin-details.d.ts +14 -0
- package/dist/plugin-discovery.d.ts +25 -0
- package/dist/provider.d.ts +13 -1
- package/dist/{queue-surface-implementation-2KVJTYXH.js → queue-surface-implementation-ZHFI5JBP.js} +131 -44
- package/dist/queue-surface-implementation-ZHFI5JBP.js.map +1 -0
- package/dist/realtime/realtime-control.d.ts +10 -3
- package/dist/realtime.js +229 -83
- package/dist/realtime.js.map +1 -1
- package/dist/sandbox-files-BBC47SLD.js +20 -0
- package/dist/sandbox-files-BBC47SLD.js.map +1 -0
- package/dist/session-auth-recommendation.d.ts +5 -0
- package/dist/session-capability-policy.d.ts +12 -0
- package/dist/session-ui.d.ts +30 -2
- package/dist/session-ui.js +85 -7
- package/dist/session-ui.js.map +1 -1
- package/dist/session.d.ts +8 -2
- package/dist/session.js +30 -19
- package/dist/sites-ui.d.ts +34 -0
- package/dist/sites.d.ts +3 -0
- package/dist/sites.js +11 -0
- package/dist/sites.js.map +1 -0
- package/dist/skill-discovery.d.ts +47 -0
- package/dist/terminal.d.ts +8 -0
- package/dist/terminal.js +31 -0
- package/dist/terminal.js.map +1 -0
- package/dist/timeline/activity-rail.d.ts +11 -2
- package/dist/timeline/allowance-exhausted-row.d.ts +24 -0
- package/dist/timeline/compaction-copy.d.ts +10 -0
- package/dist/timeline/entrance.d.ts +13 -1
- package/dist/timeline/genie-loading.d.ts +34 -0
- package/dist/timeline/index.d.ts +6 -2
- package/dist/timeline/knowledge-receipt.d.ts +17 -0
- package/dist/timeline/platform-activity-row.d.ts +14 -0
- package/dist/timeline/presented-image.d.ts +6 -0
- package/dist/timeline/projection.d.ts +31 -2
- package/dist/timeline/registry.d.ts +2 -0
- package/dist/timeline/retained-image.d.ts +18 -0
- package/dist/timeline/rolling-activity.d.ts +11 -0
- package/dist/timeline/screenshot-lightbox.d.ts +16 -1
- package/dist/timeline/shared.d.ts +8 -3
- package/dist/timeline/startup-preference.d.ts +3 -0
- package/dist/timeline/startup-timings.d.ts +4 -0
- package/dist/timeline/tool-display-name.d.ts +2 -1
- package/dist/timeline/turn-summary.d.ts +32 -3
- package/dist/timeline/types.d.ts +141 -7
- package/dist/timeline-annotation-markers-GNDHTGBD.js +165 -0
- package/dist/timeline-annotation-markers-GNDHTGBD.js.map +1 -0
- package/dist/timeline-annotation-selection-DMLMM2TX.js +241 -0
- package/dist/timeline-annotation-selection-DMLMM2TX.js.map +1 -0
- package/dist/timeline-annotations-dialog-ELRDBHTS.js +273 -0
- package/dist/timeline-annotations-dialog-ELRDBHTS.js.map +1 -0
- package/dist/types/machines.d.ts +2 -2
- package/dist/usage/allowance-copy.d.ts +25 -0
- package/dist/usage/summary.d.ts +35 -0
- package/dist/usage.d.ts +13 -0
- package/dist/usage.js +1074 -0
- package/dist/usage.js.map +1 -0
- package/package.json +44 -4
- package/src/accounts.tsx +1072 -0
- package/src/approvals.ts +8 -1
- package/src/artifacts.ts +42 -0
- package/src/assets/README.md +8 -0
- package/src/assets/gmail.ico +0 -0
- package/src/assets/outlook.ico +0 -0
- package/src/capability-catalog-row.tsx +94 -0
- package/src/capability-logo-fallback.ts +22 -0
- package/src/client.ts +22 -13
- package/src/commands/registry.ts +18 -15
- package/src/commands/types.ts +2 -0
- package/src/components/anthropic-mark.tsx +10 -0
- package/src/components/approval-surface.tsx +171 -37
- package/src/components/artifacts/artifact-chrome.tsx +413 -0
- package/src/components/artifacts/artifact-sandbox.tsx +185 -0
- package/src/components/artifacts/artifact-surface.tsx +39 -19
- package/src/components/artifacts/chat-interactive-block.tsx +260 -0
- package/src/components/artifacts/deferred-chat-media.tsx +67 -0
- package/src/components/artifacts/document-editor.tsx +141 -16
- package/src/components/artifacts/editable-artifact-ui.tsx +4 -2
- package/src/components/artifacts/editable-artifact-view.tsx +187 -0
- package/src/components/artifacts/editable-artifact-workbench.tsx +5 -2
- package/src/components/artifacts/editable-document.tsx +37 -36
- package/src/components/artifacts/editable-presentation.tsx +36 -18
- package/src/components/artifacts/editable-spreadsheet.tsx +5 -2
- package/src/components/artifacts/index.ts +44 -0
- package/src/components/artifacts/inline-html-document.ts +24 -0
- package/src/components/artifacts/latest-task-runner.ts +49 -0
- package/src/components/artifacts/presentation-editor.tsx +323 -67
- package/src/components/artifacts/published-html-artifact-frame.tsx +338 -5
- package/src/components/artifacts/session-artifact-viewer.tsx +376 -0
- package/src/components/artifacts/site-view.tsx +116 -0
- package/src/components/artifacts/spreadsheet-canvas.ts +5 -10
- package/src/components/artifacts/spreadsheet-general-display.ts +43 -0
- package/src/components/artifacts/spreadsheet-grid.tsx +12 -13
- package/src/components/artifacts/visualization-assets/base.css +1015 -0
- package/src/components/artifacts/visualization-assets/helpers.html +349 -0
- package/src/components/artifacts/visualization-assets.gen.ts +3 -0
- package/src/components/browser-select-control.tsx +312 -0
- package/src/components/browser-viewer.tsx +1054 -314
- package/src/components/chat-composer.tsx +131 -85
- package/src/components/child-session-link.tsx +27 -0
- package/src/components/claude-mark.tsx +10 -0
- package/src/components/code-editor.tsx +13 -16
- package/src/components/composer-transcription-control.tsx +7 -5
- package/src/components/composer.tsx +376 -49
- package/src/components/computer-viewer.tsx +1041 -329
- package/src/components/copy-button.tsx +13 -5
- package/src/components/desktop-viewer.tsx +1 -1
- package/src/components/enrollment-consent.tsx +65 -7
- package/src/components/enrollment-device-flow.tsx +1 -1
- package/src/components/file-browser.tsx +158 -34
- package/src/components/fleet-tile.tsx +8 -16
- package/src/components/generated-video-player.tsx +4 -2
- package/src/components/grok-mark.tsx +33 -0
- package/src/components/human-input-form.tsx +455 -114
- package/src/components/human-input-surface.tsx +18 -7
- package/src/components/interaction-intervention-banner.tsx +2 -2
- package/src/components/machine-card.tsx +119 -4
- package/src/components/machine-dock-bar.tsx +1 -1
- package/src/components/machine-input-display.ts +23 -2
- package/src/components/machines/machine-detail.tsx +52 -2
- package/src/components/machines/machine-operation-policy.tsx +179 -0
- package/src/components/machines-dashboard.tsx +8 -17
- package/src/components/markdown-table-layout.ts +132 -0
- package/src/components/markdown.tsx +473 -44
- package/src/components/message-timeline.tsx +2498 -663
- package/src/components/model-mark.tsx +90 -0
- package/src/components/model-picker.tsx +15 -4
- package/src/components/model-policy-picker-menu.tsx +424 -0
- package/src/components/model-policy-picker.tsx +337 -381
- package/src/components/open-geni-chat.tsx +319 -0
- package/src/components/open-geni-links.tsx +179 -0
- package/src/components/openrouter-mark.tsx +13 -0
- package/src/components/pierre-diff.tsx +41 -16
- package/src/components/pierre-file.tsx +36 -11
- package/src/components/preview-loading.tsx +154 -0
- package/src/components/queue-item-content.ts +14 -0
- package/src/components/queue-surface-implementation.tsx +132 -42
- package/src/components/queue-surface-state.tsx +3 -1
- package/src/components/sandbox-files.tsx +267 -35
- package/src/components/sandbox-terminal.tsx +48 -11
- package/src/components/sandbox-workspace.tsx +337 -135
- package/src/components/session-capability-frame.tsx +192 -0
- package/src/components/session-chrome.tsx +1027 -328
- package/src/components/session-commands-panel.tsx +126 -0
- package/src/components/session-commands.tsx +18 -0
- package/src/components/session-connection-request.tsx +97 -0
- package/src/components/session-conversation.tsx +512 -0
- package/src/components/session-list.tsx +250 -0
- package/src/components/session-mcp-capability-card.tsx +680 -0
- package/src/components/session-status.tsx +1 -1
- package/src/components/timeline-anchor.tsx +119 -0
- package/src/components/timeline-annotation-chrome.tsx +196 -0
- package/src/components/timeline-annotation-layout.ts +268 -0
- package/src/components/timeline-annotation-markers.tsx +185 -0
- package/src/components/timeline-annotation-reveal-context.ts +9 -0
- package/src/components/timeline-annotation-selection.tsx +106 -54
- package/src/components/timeline-annotation-shared.ts +245 -0
- package/src/components/timeline-annotations-dialog.tsx +185 -128
- package/src/components/timeline-annotations.tsx +189 -45
- package/src/components/timeline-reading-progress.ts +80 -0
- package/src/components/timeline-search.tsx +168 -0
- package/src/components/timeline-settlement.ts +60 -0
- package/src/components/tip-follow.ts +70 -7
- package/src/components/tooltip.tsx +38 -5
- package/src/components/usage-limit-notice.tsx +179 -0
- package/src/components/usage-member-list.tsx +792 -0
- package/src/components/usage-meter.tsx +382 -0
- package/src/components/use-viewer-menu-dismiss.ts +33 -0
- package/src/components/user-message-body.tsx +194 -49
- package/src/components/workspace-dock.tsx +141 -175
- package/src/composer.ts +6 -1
- package/src/connect-account-identity.tsx +34 -0
- package/src/connect-accounts.tsx +233 -0
- package/src/connect-chooser.tsx +336 -0
- package/src/connect-panel.tsx +99 -0
- package/src/connect-setup.tsx +307 -0
- package/src/connect.ts +60 -0
- package/src/connection-assets.d.ts +4 -0
- package/src/connection-catalog.tsx +162 -0
- package/src/connection-discovery.tsx +235 -0
- package/src/connection-installed.tsx +51 -0
- package/src/connection-logo.tsx +37 -0
- package/src/connection-service-logo.tsx +55 -0
- package/src/connection-service-presentation.ts +46 -0
- package/src/connection-skeleton.tsx +16 -0
- package/src/connection-type-picker.tsx +36 -0
- package/src/conversation-timeline.ts +92 -0
- package/src/desktop.ts +24 -0
- package/src/device-authorization.tsx +98 -0
- package/src/diffs.ts +16 -0
- package/src/discovery-cache.ts +42 -0
- package/src/editor.ts +13 -0
- package/src/embedded-session-client.ts +104 -0
- package/src/file-node-visibility.ts +66 -0
- package/src/hooks/channel-cache.ts +104 -0
- package/src/hooks/internal.ts +3 -2
- package/src/hooks/latest-question.ts +164 -0
- package/src/hooks/shared-machines-list.ts +239 -0
- package/src/hooks/use-attached-browsers.ts +5 -1
- package/src/hooks/use-available-models.ts +20 -14
- package/src/hooks/use-browser-frame-stream.ts +25 -3
- package/src/hooks/use-browser-session.ts +271 -71
- package/src/hooks/use-browser-sessions.ts +7 -1
- package/src/hooks/use-channels.ts +32 -10
- package/src/hooks/use-codex-accounts.ts +78 -21
- package/src/hooks/use-composer.ts +1034 -320
- package/src/hooks/use-computer-frame-stream.ts +39 -16
- package/src/hooks/use-computer-input-posture.ts +94 -0
- package/src/hooks/use-computer-session.ts +110 -32
- package/src/hooks/use-computer-sessions.ts +8 -1
- package/src/hooks/use-connect.ts +23 -0
- package/src/hooks/use-desktop-stream.ts +19 -28
- package/src/hooks/use-file-attachments.ts +118 -10
- package/src/hooks/use-goal.ts +36 -9
- package/src/hooks/use-human-input.ts +31 -4
- package/src/hooks/use-last-started-turn-policy.ts +15 -13
- package/src/hooks/use-machine-chip.ts +23 -6
- package/src/hooks/use-machines.ts +104 -6
- package/src/hooks/use-sandbox-files.ts +253 -150
- package/src/hooks/use-sandbox-git.ts +58 -29
- package/src/hooks/use-session-background-commands.ts +67 -0
- package/src/hooks/use-session-capabilities.ts +21 -2
- package/src/hooks/use-session-events.ts +759 -433
- package/src/hooks/use-session-lineage.ts +28 -6
- package/src/hooks/use-session-mcp-approval-policy.ts +13 -5
- package/src/hooks/use-session.ts +75 -16
- package/src/hooks/use-slash-commands.ts +6 -11
- package/src/hooks/use-turn-queue.ts +113 -13
- package/src/hooks/use-usage.ts +100 -0
- package/src/hooks/use-voice-input.ts +12 -1
- package/src/hooks/use-workspace-capture.ts +3 -2
- package/src/hooks/use-workspace-edit.ts +23 -5
- package/src/hooks/use-workspace-sessions.ts +99 -11
- package/src/human-input.ts +12 -1
- package/src/identity-link-accounts.tsx +148 -0
- package/src/identity-link-consent.tsx +192 -0
- package/src/index.ts +157 -12
- package/src/interaction.ts +1 -0
- package/src/lib/error-message.ts +37 -0
- package/src/lib/format.ts +150 -14
- package/src/lib/host-theme.ts +511 -0
- package/src/lib/interaction-errors.ts +33 -0
- package/src/lib/menu-styles.ts +44 -0
- package/src/lib/pierre-diffs-loader.ts +53 -0
- package/src/lib/workbench-peers.ts +62 -0
- package/src/lib/xterm-theme.ts +23 -21
- package/src/machines.ts +9 -1
- package/src/mcp-connection-status.ts +35 -0
- package/src/model-policy.ts +223 -69
- package/src/older-history.ts +87 -0
- package/src/plugin-details.tsx +185 -0
- package/src/plugin-discovery.tsx +196 -0
- package/src/provider.tsx +55 -14
- package/src/realtime/dropdown-menu.tsx +19 -12
- package/src/realtime/realtime-control.tsx +274 -60
- package/src/session-auth-recommendation.ts +48 -0
- package/src/session-capability-policy.ts +83 -0
- package/src/session-context.ts +1 -0
- package/src/session-ui.ts +66 -2
- package/src/session.ts +18 -1
- package/src/sites-ui.tsx +402 -0
- package/src/sites.ts +3 -0
- package/src/skill-discovery.tsx +208 -0
- package/src/terminal.ts +26 -0
- package/src/timeline/activity-rail.tsx +171 -80
- package/src/timeline/allowance-exhausted-row.tsx +86 -0
- package/src/timeline/compaction-copy.ts +42 -0
- package/src/timeline/entrance.tsx +28 -3
- package/src/timeline/fleet-decision-projection.ts +2 -1
- package/src/timeline/fleet-decision-row.tsx +1 -0
- package/src/timeline/genie-loading.tsx +136 -0
- package/src/timeline/index.ts +11 -0
- package/src/timeline/knowledge-receipt.tsx +100 -0
- package/src/timeline/parsers.ts +2 -2
- package/src/timeline/platform-activity-row.tsx +216 -0
- package/src/timeline/presented-image.ts +49 -0
- package/src/timeline/projection.ts +1600 -84
- package/src/timeline/registry.ts +15 -3
- package/src/timeline/retained-image.ts +97 -0
- package/src/timeline/rolling-activity.tsx +92 -0
- package/src/timeline/screenshot-lightbox.tsx +115 -17
- package/src/timeline/shared.tsx +47 -15
- package/src/timeline/startup-preference.ts +33 -0
- package/src/timeline/startup-timings.tsx +145 -0
- package/src/timeline/tool-display-name.ts +8 -6
- package/src/timeline/tool-renderers.tsx +497 -128
- package/src/timeline/turn-summary.tsx +208 -44
- package/src/timeline/types.ts +186 -7
- package/src/types/machines.ts +10 -0
- package/src/usage/allowance-copy.ts +64 -0
- package/src/usage/summary.ts +93 -0
- package/src/usage.ts +50 -0
- package/styles/compiled.css +2098 -757
- package/styles/connect.css +284 -0
- package/styles/connect.d.ts +1 -0
- package/styles/effective-tokens.css +1 -0
- package/styles/index.css +201 -9
- package/styles/responsive.css +27 -1
- package/styles/session-capability.css +44 -0
- package/styles/tokens.css +135 -65
- package/dist/chunk-5UQPNLIO.js.map +0 -1
- package/dist/chunk-6KLX2RH5.js.map +0 -1
- package/dist/chunk-7WCLAEFV.js.map +0 -1
- package/dist/chunk-B6WPZSTT.js.map +0 -1
- package/dist/chunk-FK6VG4LL.js +0 -90
- package/dist/chunk-FK6VG4LL.js.map +0 -1
- package/dist/chunk-HA46CYQK.js.map +0 -1
- package/dist/chunk-HUIKIDM5.js.map +0 -1
- package/dist/chunk-IGC6A2ZI.js.map +0 -1
- package/dist/chunk-KCGXPP5V.js.map +0 -1
- package/dist/chunk-KZ73RL76.js.map +0 -1
- package/dist/chunk-LAKLF4PA.js +0 -141
- package/dist/chunk-LAKLF4PA.js.map +0 -1
- package/dist/chunk-LLOLUHVG.js.map +0 -1
- package/dist/chunk-MKPIAGVL.js +0 -465
- package/dist/chunk-MKPIAGVL.js.map +0 -1
- package/dist/chunk-PEI6RANI.js.map +0 -1
- package/dist/chunk-R3AZOAB5.js.map +0 -1
- package/dist/chunk-WSK7G5LE.js +0 -170
- package/dist/chunk-WSK7G5LE.js.map +0 -1
- package/dist/chunk-XBZWOM2K.js +0 -218
- package/dist/chunk-XBZWOM2K.js.map +0 -1
- package/dist/chunk-Y7OEDUJ5.js +0 -8810
- package/dist/chunk-Y7OEDUJ5.js.map +0 -1
- package/dist/fleet-decision-row-GGCAT4E4.js.map +0 -1
- package/dist/hooks/use-packs.d.ts +0 -32
- package/dist/interactive-workbench-viewers-TOHBXJEE.js +0 -15
- package/dist/queue-surface-implementation-2KVJTYXH.js.map +0 -1
- package/dist/timeline-annotation-selection-3L7LHGG2.js +0 -187
- package/dist/timeline-annotation-selection-3L7LHGG2.js.map +0 -1
- package/dist/timeline-annotations-dialog-U7EVLR75.js +0 -196
- package/dist/timeline-annotations-dialog-U7EVLR75.js.map +0 -1
- package/src/hooks/use-packs.ts +0 -157
- /package/dist/{interactive-workbench-viewers-TOHBXJEE.js.map → browser-viewer-GTR5XQ7X.js.map} +0 -0
|
@@ -16,12 +16,31 @@ import {
|
|
|
16
16
|
type EmbeddedBrowserInteractionClientOverride,
|
|
17
17
|
useEmbeddedBrowserInteraction,
|
|
18
18
|
} from "../session-context";
|
|
19
|
+
import { isNonRetryableInteractionError } from "../lib/interaction-errors";
|
|
19
20
|
import { usePageLiveActivity } from "./internal";
|
|
20
21
|
|
|
22
|
+
/** Immutable input fence; queued actions never need the encoded screenshot. */
|
|
23
|
+
export type BrowserFrameInputFence = Pick<
|
|
24
|
+
BrowserFrame,
|
|
25
|
+
| "browserSessionId"
|
|
26
|
+
| "controllerGeneration"
|
|
27
|
+
| "targetId"
|
|
28
|
+
| "targetGeneration"
|
|
29
|
+
| "documentGeneration"
|
|
30
|
+
| "frameId"
|
|
31
|
+
>;
|
|
32
|
+
|
|
33
|
+
export type BrowserInputFailure = Pick<BrowserActionReceipt, "operationId" | "error"> & {
|
|
34
|
+
state: Exclude<BrowserActionReceipt["state"], "completed">;
|
|
35
|
+
};
|
|
36
|
+
|
|
21
37
|
export type UseBrowserSessionOptions = EmbeddedBrowserInteractionClientOverride & {
|
|
22
38
|
browserSessionId: string | null;
|
|
23
39
|
enabled?: boolean | undefined;
|
|
24
40
|
pollIntervalMs?: number | undefined;
|
|
41
|
+
/** Keep session/tab inventory current without repeatedly fetching the full
|
|
42
|
+
* accessibility tree while a live frame is available or the viewer is hidden. */
|
|
43
|
+
semanticObservationEnabled?: boolean | undefined;
|
|
25
44
|
};
|
|
26
45
|
|
|
27
46
|
export type UseBrowserSessionResult = {
|
|
@@ -32,7 +51,13 @@ export type UseBrowserSessionResult = {
|
|
|
32
51
|
loading: boolean;
|
|
33
52
|
mutating: boolean;
|
|
34
53
|
error: Error | null;
|
|
54
|
+
inputFailure: BrowserInputFailure | null;
|
|
35
55
|
refresh: () => Promise<void>;
|
|
56
|
+
observeForInput: () => Promise<BrowserObservation>;
|
|
57
|
+
actFromObservation: (
|
|
58
|
+
action: BrowserAction,
|
|
59
|
+
observation: BrowserObservation,
|
|
60
|
+
) => Promise<BrowserActionReceipt>;
|
|
36
61
|
selectTarget: (targetId: string) => Promise<BrowserTarget>;
|
|
37
62
|
openTarget: (url?: string) => Promise<BrowserTarget>;
|
|
38
63
|
closeTarget: (targetId: string) => Promise<void>;
|
|
@@ -44,8 +69,9 @@ export type UseBrowserSessionResult = {
|
|
|
44
69
|
* the controller fence instead of targeting a newer page. */
|
|
45
70
|
actFromFrame: (
|
|
46
71
|
action: BrowserAction | BrowserActionBatch,
|
|
47
|
-
frame:
|
|
72
|
+
frame: BrowserFrameInputFence,
|
|
48
73
|
operationId?: string,
|
|
74
|
+
observationMode?: "none" | "input",
|
|
49
75
|
) => Promise<BrowserActionReceipt>;
|
|
50
76
|
readClipboard: () => Promise<BrowserClipboard>;
|
|
51
77
|
diagnostics: (options?: BrowserDiagnosticsOptions) => Promise<BrowserDiagnosticBatch>;
|
|
@@ -57,6 +83,13 @@ export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowser
|
|
|
57
83
|
const { client, workspaceId } = useEmbeddedBrowserInteraction(options);
|
|
58
84
|
const browserSessionId = options.browserSessionId;
|
|
59
85
|
const enabled = (options.enabled ?? true) && browserSessionId !== null;
|
|
86
|
+
const semanticObservationEnabled = options.semanticObservationEnabled ?? true;
|
|
87
|
+
const semanticObservationEnabledRef = useRef(semanticObservationEnabled);
|
|
88
|
+
semanticObservationEnabledRef.current = semanticObservationEnabled;
|
|
89
|
+
const previousSemanticObservationRef = useRef({
|
|
90
|
+
browserSessionId,
|
|
91
|
+
enabled: semanticObservationEnabled,
|
|
92
|
+
});
|
|
60
93
|
const pageLive = usePageLiveActivity();
|
|
61
94
|
const pollIntervalMs = Math.max(750, options.pollIntervalMs ?? 2_000);
|
|
62
95
|
const [state, setState] = useState<{
|
|
@@ -68,15 +101,25 @@ export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowser
|
|
|
68
101
|
loading: boolean;
|
|
69
102
|
mutating: boolean;
|
|
70
103
|
error: Error | null;
|
|
104
|
+
inputFailure: BrowserInputFailure | null;
|
|
71
105
|
}>(() => emptyState(browserSessionId, enabled));
|
|
72
106
|
const visible =
|
|
73
107
|
state.browserSessionId === browserSessionId ? state : emptyState(browserSessionId, enabled);
|
|
108
|
+
const refreshBlocked = isNonRetryableInteractionError(visible.error);
|
|
109
|
+
const inputFailureRef = useRef(visible.inputFailure);
|
|
110
|
+
inputFailureRef.current = visible.inputFailure;
|
|
74
111
|
const selectedTargetIdRef = useRef<string | null>(visible.selectedTargetId);
|
|
75
112
|
selectedTargetIdRef.current = visible.selectedTargetId;
|
|
113
|
+
const selectedTargetRef = useRef<BrowserTarget | null>(
|
|
114
|
+
visible.targets.find((target) => target.id === visible.selectedTargetId) ?? null,
|
|
115
|
+
);
|
|
116
|
+
selectedTargetRef.current =
|
|
117
|
+
visible.targets.find((target) => target.id === visible.selectedTargetId) ?? null;
|
|
76
118
|
const observationRef = useRef<{
|
|
77
119
|
browserSessionId: string | null;
|
|
78
120
|
observation: BrowserObservation | null;
|
|
79
121
|
}>({ browserSessionId, observation: visible.observation });
|
|
122
|
+
const lastObservationAtRef = useRef(0);
|
|
80
123
|
if (observationRef.current.browserSessionId !== browserSessionId) {
|
|
81
124
|
observationRef.current = {
|
|
82
125
|
browserSessionId,
|
|
@@ -104,77 +147,133 @@ export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowser
|
|
|
104
147
|
requestRef.current = { id, controller: null };
|
|
105
148
|
}, []);
|
|
106
149
|
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
client.getBrowserSession(workspaceId, browserSessionId, {
|
|
116
|
-
signal: controller.signal,
|
|
117
|
-
}),
|
|
118
|
-
client.listBrowserTargets(workspaceId, browserSessionId, {
|
|
119
|
-
signal: controller.signal,
|
|
120
|
-
}),
|
|
121
|
-
]);
|
|
122
|
-
if (!mountedRef.current || requestRef.current.id !== id) return;
|
|
123
|
-
const selected = chooseTarget(targetResponse.targets, selectedTargetIdRef.current);
|
|
124
|
-
selectedTargetIdRef.current = selected?.id ?? null;
|
|
125
|
-
observationRef.current = { browserSessionId, observation: null };
|
|
126
|
-
setState((current) =>
|
|
127
|
-
current.browserSessionId === browserSessionId
|
|
128
|
-
? {
|
|
129
|
-
...current,
|
|
130
|
-
session,
|
|
131
|
-
targets: targetResponse.targets,
|
|
132
|
-
selectedTargetId: selected?.id ?? null,
|
|
133
|
-
observation: null,
|
|
134
|
-
loading: false,
|
|
135
|
-
error: null,
|
|
136
|
-
}
|
|
137
|
-
: current,
|
|
138
|
-
);
|
|
139
|
-
if (!selected) return;
|
|
150
|
+
const refreshInventory = useCallback(
|
|
151
|
+
async (checkInput = false) => {
|
|
152
|
+
if (!enabled || !browserSessionId) return;
|
|
153
|
+
const checkedInputFailure = inputFailureRef.current;
|
|
154
|
+
const id = requestRef.current.id + 1;
|
|
155
|
+
requestRef.current.controller?.abort();
|
|
156
|
+
const controller = new AbortController();
|
|
157
|
+
requestRef.current = { id, controller };
|
|
140
158
|
try {
|
|
141
|
-
const
|
|
142
|
-
workspaceId,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
159
|
+
const [session, targetResponse] = await Promise.all([
|
|
160
|
+
client.getBrowserSession(workspaceId, browserSessionId, {
|
|
161
|
+
signal: controller.signal,
|
|
162
|
+
}),
|
|
163
|
+
client.listBrowserTargets(workspaceId, browserSessionId, {
|
|
164
|
+
signal: controller.signal,
|
|
165
|
+
}),
|
|
166
|
+
]);
|
|
147
167
|
if (!mountedRef.current || requestRef.current.id !== id) return;
|
|
148
|
-
|
|
168
|
+
const selected = chooseTarget(targetResponse.targets, selectedTargetIdRef.current);
|
|
169
|
+
selectedTargetIdRef.current = selected?.id ?? null;
|
|
170
|
+
const previousObservation =
|
|
171
|
+
observationRef.current.browserSessionId === browserSessionId
|
|
172
|
+
? observationRef.current.observation
|
|
173
|
+
: null;
|
|
174
|
+
const retainedObservation =
|
|
175
|
+
selected && previousObservation && sameObservationTarget(previousObservation, selected)
|
|
176
|
+
? previousObservation
|
|
177
|
+
: null;
|
|
178
|
+
observationRef.current = { browserSessionId, observation: retainedObservation };
|
|
149
179
|
setState((current) =>
|
|
150
|
-
current.browserSessionId === browserSessionId
|
|
151
|
-
|
|
152
|
-
|
|
180
|
+
current.browserSessionId === browserSessionId
|
|
181
|
+
? {
|
|
182
|
+
...current,
|
|
183
|
+
session,
|
|
184
|
+
targets: targetResponse.targets,
|
|
185
|
+
selectedTargetId: selected?.id ?? null,
|
|
186
|
+
observation: retainedObservation,
|
|
187
|
+
loading: false,
|
|
188
|
+
error: null,
|
|
189
|
+
// Media and background polling cannot confirm an input outcome.
|
|
190
|
+
// Only an explicit fresh check clears the notice it began with.
|
|
191
|
+
inputFailure:
|
|
192
|
+
checkInput &&
|
|
193
|
+
session.id === browserSessionId &&
|
|
194
|
+
targetResponse.browserSessionId === browserSessionId &&
|
|
195
|
+
current.inputFailure === checkedInputFailure
|
|
196
|
+
? null
|
|
197
|
+
: current.inputFailure,
|
|
198
|
+
}
|
|
153
199
|
: current,
|
|
154
200
|
);
|
|
201
|
+
if (!selected || !semanticObservationEnabledRef.current) return;
|
|
202
|
+
try {
|
|
203
|
+
const observation = await client.observeBrowserTarget(
|
|
204
|
+
workspaceId,
|
|
205
|
+
browserSessionId,
|
|
206
|
+
selected.id,
|
|
207
|
+
{ signal: controller.signal },
|
|
208
|
+
);
|
|
209
|
+
if (!mountedRef.current || requestRef.current.id !== id) return;
|
|
210
|
+
observationRef.current = { browserSessionId, observation };
|
|
211
|
+
lastObservationAtRef.current = Date.now();
|
|
212
|
+
setState((current) =>
|
|
213
|
+
current.browserSessionId === browserSessionId &&
|
|
214
|
+
current.selectedTargetId === observation.target.id
|
|
215
|
+
? { ...current, observation }
|
|
216
|
+
: current,
|
|
217
|
+
);
|
|
218
|
+
} catch (cause) {
|
|
219
|
+
if (controller.signal.aborted || !mountedRef.current || requestRef.current.id !== id)
|
|
220
|
+
return;
|
|
221
|
+
// Target inventory and the media plane remain authoritative for the
|
|
222
|
+
// human-facing browser. A failed semantic snapshot must not blank or
|
|
223
|
+
// disable an otherwise live visual browser.
|
|
224
|
+
void cause;
|
|
225
|
+
}
|
|
155
226
|
} catch (cause) {
|
|
156
227
|
if (controller.signal.aborted || !mountedRef.current || requestRef.current.id !== id)
|
|
157
228
|
return;
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
229
|
+
setState((current) =>
|
|
230
|
+
current.browserSessionId === browserSessionId
|
|
231
|
+
? {
|
|
232
|
+
...current,
|
|
233
|
+
loading: false,
|
|
234
|
+
error: cause instanceof Error ? cause : new Error(String(cause)),
|
|
235
|
+
}
|
|
236
|
+
: current,
|
|
237
|
+
);
|
|
238
|
+
} finally {
|
|
239
|
+
if (requestRef.current.id === id) {
|
|
240
|
+
requestRef.current = { id, controller: null };
|
|
241
|
+
}
|
|
162
242
|
}
|
|
163
|
-
}
|
|
164
|
-
|
|
243
|
+
},
|
|
244
|
+
[browserSessionId, client, enabled, workspaceId],
|
|
245
|
+
);
|
|
246
|
+
|
|
247
|
+
const refresh = useCallback(async () => await refreshInventory(true), [refreshInventory]);
|
|
248
|
+
|
|
249
|
+
const refreshSemantic = useCallback(async (): Promise<void> => {
|
|
250
|
+
if (!enabled || !browserSessionId) return;
|
|
251
|
+
const target = selectedTargetRef.current;
|
|
252
|
+
if (!target) return;
|
|
253
|
+
const id = requestRef.current.id + 1;
|
|
254
|
+
requestRef.current.controller?.abort();
|
|
255
|
+
const controller = new AbortController();
|
|
256
|
+
requestRef.current = { id, controller };
|
|
257
|
+
try {
|
|
258
|
+
const observation = await client.observeBrowserTarget(
|
|
259
|
+
workspaceId,
|
|
260
|
+
browserSessionId,
|
|
261
|
+
target.id,
|
|
262
|
+
{ signal: controller.signal },
|
|
263
|
+
);
|
|
264
|
+
if (!mountedRef.current || requestRef.current.id !== id) return;
|
|
265
|
+
if (!sameObservationTarget(observation, selectedTargetRef.current)) return;
|
|
266
|
+
observationRef.current = { browserSessionId, observation };
|
|
267
|
+
lastObservationAtRef.current = Date.now();
|
|
165
268
|
setState((current) =>
|
|
166
|
-
current.browserSessionId === browserSessionId
|
|
167
|
-
? {
|
|
168
|
-
...current,
|
|
169
|
-
loading: false,
|
|
170
|
-
error: cause instanceof Error ? cause : new Error(String(cause)),
|
|
171
|
-
}
|
|
269
|
+
current.browserSessionId === browserSessionId && current.selectedTargetId === target.id
|
|
270
|
+
? { ...current, observation }
|
|
172
271
|
: current,
|
|
173
272
|
);
|
|
273
|
+
} catch {
|
|
274
|
+
// A failed semantic fallback cannot disable an otherwise live browser.
|
|
174
275
|
} finally {
|
|
175
|
-
if (requestRef.current.id === id) {
|
|
176
|
-
requestRef.current = { id, controller: null };
|
|
177
|
-
}
|
|
276
|
+
if (requestRef.current.id === id) requestRef.current = { id, controller: null };
|
|
178
277
|
}
|
|
179
278
|
}, [browserSessionId, client, enabled, workspaceId]);
|
|
180
279
|
|
|
@@ -190,27 +289,58 @@ export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowser
|
|
|
190
289
|
? { ...current, loading: true }
|
|
191
290
|
: emptyState(browserSessionId, true),
|
|
192
291
|
);
|
|
193
|
-
void
|
|
292
|
+
void refreshInventory();
|
|
194
293
|
return () => {
|
|
195
294
|
mountedRef.current = false;
|
|
196
295
|
invalidateRefresh();
|
|
197
296
|
};
|
|
198
|
-
}, [browserSessionId, enabled, invalidateRefresh,
|
|
297
|
+
}, [browserSessionId, enabled, invalidateRefresh, refreshInventory]);
|
|
298
|
+
|
|
299
|
+
useEffect(() => {
|
|
300
|
+
const previous = previousSemanticObservationRef.current;
|
|
301
|
+
previousSemanticObservationRef.current = {
|
|
302
|
+
browserSessionId,
|
|
303
|
+
enabled: semanticObservationEnabled,
|
|
304
|
+
};
|
|
305
|
+
if (
|
|
306
|
+
enabled &&
|
|
307
|
+
semanticObservationEnabled &&
|
|
308
|
+
previous.browserSessionId === browserSessionId &&
|
|
309
|
+
!previous.enabled
|
|
310
|
+
) {
|
|
311
|
+
// The media stream disappeared or the user returned to the Browser tab.
|
|
312
|
+
// A just-returned action/tab observation is already a fresh fallback.
|
|
313
|
+
// Otherwise drop the old tree/fence until a new read settles.
|
|
314
|
+
const currentObservation = observationRef.current.observation;
|
|
315
|
+
if (
|
|
316
|
+
currentObservation &&
|
|
317
|
+
sameObservationTarget(currentObservation, selectedTargetRef.current) &&
|
|
318
|
+
Date.now() - lastObservationAtRef.current < pollIntervalMs
|
|
319
|
+
) {
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
observationRef.current = { browserSessionId, observation: null };
|
|
323
|
+
setState((current) =>
|
|
324
|
+
current.browserSessionId === browserSessionId ? { ...current, observation: null } : current,
|
|
325
|
+
);
|
|
326
|
+
void refreshSemantic();
|
|
327
|
+
}
|
|
328
|
+
}, [browserSessionId, enabled, pollIntervalMs, refreshSemantic, semanticObservationEnabled]);
|
|
199
329
|
|
|
200
330
|
useEffect(() => {
|
|
201
|
-
if (!enabled || !pageLive || visible.mutating) return;
|
|
331
|
+
if (!enabled || !pageLive || visible.mutating || refreshBlocked) return;
|
|
202
332
|
const timer = setInterval(() => {
|
|
203
|
-
if (!requestRef.current.controller) void
|
|
333
|
+
if (!requestRef.current.controller) void refreshInventory();
|
|
204
334
|
}, pollIntervalMs);
|
|
205
335
|
return () => clearInterval(timer);
|
|
206
|
-
}, [enabled, pageLive, pollIntervalMs,
|
|
336
|
+
}, [enabled, pageLive, pollIntervalMs, refreshInventory, refreshBlocked, visible.mutating]);
|
|
207
337
|
|
|
208
338
|
useEffect(() => {
|
|
209
|
-
if (!enabled || !browserSessionId || !pageLive) return;
|
|
339
|
+
if (!enabled || !browserSessionId || !pageLive || refreshBlocked) return;
|
|
210
340
|
let disposed = false;
|
|
211
341
|
const heartbeat = () => {
|
|
212
342
|
void client.heartbeatBrowserSession(workspaceId, browserSessionId).catch(() => {
|
|
213
|
-
if (!disposed) void
|
|
343
|
+
if (!disposed) void refreshInventory();
|
|
214
344
|
});
|
|
215
345
|
};
|
|
216
346
|
const timer = setInterval(heartbeat, 30_000);
|
|
@@ -218,7 +348,7 @@ export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowser
|
|
|
218
348
|
disposed = true;
|
|
219
349
|
clearInterval(timer);
|
|
220
350
|
};
|
|
221
|
-
}, [browserSessionId, client, enabled, pageLive,
|
|
351
|
+
}, [browserSessionId, client, enabled, pageLive, refreshInventory, refreshBlocked, workspaceId]);
|
|
222
352
|
|
|
223
353
|
const runMutation = useCallback(
|
|
224
354
|
async <T>(scopeBrowserSessionId: string, operation: () => Promise<T>): Promise<T> => {
|
|
@@ -299,6 +429,7 @@ export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowser
|
|
|
299
429
|
}
|
|
300
430
|
selectedTargetIdRef.current = target.id;
|
|
301
431
|
observationRef.current = { browserSessionId, observation };
|
|
432
|
+
lastObservationAtRef.current = Date.now();
|
|
302
433
|
setState((current) =>
|
|
303
434
|
current.browserSessionId === browserSessionId
|
|
304
435
|
? {
|
|
@@ -330,6 +461,7 @@ export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowser
|
|
|
330
461
|
const target = observation.target;
|
|
331
462
|
selectedTargetIdRef.current = target.id;
|
|
332
463
|
observationRef.current = { browserSessionId, observation };
|
|
464
|
+
lastObservationAtRef.current = Date.now();
|
|
333
465
|
setState((current) =>
|
|
334
466
|
current.browserSessionId === browserSessionId
|
|
335
467
|
? {
|
|
@@ -363,6 +495,7 @@ export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowser
|
|
|
363
495
|
: null;
|
|
364
496
|
selectedTargetIdRef.current = selected?.id ?? null;
|
|
365
497
|
observationRef.current = { browserSessionId, observation };
|
|
498
|
+
if (observation) lastObservationAtRef.current = Date.now();
|
|
366
499
|
setState((current) =>
|
|
367
500
|
current.browserSessionId === browserSessionId
|
|
368
501
|
? {
|
|
@@ -382,7 +515,13 @@ export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowser
|
|
|
382
515
|
async (
|
|
383
516
|
action: BrowserAction | BrowserActionBatch,
|
|
384
517
|
operationId: string,
|
|
385
|
-
frame:
|
|
518
|
+
frame:
|
|
519
|
+
| (Pick<BrowserFrame, "browserSessionId" | "targetId" | "targetGeneration"> & {
|
|
520
|
+
frameId: string | null;
|
|
521
|
+
documentGeneration: string | null;
|
|
522
|
+
})
|
|
523
|
+
| null,
|
|
524
|
+
observationMode: "none" | "input" = "none",
|
|
386
525
|
): Promise<BrowserActionReceipt> => {
|
|
387
526
|
if (!browserSessionId) throw new Error("No BrowserSession is selected.");
|
|
388
527
|
if (frame && frame.browserSessionId !== browserSessionId) {
|
|
@@ -414,14 +553,25 @@ export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowser
|
|
|
414
553
|
const receipt = await client.actInBrowser(workspaceId, browserSessionId, {
|
|
415
554
|
operationId,
|
|
416
555
|
...fence,
|
|
417
|
-
observationMode
|
|
556
|
+
observationMode,
|
|
418
557
|
action,
|
|
419
558
|
});
|
|
559
|
+
if (receipt.state !== "completed") {
|
|
560
|
+
const inputFailure: BrowserInputFailure = {
|
|
561
|
+
operationId: receipt.operationId,
|
|
562
|
+
state: receipt.state,
|
|
563
|
+
error: receipt.error,
|
|
564
|
+
};
|
|
565
|
+
setState((current) =>
|
|
566
|
+
current.browserSessionId === browserSessionId ? { ...current, inputFailure } : current,
|
|
567
|
+
);
|
|
568
|
+
}
|
|
420
569
|
if (receipt.observation) {
|
|
421
570
|
observationRef.current = {
|
|
422
571
|
browserSessionId,
|
|
423
572
|
observation: receipt.observation,
|
|
424
573
|
};
|
|
574
|
+
lastObservationAtRef.current = Date.now();
|
|
425
575
|
setState((current) =>
|
|
426
576
|
current.browserSessionId === browserSessionId
|
|
427
577
|
? {
|
|
@@ -455,9 +605,41 @@ export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowser
|
|
|
455
605
|
const actFromFrame = useCallback(
|
|
456
606
|
async (
|
|
457
607
|
action: BrowserAction | BrowserActionBatch,
|
|
458
|
-
frame:
|
|
608
|
+
frame: BrowserFrameInputFence,
|
|
459
609
|
operationId: string = crypto.randomUUID(),
|
|
460
|
-
|
|
610
|
+
observationMode: "none" | "input" = "none",
|
|
611
|
+
): Promise<BrowserActionReceipt> =>
|
|
612
|
+
await dispatchAction(action, operationId, frame, observationMode),
|
|
613
|
+
[dispatchAction],
|
|
614
|
+
);
|
|
615
|
+
|
|
616
|
+
const observeForInput = useCallback(async (): Promise<BrowserObservation> => {
|
|
617
|
+
const target = selectedTargetRef.current;
|
|
618
|
+
if (!browserSessionId || !target) throw new Error("No browser tab is selected.");
|
|
619
|
+
const observation = await client.observeBrowserTarget(workspaceId, browserSessionId, target.id);
|
|
620
|
+
if (
|
|
621
|
+
!mountedRef.current ||
|
|
622
|
+
observation.browserSessionId !== browserSessionId ||
|
|
623
|
+
!sameObservationTarget(observation, selectedTargetRef.current)
|
|
624
|
+
) {
|
|
625
|
+
throw new Error("The browser page changed. Open the options again.");
|
|
626
|
+
}
|
|
627
|
+
return observation;
|
|
628
|
+
}, [browserSessionId, client, workspaceId]);
|
|
629
|
+
|
|
630
|
+
const actFromObservation = useCallback(
|
|
631
|
+
async (action: BrowserAction, observation: BrowserObservation) => {
|
|
632
|
+
if (!sameObservationTarget(observation, selectedTargetRef.current)) {
|
|
633
|
+
throw new Error("The browser page changed. Open the options again.");
|
|
634
|
+
}
|
|
635
|
+
return await dispatchAction(action, crypto.randomUUID(), {
|
|
636
|
+
browserSessionId: observation.browserSessionId,
|
|
637
|
+
targetId: observation.target.id,
|
|
638
|
+
targetGeneration: observation.target.targetGeneration,
|
|
639
|
+
documentGeneration: observation.target.documentGeneration,
|
|
640
|
+
frameId: observation.frameId,
|
|
641
|
+
});
|
|
642
|
+
},
|
|
461
643
|
[dispatchAction],
|
|
462
644
|
);
|
|
463
645
|
|
|
@@ -495,7 +677,10 @@ export function useBrowserSession(options: UseBrowserSessionOptions): UseBrowser
|
|
|
495
677
|
loading: visible.loading,
|
|
496
678
|
mutating: visible.mutating,
|
|
497
679
|
error: visible.error,
|
|
680
|
+
inputFailure: visible.inputFailure,
|
|
498
681
|
refresh,
|
|
682
|
+
observeForInput,
|
|
683
|
+
actFromObservation,
|
|
499
684
|
selectTarget,
|
|
500
685
|
openTarget,
|
|
501
686
|
closeTarget,
|
|
@@ -516,6 +701,7 @@ function emptyState(browserSessionId: string | null, loading: boolean) {
|
|
|
516
701
|
loading,
|
|
517
702
|
mutating: false,
|
|
518
703
|
error: null as Error | null,
|
|
704
|
+
inputFailure: null as BrowserInputFailure | null,
|
|
519
705
|
};
|
|
520
706
|
}
|
|
521
707
|
|
|
@@ -538,6 +724,20 @@ function replaceTarget(targets: readonly BrowserTarget[], target: BrowserTarget)
|
|
|
538
724
|
return next.sort((left, right) => left.createdAt.localeCompare(right.createdAt));
|
|
539
725
|
}
|
|
540
726
|
|
|
727
|
+
function sameObservationTarget(
|
|
728
|
+
observation: BrowserObservation,
|
|
729
|
+
target: BrowserTarget | null,
|
|
730
|
+
): boolean {
|
|
731
|
+
return (
|
|
732
|
+
target !== null &&
|
|
733
|
+
observation.browserSessionId === target.browserSessionId &&
|
|
734
|
+
observation.target.id === target.id &&
|
|
735
|
+
observation.target.controllerGeneration === target.controllerGeneration &&
|
|
736
|
+
observation.target.targetGeneration === target.targetGeneration &&
|
|
737
|
+
observation.target.documentGeneration === target.documentGeneration
|
|
738
|
+
);
|
|
739
|
+
}
|
|
740
|
+
|
|
541
741
|
function isMissingBrowserTarget(error: unknown): boolean {
|
|
542
742
|
return error instanceof OpenGeniApiError && error.code === "target_not_found";
|
|
543
743
|
}
|
|
@@ -60,6 +60,7 @@ export function useBrowserSessions(
|
|
|
60
60
|
const enabled = options.enabled ?? true;
|
|
61
61
|
const [state, setState] = useState<{
|
|
62
62
|
workspaceId: string;
|
|
63
|
+
active: boolean;
|
|
63
64
|
revision: number;
|
|
64
65
|
sessions: BrowserSession[];
|
|
65
66
|
loading: boolean;
|
|
@@ -89,6 +90,7 @@ export function useBrowserSessions(
|
|
|
89
90
|
requestRef.current = { id, controller };
|
|
90
91
|
setState((current) => ({
|
|
91
92
|
...(current.workspaceId === workspaceId ? current : emptyState(workspaceId, true)),
|
|
93
|
+
active: true,
|
|
92
94
|
loading: foreground,
|
|
93
95
|
refreshing: !foreground,
|
|
94
96
|
error: foreground || current.workspaceId !== workspaceId ? null : current.error,
|
|
@@ -100,6 +102,7 @@ export function useBrowserSessions(
|
|
|
100
102
|
if (!mountedRef.current || requestRef.current.id !== id) return;
|
|
101
103
|
setState({
|
|
102
104
|
workspaceId,
|
|
105
|
+
active: true,
|
|
103
106
|
revision: response.revision,
|
|
104
107
|
sessions: sortBrowserSessions(response.sessions),
|
|
105
108
|
loading: false,
|
|
@@ -229,7 +232,9 @@ export function useBrowserSessions(
|
|
|
229
232
|
revision: visibleState.revision,
|
|
230
233
|
sessions: visibleState.sessions,
|
|
231
234
|
relevantSessions,
|
|
232
|
-
|
|
235
|
+
// A disabled registry is deliberately empty. Expose the first re-enabled
|
|
236
|
+
// render as loading so consumers do not reconcile against that empty gap.
|
|
237
|
+
loading: enabled ? !visibleState.active || visibleState.loading : false,
|
|
233
238
|
refreshing: visibleState.refreshing,
|
|
234
239
|
error: visibleState.error,
|
|
235
240
|
refresh,
|
|
@@ -243,6 +248,7 @@ export function useBrowserSessions(
|
|
|
243
248
|
function emptyState(workspaceId: string, loading: boolean) {
|
|
244
249
|
return {
|
|
245
250
|
workspaceId,
|
|
251
|
+
active: false,
|
|
246
252
|
revision: 0,
|
|
247
253
|
sessions: [] as BrowserSession[],
|
|
248
254
|
loading,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Channel, CreateChannelRequest, Session, UpdateChannelRequest } from "@opengeni/sdk";
|
|
2
|
-
import { useCallback } from "react";
|
|
2
|
+
import { useCallback, useMemo, useSyncExternalStore } from "react";
|
|
3
3
|
import { useOpenGeni, type ClientOverride } from "../provider";
|
|
4
|
+
import { channelCacheFor } from "./channel-cache";
|
|
4
5
|
import { useMutationRunner, usePolledValue } from "./internal";
|
|
5
6
|
|
|
6
7
|
export type UseChannelsOptions = ClientOverride & {
|
|
@@ -15,6 +16,7 @@ export type UseChannelsResult = {
|
|
|
15
16
|
refresh: () => Promise<void>;
|
|
16
17
|
create: (request: CreateChannelRequest) => Promise<Channel | null>;
|
|
17
18
|
update: (channelId: string, request: UpdateChannelRequest) => Promise<Channel | null>;
|
|
19
|
+
reorder: (channelIds: string[]) => Promise<Channel[] | null>;
|
|
18
20
|
remove: (channelId: string) => Promise<boolean>;
|
|
19
21
|
/** Re-file a session into a channel; null moves it back to the inbox. */
|
|
20
22
|
moveSession: (sessionId: string, channelId: string | null) => Promise<Session | null>;
|
|
@@ -30,25 +32,33 @@ export type UseChannelsResult = {
|
|
|
30
32
|
*/
|
|
31
33
|
export function useChannels(options: UseChannelsOptions = {}): UseChannelsResult {
|
|
32
34
|
const { client, workspaceId } = useOpenGeni(options);
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
const cache = useMemo(() => channelCacheFor(client, workspaceId), [client, workspaceId]);
|
|
36
|
+
const snapshot = useSyncExternalStore(cache.subscribe, cache.getSnapshot, cache.getSnapshot);
|
|
37
|
+
const load = useCallback(async () => {
|
|
38
|
+
const ticket = cache.beginLoad();
|
|
39
|
+
const channels = await client.listChannels(workspaceId);
|
|
40
|
+
cache.acceptLoad(ticket, channels);
|
|
41
|
+
return channels;
|
|
42
|
+
}, [cache, client, workspaceId]);
|
|
43
|
+
const { loading, error, refresh } = usePolledValue(load, {
|
|
38
44
|
pollIntervalMs: options.pollIntervalMs,
|
|
39
45
|
enabled: options.enabled,
|
|
40
46
|
});
|
|
41
|
-
const { run, mutating, mutationError, clearMutationError } = useMutationRunner();
|
|
47
|
+
const { run, mutating, mutationError, clearMutationError } = useMutationRunner(cache);
|
|
42
48
|
|
|
43
49
|
const create = useCallback(
|
|
44
50
|
async (request: CreateChannelRequest): Promise<Channel | null> => {
|
|
45
51
|
const result = await run(() => client.createChannel(workspaceId, request));
|
|
46
52
|
if (result) {
|
|
53
|
+
// Publish the canonical write response before this promise can resolve.
|
|
54
|
+
// The composer may create a session with this id immediately, while a
|
|
55
|
+
// sibling rail hook could still have an older list request in flight.
|
|
56
|
+
cache.publishCreated(result);
|
|
47
57
|
await refresh();
|
|
48
58
|
}
|
|
49
59
|
return result;
|
|
50
60
|
},
|
|
51
|
-
[client, workspaceId, run, refresh],
|
|
61
|
+
[cache, client, workspaceId, run, refresh],
|
|
52
62
|
);
|
|
53
63
|
|
|
54
64
|
const update = useCallback(
|
|
@@ -76,6 +86,15 @@ export function useChannels(options: UseChannelsOptions = {}): UseChannelsResult
|
|
|
76
86
|
[client, workspaceId, run, refresh],
|
|
77
87
|
);
|
|
78
88
|
|
|
89
|
+
const reorder = useCallback(
|
|
90
|
+
async (channelIds: string[]): Promise<Channel[] | null> => {
|
|
91
|
+
const result = await run(() => client.reorderChannels(workspaceId, { channelIds }));
|
|
92
|
+
if (result) await refresh();
|
|
93
|
+
return result;
|
|
94
|
+
},
|
|
95
|
+
[client, workspaceId, run, refresh],
|
|
96
|
+
);
|
|
97
|
+
|
|
79
98
|
const moveSession = useCallback(
|
|
80
99
|
async (sessionId: string, channelId: string | null): Promise<Session | null> => {
|
|
81
100
|
return await run(() => client.updateSessionChannel(workspaceId, sessionId, { channelId }));
|
|
@@ -84,12 +103,15 @@ export function useChannels(options: UseChannelsOptions = {}): UseChannelsResult
|
|
|
84
103
|
);
|
|
85
104
|
|
|
86
105
|
return {
|
|
87
|
-
|
|
88
|
-
|
|
106
|
+
// Cache snapshots replace arrays instead of mutating them, so preserve the
|
|
107
|
+
// stable reference expected from the previous polled-value implementation.
|
|
108
|
+
channels: snapshot.channels as Channel[],
|
|
109
|
+
loading: loading && !snapshot.ready,
|
|
89
110
|
error,
|
|
90
111
|
refresh,
|
|
91
112
|
create,
|
|
92
113
|
update,
|
|
114
|
+
reorder,
|
|
93
115
|
remove,
|
|
94
116
|
moveSession,
|
|
95
117
|
mutating,
|