@opengeni/react 0.46.1 → 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 (341) hide show
  1. package/README.md +158 -14
  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-HFO4ERGQ.js → chunk-724BW4TW.js} +586 -35
  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-U3CSCMWA.js → chunk-FK6VG4LL.js} +9 -13
  23. package/dist/chunk-FK6VG4LL.js.map +1 -0
  24. package/dist/{chunk-SRFUT2ZU.js → chunk-FWS3KC3Z.js} +120 -64
  25. package/dist/chunk-FWS3KC3Z.js.map +1 -0
  26. package/dist/{chunk-EKZH6IDG.js → chunk-HDBG7XGO.js} +62 -1
  27. package/dist/chunk-HDBG7XGO.js.map +1 -0
  28. package/dist/chunk-HUIKIDM5.js +2148 -0
  29. package/dist/chunk-HUIKIDM5.js.map +1 -0
  30. package/dist/{chunk-LGVMUIRV.js → chunk-JAGDUCZQ.js} +1053 -390
  31. package/dist/chunk-JAGDUCZQ.js.map +1 -0
  32. package/dist/{chunk-LWR4MXSS.js → chunk-JR3QFY6B.js} +420 -35
  33. package/dist/chunk-JR3QFY6B.js.map +1 -0
  34. package/dist/chunk-JVYQRRC4.js +53 -0
  35. package/dist/chunk-JVYQRRC4.js.map +1 -0
  36. package/dist/chunk-KCGXPP5V.js +157 -0
  37. package/dist/chunk-KCGXPP5V.js.map +1 -0
  38. package/dist/{chunk-EB67J347.js → chunk-KZ73RL76.js} +111 -31
  39. package/dist/chunk-KZ73RL76.js.map +1 -0
  40. package/dist/chunk-PEI6RANI.js +3234 -0
  41. package/dist/chunk-PEI6RANI.js.map +1 -0
  42. package/dist/{chunk-3PB7MIT6.js → chunk-ROIRTM37.js} +220 -72
  43. package/dist/chunk-ROIRTM37.js.map +1 -0
  44. package/dist/chunk-VZTQ73XT.js +86 -0
  45. package/dist/chunk-VZTQ73XT.js.map +1 -0
  46. package/dist/{chunk-VCBFUSUZ.js → chunk-WSK7G5LE.js} +72 -4
  47. package/dist/chunk-WSK7G5LE.js.map +1 -0
  48. package/dist/{chunk-FGZUCXZF.js → chunk-WYA65Y3F.js} +16 -16
  49. package/dist/chunk-WYA65Y3F.js.map +1 -0
  50. package/dist/{chunk-6EDV6YFE.js → chunk-X4S56Y2H.js} +147 -35
  51. package/dist/chunk-X4S56Y2H.js.map +1 -0
  52. package/dist/client.d.ts +7 -1
  53. package/dist/clipboard.d.ts +1 -0
  54. package/dist/clipboard.js +7 -0
  55. package/dist/clipboard.js.map +1 -0
  56. package/dist/commands/index.d.ts +3 -3
  57. package/dist/commands/registry.d.ts +1 -1
  58. package/dist/commands/types.d.ts +1 -1
  59. package/dist/components/approval-surface.d.ts +2 -2
  60. package/dist/components/artifacts/artifact-surface.d.ts +18 -0
  61. package/dist/components/artifacts/document-editor.d.ts +172 -0
  62. package/dist/components/artifacts/editable-artifact-ui.d.ts +13 -0
  63. package/dist/components/artifacts/editable-artifact-workbench.d.ts +49 -0
  64. package/dist/components/artifacts/editable-document.d.ts +24 -0
  65. package/dist/components/artifacts/editable-presentation.d.ts +24 -0
  66. package/dist/components/artifacts/editable-spreadsheet.d.ts +32 -0
  67. package/dist/components/artifacts/index.d.ts +8 -0
  68. package/dist/components/artifacts/presentation-editor.d.ts +297 -0
  69. package/dist/components/artifacts/spreadsheet-canvas.d.ts +120 -0
  70. package/dist/components/artifacts/spreadsheet-grid.d.ts +113 -0
  71. package/dist/components/browser-viewer.d.ts +29 -0
  72. package/dist/components/chat-composer.d.ts +13 -8
  73. package/dist/components/code-editor.d.ts +25 -3
  74. package/dist/components/command-palette.d.ts +2 -2
  75. package/dist/components/composer-transcription-control.d.ts +4 -2
  76. package/dist/components/composer.d.ts +29 -15
  77. package/dist/components/computer-viewer.d.ts +23 -0
  78. package/dist/components/copy-button.d.ts +2 -2
  79. package/dist/components/desktop-viewer.d.ts +25 -21
  80. package/dist/components/diff-view.d.ts +1 -1
  81. package/dist/components/enrollment-consent.d.ts +1 -1
  82. package/dist/components/enrollment-device-flow.d.ts +1 -1
  83. package/dist/components/file-browser.d.ts +2 -2
  84. package/dist/components/fleet-tile.d.ts +1 -1
  85. package/dist/components/generated-video-player.d.ts +10 -0
  86. package/dist/components/human-input-form.d.ts +1 -1
  87. package/dist/components/human-input-surface.d.ts +2 -2
  88. package/dist/components/interactive-workbench-viewers.d.ts +2 -0
  89. package/dist/components/machine-card.d.ts +2 -2
  90. package/dist/components/machine-dock-bar.d.ts +3 -3
  91. package/dist/components/machine-health-pill.d.ts +2 -2
  92. package/dist/components/machine-input-display.d.ts +1 -1
  93. package/dist/components/machine-metrics.d.ts +2 -2
  94. package/dist/components/machine-status-pill.d.ts +4 -4
  95. package/dist/components/machines/health.d.ts +1 -1
  96. package/dist/components/machines/machine-detail.d.ts +5 -3
  97. package/dist/components/machines/metric-history-chart.d.ts +1 -1
  98. package/dist/components/machines/metric-sparkline.d.ts +2 -2
  99. package/dist/components/machines/series.d.ts +2 -2
  100. package/dist/components/machines-dashboard.d.ts +5 -5
  101. package/dist/components/markdown.d.ts +1 -1
  102. package/dist/components/message-timeline.d.ts +22 -5
  103. package/dist/components/model-picker.d.ts +2 -2
  104. package/dist/components/model-policy-picker.d.ts +7 -7
  105. package/dist/components/pierre-diff.d.ts +1 -1
  106. package/dist/components/pierre-file.d.ts +1 -1
  107. package/dist/components/queue-draft-policy.d.ts +1 -1
  108. package/dist/components/queue-surface-implementation.d.ts +3 -3
  109. package/dist/components/queue-surface-state.d.ts +4 -4
  110. package/dist/components/queue-surface.d.ts +5 -5
  111. package/dist/components/sandbox-files.d.ts +5 -5
  112. package/dist/components/sandbox-terminal.d.ts +50 -4
  113. package/dist/components/sandbox-workspace.d.ts +30 -10
  114. package/dist/components/session-chrome.d.ts +4 -4
  115. package/dist/components/session-status.d.ts +2 -2
  116. package/dist/components/timeline-annotation-selection.d.ts +9 -0
  117. package/dist/components/timeline-annotations-dialog.d.ts +16 -0
  118. package/dist/components/timeline-annotations.d.ts +13 -0
  119. package/dist/components/tooltip.d.ts +4 -4
  120. package/dist/components/user-message-body.d.ts +2 -2
  121. package/dist/components/workbench-changes.d.ts +2 -2
  122. package/dist/components/workspace-dock.d.ts +3 -1
  123. package/dist/composer.d.ts +11 -11
  124. package/dist/composer.js +7 -7
  125. package/dist/hooks/internal.d.ts +7 -1
  126. package/dist/hooks/use-attached-browsers.d.ts +21 -0
  127. package/dist/hooks/use-available-models.d.ts +2 -2
  128. package/dist/hooks/use-billing-usage.d.ts +1 -1
  129. package/dist/hooks/use-browser-frame-stream.d.ts +28 -0
  130. package/dist/hooks/use-browser-identities.d.ts +26 -0
  131. package/dist/hooks/use-browser-session.d.ts +28 -0
  132. package/dist/hooks/use-browser-sessions.d.ts +32 -0
  133. package/dist/hooks/use-codex-accounts.d.ts +3 -3
  134. package/dist/hooks/use-composer.d.ts +36 -9
  135. package/dist/hooks/use-computer-frame-stream.d.ts +24 -0
  136. package/dist/hooks/use-computer-session.d.ts +28 -0
  137. package/dist/hooks/use-computer-sessions.d.ts +28 -0
  138. package/dist/hooks/use-desktop-stream.d.ts +1 -1
  139. package/dist/hooks/use-environments.d.ts +11 -5
  140. package/dist/hooks/use-file-attachments.d.ts +1 -1
  141. package/dist/hooks/use-goal.d.ts +2 -2
  142. package/dist/hooks/use-human-input.d.ts +2 -2
  143. package/dist/hooks/use-last-started-turn-policy.d.ts +2 -2
  144. package/dist/hooks/use-machine-chip.d.ts +2 -2
  145. package/dist/hooks/use-machines.d.ts +10 -3
  146. package/dist/hooks/use-packs.d.ts +7 -2
  147. package/dist/hooks/use-rigs.d.ts +1 -1
  148. package/dist/hooks/use-sandbox-files.d.ts +25 -4
  149. package/dist/hooks/use-sandbox-git.d.ts +13 -5
  150. package/dist/hooks/use-sandbox-terminal.d.ts +1 -1
  151. package/dist/hooks/use-scheduled-tasks.d.ts +1 -1
  152. package/dist/hooks/use-session-capabilities.d.ts +5 -4
  153. package/dist/hooks/use-session-control.d.ts +1 -1
  154. package/dist/hooks/use-session-events.d.ts +2 -2
  155. package/dist/hooks/use-session-lineage.d.ts +1 -1
  156. package/dist/hooks/use-session-mcp-approval-policy.d.ts +2 -2
  157. package/dist/hooks/use-session.d.ts +2 -2
  158. package/dist/hooks/use-slash-commands.d.ts +1 -1
  159. package/dist/hooks/use-terminal-stream.d.ts +8 -2
  160. package/dist/hooks/use-transcription.d.ts +2 -2
  161. package/dist/hooks/use-turn-queue.d.ts +2 -2
  162. package/dist/hooks/use-video-artifact-playback.d.ts +9 -0
  163. package/dist/hooks/use-voice-input.d.ts +6 -4
  164. package/dist/hooks/use-workspace-capture.d.ts +1 -1
  165. package/dist/hooks/use-workspace-edit.d.ts +1 -1
  166. package/dist/hooks/use-workspace-sessions.d.ts +1 -1
  167. package/dist/hooks/use-workspaces.d.ts +1 -1
  168. package/dist/index.d.ts +158 -154
  169. package/dist/index.js +1718 -908
  170. package/dist/index.js.map +1 -1
  171. package/dist/interaction.d.ts +23 -0
  172. package/dist/interaction.js +36 -0
  173. package/dist/interaction.js.map +1 -0
  174. package/dist/interactive-workbench-viewers-KHNOHWQE.js +13 -0
  175. package/dist/interactive-workbench-viewers-KHNOHWQE.js.map +1 -0
  176. package/dist/lib/composer-responsive-context.d.ts +9 -0
  177. package/dist/lib/relay-wire.d.ts +4 -0
  178. package/dist/lib/sandbox-liveness.d.ts +9 -0
  179. package/dist/lib/terminal-capability.d.ts +5 -0
  180. package/dist/lib/use-portal-token-style.d.ts +14 -3
  181. package/dist/lib/xterm-theme.d.ts +1 -1
  182. package/dist/machines.d.ts +30 -30
  183. package/dist/machines.js +3 -3
  184. package/dist/provider.d.ts +4 -4
  185. package/dist/{queue-surface-implementation-J4XJFKRW.js → queue-surface-implementation-2KVJTYXH.js} +117 -64
  186. package/dist/queue-surface-implementation-2KVJTYXH.js.map +1 -0
  187. package/dist/realtime/dropdown-menu.d.ts +8 -8
  188. package/dist/realtime/realtime-control.d.ts +15 -6
  189. package/dist/realtime.d.ts +4 -4
  190. package/dist/realtime.js +30 -33
  191. package/dist/realtime.js.map +1 -1
  192. package/dist/session-context.d.ts +19 -1
  193. package/dist/session-ui.d.ts +14 -14
  194. package/dist/session-ui.js +6 -5
  195. package/dist/session.d.ts +28 -28
  196. package/dist/session.js +5 -5
  197. package/dist/timeline/activity-rail.d.ts +6 -3
  198. package/dist/timeline/disclosure-context.d.ts +1 -1
  199. package/dist/timeline/fleet-decision-projection.d.ts +1 -1
  200. package/dist/timeline/fleet-decision-row.d.ts +3 -3
  201. package/dist/timeline/index.d.ts +19 -19
  202. package/dist/timeline/parsers.d.ts +6 -3
  203. package/dist/timeline/projection.d.ts +3 -3
  204. package/dist/timeline/registry.d.ts +10 -1
  205. package/dist/timeline/screenshot-lightbox.d.ts +2 -2
  206. package/dist/timeline/shared.d.ts +21 -10
  207. package/dist/timeline/tool-diff.d.ts +2 -2
  208. package/dist/timeline/tool-renderers.d.ts +1 -1
  209. package/dist/timeline/turn-summary.d.ts +3 -3
  210. package/dist/timeline/types.d.ts +42 -2
  211. package/dist/timeline-annotation-selection-3L7LHGG2.js +187 -0
  212. package/dist/timeline-annotation-selection-3L7LHGG2.js.map +1 -0
  213. package/dist/timeline-annotations-dialog-U7EVLR75.js +196 -0
  214. package/dist/timeline-annotations-dialog-U7EVLR75.js.map +1 -0
  215. package/dist/voice-recording-store.d.ts +8 -2
  216. package/package.json +52 -7
  217. package/src/artifacts-document.ts +31 -0
  218. package/src/artifacts-presentation.ts +36 -0
  219. package/src/artifacts-spreadsheet.ts +21 -0
  220. package/src/artifacts.ts +86 -0
  221. package/src/client.ts +90 -1
  222. package/src/clipboard.ts +2 -0
  223. package/src/components/artifacts/artifact-surface.tsx +93 -0
  224. package/src/components/artifacts/document-editor.tsx +2255 -0
  225. package/src/components/artifacts/editable-artifact-ui.tsx +89 -0
  226. package/src/components/artifacts/editable-artifact-workbench.tsx +203 -0
  227. package/src/components/artifacts/editable-document.tsx +657 -0
  228. package/src/components/artifacts/editable-presentation.tsx +1020 -0
  229. package/src/components/artifacts/editable-spreadsheet.tsx +733 -0
  230. package/src/components/artifacts/index.ts +99 -0
  231. package/src/components/artifacts/presentation-editor.tsx +3148 -0
  232. package/src/components/artifacts/spreadsheet-canvas.ts +799 -0
  233. package/src/components/artifacts/spreadsheet-grid.tsx +2129 -0
  234. package/src/components/browser-viewer.tsx +1592 -0
  235. package/src/components/chat-composer.tsx +25 -2
  236. package/src/components/code-editor.tsx +90 -31
  237. package/src/components/command-palette.tsx +1 -1
  238. package/src/components/composer-transcription-control.tsx +51 -22
  239. package/src/components/composer.tsx +49 -23
  240. package/src/components/computer-viewer.tsx +1139 -0
  241. package/src/components/copy-button.tsx +1 -1
  242. package/src/components/desktop-viewer.tsx +103 -75
  243. package/src/components/file-browser.tsx +39 -17
  244. package/src/components/generated-video-player.tsx +89 -0
  245. package/src/components/human-input-form.tsx +2 -2
  246. package/src/components/interactive-workbench-viewers.ts +2 -0
  247. package/src/components/machine-card.tsx +1 -1
  248. package/src/components/machine-input-display.ts +3 -0
  249. package/src/components/machines/machine-detail.tsx +39 -15
  250. package/src/components/machines-dashboard.tsx +7 -6
  251. package/src/components/message-timeline.tsx +327 -37
  252. package/src/components/model-picker.tsx +2 -2
  253. package/src/components/model-policy-picker.tsx +16 -15
  254. package/src/components/queue-surface-implementation.tsx +135 -75
  255. package/src/components/queue-surface-state.tsx +2 -2
  256. package/src/components/sandbox-files.tsx +142 -62
  257. package/src/components/sandbox-terminal.tsx +119 -35
  258. package/src/components/sandbox-workspace.tsx +394 -228
  259. package/src/components/session-chrome.tsx +67 -27
  260. package/src/components/timeline-annotation-selection.tsx +221 -0
  261. package/src/components/timeline-annotations-dialog.tsx +213 -0
  262. package/src/components/timeline-annotations.tsx +84 -0
  263. package/src/components/tooltip.tsx +13 -16
  264. package/src/components/user-message-body.tsx +1 -1
  265. package/src/components/workbench-changes.tsx +192 -35
  266. package/src/components/workspace-dock.tsx +13 -5
  267. package/src/composer.ts +3 -0
  268. package/src/hooks/internal.ts +132 -38
  269. package/src/hooks/use-attached-browsers.ts +152 -0
  270. package/src/hooks/use-browser-frame-stream.ts +316 -0
  271. package/src/hooks/use-browser-identities.ts +225 -0
  272. package/src/hooks/use-browser-session.ts +476 -0
  273. package/src/hooks/use-browser-sessions.ts +281 -0
  274. package/src/hooks/use-codex-accounts.ts +4 -4
  275. package/src/hooks/use-composer.ts +769 -24
  276. package/src/hooks/use-computer-frame-stream.ts +311 -0
  277. package/src/hooks/use-computer-session.ts +442 -0
  278. package/src/hooks/use-computer-sessions.ts +245 -0
  279. package/src/hooks/use-environments.ts +24 -5
  280. package/src/hooks/use-file-attachments.ts +70 -32
  281. package/src/hooks/use-goal.ts +17 -5
  282. package/src/hooks/use-machine-chip.ts +5 -3
  283. package/src/hooks/use-machines.ts +79 -3
  284. package/src/hooks/use-packs.ts +51 -0
  285. package/src/hooks/use-sandbox-files.ts +382 -88
  286. package/src/hooks/use-sandbox-git.ts +208 -46
  287. package/src/hooks/use-sandbox-terminal.ts +3 -2
  288. package/src/hooks/use-session-capabilities.ts +94 -70
  289. package/src/hooks/use-session-events.ts +18 -4
  290. package/src/hooks/use-terminal-stream.ts +102 -23
  291. package/src/hooks/use-transcription.ts +4 -14
  292. package/src/hooks/use-turn-queue.ts +17 -5
  293. package/src/hooks/use-video-artifact-playback.ts +28 -0
  294. package/src/hooks/use-voice-input.ts +163 -19
  295. package/src/hooks/use-windowed-sections.ts +9 -7
  296. package/src/hooks/use-workspace-edit.ts +2 -1
  297. package/src/index.ts +21 -6
  298. package/src/interaction.ts +71 -0
  299. package/src/lib/composer-responsive-context.ts +15 -0
  300. package/src/lib/relay-wire.ts +4 -0
  301. package/src/lib/sandbox-liveness.ts +11 -0
  302. package/src/lib/terminal-capability.ts +10 -0
  303. package/src/lib/use-portal-token-style.ts +60 -15
  304. package/src/provider.tsx +52 -7
  305. package/src/realtime/dropdown-menu.tsx +15 -19
  306. package/src/realtime/realtime-control.tsx +16 -5
  307. package/src/session-context.ts +90 -0
  308. package/src/timeline/activity-rail.tsx +31 -6
  309. package/src/timeline/index.ts +4 -1
  310. package/src/timeline/parsers.ts +46 -20
  311. package/src/timeline/projection.ts +233 -13
  312. package/src/timeline/registry.ts +19 -0
  313. package/src/timeline/screenshot-lightbox.tsx +30 -9
  314. package/src/timeline/shared.tsx +59 -11
  315. package/src/timeline/tool-renderers.tsx +421 -24
  316. package/src/timeline/turn-summary.tsx +2 -2
  317. package/src/timeline/types.ts +58 -2
  318. package/src/voice-recording-store.ts +15 -0
  319. package/styles/compiled.css +5298 -0
  320. package/styles/compiled.d.ts +2 -0
  321. package/styles/effective-tokens.css +27 -0
  322. package/styles/index.css +18 -0
  323. package/styles/responsive.css +208 -0
  324. package/styles/responsive.d.ts +2 -0
  325. package/styles/tokens.css +50 -17
  326. package/dist/chunk-3PB7MIT6.js.map +0 -1
  327. package/dist/chunk-6EDV6YFE.js.map +0 -1
  328. package/dist/chunk-EB67J347.js.map +0 -1
  329. package/dist/chunk-EKZH6IDG.js.map +0 -1
  330. package/dist/chunk-FGZUCXZF.js.map +0 -1
  331. package/dist/chunk-HFO4ERGQ.js.map +0 -1
  332. package/dist/chunk-JB5725BI.js +0 -48
  333. package/dist/chunk-JB5725BI.js.map +0 -1
  334. package/dist/chunk-LGVMUIRV.js.map +0 -1
  335. package/dist/chunk-LWR4MXSS.js.map +0 -1
  336. package/dist/chunk-SRFUT2ZU.js.map +0 -1
  337. package/dist/chunk-U3CSCMWA.js.map +0 -1
  338. package/dist/chunk-VCBFUSUZ.js.map +0 -1
  339. package/dist/fleet-decision-projection-SLNZMS42.js +0 -241
  340. package/dist/fleet-decision-projection-SLNZMS42.js.map +0 -1
  341. package/dist/queue-surface-implementation-J4XJFKRW.js.map +0 -1
