@opengeni/react 1.4.4 → 1.4.5-canary.37458084490001

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 (234) hide show
  1. package/README.md +17 -6
  2. package/dist/artifacts.d.ts +1 -0
  3. package/dist/artifacts.js +22 -15
  4. package/dist/artifacts.js.map +1 -1
  5. package/dist/{browser-viewer-5EEAS3IU.js → browser-viewer-CV23VIHB.js} +8 -6
  6. package/dist/chunk-3ZC6QPOM.js +174 -0
  7. package/dist/chunk-3ZC6QPOM.js.map +1 -0
  8. package/dist/{chunk-YVFRBXST.js → chunk-4BCVCJSU.js} +2 -2
  9. package/dist/{chunk-JHTIMBOL.js → chunk-5JSUNNQN.js} +26 -4
  10. package/dist/{chunk-JHTIMBOL.js.map → chunk-5JSUNNQN.js.map} +1 -1
  11. package/dist/{chunk-I6OY3MWC.js → chunk-6FOTSVWU.js} +2 -2
  12. package/dist/{chunk-IUHHPMAX.js → chunk-7RRBX5EM.js} +14 -85
  13. package/dist/chunk-7RRBX5EM.js.map +1 -0
  14. package/dist/{chunk-L2J3PU7A.js → chunk-7ZB7I3KP.js} +24 -98
  15. package/dist/chunk-7ZB7I3KP.js.map +1 -0
  16. package/dist/{chunk-LVS3MH5T.js → chunk-ATIRUHBZ.js} +128 -10
  17. package/dist/chunk-ATIRUHBZ.js.map +1 -0
  18. package/dist/chunk-BOFEQC6K.js +162 -0
  19. package/dist/chunk-BOFEQC6K.js.map +1 -0
  20. package/dist/{chunk-2OQA3CPB.js → chunk-CESBPQP5.js} +19 -5
  21. package/dist/chunk-CESBPQP5.js.map +1 -0
  22. package/dist/{chunk-IYQCWGU5.js → chunk-GHJU7XG7.js} +35 -62
  23. package/dist/chunk-GHJU7XG7.js.map +1 -0
  24. package/dist/{chunk-G6YRCIYJ.js → chunk-HNVWMDNN.js} +55 -60
  25. package/dist/chunk-HNVWMDNN.js.map +1 -0
  26. package/dist/{chunk-PHBFJCEU.js → chunk-I5EGRXXG.js} +110 -7
  27. package/dist/chunk-I5EGRXXG.js.map +1 -0
  28. package/dist/{chunk-PBCZL4JP.js → chunk-INIZSNXT.js} +2 -2
  29. package/dist/{chunk-XS67YG5R.js → chunk-IX3K4THH.js} +24 -3
  30. package/dist/chunk-IX3K4THH.js.map +1 -0
  31. package/dist/chunk-IZV5FTJC.js +55 -0
  32. package/dist/chunk-IZV5FTJC.js.map +1 -0
  33. package/dist/chunk-JDJJMBB3.js +1883 -0
  34. package/dist/chunk-JDJJMBB3.js.map +1 -0
  35. package/dist/{chunk-C5BF4L26.js → chunk-KHF2VRXF.js} +7 -7
  36. package/dist/{chunk-QMMCJGFI.js → chunk-L5OKM2VX.js} +2 -2
  37. package/dist/chunk-LHF6BVM4.js +83 -0
  38. package/dist/chunk-LHF6BVM4.js.map +1 -0
  39. package/dist/chunk-N7S72EXK.js +25 -0
  40. package/dist/chunk-N7S72EXK.js.map +1 -0
  41. package/dist/{chunk-CVYCLFMH.js → chunk-PEHTX3V7.js} +19 -1
  42. package/dist/chunk-PEHTX3V7.js.map +1 -0
  43. package/dist/chunk-R5R5RQQD.js +51 -0
  44. package/dist/chunk-R5R5RQQD.js.map +1 -0
  45. package/dist/chunk-RI42H5IU.js +326 -0
  46. package/dist/chunk-RI42H5IU.js.map +1 -0
  47. package/dist/{chunk-JH7V627O.js → chunk-SHLZMAJN.js} +2 -11
  48. package/dist/chunk-SHLZMAJN.js.map +1 -0
  49. package/dist/{chunk-EAOSEIXB.js → chunk-TZQSHCZN.js} +692 -1996
  50. package/dist/chunk-TZQSHCZN.js.map +1 -0
  51. package/dist/chunk-ZIB4H5LN.js +101 -0
  52. package/dist/chunk-ZIB4H5LN.js.map +1 -0
  53. package/dist/client.d.ts +9 -3
  54. package/dist/clipboard.js +1 -1
  55. package/dist/components/browser-viewer.d.ts +6 -0
  56. package/dist/components/composer.d.ts +3 -69
  57. package/dist/components/human-input-form.d.ts +3 -32
  58. package/dist/components/markdown.d.ts +8 -0
  59. package/dist/components/model-policy-picker.d.ts +4 -37
  60. package/dist/components/opper-mark.d.ts +7 -0
  61. package/dist/components/provider-recovery-notice.d.ts +15 -0
  62. package/dist/components/remark-soft-line-breaks.d.ts +38 -0
  63. package/dist/components/sandbox-workspace.d.ts +13 -0
  64. package/dist/components/session-chrome.d.ts +5 -3
  65. package/dist/components/session-conversation.d.ts +15 -3
  66. package/dist/composer-messages.d.ts +74 -0
  67. package/dist/composer-messages.js +9 -0
  68. package/dist/composer.js +15 -10
  69. package/dist/{computer-viewer-ELNLZGHI.js → computer-viewer-K4CKYRX6.js} +4 -4
  70. package/dist/connect-setup.d.ts +2 -0
  71. package/dist/connect.d.ts +1 -1
  72. package/dist/connect.js +21 -6
  73. package/dist/connect.js.map +1 -1
  74. package/dist/{embedded-voice-NIL4RDX3.js → embedded-voice-3ZFWWJ6O.js} +6 -4
  75. package/dist/{embedded-voice-NIL4RDX3.js.map → embedded-voice-3ZFWWJ6O.js.map} +1 -1
  76. package/dist/hooks/shared-machines-list.d.ts +4 -0
  77. package/dist/hooks/use-client-config-flags.d.ts +6 -0
  78. package/dist/hooks/use-goal.d.ts +2 -1
  79. package/dist/human-input-model.d.ts +40 -0
  80. package/dist/index.d.ts +4 -1
  81. package/dist/index.js +116 -73
  82. package/dist/index.js.map +1 -1
  83. package/dist/interaction.js +5 -5
  84. package/dist/{latest-question-2POFPYNB.js → latest-question-SWC6QEVN.js} +3 -3
  85. package/dist/lib/clipboard.d.ts +7 -0
  86. package/dist/lib/provider-recovery.d.ts +49 -0
  87. package/dist/machines.js +2 -2
  88. package/dist/model-mark-paths.d.ts +34 -0
  89. package/dist/model-mark-paths.js +16 -0
  90. package/dist/model-picker-model.d.ts +111 -0
  91. package/dist/model-picker-model.js +25 -0
  92. package/dist/model-picker-model.js.map +1 -0
  93. package/dist/{model-policy-picker-menu-WRNSRFQC.js → model-policy-picker-menu-NM4RPTY6.js} +6 -4
  94. package/dist/model-policy-picker-menu-NM4RPTY6.js.map +1 -0
  95. package/dist/model-policy.d.ts +10 -0
  96. package/dist/model-policy.js +5 -1
  97. package/dist/organization-model.d.ts +32 -0
  98. package/dist/organization-model.js +65 -0
  99. package/dist/organization-model.js.map +1 -0
  100. package/dist/{platform-activity-row-PJJVATTZ.js → platform-activity-row-NJ47YBXW.js} +7 -84
  101. package/dist/platform-activity-row-NJ47YBXW.js.map +1 -0
  102. package/dist/queue-presentation-model.d.ts +72 -0
  103. package/dist/queue-presentation-model.js +38 -0
  104. package/dist/queue-presentation-model.js.map +1 -0
  105. package/dist/{queue-surface-implementation-67FS7FUI.js → queue-surface-implementation-YPJFQ3O6.js} +24 -252
  106. package/dist/queue-surface-implementation-YPJFQ3O6.js.map +1 -0
  107. package/dist/realtime.js +5 -3
  108. package/dist/{sandbox-files-34CJJNOY.js → sandbox-files-RCVCMXG7.js} +5 -5
  109. package/dist/sandbox-files-RCVCMXG7.js.map +1 -0
  110. package/dist/sandbox-label-model.d.ts +23 -0
  111. package/dist/sandbox-label-model.js +28 -0
  112. package/dist/sandbox-label-model.js.map +1 -0
  113. package/dist/session-attention-model.d.ts +8 -0
  114. package/dist/session-attention-model.js +46 -0
  115. package/dist/session-attention-model.js.map +1 -0
  116. package/dist/session-feedback-model.d.ts +20 -0
  117. package/dist/session-feedback-model.js +56 -0
  118. package/dist/session-feedback-model.js.map +1 -0
  119. package/dist/session-list-model.d.ts +96 -0
  120. package/dist/session-list-model.js +219 -0
  121. package/dist/session-list-model.js.map +1 -0
  122. package/dist/session-status-model.d.ts +19 -0
  123. package/dist/session-ui.js +26 -17
  124. package/dist/session-ui.js.map +1 -1
  125. package/dist/session.js +8 -6
  126. package/dist/testing/session-scenarios.d.ts +10 -0
  127. package/dist/testing/session-scenarios.js +303 -0
  128. package/dist/testing/session-scenarios.js.map +1 -0
  129. package/dist/timeline/genie-copy.d.ts +3 -0
  130. package/dist/timeline/genie-loading.d.ts +11 -0
  131. package/dist/timeline/index.d.ts +1 -1
  132. package/dist/timeline/notice-presentation.d.ts +7 -0
  133. package/dist/timeline/patch-apply-command.d.ts +18 -0
  134. package/dist/timeline/platform-activity-presentation.d.ts +7 -0
  135. package/dist/timeline/presented-image.d.ts +6 -1
  136. package/dist/timeline/question-nav-model.d.ts +23 -0
  137. package/dist/timeline/registry.d.ts +10 -1
  138. package/dist/timeline/retained-loaders.d.ts +1 -1
  139. package/dist/timeline/tool-presentation.d.ts +172 -0
  140. package/dist/timeline/turn-summary-model.d.ts +90 -0
  141. package/dist/timeline/turn-summary.d.ts +4 -74
  142. package/dist/timeline/work-presentation.d.ts +42 -0
  143. package/dist/timeline-model.d.ts +24 -0
  144. package/dist/timeline-model.js +152 -0
  145. package/dist/timeline-model.js.map +1 -0
  146. package/package.json +47 -3
  147. package/src/artifacts.ts +1 -0
  148. package/src/client.ts +9 -3
  149. package/src/components/browser-viewer.tsx +23 -2
  150. package/src/components/claude-mark.tsx +2 -1
  151. package/src/components/composer.tsx +4 -144
  152. package/src/components/grok-mark.tsx +2 -1
  153. package/src/components/human-input-form.tsx +13 -124
  154. package/src/components/markdown.tsx +19 -1
  155. package/src/components/message-timeline.tsx +45 -99
  156. package/src/components/model-mark.tsx +2 -1
  157. package/src/components/model-policy-picker-menu.tsx +30 -85
  158. package/src/components/model-policy-picker.tsx +15 -148
  159. package/src/components/opper-mark.tsx +18 -0
  160. package/src/components/provider-recovery-notice.tsx +41 -0
  161. package/src/components/queue-surface-implementation.tsx +20 -349
  162. package/src/components/remark-soft-line-breaks.ts +166 -0
  163. package/src/components/sandbox-workspace.tsx +17 -1
  164. package/src/components/session-chrome.tsx +114 -99
  165. package/src/components/session-conversation.tsx +55 -6
  166. package/src/components/session-status.tsx +17 -16
  167. package/src/composer-messages.ts +150 -0
  168. package/src/connect-setup.tsx +45 -11
  169. package/src/connect.ts +1 -1
  170. package/src/hooks/shared-machines-list.ts +34 -1
  171. package/src/hooks/use-client-config-flags.ts +8 -0
  172. package/src/hooks/use-goal.ts +66 -10
  173. package/src/human-input-model.ts +147 -0
  174. package/src/index.ts +16 -0
  175. package/src/lib/clipboard.ts +29 -0
  176. package/src/lib/format.ts +7 -0
  177. package/src/lib/provider-recovery.ts +202 -0
  178. package/src/model-mark-paths.ts +53 -0
  179. package/src/model-picker-model.ts +330 -0
  180. package/src/model-policy.ts +43 -2
  181. package/src/organization-model.ts +118 -0
  182. package/src/queue-presentation-model.ts +464 -0
  183. package/src/sandbox-label-model.ts +41 -0
  184. package/src/session-attention-model.ts +59 -0
  185. package/src/session-feedback-model.ts +95 -0
  186. package/src/session-list-model.ts +327 -0
  187. package/src/session-status-model.ts +62 -0
  188. package/src/testing/session-scenarios.ts +326 -0
  189. package/src/timeline/activity-rail.tsx +5 -17
  190. package/src/timeline/genie-copy.ts +19 -0
  191. package/src/timeline/genie-loading.tsx +13 -18
  192. package/src/timeline/index.ts +1 -0
  193. package/src/timeline/notice-presentation.ts +22 -0
  194. package/src/timeline/patch-apply-command.tsx +135 -0
  195. package/src/timeline/platform-activity-presentation.ts +122 -0
  196. package/src/timeline/platform-activity-row.tsx +6 -96
  197. package/src/timeline/presented-image.ts +16 -2
  198. package/src/timeline/question-nav-model.ts +28 -0
  199. package/src/timeline/registry.ts +11 -1
  200. package/src/timeline/retained-loaders.ts +9 -4
  201. package/src/timeline/rolling-activity.tsx +7 -19
  202. package/src/timeline/tool-presentation.ts +1316 -0
  203. package/src/timeline/tool-renderers.tsx +226 -1025
  204. package/src/timeline/turn-summary-model.ts +338 -0
  205. package/src/timeline/turn-summary.tsx +21 -326
  206. package/src/timeline/work-presentation.ts +139 -0
  207. package/src/timeline-model.ts +108 -0
  208. package/styles/compiled.css +3 -0
  209. package/styles/connect.css +4 -0
  210. package/dist/chunk-2OQA3CPB.js.map +0 -1
  211. package/dist/chunk-CVYCLFMH.js.map +0 -1
  212. package/dist/chunk-EAOSEIXB.js.map +0 -1
  213. package/dist/chunk-G6YRCIYJ.js.map +0 -1
  214. package/dist/chunk-HXYOSSQO.js +0 -117
  215. package/dist/chunk-HXYOSSQO.js.map +0 -1
  216. package/dist/chunk-IUHHPMAX.js.map +0 -1
  217. package/dist/chunk-IYQCWGU5.js.map +0 -1
  218. package/dist/chunk-JH7V627O.js.map +0 -1
  219. package/dist/chunk-L2J3PU7A.js.map +0 -1
  220. package/dist/chunk-LVS3MH5T.js.map +0 -1
  221. package/dist/chunk-PHBFJCEU.js.map +0 -1
  222. package/dist/chunk-XS67YG5R.js.map +0 -1
  223. package/dist/platform-activity-row-PJJVATTZ.js.map +0 -1
  224. package/dist/queue-surface-implementation-67FS7FUI.js.map +0 -1
  225. /package/dist/{browser-viewer-5EEAS3IU.js.map → browser-viewer-CV23VIHB.js.map} +0 -0
  226. /package/dist/{chunk-YVFRBXST.js.map → chunk-4BCVCJSU.js.map} +0 -0
  227. /package/dist/{chunk-I6OY3MWC.js.map → chunk-6FOTSVWU.js.map} +0 -0
  228. /package/dist/{chunk-PBCZL4JP.js.map → chunk-INIZSNXT.js.map} +0 -0
  229. /package/dist/{chunk-C5BF4L26.js.map → chunk-KHF2VRXF.js.map} +0 -0
  230. /package/dist/{chunk-QMMCJGFI.js.map → chunk-L5OKM2VX.js.map} +0 -0
  231. /package/dist/{computer-viewer-ELNLZGHI.js.map → composer-messages.js.map} +0 -0
  232. /package/dist/{model-policy-picker-menu-WRNSRFQC.js.map → computer-viewer-K4CKYRX6.js.map} +0 -0
  233. /package/dist/{latest-question-2POFPYNB.js.map → latest-question-SWC6QEVN.js.map} +0 -0
  234. /package/dist/{sandbox-files-34CJJNOY.js.map → model-mark-paths.js.map} +0 -0
@@ -1,28 +1,29 @@
1
1
  "use client";
2
- import {
3
- useThemeType
4
- } from "./chunk-B27E3V37.js";
5
2
  import {
6
3
  EmptyQueueStateSurface,
7
- QUEUE_ITEM_CONTENT_UNAVAILABLE,
8
4
  TimelineAnnotationCards,
9
5
  TimelineAnnotationsChip,
10
- queueItemContent,
11
6
  requestQueueDraftEdit
12
- } from "./chunk-JH7V627O.js";
7
+ } from "./chunk-SHLZMAJN.js";
8
+ import {
9
+ useThemeType
10
+ } from "./chunk-B27E3V37.js";
13
11
  import {
14
12
  TimelineAnnotationSourceRootContext
15
13
  } from "./chunk-2HVLQ26H.js";
16
14
  import {
17
- isRetainedImageContentType,
18
- timelineGroupContainsPresentedImage,
15
+ loadPierreDiffs,
16
+ pierreDiffsRevision,
17
+ subscribePierreDiffs
18
+ } from "./chunk-YSRBFJMQ.js";
19
+ import {
20
+ PatchApplyCommand,
19
21
  useRetainedImageObjectUrl
20
- } from "./chunk-HXYOSSQO.js";
22
+ } from "./chunk-BOFEQC6K.js";
21
23
  import {
22
24
  approvalsFromRequiresAction,
23
25
  conversationTimeline,
24
26
  invokeOlderHistoryLoaderWithReceiptCapture,
25
- isActionableHumanInputRequest,
26
27
  projectPendingApprovals,
27
28
  useFileAttachments,
28
29
  useGoal,
@@ -31,18 +32,23 @@ import {
31
32
  useSessionControl,
32
33
  useSessionEvents,
33
34
  useTurnQueue
34
- } from "./chunk-G6YRCIYJ.js";
35
+ } from "./chunk-HNVWMDNN.js";
35
36
  import {
36
37
  buildTimeline,
37
38
  groupTimeline
38
- } from "./chunk-QMMCJGFI.js";
39
- import {
40
- mcpToolLeaf,
41
- toolDisplayName
42
- } from "./chunk-T46QZH3E.js";
39
+ } from "./chunk-L5OKM2VX.js";
43
40
  import {
44
41
  OpenGeniProvider
45
42
  } from "./chunk-PKCAYHDC.js";
43
+ import {
44
+ QUEUE_ITEM_CONTENT_UNAVAILABLE,
45
+ QUEUE_REPLACE_DRAFT_COPY,
46
+ countAuthoritativeQueuedTurns,
47
+ isAuthoritativeQueuedTurn,
48
+ queueItemContent,
49
+ queueNeighborAnchors,
50
+ queuedTurnPresentation
51
+ } from "./chunk-RI42H5IU.js";
46
52
  import {
47
53
  ActivityDisclosure,
48
54
  BodyNote,
@@ -63,7 +69,7 @@ import {
63
69
  useForcedDefaultOpen,
64
70
  useTimelineSearchNavigation,
65
71
  useTimelineSearchReveal
66
- } from "./chunk-PHBFJCEU.js";
72
+ } from "./chunk-I5EGRXXG.js";
67
73
  import {
68
74
  prefersReducedMotion
69
75
  } from "./chunk-OYQQJL3J.js";
@@ -75,10 +81,69 @@ import {
75
81
  viewerLinkResolver
76
82
  } from "./chunk-OGTTUYNT.js";
77
83
  import {
78
- loadPierreDiffs,
79
- pierreDiffsRevision,
80
- subscribePierreDiffs
81
- } from "./chunk-YSRBFJMQ.js";
84
+ GENIE_PREPARING_PHRASES,
85
+ GENIE_WAITING_PHRASES,
86
+ QUESTION_NAV_MARGIN_PX,
87
+ SESSION_STATUS_PRESENTATION,
88
+ answersFromDrafts,
89
+ applyPatchPresentation,
90
+ askPresentation,
91
+ clusterIsSettled,
92
+ compactedLandmarkCount,
93
+ createToolRegistry,
94
+ createTurnSummaryContext,
95
+ defaultHumanInputFormMessages,
96
+ durationBetween,
97
+ emptyDraft,
98
+ execPresentation,
99
+ flattenActivityItems,
100
+ formatElapsed,
101
+ generatedImageReceipt,
102
+ genericToolIconKind,
103
+ genericToolPresentation,
104
+ initialDrafts,
105
+ isPreparingWork,
106
+ mediaPreviewFact,
107
+ noticeDisplayText,
108
+ noticeIsResolvedApproval,
109
+ noticeTone,
110
+ parseDisclosedTools,
111
+ parseSearchHits,
112
+ parseToolArgs,
113
+ pathBasename,
114
+ pathDirname,
115
+ questionNavTarget,
116
+ readableWorkDefaultOpen,
117
+ readableWorkShowsPreview,
118
+ readableWorkStatus,
119
+ resolveTurnSummaryFacets,
120
+ retainedScreenshotMetadata,
121
+ rollingActivityItem,
122
+ runOnPresentation,
123
+ screenshotDataUrl,
124
+ selectTurnSummaryFacets,
125
+ toolSearchPreview,
126
+ toolSearchQuery,
127
+ truncatePreview,
128
+ unwrapMcpOutput,
129
+ webSearchPresentation,
130
+ writeStdinPresentation
131
+ } from "./chunk-JDJJMBB3.js";
132
+ import {
133
+ workerRowTitle
134
+ } from "./chunk-ZIB4H5LN.js";
135
+ import {
136
+ isPatchFilename,
137
+ isRetainedImageContentType,
138
+ timelineGroupContainsPresentedImage
139
+ } from "./chunk-R5R5RQQD.js";
140
+ import {
141
+ isActionableHumanInputRequest
142
+ } from "./chunk-IZV5FTJC.js";
143
+ import {
144
+ mcpToolLeaf,
145
+ toolDisplayName
146
+ } from "./chunk-T46QZH3E.js";
82
147
  import {
83
148
  Actions,
84
149
  AttachButton,
@@ -102,11 +167,14 @@ import {
102
167
  StopButton,
103
168
  Surface,
104
169
  useChatComposerController
105
- } from "./chunk-IUHHPMAX.js";
170
+ } from "./chunk-7RRBX5EM.js";
171
+ import {
172
+ ModelPolicyPicker
173
+ } from "./chunk-7ZB7I3KP.js";
106
174
  import {
107
175
  FILE_ONLY_MESSAGE_TEXT,
108
176
  useComposer
109
- } from "./chunk-PBCZL4JP.js";
177
+ } from "./chunk-INIZSNXT.js";
110
178
  import {
111
179
  LightboxProvider,
112
180
  Tooltip,
@@ -114,21 +182,19 @@ import {
114
182
  TooltipProvider,
115
183
  TooltipTrigger
116
184
  } from "./chunk-IEE7WCLN.js";
117
- import {
118
- ModelPolicyPicker
119
- } from "./chunk-L2J3PU7A.js";
120
185
  import {
121
186
  projectPickerRows,
122
187
  sortPickerRows
123
- } from "./chunk-XS67YG5R.js";
188
+ } from "./chunk-IX3K4THH.js";
124
189
  import {
190
+ currentProviderRecovery,
125
191
  formatBytes,
126
192
  formatClockTime,
127
193
  formatRelativeTime,
128
- stringifyPayload,
194
+ providerRecoveryRetryingText,
129
195
  truncate,
130
196
  tryParseJson
131
- } from "./chunk-LVS3MH5T.js";
197
+ } from "./chunk-ATIRUHBZ.js";
132
198
  import {
133
199
  allowanceLabels,
134
200
  allowanceResetSentence,
@@ -154,32 +220,6 @@ import { useEffect, useId, useRef, useState } from "react";
154
220
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
155
221
  var SkillReviewVerificationError = class extends Error {
156
222
  };
157
- var defaultHumanInputFormMessages = {
158
- title: "Input required",
159
- /** Multi-question chrome has no default subtitle; hosts may still override. */
160
- description: "",
161
- submit: "Send answers",
162
- skip: "Skip",
163
- submitting: "Submitting\u2026",
164
- other: "Other",
165
- deadlineLabel: "Expires",
166
- formatDeadline,
167
- required: "This question is required.",
168
- otherRequired: "Enter a value for Other.",
169
- minSelections: (count) => `Choose at least ${count} option${count === 1 ? "" : "s"}.`,
170
- maxSelections: (count) => `Choose no more than ${count} option${count === 1 ? "" : "s"}.`,
171
- optional: "Optional",
172
- moreBelow: "More below",
173
- questionCount: (count) => `${count} questions`,
174
- collapse: "Collapse",
175
- expand: "Expand",
176
- selectionHint: (min, max) => {
177
- if (min != null && max != null) return `Choose ${min}\u2013${max}.`;
178
- if (min != null) return `Choose at least ${min}.`;
179
- if (max != null) return `Choose up to ${max}.`;
180
- return null;
181
- }
182
- };
183
223
  function HumanInputForm(props) {
184
224
  return /* @__PURE__ */ jsx(HumanInputRequestForm, { ...props }, props.request.id);
185
225
  }
@@ -879,64 +919,6 @@ function QuestionControls({
879
919
  error ? /* @__PURE__ */ jsx("p", { id: errorId, role: "alert", className: "text-og-xs text-og-status-failed", children: error }) : null
880
920
  ] });
881
921
  }
882
- function answersFromDrafts(questions, drafts, messageOverrides = {}) {
883
- const messages = { ...defaultHumanInputFormMessages, ...messageOverrides };
884
- const answers = [];
885
- const errors = {};
886
- for (const question of questions) {
887
- const draft = drafts[question.id] ?? emptyDraft();
888
- const values = question.kind === "text" ? draft.values.filter(Boolean) : draft.values;
889
- const other = draft.otherSelected ? draft.other : "";
890
- const hasOther = Boolean(other.trim());
891
- const supplied = values.length + (hasOther ? 1 : 0);
892
- if (question.kind !== "text" && draft.otherSelected && !hasOther) {
893
- errors[question.id] = messages.otherRequired;
894
- continue;
895
- }
896
- if (question.required && supplied === 0) {
897
- errors[question.id] = messages.required;
898
- continue;
899
- }
900
- if (question.kind !== "text") {
901
- const min = question.validation?.minSelections;
902
- const max = question.kind === "single_select" ? 1 : question.validation?.maxSelections;
903
- if (min != null && supplied < min) {
904
- errors[question.id] = messages.minSelections(min);
905
- continue;
906
- }
907
- if (max != null && supplied > max) {
908
- errors[question.id] = messages.maxSelections(max);
909
- continue;
910
- }
911
- }
912
- if (supplied > 0) {
913
- answers.push({
914
- questionId: question.id,
915
- values,
916
- ...hasOther ? { other } : {}
917
- });
918
- }
919
- }
920
- return { answers, errors };
921
- }
922
- function initialDrafts(questions) {
923
- return Object.fromEntries(questions.map((question) => [question.id, emptyDraft()]));
924
- }
925
- function emptyDraft() {
926
- return { values: [], other: "", otherSelected: false };
927
- }
928
- function formatDeadline(value) {
929
- const date = new Date(value);
930
- if (Number.isNaN(date.getTime())) return value;
931
- const ms = date.getTime() - Date.now();
932
- if (ms <= 0) return "deadline passed";
933
- const minutes = Math.round(ms / 6e4);
934
- if (minutes < 1) return "in under a minute";
935
- if (minutes < 60) return `in ${minutes}m`;
936
- const hours = Math.round(minutes / 60);
937
- if (hours < 48) return `in ${hours}h`;
938
- return date.toLocaleString();
939
- }
940
922
 
941
923
  // src/components/human-input-surface.tsx
942
924
  import { useEffect as useEffect2, useMemo, useRef as useRef2 } from "react";
@@ -2017,514 +1999,6 @@ function useRecordedToolReview(approvalId) {
2017
1999
  };
2018
2000
  }
2019
2001
 
