@athenaintel/react 0.41.2 → 0.42.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (451) hide show
  1. package/README.md +108 -9
  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.cjs +158 -0
  48. package/dist/agent-runtime/src/durable-thread-snapshot-cache.cjs.map +1 -0
  49. package/dist/agent-runtime/src/durable-thread-snapshot-cache.d.ts +60 -0
  50. package/dist/agent-runtime/src/durable-thread-snapshot-cache.js +158 -0
  51. package/dist/agent-runtime/src/durable-thread-snapshot-cache.js.map +1 -0
  52. package/dist/agent-runtime/src/edit-command.d.ts +156 -0
  53. package/dist/agent-runtime/src/errors.d.ts +174 -0
  54. package/dist/agent-runtime/src/execute-output.d.ts +31 -0
  55. package/dist/agent-runtime/src/generated/runconfig-contract.cjs +16 -2
  56. package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
  57. package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +202 -0
  58. package/dist/agent-runtime/src/generated/runconfig-contract.js +16 -2
  59. package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
  60. package/dist/agent-runtime/src/github-wake-event.d.ts +77 -0
  61. package/dist/agent-runtime/src/index.d.ts +74 -0
  62. package/dist/agent-runtime/src/interrupts.cjs +17 -0
  63. package/dist/agent-runtime/src/interrupts.cjs.map +1 -1
  64. package/dist/agent-runtime/src/interrupts.d.ts +348 -0
  65. package/dist/agent-runtime/src/interrupts.js +17 -0
  66. package/dist/agent-runtime/src/interrupts.js.map +1 -1
  67. package/dist/agent-runtime/src/lane-follow.d.ts +121 -0
  68. package/dist/agent-runtime/src/lane-history.cjs +209 -0
  69. package/dist/agent-runtime/src/lane-history.cjs.map +1 -0
  70. package/dist/agent-runtime/src/lane-history.d.ts +175 -0
  71. package/dist/agent-runtime/src/lane-history.js +209 -0
  72. package/dist/agent-runtime/src/lane-history.js.map +1 -0
  73. package/dist/agent-runtime/src/lane-images.d.ts +184 -0
  74. package/dist/agent-runtime/src/message-author.d.ts +43 -0
  75. package/dist/agent-runtime/src/message-text.cjs +15 -0
  76. package/dist/agent-runtime/src/message-text.cjs.map +1 -0
  77. package/dist/agent-runtime/src/message-text.d.ts +47 -0
  78. package/dist/agent-runtime/src/message-text.js +15 -0
  79. package/dist/agent-runtime/src/message-text.js.map +1 -0
  80. package/dist/agent-runtime/src/message-window.cjs +15 -1
  81. package/dist/agent-runtime/src/message-window.cjs.map +1 -1
  82. package/dist/agent-runtime/src/message-window.d.ts +159 -0
  83. package/dist/agent-runtime/src/message-window.js +16 -2
  84. package/dist/agent-runtime/src/message-window.js.map +1 -1
  85. package/dist/agent-runtime/src/messages.cjs +88 -4
  86. package/dist/agent-runtime/src/messages.cjs.map +1 -1
  87. package/dist/agent-runtime/src/messages.d.ts +603 -0
  88. package/dist/agent-runtime/src/messages.js +88 -4
  89. package/dist/agent-runtime/src/messages.js.map +1 -1
  90. package/dist/agent-runtime/src/model-context.d.ts +22 -0
  91. package/dist/agent-runtime/src/offline-status.d.ts +157 -0
  92. package/dist/agent-runtime/src/optimistic-content.d.ts +21 -0
  93. package/dist/agent-runtime/src/protocol.cjs +12 -4
  94. package/dist/agent-runtime/src/protocol.cjs.map +1 -1
  95. package/dist/agent-runtime/src/protocol.d.ts +119 -0
  96. package/dist/agent-runtime/src/protocol.js +13 -5
  97. package/dist/agent-runtime/src/protocol.js.map +1 -1
  98. package/dist/agent-runtime/src/ptc-subcalls.d.ts +51 -0
  99. package/dist/agent-runtime/src/queue.d.ts +138 -0
  100. package/dist/agent-runtime/src/quota-safe-local-storage-session.d.ts +154 -0
  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/statewire-attach-observer.d.ts +194 -0
  115. package/dist/agent-runtime/src/statewire-diagnostics.d.ts +74 -0
  116. package/dist/agent-runtime/src/statewire-state.d.ts +29 -0
  117. package/dist/agent-runtime/src/statewire-suspended.cjs.map +1 -1
  118. package/dist/agent-runtime/src/statewire-suspended.d.ts +27 -0
  119. package/dist/agent-runtime/src/statewire-suspended.js.map +1 -1
  120. package/dist/agent-runtime/src/statewire-transport.d.ts +40 -0
  121. package/dist/agent-runtime/src/streaming-markdown.d.ts +46 -0
  122. package/dist/agent-runtime/src/subagent-transcripts.cjs +209 -0
  123. package/dist/agent-runtime/src/subagent-transcripts.cjs.map +1 -0
  124. package/dist/agent-runtime/src/subagent-transcripts.d.ts +71 -0
  125. package/dist/agent-runtime/src/subagent-transcripts.js +209 -0
  126. package/dist/agent-runtime/src/subagent-transcripts.js.map +1 -0
  127. package/dist/agent-runtime/src/subagents.cjs +253 -0
  128. package/dist/agent-runtime/src/subagents.cjs.map +1 -0
  129. package/dist/agent-runtime/src/subagents.d.ts +311 -0
  130. package/dist/agent-runtime/src/subagents.js +253 -0
  131. package/dist/agent-runtime/src/subagents.js.map +1 -0
  132. package/dist/agent-runtime/src/subscription-wake-event.d.ts +111 -0
  133. package/dist/agent-runtime/src/thread-extras.d.ts +43 -0
  134. package/dist/agent-runtime/src/thread-handoff.d.ts +364 -0
  135. package/dist/agent-runtime/src/thread-prewarm-controller.d.ts +76 -0
  136. package/dist/agent-runtime/src/thread-prewarm.d.ts +118 -0
  137. package/dist/agent-runtime/src/thread-snapshot-cache.d.ts +99 -0
  138. package/dist/agent-runtime/src/thread-snapshot-mirror.cjs +329 -0
  139. package/dist/agent-runtime/src/thread-snapshot-mirror.cjs.map +1 -0
  140. package/dist/agent-runtime/src/thread-snapshot-mirror.d.ts +101 -0
  141. package/dist/agent-runtime/src/thread-snapshot-mirror.js +329 -0
  142. package/dist/agent-runtime/src/thread-snapshot-mirror.js.map +1 -0
  143. package/dist/agent-runtime/src/thread-status.d.ts +53 -0
  144. package/dist/agent-runtime/src/tool-metadata.d.ts +146 -0
  145. package/dist/agent-runtime/src/tool-names.cjs +67 -0
  146. package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
  147. package/dist/agent-runtime/src/tool-names.d.ts +60 -0
  148. package/dist/agent-runtime/src/tool-names.js +68 -1
  149. package/dist/agent-runtime/src/tool-names.js.map +1 -1
  150. package/dist/agent-runtime/src/tool-outputs.d.ts +35 -0
  151. package/dist/agent-runtime/src/tool-result.cjs +1 -0
  152. package/dist/agent-runtime/src/tool-result.cjs.map +1 -1
  153. package/dist/agent-runtime/src/tool-result.d.ts +126 -0
  154. package/dist/agent-runtime/src/tool-result.js +1 -0
  155. package/dist/agent-runtime/src/tool-result.js.map +1 -1
  156. package/dist/agent-runtime/src/types.d.ts +159 -0
  157. package/dist/agent-runtime/src/use-conversation-list.d.ts +76 -0
  158. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +136 -0
  159. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -0
  160. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +64 -0
  161. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +136 -0
  162. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -0
  163. package/dist/agent-runtime/src/use-deep-agent-config.d.ts +169 -0
  164. package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs +13 -0
  165. package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
  166. package/dist/agent-runtime/src/use-deep-agent-edit-submit.d.ts +22 -0
  167. package/dist/agent-runtime/src/use-deep-agent-edit-submit.js +13 -0
  168. package/dist/agent-runtime/src/use-deep-agent-edit-submit.js.map +1 -1
  169. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +20 -2
  170. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
  171. package/dist/agent-runtime/src/use-deep-agent-runtime.d.ts +168 -0
  172. package/dist/agent-runtime/src/use-deep-agent-runtime.js +20 -2
  173. package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
  174. package/dist/agent-runtime/src/use-deep-agent-thread.cjs +12 -4
  175. package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
  176. package/dist/agent-runtime/src/use-deep-agent-thread.d.ts +320 -0
  177. package/dist/agent-runtime/src/use-deep-agent-thread.js +12 -4
  178. package/dist/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
  179. package/dist/agent-runtime/src/use-deep-agent-voice.cjs +999 -0
  180. package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -0
  181. package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +409 -0
  182. package/dist/agent-runtime/src/use-deep-agent-voice.js +999 -0
  183. package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -0
  184. package/dist/agent-runtime/src/use-deep-agent-window-sync.d.ts +102 -0
  185. package/dist/agent-runtime/src/use-historical-edit-attachments.d.ts +2 -0
  186. package/dist/agent-runtime/src/use-thread-handoff-flow.d.ts +84 -0
  187. package/dist/agent-runtime/src/voice-presentation.d.ts +80 -0
  188. package/dist/agent-runtime/src/voice-turn-grouping.d.ts +28 -0
  189. package/dist/agent-runtime/src/voice-wire-types.d.ts +15 -0
  190. package/dist/agent-runtime/src/withdrawn-turns.d.ts +97 -0
  191. package/dist/chat/AthenaChat.cjs +77 -6
  192. package/dist/chat/AthenaChat.cjs.map +1 -1
  193. package/dist/chat/AthenaChat.js +78 -7
  194. package/dist/chat/AthenaChat.js.map +1 -1
  195. package/dist/chat/StatewireApprovalCard.d.ts +1 -1
  196. package/dist/chat/StatewireClientToolBridge.d.ts +1 -1
  197. package/dist/chat/StatewireQueuedMessages.cjs +11 -4
  198. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
  199. package/dist/chat/StatewireQueuedMessages.d.ts +1 -1
  200. package/dist/chat/StatewireQueuedMessages.js +11 -4
  201. package/dist/chat/StatewireQueuedMessages.js.map +1 -1
  202. package/dist/chat/chat-outbox-rows.cjs +223 -0
  203. package/dist/chat/chat-outbox-rows.cjs.map +1 -0
  204. package/dist/chat/chat-outbox-rows.d.ts +29 -0
  205. package/dist/chat/chat-outbox-rows.js +223 -0
  206. package/dist/chat/chat-outbox-rows.js.map +1 -0
  207. package/dist/chat/statewire-approval.d.ts +1 -1
  208. package/dist/chat/statewire-client-tools.d.ts +1 -1
  209. package/dist/chat/super-grouping/SuperGroupingCard.cjs +3 -1
  210. package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
  211. package/dist/chat/super-grouping/SuperGroupingCard.d.ts +7 -1
  212. package/dist/chat/super-grouping/SuperGroupingCard.js +3 -1
  213. package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
  214. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +7 -2
  215. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -1
  216. package/dist/chat/super-grouping/SuperGroupingTranscript.d.ts +2 -2
  217. package/dist/chat/super-grouping/SuperGroupingTranscript.js +7 -2
  218. package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -1
  219. package/dist/chat/super-grouping/activity-timeline.cjs +19 -11
  220. package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
  221. package/dist/chat/super-grouping/activity-timeline.d.ts +25 -9
  222. package/dist/chat/super-grouping/activity-timeline.js +19 -11
  223. package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
  224. package/dist/chat/use-statewire-approval-request.cjs +36 -0
  225. package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
  226. package/dist/chat/use-statewire-approval-request.d.ts +49 -1
  227. package/dist/chat/use-statewire-approval-request.js +39 -3
  228. package/dist/chat/use-statewire-approval-request.js.map +1 -1
  229. package/dist/chat-ui/composer/tiptap-composer.cjs +102 -3
  230. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
  231. package/dist/chat-ui/composer/tiptap-composer.d.ts +32 -1
  232. package/dist/chat-ui/composer/tiptap-composer.js +103 -4
  233. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
  234. package/dist/chat-ui/header/conversation-history-panel.d.ts +1 -1
  235. package/dist/chat-ui/index.d.ts +1 -1
  236. package/dist/chat-ui/messages/message-components.cjs +15 -0
  237. package/dist/chat-ui/messages/message-components.cjs.map +1 -1
  238. package/dist/chat-ui/messages/message-components.js +15 -0
  239. package/dist/chat-ui/messages/message-components.js.map +1 -1
  240. package/dist/chat-ui/messages/runtime-message.d.ts +1 -1
  241. package/dist/chat-ui/messages/statewire-continue-run.d.ts +1 -1
  242. package/dist/chat-ui/messages/user-edit-composer.cjs +15 -2
  243. package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
  244. package/dist/chat-ui/messages/user-edit-composer.d.ts +4 -2
  245. package/dist/chat-ui/messages/user-edit-composer.js +15 -2
  246. package/dist/chat-ui/messages/user-edit-composer.js.map +1 -1
  247. package/dist/chat-ui/messages/wake-marker.d.ts +1 -1
  248. package/dist/chat-ui/rich-text/chat-text-schema.cjs +1 -0
  249. package/dist/chat-ui/rich-text/chat-text-schema.cjs.map +1 -1
  250. package/dist/chat-ui/rich-text/chat-text-schema.d.ts +3 -0
  251. package/dist/chat-ui/rich-text/chat-text-schema.js +1 -0
  252. package/dist/chat-ui/rich-text/chat-text-schema.js.map +1 -1
  253. package/dist/chat-ui/statewire.cjs +1 -0
  254. package/dist/chat-ui/statewire.cjs.map +1 -1
  255. package/dist/chat-ui/statewire.d.ts +2 -2
  256. package/dist/chat-ui/statewire.js +2 -1
  257. package/dist/chat-ui/thread/statewire-history-edge.d.ts +1 -1
  258. package/dist/composer/AttachmentContext.cjs +8 -4
  259. package/dist/composer/AttachmentContext.cjs.map +1 -1
  260. package/dist/composer/AttachmentContext.d.ts +7 -0
  261. package/dist/composer/AttachmentContext.js +8 -4
  262. package/dist/composer/AttachmentContext.js.map +1 -1
  263. package/dist/composer/build-composed-message.cjs +34 -0
  264. package/dist/composer/build-composed-message.cjs.map +1 -1
  265. package/dist/composer/build-composed-message.d.ts +20 -0
  266. package/dist/composer/build-composed-message.js +35 -1
  267. package/dist/composer/build-composed-message.js.map +1 -1
  268. package/dist/composer/composer-handoff.cjs +39 -2
  269. package/dist/composer/composer-handoff.cjs.map +1 -1
  270. package/dist/composer/composer-handoff.d.ts +28 -3
  271. package/dist/composer/composer-handoff.js +39 -2
  272. package/dist/composer/composer-handoff.js.map +1 -1
  273. package/dist/composer/useAttachFiles.cjs +15 -2
  274. package/dist/composer/useAttachFiles.cjs.map +1 -1
  275. package/dist/composer/useAttachFiles.d.ts +11 -0
  276. package/dist/composer/useAttachFiles.js +15 -2
  277. package/dist/composer/useAttachFiles.js.map +1 -1
  278. package/dist/composer/useSendMessage.cjs.map +1 -1
  279. package/dist/composer/useSendMessage.d.ts +4 -3
  280. package/dist/composer/useSendMessage.js.map +1 -1
  281. package/dist/diagnostics/athena-diagnostics.cjs.map +1 -1
  282. package/dist/diagnostics/athena-diagnostics.d.ts +3 -1
  283. package/dist/diagnostics/athena-diagnostics.js.map +1 -1
  284. package/dist/index.cjs +18 -0
  285. package/dist/index.cjs.map +1 -1
  286. package/dist/index.d.ts +15 -6
  287. package/dist/index.js +19 -1
  288. package/dist/index.js.map +1 -1
  289. package/dist/offline/chat-outbox.cjs +57 -0
  290. package/dist/offline/chat-outbox.cjs.map +1 -0
  291. package/dist/offline/chat-outbox.d.ts +80 -0
  292. package/dist/offline/chat-outbox.js +57 -0
  293. package/dist/offline/chat-outbox.js.map +1 -0
  294. package/dist/offline/offline-history.cjs +77 -0
  295. package/dist/offline/offline-history.cjs.map +1 -0
  296. package/dist/offline/offline-history.d.ts +60 -0
  297. package/dist/offline/offline-history.js +77 -0
  298. package/dist/offline/offline-history.js.map +1 -0
  299. package/dist/provider/AthenaProvider.cjs +206 -9
  300. package/dist/provider/AthenaProvider.cjs.map +1 -1
  301. package/dist/provider/AthenaProvider.d.ts +22 -1
  302. package/dist/provider/AthenaProvider.js +207 -10
  303. package/dist/provider/AthenaProvider.js.map +1 -1
  304. package/dist/provider/statewire-window-context.d.ts +1 -1
  305. package/dist/react/package.json.cjs +1 -1
  306. package/dist/react/package.json.js +1 -1
  307. package/dist/references/src/anchors/file-line-range.d.ts +58 -0
  308. package/dist/references/src/anchors/format.d.ts +21 -0
  309. package/dist/references/src/anchors/message-anchors.d.ts +71 -0
  310. package/dist/references/src/anchors/parse.d.ts +8 -0
  311. package/dist/references/src/anchors/registry-contract.d.ts +24 -0
  312. package/dist/references/src/anchors/registry.d.ts +19 -0
  313. package/dist/references/src/anchors/schemas.d.ts +194 -0
  314. package/dist/references/src/anchors/serialize.d.ts +8 -0
  315. package/dist/references/src/anchors/time.d.ts +78 -0
  316. package/dist/references/src/anchors/types.d.ts +474 -0
  317. package/dist/references/src/asset-bounds.d.ts +27 -0
  318. package/dist/references/src/asset-links.d.ts +23 -0
  319. package/dist/references/src/asset-reference.d.ts +16 -0
  320. package/dist/references/src/formats/format-catalog.d.ts +79 -0
  321. package/dist/references/src/formats/markdown/parse-reference-markdown.d.ts +28 -0
  322. package/dist/references/src/formats/markdown/reference-display-name.d.ts +6 -0
  323. package/dist/references/src/formats/object/asset-object.d.ts +9 -0
  324. package/dist/references/src/formats/object/callable-object.d.ts +6 -0
  325. package/dist/references/src/formats/object/decode-reference-object-payload.d.ts +3 -0
  326. package/dist/references/src/formats/object/external-url-object.d.ts +9 -0
  327. package/dist/references/src/formats/object/group-object.d.ts +9 -0
  328. package/dist/references/src/formats/object/navigation-object.d.ts +9 -0
  329. package/dist/references/src/formats/object/parse-reference-object.d.ts +11 -0
  330. package/dist/references/src/formats/object/person-object.d.ts +9 -0
  331. package/dist/references/src/formats/uri/asset-mention-uri.d.ts +9 -0
  332. package/dist/references/src/formats/uri/asset-spaces-url.d.ts +9 -0
  333. package/dist/references/src/formats/uri/callable-mention-uris.d.ts +9 -0
  334. package/dist/references/src/formats/uri/detect-uri-wire.d.ts +9 -0
  335. package/dist/references/src/formats/uri/group-mention-uri.d.ts +12 -0
  336. package/dist/references/src/formats/uri/navigation-spaces-url.d.ts +14 -0
  337. package/dist/references/src/formats/uri/parse-reference-uri.d.ts +20 -0
  338. package/dist/references/src/formats/uri/person-mention-uri.d.ts +9 -0
  339. package/dist/references/src/formats/uri/template-placeholder.d.ts +12 -0
  340. package/dist/references/src/index.d.ts +47 -0
  341. package/dist/references/src/legacy/index.d.ts +14 -0
  342. package/dist/references/src/legacy/pre-reference-asset-url.d.ts +57 -0
  343. package/dist/references/src/legacy/pre-reference-citation-bridge.d.ts +22 -0
  344. package/dist/references/src/legacy/pre-reference-citation.d.ts +138 -0
  345. package/dist/references/src/legacy/pre-reference-external-url.d.ts +31 -0
  346. package/dist/references/src/legacy/pre-reference-format.d.ts +8 -0
  347. package/dist/references/src/legacy/pre-reference-mention.d.ts +27 -0
  348. package/dist/references/src/legacy/pre-reference-object.d.ts +8 -0
  349. package/dist/references/src/legacy/pre-reference-uri.d.ts +12 -0
  350. package/dist/references/src/legacy.d.ts +2 -0
  351. package/dist/references/src/mention-href-patterns.d.ts +19 -0
  352. package/dist/references/src/mention-node/index.d.ts +5 -0
  353. package/dist/references/src/mention-node/mention-node.d.ts +31 -0
  354. package/dist/references/src/mention-node/resolve-node-attrs.d.ts +27 -0
  355. package/dist/references/src/parse-reference.d.ts +23 -0
  356. package/dist/references/src/schemas.d.ts +463 -0
  357. package/dist/references/src/serialize-reference.d.ts +50 -0
  358. package/dist/references/src/sheet-name.d.ts +10 -0
  359. package/dist/references/src/tool-option-schemas.d.ts +597 -0
  360. package/dist/references/src/types.d.ts +125 -0
  361. package/dist/references/src/version-ref.d.ts +30 -0
  362. package/dist/runtime/statewire-lifecycle.d.ts +1 -1
  363. package/dist/runtime/statewire-model-lane.d.ts +1 -1
  364. package/dist/runtime/statewire-server-lane-context.d.ts +1 -1
  365. package/dist/runtime/statewire-session-key.cjs +7 -0
  366. package/dist/runtime/statewire-session-key.cjs.map +1 -1
  367. package/dist/runtime/statewire-session-key.d.ts +16 -0
  368. package/dist/runtime/statewire-session-key.js +8 -1
  369. package/dist/runtime/statewire-session-key.js.map +1 -1
  370. package/dist/runtime/statewire-session-lane.cjs +48 -0
  371. package/dist/runtime/statewire-session-lane.cjs.map +1 -0
  372. package/dist/runtime/statewire-session-lane.d.ts +29 -0
  373. package/dist/runtime/statewire-session-lane.js +48 -0
  374. package/dist/runtime/statewire-session-lane.js.map +1 -0
  375. package/dist/runtime/statewire-thread-config-lane.d.ts +1 -1
  376. package/dist/runtime/useAthenaStatewireRuntime.cjs +16 -5
  377. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
  378. package/dist/runtime/useAthenaStatewireRuntime.d.ts +15 -1
  379. package/dist/runtime/useAthenaStatewireRuntime.js +17 -6
  380. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
  381. package/dist/styles.css +1 -1
  382. package/dist/threads/api.d.ts +1 -1
  383. package/dist/threads/conversation-list-fetcher.d.ts +1 -1
  384. package/dist/threads/index-triggered-refresh.cjs +164 -0
  385. package/dist/threads/index-triggered-refresh.cjs.map +1 -0
  386. package/dist/threads/index-triggered-refresh.d.ts +70 -0
  387. package/dist/threads/index-triggered-refresh.js +164 -0
  388. package/dist/threads/index-triggered-refresh.js.map +1 -0
  389. package/dist/threads/offline-session-list.cjs +75 -0
  390. package/dist/threads/offline-session-list.cjs.map +1 -0
  391. package/dist/threads/offline-session-list.d.ts +27 -0
  392. package/dist/threads/offline-session-list.js +75 -0
  393. package/dist/threads/offline-session-list.js.map +1 -0
  394. package/dist/threads/pull-request-display.d.ts +1 -1
  395. package/dist/threads/session-list-model.d.ts +1 -1
  396. package/dist/threads/session-list-tab-share.cjs +150 -0
  397. package/dist/threads/session-list-tab-share.cjs.map +1 -0
  398. package/dist/threads/session-list-tab-share.d.ts +73 -0
  399. package/dist/threads/session-list-tab-share.js +150 -0
  400. package/dist/threads/session-list-tab-share.js.map +1 -0
  401. package/dist/threads/session-row-parts.d.ts +1 -1
  402. package/dist/threads/sessions-query.d.ts +1 -1
  403. package/dist/threads/statewire-thread-list.cjs +105 -20
  404. package/dist/threads/statewire-thread-list.cjs.map +1 -1
  405. package/dist/threads/statewire-thread-list.d.ts +31 -3
  406. package/dist/threads/statewire-thread-list.js +107 -22
  407. package/dist/threads/statewire-thread-list.js.map +1 -1
  408. package/dist/threads/thread-prefetcher.d.ts +1 -1
  409. package/dist/threads/use-athena-session-attention.d.ts +1 -1
  410. package/dist/threads/use-athena-sessions.cjs +32 -22
  411. package/dist/threads/use-athena-sessions.cjs.map +1 -1
  412. package/dist/threads/use-athena-sessions.js +33 -23
  413. package/dist/threads/use-athena-sessions.js.map +1 -1
  414. package/dist/threads/use-rest-conversation-history.d.ts +1 -1
  415. package/dist/threads/use-statewire-conversation-history.d.ts +5 -5
  416. package/dist/tiptap-markdown-table/src/markdown-table-serializer.d.ts +56 -0
  417. package/dist/tools/NestedPtcMessages.cjs +14 -9
  418. package/dist/tools/NestedPtcMessages.cjs.map +1 -1
  419. package/dist/tools/NestedPtcMessages.d.ts +9 -0
  420. package/dist/tools/NestedPtcMessages.js +6 -1
  421. package/dist/tools/NestedPtcMessages.js.map +1 -1
  422. package/dist/tools/index.d.ts +1 -1
  423. package/dist/tools/primitives.d.ts +1 -1
  424. package/dist/tools/subagent-task-tool-ui.cjs +494 -0
  425. package/dist/tools/subagent-task-tool-ui.cjs.map +1 -0
  426. package/dist/tools/subagent-task-tool-ui.d.ts +109 -0
  427. package/dist/tools/subagent-task-tool-ui.js +494 -0
  428. package/dist/tools/subagent-task-tool-ui.js.map +1 -0
  429. package/dist/tools/tool-fallback.d.ts +1 -1
  430. package/dist/tools/tool-icons.d.ts +1 -1
  431. package/dist/tools/tool-summary.d.ts +1 -1
  432. package/dist/tools/tool-uis.cjs +4 -0
  433. package/dist/tools/tool-uis.cjs.map +1 -1
  434. package/dist/tools/tool-uis.js +4 -0
  435. package/dist/tools/tool-uis.js.map +1 -1
  436. package/dist/voice/chat.cjs +6 -0
  437. package/dist/voice/chat.cjs.map +1 -0
  438. package/dist/voice/chat.d.ts +2 -0
  439. package/dist/voice/chat.js +6 -0
  440. package/dist/voice/chat.js.map +1 -0
  441. package/dist/voice/livekit-join.cjs +119 -0
  442. package/dist/voice/livekit-join.cjs.map +1 -0
  443. package/dist/voice/livekit-join.d.ts +8 -0
  444. package/dist/voice/livekit-join.js +119 -0
  445. package/dist/voice/livekit-join.js.map +1 -0
  446. package/dist/voice/livekit.cjs +32 -0
  447. package/dist/voice/livekit.cjs.map +1 -0
  448. package/dist/voice/livekit.d.ts +80 -0
  449. package/dist/voice/livekit.js +32 -0
  450. package/dist/voice/livekit.js.map +1 -0
  451. package/package.json +20 -10
