@athenaintel/react 0.57.2 → 0.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (852) hide show
  1. package/README.md +795 -12
  2. package/dist/agent-runtime/src/addressed-agents.cjs +16 -0
  3. package/dist/agent-runtime/src/addressed-agents.cjs.map +1 -0
  4. package/dist/agent-runtime/src/addressed-agents.d.ts +30 -0
  5. package/dist/agent-runtime/src/addressed-agents.js +16 -0
  6. package/dist/agent-runtime/src/addressed-agents.js.map +1 -0
  7. package/dist/agent-runtime/src/answer-label.cjs +4 -3
  8. package/dist/agent-runtime/src/answer-label.cjs.map +1 -1
  9. package/dist/agent-runtime/src/answer-label.d.ts +13 -6
  10. package/dist/agent-runtime/src/answer-label.js +4 -3
  11. package/dist/agent-runtime/src/answer-label.js.map +1 -1
  12. package/dist/agent-runtime/src/chat-outbox-attachments.cjs.map +1 -1
  13. package/dist/agent-runtime/src/chat-outbox-attachments.d.ts +1 -1
  14. package/dist/agent-runtime/src/chat-outbox-attachments.js.map +1 -1
  15. package/dist/agent-runtime/src/chat-outbox-entry.cjs +101 -0
  16. package/dist/agent-runtime/src/chat-outbox-entry.cjs.map +1 -0
  17. package/dist/agent-runtime/src/chat-outbox-entry.d.ts +99 -0
  18. package/dist/agent-runtime/src/chat-outbox-entry.js +101 -0
  19. package/dist/agent-runtime/src/chat-outbox-entry.js.map +1 -0
  20. package/dist/agent-runtime/src/chat-outbox-legacy.cjs +252 -0
  21. package/dist/agent-runtime/src/chat-outbox-legacy.cjs.map +1 -0
  22. package/dist/agent-runtime/src/chat-outbox-legacy.d.ts +96 -0
  23. package/dist/agent-runtime/src/chat-outbox-legacy.js +252 -0
  24. package/dist/agent-runtime/src/chat-outbox-legacy.js.map +1 -0
  25. package/dist/agent-runtime/src/chat-outbox-policy.cjs +30 -0
  26. package/dist/agent-runtime/src/chat-outbox-policy.cjs.map +1 -0
  27. package/dist/agent-runtime/src/chat-outbox-policy.d.ts +42 -0
  28. package/dist/agent-runtime/src/chat-outbox-policy.js +30 -0
  29. package/dist/agent-runtime/src/chat-outbox-policy.js.map +1 -0
  30. package/dist/agent-runtime/src/chat-outbox-storage.cjs +306 -0
  31. package/dist/agent-runtime/src/chat-outbox-storage.cjs.map +1 -0
  32. package/dist/agent-runtime/src/chat-outbox-storage.d.ts +194 -0
  33. package/dist/agent-runtime/src/chat-outbox-storage.js +306 -0
  34. package/dist/agent-runtime/src/chat-outbox-storage.js.map +1 -0
  35. package/dist/agent-runtime/src/chat-outbox-thread.cjs +21 -94
  36. package/dist/agent-runtime/src/chat-outbox-thread.cjs.map +1 -1
  37. package/dist/agent-runtime/src/chat-outbox-thread.d.ts +22 -18
  38. package/dist/agent-runtime/src/chat-outbox-thread.js +21 -94
  39. package/dist/agent-runtime/src/chat-outbox-thread.js.map +1 -1
  40. package/dist/agent-runtime/src/chat-outbox.cjs +492 -547
  41. package/dist/agent-runtime/src/chat-outbox.cjs.map +1 -1
  42. package/dist/agent-runtime/src/chat-outbox.d.ts +110 -142
  43. package/dist/agent-runtime/src/chat-outbox.js +492 -547
  44. package/dist/agent-runtime/src/chat-outbox.js.map +1 -1
  45. package/dist/agent-runtime/src/composer-markdown.cjs +0 -16
  46. package/dist/agent-runtime/src/composer-markdown.cjs.map +1 -1
  47. package/dist/agent-runtime/src/composer-markdown.d.ts +1 -1
  48. package/dist/agent-runtime/src/composer-markdown.js +1 -17
  49. package/dist/agent-runtime/src/composer-markdown.js.map +1 -1
  50. package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs +3 -1
  51. package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -1
  52. package/dist/agent-runtime/src/deep-agent-transport-recipe.d.ts +8 -1
  53. package/dist/agent-runtime/src/deep-agent-transport-recipe.js +3 -1
  54. package/dist/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -1
  55. package/dist/agent-runtime/src/dictation-preferences.d.ts +356 -0
  56. package/dist/agent-runtime/src/dictation-record.d.ts +279 -0
  57. package/dist/agent-runtime/src/dictation-session.d.ts +106 -7
  58. package/dist/agent-runtime/src/dictation-snippets.d.ts +9 -0
  59. package/dist/agent-runtime/src/dictation-transfer.d.ts +142 -0
  60. package/dist/agent-runtime/src/edit-command.cjs.map +1 -1
  61. package/dist/agent-runtime/src/edit-command.d.ts +1 -1
  62. package/dist/agent-runtime/src/edit-command.js.map +1 -1
  63. package/dist/agent-runtime/src/errors.cjs +1 -0
  64. package/dist/agent-runtime/src/errors.cjs.map +1 -1
  65. package/dist/agent-runtime/src/errors.js +1 -0
  66. package/dist/agent-runtime/src/errors.js.map +1 -1
  67. package/dist/agent-runtime/src/generated/runconfig-contract.cjs +24 -0
  68. package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
  69. package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +3 -3
  70. package/dist/agent-runtime/src/generated/runconfig-contract.js +24 -0
  71. package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
  72. package/dist/agent-runtime/src/index.d.ts +14 -8
  73. package/dist/agent-runtime/src/lane-follow.cjs +289 -0
  74. package/dist/agent-runtime/src/lane-follow.cjs.map +1 -0
  75. package/dist/agent-runtime/src/lane-follow.js +289 -0
  76. package/dist/agent-runtime/src/lane-follow.js.map +1 -0
  77. package/dist/agent-runtime/src/lane-images.cjs +387 -0
  78. package/dist/agent-runtime/src/lane-images.cjs.map +1 -0
  79. package/dist/agent-runtime/src/lane-images.js +387 -0
  80. package/dist/agent-runtime/src/lane-images.js.map +1 -0
  81. package/dist/agent-runtime/src/message-window.js +1 -1
  82. package/dist/agent-runtime/src/messages.cjs +19 -1
  83. package/dist/agent-runtime/src/messages.cjs.map +1 -1
  84. package/dist/agent-runtime/src/messages.d.ts +8 -0
  85. package/dist/agent-runtime/src/messages.js +21 -3
  86. package/dist/agent-runtime/src/messages.js.map +1 -1
  87. package/dist/agent-runtime/src/named-agents.cjs +301 -0
  88. package/dist/agent-runtime/src/named-agents.cjs.map +1 -0
  89. package/dist/agent-runtime/src/named-agents.d.ts +246 -0
  90. package/dist/agent-runtime/src/named-agents.js +301 -0
  91. package/dist/agent-runtime/src/named-agents.js.map +1 -0
  92. package/dist/agent-runtime/src/offline-status.cjs.map +1 -1
  93. package/dist/agent-runtime/src/offline-status.d.ts +93 -2
  94. package/dist/agent-runtime/src/offline-status.js.map +1 -1
  95. package/dist/agent-runtime/src/ptc-subcalls.cjs +41 -0
  96. package/dist/agent-runtime/src/ptc-subcalls.cjs.map +1 -0
  97. package/dist/agent-runtime/src/ptc-subcalls.js +41 -0
  98. package/dist/agent-runtime/src/ptc-subcalls.js.map +1 -0
  99. package/dist/agent-runtime/src/queue.cjs +2 -2
  100. package/dist/agent-runtime/src/queue.cjs.map +1 -1
  101. package/dist/agent-runtime/src/queue.d.ts +20 -25
  102. package/dist/agent-runtime/src/queue.js +2 -2
  103. package/dist/agent-runtime/src/queue.js.map +1 -1
  104. package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs +314 -84
  105. package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
  106. package/dist/agent-runtime/src/quota-safe-local-storage-session.d.ts +137 -40
  107. package/dist/agent-runtime/src/quota-safe-local-storage-session.js +318 -88
  108. package/dist/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -1
  109. package/dist/agent-runtime/src/run-send.cjs +54 -0
  110. package/dist/agent-runtime/src/run-send.cjs.map +1 -0
  111. package/dist/agent-runtime/src/run-send.d.ts +51 -0
  112. package/dist/agent-runtime/src/run-send.js +54 -0
  113. package/dist/agent-runtime/src/run-send.js.map +1 -0
  114. package/dist/agent-runtime/src/running-tool-placeholder.cjs +6 -0
  115. package/dist/agent-runtime/src/running-tool-placeholder.cjs.map +1 -1
  116. package/dist/agent-runtime/src/running-tool-placeholder.js +6 -0
  117. package/dist/agent-runtime/src/running-tool-placeholder.js.map +1 -1
  118. package/dist/agent-runtime/src/runtime.d.ts +9 -5
  119. package/dist/agent-runtime/src/sealed-idb.cjs +64 -0
  120. package/dist/agent-runtime/src/sealed-idb.cjs.map +1 -1
  121. package/dist/agent-runtime/src/sealed-idb.d.ts +16 -0
  122. package/dist/agent-runtime/src/sealed-idb.js +64 -0
  123. package/dist/agent-runtime/src/sealed-idb.js.map +1 -1
  124. package/dist/agent-runtime/src/send-recovery.cjs +90 -118
  125. package/dist/agent-runtime/src/send-recovery.cjs.map +1 -1
  126. package/dist/agent-runtime/src/send-recovery.d.ts +25 -29
  127. package/dist/agent-runtime/src/send-recovery.js +90 -118
  128. package/dist/agent-runtime/src/send-recovery.js.map +1 -1
  129. package/dist/agent-runtime/src/statewire-diagnostics.d.ts +4 -1
  130. package/dist/agent-runtime/src/statewire-held-sends.cjs +191 -0
  131. package/dist/agent-runtime/src/statewire-held-sends.cjs.map +1 -0
  132. package/dist/agent-runtime/src/statewire-held-sends.d.ts +119 -0
  133. package/dist/agent-runtime/src/statewire-held-sends.js +191 -0
  134. package/dist/agent-runtime/src/statewire-held-sends.js.map +1 -0
  135. package/dist/agent-runtime/src/statewire-state.cjs +4 -0
  136. package/dist/agent-runtime/src/statewire-state.cjs.map +1 -1
  137. package/dist/agent-runtime/src/statewire-state.js +4 -0
  138. package/dist/agent-runtime/src/statewire-state.js.map +1 -1
  139. package/dist/agent-runtime/src/statewire-transport.cjs +8 -2
  140. package/dist/agent-runtime/src/statewire-transport.cjs.map +1 -1
  141. package/dist/agent-runtime/src/statewire-transport.d.ts +14 -5
  142. package/dist/agent-runtime/src/statewire-transport.js +8 -2
  143. package/dist/agent-runtime/src/statewire-transport.js.map +1 -1
  144. package/dist/agent-runtime/src/subagent-transcripts.cjs +1 -23
  145. package/dist/agent-runtime/src/subagent-transcripts.cjs.map +1 -1
  146. package/dist/agent-runtime/src/subagent-transcripts.js +3 -25
  147. package/dist/agent-runtime/src/subagent-transcripts.js.map +1 -1
  148. package/dist/agent-runtime/src/subagents.cjs +22 -29
  149. package/dist/agent-runtime/src/subagents.cjs.map +1 -1
  150. package/dist/agent-runtime/src/subagents.js +23 -30
  151. package/dist/agent-runtime/src/subagents.js.map +1 -1
  152. package/dist/agent-runtime/src/thread-extras.cjs +27 -19
  153. package/dist/agent-runtime/src/thread-extras.cjs.map +1 -1
  154. package/dist/agent-runtime/src/thread-extras.d.ts +19 -6
  155. package/dist/agent-runtime/src/thread-extras.js +27 -19
  156. package/dist/agent-runtime/src/thread-extras.js.map +1 -1
  157. package/dist/agent-runtime/src/thread-handoff-flow-machine.d.ts +8 -8
  158. package/dist/agent-runtime/src/tool-metadata.cjs +19 -0
  159. package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -1
  160. package/dist/agent-runtime/src/tool-metadata.js +19 -0
  161. package/dist/agent-runtime/src/tool-metadata.js.map +1 -1
  162. package/dist/agent-runtime/src/tool-names.cjs +21 -0
  163. package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
  164. package/dist/agent-runtime/src/tool-names.d.ts +8 -0
  165. package/dist/agent-runtime/src/tool-names.js +21 -0
  166. package/dist/agent-runtime/src/tool-names.js.map +1 -1
  167. package/dist/agent-runtime/src/typed-interrupt-kinds.cjs +247 -0
  168. package/dist/agent-runtime/src/typed-interrupt-kinds.cjs.map +1 -0
  169. package/dist/agent-runtime/src/typed-interrupt-kinds.d.ts +173 -0
  170. package/dist/agent-runtime/src/typed-interrupt-kinds.js +247 -0
  171. package/dist/agent-runtime/src/typed-interrupt-kinds.js.map +1 -0
  172. package/dist/agent-runtime/src/typed-interrupts.cjs +48 -0
  173. package/dist/agent-runtime/src/typed-interrupts.cjs.map +1 -0
  174. package/dist/agent-runtime/src/typed-interrupts.d.ts +75 -0
  175. package/dist/agent-runtime/src/typed-interrupts.js +48 -0
  176. package/dist/agent-runtime/src/typed-interrupts.js.map +1 -0
  177. package/dist/agent-runtime/src/types.d.ts +1 -1
  178. package/dist/agent-runtime/src/use-conversation-list.cjs +1 -0
  179. package/dist/agent-runtime/src/use-conversation-list.cjs.map +1 -1
  180. package/dist/agent-runtime/src/use-conversation-list.d.ts +7 -0
  181. package/dist/agent-runtime/src/use-conversation-list.js +1 -0
  182. package/dist/agent-runtime/src/use-conversation-list.js.map +1 -1
  183. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +46 -29
  184. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -1
  185. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +14 -22
  186. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +46 -29
  187. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -1
  188. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +78 -14
  189. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
  190. package/dist/agent-runtime/src/use-deep-agent-runtime.d.ts +34 -7
  191. package/dist/agent-runtime/src/use-deep-agent-runtime.js +79 -15
  192. package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
  193. package/dist/agent-runtime/src/use-deep-agent-thread.cjs +16 -1
  194. package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
  195. package/dist/agent-runtime/src/use-deep-agent-thread.d.ts +7 -2
  196. package/dist/agent-runtime/src/use-deep-agent-thread.js +16 -1
  197. package/dist/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
  198. package/dist/agent-runtime/src/use-deep-agent-voice.cjs +30 -4
  199. package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -1
  200. package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +22 -4
  201. package/dist/agent-runtime/src/use-deep-agent-voice.js +30 -4
  202. package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -1
  203. package/dist/agent-runtime/src/withdrawn-turns.d.ts +5 -4
  204. package/dist/agent-runtime/src/word-device-fit.d.ts +174 -0
  205. package/dist/agent-runtime/src/work-in.d.ts +127 -0
  206. package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
  207. package/dist/assets/AthenaAssetEmbed.d.ts +6 -1
  208. package/dist/assets/AthenaAssetEmbed.js.map +1 -1
  209. package/dist/assets/asset-panel-store.cjs +13 -5
  210. package/dist/assets/asset-panel-store.cjs.map +1 -1
  211. package/dist/assets/asset-panel-store.d.ts +33 -2
  212. package/dist/assets/asset-panel-store.js +13 -5
  213. package/dist/assets/asset-panel-store.js.map +1 -1
  214. package/dist/auth/AthenaCredentialSourceContext.cjs +11 -0
  215. package/dist/auth/AthenaCredentialSourceContext.cjs.map +1 -1
  216. package/dist/auth/AthenaCredentialSourceContext.d.ts +6 -0
  217. package/dist/auth/AthenaCredentialSourceContext.js +11 -0
  218. package/dist/auth/AthenaCredentialSourceContext.js.map +1 -1
  219. package/dist/auth/account-identity.cjs +13 -2
  220. package/dist/auth/account-identity.cjs.map +1 -1
  221. package/dist/auth/account-identity.d.ts +9 -0
  222. package/dist/auth/account-identity.js +13 -2
  223. package/dist/auth/account-identity.js.map +1 -1
  224. package/dist/auth/credential-source.cjs +20 -4
  225. package/dist/auth/credential-source.cjs.map +1 -1
  226. package/dist/auth/credential-source.d.ts +9 -0
  227. package/dist/auth/credential-source.js +20 -4
  228. package/dist/auth/credential-source.js.map +1 -1
  229. package/dist/catalog/chat-pickers.cjs +31 -0
  230. package/dist/catalog/chat-pickers.cjs.map +1 -1
  231. package/dist/catalog/chat-pickers.d.ts +17 -0
  232. package/dist/catalog/chat-pickers.js +33 -2
  233. package/dist/catalog/chat-pickers.js.map +1 -1
  234. package/dist/catalog/runtime-catalog.cjs +63 -3
  235. package/dist/catalog/runtime-catalog.cjs.map +1 -1
  236. package/dist/catalog/runtime-catalog.d.ts +63 -3
  237. package/dist/catalog/runtime-catalog.js +64 -4
  238. package/dist/catalog/runtime-catalog.js.map +1 -1
  239. package/dist/chat/AthenaChat.cjs +301 -98
  240. package/dist/chat/AthenaChat.cjs.map +1 -1
  241. package/dist/chat/AthenaChat.d.ts +80 -4
  242. package/dist/chat/AthenaChat.js +302 -99
  243. package/dist/chat/AthenaChat.js.map +1 -1
  244. package/dist/chat/StatewireApprovalCard.cjs +35 -5
  245. package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
  246. package/dist/chat/StatewireApprovalCard.d.ts +55 -2
  247. package/dist/chat/StatewireApprovalCard.js +37 -7
  248. package/dist/chat/StatewireApprovalCard.js.map +1 -1
  249. package/dist/chat/StatewireQueuedMessages.cjs +17 -2
  250. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
  251. package/dist/chat/StatewireQueuedMessages.d.ts +8 -45
  252. package/dist/chat/StatewireQueuedMessages.js +18 -3
  253. package/dist/chat/StatewireQueuedMessages.js.map +1 -1
  254. package/dist/chat/chat-agent-mentions.cjs +70 -0
  255. package/dist/chat/chat-agent-mentions.cjs.map +1 -0
  256. package/dist/chat/chat-agent-mentions.d.ts +13 -0
  257. package/dist/chat/chat-agent-mentions.js +70 -0
  258. package/dist/chat/chat-agent-mentions.js.map +1 -0
  259. package/dist/chat/composer-actions.cjs +12 -0
  260. package/dist/chat/composer-actions.cjs.map +1 -0
  261. package/dist/chat/composer-actions.d.ts +22 -0
  262. package/dist/chat/composer-actions.js +12 -0
  263. package/dist/chat/composer-actions.js.map +1 -0
  264. package/dist/chat/follow-up-suggestions.cjs +185 -0
  265. package/dist/chat/follow-up-suggestions.cjs.map +1 -0
  266. package/dist/chat/follow-up-suggestions.d.ts +64 -0
  267. package/dist/chat/follow-up-suggestions.js +185 -0
  268. package/dist/chat/follow-up-suggestions.js.map +1 -0
  269. package/dist/chat/super-grouping/ToolTimeline.cjs +4 -3
  270. package/dist/chat/super-grouping/ToolTimeline.cjs.map +1 -1
  271. package/dist/chat/super-grouping/ToolTimeline.d.ts +7 -3
  272. package/dist/chat/super-grouping/ToolTimeline.js +4 -3
  273. package/dist/chat/super-grouping/ToolTimeline.js.map +1 -1
  274. package/dist/chat/turn-changes.cjs +284 -0
  275. package/dist/chat/turn-changes.cjs.map +1 -0
  276. package/dist/chat/turn-changes.d.ts +130 -0
  277. package/dist/chat/turn-changes.js +284 -0
  278. package/dist/chat/turn-changes.js.map +1 -0
  279. package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.cjs +31 -0
  280. package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.cjs.map +1 -0
  281. package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.d.ts +31 -0
  282. package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.js +31 -0
  283. package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.js.map +1 -0
  284. package/dist/chat/typed-interrupts/approval-cards.cjs +250 -0
  285. package/dist/chat/typed-interrupts/approval-cards.cjs.map +1 -0
  286. package/dist/chat/typed-interrupts/approval-cards.d.ts +22 -0
  287. package/dist/chat/typed-interrupts/approval-cards.js +250 -0
  288. package/dist/chat/typed-interrupts/approval-cards.js.map +1 -0
  289. package/dist/chat/typed-interrupts/form-cards.cjs +289 -0
  290. package/dist/chat/typed-interrupts/form-cards.cjs.map +1 -0
  291. package/dist/chat/typed-interrupts/form-cards.d.ts +6 -0
  292. package/dist/chat/typed-interrupts/form-cards.js +289 -0
  293. package/dist/chat/typed-interrupts/form-cards.js.map +1 -0
  294. package/dist/chat/typed-interrupts/interrupt-card-shell.cjs +182 -0
  295. package/dist/chat/typed-interrupts/interrupt-card-shell.cjs.map +1 -0
  296. package/dist/chat/typed-interrupts/interrupt-card-shell.d.ts +47 -0
  297. package/dist/chat/typed-interrupts/interrupt-card-shell.js +182 -0
  298. package/dist/chat/typed-interrupts/interrupt-card-shell.js.map +1 -0
  299. package/dist/chat/typed-interrupts/json-schema-form.cjs +388 -0
  300. package/dist/chat/typed-interrupts/json-schema-form.cjs.map +1 -0
  301. package/dist/chat/typed-interrupts/json-schema-form.d.ts +33 -0
  302. package/dist/chat/typed-interrupts/json-schema-form.js +388 -0
  303. package/dist/chat/typed-interrupts/json-schema-form.js.map +1 -0
  304. package/dist/chat/typed-interrupts/questionnaire-card.cjs +449 -0
  305. package/dist/chat/typed-interrupts/questionnaire-card.cjs.map +1 -0
  306. package/dist/chat/typed-interrupts/questionnaire-card.d.ts +20 -0
  307. package/dist/chat/typed-interrupts/questionnaire-card.js +449 -0
  308. package/dist/chat/typed-interrupts/questionnaire-card.js.map +1 -0
  309. package/dist/chat/typed-interrupts/request-file-card.cjs +159 -0
  310. package/dist/chat/typed-interrupts/request-file-card.cjs.map +1 -0
  311. package/dist/chat/typed-interrupts/request-file-card.d.ts +2 -0
  312. package/dist/chat/typed-interrupts/request-file-card.js +159 -0
  313. package/dist/chat/typed-interrupts/request-file-card.js.map +1 -0
  314. package/dist/chat/typed-interrupts/toolkit-selection-card.cjs +189 -0
  315. package/dist/chat/typed-interrupts/toolkit-selection-card.cjs.map +1 -0
  316. package/dist/chat/typed-interrupts/toolkit-selection-card.d.ts +23 -0
  317. package/dist/chat/typed-interrupts/toolkit-selection-card.js +189 -0
  318. package/dist/chat/typed-interrupts/toolkit-selection-card.js.map +1 -0
  319. package/dist/chat/typed-interrupts/typed-interrupt-body.cjs +26 -0
  320. package/dist/chat/typed-interrupts/typed-interrupt-body.cjs.map +1 -0
  321. package/dist/chat/typed-interrupts/typed-interrupt-body.d.ts +3 -0
  322. package/dist/chat/typed-interrupts/typed-interrupt-body.js +26 -0
  323. package/dist/chat/typed-interrupts/typed-interrupt-body.js.map +1 -0
  324. package/dist/chat/typed-interrupts/typed-interrupt-graphql.cjs +105 -0
  325. package/dist/chat/typed-interrupts/typed-interrupt-graphql.cjs.map +1 -0
  326. package/dist/chat/typed-interrupts/typed-interrupt-graphql.d.ts +29 -0
  327. package/dist/chat/typed-interrupts/typed-interrupt-graphql.js +105 -0
  328. package/dist/chat/typed-interrupts/typed-interrupt-graphql.js.map +1 -0
  329. package/dist/chat/typed-interrupts/typed-interrupt-notice.cjs +70 -0
  330. package/dist/chat/typed-interrupts/typed-interrupt-notice.cjs.map +1 -0
  331. package/dist/chat/typed-interrupts/typed-interrupt-notice.d.ts +45 -0
  332. package/dist/chat/typed-interrupts/typed-interrupt-notice.js +70 -0
  333. package/dist/chat/typed-interrupts/typed-interrupt-notice.js.map +1 -0
  334. package/dist/chat/typed-interrupts/typed-interrupt-panel.cjs +76 -0
  335. package/dist/chat/typed-interrupts/typed-interrupt-panel.cjs.map +1 -0
  336. package/dist/chat/typed-interrupts/typed-interrupt-panel.d.ts +11 -0
  337. package/dist/chat/typed-interrupts/typed-interrupt-panel.js +76 -0
  338. package/dist/chat/typed-interrupts/typed-interrupt-panel.js.map +1 -0
  339. package/dist/chat/typed-interrupts/typed-interrupt-types.d.ts +46 -0
  340. package/dist/chat/typed-interrupts/use-interrupt-draft.cjs +106 -0
  341. package/dist/chat/typed-interrupts/use-interrupt-draft.cjs.map +1 -0
  342. package/dist/chat/typed-interrupts/use-interrupt-draft.d.ts +29 -0
  343. package/dist/chat/typed-interrupts/use-interrupt-draft.js +106 -0
  344. package/dist/chat/typed-interrupts/use-interrupt-draft.js.map +1 -0
  345. package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.cjs +231 -0
  346. package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.cjs.map +1 -0
  347. package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.d.ts +66 -0
  348. package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.js +231 -0
  349. package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.js.map +1 -0
  350. package/dist/chat-ui/composer/composer-named-agents.cjs +13 -0
  351. package/dist/chat-ui/composer/composer-named-agents.cjs.map +1 -0
  352. package/dist/chat-ui/composer/composer-named-agents.d.ts +20 -0
  353. package/dist/chat-ui/composer/composer-named-agents.js +13 -0
  354. package/dist/chat-ui/composer/composer-named-agents.js.map +1 -0
  355. package/dist/chat-ui/composer/slash-command-menu.cjs +143 -0
  356. package/dist/chat-ui/composer/slash-command-menu.cjs.map +1 -0
  357. package/dist/chat-ui/composer/slash-command-menu.d.ts +19 -0
  358. package/dist/chat-ui/composer/slash-command-menu.js +143 -0
  359. package/dist/chat-ui/composer/slash-command-menu.js.map +1 -0
  360. package/dist/chat-ui/composer/slash-commands-extension.cjs +51 -0
  361. package/dist/chat-ui/composer/slash-commands-extension.cjs.map +1 -0
  362. package/dist/chat-ui/composer/slash-commands-extension.d.ts +39 -0
  363. package/dist/chat-ui/composer/slash-commands-extension.js +51 -0
  364. package/dist/chat-ui/composer/slash-commands-extension.js.map +1 -0
  365. package/dist/chat-ui/composer/slash-commands.cjs +74 -0
  366. package/dist/chat-ui/composer/slash-commands.cjs.map +1 -0
  367. package/dist/chat-ui/composer/slash-commands.d.ts +82 -0
  368. package/dist/chat-ui/composer/slash-commands.js +74 -0
  369. package/dist/chat-ui/composer/slash-commands.js.map +1 -0
  370. package/dist/chat-ui/composer/tiptap-composer.cjs +135 -9
  371. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
  372. package/dist/chat-ui/composer/tiptap-composer.d.ts +61 -2
  373. package/dist/chat-ui/composer/tiptap-composer.js +135 -9
  374. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
  375. package/dist/chat-ui/index.cjs +5 -0
  376. package/dist/chat-ui/index.cjs.map +1 -1
  377. package/dist/chat-ui/index.d.ts +4 -2
  378. package/dist/chat-ui/index.js +5 -0
  379. package/dist/chat-ui/index.js.map +1 -1
  380. package/dist/chat-ui/mentions/mention-chip.cjs +10 -4
  381. package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
  382. package/dist/chat-ui/mentions/mention-chip.js +11 -5
  383. package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
  384. package/dist/chat-ui/mentions/mention-extension.cjs +8 -1
  385. package/dist/chat-ui/mentions/mention-extension.cjs.map +1 -1
  386. package/dist/chat-ui/mentions/mention-extension.js +8 -1
  387. package/dist/chat-ui/mentions/mention-extension.js.map +1 -1
  388. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.cjs +1 -0
  389. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.cjs.map +1 -1
  390. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.js +1 -0
  391. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.js.map +1 -1
  392. package/dist/chat-ui/mentions/suggestions/components/mention-icon.cjs +20 -2
  393. package/dist/chat-ui/mentions/suggestions/components/mention-icon.cjs.map +1 -1
  394. package/dist/chat-ui/mentions/suggestions/components/mention-icon.d.ts +10 -1
  395. package/dist/chat-ui/mentions/suggestions/components/mention-icon.js +22 -4
  396. package/dist/chat-ui/mentions/suggestions/components/mention-icon.js.map +1 -1
  397. package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs +1 -1
  398. package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs.map +1 -1
  399. package/dist/chat-ui/mentions/suggestions/components/menu-item.js +1 -1
  400. package/dist/chat-ui/mentions/suggestions/components/menu-item.js.map +1 -1
  401. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +45 -0
  402. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
  403. package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +48 -0
  404. package/dist/chat-ui/mentions/suggestions/data/api-client.js +45 -0
  405. package/dist/chat-ui/mentions/suggestions/data/api-client.js.map +1 -1
  406. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icon-names.generated.cjs +89 -0
  407. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icon-names.generated.cjs.map +1 -0
  408. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icon-names.generated.d.ts +8 -0
  409. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icon-names.generated.js +89 -0
  410. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icon-names.generated.js.map +1 -0
  411. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs +140 -116
  412. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs.map +1 -1
  413. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.d.ts +46 -12
  414. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js +141 -117
  415. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js.map +1 -1
  416. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +272 -25
  417. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -1
  418. package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +88 -10
  419. package/dist/chat-ui/mentions/suggestions/data/sources/index.js +274 -27
  420. package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
  421. package/dist/chat-ui/mentions/suggestions/data/types.cjs.map +1 -1
  422. package/dist/chat-ui/mentions/suggestions/data/types.d.ts +27 -1
  423. package/dist/chat-ui/mentions/suggestions/data/types.js.map +1 -1
  424. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs +56 -5
  425. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs.map +1 -1
  426. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.d.ts +26 -6
  427. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js +57 -6
  428. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js.map +1 -1
  429. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.cjs +34 -17
  430. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.cjs.map +1 -1
  431. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.d.ts +19 -1
  432. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.js +35 -18
  433. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.js.map +1 -1
  434. package/dist/chat-ui/mentions/use-asset-icon-app-url.cjs +12 -0
  435. package/dist/chat-ui/mentions/use-asset-icon-app-url.cjs.map +1 -0
  436. package/dist/chat-ui/mentions/use-asset-icon-app-url.d.ts +8 -0
  437. package/dist/chat-ui/mentions/use-asset-icon-app-url.js +12 -0
  438. package/dist/chat-ui/mentions/use-asset-icon-app-url.js.map +1 -0
  439. package/dist/chat-ui/statewire.d.ts +1 -1
  440. package/dist/chat-ui/thread/statewire-history-edge.cjs +15 -0
  441. package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
  442. package/dist/chat-ui/thread/statewire-history-edge.d.ts +4 -1
  443. package/dist/chat-ui/thread/statewire-history-edge.js +15 -0
  444. package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
  445. package/dist/collab/client.cjs +41 -6
  446. package/dist/collab/client.cjs.map +1 -1
  447. package/dist/collab/client.d.ts +38 -7
  448. package/dist/collab/client.js +41 -6
  449. package/dist/collab/client.js.map +1 -1
  450. package/dist/composer/ComposerAttachedReferences.cjs +119 -0
  451. package/dist/composer/ComposerAttachedReferences.cjs.map +1 -0
  452. package/dist/composer/ComposerAttachedReferences.d.ts +26 -0
  453. package/dist/composer/ComposerAttachedReferences.js +119 -0
  454. package/dist/composer/ComposerAttachedReferences.js.map +1 -0
  455. package/dist/composer/ComposerNamedAgents.cjs +63 -0
  456. package/dist/composer/ComposerNamedAgents.cjs.map +1 -0
  457. package/dist/composer/ComposerNamedAgents.d.ts +16 -0
  458. package/dist/composer/ComposerNamedAgents.js +63 -0
  459. package/dist/composer/ComposerNamedAgents.js.map +1 -0
  460. package/dist/composer/attached-references.cjs +159 -0
  461. package/dist/composer/attached-references.cjs.map +1 -0
  462. package/dist/composer/attached-references.d.ts +86 -0
  463. package/dist/composer/attached-references.js +159 -0
  464. package/dist/composer/attached-references.js.map +1 -0
  465. package/dist/composer/build-composed-message.cjs +14 -7
  466. package/dist/composer/build-composed-message.cjs.map +1 -1
  467. package/dist/composer/build-composed-message.d.ts +6 -1
  468. package/dist/composer/build-composed-message.js +14 -7
  469. package/dist/composer/build-composed-message.js.map +1 -1
  470. package/dist/composer/composer-handoff.cjs +6 -2
  471. package/dist/composer/composer-handoff.cjs.map +1 -1
  472. package/dist/composer/composer-handoff.d.ts +7 -1
  473. package/dist/composer/composer-handoff.js +6 -2
  474. package/dist/composer/composer-handoff.js.map +1 -1
  475. package/dist/composer/folder-upload.cjs +149 -0
  476. package/dist/composer/folder-upload.cjs.map +1 -0
  477. package/dist/composer/folder-upload.d.ts +79 -0
  478. package/dist/composer/folder-upload.js +149 -0
  479. package/dist/composer/folder-upload.js.map +1 -0
  480. package/dist/composer/index.d.ts +1 -1
  481. package/dist/composer/staged-message-metadata.cjs +12 -0
  482. package/dist/composer/staged-message-metadata.cjs.map +1 -0
  483. package/dist/composer/staged-message-metadata.d.ts +15 -0
  484. package/dist/composer/staged-message-metadata.js +12 -0
  485. package/dist/composer/staged-message-metadata.js.map +1 -0
  486. package/dist/composer/useAttachToChat.cjs +35 -0
  487. package/dist/composer/useAttachToChat.cjs.map +1 -0
  488. package/dist/composer/useAttachToChat.d.ts +54 -0
  489. package/dist/composer/useAttachToChat.js +35 -0
  490. package/dist/composer/useAttachToChat.js.map +1 -0
  491. package/dist/composer/useAttachedReferencesComposerProps.cjs +19 -0
  492. package/dist/composer/useAttachedReferencesComposerProps.cjs.map +1 -0
  493. package/dist/composer/useAttachedReferencesComposerProps.d.ts +12 -0
  494. package/dist/composer/useAttachedReferencesComposerProps.js +19 -0
  495. package/dist/composer/useAttachedReferencesComposerProps.js.map +1 -0
  496. package/dist/composer/useFileUpload.cjs +95 -7
  497. package/dist/composer/useFileUpload.cjs.map +1 -1
  498. package/dist/composer/useFileUpload.d.ts +21 -2
  499. package/dist/composer/useFileUpload.js +95 -7
  500. package/dist/composer/useFileUpload.js.map +1 -1
  501. package/dist/data/athena-api-error.cjs +125 -0
  502. package/dist/data/athena-api-error.cjs.map +1 -0
  503. package/dist/data/athena-api-error.d.ts +96 -0
  504. package/dist/data/athena-api-error.js +125 -0
  505. package/dist/data/athena-api-error.js.map +1 -0
  506. package/dist/data/athena-data-client.cjs +106 -0
  507. package/dist/data/athena-data-client.cjs.map +1 -0
  508. package/dist/data/athena-data-client.d.ts +74 -0
  509. package/dist/data/athena-data-client.js +106 -0
  510. package/dist/data/athena-data-client.js.map +1 -0
  511. package/dist/data/athena-member.cjs +93 -0
  512. package/dist/data/athena-member.cjs.map +1 -0
  513. package/dist/data/athena-member.d.ts +125 -0
  514. package/dist/data/athena-member.js +93 -0
  515. package/dist/data/athena-member.js.map +1 -0
  516. package/dist/data/athena-request.cjs +460 -0
  517. package/dist/data/athena-request.cjs.map +1 -0
  518. package/dist/data/athena-request.d.ts +120 -0
  519. package/dist/data/athena-request.js +460 -0
  520. package/dist/data/athena-request.js.map +1 -0
  521. package/dist/data/use-athena-fetch.cjs +14 -0
  522. package/dist/data/use-athena-fetch.cjs.map +1 -0
  523. package/dist/data/use-athena-fetch.d.ts +19 -0
  524. package/dist/data/use-athena-fetch.js +14 -0
  525. package/dist/data/use-athena-fetch.js.map +1 -0
  526. package/dist/data/use-athena-graphql.cjs +66 -0
  527. package/dist/data/use-athena-graphql.cjs.map +1 -0
  528. package/dist/data/use-athena-graphql.d.ts +56 -0
  529. package/dist/data/use-athena-graphql.js +66 -0
  530. package/dist/data/use-athena-graphql.js.map +1 -0
  531. package/dist/data/use-athena-rest.cjs +33 -0
  532. package/dist/data/use-athena-rest.cjs.map +1 -0
  533. package/dist/data/use-athena-rest.d.ts +21 -0
  534. package/dist/data/use-athena-rest.js +33 -0
  535. package/dist/data/use-athena-rest.js.map +1 -0
  536. package/dist/data/use-semantic-query.cjs +44 -0
  537. package/dist/data/use-semantic-query.cjs.map +1 -0
  538. package/dist/data/use-semantic-query.d.ts +92 -0
  539. package/dist/data/use-semantic-query.js +44 -0
  540. package/dist/data/use-semantic-query.js.map +1 -0
  541. package/dist/diagnostics/athena-diagnostics.cjs.map +1 -1
  542. package/dist/diagnostics/athena-diagnostics.d.ts +5 -1
  543. package/dist/diagnostics/athena-diagnostics.js.map +1 -1
  544. package/dist/diagnostics/errors.cjs +7 -0
  545. package/dist/diagnostics/errors.cjs.map +1 -1
  546. package/dist/diagnostics/errors.d.ts +7 -0
  547. package/dist/diagnostics/errors.js +7 -0
  548. package/dist/diagnostics/errors.js.map +1 -1
  549. package/dist/index.cjs +155 -11
  550. package/dist/index.cjs.map +1 -1
  551. package/dist/index.d.ts +72 -13
  552. package/dist/index.js +148 -4
  553. package/dist/index.js.map +1 -1
  554. package/dist/keryx-http/src/initial-sync.cjs +64 -16
  555. package/dist/keryx-http/src/initial-sync.cjs.map +1 -1
  556. package/dist/keryx-http/src/initial-sync.d.ts +31 -1
  557. package/dist/keryx-http/src/initial-sync.js +64 -16
  558. package/dist/keryx-http/src/initial-sync.js.map +1 -1
  559. package/dist/keryx-http/src/own-awareness.cjs +20 -0
  560. package/dist/keryx-http/src/own-awareness.cjs.map +1 -0
  561. package/dist/keryx-http/src/own-awareness.d.ts +50 -0
  562. package/dist/keryx-http/src/own-awareness.js +20 -0
  563. package/dist/keryx-http/src/own-awareness.js.map +1 -0
  564. package/dist/keryx-http/src/update-attributions.cjs +26 -1
  565. package/dist/keryx-http/src/update-attributions.cjs.map +1 -1
  566. package/dist/keryx-http/src/update-attributions.d.ts +10 -1
  567. package/dist/keryx-http/src/update-attributions.js +26 -1
  568. package/dist/keryx-http/src/update-attributions.js.map +1 -1
  569. package/dist/offline/chat-outbox.cjs +262 -26
  570. package/dist/offline/chat-outbox.cjs.map +1 -1
  571. package/dist/offline/chat-outbox.d.ts +90 -12
  572. package/dist/offline/chat-outbox.js +263 -27
  573. package/dist/offline/chat-outbox.js.map +1 -1
  574. package/dist/provider/AthenaProvider.cjs +60 -22
  575. package/dist/provider/AthenaProvider.cjs.map +1 -1
  576. package/dist/provider/AthenaProvider.d.ts +24 -8
  577. package/dist/provider/AthenaProvider.js +61 -23
  578. package/dist/provider/AthenaProvider.js.map +1 -1
  579. package/dist/react/package.json.cjs +1 -1
  580. package/dist/react/package.json.js +1 -1
  581. package/dist/references/src/anchors/parse.cjs +11 -1
  582. package/dist/references/src/anchors/parse.cjs.map +1 -1
  583. package/dist/references/src/anchors/parse.js +11 -1
  584. package/dist/references/src/anchors/parse.js.map +1 -1
  585. package/dist/references/src/anchors/schemas.d.ts +1 -0
  586. package/dist/references/src/anchors/serialize.cjs +1 -0
  587. package/dist/references/src/anchors/serialize.cjs.map +1 -1
  588. package/dist/references/src/anchors/serialize.js +1 -0
  589. package/dist/references/src/anchors/serialize.js.map +1 -1
  590. package/dist/references/src/anchors/types.cjs +5 -0
  591. package/dist/references/src/anchors/types.cjs.map +1 -1
  592. package/dist/references/src/anchors/types.d.ts +9 -0
  593. package/dist/references/src/anchors/types.js +5 -0
  594. package/dist/references/src/anchors/types.js.map +1 -1
  595. package/dist/references/src/attachable.cjs +149 -0
  596. package/dist/references/src/attachable.cjs.map +1 -0
  597. package/dist/references/src/attachable.d.ts +87 -0
  598. package/dist/references/src/attachable.js +149 -0
  599. package/dist/references/src/attachable.js.map +1 -0
  600. package/dist/references/src/schemas.d.ts +2 -0
  601. package/dist/runtime/StatewirePlanModeLaneSync.cjs +93 -0
  602. package/dist/runtime/StatewirePlanModeLaneSync.cjs.map +1 -0
  603. package/dist/runtime/StatewirePlanModeLaneSync.d.ts +34 -0
  604. package/dist/runtime/StatewirePlanModeLaneSync.js +93 -0
  605. package/dist/runtime/StatewirePlanModeLaneSync.js.map +1 -0
  606. package/dist/runtime/StatewireThreadConfigLaneSync.cjs +2 -0
  607. package/dist/runtime/StatewireThreadConfigLaneSync.cjs.map +1 -1
  608. package/dist/runtime/StatewireThreadConfigLaneSync.d.ts +4 -0
  609. package/dist/runtime/StatewireThreadConfigLaneSync.js +2 -0
  610. package/dist/runtime/StatewireThreadConfigLaneSync.js.map +1 -1
  611. package/dist/runtime/statewire-plan-mode.cjs +71 -0
  612. package/dist/runtime/statewire-plan-mode.cjs.map +1 -0
  613. package/dist/runtime/statewire-plan-mode.d.ts +88 -0
  614. package/dist/runtime/statewire-plan-mode.js +71 -0
  615. package/dist/runtime/statewire-plan-mode.js.map +1 -0
  616. package/dist/runtime/statewire-run-config.cjs +3 -1
  617. package/dist/runtime/statewire-run-config.cjs.map +1 -1
  618. package/dist/runtime/statewire-run-config.d.ts +7 -0
  619. package/dist/runtime/statewire-run-config.js +3 -1
  620. package/dist/runtime/statewire-run-config.js.map +1 -1
  621. package/dist/runtime/statewire-session-key.cjs +11 -5
  622. package/dist/runtime/statewire-session-key.cjs.map +1 -1
  623. package/dist/runtime/statewire-session-key.d.ts +22 -10
  624. package/dist/runtime/statewire-session-key.js +11 -5
  625. package/dist/runtime/statewire-session-key.js.map +1 -1
  626. package/dist/runtime/useAthenaStatewireRuntime.cjs +64 -9
  627. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
  628. package/dist/runtime/useAthenaStatewireRuntime.d.ts +26 -10
  629. package/dist/runtime/useAthenaStatewireRuntime.js +66 -11
  630. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
  631. package/dist/search/useAthenaAssets.cjs +394 -0
  632. package/dist/search/useAthenaAssets.cjs.map +1 -0
  633. package/dist/search/useAthenaAssets.d.ts +186 -0
  634. package/dist/search/useAthenaAssets.js +394 -0
  635. package/dist/search/useAthenaAssets.js.map +1 -0
  636. package/dist/sheet-range/index.cjs +4 -0
  637. package/dist/sheet-range/index.cjs.map +1 -1
  638. package/dist/sheet-range/index.d.ts +4 -2
  639. package/dist/sheet-range/index.js +4 -0
  640. package/dist/sheet-range/index.js.map +1 -1
  641. package/dist/sheet-range/query-range.cjs +102 -0
  642. package/dist/sheet-range/query-range.cjs.map +1 -0
  643. package/dist/sheet-range/query-range.d.ts +46 -0
  644. package/dist/sheet-range/query-range.js +102 -0
  645. package/dist/sheet-range/query-range.js.map +1 -0
  646. package/dist/styles.css +1 -1
  647. package/dist/subagents/index.cjs +49 -0
  648. package/dist/subagents/index.cjs.map +1 -0
  649. package/dist/subagents/index.d.ts +16 -0
  650. package/dist/subagents/index.js +49 -0
  651. package/dist/subagents/index.js.map +1 -0
  652. package/dist/subagents/lane-follow.cjs +19 -0
  653. package/dist/subagents/lane-follow.cjs.map +1 -0
  654. package/dist/subagents/lane-follow.d.ts +9 -0
  655. package/dist/subagents/lane-follow.js +19 -0
  656. package/dist/subagents/lane-follow.js.map +1 -0
  657. package/dist/subagents/lane-model.cjs +178 -0
  658. package/dist/subagents/lane-model.cjs.map +1 -0
  659. package/dist/subagents/lane-model.d.ts +140 -0
  660. package/dist/subagents/lane-model.js +178 -0
  661. package/dist/subagents/lane-model.js.map +1 -0
  662. package/dist/subagents/lane-parts.cjs +517 -0
  663. package/dist/subagents/lane-parts.cjs.map +1 -0
  664. package/dist/subagents/lane-parts.d.ts +130 -0
  665. package/dist/subagents/lane-parts.js +517 -0
  666. package/dist/subagents/lane-parts.js.map +1 -0
  667. package/dist/subagents/subagent-lane-group.cjs +215 -0
  668. package/dist/subagents/subagent-lane-group.cjs.map +1 -0
  669. package/dist/subagents/subagent-lane-group.d.ts +67 -0
  670. package/dist/subagents/subagent-lane-group.js +215 -0
  671. package/dist/subagents/subagent-lane-group.js.map +1 -0
  672. package/dist/subagents/subagent-transcript-drawer.cjs +431 -0
  673. package/dist/subagents/subagent-transcript-drawer.cjs.map +1 -0
  674. package/dist/subagents/subagent-transcript-drawer.d.ts +78 -0
  675. package/dist/subagents/subagent-transcript-drawer.js +431 -0
  676. package/dist/subagents/subagent-transcript-drawer.js.map +1 -0
  677. package/dist/subagents/task-subagent-group.cjs +115 -0
  678. package/dist/subagents/task-subagent-group.cjs.map +1 -0
  679. package/dist/subagents/task-subagent-group.d.ts +36 -0
  680. package/dist/subagents/task-subagent-group.js +115 -0
  681. package/dist/subagents/task-subagent-group.js.map +1 -0
  682. package/dist/subagents/use-omitted-images-in-view.cjs +68 -0
  683. package/dist/subagents/use-omitted-images-in-view.cjs.map +1 -0
  684. package/dist/subagents/use-omitted-images-in-view.d.ts +21 -0
  685. package/dist/subagents/use-omitted-images-in-view.js +68 -0
  686. package/dist/subagents/use-omitted-images-in-view.js.map +1 -0
  687. package/dist/threads/Inbox.cjs +2 -2
  688. package/dist/threads/Inbox.cjs.map +1 -1
  689. package/dist/threads/SessionList.cjs +6 -6
  690. package/dist/threads/SessionList.cjs.map +1 -1
  691. package/dist/threads/SessionsPage.cjs +13 -7
  692. package/dist/threads/SessionsPage.cjs.map +1 -1
  693. package/dist/threads/SessionsPage.d.ts +10 -1
  694. package/dist/threads/SessionsPage.js +9 -3
  695. package/dist/threads/SessionsPage.js.map +1 -1
  696. package/dist/threads/session-list-model.cjs.map +1 -1
  697. package/dist/threads/session-list-model.d.ts +2 -1
  698. package/dist/threads/session-list-model.js.map +1 -1
  699. package/dist/threads/session-row-parts.cjs +3 -3
  700. package/dist/threads/session-row-parts.cjs.map +1 -1
  701. package/dist/threads/sessions-page-model.cjs +13 -5
  702. package/dist/threads/sessions-page-model.cjs.map +1 -1
  703. package/dist/threads/sessions-page-model.d.ts +7 -0
  704. package/dist/threads/sessions-page-model.js +11 -3
  705. package/dist/threads/sessions-page-model.js.map +1 -1
  706. package/dist/threads/sessions-page-storage.cjs +8 -8
  707. package/dist/threads/sessions-page-storage.cjs.map +1 -1
  708. package/dist/threads/sessions-page-storage.d.ts +5 -1
  709. package/dist/threads/sessions-page-storage.js +8 -8
  710. package/dist/threads/sessions-page-storage.js.map +1 -1
  711. package/dist/threads/statewire-thread-list.cjs +14 -2
  712. package/dist/threads/statewire-thread-list.cjs.map +1 -1
  713. package/dist/threads/statewire-thread-list.d.ts +11 -2
  714. package/dist/threads/statewire-thread-list.js +14 -2
  715. package/dist/threads/statewire-thread-list.js.map +1 -1
  716. package/dist/threads/use-athena-sessions.cjs +1 -0
  717. package/dist/threads/use-athena-sessions.cjs.map +1 -1
  718. package/dist/threads/use-athena-sessions.d.ts +7 -0
  719. package/dist/threads/use-athena-sessions.js +1 -0
  720. package/dist/threads/use-athena-sessions.js.map +1 -1
  721. package/dist/threads/use-athena-thread-agent.cjs +31 -0
  722. package/dist/threads/use-athena-thread-agent.cjs.map +1 -0
  723. package/dist/threads/use-athena-thread-agent.d.ts +38 -0
  724. package/dist/threads/use-athena-thread-agent.js +31 -0
  725. package/dist/threads/use-athena-thread-agent.js.map +1 -0
  726. package/dist/threads/use-athena-thread-plan-mode.cjs +18 -0
  727. package/dist/threads/use-athena-thread-plan-mode.cjs.map +1 -0
  728. package/dist/threads/use-athena-thread-plan-mode.d.ts +18 -0
  729. package/dist/threads/use-athena-thread-plan-mode.js +18 -0
  730. package/dist/threads/use-athena-thread-plan-mode.js.map +1 -0
  731. package/dist/threads/use-rest-conversation-history.d.ts +1 -0
  732. package/dist/tools/agent-creations.cjs +97 -0
  733. package/dist/tools/agent-creations.cjs.map +1 -0
  734. package/dist/tools/agent-creations.d.ts +38 -0
  735. package/dist/tools/agent-creations.js +97 -0
  736. package/dist/tools/agent-creations.js.map +1 -0
  737. package/dist/tools/agent-highlights.cjs +100 -0
  738. package/dist/tools/agent-highlights.cjs.map +1 -0
  739. package/dist/tools/agent-highlights.d.ts +57 -0
  740. package/dist/tools/agent-highlights.js +100 -0
  741. package/dist/tools/agent-highlights.js.map +1 -0
  742. package/dist/tools/append-document-tool-ui.cjs +1 -0
  743. package/dist/tools/append-document-tool-ui.cjs.map +1 -1
  744. package/dist/tools/append-document-tool-ui.d.ts +7 -0
  745. package/dist/tools/append-document-tool-ui.js +2 -1
  746. package/dist/tools/append-document-tool-ui.js.map +1 -1
  747. package/dist/tools/auto-open-tools.cjs +144 -71
  748. package/dist/tools/auto-open-tools.cjs.map +1 -1
  749. package/dist/tools/auto-open-tools.d.ts +131 -1
  750. package/dist/tools/auto-open-tools.js +145 -72
  751. package/dist/tools/auto-open-tools.js.map +1 -1
  752. package/dist/tools/browser-tool-uis.cjs +594 -0
  753. package/dist/tools/browser-tool-uis.cjs.map +1 -0
  754. package/dist/tools/browser-tool-uis.d.ts +8 -0
  755. package/dist/tools/browser-tool-uis.js +594 -0
  756. package/dist/tools/browser-tool-uis.js.map +1 -0
  757. package/dist/tools/computer-asset-tool-uis.cjs +313 -0
  758. package/dist/tools/computer-asset-tool-uis.cjs.map +1 -0
  759. package/dist/tools/computer-asset-tool-uis.d.ts +5 -0
  760. package/dist/tools/computer-asset-tool-uis.js +313 -0
  761. package/dist/tools/computer-asset-tool-uis.js.map +1 -0
  762. package/dist/tools/document-edit-tool-uis.cjs +218 -0
  763. package/dist/tools/document-edit-tool-uis.cjs.map +1 -0
  764. package/dist/tools/document-edit-tool-uis.d.ts +40 -0
  765. package/dist/tools/document-edit-tool-uis.js +218 -0
  766. package/dist/tools/document-edit-tool-uis.js.map +1 -0
  767. package/dist/tools/drive-tool-uis.cjs +429 -0
  768. package/dist/tools/drive-tool-uis.cjs.map +1 -0
  769. package/dist/tools/drive-tool-uis.d.ts +121 -0
  770. package/dist/tools/drive-tool-uis.js +429 -0
  771. package/dist/tools/drive-tool-uis.js.map +1 -0
  772. package/dist/tools/email-calendar-tool-uis.cjs +789 -0
  773. package/dist/tools/email-calendar-tool-uis.cjs.map +1 -0
  774. package/dist/tools/email-calendar-tool-uis.d.ts +129 -0
  775. package/dist/tools/email-calendar-tool-uis.js +789 -0
  776. package/dist/tools/email-calendar-tool-uis.js.map +1 -0
  777. package/dist/tools/ontology-tool-uis.cjs +83 -0
  778. package/dist/tools/ontology-tool-uis.cjs.map +1 -0
  779. package/dist/tools/ontology-tool-uis.d.ts +9 -0
  780. package/dist/tools/ontology-tool-uis.js +83 -0
  781. package/dist/tools/ontology-tool-uis.js.map +1 -0
  782. package/dist/tools/orchestration-tool-uis.cjs +586 -0
  783. package/dist/tools/orchestration-tool-uis.cjs.map +1 -0
  784. package/dist/tools/orchestration-tool-uis.d.ts +141 -0
  785. package/dist/tools/orchestration-tool-uis.js +586 -0
  786. package/dist/tools/orchestration-tool-uis.js.map +1 -0
  787. package/dist/tools/presentation-edit-tool-uis.cjs +516 -0
  788. package/dist/tools/presentation-edit-tool-uis.cjs.map +1 -0
  789. package/dist/tools/presentation-edit-tool-uis.d.ts +73 -0
  790. package/dist/tools/presentation-edit-tool-uis.js +516 -0
  791. package/dist/tools/presentation-edit-tool-uis.js.map +1 -0
  792. package/dist/tools/project-tool-uis.cjs +213 -0
  793. package/dist/tools/project-tool-uis.cjs.map +1 -0
  794. package/dist/tools/project-tool-uis.d.ts +14 -0
  795. package/dist/tools/project-tool-uis.js +213 -0
  796. package/dist/tools/project-tool-uis.js.map +1 -0
  797. package/dist/tools/sandbox-tool-uis.cjs +491 -0
  798. package/dist/tools/sandbox-tool-uis.cjs.map +1 -0
  799. package/dist/tools/sandbox-tool-uis.d.ts +116 -0
  800. package/dist/tools/sandbox-tool-uis.js +491 -0
  801. package/dist/tools/sandbox-tool-uis.js.map +1 -0
  802. package/dist/tools/sheet-query-tool-ui.cjs +138 -0
  803. package/dist/tools/sheet-query-tool-ui.cjs.map +1 -0
  804. package/dist/tools/sheet-query-tool-ui.d.ts +15 -0
  805. package/dist/tools/sheet-query-tool-ui.js +138 -0
  806. package/dist/tools/sheet-query-tool-ui.js.map +1 -0
  807. package/dist/tools/studio-screenshot-tool-uis.cjs +262 -0
  808. package/dist/tools/studio-screenshot-tool-uis.cjs.map +1 -0
  809. package/dist/tools/studio-screenshot-tool-uis.d.ts +52 -0
  810. package/dist/tools/studio-screenshot-tool-uis.js +262 -0
  811. package/dist/tools/studio-screenshot-tool-uis.js.map +1 -0
  812. package/dist/tools/subagent-task-tool-ui.cjs +24 -475
  813. package/dist/tools/subagent-task-tool-ui.cjs.map +1 -1
  814. package/dist/tools/subagent-task-tool-ui.d.ts +19 -103
  815. package/dist/tools/subagent-task-tool-ui.js +28 -479
  816. package/dist/tools/subagent-task-tool-ui.js.map +1 -1
  817. package/dist/tools/tool-summary.cjs +36 -0
  818. package/dist/tools/tool-summary.cjs.map +1 -1
  819. package/dist/tools/tool-summary.js +36 -0
  820. package/dist/tools/tool-summary.js.map +1 -1
  821. package/dist/tools/tool-uis.cjs +181 -53
  822. package/dist/tools/tool-uis.cjs.map +1 -1
  823. package/dist/tools/tool-uis.d.ts +40 -0
  824. package/dist/tools/tool-uis.js +183 -55
  825. package/dist/tools/tool-uis.js.map +1 -1
  826. package/dist/typed-interrupts/index.cjs +15 -0
  827. package/dist/typed-interrupts/index.cjs.map +1 -0
  828. package/dist/typed-interrupts/index.d.ts +20 -0
  829. package/dist/typed-interrupts/index.js +15 -0
  830. package/dist/typed-interrupts/index.js.map +1 -0
  831. package/dist/version.cjs +4 -0
  832. package/dist/version.cjs.map +1 -1
  833. package/dist/version.d.ts +9 -0
  834. package/dist/version.js +4 -0
  835. package/dist/version.js.map +1 -1
  836. package/dist/workbench/live-desktop-api.cjs +2 -1
  837. package/dist/workbench/live-desktop-api.cjs.map +1 -1
  838. package/dist/workbench/live-desktop-api.js +2 -1
  839. package/dist/workbench/live-desktop-api.js.map +1 -1
  840. package/dist/workbench/session-workbench-panes.cjs +6 -6
  841. package/dist/workbench/session-workbench-panes.cjs.map +1 -1
  842. package/dist/workbench/session-workspace-api.cjs +7 -2
  843. package/dist/workbench/session-workspace-api.cjs.map +1 -1
  844. package/dist/workbench/session-workspace-api.d.ts +10 -0
  845. package/dist/workbench/session-workspace-api.js +7 -2
  846. package/dist/workbench/session-workspace-api.js.map +1 -1
  847. package/package.json +28 -6
  848. package/dist/agent-runtime/src/chat-outbox-store.cjs +0 -510
  849. package/dist/agent-runtime/src/chat-outbox-store.cjs.map +0 -1
  850. package/dist/agent-runtime/src/chat-outbox-store.d.ts +0 -210
  851. package/dist/agent-runtime/src/chat-outbox-store.js +0 -510
  852. package/dist/agent-runtime/src/chat-outbox-store.js.map +0 -1
