@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 @@
1
+ {"version":3,"file":"sealed-idb.js","sources":["../../../../agent-runtime/src/sealed-idb.ts"],"sourcesContent":["/**\n * The sealed-record toolkit the device stores in this package share (the thread snapshot mirror,\n * the chat outbox): AES-GCM-256 sealing with a fresh IV and additional data that binds a record to\n * where it is stored, SHA-256 names so a database names no one, and the part of IndexedDB they use.\n *\n * This package compiles without the DOM lib (React Native honesty, `globals.d.ts`), so IndexedDB is\n * described structurally here; the stores run only where it exists and degrade to nothing where it\n * does not.\n */\n\nexport type IdbListener = ((event?: unknown) => void) | null;\n\nexport interface IdbRequest<T> {\n readonly result: T;\n readonly error: unknown;\n onsuccess: IdbListener;\n onerror: IdbListener;\n}\n\nexport interface IdbOpenRequest extends IdbRequest<IdbDatabase> {\n onupgradeneeded: IdbListener;\n onblocked: IdbListener;\n}\n\nexport interface IdbFactory {\n open(name: string, version?: number): IdbOpenRequest;\n}\n\nexport interface IdbCursor {\n readonly primaryKey: unknown;\n continue(): void;\n}\n\nexport interface IdbIndex {\n getAll(query?: unknown): IdbRequest<unknown[]>;\n getAllKeys(query?: unknown): IdbRequest<unknown[]>;\n openKeyCursor(range?: unknown, direction?: string): IdbRequest<IdbCursor | null>;\n}\n\nexport interface IdbObjectStore {\n put(value: unknown): IdbRequest<unknown>;\n get(key: unknown): IdbRequest<unknown>;\n delete(key: unknown): IdbRequest<unknown>;\n clear(): IdbRequest<unknown>;\n index(name: string): IdbIndex;\n createIndex(name: string, keyPath: string | string[], options?: { unique?: boolean }): unknown;\n}\n\nexport interface IdbTransaction {\n objectStore(name: string): IdbObjectStore;\n readonly error: unknown;\n oncomplete: IdbListener;\n onabort: IdbListener;\n onerror: IdbListener;\n}\n\nexport interface IdbDatabase {\n readonly objectStoreNames: { contains(name: string): boolean };\n transaction(stores: string | string[], mode?: \"readonly\" | \"readwrite\"): IdbTransaction;\n createObjectStore(name: string, options?: { keyPath: string }): IdbObjectStore;\n onversionchange: IdbListener;\n addEventListener(type: string, listener: () => void): void;\n close(): void;\n}\n\nexport interface IdbKeyRangeStatic {\n bound(lower: unknown, upper: unknown): unknown;\n}\n\nexport const idbGlobals = globalThis as { indexedDB?: object; IDBKeyRange?: IdbKeyRangeStatic };\n\n/** The AES-GCM IV length, prefixed to every sealed payload. */\nexport const SEALED_IV_BYTES = 12;\n\nconst encoder = new TextEncoder();\nconst decoder = new TextDecoder();\n\nexport async function sha256Hex(value: string): Promise<string> {\n const digest = await crypto.subtle.digest(\"SHA-256\", encoder.encode(value));\n return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\n/** `value` as JSON, sealed under `key` with a fresh IV; `aad` binds it to where it is stored. */\nexport async function sealJson({\n key,\n value,\n aad,\n}: {\n key: CryptoKey;\n value: unknown;\n aad: string;\n}): Promise<Uint8Array> {\n const iv = crypto.getRandomValues(new Uint8Array(SEALED_IV_BYTES));\n const ciphertext = new Uint8Array(\n await crypto.subtle.encrypt(\n { name: \"AES-GCM\", iv, additionalData: encoder.encode(aad) },\n key,\n encoder.encode(JSON.stringify(value)),\n ),\n );\n const sealed = new Uint8Array(SEALED_IV_BYTES + ciphertext.byteLength);\n sealed.set(iv, 0);\n sealed.set(ciphertext, SEALED_IV_BYTES);\n return sealed;\n}\n\n/** Opens what {@link sealJson} sealed; throws for the wrong key, the wrong `aad`, or a damaged record. */\nexport async function openJson({\n key,\n sealed,\n aad,\n}: {\n key: CryptoKey;\n sealed: Uint8Array;\n aad: string;\n}): Promise<unknown> {\n const iv = sealed.subarray(0, SEALED_IV_BYTES) as Uint8Array<ArrayBuffer>;\n const plaintext = await crypto.subtle.decrypt(\n { name: \"AES-GCM\", iv, additionalData: encoder.encode(aad) },\n key,\n sealed.subarray(SEALED_IV_BYTES) as Uint8Array<ArrayBuffer>,\n );\n return JSON.parse(decoder.decode(plaintext)) as unknown;\n}\n\nexport function requestToPromise<T>(request: IdbRequest<T>): Promise<T> {\n return new Promise((resolve, reject) => {\n request.onsuccess = () => resolve(request.result);\n request.onerror = () => reject(request.error ?? new Error(\"IndexedDB request failed\"));\n });\n}\n\nexport function transactionDone(tx: IdbTransaction): Promise<void> {\n return new Promise((resolve, reject) => {\n tx.oncomplete = () => resolve();\n tx.onabort = () => reject(tx.error ?? new Error(\"IndexedDB transaction aborted\"));\n tx.onerror = () => reject(tx.error ?? new Error(\"IndexedDB transaction failed\"));\n });\n}\n\n/**\n * Opens `name` at `version`, creating what `upgrade` creates. Resolves `null` instead of failing:\n * a database a newer build upgraded past this version, a blocked open, or no IndexedDB at all\n * (private browsing, SSR) all mean \"no store here\".\n */\nexport function openSealedDatabase({\n factory,\n name,\n version,\n upgrade,\n}: {\n factory: IdbFactory;\n name: string;\n version: number;\n upgrade: (db: IdbDatabase) => void;\n}): Promise<IdbDatabase | null> {\n return new Promise((resolve) => {\n try {\n const request = factory.open(name, version);\n request.onupgradeneeded = () => upgrade(request.result);\n request.onsuccess = () => {\n const db = request.result;\n // Another page deleting or upgrading the database: step aside.\n db.onversionchange = () => db.close();\n resolve(db);\n };\n request.onerror = () => resolve(null);\n request.onblocked = () => resolve(null);\n } catch {\n resolve(null);\n }\n });\n}\n\n/**\n * A lazily opened database handle that reopens after the browser (or another page's upgrade or\n * delete) closes it. `null` while there is no IndexedDB or Web Crypto here.\n */\nexport function lazySealedDatabase({\n factory,\n name,\n version,\n upgrade,\n}: {\n factory: object | undefined;\n name: string;\n version: number;\n upgrade: (db: IdbDatabase) => void;\n}): () => Promise<IdbDatabase | null> {\n let databasePromise: Promise<IdbDatabase | null> | null = null;\n return () => {\n if (!factory || typeof crypto === \"undefined\" || !crypto.subtle) return Promise.resolve(null);\n databasePromise ??= openSealedDatabase({ factory: factory as IdbFactory, name, version, upgrade }).then(\n (db) => {\n if (db) {\n const forget = () => {\n databasePromise = null;\n };\n db.addEventListener(\"versionchange\", forget);\n db.addEventListener(\"close\", forget);\n } else {\n databasePromise = null;\n }\n return db;\n },\n );\n return databasePromise;\n };\n}\n"],"names":[],"mappings":"AAqEO,MAAM,aAAa;AAGnB,MAAM,kBAAkB;AAE/B,MAAM,UAAU,IAAI,YAAA;AACpB,MAAM,UAAU,IAAI,YAAA;AAEpB,eAAsB,UAAU,OAAgC;AAC9D,QAAM,SAAS,MAAM,OAAO,OAAO,OAAO,WAAW,QAAQ,OAAO,KAAK,CAAC;AAC1E,SAAO,MAAM,KAAK,IAAI,WAAW,MAAM,GAAG,CAAC,SAAS,KAAK,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,EAAE,KAAK,EAAE;AACjG;AAGA,eAAsB,SAAS;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AACF,GAIwB;AACtB,QAAM,KAAK,OAAO,gBAAgB,IAAI,WAAW,eAAe,CAAC;AACjE,QAAM,aAAa,IAAI;AAAA,IACrB,MAAM,OAAO,OAAO;AAAA,MAClB,EAAE,MAAM,WAAW,IAAI,gBAAgB,QAAQ,OAAO,GAAG,EAAA;AAAA,MACzD;AAAA,MACA,QAAQ,OAAO,KAAK,UAAU,KAAK,CAAC;AAAA,IAAA;AAAA,EACtC;AAEF,QAAM,SAAS,IAAI,WAAW,kBAAkB,WAAW,UAAU;AACrE,SAAO,IAAI,IAAI,CAAC;AAChB,SAAO,IAAI,YAAY,eAAe;AACtC,SAAO;AACT;AAGA,eAAsB,SAAS;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AACF,GAIqB;AACnB,QAAM,KAAK,OAAO,SAAS,GAAG,eAAe;AAC7C,QAAM,YAAY,MAAM,OAAO,OAAO;AAAA,IACpC,EAAE,MAAM,WAAW,IAAI,gBAAgB,QAAQ,OAAO,GAAG,EAAA;AAAA,IACzD;AAAA,IACA,OAAO,SAAS,eAAe;AAAA,EAAA;AAEjC,SAAO,KAAK,MAAM,QAAQ,OAAO,SAAS,CAAC;AAC7C;AAEO,SAAS,iBAAoB,SAAoC;AACtE,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,YAAQ,YAAY,MAAM,QAAQ,QAAQ,MAAM;AAChD,YAAQ,UAAU,MAAM,OAAO,QAAQ,SAAS,IAAI,MAAM,0BAA0B,CAAC;AAAA,EACvF,CAAC;AACH;AAEO,SAAS,gBAAgB,IAAmC;AACjE,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,OAAG,aAAa,MAAM,QAAA;AACtB,OAAG,UAAU,MAAM,OAAO,GAAG,SAAS,IAAI,MAAM,+BAA+B,CAAC;AAChF,OAAG,UAAU,MAAM,OAAO,GAAG,SAAS,IAAI,MAAM,8BAA8B,CAAC;AAAA,EACjF,CAAC;AACH;AAOO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAKgC;AAC9B,SAAO,IAAI,QAAQ,CAAC,YAAY;AAC9B,QAAI;AACF,YAAM,UAAU,QAAQ,KAAK,MAAM,OAAO;AAC1C,cAAQ,kBAAkB,MAAM,QAAQ,QAAQ,MAAM;AACtD,cAAQ,YAAY,MAAM;AACxB,cAAM,KAAK,QAAQ;AAEnB,WAAG,kBAAkB,MAAM,GAAG,MAAA;AAC9B,gBAAQ,EAAE;AAAA,MACZ;AACA,cAAQ,UAAU,MAAM,QAAQ,IAAI;AACpC,cAAQ,YAAY,MAAM,QAAQ,IAAI;AAAA,IACxC,QAAQ;AACN,cAAQ,IAAI;AAAA,IACd;AAAA,EACF,CAAC;AACH;AAMO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAKsC;AACpC,MAAI,kBAAsD;AAC1D,SAAO,MAAM;AACX,QAAI,CAAC,WAAW,OAAO,WAAW,eAAe,CAAC,OAAO,OAAQ,QAAO,QAAQ,QAAQ,IAAI;AAC5F,0CAAoB,mBAAmB,EAAE,SAAgC,MAAM,SAAS,QAAA,CAAS,EAAE;AAAA,MACjG,CAAC,OAAO;AACN,YAAI,IAAI;AACN,gBAAM,SAAS,MAAM;AACnB,8BAAkB;AAAA,UACpB;AACA,aAAG,iBAAiB,iBAAiB,MAAM;AAC3C,aAAG,iBAAiB,SAAS,MAAM;AAAA,QACrC,OAAO;AACL,4BAAkB;AAAA,QACpB;AACA,eAAO;AAAA,MACT;AAAA,IAAA;AAEF,WAAO;AAAA,EACT;AACF;"}
@@ -0,0 +1,40 @@
1
+ import type { StatewireDiagnosticsCommandUpdate, StatewireDiagnosticsRecorder } from './statewire-diagnostics';
2
+ import type { StatewireFailedSendLane } from './thread-extras';
3
+ export interface DeepAgentSendRecoveryOptions {
4
+ /**
5
+ * Reads the thread's failed-send lane. `null` while it is unavailable (the
6
+ * client has not mounted yet, or its extras are not a statewire thread) —
7
+ * the controller stays armed and retries on the next state change.
8
+ */
9
+ lane: () => StatewireFailedSendLane | null;
10
+ /**
11
+ * Persisted failure stamps (message id → epoch ms of the original send) for
12
+ * the freshness gate. `null`/absent means no persistence is readable — every
13
+ * lane entry then counts as fresh (an in-memory failed lane can only hold
14
+ * failures from this page session).
15
+ */
16
+ failureStamps?: (() => ReadonlyMap<string, number> | null) | undefined;
17
+ /** Transport lifecycle recorder; read per event so a late-mounted recorder still sees retries. */
18
+ diagnostics?: (() => StatewireDiagnosticsRecorder | undefined) | undefined;
19
+ /** Injectable clock (tests). */
20
+ now?: () => number;
21
+ /** Sweep scheduler; defaults to `queueMicrotask` so a sweep never dispatches
22
+ * from inside a statewire flush or a React render. */
23
+ schedule?: (task: () => void) => void;
24
+ }
25
+ export interface DeepAgentSendRecovery {
26
+ /** Feed every (normalized) statewire state change; hydration arms the mount sweep. */
27
+ observeStateChange(state: unknown): void;
28
+ /** Feed every command-lifecycle update; a never-server-judged settle arms a sweep. */
29
+ observeCommand(update: StatewireDiagnosticsCommandUpdate): void;
30
+ /** Feed client notifications too: failed history can publish after the
31
+ * command settles, without any change to the canonical thread snapshot. */
32
+ observeFailedLaneChange(): void;
33
+ dispose(): void;
34
+ }
35
+ /** Whether a settle failure is a client-side death the recovery re-dispatches
36
+ * (the server never judged the command). Exported for host-side telemetry. */
37
+ export declare function shouldAutoRetryFailedSend(failure: {
38
+ fate: string;
39
+ } | undefined): boolean;
40
+ export declare function createDeepAgentSendRecovery(options: DeepAgentSendRecoveryOptions): DeepAgentSendRecovery;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ function isSameSessionLaneScope({
4
+ scope,
5
+ key
6
+ }) {
7
+ return key(scope.threadId) === scope.laneKey;
8
+ }
9
+ const INITIAL_SESSION_LANE_EPOCH = { scope: null, epoch: 0 };
10
+ function nextSessionLaneEpoch({
11
+ previous,
12
+ threadId,
13
+ key
14
+ }) {
15
+ if (key === null) return previous;
16
+ if (previous.scope === null) {
17
+ return { scope: { threadId, laneKey: key(threadId) }, epoch: previous.epoch };
18
+ }
19
+ if (isSameSessionLaneScope({ scope: previous.scope, key })) return previous;
20
+ return { scope: { threadId, laneKey: key(threadId) }, epoch: previous.epoch + 1 };
21
+ }
22
+ exports.INITIAL_SESSION_LANE_EPOCH = INITIAL_SESSION_LANE_EPOCH;
23
+ exports.isSameSessionLaneScope = isSameSessionLaneScope;
24
+ exports.nextSessionLaneEpoch = nextSessionLaneEpoch;
25
+ //# sourceMappingURL=session-lane-scope.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-lane-scope.cjs","sources":["../../../../agent-runtime/src/session-lane-scope.ts"],"sourcesContent":["/**\n * The scope of a thread's durable command lane, as the host names it: the\n * host's `key` maps a thread id to the lane's storage key, and folds into it\n * whatever the lane belongs to (the signed-in principal, the sync host). A lane\n * is one principal's: it holds that principal's client id, lane clocks and the\n * commands still waiting for a durable verdict, and everything in it is sent\n * under whatever credential the transport holds when it next attaches.\n *\n * The scope is the key the host's `key` gave one thread. Probing that same\n * thread again tells a change of scope (another principal, another backend)\n * apart from a thread switch, which moves to another lane of the same scope.\n */\nexport type DeepAgentSessionLaneScope = {\n /** The thread the scope was taken on. */\n threadId: string;\n /** The lane key the host's `key` gave that thread. */\n laneKey: string;\n};\n\n/** The host's lane key: thread id to the lane's storage key. */\nexport type DeepAgentSessionLaneKey = (threadId: string) => string;\n\n/**\n * Whether `key` still names the lanes of `scope`: a thread switch keeps the\n * scope, a principal change does not.\n */\nexport function isSameSessionLaneScope({\n scope,\n key,\n}: {\n scope: DeepAgentSessionLaneScope;\n key: DeepAgentSessionLaneKey;\n}): boolean {\n return key(scope.threadId) === scope.laneKey;\n}\n\n/**\n * A mounted thread's lane epoch: the scope its current lane belongs to, and how\n * many times that scope changed under the mount. `scope` is `null` until the\n * first lane is known (a `pending` lane waits for its principal).\n */\nexport type DeepAgentSessionLaneEpoch = {\n scope: DeepAgentSessionLaneScope | null;\n epoch: number;\n};\n\nexport const INITIAL_SESSION_LANE_EPOCH: DeepAgentSessionLaneEpoch = { scope: null, epoch: 0 };\n\n/**\n * The lane epoch after a render with the host's current lane key (`null` while\n * the host names no lane: `pending`, process-local or a host session store).\n *\n * The first lane a mount learns sets the scope without starting a new epoch:\n * a `pending` lane that resolves to its principal is that principal's first\n * lane, not a change. A key that maps the scope's thread to another lane starts\n * the next epoch: the lane now belongs to another principal (or another\n * backend), so nothing of the previous lane — its client id, clocks, journal,\n * the state it rendered — may carry over. A gap with no lane in between (the\n * previous principal signed out, the next one still loading) does not hide\n * the change, and a key with the same scope (a token refresh, a fresh `key`\n * function for the same principal, a thread switch) changes nothing.\n *\n * Returns `previous` itself when nothing changed.\n */\nexport function nextSessionLaneEpoch({\n previous,\n threadId,\n key,\n}: {\n previous: DeepAgentSessionLaneEpoch;\n threadId: string;\n key: DeepAgentSessionLaneKey | null;\n}): DeepAgentSessionLaneEpoch {\n if (key === null) return previous;\n if (previous.scope === null) {\n return { scope: { threadId, laneKey: key(threadId) }, epoch: previous.epoch };\n }\n if (isSameSessionLaneScope({ scope: previous.scope, key })) return previous;\n return { scope: { threadId, laneKey: key(threadId) }, epoch: previous.epoch + 1 };\n}\n"],"names":[],"mappings":";;AA0BO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AACF,GAGY;AACV,SAAO,IAAI,MAAM,QAAQ,MAAM,MAAM;AACvC;AAYO,MAAM,6BAAwD,EAAE,OAAO,MAAM,OAAO,EAAA;AAkBpF,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AACF,GAI8B;AAC5B,MAAI,QAAQ,KAAM,QAAO;AACzB,MAAI,SAAS,UAAU,MAAM;AAC3B,WAAO,EAAE,OAAO,EAAE,UAAU,SAAS,IAAI,QAAQ,KAAK,OAAO,SAAS,MAAA;AAAA,EACxE;AACA,MAAI,uBAAuB,EAAE,OAAO,SAAS,OAAO,IAAA,CAAK,EAAG,QAAO;AACnE,SAAO,EAAE,OAAO,EAAE,UAAU,SAAS,IAAI,QAAQ,EAAA,GAAK,OAAO,SAAS,QAAQ,EAAA;AAChF;;;;"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * The scope of a thread's durable command lane, as the host names it: the
3
+ * host's `key` maps a thread id to the lane's storage key, and folds into it
4
+ * whatever the lane belongs to (the signed-in principal, the sync host). A lane
5
+ * is one principal's: it holds that principal's client id, lane clocks and the
6
+ * commands still waiting for a durable verdict, and everything in it is sent
7
+ * under whatever credential the transport holds when it next attaches.
8
+ *
9
+ * The scope is the key the host's `key` gave one thread. Probing that same
10
+ * thread again tells a change of scope (another principal, another backend)
11
+ * apart from a thread switch, which moves to another lane of the same scope.
12
+ */
13
+ export type DeepAgentSessionLaneScope = {
14
+ /** The thread the scope was taken on. */
15
+ threadId: string;
16
+ /** The lane key the host's `key` gave that thread. */
17
+ laneKey: string;
18
+ };
19
+ /** The host's lane key: thread id to the lane's storage key. */
20
+ export type DeepAgentSessionLaneKey = (threadId: string) => string;
21
+ /**
22
+ * Whether `key` still names the lanes of `scope`: a thread switch keeps the
23
+ * scope, a principal change does not.
24
+ */
25
+ export declare function isSameSessionLaneScope({ scope, key, }: {
26
+ scope: DeepAgentSessionLaneScope;
27
+ key: DeepAgentSessionLaneKey;
28
+ }): boolean;
29
+ /**
30
+ * A mounted thread's lane epoch: the scope its current lane belongs to, and how
31
+ * many times that scope changed under the mount. `scope` is `null` until the
32
+ * first lane is known (a `pending` lane waits for its principal).
33
+ */
34
+ export type DeepAgentSessionLaneEpoch = {
35
+ scope: DeepAgentSessionLaneScope | null;
36
+ epoch: number;
37
+ };
38
+ export declare const INITIAL_SESSION_LANE_EPOCH: DeepAgentSessionLaneEpoch;
39
+ /**
40
+ * The lane epoch after a render with the host's current lane key (`null` while
41
+ * the host names no lane: `pending`, process-local or a host session store).
42
+ *
43
+ * The first lane a mount learns sets the scope without starting a new epoch:
44
+ * a `pending` lane that resolves to its principal is that principal's first
45
+ * lane, not a change. A key that maps the scope's thread to another lane starts
46
+ * the next epoch: the lane now belongs to another principal (or another
47
+ * backend), so nothing of the previous lane — its client id, clocks, journal,
48
+ * the state it rendered — may carry over. A gap with no lane in between (the
49
+ * previous principal signed out, the next one still loading) does not hide
50
+ * the change, and a key with the same scope (a token refresh, a fresh `key`
51
+ * function for the same principal, a thread switch) changes nothing.
52
+ *
53
+ * Returns `previous` itself when nothing changed.
54
+ */
55
+ export declare function nextSessionLaneEpoch({ previous, threadId, key, }: {
56
+ previous: DeepAgentSessionLaneEpoch;
57
+ threadId: string;
58
+ key: DeepAgentSessionLaneKey | null;
59
+ }): DeepAgentSessionLaneEpoch;
@@ -0,0 +1,25 @@
1
+ function isSameSessionLaneScope({
2
+ scope,
3
+ key
4
+ }) {
5
+ return key(scope.threadId) === scope.laneKey;
6
+ }
7
+ const INITIAL_SESSION_LANE_EPOCH = { scope: null, epoch: 0 };
8
+ function nextSessionLaneEpoch({
9
+ previous,
10
+ threadId,
11
+ key
12
+ }) {
13
+ if (key === null) return previous;
14
+ if (previous.scope === null) {
15
+ return { scope: { threadId, laneKey: key(threadId) }, epoch: previous.epoch };
16
+ }
17
+ if (isSameSessionLaneScope({ scope: previous.scope, key })) return previous;
18
+ return { scope: { threadId, laneKey: key(threadId) }, epoch: previous.epoch + 1 };
19
+ }
20
+ export {
21
+ INITIAL_SESSION_LANE_EPOCH,
22
+ isSameSessionLaneScope,
23
+ nextSessionLaneEpoch
24
+ };
25
+ //# sourceMappingURL=session-lane-scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-lane-scope.js","sources":["../../../../agent-runtime/src/session-lane-scope.ts"],"sourcesContent":["/**\n * The scope of a thread's durable command lane, as the host names it: the\n * host's `key` maps a thread id to the lane's storage key, and folds into it\n * whatever the lane belongs to (the signed-in principal, the sync host). A lane\n * is one principal's: it holds that principal's client id, lane clocks and the\n * commands still waiting for a durable verdict, and everything in it is sent\n * under whatever credential the transport holds when it next attaches.\n *\n * The scope is the key the host's `key` gave one thread. Probing that same\n * thread again tells a change of scope (another principal, another backend)\n * apart from a thread switch, which moves to another lane of the same scope.\n */\nexport type DeepAgentSessionLaneScope = {\n /** The thread the scope was taken on. */\n threadId: string;\n /** The lane key the host's `key` gave that thread. */\n laneKey: string;\n};\n\n/** The host's lane key: thread id to the lane's storage key. */\nexport type DeepAgentSessionLaneKey = (threadId: string) => string;\n\n/**\n * Whether `key` still names the lanes of `scope`: a thread switch keeps the\n * scope, a principal change does not.\n */\nexport function isSameSessionLaneScope({\n scope,\n key,\n}: {\n scope: DeepAgentSessionLaneScope;\n key: DeepAgentSessionLaneKey;\n}): boolean {\n return key(scope.threadId) === scope.laneKey;\n}\n\n/**\n * A mounted thread's lane epoch: the scope its current lane belongs to, and how\n * many times that scope changed under the mount. `scope` is `null` until the\n * first lane is known (a `pending` lane waits for its principal).\n */\nexport type DeepAgentSessionLaneEpoch = {\n scope: DeepAgentSessionLaneScope | null;\n epoch: number;\n};\n\nexport const INITIAL_SESSION_LANE_EPOCH: DeepAgentSessionLaneEpoch = { scope: null, epoch: 0 };\n\n/**\n * The lane epoch after a render with the host's current lane key (`null` while\n * the host names no lane: `pending`, process-local or a host session store).\n *\n * The first lane a mount learns sets the scope without starting a new epoch:\n * a `pending` lane that resolves to its principal is that principal's first\n * lane, not a change. A key that maps the scope's thread to another lane starts\n * the next epoch: the lane now belongs to another principal (or another\n * backend), so nothing of the previous lane — its client id, clocks, journal,\n * the state it rendered — may carry over. A gap with no lane in between (the\n * previous principal signed out, the next one still loading) does not hide\n * the change, and a key with the same scope (a token refresh, a fresh `key`\n * function for the same principal, a thread switch) changes nothing.\n *\n * Returns `previous` itself when nothing changed.\n */\nexport function nextSessionLaneEpoch({\n previous,\n threadId,\n key,\n}: {\n previous: DeepAgentSessionLaneEpoch;\n threadId: string;\n key: DeepAgentSessionLaneKey | null;\n}): DeepAgentSessionLaneEpoch {\n if (key === null) return previous;\n if (previous.scope === null) {\n return { scope: { threadId, laneKey: key(threadId) }, epoch: previous.epoch };\n }\n if (isSameSessionLaneScope({ scope: previous.scope, key })) return previous;\n return { scope: { threadId, laneKey: key(threadId) }, epoch: previous.epoch + 1 };\n}\n"],"names":[],"mappings":"AA0BO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AACF,GAGY;AACV,SAAO,IAAI,MAAM,QAAQ,MAAM,MAAM;AACvC;AAYO,MAAM,6BAAwD,EAAE,OAAO,MAAM,OAAO,EAAA;AAkBpF,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AACF,GAI8B;AAC5B,MAAI,QAAQ,KAAM,QAAO;AACzB,MAAI,SAAS,UAAU,MAAM;AAC3B,WAAO,EAAE,OAAO,EAAE,UAAU,SAAS,IAAI,QAAQ,KAAK,OAAO,SAAS,MAAA;AAAA,EACxE;AACA,MAAI,uBAAuB,EAAE,OAAO,SAAS,OAAO,IAAA,CAAK,EAAG,QAAO;AACnE,SAAO,EAAE,OAAO,EAAE,UAAU,SAAS,IAAI,QAAQ,EAAA,GAAK,OAAO,SAAS,QAAQ,EAAA;AAChF;"}
@@ -0,0 +1,194 @@
1
+ /**
2
+ * Attach-path instrumentation for the deep-agent statewire transport, wired
3
+ * through the two injection points statewire already exposes — the
4
+ * `webSocket` constructor (`StatewireClient.WebsocketOptions`) and `fetch`
5
+ * (`StatewireClient.HttpOptions`) — so the runtime can observe what the library
6
+ * does not surface:
7
+ *
8
+ * - socket open latency (`ws_open_ms`), the hello frame's size and its
9
+ * synchronous handler cost (`hello_bytes`, `hello_handler_ms`), and close
10
+ * codes/reasons, for the thread-switch telemetry;
11
+ * - a server `Retry-After` hint, honoured as a floor under the next dial.
12
+ *
13
+ * Retry-After today: statewire honours `retry-after` only on 429 command-frame
14
+ * refusals (folded into the refusal `syn.retry`); its attach paths treat a 503
15
+ * as a generic `HTTP 503` / `network` failure and back off exponentially with
16
+ * no server input. Browsers never expose the response headers of a refused
17
+ * WebSocket upgrade at all, so for the WS transport the hint can only ride
18
+ * something the client can read: the close frame. The contract this module
19
+ * reads is a close `reason` carrying `retry-after=<seconds>` (or
20
+ * `retry-after-ms=<ms>`) — the pinboard half of that contract is a separate
21
+ * change; until it lands the WS path simply sees no hint. The SSE attach
22
+ * (`POST …/stream`) is a plain fetch, so its `Retry-After` header is read here
23
+ * directly.
24
+ *
25
+ * This package compiles without the DOM lib (React Native honesty), so the
26
+ * browser surface is typed structurally and resolved through `globalThis`.
27
+ */
28
+ /**
29
+ * Who refused a wake (503/429), read off the response body against the two
30
+ * refusal vocabularies the iris scaler also classifies data-plane 503s by
31
+ * (`iris/scaler/src/v2AccessLog.ts`):
32
+ *
33
+ * - `"placement"` — the pinboard's own refusal, `{"error": …}` with one of its
34
+ * known strings ("no live workers for hostname", "registry cold start,
35
+ * retry", "takeover in progress, retry", …): the thread has no worker to
36
+ * dial right now.
37
+ * - `"worker"` — a pinned instance-lifecycle refusal, `{"detail": …}` with one
38
+ * of its known strings ("instance closing; retry", "activation queue full;
39
+ * retry", "host draining; retry", …): one instance on the worker the thread
40
+ * is already placed on, cleared in the time a teardown takes.
41
+ * - `"unknown"` — any other 503/429 body (unreadable, an unfamiliar string, a
42
+ * real worker failure such as "Thread history load failed"): treated
43
+ * conservatively — the full `Retry-After`, no dial dropped.
44
+ * - `null` — not a refusal status.
45
+ */
46
+ export type DeepAgentWakeRefusal = "placement" | "worker" | "unknown" | null;
47
+ export type DeepAgentAttachTimingEvent = {
48
+ type: "socket-open";
49
+ url: string;
50
+ openMs: number;
51
+ } | {
52
+ type: "hello";
53
+ url: string;
54
+ /** UTF-16 length of the hello frame — bytes for the ASCII JSON the wire carries. */
55
+ bytes: number;
56
+ /** Synchronous cost of statewire's message handler for the hello (parse + apply + flush). */
57
+ handlerMs: number;
58
+ /** Hello arrival relative to the socket open; `null` when the open was not observed. */
59
+ sinceOpenMs: number | null;
60
+ } | {
61
+ type: "socket-close";
62
+ url: string;
63
+ code: number | undefined;
64
+ reason: string | undefined;
65
+ sinceOpenMs: number | null;
66
+ } | {
67
+ type: "retry-after";
68
+ url: string;
69
+ delayMs: number;
70
+ source: "ws-close" | "http-header";
71
+ } | {
72
+ /** `POST …/prewarm` answered (see `wakeDeepAgentThread`). */
73
+ type: "wake";
74
+ url: string;
75
+ status: number;
76
+ durationMs: number;
77
+ /** How the host sourced the history: already resident (`warm`) or loaded by this call. */
78
+ history: "fresh_load" | "warm" | null;
79
+ /** Who refused a 503/429 (see {@link DeepAgentWakeRefusal}); `null` otherwise. */
80
+ refusal: DeepAgentWakeRefusal;
81
+ };
82
+ /** Longest server hint honoured — a buggy or hostile hint must not park a client. */
83
+ export declare const MAX_RETRY_AFTER_MS = 30000;
84
+ /**
85
+ * Parse an HTTP `Retry-After` header value: delta-seconds or an HTTP-date.
86
+ * Returns the delay in ms clamped to {@link MAX_RETRY_AFTER_MS}, or `null` when
87
+ * the value is absent or unparseable.
88
+ */
89
+ export declare function parseRetryAfterHeaderMs(value: string | null | undefined, now?: () => number): number | null;
90
+ /**
91
+ * Parse a retry hint off a WebSocket close reason: `retry-after=<seconds>` or
92
+ * `retry-after-ms=<ms>` anywhere in the reason text (case-insensitive, `=` or
93
+ * `:`). Returns ms clamped to {@link MAX_RETRY_AFTER_MS}, or `null`.
94
+ */
95
+ export declare function parseRetryAfterFromCloseReason(reason: string | undefined): number | null;
96
+ export interface AttachRetryGate {
97
+ /** Record a hint: no dial for `key` before `now + delayMs` (clamped). */
98
+ noteRetryAfter(key: string, delayMs: number): void;
99
+ /** Resolves once the recorded floor for `key` has passed (immediately when none). */
100
+ waitForDial(key: string): Promise<void>;
101
+ /** Remaining floor for `key` in ms (0 when none). */
102
+ remainingMs(key: string): number;
103
+ /** Drop one key's floor, or every floor. */
104
+ reset(key?: string): void;
105
+ }
106
+ /**
107
+ * Per-key dial floors. Keyed by the thread's attach URL so a hint delivered
108
+ * for one thread never delays another. The floor is a minimum under
109
+ * statewire's own backoff, never a replacement for it: the transport still
110
+ * schedules its retry, and the dial simply waits out the remainder inside the
111
+ * headers resolve (both attach paths resolve headers before they dial).
112
+ */
113
+ export declare function createAttachRetryGate({ now, wait, }?: {
114
+ now?: () => number;
115
+ wait?: (ms: number) => Promise<void>;
116
+ }): AttachRetryGate;
117
+ /** Process-wide gate shared by every deep-agent transport in the host. */
118
+ export declare const attachRetryGate: AttachRetryGate;
119
+ /** Structural subset of the browser `WebSocket` that statewire's WS transport touches. */
120
+ export interface AttachSocketLike {
121
+ readonly readyState: number;
122
+ readonly protocol: string;
123
+ onopen: ((event: unknown) => void) | null;
124
+ onmessage: ((event: {
125
+ data: unknown;
126
+ }) => void) | null;
127
+ onclose: ((event: {
128
+ code?: number;
129
+ reason?: string;
130
+ }) => void) | null;
131
+ onerror: ((event: unknown) => void) | null;
132
+ send(data: string): void;
133
+ close(code?: number, reason?: string): void;
134
+ }
135
+ export type AttachWebSocketConstructor = new (url: string, protocols?: string | string[]) => AttachSocketLike;
136
+ /**
137
+ * Wrap a socket in a forwarding facade whose handler setters time the events
138
+ * statewire attaches to (`onopen`, `onmessage`, `onclose`). A facade rather
139
+ * than a subclass so the same instrumentation works over any host `WebSocket`
140
+ * implementation, including test fakes.
141
+ */
142
+ export declare function instrumentAttachSocket({ socket, url, onEvent, now, }: {
143
+ socket: AttachSocketLike;
144
+ /** The thread attach URL the events are attributed to (not the socket URL). */
145
+ url: string;
146
+ onEvent: (event: DeepAgentAttachTimingEvent) => void;
147
+ now?: () => number;
148
+ }): AttachSocketLike;
149
+ /**
150
+ * A `WebSocket`-shaped constructor that dials through `Base` and reports the
151
+ * attach events for `url`. Constructor semantics (`new` returns the facade)
152
+ * match what statewire's `webSocket` option expects.
153
+ */
154
+ export declare function instrumentedWebSocketConstructor({ Base, url, onEvent, now, }: {
155
+ Base: AttachWebSocketConstructor;
156
+ url: string;
157
+ onEvent: (event: DeepAgentAttachTimingEvent) => void;
158
+ now?: () => number;
159
+ }): AttachWebSocketConstructor;
160
+ /** Structural `fetch` — what statewire's SSE transport calls. */
161
+ export type AttachFetch = (input: string | URL, init?: unknown) => Promise<{
162
+ ok: boolean;
163
+ status: number;
164
+ headers: {
165
+ get(name: string): string | null;
166
+ };
167
+ }>;
168
+ /**
169
+ * A `fetch` that reports a `Retry-After` header on refused attach requests
170
+ * (the SSE `POST …/stream`) before handing the response back untouched.
171
+ */
172
+ export declare function instrumentedAttachFetch<TFetch extends AttachFetch>({ baseFetch, url, onEvent, now, }: {
173
+ baseFetch: TFetch;
174
+ url: string;
175
+ onEvent: (event: DeepAgentAttachTimingEvent) => void;
176
+ now?: () => number;
177
+ }): TFetch;
178
+ /**
179
+ * The transport option overrides for one attach: an instrumented `webSocket`
180
+ * (WS) or `fetch` (SSE) that reports attach events for `url` and feeds
181
+ * `Retry-After` hints into the gate. Returns `{}` where the host has no such
182
+ * global (a server render, a non-browser runtime) so the transport keeps its
183
+ * defaults.
184
+ */
185
+ export declare function createAttachInstrumentation({ url, sse, onEvent, retryGate, now, }: {
186
+ url: string;
187
+ sse: boolean;
188
+ onEvent?: ((event: DeepAgentAttachTimingEvent) => void) | undefined;
189
+ retryGate?: AttachRetryGate;
190
+ now?: () => number;
191
+ }): {
192
+ webSocket?: AttachWebSocketConstructor;
193
+ fetch?: AttachFetch;
194
+ };
@@ -0,0 +1,74 @@
1
+ import type { StatewireClient } from 'statewire';
2
+ /**
3
+ * Allocation-light lifecycle recorder for the deep-agent statewire transport.
4
+ *
5
+ * `useDeepAgentThread` feeds it from the seams it already owns — the raw
6
+ * connection each converter pass, every command-lifecycle update, transport
7
+ * errors, and stale-auth header resolves — and it distills them into a small
8
+ * ring buffer of transition events:
9
+ *
10
+ * - `connection/dialing` · `connection/connected` (with attach latency + attempts)
11
+ * - `connection/retrying` (cause, attempt, lastError) · `connection/gone` · `connection/idle` · `connection/deferred`
12
+ * - `command/settled` (fate: `durable` or the failure fate, with settle latency)
13
+ * - `auth/stale-renewal` (a header resolve forced by a refused credential)
14
+ * - `transport/error`
15
+ *
16
+ * The recorder itself persists nothing: the host passes `onRecord` to mirror
17
+ * entries into its own persistence (Olympus wires it into the persisted
18
+ * diagnostics framework). Hosts should only construct one when their
19
+ * diagnostics channel is enabled — an absent recorder costs a single optional
20
+ * call at each seam. When present, the hot paths (`observeConnection` runs on
21
+ * every converter pass) compare plain fields and allocate only on an actual
22
+ * transition.
23
+ */
24
+ export interface StatewireDiagnosticsEntry {
25
+ /** ms since page navigation start (`performance.now()`), or epoch ms fallback. */
26
+ at: number;
27
+ event: string;
28
+ data?: Record<string, unknown>;
29
+ }
30
+ /** The command-lifecycle fields the recorder reads; structural subset of `Statewire.CommandUpdate`. */
31
+ export interface StatewireDiagnosticsCommandUpdate {
32
+ method: string;
33
+ /** The wire statement's params (a run send carries its message first). */
34
+ params?: readonly unknown[];
35
+ seq: number;
36
+ status: 'queued' | 'posted' | 'applied' | 'settled';
37
+ failure?: {
38
+ fate: string;
39
+ cause?: string;
40
+ code?: string;
41
+ message?: string;
42
+ };
43
+ }
44
+ export interface StatewireDiagnosticsRecorderOptions {
45
+ /** Ring-buffer capacity; oldest entries are overwritten. */
46
+ maxEntries?: number;
47
+ /** Injectable clock (tests). Defaults to `performance.now()`. */
48
+ now?: () => number;
49
+ /** Persistence sink, invoked once per recorded entry (exceptions swallowed). */
50
+ onRecord?: (entry: StatewireDiagnosticsEntry) => void;
51
+ }
52
+ export interface StatewireDiagnosticsRecorder {
53
+ /** Record an arbitrary host event (outbox replays, boundary crashes, …). */
54
+ record(event: string, data?: Record<string, unknown>): void;
55
+ /**
56
+ * Fold a connection into the transition log; call as often as you like —
57
+ * unchanged states are free. Takes the raw statewire connection so any host
58
+ * observer can feed it, and reads it only through
59
+ * `projectDeepAgentConnection` — the one seam over the wire vocabulary.
60
+ */
61
+ observeConnection(connection: StatewireClient.ConnectionState): void;
62
+ /** Fold a command-lifecycle update; records settle fates with latency. */
63
+ observeCommand(update: StatewireDiagnosticsCommandUpdate): void;
64
+ /** Fold a headers resolve; records only stale-auth renewals. */
65
+ observeAuthResolve(ctx: {
66
+ staleAuth: boolean;
67
+ }): void;
68
+ /** Record a transport error surfaced through `onError`. */
69
+ observeError(error: unknown): void;
70
+ /** Entries in arrival order (oldest first). */
71
+ getEntries(): StatewireDiagnosticsEntry[];
72
+ clear(): void;
73
+ }
74
+ export declare function createStatewireDiagnosticsRecorder(options?: StatewireDiagnosticsRecorderOptions): StatewireDiagnosticsRecorder;
@@ -0,0 +1,29 @@
1
+ import type { DeepAgentStreamValues } from './types';
2
+ export declare const DEEP_AGENT_PRE_STREAM_STATE: DeepAgentStreamValues;
3
+ /**
4
+ * Read the deep-agent stream values off a raw statewire state, substituting
5
+ * {@link DEEP_AGENT_PRE_STREAM_STATE} while the state is not an object yet
6
+ * (pre-attach, or a replay boundary republishing `undefined`).
7
+ *
8
+ * Identity-preserving: a hydrated state returns the same object reference it
9
+ * was given and the pre-stream branch always returns the same module constant,
10
+ * so this is safe to call inside `useStatewireState` selectors.
11
+ */
12
+ export declare function readDeepAgentStreamValues(state: unknown): DeepAgentStreamValues;
13
+ /**
14
+ * Whether a state (raw, or already normalized through
15
+ * {@link readDeepAgentStreamValues}) carries a real wire payload. `false`
16
+ * exactly while the pre-stream default stands in — the explicit signal for
17
+ * code that must distinguish "empty thread" from "no snapshot yet".
18
+ */
19
+ export declare function isDeepAgentStateHydrated(state: unknown): boolean;
20
+ /** Record that `threadId`'s attach produced `state` (the converter's output). */
21
+ export declare function pairDeepAgentStateWithThread({ state, threadId, }: {
22
+ state: object;
23
+ threadId: string;
24
+ }): void;
25
+ /**
26
+ * The thread whose attach produced `state`, or `null` for a state no deep-agent
27
+ * converter published (the pre-stream default, a state built elsewhere).
28
+ */
29
+ export declare function readDeepAgentStateThreadId(state: unknown): string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"statewire-suspended.cjs","sources":["../../../../agent-runtime/src/statewire-suspended.ts"],"sourcesContent":["import { resource } from '@assistant-ui/tap';\nimport type { ResourceElement } from '@assistant-ui/tap';\nimport { useRef, useState } from 'react';\nimport type { Statewire, StatewireClient } from 'statewire';\nimport { StatewireSendError } from 'statewire';\n\nexport interface SuspendedStatewireOptions {\n /** Why the transport is parked; surfaced as the connection message. */\n message: string;\n /**\n * Invoked when a surface asks the parked connection to `reconnect()` (the\n * connection indicator's retry affordance). Hosts that park for a reason\n * only they can clear (e.g. the user has no workspace) omit it.\n */\n onReconnectRequested?: (() => void) | undefined;\n}\n\nconst suspendedCommands = <\n TCommands extends Statewire.Commands,\n>(): Statewire.CommandsProxy<TCommands> =>\n new Proxy({} as Statewire.CommandsProxy<TCommands>, {\n get: (_target, method) => {\n if (typeof method !== 'string') return undefined;\n // Settle like a locally-dead channel: hosts already classify\n // non-\"server\" causes as channel teardown (quiet log, no user error).\n return () =>\n Promise.reject(new StatewireSendError({ fate: 'aborted', cause: 'stream-gone' }));\n },\n });\n\nconst useSuspendedStatewire = <TCommands extends Statewire.Commands = Statewire.Commands>(\n options: SuspendedStatewireOptions\n): Statewire<undefined, TCommands> => {\n const latest = useRef(options);\n latest.current = options;\n // `state` stays undefined so the thread keeps serving its `initialState`\n // (the same contract a live transport has before its attach snapshot).\n const [value] = useState((): Statewire<undefined, TCommands> => {\n const connection: StatewireClient.Connection & { readonly message: string } = {\n status: 'standby',\n reason: 'deferred',\n get message() {\n return latest.current.message;\n },\n reconnect: () => latest.current.onReconnectRequested?.(),\n degraded: false,\n };\n return {\n state: undefined,\n commands: suspendedCommands<TCommands>(),\n connection,\n // Context updates while parked are local and must never start a dial.\n // The live transport receives the current snapshot when it replaces us.\n setContext: () => {},\n isBusy: false,\n };\n });\n return value;\n};\n\n/**\n * A statewire transport that never dials.\n *\n * Swapped in for the live WS/SSE transport when attaching is known to be\n * pointless — the host gates it (no workspace) or repeated `unauthorized`\n * denials parked it — so the thread element stays mounted for assistant-ui\n * consumers while the reconnect loop stops entirely.\n */\nexport const StatewireSuspended = resource(useSuspendedStatewire) as <\n TCommands extends Statewire.Commands = Statewire.Commands,\n>(\n options: SuspendedStatewireOptions\n) => ResourceElement<Statewire<undefined, TCommands>>;\n"],"names":["StatewireSendError","useRef","useState","resource"],"mappings":";;;;;AAiBA,MAAM,oBAAoB,MAGxB,IAAI,MAAM,IAA0C;AAAA,EAClD,KAAK,CAAC,SAAS,WAAW;AACxB,QAAI,OAAO,WAAW,SAAU,QAAO;AAGvC,WAAO,MACL,QAAQ,OAAO,IAAIA,UAAAA,mBAAmB,EAAE,MAAM,WAAW,OAAO,cAAA,CAAe,CAAC;AAAA,EACpF;AACF,CAAC;AAEH,MAAM,wBAAwB,CAC5B,YACoC;AACpC,QAAM,SAASC,MAAAA,OAAO,OAAO;AAC7B,SAAO,UAAU;AAGjB,QAAM,CAAC,KAAK,IAAIC,MAAAA,SAAS,MAAuC;AAC9D,UAAM,aAAwE;AAAA,MAC5E,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,IAAI,UAAU;AACZ,eAAO,OAAO,QAAQ;AAAA,MACxB;AAAA,MACA,WAAW,MAAA;;AAAM,kCAAO,SAAQ,yBAAf;AAAA;AAAA,MACjB,UAAU;AAAA,IAAA;AAEZ,WAAO;AAAA,MACL,OAAO;AAAA,MACP,UAAU,kBAAA;AAAA,MACV;AAAA;AAAA;AAAA,MAGA,YAAY,MAAM;AAAA,MAAC;AAAA,MACnB,QAAQ;AAAA,IAAA;AAAA,EAEZ,CAAC;AACD,SAAO;AACT;AAUO,MAAM,qBAAqBC,IAAAA,SAAS,qBAAqB;;"}
1
+ {"version":3,"file":"statewire-suspended.cjs","sources":["../../../../agent-runtime/src/statewire-suspended.ts"],"sourcesContent":["import { resource } from '@assistant-ui/tap';\nimport type { ResourceElement } from '@assistant-ui/tap';\nimport { useRef, useState } from 'react';\nimport type { Statewire, StatewireClient } from 'statewire';\nimport { StatewireSendError } from 'statewire';\n\nexport interface SuspendedStatewireOptions {\n /**\n * Why the transport is parked; surfaced as the connection message. Omitted\n * for a park that is part of normal startup rather than a refusal (a\n * `pending` session lane, whose principal is still loading): the connection\n * then carries no message and reads like a never-started chat, which hosts\n * render as ready rather than paused.\n */\n message?: string | undefined;\n /**\n * Invoked when a surface asks the parked connection to `reconnect()` (the\n * connection indicator's retry affordance). Hosts that park for a reason\n * only they can clear (e.g. the user has no workspace) omit it.\n */\n onReconnectRequested?: (() => void) | undefined;\n}\n\nconst suspendedCommands = <\n TCommands extends Statewire.Commands,\n>(): Statewire.CommandsProxy<TCommands> =>\n new Proxy({} as Statewire.CommandsProxy<TCommands>, {\n get: (_target, method) => {\n if (typeof method !== 'string') return undefined;\n // Settle like a locally-dead channel: hosts already classify\n // non-\"server\" causes as channel teardown (quiet log, no user error).\n return () =>\n Promise.reject(new StatewireSendError({ fate: 'aborted', cause: 'stream-gone' }));\n },\n });\n\nconst useSuspendedStatewire = <TCommands extends Statewire.Commands = Statewire.Commands>(\n options: SuspendedStatewireOptions\n): Statewire<undefined, TCommands> => {\n const latest = useRef(options);\n latest.current = options;\n // `state` stays undefined so the thread keeps serving its `initialState`\n // (the same contract a live transport has before its attach snapshot).\n const [value] = useState((): Statewire<undefined, TCommands> => {\n const connection: StatewireClient.Connection & { readonly message: string | undefined } = {\n status: 'standby',\n reason: 'deferred',\n get message() {\n return latest.current.message;\n },\n reconnect: () => latest.current.onReconnectRequested?.(),\n degraded: false,\n };\n return {\n state: undefined,\n commands: suspendedCommands<TCommands>(),\n connection,\n // Context updates while parked are local and must never start a dial.\n // The live transport receives the current snapshot when it replaces us.\n setContext: () => {},\n isBusy: false,\n };\n });\n return value;\n};\n\n/**\n * A statewire transport that never dials.\n *\n * Swapped in for the live WS/SSE transport when attaching is known to be\n * pointless — the host gates it (no workspace) or repeated `unauthorized`\n * denials parked it — so the thread element stays mounted for assistant-ui\n * consumers while the reconnect loop stops entirely.\n */\nexport const StatewireSuspended = resource(useSuspendedStatewire) as <\n TCommands extends Statewire.Commands = Statewire.Commands,\n>(\n options: SuspendedStatewireOptions\n) => ResourceElement<Statewire<undefined, TCommands>>;\n"],"names":["StatewireSendError","useRef","useState","resource"],"mappings":";;;;;AAuBA,MAAM,oBAAoB,MAGxB,IAAI,MAAM,IAA0C;AAAA,EAClD,KAAK,CAAC,SAAS,WAAW;AACxB,QAAI,OAAO,WAAW,SAAU,QAAO;AAGvC,WAAO,MACL,QAAQ,OAAO,IAAIA,UAAAA,mBAAmB,EAAE,MAAM,WAAW,OAAO,cAAA,CAAe,CAAC;AAAA,EACpF;AACF,CAAC;AAEH,MAAM,wBAAwB,CAC5B,YACoC;AACpC,QAAM,SAASC,MAAAA,OAAO,OAAO;AAC7B,SAAO,UAAU;AAGjB,QAAM,CAAC,KAAK,IAAIC,MAAAA,SAAS,MAAuC;AAC9D,UAAM,aAAoF;AAAA,MACxF,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,IAAI,UAAU;AACZ,eAAO,OAAO,QAAQ;AAAA,MACxB;AAAA,MACA,WAAW,MAAA;;AAAM,kCAAO,SAAQ,yBAAf;AAAA;AAAA,MACjB,UAAU;AAAA,IAAA;AAEZ,WAAO;AAAA,MACL,OAAO;AAAA,MACP,UAAU,kBAAA;AAAA,MACV;AAAA;AAAA;AAAA,MAGA,YAAY,MAAM;AAAA,MAAC;AAAA,MACnB,QAAQ;AAAA,IAAA;AAAA,EAEZ,CAAC;AACD,SAAO;AACT;AAUO,MAAM,qBAAqBC,IAAAA,SAAS,qBAAqB;;"}
@@ -0,0 +1,27 @@
1
+ import type { ResourceElement } from '@assistant-ui/tap';
2
+ import type { Statewire } from 'statewire';
3
+ export interface SuspendedStatewireOptions {
4
+ /**
5
+ * Why the transport is parked; surfaced as the connection message. Omitted
6
+ * for a park that is part of normal startup rather than a refusal (a
7
+ * `pending` session lane, whose principal is still loading): the connection
8
+ * then carries no message and reads like a never-started chat, which hosts
9
+ * render as ready rather than paused.
10
+ */
11
+ message?: string | undefined;
12
+ /**
13
+ * Invoked when a surface asks the parked connection to `reconnect()` (the
14
+ * connection indicator's retry affordance). Hosts that park for a reason
15
+ * only they can clear (e.g. the user has no workspace) omit it.
16
+ */
17
+ onReconnectRequested?: (() => void) | undefined;
18
+ }
19
+ /**
20
+ * A statewire transport that never dials.
21
+ *
22
+ * Swapped in for the live WS/SSE transport when attaching is known to be
23
+ * pointless — the host gates it (no workspace) or repeated `unauthorized`
24
+ * denials parked it — so the thread element stays mounted for assistant-ui
25
+ * consumers while the reconnect loop stops entirely.
26
+ */
27
+ export declare const StatewireSuspended: <TCommands extends Statewire.Commands = Statewire.Commands>(options: SuspendedStatewireOptions) => ResourceElement<Statewire<undefined, TCommands>>;
@@ -1 +1 @@
1
- {"version":3,"file":"statewire-suspended.js","sources":["../../../../agent-runtime/src/statewire-suspended.ts"],"sourcesContent":["import { resource } from '@assistant-ui/tap';\nimport type { ResourceElement } from '@assistant-ui/tap';\nimport { useRef, useState } from 'react';\nimport type { Statewire, StatewireClient } from 'statewire';\nimport { StatewireSendError } from 'statewire';\n\nexport interface SuspendedStatewireOptions {\n /** Why the transport is parked; surfaced as the connection message. */\n message: string;\n /**\n * Invoked when a surface asks the parked connection to `reconnect()` (the\n * connection indicator's retry affordance). Hosts that park for a reason\n * only they can clear (e.g. the user has no workspace) omit it.\n */\n onReconnectRequested?: (() => void) | undefined;\n}\n\nconst suspendedCommands = <\n TCommands extends Statewire.Commands,\n>(): Statewire.CommandsProxy<TCommands> =>\n new Proxy({} as Statewire.CommandsProxy<TCommands>, {\n get: (_target, method) => {\n if (typeof method !== 'string') return undefined;\n // Settle like a locally-dead channel: hosts already classify\n // non-\"server\" causes as channel teardown (quiet log, no user error).\n return () =>\n Promise.reject(new StatewireSendError({ fate: 'aborted', cause: 'stream-gone' }));\n },\n });\n\nconst useSuspendedStatewire = <TCommands extends Statewire.Commands = Statewire.Commands>(\n options: SuspendedStatewireOptions\n): Statewire<undefined, TCommands> => {\n const latest = useRef(options);\n latest.current = options;\n // `state` stays undefined so the thread keeps serving its `initialState`\n // (the same contract a live transport has before its attach snapshot).\n const [value] = useState((): Statewire<undefined, TCommands> => {\n const connection: StatewireClient.Connection & { readonly message: string } = {\n status: 'standby',\n reason: 'deferred',\n get message() {\n return latest.current.message;\n },\n reconnect: () => latest.current.onReconnectRequested?.(),\n degraded: false,\n };\n return {\n state: undefined,\n commands: suspendedCommands<TCommands>(),\n connection,\n // Context updates while parked are local and must never start a dial.\n // The live transport receives the current snapshot when it replaces us.\n setContext: () => {},\n isBusy: false,\n };\n });\n return value;\n};\n\n/**\n * A statewire transport that never dials.\n *\n * Swapped in for the live WS/SSE transport when attaching is known to be\n * pointless — the host gates it (no workspace) or repeated `unauthorized`\n * denials parked it — so the thread element stays mounted for assistant-ui\n * consumers while the reconnect loop stops entirely.\n */\nexport const StatewireSuspended = resource(useSuspendedStatewire) as <\n TCommands extends Statewire.Commands = Statewire.Commands,\n>(\n options: SuspendedStatewireOptions\n) => ResourceElement<Statewire<undefined, TCommands>>;\n"],"names":[],"mappings":";;;AAiBA,MAAM,oBAAoB,MAGxB,IAAI,MAAM,IAA0C;AAAA,EAClD,KAAK,CAAC,SAAS,WAAW;AACxB,QAAI,OAAO,WAAW,SAAU,QAAO;AAGvC,WAAO,MACL,QAAQ,OAAO,IAAI,mBAAmB,EAAE,MAAM,WAAW,OAAO,cAAA,CAAe,CAAC;AAAA,EACpF;AACF,CAAC;AAEH,MAAM,wBAAwB,CAC5B,YACoC;AACpC,QAAM,SAAS,OAAO,OAAO;AAC7B,SAAO,UAAU;AAGjB,QAAM,CAAC,KAAK,IAAI,SAAS,MAAuC;AAC9D,UAAM,aAAwE;AAAA,MAC5E,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,IAAI,UAAU;AACZ,eAAO,OAAO,QAAQ;AAAA,MACxB;AAAA,MACA,WAAW,MAAA;;AAAM,kCAAO,SAAQ,yBAAf;AAAA;AAAA,MACjB,UAAU;AAAA,IAAA;AAEZ,WAAO;AAAA,MACL,OAAO;AAAA,MACP,UAAU,kBAAA;AAAA,MACV;AAAA;AAAA;AAAA,MAGA,YAAY,MAAM;AAAA,MAAC;AAAA,MACnB,QAAQ;AAAA,IAAA;AAAA,EAEZ,CAAC;AACD,SAAO;AACT;AAUO,MAAM,qBAAqB,SAAS,qBAAqB;"}
1
+ {"version":3,"file":"statewire-suspended.js","sources":["../../../../agent-runtime/src/statewire-suspended.ts"],"sourcesContent":["import { resource } from '@assistant-ui/tap';\nimport type { ResourceElement } from '@assistant-ui/tap';\nimport { useRef, useState } from 'react';\nimport type { Statewire, StatewireClient } from 'statewire';\nimport { StatewireSendError } from 'statewire';\n\nexport interface SuspendedStatewireOptions {\n /**\n * Why the transport is parked; surfaced as the connection message. Omitted\n * for a park that is part of normal startup rather than a refusal (a\n * `pending` session lane, whose principal is still loading): the connection\n * then carries no message and reads like a never-started chat, which hosts\n * render as ready rather than paused.\n */\n message?: string | undefined;\n /**\n * Invoked when a surface asks the parked connection to `reconnect()` (the\n * connection indicator's retry affordance). Hosts that park for a reason\n * only they can clear (e.g. the user has no workspace) omit it.\n */\n onReconnectRequested?: (() => void) | undefined;\n}\n\nconst suspendedCommands = <\n TCommands extends Statewire.Commands,\n>(): Statewire.CommandsProxy<TCommands> =>\n new Proxy({} as Statewire.CommandsProxy<TCommands>, {\n get: (_target, method) => {\n if (typeof method !== 'string') return undefined;\n // Settle like a locally-dead channel: hosts already classify\n // non-\"server\" causes as channel teardown (quiet log, no user error).\n return () =>\n Promise.reject(new StatewireSendError({ fate: 'aborted', cause: 'stream-gone' }));\n },\n });\n\nconst useSuspendedStatewire = <TCommands extends Statewire.Commands = Statewire.Commands>(\n options: SuspendedStatewireOptions\n): Statewire<undefined, TCommands> => {\n const latest = useRef(options);\n latest.current = options;\n // `state` stays undefined so the thread keeps serving its `initialState`\n // (the same contract a live transport has before its attach snapshot).\n const [value] = useState((): Statewire<undefined, TCommands> => {\n const connection: StatewireClient.Connection & { readonly message: string | undefined } = {\n status: 'standby',\n reason: 'deferred',\n get message() {\n return latest.current.message;\n },\n reconnect: () => latest.current.onReconnectRequested?.(),\n degraded: false,\n };\n return {\n state: undefined,\n commands: suspendedCommands<TCommands>(),\n connection,\n // Context updates while parked are local and must never start a dial.\n // The live transport receives the current snapshot when it replaces us.\n setContext: () => {},\n isBusy: false,\n };\n });\n return value;\n};\n\n/**\n * A statewire transport that never dials.\n *\n * Swapped in for the live WS/SSE transport when attaching is known to be\n * pointless — the host gates it (no workspace) or repeated `unauthorized`\n * denials parked it — so the thread element stays mounted for assistant-ui\n * consumers while the reconnect loop stops entirely.\n */\nexport const StatewireSuspended = resource(useSuspendedStatewire) as <\n TCommands extends Statewire.Commands = Statewire.Commands,\n>(\n options: SuspendedStatewireOptions\n) => ResourceElement<Statewire<undefined, TCommands>>;\n"],"names":[],"mappings":";;;AAuBA,MAAM,oBAAoB,MAGxB,IAAI,MAAM,IAA0C;AAAA,EAClD,KAAK,CAAC,SAAS,WAAW;AACxB,QAAI,OAAO,WAAW,SAAU,QAAO;AAGvC,WAAO,MACL,QAAQ,OAAO,IAAI,mBAAmB,EAAE,MAAM,WAAW,OAAO,cAAA,CAAe,CAAC;AAAA,EACpF;AACF,CAAC;AAEH,MAAM,wBAAwB,CAC5B,YACoC;AACpC,QAAM,SAAS,OAAO,OAAO;AAC7B,SAAO,UAAU;AAGjB,QAAM,CAAC,KAAK,IAAI,SAAS,MAAuC;AAC9D,UAAM,aAAoF;AAAA,MACxF,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,IAAI,UAAU;AACZ,eAAO,OAAO,QAAQ;AAAA,MACxB;AAAA,MACA,WAAW,MAAA;;AAAM,kCAAO,SAAQ,yBAAf;AAAA;AAAA,MACjB,UAAU;AAAA,IAAA;AAEZ,WAAO;AAAA,MACL,OAAO;AAAA,MACP,UAAU,kBAAA;AAAA,MACV;AAAA;AAAA;AAAA,MAGA,YAAY,MAAM;AAAA,MAAC;AAAA,MACnB,QAAQ;AAAA,IAAA;AAAA,EAEZ,CAAC;AACD,SAAO;AACT;AAUO,MAAM,qBAAqB,SAAS,qBAAqB;"}
@@ -0,0 +1,40 @@
1
+ import { type Statewire, type StatewireClient } from 'statewire';
2
+ import type { DeepAgentStreamValues } from './types';
3
+ export type StatewireTransportOptions = StatewireClient.HttpOptions & StatewireClient.WebsocketOptions;
4
+ /**
5
+ * The application protocol the deep-agent transport stamps on every command.
6
+ * The thread client must declare the same protocol: statewire's core applies
7
+ * its optimistic folds only to commands of its own protocol, so a mismatch
8
+ * leaves a send invisible until the server's frame lands.
9
+ */
10
+ export declare const DEEP_AGENT_STATEWIRE_PROTOCOL = "athena";
11
+ /** Durable Athena commands keep their schema version across wire upgrades. */
12
+ export declare const DEEP_AGENT_STATEWIRE_PROTOCOL_VERSION = "2026-09-13";
13
+ /**
14
+ * The wire contract every deep-agent transport offers. Athena's hosts (Python
15
+ * statewire 0.20) speak 2026-09-30 natively, so no legacy context range is
16
+ * advertised.
17
+ */
18
+ export declare const DEEP_AGENT_STATEWIRE_WIRE_VERSION: NonNullable<StatewireTransportOptions['wireVersion']>;
19
+ export type StatewireTransportKind = 'sse' | 'websocket';
20
+ /**
21
+ * The transport a host gets: SSE when it asks for SSE, WebSocket otherwise.
22
+ * Whatever instruments the transport must read this too, so it matches the
23
+ * transport actually built.
24
+ */
25
+ export declare function resolveStatewireTransportKind({ sse }: {
26
+ sse: boolean;
27
+ }): StatewireTransportKind;
28
+ /**
29
+ * Build the deep-agent statewire transport: WebSocket by default, SSE when the
30
+ * host app's toggle asks for it ({@link resolveStatewireTransportKind}). The
31
+ * toggle source is host-specific (env var, extension flag, config store), so
32
+ * the caller resolves it to a boolean.
33
+ *
34
+ * `TState` defaults to the deep-agent wire shape: the thread mounts that make
35
+ * up nearly every caller get a typed state without naming it, and the other
36
+ * mounts (the conversation index) name theirs.
37
+ */
38
+ export declare const statewireTransport: <TState = DeepAgentStreamValues, TCommands extends Statewire.Commands = Statewire.Commands>(options: StatewireTransportOptions, { sse }?: {
39
+ sse?: boolean;
40
+ }) => import("@assistant-ui/tap").ResourceElement<Statewire<TState | undefined, TCommands>>;