@@ -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,11 +705,17 @@ ${message}` : message;
385
705
  }
386
706
  case "tool.auth_needed":
387
707
  case "credential.auth_needed": {
708
+ const capability = capabilityAuthorizationRequest(payload.capability);
709
+ if (event.type === "tool.auth_needed" && !stringValue(payload.toolName) && stringValue(payload.serverId) !== "codex_apps") {
710
+ break;
711
+ }
388
712
  closeStreamingTail();
389
713
  items.push({
390
714
  kind: "auth-needed",
391
715
  id: event.id,
392
716
  turnId,
717
+ serverId: typeof payload.serverId === "string" ? payload.serverId : null,
718
+ source: capability ? "capability" : event.type === "tool.auth_needed" ? "tool" : "credential",
393
719
  providerDomain: stringValue(payload.providerDomain),
394
720
  connectionId: typeof payload.connectionId === "string" ? payload.connectionId : null,
395
721
  reason: authNeededReason(payload.reason),
@@ -397,6 +723,7 @@ ${message}` : message;
397
723
  resource: typeof payload.resource === "string" ? payload.resource : null,
398
724
  toolName: typeof payload.toolName === "string" ? payload.toolName : null,
399
725
  authorizationUrl: typeof payload.authorizationUrl === "string" ? payload.authorizationUrl : null,