@@ -0,0 +1,289 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const store = require("@assistant-ui/store");
4
+ const require$$0 = require("react");
5
+ const runconfigContract = require("./generated/runconfig-contract.cjs");
6
+ const messageWindow = require("./message-window.cjs");
7
+ const protocol = require("./protocol.cjs");
8
+ const runningToolPlaceholder = require("./running-tool-placeholder.cjs");
9
+ const statewireTransport = require("./statewire-transport.cjs");
10
+ const threadExtras = require("./thread-extras.cjs");
11
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
12
+ const isCount = (value) => typeof value === "number" && Number.isInteger(value) && value >= 0;
13
+ const stepId = (step) => {
14
+ const id = isRecord(step) ? step.id : void 0;
15
+ return typeof id === "string" ? id : void 0;
16
+ };
17
+ function laneFollowRequest(cardId) {
18
+ return {
19
+ ns: runconfigContract.DEEP_AGENT_MAIN_NS,
20
+ before: 1,
21
+ at: cardId,
22
+ follow: { before: runconfigContract.DEEP_AGENT_MAX_FOLLOWED_STEPS }
23
+ };
24
+ }
25
+ function isLaneFollowRequest(request) {
26
+ return request.follow !== void 0 && request.at !== void 0;
27
+ }
28
+ const NO_FOLLOWS = { requests: [], lanes: /* @__PURE__ */ new Map() };
29
+ function followRequestOf(window) {
30
+ const { ns, before, at, follow, chain } = window;
31
+ if (ns !== runconfigContract.DEEP_AGENT_MAIN_NS || typeof at !== "string" || !isRecord(follow)) return null;
32
+ if (!Array.isArray(chain) || chain.length === 0) return null;
33
+ if (!isCount(before) || !isCount(follow.before)) return null;
34
+ return { ns: runconfigContract.DEEP_AGENT_MAIN_NS, before, at, follow: { before: follow.before } };
35
+ }
36
+ function readDeepAgentLaneFollows(mounted) {
37
+ var _a;
38
+ if (mounted === void 0) return NO_FOLLOWS;
39
+ let windows;
40
+ const steps = /* @__PURE__ */ new Map();
41
+ for (const document of mounted.values()) {
42
+ const key = document.key;
43
+ if (document.protocol === runconfigContract.DEEP_AGENT_INTEREST_PROTOCOL && document.main === true) {
44
+ const value = document.value;
45
+ if (isRecord(value) && Array.isArray(value.windows)) windows = value.windows;
46
+ continue;
47
+ }
48
+ if (document.protocol !== statewireTransport.DEEP_AGENT_STATEWIRE_PROTOCOL || key === null || key.length !== 3) {
49
+ continue;
50
+ }
51
+ const [, ns, id] = key;
52
+ if (typeof ns !== "string" || ns === runconfigContract.DEEP_AGENT_MAIN_NS || typeof id !== "string") continue;
53
+ let lane = steps.get(ns);
54
+ if (lane === void 0) {
55
+ lane = /* @__PURE__ */ new Map();
56
+ steps.set(ns, lane);
57
+ }
58
+ lane.set(id, document.value);
59
+ }
60
+ if (windows === void 0) return NO_FOLLOWS;
61
+ const requests = [];
62
+ const lanes = /* @__PURE__ */ new Map();
63
+ for (const window of windows) {
64
+ if (!isRecord(window)) continue;
65
+ const request = followRequestOf(window);
66
+ if (request !== null) requests.push(request);
67
+ if (!isRecord(window.follows)) continue;
68
+ for (const [ns, follow] of Object.entries(window.follows)) {
69
+ if (!isRecord(follow) || !Array.isArray(follow.chain)) continue;
70
+ const toolCallId = follow[runconfigContract.DEEP_AGENT_FOLLOW_TOOL_CALL_ID_KEY];
71
+ if (typeof toolCallId !== "string") continue;
72
+ const lane = steps.get(ns);
73
+ const ordered = [];
74
+ for (const entry of follow.chain) {
75
+ const id = stepId(entry);
76
+ const step = id === void 0 ? void 0 : lane == null ? void 0 : lane.get(id);
77
+ if (step !== void 0) ordered.push(step);
78
+ }
79
+ if (ordered.length > (((_a = lanes.get(toolCallId)) == null ? void 0 : _a.length) ?? 0)) lanes.set(toolCallId, ordered);
80
+ }
81
+ }
82
+ return requests.length === 0 && lanes.size === 0 ? NO_FOLLOWS : { requests, lanes };
83
+ }
84
+ function mergeFollowedLane(carried, followed, cutTurns = 0) {
85
+ const position = /* @__PURE__ */ new Map();
86
+ for (const [index, step] of followed.entries()) {
87
+ const id = stepId(step);
88
+ if (id !== void 0) position.set(id, index);
89
+ }
90
+ const newest = carried.slice(cutTurns);
91
+ const turns = carried.slice(0, cutTurns).filter((turn) => {
92
+ const id = stepId(turn);
93
+ return id === void 0 || !position.has(id);
94
+ });
95
+ let first = followed.length;
96
+ let last = -1;
97
+ for (const step of newest) {
98
+ const id = stepId(step);
99
+ const at = id === void 0 ? void 0 : position.get(id);
100
+ if (at === void 0) continue;
101
+ first = Math.min(first, at);
102
+ last = Math.max(last, at);
103
+ }
104
+ if (last < 0) {
105
+ return carried.length === 0 ? followed : [...turns, ...followed, ...newest];
106
+ }
107
+ return [...turns, ...followed.slice(0, first), ...newest, ...followed.slice(last + 1)];
108
+ }
109
+ function cutTurnsOf(message, carried) {
110
+ const marker = message[runconfigContract.DEEP_AGENT_TRUNCATED_LANE_KEY];
111
+ return isRecord(marker) ? Math.max(0, carried.length - runconfigContract.DEEP_AGENT_RUNNING_LANE_WIRE_MESSAGES) : 0;
112
+ }
113
+ const sameItems = (a, b) => a.length === b.length && a.every((item, index) => item === b[index]);
114
+ const followedCards = /* @__PURE__ */ new WeakMap();
115
+ function withFollowedLane(message, lanes) {
116
+ if (message.type !== "tool" || !runningToolPlaceholder.isRunningToolPlaceholder(message)) return message;
117
+ const steps = lanes.get(message.tool_call_id);
118
+ if (steps === void 0 || steps.length === 0) return message;
119
+ const kept = followedCards.get(message);
120
+ if (kept !== void 0 && sameItems(kept.steps, steps)) return kept.card;
121
+ const artifact = isRecord(message.artifact) ? message.artifact : {};
122
+ const state = isRecord(artifact.subgraph_state) ? artifact.subgraph_state : {};
123
+ const carried = Array.isArray(state.messages) ? state.messages : [];
124
+ const card = {
125
+ ...message,
126
+ artifact: {
127
+ ...artifact,
128
+ subgraph_state: {
129
+ ...state,
130
+ messages: mergeFollowedLane(carried, steps, cutTurnsOf(message, carried))
131
+ }
132
+ }
133
+ };
134
+ followedCards.set(message, { steps, card });
135
+ return card;
136
+ }
137
+ function readDeepAgentFollowedWindow(mounted) {
138
+ const window = messageWindow.readDeepAgentMessageWindow(mounted);
139
+ if (window === null) return null;
140
+ const follows = readDeepAgentLaneFollows(mounted);
141
+ if (follows === NO_FOLLOWS) return window;
142
+ return {
143
+ ...window,
144
+ requests: [...window.requests, ...follows.requests],
145
+ messages: follows.lanes.size === 0 ? window.messages : window.messages.map((message) => withFollowedLane(message, follows.lanes))
146
+ };
147
+ }
148
+ function createDeepAgentLaneFollowRegistry() {
149
+ const holds = /* @__PURE__ */ new Map();
150
+ const listeners = /* @__PURE__ */ new Set();
151
+ let snapshot = /* @__PURE__ */ new Set();
152
+ const publish = () => {
153
+ snapshot = new Set(holds.keys());
154
+ for (const listener of listeners) listener();
155
+ };
156
+ return {
157
+ follow(toolCallId) {
158
+ const held = holds.get(toolCallId) ?? 0;
159
+ holds.set(toolCallId, held + 1);
160
+ if (held === 0) publish();
161
+ let released = false;
162
+ return () => {
163
+ if (released) return;
164
+ released = true;
165
+ const left = (holds.get(toolCallId) ?? 1) - 1;
166
+ if (left > 0) {
167
+ holds.set(toolCallId, left);
168
+ return;
169
+ }
170
+ holds.delete(toolCallId);
171
+ publish();
172
+ };
173
+ },
174
+ subscribe(listener) {
175
+ listeners.add(listener);
176
+ return () => {
177
+ listeners.delete(listener);
178
+ };
179
+ },
180
+ getSnapshot: () => snapshot
181
+ };
182
+ }
183
+ function useDeepAgentLaneFollow(registry, toolCallId, active) {
184
+ require$$0.useEffect(() => {
185
+ if (registry === null || !active) return void 0;
186
+ return registry.follow(toolCallId);
187
+ }, [registry, toolCallId, active]);
188
+ }
189
+ function laneFollowRequestsFor(window, followed) {
190
+ if (followed.size === 0) return [];
191
+ const requests = [];
192
+ for (const message of window.messages) {
193
+ if (message.type !== "tool" || !followed.has(message.tool_call_id)) continue;
194
+ if (typeof message.id !== "string" || !runningToolPlaceholder.isRunningToolPlaceholder(message)) continue;
195
+ requests.push(laneFollowRequest(message.id));
196
+ }
197
+ return requests;
198
+ }
199
+ const followKey = (request) => {
200
+ var _a;
201
+ return `${request.at}:${(_a = request.follow) == null ? void 0 : _a.before}`;
202
+ };
203
+ const sameLaneFollows = (held, wanted) => held.length === wanted.length && wanted.every((request) => held.some((have) => followKey(have) === followKey(request)));
204
+ const rejectionCode = (error) => {
205
+ const failure = isRecord(error) ? error.failure : void 0;
206
+ return isRecord(failure) && failure.fate === "rejected" && typeof failure.code === "string" ? failure.code : void 0;
207
+ };
208
+ const noopSubscribe = () => () => {
209
+ };
210
+ function useDeepAgentLaneFollowSync({
211
+ registry,
212
+ paused = false,
213
+ onError
214
+ }) {
215
+ const { invoke, connection, documents } = store.useAuiState((s) => {
216
+ if (!threadExtras.hasStatewireThreadExtras(s.thread.extras)) {
217
+ throw new Error("useDeepAgentLaneFollowSync requires a statewire thread");
218
+ }
219
+ return s.thread.extras;
220
+ });
221
+ const hostVersion = store.useAuiState((s) => {
222
+ var _a;
223
+ const extras = s.thread.extras;
224
+ return ((_a = protocol.readDeepAgentProtocol(extras == null ? void 0 : extras.state)) == null ? void 0 : _a.version) ?? 0;
225
+ });
226
+ const mounted = require$$0.useSyncExternalStore(
227
+ (documents == null ? void 0 : documents.subscribe) ?? noopSubscribe,
228
+ () => documents == null ? void 0 : documents.list(),
229
+ () => documents == null ? void 0 : documents.list()
230
+ );
231
+ const window = require$$0.useMemo(() => readDeepAgentFollowedWindow(mounted), [mounted]);
232
+ const followed = require$$0.useSyncExternalStore(
233
+ registry.subscribe,
234
+ registry.getSnapshot,
235
+ registry.getSnapshot
236
+ );
237
+ const [settled, setSettled] = require$$0.useState(0);
238
+ const inflightRef = require$$0.useRef(false);
239
+ const aliveRef = require$$0.useRef(true);
240
+ const unservedRef = require$$0.useRef(null);
241
+ const lastStatedRef = require$$0.useRef(null);
242
+ const onErrorRef = require$$0.useRef(onError);
243
+ onErrorRef.current = onError;
244
+ require$$0.useEffect(() => {
245
+ aliveRef.current = true;
246
+ return () => {
247
+ aliveRef.current = false;
248
+ };
249
+ }, []);
250
+ require$$0.useEffect(() => {
251
+ if (window === null || paused || inflightRef.current) return;
252
+ if (connection.status !== "connected") return;
253
+ const served = hostVersion >= runconfigContract.DEEP_AGENT_LANE_FOLLOW_PROTOCOL_VERSION && unservedRef.current !== connection;
254
+ const others = window.requests.filter((request) => !isLaneFollowRequest(request));
255
+ const held = window.requests.filter(isLaneFollowRequest);
256
+ const wanted = served ? laneFollowRequestsFor(window, followed).slice(
257
+ 0,
258
+ Math.max(0, runconfigContract.DEEP_AGENT_MAX_INTERESTS - others.length)
259
+ ) : [];
260
+ if (sameLaneFollows(held, wanted)) return;
261
+ const requests = [...others, ...wanted];
262
+ const key = JSON.stringify(requests);
263
+ const last = lastStatedRef.current;
264
+ if (last !== null && last.connection === connection && last.key === key) return;
265
+ lastStatedRef.current = { connection, key };
266
+ inflightRef.current = true;
267
+ invoke(runconfigContract.DEEP_AGENT_INTEREST_PROTOCOL, "set", [requests]).catch((error) => {
268
+ var _a;
269
+ const code = rejectionCode(error);
270
+ if (code === "invalid-interest" && wanted.length > 0) {
271
+ unservedRef.current = connection;
272
+ return;
273
+ }
274
+ if (code !== "unknown-message") (_a = onErrorRef.current) == null ? void 0 : _a.call(onErrorRef, error);
275
+ }).finally(() => {
276
+ inflightRef.current = false;
277
+ if (aliveRef.current) setSettled((count) => count + 1);
278
+ });
279
+ }, [window, followed, hostVersion, connection, invoke, paused, settled]);
280
+ }
281
+ exports.createDeepAgentLaneFollowRegistry = createDeepAgentLaneFollowRegistry;
282
+ exports.isLaneFollowRequest = isLaneFollowRequest;
283
+ exports.laneFollowRequest = laneFollowRequest;
284
+ exports.mergeFollowedLane = mergeFollowedLane;
285
+ exports.readDeepAgentFollowedWindow = readDeepAgentFollowedWindow;
286
+ exports.readDeepAgentLaneFollows = readDeepAgentLaneFollows;
287
+ exports.useDeepAgentLaneFollow = useDeepAgentLaneFollow;
288
+ exports.useDeepAgentLaneFollowSync = useDeepAgentLaneFollowSync;
289
+ //# sourceMappingURL=lane-follow.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lane-follow.cjs","sources":["../../../../agent-runtime/src/lane-follow.ts"],"sourcesContent":["/**\n * Followed subagent lanes — the client half of agora's `follow` interest\n * (`message_window.follow_windows`).\n *\n * A running `task` card carries only its lane's newest steps (eight, with\n * `athena_lane_truncated` counting the rest). A request that adds\n * `follow: {before}` also covers the newest `before` steps of every lane a card\n * in its window names: the resolution gains `follows`\n * (`{ns: {chain, more, toolCallId}}`) and each step is its own `athena`\n * document, keyed `[threadId, ns, stepId]`.\n *\n * A lane is followed through a request anchored at its card alone\n * ({@link laneFollowRequest}), so following one lane pulls in no other and has\n * the attach's whole step allowance. {@link readDeepAgentFollowedWindow} reads\n * the followed steps back onto the card, so the card's tool-call part carries\n * the whole live lane as its nested thread; {@link useDeepAgentLaneFollowSync}\n * keeps the attach's follow requests to the running lanes a surface shows\n * ({@link createDeepAgentLaneFollowRegistry}). It follows only on a host whose\n * `protocol` lane advertises `DEEP_AGENT_LANE_FOLLOW_PROTOCOL_VERSION`; a host\n * that refuses `follow` anyway (`invalid-interest`, one predating it) keeps the\n * attach's windows, and the cards keep the steps their own documents carry.\n *\n * Surfaces opt in. A surface that follows nothing ships none of this and sees\n * the wire it saw before.\n */\nimport type { LangChainMessage } from '@assistant-ui/react-langgraph';\nimport type { StatewireThread } from '@assistant-ui/react-statewire';\nimport { useAuiState } from '@assistant-ui/store';\nimport { useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';\nimport {\n DEEP_AGENT_FOLLOW_TOOL_CALL_ID_KEY,\n DEEP_AGENT_INTEREST_PROTOCOL,\n DEEP_AGENT_LANE_FOLLOW_PROTOCOL_VERSION,\n DEEP_AGENT_MAIN_NS,\n DEEP_AGENT_MAX_FOLLOWED_STEPS,\n DEEP_AGENT_MAX_INTERESTS,\n DEEP_AGENT_RUNNING_LANE_WIRE_MESSAGES,\n DEEP_AGENT_TRUNCATED_LANE_KEY,\n} from './generated/runconfig-contract';\nimport {\n type DeepAgentInterestRequest,\n type DeepAgentMessageWindow,\n readDeepAgentMessageWindow,\n} from './message-window';\nimport { readDeepAgentProtocol } from './protocol';\nimport { isRunningToolPlaceholder } from './running-tool-placeholder';\nimport { DEEP_AGENT_STATEWIRE_PROTOCOL } from './statewire-transport';\nimport { hasStatewireThreadExtras } from './thread-extras';\n\ntype MountedDocuments = Parameters<typeof readDeepAgentMessageWindow>[0];\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\nconst isCount = (value: unknown): value is number =>\n typeof value === 'number' && Number.isInteger(value) && value >= 0;\n\nconst stepId = (step: unknown): string | undefined => {\n const id = isRecord(step) ? step.id : undefined;\n return typeof id === 'string' ? id : undefined;\n};\n\n/** A request following the lane one `task` card holds. */\nexport interface DeepAgentLaneFollowRequest extends DeepAgentInterestRequest {\n readonly at: string;\n readonly follow: { readonly before: number };\n}\n\n/**\n * The request following the lane of the running `task` card `cardId`: the card\n * alone (`before: 1`), so its window names no other card's lane, with as many\n * of its lane's newest steps as one attach follows.\n */\nexport function laneFollowRequest(cardId: string): DeepAgentLaneFollowRequest {\n return {\n ns: DEEP_AGENT_MAIN_NS,\n before: 1,\n at: cardId,\n follow: { before: DEEP_AGENT_MAX_FOLLOWED_STEPS },\n };\n}\n\nexport function isLaneFollowRequest(\n request: DeepAgentInterestRequest\n): request is DeepAgentLaneFollowRequest {\n return request.follow !== undefined && request.at !== undefined;\n}\n\n/** What an attach follows, read off its mounted documents. */\nexport interface DeepAgentLaneFollows {\n /** The follow requests the attach holds whose card is still in the transcript. */\n readonly requests: readonly DeepAgentLaneFollowRequest[];\n /** Each followed lane's mounted steps, oldest first, by the `task` call whose card holds it. */\n readonly lanes: ReadonlyMap<string, readonly LangChainMessage[]>;\n}\n\nconst NO_FOLLOWS: DeepAgentLaneFollows = { requests: [], lanes: new Map() };\n\n/**\n * A follow request as the host echoes it, or `null` for any other window. A\n * card that left the transcript (its result replaced the running placeholder)\n * leaves its window empty in place: there is nothing left to follow.\n */\nfunction followRequestOf(window: Record<string, unknown>): DeepAgentLaneFollowRequest | null {\n const { ns, before, at, follow, chain } = window;\n if (ns !== DEEP_AGENT_MAIN_NS || typeof at !== 'string' || !isRecord(follow)) return null;\n if (!Array.isArray(chain) || chain.length === 0) return null;\n if (!isCount(before) || !isCount(follow.before)) return null;\n return { ns: DEEP_AGENT_MAIN_NS, before, at, follow: { before: follow.before } };\n}\n\n/**\n * The attach's follow requests and followed lanes. A step whose document is\n * not mounted is left out; a lane two windows follow is read from the deeper\n * one. A malformed window or step reads as absent.\n */\nexport function readDeepAgentLaneFollows(mounted: MountedDocuments): DeepAgentLaneFollows {\n if (mounted === undefined) return NO_FOLLOWS;\n let windows: readonly unknown[] | undefined;\n const steps = new Map<string, Map<string, LangChainMessage>>();\n for (const document of mounted.values()) {\n const key = document.key;\n if (document.protocol === DEEP_AGENT_INTEREST_PROTOCOL && document.main === true) {\n const value = document.value;\n if (isRecord(value) && Array.isArray(value.windows)) windows = value.windows;\n continue;\n }\n if (document.protocol !== DEEP_AGENT_STATEWIRE_PROTOCOL || key === null || key.length !== 3) {\n continue;\n }\n const [, ns, id] = key;\n if (typeof ns !== 'string' || ns === DEEP_AGENT_MAIN_NS || typeof id !== 'string') continue;\n let lane = steps.get(ns);\n if (lane === undefined) {\n lane = new Map();\n steps.set(ns, lane);\n }\n lane.set(id, document.value as LangChainMessage);\n }\n if (windows === undefined) return NO_FOLLOWS;\n const requests: DeepAgentLaneFollowRequest[] = [];\n const lanes = new Map<string, readonly LangChainMessage[]>();\n for (const window of windows) {\n if (!isRecord(window)) continue;\n const request = followRequestOf(window);\n if (request !== null) requests.push(request);\n if (!isRecord(window.follows)) continue;\n for (const [ns, follow] of Object.entries(window.follows)) {\n if (!isRecord(follow) || !Array.isArray(follow.chain)) continue;\n const toolCallId = follow[DEEP_AGENT_FOLLOW_TOOL_CALL_ID_KEY];\n if (typeof toolCallId !== 'string') continue;\n const lane = steps.get(ns);\n const ordered: LangChainMessage[] = [];\n for (const entry of follow.chain) {\n const id = stepId(entry);\n const step = id === undefined ? undefined : lane?.get(id);\n if (step !== undefined) ordered.push(step);\n }\n if (ordered.length > (lanes.get(toolCallId)?.length ?? 0)) lanes.set(toolCallId, ordered);\n }\n }\n return requests.length === 0 && lanes.size === 0 ? NO_FOLLOWS : { requests, lanes };\n}\n\n/**\n * A running card's transcript with its followed lane read in. A cut card\n * carries its lane's newest steps whole, led by its first `cutTurns` entries:\n * the older assistant turns that requested results among them, cut to those\n * calls. The merge is the followed steps older than the card's newest, then\n * the card's newest steps, then any followed step newer than all of them. The\n * card's newest copies are the fuller ones (a lane step's document leaves every\n * inline image a placeholder), and only the card carries a step without an id,\n * which no follow addresses; the follow holds the cut turns whole, with the\n * steps between them and the newest, and a cut turn it does not hold leads.\n */\nexport function mergeFollowedLane(\n carried: readonly unknown[],\n followed: readonly LangChainMessage[],\n cutTurns = 0\n): readonly unknown[] {\n const position = new Map<string, number>();\n for (const [index, step] of followed.entries()) {\n const id = stepId(step);\n if (id !== undefined) position.set(id, index);\n }\n const newest = carried.slice(cutTurns);\n const turns = carried.slice(0, cutTurns).filter((turn) => {\n const id = stepId(turn);\n return id === undefined || !position.has(id);\n });\n let first = followed.length;\n let last = -1;\n for (const step of newest) {\n const id = stepId(step);\n const at = id === undefined ? undefined : position.get(id);\n if (at === undefined) continue;\n first = Math.min(first, at);\n last = Math.max(last, at);\n }\n if (last < 0) {\n return carried.length === 0 ? followed : [...turns, ...followed, ...newest];\n }\n return [...turns, ...followed.slice(0, first), ...newest, ...followed.slice(last + 1)];\n}\n\n/** How many of a running card's carried entries are cut assistant turns ahead of its newest steps. */\nfunction cutTurnsOf(message: LangChainMessage, carried: readonly unknown[]): number {\n const marker = (message as Record<string, unknown>)[DEEP_AGENT_TRUNCATED_LANE_KEY];\n return isRecord(marker) ? Math.max(0, carried.length - DEEP_AGENT_RUNNING_LANE_WIRE_MESSAGES) : 0;\n}\n\nconst sameItems = (a: readonly unknown[], b: readonly unknown[]): boolean =>\n a.length === b.length && a.every((item, index) => item === b[index]);\n\n/** Each card read with its followed lane, by the card object, while its steps stand. */\nconst followedCards = new WeakMap<\n object,\n { readonly steps: readonly LangChainMessage[]; readonly card: LangChainMessage }\n>();\n\nfunction withFollowedLane(\n message: LangChainMessage,\n lanes: ReadonlyMap<string, readonly LangChainMessage[]>\n): LangChainMessage {\n if (message.type !== 'tool' || !isRunningToolPlaceholder(message)) return message;\n const steps = lanes.get(message.tool_call_id);\n if (steps === undefined || steps.length === 0) return message;\n const kept = followedCards.get(message);\n if (kept !== undefined && sameItems(kept.steps, steps)) return kept.card;\n const artifact: Record<string, unknown> = isRecord(message.artifact) ? message.artifact : {};\n const state = isRecord(artifact.subgraph_state) ? artifact.subgraph_state : {};\n const carried: readonly unknown[] = Array.isArray(state.messages) ? state.messages : [];\n const card: LangChainMessage = {\n ...message,\n artifact: {\n ...artifact,\n subgraph_state: {\n ...state,\n messages: mergeFollowedLane(carried, steps, cutTurnsOf(message, carried)),\n },\n },\n };\n followedCards.set(message, { steps, card });\n return card;\n}\n\n/**\n * {@link readDeepAgentMessageWindow} with the attach's followed lanes read in.\n * The follow requests ride at the end of `requests`, so a restatement built\n * from this window (the thread's head widening, a page of older history) keeps\n * them: the joined view never counts them as pages. Each running card a follow\n * covers carries its lane's followed steps as its transcript, kept as the same\n * object while its steps stand. Without follows, the window is\n * {@link readDeepAgentMessageWindow}'s own.\n */\nexport function readDeepAgentFollowedWindow(\n mounted: MountedDocuments\n): DeepAgentMessageWindow | null {\n const window = readDeepAgentMessageWindow(mounted);\n if (window === null) return null;\n const follows = readDeepAgentLaneFollows(mounted);\n if (follows === NO_FOLLOWS) return window;\n return {\n ...window,\n requests: [...window.requests, ...follows.requests],\n messages:\n follows.lanes.size === 0\n ? window.messages\n : window.messages.map((message) => withFollowedLane(message, follows.lanes)),\n };\n}\n\n/**\n * The lanes a surface shows (an open transcript drawer's), by the `task` call\n * whose card holds each: what {@link useDeepAgentLaneFollowSync} follows.\n */\nexport interface DeepAgentLaneFollowRegistry {\n /** Follow the lane of the `task` call `toolCallId` until the returned release is called. */\n follow(toolCallId: string): () => void;\n subscribe(listener: () => void): () => void;\n /** The `task` calls whose lanes are followed; a new set on every change. */\n getSnapshot(): ReadonlySet<string>;\n}\n\nexport function createDeepAgentLaneFollowRegistry(): DeepAgentLaneFollowRegistry {\n const holds = new Map<string, number>();\n const listeners = new Set<() => void>();\n let snapshot: ReadonlySet<string> = new Set();\n const publish = () => {\n snapshot = new Set(holds.keys());\n for (const listener of listeners) listener();\n };\n return {\n follow(toolCallId) {\n const held = holds.get(toolCallId) ?? 0;\n holds.set(toolCallId, held + 1);\n if (held === 0) publish();\n let released = false;\n return () => {\n if (released) return;\n released = true;\n const left = (holds.get(toolCallId) ?? 1) - 1;\n if (left > 0) {\n holds.set(toolCallId, left);\n return;\n }\n holds.delete(toolCallId);\n publish();\n };\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n getSnapshot: () => snapshot,\n };\n}\n\n/** Follows the lane of `toolCallId` while `active` (a drawer open on a running lane). */\nexport function useDeepAgentLaneFollow(\n registry: DeepAgentLaneFollowRegistry | null,\n toolCallId: string,\n active: boolean\n): void {\n useEffect(() => {\n if (registry === null || !active) return undefined;\n return registry.follow(toolCallId);\n }, [registry, toolCallId, active]);\n}\n\n/** The follow requests for the running cards of the followed lanes, in transcript order. */\nfunction laneFollowRequestsFor(\n window: DeepAgentMessageWindow,\n followed: ReadonlySet<string>\n): DeepAgentLaneFollowRequest[] {\n if (followed.size === 0) return [];\n const requests: DeepAgentLaneFollowRequest[] = [];\n for (const message of window.messages) {\n if (message.type !== 'tool' || !followed.has(message.tool_call_id)) continue;\n if (typeof message.id !== 'string' || !isRunningToolPlaceholder(message)) continue;\n requests.push(laneFollowRequest(message.id));\n }\n return requests;\n}\n\nconst followKey = (request: DeepAgentInterestRequest): string =>\n `${request.at}:${request.follow?.before}`;\n\nconst sameLaneFollows = (\n held: readonly DeepAgentInterestRequest[],\n wanted: readonly DeepAgentInterestRequest[]\n): boolean =>\n held.length === wanted.length &&\n wanted.every((request) => held.some((have) => followKey(have) === followKey(request)));\n\n/** The code a host refused a statement with (`StatewireSendError.failure`), if any. */\nconst rejectionCode = (error: unknown): string | undefined => {\n const failure = isRecord(error) ? error.failure : undefined;\n return isRecord(failure) && failure.fate === 'rejected' && typeof failure.code === 'string'\n ? failure.code\n : undefined;\n};\n\nconst noopSubscribe = () => () => {};\n\nexport interface UseDeepAgentLaneFollowSyncOptions {\n /** The lanes the surface shows. */\n registry: DeepAgentLaneFollowRegistry;\n /**\n * Another statement on the interest lane is in flight (a page of older\n * history): wait for it, so neither statement drops what the other adds.\n */\n paused?: boolean;\n /**\n * A follow statement failed. A host that does not serve `follow` is not a\n * failure: the cards keep the lanes their own documents carry.\n */\n onError?: ((error: unknown) => void) | undefined;\n}\n\n/**\n * Keeps the attach's follow requests to the running lanes the registry holds,\n * once per change, on a host whose `protocol` lane advertises at least\n * `DEEP_AGENT_LANE_FOLLOW_PROTOCOL_VERSION`. A statement restates the\n * attach's other requests as the window holds them, with the follows after\n * them, inside the host's interest cap; a statement elsewhere that left a\n * follow out (a page of older history) is answered by stating it again.\n *\n * Never a retry loop: a statement is not sent again unchanged on the same\n * connection. A host that refuses `follow` (`invalid-interest`, one that\n * predates it) keeps the attach's windows, and nothing is followed on that\n * connection again; a card that left the transcript first (`unknown-message`)\n * is not followed until the transcript moves.\n */\nexport function useDeepAgentLaneFollowSync({\n registry,\n paused = false,\n onError,\n}: UseDeepAgentLaneFollowSyncOptions): void {\n const { invoke, connection, documents } = useAuiState((s) => {\n if (!hasStatewireThreadExtras(s.thread.extras)) {\n throw new Error('useDeepAgentLaneFollowSync requires a statewire thread');\n }\n return s.thread.extras as StatewireThread.Extras;\n });\n const hostVersion = useAuiState((s) => {\n const extras = s.thread.extras as Partial<StatewireThread.Extras> | undefined;\n return readDeepAgentProtocol(extras?.state)?.version ?? 0;\n });\n const mounted = useSyncExternalStore(\n documents?.subscribe ?? noopSubscribe,\n () => documents?.list(),\n () => documents?.list()\n );\n const window = useMemo(() => readDeepAgentFollowedWindow(mounted), [mounted]);\n const followed = useSyncExternalStore(\n registry.subscribe,\n registry.getSnapshot,\n registry.getSnapshot\n );\n const [settled, setSettled] = useState(0);\n const inflightRef = useRef(false);\n const aliveRef = useRef(true);\n // The connection whose host refused `follow`, and the last statement sent on a connection.\n const unservedRef = useRef<unknown>(null);\n const lastStatedRef = useRef<{ connection: unknown; key: string } | null>(null);\n const onErrorRef = useRef(onError);\n onErrorRef.current = onError;\n\n useEffect(() => {\n aliveRef.current = true;\n return () => {\n aliveRef.current = false;\n };\n }, []);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: `settled` re-runs the check once a statement settles.\n useEffect(() => {\n if (window === null || paused || inflightRef.current) return;\n if (connection.status !== 'connected') return;\n const served =\n hostVersion >= DEEP_AGENT_LANE_FOLLOW_PROTOCOL_VERSION && unservedRef.current !== connection;\n const others = window.requests.filter((request) => !isLaneFollowRequest(request));\n const held = window.requests.filter(isLaneFollowRequest);\n const wanted = served\n ? laneFollowRequestsFor(window, followed).slice(\n 0,\n Math.max(0, DEEP_AGENT_MAX_INTERESTS - others.length)\n )\n : [];\n if (sameLaneFollows(held, wanted)) return;\n const requests = [...others, ...wanted];\n const key = JSON.stringify(requests);\n const last = lastStatedRef.current;\n if (last !== null && last.connection === connection && last.key === key) return;\n lastStatedRef.current = { connection, key };\n inflightRef.current = true;\n invoke(DEEP_AGENT_INTEREST_PROTOCOL, 'set', [requests])\n .catch((error: unknown) => {\n const code = rejectionCode(error);\n if (code === 'invalid-interest' && wanted.length > 0) {\n unservedRef.current = connection;\n return;\n }\n if (code !== 'unknown-message') onErrorRef.current?.(error);\n })\n .finally(() => {\n inflightRef.current = false;\n if (aliveRef.current) setSettled((count) => count + 1);\n });\n }, [window, followed, hostVersion, connection, invoke, paused, settled]);\n}\n"],"names":["DEEP_AGENT_MAIN_NS","DEEP_AGENT_MAX_FOLLOWED_STEPS","DEEP_AGENT_INTEREST_PROTOCOL","DEEP_AGENT_STATEWIRE_PROTOCOL","DEEP_AGENT_FOLLOW_TOOL_CALL_ID_KEY","DEEP_AGENT_TRUNCATED_LANE_KEY","DEEP_AGENT_RUNNING_LANE_WIRE_MESSAGES","isRunningToolPlaceholder","readDeepAgentMessageWindow","useEffect","useAuiState","hasStatewireThreadExtras","readDeepAgentProtocol","useSyncExternalStore","useMemo","useState","useRef","DEEP_AGENT_LANE_FOLLOW_PROTOCOL_VERSION","DEEP_AGENT_MAX_INTERESTS"],"mappings":";;;;;;;;;;AAmDA,MAAM,WAAW,CAAC,UAChB,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,MAAM,UAAU,CAAC,UACf,OAAO,UAAU,YAAY,OAAO,UAAU,KAAK,KAAK,SAAS;AAEnE,MAAM,SAAS,CAAC,SAAsC;AACpD,QAAM,KAAK,SAAS,I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;AAAA,IACvD,CAAC;AAAA,EACL,GAAG,CAAC,QAAQ,UAAU,aAAa,YAAY,QAAQ,QAAQ,OAAO,CAAC;AACzE;;;;;;;;;"}
@@ -0,0 +1,289 @@
1
+ import { useAuiState } from "@assistant-ui/store";
2
+ import { useSyncExternalStore, useMemo, useState, useRef, useEffect } from "react";
3
+ import { DEEP_AGENT_LANE_FOLLOW_PROTOCOL_VERSION, DEEP_AGENT_MAX_INTERESTS, DEEP_AGENT_INTEREST_PROTOCOL, DEEP_AGENT_MAIN_NS, DEEP_AGENT_FOLLOW_TOOL_CALL_ID_KEY, DEEP_AGENT_MAX_FOLLOWED_STEPS, DEEP_AGENT_TRUNCATED_LANE_KEY, DEEP_AGENT_RUNNING_LANE_WIRE_MESSAGES } from "./generated/runconfig-contract.js";
4
+ import { readDeepAgentMessageWindow } from "./message-window.js";
5
+ import { readDeepAgentProtocol } from "./protocol.js";
6
+ import { isRunningToolPlaceholder } from "./running-tool-placeholder.js";
7
+ import { DEEP_AGENT_STATEWIRE_PROTOCOL } from "./statewire-transport.js";
8
+ import { hasStatewireThreadExtras } from "./thread-extras.js";
9
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
10
+ const isCount = (value) => typeof value === "number" && Number.isInteger(value) && value >= 0;
11
+ const stepId = (step) => {
12
+ const id = isRecord(step) ? step.id : void 0;
13
+ return typeof id === "string" ? id : void 0;
14
+ };
15
+ function laneFollowRequest(cardId) {
16
+ return {
17
+ ns: DEEP_AGENT_MAIN_NS,
18
+ before: 1,
19
+ at: cardId,
20
+ follow: { before: DEEP_AGENT_MAX_FOLLOWED_STEPS }
21
+ };
22
+ }
23
+ function isLaneFollowRequest(request) {
24
+ return request.follow !== void 0 && request.at !== void 0;
25
+ }
26
+ const NO_FOLLOWS = { requests: [], lanes: /* @__PURE__ */ new Map() };
27
+ function followRequestOf(window) {
28
+ const { ns, before, at, follow, chain } = window;
29
+ if (ns !== DEEP_AGENT_MAIN_NS || typeof at !== "string" || !isRecord(follow)) return null;
30
+ if (!Array.isArray(chain) || chain.length === 0) return null;
31
+ if (!isCount(before) || !isCount(follow.before)) return null;
32
+ return { ns: DEEP_AGENT_MAIN_NS, before, at, follow: { before: follow.before } };
33
+ }
34
+ function readDeepAgentLaneFollows(mounted) {
35
+ var _a;
36
+ if (mounted === void 0) return NO_FOLLOWS;
37
+ let windows;
38
+ const steps = /* @__PURE__ */ new Map();
39
+ for (const document of mounted.values()) {
40
+ const key = document.key;
41
+ if (document.protocol === DEEP_AGENT_INTEREST_PROTOCOL && document.main === true) {
42
+ const value = document.value;
43
+ if (isRecord(value) && Array.isArray(value.windows)) windows = value.windows;
44
+ continue;
45
+ }
46
+ if (document.protocol !== DEEP_AGENT_STATEWIRE_PROTOCOL || key === null || key.length !== 3) {
47
+ continue;
48
+ }
49
+ const [, ns, id] = key;
50
+ if (typeof ns !== "string" || ns === DEEP_AGENT_MAIN_NS || typeof id !== "string") continue;
51
+ let lane = steps.get(ns);
52
+ if (lane === void 0) {
53
+ lane = /* @__PURE__ */ new Map();
54
+ steps.set(ns, lane);
55
+ }
56
+ lane.set(id, document.value);
57
+ }
58
+ if (windows === void 0) return NO_FOLLOWS;
59
+ const requests = [];
60
+ const lanes = /* @__PURE__ */ new Map();
61
+ for (const window of windows) {
62
+ if (!isRecord(window)) continue;
63
+ const request = followRequestOf(window);
64
+ if (request !== null) requests.push(request);
65
+ if (!isRecord(window.follows)) continue;
66
+ for (const [ns, follow] of Object.entries(window.follows)) {
67
+ if (!isRecord(follow) || !Array.isArray(follow.chain)) continue;
68
+ const toolCallId = follow[DEEP_AGENT_FOLLOW_TOOL_CALL_ID_KEY];
69
+ if (typeof toolCallId !== "string") continue;
70
+ const lane = steps.get(ns);
71
+ const ordered = [];
72
+ for (const entry of follow.chain) {
73
+ const id = stepId(entry);
74
+ const step = id === void 0 ? void 0 : lane == null ? void 0 : lane.get(id);
75
+ if (step !== void 0) ordered.push(step);
76
+ }
77
+ if (ordered.length > (((_a = lanes.get(toolCallId)) == null ? void 0 : _a.length) ?? 0)) lanes.set(toolCallId, ordered);
78
+ }
79
+ }
80
+ return requests.length === 0 && lanes.size === 0 ? NO_FOLLOWS : { requests, lanes };
81
+ }
82
+ function mergeFollowedLane(carried, followed, cutTurns = 0) {
83
+ const position = /* @__PURE__ */ new Map();
84
+ for (const [index, step] of followed.entries()) {
85
+ const id = stepId(step);
86
+ if (id !== void 0) position.set(id, index);
87
+ }
88
+ const newest = carried.slice(cutTurns);
89
+ const turns = carried.slice(0, cutTurns).filter((turn) => {
90
+ const id = stepId(turn);
91
+ return id === void 0 || !position.has(id);
92
+ });
93
+ let first = followed.length;
94
+ let last = -1;
95
+ for (const step of newest) {
96
+ const id = stepId(step);
97
+ const at = id === void 0 ? void 0 : position.get(id);
98
+ if (at === void 0) continue;
99
+ first = Math.min(first, at);
100
+ last = Math.max(last, at);
101
+ }
102
+ if (last < 0) {
103
+ return carried.length === 0 ? followed : [...turns, ...followed, ...newest];
104
+ }
105
+ return [...turns, ...followed.slice(0, first), ...newest, ...followed.slice(last + 1)];
106
+ }
107
+ function cutTurnsOf(message, carried) {
108
+ const marker = message[DEEP_AGENT_TRUNCATED_LANE_KEY];
109
+ return isRecord(marker) ? Math.max(0, carried.length - DEEP_AGENT_RUNNING_LANE_WIRE_MESSAGES) : 0;
110
+ }
111
+ const sameItems = (a, b) => a.length === b.length && a.every((item, index) => item === b[index]);
112
+ const followedCards = /* @__PURE__ */ new WeakMap();
113
+ function withFollowedLane(message, lanes) {
114
+ if (message.type !== "tool" || !isRunningToolPlaceholder(message)) return message;
115
+ const steps = lanes.get(message.tool_call_id);
116
+ if (steps === void 0 || steps.length === 0) return message;
117
+ const kept = followedCards.get(message);
118
+ if (kept !== void 0 && sameItems(kept.steps, steps)) return kept.card;
119
+ const artifact = isRecord(message.artifact) ? message.artifact : {};
120
+ const state = isRecord(artifact.subgraph_state) ? artifact.subgraph_state : {};
121
+ const carried = Array.isArray(state.messages) ? state.messages : [];
122
+ const card = {
123
+ ...message,
124
+ artifact: {
125
+ ...artifact,
126
+ subgraph_state: {
127
+ ...state,
128
+ messages: mergeFollowedLane(carried, steps, cutTurnsOf(message, carried))
129
+ }
130
+ }
131
+ };
132
+ followedCards.set(message, { steps, card });
133
+ return card;
134
+ }
135
+ function readDeepAgentFollowedWindow(mounted) {
136
+ const window = readDeepAgentMessageWindow(mounted);
137
+ if (window === null) return null;
138
+ const follows = readDeepAgentLaneFollows(mounted);
139
+ if (follows === NO_FOLLOWS) return window;
140
+ return {
141
+ ...window,
142
+ requests: [...window.requests, ...follows.requests],
143
+ messages: follows.lanes.size === 0 ? window.messages : window.messages.map((message) => withFollowedLane(message, follows.lanes))
144
+ };
145
+ }
146
+ function createDeepAgentLaneFollowRegistry() {
147
+ const holds = /* @__PURE__ */ new Map();
148
+ const listeners = /* @__PURE__ */ new Set();
149
+ let snapshot = /* @__PURE__ */ new Set();
150
+ const publish = () => {
151
+ snapshot = new Set(holds.keys());
152
+ for (const listener of listeners) listener();
153
+ };
154
+ return {
155
+ follow(toolCallId) {
156
+ const held = holds.get(toolCallId) ?? 0;
157
+ holds.set(toolCallId, held + 1);
158
+ if (held === 0) publish();
159
+ let released = false;
160
+ return () => {
161
+ if (released) return;
162
+ released = true;
163
+ const left = (holds.get(toolCallId) ?? 1) - 1;
164
+ if (left > 0) {
165
+ holds.set(toolCallId, left);
166
+ return;
167
+ }
168
+ holds.delete(toolCallId);
169
+ publish();
170
+ };
171
+ },
172
+ subscribe(listener) {
173
+ listeners.add(listener);
174
+ return () => {
175
+ listeners.delete(listener);
176
+ };
177
+ },
178
+ getSnapshot: () => snapshot
179
+ };
180
+ }
181
+ function useDeepAgentLaneFollow(registry, toolCallId, active) {
182
+ useEffect(() => {
183
+ if (registry === null || !active) return void 0;
184
+ return registry.follow(toolCallId);
185
+ }, [registry, toolCallId, active]);
186
+ }
187
+ function laneFollowRequestsFor(window, followed) {
188
+ if (followed.size === 0) return [];
189
+ const requests = [];
190
+ for (const message of window.messages) {
191
+ if (message.type !== "tool" || !followed.has(message.tool_call_id)) continue;
192
+ if (typeof message.id !== "string" || !isRunningToolPlaceholder(message)) continue;
193
+ requests.push(laneFollowRequest(message.id));
194
+ }
195
+ return requests;
196
+ }
197
+ const followKey = (request) => {
198
+ var _a;
199
+ return `${request.at}:${(_a = request.follow) == null ? void 0 : _a.before}`;
200
+ };
201
+ const sameLaneFollows = (held, wanted) => held.length === wanted.length && wanted.every((request) => held.some((have) => followKey(have) === followKey(request)));
202
+ const rejectionCode = (error) => {
203
+ const failure = isRecord(error) ? error.failure : void 0;
204
+ return isRecord(failure) && failure.fate === "rejected" && typeof failure.code === "string" ? failure.code : void 0;
205
+ };
206
+ const noopSubscribe = () => () => {
207
+ };
208
+ function useDeepAgentLaneFollowSync({
209
+ registry,
210
+ paused = false,
211
+ onError
212
+ }) {
213
+ const { invoke, connection, documents } = useAuiState((s) => {
214
+ if (!hasStatewireThreadExtras(s.thread.extras)) {
215
+ throw new Error("useDeepAgentLaneFollowSync requires a statewire thread");
216
+ }
217
+ return s.thread.extras;
218
+ });
219
+ const hostVersion = useAuiState((s) => {
220
+ var _a;
221
+ const extras = s.thread.extras;
222
+ return ((_a = readDeepAgentProtocol(extras == null ? void 0 : extras.state)) == null ? void 0 : _a.version) ?? 0;
223
+ });
224
+ const mounted = useSyncExternalStore(
225
+ (documents == null ? void 0 : documents.subscribe) ?? noopSubscribe,
226
+ () => documents == null ? void 0 : documents.list(),
227
+ () => documents == null ? void 0 : documents.list()
228
+ );
229
+ const window = useMemo(() => readDeepAgentFollowedWindow(mounted), [mounted]);
230
+ const followed = useSyncExternalStore(
231
+ registry.subscribe,
232
+ registry.getSnapshot,
233
+ registry.getSnapshot
234
+ );
235
+ const [settled, setSettled] = useState(0);
236
+ const inflightRef = useRef(false);
237
+ const aliveRef = useRef(true);
238
+ const unservedRef = useRef(null);
239
+ const lastStatedRef = useRef(null);
240
+ const onErrorRef = useRef(onError);
241
+ onErrorRef.current = onError;
242
+ useEffect(() => {
243
+ aliveRef.current = true;
244
+ return () => {
245
+ aliveRef.current = false;
246
+ };
247
+ }, []);
248
+ useEffect(() => {
249
+ if (window === null || paused || inflightRef.current) return;
250
+ if (connection.status !== "connected") return;
251
+ const served = hostVersion >= DEEP_AGENT_LANE_FOLLOW_PROTOCOL_VERSION && unservedRef.current !== connection;
252
+ const others = window.requests.filter((request) => !isLaneFollowRequest(request));
253
+ const held = window.requests.filter(isLaneFollowRequest);
254
+ const wanted = served ? laneFollowRequestsFor(window, followed).slice(
255
+ 0,
256
+ Math.max(0, DEEP_AGENT_MAX_INTERESTS - others.length)
257
+ ) : [];
258
+ if (sameLaneFollows(held, wanted)) return;
259
+ const requests = [...others, ...wanted];
260
+ const key = JSON.stringify(requests);
261
+ const last = lastStatedRef.current;
262
+ if (last !== null && last.connection === connection && last.key === key) return;
263
+ lastStatedRef.current = { connection, key };
264
+ inflightRef.current = true;
265
+ invoke(DEEP_AGENT_INTEREST_PROTOCOL, "set", [requests]).catch((error) => {
266
+ var _a;
267
+ const code = rejectionCode(error);
268
+ if (code === "invalid-interest" && wanted.length > 0) {
269
+ unservedRef.current = connection;
270
+ return;
271
+ }
272
+ if (code !== "unknown-message") (_a = onErrorRef.current) == null ? void 0 : _a.call(onErrorRef, error);
273
+ }).finally(() => {
274
+ inflightRef.current = false;
275
+ if (aliveRef.current) setSettled((count) => count + 1);
276
+ });
277
+ }, [window, followed, hostVersion, connection, invoke, paused, settled]);
278
+ }
279
+ export {
280
+ createDeepAgentLaneFollowRegistry,
281
+ isLaneFollowRequest,
282
+ laneFollowRequest,
283
+ mergeFollowedLane,
284
+ readDeepAgentFollowedWindow,
285
+ readDeepAgentLaneFollows,
286
+ useDeepAgentLaneFollow,
287
+ useDeepAgentLaneFollowSync
288
+ };
289
+ //# sourceMappingURL=lane-follow.js.map