@athenaintel/react 0.23.3 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/README.md +6 -0
  2. package/dist/assets/AssetPanel.cjs +1 -1
  3. package/dist/assets/AssetPanel.cjs.map +1 -1
  4. package/dist/assets/AssetPanel.js +1 -1
  5. package/dist/assets/AssetPanel.js.map +1 -1
  6. package/dist/assets/AthenaAssetEmbed.cjs +1 -1
  7. package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
  8. package/dist/assets/AthenaAssetEmbed.js +1 -1
  9. package/dist/assets/AthenaAssetEmbed.js.map +1 -1
  10. package/dist/chat/AthenaChat.cjs +15 -23
  11. package/dist/chat/AthenaChat.cjs.map +1 -1
  12. package/dist/chat/AthenaChat.d.ts +9 -4
  13. package/dist/chat/AthenaChat.js +15 -23
  14. package/dist/chat/AthenaChat.js.map +1 -1
  15. package/dist/chat/StatewireApprovalCard.cjs +3 -18
  16. package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
  17. package/dist/chat/StatewireApprovalCard.js +3 -18
  18. package/dist/chat/StatewireApprovalCard.js.map +1 -1
  19. package/dist/chat/StatewireClientToolBridge.cjs +2 -16
  20. package/dist/chat/StatewireClientToolBridge.cjs.map +1 -1
  21. package/dist/chat/StatewireClientToolBridge.js +2 -16
  22. package/dist/chat/StatewireClientToolBridge.js.map +1 -1
  23. package/dist/chat/StatewireQueuedMessages.cjs +5 -16
  24. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
  25. package/dist/chat/StatewireQueuedMessages.js +5 -16
  26. package/dist/chat/StatewireQueuedMessages.js.map +1 -1
  27. package/dist/chat/WaitingOnYouBanner.cjs +3 -18
  28. package/dist/chat/WaitingOnYouBanner.cjs.map +1 -1
  29. package/dist/chat/WaitingOnYouBanner.js +3 -18
  30. package/dist/chat/WaitingOnYouBanner.js.map +1 -1
  31. package/dist/chat/run-activity.cjs +0 -16
  32. package/dist/chat/run-activity.cjs.map +1 -1
  33. package/dist/chat/run-activity.js +0 -16
  34. package/dist/chat/run-activity.js.map +1 -1
  35. package/dist/chat/statewire-client-tools.cjs +1 -17
  36. package/dist/chat/statewire-client-tools.cjs.map +1 -1
  37. package/dist/chat/statewire-client-tools.js +1 -17
  38. package/dist/chat/statewire-client-tools.js.map +1 -1
  39. package/dist/chat/super-grouping/activity-timeline.cjs +0 -16
  40. package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
  41. package/dist/chat/super-grouping/activity-timeline.js +0 -16
  42. package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
  43. package/dist/chat/tiptap-text.cjs +1 -17
  44. package/dist/chat/tiptap-text.cjs.map +1 -1
  45. package/dist/chat/tiptap-text.js +1 -17
  46. package/dist/chat/tiptap-text.js.map +1 -1
  47. package/dist/chat/use-athena-run-live.cjs +0 -15
  48. package/dist/chat/use-athena-run-live.cjs.map +1 -1
  49. package/dist/chat/use-athena-run-live.js +0 -15
  50. package/dist/chat/use-athena-run-live.js.map +1 -1
  51. package/dist/chat/use-statewire-approval-request.cjs +4 -16
  52. package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
  53. package/dist/chat/use-statewire-approval-request.d.ts +2 -0
  54. package/dist/chat/use-statewire-approval-request.js +4 -16
  55. package/dist/chat/use-statewire-approval-request.js.map +1 -1
  56. package/dist/chat-ui/composer/tiptap-composer.cjs +1 -16
  57. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
  58. package/dist/chat-ui/composer/tiptap-composer.js +1 -16
  59. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
  60. package/dist/chat-ui/index.cjs +0 -16
  61. package/dist/chat-ui/index.cjs.map +1 -1
  62. package/dist/chat-ui/index.js +0 -16
  63. package/dist/chat-ui/index.js.map +1 -1
  64. package/dist/chat-ui/mentions/mention-chip.cjs +1 -16
  65. package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
  66. package/dist/chat-ui/mentions/mention-chip.js +1 -16
  67. package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
  68. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs +4 -6
  69. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs.map +1 -1
  70. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js +4 -6
  71. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js.map +1 -1
  72. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +2 -9
  73. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -1
  74. package/dist/chat-ui/mentions/suggestions/data/sources/index.js +2 -9
  75. package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
  76. package/dist/chat-ui/messages/message-components.cjs +5 -19
  77. package/dist/chat-ui/messages/message-components.cjs.map +1 -1
  78. package/dist/chat-ui/messages/message-components.js +5 -19
  79. package/dist/chat-ui/messages/message-components.js.map +1 -1
  80. package/dist/chat-ui/messages/runtime-message.cjs +1 -16
  81. package/dist/chat-ui/messages/runtime-message.cjs.map +1 -1
  82. package/dist/chat-ui/messages/runtime-message.js +1 -16
  83. package/dist/chat-ui/messages/runtime-message.js.map +1 -1
  84. package/dist/chat-ui/messages/statewire-continue-run.cjs +3 -15
  85. package/dist/chat-ui/messages/statewire-continue-run.cjs.map +1 -1
  86. package/dist/chat-ui/messages/statewire-continue-run.js +3 -15
  87. package/dist/chat-ui/messages/statewire-continue-run.js.map +1 -1
  88. package/dist/chat-ui/messages/user-edit-composer.cjs +0 -16
  89. package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
  90. package/dist/chat-ui/messages/user-edit-composer.js +0 -16
  91. package/dist/chat-ui/messages/user-edit-composer.js.map +1 -1
  92. package/dist/chat-ui/messages/wake-marker.cjs +1 -16
  93. package/dist/chat-ui/messages/wake-marker.cjs.map +1 -1
  94. package/dist/chat-ui/messages/wake-marker.js +1 -16
  95. package/dist/chat-ui/messages/wake-marker.js.map +1 -1
  96. package/dist/chat-ui/statewire.cjs +0 -16
  97. package/dist/chat-ui/statewire.cjs.map +1 -1
  98. package/dist/chat-ui/statewire.js +0 -16
  99. package/dist/chat-ui/statewire.js.map +1 -1
  100. package/dist/chat-ui/thread/statewire-history-edge.cjs +2 -17
  101. package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
  102. package/dist/chat-ui/thread/statewire-history-edge.js +2 -17
  103. package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
  104. package/dist/dictation/DictationStrip.cjs +2 -1
  105. package/dist/dictation/DictationStrip.cjs.map +1 -1
  106. package/dist/dictation/DictationStrip.d.ts +2 -0
  107. package/dist/dictation/DictationStrip.js +2 -1
  108. package/dist/dictation/DictationStrip.js.map +1 -1
  109. package/dist/dictation/dictation-engine.cjs.map +1 -1
  110. package/dist/dictation/dictation-engine.d.ts +8 -0
  111. package/dist/dictation/dictation-engine.js.map +1 -1
  112. package/dist/dictation/recorded-dictation-engine.cjs +153 -0
  113. package/dist/dictation/recorded-dictation-engine.cjs.map +1 -0
  114. package/dist/dictation/recorded-dictation-engine.d.ts +66 -0
  115. package/dist/dictation/recorded-dictation-engine.js +153 -0
  116. package/dist/dictation/recorded-dictation-engine.js.map +1 -0
  117. package/dist/dictation/use-athena-dictation-engine.cjs +64 -0
  118. package/dist/dictation/use-athena-dictation-engine.cjs.map +1 -0
  119. package/dist/dictation/use-athena-dictation-engine.d.ts +25 -0
  120. package/dist/dictation/use-athena-dictation-engine.js +64 -0
  121. package/dist/dictation/use-athena-dictation-engine.js.map +1 -0
  122. package/dist/dictation/use-dictation.cjs +17 -6
  123. package/dist/dictation/use-dictation.cjs.map +1 -1
  124. package/dist/dictation/use-dictation.d.ts +20 -4
  125. package/dist/dictation/use-dictation.js +17 -6
  126. package/dist/dictation/use-dictation.js.map +1 -1
  127. package/dist/index.cjs +28 -39
  128. package/dist/index.cjs.map +1 -1
  129. package/dist/index.d.ts +4 -1
  130. package/dist/index.js +10 -21
  131. package/dist/index.js.map +1 -1
  132. package/dist/packages/agent-runtime/src/edit-command.cjs.map +1 -1
  133. package/dist/packages/agent-runtime/src/edit-command.js.map +1 -1
  134. package/dist/packages/agent-runtime/src/errors.cjs +18 -0
  135. package/dist/packages/agent-runtime/src/errors.cjs.map +1 -1
  136. package/dist/packages/agent-runtime/src/errors.js +19 -1
  137. package/dist/packages/agent-runtime/src/errors.js.map +1 -1
  138. package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs +1 -0
  139. package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
  140. package/dist/packages/agent-runtime/src/generated/runconfig-contract.js +1 -0
  141. package/dist/packages/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
  142. package/dist/packages/agent-runtime/src/interrupts.cjs +61 -12
  143. package/dist/packages/agent-runtime/src/interrupts.cjs.map +1 -1
  144. package/dist/packages/agent-runtime/src/interrupts.js +61 -12
  145. package/dist/packages/agent-runtime/src/interrupts.js.map +1 -1
  146. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs +49 -0
  147. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
  148. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js +49 -0
  149. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -1
  150. package/dist/packages/agent-runtime/src/thread-status.js +1 -1
  151. package/dist/packages/agent-runtime/src/tool-metadata.cjs +1 -37
  152. package/dist/packages/agent-runtime/src/tool-metadata.cjs.map +1 -1
  153. package/dist/packages/agent-runtime/src/tool-metadata.js +1 -37
  154. package/dist/packages/agent-runtime/src/tool-metadata.js.map +1 -1
  155. package/dist/packages/agent-runtime/src/use-deep-agent-config.cjs +0 -1
  156. package/dist/packages/agent-runtime/src/use-deep-agent-config.cjs.map +1 -1
  157. package/dist/packages/agent-runtime/src/use-deep-agent-config.js +0 -1
  158. package/dist/packages/agent-runtime/src/use-deep-agent-config.js.map +1 -1
  159. package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
  160. package/dist/packages/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
  161. package/dist/packages/react/package.json.cjs +1 -1
  162. package/dist/packages/react/package.json.js +1 -1
  163. package/dist/provider/AthenaProvider.cjs +3 -17
  164. package/dist/provider/AthenaProvider.cjs.map +1 -1
  165. package/dist/provider/AthenaProvider.js +3 -17
  166. package/dist/provider/AthenaProvider.js.map +1 -1
  167. package/dist/runtime/statewire-lifecycle.cjs +0 -16
  168. package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
  169. package/dist/runtime/statewire-lifecycle.js +0 -16
  170. package/dist/runtime/statewire-lifecycle.js.map +1 -1
  171. package/dist/runtime/useAthenaStatewireRuntime.cjs +3 -17
  172. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
  173. package/dist/runtime/useAthenaStatewireRuntime.js +3 -17
  174. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
  175. package/dist/threads/statewire-thread-list.cjs +4 -17
  176. package/dist/threads/statewire-thread-list.cjs.map +1 -1
  177. package/dist/threads/statewire-thread-list.js +4 -17
  178. package/dist/threads/statewire-thread-list.js.map +1 -1
  179. package/dist/threads/use-rest-conversation-history.cjs +2 -16
  180. package/dist/threads/use-rest-conversation-history.cjs.map +1 -1
  181. package/dist/threads/use-rest-conversation-history.js +2 -16
  182. package/dist/threads/use-rest-conversation-history.js.map +1 -1
  183. package/dist/threads/use-statewire-conversation-history.cjs +2 -16
  184. package/dist/threads/use-statewire-conversation-history.cjs.map +1 -1
  185. package/dist/threads/use-statewire-conversation-history.js +2 -16
  186. package/dist/threads/use-statewire-conversation-history.js.map +1 -1
  187. package/dist/toolkits/index.cjs +0 -7
  188. package/dist/toolkits/index.cjs.map +1 -1
  189. package/dist/toolkits/index.d.ts +0 -2
  190. package/dist/toolkits/index.js +0 -7
  191. package/dist/toolkits/index.js.map +1 -1
  192. package/dist/tools/index.cjs +4 -20
  193. package/dist/tools/index.cjs.map +1 -1
  194. package/dist/tools/index.js +1 -17
  195. package/dist/tools/index.js.map +1 -1
  196. package/dist/tools/misc-tool-uis.cjs +2 -17
  197. package/dist/tools/misc-tool-uis.cjs.map +1 -1
  198. package/dist/tools/misc-tool-uis.js +2 -17
  199. package/dist/tools/misc-tool-uis.js.map +1 -1
  200. package/dist/tools/primitives.cjs +1 -16
  201. package/dist/tools/primitives.cjs.map +1 -1
  202. package/dist/tools/primitives.js +1 -16
  203. package/dist/tools/primitives.js.map +1 -1
  204. package/dist/tools/tool-fallback.cjs +2 -17
  205. package/dist/tools/tool-fallback.cjs.map +1 -1
  206. package/dist/tools/tool-fallback.js +2 -17
  207. package/dist/tools/tool-fallback.js.map +1 -1
  208. package/dist/tools/voice-update-tool-ui.cjs +1 -17
  209. package/dist/tools/voice-update-tool-ui.cjs.map +1 -1
  210. package/dist/tools/voice-update-tool-ui.js +1 -17
  211. package/dist/tools/voice-update-tool-ui.js.map +1 -1
  212. package/package.json +1 -1
  213. package/dist/node_modules/qrcode-generator/dist/qrcode.cjs +0 -32
  214. package/dist/node_modules/qrcode-generator/dist/qrcode.cjs.map +0 -1
  215. package/dist/node_modules/qrcode-generator/dist/qrcode.js +0 -31
  216. package/dist/node_modules/qrcode-generator/dist/qrcode.js.map +0 -1
  217. package/dist/node_modules/zod/v4/classic/errors.cjs +0 -44
  218. package/dist/node_modules/zod/v4/classic/errors.cjs.map +0 -1
  219. package/dist/node_modules/zod/v4/classic/errors.js +0 -44
  220. package/dist/node_modules/zod/v4/classic/errors.js.map +0 -1
  221. package/dist/node_modules/zod/v4/classic/iso.cjs +0 -43
  222. package/dist/node_modules/zod/v4/classic/iso.cjs.map +0 -1
  223. package/dist/node_modules/zod/v4/classic/iso.js +0 -43
  224. package/dist/node_modules/zod/v4/classic/iso.js.map +0 -1
  225. package/dist/node_modules/zod/v4/classic/parse.cjs +0 -29
  226. package/dist/node_modules/zod/v4/classic/parse.cjs.map +0 -1
  227. package/dist/node_modules/zod/v4/classic/parse.js +0 -29
  228. package/dist/node_modules/zod/v4/classic/parse.js.map +0 -1
  229. package/dist/node_modules/zod/v4/classic/schemas.cjs +0 -871
  230. package/dist/node_modules/zod/v4/classic/schemas.cjs.map +0 -1
  231. package/dist/node_modules/zod/v4/classic/schemas.js +0 -871
  232. package/dist/node_modules/zod/v4/classic/schemas.js.map +0 -1
  233. package/dist/node_modules/zod/v4/core/api.cjs +0 -570
  234. package/dist/node_modules/zod/v4/core/api.cjs.map +0 -1
  235. package/dist/node_modules/zod/v4/core/api.js +0 -570
  236. package/dist/node_modules/zod/v4/core/api.js.map +0 -1
  237. package/dist/node_modules/zod/v4/core/checks.cjs +0 -411
  238. package/dist/node_modules/zod/v4/core/checks.cjs.map +0 -1
  239. package/dist/node_modules/zod/v4/core/checks.js +0 -411
  240. package/dist/node_modules/zod/v4/core/checks.js.map +0 -1
  241. package/dist/node_modules/zod/v4/core/core.cjs +0 -77
  242. package/dist/node_modules/zod/v4/core/core.cjs.map +0 -1
  243. package/dist/node_modules/zod/v4/core/core.js +0 -77
  244. package/dist/node_modules/zod/v4/core/core.js.map +0 -1
  245. package/dist/node_modules/zod/v4/core/doc.cjs +0 -38
  246. package/dist/node_modules/zod/v4/core/doc.cjs.map +0 -1
  247. package/dist/node_modules/zod/v4/core/doc.js +0 -38
  248. package/dist/node_modules/zod/v4/core/doc.js.map +0 -1
  249. package/dist/node_modules/zod/v4/core/errors.cjs +0 -76
  250. package/dist/node_modules/zod/v4/core/errors.cjs.map +0 -1
  251. package/dist/node_modules/zod/v4/core/errors.js +0 -76
  252. package/dist/node_modules/zod/v4/core/errors.js.map +0 -1
  253. package/dist/node_modules/zod/v4/core/json-schema-processors.cjs +0 -312
  254. package/dist/node_modules/zod/v4/core/json-schema-processors.cjs.map +0 -1
  255. package/dist/node_modules/zod/v4/core/json-schema-processors.js +0 -312
  256. package/dist/node_modules/zod/v4/core/json-schema-processors.js.map +0 -1
  257. package/dist/node_modules/zod/v4/core/parse.cjs +0 -96
  258. package/dist/node_modules/zod/v4/core/parse.cjs.map +0 -1
  259. package/dist/node_modules/zod/v4/core/parse.js +0 -96
  260. package/dist/node_modules/zod/v4/core/parse.js.map +0 -1
  261. package/dist/node_modules/zod/v4/core/regexes.cjs +0 -86
  262. package/dist/node_modules/zod/v4/core/regexes.cjs.map +0 -1
  263. package/dist/node_modules/zod/v4/core/regexes.js +0 -86
  264. package/dist/node_modules/zod/v4/core/regexes.js.map +0 -1
  265. package/dist/node_modules/zod/v4/core/registries.cjs +0 -52
  266. package/dist/node_modules/zod/v4/core/registries.cjs.map +0 -1
  267. package/dist/node_modules/zod/v4/core/registries.js +0 -52
  268. package/dist/node_modules/zod/v4/core/registries.js.map +0 -1
  269. package/dist/node_modules/zod/v4/core/schemas.cjs +0 -1412
  270. package/dist/node_modules/zod/v4/core/schemas.cjs.map +0 -1
  271. package/dist/node_modules/zod/v4/core/schemas.js +0 -1413
  272. package/dist/node_modules/zod/v4/core/schemas.js.map +0 -1
  273. package/dist/node_modules/zod/v4/core/to-json-schema.cjs +0 -370
  274. package/dist/node_modules/zod/v4/core/to-json-schema.cjs.map +0 -1
  275. package/dist/node_modules/zod/v4/core/to-json-schema.js +0 -370
  276. package/dist/node_modules/zod/v4/core/to-json-schema.js.map +0 -1
  277. package/dist/node_modules/zod/v4/core/util.cjs +0 -444
  278. package/dist/node_modules/zod/v4/core/util.cjs.map +0 -1
  279. package/dist/node_modules/zod/v4/core/util.js +0 -444
  280. package/dist/node_modules/zod/v4/core/util.js.map +0 -1
  281. package/dist/node_modules/zod/v4/core/versions.cjs +0 -9
  282. package/dist/node_modules/zod/v4/core/versions.cjs.map +0 -1
  283. package/dist/node_modules/zod/v4/core/versions.js +0 -9
  284. package/dist/node_modules/zod/v4/core/versions.js.map +0 -1
  285. package/dist/packages/agent-runtime/src/thread-handoff.cjs +0 -85
  286. package/dist/packages/agent-runtime/src/thread-handoff.cjs.map +0 -1
  287. package/dist/packages/agent-runtime/src/thread-handoff.js +0 -85
  288. package/dist/packages/agent-runtime/src/thread-handoff.js.map +0 -1
