@athenaintel/react 0.42.2 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (685) hide show
  1. package/README.md +225 -3
  2. package/dist/agent-runtime/src/answer-label.cjs +137 -0
  3. package/dist/agent-runtime/src/answer-label.cjs.map +1 -0
  4. package/dist/agent-runtime/src/answer-label.d.ts +104 -0
  5. package/dist/agent-runtime/src/answer-label.js +137 -0
  6. package/dist/agent-runtime/src/answer-label.js.map +1 -0
  7. package/dist/agent-runtime/src/answer-rows.cjs +180 -0
  8. package/dist/agent-runtime/src/answer-rows.cjs.map +1 -0
  9. package/dist/agent-runtime/src/answer-rows.d.ts +86 -0
  10. package/dist/agent-runtime/src/answer-rows.js +180 -0
  11. package/dist/agent-runtime/src/answer-rows.js.map +1 -0
  12. package/dist/agent-runtime/src/client-tool-bridge.cjs +15 -15
  13. package/dist/agent-runtime/src/client-tool-bridge.cjs.map +1 -1
  14. package/dist/agent-runtime/src/conversation-index.cjs +8 -8
  15. package/dist/agent-runtime/src/conversation-index.cjs.map +1 -1
  16. package/dist/agent-runtime/src/conversation-list-groups.d.ts +74 -0
  17. package/dist/agent-runtime/src/decision-checks.cjs +207 -0
  18. package/dist/agent-runtime/src/decision-checks.cjs.map +1 -0
  19. package/dist/agent-runtime/src/decision-checks.d.ts +142 -0
  20. package/dist/agent-runtime/src/decision-checks.js +207 -0
  21. package/dist/agent-runtime/src/decision-checks.js.map +1 -0
  22. package/dist/agent-runtime/src/desktop-handoff.d.ts +12 -0
  23. package/dist/agent-runtime/src/errors.cjs +18 -0
  24. package/dist/agent-runtime/src/errors.cjs.map +1 -1
  25. package/dist/agent-runtime/src/errors.d.ts +7 -0
  26. package/dist/agent-runtime/src/errors.js +18 -0
  27. package/dist/agent-runtime/src/errors.js.map +1 -1
  28. package/dist/agent-runtime/src/generated/runconfig-contract.cjs +12 -0
  29. package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
  30. package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +6 -6
  31. package/dist/agent-runtime/src/generated/runconfig-contract.js +12 -0
  32. package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
  33. package/dist/agent-runtime/src/handoff-arrival.cjs +60 -0
  34. package/dist/agent-runtime/src/handoff-arrival.cjs.map +1 -0
  35. package/dist/agent-runtime/src/handoff-arrival.d.ts +46 -0
  36. package/dist/agent-runtime/src/handoff-arrival.js +60 -0
  37. package/dist/agent-runtime/src/handoff-arrival.js.map +1 -0
  38. package/dist/agent-runtime/src/index.d.ts +15 -8
  39. package/dist/agent-runtime/src/interrupts.cjs +43 -18
  40. package/dist/agent-runtime/src/interrupts.cjs.map +1 -1
  41. package/dist/agent-runtime/src/interrupts.d.ts +19 -2
  42. package/dist/agent-runtime/src/interrupts.js +28 -3
  43. package/dist/agent-runtime/src/interrupts.js.map +1 -1
  44. package/dist/agent-runtime/src/lane-history.cjs +8 -8
  45. package/dist/agent-runtime/src/lane-history.cjs.map +1 -1
  46. package/dist/agent-runtime/src/messages.cjs +43 -8
  47. package/dist/agent-runtime/src/messages.cjs.map +1 -1
  48. package/dist/agent-runtime/src/messages.d.ts +25 -3
  49. package/dist/agent-runtime/src/messages.js +43 -8
  50. package/dist/agent-runtime/src/messages.js.map +1 -1
  51. package/dist/agent-runtime/src/offline-status.cjs +36 -0
  52. package/dist/agent-runtime/src/offline-status.cjs.map +1 -0
  53. package/dist/agent-runtime/src/offline-status.d.ts +118 -3
  54. package/dist/agent-runtime/src/offline-status.js +36 -0
  55. package/dist/agent-runtime/src/offline-status.js.map +1 -0
  56. package/dist/agent-runtime/src/queue.cjs +0 -9
  57. package/dist/agent-runtime/src/queue.cjs.map +1 -1
  58. package/dist/agent-runtime/src/queue.js +0 -9
  59. package/dist/agent-runtime/src/queue.js.map +1 -1
  60. package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs +9 -9
  61. package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
  62. package/dist/agent-runtime/src/runtime-catalog.cjs +42 -0
  63. package/dist/agent-runtime/src/runtime-catalog.cjs.map +1 -0
  64. package/dist/agent-runtime/src/runtime-catalog.d.ts +35 -0
  65. package/dist/agent-runtime/src/runtime-catalog.js +42 -0
  66. package/dist/agent-runtime/src/runtime-catalog.js.map +1 -0
  67. package/dist/agent-runtime/src/runtime-messages.cjs.map +1 -1
  68. package/dist/agent-runtime/src/runtime-messages.d.ts +1 -1
  69. package/dist/agent-runtime/src/runtime-messages.js.map +1 -1
  70. package/dist/agent-runtime/src/runtime.d.ts +40 -0
  71. package/dist/agent-runtime/src/statewire-suspended.cjs +3 -3
  72. package/dist/agent-runtime/src/statewire-suspended.cjs.map +1 -1
  73. package/dist/agent-runtime/src/subagents.cjs +32 -2
  74. package/dist/agent-runtime/src/subagents.cjs.map +1 -1
  75. package/dist/agent-runtime/src/subagents.d.ts +9 -0
  76. package/dist/agent-runtime/src/subagents.js +30 -0
  77. package/dist/agent-runtime/src/subagents.js.map +1 -1
  78. package/dist/agent-runtime/src/thread-driver.cjs +67 -0
  79. package/dist/agent-runtime/src/thread-driver.cjs.map +1 -0
  80. package/dist/agent-runtime/src/thread-driver.d.ts +49 -0
  81. package/dist/agent-runtime/src/thread-driver.js +67 -0
  82. package/dist/agent-runtime/src/thread-driver.js.map +1 -0
  83. package/dist/agent-runtime/src/thread-handoff-flow-machine.d.ts +172 -0
  84. package/dist/agent-runtime/src/thread-handoff-protocol.d.ts +756 -0
  85. package/dist/agent-runtime/src/thread-handoff-qr.d.ts +11 -0
  86. package/dist/agent-runtime/src/thread-handoff.d.ts +3 -364
  87. package/dist/agent-runtime/src/thread-status.cjs +3 -3
  88. package/dist/agent-runtime/src/thread-status.cjs.map +1 -1
  89. package/dist/agent-runtime/src/tool-metadata.cjs +210 -33
  90. package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -1
  91. package/dist/agent-runtime/src/tool-metadata.d.ts +12 -0
  92. package/dist/agent-runtime/src/tool-metadata.js +210 -33
  93. package/dist/agent-runtime/src/tool-metadata.js.map +1 -1
  94. package/dist/agent-runtime/src/tool-names.cjs +2 -0
  95. package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
  96. package/dist/agent-runtime/src/tool-names.d.ts +2 -0
  97. package/dist/agent-runtime/src/tool-names.js +2 -0
  98. package/dist/agent-runtime/src/tool-names.js.map +1 -1
  99. package/dist/agent-runtime/src/types.d.ts +10 -2
  100. package/dist/agent-runtime/src/use-conversation-list.cjs +11 -11
  101. package/dist/agent-runtime/src/use-conversation-list.cjs.map +1 -1
  102. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +24 -19
  103. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -1
  104. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +2 -1
  105. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +6 -1
  106. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -1
  107. package/dist/agent-runtime/src/use-deep-agent-config.cjs +14 -14
  108. package/dist/agent-runtime/src/use-deep-agent-config.cjs.map +1 -1
  109. package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs +6 -6
  110. package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
  111. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +16 -16
  112. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
  113. package/dist/agent-runtime/src/use-deep-agent-thread.cjs +45 -45
  114. package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
  115. package/dist/agent-runtime/src/use-deep-agent-voice.cjs +572 -134
  116. package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -1
  117. package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +137 -10
  118. package/dist/agent-runtime/src/use-deep-agent-voice.js +514 -76
  119. package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -1
  120. package/dist/agent-runtime/src/use-deep-agent-window-sync.cjs +26 -26
  121. package/dist/agent-runtime/src/use-deep-agent-window-sync.cjs.map +1 -1
  122. package/dist/agent-runtime/src/use-historical-edit-attachments.cjs +4 -4
  123. package/dist/agent-runtime/src/use-historical-edit-attachments.cjs.map +1 -1
  124. package/dist/agent-runtime/src/use-thread-handoff-flow.d.ts +28 -26
  125. package/dist/agent-runtime/src/voice-media.cjs +117 -0
  126. package/dist/agent-runtime/src/voice-media.cjs.map +1 -0
  127. package/dist/agent-runtime/src/voice-media.d.ts +49 -0
  128. package/dist/agent-runtime/src/voice-media.js +117 -0
  129. package/dist/agent-runtime/src/voice-media.js.map +1 -0
  130. package/dist/agent-runtime/src/voice-wire-types.d.ts +32 -0
  131. package/dist/assets/AssetPanel.cjs +11 -11
  132. package/dist/assets/AssetPanel.cjs.map +1 -1
  133. package/dist/assets/AthenaAssetEmbed.cjs +11 -9
  134. package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
  135. package/dist/assets/AthenaAssetEmbed.d.ts +7 -0
  136. package/dist/assets/AthenaAssetEmbed.js +4 -2
  137. package/dist/assets/AthenaAssetEmbed.js.map +1 -1
  138. package/dist/assets/AthenaLayout.cjs +16 -16
  139. package/dist/assets/AthenaLayout.cjs.map +1 -1
  140. package/dist/assets/use-asset-content.cjs +4 -4
  141. package/dist/assets/use-asset-content.cjs.map +1 -1
  142. package/dist/assets/use-asset-embed.cjs +14 -7
  143. package/dist/assets/use-asset-embed.cjs.map +1 -1
  144. package/dist/assets/use-asset-embed.d.ts +11 -1
  145. package/dist/assets/use-asset-embed.js +10 -3
  146. package/dist/assets/use-asset-embed.js.map +1 -1
  147. package/dist/auth/AthenaAuthContext.cjs +3 -3
  148. package/dist/auth/AthenaAuthContext.cjs.map +1 -1
  149. package/dist/auth/AthenaAuthProvider.cjs +8 -8
  150. package/dist/auth/AthenaAuthProvider.cjs.map +1 -1
  151. package/dist/auth/AthenaCredentialSourceContext.cjs +5 -5
  152. package/dist/auth/AthenaCredentialSourceContext.cjs.map +1 -1
  153. package/dist/auth/AthenaSSOProvider.cjs +14 -14
  154. package/dist/auth/AthenaSSOProvider.cjs.map +1 -1
  155. package/dist/auth/credential-source.cjs +26 -13
  156. package/dist/auth/credential-source.cjs.map +1 -1
  157. package/dist/auth/credential-source.d.ts +8 -0
  158. package/dist/auth/credential-source.js +26 -13
  159. package/dist/auth/credential-source.js.map +1 -1
  160. package/dist/catalog/agent-model-options.cjs +25 -17
  161. package/dist/catalog/agent-model-options.cjs.map +1 -1
  162. package/dist/catalog/agent-model-options.d.ts +38 -5
  163. package/dist/catalog/agent-model-options.js +25 -17
  164. package/dist/catalog/agent-model-options.js.map +1 -1
  165. package/dist/catalog/channel-refusal.cjs +36 -0
  166. package/dist/catalog/channel-refusal.cjs.map +1 -0
  167. package/dist/catalog/channel-refusal.d.ts +29 -0
  168. package/dist/catalog/channel-refusal.js +36 -0
  169. package/dist/catalog/channel-refusal.js.map +1 -0
  170. package/dist/catalog/chat-pickers.cjs +60 -24
  171. package/dist/catalog/chat-pickers.cjs.map +1 -1
  172. package/dist/catalog/chat-pickers.d.ts +12 -2
  173. package/dist/catalog/chat-pickers.js +56 -20
  174. package/dist/catalog/chat-pickers.js.map +1 -1
  175. package/dist/catalog/runtime-catalog.cjs +89 -23
  176. package/dist/catalog/runtime-catalog.cjs.map +1 -1
  177. package/dist/catalog/runtime-catalog.d.ts +8 -2
  178. package/dist/catalog/runtime-catalog.js +83 -17
  179. package/dist/catalog/runtime-catalog.js.map +1 -1
  180. package/dist/catalog/use-athena-chat-mode.cjs +12 -12
  181. package/dist/catalog/use-athena-chat-mode.cjs.map +1 -1
  182. package/dist/chat/AthenaChat.cjs +155 -67
  183. package/dist/chat/AthenaChat.cjs.map +1 -1
  184. package/dist/chat/AthenaChat.d.ts +42 -2
  185. package/dist/chat/AthenaChat.js +106 -18
  186. package/dist/chat/AthenaChat.js.map +1 -1
  187. package/dist/chat/AthenaChatErrorBoundary.cjs +3 -3
  188. package/dist/chat/AthenaChatErrorBoundary.cjs.map +1 -1
  189. package/dist/chat/DrivingOnChip.cjs +23 -0
  190. package/dist/chat/DrivingOnChip.cjs.map +1 -0
  191. package/dist/chat/DrivingOnChip.d.ts +17 -0
  192. package/dist/chat/DrivingOnChip.js +23 -0
  193. package/dist/chat/DrivingOnChip.js.map +1 -0
  194. package/dist/chat/StatewireApprovalCard.cjs +125 -31
  195. package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
  196. package/dist/chat/StatewireApprovalCard.d.ts +73 -1
  197. package/dist/chat/StatewireApprovalCard.js +115 -21
  198. package/dist/chat/StatewireApprovalCard.js.map +1 -1
  199. package/dist/chat/StatewireClientToolBridge.cjs +2 -2
  200. package/dist/chat/StatewireClientToolBridge.cjs.map +1 -1
  201. package/dist/chat/StatewireQueuedMessages.cjs +25 -63
  202. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
  203. package/dist/chat/StatewireQueuedMessages.d.ts +11 -13
  204. package/dist/chat/StatewireQueuedMessages.js +16 -54
  205. package/dist/chat/StatewireQueuedMessages.js.map +1 -1
  206. package/dist/chat/WaitingOnYouBanner.cjs +3 -3
  207. package/dist/chat/WaitingOnYouBanner.cjs.map +1 -1
  208. package/dist/chat/athena-chat-welcome.cjs +2 -2
  209. package/dist/chat/athena-chat-welcome.cjs.map +1 -1
  210. package/dist/chat/athena-citation-links.cjs +5 -5
  211. package/dist/chat/athena-citation-links.cjs.map +1 -1
  212. package/dist/chat/athena-composer-controls.cjs +26 -16
  213. package/dist/chat/athena-composer-controls.cjs.map +1 -1
  214. package/dist/chat/athena-composer-controls.d.ts +6 -0
  215. package/dist/chat/athena-composer-controls.js +26 -16
  216. package/dist/chat/athena-composer-controls.js.map +1 -1
  217. package/dist/chat/athena-turn-end-status.cjs +42 -0
  218. package/dist/chat/athena-turn-end-status.cjs.map +1 -0
  219. package/dist/chat/athena-turn-end-status.d.ts +24 -0
  220. package/dist/chat/athena-turn-end-status.js +42 -0
  221. package/dist/chat/athena-turn-end-status.js.map +1 -0
  222. package/dist/chat/browser-decision-check.cjs +131 -0
  223. package/dist/chat/browser-decision-check.cjs.map +1 -0
  224. package/dist/chat/browser-decision-check.d.ts +61 -0
  225. package/dist/chat/browser-decision-check.js +131 -0
  226. package/dist/chat/browser-decision-check.js.map +1 -0
  227. package/dist/chat/chat-outbox-rows.cjs +3 -3
  228. package/dist/chat/chat-outbox-rows.cjs.map +1 -1
  229. package/dist/chat/chat-voice-controls.cjs +93 -28
  230. package/dist/chat/chat-voice-controls.cjs.map +1 -1
  231. package/dist/chat/chat-voice-controls.d.ts +36 -2
  232. package/dist/chat/chat-voice-controls.js +89 -24
  233. package/dist/chat/chat-voice-controls.js.map +1 -1
  234. package/dist/chat/composer-keyboard-hint.cjs +5 -5
  235. package/dist/chat/composer-keyboard-hint.cjs.map +1 -1
  236. package/dist/chat/device-operation.cjs +29 -0
  237. package/dist/chat/device-operation.cjs.map +1 -0
  238. package/dist/chat/device-operation.d.ts +34 -0
  239. package/dist/chat/device-operation.js +29 -0
  240. package/dist/chat/device-operation.js.map +1 -0
  241. package/dist/chat/super-grouping/CollapsibleGroup.cjs +14 -14
  242. package/dist/chat/super-grouping/CollapsibleGroup.cjs.map +1 -1
  243. package/dist/chat/super-grouping/GroupedMessageParts.cjs +4 -4
  244. package/dist/chat/super-grouping/GroupedMessageParts.cjs.map +1 -1
  245. package/dist/chat/super-grouping/SuperGroupingCard.cjs +60 -38
  246. package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
  247. package/dist/chat/super-grouping/SuperGroupingCard.d.ts +24 -4
  248. package/dist/chat/super-grouping/SuperGroupingCard.js +37 -15
  249. package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
  250. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +32 -32
  251. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -1
  252. package/dist/chat/super-grouping/SuperGroupingTranscript.js +3 -3
  253. package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -1
  254. package/dist/chat/super-grouping/ToolTimeline.cjs +97 -37
  255. package/dist/chat/super-grouping/ToolTimeline.cjs.map +1 -1
  256. package/dist/chat/super-grouping/ToolTimeline.d.ts +14 -2
  257. package/dist/chat/super-grouping/ToolTimeline.js +94 -34
  258. package/dist/chat/super-grouping/ToolTimeline.js.map +1 -1
  259. package/dist/chat/super-grouping/activity-timeline.cjs +47 -12
  260. package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
  261. package/dist/chat/super-grouping/activity-timeline.d.ts +21 -0
  262. package/dist/chat/super-grouping/activity-timeline.js +47 -12
  263. package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
  264. package/dist/chat/super-grouping/grouping-function.cjs +4 -0
  265. package/dist/chat/super-grouping/grouping-function.cjs.map +1 -1
  266. package/dist/chat/super-grouping/grouping-function.d.ts +7 -0
  267. package/dist/chat/super-grouping/grouping-function.js +5 -1
  268. package/dist/chat/super-grouping/grouping-function.js.map +1 -1
  269. package/dist/chat/super-grouping/index.cjs +6 -0
  270. package/dist/chat/super-grouping/index.cjs.map +1 -1
  271. package/dist/chat/super-grouping/index.d.ts +6 -2
  272. package/dist/chat/super-grouping/index.js +7 -1
  273. package/dist/chat/super-grouping/index.js.map +1 -1
  274. package/dist/chat/super-grouping/timeline-step.cjs +61 -2
  275. package/dist/chat/super-grouping/timeline-step.cjs.map +1 -1
  276. package/dist/chat/super-grouping/timeline-step.d.ts +13 -1
  277. package/dist/chat/super-grouping/timeline-step.js +61 -2
  278. package/dist/chat/super-grouping/timeline-step.js.map +1 -1
  279. package/dist/chat/super-grouping/tool-part-placement.cjs +17 -0
  280. package/dist/chat/super-grouping/tool-part-placement.cjs.map +1 -0
  281. package/dist/chat/super-grouping/tool-part-placement.d.ts +22 -0
  282. package/dist/chat/super-grouping/tool-part-placement.js +17 -0
  283. package/dist/chat/super-grouping/tool-part-placement.js.map +1 -0
  284. package/dist/chat/thread-scroll-to-bottom.cjs +2 -2
  285. package/dist/chat/thread-scroll-to-bottom.cjs.map +1 -1
  286. package/dist/chat/thread-scroll-to-bottom.d.ts +10 -7
  287. package/dist/chat/thread-scroll-to-bottom.js +2 -2
  288. package/dist/chat/thread-scroll-to-bottom.js.map +1 -1
  289. package/dist/chat/tooltip-icon-button.cjs +2 -2
  290. package/dist/chat/tooltip-icon-button.cjs.map +1 -1
  291. package/dist/chat/use-athena-voice-live.cjs +11 -0
  292. package/dist/chat/use-athena-voice-live.cjs.map +1 -0
  293. package/dist/chat/use-athena-voice-live.d.ts +11 -0
  294. package/dist/chat/use-athena-voice-live.js +11 -0
  295. package/dist/chat/use-athena-voice-live.js.map +1 -0
  296. package/dist/chat/use-statewire-approval-request.cjs +56 -24
  297. package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
  298. package/dist/chat/use-statewire-approval-request.d.ts +33 -4
  299. package/dist/chat/use-statewire-approval-request.js +41 -9
  300. package/dist/chat/use-statewire-approval-request.js.map +1 -1
  301. package/dist/chat-ui/auth/sign-in-card.cjs +2 -2
  302. package/dist/chat-ui/auth/sign-in-card.cjs.map +1 -1
  303. package/dist/chat-ui/composer/tiptap-composer.cjs +138 -107
  304. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
  305. package/dist/chat-ui/composer/tiptap-composer.d.ts +20 -4
  306. package/dist/chat-ui/composer/tiptap-composer.js +85 -54
  307. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
  308. package/dist/chat-ui/header/conversation-history-panel.cjs +49 -23
  309. package/dist/chat-ui/header/conversation-history-panel.cjs.map +1 -1
  310. package/dist/chat-ui/header/conversation-history-panel.d.ts +12 -1
  311. package/dist/chat-ui/header/conversation-history-panel.js +38 -12
  312. package/dist/chat-ui/header/conversation-history-panel.js.map +1 -1
  313. package/dist/chat-ui/index.cjs +18 -0
  314. package/dist/chat-ui/index.cjs.map +1 -1
  315. package/dist/chat-ui/index.d.ts +7 -1
  316. package/dist/chat-ui/index.js +18 -0
  317. package/dist/chat-ui/index.js.map +1 -1
  318. package/dist/chat-ui/mentions/mention-chip.cjs +147 -38
  319. package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
  320. package/dist/chat-ui/mentions/mention-chip.d.ts +17 -1
  321. package/dist/chat-ui/mentions/mention-chip.js +146 -37
  322. package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
  323. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs +10 -9
  324. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs.map +1 -1
  325. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js +3 -2
  326. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js.map +1 -1
  327. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs +2 -2
  328. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs.map +1 -1
  329. package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs +29 -6
  330. package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs.map +1 -1
  331. package/dist/chat-ui/mentions/suggestions/components/menu-list.d.ts +7 -1
  332. package/dist/chat-ui/mentions/suggestions/components/menu-list.js +25 -2
  333. package/dist/chat-ui/mentions/suggestions/components/menu-list.js.map +1 -1
  334. package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.cjs +2 -2
  335. package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.cjs.map +1 -1
  336. package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.cjs +2 -2
  337. package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.cjs.map +1 -1
  338. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +3 -3
  339. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
  340. package/dist/chat-ui/mentions/suggestions/data/orchestrator.cjs +56 -2
  341. package/dist/chat-ui/mentions/suggestions/data/orchestrator.cjs.map +1 -1
  342. package/dist/chat-ui/mentions/suggestions/data/orchestrator.d.ts +12 -0
  343. package/dist/chat-ui/mentions/suggestions/data/orchestrator.js +56 -2
  344. package/dist/chat-ui/mentions/suggestions/data/orchestrator.js.map +1 -1
  345. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +24 -3
  346. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -1
  347. package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +7 -0
  348. package/dist/chat-ui/mentions/suggestions/data/sources/index.js +24 -3
  349. package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
  350. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs +35 -13
  351. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs.map +1 -1
  352. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.d.ts +15 -1
  353. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js +28 -6
  354. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js.map +1 -1
  355. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.cjs +9 -6
  356. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.cjs.map +1 -1
  357. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.d.ts +3 -0
  358. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.js +5 -2
  359. package/dist/chat-ui/mentions/suggestions/data/use-menu-items.js.map +1 -1
  360. package/dist/chat-ui/mentions/use-account-workspace-id.cjs +45 -10
  361. package/dist/chat-ui/mentions/use-account-workspace-id.cjs.map +1 -1
  362. package/dist/chat-ui/mentions/use-account-workspace-id.d.ts +24 -1
  363. package/dist/chat-ui/mentions/use-account-workspace-id.js +46 -11
  364. package/dist/chat-ui/mentions/use-account-workspace-id.js.map +1 -1
  365. package/dist/chat-ui/mentions/use-member-avatar.cjs +4 -4
  366. package/dist/chat-ui/mentions/use-member-avatar.cjs.map +1 -1
  367. package/dist/chat-ui/mentions/use-mention-asset.cjs +140 -0
  368. package/dist/chat-ui/mentions/use-mention-asset.cjs.map +1 -0
  369. package/dist/chat-ui/mentions/use-mention-asset.d.ts +16 -0
  370. package/dist/chat-ui/mentions/use-mention-asset.js +140 -0
  371. package/dist/chat-ui/mentions/use-mention-asset.js.map +1 -0
  372. package/dist/chat-ui/messages/answer-label.cjs +42 -0
  373. package/dist/chat-ui/messages/answer-label.cjs.map +1 -0
  374. package/dist/chat-ui/messages/answer-label.d.ts +33 -0
  375. package/dist/chat-ui/messages/answer-label.js +42 -0
  376. package/dist/chat-ui/messages/answer-label.js.map +1 -0
  377. package/dist/chat-ui/messages/arrival-animation.cjs +13 -0
  378. package/dist/chat-ui/messages/arrival-animation.cjs.map +1 -0
  379. package/dist/chat-ui/messages/arrival-animation.d.ts +14 -0
  380. package/dist/chat-ui/messages/arrival-animation.js +13 -0
  381. package/dist/chat-ui/messages/arrival-animation.js.map +1 -0
  382. package/dist/chat-ui/messages/continue-pill.cjs +5 -5
  383. package/dist/chat-ui/messages/continue-pill.cjs.map +1 -1
  384. package/dist/chat-ui/messages/handoff-arrival-divider.cjs +44 -0
  385. package/dist/chat-ui/messages/handoff-arrival-divider.cjs.map +1 -0
  386. package/dist/chat-ui/messages/handoff-arrival-divider.d.ts +17 -0
  387. package/dist/chat-ui/messages/handoff-arrival-divider.js +44 -0
  388. package/dist/chat-ui/messages/handoff-arrival-divider.js.map +1 -0
  389. package/dist/chat-ui/messages/message-actions-config.cjs +3 -3
  390. package/dist/chat-ui/messages/message-actions-config.cjs.map +1 -1
  391. package/dist/chat-ui/messages/message-components.cjs +8 -4
  392. package/dist/chat-ui/messages/message-components.cjs.map +1 -1
  393. package/dist/chat-ui/messages/message-components.js +5 -1
  394. package/dist/chat-ui/messages/message-components.js.map +1 -1
  395. package/dist/chat-ui/messages/message-images.cjs +66 -0
  396. package/dist/chat-ui/messages/message-images.cjs.map +1 -0
  397. package/dist/chat-ui/messages/message-images.d.ts +16 -0
  398. package/dist/chat-ui/messages/message-images.js +66 -0
  399. package/dist/chat-ui/messages/message-images.js.map +1 -0
  400. package/dist/chat-ui/messages/user-edit-composer.cjs +2 -2
  401. package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
  402. package/dist/chat-ui/messages/wake-marker.cjs +3 -3
  403. package/dist/chat-ui/messages/wake-marker.cjs.map +1 -1
  404. package/dist/chat-ui/rich-text/chat-link.cjs +7 -6
  405. package/dist/chat-ui/rich-text/chat-link.cjs.map +1 -1
  406. package/dist/chat-ui/rich-text/chat-link.d.ts +2 -3
  407. package/dist/chat-ui/rich-text/chat-link.js +6 -5
  408. package/dist/chat-ui/rich-text/chat-link.js.map +1 -1
  409. package/dist/chat-ui/rich-text/chat-message-body.cjs +8 -8
  410. package/dist/chat-ui/rich-text/chat-message-body.cjs.map +1 -1
  411. package/dist/chat-ui/rich-text/chat-node-views.cjs +7 -6
  412. package/dist/chat-ui/rich-text/chat-node-views.cjs.map +1 -1
  413. package/dist/chat-ui/rich-text/chat-node-views.js +1 -0
  414. package/dist/chat-ui/rich-text/chat-node-views.js.map +1 -1
  415. package/dist/chat-ui/rich-text/dom-output-spec.cjs +2 -2
  416. package/dist/chat-ui/rich-text/dom-output-spec.cjs.map +1 -1
  417. package/dist/chat-ui/statewire.cjs +3 -0
  418. package/dist/chat-ui/statewire.cjs.map +1 -1
  419. package/dist/chat-ui/statewire.d.ts +2 -1
  420. package/dist/chat-ui/statewire.js +3 -0
  421. package/dist/chat-ui/statewire.js.map +1 -1
  422. package/dist/chat-ui/thread/chat-thread-shell.cjs +43 -14
  423. package/dist/chat-ui/thread/chat-thread-shell.cjs.map +1 -1
  424. package/dist/chat-ui/thread/chat-thread-shell.d.ts +16 -2
  425. package/dist/chat-ui/thread/chat-thread-shell.js +35 -6
  426. package/dist/chat-ui/thread/chat-thread-shell.js.map +1 -1
  427. package/dist/chat-ui/thread/composer-send-or-stop.cjs +30 -20
  428. package/dist/chat-ui/thread/composer-send-or-stop.cjs.map +1 -1
  429. package/dist/chat-ui/thread/composer-send-or-stop.d.ts +8 -0
  430. package/dist/chat-ui/thread/composer-send-or-stop.js +29 -19
  431. package/dist/chat-ui/thread/composer-send-or-stop.js.map +1 -1
  432. package/dist/chat-ui/thread/statewire-history-edge.cjs +20 -21
  433. package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
  434. package/dist/chat-ui/thread/statewire-history-edge.js +3 -4
  435. package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
  436. package/dist/chat-ui/thread/thread-loading-overlay.cjs +5 -5
  437. package/dist/chat-ui/thread/thread-loading-overlay.cjs.map +1 -1
  438. package/dist/collab/client.cjs +40 -3
  439. package/dist/collab/client.cjs.map +1 -1
  440. package/dist/collab/client.d.ts +25 -0
  441. package/dist/collab/client.js +40 -3
  442. package/dist/collab/client.js.map +1 -1
  443. package/dist/collab/document-status.cjs +150 -0
  444. package/dist/collab/document-status.cjs.map +1 -0
  445. package/dist/collab/document-status.d.ts +68 -0
  446. package/dist/collab/document-status.js +150 -0
  447. package/dist/collab/document-status.js.map +1 -0
  448. package/dist/collab/index.cjs +7 -0
  449. package/dist/collab/index.cjs.map +1 -1
  450. package/dist/collab/index.d.ts +6 -1
  451. package/dist/collab/index.js +7 -0
  452. package/dist/collab/index.js.map +1 -1
  453. package/dist/collab/presence-react.cjs +11 -11
  454. package/dist/collab/presence-react.cjs.map +1 -1
  455. package/dist/collab/react.cjs +6 -6
  456. package/dist/collab/react.cjs.map +1 -1
  457. package/dist/composer/AttachmentContext.cjs +24 -11
  458. package/dist/composer/AttachmentContext.cjs.map +1 -1
  459. package/dist/composer/AttachmentContext.js +18 -5
  460. package/dist/composer/AttachmentContext.js.map +1 -1
  461. package/dist/composer/ComposerAttachmentPreview.cjs +78 -23
  462. package/dist/composer/ComposerAttachmentPreview.cjs.map +1 -1
  463. package/dist/composer/ComposerAttachmentPreview.d.ts +5 -3
  464. package/dist/composer/ComposerAttachmentPreview.js +79 -24
  465. package/dist/composer/ComposerAttachmentPreview.js.map +1 -1
  466. package/dist/composer/ComposerDropZone.cjs +7 -7
  467. package/dist/composer/ComposerDropZone.cjs.map +1 -1
  468. package/dist/composer/FileUploadButton.cjs +37 -22
  469. package/dist/composer/FileUploadButton.cjs.map +1 -1
  470. package/dist/composer/FileUploadButton.d.ts +6 -0
  471. package/dist/composer/FileUploadButton.js +34 -19
  472. package/dist/composer/FileUploadButton.js.map +1 -1
  473. package/dist/composer/QuoteContext.cjs +8 -8
  474. package/dist/composer/QuoteContext.cjs.map +1 -1
  475. package/dist/composer/composer-handoff.cjs +4 -4
  476. package/dist/composer/composer-handoff.cjs.map +1 -1
  477. package/dist/composer/useAppendToComposer.cjs +4 -4
  478. package/dist/composer/useAppendToComposer.cjs.map +1 -1
  479. package/dist/composer/useAttachFiles.cjs +23 -6
  480. package/dist/composer/useAttachFiles.cjs.map +1 -1
  481. package/dist/composer/useAttachFiles.d.ts +15 -7
  482. package/dist/composer/useAttachFiles.js +22 -5
  483. package/dist/composer/useAttachFiles.js.map +1 -1
  484. package/dist/composer/useComposerAttachment.cjs +4 -4
  485. package/dist/composer/useComposerAttachment.cjs.map +1 -1
  486. package/dist/composer/useFileUpload.cjs +21 -16
  487. package/dist/composer/useFileUpload.cjs.map +1 -1
  488. package/dist/composer/useFileUpload.d.ts +12 -0
  489. package/dist/composer/useFileUpload.js +12 -7
  490. package/dist/composer/useFileUpload.js.map +1 -1
  491. package/dist/composer/useReadComposerDraft.cjs +2 -2
  492. package/dist/composer/useReadComposerDraft.cjs.map +1 -1
  493. package/dist/composer/useSendMessage.cjs +4 -4
  494. package/dist/composer/useSendMessage.cjs.map +1 -1
  495. package/dist/diagnostics/useAthenaDiagnostics.cjs +4 -4
  496. package/dist/diagnostics/useAthenaDiagnostics.cjs.map +1 -1
  497. package/dist/dictation/audio-level-history.cjs +3 -3
  498. package/dist/dictation/audio-level-history.cjs.map +1 -1
  499. package/dist/dictation/dictation-controls.cjs +24 -20
  500. package/dist/dictation/dictation-controls.cjs.map +1 -1
  501. package/dist/dictation/dictation-controls.d.ts +6 -1
  502. package/dist/dictation/dictation-controls.js +24 -20
  503. package/dist/dictation/dictation-controls.js.map +1 -1
  504. package/dist/dictation/use-athena-dictation-engine.cjs +3 -3
  505. package/dist/dictation/use-athena-dictation-engine.cjs.map +1 -1
  506. package/dist/dictation/use-dictation.cjs +22 -22
  507. package/dist/dictation/use-dictation.cjs.map +1 -1
  508. package/dist/index.cjs +26 -2
  509. package/dist/index.cjs.map +1 -1
  510. package/dist/index.d.ts +15 -3
  511. package/dist/index.js +26 -2
  512. package/dist/index.js.map +1 -1
  513. package/dist/keryx-http/src/receive-only-socket.cjs +40 -0
  514. package/dist/keryx-http/src/receive-only-socket.cjs.map +1 -0
  515. package/dist/keryx-http/src/receive-only-socket.d.ts +27 -0
  516. package/dist/keryx-http/src/receive-only-socket.js +40 -0
  517. package/dist/keryx-http/src/receive-only-socket.js.map +1 -0
  518. package/dist/keryx-http/src/update-attributions.cjs +111 -0
  519. package/dist/keryx-http/src/update-attributions.cjs.map +1 -0
  520. package/dist/keryx-http/src/update-attributions.d.ts +75 -0
  521. package/dist/keryx-http/src/update-attributions.js +111 -0
  522. package/dist/keryx-http/src/update-attributions.js.map +1 -0
  523. package/dist/lib/owner-document.cjs +6 -6
  524. package/dist/lib/owner-document.cjs.map +1 -1
  525. package/dist/lib/use-athena-rest-query.cjs +4 -4
  526. package/dist/lib/use-athena-rest-query.cjs.map +1 -1
  527. package/dist/lib/use-document-active.cjs +4 -4
  528. package/dist/lib/use-document-active.cjs.map +1 -1
  529. package/dist/lib/use-prefers-reduced-motion.cjs +2 -2
  530. package/dist/lib/use-prefers-reduced-motion.cjs.map +1 -1
  531. package/dist/offline/offline-history.cjs +7 -7
  532. package/dist/offline/offline-history.cjs.map +1 -1
  533. package/dist/provider/AthenaContext.cjs +3 -3
  534. package/dist/provider/AthenaContext.cjs.map +1 -1
  535. package/dist/provider/AthenaProvider.cjs +116 -79
  536. package/dist/provider/AthenaProvider.cjs.map +1 -1
  537. package/dist/provider/AthenaProvider.js +40 -3
  538. package/dist/provider/AthenaProvider.js.map +1 -1
  539. package/dist/provider/PostHogProvider.cjs +2 -2
  540. package/dist/provider/PostHogProvider.cjs.map +1 -1
  541. package/dist/provider/agent-selection-context.cjs +2 -2
  542. package/dist/provider/agent-selection-context.cjs.map +1 -1
  543. package/dist/provider/chat-mode-context.cjs +2 -2
  544. package/dist/provider/chat-mode-context.cjs.map +1 -1
  545. package/dist/provider/session-persistence-context.cjs +10 -0
  546. package/dist/provider/session-persistence-context.cjs.map +1 -0
  547. package/dist/provider/session-persistence-context.d.ts +15 -0
  548. package/dist/provider/session-persistence-context.js +10 -0
  549. package/dist/provider/session-persistence-context.js.map +1 -0
  550. package/dist/provider/statewire-history-context.cjs +4 -4
  551. package/dist/provider/statewire-history-context.cjs.map +1 -1
  552. package/dist/provider/statewire-lifecycle-context.cjs +3 -3
  553. package/dist/provider/statewire-lifecycle-context.cjs.map +1 -1
  554. package/dist/provider/statewire-window-context.cjs +3 -3
  555. package/dist/provider/statewire-window-context.cjs.map +1 -1
  556. package/dist/provider/theme-style-context.cjs +3 -3
  557. package/dist/provider/theme-style-context.cjs.map +1 -1
  558. package/dist/react/package.json.cjs +1 -1
  559. package/dist/react/package.json.js +1 -1
  560. package/dist/references/src/tool-option-schemas.d.ts +0 -34
  561. package/dist/runtime/StatewireThreadConfigLaneSync.cjs +10 -10
  562. package/dist/runtime/StatewireThreadConfigLaneSync.cjs.map +1 -1
  563. package/dist/runtime/auth-refusal-restart.cjs +7 -7
  564. package/dist/runtime/auth-refusal-restart.cjs.map +1 -1
  565. package/dist/runtime/auth.cjs +13 -13
  566. package/dist/runtime/auth.cjs.map +1 -1
  567. package/dist/runtime/statewire-lifecycle.cjs +1 -0
  568. package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
  569. package/dist/runtime/statewire-lifecycle.d.ts +3 -1
  570. package/dist/runtime/statewire-lifecycle.js +2 -1
  571. package/dist/runtime/statewire-lifecycle.js.map +1 -1
  572. package/dist/runtime/statewire-server-lane-context.cjs +2 -2
  573. package/dist/runtime/statewire-server-lane-context.cjs.map +1 -1
  574. package/dist/runtime/statewire-session-lane.cjs +4 -4
  575. package/dist/runtime/statewire-session-lane.cjs.map +1 -1
  576. package/dist/runtime/useAthenaStatewireRuntime.cjs +10 -8
  577. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
  578. package/dist/runtime/useAthenaStatewireRuntime.d.ts +2 -0
  579. package/dist/runtime/useAthenaStatewireRuntime.js +2 -0
  580. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
  581. package/dist/styles.css +1 -1
  582. package/dist/threads/Inbox.cjs +8 -8
  583. package/dist/threads/Inbox.cjs.map +1 -1
  584. package/dist/threads/SessionList.cjs +9 -9
  585. package/dist/threads/SessionList.cjs.map +1 -1
  586. package/dist/threads/SessionsPage.cjs +11 -11
  587. package/dist/threads/SessionsPage.cjs.map +1 -1
  588. package/dist/threads/index-triggered-refresh.cjs +10 -10
  589. package/dist/threads/index-triggered-refresh.cjs.map +1 -1
  590. package/dist/threads/mark-viewed-thread-read.cjs +12 -12
  591. package/dist/threads/mark-viewed-thread-read.cjs.map +1 -1
  592. package/dist/threads/offline-session-list.cjs +3 -3
  593. package/dist/threads/offline-session-list.cjs.map +1 -1
  594. package/dist/threads/session-list-tab-share.cjs +5 -5
  595. package/dist/threads/session-list-tab-share.cjs.map +1 -1
  596. package/dist/threads/statewire-thread-list.cjs +55 -51
  597. package/dist/threads/statewire-thread-list.cjs.map +1 -1
  598. package/dist/threads/statewire-thread-list.js +6 -2
  599. package/dist/threads/statewire-thread-list.js.map +1 -1
  600. package/dist/threads/thread-id-context.cjs +5 -5
  601. package/dist/threads/thread-id-context.cjs.map +1 -1
  602. package/dist/threads/use-athena-session-attention.cjs +2 -2
  603. package/dist/threads/use-athena-session-attention.cjs.map +1 -1
  604. package/dist/threads/use-athena-sessions.cjs +10 -10
  605. package/dist/threads/use-athena-sessions.cjs.map +1 -1
  606. package/dist/threads/use-athena-thread-model.cjs +3 -3
  607. package/dist/threads/use-athena-thread-model.cjs.map +1 -1
  608. package/dist/threads/use-rest-conversation-history.cjs +3 -3
  609. package/dist/threads/use-rest-conversation-history.cjs.map +1 -1
  610. package/dist/threads/use-statewire-conversation-history.cjs +8 -8
  611. package/dist/threads/use-statewire-conversation-history.cjs.map +1 -1
  612. package/dist/threads/use-thread-archive.cjs +9 -9
  613. package/dist/threads/use-thread-archive.cjs.map +1 -1
  614. package/dist/threads/use-thread-favorite.cjs +2 -2
  615. package/dist/threads/use-thread-favorite.cjs.map +1 -1
  616. package/dist/threads/use-thread-field-override.cjs +20 -20
  617. package/dist/threads/use-thread-field-override.cjs.map +1 -1
  618. package/dist/threads/use-thread-read-state.cjs +4 -4
  619. package/dist/threads/use-thread-read-state.cjs.map +1 -1
  620. package/dist/threads/use-thread-rename.cjs +2 -2
  621. package/dist/threads/use-thread-rename.cjs.map +1 -1
  622. package/dist/threads/useAthenaThreadManager.cjs +2 -2
  623. package/dist/threads/useAthenaThreadManager.cjs.map +1 -1
  624. package/dist/tools/NestedPtcMessages.cjs +6 -6
  625. package/dist/tools/NestedPtcMessages.cjs.map +1 -1
  626. package/dist/tools/append-document-tool-ui.cjs +7 -7
  627. package/dist/tools/append-document-tool-ui.cjs.map +1 -1
  628. package/dist/tools/file-tool-uis.cjs +2 -2
  629. package/dist/tools/file-tool-uis.cjs.map +1 -1
  630. package/dist/tools/misc-tool-uis.cjs +2 -2
  631. package/dist/tools/misc-tool-uis.cjs.map +1 -1
  632. package/dist/tools/primitives.cjs +6 -6
  633. package/dist/tools/primitives.cjs.map +1 -1
  634. package/dist/tools/read-asset-tool-ui.cjs +6 -6
  635. package/dist/tools/read-asset-tool-ui.cjs.map +1 -1
  636. package/dist/tools/subagent-task-tool-ui.cjs +21 -21
  637. package/dist/tools/subagent-task-tool-ui.cjs.map +1 -1
  638. package/dist/tools/test-recording-tool-uis.cjs +16 -16
  639. package/dist/tools/test-recording-tool-uis.cjs.map +1 -1
  640. package/dist/tools/todo-plan-store.cjs +4 -4
  641. package/dist/tools/todo-plan-store.cjs.map +1 -1
  642. package/dist/tools/tool-appearance.cjs +3 -3
  643. package/dist/tools/tool-appearance.cjs.map +1 -1
  644. package/dist/tools/tool-fallback.cjs +14 -14
  645. package/dist/tools/tool-fallback.cjs.map +1 -1
  646. package/dist/tools/tool-summary.cjs +0 -2
  647. package/dist/tools/tool-summary.cjs.map +1 -1
  648. package/dist/tools/tool-summary.js +0 -2
  649. package/dist/tools/tool-summary.js.map +1 -1
  650. package/dist/tools/tool-uis.cjs +74 -74
  651. package/dist/tools/tool-uis.cjs.map +1 -1
  652. package/dist/tools/use-elapsed-seconds.cjs +3 -3
  653. package/dist/tools/use-elapsed-seconds.cjs.map +1 -1
  654. package/dist/tools/write-todos-tool-ui.cjs +9 -9
  655. package/dist/tools/write-todos-tool-ui.cjs.map +1 -1
  656. package/dist/ui/image-viewer.cjs +382 -0
  657. package/dist/ui/image-viewer.cjs.map +1 -0
  658. package/dist/ui/image-viewer.d.ts +50 -0
  659. package/dist/ui/image-viewer.js +382 -0
  660. package/dist/ui/image-viewer.js.map +1 -0
  661. package/dist/voice/chat.cjs +6 -0
  662. package/dist/voice/chat.cjs.map +1 -1
  663. package/dist/voice/chat.d.ts +1 -1
  664. package/dist/voice/chat.js +8 -2
  665. package/dist/voice/livekit-join.cjs +52 -101
  666. package/dist/voice/livekit-join.cjs.map +1 -1
  667. package/dist/voice/livekit-join.d.ts +1 -6
  668. package/dist/voice/livekit-join.js +52 -101
  669. package/dist/voice/livekit-join.js.map +1 -1
  670. package/dist/voice/livekit.cjs.map +1 -1
  671. package/dist/voice/livekit.d.ts +11 -1
  672. package/dist/voice/livekit.js.map +1 -1
  673. package/dist/voice/use-athena-voice-session.cjs +34 -34
  674. package/dist/voice/use-athena-voice-session.cjs.map +1 -1
  675. package/dist/workbench/ComputerLiveDesktop.cjs +13 -13
  676. package/dist/workbench/ComputerLiveDesktop.cjs.map +1 -1
  677. package/dist/workbench/SessionWorkbench.cjs +22 -22
  678. package/dist/workbench/SessionWorkbench.cjs.map +1 -1
  679. package/dist/workbench/session-workbench-context.cjs +3 -3
  680. package/dist/workbench/session-workbench-context.cjs.map +1 -1
  681. package/dist/workbench/session-workbench-panes.cjs +8 -8
  682. package/dist/workbench/session-workbench-panes.cjs.map +1 -1
  683. package/dist/workbench/workbench-layout-context.cjs +3 -3
  684. package/dist/workbench/workbench-layout-context.cjs.map +1 -1
  685. package/package.json +2 -1
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const UNCONFIRMED_EDITS_STALL_MS = 15e3;
4
+ const AVAILABLE_AGAIN = "It’s available again when you’re back online.";
5
+ const NEEDS_CONNECTION = {
6
+ label: "Needs a connection",
7
+ detail: `This needs Athena. ${AVAILABLE_AGAIN}`
8
+ };
9
+ function attachmentNeedsConnection({
10
+ kind,
11
+ messagesWait
12
+ }) {
13
+ const attaching = `Attaching ${"a file"} needs Athena. ${AVAILABLE_AGAIN}`;
14
+ return messagesWait ? `You can still send your message: it goes when Athena is back. ${attaching}` : attaching;
15
+ }
16
+ function heldExtras(withQuote) {
17
+ return withQuote ? "an attachment or a quote" : "an attachment";
18
+ }
19
+ function attachedMessageNeedsConnection({
20
+ withQuote = false
21
+ } = {}) {
22
+ return `Your text can wait and go when Athena is back, but ${heldExtras(withQuote)} can’t. Remove ${withQuote ? "it" : "the attachment"} to send the text.`;
23
+ }
24
+ function attachedMessageBehindWaiting({
25
+ withQuote = false
26
+ } = {}) {
27
+ return `Messages you wrote while Athena couldn’t be reached go first. A message with ${heldExtras(
28
+ withQuote
29
+ )} can’t wait behind them, so send it once they’ve gone.`;
30
+ }
31
+ exports.NEEDS_CONNECTION = NEEDS_CONNECTION;
32
+ exports.UNCONFIRMED_EDITS_STALL_MS = UNCONFIRMED_EDITS_STALL_MS;
33
+ exports.attachedMessageBehindWaiting = attachedMessageBehindWaiting;
34
+ exports.attachedMessageNeedsConnection = attachedMessageNeedsConnection;
35
+ exports.attachmentNeedsConnection = attachmentNeedsConnection;
36
+ //# sourceMappingURL=offline-status.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"offline-status.cjs","sources":["../../../../agent-runtime/src/offline-status.ts"],"sourcesContent":["/**\n * Athena's offline language: the one set of states and words every app uses to\n * say where the person stands when the network, or Athena, is out of reach —\n * Olympus, the desktop app, the phone app, the Chrome extension and the Office\n * add-in.\n *\n * The rule the words follow: say what still works before what doesn't. Work\n * done while Athena can't be reached is kept on the device and syncs when\n * Athena is back, so every message leads with that promise. Nothing here is\n * shown while Athena answers and nothing waits; the \"back\" messages are brief.\n *\n * Pure strings and small functions, no UI library: each app draws them its own\n * way (a banner, a header chip, a tooltip, a sheet). Reachability itself is\n * each app's own (the browser's or OS's online flag AND agora answering its\n * health read); this module only names the result.\n */\n\n/** Where the app stands with Athena. */\nexport type ConnectionState =\n /** Athena answers. Nothing is shown. */\n | 'online'\n /** The device has no network. */\n | 'offline'\n /** The network is up but Athena doesn't answer. */\n | 'unreachable'\n /** Athena answers again and what waited is being sent. */\n | 'reconnecting'\n /** Just back, and everything that waited was sent. Shown briefly. */\n | 'synced';\n\n/** Where one document's edits stand, for the chip in its header. */\nexport type DocumentSyncState =\n /** In Athena. */\n | 'saved'\n /** Being sent to Athena. */\n | 'saving'\n /** Kept on this device while Athena can't be reached; syncs when it is back. */\n | 'on-device'\n /** Kept only while this tab or app stays open (no device storage); syncs when Athena is back. */\n | 'in-memory'\n /** Sending what was kept on this device. */\n | 'syncing'\n /** Some changes overlap with Athena's version: the person chooses. */\n | 'needs-review'\n /** The document can no longer take these edits (access or state changed): kept, not sent. */\n | 'view-only'\n /**\n * Athena answers but isn't taking this document's changes for now: it holds the document while it\n * repairs it, or hasn't confirmed the latest changes for longer than usual (`SavingDelayCause`\n * says which). Kept, and saved once Athena takes them. Never said while Athena can't be reached:\n * that is `on-device` or `in-memory`.\n */\n | 'delayed';\n\n/** Why a document's saving is delayed while Athena answers (`DocumentSyncState` `delayed`). */\nexport type SavingDelayCause =\n /** Athena holds the document while it repairs it, and takes no changes to it until then. */\n | 'repairing'\n /** Athena hasn't confirmed the latest changes for longer than usual. */\n | 'unconfirmed';\n\n/** How a sentence names the device the person is on. */\nexport type DeviceNoun =\n | 'this browser'\n | 'this Mac'\n | 'this computer'\n | 'this phone'\n | 'this tablet'\n | 'this device';\n\n/**\n * What the app really keeps of work done while Athena can't be reached, so the\n * words never promise more: `device` (stored on the device, survives closing),\n * `memory` (kept only while this tab or app stays open: a tenant that turns\n * device copies off, or storage the app can't open), `none` (a surface that\n * keeps no work offline at all, like the Chrome side panel).\n */\nexport type OfflineKeeping = 'device' | 'memory' | 'none';\n\n/** A title and the one line under it (a banner, a sheet, a tooltip's heading). */\nexport interface StatusCopy {\n title: string;\n detail: string;\n}\n\n/** A short label for a chip or a disabled control, and its one-line explanation. */\nexport interface LabelCopy {\n label: string;\n detail: string;\n}\n\nfunction plural(count: number, one: string, many: string): string {\n return `${count} ${count === 1 ? one : many}`;\n}\n\n/** What a tab or an app is called when work lasts only while it stays open. */\nfunction openContainer(device: DeviceNoun): string {\n return device === 'this browser' ? 'this tab' : 'the app';\n}\n\n/** The promise after \"You're offline\" / \"Can't reach Athena\", honest to what is kept. */\nfunction keepingPromise({\n keeping,\n device,\n when,\n}: {\n keeping: OfflineKeeping;\n device: DeviceNoun;\n when: string;\n}): string {\n switch (keeping) {\n case 'device':\n return `You can keep working. Changes are saved on ${device} and sync ${when}.`;\n case 'memory':\n return `You can keep working, but changes are kept only until you close ${openContainer(device)}. They sync ${when}.`;\n case 'none':\n return `You’re still signed in. This reconnects ${when}.`;\n }\n}\n\n/**\n * The app-wide status line, or `null` while Athena answers and nothing waits.\n * `waiting` counts changes not in Athena yet: while `reconnecting` they are\n * being sent; while `online` they wait for something else (a copy that sends\n * when it is next opened), and the line stays until they are gone.\n * `keeping` is what the app really keeps offline (default `device`). A surface\n * that keeps nothing (`none`) has nothing to sync, so its way back is only\n * \"Back online\", never \"Syncing…\" or \"All changes synced\".\n */\nexport function connectionCopy({\n state,\n device,\n waiting = 0,\n keeping = 'device',\n}: {\n state: ConnectionState;\n device: DeviceNoun;\n waiting?: number;\n keeping?: OfflineKeeping;\n}): StatusCopy | null {\n switch (state) {\n case 'online':\n return waiting > 0\n ? {\n title: 'Not synced yet',\n detail: `${plural(waiting, 'change', 'changes')} on ${device} ${waiting === 1 ? 'hasn’t' : 'haven’t'} synced yet.`,\n }\n : null;\n case 'offline':\n return {\n title: 'You’re offline',\n detail: keepingPromise({ keeping, device, when: 'when you’re back online' }),\n };\n case 'unreachable':\n return {\n title: 'Can’t reach Athena',\n detail: keepingPromise({ keeping, device, when: 'when Athena is back' }),\n };\n case 'reconnecting':\n if (keeping === 'none') return { title: 'Back online', detail: '' };\n return {\n title: 'Back online',\n detail:\n waiting > 0 ? `Syncing ${plural(waiting, 'change', 'changes')}…` : 'Syncing…',\n };\n case 'synced':\n return keeping === 'none'\n ? { title: 'Back online', detail: '' }\n : { title: 'All changes synced', detail: '' };\n }\n}\n\n/**\n * The line under \"Saving delayed\": why saving waits, and what is kept meanwhile, never promising\n * more than the app keeps.\n */\nfunction savingDelayedDetail({\n delay,\n keeping,\n device,\n}: {\n delay: SavingDelayCause;\n keeping: Exclude<OfflineKeeping, 'none'>;\n device: DeviceNoun;\n}): string {\n if (delay === 'repairing') {\n return keeping === 'memory'\n ? `You can keep working, but your changes are kept only until you close ${openContainer(device)}. They save once Athena finishes repairing this document.`\n : `You can keep working. Your changes are kept on ${device} and save once Athena finishes repairing this document.`;\n }\n return keeping === 'memory'\n ? `Athena is taking longer than usual to save your latest changes. They’re kept only until you close ${openContainer(device)}, so keep it open.`\n : `Athena is taking longer than usual to save your latest changes. They’re kept on ${device} in the meantime.`;\n}\n\n/**\n * The chip in a document's header, and the line it explains itself with. For `delayed`, `delay`\n * says why (default `unconfirmed`) and `keeping` whether the changes are kept on the device or only\n * while the tab or app stays open (default `device`); every other state ignores both.\n */\nexport function documentSyncCopy({\n state,\n device,\n delay = 'unconfirmed',\n keeping = 'device',\n}: {\n state: DocumentSyncState;\n device: DeviceNoun;\n delay?: SavingDelayCause;\n keeping?: Exclude<OfflineKeeping, 'none'>;\n}): LabelCopy {\n switch (state) {\n case 'saved':\n return { label: 'Saved', detail: 'Saved to Athena.' };\n case 'saving':\n return { label: 'Saving…', detail: 'Saving to Athena.' };\n case 'on-device':\n return {\n label: `Saved on ${device}`,\n detail: `Saved on ${device}. Your changes sync when Athena is back.`,\n };\n case 'in-memory':\n return {\n label: 'Not saved yet',\n detail: `Your changes are kept only until you close ${openContainer(device)}, and save when Athena is back.`,\n };\n case 'syncing':\n return { label: 'Syncing…', detail: `Sending the changes saved on ${device}.` };\n case 'needs-review':\n return {\n label: 'Review changes',\n detail: 'Some of your changes overlap with changes made in Athena. Choose what to keep.',\n };\n case 'view-only':\n return {\n label: 'View only',\n detail: `You can’t edit this anymore. Your changes stay on ${device}.`,\n };\n case 'delayed':\n return { label: 'Saving delayed', detail: savingDelayedDetail({ delay, keeping, device }) };\n }\n}\n\n/**\n * How long a document's edits may wait unconfirmed on a connection that is up before its saving\n * reads as delayed (`delayed`, `unconfirmed`), and before its room asks Keryx why: the stall window\n * every editor shares (`ACK_STALL_MS` in `@athenaintel/asset-host/local-updates`, which Olympus's\n * `room-sync-store.test.ts` holds equal).\n */\nexport const UNCONFIRMED_EDITS_STALL_MS = 15_000;\n\n/**\n * Whether a document's saving is delayed, and why (`DocumentSyncState` `delayed`): only while Athena\n * answers and the document's room is connected; `repairing` when Keryx refuses the room's writes\n * (quarantined while it is repaired: said at once, before anything waits), `unconfirmed` once its\n * edits have stayed unconfirmed past {@link UNCONFIRMED_EDITS_STALL_MS}; `null` otherwise. Every\n * app's chip asks it after a hold and after edits kept without a connection, and ahead of syncing\n * and saving, so a room that refuses writes never spins and being offline is never a delay.\n */\nexport function savingDelayCause({\n reachable,\n connected,\n writesRefused,\n unconfirmedStalled,\n}: {\n /** Athena answers (the app's reachability, never the socket alone). */\n reachable: boolean;\n /** The document's room is connected. */\n connected: boolean;\n /** Keryx's document status says the room takes no writes for now. */\n writesRefused: boolean;\n /** Local edits have waited unconfirmed past the stall window on this connection. */\n unconfirmedStalled: boolean;\n}): SavingDelayCause | null {\n if (!reachable || !connected) return null;\n if (writesRefused) return 'repairing';\n return unconfirmedStalled ? 'unconfirmed' : null;\n}\n\n/** When something that needs Athena works again (the second half of `NEEDS_CONNECTION`'s line). */\nconst AVAILABLE_AGAIN = 'It’s available again when you’re back online.';\n\n/**\n * The reason on a control that needs Athena (share, run, upload, invite…),\n * shown disabled while Athena can't be reached rather than failing when used.\n */\nexport const NEEDS_CONNECTION: LabelCopy = {\n label: 'Needs a connection',\n detail: `This needs Athena. ${AVAILABLE_AGAIN}`,\n};\n\n/** What a composer was given to attach: a photo (from the phone's library or camera) or any file. */\nexport type AttachmentKind = 'photo' | 'file';\n\n/**\n * What a composer says when a photo or file is picked, pasted or dropped while\n * Athena can't be reached. It isn't attached: only Athena can take the upload.\n * In a chat whose messages wait to be sent meanwhile (`messagesWait`: the chat\n * keeps an outbox), the message itself still goes, so that comes first. Where\n * nothing waits (the Chrome side panel, a launcher that keeps its draft), it\n * says only when attaching works again, as `NEEDS_CONNECTION` does.\n */\nexport function attachmentNeedsConnection({\n kind,\n messagesWait,\n}: {\n kind: AttachmentKind;\n messagesWait: boolean;\n}): string {\n const attaching = `Attaching ${kind === 'photo' ? 'a photo' : 'a file'} needs Athena. ${AVAILABLE_AGAIN}`;\n return messagesWait\n ? `You can still send your message: it goes when Athena is back. ${attaching}`\n : attaching;\n}\n\n/** What a sent message carries besides its text that can't wait for Athena. */\nfunction heldExtras(withQuote: boolean): string {\n return withQuote ? 'an attachment or a quote' : 'an attachment';\n}\n\n/**\n * What a composer says when a message is sent while Athena can't be reached\n * with an attachment that never reached Athena (or, `withQuote`, a quote the\n * chat can't keep waiting). Its text could wait in the chat outbox; the\n * attachment can't, so the draft stays as it is.\n */\nexport function attachedMessageNeedsConnection({\n withQuote = false,\n}: {\n withQuote?: boolean;\n} = {}): string {\n return `Your text can wait and go when Athena is back, but ${heldExtras(withQuote)} can’t. Remove ${\n withQuote ? 'it' : 'the attachment'\n } to send the text.`;\n}\n\n/**\n * What a composer says when a message with an attachment (or, `withQuote`, a\n * quote) is sent while messages written when Athena couldn't be reached still\n * wait to go: those go first, and this one can't wait behind them.\n */\nexport function attachedMessageBehindWaiting({\n withQuote = false,\n}: {\n withQuote?: boolean;\n} = {}): string {\n return `Messages you wrote while Athena couldn’t be reached go first. A message with ${heldExtras(\n withQuote\n )} can’t wait behind them, so send it once they’ve gone.`;\n}\n\n/**\n * The reason on New Presentation while Athena can't be reached, in a workspace\n * whose new presentations start from its design system's template: a\n * presentation made offline starts blank, and only Athena can copy the\n * template, so none is made until it can.\n */\nexport const NEW_PRESENTATION_NEEDS_TEMPLATE: LabelCopy = {\n label: 'Needs a connection',\n detail:\n 'New presentations in this workspace start from its design template, which needs Athena. You can make one when you’re back online.',\n};\n\n/**\n * Whether an item opens without a connection on this device, for lists.\n * `canKeep` says whether opening it online would keep a copy here (the\n * deployment allows device copies and the item's type is one that is kept):\n * only then is the person told to open it once.\n */\nexport function offlineAvailabilityCopy({\n available,\n canKeep,\n device,\n}: {\n available: boolean;\n canKeep: boolean;\n device: DeviceNoun;\n}): LabelCopy {\n if (available) {\n return { label: 'Available offline', detail: `Opens without a connection on ${device}.` };\n }\n return canKeep\n ? {\n label: 'Not available offline',\n detail: `Open it once while online to keep it on ${device}.`,\n }\n : { label: 'Not available offline', detail: 'This opens only with a connection.' };\n}\n\n/**\n * The one-time explainer shown the first time the person goes offline, on a\n * surface that keeps work there (`keeping` `device`). A surface that keeps\n * nothing (`none`: the Chrome side panel, the Office task pane) shows no\n * explainer; its status line already says all that holds.\n */\nexport function firstOfflineExplainer({ device }: { device: DeviceNoun }): StatusCopy & {\n action: string;\n} {\n return {\n title: 'You can keep working offline',\n detail: `Documents you’ve opened recently keep working on ${device}. Your changes sync when you’re back online.`,\n action: 'Got it',\n };\n}\n\n/**\n * The summary heading of the one \"Waiting to sync\" list, from what waits on\n * the device; `null` when nothing does.\n */\nexport function waitingSummary({\n changes = 0,\n messages = 0,\n recordings = 0,\n}: {\n changes?: number;\n messages?: number;\n recordings?: number;\n}): string | null {\n const parts = [\n changes > 0 ? plural(changes, 'change', 'changes') : null,\n messages > 0 ? plural(messages, 'message', 'messages') : null,\n recordings > 0 ? plural(recordings, 'recording', 'recordings') : null,\n ].filter((part): part is string => part !== null);\n return parts.length === 0 ? null : `Waiting to sync: ${parts.join(', ')}`;\n}\n\n/**\n * Where one item in the \"Waiting to sync\" list stands: a change, a message or a\n * recording made while Athena couldn't be reached.\n */\nexport type WaitingItemState =\n /** Saved on the device; it syncs when Athena is back. */\n | 'waiting'\n /** Being sent to Athena now. */\n | 'syncing'\n /**\n * Kept only while this tab or app stays open: it couldn't be saved on the\n * device (the organization keeps nothing on devices, or storage failed).\n */\n | 'in-memory'\n /**\n * Saved on the device in something that isn't open (a document closed before\n * its edits synced, one made offline): it syncs when it is next opened with a\n * connection (opening it offline sends nothing).\n */\n | 'when-opened'\n /** Made in another workspace: it syncs once that workspace is open again, with a connection. */\n | 'other-workspace'\n /** It doesn't go on its own: the person chooses (a message that waited more than a day). */\n | 'needs-you'\n /** Athena didn't take it: the app adds why, and what the person can do about it. */\n | 'not-synced';\n\n/** The state of one item in the \"Waiting to sync\" list, and the line that explains it. */\nexport function waitingItemCopy({\n state,\n device,\n}: {\n state: WaitingItemState;\n device: DeviceNoun;\n}): LabelCopy {\n switch (state) {\n case 'waiting':\n return {\n label: 'Waiting to sync',\n detail: `Saved on ${device}. It syncs when Athena is back.`,\n };\n case 'syncing':\n return { label: 'Syncing…', detail: `Sending what was saved on ${device}.` };\n case 'in-memory':\n return {\n label: 'Not saved yet',\n detail: `Kept only until you close ${openContainer(device)}. It syncs when Athena is back.`,\n };\n case 'when-opened':\n return {\n label: 'Not synced yet',\n detail: `Saved on ${device}. It syncs when you next open it with a connection.`,\n };\n case 'other-workspace':\n return {\n label: 'Waiting for its workspace',\n detail: 'It syncs once you’re in the workspace it was made in, with a connection.',\n };\n case 'needs-you':\n return { label: 'Waiting for you', detail: 'Open it to choose what happens to it.' };\n case 'not-synced':\n return { label: 'Couldn’t sync', detail: 'Athena didn’t take it.' };\n }\n}\n\n/** The headings of the \"Waiting to sync\" list, one per kind of item. */\nexport const WAITING_SECTION_TITLES = {\n changes: 'Changes',\n messages: 'Messages',\n recordings: 'Recordings',\n} as const;\n\n/**\n * What the person can do with an item Athena didn't take (`not-synced`) in the\n * \"Waiting to sync\" list: send it again, or delete the copy on the device. That\n * copy is the item's only one, so the app asks first (`deleteFromDeviceConfirm`)\n * and never deletes it as a side effect of anything else.\n */\nexport function notSyncedActions({ device }: { device: DeviceNoun }): {\n retry: string;\n remove: string;\n} {\n return { retry: 'Try again', remove: `Delete from ${device}` };\n}\n\n/** One of `notSyncedActions`, or showing where the item is kept on the device. */\nexport type NotSyncedAction = 'retry' | 'reveal' | 'remove';\n\n/**\n * What the person hears when the device couldn't do what they asked for an\n * item Athena didn't take (its files, not Athena, failed).\n */\nexport function notSyncedActionFailed({\n action,\n device,\n}: {\n action: NotSyncedAction;\n device: DeviceNoun;\n}): string {\n switch (action) {\n case 'retry':\n return 'Couldn’t send it again. Try again in a moment.';\n case 'reveal':\n return `Couldn’t show where it’s kept on ${device}.`;\n case 'remove':\n return `Couldn’t delete it from ${device}.`;\n }\n}\n\n/**\n * The question before deleting such an item's copy on the device, naming the\n * item: the destructive choice is never the default.\n */\nexport function deleteFromDeviceConfirm({\n name,\n device,\n}: {\n name: string;\n device: DeviceNoun;\n}): StatusCopy & { confirm: string; cancel: string } {\n return {\n title: `Delete “${name}” from ${device}?`,\n detail: 'Athena didn’t take it, so this is its only copy. Deleting it can’t be undone.',\n confirm: 'Delete',\n cancel: 'Cancel',\n };\n}\n"],"names":[],"mappings":";;AAyPO,MAAM,6BAA6B;AA+B1C,MAAM,kBAAkB;AAMjB,MAAM,mBAA8B;AAAA,EACzC,OAAO;AAAA,EACP,QAAQ,sBAAsB,eAAe;AAC/C;AAaO,SAAS,0BAA0B;AAAA,EACxC;AAAA,EACA;AACF,GAGW;AACT,QAAM,YAAY,aAA4C,QAAQ,kBAAkB,eAAe;AACvG,SAAO,eACH,iEAAiE,SAAS,KAC1E;AACN;AAGA,SAAS,WAAW,WAA4B;AAC9C,SAAO,YAAY,6BAA6B;AAClD;AAQO,SAAS,+BAA+B;AAAA,EAC7C,YAAY;AACd,IAEI,IAAY;AACd,SAAO,sDAAsD,WAAW,SAAS,CAAC,kBAChF,YAAY,OAAO,gBACrB;AACF;AAOO,SAAS,6BAA6B;AAAA,EAC3C,YAAY;AACd,IAEI,IAAY;AACd,SAAO,gFAAgF;AAAA,IACrF;AAAA,EAAA,CACD;AACH;;;;;;"}
@@ -41,7 +41,20 @@ export type DocumentSyncState =
41
41
  /** Some changes overlap with Athena's version: the person chooses. */
