@athenaintel/react 0.41.3 → 0.42.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (479) hide show
  1. package/README.md +132 -10
  2. package/dist/agent-runtime/src/asset-attachment.d.ts +98 -0
  3. package/dist/agent-runtime/src/athena-asset-drag.d.ts +32 -0
  4. package/dist/agent-runtime/src/auth-denial.d.ts +29 -0
  5. package/dist/agent-runtime/src/chat-outbox-attachments.cjs +41 -0
  6. package/dist/agent-runtime/src/chat-outbox-attachments.cjs.map +1 -0
  7. package/dist/agent-runtime/src/chat-outbox-attachments.d.ts +38 -0
  8. package/dist/agent-runtime/src/chat-outbox-attachments.js +41 -0
  9. package/dist/agent-runtime/src/chat-outbox-attachments.js.map +1 -0
  10. package/dist/agent-runtime/src/chat-outbox-signals.cjs +63 -0
  11. package/dist/agent-runtime/src/chat-outbox-signals.cjs.map +1 -0
  12. package/dist/agent-runtime/src/chat-outbox-signals.d.ts +12 -0
  13. package/dist/agent-runtime/src/chat-outbox-signals.js +63 -0
  14. package/dist/agent-runtime/src/chat-outbox-signals.js.map +1 -0
  15. package/dist/agent-runtime/src/chat-outbox-store.cjs +509 -0
  16. package/dist/agent-runtime/src/chat-outbox-store.cjs.map +1 -0
  17. package/dist/agent-runtime/src/chat-outbox-store.d.ts +203 -0
  18. package/dist/agent-runtime/src/chat-outbox-store.js +509 -0
  19. package/dist/agent-runtime/src/chat-outbox-store.js.map +1 -0
  20. package/dist/agent-runtime/src/chat-outbox-thread.cjs +136 -0
  21. package/dist/agent-runtime/src/chat-outbox-thread.cjs.map +1 -0
  22. package/dist/agent-runtime/src/chat-outbox-thread.d.ts +118 -0
  23. package/dist/agent-runtime/src/chat-outbox-thread.js +136 -0
  24. package/dist/agent-runtime/src/chat-outbox-thread.js.map +1 -0
  25. package/dist/agent-runtime/src/chat-outbox.cjs +696 -0
  26. package/dist/agent-runtime/src/chat-outbox.cjs.map +1 -0
  27. package/dist/agent-runtime/src/chat-outbox.d.ts +285 -0
  28. package/dist/agent-runtime/src/chat-outbox.js +696 -0
  29. package/dist/agent-runtime/src/chat-outbox.js.map +1 -0
  30. package/dist/agent-runtime/src/chat-socket-reachability.d.ts +45 -0
  31. package/dist/agent-runtime/src/client-tool-bridge.d.ts +152 -0
  32. package/dist/agent-runtime/src/client-tools.d.ts +133 -0
  33. package/dist/agent-runtime/src/composer-markdown.cjs +10 -0
  34. package/dist/agent-runtime/src/composer-markdown.cjs.map +1 -1
  35. package/dist/agent-runtime/src/composer-markdown.d.ts +108 -0
  36. package/dist/agent-runtime/src/composer-markdown.js +10 -0
  37. package/dist/agent-runtime/src/composer-markdown.js.map +1 -1
  38. package/dist/agent-runtime/src/config-mutations.d.ts +51 -0
  39. package/dist/agent-runtime/src/conversation-index.d.ts +110 -0
  40. package/dist/agent-runtime/src/conversation-list.d.ts +343 -0
  41. package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs +3 -2
  42. package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -1
  43. package/dist/agent-runtime/src/deep-agent-transport-recipe.d.ts +166 -0
  44. package/dist/agent-runtime/src/deep-agent-transport-recipe.js +3 -2
  45. package/dist/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -1
  46. package/dist/agent-runtime/src/desktop-handoff.d.ts +139 -0
  47. package/dist/agent-runtime/src/durable-thread-snapshot-cache.d.ts +60 -0
  48. package/dist/agent-runtime/src/edit-command.d.ts +156 -0
  49. package/dist/agent-runtime/src/errors.d.ts +174 -0
  50. package/dist/agent-runtime/src/execute-output.d.ts +31 -0
  51. package/dist/agent-runtime/src/generated/runconfig-contract.cjs +16 -2
  52. package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
  53. package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +202 -0
  54. package/dist/agent-runtime/src/generated/runconfig-contract.js +16 -2
  55. package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
  56. package/dist/agent-runtime/src/github-wake-event.d.ts +77 -0
  57. package/dist/agent-runtime/src/index.d.ts +74 -0
  58. package/dist/agent-runtime/src/interrupts.cjs +17 -0
  59. package/dist/agent-runtime/src/interrupts.cjs.map +1 -1
  60. package/dist/agent-runtime/src/interrupts.d.ts +348 -0
  61. package/dist/agent-runtime/src/interrupts.js +17 -0
  62. package/dist/agent-runtime/src/interrupts.js.map +1 -1
  63. package/dist/agent-runtime/src/lane-follow.d.ts +121 -0
  64. package/dist/agent-runtime/src/lane-history.cjs +209 -0
  65. package/dist/agent-runtime/src/lane-history.cjs.map +1 -0
  66. package/dist/agent-runtime/src/lane-history.d.ts +175 -0
  67. package/dist/agent-runtime/src/lane-history.js +209 -0
  68. package/dist/agent-runtime/src/lane-history.js.map +1 -0
  69. package/dist/agent-runtime/src/lane-images.d.ts +184 -0
  70. package/dist/agent-runtime/src/message-author.d.ts +43 -0
  71. package/dist/agent-runtime/src/message-text.cjs +15 -0
  72. package/dist/agent-runtime/src/message-text.cjs.map +1 -0
  73. package/dist/agent-runtime/src/message-text.d.ts +47 -0
  74. package/dist/agent-runtime/src/message-text.js +15 -0
  75. package/dist/agent-runtime/src/message-text.js.map +1 -0
  76. package/dist/agent-runtime/src/message-window.cjs +15 -1
  77. package/dist/agent-runtime/src/message-window.cjs.map +1 -1
  78. package/dist/agent-runtime/src/message-window.d.ts +159 -0
  79. package/dist/agent-runtime/src/message-window.js +16 -2
  80. package/dist/agent-runtime/src/message-window.js.map +1 -1
  81. package/dist/agent-runtime/src/messages.cjs +123 -8
  82. package/dist/agent-runtime/src/messages.cjs.map +1 -1
  83. package/dist/agent-runtime/src/messages.d.ts +621 -0
  84. package/dist/agent-runtime/src/messages.js +123 -8
  85. package/dist/agent-runtime/src/messages.js.map +1 -1
  86. package/dist/agent-runtime/src/model-context.d.ts +22 -0
  87. package/dist/agent-runtime/src/offline-status.d.ts +157 -0
  88. package/dist/agent-runtime/src/optimistic-content.d.ts +21 -0
  89. package/dist/agent-runtime/src/protocol.cjs +12 -4
  90. package/dist/agent-runtime/src/protocol.cjs.map +1 -1
  91. package/dist/agent-runtime/src/protocol.d.ts +119 -0
  92. package/dist/agent-runtime/src/protocol.js +13 -5
  93. package/dist/agent-runtime/src/protocol.js.map +1 -1
  94. package/dist/agent-runtime/src/ptc-subcalls.d.ts +51 -0
  95. package/dist/agent-runtime/src/queue.d.ts +138 -0
  96. package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs +10 -0
  97. package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
  98. package/dist/agent-runtime/src/quota-safe-local-storage-session.d.ts +161 -0
  99. package/dist/agent-runtime/src/quota-safe-local-storage-session.js +10 -0
  100. package/dist/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -1
  101. package/dist/agent-runtime/src/running-tool-placeholder.cjs +11 -0
  102. package/dist/agent-runtime/src/running-tool-placeholder.cjs.map +1 -0
  103. package/dist/agent-runtime/src/running-tool-placeholder.d.ts +25 -0
  104. package/dist/agent-runtime/src/running-tool-placeholder.js +11 -0
  105. package/dist/agent-runtime/src/running-tool-placeholder.js.map +1 -0
  106. package/dist/agent-runtime/src/runtime-messages.d.ts +104 -0
  107. package/dist/agent-runtime/src/screen-point.d.ts +151 -0
  108. package/dist/agent-runtime/src/sealed-idb.cjs +112 -0
  109. package/dist/agent-runtime/src/sealed-idb.cjs.map +1 -0
  110. package/dist/agent-runtime/src/sealed-idb.d.ts +106 -0
  111. package/dist/agent-runtime/src/sealed-idb.js +112 -0
  112. package/dist/agent-runtime/src/sealed-idb.js.map +1 -0
  113. package/dist/agent-runtime/src/send-recovery.d.ts +40 -0
  114. package/dist/agent-runtime/src/session-lane-scope.cjs +25 -0
  115. package/dist/agent-runtime/src/session-lane-scope.cjs.map +1 -0
  116. package/dist/agent-runtime/src/session-lane-scope.d.ts +59 -0
  117. package/dist/agent-runtime/src/session-lane-scope.js +25 -0
  118. package/dist/agent-runtime/src/session-lane-scope.js.map +1 -0
  119. package/dist/agent-runtime/src/statewire-attach-observer.d.ts +194 -0
  120. package/dist/agent-runtime/src/statewire-diagnostics.d.ts +74 -0
  121. package/dist/agent-runtime/src/statewire-state.d.ts +29 -0
  122. package/dist/agent-runtime/src/statewire-suspended.cjs.map +1 -1
  123. package/dist/agent-runtime/src/statewire-suspended.d.ts +27 -0
  124. package/dist/agent-runtime/src/statewire-suspended.js.map +1 -1
  125. package/dist/agent-runtime/src/statewire-transport.d.ts +40 -0
  126. package/dist/agent-runtime/src/streaming-markdown.d.ts +46 -0
  127. package/dist/agent-runtime/src/subagent-transcripts.cjs +209 -0
  128. package/dist/agent-runtime/src/subagent-transcripts.cjs.map +1 -0
  129. package/dist/agent-runtime/src/subagent-transcripts.d.ts +71 -0
  130. package/dist/agent-runtime/src/subagent-transcripts.js +209 -0
  131. package/dist/agent-runtime/src/subagent-transcripts.js.map +1 -0
  132. package/dist/agent-runtime/src/subagents.cjs +253 -0
  133. package/dist/agent-runtime/src/subagents.cjs.map +1 -0
  134. package/dist/agent-runtime/src/subagents.d.ts +311 -0
  135. package/dist/agent-runtime/src/subagents.js +253 -0
  136. package/dist/agent-runtime/src/subagents.js.map +1 -0
  137. package/dist/agent-runtime/src/subscription-wake-event.d.ts +111 -0
  138. package/dist/agent-runtime/src/thread-extras.d.ts +43 -0
  139. package/dist/agent-runtime/src/thread-handoff.d.ts +364 -0
  140. package/dist/agent-runtime/src/thread-prewarm-controller.d.ts +76 -0
  141. package/dist/agent-runtime/src/thread-prewarm.d.ts +118 -0
  142. package/dist/agent-runtime/src/thread-snapshot-cache.d.ts +99 -0
  143. package/dist/agent-runtime/src/thread-snapshot-mirror.cjs +46 -117
  144. package/dist/agent-runtime/src/thread-snapshot-mirror.cjs.map +1 -1
  145. package/dist/agent-runtime/src/thread-snapshot-mirror.d.ts +101 -0
  146. package/dist/agent-runtime/src/thread-snapshot-mirror.js +17 -88
  147. package/dist/agent-runtime/src/thread-snapshot-mirror.js.map +1 -1
  148. package/dist/agent-runtime/src/thread-status.d.ts +53 -0
  149. package/dist/agent-runtime/src/tool-metadata.d.ts +146 -0
  150. package/dist/agent-runtime/src/tool-names.cjs +71 -0
  151. package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
  152. package/dist/agent-runtime/src/tool-names.d.ts +67 -0
  153. package/dist/agent-runtime/src/tool-names.js +72 -1
  154. package/dist/agent-runtime/src/tool-names.js.map +1 -1
  155. package/dist/agent-runtime/src/tool-outputs.d.ts +35 -0
  156. package/dist/agent-runtime/src/tool-result.cjs +1 -0
  157. package/dist/agent-runtime/src/tool-result.cjs.map +1 -1
  158. package/dist/agent-runtime/src/tool-result.d.ts +126 -0
  159. package/dist/agent-runtime/src/tool-result.js +1 -0
  160. package/dist/agent-runtime/src/tool-result.js.map +1 -1
  161. package/dist/agent-runtime/src/types.d.ts +159 -0
  162. package/dist/agent-runtime/src/use-conversation-list.d.ts +76 -0
  163. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +136 -0
  164. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -0
  165. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +64 -0
  166. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +136 -0
  167. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -0
  168. package/dist/agent-runtime/src/use-deep-agent-config.d.ts +169 -0
  169. package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs +13 -0
  170. package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
  171. package/dist/agent-runtime/src/use-deep-agent-edit-submit.d.ts +22 -0
  172. package/dist/agent-runtime/src/use-deep-agent-edit-submit.js +13 -0
  173. package/dist/agent-runtime/src/use-deep-agent-edit-submit.js.map +1 -1
  174. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +37 -2
  175. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
  176. package/dist/agent-runtime/src/use-deep-agent-runtime.d.ts +177 -0
  177. package/dist/agent-runtime/src/use-deep-agent-runtime.js +38 -3
  178. package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
  179. package/dist/agent-runtime/src/use-deep-agent-thread.cjs +39 -13
  180. package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
  181. package/dist/agent-runtime/src/use-deep-agent-thread.d.ts +352 -0
  182. package/dist/agent-runtime/src/use-deep-agent-thread.js +39 -13
  183. package/dist/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
  184. package/dist/agent-runtime/src/use-deep-agent-voice.cjs +1019 -0
  185. package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -0
  186. package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +409 -0
  187. package/dist/agent-runtime/src/use-deep-agent-voice.js +1019 -0
  188. package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -0
  189. package/dist/agent-runtime/src/use-deep-agent-window-sync.d.ts +102 -0
  190. package/dist/agent-runtime/src/use-historical-edit-attachments.d.ts +2 -0
  191. package/dist/agent-runtime/src/use-thread-handoff-flow.d.ts +84 -0
  192. package/dist/agent-runtime/src/voice-presentation.cjs +2 -0
  193. package/dist/agent-runtime/src/voice-presentation.cjs.map +1 -1
  194. package/dist/agent-runtime/src/voice-presentation.d.ts +80 -0
  195. package/dist/agent-runtime/src/voice-presentation.js +2 -0
  196. package/dist/agent-runtime/src/voice-presentation.js.map +1 -1
  197. package/dist/agent-runtime/src/voice-turn-grouping.d.ts +28 -0
  198. package/dist/agent-runtime/src/voice-wire-types.d.ts +15 -0
  199. package/dist/agent-runtime/src/withdrawn-turns.d.ts +97 -0
  200. package/dist/catalog/runtime-catalog.js +1 -1
  201. package/dist/chat/AthenaChat.cjs +192 -103
  202. package/dist/chat/AthenaChat.cjs.map +1 -1
  203. package/dist/chat/AthenaChat.d.ts +9 -0
  204. package/dist/chat/AthenaChat.js +194 -105
  205. package/dist/chat/AthenaChat.js.map +1 -1
  206. package/dist/chat/StatewireApprovalCard.d.ts +1 -1
  207. package/dist/chat/StatewireClientToolBridge.d.ts +1 -1
  208. package/dist/chat/StatewireQueuedMessages.cjs +11 -4
  209. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
  210. package/dist/chat/StatewireQueuedMessages.d.ts +1 -1
  211. package/dist/chat/StatewireQueuedMessages.js +11 -4
  212. package/dist/chat/StatewireQueuedMessages.js.map +1 -1
  213. package/dist/chat/chat-outbox-rows.cjs +223 -0
  214. package/dist/chat/chat-outbox-rows.cjs.map +1 -0
  215. package/dist/chat/chat-outbox-rows.d.ts +29 -0
  216. package/dist/chat/chat-outbox-rows.js +223 -0
  217. package/dist/chat/chat-outbox-rows.js.map +1 -0
  218. package/dist/chat/chat-voice-controls.cjs +128 -0
  219. package/dist/chat/chat-voice-controls.cjs.map +1 -0
  220. package/dist/chat/chat-voice-controls.d.ts +19 -0
  221. package/dist/chat/chat-voice-controls.js +128 -0
  222. package/dist/chat/chat-voice-controls.js.map +1 -0
  223. package/dist/chat/statewire-approval.d.ts +1 -1
  224. package/dist/chat/statewire-client-tools.d.ts +1 -1
  225. package/dist/chat/super-grouping/SuperGroupingCard.cjs +3 -1
  226. package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
  227. package/dist/chat/super-grouping/SuperGroupingCard.d.ts +7 -1
  228. package/dist/chat/super-grouping/SuperGroupingCard.js +3 -1
  229. package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
  230. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +7 -2
  231. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -1
  232. package/dist/chat/super-grouping/SuperGroupingTranscript.d.ts +2 -2
  233. package/dist/chat/super-grouping/SuperGroupingTranscript.js +7 -2
  234. package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -1
  235. package/dist/chat/super-grouping/activity-timeline.cjs +15 -8
  236. package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
  237. package/dist/chat/super-grouping/activity-timeline.d.ts +18 -8
  238. package/dist/chat/super-grouping/activity-timeline.js +15 -8
  239. package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
  240. package/dist/chat/use-statewire-approval-request.cjs +36 -0
  241. package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
  242. package/dist/chat/use-statewire-approval-request.d.ts +49 -1
  243. package/dist/chat/use-statewire-approval-request.js +39 -3
  244. package/dist/chat/use-statewire-approval-request.js.map +1 -1
  245. package/dist/chat-ui/composer/tiptap-composer.cjs +133 -14
  246. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
  247. package/dist/chat-ui/composer/tiptap-composer.d.ts +33 -1
  248. package/dist/chat-ui/composer/tiptap-composer.js +135 -16
  249. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
  250. package/dist/chat-ui/header/conversation-history-panel.d.ts +1 -1
  251. package/dist/chat-ui/index.d.ts +1 -1
  252. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +2 -1
  253. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
  254. package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +3 -1
  255. package/dist/chat-ui/mentions/suggestions/data/api-client.js +2 -1
  256. package/dist/chat-ui/mentions/suggestions/data/api-client.js.map +1 -1
  257. package/dist/chat-ui/mentions/use-account-workspace-id.cjs +29 -51
  258. package/dist/chat-ui/mentions/use-account-workspace-id.cjs.map +1 -1
  259. package/dist/chat-ui/mentions/use-account-workspace-id.d.ts +2 -2
  260. package/dist/chat-ui/mentions/use-account-workspace-id.js +30 -52
  261. package/dist/chat-ui/mentions/use-account-workspace-id.js.map +1 -1
  262. package/dist/chat-ui/messages/message-components.cjs +15 -0
  263. package/dist/chat-ui/messages/message-components.cjs.map +1 -1
  264. package/dist/chat-ui/messages/message-components.js +15 -0
  265. package/dist/chat-ui/messages/message-components.js.map +1 -1
  266. package/dist/chat-ui/messages/runtime-message.d.ts +1 -1
  267. package/dist/chat-ui/messages/statewire-continue-run.d.ts +1 -1
  268. package/dist/chat-ui/messages/user-edit-composer.cjs +15 -2
  269. package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
  270. package/dist/chat-ui/messages/user-edit-composer.d.ts +4 -2
  271. package/dist/chat-ui/messages/user-edit-composer.js +15 -2
  272. package/dist/chat-ui/messages/user-edit-composer.js.map +1 -1
  273. package/dist/chat-ui/messages/wake-marker.d.ts +1 -1
  274. package/dist/chat-ui/rich-text/chat-text-schema.cjs +1 -0
  275. package/dist/chat-ui/rich-text/chat-text-schema.cjs.map +1 -1
  276. package/dist/chat-ui/rich-text/chat-text-schema.d.ts +3 -0
  277. package/dist/chat-ui/rich-text/chat-text-schema.js +1 -0
  278. package/dist/chat-ui/rich-text/chat-text-schema.js.map +1 -1
  279. package/dist/chat-ui/statewire.cjs +1 -0
  280. package/dist/chat-ui/statewire.cjs.map +1 -1
  281. package/dist/chat-ui/statewire.d.ts +2 -2
  282. package/dist/chat-ui/statewire.js +2 -1
  283. package/dist/chat-ui/thread/composer-send-or-stop.cjs +2 -1
  284. package/dist/chat-ui/thread/composer-send-or-stop.cjs.map +1 -1
  285. package/dist/chat-ui/thread/composer-send-or-stop.d.ts +2 -0
  286. package/dist/chat-ui/thread/composer-send-or-stop.js +2 -1
  287. package/dist/chat-ui/thread/composer-send-or-stop.js.map +1 -1
  288. package/dist/chat-ui/thread/statewire-history-edge.d.ts +1 -1
  289. package/dist/composer/AttachmentContext.cjs +8 -4
  290. package/dist/composer/AttachmentContext.cjs.map +1 -1
  291. package/dist/composer/AttachmentContext.d.ts +7 -0
  292. package/dist/composer/AttachmentContext.js +8 -4
  293. package/dist/composer/AttachmentContext.js.map +1 -1
  294. package/dist/composer/build-composed-message.cjs +34 -0
  295. package/dist/composer/build-composed-message.cjs.map +1 -1
  296. package/dist/composer/build-composed-message.d.ts +20 -0
  297. package/dist/composer/build-composed-message.js +35 -1
  298. package/dist/composer/build-composed-message.js.map +1 -1
  299. package/dist/composer/composer-handoff.cjs +39 -2
  300. package/dist/composer/composer-handoff.cjs.map +1 -1
  301. package/dist/composer/composer-handoff.d.ts +28 -3
  302. package/dist/composer/composer-handoff.js +39 -2
  303. package/dist/composer/composer-handoff.js.map +1 -1
  304. package/dist/composer/useAttachFiles.cjs +15 -2
  305. package/dist/composer/useAttachFiles.cjs.map +1 -1
  306. package/dist/composer/useAttachFiles.d.ts +11 -0
  307. package/dist/composer/useAttachFiles.js +15 -2
  308. package/dist/composer/useAttachFiles.js.map +1 -1
  309. package/dist/composer/useSendMessage.cjs.map +1 -1
  310. package/dist/composer/useSendMessage.d.ts +4 -3
  311. package/dist/composer/useSendMessage.js.map +1 -1
  312. package/dist/diagnostics/athena-diagnostics.cjs.map +1 -1
  313. package/dist/diagnostics/athena-diagnostics.d.ts +3 -1
  314. package/dist/diagnostics/athena-diagnostics.js.map +1 -1
  315. package/dist/index.cjs +13 -0
  316. package/dist/index.cjs.map +1 -1
  317. package/dist/index.d.ts +14 -7
  318. package/dist/index.js +14 -1
  319. package/dist/index.js.map +1 -1
  320. package/dist/offline/chat-outbox.cjs +57 -0
  321. package/dist/offline/chat-outbox.cjs.map +1 -0
  322. package/dist/offline/chat-outbox.d.ts +80 -0
  323. package/dist/offline/chat-outbox.js +57 -0
  324. package/dist/offline/chat-outbox.js.map +1 -0
  325. package/dist/offline/offline-history.d.ts +1 -1
  326. package/dist/provider/AthenaProvider.cjs +162 -8
  327. package/dist/provider/AthenaProvider.cjs.map +1 -1
  328. package/dist/provider/AthenaProvider.d.ts +15 -1
  329. package/dist/provider/AthenaProvider.js +163 -9
  330. package/dist/provider/AthenaProvider.js.map +1 -1
  331. package/dist/provider/statewire-window-context.d.ts +1 -1
  332. package/dist/react/package.json.cjs +1 -1
  333. package/dist/react/package.json.js +1 -1
  334. package/dist/references/src/anchors/file-line-range.d.ts +58 -0
  335. package/dist/references/src/anchors/format.d.ts +21 -0
  336. package/dist/references/src/anchors/message-anchors.d.ts +71 -0
  337. package/dist/references/src/anchors/parse.d.ts +8 -0
  338. package/dist/references/src/anchors/registry-contract.d.ts +24 -0
  339. package/dist/references/src/anchors/registry.d.ts +19 -0
  340. package/dist/references/src/anchors/schemas.d.ts +194 -0
  341. package/dist/references/src/anchors/serialize.d.ts +8 -0
  342. package/dist/references/src/anchors/time.d.ts +78 -0
  343. package/dist/references/src/anchors/types.d.ts +474 -0
  344. package/dist/references/src/asset-bounds.d.ts +27 -0
  345. package/dist/references/src/asset-links.d.ts +23 -0
  346. package/dist/references/src/asset-reference.d.ts +16 -0
  347. package/dist/references/src/formats/format-catalog.d.ts +79 -0
  348. package/dist/references/src/formats/markdown/parse-reference-markdown.d.ts +28 -0
  349. package/dist/references/src/formats/markdown/reference-display-name.d.ts +6 -0
  350. package/dist/references/src/formats/object/asset-object.d.ts +9 -0
  351. package/dist/references/src/formats/object/callable-object.d.ts +6 -0
  352. package/dist/references/src/formats/object/decode-reference-object-payload.d.ts +3 -0
  353. package/dist/references/src/formats/object/external-url-object.d.ts +9 -0
  354. package/dist/references/src/formats/object/group-object.d.ts +9 -0
  355. package/dist/references/src/formats/object/navigation-object.d.ts +9 -0
  356. package/dist/references/src/formats/object/parse-reference-object.d.ts +11 -0
  357. package/dist/references/src/formats/object/person-object.d.ts +9 -0
  358. package/dist/references/src/formats/uri/asset-mention-uri.d.ts +9 -0
  359. package/dist/references/src/formats/uri/asset-spaces-url.d.ts +9 -0
  360. package/dist/references/src/formats/uri/callable-mention-uris.d.ts +9 -0
  361. package/dist/references/src/formats/uri/detect-uri-wire.d.ts +9 -0
  362. package/dist/references/src/formats/uri/group-mention-uri.d.ts +12 -0
  363. package/dist/references/src/formats/uri/navigation-spaces-url.d.ts +14 -0
  364. package/dist/references/src/formats/uri/parse-reference-uri.d.ts +20 -0
  365. package/dist/references/src/formats/uri/person-mention-uri.d.ts +9 -0
  366. package/dist/references/src/formats/uri/template-placeholder.d.ts +12 -0
  367. package/dist/references/src/index.d.ts +47 -0
  368. package/dist/references/src/legacy/index.d.ts +14 -0
  369. package/dist/references/src/legacy/pre-reference-asset-url.d.ts +57 -0
  370. package/dist/references/src/legacy/pre-reference-citation-bridge.d.ts +22 -0
  371. package/dist/references/src/legacy/pre-reference-citation.d.ts +138 -0
  372. package/dist/references/src/legacy/pre-reference-external-url.d.ts +31 -0
  373. package/dist/references/src/legacy/pre-reference-format.d.ts +8 -0
  374. package/dist/references/src/legacy/pre-reference-mention.d.ts +27 -0
  375. package/dist/references/src/legacy/pre-reference-object.d.ts +8 -0
  376. package/dist/references/src/legacy/pre-reference-uri.d.ts +12 -0
  377. package/dist/references/src/legacy.d.ts +2 -0
  378. package/dist/references/src/mention-href-patterns.d.ts +19 -0
  379. package/dist/references/src/mention-node/index.d.ts +5 -0
  380. package/dist/references/src/mention-node/mention-node.d.ts +31 -0
  381. package/dist/references/src/mention-node/resolve-node-attrs.d.ts +27 -0
  382. package/dist/references/src/parse-reference.d.ts +23 -0
  383. package/dist/references/src/schemas.d.ts +463 -0
  384. package/dist/references/src/serialize-reference.d.ts +50 -0
  385. package/dist/references/src/sheet-name.d.ts +10 -0
  386. package/dist/references/src/tool-option-schemas.d.ts +597 -0
  387. package/dist/references/src/types.d.ts +125 -0
  388. package/dist/references/src/version-ref.d.ts +30 -0
  389. package/dist/runtime/statewire-lifecycle.d.ts +1 -1
  390. package/dist/runtime/statewire-model-lane.d.ts +1 -1
  391. package/dist/runtime/statewire-server-lane-context.d.ts +1 -1
  392. package/dist/runtime/statewire-session-key.cjs +7 -0
  393. package/dist/runtime/statewire-session-key.cjs.map +1 -1
  394. package/dist/runtime/statewire-session-key.d.ts +19 -0
  395. package/dist/runtime/statewire-session-key.js +8 -1
  396. package/dist/runtime/statewire-session-key.js.map +1 -1
  397. package/dist/runtime/statewire-session-lane.cjs +48 -0
  398. package/dist/runtime/statewire-session-lane.cjs.map +1 -0
  399. package/dist/runtime/statewire-session-lane.d.ts +29 -0
  400. package/dist/runtime/statewire-session-lane.js +48 -0
  401. package/dist/runtime/statewire-session-lane.js.map +1 -0
  402. package/dist/runtime/statewire-thread-config-lane.d.ts +1 -1
  403. package/dist/runtime/useAthenaStatewireRuntime.cjs +19 -5
  404. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
  405. package/dist/runtime/useAthenaStatewireRuntime.d.ts +15 -1
  406. package/dist/runtime/useAthenaStatewireRuntime.js +20 -6
  407. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
  408. package/dist/styles.css +1 -1
  409. package/dist/threads/api.d.ts +1 -1
  410. package/dist/threads/conversation-list-fetcher.d.ts +1 -1
  411. package/dist/threads/index-triggered-refresh.cjs +164 -0
  412. package/dist/threads/index-triggered-refresh.cjs.map +1 -0
  413. package/dist/threads/index-triggered-refresh.d.ts +70 -0
  414. package/dist/threads/index-triggered-refresh.js +164 -0
  415. package/dist/threads/index-triggered-refresh.js.map +1 -0
  416. package/dist/threads/offline-session-list.d.ts +1 -1
  417. package/dist/threads/pull-request-display.d.ts +1 -1
  418. package/dist/threads/session-list-model.d.ts +1 -1
  419. package/dist/threads/session-list-tab-share.cjs +150 -0
  420. package/dist/threads/session-list-tab-share.cjs.map +1 -0
  421. package/dist/threads/session-list-tab-share.d.ts +73 -0
  422. package/dist/threads/session-list-tab-share.js +150 -0
  423. package/dist/threads/session-list-tab-share.js.map +1 -0
  424. package/dist/threads/session-row-parts.d.ts +1 -1
  425. package/dist/threads/sessions-query.d.ts +1 -1
  426. package/dist/threads/statewire-thread-list.cjs +42 -16
  427. package/dist/threads/statewire-thread-list.cjs.map +1 -1
  428. package/dist/threads/statewire-thread-list.d.ts +11 -2
  429. package/dist/threads/statewire-thread-list.js +43 -17
  430. package/dist/threads/statewire-thread-list.js.map +1 -1
  431. package/dist/threads/thread-prefetcher.d.ts +1 -1
  432. package/dist/threads/use-athena-session-attention.d.ts +1 -1
  433. package/dist/threads/use-athena-sessions.cjs +32 -22
  434. package/dist/threads/use-athena-sessions.cjs.map +1 -1
  435. package/dist/threads/use-athena-sessions.js +33 -23
  436. package/dist/threads/use-athena-sessions.js.map +1 -1
  437. package/dist/threads/use-rest-conversation-history.d.ts +1 -1
  438. package/dist/threads/use-statewire-conversation-history.d.ts +5 -5
  439. package/dist/tiptap-markdown-table/src/markdown-table-serializer.d.ts +56 -0
  440. package/dist/tools/NestedPtcMessages.cjs +14 -9
  441. package/dist/tools/NestedPtcMessages.cjs.map +1 -1
  442. package/dist/tools/NestedPtcMessages.d.ts +9 -0
  443. package/dist/tools/NestedPtcMessages.js +6 -1
  444. package/dist/tools/NestedPtcMessages.js.map +1 -1
  445. package/dist/tools/index.d.ts +1 -1
  446. package/dist/tools/primitives.d.ts +1 -1
  447. package/dist/tools/subagent-task-tool-ui.cjs +494 -0
  448. package/dist/tools/subagent-task-tool-ui.cjs.map +1 -0
  449. package/dist/tools/subagent-task-tool-ui.d.ts +109 -0
  450. package/dist/tools/subagent-task-tool-ui.js +494 -0
  451. package/dist/tools/subagent-task-tool-ui.js.map +1 -0
  452. package/dist/tools/tool-fallback.d.ts +1 -1
  453. package/dist/tools/tool-icons.d.ts +1 -1
  454. package/dist/tools/tool-summary.d.ts +1 -1
  455. package/dist/tools/tool-uis.cjs +4 -0
  456. package/dist/tools/tool-uis.cjs.map +1 -1
  457. package/dist/tools/tool-uis.js +4 -0
  458. package/dist/tools/tool-uis.js.map +1 -1
  459. package/dist/voice/chat.cjs +6 -0
  460. package/dist/voice/chat.cjs.map +1 -0
  461. package/dist/voice/chat.d.ts +2 -0
  462. package/dist/voice/chat.js +6 -0
  463. package/dist/voice/chat.js.map +1 -0
  464. package/dist/voice/livekit-join.cjs +119 -0
  465. package/dist/voice/livekit-join.cjs.map +1 -0
  466. package/dist/voice/livekit-join.d.ts +8 -0
  467. package/dist/voice/livekit-join.js +119 -0
  468. package/dist/voice/livekit-join.js.map +1 -0
  469. package/dist/voice/livekit.cjs +32 -0
  470. package/dist/voice/livekit.cjs.map +1 -0
  471. package/dist/voice/livekit.d.ts +80 -0
  472. package/dist/voice/livekit.js +32 -0
  473. package/dist/voice/livekit.js.map +1 -0
  474. package/dist/voice/use-chat-voice-enabled.cjs +43 -0
  475. package/dist/voice/use-chat-voice-enabled.cjs.map +1 -0
  476. package/dist/voice/use-chat-voice-enabled.d.ts +9 -0
  477. package/dist/voice/use-chat-voice-enabled.js +43 -0
  478. package/dist/voice/use-chat-voice-enabled.js.map +1 -0
  479. package/package.json +22 -16