@@ -3,25 +3,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const react = require("@assistant-ui/react");
5
5
  const reactStatewire = require("@assistant-ui/react-statewire");
6
- require("../../packages/agent-runtime/src/generated/runconfig-contract.cjs");
7
- require("react");
8
- require("@assistant-ui/tap");
9
- require("statewire");
10
- const errors = require("../../packages/agent-runtime/src/errors.cjs");
11
- require("../../packages/agent-runtime/src/statewire-suspended.cjs");
12
- require("../../packages/agent-runtime/src/conversation-list.cjs");
13
- require("@tanstack/react-query");
14
- require("../../packages/agent-runtime/src/statewire-state.cjs");
6
+ const continuePill = require("./continue-pill.cjs");
7
+ const runtimeMessage = require("./runtime-message.cjs");
15
8
  const messages = require("../../packages/agent-runtime/src/messages.cjs");
16
9
  const threadExtras = require("../../packages/agent-runtime/src/thread-extras.cjs");
17
- require("@assistant-ui/store");
18
- require("../../packages/agent-runtime/src/quota-safe-local-storage-session.cjs");
19
- require("../../packages/agent-runtime/src/statewire-attach-observer.cjs");
20
10
  const threadStatus = require("../../packages/agent-runtime/src/thread-status.cjs");
11
+ const errors = require("../../packages/agent-runtime/src/errors.cjs");
21
12
  const runtimeMessages = require("../../packages/agent-runtime/src/runtime-messages.cjs");
22
- require("../../packages/agent-runtime/src/thread-handoff.cjs");
23
- const continuePill = require("./continue-pill.cjs");
24
- const runtimeMessage = require("./runtime-message.cjs");
25
13
  const cnfast = require("cnfast");
26
14
  function notifyContinue(onContinue, context) {
27
15
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"statewire-continue-run.cjs","sources":["../../../src/chat-ui/messages/statewire-continue-run.tsx"],"sourcesContent":["import { type ThreadMessage, useAuiState } from \"@assistant-ui/react\";\nimport {\n useStatewireRuns,\n useStatewireSendCommand,\n} from \"@assistant-ui/react-statewire\";\nimport {\n ATHENA_RUN_MARKER_CANCELLED,\n ATHENA_RUN_MARKER_FAILED,\n type AthenaRuntimeMessage,\n type AthenaRuntimeMessageKind,\n type DeepAgentThreadStatus,\n hasStatewireThreadExtras,\n readRetryableRunRefusal,\n readRunMarkerFromSourceMessages,\n readRuntimeMessageFromSourceMessages,\n useDeepAgentThreadStatus,\n} from \"@athenaintel/agent-runtime\";\nimport type { ReactElement, ReactNode } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport { ContinuePill } from \"./continue-pill\";\nimport { RuntimeMessageCard } from \"./runtime-message\";\n\nexport interface StatewireContinueRunButtonProps {\n /**\n * Also offer Continue while the thread projects `ready`. An old snapshot\n * can report a resting thread whose last persisted ending is still\n * continuable; the marker row that mounts this button knows that.\n */\n allowReadyFallback?: boolean;\n /**\n * Called as the continue dispatches (after the pill's exit animation),\n * immediately before the command queues — the host's telemetry hook.\n * Receives the settled status and live run id the user acted on. Queueing\n * publishes the command's first update synchronously, so a hook that pairs\n * this click with that update must run first. Best-effort: a throwing hook\n * is swallowed and never blocks the dispatch.\n */\n onContinue?: (context: { status: DeepAgentThreadStatus; runId: string | null }) => void;\n}\n\nfunction notifyContinue(\n onContinue: StatewireContinueRunButtonProps[\"onContinue\"],\n context: { status: DeepAgentThreadStatus; runId: string | null },\n): void {\n try {\n onContinue?.(context);\n } catch (error) {\n console.debug(\"[StatewireContinueRunButton] onContinue hook failed:\", error);\n }\n}\n\n/**\n * Dispatches the bare `run/continue` for the live Statewire thread — the\n * heal-then-continue recovery for stopped, errored, and pod-drained runs. The\n * command is exactly what the library's `onResume` emits, so it inherits the\n * optimistic running-flip (the pill unmounts once the dispatch is accepted)\n * and routes rejections to the runtime's shared `onError` policy.\n *\n * Gated on the LIVE thread status, never on the persisted marker: markers live\n * in the transcript forever, while continuability is a property of the\n * current run state. Requires `capabilities.continue` on the host thread and\n * a statewire aui scope (throws outside one, like every `useStatewire*` hook).\n */\nexport function StatewireContinueRunButton({\n allowReadyFallback = false,\n onContinue,\n}: StatewireContinueRunButtonProps = {}): ReactElement | null {\n const status = useDeepAgentThreadStatus();\n const { runId } = useStatewireRuns();\n const sendCommand = useStatewireSendCommand();\n\n const isSettled = status === \"stopped\" || status === \"error\";\n if (!isSettled && !(allowReadyFallback && status === \"ready\")) return null;\n\n return (\n <ContinuePill\n ariaLabel=\"Continue this run from where it stopped\"\n dataTestId=\"statewire-continue-run\"\n onClick={() => {\n notifyContinue(onContinue, { status, runId });\n sendCommand({\n type: \"run/continue\",\n ...(runId !== null && { runId }),\n });\n }}\n />\n );\n}\n\nexport interface StatewireContinueRunAffordanceProps {\n /** Forwarded to the mounted `StatewireContinueRunButton`. */\n onContinue?: StatewireContinueRunButtonProps[\"onContinue\"];\n}\n\n/**\n * Recovery affordance for the latest persisted stopped/failed run marker,\n * for the `runtimeMessageAction` slot of `createAssistantMessage`.\n *\n * Marker messages remain in history forever, so only the current last message\n * may continue. The extras guard keeps Statewire hooks out of read-only or\n * legacy runtimes where they would throw.\n */\nexport function StatewireContinueRunAffordance({\n onContinue,\n}: StatewireContinueRunAffordanceProps = {}): ReactElement | null {\n const messageId = useAuiState((state) => state.message.id);\n const lastMessageId = useAuiState(\n (state) => state.thread.messages.at(-1)?.id,\n );\n const runMarker = useAuiState(\n (state) => readRunMarkerFromSourceMessages(state.message)?.marker,\n );\n const threadExtras = useAuiState((state) => state.thread.extras);\n\n const isContinuableMarker =\n runMarker === ATHENA_RUN_MARKER_CANCELLED ||\n runMarker === ATHENA_RUN_MARKER_FAILED;\n if (messageId !== lastMessageId || !isContinuableMarker) return null;\n if (!hasStatewireThreadExtras(threadExtras)) return null;\n\n return (\n <div className=\"flex w-full justify-center py-1\">\n <StatewireContinueRunButton allowReadyFallback onContinue={onContinue} />\n </div>\n );\n}\n\n/** The ending a transcript row paints, as the footer needs to know it. */\nexport interface StatewireTailEnding {\n kind: AthenaRuntimeMessageKind;\n /** A send-now cancellation: kept in the data, painted as nothing. */\n silent: boolean;\n}\n\n/** Reads the runtime ending (marker or handoff) a message row renders, if any. */\nexport type ReadStatewireTailEnding = (message: ThreadMessage) => StatewireTailEnding | null;\n\nconst readRuntimeTailEnding: ReadStatewireTailEnding = (message) => {\n const runtime = readRuntimeMessageFromSourceMessages(message);\n return runtime ? { kind: runtime.kind, silent: runtime.silent } : null;\n};\n\nexport interface StatewireRunEndedFooterActionsContext {\n /** The live settled status the footer describes. */\n status: \"stopped\" | \"error\";\n /** The ending the tail row renders, when it renders one (silent markers read as none). */\n tailEndingKind: AthenaRuntimeMessageKind | null;\n}\n\nexport interface StatewireRunEndedFooterProps {\n /** Merged onto the recovery card's default classes. */\n className?: string;\n /**\n * How the host's assistant row paints the transcript tail. The default reads\n * the runtime ending only (a persisted marker or handoff); a host whose row\n * also styles an assistant-ui error status as a failed ending passes a\n * reader that reports it, so the footer never doubles that row's recovery.\n */\n readTailEnding?: ReadStatewireTailEnding;\n /**\n * The recovery controls. The default renders Continue unless the tail row\n * (a marker of another kind) already carries it; hosts with richer recovery\n * (Retry + Continue) supply their own and decide ownership from the context.\n */\n renderActions?: (context: StatewireRunEndedFooterActionsContext) => ReactNode;\n /** Forwarded to the default Continue action (unused when `renderActions` is set). */\n onContinue?: StatewireContinueRunButtonProps[\"onContinue\"];\n}\n\n/**\n * Recovery row for a settled run whose persisted ending is no longer the\n * transcript tail — rendered after the messages (`renderMessages`). Rewinds,\n * compaction, and older snapshots can all leave the durable run state\n * recoverable without a marker row that owns the action. The failure copy\n * comes from the replicated run error (`runs.error.message`) — the same text\n * the marker would have carried. A RETRYABLE refusal recorded there\n * (`readRetryableRunRefusal`: a closing host refused to start the queued\n * work, which stays in its lane and re-dispatches on the thread's next\n * placement) is not a failure of the run and paints as a pause, keeping\n * Continue as the manual way on. Renders nothing on legacy (non-statewire)\n * threads.\n */\nexport function StatewireRunEndedFooter({\n className,\n readTailEnding,\n renderActions,\n onContinue,\n}: StatewireRunEndedFooterProps = {}): ReactElement | null {\n const threadExtras = useAuiState((state) => state.thread.extras);\n if (!hasStatewireThreadExtras(threadExtras)) return null;\n return (\n <StatewireRunEndedFooterContent\n className={className}\n readTailEnding={readTailEnding}\n renderActions={renderActions}\n onContinue={onContinue}\n />\n );\n}\n\nfunction StatewireRunEndedFooterContent({\n className,\n readTailEnding = readRuntimeTailEnding,\n renderActions,\n onContinue,\n}: StatewireRunEndedFooterProps): ReactElement | null {\n const status = useDeepAgentThreadStatus();\n const { error } = useStatewireRuns();\n // The reader builds a fresh object per call; select primitives so the\n // snapshots stay stable under `Object.is` comparison.\n const tailEndingKind = useAuiState((state) => {\n const last = state.thread.messages.at(-1);\n return last ? (readTailEnding(last)?.kind ?? null) : null;\n });\n const tailEndingSilent = useAuiState((state) => {\n const last = state.thread.messages.at(-1);\n return last ? (readTailEnding(last)?.silent ?? false) : false;\n });\n const transcriptEmpty = useAuiState((state) => state.thread.messages.length === 0);\n\n if (status !== \"stopped\" && status !== \"error\") return null;\n\n // A user stop that retracted the only turn (its text went back to the\n // composer) settles as stopped over an empty transcript: there is no\n // conversation to continue or retry, so the thread reads as fresh.\n if (status === \"stopped\" && transcriptEmpty) return null;\n\n // A send-now promotion intentionally cancels the superseded run without a\n // visible ending. Statewire can briefly report that cancellation as stopped;\n // preserve the silent contract instead of presenting a false recovery state.\n // A genuine error still wins and remains recoverable below.\n if (status === \"stopped\" && tailEndingSilent) return null;\n\n const tailRendersEnding = tailEndingKind !== null && !tailEndingSilent;\n const tailMatchesStatus =\n status === \"error\"\n ? tailEndingKind === \"failed\"\n : tailEndingKind === \"stopped\" || tailEndingKind === \"paused\";\n if (tailRendersEnding && tailMatchesStatus) return null;\n\n // An older run's marker at the tail still carries its own Continue (the\n // marker-row affordance); a handoff banner does not.\n const tailOwnsContinue = tailRendersEnding && tailEndingKind !== \"handoff\";\n const action = renderActions ? (\n renderActions({ status, tailEndingKind: tailRendersEnding ? tailEndingKind : null })\n ) : tailOwnsContinue ? undefined : (\n <StatewireContinueRunButton onContinue={onContinue} />\n );\n const refusal = status === \"error\" ? readRetryableRunRefusal(error) : null;\n const message: AthenaRuntimeMessage =\n status === \"error\"\n ? refusal\n ? {\n kind: \"paused\",\n reason: refusal.code,\n severity: \"info\",\n title: \"Waiting for a server update\",\n detail:\n \"The server hosting this chat is restarting, so the queued message could not start yet. It runs on a ready server automatically.\",\n text: undefined,\n silent: false,\n isSoleSourceMessage: true,\n }\n : {\n kind: \"failed\",\n reason: \"error\",\n severity: \"error\",\n title: \"Run failed\",\n detail: undefined,\n text: error?.message ? `⚠️ The run failed: ${error.message}` : undefined,\n silent: false,\n isSoleSourceMessage: true,\n }\n : {\n kind: \"stopped\",\n reason: undefined,\n severity: \"info\",\n title: \"Conversation stopped\",\n detail: undefined,\n text: undefined,\n silent: false,\n isSoleSourceMessage: true,\n };\n\n return (\n <RuntimeMessageCard\n data-testid=\"statewire-run-ended-footer\"\n message={message}\n action={action}\n className={cn(\"mx-auto max-w-[95%]\", className)}\n />\n );\n}\n"],"names":["useDeepAgentThreadStatus","useStatewireRuns","useStatewireSendCommand","jsx","ContinuePill","useAuiState","readRunMarkerFromSourceMessages","threadExtras","ATHENA_RUN_MARKER_CANCELLED","ATHENA_RUN_MARKER_FAILED","hasStatewireThreadExtras","readRuntimeMessageFromSourceMessages","readRetryableRunRefusal","RuntimeMessageCard","cn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAS,eACP,YACA,SACM;AACN,MAAI;AACF,6CAAa;AAAA,EACf,SAAS,OAAO;AACd,YAAQ,MAAM,wDAAwD,KAAK;AAAA,EAC7E;AACF;AAcO,SAAS,2BAA2B;AAAA,EACzC,qBAAqB;AAAA,EACrB;AACF,IAAqC,IAAyB;AAC5D,QAAM,SAASA,aAAAA,yBAAA;AACf,QAAM,EAAE,MAAA,IAAUC,gCAAA;AAClB,QAAM,cAAcC,eAAAA,wBAAA;AAEpB,QAAM,YAAY,WAAW,aAAa,WAAW;AACrD,MAAI,CAAC,aAAa,EAAE,sBAAsB,WAAW,SAAU,QAAO;AAEtE,SACEC,2BAAAA;AAAAA,IAACC,aAAAA;AAAAA,IAAA;AAAA,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,KAAK,IAAI;AACtE,QAAM,UACJ,WAAW,UACP,UACE;AAAA,IACE,MAAM;AAAA,IACN,QAAQ,QAAQ;AAAA,IAChB,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QACE;AAAA,IACF,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,qBAAqB;AAAA,EAAA,IAEvB;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAM,+BAAO,WAAU,sBAAsB,MAAM,OAAO,KAAK;AAAA,IAC/D,QAAQ;AAAA,IACR,qBAAqB;AAAA,EAAA,IAEzB;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,qBAAqB;AAAA,EAAA;AAG7B,SACET,2BAAAA;AAAAA,IAACU,eAAAA;AAAAA,IAAA;AAAA,MACC,eAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA,WAAWC,OAAAA,GAAG,uBAAuB,SAAS;AAAA,IAAA;AAAA,EAAA;AAGpD;;;;"}
1
+ {"version":3,"file":"statewire-continue-run.cjs","sources":["../../../src/chat-ui/messages/statewire-continue-run.tsx"],"sourcesContent":["import { type ThreadMessage, useAuiState } from \"@assistant-ui/react\";\nimport {\n useStatewireRuns,\n useStatewireSendCommand,\n} from \"@assistant-ui/react-statewire\";\nimport {\n ATHENA_RUN_MARKER_CANCELLED,\n ATHENA_RUN_MARKER_FAILED,\n type AthenaRuntimeMessage,\n type AthenaRuntimeMessageKind,\n type DeepAgentThreadStatus,\n hasStatewireThreadExtras,\n readRetryableRunRefusal,\n readRunMarkerFromSourceMessages,\n readRuntimeMessageFromSourceMessages,\n useDeepAgentThreadStatus,\n} from \"@athenaintel/agent-runtime\";\nimport type { ReactElement, ReactNode } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport { ContinuePill } from \"./continue-pill\";\nimport { RuntimeMessageCard } from \"./runtime-message\";\n\nexport interface StatewireContinueRunButtonProps {\n /**\n * Also offer Continue while the thread projects `ready`. An old snapshot\n * can report a resting thread whose last persisted ending is still\n * continuable; the marker row that mounts this button knows that.\n */\n allowReadyFallback?: boolean;\n /**\n * Called as the continue dispatches (after the pill's exit animation),\n * immediately before the command queues — the host's telemetry hook.\n * Receives the settled status and live run id the user acted on. Queueing\n * publishes the command's first update synchronously, so a hook that pairs\n * this click with that update must run first. Best-effort: a throwing hook\n * is swallowed and never blocks the dispatch.\n */\n onContinue?: (context: { status: DeepAgentThreadStatus; runId: string | null }) => void;\n}\n\nfunction notifyContinue(\n onContinue: StatewireContinueRunButtonProps[\"onContinue\"],\n context: { status: DeepAgentThreadStatus; runId: string | null },\n): void {\n try {\n onContinue?.(context);\n } catch (error) {\n console.debug(\"[StatewireContinueRunButton] onContinue hook failed:\", error);\n }\n}\n\n/**\n * Dispatches the bare `run/continue` for the live Statewire thread — the\n * heal-then-continue recovery for stopped, errored, and pod-drained runs. The\n * command is exactly what the library's `onResume` emits, so it inherits the\n * optimistic running-flip (the pill unmounts once the dispatch is accepted)\n * and routes rejections to the runtime's shared `onError` policy.\n *\n * Gated on the LIVE thread status, never on the persisted marker: markers live\n * in the transcript forever, while continuability is a property of the\n * current run state. Requires `capabilities.continue` on the host thread and\n * a statewire aui scope (throws outside one, like every `useStatewire*` hook).\n */\nexport function StatewireContinueRunButton({\n allowReadyFallback = false,\n onContinue,\n}: StatewireContinueRunButtonProps = {}): ReactElement | null {\n const status = useDeepAgentThreadStatus();\n const { runId } = useStatewireRuns();\n const sendCommand = useStatewireSendCommand();\n\n const isSettled = status === \"stopped\" || status === \"error\";\n if (!isSettled && !(allowReadyFallback && status === \"ready\")) return null;\n\n return (\n <ContinuePill\n ariaLabel=\"Continue this run from where it stopped\"\n dataTestId=\"statewire-continue-run\"\n onClick={() => {\n notifyContinue(onContinue, { status, runId });\n sendCommand({\n type: \"run/continue\",\n ...(runId !== null && { runId }),\n });\n }}\n />\n );\n}\n\nexport interface StatewireContinueRunAffordanceProps {\n /** Forwarded to the mounted `StatewireContinueRunButton`. */\n onContinue?: StatewireContinueRunButtonProps[\"onContinue\"];\n}\n\n/**\n * Recovery affordance for the latest persisted stopped/failed run marker,\n * for the `runtimeMessageAction` slot of `createAssistantMessage`.\n *\n * Marker messages remain in history forever, so only the current last message\n * may continue. The extras guard keeps Statewire hooks out of read-only or\n * legacy runtimes where they would throw.\n */\nexport function StatewireContinueRunAffordance({\n onContinue,\n}: StatewireContinueRunAffordanceProps = {}): ReactElement | null {\n const messageId = useAuiState((state) => state.message.id);\n const lastMessageId = useAuiState(\n (state) => state.thread.messages.at(-1)?.id,\n );\n const runMarker = useAuiState(\n (state) => readRunMarkerFromSourceMessages(state.message)?.marker,\n );\n const threadExtras = useAuiState((state) => state.thread.extras);\n\n const isContinuableMarker =\n runMarker === ATHENA_RUN_MARKER_CANCELLED ||\n runMarker === ATHENA_RUN_MARKER_FAILED;\n if (messageId !== lastMessageId || !isContinuableMarker) return null;\n if (!hasStatewireThreadExtras(threadExtras)) return null;\n\n return (\n <div className=\"flex w-full justify-center py-1\">\n <StatewireContinueRunButton allowReadyFallback onContinue={onContinue} />\n </div>\n );\n}\n\n/** The ending a transcript row paints, as the footer needs to know it. */\nexport interface StatewireTailEnding {\n kind: AthenaRuntimeMessageKind;\n /** A send-now cancellation: kept in the data, painted as nothing. */\n silent: boolean;\n}\n\n/** Reads the runtime ending (marker or handoff) a message row renders, if any. */\nexport type ReadStatewireTailEnding = (message: ThreadMessage) => StatewireTailEnding | null;\n\nconst readRuntimeTailEnding: ReadStatewireTailEnding = (message) => {\n const runtime = readRuntimeMessageFromSourceMessages(message);\n return runtime ? { kind: runtime.kind, silent: runtime.silent } : null;\n};\n\nexport interface StatewireRunEndedFooterActionsContext {\n /** The live settled status the footer describes. */\n status: \"stopped\" | \"error\";\n /** The ending the tail row renders, when it renders one (silent markers read as none). */\n tailEndingKind: AthenaRuntimeMessageKind | null;\n}\n\nexport interface StatewireRunEndedFooterProps {\n /** Merged onto the recovery card's default classes. */\n className?: string;\n /**\n * How the host's assistant row paints the transcript tail. The default reads\n * the runtime ending only (a persisted marker or handoff); a host whose row\n * also styles an assistant-ui error status as a failed ending passes a\n * reader that reports it, so the footer never doubles that row's recovery.\n */\n readTailEnding?: ReadStatewireTailEnding;\n /**\n * The recovery controls. The default renders Continue unless the tail row\n * (a marker of another kind) already carries it; hosts with richer recovery\n * (Retry + Continue) supply their own and decide ownership from the context.\n */\n renderActions?: (context: StatewireRunEndedFooterActionsContext) => ReactNode;\n /** Forwarded to the default Continue action (unused when `renderActions` is set). */\n onContinue?: StatewireContinueRunButtonProps[\"onContinue\"];\n}\n\n/**\n * Recovery row for a settled run whose persisted ending is no longer the\n * transcript tail — rendered after the messages (`renderMessages`). Rewinds,\n * compaction, and older snapshots can all leave the durable run state\n * recoverable without a marker row that owns the action. The failure copy\n * comes from the replicated run error (`runs.error.message`) — the same text\n * the marker would have carried. A RETRYABLE refusal recorded there\n * (`readRetryableRunRefusal`: a closing host refused to start the queued\n * work, which stays in its lane and re-dispatches on the thread's next\n * placement) is not a failure of the run and paints as a pause, keeping\n * Continue as the manual way on. Renders nothing on legacy (non-statewire)\n * threads.\n */\nexport function StatewireRunEndedFooter({\n className,\n readTailEnding,\n renderActions,\n onContinue,\n}: StatewireRunEndedFooterProps = {}): ReactElement | null {\n const threadExtras = useAuiState((state) => state.thread.extras);\n if (!hasStatewireThreadExtras(threadExtras)) return null;\n return (\n <StatewireRunEndedFooterContent\n className={className}\n readTailEnding={readTailEnding}\n renderActions={renderActions}\n onContinue={onContinue}\n />\n );\n}\n\nfunction StatewireRunEndedFooterContent({\n className,\n readTailEnding = readRuntimeTailEnding,\n renderActions,\n onContinue,\n}: StatewireRunEndedFooterProps): ReactElement | null {\n const status = useDeepAgentThreadStatus();\n const { error } = useStatewireRuns();\n // The reader builds a fresh object per call; select primitives so the\n // snapshots stay stable under `Object.is` comparison.\n const tailEndingKind = useAuiState((state) => {\n const last = state.thread.messages.at(-1);\n return last ? (readTailEnding(last)?.kind ?? null) : null;\n });\n const tailEndingSilent = useAuiState((state) => {\n const last = state.thread.messages.at(-1);\n return last ? (readTailEnding(last)?.silent ?? false) : false;\n });\n const transcriptEmpty = useAuiState((state) => state.thread.messages.length === 0);\n\n if (status !== \"stopped\" && status !== \"error\") return null;\n\n // A user stop that retracted the only turn (its text went back to the\n // composer) settles as stopped over an empty transcript: there is no\n // conversation to continue or retry, so the thread reads as fresh.\n if (status === \"stopped\" && transcriptEmpty) return null;\n\n // A send-now promotion intentionally cancels the superseded run without a\n // visible ending. Statewire can briefly report that cancellation as stopped;\n // preserve the silent contract instead of presenting a false recovery state.\n // A genuine error still wins and remains recoverable below.\n if (status === \"stopped\" && tailEndingSilent) return null;\n\n const tailRendersEnding = tailEndingKind !== null && !tailEndingSilent;\n const tailMatchesStatus =\n status === \"error\"\n ? tailEndingKind === \"failed\"\n : tailEndingKind === \"stopped\" || tailEndingKind === \"paused\";\n if (tailRendersEnding && tailMatchesStatus) return null;\n\n // An older run's marker at the tail still carries its own Continue (the\n // marker-row affordance); a handoff banner does not.\n const tailOwnsContinue = tailRendersEnding && tailEndingKind !== \"handoff\";\n const action = renderActions ? (\n renderActions({ status, tailEndingKind: tailRendersEnding ? tailEndingKind : null })\n ) : tailOwnsContinue ? undefined : (\n <StatewireContinueRunButton onContinue={onContinue} />\n );\n const refusal = status === \"error\" ? readRetryableRunRefusal(error) : null;\n const message: AthenaRuntimeMessage =\n status === \"error\"\n ? refusal\n ? {\n kind: \"paused\",\n reason: refusal.code,\n severity: \"info\",\n title: \"Waiting for a server update\",\n detail:\n \"The server hosting this chat is restarting, so the queued message could not start yet. It runs on a ready server automatically.\",\n text: undefined,\n silent: false,\n isSoleSourceMessage: true,\n }\n : {\n kind: \"failed\",\n reason: \"error\",\n severity: \"error\",\n title: \"Run failed\",\n detail: undefined,\n text: error?.message ? `⚠️ The run failed: ${error.message}` : undefined,\n silent: false,\n isSoleSourceMessage: true,\n }\n : {\n kind: \"stopped\",\n reason: undefined,\n severity: \"info\",\n title: \"Conversation stopped\",\n detail: undefined,\n text: undefined,\n silent: false,\n isSoleSourceMessage: true,\n };\n\n return (\n <RuntimeMessageCard\n data-testid=\"statewire-run-ended-footer\"\n message={message}\n action={action}\n className={cn(\"mx-auto max-w-[95%]\", className)}\n />\n );\n}\n"],"names":["useDeepAgentThreadStatus","useStatewireRuns","useStatewireSendCommand","jsx","ContinuePill","useAuiState","readRunMarkerFromSourceMessages","threadExtras","ATHENA_RUN_MARKER_CANCELLED","ATHENA_RUN_MARKER_FAILED","hasStatewireThreadExtras","readRuntimeMessageFromSourceMessages","readRetryableRunRefusal","RuntimeMessageCard","cn"],"mappings":";;;;;;;;;;;;;AAwCA,SAAS,eACP,YACA,SACM;AACN,MAAI;AACF,6CAAa;AAAA,EACf,SAAS,OAAO;AACd,YAAQ,MAAM,wDAAwD,KAAK;AAAA,EAC7E;AACF;AAcO,SAAS,2BAA2B;AAAA,EACzC,qBAAqB;AAAA,EACrB;AACF,IAAqC,IAAyB;AAC5D,QAAM,SAASA,aAAAA,yBAAA;AACf,QAAM,EAAE,MAAA,IAAUC,gCAAA;AAClB,QAAM,cAAcC,eAAAA,wBAAA;AAEpB,QAAM,YAAY,WAAW,aAAa,WAAW;AACrD,MAAI,CAAC,aAAa,EAAE,sBAAsB,WAAW,SAAU,QAAO;AAEtE,SACEC,2BAAAA;AAAAA,IAACC,aAAAA;AAAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,YAAW;AAAA,MACX,SAAS,MAAM;AACb,uBAAe,YAAY,EAAE,QAAQ,MAAA,CAAO;AAC5C,oBAAY;AAAA,UACV,MAAM;AAAA,UACN,GAAI,UAAU,QAAQ,EAAE,MAAA;AAAA,QAAM,CAC/B;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAGN;AAeO,SAAS,+BAA+B;AAAA,EAC7C;AACF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AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAM,+BAAO,WAAU,sBAAsB,MAAM,OAAO,KAAK;AAAA,IAC/D,QAAQ;AAAA,IACR,qBAAqB;AAAA,EAAA,IAEzB;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,qBAAqB;AAAA,EAAA;AAG7B,SACET,2BAAAA;AAAAA,IAACU,eAAAA;AAAAA,IAAA;AAAA,MACC,eAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA,WAAWC,OAAAA,GAAG,uBAAuB,SAAS;AAAA,IAAA;AAAA,EAAA;AAGpD;;;;"}
@@ -1,25 +1,13 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useAuiState } from "@assistant-ui/react";
3
3
  import { useStatewireRuns, useStatewireSendCommand } from "@assistant-ui/react-statewire";