42
42
  | 'needs-review'
43
43
  /** The document can no longer take these edits (access or state changed): kept, not sent. */
44
- | 'view-only';
44
+ | 'view-only'
45
+ /**
46
+ * Athena answers but isn't taking this document's changes for now: it holds the document while it
47
+ * repairs it, or hasn't confirmed the latest changes for longer than usual (`SavingDelayCause`
48
+ * says which). Kept, and saved once Athena takes them. Never said while Athena can't be reached:
49
+ * that is `on-device` or `in-memory`.
50
+ */
51
+ | 'delayed';
52
+ /** Why a document's saving is delayed while Athena answers (`DocumentSyncState` `delayed`). */
53
+ export type SavingDelayCause =
54
+ /** Athena holds the document while it repairs it, and takes no changes to it until then. */
55
+ 'repairing'
56
+ /** Athena hasn't confirmed the latest changes for longer than usual. */
57
+ | 'unconfirmed';
45
58
  /** How a sentence names the device the person is on. */
46
59
  export type DeviceNoun = 'this browser' | 'this Mac' | 'this computer' | 'this phone' | 'this tablet' | 'this device';
47
60
  /**
@@ -77,16 +90,85 @@ export declare function connectionCopy({ state, device, waiting, keeping, }: {
77
90
  waiting?: number;
78
91
  keeping?: OfflineKeeping;
79
92
  }): StatusCopy | null;
80
- /** The chip in a document's header, and the line it explains itself with. */
81
- export declare function documentSyncCopy({ state, device, }: {
93
+ /**
94
+ * The chip in a document's header, and the line it explains itself with. For `delayed`, `delay`
95
+ * says why (default `unconfirmed`) and `keeping` whether the changes are kept on the device or only
96
+ * while the tab or app stays open (default `device`); every other state ignores both.
97
+ */
98
+ export declare function documentSyncCopy({ state, device, delay, keeping, }: {
82
99
  state: DocumentSyncState;
83
100
  device: DeviceNoun;
101
+ delay?: SavingDelayCause;
102
+ keeping?: Exclude<OfflineKeeping, 'none'>;
84
103
  }): LabelCopy;
104
+ /**
105
+ * How long a document's edits may wait unconfirmed on a connection that is up before its saving
106
+ * reads as delayed (`delayed`, `unconfirmed`), and before its room asks Keryx why: the stall window
107
+ * every editor shares (`ACK_STALL_MS` in `@athenaintel/asset-host/local-updates`, which Olympus's
108
+ * `room-sync-store.test.ts` holds equal).
109
+ */
110
+ export declare const UNCONFIRMED_EDITS_STALL_MS = 15000;
111
+ /**
112
+ * Whether a document's saving is delayed, and why (`DocumentSyncState` `delayed`): only while Athena
113
+ * answers and the document's room is connected; `repairing` when Keryx refuses the room's writes
114
+ * (quarantined while it is repaired: said at once, before anything waits), `unconfirmed` once its
115
+ * edits have stayed unconfirmed past {@link UNCONFIRMED_EDITS_STALL_MS}; `null` otherwise. Every
116
+ * app's chip asks it after a hold and after edits kept without a connection, and ahead of syncing
117
+ * and saving, so a room that refuses writes never spins and being offline is never a delay.
118
+ */
119
+ export declare function savingDelayCause({ reachable, connected, writesRefused, unconfirmedStalled, }: {
120
+ /** Athena answers (the app's reachability, never the socket alone). */
121
+ reachable: boolean;
122
+ /** The document's room is connected. */
123
+ connected: boolean;
124
+ /** Keryx's document status says the room takes no writes for now. */
125
+ writesRefused: boolean;
126
+ /** Local edits have waited unconfirmed past the stall window on this connection. */
127
+ unconfirmedStalled: boolean;
128
+ }): SavingDelayCause | null;
85
129
  /**
86
130
  * The reason on a control that needs Athena (share, run, upload, invite…),
87
131
  * shown disabled while Athena can't be reached rather than failing when used.
88
132
  */
89
133
  export declare const NEEDS_CONNECTION: LabelCopy;
134
+ /** What a composer was given to attach: a photo (from the phone's library or camera) or any file. */
135
+ export type AttachmentKind = 'photo' | 'file';
136
+ /**
137
+ * What a composer says when a photo or file is picked, pasted or dropped while
138
+ * Athena can't be reached. It isn't attached: only Athena can take the upload.
139
+ * In a chat whose messages wait to be sent meanwhile (`messagesWait`: the chat
140
+ * keeps an outbox), the message itself still goes, so that comes first. Where
141
+ * nothing waits (the Chrome side panel, a launcher that keeps its draft), it
142
+ * says only when attaching works again, as `NEEDS_CONNECTION` does.
143
+ */
144
+ export declare function attachmentNeedsConnection({ kind, messagesWait, }: {
145
+ kind: AttachmentKind;
146
+ messagesWait: boolean;
147
+ }): string;
148
+ /**
149
+ * What a composer says when a message is sent while Athena can't be reached
150
+ * with an attachment that never reached Athena (or, `withQuote`, a quote the
151
+ * chat can't keep waiting). Its text could wait in the chat outbox; the
152
+ * attachment can't, so the draft stays as it is.
153
+ */
154
+ export declare function attachedMessageNeedsConnection({ withQuote, }?: {
155
+ withQuote?: boolean;
156
+ }): string;
157
+ /**
158
+ * What a composer says when a message with an attachment (or, `withQuote`, a
159
+ * quote) is sent while messages written when Athena couldn't be reached still
160
+ * wait to go: those go first, and this one can't wait behind them.
161
+ */
162
+ export declare function attachedMessageBehindWaiting({ withQuote, }?: {
163
+ withQuote?: boolean;
164
+ }): string;
165
+ /**
166
+ * The reason on New Presentation while Athena can't be reached, in a workspace
167
+ * whose new presentations start from its design system's template: a
168
+ * presentation made offline starts blank, and only Athena can copy the
169
+ * template, so none is made until it can.
170
+ */
171
+ export declare const NEW_PRESENTATION_NEEDS_TEMPLATE: LabelCopy;
90
172
  /**
91
173
  * Whether an item opens without a connection on this device, for lists.
92
174
  * `canKeep` says whether opening it online would keep a copy here (the
@@ -155,3 +237,36 @@ export declare const WAITING_SECTION_TITLES: {
155
237
  readonly messages: 'Messages';
156
238
  readonly recordings: 'Recordings';
157
239
  };
240
+ /**
241
+ * What the person can do with an item Athena didn't take (`not-synced`) in the
242
+ * "Waiting to sync" list: send it again, or delete the copy on the device. That
243
+ * copy is the item's only one, so the app asks first (`deleteFromDeviceConfirm`)
244
+ * and never deletes it as a side effect of anything else.
245
+ */
246
+ export declare function notSyncedActions({ device }: {
247
+ device: DeviceNoun;
248
+ }): {
249
+ retry: string;
250
+ remove: string;
251
+ };
252
+ /** One of `notSyncedActions`, or showing where the item is kept on the device. */
253
+ export type NotSyncedAction = 'retry' | 'reveal' | 'remove';
254
+ /**
255
+ * What the person hears when the device couldn't do what they asked for an
256
+ * item Athena didn't take (its files, not Athena, failed).
257
+ */
258
+ export declare function notSyncedActionFailed({ action, device, }: {
259
+ action: NotSyncedAction;
260
+ device: DeviceNoun;
261
+ }): string;
262
+ /**
263
+ * The question before deleting such an item's copy on the device, naming the
264
+ * item: the destructive choice is never the default.
265
+ */
266
+ export declare function deleteFromDeviceConfirm({ name, device, }: {
267
+ name: string;
268
+ device: DeviceNoun;
269
+ }): StatusCopy & {
270
+ confirm: string;
271
+ cancel: string;
272
+ };
@@ -0,0 +1,36 @@
1
+ const UNCONFIRMED_EDITS_STALL_MS = 15e3;
2
+ const AVAILABLE_AGAIN = "It’s available again when you’re back online.";
3
+ const NEEDS_CONNECTION = {
4
+ label: "Needs a connection",
5
+ detail: `This needs Athena. ${AVAILABLE_AGAIN}`
6
+ };
7
+ function attachmentNeedsConnection({
8
+ kind,
9
+ messagesWait
10
+ }) {
11
+ const attaching = `Attaching ${"a file"} needs Athena. ${AVAILABLE_AGAIN}`;
12
+ return messagesWait ? `You can still send your message: it goes when Athena is back. ${attaching}` : attaching;
13
+ }
14
+ function heldExtras(withQuote) {
15
+ return withQuote ? "an attachment or a quote" : "an attachment";
16
+ }
17
+ function attachedMessageNeedsConnection({
18
+ withQuote = false
19
+ } = {}) {
20
+ return `Your text can wait and go when Athena is back, but ${heldExtras(withQuote)} can’t. Remove ${withQuote ? "it" : "the attachment"} to send the text.`;
21
+ }
22
+ function attachedMessageBehindWaiting({
23
+ withQuote = false
24
+ } = {}) {
25
+ return `Messages you wrote while Athena couldn’t be reached go first. A message with ${heldExtras(
26
+ withQuote
27
+ )} can’t wait behind them, so send it once they’ve gone.`;
28
+ }
29
+ export {
30
+ NEEDS_CONNECTION,
31
+ UNCONFIRMED_EDITS_STALL_MS,
32
+ attachedMessageBehindWaiting,
33
+ attachedMessageNeedsConnection,
34
+ attachmentNeedsConnection
35
+ };
36
+ //# sourceMappingURL=offline-status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"offline-status.js","sources":["../../../../agent-runtime/src/offline-status.ts"],"sourcesContent":["/**\n * Athena's offline language: the one set of states and words every app uses to\n * say where the person stands when the network, or Athena, is out of reach —\n * Olympus, the desktop app, the phone app, the Chrome extension and the Office\n * add-in.\n *\n * The rule the words follow: say what still works before what doesn't. Work\n * done while Athena can't be reached is kept on the device and syncs when\n * Athena is back, so every message leads with that promise. Nothing here is\n * shown while Athena answers and nothing waits; the \"back\" messages are brief.\n *\n * Pure strings and small functions, no UI library: each app draws them its own\n * way (a banner, a header chip, a tooltip, a sheet). Reachability itself is\n * each app's own (the browser's or OS's online flag AND agora answering its\n * health read); this module only names the result.\n */\n\n/** Where the app stands with Athena. */\nexport type ConnectionState =\n /** Athena answers. Nothing is shown. */\n | 'online'\n /** The device has no network. */\n | 'offline'\n /** The network is up but Athena doesn't answer. */\n | 'unreachable'\n /** Athena answers again and what waited is being sent. */\n | 'reconnecting'\n /** Just back, and everything that waited was sent. Shown briefly. */\n | 'synced';\n\n/** Where one document's edits stand, for the chip in its header. */\nexport type DocumentSyncState =\n /** In Athena. */\n | 'saved'\n /** Being sent to Athena. */\n | 'saving'\n /** Kept on this device while Athena can't be reached; syncs when it is back. */\n | 'on-device'\n /** Kept only while this tab or app stays open (no device storage); syncs when Athena is back. */\n | 'in-memory'\n /** Sending what was kept on this device. */\n | 'syncing'\n /** Some changes overlap with Athena's version: the person chooses. */\n | 'needs-review'\n /** The document can no longer take these edits (access or state changed): kept, not sent. */\n | 'view-only'\n /**\n * Athena answers but isn't taking this document's changes for now: it holds the document while it\n * repairs it, or hasn't confirmed the latest changes for longer than usual (`SavingDelayCause`\n * says which). Kept, and saved once Athena takes them. Never said while Athena can't be reached:\n * that is `on-device` or `in-memory`.\n */\n | 'delayed';\n\n/** Why a document's saving is delayed while Athena answers (`DocumentSyncState` `delayed`). */\nexport type SavingDelayCause =\n /** Athena holds the document while it repairs it, and takes no changes to it until then. */\n | 'repairing'\n /** Athena hasn't confirmed the latest changes for longer than usual. */\n | 'unconfirmed';\n\n/** How a sentence names the device the person is on. */\nexport type DeviceNoun =\n | 'this browser'\n | 'this Mac'\n | 'this computer'\n | 'this phone'\n | 'this tablet'\n | 'this device';\n\n/**\n * What the app really keeps of work done while Athena can't be reached, so the\n * words never promise more: `device` (stored on the device, survives closing),\n * `memory` (kept only while this tab or app stays open: a tenant that turns\n * device copies off, or storage the app can't open), `none` (a surface that\n * keeps no work offline at all, like the Chrome side panel).\n */\nexport type OfflineKeeping = 'device' | 'memory' | 'none';\n\n/** A title and the one line under it (a banner, a sheet, a tooltip's heading). */\nexport interface StatusCopy {\n title: string;\n detail: string;\n}\n\n/** A short label for a chip or a disabled control, and its one-line explanation. */\nexport interface LabelCopy {\n label: string;\n detail: string;\n}\n\nfunction plural(count: number, one: string, many: string): string {\n return `${count} ${count === 1 ? one : many}`;\n}\n\n/** What a tab or an app is called when work lasts only while it stays open. */\nfunction openContainer(device: DeviceNoun): string {\n return device === 'this browser' ? 'this tab' : 'the app';\n}\n\n/** The promise after \"You're offline\" / \"Can't reach Athena\", honest to what is kept. */\nfunction keepingPromise({\n keeping,\n device,\n when,\n}: {\n keeping: OfflineKeeping;\n device: DeviceNoun;\n when: string;\n}): string {\n switch (keeping) {\n case 'device':\n return `You can keep working. Changes are saved on ${device} and sync ${when}.`;\n case 'memory':\n return `You can keep working, but changes are kept only until you close ${openContainer(device)}. They sync ${when}.`;\n case 'none':\n return `You’re still signed in. This reconnects ${when}.`;\n }\n}\n\n/**\n * The app-wide status line, or `null` while Athena answers and nothing waits.\n * `waiting` counts changes not in Athena yet: while `reconnecting` they are\n * being sent; while `online` they wait for something else (a copy that sends\n * when it is next opened), and the line stays until they are gone.\n * `keeping` is what the app really keeps offline (default `device`). A surface\n * that keeps nothing (`none`) has nothing to sync, so its way back is only\n * \"Back online\", never \"Syncing…\" or \"All changes synced\".\n */\nexport function connectionCopy({\n state,\n device,\n waiting = 0,\n keeping = 'device',\n}: {\n state: ConnectionState;\n device: DeviceNoun;\n waiting?: number;\n keeping?: OfflineKeeping;\n}): StatusCopy | null {\n switch (state) {\n case 'online':\n return waiting > 0\n ? {\n title: 'Not synced yet',\n detail: `${plural(waiting, 'change', 'changes')} on ${device} ${waiting === 1 ? 'hasn’t' : 'haven’t'} synced yet.`,\n }\n : null;\n case 'offline':\n return {\n title: 'You’re offline',\n detail: keepingPromise({ keeping, device, when: 'when you’re back online' }),\n };\n case 'unreachable':\n return {\n title: 'Can’t reach Athena',\n detail: keepingPromise({ keeping, device, when: 'when Athena is back' }),\n };\n case 'reconnecting':\n if (keeping === 'none') return { title: 'Back online', detail: '' };\n return {\n title: 'Back online',\n detail:\n waiting > 0 ? `Syncing ${plural(waiting, 'change', 'changes')}…` : 'Syncing…',\n };\n case 'synced':\n return keeping === 'none'\n ? { title: 'Back online', detail: '' }\n : { title: 'All changes synced', detail: '' };\n }\n}\n\n/**\n * The line under \"Saving delayed\": why saving waits, and what is kept meanwhile, never promising\n * more than the app keeps.\n */\nfunction savingDelayedDetail({\n delay,\n keeping,\n device,\n}: {\n delay: SavingDelayCause;\n keeping: Exclude<OfflineKeeping, 'none'>;\n device: DeviceNoun;\n}): string {\n if (delay === 'repairing') {\n return keeping === 'memory'\n ? `You can keep working, but your changes are kept only until you close ${openContainer(device)}. They save once Athena finishes repairing this document.`\n : `You can keep working. Your changes are kept on ${device} and save once Athena finishes repairing this document.`;\n }\n return keeping === 'memory'\n ? `Athena is taking longer than usual to save your latest changes. They’re kept only until you close ${openContainer(device)}, so keep it open.`\n : `Athena is taking longer than usual to save your latest changes. They’re kept on ${device} in the meantime.`;\n}\n\n/**\n * The chip in a document's header, and the line it explains itself with. For `delayed`, `delay`\n * says why (default `unconfirmed`) and `keeping` whether the changes are kept on the device or only\n * while the tab or app stays open (default `device`); every other state ignores both.\n */\nexport function documentSyncCopy({\n state,\n device,\n delay = 'unconfirmed',\n keeping = 'device',\n}: {\n state: DocumentSyncState;\n device: DeviceNoun;\n delay?: SavingDelayCause;\n keeping?: Exclude<OfflineKeeping, 'none'>;\n}): LabelCopy {\n switch (state) {\n case 'saved':\n return { label: 'Saved', detail: 'Saved to Athena.' };\n case 'saving':\n return { label: 'Saving…', detail: 'Saving to Athena.' };\n case 'on-device':\n return {\n label: `Saved on ${device}`,\n detail: `Saved on ${device}. Your changes sync when Athena is back.`,\n };\n case 'in-memory':\n return {\n label: 'Not saved yet',\n detail: `Your changes are kept only until you close ${openContainer(device)}, and save when Athena is back.`,\n };\n case 'syncing':\n return { label: 'Syncing…', detail: `Sending the changes saved on ${device}.` };\n case 'needs-review':\n return {\n label: 'Review changes',\n detail: 'Some of your changes overlap with changes made in Athena. Choose what to keep.',\n };\n case 'view-only':\n return {\n label: 'View only',\n detail: `You can’t edit this anymore. Your changes stay on ${device}.`,\n };\n case 'delayed':\n return { label: 'Saving delayed', detail: savingDelayedDetail({ delay, keeping, device }) };\n }\n}\n\n/**\n * How long a document's edits may wait unconfirmed on a connection that is up before its saving\n * reads as delayed (`delayed`, `unconfirmed`), and before its room asks Keryx why: the stall window\n * every editor shares (`ACK_STALL_MS` in `@athenaintel/asset-host/local-updates`, which Olympus's\n * `room-sync-store.test.ts` holds equal).\n */\nexport const UNCONFIRMED_EDITS_STALL_MS = 15_000;\n\n/**\n * Whether a document's saving is delayed, and why (`DocumentSyncState` `delayed`): only while Athena\n * answers and the document's room is connected; `repairing` when Keryx refuses the room's writes\n * (quarantined while it is repaired: said at once, before anything waits), `unconfirmed` once its\n * edits have stayed unconfirmed past {@link UNCONFIRMED_EDITS_STALL_MS}; `null` otherwise. Every\n * app's chip asks it after a hold and after edits kept without a connection, and ahead of syncing\n * and saving, so a room that refuses writes never spins and being offline is never a delay.\n */\nexport function savingDelayCause({\n reachable,\n connected,\n writesRefused,\n unconfirmedStalled,\n}: {\n /** Athena answers (the app's reachability, never the socket alone). */\n reachable: boolean;\n /** The document's room is connected. */\n connected: boolean;\n /** Keryx's document status says the room takes no writes for now. */\n writesRefused: boolean;\n /** Local edits have waited unconfirmed past the stall window on this connection. */\n unconfirmedStalled: boolean;\n}): SavingDelayCause | null {\n if (!reachable || !connected) return null;\n if (writesRefused) return 'repairing';\n return unconfirmedStalled ? 'unconfirmed' : null;\n}\n\n/** When something that needs Athena works again (the second half of `NEEDS_CONNECTION`'s line). */\nconst AVAILABLE_AGAIN = 'It’s available again when you’re back online.';\n\n/**\n * The reason on a control that needs Athena (share, run, upload, invite…),\n * shown disabled while Athena can't be reached rather than failing when used.\n */\nexport const NEEDS_CONNECTION: LabelCopy = {\n label: 'Needs a connection',\n detail: `This needs Athena. ${AVAILABLE_AGAIN}`,\n};\n\n/** What a composer was given to attach: a photo (from the phone's library or camera) or any file. */\nexport type AttachmentKind = 'photo' | 'file';\n\n/**\n * What a composer says when a photo or file is picked, pasted or dropped while\n * Athena can't be reached. It isn't attached: only Athena can take the upload.\n * In a chat whose messages wait to be sent meanwhile (`messagesWait`: the chat\n * keeps an outbox), the message itself still goes, so that comes first. Where\n * nothing waits (the Chrome side panel, a launcher that keeps its draft), it\n * says only when attaching works again, as `NEEDS_CONNECTION` does.\n */\nexport function attachmentNeedsConnection({\n kind,\n messagesWait,\n}: {\n kind: AttachmentKind;\n messagesWait: boolean;\n}): string {\n const attaching = `Attaching ${kind === 'photo' ? 'a photo' : 'a file'} needs Athena. ${AVAILABLE_AGAIN}`;\n return messagesWait\n ? `You can still send your message: it goes when Athena is back. ${attaching}`\n : attaching;\n}\n\n/** What a sent message carries besides its text that can't wait for Athena. */\nfunction heldExtras(withQuote: boolean): string {\n return withQuote ? 'an attachment or a quote' : 'an attachment';\n}\n\n/**\n * What a composer says when a message is sent while Athena can't be reached\n * with an attachment that never reached Athena (or, `withQuote`, a quote the\n * chat can't keep waiting). Its text could wait in the chat outbox; the\n * attachment can't, so the draft stays as it is.\n */\nexport function attachedMessageNeedsConnection({\n withQuote = false,\n}: {\n withQuote?: boolean;\n} = {}): string {\n return `Your text can wait and go when Athena is back, but ${heldExtras(withQuote)} can’t. Remove ${\n withQuote ? 'it' : 'the attachment'\n } to send the text.`;\n}\n\n/**\n * What a composer says when a message with an attachment (or, `withQuote`, a\n * quote) is sent while messages written when Athena couldn't be reached still\n * wait to go: those go first, and this one can't wait behind them.\n */\nexport function attachedMessageBehindWaiting({\n withQuote = false,\n}: {\n withQuote?: boolean;\n} = {}): string {\n return `Messages you wrote while Athena couldn’t be reached go first. A message with ${heldExtras(\n withQuote\n )} can’t wait behind them, so send it once they’ve gone.`;\n}\n\n/**\n * The reason on New Presentation while Athena can't be reached, in a workspace\n * whose new presentations start from its design system's template: a\n * presentation made offline starts blank, and only Athena can copy the\n * template, so none is made until it can.\n */\nexport const NEW_PRESENTATION_NEEDS_TEMPLATE: LabelCopy = {\n label: 'Needs a connection',\n detail:\n 'New presentations in this workspace start from its design template, which needs Athena. You can make one when you’re back online.',\n};\n\n/**\n * Whether an item opens without a connection on this device, for lists.\n * `canKeep` says whether opening it online would keep a copy here (the\n * deployment allows device copies and the item's type is one that is kept):\n * only then is the person told to open it once.\n */\nexport function offlineAvailabilityCopy({\n available,\n canKeep,\n device,\n}: {\n available: boolean;\n canKeep: boolean;\n device: DeviceNoun;\n}): LabelCopy {\n if (available) {\n return { label: 'Available offline', detail: `Opens without a connection on ${device}.` };\n }\n return canKeep\n ? {\n label: 'Not available offline',\n detail: `Open it once while online to keep it on ${device}.`,\n }\n : { label: 'Not available offline', detail: 'This opens only with a connection.' };\n}\n\n/**\n * The one-time explainer shown the first time the person goes offline, on a\n * surface that keeps work there (`keeping` `device`). A surface that keeps\n * nothing (`none`: the Chrome side panel, the Office task pane) shows no\n * explainer; its status line already says all that holds.\n */\nexport function firstOfflineExplainer({ device }: { device: DeviceNoun }): StatusCopy & {\n action: string;\n} {\n return {\n title: 'You can keep working offline',\n detail: `Documents you’ve opened recently keep working on ${device}. Your changes sync when you’re back online.`,\n action: 'Got it',\n };\n}\n\n/**\n * The summary heading of the one \"Waiting to sync\" list, from what waits on\n * the device; `null` when nothing does.\n */\nexport function waitingSummary({\n changes = 0,\n messages = 0,\n recordings = 0,\n}: {\n changes?: number;\n messages?: number;\n recordings?: number;\n}): string | null {\n const parts = [\n changes > 0 ? plural(changes, 'change', 'changes') : null,\n messages > 0 ? plural(messages, 'message', 'messages') : null,\n recordings > 0 ? plural(recordings, 'recording', 'recordings') : null,\n ].filter((part): part is string => part !== null);\n return parts.length === 0 ? null : `Waiting to sync: ${parts.join(', ')}`;\n}\n\n/**\n * Where one item in the \"Waiting to sync\" list stands: a change, a message or a\n * recording made while Athena couldn't be reached.\n */\nexport type WaitingItemState =\n /** Saved on the device; it syncs when Athena is back. */\n | 'waiting'\n /** Being sent to Athena now. */\n | 'syncing'\n /**\n * Kept only while this tab or app stays open: it couldn't be saved on the\n * device (the organization keeps nothing on devices, or storage failed).\n */\n | 'in-memory'\n /**\n * Saved on the device in something that isn't open (a document closed before\n * its edits synced, one made offline): it syncs when it is next opened with a\n * connection (opening it offline sends nothing).\n */\n | 'when-opened'\n /** Made in another workspace: it syncs once that workspace is open again, with a connection. */\n | 'other-workspace'\n /** It doesn't go on its own: the person chooses (a message that waited more than a day). */\n | 'needs-you'\n /** Athena didn't take it: the app adds why, and what the person can do about it. */\n | 'not-synced';\n\n/** The state of one item in the \"Waiting to sync\" list, and the line that explains it. */\nexport function waitingItemCopy({\n state,\n device,\n}: {\n state: WaitingItemState;\n device: DeviceNoun;\n}): LabelCopy {\n switch (state) {\n case 'waiting':\n return {\n label: 'Waiting to sync',\n detail: `Saved on ${device}. It syncs when Athena is back.`,\n };\n case 'syncing':\n return { label: 'Syncing…', detail: `Sending what was saved on ${device}.` };\n case 'in-memory':\n return {\n label: 'Not saved yet',\n detail: `Kept only until you close ${openContainer(device)}. It syncs when Athena is back.`,\n };\n case 'when-opened':\n return {\n label: 'Not synced yet',\n detail: `Saved on ${device}. It syncs when you next open it with a connection.`,\n };\n case 'other-workspace':\n return {\n label: 'Waiting for its workspace',\n detail: 'It syncs once you’re in the workspace it was made in, with a connection.',\n };\n case 'needs-you':\n return { label: 'Waiting for you', detail: 'Open it to choose what happens to it.' };\n case 'not-synced':\n return { label: 'Couldn’t sync', detail: 'Athena didn’t take it.' };\n }\n}\n\n/** The headings of the \"Waiting to sync\" list, one per kind of item. */\nexport const WAITING_SECTION_TITLES = {\n changes: 'Changes',\n messages: 'Messages',\n recordings: 'Recordings',\n} as const;\n\n/**\n * What the person can do with an item Athena didn't take (`not-synced`) in the\n * \"Waiting to sync\" list: send it again, or delete the copy on the device. That\n * copy is the item's only one, so the app asks first (`deleteFromDeviceConfirm`)\n * and never deletes it as a side effect of anything else.\n */\nexport function notSyncedActions({ device }: { device: DeviceNoun }): {\n retry: string;\n remove: string;\n} {\n return { retry: 'Try again', remove: `Delete from ${device}` };\n}\n\n/** One of `notSyncedActions`, or showing where the item is kept on the device. */\nexport type NotSyncedAction = 'retry' | 'reveal' | 'remove';\n\n/**\n * What the person hears when the device couldn't do what they asked for an\n * item Athena didn't take (its files, not Athena, failed).\n */\nexport function notSyncedActionFailed({\n action,\n device,\n}: {\n action: NotSyncedAction;\n device: DeviceNoun;\n}): string {\n switch (action) {\n case 'retry':\n return 'Couldn’t send it again. Try again in a moment.';\n case 'reveal':\n return `Couldn’t show where it’s kept on ${device}.`;\n case 'remove':\n return `Couldn’t delete it from ${device}.`;\n }\n}\n\n/**\n * The question before deleting such an item's copy on the device, naming the\n * item: the destructive choice is never the default.\n */\nexport function deleteFromDeviceConfirm({\n name,\n device,\n}: {\n name: string;\n device: DeviceNoun;\n}): StatusCopy & { confirm: string; cancel: string } {\n return {\n title: `Delete “${name}” from ${device}?`,\n detail: 'Athena didn’t take it, so this is its only copy. Deleting it can’t be undone.',\n confirm: 'Delete',\n cancel: 'Cancel',\n };\n}\n"],"names":[],"mappings":"AAyPO,MAAM,6BAA6B;AA+B1C,MAAM,kBAAkB;AAMjB,MAAM,mBAA8B;AAAA,EACzC,OAAO;AAAA,EACP,QAAQ,sBAAsB,eAAe;AAC/C;AAaO,SAAS,0BAA0B;AAAA,EACxC;AAAA,EACA;AACF,GAGW;AACT,QAAM,YAAY,aAA4C,QAAQ,kBAAkB,eAAe;AACvG,SAAO,eACH,iEAAiE,SAAS,KAC1E;AACN;AAGA,SAAS,WAAW,WAA4B;AAC9C,SAAO,YAAY,6BAA6B;AAClD;AAQO,SAAS,+BAA+B;AAAA,EAC7C,YAAY;AACd,IAEI,IAAY;AACd,SAAO,sDAAsD,WAAW,SAAS,CAAC,kBAChF,YAAY,OAAO,gBACrB;AACF;AAOO,SAAS,6BAA6B;AAAA,EAC3C,YAAY;AACd,IAEI,IAAY;AACd,SAAO,gFAAgF;AAAA,IACrF;AAAA,EAAA,CACD;AACH;"}
@@ -10,9 +10,6 @@ function queueEntryText(parts) {
10
10
  function isQueueEntryUnsettled(entry) {
11
11
  return entry.meta === void 0;
12
12
  }
13
- function readPrioritizedQueueIds(raw) {
14
- return Array.isArray(raw) ? raw.filter((id) => typeof id === "string") : [];
15
- }
16
13
  function queueLaneFlags(status) {
17
14
  return {
18
15
  isRunning: status === "running",
@@ -26,10 +23,6 @@ function buildStatewireQueueRows(options) {
26
23
  ...queue.map((item) => ({ item, lane: "queue" }))
27
24
  ];
28
25
  }
29
- function showQueueRowSendNow(options) {
30
- const { lane, index, isRunning, isContinuable } = options;
31
- return lane === "queue" && (isContinuable || isRunning && index === 0);
32
- }
33
26
  function showQueueRowSteer(options) {
34
27
  return options.lane === "queue" && options.isRunning;
35
28
  }
@@ -85,8 +78,6 @@ exports.isFailedSendEntryRace = isFailedSendEntryRace;
85
78
  exports.isQueueEntryUnsettled = isQueueEntryUnsettled;
86
79
  exports.queueEntryText = queueEntryText;
87
80
  exports.queueLaneFlags = queueLaneFlags;
88
- exports.readPrioritizedQueueIds = readPrioritizedQueueIds;
89
- exports.showQueueRowSendNow = showQueueRowSendNow;
90
81
  exports.showQueueRowSteer = showQueueRowSteer;
91
82
  exports.userStopBlocksQueueAutoContinue = userStopBlocksQueueAutoContinue;
92
83
  //# sourceMappingURL=queue.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"queue.cjs","sources":["../../../../agent-runtime/src/queue.ts"],"sourcesContent":["/**\n * Derivations for the server-owned statewire queue and steer lanes, shared by\n * every queued-messages tray (Olympus, the React SDK, the Chrome extension).\n *\n * The queue is SERVER-owned: statewire surfaces it on the runs projection.\n * \"Send now\" moves an item into the steer lane (`run/steer` — the host stops\n * the run and dispatches it once the run settles; on a stopped/errored thread\n * the same move dispatches immediately as a stop-/error-continue run) and\n * remove issues `run/dequeue`. While the thread rests stopped/errored,\n * stranded steer-lane entries list ahead of the queue — they dispatch first,\n * as one batch, so they carry Remove but no per-row Send now.\n *\n * Pure helpers only: the host component reads `useStatewireRuns()` and\n * `useDeepAgentThreadStatus()` itself (both mockable per surface) and passes\n * the values in.\n */\n\nimport type { StatewireThread } from '@assistant-ui/react-statewire';\nimport { DEEP_AGENT_COMPOSER_MARKDOWN_KEY } from './composer-markdown';\nimport { ATHENA_RUN_MARKER_CANCELLED, isServerUpdateStopSource } from './messages';\nimport type { DeepAgentThreadStatus } from './thread-status';\n\n/** The text content of a queued entry (non-text parts render as fallbacks). */\nexport function queueEntryText(\n parts: readonly { type: string; text?: string }[],\n): string {\n return parts\n .flatMap((part) =>\n part.type === 'text' && typeof part.text === 'string' ? [part.text] : [],\n )\n .join('\\n\\n');\n}\n\n/**\n * Whether a lane entry is still awaiting its send's settle: the host stamps\n * `meta` on every entry it admits (`_op_meta` — submitter and contextSync\n * snapshot), so a meta-less entry is this client's own optimistic fold. The\n * send is still in flight and can still be refused (billing gate, auth,\n * reconnect), which the tray must not render as an accepted queue position.\n */\nexport function isQueueEntryUnsettled(entry: StatewireThread.RunsQueueEntry): boolean {\n return entry.meta === undefined;\n}\n\n/**\n * The ids of queued entries the user prioritized (⚡ — `run/prioritize`), as\n * the host records them in its durable `prioritizedQueueIds` state. A\n * prioritized entry heads the queue lane and the live run ends at its next\n * model-call boundary to deliver it, so trays render these rows lit and offer\n * \"Remove priority\" instead of \"Prioritize\". Tolerates the key being absent\n * (a thread that never prioritized, a pre-feature host) and ignores anything\n * that is not a string id.\n */\nexport function readPrioritizedQueueIds(raw: unknown): readonly string[] {\n return Array.isArray(raw)\n ? raw.filter((id): id is string => typeof id === 'string')\n : [];\n}\n\nexport interface QueueLaneFlags {\n isRunning: boolean;\n /** A stopped/errored thread can continue with its queued work. */\n isContinuable: boolean;\n}\n\n/** The thread-status split every queue tray keys its affordances on. */\nexport function queueLaneFlags(status: DeepAgentThreadStatus): QueueLaneFlags {\n return {\n isRunning: status === 'running',\n isContinuable: status === 'stopped' || status === 'error',\n };\n}\n\nexport interface StatewireQueueRow {\n item: StatewireThread.RunsQueueEntry;\n lane: 'queue' | 'steer';\n}\n\n/**\n * The rows a queue tray renders, in dispatch order: stranded steer-lane\n * entries first (only while the thread rests continuable — during a run they\n * already render in the message list), then the queue lane.\n */\nexport function buildStatewireQueueRows(options: {\n queue: readonly StatewireThread.RunsQueueEntry[];\n steerQueue: readonly StatewireThread.RunsQueueEntry[];\n isContinuable: boolean;\n}): StatewireQueueRow[] {\n const { queue, steerQueue, isContinuable } = options;\n return [\n ...(isContinuable\n ? steerQueue.map((item) => ({ item, lane: 'steer' as const }))\n : []),\n ...queue.map((item) => ({ item, lane: 'queue' as const })),\n ];\n}\n\n/**\n * Whether a row offers \"Send now\": queue-lane rows only (steer entries already\n * dispatch first), every row while the thread rests continuable, and only the\n * head row while a run is live (later rows would jump the queue order).\n */\nexport function showQueueRowSendNow(options: {\n lane: 'queue' | 'steer';\n index: number;\n isRunning: boolean;\n isContinuable: boolean;\n}): boolean {\n const { lane, index, isRunning, isContinuable } = options;\n return lane === 'queue' && (isContinuable || (isRunning && index === 0));\n}\n\n/**\n * Whether a row offers \"Steer\" (`run/steer-live`): queue-lane rows while a run\n * is live. Steer folds the entry into the RUNNING turn at its next model call\n * — after the in-flight tool chain, never mid-tool — and the run goes on with\n * it in context (ChatGPT's and Codex's Steer, versus Queue). Nothing is\n * cancelled and no second run starts, so every queued row qualifies, not just\n * the head. At rest there is no turn to steer: Send now already dispatches.\n */\nexport function showQueueRowSteer(options: {\n lane: 'queue' | 'steer';\n isRunning: boolean;\n}): boolean {\n return options.lane === 'queue' && options.isRunning;\n}\n\nexport type QueueEditCommand =\n | { type: 'run/steer'; runId: string; message: StatewireThread.UserMessage }\n | { type: 'run/enqueue'; runId: string; message: StatewireThread.UserMessage };\n\n/**\n * Re-send a queued entry under its own id on its own lane with edited text:\n * the host replaces the queued message's content in place, leaving its queue\n * position and lane untouched (a same-id send never dispatches). The built-in\n * queue client has no update command, so this goes straight to the runs\n * protocol. Returns `null` when there is nothing to send — blank or unchanged\n * text, or no live run entry to address.\n */\nexport function buildQueueEditCommand(options: {\n item: StatewireThread.RunsQueueEntry;\n lane: 'queue' | 'steer';\n runId: string | null;\n text: string;\n /**\n * The edited message's metadata, replacing the entry's (the host replaces\n * the queued message whole). Omitted, the entry's metadata is kept, minus a\n * composer markdown that described the old text.\n */\n metadata?: Readonly<Record<string, unknown>> | undefined;\n}): QueueEditCommand | null {\n const { item, lane, runId, text } = options;\n const textChanged: boolean = text !== queueEntryText(item.parts);\n const previous: Readonly<Record<string, unknown>> | undefined = nonEmpty(item.metadata);\n const next: Readonly<Record<string, unknown>> | undefined = nonEmpty(\n options.metadata !== undefined\n ? options.metadata\n : textChanged\n ? withoutComposerMarkdown(item.metadata)\n : item.metadata,\n );\n if (\n !text.trim() ||\n runId === null ||\n (!textChanged && stableJson(next ?? null) === stableJson(previous ?? null))\n ) {\n return null;\n }\n // An entry that had metadata and keeps none sends an empty object: the\n // optimistic lane keeps an entry's metadata when the command carries none,\n // and would go on showing the old composer markdown until the host answers.\n const metadata: Readonly<Record<string, unknown>> | undefined =\n next ?? (previous === undefined ? undefined : {});\n const message: StatewireThread.UserMessage = {\n id: item.id,\n role: 'user',\n parts: [{ type: 'text', text }, ...item.parts.filter((part) => part.type !== 'text')],\n ...(metadata === undefined ? {} : { metadata: { ...metadata } }),\n };\n return lane === 'steer'\n ? { type: 'run/steer', runId, message }\n : { type: 'run/enqueue', runId, message };\n}\n\n/** `metadata` unless it is empty. */\nfunction nonEmpty(\n metadata: Readonly<Record<string, unknown>> | undefined,\n): Readonly<Record<string, unknown>> | undefined {\n return metadata !== undefined && Object.keys(metadata).length > 0 ? metadata : undefined;\n}\n\n/** JSON with object keys sorted, so equal metadata compares equal whatever its key order. */\nfunction stableJson(value: unknown): string {\n const sorted = (entry: unknown): unknown =>\n Array.isArray(entry)\n ? entry.map(sorted)\n : typeof entry === 'object' && entry !== null\n ? Object.fromEntries(\n Object.keys(entry)\n .sort()\n .map((key) => [key, sorted((entry as Record<string, unknown>)[key])]),\n )\n : entry;\n return JSON.stringify(sorted(value));\n}\n\n/** Entry metadata without a composer markdown, `undefined` when nothing is left. */\nfunction withoutComposerMarkdown(\n metadata: Readonly<Record<string, unknown>> | undefined,\n): Readonly<Record<string, unknown>> | undefined {\n if (metadata === undefined || !(DEEP_AGENT_COMPOSER_MARKDOWN_KEY in metadata)) return metadata;\n const { [DEEP_AGENT_COMPOSER_MARKDOWN_KEY]: _stale, ...rest } = metadata;\n return Object.keys(rest).length > 0 ? rest : undefined;\n}\n\n/**\n * Grace between observing a stranded settle and auto-promoting the queue\n * head — long enough for the host's own settle bookkeeping (or a status flap\n * during reconnect) to resolve first, short enough to read as \"it just\n * continued\" rather than \"it hung\".\n */\nexport const QUEUE_AUTO_CONTINUE_DELAY_MS = 2_000;\n\n/** Whether the last cancellation marker records a user or client stop. */\nexport function userStopBlocksQueueAutoContinue(options: {\n marker: string | undefined;\n source: string | undefined;\n}): boolean {\n return (\n options.marker === ATHENA_RUN_MARKER_CANCELLED && !isServerUpdateStopSource(options.source)\n );\n}\n\n/** `fate (cause)[: message]` — the detail a failed-send row carries. */\nexport function describeQueueSendFailure(\n failure: StatewireThread.RunsFailedEntry['sendFailure'],\n): string {\n const message =\n 'message' in failure && failure.message !== undefined ? `: ${failure.message}` : '';\n return `${failure.fate} (${failure.cause})${message}`;\n}\n\n/**\n * Whether a `retryFailed` / `discardFailed` throw is the covered drop race:\n * statewire drops a failed entry on its own as soon as a canonical update\n * shows the message landed, and acting on a just-dropped entry throws. Both\n * the session record (\"unknown failed command\") and the adapter's projection\n * (\"unknown failed entry\") use this prefix. Nothing is lost in that race — the\n * message already made it and the row is about to disappear — so a tray\n * swallows it (keeping telemetry) instead of crashing the click handler.\n */\nexport function isFailedSendEntryRace(error: unknown): boolean {\n return error instanceof Error && error.message.startsWith('statewire: unknown failed');\n}\n"],"names":["DEEP_AGENT_COMPOSER_MARKDOWN_KEY","ATHENA_RUN_MARKER_CANCELLED","isServerUpdateStopSource"],"mappings":"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"}
1
+ {"version":3,"file":"queue.cjs","sources":["../../../../agent-runtime/src/queue.ts"],"sourcesContent":["/**\n * Derivations for the server-owned statewire queue and steer lanes, shared by\n * every queued-messages tray (Olympus, the React SDK, the Chrome extension).\n *\n * The queue is SERVER-owned: statewire surfaces it on the runs projection.\n * \"Send now\" moves an item into the steer lane (`run/steer` — the host stops\n * the run and dispatches it once the run settles; on a stopped/errored thread\n * the same move dispatches immediately as a stop-/error-continue run) and\n * remove issues `run/dequeue`. While the thread rests stopped/errored,\n * stranded steer-lane entries list ahead of the queue — they dispatch first,\n * as one batch, so they carry Remove but no per-row Send now.\n *\n * Pure helpers only: the host component reads `useStatewireRuns()` and\n * `useDeepAgentThreadStatus()` itself (both mockable per surface) and passes\n * the values in.\n */\n\nimport type { StatewireThread } from '@assistant-ui/react-statewire';\nimport { DEEP_AGENT_COMPOSER_MARKDOWN_KEY } from './composer-markdown';\nimport { ATHENA_RUN_MARKER_CANCELLED, isServerUpdateStopSource } from './messages';\nimport type { DeepAgentThreadStatus } from './thread-status';\n\n/** The text content of a queued entry (non-text parts render as fallbacks). */\nexport function queueEntryText(\n parts: readonly { type: string; text?: string }[],\n): string {\n return parts\n .flatMap((part) =>\n part.type === 'text' && typeof part.text === 'string' ? [part.text] : [],\n )\n .join('\\n\\n');\n}\n\n/**\n * Whether a lane entry is still awaiting its send's settle: the host stamps\n * `meta` on every entry it admits (`_op_meta` — submitter and contextSync\n * snapshot), so a meta-less entry is this client's own optimistic fold. The\n * send is still in flight and can still be refused (billing gate, auth,\n * reconnect), which the tray must not render as an accepted queue position.\n */\nexport function isQueueEntryUnsettled(entry: StatewireThread.RunsQueueEntry): boolean {\n return entry.meta === undefined;\n}\n\n/**\n * The ids of queued entries the user prioritized (⚡ — `run/prioritize`), as\n * the host records them in its durable `prioritizedQueueIds` state. A\n * prioritized entry heads the queue lane and the live run ends at its next\n * model-call boundary to deliver it, so trays render these rows lit and offer\n * \"Remove priority\" instead of \"Prioritize\". Tolerates the key being absent\n * (a thread that never prioritized, a pre-feature host) and ignores anything\n * that is not a string id.\n */\nexport function readPrioritizedQueueIds(raw: unknown): readonly string[] {\n return Array.isArray(raw)\n ? raw.filter((id): id is string => typeof id === 'string')\n : [];\n}\n\nexport interface QueueLaneFlags {\n isRunning: boolean;\n /** A stopped/errored thread can continue with its queued work. */\n isContinuable: boolean;\n}\n\n/** The thread-status split every queue tray keys its affordances on. */\nexport function queueLaneFlags(status: DeepAgentThreadStatus): QueueLaneFlags {\n return {\n isRunning: status === 'running',\n isContinuable: status === 'stopped' || status === 'error',\n };\n}\n\nexport interface StatewireQueueRow {\n item: StatewireThread.RunsQueueEntry;\n lane: 'queue' | 'steer';\n}\n\n/**\n * The rows a queue tray renders, in dispatch order: stranded steer-lane\n * entries first (only while the thread rests continuable — during a run they\n * already render in the message list), then the queue lane.\n */\nexport function buildStatewireQueueRows(options: {\n queue: readonly StatewireThread.RunsQueueEntry[];\n steerQueue: readonly StatewireThread.RunsQueueEntry[];\n isContinuable: boolean;\n}): StatewireQueueRow[] {\n const { queue, steerQueue, isContinuable } = options;\n return [\n ...(isContinuable\n ? steerQueue.map((item) => ({ item, lane: 'steer' as const }))\n : []),\n ...queue.map((item) => ({ item, lane: 'queue' as const })),\n ];\n}\n\n/**\n * Whether a row offers \"Send now\": queue-lane rows only (steer entries already\n * dispatch first), every row while the thread rests continuable, and only the\n * head row while a run is live (later rows would jump the queue order).\n */\nexport function showQueueRowSendNow(options: {\n lane: 'queue' | 'steer';\n index: number;\n isRunning: boolean;\n isContinuable: boolean;\n}): boolean {\n const { lane, index, isRunning, isContinuable } = options;\n return lane === 'queue' && (isContinuable || (isRunning && index === 0));\n}\n\n/**\n * Whether a row offers \"Steer\" (`run/steer-live`): queue-lane rows while a run\n * is live. Steer folds the entry into the RUNNING turn at its next model call\n * — after the in-flight tool chain, never mid-tool — and the run goes on with\n * it in context (ChatGPT's and Codex's Steer, versus Queue). Nothing is\n * cancelled and no second run starts, so every queued row qualifies, not just\n * the head. At rest there is no turn to steer: Send now already dispatches.\n */\nexport function showQueueRowSteer(options: {\n lane: 'queue' | 'steer';\n isRunning: boolean;\n}): boolean {\n return options.lane === 'queue' && options.isRunning;\n}\n\nexport type QueueEditCommand =\n | { type: 'run/steer'; runId: string; message: StatewireThread.UserMessage }\n | { type: 'run/enqueue'; runId: string; message: StatewireThread.UserMessage };\n\n/**\n * Re-send a queued entry under its own id on its own lane with edited text:\n * the host replaces the queued message's content in place, leaving its queue\n * position and lane untouched (a same-id send never dispatches). The built-in\n * queue client has no update command, so this goes straight to the runs\n * protocol. Returns `null` when there is nothing to send — blank or unchanged\n * text, or no live run entry to address.\n */\nexport function buildQueueEditCommand(options: {\n item: StatewireThread.RunsQueueEntry;\n lane: 'queue' | 'steer';\n runId: string | null;\n text: string;\n /**\n * The edited message's metadata, replacing the entry's (the host replaces\n * the queued message whole). Omitted, the entry's metadata is kept, minus a\n * composer markdown that described the old text.\n */\n metadata?: Readonly<Record<string, unknown>> | undefined;\n}): QueueEditCommand | null {\n const { item, lane, runId, text } = options;\n const textChanged: boolean = text !== queueEntryText(item.parts);\n const previous: Readonly<Record<string, unknown>> | undefined = nonEmpty(item.metadata);\n const next: Readonly<Record<string, unknown>> | undefined = nonEmpty(\n options.metadata !== undefined\n ? options.metadata\n : textChanged\n ? withoutComposerMarkdown(item.metadata)\n : item.metadata,\n );\n if (\n !text.trim() ||\n runId === null ||\n (!textChanged && stableJson(next ?? null) === stableJson(previous ?? null))\n ) {\n return null;\n }\n // An entry that had metadata and keeps none sends an empty object: the\n // optimistic lane keeps an entry's metadata when the command carries none,\n // and would go on showing the old composer markdown until the host answers.\n const metadata: Readonly<Record<string, unknown>> | undefined =\n next ?? (previous === undefined ? undefined : {});\n const message: StatewireThread.UserMessage = {\n id: item.id,\n role: 'user',\n parts: [{ type: 'text', text }, ...item.parts.filter((part) => part.type !== 'text')],\n ...(metadata === undefined ? {} : { metadata: { ...metadata } }),\n };\n return lane === 'steer'\n ? { type: 'run/steer', runId, message }\n : { type: 'run/enqueue', runId, message };\n}\n\n/** `metadata` unless it is empty. */\nfunction nonEmpty(\n metadata: Readonly<Record<string, unknown>> | undefined,\n): Readonly<Record<string, unknown>> | undefined {\n return metadata !== undefined && Object.keys(metadata).length > 0 ? metadata : undefined;\n}\n\n/** JSON with object keys sorted, so equal metadata compares equal whatever its key order. */\nfunction stableJson(value: unknown): string {\n const sorted = (entry: unknown): unknown =>\n Array.isArray(entry)\n ? entry.map(sorted)\n : typeof entry === 'object' && entry !== null\n ? Object.fromEntries(\n Object.keys(entry)\n .sort()\n .map((key) => [key, sorted((entry as Record<string, unknown>)[key])]),\n )\n : entry;\n return JSON.stringify(sorted(value));\n}\n\n/** Entry metadata without a composer markdown, `undefined` when nothing is left. */\nfunction withoutComposerMarkdown(\n metadata: Readonly<Record<string, unknown>> | undefined,\n): Readonly<Record<string, unknown>> | undefined {\n if (metadata === undefined || !(DEEP_AGENT_COMPOSER_MARKDOWN_KEY in metadata)) return metadata;\n const { [DEEP_AGENT_COMPOSER_MARKDOWN_KEY]: _stale, ...rest } = metadata;\n return Object.keys(rest).length > 0 ? rest : undefined;\n}\n\n/**\n * Grace between observing a stranded settle and auto-promoting the queue\n * head — long enough for the host's own settle bookkeeping (or a status flap\n * during reconnect) to resolve first, short enough to read as \"it just\n * continued\" rather than \"it hung\".\n */\nexport const QUEUE_AUTO_CONTINUE_DELAY_MS = 2_000;\n\n/** Whether the last cancellation marker records a user or client stop. */\nexport function userStopBlocksQueueAutoContinue(options: {\n marker: string | undefined;\n source: string | undefined;\n}): boolean {\n return (\n options.marker === ATHENA_RUN_MARKER_CANCELLED && !isServerUpdateStopSource(options.source)\n );\n}\n\n/** `fate (cause)[: message]` — the detail a failed-send row carries. */\nexport function describeQueueSendFailure(\n failure: StatewireThread.RunsFailedEntry['sendFailure'],\n): string {\n const message =\n 'message' in failure && failure.message !== undefined ? `: ${failure.message}` : '';\n return `${failure.fate} (${failure.cause})${message}`;\n}\n\n/**\n * Whether a `retryFailed` / `discardFailed` throw is the covered drop race:\n * statewire drops a failed entry on its own as soon as a canonical update\n * shows the message landed, and acting on a just-dropped entry throws. Both\n * the session record (\"unknown failed command\") and the adapter's projection\n * (\"unknown failed entry\") use this prefix. Nothing is lost in that race — the\n * message already made it and the row is about to disappear — so a tray\n * swallows it (keeping telemetry) instead of crashing the click handler.\n */\nexport function isFailedSendEntryRace(error: unknown): boolean {\n return error instanceof Error && error.message.startsWith('statewire: unknown failed');\n}\n"],"names":["DEEP_AGENT_COMPOSER_MARKDOWN_KEY","ATHENA_RUN_MARKER_CANCELLED","isServerUpdateStopSource"],"mappings":"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"}
@@ -8,9 +8,6 @@ function queueEntryText(parts) {
8
8
  function isQueueEntryUnsettled(entry) {
9
9
  return entry.meta === void 0;
10
10
  }
11
- function readPrioritizedQueueIds(raw) {
12
- return Array.isArray(raw) ? raw.filter((id) => typeof id === "string") : [];
13
- }
14
11
  function queueLaneFlags(status) {
15
12
  return {
16
13
  isRunning: status === "running",
@@ -24,10 +21,6 @@ function buildStatewireQueueRows(options) {
24
21
  ...queue.map((item) => ({ item, lane: "queue" }))
25
22
  ];
26
23
  }
27
- function showQueueRowSendNow(options) {
28
- const { lane, index, isRunning, isContinuable } = options;
29
- return lane === "queue" && (isContinuable || isRunning && index === 0);
30
- }
31
24
  function showQueueRowSteer(options) {
32
25
  return options.lane === "queue" && options.isRunning;
33
26
  }
@@ -84,8 +77,6 @@ export {
84
77
  isQueueEntryUnsettled,
85
78
  queueEntryText,
86
79
  queueLaneFlags,
87
- readPrioritizedQueueIds,
88
- showQueueRowSendNow,
89
80
  showQueueRowSteer,
90
81
  userStopBlocksQueueAutoContinue
91
82
  };
@@ -1 +1 @@
1
- {"version":3,"file":"queue.js","sources":["../../../../agent-runtime/src/queue.ts"],"sourcesContent":["/**\n * Derivations for the server-owned statewire queue and steer lanes, shared by\n * every queued-messages tray (Olympus, the React SDK, the Chrome extension).\n *\n * The queue is SERVER-owned: statewire surfaces it on the runs projection.\n * \"Send now\" moves an item into the steer lane (`run/steer` — the host stops\n * the run and dispatches it once the run settles; on a stopped/errored thread\n * the same move dispatches immediately as a stop-/error-continue run) and\n * remove issues `run/dequeue`. While the thread rests stopped/errored,\n * stranded steer-lane entries list ahead of the queue — they dispatch first,\n * as one batch, so they carry Remove but no per-row Send now.\n *\n * Pure helpers only: the host component reads `useStatewireRuns()` and\n * `useDeepAgentThreadStatus()` itself (both mockable per surface) and passes\n * the values in.\n */\n\nimport type { StatewireThread } from '@assistant-ui/react-statewire';\nimport { DEEP_AGENT_COMPOSER_MARKDOWN_KEY } from './composer-markdown';\nimport { ATHENA_RUN_MARKER_CANCELLED, isServerUpdateStopSource } from './messages';\nimport type { DeepAgentThreadStatus } from './thread-status';\n\n/** The text content of a queued entry (non-text parts render as fallbacks). */\nexport function queueEntryText(\n parts: readonly { type: string; text?: string }[],\n): string {\n return parts\n .flatMap((part) =>\n part.type === 'text' && typeof part.text === 'string' ? [part.text] : [],\n )\n .join('\\n\\n');\n}\n\n/**\n * Whether a lane entry is still awaiting its send's settle: the host stamps\n * `meta` on every entry it admits (`_op_meta` — submitter and contextSync\n * snapshot), so a meta-less entry is this client's own optimistic fold. The\n * send is still in flight and can still be refused (billing gate, auth,\n * reconnect), which the tray must not render as an accepted queue position.\n */\nexport function isQueueEntryUnsettled(entry: StatewireThread.RunsQueueEntry): boolean {\n return entry.meta === undefined;\n}\n\n/**\n * The ids of queued entries the user prioritized (⚡ — `run/prioritize`), as\n * the host records them in its durable `prioritizedQueueIds` state. A\n * prioritized entry heads the queue lane and the live run ends at its next\n * model-call boundary to deliver it, so trays render these rows lit and offer\n * \"Remove priority\" instead of \"Prioritize\". Tolerates the key being absent\n * (a thread that never prioritized, a pre-feature host) and ignores anything\n * that is not a string id.\n */\nexport function readPrioritizedQueueIds(raw: unknown): readonly string[] {\n return Array.isArray(raw)\n ? raw.filter((id): id is string => typeof id === 'string')\n : [];\n}\n\nexport interface QueueLaneFlags {\n isRunning: boolean;\n /** A stopped/errored thread can continue with its queued work. */\n isContinuable: boolean;\n}\n\n/** The thread-status split every queue tray keys its affordances on. */\nexport function queueLaneFlags(status: DeepAgentThreadStatus): QueueLaneFlags {\n return {\n isRunning: status === 'running',\n isContinuable: status === 'stopped' || status === 'error',\n };\n}\n\nexport interface StatewireQueueRow {\n item: StatewireThread.RunsQueueEntry;\n lane: 'queue' | 'steer';\n}\n\n/**\n * The rows a queue tray renders, in dispatch order: stranded steer-lane\n * entries first (only while the thread rests continuable — during a run they\n * already render in the message list), then the queue lane.\n */\nexport function buildStatewireQueueRows(options: {\n queue: readonly StatewireThread.RunsQueueEntry[];\n steerQueue: readonly StatewireThread.RunsQueueEntry[];\n isContinuable: boolean;\n}): StatewireQueueRow[] {\n const { queue, steerQueue, isContinuable } = options;\n return [\n ...(isContinuable\n ? steerQueue.map((item) => ({ item, lane: 'steer' as const }))\n : []),\n ...queue.map((item) => ({ item, lane: 'queue' as const })),\n ];\n}\n\n/**\n * Whether a row offers \"Send now\": queue-lane rows only (steer entries already\n * dispatch first), every row while the thread rests continuable, and only the\n * head row while a run is live (later rows would jump the queue order).\n */\nexport function showQueueRowSendNow(options: {\n lane: 'queue' | 'steer';\n index: number;\n isRunning: boolean;\n isContinuable: boolean;\n}): boolean {\n const { lane, index, isRunning, isContinuable } = options;\n return lane === 'queue' && (isContinuable || (isRunning && index === 0));\n}\n\n/**\n * Whether a row offers \"Steer\" (`run/steer-live`): queue-lane rows while a run\n * is live. Steer folds the entry into the RUNNING turn at its next model call\n * — after the in-flight tool chain, never mid-tool — and the run goes on with\n * it in context (ChatGPT's and Codex's Steer, versus Queue). Nothing is\n * cancelled and no second run starts, so every queued row qualifies, not just\n * the head. At rest there is no turn to steer: Send now already dispatches.\n */\nexport function showQueueRowSteer(options: {\n lane: 'queue' | 'steer';\n isRunning: boolean;\n}): boolean {\n return options.lane === 'queue' && options.isRunning;\n}\n\nexport type QueueEditCommand =\n | { type: 'run/steer'; runId: string; message: StatewireThread.UserMessage }\n | { type: 'run/enqueue'; runId: string; message: StatewireThread.UserMessage };\n\n/**\n * Re-send a queued entry under its own id on its own lane with edited text:\n * the host replaces the queued message's content in place, leaving its queue\n * position and lane untouched (a same-id send never dispatches). The built-in\n * queue client has no update command, so this goes straight to the runs\n * protocol. Returns `null` when there is nothing to send — blank or unchanged\n * text, or no live run entry to address.\n */\nexport function buildQueueEditCommand(options: {\n item: StatewireThread.RunsQueueEntry;\n lane: 'queue' | 'steer';\n runId: string | null;\n text: string;\n /**\n * The edited message's metadata, replacing the entry's (the host replaces\n * the queued message whole). Omitted, the entry's metadata is kept, minus a\n * composer markdown that described the old text.\n */\n metadata?: Readonly<Record<string, unknown>> | undefined;\n}): QueueEditCommand | null {\n const { item, lane, runId, text } = options;\n const textChanged: boolean = text !== queueEntryText(item.parts);\n const previous: Readonly<Record<string, unknown>> | undefined = nonEmpty(item.metadata);\n const next: Readonly<Record<string, unknown>> | undefined = nonEmpty(\n options.metadata !== undefined\n ? options.metadata\n : textChanged\n ? withoutComposerMarkdown(item.metadata)\n : item.metadata,\n );\n if (\n !text.trim() ||\n runId === null ||\n (!textChanged && stableJson(next ?? null) === stableJson(previous ?? null))\n ) {\n return null;\n }\n // An entry that had metadata and keeps none sends an empty object: the\n // optimistic lane keeps an entry's metadata when the command carries none,\n // and would go on showing the old composer markdown until the host answers.\n const metadata: Readonly<Record<string, unknown>> | undefined =\n next ?? (previous === undefined ? undefined : {});\n const message: StatewireThread.UserMessage = {\n id: item.id,\n role: 'user',\n parts: [{ type: 'text', text }, ...item.parts.filter((part) => part.type !== 'text')],\n ...(metadata === undefined ? {} : { metadata: { ...metadata } }),\n };\n return lane === 'steer'\n ? { type: 'run/steer', runId, message }\n : { type: 'run/enqueue', runId, message };\n}\n\n/** `metadata` unless it is empty. */\nfunction nonEmpty(\n metadata: Readonly<Record<string, unknown>> | undefined,\n): Readonly<Record<string, unknown>> | undefined {\n return metadata !== undefined && Object.keys(metadata).length > 0 ? metadata : undefined;\n}\n\n/** JSON with object keys sorted, so equal metadata compares equal whatever its key order. */\nfunction stableJson(value: unknown): string {\n const sorted = (entry: unknown): unknown =>\n Array.isArray(entry)\n ? entry.map(sorted)\n : typeof entry === 'object' && entry !== null\n ? Object.fromEntries(\n Object.keys(entry)\n .sort()\n .map((key) => [key, sorted((entry as Record<string, unknown>)[key])]),\n )\n : entry;\n return JSON.stringify(sorted(value));\n}\n\n/** Entry metadata without a composer markdown, `undefined` when nothing is left. */\nfunction withoutComposerMarkdown(\n metadata: Readonly<Record<string, unknown>> | undefined,\n): Readonly<Record<string, unknown>> | undefined {\n if (metadata === undefined || !(DEEP_AGENT_COMPOSER_MARKDOWN_KEY in metadata)) return metadata;\n const { [DEEP_AGENT_COMPOSER_MARKDOWN_KEY]: _stale, ...rest } = metadata;\n return Object.keys(rest).length > 0 ? rest : undefined;\n}\n\n/**\n * Grace between observing a stranded settle and auto-promoting the queue\n * head — long enough for the host's own settle bookkeeping (or a status flap\n * during reconnect) to resolve first, short enough to read as \"it just\n * continued\" rather than \"it hung\".\n */\nexport const QUEUE_AUTO_CONTINUE_DELAY_MS = 2_000;\n\n/** Whether the last cancellation marker records a user or client stop. */\nexport function userStopBlocksQueueAutoContinue(options: {\n marker: string | undefined;\n source: string | undefined;\n}): boolean {\n return (\n options.marker === ATHENA_RUN_MARKER_CANCELLED && !isServerUpdateStopSource(options.source)\n );\n}\n\n/** `fate (cause)[: message]` — the detail a failed-send row carries. */\nexport function describeQueueSendFailure(\n failure: StatewireThread.RunsFailedEntry['sendFailure'],\n): string {\n const message =\n 'message' in failure && failure.message !== undefined ? `: ${failure.message}` : '';\n return `${failure.fate} (${failure.cause})${message}`;\n}\n\n/**\n * Whether a `retryFailed` / `discardFailed` throw is the covered drop race:\n * statewire drops a failed entry on its own as soon as a canonical update\n * shows the message landed, and acting on a just-dropped entry throws. Both\n * the session record (\"unknown failed command\") and the adapter's projection\n * (\"unknown failed entry\") use this prefix. Nothing is lost in that race — the\n * message already made it and the row is about to disappear — so a tray\n * swallows it (keeping telemetry) instead of crashing the click handler.\n */\nexport function isFailedSendEntryRace(error: unknown): boolean {\n return error instanceof Error && error.message.startsWith('statewire: unknown failed');\n}\n"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"queue.js","sources":["../../../../agent-runtime/src/queue.ts"],"sourcesContent":["/**\n * Derivations for the server-owned statewire queue and steer lanes, shared by\n * every queued-messages tray (Olympus, the React SDK, the Chrome extension).\n *\n * The queue is SERVER-owned: statewire surfaces it on the runs projection.\n * \"Send now\" moves an item into the steer lane (`run/steer` — the host stops\n * the run and dispatches it once the run settles; on a stopped/errored thread\n * the same move dispatches immediately as a stop-/error-continue run) and\n * remove issues `run/dequeue`. While the thread rests stopped/errored,\n * stranded steer-lane entries list ahead of the queue — they dispatch first,\n * as one batch, so they carry Remove but no per-row Send now.\n *\n * Pure helpers only: the host component reads `useStatewireRuns()` and\n * `useDeepAgentThreadStatus()` itself (both mockable per surface) and passes\n * the values in.\n */\n\nimport type { StatewireThread } from '@assistant-ui/react-statewire';\nimport { DEEP_AGENT_COMPOSER_MARKDOWN_KEY } from './composer-markdown';\nimport { ATHENA_RUN_MARKER_CANCELLED, isServerUpdateStopSource } from './messages';\nimport type { DeepAgentThreadStatus } from './thread-status';\n\n/** The text content of a queued entry (non-text parts render as fallbacks). */\nexport function queueEntryText(\n parts: readonly { type: string; text?: string }[],\n): string {\n return parts\n .flatMap((part) =>\n part.type === 'text' && typeof part.text === 'string' ? [part.text] : [],\n )\n .join('\\n\\n');\n}\n\n/**\n * Whether a lane entry is still awaiting its send's settle: the host stamps\n * `meta` on every entry it admits (`_op_meta` — submitter and contextSync\n * snapshot), so a meta-less entry is this client's own optimistic fold. The\n * send is still in flight and can still be refused (billing gate, auth,\n * reconnect), which the tray must not render as an accepted queue position.\n */\nexport function isQueueEntryUnsettled(entry: StatewireThread.RunsQueueEntry): boolean {\n return entry.meta === undefined;\n}\n\n/**\n * The ids of queued entries the user prioritized (⚡ — `run/prioritize`), as\n * the host records them in its durable `prioritizedQueueIds` state. A\n * prioritized entry heads the queue lane and the live run ends at its next\n * model-call boundary to deliver it, so trays render these rows lit and offer\n * \"Remove priority\" instead of \"Prioritize\". Tolerates the key being absent\n * (a thread that never prioritized, a pre-feature host) and ignores anything\n * that is not a string id.\n */\nexport function readPrioritizedQueueIds(raw: unknown): readonly string[] {\n return Array.isArray(raw)\n ? raw.filter((id): id is string => typeof id === 'string')\n : [];\n}\n\nexport interface QueueLaneFlags {\n isRunning: boolean;\n /** A stopped/errored thread can continue with its queued work. */\n isContinuable: boolean;\n}\n\n/** The thread-status split every queue tray keys its affordances on. */\nexport function queueLaneFlags(status: DeepAgentThreadStatus): QueueLaneFlags {\n return {\n isRunning: status === 'running',\n isContinuable: status === 'stopped' || status === 'error',\n };\n}\n\nexport interface StatewireQueueRow {\n item: StatewireThread.RunsQueueEntry;\n lane: 'queue' | 'steer';\n}\n\n/**\n * The rows a queue tray renders, in dispatch order: stranded steer-lane\n * entries first (only while the thread rests continuable — during a run they\n * already render in the message list), then the queue lane.\n */\nexport function buildStatewireQueueRows(options: {\n queue: readonly StatewireThread.RunsQueueEntry[];\n steerQueue: readonly StatewireThread.RunsQueueEntry[];\n isContinuable: boolean;\n}): StatewireQueueRow[] {\n const { queue, steerQueue, isContinuable } = options;\n return [\n ...(isContinuable\n ? steerQueue.map((item) => ({ item, lane: 'steer' as const }))\n : []),\n ...queue.map((item) => ({ item, lane: 'queue' as const })),\n ];\n}\n\n/**\n * Whether a row offers \"Send now\": queue-lane rows only (steer entries already\n * dispatch first), every row while the thread rests continuable, and only the\n * head row while a run is live (later rows would jump the queue order).\n */\nexport function showQueueRowSendNow(options: {\n lane: 'queue' | 'steer';\n index: number;\n isRunning: boolean;\n isContinuable: boolean;\n}): boolean {\n const { lane, index, isRunning, isContinuable } = options;\n return lane === 'queue' && (isContinuable || (isRunning && index === 0));\n}\n\n/**\n * Whether a row offers \"Steer\" (`run/steer-live`): queue-lane rows while a run\n * is live. Steer folds the entry into the RUNNING turn at its next model call\n * — after the in-flight tool chain, never mid-tool — and the run goes on with\n * it in context (ChatGPT's and Codex's Steer, versus Queue). Nothing is\n * cancelled and no second run starts, so every queued row qualifies, not just\n * the head. At rest there is no turn to steer: Send now already dispatches.\n */\nexport function showQueueRowSteer(options: {\n lane: 'queue' | 'steer';\n isRunning: boolean;\n}): boolean {\n return options.lane === 'queue' && options.isRunning;\n}\n\nexport type QueueEditCommand =\n | { type: 'run/steer'; runId: string; message: StatewireThread.UserMessage }\n | { type: 'run/enqueue'; runId: string; message: StatewireThread.UserMessage };\n\n/**\n * Re-send a queued entry under its own id on its own lane with edited text:\n * the host replaces the queued message's content in place, leaving its queue\n * position and lane untouched (a same-id send never dispatches). The built-in\n * queue client has no update command, so this goes straight to the runs\n * protocol. Returns `null` when there is nothing to send — blank or unchanged\n * text, or no live run entry to address.\n */\nexport function buildQueueEditCommand(options: {\n item: StatewireThread.RunsQueueEntry;\n lane: 'queue' | 'steer';\n runId: string | null;\n text: string;\n /**\n * The edited message's metadata, replacing the entry's (the host replaces\n * the queued message whole). Omitted, the entry's metadata is kept, minus a\n * composer markdown that described the old text.\n */\n metadata?: Readonly<Record<string, unknown>> | undefined;\n}): QueueEditCommand | null {\n const { item, lane, runId, text } = options;\n const textChanged: boolean = text !== queueEntryText(item.parts);\n const previous: Readonly<Record<string, unknown>> | undefined = nonEmpty(item.metadata);\n const next: Readonly<Record<string, unknown>> | undefined = nonEmpty(\n options.metadata !== undefined\n ? options.metadata\n : textChanged\n ? withoutComposerMarkdown(item.metadata)\n : item.metadata,\n );\n if (\n !text.trim() ||\n runId === null ||\n (!textChanged && stableJson(next ?? null) === stableJson(previous ?? null))\n ) {\n return null;\n }\n // An entry that had metadata and keeps none sends an empty object: the\n // optimistic lane keeps an entry's metadata when the command carries none,\n // and would go on showing the old composer markdown until the host answers.\n const metadata: Readonly<Record<string, unknown>> | undefined =\n next ?? (previous === undefined ? undefined : {});\n const message: StatewireThread.UserMessage = {\n id: item.id,\n role: 'user',\n parts: [{ type: 'text', text }, ...item.parts.filter((part) => part.type !== 'text')],\n ...(metadata === undefined ? {} : { metadata: { ...metadata } }),\n };\n return lane === 'steer'\n ? { type: 'run/steer', runId, message }\n : { type: 'run/enqueue', runId, message };\n}\n\n/** `metadata` unless it is empty. */\nfunction nonEmpty(\n metadata: Readonly<Record<string, unknown>> | undefined,\n): Readonly<Record<string, unknown>> | undefined {\n return metadata !== undefined && Object.keys(metadata).length > 0 ? metadata : undefined;\n}\n\n/** JSON with object keys sorted, so equal metadata compares equal whatever its key order. */\nfunction stableJson(value: unknown): string {\n const sorted = (entry: unknown): unknown =>\n Array.isArray(entry)\n ? entry.map(sorted)\n : typeof entry === 'object' && entry !== null\n ? Object.fromEntries(\n Object.keys(entry)\n .sort()\n .map((key) => [key, sorted((entry as Record<string, unknown>)[key])]),\n )\n : entry;\n return JSON.stringify(sorted(value));\n}\n\n/** Entry metadata without a composer markdown, `undefined` when nothing is left. */\nfunction withoutComposerMarkdown(\n metadata: Readonly<Record<string, unknown>> | undefined,\n): Readonly<Record<string, unknown>> | undefined {\n if (metadata === undefined || !(DEEP_AGENT_COMPOSER_MARKDOWN_KEY in metadata)) return metadata;\n const { [DEEP_AGENT_COMPOSER_MARKDOWN_KEY]: _stale, ...rest } = metadata;\n return Object.keys(rest).length > 0 ? rest : undefined;\n}\n\n/**\n * Grace between observing a stranded settle and auto-promoting the queue\n * head — long enough for the host's own settle bookkeeping (or a status flap\n * during reconnect) to resolve first, short enough to read as \"it just\n * continued\" rather than \"it hung\".\n */\nexport const QUEUE_AUTO_CONTINUE_DELAY_MS = 2_000;\n\n/** Whether the last cancellation marker records a user or client stop. */\nexport function userStopBlocksQueueAutoContinue(options: {\n marker: string | undefined;\n source: string | undefined;\n}): boolean {\n return (\n options.marker === ATHENA_RUN_MARKER_CANCELLED && !isServerUpdateStopSource(options.source)\n );\n}\n\n/** `fate (cause)[: message]` — the detail a failed-send row carries. */\nexport function describeQueueSendFailure(\n failure: StatewireThread.RunsFailedEntry['sendFailure'],\n): string {\n const message =\n 'message' in failure && failure.message !== undefined ? `: ${failure.message}` : '';\n return `${failure.fate} (${failure.cause})${message}`;\n}\n\n/**\n * Whether a `retryFailed` / `discardFailed` throw is the covered drop race:\n * statewire drops a failed entry on its own as soon as a canonical update\n * shows the message landed, and acting on a just-dropped entry throws. Both\n * the session record (\"unknown failed command\") and the adapter's projection\n * (\"unknown failed entry\") use this prefix. Nothing is lost in that race — the\n * message already made it and the row is about to disappear — so a tray\n * swallows it (keeping telemetry) instead of crashing the click handler.\n */\nexport function isFailedSendEntryRace(error: unknown): boolean {\n return error instanceof Error && error.message.startsWith('statewire: unknown failed');\n}\n"],"names":[],"mappings":"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"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const tap = require("@assistant-ui/tap");
4
4
  const storage = require("statewire/storage");
5
- const react = require("react");
5
+ const require$$0 = require("react");
6
6
  const sessionLaneScope = require("./session-lane-scope.cjs");
7
7
  const statewireTransport = require("./statewire-transport.cjs");
8
8
  const SESSION_PREFIX = "aui:statewire-session:";
@@ -321,7 +321,7 @@ const useQuotaSafeLocalStorageSession = ({
321
321
  const sessionKey = key(threadId);
322
322
  const storageKey = SESSION_PREFIX + sessionKey;
323
323
  const lockName = SESSION_LOCK_PREFIX + sessionKey;
324
- const mountedScope = react.useRef({
324
+ const mountedScope = require$$0.useRef({
325
325
  threadId,
326
326
  laneKey: sessionKey
327
327
  });
@@ -330,9 +330,9 @@ const useQuotaSafeLocalStorageSession = ({
330
330
  "statewire: principal changed; remount the account's thread/session"
331
331
  );
332
332
  }
333
- const latestOnDegraded = react.useRef(onStorageDegraded);
333
+ const latestOnDegraded = require$$0.useRef(onStorageDegraded);
334
334
  latestOnDegraded.current = onStorageDegraded;
335
- const reportDegradation = react.useMemo(() => {
335
+ const reportDegradation = require$$0.useMemo(() => {
336
336
  const reported = /* @__PURE__ */ new Set();
337
337
  return (degradation) => {
338
338
  const handler = latestOnDegraded.current;
@@ -354,13 +354,13 @@ const useQuotaSafeLocalStorageSession = ({
354
354
  }, []);
355
355
  const shared = sharedBackend({ storage: storage$1, locks });
356
356
  shared.listeners.add(reportDegradation);
357
- react.useEffect(() => {
357
+ require$$0.useEffect(() => {
358
358
  shared.listeners.add(reportDegradation);
359
359
  return () => {
360
360
  shared.listeners.delete(reportDegradation);
361
361
  };
362
362
  }, [shared, reportDegradation]);
363
- react.useEffect(() => {
363
+ require$$0.useEffect(() => {
364
364
  const { mounted } = shared;
365
365
  mounted.set(storageKey, (mounted.get(storageKey) ?? 0) + 1);
366
366
  retireExpiredSessionRecords({
@@ -376,7 +376,7 @@ const useQuotaSafeLocalStorageSession = ({
376
376
  else mounted.set(storageKey, count);
377
377
  };
378
378
  }, [shared, storageKey, ttl, reportDegradation]);
379
- react.useEffect(() => {
379
+ require$$0.useEffect(() => {
380
380
  let release;
381
381
  let disposed = false;
382
382
  Promise.resolve(
@@ -398,7 +398,7 @@ const useQuotaSafeLocalStorageSession = ({
398
398
  release == null ? void 0 : release();
399
399
  };
400
400
  }, [locks, storageKey, reportDegradation]);
401
- const migrate = react.useCallback(
401
+ const migrate = require$$0.useCallback(
402
402
  (record, current) => {
403
403
  const migrated = parkIncompatibleSessionCommands(record, current);
404
404
  if (migrated.parked === 0) return migrated.record;
@@ -426,7 +426,7 @@ const useQuotaSafeLocalStorageSession = ({
426
426
  onError: (error) => reportDegradation({ operation: "session", key: storageKey, error })
427
427
  })
428
428
  );
429
- return react.useMemo(
429
+ return require$$0.useMemo(
430
430
  () => ({
431
431
  ...sessionStorage,
432
432
  lock: async (fn) => {