@@ -0,0 +1,21 @@
1
+ import type { LangChainMessage } from '@assistant-ui/react-langgraph';
2
+ /** Parts of a pending user message the optimistic bubble can render. */
3
+ export type OptimisticContentPart = {
4
+ type: 'text';
5
+ text: string;
6
+ } | {
7
+ type: 'image';
8
+ image: string;
9
+ };
10
+ type HumanMessageContent = Extract<LangChainMessage, {
11
+ type: 'human';
12
+ }>['content'];
13
+ /**
14
+ * Content for the optimistic human bubble built from a pending send. Image
15
+ * attachment parts become LangChain `image_url` blocks so the just-sent
16
+ * message renders its images immediately instead of waiting for the backend
17
+ * echo (which only carries images after server-side mention extraction).
18
+ * Text-only sends keep the plain joined string.
19
+ */
20
+ export declare const buildOptimisticHumanContent: (parts: readonly OptimisticContentPart[]) => HumanMessageContent;
21
+ export {};
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const runconfigContract = require("./generated/runconfig-contract.cjs");
4
+ const DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION = runconfigContract.DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION - 1;
5
+ function declaredDeepAgentProtocolVersion({
6
+ laneHistory = false
7
+ } = {}) {
8
+ return laneHistory ? runconfigContract.DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION : DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION;
9
+ }
4
10
  const isContractVersion = (value) => typeof value === "number" && Number.isInteger(value) && value >= 1;