4
- import "../../packages/agent-runtime/src/generated/runconfig-contract.js";
5
- import "react";
6
- import "@assistant-ui/tap";
7
- import "statewire";
8
- import { readRetryableRunRefusal } from "../../packages/agent-runtime/src/errors.js";
9
- import "../../packages/agent-runtime/src/statewire-suspended.js";
10
- import "../../packages/agent-runtime/src/conversation-list.js";
11
- import "@tanstack/react-query";
12
- import "../../packages/agent-runtime/src/statewire-state.js";
4
+ import { ContinuePill } from "./continue-pill.js";
5
+ import { RuntimeMessageCard } from "./runtime-message.js";
13
6
  import { readRunMarkerFromSourceMessages, ATHENA_RUN_MARKER_CANCELLED, ATHENA_RUN_MARKER_FAILED } from "../../packages/agent-runtime/src/messages.js";
14
7
  import { hasStatewireThreadExtras } from "../../packages/agent-runtime/src/thread-extras.js";
15
- import "@assistant-ui/store";
16
- import "../../packages/agent-runtime/src/quota-safe-local-storage-session.js";
17
- import "../../packages/agent-runtime/src/statewire-attach-observer.js";
18
8
  import { useDeepAgentThreadStatus } from "../../packages/agent-runtime/src/thread-status.js";
9
+ import { readRetryableRunRefusal } from "../../packages/agent-runtime/src/errors.js";
19
10
  import { readRuntimeMessageFromSourceMessages } from "../../packages/agent-runtime/src/runtime-messages.js";
20
- import "../../packages/agent-runtime/src/thread-handoff.js";
21
- import { ContinuePill } from "./continue-pill.js";
22
- import { RuntimeMessageCard } from "./runtime-message.js";
23
11
  import { cn } from "cnfast";
