@opengeni/react 1.0.1 → 1.0.2-canary.37202341988001
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 +660 -21
- package/dist/accounts.d.ts +64 -0
- package/dist/accounts.js +822 -0
- package/dist/accounts.js.map +1 -0
- package/dist/approvals.d.ts +2 -1
- package/dist/artifacts-document.js +3 -2
- package/dist/artifacts-presentation.js +3 -2
- package/dist/artifacts-spreadsheet.js +2 -2
- package/dist/artifacts.d.ts +4 -1
- package/dist/artifacts.js +518 -42
- package/dist/artifacts.js.map +1 -1
- package/dist/browser-viewer-SHYKQRNX.js +16 -0
- package/dist/capability-catalog-row.d.ts +20 -0
- package/dist/capability-logo-fallback.d.ts +3 -0
- package/dist/chat-interactive-block-UGBTNB3L.js +11 -0
- package/dist/chat-interactive-block-UGBTNB3L.js.map +1 -0
- package/dist/chunk-26ZNDDLZ.js +453 -0
- package/dist/chunk-26ZNDDLZ.js.map +1 -0
- package/dist/chunk-3CTRFMAK.js +359 -0
- package/dist/chunk-3CTRFMAK.js.map +1 -0
- package/dist/chunk-447JLCBU.js +209 -0
- package/dist/chunk-447JLCBU.js.map +1 -0
- package/dist/chunk-4RVYOY4O.js +379 -0
- package/dist/chunk-4RVYOY4O.js.map +1 -0
- package/dist/chunk-5CVXZA3Y.js +292 -0
- package/dist/chunk-5CVXZA3Y.js.map +1 -0
- package/dist/chunk-5J4FOW6Q.js +108 -0
- package/dist/chunk-5J4FOW6Q.js.map +1 -0
- package/dist/chunk-742CZ3L3.js +481 -0
- package/dist/chunk-742CZ3L3.js.map +1 -0
- package/dist/chunk-A2PI6UMY.js +41 -0
- package/dist/chunk-A2PI6UMY.js.map +1 -0
- package/dist/{chunk-7WCLAEFV.js → chunk-A4UJB2MM.js} +37 -27
- package/dist/chunk-A4UJB2MM.js.map +1 -0
- package/dist/chunk-B3V6TG77.js +41 -0
- package/dist/chunk-B3V6TG77.js.map +1 -0
- package/dist/chunk-BRM6FVZA.js +302 -0
- package/dist/chunk-BRM6FVZA.js.map +1 -0
- package/dist/chunk-C5X5AJXK.js +182 -0
- package/dist/chunk-C5X5AJXK.js.map +1 -0
- package/dist/{chunk-6KLX2RH5.js → chunk-DO544OSV.js} +1075 -79
- package/dist/chunk-DO544OSV.js.map +1 -0
- package/dist/{chunk-R3AZOAB5.js → chunk-DYWBUX5Q.js} +29 -123
- package/dist/chunk-DYWBUX5Q.js.map +1 -0
- package/dist/{chunk-HA46CYQK.js → chunk-EESD3PY3.js} +792 -537
- package/dist/chunk-EESD3PY3.js.map +1 -0
- package/dist/{chunk-5UQPNLIO.js → chunk-EN3YTHKR.js} +4117 -3896
- package/dist/chunk-EN3YTHKR.js.map +1 -0
- package/dist/chunk-ERGYJIBB.js +21 -0
- package/dist/chunk-ERGYJIBB.js.map +1 -0
- package/dist/chunk-FZCP527Y.js +116 -0
- package/dist/chunk-FZCP527Y.js.map +1 -0
- package/dist/chunk-GIMRELBW.js +14 -0
- package/dist/chunk-GIMRELBW.js.map +1 -0
- package/dist/chunk-GYVRFZDY.js +2733 -0
- package/dist/chunk-GYVRFZDY.js.map +1 -0
- package/dist/{chunk-LLOLUHVG.js → chunk-HDJWDK7W.js} +1358 -2746
- package/dist/chunk-HDJWDK7W.js.map +1 -0
- package/dist/chunk-I7IWRQLN.js +1608 -0
- package/dist/chunk-I7IWRQLN.js.map +1 -0
- package/dist/chunk-IT4BJUGF.js +13055 -0
- package/dist/chunk-IT4BJUGF.js.map +1 -0
- package/dist/chunk-IWIDV7SB.js +1 -0
- package/dist/chunk-IWIDV7SB.js.map +1 -0
- package/dist/chunk-J2QWVSQY.js +312 -0
- package/dist/chunk-J2QWVSQY.js.map +1 -0
- package/dist/chunk-J6DBS4T3.js +371 -0
- package/dist/chunk-J6DBS4T3.js.map +1 -0
- package/dist/{chunk-B6WPZSTT.js → chunk-JIQYUGVL.js} +1331 -1163
- package/dist/chunk-JIQYUGVL.js.map +1 -0
- package/dist/chunk-JT4JW7BC.js +54 -0
- package/dist/chunk-JT4JW7BC.js.map +1 -0
- package/dist/chunk-K3HQAKQX.js +24 -0
- package/dist/chunk-K3HQAKQX.js.map +1 -0
- package/dist/{chunk-PEI6RANI.js → chunk-PNY3JKBJ.js} +309 -74
- package/dist/chunk-PNY3JKBJ.js.map +1 -0
- package/dist/chunk-RHREZ7BO.js +11 -0
- package/dist/chunk-RHREZ7BO.js.map +1 -0
- package/dist/chunk-RLUSC2WA.js +299 -0
- package/dist/chunk-RLUSC2WA.js.map +1 -0
- package/dist/{chunk-IGC6A2ZI.js → chunk-RSI7XYXL.js} +777 -246
- package/dist/chunk-RSI7XYXL.js.map +1 -0
- package/dist/chunk-SCOTPE2I.js +589 -0
- package/dist/chunk-SCOTPE2I.js.map +1 -0
- package/dist/{chunk-C5ZPSSS5.js → chunk-TKOTKRWY.js} +5 -4
- package/dist/{chunk-C5ZPSSS5.js.map → chunk-TKOTKRWY.js.map} +1 -1
- package/dist/chunk-TMYGL6X5.js +742 -0
- package/dist/chunk-TMYGL6X5.js.map +1 -0
- package/dist/chunk-UGLEYEMP.js +33 -0
- package/dist/chunk-UGLEYEMP.js.map +1 -0
- package/dist/chunk-UK4TINKT.js +27 -0
- package/dist/chunk-UK4TINKT.js.map +1 -0
- package/dist/chunk-UTRTG6LH.js +220 -0
- package/dist/chunk-UTRTG6LH.js.map +1 -0
- package/dist/chunk-WEHMPOXK.js +39 -0
- package/dist/chunk-WEHMPOXK.js.map +1 -0
- package/dist/chunk-WGXVEJO5.js +319 -0
- package/dist/chunk-WGXVEJO5.js.map +1 -0
- package/dist/chunk-WRHIZYZF.js +988 -0
- package/dist/chunk-WRHIZYZF.js.map +1 -0
- package/dist/{chunk-HUIKIDM5.js → chunk-WUISZ3WU.js} +223 -115
- package/dist/chunk-WUISZ3WU.js.map +1 -0
- package/dist/chunk-XCHWDJ22.js +107 -0
- package/dist/chunk-XCHWDJ22.js.map +1 -0
- package/dist/{chunk-KCGXPP5V.js → chunk-Y2PRMYLC.js} +11 -6
- package/dist/chunk-Y2PRMYLC.js.map +1 -0
- package/dist/chunk-YBXQDQFX.js +1772 -0
- package/dist/chunk-YBXQDQFX.js.map +1 -0
- package/dist/chunk-YM2DE7BQ.js +3124 -0
- package/dist/chunk-YM2DE7BQ.js.map +1 -0
- package/dist/{chunk-KZ73RL76.js → chunk-YQEAA6LT.js} +7 -3
- package/dist/chunk-YQEAA6LT.js.map +1 -0
- package/dist/chunk-YV4L3ILF.js +9 -0
- package/dist/chunk-YV4L3ILF.js.map +1 -0
- package/dist/chunk-ZYRGEKWS.js +216 -0
- package/dist/chunk-ZYRGEKWS.js.map +1 -0
- package/dist/client.d.ts +7 -4
- package/dist/clipboard.js +1 -0
- package/dist/commands/types.d.ts +2 -0
- package/dist/components/anthropic-mark.d.ts +3 -0
- package/dist/components/approval-surface.d.ts +15 -0
- package/dist/components/artifacts/artifact-chrome.d.ts +120 -0
- package/dist/components/artifacts/artifact-sandbox.d.ts +27 -0
- package/dist/components/artifacts/artifact-surface.d.ts +3 -1
- package/dist/components/artifacts/chat-interactive-block.d.ts +29 -0
- package/dist/components/artifacts/deferred-chat-media.d.ts +15 -0
- package/dist/components/artifacts/document-editor.d.ts +4 -2
- package/dist/components/artifacts/editable-artifact-ui.d.ts +2 -1
- package/dist/components/artifacts/editable-artifact-view.d.ts +46 -0
- package/dist/components/artifacts/editable-document.d.ts +1 -1
- package/dist/components/artifacts/editable-presentation.d.ts +2 -2
- package/dist/components/artifacts/editable-spreadsheet.d.ts +2 -1
- package/dist/components/artifacts/index.d.ts +8 -1
- package/dist/components/artifacts/inline-html-document.d.ts +2 -0
- package/dist/components/artifacts/latest-task-runner.d.ts +15 -0
- package/dist/components/artifacts/presentation-editor.d.ts +6 -2
- package/dist/components/artifacts/published-html-artifact-frame.d.ts +48 -3
- package/dist/components/artifacts/session-artifact-viewer.d.ts +39 -0
- package/dist/components/artifacts/site-view.d.ts +23 -0
- package/dist/components/artifacts/spreadsheet-general-display.d.ts +24 -0
- package/dist/components/artifacts/visualization-assets.gen.d.ts +2 -0
- package/dist/components/browser-select-control.d.ts +16 -0
- package/dist/components/browser-viewer.d.ts +10 -1
- package/dist/components/chat-composer.d.ts +21 -3
- package/dist/components/child-session-link.d.ts +5 -0
- package/dist/components/claude-mark.d.ts +3 -0
- package/dist/components/code-editor.d.ts +1 -4
- package/dist/components/composer.d.ts +45 -4
- package/dist/components/computer-viewer.d.ts +4 -1
- package/dist/components/copy-button.d.ts +3 -1
- package/dist/components/desktop-viewer.d.ts +1 -1
- package/dist/components/enrollment-consent.d.ts +6 -3
- package/dist/components/file-browser.d.ts +10 -1
- package/dist/components/fleet-tile.d.ts +2 -2
- package/dist/components/grok-mark.d.ts +26 -0
- package/dist/components/human-input-form.d.ts +21 -2
- package/dist/components/human-input-surface.d.ts +6 -3
- package/dist/components/machine-card.d.ts +4 -1
- package/dist/components/machines/machine-detail.d.ts +4 -1
- package/dist/components/machines/machine-operation-policy.d.ts +11 -0
- package/dist/components/machines-dashboard.d.ts +3 -1
- package/dist/components/markdown-table-layout.d.ts +12 -0
- package/dist/components/markdown.d.ts +47 -3
- package/dist/components/message-timeline.d.ts +72 -9
- package/dist/components/model-mark.d.ts +29 -0
- package/dist/components/model-policy-picker-menu.d.ts +9 -0
- package/dist/components/model-policy-picker.d.ts +62 -13
- package/dist/components/open-geni-chat.d.ts +58 -0
- package/dist/components/open-geni-links.d.ts +68 -0
- package/dist/components/openrouter-mark.d.ts +6 -0
- package/dist/components/pierre-file.d.ts +1 -1
- package/dist/components/preview-loading.d.ts +2 -0
- package/dist/components/queue-item-content.d.ts +9 -0
- package/dist/components/sandbox-files.d.ts +13 -2
- package/dist/components/sandbox-workspace.d.ts +43 -3
- package/dist/components/session-capability-frame.d.ts +35 -0
- package/dist/components/session-chrome.d.ts +66 -8
- package/dist/components/session-commands-panel.d.ts +6 -0
- package/dist/components/session-commands.d.ts +6 -0
- package/dist/components/session-connection-request.d.ts +8 -0
- package/dist/components/session-conversation.d.ts +89 -0
- package/dist/components/session-list.d.ts +36 -0
- package/dist/components/session-mcp-capability-card.d.ts +41 -0
- package/dist/components/session-proxy-scope.d.ts +21 -0
- package/dist/components/timeline-anchor.d.ts +24 -0
- package/dist/components/timeline-annotation-chrome.d.ts +25 -0
- package/dist/components/timeline-annotation-layout.d.ts +42 -0
- package/dist/components/timeline-annotation-markers.d.ts +8 -0
- package/dist/components/timeline-annotation-reveal-context.d.ts +4 -0
- package/dist/components/timeline-annotation-shared.d.ts +31 -0
- package/dist/components/timeline-annotations-dialog.d.ts +3 -2
- package/dist/components/timeline-annotations.d.ts +13 -3
- package/dist/components/timeline-reading-progress.d.ts +11 -0
- package/dist/components/timeline-search.d.ts +34 -0
- package/dist/components/timeline-settlement.d.ts +16 -0
- package/dist/components/tip-follow.d.ts +16 -0
- package/dist/components/usage-limit-notice.d.ts +49 -0
- package/dist/components/usage-member-list.d.ts +91 -0
- package/dist/components/usage-meter.d.ts +73 -0
- package/dist/components/use-viewer-menu-dismiss.d.ts +2 -0
- package/dist/components/user-message-body.d.ts +10 -1
- package/dist/components/workspace-dock.d.ts +6 -2
- package/dist/composer.d.ts +5 -4
- package/dist/composer.js +15 -9
- package/dist/computer-viewer-6SRGWRUX.js +19 -0
- package/dist/computer-viewer-6SRGWRUX.js.map +1 -0
- package/dist/connect-account-identity.d.ts +8 -0
- package/dist/connect-accounts.d.ts +15 -0
- package/dist/connect-chooser.d.ts +18 -0
- package/dist/connect-panel.d.ts +18 -0
- package/dist/connect-setup.d.ts +16 -0
- package/dist/connect.d.ts +21 -0
- package/dist/connect.js +2129 -0
- package/dist/connect.js.map +1 -0
- package/dist/connection-catalog.d.ts +38 -0
- package/dist/connection-discovery.d.ts +12 -0
- package/dist/connection-installed.d.ts +17 -0
- package/dist/connection-logo.d.ts +9 -0
- package/dist/connection-service-logo.d.ts +8 -0
- package/dist/connection-service-presentation.d.ts +13 -0
- package/dist/connection-skeleton.d.ts +5 -0
- package/dist/connection-type-picker.d.ts +6 -0
- package/dist/conversation-timeline.d.ts +5 -0
- package/dist/desktop.d.ts +7 -0
- package/dist/desktop.js +26 -0
- package/dist/desktop.js.map +1 -0
- package/dist/device-authorization.d.ts +23 -0
- package/dist/diffs.d.ts +8 -0
- package/dist/diffs.js +14 -0
- package/dist/diffs.js.map +1 -0
- package/dist/discovery-cache.d.ts +5 -0
- package/dist/editor.d.ts +7 -0
- package/dist/editor.js +21 -0
- package/dist/editor.js.map +1 -0
- package/dist/embedded-session-client.d.ts +23 -0
- package/dist/file-node-visibility.d.ts +15 -0
- package/dist/{fleet-decision-row-GGCAT4E4.js → fleet-decision-row-YZ3ZKWMM.js} +2 -1
- package/dist/fleet-decision-row-YZ3ZKWMM.js.map +1 -0
- package/dist/hooks/channel-cache.d.ts +23 -0
- package/dist/hooks/latest-question.d.ts +25 -0
- package/dist/hooks/shared-machines-list.d.ts +14 -0
- package/dist/hooks/use-attached-browsers.d.ts +2 -1
- package/dist/hooks/use-browser-frame-stream.d.ts +1 -1
- package/dist/hooks/use-browser-session.d.ts +12 -1
- package/dist/hooks/use-channels.d.ts +1 -0
- package/dist/hooks/use-codex-accounts.d.ts +25 -7
- package/dist/hooks/use-composer.d.ts +45 -9
- package/dist/hooks/use-computer-frame-stream.d.ts +1 -1
- package/dist/hooks/use-computer-input-posture.d.ts +13 -0
- package/dist/hooks/use-computer-session.d.ts +2 -0
- package/dist/hooks/use-connect.d.ts +22 -0
- package/dist/hooks/use-desktop-stream.d.ts +1 -1
- package/dist/hooks/use-file-attachments.d.ts +21 -2
- package/dist/hooks/use-machine-chip.d.ts +3 -3
- package/dist/hooks/use-machines.d.ts +19 -1
- package/dist/hooks/use-sandbox-files.d.ts +5 -1
- package/dist/hooks/use-session-background-commands.d.ts +14 -0
- package/dist/hooks/use-session-events.d.ts +30 -8
- package/dist/hooks/use-session-lineage.d.ts +4 -0
- package/dist/hooks/use-session-mcp-approval-policy.d.ts +2 -2
- package/dist/hooks/use-session.d.ts +6 -0
- package/dist/hooks/use-turn-queue.d.ts +12 -0
- package/dist/hooks/use-usage.d.ts +40 -0
- package/dist/hooks/use-workspace-edit.d.ts +4 -0
- package/dist/hooks/use-workspace-sessions.d.ts +27 -5
- package/dist/human-input.d.ts +3 -1
- package/dist/identity-link-accounts.d.ts +11 -0
- package/dist/identity-link-consent.d.ts +18 -0
- package/dist/index.d.ts +60 -17
- package/dist/index.js +2238 -6201
- package/dist/index.js.map +1 -1
- package/dist/interaction.d.ts +1 -1
- package/dist/interaction.js +35 -184
- package/dist/interaction.js.map +1 -1
- package/dist/latest-question-HTRIS4KJ.js +117 -0
- package/dist/latest-question-HTRIS4KJ.js.map +1 -0
- package/dist/lib/error-message.d.ts +7 -0
- package/dist/lib/format.d.ts +36 -2
- package/dist/lib/host-theme.d.ts +70 -0
- package/dist/lib/interaction-errors.d.ts +6 -0
- package/dist/lib/menu-styles.d.ts +22 -0
- package/dist/lib/pierre-diffs-loader.d.ts +20 -0
- package/dist/lib/workbench-peers.d.ts +36 -0
- package/dist/lib/xterm-theme.d.ts +7 -5
- package/dist/machines.d.ts +4 -2
- package/dist/machines.js +14 -4
- package/dist/markdown-table-layout-QXSLK4BY.js +106 -0
- package/dist/markdown-table-layout-QXSLK4BY.js.map +1 -0
- package/dist/mcp-connection-status.d.ts +14 -0
- package/dist/model-policy-picker-menu-M54ISBMN.js +14 -0
- package/dist/model-policy-picker-menu-M54ISBMN.js.map +1 -0
- package/dist/model-policy.d.ts +19 -3
- package/dist/model-policy.js +9 -1
- package/dist/older-history.d.ts +30 -0
- package/dist/platform-activity-row-627BFZ46.js +182 -0
- package/dist/platform-activity-row-627BFZ46.js.map +1 -0
- package/dist/plugin-details.d.ts +14 -0
- package/dist/plugin-discovery.d.ts +25 -0
- package/dist/provider.d.ts +13 -1
- package/dist/{queue-surface-implementation-2KVJTYXH.js → queue-surface-implementation-ZHFI5JBP.js} +131 -44
- package/dist/queue-surface-implementation-ZHFI5JBP.js.map +1 -0
- package/dist/realtime/realtime-control.d.ts +6 -3
- package/dist/realtime.js +133 -74
- package/dist/realtime.js.map +1 -1
- package/dist/sandbox-files-GORZOUUJ.js +20 -0
- package/dist/sandbox-files-GORZOUUJ.js.map +1 -0
- package/dist/session-auth-recommendation.d.ts +5 -0
- package/dist/session-capability-policy.d.ts +12 -0
- package/dist/session-ui.d.ts +30 -2
- package/dist/session-ui.js +85 -7
- package/dist/session-ui.js.map +1 -1
- package/dist/session.d.ts +8 -2
- package/dist/session.js +30 -19
- package/dist/sites-ui.d.ts +34 -0
- package/dist/sites.d.ts +3 -0
- package/dist/sites.js +11 -0
- package/dist/sites.js.map +1 -0
- package/dist/skill-discovery.d.ts +47 -0
- package/dist/terminal.d.ts +8 -0
- package/dist/terminal.js +31 -0
- package/dist/terminal.js.map +1 -0
- package/dist/timeline/activity-rail.d.ts +11 -2
- package/dist/timeline/allowance-exhausted-row.d.ts +24 -0
- package/dist/timeline/compaction-copy.d.ts +10 -0
- package/dist/timeline/entrance.d.ts +13 -1
- package/dist/timeline/genie-loading.d.ts +34 -0
- package/dist/timeline/index.d.ts +6 -2
- package/dist/timeline/knowledge-receipt.d.ts +17 -0
- package/dist/timeline/platform-activity-row.d.ts +14 -0
- package/dist/timeline/presented-image.d.ts +6 -0
- package/dist/timeline/projection.d.ts +31 -2
- package/dist/timeline/registry.d.ts +2 -0
- package/dist/timeline/retained-image.d.ts +18 -0
- package/dist/timeline/rolling-activity.d.ts +11 -0
- package/dist/timeline/screenshot-lightbox.d.ts +16 -1
- package/dist/timeline/shared.d.ts +8 -3
- package/dist/timeline/startup-preference.d.ts +3 -0
- package/dist/timeline/startup-timings.d.ts +4 -0
- package/dist/timeline/tool-display-name.d.ts +2 -1
- package/dist/timeline/turn-summary.d.ts +34 -3
- package/dist/timeline/types.d.ts +147 -7
- package/dist/timeline-annotation-markers-GNDHTGBD.js +165 -0
- package/dist/timeline-annotation-markers-GNDHTGBD.js.map +1 -0
- package/dist/timeline-annotation-selection-DMLMM2TX.js +241 -0
- package/dist/timeline-annotation-selection-DMLMM2TX.js.map +1 -0
- package/dist/timeline-annotations-dialog-ELRDBHTS.js +273 -0
- package/dist/timeline-annotations-dialog-ELRDBHTS.js.map +1 -0
- package/dist/types/machines.d.ts +2 -2
- package/dist/usage/allowance-copy.d.ts +25 -0
- package/dist/usage/summary.d.ts +35 -0
- package/dist/usage.d.ts +13 -0
- package/dist/usage.js +1074 -0
- package/dist/usage.js.map +1 -0
- package/package.json +44 -4
- package/src/accounts.tsx +1072 -0
- package/src/approvals.ts +8 -1
- package/src/artifacts.ts +42 -0
- package/src/assets/README.md +8 -0
- package/src/assets/gmail.ico +0 -0
- package/src/assets/outlook.ico +0 -0
- package/src/capability-catalog-row.tsx +94 -0
- package/src/capability-logo-fallback.ts +22 -0
- package/src/client.ts +22 -13
- package/src/commands/registry.ts +18 -15
- package/src/commands/types.ts +2 -0
- package/src/components/anthropic-mark.tsx +10 -0
- package/src/components/approval-surface.tsx +171 -37
- package/src/components/artifacts/artifact-chrome.tsx +413 -0
- package/src/components/artifacts/artifact-sandbox.tsx +185 -0
- package/src/components/artifacts/artifact-surface.tsx +39 -19
- package/src/components/artifacts/chat-interactive-block.tsx +260 -0
- package/src/components/artifacts/deferred-chat-media.tsx +67 -0
- package/src/components/artifacts/document-editor.tsx +141 -16
- package/src/components/artifacts/editable-artifact-ui.tsx +4 -2
- package/src/components/artifacts/editable-artifact-view.tsx +187 -0
- package/src/components/artifacts/editable-artifact-workbench.tsx +5 -2
- package/src/components/artifacts/editable-document.tsx +37 -36
- package/src/components/artifacts/editable-presentation.tsx +36 -18
- package/src/components/artifacts/editable-spreadsheet.tsx +5 -2
- package/src/components/artifacts/index.ts +44 -0
- package/src/components/artifacts/inline-html-document.ts +24 -0
- package/src/components/artifacts/latest-task-runner.ts +49 -0
- package/src/components/artifacts/presentation-editor.tsx +323 -67
- package/src/components/artifacts/published-html-artifact-frame.tsx +338 -5
- package/src/components/artifacts/session-artifact-viewer.tsx +376 -0
- package/src/components/artifacts/site-view.tsx +116 -0
- package/src/components/artifacts/spreadsheet-canvas.ts +5 -10
- package/src/components/artifacts/spreadsheet-general-display.ts +43 -0
- package/src/components/artifacts/spreadsheet-grid.tsx +12 -13
- package/src/components/artifacts/visualization-assets/base.css +1015 -0
- package/src/components/artifacts/visualization-assets/helpers.html +349 -0
- package/src/components/artifacts/visualization-assets.gen.ts +3 -0
- package/src/components/browser-select-control.tsx +312 -0
- package/src/components/browser-viewer.tsx +1054 -314
- package/src/components/chat-composer.tsx +131 -85
- package/src/components/child-session-link.tsx +27 -0
- package/src/components/claude-mark.tsx +10 -0
- package/src/components/code-editor.tsx +13 -16
- package/src/components/composer-transcription-control.tsx +7 -5
- package/src/components/composer.tsx +376 -49
- package/src/components/computer-viewer.tsx +1041 -329
- package/src/components/copy-button.tsx +13 -5
- package/src/components/desktop-viewer.tsx +1 -1
- package/src/components/enrollment-consent.tsx +65 -7
- package/src/components/enrollment-device-flow.tsx +1 -1
- package/src/components/file-browser.tsx +158 -34
- package/src/components/fleet-tile.tsx +8 -16
- package/src/components/generated-video-player.tsx +4 -2
- package/src/components/grok-mark.tsx +33 -0
- package/src/components/human-input-form.tsx +455 -114
- package/src/components/human-input-surface.tsx +18 -7
- package/src/components/interaction-intervention-banner.tsx +2 -2
- package/src/components/machine-card.tsx +119 -4
- package/src/components/machine-dock-bar.tsx +1 -1
- package/src/components/machine-input-display.ts +23 -2
- package/src/components/machines/machine-detail.tsx +52 -2
- package/src/components/machines/machine-operation-policy.tsx +179 -0
- package/src/components/machines-dashboard.tsx +8 -17
- package/src/components/markdown-table-layout.ts +132 -0
- package/src/components/markdown.tsx +473 -44
- package/src/components/message-timeline.tsx +2754 -665
- package/src/components/model-mark.tsx +90 -0
- package/src/components/model-picker.tsx +15 -4
- package/src/components/model-policy-picker-menu.tsx +424 -0
- package/src/components/model-policy-picker.tsx +337 -381
- package/src/components/open-geni-chat.tsx +338 -0
- package/src/components/open-geni-links.tsx +179 -0
- package/src/components/openrouter-mark.tsx +13 -0
- package/src/components/pierre-diff.tsx +41 -16
- package/src/components/pierre-file.tsx +36 -11
- package/src/components/preview-loading.tsx +154 -0
- package/src/components/queue-item-content.ts +14 -0
- package/src/components/queue-surface-implementation.tsx +132 -42
- package/src/components/queue-surface-state.tsx +3 -1
- package/src/components/sandbox-files.tsx +267 -35
- package/src/components/sandbox-terminal.tsx +48 -11
- package/src/components/sandbox-workspace.tsx +337 -135
- package/src/components/session-capability-frame.tsx +192 -0
- package/src/components/session-chrome.tsx +1027 -328
- package/src/components/session-commands-panel.tsx +126 -0
- package/src/components/session-commands.tsx +18 -0
- package/src/components/session-connection-request.tsx +97 -0
- package/src/components/session-conversation.tsx +526 -0
- package/src/components/session-list.tsx +250 -0
- package/src/components/session-mcp-capability-card.tsx +680 -0
- package/src/components/session-proxy-scope.tsx +92 -0
- package/src/components/session-status.tsx +1 -1
- package/src/components/timeline-anchor.tsx +119 -0
- package/src/components/timeline-annotation-chrome.tsx +196 -0
- package/src/components/timeline-annotation-layout.ts +268 -0
- package/src/components/timeline-annotation-markers.tsx +185 -0
- package/src/components/timeline-annotation-reveal-context.ts +9 -0
- package/src/components/timeline-annotation-selection.tsx +106 -54
- package/src/components/timeline-annotation-shared.ts +245 -0
- package/src/components/timeline-annotations-dialog.tsx +185 -128
- package/src/components/timeline-annotations.tsx +189 -45
- package/src/components/timeline-reading-progress.ts +80 -0
- package/src/components/timeline-search.tsx +168 -0
- package/src/components/timeline-settlement.ts +60 -0
- package/src/components/tip-follow.ts +70 -7
- package/src/components/tooltip.tsx +38 -5
- package/src/components/usage-limit-notice.tsx +179 -0
- package/src/components/usage-member-list.tsx +792 -0
- package/src/components/usage-meter.tsx +382 -0
- package/src/components/use-viewer-menu-dismiss.ts +33 -0
- package/src/components/user-message-body.tsx +194 -49
- package/src/components/workspace-dock.tsx +141 -175
- package/src/composer.ts +6 -1
- package/src/connect-account-identity.tsx +34 -0
- package/src/connect-accounts.tsx +233 -0
- package/src/connect-chooser.tsx +336 -0
- package/src/connect-panel.tsx +99 -0
- package/src/connect-setup.tsx +307 -0
- package/src/connect.ts +60 -0
- package/src/connection-assets.d.ts +4 -0
- package/src/connection-catalog.tsx +162 -0
- package/src/connection-discovery.tsx +235 -0
- package/src/connection-installed.tsx +51 -0
- package/src/connection-logo.tsx +37 -0
- package/src/connection-service-logo.tsx +55 -0
- package/src/connection-service-presentation.ts +46 -0
- package/src/connection-skeleton.tsx +16 -0
- package/src/connection-type-picker.tsx +36 -0
- package/src/conversation-timeline.ts +92 -0
- package/src/desktop.ts +24 -0
- package/src/device-authorization.tsx +98 -0
- package/src/diffs.ts +16 -0
- package/src/discovery-cache.ts +42 -0
- package/src/editor.ts +13 -0
- package/src/embedded-session-client.ts +104 -0
- package/src/file-node-visibility.ts +66 -0
- package/src/hooks/channel-cache.ts +104 -0
- package/src/hooks/internal.ts +3 -2
- package/src/hooks/latest-question.ts +164 -0
- package/src/hooks/shared-machines-list.ts +239 -0
- package/src/hooks/use-attached-browsers.ts +5 -1
- package/src/hooks/use-available-models.ts +20 -14
- package/src/hooks/use-browser-frame-stream.ts +25 -3
- package/src/hooks/use-browser-session.ts +271 -71
- package/src/hooks/use-browser-sessions.ts +7 -1
- package/src/hooks/use-channels.ts +32 -10
- package/src/hooks/use-codex-accounts.ts +78 -21
- package/src/hooks/use-composer.ts +1034 -320
- package/src/hooks/use-computer-frame-stream.ts +39 -16
- package/src/hooks/use-computer-input-posture.ts +94 -0
- package/src/hooks/use-computer-session.ts +110 -32
- package/src/hooks/use-computer-sessions.ts +8 -1
- package/src/hooks/use-connect.ts +23 -0
- package/src/hooks/use-desktop-stream.ts +19 -28
- package/src/hooks/use-file-attachments.ts +118 -10
- package/src/hooks/use-goal.ts +36 -9
- package/src/hooks/use-human-input.ts +31 -4
- package/src/hooks/use-last-started-turn-policy.ts +15 -13
- package/src/hooks/use-machine-chip.ts +23 -6
- package/src/hooks/use-machines.ts +104 -6
- package/src/hooks/use-sandbox-files.ts +253 -150
- package/src/hooks/use-sandbox-git.ts +58 -29
- package/src/hooks/use-session-background-commands.ts +67 -0
- package/src/hooks/use-session-capabilities.ts +21 -2
- package/src/hooks/use-session-events.ts +759 -433
- package/src/hooks/use-session-lineage.ts +28 -6
- package/src/hooks/use-session-mcp-approval-policy.ts +13 -5
- package/src/hooks/use-session.ts +75 -16
- package/src/hooks/use-slash-commands.ts +6 -11
- package/src/hooks/use-turn-queue.ts +113 -13
- package/src/hooks/use-usage.ts +100 -0
- package/src/hooks/use-video-artifact-playback.ts +1 -1
- package/src/hooks/use-voice-input.ts +12 -1
- package/src/hooks/use-workspace-capture.ts +3 -2
- package/src/hooks/use-workspace-edit.ts +23 -5
- package/src/hooks/use-workspace-sessions.ts +99 -11
- package/src/human-input.ts +12 -1
- package/src/identity-link-accounts.tsx +148 -0
- package/src/identity-link-consent.tsx +192 -0
- package/src/index.ts +157 -12
- package/src/interaction.ts +1 -0
- package/src/lib/error-message.ts +37 -0
- package/src/lib/format.ts +150 -14
- package/src/lib/host-theme.ts +511 -0
- package/src/lib/interaction-errors.ts +33 -0
- package/src/lib/menu-styles.ts +44 -0
- package/src/lib/pierre-diffs-loader.ts +53 -0
- package/src/lib/workbench-peers.ts +62 -0
- package/src/lib/xterm-theme.ts +23 -21
- package/src/machines.ts +9 -1
- package/src/mcp-connection-status.ts +35 -0
- package/src/model-policy.ts +223 -69
- package/src/older-history.ts +87 -0
- package/src/plugin-details.tsx +185 -0
- package/src/plugin-discovery.tsx +196 -0
- package/src/provider.tsx +55 -14
- package/src/realtime/dropdown-menu.tsx +19 -12
- package/src/realtime/realtime-control.tsx +133 -46
- package/src/session-auth-recommendation.ts +48 -0
- package/src/session-capability-policy.ts +83 -0
- package/src/session-context.ts +4 -3
- package/src/session-ui.ts +66 -2
- package/src/session.ts +18 -1
- package/src/sites-ui.tsx +402 -0
- package/src/sites.ts +3 -0
- package/src/skill-discovery.tsx +208 -0
- package/src/terminal.ts +26 -0
- package/src/timeline/activity-rail.tsx +171 -80
- package/src/timeline/allowance-exhausted-row.tsx +86 -0
- package/src/timeline/compaction-copy.ts +42 -0
- package/src/timeline/entrance.tsx +28 -3
- package/src/timeline/fleet-decision-projection.ts +2 -1
- package/src/timeline/fleet-decision-row.tsx +1 -0
- package/src/timeline/genie-loading.tsx +136 -0
- package/src/timeline/index.ts +11 -0
- package/src/timeline/knowledge-receipt.tsx +100 -0
- package/src/timeline/parsers.ts +2 -2
- package/src/timeline/platform-activity-row.tsx +216 -0
- package/src/timeline/presented-image.ts +49 -0
- package/src/timeline/projection.ts +1609 -84
- package/src/timeline/registry.ts +15 -3
- package/src/timeline/retained-image.ts +97 -0
- package/src/timeline/rolling-activity.tsx +92 -0
- package/src/timeline/screenshot-lightbox.tsx +115 -17
- package/src/timeline/shared.tsx +47 -15
- package/src/timeline/startup-preference.ts +33 -0
- package/src/timeline/startup-timings.tsx +145 -0
- package/src/timeline/tool-display-name.ts +8 -6
- package/src/timeline/tool-renderers.tsx +497 -128
- package/src/timeline/turn-summary.tsx +218 -44
- package/src/timeline/types.ts +192 -7
- package/src/types/machines.ts +10 -0
- package/src/usage/allowance-copy.ts +64 -0
- package/src/usage/summary.ts +93 -0
- package/src/usage.ts +50 -0
- package/styles/compiled.css +2098 -757
- package/styles/connect.css +284 -0
- package/styles/connect.d.ts +1 -0
- package/styles/effective-tokens.css +1 -0
- package/styles/index.css +201 -9
- package/styles/responsive.css +27 -1
- package/styles/session-capability.css +44 -0
- package/styles/tokens.css +135 -65
- package/dist/chunk-5UQPNLIO.js.map +0 -1
- package/dist/chunk-6KLX2RH5.js.map +0 -1
- package/dist/chunk-7WCLAEFV.js.map +0 -1
- package/dist/chunk-B6WPZSTT.js.map +0 -1
- package/dist/chunk-FK6VG4LL.js +0 -90
- package/dist/chunk-FK6VG4LL.js.map +0 -1
- package/dist/chunk-HA46CYQK.js.map +0 -1
- package/dist/chunk-HUIKIDM5.js.map +0 -1
- package/dist/chunk-IGC6A2ZI.js.map +0 -1
- package/dist/chunk-KCGXPP5V.js.map +0 -1
- package/dist/chunk-KZ73RL76.js.map +0 -1
- package/dist/chunk-LAKLF4PA.js +0 -141
- package/dist/chunk-LAKLF4PA.js.map +0 -1
- package/dist/chunk-LLOLUHVG.js.map +0 -1
- package/dist/chunk-MKPIAGVL.js +0 -465
- package/dist/chunk-MKPIAGVL.js.map +0 -1
- package/dist/chunk-PEI6RANI.js.map +0 -1
- package/dist/chunk-R3AZOAB5.js.map +0 -1
- package/dist/chunk-WSK7G5LE.js +0 -170
- package/dist/chunk-WSK7G5LE.js.map +0 -1
- package/dist/chunk-XBZWOM2K.js +0 -218
- package/dist/chunk-XBZWOM2K.js.map +0 -1
- package/dist/chunk-Y7OEDUJ5.js +0 -8810
- package/dist/chunk-Y7OEDUJ5.js.map +0 -1
- package/dist/fleet-decision-row-GGCAT4E4.js.map +0 -1
- package/dist/hooks/use-packs.d.ts +0 -32
- package/dist/interactive-workbench-viewers-TOHBXJEE.js +0 -15
- package/dist/queue-surface-implementation-2KVJTYXH.js.map +0 -1
- package/dist/timeline-annotation-selection-3L7LHGG2.js +0 -187
- package/dist/timeline-annotation-selection-3L7LHGG2.js.map +0 -1
- package/dist/timeline-annotations-dialog-U7EVLR75.js +0 -196
- package/dist/timeline-annotations-dialog-U7EVLR75.js.map +0 -1
- package/src/hooks/use-packs.ts +0 -157
- /package/dist/{interactive-workbench-viewers-TOHBXJEE.js.map → browser-viewer-SHYKQRNX.js.map} +0 -0
|
@@ -1,29 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
mcpToolLeaf,
|
|
3
|
+
toolMatchesLeaf
|
|
4
|
+
} from "./chunk-ERGYJIBB.js";
|
|
1
5
|
import {
|
|
2
6
|
CREDIT_EXHAUSTION_MESSAGE,
|
|
3
|
-
humanizeFailureReason,
|
|
4
7
|
isCreditExhaustion,
|
|
8
|
+
presentFailure,
|
|
5
9
|
tryParseJson
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
|
|
8
|
-
// src/timeline/tool-display-name.ts
|
|
9
|
-
function mcpToolLeaf(name) {
|
|
10
|
-
const boundary = name.indexOf("__");
|
|
11
|
-
return boundary >= 0 ? name.slice(boundary + 2) : name;
|
|
12
|
-
}
|
|
13
|
-
function toolMatchesLeaf(wireName, leaf) {
|
|
14
|
-
return wireName === leaf || wireName.endsWith(`__${leaf}`);
|
|
15
|
-
}
|
|
16
|
-
function toolDisplayName(name) {
|
|
17
|
-
const phrase = mcpToolLeaf(name).replace(/[_-]+/g, " ").trim();
|
|
18
|
-
if (!phrase) {
|
|
19
|
-
return name;
|
|
20
|
-
}
|
|
21
|
-
return phrase.charAt(0).toUpperCase() + phrase.slice(1);
|
|
22
|
-
}
|
|
10
|
+
} from "./chunk-UTRTG6LH.js";
|
|
23
11
|
|
|
24
12
|
// src/timeline/projection.ts
|
|
25
13
|
import {
|
|
26
|
-
parseMediaGenerationResult
|
|
14
|
+
parseMediaGenerationResult,
|
|
15
|
+
parseToolDisplayMetadata,
|
|
16
|
+
EMPTY_FINAL_REPLY_NOTICE,
|
|
17
|
+
turnCompletedWithEmptyFinalReply
|
|
27
18
|
} from "@opengeni/sdk";
|
|
28
19
|
|
|
29
20
|
// src/timeline/fleet-decision-projection.ts
|
|
@@ -34,6 +25,7 @@ var FLEET_ACTUAL_REASONS = [
|
|
|
34
25
|
"rotation",
|
|
35
26
|
"active",
|
|
36
27
|
"all_capped",
|
|
28
|
+
"allocator_disabled",
|
|
37
29
|
"none"
|
|
38
30
|
];
|
|
39
31
|
var FLEET_SHADOW_OUTCOMES = ["selected", "paced", "none"];
|
|
@@ -251,7 +243,7 @@ function fleetComparisonIsConsistent(comparison, actualOutcome, actualCandidateK
|
|
|
251
243
|
return comparableActualOutcome !== "selected" || actualCandidateKey === shadowCandidateKey;
|
|
252
244
|
}
|
|
253
245
|
function fleetDecisionSemanticsAreConsistent(input) {
|
|
254
|
-
const actualConsistent = input.actualOutcome === "selected" ? ["lease_reused", "pin", "rotation", "active"].includes(input.actualReason) : input.actualOutcome === "waiting" ? input.actualReason
|
|
246
|
+
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";
|
|
255
247
|
const shadowConsistent = input.shadowOutcome === "selected" ? ["fenced_in_flight", "best_score", "affinity_best", "hysteresis_hold"].includes(
|
|
256
248
|
input.shadowReason
|
|
257
249
|
) : input.shadowOutcome === "paced" ? input.shadowReason === "admission_paced" : ["fenced_candidate_missing", "no_eligible_candidate", "overlay_isolated_empty"].includes(
|
|
@@ -265,6 +257,13 @@ function asRecord(value) {
|
|
|
265
257
|
}
|
|
266
258
|
|
|
267
259
|
// src/timeline/projection.ts
|
|
260
|
+
import {
|
|
261
|
+
allowanceExhaustedMessage,
|
|
262
|
+
parseAllowanceExhaustedRefusal
|
|
263
|
+
} from "@opengeni/sdk/allowance-refusal";
|
|
264
|
+
function isTimelineUserQuestion(event) {
|
|
265
|
+
return event.type === "user.message" && workerCompletionPayload(asRecord2(event.payload).childCompletion) === null;
|
|
266
|
+
}
|
|
268
267
|
var WORKER_SPAWN_TOOL = "session_create";
|
|
269
268
|
var WORKER_MESSAGE_TOOL = "session_send_message";
|
|
270
269
|
var WORKER_FAILURE_CODE_MAX_LENGTH = 128;
|
|
@@ -306,18 +305,153 @@ function timelineAnnotationToolOutputText(output) {
|
|
|
306
305
|
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, "");
|
|
307
306
|
return text.length > 0 ? text : null;
|
|
308
307
|
}
|
|
309
|
-
function buildTimeline(events) {
|
|
308
|
+
function buildTimeline(events, options = {}) {
|
|
310
309
|
const items = [];
|
|
310
|
+
const allowanceNotices = /* @__PURE__ */ new Set();
|
|
311
|
+
const allowanceNotice = (event, turnId) => {
|
|
312
|
+
const refusal = parseAllowanceExhaustedRefusal(event.payload);
|
|
313
|
+
if (!refusal) return null;
|
|
314
|
+
const text = allowanceExhaustedMessage(refusal);
|
|
315
|
+
const key = JSON.stringify([
|
|
316
|
+
turnId,
|
|
317
|
+
event.turnAttemptId,
|
|
318
|
+
startupRecoveryRevisionByTurn.get(turnId ?? "") ?? 0,
|
|
319
|
+
refusal.scope,
|
|
320
|
+
refusal.subjectId,
|
|
321
|
+
refusal.resetsAt
|
|
322
|
+
]);
|
|
323
|
+
if (!allowanceNotices.has(key)) {
|
|
324
|
+
allowanceNotices.add(key);
|
|
325
|
+
items.push({
|
|
326
|
+
kind: "notice",
|
|
327
|
+
id: `${event.id}-allowance`,
|
|
328
|
+
tone: "failed",
|
|
329
|
+
text,
|
|
330
|
+
// The canonical sentence replaces upstream prose, so a host renderer
|
|
331
|
+
// reading `message` never shows a wrapper's private wording.
|
|
332
|
+
allowance: { ...refusal, message: text },
|
|
333
|
+
occurredAt: event.occurredAt
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
return text;
|
|
337
|
+
};
|
|
311
338
|
const prescan = prescanTurnAnchors(events);
|
|
312
339
|
const ordered = orderTimelineEvents(events, prescan);
|
|
340
|
+
let completeHistoryPrefix = options.partialStart !== true;
|
|
341
|
+
const knownMessagePrefixTurns = /* @__PURE__ */ new Set();
|
|
342
|
+
const incompleteMessageKeys = /* @__PURE__ */ new Set();
|
|
343
|
+
const pendingWaitOutcomeByTurn = /* @__PURE__ */ new Map();
|
|
344
|
+
const latestAgentResponseByTurn = /* @__PURE__ */ new Map();
|
|
345
|
+
const identifiedMessages = /* @__PURE__ */ new Map();
|
|
346
|
+
const humanInputRequests = humanInputRequestsById(events);
|
|
347
|
+
const humanInputToolCallIds = new Set(
|
|
348
|
+
[...humanInputRequests.values()].map((request) => stringValue(request.toolCallId)).filter(Boolean)
|
|
349
|
+
);
|
|
350
|
+
const workerSessions = /* @__PURE__ */ new Set();
|
|
351
|
+
const pendingWorkerSessions = /* @__PURE__ */ new Set();
|
|
352
|
+
let openWaitNotice = null;
|
|
353
|
+
const presentationWaits = /* @__PURE__ */ new Map();
|
|
354
|
+
const presentationFailures = /* @__PURE__ */ new Map();
|
|
355
|
+
let presentationTurnId = null;
|
|
356
|
+
const rememberPresentationWait = (item, turnId) => {
|
|
357
|
+
const key = turnId ?? presentationTurnId;
|
|
358
|
+
const waits = presentationWaits.get(key) ?? [];
|
|
359
|
+
waits.push(item);
|
|
360
|
+
presentationWaits.set(key, waits);
|
|
361
|
+
items.push(item);
|
|
362
|
+
};
|
|
363
|
+
const resolvePresentationWait = (event, turnId) => {
|
|
364
|
+
if (event.duplicateOfEventId || event.turnAssociation && event.turnAssociation !== "current")
|
|
365
|
+
return;
|
|
366
|
+
const key = turnId ?? presentationTurnId;
|
|
367
|
+
for (const item of presentationWaits.get(key) ?? []) item.resolvedAt = event.occurredAt;
|
|
368
|
+
presentationWaits.delete(key);
|
|
369
|
+
};
|
|
370
|
+
const queuedAtByTurn = /* @__PURE__ */ new Map();
|
|
371
|
+
const startupRecoveryRevisionByTurn = /* @__PURE__ */ new Map();
|
|
372
|
+
const startupPhases = /* @__PURE__ */ new Map();
|
|
373
|
+
let startupEvent;
|
|
374
|
+
let startupTurnId = null;
|
|
375
|
+
let startupAttemptId = null;
|
|
376
|
+
let startupRecoveryRevision = 0;
|
|
377
|
+
const settleStartupPhase = (phase, status, duration, outcome, mode = 0, explicitStartedAt, explicitId, blockedReason) => {
|
|
378
|
+
const key = `${startupTurnId}:${phase}`;
|
|
379
|
+
const priorState = startupPhases.get(key);
|
|
380
|
+
const prior = priorState?.[0];
|
|
381
|
+
const comparedByAttempt = priorState?.[1] && startupAttemptId;
|
|
382
|
+
const sameAttempt = comparedByAttempt ? priorState[1] === startupAttemptId : (priorState?.[2] ?? 0) === startupRecoveryRevision;
|
|
383
|
+
const open = prior?.status === "running" && sameAttempt ? prior : void 0;
|
|
384
|
+
const replacesPriorAttempt = prior !== void 0 && (comparedByAttempt ? !sameAttempt : startupRecoveryRevision > (priorState?.[2] ?? 0));
|
|
385
|
+
if (replacesPriorAttempt && prior.status === "complete") return;
|
|
386
|
+
if (mode === 2 && prior && !replacesPriorAttempt) return;
|
|
387
|
+
if (mode === 1 && !open) return;
|
|
388
|
+
if (!replacesPriorAttempt && status !== "running" && open) {
|
|
389
|
+
open.status = status;
|
|
390
|
+
open.completedAt = startupEvent.occurredAt;
|
|
391
|
+
open.durationMs = duration === null ? elapsedDurationMs(open.startedAt, startupEvent.occurredAt) : Math.max(0, duration);
|
|
392
|
+
open.outcome = outcome ?? open.outcome;
|
|
393
|
+
open.blockedReason = blockedReason;
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
const running = status === "running";
|
|
397
|
+
const durationMs = running || duration === null ? null : Math.max(0, duration);
|
|
398
|
+
const completedEpoch = Date.parse(startupEvent.occurredAt);
|
|
399
|
+
const startedAt = explicitStartedAt ?? (!running && durationMs !== null && Number.isFinite(completedEpoch) ? new Date(completedEpoch - durationMs).toISOString() : startupEvent.occurredAt);
|
|
400
|
+
if (replacesPriorAttempt) {
|
|
401
|
+
Object.assign(prior, {
|
|
402
|
+
id: explicitId ?? startupEvent.id,
|
|
403
|
+
status,
|
|
404
|
+
startedAt,
|
|
405
|
+
completedAt: running ? null : startupEvent.occurredAt,
|
|
406
|
+
durationMs,
|
|
407
|
+
outcome,
|
|
408
|
+
blockedReason,
|
|
409
|
+
occurredAt: startedAt
|
|
410
|
+
});
|
|
411
|
+
startupPhases.set(key, [prior, startupAttemptId, startupRecoveryRevision]);
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
const item = {
|
|
415
|
+
kind: "startup-phase",
|
|
416
|
+
id: explicitId ?? startupEvent.id,
|
|
417
|
+
turnId: startupTurnId,
|
|
418
|
+
phase,
|
|
419
|
+
status,
|
|
420
|
+
startedAt,
|
|
421
|
+
completedAt: running ? null : startupEvent.occurredAt,
|
|
422
|
+
durationMs,
|
|
423
|
+
outcome,
|
|
424
|
+
blockedReason,
|
|
425
|
+
occurredAt: startedAt
|
|
426
|
+
};
|
|
427
|
+
items.push(item);
|
|
428
|
+
startupPhases.set(key, [item, startupAttemptId, startupRecoveryRevision]);
|
|
429
|
+
};
|
|
313
430
|
const last = () => items[items.length - 1];
|
|
431
|
+
const rememberAgentResponse = (turnId, item, completed) => {
|
|
432
|
+
latestAgentResponseByTurn.set(turnId, { item, completed });
|
|
433
|
+
};
|
|
434
|
+
const takePendingWaitOutcome = (turnId) => {
|
|
435
|
+
const outcome = pendingWaitOutcomeByTurn.get(turnId);
|
|
436
|
+
pendingWaitOutcomeByTurn.delete(turnId);
|
|
437
|
+
return outcome;
|
|
438
|
+
};
|
|
439
|
+
const takeAgentResponse = (turnId) => {
|
|
440
|
+
const response = latestAgentResponseByTurn.get(turnId);
|
|
441
|
+
latestAgentResponseByTurn.delete(turnId);
|
|
442
|
+
return response;
|
|
443
|
+
};
|
|
444
|
+
const clearUnscopedTerminalTracking = () => {
|
|
445
|
+
latestAgentResponseByTurn.delete(null);
|
|
446
|
+
pendingWaitOutcomeByTurn.delete(null);
|
|
447
|
+
};
|
|
314
448
|
const closeStreamingTail = () => {
|
|
315
449
|
const open = last();
|
|
316
450
|
if ((open?.kind === "agent-message" || open?.kind === "reasoning") && open.streaming) {
|
|
317
451
|
open.streaming = false;
|
|
318
452
|
}
|
|
319
453
|
};
|
|
320
|
-
const finalizeOpen = (turnId, disposition = "complete") => {
|
|
454
|
+
const finalizeOpen = (turnId, disposition = "complete", completedAt) => {
|
|
321
455
|
for (const item of items) {
|
|
322
456
|
if (turnId !== void 0 && "turnId" in item && item.turnId && turnId && item.turnId !== turnId) {
|
|
323
457
|
continue;
|
|
@@ -331,16 +465,67 @@ function buildTimeline(events) {
|
|
|
331
465
|
if (item.kind === "sandbox" && item.status === "running") {
|
|
332
466
|
item.status = disposition;
|
|
333
467
|
}
|
|
468
|
+
if (item.kind === "startup-phase" && item.status === "running") {
|
|
469
|
+
item.status = disposition;
|
|
470
|
+
if (completedAt) {
|
|
471
|
+
item.completedAt = completedAt;
|
|
472
|
+
item.durationMs = elapsedDurationMs(item.startedAt, completedAt);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
334
475
|
}
|
|
335
476
|
};
|
|
336
477
|
for (const event of ordered) {
|
|
337
478
|
const payload = asRecord2(event.payload);
|
|
338
479
|
const turnId = event.turnId ?? null;
|
|
480
|
+
if (turnId && (event.type === "turn.started" || presentationTurnId === null && isAgentActivityEvent(event.type))) {
|
|
481
|
+
presentationTurnId = turnId;
|
|
482
|
+
}
|
|
483
|
+
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"))) {
|
|
484
|
+
openWaitNotice.waitEndedAt = event.occurredAt;
|
|
485
|
+
openWaitNotice = null;
|
|
486
|
+
}
|
|
487
|
+
if (event.type === "session.created") {
|
|
488
|
+
completeHistoryPrefix = true;
|
|
489
|
+
} else if (event.type === "turn.started" || event.type === "user.message" && payload.delivery !== "steer" && payload.routing !== "accepted_for_steering") {
|
|
490
|
+
knownMessagePrefixTurns.add(turnId);
|
|
491
|
+
}
|
|
492
|
+
startupEvent = event;
|
|
493
|
+
startupTurnId = turnId;
|
|
494
|
+
startupAttemptId = (typeof event.turnAttemptId === "string" ? event.turnAttemptId : null) ?? stringValue(payload.attemptId);
|
|
495
|
+
startupRecoveryRevision = turnId ? startupRecoveryRevisionByTurn.get(turnId) ?? 0 : 0;
|
|
496
|
+
const setupPhase = event.type.startsWith("rig.setup.") ? "rig" : event.type.startsWith("turn.startup.phase.") ? startupPhaseFromPayload(payload.phase) : null;
|
|
497
|
+
const setupStatus = event.type.endsWith(".started") ? "running" : event.type.endsWith(".failed") ? "failed" : event.type.endsWith(".completed") || event.type === "rig.setup.skipped" ? "complete" : null;
|
|
498
|
+
if (setupPhase && setupStatus) {
|
|
499
|
+
closeStreamingTail();
|
|
500
|
+
let blockedReason;
|
|
501
|
+
if (setupPhase === "model_preparation" && setupStatus === "failed") {
|
|
502
|
+
blockedReason = startupLifecycleWaitReason(payload);
|
|
503
|
+
const sandbox = startupPhases.get(`${startupTurnId}:sandbox`);
|
|
504
|
+
const sameAttempt = sandbox?.[1] || startupAttemptId ? Boolean(startupAttemptId && sandbox?.[1] === startupAttemptId) : sandbox?.[2] === startupRecoveryRevision;
|
|
505
|
+
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") {
|
|
506
|
+
blockedReason = sandbox[0].blockedReason;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
settleStartupPhase(
|
|
510
|
+
setupPhase,
|
|
511
|
+
blockedReason ? "cancelled" : setupStatus,
|
|
512
|
+
numberOrNull(payload.durationMs),
|
|
513
|
+
event.type === "rig.setup.skipped" ? "skipped" : null,
|
|
514
|
+
0,
|
|
515
|
+
void 0,
|
|
516
|
+
void 0,
|
|
517
|
+
blockedReason
|
|
518
|
+
);
|
|
519
|
+
continue;
|
|
520
|
+
}
|
|
339
521
|
switch (event.type) {
|
|
340
522
|
case "user.message": {
|
|
523
|
+
clearUnscopedTerminalTracking();
|
|
341
524
|
closeStreamingTail();
|
|
342
525
|
const childCompletion = workerCompletionPayload(payload.childCompletion);
|
|
343
526
|
if (childCompletion) {
|
|
527
|
+
workerSessions.add(childCompletion.childSessionId);
|
|
528
|
+
pendingWorkerSessions.delete(childCompletion.childSessionId);
|
|
344
529
|
items.push({
|
|
345
530
|
kind: "worker-completion",
|
|
346
531
|
id: event.id,
|
|
@@ -360,6 +545,7 @@ function buildTimeline(events) {
|
|
|
360
545
|
items.push({
|
|
361
546
|
kind: "user-message",
|
|
362
547
|
id: event.id,
|
|
548
|
+
...event.clientEventId ? { reconciliationKey: `user-message:${event.clientEventId}` } : {},
|
|
363
549
|
text: voiceMessage?.text ?? stringValue(payload.text),
|
|
364
550
|
annotations: timelineAnnotations(payload.annotations),
|
|
365
551
|
annotationSource: {
|
|
@@ -377,10 +563,26 @@ function buildTimeline(events) {
|
|
|
377
563
|
});
|
|
378
564
|
break;
|
|
379
565
|
}
|
|
566
|
+
case "user.humanInputResponse": {
|
|
567
|
+
const item = humanInputItemFromResponse(event, payload, humanInputRequests);
|
|
568
|
+
if (!item) break;
|
|
569
|
+
closeStreamingTail();
|
|
570
|
+
items.push(item);
|
|
571
|
+
break;
|
|
572
|
+
}
|
|
380
573
|
case "system.update.delivered": {
|
|
381
574
|
const inputs = machineInputMembers(payload.members);
|
|
575
|
+
for (const input of inputs) {
|
|
576
|
+
if (input.kind === "child_terminal_result") {
|
|
577
|
+
workerSessions.add(input.sourceId);
|
|
578
|
+
pendingWorkerSessions.delete(input.sourceId);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
382
581
|
if (inputs.length === 0) break;
|
|
383
|
-
|
|
582
|
+
const visibleInputs = inputs.filter(
|
|
583
|
+
(member) => member.kind !== "background_command_result"
|
|
584
|
+
);
|
|
585
|
+
if (visibleInputs.length === 0 || visibleInputs.every((member) => member.kind === "goal_continuation")) {
|
|
384
586
|
break;
|
|
385
587
|
}
|
|
386
588
|
closeStreamingTail();
|
|
@@ -388,7 +590,7 @@ function buildTimeline(events) {
|
|
|
388
590
|
kind: "machine-input-batch",
|
|
389
591
|
id: event.id,
|
|
390
592
|
turnId,
|
|
391
|
-
members:
|
|
593
|
+
members: visibleInputs,
|
|
392
594
|
occurredAt: event.occurredAt
|
|
393
595
|
});
|
|
394
596
|
break;
|
|
@@ -398,26 +600,61 @@ function buildTimeline(events) {
|
|
|
398
600
|
if (!text) {
|
|
399
601
|
break;
|
|
400
602
|
}
|
|
603
|
+
const messageId = stringValue(payload.messageId);
|
|
604
|
+
const messageKey = messageId ? JSON.stringify([turnId, messageId]) : null;
|
|
605
|
+
const phase = assistantMessagePhase(payload.phase);
|
|
606
|
+
if (!completeHistoryPrefix && !knownMessagePrefixTurns.has(turnId) || messageKey && incompleteMessageKeys.has(messageKey)) {
|
|
607
|
+
if (messageKey) incompleteMessageKeys.add(messageKey);
|
|
608
|
+
break;
|
|
609
|
+
}
|
|
610
|
+
const identified = messageKey ? identifiedMessages.get(messageKey) : void 0;
|
|
611
|
+
if (identified) {
|
|
612
|
+
if (identified.annotationSource?.eventType !== "agent.message.completed") {
|
|
613
|
+
identified.text += text;
|
|
614
|
+
if (phase && !identified.phase) identified.phase = phase;
|
|
615
|
+
rememberAgentResponse(turnId, identified, false);
|
|
616
|
+
}
|
|
617
|
+
break;
|
|
618
|
+
}
|
|
401
619
|
const open = last();
|
|
402
|
-
if (open?.kind === "
|
|
620
|
+
if (!messageKey && open?.kind === "tool-call" && open.status === "running") {
|
|
621
|
+
const previous = latestAgentResponseByTurn.get(turnId);
|
|
622
|
+
const previousIndex = previous ? items.indexOf(previous.item) : -1;
|
|
623
|
+
if (previous && !previous.completed && previousIndex >= 0 && items.slice(previousIndex + 1).every(
|
|
624
|
+
(item2) => item2.kind === "tool-call" && item2.turnId === turnId && item2.status === "running"
|
|
625
|
+
)) {
|
|
626
|
+
previous.item.text += text;
|
|
627
|
+
break;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
if (!messageKey && open?.kind === "agent-message" && open.streaming && open.turnId === turnId) {
|
|
403
631
|
open.text += text;
|
|
632
|
+
rememberAgentResponse(turnId, open, false);
|
|
404
633
|
break;
|
|
405
634
|
}
|
|
406
635
|
closeStreamingTail();
|
|
407
|
-
|
|
636
|
+
const item = {
|
|
408
637
|
kind: "agent-message",
|
|
409
638
|
id: event.id,
|
|
410
639
|
turnId,
|
|
411
640
|
text,
|
|
641
|
+
...phase ? { phase } : {},
|
|
412
642
|
streaming: true,
|
|
413
643
|
occurredAt: event.occurredAt
|
|
414
|
-
}
|
|
644
|
+
};
|
|
645
|
+
items.push(item);
|
|
646
|
+
if (messageKey) identifiedMessages.set(messageKey, item);
|
|
647
|
+
rememberAgentResponse(turnId, item, false);
|
|
415
648
|
break;
|
|
416
649
|
}
|
|
417
650
|
case "agent.message.completed": {
|
|
651
|
+
knownMessagePrefixTurns.add(turnId);
|
|
418
652
|
const text = stringValue(payload.text);
|
|
419
|
-
|
|
420
|
-
|
|
653
|
+
const messageId = stringValue(payload.messageId);
|
|
654
|
+
const messageKey = messageId ? JSON.stringify([turnId, messageId]) : null;
|
|
655
|
+
const phase = assistantMessagePhase(payload.phase);
|
|
656
|
+
let openIndex = messageKey ? items.indexOf(identifiedMessages.get(messageKey)) : -1;
|
|
657
|
+
for (let index = messageKey ? -1 : items.length - 1; index >= 0; index -= 1) {
|
|
421
658
|
const candidate2 = items[index];
|
|
422
659
|
if (candidate2?.kind === "agent-message" && candidate2.turnId === turnId) {
|
|
423
660
|
openIndex = index;
|
|
@@ -426,10 +663,14 @@ function buildTimeline(events) {
|
|
|
426
663
|
}
|
|
427
664
|
const candidate = openIndex >= 0 ? items[openIndex] : void 0;
|
|
428
665
|
const open = candidate?.kind === "agent-message" ? candidate : void 0;
|
|
429
|
-
if (open && (open.streaming || !open.text || text === open.text || text.startsWith(open.text))) {
|
|
430
|
-
if (!open.text || text && text.startsWith(open.text)) {
|
|
666
|
+
if (open && (messageKey || open.streaming || !open.text || text === open.text || text.startsWith(open.text))) {
|
|
667
|
+
if (!open.text || text && (messageKey || text.startsWith(open.text))) {
|
|
431
668
|
open.text = text || open.text;
|
|
432
669
|
}
|
|
670
|
+
if (phase) open.phase = phase;
|
|
671
|
+
if (open.startedAt === void 0 && open.occurredAt !== event.occurredAt) {
|
|
672
|
+
open.startedAt = open.occurredAt;
|
|
673
|
+
}
|
|
433
674
|
open.streaming = false;
|
|
434
675
|
open.occurredAt = event.occurredAt;
|
|
435
676
|
open.annotationSource = text && open.text === text ? {
|
|
@@ -444,14 +685,16 @@ function buildTimeline(events) {
|
|
|
444
685
|
items.splice(openIndex, 1);
|
|
445
686
|
items.push(open);
|
|
446
687
|
}
|
|
688
|
+
rememberAgentResponse(turnId, open, true);
|
|
447
689
|
break;
|
|
448
690
|
}
|
|
449
691
|
if (text) {
|
|
450
|
-
|
|
692
|
+
const item = {
|
|
451
693
|
kind: "agent-message",
|
|
452
694
|
id: event.id,
|
|
453
695
|
turnId,
|
|
454
696
|
text,
|
|
697
|
+
...phase ? { phase } : {},
|
|
455
698
|
streaming: false,
|
|
456
699
|
occurredAt: event.occurredAt,
|
|
457
700
|
annotationSource: {
|
|
@@ -462,7 +705,10 @@ function buildTimeline(events) {
|
|
|
462
705
|
turnId,
|
|
463
706
|
text
|
|
464
707
|
}
|
|
465
|
-
}
|
|
708
|
+
};
|
|
709
|
+
items.push(item);
|
|
710
|
+
if (messageKey) identifiedMessages.set(messageKey, item);
|
|
711
|
+
rememberAgentResponse(turnId, item, true);
|
|
466
712
|
}
|
|
467
713
|
break;
|
|
468
714
|
}
|
|
@@ -489,9 +735,13 @@ function buildTimeline(events) {
|
|
|
489
735
|
}
|
|
490
736
|
case "agent.toolCall.created": {
|
|
491
737
|
const name = typeof payload.name === "string" ? payload.name : "tool";
|
|
738
|
+
const display = parseToolDisplayMetadata(payload.display);
|
|
492
739
|
const callId = typeof payload.id === "string" ? payload.id : null;
|
|
493
740
|
const args = payload.arguments ?? null;
|
|
494
741
|
closeStreamingTail();
|
|
742
|
+
if (callId && humanInputToolCallIds.has(callId)) {
|
|
743
|
+
break;
|
|
744
|
+
}
|
|
495
745
|
if (toolMatchesLeaf(name, WORKER_SPAWN_TOOL) || toolMatchesLeaf(name, WORKER_MESSAGE_TOOL)) {
|
|
496
746
|
items.push({
|
|
497
747
|
kind: "worker",
|
|
@@ -515,6 +765,7 @@ function buildTimeline(events) {
|
|
|
515
765
|
(item) => item.kind === "tool-call" && item.callId === callId
|
|
516
766
|
);
|
|
517
767
|
if (existing) {
|
|
768
|
+
if (display) existing.display = display;
|
|
518
769
|
if (args != null) {
|
|
519
770
|
existing.arguments = args;
|
|
520
771
|
}
|
|
@@ -531,6 +782,7 @@ function buildTimeline(events) {
|
|
|
531
782
|
turnId,
|
|
532
783
|
callId,
|
|
533
784
|
name,
|
|
785
|
+
...display ? { display } : {},
|
|
534
786
|
arguments: args,
|
|
535
787
|
output: void 0,
|
|
536
788
|
truncation: null,
|
|
@@ -548,10 +800,17 @@ function buildTimeline(events) {
|
|
|
548
800
|
if (!target) {
|
|
549
801
|
break;
|
|
550
802
|
}
|
|
803
|
+
resolvePresentationWait(event, turnId ?? target.turnId);
|
|
551
804
|
if (target.kind === "worker") {
|
|
552
805
|
target.status = isErrorOutput(payload) ? "failed" : "complete";
|
|
553
806
|
target.workerSessionId = target.workerSessionId ?? extractSessionRef(payload.output);
|
|
554
807
|
target.failure = target.status === "failed" ? workerFailure(payload.output) : null;
|
|
808
|
+
if (target.status === "complete" && target.workerSessionId) {
|
|
809
|
+
if (target.action === "spawn") workerSessions.add(target.workerSessionId);
|
|
810
|
+
if (workerSessions.has(target.workerSessionId)) {
|
|
811
|
+
pendingWorkerSessions.add(target.workerSessionId);
|
|
812
|
+
}
|
|
813
|
+
}
|
|
555
814
|
break;
|
|
556
815
|
}
|
|
557
816
|
const truncation = toolCallTruncation(payload);
|
|
@@ -574,20 +833,59 @@ function buildTimeline(events) {
|
|
|
574
833
|
}
|
|
575
834
|
break;
|
|
576
835
|
}
|
|
836
|
+
case "turn.queued": {
|
|
837
|
+
const queuedTurnId = turnId ?? (typeof payload.turnId === "string" ? payload.turnId : null);
|
|
838
|
+
if (queuedTurnId) {
|
|
839
|
+
queuedAtByTurn.set(queuedTurnId, event.occurredAt);
|
|
840
|
+
}
|
|
841
|
+
break;
|
|
842
|
+
}
|
|
843
|
+
case "turn.started": {
|
|
844
|
+
if (turnId) clearUnscopedTerminalTracking();
|
|
845
|
+
if (!turnId) break;
|
|
846
|
+
const queuedAt = queuedAtByTurn.get(turnId);
|
|
847
|
+
if (!queuedAt) break;
|
|
848
|
+
queuedAtByTurn.delete(turnId);
|
|
849
|
+
closeStreamingTail();
|
|
850
|
+
settleStartupPhase(
|
|
851
|
+
"queue",
|
|
852
|
+
"complete",
|
|
853
|
+
elapsedDurationMs(queuedAt, event.occurredAt),
|
|
854
|
+
null,
|
|
855
|
+
0,
|
|
856
|
+
queuedAt,
|
|
857
|
+
`${event.id}-queue`
|
|
858
|
+
);
|
|
859
|
+
break;
|
|
860
|
+
}
|
|
577
861
|
case "sandbox.operation.started":
|
|
578
862
|
case "sandbox.operation.completed":
|
|
579
863
|
case "sandbox.operation.failed": {
|
|
580
864
|
const name = typeof payload.name === "string" ? payload.name : "sandbox";
|
|
581
|
-
const status = event.type.endsWith(".failed") ? "failed" : event.type.endsWith(".completed") ? "complete" : "running";
|
|
582
|
-
|
|
865
|
+
const status = event.type.endsWith(".failed") ? payload.expectedTransition === true ? "cancelled" : "failed" : event.type.endsWith(".completed") ? "complete" : "running";
|
|
866
|
+
const origin = payload.origin === "created" || payload.origin === "restored" || payload.origin === "resumed" ? payload.origin : null;
|
|
867
|
+
const startupPhase = startupPhaseForSandboxOperation(name);
|
|
868
|
+
if (startupPhase) {
|
|
869
|
+
closeStreamingTail();
|
|
870
|
+
settleStartupPhase(
|
|
871
|
+
startupPhase,
|
|
872
|
+
status,
|
|
873
|
+
numberOrNull(payload.durationMs),
|
|
874
|
+
origin,
|
|
875
|
+
0,
|
|
876
|
+
void 0,
|
|
877
|
+
void 0,
|
|
878
|
+
status === "cancelled" ? startupLifecycleWaitReason(payload) ?? (payload.failureCode === "rotation_in_progress" ? "rotation_in_progress" : void 0) : void 0
|
|
879
|
+
);
|
|
880
|
+
break;
|
|
881
|
+
}
|
|
882
|
+
if ((name === "repository-clone" || name === "file-resource-download" || name === "optional-repository-access") && status !== "failed") {
|
|
583
883
|
break;
|
|
584
884
|
}
|
|
585
885
|
const existing = findOpenSandbox(items, name);
|
|
586
886
|
if (existing && status !== "running") {
|
|
587
887
|
existing.status = status;
|
|
588
|
-
if (
|
|
589
|
-
existing.origin = payload.origin;
|
|
590
|
-
}
|
|
888
|
+
if (origin) existing.origin = origin;
|
|
591
889
|
const message = failureMessage(payload);
|
|
592
890
|
if (message) {
|
|
593
891
|
existing.output = existing.output ? `${existing.output}
|
|
@@ -604,13 +902,28 @@ ${message}` : message;
|
|
|
604
902
|
name,
|
|
605
903
|
command: typeof payload.command === "string" ? payload.command : null,
|
|
606
904
|
output: failureMessage(payload) ?? "",
|
|
607
|
-
origin
|
|
905
|
+
origin,
|
|
608
906
|
status,
|
|
609
907
|
occurredAt: event.occurredAt
|
|
610
908
|
});
|
|
611
909
|
}
|
|
612
910
|
break;
|
|
613
911
|
}
|
|
912
|
+
case "agent.model.request": {
|
|
913
|
+
const requestPhase = typeof payload.phase === "string" ? payload.phase : null;
|
|
914
|
+
const status = requestPhase === "started" ? "running" : requestPhase === "first_byte" || requestPhase === "first_event" ? "complete" : requestPhase === "failed" || requestPhase === "timed_out" ? "failed" : null;
|
|
915
|
+
if (status) {
|
|
916
|
+
if (status === "running") closeStreamingTail();
|
|
917
|
+
settleStartupPhase(
|
|
918
|
+
"provider_first_byte",
|
|
919
|
+
status,
|
|
920
|
+
status === "running" ? null : numberOrNull(payload.durationMs),
|
|
921
|
+
null,
|
|
922
|
+
status === "running" ? 2 : 1
|
|
923
|
+
);
|
|
924
|
+
}
|
|
925
|
+
break;
|
|
926
|
+
}
|
|
614
927
|
case "sandbox.command.output.delta": {
|
|
615
928
|
const text = typeof payload.chunk === "string" ? payload.chunk : typeof payload.text === "string" ? payload.text : typeof payload.output === "string" ? payload.output : "";
|
|
616
929
|
if (!text) {
|
|
@@ -629,32 +942,56 @@ ${message}` : message;
|
|
|
629
942
|
if (!isSessionStatus(status)) {
|
|
630
943
|
break;
|
|
631
944
|
}
|
|
945
|
+
if (status === "running") resolvePresentationWait(event, turnId);
|
|
632
946
|
if (!ATTENTION_STATUSES.has(status)) {
|
|
633
947
|
break;
|
|
634
948
|
}
|
|
635
|
-
const previous = [...items].reverse().find((
|
|
636
|
-
if (previous?.status === status) {
|
|
949
|
+
const previous = [...items].reverse().find((item2) => item2.kind === "session-status");
|
|
950
|
+
if (previous?.status === status && !previous.resolvedAt) {
|
|
637
951
|
break;
|
|
638
952
|
}
|
|
639
|
-
|
|
953
|
+
const item = {
|
|
640
954
|
kind: "session-status",
|
|
641
955
|
id: event.id,
|
|
642
956
|
status,
|
|
643
957
|
occurredAt: event.occurredAt
|
|
644
|
-
}
|
|
958
|
+
};
|
|
959
|
+
if (status === "requires_action") rememberPresentationWait(item, turnId);
|
|
960
|
+
else {
|
|
961
|
+
items.push(item);
|
|
962
|
+
if (status === "failed") {
|
|
963
|
+
const key = turnId ?? presentationTurnId;
|
|
964
|
+
const failures = presentationFailures.get(key) ?? [];
|
|
965
|
+
failures.push(item);
|
|
966
|
+
presentationFailures.set(key, failures);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
645
969
|
break;
|
|
646
970
|
}
|
|
647
|
-
case "
|
|
648
|
-
finalizeOpen(turnId);
|
|
971
|
+
case "codex.capacity.waiting": {
|
|
649
972
|
items.push({
|
|
650
973
|
kind: "notice",
|
|
651
974
|
id: event.id,
|
|
652
975
|
tone: "waiting",
|
|
653
|
-
text:
|
|
976
|
+
text: stringValue(payload.detail) ?? stringValue(payload.error) ?? "Waiting for Codex capacity.",
|
|
654
977
|
occurredAt: event.occurredAt
|
|
655
978
|
});
|
|
656
979
|
break;
|
|
657
980
|
}
|
|
981
|
+
case "session.requiresAction": {
|
|
982
|
+
finalizeOpen(turnId, "complete", event.occurredAt);
|
|
983
|
+
rememberPresentationWait(
|
|
984
|
+
{
|
|
985
|
+
kind: "notice",
|
|
986
|
+
id: event.id,
|
|
987
|
+
tone: "waiting",
|
|
988
|
+
text: "Approval needed \u2014 the turn is paused until someone decides.",
|
|
989
|
+
occurredAt: event.occurredAt
|
|
990
|
+
},
|
|
991
|
+
turnId
|
|
992
|
+
);
|
|
993
|
+
break;
|
|
994
|
+
}
|
|
658
995
|
case "session.context.compaction.requested":
|
|
659
996
|
case "session.context.compaction.started": {
|
|
660
997
|
closeStreamingTail();
|
|
@@ -666,6 +1003,7 @@ ${message}` : message;
|
|
|
666
1003
|
estimatedTokensBefore: numberOrNull(payload.estimatedTokensBefore),
|
|
667
1004
|
estimatedTokensAfter: null,
|
|
668
1005
|
skipReason: null,
|
|
1006
|
+
providerRejection: null,
|
|
669
1007
|
implementation: typeof payload.implementation === "string" ? payload.implementation : null,
|
|
670
1008
|
occurredAt: event.occurredAt
|
|
671
1009
|
});
|
|
@@ -681,6 +1019,7 @@ ${message}` : message;
|
|
|
681
1019
|
estimatedTokensBefore: numberOrNull(payload.estimatedTokensBefore),
|
|
682
1020
|
estimatedTokensAfter: numberOrNull(payload.estimatedTokensAfter),
|
|
683
1021
|
skipReason: null,
|
|
1022
|
+
providerRejection: null,
|
|
684
1023
|
implementation: typeof payload.implementation === "string" ? payload.implementation : null,
|
|
685
1024
|
occurredAt: event.occurredAt
|
|
686
1025
|
});
|
|
@@ -696,12 +1035,30 @@ ${message}` : message;
|
|
|
696
1035
|
estimatedTokensBefore: numberOrNull(payload.estimatedTokensBefore),
|
|
697
1036
|
estimatedTokensAfter: null,
|
|
698
1037
|
skipReason: typeof payload.reason === "string" ? payload.reason : null,
|
|
1038
|
+
providerRejection: compactionProviderRejection(payload),
|
|
699
1039
|
implementation: typeof payload.implementation === "string" ? payload.implementation : null,
|
|
700
1040
|
occurredAt: event.occurredAt
|
|
701
1041
|
});
|
|
702
1042
|
break;
|
|
703
1043
|
}
|
|
704
1044
|
case "turn.recovery.requested": {
|
|
1045
|
+
if (turnId) {
|
|
1046
|
+
startupRecoveryRevisionByTurn.set(
|
|
1047
|
+
turnId,
|
|
1048
|
+
(startupRecoveryRevisionByTurn.get(turnId) ?? 0) + 1
|
|
1049
|
+
);
|
|
1050
|
+
if (!event.duplicateOfEventId && (!event.turnAssociation || event.turnAssociation === "current")) {
|
|
1051
|
+
for (const item of items) {
|
|
1052
|
+
if (item.kind === "turn-end" && item.turnId === turnId && item.outcome === "failed") {
|
|
1053
|
+
item.resumedAt ??= event.occurredAt;
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
for (const item of presentationFailures.get(turnId) ?? []) {
|
|
1057
|
+
item.resolvedAt = event.occurredAt;
|
|
1058
|
+
}
|
|
1059
|
+
presentationFailures.delete(turnId);
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
705
1062
|
break;
|
|
706
1063
|
}
|
|
707
1064
|
case "turn.event.rejected_late": {
|
|
@@ -710,6 +1067,7 @@ ${message}` : message;
|
|
|
710
1067
|
case "tool.auth_needed":
|
|
711
1068
|
case "credential.auth_needed": {
|
|
712
1069
|
const capability = capabilityAuthorizationRequest(payload.capability);
|
|
1070
|
+
const setupRequest = customMcpSetupRequest(payload.setupRequest);
|
|
713
1071
|
if (event.type === "tool.auth_needed" && !stringValue(payload.toolName) && stringValue(payload.serverId) !== "codex_apps") {
|
|
714
1072
|
break;
|
|
715
1073
|
}
|
|
@@ -719,26 +1077,49 @@ ${message}` : message;
|
|
|
719
1077
|
id: event.id,
|
|
720
1078
|
turnId,
|
|
721
1079
|
serverId: typeof payload.serverId === "string" ? payload.serverId : null,
|
|
722
|
-
|
|
1080
|
+
canonicalServerId: typeof payload.canonicalServerId === "string" ? payload.canonicalServerId : null,
|
|
1081
|
+
connectionSubjectScope: payload.connectionSubjectScope === "subject" || payload.connectionSubjectScope === "workspace" ? payload.connectionSubjectScope : null,
|
|
1082
|
+
source: capability || setupRequest ? "capability" : event.type === "tool.auth_needed" ? "tool" : "credential",
|
|
723
1083
|
providerDomain: stringValue(payload.providerDomain),
|
|
724
1084
|
connectionId: typeof payload.connectionId === "string" ? payload.connectionId : null,
|
|
725
|
-
|
|
1085
|
+
authoritySource: payload.authoritySource === "host" ? "host" : null,
|
|
1086
|
+
reason: authNeededReason(
|
|
1087
|
+
payload.authoritySource === "host" && typeof payload.authorizationUrl === "string" ? payload.hostReason ?? payload.reason : payload.reason
|
|
1088
|
+
),
|
|
726
1089
|
scopes: stringList(payload.scopes),
|
|
727
1090
|
resource: typeof payload.resource === "string" ? payload.resource : null,
|
|
728
1091
|
toolName: typeof payload.toolName === "string" ? payload.toolName : null,
|
|
729
1092
|
authorizationUrl: typeof payload.authorizationUrl === "string" ? payload.authorizationUrl : null,
|
|
730
1093
|
capability,
|
|
1094
|
+
setupRequest,
|
|
731
1095
|
occurredAt: event.occurredAt
|
|
732
1096
|
});
|
|
733
1097
|
break;
|
|
734
1098
|
}
|
|
1099
|
+
case "usage.exhausted": {
|
|
1100
|
+
allowanceNotice(event, turnId);
|
|
1101
|
+
break;
|
|
1102
|
+
}
|
|
735
1103
|
case "turn.completed": {
|
|
736
1104
|
if (payload.maintenance === "context_compaction") {
|
|
737
|
-
finalizeOpen(turnId);
|
|
1105
|
+
finalizeOpen(turnId, "complete", event.occurredAt);
|
|
1106
|
+
takeAgentResponse(turnId);
|
|
1107
|
+
takePendingWaitOutcome(turnId);
|
|
1108
|
+
break;
|
|
1109
|
+
}
|
|
1110
|
+
const allowance = parseAllowanceExhaustedRefusal(payload);
|
|
1111
|
+
if (allowance) {
|
|
1112
|
+
finalizeOpen(turnId, "complete", event.occurredAt);
|
|
1113
|
+
takeAgentResponse(turnId);
|
|
1114
|
+
takePendingWaitOutcome(turnId);
|
|
1115
|
+
items.push(turnEndItem(event, "failed", ALLOWANCE_TURN_END_TEXT));
|
|
1116
|
+
allowanceNotice(event, turnId);
|
|
738
1117
|
break;
|
|
739
1118
|
}
|
|
740
1119
|
if (isCreditExhaustionPayload(payload)) {
|
|
741
|
-
finalizeOpen(turnId);
|
|
1120
|
+
finalizeOpen(turnId, "complete", event.occurredAt);
|
|
1121
|
+
takeAgentResponse(turnId);
|
|
1122
|
+
takePendingWaitOutcome(turnId);
|
|
742
1123
|
items.push(turnEndItem(event, "failed", CREDIT_EXHAUSTION_MESSAGE));
|
|
743
1124
|
items.push({
|
|
744
1125
|
kind: "notice",
|
|
@@ -749,16 +1130,82 @@ ${message}` : message;
|
|
|
749
1130
|
});
|
|
750
1131
|
break;
|
|
751
1132
|
}
|
|
752
|
-
|
|
753
|
-
|
|
1133
|
+
const latestAgentResponse = takeAgentResponse(turnId);
|
|
1134
|
+
const finalOutput = stringValue(payload.output);
|
|
1135
|
+
const visibleFinalOutput = stripOpaqueCitationTokens(finalOutput).trim();
|
|
1136
|
+
const visibleTrackedResponse = stripOpaqueCitationTokens(
|
|
1137
|
+
latestAgentResponse?.item.text ?? ""
|
|
1138
|
+
).trim();
|
|
1139
|
+
const finalOutputMirrorsCommentary = latestAgentResponse?.item.phase === "commentary" && visibleTrackedResponse === visibleFinalOutput;
|
|
1140
|
+
const hasAuthoritativeFinalOutput = Boolean(visibleFinalOutput) && !finalOutputMirrorsCommentary;
|
|
1141
|
+
const pendingWaitOutcome = takePendingWaitOutcome(turnId);
|
|
1142
|
+
if (hasAuthoritativeFinalOutput) {
|
|
1143
|
+
if (latestAgentResponse && !latestAgentResponse.completed && finalOutput.startsWith(latestAgentResponse.item.text)) {
|
|
1144
|
+
latestAgentResponse.item.text = finalOutput;
|
|
1145
|
+
latestAgentResponse.item.streaming = false;
|
|
1146
|
+
if (latestAgentResponse.item.startedAt === void 0 && latestAgentResponse.item.occurredAt !== event.occurredAt) {
|
|
1147
|
+
latestAgentResponse.item.startedAt = latestAgentResponse.item.occurredAt;
|
|
1148
|
+
}
|
|
1149
|
+
latestAgentResponse.item.occurredAt = event.occurredAt;
|
|
1150
|
+
const responseIndex = items.indexOf(latestAgentResponse.item);
|
|
1151
|
+
if (responseIndex >= 0 && responseIndex < items.length - 1) {
|
|
1152
|
+
items.splice(responseIndex, 1);
|
|
1153
|
+
items.push(latestAgentResponse.item);
|
|
1154
|
+
}
|
|
1155
|
+
} else if (visibleTrackedResponse !== visibleFinalOutput) {
|
|
1156
|
+
items.push({
|
|
1157
|
+
kind: "agent-message",
|
|
1158
|
+
id: `${event.id}-output-message`,
|
|
1159
|
+
turnId,
|
|
1160
|
+
text: finalOutput,
|
|
1161
|
+
streaming: false,
|
|
1162
|
+
occurredAt: event.occurredAt
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
finalizeOpen(turnId, "complete", event.occurredAt);
|
|
1167
|
+
const completedTurn = turnEndItem(event, "complete", null);
|
|
1168
|
+
items.push(completedTurn);
|
|
1169
|
+
if (turnCompletedWithEmptyFinalReply(payload)) {
|
|
1170
|
+
items.push({
|
|
1171
|
+
kind: "notice",
|
|
1172
|
+
id: `${event.id}-empty-final-reply`,
|
|
1173
|
+
tone: "input",
|
|
1174
|
+
text: EMPTY_FINAL_REPLY_NOTICE,
|
|
1175
|
+
recordedOutcome: true,
|
|
1176
|
+
occurredAt: event.occurredAt
|
|
1177
|
+
});
|
|
1178
|
+
}
|
|
1179
|
+
const hasCompletedFinalResponse = latestAgentResponse?.completed === true && latestAgentResponse.item.phase !== "commentary" && Boolean(visibleTrackedResponse);
|
|
1180
|
+
if (!hasAuthoritativeFinalOutput && pendingWaitOutcome) {
|
|
1181
|
+
completedTurn.preserveWaitResponse = true;
|
|
1182
|
+
}
|
|
1183
|
+
if (!hasAuthoritativeFinalOutput && !hasCompletedFinalResponse && pendingWaitOutcome) {
|
|
1184
|
+
const notice = {
|
|
1185
|
+
kind: "notice",
|
|
1186
|
+
id: `${pendingWaitOutcome.id}-visible-outcome`,
|
|
1187
|
+
tone: "waiting",
|
|
1188
|
+
text: waitingOutcomeText(pendingWaitOutcome.reason),
|
|
1189
|
+
recordedOutcome: true,
|
|
1190
|
+
...pendingWorkerSessions.size > 0 ? { waitingAgents: pendingWorkerSessions.size } : {},
|
|
1191
|
+
occurredAt: pendingWaitOutcome.occurredAt
|
|
1192
|
+
};
|
|
1193
|
+
items.push(notice);
|
|
1194
|
+
openWaitNotice = notice;
|
|
1195
|
+
}
|
|
754
1196
|
break;
|
|
755
1197
|
}
|
|
756
1198
|
case "turn.failed": {
|
|
1199
|
+
takeAgentResponse(turnId);
|
|
1200
|
+
takePendingWaitOutcome(turnId);
|
|
757
1201
|
const hadActivity = hasTurnActivity(items, turnId);
|
|
758
|
-
const
|
|
759
|
-
|
|
1202
|
+
const allowance = parseAllowanceExhaustedRefusal(payload);
|
|
1203
|
+
const failureText = allowance ? ALLOWANCE_TURN_END_TEXT : isCreditExhaustionPayload(payload) ? CREDIT_EXHAUSTION_MESSAGE : failureMessage(payload);
|
|
1204
|
+
finalizeOpen(turnId, "cancelled", event.occurredAt);
|
|
760
1205
|
items.push(turnEndItem(event, "failed", failureText));
|
|
761
|
-
if (
|
|
1206
|
+
if (allowance) {
|
|
1207
|
+
allowanceNotice(event, turnId);
|
|
1208
|
+
} else if (!hadActivity) {
|
|
762
1209
|
items.push({
|
|
763
1210
|
kind: "notice",
|
|
764
1211
|
id: event.id,
|
|
@@ -769,12 +1216,15 @@ ${message}` : message;
|
|
|
769
1216
|
}
|
|
770
1217
|
break;
|
|
771
1218
|
}
|
|
1219
|
+
case "turn.superseded":
|
|
772
1220
|
case "turn.cancelled": {
|
|
773
|
-
if (turnId && !prescan.startedTurnIds.has(turnId)) {
|
|
1221
|
+
if (event.type === "turn.cancelled" && turnId && !prescan.startedTurnIds.has(turnId)) {
|
|
774
1222
|
break;
|
|
775
1223
|
}
|
|
1224
|
+
takeAgentResponse(turnId);
|
|
1225
|
+
takePendingWaitOutcome(turnId);
|
|
776
1226
|
const hadActivity = hasTurnActivity(items, turnId);
|
|
777
|
-
finalizeOpen(turnId, "cancelled");
|
|
1227
|
+
finalizeOpen(turnId, "cancelled", event.occurredAt);
|
|
778
1228
|
items.push(turnEndItem(event, "cancelled", null));
|
|
779
1229
|
if (!hadActivity) {
|
|
780
1230
|
items.push({
|
|
@@ -787,6 +1237,40 @@ ${message}` : message;
|
|
|
787
1237
|
}
|
|
788
1238
|
break;
|
|
789
1239
|
}
|
|
1240
|
+
case "instruction.confirmation.recovered": {
|
|
1241
|
+
const receipt = asRecord2(payload.receipt);
|
|
1242
|
+
if (receipt.outcome !== "published") break;
|
|
1243
|
+
closeStreamingTail();
|
|
1244
|
+
items.push({
|
|
1245
|
+
kind: "notice",
|
|
1246
|
+
id: event.id,
|
|
1247
|
+
tone: "input",
|
|
1248
|
+
text: "Your previously approved workspace instruction was saved.",
|
|
1249
|
+
occurredAt: event.occurredAt
|
|
1250
|
+
});
|
|
1251
|
+
break;
|
|
1252
|
+
}
|
|
1253
|
+
case "knowledge.confirmation.recovered":
|
|
1254
|
+
case "knowledge.source.prepared":
|
|
1255
|
+
case "knowledge.source.failed": {
|
|
1256
|
+
const receipt = asRecord2(payload.receipt);
|
|
1257
|
+
const outcome = event.type === "knowledge.source.failed" ? "failed" : receipt.outcome;
|
|
1258
|
+
if (event.type !== "knowledge.confirmation.recovered" && typeof payload.fileId !== "string" || !["published", "pending", "rejected", "archived", "failed"].includes(String(outcome)))
|
|
1259
|
+
break;
|
|
1260
|
+
closeStreamingTail();
|
|
1261
|
+
items.push({
|
|
1262
|
+
kind: "knowledge",
|
|
1263
|
+
id: event.id,
|
|
1264
|
+
turnId,
|
|
1265
|
+
fileId: typeof payload.fileId === "string" ? payload.fileId : void 0,
|
|
1266
|
+
filename: typeof payload.filename === "string" ? payload.filename : void 0,
|
|
1267
|
+
entryId: typeof receipt.entryId === "string" ? receipt.entryId : void 0,
|
|
1268
|
+
status: outcome === "failed" ? "failed" : "complete",
|
|
1269
|
+
outcome,
|
|
1270
|
+
occurredAt: event.occurredAt
|
|
1271
|
+
});
|
|
1272
|
+
break;
|
|
1273
|
+
}
|
|
790
1274
|
case "memory.saved":
|
|
791
1275
|
case "memory.corrected": {
|
|
792
1276
|
const memory = memoryItem(event.id, event.type, turnId, payload, event.occurredAt);
|
|
@@ -810,7 +1294,11 @@ ${message}` : message;
|
|
|
810
1294
|
case "goal.paused":
|
|
811
1295
|
case "goal.resumed":
|
|
812
1296
|
case "goal.cleared":
|
|
1297
|
+
case "goal.held":
|
|
813
1298
|
case "goal.continuation": {
|
|
1299
|
+
if (event.type === "goal.held" && payload.actor === "agent") {
|
|
1300
|
+
rememberPendingWaitOutcome(pendingWaitOutcomeByTurn, event, payload, turnId);
|
|
1301
|
+
}
|
|
814
1302
|
if (shouldSuppressAgentGoalLandmark(event.type, payload)) {
|
|
815
1303
|
break;
|
|
816
1304
|
}
|
|
@@ -818,16 +1306,29 @@ ${message}` : message;
|
|
|
818
1306
|
kind: "goal",
|
|
819
1307
|
id: event.id,
|
|
820
1308
|
action: event.type.slice("goal.".length),
|
|
821
|
-
text: goalText(payload),
|
|
1309
|
+
text: event.type === "goal.held" && typeof payload.reason === "string" && payload.reason ? payload.reason : goalText(payload),
|
|
822
1310
|
occurredAt: event.occurredAt
|
|
823
1311
|
});
|
|
824
1312
|
break;
|
|
825
1313
|
}
|
|
1314
|
+
case "session.wait.started": {
|
|
1315
|
+
if (payload.actor === "agent") {
|
|
1316
|
+
rememberPendingWaitOutcome(pendingWaitOutcomeByTurn, event, payload, turnId);
|
|
1317
|
+
}
|
|
1318
|
+
break;
|
|
1319
|
+
}
|
|
826
1320
|
default:
|
|
827
1321
|
break;
|
|
828
1322
|
}
|
|
829
1323
|
}
|
|
1324
|
+
const sourceEventsById = new Map(events.map((event) => [event.id, event]));
|
|
830
1325
|
for (const item of items) {
|
|
1326
|
+
const source = sourceEventsById.get(item.id);
|
|
1327
|
+
const canonical = "annotationSource" in item ? item.annotationSource : void 0;
|
|
1328
|
+
item.sourceEvents = [
|
|
1329
|
+
...source ? [{ eventId: source.id, sequence: source.sequence }] : [],
|
|
1330
|
+
...canonical && canonical.eventId !== source?.id ? [{ eventId: canonical.eventId, sequence: canonical.sequence }] : []
|
|
1331
|
+
];
|
|
831
1332
|
if (item.kind === "agent-message") {
|
|
832
1333
|
item.text = stripOpaqueCitationTokens(item.text);
|
|
833
1334
|
}
|
|
@@ -843,6 +1344,93 @@ function realtimeVoiceMessage(payload) {
|
|
|
843
1344
|
}
|
|
844
1345
|
return null;
|
|
845
1346
|
}
|
|
1347
|
+
function humanInputRequestsById(events) {
|
|
1348
|
+
const requests = /* @__PURE__ */ new Map();
|
|
1349
|
+
for (const event of events) {
|
|
1350
|
+
if (event.type !== "session.humanInput.requested") continue;
|
|
1351
|
+
const request = asRecord2(asRecord2(event.payload).request);
|
|
1352
|
+
const requestId = stringValue(request.id);
|
|
1353
|
+
if (requestId) requests.set(requestId, request);
|
|
1354
|
+
}
|
|
1355
|
+
return requests;
|
|
1356
|
+
}
|
|
1357
|
+
function humanInputItemFromResponse(event, payload, requests) {
|
|
1358
|
+
const response = asRecord2(payload.response);
|
|
1359
|
+
const outcome = response.outcome;
|
|
1360
|
+
if (outcome !== "answered" && outcome !== "skipped" && outcome !== "expired" && outcome !== "cancelled") {
|
|
1361
|
+
return null;
|
|
1362
|
+
}
|
|
1363
|
+
const requestId = stringValue(payload.requestId);
|
|
1364
|
+
const request = requests.get(requestId);
|
|
1365
|
+
const questions = humanInputQuestions(request?.questions);
|
|
1366
|
+
const normalizedResponse = outcome === "answered" ? {
|
|
1367
|
+
outcome,
|
|
1368
|
+
answers: Array.isArray(response.answers) ? response.answers.map(asRecord2).map(humanInputAnswer).filter((answer) => answer !== null) : []
|
|
1369
|
+
} : { outcome };
|
|
1370
|
+
const questionsById = new Map(questions.map((question) => [question.id, question]));
|
|
1371
|
+
const answers = normalizedResponse.outcome === "answered" ? normalizedResponse.answers.map(
|
|
1372
|
+
(answer) => humanInputAnswerSummary(answer, questionsById.get(answer.questionId))
|
|
1373
|
+
) : [];
|
|
1374
|
+
return {
|
|
1375
|
+
kind: "human-input",
|
|
1376
|
+
id: event.id,
|
|
1377
|
+
turnId: event.turnId ?? null,
|
|
1378
|
+
requestId,
|
|
1379
|
+
questions,
|
|
1380
|
+
response: normalizedResponse,
|
|
1381
|
+
answers,
|
|
1382
|
+
occurredAt: event.occurredAt
|
|
1383
|
+
};
|
|
1384
|
+
}
|
|
1385
|
+
function humanInputQuestions(value) {
|
|
1386
|
+
if (!Array.isArray(value)) return [];
|
|
1387
|
+
return value.map(asRecord2).flatMap((question) => {
|
|
1388
|
+
const id = stringValue(question.id);
|
|
1389
|
+
const prompt = stringValue(question.prompt);
|
|
1390
|
+
const kind = question.kind;
|
|
1391
|
+
if (!id || !prompt || kind !== "text" && kind !== "single_select" && kind !== "multi_select") {
|
|
1392
|
+
return [];
|
|
1393
|
+
}
|
|
1394
|
+
const options = Array.isArray(question.options) ? question.options.map(asRecord2).flatMap((option) => {
|
|
1395
|
+
const optionId = stringValue(option.id);
|
|
1396
|
+
const label = stringValue(option.label);
|
|
1397
|
+
return optionId && label ? [{ id: optionId, label, description: stringValue(option.description) || null }] : [];
|
|
1398
|
+
}) : [];
|
|
1399
|
+
return [
|
|
1400
|
+
{
|
|
1401
|
+
id,
|
|
1402
|
+
kind,
|
|
1403
|
+
prompt,
|
|
1404
|
+
label: stringValue(question.label) || null,
|
|
1405
|
+
helpText: stringValue(question.helpText) || null,
|
|
1406
|
+
options,
|
|
1407
|
+
required: question.required === true,
|
|
1408
|
+
allowOther: question.allowOther === true
|
|
1409
|
+
}
|
|
1410
|
+
];
|
|
1411
|
+
});
|
|
1412
|
+
}
|
|
1413
|
+
function humanInputAnswer(value) {
|
|
1414
|
+
const questionId = stringValue(value.questionId);
|
|
1415
|
+
if (!questionId) return null;
|
|
1416
|
+
return {
|
|
1417
|
+
questionId,
|
|
1418
|
+
values: Array.isArray(value.values) ? value.values.filter((answer) => typeof answer === "string") : [],
|
|
1419
|
+
...typeof value.other === "string" && value.other ? { other: value.other } : {}
|
|
1420
|
+
};
|
|
1421
|
+
}
|
|
1422
|
+
function humanInputAnswerSummary(answer, question) {
|
|
1423
|
+
const optionLabels = new Map(question?.options.map((option) => [option.id, option.label]) ?? []);
|
|
1424
|
+
const values = answer.values.map((value) => optionLabels.get(value) || value);
|
|
1425
|
+
if (answer.other) values.push(answer.other);
|
|
1426
|
+
const fallbackLabel = answer.questionId.replace(/[_-]+/g, " ").replace(/\b\w/g, (character) => character.toUpperCase());
|
|
1427
|
+
return {
|
|
1428
|
+
questionId: answer.questionId,
|
|
1429
|
+
label: question?.label || question?.prompt || fallbackLabel,
|
|
1430
|
+
prompt: question?.prompt || fallbackLabel,
|
|
1431
|
+
values
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
846
1434
|
function providerNativeToolStatus(rawValue) {
|
|
847
1435
|
const raw = asRecord2(rawValue);
|
|
848
1436
|
if (raw.type !== "hosted_tool_call") {
|
|
@@ -884,7 +1472,9 @@ function mergeToolCallRaw(existingValue, nextValue) {
|
|
|
884
1472
|
function stripOpaqueCitationTokens(text) {
|
|
885
1473
|
return text.replace(/\s*cite(?:[^]+)+/gu, "");
|
|
886
1474
|
}
|
|
1475
|
+
var ALLOWANCE_TURN_END_TEXT = "Usage limit reached";
|
|
887
1476
|
function isCreditExhaustionPayload(payload) {
|
|
1477
|
+
if (payload.code === "allowance_exhausted") return false;
|
|
888
1478
|
return isCreditExhaustion({
|
|
889
1479
|
error: typeof payload.error === "string" ? payload.error : null,
|
|
890
1480
|
detail: typeof payload.detail === "string" ? payload.detail : null,
|
|
@@ -921,14 +1511,17 @@ function isActivityItem(item) {
|
|
|
921
1511
|
case "tool-call":
|
|
922
1512
|
case "worker":
|
|
923
1513
|
case "sandbox":
|
|
1514
|
+
case "startup-phase":
|
|
924
1515
|
case "memory":
|
|
1516
|
+
case "knowledge":
|
|
925
1517
|
case "fleet-decision":
|
|
926
1518
|
return true;
|
|
927
1519
|
default:
|
|
928
1520
|
return false;
|
|
929
1521
|
}
|
|
930
1522
|
}
|
|
931
|
-
function groupTimeline(items) {
|
|
1523
|
+
function groupTimeline(items, options = {}) {
|
|
1524
|
+
if (options.readableTurns || options.foldExchanges) return groupReadableTurns(items);
|
|
932
1525
|
const groups = [];
|
|
933
1526
|
for (const item of items) {
|
|
934
1527
|
if (isActivityItem(item)) {
|
|
@@ -953,21 +1546,293 @@ function groupTimeline(items) {
|
|
|
953
1546
|
}
|
|
954
1547
|
return groups;
|
|
955
1548
|
}
|
|
1549
|
+
function groupReadableTurns(items) {
|
|
1550
|
+
let groups = [];
|
|
1551
|
+
const turns = /* @__PURE__ */ new Map();
|
|
1552
|
+
const seenTurns = /* @__PURE__ */ new Set();
|
|
1553
|
+
const settlements = /* @__PURE__ */ new Map();
|
|
1554
|
+
const compactionTurns = /* @__PURE__ */ new Map();
|
|
1555
|
+
const messages = /* @__PURE__ */ new Map();
|
|
1556
|
+
const inputs = /* @__PURE__ */ new Map();
|
|
1557
|
+
const itemOrder = new Map(items.map((item, index) => [item.id, index]));
|
|
1558
|
+
let legacyTurn = "start";
|
|
1559
|
+
let currentTurn = legacyTurn;
|
|
1560
|
+
for (const item of items) {
|
|
1561
|
+
if (item.kind === "user-message") legacyTurn = item.id;
|
|
1562
|
+
const key = "turnId" in item && item.turnId || legacyTurn;
|
|
1563
|
+
if ("turnId" in item && item.turnId || isActivityItem(item) || item.kind === "agent-message" && item.text.trim()) {
|
|
1564
|
+
if (key !== currentTurn && !seenTurns.has(key)) {
|
|
1565
|
+
const previous = turns.get(currentTurn);
|
|
1566
|
+
if (!settlements.has(currentTurn)) {
|
|
1567
|
+
settlements.set(currentTurn, { endedAt: item.occurredAt });
|
|
1568
|
+
}
|
|
1569
|
+
if (previous?.work && !previous.work.endedAt) previous.work.endedAt = item.occurredAt;
|
|
1570
|
+
currentTurn = key;
|
|
1571
|
+
}
|
|
1572
|
+
seenTurns.add(key);
|
|
1573
|
+
}
|
|
1574
|
+
const workForTurn = () => {
|
|
1575
|
+
let group = turns.get(key);
|
|
1576
|
+
const firstMessage = messages.get(key)?.[0];
|
|
1577
|
+
const messageStart = firstMessage?.startedAt ?? firstMessage?.occurredAt;
|
|
1578
|
+
const startedAt = messageStart && Date.parse(messageStart) < Date.parse(item.occurredAt) ? messageStart : item.occurredAt;
|
|
1579
|
+
if (!group) {
|
|
1580
|
+
const settlement = settlements.get(key);
|
|
1581
|
+
group = {
|
|
1582
|
+
kind: "activity",
|
|
1583
|
+
id: `work-${key}`,
|
|
1584
|
+
items: [],
|
|
1585
|
+
work: { startedAt, details: [] }
|
|
1586
|
+
};
|
|
1587
|
+
if (settlement) {
|
|
1588
|
+
group.work.endedAt = settlement.endedAt;
|
|
1589
|
+
if (settlement.outcome) group.outcome = settlement.outcome;
|
|
1590
|
+
if (settlement.failureText) group.failureText = settlement.failureText;
|
|
1591
|
+
}
|
|
1592
|
+
turns.set(key, group);
|
|
1593
|
+
const firstMessageIndex = settlement && firstMessage ? groups.findIndex((entry) => entry.kind === "item" && entry.item === firstMessage) : -1;
|
|
1594
|
+
if (firstMessageIndex >= 0) groups.splice(firstMessageIndex, 0, group);
|
|
1595
|
+
else groups.push(group);
|
|
1596
|
+
} else if (Date.parse(startedAt) < Date.parse(group.work.startedAt)) {
|
|
1597
|
+
group.work.startedAt = startedAt;
|
|
1598
|
+
}
|
|
1599
|
+
return group;
|
|
1600
|
+
};
|
|
1601
|
+
if (isActivityItem(item)) {
|
|
1602
|
+
const group = workForTurn();
|
|
1603
|
+
group.items.push(item);
|
|
1604
|
+
const previous = group.work.details.at(-1);
|
|
1605
|
+
const preparing = (entry) => entry.kind === "startup-phase" || entry.kind === "reasoning" && !entry.text.trim();
|
|
1606
|
+
if (preparing(item) && previous?.kind === "activity" && previous.items.every(preparing) && previous.items.at(-1) === items[(itemOrder.get(item.id) ?? 0) - 1])
|
|
1607
|
+
previous.items.push(item);
|
|
1608
|
+
else
|
|
1609
|
+
group.work.details.push({ kind: "activity", id: `work-item-${item.id}`, items: [item] });
|
|
1610
|
+
delete group.work.waiting;
|
|
1611
|
+
} else if (item.kind === "turn-end") {
|
|
1612
|
+
if (!item.resumedAt) {
|
|
1613
|
+
settlements.set(key, {
|
|
1614
|
+
endedAt: item.occurredAt,
|
|
1615
|
+
outcome: item.outcome,
|
|
1616
|
+
...item.failureText ? { failureText: item.failureText } : {}
|
|
1617
|
+
});
|
|
1618
|
+
}
|
|
1619
|
+
const group = turns.get(key);
|
|
1620
|
+
if (group?.work) {
|
|
1621
|
+
if (item.resumedAt) {
|
|
1622
|
+
group.work.details.push({
|
|
1623
|
+
kind: "item",
|
|
1624
|
+
item: {
|
|
1625
|
+
kind: "notice",
|
|
1626
|
+
id: item.id,
|
|
1627
|
+
tone: "failed",
|
|
1628
|
+
text: item.failureText ?? "The turn failed before retrying.",
|
|
1629
|
+
occurredAt: item.occurredAt
|
|
1630
|
+
}
|
|
1631
|
+
});
|
|
1632
|
+
continue;
|
|
1633
|
+
}
|
|
1634
|
+
group.outcome = item.outcome;
|
|
1635
|
+
if (item.failureText) group.failureText = item.failureText;
|
|
1636
|
+
group.work.endedAt = item.occurredAt;
|
|
1637
|
+
}
|
|
1638
|
+
} else if (item.kind === "context-compaction" && item.phase === "compacted") {
|
|
1639
|
+
compactionTurns.set(item, key);
|
|
1640
|
+
groups.push({ kind: "item", item });
|
|
1641
|
+
} else if (item.kind === "machine-input-batch" && item.members.every((member) => ROUTINE_MACHINE_INPUT_KINDS.has(member.kind))) {
|
|
1642
|
+
const previous = inputs.get(key);
|
|
1643
|
+
if (previous) {
|
|
1644
|
+
previous.members.push(
|
|
1645
|
+
...item.members.filter((member) => !previous.members.some((old) => old.id === member.id))
|
|
1646
|
+
);
|
|
1647
|
+
previous.sourceEvents = [...previous.sourceEvents ?? [], ...item.sourceEvents ?? []];
|
|
1648
|
+
} else {
|
|
1649
|
+
const batch = { ...item, compact: true, members: [...item.members] };
|
|
1650
|
+
inputs.set(key, batch);
|
|
1651
|
+
groups.push({ kind: "item", item: batch });
|
|
1652
|
+
}
|
|
1653
|
+
} else if (item.kind === "worker-completion" || item.kind === "goal" && item.action === "continuation") {
|
|
1654
|
+
const group = turns.get(currentTurn);
|
|
1655
|
+
if (group?.work) group.work.details.push({ kind: "item", item });
|
|
1656
|
+
else groups.push({ kind: "item", item });
|
|
1657
|
+
} else {
|
|
1658
|
+
const current = turns.get(currentTurn)?.work;
|
|
1659
|
+
const liveApprovalWait = item.kind === "notice" && item.tone === "waiting" && !item.recordedOutcome && !item.resolvedAt && item.text.startsWith("Approval needed") && current !== void 0 && !current.endedAt;
|
|
1660
|
+
const liveStatusWait = item.kind === "session-status" && item.status === "requires_action" && !item.resolvedAt && current !== void 0 && !current.endedAt;
|
|
1661
|
+
if (!liveApprovalWait && !liveStatusWait) groups.push({ kind: "item", item });
|
|
1662
|
+
if (current && !current.endedAt) {
|
|
1663
|
+
if (item.kind === "notice" && item.tone === "waiting" && !item.recordedOutcome && !item.resolvedAt) {
|
|
1664
|
+
current.waiting = {
|
|
1665
|
+
label: item.text.startsWith("Approval needed") ? "Waiting for you" : "Waiting",
|
|
1666
|
+
since: item.occurredAt
|
|
1667
|
+
};
|
|
1668
|
+
} else if (item.kind === "session-status" && item.status === "requires_action" && !item.resolvedAt) {
|
|
1669
|
+
current.waiting = { label: "Waiting for you", since: item.occurredAt };
|
|
1670
|
+
} else if (item.kind === "session-status" && ["paused", "cancelled", "failed"].includes(item.status) && !item.resolvedAt) {
|
|
1671
|
+
current.endedAt = item.occurredAt;
|
|
1672
|
+
delete current.waiting;
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
if (item.kind === "agent-message" && item.text.trim()) {
|
|
1676
|
+
const prose = messages.get(key) ?? [];
|
|
1677
|
+
prose.push(item);
|
|
1678
|
+
messages.set(key, prose);
|
|
1679
|
+
if ((item.phase !== "final_answer" || prose.length > 1) && (turns.has(key) || !settlements.has(key)))
|
|
1680
|
+
workForTurn();
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
groups = groups.filter((entry) => {
|
|
1685
|
+
if (entry.kind !== "item" || entry.item.kind !== "context-compaction") return true;
|
|
1686
|
+
const key = compactionTurns.get(entry.item);
|
|
1687
|
+
const work = key === void 0 ? void 0 : turns.get(key)?.work;
|
|
1688
|
+
if (!work) return true;
|
|
1689
|
+
work.details.push(entry);
|
|
1690
|
+
return false;
|
|
1691
|
+
});
|
|
1692
|
+
const beforeRows = /* @__PURE__ */ new Map();
|
|
1693
|
+
const afterRows = /* @__PURE__ */ new Map();
|
|
1694
|
+
const movedRows = /* @__PURE__ */ new Set();
|
|
1695
|
+
const foldedProse = /* @__PURE__ */ new Set();
|
|
1696
|
+
const positions = /* @__PURE__ */ new Map();
|
|
1697
|
+
const nextBoundary = /* @__PURE__ */ new Map();
|
|
1698
|
+
let boundary = groups.length;
|
|
1699
|
+
for (let index = groups.length - 1; index >= 0; index -= 1) {
|
|
1700
|
+
const entry = groups[index];
|
|
1701
|
+
positions.set(entry.kind === "item" ? entry.item : entry, index);
|
|
1702
|
+
if (entry.kind === "activity" && entry.work) {
|
|
1703
|
+
nextBoundary.set(entry, boundary);
|
|
1704
|
+
boundary = index;
|
|
1705
|
+
} else if (entry.kind === "item" && (entry.item.kind === "user-message" || entry.item.kind === "machine-input-batch")) {
|
|
1706
|
+
boundary = index;
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
for (const [key, group] of turns) {
|
|
1710
|
+
const prose = messages.get(key) ?? [];
|
|
1711
|
+
const settledAt = group.work.endedAt;
|
|
1712
|
+
const responseCandidates = settledAt ? prose.filter(
|
|
1713
|
+
(message) => Date.parse(message.startedAt ?? message.occurredAt) <= Date.parse(settledAt)
|
|
1714
|
+
) : prose;
|
|
1715
|
+
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);
|
|
1716
|
+
if (settledAt) {
|
|
1717
|
+
for (const message of responseCandidates) {
|
|
1718
|
+
if (message === response || message.text.includes("![")) continue;
|
|
1719
|
+
foldedProse.add(message);
|
|
1720
|
+
group.work.details.push({ kind: "item", item: message });
|
|
1721
|
+
}
|
|
1722
|
+
} else {
|
|
1723
|
+
for (const message of prose) {
|
|
1724
|
+
if (message.phase === "final_answer" || message.text.includes("![")) continue;
|
|
1725
|
+
group.work.details.push({ kind: "item", item: message });
|
|
1726
|
+
(group.work.liveNoteIds ??= []).push(message.id);
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
group.work.details.sort((a, b) => {
|
|
1730
|
+
const first = (entry) => entry.kind === "item" ? entry.item.id : entry.kind === "activity" ? entry.items[0]?.id : void 0;
|
|
1731
|
+
return (itemOrder.get(first(a) ?? "") ?? 0) - (itemOrder.get(first(b) ?? "") ?? 0);
|
|
1732
|
+
});
|
|
1733
|
+
if (response) {
|
|
1734
|
+
const responseAt = response.startedAt ?? response.occurredAt;
|
|
1735
|
+
group.work.responseStartedAt = settledAt && Date.parse(responseAt) > Date.parse(settledAt) ? settledAt : responseAt;
|
|
1736
|
+
if (settledAt && (positions.get(response) ?? groups.length) < (nextBoundary.get(group) ?? groups.length)) {
|
|
1737
|
+
beforeRows.set(groups[positions.get(response)], group);
|
|
1738
|
+
movedRows.add(group);
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
if (!settledAt) {
|
|
1742
|
+
const lastProseIndex = Math.max(...prose.map((message) => positions.get(message) ?? -1));
|
|
1743
|
+
let tailIndex = groups.length - 1;
|
|
1744
|
+
for (let index = (positions.get(group) ?? 0) + 1; index <= tailIndex; index += 1) {
|
|
1745
|
+
const entry = groups[index];
|
|
1746
|
+
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"))) {
|
|
1747
|
+
tailIndex = index - 1;
|
|
1748
|
+
break;
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
const tail = groups[tailIndex];
|
|
1752
|
+
if (tail && tail !== group) {
|
|
1753
|
+
afterRows.set(tail, group);
|
|
1754
|
+
movedRows.add(group);
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
return groups.flatMap((group) => {
|
|
1759
|
+
if (group.kind === "activity" && movedRows.has(group)) return [];
|
|
1760
|
+
const hidden = group.kind === "item" && group.item.kind === "agent-message" && foldedProse.has(group.item);
|
|
1761
|
+
const before = beforeRows.get(group);
|
|
1762
|
+
const after = afterRows.get(group);
|
|
1763
|
+
return [...before ? [before] : [], ...hidden ? [] : [group], ...after ? [after] : []];
|
|
1764
|
+
});
|
|
1765
|
+
}
|
|
1766
|
+
var ROUTINE_MACHINE_INPUT_KINDS = /* @__PURE__ */ new Set([
|
|
1767
|
+
"goal_continuation",
|
|
1768
|
+
"background_command_result",
|
|
1769
|
+
"session_wait_timeout",
|
|
1770
|
+
"agent_message",
|
|
1771
|
+
"agent_steer_instruction",
|
|
1772
|
+
"child_terminal_result",
|
|
1773
|
+
"child_requires_action_resolved",
|
|
1774
|
+
"child_paused",
|
|
1775
|
+
"child_waiting_capacity",
|
|
1776
|
+
"child_progress"
|
|
1777
|
+
]);
|
|
1778
|
+
function timelineQuestionPlacement(question, evidence) {
|
|
1779
|
+
const anchors = prescanTurnAnchors([question, ...evidence]);
|
|
1780
|
+
const direct = anchors.directChatSequenceByTrigger.get(question.id);
|
|
1781
|
+
if (direct !== void 0) return { kind: "visible", sequence: direct };
|
|
1782
|
+
if (anchors.cancelledBeforeStartTriggers.has(question.id)) return { kind: "withdrawn" };
|
|
1783
|
+
const start = anchors.startSeqByTrigger.get(question.id);
|
|
1784
|
+
if (start !== void 0) return { kind: "visible", sequence: start };
|
|
1785
|
+
if (anchors.queuedTurnByTrigger.has(question.id) || anchors.explicitQueuedTriggers.has(question.id))
|
|
1786
|
+
return { kind: "pending" };
|
|
1787
|
+
return { kind: "visible", sequence: question.sequence };
|
|
1788
|
+
}
|
|
956
1789
|
function prescanTurnAnchors(events) {
|
|
957
1790
|
const ordered = [...events].sort((a, b) => a.sequence - b.sequence);
|
|
958
1791
|
const queuedTurnByTrigger = /* @__PURE__ */ new Map();
|
|
959
1792
|
const startSeqByTrigger = /* @__PURE__ */ new Map();
|
|
960
1793
|
const cancelledTurnIds = /* @__PURE__ */ new Set();
|
|
1794
|
+
const withdrawnTurnIds = /* @__PURE__ */ new Set();
|
|
961
1795
|
const fallbackSeqByTurn = /* @__PURE__ */ new Map();
|
|
1796
|
+
const directChatSequenceByTrigger = /* @__PURE__ */ new Map();
|
|
1797
|
+
const explicitQueuedTriggers = /* @__PURE__ */ new Set();
|
|
1798
|
+
const queueSteerSequenceByTurn = /* @__PURE__ */ new Map();
|
|
962
1799
|
const startedTurnIds = /* @__PURE__ */ new Set();
|
|
1800
|
+
const userMessageSequenceById = /* @__PURE__ */ new Map();
|
|
963
1801
|
for (const event of ordered) {
|
|
964
1802
|
const payload = asRecord2(event.payload);
|
|
965
1803
|
const turnId = event.turnId ?? null;
|
|
1804
|
+
if (event.type === "user.message") {
|
|
1805
|
+
userMessageSequenceById.set(event.id, event.sequence);
|
|
1806
|
+
if (payload.routing === "queued_for_execution") {
|
|
1807
|
+
explicitQueuedTriggers.add(event.id);
|
|
1808
|
+
} else if (payload.routing === "accepted_for_execution" || payload.routing === "accepted_for_steering") {
|
|
1809
|
+
directChatSequenceByTrigger.set(event.id, event.sequence);
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
if (event.type === "user.message" && payload.delivery === "steer") {
|
|
1813
|
+
directChatSequenceByTrigger.set(event.id, event.sequence);
|
|
1814
|
+
}
|
|
1815
|
+
if (event.type === "session.control.steer_requested") {
|
|
1816
|
+
const targetTurnId = typeof payload.targetTurnId === "string" ? payload.targetTurnId : null;
|
|
1817
|
+
if (targetTurnId && !queueSteerSequenceByTurn.has(targetTurnId)) {
|
|
1818
|
+
queueSteerSequenceByTurn.set(targetTurnId, event.sequence);
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
if (event.type === "session.queue.changed" && (payload.operation === "edit" || payload.operation === "delete")) {
|
|
1822
|
+
const withdrawnTurnId = typeof payload.turnId === "string" ? payload.turnId : turnId ?? null;
|
|
1823
|
+
if (withdrawnTurnId) withdrawnTurnIds.add(withdrawnTurnId);
|
|
1824
|
+
}
|
|
966
1825
|
if (event.type === "turn.queued") {
|
|
967
1826
|
const triggerEventId = typeof payload.triggerEventId === "string" ? payload.triggerEventId : null;
|
|
968
1827
|
const queuedTurnId = typeof payload.turnId === "string" ? payload.turnId : turnId;
|
|
969
1828
|
if (triggerEventId && queuedTurnId) {
|
|
970
1829
|
queuedTurnByTrigger.set(triggerEventId, queuedTurnId);
|
|
1830
|
+
if ((payload.routing === "accepted_for_execution" || payload.routing === "accepted_for_steering") && !directChatSequenceByTrigger.has(triggerEventId)) {
|
|
1831
|
+
directChatSequenceByTrigger.set(
|
|
1832
|
+
triggerEventId,
|
|
1833
|
+
userMessageSequenceById.get(triggerEventId) ?? event.sequence
|
|
1834
|
+
);
|
|
1835
|
+
}
|
|
971
1836
|
}
|
|
972
1837
|
continue;
|
|
973
1838
|
}
|
|
@@ -993,6 +1858,10 @@ function prescanTurnAnchors(events) {
|
|
|
993
1858
|
}
|
|
994
1859
|
}
|
|
995
1860
|
for (const [triggerEventId, turnId] of queuedTurnByTrigger) {
|
|
1861
|
+
const queueSteerSequence = queueSteerSequenceByTurn.get(turnId);
|
|
1862
|
+
if (queueSteerSequence !== void 0) {
|
|
1863
|
+
directChatSequenceByTrigger.set(triggerEventId, queueSteerSequence);
|
|
1864
|
+
}
|
|
996
1865
|
if (!startSeqByTrigger.has(triggerEventId)) {
|
|
997
1866
|
const fallbackSeq = fallbackSeqByTurn.get(turnId);
|
|
998
1867
|
if (fallbackSeq !== void 0) {
|
|
@@ -1002,7 +1871,7 @@ function prescanTurnAnchors(events) {
|
|
|
1002
1871
|
}
|
|
1003
1872
|
const cancelledBeforeStartTriggers = /* @__PURE__ */ new Set();
|
|
1004
1873
|
for (const [triggerEventId, turnId] of queuedTurnByTrigger) {
|
|
1005
|
-
if (cancelledTurnIds.has(turnId) && !startSeqByTrigger.has(triggerEventId) && !fallbackSeqByTurn.has(turnId)) {
|
|
1874
|
+
if ((cancelledTurnIds.has(turnId) || withdrawnTurnIds.has(turnId)) && !startSeqByTrigger.has(triggerEventId) && !fallbackSeqByTurn.has(turnId)) {
|
|
1006
1875
|
cancelledBeforeStartTriggers.add(triggerEventId);
|
|
1007
1876
|
}
|
|
1008
1877
|
}
|
|
@@ -1010,6 +1879,8 @@ function prescanTurnAnchors(events) {
|
|
|
1010
1879
|
queuedTurnByTrigger,
|
|
1011
1880
|
startSeqByTrigger,
|
|
1012
1881
|
cancelledBeforeStartTriggers,
|
|
1882
|
+
directChatSequenceByTrigger,
|
|
1883
|
+
explicitQueuedTriggers,
|
|
1013
1884
|
startedTurnIds
|
|
1014
1885
|
};
|
|
1015
1886
|
}
|
|
@@ -1020,8 +1891,20 @@ function orderTimelineEvents(events, prescan) {
|
|
|
1020
1891
|
if (event.type !== "user.message") {
|
|
1021
1892
|
continue;
|
|
1022
1893
|
}
|
|
1894
|
+
const directChatSequence = prescan.directChatSequenceByTrigger.get(event.id);
|
|
1895
|
+
if (directChatSequence !== void 0) {
|
|
1896
|
+
pushInsertion(insertions, directChatSequence, event);
|
|
1897
|
+
continue;
|
|
1898
|
+
}
|
|
1023
1899
|
const queuedTurnId = prescan.queuedTurnByTrigger.get(event.id);
|
|
1024
1900
|
if (!queuedTurnId) {
|
|
1901
|
+
if (prescan.explicitQueuedTriggers.has(event.id)) {
|
|
1902
|
+
const startSeq2 = prescan.startSeqByTrigger.get(event.id);
|
|
1903
|
+
if (startSeq2 !== void 0) {
|
|
1904
|
+
pushInsertion(insertions, startSeq2, event);
|
|
1905
|
+
}
|
|
1906
|
+
continue;
|
|
1907
|
+
}
|
|
1025
1908
|
pushInsertion(insertions, event.sequence, event);
|
|
1026
1909
|
continue;
|
|
1027
1910
|
}
|
|
@@ -1058,7 +1941,9 @@ function isAgentActivityEvent(type) {
|
|
|
1058
1941
|
return type.startsWith("agent.") || type.startsWith("sandbox.");
|
|
1059
1942
|
}
|
|
1060
1943
|
function isTurnExecutionEvidence(type) {
|
|
1061
|
-
return isAgentActivityEvent(type) || type === "turn.completed" || type === "turn.failed" ||
|
|
1944
|
+
return isAgentActivityEvent(type) || type === "turn.completed" || type === "turn.failed" || // An admission refusal can settle a queued turn before it ever starts:
|
|
1945
|
+
// its prompt still belongs above the "usage limit reached" row.
|
|
1946
|
+
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";
|
|
1062
1947
|
}
|
|
1063
1948
|
function turnEndItem(event, outcome, failureText) {
|
|
1064
1949
|
return {
|
|
@@ -1139,8 +2024,17 @@ function foldSettledTurn(groups, turnEnd) {
|
|
|
1139
2024
|
if (collected.length === 0) {
|
|
1140
2025
|
return;
|
|
1141
2026
|
}
|
|
1142
|
-
const
|
|
1143
|
-
const
|
|
2027
|
+
const collectedLength = collected.length;
|
|
2028
|
+
const waitMessages = turnEnd.preserveWaitResponse ? collected.filter(
|
|
2029
|
+
(group) => group.kind === "item" && group.item.kind === "agent-message" && !group.item.streaming && group.item.text.trim().length > 0 && belongsToTurn(group.item, turnEnd.turnId)
|
|
2030
|
+
) : [];
|
|
2031
|
+
const waitResponse = waitMessages.slice().reverse().find(
|
|
2032
|
+
(group) => group.item.kind === "agent-message" && group.item.phase !== "commentary" && group.item.annotationSource?.eventType === "agent.message.completed"
|
|
2033
|
+
) ?? waitMessages.at(-1);
|
|
2034
|
+
const finalMessage = waitResponse ?? extractFinalAgentMessage(collected, turnEnd);
|
|
2035
|
+
const fallbackMessage = finalMessage || hasOrdinaryFinalAgentMessage(collected, turnEnd) ? null : extractLatestCompletedCommentary(collected, turnEnd);
|
|
2036
|
+
const visibleMessage = finalMessage ?? fallbackMessage;
|
|
2037
|
+
const body = visibleMessage ? collected.filter((group) => group !== visibleMessage) : collected;
|
|
1144
2038
|
if (body.length === 0) {
|
|
1145
2039
|
return;
|
|
1146
2040
|
}
|
|
@@ -1161,12 +2055,12 @@ function foldSettledTurn(groups, turnEnd) {
|
|
|
1161
2055
|
}
|
|
1162
2056
|
groups.splice(
|
|
1163
2057
|
startIndex,
|
|
1164
|
-
|
|
1165
|
-
...
|
|
2058
|
+
collectedLength,
|
|
2059
|
+
...visibleMessage ? [turnGroup, visibleMessage] : [turnGroup]
|
|
1166
2060
|
);
|
|
1167
2061
|
}
|
|
1168
2062
|
function isTurnBoundary(group) {
|
|
1169
|
-
return group?.kind === "turn" || group?.kind === "item" && (group.item.kind === "user-message" || group.item.kind === "
|
|
2063
|
+
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");
|
|
1170
2064
|
}
|
|
1171
2065
|
function belongsToDifferentTurn(group, turnId) {
|
|
1172
2066
|
if (!group || !turnId) {
|
|
@@ -1190,6 +2084,27 @@ function extractFinalAgentMessage(groups, turnEnd) {
|
|
|
1190
2084
|
}
|
|
1191
2085
|
return tail;
|
|
1192
2086
|
}
|
|
2087
|
+
function hasOrdinaryFinalAgentMessage(groups, turnEnd) {
|
|
2088
|
+
return groups.some((group) => {
|
|
2089
|
+
if (group.kind !== "item" || group.item.kind !== "agent-message") return false;
|
|
2090
|
+
const message = group.item;
|
|
2091
|
+
return !message.streaming && message.phase !== "commentary" && message.text.trim().length > 0 && belongsToTurn(message, turnEnd.turnId);
|
|
2092
|
+
});
|
|
2093
|
+
}
|
|
2094
|
+
function extractLatestCompletedCommentary(groups, turnEnd) {
|
|
2095
|
+
for (let index = groups.length - 1; index >= 0; index -= 1) {
|
|
2096
|
+
const group = groups[index];
|
|
2097
|
+
if (group?.kind !== "item" || group.item.kind !== "agent-message") continue;
|
|
2098
|
+
const message = group.item;
|
|
2099
|
+
if (!message.streaming && message.phase === "commentary" && message.text.trim().length > 0 && belongsToTurn(message, turnEnd.turnId)) {
|
|
2100
|
+
return group;
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
return null;
|
|
2104
|
+
}
|
|
2105
|
+
function belongsToTurn(message, turnId) {
|
|
2106
|
+
return !message.turnId || !turnId || message.turnId === turnId;
|
|
2107
|
+
}
|
|
1193
2108
|
function groupStartedAt(group) {
|
|
1194
2109
|
if (!group) {
|
|
1195
2110
|
return void 0;
|
|
@@ -1209,9 +2124,26 @@ function asRecord2(value) {
|
|
|
1209
2124
|
function stringValue(value) {
|
|
1210
2125
|
return typeof value === "string" ? value : "";
|
|
1211
2126
|
}
|
|
2127
|
+
function assistantMessagePhase(value) {
|
|
2128
|
+
return value === "commentary" || value === "final_answer" ? value : void 0;
|
|
2129
|
+
}
|
|
1212
2130
|
function numberOrNull(value) {
|
|
1213
2131
|
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
1214
2132
|
}
|
|
2133
|
+
function compactionProviderRejection(payload) {
|
|
2134
|
+
const record = asRecord2(payload.providerRejection);
|
|
2135
|
+
if (typeof record.httpStatus !== "number" || !Number.isFinite(record.httpStatus)) {
|
|
2136
|
+
return null;
|
|
2137
|
+
}
|
|
2138
|
+
const text = (value) => typeof value === "string" && value.trim() ? value : null;
|
|
2139
|
+
return {
|
|
2140
|
+
httpStatus: record.httpStatus,
|
|
2141
|
+
type: text(record.type),
|
|
2142
|
+
code: text(record.code),
|
|
2143
|
+
param: text(record.param),
|
|
2144
|
+
requestId: text(record.requestId)
|
|
2145
|
+
};
|
|
2146
|
+
}
|
|
1215
2147
|
function compactionTrigger(payload) {
|
|
1216
2148
|
const trigger = payload.trigger;
|
|
1217
2149
|
return trigger === "auto" || trigger === "operator" || trigger === "proactive" || trigger === "overflow" ? trigger : null;
|
|
@@ -1252,10 +2184,17 @@ function machineInputMembers(value) {
|
|
|
1252
2184
|
const kinds = /* @__PURE__ */ new Set([
|
|
1253
2185
|
"scheduled_occurrence",
|
|
1254
2186
|
"goal_continuation",
|
|
2187
|
+
"background_command_result",
|
|
2188
|
+
"session_wait_timeout",
|
|
1255
2189
|
"agent_message",
|
|
1256
2190
|
"agent_steer_instruction",
|
|
1257
2191
|
"child_terminal_result",
|
|
1258
|
-
"media_generation_result"
|
|
2192
|
+
"media_generation_result",
|
|
2193
|
+
"child_requires_action",
|
|
2194
|
+
"child_requires_action_resolved",
|
|
2195
|
+
"child_paused",
|
|
2196
|
+
"child_waiting_capacity",
|
|
2197
|
+
"child_progress"
|
|
1259
2198
|
]);
|
|
1260
2199
|
const classifications = /* @__PURE__ */ new Set([
|
|
1261
2200
|
"success",
|
|
@@ -1288,6 +2227,8 @@ var SESSION_STATUSES = [
|
|
|
1288
2227
|
"running",
|
|
1289
2228
|
"idle",
|
|
1290
2229
|
"requires_action",
|
|
2230
|
+
"recovering",
|
|
2231
|
+
"waiting_capacity",
|
|
1291
2232
|
"failed",
|
|
1292
2233
|
"cancelled"
|
|
1293
2234
|
];
|
|
@@ -1381,6 +2322,7 @@ function findOpenCall(items, callId) {
|
|
|
1381
2322
|
if (byId) {
|
|
1382
2323
|
return byId;
|
|
1383
2324
|
}
|
|
2325
|
+
return void 0;
|
|
1384
2326
|
}
|
|
1385
2327
|
return reversed.find(
|
|
1386
2328
|
(item) => isCall(item) && item.status === "running"
|
|
@@ -1391,14 +2333,41 @@ function findOpenSandbox(items, name) {
|
|
|
1391
2333
|
(item) => item.kind === "sandbox" && item.name === name && item.status === "running"
|
|
1392
2334
|
);
|
|
1393
2335
|
}
|
|
1394
|
-
function
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
2336
|
+
function startupPhaseForSandboxOperation(name) {
|
|
2337
|
+
return SANDBOX_STARTUP_PHASES[name] ?? null;
|
|
2338
|
+
}
|
|
2339
|
+
function startupPhaseFromPayload(value) {
|
|
2340
|
+
return typeof value === "string" && STARTUP_PHASES.has(value) ? value : null;
|
|
2341
|
+
}
|
|
2342
|
+
function startupLifecycleWaitReason(payload) {
|
|
2343
|
+
if (payload.expectedTransition !== true || payload.failureStage !== "lifecycle_wait" || payload.failureCategory !== "drain_capture_wait") {
|
|
2344
|
+
return void 0;
|
|
1400
2345
|
}
|
|
1401
|
-
|
|
2346
|
+
const code = payload.failureCode;
|
|
2347
|
+
return code === "capture_in_progress" || code === "rotation_in_progress" || code === "provider_recovery_in_progress" ? code : void 0;
|
|
2348
|
+
}
|
|
2349
|
+
var SANDBOX_STARTUP_PHASES = {
|
|
2350
|
+
"sandbox.provision": "sandbox",
|
|
2351
|
+
"repository-clone": "repository",
|
|
2352
|
+
"file-resource-download": "files"
|
|
2353
|
+
};
|
|
2354
|
+
var STARTUP_PHASES = /* @__PURE__ */ new Set([
|
|
2355
|
+
"queue",
|
|
2356
|
+
"sandbox",
|
|
2357
|
+
"rig",
|
|
2358
|
+
"repository",
|
|
2359
|
+
"files",
|
|
2360
|
+
"tools",
|
|
2361
|
+
"model_preparation",
|
|
2362
|
+
"provider_first_byte"
|
|
2363
|
+
]);
|
|
2364
|
+
function elapsedDurationMs(startedAt, completedAt) {
|
|
2365
|
+
const start = Date.parse(startedAt);
|
|
2366
|
+
const end = Date.parse(completedAt);
|
|
2367
|
+
return Number.isFinite(start) && Number.isFinite(end) ? Math.max(0, end - start) : null;
|
|
2368
|
+
}
|
|
2369
|
+
function failureMessage(payload) {
|
|
2370
|
+
return presentFailure(payload).reason;
|
|
1402
2371
|
}
|
|
1403
2372
|
function goalText(payload) {
|
|
1404
2373
|
if (typeof payload.text === "string" && payload.text) {
|
|
@@ -1413,11 +2382,20 @@ function goalText(payload) {
|
|
|
1413
2382
|
}
|
|
1414
2383
|
return null;
|
|
1415
2384
|
}
|
|
2385
|
+
function rememberPendingWaitOutcome(pending, event, payload, eventTurnId) {
|
|
2386
|
+
const reason = stringValue(payload.reason).trim();
|
|
2387
|
+
if (!reason) return;
|
|
2388
|
+
const turnId = eventTurnId || stringValue(payload.waitTurnId) || stringValue(payload.turnId) || null;
|
|
2389
|
+
pending.set(turnId, { id: event.id, reason, occurredAt: event.occurredAt });
|
|
2390
|
+
}
|
|
2391
|
+
function waitingOutcomeText(reason) {
|
|
2392
|
+
return /^waiting\b/i.test(reason) ? reason : `Waiting: ${reason}`;
|
|
2393
|
+
}
|
|
1416
2394
|
function shouldSuppressAgentGoalLandmark(type, payload) {
|
|
1417
2395
|
if (type === "goal.completed") {
|
|
1418
2396
|
return true;
|
|
1419
2397
|
}
|
|
1420
|
-
if (type === "goal.set" || type === "goal.updated" || type === "goal.paused") {
|
|
2398
|
+
if (type === "goal.set" || type === "goal.updated" || type === "goal.paused" || type === "goal.held") {
|
|
1421
2399
|
return payload.actor === "agent";
|
|
1422
2400
|
}
|
|
1423
2401
|
return false;
|
|
@@ -1463,7 +2441,7 @@ function capabilityAuthorizationRequest(value) {
|
|
|
1463
2441
|
const kind = record.kind;
|
|
1464
2442
|
const source = record.source;
|
|
1465
2443
|
const action = record.action;
|
|
1466
|
-
if (typeof record.id !== "string" || typeof record.name !== "string" || !["
|
|
2444
|
+
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(
|
|
1467
2445
|
String(source)
|
|
1468
2446
|
) || !["connect", "add_credentials", "enable"].includes(String(action)) || typeof record.rationale !== "string") {
|
|
1469
2447
|
return null;
|
|
@@ -1478,6 +2456,23 @@ function capabilityAuthorizationRequest(value) {
|
|
|
1478
2456
|
requiredVariables: stringList(record.requiredVariables)
|
|
1479
2457
|
};
|
|
1480
2458
|
}
|
|
2459
|
+
function customMcpSetupRequest(value) {
|
|
2460
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
2461
|
+
const input = value;
|
|
2462
|
+
if (input.kind !== "mcp" || typeof input.name !== "string" || typeof input.rationale !== "string" || typeof input.endpointUrl !== "string")
|
|
2463
|
+
return null;
|
|
2464
|
+
try {
|
|
2465
|
+
if (new URL(input.endpointUrl).protocol !== "https:") return null;
|
|
2466
|
+
} catch {
|
|
2467
|
+
return null;
|
|
2468
|
+
}
|
|
2469
|
+
return {
|
|
2470
|
+
kind: "mcp",
|
|
2471
|
+
name: input.name,
|
|
2472
|
+
endpointUrl: input.endpointUrl,
|
|
2473
|
+
rationale: input.rationale
|
|
2474
|
+
};
|
|
2475
|
+
}
|
|
1481
2476
|
function stringList(value) {
|
|
1482
2477
|
return Array.isArray(value) ? value.filter((entry) => typeof entry === "string" && entry.trim().length > 0) : [];
|
|
1483
2478
|
}
|
|
@@ -1596,12 +2591,13 @@ function looksLikeId(value) {
|
|
|
1596
2591
|
}
|
|
1597
2592
|
|
|
1598
2593
|
export {
|
|
1599
|
-
|
|
1600
|
-
toolDisplayName,
|
|
2594
|
+
isTimelineUserQuestion,
|
|
1601
2595
|
buildTimeline,
|
|
1602
2596
|
creditExhaustedFromEvents,
|
|
1603
2597
|
sessionStatusFromEvents,
|
|
1604
2598
|
groupTimeline,
|
|
2599
|
+
timelineQuestionPlacement,
|
|
2600
|
+
isTurnExecutionEvidence,
|
|
1605
2601
|
extractSessionRef
|
|
1606
2602
|
};
|
|
1607
|
-
//# sourceMappingURL=chunk-
|
|
2603
|
+
//# sourceMappingURL=chunk-DO544OSV.js.map
|