@opengeni/react 0.48.0 → 0.52.1

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.
Files changed (284) hide show
  1. package/README.md +90 -2
  2. package/dist/artifacts-document.d.ts +3 -0
  3. package/dist/artifacts-document.js +17 -0
  4. package/dist/artifacts-document.js.map +1 -0
  5. package/dist/artifacts-presentation.d.ts +3 -0
  6. package/dist/artifacts-presentation.js +17 -0
  7. package/dist/artifacts-presentation.js.map +1 -0
  8. package/dist/artifacts-spreadsheet.d.ts +3 -0
  9. package/dist/artifacts-spreadsheet.js +17 -0
  10. package/dist/artifacts-spreadsheet.js.map +1 -0
  11. package/dist/artifacts.d.ts +2 -0
  12. package/dist/artifacts.js +170 -0
  13. package/dist/artifacts.js.map +1 -0
  14. package/dist/chunk-6BBWWOOU.js +82 -0
  15. package/dist/chunk-6BBWWOOU.js.map +1 -0
  16. package/dist/{chunk-FWXGSNXT.js → chunk-724BW4TW.js} +585 -34
  17. package/dist/chunk-724BW4TW.js.map +1 -0
  18. package/dist/chunk-7I2KB3OK.js +3895 -0
  19. package/dist/chunk-7I2KB3OK.js.map +1 -0
  20. package/dist/chunk-7WCLAEFV.js +2828 -0
  21. package/dist/chunk-7WCLAEFV.js.map +1 -0
  22. package/dist/{chunk-I4MPFDRP.js → chunk-FWS3KC3Z.js} +3 -3
  23. package/dist/{chunk-EKZH6IDG.js → chunk-HDBG7XGO.js} +62 -1
  24. package/dist/chunk-HDBG7XGO.js.map +1 -0
  25. package/dist/chunk-HUIKIDM5.js +2148 -0
  26. package/dist/chunk-HUIKIDM5.js.map +1 -0
  27. package/dist/{chunk-XCNTXWBB.js → chunk-JAGDUCZQ.js} +854 -340
  28. package/dist/chunk-JAGDUCZQ.js.map +1 -0
  29. package/dist/{chunk-LHLYWG5R.js → chunk-JR3QFY6B.js} +413 -37
  30. package/dist/chunk-JR3QFY6B.js.map +1 -0
  31. package/dist/chunk-JVYQRRC4.js +53 -0
  32. package/dist/chunk-JVYQRRC4.js.map +1 -0
  33. package/dist/chunk-KCGXPP5V.js +157 -0
  34. package/dist/chunk-KCGXPP5V.js.map +1 -0
  35. package/dist/chunk-PEI6RANI.js +3234 -0
  36. package/dist/chunk-PEI6RANI.js.map +1 -0
  37. package/dist/{chunk-NJ7M2B6Z.js → chunk-ROIRTM37.js} +18 -10
  38. package/dist/{chunk-NJ7M2B6Z.js.map → chunk-ROIRTM37.js.map} +1 -1
  39. package/dist/{chunk-O4VXOBGF.js → chunk-WSK7G5LE.js} +70 -2
  40. package/dist/chunk-WSK7G5LE.js.map +1 -0
  41. package/dist/{chunk-OL6QVXGF.js → chunk-X4S56Y2H.js} +27 -7
  42. package/dist/{chunk-OL6QVXGF.js.map → chunk-X4S56Y2H.js.map} +1 -1
  43. package/dist/client.d.ts +7 -1
  44. package/dist/clipboard.d.ts +1 -0
  45. package/dist/clipboard.js +7 -0
  46. package/dist/clipboard.js.map +1 -0
  47. package/dist/commands/index.d.ts +3 -3
  48. package/dist/commands/registry.d.ts +1 -1
  49. package/dist/commands/types.d.ts +1 -1
  50. package/dist/components/approval-surface.d.ts +2 -2
  51. package/dist/components/artifacts/artifact-surface.d.ts +18 -0
  52. package/dist/components/artifacts/document-editor.d.ts +172 -0
  53. package/dist/components/artifacts/editable-artifact-ui.d.ts +13 -0
  54. package/dist/components/artifacts/editable-artifact-workbench.d.ts +49 -0
  55. package/dist/components/artifacts/editable-document.d.ts +24 -0
  56. package/dist/components/artifacts/editable-presentation.d.ts +24 -0
  57. package/dist/components/artifacts/editable-spreadsheet.d.ts +32 -0
  58. package/dist/components/artifacts/index.d.ts +8 -0
  59. package/dist/components/artifacts/presentation-editor.d.ts +297 -0
  60. package/dist/components/artifacts/spreadsheet-canvas.d.ts +120 -0
  61. package/dist/components/artifacts/spreadsheet-grid.d.ts +113 -0
  62. package/dist/components/browser-viewer.d.ts +29 -0
  63. package/dist/components/chat-composer.d.ts +8 -8
  64. package/dist/components/code-editor.d.ts +25 -3
  65. package/dist/components/command-palette.d.ts +2 -2
  66. package/dist/components/composer-transcription-control.d.ts +2 -2
  67. package/dist/components/composer.d.ts +17 -17
  68. package/dist/components/computer-viewer.d.ts +23 -0
  69. package/dist/components/copy-button.d.ts +2 -2
  70. package/dist/components/desktop-viewer.d.ts +25 -21
  71. package/dist/components/diff-view.d.ts +1 -1
  72. package/dist/components/enrollment-consent.d.ts +1 -1
  73. package/dist/components/enrollment-device-flow.d.ts +1 -1
  74. package/dist/components/file-browser.d.ts +2 -2
  75. package/dist/components/fleet-tile.d.ts +1 -1
  76. package/dist/components/generated-video-player.d.ts +10 -0
  77. package/dist/components/human-input-form.d.ts +1 -1
  78. package/dist/components/human-input-surface.d.ts +2 -2
  79. package/dist/components/interactive-workbench-viewers.d.ts +2 -0
  80. package/dist/components/machine-card.d.ts +2 -2
  81. package/dist/components/machine-dock-bar.d.ts +3 -3
  82. package/dist/components/machine-health-pill.d.ts +2 -2
  83. package/dist/components/machine-input-display.d.ts +1 -1
  84. package/dist/components/machine-metrics.d.ts +2 -2
  85. package/dist/components/machine-status-pill.d.ts +4 -4
  86. package/dist/components/machines/health.d.ts +1 -1
  87. package/dist/components/machines/machine-detail.d.ts +3 -3
  88. package/dist/components/machines/metric-history-chart.d.ts +1 -1
  89. package/dist/components/machines/metric-sparkline.d.ts +2 -2
  90. package/dist/components/machines/series.d.ts +2 -2
  91. package/dist/components/machines-dashboard.d.ts +2 -2
  92. package/dist/components/markdown.d.ts +1 -1
  93. package/dist/components/message-timeline.d.ts +12 -5
  94. package/dist/components/model-picker.d.ts +2 -2
  95. package/dist/components/model-policy-picker.d.ts +7 -7
  96. package/dist/components/pierre-diff.d.ts +1 -1
  97. package/dist/components/pierre-file.d.ts +1 -1
  98. package/dist/components/queue-draft-policy.d.ts +1 -1
  99. package/dist/components/queue-surface-implementation.d.ts +3 -3
  100. package/dist/components/queue-surface-state.d.ts +4 -4
  101. package/dist/components/queue-surface.d.ts +5 -5
  102. package/dist/components/sandbox-files.d.ts +3 -3
  103. package/dist/components/sandbox-terminal.d.ts +21 -4
  104. package/dist/components/sandbox-workspace.d.ts +25 -9
  105. package/dist/components/session-chrome.d.ts +4 -4
  106. package/dist/components/session-status.d.ts +2 -2
  107. package/dist/components/timeline-annotation-selection.d.ts +9 -0
  108. package/dist/components/timeline-annotations-dialog.d.ts +16 -0
  109. package/dist/components/timeline-annotations.d.ts +13 -0
  110. package/dist/components/tooltip.d.ts +4 -4
  111. package/dist/components/user-message-body.d.ts +2 -2
  112. package/dist/components/workbench-changes.d.ts +2 -2
  113. package/dist/components/workspace-dock.d.ts +1 -1
  114. package/dist/composer.d.ts +11 -11
  115. package/dist/composer.js +5 -5
  116. package/dist/hooks/internal.d.ts +1 -1
  117. package/dist/hooks/use-attached-browsers.d.ts +21 -0
  118. package/dist/hooks/use-available-models.d.ts +2 -2
  119. package/dist/hooks/use-billing-usage.d.ts +1 -1
  120. package/dist/hooks/use-browser-frame-stream.d.ts +28 -0
  121. package/dist/hooks/use-browser-identities.d.ts +26 -0
  122. package/dist/hooks/use-browser-session.d.ts +28 -0
  123. package/dist/hooks/use-browser-sessions.d.ts +32 -0
  124. package/dist/hooks/use-codex-accounts.d.ts +2 -2
  125. package/dist/hooks/use-composer.d.ts +36 -9
  126. package/dist/hooks/use-computer-frame-stream.d.ts +24 -0
  127. package/dist/hooks/use-computer-session.d.ts +28 -0
  128. package/dist/hooks/use-computer-sessions.d.ts +28 -0
  129. package/dist/hooks/use-desktop-stream.d.ts +1 -1
  130. package/dist/hooks/use-environments.d.ts +1 -1
  131. package/dist/hooks/use-file-attachments.d.ts +1 -1
  132. package/dist/hooks/use-goal.d.ts +2 -2
  133. package/dist/hooks/use-human-input.d.ts +2 -2
  134. package/dist/hooks/use-last-started-turn-policy.d.ts +2 -2
  135. package/dist/hooks/use-machine-chip.d.ts +2 -2
  136. package/dist/hooks/use-machines.d.ts +4 -4
  137. package/dist/hooks/use-packs.d.ts +7 -2
  138. package/dist/hooks/use-rigs.d.ts +1 -1
  139. package/dist/hooks/use-sandbox-files.d.ts +6 -4
  140. package/dist/hooks/use-sandbox-git.d.ts +6 -5
  141. package/dist/hooks/use-sandbox-terminal.d.ts +1 -1
  142. package/dist/hooks/use-scheduled-tasks.d.ts +1 -1
  143. package/dist/hooks/use-session-capabilities.d.ts +5 -4
  144. package/dist/hooks/use-session-control.d.ts +1 -1
  145. package/dist/hooks/use-session-events.d.ts +2 -2
  146. package/dist/hooks/use-session-lineage.d.ts +1 -1
  147. package/dist/hooks/use-session-mcp-approval-policy.d.ts +2 -2
  148. package/dist/hooks/use-session.d.ts +2 -2
  149. package/dist/hooks/use-slash-commands.d.ts +1 -1
  150. package/dist/hooks/use-terminal-stream.d.ts +8 -2
  151. package/dist/hooks/use-turn-queue.d.ts +2 -2
  152. package/dist/hooks/use-video-artifact-playback.d.ts +9 -0
  153. package/dist/hooks/use-voice-input.d.ts +1 -1
  154. package/dist/hooks/use-workspace-capture.d.ts +1 -1
  155. package/dist/hooks/use-workspace-edit.d.ts +1 -1
  156. package/dist/hooks/use-workspace-sessions.d.ts +1 -1
  157. package/dist/hooks/use-workspaces.d.ts +1 -1
  158. package/dist/index.d.ts +158 -155
  159. package/dist/index.js +906 -462
  160. package/dist/index.js.map +1 -1
  161. package/dist/interaction.d.ts +23 -0
  162. package/dist/interaction.js +36 -0
  163. package/dist/interaction.js.map +1 -0
  164. package/dist/interactive-workbench-viewers-KHNOHWQE.js +13 -0
  165. package/dist/interactive-workbench-viewers-KHNOHWQE.js.map +1 -0
  166. package/dist/lib/relay-wire.d.ts +4 -0
  167. package/dist/lib/sandbox-liveness.d.ts +9 -0
  168. package/dist/lib/terminal-capability.d.ts +5 -0
  169. package/dist/lib/xterm-theme.d.ts +1 -1
  170. package/dist/machines.d.ts +30 -30
  171. package/dist/machines.js +3 -3
  172. package/dist/provider.d.ts +4 -4
  173. package/dist/{queue-surface-implementation-U5JFG7HT.js → queue-surface-implementation-2KVJTYXH.js} +100 -48
  174. package/dist/queue-surface-implementation-2KVJTYXH.js.map +1 -0
  175. package/dist/realtime/dropdown-menu.d.ts +8 -8
  176. package/dist/realtime/realtime-control.d.ts +6 -6
  177. package/dist/realtime.d.ts +4 -4
  178. package/dist/realtime.js +3 -3
  179. package/dist/session-context.d.ts +19 -1
  180. package/dist/session-ui.d.ts +14 -14
  181. package/dist/session-ui.js +5 -4
  182. package/dist/session.d.ts +28 -28
  183. package/dist/session.js +5 -5
  184. package/dist/timeline/activity-rail.d.ts +5 -3
  185. package/dist/timeline/disclosure-context.d.ts +1 -1
  186. package/dist/timeline/fleet-decision-projection.d.ts +1 -1
  187. package/dist/timeline/fleet-decision-row.d.ts +3 -3
  188. package/dist/timeline/index.d.ts +19 -19
  189. package/dist/timeline/parsers.d.ts +4 -1
  190. package/dist/timeline/projection.d.ts +3 -3
  191. package/dist/timeline/registry.d.ts +8 -2
  192. package/dist/timeline/screenshot-lightbox.d.ts +2 -2
  193. package/dist/timeline/shared.d.ts +21 -10
  194. package/dist/timeline/tool-diff.d.ts +2 -2
  195. package/dist/timeline/tool-renderers.d.ts +1 -1
  196. package/dist/timeline/turn-summary.d.ts +3 -3
  197. package/dist/timeline/types.d.ts +39 -3
  198. package/dist/timeline-annotation-selection-3L7LHGG2.js +187 -0
  199. package/dist/timeline-annotation-selection-3L7LHGG2.js.map +1 -0
  200. package/dist/timeline-annotations-dialog-U7EVLR75.js +196 -0
  201. package/dist/timeline-annotations-dialog-U7EVLR75.js.map +1 -0
  202. package/package.json +36 -7
  203. package/src/artifacts-document.ts +31 -0
  204. package/src/artifacts-presentation.ts +36 -0
  205. package/src/artifacts-spreadsheet.ts +21 -0
  206. package/src/artifacts.ts +86 -0
  207. package/src/client.ts +87 -1
  208. package/src/clipboard.ts +2 -0
  209. package/src/components/artifacts/artifact-surface.tsx +93 -0
  210. package/src/components/artifacts/document-editor.tsx +2255 -0
  211. package/src/components/artifacts/editable-artifact-ui.tsx +89 -0
  212. package/src/components/artifacts/editable-artifact-workbench.tsx +203 -0
  213. package/src/components/artifacts/editable-document.tsx +657 -0
  214. package/src/components/artifacts/editable-presentation.tsx +1020 -0
  215. package/src/components/artifacts/editable-spreadsheet.tsx +733 -0
  216. package/src/components/artifacts/index.ts +99 -0
  217. package/src/components/artifacts/presentation-editor.tsx +3148 -0
  218. package/src/components/artifacts/spreadsheet-canvas.ts +799 -0
  219. package/src/components/artifacts/spreadsheet-grid.tsx +2129 -0
  220. package/src/components/browser-viewer.tsx +1592 -0
  221. package/src/components/chat-composer.tsx +13 -0
  222. package/src/components/code-editor.tsx +89 -30
  223. package/src/components/composer-transcription-control.tsx +10 -6
  224. package/src/components/computer-viewer.tsx +1139 -0
  225. package/src/components/desktop-viewer.tsx +101 -73
  226. package/src/components/generated-video-player.tsx +89 -0
  227. package/src/components/interactive-workbench-viewers.ts +2 -0
  228. package/src/components/machine-input-display.ts +3 -0
  229. package/src/components/message-timeline.tsx +289 -32
  230. package/src/components/queue-surface-implementation.tsx +116 -60
  231. package/src/components/sandbox-files.tsx +2 -2
  232. package/src/components/sandbox-terminal.tsx +106 -41
  233. package/src/components/sandbox-workspace.tsx +215 -87
  234. package/src/components/session-chrome.tsx +53 -13
  235. package/src/components/timeline-annotation-selection.tsx +221 -0
  236. package/src/components/timeline-annotations-dialog.tsx +213 -0
  237. package/src/components/timeline-annotations.tsx +84 -0
  238. package/src/components/workbench-changes.tsx +188 -31
  239. package/src/hooks/use-attached-browsers.ts +152 -0
  240. package/src/hooks/use-browser-frame-stream.ts +316 -0
  241. package/src/hooks/use-browser-identities.ts +225 -0
  242. package/src/hooks/use-browser-session.ts +476 -0
  243. package/src/hooks/use-browser-sessions.ts +281 -0
  244. package/src/hooks/use-composer.ts +769 -24
  245. package/src/hooks/use-computer-frame-stream.ts +311 -0
  246. package/src/hooks/use-computer-session.ts +442 -0
  247. package/src/hooks/use-computer-sessions.ts +245 -0
  248. package/src/hooks/use-machine-chip.ts +5 -3
  249. package/src/hooks/use-machines.ts +33 -3
  250. package/src/hooks/use-packs.ts +51 -0
  251. package/src/hooks/use-sandbox-files.ts +98 -55
  252. package/src/hooks/use-sandbox-git.ts +93 -38
  253. package/src/hooks/use-sandbox-terminal.ts +3 -2
  254. package/src/hooks/use-session-capabilities.ts +59 -46
  255. package/src/hooks/use-terminal-stream.ts +102 -23
  256. package/src/hooks/use-video-artifact-playback.ts +28 -0
  257. package/src/hooks/use-workspace-edit.ts +2 -1
  258. package/src/index.ts +10 -0
  259. package/src/interaction.ts +71 -0
  260. package/src/lib/relay-wire.ts +4 -0
  261. package/src/lib/sandbox-liveness.ts +11 -0
  262. package/src/lib/terminal-capability.ts +10 -0
  263. package/src/session-context.ts +90 -0
  264. package/src/timeline/activity-rail.tsx +19 -3
  265. package/src/timeline/index.ts +3 -0
  266. package/src/timeline/parsers.ts +14 -1
  267. package/src/timeline/projection.ts +211 -14
  268. package/src/timeline/registry.ts +13 -1
  269. package/src/timeline/screenshot-lightbox.tsx +19 -9
  270. package/src/timeline/shared.tsx +56 -8
  271. package/src/timeline/tool-renderers.tsx +303 -50
  272. package/src/timeline/types.ts +55 -3
  273. package/styles/compiled.css +248 -15
  274. package/styles/index.css +15 -0
  275. package/styles/responsive.css +13 -1
  276. package/dist/chunk-EKZH6IDG.js.map +0 -1
  277. package/dist/chunk-FWXGSNXT.js.map +0 -1
  278. package/dist/chunk-LHLYWG5R.js.map +0 -1
  279. package/dist/chunk-O4VXOBGF.js.map +0 -1
  280. package/dist/chunk-XCNTXWBB.js.map +0 -1
  281. package/dist/fleet-decision-projection-SLNZMS42.js +0 -241
  282. package/dist/fleet-decision-projection-SLNZMS42.js.map +0 -1
  283. package/dist/queue-surface-implementation-U5JFG7HT.js.map +0 -1
  284. /package/dist/{chunk-I4MPFDRP.js.map → chunk-FWS3KC3Z.js.map} +0 -0