@@ -0,0 +1,77 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { CloudOffIcon } from "lucide-react";
3
+ import { useContext, useSyncExternalStore, useState, useEffect, createContext } from "react";
4
+ import { useAthenaThreadId } from "../threads/thread-id-context.js";
5
+ import { cn } from "cnfast";
6
+ const OFFLINE_SNAPSHOT_READ_WAIT_MS = 1500;
7
+ function useKeptSnapshotsGate({
8
+ cache,
9
+ ownerId,
10
+ isOffline,
11
+ waitMs = OFFLINE_SNAPSHOT_READ_WAIT_MS
12
+ }) {
13
+ const [readFor, setReadFor] = useState(void 0);
14
+ useEffect(() => {
15
+ if (!cache) return;
16
+ let live = true;
17
+ const settle = () => {
18
+ if (live) setReadFor(ownerId);
19
+ };
20
+ const timer = setTimeout(settle, waitMs);
21
+ const done = () => {
22
+ clearTimeout(timer);
23
+ settle();
24
+ };
25
+ void cache.setOwner(ownerId).then(done, done);
26
+ return () => {
27
+ live = false;
28
+ clearTimeout(timer);
29
+ };
30
+ }, [cache, ownerId, waitMs]);
31
+ const [mountedOffline] = useState(() => cache !== null && isOffline());
32
+ return mountedOffline && ownerId !== null && readFor !== ownerId;
33
+ }
34
+ const AthenaOfflineSnapshotsContext = createContext(null);
35
+ const noSubscription = () => () => void 0;
36
+ const serverSnapshot = () => null;
37
+ function useAthenaOfflineSnapshotAt(threadId) {
38
+ const snapshots = useContext(AthenaOfflineSnapshotsContext);
39
+ return useSyncExternalStore(
40
+ snapshots ? (listener) => snapshots.subscribeOfflineSeeds(listener) : noSubscription,
41
+ () => snapshots && threadId ? snapshots.offlineSeedAt(threadId) : null,
42
+ serverSnapshot
43
+ );
44
+ }
45
+ function formatOfflineSnapshotTime(at) {
46
+ return new Intl.DateTimeFormat(void 0, { dateStyle: "medium", timeStyle: "short" }).format(at);
47
+ }
48
+ const OfflineSnapshotBanner = ({ className }) => {
49
+ const at = useAthenaOfflineSnapshotAt(useAthenaThreadId());
50
+ if (at === null) return null;
51
+ return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsxs(
52
+ "div",
53
+ {
54
+ role: "status",
55
+ className: cn(
56
+ "mx-auto flex w-full max-w-(--thread-max-width) items-center gap-2 rounded-md border px-3 py-2 text-xs",
57
+ "border-border bg-muted text-muted-foreground"
58
+ ),
59
+ children: [
60
+ /* @__PURE__ */ jsx(CloudOffIcon, { className: "size-3.5 shrink-0", "aria-hidden": true }),
61
+ /* @__PURE__ */ jsxs("span", { children: [
62
+ "Offline · this conversation as of ",
63
+ formatOfflineSnapshotTime(at)
64
+ ] })
65
+ ]
66
+ }
67
+ ) });
68
+ };
69
+ export {
70
+ AthenaOfflineSnapshotsContext,
71
+ OFFLINE_SNAPSHOT_READ_WAIT_MS,
72
+ OfflineSnapshotBanner,
73
+ formatOfflineSnapshotTime,
74
+ useAthenaOfflineSnapshotAt,
75
+ useKeptSnapshotsGate
76
+ };
77
+ //# sourceMappingURL=offline-history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"offline-history.js","sources":["../../src/offline/offline-history.tsx"],"sourcesContent":["import type { DurableThreadSnapshotCache } from '@athenaintel/agent-runtime';\nimport { CloudOffIcon } from 'lucide-react';\nimport {\n createContext,\n type FC,\n useContext,\n useEffect,\n useState,\n useSyncExternalStore,\n} from 'react';\nimport { cn } from '../lib/utils';\nimport { useAthenaThreadId } from '../threads/thread-id-context';\n\n/**\n * Opt-in: keep the chat's recent conversations, and the session list, on this device, sealed with\n * the host's key, so a reload paints them at once and they can be read while Athena can't be\n * reached (`AthenaProvider`'s `offlineHistory`). Without it nothing is stored, as before.\n *\n * - `ownerId` names whose they are (the signed-in person). Changing it drops what the previous\n * owner kept, in memory and on the device (the session list's cached pages too); nothing kept\n * under one owner is ever shown to another. Passing no `offlineHistory` any more (a deployment\n * that now keeps nothing on devices) drops it all the same.\n * - `getKey` returns the AES-GCM key that seals them, for that owner, or `null` to keep nothing\n * (no key, a deployment that keeps nothing on devices). Midas's comes from its main process,\n * kept with the OS keychain and handed to the page only for the signed-in person.\n * - `isOffline` says Athena can't be reached (the browser's own offline when omitted): then a\n * conversation opens on its last resting transcript this device holds, up to 30 days old, marked\n * \"as of\" when it was captured; a chat that mounts offline waits (at most\n * {@link OFFLINE_SNAPSHOT_READ_WAIT_MS}) for what the device kept to be read.\n */\nexport interface AthenaOfflineHistory {\n ownerId: string;\n getKey: () => Promise<CryptoKey | null>;\n isOffline?: () => boolean;\n}\n\n/**\n * How long a chat that mounts offline waits for what this device kept before it mounts without:\n * the host's key and IndexedDB answer in milliseconds unless something is stuck.\n */\nexport const OFFLINE_SNAPSHOT_READ_WAIT_MS = 1_500;\n\n/**\n * Binds `cache` to `ownerId`, and says whether a chat that mounted offline still waits for what\n * this device kept for that owner to be read (at most `waitMs`). The runtime takes a thread's seed\n * once, as it mounts, and offline that seed is all a thread can show; online it never waits, the\n * attach delivers the thread.\n */\nexport function useKeptSnapshotsGate({\n cache,\n ownerId,\n isOffline,\n waitMs = OFFLINE_SNAPSHOT_READ_WAIT_MS,\n}: {\n cache: Pick<DurableThreadSnapshotCache, 'setOwner'> | null;\n ownerId: string | null;\n isOffline: () => boolean;\n waitMs?: number;\n}): boolean {\n const [readFor, setReadFor] = useState<string | null | undefined>(undefined);\n useEffect(() => {\n if (!cache) return;\n let live = true;\n const settle = () => {\n if (live) setReadFor(ownerId);\n };\n const timer = setTimeout(settle, waitMs);\n const done = () => {\n clearTimeout(timer);\n settle();\n };\n void cache.setOwner(ownerId).then(done, done);\n return () => {\n live = false;\n clearTimeout(timer);\n };\n }, [cache, ownerId, waitMs]);\n const [mountedOffline] = useState(() => cache !== null && isOffline());\n return mountedOffline && ownerId !== null && readFor !== ownerId;\n}\n\n/** The provider's offline snapshots: when a thread on screen was captured, if it opened offline. */\nexport type AthenaOfflineSnapshots = Pick<\n DurableThreadSnapshotCache,\n 'offlineSeedAt' | 'subscribeOfflineSeeds'\n>;\n\nexport const AthenaOfflineSnapshotsContext = createContext<AthenaOfflineSnapshots | null>(null);\n\nconst noSubscription = (): (() => void) => () => undefined;\nconst serverSnapshot = (): number | null => null;\n\n/**\n * When the transcript `threadId` shows was captured, if it opened from this device while Athena\n * could not be reached; `null` once the thread's own state arrives, outside an `offlineHistory`\n * provider, or for a new chat.\n */\nexport function useAthenaOfflineSnapshotAt(threadId: string | undefined): number | null {\n const snapshots = useContext(AthenaOfflineSnapshotsContext);\n return useSyncExternalStore(\n snapshots ? (listener) => snapshots.subscribeOfflineSeeds(listener) : noSubscription,\n () => (snapshots && threadId ? snapshots.offlineSeedAt(threadId) : null),\n serverSnapshot,\n );\n}\n\nexport function formatOfflineSnapshotTime(at: number): string {\n return new Intl.DateTimeFormat(undefined, { dateStyle: 'medium', timeStyle: 'short' }).format(at);\n}\n\nexport interface OfflineSnapshotBannerProps {\n /** Applied to the outer wrapper (host padding); the banner itself is width-capped inside it. */\n className?: string;\n}\n\n/**\n * Above a conversation that opened from this device while Athena can't be reached: what is shown\n * is the conversation as it was then, not live. Renders nothing otherwise.\n */\nexport const OfflineSnapshotBanner: FC<OfflineSnapshotBannerProps> = ({ className }) => {\n const at = useAthenaOfflineSnapshotAt(useAthenaThreadId());\n if (at === null) return null;\n return (\n <div className={className}>\n <div\n role=\"status\"\n className={cn(\n 'mx-auto flex w-full max-w-(--thread-max-width) items-center gap-2 rounded-md border px-3 py-2 text-xs',\n 'border-border bg-muted text-muted-foreground',\n )}\n >\n <CloudOffIcon className=\"size-3.5 shrink-0\" aria-hidden />\n <span>Offline · this conversation as of {formatOfflineSnapshotTime(at)}</span>\n </div>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;AAwCO,MAAM,gCAAgC;AAQtC,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AACX,GAKY;AACV,QAAM,CAAC,SAAS,UAAU,IAAI,SAAoC,MAAS;AAC3E,YAAU,MAAM;AACd,QAAI,CAAC,MAAO;AACZ,QAAI,OAAO;AACX,UAAM,SAAS,MAAM;AACnB,UAAI,iBAAiB,OAAO;AAAA,IAC9B;AACA,UAAM,QAAQ,WAAW,QAAQ,MAAM;AACvC,UAAM,OAAO,MAAM;AACjB,mBAAa,KAAK;AAClB,aAAA;AAAA,IACF;AACA,SAAK,MAAM,SAAS,OAAO,EAAE,KAAK,MAAM,IAAI;AAC5C,WAAO,MAAM;AACX,aAAO;AACP,mBAAa,KAAK;AAAA,IACpB;AAAA,EACF,GAAG,CAAC,OAAO,SAAS,MAAM,CAAC;AAC3B,QAAM,CAAC,cAAc,IAAI,SAAS,MAAM,UAAU,QAAQ,WAAW;AACrE,SAAO,kBAAkB,YAAY,QAAQ,YAAY;AAC3D;AAQO,MAAM,gCAAgC,cAA6C,IAAI;AAE9F,MAAM,iBAAiB,MAAoB,MAAM;AACjD,MAAM,iBAAiB,MAAqB;AAOrC,SAAS,2BAA2B,UAA6C;AACtF,QAAM,YAAY,WAAW,6BAA6B;AAC1D,SAAO;AAAA,IACL,YAAY,CAAC,aAAa,UAAU,sBAAsB,QAAQ,IAAI;AAAA,IACtE,MAAO,aAAa,WAAW,UAAU,cAAc,QAAQ,IAAI;AAAA,IACnE;AAAA,EAAA;AAEJ;AAEO,SAAS,0BAA0B,IAAoB;AAC5D,SAAO,IAAI,KAAK,eAAe,QAAW,EAAE,WAAW,UAAU,WAAW,QAAA,CAAS,EAAE,OAAO,EAAE;AAClG;AAWO,MAAM,wBAAwD,CAAC,EAAE,gBAAgB;AACtF,QAAM,KAAK,2BAA2B,mBAAmB;AACzD,MAAI,OAAO,KAAM,QAAO;AACxB,SACE,oBAAC,SAAI,WACH,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MAAA;AAAA,MAGF,UAAA;AAAA,QAAA,oBAAC,cAAA,EAAa,WAAU,qBAAoB,eAAW,MAAC;AAAA,6BACvD,QAAA,EAAK,UAAA;AAAA,UAAA;AAAA,UAAmC,0BAA0B,EAAE;AAAA,QAAA,EAAA,CAAE;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAE3E;AAEJ;"}
@@ -3,6 +3,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const react$1 = require("@assistant-ui/react");
5
5
  const react = require("react");
