@athenaintel/react 0.41.3 → 0.42.2

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 (479) hide show
  1. package/README.md +132 -10
  2. package/dist/agent-runtime/src/asset-attachment.d.ts +98 -0
  3. package/dist/agent-runtime/src/athena-asset-drag.d.ts +32 -0
  4. package/dist/agent-runtime/src/auth-denial.d.ts +29 -0
  5. package/dist/agent-runtime/src/chat-outbox-attachments.cjs +41 -0
  6. package/dist/agent-runtime/src/chat-outbox-attachments.cjs.map +1 -0
  7. package/dist/agent-runtime/src/chat-outbox-attachments.d.ts +38 -0
  8. package/dist/agent-runtime/src/chat-outbox-attachments.js +41 -0
  9. package/dist/agent-runtime/src/chat-outbox-attachments.js.map +1 -0
  10. package/dist/agent-runtime/src/chat-outbox-signals.cjs +63 -0
  11. package/dist/agent-runtime/src/chat-outbox-signals.cjs.map +1 -0
  12. package/dist/agent-runtime/src/chat-outbox-signals.d.ts +12 -0
  13. package/dist/agent-runtime/src/chat-outbox-signals.js +63 -0
  14. package/dist/agent-runtime/src/chat-outbox-signals.js.map +1 -0
  15. package/dist/agent-runtime/src/chat-outbox-store.cjs +509 -0
  16. package/dist/agent-runtime/src/chat-outbox-store.cjs.map +1 -0
  17. package/dist/agent-runtime/src/chat-outbox-store.d.ts +203 -0
  18. package/dist/agent-runtime/src/chat-outbox-store.js +509 -0
  19. package/dist/agent-runtime/src/chat-outbox-store.js.map +1 -0
  20. package/dist/agent-runtime/src/chat-outbox-thread.cjs +136 -0
  21. package/dist/agent-runtime/src/chat-outbox-thread.cjs.map +1 -0
  22. package/dist/agent-runtime/src/chat-outbox-thread.d.ts +118 -0
  23. package/dist/agent-runtime/src/chat-outbox-thread.js +136 -0
  24. package/dist/agent-runtime/src/chat-outbox-thread.js.map +1 -0
  25. package/dist/agent-runtime/src/chat-outbox.cjs +696 -0
  26. package/dist/agent-runtime/src/chat-outbox.cjs.map +1 -0
  27. package/dist/agent-runtime/src/chat-outbox.d.ts +285 -0
  28. package/dist/agent-runtime/src/chat-outbox.js +696 -0
  29. package/dist/agent-runtime/src/chat-outbox.js.map +1 -0
  30. package/dist/agent-runtime/src/chat-socket-reachability.d.ts +45 -0
  31. package/dist/agent-runtime/src/client-tool-bridge.d.ts +152 -0
  32. package/dist/agent-runtime/src/client-tools.d.ts +133 -0
  33. package/dist/agent-runtime/src/composer-markdown.cjs +10 -0
  34. package/dist/agent-runtime/src/composer-markdown.cjs.map +1 -1
  35. package/dist/agent-runtime/src/composer-markdown.d.ts +108 -0
  36. package/dist/agent-runtime/src/composer-markdown.js +10 -0
  37. package/dist/agent-runtime/src/composer-markdown.js.map +1 -1
  38. package/dist/agent-runtime/src/config-mutations.d.ts +51 -0
  39. package/dist/agent-runtime/src/conversation-index.d.ts +110 -0
  40. package/dist/agent-runtime/src/conversation-list.d.ts +343 -0
  41. package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs +3 -2
  42. package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -1
  43. package/dist/agent-runtime/src/deep-agent-transport-recipe.d.ts +166 -0
  44. package/dist/agent-runtime/src/deep-agent-transport-recipe.js +3 -2
  45. package/dist/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -1
  46. package/dist/agent-runtime/src/desktop-handoff.d.ts +139 -0
  47. package/dist/agent-runtime/src/durable-thread-snapshot-cache.d.ts +60 -0
  48. package/dist/agent-runtime/src/edit-command.d.ts +156 -0
  49. package/dist/agent-runtime/src/errors.d.ts +174 -0
  50. package/dist/agent-runtime/src/execute-output.d.ts +31 -0
  51. package/dist/agent-runtime/src/generated/runconfig-contract.cjs +16 -2
  52. package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
  53. package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +202 -0
  54. package/dist/agent-runtime/src/generated/runconfig-contract.js +16 -2
  55. package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
  56. package/dist/agent-runtime/src/github-wake-event.d.ts +77 -0
  57. package/dist/agent-runtime/src/index.d.ts +74 -0
  58. package/dist/agent-runtime/src/interrupts.cjs +17 -0
  59. package/dist/agent-runtime/src/interrupts.cjs.map +1 -1
  60. package/dist/agent-runtime/src/interrupts.d.ts +348 -0
  61. package/dist/agent-runtime/src/interrupts.js +17 -0
  62. package/dist/agent-runtime/src/interrupts.js.map +1 -1
  63. package/dist/agent-runtime/src/lane-follow.d.ts +121 -0
  64. package/dist/agent-runtime/src/lane-history.cjs +209 -0
  65. package/dist/agent-runtime/src/lane-history.cjs.map +1 -0
  66. package/dist/agent-runtime/src/lane-history.d.ts +175 -0
  67. package/dist/agent-runtime/src/lane-history.js +209 -0
  68. package/dist/agent-runtime/src/lane-history.js.map +1 -0
  69. package/dist/agent-runtime/src/lane-images.d.ts +184 -0
  70. package/dist/agent-runtime/src/message-author.d.ts +43 -0
  71. package/dist/agent-runtime/src/message-text.cjs +15 -0
  72. package/dist/agent-runtime/src/message-text.cjs.map +1 -0
  73. package/dist/agent-runtime/src/message-text.d.ts +47 -0
  74. package/dist/agent-runtime/src/message-text.js +15 -0
  75. package/dist/agent-runtime/src/message-text.js.map +1 -0
  76. package/dist/agent-runtime/src/message-window.cjs +15 -1
  77. package/dist/agent-runtime/src/message-window.cjs.map +1 -1
  78. package/dist/agent-runtime/src/message-window.d.ts +159 -0
  79. package/dist/agent-runtime/src/message-window.js +16 -2
  80. package/dist/agent-runtime/src/message-window.js.map +1 -1
  81. package/dist/agent-runtime/src/messages.cjs +123 -8
  82. package/dist/agent-runtime/src/messages.cjs.map +1 -1
  83. package/dist/agent-runtime/src/messages.d.ts +621 -0
  84. package/dist/agent-runtime/src/messages.js +123 -8
  85. package/dist/agent-runtime/src/messages.js.map +1 -1
  86. package/dist/agent-runtime/src/model-context.d.ts +22 -0
  87. package/dist/agent-runtime/src/offline-status.d.ts +157 -0
  88. package/dist/agent-runtime/src/optimistic-content.d.ts +21 -0
  89. package/dist/agent-runtime/src/protocol.cjs +12 -4
  90. package/dist/agent-runtime/src/protocol.cjs.map +1 -1
  91. package/dist/agent-runtime/src/protocol.d.ts +119 -0
  92. package/dist/agent-runtime/src/protocol.js +13 -5
  93. package/dist/agent-runtime/src/protocol.js.map +1 -1
  94. package/dist/agent-runtime/src/ptc-subcalls.d.ts +51 -0
  95. package/dist/agent-runtime/src/queue.d.ts +138 -0
  96. package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs +10 -0
  97. package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
  98. package/dist/agent-runtime/src/quota-safe-local-storage-session.d.ts +161 -0
  99. package/dist/agent-runtime/src/quota-safe-local-storage-session.js +10 -0
  100. package/dist/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -1
  101. package/dist/agent-runtime/src/running-tool-placeholder.cjs +11 -0
  102. package/dist/agent-runtime/src/running-tool-placeholder.cjs.map +1 -0
  103. package/dist/agent-runtime/src/running-tool-placeholder.d.ts +25 -0
  104. package/dist/agent-runtime/src/running-tool-placeholder.js +11 -0
  105. package/dist/agent-runtime/src/running-tool-placeholder.js.map +1 -0
  106. package/dist/agent-runtime/src/runtime-messages.d.ts +104 -0
  107. package/dist/agent-runtime/src/screen-point.d.ts +151 -0
  108. package/dist/agent-runtime/src/sealed-idb.cjs +112 -0
  109. package/dist/agent-runtime/src/sealed-idb.cjs.map +1 -0
  110. package/dist/agent-runtime/src/sealed-idb.d.ts +106 -0
  111. package/dist/agent-runtime/src/sealed-idb.js +112 -0
  112. package/dist/agent-runtime/src/sealed-idb.js.map +1 -0
  113. package/dist/agent-runtime/src/send-recovery.d.ts +40 -0
  114. package/dist/agent-runtime/src/session-lane-scope.cjs +25 -0
  115. package/dist/agent-runtime/src/session-lane-scope.cjs.map +1 -0
  116. package/dist/agent-runtime/src/session-lane-scope.d.ts +59 -0
  117. package/dist/agent-runtime/src/session-lane-scope.js +25 -0
  118. package/dist/agent-runtime/src/session-lane-scope.js.map +1 -0
  119. package/dist/agent-runtime/src/statewire-attach-observer.d.ts +194 -0
  120. package/dist/agent-runtime/src/statewire-diagnostics.d.ts +74 -0
  121. package/dist/agent-runtime/src/statewire-state.d.ts +29 -0
  122. package/dist/agent-runtime/src/statewire-suspended.cjs.map +1 -1
  123. package/dist/agent-runtime/src/statewire-suspended.d.ts +27 -0
  124. package/dist/agent-runtime/src/statewire-suspended.js.map +1 -1
  125. package/dist/agent-runtime/src/statewire-transport.d.ts +40 -0
  126. package/dist/agent-runtime/src/streaming-markdown.d.ts +46 -0
  127. package/dist/agent-runtime/src/subagent-transcripts.cjs +209 -0
  128. package/dist/agent-runtime/src/subagent-transcripts.cjs.map +1 -0
  129. package/dist/agent-runtime/src/subagent-transcripts.d.ts +71 -0
  130. package/dist/agent-runtime/src/subagent-transcripts.js +209 -0
  131. package/dist/agent-runtime/src/subagent-transcripts.js.map +1 -0
  132. package/dist/agent-runtime/src/subagents.cjs +253 -0
  133. package/dist/agent-runtime/src/subagents.cjs.map +1 -0
  134. package/dist/agent-runtime/src/subagents.d.ts +311 -0
  135. package/dist/agent-runtime/src/subagents.js +253 -0
  136. package/dist/agent-runtime/src/subagents.js.map +1 -0
  137. package/dist/agent-runtime/src/subscription-wake-event.d.ts +111 -0
  138. package/dist/agent-runtime/src/thread-extras.d.ts +43 -0
  139. package/dist/agent-runtime/src/thread-handoff.d.ts +364 -0
  140. package/dist/agent-runtime/src/thread-prewarm-controller.d.ts +76 -0
  141. package/dist/agent-runtime/src/thread-prewarm.d.ts +118 -0
  142. package/dist/agent-runtime/src/thread-snapshot-cache.d.ts +99 -0
  143. package/dist/agent-runtime/src/thread-snapshot-mirror.cjs +46 -117
  144. package/dist/agent-runtime/src/thread-snapshot-mirror.cjs.map +1 -1
  145. package/dist/agent-runtime/src/thread-snapshot-mirror.d.ts +101 -0
  146. package/dist/agent-runtime/src/thread-snapshot-mirror.js +17 -88
  147. package/dist/agent-runtime/src/thread-snapshot-mirror.js.map +1 -1
  148. package/dist/agent-runtime/src/thread-status.d.ts +53 -0
  149. package/dist/agent-runtime/src/tool-metadata.d.ts +146 -0
  150. package/dist/agent-runtime/src/tool-names.cjs +71 -0
  151. package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
  152. package/dist/agent-runtime/src/tool-names.d.ts +67 -0
  153. package/dist/agent-runtime/src/tool-names.js +72 -1
  154. package/dist/agent-runtime/src/tool-names.js.map +1 -1
  155. package/dist/agent-runtime/src/tool-outputs.d.ts +35 -0
  156. package/dist/agent-runtime/src/tool-result.cjs +1 -0
  157. package/dist/agent-runtime/src/tool-result.cjs.map +1 -1
  158. package/dist/agent-runtime/src/tool-result.d.ts +126 -0
  159. package/dist/agent-runtime/src/tool-result.js +1 -0
  160. package/dist/agent-runtime/src/tool-result.js.map +1 -1
  161. package/dist/agent-runtime/src/types.d.ts +159 -0
  162. package/dist/agent-runtime/src/use-conversation-list.d.ts +76 -0
  163. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +136 -0
  164. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -0
  165. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +64 -0
  166. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +136 -0
  167. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -0
  168. package/dist/agent-runtime/src/use-deep-agent-config.d.ts +169 -0
  169. package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs +13 -0
  170. package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
  171. package/dist/agent-runtime/src/use-deep-agent-edit-submit.d.ts +22 -0
  172. package/dist/agent-runtime/src/use-deep-agent-edit-submit.js +13 -0
  173. package/dist/agent-runtime/src/use-deep-agent-edit-submit.js.map +1 -1
  174. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +37 -2
  175. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
  176. package/dist/agent-runtime/src/use-deep-agent-runtime.d.ts +177 -0
  177. package/dist/agent-runtime/src/use-deep-agent-runtime.js +38 -3
  178. package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
  179. package/dist/agent-runtime/src/use-deep-agent-thread.cjs +39 -13
  180. package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
  181. package/dist/agent-runtime/src/use-deep-agent-thread.d.ts +352 -0
  182. package/dist/agent-runtime/src/use-deep-agent-thread.js +39 -13
  183. package/dist/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
  184. package/dist/agent-runtime/src/use-deep-agent-voice.cjs +1019 -0
  185. package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -0
  186. package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +409 -0
  187. package/dist/agent-runtime/src/use-deep-agent-voice.js +1019 -0
  188. package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -0
  189. package/dist/agent-runtime/src/use-deep-agent-window-sync.d.ts +102 -0
  190. package/dist/agent-runtime/src/use-historical-edit-attachments.d.ts +2 -0
  191. package/dist/agent-runtime/src/use-thread-handoff-flow.d.ts +84 -0
  192. package/dist/agent-runtime/src/voice-presentation.cjs +2 -0
  193. package/dist/agent-runtime/src/voice-presentation.cjs.map +1 -1
  194. package/dist/agent-runtime/src/voice-presentation.d.ts +80 -0
  195. package/dist/agent-runtime/src/voice-presentation.js +2 -0
  196. package/dist/agent-runtime/src/voice-presentation.js.map +1 -1
  197. package/dist/agent-runtime/src/voice-turn-grouping.d.ts +28 -0
  198. package/dist/agent-runtime/src/voice-wire-types.d.ts +15 -0
  199. package/dist/agent-runtime/src/withdrawn-turns.d.ts +97 -0
  200. package/dist/catalog/runtime-catalog.js +1 -1
  201. package/dist/chat/AthenaChat.cjs +192 -103
  202. package/dist/chat/AthenaChat.cjs.map +1 -1
  203. package/dist/chat/AthenaChat.d.ts +9 -0
  204. package/dist/chat/AthenaChat.js +194 -105
  205. package/dist/chat/AthenaChat.js.map +1 -1
  206. package/dist/chat/StatewireApprovalCard.d.ts +1 -1
  207. package/dist/chat/StatewireClientToolBridge.d.ts +1 -1
  208. package/dist/chat/StatewireQueuedMessages.cjs +11 -4
  209. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
  210. package/dist/chat/StatewireQueuedMessages.d.ts +1 -1
  211. package/dist/chat/StatewireQueuedMessages.js +11 -4
  212. package/dist/chat/StatewireQueuedMessages.js.map +1 -1
  213. package/dist/chat/chat-outbox-rows.cjs +223 -0
  214. package/dist/chat/chat-outbox-rows.cjs.map +1 -0
  215. package/dist/chat/chat-outbox-rows.d.ts +29 -0
  216. package/dist/chat/chat-outbox-rows.js +223 -0
  217. package/dist/chat/chat-outbox-rows.js.map +1 -0
  218. package/dist/chat/chat-voice-controls.cjs +128 -0
  219. package/dist/chat/chat-voice-controls.cjs.map +1 -0
  220. package/dist/chat/chat-voice-controls.d.ts +19 -0
  221. package/dist/chat/chat-voice-controls.js +128 -0
  222. package/dist/chat/chat-voice-controls.js.map +1 -0
  223. package/dist/chat/statewire-approval.d.ts +1 -1
  224. package/dist/chat/statewire-client-tools.d.ts +1 -1
  225. package/dist/chat/super-grouping/SuperGroupingCard.cjs +3 -1
  226. package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
  227. package/dist/chat/super-grouping/SuperGroupingCard.d.ts +7 -1
  228. package/dist/chat/super-grouping/SuperGroupingCard.js +3 -1
  229. package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
  230. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +7 -2
  231. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -1
  232. package/dist/chat/super-grouping/SuperGroupingTranscript.d.ts +2 -2
  233. package/dist/chat/super-grouping/SuperGroupingTranscript.js +7 -2
  234. package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -1
  235. package/dist/chat/super-grouping/activity-timeline.cjs +15 -8
  236. package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
  237. package/dist/chat/super-grouping/activity-timeline.d.ts +18 -8
  238. package/dist/chat/super-grouping/activity-timeline.js +15 -8
  239. package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
  240. package/dist/chat/use-statewire-approval-request.cjs +36 -0
  241. package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
  242. package/dist/chat/use-statewire-approval-request.d.ts +49 -1
  243. package/dist/chat/use-statewire-approval-request.js +39 -3
  244. package/dist/chat/use-statewire-approval-request.js.map +1 -1
  245. package/dist/chat-ui/composer/tiptap-composer.cjs +133 -14
  246. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
  247. package/dist/chat-ui/composer/tiptap-composer.d.ts +33 -1
  248. package/dist/chat-ui/composer/tiptap-composer.js +135 -16
  249. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
  250. package/dist/chat-ui/header/conversation-history-panel.d.ts +1 -1
  251. package/dist/chat-ui/index.d.ts +1 -1
  252. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +2 -1
  253. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
  254. package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +3 -1
  255. package/dist/chat-ui/mentions/suggestions/data/api-client.js +2 -1
  256. package/dist/chat-ui/mentions/suggestions/data/api-client.js.map +1 -1
  257. package/dist/chat-ui/mentions/use-account-workspace-id.cjs +29 -51
  258. package/dist/chat-ui/mentions/use-account-workspace-id.cjs.map +1 -1
  259. package/dist/chat-ui/mentions/use-account-workspace-id.d.ts +2 -2
  260. package/dist/chat-ui/mentions/use-account-workspace-id.js +30 -52
  261. package/dist/chat-ui/mentions/use-account-workspace-id.js.map +1 -1
  262. package/dist/chat-ui/messages/message-components.cjs +15 -0
  263. package/dist/chat-ui/messages/message-components.cjs.map +1 -1
  264. package/dist/chat-ui/messages/message-components.js +15 -0
  265. package/dist/chat-ui/messages/message-components.js.map +1 -1
  266. package/dist/chat-ui/messages/runtime-message.d.ts +1 -1
  267. package/dist/chat-ui/messages/statewire-continue-run.d.ts +1 -1
  268. package/dist/chat-ui/messages/user-edit-composer.cjs +15 -2
  269. package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
  270. package/dist/chat-ui/messages/user-edit-composer.d.ts +4 -2
  271. package/dist/chat-ui/messages/user-edit-composer.js +15 -2
  272. package/dist/chat-ui/messages/user-edit-composer.js.map +1 -1
  273. package/dist/chat-ui/messages/wake-marker.d.ts +1 -1
  274. package/dist/chat-ui/rich-text/chat-text-schema.cjs +1 -0
  275. package/dist/chat-ui/rich-text/chat-text-schema.cjs.map +1 -1
  276. package/dist/chat-ui/rich-text/chat-text-schema.d.ts +3 -0
  277. package/dist/chat-ui/rich-text/chat-text-schema.js +1 -0
  278. package/dist/chat-ui/rich-text/chat-text-schema.js.map +1 -1
  279. package/dist/chat-ui/statewire.cjs +1 -0
  280. package/dist/chat-ui/statewire.cjs.map +1 -1
  281. package/dist/chat-ui/statewire.d.ts +2 -2
  282. package/dist/chat-ui/statewire.js +2 -1
  283. package/dist/chat-ui/thread/composer-send-or-stop.cjs +2 -1
  284. package/dist/chat-ui/thread/composer-send-or-stop.cjs.map +1 -1
  285. package/dist/chat-ui/thread/composer-send-or-stop.d.ts +2 -0
  286. package/dist/chat-ui/thread/composer-send-or-stop.js +2 -1
  287. package/dist/chat-ui/thread/composer-send-or-stop.js.map +1 -1
  288. package/dist/chat-ui/thread/statewire-history-edge.d.ts +1 -1
  289. package/dist/composer/AttachmentContext.cjs +8 -4
  290. package/dist/composer/AttachmentContext.cjs.map +1 -1
  291. package/dist/composer/AttachmentContext.d.ts +7 -0
  292. package/dist/composer/AttachmentContext.js +8 -4
  293. package/dist/composer/AttachmentContext.js.map +1 -1
  294. package/dist/composer/build-composed-message.cjs +34 -0
  295. package/dist/composer/build-composed-message.cjs.map +1 -1
  296. package/dist/composer/build-composed-message.d.ts +20 -0
  297. package/dist/composer/build-composed-message.js +35 -1
  298. package/dist/composer/build-composed-message.js.map +1 -1
  299. package/dist/composer/composer-handoff.cjs +39 -2
  300. package/dist/composer/composer-handoff.cjs.map +1 -1
  301. package/dist/composer/composer-handoff.d.ts +28 -3
  302. package/dist/composer/composer-handoff.js +39 -2
  303. package/dist/composer/composer-handoff.js.map +1 -1
  304. package/dist/composer/useAttachFiles.cjs +15 -2
  305. package/dist/composer/useAttachFiles.cjs.map +1 -1
  306. package/dist/composer/useAttachFiles.d.ts +11 -0
  307. package/dist/composer/useAttachFiles.js +15 -2
  308. package/dist/composer/useAttachFiles.js.map +1 -1
  309. package/dist/composer/useSendMessage.cjs.map +1 -1
  310. package/dist/composer/useSendMessage.d.ts +4 -3
  311. package/dist/composer/useSendMessage.js.map +1 -1
  312. package/dist/diagnostics/athena-diagnostics.cjs.map +1 -1
  313. package/dist/diagnostics/athena-diagnostics.d.ts +3 -1
  314. package/dist/diagnostics/athena-diagnostics.js.map +1 -1
  315. package/dist/index.cjs +13 -0
  316. package/dist/index.cjs.map +1 -1
  317. package/dist/index.d.ts +14 -7
  318. package/dist/index.js +14 -1
  319. package/dist/index.js.map +1 -1
  320. package/dist/offline/chat-outbox.cjs +57 -0
  321. package/dist/offline/chat-outbox.cjs.map +1 -0
  322. package/dist/offline/chat-outbox.d.ts +80 -0
  323. package/dist/offline/chat-outbox.js +57 -0
  324. package/dist/offline/chat-outbox.js.map +1 -0
  325. package/dist/offline/offline-history.d.ts +1 -1
  326. package/dist/provider/AthenaProvider.cjs +162 -8
  327. package/dist/provider/AthenaProvider.cjs.map +1 -1
  328. package/dist/provider/AthenaProvider.d.ts +15 -1
  329. package/dist/provider/AthenaProvider.js +163 -9
  330. package/dist/provider/AthenaProvider.js.map +1 -1
  331. package/dist/provider/statewire-window-context.d.ts +1 -1
  332. package/dist/react/package.json.cjs +1 -1
  333. package/dist/react/package.json.js +1 -1
  334. package/dist/references/src/anchors/file-line-range.d.ts +58 -0
  335. package/dist/references/src/anchors/format.d.ts +21 -0
  336. package/dist/references/src/anchors/message-anchors.d.ts +71 -0
  337. package/dist/references/src/anchors/parse.d.ts +8 -0
  338. package/dist/references/src/anchors/registry-contract.d.ts +24 -0
  339. package/dist/references/src/anchors/registry.d.ts +19 -0
  340. package/dist/references/src/anchors/schemas.d.ts +194 -0
  341. package/dist/references/src/anchors/serialize.d.ts +8 -0
  342. package/dist/references/src/anchors/time.d.ts +78 -0
  343. package/dist/references/src/anchors/types.d.ts +474 -0
  344. package/dist/references/src/asset-bounds.d.ts +27 -0
  345. package/dist/references/src/asset-links.d.ts +23 -0
  346. package/dist/references/src/asset-reference.d.ts +16 -0
  347. package/dist/references/src/formats/format-catalog.d.ts +79 -0
  348. package/dist/references/src/formats/markdown/parse-reference-markdown.d.ts +28 -0
  349. package/dist/references/src/formats/markdown/reference-display-name.d.ts +6 -0
  350. package/dist/references/src/formats/object/asset-object.d.ts +9 -0
  351. package/dist/references/src/formats/object/callable-object.d.ts +6 -0
  352. package/dist/references/src/formats/object/decode-reference-object-payload.d.ts +3 -0
  353. package/dist/references/src/formats/object/external-url-object.d.ts +9 -0
  354. package/dist/references/src/formats/object/group-object.d.ts +9 -0
  355. package/dist/references/src/formats/object/navigation-object.d.ts +9 -0
  356. package/dist/references/src/formats/object/parse-reference-object.d.ts +11 -0
  357. package/dist/references/src/formats/object/person-object.d.ts +9 -0
  358. package/dist/references/src/formats/uri/asset-mention-uri.d.ts +9 -0
  359. package/dist/references/src/formats/uri/asset-spaces-url.d.ts +9 -0
  360. package/dist/references/src/formats/uri/callable-mention-uris.d.ts +9 -0
  361. package/dist/references/src/formats/uri/detect-uri-wire.d.ts +9 -0
  362. package/dist/references/src/formats/uri/group-mention-uri.d.ts +12 -0
  363. package/dist/references/src/formats/uri/navigation-spaces-url.d.ts +14 -0
  364. package/dist/references/src/formats/uri/parse-reference-uri.d.ts +20 -0
  365. package/dist/references/src/formats/uri/person-mention-uri.d.ts +9 -0
  366. package/dist/references/src/formats/uri/template-placeholder.d.ts +12 -0
  367. package/dist/references/src/index.d.ts +47 -0
  368. package/dist/references/src/legacy/index.d.ts +14 -0
  369. package/dist/references/src/legacy/pre-reference-asset-url.d.ts +57 -0
  370. package/dist/references/src/legacy/pre-reference-citation-bridge.d.ts +22 -0
  371. package/dist/references/src/legacy/pre-reference-citation.d.ts +138 -0
  372. package/dist/references/src/legacy/pre-reference-external-url.d.ts +31 -0
  373. package/dist/references/src/legacy/pre-reference-format.d.ts +8 -0
  374. package/dist/references/src/legacy/pre-reference-mention.d.ts +27 -0
  375. package/dist/references/src/legacy/pre-reference-object.d.ts +8 -0
  376. package/dist/references/src/legacy/pre-reference-uri.d.ts +12 -0
  377. package/dist/references/src/legacy.d.ts +2 -0
  378. package/dist/references/src/mention-href-patterns.d.ts +19 -0
  379. package/dist/references/src/mention-node/index.d.ts +5 -0
  380. package/dist/references/src/mention-node/mention-node.d.ts +31 -0
  381. package/dist/references/src/mention-node/resolve-node-attrs.d.ts +27 -0
  382. package/dist/references/src/parse-reference.d.ts +23 -0
  383. package/dist/references/src/schemas.d.ts +463 -0
  384. package/dist/references/src/serialize-reference.d.ts +50 -0
  385. package/dist/references/src/sheet-name.d.ts +10 -0
  386. package/dist/references/src/tool-option-schemas.d.ts +597 -0
  387. package/dist/references/src/types.d.ts +125 -0
  388. package/dist/references/src/version-ref.d.ts +30 -0
  389. package/dist/runtime/statewire-lifecycle.d.ts +1 -1
  390. package/dist/runtime/statewire-model-lane.d.ts +1 -1
  391. package/dist/runtime/statewire-server-lane-context.d.ts +1 -1
  392. package/dist/runtime/statewire-session-key.cjs +7 -0
  393. package/dist/runtime/statewire-session-key.cjs.map +1 -1
  394. package/dist/runtime/statewire-session-key.d.ts +19 -0
  395. package/dist/runtime/statewire-session-key.js +8 -1
  396. package/dist/runtime/statewire-session-key.js.map +1 -1
  397. package/dist/runtime/statewire-session-lane.cjs +48 -0
  398. package/dist/runtime/statewire-session-lane.cjs.map +1 -0
  399. package/dist/runtime/statewire-session-lane.d.ts +29 -0
  400. package/dist/runtime/statewire-session-lane.js +48 -0
  401. package/dist/runtime/statewire-session-lane.js.map +1 -0
  402. package/dist/runtime/statewire-thread-config-lane.d.ts +1 -1
  403. package/dist/runtime/useAthenaStatewireRuntime.cjs +19 -5
  404. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
  405. package/dist/runtime/useAthenaStatewireRuntime.d.ts +15 -1
  406. package/dist/runtime/useAthenaStatewireRuntime.js +20 -6
  407. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
  408. package/dist/styles.css +1 -1
  409. package/dist/threads/api.d.ts +1 -1
  410. package/dist/threads/conversation-list-fetcher.d.ts +1 -1
  411. package/dist/threads/index-triggered-refresh.cjs +164 -0
  412. package/dist/threads/index-triggered-refresh.cjs.map +1 -0
  413. package/dist/threads/index-triggered-refresh.d.ts +70 -0
  414. package/dist/threads/index-triggered-refresh.js +164 -0
  415. package/dist/threads/index-triggered-refresh.js.map +1 -0
  416. package/dist/threads/offline-session-list.d.ts +1 -1
  417. package/dist/threads/pull-request-display.d.ts +1 -1
  418. package/dist/threads/session-list-model.d.ts +1 -1
  419. package/dist/threads/session-list-tab-share.cjs +150 -0
  420. package/dist/threads/session-list-tab-share.cjs.map +1 -0
  421. package/dist/threads/session-list-tab-share.d.ts +73 -0
  422. package/dist/threads/session-list-tab-share.js +150 -0
  423. package/dist/threads/session-list-tab-share.js.map +1 -0
  424. package/dist/threads/session-row-parts.d.ts +1 -1
  425. package/dist/threads/sessions-query.d.ts +1 -1
  426. package/dist/threads/statewire-thread-list.cjs +42 -16
  427. package/dist/threads/statewire-thread-list.cjs.map +1 -1
  428. package/dist/threads/statewire-thread-list.d.ts +11 -2
  429. package/dist/threads/statewire-thread-list.js +43 -17
  430. package/dist/threads/statewire-thread-list.js.map +1 -1
  431. package/dist/threads/thread-prefetcher.d.ts +1 -1
  432. package/dist/threads/use-athena-session-attention.d.ts +1 -1
  433. package/dist/threads/use-athena-sessions.cjs +32 -22
  434. package/dist/threads/use-athena-sessions.cjs.map +1 -1
  435. package/dist/threads/use-athena-sessions.js +33 -23
  436. package/dist/threads/use-athena-sessions.js.map +1 -1
  437. package/dist/threads/use-rest-conversation-history.d.ts +1 -1
  438. package/dist/threads/use-statewire-conversation-history.d.ts +5 -5
  439. package/dist/tiptap-markdown-table/src/markdown-table-serializer.d.ts +56 -0
  440. package/dist/tools/NestedPtcMessages.cjs +14 -9
  441. package/dist/tools/NestedPtcMessages.cjs.map +1 -1
  442. package/dist/tools/NestedPtcMessages.d.ts +9 -0
  443. package/dist/tools/NestedPtcMessages.js +6 -1
  444. package/dist/tools/NestedPtcMessages.js.map +1 -1
  445. package/dist/tools/index.d.ts +1 -1
  446. package/dist/tools/primitives.d.ts +1 -1
  447. package/dist/tools/subagent-task-tool-ui.cjs +494 -0
  448. package/dist/tools/subagent-task-tool-ui.cjs.map +1 -0
  449. package/dist/tools/subagent-task-tool-ui.d.ts +109 -0
  450. package/dist/tools/subagent-task-tool-ui.js +494 -0
  451. package/dist/tools/subagent-task-tool-ui.js.map +1 -0
  452. package/dist/tools/tool-fallback.d.ts +1 -1
  453. package/dist/tools/tool-icons.d.ts +1 -1
  454. package/dist/tools/tool-summary.d.ts +1 -1
  455. package/dist/tools/tool-uis.cjs +4 -0
  456. package/dist/tools/tool-uis.cjs.map +1 -1
  457. package/dist/tools/tool-uis.js +4 -0
  458. package/dist/tools/tool-uis.js.map +1 -1
  459. package/dist/voice/chat.cjs +6 -0
  460. package/dist/voice/chat.cjs.map +1 -0
  461. package/dist/voice/chat.d.ts +2 -0
  462. package/dist/voice/chat.js +6 -0
  463. package/dist/voice/chat.js.map +1 -0
  464. package/dist/voice/livekit-join.cjs +119 -0
  465. package/dist/voice/livekit-join.cjs.map +1 -0
  466. package/dist/voice/livekit-join.d.ts +8 -0
  467. package/dist/voice/livekit-join.js +119 -0
  468. package/dist/voice/livekit-join.js.map +1 -0
  469. package/dist/voice/livekit.cjs +32 -0
  470. package/dist/voice/livekit.cjs.map +1 -0
  471. package/dist/voice/livekit.d.ts +80 -0
  472. package/dist/voice/livekit.js +32 -0
  473. package/dist/voice/livekit.js.map +1 -0
  474. package/dist/voice/use-chat-voice-enabled.cjs +43 -0
  475. package/dist/voice/use-chat-voice-enabled.cjs.map +1 -0
  476. package/dist/voice/use-chat-voice-enabled.d.ts +9 -0
  477. package/dist/voice/use-chat-voice-enabled.js +43 -0
  478. package/dist/voice/use-chat-voice-enabled.js.map +1 -0
  479. package/package.json +22 -16
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const chatOutboxStore = require("../agent-runtime/src/chat-outbox-store.cjs");
4
+ const chatOutbox = require("../agent-runtime/src/chat-outbox.cjs");
5
+ const ownerStores = /* @__PURE__ */ new Map();
6
+ function keylessHost(ownerId) {
7
+ return { ownerId, getKey: async () => null };
8
+ }
9
+ function ownerStore(ownerId, host) {
10
+ let owner = ownerStores.get(ownerId);
11
+ if (!owner) {
12
+ const current = { current: host ?? keylessHost(ownerId) };
13
+ owner = {
14
+ host: current,
15
+ store: chatOutboxStore.createIndexedDbChatOutboxStore({
16
+ ownerId,
17
+ getKey: (_ownerId, purpose) => current.current.getKey(purpose)
18
+ })
19
+ };
20
+ ownerStores.set(ownerId, owner);
21
+ }
22
+ if (host) owner.host.current = host;
23
+ return owner.store;
24
+ }
25
+ function chatOutboxStoreFor(host) {
26
+ return ownerStore(host.ownerId, host);
27
+ }
28
+ function countChatOutboxMessages(ownerId) {
29
+ return ownerStore(ownerId).count();
30
+ }
31
+ function subscribeChatOutbox(ownerId, listener) {
32
+ return ownerStore(ownerId).subscribe(listener);
33
+ }
34
+ async function listChatOutboxMessages(ownerId, now = Date.now()) {
35
+ const records = await ownerStore(ownerId).listAll();
36
+ return records.map(({ entry, claim, failure, memoryOnly }) => ({
37
+ id: entry.id,
38
+ threadId: entry.threadId,
39
+ text: entry.text,
40
+ newChat: entry.newChat,
41
+ status: failure ? "failed" : claim && now - claim.at < chatOutbox.CHAT_OUTBOX_CLAIM_LEASE_MS ? "sending" : now - entry.queuedAt > chatOutbox.CHAT_OUTBOX_ASK_AFTER_MS ? "ask" : "waiting",
42
+ inMemory: memoryOnly === true
43
+ }));
44
+ }
45
+ function clearChatOutbox(ownerId) {
46
+ return ownerStore(ownerId).clear();
47
+ }
48
+ function clearUnopenableChatOutbox(ownerId) {
49
+ return chatOutboxStore.createIndexedDbChatOutboxStore({ ownerId, getKey: async () => null }).clear();
50
+ }
51
+ exports.chatOutboxStoreFor = chatOutboxStoreFor;
52
+ exports.clearChatOutbox = clearChatOutbox;
53
+ exports.clearUnopenableChatOutbox = clearUnopenableChatOutbox;
54
+ exports.countChatOutboxMessages = countChatOutboxMessages;
55
+ exports.listChatOutboxMessages = listChatOutboxMessages;
56
+ exports.subscribeChatOutbox = subscribeChatOutbox;
57
+ //# sourceMappingURL=chat-outbox.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-outbox.cjs","sources":["../../src/offline/chat-outbox.ts"],"sourcesContent":["import {\n CHAT_OUTBOX_ASK_AFTER_MS,\n CHAT_OUTBOX_CLAIM_LEASE_MS,\n type ChatOutboxKeyPurpose,\n type ChatOutboxSignal,\n type ChatOutboxStore,\n createIndexedDbChatOutboxStore,\n} from '@athenaintel/agent-runtime';\n\n/**\n * Opt-in: messages typed while Athena can't be reached wait on this device, sealed with the host's\n * key, and are sent once Athena is back while the app is in front, after a countdown the person\n * can cancel (`@athenaintel/agent-runtime`'s chat outbox, shown at the top of the queue tray).\n * Without it a send goes to the transport as before.\n *\n * - `ownerId` names whose they are (the signed-in person, with the environment). Another owner's\n * messages are never shown or sent: each owner's are sealed under their own key.\n * - `getKey(purpose)` returns the AES-GCM key: `read` opens what is kept (the key if one exists,\n * never made for this), `write` keeps a new message (only while the deployment lets devices keep\n * copies). `null` keeps a new message in memory only, for as long as the page stays open. Unlike\n * the chat history's, this key guards the only copy of what someone wrote: a host must never\n * replace or drop it except at a sign-out the person chose.\n * - `reachability` says Athena can be reached: the host's own model (the device online AND agora\n * answering a health read, as Midas's main process decides it), by default the browser being\n * online. Either way a conversation whose own channel keeps failing to connect counts as out of\n * reach too.\n * - `foreground` says the app is in front; by default a visible document. A desktop host passes\n * `windowInFrontSignal()` (visible and focused).\n * - `openThread` opens another of the person's conversations the tray lists as holding waiting\n * messages (`newChat`: one that never started). Without it, a provider with a thread list\n * switches to it; otherwise the tray names it without Open.\n */\nexport interface AthenaChatOutbox {\n ownerId: string;\n getKey: (purpose: ChatOutboxKeyPurpose) => Promise<CryptoKey | null>;\n reachability?: ChatOutboxSignal;\n foreground?: ChatOutboxSignal;\n openThread?: (target: { threadId: string; newChat: boolean }) => void;\n}\n\ninterface OwnerStore {\n store: ChatOutboxStore;\n /** The latest host for this owner: the store asks it for the key. */\n host: { current: AthenaChatOutbox };\n}\n\n// process-local: one store per owner in this page, so every provider of the person (a chat in a\n// tab, another in a pane) shares one change bus and one memory of the messages this device could\n// not keep: a thread switch or a closed tab never loses them, and a sign-out counts them.\nconst ownerStores = new Map<string, OwnerStore>();\n\n/** A host that has no key to give (counting and deleting never need one). */\nfunction keylessHost(ownerId: string): AthenaChatOutbox {\n return { ownerId, getKey: async () => null };\n}\n\nfunction ownerStore(ownerId: string, host?: AthenaChatOutbox): ChatOutboxStore {\n let owner = ownerStores.get(ownerId);\n if (!owner) {\n const current = { current: host ?? keylessHost(ownerId) };\n owner = {\n host: current,\n store: createIndexedDbChatOutboxStore({\n ownerId,\n getKey: (_ownerId, purpose) => current.current.getKey(purpose),\n }),\n };\n ownerStores.set(ownerId, owner);\n }\n if (host) owner.host.current = host;\n return owner.store;\n}\n\n/** The page's chat outbox store for `host`'s owner, made on first use. */\nexport function chatOutboxStoreFor(host: AthenaChatOutbox): ChatOutboxStore {\n return ownerStore(host.ownerId, host);\n}\n\n/**\n * How many messages wait for `ownerId` (kept on the device, including records this build cannot\n * open, and waiting in this page's memory), counted without opening them. Rejects when the\n * device's records cannot be counted at all.\n */\nexport function countChatOutboxMessages(ownerId: string): Promise<number> {\n return ownerStore(ownerId).count();\n}\n\n/**\n * Calls `listener` after any change to `ownerId`'s waiting messages, this window's or another's\n * (one kept, handed to its conversation, cancelled, failed or retried), so a host can show how many\n * wait (`countChatOutboxMessages`) without asking on a timer. Returns what stops it.\n */\nexport function subscribeChatOutbox(ownerId: string, listener: () => void): () => void {\n return ownerStore(ownerId).subscribe(listener);\n}\n\n/** A message waiting in an owner's outbox, as a host lists it (its \"Waiting to sync\" list). */\nexport interface ChatOutboxMessageSummary {\n id: string;\n threadId: string;\n /** The text as it will be sent. */\n text: string;\n /** Typed into a chat that had never started. */\n newChat: boolean;\n /**\n * Where it stands, as the queue tray shows it: waiting to be sent, being handed to its\n * conversation now (a window's claim on it still holds), waiting for the person (it waited more\n * than a day: Send, Edit or Discard), or failed (Retry or Discard; never retried on its own).\n */\n status: 'waiting' | 'sending' | 'ask' | 'failed';\n /** Kept only in this page's memory: this device could not keep it. */\n inMemory: boolean;\n}\n\n/**\n * The messages waiting for `ownerId` that this page can open (oldest first), each with where it\n * stands, for a host's list of what waits to sync; the tray in the conversation acts on them.\n * Records this page cannot open (no key here, a newer build's) are left out, so a host counts with\n * `countChatOutboxMessages`.\n */\nexport async function listChatOutboxMessages(\n ownerId: string,\n now: number = Date.now(),\n): Promise<ChatOutboxMessageSummary[]> {\n const records = await ownerStore(ownerId).listAll();\n return records.map(({ entry, claim, failure, memoryOnly }) => ({\n id: entry.id,\n threadId: entry.threadId,\n text: entry.text,\n newChat: entry.newChat,\n status: failure\n ? 'failed'\n : claim && now - claim.at < CHAT_OUTBOX_CLAIM_LEASE_MS\n ? 'sending'\n : now - entry.queuedAt > CHAT_OUTBOX_ASK_AFTER_MS\n ? 'ask'\n : 'waiting',\n inMemory: memoryOnly === true,\n }));\n}\n\n/** A sign-out the person chose: every message waiting for `ownerId` goes, on the device and in memory. */\nexport function clearChatOutbox(ownerId: string): Promise<void> {\n return ownerStore(ownerId).clear();\n}\n\n/**\n * Deletes the records kept on this device for `ownerId`, never the messages waiting in this page's\n * memory: for a host whose key for them no longer exists (a chosen sign-out deleted it before the\n * page could delete the records), so nothing can ever open them and they must not be counted.\n */\nexport function clearUnopenableChatOutbox(ownerId: string): Promise<void> {\n return createIndexedDbChatOutboxStore({ ownerId, getKey: async () => null }).clear();\n}\n"],"names":["createIndexedDbChatOutboxStore","CHAT_OUTBOX_CLAIM_LEASE_MS","CHAT_OUTBOX_ASK_AFTER_MS"],"mappings":";;;;AAiDA,MAAM,kCAAkB,IAAA;AAGxB,SAAS,YAAY,SAAmC;AACtD,SAAO,EAAE,SAAS,QAAQ,YAAY,KAAA;AACxC;AAEA,SAAS,WAAW,SAAiB,MAA0C;AAC7E,MAAI,QAAQ,YAAY,IAAI,OAAO;AACnC,MAAI,CAAC,OAAO;AACV,UAAM,UAAU,EAAE,SAAS,QAAQ,YAAY,OAAO,EAAA;AACtD,YAAQ;AAAA,MACN,MAAM;AAAA,MACN,OAAOA,gBAAAA,+BAA+B;AAAA,QACpC;AAAA,QACA,QAAQ,CAAC,UAAU,YAAY,QAAQ,QAAQ,OAAO,OAAO;AAAA,MAAA,CAC9D;AAAA,IAAA;AAEH,gBAAY,IAAI,SAAS,KAAK;AAAA,EAChC;AACA,MAAI,KAAM,OAAM,KAAK,UAAU;AAC/B,SAAO,MAAM;AACf;AAGO,SAAS,mBAAmB,MAAyC;AAC1E,SAAO,WAAW,KAAK,SAAS,IAAI;AACtC;AAOO,SAAS,wBAAwB,SAAkC;AACxE,SAAO,WAAW,OAAO,EAAE,MAAA;AAC7B;AAOO,SAAS,oBAAoB,SAAiB,UAAkC;AACrF,SAAO,WAAW,OAAO,EAAE,UAAU,QAAQ;AAC/C;AA0BA,eAAsB,uBACpB,SACA,MAAc,KAAK,OACkB;AACrC,QAAM,UAAU,MAAM,WAAW,OAAO,EAAE,QAAA;AAC1C,SAAO,QAAQ,IAAI,CAAC,EAAE,OAAO,OAAO,SAAS,kBAAkB;AAAA,IAC7D,IAAI,MAAM;AAAA,IACV,UAAU,MAAM;AAAA,IAChB,MAAM,MAAM;AAAA,IACZ,SAAS,MAAM;AAAA,IACf,QAAQ,UACJ,WACA,SAAS,MAAM,MAAM,KAAKC,WAAAA,6BACxB,YACA,MAAM,MAAM,WAAWC,WAAAA,2BACrB,QACA;AAAA,IACR,UAAU,eAAe;AAAA,EAAA,EACzB;AACJ;AAGO,SAAS,gBAAgB,SAAgC;AAC9D,SAAO,WAAW,OAAO,EAAE,MAAA;AAC7B;AAOO,SAAS,0BAA0B,SAAgC;AACxE,SAAOF,gBAAAA,+BAA+B,EAAE,SAAS,QAAQ,YAAY,KAAA,CAAM,EAAE,MAAA;AAC/E;;;;;;;"}
@@ -0,0 +1,80 @@
1
+ import { type ChatOutboxKeyPurpose, type ChatOutboxSignal, type ChatOutboxStore } from '../agent-runtime/src/index';
2
+ /**
3
+ * Opt-in: messages typed while Athena can't be reached wait on this device, sealed with the host's
4
+ * key, and are sent once Athena is back while the app is in front, after a countdown the person
5
+ * can cancel (`@athenaintel/agent-runtime`'s chat outbox, shown at the top of the queue tray).
6
+ * Without it a send goes to the transport as before.
7
+ *
8
+ * - `ownerId` names whose they are (the signed-in person, with the environment). Another owner's
9
+ * messages are never shown or sent: each owner's are sealed under their own key.
10
+ * - `getKey(purpose)` returns the AES-GCM key: `read` opens what is kept (the key if one exists,
11
+ * never made for this), `write` keeps a new message (only while the deployment lets devices keep
12
+ * copies). `null` keeps a new message in memory only, for as long as the page stays open. Unlike
13
+ * the chat history's, this key guards the only copy of what someone wrote: a host must never
14
+ * replace or drop it except at a sign-out the person chose.
15
+ * - `reachability` says Athena can be reached: the host's own model (the device online AND agora
16
+ * answering a health read, as Midas's main process decides it), by default the browser being
17
+ * online. Either way a conversation whose own channel keeps failing to connect counts as out of
18
+ * reach too.
19
+ * - `foreground` says the app is in front; by default a visible document. A desktop host passes
20
+ * `windowInFrontSignal()` (visible and focused).
21
+ * - `openThread` opens another of the person's conversations the tray lists as holding waiting
22
+ * messages (`newChat`: one that never started). Without it, a provider with a thread list
23
+ * switches to it; otherwise the tray names it without Open.
24
+ */
25
+ export interface AthenaChatOutbox {
26
+ ownerId: string;
27
+ getKey: (purpose: ChatOutboxKeyPurpose) => Promise<CryptoKey | null>;
28
+ reachability?: ChatOutboxSignal;
29
+ foreground?: ChatOutboxSignal;
30
+ openThread?: (target: {
31
+ threadId: string;
32
+ newChat: boolean;
33
+ }) => void;
34
+ }
35
+ /** The page's chat outbox store for `host`'s owner, made on first use. */
36
+ export declare function chatOutboxStoreFor(host: AthenaChatOutbox): ChatOutboxStore;
37
+ /**
38
+ * How many messages wait for `ownerId` (kept on the device, including records this build cannot
39
+ * open, and waiting in this page's memory), counted without opening them. Rejects when the
40
+ * device's records cannot be counted at all.
41
+ */
42
+ export declare function countChatOutboxMessages(ownerId: string): Promise<number>;
43
+ /**
44
+ * Calls `listener` after any change to `ownerId`'s waiting messages, this window's or another's
45
+ * (one kept, handed to its conversation, cancelled, failed or retried), so a host can show how many
46
+ * wait (`countChatOutboxMessages`) without asking on a timer. Returns what stops it.
47
+ */
48
+ export declare function subscribeChatOutbox(ownerId: string, listener: () => void): () => void;
49
+ /** A message waiting in an owner's outbox, as a host lists it (its "Waiting to sync" list). */
50
+ export interface ChatOutboxMessageSummary {
51
+ id: string;
52
+ threadId: string;
53
+ /** The text as it will be sent. */
54
+ text: string;
55
+ /** Typed into a chat that had never started. */
56
+ newChat: boolean;
57
+ /**
58
+ * Where it stands, as the queue tray shows it: waiting to be sent, being handed to its
59
+ * conversation now (a window's claim on it still holds), waiting for the person (it waited more
60
+ * than a day: Send, Edit or Discard), or failed (Retry or Discard; never retried on its own).
61
+ */
62
+ status: 'waiting' | 'sending' | 'ask' | 'failed';
63
+ /** Kept only in this page's memory: this device could not keep it. */
64
+ inMemory: boolean;
65
+ }
66
+ /**
67
+ * The messages waiting for `ownerId` that this page can open (oldest first), each with where it
68
+ * stands, for a host's list of what waits to sync; the tray in the conversation acts on them.
69
+ * Records this page cannot open (no key here, a newer build's) are left out, so a host counts with
70
+ * `countChatOutboxMessages`.
71
+ */
72
+ export declare function listChatOutboxMessages(ownerId: string, now?: number): Promise<ChatOutboxMessageSummary[]>;
73
+ /** A sign-out the person chose: every message waiting for `ownerId` goes, on the device and in memory. */
74
+ export declare function clearChatOutbox(ownerId: string): Promise<void>;
75
+ /**
76
+ * Deletes the records kept on this device for `ownerId`, never the messages waiting in this page's
77
+ * memory: for a host whose key for them no longer exists (a chosen sign-out deleted it before the
78
+ * page could delete the records), so nothing can ever open them and they must not be counted.
79
+ */
80
+ export declare function clearUnopenableChatOutbox(ownerId: string): Promise<void>;
@@ -0,0 +1,57 @@
1
+ import { createIndexedDbChatOutboxStore } from "../agent-runtime/src/chat-outbox-store.js";
2
+ import { CHAT_OUTBOX_CLAIM_LEASE_MS, CHAT_OUTBOX_ASK_AFTER_MS } from "../agent-runtime/src/chat-outbox.js";
3
+ const ownerStores = /* @__PURE__ */ new Map();
4
+ function keylessHost(ownerId) {
5
+ return { ownerId, getKey: async () => null };
6
+ }
7
+ function ownerStore(ownerId, host) {
8
+ let owner = ownerStores.get(ownerId);
9
+ if (!owner) {
10
+ const current = { current: host ?? keylessHost(ownerId) };
11
+ owner = {
12
+ host: current,
13
+ store: createIndexedDbChatOutboxStore({
14
+ ownerId,
15
+ getKey: (_ownerId, purpose) => current.current.getKey(purpose)
16
+ })
17
+ };
18
+ ownerStores.set(ownerId, owner);
19
+ }
20
+ if (host) owner.host.current = host;
21
+ return owner.store;
22
+ }
23
+ function chatOutboxStoreFor(host) {
24
+ return ownerStore(host.ownerId, host);
25
+ }
26
+ function countChatOutboxMessages(ownerId) {
27
+ return ownerStore(ownerId).count();
28
+ }
29
+ function subscribeChatOutbox(ownerId, listener) {
30
+ return ownerStore(ownerId).subscribe(listener);
31
+ }
32
+ async function listChatOutboxMessages(ownerId, now = Date.now()) {
33
+ const records = await ownerStore(ownerId).listAll();
34
+ return records.map(({ entry, claim, failure, memoryOnly }) => ({
35
+ id: entry.id,
36
+ threadId: entry.threadId,
37
+ text: entry.text,
38
+ newChat: entry.newChat,
39
+ status: failure ? "failed" : claim && now - claim.at < CHAT_OUTBOX_CLAIM_LEASE_MS ? "sending" : now - entry.queuedAt > CHAT_OUTBOX_ASK_AFTER_MS ? "ask" : "waiting",
40
+ inMemory: memoryOnly === true
41
+ }));
42
+ }
43
+ function clearChatOutbox(ownerId) {
44
+ return ownerStore(ownerId).clear();
45
+ }
46
+ function clearUnopenableChatOutbox(ownerId) {
47
+ return createIndexedDbChatOutboxStore({ ownerId, getKey: async () => null }).clear();
48
+ }
49
+ export {
50
+ chatOutboxStoreFor,
51
+ clearChatOutbox,
52
+ clearUnopenableChatOutbox,
53
+ countChatOutboxMessages,
54
+ listChatOutboxMessages,
55
+ subscribeChatOutbox
56
+ };
57
+ //# sourceMappingURL=chat-outbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-outbox.js","sources":["../../src/offline/chat-outbox.ts"],"sourcesContent":["import {\n CHAT_OUTBOX_ASK_AFTER_MS,\n CHAT_OUTBOX_CLAIM_LEASE_MS,\n type ChatOutboxKeyPurpose,\n type ChatOutboxSignal,\n type ChatOutboxStore,\n createIndexedDbChatOutboxStore,\n} from '@athenaintel/agent-runtime';\n\n/**\n * Opt-in: messages typed while Athena can't be reached wait on this device, sealed with the host's\n * key, and are sent once Athena is back while the app is in front, after a countdown the person\n * can cancel (`@athenaintel/agent-runtime`'s chat outbox, shown at the top of the queue tray).\n * Without it a send goes to the transport as before.\n *\n * - `ownerId` names whose they are (the signed-in person, with the environment). Another owner's\n * messages are never shown or sent: each owner's are sealed under their own key.\n * - `getKey(purpose)` returns the AES-GCM key: `read` opens what is kept (the key if one exists,\n * never made for this), `write` keeps a new message (only while the deployment lets devices keep\n * copies). `null` keeps a new message in memory only, for as long as the page stays open. Unlike\n * the chat history's, this key guards the only copy of what someone wrote: a host must never\n * replace or drop it except at a sign-out the person chose.\n * - `reachability` says Athena can be reached: the host's own model (the device online AND agora\n * answering a health read, as Midas's main process decides it), by default the browser being\n * online. Either way a conversation whose own channel keeps failing to connect counts as out of\n * reach too.\n * - `foreground` says the app is in front; by default a visible document. A desktop host passes\n * `windowInFrontSignal()` (visible and focused).\n * - `openThread` opens another of the person's conversations the tray lists as holding waiting\n * messages (`newChat`: one that never started). Without it, a provider with a thread list\n * switches to it; otherwise the tray names it without Open.\n */\nexport interface AthenaChatOutbox {\n ownerId: string;\n getKey: (purpose: ChatOutboxKeyPurpose) => Promise<CryptoKey | null>;\n reachability?: ChatOutboxSignal;\n foreground?: ChatOutboxSignal;\n openThread?: (target: { threadId: string; newChat: boolean }) => void;\n}\n\ninterface OwnerStore {\n store: ChatOutboxStore;\n /** The latest host for this owner: the store asks it for the key. */\n host: { current: AthenaChatOutbox };\n}\n\n// process-local: one store per owner in this page, so every provider of the person (a chat in a\n// tab, another in a pane) shares one change bus and one memory of the messages this device could\n// not keep: a thread switch or a closed tab never loses them, and a sign-out counts them.\nconst ownerStores = new Map<string, OwnerStore>();\n\n/** A host that has no key to give (counting and deleting never need one). */\nfunction keylessHost(ownerId: string): AthenaChatOutbox {\n return { ownerId, getKey: async () => null };\n}\n\nfunction ownerStore(ownerId: string, host?: AthenaChatOutbox): ChatOutboxStore {\n let owner = ownerStores.get(ownerId);\n if (!owner) {\n const current = { current: host ?? keylessHost(ownerId) };\n owner = {\n host: current,\n store: createIndexedDbChatOutboxStore({\n ownerId,\n getKey: (_ownerId, purpose) => current.current.getKey(purpose),\n }),\n };\n ownerStores.set(ownerId, owner);\n }\n if (host) owner.host.current = host;\n return owner.store;\n}\n\n/** The page's chat outbox store for `host`'s owner, made on first use. */\nexport function chatOutboxStoreFor(host: AthenaChatOutbox): ChatOutboxStore {\n return ownerStore(host.ownerId, host);\n}\n\n/**\n * How many messages wait for `ownerId` (kept on the device, including records this build cannot\n * open, and waiting in this page's memory), counted without opening them. Rejects when the\n * device's records cannot be counted at all.\n */\nexport function countChatOutboxMessages(ownerId: string): Promise<number> {\n return ownerStore(ownerId).count();\n}\n\n/**\n * Calls `listener` after any change to `ownerId`'s waiting messages, this window's or another's\n * (one kept, handed to its conversation, cancelled, failed or retried), so a host can show how many\n * wait (`countChatOutboxMessages`) without asking on a timer. Returns what stops it.\n */\nexport function subscribeChatOutbox(ownerId: string, listener: () => void): () => void {\n return ownerStore(ownerId).subscribe(listener);\n}\n\n/** A message waiting in an owner's outbox, as a host lists it (its \"Waiting to sync\" list). */\nexport interface ChatOutboxMessageSummary {\n id: string;\n threadId: string;\n /** The text as it will be sent. */\n text: string;\n /** Typed into a chat that had never started. */\n newChat: boolean;\n /**\n * Where it stands, as the queue tray shows it: waiting to be sent, being handed to its\n * conversation now (a window's claim on it still holds), waiting for the person (it waited more\n * than a day: Send, Edit or Discard), or failed (Retry or Discard; never retried on its own).\n */\n status: 'waiting' | 'sending' | 'ask' | 'failed';\n /** Kept only in this page's memory: this device could not keep it. */\n inMemory: boolean;\n}\n\n/**\n * The messages waiting for `ownerId` that this page can open (oldest first), each with where it\n * stands, for a host's list of what waits to sync; the tray in the conversation acts on them.\n * Records this page cannot open (no key here, a newer build's) are left out, so a host counts with\n * `countChatOutboxMessages`.\n */\nexport async function listChatOutboxMessages(\n ownerId: string,\n now: number = Date.now(),\n): Promise<ChatOutboxMessageSummary[]> {\n const records = await ownerStore(ownerId).listAll();\n return records.map(({ entry, claim, failure, memoryOnly }) => ({\n id: entry.id,\n threadId: entry.threadId,\n text: entry.text,\n newChat: entry.newChat,\n status: failure\n ? 'failed'\n : claim && now - claim.at < CHAT_OUTBOX_CLAIM_LEASE_MS\n ? 'sending'\n : now - entry.queuedAt > CHAT_OUTBOX_ASK_AFTER_MS\n ? 'ask'\n : 'waiting',\n inMemory: memoryOnly === true,\n }));\n}\n\n/** A sign-out the person chose: every message waiting for `ownerId` goes, on the device and in memory. */\nexport function clearChatOutbox(ownerId: string): Promise<void> {\n return ownerStore(ownerId).clear();\n}\n\n/**\n * Deletes the records kept on this device for `ownerId`, never the messages waiting in this page's\n * memory: for a host whose key for them no longer exists (a chosen sign-out deleted it before the\n * page could delete the records), so nothing can ever open them and they must not be counted.\n */\nexport function clearUnopenableChatOutbox(ownerId: string): Promise<void> {\n return createIndexedDbChatOutboxStore({ ownerId, getKey: async () => null }).clear();\n}\n"],"names":[],"mappings":";;AAiDA,MAAM,kCAAkB,IAAA;AAGxB,SAAS,YAAY,SAAmC;AACtD,SAAO,EAAE,SAAS,QAAQ,YAAY,KAAA;AACxC;AAEA,SAAS,WAAW,SAAiB,MAA0C;AAC7E,MAAI,QAAQ,YAAY,IAAI,OAAO;AACnC,MAAI,CAAC,OAAO;AACV,UAAM,UAAU,EAAE,SAAS,QAAQ,YAAY,OAAO,EAAA;AACtD,YAAQ;AAAA,MACN,MAAM;AAAA,MACN,OAAO,+BAA+B;AAAA,QACpC;AAAA,QACA,QAAQ,CAAC,UAAU,YAAY,QAAQ,QAAQ,OAAO,OAAO;AAAA,MAAA,CAC9D;AAAA,IAAA;AAEH,gBAAY,IAAI,SAAS,KAAK;AAAA,EAChC;AACA,MAAI,KAAM,OAAM,KAAK,UAAU;AAC/B,SAAO,MAAM;AACf;AAGO,SAAS,mBAAmB,MAAyC;AAC1E,SAAO,WAAW,KAAK,SAAS,IAAI;AACtC;AAOO,SAAS,wBAAwB,SAAkC;AACxE,SAAO,WAAW,OAAO,EAAE,MAAA;AAC7B;AAOO,SAAS,oBAAoB,SAAiB,UAAkC;AACrF,SAAO,WAAW,OAAO,EAAE,UAAU,QAAQ;AAC/C;AA0BA,eAAsB,uBACpB,SACA,MAAc,KAAK,OACkB;AACrC,QAAM,UAAU,MAAM,WAAW,OAAO,EAAE,QAAA;AAC1C,SAAO,QAAQ,IAAI,CAAC,EAAE,OAAO,OAAO,SAAS,kBAAkB;AAAA,IAC7D,IAAI,MAAM;AAAA,IACV,UAAU,MAAM;AAAA,IAChB,MAAM,MAAM;AAAA,IACZ,SAAS,MAAM;AAAA,IACf,QAAQ,UACJ,WACA,SAAS,MAAM,MAAM,KAAK,6BACxB,YACA,MAAM,MAAM,WAAW,2BACrB,QACA;AAAA,IACR,UAAU,eAAe;AAAA,EAAA,EACzB;AACJ;AAGO,SAAS,gBAAgB,SAAgC;AAC9D,SAAO,WAAW,OAAO,EAAE,MAAA;AAC7B;AAOO,SAAS,0BAA0B,SAAgC;AACxE,SAAO,+BAA+B,EAAE,SAAS,QAAQ,YAAY,KAAA,CAAM,EAAE,MAAA;AAC/E;"}
@@ -1,4 +1,4 @@
1
- import type { DurableThreadSnapshotCache } from '@athenaintel/agent-runtime';
1
+ import type { DurableThreadSnapshotCache } from '../agent-runtime/src/index';
2
2
  import { type FC } from 'react';
