@athenaintel/react 0.23.2 → 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 (334) hide show
  1. package/README.md +46 -1
  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 +138 -46
  11. package/dist/chat/AthenaChat.cjs.map +1 -1
  12. package/dist/chat/AthenaChat.d.ts +37 -1
  13. package/dist/chat/AthenaChat.js +139 -47
  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/athena-composer-controls.js +1 -1
  32. package/dist/chat/run-activity.cjs +0 -16
  33. package/dist/chat/run-activity.cjs.map +1 -1
  34. package/dist/chat/run-activity.js +0 -16
  35. package/dist/chat/run-activity.js.map +1 -1
  36. package/dist/chat/statewire-client-tools.cjs +21 -17
  37. package/dist/chat/statewire-client-tools.cjs.map +1 -1
  38. package/dist/chat/statewire-client-tools.d.ts +27 -0
  39. package/dist/chat/statewire-client-tools.js +21 -17
  40. package/dist/chat/statewire-client-tools.js.map +1 -1
  41. package/dist/chat/super-grouping/activity-timeline.cjs +0 -16
  42. package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
  43. package/dist/chat/super-grouping/activity-timeline.js +0 -16
  44. package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
  45. package/dist/chat/tiptap-text.cjs +1 -17
  46. package/dist/chat/tiptap-text.cjs.map +1 -1
  47. package/dist/chat/tiptap-text.js +1 -17
  48. package/dist/chat/tiptap-text.js.map +1 -1
  49. package/dist/chat/use-athena-run-live.cjs +0 -15
  50. package/dist/chat/use-athena-run-live.cjs.map +1 -1
  51. package/dist/chat/use-athena-run-live.d.ts +7 -0
  52. package/dist/chat/use-athena-run-live.js +0 -15
  53. package/dist/chat/use-athena-run-live.js.map +1 -1
  54. package/dist/chat/use-statewire-approval-request.cjs +4 -16
  55. package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
  56. package/dist/chat/use-statewire-approval-request.d.ts +2 -0
  57. package/dist/chat/use-statewire-approval-request.js +4 -16
  58. package/dist/chat/use-statewire-approval-request.js.map +1 -1
  59. package/dist/chat-ui/composer/tiptap-composer.cjs +17 -17
  60. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
  61. package/dist/chat-ui/composer/tiptap-composer.js +17 -17
  62. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
  63. package/dist/chat-ui/index.cjs +0 -16
  64. package/dist/chat-ui/index.cjs.map +1 -1
  65. package/dist/chat-ui/index.js +0 -16
  66. package/dist/chat-ui/index.js.map +1 -1
  67. package/dist/chat-ui/mentions/mention-chip.cjs +1 -16
  68. package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
  69. package/dist/chat-ui/mentions/mention-chip.js +1 -16
  70. package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
  71. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs +4 -6
  72. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs.map +1 -1
  73. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js +4 -6
  74. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js.map +1 -1
  75. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +2 -9
  76. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -1
  77. package/dist/chat-ui/mentions/suggestions/data/sources/index.js +2 -9
  78. package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
  79. package/dist/chat-ui/messages/message-components.cjs +5 -19
  80. package/dist/chat-ui/messages/message-components.cjs.map +1 -1
  81. package/dist/chat-ui/messages/message-components.js +5 -19
  82. package/dist/chat-ui/messages/message-components.js.map +1 -1
  83. package/dist/chat-ui/messages/runtime-message.cjs +1 -16
  84. package/dist/chat-ui/messages/runtime-message.cjs.map +1 -1
  85. package/dist/chat-ui/messages/runtime-message.js +1 -16
  86. package/dist/chat-ui/messages/runtime-message.js.map +1 -1
  87. package/dist/chat-ui/messages/statewire-continue-run.cjs +3 -15
  88. package/dist/chat-ui/messages/statewire-continue-run.cjs.map +1 -1
  89. package/dist/chat-ui/messages/statewire-continue-run.js +3 -15
  90. package/dist/chat-ui/messages/statewire-continue-run.js.map +1 -1
  91. package/dist/chat-ui/messages/user-edit-composer.cjs +0 -16
  92. package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
  93. package/dist/chat-ui/messages/user-edit-composer.js +0 -16
  94. package/dist/chat-ui/messages/user-edit-composer.js.map +1 -1
  95. package/dist/chat-ui/messages/wake-marker.cjs +1 -16
  96. package/dist/chat-ui/messages/wake-marker.cjs.map +1 -1
  97. package/dist/chat-ui/messages/wake-marker.js +1 -16
  98. package/dist/chat-ui/messages/wake-marker.js.map +1 -1
  99. package/dist/chat-ui/statewire.cjs +0 -16
  100. package/dist/chat-ui/statewire.cjs.map +1 -1
  101. package/dist/chat-ui/statewire.js +0 -16
  102. package/dist/chat-ui/statewire.js.map +1 -1
  103. package/dist/chat-ui/thread/statewire-history-edge.cjs +2 -17
  104. package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
  105. package/dist/chat-ui/thread/statewire-history-edge.js +2 -17
  106. package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
  107. package/dist/composer/composer-handoff.cjs +121 -0
  108. package/dist/composer/composer-handoff.cjs.map +1 -0
  109. package/dist/composer/composer-handoff.d.ts +89 -0
  110. package/dist/composer/composer-handoff.js +121 -0
  111. package/dist/composer/composer-handoff.js.map +1 -0
  112. package/dist/composer/index.d.ts +2 -0
  113. package/dist/composer/useAppendToComposer.cjs +19 -7
  114. package/dist/composer/useAppendToComposer.cjs.map +1 -1
  115. package/dist/composer/useAppendToComposer.d.ts +22 -4
  116. package/dist/composer/useAppendToComposer.js +20 -8
  117. package/dist/composer/useAppendToComposer.js.map +1 -1
  118. package/dist/composer/useSendMessage.cjs +26 -8
  119. package/dist/composer/useSendMessage.cjs.map +1 -1
  120. package/dist/composer/useSendMessage.d.ts +8 -0
  121. package/dist/composer/useSendMessage.js +27 -9
  122. package/dist/composer/useSendMessage.js.map +1 -1
  123. package/dist/diagnostics/athena-diagnostics.cjs.map +1 -1
  124. package/dist/diagnostics/athena-diagnostics.d.ts +1 -1
  125. package/dist/diagnostics/athena-diagnostics.js.map +1 -1
  126. package/dist/diagnostics/errors.cjs +2 -0
  127. package/dist/diagnostics/errors.cjs.map +1 -1
  128. package/dist/diagnostics/errors.d.ts +2 -0
  129. package/dist/diagnostics/errors.js +2 -0
  130. package/dist/diagnostics/errors.js.map +1 -1
  131. package/dist/dictation/DictationStrip.cjs +61 -0
  132. package/dist/dictation/DictationStrip.cjs.map +1 -0
  133. package/dist/dictation/DictationStrip.d.ts +27 -0
  134. package/dist/dictation/DictationStrip.js +61 -0
  135. package/dist/dictation/DictationStrip.js.map +1 -0
  136. package/dist/dictation/audio-level-history.cjs +68 -0
  137. package/dist/dictation/audio-level-history.cjs.map +1 -0
  138. package/dist/dictation/audio-level-history.d.ts +27 -0
  139. package/dist/dictation/audio-level-history.js +68 -0
  140. package/dist/dictation/audio-level-history.js.map +1 -0
  141. package/dist/dictation/dictation-controls.cjs +60 -0
  142. package/dist/dictation/dictation-controls.cjs.map +1 -0
  143. package/dist/dictation/dictation-controls.d.ts +15 -0
  144. package/dist/dictation/dictation-controls.js +60 -0
  145. package/dist/dictation/dictation-controls.js.map +1 -0
  146. package/dist/dictation/dictation-engine.cjs +128 -0
  147. package/dist/dictation/dictation-engine.cjs.map +1 -0
  148. package/dist/dictation/dictation-engine.d.ts +95 -0
  149. package/dist/dictation/dictation-engine.js +128 -0
  150. package/dist/dictation/dictation-engine.js.map +1 -0
  151. package/dist/dictation/dictation-state.cjs +68 -0
  152. package/dist/dictation/dictation-state.cjs.map +1 -0
  153. package/dist/dictation/dictation-state.d.ts +58 -0
  154. package/dist/dictation/dictation-state.js +68 -0
  155. package/dist/dictation/dictation-state.js.map +1 -0
  156. package/dist/dictation/recorded-dictation-engine.cjs +153 -0
  157. package/dist/dictation/recorded-dictation-engine.cjs.map +1 -0
  158. package/dist/dictation/recorded-dictation-engine.d.ts +66 -0
  159. package/dist/dictation/recorded-dictation-engine.js +153 -0
  160. package/dist/dictation/recorded-dictation-engine.js.map +1 -0
  161. package/dist/dictation/use-athena-dictation-engine.cjs +64 -0
  162. package/dist/dictation/use-athena-dictation-engine.cjs.map +1 -0
  163. package/dist/dictation/use-athena-dictation-engine.d.ts +25 -0
  164. package/dist/dictation/use-athena-dictation-engine.js +64 -0
  165. package/dist/dictation/use-athena-dictation-engine.js.map +1 -0
  166. package/dist/dictation/use-dictation.cjs +215 -0
  167. package/dist/dictation/use-dictation.cjs.map +1 -0
  168. package/dist/dictation/use-dictation.d.ts +63 -0
  169. package/dist/dictation/use-dictation.js +215 -0
  170. package/dist/dictation/use-dictation.js.map +1 -0
  171. package/dist/index.cjs +41 -39
  172. package/dist/index.cjs.map +1 -1
  173. package/dist/index.d.ts +14 -0
  174. package/dist/index.js +23 -21
  175. package/dist/index.js.map +1 -1
  176. package/dist/packages/agent-runtime/src/edit-command.cjs.map +1 -1
  177. package/dist/packages/agent-runtime/src/edit-command.js.map +1 -1
  178. package/dist/packages/agent-runtime/src/errors.cjs +18 -0
  179. package/dist/packages/agent-runtime/src/errors.cjs.map +1 -1
  180. package/dist/packages/agent-runtime/src/errors.js +19 -1
  181. package/dist/packages/agent-runtime/src/errors.js.map +1 -1
  182. package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs +1 -0
  183. package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
  184. package/dist/packages/agent-runtime/src/generated/runconfig-contract.js +1 -0
  185. package/dist/packages/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
  186. package/dist/packages/agent-runtime/src/interrupts.cjs +61 -12
  187. package/dist/packages/agent-runtime/src/interrupts.cjs.map +1 -1
  188. package/dist/packages/agent-runtime/src/interrupts.js +61 -12
  189. package/dist/packages/agent-runtime/src/interrupts.js.map +1 -1
  190. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs +49 -0
  191. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
  192. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js +49 -0
  193. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -1
  194. package/dist/packages/agent-runtime/src/thread-status.js +1 -1
  195. package/dist/packages/agent-runtime/src/tool-metadata.cjs +1 -37
  196. package/dist/packages/agent-runtime/src/tool-metadata.cjs.map +1 -1
  197. package/dist/packages/agent-runtime/src/tool-metadata.js +1 -37
  198. package/dist/packages/agent-runtime/src/tool-metadata.js.map +1 -1
  199. package/dist/packages/agent-runtime/src/use-deep-agent-config.cjs +0 -1
  200. package/dist/packages/agent-runtime/src/use-deep-agent-config.cjs.map +1 -1
  201. package/dist/packages/agent-runtime/src/use-deep-agent-config.js +0 -1
  202. package/dist/packages/agent-runtime/src/use-deep-agent-config.js.map +1 -1
  203. package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
  204. package/dist/packages/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
  205. package/dist/packages/react/package.json.cjs +1 -1
  206. package/dist/packages/react/package.json.js +1 -1
  207. package/dist/provider/AthenaProvider.cjs +45 -20
  208. package/dist/provider/AthenaProvider.cjs.map +1 -1
  209. package/dist/provider/AthenaProvider.d.ts +1 -1
  210. package/dist/provider/AthenaProvider.js +46 -21
  211. package/dist/provider/AthenaProvider.js.map +1 -1
  212. package/dist/runtime/statewire-lifecycle.cjs +0 -16
  213. package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
  214. package/dist/runtime/statewire-lifecycle.js +0 -16
  215. package/dist/runtime/statewire-lifecycle.js.map +1 -1
  216. package/dist/runtime/useAthenaStatewireRuntime.cjs +3 -17
  217. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
  218. package/dist/runtime/useAthenaStatewireRuntime.js +3 -17
  219. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
  220. package/dist/styles.css +1 -1
  221. package/dist/threads/statewire-thread-list.cjs +4 -17
  222. package/dist/threads/statewire-thread-list.cjs.map +1 -1
  223. package/dist/threads/statewire-thread-list.js +4 -17
  224. package/dist/threads/statewire-thread-list.js.map +1 -1
  225. package/dist/threads/use-rest-conversation-history.cjs +2 -16
  226. package/dist/threads/use-rest-conversation-history.cjs.map +1 -1
  227. package/dist/threads/use-rest-conversation-history.js +2 -16
  228. package/dist/threads/use-rest-conversation-history.js.map +1 -1
  229. package/dist/threads/use-statewire-conversation-history.cjs +2 -16
  230. package/dist/threads/use-statewire-conversation-history.cjs.map +1 -1
  231. package/dist/threads/use-statewire-conversation-history.js +2 -16
  232. package/dist/threads/use-statewire-conversation-history.js.map +1 -1
  233. package/dist/toolkits/index.cjs +0 -7
  234. package/dist/toolkits/index.cjs.map +1 -1
  235. package/dist/toolkits/index.d.ts +0 -2
  236. package/dist/toolkits/index.js +0 -7
  237. package/dist/toolkits/index.js.map +1 -1
  238. package/dist/tools/index.cjs +4 -20
  239. package/dist/tools/index.cjs.map +1 -1
  240. package/dist/tools/index.js +1 -17
  241. package/dist/tools/index.js.map +1 -1
  242. package/dist/tools/misc-tool-uis.cjs +2 -17
  243. package/dist/tools/misc-tool-uis.cjs.map +1 -1
  244. package/dist/tools/misc-tool-uis.js +2 -17
  245. package/dist/tools/misc-tool-uis.js.map +1 -1
  246. package/dist/tools/primitives.cjs +1 -16
  247. package/dist/tools/primitives.cjs.map +1 -1
  248. package/dist/tools/primitives.js +1 -16
  249. package/dist/tools/primitives.js.map +1 -1
  250. package/dist/tools/tool-fallback.cjs +2 -17
  251. package/dist/tools/tool-fallback.cjs.map +1 -1
  252. package/dist/tools/tool-fallback.js +2 -17
  253. package/dist/tools/tool-fallback.js.map +1 -1
  254. package/dist/tools/voice-update-tool-ui.cjs +1 -17
  255. package/dist/tools/voice-update-tool-ui.cjs.map +1 -1
  256. package/dist/tools/voice-update-tool-ui.js +1 -17
  257. package/dist/tools/voice-update-tool-ui.js.map +1 -1
  258. package/package.json +1 -1
  259. package/dist/node_modules/qrcode-generator/dist/qrcode.cjs +0 -32
  260. package/dist/node_modules/qrcode-generator/dist/qrcode.cjs.map +0 -1
  261. package/dist/node_modules/qrcode-generator/dist/qrcode.js +0 -31
  262. package/dist/node_modules/qrcode-generator/dist/qrcode.js.map +0 -1
  263. package/dist/node_modules/zod/v4/classic/errors.cjs +0 -44
  264. package/dist/node_modules/zod/v4/classic/errors.cjs.map +0 -1
  265. package/dist/node_modules/zod/v4/classic/errors.js +0 -44
  266. package/dist/node_modules/zod/v4/classic/errors.js.map +0 -1
  267. package/dist/node_modules/zod/v4/classic/iso.cjs +0 -43
  268. package/dist/node_modules/zod/v4/classic/iso.cjs.map +0 -1
  269. package/dist/node_modules/zod/v4/classic/iso.js +0 -43
  270. package/dist/node_modules/zod/v4/classic/iso.js.map +0 -1
  271. package/dist/node_modules/zod/v4/classic/parse.cjs +0 -29
  272. package/dist/node_modules/zod/v4/classic/parse.cjs.map +0 -1
  273. package/dist/node_modules/zod/v4/classic/parse.js +0 -29
  274. package/dist/node_modules/zod/v4/classic/parse.js.map +0 -1
  275. package/dist/node_modules/zod/v4/classic/schemas.cjs +0 -871
  276. package/dist/node_modules/zod/v4/classic/schemas.cjs.map +0 -1
  277. package/dist/node_modules/zod/v4/classic/schemas.js +0 -871
  278. package/dist/node_modules/zod/v4/classic/schemas.js.map +0 -1
  279. package/dist/node_modules/zod/v4/core/api.cjs +0 -570
  280. package/dist/node_modules/zod/v4/core/api.cjs.map +0 -1
  281. package/dist/node_modules/zod/v4/core/api.js +0 -570
  282. package/dist/node_modules/zod/v4/core/api.js.map +0 -1
  283. package/dist/node_modules/zod/v4/core/checks.cjs +0 -411
  284. package/dist/node_modules/zod/v4/core/checks.cjs.map +0 -1
  285. package/dist/node_modules/zod/v4/core/checks.js +0 -411
  286. package/dist/node_modules/zod/v4/core/checks.js.map +0 -1
  287. package/dist/node_modules/zod/v4/core/core.cjs +0 -77
  288. package/dist/node_modules/zod/v4/core/core.cjs.map +0 -1
  289. package/dist/node_modules/zod/v4/core/core.js +0 -77
  290. package/dist/node_modules/zod/v4/core/core.js.map +0 -1
  291. package/dist/node_modules/zod/v4/core/doc.cjs +0 -38
  292. package/dist/node_modules/zod/v4/core/doc.cjs.map +0 -1
  293. package/dist/node_modules/zod/v4/core/doc.js +0 -38
  294. package/dist/node_modules/zod/v4/core/doc.js.map +0 -1
  295. package/dist/node_modules/zod/v4/core/errors.cjs +0 -76
  296. package/dist/node_modules/zod/v4/core/errors.cjs.map +0 -1
  297. package/dist/node_modules/zod/v4/core/errors.js +0 -76
  298. package/dist/node_modules/zod/v4/core/errors.js.map +0 -1
  299. package/dist/node_modules/zod/v4/core/json-schema-processors.cjs +0 -312
  300. package/dist/node_modules/zod/v4/core/json-schema-processors.cjs.map +0 -1
  301. package/dist/node_modules/zod/v4/core/json-schema-processors.js +0 -312
  302. package/dist/node_modules/zod/v4/core/json-schema-processors.js.map +0 -1
  303. package/dist/node_modules/zod/v4/core/parse.cjs +0 -96
  304. package/dist/node_modules/zod/v4/core/parse.cjs.map +0 -1
  305. package/dist/node_modules/zod/v4/core/parse.js +0 -96
  306. package/dist/node_modules/zod/v4/core/parse.js.map +0 -1
  307. package/dist/node_modules/zod/v4/core/regexes.cjs +0 -86
  308. package/dist/node_modules/zod/v4/core/regexes.cjs.map +0 -1
  309. package/dist/node_modules/zod/v4/core/regexes.js +0 -86
  310. package/dist/node_modules/zod/v4/core/regexes.js.map +0 -1
  311. package/dist/node_modules/zod/v4/core/registries.cjs +0 -52
  312. package/dist/node_modules/zod/v4/core/registries.cjs.map +0 -1
  313. package/dist/node_modules/zod/v4/core/registries.js +0 -52
  314. package/dist/node_modules/zod/v4/core/registries.js.map +0 -1
  315. package/dist/node_modules/zod/v4/core/schemas.cjs +0 -1412
  316. package/dist/node_modules/zod/v4/core/schemas.cjs.map +0 -1
  317. package/dist/node_modules/zod/v4/core/schemas.js +0 -1413
  318. package/dist/node_modules/zod/v4/core/schemas.js.map +0 -1
  319. package/dist/node_modules/zod/v4/core/to-json-schema.cjs +0 -370
  320. package/dist/node_modules/zod/v4/core/to-json-schema.cjs.map +0 -1
  321. package/dist/node_modules/zod/v4/core/to-json-schema.js +0 -370
  322. package/dist/node_modules/zod/v4/core/to-json-schema.js.map +0 -1
  323. package/dist/node_modules/zod/v4/core/util.cjs +0 -444
  324. package/dist/node_modules/zod/v4/core/util.cjs.map +0 -1
  325. package/dist/node_modules/zod/v4/core/util.js +0 -444
  326. package/dist/node_modules/zod/v4/core/util.js.map +0 -1
  327. package/dist/node_modules/zod/v4/core/versions.cjs +0 -9
  328. package/dist/node_modules/zod/v4/core/versions.cjs.map +0 -1
  329. package/dist/node_modules/zod/v4/core/versions.js +0 -9
  330. package/dist/node_modules/zod/v4/core/versions.js.map +0 -1
  331. package/dist/packages/agent-runtime/src/thread-handoff.cjs +0 -85
  332. package/dist/packages/agent-runtime/src/thread-handoff.cjs.map +0 -1
  333. package/dist/packages/agent-runtime/src/thread-handoff.js +0 -85
  334. package/dist/packages/agent-runtime/src/thread-handoff.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"StatewireQueuedMessages.js","sources":["../../src/chat/StatewireQueuedMessages.tsx"],"sourcesContent":["import { useAui, useAuiState } from '@assistant-ui/react';\nimport type { StatewireThread } from '@assistant-ui/react-statewire';\nimport {\n useStatewireRuns,\n useStatewireSendCommand,\n useStatewireState,\n} from '@assistant-ui/react-statewire';\nimport {\n buildQueueEditCommand,\n buildStatewireQueueRows,\n type DeepAgentThreadStatus,\n describeQueueSendFailure,\n hasStatewireThreadExtras,\n isFailedSendEntryRace,\n isQueueEntryUnsettled,\n isServerUpdateStopSource,\n QUEUE_AUTO_CONTINUE_DELAY_MS,\n queueEntryText,\n queueLaneFlags,\n readDeepAgentStreamValues,\n readPrioritizedQueueIds,\n readRetryableRunRefusal,\n readRunMarkerFromSourceMessages,\n requireStatewireFailedActions,\n showQueueRowSendNow,\n type StatewireFailedActions,\n useDeepAgentThreadStatus,\n userStopBlocksQueueAutoContinue,\n} from '@athenaintel/agent-runtime';\nimport {\n AlertCircleIcon,\n CheckIcon,\n ChevronDownIcon,\n ChevronRightIcon,\n CircleIcon,\n Loader2Icon,\n PencilIcon,\n RotateCcwIcon,\n SendIcon,\n Trash2Icon,\n XIcon,\n ZapIcon,\n} from 'lucide-react';\nimport {\n type FC,\n type KeyboardEvent,\n type MutableRefObject,\n type ReactNode,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { ContinuePill } from '../chat-ui/messages/continue-pill';\nimport { cn } from '../lib/utils';\n\ndeclare module '@assistant-ui/core' {\n namespace Assistant {\n interface Commands {\n /**\n * The ⚡ on a queued row (`DeepAgentThread.run_prioritize`). With\n * `priority: true` the host moves the entry to the head of the queue\n * lane (behind entries prioritized before it), records it durably, and\n * the live run ends at its next model-call boundary — after the\n * in-flight tool chain, never mid-tool — so the settle delivers the\n * entry on top of the finished tool results instead of after the whole\n * turn. `priority: false` withdraws the request and leaves the entry\n * where it is.\n */\n runPrioritize: {\n type: 'run/prioritize';\n runId: string;\n messageId: string;\n priority: boolean;\n };\n }\n }\n}\n\n/**\n * The one queued-messages tray for the server-owned statewire queue and steer\n * lanes, mounted by the SDK's `AthenaChat`, the Chrome side panel, the Office\n * task pane, and Olympus.\n *\n * A message sent mid-run queues behind the active run. Rows offer \"Send now\"\n * (a steer-lane move — the host stops the run and dispatches it once the run\n * settles; on a stopped/errored thread the same move dispatches immediately),\n * \"Prioritize\" (`run/prioritize`, the ⚡ — the non-interrupting analog: the\n * live run ends at its next model-call boundary so the entry lands on top of\n * the finished tool results), inline edit (re-sent under the entry's own id\n * on its own lane, which the host folds as an in-place content update), and\n * remove (`run/dequeue`). While the thread rests stopped/errored, stranded\n * steer-lane entries list ahead of the queue (they dispatch first, as one\n * batch, so they carry Remove but no per-row Send now) and a Continue pill\n * steer-promotes the queue head — a steer entry moved onto its own lane is a\n * no-op, so a steer-only rest state gets no dead button.\n *\n * A row whose send has not settled yet (`isQueueEntryUnsettled` — this\n * client's optimistic fold, not a host-admitted lane entry) renders as\n * \"Sending…\" with no acting affordances: admission is server-side and can\n * still refuse the message. Failed run sends (`runs.failed`) list after the\n * lanes with Retry (`retryFailed`) and Discard (`discardFailed`).\n *\n * With `autoContinue`, an ordinary stranded settle promotes the queue head\n * once after `QUEUE_AUTO_CONTINUE_DELAY_MS`. User stops remain manual;\n * infrastructure pauses and retryable dispatch refusals recover on the server.\n *\n * Renders nothing on the legacy transport or when every lane is empty.\n */\n\nexport type StatewireQueueEvent =\n | {\n type: 'auto-continued';\n threadId: string | null;\n status: DeepAgentThreadStatus;\n headEntryId: string;\n }\n | {\n type: 'failed-send-action-raced';\n threadId: string | null;\n messageId: string;\n action: 'retry' | 'discard';\n error: string;\n };\n\nexport interface StatewireQueueRowContentContext {\n text: string;\n index: number;\n item: StatewireThread.RunsQueueEntry;\n}\n\nexport interface StatewireQueueEditorContext {\n value: string;\n onChange: (value: string) => void;\n /** Save the edit; a blank or unchanged text sends nothing but closes the editor. */\n onSave: (text: string) => void;\n onCancel: () => void;\n}\n\nexport interface StatewireQueuedMessagesProps {\n /** Surface-styling overrides merged onto the default classes. */\n classNames?: {\n /** The tray container. */\n root?: string;\n /** The row list. */\n list?: string;\n };\n /**\n * Steer-promote a stranded queue head automatically after a settle (see the\n * component docs). Off by default: a host opts in to dispatching runs on the\n * user's behalf. Pass `{ delayMs }` to tune the grace before the promotion\n * (defaults to `QUEUE_AUTO_CONTINUE_DELAY_MS`).\n */\n autoContinue?: boolean | { delayMs?: number };\n /** Identifies the thread for once-per-entry auto-continue attempts and events. */\n threadId?: string | null;\n /** Telemetry sink for the tray's notable moments. */\n onEvent?: (event: StatewireQueueEvent) => void;\n /** Replace the plain-text row body (e.g. a mention-aware renderer). */\n renderContent?: (context: StatewireQueueRowContentContext) => ReactNode;\n /** Replace the plain textarea inline editor (e.g. the host's composer editor). */\n renderEditor?: (context: StatewireQueueEditorContext) => ReactNode;\n}\n\nexport const StatewireQueuedMessages: FC<StatewireQueuedMessagesProps> = (props) => {\n const extras = useAuiState((s) => s.thread.extras);\n if (!hasStatewireThreadExtras(extras)) return null;\n return <StatewireQueuedMessagesInner {...props} />;\n};\n\nconst StatewireQueuedMessagesInner: FC<StatewireQueuedMessagesProps> = ({\n classNames,\n autoContinue = false,\n threadId = null,\n onEvent,\n renderContent,\n renderEditor,\n}) => {\n // The QUEUE lane only: composer.queue prepends the steer lane, whose entries\n // already render in the message list. A non-empty queue implies a live run\n // entry (the host retires runId only once both lanes drain), so the row\n // controls can always send.\n const runs = useStatewireRuns();\n const { queue, steerQueue, runId } = runs;\n // `failed` joined the runs projection in react-statewire 0.24; a projection\n // without it (an older lib, a stubbed runs read) must not crash the tray.\n const failed = runs.failed ?? [];\n // The host's durable prioritized-id record: a raw path read (the selector\n // must return a stable reference), with the lookup set derived below.\n const rawPrioritizedQueueIds = useStatewireState(\n (state) => readDeepAgentStreamValues(state).prioritizedQueueIds,\n );\n const prioritizedQueueIds = useMemo(\n () => new Set(readPrioritizedQueueIds(rawPrioritizedQueueIds)),\n [rawPrioritizedQueueIds],\n );\n const status = useDeepAgentThreadStatus();\n const { isRunning, isContinuable } = queueLaneFlags(status);\n const aui = useAui();\n const sendCommand = useStatewireSendCommand();\n const listId = useId();\n const [expanded, setExpanded] = useState(true);\n const [editingId, setEditingId] = useState<string | null>(null);\n const [editingText, setEditingText] = useState('');\n // Head entries already auto-promoted once on this mount: an attempt whose\n // continue run dies and re-strands the SAME entry must not loop — the manual\n // Continue pill is the fallback for a repeatedly failing dispatch. Kept on\n // the tray (not the auto-continue child) so it survives the empty-lane\n // renders between a promotion and its outcome.\n const autoContinuedRef = useRef<Set<string>>(new Set());\n const onEventRef = useRef(onEvent);\n onEventRef.current = onEvent;\n\n const rows = buildStatewireQueueRows({ queue, steerQueue, isContinuable });\n // Continue promotes the QUEUE head only: a queue→steer move dispatches the\n // stranded steer lane plus this entry, while a steer entry moved onto its\n // own lane is a no-op.\n const queueHeadId = queue[0]?.id ?? null;\n const retryableRefusal = readRetryableRunRefusal(runs.error) !== null;\n const autoContinueOptions = autoContinue === true ? {} : autoContinue || null;\n\n /**\n * Re-send the entry under its own id on its own lane: the host replaces the\n * queued message's content in place, leaving its queue position and lane\n * untouched (a same-id send never dispatches).\n */\n const saveEdit = (\n item: StatewireThread.RunsQueueEntry,\n lane: 'queue' | 'steer',\n text: string,\n ): void => {\n setEditingId(null);\n setEditingText('');\n const command = buildQueueEditCommand({ item, lane, runId, text });\n if (command !== null) sendCommand(command);\n };\n\n /**\n * Retry/Discard act on a rendered lane snapshot that can trail the session\n * record; acting on an entry statewire already dropped throws. Nothing is\n * lost in that race, so it is recorded instead of crashing the click.\n */\n const runFailedSendAction = ({\n action,\n messageId,\n run,\n }: {\n action: 'retry' | 'discard';\n messageId: string;\n run: (actions: StatewireFailedActions) => void;\n }): void => {\n try {\n run(requireStatewireFailedActions(aui.thread().getState().extras));\n } catch (error) {\n if (!(error instanceof Error) || !isFailedSendEntryRace(error)) throw error;\n onEvent?.({\n type: 'failed-send-action-raced',\n threadId,\n messageId,\n action,\n error: error.message,\n });\n }\n };\n\n if (rows.length === 0 && failed.length === 0) return null;\n\n const renderRowContent = (context: StatewireQueueRowContentContext): ReactNode =>\n renderContent ? (\n renderContent(context)\n ) : (\n <p className=\"min-w-0 flex-1 whitespace-pre-wrap break-words text-foreground text-xs\">\n {context.text || 'Queued attachment'}\n </p>\n );\n\n return (\n <section\n aria-label=\"Queued messages\"\n className={cn(\n 'aui-statewire-queue w-full rounded-xl border border-border/70 bg-muted/30 px-2 py-1.5',\n classNames?.root,\n )}\n >\n {autoContinueOptions ? (\n <QueueAutoContinue\n delayMs={autoContinueOptions.delayMs ?? QUEUE_AUTO_CONTINUE_DELAY_MS}\n queueHeadId={queueHeadId}\n retryableRefusal={retryableRefusal}\n isContinuable={isContinuable}\n status={status}\n threadId={threadId}\n editing={editingId !== null}\n continuedRef={autoContinuedRef}\n onEventRef={onEventRef}\n />\n ) : null}\n <div className=\"flex items-center gap-1.5\">\n <button\n type=\"button\"\n onClick={() => setExpanded((value) => !value)}\n aria-expanded={expanded}\n aria-controls={listId}\n className=\"flex items-center gap-1 rounded px-1 py-1 font-medium text-muted-foreground text-xs hover:text-foreground\"\n >\n {expanded ? (\n <ChevronDownIcon className=\"size-3.5\" />\n ) : (\n <ChevronRightIcon className=\"size-3.5\" />\n )}\n {rows.length + failed.length} queued\n </button>\n {isContinuable && queueHeadId !== null ? (\n <ContinuePill\n ariaLabel=\"Continue with queued messages\"\n onClick={() => aui.composer.queueItem({ id: queueHeadId }).move({ lane: 'steer' })}\n />\n ) : null}\n </div>\n {expanded ? (\n <ul\n id={listId}\n className={cn('max-h-40 overflow-y-auto', classNames?.list)}\n data-testid=\"athena-statewire-queue\"\n >\n {rows.map(({ item, lane }, index) => {\n const text = queueEntryText(item.parts);\n const isUnsettled = isQueueEntryUnsettled(item);\n const isEditing = editingId === item.id;\n const showSendNow =\n !isUnsettled && showQueueRowSendNow({ lane, index, isRunning, isContinuable });\n const showPrioritize = !isUnsettled && lane === 'queue' && isRunning && runId !== null;\n const isPrioritized = prioritizedQueueIds.has(item.id);\n const editorContext: StatewireQueueEditorContext = {\n value: editingText,\n onChange: setEditingText,\n onSave: (next) => saveEdit(item, lane, next),\n onCancel: () => {\n setEditingId(null);\n setEditingText('');\n },\n };\n return (\n <li\n key={item.id}\n className=\"group flex items-start gap-2 rounded-md px-1 py-1.5 hover:bg-background\"\n >\n {isUnsettled ? (\n <Loader2Icon className=\"mt-0.5 size-3.5 shrink-0 animate-spin text-muted-foreground/60\" />\n ) : (\n <CircleIcon className=\"mt-0.5 size-3.5 shrink-0 text-muted-foreground/40\" />\n )}\n {isEditing ? (\n renderEditor ? (\n renderEditor(editorContext)\n ) : (\n <DefaultQueueEditor {...editorContext} />\n )\n ) : (\n renderRowContent({ text, index, item })\n )}\n <div\n className={cn('flex shrink-0 items-center gap-1', isEditing && 'hidden')}\n data-testid=\"statewire-queue-row-actions\"\n >\n {isUnsettled ? (\n <span\n className=\"px-1 text-[10px] text-muted-foreground\"\n data-testid=\"statewire-queued-message-sending\"\n >\n Sending…\n </span>\n ) : null}\n {showSendNow ? (\n <button\n type=\"button\"\n aria-label=\"Send now\"\n onClick={() =>\n aui.composer.queueItem({ id: item.id }).move({ lane: 'steer' })\n }\n className=\"inline-flex items-center gap-1 rounded-full border border-primary/30 px-2 py-1 font-medium text-[10px] text-primary hover:bg-primary/5\"\n >\n <SendIcon className=\"size-2.5\" />\n Send now\n </button>\n ) : null}\n {showPrioritize ? (\n <button\n type=\"button\"\n aria-label={isPrioritized ? 'Remove priority' : 'Prioritize'}\n aria-pressed={isPrioritized}\n title={\n isPrioritized\n ? 'Remove priority'\n : 'Prioritize this message. Delivered as soon as the current step ends.'\n }\n onClick={() => {\n if (runId === null) return;\n sendCommand({\n type: 'run/prioritize',\n runId,\n messageId: item.id,\n priority: !isPrioritized,\n });\n }}\n className={cn(\n 'rounded p-1 transition-colors',\n isPrioritized\n ? 'text-amber-500 hover:text-amber-600'\n : 'text-muted-foreground hover:text-amber-500',\n )}\n >\n <ZapIcon className=\"size-3\" />\n </button>\n ) : null}\n {!isUnsettled ? (\n <button\n type=\"button\"\n aria-label=\"Edit queued message\"\n onClick={() => {\n setEditingId(item.id);\n setEditingText(text);\n }}\n className=\"rounded p-1 text-muted-foreground transition-colors hover:text-primary\"\n >\n <PencilIcon className=\"size-3\" />\n </button>\n ) : null}\n <button\n type=\"button\"\n aria-label=\"Remove queued message\"\n onClick={() => aui.composer.queueItem({ id: item.id }).remove()}\n className={cn(\n 'rounded p-1 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive',\n !showSendNow &&\n 'opacity-0 focus-visible:opacity-100 group-hover:opacity-100',\n )}\n >\n <Trash2Icon className=\"size-3\" />\n </button>\n </div>\n </li>\n );\n })}\n {failed.map((item, index) => (\n <li\n key={item.id}\n className=\"group flex items-start gap-2 rounded-md px-1 py-1.5 hover:bg-background\"\n >\n <AlertCircleIcon className=\"mt-0.5 size-3.5 shrink-0 text-destructive\" />\n {renderRowContent({\n text: queueEntryText(item.parts),\n index: rows.length + index,\n item,\n })}\n <div\n className=\"flex shrink-0 items-center gap-1\"\n data-testid=\"statewire-queue-row-actions\"\n >\n <span\n className=\"px-1 text-[10px] text-destructive\"\n title={describeQueueSendFailure(item.sendFailure)}\n >\n Failed to send\n </span>\n <button\n type=\"button\"\n aria-label=\"Retry failed message\"\n onClick={() =>\n runFailedSendAction({\n action: 'retry',\n messageId: item.id,\n run: (actions) => actions.retryFailed(item.id),\n })\n }\n className=\"inline-flex items-center gap-1 rounded-full border border-primary/30 px-2 py-1 font-medium text-[10px] text-primary hover:bg-primary/5\"\n >\n <RotateCcwIcon className=\"size-2.5\" />\n Retry\n </button>\n <button\n type=\"button\"\n aria-label=\"Discard failed message\"\n onClick={() =>\n runFailedSendAction({\n action: 'discard',\n messageId: item.id,\n run: (actions) => actions.discardFailed(item.id),\n })\n }\n className=\"rounded p-1 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive\"\n >\n <Trash2Icon className=\"size-3\" />\n </button>\n </div>\n </li>\n ))}\n </ul>\n ) : null}\n </section>\n );\n};\n\n/** Promotes ordinary stranded queue heads once; infrastructure recovery stays server-owned. */\nconst QueueAutoContinue: FC<{\n delayMs: number;\n queueHeadId: string | null;\n retryableRefusal: boolean;\n isContinuable: boolean;\n status: DeepAgentThreadStatus;\n threadId: string | null;\n editing: boolean;\n continuedRef: MutableRefObject<Set<string>>;\n onEventRef: MutableRefObject<((event: StatewireQueueEvent) => void) | undefined>;\n}> = ({\n delayMs,\n queueHeadId,\n retryableRefusal,\n isContinuable,\n status,\n threadId,\n editing,\n continuedRef,\n onEventRef,\n}) => {\n const aui = useAui();\n // The settle that stranded the queue is described by the LAST message's run\n // marker (a marker deeper in history was superseded by a later send). The\n // selectors return primitives so the subscriptions stay shallow-stable.\n const lastMessageMarker = useAuiState((s) => {\n const last = s.thread.messages.at(-1);\n return last ? readRunMarkerFromSourceMessages(last)?.marker : undefined;\n });\n const lastMessageMarkerSource = useAuiState((s) => {\n const last = s.thread.messages.at(-1);\n return last ? readRunMarkerFromSourceMessages(last)?.source : undefined;\n });\n const userStopBlocks = userStopBlocksQueueAutoContinue({\n marker: lastMessageMarker,\n source: lastMessageMarkerSource,\n });\n\n useEffect(() => {\n if (\n !isContinuable ||\n userStopBlocks ||\n retryableRefusal ||\n isServerUpdateStopSource(lastMessageMarkerSource)\n ) return;\n // An open inline edit means the user is mid-revision on some row —\n // dispatching underneath them could send text they are about to change.\n if (editing) return;\n if (queueHeadId === null) return;\n const attemptKey = `${threadId ?? 'unknown'}:${queueHeadId}`;\n if (continuedRef.current.has(attemptKey)) return;\n const timeoutId = setTimeout(() => {\n continuedRef.current.add(attemptKey);\n onEventRef.current?.({ type: 'auto-continued', threadId, status, headEntryId: queueHeadId });\n aui.composer.queueItem({ id: queueHeadId }).move({ lane: 'steer' });\n }, delayMs);\n return () => clearTimeout(timeoutId);\n }, [\n continuedRef,\n aui,\n delayMs,\n editing,\n isContinuable,\n onEventRef,\n queueHeadId,\n retryableRefusal,\n lastMessageMarkerSource,\n status,\n threadId,\n userStopBlocks,\n ]);\n\n return null;\n};\n\n/** Plain textarea editor: Enter saves, Shift+Enter breaks a line, Escape cancels. */\nconst DefaultQueueEditor: FC<StatewireQueueEditorContext> = ({\n value,\n onChange,\n onSave,\n onCancel,\n}) => {\n const canSave = value.trim().length > 0;\n const handleKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>): void => {\n if (event.key === 'Enter' && !event.shiftKey) {\n event.preventDefault();\n if (canSave) onSave(value);\n } else if (event.key === 'Escape') {\n event.preventDefault();\n onCancel();\n }\n };\n return (\n <div className=\"flex min-w-0 flex-1 items-start gap-1\">\n <textarea\n autoFocus\n aria-label=\"Edit message\"\n value={value}\n onChange={(event) => onChange(event.target.value)}\n onKeyDown={handleKeyDown}\n rows={Math.min(6, Math.max(1, value.split('\\n').length))}\n className=\"min-w-0 flex-1 resize-none rounded-md border border-border bg-background px-2 py-1 text-foreground text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring/50\"\n />\n <button\n type=\"button\"\n aria-label=\"Save edit\"\n disabled={!canSave}\n onClick={() => onSave(value)}\n className={cn(\n 'rounded p-1 text-primary transition-colors hover:bg-primary/10',\n !canSave && 'cursor-not-allowed opacity-40',\n )}\n >\n <CheckIcon className=\"size-3.5\" />\n </button>\n <button\n type=\"button\"\n aria-label=\"Cancel edit\"\n onClick={onCancel}\n className=\"rounded p-1 text-muted-foreground transition-colors hover:bg-muted\"\n >\n <XIcon className=\"size-3.5\" />\n </button>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAqKO,MAAM,0BAA4D,CAAC,UAAU;AAClF,QAAM,SAAS,YAAY,CAAC,MAAM,EAAE,OAAO,MAAM;AACjD,MAAI,CAAC,yBAAyB,MAAM,EAAG,QAAO;AAC9C,SAAO,oBAAC,8BAAA,EAA8B,GAAG,MAAA,CAAO;AAClD;AAEA,MAAM,+BAAiE,CAAC;AAAA,EACtE;AAAA,EACA,eAAe;AAAA,EACf,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AACF,MAAM;;AAKJ,QAAM,OAAO,iBAAA;AACb,QAAM,EAAE,OAAO,YAAY,MAAA,IAAU;AAGrC,QAAM,SAAS,KAAK,UAAU,CAAA;AAG9B,QAAM,yBAAyB;AAAA,IAC7B,CAAC,UAAU,0BAA0B,KAAK,EAAE;AAAA,EAAA;AAE9C,QAAM,sBAAsB;AAAA,IAC1B,MAAM,IAAI,IAAI,wBAAwB,sBAAsB,CAAC;AAAA,IAC7D,CAAC,sBAAsB;AAAA,EAAA;AAEzB,QAAM,SAAS,yBAAA;AACf,QAAM,EAAE,WAAW,kBAAkB,eAAe,MAAM;AAC1D,QAAM,MAAM,OAAA;AACZ,QAAM,cAAc,wBAAA;AACpB,QAAM,SAAS,MAAA;AACf,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,IAAI;AAC7C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAwB,IAAI;AAC9D,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,EAAE;AAMjD,QAAM,mBAAmB,OAAoB,oBAAI,KAAK;AACtD,QAAM,aAAa,OAAO,OAAO;AACjC,aAAW,UAAU;AAErB,QAAM,OAAO,wBAAwB,EAAE,OAAO,YAAY,eAAe;AAIzE,QAAM,gBAAc,WAAM,CAAC,MAAP,mBAAU,OAAM;AACpC,Q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AAA,IAC3B,WAAW,MAAM,QAAQ,UAAU;AACjC,YAAM,eAAA;AACN,eAAA;AAAA,IACF;AAAA,EACF;AACA,SACE,qBAAC,OAAA,EAAI,WAAU,yCACb,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAS;AAAA,QACT,cAAW;AAAA,QACX;AAAA,QACA,UAAU,CAAC,UAAU,SAAS,MAAM,OAAO,KAAK;AAAA,QAChD,WAAW;AAAA,QACX,MAAM,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,MAAM,MAAM,IAAI,EAAE,MAAM,CAAC;AAAA,QACvD,WAAU;AAAA,MAAA;AAAA,IAAA;AAAA,IAEZ;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,cAAW;AAAA,QACX,UAAU,CAAC;AAAA,QACX,SAAS,MAAM,OAAO,KAAK;AAAA,QAC3B,WAAW;AAAA,UACT;AAAA,UACA,CAAC,WAAW;AAAA,QAAA;AAAA,QAGd,UAAA,oBAAC,WAAA,EAAU,WAAU,WAAA,CAAW;AAAA,MAAA;AAAA,IAAA;AAAA,IAElC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,cAAW;AAAA,QACX,SAAS;AAAA,QACT,WAAU;AAAA,QAEV,UAAA,oBAAC,OAAA,EAAM,WAAU,WAAA,CAAW;AAAA,MAAA;AAAA,IAAA;AAAA,EAC9B,GACF;AAEJ;"}
