@opengeni/react 0.48.0 → 0.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +138 -2
- package/dist/artifacts-document.d.ts +3 -0
- package/dist/artifacts-document.js +17 -0
- package/dist/artifacts-document.js.map +1 -0
- package/dist/artifacts-presentation.d.ts +3 -0
- package/dist/artifacts-presentation.js +17 -0
- package/dist/artifacts-presentation.js.map +1 -0
- package/dist/artifacts-spreadsheet.d.ts +3 -0
- package/dist/artifacts-spreadsheet.js +17 -0
- package/dist/artifacts-spreadsheet.js.map +1 -0
- package/dist/artifacts.d.ts +2 -0
- package/dist/artifacts.js +199 -0
- package/dist/artifacts.js.map +1 -0
- package/dist/{chunk-NJ7M2B6Z.js → chunk-5UQPNLIO.js} +16 -8
- package/dist/{chunk-NJ7M2B6Z.js.map → chunk-5UQPNLIO.js.map} +1 -1
- package/dist/{chunk-LHLYWG5R.js → chunk-6KLX2RH5.js} +461 -38
- package/dist/chunk-6KLX2RH5.js.map +1 -0
- package/dist/chunk-7WCLAEFV.js +2828 -0
- package/dist/chunk-7WCLAEFV.js.map +1 -0
- package/dist/{chunk-I4MPFDRP.js → chunk-B6WPZSTT.js} +104 -104
- package/dist/{chunk-I4MPFDRP.js.map → chunk-B6WPZSTT.js.map} +1 -1
- package/dist/{chunk-EKZH6IDG.js → chunk-C5ZPSSS5.js} +111 -1
- package/dist/chunk-C5ZPSSS5.js.map +1 -0
- package/dist/{chunk-OL6QVXGF.js → chunk-HA46CYQK.js} +152 -8
- package/dist/chunk-HA46CYQK.js.map +1 -0
- package/dist/chunk-HUIKIDM5.js +2148 -0
- package/dist/chunk-HUIKIDM5.js.map +1 -0
- package/dist/{chunk-FWXGSNXT.js → chunk-IGC6A2ZI.js} +585 -34
- package/dist/chunk-IGC6A2ZI.js.map +1 -0
- package/dist/chunk-JVYQRRC4.js +53 -0
- package/dist/chunk-JVYQRRC4.js.map +1 -0
- package/dist/chunk-KCGXPP5V.js +157 -0
- package/dist/chunk-KCGXPP5V.js.map +1 -0
- package/dist/chunk-LLOLUHVG.js +5937 -0
- package/dist/chunk-LLOLUHVG.js.map +1 -0
- package/dist/{chunk-WYA65Y3F.js → chunk-MKPIAGVL.js} +13 -3
- package/dist/chunk-MKPIAGVL.js.map +1 -0
- package/dist/chunk-PEI6RANI.js +3234 -0
- package/dist/chunk-PEI6RANI.js.map +1 -0
- package/dist/chunk-R3AZOAB5.js +933 -0
- package/dist/chunk-R3AZOAB5.js.map +1 -0
- package/dist/{chunk-O4VXOBGF.js → chunk-WSK7G5LE.js} +70 -2
- package/dist/chunk-WSK7G5LE.js.map +1 -0
- package/dist/{chunk-23EJ676W.js → chunk-XBZWOM2K.js} +9 -4
- package/dist/chunk-XBZWOM2K.js.map +1 -0
- package/dist/{chunk-XCNTXWBB.js → chunk-Y7OEDUJ5.js} +856 -338
- package/dist/chunk-Y7OEDUJ5.js.map +1 -0
- package/dist/client.d.ts +10 -2
- package/dist/clipboard.d.ts +1 -0
- package/dist/clipboard.js +7 -0
- package/dist/clipboard.js.map +1 -0
- package/dist/commands/index.d.ts +3 -3
- package/dist/commands/registry.d.ts +1 -1
- package/dist/commands/types.d.ts +1 -1
- package/dist/components/approval-surface.d.ts +2 -2
- package/dist/components/artifacts/artifact-surface.d.ts +18 -0
- package/dist/components/artifacts/document-editor.d.ts +172 -0
- package/dist/components/artifacts/editable-artifact-ui.d.ts +13 -0
- package/dist/components/artifacts/editable-artifact-workbench.d.ts +49 -0
- package/dist/components/artifacts/editable-document.d.ts +24 -0
- package/dist/components/artifacts/editable-presentation.d.ts +24 -0
- package/dist/components/artifacts/editable-spreadsheet.d.ts +32 -0
- package/dist/components/artifacts/index.d.ts +9 -0
- package/dist/components/artifacts/presentation-editor.d.ts +297 -0
- package/dist/components/artifacts/published-html-artifact-frame.d.ts +14 -0
- package/dist/components/artifacts/spreadsheet-canvas.d.ts +120 -0
- package/dist/components/artifacts/spreadsheet-grid.d.ts +113 -0
- package/dist/components/browser-input.d.ts +7 -0
- package/dist/components/browser-viewer.d.ts +30 -0
- package/dist/components/chat-composer.d.ts +8 -8
- package/dist/components/code-editor.d.ts +25 -3
- package/dist/components/command-palette.d.ts +2 -2
- package/dist/components/composer-transcription-control.d.ts +2 -2
- package/dist/components/composer.d.ts +17 -17
- package/dist/components/computer-viewer.d.ts +24 -0
- package/dist/components/copy-button.d.ts +2 -2
- package/dist/components/desktop-viewer.d.ts +50 -22
- package/dist/components/diff-view.d.ts +1 -1
- package/dist/components/enrollment-consent.d.ts +1 -1
- package/dist/components/enrollment-device-flow.d.ts +1 -1
- package/dist/components/file-browser.d.ts +2 -2
- package/dist/components/fleet-tile.d.ts +1 -1
- package/dist/components/generated-video-player.d.ts +10 -0
- package/dist/components/human-input-form.d.ts +1 -1
- package/dist/components/human-input-surface.d.ts +2 -2
- package/dist/components/interaction-intervention-banner.d.ts +11 -0
- package/dist/components/interactive-workbench-viewers.d.ts +2 -0
- package/dist/components/machine-card.d.ts +2 -2
- package/dist/components/machine-dock-bar.d.ts +3 -3
- package/dist/components/machine-health-pill.d.ts +2 -2
- package/dist/components/machine-input-display.d.ts +1 -1
- package/dist/components/machine-metrics.d.ts +2 -2
- package/dist/components/machine-status-pill.d.ts +4 -4
- package/dist/components/machines/health.d.ts +1 -1
- package/dist/components/machines/machine-detail.d.ts +3 -3
- package/dist/components/machines/metric-history-chart.d.ts +1 -1
- package/dist/components/machines/metric-sparkline.d.ts +2 -2
- package/dist/components/machines/series.d.ts +2 -2
- package/dist/components/machines-dashboard.d.ts +2 -2
- package/dist/components/markdown.d.ts +1 -1
- package/dist/components/message-timeline.d.ts +12 -5
- package/dist/components/model-picker.d.ts +2 -2
- package/dist/components/model-policy-picker.d.ts +7 -7
- package/dist/components/pierre-diff.d.ts +1 -1
- package/dist/components/pierre-file.d.ts +1 -1
- package/dist/components/queue-draft-policy.d.ts +1 -1
- package/dist/components/queue-surface-implementation.d.ts +3 -3
- package/dist/components/queue-surface-state.d.ts +4 -4
- package/dist/components/queue-surface.d.ts +5 -5
- package/dist/components/sandbox-files.d.ts +3 -3
- package/dist/components/sandbox-terminal.d.ts +24 -4
- package/dist/components/sandbox-workspace.d.ts +28 -9
- package/dist/components/session-chrome.d.ts +4 -4
- package/dist/components/session-status.d.ts +2 -2
- package/dist/components/timeline-annotation-selection.d.ts +9 -0
- package/dist/components/timeline-annotations-dialog.d.ts +16 -0
- package/dist/components/timeline-annotations.d.ts +13 -0
- package/dist/components/tooltip.d.ts +4 -4
- package/dist/components/user-message-body.d.ts +2 -2
- package/dist/components/workbench-changes.d.ts +2 -2
- package/dist/components/workspace-dock.d.ts +1 -1
- package/dist/composer.d.ts +11 -11
- package/dist/composer.js +7 -7
- package/dist/hooks/internal.d.ts +1 -1
- package/dist/hooks/use-attached-browsers.d.ts +21 -0
- package/dist/hooks/use-auth-runs.d.ts +32 -0
- package/dist/hooks/use-available-models.d.ts +2 -2
- package/dist/hooks/use-billing-usage.d.ts +1 -1
- package/dist/hooks/use-browser-downloads.d.ts +25 -0
- package/dist/hooks/use-browser-frame-stream.d.ts +28 -0
- package/dist/hooks/use-browser-identities.d.ts +30 -0
- package/dist/hooks/use-browser-session.d.ts +29 -0
- package/dist/hooks/use-browser-sessions.d.ts +32 -0
- package/dist/hooks/use-channels.d.ts +26 -0
- package/dist/hooks/use-codex-accounts.d.ts +2 -2
- package/dist/hooks/use-composer.d.ts +36 -9
- package/dist/hooks/use-computer-frame-stream.d.ts +24 -0
- package/dist/hooks/use-computer-session.d.ts +29 -0
- package/dist/hooks/use-computer-sessions.d.ts +28 -0
- package/dist/hooks/use-desktop-stream.d.ts +5 -1
- package/dist/hooks/use-environments.d.ts +1 -1
- package/dist/hooks/use-file-attachments.d.ts +1 -1
- package/dist/hooks/use-goal.d.ts +2 -2
- package/dist/hooks/use-human-input.d.ts +2 -2
- package/dist/hooks/use-interaction-interventions.d.ts +27 -0
- package/dist/hooks/use-interaction-invalidation.d.ts +19 -0
- package/dist/hooks/use-last-started-turn-policy.d.ts +2 -2
- package/dist/hooks/use-machine-chip.d.ts +2 -2
- package/dist/hooks/use-machines.d.ts +4 -4
- package/dist/hooks/use-network-routes.d.ts +25 -0
- package/dist/hooks/use-packs.d.ts +7 -2
- package/dist/hooks/use-rigs.d.ts +1 -1
- package/dist/hooks/use-sandbox-files.d.ts +6 -4
- package/dist/hooks/use-sandbox-git.d.ts +6 -5
- package/dist/hooks/use-sandbox-terminal.d.ts +1 -1
- package/dist/hooks/use-scheduled-tasks.d.ts +1 -1
- package/dist/hooks/use-session-capabilities.d.ts +5 -4
- package/dist/hooks/use-session-control.d.ts +1 -1
- package/dist/hooks/use-session-events.d.ts +2 -2
- package/dist/hooks/use-session-lineage.d.ts +1 -1
- package/dist/hooks/use-session-mcp-approval-policy.d.ts +2 -2
- package/dist/hooks/use-session.d.ts +2 -2
- package/dist/hooks/use-site-auth-connections.d.ts +25 -0
- package/dist/hooks/use-slash-commands.d.ts +1 -1
- package/dist/hooks/use-supergrok-accounts.d.ts +26 -0
- package/dist/hooks/use-terminal-stream.d.ts +11 -2
- package/dist/hooks/use-turn-queue.d.ts +2 -2
- package/dist/hooks/use-video-artifact-playback.d.ts +9 -0
- package/dist/hooks/use-voice-input.d.ts +1 -1
- package/dist/hooks/use-workspace-capture.d.ts +1 -1
- package/dist/hooks/use-workspace-edit.d.ts +1 -1
- package/dist/hooks/use-workspace-sessions.d.ts +1 -1
- package/dist/hooks/use-workspaces.d.ts +1 -1
- package/dist/index.d.ts +162 -155
- package/dist/index.js +1822 -1703
- package/dist/index.js.map +1 -1
- package/dist/interaction.d.ts +33 -0
- package/dist/interaction.js +550 -0
- package/dist/interaction.js.map +1 -0
- package/dist/interactive-workbench-viewers-TOHBXJEE.js +15 -0
- package/dist/interactive-workbench-viewers-TOHBXJEE.js.map +1 -0
- package/dist/lib/host-platform.d.ts +5 -0
- package/dist/lib/relay-wire.d.ts +24 -1
- package/dist/lib/sandbox-liveness.d.ts +9 -0
- package/dist/lib/terminal-capability.d.ts +5 -0
- package/dist/lib/xterm-theme.d.ts +1 -1
- package/dist/machines.d.ts +30 -30
- package/dist/machines.js +2 -2
- package/dist/model-policy.d.ts +1 -1
- package/dist/model-policy.js +1 -1
- package/dist/provider.d.ts +6 -5
- package/dist/{queue-surface-implementation-U5JFG7HT.js → queue-surface-implementation-2KVJTYXH.js} +100 -48
- package/dist/queue-surface-implementation-2KVJTYXH.js.map +1 -0
- package/dist/realtime/dropdown-menu.d.ts +8 -8
- package/dist/realtime/realtime-control.d.ts +8 -8
- package/dist/realtime.d.ts +4 -4
- package/dist/realtime.js +38 -11
- package/dist/realtime.js.map +1 -1
- package/dist/session-context.d.ts +28 -2
- package/dist/session-ui.d.ts +14 -14
- package/dist/session-ui.js +5 -4
- package/dist/session.d.ts +28 -28
- package/dist/session.js +10 -10
- package/dist/timeline/activity-rail.d.ts +5 -3
- package/dist/timeline/disclosure-context.d.ts +1 -1
- package/dist/timeline/fleet-decision-projection.d.ts +1 -1
- package/dist/timeline/fleet-decision-row.d.ts +3 -3
- package/dist/timeline/index.d.ts +19 -19
- package/dist/timeline/parsers.d.ts +4 -1
- package/dist/timeline/projection.d.ts +3 -3
- package/dist/timeline/registry.d.ts +8 -2
- package/dist/timeline/screenshot-lightbox.d.ts +2 -2
- package/dist/timeline/shared.d.ts +21 -10
- package/dist/timeline/tool-diff.d.ts +2 -2
- package/dist/timeline/tool-renderers.d.ts +1 -1
- package/dist/timeline/turn-summary.d.ts +3 -3
- package/dist/timeline/types.d.ts +44 -3
- package/dist/timeline-annotation-selection-3L7LHGG2.js +187 -0
- package/dist/timeline-annotation-selection-3L7LHGG2.js.map +1 -0
- package/dist/timeline-annotations-dialog-U7EVLR75.js +196 -0
- package/dist/timeline-annotations-dialog-U7EVLR75.js.map +1 -0
- package/package.json +36 -7
- package/src/artifacts-document.ts +31 -0
- package/src/artifacts-presentation.ts +36 -0
- package/src/artifacts-spreadsheet.ts +21 -0
- package/src/artifacts.ts +89 -0
- package/src/client.ts +157 -1
- package/src/clipboard.ts +2 -0
- package/src/components/artifacts/artifact-surface.tsx +93 -0
- package/src/components/artifacts/document-editor.tsx +2255 -0
- package/src/components/artifacts/editable-artifact-ui.tsx +89 -0
- package/src/components/artifacts/editable-artifact-workbench.tsx +203 -0
- package/src/components/artifacts/editable-document.tsx +657 -0
- package/src/components/artifacts/editable-presentation.tsx +1020 -0
- package/src/components/artifacts/editable-spreadsheet.tsx +733 -0
- package/src/components/artifacts/index.ts +104 -0
- package/src/components/artifacts/presentation-editor.tsx +3148 -0
- package/src/components/artifacts/published-html-artifact-frame.tsx +38 -0
- package/src/components/artifacts/spreadsheet-canvas.ts +799 -0
- package/src/components/artifacts/spreadsheet-grid.tsx +2129 -0
- package/src/components/browser-input.ts +65 -0
- package/src/components/browser-viewer.tsx +2702 -0
- package/src/components/chat-composer.tsx +13 -0
- package/src/components/code-editor.tsx +89 -30
- package/src/components/composer-transcription-control.tsx +10 -6
- package/src/components/computer-viewer.tsx +1636 -0
- package/src/components/desktop-viewer.tsx +215 -74
- package/src/components/generated-video-player.tsx +89 -0
- package/src/components/interaction-intervention-banner.tsx +99 -0
- package/src/components/interactive-workbench-viewers.ts +2 -0
- package/src/components/machine-input-display.ts +3 -0
- package/src/components/machines/machine-detail.tsx +1 -1
- package/src/components/message-timeline.tsx +289 -32
- package/src/components/model-policy-picker.tsx +15 -0
- package/src/components/queue-surface-implementation.tsx +116 -60
- package/src/components/sandbox-files.tsx +2 -2
- package/src/components/sandbox-terminal.tsx +128 -46
- package/src/components/sandbox-workspace.tsx +256 -90
- package/src/components/session-chrome.tsx +53 -13
- package/src/components/timeline-annotation-selection.tsx +221 -0
- package/src/components/timeline-annotations-dialog.tsx +213 -0
- package/src/components/timeline-annotations.tsx +84 -0
- package/src/components/workbench-changes.tsx +188 -31
- package/src/components/workspace-dock.tsx +59 -5
- package/src/hooks/use-attached-browsers.ts +154 -0
- package/src/hooks/use-auth-runs.ts +278 -0
- package/src/hooks/use-browser-downloads.ts +218 -0
- package/src/hooks/use-browser-frame-stream.ts +425 -0
- package/src/hooks/use-browser-identities.ts +266 -0
- package/src/hooks/use-browser-session.ts +543 -0
- package/src/hooks/use-browser-sessions.ts +286 -0
- package/src/hooks/use-channels.ts +99 -0
- package/src/hooks/use-composer.ts +769 -24
- package/src/hooks/use-computer-frame-stream.ts +434 -0
- package/src/hooks/use-computer-session.ts +462 -0
- package/src/hooks/use-computer-sessions.ts +251 -0
- package/src/hooks/use-desktop-stream.ts +39 -7
- package/src/hooks/use-interaction-interventions.ts +242 -0
- package/src/hooks/use-interaction-invalidation.ts +66 -0
- package/src/hooks/use-machine-chip.ts +15 -3
- package/src/hooks/use-machines.ts +33 -3
- package/src/hooks/use-network-routes.ts +214 -0
- package/src/hooks/use-packs.ts +51 -0
- package/src/hooks/use-sandbox-files.ts +98 -55
- package/src/hooks/use-sandbox-git.ts +93 -38
- package/src/hooks/use-sandbox-terminal.ts +3 -2
- package/src/hooks/use-session-capabilities.ts +59 -46
- package/src/hooks/use-site-auth-connections.ts +226 -0
- package/src/hooks/use-supergrok-accounts.ts +81 -0
- package/src/hooks/use-terminal-stream.ts +359 -47
- package/src/hooks/use-video-artifact-playback.ts +28 -0
- package/src/hooks/use-workspace-edit.ts +2 -1
- package/src/index.ts +18 -0
- package/src/interaction.ts +101 -0
- package/src/lib/host-platform.ts +10 -0
- package/src/lib/relay-wire.ts +47 -4
- package/src/lib/sandbox-liveness.ts +11 -0
- package/src/lib/terminal-capability.ts +10 -0
- package/src/model-policy.ts +19 -4
- package/src/provider.tsx +133 -1
- package/src/realtime/realtime-control.tsx +34 -6
- package/src/session-context.ts +156 -1
- package/src/timeline/activity-rail.tsx +25 -3
- package/src/timeline/index.ts +3 -0
- package/src/timeline/parsers.ts +14 -1
- package/src/timeline/projection.ts +269 -14
- package/src/timeline/registry.ts +13 -1
- package/src/timeline/screenshot-lightbox.tsx +19 -9
- package/src/timeline/shared.tsx +56 -8
- package/src/timeline/tool-renderers.tsx +303 -50
- package/src/timeline/types.ts +57 -3
- package/styles/compiled.css +312 -21
- package/styles/index.css +15 -0
- package/styles/responsive.css +13 -1
- package/dist/chunk-23EJ676W.js.map +0 -1
- package/dist/chunk-EKZH6IDG.js.map +0 -1
- package/dist/chunk-FWXGSNXT.js.map +0 -1
- package/dist/chunk-LHLYWG5R.js.map +0 -1
- package/dist/chunk-O4VXOBGF.js.map +0 -1
- package/dist/chunk-OL6QVXGF.js.map +0 -1
- package/dist/chunk-WYA65Y3F.js.map +0 -1
- package/dist/chunk-XCNTXWBB.js.map +0 -1
- package/dist/fleet-decision-projection-SLNZMS42.js +0 -241
- package/dist/fleet-decision-projection-SLNZMS42.js.map +0 -1
- package/dist/queue-surface-implementation-U5JFG7HT.js.map +0 -1
|
@@ -22,10 +22,290 @@ function toolDisplayName(name) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// src/timeline/projection.ts
|
|
25
|
-
|
|
25
|
+
import {
|
|
26
|
+
parseMediaGenerationResult
|
|
27
|
+
} from "@opengeni/sdk";
|
|
28
|
+
|
|
29
|
+
// src/timeline/fleet-decision-projection.ts
|
|
30
|
+
var FLEET_ACTUAL_OUTCOMES = ["selected", "waiting", "none"];
|
|
31
|
+
var FLEET_ACTUAL_REASONS = [
|
|
32
|
+
"lease_reused",
|
|
33
|
+
"pin",
|
|
34
|
+
"rotation",
|
|
35
|
+
"active",
|
|
36
|
+
"all_capped",
|
|
37
|
+
"none"
|
|
38
|
+
];
|
|
39
|
+
var FLEET_SHADOW_OUTCOMES = ["selected", "paced", "none"];
|
|
40
|
+
var FLEET_SHADOW_REASONS = [
|
|
41
|
+
"fenced_in_flight",
|
|
42
|
+
"fenced_candidate_missing",
|
|
43
|
+
"admission_paced",
|
|
44
|
+
"no_eligible_candidate",
|
|
45
|
+
"overlay_isolated_empty",
|
|
46
|
+
"best_score",
|
|
47
|
+
"affinity_best",
|
|
48
|
+
"hysteresis_hold"
|
|
49
|
+
];
|
|
50
|
+
var FLEET_COMPARISONS = [
|
|
51
|
+
"match",
|
|
52
|
+
"different_candidate",
|
|
53
|
+
"different_outcome",
|
|
54
|
+
"not_comparable_truncated"
|
|
55
|
+
];
|
|
56
|
+
var FLEET_CONFIDENCES = ["unknown", "low", "medium", "high"];
|
|
57
|
+
var FLEET_ADMISSION_OUTCOMES = ["admit", "pace"];
|
|
58
|
+
var FLEET_ADMISSION_REASONS = [
|
|
59
|
+
"fenced_in_flight",
|
|
60
|
+
"pacing_disabled",
|
|
61
|
+
"capacity_unknown",
|
|
62
|
+
"capacity_available",
|
|
63
|
+
"work_conserving_borrow",
|
|
64
|
+
"manager_priority",
|
|
65
|
+
"standard_starvation_bound",
|
|
66
|
+
"capacity_saturated",
|
|
67
|
+
"emergency_fuse"
|
|
68
|
+
];
|
|
69
|
+
var FLEET_ADMISSION_REASON_CLASSIFICATION = {
|
|
70
|
+
fenced_in_flight: "admit",
|
|
71
|
+
pacing_disabled: "admit",
|
|
72
|
+
capacity_unknown: "admit",
|
|
73
|
+
capacity_available: "admit",
|
|
74
|
+
work_conserving_borrow: "admit",
|
|
75
|
+
manager_priority: "pace",
|
|
76
|
+
standard_starvation_bound: "admit",
|
|
77
|
+
capacity_saturated: "pace",
|
|
78
|
+
emergency_fuse: "pace"
|
|
79
|
+
};
|
|
80
|
+
var FLEET_REJECTION_REASONS = [
|
|
81
|
+
"allocator_disabled",
|
|
82
|
+
"unavailable",
|
|
83
|
+
"cooling",
|
|
84
|
+
"quota_ceiling",
|
|
85
|
+
"overlay_isolation"
|
|
86
|
+
];
|
|
87
|
+
var FLEET_MAX_CANDIDATES = 32;
|
|
88
|
+
var FLEET_MAX_COUNT = 1e6;
|
|
89
|
+
function fleetDecisionItem(event, payload) {
|
|
90
|
+
const actual = asRecord(payload.actual);
|
|
91
|
+
const replay = asRecord(payload.replay);
|
|
92
|
+
const input = asRecord(replay.input);
|
|
93
|
+
const decision = asRecord(replay.decision);
|
|
94
|
+
const admission = asRecord(decision.admission);
|
|
95
|
+
if (payload.schemaVersion !== 1 || payload.mode !== "shadow" || replay.schemaVersion !== 1 || replay.mode !== "shadow" || replay.policyVersion !== "adaptive-shadow-v1") {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
const actualOutcome = fleetEnum(actual.outcome, FLEET_ACTUAL_OUTCOMES);
|
|
99
|
+
const actualReason = fleetEnum(actual.reason, FLEET_ACTUAL_REASONS);
|
|
100
|
+
const shadowOutcome = fleetEnum(decision.outcome, FLEET_SHADOW_OUTCOMES);
|
|
101
|
+
const shadowReason = fleetEnum(decision.reason, FLEET_SHADOW_REASONS);
|
|
102
|
+
const comparison = fleetEnum(payload.comparison, FLEET_COMPARISONS);
|
|
103
|
+
const confidence = fleetEnum(decision.confidence, FLEET_CONFIDENCES);
|
|
104
|
+
const admissionOutcome = fleetEnum(admission.outcome, FLEET_ADMISSION_OUTCOMES);
|
|
105
|
+
const admissionReason = fleetEnum(admission.reason, FLEET_ADMISSION_REASONS);
|
|
106
|
+
if (!actualOutcome || !actualReason || !shadowOutcome || !shadowReason || !comparison || !confidence || !admissionOutcome || !admissionReason) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
if (typeof admission.borrowedIdleCapacity !== "boolean" || typeof decision.borrowedOverlayCapacity !== "boolean") {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
const actualCandidateKey = fleetCandidateKey(actual.candidateKey);
|
|
113
|
+
const shadowCandidateKey = fleetCandidateKey(decision.selectedCandidateKey);
|
|
114
|
+
if (actualCandidateKey === void 0 || shadowCandidateKey === void 0) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
if (actualOutcome === "selected" !== (actualCandidateKey !== null) || shadowOutcome === "selected" !== (shadowCandidateKey !== null)) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
const candidates = input.candidates;
|
|
121
|
+
if (!Array.isArray(candidates) || candidates.length > FLEET_MAX_CANDIDATES) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
const candidateKeys = /* @__PURE__ */ new Set();
|
|
125
|
+
for (const candidate of candidates) {
|
|
126
|
+
const key = asRecord(candidate).key;
|
|
127
|
+
if (!isFleetCandidateAlias(key) || candidateKeys.has(key)) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
candidateKeys.add(key);
|
|
131
|
+
}
|
|
132
|
+
const truncatedCandidateCount = fleetCount(replay.truncatedCandidateCount);
|
|
133
|
+
const strandedEligibleCount = fleetCount(decision.strandedEligibleCount);
|
|
134
|
+
if (truncatedCandidateCount === null || strandedEligibleCount === null || strandedEligibleCount > candidates.length || !fleetDecisionSemanticsAreConsistent({
|
|
135
|
+
actualOutcome,
|
|
136
|
+
actualReason,
|
|
137
|
+
shadowOutcome,
|
|
138
|
+
shadowReason,
|
|
139
|
+
admissionOutcome,
|
|
140
|
+
admissionReason,
|
|
141
|
+
borrowedIdleCapacity: admission.borrowedIdleCapacity,
|
|
142
|
+
borrowedOverlayCapacity: decision.borrowedOverlayCapacity,
|
|
143
|
+
strandedEligibleCount
|
|
144
|
+
})) {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
if (shadowCandidateKey !== null && !candidateKeys.has(shadowCandidateKey)) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
if (actualCandidateKey !== null && !candidateKeys.has(actualCandidateKey) && !(comparison === "not_comparable_truncated" && truncatedCandidateCount > 0)) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
if (comparison === "not_comparable_truncated" && (truncatedCandidateCount === 0 || actualCandidateKey === null || candidateKeys.has(actualCandidateKey))) {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
if (!fleetComparisonIsConsistent(
|
|
157
|
+
comparison,
|
|
158
|
+
actualOutcome,
|
|
159
|
+
actualCandidateKey,
|
|
160
|
+
shadowOutcome,
|
|
161
|
+
shadowCandidateKey
|
|
162
|
+
)) {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
const rawScores = decision.scores;
|
|
166
|
+
if (!Array.isArray(rawScores)) {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
const scores = [];
|
|
170
|
+
const scoreKeys = /* @__PURE__ */ new Set();
|
|
171
|
+
for (const value of rawScores.slice(0, FLEET_MAX_CANDIDATES)) {
|
|
172
|
+
const score = asRecord(value);
|
|
173
|
+
const candidateKey = score.candidateKey;
|
|
174
|
+
const parsedRejectionReason = score.rejectionReason === null ? null : fleetEnum(score.rejectionReason, FLEET_REJECTION_REASONS);
|
|
175
|
+
if (score.rejectionReason !== null && parsedRejectionReason === null) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
const rejectionReason = parsedRejectionReason;
|
|
179
|
+
const total = fleetFiniteNumber(score.total);
|
|
180
|
+
const scoreConfidence = fleetEnum(score.confidence, FLEET_CONFIDENCES);
|
|
181
|
+
if (!isFleetCandidateAlias(candidateKey) || !candidateKeys.has(candidateKey) || scoreKeys.has(candidateKey) || typeof score.eligible !== "boolean" || total === null || !scoreConfidence || (score.eligible ? rejectionReason !== null : rejectionReason === null)) {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
scoreKeys.add(candidateKey);
|
|
185
|
+
scores.push({
|
|
186
|
+
candidateKey,
|
|
187
|
+
eligible: score.eligible,
|
|
188
|
+
rejectionReason,
|
|
189
|
+
total,
|
|
190
|
+
confidence: scoreConfidence
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
if (shadowCandidateKey !== null && !scoreKeys.has(shadowCandidateKey)) {
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
return {
|
|
197
|
+
kind: "fleet-decision",
|
|
198
|
+
id: event.id,
|
|
199
|
+
turnId: event.turnId ?? null,
|
|
200
|
+
policyVersion: "adaptive-shadow-v1",
|
|
201
|
+
actualOutcome,
|
|
202
|
+
actualCandidateKey,
|
|
203
|
+
actualReason,
|
|
204
|
+
shadowOutcome,
|
|
205
|
+
shadowCandidateKey,
|
|
206
|
+
shadowReason,
|
|
207
|
+
comparison,
|
|
208
|
+
confidence,
|
|
209
|
+
admissionOutcome,
|
|
210
|
+
admissionReason,
|
|
211
|
+
borrowedIdleCapacity: admission.borrowedIdleCapacity,
|
|
212
|
+
borrowedOverlayCapacity: decision.borrowedOverlayCapacity,
|
|
213
|
+
strandedEligibleCount,
|
|
214
|
+
candidateCount: candidates.length,
|
|
215
|
+
truncatedCandidateCount,
|
|
216
|
+
scoreRowsTruncatedCount: Math.max(0, rawScores.length - FLEET_MAX_CANDIDATES),
|
|
217
|
+
scores,
|
|
218
|
+
occurredAt: event.occurredAt
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
function fleetEnum(value, values) {
|
|
222
|
+
return typeof value === "string" && values.includes(value) ? value : null;
|
|
223
|
+
}
|
|
224
|
+
function isFleetCandidateAlias(value) {
|
|
225
|
+
return typeof value === "string" && /^c[0-9a-z]{2}$/.test(value);
|
|
226
|
+
}
|
|
227
|
+
function fleetCandidateKey(value) {
|
|
228
|
+
return value === null ? null : isFleetCandidateAlias(value) ? value : void 0;
|
|
229
|
+
}
|
|
230
|
+
function fleetCount(value) {
|
|
231
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 && value <= FLEET_MAX_COUNT ? value : null;
|
|
232
|
+
}
|
|
233
|
+
function fleetFiniteNumber(value) {
|
|
234
|
+
return typeof value === "number" && Number.isFinite(value) && Math.abs(value) <= Number.MAX_SAFE_INTEGER ? value : null;
|
|
235
|
+
}
|
|
236
|
+
function fleetComparisonIsConsistent(comparison, actualOutcome, actualCandidateKey, shadowOutcome, shadowCandidateKey) {
|
|
237
|
+
if (comparison === "not_comparable_truncated") {
|
|
238
|
+
return actualOutcome === "selected" && actualCandidateKey !== null;
|
|
239
|
+
}
|
|
240
|
+
const comparableActualOutcome = actualOutcome === "selected" ? "selected" : "none";
|
|
241
|
+
const comparableShadowOutcome = shadowOutcome === "selected" ? "selected" : "none";
|
|
242
|
+
if (comparison === "different_outcome") {
|
|
243
|
+
return comparableActualOutcome !== comparableShadowOutcome;
|
|
244
|
+
}
|
|
245
|
+
if (comparableActualOutcome !== comparableShadowOutcome) {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
if (comparison === "different_candidate") {
|
|
249
|
+
return comparableActualOutcome === "selected" && actualCandidateKey !== shadowCandidateKey;
|
|
250
|
+
}
|
|
251
|
+
return comparableActualOutcome !== "selected" || actualCandidateKey === shadowCandidateKey;
|
|
252
|
+
}
|
|
253
|
+
function fleetDecisionSemanticsAreConsistent(input) {
|
|
254
|
+
const actualConsistent = input.actualOutcome === "selected" ? ["lease_reused", "pin", "rotation", "active"].includes(input.actualReason) : input.actualOutcome === "waiting" ? input.actualReason === "all_capped" : input.actualReason === "none";
|
|
255
|
+
const shadowConsistent = input.shadowOutcome === "selected" ? ["fenced_in_flight", "best_score", "affinity_best", "hysteresis_hold"].includes(
|
|
256
|
+
input.shadowReason
|
|
257
|
+
) : input.shadowOutcome === "paced" ? input.shadowReason === "admission_paced" : ["fenced_candidate_missing", "no_eligible_candidate", "overlay_isolated_empty"].includes(
|
|
258
|
+
input.shadowReason
|
|
259
|
+
);
|
|
260
|
+
const pacedAdmissionReason = FLEET_ADMISSION_REASON_CLASSIFICATION[input.admissionReason] === "pace";
|
|
261
|
+
return actualConsistent && shadowConsistent && input.admissionOutcome === "pace" === pacedAdmissionReason && input.shadowOutcome === "paced" === (input.admissionOutcome === "pace") && input.borrowedIdleCapacity === (input.admissionReason === "work_conserving_borrow") && (!input.borrowedOverlayCapacity || input.shadowOutcome === "selected" && input.strandedEligibleCount === 0);
|
|
262
|
+
}
|
|
263
|
+
function asRecord(value) {
|
|
264
|
+
return value !== null && typeof value === "object" ? value : {};
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// src/timeline/projection.ts
|
|
26
268
|
var WORKER_SPAWN_TOOL = "session_create";
|
|
27
269
|
var WORKER_MESSAGE_TOOL = "session_send_message";
|
|
270
|
+
var WORKER_FAILURE_CODE_MAX_LENGTH = 128;
|
|
271
|
+
var WORKER_FAILURE_MESSAGE_MAX_UTF8_BYTES = 1024;
|
|
28
272
|
var LANDMARK_ONLY_TOOL_LEAVES = /* @__PURE__ */ new Set(["memory_save", "memory_correct"]);
|
|
273
|
+
var TIMELINE_ANNOTATION_ANSI_SEQUENCE = new RegExp("\\u001B\\[[0-?]*[ -/]*[@-~]", "g");
|
|
274
|
+
function safeTimelineAnnotationJson(value) {
|
|
275
|
+
try {
|
|
276
|
+
return JSON.stringify(value) ?? "";
|
|
277
|
+
} catch {
|
|
278
|
+
return String(value ?? "");
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
function timelineAnnotationToolOutputValue(value, depth = 0) {
|
|
282
|
+
if (depth > 8 || value === null || value === void 0) {
|
|
283
|
+
return value == null ? "" : safeTimelineAnnotationJson(value);
|
|
284
|
+
}
|
|
285
|
+
if (typeof value === "string") return value;
|
|
286
|
+
if (typeof value !== "object" || Array.isArray(value)) {
|
|
287
|
+
return safeTimelineAnnotationJson(value);
|
|
288
|
+
}
|
|
289
|
+
const record = value;
|
|
290
|
+
if (record.type === "text" && typeof record.text === "string") return record.text;
|
|
291
|
+
if (Array.isArray(record.content)) {
|
|
292
|
+
const text = record.content.find(
|
|
293
|
+
(part) => part !== null && typeof part === "object" && part.type === "text" && typeof part.text === "string"
|
|
294
|
+
);
|
|
295
|
+
if (text) return text.text;
|
|
296
|
+
}
|
|
297
|
+
if ("structuredContent" in record) {
|
|
298
|
+
return timelineAnnotationToolOutputValue(record.structuredContent, depth + 1);
|
|
299
|
+
}
|
|
300
|
+
if ("result" in record) return timelineAnnotationToolOutputValue(record.result, depth + 1);
|
|
301
|
+
return safeTimelineAnnotationJson(value);
|
|
302
|
+
}
|
|
303
|
+
function timelineAnnotationToolOutputText(output) {
|
|
304
|
+
const raw = timelineAnnotationToolOutputValue(output);
|
|
305
|
+
const marker = raw.indexOf("\nOutput:\n");
|
|
306
|
+
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
|
+
return text.length > 0 ? text : null;
|
|
308
|
+
}
|
|
29
309
|
function buildTimeline(events) {
|
|
30
310
|
const items = [];
|
|
31
311
|
const prescan = prescanTurnAnchors(events);
|
|
@@ -54,7 +334,7 @@ function buildTimeline(events) {
|
|
|
54
334
|
}
|
|
55
335
|
};
|
|
56
336
|
for (const event of ordered) {
|
|
57
|
-
const payload =
|
|
337
|
+
const payload = asRecord2(event.payload);
|
|
58
338
|
const turnId = event.turnId ?? null;
|
|
59
339
|
switch (event.type) {
|
|
60
340
|
case "user.message": {
|
|
@@ -81,6 +361,15 @@ function buildTimeline(events) {
|
|
|
81
361
|
kind: "user-message",
|
|
82
362
|
id: event.id,
|
|
83
363
|
text: voiceMessage?.text ?? stringValue(payload.text),
|
|
364
|
+
annotations: timelineAnnotations(payload.annotations),
|
|
365
|
+
annotationSource: {
|
|
366
|
+
kind: "user_message",
|
|
367
|
+
eventId: event.id,
|
|
368
|
+
eventType: "user.message",
|
|
369
|
+
sequence: event.sequence,
|
|
370
|
+
turnId,
|
|
371
|
+
text: voiceMessage?.text ?? stringValue(payload.text)
|
|
372
|
+
},
|
|
84
373
|
...voiceMessage ? { presentation: voiceMessage.presentation } : {},
|
|
85
374
|
resources: resourceRefs(payload.resources),
|
|
86
375
|
tools: toolRefs(payload.tools),
|
|
@@ -143,6 +432,14 @@ function buildTimeline(events) {
|
|
|
143
432
|
}
|
|
144
433
|
open.streaming = false;
|
|
145
434
|
open.occurredAt = event.occurredAt;
|
|
435
|
+
open.annotationSource = text && open.text === text ? {
|
|
436
|
+
kind: "assistant_message",
|
|
437
|
+
eventId: event.id,
|
|
438
|
+
eventType: "agent.message.completed",
|
|
439
|
+
sequence: event.sequence,
|
|
440
|
+
turnId,
|
|
441
|
+
text
|
|
442
|
+
} : void 0;
|
|
146
443
|
if (openIndex < items.length - 1) {
|
|
147
444
|
items.splice(openIndex, 1);
|
|
148
445
|
items.push(open);
|
|
@@ -156,7 +453,15 @@ function buildTimeline(events) {
|
|
|
156
453
|
turnId,
|
|
157
454
|
text,
|
|
158
455
|
streaming: false,
|
|
159
|
-
occurredAt: event.occurredAt
|
|
456
|
+
occurredAt: event.occurredAt,
|
|
457
|
+
annotationSource: {
|
|
458
|
+
kind: "assistant_message",
|
|
459
|
+
eventId: event.id,
|
|
460
|
+
eventType: "agent.message.completed",
|
|
461
|
+
sequence: event.sequence,
|
|
462
|
+
turnId,
|
|
463
|
+
text
|
|
464
|
+
}
|
|
160
465
|
});
|
|
161
466
|
}
|
|
162
467
|
break;
|
|
@@ -196,6 +501,7 @@ function buildTimeline(events) {
|
|
|
196
501
|
action: toolMatchesLeaf(name, WORKER_SPAWN_TOOL) ? "spawn" : "message",
|
|
197
502
|
prompt: workerPrompt(args),
|
|
198
503
|
workerSessionId: extractSessionRef(args),
|
|
504
|
+
failure: null,
|
|
199
505
|
status: "running",
|
|
200
506
|
occurredAt: event.occurredAt
|
|
201
507
|
});
|
|
@@ -227,6 +533,7 @@ function buildTimeline(events) {
|
|
|
227
533
|
name,
|
|
228
534
|
arguments: args,
|
|
229
535
|
output: void 0,
|
|
536
|
+
truncation: null,
|
|
230
537
|
// The provider-native item drives the per-tool renderers (apply_patch
|
|
231
538
|
// operation, computer_call action, web_search providerData, …).
|
|
232
539
|
raw: payload.raw,
|
|
@@ -244,10 +551,27 @@ function buildTimeline(events) {
|
|
|
244
551
|
if (target.kind === "worker") {
|
|
245
552
|
target.status = isErrorOutput(payload) ? "failed" : "complete";
|
|
246
553
|
target.workerSessionId = target.workerSessionId ?? extractSessionRef(payload.output);
|
|
554
|
+
target.failure = target.status === "failed" ? workerFailure(payload.output) : null;
|
|
247
555
|
break;
|
|
248
556
|
}
|
|
557
|
+
const truncation = toolCallTruncation(payload);
|
|
249
558
|
target.status = isErrorOutput(payload) ? "failed" : "complete";
|
|
250
|
-
target.output = payload.output;
|
|
559
|
+
target.output = Object.prototype.hasOwnProperty.call(payload, "output") ? payload.output : truncation && typeof payload.preview === "string" ? payload.preview : payload.output;
|
|
560
|
+
target.truncation = truncation;
|
|
561
|
+
const sourceText = timelineAnnotationToolOutputText(
|
|
562
|
+
Object.prototype.hasOwnProperty.call(payload, "output") ? payload.output : payload.preview
|
|
563
|
+
);
|
|
564
|
+
if (sourceText !== null) {
|
|
565
|
+
target.annotationSource = {
|
|
566
|
+
kind: "tool_output",
|
|
567
|
+
eventId: event.id,
|
|
568
|
+
eventType: "agent.toolCall.output",
|
|
569
|
+
sequence: event.sequence,
|
|
570
|
+
turnId,
|
|
571
|
+
text: sourceText,
|
|
572
|
+
label: target.name
|
|
573
|
+
};
|
|
574
|
+
}
|
|
251
575
|
break;
|
|
252
576
|
}
|
|
253
577
|
case "sandbox.operation.started":
|
|
@@ -385,6 +709,7 @@ ${message}` : message;
|
|
|
385
709
|
}
|
|
386
710
|
case "tool.auth_needed":
|
|
387
711
|
case "credential.auth_needed": {
|
|
712
|
+
const capability = capabilityAuthorizationRequest(payload.capability);
|
|
388
713
|
if (event.type === "tool.auth_needed" && !stringValue(payload.toolName) && stringValue(payload.serverId) !== "codex_apps") {
|
|
389
714
|
break;
|
|
390
715
|
}
|
|
@@ -394,7 +719,7 @@ ${message}` : message;
|
|
|
394
719
|
id: event.id,
|
|
395
720
|
turnId,
|
|
396
721
|
serverId: typeof payload.serverId === "string" ? payload.serverId : null,
|
|
397
|
-
source: event.type === "tool.auth_needed" ? "tool" : "credential",
|
|
722
|
+
source: capability ? "capability" : event.type === "tool.auth_needed" ? "tool" : "credential",
|
|
398
723
|
providerDomain: stringValue(payload.providerDomain),
|
|
399
724
|
connectionId: typeof payload.connectionId === "string" ? payload.connectionId : null,
|
|
400
725
|
reason: authNeededReason(payload.reason),
|
|
@@ -402,6 +727,7 @@ ${message}` : message;
|
|
|
402
727
|
resource: typeof payload.resource === "string" ? payload.resource : null,
|
|
403
728
|
toolName: typeof payload.toolName === "string" ? payload.toolName : null,
|
|
404
729
|
authorizationUrl: typeof payload.authorizationUrl === "string" ? payload.authorizationUrl : null,
|
|
730
|
+
capability,
|
|
405
731
|
occurredAt: event.occurredAt
|
|
406
732
|
});
|
|
407
733
|
break;
|
|
@@ -509,7 +835,7 @@ ${message}` : message;
|
|
|
509
835
|
return items;
|
|
510
836
|
}
|
|
511
837
|
function realtimeVoiceMessage(payload) {
|
|
512
|
-
const presentation =
|
|
838
|
+
const presentation = asRecord2(payload.presentation);
|
|
513
839
|
const visibleText = stringValue(payload.text);
|
|
514
840
|
if (presentation.kind === "realtime_voice" || presentation.kind === "realtime_voice_handoff") {
|
|
515
841
|
const context = stringValue(presentation.context);
|
|
@@ -518,7 +844,7 @@ function realtimeVoiceMessage(payload) {
|
|
|
518
844
|
return null;
|
|
519
845
|
}
|
|
520
846
|
function providerNativeToolStatus(rawValue) {
|
|
521
|
-
const raw =
|
|
847
|
+
const raw = asRecord2(rawValue);
|
|
522
848
|
if (raw.type !== "hosted_tool_call") {
|
|
523
849
|
return "running";
|
|
524
850
|
}
|
|
@@ -535,13 +861,13 @@ function providerNativeToolStatus(rawValue) {
|
|
|
535
861
|
}
|
|
536
862
|
}
|
|
537
863
|
function mergeToolCallRaw(existingValue, nextValue) {
|
|
538
|
-
const existing =
|
|
539
|
-
const next =
|
|
864
|
+
const existing = asRecord2(existingValue);
|
|
865
|
+
const next = asRecord2(nextValue);
|
|
540
866
|
if (Object.keys(next).length === 0) {
|
|
541
867
|
return existingValue;
|
|
542
868
|
}
|
|
543
|
-
const existingProvider =
|
|
544
|
-
const nextProvider =
|
|
869
|
+
const existingProvider = asRecord2(existing.providerData);
|
|
870
|
+
const nextProvider = asRecord2(next.providerData);
|
|
545
871
|
const providerData = {
|
|
546
872
|
...existingProvider,
|
|
547
873
|
...nextProvider
|
|
@@ -572,7 +898,7 @@ function creditExhaustedFromEvents(events) {
|
|
|
572
898
|
if (event?.type !== "turn.completed" && event?.type !== "turn.failed" && event?.type !== "turn.cancelled") {
|
|
573
899
|
continue;
|
|
574
900
|
}
|
|
575
|
-
return isCreditExhaustionPayload(
|
|
901
|
+
return isCreditExhaustionPayload(asRecord2(event.payload));
|
|
576
902
|
}
|
|
577
903
|
return false;
|
|
578
904
|
}
|
|
@@ -582,7 +908,7 @@ function sessionStatusFromEvents(events) {
|
|
|
582
908
|
if (event?.type !== "session.status.changed") {
|
|
583
909
|
continue;
|
|
584
910
|
}
|
|
585
|
-
const status =
|
|
911
|
+
const status = asRecord2(event.payload).status;
|
|
586
912
|
if (isSessionStatus(status)) {
|
|
587
913
|
return status;
|
|
588
914
|
}
|
|
@@ -635,7 +961,7 @@ function prescanTurnAnchors(events) {
|
|
|
635
961
|
const fallbackSeqByTurn = /* @__PURE__ */ new Map();
|
|
636
962
|
const startedTurnIds = /* @__PURE__ */ new Set();
|
|
637
963
|
for (const event of ordered) {
|
|
638
|
-
const payload =
|
|
964
|
+
const payload = asRecord2(event.payload);
|
|
639
965
|
const turnId = event.turnId ?? null;
|
|
640
966
|
if (event.type === "turn.queued") {
|
|
641
967
|
const triggerEventId = typeof payload.triggerEventId === "string" ? payload.triggerEventId : null;
|
|
@@ -840,7 +1166,7 @@ function foldSettledTurn(groups, turnEnd) {
|
|
|
840
1166
|
);
|
|
841
1167
|
}
|
|
842
1168
|
function isTurnBoundary(group) {
|
|
843
|
-
return group?.kind === "turn" || group?.kind === "item" && (group.item.kind === "user-message" || group.item.kind === "context-compaction" || group.item.kind === "notice" && group.item.tone === "input");
|
|
1169
|
+
return group?.kind === "turn" || group?.kind === "item" && (group.item.kind === "user-message" || group.item.kind === "context-compaction" || group.item.kind === "machine-input-batch" && group.item.members.some((member) => member.kind === "media_generation_result") || group.item.kind === "notice" && group.item.tone === "input");
|
|
844
1170
|
}
|
|
845
1171
|
function belongsToDifferentTurn(group, turnId) {
|
|
846
1172
|
if (!group || !turnId) {
|
|
@@ -877,7 +1203,7 @@ function groupStartedAt(group) {
|
|
|
877
1203
|
return group.startedAt;
|
|
878
1204
|
}
|
|
879
1205
|
}
|
|
880
|
-
function
|
|
1206
|
+
function asRecord2(value) {
|
|
881
1207
|
return value !== null && typeof value === "object" ? value : {};
|
|
882
1208
|
}
|
|
883
1209
|
function stringValue(value) {
|
|
@@ -928,7 +1254,8 @@ function machineInputMembers(value) {
|
|
|
928
1254
|
"goal_continuation",
|
|
929
1255
|
"agent_message",
|
|
930
1256
|
"agent_steer_instruction",
|
|
931
|
-
"child_terminal_result"
|
|
1257
|
+
"child_terminal_result",
|
|
1258
|
+
"media_generation_result"
|
|
932
1259
|
]);
|
|
933
1260
|
const classifications = /* @__PURE__ */ new Set([
|
|
934
1261
|
"success",
|
|
@@ -937,18 +1264,23 @@ function machineInputMembers(value) {
|
|
|
937
1264
|
"info"
|
|
938
1265
|
]);
|
|
939
1266
|
return Array.isArray(value) ? value.flatMap((candidate) => {
|
|
940
|
-
const member =
|
|
1267
|
+
const member = asRecord2(candidate);
|
|
941
1268
|
return typeof member.id === "string" && typeof member.kind === "string" && kinds.has(member.kind) && typeof member.classification === "string" && classifications.has(
|
|
942
1269
|
member.classification
|
|
943
|
-
) && typeof member.sourceId === "string" ?
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
1270
|
+
) && typeof member.sourceId === "string" ? (() => {
|
|
1271
|
+
const kind = member.kind;
|
|
1272
|
+
const result = kind === "media_generation_result" ? parseMediaGenerationResult(member.result) : null;
|
|
1273
|
+
return [
|
|
1274
|
+
{
|
|
1275
|
+
id: member.id,
|
|
1276
|
+
kind,
|
|
1277
|
+
classification: member.classification,
|
|
1278
|
+
sourceId: member.sourceId,
|
|
1279
|
+
summary: stringValue(member.summary),
|
|
1280
|
+
...result ? { result } : {}
|
|
1281
|
+
}
|
|
1282
|
+
];
|
|
1283
|
+
})() : [];
|
|
952
1284
|
}) : [];
|
|
953
1285
|
}
|
|
954
1286
|
var SESSION_STATUSES = [
|
|
@@ -969,29 +1301,37 @@ function resourceRefs(value) {
|
|
|
969
1301
|
return [];
|
|
970
1302
|
}
|
|
971
1303
|
return value.filter((entry) => {
|
|
972
|
-
const record =
|
|
1304
|
+
const record = asRecord2(entry);
|
|
973
1305
|
if (record.kind === "repository") {
|
|
974
1306
|
return typeof record.uri === "string" && typeof record.ref === "string";
|
|
975
1307
|
}
|
|
976
1308
|
return record.kind === "file" && typeof record.fileId === "string";
|
|
977
1309
|
});
|
|
978
1310
|
}
|
|
1311
|
+
function timelineAnnotations(value) {
|
|
1312
|
+
if (!Array.isArray(value)) return [];
|
|
1313
|
+
return value.filter((candidate) => {
|
|
1314
|
+
const annotation = asRecord2(candidate);
|
|
1315
|
+
const source = asRecord2(annotation.source);
|
|
1316
|
+
return typeof annotation.id === "string" && typeof annotation.ordinal === "number" && typeof annotation.quote === "string" && typeof annotation.note === "string" && typeof source.eventId === "string" && typeof source.eventType === "string" && typeof source.sequence === "number" && typeof source.startOffset === "number" && typeof source.endOffset === "number";
|
|
1317
|
+
});
|
|
1318
|
+
}
|
|
979
1319
|
function toolRefs(value) {
|
|
980
1320
|
if (!Array.isArray(value)) {
|
|
981
1321
|
return [];
|
|
982
1322
|
}
|
|
983
1323
|
return value.filter((entry) => {
|
|
984
|
-
const record =
|
|
1324
|
+
const record = asRecord2(entry);
|
|
985
1325
|
return record.kind === "mcp" && typeof record.id === "string";
|
|
986
1326
|
});
|
|
987
1327
|
}
|
|
988
1328
|
function workerCompletionPayload(value) {
|
|
989
|
-
const payload =
|
|
1329
|
+
const payload = asRecord2(value);
|
|
990
1330
|
const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
991
1331
|
if (typeof payload.childSessionId !== "string" || !uuidPattern.test(payload.childSessionId) || typeof payload.status !== "string" || payload.status.trim() === "") {
|
|
992
1332
|
return null;
|
|
993
1333
|
}
|
|
994
|
-
const goal =
|
|
1334
|
+
const goal = asRecord2(payload.goal);
|
|
995
1335
|
return {
|
|
996
1336
|
childSessionId: payload.childSessionId,
|
|
997
1337
|
childStatus: payload.status,
|
|
@@ -1014,6 +1354,25 @@ function isErrorOutput(payload) {
|
|
|
1014
1354
|
const output = payload.output;
|
|
1015
1355
|
return !!output && typeof output === "object" && output.isError === true;
|
|
1016
1356
|
}
|
|
1357
|
+
function toolCallTruncation(payload) {
|
|
1358
|
+
const truncation = asRecord2(payload.truncation);
|
|
1359
|
+
const fullEvidence = asRecord2(truncation.fullEvidence);
|
|
1360
|
+
const surface = stringValue(truncation.surface);
|
|
1361
|
+
const reason = stringValue(truncation.reason);
|
|
1362
|
+
if (truncation.truncated !== true || !surface || !reason || typeof fullEvidence.available !== "boolean") {
|
|
1363
|
+
return null;
|
|
1364
|
+
}
|
|
1365
|
+
return {
|
|
1366
|
+
truncated: true,
|
|
1367
|
+
surface,
|
|
1368
|
+
reason,
|
|
1369
|
+
omittedBytes: numberOrNull(truncation.omittedBytes),
|
|
1370
|
+
fullEvidence: {
|
|
1371
|
+
available: fullEvidence.available,
|
|
1372
|
+
reason: stringValue(fullEvidence.reason) || null
|
|
1373
|
+
}
|
|
1374
|
+
};
|
|
1375
|
+
}
|
|
1017
1376
|
function findOpenCall(items, callId) {
|
|
1018
1377
|
const reversed = [...items].reverse();
|
|
1019
1378
|
const isCall = (item) => item.kind === "tool-call" || item.kind === "worker";
|
|
@@ -1045,7 +1404,7 @@ function goalText(payload) {
|
|
|
1045
1404
|
if (typeof payload.text === "string" && payload.text) {
|
|
1046
1405
|
return payload.text;
|
|
1047
1406
|
}
|
|
1048
|
-
const goal =
|
|
1407
|
+
const goal = asRecord2(payload.goal);
|
|
1049
1408
|
if (typeof goal.text === "string" && goal.text) {
|
|
1050
1409
|
return goal.text;
|
|
1051
1410
|
}
|
|
@@ -1098,25 +1457,46 @@ var AUTH_NEEDED_REASONS = /* @__PURE__ */ new Set([
|
|
|
1098
1457
|
function authNeededReason(value) {
|
|
1099
1458
|
return typeof value === "string" && AUTH_NEEDED_REASONS.has(value) ? value : null;
|
|
1100
1459
|
}
|
|
1460
|
+
function capabilityAuthorizationRequest(value) {
|
|
1461
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
1462
|
+
const record = value;
|
|
1463
|
+
const kind = record.kind;
|
|
1464
|
+
const source = record.source;
|
|
1465
|
+
const action = record.action;
|
|
1466
|
+
if (typeof record.id !== "string" || typeof record.name !== "string" || !["pack", "mcp", "api", "skill", "plugin"].includes(String(kind)) || !["built_in", "library", "configured", "public_registry", "registry", "manual"].includes(
|
|
1467
|
+
String(source)
|
|
1468
|
+
) || !["connect", "add_credentials", "enable"].includes(String(action)) || typeof record.rationale !== "string") {
|
|
1469
|
+
return null;
|
|
1470
|
+
}
|
|
1471
|
+
return {
|
|
1472
|
+
id: record.id,
|
|
1473
|
+
name: record.name,
|
|
1474
|
+
kind,
|
|
1475
|
+
source,
|
|
1476
|
+
action,
|
|
1477
|
+
rationale: record.rationale,
|
|
1478
|
+
requiredVariables: stringList(record.requiredVariables)
|
|
1479
|
+
};
|
|
1480
|
+
}
|
|
1101
1481
|
function stringList(value) {
|
|
1102
1482
|
return Array.isArray(value) ? value.filter((entry) => typeof entry === "string" && entry.trim().length > 0) : [];
|
|
1103
1483
|
}
|
|
1104
1484
|
function reasoningText(payload) {
|
|
1105
|
-
const record =
|
|
1485
|
+
const record = asRecord2(payload);
|
|
1106
1486
|
if (typeof record.text === "string") {
|
|
1107
1487
|
return record.text;
|
|
1108
1488
|
}
|
|
1109
|
-
const content =
|
|
1489
|
+
const content = asRecord2(asRecord2(record.item).rawItem).content;
|
|
1110
1490
|
if (!Array.isArray(content)) {
|
|
1111
1491
|
return "";
|
|
1112
1492
|
}
|
|
1113
1493
|
return content.map((part) => {
|
|
1114
|
-
const text =
|
|
1494
|
+
const text = asRecord2(part).text;
|
|
1115
1495
|
return stringValue(text);
|
|
1116
1496
|
}).join("");
|
|
1117
1497
|
}
|
|
1118
1498
|
function workerPrompt(args) {
|
|
1119
|
-
const record =
|
|
1499
|
+
const record = asRecord2(typeof args === "string" ? tryParseJson(args) : args);
|
|
1120
1500
|
for (const key of ["initialMessage", "message", "text", "prompt"]) {
|
|
1121
1501
|
const value = record[key];
|
|
1122
1502
|
if (typeof value === "string" && value.trim().length > 0) {
|
|
@@ -1125,6 +1505,49 @@ function workerPrompt(args) {
|
|
|
1125
1505
|
}
|
|
1126
1506
|
return null;
|
|
1127
1507
|
}
|
|
1508
|
+
function boundedWorkerFailureMessage(value) {
|
|
1509
|
+
const normalized = value.replace(/[\u0000-\u001f\u007f]+/g, " ").trim();
|
|
1510
|
+
if (!normalized) return null;
|
|
1511
|
+
const encoded = new TextEncoder().encode(normalized);
|
|
1512
|
+
if (encoded.byteLength <= WORKER_FAILURE_MESSAGE_MAX_UTF8_BYTES) return normalized;
|
|
1513
|
+
let end = WORKER_FAILURE_MESSAGE_MAX_UTF8_BYTES;
|
|
1514
|
+
while (end > 0 && (encoded[end] & 192) === 128) end -= 1;
|
|
1515
|
+
return new TextDecoder().decode(encoded.slice(0, end)).trim();
|
|
1516
|
+
}
|
|
1517
|
+
function boundedWorkerFailure(value) {
|
|
1518
|
+
const record = asRecord2(value);
|
|
1519
|
+
const code = typeof record.code === "string" ? record.code.trim() : "";
|
|
1520
|
+
const message = typeof record.message === "string" ? boundedWorkerFailureMessage(record.message) : null;
|
|
1521
|
+
if (!/^[A-Za-z0-9._:-]{1,128}$/.test(code) || !message) return null;
|
|
1522
|
+
return { code: code.slice(0, WORKER_FAILURE_CODE_MAX_LENGTH), message };
|
|
1523
|
+
}
|
|
1524
|
+
function workerFailure(value, depth = 0) {
|
|
1525
|
+
if (depth > 6 || value === null || value === void 0) return null;
|
|
1526
|
+
if (typeof value === "string") {
|
|
1527
|
+
const parsed = tryParseJson(value);
|
|
1528
|
+
return parsed === value ? null : workerFailure(parsed, depth + 1);
|
|
1529
|
+
}
|
|
1530
|
+
if (Array.isArray(value)) {
|
|
1531
|
+
for (const entry of value) {
|
|
1532
|
+
const failure = workerFailure(entry, depth + 1);
|
|
1533
|
+
if (failure) return failure;
|
|
1534
|
+
}
|
|
1535
|
+
return null;
|
|
1536
|
+
}
|
|
1537
|
+
if (typeof value !== "object") return null;
|
|
1538
|
+
const record = value;
|
|
1539
|
+
const direct = boundedWorkerFailure(record.error);
|
|
1540
|
+
if (direct) return direct;
|
|
1541
|
+
for (const key of ["structuredContent", "content", "result", "output"]) {
|
|
1542
|
+
if (!(key in record)) continue;
|
|
1543
|
+
const failure = workerFailure(record[key], depth + 1);
|
|
1544
|
+
if (failure) return failure;
|
|
1545
|
+
}
|
|
1546
|
+
if (record.type === "text" && typeof record.text === "string") {
|
|
1547
|
+
return workerFailure(record.text, depth + 1);
|
|
1548
|
+
}
|
|
1549
|
+
return null;
|
|
1550
|
+
}
|
|
1128
1551
|
function extractSessionRef(value, depth = 0) {
|
|
1129
1552
|
if (depth > 6 || value === null || value === void 0) {
|
|
1130
1553
|
return null;
|
|
@@ -1145,7 +1568,7 @@ function extractSessionRef(value, depth = 0) {
|
|
|
1145
1568
|
return null;
|
|
1146
1569
|
}
|
|
1147
1570
|
const record = value;
|
|
1148
|
-
const receiptResource =
|
|
1571
|
+
const receiptResource = asRecord2(record.resource);
|
|
1149
1572
|
if (record.receiptVersion === "mcp-mutation-receipt.v1" && receiptResource.type === "session" && typeof receiptResource.id === "string" && looksLikeId(receiptResource.id)) {
|
|
1150
1573
|
return receiptResource.id;
|
|
1151
1574
|
}
|
|
@@ -1181,4 +1604,4 @@ export {
|
|
|
1181
1604
|
groupTimeline,
|
|
1182
1605
|
extractSessionRef
|
|
1183
1606
|
};
|
|
1184
|
-
//# sourceMappingURL=chunk-
|
|
1607
|
+
//# sourceMappingURL=chunk-6KLX2RH5.js.map
|