3
3
  /**
4
4
  * Opt-in: keep the chat's recent conversations, and the session list, on this device, sealed with
@@ -4,6 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const react$1 = require("@assistant-ui/react");
5
5
  const react = require("react");
6
6
  const offlineHistory = require("../offline/offline-history.cjs");
7
+ const chatOutbox = require("../offline/chat-outbox.cjs");
7
8
  const athenaUrls = require("../lib/athena-urls.cjs");
8
9
  const mint = require("../collab/mint.cjs");
9
10
  const auth = require("../runtime/auth.cjs");
@@ -12,7 +13,10 @@ const AthenaCredentialSourceContext = require("../auth/AthenaCredentialSourceCon
12
13
  const credentialSource = require("../auth/credential-source.cjs");
13
14
  const authRefusalRestart = require("../runtime/auth-refusal-restart.cjs");
14
15
  const useAthenaStatewireRuntime = require("../runtime/useAthenaStatewireRuntime.cjs");
16
+ const statewireSessionKey = require("../runtime/statewire-session-key.cjs");
17
+ const statewireSessionLane = require("../runtime/statewire-session-lane.cjs");
15
18
  const statewireLifecycle = require("../runtime/statewire-lifecycle.cjs");
19
+ const credentialRenewal = require("../runtime/credential-renewal.cjs");
16
20
  const statewireRunConfig = require("../runtime/statewire-run-config.cjs");
17
21
  const statewireThreadConfigLane = require("../runtime/statewire-thread-config-lane.cjs");
18
22
  const mintThreadId = require("../threads/mint-thread-id.cjs");
@@ -40,9 +44,12 @@ const PostHogProvider = require("./PostHogProvider.cjs");
40
44
  const threadSnapshotMirror = require("../agent-runtime/src/thread-snapshot-mirror.cjs");
41
45
  const durableThreadSnapshotCache = require("../agent-runtime/src/durable-thread-snapshot-cache.cjs");
42
46
  const threadSnapshotCache = require("../agent-runtime/src/thread-snapshot-cache.cjs");
47
+ const chatOutboxAttachments = require("../agent-runtime/src/chat-outbox-attachments.cjs");
43
48
  const toolOutputs = require("../agent-runtime/src/tool-outputs.cjs");
44
49
  const threadStatus = require("../agent-runtime/src/thread-status.cjs");
50
+ const useDeepAgentChatOutbox = require("../agent-runtime/src/use-deep-agent-chat-outbox.cjs");
45
51
  const useDeepAgentConfig = require("../agent-runtime/src/use-deep-agent-config.cjs");
52
+ const chatOutboxSignals = require("../agent-runtime/src/chat-outbox-signals.cjs");
46
53
  const resolveTokenOverride = ({
47
54
  config,
48
55
  token
@@ -104,6 +111,7 @@ function ComposerHandoffDrain() {
104
111
  return null;
105
112
  }
106
113
  const EMPTY_MODES = [];
114
+ const CHAT_OUTBOX_ATTACHMENT_READ_TIMEOUT_MS = 1e4;
107
115
  function withEntry(record, key, value) {
108
116
  if (value === null) {
109
117
  if (!(key in record)) return record;
@@ -138,8 +146,12 @@ function AthenaStatewireRuntimeMount({
138
146
  appId,
139
147
  extraRunConfig,
140
148
  snapshotCache,
141
- toolOutputs: toolOutputs2
149
+ toolOutputs: toolOutputs2,
150
+ chatOutbox: chatOutbox2 = null,
151
+ sessionLane,
152
+ subagentLaneHistory
142
153
  }) {
154
+ const outboxRef = react.useRef(null);
143
155
  const [lifecycle, dispatchLifecycle] = react.useReducer(
144
156
  statewireLifecycle.statewireLifecycleReducer,
145
157
  statewireLifecycle.initialStatewireLifecycle
@@ -168,6 +180,7 @@ function AthenaStatewireRuntimeMount({
168
180
  extraRunConfig,
169
181
  snapshotCache,
170
182
  toolOutputs: toolOutputs2,
183
+ subagentLaneHistory,
171
184
  // The runtime already records every transport error on the diagnostics
172
185
  // bus (with the channel-teardown split), so this layer only maps it to
173
186
  // the banner notice.
@@ -181,6 +194,10 @@ function AthenaStatewireRuntimeMount({
181
194
  onRawConnectionChange: (connection) => {
182
195
  dispatchLifecycle({ type: "raw-connection", reconnect: connection.reconnect });
183
196
  },
197
+ onCommandChange: (update) => {
198
+ var _a;
199
+ return (_a = outboxRef.current) == null ? void 0 : _a.observeCommand(update);
200
+ },
184
201
  // The lane as the host holds it: anything that decides from the lane waits
185
202
  // for this, never the placeholder or remembered snapshot rendered before.
186
203
  onServerState: (state) => {
@@ -188,6 +205,64 @@ function AthenaStatewireRuntimeMount({
188
205
  setServerLane((previous) => statewireServerLaneContext.nextServerLane({ previous, config }));
189
206
  }
190
207
  });
208
+ const lanePending = statewireSessionKey.statewireSessionPrincipal(react.useContext(AthenaAuthContext.AthenaAuthContext)) === null;
209
+ react.useEffect(() => {
210
+ sessionLane.setPending(lanePending);
211
+ }, [sessionLane, lanePending]);
212
+ const connectionRef = react.useRef(lifecycle.connection);
213
+ connectionRef.current = lifecycle.connection;
214
+ const [connectionListeners] = react.useState(() => /* @__PURE__ */ new Set());
215
+ react.useEffect(() => {
216
+ for (const listener of connectionListeners) listener();
217
+ }, [lifecycle.connection, connectionListeners]);
218
+ const [channelReachability] = react.useState(() => ({
219
+ get: () => {
220
+ var _a;
221
+ return ((_a = connectionRef.current) == null ? void 0 : _a.status) !== "retrying";
222
+ },
223
+ subscribe: (listener) => {
224
+ connectionListeners.add(listener);
225
+ return () => {
226
+ connectionListeners.delete(listener);
227
+ };
228
+ }
229
+ }));
230
+ const [browserOnline] = react.useState(chatOutboxSignals.browserOnlineSignal);
231
+ const hostReachability = chatOutbox2 == null ? void 0 : chatOutbox2.reachability;
232
+ const reachability = react.useMemo(
233
+ () => chatOutboxSignals.allChatOutboxSignals(hostReachability ?? browserOnline, channelReachability),
234
+ [hostReachability, browserOnline, channelReachability]
235
+ );
236
+ const [defaultForeground] = react.useState(chatOutboxSignals.documentVisibleSignal);
237
+ const composerHandoff$1 = composerHandoff.useComposerHandoffStore();
238
+ const outbox = useDeepAgentChatOutbox.useDeepAgentChatOutbox({
239
+ client,
240
+ threadId,
241
+ isNewChat,
242
+ store: (chatOutbox2 == null ? void 0 : chatOutbox2.store) ?? null,
243
+ reachability,
244
+ foreground: (chatOutbox2 == null ? void 0 : chatOutbox2.foreground) ?? defaultForeground,
245
+ // Cancel and Edit give the draft back, after anything typed since. Its attachments come back
246
+ // as mentions in it, remembered so a message held again from it is asked about again.
247
+ restore: (entry) => {
248
+ const draft = entry.composerMarkdown ?? entry.text;
249
+ const current = client.composer.getState().text ?? "";
250
+ client.composer.setText(current.trim() ? `${current}
251
+
252
+ ${draft}` : draft);
253
+ if (composerHandoff$1 && entry.attachments) {
254
+ composerHandoff.rememberRestoredAttachments({
255
+ store: composerHandoff$1,
256
+ threadId,
257
+ attachments: entry.attachments
258
+ });
259
+ }
260
+ },
261
+ ...(chatOutbox2 == null ? void 0 : chatOutbox2.openThread) && { openThread: chatOutbox2.openThread },
262
+ ...(chatOutbox2 == null ? void 0 : chatOutbox2.checkAttachments) && { checkAttachments: chatOutbox2.checkAttachments },
263
+ enabled: chatOutbox2 !== null
264
+ });
265
+ outboxRef.current = outbox;
191
266
  authRefusalRestart.useRestartAfterAuthRefusal({
192
267
  connection: lifecycle.connection,
193
268
  reconnect: lifecycle.reconnect
@@ -221,9 +296,10 @@ function AthenaStatewireRuntimeMount({
221
296
  client,
222
297
  lifecycle: lifecycleValue,
223
298
  serverLane,
224
- threadConfig
299
+ threadConfig,
300
+ outbox
225
301
  }),
226
- [threadId, isNewChat, client, lifecycleValue, serverLane, threadConfig]
302
+ [threadId, isNewChat, client, lifecycleValue, serverLane, threadConfig, outbox]
227
303
  );
228
304
  react.useLayoutEffect(() => {
229
305
  onPublish(snapshot);
@@ -323,7 +399,7 @@ function AthenaStatewireStandalone({
323
399
  published.threadId
324
400
  ),
325
401
  /* @__PURE__ */ jsxRuntime.jsx(ComposerHandoffDrain, {}),
326
- /* @__PURE__ */ jsxRuntime.jsx(chatModeContext.AthenaChatModeSelectionContext.Provider, { value: chatModeSelection, children })
402
+ /* @__PURE__ */ jsxRuntime.jsx(useDeepAgentChatOutbox.DeepAgentChatOutboxContext.Provider, { value: published.outbox, children: /* @__PURE__ */ jsxRuntime.jsx(chatModeContext.AthenaChatModeSelectionContext.Provider, { value: chatModeSelection, children }) })
327
403
  ] }) }) }) }) }) }) }) }) });