1
+ {"version":3,"file":"StatewireQueuedMessages.js","sources":["../../src/chat/StatewireQueuedMessages.tsx"],"sourcesContent":["import { useAui, useAuiState } from '@assistant-ui/react';\nimport type { StatewireThread } from '@assistant-ui/react-statewire';\nimport {\n useStatewireRuns,\n useStatewireSendCommand,\n useStatewireState,\n} from '@assistant-ui/react-statewire';\nimport {\n buildQueueEditCommand,\n buildStatewireQueueRows,\n type DeepAgentThreadStatus,\n describeQueueSendFailure,\n hasStatewireThreadExtras,\n isFailedSendEntryRace,\n isQueueEntryUnsettled,\n isServerUpdateStopSource,\n QUEUE_AUTO_CONTINUE_DELAY_MS,\n queueEntryText,\n queueLaneFlags,\n readDeepAgentStreamValues,\n readPrioritizedQueueIds,\n readRetryableRunRefusal,\n readRunMarkerFromSourceMessages,\n requireStatewireFailedActions,\n showQueueRowSendNow,\n type StatewireFailedActions,\n useDeepAgentThreadStatus,\n userStopBlocksQueueAutoContinue,\n} from '@athenaintel/agent-runtime';\nimport {\n AlertCircleIcon,\n CheckIcon,\n ChevronDownIcon,\n ChevronRightIcon,\n CircleIcon,\n Loader2Icon,\n PencilIcon,\n RotateCcwIcon,\n SendIcon,\n Trash2Icon,\n XIcon,\n ZapIcon,\n} from 'lucide-react';\nimport {\n type FC,\n type KeyboardEvent,\n type MutableRefObject,\n type ReactNode,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { ContinuePill } from '../chat-ui/messages/continue-pill';\nimport { cn } from '../lib/utils';\n\ndeclare module '@assistant-ui/core' {\n namespace Assistant {\n interface Commands {\n /**\n * The ⚡ on a queued row (`DeepAgentThread.run_prioritize`). With\n * `priority: true` the host moves the entry to the head of the queue\n * lane (behind entries prioritized before it), records it durably, and\n * the live run ends at its next model-call boundary — after the\n * in-flight tool chain, never mid-tool — so the settle delivers the\n * entry on top of the finished tool results instead of after the whole\n * turn. `priority: false` withdraws the request and leaves the entry\n * where it is.\n */\n runPrioritize: {\n type: 'run/prioritize';\n runId: string;\n messageId: string;\n priority: boolean;\n };\n }\n }\n}\n\n/**\n * The one queued-messages tray for the server-owned statewire queue and steer\n * lanes, mounted by the SDK's `AthenaChat`, the Chrome side panel, the Office\n * task pane, and Olympus.\n *\n * A message sent mid-run queues behind the active run. Rows offer \"Send now\"\n * (a steer-lane move — the host stops the run and dispatches it once the run\n * settles; on a stopped/errored thread the same move dispatches immediately),\n * \"Prioritize\" (`run/prioritize`, the ⚡ — the non-interrupting analog: the\n * live run ends at its next model-call boundary so the entry lands on top of\n * the finished tool results), inline edit (re-sent under the entry's own id\n * on its own lane, which the host folds as an in-place content update), and\n * remove (`run/dequeue`). While the thread rests stopped/errored, stranded\n * steer-lane entries list ahead of the queue (they dispatch first, as one\n * batch, so they carry Remove but no per-row Send now) and a Continue pill\n * steer-promotes the queue head — a steer entry moved onto its own lane is a\n * no-op, so a steer-only rest state gets no dead button.\n *\n * A row whose send has not settled yet (`isQueueEntryUnsettled` — this\n * client's optimistic fold, not a host-admitted lane entry) renders as\n * \"Sending…\" with no acting affordances: admission is server-side and can\n * still refuse the message. Failed run sends (`runs.failed`) list after the\n * lanes with Retry (`retryFailed`) and Discard (`discardFailed`).\n *\n * With `autoContinue`, an ordinary stranded settle promotes the queue head\n * once after `QUEUE_AUTO_CONTINUE_DELAY_MS`. User stops remain manual;\n * infrastructure pauses and retryable dispatch refusals recover on the server.\n *\n * Renders nothing on the legacy transport or when every lane is empty.\n */\n\nexport type StatewireQueueEvent =\n | {\n type: 'auto-continued';\n threadId: string | null;\n status: DeepAgentThreadStatus;\n headEntryId: string;\n }\n | {\n type: 'failed-send-action-raced';\n threadId: string | null;\n messageId: string;\n action: 'retry' | 'discard';\n error: string;\n };\n\nexport interface StatewireQueueRowContentContext {\n text: string;\n index: number;\n item: StatewireThread.RunsQueueEntry;\n}\n\nexport interface StatewireQueueEditorContext {\n value: string;\n onChange: (value: string) => void;\n /** Save the edit; a blank or unchanged text sends nothing but closes the editor. */\n onSave: (text: string) => void;\n onCancel: () => void;\n}\n\nexport interface StatewireQueuedMessagesProps {\n /** Surface-styling overrides merged onto the default classes. */\n classNames?: {\n /** The tray container. */\n root?: string;\n /** The row list. */\n list?: string;\n };\n /**\n * Steer-promote a stranded queue head automatically after a settle (see the\n * component docs). Off by default: a host opts in to dispatching runs on the\n * user's behalf. Pass `{ delayMs }` to tune the grace before the promotion\n * (defaults to `QUEUE_AUTO_CONTINUE_DELAY_MS`).\n */\n autoContinue?: boolean | { delayMs?: number };\n /** Identifies the thread for once-per-entry auto-continue attempts and events. */\n threadId?: string | null;\n /** Telemetry sink for the tray's notable moments. */\n onEvent?: (event: StatewireQueueEvent) => void;\n /** Replace the plain-text row body (e.g. a mention-aware renderer). */\n renderContent?: (context: StatewireQueueRowContentContext) => ReactNode;\n /** Replace the plain textarea inline editor (e.g. the host's composer editor). */\n renderEditor?: (context: StatewireQueueEditorContext) => ReactNode;\n}\n\nexport const StatewireQueuedMessages: FC<StatewireQueuedMessagesProps> = (props) => {\n const extras = useAuiState((s) => s.thread.extras);\n if (!hasStatewireThreadExtras(extras)) return null;\n return <StatewireQueuedMessagesInner {...props} />;\n};\n\nconst StatewireQueuedMessagesInner: FC<StatewireQueuedMessagesProps> = ({\n classNames,\n autoContinue = false,\n threadId = null,\n onEvent,\n renderContent,\n renderEditor,\n}) => {\n // The QUEUE lane only: composer.queue prepends the steer lane, whose entries\n // already render in the message list. A non-empty queue implies a live run\n // entry (the host retires runId only once both lanes drain), so the row\n // controls can always send.\n const runs = useStatewireRuns();\n const { queue, steerQueue, runId } = runs;\n // `failed` joined the runs projection in react-statewire 0.24; a projection\n // without it (an older lib, a stubbed runs read) must not crash the tray.\n const failed = runs.failed ?? [];\n // The host's durable prioritized-id record: a raw path read (the selector\n // must return a stable reference), with the lookup set derived below.\n const rawPrioritizedQueueIds = useStatewireState(\n (state) => readDeepAgentStreamValues(state).prioritizedQueueIds,\n );\n const prioritizedQueueIds = useMemo(\n () => new Set(readPrioritizedQueueIds(rawPrioritizedQueueIds)),\n [rawPrioritizedQueueIds],\n );\n const status = useDeepAgentThreadStatus();\n const { isRunning, isContinuable } = queueLaneFlags(status);\n const aui = useAui();\n const sendCommand = useStatewireSendCommand();\n const listId = useId();\n const [expanded, setExpanded] = useState(true);\n const [editingId, setEditingId] = useState<string | null>(null);\n const [editingText, setEditingText] = useState('');\n // Head entries already auto-promoted once on this mount: an attempt whose\n // continue run dies and re-strands the SAME entry must not loop — the manual\n // Continue pill is the fallback for a repeatedly failing dispatch. Kept on\n // the tray (not the auto-continue child) so it survives the empty-lane\n // renders between a promotion and its outcome.\n const autoContinuedRef = useRef<Set<string>>(new Set());\n const onEventRef = useRef(onEvent);\n onEventRef.current = onEvent;\n\n const rows = buildStatewireQueueRows({ queue, steerQueue, isContinuable });\n // Continue promotes the QUEUE head only: a queue→steer move dispatches the\n // stranded steer lane plus this entry, while a steer entry moved onto its\n // own lane is a no-op.\n const queueHeadId = queue[0]?.id ?? null;\n const retryableRefusal = readRetryableRunRefusal(runs.error) !== null;\n const autoContinueOptions = autoContinue === true ? {} : autoContinue || null;\n\n /**\n * Re-send the entry under its own id on its own lane: the host replaces the\n * queued message's content in place, leaving its queue position and lane\n * untouched (a same-id send never dispatches).\n */\n const saveEdit = (\n item: StatewireThread.RunsQueueEntry,\n lane: 'queue' | 'steer',\n text: string,\n ): void => {\n setEditingId(null);\n setEditingText('');\n const command = buildQueueEditCommand({ item, lane, runId, text });\n if (command !== null) sendCommand(command);\n };\n\n /**\n * Retry/Discard act on a rendered lane snapshot that can trail the session\n * record; acting on an entry statewire already dropped throws. Nothing is\n * lost in that race, so it is recorded instead of crashing the click.\n */\n const runFailedSendAction = ({\n action,\n messageId,\n run,\n }: {\n action: 'retry' | 'discard';\n messageId: string;\n run: (actions: StatewireFailedActions) => void;\n }): void => {\n try {\n run(requireStatewireFailedActions(aui.thread().getState().extras));\n } catch (error) {\n if (!(error instanceof Error) || !isFailedSendEntryRace(error)) throw error;\n onEvent?.({\n type: 'failed-send-action-raced',\n threadId,\n messageId,\n action,\n error: error.message,\n });\n }\n };\n\n if (rows.length === 0 && failed.length === 0) return null;\n\n const renderRowContent = (context: StatewireQueueRowContentContext): ReactNode =>\n renderContent ? (\n renderContent(context)\n ) : (\n <p className=\"min-w-0 flex-1 whitespace-pre-wrap break-words text-foreground text-xs\">\n {context.text || 'Queued attachment'}\n </p>\n );\n\n return (\n <section\n aria-label=\"Queued messages\"\n className={cn(\n 'aui-statewire-queue w-full rounded-xl border border-border/70 bg-muted/30 px-2 py-1.5',\n classNames?.root,\n )}\n >\n {autoContinueOptions ? (\n <QueueAutoContinue\n delayMs={autoContinueOptions.delayMs ?? QUEUE_AUTO_CONTINUE_DELAY_MS}\n queueHeadId={queueHeadId}\n retryableRefusal={retryableRefusal}\n isContinuable={isContinuable}\n status={status}\n threadId={threadId}\n editing={editingId !== null}\n continuedRef={autoContinuedRef}\n onEventRef={onEventRef}\n />\n ) : null}\n <div className=\"flex items-center gap-1.5\">\n <button\n type=\"button\"\n onClick={() => setExpanded((value) => !value)}\n aria-expanded={expanded}\n aria-controls={listId}\n className=\"flex items-center gap-1 rounded px-1 py-1 font-medium text-muted-foreground text-xs hover:text-foreground\"\n >\n {expanded ? (\n <ChevronDownIcon className=\"size-3.5\" />\n ) : (\n <ChevronRightIcon className=\"size-3.5\" />\n )}\n {rows.length + failed.length} queued\n </button>\n {isContinuable && queueHeadId !== null ? (\n <ContinuePill\n ariaLabel=\"Continue with queued messages\"\n onClick={() => aui.composer.queueItem({ id: queueHeadId }).move({ lane: 'steer' })}\n />\n ) : null}\n </div>\n {expanded ? (\n <ul\n id={listId}\n className={cn('max-h-40 overflow-y-auto', classNames?.list)}\n data-testid=\"athena-statewire-queue\"\n >\n {rows.map(({ item, lane }, index) => {\n const text = queueEntryText(item.parts);\n const isUnsettled = isQueueEntryUnsettled(item);\n const isEditing = editingId === item.id;\n const showSendNow =\n !isUnsettled && showQueueRowSendNow({ lane, index, isRunning, isContinuable });\n const showPrioritize = !isUnsettled && lane === 'queue' && isRunning && runId !== null;\n const isPrioritized = prioritizedQueueIds.has(item.id);\n const editorContext: StatewireQueueEditorContext = {\n value: editingText,\n onChange: setEditingText,\n onSave: (next) => saveEdit(item, lane, next),\n onCancel: () => {\n setEditingId(null);\n setEditingText('');\n },\n };\n return (\n <li\n key={item.id}\n className=\"group flex items-start gap-2 rounded-md px-1 py-1.5 hover:bg-background\"\n >\n {isUnsettled ? (\n <Loader2Icon className=\"mt-0.5 size-3.5 shrink-0 animate-spin text-muted-foreground/60\" />\n ) : (\n <CircleIcon className=\"mt-0.5 size-3.5 shrink-0 text-muted-foreground/40\" />\n )}\n {isEditing ? (\n renderEditor ? (\n renderEditor(editorContext)\n ) : (\n <DefaultQueueEditor {...editorContext} />\n )\n ) : (\n renderRowContent({ text, index, item })\n )}\n <div\n className={cn('flex shrink-0 items-center gap-1', isEditing && 'hidden')}\n data-testid=\"statewire-queue-row-actions\"\n >\n {isUnsettled ? (\n <span\n className=\"px-1 text-[10px] text-muted-foreground\"\n data-testid=\"statewire-queued-message-sending\"\n >\n Sending…\n </span>\n ) : null}\n {showSendNow ? (\n <button\n type=\"button\"\n aria-label=\"Send now\"\n onClick={() =>\n aui.composer.queueItem({ id: item.id }).move({ lane: 'steer' })\n }\n className=\"inline-flex items-center gap-1 rounded-full border border-primary/30 px-2 py-1 font-medium text-[10px] text-primary hover:bg-primary/5\"\n >\n <SendIcon className=\"size-2.5\" />\n Send now\n </button>\n ) : null}\n {showPrioritize ? (\n <button\n type=\"button\"\n aria-label={isPrioritized ? 'Remove priority' : 'Prioritize'}\n aria-pressed={isPrioritized}\n title={\n isPrioritized\n ? 'Remove priority'\n : 'Prioritize this message. Delivered as soon as the current step ends.'\n }\n onClick={() => {\n if (runId === null) return;\n sendCommand({\n type: 'run/prioritize',\n runId,\n messageId: item.id,\n priority: !isPrioritized,\n });\n }}\n className={cn(\n 'rounded p-1 transition-colors',\n isPrioritized\n ? 'text-amber-500 hover:text-amber-600'\n : 'text-muted-foreground hover:text-amber-500',\n )}\n >\n <ZapIcon className=\"size-3\" />\n </button>\n ) : null}\n {!isUnsettled ? (\n <button\n type=\"button\"\n aria-label=\"Edit queued message\"\n onClick={() => {\n setEditingId(item.id);\n setEditingText(text);\n }}\n className=\"rounded p-1 text-muted-foreground transition-colors hover:text-primary\"\n >\n <PencilIcon className=\"size-3\" />\n </button>\n ) : null}\n <button\n type=\"button\"\n aria-label=\"Remove queued message\"\n onClick={() => aui.composer.queueItem({ id: item.id }).remove()}\n className={cn(\n 'rounded p-1 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive',\n !showSendNow &&\n 'opacity-0 focus-visible:opacity-100 group-hover:opacity-100',\n )}\n >\n <Trash2Icon className=\"size-3\" />\n </button>\n </div>\n </li>\n );\n })}\n {failed.map((item, index) => (\n <li\n key={item.id}\n className=\"group flex items-start gap-2 rounded-md px-1 py-1.5 hover:bg-background\"\n >\n <AlertCircleIcon className=\"mt-0.5 size-3.5 shrink-0 text-destructive\" />\n {renderRowContent({\n text: queueEntryText(item.parts),\n index: rows.length + index,\n item,\n })}\n <div\n className=\"flex shrink-0 items-center gap-1\"\n data-testid=\"statewire-queue-row-actions\"\n >\n <span\n className=\"px-1 text-[10px] text-destructive\"\n title={describeQueueSendFailure(item.sendFailure)}\n >\n Failed to send\n </span>\n <button\n type=\"button\"\n aria-label=\"Retry failed message\"\n onClick={() =>\n runFailedSendAction({\n action: 'retry',\n messageId: item.id,\n run: (actions) => actions.retryFailed(item.id),\n })\n }\n className=\"inline-flex items-center gap-1 rounded-full border border-primary/30 px-2 py-1 font-medium text-[10px] text-primary hover:bg-primary/5\"\n >\n <RotateCcwIcon className=\"size-2.5\" />\n Retry\n </button>\n <button\n type=\"button\"\n aria-label=\"Discard failed message\"\n onClick={() =>\n runFailedSendAction({\n action: 'discard',\n messageId: item.id,\n run: (actions) => actions.discardFailed(item.id),\n })\n }\n className=\"rounded p-1 text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive\"\n >\n <Trash2Icon className=\"size-3\" />\n </button>\n </div>\n </li>\n ))}\n </ul>\n ) : null}\n </section>\n );\n};\n\n/** Promotes ordinary stranded queue heads once; infrastructure recovery stays server-owned. */\nconst QueueAutoContinue: FC<{\n delayMs: number;\n queueHeadId: string | null;\n retryableRefusal: boolean;\n isContinuable: boolean;\n status: DeepAgentThreadStatus;\n threadId: string | null;\n editing: boolean;\n continuedRef: MutableRefObject<Set<string>>;\n onEventRef: MutableRefObject<((event: StatewireQueueEvent) => void) | undefined>;\n}> = ({\n delayMs,\n queueHeadId,\n retryableRefusal,\n isContinuable,\n status,\n threadId,\n editing,\n continuedRef,\n onEventRef,\n}) => {\n const aui = useAui();\n // The settle that stranded the queue is described by the LAST message's run\n // marker (a marker deeper in history was superseded by a later send). The\n // selectors return primitives so the subscriptions stay shallow-stable.\n const lastMessageMarker = useAuiState((s) => {\n const last = s.thread.messages.at(-1);\n return last ? readRunMarkerFromSourceMessages(last)?.marker : undefined;\n });\n const lastMessageMarkerSource = useAuiState((s) => {\n const last = s.thread.messages.at(-1);\n return last ? readRunMarkerFromSourceMessages(last)?.source : undefined;\n });\n const userStopBlocks = userStopBlocksQueueAutoContinue({\n marker: lastMessageMarker,\n source: lastMessageMarkerSource,\n });\n\n useEffect(() => {\n if (\n !isContinuable ||\n userStopBlocks ||\n retryableRefusal ||\n isServerUpdateStopSource(lastMessageMarkerSource)\n ) return;\n // An open inline edit means the user is mid-revision on some row —\n // dispatching underneath them could send text they are about to change.\n if (editing) return;\n if (queueHeadId === null) return;\n const attemptKey = `${threadId ?? 'unknown'}:${queueHeadId}`;\n if (continuedRef.current.has(attemptKey)) return;\n const timeoutId = setTimeout(() => {\n continuedRef.current.add(attemptKey);\n onEventRef.current?.({ type: 'auto-continued', threadId, status, headEntryId: queueHeadId });\n aui.composer.queueItem({ id: queueHeadId }).move({ lane: 'steer' });\n }, delayMs);\n return () => clearTimeout(timeoutId);\n }, [\n continuedRef,\n aui,\n delayMs,\n editing,\n isContinuable,\n onEventRef,\n queueHeadId,\n retryableRefusal,\n lastMessageMarkerSource,\n status,\n threadId,\n userStopBlocks,\n ]);\n\n return null;\n};\n\n/** Plain textarea editor: Enter saves, Shift+Enter breaks a line, Escape cancels. */\nconst DefaultQueueEditor: FC<StatewireQueueEditorContext> = ({\n value,\n onChange,\n onSave,\n onCancel,\n}) => {\n const canSave = value.trim().length > 0;\n const handleKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>): void => {\n if (event.key === 'Enter' && !event.shiftKey) {\n event.preventDefault();\n if (canSave) onSave(value);\n } else if (event.key === 'Escape') {\n event.preventDefault();\n onCancel();\n }\n };\n return (\n <div className=\"flex min-w-0 flex-1 items-start gap-1\">\n <textarea\n autoFocus\n aria-label=\"Edit message\"\n value={value}\n onChange={(event) => onChange(event.target.value)}\n onKeyDown={handleKeyDown}\n rows={Math.min(6, Math.max(1, value.split('\\n').length))}\n className=\"min-w-0 flex-1 resize-none rounded-md border border-border bg-background px-2 py-1 text-foreground text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring/50\"\n />\n <button\n type=\"button\"\n aria-label=\"Save edit\"\n disabled={!canSave}\n onClick={() => onSave(value)}\n className={cn(\n 'rounded p-1 text-primary transition-colors hover:bg-primary/10',\n !canSave && 'cursor-not-allowed opacity-40',\n )}\n >\n <CheckIcon className=\"size-3.5\" />\n </button>\n <button\n type=\"button\"\n aria-label=\"Cancel edit\"\n onClick={onCancel}\n className=\"rounded p-1 text-muted-foreground transition-colors hover:bg-muted\"\n >\n <XIcon className=\"size-3.5\" />\n </button>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAqKO,MAAM,0BAA4D,CAAC,UAAU;AAClF,QAAM,SAAS,YAAY,CAAC,MAAM,EAAE,OAAO,MAAM;AACjD,MAAI,CAAC,yBAAyB,MAAM,EAAG,QAAO;AAC9C,SAAO,oBAAC,8BAAA,EAA8B,GAAG,MAAA,CAAO;AAClD;AAEA,MAAM,+BAAiE,CAAC;AAAA,EACtE;AAAA,EACA,eAAe;AAAA,EACf,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AACF,MAAM;;AAKJ,QAAM,OAAO,iBAAA;AACb,QAAM,EAAE,OAAO,YAAY,MAAA,IAAU;AAGrC,QAAM,SAAS,KAAK,UAAU,CAAA;AAG9B,QAAM,yBAAyB;AAAA,IAC7B,CAAC,UAAU,0BAA0B,KAAK,EAAE;AAAA,EAAA;AAE9C,QAAM,sBAAsB;AAAA,IAC1B,MAAM,IAAI,IAAI,wBAAwB,sBAAsB,CA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AElC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,cAAW;AAAA,QACX,SAAS;AAAA,QACT,WAAU;AAAA,QAEV,UAAA,oBAAC,OAAA,EAAM,WAAU,WAAA,CAAW;AAAA,MAAA;AAAA,IAAA;AAAA,EAC9B,GACF;AAEJ;"}
@@ -2,28 +2,13 @@
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
- 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
- const interrupts = require("../packages/agent-runtime/src/interrupts.cjs");
13
- require("../packages/agent-runtime/src/messages.cjs");
14
- require("../packages/agent-runtime/src/statewire-state.cjs");
15
- const threadExtras = require("../packages/agent-runtime/src/thread-extras.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
5
  const lucideReact = require("lucide-react");
6
+ const react$1 = require("react");
24
7
  const statewireHistoryEdge = require("../chat-ui/thread/statewire-history-edge.cjs");
25
8
  const useAthenaSessionAttention = require("../threads/use-athena-session-attention.cjs");
26
9
  const useStatewireApprovalRequest = require("./use-statewire-approval-request.cjs");
10
+ const threadExtras = require("../packages/agent-runtime/src/thread-extras.cjs");
11
+ const interrupts = require("../packages/agent-runtime/src/interrupts.cjs");
27
12
  const cnfast = require("cnfast");
28
13
  const APPROVAL_CARD_SELECTOR = ".aui-approval-card";
29
14
  const WaitingOnYouBanner = (props) => {
@@ -1 +1 @@
1
- {"version":3,"file":"WaitingOnYouBanner.cjs","sources":["../../src/chat/WaitingOnYouBanner.tsx"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport { hasStatewireThreadExtras, readInterruptMessage } from '@athenaintel/agent-runtime';\nimport { HandIcon } from 'lucide-react';\nimport { type FC, useCallback, useRef } from 'react';\nimport { THREAD_VIEWPORT_ATTR } from '../chat-ui/thread/statewire-history-edge';\nimport { cn } from '../lib/utils';\nimport {\n type AthenaSessionAttention,\n useAthenaSessionAttention,\n} from '../threads/use-athena-session-attention';\nimport { useStatewireApprovalRequest } from './use-statewire-approval-request';\n\n/** The CSS class `StatewireApprovalCard` puts on its section; the banner scrolls to it. */\nconst APPROVAL_CARD_SELECTOR = '.aui-approval-card';\n\nexport interface WaitingOnYouBannerProps {\n /** Applied to the outer wrapper (host padding); the banner itself is width-capped inside it. */\n className?: string;\n /** Copy shown when a parked interrupt carries no message. */\n fallbackMessage?: string;\n}\n\n/**\n * Persistent top-of-thread banner for a session that is waiting on the\n * viewer: shown while the active thread's attention is `needs_you` (from the\n * thread list) or while the approval hook reports a pending request. The text\n * is the server's next action, else a summary of the pending request; a\n * click scrolls to the approval card (or to the composer when there is no\n * card). It never duplicates the card's decision buttons — the card stays the\n * one place a request is answered. Renders nothing otherwise.\n */\nexport const WaitingOnYouBanner: FC<WaitingOnYouBannerProps> = (props) => {\n const extras = useAuiState((s) => s.thread.extras);\n const attention = useAthenaSessionAttention();\n // `useStatewireApprovalRequest` needs a statewire aui scope (it throws\n // outside one), so the approval leg mounts only once the thread extras are.\n if (!hasStatewireThreadExtras(extras)) {\n return <WaitingOnYouBannerView attention={attention} approvalSummary={null} {...props} />;\n }\n return <WaitingOnYouBannerWithApproval attention={attention} {...props} />;\n};\n\nconst WaitingOnYouBannerWithApproval: FC<\n WaitingOnYouBannerProps & { attention: AthenaSessionAttention | null }\n> = ({ attention, fallbackMessage, ...props }) => {\n const { request, hitl, liveHitl } = useStatewireApprovalRequest();\n const pending = request !== undefined || liveHitl !== null;\n const payload = hitl ?? liveHitl;\n const toolName = payload?.context?.tool_name ?? payload?.context?.tool_id;\n const pendingCount = payload?.context?.pending_action_count ?? 1;\n const approvalSummary = !pending\n ? null\n : payload && pendingCount === 1 && toolName\n ? `${toolName} requires approval before it runs.`\n : readInterruptMessage(request ? request.payload : liveHitl, fallbackMessage);\n return <WaitingOnYouBannerView attention={attention} approvalSummary={approvalSummary} {...props} />;\n};\n\nexport interface WaitingOnYouBannerViewProps {\n attention: Pick<AthenaSessionAttention, 'attention' | 'nextAction'> | null;\n /** Summary of the pending approval, or `null` when nothing is parked. */\n approvalSummary: string | null;\n className?: string;\n}\n\n/**\n * The banner itself, over already-resolved inputs — the pure presenter\n * `WaitingOnYouBanner` binds to the thread list and the approval hook.\n */\nexport const WaitingOnYouBannerView: FC<WaitingOnYouBannerViewProps> = ({\n attention,\n approvalSummary,\n className,\n}) => {\n const rootRef = useRef<HTMLDivElement>(null);\n const scrollToApproval = useCallback(() => {\n const root = rootRef.current;\n if (!root) return;\n // The nearest ancestor that holds the thread viewport is the chat panel;\n // the card lives in that viewport's sticky footer.\n let scope: HTMLElement | null = root.parentElement;\n while (scope && scope.querySelector(`[${THREAD_VIEWPORT_ATTR}]`) === null) {\n scope = scope.parentElement;\n }\n const container: ParentNode = scope ?? root.ownerDocument;\n const card = container.querySelector<HTMLElement>(APPROVAL_CARD_SELECTOR);\n if (card) {\n card.scrollIntoView({ behavior: 'smooth', block: 'nearest' });\n return;\n }\n const viewport = container.querySelector<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`);\n viewport?.scrollTo({ top: viewport.scrollHeight, behavior: 'smooth' });\n }, []);\n\n const needsYou = attention?.attention === 'needs_you';\n const pending = approvalSummary !== null;\n if (!needsYou && !pending) return null;\n const text =\n attention?.nextAction?.trim() || approvalSummary || 'This session is waiting on you.';\n\n return (\n <div ref={rootRef} className={cn('aui-waiting-on-you', className)}>\n <div\n role=\"status\"\n data-testid=\"waiting-on-you-banner\"\n data-pending-approval={pending || undefined}\n className=\"mx-auto w-full max-w-(--thread-max-width) rounded-xl border border-amber-300 bg-amber-50 text-amber-900\"\n >\n <button\n type=\"button\"\n onClick={scrollToApproval}\n className=\"flex w-full items-center gap-2 px-3 py-2 text-left text-xs transition-colors hover:bg-amber-100/70\"\n >\n <HandIcon className=\"size-4 shrink-0\" aria-hidden=\"true\" />\n <span className=\"shrink-0 font-semibold\">Waiting on you</span>\n <span className=\"min-w-0 flex-1 truncate text-amber-800\">{text}</span>\n {pending ? (\n <span className=\"shrink-0 font-medium underline-offset-2 hover:underline\">\n Review\n </span>\n ) : null}\n </button>\n </div>\n </div>\n );\n};\n"],"names":["useAuiState","useAthenaSessionAttention","hasStatewireThreadExtras","jsx","useStatewireApprovalRequest","readInterruptMessage","useRef","useCallback","THREAD_VIEWPORT_ATTR","cn","jsxs","HandIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAM,yBAAyB;AAkBxB,MAAM,qBAAkD,CAAC,UAAU;AACxE,QAAM,SAASA,MAAAA,YAAY,CAAC,MAAM,EAAE,OAAO,MAAM;AACjD,QAAM,YAAYC,0BAAAA,0BAAA;AAGlB,MAAI,CAACC,aAAAA,yBAAyB,MAAM,GAAG;AACrC,0CAAQ,wBAAA,EAAuB,WAAsB,iBAAiB,MAAO,GAAG,OAAO;AAAA,EACzF;AACA,SAAOC,2BAAAA,IAAC,gCAAA,EAA+B,WAAuB,GAAG,MAAA,CAAO;AAC1E;AAEA,MAAM,iCAEF,CAAC,EAAE,WAAW,iBAAiB,GAAG,YAAY;;AAChD,QAAM,EAAE,SAAS,MAAM,SAAA,IAAaC,4BAAAA,4BAAA;AACpC,QAAM,UAAU,YAAY,UAAa,aAAa;AACtD,QAAM,UAAU,QAAQ;AACxB,QAAM,aAAW,wCAAS,YAAT,mBAAkB,gBAAa,wCAAS,YAAT,mBAAkB;AAClE,QAAM,iBAAe,wCAAS,YAAT,mB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AAA;AAAA,UACC,MAAK;AAAA,UACL,SAAS;AAAA,UACT,WAAU;AAAA,UAEV,UAAA;AAAA,YAAAP,2BAAAA,IAACQ,YAAAA,UAAA,EAAS,WAAU,mBAAkB,eAAY,QAAO;AAAA,YACzDR,2BAAAA,IAAC,QAAA,EAAK,WAAU,0BAAyB,UAAA,kBAAc;AAAA,YACvDA,2BAAAA,IAAC,QAAA,EAAK,WAAU,0CAA0C,UAAA,MAAK;AAAA,YAC9D,UACCA,2BAAAA,IAAC,QAAA,EAAK,WAAU,2DAA0D,oBAE1E,IACE;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACN;AAAA,EAAA,GAEJ;AAEJ;;;"}
1
+ {"version":3,"file":"WaitingOnYouBanner.cjs","sources":["../../src/chat/WaitingOnYouBanner.tsx"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport { hasStatewireThreadExtras, readInterruptMessage } from '@athenaintel/agent-runtime';\nimport { HandIcon } from 'lucide-react';\nimport { type FC, useCallback, useRef } from 'react';\nimport { THREAD_VIEWPORT_ATTR } from '../chat-ui/thread/statewire-history-edge';\nimport { cn } from '../lib/utils';\nimport {\n type AthenaSessionAttention,\n useAthenaSessionAttention,\n} from '../threads/use-athena-session-attention';\nimport { useStatewireApprovalRequest } from './use-statewire-approval-request';\n\n/** The CSS class `StatewireApprovalCard` puts on its section; the banner scrolls to it. */\nconst APPROVAL_CARD_SELECTOR = '.aui-approval-card';\n\nexport interface WaitingOnYouBannerProps {\n /** Applied to the outer wrapper (host padding); the banner itself is width-capped inside it. */\n className?: string;\n /** Copy shown when a parked interrupt carries no message. */\n fallbackMessage?: string;\n}\n\n/**\n * Persistent top-of-thread banner for a session that is waiting on the\n * viewer: shown while the active thread's attention is `needs_you` (from the\n * thread list) or while the approval hook reports a pending request. The text\n * is the server's next action, else a summary of the pending request; a\n * click scrolls to the approval card (or to the composer when there is no\n * card). It never duplicates the card's decision buttons — the card stays the\n * one place a request is answered. Renders nothing otherwise.\n */\nexport const WaitingOnYouBanner: FC<WaitingOnYouBannerProps> = (props) => {\n const extras = useAuiState((s) => s.thread.extras);\n const attention = useAthenaSessionAttention();\n // `useStatewireApprovalRequest` needs a statewire aui scope (it throws\n // outside one), so the approval leg mounts only once the thread extras are.\n if (!hasStatewireThreadExtras(extras)) {\n return <WaitingOnYouBannerView attention={attention} approvalSummary={null} {...props} />;\n }\n return <WaitingOnYouBannerWithApproval attention={attention} {...props} />;\n};\n\nconst WaitingOnYouBannerWithApproval: FC<\n WaitingOnYouBannerProps & { attention: AthenaSessionAttention | null }\n> = ({ attention, fallbackMessage, ...props }) => {\n const { request, hitl, liveHitl } = useStatewireApprovalRequest();\n const pending = request !== undefined || liveHitl !== null;\n const payload = hitl ?? liveHitl;\n const toolName = payload?.context?.tool_name ?? payload?.context?.tool_id;\n const pendingCount = payload?.context?.pending_action_count ?? 1;\n const approvalSummary = !pending\n ? null\n : payload && pendingCount === 1 && toolName\n ? `${toolName} requires approval before it runs.`\n : readInterruptMessage(request ? request.payload : liveHitl, fallbackMessage);\n return <WaitingOnYouBannerView attention={attention} approvalSummary={approvalSummary} {...props} />;\n};\n\nexport interface WaitingOnYouBannerViewProps {\n attention: Pick<AthenaSessionAttention, 'attention' | 'nextAction'> | null;\n /** Summary of the pending approval, or `null` when nothing is parked. */\n approvalSummary: string | null;\n className?: string;\n}\n\n/**\n * The banner itself, over already-resolved inputs — the pure presenter\n * `WaitingOnYouBanner` binds to the thread list and the approval hook.\n */\nexport const WaitingOnYouBannerView: FC<WaitingOnYouBannerViewProps> = ({\n attention,\n approvalSummary,\n className,\n}) => {\n const rootRef = useRef<HTMLDivElement>(null);\n const scrollToApproval = useCallback(() => {\n const root = rootRef.current;\n if (!root) return;\n // The nearest ancestor that holds the thread viewport is the chat panel;\n // the card lives in that viewport's sticky footer.\n let scope: HTMLElement | null = root.parentElement;\n while (scope && scope.querySelector(`[${THREAD_VIEWPORT_ATTR}]`) === null) {\n scope = scope.parentElement;\n }\n const container: ParentNode = scope ?? root.ownerDocument;\n const card = container.querySelector<HTMLElement>(APPROVAL_CARD_SELECTOR);\n if (card) {\n card.scrollIntoView({ behavior: 'smooth', block: 'nearest' });\n return;\n }\n const viewport = container.querySelector<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`);\n viewport?.scrollTo({ top: viewport.scrollHeight, behavior: 'smooth' });\n }, []);\n\n const needsYou = attention?.attention === 'needs_you';\n const pending = approvalSummary !== null;\n if (!needsYou && !pending) return null;\n const text =\n attention?.nextAction?.trim() || approvalSummary || 'This session is waiting on you.';\n\n return (\n <div ref={rootRef} className={cn('aui-waiting-on-you', className)}>\n <div\n role=\"status\"\n data-testid=\"waiting-on-you-banner\"\n data-pending-approval={pending || undefined}\n className=\"mx-auto w-full max-w-(--thread-max-width) rounded-xl border border-amber-300 bg-amber-50 text-amber-900\"\n >\n <button\n type=\"button\"\n onClick={scrollToApproval}\n className=\"flex w-full items-center gap-2 px-3 py-2 text-left text-xs transition-colors hover:bg-amber-100/70\"\n >\n <HandIcon className=\"size-4 shrink-0\" aria-hidden=\"true\" />\n <span className=\"shrink-0 font-semibold\">Waiting on you</span>\n <span className=\"min-w-0 flex-1 truncate text-amber-800\">{text}</span>\n {pending ? (\n <span className=\"shrink-0 font-medium underline-offset-2 hover:underline\">\n Review\n </span>\n ) : null}\n </button>\n </div>\n </div>\n );\n};\n"],"names":["useAuiState","useAthenaSessionAttention","hasStatewireThreadExtras","jsx","useStatewireApprovalRequest","readInterruptMessage","useRef","useCallback","THREAD_VIEWPORT_ATTR","cn","jsxs","HandIcon"],"mappings":";;;;;;;;;;;;AAaA,MAAM,yBAAyB;AAkBxB,MAAM,qBAAkD,CAAC,UAAU;AACxE,QAAM,SAASA,MAAAA,YAAY,CAAC,MAAM,EAAE,OAAO,MAAM;AACjD,QAAM,YAAYC,0BAAAA,0BAAA;AAGlB,MAAI,CAACC,aAAAA,yBAAyB,MAAM,GAAG;AACrC,0CAAQ,wBAAA,EAAuB,WAAsB,i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M,YAAW,uCAAW,eAAc;AAC1C,QAAM,UAAU,oBAAoB;AACpC,MAAI,CAAC,YAAY,CAAC,QAAS,QAAO;AAClC,QAAM,SACJ,4CAAW,eAAX,mBAAuB,WAAU,mBAAmB;AAEtD,SACEL,+BAAC,SAAI,KAAK,SAAS,WAAWM,OAAAA,GAAG,sBAAsB,SAAS,GAC9D,UAAAN,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,eAAY;AAAA,MACZ,yBAAuB,WAAW;AAAA,MAClC,WAAU;AAAA,MAEV,UAAAO,2BAAAA;AAAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAS;AAAA,UACT,WAAU;AAAA,UAEV,UAAA;AAAA,YAAAP,2BAAAA,IAACQ,YAAAA,UAAA,EAAS,WAAU,mBAAkB,eAAY,QAAO;AAAA,YACzDR,2BAAAA,IAAC,QAAA,EAAK,WAAU,0BAAyB,UAAA,kBAAc;AAAA,YACvDA,2BAAAA,IAAC,QAAA,EAAK,WAAU,0CAA0C,UAAA,MAAK;AAAA,YAC9D,UACCA,2BAAAA,IAAC,QAAA,EAAK,WAAU,2DAA0D,oBAE1E,IACE;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACN;AAAA,EAAA,GAEJ;AAEJ;;;"}
@@ -1,27 +1,12 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useAuiState } from "@assistant-ui/react";
3
- import "../packages/agent-runtime/src/generated/runconfig-contract.js";
4
- import { useRef, useCallback } 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 { readInterruptMessage } from "../packages/agent-runtime/src/interrupts.js";
11
- import "../packages/agent-runtime/src/messages.js";
12
- import "../packages/agent-runtime/src/statewire-state.js";
13
- import { hasStatewireThreadExtras } from "../packages/agent-runtime/src/thread-extras.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
3
  import { HandIcon } from "lucide-react";
4
+ import { useRef, useCallback } from "react";
22
5
  import { THREAD_VIEWPORT_ATTR } from "../chat-ui/thread/statewire-history-edge.js";
23
6
  import { useAthenaSessionAttention } from "../threads/use-athena-session-attention.js";
24
7
  import { useStatewireApprovalRequest } from "./use-statewire-approval-request.js";
8
+ import { hasStatewireThreadExtras } from "../packages/agent-runtime/src/thread-extras.js";
9
+ import { readInterruptMessage } from "../packages/agent-runtime/src/interrupts.js";
25
10
  import { cn } from "cnfast";
26
11
  const APPROVAL_CARD_SELECTOR = ".aui-approval-card";
27
12
  const WaitingOnYouBanner = (props) => {
@@ -1 +1 @@
1
- {"version":3,"file":"WaitingOnYouBanner.js","sources":["../../src/chat/WaitingOnYouBanner.tsx"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport { hasStatewireThreadExtras, readInterruptMessage } from '@athenaintel/agent-runtime';\nimport { HandIcon } from 'lucide-react';\nimport { type FC, useCallback, useRef } from 'react';\nimport { THREAD_VIEWPORT_ATTR } from '../chat-ui/thread/statewire-history-edge';\nimport { cn } from '../lib/utils';\nimport {\n type AthenaSessionAttention,\n useAthenaSessionAttention,\n} from '../threads/use-athena-session-attention';\nimport { useStatewireApprovalRequest } from './use-statewire-approval-request';\n\n/** The CSS class `StatewireApprovalCard` puts on its section; the banner scrolls to it. */\nconst APPROVAL_CARD_SELECTOR = '.aui-approval-card';\n\nexport interface WaitingOnYouBannerProps {\n /** Applied to the outer wrapper (host padding); the banner itself is width-capped inside it. */\n className?: string;\n /** Copy shown when a parked interrupt carries no message. */\n fallbackMessage?: string;\n}\n\n/**\n * Persistent top-of-thread banner for a session that is waiting on the\n * viewer: shown while the active thread's attention is `needs_you` (from the\n * thread list) or while the approval hook reports a pending request. The text\n * is the server's next action, else a summary of the pending request; a\n * click scrolls to the approval card (or to the composer when there is no\n * card). It never duplicates the card's decision buttons — the card stays the\n * one place a request is answered. Renders nothing otherwise.\n */\nexport const WaitingOnYouBanner: FC<WaitingOnYouBannerProps> = (props) => {\n const extras = useAuiState((s) => s.thread.extras);\n const attention = useAthenaSessionAttention();\n // `useStatewireApprovalRequest` needs a statewire aui scope (it throws\n // outside one), so the approval leg mounts only once the thread extras are.\n if (!hasStatewireThreadExtras(extras)) {\n return <WaitingOnYouBannerView attention={attention} approvalSummary={null} {...props} />;\n }\n return <WaitingOnYouBannerWithApproval attention={attention} {...props} />;\n};\n\nconst WaitingOnYouBannerWithApproval: FC<\n WaitingOnYouBannerProps & { attention: AthenaSessionAttention | null }\n> = ({ attention, fallbackMessage, ...props }) => {\n const { request, hitl, liveHitl } = useStatewireApprovalRequest();\n const pending = request !== undefined || liveHitl !== null;\n const payload = hitl ?? liveHitl;\n const toolName = payload?.context?.tool_name ?? payload?.context?.tool_id;\n const pendingCount = payload?.context?.pending_action_count ?? 1;\n const approvalSummary = !pending\n ? null\n : payload && pendingCount === 1 && toolName\n ? `${toolName} requires approval before it runs.`\n : readInterruptMessage(request ? request.payload : liveHitl, fallbackMessage);\n return <WaitingOnYouBannerView attention={attention} approvalSummary={approvalSummary} {...props} />;\n};\n\nexport interface WaitingOnYouBannerViewProps {\n attention: Pick<AthenaSessionAttention, 'attention' | 'nextAction'> | null;\n /** Summary of the pending approval, or `null` when nothing is parked. */\n approvalSummary: string | null;\n className?: string;\n}\n\n/**\n * The banner itself, over already-resolved inputs — the pure presenter\n * `WaitingOnYouBanner` binds to the thread list and the approval hook.\n */\nexport const WaitingOnYouBannerView: FC<WaitingOnYouBannerViewProps> = ({\n attention,\n approvalSummary,\n className,\n}) => {\n const rootRef = useRef<HTMLDivElement>(null);\n const scrollToApproval = useCallback(() => {\n const root = rootRef.current;\n if (!root) return;\n // The nearest ancestor that holds the thread viewport is the chat panel;\n // the card lives in that viewport's sticky footer.\n let scope: HTMLElement | null = root.parentElement;\n while (scope && scope.querySelector(`[${THREAD_VIEWPORT_ATTR}]`) === null) {\n scope = scope.parentElement;\n }\n const container: ParentNode = scope ?? root.ownerDocument;\n const card = container.querySelector<HTMLElement>(APPROVAL_CARD_SELECTOR);\n if (card) {\n card.scrollIntoView({ behavior: 'smooth', block: 'nearest' });\n return;\n }\n const viewport = container.querySelector<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`);\n viewport?.scrollTo({ top: viewport.scrollHeight, behavior: 'smooth' });\n }, []);\n\n const needsYou = attention?.attention === 'needs_you';\n const pending = approvalSummary !== null;\n if (!needsYou && !pending) return null;\n const text =\n attention?.nextAction?.trim() || approvalSummary || 'This session is waiting on you.';\n\n return (\n <div ref={rootRef} className={cn('aui-waiting-on-you', className)}>\n <div\n role=\"status\"\n data-testid=\"waiting-on-you-banner\"\n data-pending-approval={pending || undefined}\n className=\"mx-auto w-full max-w-(--thread-max-width) rounded-xl border border-amber-300 bg-amber-50 text-amber-900\"\n >\n <button\n type=\"button\"\n onClick={scrollToApproval}\n className=\"flex w-full items-center gap-2 px-3 py-2 text-left text-xs transition-colors hover:bg-amber-100/70\"\n >\n <HandIcon className=\"size-4 shrink-0\" aria-hidden=\"true\" />\n <span className=\"shrink-0 font-semibold\">Waiting on you</span>\n <span className=\"min-w-0 flex-1 truncate text-amber-800\">{text}</span>\n {pending ? (\n <span className=\"shrink-0 font-medium underline-offset-2 hover:underline\">\n Review\n </span>\n ) : null}\n </button>\n </div>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAM,yBAAyB;AAkBxB,MAAM,qBAAkD,CAAC,UAAU;AACxE,QAAM,SAAS,YAAY,CAAC,MAAM,EAAE,OAAO,MAAM;AACjD,QAAM,YAAY,0BAAA;AAGlB,MAAI,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AEL,QAAM,YAAW,uCAAW,eAAc;AAC1C,QAAM,UAAU,oBAAoB;AACpC,MAAI,CAAC,YAAY,CAAC,QAAS,QAAO;AAClC,QAAM,SACJ,4CAAW,eAAX,mBAAuB,WAAU,mBAAmB;AAEtD,SACE,oBAAC,SAAI,KAAK,SAAS,WAAW,GAAG,sBAAsB,SAAS,GAC9D,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,eAAY;AAAA,MACZ,yBAAuB,WAAW;AAAA,MAClC,WAAU;AAAA,MAEV,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAS;AAAA,UACT,WAAU;AAAA,UAEV,UAAA;AAAA,YAAA,oBAAC,UAAA,EAAS,WAAU,mBAAkB,eAAY,QAAO;AAAA,YACzD,oBAAC,QAAA,EAAK,WAAU,0BAAyB,UAAA,kBAAc;AAAA,YACvD,oBAAC,QAAA,EAAK,WAAU,0CAA0C,UAAA,MAAK;AAAA,YAC9D,UACC,oBAAC,QAAA,EAAK,WAAU,2DAA0D,oBAE1E,IACE;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACN;AAAA,EAAA,GAEJ;AAEJ;"}
1
+ {"version":3,"file":"WaitingOnYouBanner.js","sources":["../../src/chat/WaitingOnYouBanner.tsx"],"sourcesContent":["import { useAuiState } from '@assistant-ui/react';\nimport { hasStatewireThreadExtras, readInterruptMessage } from '@athenaintel/agent-runtime';\nimport { HandIcon } from 'lucide-react';\nimport { type FC, useCallback, useRef } from 'react';\nimport { THREAD_VIEWPORT_ATTR } from '../chat-ui/thread/statewire-history-edge';\nimport { cn } from '../lib/utils';\nimport {\n type AthenaSessionAttention,\n useAthenaSessionAttention,\n} from '../threads/use-athena-session-attention';\nimport { useStatewireApprovalRequest } from './use-statewire-approval-request';\n\n/** The CSS class `StatewireApprovalCard` puts on its section; the banner scrolls to it. */\nconst APPROVAL_CARD_SELECTOR = '.aui-approval-card';\n\nexport interface WaitingOnYouBannerProps {\n /** Applied to the outer wrapper (host padding); the banner itself is width-capped inside it. */\n className?: string;\n /** Copy shown when a parked interrupt carries no message. */\n fallbackMessage?: string;\n}\n\n/**\n * Persistent top-of-thread banner for a session that is waiting on the\n * viewer: shown while the active thread's attention is `needs_you` (from the\n * thread list) or while the approval hook reports a pending request. The text\n * is the server's next action, else a summary of the pending request; a\n * click scrolls to the approval card (or to the composer when there is no\n * card). It never duplicates the card's decision buttons — the card stays the\n * one place a request is answered. Renders nothing otherwise.\n */\nexport const WaitingOnYouBanner: FC<WaitingOnYouBannerProps> = (props) => {\n const extras = useAuiState((s) => s.thread.extras);\n const attention = useAthenaSessionAttention();\n // `useStatewireApprovalRequest` needs a statewire aui scope (it throws\n // outside one), so the approval leg mounts only once the thread extras are.\n if (!hasStatewireThreadExtras(extras)) {\n return <WaitingOnYouBannerView attention={attention} approvalSummary={null} {...props} />;\n }\n return <WaitingOnYouBannerWithApproval attention={attention} {...props} />;\n};\n\nconst WaitingOnYouBannerWithApproval: FC<\n WaitingOnYouBannerProps & { attention: AthenaSessionAttention | null }\n> = ({ attention, fallbackMessage, ...props }) => {\n const { request, hitl, liveHitl } = useStatewireApprovalRequest();\n const pending = request !== undefined || liveHitl !== null;\n const payload = hitl ?? liveHitl;\n const toolName = payload?.context?.tool_name ?? payload?.context?.tool_id;\n const pendingCount = payload?.context?.pending_action_count ?? 1;\n const approvalSummary = !pending\n ? null\n : payload && pendingCount === 1 && toolName\n ? `${toolName} requires approval before it runs.`\n : readInterruptMessage(request ? request.payload : liveHitl, fallbackMessage);\n return <WaitingOnYouBannerView attention={attention} approvalSummary={approvalSummary} {...props} />;\n};\n\nexport interface WaitingOnYouBannerViewProps {\n attention: Pick<AthenaSessionAttention, 'attention' | 'nextAction'> | null;\n /** Summary of the pending approval, or `null` when nothing is parked. */\n approvalSummary: string | null;\n className?: string;\n}\n\n/**\n * The banner itself, over already-resolved inputs — the pure presenter\n * `WaitingOnYouBanner` binds to the thread list and the approval hook.\n */\nexport const WaitingOnYouBannerView: FC<WaitingOnYouBannerViewProps> = ({\n attention,\n approvalSummary,\n className,\n}) => {\n const rootRef = useRef<HTMLDivElement>(null);\n const scrollToApproval = useCallback(() => {\n const root = rootRef.current;\n if (!root) return;\n // The nearest ancestor that holds the thread viewport is the chat panel;\n // the card lives in that viewport's sticky footer.\n let scope: HTMLElement | null = root.parentElement;\n while (scope && scope.querySelector(`[${THREAD_VIEWPORT_ATTR}]`) === null) {\n scope = scope.parentElement;\n }\n const container: ParentNode = scope ?? root.ownerDocument;\n const card = container.querySelector<HTMLElement>(APPROVAL_CARD_SELECTOR);\n if (card) {\n card.scrollIntoView({ behavior: 'smooth', block: 'nearest' });\n return;\n }\n const viewport = container.querySelector<HTMLElement>(`[${THREAD_VIEWPORT_ATTR}]`);\n viewport?.scrollTo({ top: viewport.scrollHeight, behavior: 'smooth' });\n }, []);\n\n const needsYou = attention?.attention === 'needs_you';\n const pending = approvalSummary !== null;\n if (!needsYou && !pending) return null;\n const text =\n attention?.nextAction?.trim() || approvalSummary || 'This session is waiting on you.';\n\n return (\n <div ref={rootRef} className={cn('aui-waiting-on-you', className)}>\n <div\n role=\"status\"\n data-testid=\"waiting-on-you-banner\"\n data-pending-approval={pending || undefined}\n className=\"mx-auto w-full max-w-(--thread-max-width) rounded-xl border border-amber-300 bg-amber-50 text-amber-900\"\n >\n <button\n type=\"button\"\n onClick={scrollToApproval}\n className=\"flex w-full items-center gap-2 px-3 py-2 text-left text-xs transition-colors hover:bg-amber-100/70\"\n >\n <HandIcon className=\"size-4 shrink-0\" aria-hidden=\"true\" />\n <span className=\"shrink-0 font-semibold\">Waiting on you</span>\n <span className=\"min-w-0 flex-1 truncate text-amber-800\">{text}</span>\n {pending ? (\n <span className=\"shrink-0 font-medium underline-offset-2 hover:underline\">\n Review\n </span>\n ) : null}\n </button>\n </div>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAaA,MAAM,yBAAyB;AAkBxB,MAA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WAAW,UAAU,cAA2B,IAAI,oBAAoB,GAAG;AACjF,yCAAU,SAAS,EAAE,KAAK,SAAS,cAAc,UAAU;EAC7D,GAAG,CAAA,CAAE;AAEL,QAAM,YAAW,uCAAW,eAAc;AAC1C,QAAM,UAAU,oBAAoB;AACpC,MAAI,CAAC,YAAY,CAAC,QAAS,QAAO;AAClC,QAAM,SACJ,4CAAW,eAAX,mBAAuB,WAAU,mBAAmB;AAEtD,SACE,oBAAC,SAAI,KAAK,SAAS,WAAW,GAAG,sBAAsB,SAAS,GAC9D,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,eAAY;AAAA,MACZ,yBAAuB,WAAW;AAAA,MAClC,WAAU;AAAA,MAEV,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAS;AAAA,UACT,WAAU;AAAA,UAEV,UAAA;AAAA,YAAA,oBAAC,UAAA,EAAS,WAAU,mBAAkB,eAAY,QAAO;AAAA,YACzD,oBAAC,QAAA,EAAK,WAAU,0BAAyB,UAAA,kBAAc;AAAA,YACvD,oBAAC,QAAA,EAAK,WAAU,0CAA0C,UAAA,MAAK;AAAA,YAC9D,UACC,oBAAC,QAAA,EAAK,WAAU,2DAA0D,oBAE1E,IACE;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACN;AAAA,EAAA,GAEJ;AAEJ;"}
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { SquareIcon, ListPlusIcon, ArrowUpIcon, AtSignIcon } from "lucide-react";
2
+ import { ListPlusIcon, ArrowUpIcon, SquareIcon, AtSignIcon } from "lucide-react";
3
3
  import { TooltipIconButton } from "./tooltip-icon-button.js";
4
4
  import { Button } from "../ui/button.js";
5
5
  const AthenaComposerSendButton = ({
@@ -1,22 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- require("../packages/agent-runtime/src/generated/runconfig-contract.cjs");
4
- require("react");
5
- require("@assistant-ui/tap");
6
- require("statewire");
7
- require("../packages/agent-runtime/src/statewire-suspended.cjs");
8
- require("../packages/agent-runtime/src/conversation-list.cjs");
9
3
  const toolMetadata = require("../packages/agent-runtime/src/tool-metadata.cjs");
10
- require("@tanstack/react-query");
11
- require("../packages/agent-runtime/src/statewire-state.cjs");
12
- require("../packages/agent-runtime/src/messages.cjs");
13
- require("@assistant-ui/store");
14
- require("../packages/agent-runtime/src/quota-safe-local-storage-session.cjs");
15
- require("../packages/agent-runtime/src/statewire-attach-observer.cjs");
16
- require("../packages/agent-runtime/src/thread-status.cjs");
17
- require("@assistant-ui/react-statewire");
18
- require("@assistant-ui/core");
19
- require("../packages/agent-runtime/src/thread-handoff.cjs");
20
4
  function runActivityKey(parts) {
21
5
  const tail = tailPart(parts);
22
6
  if (!tail) return null;
@@ -1 +1 @@
1
- {"version":3,"file":"run-activity.cjs","sources":["../../src/chat/run-activity.ts"],"sourcesContent":["import { getToolDisplayMeta } from '@athenaintel/agent-runtime';\n\n/**\n * Run-liveness key for a streaming assistant message.\n *\n * A tool card's spinner says \"this call is running\"; nothing says the RUN is\n * still alive once parts exist — a stalled stream and a busy one look\n * identical. The activity key summarizes the message tail: it is `null` when\n * no liveness row should show (no parts yet, or a text/reasoning tail that\n * already animates on its own), and otherwise changes whenever anything\n * streams into the tail part — so an elapsed timer keyed on it measures\n * \"time since the stream last moved\", not just \"time since the call began\".\n */\nexport function runActivityKey(parts: ReadonlyArray<unknown>): string | null {\n const tail = tailPart(parts);\n if (!tail) return null;\n const type = typeof tail['type'] === 'string' ? (tail['type'] as string) : 'unknown';\n if (type === 'text' || type === 'reasoning') return null;\n const argsText = typeof tail['argsText'] === 'string' ? (tail['argsText'] as string).length : 0;\n const settled = tail['result'] === undefined ? 0 : 1;\n return `${parts.length}:${type}:${argsText}:${settled}`;\n}\n\n/**\n * The present-tense verb for what the run is doing right now — the registry's\n * activity label for a tool call still awaiting its result (\"Searching the\n * web\") — or `null` when the tail is not an unsettled tool call.\n */\nexport function runActivityVerb(parts: ReadonlyArray<unknown>): string | null {\n const tail = tailPart(parts);\n if (!tail || tail['type'] !== 'tool-call' || tail['result'] !== undefined) return null;\n const toolName = tail['toolName'];\n if (typeof toolName !== 'string' || toolName.length === 0) return null;\n return getToolDisplayMeta(toolName).activeLabel;\n}\n\nfunction tailPart(parts: ReadonlyArray<unknown>): Record<string, unknown> | null {\n const last = parts[parts.length - 1];\n if (last === undefined || last === null || typeof last !== 'object') return null;\n return last as Record<string, unknown>;\n}\n\n/** Seconds without any streamed change before the row flips to a stall tone. */\nexport const RUN_ACTIVITY_STALL_SECONDS = 30;\n\n/** Seconds before the row starts showing its elapsed counter. */\nexport const RUN_ACTIVITY_COUNTER_SECONDS = 3;\n\n/** The default verb when nothing more specific is known. */\nexport const RUN_ACTIVITY_DEFAULT_VERB = 'Thinking';\n\n/**\n * The status line for `seconds` since the stream last moved: the verb with an\n * ellipsis, the elapsed counter once it is due, and the stall tone.\n */\nexport function runActivityLabel(seconds: number, verb: string = RUN_ACTIVITY_DEFAULT_VERB): string {\n if (seconds >= RUN_ACTIVITY_STALL_SECONDS) {\n return `Still working — nothing new for ${seconds}s`;\n }\n if (seconds >= RUN_ACTIVITY_COUNTER_SECONDS) {\n return `${verb}… · ${seconds}s`;\n }\n return `${verb}…`;\n}\n"],"names":["getToolDisplayMeta"],"mappings":";;;;;;;;;;;;;;;;;;;AAaO,SAAS,eAAe,OAA8C;AAC3E,QAAM,OAAO,SAAS,KAAK;AAC3B,MAAI,CAAC,KAAM,QAAO;AAClB,QAAM,OAAO,OAAO,KAAK,MAAM,MAAM,WAAY,KAAK,MAAM,IAAe;AAC3E,MAAI,SAAS,UAAU,SAAS,YAAa,QAAO;AACpD,QAAM,WAAW,OAAO,KAAK,UAAU,MAAM,WAAY,KAAK,UAAU,EAAa,SAAS;AAC9F,QAAM,UAAU,KAAK,QAAQ,MAAM,SAAY,IAAI;AACnD,SAAO,GAAG,MAAM,MAAM,IAAI,IAAI,IAAI,QAAQ,IAAI,OAAO;AACvD;AAOO,SAAS,gBAAgB,OAA8C;AAC5E,QAAM,OAAO,SAAS,KAAK;AAC3B,MAAI,CAAC,QAAQ,KAAK,MAAM,MAAM,eAAe,KAAK,QAAQ,MAAM,OAAW,QAAO;AAClF,QAAM,WAAW,KAAK,UAAU;AAChC,MAAI,OAAO,aAAa,YAAY,SAAS,WAAW,EAAG,QAAO;AAClE,SAAOA,aAAAA,mBAAmB,QAAQ,EAAE;AACtC;AAEA,SAAS,SAAS,OAA+D;AAC/E,QAAM,OAAO,MAAM,MAAM,SAAS,CAAC;AACnC,MAAI,SAAS,UAAa,SAAS,QAAQ,OAAO,SAAS,SAAU,QAAO;AAC5E,SAAO;AACT;AAGO,MAAM,6BAA6B;AAGnC,MAAM,+BAA+B;AAGrC,MAAM,4BAA4B;AAMlC,SAAS,iBAAiB,SAAiB,OAAe,2BAAmC;AAClG,MAAI,WAAW,4BAA4B;AACzC,WAAO,mCAAmC,OAAO;AAAA,EACnD;AACA,MAAI,WAAW,8BAA8B;AAC3C,WAAO,GAAG,IAAI,OAAO,OAAO;AAAA,EAC9B;AACA,SAAO,GAAG,IAAI;AAChB;;;;;;;"}
1
+ {"version":3,"file":"run-activity.cjs","sources":["../../src/chat/run-activity.ts"],"sourcesContent":["import { getToolDisplayMeta } from '@athenaintel/agent-runtime';\n\n/**\n * Run-liveness key for a streaming assistant message.\n *\n * A tool card's spinner says \"this call is running\"; nothing says the RUN is\n * still alive once parts exist — a stalled stream and a busy one look\n * identical. The activity key summarizes the message tail: it is `null` when\n * no liveness row should show (no parts yet, or a text/reasoning tail that\n * already animates on its own), and otherwise changes whenever anything\n * streams into the tail part — so an elapsed timer keyed on it measures\n * \"time since the stream last moved\", not just \"time since the call began\".\n */\nexport function runActivityKey(parts: ReadonlyArray<unknown>): string | null {\n const tail = tailPart(parts);\n if (!tail) return null;\n const type = typeof tail['type'] === 'string' ? (tail['type'] as string) : 'unknown';\n if (type === 'text' || type === 'reasoning') return null;\n const argsText = typeof tail['argsText'] === 'string' ? (tail['argsText'] as string).length : 0;\n const settled = tail['result'] === undefined ? 0 : 1;\n return `${parts.length}:${type}:${argsText}:${settled}`;\n}\n\n/**\n * The present-tense verb for what the run is doing right now — the registry's\n * activity label for a tool call still awaiting its result (\"Searching the\n * web\") — or `null` when the tail is not an unsettled tool call.\n */\nexport function runActivityVerb(parts: ReadonlyArray<unknown>): string | null {\n const tail = tailPart(parts);\n if (!tail || tail['type'] !== 'tool-call' || tail['result'] !== undefined) return null;\n const toolName = tail['toolName'];\n if (typeof toolName !== 'string' || toolName.length === 0) return null;\n return getToolDisplayMeta(toolName).activeLabel;\n}\n\nfunction tailPart(parts: ReadonlyArray<unknown>): Record<string, unknown> | null {\n const last = parts[parts.length - 1];\n if (last === undefined || last === null || typeof last !== 'object') return null;\n return last as Record<string, unknown>;\n}\n\n/** Seconds without any streamed change before the row flips to a stall tone. */\nexport const RUN_ACTIVITY_STALL_SECONDS = 30;\n\n/** Seconds before the row starts showing its elapsed counter. */\nexport const RUN_ACTIVITY_COUNTER_SECONDS = 3;\n\n/** The default verb when nothing more specific is known. */\nexport const RUN_ACTIVITY_DEFAULT_VERB = 'Thinking';\n\n/**\n * The status line for `seconds` since the stream last moved: the verb with an\n * ellipsis, the elapsed counter once it is due, and the stall tone.\n */\nexport function runActivityLabel(seconds: number, verb: string = RUN_ACTIVITY_DEFAULT_VERB): string {\n if (seconds >= RUN_ACTIVITY_STALL_SECONDS) {\n return `Still working — nothing new for ${seconds}s`;\n }\n if (seconds >= RUN_ACTIVITY_COUNTER_SECONDS) {\n return `${verb}… · ${seconds}s`;\n }\n return `${verb}…`;\n}\n"],"names":["getToolDisplayMeta"],"mappings":";;;AAaO,SAAS,eAAe,OAA8C;AAC3E,QAAM,OAAO,SAAS,KAAK;AAC3B,MAAI,CAAC,KAAM,QAAO;AAClB,QAAM,OAAO,OAAO,KAAK,MAAM,MAAM,WAAY,KAAK,MAAM,IAAe;AAC3E,MAAI,SAAS,UAAU,SAAS,YAAa,QAAO;AACpD,QAAM,WAAW,OAAO,KAAK,UAAU,MAAM,WAAY,KAAK,UAAU,EAAa,SAAS;AAC9F,QAAM,UAAU,KAAK,QAAQ,MAAM,SAAY,IAAI;AACnD,SAAO,GAAG,MAAM,MAAM,IAAI,IAAI,IAAI,QAAQ,IAAI,OAAO;AACvD;AAOO,SAAS,gBAAgB,OAA8C;AAC5E,QAAM,OAAO,SAAS,KAAK;AAC3B,MAAI,CAAC,QAAQ,KAAK,MAAM,MAAM,eAAe,KAAK,QAAQ,MAAM,OAAW,QAAO;AAClF,QAAM,WAAW,KAAK,UAAU;AAChC,MAAI,OAAO,aAAa,YAAY,SAAS,WAAW,EAAG,QAAO;AAClE,SAAOA,aAAAA,mBAAmB,QAAQ,EAAE;AACtC;AAEA,SAAS,SAAS,OAA+D;AAC/E,QAAM,OAAO,MAAM,MAAM,SAAS,CAAC;AACnC,MAAI,SAAS,UAAa,SAAS,QAAQ,OAAO,SAAS,SAAU,QAAO;AAC5E,SAAO;AACT;AAGO,MAAM,6BAA6B;AAGnC,MAAM,+BAA+B;AAGrC,MAAM,4BAA4B;AAMlC,SAAS,iBAAiB,SAAiB,OAAe,2BAAmC;AAClG,MAAI,WAAW,4BAA4B;AACzC,WAAO,mCAAmC,OAAO;AAAA,EACnD;AACA,MAAI,WAAW,8BAA8B;AAC3C,WAAO,GAAG,IAAI,OAAO,OAAO;AAAA,EAC9B;AACA,SAAO,GAAG,IAAI;AAChB;;;;;;;"}
@@ -1,20 +1,4 @@
1
- import "../packages/agent-runtime/src/generated/runconfig-contract.js";
2
- import "react";
3
- import "@assistant-ui/tap";
4
- import "statewire";
5
- import "../packages/agent-runtime/src/statewire-suspended.js";
6
- import "../packages/agent-runtime/src/conversation-list.js";
7
1
  import { getToolDisplayMeta } from "../packages/agent-runtime/src/tool-metadata.js";
8
- import "@tanstack/react-query";
9
- import "../packages/agent-runtime/src/statewire-state.js";
10
- import "../packages/agent-runtime/src/messages.js";
11
- import "@assistant-ui/store";
12
- import "../packages/agent-runtime/src/quota-safe-local-storage-session.js";
13
- import "../packages/agent-runtime/src/statewire-attach-observer.js";
14
- import "../packages/agent-runtime/src/thread-status.js";
15
- import "@assistant-ui/react-statewire";
16
- import "@assistant-ui/core";
17
- import "../packages/agent-runtime/src/thread-handoff.js";
18
2
  function runActivityKey(parts) {
19
3
  const tail = tailPart(parts);
20
4
  if (!tail) return null;
@@ -1 +1 @@
1
- {"version":3,"file":"run-activity.js","sources":["../../src/chat/run-activity.ts"],"sourcesContent":["import { getToolDisplayMeta } from '@athenaintel/agent-runtime';\n\n/**\n * Run-liveness key for a streaming assistant message.\n *\n * A tool card's spinner says \"this call is running\"; nothing says the RUN is\n * still alive once parts exist — a stalled stream and a busy one look\n * identical. The activity key summarizes the message tail: it is `null` when\n * no liveness row should show (no parts yet, or a text/reasoning tail that\n * already animates on its own), and otherwise changes whenever anything\n * streams into the tail part — so an elapsed timer keyed on it measures\n * \"time since the stream last moved\", not just \"time since the call began\".\n */\nexport function runActivityKey(parts: ReadonlyArray<unknown>): string | null {\n const tail = tailPart(parts);\n if (!tail) return null;\n const type = typeof tail['type'] === 'string' ? (tail['type'] as string) : 'unknown';\n if (type === 'text' || type === 'reasoning') return null;\n const argsText = typeof tail['argsText'] === 'string' ? (tail['argsText'] as string).length : 0;\n const settled = tail['result'] === undefined ? 0 : 1;\n return `${parts.length}:${type}:${argsText}:${settled}`;\n}\n\n/**\n * The present-tense verb for what the run is doing right now — the registry's\n * activity label for a tool call still awaiting its result (\"Searching the\n * web\") — or `null` when the tail is not an unsettled tool call.\n */\nexport function runActivityVerb(parts: ReadonlyArray<unknown>): string | null {\n const tail = tailPart(parts);\n if (!tail || tail['type'] !== 'tool-call' || tail['result'] !== undefined) return null;\n const toolName = tail['toolName'];\n if (typeof toolName !== 'string' || toolName.length === 0) return null;\n return getToolDisplayMeta(toolName).activeLabel;\n}\n\nfunction tailPart(parts: ReadonlyArray<unknown>): Record<string, unknown> | null {\n const last = parts[parts.length - 1];\n if (last === undefined || last === null || typeof last !== 'object') return null;\n return last as Record<string, unknown>;\n}\n\n/** Seconds without any streamed change before the row flips to a stall tone. */\nexport const RUN_ACTIVITY_STALL_SECONDS = 30;\n\n/** Seconds before the row starts showing its elapsed counter. */\nexport const RUN_ACTIVITY_COUNTER_SECONDS = 3;\n\n/** The default verb when nothing more specific is known. */\nexport const RUN_ACTIVITY_DEFAULT_VERB = 'Thinking';\n\n/**\n * The status line for `seconds` since the stream last moved: the verb with an\n * ellipsis, the elapsed counter once it is due, and the stall tone.\n */\nexport function runActivityLabel(seconds: number, verb: string = RUN_ACTIVITY_DEFAULT_VERB): string {\n if (seconds >= RUN_ACTIVITY_STALL_SECONDS) {\n return `Still working — nothing new for ${seconds}s`;\n }\n if (seconds >= RUN_ACTIVITY_COUNTER_SECONDS) {\n return `${verb}… · ${seconds}s`;\n }\n return `${verb}…`;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAaO,SAAS,eAAe,OAA8C;AAC3E,QAAM,OAAO,SAAS,KAAK;AAC3B,MAAI,CAAC,KAAM,QAAO;AAClB,QAAM,OAAO,OAAO,KAAK,MAAM,MAAM,WAAY,KAAK,MAAM,IAAe;AAC3E,MAAI,SAAS,UAAU,SAAS,YAAa,QAAO;AACpD,QAAM,WAAW,OAAO,KAAK,UAAU,MAAM,WAAY,KAAK,UAAU,EAAa,SAAS;AAC9F,QAAM,UAAU,KAAK,QAAQ,MAAM,SAAY,IAAI;AACnD,SAAO,GAAG,MAAM,MAAM,IAAI,IAAI,IAAI,QAAQ,IAAI,OAAO;AACvD;AAOO,SAAS,gBAAgB,OAA8C;AAC5E,QAAM,OAAO,SAAS,KAAK;AAC3B,MAAI,CAAC,QAAQ,KAAK,MAAM,MAAM,eAAe,KAAK,QAAQ,MAAM,OAAW,QAAO;AAClF,QAAM,WAAW,KAAK,UAAU;AAChC,MAAI,OAAO,aAAa,YAAY,SAAS,WAAW,EAAG,QAAO;AAClE,SAAO,mBAAmB,QAAQ,EAAE;AACtC;AAEA,SAAS,SAAS,OAA+D;AAC/E,QAAM,OAAO,MAAM,MAAM,SAAS,CAAC;AACnC,MAAI,SAAS,UAAa,SAAS,QAAQ,OAAO,SAAS,SAAU,QAAO;AAC5E,SAAO;AACT;AAGO,MAAM,6BAA6B;AAGnC,MAAM,+BAA+B;AAGrC,MAAM,4BAA4B;AAMlC,SAAS,iBAAiB,SAAiB,OAAe,2BAAmC;AAClG,MAAI,WAAW,4BAA4B;AACzC,WAAO,mCAAmC,OAAO;AAAA,EACnD;AACA,MAAI,WAAW,8BAA8B;AAC3C,WAAO,GAAG,IAAI,OAAO,OAAO;AAAA,EAC9B;AACA,SAAO,GAAG,IAAI;AAChB;"}
1
+ {"version":3,"file":"run-activity.js","sources":["../../src/chat/run-activity.ts"],"sourcesContent":["import { getToolDisplayMeta } from '@athenaintel/agent-runtime';\n\n/**\n * Run-liveness key for a streaming assistant message.\n *\n * A tool card's spinner says \"this call is running\"; nothing says the RUN is\n * still alive once parts exist — a stalled stream and a busy one look\n * identical. The activity key summarizes the message tail: it is `null` when\n * no liveness row should show (no parts yet, or a text/reasoning tail that\n * already animates on its own), and otherwise changes whenever anything\n * streams into the tail part — so an elapsed timer keyed on it measures\n * \"time since the stream last moved\", not just \"time since the call began\".\n */\nexport function runActivityKey(parts: ReadonlyArray<unknown>): string | null {\n const tail = tailPart(parts);\n if (!tail) return null;\n const type = typeof tail['type'] === 'string' ? (tail['type'] as string) : 'unknown';\n if (type === 'text' || type === 'reasoning') return null;\n const argsText = typeof tail['argsText'] === 'string' ? (tail['argsText'] as string).length : 0;\n const settled = tail['result'] === undefined ? 0 : 1;\n return `${parts.length}:${type}:${argsText}:${settled}`;\n}\n\n/**\n * The present-tense verb for what the run is doing right now — the registry's\n * activity label for a tool call still awaiting its result (\"Searching the\n * web\") — or `null` when the tail is not an unsettled tool call.\n */\nexport function runActivityVerb(parts: ReadonlyArray<unknown>): string | null {\n const tail = tailPart(parts);\n if (!tail || tail['type'] !== 'tool-call' || tail['result'] !== undefined) return null;\n const toolName = tail['toolName'];\n if (typeof toolName !== 'string' || toolName.length === 0) return null;\n return getToolDisplayMeta(toolName).activeLabel;\n}\n\nfunction tailPart(parts: ReadonlyArray<unknown>): Record<string, unknown> | null {\n const last = parts[parts.length - 1];\n if (last === undefined || last === null || typeof last !== 'object') return null;\n return last as Record<string, unknown>;\n}\n\n/** Seconds without any streamed change before the row flips to a stall tone. */\nexport const RUN_ACTIVITY_STALL_SECONDS = 30;\n\n/** Seconds before the row starts showing its elapsed counter. */\nexport const RUN_ACTIVITY_COUNTER_SECONDS = 3;\n\n/** The default verb when nothing more specific is known. */\nexport const RUN_ACTIVITY_DEFAULT_VERB = 'Thinking';\n\n/**\n * The status line for `seconds` since the stream last moved: the verb with an\n * ellipsis, the elapsed counter once it is due, and the stall tone.\n */\nexport function runActivityLabel(seconds: number, verb: string = RUN_ACTIVITY_DEFAULT_VERB): string {\n if (seconds >= RUN_ACTIVITY_STALL_SECONDS) {\n return `Still working — nothing new for ${seconds}s`;\n }\n if (seconds >= RUN_ACTIVITY_COUNTER_SECONDS) {\n return `${verb}… · ${seconds}s`;\n }\n return `${verb}…`;\n}\n"],"names":[],"mappings":";AAaO,SAAS,eAAe,OAA8C;AAC3E,QAAM,OAAO,SAAS,KAAK;AAC3B,MAAI,CAAC,KAAM,QAAO;AAClB,QAAM,OAAO,OAAO,KAAK,MAAM,MAAM,WAAY,KAAK,MAAM,IAAe;AAC3E,MAAI,SAAS,UAAU,SAAS,YAAa,QAAO;AACpD,QAAM,WAAW,OAAO,KAAK,UAAU,MAAM,WAAY,KAAK,UAAU,EAAa,SAAS;AAC9F,QAAM,UAAU,KAAK,QAAQ,MAAM,SAAY,IAAI;AACnD,SAAO,GAAG,MAAM,MAAM,IAAI,IAAI,IAAI,QAAQ,IAAI,OAAO;AACvD;AAOO,SAAS,gBAAgB,OAA8C;AAC5E,QAAM,OAAO,SAAS,KAAK;AAC3B,MAAI,CAAC,QAAQ,KAAK,MAAM,MAAM,eAAe,KAAK,QAAQ,MAAM,OAAW,QAAO;AAClF,QAAM,WAAW,KAAK,UAAU;AAChC,MAAI,OAAO,aAAa,YAAY,SAAS,WAAW,EAAG,QAAO;AAClE,SAAO,mBAAmB,QAAQ,EAAE;AACtC;AAEA,SAAS,SAAS,OAA+D;AAC/E,QAAM,OAAO,MAAM,MAAM,SAAS,CAAC;AACnC,MAAI,SAAS,UAAa,SAAS,QAAQ,OAAO,SAAS,SAAU,QAAO;AAC5E,SAAO;AACT;AAGO,MAAM,6BAA6B;AAGnC,MAAM,+BAA+B;AAGrC,MAAM,4BAA4B;AAMlC,SAAS,iBAAiB,SAAiB,OAAe,2BAAmC;AAClG,MAAI,WAAW,4BAA4B;AACzC,WAAO,mCAAmC,OAAO;AAAA,EACnD;AACA,MAAI,WAAW,8BAA8B;AAC3C,WAAO,GAAG,IAAI,OAAO,OAAO;AAAA,EAC9B;AACA,SAAO,GAAG,IAAI;AAChB;"}
@@ -1,24 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const athenaDiagnostics = require("../diagnostics/athena-diagnostics.cjs");
4
- const clientTools = require("../packages/agent-runtime/src/client-tools.cjs");
5
- require("react");
6
- require("@assistant-ui/tap");
7
- require("statewire");
8
- require("../packages/agent-runtime/src/statewire-suspended.cjs");
9
- require("../packages/agent-runtime/src/conversation-list.cjs");
10
- require("@tanstack/react-query");
11
- require("../packages/agent-runtime/src/generated/runconfig-contract.cjs");
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
- require("@assistant-ui/core");
20
- require("../packages/agent-runtime/src/thread-handoff.cjs");
21
4
  const assistantStream = require("assistant-stream");
5
+ const clientTools = require("../packages/agent-runtime/src/client-tools.cjs");
22
6
  function hasCallableExecute(entry) {
23
7
  return !!entry && typeof entry === "object" && typeof entry.execute === "function";
24
8
  }
@@ -70,6 +54,26 @@ function collectStatewireClientTools(toolkit) {
70
54
  function statewireClientToolWireEntries(tools) {
71
55
  return clientTools.clientToolRunConfigEntries(tools);
72
56
  }
57
+ function backendDeclaredFrontendToolIds(toolkit) {
58
+ return Object.entries(toolkit).filter(([, entry]) => !hasCallableExecute(entry)).map(([name]) => name);
59
+ }
60
+ const CLIENT_TOOL_SURFACE_APP_IDS = {
61
+ olympus: "olympus",
62
+ officeAddin: "athena-office-addin",
63
+ mobile: "athena-mobile"
64
+ };
65
+ const SDK_APP_ID_PATTERN = /^computer_asset_[0-9a-f-]{8,64}$/;
66
+ function resolveClientToolSurface(appId) {
67
+ if (typeof appId !== "string" || appId.length === 0) return null;
68
+ if (appId === CLIENT_TOOL_SURFACE_APP_IDS.olympus) return "web";
69
+ if (appId === CLIENT_TOOL_SURFACE_APP_IDS.officeAddin) return "office";
70
+ if (appId === CLIENT_TOOL_SURFACE_APP_IDS.mobile) return "mobile";
71
+ if (SDK_APP_ID_PATTERN.test(appId)) return "sdk";
72
+ return null;
73
+ }
74
+ exports.CLIENT_TOOL_SURFACE_APP_IDS = CLIENT_TOOL_SURFACE_APP_IDS;
75
+ exports.backendDeclaredFrontendToolIds = backendDeclaredFrontendToolIds;
73
76
  exports.collectStatewireClientTools = collectStatewireClientTools;
77
+ exports.resolveClientToolSurface = resolveClientToolSurface;
74
78
  exports.statewireClientToolWireEntries = statewireClientToolWireEntries;
75
79
  //# sourceMappingURL=statewire-client-tools.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"statewire-client-tools.cjs","sources":["../../src/chat/statewire-client-tools.ts"],"sourcesContent":["import { athenaDiagnostics } from '../diagnostics/athena-diagnostics';\nimport type { Toolkit } from '@assistant-ui/react';\nimport {\n type ClientToolHandlerContext,\n clientToolRunConfigEntries,\n type RegisteredClientTool,\n} from '@athenaintel/agent-runtime';\nimport { ToolResponse, toJSONSchema } from 'assistant-stream';\n\n/**\n * @deprecated The SDK's client tools ARE the shared `RegisteredClientTool`\n * shape from `@athenaintel/agent-runtime` (`definition` + `handler`); import\n * that type instead. Retained for one release so existing imports type-check.\n */\nexport type StatewireClientTool = RegisteredClientTool;\n\nfunction hasCallableExecute(\n entry: unknown,\n): entry is { execute: (args: Record<string, unknown>, context: unknown) => unknown } {\n return (\n !!entry &&\n typeof entry === 'object' &&\n typeof (entry as { execute?: unknown }).execute === 'function'\n );\n}\n\n/**\n * Collect the client-executable tools from a frontend toolkit, in the shared\n * `RegisteredClientTool` shape every statewire surface declares and executes.\n *\n * The deep-agent runtime drops frontend (`ui_*`) tool definitions, so tools\n * with a local `execute` must instead be declared through\n * `runConfig.custom.client_tools` and answered by the statewire client-tool\n * bridge. Schema conversion reuses `toJSONSchema` — the same conversion\n * primitive as the legacy assistant-transport — and a tool whose schema cannot\n * be converted is skipped with a warning rather than failing the whole set.\n * SDK tools never gate on write consent (`requiresWrite: false`): a toolkit\n * `execute` is the host app's own code.\n */\nexport function collectStatewireClientTools(toolkit: Toolkit): RegisteredClientTool[] {\n const executable = Object.entries(toolkit).filter(([, entry]) => hasCallableExecute(entry));\n if (executable.length === 0) return [];\n\n return executable.flatMap(([name, entry]) => {\n if (entry.parameters === undefined) return [];\n\n let parameters: Record<string, unknown>;\n try {\n parameters = { ...toJSONSchema(entry.parameters) };\n } catch (error) {\n athenaDiagnostics.emit('tools.schema.warning', {\n level: 'warn',\n data: {\n tool: name,\n message: 'Frontend tool schema could not be converted for statewire; the tool is not registered',\n error: error instanceof Error ? error.message : String(error),\n },\n });\n return [];\n }\n\n const execute = (entry as {\n execute: (args: Record<string, unknown>, context: unknown) => unknown;\n }).execute;\n return [\n {\n definition: {\n name,\n description: entry.description ?? '',\n parameters,\n requiresWrite: false,\n },\n handler: async (args, context?: ClientToolHandlerContext) => {\n const controller = new AbortController();\n const output = await execute(args, {\n // The bridge always supplies the parked call's id; a host invoking\n // the handler directly has no call to correlate.\n toolCallId: context?.toolCallId ?? '',\n abortSignal: controller.signal,\n human: () =>\n Promise.reject(\n new Error('Human input is not supported for statewire client tools.'),\n ),\n });\n return output instanceof ToolResponse ? output.result : output;\n },\n },\n ];\n });\n}\n\n/** Wire entries for `runConfig.custom.client_tools` — the shared contract from\n * `@athenaintel/agent-runtime`, so the SDK cannot drift from the other surfaces. */\nexport function statewireClientToolWireEntries(\n tools: readonly RegisteredClientTool[],\n): Record<string, unknown>[] {\n return clientToolRunConfigEntries(tools);\n}\n"],"names":["toJSONSchema","athenaDiagnostics","ToolResponse","clientToolRunConfigEntries"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgBA,SAAS,mBACP,OACoF;AACpF,SACE,CAAC,CAAC,SACF,OAAO,UAAU,YACjB,OAAQ,MAAgC,YAAY;AAExD;AAeO,SAAS,4BAA4B,SAA0C;AACpF,QAAM,aAAa,OAAO,QAAQ,OAAO,EAAE,OAAO,CAAC,GAAG,KAAK,MAAM,mBAAmB,KAAK,CAAC;AAC1F,MAAI,WAAW,WAAW,EAAG,QAAO,CAAA;AAEpC,SAAO,WAAW,QAAQ,CAAC,CAAC,MAAM,KAAK,MAAM;AAC3C,QAAI,MAAM,eAAe,OAAW,QAAO,CAAA;AAE3C,QAAI;AACJ,QAAI;AACF,mBAAa,EAAE,GAAGA,gBAAAA,aAAa,MAAM,UAAU,EAAA;AAAA,IACjD,SAAS,OAAO;AACdC,wBAAAA,kBAAkB,KAAK,wBAAwB;AAAA,QAC7C,OAAO;AAAA,QACP,MAAM;AAAA,UACJ,MAAM;AAAA,UACN,SAAS;AAAA,UACT,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAAA,QAAA;AAAA,MAC9D,CACD;AACD,aAAO,CAAA;AAAA,IACT;AAEA,UAAM,UAAW,MAEd;AACH,WAAO;AAAA,MACL;AAAA,QACE,YAAY;AAAA,UACV;AAAA,UACA,aAAa,MAAM,eAAe;AAAA,UAClC;AAAA,UACA,eAAe;AAAA,QAAA;AAAA,QAEjB,SAAS,OAAO,MAAM,YAAuC;AAC3D,gBAAM,aAAa,IAAI,gBAAA;AACvB,gBAAM,SAAS,MAAM,QAAQ,MAAM;AAAA;AAAA;AAAA,YAGjC,aAAY,mCAAS,eAAc;AAAA,YACnC,aAAa,WAAW;AAAA,YACxB,OAAO,MACL,QAAQ;AAAA,cACN,IAAI,MAAM,0DAA0D;AAAA,YAAA;AAAA,UACtE,CACH;AACD,iBAAO,kBAAkBC,gBAAAA,eAAe,OAAO,SAAS;AAAA,QAC1D;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ,CAAC;AACH;AAIO,SAAS,+BACd,OAC2B;AAC3B,SAAOC,YAAAA,2BAA2B,KAAK;AACzC;;;"}
1
+ {"version":3,"file":"statewire-client-tools.cjs","sources":["../../src/chat/statewire-client-tools.ts"],"sourcesContent":["import { athenaDiagnostics } from '../diagnostics/athena-diagnostics';\nimport type { Toolkit } from '@assistant-ui/react';\nimport {\n type ClientToolHandlerContext,\n clientToolRunConfigEntries,\n type RegisteredClientTool,\n} from '@athenaintel/agent-runtime';\nimport { ToolResponse, toJSONSchema } from 'assistant-stream';\n\n/**\n * @deprecated The SDK's client tools ARE the shared `RegisteredClientTool`\n * shape from `@athenaintel/agent-runtime` (`definition` + `handler`); import\n * that type instead. Retained for one release so existing imports type-check.\n */\nexport type StatewireClientTool = RegisteredClientTool;\n\nfunction hasCallableExecute(\n entry: unknown,\n): entry is { execute: (args: Record<string, unknown>, context: unknown) => unknown } {\n return (\n !!entry &&\n typeof entry === 'object' &&\n typeof (entry as { execute?: unknown }).execute === 'function'\n );\n}\n\n/**\n * Collect the client-executable tools from a frontend toolkit, in the shared\n * `RegisteredClientTool` shape every statewire surface declares and executes.\n *\n * The deep-agent runtime drops frontend (`ui_*`) tool definitions, so tools\n * with a local `execute` must instead be declared through\n * `runConfig.custom.client_tools` and answered by the statewire client-tool\n * bridge. Schema conversion reuses `toJSONSchema` — the same conversion\n * primitive as the legacy assistant-transport — and a tool whose schema cannot\n * be converted is skipped with a warning rather than failing the whole set.\n * SDK tools never gate on write consent (`requiresWrite: false`): a toolkit\n * `execute` is the host app's own code.\n */\nexport function collectStatewireClientTools(toolkit: Toolkit): RegisteredClientTool[] {\n const executable = Object.entries(toolkit).filter(([, entry]) => hasCallableExecute(entry));\n if (executable.length === 0) return [];\n\n return executable.flatMap(([name, entry]) => {\n if (entry.parameters === undefined) return [];\n\n let parameters: Record<string, unknown>;\n try {\n parameters = { ...toJSONSchema(entry.parameters) };\n } catch (error) {\n athenaDiagnostics.emit('tools.schema.warning', {\n level: 'warn',\n data: {\n tool: name,\n message: 'Frontend tool schema could not be converted for statewire; the tool is not registered',\n error: error instanceof Error ? error.message : String(error),\n },\n });\n return [];\n }\n\n const execute = (entry as {\n execute: (args: Record<string, unknown>, context: unknown) => unknown;\n }).execute;\n return [\n {\n definition: {\n name,\n description: entry.description ?? '',\n parameters,\n requiresWrite: false,\n },\n handler: async (args, context?: ClientToolHandlerContext) => {\n const controller = new AbortController();\n const output = await execute(args, {\n // The bridge always supplies the parked call's id; a host invoking\n // the handler directly has no call to correlate.\n toolCallId: context?.toolCallId ?? '',\n abortSignal: controller.signal,\n human: () =>\n Promise.reject(\n new Error('Human input is not supported for statewire client tools.'),\n ),\n });\n return output instanceof ToolResponse ? output.result : output;\n },\n },\n ];\n });\n}\n\n/** Wire entries for `runConfig.custom.client_tools` — the shared contract from\n * `@athenaintel/agent-runtime`, so the SDK cannot drift from the other surfaces. */\nexport function statewireClientToolWireEntries(\n tools: readonly RegisteredClientTool[],\n): Record<string, unknown>[] {\n return clientToolRunConfigEntries(tools);\n}\n\n/**\n * The frontend-toolkit entries that must ride `enabled_tools`: declarations\n * WITHOUT a local `execute`, which name registry tools the backend already\n * knows how to bind (Olympus's frontend-executed tool ids).\n *\n * Executable entries are deliberately left out. They are declared through\n * `client_tools`, and the run binds them by name; putting the same name into\n * `enabled_tools` would also switch on any backend toolkit that happens to\n * own a tool of that name, and the backend wins the resulting collision —\n * the client tool is dropped and the model calls the backend one instead.\n */\nexport function backendDeclaredFrontendToolIds(toolkit: Toolkit): string[] {\n return Object.entries(toolkit)\n .filter(([, entry]) => !hasCallableExecute(entry))\n .map(([name]) => name);\n}\n\n/**\n * The `app_id` values the deep-agent runtime accepts as a client-tool surface.\n * Mirrors `agora/agora/graphs/athena_deep_agent/client_tools.py`: the fixed\n * first-party ids plus the `computer_asset_<uuid>` shape Athena's provisioning\n * injects into a computer-asset app. Any other `app_id` (or none) gets no\n * surface, and the runtime drops every `client_tools` declaration for the run.\n */\nexport const CLIENT_TOOL_SURFACE_APP_IDS = {\n olympus: 'olympus',\n officeAddin: 'athena-office-addin',\n mobile: 'athena-mobile',\n} as const;\n\nconst SDK_APP_ID_PATTERN = /^computer_asset_[0-9a-f-]{8,64}$/;\n\nexport type ClientToolSurface = 'web' | 'office' | 'mobile' | 'sdk';\n\n/** The surface an `app_id` selects, or null when the runtime would refuse it. */\nexport function resolveClientToolSurface(appId: string | undefined | null): ClientToolSurface | null {\n if (typeof appId !== 'string' || appId.length === 0) return null;\n if (appId === CLIENT_TOOL_SURFACE_APP_IDS.olympus) return 'web';\n if (appId === CLIENT_TOOL_SURFACE_APP_IDS.officeAddin) return 'office';\n if (appId === CLIENT_TOOL_SURFACE_APP_IDS.mobile) return 'mobile';\n if (SDK_APP_ID_PATTERN.test(appId)) return 'sdk';\n return null;\n}\n"],"names":["toJSONSchema","athenaDiagnostics","ToolResponse","clientToolRunConfigEntries"],"mappings":";;;;;AAgBA,SAAS,mBACP,OACoF;AACpF,SACE,CAAC,CAAC,SACF,OAAO,UAAU,YACjB,OAAQ,MAAgC,YAAY;AAExD;AAeO,SAAS,4BAA4B,SAA0C;AACpF,QAAM,aAAa,OAAO,QAAQ,OAAO,EAAE,OAAO,CAAC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ChD,IAAI,CAAC,CAAC,IAAI,MAAM,IAAI;AACzB;AASO,MAAM,8BAA8B;AAAA,EACzC,SAAS;AAAA,EACT,aAAa;AAAA,EACb,QAAQ;AACV;AAEA,MAAM,qBAAqB;AAKpB,SAAS,yBAAyB,OAA4D;AACnG,MAAI,OAAO,UAAU,YAAY,MAAM,WAAW,EAAG,QAAO;AAC5D,MAAI,UAAU,4BAA4B,QAAS,QAAO;AAC1D,MAAI,UAAU,4BAA4B,YAAa,QAAO;AAC9D,MAAI,UAAU,4BAA4B,OAAQ,QAAO;AACzD,MAAI,mBAAmB,KAAK,KAAK,EAAG,QAAO;AAC3C,SAAO;AACT;;;;;;"}
@@ -23,3 +23,30 @@ export declare function collectStatewireClientTools(toolkit: Toolkit): Registere
23
23
  /** Wire entries for `runConfig.custom.client_tools` — the shared contract from
24
24
  * `@athenaintel/agent-runtime`, so the SDK cannot drift from the other surfaces. */
25
25
  export declare function statewireClientToolWireEntries(tools: readonly RegisteredClientTool[]): Record<string, unknown>[];
26
+ /**
27
+ * The frontend-toolkit entries that must ride `enabled_tools`: declarations
28
+ * WITHOUT a local `execute`, which name registry tools the backend already
29
+ * knows how to bind (Olympus's frontend-executed tool ids).
30
+ *
31
+ * Executable entries are deliberately left out. They are declared through
32
+ * `client_tools`, and the run binds them by name; putting the same name into
33
+ * `enabled_tools` would also switch on any backend toolkit that happens to
34
+ * own a tool of that name, and the backend wins the resulting collision —
35
+ * the client tool is dropped and the model calls the backend one instead.
36
+ */
37
+ export declare function backendDeclaredFrontendToolIds(toolkit: Toolkit): string[];
38
+ /**
39
+ * The `app_id` values the deep-agent runtime accepts as a client-tool surface.
40
+ * Mirrors `agora/agora/graphs/athena_deep_agent/client_tools.py`: the fixed
41
+ * first-party ids plus the `computer_asset_<uuid>` shape Athena's provisioning
42
+ * injects into a computer-asset app. Any other `app_id` (or none) gets no
43
+ * surface, and the runtime drops every `client_tools` declaration for the run.
44
+ */
45
+ export declare const CLIENT_TOOL_SURFACE_APP_IDS: {
46
+ readonly olympus: 'olympus';
47
+ readonly officeAddin: 'athena-office-addin';
48
+ readonly mobile: 'athena-mobile';
49
+ };
50
+ export type ClientToolSurface = 'web' | 'office' | 'mobile' | 'sdk';
51
+ /** The surface an `app_id` selects, or null when the runtime would refuse it. */
52
+ export declare function resolveClientToolSurface(appId: string | undefined | null): ClientToolSurface | null;
@@ -1,22 +1,6 @@
1
1
  import { athenaDiagnostics } from "../diagnostics/athena-diagnostics.js";
2
- import { clientToolRunConfigEntries } from "../packages/agent-runtime/src/client-tools.js";
3
- import "react";
4
- import "@assistant-ui/tap";
5
- import "statewire";
6
- import "../packages/agent-runtime/src/statewire-suspended.js";
7
- import "../packages/agent-runtime/src/conversation-list.js";
8
- import "@tanstack/react-query";
9
- import "../packages/agent-runtime/src/generated/runconfig-contract.js";
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
- import "@assistant-ui/core";
18
- import "../packages/agent-runtime/src/thread-handoff.js";
19
2
  import { toJSONSchema, ToolResponse } from "assistant-stream";
3
+ import { clientToolRunConfigEntries } from "../packages/agent-runtime/src/client-tools.js";
20
4
  function hasCallableExecute(entry) {
21
5
  return !!entry && typeof entry === "object" && typeof entry.execute === "function";
22
6
  }
@@ -68,8 +52,28 @@ function collectStatewireClientTools(toolkit) {
68
52
  function statewireClientToolWireEntries(tools) {
69
53
  return clientToolRunConfigEntries(tools);
70
54
  }
55
+ function backendDeclaredFrontendToolIds(toolkit) {
56
+ return Object.entries(toolkit).filter(([, entry]) => !hasCallableExecute(entry)).map(([name]) => name);
57
+ }
58
+ const CLIENT_TOOL_SURFACE_APP_IDS = {
59
+ olympus: "olympus",
60
+ officeAddin: "athena-office-addin",
61
+ mobile: "athena-mobile"
62
+ };
63
+ const SDK_APP_ID_PATTERN = /^computer_asset_[0-9a-f-]{8,64}$/;
64
+ function resolveClientToolSurface(appId) {
65
+ if (typeof appId !== "string" || appId.length === 0) return null;
66
+ if (appId === CLIENT_TOOL_SURFACE_APP_IDS.olympus) return "web";
67
+ if (appId === CLIENT_TOOL_SURFACE_APP_IDS.officeAddin) return "office";
68
+ if (appId === CLIENT_TOOL_SURFACE_APP_IDS.mobile) return "mobile";
69
+ if (SDK_APP_ID_PATTERN.test(appId)) return "sdk";
70
+ return null;
71
+ }
71
72
  export {
73
+ CLIENT_TOOL_SURFACE_APP_IDS,
74
+ backendDeclaredFrontendToolIds,
72
75
  collectStatewireClientTools,
76
+ resolveClientToolSurface,
73
77
  statewireClientToolWireEntries
74
78
  };
75
79
  //# sourceMappingURL=statewire-client-tools.js.map