2020
- // src/timeline/parsers.ts
2021
- import {
2022
- normalizeMcpOutput,
2023
- parseGeneratedImageReceipt
2024
- } from "@opengeni/sdk";
2025
- function sandboxCommandExitCode(out) {
2026
- const match = String(out ?? "").match(/Process exited with code (-?\d+)/);
2027
- return match ? Number(match[1]) : null;
2028
- }
2029
- function parseExecBannerSessionId(out) {
2030
- const text = String(out ?? "");
2031
- const outputIdx = text.indexOf("\nOutput:\n");
2032
- const banner = outputIdx >= 0 ? text.slice(0, outputIdx) : text.startsWith("Output:\n") ? "" : text;
2033
- const match = banner.match(/Process running with session ID (\d+)/);
2034
- if (!match) {
2035
- return null;
2036
- }
2037
- const n = Number.parseInt(match[1], 10);
2038
- return Number.isFinite(n) ? n : null;
2039
- }
2040
- function stripExecBanner(out) {
2041
- const text = String(out ?? "");
2042
- const marker = text.indexOf("\nOutput:\n");
2043
- if (marker >= 0) {
2044
- return text.slice(marker + "\nOutput:\n".length);
2045
- }
2046
- if (text.startsWith("Output:\n")) {
2047
- return text.slice("Output:\n".length);
2048
- }
2049
- return text;
2050
- }
2051
- function execTruncated(out) {
2052
- return /Total output lines:|\.{3}\d+ tokens truncated\.{3}|\[\.{3}\d+ characters truncated/.test(
2053
- String(out ?? "")
2054
- );
2055
- }
2056
- function isExecSessionLostBanner(out) {
2057
- return /write_stdin failed: session not found: \d+/.test(String(out ?? ""));
2058
- }
2059
- function looksBinary(text) {
2060
- return text.includes("\0") || text.startsWith("\x7FELF");
2061
- }
2062
- function controlCaret(printable) {
2063
- return String(printable).replace(
2064
- /[\u0000-\u001f]/g,
2065
- (c) => `^${String.fromCharCode(c.charCodeAt(0) + 64)}`
2066
- );
2067
- }
2068
- function v4aToGitFileDiff(op) {
2069
- const status = op.type === "create_file" ? "added" : op.type === "delete_file" ? "deleted" : op.moveTo ? "renamed" : "modified";
2070
- const oldPath = op.moveTo ? op.path : null;
2071
- const path = op.moveTo || op.path;
2072
- const hunks = [];
2073
- let additions = 0;
2074
- let deletions = 0;
2075
- let sawHunkAnchor = false;
2076
- if (op.type !== "delete_file") {
2077
- const lines = (op.diff ?? "").split("\n");
2078
- let cur = null;
2079
- let oldNo = 1;
2080
- let newNo = 1;
2081
- for (const raw of lines) {
2082
- if (raw.startsWith("@@")) {
2083
- sawHunkAnchor = true;
2084
- const match = raw.match(/-(\d+)(?:,\d+)?\s+\+(\d+)/);
2085
- oldNo = match ? Number(match[1]) : 1;
2086
- newNo = match ? Number(match[2]) : 1;
2087
- cur = {
2088
- oldStart: oldNo,
2089
- oldLines: 0,
2090
- newStart: newNo,
2091
- newLines: 0,
2092
- header: raw,
2093
- lines: [{ type: "meta", oldNo: null, newNo: null, text: raw }]
2094
- };
2095
- hunks.push(cur);
2096
- } else if (cur || op.type === "create_file") {
2097
- if (!cur) {
2098
- cur = {
2099
- oldStart: 0,
2100
- oldLines: 0,
2101
- newStart: 1,
2102
- newLines: 0,
2103
- header: "",
2104
- lines: []
2105
- };
2106
- hunks.push(cur);
2107
- oldNo = 0;
2108
- newNo = 1;
2109
- }
2110
- if (raw.startsWith("+")) {
2111
- cur.lines.push({
2112
- type: "add",
2113
- oldNo: null,
2114
- newNo: newNo++,
2115
- text: raw.slice(1)
2116
- });
2117
- cur.newLines += 1;
2118
- additions += 1;
2119
- } else if (raw.startsWith("-")) {
2120
- cur.lines.push({
2121
- type: "del",
2122
- oldNo: oldNo++,
2123
- newNo: null,
2124
- text: raw.slice(1)
2125
- });
2126
- cur.oldLines += 1;
2127
- deletions += 1;
2128
- } else {
2129
- cur.lines.push({
2130
- type: "context",
2131
- oldNo: oldNo++,
2132
- newNo: newNo++,
2133
- text: raw.replace(/^ /, "")
2134
- });
2135
- cur.oldLines += 1;
2136
- cur.newLines += 1;
2137
- }
2138
- }
2139
- }
2140
- if (op.type === "update_file" && !sawHunkAnchor && lines.some((l) => l.trim().length > 0)) {
2141
- throw new Error("malformed V4A: no @@ hunk anchor");
2142
- }
2143
- }
2144
- return {
2145
- path,
2146
- oldPath,
2147
- status,
2148
- isBinary: false,
2149
- isImage: false,
2150
- additions,
2151
- deletions,
2152
- hunks,
2153
- truncated: false
2154
- };
2155
- }
2156
- var BEGIN_PATCH = "*** Begin Patch";
2157
- var END_PATCH = "*** End Patch";
2158
- var ADD_FILE = "*** Add File: ";
2159
- var DELETE_FILE = "*** Delete File: ";
2160
- var UPDATE_FILE = "*** Update File: ";
2161
- var MOVE_TO = "*** Move to: ";
2162
- var APPLY_PATCH_OP_TYPES = /* @__PURE__ */ new Set(["create_file", "update_file", "delete_file"]);
2163
- function isRecord(value) {
2164
- return value !== null && typeof value === "object" && !Array.isArray(value);
2165
- }
2166
- function freeformApplyPatchOps(rawPatch) {
2167
- return parseFreeformApplyPatch(rawPatch.trimStart());
2168
- }
2169
- function asApplyPatchOperation(value) {
2170
- if (!isRecord(value)) return null;
2171
- if (typeof value.type !== "string" || !APPLY_PATCH_OP_TYPES.has(value.type)) {
2172
- return null;
2173
- }
2174
- if (typeof value.path !== "string" || !value.path) {
2175
- return null;
2176
- }
2177
- const op = {
2178
- type: value.type,
2179
- path: value.path
2180
- };
2181
- if (typeof value.diff === "string") op.diff = value.diff;
2182
- if (typeof value.moveTo === "string" && value.moveTo.length > 0) op.moveTo = value.moveTo;
2183
- return op;
2184
- }
2185
- function parseStructuredOperations(payloads) {
2186
- if (payloads.length === 0) return [];
2187
- const operations = [];
2188
- for (const payload of payloads) {
2189
- const op = asApplyPatchOperation(payload);
2190
- if (!op) return [];
2191
- operations.push(op);
2192
- }
2193
- return operations;
2194
- }
2195
- function parseFreeformApplyPatch(rawPatch) {
2196
- const lines = rawPatch.split(/\r?\n/);
2197
- if (lines.at(-1) === "") lines.pop();
2198
- if (lines[0] !== BEGIN_PATCH) return [];
2199
- if (lines.length < 2 || lines.at(-1) !== END_PATCH) return [];
2200
- const operations = [];
2201
- let index = 1;
2202
- while (index < lines.length - 1) {
2203
- const line = lines[index];
2204
- let parsed = null;
2205
- if (line.startsWith(ADD_FILE)) parsed = parseAddFilePatch(lines, index);
2206
- else if (line.startsWith(DELETE_FILE)) parsed = parseDeleteFilePatch(lines, index);
2207
- else if (line.startsWith(UPDATE_FILE)) parsed = parseUpdateFilePatch(lines, index);
2208
- else return [];
2209
- if (!parsed || "error" in parsed) return [];
2210
- operations.push(parsed.operation);
2211
- index = parsed.nextIndex;
2212
- }
2213
- return operations.length > 0 ? operations : [];
2214
- }
2215
- function parsePatchHeader(line, prefix) {
2216
- const path = line.slice(prefix.length).trim();
2217
- return path || null;
2218
- }
2219
- function isFileOperationHeader(line) {
2220
- return line.startsWith(ADD_FILE) || line.startsWith(DELETE_FILE) || line.startsWith(UPDATE_FILE);
2221
- }
2222
- function joinDiff(lines) {
2223
- return `${lines.join("\n")}
2224
- `;
2225
- }
2226
- function parseAddFilePatch(lines, index) {
2227
- const path = parsePatchHeader(lines[index], ADD_FILE);
2228
- if (!path) return { error: true };
2229
- index += 1;
2230
- const diffLines = [];
2231
- while (index < lines.length - 1 && !isFileOperationHeader(lines[index])) {
2232
- const line = lines[index];
2233
- if (!line.startsWith("+")) return { error: true };
2234
- diffLines.push(line);
2235
- index += 1;
2236
- }
2237
- if (diffLines.length === 0) return { error: true };
2238
- return {
2239
- operation: { type: "create_file", path, diff: joinDiff(diffLines) },
2240
- nextIndex: index
2241
- };
2242
- }
2243
- function parseDeleteFilePatch(lines, index) {
2244
- const path = parsePatchHeader(lines[index], DELETE_FILE);
2245
- if (!path) return { error: true };
2246
- index += 1;
2247
- if (index < lines.length - 1 && !isFileOperationHeader(lines[index])) {
2248
- return { error: true };
2249
- }
2250
- return { operation: { type: "delete_file", path }, nextIndex: index };
2251
- }
2252
- function parseUpdateFilePatch(lines, index) {
2253
- const path = parsePatchHeader(lines[index], UPDATE_FILE);
2254
- if (!path) return { error: true };
2255
- index += 1;
2256
- let moveTo;
2257
- if (index < lines.length - 1 && lines[index].startsWith(MOVE_TO)) {
2258
- const parsedMoveTo = parsePatchHeader(lines[index], MOVE_TO);
2259
- if (!parsedMoveTo) return { error: true };
2260
- moveTo = parsedMoveTo;
2261
- index += 1;
2262
- }
2263
- const diffLines = [];
2264
- while (index < lines.length - 1 && !isFileOperationHeader(lines[index])) {
2265
- diffLines.push(lines[index]);
2266
- index += 1;
2267
- }
2268
- if (diffLines.length === 0 && !moveTo) return { error: true };
2269
- return {
2270
- operation: {
2271
- type: "update_file",
2272
- path,
2273
- diff: diffLines.length > 0 ? joinDiff(diffLines) : "",
2274
- ...moveTo ? { moveTo } : {}
2275
- },
2276
- nextIndex: index
2277
- };
2278
- }
2279
- function applyPatchOps(raw) {
2280
- if (raw == null) return [];
2281
- if (typeof raw === "string") {
2282
- const trimmed = raw.trimStart();
2283
- if (trimmed.startsWith(BEGIN_PATCH)) return freeformApplyPatchOps(trimmed);
2284
- const parsed = tryParseJson(trimmed);
2285
- return parsed === void 0 ? [] : applyPatchOps(parsed);
2286
- }
2287
- if (Array.isArray(raw)) return parseStructuredOperations(raw);
2288
- if (!isRecord(raw)) return [];
2289
- if (typeof raw.patch === "string") return freeformApplyPatchOps(raw.patch);
2290
- if (Array.isArray(raw.command)) {
2291
- const [commandName, patch] = raw.command;
2292
- if (commandName === "apply_patch" && typeof patch === "string") {
2293
- return freeformApplyPatchOps(patch);
2294
- }
2295
- }
2296
- if (Array.isArray(raw.operations) && raw.operations.length > 0) {
2297
- return parseStructuredOperations(raw.operations);
2298
- }
2299
- if (raw.operation !== void 0) {
2300
- const op = asApplyPatchOperation(raw.operation);
2301
- return op ? [op] : [];
2302
- }
2303
- const flat = asApplyPatchOperation(raw);
2304
- return flat ? [flat] : [];
2305
- }
2306
- function applyPatchOpsFromToolItem(item) {
2307
- const fromRaw = applyPatchOps(item.raw);
2308
- if (fromRaw.length > 0) return fromRaw;
2309
- if (isRecord(item.raw)) {
2310
- const nested = item.raw.arguments ?? item.raw.input;
2311
- if (nested !== void 0 && nested !== item.arguments) {
2312
- const fromNested = applyPatchOps(nested);
2313
- if (fromNested.length > 0) return fromNested;
2314
- }
2315
- }
2316
- if (item.arguments !== void 0 && item.arguments !== null) {
2317
- return applyPatchOps(item.arguments);
2318
- }
2319
- return [];
2320
- }
2321
- function isApplyPatch(item) {
2322
- const type = item.raw && typeof item.raw === "object" ? item.raw.type : void 0;
2323
- if (type === "apply_patch_call") {
2324
- return true;
2325
- }
2326
- const name = item.name;
2327
- return name === "apply_patch_call" || name === "apply_patch" || name.endsWith("__apply_patch");
2328
- }
2329
- function parseToolArgs(args) {
2330
- if (args == null) {
2331
- return {};
2332
- }
2333
- if (typeof args === "string") {
2334
- const parsed = tryParseJson(args);
2335
- return parsed && typeof parsed === "object" ? parsed : {};
2336
- }
2337
- return typeof args === "object" ? args : {};
2338
- }
2339
- function tailPeek(text) {
2340
- const trimmed = text.trim();
2341
- if (!trimmed) {
2342
- return "";
2343
- }
2344
- const lines = trimmed.split("\n");
2345
- return lines[lines.length - 1] ?? "";
2346
- }
2347
- function unwrapMcpOutput(output) {
2348
- const normalized = normalizeMcpOutput(output);
2349
- return { text: normalized.text, isError: normalized.isError };
2350
- }
2351
- function screenshotDataUrl(out) {
2352
- if (typeof out === "string") {
2353
- if (out.startsWith("data:image")) {
2354
- return out;
2355
- }
2356
- if (out.startsWith("{") || out.startsWith("[")) {
2357
- const parsed = tryParseJson(out);
2358
- if (parsed !== void 0 && parsed !== out) {
2359
- return screenshotDataUrl(parsed);
2360
- }
2361
- }
2362
- return null;
2363
- }
2364
- if (Array.isArray(out)) {
2365
- for (const entry of out) {
2366
- const url = screenshotDataUrl(entry);
2367
- if (url) {
2368
- return url;
2369
- }
2370
- }
2371
- return null;
2372
- }
2373
- if (out === null || typeof out !== "object") {
2374
- return null;
2375
- }
2376
- const record = out;
2377
- const imageUrl = record.image_url ?? record.imageUrl;
2378
- if (typeof imageUrl === "string" && imageUrl.startsWith("data:image")) {
2379
- return imageUrl;
2380
- }
2381
- if (imageUrl && typeof imageUrl === "object") {
2382
- const url = imageUrl.url;
2383
- if (typeof url === "string" && url.startsWith("data:image")) {
2384
- return url;
2385
- }
2386
- }
2387
- const image = record.image;
2388
- if (image && typeof image === "object") {
2389
- const mediaType = typeof image.mediaType === "string" ? image.mediaType : "image/png";
2390
- const base64 = bytesToBase64(image.data);
2391
- if (base64) {
2392
- return `data:${mediaType};base64,${base64}`;
2393
- }
2394
- if (typeof image.data === "string" && image.data.length > 0) {
2395
- return `data:${mediaType};base64,${image.data}`;
2396
- }
2397
- }
2398
- return null;
2399
- }
2400
- function retainedScreenshotMetadata(out) {
2401
- if (typeof out === "string" && (out.startsWith("{") || out.startsWith("["))) {
2402
- const parsed = tryParseJson(out);
2403
- if (parsed !== void 0 && parsed !== out) return retainedScreenshotMetadata(parsed);
2404
- }
2405
- if (Array.isArray(out)) {
2406
- for (const entry of out) {
2407
- const metadata = retainedScreenshotMetadata(entry);
2408
- if (metadata) return metadata;
2409
- }
2410
- return null;
2411
- }
2412
- if (!out || typeof out !== "object") return null;
2413
- const value = out;
2414
- if (typeof value.artifactId !== "string" || typeof value.available !== "boolean") return null;
2415
- if (!value.available) {
2416
- return typeof value.reason === "string" ? value : null;
2417
- }
2418
- return (value.kind === "computer_screenshot" || value.kind === "browser_screenshot") && ["image/png", "image/jpeg", "image/webp"].includes(String(value.contentType)) && typeof value.originalBytes === "number" && typeof value.sha256 === "string" && value.dimensions !== null && typeof value.dimensions === "object" && value.retention !== null && typeof value.retention === "object" && value.retention.policy === "session_screenshot" ? value : null;
2419
- }
2420
- function generatedImageReceipt(out) {
2421
- return parseGeneratedImageReceipt(out);
2422
- }
2423
- function mediaPreviewFact(out) {
2424
- if (typeof out === "string" && (out.startsWith("{") || out.startsWith("["))) {
2425
- const parsed = tryParseJson(out);
2426
- if (parsed !== void 0 && parsed !== out) return mediaPreviewFact(parsed);
2427
- }
2428
- if (Array.isArray(out)) {
2429
- for (const entry of out) {
2430
- const preview = mediaPreviewFact(entry);
2431
- if (preview) return preview;
2432
- }
2433
- return null;
2434
- }
2435
- if (!out || typeof out !== "object") return null;
2436
- const record = out;
2437
- if (record.type !== "media_preview" || typeof record.mediaType !== "string" || record.fullOutputAvailable !== false || typeof record.preview !== "string" || record.inlineBytes !== null && typeof record.inlineBytes !== "number") {
2438
- return null;
2439
- }
2440
- return record;
2441
- }
2442
- function bytesToBase64(data) {
2443
- const isByte = (n) => typeof n === "number" && Number.isInteger(n) && n >= 0 && n <= 255;
2444
- let bytes = null;
2445
- if (Array.isArray(data) && data.every(isByte)) {
2446
- bytes = data;
2447
- } else if (data && typeof data === "object") {
2448
- const record = data;
2449
- if (record.type === "Buffer" && Array.isArray(record.data) && record.data.every(isByte)) {
2450
- bytes = record.data;
2451
- } else {
2452
- const keys = Object.keys(record);
2453
- if (keys.length > 0 && keys.every((key) => /^\d+$/.test(key))) {
2454
- const values = keys.sort((a, b) => Number(a) - Number(b)).map((key) => record[key]);
2455
- if (values.every(isByte)) {
2456
- bytes = values;
2457
- }
2458
- }
2459
- }
2460
- }
2461
- if (!bytes || bytes.length === 0) {
2462
- return null;
2463
- }
2464
- try {
2465
- let binary = "";
2466
- const CHUNK = 32768;
2467
- for (let i = 0; i < bytes.length; i += CHUNK) {
2468
- binary += String.fromCharCode(...bytes.slice(i, i + CHUNK));
2469
- }
2470
- return typeof btoa === "function" ? btoa(binary) : Buffer.from(binary, "binary").toString("base64");
2471
- } catch {
2472
- return null;
2473
- }
2474
- }
2475
-
2476
- // src/timeline/registry.ts
2477
- function rawTypeOf(item) {
2478
- const raw = item.raw;
2479
- if (raw && typeof raw === "object" && typeof raw.type === "string") {
2480
- return raw.type;
2481
- }
2482
- return null;
2483
- }
2484
- function createToolRegistry(baseEntries, baseFallback, options = {}) {
2485
- const entries = [...options.entries ?? [], ...baseEntries];
2486
- const fallback2 = options.fallback ?? baseFallback;
2487
- const byRawType = /* @__PURE__ */ new Map();
2488
- const byName = /* @__PURE__ */ new Map();
2489
- const byPrefixedLeaf = /* @__PURE__ */ new Map();
2490
- for (const entry of entries) {
2491
- if (entry.match === "rawType") {
2492
- if (!byRawType.has(entry.type)) {
2493
- byRawType.set(entry.type, entry.render);
2494
- }
2495
- } else if (!byName.has(entry.name)) {
2496
- byName.set(entry.name, entry.render);
2497
- }
2498
- if (entry.match === "name" && entry.matchPrefixedLeaf !== false) {
2499
- if (!byPrefixedLeaf.has(entry.name)) {
2500
- byPrefixedLeaf.set(entry.name, entry.render);
2501
- }
2502
- }
2503
- }
2504
- const resolve = (item) => {
2505
- const rawType = rawTypeOf(item);
2506
- if (rawType) {
2507
- const byType = byRawType.get(rawType);
2508
- if (byType) {
2509
- return byType;
2510
- }
2511
- }
2512
- const exact = byName.get(item.name);
2513
- if (exact) {
2514
- return exact;
2515
- }
2516
- const leaf = mcpToolLeaf(item.name);
2517
- if (leaf !== item.name) {
2518
- const byLeaf = byPrefixedLeaf.get(leaf);
2519
- if (byLeaf) {
2520
- return byLeaf;
2521
- }
2522
- }
2523
- return fallback2;
2524
- };
2525
- return { resolve, fallback: fallback2 };
2526
- }
2527
-
2528
2002
  // src/lib/git-patch.ts
2529
2003
  function gitFileDiffToPatch(file) {
2530
2004
  const oldPath = file.oldPath ?? file.path;
@@ -2695,9 +2169,7 @@ function PlainPatch({ diff }) {
2695
2169
 
2696
2170
  // src/timeline/tool-renderers.tsx
2697
2171
  import { defaultUrlTransform } from "react-markdown";
2698
- import {
2699
- parseSandboxFileArtifactReceipt
2700
- } from "@opengeni/sdk";
2172
+ import { parseSandboxFileArtifactReceipt } from "@opengeni/sdk";
2701
2173
  import {
2702
2174
  BoxIcon,
2703
2175
  BrainCircuitIcon as BrainCircuitIcon2,
@@ -2792,7 +2264,7 @@ function RawPatch({ diff }) {
2792
2264
  }
2793
2265
 
2794
2266
  // src/timeline/tool-renderers.tsx
2795
- import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
2267
+ import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
2796
2268
  var ICON_SIZE = "size-3.5";
2797
2269
  function RunningPreview({ children }) {
2798
2270
  const compact = useContext4(CompactActivityContext);
@@ -2801,173 +2273,6 @@ function RunningPreview({ children }) {
2801
2273
  /* @__PURE__ */ jsx9("span", { className: "min-w-0 truncate", children })
2802
2274
  ] });
2803
2275
  }
2804
- function withComputePreview(label, preview) {
2805
- if (!label) {
2806
- return preview;
2807
- }
2808
- return `on ${label} \xB7 ${preview}`;
2809
- }
2810
- function ExecRenderer({ item }) {
2811
- const args = parseToolArgs(item.arguments);
2812
- const cmd = typeof args.cmd === "string" ? args.cmd : "";
2813
- const workdir = typeof args.workdir === "string" ? args.workdir : null;
2814
- const running = item.status === "running";
2815
- const out = item.output;
2816
- const title = `$ ${cmd}`;
2817
- const computeLabel = useTimelineComputeLabel();
2818
- if (item.status === "failed" && out === void 0) {
2819
- return /* @__PURE__ */ jsx9(
2820
- ActivityDisclosure,
2821
- {
2822
- icon: /* @__PURE__ */ jsx9(TerminalIcon, { className: ICON_SIZE }),
2823
- iconTone: "failed",
2824
- title,
2825
- titleMono: true,
2826
- chip: { tone: "bad", text: "failed" },
2827
- preview: withComputePreview(computeLabel, "output lost \u2014 NUL byte could not be stored"),
2828
- children: /* @__PURE__ */ jsx9(BodyNote, { tone: "error", children: "output contained a NUL byte and could not be stored; the turn failed on this tool's output insert \u2014 no output event ever arrived." })
2829
- }
2830
- );
2831
- }
2832
- if (item.status === "failed" && (out == null || out === "")) {
2833
- return /* @__PURE__ */ jsx9(
2834
- ActivityDisclosure,
2835
- {
2836
- icon: /* @__PURE__ */ jsx9(TerminalIcon, { className: ICON_SIZE }),
2837
- iconTone: "failed",
2838
- title,
2839
- titleMono: true,
2840
- chip: { tone: "bad", text: "failed" },
2841
- preview: withComputePreview(computeLabel, "tool call failed"),
2842
- children: /* @__PURE__ */ jsx9(BodyNote, { tone: "error", children: "the tool call failed with no output." })
2843
- }
2844
- );
2845
- }
2846
- if (running) {
2847
- const streamed = typeof out === "string" ? stripExecBanner(out) : "";
2848
- const runningPreview = streamed ? `${streamed.split("\n").length} lines` : "running\u2026";
2849
- return /* @__PURE__ */ jsx9(
2850
- ActivityDisclosure,
2851
- {
2852
- icon: /* @__PURE__ */ jsx9(TerminalIcon, { className: ICON_SIZE }),
2853
- iconTone: "running",
2854
- title,
2855
- titleMono: true,
2856
- running: true,
2857
- preview: /* @__PURE__ */ jsx9(RunningPreview, { children: withComputePreview(computeLabel, runningPreview) }),
2858
- children: /* @__PURE__ */ jsx9(TermBlock, { command: null, workdir, output: streamed, live: true })
2859
- }
2860
- );
2861
- }
2862
- const text = typeof out === "string" ? out : stringifyPayload(out);
2863
- const stripped = stripExecBanner(text);
2864
- const bgSession = parseExecBannerSessionId(text);
2865
- const exitCode = sandboxCommandExitCode(text);
2866
- const binary = looksBinary(stripped);
2867
- let chip;
2868
- let iconTone = "muted";
2869
- if (bgSession != null) {
2870
- chip = { tone: "muted", text: `session ${bgSession}` };
2871
- } else if (exitCode != null && exitCode !== 0) {
2872
- chip = { tone: "bad", text: `exit ${exitCode}` };
2873
- iconTone = "failed";
2874
- }
2875
- const peek = binary ? "binary output" : tailPeek(stripped) || "(no output)";
2876
- const truncated = execTruncated(text);
2877
- const preview = withComputePreview(computeLabel, truncated ? `\u22EF truncated \xB7 ${peek}` : peek);
2878
- const body = binary ? "(binary output suppressed)" : stripped;
2879
- return /* @__PURE__ */ jsxs6(
2880
- ActivityDisclosure,
2881
- {
2882
- icon: /* @__PURE__ */ jsx9(TerminalIcon, { className: ICON_SIZE }),
2883
- iconTone,
2884
- title,
2885
- titleMono: true,
2886
- ...chip ? { chip } : {},
2887
- failed: item.status === "failed",
2888
- cancelled: item.status === "cancelled",
2889
- preview,
2890
- children: [
2891
- /* @__PURE__ */ jsx9(
2892
- TermBlock,
2893
- {
2894
- command: null,
2895
- workdir,
2896
- output: body,
2897
- failed: item.status === "failed" || exitCode != null && exitCode !== 0
2898
- }
2899
- ),
2900
- bgSession != null ? /* @__PURE__ */ jsxs6(BodyNote, { children: [
2901
- "\u21B3 session ",
2902
- bgSession,
2903
- " \u2014 a later write_stdin can target this PTY."
2904
- ] }) : null
2905
- ]
2906
- }
2907
- );
2908
- }
2909
- function WriteStdinRenderer({ item }) {
2910
- const args = parseToolArgs(item.arguments);
2911
- const sessionId = typeof args.session_id === "string" || typeof args.session_id === "number" ? args.session_id : void 0;
2912
- const running = item.status === "running";
2913
- const text = typeof item.output === "string" ? item.output : stringifyPayload(item.output);
2914
- const lost = isExecSessionLostBanner(text);
2915
- const keys = controlCaret(typeof args.chars === "string" ? args.chars : "");
2916
- const exitCode = sandboxCommandExitCode(text);
2917
- const stripped = stripExecBanner(text);
2918
- if (running) {
2919
- return /* @__PURE__ */ jsx9(
2920
- ActivityDisclosure,
2921
- {
2922
- icon: /* @__PURE__ */ jsx9(KeyboardIcon, { className: ICON_SIZE }),
2923
- iconTone: "running",
2924
- title: `session ${sessionId} \u2190 ${keys || "\u2205"}`,
2925
- titleMono: true,
2926
- running: true,
2927
- preview: /* @__PURE__ */ jsx9(RunningPreview, { children: "sending\u2026" }),
2928
- children: /* @__PURE__ */ jsxs6(BodyNote, { children: [
2929
- "sending input to session ",
2930
- sessionId,
2931
- "\u2026"
2932
- ] })
2933
- }
2934
- );
2935
- }
2936
- let chip;
2937
- if (lost) {
2938
- chip = { tone: "bad", text: "lost" };
2939
- } else if (exitCode != null && exitCode !== 0) {
2940
- chip = { tone: "bad", text: `exit ${exitCode}` };
2941
- }
2942
- return /* @__PURE__ */ jsx9(
2943
- ActivityDisclosure,
2944
- {
2945
- icon: /* @__PURE__ */ jsx9(KeyboardIcon, { className: ICON_SIZE }),
2946
- iconTone: lost ? "failed" : "muted",
2947
- title: `session ${sessionId} \u2190 ${keys || "\u2205"}`,
2948
- titleMono: true,
2949
- ...chip ? { chip } : {},
2950
- failed: item.status === "failed",
2951
- cancelled: item.status === "cancelled",
2952
- preview: lost ? `session ${sessionId} PTY vanished` : tailPeek(stripped) || "sent",
2953
- children: lost ? /* @__PURE__ */ jsx9(BodyNote, { tone: "error", children: stripped || text }) : /* @__PURE__ */ jsx9(TermBlock, { command: `write_stdin \u2192 session ${sessionId}`, output: stripped })
2954
- }
2955
- );
2956
- }
2957
- function verbForOp(op) {
2958
- if (!op) {
2959
- return "Edited";
2960
- }
2961
- return op.type === "create_file" ? "Created" : op.type === "delete_file" ? "Deleted" : op.moveTo ? "Renamed" : "Edited";
2962
- }
2963
- function basename(path) {
2964
- const parts = path.split("/").filter(Boolean);
2965
- return parts.length ? parts[parts.length - 1] : path;
2966
- }
2967
- function dirname(path) {
2968
- const idx = path.lastIndexOf("/");
2969
- return idx >= 0 ? path.slice(0, idx + 1) : "";
2970
- }
2971
2276
  function PathPreview({
2972
2277
  path,
2973
2278
  add,
@@ -2975,8 +2280,8 @@ function PathPreview({
2975
2280
  }) {
2976
2281
  return /* @__PURE__ */ jsxs6("span", { className: "inline-flex items-center gap-2 truncate font-og-mono", children: [
2977
2282
  /* @__PURE__ */ jsxs6("span", { className: "truncate", children: [
2978
- /* @__PURE__ */ jsx9("span", { className: "text-og-fg-subtle", children: dirname(path) }),
2979
- /* @__PURE__ */ jsx9("span", { className: "text-og-fg-muted", children: basename(path) })
2283
+ /* @__PURE__ */ jsx9("span", { className: "text-og-fg-subtle", children: pathDirname(path) }),
2284
+ /* @__PURE__ */ jsx9("span", { className: "text-og-fg-muted", children: pathBasename(path) })
2980
2285
  ] }),
2981
2286
  add != null || del != null ? /* @__PURE__ */ jsxs6("span", { className: "shrink-0 text-og-fg-subtle", children: [
2982
2287
  add != null ? `+${add}` : "",
@@ -2985,133 +2290,157 @@ function PathPreview({
2985
2290
  ] }) : null
2986
2291
  ] });
2987
2292
  }
2988
- function ApplyPatchRenderer({ item }) {
2989
- const ops = applyPatchOpsFromToolItem(item);
2990
- const failed = item.status === "failed";
2991
- const cancelled = item.status === "cancelled";
2992
- const running = item.status === "running";
2993
- const firstOp = ops[0];
2994
- if (running) {
2995
- const fileCount = ops.length;
2996
- const titleVerb = firstOp ? `Applying ${basename(firstOp.path)}` : "Applying patch";
2997
- return /* @__PURE__ */ jsx9(
2998
- ActivityDisclosure,
2999
- {
3000
- icon: /* @__PURE__ */ jsx9(FileDiffIcon, { className: ICON_SIZE }),
3001
- iconTone: "running",
3002
- title: fileCount > 1 ? `Applying ${fileCount} files` : titleVerb,
3003
- running: true,
3004
- preview: /* @__PURE__ */ jsx9(RunningPreview, { children: fileCount > 1 ? `${fileCount} files` : firstOp ? firstOp.path : "applying\u2026" }),
3005
- children: ops.map((op, index) => {
3006
- const file2 = safeParseOp(op);
3007
- const key = `${op.type}:${op.path}:${index}`;
3008
- return file2 ? /* @__PURE__ */ jsx9(ToolDiff, { files: [file2] }, key) : /* @__PURE__ */ jsxs6("div", { children: [
3009
- /* @__PURE__ */ jsx9("p", { className: "mb-1 font-og-mono text-og-xs text-og-fg-muted", children: op.path }),
3010
- /* @__PURE__ */ jsx9(RawPatch, { diff: op.diff ?? "" })
3011
- ] }, key);
3012
- })
3013
- }
3014
- );
3015
- }
3016
- if (failed) {
3017
- return /* @__PURE__ */ jsx9(
3018
- ActivityDisclosure,
3019
- {
3020
- icon: /* @__PURE__ */ jsx9(FileDiffIcon, { className: ICON_SIZE }),
3021
- iconTone: "failed",
3022
- title: firstOp ? `${verbForOp(firstOp)} ${basename(firstOp.path)}` : "apply_patch",
3023
- chip: { tone: "bad", text: "failed" },
3024
- preview: typeof item.output === "string" ? item.output : "patch failed",
3025
- children: /* @__PURE__ */ jsx9(PayloadBlock, { label: "Error", value: item.output, failed: true })
3026
- }
3027
- );
3028
- }
3029
- if (ops.length > 1) {
3030
- const parsed = ops.map((op) => safeParseOp(op));
3031
- const goodFiles = parsed.filter((f) => f !== null);
3032
- const add = goodFiles.reduce((n, f) => n + f.additions, 0);
3033
- const del = goodFiles.reduce((n, f) => n + f.deletions, 0);
3034
- return /* @__PURE__ */ jsx9(
3035
- ActivityDisclosure,
3036
- {
3037
- icon: /* @__PURE__ */ jsx9(FileDiffIcon, { className: ICON_SIZE }),
3038
- iconTone: "accent",
3039
- title: `Edited ${ops.length} files`,
3040
- cancelled,
3041
- preview: /* @__PURE__ */ jsxs6("span", { className: "inline-flex items-center gap-2 font-og-mono", children: [
3042
- /* @__PURE__ */ jsxs6("span", { className: "text-og-fg-muted", children: [
3043
- ops.length,
3044
- " files"
3045
- ] }),
3046
- /* @__PURE__ */ jsxs6("span", { className: "text-og-fg-subtle", children: [
3047
- "+",
3048
- add,
3049
- " \u2212",
3050
- del
3051
- ] })
3052
- ] }),
3053
- children: ops.map((op, index) => {
3054
- const file2 = parsed[index];
3055
- const key = `${op.type}:${op.path}:${index}`;
3056
- return file2 ? /* @__PURE__ */ jsx9(ToolDiff, { files: [file2] }, key) : /* @__PURE__ */ jsxs6("div", { children: [
3057
- /* @__PURE__ */ jsx9("p", { className: "mb-1 font-og-mono text-og-xs text-og-fg-muted", children: op.path }),
3058
- /* @__PURE__ */ jsx9(RawPatch, { diff: op.diff ?? "" })
3059
- ] }, key);
3060
- })
3061
- }
3062
- );
3063
- }
3064
- if (!firstOp) {
3065
- return /* @__PURE__ */ jsx9(GenericRenderer, { item });
3066
- }
3067
- if (firstOp.type === "delete_file") {
3068
- return /* @__PURE__ */ jsx9(
3069
- ActivityDisclosure,
3070
- {
3071
- icon: /* @__PURE__ */ jsx9(FileDiffIcon, { className: ICON_SIZE }),
3072
- iconTone: "failed",
3073
- title: `Deleted ${basename(firstOp.path)}`,
3074
- cancelled,
3075
- preview: /* @__PURE__ */ jsx9(PathPreview, { path: firstOp.path }),
3076
- children: /* @__PURE__ */ jsx9(BodyNote, { children: "File deleted \u2014 no diff to show." })
3077
- }
3078
- );
3079
- }
3080
- const file = safeParseOp(firstOp);
3081
- if (!file) {
3082
- return /* @__PURE__ */ jsx9(
3083
- ActivityDisclosure,
3084
- {
3085
- icon: /* @__PURE__ */ jsx9(FileDiffIcon, { className: ICON_SIZE }),
3086
- iconTone: "accent",
3087
- title: `${verbForOp(firstOp)} ${basename(firstOp.path)}`,
3088
- cancelled,
3089
- preview: /* @__PURE__ */ jsxs6("span", { className: "inline-flex items-center gap-2 font-og-mono", children: [
3090
- /* @__PURE__ */ jsx9("span", { className: "text-og-fg-muted", children: basename(firstOp.path) }),
3091
- /* @__PURE__ */ jsx9("span", { className: "text-og-fg-subtle", children: "malformed V4A" })
2293
+ var TOOL_ICONS = {
2294
+ terminal: TerminalIcon,
2295
+ keyboard: KeyboardIcon,
2296
+ "file-diff": FileDiffIcon,
2297
+ search: SearchIcon,
2298
+ question: MessageCircleQuestionIcon2,
2299
+ target: TargetIcon,
2300
+ brain: BrainCircuitIcon2,
2301
+ sessions: MessagesSquareIcon,
2302
+ server: ServerIcon,
2303
+ "server-cog": ServerCogIcon,
2304
+ calendar: CalendarClockIcon,
2305
+ panels: PanelsTopLeftIcon,
2306
+ share: Share2Icon,
2307
+ message: MessageSquareIcon,
2308
+ git: FolderGitIcon,
2309
+ box: BoxIcon,
2310
+ key: KeyRoundIcon,
2311
+ "file-search": FileSearchIcon,
2312
+ "package-search": PackageSearchIcon,
2313
+ plug: PlugIcon,
2314
+ wrench: WrenchIcon
2315
+ };
2316
+ function presentedPreviewNode(preview) {
2317
+ switch (preview.kind) {
2318
+ case "text":
2319
+ return preview.running ? /* @__PURE__ */ jsx9(RunningPreview, { children: preview.text }) : preview.text;
2320
+ case "path":
2321
+ return /* @__PURE__ */ jsx9(PathPreview, { path: preview.path, add: preview.add, del: preview.del });
2322
+ case "files":
2323
+ return /* @__PURE__ */ jsxs6("span", { className: "inline-flex items-center gap-2 font-og-mono", children: [
2324
+ /* @__PURE__ */ jsxs6("span", { className: "text-og-fg-muted", children: [
2325
+ preview.count,
2326
+ " files"
3092
2327
  ] }),
3093
- children: /* @__PURE__ */ jsx9(RawPatch, { diff: firstOp.diff ?? "" })
3094
- }
3095
- );
2328
+ /* @__PURE__ */ jsxs6("span", { className: "text-og-fg-subtle", children: [
2329
+ "+",
2330
+ preview.add,
2331
+ " \u2212",
2332
+ preview.del
2333
+ ] })
2334
+ ] });
2335
+ case "malformed":
2336
+ return /* @__PURE__ */ jsxs6("span", { className: "inline-flex items-center gap-2 font-og-mono", children: [
2337
+ /* @__PURE__ */ jsx9("span", { className: "text-og-fg-muted", children: preview.name }),
2338
+ /* @__PURE__ */ jsx9("span", { className: "text-og-fg-subtle", children: "malformed V4A" })
2339
+ ] });
2340
+ }
2341
+ }
2342
+ function PresentedBody({ body }) {
2343
+ switch (body.kind) {
2344
+ case "term":
2345
+ return /* @__PURE__ */ jsxs6(Fragment3, { children: [
2346
+ /* @__PURE__ */ jsx9(
2347
+ TermBlock,
2348
+ {
2349
+ command: body.command,
2350
+ ...body.workdir !== null || body.command === null ? { workdir: body.workdir } : {},
2351
+ output: body.output,
2352
+ ...body.live ? { live: true } : {},
2353
+ ...body.failed !== void 0 ? { failed: body.failed } : {}
2354
+ }
2355
+ ),
2356
+ body.note ? /* @__PURE__ */ jsx9(BodyNote, { children: body.note }) : null
2357
+ ] });
2358
+ case "note":
2359
+ return body.tone ? /* @__PURE__ */ jsx9(BodyNote, { tone: body.tone, children: body.text }) : /* @__PURE__ */ jsx9(BodyNote, { children: body.text });
2360
+ case "payloads":
2361
+ return /* @__PURE__ */ jsxs6(Fragment3, { children: [
2362
+ body.note ? /* @__PURE__ */ jsx9("p", { className: "m-0 py-1 text-og-sm text-og-fg-muted", children: body.note }) : null,
2363
+ body.blocks.map(
2364
+ (block) => block.failed ? /* @__PURE__ */ jsx9(PayloadBlock, { label: block.label, value: block.value, failed: true }, block.label) : /* @__PURE__ */ jsx9(PayloadBlock, { label: block.label, value: block.value }, block.label)
2365
+ )
2366
+ ] });
2367
+ case "patch":
2368
+ if (body.bare) {
2369
+ return /* @__PURE__ */ jsx9(RawPatch, { diff: body.files[0]?.diff ?? "" });
2370
+ }
2371
+ return /* @__PURE__ */ jsx9(Fragment3, { children: body.files.map(
2372
+ (entry) => entry.file ? /* @__PURE__ */ jsx9(ToolDiff, { files: [entry.file] }, entry.key) : /* @__PURE__ */ jsxs6("div", { children: [
2373
+ /* @__PURE__ */ jsx9("p", { className: "mb-1 font-og-mono text-og-xs text-og-fg-muted", children: entry.path }),
2374
+ /* @__PURE__ */ jsx9(RawPatch, { diff: entry.diff })
2375
+ ] }, entry.key)
2376
+ ) });
2377
+ case "web-results":
2378
+ return /* @__PURE__ */ jsx9(WebSearchResults, { results: body.results });
3096
2379
  }
2380
+ }
2381
+ function WebSearchResults({ results }) {
2382
+ const resultOccurrences = /* @__PURE__ */ new Map();
2383
+ const keyedResults = results?.map((result) => {
2384
+ const contentKey = `${result.domain}\0${result.title}\0${result.snippet}`;
2385
+ const occurrence = (resultOccurrences.get(contentKey) ?? 0) + 1;
2386
+ resultOccurrences.set(contentKey, occurrence);
2387
+ return { key: `${contentKey}\0${occurrence}`, result };
2388
+ });
2389
+ if (!keyedResults || !keyedResults.length) {
2390
+ return /* @__PURE__ */ jsx9(BodyNote, { children: "results folded into model context \u2014 no list available." });
2391
+ }
2392
+ return /* @__PURE__ */ jsx9("ul", { className: "flex flex-col gap-2", children: keyedResults.map(({ key, result }) => /* @__PURE__ */ jsxs6("li", { className: "flex gap-2.5", children: [
2393
+ /* @__PURE__ */ jsx9(GlobeIcon, { className: "mt-0.5 size-3.5 shrink-0 text-og-fg-subtle" }),
2394
+ /* @__PURE__ */ jsxs6("div", { className: "min-w-0", children: [
2395
+ /* @__PURE__ */ jsxs6("p", { className: "truncate text-og-base text-og-fg", children: [
2396
+ result.title,
2397
+ " ",
2398
+ /* @__PURE__ */ jsx9("span", { className: "text-og-fg-subtle", children: result.domain })
2399
+ ] }),
2400
+ /* @__PURE__ */ jsx9("p", { className: "text-og-sm leading-5 text-og-fg-muted", children: result.snippet })
2401
+ ] })
2402
+ ] }, key)) });
2403
+ }
2404
+ function PresentedToolRow({ presentation: p }) {
2405
+ const Icon = TOOL_ICONS[p.icon];
3097
2406
  return /* @__PURE__ */ jsx9(
3098
2407
  ActivityDisclosure,
3099
2408
  {
3100
- icon: /* @__PURE__ */ jsx9(FileDiffIcon, { className: ICON_SIZE }),
3101
- iconTone: "accent",
3102
- title: `${verbForOp(firstOp)} ${basename(file.path)}`,
3103
- cancelled,
3104
- preview: /* @__PURE__ */ jsx9(PathPreview, { path: file.path, add: file.additions, del: file.deletions }),
3105
- children: /* @__PURE__ */ jsx9(ToolDiff, { files: [file] })
2409
+ icon: /* @__PURE__ */ jsx9(Icon, { className: ICON_SIZE }),
2410
+ iconTone: p.iconTone,
2411
+ title: p.title,
2412
+ ...p.titleMono ? { titleMono: true } : {},
2413
+ ...p.running ? { running: true } : {},
2414
+ ...p.chip ? { chip: p.chip } : {},
2415
+ ...p.failed !== void 0 ? { failed: p.failed } : {},
2416
+ ...p.cancelled !== void 0 ? { cancelled: p.cancelled } : {},
2417
+ preview: p.preview ? presentedPreviewNode(p.preview) : void 0,
2418
+ children: /* @__PURE__ */ jsx9(PresentedBody, { body: p.body })
3106
2419
  }
3107
2420
  );
3108
2421
  }
3109
- function safeParseOp(op) {
3110
- try {
3111
- return v4aToGitFileDiff(op);
3112
- } catch {
3113
- return null;
3114
- }
2422
+ function ExecRenderer({ item }) {
2423
+ const computeLabel = useTimelineComputeLabel();
2424
+ return /* @__PURE__ */ jsx9(PresentedToolRow, { presentation: execPresentation(item, { computeLabel }) });
2425
+ }
2426
+ function WriteStdinRenderer({ item }) {
2427
+ return /* @__PURE__ */ jsx9(PresentedToolRow, { presentation: writeStdinPresentation(item) });
2428
+ }
2429
+ function ApplyPatchRenderer({ item }) {
2430
+ const presentation = applyPatchPresentation(item);
2431
+ return presentation ? /* @__PURE__ */ jsx9(PresentedToolRow, { presentation }) : /* @__PURE__ */ jsx9(GenericRenderer, { item });
2432
+ }
2433
+ function WebSearchRenderer({ item }) {
2434
+ return /* @__PURE__ */ jsx9(PresentedToolRow, { presentation: webSearchPresentation(item) });
2435
+ }
2436
+ function AskRenderer({ item }) {
2437
+ return /* @__PURE__ */ jsx9(PresentedToolRow, { presentation: askPresentation(item) });
2438
+ }
2439
+ function RunOnRenderer({ item }) {
2440
+ return /* @__PURE__ */ jsx9(PresentedToolRow, { presentation: runOnPresentation(item) });
2441
+ }
2442
+ function UnreviewedGenericRenderer({ item }) {
2443
+ return /* @__PURE__ */ jsx9(PresentedToolRow, { presentation: genericToolPresentation(item) });
3115
2444
  }
3116
2445
  function computerVerb(action) {
3117
2446
  if (!action || !action.type) {
@@ -3643,7 +2972,15 @@ function SandboxFilePublishRenderer({ item, loadRetainedArtifact }) {
3643
2972
  preview: formatBytes(receipt.artifact.originalBytes),
3644
2973
  children: [
3645
2974
  downloadButton,
3646
- openLink
2975
+ openLink,
2976
+ isPatchFilename(receipt.filename) ? /* @__PURE__ */ jsx9(
2977
+ PatchApplyCommand,
2978
+ {
2979
+ artifact: receipt.artifact,
2980
+ filename: receipt.filename,
2981
+ load: loadRetainedArtifact
2982
+ }
2983
+ ) : null
3647
2984
  ]
3648
2985
  }
3649
2986
  );
@@ -3812,97 +3149,6 @@ function retainedImageFilename(artifact) {
3812
3149
  const extension = artifact.contentType === "image/jpeg" ? "jpg" : artifact.contentType === "image/webp" ? "webp" : "png";
3813
3150
  return `${artifact.kind}-${artifact.artifactId}.${extension}`;
3814
3151
  }
3815
- function webSearchQueryFromArguments(args) {
3816
- if (typeof args === "string") {
3817
- const trimmed = args.trim();
3818
- if (!trimmed) {
3819
- return null;
3820
- }
3821
- try {
3822
- return webSearchQueryFromArguments(JSON.parse(trimmed));
3823
- } catch {
3824
- return trimmed;
3825
- }
3826
- }
3827
- if (!args || typeof args !== "object") {
3828
- return null;
3829
- }
3830
- const record = args;
3831
- if (typeof record.query === "string" && record.query.trim().length > 0) {
3832
- return record.query;
3833
- }
3834
- if (Array.isArray(record.queries)) {
3835
- const first = record.queries.find(
3836
- (value) => typeof value === "string" && value.trim().length > 0
3837
- );
3838
- if (first) {
3839
- return first;
3840
- }
3841
- }
3842
- return null;
3843
- }
3844
- function WebSearchRenderer({ item }) {
3845
- const raw = item.raw ?? {};
3846
- const action = raw.providerData?.action ?? {};
3847
- const actionType = action.type ?? "search";
3848
- const queries = (action.queries ?? []).filter(
3849
- (value) => typeof value === "string" && value.trim().length > 0
3850
- );
3851
- const searchQuery = (typeof action.query === "string" && action.query.trim().length > 0 ? action.query : null) ?? queries[0] ?? webSearchQueryFromArguments(item.arguments);
3852
- const running = item.status === "running";
3853
- const query = actionType === "open_page" ? action.url ?? "(page unavailable)" : actionType === "find_in_page" ? action.pattern && action.url ? `"${action.pattern}" in ${action.url}` : action.pattern ?? action.url ?? "(page unavailable)" : (
3854
- // Codex often emits the live card before action.query/queries land;
3855
- // don't flash the scary unavailable copy while still searching.
3856
- searchQuery ?? (running ? "\u2026" : "(query unavailable)")
3857
- );
3858
- const variants = queries.length > 1 ? ` +${queries.length - 1} variants` : "";
3859
- const runningTitle = actionType === "open_page" ? "Opening web page" : actionType === "find_in_page" ? "Searching within page" : "Searching the web";
3860
- const completedTitle = actionType === "open_page" ? "Opened web page" : actionType === "find_in_page" ? "Searched within page" : "Searched the web";
3861
- const rawResults = item.output?.results;
3862
- const results = Array.isArray(rawResults) ? rawResults.filter((r) => !!r && typeof r === "object") : void 0;
3863
- const resultOccurrences = /* @__PURE__ */ new Map();
3864
- const keyedResults = results?.map((result) => {
3865
- const contentKey = `${result.domain}\0${result.title}\0${result.snippet}`;
3866
- const occurrence = (resultOccurrences.get(contentKey) ?? 0) + 1;
3867
- resultOccurrences.set(contentKey, occurrence);
3868
- return { key: `${contentKey}\0${occurrence}`, result };
3869
- });
3870
- if (running) {
3871
- return /* @__PURE__ */ jsx9(
3872
- ActivityDisclosure,
3873
- {
3874
- icon: /* @__PURE__ */ jsx9(SearchIcon, { className: ICON_SIZE }),
3875
- iconTone: "running",
3876
- title: runningTitle,
3877
- running: true,
3878
- preview: /* @__PURE__ */ jsx9(RunningPreview, { children: `${query}${variants}` }),
3879
- children: /* @__PURE__ */ jsx9(BodyNote, { children: "searching\u2026 results fold into the model context (no output event)." })
3880
- }
3881
- );
3882
- }
3883
- return /* @__PURE__ */ jsx9(
3884
- ActivityDisclosure,
3885
- {
3886
- icon: /* @__PURE__ */ jsx9(SearchIcon, { className: ICON_SIZE }),
3887
- iconTone: "muted",
3888
- title: completedTitle,
3889
- preview: `${query}${variants}`,
3890
- failed: item.status === "failed",
3891
- cancelled: item.status === "cancelled",
3892
- children: keyedResults && keyedResults.length ? /* @__PURE__ */ jsx9("ul", { className: "flex flex-col gap-2", children: keyedResults.map(({ key, result }) => /* @__PURE__ */ jsxs6("li", { className: "flex gap-2.5", children: [
3893
- /* @__PURE__ */ jsx9(GlobeIcon, { className: "mt-0.5 size-3.5 shrink-0 text-og-fg-subtle" }),
3894
- /* @__PURE__ */ jsxs6("div", { className: "min-w-0", children: [
3895
- /* @__PURE__ */ jsxs6("p", { className: "truncate text-og-base text-og-fg", children: [
3896
- result.title,
3897
- " ",
3898
- /* @__PURE__ */ jsx9("span", { className: "text-og-fg-subtle", children: result.domain })
3899
- ] }),
3900
- /* @__PURE__ */ jsx9("p", { className: "text-og-sm leading-5 text-og-fg-muted", children: result.snippet })
3901
- ] })
3902
- ] }, key)) }) : /* @__PURE__ */ jsx9(BodyNote, { children: "results folded into model context \u2014 no list available." })
3903
- }
3904
- );
3905
- }
3906
3152
  var VIEW_IMAGE_ERRORS = [
3907
3153
  "was not found",
3908
3154
  "is not a file",
@@ -3923,7 +3169,7 @@ function ViewImageRenderer({ item, loadRetainedScreenshot }) {
3923
3169
  {
3924
3170
  icon: /* @__PURE__ */ jsx9(ImageIcon, { className: ICON_SIZE }),
3925
3171
  iconTone: "running",
3926
- title: `View ${basename(path)}`,
3172
+ title: `View ${pathBasename(path)}`,
3927
3173
  running: true,
3928
3174
  preview: /* @__PURE__ */ jsx9(RunningPreview, { children: "reading\u2026" }),
3929
3175
  media: /* @__PURE__ */ jsx9(MediaSkeleton, {}),
@@ -3934,7 +3180,7 @@ function ViewImageRenderer({ item, loadRetainedScreenshot }) {
3934
3180
  const viewFailed = item.status === "failed";
3935
3181
  const viewCancelled = item.status === "cancelled";
3936
3182
  if (retained) {
3937
- const title = `Viewed ${basename(path)}`;
3183
+ const title = `Viewed ${pathBasename(path)}`;
3938
3184
  if (!retained.available) {
3939
3185
  const state = retained.reason === "expired" || retained.reason === "deleted" ? retained.reason : "unavailable";
3940
3186
  return /* @__PURE__ */ jsx9(
@@ -3981,7 +3227,7 @@ function ViewImageRenderer({ item, loadRetainedScreenshot }) {
3981
3227
  {
3982
3228
  icon: /* @__PURE__ */ jsx9(ImageIcon, { className: ICON_SIZE }),
3983
3229
  iconTone: "failed",
3984
- title: `View ${basename(path)}`,
3230
+ title: `View ${pathBasename(path)}`,
3985
3231
  chip: { tone: "bad", text: tooBig ? "too large" : "error" },
3986
3232
  preview: text,
3987
3233
  children: /* @__PURE__ */ jsx9(BodyNote, { tone: "error", children: text })
@@ -3994,7 +3240,7 @@ function ViewImageRenderer({ item, loadRetainedScreenshot }) {
3994
3240
  {
3995
3241
  icon: /* @__PURE__ */ jsx9(ImageIcon, { className: ICON_SIZE }),
3996
3242
  iconTone: viewFailed ? "failed" : "muted",
3997
- title: `Viewed ${basename(path)}`,
3243
+ title: `Viewed ${pathBasename(path)}`,
3998
3244
  failed: viewFailed,
3999
3245
  cancelled: viewCancelled,
4000
3246
  preview: path,
@@ -4008,7 +3254,7 @@ function ViewImageRenderer({ item, loadRetainedScreenshot }) {
4008
3254
  {
4009
3255
  icon: /* @__PURE__ */ jsx9(ImageIcon, { className: ICON_SIZE }),
4010
3256
  iconTone: viewFailed ? "failed" : "muted",
4011
- title: `Viewed ${basename(path)} \xB7 image omitted \xB7 not retained`,
3257
+ title: `Viewed ${pathBasename(path)} \xB7 image omitted \xB7 not retained`,
4012
3258
  failed: viewFailed,
4013
3259
  cancelled: viewCancelled,
4014
3260
  preview: "inline image omitted \xB7 not retained",
@@ -4027,7 +3273,7 @@ function ViewImageRenderer({ item, loadRetainedScreenshot }) {
4027
3273
  {
4028
3274
  icon: /* @__PURE__ */ jsx9(ImageIcon, { className: ICON_SIZE }),
4029
3275
  iconTone: viewFailed ? "failed" : "muted",
4030
- title: `Viewed ${basename(path)}`,
3276
+ title: `Viewed ${pathBasename(path)}`,
4031
3277
  failed: viewFailed,
4032
3278
  cancelled: viewCancelled,
4033
3279
  preview: "(no image)",
@@ -4041,7 +3287,7 @@ function ViewImageRenderer({ item, loadRetainedScreenshot }) {
4041
3287
  {
4042
3288
  icon: /* @__PURE__ */ jsx9(ImageIcon, { className: ICON_SIZE }),
4043
3289
  iconTone: viewFailed ? "failed" : "accent",
4044
- title: `Viewed ${basename(path)}`,
3290
+ title: `Viewed ${pathBasename(path)}`,
4045
3291
  failed: viewFailed,
4046
3292
  cancelled: viewCancelled,
4047
3293
  media: /* @__PURE__ */ jsx9(Thumbnail, { src: text, caption: path, alt: path }),
@@ -4099,92 +3345,6 @@ function SecretSetRenderer({ item }) {
4099
3345
  }
4100
3346
  );
4101
3347
  }
4102
- function splitToolWireName(name) {
4103
- const boundary = name.indexOf("__");
4104
- if (boundary <= 0) {
4105
- return { name, source: null, leaf: name };
4106
- }
4107
- return {
4108
- name,
4109
- source: name.slice(0, boundary),
4110
- leaf: name.slice(boundary + 2)
4111
- };
4112
- }
4113
- function toolSearchQuery(item) {
4114
- const fromArgs = parseToolArgs(item.arguments);
4115
- if (typeof fromArgs.query === "string" && fromArgs.query.trim()) {
4116
- return fromArgs.query.trim();
4117
- }
4118
- const raw = item.raw;
4119
- if (raw && typeof raw === "object") {
4120
- const rawArgs = raw.arguments;
4121
- if (typeof rawArgs === "string" && rawArgs.trim()) {
4122
- const parsed = tryParseJson(rawArgs);
4123
- if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
4124
- const query = parsed.query;
4125
- if (typeof query === "string" && query.trim()) {
4126
- return query.trim();
4127
- }
4128
- }
4129
- } else if (rawArgs && typeof rawArgs === "object" && !Array.isArray(rawArgs)) {
4130
- const query = rawArgs.query;
4131
- if (typeof query === "string" && query.trim()) {
4132
- return query.trim();
4133
- }
4134
- }
4135
- }
4136
- return "";
4137
- }
4138
- function parseDisclosedTools(output) {
4139
- if (output && typeof output === "object" && !Array.isArray(output)) {
4140
- const tools = output.tools;
4141
- if (Array.isArray(tools)) {
4142
- return tools.map((tool) => {
4143
- if (typeof tool === "string" && tool.trim()) {
4144
- return splitToolWireName(tool.trim());
4145
- }
4146
- if (tool && typeof tool === "object" && typeof tool.name === "string") {
4147
- const name = tool.name.trim();
4148
- return name ? splitToolWireName(name) : null;
4149
- }
4150
- return null;
4151
- }).filter((tool) => tool != null);
4152
- }
4153
- }
4154
- const { text } = unwrapMcpOutput(output);
4155
- const trimmed = text.trim();
4156
- if (!trimmed) {
4157
- return null;
4158
- }
4159
- if (/^no matching tools found\.?$/i.test(trimmed)) {
4160
- return [];
4161
- }
4162
- const disclosed = trimmed.match(/^disclosed tools:\s*(.+)$/i);
4163
- if (disclosed?.[1]) {
4164
- return disclosed[1].split(",").map((part) => part.trim()).filter(Boolean).map(splitToolWireName);
4165
- }
4166
- const parsed = tryParseJson(trimmed);
4167
- if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
4168
- return parseDisclosedTools(parsed);
4169
- }
4170
- return null;
4171
- }
4172
- function toolSearchPreview(tools, cancelled) {
4173
- if (cancelled) {
4174
- return void 0;
4175
- }
4176
- if (!tools) {
4177
- return "Done";
4178
- }
4179
- if (tools.length === 0) {
4180
- return "No matches";
4181
- }
4182
- if (tools.length === 1) {
4183
- return tools[0].leaf;
4184
- }
4185
- const head = tools[0].leaf;
4186
- return `${tools.length} tools \xB7 ${truncatePreview(head, 28)}`;
4187
- }
4188
3348
  function ToolSearchRenderer({ item }) {
4189
3349
  const query = toolSearchQuery(item);
4190
3350
  const icon = /* @__PURE__ */ jsx9(PackageSearchIcon, { className: ICON_SIZE });
@@ -4379,22 +3539,6 @@ function SetSessionTitleRenderer({ item }) {
4379
3539
  }
4380
3540
  );
4381
3541
  }
4382
- function parseSearchHits(outText) {
4383
- const parsed = tryParseJson(outText);
4384
- if (parsed == null) {
4385
- return null;
4386
- }
4387
- const list = Array.isArray(parsed) ? parsed : parsed && typeof parsed === "object" && Array.isArray(parsed.results) ? parsed.results : parsed && typeof parsed === "object" && Array.isArray(parsed.hits) ? parsed.hits : null;
4388
- if (!list) {
4389
- return null;
4390
- }
4391
- return list.map((row) => {
4392
- const r = row && typeof row === "object" ? row : {};
4393
- const title = typeof r.title === "string" && r.title || typeof r.name === "string" && r.name || typeof r.documentTitle === "string" && r.documentTitle || typeof r.path === "string" && r.path || typeof r.id === "string" && r.id || "Result";
4394
- const snippet = typeof r.snippet === "string" && r.snippet || typeof r.text === "string" && r.text || typeof r.content === "string" && r.content || "";
4395
- return { title, snippet: truncatePreview(snippet, 160) };
4396
- });
4397
- }
4398
3542
  function MemoryProposeRenderer({ item }) {
4399
3543
  const args = parseToolArgs(item.arguments);
4400
3544
  const text = typeof args.text === "string" ? args.text.trim() : "";
@@ -4408,300 +3552,23 @@ function MemoryProposeRenderer({ item }) {
4408
3552
  iconTone: "running",
4409
3553
  title,
4410
3554
  running: true,
4411
- preview: /* @__PURE__ */ jsx9(RunningPreview, { children: "Proposing\u2026" }),
4412
- children: /* @__PURE__ */ jsx9(PayloadBlock, { label: "Arguments", value: args })
4413
- }
4414
- );
4415
- }
4416
- const { text: outText, isError } = unwrapMcpOutput(item.output);
4417
- if ((isError || item.status === "failed") && item.status !== "cancelled") {
4418
- return /* @__PURE__ */ jsxs6(
4419
- ActivityDisclosure,
4420
- {
4421
- icon: /* @__PURE__ */ jsx9(BrainCircuitIcon2, { className: ICON_SIZE }),
4422
- iconTone: "failed",
4423
- title,
4424
- failed: true,
4425
- preview: truncatePreview(outText, 80) || "Propose failed",
4426
- children: [
4427
- text ? /* @__PURE__ */ jsx9(BodyNote, { children: text }) : null,
4428
- /* @__PURE__ */ jsx9(PayloadBlock, { label: "Error", value: outText, failed: true })
4429
- ]
4430
- }
4431
- );
4432
- }
4433
- return /* @__PURE__ */ jsxs6(
4434
- ActivityDisclosure,
4435
- {
4436
- icon: /* @__PURE__ */ jsx9(BrainCircuitIcon2, { className: ICON_SIZE }),
4437
- iconTone: "muted",
4438
- title,
4439
- cancelled: item.status === "cancelled",
4440
- preview: text ? truncatePreview(text, 90) : "Done",
4441
- children: [
4442
- text ? /* @__PURE__ */ jsx9(BodyNote, { children: text }) : null,
4443
- /* @__PURE__ */ jsx9(PayloadBlock, { label: "Result", value: outText })
4444
- ]
4445
- }
4446
- );
4447
- }
4448
- function askToolPreview(args) {
4449
- const record = args && typeof args === "object" ? args : null;
4450
- const questions = Array.isArray(record?.questions) ? record.questions : null;
4451
- if (!questions || questions.length === 0) {
4452
- return null;
4453
- }
4454
- const first = questions[0];
4455
- if (!first || typeof first !== "object") {
4456
- return null;
4457
- }
4458
- const q = first;
4459
- const text = typeof q.label === "string" && q.label.trim() ? q.label.trim() : typeof q.prompt === "string" && q.prompt.trim() ? q.prompt.trim() : null;
4460
- if (!text) {
4461
- return null;
4462
- }
4463
- const preview = truncatePreview(text, 90);
4464
- return questions.length > 1 ? `${preview} \xB7 ${questions.length} questions` : preview;
4465
- }
4466
- function AskRenderer({ item }) {
4467
- const args = parseToolArgs(item.arguments);
4468
- const preview = askToolPreview(args);
4469
- const icon = /* @__PURE__ */ jsx9(MessageCircleQuestionIcon2, { className: ICON_SIZE });
4470
- const title = "Ask";
4471
- if (item.status === "running") {
4472
- return /* @__PURE__ */ jsx9(
4473
- ActivityDisclosure,
4474
- {
4475
- icon,
4476
- iconTone: "running",
4477
- title,
4478
- running: true,
4479
- preview: preview ? /* @__PURE__ */ jsx9(RunningPreview, { children: preview }) : /* @__PURE__ */ jsx9(RunningPreview, { children: "Waiting\u2026" }),
4480
- children: /* @__PURE__ */ jsx9(PayloadBlock, { label: "Arguments", value: args })
4481
- }
4482
- );
4483
- }
4484
- const { text: outText, isError } = unwrapMcpOutput(item.output);
4485
- if ((isError || item.status === "failed") && item.status !== "cancelled") {
4486
- return /* @__PURE__ */ jsxs6(
4487
- ActivityDisclosure,
4488
- {
4489
- icon,
4490
- iconTone: "failed",
4491
- title,
4492
- chip: { tone: "bad", text: "error" },
4493
- preview: truncatePreview(outText, 80) || preview || "Error",
4494
- children: [
4495
- /* @__PURE__ */ jsx9(PayloadBlock, { label: "Arguments", value: args }),
4496
- /* @__PURE__ */ jsx9(PayloadBlock, { label: "Error", value: outText, failed: true })
4497
- ]
4498
- }
4499
- );
4500
- }
4501
- return /* @__PURE__ */ jsxs6(
4502
- ActivityDisclosure,
4503
- {
4504
- icon,
4505
- iconTone: "muted",
4506
- title,
4507
- cancelled: item.status === "cancelled",
4508
- preview: item.status === "cancelled" ? void 0 : preview ?? void 0,
4509
- children: [
4510
- /* @__PURE__ */ jsx9(PayloadBlock, { label: "Arguments", value: args }),
4511
- outText ? /* @__PURE__ */ jsx9(PayloadBlock, { label: "Result", value: outText }) : null
4512
- ]
4513
- }
4514
- );
4515
- }
4516
- function runOnTargetName(output) {
4517
- const { text } = unwrapMcpOutput(output);
4518
- const parsed = tryParseJson(text);
4519
- if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
4520
- const name = parsed.targetName;
4521
- if (typeof name === "string" && name.trim()) {
4522
- return name.trim();
4523
- }
4524
- }
4525
- return null;
4526
- }
4527
- function runOnOpPreview(args) {
4528
- const op = args.op;
4529
- if (!op || typeof op !== "object" || Array.isArray(op)) {
4530
- return null;
4531
- }
4532
- const record = op;
4533
- if (record.kind === "exec" && typeof record.cmd === "string" && record.cmd.trim()) {
4534
- return `$ ${record.cmd.trim()}`;
4535
- }
4536
- if ((record.kind === "read" || record.kind === "write") && typeof record.path === "string" && record.path.trim()) {
4537
- return truncatePreview(record.path.trim(), 72);
4538
- }
4539
- return null;
4540
- }
4541
- function RunOnRenderer({ item }) {
4542
- const parsedArgs = parseToolArgs(item.arguments);
4543
- const args = parsedArgs;
4544
- const targetName = runOnTargetName(item.output);
4545
- const title = targetName ? `Run on ${targetName}` : "Run on";
4546
- const opPreview = runOnOpPreview(parsedArgs);
4547
- const icon = /* @__PURE__ */ jsx9(ServerIcon, { className: ICON_SIZE });
4548
- if (item.status === "running") {
4549
- return /* @__PURE__ */ jsx9(
4550
- ActivityDisclosure,
4551
- {
4552
- icon,
4553
- iconTone: "running",
4554
- title,
4555
- running: true,
4556
- preview: opPreview ? /* @__PURE__ */ jsx9(RunningPreview, { children: opPreview }) : /* @__PURE__ */ jsx9(RunningPreview, { children: "Running\u2026" }),
4557
- children: /* @__PURE__ */ jsx9(PayloadBlock, { label: "Arguments", value: args })
4558
- }
4559
- );
4560
- }
4561
- const { text: outText, isError } = unwrapMcpOutput(item.output);
4562
- if ((isError || item.status === "failed") && item.status !== "cancelled") {
4563
- return /* @__PURE__ */ jsxs6(
4564
- ActivityDisclosure,
4565
- {
4566
- icon,
4567
- iconTone: "failed",
4568
- title,
4569
- chip: { tone: "bad", text: "error" },
4570
- preview: truncatePreview(outText, 80) || opPreview || "Error",
4571
- children: [
4572
- /* @__PURE__ */ jsx9(PayloadBlock, { label: "Arguments", value: args }),
4573
- /* @__PURE__ */ jsx9(PayloadBlock, { label: "Error", value: outText, failed: true })
4574
- ]
4575
- }
4576
- );
4577
- }
4578
- return /* @__PURE__ */ jsxs6(
4579
- ActivityDisclosure,
4580
- {
4581
- icon,
4582
- iconTone: "muted",
4583
- title,
4584
- cancelled: item.status === "cancelled",
4585
- preview: item.status === "cancelled" ? void 0 : opPreview ?? void 0,
4586
- children: [
4587
- /* @__PURE__ */ jsx9(PayloadBlock, { label: "Arguments", value: args }),
4588
- outText ? /* @__PURE__ */ jsx9(PayloadBlock, { label: "Result", value: outText }) : null
4589
- ]
4590
- }
4591
- );
4592
- }
4593
- function GenericRenderer({ item }) {
4594
- const reviewed = useHasToolReview(item.callId);
4595
- if (reviewed && item.callId) return /* @__PURE__ */ jsx9(ReviewedGenericRenderer, { item });
4596
- return /* @__PURE__ */ jsx9(UnreviewedGenericRenderer, { item });
4597
- }
4598
- var REVIEW_CHIP = {
4599
- rejected: { tone: "interrupted", text: "declined" },
4600
- cancelled: { tone: "interrupted", text: "not run" },
4601
- expired: { tone: "interrupted", text: "expired" },
4602
- stale: { tone: "interrupted", text: "not run" },
4603
- revoked: { tone: "interrupted", text: "not run" },
4604
- blocked: { tone: "interrupted", text: "blocked" },
4605
- unknown: { tone: "bad", text: "outcome unknown" },
4606
- partial: { tone: "bad", text: "partly done" },
4607
- failed: { tone: "bad", text: "failed" }
4608
- };
4609
- function ReviewedGenericRenderer({ item }) {
4610
- const { review, onViewDetails } = useRecordedToolReview(item.callId);
4611
- if (!review) return /* @__PURE__ */ jsx9(UnreviewedGenericRenderer, { item });
4612
- const icon = /* @__PURE__ */ jsx9(GenericToolIcon, { name: item.name });
4613
- const waiting = review.status === "pending";
4614
- const running = !waiting && (review.status === "executing" || review.status === "approved") && item.status === "running";
4615
- const { text: outText, isError } = unwrapMcpOutput(item.output);
4616
- const chip = REVIEW_CHIP[review.status] ?? (isError && !running && !waiting ? { tone: "bad", text: "error" } : void 0);
4617
- return /* @__PURE__ */ jsxs6(
4618
- ActivityDisclosure,
4619
- {
4620
- icon,
4621
- iconTone: chip?.tone === "bad" ? "failed" : waiting ? "accent" : "muted",
4622
- title: review.title,
4623
- running,
4624
- chip,
4625
- preview: waiting ? "Waiting for your approval" : running ? /* @__PURE__ */ jsx9(RunningPreview, { children: "Running\u2026" }) : review.accountLabel ?? void 0,
4626
- children: [
4627
- /* @__PURE__ */ jsx9("div", { className: "py-1", "data-approval-id": item.callId, "data-review-origin": "history", children: /* @__PURE__ */ jsx9(
4628
- ToolActionReviewCard,
4629
- {
4630
- bare: true,
4631
- review: { ...review, availableActions: [] },
4632
- onViewDetails
4633
- }
4634
- ) }),
4635
- outText ? /* @__PURE__ */ jsx9(PayloadBlock, { label: "Result", value: outText, failed: isError }) : null
4636
- ]
4637
- }
4638
- );
4639
- }
4640
- var BLOCKED_OUTPUT = /Connector action was not executed: blocked\b/;
4641
- var UNCERTAIN_OUTPUT = /Connector action outcome is uncertain\b/;
4642
- function UnreviewedGenericRenderer({ item }) {
4643
- const running = item.status === "running";
4644
- const args = parseToolArgs(item.arguments);
4645
- const display = toolDisplayName(item.name, item.display);
4646
- const icon = /* @__PURE__ */ jsx9(GenericToolIcon, { name: item.name });
4647
- const goalPreview = goalToolPreview(item.name, args);
4648
- if (running) {
4649
- return /* @__PURE__ */ jsx9(
4650
- ActivityDisclosure,
4651
- {
4652
- icon,
4653
- iconTone: "running",
4654
- title: display,
4655
- running: true,
4656
- preview: goalPreview ?? /* @__PURE__ */ jsx9(RunningPreview, { children: "Running\u2026" }),
4657
- children: /* @__PURE__ */ jsx9(PayloadBlock, { label: "Arguments", value: args })
4658
- }
4659
- );
4660
- }
4661
- const { text: outText, isError } = unwrapMcpOutput(item.output);
4662
- if (isError && BLOCKED_OUTPUT.test(outText)) {
4663
- return /* @__PURE__ */ jsxs6(
4664
- ActivityDisclosure,
4665
- {
4666
- icon,
4667
- iconTone: "muted",
4668
- title: display,
4669
- chip: { tone: "interrupted", text: "blocked" },
4670
- preview: "Blocked by your permission settings",
4671
- children: [
4672
- /* @__PURE__ */ jsx9("p", { className: "m-0 py-1 text-og-sm text-og-fg-muted", children: "Your permission settings block this action, so it did not run. You can change this in the integration's tool permissions." }),
4673
- /* @__PURE__ */ jsx9(PayloadBlock, { label: "Arguments", value: args })
4674
- ]
4675
- }
4676
- );
4677
- }
4678
- if (isError && UNCERTAIN_OUTPUT.test(outText)) {
4679
- return /* @__PURE__ */ jsxs6(
4680
- ActivityDisclosure,
4681
- {
4682
- icon,
4683
- iconTone: "failed",
4684
- title: display,
4685
- chip: { tone: "bad", text: "outcome unknown" },
4686
- preview: "It may have run",
4687
- children: [
4688
- /* @__PURE__ */ jsx9("p", { className: "m-0 py-1 text-og-sm text-og-fg-muted", children: "This action may have run. Check the result in the connected app before trying again." }),
4689
- /* @__PURE__ */ jsx9(PayloadBlock, { label: "Arguments", value: args })
4690
- ]
3555
+ preview: /* @__PURE__ */ jsx9(RunningPreview, { children: "Proposing\u2026" }),
3556
+ children: /* @__PURE__ */ jsx9(PayloadBlock, { label: "Arguments", value: args })
4691
3557
  }
4692
3558
  );
4693
3559
  }
3560
+ const { text: outText, isError } = unwrapMcpOutput(item.output);
4694
3561
  if ((isError || item.status === "failed") && item.status !== "cancelled") {
4695
3562
  return /* @__PURE__ */ jsxs6(
4696
3563
  ActivityDisclosure,
4697
3564
  {
4698
- icon,
3565
+ icon: /* @__PURE__ */ jsx9(BrainCircuitIcon2, { className: ICON_SIZE }),
4699
3566
  iconTone: "failed",
4700
- title: display,
4701
- chip: { tone: "bad", text: "error" },
4702
- preview: truncatePreview(outText, 80) || "Error",
3567
+ title,
3568
+ failed: true,
3569
+ preview: truncatePreview(outText, 80) || "Propose failed",
4703
3570
  children: [
4704
- /* @__PURE__ */ jsx9(PayloadBlock, { label: "Arguments", value: args }),
3571
+ text ? /* @__PURE__ */ jsx9(BodyNote, { children: text }) : null,
4705
3572
  /* @__PURE__ */ jsx9(PayloadBlock, { label: "Error", value: outText, failed: true })
4706
3573
  ]
4707
3574
  }
@@ -4710,41 +3577,65 @@ function UnreviewedGenericRenderer({ item }) {
4710
3577
  return /* @__PURE__ */ jsxs6(
4711
3578
  ActivityDisclosure,
4712
3579
  {
4713
- icon,
3580
+ icon: /* @__PURE__ */ jsx9(BrainCircuitIcon2, { className: ICON_SIZE }),
4714
3581
  iconTone: "muted",
4715
- title: display,
3582
+ title,
4716
3583
  cancelled: item.status === "cancelled",
4717
- preview: item.status === "cancelled" ? void 0 : goalPreview ?? "Done",
3584
+ preview: text ? truncatePreview(text, 90) : "Done",
4718
3585
  children: [
4719
- /* @__PURE__ */ jsx9(PayloadBlock, { label: "Arguments", value: args }),
3586
+ text ? /* @__PURE__ */ jsx9(BodyNote, { children: text }) : null,
4720
3587
  /* @__PURE__ */ jsx9(PayloadBlock, { label: "Result", value: outText })
4721
3588
  ]
4722
3589
  }
4723
3590
  );
4724
3591
  }
4725
- function goalToolPreview(name, args) {
4726
- const leaf = mcpToolLeaf(name);
4727
- if (leaf !== "goal_set" && leaf !== "goal_update" && leaf !== "goal_complete" && leaf !== "goal_pause" && leaf !== "wait_for_input") {
4728
- return null;
4729
- }
4730
- const record = args && typeof args === "object" ? args : null;
4731
- if (!record) {
4732
- return null;
4733
- }
4734
- const text = typeof record.text === "string" ? record.text : typeof record.evidence === "string" ? record.evidence : typeof record.rationale === "string" ? record.rationale : typeof record.reason === "string" ? record.reason : typeof record.progressNote === "string" ? record.progressNote : null;
4735
- return text ? truncatePreview(text, 90) : null;
4736
- }
4737
- function truncatePreview(text, max) {
4738
- const cleaned = text.replace(/\s+/g, " ").trim();
4739
- if (!cleaned) {
4740
- return "";
4741
- }
4742
- return cleaned.length > max ? `${cleaned.slice(0, max - 1)}\u2026` : cleaned;
3592
+ function GenericRenderer({ item }) {
3593
+ const reviewed = useHasToolReview(item.callId);
3594
+ if (reviewed && item.callId) return /* @__PURE__ */ jsx9(ReviewedGenericRenderer, { item });
3595
+ return /* @__PURE__ */ jsx9(UnreviewedGenericRenderer, { item });
4743
3596
  }
4744
- function GenericToolIcon({ name }) {
4745
- const leaf = mcpToolLeaf(name);
4746
- const Icon = leaf === "request_human_input" ? MessageCircleQuestionIcon2 : leaf.startsWith("goal_") ? TargetIcon : leaf.startsWith("memory_") || leaf === "preference_registry_summary" || leaf === "preference_registry_get" ? BrainCircuitIcon2 : leaf.startsWith("session_") || leaf === "sessions_list" || leaf === "set_session_title" || leaf === "set_other_session_title" ? MessagesSquareIcon : leaf.startsWith("sandbox") || leaf === "sandboxes_list" || leaf === "run_on" ? ServerIcon : leaf.startsWith("rig_") ? ServerCogIcon : leaf.startsWith("scheduled_") ? CalendarClockIcon : leaf.startsWith("artifacts_") ? PanelsTopLeftIcon : leaf.startsWith("social_") ? Share2Icon : leaf.startsWith("slack_") ? MessageSquareIcon : leaf.startsWith("github_") ? FolderGitIcon : leaf.startsWith("variable_") ? BoxIcon : leaf.startsWith("environment_") ? KeyRoundIcon : leaf.includes("document") || leaf.includes("knowledge") || leaf === "list_document_bases" ? FileSearchIcon : leaf === "tool_search" ? PackageSearchIcon : leaf.startsWith("skill_") ? PlugIcon : WrenchIcon;
4747
- return /* @__PURE__ */ jsx9(Icon, { className: ICON_SIZE });
3597
+ var REVIEW_CHIP = {
3598
+ rejected: { tone: "interrupted", text: "declined" },
3599
+ cancelled: { tone: "interrupted", text: "not run" },
3600
+ expired: { tone: "interrupted", text: "expired" },
3601
+ stale: { tone: "interrupted", text: "not run" },
3602
+ revoked: { tone: "interrupted", text: "not run" },
3603
+ blocked: { tone: "interrupted", text: "blocked" },
3604
+ unknown: { tone: "bad", text: "outcome unknown" },
3605
+ partial: { tone: "bad", text: "partly done" },
3606
+ failed: { tone: "bad", text: "failed" }
3607
+ };
3608
+ function ReviewedGenericRenderer({ item }) {
3609
+ const { review, onViewDetails } = useRecordedToolReview(item.callId);
3610
+ if (!review) return /* @__PURE__ */ jsx9(UnreviewedGenericRenderer, { item });
3611
+ const ReviewIcon = TOOL_ICONS[genericToolIconKind(item.name)];
3612
+ const icon = /* @__PURE__ */ jsx9(ReviewIcon, { className: ICON_SIZE });
3613
+ const waiting = review.status === "pending";
3614
+ const running = !waiting && (review.status === "executing" || review.status === "approved") && item.status === "running";
3615
+ const { text: outText, isError } = unwrapMcpOutput(item.output);
3616
+ const chip = REVIEW_CHIP[review.status] ?? (isError && !running && !waiting ? { tone: "bad", text: "error" } : void 0);
3617
+ return /* @__PURE__ */ jsxs6(
3618
+ ActivityDisclosure,
3619
+ {
3620
+ icon,
3621
+ iconTone: chip?.tone === "bad" ? "failed" : waiting ? "accent" : "muted",
3622
+ title: review.title,
3623
+ running,
3624
+ chip,
3625
+ preview: waiting ? "Waiting for your approval" : running ? /* @__PURE__ */ jsx9(RunningPreview, { children: "Running\u2026" }) : review.accountLabel ?? void 0,
3626
+ children: [
3627
+ /* @__PURE__ */ jsx9("div", { className: "py-1", "data-approval-id": item.callId, "data-review-origin": "history", children: /* @__PURE__ */ jsx9(
3628
+ ToolActionReviewCard,
3629
+ {
3630
+ bare: true,
3631
+ review: { ...review, availableActions: [] },
3632
+ onViewDetails
3633
+ }
3634
+ ) }),
3635
+ outText ? /* @__PURE__ */ jsx9(PayloadBlock, { label: "Result", value: outText, failed: isError }) : null
3636
+ ]
3637
+ }
3638
+ );
4748
3639
  }
4749
3640
  function KnowledgeSaveRenderer({ item }) {
4750
3641
  const output = unwrapMcpOutput(item.output);
@@ -4887,24 +3778,12 @@ import { ThinkingOrb } from "thinking-orbs";
4887
3778
  import { createContext as createContext4, useContext as useContext5, useEffect as useEffect7, useState as useState9 } from "react";
4888
3779
  import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
4889
3780
  var GenieLoadingOptionsContext = createContext4(void 0);
4890
- var PHRASES = [
4891
- "Polishing the lamp\u2026",
4892
- "Consulting the carpet\u2026",
4893
- "Untangling wishes\u2026",
4894
- "Summoning a little cleverness\u2026",
4895
- "Checking the fine print on infinity\u2026",
4896
- "Warming up the abracadabra\u2026",
4897
- "Rearranging the stars\u2026",
4898
- "Negotiating with the lamp\u2026",
4899
- "Dusting off a thousand years\u2026",
4900
- "Wishful thinking\u2026",
4901
- "Decanting a little magic\u2026",
4902
- "Finding the good stardust\u2026",
4903
- "Fluffing the magic carpet\u2026",
4904
- "Putting a wish into motion\u2026",
4905
- "A little hocus. A little pocus\u2026"
4906
- ];
4907
- var WAITING_PHRASES = ["Waiting for a response\u2026"];
3781
+ var PHRASES = GENIE_PREPARING_PHRASES;
3782
+ var WAITING_PHRASES = GENIE_WAITING_PHRASES;
3783
+ var EMBEDDED_GENIE_LOADING = {
3784
+ phrases: ["Thinking\u2026"],
3785
+ messages: { showDetails: "Show details" }
3786
+ };
4908
3787
  function GenieLoading({
4909
3788
  startedAt,
4910
3789
  phase = "preparing",
@@ -5044,9 +3923,9 @@ function useSeenActivityIds() {
5044
3923
  }
5045
3924
 
5046
3925
  // src/timeline/activity-rail.tsx
5047
- import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
3926
+ import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
5048
3927
  var LazyFleetDecisionRow = lazy2(() => import("./fleet-decision-row-SI63O5V4.js"));
5049
- var LazyPlatformActivityRow = lazy2(() => import("./platform-activity-row-PJJVATTZ.js"));
3928
+ var LazyPlatformActivityRow = lazy2(() => import("./platform-activity-row-NJ47YBXW.js"));
5050
3929
  function familyOf(item) {
5051
3930
  if (item.kind === "tool-call") {
5052
3931
  return item.name === "exec_command" || item.name === "write_stdin" ? "terminal" : item.name;
@@ -5204,7 +4083,7 @@ function ActivityNoteRow({ item }) {
5204
4083
  className: "min-w-0 flex-1 text-og-sm text-og-fg-muted",
5205
4084
  "data-og-search-item": item.id,
5206
4085
  "data-og-annotation-source-key": item.annotationSource?.eventId,
5207
- children: renderText ? renderText(item.text, item) : /* @__PURE__ */ jsx13(Markdown, { streaming: item.streaming, children: item.text })
4086
+ children: renderText ? renderText(item.text, item) : /* @__PURE__ */ jsx13(Markdown, { softLineBreaks: true, streaming: item.streaming, children: item.text })
5208
4087
  }
5209
4088
  )
5210
4089
  ] });
@@ -5310,7 +4189,7 @@ function MemoryRow({
5310
4189
  ) : corrected && item.action === "updated" ? (
5311
4190
  // Edited in place, no replacement record: the memory is still live, so
5312
4191
  // show its current text — NOT the archived treatment.
5313
- /* @__PURE__ */ jsxs9(Fragment3, { children: [
4192
+ /* @__PURE__ */ jsxs9(Fragment4, { children: [
5314
4193
  /* @__PURE__ */ jsx13("p", { className: "whitespace-pre-wrap text-og-base leading-6 text-og-fg-muted", children: item.preview }),
5315
4194
  /* @__PURE__ */ jsx13(BodyNote, { tone: "muted", children: "Updated in place." })
5316
4195
  ] })
@@ -5346,7 +4225,7 @@ function WorkerRow({
5346
4225
  const running = item.status === "running";
5347
4226
  const failed = item.status === "failed";
5348
4227
  const cancelled = item.status === "cancelled";
5349
- const title = item.action === "spawn" ? running ? "Spawning worker" : failed ? "Worker spawn failed" : cancelled ? "Worker interrupted" : "Worker spawned" : running ? "Messaging worker" : failed ? "Worker message failed" : cancelled ? "Worker interrupted" : "Worker messaged";
4228
+ const title = workerRowTitle(item);
5350
4229
  if (compact) {
5351
4230
  return /* @__PURE__ */ jsx13(
5352
4231
  ActivityDisclosure,
@@ -5360,7 +4239,7 @@ function WorkerRow({
5360
4239
  }
5361
4240
  const sessionId = item.workerSessionId;
5362
4241
  const deepLink = Boolean(sessionId) && Boolean(onOpenSession) && !failed && !cancelled;
5363
- const inner = /* @__PURE__ */ jsxs9(Fragment3, { children: [
4242
+ const inner = /* @__PURE__ */ jsxs9(Fragment4, { children: [
5364
4243
  /* @__PURE__ */ jsx13("span", { className: "size-3.5 shrink-0", "aria-hidden": true }),
5365
4244
  /* @__PURE__ */ jsx13("span", { className: cn("mt-px shrink-0", failed ? "text-og-status-failed" : "text-og-accent"), children: /* @__PURE__ */ jsx13(BotIcon, { className: "size-3.5" }) }),
5366
4245
  /* @__PURE__ */ jsxs9("div", { className: "min-w-0 flex-1", children: [
@@ -5441,20 +4320,11 @@ function inheritFoldRestingState(memory, targetKey, sourceKeys) {
5441
4320
  }
5442
4321
 
5443
4322
  // src/timeline/turn-summary.tsx
5444
- import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
4323
+ import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
5445
4324
  var TurnSettleChromeContext = createContext9(false);
5446
4325
  function useTurnSettleOpen() {
5447
4326
  return useContext10(TurnSettleChromeContext);
5448
4327
  }
5449
- var BUILT_IN_TURN_SUMMARY_FACET_IDS = [
5450
- "steps",
5451
- "files",
5452
- "commands",
5453
- "screenshots",
5454
- "memories",
5455
- "compacted",
5456
- "duration"
5457
- ];
5458
4328
  var SETTLE_FOLD_BEAT_MS = 1100 * MOTION_INSPECT_SCALE;
5459
4329
  var SETTLE_COLLAPSE_MS = 820 * MOTION_INSPECT_SCALE;
5460
4330
  var DISCLOSE_MS = 120 * MOTION_INSPECT_SCALE;
@@ -5622,19 +4492,7 @@ function TurnSummary({
5622
4492
  );
5623
4493
  const statusKind = status?.kind;
5624
4494
  const facets = useMemo4(
5625
- () => facetDefinitions.flatMap((facet) => {
5626
- if (statusKind && (facet.id === "duration" || facet === BUILT_IN_TURN_SUMMARY_FACETS[0] && context.items.every(
5627
- (item) => item.kind === "startup-phase" || item.kind === "agent-message"
5628
- ) || statusKind !== "worked" && facet.id !== "steps" && BUILT_IN_TURN_SUMMARY_FACET_IDS.includes(facet.id))) {
5629
- return [];
5630
- }
5631
- try {
5632
- const result = facet.summarize(context);
5633
- return result && hasFacetContent(result.content) ? [{ facet, result }] : [];
5634
- } catch {
5635
- return [];
5636
- }
5637
- }),
4495
+ () => selectTurnSummaryFacets(facetDefinitions, context, statusKind),
5638
4496
  [context, facetDefinitions, statusKind]
5639
4497
  );
5640
4498
  const liveShell = outcome === void 0 && open && !settlePhase && !bare;
@@ -5712,7 +4570,7 @@ function TurnSummary({
5712
4570
  ),
5713
4571
  children: [
5714
4572
  statusLine,
5715
- liveHeader && !open && !status ? liveHeader : facets.map(({ facet, result }, index) => /* @__PURE__ */ jsx14(FacetRenderBoundary, { children: /* @__PURE__ */ jsxs10(Fragment4, { children: [
4573
+ liveHeader && !open && !status ? liveHeader : facets.map(({ facet, result }, index) => /* @__PURE__ */ jsx14(FacetRenderBoundary, { children: /* @__PURE__ */ jsxs10(Fragment5, { children: [
5716
4574
  index > 0 || statusLine ? " \xB7 " : null,
5717
4575
  /* @__PURE__ */ jsxs10("span", { "aria-label": result.ariaLabel, title: result.title, children: [
5718
4576
  result.icon ? /* @__PURE__ */ jsx14("span", { "aria-hidden": true, className: "mr-1 inline-flex align-[-0.125em]", children: result.icon }) : null,
@@ -5795,146 +4653,6 @@ function LiveElapsed({ since }) {
5795
4653
  if (!Number.isFinite(startedAt)) return null;
5796
4654
  return /* @__PURE__ */ jsx14("span", { className: "tabular-nums", children: ` \xB7 ${formatElapsed(Math.max(0, now - startedAt))}` });
5797
4655
  }
5798
- function formatElapsed(durationMs) {
5799
- const totalSeconds = Math.max(0, Math.floor(durationMs / 1e3));
5800
- if (totalSeconds < 60) {
5801
- return `${totalSeconds}s`;
5802
- }
5803
- const totalMinutes = Math.floor(totalSeconds / 60);
5804
- if (totalMinutes < 60) {
5805
- const seconds = totalSeconds % 60;
5806
- return seconds ? `${totalMinutes}m ${seconds}s` : `${totalMinutes}m`;
5807
- }
5808
- const hours = Math.floor(totalMinutes / 60);
5809
- return `${hours}h ${String(totalMinutes % 60).padStart(2, "0")}m`;
5810
- }
5811
- function createTurnSummaryContext(items, outcome, failureText, durationMs, contextCompactionCount) {
5812
- const itemSnapshot = Object.freeze([...items]);
5813
- const toolCalls = Object.freeze(
5814
- itemSnapshot.filter((item) => item.kind === "tool-call")
5815
- );
5816
- const settled = itemSnapshot.every((item) => {
5817
- if (item.kind === "reasoning" || item.kind === "agent-message") {
5818
- return !item.streaming;
5819
- }
5820
- if (item.kind === "tool-call" || item.kind === "worker" || item.kind === "sandbox" || item.kind === "startup-phase") {
5821
- return item.status !== "running";
5822
- }
5823
- return true;
5824
- });
5825
- return Object.freeze({
5826
- items: itemSnapshot,
5827
- toolCalls,
5828
- outcome,
5829
- failureText,
5830
- durationMs,
5831
- settled,
5832
- contextCompactionCount: Math.max(0, Math.floor(contextCompactionCount))
5833
- });
5834
- }
5835
- var BUILT_IN_TURN_SUMMARY_FACETS = Object.freeze([
5836
- {
5837
- id: "steps",
5838
- summarize: ({ items }) => {
5839
- const count = items.filter(
5840
- (item) => item.kind !== "startup-phase" && item.kind !== "agent-message"
5841
- ).length;
5842
- return count ? { content: `${count} ${count === 1 ? "step" : "steps"}` } : items.some((item) => item.kind === "startup-phase") ? { content: "Preparation" } : null;
5843
- }
5844
- },
5845
- {
5846
- id: "files",
5847
- summarize: ({ toolCalls }) => {
5848
- let files = 0;
5849
- for (const item of toolCalls) {
5850
- if (isApplyPatch(item)) {
5851
- files += applyPatchOpsFromToolItem(item).length;
5852
- }
5853
- }
5854
- return files ? { content: `${files} ${files === 1 ? "file" : "files"} edited` } : null;
5855
- }
5856
- },
5857
- {
5858
- id: "commands",
5859
- summarize: ({ toolCalls }) => {
5860
- const commands = toolCalls.filter((item) => item.name === "exec_command").length;
5861
- return commands ? { content: `${commands} ${commands === 1 ? "command" : "commands"}` } : null;
5862
- }
5863
- },
5864
- {
5865
- id: "screenshots",
5866
- summarize: ({ toolCalls }) => {
5867
- let screenshots = 0;
5868
- for (const item of toolCalls) {
5869
- const leaf = mcpToolLeaf(item.name);
5870
- if ((rawTypeOf(item) === "computer_call" || item.name === "computer_call" || item.name === "computer_screenshot" || leaf === "browser_screenshot" || leaf === "browser_observe" || leaf === "browser_act") && (retainedScreenshotMetadata(item.output) !== null || screenshotDataUrl(item.output) !== null || mediaPreviewFact(item.output) !== null)) {
5871
- screenshots += 1;
5872
- }
5873
- }
5874
- return screenshots ? {
5875
- content: `${screenshots} ${screenshots === 1 ? "screenshot" : "screenshots"}`
5876
- } : null;
5877
- }
5878
- },
5879
- {
5880
- id: "memories",
5881
- summarize: ({ items }) => {
5882
- let saved = 0;
5883
- let updated = 0;
5884
- for (const item of items) {
5885
- if (item.kind !== "memory") {
5886
- continue;
5887
- }
5888
- if (item.variant === "corrected") {
5889
- updated += 1;
5890
- } else {
5891
- saved += 1;
5892
- }
5893
- }
5894
- const parts = [];
5895
- if (saved) {
5896
- parts.push(`${saved} ${saved === 1 ? "memory" : "memories"} saved`);
5897
- }
5898
- if (updated) {
5899
- parts.push(`${updated} ${updated === 1 ? "memory" : "memories"} updated`);
5900
- }
5901
- return parts.length > 0 ? { content: parts.join(" \xB7 ") } : null;
5902
- }
5903
- },
5904
- {
5905
- id: "compacted",
5906
- summarize: ({ contextCompactionCount }) => contextCompactionCount > 0 ? {
5907
- content: contextCompactionCount === 1 ? "compacted" : `${contextCompactionCount} compacts`,
5908
- ariaLabel: contextCompactionCount === 1 ? "Conversation history compacted" : `${contextCompactionCount} conversation history compactions`
5909
- } : null
5910
- },
5911
- {
5912
- id: "duration",
5913
- summarize: ({ durationMs }) => {
5914
- const duration = formatDurationFacet(durationMs);
5915
- return duration ? { content: duration } : null;
5916
- }
5917
- }
5918
- ]);
5919
- function resolveTurnSummaryFacets(configuration) {
5920
- const requested = configuration?.replace ?? [
5921
- ...BUILT_IN_TURN_SUMMARY_FACETS.filter(
5922
- (facet) => !configuration?.remove?.includes(facet.id)
5923
- ),
5924
- ...configuration?.add ?? []
5925
- ];
5926
- const seen = /* @__PURE__ */ new Set();
5927
- return requested.filter((facet) => {
5928
- if (!facet.id || seen.has(facet.id)) {
5929
- return false;
5930
- }
5931
- seen.add(facet.id);
5932
- return true;
5933
- });
5934
- }
5935
- function hasFacetContent(content) {
5936
- return content !== null && content !== void 0 && content !== false && content !== "";
5937
- }
5938
4656
  var FacetRenderBoundary = class extends Component {
5939
4657
  state = { failed: false };
5940
4658
  static getDerivedStateFromError() {
@@ -5944,22 +4662,6 @@ var FacetRenderBoundary = class extends Component {
5944
4662
  return this.state.failed ? null : this.props.children;
5945
4663
  }
5946
4664
  };
5947
- function formatDurationFacet(durationMs) {
5948
- if (durationMs === void 0 || !Number.isFinite(durationMs) || durationMs < 1e3) {
5949
- return null;
5950
- }
5951
- const totalSeconds = Math.floor(durationMs / 1e3);
5952
- if (totalSeconds < 60) {
5953
- return `${totalSeconds}s`;
5954
- }
5955
- const totalMinutes = Math.floor(totalSeconds / 60);
5956
- if (totalMinutes < 60) {
5957
- return `${totalMinutes}m`;
5958
- }
5959
- const hours = Math.floor(totalMinutes / 60);
5960
- const minutes = totalMinutes % 60;
5961
- return `${hours}h ${String(minutes).padStart(2, "0")}m`;
5962
- }
5963
4665
 
5964
4666
  // src/components/user-message-body.tsx
5965
4667
  import {
@@ -6344,15 +5046,15 @@ function UserMessageBody({
6344
5046
 
6345
5047
  // src/timeline/retained-loaders.ts
6346
5048
  function createWorkspaceRetainedArtifactLoader(client, workspaceId) {
6347
- return async (artifact, signal) => {
6348
- if (artifact.kind === "file") {
5049
+ return async (artifact, signal, options) => {
5050
+ if (artifact.kind === "file" && options?.prefer !== "url") {
6349
5051
  const download2 = await client.downloadRetainedArtifact(workspaceId, artifact, { signal });
6350
5052
  return download2.bytes;
6351
5053
  }
6352
5054
  const download = await client.createRetainedArtifactDownloadUrl(workspaceId, artifact, {
6353
5055
  signal
6354
5056
  });
6355
- return { url: download.url };
5057
+ return { url: download.url, expiresAt: download.expiresAt };
6356
5058
  };
6357
5059
  }
6358
5060
  function createSessionRetainedScreenshotLoader(client, workspaceId, sessionId) {
@@ -6453,52 +5155,52 @@ function GeneratedVideoPlayer({
6453
5155
  import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
6454
5156
  var SESSION_STATUS_META = {
6455
5157
  queued: {
6456
- label: "Queued",
5158
+ label: SESSION_STATUS_PRESENTATION.queued.label,
6457
5159
  dotClassName: "bg-og-status-queued",
6458
5160
  badgeClassName: "text-og-fg-muted border-og-border bg-og-status-queued/10",
6459
- pulse: false
5161
+ pulse: SESSION_STATUS_PRESENTATION.queued.pulse
6460
5162
  },
6461
5163
  running: {
6462
- label: "Running",
5164
+ label: SESSION_STATUS_PRESENTATION.running.label,
6463
5165
  dotClassName: "bg-og-status-running",
6464
5166
  badgeClassName: "text-og-status-running border-og-status-running/30 bg-og-status-running/10",
6465
- pulse: true
5167
+ pulse: SESSION_STATUS_PRESENTATION.running.pulse
6466
5168
  },
6467
5169
  recovering: {
6468
- label: "Recovering",
5170
+ label: SESSION_STATUS_PRESENTATION.recovering.label,
6469
5171
  dotClassName: "bg-og-status-running",
6470
5172
  badgeClassName: "text-og-status-running border-og-status-running/30 bg-og-status-running/10",
6471
- pulse: true
5173
+ pulse: SESSION_STATUS_PRESENTATION.recovering.pulse
6472
5174
  },
6473
5175
  waiting_capacity: {
6474
- label: "Waiting for capacity",
5176
+ label: SESSION_STATUS_PRESENTATION.waiting_capacity.label,
6475
5177
  dotClassName: "bg-og-status-waiting",
6476
5178
  badgeClassName: "text-og-status-waiting border-og-status-waiting/35 bg-og-status-waiting/10",
6477
- pulse: true
5179
+ pulse: SESSION_STATUS_PRESENTATION.waiting_capacity.pulse
6478
5180
  },
6479
5181
  idle: {
6480
- label: "Idle",
5182
+ label: SESSION_STATUS_PRESENTATION.idle.label,
6481
5183
  dotClassName: "bg-og-status-idle",
6482
5184
  badgeClassName: "text-og-status-idle border-og-status-idle/30 bg-og-status-idle/10",
6483
- pulse: false
5185
+ pulse: SESSION_STATUS_PRESENTATION.idle.pulse
6484
5186
  },
6485
5187
  requires_action: {
6486
- label: "Waiting on you",
5188
+ label: SESSION_STATUS_PRESENTATION.requires_action.label,
6487
5189
  dotClassName: "bg-og-status-waiting",
6488
5190
  badgeClassName: "text-og-status-waiting border-og-status-waiting/35 bg-og-status-waiting/10",
6489
- pulse: true
5191
+ pulse: SESSION_STATUS_PRESENTATION.requires_action.pulse
6490
5192
  },
6491
5193
  failed: {
6492
- label: "Failed",
5194
+ label: SESSION_STATUS_PRESENTATION.failed.label,
6493
5195
  dotClassName: "bg-og-status-failed",
6494
5196
  badgeClassName: "text-og-status-failed border-og-status-failed/35 bg-og-status-failed/10",
6495
- pulse: false
5197
+ pulse: SESSION_STATUS_PRESENTATION.failed.pulse
6496
5198
  },
6497
5199
  cancelled: {
6498
- label: "Cancelled",
5200
+ label: SESSION_STATUS_PRESENTATION.cancelled.label,
6499
5201
  dotClassName: "bg-og-status-cancelled",
6500
5202
  badgeClassName: "text-og-fg-subtle border-og-border bg-og-status-cancelled/10",
6501
- pulse: false
5203
+ pulse: SESSION_STATUS_PRESENTATION.cancelled.pulse
6502
5204
  }
6503
5205
  };
6504
5206
  function SessionStatus({ status, label, size = "md", className }) {
@@ -6549,51 +5251,35 @@ function RollingActivity({
6549
5251
  const reduced = useReducedMotion2();
6550
5252
  const [mounted, setMounted] = useState15(false);
6551
5253
  useEffect11(() => setMounted(true), []);
6552
- const work = items.filter(
6553
- (item2) => item2.kind !== "startup-phase" && item2.kind !== "agent-message"
6554
- );
6555
- const active = work.filter(
6556
- (item2) => item2.kind === "reasoning" ? item2.streaming : "status" in item2 && item2.status === "running"
6557
- );
6558
- const item = !mounted && previousItem && previousItem.kind !== "agent-message" ? previousItem : work.at(-1);
6559
- if (!item) return null;
6560
- const earlierCount = Math.max(
6561
- 0,
6562
- work.findIndex((entry) => entry.id === item.id)
6563
- );
5254
+ const selected = rollingActivityItem(items, previousItem, mounted);
5255
+ if (!selected) return null;
5256
+ const { item, earlierCount } = selected;
6564
5257
  const fallback2 = /* @__PURE__ */ jsxs13("span", { className: "og-rolling-label", children: [
6565
5258
  /* @__PURE__ */ jsx18(WrenchIcon2, { className: "size-3.5" }),
6566
5259
  /* @__PURE__ */ jsx18("span", { children: item.kind === "tool-call" ? toolDisplayName(item.name, item.display) : "Working" })
6567
5260
  ] });
6568
- return /* @__PURE__ */ jsxs13(
6569
- "span",
6570
- {
6571
- className: "og-rolling-status",
6572
- "data-running": active.some((entry) => entry.id === item.id) ? "true" : void 0,
6573
- children: [
6574
- /* @__PURE__ */ jsx18("span", { className: "sr-only", children: item.kind === "tool-call" ? toolDisplayName(item.name, item.display) : item.kind === "reasoning" ? "Thinking" : "Working" }),
6575
- /* @__PURE__ */ jsx18("span", { className: "og-rolling-window", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(AnimatePresence2, { initial: false, mode: "sync", children: /* @__PURE__ */ jsx18(
6576
- motion2.span,
6577
- {
6578
- className: "og-rolling-face",
6579
- initial: {
6580
- opacity: 0,
6581
- y: reduced ? 0 : 24
6582
- },
6583
- animate: { opacity: 1, y: 0 },
6584
- exit: {
6585
- opacity: 0,
6586
- y: reduced ? 0 : -24
6587
- },
6588
- transition: { duration: reduced ? 0 : 0.4, ease: [0.22, 1, 0.36, 1] },
6589
- children: /* @__PURE__ */ jsx18(CompactActivityContext.Provider, { value: true, children: /* @__PURE__ */ jsx18(Suspense3, { fallback: fallback2, children: renderActivity(item, toolRegistry, void 0, void 0, void 0, void 0) }) })
6590
- },
6591
- item.id
6592
- ) }) }),
6593
- showCount && earlierCount > 0 ? /* @__PURE__ */ jsx18("span", { className: "og-rolling-count", children: `+${earlierCount} earlier` }) : null
6594
- ]
6595
- }
6596
- );
5261
+ return /* @__PURE__ */ jsxs13("span", { className: "og-rolling-status", "data-running": selected.running ? "true" : void 0, children: [
5262
+ /* @__PURE__ */ jsx18("span", { className: "sr-only", children: item.kind === "tool-call" ? toolDisplayName(item.name, item.display) : item.kind === "reasoning" ? "Thinking" : "Working" }),
5263
+ /* @__PURE__ */ jsx18("span", { className: "og-rolling-window", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(AnimatePresence2, { initial: false, mode: "sync", children: /* @__PURE__ */ jsx18(
5264
+ motion2.span,
5265
+ {
5266
+ className: "og-rolling-face",
5267
+ initial: {
5268
+ opacity: 0,
5269
+ y: reduced ? 0 : 24
5270
+ },
5271
+ animate: { opacity: 1, y: 0 },
5272
+ exit: {
5273
+ opacity: 0,
5274
+ y: reduced ? 0 : -24
5275
+ },
5276
+ transition: { duration: reduced ? 0 : 0.4, ease: [0.22, 1, 0.36, 1] },
5277
+ children: /* @__PURE__ */ jsx18(CompactActivityContext.Provider, { value: true, children: /* @__PURE__ */ jsx18(Suspense3, { fallback: fallback2, children: renderActivity(item, toolRegistry, void 0, void 0, void 0, void 0) }) })
5278
+ },
5279
+ item.id
5280
+ ) }) }),
5281
+ showCount && earlierCount > 0 ? /* @__PURE__ */ jsx18("span", { className: "og-rolling-count", children: `+${earlierCount} earlier` }) : null
5282
+ ] });
6597
5283
  }
6598
5284
 
6599
5285
  // src/components/child-session-link.tsx
@@ -7238,7 +5924,7 @@ function machineInputSummaryIsUseful(kind, cleanedSummary) {
7238
5924
  // src/timeline/allowance-exhausted-row.tsx
7239
5925
  import { GaugeIcon } from "lucide-react";
7240
5926
  import { createContext as createContext11, useContext as useContext12, useMemo as useMemo6 } from "react";
7241
- import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
5927
+ import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
7242
5928
  var AllowancePresentationContext = createContext11({
7243
5929
  render: void 0,
7244
5930
  labels: allowanceLabels()
@@ -7284,16 +5970,15 @@ function AllowanceExhaustedRow({ refusal }) {
7284
5970
  ]
7285
5971
  }
7286
5972
  );
7287
- return /* @__PURE__ */ jsx20(Fragment5, { children: render?.(refusal, { labels, defaultRow }) ?? defaultRow });
5973
+ return /* @__PURE__ */ jsx20(Fragment6, { children: render?.(refusal, { labels, defaultRow }) ?? defaultRow });
7288
5974
  }
7289
5975
 
7290
5976
  // src/components/message-timeline.tsx
7291
- import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
5977
+ import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
7292
5978
  var TimelineAnnotationSelection = lazy3(() => import("./timeline-annotation-selection-BI7QTPTZ.js"));
7293
5979
  var TimelineAnnotationMarkers = lazy3(() => import("./timeline-annotation-markers-U3G66KUD.js"));
7294
5980
  var PIN_THRESHOLD_PX = 48;
7295
5981
  var JUMP_TO_LATEST_CATCHUP_DEBT_PX = 240;
7296
- var QUESTION_NAV_MARGIN_PX = 12;
7297
5982
  var NAV_BUTTON_CLASS = "pointer-events-auto relative inline-flex size-8 items-center justify-center rounded-full border border-og-border bg-og-surface-3/90 text-og-fg-muted shadow-og-md backdrop-blur hover:border-og-border-strong hover:text-og-fg focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-og-accent pointer-coarse:before:absolute pointer-coarse:before:-inset-1.5 pointer-coarse:before:content-['']";
7298
5983
  var NAV_FADE = {
7299
5984
  initial: { opacity: 0 },
@@ -7377,19 +6062,16 @@ function contentTopOf(node, groupKey) {
7377
6062
  }
7378
6063
  return element.getBoundingClientRect().top - node.getBoundingClientRect().top + node.scrollTop;
7379
6064
  }
7380
- var QUESTION_NAV_HIDDEN_PX = 24;
7381
6065
  function readQuestionNav(node) {
7382
6066
  const view = node.getBoundingClientRect();
7383
- const prompts = [...node.querySelectorAll("[data-og-prompt]")];
7384
- const middle = view.top + view.height / 2;
7385
- const prompt = prompts.reverse().find((candidate) => candidate.getBoundingClientRect().top <= middle);
7386
- const key = prompt?.dataset.ogGroupKey;
7387
- if (!prompt || !key) return null;
7388
- const bounds = prompt.getBoundingClientRect();
7389
- if (bounds.top >= view.top - QUESTION_NAV_HIDDEN_PX || bounds.bottom > view.top) {
7390
- return null;
7391
- }
7392
- return { key, belowHeader: workHeaderPinned(node, view) };
6067
+ const prompts = [...node.querySelectorAll("[data-og-prompt]")].flatMap((prompt) => {
6068
+ const key2 = prompt.dataset.ogGroupKey;
6069
+ if (!key2) return [];
6070
+ const bounds = prompt.getBoundingClientRect();
6071
+ return [{ key: key2, top: bounds.top, bottom: bounds.bottom }];
6072
+ });
6073
+ const key = questionNavTarget(prompts, { top: view.top, height: view.height });
6074
+ return key ? { key, belowHeader: workHeaderPinned(node, view) } : null;
7393
6075
  }
7394
6076
  function workHeaderPinned(node, view) {
7395
6077
  for (const header of node.querySelectorAll(
@@ -7479,6 +6161,7 @@ function MessageTimeline({
7479
6161
  Markdown,
7480
6162
  {
7481
6163
  searchTarget: searchItem?.id === item.id ? searchTarget : null,
6164
+ softLineBreaks: true,
7482
6165
  streaming: item.kind === "agent-message" && item.streaming,
7483
6166
  renderInteractiveBlock: item.kind === "agent-message" ? renderInteractiveBlock : void 0,
7484
6167
  children: text
@@ -9332,10 +8015,7 @@ var TimelineGroupView = memo(function TimelineGroupView2({
9332
8015
  switch (group.kind) {
9333
8016
  case "activity":
9334
8017
  if (group.work) {
9335
- const phases = group.items.filter((item) => item.kind === "startup-phase");
9336
- const preparing = !startupDetails && !startupDismissed && !group.work.endedAt && !group.work.waiting && phases.length > 0 && group.items.every(
9337
- (item) => item.kind === "startup-phase" || item.kind === "reasoning" && !item.text.trim()
9338
- ) && !phases.some((item) => item.status === "failed" || item.status === "cancelled");
8018
+ const preparing = isPreparingWork(group, { startupDetails, startupDismissed });
9339
8019
  if (preparing) {
9340
8020
  return /* @__PURE__ */ jsx21(
9341
8021
  ActivityRail,
@@ -9351,19 +8031,18 @@ var TimelineGroupView = memo(function TimelineGroupView2({
9351
8031
  }
9352
8032
  );
9353
8033
  }
9354
- const end = group.work.endedAt;
9355
- const status = end ? { kind: "worked", durationMs: durationBetween(group.work.startedAt, end) } : group.work.waiting ? { kind: "waiting", ...group.work.waiting } : {
9356
- kind: "working",
9357
- since: group.work.startedAt,
9358
- preview: containsPresentedImage ? void 0 : /* @__PURE__ */ jsx21(
8034
+ const workStatus = readableWorkStatus({ ...group, work: group.work });
8035
+ const status = workStatus.kind === "working" ? {
8036
+ ...workStatus,
8037
+ preview: readableWorkShowsPreview(group) ? /* @__PURE__ */ jsx21(
9359
8038
  RollingActivity,
9360
8039
  {
9361
8040
  items: group.items,
9362
8041
  toolRegistry,
9363
8042
  showCount: false
9364
8043
  }
9365
- )
9366
- };
8044
+ ) : void 0
8045
+ } : workStatus;
9367
8046
  return (
9368
8047
  // Marks this work row for the live-note fold (list keys can be carried
9369
8048
  // over from an earlier row, so they are not the work id).
@@ -9375,7 +8054,7 @@ var TimelineGroupView = memo(function TimelineGroupView2({
9375
8054
  outcome: group.outcome,
9376
8055
  failureText: group.failureText,
9377
8056
  foldKey: group.id,
9378
- defaultOpen: containsPresentedImage || group.outcome === "failed" || phases.some((item) => item.status === "failed" || item.status === "cancelled") ? true : void 0,
8057
+ defaultOpen: readableWorkDefaultOpen(group),
9379
8058
  facets: turnSummary?.facets,
9380
8059
  contextCompactionCount: compactedLandmarkCount(group.work.details),
9381
8060
  onOpenStateChange: group.work.liveNoteIds?.length && reportLiveFold ? (open) => reportLiveFold(group.id, open) : void 0,
@@ -9607,13 +8286,8 @@ function renderFoldedGroups(groups, behavior, readableWork = false) {
9607
8286
  timelineGroupKey(child)
9608
8287
  ));
9609
8288
  }
9610
- function compactedLandmarkCount(groups) {
9611
- return groups.filter(
9612
- (group) => group.kind === "item" && group.item.kind === "context-compaction" && group.item.phase === "compacted"
9613
- ).length;
9614
- }
9615
8289
  function FoldBody({ children }) {
9616
- return /* @__PURE__ */ jsx21(Fragment6, { children });
8290
+ return /* @__PURE__ */ jsx21(Fragment7, { children });
9617
8291
  }
9618
8292
  function TurnRailFrame({ children, compact = false }) {
9619
8293
  return /* @__PURE__ */ jsx21(
@@ -9677,17 +8351,6 @@ function isAgentProgress(next) {
9677
8351
  }
9678
8352
  return next.kind === "activity" || next.kind === "turn" || next.kind === "item" && next.item.kind === "agent-message" && next.item.text.trim().length > 0;
9679
8353
  }
9680
- function clusterIsSettled(group) {
9681
- return group.items.every((item) => {
9682
- if (item.kind === "reasoning" || item.kind === "agent-message") {
9683
- return !item.streaming;
9684
- }
9685
- if (item.kind === "memory" || item.kind === "fleet-decision") {
9686
- return true;
9687
- }
9688
- return item.status !== "running";
9689
- });
9690
- }
9691
8354
  function foldableActivityClusterCount(groups) {
9692
8355
  let count = 0;
9693
8356
  for (const child of groups) {
@@ -9697,17 +8360,6 @@ function foldableActivityClusterCount(groups) {
9697
8360
  }
9698
8361
  return count;
9699
8362
  }
9700
- function flattenActivityItems(groups) {
9701
- const items = [];
9702
- for (const group of groups) {
9703
- if (group.kind === "activity") {
9704
- items.push(...flattenActivityItems(group.work?.details ?? []), ...group.items);
9705
- } else if (group.kind === "turn") {
9706
- items.push(...flattenActivityItems(group.groups));
9707
- }
9708
- }
9709
- return items;
9710
- }
9711
8363
  function collectAgentMessageText(groups) {
9712
8364
  const parts = [];
9713
8365
  for (const group of groups) {
@@ -9787,14 +8439,6 @@ function collectTurnCopyText(groups, trailingAgentText) {
9787
8439
  }
9788
8440
  return parts.join("\n\n");
9789
8441
  }
9790
- function durationBetween(startedAt, endedAt) {
9791
- const started = Date.parse(startedAt);
9792
- const ended = Date.parse(endedAt);
9793
- if (!Number.isFinite(started) || !Number.isFinite(ended) || ended < started) {
9794
- return void 0;
9795
- }
9796
- return ended - started;
9797
- }
9798
8442
  function TimelineRow({
9799
8443
  item,
9800
8444
  renderMessageActions,
@@ -9922,7 +8566,7 @@ function UserMessageRow({
9922
8566
  ${annotation.note}`).join("\n\n"),
9923
8567
  label: "Copy message",
9924
8568
  className: "w-fit max-w-full min-w-0",
9925
- trailing: /* @__PURE__ */ jsxs15(Fragment6, { children: [
8569
+ trailing: /* @__PURE__ */ jsxs15(Fragment7, { children: [
9926
8570
  renderMessageActions?.(item),
9927
8571
  /* @__PURE__ */ jsx21(MessageFooterTime, { occurredAt: item.occurredAt })
9928
8572
  ] }),
@@ -9932,7 +8576,7 @@ ${annotation.note}`).join("\n\n"),
9932
8576
  {
9933
8577
  "data-og-search-item": item.id,
9934
8578
  "data-og-annotation-source-key": item.annotationSource?.eventId,
9935
- children: renderMessageText ? renderMessageText(item.text, item) : /* @__PURE__ */ jsx21(UserMessageBody, { messageId: item.id, text: item.text, children: /* @__PURE__ */ jsx21(Markdown, { children: item.text }) })
8579
+ children: renderMessageText ? renderMessageText(item.text, item) : /* @__PURE__ */ jsx21(UserMessageBody, { messageId: item.id, text: item.text, children: /* @__PURE__ */ jsx21(Markdown, { softLineBreaks: true, children: item.text }) })
9936
8580
  }
9937
8581
  ) : null,
9938
8582
  (item.annotations?.length ?? 0) > 0 ? /* @__PURE__ */ jsx21(
@@ -10083,7 +8727,7 @@ function AgentMessageRow({
10083
8727
  renderMessageText
10084
8728
  }) {
10085
8729
  const enter = useEntranceAnimation();
10086
- const body = renderMessageText ? renderMessageText(item.text, item) : /* @__PURE__ */ jsx21(Markdown, { streaming: item.streaming, children: item.text });
8730
+ const body = renderMessageText ? renderMessageText(item.text, item) : /* @__PURE__ */ jsx21(Markdown, { softLineBreaks: true, streaming: item.streaming, children: item.text });
10087
8731
  return /* @__PURE__ */ jsx21(
10088
8732
  CopyHoverFrame,
10089
8733
  {
@@ -10091,7 +8735,7 @@ function AgentMessageRow({
10091
8735
  label: "Copy message",
10092
8736
  align: "start",
10093
8737
  className: cn(enter && "animate-og-enter", "min-w-0 text-og-md leading-7 text-og-fg"),
10094
- trailing: item.streaming ? null : /* @__PURE__ */ jsxs15(Fragment6, { children: [
8738
+ trailing: item.streaming ? null : /* @__PURE__ */ jsxs15(Fragment7, { children: [
10095
8739
  renderMessageActions?.(item),
10096
8740
  /* @__PURE__ */ jsx21(MessageFooterTime, { occurredAt: item.occurredAt })
10097
8741
  ] }),
@@ -10484,8 +9128,9 @@ function NoticeRow({ item }) {
10484
9128
  }
10485
9129
  );
10486
9130
  }
10487
- const resolvedApproval = Boolean(item.resolvedAt && item.text.startsWith("Approval needed"));
10488
- const tone = item.tone === "failed" ? "border-og-status-failed/35 bg-og-status-failed/10 text-og-status-failed" : item.tone === "waiting" && !item.resolvedAt ? WAITING_PILL_CLASS : NEUTRAL_PILL;
9131
+ const presentedTone = noticeTone(item);
9132
+ const resolvedApproval = noticeIsResolvedApproval(item);
9133
+ const tone = presentedTone === "failed" ? "border-og-status-failed/35 bg-og-status-failed/10 text-og-status-failed" : presentedTone === "waiting" ? WAITING_PILL_CLASS : NEUTRAL_PILL;
10489
9134
  return /* @__PURE__ */ jsxs15(
10490
9135
  "div",
10491
9136
  {
@@ -10503,7 +9148,7 @@ function NoticeRow({ item }) {
10503
9148
  }
10504
9149
  ),
10505
9150
  /* @__PURE__ */ jsxs15("div", { className: "min-w-0 flex-1", children: [
10506
- /* @__PURE__ */ jsx21("span", { className: "whitespace-pre-wrap break-words", children: resolvedApproval ? "You responded to this approval." : item.text }),
9151
+ /* @__PURE__ */ jsx21("span", { className: "whitespace-pre-wrap break-words", children: noticeDisplayText(item) }),
10507
9152
  item.details ? /* @__PURE__ */ jsxs15("details", { className: "mt-2 text-og-control", children: [
10508
9153
  /* @__PURE__ */ jsx21("summary", { className: "cursor-pointer font-medium", children: item.details.label }),
10509
9154
  /* @__PURE__ */ jsx21("pre", { className: "mt-2 max-h-64 overflow-auto whitespace-pre-wrap break-all rounded-og-sm bg-og-fg/5 p-2 font-mono", children: JSON.stringify(item.details.value, null, 2) })
@@ -10528,7 +9173,7 @@ function recordedWaitSummary(item) {
10528
9173
  const target = agents > 0 ? ` for ${agents} ${agents === 1 ? "agent" : "agents"}` : "";
10529
9174
  const waitedMs = item.waitEndedAt ? durationBetween(item.occurredAt, item.waitEndedAt) : void 0;
10530
9175
  if (waitedMs !== void 0) {
10531
- return /* @__PURE__ */ jsxs15(Fragment6, { children: [
9176
+ return /* @__PURE__ */ jsxs15(Fragment7, { children: [
10532
9177
  "Waited",
10533
9178
  target,
10534
9179
  " \xB7",
@@ -10538,7 +9183,7 @@ function recordedWaitSummary(item) {
10538
9183
  }
10539
9184
  const started = new Date(item.occurredAt);
10540
9185
  const sameDay = started.toDateString() === (/* @__PURE__ */ new Date()).toDateString();
10541
- return /* @__PURE__ */ jsxs15(Fragment6, { children: [
9186
+ return /* @__PURE__ */ jsxs15(Fragment7, { children: [
10542
9187
  item.waitEndedAt ? "Waited" : "Waiting",
10543
9188
  target,
10544
9189
  " \xB7 since",
@@ -10721,7 +9366,7 @@ function authReasonLine(reason) {
10721
9366
  import { Loader2Icon } from "lucide-react";
10722
9367
  import { lazy as lazy4, Suspense as Suspense5 } from "react";
10723
9368
  import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
10724
- var loadQueueSurface = () => import("./queue-surface-implementation-67FS7FUI.js");
9369
+ var loadQueueSurface = () => import("./queue-surface-implementation-YPJFQ3O6.js");
10725
9370
  var QueueSurface = createQueueSurface(loadQueueSurface);
10726
9371
  function createQueueSurface(loadImplementation) {
10727
9372
  const LazyQueueSurface = lazy4(async () => ({
@@ -10816,7 +9461,7 @@ import { LayoutGroup, motion as motion4 } from "motion/react";
10816
9461
  import {
10817
9462
  useImperativeHandle
10818
9463
  } from "react";
10819
- import { Fragment as Fragment7, jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
9464
+ import { Fragment as Fragment8, jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
10820
9465
  function ChatComposer({
10821
9466
  composer,
10822
9467
  responsiveBasis,
@@ -10878,7 +9523,7 @@ function ChatComposer({
10878
9523
  useImperativeHandle(focusRef, () => ({ focusInput: controller.focusInput }), [
10879
9524
  controller.focusInput
10880
9525
  ]);
10881
- return /* @__PURE__ */ jsx23(Fragment7, { children: /* @__PURE__ */ jsxs17(Root, { controller, responsiveBasis, className, children: [
9526
+ return /* @__PURE__ */ jsx23(Fragment8, { children: /* @__PURE__ */ jsxs17(Root, { controller, responsiveBasis, className, children: [
10882
9527
  /* @__PURE__ */ jsxs17(Frame, { children: [
10883
9528
  /* @__PURE__ */ jsx23(CommandPalette, {}),
10884
9529
  /* @__PURE__ */ jsxs17(Surface, { className: surfaceClassName, children: [
@@ -10993,7 +9638,7 @@ import {
10993
9638
  } from "lucide-react";
10994
9639
  import { AnimatePresence as AnimatePresence4, motion as motion5, useReducedMotion as useReducedMotion4 } from "motion/react";
10995
9640
  import { useEffect as useEffect13, useId as useId4, useMemo as useMemo8, useRef as useRef11, useState as useState18 } from "react";
10996
- import { Fragment as Fragment8, jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
9641
+ import { Fragment as Fragment9, jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
10997
9642
  var GOAL_LABEL = {
10998
9643
  pursuing: "Pursuing",
10999
9644
  waiting: "Waiting",
@@ -11061,26 +9706,6 @@ function sessionChromeGoalPillExplanation(state, record) {
11061
9706
  }
11062
9707
  return null;
11063
9708
  }
11064
- function queuedTurnPresentation(turn) {
11065
- const realtimeDelegation = objectValue(turn.metadata.realtimeDelegation);
11066
- const inputTranscript = realtimeDelegation?.inputTranscript;
11067
- if (typeof inputTranscript === "string" && inputTranscript.trim()) {
11068
- return { kind: "realtime_voice", text: inputTranscript.trim() };
11069
- }
11070
- if (objectValue(turn.metadata.realtimeTailFlush)) {
11071
- return { kind: "realtime_voice_handoff", text: "Remaining voice context" };
11072
- }
11073
- return { kind: "prompt", text: turn.prompt };
11074
- }
11075
- function isSteeringTurn(turn) {
11076
- return turn.metadata.delivery === "steer";
11077
- }
11078
- function isAuthoritativeQueuedTurn(turn, mutationFor) {
11079
- return !isSteeringTurn(turn) && mutationFor(turn.id) !== "steer";
11080
- }
11081
- function countAuthoritativeQueuedTurns(turns, mutationFor) {
11082
- return turns.filter((turn) => isAuthoritativeQueuedTurn(turn, mutationFor)).length;
11083
- }
11084
9709
  function isOptimisticQueuedMessage(message, queuedTurnIds, snapshot2) {
11085
9710
  return message.delivery === "send" && message.destination === "queue" && (!message.turnId || !queuedTurnIds.has(message.turnId)) && !(message.turnId && message.appliedQueueVersion !== null && message.appliedQueueVersion !== void 0 && snapshot2 && snapshot2.version >= message.appliedQueueVersion);
11086
9711
  }
@@ -11096,9 +9721,6 @@ function sessionChromeInitialActive(input) {
11096
9721
  function sessionChromeShouldOfferQueue(input) {
11097
9722
  return !input.controlled && input.active === null && !input.activityOpen && input.authoritativeQueuedCount >= 1 && !input.suppressed;
11098
9723
  }
11099
- function objectValue(value) {
11100
- return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
11101
- }
11102
9724
  function sessionChromeGoalPillState(goalStatus, continuation, sessionStatus) {
11103
9725
  if (goalStatus === "completed") return "completed";
11104
9726
  if (goalStatus === "paused") return "paused";
@@ -11466,6 +10088,12 @@ function SessionChrome({
11466
10088
  };
11467
10089
  }, [active, signals]);
11468
10090
  const open = active !== null;
10091
+ const latestOptimisticQueued = optimisticQueued[optimisticQueued.length - 1];
10092
+ const latestQueuedTurn = queuedTurns[queuedTurns.length - 1];
10093
+ const queuePeek = queue.error || queue.mutationError ? null : latestOptimisticQueued ? { text: latestOptimisticQueued.text.trim() || null, turnId: null } : latestQueuedTurn ? {
10094
+ text: queuedTurnPresentation(latestQueuedTurn).text.trim() || null,
10095
+ turnId: latestQueuedTurn.id
10096
+ } : null;
11469
10097
  if (signals.length === 0 && !stopping) return null;
11470
10098
  const shellDuration = reduceMotion ? 0 : 0.22;
11471
10099
  const crossfadeDuration = reduceMotion ? 0 : 0.18;
@@ -11654,10 +10282,32 @@ function SessionChrome({
11654
10282
  queueArrivalNonce
11655
10283
  ) : null,
11656
10284
  /* @__PURE__ */ jsx24("span", { className: cn("shrink-0", toneClass(signal.tone, selected)), children: signal.icon }),
11657
- /* @__PURE__ */ jsxs18("span", { className: cn("font-medium text-og-fg", "min-w-0 truncate"), children: [
11658
- signal.id === "goal" ? "Goal \xB7 " : null,
11659
- signal.id === "goal" ? goalState === "pursuing" ? "Running" : signal.label : signal.id === "queue" ? queue.error || queue.mutationError ? signal.label : `${queuedTurns.length + optimisticQueued.length} queued` : signal.label
11660
- ] })
10285
+ /* @__PURE__ */ jsxs18(
10286
+ "span",
10287
+ {
10288
+ className: cn(
10289
+ "font-medium text-og-fg",
10290
+ signal.id === "queue" && queuePeek?.text && !selected ? "shrink-0" : "min-w-0 truncate"
10291
+ ),
10292
+ children: [
10293
+ signal.id === "goal" ? "Goal \xB7 " : null,
10294
+ signal.id === "goal" ? goalState === "pursuing" ? "Running" : signal.label : signal.id === "queue" ? queue.error || queue.mutationError ? signal.label : `${queuedTurns.length + optimisticQueued.length} queued` : signal.label
10295
+ ]
10296
+ }
10297
+ ),
10298
+ signal.id === "queue" && queuePeek?.text && !selected ? /* @__PURE__ */ jsx24(AnimatePresence4, { initial: false, mode: "popLayout", children: /* @__PURE__ */ jsx24(
10299
+ motion5.span,
10300
+ {
10301
+ "data-testid": "session-chrome-queue-peek",
10302
+ className: "min-w-0 max-w-[min(24rem,60vw)] truncate text-og-fg-muted",
10303
+ initial: reduceMotion ? false : { opacity: 0, y: 3 },
10304
+ animate: { opacity: 1, y: 0 },
10305
+ exit: { opacity: 0, transition: { duration: crossfadeDuration } },
10306
+ transition: { duration: crossfadeDuration, ease },
10307
+ children: queuePeek.text
10308
+ },
10309
+ queuePeek.text
10310
+ ) }) : null
11661
10311
  ]
11662
10312
  }
11663
10313
  ),
@@ -11683,16 +10333,18 @@ function SessionChrome({
11683
10333
  children: /* @__PURE__ */ jsx24(Trash2Icon2, { className: "size-3" })
11684
10334
  }
11685
10335
  )
11686
- ] }) : signal.id === "queue" && canMutateQueue && queuedTurns[0] ? /* @__PURE__ */ jsx24("div", { className: "flex shrink-0 items-center pr-1 pl-0.5", children: /* @__PURE__ */ jsx24(
10336
+ ] }) : signal.id === "queue" && canMutateQueue && queuePeek && !selected ? /* @__PURE__ */ jsx24("div", { className: "flex shrink-0 items-center pr-1 pl-0.5", children: /* @__PURE__ */ jsx24(
11687
10337
  IconAction,
11688
10338
  {
11689
- label: "Steer first queued message",
10339
+ label: "Steer latest queued message",
11690
10340
  analyticsAction: "steer",
11691
10341
  text: "Steer",
11692
10342
  tip: QUEUE_STEER_TIP,
11693
- disabled: queue.mutating || Boolean(queue.mutationFor(queuedTurns[0].id)),
11694
- onClick: () => void queue.steerTurn(queuedTurns[0].id),
11695
- children: /* @__PURE__ */ jsx24(CornerDownRightIcon, { className: "size-3" })
10343
+ disabled: !queuePeek.turnId || queue.mutating || Boolean(queue.mutationFor(queuePeek.turnId)),
10344
+ onClick: () => {
10345
+ if (queuePeek.turnId) void queue.steerTurn(queuePeek.turnId);
10346
+ },
10347
+ children: queuePeek.turnId && queue.mutationFor(queuePeek.turnId) === "steer" ? /* @__PURE__ */ jsx24(Loader2Icon2, { className: "size-3 animate-og-spin" }) : /* @__PURE__ */ jsx24(CornerDownRightIcon, { className: "size-3" })
11696
10348
  }
11697
10349
  ) }) : null
11698
10350
  ]
@@ -11724,7 +10376,7 @@ function SessionChrome({
11724
10376
  children: [
11725
10377
  /* @__PURE__ */ jsx24(ActivityIcon, { className: "size-3.5" }),
11726
10378
  /* @__PURE__ */ jsx24("span", { className: "sr-only", children: "Activity" }),
11727
- commandsCount > 0 ? /* @__PURE__ */ jsxs18(Fragment8, { children: [
10379
+ commandsCount > 0 ? /* @__PURE__ */ jsxs18(Fragment9, { children: [
11728
10380
  /* @__PURE__ */ jsx24(
11729
10381
  "span",
11730
10382
  {
@@ -11975,8 +10627,7 @@ function QueuePanel({
11975
10627
  const voice = presentation.kind !== "prompt";
11976
10628
  const pending = mutationFor(turn.id);
11977
10629
  const settling = !interactiveTurnIds.has(turn.id);
11978
- const beforeUp = index > 0 ? turns[index - 1]?.id ?? null : null;
11979
- const beforeDown = index < turns.length - 1 ? turns[index + 2]?.id ?? null : null;
10630
+ const { beforeUp, beforeDown } = queueNeighborAnchors(turns, index);
11980
10631
  const showActions = !readOnly && (onEdit || onSteer || onRemove || onMove);
11981
10632
  const confirmingReplace = replaceDraftFor === turn.id;
11982
10633
  return /* @__PURE__ */ jsxs18(
@@ -12001,29 +10652,52 @@ function QueuePanel({
12001
10652
  annotations: turn.annotations ?? []
12002
10653
  }
12003
10654
  ),
12004
- showActions ? /* @__PURE__ */ jsxs18("div", { className: "flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100 max-sm:opacity-100", children: [
12005
- onMove && turns.length > 1 ? /* @__PURE__ */ jsxs18(Fragment8, { children: [
12006
- /* @__PURE__ */ jsx24(
10655
+ showActions ? /* @__PURE__ */ jsxs18("div", { className: "flex shrink-0 items-center gap-0.5", children: [
10656
+ /* @__PURE__ */ jsxs18("div", { className: "flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100 max-sm:opacity-100", children: [
10657
+ onMove && turns.length > 1 ? /* @__PURE__ */ jsxs18(Fragment9, { children: [
10658
+ /* @__PURE__ */ jsx24(
10659
+ IconAction,
10660
+ {
10661
+ label: `Move queued prompt ${index + 1} up`,
10662
+ tip: "Move up",
10663
+ disabled: settling || pending !== null || index === 0,
10664
+ onClick: () => onMove(turn.id, beforeUp),
10665
+ children: /* @__PURE__ */ jsx24(ArrowUpIcon2, { className: "size-3" })
10666
+ }
10667
+ ),
10668
+ /* @__PURE__ */ jsx24(
10669
+ IconAction,
10670
+ {
10671
+ label: `Move queued prompt ${index + 1} down`,
10672
+ tip: "Move down",
10673
+ disabled: settling || pending !== null || index >= turns.length - 1,
10674
+ onClick: () => onMove(turn.id, beforeDown),
10675
+ children: /* @__PURE__ */ jsx24(ArrowDownIcon2, { className: "size-3" })
10676
+ }
10677
+ )
10678
+ ] }) : null,
10679
+ onEdit ? /* @__PURE__ */ jsx24(
12007
10680
  IconAction,
12008
10681
  {
12009
- label: `Move queued prompt ${index + 1} up`,
12010
- tip: "Move up",
12011
- disabled: settling || pending !== null || index === 0,
12012
- onClick: () => onMove(turn.id, beforeUp),
12013
- children: /* @__PURE__ */ jsx24(ArrowUpIcon2, { className: "size-3" })
10682
+ label: `Edit queued prompt ${index + 1}`,
10683
+ tip: QUEUE_EDIT_TIP,
10684
+ disabled: settling || pending !== null,
10685
+ onClick: () => onEdit(turn),
10686
+ children: pending === "edit" ? /* @__PURE__ */ jsx24(Loader2Icon2, { className: "size-3 animate-og-spin" }) : /* @__PURE__ */ jsx24(PencilIcon, { className: "size-3" })
12014
10687
  }
12015
- ),
12016
- /* @__PURE__ */ jsx24(
10688
+ ) : null,
10689
+ onRemove ? /* @__PURE__ */ jsx24(
12017
10690
  IconAction,
12018
10691
  {
12019
- label: `Move queued prompt ${index + 1} down`,
12020
- tip: "Move down",
12021
- disabled: settling || pending !== null || index >= turns.length - 1,
12022
- onClick: () => onMove(turn.id, beforeDown),
12023
- children: /* @__PURE__ */ jsx24(ArrowDownIcon2, { className: "size-3" })
10692
+ label: `Remove queued prompt ${index + 1}`,
10693
+ tip: QUEUE_DELETE_TIP,
10694
+ disabled: settling || pending !== null,
10695
+ onClick: () => onRemove(turn.id),
10696
+ danger: true,
10697
+ children: pending === "delete" ? /* @__PURE__ */ jsx24(Loader2Icon2, { className: "size-3 animate-og-spin" }) : /* @__PURE__ */ jsx24(Trash2Icon2, { className: "size-3" })
12024
10698
  }
12025
- )
12026
- ] }) : null,
10699
+ ) : null
10700
+ ] }),
12027
10701
  onSteer ? /* @__PURE__ */ jsx24(
12028
10702
  IconAction,
12029
10703
  {
@@ -12035,33 +10709,12 @@ function QueuePanel({
12035
10709
  onClick: () => onSteer(turn.id),
12036
10710
  children: pending === "steer" ? /* @__PURE__ */ jsx24(Loader2Icon2, { className: "size-3 animate-og-spin" }) : /* @__PURE__ */ jsx24(CornerDownRightIcon, { className: "size-3" })
12037
10711
  }
12038
- ) : null,
12039
- onEdit ? /* @__PURE__ */ jsx24(
12040
- IconAction,
12041
- {
12042
- label: `Edit queued prompt ${index + 1}`,
12043
- tip: QUEUE_EDIT_TIP,
12044
- disabled: settling || pending !== null,
12045
- onClick: () => onEdit(turn),
12046
- children: pending === "edit" ? /* @__PURE__ */ jsx24(Loader2Icon2, { className: "size-3 animate-og-spin" }) : /* @__PURE__ */ jsx24(PencilIcon, { className: "size-3" })
12047
- }
12048
- ) : null,
12049
- onRemove ? /* @__PURE__ */ jsx24(
12050
- IconAction,
12051
- {
12052
- label: `Remove queued prompt ${index + 1}`,
12053
- tip: QUEUE_DELETE_TIP,
12054
- disabled: settling || pending !== null,
12055
- onClick: () => onRemove(turn.id),
12056
- danger: true,
12057
- children: pending === "delete" ? /* @__PURE__ */ jsx24(Loader2Icon2, { className: "size-3 animate-og-spin" }) : /* @__PURE__ */ jsx24(Trash2Icon2, { className: "size-3" })
12058
- }
12059
10712
  ) : null
12060
10713
  ] }) : null
12061
10714
  ] }),
12062
10715
  confirmingReplace ? /* @__PURE__ */ jsxs18("div", { className: "rounded-og-sm border border-og-status-waiting/30 bg-og-status-waiting/10 p-2 text-og-xs text-og-fg", children: [
12063
- /* @__PURE__ */ jsx24("p", { children: "Your composer already has a draft. Replace it with this queued prompt?" }),
12064
- /* @__PURE__ */ jsx24("p", { className: "mt-0.5 text-og-fg-muted", children: "The current draft will be permanently discarded; this queued prompt is preserved until you confirm." }),
10716
+ /* @__PURE__ */ jsx24("p", { children: QUEUE_REPLACE_DRAFT_COPY.title }),
10717
+ /* @__PURE__ */ jsx24("p", { className: "mt-0.5 text-og-fg-muted", children: QUEUE_REPLACE_DRAFT_COPY.detail }),
12065
10718
  /* @__PURE__ */ jsxs18("div", { className: "mt-2 flex justify-end gap-1.5", children: [
12066
10719
  /* @__PURE__ */ jsx24(
12067
10720
  "button",
@@ -12069,7 +10722,7 @@ function QueuePanel({
12069
10722
  type: "button",
12070
10723
  className: "rounded-og-sm px-2 py-1 font-medium hover:bg-og-surface-3/70 focus-visible:ring-2 focus-visible:ring-og-accent/40",
12071
10724
  onClick: onCancelReplace,
12072
- children: "Keep current draft"
10725
+ children: QUEUE_REPLACE_DRAFT_COPY.keep
12073
10726
  }
12074
10727
  ),
12075
10728
  /* @__PURE__ */ jsx24(
@@ -12078,7 +10731,7 @@ function QueuePanel({
12078
10731
  type: "button",
12079
10732
  className: "rounded-og-sm border border-og-primary-border bg-og-primary text-og-primary-fg px-2 py-1 font-medium hover:bg-og-primary-hover focus-visible:ring-2 focus-visible:ring-og-accent/40",
12080
10733
  onClick: onConfirmReplace,
12081
- children: "Replace and edit"
10734
+ children: QUEUE_REPLACE_DRAFT_COPY.replace
12082
10735
  }
12083
10736
  )
12084
10737
  ] })
@@ -12325,6 +10978,33 @@ function IconAction({
12325
10978
  ] });
12326
10979
  }
12327
10980
 
10981
+ // src/components/provider-recovery-notice.tsx
10982
+ import { Clock3Icon } from "lucide-react";
10983
+ import { jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
10984
+ var PROVIDER_RECOVERY_NOTICE_DETAIL = "Your message is saved. Opengeni keeps retrying automatically for a few minutes.";
10985
+ function ProviderRecoveryNotice({
10986
+ recovery,
10987
+ detail,
10988
+ className
10989
+ }) {
10990
+ if (!recovery) return null;
10991
+ const secondary = detail === void 0 ? PROVIDER_RECOVERY_NOTICE_DETAIL : detail;
10992
+ return /* @__PURE__ */ jsxs19(
10993
+ "div",
10994
+ {
10995
+ className: cn("flex items-start gap-2 text-og-sm text-og-fg-muted", className),
10996
+ "data-og-provider-recovery": "",
10997
+ children: [
10998
+ /* @__PURE__ */ jsx25(Clock3Icon, { "aria-hidden": "true", className: "mt-0.5 size-4 shrink-0" }),
10999
+ /* @__PURE__ */ jsxs19("div", { className: "min-w-0", role: "status", "aria-live": "polite", children: [
11000
+ /* @__PURE__ */ jsx25("p", { className: "font-medium text-og-fg", children: providerRecoveryRetryingText(recovery) }),
11001
+ secondary ? /* @__PURE__ */ jsx25("p", { className: "mt-0.5 text-og-xs", children: secondary }) : null
11002
+ ] })
11003
+ ]
11004
+ }
11005
+ );
11006
+ }
11007
+
12328
11008
  // src/components/session-conversation.tsx
12329
11009
  import {
12330
11010
  resolveWorkspaceVoiceInputEnabled,
@@ -12352,7 +11032,8 @@ var INITIAL_FLAGS = {
12352
11032
  sessionCreation: true,
12353
11033
  archive: true,
12354
11034
  voiceInput: null,
12355
- realtimeVoice: false
11035
+ realtimeVoice: false,
11036
+ realtimeVoiceOffered: false
12356
11037
  };
12357
11038
  var configReads = /* @__PURE__ */ new WeakMap();
12358
11039
  function readClientConfig(client) {
@@ -12385,7 +11066,8 @@ function useClientConfigFlags(client) {
12385
11066
  sessionCreation: config.sessionCreation !== false,
12386
11067
  archive: config.archive !== false,
12387
11068
  voiceInput: config.voiceInput?.available === true ? config.voiceInput : null,
12388
- realtimeVoice: config.realtimeVoice !== false
11069
+ realtimeVoice: config.realtimeVoice !== false,
11070
+ realtimeVoiceOffered: config.realtimeVoice === true
12389
11071
  });
12390
11072
  }
12391
11073
  },
@@ -12446,7 +11128,7 @@ import {
12446
11128
  OpenGeniBrowserClient
12447
11129
  } from "@opengeni/sdk/browser";
12448
11130
  import { useEffect as useEffect16, useMemo as useMemo9, useRef as useRef12, useState as useState21 } from "react";
12449
- import { jsx as jsx25 } from "react/jsx-runtime";
11131
+ import { jsx as jsx26 } from "react/jsx-runtime";
12450
11132
  function proxyLoadErrorMessage(error) {
12451
11133
  if (error instanceof OpenGeniApiError2 && error.status === 401 && error.code === "unauthenticated") {
12452
11134
  const message = "Chat is unavailable right now. Ask an administrator for help.";
@@ -12515,12 +11197,12 @@ function SessionProxyScope({
12515
11197
  };
12516
11198
  }, [client, workspaceId]);
12517
11199
  if (state.status === "error") {
12518
- return /* @__PURE__ */ jsx25("div", { role: "alert", className: "og-root p-3 text-og-sm text-og-danger", "data-og-proxy-error": "", children: state.message });
11200
+ return /* @__PURE__ */ jsx26("div", { role: "alert", className: "og-root p-3 text-og-sm text-og-danger", "data-og-proxy-error": "", children: state.message });
12519
11201
  }
12520
11202
  if (state.status === "loading") {
12521
- return /* @__PURE__ */ jsx25("div", { className: "og-root", "aria-busy": "true", "data-og-proxy-loading": "" });
11203
+ return /* @__PURE__ */ jsx26("div", { className: "og-root", "aria-busy": "true", "data-og-proxy-loading": "" });
12522
11204
  }
12523
- return /* @__PURE__ */ jsx25(OpenGeniProvider, { client, workspaceId: state.workspaceId, children });
11205
+ return /* @__PURE__ */ jsx26(OpenGeniProvider, { client, workspaceId: state.workspaceId, children });
12524
11206
  }
12525
11207
 
12526
11208
  // src/lib/host-theme.ts
@@ -12864,7 +11546,7 @@ function useHostTheme(ref, options) {
12864
11546
  }
12865
11547
 
12866
11548
  // src/components/session-conversation.tsx
12867
- import { Fragment as Fragment9, jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
11549
+ import { Fragment as Fragment10, jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
12868
11550
  var DEFAULT_CONVERSATION_LABELS = {
12869
11551
  retry: "Retry",
12870
11552
  tryAgain: "Try again",
@@ -12876,9 +11558,9 @@ function SessionConversation({
12876
11558
  fetch,
12877
11559
  ...props
12878
11560
  }) {
12879
- if (baseUrl === void 0) return /* @__PURE__ */ jsx26(RetryingConversation, { ...props });
11561
+ if (baseUrl === void 0) return /* @__PURE__ */ jsx27(RetryingConversation, { ...props });
12880
11562
  const { client, workspaceId, ...rest } = props;
12881
- return /* @__PURE__ */ jsx26(
11563
+ return /* @__PURE__ */ jsx27(
12882
11564
  SessionProxyScope,
12883
11565
  {
12884
11566
  baseUrl,
@@ -12886,13 +11568,13 @@ function SessionConversation({
12886
11568
  client,
12887
11569
  headers,
12888
11570
  fetch,
12889
- children: /* @__PURE__ */ jsx26(RetryingConversation, { ...rest })
11571
+ children: /* @__PURE__ */ jsx27(RetryingConversation, { ...rest })
12890
11572
  }
12891
11573
  );
12892
11574
  }
12893
11575
  function RetryingConversation(props) {
12894
11576
  const [attempt, setAttempt] = useState23(0);
12895
- return /* @__PURE__ */ jsx26(
11577
+ return /* @__PURE__ */ jsx27(
12896
11578
  Conversation,
12897
11579
  {
12898
11580
  ...props,
@@ -12913,7 +11595,8 @@ function Conversation({
12913
11595
  allowanceExhaustedLabels,
12914
11596
  attachments: attachmentsRequested = true,
12915
11597
  voiceInput: voiceInputRequested = true,
12916
- realtimeVoice: realtimeVoiceRequested = true,
11598
+ realtimeVoice: realtimeVoiceProp,
11599
+ genieLoading,
12917
11600
  modelPicker,
12918
11601
  modelPickerProps,
12919
11602
  userMessageDisclosureLabels,
@@ -13014,6 +11697,20 @@ function Conversation({
13014
11697
  if (feed.error) void feed.jumpToLatest();
13015
11698
  };
13016
11699
  const running = status === "running" || status === "recovering" || status === "waiting_capacity";
11700
+ const realtimeVoiceRequested = realtimeVoiceProp ?? config.realtimeVoiceOffered;
11701
+ const loadingOptions = useMemo10(() => embeddedGenieLoading(genieLoading), [genieLoading]);
11702
+ const providerRecovery = useMemo10(
11703
+ () => detail.session ? currentProviderRecovery(
11704
+ {
11705
+ id: detail.session.id,
11706
+ status,
11707
+ activeTurnId: detail.session.activeTurnId,
11708
+ effectiveControl: queue.effectiveControl ?? detail.session.effectiveControl ?? void 0
11709
+ },
11710
+ feed.events
11711
+ ) : null,
11712
+ [detail.session, status, queue.effectiveControl, feed.events]
11713
+ );
13017
11714
  const voiceModels = useRealtimeVoiceModels(
13018
11715
  context.client,
13019
11716
  context.workspaceId,
@@ -13021,7 +11718,7 @@ function Conversation({
13021
11718
  );
13022
11719
  const [voiceActive, setVoiceActive] = useState23(false);
13023
11720
  const voiceControl = composer.effectiveControl ?? queue.effectiveControl ?? detail.session?.effectiveControl;
13024
- const voice = voiceModels.length > 0 && status && !terminal && voiceControl ? /* @__PURE__ */ jsx26(Suspense6, { fallback: null, children: /* @__PURE__ */ jsx26(
11721
+ const voice = voiceModels.length > 0 && status && !terminal && voiceControl ? /* @__PURE__ */ jsx27(Suspense6, { fallback: null, children: /* @__PURE__ */ jsx27(
13025
11722
  LazyEmbeddedRealtimeVoice,
13026
11723
  {
13027
11724
  client: context.client,
@@ -13035,7 +11732,7 @@ function Conversation({
13035
11732
  onVoiceActiveChange: setVoiceActive
13036
11733
  }
13037
11734
  ) }) : null;
13038
- return /* @__PURE__ */ jsxs19(
11735
+ return /* @__PURE__ */ jsxs20(
13039
11736
  "div",
13040
11737
  {
13041
11738
  className: cn(
@@ -13048,15 +11745,15 @@ function Conversation({
13048
11745
  "data-og-host-theme": "",
13049
11746
  "data-og-conversation": "",
13050
11747
  children: [
13051
- error && !loadFailed ? /* @__PURE__ */ jsxs19(
11748
+ error && !loadFailed ? /* @__PURE__ */ jsxs20(
13052
11749
  "div",
13053
11750
  {
13054
11751
  role: "alert",
13055
11752
  className: "mx-auto flex w-full max-w-3xl shrink-0 items-center gap-3 rounded-og-md border border-og-status-failed/30 bg-og-status-failed/10 px-3 py-2 text-og-sm text-og-fg",
13056
11753
  "data-og-conversation-error": "",
13057
11754
  children: [
13058
- /* @__PURE__ */ jsx26("span", { className: "min-w-0 flex-1", children: formatError(error) }),
13059
- /* @__PURE__ */ jsx26(
11755
+ /* @__PURE__ */ jsx27("span", { className: "min-w-0 flex-1", children: formatError(error) }),
11756
+ /* @__PURE__ */ jsx27(
13060
11757
  "button",
13061
11758
  {
13062
11759
  type: "button",
@@ -13068,15 +11765,15 @@ function Conversation({
13068
11765
  ]
13069
11766
  }
13070
11767
  ) : null,
13071
- loadFailed ? /* @__PURE__ */ jsxs19(
11768
+ loadFailed ? /* @__PURE__ */ jsxs20(
13072
11769
  "div",
13073
11770
  {
13074
11771
  role: "alert",
13075
11772
  className: "flex min-h-0 flex-1 flex-col items-center justify-center gap-3 px-6 text-center",
13076
11773
  "data-og-conversation-error": "",
13077
11774
  children: [
13078
- /* @__PURE__ */ jsx26("p", { className: "max-w-sm text-og-base text-og-fg-muted", children: formatError(feed.error) }),
13079
- /* @__PURE__ */ jsx26(
11775
+ /* @__PURE__ */ jsx27("p", { className: "max-w-sm text-og-base text-og-fg-muted", children: formatError(feed.error) }),
11776
+ /* @__PURE__ */ jsx27(
13080
11777
  "button",
13081
11778
  {
13082
11779
  type: "button",
@@ -13087,13 +11784,14 @@ function Conversation({
13087
11784
  )
13088
11785
  ]
13089
11786
  }
13090
- ) : /* @__PURE__ */ jsx26(
11787
+ ) : /* @__PURE__ */ jsx27(
13091
11788
  MessageTimeline,
13092
11789
  {
13093
11790
  renderMessageText,
13094
11791
  resolveLink: links,
13095
11792
  renderInteractiveBlock: renderInteractiveBlock === false ? void 0 : renderInteractiveBlock ?? defaultInteractiveBlock,
13096
11793
  userMessageDisclosureLabels,
11794
+ genieLoading: loadingOptions,
13097
11795
  renderAllowanceExhausted,
13098
11796
  allowanceExhaustedLabels,
13099
11797
  className: "isolate min-h-0 flex-1 overflow-hidden",
@@ -13119,14 +11817,14 @@ function Conversation({
13119
11817
  questionNavMinViewportHeight: 320
13120
11818
  }
13121
11819
  ),
13122
- importedArchive ? /* @__PURE__ */ jsx26("p", { className: "shrink-0 px-4 py-2 text-center text-sm text-og-muted", role: "status", children: "Archived conversation \xB7 Read only" }) : /* @__PURE__ */ jsxs19(Fragment9, { children: [
13123
- /* @__PURE__ */ jsxs19(
11820
+ importedArchive ? /* @__PURE__ */ jsx27("p", { className: "shrink-0 px-4 py-2 text-center text-sm text-og-muted", role: "status", children: "Archived conversation \xB7 Read only" }) : /* @__PURE__ */ jsxs20(Fragment10, { children: [
11821
+ /* @__PURE__ */ jsxs20(
13124
11822
  "div",
13125
11823
  {
13126
11824
  className: "relative z-20 min-h-0 max-h-[40%] shrink-0 overflow-y-auto empty:hidden",
13127
11825
  "data-og-conversation-inputs": "",
13128
11826
  children: [
13129
- approvals.length > 0 && !terminal ? /* @__PURE__ */ jsx26(
11827
+ approvals.length > 0 && !terminal ? /* @__PURE__ */ jsx27(
13130
11828
  ApprovalSurface,
13131
11829
  {
13132
11830
  className: "mx-auto max-w-3xl",
@@ -13141,7 +11839,14 @@ function Conversation({
13141
11839
  error: control.error
13142
11840
  }
13143
11841
  ) : null,
13144
- /* @__PURE__ */ jsx26(
11842
+ /* @__PURE__ */ jsx27(
11843
+ ProviderRecoveryNotice,
11844
+ {
11845
+ className: "mx-auto max-w-3xl px-1",
11846
+ recovery: providerRecovery
11847
+ }
11848
+ ),
11849
+ /* @__PURE__ */ jsx27(
13145
11850
  HumanInputSurface,
13146
11851
  {
13147
11852
  className: "mx-auto max-w-3xl",
@@ -13156,7 +11861,7 @@ function Conversation({
13156
11861
  decisionButtons: true
13157
11862
  }
13158
11863
  ),
13159
- /* @__PURE__ */ jsx26(
11864
+ /* @__PURE__ */ jsx27(
13160
11865
  ConversationChrome,
13161
11866
  {
13162
11867
  sessionId,
@@ -13175,19 +11880,19 @@ function Conversation({
13175
11880
  ]
13176
11881
  }
13177
11882
  ),
13178
- /* @__PURE__ */ jsx26(
11883
+ /* @__PURE__ */ jsx27(
13179
11884
  "div",
13180
11885
  {
13181
11886
  className: "relative z-20 mx-auto w-full max-w-3xl shrink-0",
13182
11887
  "data-og-conversation-composer": "",
13183
- children: /* @__PURE__ */ jsx26(
11888
+ children: /* @__PURE__ */ jsx27(
13184
11889
  ChatComposer,
13185
11890
  {
13186
11891
  runControl: "stop",
13187
11892
  running,
13188
11893
  ...composerProps,
13189
11894
  ...transcription && composerProps?.transcription === void 0 ? { transcription } : {},
13190
- actionsStart: voice ? /* @__PURE__ */ jsxs19(Fragment9, { children: [
11895
+ actionsStart: voice ? /* @__PURE__ */ jsxs20(Fragment10, { children: [
13191
11896
  composerProps?.actionsStart,
13192
11897
  voice
13193
11898
  ] }) : composerProps?.actionsStart,
@@ -13195,7 +11900,7 @@ function Conversation({
13195
11900
  composer,
13196
11901
  attachments: uploadsEnabled ? files : void 0,
13197
11902
  disabled: terminal || composerProps?.disabled,
13198
- controlsStart: composerProps?.controlsStart ?? (showModelPicker && composer.policy && /* @__PURE__ */ jsx26(
11903
+ controlsStart: composerProps?.controlsStart ?? (showModelPicker && composer.policy && /* @__PURE__ */ jsx27(
13199
11904
  ModelPolicyPicker,
13200
11905
  {
13201
11906
  groupPresentation: modelPickerProps?.groupPresentation,
@@ -13228,10 +11933,19 @@ function Conversation({
13228
11933
  }
13229
11934
  );
13230
11935
  }
11936
+ function embeddedGenieLoading(options) {
11937
+ if (!options) return EMBEDDED_GENIE_LOADING;
11938
+ return {
11939
+ ...EMBEDDED_GENIE_LOADING,
11940
+ ...options,
11941
+ phrases: options.phrases?.length ? options.phrases : EMBEDDED_GENIE_LOADING.phrases,
11942
+ messages: { ...EMBEDDED_GENIE_LOADING.messages, ...options.messages }
11943
+ };
11944
+ }
13231
11945
  function ConversationChrome(props) {
13232
11946
  const goals = props.client;
13233
11947
  const canReachGoals = typeof goals.getGoal === "function" && typeof goals.updateGoal === "function" && typeof goals.deleteGoal === "function";
13234
- return canReachGoals ? /* @__PURE__ */ jsx26(GoalChrome, { ...props }) : /* @__PURE__ */ jsx26(SessionChrome, { ...props.chrome });
11948
+ return canReachGoals ? /* @__PURE__ */ jsx27(GoalChrome, { ...props }) : /* @__PURE__ */ jsx27(SessionChrome, { ...props.chrome });
13235
11949
  }
13236
11950
  function GoalChrome({ sessionId, client, workspaceId, events, chrome }) {
13237
11951
  const goal = useGoal(sessionId, {
@@ -13239,9 +11953,9 @@ function GoalChrome({ sessionId, client, workspaceId, events, chrome }) {
13239
11953
  workspaceId,
13240
11954
  events
13241
11955
  });
13242
- return /* @__PURE__ */ jsx26(SessionChrome, { ...chrome, goal });
11956
+ return /* @__PURE__ */ jsx27(SessionChrome, { ...chrome, goal });
13243
11957
  }
13244
- var LazyEmbeddedRealtimeVoice = lazy5(() => import("./embedded-voice-NIL4RDX3.js"));
11958
+ var LazyEmbeddedRealtimeVoice = lazy5(() => import("./embedded-voice-3ZFWWJ6O.js"));
13245
11959
  var LazyChatInteractiveBlock = lazy5(
13246
11960
  () => import("./chat-interactive-block-ZFHOKTMS.js").then((module) => ({
13247
11961
  default: module.ChatInteractiveBlock
@@ -13269,7 +11983,7 @@ function useDefaultInteractiveBlock(client, workspaceId, sessionId, sitesAvailab
13269
11983
  (block) => block.kind === "site" && !sitesAvailable ? (
13270
11984
  // The proxy does not serve Sites: say so instead of offering a load
13271
11985
  // that can only fail.
13272
- /* @__PURE__ */ jsx26(
11986
+ /* @__PURE__ */ jsx27(
13273
11987
  "div",
13274
11988
  {
13275
11989
  className: "rounded-og-md border border-og-border bg-og-surface-1 px-3 py-2 text-og-sm text-og-fg-muted",
@@ -13277,7 +11991,7 @@ function useDefaultInteractiveBlock(client, workspaceId, sessionId, sitesAvailab
13277
11991
  children: sitePreviewUnavailable
13278
11992
  }
13279
11993
  )
13280
- ) : /* @__PURE__ */ jsx26(Suspense6, { fallback: /* @__PURE__ */ jsx26("span", { role: "status", children: "Loading preview\u2026" }), children: /* @__PURE__ */ jsx26(LazyChatInteractiveBlock, { workspaceId, client: scoped, ...block }) }),
11994
+ ) : /* @__PURE__ */ jsx27(Suspense6, { fallback: /* @__PURE__ */ jsx27("span", { role: "status", children: "Loading preview\u2026" }), children: /* @__PURE__ */ jsx27(LazyChatInteractiveBlock, { workspaceId, client: scoped, ...block }) }),
13281
11995
  [scoped, workspaceId, sitesAvailable, sitePreviewUnavailable]
13282
11996
  );
13283
11997
  }
@@ -13288,10 +12002,10 @@ function useRetainedLoaders(client, workspaceId, sessionId) {
13288
12002
  const get = () => scoped ??= sessionScoped(base, sessionId);
13289
12003
  return {
13290
12004
  ...typeof base.downloadRetainedArtifact === "function" && typeof base.createRetainedArtifactDownloadUrl === "function" ? {
13291
- loadRetainedArtifact: (artifact, signal) => createWorkspaceRetainedArtifactLoader(
12005
+ loadRetainedArtifact: (artifact, signal, options) => createWorkspaceRetainedArtifactLoader(
13292
12006
  get(),
13293
12007
  workspaceId
13294
- )(artifact, signal)
12008
+ )(artifact, signal, options)
13295
12009
  } : {},
13296
12010
  ...typeof base.downloadRetainedScreenshot === "function" ? {
13297
12011
  loadRetainedScreenshot: (artifact, signal) => createSessionRetainedScreenshotLoader(
@@ -13471,7 +12185,7 @@ function useWorkspaceSessions(options = {}) {
13471
12185
  import { deriveSessionDisplayTitle } from "@opengeni/sdk";
13472
12186
  import { ArchiveIcon, PencilIcon as PencilIcon2, PlusIcon } from "lucide-react";
13473
12187
  import { useEffect as useEffect20, useRef as useRef15, useState as useState24 } from "react";
13474
- import { jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
12188
+ import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
13475
12189
  var DEFAULT_LABELS = {
13476
12190
  heading: "Chats",
13477
12191
  newChat: "New chat",
@@ -13553,16 +12267,16 @@ function SessionList({
13553
12267
  onArchived?.(session.id);
13554
12268
  });
13555
12269
  const sessions = list.sessions;
13556
- return /* @__PURE__ */ jsxs20(
12270
+ return /* @__PURE__ */ jsxs21(
13557
12271
  "nav",
13558
12272
  {
13559
12273
  className: cn("flex min-h-0 min-w-0 flex-col gap-1 text-og-fg", className),
13560
12274
  "aria-label": labels.heading,
13561
12275
  "data-og-session-list": "",
13562
12276
  children: [
13563
- /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-between gap-2 px-2 pb-1 pt-2", children: [
13564
- /* @__PURE__ */ jsx27("h2", { className: "text-og-sm font-semibold text-og-fg-muted", children: labels.heading }),
13565
- onNewChat ? /* @__PURE__ */ jsxs20(
12277
+ /* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-between gap-2 px-2 pb-1 pt-2", children: [
12278
+ /* @__PURE__ */ jsx28("h2", { className: "text-og-sm font-semibold text-og-fg-muted", children: labels.heading }),
12279
+ onNewChat ? /* @__PURE__ */ jsxs21(
13566
12280
  "button",
13567
12281
  {
13568
12282
  type: "button",
@@ -13570,22 +12284,22 @@ function SessionList({
13570
12284
  className: "inline-flex items-center gap-1 rounded-md px-2 py-1 text-og-control text-og-fg hover:bg-og-surface-2",
13571
12285
  "data-og-new-chat": "",
13572
12286
  children: [
13573
- /* @__PURE__ */ jsx27(PlusIcon, { className: "size-3.5", "aria-hidden": true }),
12287
+ /* @__PURE__ */ jsx28(PlusIcon, { className: "size-3.5", "aria-hidden": true }),
13574
12288
  labels.newChat
13575
12289
  ]
13576
12290
  }
13577
12291
  ) : null
13578
12292
  ] }),
13579
- error || list.error ? /* @__PURE__ */ jsx27("p", { role: "alert", className: "px-2 text-og-xs text-og-status-failed", children: formatError(error ? error.cause : list.error) }) : null,
13580
- /* @__PURE__ */ jsxs20("ul", { className: "flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto px-1 pb-2", children: [
13581
- list.loading && sessions.length === 0 ? /* @__PURE__ */ jsx27("li", { className: "px-2 py-2 text-og-xs text-og-fg-subtle", children: labels.loading }) : null,
13582
- !list.loading && !list.error && sessions.length === 0 ? /* @__PURE__ */ jsx27("li", { className: "px-2 py-2 text-og-xs text-og-fg-subtle", children: labels.empty }) : null,
12293
+ error || list.error ? /* @__PURE__ */ jsx28("p", { role: "alert", className: "px-2 text-og-xs text-og-status-failed", children: formatError(error ? error.cause : list.error) }) : null,
12294
+ /* @__PURE__ */ jsxs21("ul", { className: "flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto px-1 pb-2", children: [
12295
+ list.loading && sessions.length === 0 ? /* @__PURE__ */ jsx28("li", { className: "px-2 py-2 text-og-xs text-og-fg-subtle", children: labels.loading }) : null,
12296
+ !list.loading && !list.error && sessions.length === 0 ? /* @__PURE__ */ jsx28("li", { className: "px-2 py-2 text-og-xs text-og-fg-subtle", children: labels.empty }) : null,
13583
12297
  sessions.map((session) => {
13584
12298
  const selected = session.id === selectedSessionId;
13585
12299
  const title = deriveSessionDisplayTitle(session);
13586
12300
  if (editing?.id === session.id) {
13587
- return /* @__PURE__ */ jsx27("li", { children: /* @__PURE__ */ jsxs20("form", { onSubmit: saveTitle, className: "flex items-center gap-1 px-1 py-1", children: [
13588
- /* @__PURE__ */ jsx27(
12301
+ return /* @__PURE__ */ jsx28("li", { children: /* @__PURE__ */ jsxs21("form", { onSubmit: saveTitle, className: "flex items-center gap-1 px-1 py-1", children: [
12302
+ /* @__PURE__ */ jsx28(
13589
12303
  "input",
13590
12304
  {
13591
12305
  "aria-label": labels.rename,
@@ -13599,7 +12313,7 @@ function SessionList({
13599
12313
  className: "min-w-0 flex-1 rounded-md border border-og-border bg-og-bg px-2 py-1 text-og-sm text-og-fg"
13600
12314
  }
13601
12315
  ),
13602
- /* @__PURE__ */ jsx27(
12316
+ /* @__PURE__ */ jsx28(
13603
12317
  "button",
13604
12318
  {
13605
12319
  type: "submit",
@@ -13609,8 +12323,8 @@ function SessionList({
13609
12323
  )
13610
12324
  ] }) }, session.id);
13611
12325
  }
13612
- return /* @__PURE__ */ jsxs20("li", { className: "group relative", children: [
13613
- /* @__PURE__ */ jsxs20(
12326
+ return /* @__PURE__ */ jsxs21("li", { className: "group relative", children: [
12327
+ /* @__PURE__ */ jsxs21(
13614
12328
  "button",
13615
12329
  {
13616
12330
  type: "button",
@@ -13623,36 +12337,36 @@ function SessionList({
13623
12337
  ),
13624
12338
  "data-og-session-row": "",
13625
12339
  children: [
13626
- /* @__PURE__ */ jsx27("span", { className: "w-full truncate pr-12 text-og-sm text-og-fg", children: title }),
13627
- /* @__PURE__ */ jsx27("span", { className: "text-og-xs text-og-fg-subtle", children: formatRelativeTime(session.updatedAt) })
12340
+ /* @__PURE__ */ jsx28("span", { className: "w-full truncate pr-12 text-og-sm text-og-fg", children: title }),
12341
+ /* @__PURE__ */ jsx28("span", { className: "text-og-xs text-og-fg-subtle", children: formatRelativeTime(session.updatedAt) })
13628
12342
  ]
13629
12343
  }
13630
12344
  ),
13631
- /* @__PURE__ */ jsxs20("span", { className: "absolute right-1 top-1.5 hidden gap-0.5 group-focus-within:flex group-hover:flex pointer-coarse:flex", children: [
13632
- rename ? /* @__PURE__ */ jsx27(
12345
+ /* @__PURE__ */ jsxs21("span", { className: "absolute right-1 top-1.5 hidden gap-0.5 group-focus-within:flex group-hover:flex pointer-coarse:flex", children: [
12346
+ rename ? /* @__PURE__ */ jsx28(
13633
12347
  "button",
13634
12348
  {
13635
12349
  type: "button",
13636
12350
  "aria-label": `${labels.rename}: ${title}`,
13637
12351
  onClick: () => setEditing({ id: session.id, title: session.title ?? title }),
13638
12352
  className: "rounded p-1 text-og-fg-subtle hover:bg-og-surface-3 hover:text-og-fg",
13639
- children: /* @__PURE__ */ jsx27(PencilIcon2, { className: "size-3.5", "aria-hidden": true })
12353
+ children: /* @__PURE__ */ jsx28(PencilIcon2, { className: "size-3.5", "aria-hidden": true })
13640
12354
  }
13641
12355
  ) : null,
13642
- canArchive ? /* @__PURE__ */ jsx27(
12356
+ canArchive ? /* @__PURE__ */ jsx28(
13643
12357
  "button",
13644
12358
  {
13645
12359
  type: "button",
13646
12360
  "aria-label": `${labels.archive}: ${title}`,
13647
12361
  onClick: () => archiveSession(session),
13648
12362
  className: "rounded p-1 text-og-fg-subtle hover:bg-og-surface-3 hover:text-og-fg",
13649
- children: /* @__PURE__ */ jsx27(ArchiveIcon, { className: "size-3.5", "aria-hidden": true })
12363
+ children: /* @__PURE__ */ jsx28(ArchiveIcon, { className: "size-3.5", "aria-hidden": true })
13650
12364
  }
13651
12365
  ) : null
13652
12366
  ] })
13653
12367
  ] }, session.id);
13654
12368
  }),
13655
- list.nextCursor ? /* @__PURE__ */ jsx27("li", { children: /* @__PURE__ */ jsx27(
12369
+ list.nextCursor ? /* @__PURE__ */ jsx28("li", { children: /* @__PURE__ */ jsx28(
13656
12370
  "button",
13657
12371
  {
13658
12372
  type: "button",
@@ -13673,7 +12387,7 @@ import {
13673
12387
  } from "@opengeni/sdk";
13674
12388
  import { MenuIcon, XIcon as XIcon2 } from "lucide-react";
13675
12389
  import { useCallback as useCallback8, useRef as useRef16, useState as useState25 } from "react";
13676
- import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
12390
+ import { jsx as jsx29, jsxs as jsxs22 } from "react/jsx-runtime";
13677
12391
  var DEFAULT_LABELS2 = {
13678
12392
  openChats: "Open chats",
13679
12393
  closeChats: "Close chats",
@@ -13683,9 +12397,9 @@ var DEFAULT_LABELS2 = {
13683
12397
  newChatUnavailable: "New chats are not enabled for this product."
13684
12398
  };
13685
12399
  function OpenGeniChat({ baseUrl, headers, fetch, ...props }) {
13686
- if (baseUrl === void 0) return /* @__PURE__ */ jsx28(Chat, { ...props });
12400
+ if (baseUrl === void 0) return /* @__PURE__ */ jsx29(Chat, { ...props });
13687
12401
  const { client, workspaceId, ...rest } = props;
13688
- return /* @__PURE__ */ jsx28(
12402
+ return /* @__PURE__ */ jsx29(
13689
12403
  SessionProxyScope,
13690
12404
  {
13691
12405
  baseUrl,
@@ -13693,7 +12407,7 @@ function OpenGeniChat({ baseUrl, headers, fetch, ...props }) {
13693
12407
  client,
13694
12408
  headers,
13695
12409
  fetch,
13696
- children: /* @__PURE__ */ jsx28(Chat, { ...rest })
12410
+ children: /* @__PURE__ */ jsx29(Chat, { ...rest })
13697
12411
  }
13698
12412
  );
13699
12413
  }
@@ -13753,7 +12467,7 @@ function Chat({
13753
12467
  },
13754
12468
  [context.client, context.workspaceId, createSession, labels.newChatUnavailable]
13755
12469
  );
13756
- const list = /* @__PURE__ */ jsx28(
12470
+ const list = /* @__PURE__ */ jsx29(
13757
12471
  SessionList,
13758
12472
  {
13759
12473
  ...scope,
@@ -13769,7 +12483,7 @@ function Chat({
13769
12483
  className: "h-full"
13770
12484
  }
13771
12485
  );
13772
- return /* @__PURE__ */ jsxs21(
12486
+ return /* @__PURE__ */ jsxs22(
13773
12487
  "div",
13774
12488
  {
13775
12489
  ref: root,
@@ -13782,7 +12496,7 @@ function Chat({
13782
12496
  "data-og-host-theme": "",
13783
12497
  "data-og-chat": "",
13784
12498
  children: [
13785
- /* @__PURE__ */ jsx28(
12499
+ /* @__PURE__ */ jsx29(
13786
12500
  "aside",
13787
12501
  {
13788
12502
  className: "og-chat-sidebar min-h-0 w-64 shrink-0 flex-col border-r border-og-border",
@@ -13790,21 +12504,21 @@ function Chat({
13790
12504
  children: list
13791
12505
  }
13792
12506
  ),
13793
- drawerOpen ? /* @__PURE__ */ jsxs21("div", { className: "og-chat-drawer absolute inset-0 z-30 flex", "data-og-chat-drawer": "", children: [
13794
- /* @__PURE__ */ jsxs21("div", { className: "flex h-full w-[min(20rem,85%)] flex-col border-r border-og-border bg-og-bg shadow-og-lg", children: [
13795
- /* @__PURE__ */ jsx28("div", { className: "flex justify-end p-1", children: /* @__PURE__ */ jsx28(
12507
+ drawerOpen ? /* @__PURE__ */ jsxs22("div", { className: "og-chat-drawer absolute inset-0 z-30 flex", "data-og-chat-drawer": "", children: [
12508
+ /* @__PURE__ */ jsxs22("div", { className: "flex h-full w-[min(20rem,85%)] flex-col border-r border-og-border bg-og-bg shadow-og-lg", children: [
12509
+ /* @__PURE__ */ jsx29("div", { className: "flex justify-end p-1", children: /* @__PURE__ */ jsx29(
13796
12510
  "button",
13797
12511
  {
13798
12512
  type: "button",
13799
12513
  "aria-label": labels.closeChats,
13800
12514
  onClick: () => setDrawerOpen(false),
13801
12515
  className: "rounded p-1.5 text-og-fg-muted hover:bg-og-surface-2",
13802
- children: /* @__PURE__ */ jsx28(XIcon2, { className: "size-4", "aria-hidden": true })
12516
+ children: /* @__PURE__ */ jsx29(XIcon2, { className: "size-4", "aria-hidden": true })
13803
12517
  }
13804
12518
  ) }),
13805
- /* @__PURE__ */ jsx28("div", { className: "min-h-0 flex-1", children: list })
12519
+ /* @__PURE__ */ jsx29("div", { className: "min-h-0 flex-1", children: list })
13806
12520
  ] }),
13807
- /* @__PURE__ */ jsx28(
12521
+ /* @__PURE__ */ jsx29(
13808
12522
  "button",
13809
12523
  {
13810
12524
  type: "button",
@@ -13814,9 +12528,9 @@ function Chat({
13814
12528
  }
13815
12529
  )
13816
12530
  ] }) : null,
13817
- /* @__PURE__ */ jsxs21("main", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: [
13818
- /* @__PURE__ */ jsxs21("div", { className: "og-chat-menu flex items-center gap-2 px-2 py-1", children: [
13819
- /* @__PURE__ */ jsx28(
12531
+ /* @__PURE__ */ jsxs22("main", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: [
12532
+ /* @__PURE__ */ jsxs22("div", { className: "og-chat-menu flex items-center gap-2 px-2 py-1", children: [
12533
+ /* @__PURE__ */ jsx29(
13820
12534
  "button",
13821
12535
  {
13822
12536
  type: "button",
@@ -13825,12 +12539,12 @@ function Chat({
13825
12539
  onClick: () => setDrawerOpen(true),
13826
12540
  className: "rounded p-1.5 text-og-fg-muted hover:bg-og-surface-2",
13827
12541
  "data-og-chat-menu": "",
13828
- children: /* @__PURE__ */ jsx28(MenuIcon, { className: "size-4", "aria-hidden": true })
12542
+ children: /* @__PURE__ */ jsx29(MenuIcon, { className: "size-4", "aria-hidden": true })
13829
12543
  }
13830
12544
  ),
13831
- /* @__PURE__ */ jsx28("span", { className: "text-og-sm font-semibold text-og-fg-muted", children: labels.heading })
12545
+ /* @__PURE__ */ jsx29("span", { className: "text-og-sm font-semibold text-og-fg-muted", children: labels.heading })
13832
12546
  ] }),
13833
- /* @__PURE__ */ jsx28("div", { className: "og-chat-main min-h-0 flex-1 px-3 pb-3 pt-1", children: selected ? /* @__PURE__ */ jsx28(
12547
+ /* @__PURE__ */ jsx29("div", { className: "og-chat-main min-h-0 flex-1 px-3 pb-3 pt-1", children: selected ? /* @__PURE__ */ jsx29(
13834
12548
  SessionConversation,
13835
12549
  {
13836
12550
  ...conversationProps,
@@ -13839,7 +12553,7 @@ function Chat({
13839
12553
  sessionId: selected,
13840
12554
  height: "100%"
13841
12555
  }
13842
- ) : /* @__PURE__ */ jsx28(
12556
+ ) : /* @__PURE__ */ jsx29(
13843
12557
  NewChat,
13844
12558
  {
13845
12559
  scope,
@@ -13962,7 +12676,7 @@ function NewChat({
13962
12676
  error: null,
13963
12677
  clearError: () => setError(null)
13964
12678
  };
13965
- return /* @__PURE__ */ jsxs21(
12679
+ return /* @__PURE__ */ jsxs22(
13966
12680
  "form",
13967
12681
  {
13968
12682
  onSubmit: (event) => {
@@ -13972,9 +12686,9 @@ function NewChat({
13972
12686
  className: "mx-auto box-border flex h-full w-full max-w-3xl flex-col gap-4 p-3",
13973
12687
  "data-og-new-chat-composer": "",
13974
12688
  children: [
13975
- /* @__PURE__ */ jsx28("div", { "aria-hidden": true, className: "min-h-0 flex-[2]" }),
13976
- labels.newChatTitle ? /* @__PURE__ */ jsx28("p", { className: "text-center text-og-md font-medium text-og-fg", children: labels.newChatTitle }) : null,
13977
- /* @__PURE__ */ jsx28(
12689
+ /* @__PURE__ */ jsx29("div", { "aria-hidden": true, className: "min-h-0 flex-[2]" }),
12690
+ labels.newChatTitle ? /* @__PURE__ */ jsx29("p", { className: "text-center text-og-md font-medium text-og-fg", children: labels.newChatTitle }) : null,
12691
+ /* @__PURE__ */ jsx29(
13978
12692
  ChatComposer,
13979
12693
  {
13980
12694
  ...composerProps,
@@ -13990,7 +12704,7 @@ function NewChat({
13990
12704
  ...composerProps?.inputProps
13991
12705
  },
13992
12706
  messages: { sendMessageAriaLabel: labels.send, ...composerProps?.messages },
13993
- controlsStart: composerProps?.controlsStart ?? (policy ? /* @__PURE__ */ jsx28(
12707
+ controlsStart: composerProps?.controlsStart ?? (policy ? /* @__PURE__ */ jsx29(
13994
12708
  ModelPolicyPicker,
13995
12709
  {
13996
12710
  groupPresentation: modelPickerProps?.groupPresentation,
@@ -14014,11 +12728,11 @@ function NewChat({
14014
12728
  responsiveBasis: composerProps?.responsiveBasis ?? "container"
14015
12729
  }
14016
12730
  ),
14017
- !available ? /* @__PURE__ */ jsx28("p", { className: "text-center text-og-sm text-og-fg-muted", "data-og-new-chat-unavailable": "", children: labels.newChatUnavailable }) : error ? /* @__PURE__ */ jsx28("p", { role: "alert", className: "text-center text-og-sm text-og-status-failed", children: formatError(
12731
+ !available ? /* @__PURE__ */ jsx29("p", { className: "text-center text-og-sm text-og-fg-muted", "data-og-new-chat-unavailable": "", children: labels.newChatUnavailable }) : error ? /* @__PURE__ */ jsx29("p", { role: "alert", className: "text-center text-og-sm text-og-status-failed", children: formatError(
14018
12732
  error.cause,
14019
12733
  error.cause instanceof Error && error.cause.message === labels.newChatUnavailable ? labels.newChatUnavailable : void 0
14020
12734
  ) }) : null,
14021
- /* @__PURE__ */ jsx28("div", { "aria-hidden": true, className: "min-h-0 flex-[3]" })
12735
+ /* @__PURE__ */ jsx29("div", { "aria-hidden": true, className: "min-h-0 flex-[3]" })
14022
12736
  ]
14023
12737
  }
14024
12738
  );
@@ -14027,7 +12741,7 @@ function NewChat({
14027
12741
  // src/components/session-commands-panel.tsx
14028
12742
  import { ChevronRightIcon as ChevronRightIcon5, Loader2Icon as Loader2Icon3, SquareIcon } from "lucide-react";
14029
12743
  import { useState as useState26 } from "react";
14030
- import { jsx as jsx29, jsxs as jsxs22 } from "react/jsx-runtime";
12744
+ import { jsx as jsx30, jsxs as jsxs23 } from "react/jsx-runtime";
14031
12745
  function SessionCommandsPanel({
14032
12746
  commands: state,
14033
12747
  readOnly = false
@@ -14049,11 +12763,11 @@ function SessionCommandsPanel({
14049
12763
  setPending(null);
14050
12764
  }
14051
12765
  };
14052
- return /* @__PURE__ */ jsxs22("div", { className: "space-y-2 text-og-xs", "data-og-session-commands": "", children: [
14053
- state.loading && active.length === 0 ? /* @__PURE__ */ jsx29("p", { role: "status", className: "text-og-fg-muted", children: "Loading commands\u2026" }) : null,
14054
- state.error ? /* @__PURE__ */ jsxs22("div", { role: "alert", className: "flex items-center justify-between gap-2 text-og-danger", children: [
14055
- /* @__PURE__ */ jsx29("span", { children: "Commands unavailable." }),
14056
- /* @__PURE__ */ jsx29(
12766
+ return /* @__PURE__ */ jsxs23("div", { className: "space-y-2 text-og-xs", "data-og-session-commands": "", children: [
12767
+ state.loading && active.length === 0 ? /* @__PURE__ */ jsx30("p", { role: "status", className: "text-og-fg-muted", children: "Loading commands\u2026" }) : null,
12768
+ state.error ? /* @__PURE__ */ jsxs23("div", { role: "alert", className: "flex items-center justify-between gap-2 text-og-danger", children: [
12769
+ /* @__PURE__ */ jsx30("span", { children: "Commands unavailable." }),
12770
+ /* @__PURE__ */ jsx30(
14057
12771
  "button",
14058
12772
  {
14059
12773
  type: "button",
@@ -14063,18 +12777,18 @@ function SessionCommandsPanel({
14063
12777
  }
14064
12778
  )
14065
12779
  ] }) : null,
14066
- !state.loading && !state.error && active.length === 0 ? /* @__PURE__ */ jsx29("p", { role: "status", className: "text-og-fg-muted", children: "No background commands running." }) : null,
14067
- active.length > 0 ? /* @__PURE__ */ jsx29("ul", { className: "max-h-64 overflow-y-auto overscroll-contain divide-y divide-og-border/40", children: active.map((command) => /* @__PURE__ */ jsxs22("li", { className: "flex items-start gap-3 py-2 first:pt-0 last:pb-0", children: [
14068
- /* @__PURE__ */ jsxs22("div", { className: "min-w-0 flex-1", children: [
14069
- /* @__PURE__ */ jsxs22("details", { className: "group/command", children: [
14070
- /* @__PURE__ */ jsxs22(
12780
+ !state.loading && !state.error && active.length === 0 ? /* @__PURE__ */ jsx30("p", { role: "status", className: "text-og-fg-muted", children: "No background commands running." }) : null,
12781
+ active.length > 0 ? /* @__PURE__ */ jsx30("ul", { className: "max-h-64 overflow-y-auto overscroll-contain divide-y divide-og-border/40", children: active.map((command) => /* @__PURE__ */ jsxs23("li", { className: "flex items-start gap-3 py-2 first:pt-0 last:pb-0", children: [
12782
+ /* @__PURE__ */ jsxs23("div", { className: "min-w-0 flex-1", children: [
12783
+ /* @__PURE__ */ jsxs23("details", { className: "group/command", children: [
12784
+ /* @__PURE__ */ jsxs23(
14071
12785
  "summary",
14072
12786
  {
14073
12787
  className: "flex cursor-pointer list-none items-center gap-1.5 rounded-og-sm font-mono text-og-fg outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent/40",
14074
12788
  title: "Expand command",
14075
12789
  children: [
14076
- /* @__PURE__ */ jsx29(ChevronRightIcon5, { className: "size-3 shrink-0 text-og-fg-subtle transition-transform group-open/command:rotate-90" }),
14077
- /* @__PURE__ */ jsx29(
12790
+ /* @__PURE__ */ jsx30(ChevronRightIcon5, { className: "size-3 shrink-0 text-og-fg-subtle transition-transform group-open/command:rotate-90" }),
12791
+ /* @__PURE__ */ jsx30(
14078
12792
  "span",
14079
12793
  {
14080
12794
  className: "min-w-0 truncate",
@@ -14085,9 +12799,9 @@ function SessionCommandsPanel({
14085
12799
  ]
14086
12800
  }
14087
12801
  ),
14088
- /* @__PURE__ */ jsxs22("div", { className: "mt-2 space-y-1", children: [
14089
- /* @__PURE__ */ jsx29("p", { className: "whitespace-pre-wrap break-all font-mono text-og-fg-muted", children: command.commandText ?? (command.commandPreview || "Background command") }),
14090
- /* @__PURE__ */ jsxs22(
12802
+ /* @__PURE__ */ jsxs23("div", { className: "mt-2 space-y-1", children: [
12803
+ /* @__PURE__ */ jsx30("p", { className: "whitespace-pre-wrap break-all font-mono text-og-fg-muted", children: command.commandText ?? (command.commandPreview || "Background command") }),
12804
+ /* @__PURE__ */ jsxs23(
14091
12805
  "time",
14092
12806
  {
14093
12807
  className: "block text-og-fg-subtle",
@@ -14101,9 +12815,9 @@ function SessionCommandsPanel({
14101
12815
  )
14102
12816
  ] })
14103
12817
  ] }),
14104
- /* @__PURE__ */ jsx29("p", { className: "mt-1 text-og-fg-subtle", children: command.observationStatus === "unavailable" ? command.state === "stopping" ? "Stop requested \xB7 status unavailable" : "Command status unavailable" : command.state === "stopping" ? "Stopping\u2026" : "Running" })
12818
+ /* @__PURE__ */ jsx30("p", { className: "mt-1 text-og-fg-subtle", children: command.observationStatus === "unavailable" ? command.state === "stopping" ? "Stop requested \xB7 status unavailable" : "Command status unavailable" : command.state === "stopping" ? "Stopping\u2026" : "Running" })
14105
12819
  ] }),
14106
- !readOnly ? /* @__PURE__ */ jsxs22(
12820
+ !readOnly ? /* @__PURE__ */ jsxs23(
14107
12821
  "button",
14108
12822
  {
14109
12823
  type: "button",
@@ -14112,13 +12826,13 @@ function SessionCommandsPanel({
14112
12826
  onClick: () => void stop(command.id),
14113
12827
  className: "inline-flex min-h-7 shrink-0 items-center gap-1 rounded-og-sm px-2 text-og-fg-muted outline-hidden hover:bg-og-surface-3/70 hover:text-og-fg focus-visible:ring-2 focus-visible:ring-og-accent/40 disabled:opacity-50 pointer-coarse:min-h-11",
14114
12828
  children: [
14115
- pending === command.id || command.state === "stopping" ? /* @__PURE__ */ jsx29(Loader2Icon3, { className: "size-3 animate-og-spin motion-reduce:animate-none" }) : /* @__PURE__ */ jsx29(SquareIcon, { className: "size-3" }),
12829
+ pending === command.id || command.state === "stopping" ? /* @__PURE__ */ jsx30(Loader2Icon3, { className: "size-3 animate-og-spin motion-reduce:animate-none" }) : /* @__PURE__ */ jsx30(SquareIcon, { className: "size-3" }),
14116
12830
  "Stop"
14117
12831
  ]
14118
12832
  }
14119
12833
  ) : null
14120
12834
  ] }, command.id)) }) : null,
14121
- error ? /* @__PURE__ */ jsx29("p", { role: "alert", className: "text-og-danger", children: error }) : null
12835
+ error ? /* @__PURE__ */ jsx30("p", { role: "alert", className: "text-og-danger", children: error }) : null
14122
12836
  ] });
14123
12837
  }
14124
12838
 
@@ -14171,7 +12885,7 @@ function useSessionBackgroundCommands(sessionId, options = {}) {
14171
12885
  }
14172
12886
 
14173
12887
  // src/components/session-commands.tsx
14174
- import { jsx as jsx30 } from "react/jsx-runtime";
12888
+ import { jsx as jsx31 } from "react/jsx-runtime";
14175
12889
  function SessionCommands({
14176
12890
  sessionId,
14177
12891
  readOnly = false,
@@ -14181,11 +12895,11 @@ function SessionCommands({
14181
12895
  pollIntervalMs: 3e3,
14182
12896
  ...options
14183
12897
  });
14184
- return /* @__PURE__ */ jsx30(SessionCommandsPanel, { commands, readOnly });
12898
+ return /* @__PURE__ */ jsx31(SessionCommandsPanel, { commands, readOnly });
14185
12899
  }
14186
12900
 
14187
12901
  // src/timeline/startup-timings.tsx
14188
- import { jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
12902
+ import { jsx as jsx32, jsxs as jsxs24 } from "react/jsx-runtime";
14189
12903
  var LABELS = {
14190
12904
  queue: "Worker queue",
14191
12905
  sandbox: "Sandbox",
@@ -14198,7 +12912,7 @@ var LABELS = {
14198
12912
  };
14199
12913
  function StartupTimings({ phases }) {
14200
12914
  if (!phases.length)
14201
- return /* @__PURE__ */ jsx31("p", { className: "text-og-sm text-og-fg-subtle", children: "No startup timings recorded yet." });
12915
+ return /* @__PURE__ */ jsx32("p", { className: "text-og-sm text-og-fg-subtle", children: "No startup timings recorded yet." });
14202
12916
  const byTurn = /* @__PURE__ */ new Map();
14203
12917
  for (const phase of phases) {
14204
12918
  const group = byTurn.get(phase.turnId) ?? [];
@@ -14213,9 +12927,9 @@ function StartupTimings({ phases }) {
14213
12927
  turnPhases[0].startedAt
14214
12928
  )
14215
12929
  })).sort((a, b) => b.startedAt.localeCompare(a.startedAt));
14216
- return /* @__PURE__ */ jsxs23("div", { className: "space-y-3", children: [
14217
- /* @__PURE__ */ jsx31("p", { className: "text-og-xs text-og-fg-subtle", children: "Each turn has its own startup. Phases can overlap; durations are not additive." }),
14218
- turns.map((turn, index) => /* @__PURE__ */ jsx31(
12930
+ return /* @__PURE__ */ jsxs24("div", { className: "space-y-3", children: [
12931
+ /* @__PURE__ */ jsx32("p", { className: "text-og-xs text-og-fg-subtle", children: "Each turn has its own startup. Phases can overlap; durations are not additive." }),
12932
+ turns.map((turn, index) => /* @__PURE__ */ jsx32(
14219
12933
  StartupTurn,
14220
12934
  {
14221
12935
  ...turn,
@@ -14232,53 +12946,53 @@ function StartupTurn({
14232
12946
  latest
14233
12947
  }) {
14234
12948
  const status = phases.some((phase) => phase.status === "failed") ? "Failed" : phases.some((phase) => phase.status === "running") ? "In progress" : phases.some((phase) => phase.status === "cancelled") ? "Interrupted" : "Ready";
14235
- return /* @__PURE__ */ jsxs23("details", { open: latest, className: "group border-b border-og-border pb-3", children: [
14236
- /* @__PURE__ */ jsxs23("summary", { className: "cursor-pointer rounded py-3 text-og-sm text-og-fg-muted focus-visible:outline-2 focus-visible:outline-og-accent", children: [
14237
- /* @__PURE__ */ jsx31("span", { className: "font-medium", children: turnId === null ? "Unassigned events" : latest ? "Latest turn" : "Earlier turn" }),
14238
- /* @__PURE__ */ jsx31("span", { className: "ml-2 text-og-xs text-og-fg-subtle", children: new Date(startedAt).toLocaleTimeString([], {
12949
+ return /* @__PURE__ */ jsxs24("details", { open: latest, className: "group border-b border-og-border pb-3", children: [
12950
+ /* @__PURE__ */ jsxs24("summary", { className: "cursor-pointer rounded py-3 text-og-sm text-og-fg-muted focus-visible:outline-2 focus-visible:outline-og-accent", children: [
12951
+ /* @__PURE__ */ jsx32("span", { className: "font-medium", children: turnId === null ? "Unassigned events" : latest ? "Latest turn" : "Earlier turn" }),
12952
+ /* @__PURE__ */ jsx32("span", { className: "ml-2 text-og-xs text-og-fg-subtle", children: new Date(startedAt).toLocaleTimeString([], {
14239
12953
  hour: "2-digit",
14240
12954
  minute: "2-digit",
14241
12955
  second: "2-digit"
14242
12956
  }) }),
14243
- /* @__PURE__ */ jsx31(
12957
+ /* @__PURE__ */ jsx32(
14244
12958
  "span",
14245
12959
  {
14246
12960
  className: status === "Failed" ? "ml-2 text-og-xs text-og-status-failed" : "ml-2 text-og-xs text-og-fg-subtle",
14247
12961
  children: status
14248
12962
  }
14249
12963
  ),
14250
- /* @__PURE__ */ jsx31("span", { className: "mt-1 block break-all pl-4 font-og-mono text-og-xs text-og-fg-subtle", children: turnId ?? "No turn ID recorded" })
12964
+ /* @__PURE__ */ jsx32("span", { className: "mt-1 block break-all pl-4 font-og-mono text-og-xs text-og-fg-subtle", children: turnId ?? "No turn ID recorded" })
14251
12965
  ] }),
14252
- /* @__PURE__ */ jsxs23("div", { className: "pb-2", children: [
14253
- /* @__PURE__ */ jsxs23("p", { className: "text-og-xs text-og-fg-subtle", children: [
12966
+ /* @__PURE__ */ jsxs24("div", { className: "pb-2", children: [
12967
+ /* @__PURE__ */ jsxs24("p", { className: "text-og-xs text-og-fg-subtle", children: [
14254
12968
  "Started ",
14255
- /* @__PURE__ */ jsx31("time", { dateTime: startedAt, children: new Date(startedAt).toLocaleString() })
12969
+ /* @__PURE__ */ jsx32("time", { dateTime: startedAt, children: new Date(startedAt).toLocaleString() })
14256
12970
  ] }),
14257
- /* @__PURE__ */ jsx31("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs23("table", { className: "w-full text-left text-og-xs", children: [
14258
- /* @__PURE__ */ jsxs23("caption", { className: "sr-only", children: [
12971
+ /* @__PURE__ */ jsx32("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs24("table", { className: "w-full text-left text-og-xs", children: [
12972
+ /* @__PURE__ */ jsxs24("caption", { className: "sr-only", children: [
14259
12973
  "Startup phases for ",
14260
12974
  turnId ?? "unassigned events"
14261
12975
  ] }),
14262
- /* @__PURE__ */ jsx31("thead", { children: /* @__PURE__ */ jsxs23("tr", { className: "border-b border-og-border text-og-fg-subtle", children: [
14263
- /* @__PURE__ */ jsx31("th", { scope: "col", className: "py-2 font-medium", children: "Phase" }),
14264
- /* @__PURE__ */ jsx31("th", { scope: "col", className: "px-3 py-2 font-medium", children: "Status" }),
14265
- /* @__PURE__ */ jsx31("th", { scope: "col", className: "py-2 text-right font-medium", children: "Duration" })
12976
+ /* @__PURE__ */ jsx32("thead", { children: /* @__PURE__ */ jsxs24("tr", { className: "border-b border-og-border text-og-fg-subtle", children: [
12977
+ /* @__PURE__ */ jsx32("th", { scope: "col", className: "py-2 font-medium", children: "Phase" }),
12978
+ /* @__PURE__ */ jsx32("th", { scope: "col", className: "px-3 py-2 font-medium", children: "Status" }),
12979
+ /* @__PURE__ */ jsx32("th", { scope: "col", className: "py-2 text-right font-medium", children: "Duration" })
14266
12980
  ] }) }),
14267
- /* @__PURE__ */ jsx31("tbody", { children: phases.map((phase) => /* @__PURE__ */ jsxs23(
12981
+ /* @__PURE__ */ jsx32("tbody", { children: phases.map((phase) => /* @__PURE__ */ jsxs24(
14268
12982
  "tr",
14269
12983
  {
14270
12984
  className: "border-b border-og-border/40",
14271
12985
  title: `Turn: ${phase.turnId ?? "unknown"} \xB7 Started: ${phase.startedAt}`,
14272
12986
  children: [
14273
- /* @__PURE__ */ jsx31("th", { scope: "row", className: "py-2.5 font-normal text-og-fg-muted", children: LABELS[phase.phase] }),
14274
- /* @__PURE__ */ jsx31(
12987
+ /* @__PURE__ */ jsx32("th", { scope: "row", className: "py-2.5 font-normal text-og-fg-muted", children: LABELS[phase.phase] }),
12988
+ /* @__PURE__ */ jsx32(
14275
12989
  "td",
14276
12990
  {
14277
12991
  className: `px-3 py-2.5 ${phase.status === "failed" ? "text-og-status-failed" : "text-og-fg-subtle"}`,
14278
12992
  children: phase.status === "running" ? "In progress" : phase.status
14279
12993
  }
14280
12994
  ),
14281
- /* @__PURE__ */ jsx31("td", { className: "py-2.5 text-right font-og-mono tabular-nums text-og-fg-muted", children: phase.durationMs === null ? "\u2014" : phase.durationMs < 1e3 ? `${Math.round(phase.durationMs)} ms` : `${(phase.durationMs / 1e3).toFixed(1)} s` })
12995
+ /* @__PURE__ */ jsx32("td", { className: "py-2.5 text-right font-og-mono tabular-nums text-og-fg-muted", children: phase.durationMs === null ? "\u2014" : phase.durationMs < 1e3 ? `${Math.round(phase.durationMs)} ms` : `${(phase.durationMs / 1e3).toFixed(1)} s` })
14282
12996
  ]
14283
12997
  },
14284
12998
  phase.id
@@ -14289,9 +13003,7 @@ function StartupTurn({
14289
13003
  }
14290
13004
 
14291
13005
  export {
14292
- defaultHumanInputFormMessages,
14293
13006
  HumanInputForm,
14294
- answersFromDrafts,
14295
13007
  HumanInputSurface,
14296
13008
  ToolActionReviewCard,
14297
13009
  ToolActionReviewDetails,
@@ -14301,29 +13013,11 @@ export {
14301
13013
  setStartupDetails,
14302
13014
  useStartupDetails,
14303
13015
  ToolReviewHistoryProvider,
14304
- sandboxCommandExitCode,
14305
- parseExecBannerSessionId,
14306
- stripExecBanner,
14307
- execTruncated,
14308
- isExecSessionLostBanner,
14309
- looksBinary,
14310
- controlCaret,
14311
- v4aToGitFileDiff,
14312
- parseFreeformApplyPatch,
14313
- applyPatchOps,
14314
- applyPatchOpsFromToolItem,
14315
- isApplyPatch,
14316
- parseToolArgs,
14317
- tailPeek,
14318
- unwrapMcpOutput,
14319
- rawTypeOf,
14320
- createToolRegistry,
14321
13016
  gitFileDiffToPatch,
14322
13017
  PierreDiff,
14323
13018
  defaultToolRegistry,
14324
13019
  createDefaultToolRegistry,
14325
13020
  ActivityRail,
14326
- BUILT_IN_TURN_SUMMARY_FACET_IDS,
14327
13021
  TurnSummary,
14328
13022
  userMessageLikelyNeedsDisclosure,
14329
13023
  UserMessageBody,
@@ -14344,6 +13038,8 @@ export {
14344
13038
  sessionChromeGoalPillExplanation,
14345
13039
  sessionChromeGoalPillState,
14346
13040
  SessionChrome,
13041
+ PROVIDER_RECOVERY_NOTICE_DETAIL,
13042
+ ProviderRecoveryNotice,
14347
13043
  SessionConversation,
14348
13044
  useWorkspaceSessions,
14349
13045
  SessionList,
@@ -14353,4 +13049,4 @@ export {
14353
13049
  SessionCommands,
14354
13050
  StartupTimings
14355
13051
  };
14356
- //# sourceMappingURL=chunk-EAOSEIXB.js.map
13052
+ //# sourceMappingURL=chunk-TZQSHCZN.js.map