328
404
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
329
405
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -392,15 +468,25 @@ function AthenaStatewireWithThreadList({
392
468
  }
393
469
  function AthenaStatewireActiveThreadHost({
394
470
  children,
471
+ chatOutbox: chatOutbox2,
395
472
  ...standaloneProps
396
473
  }) {
397
474
  const list = statewireThreadList.useAthenaStatewireThreadList();
475
+ const selectThread = list == null ? void 0 : list.selectThread;
476
+ const outboxHost = react.useMemo(
477
+ () => chatOutbox2 && !chatOutbox2.openThread && selectThread ? {
478
+ ...chatOutbox2,
479
+ openThread: ({ threadId, newChat }) => selectThread(threadId, { isNew: newChat })
480
+ } : chatOutbox2,
481
+ [chatOutbox2, selectThread]
482
+ );
398
483
  if (!list) return null;
399
484
  return /* @__PURE__ */ jsxRuntime.jsxs(
400
485
  AthenaStatewireStandalone,
401
486
  {
402
487
  threadId: list.activeThreadId,
403
488
  threadList: { isNewChat: list.isNewChat },
489
+ chatOutbox: outboxHost,
404
490
  ...standaloneProps,
405
491
  children: [
406
492
  /* @__PURE__ */ jsxRuntime.jsx(statewireThreadList.StatewireThreadTitlePoller, {}),
@@ -454,7 +540,9 @@ function AthenaProvider({
454
540
  debug,
455
541
  onDiagnostic,
456
542
  onError,
457
- offlineHistory: offlineHistory$1
543
+ offlineHistory: offlineHistory$1,
544
+ chatOutbox: chatOutbox$1,
545
+ subagentLaneHistory = false
458
546
  }) {
459
547
  var _a;
460
548
  const agentAssetId = statewireRunConfig.resolveAgentProp({ agent });
@@ -551,6 +639,50 @@ function AthenaProvider({
551
639
  const [snapshotCache] = react.useState(
552
640
  () => durableSnapshotCache ?? threadSnapshotCache.createDeepAgentThreadSnapshotCache()
553
641
  );
642
+ const chatOutboxRef = react.useRef(chatOutbox$1);
643
+ chatOutboxRef.current = chatOutbox$1;
644
+ const chatOutboxOwnerId = (chatOutbox$1 == null ? void 0 : chatOutbox$1.ownerId) ?? null;
645
+ const chatOutboxStore = react.useMemo(() => {
646
+ const host = chatOutboxRef.current;
647
+ return host && host.ownerId === chatOutboxOwnerId ? chatOutbox.chatOutboxStoreFor(host) : null;
648
+ }, [chatOutboxOwnerId]);
649
+ react.useEffect(() => {
650
+ if (chatOutbox$1) chatOutbox.chatOutboxStoreFor(chatOutbox$1);
651
+ }, [chatOutbox$1]);
652
+ const chatOutboxReachability = chatOutbox$1 == null ? void 0 : chatOutbox$1.reachability;
653
+ const chatOutboxForeground = chatOutbox$1 == null ? void 0 : chatOutbox$1.foreground;
654
+ const chatOutboxOpenThread = chatOutbox$1 == null ? void 0 : chatOutbox$1.openThread;
655
+ const outboxCheckAuthRef = react.useRef({});
656
+ const outboxCheckBackendRef = react.useRef("");
657
+ const [checkChatOutboxAttachments] = react.useState(
658
+ () => chatOutboxAttachments.createChatOutboxAttachmentCheck({
659
+ readAsset: (assetId) => credentialRenewal.sendWithCredentialRenewal(
660
+ outboxCheckAuthRef.current,
661
+ (headers) => fetch(`${outboxCheckBackendRef.current}${chatOutboxAttachments.chatOutboxAttachmentPath(assetId)}`, {
662
+ method: "GET",
663
+ headers,
664
+ signal: AbortSignal.timeout(CHAT_OUTBOX_ATTACHMENT_READ_TIMEOUT_MS)
665
+ })
666
+ )
667
+ })
668
+ );
669
+ const chatOutboxHost = react.useMemo(
670
+ () => chatOutboxOwnerId === null ? null : {
671
+ store: chatOutboxStore,
672
+ ...chatOutboxReachability && { reachability: chatOutboxReachability },
673
+ ...chatOutboxForeground && { foreground: chatOutboxForeground },
674
+ ...chatOutboxOpenThread && { openThread: chatOutboxOpenThread },
675
+ checkAttachments: checkChatOutboxAttachments
676
+ },
677
+ [
678
+ chatOutboxOwnerId,
679
+ chatOutboxStore,
680
+ chatOutboxReachability,
681
+ chatOutboxForeground,
682
+ chatOutboxOpenThread,
683
+ checkChatOutboxAttachments
684
+ ]
685
+ );
554
686
  const offlineOwnerId = (offlineHistory$1 == null ? void 0 : offlineHistory$1.ownerId) ?? null;
555
687
  const awaitingKeptSnapshots = offlineHistory.useKeptSnapshotsGate({
556
688
  cache: durableSnapshotCache,
@@ -575,8 +707,21 @@ function AthenaProvider({
575
707
  react.useEffect(() => {
576
708
  snapshotCache.clear();
577
709
  toolOutputs$1.clear();
578
- composerHandoff.clearComposerHandoff({ store: composerHandoff$1, reason: "the signed-in identity changed" });
579
- }, [snapshotCache, toolOutputs$1, composerHandoff$1, principal, configuredApiKey]);
710
+ }, [snapshotCache, toolOutputs$1, principal, configuredApiKey]);
711
+ const sessionPrincipal = statewireSessionKey.statewireSessionPrincipal(authContext);
712
+ const [sessionLane] = react.useState(
713
+ () => statewireSessionLane.createStatewireSessionLaneGate({ pending: sessionPrincipal === null })
714
+ );
715
+ const handoffIdentityRef = react.useRef(null);
716
+ react.useEffect(() => {
717
+ if (sessionPrincipal === null) return;
718
+ const identity = JSON.stringify([sessionPrincipal, configuredApiKey ?? null]);
719
+ const previous = handoffIdentityRef.current;
720
+ handoffIdentityRef.current = identity;
721
+ if (previous !== null && previous !== identity) {
722
+ composerHandoff.clearComposerHandoff({ store: composerHandoff$1, reason: "the signed-in identity changed" });
723
+ }
724
+ }, [composerHandoff$1, sessionPrincipal, configuredApiKey]);
580
725
  react.useEffect(
581
726
  () => () => composerHandoff.clearComposerHandoff({ store: composerHandoff$1, reason: "the chat provider unmounted" }),
582
727
  [composerHandoff$1]
@@ -600,6 +745,12 @@ function AthenaProvider({
600
745
  const effectiveBackendUrl = mint.getAthenaApiBaseUrl(
601
746
  configuredBackendUrl ?? bridge.backendBaseUrl ?? environmentUrls.backendUrl
602
747
  );
748
+ outboxCheckBackendRef.current = effectiveBackendUrl;
749
+ outboxCheckAuthRef.current = {
750
+ apiKey: configuredApiKey,
751
+ token: effectiveToken,
752
+ getToken: credentialGetToken
753
+ };
603
754
  const hostStatewireSyncUrl = configuredStatewireSyncUrl ?? bridge.statewireSyncUrl ?? void 0;
604
755
  const effectiveAppUrl = configuredAppUrl ?? bridge.appUrl ?? athenaUrls.deriveAthenaAppUrl({ apiUrl: effectiveApiUrl, backendUrl: effectiveBackendUrl }) ?? environmentUrls.appUrl;
605
756
  if (!bridge.ready) {
@@ -640,6 +791,9 @@ function AthenaProvider({
640
791
  snapshotCache,
641
792
  toolOutputs: toolOutputs$1,
642
793
  historyStore,
794
+ chatOutbox: chatOutboxHost,
795
+ sessionLane,
796
+ subagentLaneHistory,
643
797
  linkClicks,
644
798
  citationLinks
645
799
  };
@@ -672,7 +826,7 @@ function AthenaProvider({
672
826
  {
673
827
  className: themeStyleVars ? "athena-sdk athena-themed" : "athena-sdk",
674
828
  style: themeStyleVars,
675
- children: /* @__PURE__ */ jsxRuntime.jsx(PostHogProvider.PostHogProvider, { config: posthogConfig, children: /* @__PURE__ */ jsxRuntime.jsx(composerHandoff.ComposerHandoffContext.Provider, { value: composerHandoff$1, children: /* @__PURE__ */ jsxRuntime.jsx(themeStyleContext.AthenaThemeStyleContext.Provider, { value: themeStyleVars, children: /* @__PURE__ */ jsxRuntime.jsx(AthenaCredentialSourceContext.AthenaCredentialSourceContext.Provider, { value: credentials, children: /* @__PURE__ */ jsxRuntime.jsx(agentSelectionContext.AthenaAgentSelectionContext.Provider, { value: agentSelection, children: /* @__PURE__ */ jsxRuntime.jsx(offlineHistory.AthenaOfflineSnapshotsContext.Provider, { value: offlineSnapshots, children: awaitingKeptSnapshots ? null : inner }) }) }) }) }) })
829
+ children: /* @__PURE__ */ jsxRuntime.jsx(PostHogProvider.PostHogProvider, { config: posthogConfig, children: /* @__PURE__ */ jsxRuntime.jsx(composerHandoff.ComposerHandoffContext.Provider, { value: composerHandoff$1, children: /* @__PURE__ */ jsxRuntime.jsx(statewireSessionLane.StatewireSessionLaneContext.Provider, { value: sessionLane, children: /* @__PURE__ */ jsxRuntime.jsx(themeStyleContext.AthenaThemeStyleContext.Provider, { value: themeStyleVars, children: /* @__PURE__ */ jsxRuntime.jsx(AthenaCredentialSourceContext.AthenaCredentialSourceContext.Provider, { value: credentials, children: /* @__PURE__ */ jsxRuntime.jsx(agentSelectionContext.AthenaAgentSelectionContext.Provider, { value: agentSelection, children: /* @__PURE__ */ jsxRuntime.jsx(offlineHistory.AthenaOfflineSnapshotsContext.Provider, { value: offlineSnapshots, children: awaitingKeptSnapshots ? null : inner }) }) }) }) }) }) })
676
830
  }
677
831
  );
678
832
  }