5
11
  function readDeepAgentProtocol(state) {
6
12
  if (typeof state !== "object" || state === null) return null;
@@ -10,12 +16,12 @@ function readDeepAgentProtocol(state) {
10
16
  if (!isContractVersion(version)) return null;
11
17
  return { version };
12
18
  }
13
- function projectDeepAgentProtocol(state) {
19
+ function projectDeepAgentProtocol(state, declaration = {}) {
14
20
  const lane = readDeepAgentProtocol(state);
15
21
  if (lane === null) return null;
16
22
  return {
17
23
  protocolVersion: lane.version,
18
- clientVersion: runconfigContract.DEEP_AGENT_PROTOCOL_VERSION
24
+ clientVersion: declaredDeepAgentProtocolVersion(declaration)
19
25
  };
20
26
  }
21
27
  const seedProtocolLanes = /* @__PURE__ */ new WeakSet();
@@ -31,13 +37,15 @@ function isDeepAgentHostState(state) {
31
37
  const lane = state[runconfigContract.DEEP_AGENT_PROTOCOL_STATE_KEY];
32
38
  return typeof lane === "object" && lane !== null && readDeepAgentProtocol(state) !== null && !seedProtocolLanes.has(lane);
33
39
  }
34
- function withDeclaredProtocolVersion(headers) {
40
+ function withDeclaredProtocolVersion(headers, declaration = {}) {
35
41
  if (runconfigContract.DEEP_AGENT_PROTOCOL_VERSION_HEADER in headers) return headers;
36
42
  return {
37
43
  ...headers,
38
- [runconfigContract.DEEP_AGENT_PROTOCOL_VERSION_HEADER]: String(runconfigContract.DEEP_AGENT_PROTOCOL_VERSION)
44
+ [runconfigContract.DEEP_AGENT_PROTOCOL_VERSION_HEADER]: String(declaredDeepAgentProtocolVersion(declaration))
39
45
  };
40
46
  }
47
+ exports.DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION = DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION;
48
+ exports.declaredDeepAgentProtocolVersion = declaredDeepAgentProtocolVersion;
41
49
  exports.isDeepAgentHostState = isDeepAgentHostState;
42
50
  exports.projectDeepAgentProtocol = projectDeepAgentProtocol;
43
51
  exports.readDeepAgentProtocol = readDeepAgentProtocol;
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.cjs","sources":["../../../../agent-runtime/src/protocol.ts"],"sourcesContent":["import {\n DEEP_AGENT_PROTOCOL_STATE_KEY,\n DEEP_AGENT_PROTOCOL_VERSION,\n DEEP_AGENT_PROTOCOL_VERSION_HEADER,\n} from './generated/runconfig-contract';\nimport type { DeepAgentStreamValues } from './types';\n\n/**\n * Wire-contract version declaration between the deep-agent statewire host and\n * this client build (the client half of agora's\n * `agora/graphs/athena_deep_agent/protocol_version.py`; upstream ask\n * assistant-ui/statewire #31506 would make this a library concern).\n *\n * - Declaration: {@link withDeclaredProtocolVersion} stamps the version this\n * build speaks (`DEEP_AGENT_PROTOCOL_VERSION`, generated from the Python\n * source of truth) onto the attach headers — they ride the first WS frame's\n * mandatory `headers` field / the SSE request headers, so no statewire\n * change is needed. The host records it for attach telemetry and\n * per-version behaviour selection only.\n * - Advertisement: the host publishes its own `version` under the `protocol`\n * state key in every attach snapshot; {@link readDeepAgentProtocol} /\n * {@link projectDeepAgentProtocol} read it.\n *\n * There is no minimum client version: the host refuses no command for the\n * version its client declared (or for declaring none), so nothing here\n * compares versions or gates a send. Hosts still publish a `minClientVersion`\n * key (the constant 1) for installed clients whose lane reader required it;\n * this reader ignores it.\n *\n * Skew-tolerant on both sides: an old server advertises nothing (project\n * `null`, gate nothing), and a malformed lane reads as absent — the\n * declaration must never brick a client that could otherwise talk.\n */\nexport interface DeepAgentWireProtocol {\n /** The wire-contract version the server speaks. */\n version: number;\n}\n\n/** The advertised-lane projection a host surface reads. */\nexport interface DeepAgentProtocolStatus {\n /** Server-advertised current contract version. */\n protocolVersion: number;\n /** The contract version THIS client build declares. */\n clientVersion: number;\n}\n\nconst isContractVersion = (value: unknown): value is number =>\n typeof value === 'number' && Number.isInteger(value) && value >= 1;\n\n/**\n * The server-advertised version lane off a raw statewire state, or `null`\n * while it is unreadable — pre-attach, a pre-negotiation server's snapshot\n * (no lane), or a malformed lane (tolerated as absent, never thrown on).\n */\nexport function readDeepAgentProtocol(state: unknown): DeepAgentWireProtocol | null {\n if (typeof state !== 'object' || state === null) return null;\n const lane = (state as Record<string, unknown>)[DEEP_AGENT_PROTOCOL_STATE_KEY];\n if (typeof lane !== 'object' || lane === null) return null;\n const { version } = lane as Record<string, unknown>;\n if (!isContractVersion(version)) return null;\n return { version };\n}\n\n/**\n * Project the advertised version for a host surface, or `null` while the\n * server has not advertised (see {@link readDeepAgentProtocol}). Pure and\n * selector-safe, mirroring `readSessionPersisted`.\n */\nexport function projectDeepAgentProtocol(state: unknown): DeepAgentProtocolStatus | null {\n const lane = readDeepAgentProtocol(state);\n if (lane === null) return null;\n return {\n protocolVersion: lane.version,\n clientVersion: DEEP_AGENT_PROTOCOL_VERSION,\n };\n}\n\n/**\n * The protocol lanes seeds carry ({@link withSeedProtocolLane}), by identity.\n * Statewire's optimistic folds are copy-on-write, so every state folded over a\n * seed keeps its lane object, while a state the host sent never holds one\n * (each is parsed off the wire).\n */\nconst seedProtocolLanes = new WeakSet<object>();\n\n/**\n * `state` with a protocol lane of its own, remembered as a seed's — for the\n * remembered states a mount is seeded with (`toThreadSnapshotSeed`), whose\n * lanes are what the host sent an earlier attach. The lane is copied rather\n * than remembered in place, so a live attach still holding the original object\n * is never read as a seed.\n */\nexport function withSeedProtocolLane(state: DeepAgentStreamValues): DeepAgentStreamValues {\n const lane = state.protocol;\n if (typeof lane !== 'object' || lane === null) return state;\n const seeded = { ...lane };\n seedProtocolLanes.add(seeded);\n return { ...state, protocol: seeded };\n}\n\n/**\n * Whether `state` is one the host sent on this attach. The host advertises the\n * protocol lane in every attach snapshot and keeps it on every later frame;\n * the states a thread renders before its snapshot carry none (the placeholder\n * an existing thread loads with, and any optimistic fold over it) or a seed's\n * ({@link withSeedProtocolLane}).\n *\n * Decide anything about what the host holds — its config lane above all —\n * from these states only, never from the connection status: on a thread\n * mid-run the channel reports `connected` before the attach snapshot applies,\n * and a placeholder read as the host's says the thread has no config.\n *\n * A host predating the lane (2026-08-28) never answers true; the config lane\n * writes clients make (`config/patch`, 2026-09-05) came after it.\n */\nexport function isDeepAgentHostState(state: unknown): boolean {\n if (typeof state !== 'object' || state === null) return false;\n const lane = (state as Record<string, unknown>)[DEEP_AGENT_PROTOCOL_STATE_KEY];\n return (\n typeof lane === 'object' &&\n lane !== null &&\n readDeepAgentProtocol(state) !== null &&\n !seedProtocolLanes.has(lane)\n );\n}\n\n/**\n * Attach headers with this build's contract version declared. Applied by\n * `useDeepAgentThread` to every resolved header set, so all surfaces declare\n * without per-host wiring; an explicit entry (tests, forced overrides) wins.\n */\nexport function withDeclaredProtocolVersion(\n headers: Record<string, string>\n): Record<string, string> {\n if (DEEP_AGENT_PROTOCOL_VERSION_HEADER in headers) return headers;\n return {\n ...headers,\n [DEEP_AGENT_PROTOCOL_VERSION_HEADER]: String(DEEP_AGENT_PROTOCOL_VERSION),\n };\n}\n"],"names":["DEEP_AGENT_PROTOCOL_STATE_KEY","DEEP_AGENT_PROTOCOL_VERSION","DEEP_AGENT_PROTOCOL_VERSION_HEADER"],"mappings":";;;AA8CA,MAAM,oBAAoB,CAAC,UACzB,OAAO,UAAU,YAAY,OAAO,UAAU,KAAK,KAAK,SAAS;AAO5D,SAAS,sBAAsB,OAA8C;AAClF,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,OAAQ,MAAkCA,+CAA6B;AAC7E,MAAI,OAAO,SAAS,YAAY,SAAS,KAAM,QAAO;AACtD,QAAM,EAAE,YAAY;AACpB,MAAI,CAAC,kBAAkB,OAAO,EAAG,QAAO;AACxC,SAAO,EAAE,QAAA;AACX;AAOO,SAAS,yBAAyB,OAAgD;AACvF,QAAM,OAAO,sBAAsB,KAAK;AACxC,MAAI,SAAS,KAAM,QAAO;AAC1B,SAAO;AAAA,IACL,iBAAiB,KAAK;AAAA,IACtB,eAAeC,kBAAAA;AAAAA,EAAA;AAEnB;AAQA,MAAM,wCAAwB,QAAA;AASvB,SAAS,qBAAqB,OAAqD;AACxF,QAAM,OAAO,MAAM;AACnB,MAAI,OAAO,SAAS,YAAY,SAAS,KAAM,QAAO;AACtD,QAAM,SAAS,EAAE,GAAG,KAAA;AACpB,oBAAkB,IAAI,MAAM;AAC5B,SAAO,EAAE,GAAG,OAAO,UAAU,OAAA;AAC/B;AAiBO,SAAS,qBAAqB,OAAyB;AAC5D,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,OAAQ,MAAkCD,+CAA6B;AAC7E,SACE,OAAO,SAAS,YAChB,SAAS,QACT,sBAAsB,KAAK,MAAM,QACjC,CAAC,kBAAkB,IAAI,IAAI;AAE/B;AAOO,SAAS,4BACd,SACwB;AACxB,MAAIE,kBAAAA,sCAAsC,QAAS,QAAO;AAC1D,SAAO;AAAA,IACL,GAAG;AAAA,IACH,CAACA,kBAAAA,kCAAkC,GAAG,OAAOD,kBAAAA,2BAA2B;AAAA,EAAA;AAE5E;;;;;;"}
1
+ {"version":3,"file":"protocol.cjs","sources":["../../../../agent-runtime/src/protocol.ts"],"sourcesContent":["import {\n DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION,\n DEEP_AGENT_PROTOCOL_STATE_KEY,\n DEEP_AGENT_PROTOCOL_VERSION_HEADER,\n} from './generated/runconfig-contract';\nimport type { DeepAgentStreamValues } from './types';\n\n/**\n * Wire-contract version declaration between the deep-agent statewire host and\n * a client surface (the client half of agora's\n * `agora/graphs/athena_deep_agent/protocol_version.py`; upstream ask\n * assistant-ui/statewire #31506 would make this a library concern).\n *\n * - Declaration: {@link withDeclaredProtocolVersion} stamps the version the\n * surface declares ({@link declaredDeepAgentProtocolVersion}) onto the\n * attach headers — they ride the first WS frame's mandatory `headers` field /\n * the SSE request headers, so no statewire change is needed. The host\n * records it for attach telemetry and selects per-version behaviour by it.\n * - Advertisement: the host publishes its own `version` under the `protocol`\n * state key in every attach snapshot; {@link readDeepAgentProtocol} /\n * {@link projectDeepAgentProtocol} read it.\n *\n * A declared version is a promise the host acts on, not the newest version\n * this build knows (`DEEP_AGENT_PROTOCOL_VERSION`): a host serves a client\n * declaring `DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION` finished subagent lanes cut\n * to their newest steps, trusting it to page the rest. So a surface declares\n * what it implements ({@link DeepAgentProtocolDeclaration}), and a contract\n * bump never changes what a surface promises.\n *\n * There is no minimum client version: the host refuses no command for the\n * version its client declared (or for declaring none), so nothing here\n * compares versions or gates a send. Hosts still publish a `minClientVersion`\n * key (the constant 1) for installed clients whose lane reader required it;\n * this reader ignores it.\n *\n * Skew-tolerant on both sides: an old server advertises nothing (project\n * `null`, gate nothing), and a malformed lane reads as absent — the\n * declaration must never brick a client that could otherwise talk.\n */\nexport interface DeepAgentWireProtocol {\n /** The wire-contract version the server speaks. */\n version: number;\n}\n\n/**\n * What a surface implements of the contract, and so may declare on its\n * attaches ({@link declaredDeepAgentProtocolVersion}). Every field is off\n * until the surface ships the capability.\n */\nexport interface DeepAgentProtocolDeclaration {\n /**\n * The surface pages a cut lane's earlier steps (`useDeepAgentLaneHistory`\n * over `history/lane`) wherever it shows a lane's steps. Its attaches then\n * declare `DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION`, and the host sends a\n * finished `task` card with a deep nested transcript cut to its newest\n * steps, as it sends a running one, under the key\n * `[threadId, \"main\", messageId, \"cut\"]`. Off, finished cards ride whole.\n */\n laneHistory?: boolean;\n}\n\n/**\n * The version a surface declares until it pages lanes: the one below the lane\n * cut, the newest contract under which the host sends every finished card\n * whole (the host's version gates are cumulative, `>=`).\n */\nexport const DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION: number =\n DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION - 1;\n\n/**\n * The contract version a surface's attaches declare: the lane-cut version\n * when it pages lanes, else {@link DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION}.\n * Every attach of one surface — its thread, its pooled prewarm dials, its\n * wakes — declares the same, so a pooled hello is the hello the thread's own\n * attach would get.\n */\nexport function declaredDeepAgentProtocolVersion({\n laneHistory = false,\n}: DeepAgentProtocolDeclaration = {}): number {\n return laneHistory\n ? DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION\n : DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION;\n}\n\n/** The advertised-lane projection a host surface reads. */\nexport interface DeepAgentProtocolStatus {\n /** Server-advertised current contract version. */\n protocolVersion: number;\n /** The contract version this surface's attach declares ({@link declaredDeepAgentProtocolVersion}). */\n clientVersion: number;\n}\n\nconst isContractVersion = (value: unknown): value is number =>\n typeof value === 'number' && Number.isInteger(value) && value >= 1;\n\n/**\n * The server-advertised version lane off a raw statewire state, or `null`\n * while it is unreadable — pre-attach, a pre-negotiation server's snapshot\n * (no lane), or a malformed lane (tolerated as absent, never thrown on).\n */\nexport function readDeepAgentProtocol(state: unknown): DeepAgentWireProtocol | null {\n if (typeof state !== 'object' || state === null) return null;\n const lane = (state as Record<string, unknown>)[DEEP_AGENT_PROTOCOL_STATE_KEY];\n if (typeof lane !== 'object' || lane === null) return null;\n const { version } = lane as Record<string, unknown>;\n if (!isContractVersion(version)) return null;\n return { version };\n}\n\n/**\n * Project the advertised version for a host surface, paired with what the\n * surface declares, or `null` while the server has not advertised (see\n * {@link readDeepAgentProtocol}). Pure and selector-safe, mirroring\n * `readSessionPersisted`.\n */\nexport function projectDeepAgentProtocol(\n state: unknown,\n declaration: DeepAgentProtocolDeclaration = {}\n): DeepAgentProtocolStatus | null {\n const lane = readDeepAgentProtocol(state);\n if (lane === null) return null;\n return {\n protocolVersion: lane.version,\n clientVersion: declaredDeepAgentProtocolVersion(declaration),\n };\n}\n\n/**\n * The protocol lanes seeds carry ({@link withSeedProtocolLane}), by identity.\n * Statewire's optimistic folds are copy-on-write, so every state folded over a\n * seed keeps its lane object, while a state the host sent never holds one\n * (each is parsed off the wire).\n */\nconst seedProtocolLanes = new WeakSet<object>();\n\n/**\n * `state` with a protocol lane of its own, remembered as a seed's — for the\n * remembered states a mount is seeded with (`toThreadSnapshotSeed`), whose\n * lanes are what the host sent an earlier attach. The lane is copied rather\n * than remembered in place, so a live attach still holding the original object\n * is never read as a seed.\n */\nexport function withSeedProtocolLane(state: DeepAgentStreamValues): DeepAgentStreamValues {\n const lane = state.protocol;\n if (typeof lane !== 'object' || lane === null) return state;\n const seeded = { ...lane };\n seedProtocolLanes.add(seeded);\n return { ...state, protocol: seeded };\n}\n\n/**\n * Whether `state` is one the host sent on this attach. The host advertises the\n * protocol lane in every attach snapshot and keeps it on every later frame;\n * the states a thread renders before its snapshot carry none (the placeholder\n * an existing thread loads with, and any optimistic fold over it) or a seed's\n * ({@link withSeedProtocolLane}).\n *\n * Decide anything about what the host holds — its config lane above all —\n * from these states only, never from the connection status: on a thread\n * mid-run the channel reports `connected` before the attach snapshot applies,\n * and a placeholder read as the host's says the thread has no config.\n *\n * A host predating the lane (2026-08-28) never answers true; the config lane\n * writes clients make (`config/patch`, 2026-09-05) came after it.\n */\nexport function isDeepAgentHostState(state: unknown): boolean {\n if (typeof state !== 'object' || state === null) return false;\n const lane = (state as Record<string, unknown>)[DEEP_AGENT_PROTOCOL_STATE_KEY];\n return (\n typeof lane === 'object' &&\n lane !== null &&\n readDeepAgentProtocol(state) !== null &&\n !seedProtocolLanes.has(lane)\n );\n}\n\n/**\n * Attach headers with the surface's contract version declared\n * ({@link declaredDeepAgentProtocolVersion}). Applied by the attach recipe\n * (`createDeepAgentAttachTransport`, `wakeDeepAgentThread`) to every resolved\n * header set, so every surface declares without per-host wiring; an explicit\n * entry (tests, forced overrides) wins.\n */\nexport function withDeclaredProtocolVersion(\n headers: Record<string, string>,\n declaration: DeepAgentProtocolDeclaration = {}\n): Record<string, string> {\n if (DEEP_AGENT_PROTOCOL_VERSION_HEADER in headers) return headers;\n return {\n ...headers,\n [DEEP_AGENT_PROTOCOL_VERSION_HEADER]: String(declaredDeepAgentProtocolVersion(declaration)),\n };\n}\n"],"names":["DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION","DEEP_AGENT_PROTOCOL_STATE_KEY","DEEP_AGENT_PROTOCOL_VERSION_HEADER"],"mappings":";;;AAkEO,MAAM,6CACXA,kBAAAA,uCAAuC;AASlC,SAAS,iCAAiC;AAAA,EAC/C,cAAc;AAChB,IAAkC,IAAY;AAC5C,SAAO,cACHA,kBAAAA,uCACA;AACN;AAUA,MAAM,oBAAoB,CAAC,UACzB,OAAO,UAAU,YAAY,OAAO,UAAU,KAAK,KAAK,SAAS;AAO5D,SAAS,sBAAsB,OAA8C;AAClF,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,OAAQ,MAAkCC,+CAA6B;AAC7E,MAAI,OAAO,SAAS,YAAY,SAAS,KAAM,QAAO;AACtD,QAAM,EAAE,YAAY;AACpB,MAAI,CAAC,kBAAkB,OAAO,EAAG,QAAO;AACxC,SAAO,EAAE,QAAA;AACX;AAQO,SAAS,yBACd,OACA,cAA4C,IACZ;AAChC,QAAM,OAAO,sBAAsB,KAAK;AACxC,MAAI,SAAS,KAAM,QAAO;AAC1B,SAAO;AAAA,IACL,iBAAiB,KAAK;AAAA,IACtB,eAAe,iCAAiC,WAAW;AAAA,EAAA;AAE/D;AAQA,MAAM,wCAAwB,QAAA;AASvB,SAAS,qBAAqB,OAAqD;AACxF,QAAM,OAAO,MAAM;AACnB,MAAI,OAAO,SAAS,YAAY,SAAS,KAAM,QAAO;AACtD,QAAM,SAAS,EAAE,GAAG,KAAA;AACpB,oBAAkB,IAAI,MAAM;AAC5B,SAAO,EAAE,GAAG,OAAO,UAAU,OAAA;AAC/B;AAiBO,SAAS,qBAAqB,OAAyB;AAC5D,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,OAAQ,MAAkCA,+CAA6B;AAC7E,SACE,OAAO,SAAS,YAChB,SAAS,QACT,sBAAsB,KAAK,MAAM,QACjC,CAAC,kBAAkB,IAAI,IAAI;AAE/B;AASO,SAAS,4BACd,SACA,cAA4C,IACpB;AACxB,MAAIC,kBAAAA,sCAAsC,QAAS,QAAO;AAC1D,SAAO;AAAA,IACL,GAAG;AAAA,IACH,CAACA,oDAAkC,GAAG,OAAO,iCAAiC,WAAW,CAAC;AAAA,EAAA;AAE9F;;;;;;;;"}
@@ -0,0 +1,119 @@
1
+ import type { DeepAgentStreamValues } from './types';
2
+ /**
3
+ * Wire-contract version declaration between the deep-agent statewire host and
4
+ * a client surface (the client half of agora's
5
+ * `agora/graphs/athena_deep_agent/protocol_version.py`; upstream ask
6
+ * assistant-ui/statewire #31506 would make this a library concern).
7
+ *
8
+ * - Declaration: {@link withDeclaredProtocolVersion} stamps the version the
9
+ * surface declares ({@link declaredDeepAgentProtocolVersion}) onto the
10
+ * attach headers — they ride the first WS frame's mandatory `headers` field /
11
+ * the SSE request headers, so no statewire change is needed. The host
12
+ * records it for attach telemetry and selects per-version behaviour by it.
13
+ * - Advertisement: the host publishes its own `version` under the `protocol`
14
+ * state key in every attach snapshot; {@link readDeepAgentProtocol} /
15
+ * {@link projectDeepAgentProtocol} read it.
16
+ *
17
+ * A declared version is a promise the host acts on, not the newest version
18
+ * this build knows (`DEEP_AGENT_PROTOCOL_VERSION`): a host serves a client
19
+ * declaring `DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION` finished subagent lanes cut
20
+ * to their newest steps, trusting it to page the rest. So a surface declares
21
+ * what it implements ({@link DeepAgentProtocolDeclaration}), and a contract
22
+ * bump never changes what a surface promises.
23
+ *
24
+ * There is no minimum client version: the host refuses no command for the
25
+ * version its client declared (or for declaring none), so nothing here
26
+ * compares versions or gates a send. Hosts still publish a `minClientVersion`
27
+ * key (the constant 1) for installed clients whose lane reader required it;
28
+ * this reader ignores it.
29
+ *
30
+ * Skew-tolerant on both sides: an old server advertises nothing (project
31
+ * `null`, gate nothing), and a malformed lane reads as absent — the
32
+ * declaration must never brick a client that could otherwise talk.
33
+ */
34
+ export interface DeepAgentWireProtocol {
35
+ /** The wire-contract version the server speaks. */
36
+ version: number;
37
+ }
38
+ /**
39
+ * What a surface implements of the contract, and so may declare on its
40
+ * attaches ({@link declaredDeepAgentProtocolVersion}). Every field is off
41
+ * until the surface ships the capability.
42
+ */
43
+ export interface DeepAgentProtocolDeclaration {
44
+ /**
45
+ * The surface pages a cut lane's earlier steps (`useDeepAgentLaneHistory`
46
+ * over `history/lane`) wherever it shows a lane's steps. Its attaches then
47
+ * declare `DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION`, and the host sends a
48
+ * finished `task` card with a deep nested transcript cut to its newest
49
+ * steps, as it sends a running one, under the key
50
+ * `[threadId, "main", messageId, "cut"]`. Off, finished cards ride whole.
51
+ */
52
+ laneHistory?: boolean;
53
+ }
54
+ /**
55
+ * The version a surface declares until it pages lanes: the one below the lane
56
+ * cut, the newest contract under which the host sends every finished card
57
+ * whole (the host's version gates are cumulative, `>=`).
58
+ */
59
+ export declare const DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION: number;
60
+ /**
61
+ * The contract version a surface's attaches declare: the lane-cut version
62
+ * when it pages lanes, else {@link DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION}.
63
+ * Every attach of one surface — its thread, its pooled prewarm dials, its
64
+ * wakes — declares the same, so a pooled hello is the hello the thread's own
65
+ * attach would get.
66
+ */
67
+ export declare function declaredDeepAgentProtocolVersion({ laneHistory, }?: DeepAgentProtocolDeclaration): number;
68
+ /** The advertised-lane projection a host surface reads. */
69
+ export interface DeepAgentProtocolStatus {
70
+ /** Server-advertised current contract version. */
71
+ protocolVersion: number;
72
+ /** The contract version this surface's attach declares ({@link declaredDeepAgentProtocolVersion}). */
73
+ clientVersion: number;
74
+ }
75
+ /**
76
+ * The server-advertised version lane off a raw statewire state, or `null`
77
+ * while it is unreadable — pre-attach, a pre-negotiation server's snapshot
78
+ * (no lane), or a malformed lane (tolerated as absent, never thrown on).
79
+ */
80
+ export declare function readDeepAgentProtocol(state: unknown): DeepAgentWireProtocol | null;
81
+ /**
82
+ * Project the advertised version for a host surface, paired with what the
83
+ * surface declares, or `null` while the server has not advertised (see
84
+ * {@link readDeepAgentProtocol}). Pure and selector-safe, mirroring
85
+ * `readSessionPersisted`.
86
+ */
87
+ export declare function projectDeepAgentProtocol(state: unknown, declaration?: DeepAgentProtocolDeclaration): DeepAgentProtocolStatus | null;
88
+ /**
89
+ * `state` with a protocol lane of its own, remembered as a seed's — for the
90
+ * remembered states a mount is seeded with (`toThreadSnapshotSeed`), whose
91
+ * lanes are what the host sent an earlier attach. The lane is copied rather
92
+ * than remembered in place, so a live attach still holding the original object
93
+ * is never read as a seed.
94
+ */
95
+ export declare function withSeedProtocolLane(state: DeepAgentStreamValues): DeepAgentStreamValues;
96
+ /**
97
+ * Whether `state` is one the host sent on this attach. The host advertises the
98
+ * protocol lane in every attach snapshot and keeps it on every later frame;
99
+ * the states a thread renders before its snapshot carry none (the placeholder
100
+ * an existing thread loads with, and any optimistic fold over it) or a seed's
101
+ * ({@link withSeedProtocolLane}).
102
+ *
103
+ * Decide anything about what the host holds — its config lane above all —
104
+ * from these states only, never from the connection status: on a thread
105
+ * mid-run the channel reports `connected` before the attach snapshot applies,
106
+ * and a placeholder read as the host's says the thread has no config.
107
+ *
108
+ * A host predating the lane (2026-08-28) never answers true; the config lane
109
+ * writes clients make (`config/patch`, 2026-09-05) came after it.
110
+ */
111
+ export declare function isDeepAgentHostState(state: unknown): boolean;
112
+ /**
113
+ * Attach headers with the surface's contract version declared
114
+ * ({@link declaredDeepAgentProtocolVersion}). Applied by the attach recipe
115
+ * (`createDeepAgentAttachTransport`, `wakeDeepAgentThread`) to every resolved
116
+ * header set, so every surface declares without per-host wiring; an explicit
117
+ * entry (tests, forced overrides) wins.
118
+ */
119
+ export declare function withDeclaredProtocolVersion(headers: Record<string, string>, declaration?: DeepAgentProtocolDeclaration): Record<string, string>;
@@ -1,4 +1,10 @@
1
- import { DEEP_AGENT_PROTOCOL_VERSION, DEEP_AGENT_PROTOCOL_STATE_KEY, DEEP_AGENT_PROTOCOL_VERSION_HEADER } from "./generated/runconfig-contract.js";
1
+ import { DEEP_AGENT_PROTOCOL_STATE_KEY, DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION, DEEP_AGENT_PROTOCOL_VERSION_HEADER } from "./generated/runconfig-contract.js";
2
+ const DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION = DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION - 1;
3
+ function declaredDeepAgentProtocolVersion({
4
+ laneHistory = false
5
+ } = {}) {
6
+ return laneHistory ? DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION : DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION;
7
+ }
2
8
  const isContractVersion = (value) => typeof value === "number" && Number.isInteger(value) && value >= 1;
3
9
  function readDeepAgentProtocol(state) {
4
10
  if (typeof state !== "object" || state === null) return null;
@@ -8,12 +14,12 @@ function readDeepAgentProtocol(state) {
8
14
  if (!isContractVersion(version)) return null;
9
15
  return { version };
10
16
  }
11
- function projectDeepAgentProtocol(state) {
17
+ function projectDeepAgentProtocol(state, declaration = {}) {
12
18
  const lane = readDeepAgentProtocol(state);
13
19
  if (lane === null) return null;
14
20
  return {
15
21
  protocolVersion: lane.version,
16
- clientVersion: DEEP_AGENT_PROTOCOL_VERSION
22
+ clientVersion: declaredDeepAgentProtocolVersion(declaration)
17
23
  };
18
24
  }
19
25
  const seedProtocolLanes = /* @__PURE__ */ new WeakSet();
@@ -29,14 +35,16 @@ function isDeepAgentHostState(state) {
29
35
  const lane = state[DEEP_AGENT_PROTOCOL_STATE_KEY];
30
36
  return typeof lane === "object" && lane !== null && readDeepAgentProtocol(state) !== null && !seedProtocolLanes.has(lane);
31
37
  }
32
- function withDeclaredProtocolVersion(headers) {
38
+ function withDeclaredProtocolVersion(headers, declaration = {}) {
33
39
  if (DEEP_AGENT_PROTOCOL_VERSION_HEADER in headers) return headers;
34
40
  return {
35
41
  ...headers,
36
- [DEEP_AGENT_PROTOCOL_VERSION_HEADER]: String(DEEP_AGENT_PROTOCOL_VERSION)
42
+ [DEEP_AGENT_PROTOCOL_VERSION_HEADER]: String(declaredDeepAgentProtocolVersion(declaration))
37
43
  };
38
44
  }
39
45
  export {
46
+ DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION,
47
+ declaredDeepAgentProtocolVersion,
40
48
  isDeepAgentHostState,
41
49
  projectDeepAgentProtocol,
42
50
  readDeepAgentProtocol,
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.js","sources":["../../../../agent-runtime/src/protocol.ts"],"sourcesContent":["import {\n DEEP_AGENT_PROTOCOL_STATE_KEY,\n DEEP_AGENT_PROTOCOL_VERSION,\n DEEP_AGENT_PROTOCOL_VERSION_HEADER,\n} from './generated/runconfig-contract';\nimport type { DeepAgentStreamValues } from './types';\n\n/**\n * Wire-contract version declaration between the deep-agent statewire host and\n * this client build (the client half of agora's\n * `agora/graphs/athena_deep_agent/protocol_version.py`; upstream ask\n * assistant-ui/statewire #31506 would make this a library concern).\n *\n * - Declaration: {@link withDeclaredProtocolVersion} stamps the version this\n * build speaks (`DEEP_AGENT_PROTOCOL_VERSION`, generated from the Python\n * source of truth) onto the attach headers — they ride the first WS frame's\n * mandatory `headers` field / the SSE request headers, so no statewire\n * change is needed. The host records it for attach telemetry and\n * per-version behaviour selection only.\n * - Advertisement: the host publishes its own `version` under the `protocol`\n * state key in every attach snapshot; {@link readDeepAgentProtocol} /\n * {@link projectDeepAgentProtocol} read it.\n *\n * There is no minimum client version: the host refuses no command for the\n * version its client declared (or for declaring none), so nothing here\n * compares versions or gates a send. Hosts still publish a `minClientVersion`\n * key (the constant 1) for installed clients whose lane reader required it;\n * this reader ignores it.\n *\n * Skew-tolerant on both sides: an old server advertises nothing (project\n * `null`, gate nothing), and a malformed lane reads as absent — the\n * declaration must never brick a client that could otherwise talk.\n */\nexport interface DeepAgentWireProtocol {\n /** The wire-contract version the server speaks. */\n version: number;\n}\n\n/** The advertised-lane projection a host surface reads. */\nexport interface DeepAgentProtocolStatus {\n /** Server-advertised current contract version. */\n protocolVersion: number;\n /** The contract version THIS client build declares. */\n clientVersion: number;\n}\n\nconst isContractVersion = (value: unknown): value is number =>\n typeof value === 'number' && Number.isInteger(value) && value >= 1;\n\n/**\n * The server-advertised version lane off a raw statewire state, or `null`\n * while it is unreadable — pre-attach, a pre-negotiation server's snapshot\n * (no lane), or a malformed lane (tolerated as absent, never thrown on).\n */\nexport function readDeepAgentProtocol(state: unknown): DeepAgentWireProtocol | null {\n if (typeof state !== 'object' || state === null) return null;\n const lane = (state as Record<string, unknown>)[DEEP_AGENT_PROTOCOL_STATE_KEY];\n if (typeof lane !== 'object' || lane === null) return null;\n const { version } = lane as Record<string, unknown>;\n if (!isContractVersion(version)) return null;\n return { version };\n}\n\n/**\n * Project the advertised version for a host surface, or `null` while the\n * server has not advertised (see {@link readDeepAgentProtocol}). Pure and\n * selector-safe, mirroring `readSessionPersisted`.\n */\nexport function projectDeepAgentProtocol(state: unknown): DeepAgentProtocolStatus | null {\n const lane = readDeepAgentProtocol(state);\n if (lane === null) return null;\n return {\n protocolVersion: lane.version,\n clientVersion: DEEP_AGENT_PROTOCOL_VERSION,\n };\n}\n\n/**\n * The protocol lanes seeds carry ({@link withSeedProtocolLane}), by identity.\n * Statewire's optimistic folds are copy-on-write, so every state folded over a\n * seed keeps its lane object, while a state the host sent never holds one\n * (each is parsed off the wire).\n */\nconst seedProtocolLanes = new WeakSet<object>();\n\n/**\n * `state` with a protocol lane of its own, remembered as a seed's — for the\n * remembered states a mount is seeded with (`toThreadSnapshotSeed`), whose\n * lanes are what the host sent an earlier attach. The lane is copied rather\n * than remembered in place, so a live attach still holding the original object\n * is never read as a seed.\n */\nexport function withSeedProtocolLane(state: DeepAgentStreamValues): DeepAgentStreamValues {\n const lane = state.protocol;\n if (typeof lane !== 'object' || lane === null) return state;\n const seeded = { ...lane };\n seedProtocolLanes.add(seeded);\n return { ...state, protocol: seeded };\n}\n\n/**\n * Whether `state` is one the host sent on this attach. The host advertises the\n * protocol lane in every attach snapshot and keeps it on every later frame;\n * the states a thread renders before its snapshot carry none (the placeholder\n * an existing thread loads with, and any optimistic fold over it) or a seed's\n * ({@link withSeedProtocolLane}).\n *\n * Decide anything about what the host holds — its config lane above all —\n * from these states only, never from the connection status: on a thread\n * mid-run the channel reports `connected` before the attach snapshot applies,\n * and a placeholder read as the host's says the thread has no config.\n *\n * A host predating the lane (2026-08-28) never answers true; the config lane\n * writes clients make (`config/patch`, 2026-09-05) came after it.\n */\nexport function isDeepAgentHostState(state: unknown): boolean {\n if (typeof state !== 'object' || state === null) return false;\n const lane = (state as Record<string, unknown>)[DEEP_AGENT_PROTOCOL_STATE_KEY];\n return (\n typeof lane === 'object' &&\n lane !== null &&\n readDeepAgentProtocol(state) !== null &&\n !seedProtocolLanes.has(lane)\n );\n}\n\n/**\n * Attach headers with this build's contract version declared. Applied by\n * `useDeepAgentThread` to every resolved header set, so all surfaces declare\n * without per-host wiring; an explicit entry (tests, forced overrides) wins.\n */\nexport function withDeclaredProtocolVersion(\n headers: Record<string, string>\n): Record<string, string> {\n if (DEEP_AGENT_PROTOCOL_VERSION_HEADER in headers) return headers;\n return {\n ...headers,\n [DEEP_AGENT_PROTOCOL_VERSION_HEADER]: String(DEEP_AGENT_PROTOCOL_VERSION),\n };\n}\n"],"names":[],"mappings":";AA8CA,MAAM,oBAAoB,CAAC,UACzB,OAAO,UAAU,YAAY,OAAO,UAAU,KAAK,KAAK,SAAS;AAO5D,SAAS,sBAAsB,OAA8C;AAClF,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,OAAQ,MAAkC,6BAA6B;AAC7E,MAAI,OAAO,SAAS,YAAY,SAAS,KAAM,QAAO;AACtD,QAAM,EAAE,YAAY;AACpB,MAAI,CAAC,kBAAkB,OAAO,EAAG,QAAO;AACxC,SAAO,EAAE,QAAA;AACX;AAOO,SAAS,yBAAyB,OAAgD;AACvF,QAAM,OAAO,sBAAsB,KAAK;AACxC,MAAI,SAAS,KAAM,QAAO;AAC1B,SAAO;AAAA,IACL,iBAAiB,KAAK;AAAA,IACtB,eAAe;AAAA,EAAA;AAEnB;AAQA,MAAM,wCAAwB,QAAA;AASvB,SAAS,qBAAqB,OAAqD;AACxF,QAAM,OAAO,MAAM;AACnB,MAAI,OAAO,SAAS,YAAY,SAAS,KAAM,QAAO;AACtD,QAAM,SAAS,EAAE,GAAG,KAAA;AACpB,oBAAkB,IAAI,MAAM;AAC5B,SAAO,EAAE,GAAG,OAAO,UAAU,OAAA;AAC/B;AAiBO,SAAS,qBAAqB,OAAyB;AAC5D,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,OAAQ,MAAkC,6BAA6B;AAC7E,SACE,OAAO,SAAS,YAChB,SAAS,QACT,sBAAsB,KAAK,MAAM,QACjC,CAAC,kBAAkB,IAAI,IAAI;AAE/B;AAOO,SAAS,4BACd,SACwB;AACxB,MAAI,sCAAsC,QAAS,QAAO;AAC1D,SAAO;AAAA,IACL,GAAG;AAAA,IACH,CAAC,kCAAkC,GAAG,OAAO,2BAA2B;AAAA,EAAA;AAE5E;"}
1
+ {"version":3,"file":"protocol.js","sources":["../../../../agent-runtime/src/protocol.ts"],"sourcesContent":["import {\n DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION,\n DEEP_AGENT_PROTOCOL_STATE_KEY,\n DEEP_AGENT_PROTOCOL_VERSION_HEADER,\n} from './generated/runconfig-contract';\nimport type { DeepAgentStreamValues } from './types';\n\n/**\n * Wire-contract version declaration between the deep-agent statewire host and\n * a client surface (the client half of agora's\n * `agora/graphs/athena_deep_agent/protocol_version.py`; upstream ask\n * assistant-ui/statewire #31506 would make this a library concern).\n *\n * - Declaration: {@link withDeclaredProtocolVersion} stamps the version the\n * surface declares ({@link declaredDeepAgentProtocolVersion}) onto the\n * attach headers — they ride the first WS frame's mandatory `headers` field /\n * the SSE request headers, so no statewire change is needed. The host\n * records it for attach telemetry and selects per-version behaviour by it.\n * - Advertisement: the host publishes its own `version` under the `protocol`\n * state key in every attach snapshot; {@link readDeepAgentProtocol} /\n * {@link projectDeepAgentProtocol} read it.\n *\n * A declared version is a promise the host acts on, not the newest version\n * this build knows (`DEEP_AGENT_PROTOCOL_VERSION`): a host serves a client\n * declaring `DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION` finished subagent lanes cut\n * to their newest steps, trusting it to page the rest. So a surface declares\n * what it implements ({@link DeepAgentProtocolDeclaration}), and a contract\n * bump never changes what a surface promises.\n *\n * There is no minimum client version: the host refuses no command for the\n * version its client declared (or for declaring none), so nothing here\n * compares versions or gates a send. Hosts still publish a `minClientVersion`\n * key (the constant 1) for installed clients whose lane reader required it;\n * this reader ignores it.\n *\n * Skew-tolerant on both sides: an old server advertises nothing (project\n * `null`, gate nothing), and a malformed lane reads as absent — the\n * declaration must never brick a client that could otherwise talk.\n */\nexport interface DeepAgentWireProtocol {\n /** The wire-contract version the server speaks. */\n version: number;\n}\n\n/**\n * What a surface implements of the contract, and so may declare on its\n * attaches ({@link declaredDeepAgentProtocolVersion}). Every field is off\n * until the surface ships the capability.\n */\nexport interface DeepAgentProtocolDeclaration {\n /**\n * The surface pages a cut lane's earlier steps (`useDeepAgentLaneHistory`\n * over `history/lane`) wherever it shows a lane's steps. Its attaches then\n * declare `DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION`, and the host sends a\n * finished `task` card with a deep nested transcript cut to its newest\n * steps, as it sends a running one, under the key\n * `[threadId, \"main\", messageId, \"cut\"]`. Off, finished cards ride whole.\n */\n laneHistory?: boolean;\n}\n\n/**\n * The version a surface declares until it pages lanes: the one below the lane\n * cut, the newest contract under which the host sends every finished card\n * whole (the host's version gates are cumulative, `>=`).\n */\nexport const DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION: number =\n DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION - 1;\n\n/**\n * The contract version a surface's attaches declare: the lane-cut version\n * when it pages lanes, else {@link DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION}.\n * Every attach of one surface — its thread, its pooled prewarm dials, its\n * wakes — declares the same, so a pooled hello is the hello the thread's own\n * attach would get.\n */\nexport function declaredDeepAgentProtocolVersion({\n laneHistory = false,\n}: DeepAgentProtocolDeclaration = {}): number {\n return laneHistory\n ? DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION\n : DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION;\n}\n\n/** The advertised-lane projection a host surface reads. */\nexport interface DeepAgentProtocolStatus {\n /** Server-advertised current contract version. */\n protocolVersion: number;\n /** The contract version this surface's attach declares ({@link declaredDeepAgentProtocolVersion}). */\n clientVersion: number;\n}\n\nconst isContractVersion = (value: unknown): value is number =>\n typeof value === 'number' && Number.isInteger(value) && value >= 1;\n\n/**\n * The server-advertised version lane off a raw statewire state, or `null`\n * while it is unreadable — pre-attach, a pre-negotiation server's snapshot\n * (no lane), or a malformed lane (tolerated as absent, never thrown on).\n */\nexport function readDeepAgentProtocol(state: unknown): DeepAgentWireProtocol | null {\n if (typeof state !== 'object' || state === null) return null;\n const lane = (state as Record<string, unknown>)[DEEP_AGENT_PROTOCOL_STATE_KEY];\n if (typeof lane !== 'object' || lane === null) return null;\n const { version } = lane as Record<string, unknown>;\n if (!isContractVersion(version)) return null;\n return { version };\n}\n\n/**\n * Project the advertised version for a host surface, paired with what the\n * surface declares, or `null` while the server has not advertised (see\n * {@link readDeepAgentProtocol}). Pure and selector-safe, mirroring\n * `readSessionPersisted`.\n */\nexport function projectDeepAgentProtocol(\n state: unknown,\n declaration: DeepAgentProtocolDeclaration = {}\n): DeepAgentProtocolStatus | null {\n const lane = readDeepAgentProtocol(state);\n if (lane === null) return null;\n return {\n protocolVersion: lane.version,\n clientVersion: declaredDeepAgentProtocolVersion(declaration),\n };\n}\n\n/**\n * The protocol lanes seeds carry ({@link withSeedProtocolLane}), by identity.\n * Statewire's optimistic folds are copy-on-write, so every state folded over a\n * seed keeps its lane object, while a state the host sent never holds one\n * (each is parsed off the wire).\n */\nconst seedProtocolLanes = new WeakSet<object>();\n\n/**\n * `state` with a protocol lane of its own, remembered as a seed's — for the\n * remembered states a mount is seeded with (`toThreadSnapshotSeed`), whose\n * lanes are what the host sent an earlier attach. The lane is copied rather\n * than remembered in place, so a live attach still holding the original object\n * is never read as a seed.\n */\nexport function withSeedProtocolLane(state: DeepAgentStreamValues): DeepAgentStreamValues {\n const lane = state.protocol;\n if (typeof lane !== 'object' || lane === null) return state;\n const seeded = { ...lane };\n seedProtocolLanes.add(seeded);\n return { ...state, protocol: seeded };\n}\n\n/**\n * Whether `state` is one the host sent on this attach. The host advertises the\n * protocol lane in every attach snapshot and keeps it on every later frame;\n * the states a thread renders before its snapshot carry none (the placeholder\n * an existing thread loads with, and any optimistic fold over it) or a seed's\n * ({@link withSeedProtocolLane}).\n *\n * Decide anything about what the host holds — its config lane above all —\n * from these states only, never from the connection status: on a thread\n * mid-run the channel reports `connected` before the attach snapshot applies,\n * and a placeholder read as the host's says the thread has no config.\n *\n * A host predating the lane (2026-08-28) never answers true; the config lane\n * writes clients make (`config/patch`, 2026-09-05) came after it.\n */\nexport function isDeepAgentHostState(state: unknown): boolean {\n if (typeof state !== 'object' || state === null) return false;\n const lane = (state as Record<string, unknown>)[DEEP_AGENT_PROTOCOL_STATE_KEY];\n return (\n typeof lane === 'object' &&\n lane !== null &&\n readDeepAgentProtocol(state) !== null &&\n !seedProtocolLanes.has(lane)\n );\n}\n\n/**\n * Attach headers with the surface's contract version declared\n * ({@link declaredDeepAgentProtocolVersion}). Applied by the attach recipe\n * (`createDeepAgentAttachTransport`, `wakeDeepAgentThread`) to every resolved\n * header set, so every surface declares without per-host wiring; an explicit\n * entry (tests, forced overrides) wins.\n */\nexport function withDeclaredProtocolVersion(\n headers: Record<string, string>,\n declaration: DeepAgentProtocolDeclaration = {}\n): Record<string, string> {\n if (DEEP_AGENT_PROTOCOL_VERSION_HEADER in headers) return headers;\n return {\n ...headers,\n [DEEP_AGENT_PROTOCOL_VERSION_HEADER]: String(declaredDeepAgentProtocolVersion(declaration)),\n };\n}\n"],"names":[],"mappings":";AAkEO,MAAM,6CACX,uCAAuC;AASlC,SAAS,iCAAiC;AAAA,EAC/C,cAAc;AAChB,IAAkC,IAAY;AAC5C,SAAO,cACH,uCACA;AACN;AAUA,MAAM,oBAAoB,CAAC,UACzB,OAAO,UAAU,YAAY,OAAO,UAAU,KAAK,KAAK,SAAS;AAO5D,SAAS,sBAAsB,OAA8C;AAClF,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,OAAQ,MAAkC,6BAA6B;AAC7E,MAAI,OAAO,SAAS,YAAY,SAAS,KAAM,QAAO;AACtD,QAAM,EAAE,YAAY;AACpB,MAAI,CAAC,kBAAkB,OAAO,EAAG,QAAO;AACxC,SAAO,EAAE,QAAA;AACX;AAQO,SAAS,yBACd,OACA,cAA4C,IACZ;AAChC,QAAM,OAAO,sBAAsB,KAAK;AACxC,MAAI,SAAS,KAAM,QAAO;AAC1B,SAAO;AAAA,IACL,iBAAiB,KAAK;AAAA,IACtB,eAAe,iCAAiC,WAAW;AAAA,EAAA;AAE/D;AAQA,MAAM,wCAAwB,QAAA;AASvB,SAAS,qBAAqB,OAAqD;AACxF,QAAM,OAAO,MAAM;AACnB,MAAI,OAAO,SAAS,YAAY,SAAS,KAAM,QAAO;AACtD,QAAM,SAAS,EAAE,GAAG,KAAA;AACpB,oBAAkB,IAAI,MAAM;AAC5B,SAAO,EAAE,GAAG,OAAO,UAAU,OAAA;AAC/B;AAiBO,SAAS,qBAAqB,OAAyB;AAC5D,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,OAAQ,MAAkC,6BAA6B;AAC7E,SACE,OAAO,SAAS,YAChB,SAAS,QACT,sBAAsB,KAAK,MAAM,QACjC,CAAC,kBAAkB,IAAI,IAAI;AAE/B;AASO,SAAS,4BACd,SACA,cAA4C,IACpB;AACxB,MAAI,sCAAsC,QAAS,QAAO;AAC1D,SAAO;AAAA,IACL,GAAG;AAAA,IACH,CAAC,kCAAkC,GAAG,OAAO,iCAAiC,WAAW,CAAC;AAAA,EAAA;AAE9F;"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Programmatic-tool-calling (PTC) sub-call parsing — the SDK method calls a
3
+ * sandbox `execute` / interpreter `eval` recorded, promoted by the backend onto
4
+ * the parent ToolMessage's artifact (`promote_artifact_with_ptc_subcalls`
5
+ * shape: one AIMessage carrying every call, then one ToolMessage per settled
6
+ * call). Pure parsing shared by the nested tool cards and the studio
7
+ * follow-along; React selectors over these live with each runtime host.
8
+ */
9
+ import type { LangChainMessage } from '@assistant-ui/react-langgraph';
10
+ /**
11
+ * One SDK sub-call recorded under a sandbox `execute` (or interpreter `eval`)
12
+ * tool call — an Athena SDK method call (e.g. `Presentation.create`) the
13
+ * backend's PTC display channel captured and promoted onto the parent
14
+ * ToolMessage's `artifact.subgraph_state.messages`.
15
+ */
16
+ export interface PtcSubcall {
17
+ id: string;
18
+ name: string;
19
+ args: Record<string, unknown>;
20
+ status: 'in_flight' | 'completed' | 'error';
21
+ /** The settled call's parsed result payload (`undefined` while in flight). */
22
+ result: unknown;
23
+ /** The settled call's result text ('' while in flight). */
24
+ resultText: string;
25
+ }
26
+ /** Parse the PTC sub-call list from a parent ToolMessage's promoted artifact. */
27
+ export declare function ptcSubcallsFromArtifact(artifact: unknown): PtcSubcall[];
28
+ /** One completed PTC parent (`execute`, `eval`, or a studio executor) carrying recorded sub-calls. */
29
+ export interface CompletedPtcParent {
30
+ toolCallId: string;
31
+ /** The parent tool's name, one of `PTC_PARENT_TOOL_NAMES`. */
32
+ toolName: string;
33
+ /**
34
+ * The executor source the call ran (`eval`'s `code` arg), read off the AI
35
+ * message that requested it. The studio SDKs emit no cell-level sub-calls,
36
+ * so the code string is the only carrier of the written spreadsheet cell.
37
+ */
38
+ code: string | undefined;
39
+ /** Shape `computeStudioFollowTarget` expects: `{ artifact, result }`. */
40
+ rawResult: {
41
+ artifact: unknown;
42
+ result: unknown;
43
+ };
44
+ }
45
+ /**
46
+ * Every completed `execute`/`eval` ToolMessage carrying recorded PTC
47
+ * sub-calls, from the raw transport messages — including the ones a subagent
48
+ * ran inside a `task` call's nested transcript. Drives the deep-agent's studio
49
+ * follow-along (`DeepAgentPtcStudioFollowObserver`).
50
+ */
51
+ export declare function extractCompletedPtcParents(messages: readonly LangChainMessage[]): CompletedPtcParent[];
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Derivations for the server-owned statewire queue and steer lanes, shared by
3
+ * every queued-messages tray (Olympus, the React SDK, the Chrome extension).
4
+ *
5
+ * The queue is SERVER-owned: statewire surfaces it on the runs projection.
6
+ * "Send now" moves an item into the steer lane (`run/steer` — the host stops
7
+ * the run and dispatches it once the run settles; on a stopped/errored thread
8
+ * the same move dispatches immediately as a stop-/error-continue run) and
9
+ * remove issues `run/dequeue`. While the thread rests stopped/errored,
10
+ * stranded steer-lane entries list ahead of the queue — they dispatch first,
11
+ * as one batch, so they carry Remove but no per-row Send now.
12
+ *
13
+ * Pure helpers only: the host component reads `useStatewireRuns()` and
14
+ * `useDeepAgentThreadStatus()` itself (both mockable per surface) and passes
15
+ * the values in.
16
+ */
17
+ import type { StatewireThread } from '@assistant-ui/react-statewire';
18
+ import type { DeepAgentThreadStatus } from './thread-status';
19
+ /** The text content of a queued entry (non-text parts render as fallbacks). */
20
+ export declare function queueEntryText(parts: readonly {
21
+ type: string;
22
+ text?: string;
23
+ }[]): string;
24
+ /**
25
+ * Whether a lane entry is still awaiting its send's settle: the host stamps
26
+ * `meta` on every entry it admits (`_op_meta` — submitter and contextSync
27
+ * snapshot), so a meta-less entry is this client's own optimistic fold. The
28
+ * send is still in flight and can still be refused (billing gate, auth,
29
+ * reconnect), which the tray must not render as an accepted queue position.
30
+ */
31
+ export declare function isQueueEntryUnsettled(entry: StatewireThread.RunsQueueEntry): boolean;
32
+ /**
33
+ * The ids of queued entries the user prioritized (⚡ — `run/prioritize`), as
34
+ * the host records them in its durable `prioritizedQueueIds` state. A
35
+ * prioritized entry heads the queue lane and the live run ends at its next
36
+ * model-call boundary to deliver it, so trays render these rows lit and offer
37
+ * "Remove priority" instead of "Prioritize". Tolerates the key being absent
38
+ * (a thread that never prioritized, a pre-feature host) and ignores anything
39
+ * that is not a string id.
40
+ */
41
+ export declare function readPrioritizedQueueIds(raw: unknown): readonly string[];
42
+ export interface QueueLaneFlags {
43
+ isRunning: boolean;
44
+ /** A stopped/errored thread can continue with its queued work. */
45
+ isContinuable: boolean;
46
+ }
47
+ /** The thread-status split every queue tray keys its affordances on. */
48
+ export declare function queueLaneFlags(status: DeepAgentThreadStatus): QueueLaneFlags;
49
+ export interface StatewireQueueRow {
50
+ item: StatewireThread.RunsQueueEntry;
51
+ lane: 'queue' | 'steer';
52
+ }
53
+ /**
54
+ * The rows a queue tray renders, in dispatch order: stranded steer-lane
55
+ * entries first (only while the thread rests continuable — during a run they
56
+ * already render in the message list), then the queue lane.
57
+ */
58
+ export declare function buildStatewireQueueRows(options: {
59
+ queue: readonly StatewireThread.RunsQueueEntry[];
60
+ steerQueue: readonly StatewireThread.RunsQueueEntry[];
61
+ isContinuable: boolean;
62
+ }): StatewireQueueRow[];
63
+ /**
64
+ * Whether a row offers "Send now": queue-lane rows only (steer entries already
65
+ * dispatch first), every row while the thread rests continuable, and only the
66
+ * head row while a run is live (later rows would jump the queue order).
67
+ */
68
+ export declare function showQueueRowSendNow(options: {
69
+ lane: 'queue' | 'steer';
70
+ index: number;
71
+ isRunning: boolean;
72
+ isContinuable: boolean;
73
+ }): boolean;
74
+ /**
75
+ * Whether a row offers "Steer" (`run/steer-live`): queue-lane rows while a run
76
+ * is live. Steer folds the entry into the RUNNING turn at its next model call
77
+ * — after the in-flight tool chain, never mid-tool — and the run goes on with
78
+ * it in context (ChatGPT's and Codex's Steer, versus Queue). Nothing is
79
+ * cancelled and no second run starts, so every queued row qualifies, not just
80
+ * the head. At rest there is no turn to steer: Send now already dispatches.
81
+ */
82
+ export declare function showQueueRowSteer(options: {
83
+ lane: 'queue' | 'steer';
84
+ isRunning: boolean;
85
+ }): boolean;
86
+ export type QueueEditCommand = {
87
+ type: 'run/steer';
88
+ runId: string;
89
+ message: StatewireThread.UserMessage;
90
+ } | {
91
+ type: 'run/enqueue';
92
+ runId: string;
93
+ message: StatewireThread.UserMessage;
94
+ };
95
+ /**
96
+ * Re-send a queued entry under its own id on its own lane with edited text:
97
+ * the host replaces the queued message's content in place, leaving its queue
98
+ * position and lane untouched (a same-id send never dispatches). The built-in
99
+ * queue client has no update command, so this goes straight to the runs
100
+ * protocol. Returns `null` when there is nothing to send — blank or unchanged
101
+ * text, or no live run entry to address.
102
+ */
103
+ export declare function buildQueueEditCommand(options: {
104
+ item: StatewireThread.RunsQueueEntry;
105
+ lane: 'queue' | 'steer';
106
+ runId: string | null;
107
+ text: string;
108
+ /**
109
+ * The edited message's metadata, replacing the entry's (the host replaces
110
+ * the queued message whole). Omitted, the entry's metadata is kept, minus a
111
+ * composer markdown that described the old text.
112
+ */
113
+ metadata?: Readonly<Record<string, unknown>> | undefined;
114
+ }): QueueEditCommand | null;
115
+ /**
116
+ * Grace between observing a stranded settle and auto-promoting the queue
117
+ * head — long enough for the host's own settle bookkeeping (or a status flap
118
+ * during reconnect) to resolve first, short enough to read as "it just
119
+ * continued" rather than "it hung".
120
+ */
121
+ export declare const QUEUE_AUTO_CONTINUE_DELAY_MS = 2000;
122
+ /** Whether the last cancellation marker records a user or client stop. */
123
+ export declare function userStopBlocksQueueAutoContinue(options: {
124
+ marker: string | undefined;
125
+ source: string | undefined;
126
+ }): boolean;
127
+ /** `fate (cause)[: message]` — the detail a failed-send row carries. */
128
+ export declare function describeQueueSendFailure(failure: StatewireThread.RunsFailedEntry['sendFailure']): string;
129
+ /**
130
+ * Whether a `retryFailed` / `discardFailed` throw is the covered drop race:
131
+ * statewire drops a failed entry on its own as soon as a canonical update
132
+ * shows the message landed, and acting on a just-dropped entry throws. Both
133
+ * the session record ("unknown failed command") and the adapter's projection
134
+ * ("unknown failed entry") use this prefix. Nothing is lost in that race — the
135
+ * message already made it and the row is about to disappear — so a tray
136
+ * swallows it (keeping telemetry) instead of crashing the click handler.
137
+ */
138
+ export declare function isFailedSendEntryRace(error: unknown): boolean;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const tap = require("@assistant-ui/tap");
4
4
  const storage = require("statewire/storage");
5
5
  const react = require("react");
6
+ const sessionLaneScope = require("./session-lane-scope.cjs");
6
7
  const statewireTransport = require("./statewire-transport.cjs");
7
8
  const SESSION_PREFIX = "aui:statewire-session:";
8
9
  const SESSION_LOCK_PREFIX = "aui:statewire-session-lock:";
@@ -320,6 +321,15 @@ const useQuotaSafeLocalStorageSession = ({
320
321
  const sessionKey = key(threadId);
321
322
  const storageKey = SESSION_PREFIX + sessionKey;
322
323
  const lockName = SESSION_LOCK_PREFIX + sessionKey;
324
+ const mountedScope = react.useRef({
325
+ threadId,
326
+ laneKey: sessionKey
327
+ });
328
+ if (!sessionLaneScope.isSameSessionLaneScope({ scope: mountedScope.current, key })) {
329
+ throw new Error(
330
+ "statewire: principal changed; remount the account's thread/session"
331
+ );
332
+ }
323
333
  const latestOnDegraded = react.useRef(onStorageDegraded);
324
334
  latestOnDegraded.current = onStorageDegraded;
325
335
  const reportDegradation = react.useMemo(() => {