6
+ const offlineHistory = require("../offline/offline-history.cjs");
7
+ const chatOutbox = require("../offline/chat-outbox.cjs");
6
8
  const athenaUrls = require("../lib/athena-urls.cjs");
7
9
  const mint = require("../collab/mint.cjs");
8
10
  const auth = require("../runtime/auth.cjs");
@@ -11,7 +13,10 @@ const AthenaCredentialSourceContext = require("../auth/AthenaCredentialSourceCon
11
13
  const credentialSource = require("../auth/credential-source.cjs");
12
14
  const authRefusalRestart = require("../runtime/auth-refusal-restart.cjs");
13
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");
14
18
  const statewireLifecycle = require("../runtime/statewire-lifecycle.cjs");
19
+ const credentialRenewal = require("../runtime/credential-renewal.cjs");
15
20
  const statewireRunConfig = require("../runtime/statewire-run-config.cjs");
16
21
  const statewireThreadConfigLane = require("../runtime/statewire-thread-config-lane.cjs");
17
22
  const mintThreadId = require("../threads/mint-thread-id.cjs");
@@ -36,10 +41,15 @@ const assetPanelStore = require("../assets/asset-panel-store.cjs");
36
41
  const index = require("../theme/index.cjs");
37
42
  const themeStyleContext = require("./theme-style-context.cjs");
38
43
  const PostHogProvider = require("./PostHogProvider.cjs");
44
+ const threadSnapshotMirror = require("../agent-runtime/src/thread-snapshot-mirror.cjs");
45
+ const durableThreadSnapshotCache = require("../agent-runtime/src/durable-thread-snapshot-cache.cjs");
39
46
  const threadSnapshotCache = require("../agent-runtime/src/thread-snapshot-cache.cjs");
47
+ const chatOutboxAttachments = require("../agent-runtime/src/chat-outbox-attachments.cjs");
40
48
  const toolOutputs = require("../agent-runtime/src/tool-outputs.cjs");
41
49
  const threadStatus = require("../agent-runtime/src/thread-status.cjs");
50
+ const useDeepAgentChatOutbox = require("../agent-runtime/src/use-deep-agent-chat-outbox.cjs");
42
51
  const useDeepAgentConfig = require("../agent-runtime/src/use-deep-agent-config.cjs");
52
+ const chatOutboxSignals = require("../agent-runtime/src/chat-outbox-signals.cjs");
43
53
  const resolveTokenOverride = ({
44
54
  config,
45
55
  token
@@ -101,6 +111,7 @@ function ComposerHandoffDrain() {
101
111
  return null;
102
112
  }
103
113
  const EMPTY_MODES = [];
114
+ const CHAT_OUTBOX_ATTACHMENT_READ_TIMEOUT_MS = 1e4;
104
115
  function withEntry(record, key, value) {
105
116
  if (value === null) {
106
117
  if (!(key in record)) return record;
@@ -135,8 +146,12 @@ function AthenaStatewireRuntimeMount({
135
146
  appId,
136
147
  extraRunConfig,
137
148
  snapshotCache,
138
- toolOutputs: toolOutputs2
149
+ toolOutputs: toolOutputs2,
150
+ chatOutbox: chatOutbox2 = null,
151
+ sessionLane,
152
+ subagentLaneHistory
139
153
  }) {
154
+ const outboxRef = react.useRef(null);
140
155
  const [lifecycle, dispatchLifecycle] = react.useReducer(
141
156
  statewireLifecycle.statewireLifecycleReducer,
142
157
  statewireLifecycle.initialStatewireLifecycle
@@ -165,6 +180,7 @@ function AthenaStatewireRuntimeMount({
165
180
  extraRunConfig,
166
181
  snapshotCache,
167
182
  toolOutputs: toolOutputs2,
183
+ subagentLaneHistory,
168
184
  // The runtime already records every transport error on the diagnostics
169
185
  // bus (with the channel-teardown split), so this layer only maps it to
170
186
  // the banner notice.
@@ -178,6 +194,10 @@ function AthenaStatewireRuntimeMount({
178
194
  onRawConnectionChange: (connection) => {
179
195
  dispatchLifecycle({ type: "raw-connection", reconnect: connection.reconnect });
180
196
  },
197
+ onCommandChange: (update) => {
198
+ var _a;
199
+ return (_a = outboxRef.current) == null ? void 0 : _a.observeCommand(update);
200
+ },
181
201
  // The lane as the host holds it: anything that decides from the lane waits
182
202
  // for this, never the placeholder or remembered snapshot rendered before.
183
203
  onServerState: (state) => {
@@ -185,6 +205,64 @@ function AthenaStatewireRuntimeMount({
185
205
  setServerLane((previous) => statewireServerLaneContext.nextServerLane({ previous, config }));
186
206
  }
187
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;
188
266
  authRefusalRestart.useRestartAfterAuthRefusal({
189
267
  connection: lifecycle.connection,
190
268
  reconnect: lifecycle.reconnect
@@ -218,9 +296,10 @@ function AthenaStatewireRuntimeMount({
218
296
  client,
219
297
  lifecycle: lifecycleValue,
220
298
  serverLane,
221
- threadConfig
299
+ threadConfig,
300
+ outbox
222
301
  }),
223
- [threadId, isNewChat, client, lifecycleValue, serverLane, threadConfig]
302
+ [threadId, isNewChat, client, lifecycleValue, serverLane, threadConfig, outbox]
224
303
  );
225
304
  react.useLayoutEffect(() => {
226
305
  onPublish(snapshot);
@@ -320,7 +399,7 @@ function AthenaStatewireStandalone({
320
399
  published.threadId
321
400
  ),
322
401
  /* @__PURE__ */ jsxRuntime.jsx(ComposerHandoffDrain, {}),
323
- /* @__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 }) })
324
403
  ] }) }) }) }) }) }) }) }) });
325
404
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
326
405
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -354,6 +433,7 @@ function AthenaStatewireWithThreadList({
354
433
  initialThreadId,
355
434
  includePullRequests,
356
435
  additionalListAppIds,
436
+ offlineList,
357
437
  ...standaloneProps
358
438
  }) {
359
439
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -368,6 +448,7 @@ function AthenaStatewireWithThreadList({
368
448
  additionalListAppIds,
369
449
  initialThreadId,
370
450
  includePullRequests,
451
+ offlineList,
371
452
  snapshotCache: standaloneProps.snapshotCache,
372
453
  children: /* @__PURE__ */ jsxRuntime.jsx(
373
454
  AthenaStatewireActiveThreadHost,
@@ -387,15 +468,25 @@ function AthenaStatewireWithThreadList({
387
468
  }
388
469
  function AthenaStatewireActiveThreadHost({
389
470
  children,
471
+ chatOutbox: chatOutbox2,
390
472
  ...standaloneProps
391
473
  }) {
392
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
+ );
393
483
  if (!list) return null;
394
484
  return /* @__PURE__ */ jsxRuntime.jsxs(
395
485
  AthenaStatewireStandalone,
396
486
  {
397
487
  threadId: list.activeThreadId,
398
488
  threadList: { isNewChat: list.isNewChat },
489
+ chatOutbox: outboxHost,
399
490
  ...standaloneProps,
400
491
  children: [
401
492
  /* @__PURE__ */ jsxRuntime.jsx(statewireThreadList.StatewireThreadTitlePoller, {}),
@@ -448,7 +539,10 @@ function AthenaProvider({
448
539
  posthog: posthogProp,
449
540
  debug,
450
541
  onDiagnostic,
451
- onError
542
+ onError,
543
+ offlineHistory: offlineHistory$1,
544
+ chatOutbox: chatOutbox$1,
545
+ subagentLaneHistory = false
452
546
  }) {
453
547
  var _a;
454
548
  const agentAssetId = statewireRunConfig.resolveAgentProp({ agent });
@@ -525,7 +619,87 @@ function AthenaProvider({
525
619
  });
526
620
  const authContext = react.useContext(AthenaAuthContext.AthenaAuthContext);
527
621
  const authProviderToken = (authContext == null ? void 0 : authContext.accessToken) ?? null;
528
- const [snapshotCache] = react.useState(() => threadSnapshotCache.createDeepAgentThreadSnapshotCache());
622
+ const offlineHistoryRef = react.useRef(offlineHistory$1);
623
+ offlineHistoryRef.current = offlineHistory$1;
624
+ const isOfflineNow = () => {
625
+ var _a2, _b;
626
+ return ((_b = (_a2 = offlineHistoryRef.current) == null ? void 0 : _a2.isOffline) == null ? void 0 : _b.call(_a2)) ?? (typeof navigator !== "undefined" && navigator.onLine === false);
627
+ };
628
+ const [offlineMirror] = react.useState(
629
+ () => offlineHistory$1 ? threadSnapshotMirror.createThreadSnapshotMirror({
630
+ getKey: (ownerId) => {
631
+ const host = offlineHistoryRef.current;
632
+ return host && host.ownerId === ownerId ? host.getKey() : Promise.resolve(null);
633
+ }
634
+ }) : null
635
+ );
636
+ const [durableSnapshotCache] = react.useState(
637
+ () => offlineMirror ? durableThreadSnapshotCache.createDurableThreadSnapshotCache({ mirror: offlineMirror, isOffline: isOfflineNow }) : null
638
+ );
639
+ const [snapshotCache] = react.useState(
640
+ () => durableSnapshotCache ?? threadSnapshotCache.createDeepAgentThreadSnapshotCache()
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
+ );
686
+ const offlineOwnerId = (offlineHistory$1 == null ? void 0 : offlineHistory$1.ownerId) ?? null;
687
+ const awaitingKeptSnapshots = offlineHistory.useKeptSnapshotsGate({
688
+ cache: durableSnapshotCache,
689
+ ownerId: offlineOwnerId,
690
+ isOffline: isOfflineNow
691
+ });
692
+ const offlineSnapshots = react.useMemo(
693
+ () => durableSnapshotCache ? {
694
+ offlineSeedAt: (threadId) => durableSnapshotCache.offlineSeedAt(threadId),
695
+ subscribeOfflineSeeds: (listener) => durableSnapshotCache.subscribeOfflineSeeds(listener)
696
+ } : null,
697
+ [durableSnapshotCache]
698
+ );
699
+ const offlineList = react.useMemo(
700
+ () => offlineMirror && offlineOwnerId ? { mirror: offlineMirror, ownerId: offlineOwnerId } : void 0,
701
+ [offlineMirror, offlineOwnerId]
702
+ );
529
703
  const [composerHandoff$1] = react.useState(composerHandoff.createComposerHandoffStore);
530
704
  const [toolOutputs$1] = react.useState(() => toolOutputs.createDeepAgentToolOutputStore());
531
705
  const [historyStore] = react.useState(statewireHistoryContext.createStatewireHistoryStore);
@@ -533,8 +707,21 @@ function AthenaProvider({
533
707
  react.useEffect(() => {
534
708
  snapshotCache.clear();
535
709
  toolOutputs$1.clear();
536
- composerHandoff.clearComposerHandoff({ store: composerHandoff$1, reason: "the signed-in identity changed" });
537
- }, [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]);
538
725
  react.useEffect(
539
726
  () => () => composerHandoff.clearComposerHandoff({ store: composerHandoff$1, reason: "the chat provider unmounted" }),
540
727
  [composerHandoff$1]
@@ -558,6 +745,12 @@ function AthenaProvider({
558
745
  const effectiveBackendUrl = mint.getAthenaApiBaseUrl(
559
746
  configuredBackendUrl ?? bridge.backendBaseUrl ?? environmentUrls.backendUrl
560
747
  );
748
+ outboxCheckBackendRef.current = effectiveBackendUrl;
749
+ outboxCheckAuthRef.current = {
750
+ apiKey: configuredApiKey,
751
+ token: effectiveToken,
752
+ getToken: credentialGetToken
753
+ };
561
754
  const hostStatewireSyncUrl = configuredStatewireSyncUrl ?? bridge.statewireSyncUrl ?? void 0;
562
755
  const effectiveAppUrl = configuredAppUrl ?? bridge.appUrl ?? athenaUrls.deriveAthenaAppUrl({ apiUrl: effectiveApiUrl, backendUrl: effectiveBackendUrl }) ?? environmentUrls.appUrl;
563
756
  if (!bridge.ready) {
@@ -598,6 +791,9 @@ function AthenaProvider({
598
791
  snapshotCache,
599
792
  toolOutputs: toolOutputs$1,
600
793
  historyStore,
794
+ chatOutbox: chatOutboxHost,
795
+ sessionLane,
796
+ subagentLaneHistory,
601
797
  linkClicks,
602
798
  citationLinks
603
799
  };
@@ -608,6 +804,7 @@ function AthenaProvider({
608
804
  initialThreadId: threadIdProp,
609
805
  includePullRequests: threadListIncludePullRequests,
610
806
  additionalListAppIds: threadListAdditionalAppIds,
807
+ offlineList,
611
808
  children
612
809
  }
613
810
  ) : (
@@ -629,7 +826,7 @@ function AthenaProvider({
629
826
  {
630
827
  className: themeStyleVars ? "athena-sdk athena-themed" : "athena-sdk",
631
828
  style: themeStyleVars,
632
- 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: 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 }) }) }) }) }) }) })
633
830
  }
634
831
  );
635
832
  }