@opengeni/react 4.0.2 → 4.0.5-canary.39118806767001
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +787 -26
- package/dist/accounts.js +2 -0
- package/dist/accounts.js.map +1 -1
- package/dist/approvals.d.ts +2 -1
- package/dist/artifacts-document.js +6 -3
- package/dist/artifacts-presentation.js +6 -3
- package/dist/artifacts-spreadsheet.d.ts +1 -1
- package/dist/artifacts-spreadsheet.js +6 -3
- package/dist/artifacts.d.ts +5 -1
- package/dist/artifacts.js +542 -278
- package/dist/artifacts.js.map +1 -1
- package/dist/browser-viewer-GEHX3KYE.js +20 -0
- package/dist/capability-catalog-row.d.ts +20 -0
- package/dist/capability-logo-fallback.d.ts +3 -0
- package/dist/chat-interactive-block-5V3BGLXT.js +15 -0
- package/dist/chunk-2DDJ6YH6.js +41 -0
- package/dist/chunk-2DDJ6YH6.js.map +1 -0
- package/dist/chunk-2EGXXUG4.js +1161 -0
- package/dist/chunk-2EGXXUG4.js.map +1 -0
- package/dist/chunk-2XKRY4GF.js +302 -0
- package/dist/chunk-2XKRY4GF.js.map +1 -0
- package/dist/chunk-2ZUUIMBY.js +343 -0
- package/dist/chunk-2ZUUIMBY.js.map +1 -0
- package/dist/chunk-4F4FGCH2.js +34 -0
- package/dist/chunk-4F4FGCH2.js.map +1 -0
- package/dist/{chunk-Z7WBDB4E.js → chunk-4M2MJLY3.js} +848 -867
- package/dist/chunk-4M2MJLY3.js.map +1 -0
- package/dist/chunk-4U7SHFQ2.js +193 -0
- package/dist/chunk-4U7SHFQ2.js.map +1 -0
- package/dist/chunk-5I4VRWBB.js +56 -0
- package/dist/chunk-5I4VRWBB.js.map +1 -0
- package/dist/{chunk-24M4YBCL.js → chunk-62XZ3IX3.js} +1751 -845
- package/dist/chunk-62XZ3IX3.js.map +1 -0
- package/dist/chunk-77THWHSU.js +308 -0
- package/dist/chunk-77THWHSU.js.map +1 -0
- package/dist/chunk-7CZLTFXF.js +466 -0
- package/dist/chunk-7CZLTFXF.js.map +1 -0
- package/dist/chunk-7N5AD2TC.js +327 -0
- package/dist/chunk-7N5AD2TC.js.map +1 -0
- package/dist/chunk-7SZ7MMCY.js +325 -0
- package/dist/chunk-7SZ7MMCY.js.map +1 -0
- package/dist/chunk-7TG6KTR2.js +3153 -0
- package/dist/chunk-7TG6KTR2.js.map +1 -0
- package/dist/chunk-AIX25FIQ.js +409 -0
- package/dist/chunk-AIX25FIQ.js.map +1 -0
- package/dist/chunk-AT2HD6RQ.js +1936 -0
- package/dist/chunk-AT2HD6RQ.js.map +1 -0
- package/dist/chunk-B27E3V37.js +29 -0
- package/dist/chunk-B27E3V37.js.map +1 -0
- package/dist/{chunk-5M6VTFJ5.js → chunk-B4EDAXMC.js} +37 -13
- package/dist/chunk-B4EDAXMC.js.map +1 -0
- package/dist/chunk-BOG2FED3.js +35 -0
- package/dist/chunk-BOG2FED3.js.map +1 -0
- package/dist/chunk-BQYQU5QW.js +109 -0
- package/dist/chunk-BQYQU5QW.js.map +1 -0
- package/dist/{chunk-PAJU5KKL.js → chunk-BRIOXCLH.js} +68 -25
- package/dist/chunk-BRIOXCLH.js.map +1 -0
- package/dist/chunk-CM7LVUKC.js +35 -0
- package/dist/chunk-CM7LVUKC.js.map +1 -0
- package/dist/{chunk-KCGXPP5V.js → chunk-CXIGFHVL.js} +35 -23
- package/dist/chunk-CXIGFHVL.js.map +1 -0
- package/dist/chunk-DHXKEJBH.js +71 -0
- package/dist/chunk-DHXKEJBH.js.map +1 -0
- package/dist/{chunk-NOSYBS2D.js → chunk-DN3TKURW.js} +12 -9
- package/dist/chunk-DN3TKURW.js.map +1 -0
- package/dist/chunk-DNJ23AWQ.js +35 -0
- package/dist/chunk-DNJ23AWQ.js.map +1 -0
- package/dist/chunk-ESAMXNBZ.js +3237 -0
- package/dist/chunk-ESAMXNBZ.js.map +1 -0
- package/dist/{chunk-4MDLEHXL.js → chunk-EWATYP5L.js} +64 -44
- package/dist/chunk-EWATYP5L.js.map +1 -0
- package/dist/{chunk-YBM6CQRU.js → chunk-FQ5CXNUG.js} +65 -42
- package/dist/chunk-FQ5CXNUG.js.map +1 -0
- package/dist/chunk-HEVQKE27.js +150 -0
- package/dist/chunk-HEVQKE27.js.map +1 -0
- package/dist/chunk-HZ47S3DP.js +1086 -0
- package/dist/chunk-HZ47S3DP.js.map +1 -0
- package/dist/chunk-I5BJ7ENY.js +174 -0
- package/dist/chunk-I5BJ7ENY.js.map +1 -0
- package/dist/chunk-IGFZFLI2.js +1390 -0
- package/dist/chunk-IGFZFLI2.js.map +1 -0
- package/dist/chunk-IGVL3ELX.js +46 -0
- package/dist/chunk-IGVL3ELX.js.map +1 -0
- package/dist/chunk-IOD24LGR.js +384 -0
- package/dist/chunk-IOD24LGR.js.map +1 -0
- package/dist/chunk-IOYHDEP3.js +38 -0
- package/dist/chunk-IOYHDEP3.js.map +1 -0
- package/dist/chunk-IQL77TMM.js +803 -0
- package/dist/chunk-IQL77TMM.js.map +1 -0
- package/dist/chunk-IZV5FTJC.js +55 -0
- package/dist/chunk-IZV5FTJC.js.map +1 -0
- package/dist/{chunk-H5YGYNXS.js → chunk-JAYYFOOB.js} +75 -28
- package/dist/chunk-JAYYFOOB.js.map +1 -0
- package/dist/chunk-KN2MYSCC.js +409 -0
- package/dist/chunk-KN2MYSCC.js.map +1 -0
- package/dist/{chunk-PEI6RANI.js → chunk-KYVJMTXL.js} +434 -145
- package/dist/chunk-KYVJMTXL.js.map +1 -0
- package/dist/{chunk-ZYRGEKWS.js → chunk-LJUMYUBO.js} +3 -1
- package/dist/{chunk-ZYRGEKWS.js.map → chunk-LJUMYUBO.js.map} +1 -1
- package/dist/{chunk-ICA6R6TW.js → chunk-LNUD3JNI.js} +1532 -395
- package/dist/chunk-LNUD3JNI.js.map +1 -0
- package/dist/chunk-M357MHH3.js +2 -0
- package/dist/{chunk-BV5A4OTE.js → chunk-MEL6PH2I.js} +1218 -537
- package/dist/chunk-MEL6PH2I.js.map +1 -0
- package/dist/chunk-MF6WS2XF.js +386 -0
- package/dist/chunk-MF6WS2XF.js.map +1 -0
- package/dist/chunk-MK2TQO4Y.js +24 -0
- package/dist/chunk-MK2TQO4Y.js.map +1 -0
- package/dist/chunk-N7S72EXK.js +25 -0
- package/dist/chunk-N7S72EXK.js.map +1 -0
- package/dist/{chunk-KZ73RL76.js → chunk-NAWXARTY.js} +58 -9
- package/dist/chunk-NAWXARTY.js.map +1 -0
- package/dist/chunk-NX4ADH73.js +14 -0
- package/dist/chunk-NX4ADH73.js.map +1 -0
- package/dist/chunk-OYQQJL3J.js +16 -0
- package/dist/chunk-OYQQJL3J.js.map +1 -0
- package/dist/chunk-P4MKPCTC.js +51 -0
- package/dist/chunk-P4MKPCTC.js.map +1 -0
- package/dist/{chunk-JVYQRRC4.js → chunk-PEHTX3V7.js} +21 -1
- package/dist/chunk-PEHTX3V7.js.map +1 -0
- package/dist/chunk-PMV53IMM.js +26 -0
- package/dist/chunk-PMV53IMM.js.map +1 -0
- package/dist/chunk-PYSEGV5X.js +14396 -0
- package/dist/chunk-PYSEGV5X.js.map +1 -0
- package/dist/{chunk-HUIKIDM5.js → chunk-QOEWDOFW.js} +295 -156
- package/dist/chunk-QOEWDOFW.js.map +1 -0
- package/dist/chunk-QV3DJVRZ.js +11 -0
- package/dist/chunk-QV3DJVRZ.js.map +1 -0
- package/dist/{chunk-HUMIRRYI.js → chunk-QYUYVSNG.js} +1103 -1699
- package/dist/chunk-QYUYVSNG.js.map +1 -0
- package/dist/{chunk-6J56T3MG.js → chunk-RRAQ5FV5.js} +186 -60
- package/dist/chunk-RRAQ5FV5.js.map +1 -0
- package/dist/{chunk-5YK2ZDIG.js → chunk-TNEZNMSN.js} +4 -10
- package/dist/chunk-TNEZNMSN.js.map +1 -0
- package/dist/{chunk-22KP6LR5.js → chunk-TXS65BB2.js} +3 -1
- package/dist/{chunk-22KP6LR5.js.map → chunk-TXS65BB2.js.map} +1 -1
- package/dist/chunk-UIWIOB4U.js +2215 -0
- package/dist/chunk-UIWIOB4U.js.map +1 -0
- package/dist/chunk-UNJPZGNK.js +63 -0
- package/dist/chunk-UNJPZGNK.js.map +1 -0
- package/dist/chunk-V7UGCQHQ.js +86 -0
- package/dist/chunk-V7UGCQHQ.js.map +1 -0
- package/dist/chunk-VU4QUISJ.js +3405 -0
- package/dist/chunk-VU4QUISJ.js.map +1 -0
- package/dist/chunk-WEY5J52U.js +467 -0
- package/dist/chunk-WEY5J52U.js.map +1 -0
- package/dist/chunk-WH2CBESG.js +409 -0
- package/dist/chunk-WH2CBESG.js.map +1 -0
- package/dist/{chunk-VZTQ73XT.js → chunk-XEA5BCMA.js} +3 -1
- package/dist/{chunk-VZTQ73XT.js.map → chunk-XEA5BCMA.js.map} +1 -1
- package/dist/{chunk-NLTS7JHI.js → chunk-XEIHS3RN.js} +834 -403
- package/dist/chunk-XEIHS3RN.js.map +1 -0
- package/dist/chunk-YNXZRE3F.js +408 -0
- package/dist/chunk-YNXZRE3F.js.map +1 -0
- package/dist/chunk-YSRBFJMQ.js +43 -0
- package/dist/chunk-YSRBFJMQ.js.map +1 -0
- package/dist/{chunk-NEXLLTP4.js → chunk-ZGFU4LVW.js} +6 -5
- package/dist/chunk-ZGFU4LVW.js.map +1 -0
- package/dist/chunk-ZO35BAMO.js +172 -0
- package/dist/chunk-ZO35BAMO.js.map +1 -0
- package/dist/chunk-ZUWF4NF7.js +13 -0
- package/dist/chunk-ZUWF4NF7.js.map +1 -0
- package/dist/client.d.ts +15 -6
- package/dist/clipboard.js +3 -1
- package/dist/commands/registry.d.ts +2 -1
- package/dist/commands/types.d.ts +2 -0
- package/dist/components/anthropic-mark.d.ts +3 -0
- package/dist/components/approval-surface.d.ts +21 -7
- package/dist/components/artifacts/artifact-chrome.d.ts +121 -0
- package/dist/components/artifacts/artifact-sandbox.d.ts +30 -0
- package/dist/components/artifacts/artifact-surface.d.ts +4 -2
- package/dist/components/artifacts/chat-interactive-block.d.ts +29 -0
- package/dist/components/artifacts/deferred-chat-media.d.ts +15 -0
- package/dist/components/artifacts/document-editor.d.ts +4 -2
- package/dist/components/artifacts/editable-artifact-ui.d.ts +4 -2
- package/dist/components/artifacts/editable-artifact-view.d.ts +48 -0
- package/dist/components/artifacts/editable-document.d.ts +3 -2
- package/dist/components/artifacts/editable-presentation.d.ts +4 -3
- package/dist/components/artifacts/editable-spreadsheet.d.ts +8 -3
- package/dist/components/artifacts/index.d.ts +8 -1
- package/dist/components/artifacts/inline-html-document.d.ts +2 -0
- package/dist/components/artifacts/latest-task-runner.d.ts +15 -0
- package/dist/components/artifacts/presentation-editor.d.ts +6 -2
- package/dist/components/artifacts/published-html-artifact-frame.d.ts +17 -40
- package/dist/components/artifacts/session-artifact-viewer.d.ts +39 -0
- package/dist/components/artifacts/site-view.d.ts +26 -0
- package/dist/components/artifacts/spreadsheet-command-queue.d.ts +20 -0
- package/dist/components/artifacts/spreadsheet-download.d.ts +7 -0
- package/dist/components/artifacts/spreadsheet-general-display.d.ts +24 -0
- package/dist/components/artifacts/spreadsheet-grid.d.ts +11 -4
- package/dist/components/artifacts/spreadsheet-resize.d.ts +50 -0
- package/dist/components/artifacts/spreadsheet-submissions.d.ts +9 -0
- package/dist/components/artifacts/visualization-assets.gen.d.ts +2 -0
- package/dist/components/browser-select-control.d.ts +16 -0
- package/dist/components/browser-viewer.d.ts +11 -2
- package/dist/components/chat-composer.d.ts +21 -3
- package/dist/components/child-session-link.d.ts +5 -1
- package/dist/components/claude-mark.d.ts +3 -0
- package/dist/components/code-editor.d.ts +1 -4
- package/dist/components/command-palette.d.ts +1 -1
- package/dist/components/composer-transcription-control.d.ts +7 -0
- package/dist/components/composer.d.ts +30 -67
- package/dist/components/computer-viewer.d.ts +1 -1
- package/dist/components/copy-button.d.ts +3 -1
- package/dist/components/desktop-viewer.d.ts +1 -1
- package/dist/components/generated-video-player.d.ts +1 -1
- package/dist/components/grok-mark.d.ts +26 -0
- package/dist/components/human-input-form.d.ts +26 -32
- package/dist/components/human-input-surface.d.ts +5 -1
- package/dist/components/linkified-text.d.ts +18 -0
- package/dist/components/machine-input-display.d.ts +25 -3
- package/dist/components/machine-status-pill.d.ts +3 -2
- package/dist/components/machines/agent-status-icon.d.ts +6 -0
- package/dist/components/machines/health.d.ts +2 -1
- package/dist/components/machines/machine-detail.d.ts +7 -1
- package/dist/components/machines/machine-status.d.ts +49 -0
- package/dist/components/machines/metric-history-chart.d.ts +1 -1
- package/dist/components/machines/series.d.ts +3 -2
- package/dist/components/markdown-table-layout.d.ts +11 -2
- package/dist/components/markdown.d.ts +37 -4
- package/dist/components/message-timeline.d.ts +79 -7
- package/dist/components/model-mark.d.ts +29 -0
- package/dist/components/model-picker.d.ts +1 -1
- package/dist/components/model-policy-picker.d.ts +31 -22
- package/dist/components/new-conversation.d.ts +32 -0
- package/dist/components/open-geni-chat.d.ts +73 -0
- package/dist/components/open-geni-links.d.ts +69 -0
- package/dist/components/openrouter-mark.d.ts +6 -0
- package/dist/components/opper-mark.d.ts +7 -0
- package/dist/components/preview-loading.d.ts +2 -0
- package/dist/components/provider-recovery-notice.d.ts +17 -0
- package/dist/components/queue-item-content.d.ts +10 -0
- package/dist/components/rehype-secret-refs.d.ts +23 -0
- package/dist/components/remark-soft-line-breaks.d.ts +38 -0
- package/dist/components/sandbox-workspace.d.ts +18 -0
- package/dist/components/secret-question-field.d.ts +31 -0
- package/dist/components/secret-ref-chip.d.ts +35 -0
- package/dist/components/session-capability-frame.d.ts +37 -0
- package/dist/components/session-chrome.d.ts +20 -7
- package/dist/components/session-commands.d.ts +6 -0
- package/dist/components/session-connection-request.d.ts +8 -0
- package/dist/components/session-conversation.d.ts +147 -6
- package/dist/components/session-list.d.ts +39 -0
- package/dist/components/session-mcp-capability-card.d.ts +41 -0
- package/dist/components/session-proxy-scope.d.ts +35 -0
- package/dist/components/session-status.d.ts +6 -2
- package/dist/components/session-usage-limit-notice.d.ts +39 -0
- package/dist/components/this-computer/illustrations.d.ts +38 -0
- package/dist/components/this-computer/labels.d.ts +111 -0
- package/dist/components/this-computer/this-computer-card.d.ts +40 -0
- package/dist/components/this-computer/this-computer-setup.d.ts +35 -0
- package/dist/components/this-computer/this-computer-status.d.ts +42 -0
- package/dist/components/this-computer/use-this-computer.d.ts +29 -0
- package/dist/components/timeline-anchor.d.ts +3 -0
- package/dist/components/timeline-annotation-shared.d.ts +3 -2
- package/dist/components/timeline-annotations-dialog.d.ts +2 -1
- package/dist/components/timeline-annotations.d.ts +5 -1
- package/dist/components/timeline-reading-progress.d.ts +11 -0
- package/dist/components/timeline-search.d.ts +34 -0
- package/dist/components/timeline-settlement.d.ts +16 -0
- package/dist/components/tool-action-review.d.ts +48 -0
- package/dist/components/tool-review-history.d.ts +25 -0
- package/dist/components/usage-limit-notice.d.ts +50 -0
- package/dist/components/usage-member-list.d.ts +92 -0
- package/dist/components/usage-meter.d.ts +74 -0
- package/dist/components/use-viewer-menu-dismiss.d.ts +2 -0
- package/dist/components/user-message-body.d.ts +10 -1
- package/dist/components/workbench-changes.d.ts +2 -1
- package/dist/composer-messages.d.ts +75 -0
- package/dist/composer-messages.js +9 -0
- package/dist/composer-messages.js.map +1 -0
- package/dist/composer-voice-events.d.ts +8 -0
- package/dist/composer.d.ts +3 -3
- package/dist/composer.js +25 -12
- package/dist/computer-viewer-VOIOZGVZ.js +21 -0
- package/dist/computer-viewer-VOIOZGVZ.js.map +1 -0
- package/dist/connect-account-identity.d.ts +8 -0
- package/dist/connect-accounts.d.ts +15 -0
- package/dist/connect-chooser.d.ts +18 -0
- package/dist/connect-panel.d.ts +18 -0
- package/dist/connect-setup.d.ts +18 -0
- package/dist/connect.d.ts +21 -0
- package/dist/connect.js +2216 -0
- package/dist/connect.js.map +1 -0
- package/dist/connection-catalog.d.ts +38 -0
- package/dist/connection-discovery.d.ts +12 -0
- package/dist/connection-installed.d.ts +17 -0
- package/dist/connection-logo.d.ts +9 -0
- package/dist/connection-service-logo.d.ts +8 -0
- package/dist/connection-service-presentation.d.ts +13 -0
- package/dist/connection-skeleton.d.ts +5 -0
- package/dist/connection-type-picker.d.ts +6 -0
- package/dist/conversation-timeline.d.ts +1 -1
- package/dist/desktop.d.ts +7 -0
- package/dist/desktop.js +28 -0
- package/dist/desktop.js.map +1 -0
- package/dist/device-authorization.d.ts +23 -0
- package/dist/diffs.d.ts +8 -0
- package/dist/diffs.js +15 -0
- package/dist/diffs.js.map +1 -0
- package/dist/discovery-cache.d.ts +5 -0
- package/dist/editor.d.ts +7 -0
- package/dist/editor.js +23 -0
- package/dist/editor.js.map +1 -0
- package/dist/embedded-new-voice-KPLC5UJZ.js +19 -0
- package/dist/embedded-new-voice-KPLC5UJZ.js.map +1 -0
- package/dist/embedded-voice-V2RFSLIU.js +19 -0
- package/dist/embedded-voice-V2RFSLIU.js.map +1 -0
- package/dist/fleet-decision-row-FE73NSQ6.js +361 -0
- package/dist/fleet-decision-row-FE73NSQ6.js.map +1 -0
- package/dist/hooks/internal.d.ts +27 -2
- package/dist/hooks/latest-question.d.ts +26 -0
- package/dist/hooks/session-view-cache.d.ts +38 -0
- package/dist/hooks/shared-machines-list.d.ts +4 -0
- package/dist/hooks/shared-query.d.ts +123 -0
- package/dist/hooks/use-attached-browsers.d.ts +1 -1
- package/dist/hooks/use-auth-runs.d.ts +1 -4
- package/dist/hooks/use-available-models.d.ts +8 -3
- package/dist/hooks/use-browser-frame-stream.d.ts +1 -1
- package/dist/hooks/use-browser-session.d.ts +12 -1
- package/dist/hooks/use-client-config-flags.d.ts +49 -0
- package/dist/hooks/use-codex-accounts.d.ts +48 -9
- package/dist/hooks/use-composer.d.ts +24 -3
- package/dist/hooks/use-computer-frame-stream.d.ts +1 -1
- package/dist/hooks/use-computer-input-posture.d.ts +13 -0
- package/dist/hooks/use-computer-session.d.ts +5 -0
- package/dist/hooks/use-connect.d.ts +23 -0
- package/dist/hooks/use-desktop-stream.d.ts +1 -1
- package/dist/hooks/use-file-attachments.d.ts +4 -0
- package/dist/hooks/use-goal.d.ts +2 -1
- package/dist/hooks/use-last-started-turn-policy.d.ts +5 -1
- package/dist/hooks/use-machine-chip.d.ts +3 -2
- package/dist/hooks/use-new-conversation.d.ts +56 -0
- package/dist/hooks/use-new-session-draft.d.ts +74 -0
- package/dist/hooks/use-realtime-voice-models.d.ts +7 -0
- package/dist/hooks/use-sandbox-files.d.ts +3 -2
- package/dist/hooks/use-session-conversation.d.ts +49 -0
- package/dist/hooks/use-session-events.d.ts +21 -2
- package/dist/hooks/use-session-mcp-approval-policy.d.ts +2 -2
- package/dist/hooks/use-session-model-account.d.ts +48 -0
- package/dist/hooks/use-supergrok-accounts.d.ts +7 -1
- package/dist/hooks/use-terminal-stream.d.ts +11 -5
- package/dist/hooks/use-transcription.d.ts +2 -1
- package/dist/hooks/use-usage.d.ts +40 -0
- package/dist/hooks/use-vaults.d.ts +53 -0
- package/dist/hooks/use-voice-input.d.ts +8 -1
- package/dist/hooks/use-workspace-sessions.d.ts +24 -5
- package/dist/human-input-model.d.ts +123 -0
- package/dist/identity-link-accounts.d.ts +11 -0
- package/dist/identity-link-consent.d.ts +18 -0
- package/dist/index.d.ts +83 -18
- package/dist/index.js +2317 -6453
- package/dist/index.js.map +1 -1
- package/dist/interaction.d.ts +1 -1
- package/dist/interaction.js +20 -29
- package/dist/interaction.js.map +1 -1
- package/dist/latest-question-SXBXROBT.js +118 -0
- package/dist/latest-question-SXBXROBT.js.map +1 -0
- package/dist/lib/client-config-read.d.ts +31 -0
- package/dist/lib/clipboard.d.ts +7 -0
- package/dist/lib/error-message.d.ts +7 -0
- package/dist/lib/format.d.ts +59 -9
- package/dist/lib/host-theme.d.ts +77 -0
- package/dist/lib/interaction-errors.d.ts +3 -0
- package/dist/lib/menu-styles.d.ts +22 -0
- package/dist/lib/notify-observer.d.ts +2 -0
- package/dist/lib/pierre-diffs-loader.d.ts +20 -0
- package/dist/lib/provider-recovery.d.ts +56 -0
- package/dist/lib/scrollbars.d.ts +11 -0
- package/dist/lib/terminal-input-readiness.d.ts +11 -0
- package/dist/lib/transient-retry.d.ts +26 -0
- package/dist/lib/workbench-peers.d.ts +36 -0
- package/dist/lib/xterm-theme.d.ts +7 -5
- package/dist/machines.js +12 -6
- package/dist/{markdown-table-layout-3Z3AWBY7.js → markdown-table-layout-3PV2UAAH.js} +51 -9
- package/dist/markdown-table-layout-3PV2UAAH.js.map +1 -0
- package/dist/mcp-connection-status.d.ts +15 -0
- package/dist/messages/en.d.ts +3328 -0
- package/dist/messages/runtime.d.ts +69 -0
- package/dist/messages.d.ts +3 -0
- package/dist/messages.js +16 -0
- package/dist/messages.js.map +1 -0
- package/dist/model-mark-paths.d.ts +34 -0
- package/dist/model-mark-paths.js +16 -0
- package/dist/model-mark-paths.js.map +1 -0
- package/dist/model-picker-model.d.ts +112 -0
- package/dist/model-picker-model.js +25 -0
- package/dist/model-picker-model.js.map +1 -0
- package/dist/model-policy-picker-menu-NWIETWSR.js +18 -0
- package/dist/model-policy-picker-menu-NWIETWSR.js.map +1 -0
- package/dist/model-policy.d.ts +35 -10
- package/dist/model-policy.js +12 -1
- package/dist/native-previews.d.ts +29 -0
- package/dist/native-previews.js +82 -0
- package/dist/native-previews.js.map +1 -0
- package/dist/new-session-draft.d.ts +7 -0
- package/dist/new-session-draft.js +639 -0
- package/dist/new-session-draft.js.map +1 -0
- package/dist/notification-text.d.ts +27 -0
- package/dist/{noto-sans-arabic-loader-IA2T4X2A.js → noto-sans-arabic-loader-XSH2KYWJ.js} +3 -1
- package/dist/{noto-sans-arabic-loader-IA2T4X2A.js.map → noto-sans-arabic-loader-XSH2KYWJ.js.map} +1 -1
- package/dist/{noto-sans-jp-loader.generated-HFGLYBR3.js → noto-sans-jp-loader.generated-MR5L6V7K.js} +3 -1
- package/dist/{noto-sans-jp-loader.generated-HFGLYBR3.js.map → noto-sans-jp-loader.generated-MR5L6V7K.js.map} +1 -1
- package/dist/organization-model.d.ts +33 -0
- package/dist/organization-model.js +65 -0
- package/dist/organization-model.js.map +1 -0
- package/dist/platform-activity-row-VSQ2FZ5T.js +119 -0
- package/dist/platform-activity-row-VSQ2FZ5T.js.map +1 -0
- package/dist/plugin-details.d.ts +14 -0
- package/dist/plugin-discovery.d.ts +25 -0
- package/dist/preview-loading-paint.d.ts +20 -0
- package/dist/provider.d.ts +37 -2
- package/dist/queue-presentation-model.d.ts +73 -0
- package/dist/queue-presentation-model.js +38 -0
- package/dist/queue-presentation-model.js.map +1 -0
- package/dist/{queue-surface-implementation-LK3S4BIW.js → queue-surface-implementation-MEKXXWGR.js} +189 -343
- package/dist/queue-surface-implementation-MEKXXWGR.js.map +1 -0
- package/dist/realtime/embedded-new-voice.d.ts +1 -0
- package/dist/realtime/embedded-voice.d.ts +1 -0
- package/dist/realtime/realtime-control.d.ts +4 -65
- package/dist/realtime/session-realtime.d.ts +79 -0
- package/dist/realtime.js +26 -1333
- package/dist/realtime.js.map +1 -1
- package/dist/sandbox-files-5NRC2QUT.js +24 -0
- package/dist/sandbox-files-5NRC2QUT.js.map +1 -0
- package/dist/sandbox-label-model.d.ts +31 -0
- package/dist/sandbox-label-model.js +20 -0
- package/dist/sandbox-label-model.js.map +1 -0
- package/dist/scrollbars.d.ts +1 -0
- package/dist/scrollbars.js +10 -0
- package/dist/scrollbars.js.map +1 -0
- package/dist/secret-reference-label.d.ts +15 -0
- package/dist/secrets-ui.d.ts +57 -0
- package/dist/session-agents-model.d.ts +11 -0
- package/dist/session-agents-model.js +25 -0
- package/dist/session-agents-model.js.map +1 -0
- package/dist/session-attention-model.d.ts +8 -0
- package/dist/session-attention-model.js +47 -0
- package/dist/session-attention-model.js.map +1 -0
- package/dist/session-auth-recommendation.d.ts +6 -0
- package/dist/session-capability-policy.d.ts +32 -0
- package/dist/session-context.d.ts +9 -1
- package/dist/session-feedback-model.d.ts +21 -0
- package/dist/session-feedback-model.js +56 -0
- package/dist/session-feedback-model.js.map +1 -0
- package/dist/session-list-model.d.ts +139 -0
- package/dist/session-list-model.js +274 -0
- package/dist/session-list-model.js.map +1 -0
- package/dist/session-realtime-OZCE6IKP.js +22 -0
- package/dist/session-realtime-OZCE6IKP.js.map +1 -0
- package/dist/session-realtime.d.ts +7 -0
- package/dist/session-realtime.js +20 -0
- package/dist/session-realtime.js.map +1 -0
- package/dist/session-status-model.d.ts +37 -0
- package/dist/session-ui.d.ts +40 -3
- package/dist/session-ui.js +127 -21
- package/dist/session-ui.js.map +1 -1
- package/dist/session.d.ts +10 -2
- package/dist/session.js +44 -20
- package/dist/site-snapshot.d.ts +14 -0
- package/dist/sites-ui.d.ts +24 -0
- package/dist/sites.d.ts +3 -0
- package/dist/sites.js +15 -0
- package/dist/sites.js.map +1 -0
- package/dist/skill-discovery.d.ts +47 -0
- package/dist/terminal.d.ts +8 -0
- package/dist/terminal.js +33 -0
- package/dist/terminal.js.map +1 -0
- package/dist/testing/session-scenarios.d.ts +10 -0
- package/dist/testing/session-scenarios.js +367 -0
- package/dist/testing/session-scenarios.js.map +1 -0
- package/dist/this-computer.d.ts +8 -0
- package/dist/this-computer.js +1042 -0
- package/dist/this-computer.js.map +1 -0
- package/dist/timeline/activity-rail.d.ts +12 -2
- package/dist/timeline/agent-identity.d.ts +30 -0
- package/dist/timeline/agent-row.d.ts +31 -0
- package/dist/timeline/allowance-exhausted-row.d.ts +24 -0
- package/dist/timeline/compaction-copy.d.ts +47 -0
- package/dist/timeline/focus-sequence.d.ts +9 -0
- package/dist/timeline/genie-copy.d.ts +4 -0
- package/dist/timeline/genie-loading.d.ts +48 -0
- package/dist/timeline/index.d.ts +12 -5
- package/dist/timeline/invoked-tool.d.ts +6 -0
- package/dist/timeline/knowledge-receipt.d.ts +17 -0
- package/dist/timeline/learning-refusal-copy.d.ts +23 -0
- package/dist/timeline/learning-refusal-row.d.ts +19 -0
- package/dist/timeline/message-sender.d.ts +19 -0
- package/dist/timeline/notice-presentation.d.ts +14 -0
- package/dist/timeline/parsers.d.ts +11 -0
- package/dist/timeline/patch-apply-command.d.ts +19 -0
- package/dist/timeline/platform-activity-presentation.d.ts +26 -0
- package/dist/timeline/platform-activity-row.d.ts +1 -2
- package/dist/timeline/presented-image.d.ts +11 -0
- package/dist/timeline/projection.d.ts +32 -2
- package/dist/timeline/provider-logo.d.ts +15 -0
- package/dist/timeline/question-nav-model.d.ts +23 -0
- package/dist/timeline/registry.d.ts +10 -1
- package/dist/timeline/retained-image.d.ts +18 -0
- package/dist/timeline/retained-loaders.d.ts +27 -0
- package/dist/timeline/rolling-activity.d.ts +11 -0
- package/dist/timeline/screenshot-lightbox.d.ts +23 -1
- package/dist/timeline/session-usage-limit-row.d.ts +11 -0
- package/dist/timeline/shared.d.ts +8 -3
- package/dist/timeline/startup-dispatch-details.d.ts +5 -0
- package/dist/timeline/startup-preference.d.ts +3 -0
- package/dist/timeline/startup-timings.d.ts +4 -0
- package/dist/timeline/tool-display-name.d.ts +6 -2
- package/dist/timeline/tool-presentation.d.ts +185 -0
- package/dist/timeline/turn-summary-model.d.ts +102 -0
- package/dist/timeline/turn-summary.d.ts +20 -54
- package/dist/timeline/types.d.ts +184 -7
- package/dist/timeline/work-presentation.d.ts +61 -0
- package/dist/{timeline-annotation-markers-DRSTLEM6.js → timeline-annotation-markers-HYLRTT6S.js} +11 -6
- package/dist/timeline-annotation-markers-HYLRTT6S.js.map +1 -0
- package/dist/{timeline-annotation-selection-IHLUGVND.js → timeline-annotation-selection-LBKW5GHA.js} +15 -5
- package/dist/timeline-annotation-selection-LBKW5GHA.js.map +1 -0
- package/dist/{timeline-annotations-dialog-6Q53N5FG.js → timeline-annotations-dialog-JKVINC42.js} +34 -19
- package/dist/timeline-annotations-dialog-JKVINC42.js.map +1 -0
- package/dist/timeline-model.d.ts +29 -0
- package/dist/timeline-model.js +254 -0
- package/dist/timeline-model.js.map +1 -0
- package/dist/usage/allowance-copy.d.ts +26 -0
- package/dist/usage/session-usage-limit.d.ts +89 -0
- package/dist/usage/summary.d.ts +35 -0
- package/dist/usage.d.ts +17 -0
- package/dist/usage.js +1201 -0
- package/dist/usage.js.map +1 -0
- package/dist/voice-recording-owner.d.ts +7 -0
- package/package.json +119 -7
- package/src/approvals.ts +8 -1
- package/src/artifacts-spreadsheet.ts +1 -0
- package/src/artifacts.ts +41 -0
- package/src/assets/README.md +8 -0
- package/src/assets/gmail.ico +0 -0
- package/src/assets/outlook.ico +0 -0
- package/src/capability-catalog-row.tsx +96 -0
- package/src/capability-logo-fallback.ts +22 -0
- package/src/client.ts +18 -30
- package/src/commands/registry.ts +46 -36
- package/src/commands/types.ts +2 -0
- package/src/components/anthropic-mark.tsx +10 -0
- package/src/components/approval-surface.tsx +407 -142
- package/src/components/artifacts/artifact-chrome.tsx +425 -0
- package/src/components/artifacts/artifact-sandbox.tsx +193 -0
- package/src/components/artifacts/artifact-surface.tsx +48 -26
- package/src/components/artifacts/chat-interactive-block.tsx +260 -0
- package/src/components/artifacts/deferred-chat-media.tsx +72 -0
- package/src/components/artifacts/document-editor.tsx +193 -45
- package/src/components/artifacts/editable-artifact-ui.tsx +23 -11
- package/src/components/artifacts/editable-artifact-view.tsx +199 -0
- package/src/components/artifacts/editable-artifact-workbench.tsx +8 -3
- package/src/components/artifacts/editable-document.tsx +76 -54
- package/src/components/artifacts/editable-presentation.tsx +86 -40
- package/src/components/artifacts/editable-spreadsheet.tsx +581 -121
- package/src/components/artifacts/index.ts +42 -0
- package/src/components/artifacts/inline-html-document.ts +24 -0
- package/src/components/artifacts/latest-task-runner.ts +49 -0
- package/src/components/artifacts/presentation-editor.tsx +422 -122
- package/src/components/artifacts/published-html-artifact-frame.tsx +79 -265
- package/src/components/artifacts/session-artifact-viewer.tsx +381 -0
- package/src/components/artifacts/site-view.tsx +129 -0
- package/src/components/artifacts/spreadsheet-canvas.ts +5 -10
- package/src/components/artifacts/spreadsheet-command-queue.ts +190 -0
- package/src/components/artifacts/spreadsheet-download.tsx +117 -0
- package/src/components/artifacts/spreadsheet-general-display.ts +43 -0
- package/src/components/artifacts/spreadsheet-grid.tsx +390 -172
- package/src/components/artifacts/spreadsheet-resize.tsx +432 -0
- package/src/components/artifacts/spreadsheet-submissions.tsx +46 -0
- package/src/components/artifacts/visualization-assets/base.css +1015 -0
- package/src/components/artifacts/visualization-assets/helpers.html +349 -0
- package/src/components/artifacts/visualization-assets.gen.ts +3 -0
- package/src/components/browser-select-control.tsx +320 -0
- package/src/components/browser-viewer.tsx +1102 -505
- package/src/components/chat-composer.tsx +42 -3
- package/src/components/child-session-link.tsx +16 -5
- package/src/components/claude-mark.tsx +11 -0
- package/src/components/code-editor.tsx +38 -27
- package/src/components/command-palette.tsx +4 -1
- package/src/components/composer-transcription-control.tsx +151 -50
- package/src/components/composer.tsx +281 -176
- package/src/components/computer-viewer.tsx +1013 -341
- package/src/components/copy-button.tsx +17 -7
- package/src/components/desktop-viewer.tsx +42 -33
- package/src/components/diff-view.tsx +3 -1
- package/src/components/enrollment-consent.tsx +39 -34
- package/src/components/enrollment-device-flow.tsx +31 -19
- package/src/components/file-browser.tsx +47 -35
- package/src/components/fleet-tile.tsx +8 -4
- package/src/components/generated-video-player.tsx +10 -5
- package/src/components/grok-mark.tsx +34 -0
- package/src/components/human-input-form.tsx +438 -251
- package/src/components/human-input-surface.tsx +8 -0
- package/src/components/interaction-intervention-banner.tsx +15 -13
- package/src/components/linkified-text.tsx +79 -0
- package/src/components/machine-card.tsx +56 -89
- package/src/components/machine-dock-bar.tsx +10 -4
- package/src/components/machine-health-pill.tsx +4 -2
- package/src/components/machine-input-display.ts +309 -34
- package/src/components/machine-metrics.tsx +10 -7
- package/src/components/machine-status-pill.tsx +23 -15
- package/src/components/machines/agent-status-icon.tsx +31 -0
- package/src/components/machines/health.ts +53 -10
- package/src/components/machines/machine-detail.tsx +230 -42
- package/src/components/machines/machine-operation-policy.tsx +36 -29
- package/src/components/machines/machine-status.ts +264 -0
- package/src/components/machines/metric-history-chart.tsx +8 -2
- package/src/components/machines/series.ts +12 -11
- package/src/components/machines-dashboard.tsx +16 -9
- package/src/components/markdown-table-layout.ts +67 -9
- package/src/components/markdown.tsx +470 -133
- package/src/components/message-timeline.tsx +2290 -752
- package/src/components/model-mark.tsx +102 -0
- package/src/components/model-picker.tsx +27 -9
- package/src/components/model-policy-picker-menu.tsx +204 -100
- package/src/components/model-policy-picker.tsx +215 -152
- package/src/components/new-conversation.tsx +223 -0
- package/src/components/open-geni-chat.tsx +311 -0
- package/src/components/open-geni-links.tsx +183 -0
- package/src/components/openrouter-mark.tsx +13 -0
- package/src/components/opper-mark.tsx +18 -0
- package/src/components/pierre-diff.tsx +47 -19
- package/src/components/pierre-file.tsx +38 -11
- package/src/components/preview-loading.tsx +111 -0
- package/src/components/provider-recovery-notice.tsx +51 -0
- package/src/components/queue-item-content.ts +16 -0
- package/src/components/queue-surface-implementation.tsx +185 -420
- package/src/components/queue-surface-state.tsx +13 -8
- package/src/components/queue-surface.tsx +3 -1
- package/src/components/rehype-secret-refs.ts +98 -0
- package/src/components/remark-soft-line-breaks.ts +166 -0
- package/src/components/sandbox-files.tsx +75 -44
- package/src/components/sandbox-terminal.tsx +103 -22
- package/src/components/sandbox-workspace.tsx +168 -78
- package/src/components/secret-question-field.tsx +326 -0
- package/src/components/secret-ref-chip.tsx +187 -0
- package/src/components/session-capability-frame.tsx +203 -0
- package/src/components/session-chrome.tsx +559 -328
- package/src/components/session-commands-panel.tsx +34 -17
- package/src/components/session-commands.tsx +18 -0
- package/src/components/session-connection-request.tsx +99 -0
- package/src/components/session-conversation.tsx +853 -118
- package/src/components/session-list.tsx +259 -0
- package/src/components/session-mcp-capability-card.tsx +681 -0
- package/src/components/session-proxy-scope.tsx +160 -0
- package/src/components/session-status.tsx +35 -21
- package/src/components/session-usage-limit-notice.tsx +176 -0
- package/src/components/this-computer/illustrations.tsx +164 -0
- package/src/components/this-computer/labels.ts +234 -0
- package/src/components/this-computer/this-computer-card.tsx +203 -0
- package/src/components/this-computer/this-computer-setup.tsx +433 -0
- package/src/components/this-computer/this-computer-status.tsx +329 -0
- package/src/components/this-computer/use-this-computer.ts +183 -0
- package/src/components/timeline-anchor.tsx +43 -15
- package/src/components/timeline-annotation-chrome.tsx +33 -9
- package/src/components/timeline-annotation-markers.tsx +4 -2
- package/src/components/timeline-annotation-selection.tsx +11 -2
- package/src/components/timeline-annotation-shared.ts +9 -8
- package/src/components/timeline-annotations-dialog.tsx +30 -9
- package/src/components/timeline-annotations.tsx +24 -7
- package/src/components/timeline-reading-progress.ts +80 -0
- package/src/components/timeline-search.tsx +168 -0
- package/src/components/timeline-settlement.ts +60 -0
- package/src/components/tool-action-review.tsx +670 -0
- package/src/components/tool-review-history.tsx +88 -0
- package/src/components/usage-limit-notice.tsx +183 -0
- package/src/components/usage-member-list.tsx +797 -0
- package/src/components/usage-meter.tsx +386 -0
- package/src/components/use-viewer-menu-dismiss.ts +33 -0
- package/src/components/user-message-body.tsx +33 -2
- package/src/components/workbench-changes.tsx +28 -16
- package/src/components/workspace-dock.tsx +45 -13
- package/src/composer-messages.ts +153 -0
- package/src/composer-voice-events.ts +12 -0
- package/src/composer.ts +4 -0
- package/src/connect-account-identity.tsx +38 -0
- package/src/connect-accounts.tsx +233 -0
- package/src/connect-chooser.tsx +339 -0
- package/src/connect-panel.tsx +104 -0
- package/src/connect-setup.tsx +354 -0
- package/src/connect.ts +60 -0
- package/src/connection-assets.d.ts +4 -0
- package/src/connection-catalog.tsx +175 -0
- package/src/connection-discovery.tsx +251 -0
- package/src/connection-installed.tsx +56 -0
- package/src/connection-logo.tsx +37 -0
- package/src/connection-service-logo.tsx +55 -0
- package/src/connection-service-presentation.ts +46 -0
- package/src/connection-skeleton.tsx +16 -0
- package/src/connection-type-picker.tsx +38 -0
- package/src/conversation-timeline.ts +11 -2
- package/src/desktop.ts +24 -0
- package/src/device-authorization.tsx +111 -0
- package/src/diffs.ts +16 -0
- package/src/discovery-cache.ts +42 -0
- package/src/editor.ts +13 -0
- package/src/hooks/internal.ts +93 -10
- package/src/hooks/latest-question.ts +168 -0
- package/src/hooks/session-view-cache.ts +167 -0
- package/src/hooks/shared-machines-list.ts +34 -1
- package/src/hooks/shared-query.ts +744 -0
- package/src/hooks/use-attached-browsers.ts +1 -1
- package/src/hooks/use-auth-runs.ts +0 -27
- package/src/hooks/use-available-models.ts +20 -10
- package/src/hooks/use-browser-frame-stream.ts +23 -4
- package/src/hooks/use-browser-session.ts +684 -206
- package/src/hooks/use-browser-sessions.ts +32 -1
- package/src/hooks/use-client-config-flags.ts +102 -0
- package/src/hooks/use-codex-accounts.ts +216 -43
- package/src/hooks/use-composer.ts +240 -59
- package/src/hooks/use-computer-frame-stream.ts +29 -9
- package/src/hooks/use-computer-input-posture.ts +96 -0
- package/src/hooks/use-computer-session.ts +419 -100
- package/src/hooks/use-connect.ts +23 -0
- package/src/hooks/use-desktop-stream.ts +19 -28
- package/src/hooks/use-file-attachments.ts +19 -3
- package/src/hooks/use-goal.ts +172 -21
- package/src/hooks/use-human-input.ts +16 -2
- package/src/hooks/use-last-started-turn-policy.ts +37 -11
- package/src/hooks/use-machine-chip.ts +13 -8
- package/src/hooks/use-machines.ts +24 -10
- package/src/hooks/use-new-conversation.ts +377 -0
- package/src/hooks/use-new-session-draft.ts +813 -0
- package/src/hooks/use-realtime-voice-models.ts +46 -0
- package/src/hooks/use-sandbox-files.ts +22 -16
- package/src/hooks/use-session-background-commands.ts +2 -2
- package/src/hooks/use-session-capabilities.ts +3 -2
- package/src/hooks/use-session-conversation.ts +150 -0
- package/src/hooks/use-session-events.ts +403 -64
- package/src/hooks/use-session-lineage.ts +47 -9
- package/src/hooks/use-session-mcp-approval-policy.ts +13 -5
- package/src/hooks/use-session-model-account.ts +174 -0
- package/src/hooks/use-session.ts +19 -3
- package/src/hooks/use-slash-commands.ts +6 -11
- package/src/hooks/use-supergrok-accounts.ts +22 -8
- package/src/hooks/use-terminal-stream.ts +153 -27
- package/src/hooks/use-transcription.ts +45 -19
- package/src/hooks/use-turn-queue.ts +25 -5
- package/src/hooks/use-usage.ts +100 -0
- package/src/hooks/use-vaults.ts +153 -0
- package/src/hooks/use-video-artifact-playback.ts +1 -1
- package/src/hooks/use-voice-input.ts +127 -19
- package/src/hooks/use-workspace-capture.ts +3 -2
- package/src/hooks/use-workspace-sessions.ts +74 -7
- package/src/human-input-model.ts +374 -0
- package/src/identity-link-accounts.tsx +149 -0
- package/src/identity-link-consent.tsx +193 -0
- package/src/index.ts +282 -16
- package/src/interaction.ts +1 -0
- package/src/lib/client-config-read.ts +76 -0
- package/src/lib/clipboard.ts +29 -0
- package/src/lib/error-message.ts +37 -0
- package/src/lib/format.ts +231 -36
- package/src/lib/host-theme.ts +529 -0
- package/src/lib/interaction-errors.ts +15 -0
- package/src/lib/menu-styles.ts +44 -0
- package/src/lib/notify-observer.ts +15 -0
- package/src/lib/pierre-diffs-loader.ts +53 -0
- package/src/lib/provider-recovery.ts +255 -0
- package/src/lib/scrollbars.ts +30 -0
- package/src/lib/terminal-input-readiness.ts +51 -0
- package/src/lib/transient-retry.ts +101 -0
- package/src/lib/workbench-peers.ts +62 -0
- package/src/lib/xterm-theme.ts +23 -21
- package/src/mcp-connection-status.ts +39 -0
- package/src/messages/en.ts +3810 -0
- package/src/messages/runtime.tsx +175 -0
- package/src/messages.ts +19 -0
- package/src/model-mark-paths.ts +53 -0
- package/src/model-picker-model.ts +343 -0
- package/src/model-policy.ts +301 -79
- package/src/native-previews.ts +104 -0
- package/src/new-session-draft.ts +22 -0
- package/src/notification-text.ts +81 -0
- package/src/organization-model.ts +123 -0
- package/src/plugin-details.tsx +192 -0
- package/src/plugin-discovery.tsx +209 -0
- package/src/preview-loading-paint.ts +68 -0
- package/src/provider.tsx +105 -21
- package/src/queue-presentation-model.ts +475 -0
- package/src/realtime/dropdown-menu.tsx +19 -12
- package/src/realtime/embedded-new-voice.tsx +1 -0
- package/src/realtime/embedded-voice.tsx +3 -0
- package/src/realtime/realtime-control.tsx +240 -609
- package/src/realtime/session-realtime.ts +582 -0
- package/src/sandbox-label-model.ts +56 -0
- package/src/scrollbars.ts +3 -0
- package/src/secret-reference-label.ts +47 -0
- package/src/secrets-ui.tsx +59 -0
- package/src/session-agents-model.ts +40 -0
- package/src/session-attention-model.ts +62 -0
- package/src/session-auth-recommendation.ts +50 -0
- package/src/session-capability-policy.ts +200 -0
- package/src/session-context.ts +13 -5
- package/src/session-feedback-model.ts +101 -0
- package/src/session-list-model.ts +437 -0
- package/src/session-realtime.ts +18 -0
- package/src/session-status-model.ts +99 -0
- package/src/session-ui.ts +102 -3
- package/src/session.ts +19 -1
- package/src/site-snapshot.ts +74 -0
- package/src/sites-ui.tsx +350 -0
- package/src/sites.ts +3 -0
- package/src/skill-discovery.tsx +221 -0
- package/src/terminal.ts +26 -0
- package/src/testing/session-scenarios.ts +404 -0
- package/src/this-computer.ts +62 -0
- package/src/timeline/activity-rail.tsx +289 -119
- package/src/timeline/agent-identity.tsx +84 -0
- package/src/timeline/agent-row.tsx +235 -0
- package/src/timeline/allowance-exhausted-row.tsx +90 -0
- package/src/timeline/compaction-copy.ts +125 -0
- package/src/timeline/fleet-decision-row.tsx +120 -101
- package/src/timeline/focus-sequence.ts +44 -0
- package/src/timeline/genie-copy.ts +22 -0
- package/src/timeline/genie-loading.tsx +158 -0
- package/src/timeline/index.ts +37 -2
- package/src/timeline/invoked-tool.ts +15 -0
- package/src/timeline/knowledge-receipt.tsx +104 -0
- package/src/timeline/learning-refusal-copy.ts +67 -0
- package/src/timeline/learning-refusal-row.tsx +70 -0
- package/src/timeline/message-sender.tsx +71 -0
- package/src/timeline/notice-presentation.ts +67 -0
- package/src/timeline/parsers.ts +42 -2
- package/src/timeline/patch-apply-command.tsx +139 -0
- package/src/timeline/platform-activity-presentation.ts +219 -0
- package/src/timeline/platform-activity-row.tsx +34 -98
- package/src/timeline/presented-image.ts +63 -0
- package/src/timeline/projection.ts +1556 -71
- package/src/timeline/provider-logo.tsx +53 -0
- package/src/timeline/question-nav-model.ts +28 -0
- package/src/timeline/registry.ts +11 -1
- package/src/timeline/retained-image.ts +102 -0
- package/src/timeline/retained-loaders.ts +91 -0
- package/src/timeline/rolling-activity.tsx +84 -0
- package/src/timeline/screenshot-lightbox.tsx +250 -10
- package/src/timeline/session-usage-limit-row.tsx +44 -0
- package/src/timeline/shared.tsx +76 -29
- package/src/timeline/startup-dispatch-details.tsx +43 -0
- package/src/timeline/startup-preference.ts +33 -0
- package/src/timeline/startup-timings.tsx +164 -0
- package/src/timeline/tool-diff.tsx +3 -1
- package/src/timeline/tool-display-name.ts +38 -6
- package/src/timeline/tool-presentation.ts +1552 -0
- package/src/timeline/tool-renderers.tsx +1023 -1265
- package/src/timeline/turn-summary-model.ts +363 -0
- package/src/timeline/turn-summary.tsx +288 -367
- package/src/timeline/types.ts +191 -7
- package/src/timeline/work-presentation.ts +196 -0
- package/src/timeline-model.ts +143 -0
- package/src/usage/allowance-copy.ts +70 -0
- package/src/usage/session-usage-limit.ts +270 -0
- package/src/usage/summary.ts +93 -0
- package/src/usage.ts +70 -0
- package/src/voice-recording-owner.ts +22 -0
- package/styles/compiled.css +2010 -651
- package/styles/connect.css +290 -0
- package/styles/connect.d.ts +1 -0
- package/styles/effective-tokens.css +1 -0
- package/styles/index.css +286 -9
- package/styles/responsive.css +98 -6
- package/styles/session-capability.css +44 -0
- package/styles/this-computer.css +1042 -0
- package/styles/this-computer.d.ts +1 -0
- package/styles/tokens.css +132 -64
- package/dist/browser-viewer-NTD6UIPR.js +0 -14
- package/dist/chunk-24M4YBCL.js.map +0 -1
- package/dist/chunk-4MDLEHXL.js.map +0 -1
- package/dist/chunk-5M6VTFJ5.js.map +0 -1
- package/dist/chunk-5PQJOCX5.js +0 -902
- package/dist/chunk-5PQJOCX5.js.map +0 -1
- package/dist/chunk-5YK2ZDIG.js.map +0 -1
- package/dist/chunk-6J56T3MG.js.map +0 -1
- package/dist/chunk-BV5A4OTE.js.map +0 -1
- package/dist/chunk-CQG7YUJB.js +0 -10883
- package/dist/chunk-CQG7YUJB.js.map +0 -1
- package/dist/chunk-H5YGYNXS.js.map +0 -1
- package/dist/chunk-HUIKIDM5.js.map +0 -1
- package/dist/chunk-HUMIRRYI.js.map +0 -1
- package/dist/chunk-ICA6R6TW.js.map +0 -1
- package/dist/chunk-JVYQRRC4.js.map +0 -1
- package/dist/chunk-KCGXPP5V.js.map +0 -1
- package/dist/chunk-KZ73RL76.js.map +0 -1
- package/dist/chunk-NEXLLTP4.js.map +0 -1
- package/dist/chunk-NLTS7JHI.js.map +0 -1
- package/dist/chunk-NOSYBS2D.js.map +0 -1
- package/dist/chunk-PAJU5KKL.js.map +0 -1
- package/dist/chunk-PEI6RANI.js.map +0 -1
- package/dist/chunk-PLYRL5ER.js +0 -164
- package/dist/chunk-PLYRL5ER.js.map +0 -1
- package/dist/chunk-R4KRSFGA.js +0 -290
- package/dist/chunk-R4KRSFGA.js.map +0 -1
- package/dist/chunk-UMECRJRV.js +0 -223
- package/dist/chunk-UMECRJRV.js.map +0 -1
- package/dist/chunk-VRBL3F5E.js +0 -241
- package/dist/chunk-VRBL3F5E.js.map +0 -1
- package/dist/chunk-YBM6CQRU.js.map +0 -1
- package/dist/chunk-Z7WBDB4E.js.map +0 -1
- package/dist/computer-viewer-7TEZC6Y2.js +0 -16
- package/dist/fleet-decision-row-YZ3ZKWMM.js +0 -352
- package/dist/fleet-decision-row-YZ3ZKWMM.js.map +0 -1
- package/dist/hooks/use-environments.d.ts +0 -41
- package/dist/hooks/use-packs.d.ts +0 -32
- package/dist/markdown-table-layout-3Z3AWBY7.js.map +0 -1
- package/dist/model-policy-picker-menu-3R336DP2.js +0 -13
- package/dist/platform-activity-row-27LKAWZD.js +0 -169
- package/dist/platform-activity-row-27LKAWZD.js.map +0 -1
- package/dist/queue-surface-implementation-LK3S4BIW.js.map +0 -1
- package/dist/timeline-annotation-markers-DRSTLEM6.js.map +0 -1
- package/dist/timeline-annotation-selection-IHLUGVND.js.map +0 -1
- package/dist/timeline-annotations-dialog-6Q53N5FG.js.map +0 -1
- package/src/hooks/use-environments.ts +0 -182
- package/src/hooks/use-packs.ts +0 -157
- /package/dist/{browser-viewer-NTD6UIPR.js.map → browser-viewer-GEHX3KYE.js.map} +0 -0
- /package/dist/{computer-viewer-7TEZC6Y2.js.map → chat-interactive-block-5V3BGLXT.js.map} +0 -0
- /package/dist/{model-policy-picker-menu-3R336DP2.js.map → chunk-M357MHH3.js.map} +0 -0
|
@@ -1,312 +1,46 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
defaultChatComposerMessages
|
|
4
|
+
} from "./chunk-V7UGCQHQ.js";
|
|
5
|
+
import {
|
|
6
|
+
COMPOSER_VOICE_INPUT_START_EVENT,
|
|
7
|
+
composerVoiceEventScope
|
|
8
|
+
} from "./chunk-NX4ADH73.js";
|
|
5
9
|
import {
|
|
6
10
|
shouldSteerOnKey,
|
|
7
11
|
shouldSubmitOnKey
|
|
8
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-RRAQ5FV5.js";
|
|
9
13
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
Tooltip,
|
|
15
|
+
TooltipContent,
|
|
16
|
+
TooltipProvider,
|
|
17
|
+
TooltipTrigger,
|
|
18
|
+
useLightboxOptional
|
|
19
|
+
} from "./chunk-7CZLTFXF.js";
|
|
14
20
|
import {
|
|
15
21
|
groupPickerRowsByBillingClass
|
|
16
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-2ZUUIMBY.js";
|
|
17
23
|
import {
|
|
18
|
-
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
|
|
21
|
-
// src/components/tooltip.tsx
|
|
22
|
-
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
24
|
+
ComposerResponsiveContext
|
|
25
|
+
} from "./chunk-XEA5BCMA.js";
|
|
23
26
|
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
useLayoutEffect,
|
|
27
|
-
useMemo,
|
|
28
|
-
useRef,
|
|
29
|
-
useState
|
|
30
|
-
} from "react";
|
|
31
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
32
|
-
var TooltipSourceContext = createContext(null);
|
|
33
|
-
function TooltipProvider({
|
|
34
|
-
delayDuration = 300,
|
|
35
|
-
...props
|
|
36
|
-
}) {
|
|
37
|
-
return /* @__PURE__ */ jsx(TooltipPrimitive.Provider, { delayDuration, ...props });
|
|
38
|
-
}
|
|
39
|
-
function Tooltip({ children, ...props }) {
|
|
40
|
-
const { onOpenChange, ...rootProps } = props;
|
|
41
|
-
const sourceRef = useRef(null);
|
|
42
|
-
const sourcePublishedRef = useRef(false);
|
|
43
|
-
const [source, setSource] = useState(null);
|
|
44
|
-
const ref = useRef((node) => {
|
|
45
|
-
sourceRef.current = node;
|
|
46
|
-
if (sourcePublishedRef.current) setSource(node);
|
|
47
|
-
}).current;
|
|
48
|
-
useLayoutEffect(() => {
|
|
49
|
-
if (rootProps.open === true || rootProps.defaultOpen === true) {
|
|
50
|
-
sourcePublishedRef.current = true;
|
|
51
|
-
setSource(sourceRef.current);
|
|
52
|
-
}
|
|
53
|
-
}, [rootProps.defaultOpen, rootProps.open]);
|
|
54
|
-
const sourceContext = useMemo(() => ({ source, ref }), [ref, source]);
|
|
55
|
-
return /* @__PURE__ */ jsx(TooltipSourceContext.Provider, { value: sourceContext, children: /* @__PURE__ */ jsx(
|
|
56
|
-
TooltipPrimitive.Root,
|
|
57
|
-
{
|
|
58
|
-
"data-slot": "tooltip",
|
|
59
|
-
onOpenChange: (open) => {
|
|
60
|
-
if (open) {
|
|
61
|
-
sourcePublishedRef.current = true;
|
|
62
|
-
setSource(sourceRef.current);
|
|
63
|
-
}
|
|
64
|
-
onOpenChange?.(open);
|
|
65
|
-
},
|
|
66
|
-
...rootProps,
|
|
67
|
-
children
|
|
68
|
-
}
|
|
69
|
-
) });
|
|
70
|
-
}
|
|
71
|
-
function TooltipTrigger({
|
|
72
|
-
asChild = true,
|
|
73
|
-
...props
|
|
74
|
-
}) {
|
|
75
|
-
const sourceRef = useContext(TooltipSourceContext);
|
|
76
|
-
return /* @__PURE__ */ jsx(
|
|
77
|
-
TooltipPrimitive.Trigger,
|
|
78
|
-
{
|
|
79
|
-
"data-slot": "tooltip-trigger",
|
|
80
|
-
asChild,
|
|
81
|
-
ref: (node) => {
|
|
82
|
-
sourceRef?.ref(node);
|
|
83
|
-
},
|
|
84
|
-
...props
|
|
85
|
-
}
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
var tooltipSurfaceStyle = {
|
|
89
|
-
backgroundColor: "var(--og-color-fg)",
|
|
90
|
-
color: "var(--og-color-bg)"
|
|
91
|
-
};
|
|
92
|
-
function TooltipContent({
|
|
93
|
-
className,
|
|
94
|
-
sideOffset = 6,
|
|
95
|
-
children,
|
|
96
|
-
style,
|
|
97
|
-
...props
|
|
98
|
-
}) {
|
|
99
|
-
const source = useContext(TooltipSourceContext);
|
|
100
|
-
const portalStyle = usePortalTokenStyle(source?.source ?? null);
|
|
101
|
-
return /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
102
|
-
TooltipPrimitive.Content,
|
|
103
|
-
{
|
|
104
|
-
"data-slot": "tooltip-content",
|
|
105
|
-
sideOffset,
|
|
106
|
-
className: cn(
|
|
107
|
-
"og-root z-50 w-fit max-w-xs origin-[var(--radix-tooltip-content-transform-origin)]",
|
|
108
|
-
"rounded-og-md px-2.5 py-1.5 text-og-xs leading-4 text-balance shadow-og-md",
|
|
109
|
-
"animate-og-enter data-[state=closed]:opacity-0 data-[state=closed]:transition-opacity",
|
|
110
|
-
className
|
|
111
|
-
),
|
|
112
|
-
style: { ...portalStyle, ...tooltipSurfaceStyle, ...style },
|
|
113
|
-
...props,
|
|
114
|
-
children: [
|
|
115
|
-
children,
|
|
116
|
-
/* @__PURE__ */ jsx(
|
|
117
|
-
TooltipPrimitive.Arrow,
|
|
118
|
-
{
|
|
119
|
-
className: "z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]",
|
|
120
|
-
style: {
|
|
121
|
-
backgroundColor: "var(--og-color-fg)",
|
|
122
|
-
fill: "var(--og-color-fg)"
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
)
|
|
126
|
-
]
|
|
127
|
-
}
|
|
128
|
-
) });
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// src/timeline/screenshot-lightbox.tsx
|
|
132
|
-
import { DownloadIcon, XIcon } from "lucide-react";
|
|
133
|
-
import { AnimatePresence, motion } from "motion/react";
|
|
27
|
+
useErrorMessage
|
|
28
|
+
} from "./chunk-CM7LVUKC.js";
|
|
134
29
|
import {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
144
|
-
var LightboxContext = createContext2(null);
|
|
145
|
-
function useLightbox() {
|
|
146
|
-
return useContext2(LightboxContext) ?? NOOP;
|
|
147
|
-
}
|
|
148
|
-
function useLightboxOptional() {
|
|
149
|
-
return useContext2(LightboxContext);
|
|
150
|
-
}
|
|
151
|
-
var NOOP = { open: () => {
|
|
152
|
-
} };
|
|
153
|
-
function createLightboxSourceOwner() {
|
|
154
|
-
let releaseCurrent = null;
|
|
155
|
-
return {
|
|
156
|
-
replace(release) {
|
|
157
|
-
const previous = releaseCurrent;
|
|
158
|
-
releaseCurrent = release ?? null;
|
|
159
|
-
previous?.();
|
|
160
|
-
},
|
|
161
|
-
release() {
|
|
162
|
-
const release = releaseCurrent;
|
|
163
|
-
releaseCurrent = null;
|
|
164
|
-
release?.();
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
function LightboxProvider({ children }) {
|
|
169
|
-
const ancestor = useContext2(LightboxContext);
|
|
170
|
-
if (ancestor) {
|
|
171
|
-
return /* @__PURE__ */ jsx2(Fragment, { children });
|
|
172
|
-
}
|
|
173
|
-
return /* @__PURE__ */ jsx2(LightboxRoot, { children });
|
|
174
|
-
}
|
|
175
|
-
function LightboxRoot({ children }) {
|
|
176
|
-
const [state, setState] = useState2(null);
|
|
177
|
-
const [tokenSource, setTokenSource] = useState2(null);
|
|
178
|
-
const sourceOwner = useMemo2(() => createLightboxSourceOwner(), []);
|
|
179
|
-
const portalStyle = usePortalTokenStyle(tokenSource);
|
|
180
|
-
const releaseCurrentSource = useCallback(() => {
|
|
181
|
-
sourceOwner.release();
|
|
182
|
-
}, [sourceOwner]);
|
|
183
|
-
useEffect(() => releaseCurrentSource, [releaseCurrentSource]);
|
|
184
|
-
const open = useCallback(
|
|
185
|
-
(src, caption, source, label = "Screenshot", downloadFilename, controlLabels, releaseSource) => {
|
|
186
|
-
sourceOwner.replace(releaseSource);
|
|
187
|
-
setTokenSource(source ?? null);
|
|
188
|
-
setState({
|
|
189
|
-
src,
|
|
190
|
-
label,
|
|
191
|
-
...caption ? { caption } : {},
|
|
192
|
-
...downloadFilename ? { downloadFilename } : {},
|
|
193
|
-
...controlLabels ? { controlLabels } : {}
|
|
194
|
-
});
|
|
195
|
-
},
|
|
196
|
-
[sourceOwner]
|
|
197
|
-
);
|
|
198
|
-
const close = useCallback(() => {
|
|
199
|
-
releaseCurrentSource();
|
|
200
|
-
setState(null);
|
|
201
|
-
setTokenSource(null);
|
|
202
|
-
}, [releaseCurrentSource]);
|
|
203
|
-
const controller = useMemo2(() => ({ open }), [open]);
|
|
204
|
-
return /* @__PURE__ */ jsxs2(LightboxContext.Provider, { value: controller, children: [
|
|
205
|
-
children,
|
|
206
|
-
/* @__PURE__ */ jsx2(Dialog.Root, { open: state !== null, onOpenChange: (next) => !next && close(), children: /* @__PURE__ */ jsx2(AnimatePresence, { children: state !== null ? /* @__PURE__ */ jsxs2(Dialog.Portal, { forceMount: true, children: [
|
|
207
|
-
/* @__PURE__ */ jsx2(Dialog.Overlay, { asChild: true, forceMount: true, children: /* @__PURE__ */ jsx2(
|
|
208
|
-
motion.div,
|
|
209
|
-
{
|
|
210
|
-
initial: { opacity: 0 },
|
|
211
|
-
animate: { opacity: 1 },
|
|
212
|
-
exit: { opacity: 0 },
|
|
213
|
-
transition: { duration: 0.15 },
|
|
214
|
-
className: "og-root fixed inset-0 z-50 bg-black/90 backdrop-blur-md",
|
|
215
|
-
style: portalStyle
|
|
216
|
-
}
|
|
217
|
-
) }),
|
|
218
|
-
/* @__PURE__ */ jsx2(
|
|
219
|
-
Dialog.Content,
|
|
220
|
-
{
|
|
221
|
-
asChild: true,
|
|
222
|
-
forceMount: true,
|
|
223
|
-
"aria-label": state.label,
|
|
224
|
-
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
225
|
-
children: /* @__PURE__ */ jsxs2(
|
|
226
|
-
motion.div,
|
|
227
|
-
{
|
|
228
|
-
initial: { opacity: 0, scale: 0.98 },
|
|
229
|
-
animate: { opacity: 1, scale: 1 },
|
|
230
|
-
exit: { opacity: 0, scale: 0.98 },
|
|
231
|
-
transition: { duration: 0.18, ease: [0.16, 1, 0.3, 1] },
|
|
232
|
-
onClick: (event) => {
|
|
233
|
-
if (event.target === event.currentTarget) {
|
|
234
|
-
close();
|
|
235
|
-
}
|
|
236
|
-
},
|
|
237
|
-
className: "og-root fixed inset-0 z-50 flex items-center justify-center p-6 sm:p-12",
|
|
238
|
-
style: portalStyle,
|
|
239
|
-
children: [
|
|
240
|
-
/* @__PURE__ */ jsx2(Dialog.Title, { className: "sr-only", children: state.label }),
|
|
241
|
-
/* @__PURE__ */ jsx2(Dialog.Description, { className: "sr-only", children: state.caption ?? `Expanded ${state.label.toLowerCase()}` }),
|
|
242
|
-
/* @__PURE__ */ jsxs2("figure", { className: "m-0 flex max-h-full max-w-5xl flex-col items-center gap-3", children: [
|
|
243
|
-
/* @__PURE__ */ jsxs2("div", { className: "relative flex min-h-0 w-fit max-w-full", children: [
|
|
244
|
-
/* @__PURE__ */ jsx2(
|
|
245
|
-
"img",
|
|
246
|
-
{
|
|
247
|
-
src: state.src,
|
|
248
|
-
alt: state.caption ?? state.label,
|
|
249
|
-
className: "min-h-0 max-h-[82vh] w-auto max-w-full rounded-og-md border border-white/10 object-contain shadow-og-lg"
|
|
250
|
-
}
|
|
251
|
-
),
|
|
252
|
-
/* @__PURE__ */ jsx2(
|
|
253
|
-
ScreenshotLightboxControls,
|
|
254
|
-
{
|
|
255
|
-
src: state.src,
|
|
256
|
-
downloadFilename: state.downloadFilename,
|
|
257
|
-
controlLabels: state.controlLabels
|
|
258
|
-
}
|
|
259
|
-
)
|
|
260
|
-
] }),
|
|
261
|
-
state.caption ? /* @__PURE__ */ jsx2("figcaption", { className: "max-w-2xl text-center font-og-mono text-og-xs text-white/55", children: state.caption }) : /* @__PURE__ */ jsx2("figcaption", { className: "font-og-mono text-og-xs uppercase tracking-[0.1em] text-white/35", children: "Esc or click outside to close" })
|
|
262
|
-
] })
|
|
263
|
-
]
|
|
264
|
-
}
|
|
265
|
-
)
|
|
266
|
-
}
|
|
267
|
-
)
|
|
268
|
-
] }) : null }) })
|
|
269
|
-
] });
|
|
270
|
-
}
|
|
271
|
-
function ScreenshotLightboxControls({
|
|
272
|
-
src,
|
|
273
|
-
downloadFilename,
|
|
274
|
-
controlLabels
|
|
275
|
-
}) {
|
|
276
|
-
return /* @__PURE__ */ jsxs2("div", { className: "absolute -right-3 -top-3 flex items-center gap-2", children: [
|
|
277
|
-
downloadFilename ? /* @__PURE__ */ jsx2(
|
|
278
|
-
"a",
|
|
279
|
-
{
|
|
280
|
-
href: src,
|
|
281
|
-
download: downloadFilename,
|
|
282
|
-
className: cn(
|
|
283
|
-
"inline-flex size-9 items-center justify-center rounded-full",
|
|
284
|
-
"border border-white/15 bg-black/60 text-white/70 backdrop-blur",
|
|
285
|
-
"transition-colors hover:border-white/30 hover:text-white"
|
|
286
|
-
),
|
|
287
|
-
"aria-label": controlLabels?.download ?? `Download ${downloadFilename}`,
|
|
288
|
-
children: /* @__PURE__ */ jsx2(DownloadIcon, { className: "size-4" })
|
|
289
|
-
}
|
|
290
|
-
) : null,
|
|
291
|
-
/* @__PURE__ */ jsx2(
|
|
292
|
-
Dialog.Close,
|
|
293
|
-
{
|
|
294
|
-
className: cn(
|
|
295
|
-
"inline-flex size-9 items-center justify-center rounded-full",
|
|
296
|
-
"border border-white/15 bg-black/60 text-white/70 backdrop-blur",
|
|
297
|
-
"transition-colors hover:border-white/30 hover:text-white"
|
|
298
|
-
),
|
|
299
|
-
"aria-label": controlLabels?.close ?? "Close",
|
|
300
|
-
children: /* @__PURE__ */ jsx2(XIcon, { className: "size-4" })
|
|
301
|
-
}
|
|
302
|
-
)
|
|
303
|
-
] });
|
|
304
|
-
}
|
|
30
|
+
composerSubmissionErrorMessage
|
|
31
|
+
} from "./chunk-AIX25FIQ.js";
|
|
32
|
+
import {
|
|
33
|
+
cn
|
|
34
|
+
} from "./chunk-TXS65BB2.js";
|
|
35
|
+
import {
|
|
36
|
+
useOpenGeniText
|
|
37
|
+
} from "./chunk-VU4QUISJ.js";
|
|
305
38
|
|
|
306
39
|
// src/workstream-control-event.ts
|
|
307
40
|
var OPEN_WORKSTREAM_CONTROL_EVENT = "opengeni:open-workstream-control";
|
|
308
41
|
|
|
309
42
|
// src/commands/registry.ts
|
|
43
|
+
import { formatErrorMessage } from "@opengeni/sdk";
|
|
310
44
|
function parseCommandLine(value) {
|
|
311
45
|
if (value[0] !== "/") {
|
|
312
46
|
return null;
|
|
@@ -374,18 +108,18 @@ function firstMissingRequiredArg(command, args) {
|
|
|
374
108
|
}
|
|
375
109
|
return null;
|
|
376
110
|
}
|
|
377
|
-
function requireSession(ctx) {
|
|
111
|
+
function requireSession(t, ctx) {
|
|
378
112
|
if (!ctx.sessionId) {
|
|
379
|
-
throw new Error("
|
|
113
|
+
throw new Error(t("commands.registry.noActiveSessionYetStart"));
|
|
380
114
|
}
|
|
381
115
|
return ctx.sessionId;
|
|
382
116
|
}
|
|
383
117
|
var hasSession = (ctx) => ctx.sessionId !== null;
|
|
384
|
-
var defaultCommands = [
|
|
118
|
+
var defaultCommands = (t) => [
|
|
385
119
|
{
|
|
386
120
|
name: "help",
|
|
387
121
|
aliases: ["?"],
|
|
388
|
-
description: "
|
|
122
|
+
description: t("commands.registry.showAvailableCommands"),
|
|
389
123
|
run: (_args, ctx) => {
|
|
390
124
|
ctx.openHelp();
|
|
391
125
|
return { status: "ok" };
|
|
@@ -393,28 +127,28 @@ var defaultCommands = [
|
|
|
393
127
|
},
|
|
394
128
|
{
|
|
395
129
|
name: "clear-view",
|
|
396
|
-
description: "
|
|
130
|
+
description: t("commands.registry.clearTheLocalTimelineView"),
|
|
397
131
|
run: (_args, ctx) => {
|
|
398
132
|
const cleared = ctx.clearView();
|
|
399
133
|
if (!cleared) {
|
|
400
134
|
return {
|
|
401
135
|
status: "error",
|
|
402
|
-
message:
|
|
136
|
+
message: t("commands.registry.thisViewCanTBe")
|
|
403
137
|
};
|
|
404
138
|
}
|
|
405
|
-
return { status: "ok", message: "
|
|
139
|
+
return { status: "ok", message: t("commands.registry.localViewCleared") };
|
|
406
140
|
}
|
|
407
141
|
},
|
|
408
142
|
{
|
|
409
143
|
name: "goal",
|
|
410
|
-
description: "
|
|
144
|
+
description: t("commands.registry.pauseOrResumeTheSession"),
|
|
411
145
|
permission: "sessions:control",
|
|
412
146
|
available: hasSession,
|
|
413
147
|
args: [
|
|
414
148
|
{ name: "action", required: true, oneOf: ["pause", "resume"], description: "pause | resume" }
|
|
415
149
|
],
|
|
416
150
|
run: async (args, ctx) => {
|
|
417
|
-
const sessionId = requireSession(ctx);
|
|
151
|
+
const sessionId = requireSession(t, ctx);
|
|
418
152
|
const action = args[0];
|
|
419
153
|
if (action !== "pause" && action !== "resume") {
|
|
420
154
|
return { status: "error", message: "Usage: /goal pause | /goal resume" };
|
|
@@ -423,53 +157,59 @@ var defaultCommands = [
|
|
|
423
157
|
await ctx.client.updateGoal(ctx.workspaceId, sessionId, {
|
|
424
158
|
status: action === "pause" ? "paused" : "active"
|
|
425
159
|
});
|
|
426
|
-
return {
|
|
160
|
+
return {
|
|
161
|
+
status: "ok",
|
|
162
|
+
message: action === "pause" ? t("commands.registry.goalPaused") : t("commands.registry.goalResumed")
|
|
163
|
+
};
|
|
427
164
|
} catch (cause) {
|
|
428
|
-
return {
|
|
165
|
+
return {
|
|
166
|
+
status: "error",
|
|
167
|
+
message: commandErrorMessage(ctx, cause, goalErrorMessage(t, cause, action))
|
|
168
|
+
};
|
|
429
169
|
}
|
|
430
170
|
}
|
|
431
171
|
},
|
|
432
172
|
{
|
|
433
173
|
name: "compact",
|
|
434
|
-
description: "
|
|
174
|
+
description: t("commands.registry.compactTheConversationContextNow"),
|
|
435
175
|
permission: "sessions:control",
|
|
436
176
|
available: hasSession,
|
|
437
177
|
run: async (_args, ctx) => {
|
|
438
|
-
const sessionId = requireSession(ctx);
|
|
178
|
+
const sessionId = requireSession(t, ctx);
|
|
439
179
|
try {
|
|
440
180
|
const result = await ctx.client.compactSessionContext(ctx.workspaceId, sessionId);
|
|
441
181
|
return { status: "ok", message: result.message };
|
|
442
182
|
} catch (cause) {
|
|
443
|
-
return { status: "error", message:
|
|
183
|
+
return { status: "error", message: commandErrorMessage(ctx, cause) };
|
|
444
184
|
}
|
|
445
185
|
}
|
|
446
186
|
},
|
|
447
187
|
{
|
|
448
188
|
name: "clear",
|
|
449
|
-
description: "
|
|
189
|
+
description: t("commands.registry.clearTheConversationContextDestructive"),
|
|
450
190
|
permission: "sessions:control",
|
|
451
191
|
danger: true,
|
|
452
192
|
available: hasSession,
|
|
453
193
|
run: async (_args, ctx) => {
|
|
454
|
-
const sessionId = requireSession(ctx);
|
|
194
|
+
const sessionId = requireSession(t, ctx);
|
|
455
195
|
const confirmed = await ctx.confirm();
|
|
456
196
|
if (!confirmed) {
|
|
457
197
|
return { status: "ok", keepDraft: true };
|
|
458
198
|
}
|
|
459
199
|
try {
|
|
460
200
|
await ctx.client.clearSessionContext(ctx.workspaceId, sessionId);
|
|
461
|
-
return { status: "ok", message: "
|
|
201
|
+
return { status: "ok", message: t("commands.registry.contextCleared") };
|
|
462
202
|
} catch (cause) {
|
|
463
|
-
return {
|
|
203
|
+
return {
|
|
204
|
+
status: "error",
|
|
205
|
+
message: commandErrorMessage(ctx, cause, clearErrorMessage(t, cause))
|
|
206
|
+
};
|
|
464
207
|
}
|
|
465
208
|
}
|
|
466
209
|
}
|
|
467
210
|
];
|
|
468
|
-
function
|
|
469
|
-
|
|
470
|
-
return cause.message;
|
|
471
|
-
}
|
|
472
|
-
return void 0;
|
|
211
|
+
function commandErrorMessage(ctx, cause, message = formatErrorMessage(cause)) {
|
|
212
|
+
return ctx.formatError?.(cause, message) || message;
|
|
473
213
|
}
|
|
474
214
|
function statusCode(cause) {
|
|
475
215
|
if (cause && typeof cause === "object" && "status" in cause && typeof cause.status === "number") {
|
|
@@ -477,38 +217,39 @@ function statusCode(cause) {
|
|
|
477
217
|
}
|
|
478
218
|
return void 0;
|
|
479
219
|
}
|
|
480
|
-
function goalErrorMessage(cause, action) {
|
|
220
|
+
function goalErrorMessage(t, cause, action) {
|
|
481
221
|
const code = statusCode(cause);
|
|
482
222
|
if (code === 404) {
|
|
483
|
-
return "
|
|
223
|
+
return t("commands.registry.thisSessionHasNoGoal");
|
|
484
224
|
}
|
|
485
225
|
if (code === 409) {
|
|
486
|
-
return action === "resume" ? "
|
|
226
|
+
return action === "resume" ? t("commands.registry.onlyAPausedGoalCan") : t("commands.registry.goalIsAlreadyInA");
|
|
487
227
|
}
|
|
488
|
-
return
|
|
228
|
+
return formatErrorMessage(cause);
|
|
489
229
|
}
|
|
490
|
-
function clearErrorMessage(cause) {
|
|
230
|
+
function clearErrorMessage(t, cause) {
|
|
491
231
|
if (statusCode(cause) === 409) {
|
|
492
|
-
return "
|
|
232
|
+
return t("commands.registry.pauseTheSessionAndWait");
|
|
493
233
|
}
|
|
494
|
-
return
|
|
234
|
+
return formatErrorMessage(cause);
|
|
495
235
|
}
|
|
496
236
|
|
|
497
237
|
// src/hooks/use-slash-commands.ts
|
|
498
|
-
import { useCallback
|
|
238
|
+
import { useCallback, useMemo, useRef, useState } from "react";
|
|
499
239
|
function useSlashCommands(options) {
|
|
240
|
+
const formatError = useErrorMessage();
|
|
500
241
|
const { commands, context, handlers, value, setValue } = options;
|
|
501
|
-
const [highlight, setHighlight] =
|
|
502
|
-
const [dismissedValue, setDismissedValue] =
|
|
242
|
+
const [highlight, setHighlight] = useState(0);
|
|
243
|
+
const [dismissedValue, setDismissedValue] = useState(null);
|
|
503
244
|
const dismissed = dismissedValue !== null && dismissedValue === value;
|
|
504
|
-
const navigatedRef =
|
|
505
|
-
const navTokenRef =
|
|
245
|
+
const navigatedRef = useRef(false);
|
|
246
|
+
const navTokenRef = useRef(value);
|
|
506
247
|
if (navTokenRef.current !== value) {
|
|
507
248
|
navTokenRef.current = value;
|
|
508
249
|
navigatedRef.current = false;
|
|
509
250
|
}
|
|
510
|
-
const parsed =
|
|
511
|
-
const filterCtx =
|
|
251
|
+
const parsed = useMemo(() => parseCommandLine(value), [value]);
|
|
252
|
+
const filterCtx = useMemo(
|
|
512
253
|
() => ({
|
|
513
254
|
sessionId: context?.sessionId ?? null,
|
|
514
255
|
status: context?.status ?? null,
|
|
@@ -516,13 +257,13 @@ function useSlashCommands(options) {
|
|
|
516
257
|
}),
|
|
517
258
|
[context?.sessionId, context?.status, context?.permissions]
|
|
518
259
|
);
|
|
519
|
-
const activeCommand =
|
|
260
|
+
const activeCommand = useMemo(() => {
|
|
520
261
|
if (!parsed || !parsed.hasTrailingSpace) {
|
|
521
262
|
return null;
|
|
522
263
|
}
|
|
523
264
|
return matchCommand(commands, value);
|
|
524
265
|
}, [commands, value, parsed]);
|
|
525
|
-
const items =
|
|
266
|
+
const items = useMemo(() => {
|
|
526
267
|
if (!parsed) {
|
|
527
268
|
return [];
|
|
528
269
|
}
|
|
@@ -535,16 +276,16 @@ function useSlashCommands(options) {
|
|
|
535
276
|
const isCommandDraft = parsed !== null && items.length > 0;
|
|
536
277
|
const clampedHighlight = items.length === 0 ? 0 : Math.min(highlight, items.length - 1);
|
|
537
278
|
const activeArgHint = activeCommand ? argHint(activeCommand.args) : "";
|
|
538
|
-
const buildContext =
|
|
279
|
+
const buildContext = useCallback(
|
|
539
280
|
(command) => {
|
|
540
281
|
if (!context) {
|
|
541
282
|
return null;
|
|
542
283
|
}
|
|
543
|
-
return { ...context, ...handlers, confirm: () => handlers.confirm(command) };
|
|
284
|
+
return { ...context, ...handlers, formatError, confirm: () => handlers.confirm(command) };
|
|
544
285
|
},
|
|
545
|
-
[context, handlers]
|
|
286
|
+
[context, handlers, formatError]
|
|
546
287
|
);
|
|
547
|
-
const execute =
|
|
288
|
+
const execute = useCallback(
|
|
548
289
|
async (command, args) => {
|
|
549
290
|
const ctx = buildContext(command);
|
|
550
291
|
if (!ctx) {
|
|
@@ -559,26 +300,26 @@ function useSlashCommands(options) {
|
|
|
559
300
|
setValue("");
|
|
560
301
|
}
|
|
561
302
|
} catch (cause) {
|
|
562
|
-
ctx.notice({ tone: "error", message:
|
|
303
|
+
ctx.notice({ tone: "error", message: formatError(cause) });
|
|
563
304
|
}
|
|
564
305
|
},
|
|
565
|
-
[buildContext, setValue]
|
|
306
|
+
[buildContext, setValue, formatError]
|
|
566
307
|
);
|
|
567
|
-
const autocomplete =
|
|
308
|
+
const autocomplete = useCallback(
|
|
568
309
|
(command) => {
|
|
569
310
|
setValue(`/${command.name} `);
|
|
570
311
|
setHighlight(0);
|
|
571
312
|
},
|
|
572
313
|
[setValue]
|
|
573
314
|
);
|
|
574
|
-
const autocompleteHighlighted =
|
|
315
|
+
const autocompleteHighlighted = useCallback(() => {
|
|
575
316
|
const command = items[clampedHighlight];
|
|
576
317
|
if (command) {
|
|
577
318
|
autocomplete(command);
|
|
578
319
|
}
|
|
579
320
|
}, [items, clampedHighlight, autocomplete]);
|
|
580
|
-
const runningRef =
|
|
581
|
-
const runResolved =
|
|
321
|
+
const runningRef = useRef(false);
|
|
322
|
+
const runResolved = useCallback(
|
|
582
323
|
async (command, executionOptions) => {
|
|
583
324
|
if (!parsed || runningRef.current) {
|
|
584
325
|
return;
|
|
@@ -606,7 +347,7 @@ function useSlashCommands(options) {
|
|
|
606
347
|
},
|
|
607
348
|
[parsed, activeCommand, autocomplete, execute]
|
|
608
349
|
);
|
|
609
|
-
const runHighlighted =
|
|
350
|
+
const runHighlighted = useCallback(async () => {
|
|
610
351
|
if (!parsed) {
|
|
611
352
|
return;
|
|
612
353
|
}
|
|
@@ -625,7 +366,7 @@ function useSlashCommands(options) {
|
|
|
625
366
|
}
|
|
626
367
|
await runResolved(command);
|
|
627
368
|
}, [parsed, activeCommand, items, clampedHighlight, runResolved]);
|
|
628
|
-
const runAt =
|
|
369
|
+
const runAt = useCallback(
|
|
629
370
|
async (index) => {
|
|
630
371
|
const command = items[index];
|
|
631
372
|
if (!command) {
|
|
@@ -635,7 +376,7 @@ function useSlashCommands(options) {
|
|
|
635
376
|
},
|
|
636
377
|
[items, runResolved]
|
|
637
378
|
);
|
|
638
|
-
const onKeyDown =
|
|
379
|
+
const onKeyDown = useCallback(
|
|
639
380
|
(event) => {
|
|
640
381
|
if (!open) {
|
|
641
382
|
return false;
|
|
@@ -696,16 +437,10 @@ function useSlashCommands(options) {
|
|
|
696
437
|
autocompleteHighlighted
|
|
697
438
|
};
|
|
698
439
|
}
|
|
699
|
-
function errorMessage2(cause) {
|
|
700
|
-
if (cause instanceof Error) {
|
|
701
|
-
return cause.message;
|
|
702
|
-
}
|
|
703
|
-
return String(cause);
|
|
704
|
-
}
|
|
705
440
|
|
|
706
441
|
// src/components/command-palette.tsx
|
|
707
|
-
import { AnimatePresence
|
|
708
|
-
import { jsx
|
|
442
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
443
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
709
444
|
function CommandPalette({
|
|
710
445
|
open,
|
|
711
446
|
items,
|
|
@@ -714,11 +449,13 @@ function CommandPalette({
|
|
|
714
449
|
onRun,
|
|
715
450
|
argHintText,
|
|
716
451
|
listboxId,
|
|
717
|
-
label
|
|
452
|
+
label: labelProp,
|
|
718
453
|
dangerLabel = "danger"
|
|
719
454
|
}) {
|
|
720
|
-
|
|
721
|
-
|
|
455
|
+
const t = useOpenGeniText();
|
|
456
|
+
const label = labelProp === void 0 ? t("commandPalette.slashCommands") : labelProp;
|
|
457
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: open ? /* @__PURE__ */ jsxs(
|
|
458
|
+
motion.div,
|
|
722
459
|
{
|
|
723
460
|
initial: { opacity: 0, y: 6, scale: 0.99 },
|
|
724
461
|
animate: { opacity: 1, y: 0, scale: 1 },
|
|
@@ -729,7 +466,7 @@ function CommandPalette({
|
|
|
729
466
|
"rounded-og-lg border border-og-border bg-og-surface-2 shadow-og-sm"
|
|
730
467
|
),
|
|
731
468
|
children: [
|
|
732
|
-
/* @__PURE__ */
|
|
469
|
+
/* @__PURE__ */ jsx(
|
|
733
470
|
"ul",
|
|
734
471
|
{
|
|
735
472
|
id: listboxId,
|
|
@@ -739,7 +476,7 @@ function CommandPalette({
|
|
|
739
476
|
children: items.map((command, index) => {
|
|
740
477
|
const selected = index === highlight;
|
|
741
478
|
const hint = argHint(command.args);
|
|
742
|
-
return /* @__PURE__ */
|
|
479
|
+
return /* @__PURE__ */ jsxs(
|
|
743
480
|
"li",
|
|
744
481
|
{
|
|
745
482
|
id: `${listboxId}-option-${index}`,
|
|
@@ -756,8 +493,8 @@ function CommandPalette({
|
|
|
756
493
|
selected ? "bg-og-accent/15 text-og-fg" : "text-og-fg-muted hover:bg-og-surface-3"
|
|
757
494
|
),
|
|
758
495
|
children: [
|
|
759
|
-
/* @__PURE__ */
|
|
760
|
-
/* @__PURE__ */
|
|
496
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-baseline gap-1.5", children: [
|
|
497
|
+
/* @__PURE__ */ jsxs(
|
|
761
498
|
"span",
|
|
762
499
|
{
|
|
763
500
|
className: cn(
|
|
@@ -770,11 +507,11 @@ function CommandPalette({
|
|
|
770
507
|
]
|
|
771
508
|
}
|
|
772
509
|
),
|
|
773
|
-
hint ? /* @__PURE__ */
|
|
510
|
+
hint ? /* @__PURE__ */ jsx("span", { className: "truncate font-mono text-[11px] text-og-fg-subtle", children: hint }) : null
|
|
774
511
|
] }),
|
|
775
|
-
/* @__PURE__ */
|
|
776
|
-
command.danger ? /* @__PURE__ */
|
|
777
|
-
/* @__PURE__ */
|
|
512
|
+
/* @__PURE__ */ jsxs("span", { className: "ml-auto flex items-center gap-1.5", children: [
|
|
513
|
+
command.danger ? /* @__PURE__ */ jsx("span", { className: "rounded-og-xs bg-og-status-failed/15 px-1 text-[10px] uppercase tracking-wide text-og-status-failed", children: dangerLabel }) : null,
|
|
514
|
+
/* @__PURE__ */ jsx("span", { className: "og-command-description truncate text-[12px] text-og-fg-subtle max-sm:hidden", children: command.description })
|
|
778
515
|
] })
|
|
779
516
|
]
|
|
780
517
|
},
|
|
@@ -783,16 +520,17 @@ function CommandPalette({
|
|
|
783
520
|
})
|
|
784
521
|
}
|
|
785
522
|
),
|
|
786
|
-
argHintText ? /* @__PURE__ */
|
|
523
|
+
argHintText ? /* @__PURE__ */ jsx("div", { className: "border-t border-og-border px-3 py-1.5 font-mono text-[11px] text-og-fg-subtle", children: argHintText }) : null
|
|
787
524
|
]
|
|
788
525
|
}
|
|
789
526
|
) : null });
|
|
790
527
|
}
|
|
791
528
|
|
|
792
529
|
// src/components/model-picker.tsx
|
|
530
|
+
import { modelDisplayName } from "@opengeni/sdk/model-display";
|
|
793
531
|
import { ChevronDownIcon } from "lucide-react";
|
|
794
|
-
import { useId, useMemo as
|
|
795
|
-
import { jsx as
|
|
532
|
+
import { useId, useMemo as useMemo2 } from "react";
|
|
533
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
796
534
|
var EMPTY_CLIENT_MODELS = [];
|
|
797
535
|
function isCodexClientModel(model) {
|
|
798
536
|
return model.id.startsWith("codex/") || model.source === "codex";
|
|
@@ -800,14 +538,14 @@ function isCodexClientModel(model) {
|
|
|
800
538
|
function isCodexPickerRow(row) {
|
|
801
539
|
return row.id.startsWith("codex/") || row.catalog.source === "codex";
|
|
802
540
|
}
|
|
803
|
-
function applyCodexOnlyRows(rows, codexOnly) {
|
|
541
|
+
function applyCodexOnlyRows(t, rows, codexOnly) {
|
|
804
542
|
if (!codexOnly) return rows;
|
|
805
543
|
return rows.map((row) => {
|
|
806
544
|
if (isCodexPickerRow(row)) return row;
|
|
807
545
|
return {
|
|
808
546
|
...row,
|
|
809
547
|
selectable: false,
|
|
810
|
-
unavailableReason: row.unavailableReason ?? "
|
|
548
|
+
unavailableReason: row.unavailableReason ?? t("modelPicker.codexOnlySession")
|
|
811
549
|
};
|
|
812
550
|
});
|
|
813
551
|
}
|
|
@@ -824,7 +562,14 @@ function providerGroups(models, codexOnly) {
|
|
|
824
562
|
optionDisabled: codexOnly && !isCodexClientModel(model)
|
|
825
563
|
});
|
|
826
564
|
}
|
|
827
|
-
|
|
565
|
+
const groups = [...byProvider.values()];
|
|
566
|
+
if (codexOnly) {
|
|
567
|
+
const codexIndex = groups.findIndex(
|
|
568
|
+
(group) => group.models.some((model) => !model.optionDisabled && isCodexClientModel(model))
|
|
569
|
+
);
|
|
570
|
+
if (codexIndex > 0) groups.unshift(...groups.splice(codexIndex, 1));
|
|
571
|
+
}
|
|
572
|
+
return groups;
|
|
828
573
|
}
|
|
829
574
|
function ModelPicker({
|
|
830
575
|
models = EMPTY_CLIENT_MODELS,
|
|
@@ -833,26 +578,28 @@ function ModelPicker({
|
|
|
833
578
|
onChange,
|
|
834
579
|
disabled,
|
|
835
580
|
className,
|
|
836
|
-
label
|
|
581
|
+
label: labelProp,
|
|
837
582
|
codexOnly = false
|
|
838
583
|
}) {
|
|
584
|
+
const t = useOpenGeniText();
|
|
585
|
+
const label = labelProp === void 0 ? t("modelPicker.model") : labelProp;
|
|
839
586
|
const selectId = useId();
|
|
840
|
-
const effectiveRows =
|
|
841
|
-
() => rows && rows.length > 0 ? applyCodexOnlyRows(rows, codexOnly) : [],
|
|
842
|
-
[rows, codexOnly]
|
|
587
|
+
const effectiveRows = useMemo2(
|
|
588
|
+
() => rows && rows.length > 0 ? applyCodexOnlyRows(t, rows, codexOnly) : [],
|
|
589
|
+
[rows, codexOnly, t]
|
|
843
590
|
);
|
|
844
|
-
const billingGroups =
|
|
845
|
-
() => effectiveRows.length > 0 ? groupPickerRowsByBillingClass(effectiveRows) : [],
|
|
846
|
-
[effectiveRows]
|
|
591
|
+
const billingGroups = useMemo2(
|
|
592
|
+
() => effectiveRows.length > 0 ? groupPickerRowsByBillingClass(t, effectiveRows, { codexOnly, selectedId: value }) : [],
|
|
593
|
+
[effectiveRows, codexOnly, value, t]
|
|
847
594
|
);
|
|
848
|
-
const providerGroupList =
|
|
595
|
+
const providerGroupList = useMemo2(() => providerGroups(models, codexOnly), [models, codexOnly]);
|
|
849
596
|
const useBillingGroups = Boolean(effectiveRows.length);
|
|
850
597
|
if (models.length === 0 && effectiveRows.length === 0) {
|
|
851
598
|
return null;
|
|
852
599
|
}
|
|
853
|
-
return /* @__PURE__ */
|
|
854
|
-
/* @__PURE__ */
|
|
855
|
-
/* @__PURE__ */
|
|
600
|
+
return /* @__PURE__ */ jsxs2("span", { className: cn("relative inline-flex items-center", className), children: [
|
|
601
|
+
/* @__PURE__ */ jsx2("label", { htmlFor: selectId, className: "sr-only", children: label }),
|
|
602
|
+
/* @__PURE__ */ jsx2(
|
|
856
603
|
"select",
|
|
857
604
|
{
|
|
858
605
|
id: selectId,
|
|
@@ -867,10 +614,10 @@ function ModelPicker({
|
|
|
867
614
|
"focus:outline-hidden focus-visible:outline-hidden",
|
|
868
615
|
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
869
616
|
),
|
|
870
|
-
children: useBillingGroups ? billingGroups.map((group) => /* @__PURE__ */
|
|
617
|
+
children: useBillingGroups ? billingGroups.map((group) => /* @__PURE__ */ jsx2("optgroup", { label: group.label, children: group.rows.map((row) => /* @__PURE__ */ jsx2("option", { value: row.id, disabled: !row.selectable, children: row.unavailableReason ? `${row.label} (${row.unavailableReason})` : row.label }, row.id)) }, group.billingClass)) : providerGroupList.map((group) => /* @__PURE__ */ jsx2("optgroup", { label: group.label, children: group.models.map((model) => /* @__PURE__ */ jsx2("option", { value: model.id, disabled: model.optionDisabled, children: modelDisplayName(model) }, model.id)) }, group.label))
|
|
871
618
|
}
|
|
872
619
|
),
|
|
873
|
-
/* @__PURE__ */
|
|
620
|
+
/* @__PURE__ */ jsx2(
|
|
874
621
|
ChevronDownIcon,
|
|
875
622
|
{
|
|
876
623
|
"aria-hidden": true,
|
|
@@ -891,23 +638,24 @@ import {
|
|
|
891
638
|
PauseIcon,
|
|
892
639
|
PlayIcon,
|
|
893
640
|
RotateCwIcon,
|
|
894
|
-
|
|
641
|
+
SquareIcon,
|
|
642
|
+
XIcon
|
|
895
643
|
} from "lucide-react";
|
|
896
|
-
import { AnimatePresence as
|
|
644
|
+
import { AnimatePresence as AnimatePresence2, motion as motion2 } from "motion/react";
|
|
897
645
|
import {
|
|
898
646
|
cloneElement,
|
|
899
|
-
createContext
|
|
647
|
+
createContext,
|
|
900
648
|
forwardRef,
|
|
901
|
-
useCallback as
|
|
902
|
-
useContext
|
|
903
|
-
useEffect
|
|
649
|
+
useCallback as useCallback2,
|
|
650
|
+
useContext,
|
|
651
|
+
useEffect,
|
|
904
652
|
useId as useId2,
|
|
905
|
-
useLayoutEffect
|
|
906
|
-
useMemo as
|
|
907
|
-
useRef as
|
|
908
|
-
useState as
|
|
653
|
+
useLayoutEffect,
|
|
654
|
+
useMemo as useMemo3,
|
|
655
|
+
useRef as useRef2,
|
|
656
|
+
useState as useState2
|
|
909
657
|
} from "react";
|
|
910
|
-
import { Fragment
|
|
658
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
911
659
|
function ComposerTip({
|
|
912
660
|
tip,
|
|
913
661
|
children
|
|
@@ -915,73 +663,6 @@ function ComposerTip({
|
|
|
915
663
|
if (!tip) return children;
|
|
916
664
|
return cloneElement(children, { title: tip });
|
|
917
665
|
}
|
|
918
|
-
var defaultChatComposerMessages = {
|
|
919
|
-
messagePlaceholder: "Message the agent\u2026",
|
|
920
|
-
pausedPlaceholder: "Message the agent \u2014 it will wait in the queue\u2026",
|
|
921
|
-
inputLabel: "Message the agent",
|
|
922
|
-
keyboardHint: "Enter to queue \xB7 Cmd/Ctrl+Enter to steer \xB7 Shift+Enter for a new line",
|
|
923
|
-
slashCommandBlocked: "That's a slash command \u2014 press Enter in the command list to run it, or edit the line to send a message.",
|
|
924
|
-
controlChangedError: "This workstream was paused while you were sending. Nothing was sent, and your draft is still here.",
|
|
925
|
-
sendFailedError: "Sending failed \u2014 your draft is still here. Try again.",
|
|
926
|
-
dropFiles: "Drop files to attach",
|
|
927
|
-
attachFiles: "Attach files",
|
|
928
|
-
pauseAriaLabel: "Pause this workstream",
|
|
929
|
-
pauseTitle: "Pause this workstream; queued prompts and approvals are preserved",
|
|
930
|
-
sendMessageAriaLabel: "Send message",
|
|
931
|
-
sendAndResumeAriaLabel: "Add message to queue",
|
|
932
|
-
sendTitle: "Queue message (Enter); steer with Cmd/Ctrl+Enter",
|
|
933
|
-
sendAndResumeTitle: "Add to queue (Enter); steer now with Cmd/Ctrl+Enter",
|
|
934
|
-
annotationNotesRequired: "Add a note to each quote before sending.",
|
|
935
|
-
workspacePaused: "Workspace paused",
|
|
936
|
-
pausedHere: "Paused here",
|
|
937
|
-
parentBlocker: "parent",
|
|
938
|
-
narrowerPause: "a narrower pause",
|
|
939
|
-
pausedBy: (displayName) => `Paused by ${displayName}`,
|
|
940
|
-
queuedAhead: (count) => `${count} waiting prompt${count === 1 ? "" : "s"}; your message joins the queue.`,
|
|
941
|
-
resumingAndSending: "Sending\u2026",
|
|
942
|
-
nextMessageResumes: "Messages wait in the queue until you resume.",
|
|
943
|
-
resumeThisWorkstream: "Resume this workstream",
|
|
944
|
-
resumeShort: "Resume",
|
|
945
|
-
hidePauseDetails: "Hide pause details",
|
|
946
|
-
showPauseDetails: "Show pause details",
|
|
947
|
-
pauseReasonsLabel: "Reasons this workstream is paused",
|
|
948
|
-
pausedByLabel: "Paused by ",
|
|
949
|
-
alsoPausedByLabel: "Also paused by ",
|
|
950
|
-
resumeWorkspace: "Resume workspace",
|
|
951
|
-
resumeFromSession: "Resume from this session",
|
|
952
|
-
sessionCanRun: "This session will be able to run",
|
|
953
|
-
stillPausedBy: (displayName) => `Still paused by ${displayName}`,
|
|
954
|
-
restoredResourcesLabel: "Restored prompt resources",
|
|
955
|
-
restoredFile: (fileId) => `File ${fileId.slice(0, 8)}`,
|
|
956
|
-
removeRestoredResource: (index) => `Remove restored resource ${index + 1}`,
|
|
957
|
-
uploading: "Uploading",
|
|
958
|
-
uploadFailed: "Upload failed",
|
|
959
|
-
previewAttachment: (name) => `Preview ${name}`,
|
|
960
|
-
previewUnavailable: "Preview unavailable",
|
|
961
|
-
attachmentPreviewLabel: "Attachment preview",
|
|
962
|
-
downloadAttachment: (name) => `Download ${name}`,
|
|
963
|
-
closeAttachmentPreview: "Close",
|
|
964
|
-
retryAttachment: (name) => `Retry ${name}`,
|
|
965
|
-
retryUpload: "Retry upload",
|
|
966
|
-
removeAttachment: (name) => `Remove ${name}`,
|
|
967
|
-
confirmCommand: (name) => `Confirm /${name}`,
|
|
968
|
-
confirmDescription: (command) => `Run /${command.name}? ${command.description}`,
|
|
969
|
-
cancel: "Cancel",
|
|
970
|
-
runCommand: (name) => `Run /${name}`,
|
|
971
|
-
commands: "Commands",
|
|
972
|
-
slashCommandsLabel: "Slash commands",
|
|
973
|
-
modelLabel: "Model",
|
|
974
|
-
close: "Close",
|
|
975
|
-
danger: "danger",
|
|
976
|
-
draftConflict: "This draft changed in another tab. Your local draft is still here.",
|
|
977
|
-
useOtherDraft: "Use other draft",
|
|
978
|
-
keepMine: "Keep mine",
|
|
979
|
-
// Kept for embedder message overrides / back-compat. Routine autosave is
|
|
980
|
-
// silent — only draft conflicts surface under the composer.
|
|
981
|
-
savingDraft: "Saving draft\u2026",
|
|
982
|
-
formatBytes,
|
|
983
|
-
formatRelativeTime
|
|
984
|
-
};
|
|
985
666
|
var composerHeightMirror = null;
|
|
986
667
|
function measureComposerContentHeight(textarea) {
|
|
987
668
|
if (typeof document === "undefined") {
|
|
@@ -1050,40 +731,51 @@ function useChatComposerController({
|
|
|
1050
731
|
controlLinks,
|
|
1051
732
|
disabled = false,
|
|
1052
733
|
attachments,
|
|
1053
|
-
commands
|
|
734
|
+
commands: commandsProp,
|
|
1054
735
|
commandContext,
|
|
1055
736
|
onClearView,
|
|
1056
737
|
onPaste,
|
|
1057
|
-
messages: messageOverrides
|
|
738
|
+
messages: messageOverrides,
|
|
739
|
+
runControl = "pause",
|
|
740
|
+
running = false
|
|
1058
741
|
}) {
|
|
1059
|
-
const
|
|
1060
|
-
|
|
1061
|
-
|
|
742
|
+
const t = useOpenGeniText();
|
|
743
|
+
const commands = useMemo3(() => commandsProp ?? defaultCommands(t), [commandsProp, t]);
|
|
744
|
+
const formatError = useErrorMessage();
|
|
745
|
+
const messages = useMemo3(
|
|
746
|
+
() => ({ ...defaultChatComposerMessages(t), ...messageOverrides }),
|
|
747
|
+
[messageOverrides, t]
|
|
1062
748
|
);
|
|
1063
749
|
const id = useId2();
|
|
1064
|
-
const rootRef =
|
|
1065
|
-
const textareaRef =
|
|
1066
|
-
const pauseButtonRef =
|
|
1067
|
-
const fileInputRef =
|
|
750
|
+
const rootRef = useRef2(null);
|
|
751
|
+
const textareaRef = useRef2(null);
|
|
752
|
+
const pauseButtonRef = useRef2(null);
|
|
753
|
+
const fileInputRef = useRef2(null);
|
|
1068
754
|
const listboxId = useId2();
|
|
1069
|
-
const
|
|
1070
|
-
const [
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
const
|
|
755
|
+
const controlPaused = effectiveControl?.state === "paused";
|
|
756
|
+
const [stoppedHere, setStoppedHere] = useState2(false);
|
|
757
|
+
useEffect(() => {
|
|
758
|
+
if (!controlPaused) setStoppedHere(false);
|
|
759
|
+
}, [controlPaused]);
|
|
760
|
+
const resumesOnSend = runControl === "stop" && stoppedHere && controlPaused && effectiveControl?.directState === "paused" && effectiveControl.additionalBlockerCount === 0 && queuedAheadCount === 0;
|
|
761
|
+
const paused = controlPaused && !resumesOnSend;
|
|
762
|
+
const [controlDetailsOpen, setControlDetailsOpen] = useState2(false);
|
|
763
|
+
const [paletteMounted, setPaletteMounted] = useState2(false);
|
|
764
|
+
const [submitting, setSubmitting] = useState2(false);
|
|
765
|
+
const submittingRef = useRef2(false);
|
|
766
|
+
const controlOperationRef = useRef2(false);
|
|
1075
767
|
const deliveryValue = delivery.value;
|
|
1076
768
|
const setDeliveryValue = delivery.setValue;
|
|
1077
|
-
const mountedRef =
|
|
1078
|
-
const deliveredValueRef =
|
|
1079
|
-
const liveValueRef =
|
|
1080
|
-
const [renderedValue, setRenderedValue] =
|
|
769
|
+
const mountedRef = useRef2(true);
|
|
770
|
+
const deliveredValueRef = useRef2(deliveryValue);
|
|
771
|
+
const liveValueRef = useRef2(deliveryValue);
|
|
772
|
+
const [renderedValue, setRenderedValue] = useState2(deliveryValue);
|
|
1081
773
|
const deliveryChanged = deliveryValue !== deliveredValueRef.current;
|
|
1082
774
|
if (deliveryChanged) {
|
|
1083
775
|
deliveredValueRef.current = deliveryValue;
|
|
1084
776
|
liveValueRef.current = deliveryValue;
|
|
1085
777
|
}
|
|
1086
|
-
const setComposerValue =
|
|
778
|
+
const setComposerValue = useCallback2(
|
|
1087
779
|
(next) => {
|
|
1088
780
|
liveValueRef.current = next;
|
|
1089
781
|
setRenderedValue(next);
|
|
@@ -1092,18 +784,18 @@ function useChatComposerController({
|
|
|
1092
784
|
[setDeliveryValue]
|
|
1093
785
|
);
|
|
1094
786
|
const visibleValue = deliveryChanged ? deliveryValue : renderedValue;
|
|
1095
|
-
|
|
787
|
+
useLayoutEffect(() => {
|
|
1096
788
|
if (renderedValue !== liveValueRef.current) {
|
|
1097
789
|
setRenderedValue(liveValueRef.current);
|
|
1098
790
|
}
|
|
1099
791
|
}, [deliveryValue, renderedValue]);
|
|
1100
|
-
|
|
792
|
+
useEffect(() => {
|
|
1101
793
|
mountedRef.current = true;
|
|
1102
794
|
return () => {
|
|
1103
795
|
mountedRef.current = false;
|
|
1104
796
|
};
|
|
1105
797
|
}, []);
|
|
1106
|
-
|
|
798
|
+
useEffect(() => {
|
|
1107
799
|
const openControl = (event) => {
|
|
1108
800
|
const requestedId = event instanceof CustomEvent && isRecord(event.detail) && typeof event.detail.composerId === "string" ? event.detail.composerId : null;
|
|
1109
801
|
if (requestedId && requestedId !== id) return;
|
|
@@ -1122,18 +814,17 @@ function useChatComposerController({
|
|
|
1122
814
|
return () => document.removeEventListener(OPEN_WORKSTREAM_CONTROL_EVENT, openControl);
|
|
1123
815
|
}, [id, paused]);
|
|
1124
816
|
const blockedByAttachment = attachments?.hasUnresolved === true;
|
|
1125
|
-
const
|
|
1126
|
-
const [dragging, setDragging] = useState4(false);
|
|
817
|
+
const [dragging, setDragging] = useState2(false);
|
|
1127
818
|
const dragCarriesFiles = (event) => event.dataTransfer !== null && [...event.dataTransfer.types].includes("Files");
|
|
1128
|
-
const handleDragOver =
|
|
819
|
+
const handleDragOver = useCallback2(
|
|
1129
820
|
(event) => {
|
|
1130
821
|
if (!attachments || !dragCarriesFiles(event)) return;
|
|
1131
822
|
event.preventDefault();
|
|
1132
|
-
setDragging(true);
|
|
823
|
+
if (!disabled) setDragging(true);
|
|
1133
824
|
},
|
|
1134
|
-
[attachments]
|
|
825
|
+
[attachments, disabled]
|
|
1135
826
|
);
|
|
1136
|
-
const handleDragLeave =
|
|
827
|
+
const handleDragLeave = useCallback2(
|
|
1137
828
|
(event) => {
|
|
1138
829
|
if (!attachments) return;
|
|
1139
830
|
if (event.currentTarget.contains(event.relatedTarget)) return;
|
|
@@ -1141,34 +832,38 @@ function useChatComposerController({
|
|
|
1141
832
|
},
|
|
1142
833
|
[attachments]
|
|
1143
834
|
);
|
|
1144
|
-
const handleDrop =
|
|
835
|
+
const handleDrop = useCallback2(
|
|
1145
836
|
(event) => {
|
|
1146
837
|
if (!attachments || !dragCarriesFiles(event)) return;
|
|
1147
838
|
event.preventDefault();
|
|
1148
839
|
setDragging(false);
|
|
1149
|
-
if (event.dataTransfer.files.length > 0)
|
|
840
|
+
if (!disabled && event.dataTransfer.files.length > 0)
|
|
841
|
+
attachments.addFiles(event.dataTransfer.files);
|
|
1150
842
|
},
|
|
1151
|
-
[attachments]
|
|
843
|
+
[attachments, disabled]
|
|
1152
844
|
);
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
const
|
|
1157
|
-
const
|
|
845
|
+
useEffect(() => {
|
|
846
|
+
if (disabled) setDragging(false);
|
|
847
|
+
}, [disabled]);
|
|
848
|
+
const [notice, setNotice] = useState2(null);
|
|
849
|
+
const [helpOpen, setHelpOpen] = useState2(false);
|
|
850
|
+
const [confirmState, setConfirmState] = useState2(null);
|
|
851
|
+
const pendingConfirm = useRef2(null);
|
|
852
|
+
const settleConfirmation = useCallback2((confirmed) => {
|
|
1158
853
|
const resolve = pendingConfirm.current;
|
|
1159
854
|
pendingConfirm.current = null;
|
|
1160
855
|
setConfirmState(null);
|
|
1161
856
|
resolve?.(confirmed);
|
|
1162
857
|
}, []);
|
|
1163
|
-
|
|
858
|
+
useEffect(
|
|
1164
859
|
() => () => {
|
|
1165
860
|
pendingConfirm.current?.(false);
|
|
1166
861
|
pendingConfirm.current = null;
|
|
1167
862
|
},
|
|
1168
863
|
[]
|
|
1169
864
|
);
|
|
1170
|
-
const resizeInputRafRef =
|
|
1171
|
-
const resizeInput =
|
|
865
|
+
const resizeInputRafRef = useRef2(null);
|
|
866
|
+
const resizeInput = useCallback2(() => {
|
|
1172
867
|
if (resizeInputRafRef.current !== null) {
|
|
1173
868
|
return;
|
|
1174
869
|
}
|
|
@@ -1181,8 +876,8 @@ function useChatComposerController({
|
|
|
1181
876
|
applyComposerTextareaHeight(textarea, 220);
|
|
1182
877
|
});
|
|
1183
878
|
}, []);
|
|
1184
|
-
|
|
1185
|
-
|
|
879
|
+
useEffect(() => resizeInput(), [resizeInput, visibleValue]);
|
|
880
|
+
useEffect(
|
|
1186
881
|
() => () => {
|
|
1187
882
|
if (resizeInputRafRef.current !== null) {
|
|
1188
883
|
cancelAnimationFrame(resizeInputRafRef.current);
|
|
@@ -1191,7 +886,7 @@ function useChatComposerController({
|
|
|
1191
886
|
},
|
|
1192
887
|
[]
|
|
1193
888
|
);
|
|
1194
|
-
const handlers =
|
|
889
|
+
const handlers = useMemo3(
|
|
1195
890
|
() => ({
|
|
1196
891
|
notice: (next) => {
|
|
1197
892
|
setNotice(next);
|
|
@@ -1223,9 +918,9 @@ function useChatComposerController({
|
|
|
1223
918
|
const annotationsIncomplete = (delivery.annotations ?? []).some(
|
|
1224
919
|
(annotation) => annotation.note.trim().length === 0
|
|
1225
920
|
);
|
|
1226
|
-
const submitBlocker = disabled ? "disabled" : blockedByAttachment ? "attachment" : delivery.sending || submitting ? "sending" : commandDraftBlocked ? "command" : annotationsIncomplete ? "annotations" : delivery.canSend
|
|
921
|
+
const submitBlocker = disabled ? "disabled" : blockedByAttachment ? "attachment" : delivery.sending || submitting ? "sending" : commandDraftBlocked ? "command" : annotationsIncomplete ? "annotations" : delivery.canSend ? null : "empty";
|
|
1227
922
|
const canSubmit = submitBlocker === null;
|
|
1228
|
-
const submit =
|
|
923
|
+
const submit = useCallback2(
|
|
1229
924
|
async (mode) => {
|
|
1230
925
|
if (commandDraftBlocked) {
|
|
1231
926
|
setNotice({ tone: "error", message: messages.slashCommandBlocked });
|
|
@@ -1240,11 +935,11 @@ function useChatComposerController({
|
|
|
1240
935
|
delivery.requestAnnotationReview?.();
|
|
1241
936
|
return false;
|
|
1242
937
|
}
|
|
1243
|
-
if (!delivery.canSend
|
|
938
|
+
if (!delivery.canSend) return false;
|
|
1244
939
|
submittingRef.current = true;
|
|
1245
940
|
setSubmitting(true);
|
|
1246
941
|
try {
|
|
1247
|
-
return mode === "steer" ? await delivery.steer() : await delivery.send();
|
|
942
|
+
return mode === "steer" || resumesOnSend ? await delivery.steer() : await delivery.send();
|
|
1248
943
|
} finally {
|
|
1249
944
|
submittingRef.current = false;
|
|
1250
945
|
if (mountedRef.current) setSubmitting(false);
|
|
@@ -1256,12 +951,12 @@ function useChatComposerController({
|
|
|
1256
951
|
commandDraftBlocked,
|
|
1257
952
|
delivery,
|
|
1258
953
|
disabled,
|
|
1259
|
-
hasReadyAttachment,
|
|
1260
954
|
messages.annotationNotesRequired,
|
|
1261
|
-
messages.slashCommandBlocked
|
|
955
|
+
messages.slashCommandBlocked,
|
|
956
|
+
resumesOnSend
|
|
1262
957
|
]
|
|
1263
958
|
);
|
|
1264
|
-
const handleKeyDown =
|
|
959
|
+
const handleKeyDown = useCallback2(
|
|
1265
960
|
(event) => {
|
|
1266
961
|
if (paletteEnabled && paletteMounted && palette.onKeyDown(event)) return;
|
|
1267
962
|
if (!shouldSubmitOnKey(event)) return;
|
|
@@ -1270,21 +965,22 @@ function useChatComposerController({
|
|
|
1270
965
|
},
|
|
1271
966
|
[palette, paletteEnabled, paletteMounted, submit]
|
|
1272
967
|
);
|
|
1273
|
-
const handlePaste =
|
|
968
|
+
const handlePaste = useCallback2(
|
|
1274
969
|
(event) => {
|
|
970
|
+
if (disabled) return;
|
|
1275
971
|
onPaste?.(event);
|
|
1276
972
|
attachments?.addFromPaste(event);
|
|
1277
973
|
},
|
|
1278
|
-
[attachments, onPaste]
|
|
974
|
+
[attachments, disabled, onPaste]
|
|
1279
975
|
);
|
|
1280
|
-
const handleFileChange =
|
|
976
|
+
const handleFileChange = useCallback2(
|
|
1281
977
|
(event) => {
|
|
1282
|
-
if (event.target.files) attachments?.addFiles(event.target.files);
|
|
978
|
+
if (!disabled && event.target.files) attachments?.addFiles(event.target.files);
|
|
1283
979
|
event.target.value = "";
|
|
1284
980
|
},
|
|
1285
|
-
[attachments]
|
|
981
|
+
[attachments, disabled]
|
|
1286
982
|
);
|
|
1287
|
-
const helpCommands =
|
|
983
|
+
const helpCommands = useMemo3(
|
|
1288
984
|
() => commands.filter((command) => {
|
|
1289
985
|
if (command.permission && commandContext) {
|
|
1290
986
|
const permissions = commandContext.permissions;
|
|
@@ -1296,9 +992,12 @@ function useChatComposerController({
|
|
|
1296
992
|
);
|
|
1297
993
|
const activeNotice = notice ?? (delivery.error ? {
|
|
1298
994
|
tone: "error",
|
|
1299
|
-
message: /control changed|paused while/i.test(delivery.error.message) ? messages.controlChangedError :
|
|
995
|
+
message: /control changed|paused while/i.test(delivery.error.message) ? messages.controlChangedError : formatError(
|
|
996
|
+
delivery.error,
|
|
997
|
+
composerSubmissionErrorMessage(t, delivery.error) || messages.sendFailedError
|
|
998
|
+
)
|
|
1300
999
|
} : null);
|
|
1301
|
-
|
|
1000
|
+
useEffect(() => {
|
|
1302
1001
|
if (notice?.tone !== "ok") return;
|
|
1303
1002
|
const timer = window.setTimeout(
|
|
1304
1003
|
() => setNotice((current) => current === notice ? null : current),
|
|
@@ -1306,13 +1005,13 @@ function useChatComposerController({
|
|
|
1306
1005
|
);
|
|
1307
1006
|
return () => window.clearTimeout(timer);
|
|
1308
1007
|
}, [notice]);
|
|
1309
|
-
|
|
1008
|
+
useEffect(() => {
|
|
1310
1009
|
if (annotationsIncomplete) return;
|
|
1311
1010
|
setNotice(
|
|
1312
1011
|
(current) => current?.message === messages.annotationNotesRequired ? null : current
|
|
1313
1012
|
);
|
|
1314
1013
|
}, [annotationsIncomplete, messages.annotationNotesRequired]);
|
|
1315
|
-
const runControlOperation =
|
|
1014
|
+
const runControlOperation = useCallback2(async (operation) => {
|
|
1316
1015
|
if (controlOperationRef.current) return false;
|
|
1317
1016
|
controlOperationRef.current = true;
|
|
1318
1017
|
try {
|
|
@@ -1322,27 +1021,32 @@ function useChatComposerController({
|
|
|
1322
1021
|
controlOperationRef.current = false;
|
|
1323
1022
|
}
|
|
1324
1023
|
}, []);
|
|
1325
|
-
const pause =
|
|
1024
|
+
const pause = useCallback2(
|
|
1326
1025
|
async (reason) => {
|
|
1327
1026
|
if (!control || control.pausing || control.resuming) return false;
|
|
1328
1027
|
return await runControlOperation(() => control.pause(reason));
|
|
1329
1028
|
},
|
|
1330
1029
|
[control, runControlOperation]
|
|
1331
1030
|
);
|
|
1332
|
-
const resume =
|
|
1031
|
+
const resume = useCallback2(
|
|
1333
1032
|
async (reason) => {
|
|
1334
1033
|
if (!control || control.pausing || control.resuming) return false;
|
|
1335
1034
|
return await runControlOperation(() => control.resume(reason));
|
|
1336
1035
|
},
|
|
1337
1036
|
[control, runControlOperation]
|
|
1338
1037
|
);
|
|
1339
|
-
const resumeScope =
|
|
1038
|
+
const resumeScope = useCallback2(
|
|
1340
1039
|
async (option) => {
|
|
1341
1040
|
if (!control || control.pausing || control.resuming) return false;
|
|
1342
1041
|
return await runControlOperation(() => control.resumeScope(option));
|
|
1343
1042
|
},
|
|
1344
1043
|
[control, runControlOperation]
|
|
1345
1044
|
);
|
|
1045
|
+
const stop = useCallback2(async () => {
|
|
1046
|
+
const stopped = await pause();
|
|
1047
|
+
if (stopped && mountedRef.current) setStoppedHere(true);
|
|
1048
|
+
return stopped;
|
|
1049
|
+
}, [pause]);
|
|
1346
1050
|
return {
|
|
1347
1051
|
id,
|
|
1348
1052
|
rootRef,
|
|
@@ -1367,9 +1071,12 @@ function useChatComposerController({
|
|
|
1367
1071
|
removeRestoredResource: draft?.removeRestoredResource,
|
|
1368
1072
|
resolveDraftConflict: draft?.resolveDraftConflict,
|
|
1369
1073
|
hasControl: control !== void 0,
|
|
1074
|
+
runControl,
|
|
1075
|
+
running,
|
|
1370
1076
|
pausing: control?.pausing ?? false,
|
|
1371
1077
|
resuming: control?.resuming ?? false,
|
|
1372
1078
|
pause,
|
|
1079
|
+
stop,
|
|
1373
1080
|
resume,
|
|
1374
1081
|
resumeScope,
|
|
1375
1082
|
paused,
|
|
@@ -1401,9 +1108,9 @@ function useChatComposerController({
|
|
|
1401
1108
|
value: visibleValue
|
|
1402
1109
|
};
|
|
1403
1110
|
}
|
|
1404
|
-
var ComposerContext =
|
|
1111
|
+
var ComposerContext = createContext(null);
|
|
1405
1112
|
function useComposerController() {
|
|
1406
|
-
const controller =
|
|
1113
|
+
const controller = useContext(ComposerContext);
|
|
1407
1114
|
if (!controller) throw new Error("useChatComposer must be used inside <Composer.Root>");
|
|
1408
1115
|
return controller;
|
|
1409
1116
|
}
|
|
@@ -1414,12 +1121,12 @@ function isRecord(value) {
|
|
|
1414
1121
|
return typeof value === "object" && value !== null;
|
|
1415
1122
|
}
|
|
1416
1123
|
var Root = forwardRef(function ComposerRoot({ controller, children, className, style, responsiveBasis = "viewport", ...props }, forwardedRef) {
|
|
1417
|
-
const responsiveRootRef =
|
|
1418
|
-
const responsiveContext =
|
|
1124
|
+
const responsiveRootRef = useRef2(null);
|
|
1125
|
+
const responsiveContext = useMemo3(
|
|
1419
1126
|
() => ({ responsiveBasis, rootRef: responsiveRootRef }),
|
|
1420
1127
|
[responsiveBasis]
|
|
1421
1128
|
);
|
|
1422
|
-
return /* @__PURE__ */
|
|
1129
|
+
return /* @__PURE__ */ jsx3(ComposerContext.Provider, { value: controller, children: /* @__PURE__ */ jsx3(ComposerResponsiveContext.Provider, { value: responsiveContext, children: /* @__PURE__ */ jsx3(TooltipProvider, { delayDuration: 300, children: /* @__PURE__ */ jsxs3(
|
|
1423
1130
|
"div",
|
|
1424
1131
|
{
|
|
1425
1132
|
...props,
|
|
@@ -1430,23 +1137,23 @@ var Root = forwardRef(function ComposerRoot({ controller, children, className, s
|
|
|
1430
1137
|
style: { paddingBottom: "env(safe-area-inset-bottom)", ...style },
|
|
1431
1138
|
children: [
|
|
1432
1139
|
children,
|
|
1433
|
-
/* @__PURE__ */
|
|
1140
|
+
/* @__PURE__ */ jsx3(ComposerAnnouncements, {})
|
|
1434
1141
|
]
|
|
1435
1142
|
}
|
|
1436
1143
|
) }) }) });
|
|
1437
1144
|
});
|
|
1438
1145
|
var Frame = forwardRef(function ComposerFrame({ className, ...props }, ref) {
|
|
1439
|
-
return /* @__PURE__ */
|
|
1146
|
+
return /* @__PURE__ */ jsx3("div", { ...props, ref, className: cn("relative", className) });
|
|
1440
1147
|
});
|
|
1441
1148
|
function CommandPalette2({ className }) {
|
|
1442
1149
|
const controller = useComposerController();
|
|
1443
1150
|
const setPaletteMounted = controller.setPaletteMounted;
|
|
1444
|
-
|
|
1151
|
+
useEffect(() => {
|
|
1445
1152
|
setPaletteMounted(true);
|
|
1446
1153
|
return () => setPaletteMounted(false);
|
|
1447
1154
|
}, [setPaletteMounted]);
|
|
1448
1155
|
if (!controller.paletteEnabled) return null;
|
|
1449
|
-
return /* @__PURE__ */
|
|
1156
|
+
return /* @__PURE__ */ jsx3("div", { className, children: /* @__PURE__ */ jsx3(
|
|
1450
1157
|
CommandPalette,
|
|
1451
1158
|
{
|
|
1452
1159
|
open: controller.palette.open && controller.confirmState === null,
|
|
@@ -1466,9 +1173,10 @@ function CommandPalette2({ className }) {
|
|
|
1466
1173
|
}
|
|
1467
1174
|
var Surface = forwardRef(function ComposerSurface({ className, children, ...props }, ref) {
|
|
1468
1175
|
const controller = useComposerController();
|
|
1469
|
-
return /* @__PURE__ */
|
|
1176
|
+
return /* @__PURE__ */ jsxs3(
|
|
1470
1177
|
"div",
|
|
1471
1178
|
{
|
|
1179
|
+
"data-og-composer-surface": "",
|
|
1472
1180
|
...props,
|
|
1473
1181
|
ref,
|
|
1474
1182
|
onDragOver: controller.attachments ? controller.handleDragOver : void 0,
|
|
@@ -1482,7 +1190,7 @@ var Surface = forwardRef(function ComposerSurface({ className, children, ...prop
|
|
|
1482
1190
|
className
|
|
1483
1191
|
),
|
|
1484
1192
|
children: [
|
|
1485
|
-
controller.dragging ? /* @__PURE__ */
|
|
1193
|
+
controller.dragging ? /* @__PURE__ */ jsx3(
|
|
1486
1194
|
"div",
|
|
1487
1195
|
{
|
|
1488
1196
|
"aria-hidden": true,
|
|
@@ -1490,8 +1198,8 @@ var Surface = forwardRef(function ComposerSurface({ className, children, ...prop
|
|
|
1490
1198
|
"pointer-events-none absolute inset-0 z-10 flex items-center justify-center",
|
|
1491
1199
|
"rounded-og-lg bg-og-surface-1/85 text-og-menu font-medium text-og-accent backdrop-blur-[1px]"
|
|
1492
1200
|
),
|
|
1493
|
-
children: /* @__PURE__ */
|
|
1494
|
-
/* @__PURE__ */
|
|
1201
|
+
children: /* @__PURE__ */ jsxs3("span", { className: "inline-flex items-center gap-2", children: [
|
|
1202
|
+
/* @__PURE__ */ jsx3(PaperclipIcon, { className: "size-4" }),
|
|
1495
1203
|
controller.messages.dropFiles
|
|
1496
1204
|
] })
|
|
1497
1205
|
}
|
|
@@ -1504,7 +1212,7 @@ var Surface = forwardRef(function ComposerSurface({ className, children, ...prop
|
|
|
1504
1212
|
function PausedState() {
|
|
1505
1213
|
const controller = useComposerController();
|
|
1506
1214
|
if (!controller.paused || !controller.effectiveControl || !controller.hasControl) return null;
|
|
1507
|
-
return /* @__PURE__ */
|
|
1215
|
+
return /* @__PURE__ */ jsx3(
|
|
1508
1216
|
WorkstreamPausedStrip,
|
|
1509
1217
|
{
|
|
1510
1218
|
control: controller.effectiveControl,
|
|
@@ -1524,7 +1232,7 @@ function PausedState() {
|
|
|
1524
1232
|
function RestoredResources() {
|
|
1525
1233
|
const controller = useComposerController();
|
|
1526
1234
|
if (controller.restoredResources.length === 0 || !controller.removeRestoredResource) return null;
|
|
1527
|
-
return /* @__PURE__ */
|
|
1235
|
+
return /* @__PURE__ */ jsx3(
|
|
1528
1236
|
RestoredResourceChips,
|
|
1529
1237
|
{
|
|
1530
1238
|
resources: controller.restoredResources,
|
|
@@ -1536,11 +1244,12 @@ function RestoredResources() {
|
|
|
1536
1244
|
function Attachments() {
|
|
1537
1245
|
const controller = useComposerController();
|
|
1538
1246
|
if (!controller.attachments || controller.attachments.attachments.length === 0) return null;
|
|
1539
|
-
return /* @__PURE__ */
|
|
1247
|
+
return /* @__PURE__ */ jsx3(
|
|
1540
1248
|
AttachmentChips,
|
|
1541
1249
|
{
|
|
1542
1250
|
attachments: controller.attachments.attachments,
|
|
1543
1251
|
messages: controller.messages,
|
|
1252
|
+
disabled: controller.disabled,
|
|
1544
1253
|
onRemove: controller.attachments.remove,
|
|
1545
1254
|
onRetry: controller.attachments.retry,
|
|
1546
1255
|
onRetainPreview: controller.attachments.retainPreview,
|
|
@@ -1548,21 +1257,52 @@ function Attachments() {
|
|
|
1548
1257
|
}
|
|
1549
1258
|
);
|
|
1550
1259
|
}
|
|
1260
|
+
var EDITING_FOCUS_SELECTOR = 'input, textarea, select, [contenteditable="true"], [role="textbox"]';
|
|
1261
|
+
var POPUP_FOCUS_SELECTOR = '[role="menu"], [role="menubar"], [role="listbox"], [role="dialog"], [role="alertdialog"]';
|
|
1262
|
+
function focusBelongsElsewhere(textarea) {
|
|
1263
|
+
const active = textarea.ownerDocument.activeElement;
|
|
1264
|
+
if (!active || active === textarea) return false;
|
|
1265
|
+
if (active.closest(EDITING_FOCUS_SELECTOR)) return true;
|
|
1266
|
+
const popup = active.closest(POPUP_FOCUS_SELECTOR);
|
|
1267
|
+
if (popup) return !popup.contains(textarea);
|
|
1268
|
+
return active !== textarea.ownerDocument.body && active !== textarea.ownerDocument.documentElement;
|
|
1269
|
+
}
|
|
1551
1270
|
var Input = forwardRef(function ComposerInput({ rows = 1, placeholder, className, "aria-label": ariaLabel, autoFocus = false, ...props }, forwardedRef) {
|
|
1552
1271
|
const controller = useComposerController();
|
|
1553
|
-
const autoFocusedRef =
|
|
1272
|
+
const autoFocusedRef = useRef2(false);
|
|
1554
1273
|
const paletteOpen = controller.paletteEnabled && controller.paletteMounted && controller.palette.open;
|
|
1555
|
-
|
|
1274
|
+
useEffect(() => {
|
|
1556
1275
|
if (!autoFocus || controller.disabled || autoFocusedRef.current) return;
|
|
1557
1276
|
const frame = window.requestAnimationFrame(() => {
|
|
1558
1277
|
const textarea = controller.textareaRef.current;
|
|
1559
1278
|
if (!textarea || textarea.disabled) return;
|
|
1560
1279
|
autoFocusedRef.current = true;
|
|
1280
|
+
if (focusBelongsElsewhere(textarea)) return;
|
|
1561
1281
|
textarea.focus();
|
|
1562
1282
|
});
|
|
1563
1283
|
return () => window.cancelAnimationFrame(frame);
|
|
1564
1284
|
}, [autoFocus, controller.disabled, controller.textareaRef]);
|
|
1565
|
-
|
|
1285
|
+
useEffect(() => {
|
|
1286
|
+
const textarea = controller.textareaRef.current;
|
|
1287
|
+
if (!textarea || typeof ResizeObserver === "undefined") return;
|
|
1288
|
+
let width = textarea.clientWidth;
|
|
1289
|
+
let frame = null;
|
|
1290
|
+
const observer = new ResizeObserver(() => {
|
|
1291
|
+
if (textarea.clientWidth === width) return;
|
|
1292
|
+
width = textarea.clientWidth;
|
|
1293
|
+
if (frame !== null) return;
|
|
1294
|
+
frame = window.requestAnimationFrame(() => {
|
|
1295
|
+
frame = null;
|
|
1296
|
+
applyComposerTextareaHeight(textarea, 220);
|
|
1297
|
+
});
|
|
1298
|
+
});
|
|
1299
|
+
observer.observe(textarea);
|
|
1300
|
+
return () => {
|
|
1301
|
+
observer.disconnect();
|
|
1302
|
+
if (frame !== null) window.cancelAnimationFrame(frame);
|
|
1303
|
+
};
|
|
1304
|
+
}, [controller.textareaRef]);
|
|
1305
|
+
return /* @__PURE__ */ jsx3(
|
|
1566
1306
|
"textarea",
|
|
1567
1307
|
{
|
|
1568
1308
|
...props,
|
|
@@ -1574,7 +1314,6 @@ var Input = forwardRef(function ComposerInput({ rows = 1, placeholder, className
|
|
|
1574
1314
|
onPaste: controller.handlePaste,
|
|
1575
1315
|
placeholder: controller.paused && !controller.disabled ? controller.messages.pausedPlaceholder : placeholder ?? controller.messages.messagePlaceholder,
|
|
1576
1316
|
disabled: controller.disabled,
|
|
1577
|
-
autoFocus: autoFocus && !controller.disabled,
|
|
1578
1317
|
"aria-label": ariaLabel ?? controller.messages.inputLabel,
|
|
1579
1318
|
"aria-keyshortcuts": "Enter Meta+Enter Control+Enter Shift+Enter",
|
|
1580
1319
|
"aria-autocomplete": controller.paletteEnabled && controller.paletteMounted ? "list" : void 0,
|
|
@@ -1593,7 +1332,7 @@ function Confirmation() {
|
|
|
1593
1332
|
const controller = useComposerController();
|
|
1594
1333
|
const command = controller.confirmState?.command;
|
|
1595
1334
|
if (!command || !controller.confirmState) return null;
|
|
1596
|
-
return /* @__PURE__ */
|
|
1335
|
+
return /* @__PURE__ */ jsx3(
|
|
1597
1336
|
ConfirmBar,
|
|
1598
1337
|
{
|
|
1599
1338
|
command,
|
|
@@ -1605,7 +1344,7 @@ function Confirmation() {
|
|
|
1605
1344
|
);
|
|
1606
1345
|
}
|
|
1607
1346
|
var Footer = forwardRef(function ComposerFooter({ className, ...props }, ref) {
|
|
1608
|
-
return /* @__PURE__ */
|
|
1347
|
+
return /* @__PURE__ */ jsx3(
|
|
1609
1348
|
"div",
|
|
1610
1349
|
{
|
|
1611
1350
|
...props,
|
|
@@ -1621,14 +1360,16 @@ var Footer = forwardRef(function ComposerFooter({ className, ...props }, ref) {
|
|
|
1621
1360
|
});
|
|
1622
1361
|
var Controls = forwardRef(
|
|
1623
1362
|
function ComposerControls({ className, ...props }, ref) {
|
|
1624
|
-
return /* @__PURE__ */
|
|
1363
|
+
return /* @__PURE__ */ jsx3(
|
|
1625
1364
|
"span",
|
|
1626
1365
|
{
|
|
1627
1366
|
...props,
|
|
1628
1367
|
ref,
|
|
1629
1368
|
className: cn(
|
|
1630
1369
|
"og-composer-controls flex min-w-0 flex-1 flex-wrap items-center gap-1.5",
|
|
1631
|
-
|
|
1370
|
+
// Phone: 44px touch targets already space themselves; tight gaps leave
|
|
1371
|
+
// the model pill room for its name.
|
|
1372
|
+
"max-sm:flex-nowrap max-sm:gap-0.5",
|
|
1632
1373
|
className
|
|
1633
1374
|
)
|
|
1634
1375
|
}
|
|
@@ -1637,7 +1378,7 @@ var Controls = forwardRef(
|
|
|
1637
1378
|
);
|
|
1638
1379
|
var Hint = forwardRef(function ComposerHint({ className, children, ...props }, ref) {
|
|
1639
1380
|
const controller = useComposerController();
|
|
1640
|
-
return /* @__PURE__ */
|
|
1381
|
+
return /* @__PURE__ */ jsx3(
|
|
1641
1382
|
"span",
|
|
1642
1383
|
{
|
|
1643
1384
|
...props,
|
|
@@ -1651,14 +1392,14 @@ var Hint = forwardRef(function ComposerHint({ className, children, ...props }, r
|
|
|
1651
1392
|
);
|
|
1652
1393
|
});
|
|
1653
1394
|
var Actions = forwardRef(function ComposerActions({ className, ...props }, ref) {
|
|
1654
|
-
return /* @__PURE__ */
|
|
1395
|
+
return /* @__PURE__ */ jsx3(
|
|
1655
1396
|
"span",
|
|
1656
1397
|
{
|
|
1657
1398
|
...props,
|
|
1658
1399
|
ref,
|
|
1659
1400
|
className: cn(
|
|
1660
1401
|
"og-composer-actions ml-auto flex shrink-0 items-center gap-1.5",
|
|
1661
|
-
"max-sm:flex-nowrap max-sm:gap-
|
|
1402
|
+
"max-sm:flex-nowrap max-sm:gap-0.5",
|
|
1662
1403
|
className
|
|
1663
1404
|
)
|
|
1664
1405
|
}
|
|
@@ -1669,8 +1410,8 @@ var AttachButton = forwardRef(
|
|
|
1669
1410
|
const controller = useComposerController();
|
|
1670
1411
|
if (!controller.attachments) return null;
|
|
1671
1412
|
const tip = title ?? controller.messages.attachFiles;
|
|
1672
|
-
return /* @__PURE__ */
|
|
1673
|
-
/* @__PURE__ */
|
|
1413
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1414
|
+
/* @__PURE__ */ jsx3(
|
|
1674
1415
|
"input",
|
|
1675
1416
|
{
|
|
1676
1417
|
ref: controller.fileInputRef,
|
|
@@ -1682,7 +1423,7 @@ var AttachButton = forwardRef(
|
|
|
1682
1423
|
onChange: controller.handleFileChange
|
|
1683
1424
|
}
|
|
1684
1425
|
),
|
|
1685
|
-
/* @__PURE__ */
|
|
1426
|
+
/* @__PURE__ */ jsx3(ComposerTip, { tip, children: /* @__PURE__ */ jsx3(
|
|
1686
1427
|
"button",
|
|
1687
1428
|
{
|
|
1688
1429
|
...props,
|
|
@@ -1697,7 +1438,7 @@ var AttachButton = forwardRef(
|
|
|
1697
1438
|
"disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:size-11",
|
|
1698
1439
|
className
|
|
1699
1440
|
),
|
|
1700
|
-
children: children ?? /* @__PURE__ */
|
|
1441
|
+
children: children ?? /* @__PURE__ */ jsx3(PaperclipIcon, { className: "size-4" })
|
|
1701
1442
|
}
|
|
1702
1443
|
) })
|
|
1703
1444
|
] });
|
|
@@ -1713,7 +1454,7 @@ function ModelPicker2({
|
|
|
1713
1454
|
codexOnly
|
|
1714
1455
|
}) {
|
|
1715
1456
|
const controller = useComposerController();
|
|
1716
|
-
return /* @__PURE__ */
|
|
1457
|
+
return /* @__PURE__ */ jsx3(
|
|
1717
1458
|
ModelPicker,
|
|
1718
1459
|
{
|
|
1719
1460
|
models,
|
|
@@ -1730,12 +1471,14 @@ function ModelPicker2({
|
|
|
1730
1471
|
var PauseButton = forwardRef(
|
|
1731
1472
|
function ComposerPauseButton({ className, "aria-label": ariaLabel, title, children, ...props }, ref) {
|
|
1732
1473
|
const controller = useComposerController();
|
|
1733
|
-
if (!controller.effectiveControl || controller.paused || !controller.hasControl)
|
|
1474
|
+
if (controller.runControl !== "pause" || !controller.effectiveControl || controller.paused || !controller.hasControl)
|
|
1475
|
+
return null;
|
|
1734
1476
|
const busy = controller.pausing || controller.resuming;
|
|
1735
1477
|
const tip = title ?? controller.messages.pauseTitle;
|
|
1736
|
-
return /* @__PURE__ */
|
|
1478
|
+
return /* @__PURE__ */ jsx3(ComposerTip, { tip, children: /* @__PURE__ */ jsx3(
|
|
1737
1479
|
"button",
|
|
1738
1480
|
{
|
|
1481
|
+
"data-analytics-action": "pause",
|
|
1739
1482
|
...props,
|
|
1740
1483
|
ref: mergeRefs(controller.pauseButtonRef, ref),
|
|
1741
1484
|
type: "button",
|
|
@@ -1749,7 +1492,38 @@ var PauseButton = forwardRef(
|
|
|
1749
1492
|
"disabled:opacity-50",
|
|
1750
1493
|
className
|
|
1751
1494
|
),
|
|
1752
|
-
children: children ?? (busy ? /* @__PURE__ */
|
|
1495
|
+
children: children ?? (busy ? /* @__PURE__ */ jsx3(LoaderCircleIcon, { className: "size-3.5 animate-og-spin" }) : /* @__PURE__ */ jsx3(PauseIcon, { className: "size-3.5 fill-current" }))
|
|
1496
|
+
}
|
|
1497
|
+
) });
|
|
1498
|
+
}
|
|
1499
|
+
);
|
|
1500
|
+
var StopButton = forwardRef(
|
|
1501
|
+
function ComposerStopButton({ className, "aria-label": ariaLabel, title, children, ...props }, ref) {
|
|
1502
|
+
const t = useOpenGeniText();
|
|
1503
|
+
const controller = useComposerController();
|
|
1504
|
+
if (controller.runControl !== "stop" || !controller.running || !controller.hasControl || controller.effectiveControl?.state === "paused")
|
|
1505
|
+
return null;
|
|
1506
|
+
const busy = controller.pausing;
|
|
1507
|
+
const label = ariaLabel ?? controller.messages.stopAriaLabel ?? t("composer.stop");
|
|
1508
|
+
const tip = title ?? controller.messages.stopTitle ?? label;
|
|
1509
|
+
return /* @__PURE__ */ jsx3(ComposerTip, { tip, children: /* @__PURE__ */ jsx3(
|
|
1510
|
+
"button",
|
|
1511
|
+
{
|
|
1512
|
+
"data-analytics-action": "stop",
|
|
1513
|
+
"data-og-composer-stop": "",
|
|
1514
|
+
...props,
|
|
1515
|
+
ref,
|
|
1516
|
+
type: "button",
|
|
1517
|
+
onClick: () => void controller.stop(),
|
|
1518
|
+
disabled: busy,
|
|
1519
|
+
"aria-label": label,
|
|
1520
|
+
className: cn(
|
|
1521
|
+
"inline-flex size-8 items-center justify-center rounded-og-md border border-og-border pointer-coarse:size-11",
|
|
1522
|
+
"bg-og-surface-1 text-og-fg transition-colors duration-150",
|
|
1523
|
+
"hover:bg-og-surface-2 disabled:opacity-50",
|
|
1524
|
+
className
|
|
1525
|
+
),
|
|
1526
|
+
children: children ?? (busy ? /* @__PURE__ */ jsx3(LoaderCircleIcon, { className: "size-3.5 animate-og-spin" }) : /* @__PURE__ */ jsx3(SquareIcon, { className: "size-3 fill-current" }))
|
|
1753
1527
|
}
|
|
1754
1528
|
) });
|
|
1755
1529
|
}
|
|
@@ -1758,9 +1532,10 @@ var SendButton = forwardRef(
|
|
|
1758
1532
|
function ComposerSendButton({ className, "aria-label": ariaLabel, title, children, ...props }, ref) {
|
|
1759
1533
|
const controller = useComposerController();
|
|
1760
1534
|
const tip = title ?? (controller.submitBlocker === "annotations" ? controller.messages.annotationNotesRequired : controller.paused ? controller.messages.sendAndResumeTitle : controller.messages.sendTitle);
|
|
1761
|
-
return /* @__PURE__ */
|
|
1535
|
+
return /* @__PURE__ */ jsx3(ComposerTip, { tip, children: /* @__PURE__ */ jsx3(
|
|
1762
1536
|
"button",
|
|
1763
1537
|
{
|
|
1538
|
+
"data-analytics-action": "send",
|
|
1764
1539
|
...props,
|
|
1765
1540
|
ref,
|
|
1766
1541
|
type: "button",
|
|
@@ -1770,20 +1545,20 @@ var SendButton = forwardRef(
|
|
|
1770
1545
|
"aria-label": ariaLabel ?? (controller.paused ? controller.messages.sendAndResumeAriaLabel : controller.messages.sendMessageAriaLabel),
|
|
1771
1546
|
className: cn(
|
|
1772
1547
|
"inline-flex size-8 items-center justify-center rounded-og-md pointer-coarse:size-11",
|
|
1773
|
-
"bg-og-
|
|
1548
|
+
"border border-og-primary-border bg-og-primary text-og-primary-fg",
|
|
1774
1549
|
"transition-[background-color,transform,opacity] duration-150 ease-og-spring",
|
|
1775
|
-
"hover:bg-og-
|
|
1776
|
-
"disabled:cursor-not-allowed disabled:
|
|
1550
|
+
"hover:bg-og-primary-hover active:scale-95",
|
|
1551
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
1777
1552
|
className
|
|
1778
1553
|
),
|
|
1779
|
-
children: children ?? (controller.sending ? /* @__PURE__ */
|
|
1554
|
+
children: children ?? (controller.sending ? /* @__PURE__ */ jsx3(LoaderCircleIcon, { className: "size-4 animate-og-spin" }) : /* @__PURE__ */ jsx3(ArrowUpIcon, { className: "size-4" }))
|
|
1780
1555
|
}
|
|
1781
1556
|
) });
|
|
1782
1557
|
}
|
|
1783
1558
|
);
|
|
1784
1559
|
function Help() {
|
|
1785
1560
|
const controller = useComposerController();
|
|
1786
|
-
return /* @__PURE__ */
|
|
1561
|
+
return /* @__PURE__ */ jsx3(AnimatePresence2, { children: controller.helpOpen ? /* @__PURE__ */ jsx3(
|
|
1787
1562
|
HelpPanel,
|
|
1788
1563
|
{
|
|
1789
1564
|
commands: controller.helpCommands,
|
|
@@ -1794,9 +1569,9 @@ function Help() {
|
|
|
1794
1569
|
}
|
|
1795
1570
|
function Status() {
|
|
1796
1571
|
const controller = useComposerController();
|
|
1797
|
-
return /* @__PURE__ */
|
|
1798
|
-
/* @__PURE__ */
|
|
1799
|
-
|
|
1572
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1573
|
+
/* @__PURE__ */ jsx3(AnimatePresence2, { children: controller.activeNotice ? /* @__PURE__ */ jsx3(
|
|
1574
|
+
motion2.p,
|
|
1800
1575
|
{
|
|
1801
1576
|
initial: { opacity: 0, height: 0 },
|
|
1802
1577
|
animate: { opacity: 1, height: "auto" },
|
|
@@ -1808,9 +1583,9 @@ function Status() {
|
|
|
1808
1583
|
children: controller.activeNotice.message
|
|
1809
1584
|
}
|
|
1810
1585
|
) : null }),
|
|
1811
|
-
controller.draftConflict ? /* @__PURE__ */
|
|
1812
|
-
/* @__PURE__ */
|
|
1813
|
-
/* @__PURE__ */
|
|
1586
|
+
controller.draftConflict ? /* @__PURE__ */ jsxs3("div", { className: "mt-1.5 flex flex-wrap items-center gap-2 px-1 text-og-xs text-og-status-failed", children: [
|
|
1587
|
+
/* @__PURE__ */ jsx3("span", { className: "min-w-0 flex-1", children: controller.messages.draftConflict }),
|
|
1588
|
+
/* @__PURE__ */ jsx3(
|
|
1814
1589
|
"button",
|
|
1815
1590
|
{
|
|
1816
1591
|
type: "button",
|
|
@@ -1819,7 +1594,7 @@ function Status() {
|
|
|
1819
1594
|
children: controller.messages.useOtherDraft
|
|
1820
1595
|
}
|
|
1821
1596
|
),
|
|
1822
|
-
/* @__PURE__ */
|
|
1597
|
+
/* @__PURE__ */ jsx3(
|
|
1823
1598
|
"button",
|
|
1824
1599
|
{
|
|
1825
1600
|
type: "button",
|
|
@@ -1833,9 +1608,9 @@ function Status() {
|
|
|
1833
1608
|
}
|
|
1834
1609
|
function ComposerAnnouncements() {
|
|
1835
1610
|
const controller = useComposerController();
|
|
1836
|
-
return /* @__PURE__ */
|
|
1837
|
-
controller.activeNotice ? /* @__PURE__ */
|
|
1838
|
-
controller.draftConflict ? /* @__PURE__ */
|
|
1611
|
+
return /* @__PURE__ */ jsxs3("div", { className: "sr-only", children: [
|
|
1612
|
+
controller.activeNotice ? /* @__PURE__ */ jsx3("p", { role: controller.activeNotice.tone === "error" ? "alert" : "status", children: controller.activeNotice.message }) : null,
|
|
1613
|
+
controller.draftConflict ? /* @__PURE__ */ jsx3("p", { role: "alert", children: controller.messages.draftConflict }) : null
|
|
1839
1614
|
] });
|
|
1840
1615
|
}
|
|
1841
1616
|
function mergeRefs(...refs) {
|
|
@@ -1865,10 +1640,10 @@ function WorkstreamPausedStrip({
|
|
|
1865
1640
|
const broaderOptions = control.resumeOptions.filter(
|
|
1866
1641
|
(option) => option !== primary && option.scope !== "selected" && (option.scope !== "workspace" || canControlWorkspace)
|
|
1867
1642
|
);
|
|
1868
|
-
return /* @__PURE__ */
|
|
1869
|
-
/* @__PURE__ */
|
|
1870
|
-
/* @__PURE__ */
|
|
1871
|
-
/* @__PURE__ */
|
|
1643
|
+
return /* @__PURE__ */ jsxs3("div", { className: "border-b border-og-status-waiting/25 bg-og-status-waiting/[0.07]", children: [
|
|
1644
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 items-center gap-2 px-3 py-2", children: [
|
|
1645
|
+
/* @__PURE__ */ jsx3(PauseIcon, { className: "size-3.5 shrink-0 text-og-status-waiting" }),
|
|
1646
|
+
/* @__PURE__ */ jsxs3(
|
|
1872
1647
|
"button",
|
|
1873
1648
|
{
|
|
1874
1649
|
type: "button",
|
|
@@ -1876,61 +1651,61 @@ function WorkstreamPausedStrip({
|
|
|
1876
1651
|
onClick: () => onOpenChange(!open),
|
|
1877
1652
|
"aria-expanded": open,
|
|
1878
1653
|
children: [
|
|
1879
|
-
/* @__PURE__ */
|
|
1880
|
-
/* @__PURE__ */
|
|
1654
|
+
/* @__PURE__ */ jsx3("span", { className: "block truncate text-og-xs font-medium text-og-fg", children: cause }),
|
|
1655
|
+
/* @__PURE__ */ jsx3("span", { className: "block truncate text-[11px] text-og-fg-muted", children: queuedAheadCount > 0 ? messages.queuedAhead(queuedAheadCount) : sending ? messages.resumingAndSending : messages.nextMessageResumes })
|
|
1881
1656
|
]
|
|
1882
1657
|
}
|
|
1883
1658
|
),
|
|
1884
|
-
/* @__PURE__ */
|
|
1659
|
+
/* @__PURE__ */ jsxs3(
|
|
1885
1660
|
"button",
|
|
1886
1661
|
{
|
|
1887
1662
|
type: "button",
|
|
1888
1663
|
"aria-label": messages.resumeThisWorkstream,
|
|
1889
|
-
className: "inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-og-md border border-og-
|
|
1664
|
+
className: "inline-flex min-h-8 shrink-0 items-center gap-1.5 rounded-og-md border border-og-primary-border bg-og-primary px-2.5 text-og-xs font-medium text-og-primary-fg hover:bg-og-primary-hover disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:min-h-11",
|
|
1890
1665
|
disabled: busy,
|
|
1891
1666
|
onClick: onResume,
|
|
1892
1667
|
children: [
|
|
1893
|
-
busy ? /* @__PURE__ */
|
|
1894
|
-
/* @__PURE__ */
|
|
1895
|
-
/* @__PURE__ */
|
|
1668
|
+
busy ? /* @__PURE__ */ jsx3(LoaderCircleIcon, { className: "size-3.5 animate-og-spin" }) : /* @__PURE__ */ jsx3(PlayIcon, { className: "size-3.5 fill-current" }),
|
|
1669
|
+
/* @__PURE__ */ jsx3("span", { className: "og-composer-resume-label-long hidden min-[400px]:inline", children: messages.resumeThisWorkstream }),
|
|
1670
|
+
/* @__PURE__ */ jsx3("span", { className: "og-composer-resume-label-short min-[400px]:hidden", children: messages.resumeShort })
|
|
1896
1671
|
]
|
|
1897
1672
|
}
|
|
1898
1673
|
),
|
|
1899
|
-
/* @__PURE__ */
|
|
1674
|
+
/* @__PURE__ */ jsx3(
|
|
1900
1675
|
"button",
|
|
1901
1676
|
{
|
|
1902
1677
|
type: "button",
|
|
1903
1678
|
className: "inline-flex size-8 shrink-0 items-center justify-center rounded-og-md text-og-fg-muted hover:bg-og-surface-2 pointer-coarse:size-11",
|
|
1904
1679
|
onClick: () => onOpenChange(!open),
|
|
1905
1680
|
"aria-label": open ? messages.hidePauseDetails : messages.showPauseDetails,
|
|
1906
|
-
children: /* @__PURE__ */
|
|
1681
|
+
children: /* @__PURE__ */ jsx3(ChevronDownIcon2, { className: cn("size-3.5 transition-transform", open && "rotate-180") })
|
|
1907
1682
|
}
|
|
1908
1683
|
)
|
|
1909
1684
|
] }),
|
|
1910
|
-
open ? /* @__PURE__ */
|
|
1911
|
-
/* @__PURE__ */
|
|
1685
|
+
open ? /* @__PURE__ */ jsxs3("div", { className: "border-t border-og-status-waiting/20 px-3 pb-3 pt-2", children: [
|
|
1686
|
+
/* @__PURE__ */ jsx3("ul", { className: "grid gap-2", "aria-label": messages.pauseReasonsLabel, children: control.blockers.map((entry, index) => /* @__PURE__ */ jsxs3(
|
|
1912
1687
|
"li",
|
|
1913
1688
|
{
|
|
1914
1689
|
className: "text-og-xs",
|
|
1915
1690
|
children: [
|
|
1916
|
-
/* @__PURE__ */
|
|
1917
|
-
blockerHref(entry, controlLinks) ? /* @__PURE__ */
|
|
1691
|
+
/* @__PURE__ */ jsx3("span", { className: "font-medium text-og-fg", children: index === 0 ? messages.pausedByLabel : messages.alsoPausedByLabel }),
|
|
1692
|
+
blockerHref(entry, controlLinks) ? /* @__PURE__ */ jsx3(
|
|
1918
1693
|
"a",
|
|
1919
1694
|
{
|
|
1920
1695
|
href: blockerHref(entry, controlLinks),
|
|
1921
1696
|
className: "font-medium text-og-fg underline decoration-og-border-strong underline-offset-2 hover:text-og-accent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-ring/40",
|
|
1922
1697
|
children: entry.displayName
|
|
1923
1698
|
}
|
|
1924
|
-
) : /* @__PURE__ */
|
|
1925
|
-
entry.reason ? /* @__PURE__ */
|
|
1699
|
+
) : /* @__PURE__ */ jsx3("span", { className: "font-medium text-og-fg", children: entry.displayName }),
|
|
1700
|
+
entry.reason ? /* @__PURE__ */ jsxs3("span", { className: "text-og-fg-muted", children: [
|
|
1926
1701
|
" \xB7 ",
|
|
1927
1702
|
entry.reason
|
|
1928
1703
|
] }) : null,
|
|
1929
|
-
entry.actor ? /* @__PURE__ */
|
|
1704
|
+
entry.actor ? /* @__PURE__ */ jsxs3("span", { className: "text-og-fg-subtle", children: [
|
|
1930
1705
|
" \xB7 ",
|
|
1931
1706
|
entry.actor
|
|
1932
1707
|
] }) : null,
|
|
1933
|
-
entry.changedAt ? /* @__PURE__ */
|
|
1708
|
+
entry.changedAt ? /* @__PURE__ */ jsxs3("span", { className: "text-og-fg-subtle", children: [
|
|
1934
1709
|
" ",
|
|
1935
1710
|
"\xB7 ",
|
|
1936
1711
|
messages.formatRelativeTime(entry.changedAt)
|
|
@@ -1939,11 +1714,11 @@ function WorkstreamPausedStrip({
|
|
|
1939
1714
|
},
|
|
1940
1715
|
`${entry.kind}-${entry.sessionId ?? "workspace"}-${entry.revision}`
|
|
1941
1716
|
)) }),
|
|
1942
|
-
broaderOptions.length > 0 ? /* @__PURE__ */
|
|
1717
|
+
broaderOptions.length > 0 ? /* @__PURE__ */ jsx3("div", { className: "mt-2 flex flex-wrap gap-1.5", children: broaderOptions.map((option) => /* @__PURE__ */ jsx3(
|
|
1943
1718
|
ComposerTip,
|
|
1944
1719
|
{
|
|
1945
1720
|
tip: option.impactCopy,
|
|
1946
|
-
children: /* @__PURE__ */
|
|
1721
|
+
children: /* @__PURE__ */ jsxs3(
|
|
1947
1722
|
"button",
|
|
1948
1723
|
{
|
|
1949
1724
|
type: "button",
|
|
@@ -1951,8 +1726,8 @@ function WorkstreamPausedStrip({
|
|
|
1951
1726
|
onClick: () => onResumeOption(option),
|
|
1952
1727
|
className: "rounded-og-md border border-og-border bg-og-surface-1 px-2 py-1 text-og-xs text-og-fg-muted hover:bg-og-surface-2 hover:text-og-fg pointer-coarse:min-h-10",
|
|
1953
1728
|
children: [
|
|
1954
|
-
/* @__PURE__ */
|
|
1955
|
-
/* @__PURE__ */
|
|
1729
|
+
/* @__PURE__ */ jsx3("span", { className: "block font-medium", children: option.scope === "workspace" ? messages.resumeWorkspace : messages.resumeFromSession }),
|
|
1730
|
+
/* @__PURE__ */ jsx3("span", { className: "block text-[10px] text-og-fg-subtle", children: option.selectedStateAfter === "active" ? messages.sessionCanRun : messages.stillPausedBy(
|
|
1956
1731
|
option.remainingPrimaryBlocker?.displayName ?? messages.narrowerPause
|
|
1957
1732
|
) })
|
|
1958
1733
|
]
|
|
@@ -1973,26 +1748,26 @@ function RestoredResourceChips({
|
|
|
1973
1748
|
messages,
|
|
1974
1749
|
onRemove
|
|
1975
1750
|
}) {
|
|
1976
|
-
return /* @__PURE__ */
|
|
1751
|
+
return /* @__PURE__ */ jsx3(
|
|
1977
1752
|
"div",
|
|
1978
1753
|
{
|
|
1979
1754
|
className: "flex flex-wrap gap-1.5 border-b border-og-border px-3 py-2",
|
|
1980
1755
|
"aria-label": messages.restoredResourcesLabel,
|
|
1981
|
-
children: resources.map((resource, index) => /* @__PURE__ */
|
|
1756
|
+
children: resources.map((resource, index) => /* @__PURE__ */ jsxs3(
|
|
1982
1757
|
"span",
|
|
1983
1758
|
{
|
|
1984
1759
|
className: "inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-og-md border border-og-border bg-og-surface-2 px-2 py-1 text-og-xs text-og-fg-muted",
|
|
1985
1760
|
children: [
|
|
1986
|
-
/* @__PURE__ */
|
|
1987
|
-
/* @__PURE__ */
|
|
1988
|
-
/* @__PURE__ */
|
|
1761
|
+
/* @__PURE__ */ jsx3(FileIcon, { className: "size-3 shrink-0" }),
|
|
1762
|
+
/* @__PURE__ */ jsx3("span", { className: "truncate", children: resource.kind === "file" ? messages.restoredFile(resource.fileId) : resource.uri }),
|
|
1763
|
+
/* @__PURE__ */ jsx3(
|
|
1989
1764
|
"button",
|
|
1990
1765
|
{
|
|
1991
1766
|
type: "button",
|
|
1992
1767
|
className: "shrink-0 hover:text-og-fg",
|
|
1993
1768
|
onClick: () => onRemove(index),
|
|
1994
1769
|
"aria-label": messages.removeRestoredResource(index),
|
|
1995
|
-
children: /* @__PURE__ */
|
|
1770
|
+
children: /* @__PURE__ */ jsx3(XIcon, { className: "size-3" })
|
|
1996
1771
|
}
|
|
1997
1772
|
)
|
|
1998
1773
|
]
|
|
@@ -2009,14 +1784,14 @@ function ConfirmBar({
|
|
|
2009
1784
|
onConfirm,
|
|
2010
1785
|
returnFocusRef
|
|
2011
1786
|
}) {
|
|
2012
|
-
const confirmRef =
|
|
1787
|
+
const confirmRef = useRef2(null);
|
|
2013
1788
|
const descriptionId = useId2();
|
|
2014
|
-
|
|
1789
|
+
useEffect(() => {
|
|
2015
1790
|
const returnTo = returnFocusRef?.current ?? null;
|
|
2016
1791
|
confirmRef.current?.focus();
|
|
2017
1792
|
return () => returnTo?.focus();
|
|
2018
1793
|
}, [returnFocusRef]);
|
|
2019
|
-
return /* @__PURE__ */
|
|
1794
|
+
return /* @__PURE__ */ jsxs3(
|
|
2020
1795
|
"div",
|
|
2021
1796
|
{
|
|
2022
1797
|
role: "alertdialog",
|
|
@@ -2032,9 +1807,9 @@ function ConfirmBar({
|
|
|
2032
1807
|
},
|
|
2033
1808
|
className: "flex items-end justify-between gap-2 px-2.5 pb-2.5 pt-1",
|
|
2034
1809
|
children: [
|
|
2035
|
-
/* @__PURE__ */
|
|
2036
|
-
/* @__PURE__ */
|
|
2037
|
-
/* @__PURE__ */
|
|
1810
|
+
/* @__PURE__ */ jsx3("span", { id: descriptionId, className: "min-w-0 flex-1 px-1.5 text-og-sm text-og-status-failed", children: messages.confirmDescription(command) }),
|
|
1811
|
+
/* @__PURE__ */ jsxs3("span", { className: "flex shrink-0 items-center gap-1.5", children: [
|
|
1812
|
+
/* @__PURE__ */ jsx3(
|
|
2038
1813
|
"button",
|
|
2039
1814
|
{
|
|
2040
1815
|
type: "button",
|
|
@@ -2043,7 +1818,7 @@ function ConfirmBar({
|
|
|
2043
1818
|
children: messages.cancel
|
|
2044
1819
|
}
|
|
2045
1820
|
),
|
|
2046
|
-
/* @__PURE__ */
|
|
1821
|
+
/* @__PURE__ */ jsx3(
|
|
2047
1822
|
"button",
|
|
2048
1823
|
{
|
|
2049
1824
|
ref: confirmRef,
|
|
@@ -2061,22 +1836,55 @@ function ConfirmBar({
|
|
|
2061
1836
|
function AttachmentChips({
|
|
2062
1837
|
attachments,
|
|
2063
1838
|
messages,
|
|
1839
|
+
disabled,
|
|
2064
1840
|
onRemove,
|
|
2065
1841
|
onRetry,
|
|
2066
1842
|
onRetainPreview,
|
|
2067
1843
|
onLoadPreview
|
|
2068
1844
|
}) {
|
|
1845
|
+
const t = useOpenGeniText();
|
|
2069
1846
|
const lightbox = useLightboxOptional();
|
|
2070
|
-
const previewRequest =
|
|
2071
|
-
const [previewLoadingId, setPreviewLoadingId] =
|
|
2072
|
-
const [previewErrorId, setPreviewErrorId] =
|
|
2073
|
-
|
|
1847
|
+
const previewRequest = useRef2(null);
|
|
1848
|
+
const [previewLoadingId, setPreviewLoadingId] = useState2(null);
|
|
1849
|
+
const [previewErrorId, setPreviewErrorId] = useState2(null);
|
|
1850
|
+
const [storedThumbs, setStoredThumbs] = useState2({});
|
|
1851
|
+
const [brokenLocal, setBrokenLocal] = useState2(() => /* @__PURE__ */ new Set());
|
|
1852
|
+
const thumbRequests = useRef2(/* @__PURE__ */ new Map());
|
|
1853
|
+
const localPreview = (attachment) => attachment.previewUrl && !brokenLocal.has(attachment.id) ? attachment.previewUrl : void 0;
|
|
1854
|
+
useEffect(() => {
|
|
1855
|
+
if (!onLoadPreview) return;
|
|
1856
|
+
for (const attachment of attachments) {
|
|
1857
|
+
const id = attachment.id;
|
|
1858
|
+
if (attachment.status !== "ready" || !attachment.file || !attachment.contentType.startsWith("image/") || attachment.previewUrl && !brokenLocal.has(id) || storedThumbs[id] || thumbRequests.current.has(id)) {
|
|
1859
|
+
continue;
|
|
1860
|
+
}
|
|
1861
|
+
const controller = new AbortController();
|
|
1862
|
+
thumbRequests.current.set(id, controller);
|
|
1863
|
+
void onLoadPreview(id, controller.signal).then((url) => {
|
|
1864
|
+
if (url && !controller.signal.aborted) {
|
|
1865
|
+
setStoredThumbs((current) => ({ ...current, [id]: url }));
|
|
1866
|
+
}
|
|
1867
|
+
}).catch(() => void 0).finally(() => {
|
|
1868
|
+
if (thumbRequests.current.get(id) === controller) thumbRequests.current.delete(id);
|
|
1869
|
+
});
|
|
1870
|
+
}
|
|
1871
|
+
}, [attachments, brokenLocal, onLoadPreview, storedThumbs]);
|
|
1872
|
+
useEffect(() => {
|
|
1873
|
+
const requests = thumbRequests.current;
|
|
1874
|
+
return () => {
|
|
1875
|
+
for (const controller of requests.values()) controller.abort();
|
|
1876
|
+
requests.clear();
|
|
1877
|
+
};
|
|
1878
|
+
}, []);
|
|
1879
|
+
useEffect(() => () => previewRequest.current?.abort(), [onLoadPreview]);
|
|
2074
1880
|
async function openPreview(attachment, source, canLoadPreview) {
|
|
2075
1881
|
previewRequest.current?.abort();
|
|
2076
1882
|
const attachmentId = attachment.id;
|
|
2077
|
-
const
|
|
2078
|
-
|
|
2079
|
-
|
|
1883
|
+
const local = localPreview(attachment);
|
|
1884
|
+
const releaseSource = local ? onRetainPreview(attachmentId) : void 0;
|
|
1885
|
+
let src = local ?? storedThumbs[attachmentId];
|
|
1886
|
+
if (!releaseSource && canLoadPreview) src = storedThumbs[attachmentId];
|
|
1887
|
+
if (!src && canLoadPreview) {
|
|
2080
1888
|
const controller = new AbortController();
|
|
2081
1889
|
previewRequest.current = controller;
|
|
2082
1890
|
setPreviewLoadingId(attachmentId);
|
|
@@ -2110,16 +1918,21 @@ function AttachmentChips({
|
|
|
2110
1918
|
releaseSource
|
|
2111
1919
|
);
|
|
2112
1920
|
}
|
|
2113
|
-
return /* @__PURE__ */
|
|
1921
|
+
return /* @__PURE__ */ jsx3("div", { className: "flex flex-wrap gap-2 px-3 py-2", children: attachments.map((attachment) => {
|
|
2114
1922
|
const failed = attachment.status === "failed";
|
|
2115
1923
|
const secureContextRequired = attachment.errorCode === "secure_context_required";
|
|
2116
1924
|
const previewFailed = previewErrorId === attachment.id;
|
|
2117
1925
|
const previewLoading = previewLoadingId === attachment.id;
|
|
1926
|
+
const local = localPreview(attachment);
|
|
1927
|
+
const thumb = local ?? storedThumbs[attachment.id];
|
|
1928
|
+
const onThumbError = local ? () => setBrokenLocal(
|
|
1929
|
+
(current) => current.has(attachment.id) ? current : new Set(current).add(attachment.id)
|
|
1930
|
+
) : void 0;
|
|
2118
1931
|
const canLoadPreview = Boolean(
|
|
2119
1932
|
lightbox && onLoadPreview && attachment.status === "ready" && attachment.file && attachment.contentType.startsWith("image/")
|
|
2120
1933
|
);
|
|
2121
|
-
const statusText = previewFailed ? messages.previewUnavailable ?? "
|
|
2122
|
-
return /* @__PURE__ */
|
|
1934
|
+
const statusText = previewFailed ? messages.previewUnavailable ?? t("composer.previewUnavailable") : attachment.status === "uploading" ? messages.uploading : failed ? attachment.error || messages.uploadFailed : messages.formatBytes(attachment.sizeBytes);
|
|
1935
|
+
return /* @__PURE__ */ jsxs3(
|
|
2123
1936
|
"div",
|
|
2124
1937
|
{
|
|
2125
1938
|
className: cn(
|
|
@@ -2130,58 +1943,62 @@ function AttachmentChips({
|
|
|
2130
1943
|
) : "max-w-[240px] border-og-border bg-og-surface-2"
|
|
2131
1944
|
),
|
|
2132
1945
|
children: [
|
|
2133
|
-
lightbox && (
|
|
1946
|
+
lightbox && (thumb || canLoadPreview) ? /* @__PURE__ */ jsx3(
|
|
2134
1947
|
"button",
|
|
2135
1948
|
{
|
|
2136
1949
|
type: "button",
|
|
2137
1950
|
className: cn(
|
|
2138
1951
|
"size-8 shrink-0 overflow-hidden rounded outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent",
|
|
2139
|
-
!
|
|
1952
|
+
!thumb && "flex items-center justify-center disabled:cursor-wait"
|
|
2140
1953
|
),
|
|
2141
1954
|
"aria-label": messages.previewAttachment(attachment.name),
|
|
2142
1955
|
"aria-busy": previewLoading || void 0,
|
|
2143
1956
|
disabled: previewLoading,
|
|
2144
1957
|
onClick: (event) => void openPreview(attachment, event.currentTarget, canLoadPreview),
|
|
2145
|
-
children:
|
|
1958
|
+
children: thumb ? /* @__PURE__ */ jsx3(
|
|
2146
1959
|
"img",
|
|
2147
1960
|
{
|
|
2148
|
-
src:
|
|
1961
|
+
src: thumb,
|
|
2149
1962
|
alt: "",
|
|
1963
|
+
onError: onThumbError,
|
|
2150
1964
|
className: "h-full w-full object-cover transition-opacity hover:opacity-80"
|
|
2151
1965
|
}
|
|
2152
|
-
) : previewLoading ? /* @__PURE__ */
|
|
1966
|
+
) : previewLoading ? /* @__PURE__ */ jsx3(LoaderCircleIcon, { className: "size-4 animate-og-spin text-og-fg-muted" }) : /* @__PURE__ */ jsx3(ImageIcon, { className: "size-4 text-og-fg-muted" })
|
|
2153
1967
|
}
|
|
2154
|
-
) :
|
|
1968
|
+
) : thumb ? /* @__PURE__ */ jsx3(
|
|
2155
1969
|
"img",
|
|
2156
1970
|
{
|
|
2157
|
-
src:
|
|
1971
|
+
src: thumb,
|
|
2158
1972
|
alt: "",
|
|
1973
|
+
onError: onThumbError,
|
|
2159
1974
|
className: "size-8 shrink-0 rounded object-cover"
|
|
2160
1975
|
}
|
|
2161
|
-
) : attachment.contentType.startsWith("image/") ? /* @__PURE__ */
|
|
2162
|
-
/* @__PURE__ */
|
|
2163
|
-
/* @__PURE__ */
|
|
2164
|
-
secureContextRequired ? /* @__PURE__ */
|
|
1976
|
+
) : attachment.contentType.startsWith("image/") ? /* @__PURE__ */ jsx3(ImageIcon, { className: "size-4 shrink-0 text-og-fg-muted" }) : /* @__PURE__ */ jsx3(FileIcon, { className: "size-4 shrink-0 text-og-fg-muted" }),
|
|
1977
|
+
/* @__PURE__ */ jsxs3("div", { className: "min-w-0 flex-1", children: [
|
|
1978
|
+
/* @__PURE__ */ jsx3("div", { className: "truncate font-medium text-og-fg", children: attachment.name }),
|
|
1979
|
+
secureContextRequired ? /* @__PURE__ */ jsx3("div", { className: "break-words text-og-xs leading-4 text-og-status-failed", children: statusText }) : failed || previewFailed ? /* @__PURE__ */ jsx3(ComposerTip, { tip: statusText, children: /* @__PURE__ */ jsx3("div", { className: "truncate text-og-xs text-og-status-failed", children: statusText }) }) : /* @__PURE__ */ jsx3("div", { className: "truncate text-og-xs text-og-fg-subtle", children: statusText })
|
|
2165
1980
|
] }),
|
|
2166
|
-
attachment.status === "uploading" ? /* @__PURE__ */
|
|
2167
|
-
failed && !secureContextRequired && onRetry ? /* @__PURE__ */
|
|
1981
|
+
attachment.status === "uploading" ? /* @__PURE__ */ jsx3(LoaderCircleIcon, { className: "size-3.5 shrink-0 animate-og-spin" }) : null,
|
|
1982
|
+
failed && !secureContextRequired && onRetry ? /* @__PURE__ */ jsx3(ComposerTip, { tip: messages.retryUpload, children: /* @__PURE__ */ jsx3(
|
|
2168
1983
|
"button",
|
|
2169
1984
|
{
|
|
2170
1985
|
type: "button",
|
|
2171
1986
|
onClick: () => onRetry(attachment.id),
|
|
2172
|
-
|
|
1987
|
+
disabled,
|
|
1988
|
+
className: "shrink-0 rounded-og-xs p-1 text-og-fg-muted hover:bg-og-surface-1 hover:text-og-fg disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:size-10",
|
|
2173
1989
|
"aria-label": messages.retryAttachment(attachment.name),
|
|
2174
|
-
children: /* @__PURE__ */
|
|
1990
|
+
children: /* @__PURE__ */ jsx3(RotateCwIcon, { className: "size-3.5" })
|
|
2175
1991
|
}
|
|
2176
1992
|
) }) : null,
|
|
2177
|
-
/* @__PURE__ */
|
|
1993
|
+
/* @__PURE__ */ jsx3(
|
|
2178
1994
|
"button",
|
|
2179
1995
|
{
|
|
2180
1996
|
type: "button",
|
|
2181
1997
|
onClick: () => onRemove(attachment.id),
|
|
2182
|
-
|
|
1998
|
+
disabled,
|
|
1999
|
+
className: "shrink-0 rounded-og-xs p-1 text-og-fg-muted hover:bg-og-surface-1 hover:text-og-fg disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:size-10",
|
|
2183
2000
|
"aria-label": messages.removeAttachment(attachment.name),
|
|
2184
|
-
children: /* @__PURE__ */
|
|
2001
|
+
children: /* @__PURE__ */ jsx3(XIcon, { className: "size-3.5" })
|
|
2185
2002
|
}
|
|
2186
2003
|
)
|
|
2187
2004
|
]
|
|
@@ -2195,17 +2012,17 @@ function HelpPanel({
|
|
|
2195
2012
|
messages,
|
|
2196
2013
|
onClose
|
|
2197
2014
|
}) {
|
|
2198
|
-
return /* @__PURE__ */
|
|
2199
|
-
|
|
2015
|
+
return /* @__PURE__ */ jsxs3(
|
|
2016
|
+
motion2.div,
|
|
2200
2017
|
{
|
|
2201
2018
|
initial: { opacity: 0, height: 0 },
|
|
2202
2019
|
animate: { opacity: 1, height: "auto" },
|
|
2203
2020
|
exit: { opacity: 0, height: 0 },
|
|
2204
2021
|
className: "mt-2 overflow-hidden rounded-og-lg border border-og-border bg-og-surface-2",
|
|
2205
2022
|
children: [
|
|
2206
|
-
/* @__PURE__ */
|
|
2207
|
-
/* @__PURE__ */
|
|
2208
|
-
/* @__PURE__ */
|
|
2023
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between border-b border-og-border px-3 py-1.5", children: [
|
|
2024
|
+
/* @__PURE__ */ jsx3("span", { className: "text-og-sm font-medium text-og-fg", children: messages.commands }),
|
|
2025
|
+
/* @__PURE__ */ jsx3(
|
|
2209
2026
|
"button",
|
|
2210
2027
|
{
|
|
2211
2028
|
type: "button",
|
|
@@ -2215,16 +2032,16 @@ function HelpPanel({
|
|
|
2215
2032
|
}
|
|
2216
2033
|
)
|
|
2217
2034
|
] }),
|
|
2218
|
-
/* @__PURE__ */
|
|
2035
|
+
/* @__PURE__ */ jsx3("ul", { className: "py-1", children: commands.map((command) => {
|
|
2219
2036
|
const hint = argHint(command.args);
|
|
2220
|
-
return /* @__PURE__ */
|
|
2221
|
-
/* @__PURE__ */
|
|
2037
|
+
return /* @__PURE__ */ jsxs3("li", { className: "flex items-baseline gap-2 px-3 py-1", children: [
|
|
2038
|
+
/* @__PURE__ */ jsxs3("span", { className: "font-mono text-og-sm text-og-accent", children: [
|
|
2222
2039
|
"/",
|
|
2223
2040
|
command.name,
|
|
2224
|
-
hint ? /* @__PURE__ */
|
|
2041
|
+
hint ? /* @__PURE__ */ jsx3("span", { className: "ml-1 text-og-fg-subtle", children: hint }) : null
|
|
2225
2042
|
] }),
|
|
2226
|
-
/* @__PURE__ */
|
|
2227
|
-
command.danger ? /* @__PURE__ */
|
|
2043
|
+
/* @__PURE__ */ jsx3("span", { className: "text-og-sm text-og-fg-muted", children: command.description }),
|
|
2044
|
+
command.danger ? /* @__PURE__ */ jsx3("span", { className: "ml-auto rounded-og-xs bg-og-status-failed/15 px-1 text-og-xs uppercase tracking-wide text-og-status-failed", children: messages.danger }) : null
|
|
2228
2045
|
] }, command.name);
|
|
2229
2046
|
}) })
|
|
2230
2047
|
]
|
|
@@ -2582,7 +2399,7 @@ import {
|
|
|
2582
2399
|
authorizeTranscriptionAdapter,
|
|
2583
2400
|
createTranscriptionSessionRequest
|
|
2584
2401
|
} from "@opengeni/sdk";
|
|
2585
|
-
import { useCallback as
|
|
2402
|
+
import { useCallback as useCallback3, useEffect as useEffect2, useMemo as useMemo4, useRef as useRef3, useState as useState3 } from "react";
|
|
2586
2403
|
var INITIAL_TRANSCRIPTION_CONTROL_STATE = {
|
|
2587
2404
|
status: "idle",
|
|
2588
2405
|
generation: 0,
|
|
@@ -2744,12 +2561,13 @@ function useTranscription({
|
|
|
2744
2561
|
lifecycleTimeouts,
|
|
2745
2562
|
onDiagnostic
|
|
2746
2563
|
}) {
|
|
2747
|
-
const
|
|
2748
|
-
const
|
|
2749
|
-
const
|
|
2750
|
-
const
|
|
2751
|
-
const
|
|
2752
|
-
const
|
|
2564
|
+
const t = useOpenGeniText();
|
|
2565
|
+
const [state, setState] = useState3(INITIAL_TRANSCRIPTION_CONTROL_STATE);
|
|
2566
|
+
const stateRef = useRef3(state);
|
|
2567
|
+
const valueRef = useRef3(value);
|
|
2568
|
+
const sessionRef = useRef3(null);
|
|
2569
|
+
const pendingStartRef = useRef3(null);
|
|
2570
|
+
const activePolicyRef = useRef3(null);
|
|
2753
2571
|
valueRef.current = value;
|
|
2754
2572
|
const startTimeoutMs = normalizeTimeout(
|
|
2755
2573
|
lifecycleTimeouts?.startMs,
|
|
@@ -2759,30 +2577,30 @@ function useTranscription({
|
|
|
2759
2577
|
lifecycleTimeouts?.cleanupMs,
|
|
2760
2578
|
DEFAULT_TRANSCRIPTION_LIFECYCLE_TIMEOUTS.cleanupMs
|
|
2761
2579
|
);
|
|
2762
|
-
const reportDiagnostic =
|
|
2580
|
+
const reportDiagnostic = useCallback3(
|
|
2763
2581
|
(diagnostic) => {
|
|
2764
2582
|
if (!onDiagnostic) return;
|
|
2765
2583
|
try {
|
|
2766
|
-
onDiagnostic(normalizeTranscriptionDiagnostic(diagnostic));
|
|
2584
|
+
onDiagnostic(normalizeTranscriptionDiagnostic(t, diagnostic));
|
|
2767
2585
|
} catch {
|
|
2768
2586
|
}
|
|
2769
2587
|
},
|
|
2770
|
-
[onDiagnostic]
|
|
2588
|
+
[onDiagnostic, t]
|
|
2771
2589
|
);
|
|
2772
|
-
const cleanupRuntimeRef =
|
|
2773
|
-
|
|
2590
|
+
const cleanupRuntimeRef = useRef3({ cleanupTimeoutMs, reportDiagnostic });
|
|
2591
|
+
useEffect2(() => {
|
|
2774
2592
|
cleanupRuntimeRef.current = { cleanupTimeoutMs, reportDiagnostic };
|
|
2775
2593
|
}, [cleanupTimeoutMs, reportDiagnostic]);
|
|
2776
|
-
const policyRevision =
|
|
2594
|
+
const policyRevision = useMemo4(
|
|
2777
2595
|
() => transcriptionPolicyRevision(policy, selection),
|
|
2778
2596
|
[policy, selection]
|
|
2779
2597
|
);
|
|
2780
|
-
const authorization =
|
|
2598
|
+
const authorization = useMemo4(
|
|
2781
2599
|
() => adapter ? authorizeTranscriptionAdapter(policy, adapter.descriptor, selection) : null,
|
|
2782
2600
|
[adapter, policy, selection]
|
|
2783
2601
|
);
|
|
2784
2602
|
const unavailableReason = disabled ? "composer_disabled" : !policy.enabled ? "disabled" : !policy.acceptanceId ? "unaccepted" : !policy.primary ? "target_missing" : !adapter ? "adapter_missing" : authorization?.authorized ? null : authorization?.reason ?? "unaccepted";
|
|
2785
|
-
const apply =
|
|
2603
|
+
const apply = useCallback3(
|
|
2786
2604
|
(action) => {
|
|
2787
2605
|
const transition = transitionTranscriptionControl(stateRef.current, action);
|
|
2788
2606
|
if (transition.state !== stateRef.current) {
|
|
@@ -2799,20 +2617,20 @@ function useTranscription({
|
|
|
2799
2617
|
},
|
|
2800
2618
|
[focusInput, setValue]
|
|
2801
2619
|
);
|
|
2802
|
-
const releaseTerminalSession =
|
|
2620
|
+
const releaseTerminalSession = useCallback3(
|
|
2803
2621
|
(generation) => {
|
|
2804
2622
|
const active = sessionRef.current;
|
|
2805
2623
|
if (!active || active.generation !== generation) return;
|
|
2806
2624
|
sessionRef.current = null;
|
|
2807
2625
|
if (activePolicyRef.current?.generation === generation) activePolicyRef.current = null;
|
|
2808
|
-
detachSessionCleanup(active.session, {
|
|
2626
|
+
detachSessionCleanup(t, active.session, {
|
|
2809
2627
|
cleanupTimeoutMs,
|
|
2810
2628
|
reportDiagnostic
|
|
2811
2629
|
});
|
|
2812
2630
|
},
|
|
2813
|
-
[cleanupTimeoutMs, reportDiagnostic]
|
|
2631
|
+
[cleanupTimeoutMs, reportDiagnostic, t]
|
|
2814
2632
|
);
|
|
2815
|
-
const start =
|
|
2633
|
+
const start = useCallback3(async () => {
|
|
2816
2634
|
if (!adapter || unavailableReason !== null || isActiveTranscriptionStatus(stateRef.current.status)) {
|
|
2817
2635
|
return false;
|
|
2818
2636
|
}
|
|
@@ -2858,7 +2676,7 @@ function useTranscription({
|
|
|
2858
2676
|
).then(
|
|
2859
2677
|
(session) => {
|
|
2860
2678
|
if (boundarySettled && !accepted) {
|
|
2861
|
-
detachSessionCleanup(session, {
|
|
2679
|
+
detachSessionCleanup(t, session, {
|
|
2862
2680
|
cancelReason: "stale-generation",
|
|
2863
2681
|
cleanupTimeoutMs,
|
|
2864
2682
|
reportDiagnostic
|
|
@@ -2871,7 +2689,7 @@ function useTranscription({
|
|
|
2871
2689
|
reportDiagnostic({
|
|
2872
2690
|
operation: "start",
|
|
2873
2691
|
code: classifyStartError(error),
|
|
2874
|
-
detail: diagnosticDetail(error)
|
|
2692
|
+
detail: diagnosticDetail(t, error)
|
|
2875
2693
|
});
|
|
2876
2694
|
}
|
|
2877
2695
|
return { kind: "error", error };
|
|
@@ -2902,7 +2720,9 @@ function useTranscription({
|
|
|
2902
2720
|
reportDiagnostic({
|
|
2903
2721
|
operation: "start",
|
|
2904
2722
|
code: "timeout",
|
|
2905
|
-
detail:
|
|
2723
|
+
detail: t("hooks.useTranscription.transcriptionAdapterStartExceededStarttimeoutms", {
|
|
2724
|
+
startTimeoutMs
|
|
2725
|
+
})
|
|
2906
2726
|
});
|
|
2907
2727
|
apply({ type: "start.failed", generation, code: "timeout" });
|
|
2908
2728
|
return false;
|
|
@@ -2913,7 +2733,7 @@ function useTranscription({
|
|
|
2913
2733
|
reportDiagnostic({
|
|
2914
2734
|
operation: "start",
|
|
2915
2735
|
code,
|
|
2916
|
-
detail: diagnosticDetail(outcome.error)
|
|
2736
|
+
detail: diagnosticDetail(t, outcome.error)
|
|
2917
2737
|
});
|
|
2918
2738
|
if (!controller.signal.aborted) {
|
|
2919
2739
|
apply({ type: "start.failed", generation, code });
|
|
@@ -2923,7 +2743,7 @@ function useTranscription({
|
|
|
2923
2743
|
const current = stateRef.current;
|
|
2924
2744
|
if (current.generation !== generation || current.localSessionId !== localSessionId || current.status === "cancelling" || !isActiveTranscriptionStatus(current.status)) {
|
|
2925
2745
|
if (activePolicyRef.current?.generation === generation) activePolicyRef.current = null;
|
|
2926
|
-
detachSessionCleanup(outcome.session, {
|
|
2746
|
+
detachSessionCleanup(t, outcome.session, {
|
|
2927
2747
|
...current.status === "error" ? {} : { cancelReason: "stale-generation" },
|
|
2928
2748
|
cleanupTimeoutMs,
|
|
2929
2749
|
reportDiagnostic
|
|
@@ -2944,9 +2764,10 @@ function useTranscription({
|
|
|
2944
2764
|
reportDiagnostic,
|
|
2945
2765
|
selection,
|
|
2946
2766
|
startTimeoutMs,
|
|
2947
|
-
unavailableReason
|
|
2767
|
+
unavailableReason,
|
|
2768
|
+
t
|
|
2948
2769
|
]);
|
|
2949
|
-
const cancel =
|
|
2770
|
+
const cancel = useCallback3(async () => {
|
|
2950
2771
|
const current = stateRef.current;
|
|
2951
2772
|
if (!isActiveTranscriptionStatus(current.status)) return false;
|
|
2952
2773
|
const generation = current.generation;
|
|
@@ -2962,16 +2783,16 @@ function useTranscription({
|
|
|
2962
2783
|
apply({ type: "cancel.settled", generation });
|
|
2963
2784
|
focusInput();
|
|
2964
2785
|
if (active?.generation === generation) {
|
|
2965
|
-
detachSessionCleanup(active.session, {
|
|
2786
|
+
detachSessionCleanup(t, active.session, {
|
|
2966
2787
|
cancelReason: "user-cancelled",
|
|
2967
2788
|
cleanupTimeoutMs,
|
|
2968
2789
|
reportDiagnostic
|
|
2969
2790
|
});
|
|
2970
2791
|
}
|
|
2971
2792
|
return true;
|
|
2972
|
-
}, [apply, cleanupTimeoutMs, focusInput, reportDiagnostic]);
|
|
2973
|
-
const reset =
|
|
2974
|
-
|
|
2793
|
+
}, [apply, cleanupTimeoutMs, focusInput, reportDiagnostic, t]);
|
|
2794
|
+
const reset = useCallback3(() => apply({ type: "reset" }), [apply]);
|
|
2795
|
+
useEffect2(() => {
|
|
2975
2796
|
if (!isActiveTranscriptionStatus(state.status)) return;
|
|
2976
2797
|
const onKeyDown = (event) => {
|
|
2977
2798
|
if (event.key !== "Escape") return;
|
|
@@ -2981,7 +2802,7 @@ function useTranscription({
|
|
|
2981
2802
|
document.addEventListener("keydown", onKeyDown);
|
|
2982
2803
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
2983
2804
|
}, [cancel, state.status]);
|
|
2984
|
-
|
|
2805
|
+
useEffect2(() => {
|
|
2985
2806
|
if (!isActiveTranscriptionStatus(state.status)) return;
|
|
2986
2807
|
const activePolicy = activePolicyRef.current;
|
|
2987
2808
|
if (unavailableReason === null && activePolicy?.generation === state.generation && activePolicy.revision === policyRevision) {
|
|
@@ -2989,7 +2810,7 @@ function useTranscription({
|
|
|
2989
2810
|
}
|
|
2990
2811
|
void cancel();
|
|
2991
2812
|
}, [cancel, policyRevision, state.generation, state.status, unavailableReason]);
|
|
2992
|
-
|
|
2813
|
+
useEffect2(
|
|
2993
2814
|
() => () => {
|
|
2994
2815
|
const pending = pendingStartRef.current;
|
|
2995
2816
|
pendingStartRef.current = null;
|
|
@@ -3005,14 +2826,14 @@ function useTranscription({
|
|
|
3005
2826
|
};
|
|
3006
2827
|
if (active) {
|
|
3007
2828
|
const runtime = cleanupRuntimeRef.current;
|
|
3008
|
-
detachSessionCleanup(active.session, {
|
|
2829
|
+
detachSessionCleanup(t, active.session, {
|
|
3009
2830
|
cancelReason: "component-unmounted",
|
|
3010
2831
|
cleanupTimeoutMs: runtime.cleanupTimeoutMs,
|
|
3011
2832
|
reportDiagnostic: runtime.reportDiagnostic
|
|
3012
2833
|
});
|
|
3013
2834
|
}
|
|
3014
2835
|
},
|
|
3015
|
-
[]
|
|
2836
|
+
[t]
|
|
3016
2837
|
);
|
|
3017
2838
|
return {
|
|
3018
2839
|
state,
|
|
@@ -3044,6 +2865,12 @@ function classifyStartError(error) {
|
|
|
3044
2865
|
}
|
|
3045
2866
|
function normalizeTranscriptionErrorCode(code) {
|
|
3046
2867
|
switch (code) {
|
|
2868
|
+
case "insufficient_credits":
|
|
2869
|
+
case "allowance_exhausted":
|
|
2870
|
+
case "monthly_model_cost_limit":
|
|
2871
|
+
case "unavailable":
|
|
2872
|
+
case "too_large":
|
|
2873
|
+
case "invalid_audio":
|
|
3047
2874
|
case "permission_denied":
|
|
3048
2875
|
case "not_supported":
|
|
3049
2876
|
case "network":
|
|
@@ -3057,19 +2884,20 @@ function normalizeTranscriptionErrorCode(code) {
|
|
|
3057
2884
|
return "unknown";
|
|
3058
2885
|
}
|
|
3059
2886
|
}
|
|
3060
|
-
function normalizeTranscriptionDiagnostic(diagnostic) {
|
|
2887
|
+
function normalizeTranscriptionDiagnostic(t, diagnostic) {
|
|
3061
2888
|
const source = isRecord2(diagnostic) ? diagnostic : {};
|
|
3062
2889
|
const operation = source.operation === "start" || source.operation === "session" || source.operation === "cancel" || source.operation === "close" ? source.operation : "session";
|
|
3063
|
-
const rawDetail = typeof source.detail === "string" ? source.detail : "
|
|
2890
|
+
const rawDetail = typeof source.detail === "string" ? source.detail : t("hooks.useTranscription.noDiagnosticDetail");
|
|
3064
2891
|
return {
|
|
3065
2892
|
operation,
|
|
3066
2893
|
code: normalizeTranscriptionErrorCode(source.code),
|
|
3067
2894
|
detail: rawDetail
|
|
3068
2895
|
};
|
|
3069
2896
|
}
|
|
3070
|
-
function detachSessionCleanup(session, options) {
|
|
2897
|
+
function detachSessionCleanup(t, session, options) {
|
|
3071
2898
|
if (options.cancelReason) {
|
|
3072
2899
|
void runBoundedCleanup(
|
|
2900
|
+
t,
|
|
3073
2901
|
"cancel",
|
|
3074
2902
|
() => session.cancel(options.cancelReason),
|
|
3075
2903
|
options.cleanupTimeoutMs,
|
|
@@ -3077,13 +2905,14 @@ function detachSessionCleanup(session, options) {
|
|
|
3077
2905
|
);
|
|
3078
2906
|
}
|
|
3079
2907
|
void runBoundedCleanup(
|
|
2908
|
+
t,
|
|
3080
2909
|
"close",
|
|
3081
2910
|
() => session.close(),
|
|
3082
2911
|
options.cleanupTimeoutMs,
|
|
3083
2912
|
options.reportDiagnostic
|
|
3084
2913
|
);
|
|
3085
2914
|
}
|
|
3086
|
-
async function runBoundedCleanup(operation, invoke, timeoutMs, reportDiagnostic) {
|
|
2915
|
+
async function runBoundedCleanup(t, operation, invoke, timeoutMs, reportDiagnostic) {
|
|
3087
2916
|
let timeoutId = null;
|
|
3088
2917
|
const result = Promise.resolve().then(invoke).then(
|
|
3089
2918
|
() => ({ kind: "settled" }),
|
|
@@ -3098,12 +2927,15 @@ async function runBoundedCleanup(operation, invoke, timeoutMs, reportDiagnostic)
|
|
|
3098
2927
|
reportDiagnostic({
|
|
3099
2928
|
operation,
|
|
3100
2929
|
code: outcome.kind === "timeout" ? "timeout" : "provider",
|
|
3101
|
-
detail: outcome.kind === "timeout" ?
|
|
2930
|
+
detail: outcome.kind === "timeout" ? t("hooks.useTranscription.transcriptionOperationExceededTimeoutmsMs", {
|
|
2931
|
+
operation,
|
|
2932
|
+
timeoutMs
|
|
2933
|
+
}) : diagnosticDetail(t, outcome.error)
|
|
3102
2934
|
});
|
|
3103
2935
|
}
|
|
3104
|
-
function diagnosticDetail(error) {
|
|
2936
|
+
function diagnosticDetail(t, error) {
|
|
3105
2937
|
if (error instanceof Error) return error.message;
|
|
3106
|
-
return typeof error === "string" ? error : "
|
|
2938
|
+
return typeof error === "string" ? error : t("hooks.useTranscription.unknownTranscriptionAdapterFailure");
|
|
3107
2939
|
}
|
|
3108
2940
|
function normalizeTimeout(value, fallback) {
|
|
3109
2941
|
return typeof value === "number" && Number.isFinite(value) && value >= 1 ? Math.min(Math.floor(value), 6e4) : fallback;
|
|
@@ -3143,7 +2975,7 @@ function transcriptionPolicyRevision(policy, selection) {
|
|
|
3143
2975
|
|
|
3144
2976
|
// src/hooks/use-voice-input.ts
|
|
3145
2977
|
import { OpenGeniApiError } from "@opengeni/sdk";
|
|
3146
|
-
import { useCallback as
|
|
2978
|
+
import { useCallback as useCallback4, useEffect as useEffect3, useRef as useRef4, useState as useState4 } from "react";
|
|
3147
2979
|
|
|
3148
2980
|
// src/voice-recording-owner.ts
|
|
3149
2981
|
var VOICE_RECORDING_OWNER_SESSION_KEY = "opengeni.voice-recording-owner.v1";
|
|
@@ -3206,6 +3038,21 @@ async function createUnderlyingOwnerLease() {
|
|
|
3206
3038
|
writeSessionOwnerId(ownerId);
|
|
3207
3039
|
return { ownerId, release: () => void 0 };
|
|
3208
3040
|
}
|
|
3041
|
+
async function liveVoiceRecordingOwnerIds() {
|
|
3042
|
+
if (!hasWebLocks() || typeof navigator.locks.query !== "function") return null;
|
|
3043
|
+
try {
|
|
3044
|
+
const snapshot = await navigator.locks.query();
|
|
3045
|
+
const live = /* @__PURE__ */ new Set();
|
|
3046
|
+
for (const lock of [...snapshot.held ?? [], ...snapshot.pending ?? []]) {
|
|
3047
|
+
if (lock.name?.startsWith(VOICE_RECORDING_OWNER_LOCK_PREFIX)) {
|
|
3048
|
+
live.add(lock.name.slice(VOICE_RECORDING_OWNER_LOCK_PREFIX.length));
|
|
3049
|
+
}
|
|
3050
|
+
}
|
|
3051
|
+
return live;
|
|
3052
|
+
} catch {
|
|
3053
|
+
return null;
|
|
3054
|
+
}
|
|
3055
|
+
}
|
|
3209
3056
|
function hasWebLocks() {
|
|
3210
3057
|
return typeof navigator !== "undefined" && navigator.locks !== null && navigator.locks !== void 0 && typeof navigator.locks.request === "function";
|
|
3211
3058
|
}
|
|
@@ -3327,6 +3174,7 @@ var VOICE_RECORDING_TIMESLICE_MILLISECONDS = 5e3;
|
|
|
3327
3174
|
var VOICE_RECORDING_OWNER_HEARTBEAT_MILLISECONDS = 5e3;
|
|
3328
3175
|
var VOICE_RECORDING_OWNER_STALE_MILLISECONDS = 3e4;
|
|
3329
3176
|
var VOICE_RECORDING_CLIENT_MAX_DURATION_SECONDS = 600;
|
|
3177
|
+
var VOICE_RECORDING_DISCARD_ON_CANCEL_MAX_MILLISECONDS = 3e3;
|
|
3330
3178
|
var VOICE_RECORDING_RESUMABLE_CLIENT_MAX_DURATION_SECONDS = 8 * 60 * 60;
|
|
3331
3179
|
var VOICE_RECORDING_RECOVERY_STATUS_POLL_MILLISECONDS = 2e3;
|
|
3332
3180
|
var VOICE_RECORDING_RECOVERY_MAX_MUTATION_DELAY_MILLISECONDS = 3e4;
|
|
@@ -3367,48 +3215,52 @@ function useVoiceInput({
|
|
|
3367
3215
|
now = currentDate,
|
|
3368
3216
|
automaticRetryDelayMilliseconds
|
|
3369
3217
|
}) {
|
|
3370
|
-
const [status, setStatus] =
|
|
3371
|
-
const [error, setError] =
|
|
3372
|
-
const [stream, setStream] =
|
|
3373
|
-
const [recordingId, setRecordingId] =
|
|
3374
|
-
const [durationSeconds, setDurationSeconds] =
|
|
3375
|
-
const [locallySaved, setLocallySaved] =
|
|
3376
|
-
const [storageAvailable, setStorageAvailable] =
|
|
3218
|
+
const [status, setStatus] = useState4("idle");
|
|
3219
|
+
const [error, setError] = useState4(null);
|
|
3220
|
+
const [stream, setStream] = useState4(null);
|
|
3221
|
+
const [recordingId, setRecordingId] = useState4(null);
|
|
3222
|
+
const [durationSeconds, setDurationSeconds] = useState4(0);
|
|
3223
|
+
const [locallySaved, setLocallySaved] = useState4(false);
|
|
3224
|
+
const [storageAvailable, setStorageAvailable] = useState4(
|
|
3377
3225
|
() => Boolean(createRecordingStore) || typeof globalThis.indexedDB !== "undefined"
|
|
3378
3226
|
);
|
|
3379
|
-
const createRecordingStoreRef =
|
|
3227
|
+
const createRecordingStoreRef = useRef4(createRecordingStore);
|
|
3380
3228
|
createRecordingStoreRef.current = createRecordingStore;
|
|
3381
|
-
const nowRef =
|
|
3229
|
+
const nowRef = useRef4(now);
|
|
3382
3230
|
nowRef.current = now;
|
|
3383
|
-
const readNow =
|
|
3384
|
-
const generationRef =
|
|
3385
|
-
const workspaceIdRef =
|
|
3386
|
-
const ownerIdRef =
|
|
3387
|
-
const ownerLeaseRef =
|
|
3388
|
-
const ownerIdPromiseRef =
|
|
3389
|
-
const createOwnerIdRef =
|
|
3390
|
-
const recorderRef =
|
|
3391
|
-
const streamRef =
|
|
3392
|
-
const timerRef =
|
|
3393
|
-
const
|
|
3394
|
-
const
|
|
3395
|
-
const
|
|
3396
|
-
const
|
|
3397
|
-
const
|
|
3398
|
-
const
|
|
3399
|
-
const
|
|
3400
|
-
const
|
|
3401
|
-
const
|
|
3402
|
-
const
|
|
3403
|
-
const
|
|
3404
|
-
const
|
|
3405
|
-
const
|
|
3406
|
-
const
|
|
3407
|
-
const
|
|
3231
|
+
const readNow = useCallback4(() => nowRef.current(), []);
|
|
3232
|
+
const generationRef = useRef4(0);
|
|
3233
|
+
const workspaceIdRef = useRef4(workspaceId);
|
|
3234
|
+
const ownerIdRef = useRef4(null);
|
|
3235
|
+
const ownerLeaseRef = useRef4(null);
|
|
3236
|
+
const ownerIdPromiseRef = useRef4(null);
|
|
3237
|
+
const createOwnerIdRef = useRef4(createOwnerId);
|
|
3238
|
+
const recorderRef = useRef4(null);
|
|
3239
|
+
const streamRef = useRef4(null);
|
|
3240
|
+
const timerRef = useRef4(null);
|
|
3241
|
+
const holdOnStopRef = useRef4(false);
|
|
3242
|
+
const recordingStartedAtRef = useRef4(0);
|
|
3243
|
+
const automaticRetryTimerRef = useRef4(null);
|
|
3244
|
+
const automaticRetryAttemptRef = useRef4(0);
|
|
3245
|
+
const ownerHeartbeatTimerRef = useRef4(null);
|
|
3246
|
+
const controllerRef = useRef4(null);
|
|
3247
|
+
const disabledRef = useRef4(disabled);
|
|
3248
|
+
const valueRef = useRef4(value);
|
|
3249
|
+
const storeRef = useRef4(null);
|
|
3250
|
+
const storePromiseRef = useRef4(null);
|
|
3251
|
+
const ownsStoreRef = useRef4(false);
|
|
3252
|
+
const manifestRef = useRef4(null);
|
|
3253
|
+
const persistenceQueueRef = useRef4(Promise.resolve());
|
|
3254
|
+
const persistenceErrorRef = useRef4(null);
|
|
3255
|
+
const captureLimitErrorRef = useRef4(null);
|
|
3256
|
+
const captureSettledRef = useRef4(Promise.resolve());
|
|
3257
|
+
const resolveCaptureSettledRef = useRef4(null);
|
|
3258
|
+
const statusRef = useRef4(status);
|
|
3408
3259
|
valueRef.current = value;
|
|
3409
3260
|
statusRef.current = status;
|
|
3261
|
+
disabledRef.current = disabled;
|
|
3410
3262
|
workspaceIdRef.current = workspaceId;
|
|
3411
|
-
const ensureOwnerId =
|
|
3263
|
+
const ensureOwnerId = useCallback4(async () => {
|
|
3412
3264
|
if (ownerIdRef.current) return ownerIdRef.current;
|
|
3413
3265
|
ownerIdPromiseRef.current ??= (async () => {
|
|
3414
3266
|
const injectedOwnerId = createOwnerIdRef.current?.();
|
|
@@ -3423,11 +3275,11 @@ function useVoiceInput({
|
|
|
3423
3275
|
})();
|
|
3424
3276
|
return await ownerIdPromiseRef.current;
|
|
3425
3277
|
}, []);
|
|
3426
|
-
const stopOwnerHeartbeat =
|
|
3278
|
+
const stopOwnerHeartbeat = useCallback4(() => {
|
|
3427
3279
|
if (ownerHeartbeatTimerRef.current) clearInterval(ownerHeartbeatTimerRef.current);
|
|
3428
3280
|
ownerHeartbeatTimerRef.current = null;
|
|
3429
3281
|
}, []);
|
|
3430
|
-
const clearCaptureRuntime =
|
|
3282
|
+
const clearCaptureRuntime = useCallback4((expectedStream) => {
|
|
3431
3283
|
const captureStream = expectedStream ?? streamRef.current;
|
|
3432
3284
|
captureStream?.getTracks().forEach((track) => track.stop());
|
|
3433
3285
|
if (expectedStream && streamRef.current !== expectedStream) return;
|
|
@@ -3437,7 +3289,7 @@ function useVoiceInput({
|
|
|
3437
3289
|
recorderRef.current = null;
|
|
3438
3290
|
setStream(null);
|
|
3439
3291
|
}, []);
|
|
3440
|
-
const clearVisibleRecording =
|
|
3292
|
+
const clearVisibleRecording = useCallback4(() => {
|
|
3441
3293
|
stopOwnerHeartbeat();
|
|
3442
3294
|
manifestRef.current = null;
|
|
3443
3295
|
setRecordingId(null);
|
|
@@ -3445,7 +3297,7 @@ function useVoiceInput({
|
|
|
3445
3297
|
setLocallySaved(false);
|
|
3446
3298
|
automaticRetryAttemptRef.current = 0;
|
|
3447
3299
|
}, [stopOwnerHeartbeat]);
|
|
3448
|
-
const ensureStore =
|
|
3300
|
+
const ensureStore = useCallback4(async () => {
|
|
3449
3301
|
if (storeRef.current) return storeRef.current;
|
|
3450
3302
|
if (!storePromiseRef.current) {
|
|
3451
3303
|
storePromiseRef.current = Promise.resolve().then(() => {
|
|
@@ -3465,13 +3317,13 @@ function useVoiceInput({
|
|
|
3465
3317
|
throw reason;
|
|
3466
3318
|
}
|
|
3467
3319
|
}, []);
|
|
3468
|
-
const rememberManifest =
|
|
3320
|
+
const rememberManifest = useCallback4((manifest) => {
|
|
3469
3321
|
manifestRef.current = manifest;
|
|
3470
3322
|
setRecordingId(manifest.recordingId);
|
|
3471
3323
|
setDurationSeconds(manifest.totalDurationMilliseconds / 1e3);
|
|
3472
3324
|
setLocallySaved(manifest.chunkCount > 0);
|
|
3473
3325
|
}, []);
|
|
3474
|
-
const beginOwnerHeartbeat =
|
|
3326
|
+
const beginOwnerHeartbeat = useCallback4(
|
|
3475
3327
|
(manifest) => {
|
|
3476
3328
|
stopOwnerHeartbeat();
|
|
3477
3329
|
ownerHeartbeatTimerRef.current = setInterval(() => {
|
|
@@ -3496,7 +3348,7 @@ function useVoiceInput({
|
|
|
3496
3348
|
},
|
|
3497
3349
|
[ensureStore, readNow, stopOwnerHeartbeat]
|
|
3498
3350
|
);
|
|
3499
|
-
const preserveForRetry =
|
|
3351
|
+
const preserveForRetry = useCallback4(
|
|
3500
3352
|
async (manifest, code, generation) => {
|
|
3501
3353
|
if (generation !== generationRef.current) return;
|
|
3502
3354
|
rememberManifest(manifest);
|
|
@@ -3507,7 +3359,7 @@ function useVoiceInput({
|
|
|
3507
3359
|
},
|
|
3508
3360
|
[focusInput, rememberManifest]
|
|
3509
3361
|
);
|
|
3510
|
-
const updateManifestBestEffort =
|
|
3362
|
+
const updateManifestBestEffort = useCallback4(
|
|
3511
3363
|
async (manifest, update) => {
|
|
3512
3364
|
try {
|
|
3513
3365
|
return await (await ensureStore()).updateManifest(
|
|
@@ -3522,20 +3374,22 @@ function useVoiceInput({
|
|
|
3522
3374
|
},
|
|
3523
3375
|
[ensureStore, readNow]
|
|
3524
3376
|
);
|
|
3525
|
-
const loadNextRecoverable =
|
|
3377
|
+
const loadNextRecoverable = useCallback4(
|
|
3526
3378
|
async (generation) => {
|
|
3527
3379
|
const active = () => generation === generationRef.current && workspaceIdRef.current === workspaceId;
|
|
3528
3380
|
const [store, ownerId] = await Promise.all([ensureStore(), ensureOwnerId()]);
|
|
3529
3381
|
if (!active()) return;
|
|
3530
|
-
const
|
|
3382
|
+
const heartbeatStaleBefore = new Date(
|
|
3531
3383
|
readNow().getTime() - VOICE_RECORDING_OWNER_STALE_MILLISECONDS
|
|
3532
3384
|
).toISOString();
|
|
3533
|
-
await store.cleanupHandedOffManifests({ ownerId, staleBefore }).catch(() => void 0);
|
|
3385
|
+
await store.cleanupHandedOffManifests({ ownerId, staleBefore: heartbeatStaleBefore }).catch(() => void 0);
|
|
3534
3386
|
if (!active()) return;
|
|
3535
|
-
const
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
})
|
|
3387
|
+
const liveOwners = createOwnerIdRef.current === void 0 ? await liveVoiceRecordingOwnerIds() : null;
|
|
3388
|
+
if (!active()) return;
|
|
3389
|
+
const staleBefore = liveOwners ? readNow().toISOString() : heartbeatStaleBefore;
|
|
3390
|
+
const manifests = (await store.listRecoverableManifests(workspaceId, { ownerId, staleBefore })).filter(
|
|
3391
|
+
(manifest) => !liveOwners || !manifest.ownerId || manifest.ownerId === ownerId || !liveOwners.has(manifest.ownerId) || !manifest.ownerHeartbeatAt || manifest.ownerHeartbeatAt <= heartbeatStaleBefore
|
|
3392
|
+
);
|
|
3539
3393
|
if (!active()) return;
|
|
3540
3394
|
for (const candidate of manifests) {
|
|
3541
3395
|
try {
|
|
@@ -3557,10 +3411,13 @@ function useVoiceInput({
|
|
|
3557
3411
|
}
|
|
3558
3412
|
rememberManifest(claimed);
|
|
3559
3413
|
beginOwnerHeartbeat(claimed);
|
|
3414
|
+
const transcriptReady = claimed.finalizationState === "transcript-ready" && claimed.transcriptText !== null;
|
|
3560
3415
|
setStatus(
|
|
3561
|
-
|
|
3416
|
+
transcriptReady ? "transcript-ready" : claimed.recoveryMode === "automatic" ? "retrying" : "recovered"
|
|
3417
|
+
);
|
|
3418
|
+
setError(
|
|
3419
|
+
transcriptReady && candidate.handoffMode === "append" ? "handoff_uncertain" : null
|
|
3562
3420
|
);
|
|
3563
|
-
setError(null);
|
|
3564
3421
|
return;
|
|
3565
3422
|
} catch (reason) {
|
|
3566
3423
|
if (reason instanceof VoiceRecordingOwnedError) continue;
|
|
@@ -3574,7 +3431,7 @@ function useVoiceInput({
|
|
|
3574
3431
|
},
|
|
3575
3432
|
[beginOwnerHeartbeat, ensureOwnerId, ensureStore, readNow, rememberManifest, workspaceId]
|
|
3576
3433
|
);
|
|
3577
|
-
const finalizePersistedRecording =
|
|
3434
|
+
const finalizePersistedRecording = useCallback4(
|
|
3578
3435
|
async (generation) => {
|
|
3579
3436
|
const manifest = manifestRef.current;
|
|
3580
3437
|
const resumable = capability?.resumable && isResumableVoiceInputClient(client) ? capability.resumable : null;
|
|
@@ -3651,10 +3508,14 @@ function useVoiceInput({
|
|
|
3651
3508
|
automaticRetryAttemptRef.current = 0;
|
|
3652
3509
|
if (ready.handoffMode === "explicit") {
|
|
3653
3510
|
setStatus("transcript-ready");
|
|
3654
|
-
setError(
|
|
3511
|
+
setError(null);
|
|
3655
3512
|
focusInput();
|
|
3656
3513
|
return;
|
|
3657
3514
|
}
|
|
3515
|
+
if (disabledRef.current) {
|
|
3516
|
+
setStatus("transcript-ready");
|
|
3517
|
+
return;
|
|
3518
|
+
}
|
|
3658
3519
|
const next = appendFinalTranscript(valueRef.current, response.text);
|
|
3659
3520
|
if (next !== valueRef.current) {
|
|
3660
3521
|
valueRef.current = next;
|
|
@@ -3728,10 +3589,10 @@ function useVoiceInput({
|
|
|
3728
3589
|
workspaceId
|
|
3729
3590
|
]
|
|
3730
3591
|
);
|
|
3731
|
-
const finalizePersistedRecordingRef =
|
|
3592
|
+
const finalizePersistedRecordingRef = useRef4(finalizePersistedRecording);
|
|
3732
3593
|
finalizePersistedRecordingRef.current = finalizePersistedRecording;
|
|
3733
3594
|
const clientAvailable = client !== null && client !== void 0;
|
|
3734
|
-
|
|
3595
|
+
useEffect3(() => {
|
|
3735
3596
|
if (status !== "retrying" || !manifestRef.current || manifestRef.current.recoveryMode !== "automatic" || manifestRef.current.workspaceId !== workspaceId || !clientAvailable || disabled || !enabled) {
|
|
3736
3597
|
return;
|
|
3737
3598
|
}
|
|
@@ -3766,7 +3627,7 @@ function useVoiceInput({
|
|
|
3766
3627
|
automaticRetryTimerRef.current = null;
|
|
3767
3628
|
};
|
|
3768
3629
|
}, [automaticRetryDelayMilliseconds, clientAvailable, disabled, enabled, status, workspaceId]);
|
|
3769
|
-
const stop =
|
|
3630
|
+
const stop = useCallback4(() => {
|
|
3770
3631
|
const recorder = recorderRef.current;
|
|
3771
3632
|
if (!recorder || recorder.state === "inactive") return;
|
|
3772
3633
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
@@ -3774,7 +3635,7 @@ function useVoiceInput({
|
|
|
3774
3635
|
setStatus("saving");
|
|
3775
3636
|
recorder.stop();
|
|
3776
3637
|
}, []);
|
|
3777
|
-
const start =
|
|
3638
|
+
const start = useCallback4(async () => {
|
|
3778
3639
|
if (disabled || !client || !enabled || !capability?.available || manifestRef.current !== null || status === "requesting-permission" || status === "recording" || status === "saving" || status === "transcribing" || status === "retrying" || !navigator.mediaDevices?.getUserMedia || typeof MediaRecorder === "undefined") {
|
|
3779
3640
|
return false;
|
|
3780
3641
|
}
|
|
@@ -3923,6 +3784,15 @@ function useVoiceInput({
|
|
|
3923
3784
|
await preserveForRetry(retained, attemptCaptureLimitError, generation);
|
|
3924
3785
|
return;
|
|
3925
3786
|
}
|
|
3787
|
+
if (holdOnStopRef.current) {
|
|
3788
|
+
holdOnStopRef.current = false;
|
|
3789
|
+
const retained = await updateManifestBestEffort(stopped, {
|
|
3790
|
+
recoveryMode: "manual",
|
|
3791
|
+
handoffMode: "explicit"
|
|
3792
|
+
});
|
|
3793
|
+
await preserveForRetry(retained, null, generation);
|
|
3794
|
+
return;
|
|
3795
|
+
}
|
|
3926
3796
|
await finalizePersistedRecording(generation);
|
|
3927
3797
|
});
|
|
3928
3798
|
};
|
|
@@ -3931,6 +3801,8 @@ function useVoiceInput({
|
|
|
3931
3801
|
resolveCaptureSettledRef.current = resolve;
|
|
3932
3802
|
});
|
|
3933
3803
|
attemptRecordingStartedAt = readNow().getTime();
|
|
3804
|
+
recordingStartedAtRef.current = attemptRecordingStartedAt;
|
|
3805
|
+
holdOnStopRef.current = false;
|
|
3934
3806
|
recorder.start(VOICE_RECORDING_TIMESLICE_MILLISECONDS);
|
|
3935
3807
|
recorderStarted = true;
|
|
3936
3808
|
setStatus("recording");
|
|
@@ -3999,7 +3871,7 @@ function useVoiceInput({
|
|
|
3999
3871
|
updateManifestBestEffort,
|
|
4000
3872
|
workspaceId
|
|
4001
3873
|
]);
|
|
4002
|
-
const retry =
|
|
3874
|
+
const retry = useCallback4(() => {
|
|
4003
3875
|
if (!manifestRef.current || manifestRef.current.finalizationState === "transcript-ready" || manifestRef.current.workspaceId !== workspaceId || !client || disabled || !enabled || status === "saving" || status === "transcribing") {
|
|
4004
3876
|
return;
|
|
4005
3877
|
}
|
|
@@ -4028,16 +3900,16 @@ function useVoiceInput({
|
|
|
4028
3900
|
updateManifestBestEffort,
|
|
4029
3901
|
workspaceId
|
|
4030
3902
|
]);
|
|
4031
|
-
const insertSavedTranscript =
|
|
3903
|
+
const insertSavedTranscript = useCallback4(async () => {
|
|
4032
3904
|
const manifest = manifestRef.current;
|
|
4033
|
-
if (!manifest || manifest.workspaceId !== workspaceId || manifest.finalizationState !== "transcript-ready" || manifest.transcriptText === null) {
|
|
3905
|
+
if (disabledRef.current || !manifest || manifest.workspaceId !== workspaceId || manifest.finalizationState !== "transcript-ready" || manifest.transcriptText === null) {
|
|
4034
3906
|
return;
|
|
4035
3907
|
}
|
|
4036
3908
|
const generation = ++generationRef.current;
|
|
4037
3909
|
controllerRef.current?.abort();
|
|
4038
3910
|
controllerRef.current = null;
|
|
4039
3911
|
const store = await ensureStore();
|
|
4040
|
-
if (generation !== generationRef.current) return;
|
|
3912
|
+
if (generation !== generationRef.current || disabledRef.current) return;
|
|
4041
3913
|
const next = appendFinalTranscript(valueRef.current, manifest.transcriptText);
|
|
4042
3914
|
if (next !== valueRef.current) {
|
|
4043
3915
|
valueRef.current = next;
|
|
@@ -4083,7 +3955,7 @@ function useVoiceInput({
|
|
|
4083
3955
|
setValue,
|
|
4084
3956
|
workspaceId
|
|
4085
3957
|
]);
|
|
4086
|
-
const discard =
|
|
3958
|
+
const discard = useCallback4(async () => {
|
|
4087
3959
|
const manifest = manifestRef.current;
|
|
4088
3960
|
const generation = ++generationRef.current;
|
|
4089
3961
|
controllerRef.current?.abort();
|
|
@@ -4131,8 +4003,22 @@ function useVoiceInput({
|
|
|
4131
4003
|
rememberManifest,
|
|
4132
4004
|
workspaceId
|
|
4133
4005
|
]);
|
|
4134
|
-
const cancel =
|
|
4135
|
-
if (status === "recording"
|
|
4006
|
+
const cancel = useCallback4(() => {
|
|
4007
|
+
if (status === "recording") {
|
|
4008
|
+
const recorder = recorderRef.current;
|
|
4009
|
+
const elapsed = readNow().getTime() - recordingStartedAtRef.current;
|
|
4010
|
+
if (recorder && recorder.state !== "inactive" && elapsed >= VOICE_RECORDING_DISCARD_ON_CANCEL_MAX_MILLISECONDS) {
|
|
4011
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
4012
|
+
timerRef.current = null;
|
|
4013
|
+
holdOnStopRef.current = true;
|
|
4014
|
+
setStatus("saving");
|
|
4015
|
+
recorder.stop();
|
|
4016
|
+
return;
|
|
4017
|
+
}
|
|
4018
|
+
void discard();
|
|
4019
|
+
return;
|
|
4020
|
+
}
|
|
4021
|
+
if (status === "requesting-permission") {
|
|
4136
4022
|
void discard();
|
|
4137
4023
|
return;
|
|
4138
4024
|
}
|
|
@@ -4156,8 +4042,8 @@ function useVoiceInput({
|
|
|
4156
4042
|
await preserveForRetry(retained, null, generation);
|
|
4157
4043
|
});
|
|
4158
4044
|
}
|
|
4159
|
-
}, [discard, preserveForRetry, status, updateManifestBestEffort]);
|
|
4160
|
-
|
|
4045
|
+
}, [discard, preserveForRetry, readNow, status, updateManifestBestEffort]);
|
|
4046
|
+
useEffect3(() => {
|
|
4161
4047
|
const current = manifestRef.current;
|
|
4162
4048
|
const generation = ++generationRef.current;
|
|
4163
4049
|
if (current && current.workspaceId !== workspaceId) {
|
|
@@ -4207,9 +4093,10 @@ function useVoiceInput({
|
|
|
4207
4093
|
readNow,
|
|
4208
4094
|
workspaceId
|
|
4209
4095
|
]);
|
|
4210
|
-
|
|
4096
|
+
useEffect3(() => {
|
|
4211
4097
|
const onKeyDown = (event) => {
|
|
4212
|
-
if (event.key === "Escape" &&
|
|
4098
|
+
if (event.key === "Escape" && // A dialog, menu, or popover that handled Escape owns it.
|
|
4099
|
+
!event.defaultPrevented && (status === "requesting-permission" || status === "recording" || status === "saving" || status === "transcribing" || status === "retrying")) {
|
|
4213
4100
|
event.preventDefault();
|
|
4214
4101
|
cancel();
|
|
4215
4102
|
}
|
|
@@ -4217,7 +4104,7 @@ function useVoiceInput({
|
|
|
4217
4104
|
document.addEventListener("keydown", onKeyDown);
|
|
4218
4105
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
4219
4106
|
}, [cancel, status]);
|
|
4220
|
-
|
|
4107
|
+
useEffect3(
|
|
4221
4108
|
() => () => {
|
|
4222
4109
|
generationRef.current += 1;
|
|
4223
4110
|
controllerRef.current?.abort();
|
|
@@ -4226,6 +4113,16 @@ function useVoiceInput({
|
|
|
4226
4113
|
automaticRetryTimerRef.current = null;
|
|
4227
4114
|
const manifest = manifestRef.current;
|
|
4228
4115
|
const ownerReady = ownerIdPromiseRef.current;
|
|
4116
|
+
const knownOwnerId = ownerIdRef.current;
|
|
4117
|
+
const ownerLease = ownerLeaseRef.current;
|
|
4118
|
+
const closingStore = storeRef.current;
|
|
4119
|
+
const ownsClosingStore = ownsStoreRef.current;
|
|
4120
|
+
storeRef.current = null;
|
|
4121
|
+
storePromiseRef.current = null;
|
|
4122
|
+
ownerIdRef.current = null;
|
|
4123
|
+
ownerIdPromiseRef.current = null;
|
|
4124
|
+
ownerLeaseRef.current = null;
|
|
4125
|
+
manifestRef.current = null;
|
|
4229
4126
|
stopOwnerHeartbeat();
|
|
4230
4127
|
const recorder = recorderRef.current;
|
|
4231
4128
|
let captureSettled = persistenceQueueRef.current;
|
|
@@ -4235,8 +4132,8 @@ function useVoiceInput({
|
|
|
4235
4132
|
}
|
|
4236
4133
|
clearCaptureRuntime();
|
|
4237
4134
|
void captureSettled.catch(() => void 0).then(async () => {
|
|
4238
|
-
const ownerId =
|
|
4239
|
-
const store =
|
|
4135
|
+
const ownerId = knownOwnerId ?? (ownerReady ? await ownerReady.catch(() => null) : null);
|
|
4136
|
+
const store = closingStore;
|
|
4240
4137
|
if (store && manifest && ownerId) {
|
|
4241
4138
|
const wasProcessing = statusRef.current === "saving" || statusRef.current === "transcribing" || statusRef.current === "retrying";
|
|
4242
4139
|
await store.updateManifest(
|
|
@@ -4256,10 +4153,9 @@ function useVoiceInput({
|
|
|
4256
4153
|
ownerId
|
|
4257
4154
|
).catch(() => void 0);
|
|
4258
4155
|
}
|
|
4259
|
-
if (
|
|
4156
|
+
if (ownsClosingStore) await store?.close();
|
|
4260
4157
|
}).catch(() => void 0).finally(() => {
|
|
4261
|
-
|
|
4262
|
-
ownerLeaseRef.current = null;
|
|
4158
|
+
ownerLease?.release();
|
|
4263
4159
|
});
|
|
4264
4160
|
},
|
|
4265
4161
|
[clearCaptureRuntime, readNow, stopOwnerHeartbeat]
|
|
@@ -4271,6 +4167,11 @@ function useVoiceInput({
|
|
|
4271
4167
|
stream,
|
|
4272
4168
|
recordingId,
|
|
4273
4169
|
durationSeconds,
|
|
4170
|
+
recordingStartedAt: status === "recording" ? recordingStartedAtRef.current || null : null,
|
|
4171
|
+
maxRecordingSeconds: capability ? Math.min(
|
|
4172
|
+
capability.resumable && isResumableVoiceInputClient(client) ? capability.resumable.maxDurationSeconds : capability.maxDurationSeconds,
|
|
4173
|
+
capability.resumable && isResumableVoiceInputClient(client) ? VOICE_RECORDING_RESUMABLE_CLIENT_MAX_DURATION_SECONDS : VOICE_RECORDING_CLIENT_MAX_DURATION_SECONDS
|
|
4174
|
+
) : null,
|
|
4274
4175
|
locallySaved,
|
|
4275
4176
|
hasRecoverableRecording: manifestRef.current !== null && status !== "recording",
|
|
4276
4177
|
savedTranscript: manifestRef.current?.finalizationState === "transcript-ready" ? manifestRef.current.transcriptText : null,
|
|
@@ -4483,6 +4384,10 @@ function errorCode(error) {
|
|
|
4483
4384
|
return "unknown";
|
|
4484
4385
|
}
|
|
4485
4386
|
function isRetryableVoiceInputError(error) {
|
|
4387
|
+
if (["insufficient_credits", "allowance_exhausted", "monthly_model_cost_limit"].includes(
|
|
4388
|
+
errorCode(error)
|
|
4389
|
+
))
|
|
4390
|
+
return false;
|
|
4486
4391
|
if (error instanceof OpenGeniApiError) {
|
|
4487
4392
|
return error.retryable && error.status !== 409;
|
|
4488
4393
|
}
|
|
@@ -4499,46 +4404,53 @@ import {
|
|
|
4499
4404
|
LoaderCircleIcon as LoaderCircleIcon2,
|
|
4500
4405
|
MicIcon,
|
|
4501
4406
|
RefreshCwIcon,
|
|
4502
|
-
SquareIcon,
|
|
4407
|
+
SquareIcon as SquareIcon2,
|
|
4503
4408
|
Trash2Icon,
|
|
4504
|
-
XIcon as
|
|
4409
|
+
XIcon as XIcon2
|
|
4505
4410
|
} from "lucide-react";
|
|
4506
|
-
import { AnimatePresence as
|
|
4507
|
-
import { useEffect as
|
|
4508
|
-
import { Fragment as
|
|
4411
|
+
import { AnimatePresence as AnimatePresence3, motion as motion3 } from "motion/react";
|
|
4412
|
+
import { useEffect as useEffect4, useState as useState5 } from "react";
|
|
4413
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
4509
4414
|
function Tip({ tip, children }) {
|
|
4510
|
-
return /* @__PURE__ */
|
|
4511
|
-
/* @__PURE__ */
|
|
4512
|
-
/* @__PURE__ */
|
|
4415
|
+
return /* @__PURE__ */ jsxs4(Tooltip, { children: [
|
|
4416
|
+
/* @__PURE__ */ jsx4(TooltipTrigger, { asChild: true, children }),
|
|
4417
|
+
/* @__PURE__ */ jsx4(TooltipContent, { side: "top", children: tip })
|
|
4513
4418
|
] });
|
|
4514
4419
|
}
|
|
4515
|
-
var defaultMessages = {
|
|
4516
|
-
start: "
|
|
4517
|
-
stop: "
|
|
4518
|
-
cancel: "
|
|
4519
|
-
retry: "
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4420
|
+
var defaultMessages = (t) => ({
|
|
4421
|
+
start: t("composerTranscriptionControl.startVoiceInput"),
|
|
4422
|
+
stop: t("composerTranscriptionControl.stopAndTranscribe"),
|
|
4423
|
+
cancel: t("composerTranscriptionControl.stopWithoutTranscribing"),
|
|
4424
|
+
retry: t("composerTranscriptionControl.retryVoiceInput"),
|
|
4425
|
+
transcribeSaved: t("composerTranscriptionControl.transcribeSavedRecording"),
|
|
4426
|
+
timeRemaining: t("composerTranscriptionControl.stopsAndTranscribesInSeconds", {
|
|
4427
|
+
seconds: "{seconds}"
|
|
4428
|
+
}),
|
|
4429
|
+
pauseRetrying: t("composerTranscriptionControl.pauseAutomaticRetry"),
|
|
4430
|
+
requestingPermission: t("composerTranscriptionControl.requestingMicrophone"),
|
|
4431
|
+
recording: t("composerTranscriptionControl.recordingPressEscapeToStop"),
|
|
4432
|
+
saving: t("composerTranscriptionControl.savingAudioLocally"),
|
|
4433
|
+
transcribing: t("composerTranscriptionControl.transcribing"),
|
|
4434
|
+
retrying: t("composerTranscriptionControl.savedRetryingTranscription"),
|
|
4435
|
+
recovered: t("composerTranscriptionControl.recordingSavedOnThisDevice"),
|
|
4436
|
+
recoveredTranscript: t("composerTranscriptionControl.transcriptSavedInsertItInto"),
|
|
4437
|
+
insertRecoveredTranscript: t("composerTranscriptionControl.insertSavedTranscript"),
|
|
4438
|
+
discardRecovered: t("composerTranscriptionControl.discardSavedRecording"),
|
|
4439
|
+
unavailableDisabled: t("composerTranscriptionControl.voiceInputIsUnavailableWhile"),
|
|
4440
|
+
unavailable: t("composerTranscriptionControl.voiceInputIsUnavailableFor"),
|
|
4441
|
+
errorPermissionDenied: t("composerTranscriptionControl.microphoneAccessIsBlockedAllow"),
|
|
4442
|
+
errorNotSupported: t("composerTranscriptionControl.voiceInputIsNotSupported"),
|
|
4443
|
+
errorUnavailable: t("composerTranscriptionControl.voiceInputIsNotConfigured"),
|
|
4444
|
+
errorInsufficientCredits: t("composerTranscriptionControl.voiceInputNeedsCreditsRecording"),
|
|
4445
|
+
errorAllowanceExhausted: t("composerTranscriptionControl.usageLimitReachedRecordingSaved"),
|
|
4446
|
+
errorPolicyBlocked: t("composerTranscriptionControl.voiceInputIsnTAllowed"),
|
|
4447
|
+
errorTooLarge: t("composerTranscriptionControl.recordingIsTooLargeTry"),
|
|
4448
|
+
errorInvalidAudio: t("composerTranscriptionControl.theRecordingCouldNotBe"),
|
|
4449
|
+
errorStorageUnavailable: t("composerTranscriptionControl.voiceInputStoppedBecauseAudio"),
|
|
4450
|
+
errorRetryable: t("composerTranscriptionControl.savedTranscriptionFailedRetryWhen"),
|
|
4451
|
+
errorHandoffUncertain: t("composerTranscriptionControl.transcriptSavedCheckYourDraft"),
|
|
4452
|
+
errorUnknown: t("composerTranscriptionControl.voiceInputCouldNotStart")
|
|
4453
|
+
});
|
|
4542
4454
|
var WAVEFORM_BARS = 18;
|
|
4543
4455
|
var WAVEFORM_BAR_KEYS = Array.from(
|
|
4544
4456
|
{ length: WAVEFORM_BARS },
|
|
@@ -4555,8 +4467,9 @@ function ComposerTranscriptionControl({
|
|
|
4555
4467
|
createOwnerId,
|
|
4556
4468
|
suppressed = false
|
|
4557
4469
|
}) {
|
|
4470
|
+
const t = useOpenGeniText();
|
|
4558
4471
|
const composer = useChatComposer();
|
|
4559
|
-
const messages = { ...defaultMessages, ...overrides };
|
|
4472
|
+
const messages = { ...defaultMessages(t), ...overrides };
|
|
4560
4473
|
const transcription = useVoiceInput({
|
|
4561
4474
|
client,
|
|
4562
4475
|
workspaceId,
|
|
@@ -4573,28 +4486,36 @@ function ComposerTranscriptionControl({
|
|
|
4573
4486
|
const retrying = status === "retrying";
|
|
4574
4487
|
const capturing = status === "requesting-permission" || status === "recording";
|
|
4575
4488
|
const cancelTranscription = transcription.cancel;
|
|
4576
|
-
|
|
4489
|
+
const discardTranscription = transcription.discard;
|
|
4490
|
+
const hasRecoverableRecording = transcription.hasRecoverableRecording;
|
|
4491
|
+
useEffect4(() => {
|
|
4577
4492
|
if (!suppressed) return;
|
|
4578
4493
|
if (status === "recording" || status === "requesting-permission") {
|
|
4579
4494
|
cancelTranscription();
|
|
4495
|
+
} else if (status === "error" && !hasRecoverableRecording) {
|
|
4496
|
+
void discardTranscription();
|
|
4580
4497
|
}
|
|
4581
|
-
}, [cancelTranscription, status, suppressed]);
|
|
4498
|
+
}, [cancelTranscription, discardTranscription, hasRecoverableRecording, status, suppressed]);
|
|
4582
4499
|
const active = capturing || status === "saving" || status === "transcribing";
|
|
4583
4500
|
const recoverable = transcription.hasRecoverableRecording && (retrying || status === "recovered" || status === "transcript-ready" || status === "error");
|
|
4584
4501
|
const savedTranscript = status === "transcript-ready" && transcription.savedTranscript !== null;
|
|
4585
4502
|
const unavailableMessage = composer.disabled ? messages.unavailableDisabled : !capability?.available || !workspaceEnabled ? messages.unavailable : !transcription.available ? messages.errorStorageUnavailable : null;
|
|
4586
4503
|
const idleLabel = unavailableMessage ?? (status === "error" ? messages.retry : messages.start);
|
|
4587
|
-
const
|
|
4588
|
-
const announcement = status === "requesting-permission" ? messages.requestingPermission : status === "recording" ? messages.recording : status === "saving" ? messages.saving : status === "transcribing" ? messages.transcribing : retrying ? messages.retrying : status === "recovered" ? messages.recovered : status === "transcript-ready" ? messages.recoveredTranscript : status === "error" ?
|
|
4504
|
+
const errorMessage = transcription.error ? transcriptionErrorMessage(transcription.error, messages) : null;
|
|
4505
|
+
const announcement = status === "requesting-permission" ? messages.requestingPermission : status === "recording" ? messages.recording : status === "saving" ? messages.saving : status === "transcribing" ? messages.transcribing : retrying ? messages.retrying : status === "recovered" ? messages.recovered : status === "transcript-ready" ? messages.recoveredTranscript : status === "error" ? errorMessage ?? messages.errorUnknown : unavailableMessage;
|
|
4506
|
+
const recoveredLabel = savedTranscript ? errorMessage ?? messages.recoveredTranscript : retrying ? messages.retrying : status === "error" ? errorMessage ?? messages.errorRetryable : messages.recovered;
|
|
4589
4507
|
function start(event) {
|
|
4590
4508
|
if (unavailableMessage) {
|
|
4591
4509
|
event.preventDefault();
|
|
4592
4510
|
return;
|
|
4593
4511
|
}
|
|
4512
|
+
composerVoiceEventScope(event.currentTarget)?.dispatchEvent(
|
|
4513
|
+
new Event(COMPOSER_VOICE_INPUT_START_EVENT)
|
|
4514
|
+
);
|
|
4594
4515
|
void transcription.start();
|
|
4595
4516
|
}
|
|
4596
|
-
return /* @__PURE__ */
|
|
4597
|
-
|
|
4517
|
+
return /* @__PURE__ */ jsx4(AnimatePresence3, { initial: false, children: suppressed ? null : /* @__PURE__ */ jsx4(
|
|
4518
|
+
motion3.span,
|
|
4598
4519
|
{
|
|
4599
4520
|
initial: { opacity: 0, width: 0 },
|
|
4600
4521
|
animate: { opacity: 1, width: "auto" },
|
|
@@ -4609,9 +4530,10 @@ function ComposerTranscriptionControl({
|
|
|
4609
4530
|
),
|
|
4610
4531
|
"data-transcription-status": status,
|
|
4611
4532
|
"data-transcription-capturing": capturing ? "" : void 0,
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4533
|
+
"data-transcription-attention": !capturing && (recoverable || status === "error" && errorMessage) ? "" : void 0,
|
|
4534
|
+
children: /* @__PURE__ */ jsxs4("span", { className: "inline-flex min-w-0 items-center gap-1.5", children: [
|
|
4535
|
+
/* @__PURE__ */ jsx4(AnimatePresence3, { mode: "popLayout", initial: false, children: recoverable ? /* @__PURE__ */ jsxs4(
|
|
4536
|
+
motion3.span,
|
|
4615
4537
|
{
|
|
4616
4538
|
initial: { opacity: 0, scale: 0.96 },
|
|
4617
4539
|
animate: { opacity: 1, scale: 1 },
|
|
@@ -4622,46 +4544,55 @@ function ComposerTranscriptionControl({
|
|
|
4622
4544
|
"bg-og-surface-2/70 pl-2 pr-1 pointer-coarse:h-11"
|
|
4623
4545
|
),
|
|
4624
4546
|
children: [
|
|
4625
|
-
/* @__PURE__ */
|
|
4626
|
-
|
|
4547
|
+
/* @__PURE__ */ jsx4(
|
|
4548
|
+
"span",
|
|
4549
|
+
{
|
|
4550
|
+
title: recoveredLabel,
|
|
4551
|
+
className: "og-transcription-recovered-label max-w-56 line-clamp-2 text-og-xs leading-tight text-og-fg-muted max-sm:max-w-32",
|
|
4552
|
+
children: recoveredLabel
|
|
4553
|
+
}
|
|
4554
|
+
),
|
|
4555
|
+
/* @__PURE__ */ jsx4(
|
|
4627
4556
|
Tip,
|
|
4628
4557
|
{
|
|
4629
|
-
tip: savedTranscript ? messages.insertRecoveredTranscript : retrying ? messages.pauseRetrying : messages.retry,
|
|
4630
|
-
children: /* @__PURE__ */
|
|
4558
|
+
tip: savedTranscript ? messages.insertRecoveredTranscript : retrying ? messages.pauseRetrying : status === "recovered" ? messages.transcribeSaved : messages.retry,
|
|
4559
|
+
children: /* @__PURE__ */ jsx4(
|
|
4631
4560
|
"button",
|
|
4632
4561
|
{
|
|
4633
4562
|
type: "button",
|
|
4563
|
+
disabled: composer.disabled && !retrying,
|
|
4634
4564
|
onClick: () => savedTranscript ? void transcription.insertSavedTranscript() : retrying ? transcription.cancel() : transcription.retry(),
|
|
4635
|
-
"aria-label": savedTranscript ? messages.insertRecoveredTranscript : retrying ? messages.pauseRetrying : messages.retry,
|
|
4565
|
+
"aria-label": savedTranscript ? messages.insertRecoveredTranscript : retrying ? messages.pauseRetrying : status === "recovered" ? messages.transcribeSaved : messages.retry,
|
|
4636
4566
|
className: cn(
|
|
4637
4567
|
"inline-flex size-7 shrink-0 items-center justify-center rounded-og-sm",
|
|
4638
|
-
"bg-og-
|
|
4639
|
-
"
|
|
4568
|
+
"border border-og-primary-border bg-og-primary text-og-primary-fg hover:bg-og-primary-hover transition-colors duration-150 motion-reduce:transition-none",
|
|
4569
|
+
"disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:size-11"
|
|
4640
4570
|
),
|
|
4641
|
-
children: savedTranscript ? /* @__PURE__ */
|
|
4571
|
+
children: savedTranscript ? /* @__PURE__ */ jsx4(ClipboardPasteIcon, { className: "size-3.5" }) : retrying ? /* @__PURE__ */ jsx4(SquareIcon2, { className: "size-3.5" }) : /* @__PURE__ */ jsx4(RefreshCwIcon, { className: "size-3.5" })
|
|
4642
4572
|
}
|
|
4643
4573
|
)
|
|
4644
4574
|
}
|
|
4645
4575
|
),
|
|
4646
|
-
/* @__PURE__ */
|
|
4576
|
+
/* @__PURE__ */ jsx4(Tip, { tip: messages.discardRecovered, children: /* @__PURE__ */ jsx4(
|
|
4647
4577
|
"button",
|
|
4648
4578
|
{
|
|
4649
4579
|
type: "button",
|
|
4580
|
+
disabled: composer.disabled,
|
|
4650
4581
|
onClick: () => void transcription.discard(),
|
|
4651
4582
|
"aria-label": messages.discardRecovered,
|
|
4652
4583
|
className: cn(
|
|
4653
4584
|
"inline-flex size-7 shrink-0 items-center justify-center rounded-og-sm",
|
|
4654
4585
|
"text-og-fg-muted transition-colors duration-150 motion-reduce:transition-none",
|
|
4655
|
-
"hover:bg-og-surface-3 hover:text-og-status-failed pointer-coarse:size-11"
|
|
4586
|
+
"hover:bg-og-surface-3 hover:text-og-status-failed disabled:cursor-not-allowed disabled:opacity-50 pointer-coarse:size-11"
|
|
4656
4587
|
),
|
|
4657
|
-
children: /* @__PURE__ */
|
|
4588
|
+
children: /* @__PURE__ */ jsx4(Trash2Icon, { className: "size-3.5" })
|
|
4658
4589
|
}
|
|
4659
4590
|
) })
|
|
4660
4591
|
]
|
|
4661
4592
|
},
|
|
4662
4593
|
"recovered"
|
|
4663
|
-
) : active ? /* @__PURE__ */
|
|
4664
|
-
|
|
4594
|
+
) : active ? /* @__PURE__ */ jsxs4(
|
|
4595
|
+
motion3.span,
|
|
4665
4596
|
{
|
|
4666
4597
|
initial: { opacity: 0, scale: 0.96 },
|
|
4667
4598
|
animate: { opacity: 1, scale: 1 },
|
|
@@ -4672,30 +4603,38 @@ function ComposerTranscriptionControl({
|
|
|
4672
4603
|
"bg-og-surface-2/70 pl-2 pr-1 pointer-coarse:h-11"
|
|
4673
4604
|
),
|
|
4674
4605
|
children: [
|
|
4675
|
-
status === "requesting-permission" ? /* @__PURE__ */
|
|
4606
|
+
status === "requesting-permission" ? /* @__PURE__ */ jsx4(
|
|
4676
4607
|
LoaderCircleIcon2,
|
|
4677
4608
|
{
|
|
4678
4609
|
className: "size-3.5 shrink-0 text-og-fg-muted animate-og-spin motion-reduce:animate-none",
|
|
4679
4610
|
"aria-hidden": true
|
|
4680
4611
|
}
|
|
4681
|
-
) : /* @__PURE__ */
|
|
4682
|
-
status === "recording" ? /* @__PURE__ */
|
|
4612
|
+
) : /* @__PURE__ */ jsxs4("span", { className: "flex items-center gap-1.5", children: [
|
|
4613
|
+
status === "recording" ? /* @__PURE__ */ jsx4(
|
|
4683
4614
|
"span",
|
|
4684
4615
|
{
|
|
4685
4616
|
"aria-hidden": true,
|
|
4686
4617
|
className: "size-1.5 shrink-0 rounded-full bg-og-status-failed animate-og-pulse motion-reduce:animate-none"
|
|
4687
4618
|
}
|
|
4688
4619
|
) : null,
|
|
4689
|
-
/* @__PURE__ */
|
|
4620
|
+
/* @__PURE__ */ jsx4(
|
|
4690
4621
|
VoiceWaveform,
|
|
4691
4622
|
{
|
|
4692
4623
|
stream: status === "recording" ? transcription.stream : null,
|
|
4693
4624
|
mode: status === "recording" ? "recording" : "transcribing"
|
|
4694
4625
|
}
|
|
4695
|
-
)
|
|
4626
|
+
),
|
|
4627
|
+
status === "recording" && transcription.recordingStartedAt !== null ? /* @__PURE__ */ jsx4(
|
|
4628
|
+
RecordingClock,
|
|
4629
|
+
{
|
|
4630
|
+
startedAt: transcription.recordingStartedAt,
|
|
4631
|
+
maxSeconds: transcription.maxRecordingSeconds,
|
|
4632
|
+
remainingLabel: messages.timeRemaining
|
|
4633
|
+
}
|
|
4634
|
+
) : null
|
|
4696
4635
|
] }),
|
|
4697
|
-
status === "recording" ? /* @__PURE__ */
|
|
4698
|
-
/* @__PURE__ */
|
|
4636
|
+
status === "recording" ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
4637
|
+
/* @__PURE__ */ jsx4(Tip, { tip: messages.cancel, children: /* @__PURE__ */ jsx4(
|
|
4699
4638
|
"button",
|
|
4700
4639
|
{
|
|
4701
4640
|
type: "button",
|
|
@@ -4707,10 +4646,10 @@ function ComposerTranscriptionControl({
|
|
|
4707
4646
|
"text-og-fg-muted transition-colors duration-150 motion-reduce:transition-none",
|
|
4708
4647
|
"hover:bg-og-surface-3 hover:text-og-fg pointer-coarse:size-11"
|
|
4709
4648
|
),
|
|
4710
|
-
children: /* @__PURE__ */
|
|
4649
|
+
children: /* @__PURE__ */ jsx4(XIcon2, { className: "size-3.5" })
|
|
4711
4650
|
}
|
|
4712
4651
|
) }),
|
|
4713
|
-
/* @__PURE__ */
|
|
4652
|
+
/* @__PURE__ */ jsx4(Tip, { tip: messages.stop, children: /* @__PURE__ */ jsx4(
|
|
4714
4653
|
"button",
|
|
4715
4654
|
{
|
|
4716
4655
|
type: "button",
|
|
@@ -4718,18 +4657,18 @@ function ComposerTranscriptionControl({
|
|
|
4718
4657
|
"aria-label": messages.stop,
|
|
4719
4658
|
className: cn(
|
|
4720
4659
|
"inline-flex size-7 shrink-0 items-center justify-center rounded-og-sm",
|
|
4721
|
-
"bg-og-
|
|
4722
|
-
"
|
|
4660
|
+
"border border-og-primary-border bg-og-primary text-og-primary-fg hover:bg-og-primary-hover",
|
|
4661
|
+
"transition-colors duration-150 motion-reduce:transition-none pointer-coarse:size-11"
|
|
4723
4662
|
),
|
|
4724
|
-
children: /* @__PURE__ */
|
|
4663
|
+
children: /* @__PURE__ */ jsx4(SquareIcon2, { className: "size-2.5 fill-current" })
|
|
4725
4664
|
}
|
|
4726
4665
|
) })
|
|
4727
|
-
] }) : status === "transcribing" || status === "saving" ? /* @__PURE__ */
|
|
4666
|
+
] }) : status === "transcribing" || status === "saving" ? /* @__PURE__ */ jsx4("span", { className: "og-shimmer-text px-1.5 text-og-xs font-medium whitespace-nowrap", children: status === "saving" ? messages.saving : messages.transcribing }) : /* @__PURE__ */ jsx4("span", { className: "px-1.5 text-og-xs text-og-fg-muted whitespace-nowrap", children: messages.requestingPermission })
|
|
4728
4667
|
]
|
|
4729
4668
|
},
|
|
4730
4669
|
status === "transcribing" || status === "saving" ? "processing" : "capture"
|
|
4731
|
-
) : /* @__PURE__ */
|
|
4732
|
-
|
|
4670
|
+
) : /* @__PURE__ */ jsx4(Tip, { tip: idleLabel, children: /* @__PURE__ */ jsx4(
|
|
4671
|
+
motion3.button,
|
|
4733
4672
|
{
|
|
4734
4673
|
type: "button",
|
|
4735
4674
|
"data-og-composer-dictate": true,
|
|
@@ -4746,18 +4685,30 @@ function ComposerTranscriptionControl({
|
|
|
4746
4685
|
"text-og-fg-muted transition-colors duration-150 motion-reduce:transition-none",
|
|
4747
4686
|
unavailableMessage ? "cursor-not-allowed opacity-45" : "hover:bg-og-surface-2 hover:text-og-fg"
|
|
4748
4687
|
),
|
|
4749
|
-
children: /* @__PURE__ */
|
|
4688
|
+
children: /* @__PURE__ */ jsx4(MicIcon, { className: "size-4" })
|
|
4750
4689
|
}
|
|
4751
4690
|
) }, "idle") }),
|
|
4752
|
-
status === "error" &&
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
"
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4691
|
+
status === "error" && errorMessage && !recoverable ? (
|
|
4692
|
+
// Nothing is saved in this state, so dismissing loses no speech.
|
|
4693
|
+
/* @__PURE__ */ jsxs4(
|
|
4694
|
+
"button",
|
|
4695
|
+
{
|
|
4696
|
+
type: "button",
|
|
4697
|
+
title: errorMessage,
|
|
4698
|
+
"aria-label": t("composerTranscriptionControl.dismissErrormessage", { errorMessage }),
|
|
4699
|
+
onClick: () => void transcription.discard(),
|
|
4700
|
+
className: cn(
|
|
4701
|
+
"inline-flex min-w-0 items-center gap-1 rounded-og-sm text-left outline-hidden",
|
|
4702
|
+
"text-og-status-failed focus-visible:ring-2 focus-visible:ring-og-accent/45"
|
|
4703
|
+
),
|
|
4704
|
+
children: [
|
|
4705
|
+
/* @__PURE__ */ jsx4("span", { className: "og-transcription-error-label max-w-56 line-clamp-2 text-og-xs leading-tight max-sm:max-w-32", children: errorMessage }),
|
|
4706
|
+
/* @__PURE__ */ jsx4(XIcon2, { className: "size-3 shrink-0 opacity-70", "aria-hidden": true })
|
|
4707
|
+
]
|
|
4708
|
+
}
|
|
4709
|
+
)
|
|
4710
|
+
) : null,
|
|
4711
|
+
/* @__PURE__ */ jsx4(
|
|
4761
4712
|
"span",
|
|
4762
4713
|
{
|
|
4763
4714
|
className: "sr-only",
|
|
@@ -4771,13 +4722,43 @@ function ComposerTranscriptionControl({
|
|
|
4771
4722
|
"composer-dictate"
|
|
4772
4723
|
) });
|
|
4773
4724
|
}
|
|
4725
|
+
function RecordingClock({
|
|
4726
|
+
startedAt,
|
|
4727
|
+
maxSeconds,
|
|
4728
|
+
remainingLabel
|
|
4729
|
+
}) {
|
|
4730
|
+
const [now, setNow] = useState5(() => Date.now());
|
|
4731
|
+
useEffect4(() => {
|
|
4732
|
+
const timer = setInterval(() => setNow(Date.now()), 500);
|
|
4733
|
+
return () => clearInterval(timer);
|
|
4734
|
+
}, []);
|
|
4735
|
+
const elapsed = Math.max(0, Math.floor((now - startedAt) / 1e3));
|
|
4736
|
+
const remaining = maxSeconds === null ? null : Math.max(0, maxSeconds - elapsed);
|
|
4737
|
+
const warn = remaining !== null && remaining <= 15;
|
|
4738
|
+
const label = `${Math.floor(elapsed / 60)}:${String(elapsed % 60).padStart(2, "0")}`;
|
|
4739
|
+
return /* @__PURE__ */ jsxs4(
|
|
4740
|
+
"span",
|
|
4741
|
+
{
|
|
4742
|
+
"data-recording-clock": true,
|
|
4743
|
+
title: warn ? remainingLabel.replace("{seconds}", String(remaining)) : void 0,
|
|
4744
|
+
className: cn(
|
|
4745
|
+
"min-w-[2.25rem] text-right text-og-xs tabular-nums",
|
|
4746
|
+
warn ? "font-medium text-og-status-failed" : "text-og-fg-muted"
|
|
4747
|
+
),
|
|
4748
|
+
children: [
|
|
4749
|
+
label,
|
|
4750
|
+
warn ? /* @__PURE__ */ jsx4("span", { className: "sr-only", children: remainingLabel.replace("{seconds}", String(remaining)) }) : null
|
|
4751
|
+
]
|
|
4752
|
+
}
|
|
4753
|
+
);
|
|
4754
|
+
}
|
|
4774
4755
|
function VoiceWaveform({
|
|
4775
4756
|
stream,
|
|
4776
4757
|
mode
|
|
4777
4758
|
}) {
|
|
4778
|
-
const [levels, setLevels] =
|
|
4779
|
-
const [live, setLive] =
|
|
4780
|
-
|
|
4759
|
+
const [levels, setLevels] = useState5(() => restingLevels(WAVEFORM_BARS));
|
|
4760
|
+
const [live, setLive] = useState5(false);
|
|
4761
|
+
useEffect4(() => {
|
|
4781
4762
|
if (!stream || mode !== "recording") {
|
|
4782
4763
|
setLive(false);
|
|
4783
4764
|
setLevels(restingLevels(WAVEFORM_BARS));
|
|
@@ -4825,7 +4806,7 @@ function VoiceWaveform({
|
|
|
4825
4806
|
void context?.close();
|
|
4826
4807
|
};
|
|
4827
4808
|
}, [stream, mode]);
|
|
4828
|
-
return /* @__PURE__ */
|
|
4809
|
+
return /* @__PURE__ */ jsx4(
|
|
4829
4810
|
"span",
|
|
4830
4811
|
{
|
|
4831
4812
|
"aria-hidden": true,
|
|
@@ -4833,7 +4814,7 @@ function VoiceWaveform({
|
|
|
4833
4814
|
className: "flex h-4 w-[3.75rem] items-center justify-center gap-px",
|
|
4834
4815
|
children: WAVEFORM_BAR_KEYS.map((key, index) => {
|
|
4835
4816
|
const level = levels[index] ?? 0;
|
|
4836
|
-
return /* @__PURE__ */
|
|
4817
|
+
return /* @__PURE__ */ jsx4(
|
|
4837
4818
|
"span",
|
|
4838
4819
|
{
|
|
4839
4820
|
className: cn(
|
|
@@ -4858,6 +4839,13 @@ function restingLevels(count) {
|
|
|
4858
4839
|
}
|
|
4859
4840
|
function transcriptionErrorMessage(code, messages) {
|
|
4860
4841
|
switch (code) {
|
|
4842
|
+
case "insufficient_credits":
|
|
4843
|
+
return messages.errorInsufficientCredits;
|
|
4844
|
+
case "allowance_exhausted":
|
|
4845
|
+
case "monthly_model_cost_limit":
|
|
4846
|
+
return messages.errorAllowanceExhausted;
|
|
4847
|
+
case "policy_blocked":
|
|
4848
|
+
return messages.errorPolicyBlocked;
|
|
4861
4849
|
case "permission_denied":
|
|
4862
4850
|
return messages.errorPermissionDenied;
|
|
4863
4851
|
case "not_supported":
|
|
@@ -4884,13 +4872,6 @@ function transcriptionErrorMessage(code, messages) {
|
|
|
4884
4872
|
}
|
|
4885
4873
|
|
|
4886
4874
|
export {
|
|
4887
|
-
TooltipProvider,
|
|
4888
|
-
Tooltip,
|
|
4889
|
-
TooltipTrigger,
|
|
4890
|
-
TooltipContent,
|
|
4891
|
-
useLightbox,
|
|
4892
|
-
useLightboxOptional,
|
|
4893
|
-
LightboxProvider,
|
|
4894
4875
|
OPEN_WORKSTREAM_CONTROL_EVENT,
|
|
4895
4876
|
parseCommandLine,
|
|
4896
4877
|
hasPermission,
|
|
@@ -4902,7 +4883,6 @@ export {
|
|
|
4902
4883
|
useSlashCommands,
|
|
4903
4884
|
CommandPalette,
|
|
4904
4885
|
ModelPicker,
|
|
4905
|
-
defaultChatComposerMessages,
|
|
4906
4886
|
useChatComposerController,
|
|
4907
4887
|
useChatComposer,
|
|
4908
4888
|
Root,
|
|
@@ -4921,6 +4901,7 @@ export {
|
|
|
4921
4901
|
AttachButton,
|
|
4922
4902
|
ModelPicker2,
|
|
4923
4903
|
PauseButton,
|
|
4904
|
+
StopButton,
|
|
4924
4905
|
SendButton,
|
|
4925
4906
|
Help,
|
|
4926
4907
|
Status,
|
|
@@ -4944,4 +4925,4 @@ export {
|
|
|
4944
4925
|
useVoiceInput,
|
|
4945
4926
|
ComposerTranscriptionControl
|
|
4946
4927
|
};
|
|
4947
|
-
//# sourceMappingURL=chunk-
|
|
4928
|
+
//# sourceMappingURL=chunk-4M2MJLY3.js.map
|