726
+ capability,
400
727
  occurredAt: event.occurredAt
401
728
  });
402
729
  break;
@@ -504,7 +831,7 @@ ${message}` : message;
504
831
  return items;
505
832
  }
506
833
  function realtimeVoiceMessage(payload) {
507
- const presentation = asRecord(payload.presentation);
834
+ const presentation = asRecord2(payload.presentation);
508
835
  const visibleText = stringValue(payload.text);
509
836
  if (presentation.kind === "realtime_voice" || presentation.kind === "realtime_voice_handoff") {
510
837
  const context = stringValue(presentation.context);
@@ -513,7 +840,7 @@ function realtimeVoiceMessage(payload) {
513
840
  return null;
514
841
  }
515
842
  function providerNativeToolStatus(rawValue) {
516
- const raw = asRecord(rawValue);
843
+ const raw = asRecord2(rawValue);
517
844
  if (raw.type !== "hosted_tool_call") {
518
845
  return "running";
519
846
  }
@@ -530,13 +857,13 @@ function providerNativeToolStatus(rawValue) {
530
857
  }
531
858
  }
532
859
  function mergeToolCallRaw(existingValue, nextValue) {
533
- const existing = asRecord(existingValue);
534
- const next = asRecord(nextValue);
860
+ const existing = asRecord2(existingValue);
861
+ const next = asRecord2(nextValue);
535
862
  if (Object.keys(next).length === 0) {
536
863
  return existingValue;
537
864
  }
538
- const existingProvider = asRecord(existing.providerData);
539
- const nextProvider = asRecord(next.providerData);
865
+ const existingProvider = asRecord2(existing.providerData);
866
+ const nextProvider = asRecord2(next.providerData);
540
867
  const providerData = {
541
868
  ...existingProvider,
542
869
  ...nextProvider
@@ -567,7 +894,7 @@ function creditExhaustedFromEvents(events) {
567
894
  if (event?.type !== "turn.completed" && event?.type !== "turn.failed" && event?.type !== "turn.cancelled") {
568
895
  continue;
569
896
  }
570
- return isCreditExhaustionPayload(asRecord(event.payload));
897
+ return isCreditExhaustionPayload(asRecord2(event.payload));
571
898
  }
572
899
  return false;
573
900
  }
@@ -577,7 +904,7 @@ function sessionStatusFromEvents(events) {
577
904
  if (event?.type !== "session.status.changed") {
578
905
  continue;
579
906
  }
580
- const status = asRecord(event.payload).status;
907
+ const status = asRecord2(event.payload).status;
581
908
  if (isSessionStatus(status)) {
582
909
  return status;
583
910
  }
@@ -630,7 +957,7 @@ function prescanTurnAnchors(events) {
630
957
  const fallbackSeqByTurn = /* @__PURE__ */ new Map();
631
958
  const startedTurnIds = /* @__PURE__ */ new Set();
632
959
  for (const event of ordered) {
633
- const payload = asRecord(event.payload);
960
+ const payload = asRecord2(event.payload);
634
961
  const turnId = event.turnId ?? null;
635
962
  if (event.type === "turn.queued") {
636
963
  const triggerEventId = typeof payload.triggerEventId === "string" ? payload.triggerEventId : null;
@@ -872,7 +1199,7 @@ function groupStartedAt(group) {
872
1199
  return group.startedAt;
873
1200
  }
874
1201
  }
875
- function asRecord(value) {
1202
+ function asRecord2(value) {
876
1203
  return value !== null && typeof value === "object" ? value : {};
877
1204
  }
878
1205
  function stringValue(value) {
@@ -923,7 +1250,8 @@ function machineInputMembers(value) {
923
1250
  "goal_continuation",
924
1251
  "agent_message",
925
1252
  "agent_steer_instruction",
926
- "child_terminal_result"
1253
+ "child_terminal_result",
1254
+ "media_generation_result"
927
1255
  ]);
928
1256
  const classifications = /* @__PURE__ */ new Set([
929
1257
  "success",
@@ -932,18 +1260,23 @@ function machineInputMembers(value) {
932
1260
  "info"
933
1261
  ]);
934
1262
  return Array.isArray(value) ? value.flatMap((candidate) => {
935
- const member = asRecord(candidate);
1263
+ const member = asRecord2(candidate);
936
1264
  return typeof member.id === "string" && typeof member.kind === "string" && kinds.has(member.kind) && typeof member.classification === "string" && classifications.has(
937
1265
  member.classification
938
- ) && typeof member.sourceId === "string" ? [
939
- {
940
- id: member.id,
941
- kind: member.kind,
942
- classification: member.classification,
943
- sourceId: member.sourceId,
944
- summary: stringValue(member.summary)
945
- }
946
- ] : [];
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
+ })() : [];
947
1280
  }) : [];
948
1281
  }
949
1282
  var SESSION_STATUSES = [
@@ -964,29 +1297,37 @@ function resourceRefs(value) {
964
1297
  return [];
965
1298
  }
966
1299
  return value.filter((entry) => {
967
- const record = asRecord(entry);
1300
+ const record = asRecord2(entry);
968
1301
  if (record.kind === "repository") {
969
1302
  return typeof record.uri === "string" && typeof record.ref === "string";
970
1303
  }
971
1304
  return record.kind === "file" && typeof record.fileId === "string";
972
1305
  });
973
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
+ }
974
1315
  function toolRefs(value) {
975
1316
  if (!Array.isArray(value)) {
976
1317
  return [];
977
1318
  }
978
1319
  return value.filter((entry) => {
979
- const record = asRecord(entry);
1320
+ const record = asRecord2(entry);
980
1321
  return record.kind === "mcp" && typeof record.id === "string";
981
1322
  });
982
1323
  }
983
1324
  function workerCompletionPayload(value) {
984
- const payload = asRecord(value);
1325
+ const payload = asRecord2(value);
985
1326
  const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
986
1327
  if (typeof payload.childSessionId !== "string" || !uuidPattern.test(payload.childSessionId) || typeof payload.status !== "string" || payload.status.trim() === "") {
987
1328
  return null;
988
1329
  }
989
- const goal = asRecord(payload.goal);
1330
+ const goal = asRecord2(payload.goal);
990
1331
  return {
991
1332
  childSessionId: payload.childSessionId,
992
1333
  childStatus: payload.status,
@@ -1009,6 +1350,25 @@ function isErrorOutput(payload) {
1009
1350
  const output = payload.output;
1010
1351
  return !!output && typeof output === "object" && output.isError === true;
1011
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
+ }
1012
1372
  function findOpenCall(items, callId) {
1013
1373
  const reversed = [...items].reverse();
1014
1374
  const isCall = (item) => item.kind === "tool-call" || item.kind === "worker";
@@ -1040,7 +1400,7 @@ function goalText(payload) {
1040
1400
  if (typeof payload.text === "string" && payload.text) {
1041
1401
  return payload.text;
1042
1402
  }
1043
- const goal = asRecord(payload.goal);
1403
+ const goal = asRecord2(payload.goal);
1044
1404
  if (typeof goal.text === "string" && goal.text) {
1045
1405
  return goal.text;
1046
1406
  }
@@ -1093,25 +1453,46 @@ var AUTH_NEEDED_REASONS = /* @__PURE__ */ new Set([
1093
1453
  function authNeededReason(value) {
1094
1454
  return typeof value === "string" && AUTH_NEEDED_REASONS.has(value) ? value : null;
1095
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
+ }
1096
1477
  function stringList(value) {
1097
1478
  return Array.isArray(value) ? value.filter((entry) => typeof entry === "string" && entry.trim().length > 0) : [];
1098
1479
  }
1099
1480
  function reasoningText(payload) {
1100
- const record = asRecord(payload);
1481
+ const record = asRecord2(payload);
1101
1482
  if (typeof record.text === "string") {
1102
1483
  return record.text;
1103
1484
  }
1104
- const content = asRecord(asRecord(record.item).rawItem).content;
1485
+ const content = asRecord2(asRecord2(record.item).rawItem).content;
1105
1486
  if (!Array.isArray(content)) {
1106
1487
  return "";
1107
1488
  }
1108
1489
  return content.map((part) => {
1109
- const text = asRecord(part).text;
1490
+ const text = asRecord2(part).text;
1110
1491
  return stringValue(text);
1111
1492
  }).join("");
1112
1493
  }
1113
1494
  function workerPrompt(args) {
1114
- const record = asRecord(typeof args === "string" ? tryParseJson(args) : args);
1495
+ const record = asRecord2(typeof args === "string" ? tryParseJson(args) : args);
1115
1496
  for (const key of ["initialMessage", "message", "text", "prompt"]) {
1116
1497
  const value = record[key];
1117
1498
  if (typeof value === "string" && value.trim().length > 0) {
@@ -1140,6 +1521,10 @@ function extractSessionRef(value, depth = 0) {
1140
1521
  return null;
1141
1522
  }
1142
1523
  const record = value;
1524
+ const receiptResource = asRecord2(record.resource);
1525
+ if (record.receiptVersion === "mcp-mutation-receipt.v1" && receiptResource.type === "session" && typeof receiptResource.id === "string" && looksLikeId(receiptResource.id)) {
1526
+ return receiptResource.id;
1527
+ }
1143
1528
  if (typeof record.sessionId === "string" && looksLikeId(record.sessionId)) {
1144
1529
  return record.sessionId;
1145
1530
  }
@@ -1172,4 +1557,4 @@ export {
1172
1557
  groupTimeline,
1173
1558
  extractSessionRef
1174
1559
  };
1175
- //# sourceMappingURL=chunk-LWR4MXSS.js.map
1560
+ //# sourceMappingURL=chunk-JR3QFY6B.js.map