@@ -22,10 +22,288 @@ function toolDisplayName(name) {
22
22
  }
23
23
 
24
24
  // src/timeline/projection.ts
25
- var { default: fleetDecisionItem } = await import("./fleet-decision-projection-SLNZMS42.js");
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";
28
270
  var LANDMARK_ONLY_TOOL_LEAVES = /* @__PURE__ */ new Set(["memory_save", "memory_correct"]);
271
+ var TIMELINE_ANNOTATION_ANSI_SEQUENCE = new RegExp("\\u001B\\[[0-?]*[ -/]*[@-~]", "g");
272
+ function safeTimelineAnnotationJson(value) {
273
+ try {
274
+ return JSON.stringify(value) ?? "";
275
+ } catch {
276
+ return String(value ?? "");
277
+ }
278
+ }
279
+ function timelineAnnotationToolOutputValue(value, depth = 0) {
280
+ if (depth > 8 || value === null || value === void 0) {
281
+ return value == null ? "" : safeTimelineAnnotationJson(value);
282
+ }
283
+ if (typeof value === "string") return value;
284
+ if (typeof value !== "object" || Array.isArray(value)) {
285
+ return safeTimelineAnnotationJson(value);
286
+ }
287
+ const record = value;
288
+ if (record.type === "text" && typeof record.text === "string") return record.text;
289
+ if (Array.isArray(record.content)) {
290
+ const text = record.content.find(
291
+ (part) => part !== null && typeof part === "object" && part.type === "text" && typeof part.text === "string"
292
+ );
293
+ if (text) return text.text;
294
+ }
295
+ if ("structuredContent" in record) {
296
+ return timelineAnnotationToolOutputValue(record.structuredContent, depth + 1);
297
+ }
298
+ if ("result" in record) return timelineAnnotationToolOutputValue(record.result, depth + 1);
299
+ return safeTimelineAnnotationJson(value);
300
+ }
301
+ function timelineAnnotationToolOutputText(output) {
302
+ const raw = timelineAnnotationToolOutputValue(output);
303
+ const marker = raw.indexOf("\nOutput:\n");
304
+ 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, "");
305
+ return text.length > 0 ? text : null;
306
+ }
29
307
  function buildTimeline(events) {
30
308
  const items = [];
31
309
  const prescan = prescanTurnAnchors(events);
@@ -54,7 +332,7 @@ function buildTimeline(events) {
54
332
  }
55
333
  };