24
12
  function notifyContinue(onContinue, context) {
25
13
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"statewire-continue-run.js","sources":["../../../src/chat-ui/messages/statewire-continue-run.tsx"],"sourcesContent":["import { type ThreadMessage, useAuiState } from \"@assistant-ui/react\";\nimport {\n useStatewireRuns,\n useStatewireSendCommand,\n} from \"@assistant-ui/react-statewire\";\nimport {\n ATHENA_RUN_MARKER_CANCELLED,\n ATHENA_RUN_MARKER_FAILED,\n type AthenaRuntimeMessage,\n type AthenaRuntimeMessageKind,\n type DeepAgentThreadStatus,\n hasStatewireThreadExtras,\n readRetryableRunRefusal,\n readRunMarkerFromSourceMessages,\n readRuntimeMessageFromSourceMessages,\n useDeepAgentThreadStatus,\n} from \"@athenaintel/agent-runtime\";\nimport type { ReactElement, ReactNode } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport { ContinuePill } from \"./continue-pill\";\nimport { RuntimeMessageCard } from \"./runtime-message\";\n\nexport interface StatewireContinueRunButtonProps {\n /**\n * Also offer Continue while the thread projects `ready`. An old snapshot\n * can report a resting thread whose last persisted ending is still\n * continuable; the marker row that mounts this button knows that.\n */\n allowReadyFallback?: boolean;\n /**\n * Called as the continue dispatches (after the pill's exit animation),\n * immediately before the command queues — the host's telemetry hook.\n * Receives the settled status and live run id the user acted on. Queueing\n * publishes the command's first update synchronously, so a hook that pairs\n * this click with that update must run first. Best-effort: a throwing hook\n * is swallowed and never blocks the dispatch.\n */\n onContinue?: (context: { status: DeepAgentThreadStatus; runId: string | null }) => void;\n}\n\nfunction notifyContinue(\n onContinue: StatewireContinueRunButtonProps[\"onContinue\"],\n context: { status: DeepAgentThreadStatus; runId: string | null },\n): void {\n try {\n onContinue?.(context);\n } catch (error) {\n console.debug(\"[StatewireContinueRunButton] onContinue hook failed:\", error);\n }\n}\n\n/**\n * Dispatches the bare `run/continue` for the live Statewire thread — the\n * heal-then-continue recovery for stopped, errored, and pod-drained runs. The\n * command is exactly what the library's `onResume` emits, so it inherits the\n * optimistic running-flip (the pill unmounts once the dispatch is accepted)\n * and routes rejections to the runtime's shared `onError` policy.\n *\n * Gated on the LIVE thread status, never on the persisted marker: markers live\n * in the transcript forever, while continuability is a property of the\n * current run state. Requires `capabilities.continue` on the host thread and\n * a statewire aui scope (throws outside one, like every `useStatewire*` hook).\n */\nexport function StatewireContinueRunButton({\n allowReadyFallback = false,\n onContinue,\n}: StatewireContinueRunButtonProps = {}): ReactElement | null {\n const status = useDeepAgentThreadStatus();\n const { runId } = useStatewireRuns();\n const sendCommand = useStatewireSendCommand();\n\n const isSettled = status === \"stopped\" || status === \"error\";\n if (!isSettled && !(allowReadyFallback && status === \"ready\")) return null;\n\n return (\n <ContinuePill\n ariaLabel=\"Continue this run from where it stopped\"\n dataTestId=\"statewire-continue-run\"\n onClick={() => {\n notifyContinue(onContinue, { status, runId });\n sendCommand({\n type: \"run/continue\",\n ...(runId !== null && { runId }),\n });\n }}\n />\n );\n}\n\nexport interface StatewireContinueRunAffordanceProps {\n /** Forwarded to the mounted `StatewireContinueRunButton`. */\n onContinue?: StatewireContinueRunButtonProps[\"onContinue\"];\n}\n\n/**\n * Recovery affordance for the latest persisted stopped/failed run marker,\n * for the `runtimeMessageAction` slot of `createAssistantMessage`.\n *\n * Marker messages remain in history forever, so only the current last message\n * may continue. The extras guard keeps Statewire hooks out of read-only or\n * legacy runtimes where they would throw.\n */\nexport function StatewireContinueRunAffordance({\n onContinue,\n}: StatewireContinueRunAffordanceProps = {}): ReactElement | null {\n const messageId = useAuiState((state) => state.message.id);\n const lastMessageId = useAuiState(\n (state) => state.thread.messages.at(-1)?.id,\n );\n const runMarker = useAuiState(\n (state) => readRunMarkerFromSourceMessages(state.message)?.marker,\n );\n const threadExtras = useAuiState((state) => state.thread.extras);\n\n const isContinuableMarker =\n runMarker === ATHENA_RUN_MARKER_CANCELLED ||\n runMarker === ATHENA_RUN_MARKER_FAILED;\n if (messageId !== lastMessageId || !isContinuableMarker) return null;\n if (!hasStatewireThreadExtras(threadExtras)) return null;\n\n return (\n <div className=\"flex w-full justify-center py-1\">\n <StatewireContinueRunButton allowReadyFallback onContinue={onContinue} />\n </div>\n );\n}\n\n/** The ending a transcript row paints, as the footer needs to know it. */\nexport interface StatewireTailEnding {\n kind: AthenaRuntimeMessageKind;\n /** A send-now cancellation: kept in the data, painted as nothing. */\n silent: boolean;\n}\n\n/** Reads the runtime ending (marker or handoff) a message row renders, if any. */\nexport type ReadStatewireTailEnding = (message: ThreadMessage) => StatewireTailEnding | null;\n\nconst readRuntimeTailEnding: ReadStatewireTailEnding = (message) => {\n const runtime = readRuntimeMessageFromSourceMessages(message);\n return runtime ? { kind: runtime.kind, silent: runtime.silent } : null;\n};\n\nexport interface StatewireRunEndedFooterActionsContext {\n /** The live settled status the footer describes. */\n status: \"stopped\" | \"error\";\n /** The ending the tail row renders, when it renders one (silent markers read as none). */\n tailEndingKind: AthenaRuntimeMessageKind | null;\n}\n\nexport interface StatewireRunEndedFooterProps {\n /** Merged onto the recovery card's default classes. */\n className?: string;\n /**\n * How the host's assistant row paints the transcript tail. The default reads\n * the runtime ending only (a persisted marker or handoff); a host whose row\n * also styles an assistant-ui error status as a failed ending passes a\n * reader that reports it, so the footer never doubles that row's recovery.\n */\n readTailEnding?: ReadStatewireTailEnding;\n /**\n * The recovery controls. The default renders Continue unless the tail row\n * (a marker of another kind) already carries it; hosts with richer recovery\n * (Retry + Continue) supply their own and decide ownership from the context.\n */\n renderActions?: (context: StatewireRunEndedFooterActionsContext) => ReactNode;\n /** Forwarded to the default Continue action (unused when `renderActions` is set). */\n onContinue?: StatewireContinueRunButtonProps[\"onContinue\"];\n}\n\n/**\n * Recovery row for a settled run whose persisted ending is no longer the\n * transcript tail — rendered after the messages (`renderMessages`). Rewinds,\n * compaction, and older snapshots can all leave the durable run state\n * recoverable without a marker row that owns the action. The failure copy\n * comes from the replicated run error (`runs.error.message`) — the same text\n * the marker would have carried. A RETRYABLE refusal recorded there\n * (`readRetryableRunRefusal`: a closing host refused to start the queued\n * work, which stays in its lane and re-dispatches on the thread's next\n * placement) is not a failure of the run and paints as a pause, keeping\n * Continue as the manual way on. Renders nothing on legacy (non-statewire)\n * threads.\n */\nexport function StatewireRunEndedFooter({\n className,\n readTailEnding,\n renderActions,\n onContinue,\n}: StatewireRunEndedFooterProps = {}): ReactElement | null {\n const threadExtras = useAuiState((state) => state.thread.extras);\n if (!hasStatewireThreadExtras(threadExtras)) return null;\n return (\n <StatewireRunEndedFooterContent\n className={className}\n readTailEnding={readTailEnding}\n renderActions={renderActions}\n onContinue={onContinue}\n />\n );\n}\n\nfunction StatewireRunEndedFooterContent({\n className,\n readTailEnding = readRuntimeTailEnding,\n renderActions,\n onContinue,\n}: StatewireRunEndedFooterProps): ReactElement | null {\n const status = useDeepAgentThreadStatus();\n const { error } = useStatewireRuns();\n // The reader builds a fresh object per call; select primitives so the\n // snapshots stay stable under `Object.is` comparison.\n const tailEndingKind = useAuiState((state) => {\n const last = state.thread.messages.at(-1);\n return last ? (readTailEnding(last)?.kind ?? null) : null;\n });\n const tailEndingSilent = useAuiState((state) => {\n const last = state.thread.messages.at(-1);\n return last ? (readTailEnding(last)?.silent ?? false) : false;\n });\n const transcriptEmpty = useAuiState((state) => state.thread.messages.length === 0);\n\n if (status !== \"stopped\" && status !== \"error\") return null;\n\n // A user stop that retracted the only turn (its text went back to the\n // composer) settles as stopped over an empty transcript: there is no\n // conversation to continue or retry, so the thread reads as fresh.\n if (status === \"stopped\" && transcriptEmpty) return null;\n\n // A send-now promotion intentionally cancels the superseded run without a\n // visible ending. Statewire can briefly report that cancellation as stopped;\n // preserve the silent contract instead of presenting a false recovery state.\n // A genuine error still wins and remains recoverable below.\n if (status === \"stopped\" && tailEndingSilent) return null;\n\n const tailRendersEnding = tailEndingKind !== null && !tailEndingSilent;\n const tailMatchesStatus =\n status === \"error\"\n ? tailEndingKind === \"failed\"\n : tailEndingKind === \"stopped\" || tailEndingKind === \"paused\";\n if (tailRendersEnding && tailMatchesStatus) return null;\n\n // An older run's marker at the tail still carries its own Continue (the\n // marker-row affordance); a handoff banner does not.\n const tailOwnsContinue = tailRendersEnding && tailEndingKind !== \"handoff\";\n const action = renderActions ? (\n renderActions({ status, tailEndingKind: tailRendersEnding ? tailEndingKind : null })\n ) : tailOwnsContinue ? undefined : (\n <StatewireContinueRunButton onContinue={onContinue} />\n );\n const refusal = status === \"error\" ? readRetryableRunRefusal(error) : null;\n const message: AthenaRuntimeMessage =\n status === \"error\"\n ? refusal\n ? {\n kind: \"paused\",\n reason: refusal.code,\n severity: \"info\",\n title: \"Waiting for a server update\",\n detail:\n \"The server hosting this chat is restarting, so the queued message could not start yet. It runs on a ready server automatically.\",\n text: undefined,\n silent: false,\n isSoleSourceMessage: true,\n }\n : {\n kind: \"failed\",\n reason: \"error\",\n severity: \"error\",\n title: \"Run failed\",\n detail: undefined,\n text: error?.message ? `⚠️ The run failed: ${error.message}` : undefined,\n silent: false,\n isSoleSourceMessage: true,\n }\n : {\n kind: \"stopped\",\n reason: undefined,\n severity: \"info\",\n title: \"Conversation stopped\",\n detail: undefined,\n text: undefined,\n silent: false,\n isSoleSourceMessage: true,\n };\n\n return (\n <RuntimeMessageCard\n data-testid=\"statewire-run-ended-footer\"\n message={message}\n action={action}\n className={cn(\"mx-auto max-w-[95%]\", className)}\n />\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAS,eACP,YACA,SACM;AACN,MAAI;AACF,6CAAa;AAAA,EACf,SAAS,OAAO;AACd,YAAQ,MAAM,wDAAwD,KAAK;AAAA,EAC7E;AACF;AAcO,SAAS,2BAA2B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oBAAoB,iBAAiB,KAAA,CAAM,IACjF,mBAAmB,SACrB,oBAAC,8BAA2B,YAAwB;AAEtD,QAAM,UAAU,WAAW,UAAU,wBAAwB,KAAK,IAAI;AACtE,QAAM,UACJ,WAAW,UACP,UACE;AAAA,IACE,MAAM;AAAA,IACN,QAAQ,QAAQ;AAAA,IAChB,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QACE;AAAA,IACF,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,qBAAqB;AAAA,EAAA,IAEvB;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAM,+BAAO,WAAU,sBAAsB,MAAM,OAAO,KAAK;AAAA,IAC/D,QAAQ;AAAA,IACR,qBAAqB;AAAA,EAAA,IAEzB;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,qBAAqB;AAAA,EAAA;AAG7B,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA,WAAW,GAAG,uBAAuB,SAAS;AAAA,IAAA;AAAA,EAAA;AAGpD;"}
1
+ {"version":3,"file":"statewire-continue-run.js","sources":["../../../src/chat-ui/messages/statewire-continue-run.tsx"],"sourcesContent":["import { type ThreadMessage, useAuiState } from \"@assistant-ui/react\";\nimport {\n useStatewireRuns,\n useStatewireSendCommand,\n} from \"@assistant-ui/react-statewire\";\nimport {\n ATHENA_RUN_MARKER_CANCELLED,\n ATHENA_RUN_MARKER_FAILED,\n type AthenaRuntimeMessage,\n type AthenaRuntimeMessageKind,\n type DeepAgentThreadStatus,\n hasStatewireThreadExtras,\n readRetryableRunRefusal,\n readRunMarkerFromSourceMessages,\n readRuntimeMessageFromSourceMessages,\n useDeepAgentThreadStatus,\n} from \"@athenaintel/agent-runtime\";\nimport type { ReactElement, ReactNode } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport { ContinuePill } from \"./continue-pill\";\nimport { RuntimeMessageCard } from \"./runtime-message\";\n\nexport interface StatewireContinueRunButtonProps {\n /**\n * Also offer Continue while the thread projects `ready`. An old snapshot\n * can report a resting thread whose last persisted ending is still\n * continuable; the marker row that mounts this button knows that.\n */\n allowReadyFallback?: boolean;\n /**\n * Called as the continue dispatches (after the pill's exit animation),\n * immediately before the command queues — the host's telemetry hook.\n * Receives the settled status and live run id the user acted on. Queueing\n * publishes the command's first update synchronously, so a hook that pairs\n * this click with that update must run first. Best-effort: a throwing hook\n * is swallowed and never blocks the dispatch.\n */\n onContinue?: (context: { status: DeepAgentThreadStatus; runId: string | null }) => void;\n}\n\nfunction notifyContinue(\n onContinue: StatewireContinueRunButtonProps[\"onContinue\"],\n context: { status: DeepAgentThreadStatus; runId: string | null },\n): void {\n try {\n onContinue?.(context);\n } catch (error) {\n console.debug(\"[StatewireContinueRunButton] onContinue hook failed:\", error);\n }\n}\n\n/**\n * Dispatches the bare `run/continue` for the live Statewire thread — the\n * heal-then-continue recovery for stopped, errored, and pod-drained runs. The\n * command is exactly what the library's `onResume` emits, so it inherits the\n * optimistic running-flip (the pill unmounts once the dispatch is accepted)\n * and routes rejections to the runtime's shared `onError` policy.\n *\n * Gated on the LIVE thread status, never on the persisted marker: markers live\n * in the transcript forever, while continuability is a property of the\n * current run state. Requires `capabilities.continue` on the host thread and\n * a statewire aui scope (throws outside one, like every `useStatewire*` hook).\n */\nexport function StatewireContinueRunButton({\n allowReadyFallback = false,\n onContinue,\n}: StatewireContinueRunButtonProps = {}): ReactElement | null {\n const status = useDeepAgentThreadStatus();\n const { runId } = useStatewireRuns();\n const sendCommand = useStatewireSendCommand();\n\n const isSettled = status === \"stopped\" || status === \"error\";\n if (!isSettled && !(allowReadyFallback && status === \"ready\")) return null;\n\n return (\n <ContinuePill\n ariaLabel=\"Continue this run from where it stopped\"\n dataTestId=\"statewire-continue-run\"\n onClick={() => {\n notifyContinue(onContinue, { status, runId });\n sendCommand({\n type: \"run/continue\",\n ...(runId !== null && { runId }),\n });\n }}\n />\n );\n}\n\nexport interface StatewireContinueRunAffordanceProps {\n /** Forwarded to the mounted `StatewireContinueRunButton`. */\n onContinue?: StatewireContinueRunButtonProps[\"onContinue\"];\n}\n\n/**\n * Recovery affordance for the latest persisted stopped/failed run marker,\n * for the `runtimeMessageAction` slot of `createAssistantMessage`.\n *\n * Marker messages remain in history forever, so only the current last message\n * may continue. The extras guard keeps Statewire hooks out of read-only or\n * legacy runtimes where they would throw.\n */\nexport function StatewireContinueRunAffordance({\n onContinue,\n}: StatewireContinueRunAffordanceProps = {}): ReactElement | null {\n const messageId = useAuiState((state) => state.message.id);\n const lastMessageId = useAuiState(\n (state) => state.thread.messages.at(-1)?.id,\n );\n const runMarker = useAuiState(\n (state) => readRunMarkerFromSourceMessages(state.message)?.marker,\n );\n const threadExtras = useAuiState((state) => state.thread.extras);\n\n const isContinuableMarker =\n runMarker === ATHENA_RUN_MARKER_CANCELLED ||\n runMarker === ATHENA_RUN_MARKER_FAILED;\n if (messageId !== lastMessageId || !isContinuableMarker) return null;\n if (!hasStatewireThreadExtras(threadExtras)) return null;\n\n return (\n <div className=\"flex w-full justify-center py-1\">\n <StatewireContinueRunButton allowReadyFallback onContinue={onContinue} />\n </div>\n );\n}\n\n/** The ending a transcript row paints, as the footer needs to know it. */\nexport interface StatewireTailEnding {\n kind: AthenaRuntimeMessageKind;\n /** A send-now cancellation: kept in the data, painted as nothing. */\n silent: boolean;\n}\n\n/** Reads the runtime ending (marker or handoff) a message row renders, if any. */\nexport type ReadStatewireTailEnding = (message: ThreadMessage) => StatewireTailEnding | null;\n\nconst readRuntimeTailEnding: ReadStatewireTailEnding = (message) => {\n const runtime = readRuntimeMessageFromSourceMessages(message);\n return runtime ? { kind: runtime.kind, silent: runtime.silent } : null;\n};\n\nexport interface StatewireRunEndedFooterActionsContext {\n /** The live settled status the footer describes. */\n status: \"stopped\" | \"error\";\n /** The ending the tail row renders, when it renders one (silent markers read as none). */\n tailEndingKind: AthenaRuntimeMessageKind | null;\n}\n\nexport interface StatewireRunEndedFooterProps {\n /** Merged onto the recovery card's default classes. */\n className?: string;\n /**\n * How the host's assistant row paints the transcript tail. The default reads\n * the runtime ending only (a persisted marker or handoff); a host whose row\n * also styles an assistant-ui error status as a failed ending passes a\n * reader that reports it, so the footer never doubles that row's recovery.\n */\n readTailEnding?: ReadStatewireTailEnding;\n /**\n * The recovery controls. The default renders Continue unless the tail row\n * (a marker of another kind) already carries it; hosts with richer recovery\n * (Retry + Continue) supply their own and decide ownership from the context.\n */\n renderActions?: (context: StatewireRunEndedFooterActionsContext) => ReactNode;\n /** Forwarded to the default Continue action (unused when `renderActions` is set). */\n onContinue?: StatewireContinueRunButtonProps[\"onContinue\"];\n}\n\n/**\n * Recovery row for a settled run whose persisted ending is no longer the\n * transcript tail — rendered after the messages (`renderMessages`). Rewinds,\n * compaction, and older snapshots can all leave the durable run state\n * recoverable without a marker row that owns the action. The failure copy\n * comes from the replicated run error (`runs.error.message`) — the same text\n * the marker would have carried. A RETRYABLE refusal recorded there\n * (`readRetryableRunRefusal`: a closing host refused to start the queued\n * work, which stays in its lane and re-dispatches on the thread's next\n * placement) is not a failure of the run and paints as a pause, keeping\n * Continue as the manual way on. Renders nothing on legacy (non-statewire)\n * threads.\n */\nexport function StatewireRunEndedFooter({\n className,\n readTailEnding,\n renderActions,\n onContinue,\n}: StatewireRunEndedFooterProps = {}): ReactElement | null {\n const threadExtras = useAuiState((state) => state.thread.extras);\n if (!hasStatewireThreadExtras(threadExtras)) return null;\n return (\n <StatewireRunEndedFooterContent\n className={className}\n readTailEnding={readTailEnding}\n renderActions={renderActions}\n onContinue={onContinue}\n />\n );\n}\n\nfunction StatewireRunEndedFooterContent({\n className,\n readTailEnding = readRuntimeTailEnding,\n renderActions,\n onContinue,\n}: StatewireRunEndedFooterProps): ReactElement | null {\n const status = useDeepAgentThreadStatus();\n const { error } = useStatewireRuns();\n // The reader builds a fresh object per call; select primitives so the\n // snapshots stay stable under `Object.is` comparison.\n const tailEndingKind = useAuiState((state) => {\n const last = state.thread.messages.at(-1);\n return last ? (readTailEnding(last)?.kind ?? null) : null;\n });\n const tailEndingSilent = useAuiState((state) => {\n const last = state.thread.messages.at(-1);\n return last ? (readTailEnding(last)?.silent ?? false) : false;\n });\n const transcriptEmpty = useAuiState((state) => state.thread.messages.length === 0);\n\n if (status !== \"stopped\" && status !== \"error\") return null;\n\n // A user stop that retracted the only turn (its text went back to the\n // composer) settles as stopped over an empty transcript: there is no\n // conversation to continue or retry, so the thread reads as fresh.\n if (status === \"stopped\" && transcriptEmpty) return null;\n\n // A send-now promotion intentionally cancels the superseded run without a\n // visible ending. Statewire can briefly report that cancellation as stopped;\n // preserve the silent contract instead of presenting a false recovery state.\n // A genuine error still wins and remains recoverable below.\n if (status === \"stopped\" && tailEndingSilent) return null;\n\n const tailRendersEnding = tailEndingKind !== null && !tailEndingSilent;\n const tailMatchesStatus =\n status === \"error\"\n ? tailEndingKind === \"failed\"\n : tailEndingKind === \"stopped\" || tailEndingKind === \"paused\";\n if (tailRendersEnding && tailMatchesStatus) return null;\n\n // An older run's marker at the tail still carries its own Continue (the\n // marker-row affordance); a handoff banner does not.\n const tailOwnsContinue = tailRendersEnding && tailEndingKind !== \"handoff\";\n const action = renderActions ? (\n renderActions({ status, tailEndingKind: tailRendersEnding ? tailEndingKind : null })\n ) : tailOwnsContinue ? undefined : (\n <StatewireContinueRunButton onContinue={onContinue} />\n );\n const refusal = status === \"error\" ? readRetryableRunRefusal(error) : null;\n const message: AthenaRuntimeMessage =\n status === \"error\"\n ? refusal\n ? {\n kind: \"paused\",\n reason: refusal.code,\n severity: \"info\",\n title: \"Waiting for a server update\",\n detail:\n \"The server hosting this chat is restarting, so the queued message could not start yet. It runs on a ready server automatically.\",\n text: undefined,\n silent: false,\n isSoleSourceMessage: true,\n }\n : {\n kind: \"failed\",\n reason: \"error\",\n severity: \"error\",\n title: \"Run failed\",\n detail: undefined,\n text: error?.message ? `⚠️ The run failed: ${error.message}` : undefined,\n silent: false,\n isSoleSourceMessage: true,\n }\n : {\n kind: \"stopped\",\n reason: undefined,\n severity: \"info\",\n title: \"Conversation stopped\",\n detail: undefined,\n text: undefined,\n silent: false,\n isSoleSourceMessage: true,\n };\n\n return (\n <RuntimeMessageCard\n data-testid=\"statewire-run-ended-footer\"\n message={message}\n action={action}\n className={cn(\"mx-auto max-w-[95%]\", className)}\n />\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAwCA,SAAS,eACP,YACA,SACM;AACN,MAAI;AACF,6CAAa;AAAA,EACf,SAAS,OAAO;AACd,YAAQ,MAAM,wDAAwD,KAAK;AAAA,EAC7E;AACF;AAcO,SAAS,2BAA2B;AAAA,EACzC,qBAAqB;AAAA,EACrB;AACF,IAAqC,IAAyB;AAC5D,QAAM,SAAS,yBAAA;AACf,QAAM,EAAE,MAAA,IAAU,iBAAA;AAClB,QAAM,cAAc,wBAAA;AAEpB,QAAM,YAAY,WAAW,aAAa,WAAW;AACrD,MAAI,CAAC,aAAa,EAAE,sBAAsB,WAAW,SAAU,QAAO;AAEtE,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,YAAW;AAAA,MACX,SAAS,MAAM;AACb,uBAAe,YAAY,EAAE,QAAQ,MAAA,CAAO;AAC5C,oBAAY;AAAA,UACV,MAAM;AAAA,UACN,GAAI,UAAU,QAAQ,EAAE,MAAA;AAAA,QAAM,CAC/B;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAGN;AAeO,SAAS,+BAA+B;AAAA,EAC7C;AACF,IAAyC,IAAyB;AAChE,QAAM,YAAY,YAAY,CAAC,UAAU,MAAM,QAAQ,EAAE;AACzD,QAAM,gBAAgB;AAAA,IACpB,CAAC,UAAA;;AAAU,yBAAM,OAAO,SAAS,GAAG,EAAE,MAA3B,mBAA8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IAAA;AAAA,MACC,eAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA,WAAW,GAAG,uBAAuB,SAAS;AAAA,IAAA;AAAA,EAAA;AAGpD;"}
@@ -2,23 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const react = require("@assistant-ui/react");
5
- require("../../packages/agent-runtime/src/generated/runconfig-contract.cjs");
6
- require("react");
7
- require("@assistant-ui/tap");
8
- require("statewire");
9
- require("../../packages/agent-runtime/src/statewire-suspended.cjs");
10
- require("../../packages/agent-runtime/src/conversation-list.cjs");
11
- require("@tanstack/react-query");
12
- require("../../packages/agent-runtime/src/statewire-state.cjs");
13
- require("../../packages/agent-runtime/src/messages.cjs");
14
- require("@assistant-ui/store");
15
5
  const useDeepAgentEditSubmit = require("../../packages/agent-runtime/src/use-deep-agent-edit-submit.cjs");
16
- require("../../packages/agent-runtime/src/quota-safe-local-storage-session.cjs");
17
- require("../../packages/agent-runtime/src/statewire-attach-observer.cjs");
18
- require("../../packages/agent-runtime/src/thread-status.cjs");
19
- require("@assistant-ui/react-statewire");
20
- require("@assistant-ui/core");
21
- require("../../packages/agent-runtime/src/thread-handoff.cjs");
22
6
  const UserEditComposer = () => {
23
7
  const submit = useDeepAgentEditSubmit.useDeepAgentMessageEditSubmit();
24
8
  const isEmpty = react.useAuiState((s) => s.message.composer.isEmpty);
@@ -1 +1 @@
1
- {"version":3,"file":"user-edit-composer.cjs","sources":["../../../src/chat-ui/messages/user-edit-composer.tsx"],"sourcesContent":["import { ComposerPrimitive, useAuiState } from \"@assistant-ui/react\";\nimport { useDeepAgentMessageEditSubmit } from \"@athenaintel/agent-runtime\";\nimport type { FC, KeyboardEvent } from \"react\";\n\n/**\n * Rendered in place of a user message while it is being edited (entered via\n * the action bar's Edit control, which seeds this composer with the message\n * text). Sending leaves as a `run/edit` anchored on the host's own parent of\n * the message (`useDeepAgentMessageEditSubmit`) — on a windowed wire the\n * lane's `anchorBefore` at the window edge — so the rewind is never rejected\n * `wrong-anchor` the way the library's converted-message anchor is after a\n * chunked assistant turn; Escape/Cancel exits edit mode.\n */\nexport const UserEditComposer: FC = () => {\n const submit = useDeepAgentMessageEditSubmit();\n const isEmpty = useAuiState((s) => s.message.composer.isEmpty);\n const onKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.key !== \"Enter\" || event.shiftKey || event.nativeEvent.isComposing) return;\n event.preventDefault();\n void submit();\n };\n return (\n <div className=\"mb-3 flex justify-end\" data-testid=\"chat-user-edit-composer\">\n <ComposerPrimitive.Root className=\"flex w-full max-w-[85%] flex-col gap-2 rounded-2xl rounded-br-md border border-border bg-muted px-3.5 py-2.5\">\n <ComposerPrimitive.Input\n autoFocus\n submitMode=\"none\"\n onKeyDown={onKeyDown}\n className=\"w-full resize-none bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground\"\n />\n <div className=\"flex items-center justify-end gap-1.5\">\n <ComposerPrimitive.Cancel asChild>\n <button\n type=\"button\"\n className=\"rounded-lg px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n Cancel\n </button>\n </ComposerPrimitive.Cancel>\n <button\n type=\"button\"\n data-testid=\"chat-user-edit-send\"\n disabled={isEmpty}\n onClick={() => void submit()}\n className=\"rounded-lg bg-foreground px-2.5 py-1 text-xs font-medium text-background shadow-sm transition-colors hover:bg-foreground/80 disabled:cursor-not-allowed disabled:opacity-60\"\n >\n Send\n </button>\n </div>\n </ComposerPrimitive.Root>\n </div>\n );\n};\n"],"names":["useDeepAgentMessageEditSubmit","useAuiState","jsx","jsxs","ComposerPrimitive"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAaO,MAAM,mBAAuB,MAAM;AACxC,QAAM,SAASA,uBAAAA,8BAAA;AACf,QAAM,UAAUC,MAAAA,YAAY,CAAC,MAAM,EAAE,QAAQ,SAAS,OAAO;AAC7D,QAAM,YAAY,CAAC,UAA8C;AAC/D,QAAI,MAAM,QAAQ,WAAW,MAAM,YAAY,MAAM,YAAY,YAAa;AAC9E,UAAM,eAAA;AACN,SAAK,OAAA;AAAA,EACP;AACA,SACEC,2BAAAA,IAAC,OAAA,EAAI,WAAU,yBAAwB,eAAY,2BACjD,UAAAC,2BAAAA,KAACC,MAAAA,kBAAkB,MAAlB,EAAuB,WAAU,gHAChC,UAAA;AAAA,IAAAF,2BAAAA;AAAAA,MAACE,MAAAA,kBAAkB;AAAA,MAAlB;AAAA,QACC,WAAS;AAAA,QACT,YAAW;AAAA,QACX;AAAA,QACA,WAAU;AAAA,MAAA;AAAA,IAAA;AAAA,IAEZD,2BAAAA,KAAC,OAAA,EAAI,WAAU,yCACb,UAAA;AAAA,MAAAD,2BAAAA,IAACE,MAAAA,kBAAkB,QAAlB,EAAyB,SAAO,MAC/B,UAAAF,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,WAAU;AAAA,UACX,UAAA;AAAA,QAAA;AAAA,MAAA,GAGH;AAAA,MACAA,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,eAAY;AAAA,UACZ,UAAU;AAAA,UACV,SAAS,MAAM,KAAK,OAAA;AAAA,UACpB,WAAU;AAAA,UACX,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAED,EAAA,CACF;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;;"}
1
+ {"version":3,"file":"user-edit-composer.cjs","sources":["../../../src/chat-ui/messages/user-edit-composer.tsx"],"sourcesContent":["import { ComposerPrimitive, useAuiState } from \"@assistant-ui/react\";\nimport { useDeepAgentMessageEditSubmit } from \"@athenaintel/agent-runtime\";\nimport type { FC, KeyboardEvent } from \"react\";\n\n/**\n * Rendered in place of a user message while it is being edited (entered via\n * the action bar's Edit control, which seeds this composer with the message\n * text). Sending leaves as a `run/edit` anchored on the host's own parent of\n * the message (`useDeepAgentMessageEditSubmit`) — on a windowed wire the\n * lane's `anchorBefore` at the window edge — so the rewind is never rejected\n * `wrong-anchor` the way the library's converted-message anchor is after a\n * chunked assistant turn; Escape/Cancel exits edit mode.\n */\nexport const UserEditComposer: FC = () => {\n const submit = useDeepAgentMessageEditSubmit();\n const isEmpty = useAuiState((s) => s.message.composer.isEmpty);\n const onKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.key !== \"Enter\" || event.shiftKey || event.nativeEvent.isComposing) return;\n event.preventDefault();\n void submit();\n };\n return (\n <div className=\"mb-3 flex justify-end\" data-testid=\"chat-user-edit-composer\">\n <ComposerPrimitive.Root className=\"flex w-full max-w-[85%] flex-col gap-2 rounded-2xl rounded-br-md border border-border bg-muted px-3.5 py-2.5\">\n <ComposerPrimitive.Input\n autoFocus\n submitMode=\"none\"\n onKeyDown={onKeyDown}\n className=\"w-full resize-none bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground\"\n />\n <div className=\"flex items-center justify-end gap-1.5\">\n <ComposerPrimitive.Cancel asChild>\n <button\n type=\"button\"\n className=\"rounded-lg px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n Cancel\n </button>\n </ComposerPrimitive.Cancel>\n <button\n type=\"button\"\n data-testid=\"chat-user-edit-send\"\n disabled={isEmpty}\n onClick={() => void submit()}\n className=\"rounded-lg bg-foreground px-2.5 py-1 text-xs font-medium text-background shadow-sm transition-colors hover:bg-foreground/80 disabled:cursor-not-allowed disabled:opacity-60\"\n >\n Send\n </button>\n </div>\n </ComposerPrimitive.Root>\n </div>\n );\n};\n"],"names":["useDeepAgentMessageEditSubmit","useAuiState","jsx","jsxs","ComposerPrimitive"],"mappings":";;;;;AAaO,MAAM,mBAAuB,MAAM;AACxC,QAAM,SAASA,uBAAAA,8BAAA;AACf,QAAM,UAAUC,MAAAA,YAAY,CAAC,MAAM,EAAE,QAAQ,SAAS,OAAO;AAC7D,QAAM,YAAY,CAAC,UAA8C;AAC/D,QAAI,MAAM,QAAQ,WAAW,MAAM,YAAY,MAAM,YAAY,YAAa;AAC9E,UAAM,eAAA;AACN,SAAK,OAAA;AAAA,EACP;AACA,SACEC,2BAAAA,IAAC,OAAA,EAAI,WAAU,yBAAwB,eAAY,2BACjD,UAAAC,2BAAAA,KAACC,MAAAA,kBAAkB,MAAlB,EAAuB,WAAU,gHAChC,UAAA;AAAA,IAAAF,2BAAAA;AAAAA,MAACE,MAAAA,kBAAkB;AAAA,MAAlB;AAAA,QACC,WAAS;AAAA,QACT,YAAW;AAAA,QACX;AAAA,QACA,WAAU;AAAA,MAAA;AAAA,IAAA;AAAA,IAEZD,2BAAAA,KAAC,OAAA,EAAI,WAAU,yCACb,UAAA;AAAA,MAAAD,2BAAAA,IAACE,MAAAA,kBAAkB,QAAlB,EAAyB,SAAO,MAC/B,UAAAF,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,WAAU;AAAA,UACX,UAAA;AAAA,QAAA;AAAA,MAAA,GAGH;AAAA,MACAA,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,eAAY;AAAA,UACZ,UAAU;AAAA,UACV,SAAS,MAAM,KAAK,OAAA;AAAA,UACpB,WAAU;AAAA,UACX,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAED,EAAA,CACF;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;;"}
@@ -1,22 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useAuiState, ComposerPrimitive } from "@assistant-ui/react";
3
- import "../../packages/agent-runtime/src/generated/runconfig-contract.js";
4
- import "react";
5
- import "@assistant-ui/tap";
6
- import "statewire";
7
- import "../../packages/agent-runtime/src/statewire-suspended.js";
8
- import "../../packages/agent-runtime/src/conversation-list.js";
9
- import "@tanstack/react-query";
10
- import "../../packages/agent-runtime/src/statewire-state.js";
11
- import "../../packages/agent-runtime/src/messages.js";
12
- import "@assistant-ui/store";
13
3
  import { useDeepAgentMessageEditSubmit } from "../../packages/agent-runtime/src/use-deep-agent-edit-submit.js";
14
- import "../../packages/agent-runtime/src/quota-safe-local-storage-session.js";
15
- import "../../packages/agent-runtime/src/statewire-attach-observer.js";
16
- import "../../packages/agent-runtime/src/thread-status.js";
17
- import "@assistant-ui/react-statewire";
18
- import "@assistant-ui/core";
19
- import "../../packages/agent-runtime/src/thread-handoff.js";
20
4
  const UserEditComposer = () => {
21
5
  const submit = useDeepAgentMessageEditSubmit();
22
6
  const isEmpty = useAuiState((s) => s.message.composer.isEmpty);
@@ -1 +1 @@
1
- {"version":3,"file":"user-edit-composer.js","sources":["../../../src/chat-ui/messages/user-edit-composer.tsx"],"sourcesContent":["import { ComposerPrimitive, useAuiState } from \"@assistant-ui/react\";\nimport { useDeepAgentMessageEditSubmit } from \"@athenaintel/agent-runtime\";\nimport type { FC, KeyboardEvent } from \"react\";\n\n/**\n * Rendered in place of a user message while it is being edited (entered via\n * the action bar's Edit control, which seeds this composer with the message\n * text). Sending leaves as a `run/edit` anchored on the host's own parent of\n * the message (`useDeepAgentMessageEditSubmit`) — on a windowed wire the\n * lane's `anchorBefore` at the window edge — so the rewind is never rejected\n * `wrong-anchor` the way the library's converted-message anchor is after a\n * chunked assistant turn; Escape/Cancel exits edit mode.\n */\nexport const UserEditComposer: FC = () => {\n const submit = useDeepAgentMessageEditSubmit();\n const isEmpty = useAuiState((s) => s.message.composer.isEmpty);\n const onKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.key !== \"Enter\" || event.shiftKey || event.nativeEvent.isComposing) return;\n event.preventDefault();\n void submit();\n };\n return (\n <div className=\"mb-3 flex justify-end\" data-testid=\"chat-user-edit-composer\">\n <ComposerPrimitive.Root className=\"flex w-full max-w-[85%] flex-col gap-2 rounded-2xl rounded-br-md border border-border bg-muted px-3.5 py-2.5\">\n <ComposerPrimitive.Input\n autoFocus\n submitMode=\"none\"\n onKeyDown={onKeyDown}\n className=\"w-full resize-none bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground\"\n />\n <div className=\"flex items-center justify-end gap-1.5\">\n <ComposerPrimitive.Cancel asChild>\n <button\n type=\"button\"\n className=\"rounded-lg px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n Cancel\n </button>\n </ComposerPrimitive.Cancel>\n <button\n type=\"button\"\n data-testid=\"chat-user-edit-send\"\n disabled={isEmpty}\n onClick={() => void submit()}\n className=\"rounded-lg bg-foreground px-2.5 py-1 text-xs font-medium text-background shadow-sm transition-colors hover:bg-foreground/80 disabled:cursor-not-allowed disabled:opacity-60\"\n >\n Send\n </button>\n </div>\n </ComposerPrimitive.Root>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAaO,MAAM,mBAAuB,MAAM;AACxC,QAAM,SAAS,8BAAA;AACf,QAAM,UAAU,YAAY,CAAC,MAAM,EAAE,QAAQ,SAAS,OAAO;AAC7D,QAAM,YAAY,CAAC,UAA8C;AAC/D,QAAI,MAAM,QAAQ,WAAW,MAAM,YAAY,MAAM,YAAY,YAAa;AAC9E,UAAM,eAAA;AACN,SAAK,OAAA;AAAA,EACP;AACA,SACE,oBAAC,OAAA,EAAI,WAAU,yBAAwB,eAAY,2BACjD,UAAA,qBAAC,kBAAkB,MAAlB,EAAuB,WAAU,gHAChC,UAAA;AAAA,IAAA;AAAA,MAAC,kBAAkB;AAAA,MAAlB;AAAA,QACC,WAAS;AAAA,QACT,YAAW;AAAA,QACX;AAAA,QACA,WAAU;AAAA,MAAA;AAAA,IAAA;AAAA,IAEZ,qBAAC,OAAA,EAAI,WAAU,yCACb,UAAA;AAAA,MAAA,oBAAC,kBAAkB,QAAlB,EAAyB,SAAO,MAC/B,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,WAAU;AAAA,UACX,UAAA;AAAA,QAAA;AAAA,MAAA,GAGH;AAAA,MACA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,eAAY;AAAA,UACZ,UAAU;AAAA,UACV,SAAS,MAAM,KAAK,OAAA;AAAA,UACpB,WAAU;AAAA,UACX,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAED,EAAA,CACF;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;"}
1
+ {"version":3,"file":"user-edit-composer.js","sources":["../../../src/chat-ui/messages/user-edit-composer.tsx"],"sourcesContent":["import { ComposerPrimitive, useAuiState } from \"@assistant-ui/react\";\nimport { useDeepAgentMessageEditSubmit } from \"@athenaintel/agent-runtime\";\nimport type { FC, KeyboardEvent } from \"react\";\n\n/**\n * Rendered in place of a user message while it is being edited (entered via\n * the action bar's Edit control, which seeds this composer with the message\n * text). Sending leaves as a `run/edit` anchored on the host's own parent of\n * the message (`useDeepAgentMessageEditSubmit`) — on a windowed wire the\n * lane's `anchorBefore` at the window edge — so the rewind is never rejected\n * `wrong-anchor` the way the library's converted-message anchor is after a\n * chunked assistant turn; Escape/Cancel exits edit mode.\n */\nexport const UserEditComposer: FC = () => {\n const submit = useDeepAgentMessageEditSubmit();\n const isEmpty = useAuiState((s) => s.message.composer.isEmpty);\n const onKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.key !== \"Enter\" || event.shiftKey || event.nativeEvent.isComposing) return;\n event.preventDefault();\n void submit();\n };\n return (\n <div className=\"mb-3 flex justify-end\" data-testid=\"chat-user-edit-composer\">\n <ComposerPrimitive.Root className=\"flex w-full max-w-[85%] flex-col gap-2 rounded-2xl rounded-br-md border border-border bg-muted px-3.5 py-2.5\">\n <ComposerPrimitive.Input\n autoFocus\n submitMode=\"none\"\n onKeyDown={onKeyDown}\n className=\"w-full resize-none bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground\"\n />\n <div className=\"flex items-center justify-end gap-1.5\">\n <ComposerPrimitive.Cancel asChild>\n <button\n type=\"button\"\n className=\"rounded-lg px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n Cancel\n </button>\n </ComposerPrimitive.Cancel>\n <button\n type=\"button\"\n data-testid=\"chat-user-edit-send\"\n disabled={isEmpty}\n onClick={() => void submit()}\n className=\"rounded-lg bg-foreground px-2.5 py-1 text-xs font-medium text-background shadow-sm transition-colors hover:bg-foreground/80 disabled:cursor-not-allowed disabled:opacity-60\"\n >\n Send\n </button>\n </div>\n </ComposerPrimitive.Root>\n </div>\n );\n};\n"],"names":[],"mappings":";;;AAaO,MAAM,mBAAuB,MAAM;AACxC,QAAM,SAAS,8BAAA;AACf,QAAM,UAAU,YAAY,CAAC,MAAM,EAAE,QAAQ,SAAS,OAAO;AAC7D,QAAM,YAAY,CAAC,UAA8C;AAC/D,QAAI,MAAM,QAAQ,WAAW,MAAM,YAAY,MAAM,YAAY,YAAa;AAC9E,UAAM,eAAA;AACN,SAAK,OAAA;AAAA,EACP;AACA,SACE,oBAAC,OAAA,EAAI,WAAU,yBAAwB,eAAY,2BACjD,UAAA,qBAAC,kBAAkB,MAAlB,EAAuB,WAAU,gHAChC,UAAA;AAAA,IAAA;AAAA,MAAC,kBAAkB;AAAA,MAAlB;AAAA,QACC,WAAS;AAAA,QACT,YAAW;AAAA,QACX;AAAA,QACA,WAAU;AAAA,MAAA;AAAA,IAAA;AAAA,IAEZ,qBAAC,OAAA,EAAI,WAAU,yCACb,UAAA;AAAA,MAAA,oBAAC,kBAAkB,QAAlB,EAAyB,SAAO,MAC/B,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,WAAU;AAAA,UACX,UAAA;AAAA,QAAA;AAAA,MAAA,GAGH;AAAA,MACA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,eAAY;AAAA,UACZ,UAAU;AAAA,UACV,SAAS,MAAM,KAAK,OAAA;AAAA,UACpB,WAAU;AAAA,UACX,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAED,EAAA,CACF;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;"}
@@ -2,24 +2,9 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const react = require("@assistant-ui/react");
5
- require("../../packages/agent-runtime/src/generated/runconfig-contract.cjs");
5
+ const lucideReact = require("lucide-react");
6
6
  const react$1 = require("react");
7
- require("@assistant-ui/tap");
8
- require("statewire");
9
- require("../../packages/agent-runtime/src/statewire-suspended.cjs");
10
- require("../../packages/agent-runtime/src/conversation-list.cjs");
11
- require("@tanstack/react-query");
12
- require("../../packages/agent-runtime/src/statewire-state.cjs");
13
- require("../../packages/agent-runtime/src/messages.cjs");
14
- require("@assistant-ui/store");
15
- require("../../packages/agent-runtime/src/quota-safe-local-storage-session.cjs");
16
- require("../../packages/agent-runtime/src/statewire-attach-observer.cjs");
17
- require("../../packages/agent-runtime/src/thread-status.cjs");
18
- require("@assistant-ui/react-statewire");
19
7
  const githubWakeEvent = require("../../packages/agent-runtime/src/github-wake-event.cjs");
20
- require("@assistant-ui/core");
21
- require("../../packages/agent-runtime/src/thread-handoff.cjs");
22
- const lucideReact = require("lucide-react");
23
8
  const cnfast = require("cnfast");
24
9
  const WakeMarkerCard = ({ event, className, ...rest }) => {
25
10
  const target = event.number !== null ? `#${event.number}` : event.repo;
@@ -1 +1 @@
1
- {"version":3,"file":"wake-marker.cjs","sources":["../../../src/chat-ui/messages/wake-marker.tsx"],"sourcesContent":["/**\n * The runtime marker for a wake turn: a GitHub webhook woke the session and\n * injected a user message (see `@athenaintel/agent-runtime`'s\n * `github-wake-event.ts`). It renders in the same visual language as the\n * runtime-ending card (`RuntimeMessageCard`) — a compact status row, not a\n * user bubble quoting the whole wake text.\n */\nimport { useAuiState } from \"@assistant-ui/react\";\nimport {\n type GithubWakeEvent,\n githubWakeEventLabel,\n githubWakeReference,\n readGithubWakeEvent,\n} from \"@athenaintel/agent-runtime\";\nimport { GitPullRequestIcon } from \"lucide-react\";\nimport { type ComponentPropsWithoutRef, type FC, useMemo } from \"react\";\nimport { cn } from \"../../lib/utils\";\n\nexport interface WakeMarkerCardProps\n extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\" | \"role\"> {\n event: GithubWakeEvent;\n}\n\n/** The \"Woke: review comment on #36337\" row; pure presenter. */\nexport const WakeMarkerCard: FC<WakeMarkerCardProps> = ({ event, className, ...rest }) => {\n const target = event.number !== null ? `#${event.number}` : event.repo;\n const reference = githubWakeReference(event);\n return (\n <div\n {...rest}\n role=\"status\"\n data-runtime-message-kind=\"wake\"\n data-testid=\"wake-marker\"\n className={cn(\n \"my-2 flex w-full items-start gap-2 rounded-lg border border-border bg-muted/40 px-3 py-2 text-muted-foreground text-sm\",\n className,\n )}\n >\n <GitPullRequestIcon className=\"mt-0.5 size-4 shrink-0\" aria-hidden=\"true\" />\n <div className=\"flex min-w-0 flex-1 flex-col gap-0.5 break-words [overflow-wrap:anywhere]\">\n <span className=\"font-medium\">\n Woke: {githubWakeEventLabel(event)} on{\" \"}\n {event.url ? (\n <a\n href={event.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n title={event.title ?? reference}\n className=\"underline-offset-2 hover:underline\"\n >\n {target}\n </a>\n ) : (\n <span title={event.title ?? reference}>{target}</span>\n )}\n </span>\n {event.sender || event.title ? (\n <span className=\"text-xs opacity-90\">\n {event.sender ? `by ${event.sender}` : null}\n {event.sender && event.title ? \" · \" : null}\n {event.title}\n </span>\n ) : null}\n {event.bodyExcerpt ? (\n <span className=\"truncate text-xs italic opacity-90\" title={event.bodyExcerpt}>\n “{event.bodyExcerpt}”\n </span>\n ) : null}\n </div>\n </div>\n );\n};\n\n/**\n * {@link WakeMarkerCard} bound to the assistant-ui message in scope. Selects\n * the message's `metadata.custom` (a stable store reference) and derives the\n * envelope from it: the reader allocates a fresh object per call, so selecting\n * its result directly would re-render on every store update.\n */\nexport const WakeMarkerMessage: FC<{ className?: string }> = ({ className }) => {\n const custom = useAuiState((s) => s.message.metadata?.custom);\n const event = useMemo(() => readGithubWakeEvent(custom), [custom]);\n if (!event) return null;\n return <WakeMarkerCard event={event} className={className} />;\n};\n"],"names":["githubWakeReference","jsxs","cn","jsx","GitPullRequestIcon","githubWakeEventLabel","useAuiState","useMemo","readGithubWakeEvent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwBO,MAAM,iBAA0C,CAAC,EAAE,OAAO,WAAW,GAAG,WAAW;AACxF,QAAM,SAAS,MAAM,WAAW,OAAO,IAAI,MAAM,MAAM,KAAK,MAAM;AAClE,QAAM,YAAYA,gBAAAA,oBAAoB,KAAK;AAC3C,SACEC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ,MAAK;AAAA,MACL,6BAA0B;AAAA,MAC1B,eAAY;AAAA,MACZ,WAAWC,OAAAA;AAAAA,QACT;AAAA,QACA;AAAA,MAAA;AAAA,MAGF,UAAA;AAAA,QAAAC,2BAAAA,IAACC,YAAAA,oBAAA,EAAmB,WAAU,0BAAyB,eAAY,QAAO;AAAA,QAC1EH,2BAAAA,KAAC,OAAA,EAAI,WAAU,6EACb,UAAA;AAAA,UAAAA,2BAAAA,KAAC,QAAA,EAAK,WAAU,eAAc,UAAA;AAAA,YAAA;AAAA,YACrBI,gBAAAA,qBAAqB,KAAK;AAAA,YAAE;AAAA,YAAI;AAAA,YACtC,MAAM,MACLF,2BAAAA;AAAAA,cAAC;AAAA,cAAA;AAAA,gBACC,MAAM,MAAM;AAAA,gBACZ,QAAO;AAAA,gBACP,KAAI;AAAA,gBACJ,OAAO,MAAM,SAAS;AAAA,gBACtB,WAAU;AAAA,gBAET,UAAA;AAAA,cAAA;AAAA,YAAA,IAGHA,2BAAAA,IAAC,QAAA,EAAK,OAAO,MAAM,SAAS,WAAY,UAAA,OAAA,CAAO;AAAA,UAAA,GAEnD;AAAA,UACC,MAAM,UAAU,MAAM,QACrBF,2BAAAA,KAAC,QAAA,EAAK,WAAU,sBACb,UAAA;AAAA,YAAA,MAAM,SAAS,MAAM,MAAM,MAAM,KAAK;AAAA,YACtC,MAAM,UAAU,MAAM,QAAQ,QAAQ;AAAA,YACtC,MAAM;AAAA,UAAA,EAAA,CACT,IACE;AAAA,UACH,MAAM,cACLA,gCAAC,QAAA,EAAK,WAAU,sCAAqC,OAAO,MAAM,aAAa,UAAA;AAAA,YAAA;AAAA,YAC3E,MAAM;AAAA,YAAY;AAAA,UAAA,EAAA,CACtB,IACE;AAAA,QAAA,EAAA,CACN;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;AAQO,MAAM,oBAAgD,CAAC,EAAE,gBAAgB;AAC9E,QAAM,SAASK,MAAAA,YAAY,CAAC;;AAAM,mBAAE,QAAQ,aAAV,mBAAoB;AAAA,GAAM;AAC5D,QAAM,QAAQC,QAAAA,QAAQ,MAAMC,gBAAAA,oBAAoB,MAAM,GAAG,CAAC,MAAM,CAAC;AACjE,MAAI,CAAC,MAAO,QAAO;AACnB,SAAOL,2BAAAA,IAAC,gBAAA,EAAe,OAAc,UAAA,CAAsB;AAC7D;;;"}
1
+ {"version":3,"file":"wake-marker.cjs","sources":["../../../src/chat-ui/messages/wake-marker.tsx"],"sourcesContent":["/**\n * The runtime marker for a wake turn: a GitHub webhook woke the session and\n * injected a user message (see `@athenaintel/agent-runtime`'s\n * `github-wake-event.ts`). It renders in the same visual language as the\n * runtime-ending card (`RuntimeMessageCard`) — a compact status row, not a\n * user bubble quoting the whole wake text.\n */\nimport { useAuiState } from \"@assistant-ui/react\";\nimport {\n type GithubWakeEvent,\n githubWakeEventLabel,\n githubWakeReference,\n readGithubWakeEvent,\n} from \"@athenaintel/agent-runtime\";\nimport { GitPullRequestIcon } from \"lucide-react\";\nimport { type ComponentPropsWithoutRef, type FC, useMemo } from \"react\";\nimport { cn } from \"../../lib/utils\";\n\nexport interface WakeMarkerCardProps\n extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\" | \"role\"> {\n event: GithubWakeEvent;\n}\n\n/** The \"Woke: review comment on #36337\" row; pure presenter. */\nexport const WakeMarkerCard: FC<WakeMarkerCardProps> = ({ event, className, ...rest }) => {\n const target = event.number !== null ? `#${event.number}` : event.repo;\n const reference = githubWakeReference(event);\n return (\n <div\n {...rest}\n role=\"status\"\n data-runtime-message-kind=\"wake\"\n data-testid=\"wake-marker\"\n className={cn(\n \"my-2 flex w-full items-start gap-2 rounded-lg border border-border bg-muted/40 px-3 py-2 text-muted-foreground text-sm\",\n className,\n )}\n >\n <GitPullRequestIcon className=\"mt-0.5 size-4 shrink-0\" aria-hidden=\"true\" />\n <div className=\"flex min-w-0 flex-1 flex-col gap-0.5 break-words [overflow-wrap:anywhere]\">\n <span className=\"font-medium\">\n Woke: {githubWakeEventLabel(event)} on{\" \"}\n {event.url ? (\n <a\n href={event.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n title={event.title ?? reference}\n className=\"underline-offset-2 hover:underline\"\n >\n {target}\n </a>\n ) : (\n <span title={event.title ?? reference}>{target}</span>\n )}\n </span>\n {event.sender || event.title ? (\n <span className=\"text-xs opacity-90\">\n {event.sender ? `by ${event.sender}` : null}\n {event.sender && event.title ? \" · \" : null}\n {event.title}\n </span>\n ) : null}\n {event.bodyExcerpt ? (\n <span className=\"truncate text-xs italic opacity-90\" title={event.bodyExcerpt}>\n “{event.bodyExcerpt}”\n </span>\n ) : null}\n </div>\n </div>\n );\n};\n\n/**\n * {@link WakeMarkerCard} bound to the assistant-ui message in scope. Selects\n * the message's `metadata.custom` (a stable store reference) and derives the\n * envelope from it: the reader allocates a fresh object per call, so selecting\n * its result directly would re-render on every store update.\n */\nexport const WakeMarkerMessage: FC<{ className?: string }> = ({ className }) => {\n const custom = useAuiState((s) => s.message.metadata?.custom);\n const event = useMemo(() => readGithubWakeEvent(custom), [custom]);\n if (!event) return null;\n return <WakeMarkerCard event={event} className={className} />;\n};\n"],"names":["githubWakeReference","jsxs","cn","j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AA,UACH,MAAM,cACLA,gCAAC,QAAA,EAAK,WAAU,sCAAqC,OAAO,MAAM,aAAa,UAAA;AAAA,YAAA;AAAA,YAC3E,MAAM;AAAA,YAAY;AAAA,UAAA,EAAA,CACtB,IACE;AAAA,QAAA,EAAA,CACN;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;AAQO,MAAM,oBAAgD,CAAC,EAAE,gBAAgB;AAC9E,QAAM,SAASK,MAAAA,YAAY,CAAC;;AAAM,mBAAE,QAAQ,aAAV,mBAAoB;AAAA,GAAM;AAC5D,QAAM,QAAQC,QAAAA,QAAQ,MAAMC,gBAAAA,oBAAoB,MAAM,GAAG,CAAC,MAAM,CAAC;AACjE,MAAI,CAAC,MAAO,QAAO;AACnB,SAAOL,2BAAAA,IAAC,gBAAA,EAAe,OAAc,UAAA,CAAsB;AAC7D;;;"}
@@ -1,23 +1,8 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useAuiState } from "@assistant-ui/react";
3
- import "../../packages/agent-runtime/src/generated/runconfig-contract.js";
3
+ import { GitPullRequestIcon } from "lucide-react";
4
4
  import { useMemo } from "react";
5
- import "@assistant-ui/tap";
6
- import "statewire";
7
- import "../../packages/agent-runtime/src/statewire-suspended.js";
8
- import "../../packages/agent-runtime/src/conversation-list.js";
9
- import "@tanstack/react-query";
10
- import "../../packages/agent-runtime/src/statewire-state.js";
11
- import "../../packages/agent-runtime/src/messages.js";
12
- import "@assistant-ui/store";
13
- import "../../packages/agent-runtime/src/quota-safe-local-storage-session.js";
14
- import "../../packages/agent-runtime/src/statewire-attach-observer.js";
15
- import "../../packages/agent-runtime/src/thread-status.js";
16
- import "@assistant-ui/react-statewire";
17
5
  import { githubWakeReference, githubWakeEventLabel, readGithubWakeEvent } from "../../packages/agent-runtime/src/github-wake-event.js";
18
- import "@assistant-ui/core";
19
- import "../../packages/agent-runtime/src/thread-handoff.js";
20
- import { GitPullRequestIcon } from "lucide-react";
21
6
  import { cn } from "cnfast";
22
7
  const WakeMarkerCard = ({ event, className, ...rest }) => {
23
8
  const target = event.number !== null ? `#${event.number}` : event.repo;
@@ -1 +1 @@
1
- {"version":3,"file":"wake-marker.js","sources":["../../../src/chat-ui/messages/wake-marker.tsx"],"sourcesContent":["/**\n * The runtime marker for a wake turn: a GitHub webhook woke the session and\n * injected a user message (see `@athenaintel/agent-runtime`'s\n * `github-wake-event.ts`). It renders in the same visual language as the\n * runtime-ending card (`RuntimeMessageCard`) — a compact status row, not a\n * user bubble quoting the whole wake text.\n */\nimport { useAuiState } from \"@assistant-ui/react\";\nimport {\n type GithubWakeEvent,\n githubWakeEventLabel,\n githubWakeReference,\n readGithubWakeEvent,\n} from \"@athenaintel/agent-runtime\";\nimport { GitPullRequestIcon } from \"lucide-react\";\nimport { type ComponentPropsWithoutRef, type FC, useMemo } from \"react\";\nimport { cn } from \"../../lib/utils\";\n\nexport interface WakeMarkerCardProps\n extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\" | \"role\"> {\n event: GithubWakeEvent;\n}\n\n/** The \"Woke: review comment on #36337\" row; pure presenter. */\nexport const WakeMarkerCard: FC<WakeMarkerCardProps> = ({ event, className, ...rest }) => {\n const target = event.number !== null ? `#${event.number}` : event.repo;\n const reference = githubWakeReference(event);\n return (\n <div\n {...rest}\n role=\"status\"\n data-runtime-message-kind=\"wake\"\n data-testid=\"wake-marker\"\n className={cn(\n \"my-2 flex w-full items-start gap-2 rounded-lg border border-border bg-muted/40 px-3 py-2 text-muted-foreground text-sm\",\n className,\n )}\n >\n <GitPullRequestIcon className=\"mt-0.5 size-4 shrink-0\" aria-hidden=\"true\" />\n <div className=\"flex min-w-0 flex-1 flex-col gap-0.5 break-words [overflow-wrap:anywhere]\">\n <span className=\"font-medium\">\n Woke: {githubWakeEventLabel(event)} on{\" \"}\n {event.url ? (\n <a\n href={event.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n title={event.title ?? reference}\n className=\"underline-offset-2 hover:underline\"\n >\n {target}\n </a>\n ) : (\n <span title={event.title ?? reference}>{target}</span>\n )}\n </span>\n {event.sender || event.title ? (\n <span className=\"text-xs opacity-90\">\n {event.sender ? `by ${event.sender}` : null}\n {event.sender && event.title ? \" · \" : null}\n {event.title}\n </span>\n ) : null}\n {event.bodyExcerpt ? (\n <span className=\"truncate text-xs italic opacity-90\" title={event.bodyExcerpt}>\n “{event.bodyExcerpt}”\n </span>\n ) : null}\n </div>\n </div>\n );\n};\n\n/**\n * {@link WakeMarkerCard} bound to the assistant-ui message in scope. Selects\n * the message's `metadata.custom` (a stable store reference) and derives the\n * envelope from it: the reader allocates a fresh object per call, so selecting\n * its result directly would re-render on every store update.\n */\nexport const WakeMarkerMessage: FC<{ className?: string }> = ({ className }) => {\n const custom = useAuiState((s) => s.message.metadata?.custom);\n const event = useMemo(() => readGithubWakeEvent(custom), [custom]);\n if (!event) return null;\n return <WakeMarkerCard event={event} className={className} />;\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwBO,MAAM,iBAA0C,CAAC,EAAE,OAAO,WAAW,GAAG,WAAW;AACxF,QAAM,SAAS,MAAM,WAAW,OAAO,IAAI,MAAM,MAAM,KAAK,MAAM;AAClE,QAAM,YAAY,oBAAoB,KAAK;AAC3C,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ,MAAK;AAAA,MACL,6BAA0B;AAAA,MAC1B,eAAY;AAAA,MACZ,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MAAA;AAAA,MAGF,UAAA;AAAA,QAAA,oBAAC,oBAAA,EAAmB,WAAU,0BAAyB,eAAY,QAAO;AAAA,QAC1E,qBAAC,OAAA,EAAI,WAAU,6EACb,UAAA;AAAA,UAAA,qBAAC,QAAA,EAAK,WAAU,eAAc,UAAA;AAAA,YAAA;AAAA,YACrB,qBAAqB,KAAK;AAAA,YAAE;AAAA,YAAI;AAAA,YACtC,MAAM,MACL;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,MAAM,MAAM;AAAA,gBACZ,QAAO;AAAA,gBACP,KAAI;AAAA,gBACJ,OAAO,MAAM,SAAS;AAAA,gBACtB,WAAU;AAAA,gBAET,UAAA;AAAA,cAAA;AAAA,YAAA,IAGH,oBAAC,QAAA,EAAK,OAAO,MAAM,SAAS,WAAY,UAAA,OAAA,CAAO;AAAA,UAAA,GAEnD;AAAA,UACC,MAAM,UAAU,MAAM,QACrB,qBAAC,QAAA,EAAK,WAAU,sBACb,UAAA;AAAA,YAAA,MAAM,SAAS,MAAM,MAAM,MAAM,KAAK;AAAA,YACtC,MAAM,UAAU,MAAM,QAAQ,QAAQ;AAAA,YACtC,MAAM;AAAA,UAAA,EAAA,CACT,IACE;AAAA,UACH,MAAM,cACL,qBAAC,QAAA,EAAK,WAAU,sCAAqC,OAAO,MAAM,aAAa,UAAA;AAAA,YAAA;AAAA,YAC3E,MAAM;AAAA,YAAY;AAAA,UAAA,EAAA,CACtB,IACE;AAAA,QAAA,EAAA,CACN;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;AAQO,MAAM,oBAAgD,CAAC,EAAE,gBAAgB;AAC9E,QAAM,SAAS,YAAY,CAAC;;AAAM,mBAAE,QAAQ,aAAV,mBAAoB;AAAA,GAAM;AAC5D,QAAM,QAAQ,QAAQ,MAAM,oBAAoB,MAAM,GAAG,CAAC,MAAM,CAAC;AACjE,MAAI,CAAC,MAAO,QAAO;AACnB,SAAO,oBAAC,gBAAA,EAAe,OAAc,UAAA,CAAsB;AAC7D;"}
1
+ {"version":3,"file":"wake-marker.js","sources":["../../../src/chat-ui/messages/wake-marker.tsx"],"sourcesContent":["/**\n * The runtime marker for a wake turn: a GitHub webhook woke the session and\n * injected a user message (see `@athenaintel/agent-runtime`'s\n * `github-wake-event.ts`). It renders in the same visual language as the\n * runtime-ending card (`RuntimeMessageCard`) — a compact status row, not a\n * user bubble quoting the whole wake text.\n */\nimport { useAuiState } from \"@assistant-ui/react\";\nimport {\n type GithubWakeEvent,\n githubWakeEventLabel,\n githubWakeReference,\n readGithubWakeEvent,\n} from \"@athenaintel/agent-runtime\";\nimport { GitPullRequestIcon } from \"lucide-react\";\nimport { type ComponentPropsWithoutRef, type FC, useMemo } from \"react\";\nimport { cn } from \"../../lib/utils\";\n\nexport interface WakeMarkerCardProps\n extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\" | \"role\"> {\n event: GithubWakeEvent;\n}\n\n/** The \"Woke: review comment on #36337\" row; pure presenter. */\nexport const WakeMarkerCard: FC<WakeMarkerCardProps> = ({ event, className, ...rest }) => {\n const target = event.number !== null ? `#${event.number}` : event.repo;\n const reference = githubWakeReference(event);\n return (\n <div\n {...rest}\n role=\"status\"\n data-runtime-message-kind=\"wake\"\n data-testid=\"wake-marker\"\n className={cn(\n \"my-2 flex w-full items-start gap-2 rounded-lg border border-border bg-muted/40 px-3 py-2 text-muted-foreground text-sm\",\n className,\n )}\n >\n <GitPullRequestIcon className=\"mt-0.5 size-4 shrink-0\" aria-hidden=\"true\" />\n <div className=\"flex min-w-0 flex-1 flex-col gap-0.5 break-words [overflow-wrap:anywhere]\">\n <span className=\"font-medium\">\n Woke: {githubWakeEventLabel(event)} on{\" \"}\n {event.url ? (\n <a\n href={event.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n title={event.title ?? reference}\n className=\"underline-offset-2 hover:underline\"\n >\n {target}\n </a>\n ) : (\n <span title={event.title ?? reference}>{target}</span>\n )}\n </span>\n {event.sender || event.title ? (\n <span className=\"text-xs opacity-90\">\n {event.sender ? `by ${event.sender}` : null}\n {event.sender && event.title ? \" · \" : null}\n {event.title}\n </span>\n ) : null}\n {event.bodyExcerpt ? (\n <span className=\"truncate text-xs italic opacity-90\" title={event.bodyExcerpt}>\n “{event.bodyExcerpt}”\n </span>\n ) : null}\n </div>\n </div>\n );\n};\n\n/**\n * {@link WakeMarkerCard} bound to the assistant-ui message in scope. Selects\n * the message's `metadata.custom` (a stable store reference) and derives the\n * envelope from it: the reader allocates a fresh object per call, so selecting\n * its result directly would re-render on every store update.\n */\nexport const WakeMarkerMessage: FC<{ className?: string }> = ({ className }) => {\n const custom = useAuiState((s) => s.message.metadata?.custom);\n const event = useMemo(() => readGithubWakeEvent(custom), [custom]);\n if (!event) return null;\n return <WakeMarkerCard event={event} className={className} />;\n};\n"],"names":[],"mappings":";;;;;;AAwBO,MAAM,iBAA0C,CAAC,EAAE,OAAO,WAAW,GAAG,WAAW;AACxF,QAAM,SAAS,MAAM,WAAW,OAAO,IAAI,MAAM,MAAM,KAAK,MAAM;AAClE,QAAM,YAAY,oBAAoB,KAAK;AAC3C,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ,MAAK;AAAA,MACL,6BAA0B;AAAA,MAC1B,eAAY;AAAA,MACZ,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MAAA;AAAA,MAGF,UAAA;AAAA,QAAA,oBAAC,oBAAA,EAAmB,WAAU,0BAAyB,eAAY,QAAO;AAAA,QAC1E,qBAAC,OAAA,EAAI,WAAU,6EACb,UAAA;AAAA,UAAA,qBAAC,QAAA,EAAK,WAAU,eAAc,UAAA;AAAA,YAAA;AAAA,YACrB,qBAAqB,KAAK;AAAA,YAAE;AAAA,YAAI;AAAA,YACtC,MAAM,MACL;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,MAAM,MAAM;AAAA,gBACZ,QAAO;AAAA,gBACP,KAAI;AAAA,gBACJ,OAAO,MAAM,SAAS;AAAA,gBACtB,WAAU;AAAA,gBAET,UAAA;AAAA,cAAA;AAAA,YAAA,IAGH,oBAAC,QAAA,EAAK,OAAO,MAAM,SAAS,WAAY,UAAA,OAAA,CAAO;AAAA,UAAA,GAEnD;AAAA,UACC,MAAM,UAAU,MAAM,QACrB,qBAAC,QAAA,EAAK,WAAU,sBACb,UAAA;AAAA,YAAA,MAAM,SAAS,MAAM,MAAM,MAAM,KAAK;AAAA,YACtC,MAAM,UAAU,MAAM,QAAQ,QAAQ;AAAA,YACtC,MAAM;AAAA,UAAA,EAAA,CACT,IACE;AAAA,UACH,MAAM,cACL,qBAAC,QAAA,EAAK,WAAU,sCAAqC,OAAO,MAAM,aAAa,UAAA;AAAA,YAAA;AAAA,YAC3E,MAAM;AAAA,YAAY;AAAA,UAAA,EAAA,CACtB,IACE;AAAA,QAAA,EAAA,CACN;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;AAQO,MAAM,oBAAgD,CAAC,EAAE,gBAAgB;AAC9E,QAAM,SAAS,YAAY,CAAC;;AAAM,mBAAE,QAAQ,aAAV,mBAAoB;AAAA,GAAM;AAC5D,QAAM,QAAQ,QAAQ,MAAM,oBAAoB,MAAM,GAAG,CAAC,MAAM,CAAC;AACjE,MAAI,CAAC,MAAO,QAAO;AACnB,SAAO,oBAAC,gBAAA,EAAe,OAAc,UAAA,CAAsB;AAC7D;"}
@@ -10,23 +10,7 @@ const runtimeMessage = require("./messages/runtime-message.cjs");
10
10
  const wakeMarker = require("./messages/wake-marker.cjs");
11
11
  const WaitingOnYouBanner = require("../chat/WaitingOnYouBanner.cjs");
12
12
  const statewireContinueRun = require("./messages/statewire-continue-run.cjs");
13
- require("../packages/agent-runtime/src/generated/runconfig-contract.cjs");
14
- require("react");
15
- require("@assistant-ui/tap");
16
- require("statewire");
17
- require("../packages/agent-runtime/src/statewire-suspended.cjs");
18
- require("../packages/agent-runtime/src/conversation-list.cjs");
19
- require("@tanstack/react-query");
20
13
  const interrupts = require("../packages/agent-runtime/src/interrupts.cjs");
21
- require("../packages/agent-runtime/src/messages.cjs");
22
- require("../packages/agent-runtime/src/statewire-state.cjs");
23
- require("@assistant-ui/store");
24
- require("../packages/agent-runtime/src/quota-safe-local-storage-session.cjs");
25
- require("../packages/agent-runtime/src/statewire-attach-observer.cjs");
26
- require("../packages/agent-runtime/src/thread-status.cjs");
27
- require("@assistant-ui/react-statewire");
28
- require("@assistant-ui/core");
29
- require("../packages/agent-runtime/src/thread-handoff.cjs");
30
14
  exports.StatewireApprovalCard = StatewireApprovalCard.StatewireApprovalCard;
31
15
  exports.useStatewireApprovalRequest = useStatewireApprovalRequest.useStatewireApprovalRequest;
32
16
  exports.StatewireQueuedMessages = StatewireQueuedMessages.StatewireQueuedMessages;
@@ -1 +1 @@
1
- {"version":3,"file":"statewire.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"statewire.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -8,23 +8,7 @@ import { RuntimeMessageCard } from "./messages/runtime-message.js";
8
8
  import { WakeMarkerCard, WakeMarkerMessage } from "./messages/wake-marker.js";
9
9
  import { WaitingOnYouBanner, WaitingOnYouBannerView } from "../chat/WaitingOnYouBanner.js";
10
10
  import { StatewireContinueRunAffordance, StatewireContinueRunButton, StatewireRunEndedFooter } from "./messages/statewire-continue-run.js";
11
- import "../packages/agent-runtime/src/generated/runconfig-contract.js";
12
- import "react";
13
- import "@assistant-ui/tap";
14
- import "statewire";
15
- import "../packages/agent-runtime/src/statewire-suspended.js";
16
- import "../packages/agent-runtime/src/conversation-list.js";
17
- import "@tanstack/react-query";
18
11
  import { HITL_PENDING_RESUME_GRACE_MS } from "../packages/agent-runtime/src/interrupts.js";
19
- import "../packages/agent-runtime/src/messages.js";
20
- import "../packages/agent-runtime/src/statewire-state.js";
21
- import "@assistant-ui/store";
22
- import "../packages/agent-runtime/src/quota-safe-local-storage-session.js";
23
- import "../packages/agent-runtime/src/statewire-attach-observer.js";
24
- import "../packages/agent-runtime/src/thread-status.js";
25
- import "@assistant-ui/react-statewire";
26
- import "@assistant-ui/core";
27
- import "../packages/agent-runtime/src/thread-handoff.js";
28
12
  export {
29
13
  ContinuePill,
30
14
  HITL_PENDING_RESUME_GRACE_MS,
@@ -1 +1 @@
1
- {"version":3,"file":"statewire.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"statewire.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
@@ -2,25 +2,10 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const react = require("@assistant-ui/react");
5
- require("../../packages/agent-runtime/src/generated/runconfig-contract.cjs");
6
5
  const react$1 = require("react");
7
- require("@assistant-ui/tap");
8
- require("statewire");
9
- const errors = require("../../packages/agent-runtime/src/errors.cjs");
10
- require("../../packages/agent-runtime/src/statewire-suspended.cjs");
11
- require("../../packages/agent-runtime/src/conversation-list.cjs");
12
- require("@tanstack/react-query");
13
- require("../../packages/agent-runtime/src/statewire-state.cjs");
14
- require("../../packages/agent-runtime/src/messages.cjs");
15
- const useDeepAgentWindowSync = require("../../packages/agent-runtime/src/use-deep-agent-window-sync.cjs");
16
- require("@assistant-ui/store");
17
- require("../../packages/agent-runtime/src/quota-safe-local-storage-session.cjs");
18
- require("../../packages/agent-runtime/src/statewire-attach-observer.cjs");
19
- require("../../packages/agent-runtime/src/thread-status.cjs");
20
- require("@assistant-ui/react-statewire");
21
- require("@assistant-ui/core");
22
- require("../../packages/agent-runtime/src/thread-handoff.cjs");
23
6
  const statewireWindowContext = require("../../provider/statewire-window-context.cjs");
7
+ const useDeepAgentWindowSync = require("../../packages/agent-runtime/src/use-deep-agent-window-sync.cjs");
8
+ const errors = require("../../packages/agent-runtime/src/errors.cjs");
24
9
  const cnfast = require("cnfast");
25
10
  const THREAD_VIEWPORT_ATTR = "data-aui-thread-viewport";
26
11
  const HISTORY_EDGE_NEAR_MARGIN_PX = 1500;
@@ -1 +1 @@
1
- {"version":3,"file":"statewire-history-edge.cjs","sources":["../../../src/chat-ui/thread/statewire-history-edge.tsx"],"sourcesContent":["import { useAuiState } from \"@assistant-ui/react\";\nimport {\n type DeepAgentHistoryLoadEvent,\n type DeepAgentToolOutputStore,\n isStatewireChannelTeardown,\n useDeepAgentWindowSync,\n} from \"@athenaintel/agent-runtime\";\nimport type { FC } from \"react\";\nimport { useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport { useStatewireToolOutputs } from \"../../provider/statewire-window-context\";\n\n/** The attribute `ChatThreadShell` stamps on the scroll viewport. */\nexport const THREAD_VIEWPORT_ATTR = \"data-aui-thread-viewport\";\n\n/**\n * How far above the viewport the edge row counts as near: the row sits above\n * the first loaded message, so reaching it means the user has scrolled past\n * everything loaded and the next page should already be on its way.\n */\nexport const HISTORY_EDGE_NEAR_MARGIN_PX = 1500;\n\nexport interface HistoryEdgeRowProps {\n /** Whether the server holds messages older than the loaded window. */\n hasOlder: boolean;\n /** Whether the next page can be asked for; `false` with `hasOlder` is the connection's loading depth spent. Defaults to `hasOlder`. */\n canLoadOlder?: boolean;\n /** A page of older history is in flight. */\n loading: boolean;\n onLoadOlder: () => void;\n className?: string;\n /** The row element, for the viewport observer. */\n rowRef?: (element: HTMLElement | null) => void;\n}\n\n/**\n * The top edge of the LOADED history: a manual way to load the next page of\n * older messages, and the in-flight state. Renders nothing when the whole\n * transcript is loaded (or the head interest has not resolved).\n */\nexport const HistoryEdgeRow: FC<HistoryEdgeRowProps> = ({\n hasOlder,\n canLoadOlder = hasOlder,\n loading,\n onLoadOlder,\n className,\n rowRef,\n}) => {\n if (!hasOlder) return null;\n return (\n <div\n ref={rowRef}\n data-testid=\"thread-history-edge\"\n className={cn(\n \"flex w-full max-w-(--thread-max-width) items-center justify-center py-1 text-xs text-muted-foreground\",\n className,\n )}\n >\n {loading ? (\n <span data-testid=\"thread-history-edge-loading\">Loading earlier messages…</span>\n ) : canLoadOlder ? (\n <button\n type=\"button\"\n data-testid=\"thread-history-edge-load\"\n onClick={onLoadOlder}\n className=\"rounded-lg px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n Load earlier messages\n </button>\n ) : (\n <span data-testid=\"thread-history-edge-limit\">Earlier messages can't be loaded here</span>\n )}\n </div>\n );\n};\n\nexport interface StatewireHistoryEdgeProps {\n /**\n * The thread's tool-output store (the one its converter substitutes from).\n * Defaults to `AthenaProvider`'s; hosts mounting the runtime themselves pass\n * the store they gave `useDeepAgentRuntime({ toolOutputs })`.\n */\n toolOutputs?: DeepAgentToolOutputStore;\n className?: string;\n /** A page interest resolved (telemetry). */\n onHistoryLoad?: (event: DeepAgentHistoryLoadEvent) => void;\n}\n\n/**\n * The client half of the interest window for a DOM thread — mounted once per\n * thread, inside the scroll viewport above the messages (`ChatThreadShell`'s\n * `beforeMessages` slot):\n *\n * - renders the \"Load earlier messages\" edge row and loads the next page when\n * the row comes near the viewport (scrolling up) or on its button, keeping\n * the reading position when the page lands above the view;\n * - fetches cut tool outputs whole for the rendered cards, so they re-render\n * complete through the converter (`toolOutputs`).\n *\n * Inert until the head interest resolves: no row, no reads.\n */\nexport const StatewireHistoryEdge: FC<StatewireHistoryEdgeProps> = ({\n toolOutputs: toolOutputsProp,\n className,\n onHistoryLoad,\n}) => {\n const providerToolOutputs = useStatewireToolOutputs();\n const toolOutputs = toolOutputsProp ?? providerToolOutputs ?? undefined;\n const messages = useAuiState((s) => s.thread.messages);\n const [nearTop, setNearTop] = useState(false);\n const [nearTopEpoch, setNearTopEpoch] = useState(0);\n const nearTopRef = useRef(false);\n const [rowEl, setRowEl] = useState<HTMLElement | null>(null);\n const { hasOlder, canLoadOlder, loading, loadOlder } = useDeepAgentWindowSync({\n messages,\n toolOutputs,\n nearTop,\n nearTopEpoch,\n onHistoryLoad,\n onError: (error, command) => {\n // Leaving the thread settles an in-flight read as lost: lifecycle, not a failure.\n if (error instanceof Error && isStatewireChannelTeardown(error)) return;\n console.warn(`[StatewireHistoryEdge] ${command} failed:`, error);\n },\n });\n\n // The row's own visibility is the near-top level: a level, not an edge, so\n // pages chain while the user stays at the top and stop once the prepended\n // content has pushed the row away again.\n useEffect(() => {\n if (!rowEl || !hasOlder || typeof IntersectionObserver === \"undefined\") return;\n const observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n const near = entry.isIntersecting;\n if (nearTopRef.current === near) continue;\n nearTopRef.current = near;\n setNearTop(near);\n if (near) setNearTopEpoch((epoch) => epoch + 1);\n }\n },\n {\n root: rowEl.closest<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`),\n rootMargin: `${HISTORY_EDGE_NEAR_MARGIN_PX}px 0px`,\n },\n );\n observer.observe(rowEl);\n return () => {\n observer.disconnect();\n nearTopRef.current = false;\n setNearTop(false);\n };\n }, [rowEl, hasOlder]);\n\n // A prepend (older history landing) keeps the reading position: the\n // viewport scrolls by the height the page added above the view, so the\n // message the user was on stays put. The pre-prepend height is measured\n // only while a page is in flight (a layout read per render would force a\n // reflow on every streamed token otherwise).\n const shapeRef = useRef<{ firstId: string | undefined; length: number; scrollHeight: number } | null>(\n null,\n );\n const firstId = messages[0]?.id;\n const length = messages.length;\n useLayoutEffect(() => {\n const viewport = rowEl?.closest<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`) ?? null;\n const prev = shapeRef.current;\n const prepended =\n viewport !== null &&\n prev !== null &&\n prev.firstId !== undefined &&\n firstId !== prev.firstId &&\n length > prev.length;\n if (prepended) viewport.scrollTop += viewport.scrollHeight - prev.scrollHeight;\n shapeRef.current =\n loading || prepended || prev === null\n ? { firstId, length, scrollHeight: viewport?.scrollHeight ?? 0 }\n : { firstId, length, scrollHeight: prev.scrollHeight };\n });\n\n return (\n <HistoryEdgeRow\n rowRef={setRowEl}\n hasOlder={hasOlder}\n canLoadOlder={canLoadOlder}\n loading={loading}\n onLoadOlder={loadOlder}\n className={className}\n />\n );\n};\n"],"names":["jsx","cn","useStatewireToolOutputs","useAuiState","useState","useRef","useDeepAgentWindowSync","isStatewireChannelTeardown","useEffect","useLayoutEffect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAaO,MAAM,uBAAuB;AAO7B,MAAM,8BAA8B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AA,IAAA;AAAA,MACC,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA,aAAa;AAAA,MACb;AAAA,IAAA;AAAA,EAAA;AAGN;;;;;"}
1
+ {"version":3,"file":"statewire-history-edge.cjs","sources":["../../../src/chat-ui/thread/statewire-history-edge.tsx"],"sourcesContent":["import { useAuiState } from \"@assistant-ui/react\";\nimport {\n type DeepAgentHistoryLoadEvent,\n type DeepAgentToolOutputStore,\n isStatewireChannelTeardown,\n useDeepAgentWindowSync,\n} from \"@athenaintel/agent-runtime\";\nimport type { FC } from \"react\";\nimport { useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport { useStatewireToolOutputs } from \"../../provider/statewire-window-context\";\n\n/** The attribute `ChatThreadShell` stamps on the scroll viewport. */\nexport const THREAD_VIEWPORT_ATTR = \"data-aui-thread-viewport\";\n\n/**\n * How far above the viewport the edge row counts as near: the row sits above\n * the first loaded message, so reaching it means the user has scrolled past\n * everything loaded and the next page should already be on its way.\n */\nexport const HISTORY_EDGE_NEAR_MARGIN_PX = 1500;\n\nexport interface HistoryEdgeRowProps {\n /** Whether the server holds messages older than the loaded window. */\n hasOlder: boolean;\n /** Whether the next page can be asked for; `false` with `hasOlder` is the connection's loading depth spent. Defaults to `hasOlder`. */\n canLoadOlder?: boolean;\n /** A page of older history is in flight. */\n loading: boolean;\n onLoadOlder: () => void;\n className?: string;\n /** The row element, for the viewport observer. */\n rowRef?: (element: HTMLElement | null) => void;\n}\n\n/**\n * The top edge of the LOADED history: a manual way to load the next page of\n * older messages, and the in-flight state. Renders nothing when the whole\n * transcript is loaded (or the head interest has not resolved).\n */\nexport const HistoryEdgeRow: FC<HistoryEdgeRowProps> = ({\n hasOlder,\n canLoadOlder = hasOlder,\n loading,\n onLoadOlder,\n className,\n rowRef,\n}) => {\n if (!hasOlder) return null;\n return (\n <div\n ref={rowRef}\n data-testid=\"thread-history-edge\"\n className={cn(\n \"flex w-full max-w-(--thread-max-width) items-center justify-center py-1 text-xs text-muted-foreground\",\n className,\n )}\n >\n {loading ? (\n <span data-testid=\"thread-history-edge-loading\">Loading earlier messages…</span>\n ) : canLoadOlder ? (\n <button\n type=\"button\"\n data-testid=\"thread-history-edge-load\"\n onClick={onLoadOlder}\n className=\"rounded-lg px-2.5 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n >\n Load earlier messages\n </button>\n ) : (\n <span data-testid=\"thread-history-edge-limit\">Earlier messages can't be loaded here</span>\n )}\n </div>\n );\n};\n\nexport interface StatewireHistoryEdgeProps {\n /**\n * The thread's tool-output store (the one its converter substitutes from).\n * Defaults to `AthenaProvider`'s; hosts mounting the runtime themselves pass\n * the store they gave `useDeepAgentRuntime({ toolOutputs })`.\n */\n toolOutputs?: DeepAgentToolOutputStore;\n className?: string;\n /** A page interest resolved (telemetry). */\n onHistoryLoad?: (event: DeepAgentHistoryLoadEvent) => void;\n}\n\n/**\n * The client half of the interest window for a DOM thread — mounted once per\n * thread, inside the scroll viewport above the messages (`ChatThreadShell`'s\n * `beforeMessages` slot):\n *\n * - renders the \"Load earlier messages\" edge row and loads the next page when\n * the row comes near the viewport (scrolling up) or on its button, keeping\n * the reading position when the page lands above the view;\n * - fetches cut tool outputs whole for the rendered cards, so they re-render\n * complete through the converter (`toolOutputs`).\n *\n * Inert until the head interest resolves: no row, no reads.\n */\nexport const StatewireHistoryEdge: FC<StatewireHistoryEdgeProps> = ({\n toolOutputs: toolOutputsProp,\n className,\n onHistoryLoad,\n}) => {\n const providerToolOutputs = useStatewireToolOutputs();\n const toolOutputs = toolOutputsProp ?? providerToolOutputs ?? undefined;\n const messages = useAuiState((s) => s.thread.messages);\n const [nearTop, setNearTop] = useState(false);\n const [nearTopEpoch, setNearTopEpoch] = useState(0);\n const nearTopRef = useRef(false);\n const [rowEl, setRowEl] = useState<HTMLElement | null>(null);\n const { hasOlder, canLoadOlder, loading, loadOlder } = useDeepAgentWindowSync({\n messages,\n toolOutputs,\n nearTop,\n nearTopEpoch,\n onHistoryLoad,\n onError: (error, command) => {\n // Leaving the thread settles an in-flight read as lost: lifecycle, not a failure.\n if (error instanceof Error && isStatewireChannelTeardown(error)) return;\n console.warn(`[StatewireHistoryEdge] ${command} failed:`, error);\n },\n });\n\n // The row's own visibility is the near-top level: a level, not an edge, so\n // pages chain while the user stays at the top and stop once the prepended\n // content has pushed the row away again.\n useEffect(() => {\n if (!rowEl || !hasOlder || typeof IntersectionObserver === \"undefined\") return;\n const observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n const near = entry.isIntersecting;\n if (nearTopRef.current === near) continue;\n nearTopRef.current = near;\n setNearTop(near);\n if (near) setNearTopEpoch((epoch) => epoch + 1);\n }\n },\n {\n root: rowEl.closest<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`),\n rootMargin: `${HISTORY_EDGE_NEAR_MARGIN_PX}px 0px`,\n },\n );\n observer.observe(rowEl);\n return () => {\n observer.disconnect();\n nearTopRef.current = false;\n setNearTop(false);\n };\n }, [rowEl, hasOlder]);\n\n // A prepend (older history landing) keeps the reading position: the\n // viewport scrolls by the height the page added above the view, so the\n // message the user was on stays put. The pre-prepend height is measured\n // only while a page is in flight (a layout read per render would force a\n // reflow on every streamed token otherwise).\n const shapeRef = useRef<{ firstId: string | undefined; length: number; scrollHeight: number } | null>(\n null,\n );\n const firstId = messages[0]?.id;\n const length = messages.length;\n useLayoutEffect(() => {\n const viewport = rowEl?.closest<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`) ?? null;\n const prev = shapeRef.current;\n const prepended =\n viewport !== null &&\n prev !== null &&\n prev.firstId !== undefined &&\n firstId !== prev.firstId &&\n length > prev.length;\n if (prepended) viewport.scrollTop += viewport.scrollHeight - prev.scrollHeight;\n shapeRef.current =\n loading || prepended || prev === null\n ? { firstId, length, scrollHeight: viewport?.scrollHeight ?? 0 }\n : { firstId, length, scrollHeight: prev.scrollHeight };\n });\n\n return (\n <HistoryEdgeRow\n rowRef={setRowEl}\n hasOlder={hasOlder}\n canLoadOlder={canLoadOlder}\n loading={loading}\n onLoadOlder={loadOlder}\n className={className}\n />\n );\n};\n"],"names":["jsx","cn","useStatewireToolOutputs","useAuiState","useState","useRef","useDeepAgentWindowSync","isStatewireChannelTeardown","useEffect","useLayoutEffect"],"mappings":";;;;;;;;;AAaO,MAAM,uBAAuB;AAO7B,MAAM,8BAA8B;AAoBpC,MAAM,iBAA0C,CAAC;AAAA,EACtD;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,MAAI,CAAC,SAAU,QAAO;AACtB,SACEA,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,eAAY;AAAA,MACZ,WAAWC,OAAAA;AAAAA,QACT;AAAA,QACA;AAAA,MAAA;AAAA,MAGD,oBACCD,+BAAC,QAAA,EAAK,eAAY,+BAA8B,UAAA,6BAAyB,IACvE,eACFA,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,eAAY;AAAA,UACZ,SAAS;AAAA,UACT,WAAU;AAAA,UACX,UAAA;AAAA,QAAA;AAAA,MAAA,IAIDA,2BAAAA,IAAC,QAAA,EAAK,eAAY,6BAA4B,UAAA,wCAAA,CAAqC;AAAA,IAAA;AAAA,EAAA;AAI3F;AA2BO,MAAM,uBAAsD,CAAC;AAAA,EAClE,aAAa;AAAA,EACb;AAAA,EACA;AACF,MAAM;;AACJ,QAAM,sBAAsBE,uBAAAA,wBAAA;AAC5B,QAAM,cAAc,mBAAmB,uBAAuB;AAC9D,QAAM,WAAWC,MAAAA,YAAY,CAAC,MAAM,EAAE,OAAO,QAAQ;AACrD,QAAM,CAAC,SAAS,UAAU,IAAIC,QAAAA,SAAS,KAAK;AAC5C,QAAM,CAAC,cAAc,eAAe,IAAIA,QAAAA,SAAS,CAAC;AAClD,QAAM,aAAaC,QAAAA,OAAO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jB,YAAY,KAAK,WACjB,SAAS,KAAK;AAChB,QAAI,UAAW,UAAS,aAAa,SAAS,eAAe,KAAK;AAClE,aAAS,UACP,WAAW,aAAa,SAAS,OAC7B,EAAE,SAAS,QAAQ,eAAc,qCAAU,iBAAgB,MAC3D,EAAE,SAAS,QAAQ,cAAc,KAAK,aAAA;AAAA,EAC9C,CAAC;AAED,SACET,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA,aAAa;AAAA,MACb;AAAA,IAAA;AAAA,EAAA;AAGN;;;;;"}
@@ -1,24 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useAuiState } from "@assistant-ui/react";
3
- import "../../packages/agent-runtime/src/generated/runconfig-contract.js";
4
3
  import { useState, useRef, useEffect, useLayoutEffect } from "react";
5
- import "@assistant-ui/tap";
6
- import "statewire";
7
- import { isStatewireChannelTeardown } from "../../packages/agent-runtime/src/errors.js";
8
- import "../../packages/agent-runtime/src/statewire-suspended.js";
9
- import "../../packages/agent-runtime/src/conversation-list.js";
10
- import "@tanstack/react-query";
11
- import "../../packages/agent-runtime/src/statewire-state.js";
12
- import "../../packages/agent-runtime/src/messages.js";
13
- import { useDeepAgentWindowSync } from "../../packages/agent-runtime/src/use-deep-agent-window-sync.js";
14
- import "@assistant-ui/store";
15
- import "../../packages/agent-runtime/src/quota-safe-local-storage-session.js";
16
- import "../../packages/agent-runtime/src/statewire-attach-observer.js";
17
- import "../../packages/agent-runtime/src/thread-status.js";
18
- import "@assistant-ui/react-statewire";
19
- import "@assistant-ui/core";
20
- import "../../packages/agent-runtime/src/thread-handoff.js";
21
4
  import { useStatewireToolOutputs } from "../../provider/statewire-window-context.js";
5
+ import { useDeepAgentWindowSync } from "../../packages/agent-runtime/src/use-deep-agent-window-sync.js";
6
+ import { isStatewireChannelTeardown } from "../../packages/agent-runtime/src/errors.js";
22
7
  import { cn } from "cnfast";
23
8
  const THREAD_VIEWPORT_ATTR = "data-aui-thread-viewport";
24
9
  const HISTORY_EDGE_NEAR_MARGIN_PX = 1500;