@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
package/README.md CHANGED
@@ -23,8 +23,11 @@ requires a compatible backend. Publication is temporarily withheld until product
23
23
  and authorization tests pass and a compatible backend rollback release is
24
24
  retained. The publish workflow requires a manual
25
25
  `PRODUCTION_NATIVE_CONTEXT_AND_ROLLBACK_QUALIFIED` acknowledgement; dry runs
26
- remain available. Computer templates keep SDK0.28.0 until the qualified
27
- release is published. The qualification steps and gate removal condition are
26
+ remain available. Once a release is on npm, the computer starters
27
+ (`docker/athena-app`, `docker/default-vite`, `docker/kpmg-audit`) move to it
28
+ with `scripts/computer-starter-lockfiles.ts --react <version>`; their
29
+ `bunfig.toml` exempts only `@athenaintel/react` from the image's four-day
30
+ release-age gate. The qualification steps and gate removal condition are
28
31
  in the [coordinated release runbook](../../docs/runbooks/coordinated-client-releases.md#public-native-context-publication-gate).
29
32
 
30
33
  The SDK pins its assistant-ui runtime (`@assistant-ui/tap`, `store`, `core`,
@@ -60,7 +63,14 @@ export default defineConfig({
60
63
  });
61
64
  ```
62
65
 
63
- Then bump to the release you want and re-resolve from scratch.
66
+ Then bump to the release you want. One exception comes first: if your app
67
+ depends on an assistant-ui package itself (say `@assistant-ui/react`, for
68
+ components of its own) and the new SDK pins the same assistant-ui stack as the
69
+ old one (compare the two versions' `dependencies`), keep `bun.lock`. Run only
70
+ the `bun add` line below and skip deleting anything. A from-scratch resolve
71
+ there can take newer `core` / `store` / `tap` patches through that package's
72
+ caret ranges, beside the SDK's exact pins; `resolve.dedupe` above still mounts
73
+ one instance at runtime. Otherwise, re-resolve from scratch.
64
74
  Lockfile-preserving commands do not do it — `bun update` and
65
75
  `bun install --force` keep the nested lockfile entries, and `bun remove` +
66
76
  `bun add` (or deleting only `bun.lock`) rewrites the lockfile but bun leaves
@@ -235,7 +245,11 @@ A `getToken` resolver is called with `{ force: true }` right after the sync
235
245
  host refuses a credential, so a caching getter must mint a fresh token then;
236
246
  the persisted command lane is scoped to the signed-in user as well as the
237
247
  host, so a shared browser never resends one user's pending sends under the
238
- next user's token.
248
+ next user's token. While a sign-in provider above the chat is still loading
249
+ who is signed in (`AthenaAuthContext` with `isLoading: true` and no `user`
250
+ yet), the chat does not connect and stores nothing: it connects once, under
251
+ the signed-in user, when they are known, and sends made meanwhile wait for
252
+ that.
239
253
 
240
254
  What the statewire transport wires up in `AthenaChat`:
241
255
 
@@ -276,8 +290,9 @@ What the statewire transport wires up in `AthenaChat`:
276
290
  `SuperGroupingCard`, `SuperGroupingFinalText`, `CollapsibleGroup`, the
277
291
  activity-timeline derivation, and the tool-based grouping function — with
278
292
  slots for the host's text/tool renderers and controls (`renderHeaderActions`,
279
- `renderRunningMeta`, `summaryDetails`, `waitingTools`, `expansionKey`), so
280
- Olympus and the Chrome extension mount one card instead of copies.
293
+ `renderRunningMeta`, `summaryDetails`, `waitingTools`, `waitingToolCallIds`,
294
+ `expansionKey`), so Olympus and the Chrome extension mount one card instead
295
+ of copies.
281
296
  - **In-repo hosts consume the package, not the source.** `@athenaintel/react`
282
297
  is a workspace dependency of Olympus, the Chrome extension, and the Office
283
298
  add-in, resolved through this package's `exports` to the built `dist/` (the
@@ -722,6 +737,44 @@ registry entries (`SESSION_WORKBENCH_TASKS_PANE`, …), the data hooks
722
737
  (`deriveShellRows`, `filterShellRows`, `deriveTaskSteps`, `taskProgress`,
723
738
  `workspaceComputers`) are exported for hosts composing their own.
724
739
 
740
+ ## Chat voice media (`@athenaintel/react/voice/livekit`)
741
+
742
+ Hosts using the shared agent runtime can use the SDK's browser LiveKit adapter
743
+ for chat voice. The runtime owns the voice commands and transcript; the adapter
744
+ joins the authorized room, publishes the microphone and plays the agent audio.
745
+ Install the optional `livekit-client` peer before starting a session.
746
+
747
+ ```tsx
748
+ import { useMemo, useRef } from 'react';
749
+ import { useAthenaChatVoice } from '@athenaintel/react/voice/chat';
750
+ import { createDeepAgentVoiceLiveKitAdapter } from '@athenaintel/react/voice/livekit';
751
+
752
+ function ChatVoice() {
753
+ const audioRef = useRef<HTMLAudioElement>(null);
754
+ const livekit = useMemo(
755
+ () => createDeepAgentVoiceLiveKitAdapter({ audioElement: () => audioRef.current }),
756
+ [],
757
+ );
758
+ const voice = useAthenaChatVoice({ transport: 'livekit', livekit });
759
+ const active = voice.phase === 'connecting' || voice.phase === 'live';
760
+ return <>
761
+ <audio ref={audioRef} autoPlay />
762
+ <button disabled={active} onClick={() => void voice.start()}>Start voice</button>
763
+ <button disabled={!active} onClick={voice.end}>End voice</button>
764
+ </>;
765
+ }
766
+ ```
767
+
768
+ Use this inside the thread's runtime provider and start voice from a user
769
+ action. Importing the adapter leaves LiveKit unloaded until a room joins. The
770
+ default room releases the microphone device on mute and enables browser echo
771
+ cancellation, noise suppression and gain control. A host can supply its own
772
+ `roomFactory` when it needs a platform-specific room policy.
773
+ The SDK's shared runtime supplies cancellation: Stop or unmount releases a pending
774
+ join, ignores late audio and cleans up a microphone request that finishes
775
+ after the attempt ended. The host still applies its voice permission and
776
+ deployment gates before issuing room credentials.
777
+
725
778
  ## Voice Sessions (`@athenaintel/react/voice`)
726
779
 
727
780
  `useAthenaVoiceSession` runs a real-time voice conversation with an Athena
@@ -807,6 +860,49 @@ Both use the same bearer / API key as session creation. The full recipe
807
860
  template skill `voice-session-guide.md`. `createAthenaVoiceSession` is also
808
861
  exported if you hold the bridge state yourself.
809
862
 
863
+ ## What's new in 0.42.1
864
+
865
+ **A chat that mounts before your sign-in provider knows who is signed in no longer resends old commands, and no longer loses what was sent meanwhile.** The chat keeps each conversation's unconfirmed commands in this browser under the signed-in user, so a reload can resend them. A sign-in provider of your own that renders the chat while it is still loading (`AthenaAuthContext` with `isLoading: true`) put the conversation under an anonymous key first. When the user loaded, the conversation moved to their key and took the anonymous record's client id and command numbers with it, and the anonymous record stayed behind with the same id. Every later page load read that record first and resent its commands below the numbers Athena had already taken, so Athena refused them as expired. A message sent before the user loaded went into a conversation that could not keep it.
866
+
867
+ While the sign-in provider is loading and names no user yet, the chat now waits: it does not connect and stores nothing, and it connects once, under the signed-in user, as soon as they are known. A provider that refreshes while still naming its user keeps that user's conversation as it is. A message sent meanwhile (Enter in the composer, a dictated send, a suggestion, `useSendMessage`) waits and goes out then, and `useComposerReady()` reads `false` until then. `AthenaAuthProvider` and `AthenaSSOProvider` render the chat only once someone is signed in, so apps that use them are unaffected. Nothing to change in your app.
868
+
869
+ ## What's new in 0.42.0
870
+
871
+ **Subagent cards.** When the agent delegates work to a subagent (a `task` call), `AthenaChat` shows the delegation as a card in the conversation, outside the turn's collapsed steps: what the subagent was asked to do, where it is (Queued, Running, Done, Failed, Stopped), how many tool calls it has made, how long it has run, and while it runs, the step it took last ("Read `routes.ts`"). A finished subagent shows the start of its report, and a failed one the start of why it failed; the card opens to the whole text, steps or none. Open the card to follow its steps live: they render read-only with the chat's own tool cards, and a delegation inside a subagent's steps shows as one row. The card is `SubagentTaskToolUI`, registered as `task` in `TOOL_UI_REGISTRY`, so an app that spreads the registry into `toolUIs` gets it too.
872
+
873
+ **Load earlier steps.** Athena sends a running subagent's card with only its newest steps. An open card says how many it shows ("Showing the latest 8 of 42 steps.") and "Load earlier steps" reads the rest, a page at a time, over the conversation's own connection (the read-only `history/lane` command, sent only when asked). Pass `subagentLaneHistory` to `AthenaProvider` when every `task` call your chat shows renders in this card (`AthenaChat` with the registry's `task`): the provider then tells Athena that its chat pages subagent steps (deep-agent protocol 2), so a finished subagent's card also arrives with only its newest steps and a long fan-out loads lighter. It is off by default, so finished subagents arrive whole until you opt in. Against an Athena that cannot page a running subagent, the card says instead that the earlier steps arrive when the subagent finishes.
874
+
875
+ **A subagent waiting for approval says so.** When a gated tool a subagent calls (or the delegation itself) waits on a person's approval, its card reads "Waiting for approval" and names what it waits on ("Needs approval to run `delete` …", or "Needs approval to start") instead of live activity, with no clock running. The turn's step for it reads "Waiting for your input", not running, so the turn header says "Waiting for you" and never "Nothing new". `AthenaChat` reads the run's approval once, the one the approval card shows, and passes the waiting steps to the collapsed view (`waitingToolCallIds`, 0.41.7). It only reads: the approval card is still what answers. For a chat of your own, `useStatewireApprovalWait()` returns the gated calls still waiting (`toolCallIds`) and whether the run is parked (`runParked`), and `useTurnToolCallsAwaitingApproval(toolCallIds)` the steps of the turn in scope they make wait, for `SuperGroupingCard` / `SuperGroupingTranscript`.
876
+
877
+ **If you render `task` yourself.** A `task` tool UI you pass in `toolUIs` keeps its place in the turn, and the SDK adds no subagent steps under it. Leave `subagentLaneHistory` off (the default) and finished subagents keep arriving whole, so a UI that reads every step off the card (`artifact.subgraph_state.messages`) still sees them all; a running subagent's card carries only its newest steps, as before. A chat of your own on `useAthenaStatewireRuntime` likewise declares the default contract unless you pass `subagentLaneHistory: true`. Each `task` tool-call part now carries its subagent's steps as `messages`, assistant-ui's nested-thread channel (`MessagePartPrimitive.Messages`, `thread.tasks`); `NestedPtcMessages` leaves them to the subagent card.
878
+
879
+ ## What's new in 0.41.7
880
+
881
+ **A step that is still running no longer reads as done when its turn stops streaming.** A long-running tool's step (a `task` subagent, Studio or Python execution, deep research) holds the backend's running placeholder until its real result arrives. When a run parks on an approval raised inside a subagent, nothing streams, so the turn's status reads complete, and the collapsed view checked the subagent's step off as done. A step whose only result is the running placeholder now reads as running whatever the turn's status says (`buildActivityTimeline`, `getActivityToolState`), and so does the card that holds it (`resolveActivityPhase`), which keeps its live tool details mounted.
882
+
883
+ **Hosts can name the steps a run is parked on.** `SuperGroupingCard` and `SuperGroupingTranscript` take `waitingToolCallIds` (and `buildActivityTimeline` the same option): the ids of the tool calls the run waits on a person for. Each one still without its real result reads "Waiting for your input", and the card reads "Waiting for you". Olympus passes the `task` call whose subagent is parked on an approval. Keep the set's identity stable while its ids do not change. Nothing to change in your app.
884
+
885
+ ## What's new in 0.41.6
886
+
887
+ **A new session reaches the sidebar even when the first refresh is refused.** When the conversation index tells the list about a session it does not show yet, the list refreshes. That refresh used to run once per session: if it was refused (a rate limit, a network error, a deploy restart), the session stayed out of the sidebar until a reload. A refused refresh is now tried again, after 10 s and then 20 s, at most three times, so a session the list legitimately never shows (another app, a search) cannot loop. The same applies to `useAthenaSessions` lists (`SessionsPage`, `Inbox`).
888
+
889
+ **Fewer session-list reads per session change.** A session starting or changing used to make every open tab re-read each of its lists at once. Now:
890
+
891
+ - the refreshes one burst of index pushes calls for are gathered into one (about 0.75 s, at most 3 s), and none is sent while that list is already being read;
892
+ - tabs of the same user and workspace share what they read over a `BroadcastChannel`. One tab claims a list and reads it, and the others take its page instead of reading it themselves. A background tab waits a little longer, so the visible tab is usually the one that reads. If the shared page never arrives, each tab reads for itself after 5 s.
893
+
894
+ Without `BroadcastChannel`, or before the signed-in user and workspace are known, each tab reads for itself, as before. Nothing to change in your app.
895
+
896
+ ## What's new in 0.41.4
897
+
898
+ **Text typed after a link stays plain.** Tiptap's Link is inclusive whenever autolink is on, so in the composer a space and the words typed after a pasted (or autolinked) URL joined the link and were sent as part of it. The chat link mark is no longer inclusive: the URL keeps its link and whatever is typed at its end is ordinary text.
899
+
900
+ ## What's new in 0.41.3
901
+
902
+ **A pinned session stays in the sidebar.** The session list reads the newest 50 sessions, and its Pinned group was built from that page alone, so a session pinned long ago left the sidebar once 50 newer sessions existed (on staging, four pinned sessions became three when two new sessions started). The provider now also reads the viewer's pinned sessions on their own (`favorites_only`, under the same app scope and search, every page of them up to 500) and adds the ones the page does not list to the Pinned group. Unpinning such a session takes it out of the sidebar, since it is not one of the newest. Nothing to change in your app.
903
+
904
+ **"Completed with issues" means the turn ended on a problem.** A finished turn's collapsed card said "Completed with issues" when any tool call in it had failed, so a long run that opened its pull request after a few failed reads or commands read as a failure. It now says so only when the turn ended on a failed call (no later call completed) or held a call the person refused; otherwise it reads `Used N tools`. `getActivitySummary` follows the same rule.
905
+
810
906
  ## What's new in 0.41.2
811
907
 
812
908
  **A session opened while its run is streaming shows, and keeps, its own model.** `useAthenaThreadModel()` could report `ready` with no model before the session's snapshot had arrived. On a session whose run was streaming, the connection reported `connected` before the attach snapshot applied, and the SDK took the placeholder the thread shows meanwhile, which holds no server config, as what the server sent. A picker seeded from it showed the agent's default model, and the provider then wrote that pick to the session (`config/patch {model: null}`), so the session lost its model for its next turns. `ready`, and every config write the provider decides, now wait for a state the server sent: the placeholder and a remembered snapshot never count, whenever the connection reports `connected`. The `statewire.attach` diagnostics span (time to the session's snapshot) now ends when that snapshot arrives, not when the thread first renders.
@@ -2045,6 +2141,8 @@ The transcript is `SuperGroupingTranscript` from `@athenaintel/react/super-group
2045
2141
 
2046
2142
  Every step row and every thread tool card reads one summary registry, `summarizeToolCall({ toolName, args, result, status })` → `{ label, detail?, meta?, code? }` (also on `@athenaintel/react/tools`). It has rules for the deep agent's core tools (`execute`, the workspace file tools, `search_assets`, the computer and GitHub tools, web search and browse, `read_asset`, `write_todos`, `task`, and the UI Testing toolkit's `test_recording_start` / `_mark` / `_stop`); other tools read the shared display registry, and a tool neither knows falls back to a host catalog name (`resolveToolDisplayName`), else its sentence-cased name. A call that targets a machine or document by id (`sandbox_asset_id`, `computer_asset_id`) is named by its title when an earlier result in the turn carried one (`collectAssetTitles`); nothing is fetched.
2047
2143
 
2144
+ A delegation to a subagent (`task`) stays in the conversation, as an email draft or a UI test report does: the subagent card, with its state, tool calls, clock and newest step, and its steps behind its disclosure (see [What's new in 0.42.0](#whats-new-in-0420)).
2145
+
2048
2146
  Every tool call it renders — the generic `ToolFallback`, the built-in tool UIs, nested sub-calls — shares one row anatomy: a status glyph (spinner / check / x / alert), the verb and its target on one line, a running call's elapsed seconds after three, a failed call tinted red, and a disclosure for the arguments and result.
2049
2147
 
2050
2148
  That row is the `thread` appearance of `ToolFallback`. Hosts that render their own thread keep the boxed host card they render today (the default, `card`); to adopt the row, wrap the thread in the provider or set it per card:
@@ -2110,9 +2208,10 @@ function MeetingCard({ block }: { block: string }) {
2110
2208
 
2111
2209
  Both hooks are safe to call at any time. A write made before the chat is
2112
2210
  ready — with `enableThreadList`, while the list is still resolving the active
2113
- thread, or while the thread's history is still loading — waits in the provider
2114
- and lands once the composer is ready, instead of being lost with the mount it
2115
- was written into (the provider keys its statewire subtree by thread). Readiness
2211
+ thread, while the thread's history is still loading, or while a sign-in
2212
+ provider above the chat is still loading who is signed in — waits in the
2213
+ provider and lands once the composer is ready, instead of being lost with the
2214
+ mount it was written into (the provider keys its statewire subtree by thread). Readiness
2116
2215
  is not the socket: a never-started chat sits in `standby` until its first send
2117
2216
  and still takes a prefill. Early writes keep their order (two early sends both
2118
2217
  go out, first then second; adjacent plain appends fold into one draft), and
@@ -0,0 +1,98 @@
1
+ import type { Attachment, AttachmentAdapter, CompleteAttachment, PendingAttachment } from '@assistant-ui/core';
2
+ /**
3
+ * Shared Athena asset-attachment choreography (issue #29088): upload the file
4
+ * as a normal Athena asset, insert its final mention into the host composer,
5
+ * and yield no assistant-ui attachment tile — the deep-agent backend resolves
6
+ * the mention (documents via read_asset, images inlined server-side), so no
7
+ * duplicate base64 part ever enters statewire. No preparation state rides the
8
+ * wire: readiness is local to the composer doing the attaching.
9
+ */
10
+ export interface UploadedChatAsset {
11
+ id: string;
12
+ title: string;
13
+ assetType: string;
14
+ }
15
+ /** Composer mention-insertion hook. The source file stays local to the client
16
+ * and lets rich composers show a preview without putting image bytes on the
17
+ * statewire. The return value is awaited when it is a promise and otherwise
18
+ * ignored, so ordinary event-handler arrows fit. */
19
+ export type ChatAssetMentionHandler = (asset: UploadedChatAsset, sourceFile?: File) => unknown;
20
+ /**
21
+ * Register the composer's mention-insertion hook for one thread. The hook is
22
+ * the per-client seam — TipTap on web, the native editor bridge on mobile —
23
+ * and the identity-checked unregister keeps a stale composer from clobbering
24
+ * a newer registration.
25
+ */
26
+ export declare function registerChatAssetMentionHandler(threadId: string, handler: ChatAssetMentionHandler): () => void;
27
+ export declare function getChatAssetMentionHandler(threadId: string): ChatAssetMentionHandler | undefined;
28
+ export interface ChatAssetUploadResponse {
29
+ success?: Array<{
30
+ id?: unknown;
31
+ title?: unknown;
32
+ file_name?: unknown;
33
+ athena_original_type?: unknown;
34
+ }>;
35
+ }
36
+ /**
37
+ * Map agora's `/api/upload/` response to the mention payload. Title falls
38
+ * back `title → file_name → local file name`; the asset type falls back to
39
+ * the caller's sniffed default when the row carries none.
40
+ */
41
+ export declare function uploadedChatAsset(args: {
42
+ body: ChatAssetUploadResponse;
43
+ fallbackTitle: string;
44
+ fallbackAssetType: string;
45
+ }): UploadedChatAsset;
46
+ /** The local default when the upload response carries no asset type. */
47
+ export declare function sniffAssetTypeForFile(file: {
48
+ type: string;
49
+ }): string;
50
+ export interface UploadChatAssetOptions {
51
+ /** Agora base URL (trailing slashes tolerated). */
52
+ baseUrl: string;
53
+ file: File;
54
+ /** Auth headers for the upload request. */
55
+ headers: () => Promise<Record<string, string>> | Record<string, string>;
56
+ /**
57
+ * Fresh headers for exactly one retry after a 401 (e.g. a force-renewed
58
+ * token). Omitted, a 401 fails like any other error status.
59
+ */
60
+ retryHeadersOn401?: () => Promise<Record<string, string>> | Record<string, string>;
61
+ /** Upload timeout; the request aborts (and the add() rejects) past it. */
62
+ timeoutMs?: number;
63
+ }
64
+ /**
65
+ * Upload one file as an Athena asset through agora's `/api/upload/`.
66
+ * Cancellation and the timeout live inside the adapter path by construction:
67
+ * the abort signal rejects the `add()` generator, so the composer's send
68
+ * (which awaits adapter completion) can never race a hung upload.
69
+ */
70
+ export declare function uploadChatAsset(options: UploadChatAssetOptions): Promise<UploadedChatAsset>;
71
+ export interface AthenaAssetAttachmentAdapterOptions {
72
+ threadId: string;
73
+ /** File-picker filter; defaults to images (the deep-agent mention path). */
74
+ accept?: string;
75
+ /** Platform upload transport; most hosts wrap {@link uploadChatAsset}. */
76
+ upload: (file: File) => Promise<UploadedChatAsset>;
77
+ }
78
+ /**
79
+ * The shared mention-backed attachment adapter: `add()` requires the thread's
80
+ * registered composer hook up front (no upload cost when the composer is
81
+ * gone), uploads, then inserts the mention into the thread's CURRENT hook —
82
+ * a same-thread composer remount mid-upload still receives the mention, and
83
+ * the thread-keyed registry makes cross-thread insertion impossible by
84
+ * construction. A thread whose hook is gone after the upload rejects with a
85
+ * visible error (the conversation closed; the user must re-attach).
86
+ * `send()` throws by contract: mention-backed attachments are never message
87
+ * parts.
88
+ */
89
+ export declare class AthenaAssetAttachmentAdapter implements AttachmentAdapter {
90
+ private readonly options;
91
+ readonly accept: string;
92
+ constructor(options: AthenaAssetAttachmentAdapterOptions);
93
+ add(args: {
94
+ file: File;
95
+ }): AsyncGenerator<PendingAttachment, void>;
96
+ remove(_attachment: Attachment): Promise<void>;
97
+ send(_attachment: PendingAttachment): Promise<CompleteAttachment>;
98
+ }
@@ -0,0 +1,32 @@
1
+ import type { UploadedChatAsset } from "./asset-attachment";
2
+ /**
3
+ * Cross-surface drag payload for an Athena asset. Olympus sets it when a
4
+ * Spaces tab or sidebar row starts a native drag so a composer in another
5
+ * document (the Chrome extension side panel, an embedded SDK chat) can insert
6
+ * an asset mention instead of the drag's incidental text.
7
+ */
8
+ export declare const ATHENA_ASSET_DRAG_MIME = "application/x-athena-asset+json";
9
+ /** Olympus's FlexLayout tab drags carry the tab's asset id under this type. */
10
+ export declare const FLEXLAYOUT_TAB_DRAG_MIME = "application/x-flexlayout-tab";
11
+ /** The `text/plain` value FlexLayout writes on every tab drag. */
12
+ export declare const FLEXLAYOUT_DRAG_TEXT_SENTINEL = "--flexlayout--";
13
+ /** The `DataTransfer` surface read here (agent-runtime has no DOM lib). */
14
+ interface DragData {
15
+ getData(format: string): string;
16
+ }
17
+ export declare function serializeAthenaAssetDrag(asset: UploadedChatAsset): string;
18
+ /** Whether a drag carries an Athena asset — readable during `dragover`. */
19
+ export declare function isAthenaAssetDrag(types: Iterable<string>): boolean;
20
+ export type AthenaAssetDrop = {
21
+ kind: "asset";
22
+ asset: UploadedChatAsset;
23
+ }
24
+ /** An Athena asset drag whose metadata did not travel — swallow it rather
25
+ * than let the editor paste the sentinel text. */
26
+ | {
27
+ kind: "unresolved";
28
+ assetId: string | null;
29
+ } | null;
30
+ /** Reads an Athena asset from a drop, or `null` when the drop is not one. */
31
+ export declare function readAthenaAssetDrop(dataTransfer: DragData): AthenaAssetDrop;
32
+ export {};
@@ -0,0 +1,29 @@
1
+ import type { DeepAgentConnectionState } from './types';
2
+ /**
3
+ * How many consecutive `unauthorized` attach denials park the transport.
4
+ *
5
+ * The client's reconnect backoff reaches its 30s ceiling around the eighth
6
+ * attempt, so eight denials ≈ one minute of the server actively refusing the
7
+ * credential. Transient auth blips (a tab waking with a stale token that
8
+ * refreshes on the next attempt) recover in one or two attempts and never
9
+ * park; a credential the server keeps refusing (revoked access, no workspace)
10
+ * would otherwise retry every 30s indefinitely — the prod "attach denied"
11
+ * loops ran for hours per tab.
12
+ */
13
+ export declare const AUTH_DENIAL_PARK_THRESHOLD = 8;
14
+ export interface AuthDenialTrackerState {
15
+ /** Reconnect attempt number of the last counted denial (dedupes converter re-runs). */
16
+ lastAttempt: number | null;
17
+ /** Consecutive `unauthorized` denials observed on this attach. */
18
+ consecutive: number;
19
+ /** The denial's host-supplied message, kept for the parked connection state. */
20
+ message: string | undefined;
21
+ }
22
+ export declare const initialAuthDenialTrackerState: () => AuthDenialTrackerState;
23
+ /** Count distinct unauthorized retries, preserving the streak during each dial. */
24
+ export declare function observeAuthDenial(state: AuthDenialTrackerState, connection: DeepAgentConnectionState, { threshold }?: {
25
+ threshold?: number;
26
+ }): {
27
+ state: AuthDenialTrackerState;
28
+ park: boolean;
29
+ };
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ function chatOutboxAttachmentPath(assetId) {
4
+ return `/api/v0/assets/${encodeURIComponent(assetId)}`;
5
+ }
6
+ function isRecord(value) {
7
+ return typeof value === "object" && value !== null;
8
+ }
9
+ async function verdictOf(response) {
10
+ if (response.status === 403 || response.status === 404) return "refused";
11
+ if (response.status < 200 || response.status >= 300) return "unknown";
12
+ let body;
13
+ try {
14
+ body = await response.json();
15
+ } catch {
16
+ return "unknown";
17
+ }
18
+ if (!isRecord(body)) return "unknown";
19
+ return body.is_archived === true ? "refused" : "ok";
20
+ }
21
+ function createChatOutboxAttachmentCheck({
22
+ readAsset
23
+ }) {
24
+ return async (attachments) => {
25
+ let unknown = false;
26
+ for (const assetId of new Set(attachments.map((attachment) => attachment.assetId))) {
27
+ let verdict;
28
+ try {
29
+ verdict = await verdictOf(await readAsset(assetId));
30
+ } catch {
31
+ verdict = "unknown";
32
+ }
33
+ if (verdict === "refused") return "refused";
34
+ if (verdict === "unknown") unknown = true;
35
+ }
36
+ return unknown ? "unknown" : "ok";
37
+ };
38
+ }
39
+ exports.chatOutboxAttachmentPath = chatOutboxAttachmentPath;
40
+ exports.createChatOutboxAttachmentCheck = createChatOutboxAttachmentCheck;
41
+ //# sourceMappingURL=chat-outbox-attachments.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-outbox-attachments.cjs","sources":["../../../../agent-runtime/src/chat-outbox-attachments.ts"],"sourcesContent":["import type { ChatOutboxAttachment } from \"./chat-outbox-store\";\n\n/**\n * Whether a waiting message's attachments can still be opened, asked of Athena right before the\n * message goes (`chat-outbox.ts`). A held message carries only files that had finished uploading\n * before Athena went out of reach, but one may be deleted, or stop being shared with the person,\n * while it waits: the message must not go with a reference Athena no longer lets them open.\n *\n * Each file is read through agora's permission-checked `GET /api/v0/assets/{id}`\n * (`get_asset_access_context_or_http`: `get_asset_with_permission_check` in the asset's workspace)\n * as the signed-in person. Nothing here grants anything: the run reads every attachment through\n * the same gates again when it uses it.\n */\n\n/** What Athena answered about a waiting message's attachments. */\nexport type ChatOutboxAttachmentVerdict =\n /** Every one is still there and still the person's to open. */\n | \"ok\"\n /** At least one is gone (deleted, or in the trash) or no longer the person's to open. */\n | \"refused\"\n /** Athena could not say: a read failed, timed out, or its credential was refused. */\n | \"unknown\";\n\n/** Asks Athena about a waiting message's attachments. */\nexport type ChatOutboxAttachmentCheck = (\n attachments: readonly ChatOutboxAttachment[],\n) => Promise<ChatOutboxAttachmentVerdict>;\n\n/** agora's permission-checked read of one asset, relative to its API base. */\nexport function chatOutboxAttachmentPath(assetId: string): string {\n return `/api/v0/assets/${encodeURIComponent(assetId)}`;\n}\n\n/** As much of a `fetch` response as the check reads. */\nexport interface ChatOutboxAssetReadResponse {\n status: number;\n json(): Promise<unknown>;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n\nasync function verdictOf(response: ChatOutboxAssetReadResponse): Promise<ChatOutboxAttachmentVerdict> {\n // 404: the asset is gone (or never was); 403: it is no longer the person's to open.\n if (response.status === 403 || response.status === 404) return \"refused\";\n if (response.status < 200 || response.status >= 300) return \"unknown\";\n // A body that does not read (cut off, or not agora's JSON) never says whether the file is in\n // the trash: that is no answer.\n let body: unknown;\n try {\n body = await response.json();\n } catch {\n return \"unknown\";\n }\n if (!isRecord(body)) return \"unknown\";\n // An archived asset is in the trash: deleted, as far as a message is concerned.\n return body.is_archived === true ? \"refused\" : \"ok\";\n}\n\n/**\n * The check a host hands its chat outbox: each attachment read once, in turn, through `readAsset`\n * (`GET {agora}{chatOutboxAttachmentPath(id)}` with the person's credential, renewed once on a\n * refused token where the host can, under the host's own request timeout). `refused` as soon as\n * one is refused; `unknown` when none was refused but one could not be read; else `ok`.\n */\nexport function createChatOutboxAttachmentCheck({\n readAsset,\n}: {\n readAsset: (assetId: string) => Promise<ChatOutboxAssetReadResponse>;\n}): ChatOutboxAttachmentCheck {\n return async (attachments) => {\n let unknown = false;\n for (const assetId of new Set(attachments.map((attachment) => attachment.assetId))) {\n let verdict: ChatOutboxAttachmentVerdict;\n try {\n verdict = await verdictOf(await readAsset(assetId));\n } catch {\n verdict = \"unknown\";\n }\n if (verdict === \"refused\") return \"refused\";\n if (verdict === \"unknown\") unknown = true;\n }\n return unknown ? \"unknown\" : \"ok\";\n };\n}\n"],"names":[],"mappings":";;AA6BO,SAAS,yBAAyB,SAAyB;AAChE,SAAO,kBAAkB,mBAAmB,OAAO,CAAC;AACtD;AAQA,SAAS,SAAS,OAAkD;AAClE,SAAO,OAAO,UAAU,YAAY,UAAU;AAChD;AAEA,eAAe,UAAU,UAA6E;AAEpG,MAAI,SAAS,WAAW,OAAO,SAAS,WAAW,IAAK,QAAO;AAC/D,MAAI,SAAS,SAAS,OAAO,SAAS,UAAU,IAAK,QAAO;AAG5D,MAAI;AACJ,MAAI;AACF,WAAO,MAAM,SAAS,KAAA;AAAA,EACxB,QAAQ;AACN,WAAO;AAAA,EACT;AACA,MAAI,CAAC,SAAS,IAAI,EAAG,QAAO;AAE5B,SAAO,KAAK,gBAAgB,OAAO,YAAY;AACjD;AAQO,SAAS,gCAAgC;AAAA,EAC9C;AACF,GAE8B;AAC5B,SAAO,OAAO,gBAAgB;AAC5B,QAAI,UAAU;AACd,eAAW,WAAW,IAAI,IAAI,YAAY,IAAI,CAAC,eAAe,WAAW,OAAO,CAAC,GAAG;AAClF,UAAI;AACJ,UAAI;AACF,kBAAU,MAAM,UAAU,MAAM,UAAU,OAAO,CAAC;AAAA,MACpD,QAAQ;AACN,kBAAU;AAAA,MACZ;AACA,UAAI,YAAY,UAAW,QAAO;AAClC,UAAI,YAAY,UAAW,WAAU;AAAA,IACvC;AACA,WAAO,UAAU,YAAY;AAAA,EAC/B;AACF;;;"}
@@ -0,0 +1,38 @@
1
+ import type { ChatOutboxAttachment } from "./chat-outbox-store";
2
+ /**
3
+ * Whether a waiting message's attachments can still be opened, asked of Athena right before the
4
+ * message goes (`chat-outbox.ts`). A held message carries only files that had finished uploading
5
+ * before Athena went out of reach, but one may be deleted, or stop being shared with the person,
6
+ * while it waits: the message must not go with a reference Athena no longer lets them open.
7
+ *
8
+ * Each file is read through agora's permission-checked `GET /api/v0/assets/{id}`
9
+ * (`get_asset_access_context_or_http`: `get_asset_with_permission_check` in the asset's workspace)
10
+ * as the signed-in person. Nothing here grants anything: the run reads every attachment through
11
+ * the same gates again when it uses it.
12
+ */
13
+ /** What Athena answered about a waiting message's attachments. */
14
+ export type ChatOutboxAttachmentVerdict =
15
+ /** Every one is still there and still the person's to open. */
16
+ "ok"
17
+ /** At least one is gone (deleted, or in the trash) or no longer the person's to open. */
18
+ | "refused"
19
+ /** Athena could not say: a read failed, timed out, or its credential was refused. */
20
+ | "unknown";
21
+ /** Asks Athena about a waiting message's attachments. */
22
+ export type ChatOutboxAttachmentCheck = (attachments: readonly ChatOutboxAttachment[]) => Promise<ChatOutboxAttachmentVerdict>;
23
+ /** agora's permission-checked read of one asset, relative to its API base. */
24
+ export declare function chatOutboxAttachmentPath(assetId: string): string;
25
+ /** As much of a `fetch` response as the check reads. */
26
+ export interface ChatOutboxAssetReadResponse {
27
+ status: number;
28
+ json(): Promise<unknown>;
29
+ }
30
+ /**
31
+ * The check a host hands its chat outbox: each attachment read once, in turn, through `readAsset`
32
+ * (`GET {agora}{chatOutboxAttachmentPath(id)}` with the person's credential, renewed once on a
33
+ * refused token where the host can, under the host's own request timeout). `refused` as soon as
34
+ * one is refused; `unknown` when none was refused but one could not be read; else `ok`.
35
+ */
36
+ export declare function createChatOutboxAttachmentCheck({ readAsset, }: {
37
+ readAsset: (assetId: string) => Promise<ChatOutboxAssetReadResponse>;
38
+ }): ChatOutboxAttachmentCheck;
@@ -0,0 +1,41 @@
1
+ function chatOutboxAttachmentPath(assetId) {
2
+ return `/api/v0/assets/${encodeURIComponent(assetId)}`;
3
+ }
4
+ function isRecord(value) {
5
+ return typeof value === "object" && value !== null;
6
+ }
7
+ async function verdictOf(response) {
8
+ if (response.status === 403 || response.status === 404) return "refused";
9
+ if (response.status < 200 || response.status >= 300) return "unknown";
10
+ let body;
11
+ try {
12
+ body = await response.json();
13
+ } catch {
14
+ return "unknown";
15
+ }
16
+ if (!isRecord(body)) return "unknown";
17
+ return body.is_archived === true ? "refused" : "ok";
18
+ }
19
+ function createChatOutboxAttachmentCheck({
20
+ readAsset
21
+ }) {
22
+ return async (attachments) => {
23
+ let unknown = false;
24
+ for (const assetId of new Set(attachments.map((attachment) => attachment.assetId))) {
25
+ let verdict;
26
+ try {
27
+ verdict = await verdictOf(await readAsset(assetId));
28
+ } catch {
29
+ verdict = "unknown";
30
+ }
31
+ if (verdict === "refused") return "refused";
32
+ if (verdict === "unknown") unknown = true;
33
+ }
34
+ return unknown ? "unknown" : "ok";
35
+ };
36
+ }
37
+ export {
38
+ chatOutboxAttachmentPath,
39
+ createChatOutboxAttachmentCheck
40
+ };
41
+ //# sourceMappingURL=chat-outbox-attachments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-outbox-attachments.js","sources":["../../../../agent-runtime/src/chat-outbox-attachments.ts"],"sourcesContent":["import type { ChatOutboxAttachment } from \"./chat-outbox-store\";\n\n/**\n * Whether a waiting message's attachments can still be opened, asked of Athena right before the\n * message goes (`chat-outbox.ts`). A held message carries only files that had finished uploading\n * before Athena went out of reach, but one may be deleted, or stop being shared with the person,\n * while it waits: the message must not go with a reference Athena no longer lets them open.\n *\n * Each file is read through agora's permission-checked `GET /api/v0/assets/{id}`\n * (`get_asset_access_context_or_http`: `get_asset_with_permission_check` in the asset's workspace)\n * as the signed-in person. Nothing here grants anything: the run reads every attachment through\n * the same gates again when it uses it.\n */\n\n/** What Athena answered about a waiting message's attachments. */\nexport type ChatOutboxAttachmentVerdict =\n /** Every one is still there and still the person's to open. */\n | \"ok\"\n /** At least one is gone (deleted, or in the trash) or no longer the person's to open. */\n | \"refused\"\n /** Athena could not say: a read failed, timed out, or its credential was refused. */\n | \"unknown\";\n\n/** Asks Athena about a waiting message's attachments. */\nexport type ChatOutboxAttachmentCheck = (\n attachments: readonly ChatOutboxAttachment[],\n) => Promise<ChatOutboxAttachmentVerdict>;\n\n/** agora's permission-checked read of one asset, relative to its API base. */\nexport function chatOutboxAttachmentPath(assetId: string): string {\n return `/api/v0/assets/${encodeURIComponent(assetId)}`;\n}\n\n/** As much of a `fetch` response as the check reads. */\nexport interface ChatOutboxAssetReadResponse {\n status: number;\n json(): Promise<unknown>;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n\nasync function verdictOf(response: ChatOutboxAssetReadResponse): Promise<ChatOutboxAttachmentVerdict> {\n // 404: the asset is gone (or never was); 403: it is no longer the person's to open.\n if (response.status === 403 || response.status === 404) return \"refused\";\n if (response.status < 200 || response.status >= 300) return \"unknown\";\n // A body that does not read (cut off, or not agora's JSON) never says whether the file is in\n // the trash: that is no answer.\n let body: unknown;\n try {\n body = await response.json();\n } catch {\n return \"unknown\";\n }\n if (!isRecord(body)) return \"unknown\";\n // An archived asset is in the trash: deleted, as far as a message is concerned.\n return body.is_archived === true ? \"refused\" : \"ok\";\n}\n\n/**\n * The check a host hands its chat outbox: each attachment read once, in turn, through `readAsset`\n * (`GET {agora}{chatOutboxAttachmentPath(id)}` with the person's credential, renewed once on a\n * refused token where the host can, under the host's own request timeout). `refused` as soon as\n * one is refused; `unknown` when none was refused but one could not be read; else `ok`.\n */\nexport function createChatOutboxAttachmentCheck({\n readAsset,\n}: {\n readAsset: (assetId: string) => Promise<ChatOutboxAssetReadResponse>;\n}): ChatOutboxAttachmentCheck {\n return async (attachments) => {\n let unknown = false;\n for (const assetId of new Set(attachments.map((attachment) => attachment.assetId))) {\n let verdict: ChatOutboxAttachmentVerdict;\n try {\n verdict = await verdictOf(await readAsset(assetId));\n } catch {\n verdict = \"unknown\";\n }\n if (verdict === \"refused\") return \"refused\";\n if (verdict === \"unknown\") unknown = true;\n }\n return unknown ? \"unknown\" : \"ok\";\n };\n}\n"],"names":[],"mappings":"AA6BO,SAAS,yBAAyB,SAAyB;AAChE,SAAO,kBAAkB,mBAAmB,OAAO,CAAC;AACtD;AAQA,SAAS,SAAS,OAAkD;AAClE,SAAO,OAAO,UAAU,YAAY,UAAU;AAChD;AAEA,eAAe,UAAU,UAA6E;AAEpG,MAAI,SAAS,WAAW,OAAO,SAAS,WAAW,IAAK,QAAO;AAC/D,MAAI,SAAS,SAAS,OAAO,SAAS,UAAU,IAAK,QAAO;AAG5D,MAAI;AACJ,MAAI;AACF,WAAO,MAAM,SAAS,KAAA;AAAA,EACxB,QAAQ;AACN,WAAO;AAAA,EACT;AACA,MAAI,CAAC,SAAS,IAAI,EAAG,QAAO;AAE5B,SAAO,KAAK,gBAAgB,OAAO,YAAY;AACjD;AAQO,SAAS,gCAAgC;AAAA,EAC9C;AACF,GAE8B;AAC5B,SAAO,OAAO,gBAAgB;AAC5B,QAAI,UAAU;AACd,eAAW,WAAW,IAAI,IAAI,YAAY,IAAI,CAAC,eAAe,WAAW,OAAO,CAAC,GAAG;AAClF,UAAI;AACJ,UAAI;AACF,kBAAU,MAAM,UAAU,MAAM,UAAU,OAAO,CAAC;AAAA,MACpD,QAAQ;AACN,kBAAU;AAAA,MACZ;AACA,UAAI,YAAY,UAAW,QAAO;AAClC,UAAI,YAAY,UAAW,WAAU;AAAA,IACvC;AACA,WAAO,UAAU,YAAY;AAAA,EAC/B;AACF;"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const host = globalThis;
4
+ function subscribeTo(targets, events, listener) {
5
+ const bound = targets.filter((target) => target !== void 0);
6
+ for (const target of bound) for (const event of events) target.addEventListener(event, listener);
7
+ return () => {
8
+ for (const target of bound) for (const event of events) target.removeEventListener(event, listener);
9
+ };
10
+ }
11
+ function browserOnlineSignal() {
12
+ return {
13
+ get: () => {
14
+ var _a;
15
+ return ((_a = host.navigator) == null ? void 0 : _a.onLine) !== false;
16
+ },
17
+ subscribe: (listener) => subscribeTo([typeof host.addEventListener === "function" ? host : void 0], ["online", "offline"], listener)
18
+ };
19
+ }
20
+ function documentVisibleSignal() {
21
+ return {
22
+ get: () => {
23
+ var _a;
24
+ return ((_a = host.document) == null ? void 0 : _a.visibilityState) !== "hidden";
25
+ },
26
+ subscribe: (listener) => subscribeTo([host.document], ["visibilitychange"], listener)
27
+ };
28
+ }
29
+ function windowInFrontSignal() {
30
+ const windowTarget = typeof host.addEventListener === "function" ? host : void 0;
31
+ return {
32
+ get: () => {
33
+ const document = host.document;
34
+ if (!document) return true;
35
+ if (document.visibilityState === "hidden") return false;
36
+ return typeof document.hasFocus === "function" ? document.hasFocus() : true;
37
+ },
38
+ subscribe: (listener) => {
39
+ const stopDocument = subscribeTo([host.document], ["visibilitychange"], listener);
40
+ const stopWindow = subscribeTo([windowTarget], ["focus", "blur"], listener);
41
+ return () => {
42
+ stopDocument();
43
+ stopWindow();
44
+ };
45
+ }
46
+ };
47
+ }
48
+ function allChatOutboxSignals(...signals) {
49
+ return {
50
+ get: () => signals.every((signal) => signal.get()),
51
+ subscribe: (listener) => {
52
+ const stops = signals.map((signal) => signal.subscribe(listener));
53
+ return () => {
54
+ for (const stop of stops) stop();
55
+ };
56
+ }
57
+ };
58
+ }
59
+ exports.allChatOutboxSignals = allChatOutboxSignals;
60
+ exports.browserOnlineSignal = browserOnlineSignal;
61
+ exports.documentVisibleSignal = documentVisibleSignal;
62
+ exports.windowInFrontSignal = windowInFrontSignal;
63
+ //# sourceMappingURL=chat-outbox-signals.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-outbox-signals.cjs","sources":["../../../../agent-runtime/src/chat-outbox-signals.ts"],"sourcesContent":["import type { ChatOutboxSignal } from \"./chat-outbox\";\n\n/**\n * Default signals for the chat outbox on browser hosts. A host with its own reachability model\n * (Olympus's `athena-reachability`, the mobile app's `connectivity`) passes that instead: \"online\"\n * means the device is online AND agora answers, which the browser alone cannot tell.\n *\n * This package compiles without the DOM lib, so the browser globals are described structurally.\n */\n\ntype EventTargetLike = {\n addEventListener(type: string, listener: () => void): void;\n removeEventListener(type: string, listener: () => void): void;\n};\n\ntype BrowserHost = EventTargetLike & {\n navigator?: { onLine?: boolean };\n document?: EventTargetLike & { visibilityState?: string; hasFocus?: () => boolean };\n};\n\nconst host = globalThis as unknown as Partial<BrowserHost>;\n\nfunction subscribeTo(\n targets: readonly (EventTargetLike | undefined)[],\n events: readonly string[],\n listener: () => void,\n): () => void {\n const bound = targets.filter((target): target is EventTargetLike => target !== undefined);\n for (const target of bound) for (const event of events) target.addEventListener(event, listener);\n return () => {\n for (const target of bound) for (const event of events) target.removeEventListener(event, listener);\n };\n}\n\n/** The browser's own word on the network (`navigator.onLine`); true where there is no browser. */\nexport function browserOnlineSignal(): ChatOutboxSignal {\n return {\n get: () => host.navigator?.onLine !== false,\n subscribe: (listener) =>\n subscribeTo([typeof host.addEventListener === \"function\" ? (host as EventTargetLike) : undefined], [\"online\", \"offline\"], listener),\n };\n}\n\n/** A tab in front: the document is visible (a hidden tab never sends). */\nexport function documentVisibleSignal(): ChatOutboxSignal {\n return {\n get: () => host.document?.visibilityState !== \"hidden\",\n subscribe: (listener) => subscribeTo([host.document], [\"visibilitychange\"], listener),\n };\n}\n\n/**\n * A desktop window in front: visible and focused. An unfocused or minimized window waits until the\n * person comes back to it.\n */\nexport function windowInFrontSignal(): ChatOutboxSignal {\n const windowTarget = typeof host.addEventListener === \"function\" ? (host as EventTargetLike) : undefined;\n return {\n get: () => {\n const document = host.document;\n if (!document) return true;\n if (document.visibilityState === \"hidden\") return false;\n return typeof document.hasFocus === \"function\" ? document.hasFocus() : true;\n },\n subscribe: (listener) => {\n const stopDocument = subscribeTo([host.document], [\"visibilitychange\"], listener);\n const stopWindow = subscribeTo([windowTarget], [\"focus\", \"blur\"], listener);\n return () => {\n stopDocument();\n stopWindow();\n };\n },\n };\n}\n\n/** Both signals at once (e.g. a host's reachability AND the browser being online). */\nexport function allChatOutboxSignals(...signals: readonly ChatOutboxSignal[]): ChatOutboxSignal {\n return {\n get: () => signals.every((signal) => signal.get()),\n subscribe: (listener) => {\n const stops = signals.map((signal) => signal.subscribe(listener));\n return () => {\n for (const stop of stops) stop();\n };\n },\n };\n}\n"],"names":[],"mappings":";;AAoBA,MAAM,OAAO;AAEb,SAAS,YACP,SACA,QACA,UACY;AACZ,QAAM,QAAQ,QAAQ,OAAO,CAAC,WAAsC,WAAW,MAAS;AACxF,aAAW,UAAU,MAAO,YAAW,SAAS,OAAQ,QAAO,iBAAiB,OAAO,QAAQ;AAC/F,SAAO,MAAM;AACX,eAAW,UAAU,MAAO,YAAW,SAAS,OAAQ,QAAO,oBAAoB,OAAO,QAAQ;AAAA,EACpG;AACF;AAGO,SAAS,sBAAwC;AACtD,SAAO;AAAA,IACL,KAAK,MAAA;;AAAM,yBAAK,cAAL,mBAAgB,YAAW;AAAA;AAAA,IACtC,WAAW,CAAC,aACV,YAAY,CAAC,OAAO,KAAK,qBAAqB,aAAc,OAA2B,MAAS,GAAG,CAAC,UAAU,SAAS,GAAG,QAAQ;AAAA,EAAA;AAExI;AAGO,SAAS,wBAA0C;AACxD,SAAO;AAAA,IACL,KAAK,MAAA;;AAAM,yBAAK,aAAL,mBAAe,qBAAoB;AAAA;AAAA,IAC9C,WAAW,CAAC,aAAa,YAAY,CAAC,KAAK,QAAQ,GAAG,CAAC,kBAAkB,GAAG,QAAQ;AAAA,EAAA;AAExF;AAMO,SAAS,sBAAwC;AACtD,QAAM,eAAe,OAAO,KAAK,qBAAqB,aAAc,OAA2B;AAC/F,SAAO;AAAA,IACL,KAAK,MAAM;AACT,YAAM,WAAW,KAAK;AACtB,UAAI,CAAC,SAAU,QAAO;AACtB,UAAI,SAAS,oBAAoB,SAAU,QAAO;AAClD,aAAO,OAAO,SAAS,aAAa,aAAa,SAAS,aAAa;AAAA,IACzE;AAAA,IACA,WAAW,CAAC,aAAa;AACvB,YAAM,eAAe,YAAY,CAAC,KAAK,QAAQ,GAAG,CAAC,kBAAkB,GAAG,QAAQ;AAChF,YAAM,aAAa,YAAY,CAAC,YAAY,GAAG,CAAC,SAAS,MAAM,GAAG,QAAQ;AAC1E,aAAO,MAAM;AACX,qBAAA;AACA,mBAAA;AAAA,MACF;AAAA,IACF;AAAA,EAAA;AAEJ;AAGO,SAAS,wBAAwB,SAAwD;AAC9F,SAAO;AAAA,IACL,KAAK,MAAM,QAAQ,MAAM,CAAC,WAAW,OAAO,KAAK;AAAA,IACjD,WAAW,CAAC,aAAa;AACvB,YAAM,QAAQ,QAAQ,IAAI,CAAC,WAAW,OAAO,UAAU,QAAQ,CAAC;AAChE,aAAO,MAAM;AACX,mBAAW,QAAQ,MAAO,MAAA;AAAA,MAC5B;AAAA,IACF;AAAA,EAAA;AAEJ;;;;;"}
@@ -0,0 +1,12 @@
1
+ import type { ChatOutboxSignal } from "./chat-outbox";
2
+ /** The browser's own word on the network (`navigator.onLine`); true where there is no browser. */
3
+ export declare function browserOnlineSignal(): ChatOutboxSignal;
4
+ /** A tab in front: the document is visible (a hidden tab never sends). */
5
+ export declare function documentVisibleSignal(): ChatOutboxSignal;
6
+ /**
7
+ * A desktop window in front: visible and focused. An unfocused or minimized window waits until the
8
+ * person comes back to it.
9
+ */
10
+ export declare function windowInFrontSignal(): ChatOutboxSignal;
11
+ /** Both signals at once (e.g. a host's reachability AND the browser being online). */
12
+ export declare function allChatOutboxSignals(...signals: readonly ChatOutboxSignal[]): ChatOutboxSignal;