56
334
  for (const event of ordered) {
57
- const payload = asRecord(event.payload);
335
+ const payload = asRecord2(event.payload);
58
336
  const turnId = event.turnId ?? null;
59
337
  switch (event.type) {
60
338
  case "user.message": {
@@ -81,6 +359,15 @@ function buildTimeline(events) {
81
359
  kind: "user-message",
82
360
  id: event.id,
83
361
  text: voiceMessage?.text ?? stringValue(payload.text),
362
+ annotations: timelineAnnotations(payload.annotations),
363
+ annotationSource: {
364
+ kind: "user_message",
365
+ eventId: event.id,
366
+ eventType: "user.message",
367
+ sequence: event.sequence,
368
+ turnId,
369
+ text: voiceMessage?.text ?? stringValue(payload.text)
370
+ },
84
371
  ...voiceMessage ? { presentation: voiceMessage.presentation } : {},
85
372
  resources: resourceRefs(payload.resources),
86
373
  tools: toolRefs(payload.tools),
@@ -143,6 +430,14 @@ function buildTimeline(events) {
143
430
  }
144
431
  open.streaming = false;
145
432
  open.occurredAt = event.occurredAt;
433
+ open.annotationSource = text && open.text === text ? {
434
+ kind: "assistant_message",
435
+ eventId: event.id,
436
+ eventType: "agent.message.completed",
437
+ sequence: event.sequence,
438
+ turnId,
439
+ text
440
+ } : void 0;
146
441
  if (openIndex < items.length - 1) {
147
442
  items.splice(openIndex, 1);
148
443
  items.push(open);
@@ -156,7 +451,15 @@ function buildTimeline(events) {
156
451
  turnId,
157
452
  text,
158
453
  streaming: false,
159
- occurredAt: event.occurredAt
454
+ occurredAt: event.occurredAt,
455
+ annotationSource: {
456
+ kind: "assistant_message",
457
+ eventId: event.id,
458
+ eventType: "agent.message.completed",
459
+ sequence: event.sequence,
460
+ turnId,
461
+ text
462
+ }
160
463
  });
161
464
  }
162
465
  break;
@@ -227,6 +530,7 @@ function buildTimeline(events) {
227
530
  name,
228
531
  arguments: args,
229
532
  output: void 0,
533
+ truncation: null,
230
534
  // The provider-native item drives the per-tool renderers (apply_patch
231
535
  // operation, computer_call action, web_search providerData, …).
232
536
  raw: payload.raw,
@@ -246,8 +550,24 @@ function buildTimeline(events) {
246
550
  target.workerSessionId = target.workerSessionId ?? extractSessionRef(payload.output);
247
551
  break;
248
552
  }
553
+ const truncation = toolCallTruncation(payload);
249
554
  target.status = isErrorOutput(payload) ? "failed" : "complete";
250
- target.output = payload.output;
555
+ target.output = Object.prototype.hasOwnProperty.call(payload, "output") ? payload.output : truncation && typeof payload.preview === "string" ? payload.preview : payload.output;
556
+ target.truncation = truncation;
557
+ const sourceText = timelineAnnotationToolOutputText(
558
+ Object.prototype.hasOwnProperty.call(payload, "output") ? payload.output : payload.preview
559
+ );
560
+ if (sourceText !== null) {
561
+ target.annotationSource = {
562
+ kind: "tool_output",
563
+ eventId: event.id,
564
+ eventType: "agent.toolCall.output",
565
+ sequence: event.sequence,
566
+ turnId,
567
+ text: sourceText,
568
+ label: target.name
569
+ };
570
+ }
251
571
  break;
252
572
  }
253
573
  case "sandbox.operation.started":
@@ -385,6 +705,7 @@ ${message}` : message;
385
705
  }
386
706
  case "tool.auth_needed":
387
707
  case "credential.auth_needed": {
708
+ const capability = capabilityAuthorizationRequest(payload.capability);
388
709
  if (event.type === "tool.auth_needed" && !stringValue(payload.toolName) && stringValue(payload.serverId) !== "codex_apps") {
389
710
  break;
390
711
  }
@@ -394,7 +715,7 @@ ${message}` : message;
394
715
  id: event.id,
395
716
  turnId,
396
717
  serverId: typeof payload.serverId === "string" ? payload.serverId : null,
397
- source: event.type === "tool.auth_needed" ? "tool" : "credential",
718
+ source: capability ? "capability" : event.type === "tool.auth_needed" ? "tool" : "credential",
398
719
  providerDomain: stringValue(payload.providerDomain),
399
720
  connectionId: typeof payload.connectionId === "string" ? payload.connectionId : null,
400
721
  reason: authNeededReason(payload.reason),
@@ -402,6 +723,7 @@ ${message}` : message;
402
723
  resource: typeof payload.resource === "string" ? payload.resource : null,
403
724
  toolName: typeof payload.toolName === "string" ? payload.toolName : null,
404
725
  authorizationUrl: typeof payload.authorizationUrl === "string" ? payload.authorizationUrl : null,
726
+ capability,
405
727
  occurredAt: event.occurredAt
406
728
  });
407
729
  break;
@@ -509,7 +831,7 @@ ${message}` : message;
509
831
  return items;
510
832
  }
511
833
  function realtimeVoiceMessage(payload) {
512
- const presentation = asRecord(payload.presentation);
834
+ const presentation = asRecord2(payload.presentation);
513
835
  const visibleText = stringValue(payload.text);
514
836
  if (presentation.kind === "realtime_voice" || presentation.kind === "realtime_voice_handoff") {
515
837
  const context = stringValue(presentation.context);
@@ -518,7 +840,7 @@ function realtimeVoiceMessage(payload) {
518
840
  return null;
519
841
  }
520
842
  function providerNativeToolStatus(rawValue) {
521
- const raw = asRecord(rawValue);
843
+ const raw = asRecord2(rawValue);
522
844
  if (raw.type !== "hosted_tool_call") {
523
845
  return "running";
524
846
  }
@@ -535,13 +857,13 @@ function providerNativeToolStatus(rawValue) {
535
857
  }
536
858
  }
537
859
  function mergeToolCallRaw(existingValue, nextValue) {
538
- const existing = asRecord(existingValue);
539
- const next = asRecord(nextValue);
860
+ const existing = asRecord2(existingValue);
861
+ const next = asRecord2(nextValue);
540
862
  if (Object.keys(next).length === 0) {
541
863
  return existingValue;
542
864
  }
543
- const existingProvider = asRecord(existing.providerData);
544
- const nextProvider = asRecord(next.providerData);
865
+ const existingProvider = asRecord2(existing.providerData);
866
+ const nextProvider = asRecord2(next.providerData);
545
867
  const providerData = {
546
868
  ...existingProvider,
547
869
  ...nextProvider
@@ -572,7 +894,7 @@ function creditExhaustedFromEvents(events) {
572
894
  if (event?.type !== "turn.completed" && event?.type !== "turn.failed" && event?.type !== "turn.cancelled") {
573
895
  continue;
574
896
  }
575
- return isCreditExhaustionPayload(asRecord(event.payload));
897
+ return isCreditExhaustionPayload(asRecord2(event.payload));
576
898
  }
577
899
  return false;
578
900
  }
@@ -582,7 +904,7 @@ function sessionStatusFromEvents(events) {
582
904
  if (event?.type !== "session.status.changed") {
583
905
  continue;
584
906
  }
585
- const status = asRecord(event.payload).status;
907
+ const status = asRecord2(event.payload).status;
586
908
  if (isSessionStatus(status)) {
587
909
  return status;
588
910
  }
@@ -635,7 +957,7 @@ function prescanTurnAnchors(events) {
635
957
  const fallbackSeqByTurn = /* @__PURE__ */ new Map();
636
958
  const startedTurnIds = /* @__PURE__ */ new Set();
637
959
  for (const event of ordered) {
638
- const payload = asRecord(event.payload);
960
+ const payload = asRecord2(event.payload);
639
961
  const turnId = event.turnId ?? null;
640
962
  if (event.type === "turn.queued") {
641
963
  const triggerEventId = typeof payload.triggerEventId === "string" ? payload.triggerEventId : null;
@@ -877,7 +1199,7 @@ function groupStartedAt(group) {
877
1199
  return group.startedAt;
878
1200
  }
879
1201
  }
880
- function asRecord(value) {
1202
+ function asRecord2(value) {
881
1203
  return value !== null && typeof value === "object" ? value : {};
882
1204
  }
883
1205
  function stringValue(value) {
@@ -928,7 +1250,8 @@ function machineInputMembers(value) {
928
1250
  "goal_continuation",
929
1251
  "agent_message",
930
1252
  "agent_steer_instruction",
931
- "child_terminal_result"
1253
+ "child_terminal_result",
1254
+ "media_generation_result"
932
1255
  ]);
933
1256
  const classifications = /* @__PURE__ */ new Set([
934
1257
  "success",
@@ -937,18 +1260,23 @@ function machineInputMembers(value) {
937
1260
  "info"
938
1261
  ]);
939
1262
  return Array.isArray(value) ? value.flatMap((candidate) => {
940
- const member = asRecord(candidate);
1263
+ const member = asRecord2(candidate);
941
1264
  return typeof member.id === "string" && typeof member.kind === "string" && kinds.has(member.kind) && typeof member.classification === "string" && classifications.has(
942
1265
  member.classification
943
- ) && typeof member.sourceId === "string" ? [
944
- {
945
- id: member.id,
946
- kind: member.kind,
947
- classification: member.classification,
948
- sourceId: member.sourceId,
949
- summary: stringValue(member.summary)
950
- }
951
- ] : [];
1266
+ ) && typeof member.sourceId === "string" ? (() => {
1267
+ const kind = member.kind;
1268
+ const result = kind === "media_generation_result" ? parseMediaGenerationResult(member.result) : null;
1269
+ return [
1270
+ {
1271
+ id: member.id,
1272
+ kind,
1273
+ classification: member.classification,
1274
+ sourceId: member.sourceId,
1275
+ summary: stringValue(member.summary),
1276
+ ...result ? { result } : {}
1277
+ }
1278
+ ];
1279
+ })() : [];
952
1280
  }) : [];
953
1281
  }
954
1282
  var SESSION_STATUSES = [
@@ -969,29 +1297,37 @@ function resourceRefs(value) {
969
1297
  return [];
970
1298
  }
971
1299
  return value.filter((entry) => {
972
- const record = asRecord(entry);
1300
+ const record = asRecord2(entry);
973
1301
  if (record.kind === "repository") {
974
1302
  return typeof record.uri === "string" && typeof record.ref === "string";
975
1303
  }
976
1304
  return record.kind === "file" && typeof record.fileId === "string";
977
1305
  });
978
1306
  }
1307
+ function timelineAnnotations(value) {
1308
+ if (!Array.isArray(value)) return [];
1309
+ return value.filter((candidate) => {
1310
+ const annotation = asRecord2(candidate);
1311
+ const source = asRecord2(annotation.source);
1312
+ 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";
1313
+ });
1314
+ }
979
1315
  function toolRefs(value) {
980
1316
  if (!Array.isArray(value)) {
981
1317
  return [];
982
1318
  }
983
1319
  return value.filter((entry) => {
984
- const record = asRecord(entry);
1320
+ const record = asRecord2(entry);
985
1321
  return record.kind === "mcp" && typeof record.id === "string";
986
1322
  });
987
1323
  }
988
1324
  function workerCompletionPayload(value) {
989
- const payload = asRecord(value);
1325
+ const payload = asRecord2(value);
990
1326
  const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
991
1327
  if (typeof payload.childSessionId !== "string" || !uuidPattern.test(payload.childSessionId) || typeof payload.status !== "string" || payload.status.trim() === "") {
992
1328
  return null;
993
1329
  }
994
- const goal = asRecord(payload.goal);
1330
+ const goal = asRecord2(payload.goal);
995
1331
  return {
996
1332
  childSessionId: payload.childSessionId,
997
1333
  childStatus: payload.status,
@@ -1014,6 +1350,25 @@ function isErrorOutput(payload) {
1014
1350
  const output = payload.output;
1015
1351
  return !!output && typeof output === "object" && output.isError === true;
1016
1352
  }
1353
+ function toolCallTruncation(payload) {
1354
+ const truncation = asRecord2(payload.truncation);
1355
+ const fullEvidence = asRecord2(truncation.fullEvidence);
1356
+ const surface = stringValue(truncation.surface);
1357
+ const reason = stringValue(truncation.reason);
1358
+ if (truncation.truncated !== true || !surface || !reason || typeof fullEvidence.available !== "boolean") {
1359
+ return null;
1360
+ }
1361
+ return {
1362
+ truncated: true,
1363
+ surface,
1364
+ reason,
1365
+ omittedBytes: numberOrNull(truncation.omittedBytes),
1366
+ fullEvidence: {
1367
+ available: fullEvidence.available,
1368
+ reason: stringValue(fullEvidence.reason) || null
1369
+ }
1370
+ };
1371
+ }
1017
1372
  function findOpenCall(items, callId) {
1018
1373
  const reversed = [...items].reverse();
1019
1374
  const isCall = (item) => item.kind === "tool-call" || item.kind === "worker";
@@ -1045,7 +1400,7 @@ function goalText(payload) {
1045
1400
  if (typeof payload.text === "string" && payload.text) {
1046
1401
  return payload.text;
1047
1402
  }
1048
- const goal = asRecord(payload.goal);
1403
+ const goal = asRecord2(payload.goal);
1049
1404
  if (typeof goal.text === "string" && goal.text) {
1050
1405
  return goal.text;
1051
1406
  }
@@ -1098,25 +1453,46 @@ var AUTH_NEEDED_REASONS = /* @__PURE__ */ new Set([
1098
1453
  function authNeededReason(value) {
1099
1454
  return typeof value === "string" && AUTH_NEEDED_REASONS.has(value) ? value : null;
1100
1455
  }
1456
+ function capabilityAuthorizationRequest(value) {
1457
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
1458
+ const record = value;
1459
+ const kind = record.kind;
1460
+ const source = record.source;
1461
+ const action = record.action;
1462
+ 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(
1463
+ String(source)
1464
+ ) || !["connect", "add_credentials", "enable"].includes(String(action)) || typeof record.rationale !== "string") {
1465
+ return null;
1466
+ }
1467
+ return {
1468
+ id: record.id,
1469
+ name: record.name,
1470
+ kind,
1471
+ source,
1472
+ action,
1473
+ rationale: record.rationale,
1474
+ requiredVariables: stringList(record.requiredVariables)
1475
+ };
1476
+ }
1101
1477
  function stringList(value) {
1102
1478
  return Array.isArray(value) ? value.filter((entry) => typeof entry === "string" && entry.trim().length > 0) : [];
1103
1479
  }
1104
1480
  function reasoningText(payload) {
1105
- const record = asRecord(payload);
1481
+ const record = asRecord2(payload);
1106
1482
  if (typeof record.text === "string") {
1107
1483
  return record.text;
1108
1484
  }
1109
- const content = asRecord(asRecord(record.item).rawItem).content;
1485
+ const content = asRecord2(asRecord2(record.item).rawItem).content;
1110
1486
  if (!Array.isArray(content)) {
1111
1487
  return "";
1112
1488
  }
1113
1489
  return content.map((part) => {
1114
- const text = asRecord(part).text;
1490
+ const text = asRecord2(part).text;
1115
1491
  return stringValue(text);
1116
1492
  }).join("");
1117
1493
  }
1118
1494
  function workerPrompt(args) {
1119
- const record = asRecord(typeof args === "string" ? tryParseJson(args) : args);
1495
+ const record = asRecord2(typeof args === "string" ? tryParseJson(args) : args);
1120
1496
  for (const key of ["initialMessage", "message", "text", "prompt"]) {
1121
1497
  const value = record[key];
1122
1498
  if (typeof value === "string" && value.trim().length > 0) {
@@ -1145,7 +1521,7 @@ function extractSessionRef(value, depth = 0) {
1145
1521
  return null;
1146
1522
  }
1147
1523
  const record = value;
1148
- const receiptResource = asRecord(record.resource);
1524
+ const receiptResource = asRecord2(record.resource);
1149
1525
  if (record.receiptVersion === "mcp-mutation-receipt.v1" && receiptResource.type === "session" && typeof receiptResource.id === "string" && looksLikeId(receiptResource.id)) {
1150
1526
  return receiptResource.id;
1151
1527
  }
@@ -1181,4 +1557,4 @@ export {
1181
1557
  groupTimeline,
1182
1558
  extractSessionRef
1183
1559
  };
1184
- //# sourceMappingURL=chunk-LHLYWG5R.js.map
1560
+ //# sourceMappingURL=chunk-JR3QFY6B.js.map