@opengeni/react 3.1.0 → 3.1.2
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 +769 -22
- package/dist/accounts.js +89 -11
- package/dist/accounts.js.map +1 -1
- package/dist/approvals.d.ts +2 -1
- package/dist/artifacts-document.js +5 -3
- package/dist/artifacts-presentation.js +5 -3
- package/dist/artifacts-spreadsheet.d.ts +1 -1
- package/dist/artifacts-spreadsheet.js +5 -3
- package/dist/artifacts.d.ts +5 -1
- package/dist/artifacts.js +536 -42
- package/dist/artifacts.js.map +1 -1
- package/dist/browser-viewer-ZWR6MWJ7.js +19 -0
- package/dist/capability-catalog-row.d.ts +20 -0
- package/dist/capability-logo-fallback.d.ts +3 -0
- package/dist/chat-interactive-block-BO2IWXVK.js +14 -0
- package/dist/chunk-2DDJ6YH6.js +41 -0
- package/dist/chunk-2DDJ6YH6.js.map +1 -0
- package/dist/chunk-2HVLQ26H.js +183 -0
- package/dist/chunk-2HVLQ26H.js.map +1 -0
- package/dist/{chunk-RGALCTWO.js → chunk-2I6R3GCZ.js} +4285 -3980
- package/dist/chunk-2I6R3GCZ.js.map +1 -0
- package/dist/{chunk-D3UIAJKY.js → chunk-2SFFYIH3.js} +1179 -166
- package/dist/chunk-2SFFYIH3.js.map +1 -0
- package/dist/chunk-3PVDYTTB.js +24 -0
- package/dist/chunk-3PVDYTTB.js.map +1 -0
- package/dist/chunk-3UZCWK46.js +298 -0
- package/dist/chunk-3UZCWK46.js.map +1 -0
- package/dist/chunk-47CKUXTW.js +293 -0
- package/dist/chunk-47CKUXTW.js.map +1 -0
- package/dist/chunk-4QYP6QUI.js +109 -0
- package/dist/chunk-4QYP6QUI.js.map +1 -0
- package/dist/chunk-5EY26VZ7.js +1053 -0
- package/dist/chunk-5EY26VZ7.js.map +1 -0
- package/dist/chunk-5I4VRWBB.js +56 -0
- package/dist/chunk-5I4VRWBB.js.map +1 -0
- package/dist/chunk-5WOR7UCL.js +191 -0
- package/dist/chunk-5WOR7UCL.js.map +1 -0
- package/dist/chunk-5YJLGOM5.js +51 -0
- package/dist/chunk-5YJLGOM5.js.map +1 -0
- package/dist/chunk-6JFN3OWG.js +386 -0
- package/dist/chunk-6JFN3OWG.js.map +1 -0
- package/dist/chunk-7QJT5O4S.js +35 -0
- package/dist/chunk-7QJT5O4S.js.map +1 -0
- package/dist/chunk-A55KV72M.js +402 -0
- package/dist/chunk-A55KV72M.js.map +1 -0
- package/dist/chunk-ADWCLI4G.js +2028 -0
- package/dist/chunk-ADWCLI4G.js.map +1 -0
- package/dist/chunk-B27E3V37.js +29 -0
- package/dist/chunk-B27E3V37.js.map +1 -0
- package/dist/chunk-B7TC2A33.js +83 -0
- package/dist/chunk-B7TC2A33.js.map +1 -0
- package/dist/chunk-BLL56F7R.js +385 -0
- package/dist/chunk-BLL56F7R.js.map +1 -0
- package/dist/chunk-BOFEQC6K.js +162 -0
- package/dist/chunk-BOFEQC6K.js.map +1 -0
- package/dist/chunk-CM7LVUKC.js +35 -0
- package/dist/chunk-CM7LVUKC.js.map +1 -0
- package/dist/chunk-CORUP6JB.js +122 -0
- package/dist/chunk-CORUP6JB.js.map +1 -0
- package/dist/chunk-CSX5FFKZ.js +35 -0
- package/dist/chunk-CSX5FFKZ.js.map +1 -0
- package/dist/chunk-EGVHJKGJ.js +3125 -0
- package/dist/chunk-EGVHJKGJ.js.map +1 -0
- package/dist/{chunk-NEXLLTP4.js → chunk-G76LSA76.js} +6 -5
- package/dist/chunk-G76LSA76.js.map +1 -0
- package/dist/{chunk-PEI6RANI.js → chunk-GQMRL52F.js} +311 -75
- package/dist/chunk-GQMRL52F.js.map +1 -0
- package/dist/{chunk-ELIYWBZR.js → chunk-GUUXOISA.js} +1113 -457
- package/dist/chunk-GUUXOISA.js.map +1 -0
- package/dist/{chunk-HUIKIDM5.js → chunk-I7X2P4FU.js} +225 -116
- package/dist/chunk-I7X2P4FU.js.map +1 -0
- package/dist/chunk-IGFZFLI2.js +1390 -0
- package/dist/chunk-IGFZFLI2.js.map +1 -0
- package/dist/{chunk-4MDLEHXL.js → chunk-IMSUVYQB.js} +26 -13
- package/dist/chunk-IMSUVYQB.js.map +1 -0
- package/dist/chunk-IOYHDEP3.js +38 -0
- package/dist/chunk-IOYHDEP3.js.map +1 -0
- package/dist/chunk-IZV5FTJC.js +55 -0
- package/dist/chunk-IZV5FTJC.js.map +1 -0
- package/dist/chunk-KF33GTWN.js +343 -0
- package/dist/chunk-KF33GTWN.js.map +1 -0
- package/dist/chunk-KSGQ5ODA.js +457 -0
- package/dist/chunk-KSGQ5ODA.js.map +1 -0
- package/dist/{chunk-OAM4WAAM.js → chunk-KZC6QRNR.js} +1513 -697
- package/dist/chunk-KZC6QRNR.js.map +1 -0
- package/dist/chunk-LJUMYUBO.js +218 -0
- package/dist/chunk-LJUMYUBO.js.map +1 -0
- package/dist/chunk-LSW2OJVV.js +380 -0
- package/dist/chunk-LSW2OJVV.js.map +1 -0
- package/dist/chunk-M357MHH3.js +2 -0
- package/dist/chunk-M357MHH3.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-XXWH2JLC.js → chunk-NKMYZFHA.js} +616 -621
- package/dist/chunk-NKMYZFHA.js.map +1 -0
- package/dist/chunk-NX4ADH73.js +14 -0
- package/dist/chunk-NX4ADH73.js.map +1 -0
- package/dist/chunk-O7F6UJO4.js +71 -0
- package/dist/chunk-O7F6UJO4.js.map +1 -0
- package/dist/chunk-OVB5WIG5.js +14064 -0
- package/dist/chunk-OVB5WIG5.js.map +1 -0
- package/dist/chunk-OYQQJL3J.js +16 -0
- package/dist/chunk-OYQQJL3J.js.map +1 -0
- package/dist/{chunk-H5YGYNXS.js → chunk-P4BNUO57.js} +60 -17
- package/dist/chunk-P4BNUO57.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-KCGXPP5V.js → chunk-PYEOPA4M.js} +13 -7
- package/dist/chunk-PYEOPA4M.js.map +1 -0
- package/dist/{chunk-KZ73RL76.js → chunk-QHUE7E4N.js} +8 -3
- package/dist/chunk-QHUE7E4N.js.map +1 -0
- package/dist/chunk-QV3DJVRZ.js +11 -0
- package/dist/chunk-QV3DJVRZ.js.map +1 -0
- package/dist/chunk-R5SBNG7S.js +810 -0
- package/dist/chunk-R5SBNG7S.js.map +1 -0
- package/dist/chunk-RI42H5IU.js +326 -0
- package/dist/chunk-RI42H5IU.js.map +1 -0
- package/dist/chunk-S2QH6EZ5.js +211 -0
- package/dist/chunk-S2QH6EZ5.js.map +1 -0
- package/dist/chunk-SHLZMAJN.js +304 -0
- package/dist/chunk-SHLZMAJN.js.map +1 -0
- package/dist/chunk-TGXK4BAZ.js +293 -0
- package/dist/chunk-TGXK4BAZ.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-UNJPZGNK.js +63 -0
- package/dist/chunk-UNJPZGNK.js.map +1 -0
- package/dist/{chunk-MZ2G2XBA.js → chunk-V5ZUJT2T.js} +205 -45
- package/dist/chunk-V5ZUJT2T.js.map +1 -0
- package/dist/chunk-VIUEOHXY.js +394 -0
- package/dist/chunk-VIUEOHXY.js.map +1 -0
- package/dist/chunk-WIUKB3LD.js +1911 -0
- package/dist/chunk-WIUKB3LD.js.map +1 -0
- package/dist/{chunk-ICA6R6TW.js → chunk-WNN7NO2N.js} +1451 -355
- package/dist/chunk-WNN7NO2N.js.map +1 -0
- package/dist/{chunk-YJFGAFBD.js → chunk-X5UVUIMF.js} +1892 -1223
- package/dist/chunk-X5UVUIMF.js.map +1 -0
- package/dist/chunk-XDA5QJE7.js +402 -0
- package/dist/chunk-XDA5QJE7.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-XHF7OYAN.js +1150 -0
- package/dist/chunk-XHF7OYAN.js.map +1 -0
- package/dist/chunk-YSRBFJMQ.js +43 -0
- package/dist/chunk-YSRBFJMQ.js.map +1 -0
- package/dist/chunk-ZOZAPAUO.js +174 -0
- package/dist/chunk-ZOZAPAUO.js.map +1 -0
- package/dist/chunk-ZQV5W7YC.js +809 -0
- package/dist/chunk-ZQV5W7YC.js.map +1 -0
- package/dist/chunk-ZUWF4NF7.js +13 -0
- package/dist/chunk-ZUWF4NF7.js.map +1 -0
- package/dist/client.d.ts +16 -7
- package/dist/clipboard.js +3 -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 +19 -6
- package/dist/components/artifacts/artifact-chrome.d.ts +120 -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 +2 -1
- package/dist/components/artifacts/editable-artifact-view.d.ts +48 -0
- package/dist/components/artifacts/editable-document.d.ts +1 -1
- package/dist/components/artifacts/editable-presentation.d.ts +2 -2
- package/dist/components/artifacts/editable-spreadsheet.d.ts +8 -3
- package/dist/components/artifacts/index.d.ts +9 -2
- 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 +23 -3
- 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 +10 -3
- 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 +9 -0
- package/dist/components/claude-mark.d.ts +3 -0
- package/dist/components/code-editor.d.ts +1 -4
- package/dist/components/composer-transcription-control.d.ts +7 -0
- package/dist/components/composer.d.ts +34 -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/fleet-tile.d.ts +2 -2
- package/dist/components/grok-mark.d.ts +26 -0
- package/dist/components/human-input-form.d.ts +28 -32
- package/dist/components/human-input-surface.d.ts +7 -2
- package/dist/components/linkified-text.d.ts +18 -0
- package/dist/components/machine-input-display.d.ts +22 -1
- package/dist/components/machines/agent-status-icon.d.ts +6 -0
- package/dist/components/machines/machine-detail.d.ts +7 -1
- package/dist/components/machines/machine-status.d.ts +48 -0
- package/dist/components/markdown-table-layout.d.ts +18 -0
- package/dist/components/markdown.d.ts +37 -4
- package/dist/components/message-timeline.d.ts +86 -7
- package/dist/components/model-mark.d.ts +29 -0
- package/dist/components/model-policy-picker-menu.d.ts +9 -0
- package/dist/components/model-policy-picker.d.ts +41 -25
- 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 +68 -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 +16 -0
- package/dist/components/queue-item-content.d.ts +9 -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-files.d.ts +3 -1
- 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 +57 -8
- package/dist/components/session-commands-panel.d.ts +6 -0
- package/dist/components/session-commands.d.ts +6 -0
- package/dist/components/session-connection-request.d.ts +8 -0
- package/dist/components/session-conversation.d.ts +157 -0
- 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 +4 -1
- package/dist/components/session-usage-limit-notice.d.ts +39 -0
- package/dist/components/timeline-anchor.d.ts +24 -0
- package/dist/components/timeline-annotation-chrome.d.ts +25 -0
- package/dist/components/timeline-annotation-layout.d.ts +42 -0
- package/dist/components/timeline-annotation-markers.d.ts +8 -0
- package/dist/components/timeline-annotation-reveal-context.d.ts +4 -0
- package/dist/components/timeline-annotation-shared.d.ts +31 -0
- package/dist/components/timeline-annotations-dialog.d.ts +3 -2
- package/dist/components/timeline-annotations.d.ts +13 -3
- package/dist/components/timeline-reading-progress.d.ts +11 -0
- package/dist/components/timeline-search.d.ts +34 -0
- package/dist/components/timeline-settlement.d.ts +16 -0
- package/dist/components/tip-follow.d.ts +16 -0
- package/dist/components/tool-action-review.d.ts +47 -0
- package/dist/components/tool-review-history.d.ts +25 -0
- package/dist/components/usage-limit-notice.d.ts +49 -0
- package/dist/components/usage-member-list.d.ts +91 -0
- package/dist/components/usage-meter.d.ts +73 -0
- package/dist/components/use-viewer-menu-dismiss.d.ts +2 -0
- package/dist/components/user-message-body.d.ts +10 -1
- package/dist/composer-messages.d.ts +74 -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 +5 -4
- package/dist/composer.js +26 -13
- package/dist/computer-viewer-GMLDXPON.js +20 -0
- package/dist/computer-viewer-GMLDXPON.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 +2149 -0
- package/dist/connect.js.map +1 -0
- package/dist/connection-catalog.d.ts +38 -0
- package/dist/connection-discovery.d.ts +12 -0
- package/dist/connection-installed.d.ts +17 -0
- package/dist/connection-logo.d.ts +9 -0
- package/dist/connection-service-logo.d.ts +8 -0
- package/dist/connection-service-presentation.d.ts +13 -0
- package/dist/connection-skeleton.d.ts +5 -0
- package/dist/connection-type-picker.d.ts +6 -0
- package/dist/conversation-timeline.d.ts +5 -0
- package/dist/desktop.d.ts +7 -0
- package/dist/desktop.js +27 -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 +22 -0
- package/dist/editor.js.map +1 -0
- package/dist/embedded-new-voice-OCRNT6U5.js +18 -0
- package/dist/embedded-new-voice-OCRNT6U5.js.map +1 -0
- package/dist/embedded-voice-RPHPYVBT.js +18 -0
- package/dist/embedded-voice-RPHPYVBT.js.map +1 -0
- package/dist/{fleet-decision-row-GGCAT4E4.js → fleet-decision-row-SI63O5V4.js} +4 -1
- package/dist/fleet-decision-row-SI63O5V4.js.map +1 -0
- package/dist/hooks/latest-question.d.ts +25 -0
- package/dist/hooks/shared-machines-list.d.ts +4 -0
- package/dist/hooks/shared-query.d.ts +113 -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 +1 -1
- package/dist/hooks/use-browser-frame-stream.d.ts +1 -1
- package/dist/hooks/use-browser-session.d.ts +12 -1
- package/dist/hooks/use-client-config-flags.d.ts +49 -0
- package/dist/hooks/use-codex-accounts.d.ts +59 -10
- package/dist/hooks/use-composer.d.ts +24 -2
- 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 +4 -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 +12 -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-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 +4 -1
- package/dist/hooks/use-session-conversation.d.ts +49 -0
- package/dist/hooks/use-session-events.d.ts +28 -7
- 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-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-edit.d.ts +4 -0
- package/dist/hooks/use-workspace-sessions.d.ts +22 -5
- package/dist/human-input-model.d.ts +122 -0
- package/dist/identity-link-accounts.d.ts +11 -0
- package/dist/identity-link-consent.d.ts +18 -0
- package/dist/index.d.ts +82 -20
- package/dist/index.js +2350 -6605
- package/dist/index.js.map +1 -1
- package/dist/interaction.d.ts +1 -1
- package/dist/interaction.js +14 -24
- package/dist/interaction.js.map +1 -1
- package/dist/latest-question-R77KWSUP.js +118 -0
- package/dist/latest-question-R77KWSUP.js.map +1 -0
- package/dist/lib/clipboard.d.ts +7 -0
- package/dist/lib/error-message.d.ts +7 -0
- package/dist/lib/format.d.ts +58 -4
- 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 +55 -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 +25 -0
- package/dist/lib/workbench-peers.d.ts +36 -0
- package/dist/lib/xterm-theme.d.ts +7 -5
- package/dist/machines.js +9 -5
- package/dist/markdown-table-layout-3PV2UAAH.js +113 -0
- package/dist/markdown-table-layout-3PV2UAAH.js.map +1 -0
- package/dist/mcp-connection-status.d.ts +14 -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 +111 -0
- package/dist/model-picker-model.js +25 -0
- package/dist/model-picker-model.js.map +1 -0
- package/dist/model-policy-picker-menu-7GJ5URPR.js +17 -0
- package/dist/model-policy-picker-menu-7GJ5URPR.js.map +1 -0
- package/dist/model-policy.d.ts +30 -3
- package/dist/model-policy.js +14 -1
- package/dist/native-previews.d.ts +28 -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/older-history.d.ts +3 -2
- package/dist/organization-model.d.ts +32 -0
- package/dist/organization-model.js +65 -0
- package/dist/organization-model.js.map +1 -0
- package/dist/{platform-activity-row-BJHUHXAT.js → platform-activity-row-5OCKOQWZ.js} +16 -78
- package/dist/platform-activity-row-5OCKOQWZ.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 +25 -2
- package/dist/queue-presentation-model.d.ts +72 -0
- package/dist/queue-presentation-model.js +38 -0
- package/dist/queue-presentation-model.js.map +1 -0
- package/dist/{queue-surface-implementation-BSKUWHRI.js → queue-surface-implementation-GJBH7NKO.js} +65 -265
- package/dist/queue-surface-implementation-GJBH7NKO.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 +78 -0
- package/dist/realtime.js +25 -1294
- package/dist/realtime.js.map +1 -1
- package/dist/sandbox-files-O27IPOZW.js +21 -0
- package/dist/sandbox-files-O27IPOZW.js.map +1 -0
- package/dist/sandbox-label-model.d.ts +30 -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 +14 -0
- package/dist/secrets-ui.d.ts +57 -0
- package/dist/session-agents-model.d.ts +10 -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 +5 -0
- package/dist/session-capability-policy.d.ts +31 -0
- package/dist/session-feedback-model.d.ts +20 -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 +138 -0
- package/dist/session-list-model.js +274 -0
- package/dist/session-list-model.js.map +1 -0
- package/dist/session-realtime-7DJOIHQW.js +21 -0
- package/dist/session-realtime-7DJOIHQW.js.map +1 -0
- package/dist/session-realtime.d.ts +7 -0
- package/dist/session-realtime.js +19 -0
- package/dist/session-realtime.js.map +1 -0
- package/dist/session-status-model.d.ts +36 -0
- package/dist/session-ui.d.ts +39 -1
- package/dist/session-ui.js +126 -12
- package/dist/session-ui.js.map +1 -1
- package/dist/session.d.ts +8 -2
- package/dist/session.js +35 -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 +14 -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 +32 -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/timeline/activity-rail.d.ts +11 -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 +46 -0
- package/dist/timeline/entrance.d.ts +13 -1
- package/dist/timeline/focus-sequence.d.ts +9 -0
- package/dist/timeline/genie-copy.d.ts +3 -0
- package/dist/timeline/genie-loading.d.ts +47 -0
- package/dist/timeline/index.d.ts +10 -5
- package/dist/timeline/knowledge-receipt.d.ts +17 -0
- package/dist/timeline/message-sender.d.ts +19 -0
- package/dist/timeline/notice-presentation.d.ts +13 -0
- package/dist/timeline/parsers.d.ts +11 -0
- package/dist/timeline/patch-apply-command.d.ts +18 -0
- package/dist/timeline/platform-activity-presentation.d.ts +21 -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 +31 -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 +12 -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 +4 -1
- 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 +5 -2
- package/dist/timeline/tool-presentation.d.ts +172 -0
- package/dist/timeline/turn-summary-model.d.ts +95 -0
- package/dist/timeline/turn-summary.d.ts +20 -54
- package/dist/timeline/types.d.ts +179 -7
- package/dist/timeline/work-presentation.d.ts +60 -0
- package/dist/timeline-annotation-markers-U3G66KUD.js +166 -0
- package/dist/timeline-annotation-markers-U3G66KUD.js.map +1 -0
- package/dist/timeline-annotation-selection-BI7QTPTZ.js +242 -0
- package/dist/timeline-annotation-selection-BI7QTPTZ.js.map +1 -0
- package/dist/timeline-annotations-dialog-FOMHSDTE.js +274 -0
- package/dist/timeline-annotations-dialog-FOMHSDTE.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 +25 -0
- package/dist/usage/session-usage-limit.d.ts +88 -0
- package/dist/usage/summary.d.ts +35 -0
- package/dist/usage.d.ts +17 -0
- package/dist/usage.js +1187 -0
- package/dist/usage.js.map +1 -0
- package/dist/voice-recording-owner.d.ts +7 -0
- package/package.json +107 -7
- package/src/accounts.tsx +116 -14
- package/src/approvals.ts +8 -1
- package/src/artifacts-spreadsheet.ts +1 -0
- package/src/artifacts.ts +44 -0
- package/src/assets/README.md +8 -0
- package/src/assets/gmail.ico +0 -0
- package/src/assets/outlook.ico +0 -0
- package/src/capability-catalog-row.tsx +94 -0
- package/src/capability-logo-fallback.ts +22 -0
- package/src/client.ts +20 -31
- package/src/commands/registry.ts +18 -15
- package/src/commands/types.ts +2 -0
- package/src/components/anthropic-mark.tsx +10 -0
- package/src/components/approval-surface.tsx +401 -138
- package/src/components/artifacts/artifact-chrome.tsx +413 -0
- package/src/components/artifacts/artifact-sandbox.tsx +189 -0
- package/src/components/artifacts/artifact-surface.tsx +40 -20
- package/src/components/artifacts/chat-interactive-block.tsx +260 -0
- package/src/components/artifacts/deferred-chat-media.tsx +67 -0
- package/src/components/artifacts/document-editor.tsx +141 -16
- package/src/components/artifacts/editable-artifact-ui.tsx +4 -2
- package/src/components/artifacts/editable-artifact-view.tsx +197 -0
- package/src/components/artifacts/editable-artifact-workbench.tsx +5 -2
- package/src/components/artifacts/editable-document.tsx +37 -36
- package/src/components/artifacts/editable-presentation.tsx +36 -18
- package/src/components/artifacts/editable-spreadsheet.tsx +543 -103
- package/src/components/artifacts/index.ts +45 -0
- package/src/components/artifacts/inline-html-document.ts +24 -0
- package/src/components/artifacts/latest-task-runner.ts +49 -0
- package/src/components/artifacts/presentation-editor.tsx +323 -67
- package/src/components/artifacts/published-html-artifact-frame.tsx +122 -5
- package/src/components/artifacts/session-artifact-viewer.tsx +378 -0
- package/src/components/artifacts/site-view.tsx +121 -0
- package/src/components/artifacts/spreadsheet-canvas.ts +5 -10
- package/src/components/artifacts/spreadsheet-command-queue.ts +184 -0
- package/src/components/artifacts/spreadsheet-download.tsx +109 -0
- package/src/components/artifacts/spreadsheet-general-display.ts +43 -0
- package/src/components/artifacts/spreadsheet-grid.tsx +344 -144
- package/src/components/artifacts/spreadsheet-resize.tsx +421 -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 +312 -0
- package/src/components/browser-viewer.tsx +778 -318
- package/src/components/chat-composer.tsx +47 -5
- package/src/components/child-session-link.tsx +36 -0
- package/src/components/claude-mark.tsx +11 -0
- package/src/components/code-editor.tsx +13 -16
- package/src/components/composer-transcription-control.tsx +128 -30
- package/src/components/composer.tsx +404 -195
- package/src/components/computer-viewer.tsx +880 -253
- package/src/components/copy-button.tsx +13 -5
- package/src/components/desktop-viewer.tsx +1 -1
- package/src/components/enrollment-consent.tsx +1 -1
- package/src/components/enrollment-device-flow.tsx +1 -1
- package/src/components/file-browser.tsx +10 -14
- package/src/components/fleet-tile.tsx +9 -18
- package/src/components/generated-video-player.tsx +4 -2
- package/src/components/grok-mark.tsx +34 -0
- package/src/components/human-input-form.tsx +590 -283
- package/src/components/human-input-surface.tsx +11 -0
- package/src/components/interaction-intervention-banner.tsx +2 -2
- package/src/components/linkified-text.tsx +79 -0
- package/src/components/machine-card.tsx +35 -78
- package/src/components/machine-dock-bar.tsx +1 -1
- package/src/components/machine-input-display.ts +197 -3
- package/src/components/machines/agent-status-icon.tsx +31 -0
- package/src/components/machines/machine-detail.tsx +200 -31
- package/src/components/machines/machine-operation-policy.tsx +1 -1
- package/src/components/machines/machine-status.ts +241 -0
- package/src/components/machines-dashboard.tsx +2 -17
- package/src/components/markdown-table-layout.ts +143 -0
- package/src/components/markdown.tsx +466 -129
- package/src/components/message-timeline.tsx +2567 -728
- package/src/components/model-mark.tsx +102 -0
- package/src/components/model-picker.tsx +15 -4
- package/src/components/model-policy-picker-menu.tsx +371 -0
- package/src/components/model-policy-picker.tsx +256 -412
- package/src/components/new-conversation.tsx +221 -0
- package/src/components/open-geni-chat.tsx +309 -0
- package/src/components/open-geni-links.tsx +179 -0
- package/src/components/openrouter-mark.tsx +13 -0
- package/src/components/opper-mark.tsx +18 -0
- package/src/components/pierre-diff.tsx +41 -16
- package/src/components/pierre-file.tsx +35 -10
- package/src/components/preview-loading.tsx +109 -0
- package/src/components/provider-recovery-notice.tsx +49 -0
- package/src/components/queue-item-content.ts +14 -0
- package/src/components/queue-surface-implementation.tsx +51 -356
- package/src/components/queue-surface-state.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 +91 -15
- package/src/components/sandbox-terminal.tsx +84 -13
- package/src/components/sandbox-workspace.tsx +147 -51
- package/src/components/secret-question-field.tsx +324 -0
- package/src/components/secret-ref-chip.tsx +185 -0
- package/src/components/session-capability-frame.tsx +197 -0
- package/src/components/session-chrome.tsx +842 -251
- package/src/components/session-commands-panel.tsx +126 -0
- package/src/components/session-commands.tsx +18 -0
- package/src/components/session-connection-request.tsx +97 -0
- package/src/components/session-conversation.tsx +876 -0
- package/src/components/session-list.tsx +257 -0
- package/src/components/session-mcp-capability-card.tsx +680 -0
- package/src/components/session-proxy-scope.tsx +153 -0
- package/src/components/session-status.tsx +26 -17
- package/src/components/session-usage-limit-notice.tsx +174 -0
- package/src/components/timeline-anchor.tsx +119 -0
- package/src/components/timeline-annotation-chrome.tsx +196 -0
- package/src/components/timeline-annotation-layout.ts +268 -0
- package/src/components/timeline-annotation-markers.tsx +185 -0
- package/src/components/timeline-annotation-reveal-context.ts +9 -0
- package/src/components/timeline-annotation-selection.tsx +106 -54
- package/src/components/timeline-annotation-shared.ts +245 -0
- package/src/components/timeline-annotations-dialog.tsx +185 -128
- package/src/components/timeline-annotations.tsx +189 -45
- package/src/components/timeline-reading-progress.ts +80 -0
- package/src/components/timeline-search.tsx +168 -0
- package/src/components/timeline-settlement.ts +60 -0
- package/src/components/tip-follow.ts +52 -0
- package/src/components/tool-action-review.tsx +650 -0
- package/src/components/tool-review-history.tsx +88 -0
- package/src/components/tooltip.tsx +38 -5
- package/src/components/usage-limit-notice.tsx +179 -0
- package/src/components/usage-member-list.tsx +792 -0
- package/src/components/usage-meter.tsx +382 -0
- package/src/components/use-viewer-menu-dismiss.ts +33 -0
- package/src/components/user-message-body.tsx +27 -2
- package/src/components/workspace-dock.tsx +18 -1
- package/src/composer-messages.ts +150 -0
- package/src/composer-voice-events.ts +12 -0
- package/src/composer.ts +6 -1
- package/src/connect-account-identity.tsx +34 -0
- package/src/connect-accounts.tsx +233 -0
- package/src/connect-chooser.tsx +336 -0
- package/src/connect-panel.tsx +99 -0
- package/src/connect-setup.tsx +355 -0
- package/src/connect.ts +60 -0
- package/src/connection-assets.d.ts +4 -0
- package/src/connection-catalog.tsx +162 -0
- package/src/connection-discovery.tsx +238 -0
- package/src/connection-installed.tsx +51 -0
- package/src/connection-logo.tsx +37 -0
- package/src/connection-service-logo.tsx +55 -0
- package/src/connection-service-presentation.ts +46 -0
- package/src/connection-skeleton.tsx +16 -0
- package/src/connection-type-picker.tsx +36 -0
- package/src/conversation-timeline.ts +92 -0
- package/src/desktop.ts +24 -0
- package/src/device-authorization.tsx +98 -0
- package/src/diffs.ts +16 -0
- package/src/discovery-cache.ts +42 -0
- package/src/editor.ts +13 -0
- package/src/hooks/internal.ts +3 -2
- package/src/hooks/latest-question.ts +164 -0
- package/src/hooks/shared-machines-list.ts +34 -1
- package/src/hooks/shared-query.ts +721 -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 +21 -15
- package/src/hooks/use-browser-frame-stream.ts +19 -2
- package/src/hooks/use-browser-session.ts +680 -205
- package/src/hooks/use-browser-sessions.ts +32 -1
- package/src/hooks/use-client-config-flags.ts +118 -0
- package/src/hooks/use-codex-accounts.ts +247 -47
- package/src/hooks/use-composer.ts +276 -47
- package/src/hooks/use-computer-frame-stream.ts +25 -7
- package/src/hooks/use-computer-input-posture.ts +94 -0
- package/src/hooks/use-computer-session.ts +409 -95
- package/src/hooks/use-connect.ts +23 -0
- package/src/hooks/use-desktop-stream.ts +19 -28
- package/src/hooks/use-file-attachments.ts +80 -4
- package/src/hooks/use-goal.ts +107 -13
- package/src/hooks/use-last-started-turn-policy.ts +46 -14
- package/src/hooks/use-machines.ts +4 -0
- package/src/hooks/use-new-conversation.ts +374 -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 +68 -20
- package/src/hooks/use-session-background-commands.ts +22 -11
- 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 +703 -382
- package/src/hooks/use-session-lineage.ts +20 -16
- 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 +53 -21
- 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 +6 -0
- package/src/hooks/use-turn-queue.ts +2 -1
- 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-edit.ts +23 -5
- package/src/hooks/use-workspace-sessions.ts +97 -32
- package/src/human-input-model.ts +359 -0
- package/src/identity-link-accounts.tsx +148 -0
- package/src/identity-link-consent.tsx +192 -0
- package/src/index.ts +262 -16
- package/src/interaction.ts +1 -0
- package/src/lib/clipboard.ts +29 -0
- package/src/lib/error-message.ts +37 -0
- package/src/lib/format.ts +213 -16
- 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 +243 -0
- package/src/lib/scrollbars.ts +30 -0
- package/src/lib/terminal-input-readiness.ts +51 -0
- package/src/lib/transient-retry.ts +99 -0
- package/src/lib/workbench-peers.ts +62 -0
- package/src/lib/xterm-theme.ts +23 -21
- package/src/mcp-connection-status.ts +35 -0
- package/src/model-mark-paths.ts +53 -0
- package/src/model-picker-model.ts +330 -0
- package/src/model-policy.ts +299 -74
- package/src/native-previews.ts +100 -0
- package/src/new-session-draft.ts +22 -0
- package/src/notification-text.ts +81 -0
- package/src/older-history.ts +22 -4
- package/src/organization-model.ts +118 -0
- package/src/plugin-details.tsx +185 -0
- package/src/plugin-discovery.tsx +196 -0
- package/src/preview-loading-paint.ts +68 -0
- package/src/provider.tsx +74 -15
- package/src/queue-presentation-model.ts +464 -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 +138 -501
- package/src/realtime/session-realtime.ts +566 -0
- package/src/sandbox-label-model.ts +53 -0
- package/src/scrollbars.ts +3 -0
- package/src/secret-reference-label.ts +43 -0
- package/src/secrets-ui.tsx +59 -0
- package/src/session-agents-model.ts +33 -0
- package/src/session-attention-model.ts +62 -0
- package/src/session-auth-recommendation.ts +48 -0
- package/src/session-capability-policy.ts +196 -0
- package/src/session-context.ts +3 -4
- package/src/session-feedback-model.ts +95 -0
- package/src/session-list-model.ts +434 -0
- package/src/session-realtime.ts +18 -0
- package/src/session-status-model.ts +99 -0
- package/src/session-ui.ts +98 -1
- package/src/session.ts +17 -1
- package/src/site-snapshot.ts +74 -0
- package/src/sites-ui.tsx +348 -0
- package/src/sites.ts +3 -0
- package/src/skill-discovery.tsx +208 -0
- package/src/terminal.ts +26 -0
- package/src/testing/session-scenarios.ts +404 -0
- package/src/timeline/activity-rail.tsx +242 -101
- package/src/timeline/agent-identity.tsx +84 -0
- package/src/timeline/agent-row.tsx +231 -0
- package/src/timeline/allowance-exhausted-row.tsx +86 -0
- package/src/timeline/compaction-copy.ts +115 -0
- package/src/timeline/entrance.tsx +28 -3
- package/src/timeline/fleet-decision-projection.ts +2 -1
- package/src/timeline/fleet-decision-row.tsx +1 -0
- package/src/timeline/focus-sequence.ts +44 -0
- package/src/timeline/genie-copy.ts +19 -0
- package/src/timeline/genie-loading.tsx +143 -0
- package/src/timeline/index.ts +30 -2
- package/src/timeline/knowledge-receipt.tsx +100 -0
- package/src/timeline/message-sender.tsx +71 -0
- package/src/timeline/notice-presentation.ts +48 -0
- package/src/timeline/parsers.ts +42 -2
- package/src/timeline/patch-apply-command.tsx +135 -0
- package/src/timeline/platform-activity-presentation.ts +166 -0
- package/src/timeline/platform-activity-row.tsx +15 -90
- package/src/timeline/presented-image.ts +63 -0
- package/src/timeline/projection.ts +1746 -76
- package/src/timeline/provider-logo.tsx +53 -0
- package/src/timeline/question-nav-model.ts +28 -0
- package/src/timeline/registry.ts +26 -4
- package/src/timeline/retained-image.ts +97 -0
- package/src/timeline/retained-loaders.ts +91 -0
- package/src/timeline/rolling-activity.tsx +80 -0
- package/src/timeline/screenshot-lightbox.tsx +228 -5
- package/src/timeline/session-usage-limit-row.tsx +42 -0
- package/src/timeline/shared.tsx +42 -15
- package/src/timeline/startup-dispatch-details.tsx +36 -0
- package/src/timeline/startup-preference.ts +33 -0
- package/src/timeline/startup-timings.tsx +145 -0
- package/src/timeline/tool-display-name.ts +19 -7
- package/src/timeline/tool-presentation.ts +1316 -0
- package/src/timeline/tool-renderers.tsx +835 -1138
- package/src/timeline/turn-summary-model.ts +343 -0
- package/src/timeline/turn-summary.tsx +272 -365
- package/src/timeline/types.ts +189 -6
- package/src/timeline/work-presentation.ts +189 -0
- package/src/timeline-model.ts +143 -0
- package/src/usage/allowance-copy.ts +64 -0
- package/src/usage/session-usage-limit.ts +266 -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 +2319 -748
- package/styles/connect.css +290 -0
- package/styles/connect.d.ts +1 -0
- package/styles/effective-tokens.css +1 -0
- package/styles/index.css +309 -9
- package/styles/responsive.css +99 -7
- package/styles/session-capability.css +44 -0
- package/styles/tokens.css +134 -66
- package/dist/browser-viewer-AEFHUYZK.js +0 -14
- package/dist/chunk-4MDLEHXL.js.map +0 -1
- package/dist/chunk-5YK2ZDIG.js.map +0 -1
- package/dist/chunk-D3UIAJKY.js.map +0 -1
- package/dist/chunk-ELIYWBZR.js.map +0 -1
- package/dist/chunk-H5YGYNXS.js.map +0 -1
- package/dist/chunk-HQVCKCLG.js +0 -9458
- package/dist/chunk-HQVCKCLG.js.map +0 -1
- package/dist/chunk-HUIKIDM5.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-LAKLF4PA.js +0 -141
- package/dist/chunk-LAKLF4PA.js.map +0 -1
- package/dist/chunk-MZ2G2XBA.js.map +0 -1
- package/dist/chunk-NEXLLTP4.js.map +0 -1
- package/dist/chunk-OAM4WAAM.js.map +0 -1
- package/dist/chunk-PEI6RANI.js.map +0 -1
- package/dist/chunk-RGALCTWO.js.map +0 -1
- package/dist/chunk-W6NFJXSA.js +0 -454
- package/dist/chunk-W6NFJXSA.js.map +0 -1
- package/dist/chunk-WSK7G5LE.js +0 -170
- package/dist/chunk-WSK7G5LE.js.map +0 -1
- package/dist/chunk-X4A66EWZ.js +0 -223
- package/dist/chunk-X4A66EWZ.js.map +0 -1
- package/dist/chunk-XXWH2JLC.js.map +0 -1
- package/dist/chunk-YFKJ7VZH.js +0 -268
- package/dist/chunk-YFKJ7VZH.js.map +0 -1
- package/dist/chunk-YJFGAFBD.js.map +0 -1
- package/dist/computer-viewer-FWEZISW4.js +0 -16
- package/dist/fleet-decision-row-GGCAT4E4.js.map +0 -1
- package/dist/hooks/use-environments.d.ts +0 -41
- package/dist/hooks/use-packs.d.ts +0 -32
- package/dist/platform-activity-row-BJHUHXAT.js.map +0 -1
- package/dist/queue-surface-implementation-BSKUWHRI.js.map +0 -1
- package/dist/timeline-annotation-selection-3L7LHGG2.js +0 -187
- package/dist/timeline-annotation-selection-3L7LHGG2.js.map +0 -1
- package/dist/timeline-annotations-dialog-U7EVLR75.js +0 -196
- package/dist/timeline-annotations-dialog-U7EVLR75.js.map +0 -1
- package/src/hooks/use-environments.ts +0 -182
- package/src/hooks/use-packs.ts +0 -157
- /package/dist/{browser-viewer-AEFHUYZK.js.map → browser-viewer-ZWR6MWJ7.js.map} +0 -0
- /package/dist/{computer-viewer-FWEZISW4.js.map → chat-interactive-block-BO2IWXVK.js.map} +0 -0
|
@@ -1,60 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
mcpToolLeaf,
|
|
4
|
+
toolMatchesLeaf
|
|
5
|
+
} from "./chunk-3PVDYTTB.js";
|
|
1
6
|
import {
|
|
2
7
|
CREDIT_EXHAUSTION_MESSAGE,
|
|
3
|
-
humanizeFailureReason,
|
|
4
8
|
isCreditExhaustion,
|
|
9
|
+
presentFailure,
|
|
5
10
|
tryParseJson
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
|
|
8
|
-
// src/older-history.ts
|
|
9
|
-
var activeReceiptCapture;
|
|
10
|
-
function invokeOlderHistoryLoaderWithReceiptCapture(load, capture) {
|
|
11
|
-
const previousCapture = activeReceiptCapture;
|
|
12
|
-
activeReceiptCapture = capture;
|
|
13
|
-
try {
|
|
14
|
-
return load();
|
|
15
|
-
} finally {
|
|
16
|
-
activeReceiptCapture = previousCapture;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function createOlderHistoryLoadReceipt(load) {
|
|
20
|
-
let resolveResult;
|
|
21
|
-
let rejectResult;
|
|
22
|
-
const result = new Promise((resolve, reject) => {
|
|
23
|
-
resolveResult = resolve;
|
|
24
|
-
rejectResult = reject;
|
|
25
|
-
});
|
|
26
|
-
result.committed = false;
|
|
27
|
-
activeReceiptCapture?.(result);
|
|
28
|
-
try {
|
|
29
|
-
const loaded = load(() => {
|
|
30
|
-
result.committed = true;
|
|
31
|
-
});
|
|
32
|
-
Promise.resolve(loaded).then(resolveResult, rejectResult);
|
|
33
|
-
} catch (error) {
|
|
34
|
-
rejectResult(error);
|
|
35
|
-
}
|
|
36
|
-
return result;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// src/timeline/tool-display-name.ts
|
|
40
|
-
function mcpToolLeaf(name) {
|
|
41
|
-
const boundary = name.indexOf("__");
|
|
42
|
-
return boundary >= 0 ? name.slice(boundary + 2) : name;
|
|
43
|
-
}
|
|
44
|
-
function toolMatchesLeaf(wireName, leaf) {
|
|
45
|
-
return wireName === leaf || wireName.endsWith(`__${leaf}`);
|
|
46
|
-
}
|
|
47
|
-
function toolDisplayName(name) {
|
|
48
|
-
const phrase = mcpToolLeaf(name).replace(/[_-]+/g, " ").trim();
|
|
49
|
-
if (!phrase) {
|
|
50
|
-
return name;
|
|
51
|
-
}
|
|
52
|
-
return phrase.charAt(0).toUpperCase() + phrase.slice(1);
|
|
53
|
-
}
|
|
11
|
+
} from "./chunk-BLL56F7R.js";
|
|
54
12
|
|
|
55
13
|
// src/timeline/projection.ts
|
|
56
14
|
import {
|
|
57
|
-
|
|
15
|
+
parseCustomMcpSetupRequest,
|
|
16
|
+
parseMediaGenerationResult,
|
|
17
|
+
parseToolDisplayMetadata,
|
|
18
|
+
EMPTY_FINAL_REPLY_NOTICE,
|
|
19
|
+
turnCompletedWithEmptyFinalReply
|
|
58
20
|
} from "@opengeni/sdk";
|
|
59
21
|
|
|
60
22
|
// src/timeline/fleet-decision-projection.ts
|
|
@@ -65,6 +27,7 @@ var FLEET_ACTUAL_REASONS = [
|
|
|
65
27
|
"rotation",
|
|
66
28
|
"active",
|
|
67
29
|
"all_capped",
|
|
30
|
+
"allocator_disabled",
|
|
68
31
|
"none"
|
|
69
32
|
];
|
|
70
33
|
var FLEET_SHADOW_OUTCOMES = ["selected", "paced", "none"];
|
|
@@ -282,7 +245,7 @@ function fleetComparisonIsConsistent(comparison, actualOutcome, actualCandidateK
|
|
|
282
245
|
return comparableActualOutcome !== "selected" || actualCandidateKey === shadowCandidateKey;
|
|
283
246
|
}
|
|
284
247
|
function fleetDecisionSemanticsAreConsistent(input) {
|
|
285
|
-
const actualConsistent = input.actualOutcome === "selected" ? ["lease_reused", "pin", "rotation", "active"].includes(input.actualReason) : input.actualOutcome === "waiting" ? input.actualReason
|
|
248
|
+
const actualConsistent = input.actualOutcome === "selected" ? ["lease_reused", "pin", "rotation", "active"].includes(input.actualReason) : input.actualOutcome === "waiting" ? ["all_capped", "allocator_disabled"].includes(input.actualReason) : input.actualReason === "none";
|
|
286
249
|
const shadowConsistent = input.shadowOutcome === "selected" ? ["fenced_in_flight", "best_score", "affinity_best", "hysteresis_hold"].includes(
|
|
287
250
|
input.shadowReason
|
|
288
251
|
) : input.shadowOutcome === "paced" ? input.shadowReason === "admission_paced" : ["fenced_candidate_missing", "no_eligible_candidate", "overlay_isolated_empty"].includes(
|
|
@@ -296,6 +259,72 @@ function asRecord(value) {
|
|
|
296
259
|
}
|
|
297
260
|
|
|
298
261
|
// src/timeline/projection.ts
|
|
262
|
+
import {
|
|
263
|
+
allowanceExhaustedMessage,
|
|
264
|
+
parseAllowanceExhaustedRefusal
|
|
265
|
+
} from "@opengeni/sdk/allowance-refusal";
|
|
266
|
+
import {
|
|
267
|
+
parseSessionUsageLimitReachedRefusal,
|
|
268
|
+
SESSION_USAGE_LIMIT_SEGMENT,
|
|
269
|
+
sessionUsageLimitReachedMessage
|
|
270
|
+
} from "@opengeni/sdk/session-usage-limits";
|
|
271
|
+
|
|
272
|
+
// src/timeline/compaction-copy.ts
|
|
273
|
+
var COMPACTION_FAILURE_TITLE = "Couldn\u2019t compact conversation history";
|
|
274
|
+
var COMPACTION_INTERRUPTED_TITLE = "Compaction interrupted";
|
|
275
|
+
function compactionSkipTitle(reason) {
|
|
276
|
+
return reason === "interrupted" ? COMPACTION_INTERRUPTED_TITLE : COMPACTION_FAILURE_TITLE;
|
|
277
|
+
}
|
|
278
|
+
var COMPACTION_REJECTION_NOTE = "The provider rejects this request the same way until the conversation changes.";
|
|
279
|
+
function compactionSkipSubtitle(reason, providerRejection = null) {
|
|
280
|
+
switch (reason) {
|
|
281
|
+
case "no_history":
|
|
282
|
+
return "No active history to compact";
|
|
283
|
+
case "replacement_not_smaller":
|
|
284
|
+
return "Checkpoint would not reduce memory size";
|
|
285
|
+
case "replacement_exceeds_model_budget":
|
|
286
|
+
return "Checkpoint exceeds this model's context budget. Chat history is unchanged.";
|
|
287
|
+
case "replacement_unchanged":
|
|
288
|
+
return "Checkpoint made no progress";
|
|
289
|
+
case "interrupted":
|
|
290
|
+
return "It will retry if still needed. Chat history is unchanged.";
|
|
291
|
+
case "summarization_failed":
|
|
292
|
+
return providerRejection ? "Chat history is unchanged. If your next message fails too, start a new session." : "Request it again to retry. Chat history is unchanged.";
|
|
293
|
+
default:
|
|
294
|
+
return "Compaction was not needed. Chat history is unchanged.";
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
function compactionFailureDetails(item) {
|
|
298
|
+
if (item.phase !== "skipped" || item.skipReason !== "summarization_failed") return null;
|
|
299
|
+
const rejection = item.providerRejection;
|
|
300
|
+
if (!rejection) {
|
|
301
|
+
const recorded = item.failureDetail?.trim();
|
|
302
|
+
return recorded ? { note: null, facts: [{ label: "Error", value: recorded }] } : null;
|
|
303
|
+
}
|
|
304
|
+
const facts = [
|
|
305
|
+
{
|
|
306
|
+
label: "Response",
|
|
307
|
+
value: [`HTTP ${rejection.httpStatus}`, rejection.type, rejection.code].filter((part) => Boolean(part)).join(" \xB7 ")
|
|
308
|
+
}
|
|
309
|
+
];
|
|
310
|
+
if (rejection.param) facts.push({ label: "Parameter", value: rejection.param });
|
|
311
|
+
if (rejection.requestId) facts.push({ label: "Request ID", value: rejection.requestId });
|
|
312
|
+
return { note: COMPACTION_REJECTION_NOTE, facts };
|
|
313
|
+
}
|
|
314
|
+
var COMPACTION_TURN_FAILURE_PREFIX = "compaction summarization failed:";
|
|
315
|
+
function presentTurnFailureText(failureText) {
|
|
316
|
+
const text = failureText?.trim();
|
|
317
|
+
if (!text) return null;
|
|
318
|
+
if (text.toLowerCase().startsWith(COMPACTION_TURN_FAILURE_PREFIX)) {
|
|
319
|
+
return { summary: COMPACTION_FAILURE_TITLE, detail: text };
|
|
320
|
+
}
|
|
321
|
+
return { summary: text };
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// src/timeline/projection.ts
|
|
325
|
+
function isTimelineUserQuestion(event) {
|
|
326
|
+
return event.type === "user.message" && workerCompletionPayload(asRecord2(event.payload).childCompletion) === null;
|
|
327
|
+
}
|
|
299
328
|
var WORKER_SPAWN_TOOL = "session_create";
|
|
300
329
|
var WORKER_MESSAGE_TOOL = "session_send_message";
|
|
301
330
|
var WORKER_FAILURE_CODE_MAX_LENGTH = 128;
|
|
@@ -337,14 +366,80 @@ function timelineAnnotationToolOutputText(output) {
|
|
|
337
366
|
const text = (marker >= 0 ? raw.slice(marker + "\nOutput:\n".length) : raw.startsWith("Output:\n") ? raw.slice("Output:\n".length) : raw).replace(TIMELINE_ANNOTATION_ANSI_SEQUENCE, "");
|
|
338
367
|
return text.length > 0 ? text : null;
|
|
339
368
|
}
|
|
340
|
-
function buildTimeline(events) {
|
|
369
|
+
function buildTimeline(events, options = {}) {
|
|
341
370
|
const items = [];
|
|
371
|
+
const allowanceNotices = /* @__PURE__ */ new Set();
|
|
372
|
+
const allowanceNotice = (event, turnId) => {
|
|
373
|
+
const refusal = parseAllowanceExhaustedRefusal(event.payload);
|
|
374
|
+
if (!refusal) return null;
|
|
375
|
+
const text = allowanceExhaustedMessage(refusal);
|
|
376
|
+
const key = JSON.stringify([
|
|
377
|
+
turnId,
|
|
378
|
+
event.turnAttemptId,
|
|
379
|
+
startupRecoveryRevisionByTurn.get(turnId ?? "") ?? 0,
|
|
380
|
+
refusal.scope,
|
|
381
|
+
refusal.subjectId,
|
|
382
|
+
refusal.resetsAt
|
|
383
|
+
]);
|
|
384
|
+
if (!allowanceNotices.has(key)) {
|
|
385
|
+
allowanceNotices.add(key);
|
|
386
|
+
items.push({
|
|
387
|
+
kind: "notice",
|
|
388
|
+
id: `${event.id}-allowance`,
|
|
389
|
+
tone: "failed",
|
|
390
|
+
text,
|
|
391
|
+
// The canonical sentence replaces upstream prose, so a host renderer
|
|
392
|
+
// reading `message` never shows a wrapper's private wording.
|
|
393
|
+
allowance: { ...refusal, message: text },
|
|
394
|
+
occurredAt: event.occurredAt
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
return text;
|
|
398
|
+
};
|
|
342
399
|
const prescan = prescanTurnAnchors(events);
|
|
343
400
|
const ordered = orderTimelineEvents(events, prescan);
|
|
401
|
+
let completeHistoryPrefix = options.partialStart !== true;
|
|
402
|
+
const knownMessagePrefixTurns = /* @__PURE__ */ new Set();
|
|
403
|
+
const incompleteMessageKeys = /* @__PURE__ */ new Set();
|
|
404
|
+
const pendingWaitOutcomeByTurn = /* @__PURE__ */ new Map();
|
|
405
|
+
const latestAgentResponseByTurn = /* @__PURE__ */ new Map();
|
|
406
|
+
const identifiedMessages = /* @__PURE__ */ new Map();
|
|
344
407
|
const humanInputRequests = humanInputRequestsById(events);
|
|
345
408
|
const humanInputToolCallIds = new Set(
|
|
346
409
|
[...humanInputRequests.values()].map((request) => stringValue(request.toolCallId)).filter(Boolean)
|
|
347
410
|
);
|
|
411
|
+
const workerSessions = /* @__PURE__ */ new Set();
|
|
412
|
+
const pendingWorkerSessions = /* @__PURE__ */ new Set();
|
|
413
|
+
let openWaitNotice = null;
|
|
414
|
+
const presentationWaits = /* @__PURE__ */ new Map();
|
|
415
|
+
let openAdmissionBlocks = [];
|
|
416
|
+
const presentationFailures = /* @__PURE__ */ new Map();
|
|
417
|
+
let presentationTurnId = null;
|
|
418
|
+
const rememberPresentationWait = (item, turnId) => {
|
|
419
|
+
const key = turnId ?? presentationTurnId;
|
|
420
|
+
const waits = presentationWaits.get(key) ?? [];
|
|
421
|
+
waits.push(item);
|
|
422
|
+
presentationWaits.set(key, waits);
|
|
423
|
+
items.push(item);
|
|
424
|
+
};
|
|
425
|
+
const resolvePresentationWait = (event, turnId) => {
|
|
426
|
+
if (event.duplicateOfEventId || event.turnAssociation && event.turnAssociation !== "current")
|
|
427
|
+
return;
|
|
428
|
+
const key = turnId ?? presentationTurnId;
|
|
429
|
+
for (const item of presentationWaits.get(key) ?? []) item.resolvedAt = event.occurredAt;
|
|
430
|
+
presentationWaits.delete(key);
|
|
431
|
+
};
|
|
432
|
+
let openCapacityWaits = [];
|
|
433
|
+
const resolveCapacityWaits = (event, payload) => {
|
|
434
|
+
if (openCapacityWaits.length === 0 || !endsCapacityWait(event, payload)) return;
|
|
435
|
+
const eventTurnId = event.turnId ?? null;
|
|
436
|
+
openCapacityWaits = openCapacityWaits.filter((item) => {
|
|
437
|
+
const waitTurnId = item.capacityWait?.turnId ?? null;
|
|
438
|
+
const ends = event.type === "session.status.changed" || eventTurnId === null || waitTurnId === null || eventTurnId === waitTurnId;
|
|
439
|
+
if (ends) item.resolvedAt = event.occurredAt;
|
|
440
|
+
return !ends;
|
|
441
|
+
});
|
|
442
|
+
};
|
|
348
443
|
const queuedAtByTurn = /* @__PURE__ */ new Map();
|
|
349
444
|
const startupRecoveryRevisionByTurn = /* @__PURE__ */ new Map();
|
|
350
445
|
const startupPhases = /* @__PURE__ */ new Map();
|
|
@@ -352,7 +447,7 @@ function buildTimeline(events) {
|
|
|
352
447
|
let startupTurnId = null;
|
|
353
448
|
let startupAttemptId = null;
|
|
354
449
|
let startupRecoveryRevision = 0;
|
|
355
|
-
const settleStartupPhase = (phase, status, duration, outcome, mode = 0, explicitStartedAt, explicitId) => {
|
|
450
|
+
const settleStartupPhase = (phase, status, duration, outcome, mode = 0, explicitStartedAt, explicitId, blockedReason) => {
|
|
356
451
|
const key = `${startupTurnId}:${phase}`;
|
|
357
452
|
const priorState = startupPhases.get(key);
|
|
358
453
|
const prior = priorState?.[0];
|
|
@@ -368,6 +463,7 @@ function buildTimeline(events) {
|
|
|
368
463
|
open.completedAt = startupEvent.occurredAt;
|
|
369
464
|
open.durationMs = duration === null ? elapsedDurationMs(open.startedAt, startupEvent.occurredAt) : Math.max(0, duration);
|
|
370
465
|
open.outcome = outcome ?? open.outcome;
|
|
466
|
+
open.blockedReason = blockedReason;
|
|
371
467
|
return;
|
|
372
468
|
}
|
|
373
469
|
const running = status === "running";
|
|
@@ -382,6 +478,7 @@ function buildTimeline(events) {
|
|
|
382
478
|
completedAt: running ? null : startupEvent.occurredAt,
|
|
383
479
|
durationMs,
|
|
384
480
|
outcome,
|
|
481
|
+
blockedReason,
|
|
385
482
|
occurredAt: startedAt
|
|
386
483
|
});
|
|
387
484
|
startupPhases.set(key, [prior, startupAttemptId, startupRecoveryRevision]);
|
|
@@ -397,12 +494,30 @@ function buildTimeline(events) {
|
|
|
397
494
|
completedAt: running ? null : startupEvent.occurredAt,
|
|
398
495
|
durationMs,
|
|
399
496
|
outcome,
|
|
497
|
+
blockedReason,
|
|
400
498
|
occurredAt: startedAt
|
|
401
499
|
};
|
|
402
500
|
items.push(item);
|
|
403
501
|
startupPhases.set(key, [item, startupAttemptId, startupRecoveryRevision]);
|
|
404
502
|
};
|
|
405
503
|
const last = () => items[items.length - 1];
|
|
504
|
+
const rememberAgentResponse = (turnId, item, completed) => {
|
|
505
|
+
latestAgentResponseByTurn.set(turnId, { item, completed });
|
|
506
|
+
};
|
|
507
|
+
const takePendingWaitOutcome = (turnId) => {
|
|
508
|
+
const outcome = pendingWaitOutcomeByTurn.get(turnId);
|
|
509
|
+
pendingWaitOutcomeByTurn.delete(turnId);
|
|
510
|
+
return outcome;
|
|
511
|
+
};
|
|
512
|
+
const takeAgentResponse = (turnId) => {
|
|
513
|
+
const response = latestAgentResponseByTurn.get(turnId);
|
|
514
|
+
latestAgentResponseByTurn.delete(turnId);
|
|
515
|
+
return response;
|
|
516
|
+
};
|
|
517
|
+
const clearUnscopedTerminalTracking = () => {
|
|
518
|
+
latestAgentResponseByTurn.delete(null);
|
|
519
|
+
pendingWaitOutcomeByTurn.delete(null);
|
|
520
|
+
};
|
|
406
521
|
const closeStreamingTail = () => {
|
|
407
522
|
const open = last();
|
|
408
523
|
if ((open?.kind === "agent-message" || open?.kind === "reasoning") && open.streaming) {
|
|
@@ -435,6 +550,19 @@ function buildTimeline(events) {
|
|
|
435
550
|
for (const event of ordered) {
|
|
436
551
|
const payload = asRecord2(event.payload);
|
|
437
552
|
const turnId = event.turnId ?? null;
|
|
553
|
+
resolveCapacityWaits(event, payload);
|
|
554
|
+
if (turnId && (event.type === "turn.started" || presentationTurnId === null && isAgentActivityEvent(event.type))) {
|
|
555
|
+
presentationTurnId = turnId;
|
|
556
|
+
}
|
|
557
|
+
if (openWaitNotice && (event.type === "user.message" || event.type === "system.update.delivered" || event.type === "turn.started" || event.type === "session.control.paused" || event.type === "session.status.changed" && (payload.status === "cancelled" || payload.status === "failed"))) {
|
|
558
|
+
openWaitNotice.waitEndedAt = event.occurredAt;
|
|
559
|
+
openWaitNotice = null;
|
|
560
|
+
}
|
|
561
|
+
if (event.type === "session.created") {
|
|
562
|
+
completeHistoryPrefix = true;
|
|
563
|
+
} else if (event.type === "turn.started" || event.type === "user.message" && payload.delivery !== "steer" && payload.routing !== "accepted_for_steering") {
|
|
564
|
+
knownMessagePrefixTurns.add(turnId);
|
|
565
|
+
}
|
|
438
566
|
startupEvent = event;
|
|
439
567
|
startupTurnId = turnId;
|
|
440
568
|
startupAttemptId = (typeof event.turnAttemptId === "string" ? event.turnAttemptId : null) ?? stringValue(payload.attemptId);
|
|
@@ -443,19 +571,35 @@ function buildTimeline(events) {
|
|
|
443
571
|
const setupStatus = event.type.endsWith(".started") ? "running" : event.type.endsWith(".failed") ? "failed" : event.type.endsWith(".completed") || event.type === "rig.setup.skipped" ? "complete" : null;
|
|
444
572
|
if (setupPhase && setupStatus) {
|
|
445
573
|
closeStreamingTail();
|
|
574
|
+
let blockedReason;
|
|
575
|
+
if (setupPhase === "model_preparation" && setupStatus === "failed") {
|
|
576
|
+
blockedReason = startupLifecycleWaitReason(payload);
|
|
577
|
+
const sandbox = startupPhases.get(`${startupTurnId}:sandbox`);
|
|
578
|
+
const sameAttempt = sandbox?.[1] || startupAttemptId ? Boolean(startupAttemptId && sandbox?.[1] === startupAttemptId) : sandbox?.[2] === startupRecoveryRevision;
|
|
579
|
+
if (!blockedReason && payload.expectedTransition === void 0 && payload.failureCode === void 0 && payload.failureStage === void 0 && payload.failureCategory === void 0 && payload.error === void 0 && startupTurnId && sameAttempt && sandbox?.[0].status === "cancelled") {
|
|
580
|
+
blockedReason = sandbox[0].blockedReason;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
446
583
|
settleStartupPhase(
|
|
447
584
|
setupPhase,
|
|
448
|
-
setupStatus,
|
|
585
|
+
blockedReason ? "cancelled" : setupStatus,
|
|
449
586
|
numberOrNull(payload.durationMs),
|
|
450
|
-
event.type === "rig.setup.skipped" ? "skipped" : null
|
|
587
|
+
event.type === "rig.setup.skipped" ? "skipped" : null,
|
|
588
|
+
0,
|
|
589
|
+
void 0,
|
|
590
|
+
void 0,
|
|
591
|
+
blockedReason
|
|
451
592
|
);
|
|
452
593
|
continue;
|
|
453
594
|
}
|
|
454
595
|
switch (event.type) {
|
|
455
596
|
case "user.message": {
|
|
597
|
+
clearUnscopedTerminalTracking();
|
|
456
598
|
closeStreamingTail();
|
|
457
599
|
const childCompletion = workerCompletionPayload(payload.childCompletion);
|
|
458
600
|
if (childCompletion) {
|
|
601
|
+
workerSessions.add(childCompletion.childSessionId);
|
|
602
|
+
pendingWorkerSessions.delete(childCompletion.childSessionId);
|
|
459
603
|
items.push({
|
|
460
604
|
kind: "worker-completion",
|
|
461
605
|
id: event.id,
|
|
@@ -472,6 +616,7 @@ function buildTimeline(events) {
|
|
|
472
616
|
break;
|
|
473
617
|
}
|
|
474
618
|
const voiceMessage = realtimeVoiceMessage(payload);
|
|
619
|
+
const sender = messageSender(payload.initiator);
|
|
475
620
|
items.push({
|
|
476
621
|
kind: "user-message",
|
|
477
622
|
id: event.id,
|
|
@@ -489,6 +634,7 @@ function buildTimeline(events) {
|
|
|
489
634
|
...voiceMessage ? { presentation: voiceMessage.presentation } : {},
|
|
490
635
|
resources: resourceRefs(payload.resources),
|
|
491
636
|
tools: toolRefs(payload.tools),
|
|
637
|
+
...sender ? { sender } : {},
|
|
492
638
|
occurredAt: event.occurredAt
|
|
493
639
|
});
|
|
494
640
|
break;
|
|
@@ -500,10 +646,38 @@ function buildTimeline(events) {
|
|
|
500
646
|
items.push(item);
|
|
501
647
|
break;
|
|
502
648
|
}
|
|
649
|
+
case "system.update.settled": {
|
|
650
|
+
if (payload.notificationOnly !== true || payload.reason !== "operator_retirement") break;
|
|
651
|
+
const members = machineInputMembers(payload.members).filter(
|
|
652
|
+
(member) => member.kind === "child_terminal_result" && member.classification === "failure"
|
|
653
|
+
);
|
|
654
|
+
if (members.length === 0) break;
|
|
655
|
+
for (const member of members) {
|
|
656
|
+
workerSessions.add(member.sourceId);
|
|
657
|
+
pendingWorkerSessions.delete(member.sourceId);
|
|
658
|
+
}
|
|
659
|
+
items.push({
|
|
660
|
+
kind: "machine-input-batch",
|
|
661
|
+
id: event.id,
|
|
662
|
+
turnId: null,
|
|
663
|
+
members,
|
|
664
|
+
occurredAt: event.occurredAt
|
|
665
|
+
});
|
|
666
|
+
break;
|
|
667
|
+
}
|
|
503
668
|
case "system.update.delivered": {
|
|
504
669
|
const inputs = machineInputMembers(payload.members);
|
|
670
|
+
for (const input of inputs) {
|
|
671
|
+
if (input.kind === "child_terminal_result") {
|
|
672
|
+
workerSessions.add(input.sourceId);
|
|
673
|
+
pendingWorkerSessions.delete(input.sourceId);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
505
676
|
if (inputs.length === 0) break;
|
|
506
|
-
|
|
677
|
+
const visibleInputs = inputs.filter(
|
|
678
|
+
(member) => member.kind !== "background_command_result"
|
|
679
|
+
);
|
|
680
|
+
if (visibleInputs.length === 0 || visibleInputs.every((member) => member.kind === "goal_continuation")) {
|
|
507
681
|
break;
|
|
508
682
|
}
|
|
509
683
|
closeStreamingTail();
|
|
@@ -511,7 +685,7 @@ function buildTimeline(events) {
|
|
|
511
685
|
kind: "machine-input-batch",
|
|
512
686
|
id: event.id,
|
|
513
687
|
turnId,
|
|
514
|
-
members:
|
|
688
|
+
members: visibleInputs,
|
|
515
689
|
occurredAt: event.occurredAt
|
|
516
690
|
});
|
|
517
691
|
break;
|
|
@@ -521,27 +695,61 @@ function buildTimeline(events) {
|
|
|
521
695
|
if (!text) {
|
|
522
696
|
break;
|
|
523
697
|
}
|
|
698
|
+
const messageId = stringValue(payload.messageId);
|
|
699
|
+
const messageKey = messageId ? JSON.stringify([turnId, messageId]) : null;
|
|
700
|
+
const phase = assistantMessagePhase(payload.phase);
|
|
701
|
+
if (!completeHistoryPrefix && !knownMessagePrefixTurns.has(turnId) || messageKey && incompleteMessageKeys.has(messageKey)) {
|
|
702
|
+
if (messageKey) incompleteMessageKeys.add(messageKey);
|
|
703
|
+
break;
|
|
704
|
+
}
|
|
705
|
+
const identified = messageKey ? identifiedMessages.get(messageKey) : void 0;
|
|
706
|
+
if (identified) {
|
|
707
|
+
if (identified.annotationSource?.eventType !== "agent.message.completed") {
|
|
708
|
+
identified.text += text;
|
|
709
|
+
if (phase && !identified.phase) identified.phase = phase;
|
|
710
|
+
rememberAgentResponse(turnId, identified, false);
|
|
711
|
+
}
|
|
712
|
+
break;
|
|
713
|
+
}
|
|
524
714
|
const open = last();
|
|
525
|
-
if (open?.kind === "
|
|
715
|
+
if (!messageKey && open?.kind === "tool-call" && open.status === "running") {
|
|
716
|
+
const previous = latestAgentResponseByTurn.get(turnId);
|
|
717
|
+
const previousIndex = previous ? items.indexOf(previous.item) : -1;
|
|
718
|
+
if (previous && !previous.completed && previousIndex >= 0 && items.slice(previousIndex + 1).every(
|
|
719
|
+
(item2) => item2.kind === "tool-call" && item2.turnId === turnId && item2.status === "running"
|
|
720
|
+
)) {
|
|
721
|
+
previous.item.text += text;
|
|
722
|
+
break;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
if (!messageKey && open?.kind === "agent-message" && open.streaming && open.turnId === turnId) {
|
|
526
726
|
open.text += text;
|
|
727
|
+
rememberAgentResponse(turnId, open, false);
|
|
527
728
|
break;
|
|
528
729
|
}
|
|
529
730
|
closeStreamingTail();
|
|
530
|
-
|
|
731
|
+
const item = {
|
|
531
732
|
kind: "agent-message",
|
|
532
733
|
id: event.id,
|
|
533
734
|
turnId,
|
|
534
735
|
text,
|
|
736
|
+
...phase ? { phase } : {},
|
|
535
737
|
streaming: true,
|
|
536
738
|
occurredAt: event.occurredAt
|
|
537
|
-
}
|
|
739
|
+
};
|
|
740
|
+
items.push(item);
|
|
741
|
+
if (messageKey) identifiedMessages.set(messageKey, item);
|
|
742
|
+
rememberAgentResponse(turnId, item, false);
|
|
538
743
|
break;
|
|
539
744
|
}
|
|
540
745
|
case "agent.message.completed": {
|
|
746
|
+
knownMessagePrefixTurns.add(turnId);
|
|
541
747
|
const text = stringValue(payload.text);
|
|
748
|
+
const messageId = stringValue(payload.messageId);
|
|
749
|
+
const messageKey = messageId ? JSON.stringify([turnId, messageId]) : null;
|
|
542
750
|
const phase = assistantMessagePhase(payload.phase);
|
|
543
|
-
let openIndex = -1;
|
|
544
|
-
for (let index = items.length - 1; index >= 0; index -= 1) {
|
|
751
|
+
let openIndex = messageKey ? items.indexOf(identifiedMessages.get(messageKey)) : -1;
|
|
752
|
+
for (let index = messageKey ? -1 : items.length - 1; index >= 0; index -= 1) {
|
|
545
753
|
const candidate2 = items[index];
|
|
546
754
|
if (candidate2?.kind === "agent-message" && candidate2.turnId === turnId) {
|
|
547
755
|
openIndex = index;
|
|
@@ -550,12 +758,15 @@ function buildTimeline(events) {
|
|
|
550
758
|
}
|
|
551
759
|
const candidate = openIndex >= 0 ? items[openIndex] : void 0;
|
|
552
760
|
const open = candidate?.kind === "agent-message" ? candidate : void 0;
|
|
553
|
-
if (open && (open.streaming || !open.text || text === open.text || text.startsWith(open.text))) {
|
|
554
|
-
if (!open.text || text && text.startsWith(open.text)) {
|
|
761
|
+
if (open && (messageKey || open.streaming || !open.text || text === open.text || text.startsWith(open.text))) {
|
|
762
|
+
if (!open.text || text && (messageKey || text.startsWith(open.text))) {
|
|
555
763
|
open.text = text || open.text;
|
|
556
764
|
}
|
|
557
|
-
open.streaming = false;
|
|
558
765
|
if (phase) open.phase = phase;
|
|
766
|
+
if (open.startedAt === void 0 && open.occurredAt !== event.occurredAt) {
|
|
767
|
+
open.startedAt = open.occurredAt;
|
|
768
|
+
}
|
|
769
|
+
open.streaming = false;
|
|
559
770
|
open.occurredAt = event.occurredAt;
|
|
560
771
|
open.annotationSource = text && open.text === text ? {
|
|
561
772
|
kind: "assistant_message",
|
|
@@ -569,10 +780,11 @@ function buildTimeline(events) {
|
|
|
569
780
|
items.splice(openIndex, 1);
|
|
570
781
|
items.push(open);
|
|
571
782
|
}
|
|
783
|
+
rememberAgentResponse(turnId, open, true);
|
|
572
784
|
break;
|
|
573
785
|
}
|
|
574
786
|
if (text) {
|
|
575
|
-
|
|
787
|
+
const item = {
|
|
576
788
|
kind: "agent-message",
|
|
577
789
|
id: event.id,
|
|
578
790
|
turnId,
|
|
@@ -588,7 +800,10 @@ function buildTimeline(events) {
|
|
|
588
800
|
turnId,
|
|
589
801
|
text
|
|
590
802
|
}
|
|
591
|
-
}
|
|
803
|
+
};
|
|
804
|
+
items.push(item);
|
|
805
|
+
if (messageKey) identifiedMessages.set(messageKey, item);
|
|
806
|
+
rememberAgentResponse(turnId, item, true);
|
|
592
807
|
}
|
|
593
808
|
break;
|
|
594
809
|
}
|
|
@@ -599,7 +814,7 @@ function buildTimeline(events) {
|
|
|
599
814
|
}
|
|
600
815
|
const open = last();
|
|
601
816
|
if (open?.kind === "reasoning" && open.streaming && open.turnId === turnId) {
|
|
602
|
-
open.text += text;
|
|
817
|
+
open.text += reasoningDeltaJoiner(open.text, text) + text;
|
|
603
818
|
break;
|
|
604
819
|
}
|
|
605
820
|
closeStreamingTail();
|
|
@@ -615,6 +830,7 @@ function buildTimeline(events) {
|
|
|
615
830
|
}
|
|
616
831
|
case "agent.toolCall.created": {
|
|
617
832
|
const name = typeof payload.name === "string" ? payload.name : "tool";
|
|
833
|
+
const display = parseToolDisplayMetadata(payload.display);
|
|
618
834
|
const callId = typeof payload.id === "string" ? payload.id : null;
|
|
619
835
|
const args = payload.arguments ?? null;
|
|
620
836
|
closeStreamingTail();
|
|
@@ -622,13 +838,16 @@ function buildTimeline(events) {
|
|
|
622
838
|
break;
|
|
623
839
|
}
|
|
624
840
|
if (toolMatchesLeaf(name, WORKER_SPAWN_TOOL) || toolMatchesLeaf(name, WORKER_MESSAGE_TOOL)) {
|
|
841
|
+
const spawn = toolMatchesLeaf(name, WORKER_SPAWN_TOOL);
|
|
842
|
+
const title = spawn ? workerTitle(args) : null;
|
|
625
843
|
items.push({
|
|
626
844
|
kind: "worker",
|
|
627
845
|
id: event.id,
|
|
628
846
|
turnId,
|
|
629
847
|
callId,
|
|
630
|
-
action:
|
|
848
|
+
action: spawn ? "spawn" : "message",
|
|
631
849
|
prompt: workerPrompt(args),
|
|
850
|
+
...title ? { title } : {},
|
|
632
851
|
workerSessionId: extractSessionRef(args),
|
|
633
852
|
failure: null,
|
|
634
853
|
status: "running",
|
|
@@ -644,6 +863,7 @@ function buildTimeline(events) {
|
|
|
644
863
|
(item) => item.kind === "tool-call" && item.callId === callId
|
|
645
864
|
);
|
|
646
865
|
if (existing) {
|
|
866
|
+
if (display) existing.display = display;
|
|
647
867
|
if (args != null) {
|
|
648
868
|
existing.arguments = args;
|
|
649
869
|
}
|
|
@@ -660,6 +880,7 @@ function buildTimeline(events) {
|
|
|
660
880
|
turnId,
|
|
661
881
|
callId,
|
|
662
882
|
name,
|
|
883
|
+
...display ? { display } : {},
|
|
663
884
|
arguments: args,
|
|
664
885
|
output: void 0,
|
|
665
886
|
truncation: null,
|
|
@@ -677,10 +898,17 @@ function buildTimeline(events) {
|
|
|
677
898
|
if (!target) {
|
|
678
899
|
break;
|
|
679
900
|
}
|
|
901
|
+
resolvePresentationWait(event, turnId ?? target.turnId);
|
|
680
902
|
if (target.kind === "worker") {
|
|
681
903
|
target.status = isErrorOutput(payload) ? "failed" : "complete";
|
|
682
904
|
target.workerSessionId = target.workerSessionId ?? extractSessionRef(payload.output);
|
|
683
905
|
target.failure = target.status === "failed" ? workerFailure(payload.output) : null;
|
|
906
|
+
if (target.status === "complete" && target.workerSessionId) {
|
|
907
|
+
if (target.action === "spawn") workerSessions.add(target.workerSessionId);
|
|
908
|
+
if (workerSessions.has(target.workerSessionId)) {
|
|
909
|
+
pendingWorkerSessions.add(target.workerSessionId);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
684
912
|
break;
|
|
685
913
|
}
|
|
686
914
|
const truncation = toolCallTruncation(payload);
|
|
@@ -711,6 +939,7 @@ function buildTimeline(events) {
|
|
|
711
939
|
break;
|
|
712
940
|
}
|
|
713
941
|
case "turn.started": {
|
|
942
|
+
if (turnId) clearUnscopedTerminalTracking();
|
|
714
943
|
if (!turnId) break;
|
|
715
944
|
const queuedAt = queuedAtByTurn.get(turnId);
|
|
716
945
|
if (!queuedAt) break;
|
|
@@ -723,7 +952,7 @@ function buildTimeline(events) {
|
|
|
723
952
|
null,
|
|
724
953
|
0,
|
|
725
954
|
queuedAt,
|
|
726
|
-
`${
|
|
955
|
+
`${turnId}-queue`
|
|
727
956
|
);
|
|
728
957
|
break;
|
|
729
958
|
}
|
|
@@ -736,10 +965,19 @@ function buildTimeline(events) {
|
|
|
736
965
|
const startupPhase = startupPhaseForSandboxOperation(name);
|
|
737
966
|
if (startupPhase) {
|
|
738
967
|
closeStreamingTail();
|
|
739
|
-
settleStartupPhase(
|
|
968
|
+
settleStartupPhase(
|
|
969
|
+
startupPhase,
|
|
970
|
+
status,
|
|
971
|
+
numberOrNull(payload.durationMs),
|
|
972
|
+
origin,
|
|
973
|
+
0,
|
|
974
|
+
void 0,
|
|
975
|
+
void 0,
|
|
976
|
+
status === "cancelled" ? startupLifecycleWaitReason(payload) ?? (payload.failureCode === "rotation_in_progress" ? "rotation_in_progress" : void 0) : void 0
|
|
977
|
+
);
|
|
740
978
|
break;
|
|
741
979
|
}
|
|
742
|
-
if ((name === "repository-clone" || name === "file-resource-download") && status !== "failed") {
|
|
980
|
+
if ((name === "repository-clone" || name === "file-resource-download" || name === "optional-repository-access") && status !== "failed") {
|
|
743
981
|
break;
|
|
744
982
|
}
|
|
745
983
|
const existing = findOpenSandbox(items, name);
|
|
@@ -802,30 +1040,88 @@ ${message}` : message;
|
|
|
802
1040
|
if (!isSessionStatus(status)) {
|
|
803
1041
|
break;
|
|
804
1042
|
}
|
|
1043
|
+
const blocked = status === "requires_action" && payload.code === "admission_blocked";
|
|
1044
|
+
if (!blocked && openAdmissionBlocks.length > 0) {
|
|
1045
|
+
for (const open of openAdmissionBlocks) open.resolvedAt = event.occurredAt;
|
|
1046
|
+
openAdmissionBlocks = [];
|
|
1047
|
+
}
|
|
1048
|
+
if (status === "running") resolvePresentationWait(event, turnId);
|
|
805
1049
|
if (!ATTENTION_STATUSES.has(status)) {
|
|
806
1050
|
break;
|
|
807
1051
|
}
|
|
808
|
-
const previous = [...items].reverse().find((
|
|
809
|
-
if (previous?.status === status) {
|
|
1052
|
+
const previous = [...items].reverse().find((item2) => item2.kind === "session-status");
|
|
1053
|
+
if (previous?.status === status && !previous.resolvedAt && Boolean(previous.blocked) === blocked) {
|
|
810
1054
|
break;
|
|
811
1055
|
}
|
|
812
|
-
|
|
1056
|
+
const item = {
|
|
813
1057
|
kind: "session-status",
|
|
814
1058
|
id: event.id,
|
|
815
1059
|
status,
|
|
1060
|
+
occurredAt: event.occurredAt,
|
|
1061
|
+
...blocked ? { blocked: true } : {}
|
|
1062
|
+
};
|
|
1063
|
+
if (blocked) {
|
|
1064
|
+
openAdmissionBlocks.push(item);
|
|
1065
|
+
items.push(item);
|
|
1066
|
+
} else if (status === "requires_action") rememberPresentationWait(item, turnId);
|
|
1067
|
+
else {
|
|
1068
|
+
items.push(item);
|
|
1069
|
+
if (status === "failed") {
|
|
1070
|
+
const key = turnId ?? presentationTurnId;
|
|
1071
|
+
const failures = presentationFailures.get(key) ?? [];
|
|
1072
|
+
failures.push(item);
|
|
1073
|
+
presentationFailures.set(key, failures);
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
break;
|
|
1077
|
+
}
|
|
1078
|
+
case "subscription.account.switched": {
|
|
1079
|
+
const text = payload.reason === "return_to_preferred" ? "Returned to your preferred model." : payload.reason === "failover_cross_provider" ? "Switched to a fallback model." : "Switched to another subscription account.";
|
|
1080
|
+
items.push({
|
|
1081
|
+
kind: "notice",
|
|
1082
|
+
id: event.id,
|
|
1083
|
+
tone: "input",
|
|
1084
|
+
text,
|
|
816
1085
|
occurredAt: event.occurredAt
|
|
817
1086
|
});
|
|
818
1087
|
break;
|
|
819
1088
|
}
|
|
820
|
-
case "
|
|
821
|
-
|
|
822
|
-
|
|
1089
|
+
case "codex.capacity.waiting":
|
|
1090
|
+
case "turn.capacity_waiting": {
|
|
1091
|
+
const capacityWait = capacityWaitPresentation(event.type, payload, turnId);
|
|
1092
|
+
const item = {
|
|
823
1093
|
kind: "notice",
|
|
824
1094
|
id: event.id,
|
|
825
1095
|
tone: "waiting",
|
|
826
|
-
text:
|
|
1096
|
+
text: capacityWait.text,
|
|
1097
|
+
capacityWait: {
|
|
1098
|
+
turnId: capacityWait.turnId,
|
|
1099
|
+
label: capacityWait.label,
|
|
1100
|
+
detail: capacityWait.detail
|
|
1101
|
+
},
|
|
827
1102
|
occurredAt: event.occurredAt
|
|
1103
|
+
};
|
|
1104
|
+
openCapacityWaits = openCapacityWaits.filter((open) => {
|
|
1105
|
+
if ((open.capacityWait?.turnId ?? null) !== turnId) return true;
|
|
1106
|
+
open.resolvedAt = event.occurredAt;
|
|
1107
|
+
return false;
|
|
828
1108
|
});
|
|
1109
|
+
items.push(item);
|
|
1110
|
+
openCapacityWaits.push(item);
|
|
1111
|
+
break;
|
|
1112
|
+
}
|
|
1113
|
+
case "session.requiresAction": {
|
|
1114
|
+
finalizeOpen(turnId, "complete", event.occurredAt);
|
|
1115
|
+
rememberPresentationWait(
|
|
1116
|
+
{
|
|
1117
|
+
kind: "notice",
|
|
1118
|
+
id: event.id,
|
|
1119
|
+
tone: "waiting",
|
|
1120
|
+
text: "Approval needed \u2014 the turn is paused until someone decides.",
|
|
1121
|
+
occurredAt: event.occurredAt
|
|
1122
|
+
},
|
|
1123
|
+
turnId
|
|
1124
|
+
);
|
|
829
1125
|
break;
|
|
830
1126
|
}
|
|
831
1127
|
case "session.context.compaction.requested":
|
|
@@ -839,6 +1135,7 @@ ${message}` : message;
|
|
|
839
1135
|
estimatedTokensBefore: numberOrNull(payload.estimatedTokensBefore),
|
|
840
1136
|
estimatedTokensAfter: null,
|
|
841
1137
|
skipReason: null,
|
|
1138
|
+
providerRejection: null,
|
|
842
1139
|
implementation: typeof payload.implementation === "string" ? payload.implementation : null,
|
|
843
1140
|
occurredAt: event.occurredAt
|
|
844
1141
|
});
|
|
@@ -854,6 +1151,7 @@ ${message}` : message;
|
|
|
854
1151
|
estimatedTokensBefore: numberOrNull(payload.estimatedTokensBefore),
|
|
855
1152
|
estimatedTokensAfter: numberOrNull(payload.estimatedTokensAfter),
|
|
856
1153
|
skipReason: null,
|
|
1154
|
+
providerRejection: null,
|
|
857
1155
|
implementation: typeof payload.implementation === "string" ? payload.implementation : null,
|
|
858
1156
|
occurredAt: event.occurredAt
|
|
859
1157
|
});
|
|
@@ -869,6 +1167,7 @@ ${message}` : message;
|
|
|
869
1167
|
estimatedTokensBefore: numberOrNull(payload.estimatedTokensBefore),
|
|
870
1168
|
estimatedTokensAfter: null,
|
|
871
1169
|
skipReason: typeof payload.reason === "string" ? payload.reason : null,
|
|
1170
|
+
providerRejection: compactionProviderRejection(payload),
|
|
872
1171
|
implementation: typeof payload.implementation === "string" ? payload.implementation : null,
|
|
873
1172
|
occurredAt: event.occurredAt
|
|
874
1173
|
});
|
|
@@ -880,6 +1179,17 @@ ${message}` : message;
|
|
|
880
1179
|
turnId,
|
|
881
1180
|
(startupRecoveryRevisionByTurn.get(turnId) ?? 0) + 1
|
|
882
1181
|
);
|
|
1182
|
+
if (!event.duplicateOfEventId && (!event.turnAssociation || event.turnAssociation === "current")) {
|
|
1183
|
+
for (const item of items) {
|
|
1184
|
+
if (item.kind === "turn-end" && item.turnId === turnId && item.outcome === "failed") {
|
|
1185
|
+
item.resumedAt ??= event.occurredAt;
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
for (const item of presentationFailures.get(turnId) ?? []) {
|
|
1189
|
+
item.resolvedAt = event.occurredAt;
|
|
1190
|
+
}
|
|
1191
|
+
presentationFailures.delete(turnId);
|
|
1192
|
+
}
|
|
883
1193
|
}
|
|
884
1194
|
break;
|
|
885
1195
|
}
|
|
@@ -889,6 +1199,7 @@ ${message}` : message;
|
|
|
889
1199
|
case "tool.auth_needed":
|
|
890
1200
|
case "credential.auth_needed": {
|
|
891
1201
|
const capability = capabilityAuthorizationRequest(payload.capability);
|
|
1202
|
+
const setupRequest = customMcpSetupRequest(payload.setupRequest);
|
|
892
1203
|
if (event.type === "tool.auth_needed" && !stringValue(payload.toolName) && stringValue(payload.serverId) !== "codex_apps") {
|
|
893
1204
|
break;
|
|
894
1205
|
}
|
|
@@ -898,26 +1209,57 @@ ${message}` : message;
|
|
|
898
1209
|
id: event.id,
|
|
899
1210
|
turnId,
|
|
900
1211
|
serverId: typeof payload.serverId === "string" ? payload.serverId : null,
|
|
901
|
-
|
|
1212
|
+
canonicalServerId: typeof payload.canonicalServerId === "string" ? payload.canonicalServerId : null,
|
|
1213
|
+
connectionSubjectScope: payload.connectionSubjectScope === "subject" || payload.connectionSubjectScope === "workspace" ? payload.connectionSubjectScope : null,
|
|
1214
|
+
source: capability || setupRequest ? "capability" : event.type === "tool.auth_needed" ? "tool" : "credential",
|
|
902
1215
|
providerDomain: stringValue(payload.providerDomain),
|
|
903
1216
|
connectionId: typeof payload.connectionId === "string" ? payload.connectionId : null,
|
|
904
|
-
|
|
1217
|
+
authoritySource: payload.authoritySource === "host" ? "host" : null,
|
|
1218
|
+
reason: authNeededReason(
|
|
1219
|
+
payload.authoritySource === "host" && typeof payload.authorizationUrl === "string" ? payload.hostReason ?? payload.reason : payload.reason
|
|
1220
|
+
),
|
|
905
1221
|
scopes: stringList(payload.scopes),
|
|
906
1222
|
resource: typeof payload.resource === "string" ? payload.resource : null,
|
|
907
1223
|
toolName: typeof payload.toolName === "string" ? payload.toolName : null,
|
|
908
1224
|
authorizationUrl: typeof payload.authorizationUrl === "string" ? payload.authorizationUrl : null,
|
|
909
1225
|
capability,
|
|
1226
|
+
setupRequest,
|
|
910
1227
|
occurredAt: event.occurredAt
|
|
911
1228
|
});
|
|
912
1229
|
break;
|
|
913
1230
|
}
|
|
1231
|
+
case "usage.exhausted": {
|
|
1232
|
+
allowanceNotice(event, turnId);
|
|
1233
|
+
break;
|
|
1234
|
+
}
|
|
914
1235
|
case "turn.completed": {
|
|
915
1236
|
if (payload.maintenance === "context_compaction") {
|
|
916
1237
|
finalizeOpen(turnId, "complete", event.occurredAt);
|
|
1238
|
+
takeAgentResponse(turnId);
|
|
1239
|
+
takePendingWaitOutcome(turnId);
|
|
1240
|
+
break;
|
|
1241
|
+
}
|
|
1242
|
+
const allowance = parseAllowanceExhaustedRefusal(payload);
|
|
1243
|
+
if (payload.segmentLimit === SESSION_USAGE_LIMIT_SEGMENT) {
|
|
1244
|
+
finalizeOpen(turnId, "complete", event.occurredAt);
|
|
1245
|
+
takeAgentResponse(turnId);
|
|
1246
|
+
takePendingWaitOutcome(turnId);
|
|
1247
|
+
items.push(turnEndItem(event, "complete", null));
|
|
1248
|
+
items.push(sessionUsageLimitNotice(event, payload));
|
|
1249
|
+
break;
|
|
1250
|
+
}
|
|
1251
|
+
if (allowance) {
|
|
1252
|
+
finalizeOpen(turnId, "complete", event.occurredAt);
|
|
1253
|
+
takeAgentResponse(turnId);
|
|
1254
|
+
takePendingWaitOutcome(turnId);
|
|
1255
|
+
items.push(turnEndItem(event, "failed", ALLOWANCE_TURN_END_TEXT));
|
|
1256
|
+
allowanceNotice(event, turnId);
|
|
917
1257
|
break;
|
|
918
1258
|
}
|
|
919
1259
|
if (isCreditExhaustionPayload(payload)) {
|
|
920
1260
|
finalizeOpen(turnId, "complete", event.occurredAt);
|
|
1261
|
+
takeAgentResponse(turnId);
|
|
1262
|
+
takePendingWaitOutcome(turnId);
|
|
921
1263
|
items.push(turnEndItem(event, "failed", CREDIT_EXHAUSTION_MESSAGE));
|
|
922
1264
|
items.push({
|
|
923
1265
|
kind: "notice",
|
|
@@ -928,30 +1270,116 @@ ${message}` : message;
|
|
|
928
1270
|
});
|
|
929
1271
|
break;
|
|
930
1272
|
}
|
|
1273
|
+
const latestAgentResponse = takeAgentResponse(turnId);
|
|
1274
|
+
const finalOutput = stringValue(payload.output);
|
|
1275
|
+
const visibleFinalOutput = stripOpaqueCitationTokens(finalOutput).trim();
|
|
1276
|
+
const visibleTrackedResponse = stripOpaqueCitationTokens(
|
|
1277
|
+
latestAgentResponse?.item.text ?? ""
|
|
1278
|
+
).trim();
|
|
1279
|
+
const finalOutputMirrorsCommentary = latestAgentResponse?.item.phase === "commentary" && visibleTrackedResponse === visibleFinalOutput;
|
|
1280
|
+
const hasAuthoritativeFinalOutput = Boolean(visibleFinalOutput) && !finalOutputMirrorsCommentary;
|
|
1281
|
+
const pendingWaitOutcome = takePendingWaitOutcome(turnId);
|
|
1282
|
+
if (hasAuthoritativeFinalOutput) {
|
|
1283
|
+
if (latestAgentResponse && !latestAgentResponse.completed && finalOutput.startsWith(latestAgentResponse.item.text)) {
|
|
1284
|
+
latestAgentResponse.item.text = finalOutput;
|
|
1285
|
+
latestAgentResponse.item.streaming = false;
|
|
1286
|
+
if (latestAgentResponse.item.startedAt === void 0 && latestAgentResponse.item.occurredAt !== event.occurredAt) {
|
|
1287
|
+
latestAgentResponse.item.startedAt = latestAgentResponse.item.occurredAt;
|
|
1288
|
+
}
|
|
1289
|
+
latestAgentResponse.item.occurredAt = event.occurredAt;
|
|
1290
|
+
const responseIndex = items.indexOf(latestAgentResponse.item);
|
|
1291
|
+
if (responseIndex >= 0 && responseIndex < items.length - 1) {
|
|
1292
|
+
items.splice(responseIndex, 1);
|
|
1293
|
+
items.push(latestAgentResponse.item);
|
|
1294
|
+
}
|
|
1295
|
+
} else if (visibleTrackedResponse !== visibleFinalOutput) {
|
|
1296
|
+
items.push({
|
|
1297
|
+
kind: "agent-message",
|
|
1298
|
+
id: `${event.id}-output-message`,
|
|
1299
|
+
turnId,
|
|
1300
|
+
text: finalOutput,
|
|
1301
|
+
streaming: false,
|
|
1302
|
+
occurredAt: event.occurredAt
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
931
1306
|
finalizeOpen(turnId, "complete", event.occurredAt);
|
|
932
|
-
|
|
1307
|
+
const completedTurn = turnEndItem(event, "complete", null);
|
|
1308
|
+
items.push(completedTurn);
|
|
1309
|
+
if (turnCompletedWithEmptyFinalReply(payload)) {
|
|
1310
|
+
items.push({
|
|
1311
|
+
kind: "notice",
|
|
1312
|
+
id: `${event.id}-empty-final-reply`,
|
|
1313
|
+
tone: "input",
|
|
1314
|
+
text: EMPTY_FINAL_REPLY_NOTICE,
|
|
1315
|
+
recordedOutcome: true,
|
|
1316
|
+
occurredAt: event.occurredAt
|
|
1317
|
+
});
|
|
1318
|
+
}
|
|
1319
|
+
const hasCompletedFinalResponse = latestAgentResponse?.completed === true && latestAgentResponse.item.phase !== "commentary" && Boolean(visibleTrackedResponse);
|
|
1320
|
+
if (!hasAuthoritativeFinalOutput && pendingWaitOutcome) {
|
|
1321
|
+
completedTurn.preserveWaitResponse = true;
|
|
1322
|
+
}
|
|
1323
|
+
if (!hasAuthoritativeFinalOutput && !hasCompletedFinalResponse && pendingWaitOutcome) {
|
|
1324
|
+
const notice = {
|
|
1325
|
+
kind: "notice",
|
|
1326
|
+
id: `${pendingWaitOutcome.id}-visible-outcome`,
|
|
1327
|
+
tone: "waiting",
|
|
1328
|
+
text: waitingOutcomeText(pendingWaitOutcome.reason),
|
|
1329
|
+
recordedOutcome: true,
|
|
1330
|
+
...pendingWorkerSessions.size > 0 ? { waitingAgents: pendingWorkerSessions.size } : {},
|
|
1331
|
+
occurredAt: pendingWaitOutcome.occurredAt
|
|
1332
|
+
};
|
|
1333
|
+
items.push(notice);
|
|
1334
|
+
openWaitNotice = notice;
|
|
1335
|
+
}
|
|
933
1336
|
break;
|
|
934
1337
|
}
|
|
935
1338
|
case "turn.failed": {
|
|
1339
|
+
takeAgentResponse(turnId);
|
|
1340
|
+
takePendingWaitOutcome(turnId);
|
|
936
1341
|
const hadActivity = hasTurnActivity(items, turnId);
|
|
937
|
-
const
|
|
1342
|
+
const allowance = parseAllowanceExhaustedRefusal(payload);
|
|
1343
|
+
const failureText = allowance ? ALLOWANCE_TURN_END_TEXT : isCreditExhaustionPayload(payload) ? CREDIT_EXHAUSTION_MESSAGE : failureMessage(payload);
|
|
938
1344
|
finalizeOpen(turnId, "cancelled", event.occurredAt);
|
|
939
1345
|
items.push(turnEndItem(event, "failed", failureText));
|
|
940
|
-
|
|
1346
|
+
const failure = allowance ? null : presentTurnFailureText(failureText);
|
|
1347
|
+
let landmarkIndex = -1;
|
|
1348
|
+
if (failure?.detail !== void 0 && turnId !== null) {
|
|
1349
|
+
for (let index = items.length - 2; index >= 0; index -= 1) {
|
|
1350
|
+
const item = items[index];
|
|
1351
|
+
if (item?.kind === "turn-end" && item.turnId === turnId) break;
|
|
1352
|
+
if (item?.kind === "context-compaction" && item.turnId === turnId && item.phase === "skipped" && item.skipReason === "summarization_failed") {
|
|
1353
|
+
landmarkIndex = index;
|
|
1354
|
+
break;
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
const landmark = landmarkIndex >= 0 ? items[landmarkIndex] : void 0;
|
|
1359
|
+
if (landmark?.kind === "context-compaction" && failure?.detail !== void 0) {
|
|
1360
|
+
items[landmarkIndex] = { ...landmark, failureDetail: failure.detail };
|
|
1361
|
+
}
|
|
1362
|
+
if (allowance) {
|
|
1363
|
+
allowanceNotice(event, turnId);
|
|
1364
|
+
} else if (!hadActivity && !landmark) {
|
|
941
1365
|
items.push({
|
|
942
1366
|
kind: "notice",
|
|
943
1367
|
id: event.id,
|
|
944
1368
|
tone: "failed",
|
|
945
|
-
text:
|
|
1369
|
+
text: failure?.summary ?? "The turn failed.",
|
|
1370
|
+
...failure?.detail ? { details: { label: "Details", value: failure.detail } } : {},
|
|
946
1371
|
occurredAt: event.occurredAt
|
|
947
1372
|
});
|
|
948
1373
|
}
|
|
949
1374
|
break;
|
|
950
1375
|
}
|
|
1376
|
+
case "turn.superseded":
|
|
951
1377
|
case "turn.cancelled": {
|
|
952
|
-
if (turnId && !prescan.startedTurnIds.has(turnId)) {
|
|
1378
|
+
if (event.type === "turn.cancelled" && turnId && !prescan.startedTurnIds.has(turnId)) {
|
|
953
1379
|
break;
|
|
954
1380
|
}
|
|
1381
|
+
takeAgentResponse(turnId);
|
|
1382
|
+
takePendingWaitOutcome(turnId);
|
|
955
1383
|
const hadActivity = hasTurnActivity(items, turnId);
|
|
956
1384
|
finalizeOpen(turnId, "cancelled", event.occurredAt);
|
|
957
1385
|
items.push(turnEndItem(event, "cancelled", null));
|
|
@@ -966,6 +1394,40 @@ ${message}` : message;
|
|
|
966
1394
|
}
|
|
967
1395
|
break;
|
|
968
1396
|
}
|
|
1397
|
+
case "instruction.confirmation.recovered": {
|
|
1398
|
+
const receipt = asRecord2(payload.receipt);
|
|
1399
|
+
if (receipt.outcome !== "published") break;
|
|
1400
|
+
closeStreamingTail();
|
|
1401
|
+
items.push({
|
|
1402
|
+
kind: "notice",
|
|
1403
|
+
id: event.id,
|
|
1404
|
+
tone: "input",
|
|
1405
|
+
text: "Your previously approved workspace instruction was saved.",
|
|
1406
|
+
occurredAt: event.occurredAt
|
|
1407
|
+
});
|
|
1408
|
+
break;
|
|
1409
|
+
}
|
|
1410
|
+
case "knowledge.confirmation.recovered":
|
|
1411
|
+
case "knowledge.source.prepared":
|
|
1412
|
+
case "knowledge.source.failed": {
|
|
1413
|
+
const receipt = asRecord2(payload.receipt);
|
|
1414
|
+
const outcome = event.type === "knowledge.source.failed" ? "failed" : receipt.outcome;
|
|
1415
|
+
if (event.type !== "knowledge.confirmation.recovered" && typeof payload.fileId !== "string" || !["published", "pending", "rejected", "archived", "failed"].includes(String(outcome)))
|
|
1416
|
+
break;
|
|
1417
|
+
closeStreamingTail();
|
|
1418
|
+
items.push({
|
|
1419
|
+
kind: "knowledge",
|
|
1420
|
+
id: event.id,
|
|
1421
|
+
turnId,
|
|
1422
|
+
fileId: typeof payload.fileId === "string" ? payload.fileId : void 0,
|
|
1423
|
+
filename: typeof payload.filename === "string" ? payload.filename : void 0,
|
|
1424
|
+
entryId: typeof receipt.entryId === "string" ? receipt.entryId : void 0,
|
|
1425
|
+
status: outcome === "failed" ? "failed" : "complete",
|
|
1426
|
+
outcome,
|
|
1427
|
+
occurredAt: event.occurredAt
|
|
1428
|
+
});
|
|
1429
|
+
break;
|
|
1430
|
+
}
|
|
969
1431
|
case "memory.saved":
|
|
970
1432
|
case "memory.corrected": {
|
|
971
1433
|
const memory = memoryItem(event.id, event.type, turnId, payload, event.occurredAt);
|
|
@@ -991,6 +1453,9 @@ ${message}` : message;
|
|
|
991
1453
|
case "goal.cleared":
|
|
992
1454
|
case "goal.held":
|
|
993
1455
|
case "goal.continuation": {
|
|
1456
|
+
if (event.type === "goal.held" && payload.actor === "agent") {
|
|
1457
|
+
rememberPendingWaitOutcome(pendingWaitOutcomeByTurn, event, payload, turnId);
|
|
1458
|
+
}
|
|
994
1459
|
if (shouldSuppressAgentGoalLandmark(event.type, payload)) {
|
|
995
1460
|
break;
|
|
996
1461
|
}
|
|
@@ -1003,11 +1468,24 @@ ${message}` : message;
|
|
|
1003
1468
|
});
|
|
1004
1469
|
break;
|
|
1005
1470
|
}
|
|
1471
|
+
case "session.wait.started": {
|
|
1472
|
+
if (payload.actor === "agent") {
|
|
1473
|
+
rememberPendingWaitOutcome(pendingWaitOutcomeByTurn, event, payload, turnId);
|
|
1474
|
+
}
|
|
1475
|
+
break;
|
|
1476
|
+
}
|
|
1006
1477
|
default:
|
|
1007
1478
|
break;
|
|
1008
1479
|
}
|
|
1009
1480
|
}
|
|
1481
|
+
const sourceEventsById = new Map(events.map((event) => [event.id, event]));
|
|
1010
1482
|
for (const item of items) {
|
|
1483
|
+
const source = sourceEventsById.get(item.id);
|
|
1484
|
+
const canonical = "annotationSource" in item ? item.annotationSource : void 0;
|
|
1485
|
+
item.sourceEvents = [
|
|
1486
|
+
...source ? [{ eventId: source.id, sequence: source.sequence }] : [],
|
|
1487
|
+
...canonical && canonical.eventId !== source?.id ? [{ eventId: canonical.eventId, sequence: canonical.sequence }] : []
|
|
1488
|
+
];
|
|
1011
1489
|
if (item.kind === "agent-message") {
|
|
1012
1490
|
item.text = stripOpaqueCitationTokens(item.text);
|
|
1013
1491
|
}
|
|
@@ -1067,9 +1545,11 @@ function humanInputQuestions(value) {
|
|
|
1067
1545
|
const id = stringValue(question.id);
|
|
1068
1546
|
const prompt = stringValue(question.prompt);
|
|
1069
1547
|
const kind = question.kind;
|
|
1070
|
-
if (!id || !prompt || kind !== "text" && kind !== "single_select" && kind !== "multi_select") {
|
|
1548
|
+
if (!id || !prompt || kind !== "text" && kind !== "single_select" && kind !== "multi_select" && kind !== "secret") {
|
|
1071
1549
|
return [];
|
|
1072
1550
|
}
|
|
1551
|
+
const secret = kind === "secret" ? humanInputSecretSpec(question.secret) : null;
|
|
1552
|
+
if (kind === "secret" && !secret) return [];
|
|
1073
1553
|
const options = Array.isArray(question.options) ? question.options.map(asRecord2).flatMap((option) => {
|
|
1074
1554
|
const optionId = stringValue(option.id);
|
|
1075
1555
|
const label = stringValue(option.label);
|
|
@@ -1084,18 +1564,45 @@ function humanInputQuestions(value) {
|
|
|
1084
1564
|
helpText: stringValue(question.helpText) || null,
|
|
1085
1565
|
options,
|
|
1086
1566
|
required: question.required === true,
|
|
1087
|
-
allowOther: question.allowOther === true
|
|
1567
|
+
allowOther: question.allowOther === true,
|
|
1568
|
+
...secret ? { secret } : {}
|
|
1088
1569
|
}
|
|
1089
1570
|
];
|
|
1090
1571
|
});
|
|
1091
1572
|
}
|
|
1573
|
+
function humanInputSecretSpec(value) {
|
|
1574
|
+
const spec = asRecord2(value);
|
|
1575
|
+
const item = stringValue(spec.item);
|
|
1576
|
+
if (!item) return null;
|
|
1577
|
+
return spec;
|
|
1578
|
+
}
|
|
1579
|
+
function humanInputSecretResult(value) {
|
|
1580
|
+
if (value === void 0 || value === null) return null;
|
|
1581
|
+
const result = asRecord2(value);
|
|
1582
|
+
const reference = stringValue(result.reference);
|
|
1583
|
+
const vaultName = stringValue(result.vaultName);
|
|
1584
|
+
const itemName = stringValue(result.itemName);
|
|
1585
|
+
const saveTo = result.saveTo;
|
|
1586
|
+
if (!reference || !vaultName || !itemName || saveTo !== "user" && saveTo !== "task" && saveTo !== "workspace") {
|
|
1587
|
+
return null;
|
|
1588
|
+
}
|
|
1589
|
+
return {
|
|
1590
|
+
reference,
|
|
1591
|
+
username: stringValue(result.username) || null,
|
|
1592
|
+
vaultName,
|
|
1593
|
+
itemName,
|
|
1594
|
+
saveTo
|
|
1595
|
+
};
|
|
1596
|
+
}
|
|
1092
1597
|
function humanInputAnswer(value) {
|
|
1093
1598
|
const questionId = stringValue(value.questionId);
|
|
1094
1599
|
if (!questionId) return null;
|
|
1600
|
+
const secret = humanInputSecretResult(value.secret);
|
|
1095
1601
|
return {
|
|
1096
1602
|
questionId,
|
|
1097
1603
|
values: Array.isArray(value.values) ? value.values.filter((answer) => typeof answer === "string") : [],
|
|
1098
|
-
...typeof value.other === "string" && value.other ? { other: value.other } : {}
|
|
1604
|
+
...typeof value.other === "string" && value.other ? { other: value.other } : {},
|
|
1605
|
+
...secret ? { secret } : {}
|
|
1099
1606
|
};
|
|
1100
1607
|
}
|
|
1101
1608
|
function humanInputAnswerSummary(answer, question) {
|
|
@@ -1107,7 +1614,8 @@ function humanInputAnswerSummary(answer, question) {
|
|
|
1107
1614
|
questionId: answer.questionId,
|
|
1108
1615
|
label: question?.label || question?.prompt || fallbackLabel,
|
|
1109
1616
|
prompt: question?.prompt || fallbackLabel,
|
|
1110
|
-
values
|
|
1617
|
+
values,
|
|
1618
|
+
...answer.secret ? { secret: answer.secret } : {}
|
|
1111
1619
|
};
|
|
1112
1620
|
}
|
|
1113
1621
|
function providerNativeToolStatus(rawValue) {
|
|
@@ -1151,7 +1659,9 @@ function mergeToolCallRaw(existingValue, nextValue) {
|
|
|
1151
1659
|
function stripOpaqueCitationTokens(text) {
|
|
1152
1660
|
return text.replace(/\s*cite(?:[^]+)+/gu, "");
|
|
1153
1661
|
}
|
|
1662
|
+
var ALLOWANCE_TURN_END_TEXT = "Usage limit reached";
|
|
1154
1663
|
function isCreditExhaustionPayload(payload) {
|
|
1664
|
+
if (payload.code === "allowance_exhausted") return false;
|
|
1155
1665
|
return isCreditExhaustion({
|
|
1156
1666
|
error: typeof payload.error === "string" ? payload.error : null,
|
|
1157
1667
|
detail: typeof payload.detail === "string" ? payload.detail : null,
|
|
@@ -1190,15 +1700,18 @@ function isActivityItem(item) {
|
|
|
1190
1700
|
case "sandbox":
|
|
1191
1701
|
case "startup-phase":
|
|
1192
1702
|
case "memory":
|
|
1703
|
+
case "knowledge":
|
|
1193
1704
|
case "fleet-decision":
|
|
1194
1705
|
return true;
|
|
1195
1706
|
default:
|
|
1196
1707
|
return false;
|
|
1197
1708
|
}
|
|
1198
1709
|
}
|
|
1199
|
-
function groupTimeline(items) {
|
|
1710
|
+
function groupTimeline(items, options = {}) {
|
|
1711
|
+
if (options.readableTurns || options.foldExchanges) return groupReadableTurns(items);
|
|
1200
1712
|
const groups = [];
|
|
1201
1713
|
for (const item of items) {
|
|
1714
|
+
if (item.kind === "notice" && item.capacityWait && item.resolvedAt) continue;
|
|
1202
1715
|
if (isActivityItem(item)) {
|
|
1203
1716
|
const open = groups[groups.length - 1];
|
|
1204
1717
|
if (open?.kind === "activity" && open.outcome === void 0) {
|
|
@@ -1221,6 +1734,414 @@ function groupTimeline(items) {
|
|
|
1221
1734
|
}
|
|
1222
1735
|
return groups;
|
|
1223
1736
|
}
|
|
1737
|
+
function groupReadableTurns(items) {
|
|
1738
|
+
let groups = [];
|
|
1739
|
+
const turns = /* @__PURE__ */ new Map();
|
|
1740
|
+
const seenTurns = /* @__PURE__ */ new Set();
|
|
1741
|
+
const settlements = /* @__PURE__ */ new Map();
|
|
1742
|
+
const compactionTurns = /* @__PURE__ */ new Map();
|
|
1743
|
+
const messages = /* @__PURE__ */ new Map();
|
|
1744
|
+
const capacityPauses = /* @__PURE__ */ new Map();
|
|
1745
|
+
const liveCapacityWaits = /* @__PURE__ */ new Map();
|
|
1746
|
+
const inputs = /* @__PURE__ */ new Map();
|
|
1747
|
+
const itemOrder = new Map(items.map((item, index) => [item.id, index]));
|
|
1748
|
+
const answersPerson = /* @__PURE__ */ new Set();
|
|
1749
|
+
let personAwaitingTurn = false;
|
|
1750
|
+
let steeredTurn;
|
|
1751
|
+
let legacyTurn = "start";
|
|
1752
|
+
let currentTurn = legacyTurn;
|
|
1753
|
+
for (const item of items) {
|
|
1754
|
+
if (item.kind === "user-message") {
|
|
1755
|
+
legacyTurn = item.id;
|
|
1756
|
+
personAwaitingTurn = true;
|
|
1757
|
+
steeredTurn = void 0;
|
|
1758
|
+
if (seenTurns.has(currentTurn) && !settlements.has(currentTurn)) {
|
|
1759
|
+
answersPerson.add(currentTurn);
|
|
1760
|
+
steeredTurn = currentTurn;
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
const itemTurnId = item.kind === "notice" && item.capacityWait ? item.capacityWait.turnId : "turnId" in item ? item.turnId : null;
|
|
1764
|
+
const key = itemTurnId || legacyTurn;
|
|
1765
|
+
if (steeredTurn !== void 0 && key === steeredTurn && (isActivityItem(item) || item.kind === "agent-message" && item.text.trim())) {
|
|
1766
|
+
personAwaitingTurn = false;
|
|
1767
|
+
steeredTurn = void 0;
|
|
1768
|
+
}
|
|
1769
|
+
if (itemTurnId || isActivityItem(item) || item.kind === "agent-message" && item.text.trim()) {
|
|
1770
|
+
if (key !== currentTurn && !seenTurns.has(key)) {
|
|
1771
|
+
const previous = turns.get(currentTurn);
|
|
1772
|
+
if (!settlements.has(currentTurn)) {
|
|
1773
|
+
settlements.set(currentTurn, { endedAt: item.occurredAt });
|
|
1774
|
+
}
|
|
1775
|
+
if (previous?.work && !previous.work.endedAt) previous.work.endedAt = item.occurredAt;
|
|
1776
|
+
currentTurn = key;
|
|
1777
|
+
if (personAwaitingTurn) answersPerson.add(key);
|
|
1778
|
+
personAwaitingTurn = false;
|
|
1779
|
+
steeredTurn = void 0;
|
|
1780
|
+
}
|
|
1781
|
+
seenTurns.add(key);
|
|
1782
|
+
}
|
|
1783
|
+
const workForTurn = () => {
|
|
1784
|
+
let group = turns.get(key);
|
|
1785
|
+
const firstMessage = messages.get(key)?.[0];
|
|
1786
|
+
const messageStart = firstMessage?.startedAt ?? firstMessage?.occurredAt;
|
|
1787
|
+
const activityStart = item.kind === "startup-phase" ? item.loadingStartedAt ?? item.occurredAt : item.occurredAt;
|
|
1788
|
+
const startedAt = messageStart && Date.parse(messageStart) < Date.parse(activityStart) ? messageStart : activityStart;
|
|
1789
|
+
if (!group) {
|
|
1790
|
+
const settlement = settlements.get(key);
|
|
1791
|
+
group = {
|
|
1792
|
+
kind: "activity",
|
|
1793
|
+
id: `work-${key}`,
|
|
1794
|
+
items: [],
|
|
1795
|
+
work: { startedAt, details: [] }
|
|
1796
|
+
};
|
|
1797
|
+
if (settlement) {
|
|
1798
|
+
group.work.endedAt = settlement.endedAt;
|
|
1799
|
+
if (settlement.outcome) group.outcome = settlement.outcome;
|
|
1800
|
+
if (settlement.failureText) group.failureText = settlement.failureText;
|
|
1801
|
+
}
|
|
1802
|
+
turns.set(key, group);
|
|
1803
|
+
const firstMessageIndex = settlement && firstMessage ? groups.findIndex((entry) => entry.kind === "item" && entry.item === firstMessage) : -1;
|
|
1804
|
+
if (firstMessageIndex >= 0) groups.splice(firstMessageIndex, 0, group);
|
|
1805
|
+
else groups.push(group);
|
|
1806
|
+
} else if (Date.parse(startedAt) < Date.parse(group.work.startedAt)) {
|
|
1807
|
+
group.work.startedAt = startedAt;
|
|
1808
|
+
}
|
|
1809
|
+
return group;
|
|
1810
|
+
};
|
|
1811
|
+
if (isActivityItem(item)) {
|
|
1812
|
+
const group = workForTurn();
|
|
1813
|
+
group.items.push(item);
|
|
1814
|
+
const previous = group.work.details.at(-1);
|
|
1815
|
+
const preparing = (entry) => entry.kind === "startup-phase" || entry.kind === "reasoning" && !entry.text.trim();
|
|
1816
|
+
if (preparing(item) && previous?.kind === "activity" && previous.items.every(preparing) && previous.items.at(-1) === items[(itemOrder.get(item.id) ?? 0) - 1])
|
|
1817
|
+
previous.items.push(item);
|
|
1818
|
+
else
|
|
1819
|
+
group.work.details.push({ kind: "activity", id: `work-item-${item.id}`, items: [item] });
|
|
1820
|
+
delete group.work.waiting;
|
|
1821
|
+
} else if (item.kind === "notice" && item.capacityWait) {
|
|
1822
|
+
const pauses = capacityPauses.get(key) ?? [];
|
|
1823
|
+
pauses.push({
|
|
1824
|
+
startedAt: item.occurredAt,
|
|
1825
|
+
...item.resolvedAt ? { endedAt: item.resolvedAt } : {}
|
|
1826
|
+
});
|
|
1827
|
+
capacityPauses.set(key, pauses);
|
|
1828
|
+
if (!item.resolvedAt) {
|
|
1829
|
+
if (settlements.has(key)) groups.push({ kind: "item", item });
|
|
1830
|
+
else {
|
|
1831
|
+
workForTurn();
|
|
1832
|
+
liveCapacityWaits.set(key, item);
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
} else if (item.kind === "turn-end") {
|
|
1836
|
+
if (!item.resumedAt) {
|
|
1837
|
+
settlements.set(key, {
|
|
1838
|
+
endedAt: item.occurredAt,
|
|
1839
|
+
outcome: item.outcome,
|
|
1840
|
+
...item.failureText ? { failureText: item.failureText } : {}
|
|
1841
|
+
});
|
|
1842
|
+
}
|
|
1843
|
+
const group = turns.get(key);
|
|
1844
|
+
if (group?.work) {
|
|
1845
|
+
if (item.resumedAt) {
|
|
1846
|
+
group.work.details.push({
|
|
1847
|
+
kind: "item",
|
|
1848
|
+
item: {
|
|
1849
|
+
kind: "notice",
|
|
1850
|
+
id: item.id,
|
|
1851
|
+
tone: "failed",
|
|
1852
|
+
text: item.failureText ?? "The turn failed before retrying.",
|
|
1853
|
+
occurredAt: item.occurredAt
|
|
1854
|
+
}
|
|
1855
|
+
});
|
|
1856
|
+
continue;
|
|
1857
|
+
}
|
|
1858
|
+
group.outcome = item.outcome;
|
|
1859
|
+
if (item.failureText) group.failureText = item.failureText;
|
|
1860
|
+
group.work.endedAt = item.occurredAt;
|
|
1861
|
+
}
|
|
1862
|
+
} else if (item.kind === "context-compaction" && item.phase === "compacted") {
|
|
1863
|
+
compactionTurns.set(item, key);
|
|
1864
|
+
groups.push({ kind: "item", item });
|
|
1865
|
+
} else if (item.kind === "machine-input-batch" && item.members.every((member) => ROUTINE_MACHINE_INPUT_KINDS.has(member.kind))) {
|
|
1866
|
+
const previous = inputs.get(key);
|
|
1867
|
+
if (previous) {
|
|
1868
|
+
previous.members.push(
|
|
1869
|
+
...item.members.filter((member) => !previous.members.some((old) => old.id === member.id))
|
|
1870
|
+
);
|
|
1871
|
+
previous.sourceEvents = [...previous.sourceEvents ?? [], ...item.sourceEvents ?? []];
|
|
1872
|
+
} else {
|
|
1873
|
+
const batch = { ...item, compact: true, members: [...item.members] };
|
|
1874
|
+
inputs.set(key, batch);
|
|
1875
|
+
groups.push({ kind: "item", item: batch });
|
|
1876
|
+
}
|
|
1877
|
+
} else if (item.kind === "worker-completion" || item.kind === "goal" && item.action === "continuation") {
|
|
1878
|
+
const group = turns.get(currentTurn);
|
|
1879
|
+
if (group?.work) group.work.details.push({ kind: "item", item });
|
|
1880
|
+
else groups.push({ kind: "item", item });
|
|
1881
|
+
} else {
|
|
1882
|
+
const current = turns.get(currentTurn)?.work;
|
|
1883
|
+
const liveApprovalWait = item.kind === "notice" && item.tone === "waiting" && !item.recordedOutcome && !item.resolvedAt && item.text.startsWith("Approval needed") && current !== void 0 && !current.endedAt;
|
|
1884
|
+
const liveStatusWait = item.kind === "session-status" && item.status === "requires_action" && !item.blocked && !item.resolvedAt && current !== void 0 && !current.endedAt;
|
|
1885
|
+
if (!liveApprovalWait && !liveStatusWait) groups.push({ kind: "item", item });
|
|
1886
|
+
if (current && !current.endedAt) {
|
|
1887
|
+
if (item.kind === "notice" && item.tone === "waiting" && !item.recordedOutcome && !item.resolvedAt) {
|
|
1888
|
+
current.waiting = {
|
|
1889
|
+
label: item.text.startsWith("Approval needed") ? "Waiting for you" : "Waiting",
|
|
1890
|
+
since: item.occurredAt
|
|
1891
|
+
};
|
|
1892
|
+
} else if (item.kind === "session-status" && item.status === "requires_action" && !item.blocked && !item.resolvedAt) {
|
|
1893
|
+
current.waiting = { label: "Waiting for you", since: item.occurredAt };
|
|
1894
|
+
} else if (item.kind === "session-status" && ["paused", "cancelled", "failed"].includes(item.status) && !item.resolvedAt) {
|
|
1895
|
+
current.endedAt = item.occurredAt;
|
|
1896
|
+
delete current.waiting;
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
if (item.kind === "agent-message" && item.text.trim()) {
|
|
1900
|
+
const prose = messages.get(key) ?? [];
|
|
1901
|
+
prose.push(item);
|
|
1902
|
+
messages.set(key, prose);
|
|
1903
|
+
if ((item.phase !== "final_answer" || prose.length > 1) && (turns.has(key) || !settlements.has(key)))
|
|
1904
|
+
workForTurn();
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
for (const [key, group] of turns) {
|
|
1909
|
+
const work = group.work;
|
|
1910
|
+
const live = liveCapacityWaits.get(key);
|
|
1911
|
+
if (live?.capacityWait && !work.endedAt) {
|
|
1912
|
+
work.waiting = {
|
|
1913
|
+
label: live.capacityWait.label,
|
|
1914
|
+
since: live.occurredAt,
|
|
1915
|
+
detail: live.capacityWait.detail,
|
|
1916
|
+
// Its span is not work and may last until a quota resets: no clock.
|
|
1917
|
+
untimed: true
|
|
1918
|
+
};
|
|
1919
|
+
}
|
|
1920
|
+
const pausedMs = (capacityPauses.get(key) ?? []).reduce((total, pause) => {
|
|
1921
|
+
if (!pause.endedAt) return total;
|
|
1922
|
+
const start = Math.max(Date.parse(work.startedAt), Date.parse(pause.startedAt));
|
|
1923
|
+
const end = Math.min(
|
|
1924
|
+
work.endedAt ? Date.parse(work.endedAt) : Number.POSITIVE_INFINITY,
|
|
1925
|
+
Date.parse(pause.endedAt)
|
|
1926
|
+
);
|
|
1927
|
+
return Number.isFinite(start) && Number.isFinite(end) && end > start ? total + end - start : total;
|
|
1928
|
+
}, 0);
|
|
1929
|
+
if (pausedMs > 0) work.pausedMs = pausedMs;
|
|
1930
|
+
}
|
|
1931
|
+
groups = groups.filter((entry) => {
|
|
1932
|
+
if (entry.kind !== "item" || entry.item.kind !== "context-compaction") return true;
|
|
1933
|
+
const key = compactionTurns.get(entry.item);
|
|
1934
|
+
const work = key === void 0 ? void 0 : turns.get(key)?.work;
|
|
1935
|
+
if (!work) return true;
|
|
1936
|
+
work.details.push(entry);
|
|
1937
|
+
return false;
|
|
1938
|
+
});
|
|
1939
|
+
const beforeRows = /* @__PURE__ */ new Map();
|
|
1940
|
+
const afterRows = /* @__PURE__ */ new Map();
|
|
1941
|
+
const movedRows = /* @__PURE__ */ new Set();
|
|
1942
|
+
const foldedProse = /* @__PURE__ */ new Set();
|
|
1943
|
+
const positions = /* @__PURE__ */ new Map();
|
|
1944
|
+
const nextBoundary = /* @__PURE__ */ new Map();
|
|
1945
|
+
let boundary = groups.length;
|
|
1946
|
+
for (let index = groups.length - 1; index >= 0; index -= 1) {
|
|
1947
|
+
const entry = groups[index];
|
|
1948
|
+
positions.set(entry.kind === "item" ? entry.item : entry, index);
|
|
1949
|
+
if (entry.kind === "activity" && entry.work) {
|
|
1950
|
+
nextBoundary.set(entry, boundary);
|
|
1951
|
+
boundary = index;
|
|
1952
|
+
} else if (entry.kind === "item" && (entry.item.kind === "user-message" || entry.item.kind === "machine-input-batch")) {
|
|
1953
|
+
boundary = index;
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
for (const [key, group] of turns) {
|
|
1957
|
+
const prose = messages.get(key) ?? [];
|
|
1958
|
+
const settledAt = group.work.endedAt;
|
|
1959
|
+
const responseCandidates = settledAt ? prose.filter(
|
|
1960
|
+
(message) => Date.parse(message.startedAt ?? message.occurredAt) <= Date.parse(settledAt)
|
|
1961
|
+
) : prose;
|
|
1962
|
+
const response = responseCandidates.filter((message) => message.phase === "final_answer").at(-1) ?? (settledAt ? responseCandidates.at(-1) ?? prose.filter((message) => message.phase === "final_answer").at(-1) : void 0);
|
|
1963
|
+
const responses = new Set(response ? [response] : []);
|
|
1964
|
+
const firstCandidate = responseCandidates[0];
|
|
1965
|
+
if (settledAt && firstCandidate && answersPerson.has(key) && responseCandidates.every((message) => message.phase === "commentary")) {
|
|
1966
|
+
responses.add(firstCandidate);
|
|
1967
|
+
}
|
|
1968
|
+
if (settledAt) {
|
|
1969
|
+
for (const message of responseCandidates) {
|
|
1970
|
+
if (responses.has(message) || message.text.includes("![")) continue;
|
|
1971
|
+
foldedProse.add(message);
|
|
1972
|
+
group.work.details.push({ kind: "item", item: message });
|
|
1973
|
+
}
|
|
1974
|
+
} else {
|
|
1975
|
+
for (const message of prose) {
|
|
1976
|
+
if (message.phase === "final_answer" || message.text.includes("![")) continue;
|
|
1977
|
+
group.work.details.push({ kind: "item", item: message });
|
|
1978
|
+
(group.work.liveNoteIds ??= []).push(message.id);
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
group.work.details.sort((a, b) => {
|
|
1982
|
+
const first = (entry) => entry.kind === "item" ? entry.item.id : entry.kind === "activity" ? entry.items[0]?.id : void 0;
|
|
1983
|
+
return (itemOrder.get(first(a) ?? "") ?? 0) - (itemOrder.get(first(b) ?? "") ?? 0);
|
|
1984
|
+
});
|
|
1985
|
+
if (response) {
|
|
1986
|
+
const responseAt = response.startedAt ?? response.occurredAt;
|
|
1987
|
+
group.work.responseStartedAt = settledAt && Date.parse(responseAt) > Date.parse(settledAt) ? settledAt : responseAt;
|
|
1988
|
+
const anchor = Math.min(
|
|
1989
|
+
...[...responses].map((message) => positions.get(message) ?? groups.length)
|
|
1990
|
+
);
|
|
1991
|
+
if (settledAt && anchor < (nextBoundary.get(group) ?? groups.length)) {
|
|
1992
|
+
beforeRows.set(groups[anchor], group);
|
|
1993
|
+
movedRows.add(group);
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
if (!settledAt) {
|
|
1997
|
+
const lastProseIndex = Math.max(...prose.map((message) => positions.get(message) ?? -1));
|
|
1998
|
+
let tailIndex = groups.length - 1;
|
|
1999
|
+
for (let index = (positions.get(group) ?? 0) + 1; index <= tailIndex; index += 1) {
|
|
2000
|
+
const entry = groups[index];
|
|
2001
|
+
if (entry.kind === "activity" && entry.work || entry.kind === "item" && ("turnId" in entry.item && entry.item.turnId && entry.item.turnId !== key || index > lastProseIndex && (entry.item.kind === "user-message" || entry.item.kind === "machine-input-batch"))) {
|
|
2002
|
+
tailIndex = index - 1;
|
|
2003
|
+
break;
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
const tail = groups[tailIndex];
|
|
2007
|
+
if (tail && tail !== group) {
|
|
2008
|
+
afterRows.set(tail, group);
|
|
2009
|
+
movedRows.add(group);
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
const personWork = new Set(
|
|
2014
|
+
[...answersPerson].flatMap((key) => {
|
|
2015
|
+
const work = turns.get(key);
|
|
2016
|
+
return work ? [work] : [];
|
|
2017
|
+
})
|
|
2018
|
+
);
|
|
2019
|
+
return compactQuietCycles(
|
|
2020
|
+
groups.flatMap((group) => {
|
|
2021
|
+
if (group.kind === "activity" && movedRows.has(group)) return [];
|
|
2022
|
+
const hidden = group.kind === "item" && group.item.kind === "agent-message" && foldedProse.has(group.item);
|
|
2023
|
+
const before = beforeRows.get(group);
|
|
2024
|
+
const after = afterRows.get(group);
|
|
2025
|
+
return [...before ? [before] : [], ...hidden ? [] : [group], ...after ? [after] : []];
|
|
2026
|
+
}),
|
|
2027
|
+
personWork
|
|
2028
|
+
);
|
|
2029
|
+
}
|
|
2030
|
+
function isQuietWork(group) {
|
|
2031
|
+
if (group.kind !== "activity" || !group.work?.endedAt || group.work.waiting) return false;
|
|
2032
|
+
if (group.work.cycles || group.outcome && group.outcome !== "complete") return false;
|
|
2033
|
+
if (group.items.some(
|
|
2034
|
+
(item) => item.kind === "startup-phase" && (item.status === "failed" || item.status === "cancelled")
|
|
2035
|
+
)) {
|
|
2036
|
+
return false;
|
|
2037
|
+
}
|
|
2038
|
+
const quiet = (entry) => entry.kind === "item" ? entry.item.kind !== "auth-needed" && entry.item.kind !== "context-compaction" && entry.item.kind !== "human-input" && !(entry.item.kind === "notice" && entry.item.tone !== "waiting") && !(entry.item.kind === "agent-message" && entry.item.text.includes("![")) : entry.kind === "activity" ? isQuietDetail(entry, quiet) : false;
|
|
2039
|
+
return !publishesOutput(group) && group.work.details.every(quiet);
|
|
2040
|
+
}
|
|
2041
|
+
function isQuietDetail(group, quiet) {
|
|
2042
|
+
return (!group.outcome || group.outcome === "complete") && (group.work?.details ?? []).every(quiet);
|
|
2043
|
+
}
|
|
2044
|
+
function publishesOutput(group) {
|
|
2045
|
+
if (group.kind !== "activity") return false;
|
|
2046
|
+
return group.items.some((item) => {
|
|
2047
|
+
if (item.kind !== "tool-call") return false;
|
|
2048
|
+
const name = mcpToolLeaf(item.name);
|
|
2049
|
+
return name === "generate_image" || name === "image_generation_call" || name === "sandbox_file_publish";
|
|
2050
|
+
}) || (group.work?.details ?? []).some(publishesOutput);
|
|
2051
|
+
}
|
|
2052
|
+
function answersPersonAt(groups, index) {
|
|
2053
|
+
for (let cursor = index - 1; cursor >= 0; cursor -= 1) {
|
|
2054
|
+
const group = groups[cursor];
|
|
2055
|
+
if (group.kind === "item" && (group.item.kind === "user-message" || group.item.kind === "human-input")) {
|
|
2056
|
+
return true;
|
|
2057
|
+
}
|
|
2058
|
+
if (!isRoutineInput(group)) return false;
|
|
2059
|
+
}
|
|
2060
|
+
return false;
|
|
2061
|
+
}
|
|
2062
|
+
function isRoutineInput(group) {
|
|
2063
|
+
return group.kind === "item" && group.item.kind === "machine-input-batch" && !!group.item.compact && group.item.members.every(
|
|
2064
|
+
(member) => member.kind !== "child_paused" && member.classification !== "failure" && // A parent's direction is always recorded as action_required for the
|
|
2065
|
+
// agent; it is routine orchestration, not something a person must do.
|
|
2066
|
+
(member.classification !== "action_required" || member.kind === "agent_steer_instruction")
|
|
2067
|
+
);
|
|
2068
|
+
}
|
|
2069
|
+
function isFinishedWait(group) {
|
|
2070
|
+
return group.kind === "item" && group.item.kind === "notice" && group.item.tone === "waiting" && !!group.item.recordedOutcome && !!group.item.waitEndedAt;
|
|
2071
|
+
}
|
|
2072
|
+
function compactQuietCycles(groups, personWork) {
|
|
2073
|
+
const result = [];
|
|
2074
|
+
let index = 0;
|
|
2075
|
+
while (index < groups.length) {
|
|
2076
|
+
let end = index;
|
|
2077
|
+
let lastCycleEnd = index;
|
|
2078
|
+
let cycles = 0;
|
|
2079
|
+
while (end < groups.length) {
|
|
2080
|
+
const input = isRoutineInput(groups[end]) ? end : -1;
|
|
2081
|
+
if (input < 0 && cycles === 0) break;
|
|
2082
|
+
const workIndex = input >= 0 ? end + 1 : end;
|
|
2083
|
+
const work = groups[workIndex];
|
|
2084
|
+
if (!work || !isQuietWork(work)) break;
|
|
2085
|
+
if (personWork.has(work) || answersPersonAt(groups, workIndex)) break;
|
|
2086
|
+
const next = groups[workIndex + 1];
|
|
2087
|
+
if (next?.kind === "item" && next.item.kind === "agent-message") break;
|
|
2088
|
+
if (!next || !isFinishedWait(next)) break;
|
|
2089
|
+
cycles += 1;
|
|
2090
|
+
end = workIndex + 2;
|
|
2091
|
+
lastCycleEnd = end;
|
|
2092
|
+
}
|
|
2093
|
+
if (cycles < 2) {
|
|
2094
|
+
result.push(groups[index]);
|
|
2095
|
+
index += 1;
|
|
2096
|
+
continue;
|
|
2097
|
+
}
|
|
2098
|
+
const run = groups.slice(index, lastCycleEnd);
|
|
2099
|
+
const works = run.filter((group) => isQuietWork(group));
|
|
2100
|
+
const waits = run.filter(isFinishedWait);
|
|
2101
|
+
const first = works[0];
|
|
2102
|
+
const lastWait = waits.at(-1);
|
|
2103
|
+
result.push({
|
|
2104
|
+
kind: "activity",
|
|
2105
|
+
id: `cycles-${first.id}`,
|
|
2106
|
+
items: works.flatMap((group) => group.items),
|
|
2107
|
+
outcome: "complete",
|
|
2108
|
+
work: {
|
|
2109
|
+
startedAt: first.work.startedAt,
|
|
2110
|
+
endedAt: lastWait.item.waitEndedAt,
|
|
2111
|
+
details: run,
|
|
2112
|
+
cycles: {
|
|
2113
|
+
count: cycles,
|
|
2114
|
+
...lastWait.item.text.trim() ? { summary: lastWait.item.text.trim() } : {}
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
});
|
|
2118
|
+
index = lastCycleEnd;
|
|
2119
|
+
}
|
|
2120
|
+
return result;
|
|
2121
|
+
}
|
|
2122
|
+
var ROUTINE_MACHINE_INPUT_KINDS = /* @__PURE__ */ new Set([
|
|
2123
|
+
"goal_continuation",
|
|
2124
|
+
"background_command_result",
|
|
2125
|
+
"session_wait_timeout",
|
|
2126
|
+
"agent_message",
|
|
2127
|
+
"agent_steer_instruction",
|
|
2128
|
+
"child_terminal_result",
|
|
2129
|
+
"child_requires_action_resolved",
|
|
2130
|
+
"child_paused",
|
|
2131
|
+
"child_waiting_capacity",
|
|
2132
|
+
"child_progress"
|
|
2133
|
+
]);
|
|
2134
|
+
function timelineQuestionPlacement(question, evidence) {
|
|
2135
|
+
const anchors = prescanTurnAnchors([question, ...evidence]);
|
|
2136
|
+
const direct = anchors.directChatSequenceByTrigger.get(question.id);
|
|
2137
|
+
if (direct !== void 0) return { kind: "visible", sequence: direct };
|
|
2138
|
+
if (anchors.cancelledBeforeStartTriggers.has(question.id)) return { kind: "withdrawn" };
|
|
2139
|
+
const start = anchors.startSeqByTrigger.get(question.id);
|
|
2140
|
+
if (start !== void 0) return { kind: "visible", sequence: start };
|
|
2141
|
+
if (anchors.queuedTurnByTrigger.has(question.id) || anchors.explicitQueuedTriggers.has(question.id))
|
|
2142
|
+
return { kind: "pending" };
|
|
2143
|
+
return { kind: "visible", sequence: question.sequence };
|
|
2144
|
+
}
|
|
1224
2145
|
function prescanTurnAnchors(events) {
|
|
1225
2146
|
const ordered = [...events].sort((a, b) => a.sequence - b.sequence);
|
|
1226
2147
|
const queuedTurnByTrigger = /* @__PURE__ */ new Map();
|
|
@@ -1373,10 +2294,12 @@ function pushInsertion(insertions, sequence, event) {
|
|
|
1373
2294
|
}
|
|
1374
2295
|
}
|
|
1375
2296
|
function isAgentActivityEvent(type) {
|
|
1376
|
-
return type.startsWith("agent.") || type.startsWith("sandbox.");
|
|
2297
|
+
return type.startsWith("agent.") || type.startsWith("sandbox.") || type === "subscription.account.selected" || type === "subscription.account.switched";
|
|
1377
2298
|
}
|
|
1378
2299
|
function isTurnExecutionEvidence(type) {
|
|
1379
|
-
return isAgentActivityEvent(type) || type === "turn.completed" || type === "turn.failed" ||
|
|
2300
|
+
return isAgentActivityEvent(type) || type === "turn.completed" || type === "turn.failed" || // An admission refusal can settle a queued turn before it ever starts:
|
|
2301
|
+
// its prompt still belongs above the "usage limit reached" row.
|
|
2302
|
+
type === "usage.exhausted" || type === "turn.superseded" || type === "turn.recovery.requested" || type === "turn.capacity_waiting" || type === "session.requiresAction" || type === "tool.auth_needed" || type === "credential.auth_needed" || type.startsWith("turn.startup.phase.") || type.startsWith("rig.setup.") || type === "codex.capacity.waiting" || type === "codex.capacity.resumed" || type === "codex.fleet.decision";
|
|
1380
2303
|
}
|
|
1381
2304
|
function turnEndItem(event, outcome, failureText) {
|
|
1382
2305
|
return {
|
|
@@ -1388,6 +2311,23 @@ function turnEndItem(event, outcome, failureText) {
|
|
|
1388
2311
|
occurredAt: event.occurredAt
|
|
1389
2312
|
};
|
|
1390
2313
|
}
|
|
2314
|
+
var SESSION_USAGE_LIMIT_STOP_TEXT = "This task's usage limit is reached. A person can raise or remove the limit to continue.";
|
|
2315
|
+
function sessionUsageLimitNotice(event, payload) {
|
|
2316
|
+
const refusal = parseSessionUsageLimitReachedRefusal(payload);
|
|
2317
|
+
return {
|
|
2318
|
+
kind: "notice",
|
|
2319
|
+
id: `${event.id}-session-usage-limit`,
|
|
2320
|
+
// Neutral: not a failure, and not an open wait the turn header should claim.
|
|
2321
|
+
tone: "cancelled",
|
|
2322
|
+
text: refusal ? sessionUsageLimitReachedMessage(refusal) : SESSION_USAGE_LIMIT_STOP_TEXT,
|
|
2323
|
+
sessionUsageLimit: {
|
|
2324
|
+
rootSessionId: refusal?.rootSessionId ?? null,
|
|
2325
|
+
limitMicros: refusal?.limitMicros ?? null,
|
|
2326
|
+
usedMicros: refusal?.usedMicros ?? null
|
|
2327
|
+
},
|
|
2328
|
+
occurredAt: event.occurredAt
|
|
2329
|
+
};
|
|
2330
|
+
}
|
|
1391
2331
|
function hasTurnActivity(items, turnId) {
|
|
1392
2332
|
if (turnId) {
|
|
1393
2333
|
return items.some((item) => isActivityItem(item) && item.turnId === turnId);
|
|
@@ -1457,10 +2397,24 @@ function foldSettledTurn(groups, turnEnd) {
|
|
|
1457
2397
|
if (collected.length === 0) {
|
|
1458
2398
|
return;
|
|
1459
2399
|
}
|
|
1460
|
-
const
|
|
2400
|
+
const collectedLength = collected.length;
|
|
2401
|
+
const waitMessages = turnEnd.preserveWaitResponse ? collected.filter(
|
|
2402
|
+
(group) => group.kind === "item" && group.item.kind === "agent-message" && !group.item.streaming && group.item.text.trim().length > 0 && belongsToTurn(group.item, turnEnd.turnId)
|
|
2403
|
+
) : [];
|
|
2404
|
+
const waitResponse = waitMessages.slice().reverse().find(
|
|
2405
|
+
(group) => group.item.kind === "agent-message" && group.item.phase !== "commentary" && group.item.annotationSource?.eventType === "agent.message.completed"
|
|
2406
|
+
) ?? waitMessages.at(-1);
|
|
2407
|
+
const finalMessage = waitResponse ?? extractFinalAgentMessage(collected, turnEnd);
|
|
1461
2408
|
const fallbackMessage = finalMessage || hasOrdinaryFinalAgentMessage(collected, turnEnd) ? null : extractLatestCompletedCommentary(collected, turnEnd);
|
|
1462
2409
|
const visibleMessage = finalMessage ?? fallbackMessage;
|
|
1463
|
-
const
|
|
2410
|
+
const visibleMessages = visibleMessage ? [visibleMessage] : [];
|
|
2411
|
+
if (visibleMessage && !hasOrdinaryFinalAgentMessage(collected, turnEnd) && turnAnswersPerson(groups, startIndex)) {
|
|
2412
|
+
const first = collected.find(
|
|
2413
|
+
(group) => group.kind === "item" && group.item.kind === "agent-message" && !group.item.streaming && group.item.text.trim().length > 0 && belongsToTurn(group.item, turnEnd.turnId)
|
|
2414
|
+
);
|
|
2415
|
+
if (first && first !== visibleMessage) visibleMessages.unshift(first);
|
|
2416
|
+
}
|
|
2417
|
+
const body = collected.filter((group) => !visibleMessages.includes(group));
|
|
1464
2418
|
if (body.length === 0) {
|
|
1465
2419
|
return;
|
|
1466
2420
|
}
|
|
@@ -1479,14 +2433,21 @@ function foldSettledTurn(groups, turnEnd) {
|
|
|
1479
2433
|
if (turnEnd.failureText) {
|
|
1480
2434
|
turnGroup.failureText = turnEnd.failureText;
|
|
1481
2435
|
}
|
|
1482
|
-
groups.splice(
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
2436
|
+
groups.splice(startIndex, collectedLength, turnGroup, ...visibleMessages);
|
|
2437
|
+
}
|
|
2438
|
+
function turnAnswersPerson(groups, startIndex) {
|
|
2439
|
+
for (let index = startIndex - 1; index >= 0; index -= 1) {
|
|
2440
|
+
const group = groups[index];
|
|
2441
|
+
if (group?.kind !== "item") return false;
|
|
2442
|
+
if (group.item.kind === "user-message") return true;
|
|
2443
|
+
if (group.item.kind !== "machine-input-batch" && group.item.kind !== "session-status" && group.item.kind !== "context-compaction" && !(group.item.kind === "notice" && group.item.tone === "input")) {
|
|
2444
|
+
return false;
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
return false;
|
|
1487
2448
|
}
|
|
1488
2449
|
function isTurnBoundary(group) {
|
|
1489
|
-
return group?.kind === "turn" || group?.kind === "item" && (group.item.kind === "user-message" || group.item.kind === "human-input" || group.item.kind === "context-compaction" || group.item.kind === "machine-input-batch"
|
|
2450
|
+
return group?.kind === "turn" || group?.kind === "item" && (group.item.kind === "user-message" || group.item.kind === "human-input" || group.item.kind === "context-compaction" || group.item.kind === "machine-input-batch" || group.item.kind === "notice" && group.item.tone === "input");
|
|
1490
2451
|
}
|
|
1491
2452
|
function belongsToDifferentTurn(group, turnId) {
|
|
1492
2453
|
if (!group || !turnId) {
|
|
@@ -1556,6 +2517,20 @@ function assistantMessagePhase(value) {
|
|
|
1556
2517
|
function numberOrNull(value) {
|
|
1557
2518
|
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
1558
2519
|
}
|
|
2520
|
+
function compactionProviderRejection(payload) {
|
|
2521
|
+
const record = asRecord2(payload.providerRejection);
|
|
2522
|
+
if (typeof record.httpStatus !== "number" || !Number.isFinite(record.httpStatus)) {
|
|
2523
|
+
return null;
|
|
2524
|
+
}
|
|
2525
|
+
const text = (value) => typeof value === "string" && value.trim() ? value : null;
|
|
2526
|
+
return {
|
|
2527
|
+
httpStatus: record.httpStatus,
|
|
2528
|
+
type: text(record.type),
|
|
2529
|
+
code: text(record.code),
|
|
2530
|
+
param: text(record.param),
|
|
2531
|
+
requestId: text(record.requestId)
|
|
2532
|
+
};
|
|
2533
|
+
}
|
|
1559
2534
|
function compactionTrigger(payload) {
|
|
1560
2535
|
const trigger = payload.trigger;
|
|
1561
2536
|
return trigger === "auto" || trigger === "operator" || trigger === "proactive" || trigger === "overflow" ? trigger : null;
|
|
@@ -1596,6 +2571,8 @@ function machineInputMembers(value) {
|
|
|
1596
2571
|
const kinds = /* @__PURE__ */ new Set([
|
|
1597
2572
|
"scheduled_occurrence",
|
|
1598
2573
|
"goal_continuation",
|
|
2574
|
+
"background_command_result",
|
|
2575
|
+
"session_wait_timeout",
|
|
1599
2576
|
"agent_message",
|
|
1600
2577
|
"agent_steer_instruction",
|
|
1601
2578
|
"child_terminal_result",
|
|
@@ -1637,6 +2614,8 @@ var SESSION_STATUSES = [
|
|
|
1637
2614
|
"running",
|
|
1638
2615
|
"idle",
|
|
1639
2616
|
"requires_action",
|
|
2617
|
+
"recovering",
|
|
2618
|
+
"waiting_capacity",
|
|
1640
2619
|
"failed",
|
|
1641
2620
|
"cancelled"
|
|
1642
2621
|
];
|
|
@@ -1657,6 +2636,13 @@ function resourceRefs(value) {
|
|
|
1657
2636
|
return record.kind === "file" && typeof record.fileId === "string";
|
|
1658
2637
|
});
|
|
1659
2638
|
}
|
|
2639
|
+
function messageSender(value) {
|
|
2640
|
+
const record = asRecord2(value);
|
|
2641
|
+
if (record.kind !== "subject" || typeof record.subjectId !== "string" || !record.subjectId)
|
|
2642
|
+
return void 0;
|
|
2643
|
+
const label = typeof record.label === "string" && record.label.trim() ? record.label : null;
|
|
2644
|
+
return { subjectId: record.subjectId, label };
|
|
2645
|
+
}
|
|
1660
2646
|
function timelineAnnotations(value) {
|
|
1661
2647
|
if (!Array.isArray(value)) return [];
|
|
1662
2648
|
return value.filter((candidate) => {
|
|
@@ -1730,6 +2716,7 @@ function findOpenCall(items, callId) {
|
|
|
1730
2716
|
if (byId) {
|
|
1731
2717
|
return byId;
|
|
1732
2718
|
}
|
|
2719
|
+
return void 0;
|
|
1733
2720
|
}
|
|
1734
2721
|
return reversed.find(
|
|
1735
2722
|
(item) => isCall(item) && item.status === "running"
|
|
@@ -1746,6 +2733,16 @@ function startupPhaseForSandboxOperation(name) {
|
|
|
1746
2733
|
function startupPhaseFromPayload(value) {
|
|
1747
2734
|
return typeof value === "string" && STARTUP_PHASES.has(value) ? value : null;
|
|
1748
2735
|
}
|
|
2736
|
+
function startupLifecycleWaitReason(payload) {
|
|
2737
|
+
if (payload.expectedTransition === true && payload.failureStage === "context_compaction" && payload.failureCategory === "context_compaction" && payload.failureCode === "compaction_required") {
|
|
2738
|
+
return "compaction_required";
|
|
2739
|
+
}
|
|
2740
|
+
if (payload.expectedTransition !== true || payload.failureStage !== "lifecycle_wait" || payload.failureCategory !== "drain_capture_wait") {
|
|
2741
|
+
return void 0;
|
|
2742
|
+
}
|
|
2743
|
+
const code = payload.failureCode;
|
|
2744
|
+
return code === "capture_in_progress" || code === "rotation_in_progress" || code === "provider_recovery_in_progress" ? code : void 0;
|
|
2745
|
+
}
|
|
1749
2746
|
var SANDBOX_STARTUP_PHASES = {
|
|
1750
2747
|
"sandbox.provision": "sandbox",
|
|
1751
2748
|
"repository-clone": "repository",
|
|
@@ -1767,13 +2764,7 @@ function elapsedDurationMs(startedAt, completedAt) {
|
|
|
1767
2764
|
return Number.isFinite(start) && Number.isFinite(end) ? Math.max(0, end - start) : null;
|
|
1768
2765
|
}
|
|
1769
2766
|
function failureMessage(payload) {
|
|
1770
|
-
|
|
1771
|
-
const value = payload[key];
|
|
1772
|
-
if (typeof value === "string" && value.trim().length > 0) {
|
|
1773
|
-
return humanizeFailureReason(value);
|
|
1774
|
-
}
|
|
1775
|
-
}
|
|
1776
|
-
return null;
|
|
2767
|
+
return presentFailure(payload).reason;
|
|
1777
2768
|
}
|
|
1778
2769
|
function goalText(payload) {
|
|
1779
2770
|
if (typeof payload.text === "string" && payload.text) {
|
|
@@ -1788,6 +2779,60 @@ function goalText(payload) {
|
|
|
1788
2779
|
}
|
|
1789
2780
|
return null;
|
|
1790
2781
|
}
|
|
2782
|
+
function rememberPendingWaitOutcome(pending, event, payload, eventTurnId) {
|
|
2783
|
+
const reason = stringValue(payload.reason).trim();
|
|
2784
|
+
if (!reason) return;
|
|
2785
|
+
const turnId = eventTurnId || stringValue(payload.waitTurnId) || stringValue(payload.turnId) || null;
|
|
2786
|
+
pending.set(turnId, { id: event.id, reason, occurredAt: event.occurredAt });
|
|
2787
|
+
}
|
|
2788
|
+
var ACTION_CAPACITY_WAIT_REASONS = /* @__PURE__ */ new Set([
|
|
2789
|
+
"pinned_account_disabled",
|
|
2790
|
+
"pinned_account_ineligible",
|
|
2791
|
+
"model_not_allowed",
|
|
2792
|
+
// Only sending the work again ends it (design 5.3 decision 4).
|
|
2793
|
+
"accepted_authority_unavailable"
|
|
2794
|
+
]);
|
|
2795
|
+
var ACTION_CAPACITY_WAIT_CODE = /_(?:allocator_disabled|relogin_required|account_forbidden)$/;
|
|
2796
|
+
function capacityWaitPresentation(type, payload, turnId) {
|
|
2797
|
+
if (ACTION_CAPACITY_WAIT_REASONS.has(stringValue(payload.waitReason)) || ACTION_CAPACITY_WAIT_CODE.test(stringValue(payload.code))) {
|
|
2798
|
+
const [first, second] = type === "turn.capacity_waiting" ? [payload.error, payload.detail] : [payload.detail, payload.error];
|
|
2799
|
+
const detail = stringValue(first) || stringValue(second) || "Waiting for an account.";
|
|
2800
|
+
return {
|
|
2801
|
+
turnId,
|
|
2802
|
+
label: stringValue(payload.waitReason) === "pinned_account_disabled" ? "Needs you" : "Waiting",
|
|
2803
|
+
detail,
|
|
2804
|
+
text: detail
|
|
2805
|
+
};
|
|
2806
|
+
}
|
|
2807
|
+
return {
|
|
2808
|
+
turnId,
|
|
2809
|
+
label: CAPACITY_LIMIT_LABEL,
|
|
2810
|
+
detail: CAPACITY_LIMIT_DETAIL,
|
|
2811
|
+
text: `${CAPACITY_LIMIT_LABEL}. ${CAPACITY_LIMIT_DETAIL}`
|
|
2812
|
+
};
|
|
2813
|
+
}
|
|
2814
|
+
var CAPACITY_LIMIT_LABEL = "Usage limit reached";
|
|
2815
|
+
var CAPACITY_LIMIT_DETAIL = "Try again after your quota resets, or switch to another model or provider.";
|
|
2816
|
+
function endsCapacityWait(event, payload) {
|
|
2817
|
+
if (event.duplicateOfEventId || event.turnAssociation && event.turnAssociation !== "current")
|
|
2818
|
+
return false;
|
|
2819
|
+
switch (event.type) {
|
|
2820
|
+
case "codex.capacity.resumed":
|
|
2821
|
+
case "codex.capacity.superseded":
|
|
2822
|
+
case "turn.completed":
|
|
2823
|
+
case "turn.failed":
|
|
2824
|
+
case "turn.cancelled":
|
|
2825
|
+
case "turn.superseded":
|
|
2826
|
+
return true;
|
|
2827
|
+
case "session.status.changed":
|
|
2828
|
+
return isSessionStatus(payload.status) && payload.status !== "waiting_capacity";
|
|
2829
|
+
default:
|
|
2830
|
+
return false;
|
|
2831
|
+
}
|
|
2832
|
+
}
|
|
2833
|
+
function waitingOutcomeText(reason) {
|
|
2834
|
+
return /^waiting\b/i.test(reason) ? reason : `Waiting: ${reason}`;
|
|
2835
|
+
}
|
|
1791
2836
|
function shouldSuppressAgentGoalLandmark(type, payload) {
|
|
1792
2837
|
if (type === "goal.completed") {
|
|
1793
2838
|
return true;
|
|
@@ -1827,7 +2872,8 @@ var AUTH_NEEDED_REASONS = /* @__PURE__ */ new Set([
|
|
|
1827
2872
|
"refresh_failed",
|
|
1828
2873
|
"personal_authority_unavailable",
|
|
1829
2874
|
"unsupported_auth",
|
|
1830
|
-
"resource_scope_unavailable"
|
|
2875
|
+
"resource_scope_unavailable",
|
|
2876
|
+
"designated_credential_unavailable"
|
|
1831
2877
|
]);
|
|
1832
2878
|
function authNeededReason(value) {
|
|
1833
2879
|
return typeof value === "string" && AUTH_NEEDED_REASONS.has(value) ? value : null;
|
|
@@ -1838,7 +2884,7 @@ function capabilityAuthorizationRequest(value) {
|
|
|
1838
2884
|
const kind = record.kind;
|
|
1839
2885
|
const source = record.source;
|
|
1840
2886
|
const action = record.action;
|
|
1841
|
-
if (typeof record.id !== "string" || typeof record.name !== "string" || !["
|
|
2887
|
+
if (typeof record.id !== "string" || typeof record.name !== "string" || !["mcp", "api", "skill", "plugin"].includes(String(kind)) || !["built_in", "library", "configured", "public_registry", "registry", "manual"].includes(
|
|
1842
2888
|
String(source)
|
|
1843
2889
|
) || !["connect", "add_credentials", "enable"].includes(String(action)) || typeof record.rationale !== "string") {
|
|
1844
2890
|
return null;
|
|
@@ -1853,9 +2899,15 @@ function capabilityAuthorizationRequest(value) {
|
|
|
1853
2899
|
requiredVariables: stringList(record.requiredVariables)
|
|
1854
2900
|
};
|
|
1855
2901
|
}
|
|
2902
|
+
function customMcpSetupRequest(value) {
|
|
2903
|
+
return parseCustomMcpSetupRequest(value);
|
|
2904
|
+
}
|
|
1856
2905
|
function stringList(value) {
|
|
1857
2906
|
return Array.isArray(value) ? value.filter((entry) => typeof entry === "string" && entry.trim().length > 0) : [];
|
|
1858
2907
|
}
|
|
2908
|
+
function reasoningDeltaJoiner(previous, next) {
|
|
2909
|
+
return previous.endsWith("**") && next.startsWith("**") ? "\n\n" : "";
|
|
2910
|
+
}
|
|
1859
2911
|
function reasoningText(payload) {
|
|
1860
2912
|
const record = asRecord2(payload);
|
|
1861
2913
|
if (typeof record.text === "string") {
|
|
@@ -1880,6 +2932,14 @@ function workerPrompt(args) {
|
|
|
1880
2932
|
}
|
|
1881
2933
|
return null;
|
|
1882
2934
|
}
|
|
2935
|
+
var WORKER_TITLE_MAX_LENGTH = 120;
|
|
2936
|
+
function workerTitle(args) {
|
|
2937
|
+
const record = asRecord2(typeof args === "string" ? tryParseJson(args) : args);
|
|
2938
|
+
if (typeof record.title !== "string") return null;
|
|
2939
|
+
const title = record.title.replace(/\s+/g, " ").trim();
|
|
2940
|
+
if (!title) return null;
|
|
2941
|
+
return title.length > WORKER_TITLE_MAX_LENGTH ? `${title.slice(0, WORKER_TITLE_MAX_LENGTH - 1).trimEnd()}\u2026` : title;
|
|
2942
|
+
}
|
|
1883
2943
|
function boundedWorkerFailureMessage(value) {
|
|
1884
2944
|
const normalized = value.replace(/[\u0000-\u001f\u007f]+/g, " ").trim();
|
|
1885
2945
|
if (!normalized) return null;
|
|
@@ -1970,65 +3030,18 @@ function looksLikeId(value) {
|
|
|
1970
3030
|
return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
|
|
1971
3031
|
}
|
|
1972
3032
|
|
|
1973
|
-
// src/human-input.ts
|
|
1974
|
-
function isActionableHumanInputRequest(request, nowMs = Date.now()) {
|
|
1975
|
-
if (request.status !== "pending") return false;
|
|
1976
|
-
if (!request.expiresAt) return true;
|
|
1977
|
-
const deadline = Date.parse(request.expiresAt);
|
|
1978
|
-
return Number.isFinite(deadline) && deadline > nowMs;
|
|
1979
|
-
}
|
|
1980
|
-
function humanInputRequestFromEvent(event) {
|
|
1981
|
-
if (event.type !== "session.humanInput.requested" || !isRecord(event.payload)) return null;
|
|
1982
|
-
const request = event.payload.request;
|
|
1983
|
-
if (!isRecord(request) || typeof request.id !== "string" || !Array.isArray(request.questions)) {
|
|
1984
|
-
return null;
|
|
1985
|
-
}
|
|
1986
|
-
return {
|
|
1987
|
-
id: request.id,
|
|
1988
|
-
turnId: event.turnId ?? null,
|
|
1989
|
-
questions: request.questions,
|
|
1990
|
-
allowSkip: request.allowSkip === true,
|
|
1991
|
-
expiresAt: typeof request.expiresAt === "string" ? request.expiresAt : null
|
|
1992
|
-
};
|
|
1993
|
-
}
|
|
1994
|
-
function projectPendingHumanInputRequests(events) {
|
|
1995
|
-
const pending = /* @__PURE__ */ new Map();
|
|
1996
|
-
for (const event of events) {
|
|
1997
|
-
const requested = humanInputRequestFromEvent(event);
|
|
1998
|
-
if (requested) {
|
|
1999
|
-
pending.set(requested.id, requested);
|
|
2000
|
-
continue;
|
|
2001
|
-
}
|
|
2002
|
-
if (event.type === "user.humanInputResponse" && isRecord(event.payload)) {
|
|
2003
|
-
if (typeof event.payload.requestId === "string") pending.delete(event.payload.requestId);
|
|
2004
|
-
continue;
|
|
2005
|
-
}
|
|
2006
|
-
if (event.type === "turn.completed" || event.type === "turn.failed" || event.type === "turn.cancelled") {
|
|
2007
|
-
for (const [id, request] of pending) {
|
|
2008
|
-
if (request.turnId === null || event.turnId === null || event.turnId === void 0 || request.turnId === event.turnId) {
|
|
2009
|
-
pending.delete(id);
|
|
2010
|
-
}
|
|
2011
|
-
}
|
|
2012
|
-
}
|
|
2013
|
-
}
|
|
2014
|
-
return [...pending.values()];
|
|
2015
|
-
}
|
|
2016
|
-
function isRecord(value) {
|
|
2017
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
2018
|
-
}
|
|
2019
|
-
|
|
2020
3033
|
export {
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
3034
|
+
compactionSkipTitle,
|
|
3035
|
+
compactionSkipSubtitle,
|
|
3036
|
+
compactionFailureDetails,
|
|
3037
|
+
presentTurnFailureText,
|
|
3038
|
+
isTimelineUserQuestion,
|
|
2025
3039
|
buildTimeline,
|
|
2026
3040
|
creditExhaustedFromEvents,
|
|
2027
3041
|
sessionStatusFromEvents,
|
|
2028
3042
|
groupTimeline,
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
projectPendingHumanInputRequests
|
|
3043
|
+
timelineQuestionPlacement,
|
|
3044
|
+
isTurnExecutionEvidence,
|
|
3045
|
+
extractSessionRef
|
|
2033
3046
|
};
|
|
2034
|
-
//# sourceMappingURL=chunk-
|
|
3047
|
+
//# sourceMappingURL=chunk-2SFFYIH3.js.map
|