@athenaintel/react 0.41.3 → 0.42.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (439) hide show
  1. package/README.md +102 -9
  2. package/dist/agent-runtime/src/asset-attachment.d.ts +98 -0
  3. package/dist/agent-runtime/src/athena-asset-drag.d.ts +32 -0
  4. package/dist/agent-runtime/src/auth-denial.d.ts +29 -0
  5. package/dist/agent-runtime/src/chat-outbox-attachments.cjs +41 -0
  6. package/dist/agent-runtime/src/chat-outbox-attachments.cjs.map +1 -0
  7. package/dist/agent-runtime/src/chat-outbox-attachments.d.ts +38 -0
  8. package/dist/agent-runtime/src/chat-outbox-attachments.js +41 -0
  9. package/dist/agent-runtime/src/chat-outbox-attachments.js.map +1 -0
  10. package/dist/agent-runtime/src/chat-outbox-signals.cjs +63 -0
  11. package/dist/agent-runtime/src/chat-outbox-signals.cjs.map +1 -0
  12. package/dist/agent-runtime/src/chat-outbox-signals.d.ts +12 -0
  13. package/dist/agent-runtime/src/chat-outbox-signals.js +63 -0
  14. package/dist/agent-runtime/src/chat-outbox-signals.js.map +1 -0
  15. package/dist/agent-runtime/src/chat-outbox-store.cjs +509 -0
  16. package/dist/agent-runtime/src/chat-outbox-store.cjs.map +1 -0
  17. package/dist/agent-runtime/src/chat-outbox-store.d.ts +203 -0
  18. package/dist/agent-runtime/src/chat-outbox-store.js +509 -0
  19. package/dist/agent-runtime/src/chat-outbox-store.js.map +1 -0
  20. package/dist/agent-runtime/src/chat-outbox-thread.cjs +136 -0
  21. package/dist/agent-runtime/src/chat-outbox-thread.cjs.map +1 -0
  22. package/dist/agent-runtime/src/chat-outbox-thread.d.ts +118 -0
  23. package/dist/agent-runtime/src/chat-outbox-thread.js +136 -0
  24. package/dist/agent-runtime/src/chat-outbox-thread.js.map +1 -0
  25. package/dist/agent-runtime/src/chat-outbox.cjs +696 -0
  26. package/dist/agent-runtime/src/chat-outbox.cjs.map +1 -0
  27. package/dist/agent-runtime/src/chat-outbox.d.ts +285 -0
  28. package/dist/agent-runtime/src/chat-outbox.js +696 -0
  29. package/dist/agent-runtime/src/chat-outbox.js.map +1 -0
  30. package/dist/agent-runtime/src/chat-socket-reachability.d.ts +45 -0
  31. package/dist/agent-runtime/src/client-tool-bridge.d.ts +152 -0
  32. package/dist/agent-runtime/src/client-tools.d.ts +133 -0
  33. package/dist/agent-runtime/src/composer-markdown.cjs +10 -0
  34. package/dist/agent-runtime/src/composer-markdown.cjs.map +1 -1
  35. package/dist/agent-runtime/src/composer-markdown.d.ts +108 -0
  36. package/dist/agent-runtime/src/composer-markdown.js +10 -0
  37. package/dist/agent-runtime/src/composer-markdown.js.map +1 -1
  38. package/dist/agent-runtime/src/config-mutations.d.ts +51 -0
  39. package/dist/agent-runtime/src/conversation-index.d.ts +110 -0
  40. package/dist/agent-runtime/src/conversation-list.d.ts +343 -0
  41. package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs +3 -2
  42. package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -1
  43. package/dist/agent-runtime/src/deep-agent-transport-recipe.d.ts +166 -0
  44. package/dist/agent-runtime/src/deep-agent-transport-recipe.js +3 -2
  45. package/dist/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -1
  46. package/dist/agent-runtime/src/desktop-handoff.d.ts +139 -0
  47. package/dist/agent-runtime/src/durable-thread-snapshot-cache.d.ts +60 -0
  48. package/dist/agent-runtime/src/edit-command.d.ts +156 -0
  49. package/dist/agent-runtime/src/errors.d.ts +174 -0
  50. package/dist/agent-runtime/src/execute-output.d.ts +31 -0
  51. package/dist/agent-runtime/src/generated/runconfig-contract.cjs +16 -2
  52. package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
  53. package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +202 -0
  54. package/dist/agent-runtime/src/generated/runconfig-contract.js +16 -2
  55. package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
  56. package/dist/agent-runtime/src/github-wake-event.d.ts +77 -0
  57. package/dist/agent-runtime/src/index.d.ts +74 -0
  58. package/dist/agent-runtime/src/interrupts.cjs +17 -0
  59. package/dist/agent-runtime/src/interrupts.cjs.map +1 -1
  60. package/dist/agent-runtime/src/interrupts.d.ts +348 -0
  61. package/dist/agent-runtime/src/interrupts.js +17 -0
  62. package/dist/agent-runtime/src/interrupts.js.map +1 -1
  63. package/dist/agent-runtime/src/lane-follow.d.ts +121 -0
  64. package/dist/agent-runtime/src/lane-history.cjs +209 -0
  65. package/dist/agent-runtime/src/lane-history.cjs.map +1 -0
  66. package/dist/agent-runtime/src/lane-history.d.ts +175 -0
  67. package/dist/agent-runtime/src/lane-history.js +209 -0
  68. package/dist/agent-runtime/src/lane-history.js.map +1 -0
  69. package/dist/agent-runtime/src/lane-images.d.ts +184 -0
  70. package/dist/agent-runtime/src/message-author.d.ts +43 -0
  71. package/dist/agent-runtime/src/message-text.cjs +15 -0
  72. package/dist/agent-runtime/src/message-text.cjs.map +1 -0
  73. package/dist/agent-runtime/src/message-text.d.ts +47 -0
  74. package/dist/agent-runtime/src/message-text.js +15 -0
  75. package/dist/agent-runtime/src/message-text.js.map +1 -0
  76. package/dist/agent-runtime/src/message-window.cjs +15 -1
  77. package/dist/agent-runtime/src/message-window.cjs.map +1 -1
  78. package/dist/agent-runtime/src/message-window.d.ts +159 -0
  79. package/dist/agent-runtime/src/message-window.js +16 -2
  80. package/dist/agent-runtime/src/message-window.js.map +1 -1
  81. package/dist/agent-runtime/src/messages.cjs +88 -4
  82. package/dist/agent-runtime/src/messages.cjs.map +1 -1
  83. package/dist/agent-runtime/src/messages.d.ts +603 -0
  84. package/dist/agent-runtime/src/messages.js +88 -4
  85. package/dist/agent-runtime/src/messages.js.map +1 -1
  86. package/dist/agent-runtime/src/model-context.d.ts +22 -0
  87. package/dist/agent-runtime/src/offline-status.d.ts +157 -0
  88. package/dist/agent-runtime/src/optimistic-content.d.ts +21 -0
  89. package/dist/agent-runtime/src/protocol.cjs +12 -4
  90. package/dist/agent-runtime/src/protocol.cjs.map +1 -1
  91. package/dist/agent-runtime/src/protocol.d.ts +119 -0
  92. package/dist/agent-runtime/src/protocol.js +13 -5
  93. package/dist/agent-runtime/src/protocol.js.map +1 -1
  94. package/dist/agent-runtime/src/ptc-subcalls.d.ts +51 -0
  95. package/dist/agent-runtime/src/queue.d.ts +138 -0
  96. package/dist/agent-runtime/src/quota-safe-local-storage-session.d.ts +154 -0
  97. package/dist/agent-runtime/src/running-tool-placeholder.cjs +11 -0
  98. package/dist/agent-runtime/src/running-tool-placeholder.cjs.map +1 -0
  99. package/dist/agent-runtime/src/running-tool-placeholder.d.ts +25 -0
  100. package/dist/agent-runtime/src/running-tool-placeholder.js +11 -0
  101. package/dist/agent-runtime/src/running-tool-placeholder.js.map +1 -0
  102. package/dist/agent-runtime/src/runtime-messages.d.ts +104 -0
  103. package/dist/agent-runtime/src/screen-point.d.ts +151 -0
  104. package/dist/agent-runtime/src/sealed-idb.cjs +112 -0
  105. package/dist/agent-runtime/src/sealed-idb.cjs.map +1 -0
  106. package/dist/agent-runtime/src/sealed-idb.d.ts +106 -0
  107. package/dist/agent-runtime/src/sealed-idb.js +112 -0
  108. package/dist/agent-runtime/src/sealed-idb.js.map +1 -0
  109. package/dist/agent-runtime/src/send-recovery.d.ts +40 -0
  110. package/dist/agent-runtime/src/statewire-attach-observer.d.ts +194 -0
  111. package/dist/agent-runtime/src/statewire-diagnostics.d.ts +74 -0
  112. package/dist/agent-runtime/src/statewire-state.d.ts +29 -0
  113. package/dist/agent-runtime/src/statewire-suspended.cjs.map +1 -1
  114. package/dist/agent-runtime/src/statewire-suspended.d.ts +27 -0
  115. package/dist/agent-runtime/src/statewire-suspended.js.map +1 -1
  116. package/dist/agent-runtime/src/statewire-transport.d.ts +40 -0
  117. package/dist/agent-runtime/src/streaming-markdown.d.ts +46 -0
  118. package/dist/agent-runtime/src/subagent-transcripts.cjs +209 -0
  119. package/dist/agent-runtime/src/subagent-transcripts.cjs.map +1 -0
  120. package/dist/agent-runtime/src/subagent-transcripts.d.ts +71 -0
  121. package/dist/agent-runtime/src/subagent-transcripts.js +209 -0
  122. package/dist/agent-runtime/src/subagent-transcripts.js.map +1 -0
  123. package/dist/agent-runtime/src/subagents.cjs +253 -0
  124. package/dist/agent-runtime/src/subagents.cjs.map +1 -0
  125. package/dist/agent-runtime/src/subagents.d.ts +311 -0
  126. package/dist/agent-runtime/src/subagents.js +253 -0
  127. package/dist/agent-runtime/src/subagents.js.map +1 -0
  128. package/dist/agent-runtime/src/subscription-wake-event.d.ts +111 -0
  129. package/dist/agent-runtime/src/thread-extras.d.ts +43 -0
  130. package/dist/agent-runtime/src/thread-handoff.d.ts +364 -0
  131. package/dist/agent-runtime/src/thread-prewarm-controller.d.ts +76 -0
  132. package/dist/agent-runtime/src/thread-prewarm.d.ts +118 -0
  133. package/dist/agent-runtime/src/thread-snapshot-cache.d.ts +99 -0
  134. package/dist/agent-runtime/src/thread-snapshot-mirror.cjs +46 -117
  135. package/dist/agent-runtime/src/thread-snapshot-mirror.cjs.map +1 -1
  136. package/dist/agent-runtime/src/thread-snapshot-mirror.d.ts +101 -0
  137. package/dist/agent-runtime/src/thread-snapshot-mirror.js +17 -88
  138. package/dist/agent-runtime/src/thread-snapshot-mirror.js.map +1 -1
  139. package/dist/agent-runtime/src/thread-status.d.ts +53 -0
  140. package/dist/agent-runtime/src/tool-metadata.d.ts +146 -0
  141. package/dist/agent-runtime/src/tool-names.cjs +67 -0
  142. package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
  143. package/dist/agent-runtime/src/tool-names.d.ts +60 -0
  144. package/dist/agent-runtime/src/tool-names.js +68 -1
  145. package/dist/agent-runtime/src/tool-names.js.map +1 -1
  146. package/dist/agent-runtime/src/tool-outputs.d.ts +35 -0
  147. package/dist/agent-runtime/src/tool-result.cjs +1 -0
  148. package/dist/agent-runtime/src/tool-result.cjs.map +1 -1
  149. package/dist/agent-runtime/src/tool-result.d.ts +126 -0
  150. package/dist/agent-runtime/src/tool-result.js +1 -0
  151. package/dist/agent-runtime/src/tool-result.js.map +1 -1
  152. package/dist/agent-runtime/src/types.d.ts +159 -0
  153. package/dist/agent-runtime/src/use-conversation-list.d.ts +76 -0
  154. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +136 -0
  155. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -0
  156. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +64 -0
  157. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +136 -0
  158. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -0
  159. package/dist/agent-runtime/src/use-deep-agent-config.d.ts +169 -0
  160. package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs +13 -0
  161. package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
  162. package/dist/agent-runtime/src/use-deep-agent-edit-submit.d.ts +22 -0
  163. package/dist/agent-runtime/src/use-deep-agent-edit-submit.js +13 -0
  164. package/dist/agent-runtime/src/use-deep-agent-edit-submit.js.map +1 -1
  165. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +20 -2
  166. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
  167. package/dist/agent-runtime/src/use-deep-agent-runtime.d.ts +168 -0
  168. package/dist/agent-runtime/src/use-deep-agent-runtime.js +20 -2
  169. package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
  170. package/dist/agent-runtime/src/use-deep-agent-thread.cjs +12 -4
  171. package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
  172. package/dist/agent-runtime/src/use-deep-agent-thread.d.ts +320 -0
  173. package/dist/agent-runtime/src/use-deep-agent-thread.js +12 -4
  174. package/dist/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
  175. package/dist/agent-runtime/src/use-deep-agent-voice.cjs +999 -0
  176. package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -0
  177. package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +409 -0
  178. package/dist/agent-runtime/src/use-deep-agent-voice.js +999 -0
  179. package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -0
  180. package/dist/agent-runtime/src/use-deep-agent-window-sync.d.ts +102 -0
  181. package/dist/agent-runtime/src/use-historical-edit-attachments.d.ts +2 -0
  182. package/dist/agent-runtime/src/use-thread-handoff-flow.d.ts +84 -0
  183. package/dist/agent-runtime/src/voice-presentation.d.ts +80 -0
  184. package/dist/agent-runtime/src/voice-turn-grouping.d.ts +28 -0
  185. package/dist/agent-runtime/src/voice-wire-types.d.ts +15 -0
  186. package/dist/agent-runtime/src/withdrawn-turns.d.ts +97 -0
  187. package/dist/chat/AthenaChat.cjs +72 -5
  188. package/dist/chat/AthenaChat.cjs.map +1 -1
  189. package/dist/chat/AthenaChat.js +73 -6
  190. package/dist/chat/AthenaChat.js.map +1 -1
  191. package/dist/chat/StatewireApprovalCard.d.ts +1 -1
  192. package/dist/chat/StatewireClientToolBridge.d.ts +1 -1
  193. package/dist/chat/StatewireQueuedMessages.cjs +11 -4
  194. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
  195. package/dist/chat/StatewireQueuedMessages.d.ts +1 -1
  196. package/dist/chat/StatewireQueuedMessages.js +11 -4
  197. package/dist/chat/StatewireQueuedMessages.js.map +1 -1
  198. package/dist/chat/chat-outbox-rows.cjs +223 -0
  199. package/dist/chat/chat-outbox-rows.cjs.map +1 -0
  200. package/dist/chat/chat-outbox-rows.d.ts +29 -0
  201. package/dist/chat/chat-outbox-rows.js +223 -0
  202. package/dist/chat/chat-outbox-rows.js.map +1 -0
  203. package/dist/chat/statewire-approval.d.ts +1 -1
  204. package/dist/chat/statewire-client-tools.d.ts +1 -1
  205. package/dist/chat/super-grouping/SuperGroupingCard.cjs +3 -1
  206. package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
  207. package/dist/chat/super-grouping/SuperGroupingCard.d.ts +7 -1
  208. package/dist/chat/super-grouping/SuperGroupingCard.js +3 -1
  209. package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
  210. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +7 -2
  211. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -1
  212. package/dist/chat/super-grouping/SuperGroupingTranscript.d.ts +2 -2
  213. package/dist/chat/super-grouping/SuperGroupingTranscript.js +7 -2
  214. package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -1
  215. package/dist/chat/super-grouping/activity-timeline.cjs +15 -8
  216. package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
  217. package/dist/chat/super-grouping/activity-timeline.d.ts +18 -8
  218. package/dist/chat/super-grouping/activity-timeline.js +15 -8
  219. package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
  220. package/dist/chat/use-statewire-approval-request.cjs +36 -0
  221. package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
  222. package/dist/chat/use-statewire-approval-request.d.ts +49 -1
  223. package/dist/chat/use-statewire-approval-request.js +39 -3
  224. package/dist/chat/use-statewire-approval-request.js.map +1 -1
  225. package/dist/chat-ui/composer/tiptap-composer.cjs +102 -3
  226. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
  227. package/dist/chat-ui/composer/tiptap-composer.d.ts +32 -1
  228. package/dist/chat-ui/composer/tiptap-composer.js +103 -4
  229. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
  230. package/dist/chat-ui/header/conversation-history-panel.d.ts +1 -1
  231. package/dist/chat-ui/index.d.ts +1 -1
  232. package/dist/chat-ui/messages/message-components.cjs +15 -0
  233. package/dist/chat-ui/messages/message-components.cjs.map +1 -1
  234. package/dist/chat-ui/messages/message-components.js +15 -0
  235. package/dist/chat-ui/messages/message-components.js.map +1 -1
  236. package/dist/chat-ui/messages/runtime-message.d.ts +1 -1
  237. package/dist/chat-ui/messages/statewire-continue-run.d.ts +1 -1
  238. package/dist/chat-ui/messages/user-edit-composer.cjs +15 -2
  239. package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
  240. package/dist/chat-ui/messages/user-edit-composer.d.ts +4 -2
  241. package/dist/chat-ui/messages/user-edit-composer.js +15 -2
  242. package/dist/chat-ui/messages/user-edit-composer.js.map +1 -1
  243. package/dist/chat-ui/messages/wake-marker.d.ts +1 -1
  244. package/dist/chat-ui/rich-text/chat-text-schema.cjs +1 -0
  245. package/dist/chat-ui/rich-text/chat-text-schema.cjs.map +1 -1
  246. package/dist/chat-ui/rich-text/chat-text-schema.d.ts +3 -0
  247. package/dist/chat-ui/rich-text/chat-text-schema.js +1 -0
  248. package/dist/chat-ui/rich-text/chat-text-schema.js.map +1 -1
  249. package/dist/chat-ui/statewire.cjs +1 -0
  250. package/dist/chat-ui/statewire.cjs.map +1 -1
  251. package/dist/chat-ui/statewire.d.ts +2 -2
  252. package/dist/chat-ui/statewire.js +2 -1
  253. package/dist/chat-ui/thread/statewire-history-edge.d.ts +1 -1
  254. package/dist/composer/AttachmentContext.cjs +8 -4
  255. package/dist/composer/AttachmentContext.cjs.map +1 -1
  256. package/dist/composer/AttachmentContext.d.ts +7 -0
  257. package/dist/composer/AttachmentContext.js +8 -4
  258. package/dist/composer/AttachmentContext.js.map +1 -1
  259. package/dist/composer/build-composed-message.cjs +34 -0
  260. package/dist/composer/build-composed-message.cjs.map +1 -1
  261. package/dist/composer/build-composed-message.d.ts +20 -0
  262. package/dist/composer/build-composed-message.js +35 -1
  263. package/dist/composer/build-composed-message.js.map +1 -1
  264. package/dist/composer/composer-handoff.cjs +39 -2
  265. package/dist/composer/composer-handoff.cjs.map +1 -1
  266. package/dist/composer/composer-handoff.d.ts +28 -3
  267. package/dist/composer/composer-handoff.js +39 -2
  268. package/dist/composer/composer-handoff.js.map +1 -1
  269. package/dist/composer/useAttachFiles.cjs +15 -2
  270. package/dist/composer/useAttachFiles.cjs.map +1 -1
  271. package/dist/composer/useAttachFiles.d.ts +11 -0
  272. package/dist/composer/useAttachFiles.js +15 -2
  273. package/dist/composer/useAttachFiles.js.map +1 -1
  274. package/dist/composer/useSendMessage.cjs.map +1 -1
  275. package/dist/composer/useSendMessage.d.ts +4 -3
  276. package/dist/composer/useSendMessage.js.map +1 -1
  277. package/dist/diagnostics/athena-diagnostics.cjs.map +1 -1
  278. package/dist/diagnostics/athena-diagnostics.d.ts +3 -1
  279. package/dist/diagnostics/athena-diagnostics.js.map +1 -1
  280. package/dist/index.cjs +13 -0
  281. package/dist/index.cjs.map +1 -1
  282. package/dist/index.d.ts +13 -6
  283. package/dist/index.js +14 -1
  284. package/dist/index.js.map +1 -1
  285. package/dist/offline/chat-outbox.cjs +57 -0
  286. package/dist/offline/chat-outbox.cjs.map +1 -0
  287. package/dist/offline/chat-outbox.d.ts +80 -0
  288. package/dist/offline/chat-outbox.js +57 -0
  289. package/dist/offline/chat-outbox.js.map +1 -0
  290. package/dist/offline/offline-history.d.ts +1 -1
  291. package/dist/provider/AthenaProvider.cjs +162 -8
  292. package/dist/provider/AthenaProvider.cjs.map +1 -1
  293. package/dist/provider/AthenaProvider.d.ts +15 -1
  294. package/dist/provider/AthenaProvider.js +163 -9
  295. package/dist/provider/AthenaProvider.js.map +1 -1
  296. package/dist/provider/statewire-window-context.d.ts +1 -1
  297. package/dist/react/package.json.cjs +1 -1
  298. package/dist/react/package.json.js +1 -1
  299. package/dist/references/src/anchors/file-line-range.d.ts +58 -0
  300. package/dist/references/src/anchors/format.d.ts +21 -0
  301. package/dist/references/src/anchors/message-anchors.d.ts +71 -0
  302. package/dist/references/src/anchors/parse.d.ts +8 -0
  303. package/dist/references/src/anchors/registry-contract.d.ts +24 -0
  304. package/dist/references/src/anchors/registry.d.ts +19 -0
  305. package/dist/references/src/anchors/schemas.d.ts +194 -0
  306. package/dist/references/src/anchors/serialize.d.ts +8 -0
  307. package/dist/references/src/anchors/time.d.ts +78 -0
  308. package/dist/references/src/anchors/types.d.ts +474 -0
  309. package/dist/references/src/asset-bounds.d.ts +27 -0
  310. package/dist/references/src/asset-links.d.ts +23 -0
  311. package/dist/references/src/asset-reference.d.ts +16 -0
  312. package/dist/references/src/formats/format-catalog.d.ts +79 -0
  313. package/dist/references/src/formats/markdown/parse-reference-markdown.d.ts +28 -0
  314. package/dist/references/src/formats/markdown/reference-display-name.d.ts +6 -0
  315. package/dist/references/src/formats/object/asset-object.d.ts +9 -0
  316. package/dist/references/src/formats/object/callable-object.d.ts +6 -0
  317. package/dist/references/src/formats/object/decode-reference-object-payload.d.ts +3 -0
  318. package/dist/references/src/formats/object/external-url-object.d.ts +9 -0
  319. package/dist/references/src/formats/object/group-object.d.ts +9 -0
  320. package/dist/references/src/formats/object/navigation-object.d.ts +9 -0
  321. package/dist/references/src/formats/object/parse-reference-object.d.ts +11 -0
  322. package/dist/references/src/formats/object/person-object.d.ts +9 -0
  323. package/dist/references/src/formats/uri/asset-mention-uri.d.ts +9 -0
  324. package/dist/references/src/formats/uri/asset-spaces-url.d.ts +9 -0
  325. package/dist/references/src/formats/uri/callable-mention-uris.d.ts +9 -0
  326. package/dist/references/src/formats/uri/detect-uri-wire.d.ts +9 -0
  327. package/dist/references/src/formats/uri/group-mention-uri.d.ts +12 -0
  328. package/dist/references/src/formats/uri/navigation-spaces-url.d.ts +14 -0
  329. package/dist/references/src/formats/uri/parse-reference-uri.d.ts +20 -0
  330. package/dist/references/src/formats/uri/person-mention-uri.d.ts +9 -0
  331. package/dist/references/src/formats/uri/template-placeholder.d.ts +12 -0
  332. package/dist/references/src/index.d.ts +47 -0
  333. package/dist/references/src/legacy/index.d.ts +14 -0
  334. package/dist/references/src/legacy/pre-reference-asset-url.d.ts +57 -0
  335. package/dist/references/src/legacy/pre-reference-citation-bridge.d.ts +22 -0
  336. package/dist/references/src/legacy/pre-reference-citation.d.ts +138 -0
  337. package/dist/references/src/legacy/pre-reference-external-url.d.ts +31 -0
  338. package/dist/references/src/legacy/pre-reference-format.d.ts +8 -0
  339. package/dist/references/src/legacy/pre-reference-mention.d.ts +27 -0
  340. package/dist/references/src/legacy/pre-reference-object.d.ts +8 -0
  341. package/dist/references/src/legacy/pre-reference-uri.d.ts +12 -0
  342. package/dist/references/src/legacy.d.ts +2 -0
  343. package/dist/references/src/mention-href-patterns.d.ts +19 -0
  344. package/dist/references/src/mention-node/index.d.ts +5 -0
  345. package/dist/references/src/mention-node/mention-node.d.ts +31 -0
  346. package/dist/references/src/mention-node/resolve-node-attrs.d.ts +27 -0
  347. package/dist/references/src/parse-reference.d.ts +23 -0
  348. package/dist/references/src/schemas.d.ts +463 -0
  349. package/dist/references/src/serialize-reference.d.ts +50 -0
  350. package/dist/references/src/sheet-name.d.ts +10 -0
  351. package/dist/references/src/tool-option-schemas.d.ts +597 -0
  352. package/dist/references/src/types.d.ts +125 -0
  353. package/dist/references/src/version-ref.d.ts +30 -0
  354. package/dist/runtime/statewire-lifecycle.d.ts +1 -1
  355. package/dist/runtime/statewire-model-lane.d.ts +1 -1
  356. package/dist/runtime/statewire-server-lane-context.d.ts +1 -1
  357. package/dist/runtime/statewire-session-key.cjs +7 -0
  358. package/dist/runtime/statewire-session-key.cjs.map +1 -1
  359. package/dist/runtime/statewire-session-key.d.ts +16 -0
  360. package/dist/runtime/statewire-session-key.js +8 -1
  361. package/dist/runtime/statewire-session-key.js.map +1 -1
  362. package/dist/runtime/statewire-session-lane.cjs +48 -0
  363. package/dist/runtime/statewire-session-lane.cjs.map +1 -0
  364. package/dist/runtime/statewire-session-lane.d.ts +29 -0
  365. package/dist/runtime/statewire-session-lane.js +48 -0
  366. package/dist/runtime/statewire-session-lane.js.map +1 -0
  367. package/dist/runtime/statewire-thread-config-lane.d.ts +1 -1
  368. package/dist/runtime/useAthenaStatewireRuntime.cjs +16 -5
  369. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
  370. package/dist/runtime/useAthenaStatewireRuntime.d.ts +15 -1
  371. package/dist/runtime/useAthenaStatewireRuntime.js +17 -6
  372. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
  373. package/dist/styles.css +1 -1
  374. package/dist/threads/api.d.ts +1 -1
  375. package/dist/threads/conversation-list-fetcher.d.ts +1 -1
  376. package/dist/threads/index-triggered-refresh.cjs +164 -0
  377. package/dist/threads/index-triggered-refresh.cjs.map +1 -0
  378. package/dist/threads/index-triggered-refresh.d.ts +70 -0
  379. package/dist/threads/index-triggered-refresh.js +164 -0
  380. package/dist/threads/index-triggered-refresh.js.map +1 -0
  381. package/dist/threads/offline-session-list.d.ts +1 -1
  382. package/dist/threads/pull-request-display.d.ts +1 -1
  383. package/dist/threads/session-list-model.d.ts +1 -1
  384. package/dist/threads/session-list-tab-share.cjs +150 -0
  385. package/dist/threads/session-list-tab-share.cjs.map +1 -0
  386. package/dist/threads/session-list-tab-share.d.ts +73 -0
  387. package/dist/threads/session-list-tab-share.js +150 -0
  388. package/dist/threads/session-list-tab-share.js.map +1 -0
  389. package/dist/threads/session-row-parts.d.ts +1 -1
  390. package/dist/threads/sessions-query.d.ts +1 -1
  391. package/dist/threads/statewire-thread-list.cjs +42 -16
  392. package/dist/threads/statewire-thread-list.cjs.map +1 -1
  393. package/dist/threads/statewire-thread-list.d.ts +11 -2
  394. package/dist/threads/statewire-thread-list.js +43 -17
  395. package/dist/threads/statewire-thread-list.js.map +1 -1
  396. package/dist/threads/thread-prefetcher.d.ts +1 -1
  397. package/dist/threads/use-athena-session-attention.d.ts +1 -1
  398. package/dist/threads/use-athena-sessions.cjs +32 -22
  399. package/dist/threads/use-athena-sessions.cjs.map +1 -1
  400. package/dist/threads/use-athena-sessions.js +33 -23
  401. package/dist/threads/use-athena-sessions.js.map +1 -1
  402. package/dist/threads/use-rest-conversation-history.d.ts +1 -1
  403. package/dist/threads/use-statewire-conversation-history.d.ts +5 -5
  404. package/dist/tiptap-markdown-table/src/markdown-table-serializer.d.ts +56 -0
  405. package/dist/tools/NestedPtcMessages.cjs +14 -9
  406. package/dist/tools/NestedPtcMessages.cjs.map +1 -1
  407. package/dist/tools/NestedPtcMessages.d.ts +9 -0
  408. package/dist/tools/NestedPtcMessages.js +6 -1
  409. package/dist/tools/NestedPtcMessages.js.map +1 -1
  410. package/dist/tools/index.d.ts +1 -1
  411. package/dist/tools/primitives.d.ts +1 -1
  412. package/dist/tools/subagent-task-tool-ui.cjs +494 -0
  413. package/dist/tools/subagent-task-tool-ui.cjs.map +1 -0
  414. package/dist/tools/subagent-task-tool-ui.d.ts +109 -0
  415. package/dist/tools/subagent-task-tool-ui.js +494 -0
  416. package/dist/tools/subagent-task-tool-ui.js.map +1 -0
  417. package/dist/tools/tool-fallback.d.ts +1 -1
  418. package/dist/tools/tool-icons.d.ts +1 -1
  419. package/dist/tools/tool-summary.d.ts +1 -1
  420. package/dist/tools/tool-uis.cjs +4 -0
  421. package/dist/tools/tool-uis.cjs.map +1 -1
  422. package/dist/tools/tool-uis.js +4 -0
  423. package/dist/tools/tool-uis.js.map +1 -1
  424. package/dist/voice/chat.cjs +6 -0
  425. package/dist/voice/chat.cjs.map +1 -0
  426. package/dist/voice/chat.d.ts +2 -0
  427. package/dist/voice/chat.js +6 -0
  428. package/dist/voice/chat.js.map +1 -0
  429. package/dist/voice/livekit-join.cjs +119 -0
  430. package/dist/voice/livekit-join.cjs.map +1 -0
  431. package/dist/voice/livekit-join.d.ts +8 -0
  432. package/dist/voice/livekit-join.js +119 -0
  433. package/dist/voice/livekit-join.js.map +1 -0
  434. package/dist/voice/livekit.cjs +32 -0
  435. package/dist/voice/livekit.cjs.map +1 -0
  436. package/dist/voice/livekit.d.ts +80 -0
  437. package/dist/voice/livekit.js +32 -0
  438. package/dist/voice/livekit.js.map +1 -0
  439. package/package.json +20 -10
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Followed subagent lanes — the client half of agora's `follow` interest
3
+ * (`message_window.follow_windows`).
4
+ *
5
+ * A running `task` card carries only its lane's newest steps (eight, with
6
+ * `athena_lane_truncated` counting the rest). A request that adds
7
+ * `follow: {before}` also covers the newest `before` steps of every lane a card
8
+ * in its window names: the resolution gains `follows`
9
+ * (`{ns: {chain, more, toolCallId}}`) and each step is its own `athena`
10
+ * document, keyed `[threadId, ns, stepId]`.
11
+ *
12
+ * A lane is followed through a request anchored at its card alone
13
+ * ({@link laneFollowRequest}), so following one lane pulls in no other and has
14
+ * the attach's whole step allowance. {@link readDeepAgentFollowedWindow} reads
15
+ * the followed steps back onto the card, so the card's tool-call part carries
16
+ * the whole live lane as its nested thread; {@link useDeepAgentLaneFollowSync}
17
+ * keeps the attach's follow requests to the running lanes a surface shows
18
+ * ({@link createDeepAgentLaneFollowRegistry}). It follows only on a host whose
19
+ * `protocol` lane advertises `DEEP_AGENT_LANE_FOLLOW_PROTOCOL_VERSION`; a host
20
+ * that refuses `follow` anyway (`invalid-interest`, one predating it) keeps the
21
+ * attach's windows, and the cards keep the steps their own documents carry.
22
+ *
23
+ * Surfaces opt in. A surface that follows nothing ships none of this and sees
24
+ * the wire it saw before.
25
+ */
26
+ import type { LangChainMessage } from '@assistant-ui/react-langgraph';
27
+ import { type DeepAgentInterestRequest, type DeepAgentMessageWindow, readDeepAgentMessageWindow } from './message-window';
28
+ type MountedDocuments = Parameters<typeof readDeepAgentMessageWindow>[0];
29
+ /** A request following the lane one `task` card holds. */
30
+ export interface DeepAgentLaneFollowRequest extends DeepAgentInterestRequest {
31
+ readonly at: string;
32
+ readonly follow: {
33
+ readonly before: number;
34
+ };
35
+ }
36
+ /**
37
+ * The request following the lane of the running `task` card `cardId`: the card
38
+ * alone (`before: 1`), so its window names no other card's lane, with as many
39
+ * of its lane's newest steps as one attach follows.
40
+ */
41
+ export declare function laneFollowRequest(cardId: string): DeepAgentLaneFollowRequest;
42
+ export declare function isLaneFollowRequest(request: DeepAgentInterestRequest): request is DeepAgentLaneFollowRequest;
43
+ /** What an attach follows, read off its mounted documents. */
44
+ export interface DeepAgentLaneFollows {
45
+ /** The follow requests the attach holds whose card is still in the transcript. */
46
+ readonly requests: readonly DeepAgentLaneFollowRequest[];
47
+ /** Each followed lane's mounted steps, oldest first, by the `task` call whose card holds it. */
48
+ readonly lanes: ReadonlyMap<string, readonly LangChainMessage[]>;
49
+ }
50
+ /**
51
+ * The attach's follow requests and followed lanes. A step whose document is
52
+ * not mounted is left out; a lane two windows follow is read from the deeper
53
+ * one. A malformed window or step reads as absent.
54
+ */
55
+ export declare function readDeepAgentLaneFollows(mounted: MountedDocuments): DeepAgentLaneFollows;
56
+ /**
57
+ * A running card's transcript with its followed lane read in. A cut card
58
+ * carries its lane's newest steps whole, led by its first `cutTurns` entries:
59
+ * the older assistant turns that requested results among them, cut to those
60
+ * calls. The merge is the followed steps older than the card's newest, then
61
+ * the card's newest steps, then any followed step newer than all of them. The
62
+ * card's newest copies are the fuller ones (a lane step's document leaves every
63
+ * inline image a placeholder), and only the card carries a step without an id,
64
+ * which no follow addresses; the follow holds the cut turns whole, with the
65
+ * steps between them and the newest, and a cut turn it does not hold leads.
66
+ */
67
+ export declare function mergeFollowedLane(carried: readonly unknown[], followed: readonly LangChainMessage[], cutTurns?: number): readonly unknown[];
68
+ /**
69
+ * {@link readDeepAgentMessageWindow} with the attach's followed lanes read in.
70
+ * The follow requests ride at the end of `requests`, so a restatement built
71
+ * from this window (the thread's head widening, a page of older history) keeps
72
+ * them: the joined view never counts them as pages. Each running card a follow
73
+ * covers carries its lane's followed steps as its transcript, kept as the same
74
+ * object while its steps stand. Without follows, the window is
75
+ * {@link readDeepAgentMessageWindow}'s own.
76
+ */
77
+ export declare function readDeepAgentFollowedWindow(mounted: MountedDocuments): DeepAgentMessageWindow | null;
78
+ /**
79
+ * The lanes a surface shows (an open transcript drawer's), by the `task` call
80
+ * whose card holds each: what {@link useDeepAgentLaneFollowSync} follows.
81
+ */
82
+ export interface DeepAgentLaneFollowRegistry {
83
+ /** Follow the lane of the `task` call `toolCallId` until the returned release is called. */
84
+ follow(toolCallId: string): () => void;
85
+ subscribe(listener: () => void): () => void;
86
+ /** The `task` calls whose lanes are followed; a new set on every change. */
87
+ getSnapshot(): ReadonlySet<string>;
88
+ }
89
+ export declare function createDeepAgentLaneFollowRegistry(): DeepAgentLaneFollowRegistry;
90
+ /** Follows the lane of `toolCallId` while `active` (a drawer open on a running lane). */
91
+ export declare function useDeepAgentLaneFollow(registry: DeepAgentLaneFollowRegistry | null, toolCallId: string, active: boolean): void;
92
+ export interface UseDeepAgentLaneFollowSyncOptions {
93
+ /** The lanes the surface shows. */
94
+ registry: DeepAgentLaneFollowRegistry;
95
+ /**
96
+ * Another statement on the interest lane is in flight (a page of older
97
+ * history): wait for it, so neither statement drops what the other adds.
98
+ */
99
+ paused?: boolean;
100
+ /**
101
+ * A follow statement failed. A host that does not serve `follow` is not a
102
+ * failure: the cards keep the lanes their own documents carry.
103
+ */
104
+ onError?: ((error: unknown) => void) | undefined;
105
+ }
106
+ /**
107
+ * Keeps the attach's follow requests to the running lanes the registry holds,
108
+ * once per change, on a host whose `protocol` lane advertises at least
109
+ * `DEEP_AGENT_LANE_FOLLOW_PROTOCOL_VERSION`. A statement restates the
110
+ * attach's other requests as the window holds them, with the follows after
111
+ * them, inside the host's interest cap; a statement elsewhere that left a
112
+ * follow out (a page of older history) is answered by stating it again.
113
+ *
114
+ * Never a retry loop: a statement is not sent again unchanged on the same
115
+ * connection. A host that refuses `follow` (`invalid-interest`, one that
116
+ * predates it) keeps the attach's windows, and nothing is followed on that
117
+ * connection again; a card that left the transcript first (`unknown-message`)
118
+ * is not followed until the transcript moves.
119
+ */
120
+ export declare function useDeepAgentLaneFollowSync({ registry, paused, onError, }: UseDeepAgentLaneFollowSyncOptions): void;
121
+ export {};
@@ -0,0 +1,209 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const store = require("@assistant-ui/store");
4
+ const reactQuery = require("@tanstack/react-query");
5
+ const react = require("react");
6
+ const runconfigContract = require("./generated/runconfig-contract.cjs");
7
+ const messageWindow = require("./message-window.cjs");
8
+ const protocol = require("./protocol.cjs");
9
+ const subagents = require("./subagents.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 entryId = (entry) => {
14
+ const id = isRecord(entry) ? entry.id : void 0;
15
+ return typeof id === "string" ? id : void 0;
16
+ };
17
+ function buildHistoryLaneCommand({
18
+ target,
19
+ at
20
+ }) {
21
+ return {
22
+ type: runconfigContract.DEEP_AGENT_HISTORY_LANE_COMMAND,
23
+ ...target.lane !== void 0 ? { lane: target.lane } : { messageId: target.messageId },
24
+ before: runconfigContract.DEEP_AGENT_MAX_LANE_PAGE,
25
+ ...at !== void 0 && { at }
26
+ };
27
+ }
28
+ const nonEmpty = (value) => typeof value === "string" && value ? value : null;
29
+ function readHistoryLanePage(payload) {
30
+ if (!isRecord(payload)) return null;
31
+ const { steps, more, total } = payload;
32
+ const messageId = nonEmpty(payload.messageId);
33
+ const lane = nonEmpty(payload.lane);
34
+ if (messageId === null === (lane === null) || !Array.isArray(steps)) return null;
35
+ if (!isRecord(more) || typeof more.before !== "boolean" || !isCount(total)) return null;
36
+ return {
37
+ messageId,
38
+ lane,
39
+ steps: steps.filter((step) => entryId(step) !== void 0),
40
+ hasEarlier: more.before,
41
+ total
42
+ };
43
+ }
44
+ const answers = (page, target) => target.lane !== void 0 ? page.lane === target.lane : page.messageId === target.messageId;
45
+ function isWholeCardRefusal(error) {
46
+ const failure = isRecord(error) ? error.failure : void 0;
47
+ return isRecord(failure) && failure.fate === "rejected" && typeof failure.message === "string" && failure.message.includes(runconfigContract.DEEP_AGENT_HISTORY_MESSAGE_COMMAND);
48
+ }
49
+ const callCount = (entry) => {
50
+ var _a;
51
+ return entry.type === "ai" ? ((_a = entry.tool_calls) == null ? void 0 : _a.length) ?? 0 : 0;
52
+ };
53
+ function mergeLaneHistory({
54
+ history,
55
+ carried,
56
+ whole = false
57
+ }) {
58
+ if (history.length === 0) return carried;
59
+ const held = /* @__PURE__ */ new Set();
60
+ for (const entry of history) {
61
+ const id = entryId(entry);
62
+ if (id !== void 0) held.add(id);
63
+ }
64
+ let anchor = -1;
65
+ for (let index = carried.length - 1; index >= 0; index -= 1) {
66
+ const id = entryId(carried[index]);
67
+ if (id !== void 0 && held.has(id)) {
68
+ anchor = index;
69
+ break;
70
+ }
71
+ }
72
+ if (anchor < 0) return whole ? history : [...history, ...carried];
73
+ const own = /* @__PURE__ */ new Map();
74
+ for (const entry of carried) {
75
+ const id = entryId(entry);
76
+ if (id !== void 0) own.set(id, entry);
77
+ }
78
+ const read = history.map((entry) => {
79
+ const id = entryId(entry);
80
+ const mine = id === void 0 ? void 0 : own.get(id);
81
+ return mine !== void 0 && callCount(mine) >= callCount(entry) ? mine : entry;
82
+ });
83
+ const older = carried.slice(0, anchor).filter((entry) => {
84
+ const id = entryId(entry);
85
+ return id !== void 0 && !held.has(id);
86
+ });
87
+ return [...older, ...read, ...carried.slice(anchor + 1)];
88
+ }
89
+ const laneTargetKey = (target) => target.lane !== void 0 ? `lane:${target.lane}` : `card:${target.messageId}`;
90
+ const deepAgentLaneHistoryQueryKey = ({
91
+ target,
92
+ mount
93
+ }) => ["athena-deep-agent", "history-lane", target, ...mount === void 0 ? [] : [mount]];
94
+ let mountCount = 0;
95
+ const nextMount = () => {
96
+ mountCount += 1;
97
+ return mountCount;
98
+ };
99
+ async function readLanePage({
100
+ sendCommand,
101
+ target,
102
+ at
103
+ }) {
104
+ try {
105
+ const page = readHistoryLanePage(await sendCommand(buildHistoryLaneCommand({ target, at })));
106
+ if (page === null || !answers(page, target)) {
107
+ throw new Error("history/lane answered another card or lane");
108
+ }
109
+ return { steps: page.steps, hasEarlier: page.hasEarlier, total: page.total, whole: false };
110
+ } catch (error) {
111
+ if (target.messageId === void 0 || !isWholeCardRefusal(error)) throw error;
112
+ const result = messageWindow.readHistoryMessageResult(
113
+ await sendCommand(messageWindow.buildHistoryMessageCommand({ messageId: target.messageId }))
114
+ );
115
+ if (result === null || result.messageId !== target.messageId) {
116
+ throw new Error("history/message answered another message");
117
+ }
118
+ const card = result.message;
119
+ const steps = subagents.nestedMessagesFromArtifact(isRecord(card) ? card.artifact : void 0);
120
+ return { steps, hasEarlier: false, total: steps.length, whole: true };
121
+ }
122
+ }
123
+ function useDeepAgentLaneHistory({
124
+ messageId,
125
+ lane,
126
+ carried,
127
+ total,
128
+ finished = false,
129
+ checkpointed = false,
130
+ auto = false
131
+ }) {
132
+ var _a;
133
+ const sendCommand = store.useAuiState(
134
+ (s) => threadExtras.hasStatewireThreadExtras(s.thread.extras) ? s.thread.extras.sendCommand : void 0
135
+ );
136
+ const hostVersion = store.useAuiState((s) => {
137
+ var _a2;
138
+ const extras = s.thread.extras;
139
+ return ((_a2 = protocol.readDeepAgentProtocol(extras == null ? void 0 : extras.state)) == null ? void 0 : _a2.version) ?? 0;
140
+ });
141
+ const sendRef = react.useRef(sendCommand);
142
+ sendRef.current = sendCommand;
143
+ const [mount] = react.useState(nextMount);
144
+ const [asked, setAsked] = react.useState(false);
145
+ const target = react.useMemo(
146
+ () => lane !== void 0 ? { lane } : messageId !== void 0 ? { messageId } : void 0,
147
+ [lane, messageId]
148
+ );
149
+ const settled = finished || checkpointed;
150
+ const askable = (total !== void 0 || checkpointed) && target !== void 0 && sendCommand !== void 0 && (target.lane !== void 0 || settled || hostVersion >= runconfigContract.DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION);
151
+ const query = reactQuery.useInfiniteQuery({
152
+ queryKey: deepAgentLaneHistoryQueryKey({
153
+ target: target === void 0 ? "" : laneTargetKey(target),
154
+ mount: settled ? void 0 : mount
155
+ }),
156
+ queryFn: ({ pageParam }) => {
157
+ const send = sendRef.current;
158
+ if (target === void 0 || send === void 0) {
159
+ return Promise.reject(new Error("no statewire thread to read the lane from"));
160
+ }
161
+ return readLanePage({ sendCommand: send, target, at: pageParam });
162
+ },
163
+ initialPageParam: void 0,
164
+ getNextPageParam: (last) => last.hasEarlier ? entryId(last.steps[0]) : void 0,
165
+ enabled: askable && (auto || asked),
166
+ retry: false,
167
+ retryOnMount: false,
168
+ staleTime: Number.POSITIVE_INFINITY,
169
+ refetchOnMount: false,
170
+ refetchOnWindowFocus: false,
171
+ refetchOnReconnect: false
172
+ });
173
+ const pages = (_a = query.data) == null ? void 0 : _a.pages;
174
+ const history = react.useMemo(() => {
175
+ var _a2, _b;
176
+ if (pages === void 0 || pages.length === 0) return null;
177
+ const entries = [...pages].reverse().flatMap((page) => page.steps);
178
+ return { entries, whole: ((_a2 = pages[0]) == null ? void 0 : _a2.whole) === true, total: ((_b = pages[0]) == null ? void 0 : _b.total) ?? 0 };
179
+ }, [pages]);
180
+ const available = askable && !query.isError;
181
+ const steps = react.useMemo(
182
+ () => history === null ? carried : mergeLaneHistory({ history: history.entries, carried, whole: history.whole }),
183
+ [history, carried]
184
+ );
185
+ const hasEarlier = available && (history === null ? checkpointed || steps.length < (total ?? 0) : query.hasNextPage);
186
+ const loading = query.isFetching;
187
+ const { fetchNextPage } = query;
188
+ const loadEarlier = react.useCallback(() => {
189
+ if (!hasEarlier || loading) return;
190
+ if (history === null) setAsked(true);
191
+ else void fetchNextPage();
192
+ }, [fetchNextPage, hasEarlier, history, loading]);
193
+ return {
194
+ steps,
195
+ // A lane read without a marker (a checkpointed one) counts what its pages say.
196
+ total: total === void 0 ? history == null ? void 0 : history.total : Math.max(total, (history == null ? void 0 : history.total) ?? 0),
197
+ available,
198
+ hasEarlier,
199
+ loading,
200
+ loadEarlier
201
+ };
202
+ }
203
+ exports.buildHistoryLaneCommand = buildHistoryLaneCommand;
204
+ exports.deepAgentLaneHistoryQueryKey = deepAgentLaneHistoryQueryKey;
205
+ exports.isWholeCardRefusal = isWholeCardRefusal;
206
+ exports.mergeLaneHistory = mergeLaneHistory;
207
+ exports.readHistoryLanePage = readHistoryLanePage;
208
+ exports.useDeepAgentLaneHistory = useDeepAgentLaneHistory;
209
+ //# sourceMappingURL=lane-history.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lane-history.cjs","sources":["../../../../agent-runtime/src/lane-history.ts"],"sourcesContent":["/**\n * A card's whole nested transcript on demand — the client half of agora's\n * `history/lane` read command.\n *\n * A card's own document carries its nested transcript (a `task` subagent's\n * lane) cut to its newest entries whenever older ones are left off — a running\n * card always, and on a version-2 view a finished one too — counting the whole\n * stored transcript under `athena_lane_truncated`. `history/lane`\n * `{messageId, before, at?}` answers a page of it: the newest `before` entries,\n * or those strictly older than `at`, oldest first, each projected like a\n * followed lane step (every inline image a placeholder), with\n * `{more: {before}, total}`. {@link useDeepAgentLaneHistory} pages one card's\n * transcript for a surface that shows it whole, and {@link mergeLaneHistory}\n * reads the pages in under the card's own live entries.\n *\n * An in-eval dispatch's lane (`task()` inside `eval`) streams the same way on\n * its `ptc_subagents` registry entry: its newest steps, the marker counting the\n * lane, running or finished. `history/lane` `{lane, before, at?}` pages it by\n * the dispatch id (the registry key, never with `messageId`), and answers the\n * same page with `lane` set and `messageId` null. A lane whose steps no longer\n * ride pages the same way from its subagent checkpoint once agora recorded its\n * namespace (`ns`), `checkpointed`: a previous run's lane in this activation\n * (a later run left its registry entry only its summary and `ns`), or a\n * reopened session's (the registry died with the activation that streamed it,\n * and the summary its eval persisted records `ns`). It carries no steps, and\n * the first page names the total.\n *\n * Only a cut card or lane is paged. A finished card is cut only by a host that\n * serves `history/lane`, so it is always asked, and so is a cut in-eval lane\n * (a client that never sends `lane` needs no gate); a running card is asked\n * only when the host's `protocol` lane advertises\n * `DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION`. A card whose entries carry no ids\n * cannot be paged: the host says to read the card whole with\n * `history/message`, and that one read stands for the lane. Any other refusal\n * (an older pod answers `history/lane` as an unknown command, or wants a\n * `messageId`; a lane with no recorded checkpoint) leaves the surface on the\n * entries it carries: no error, and that mount never asks again.\n *\n * Surfaces opt in. A surface that pages nothing ships none of this.\n */\nimport type { LangChainMessage } from '@assistant-ui/react-langgraph';\nimport type { StatewireThread } from '@assistant-ui/react-statewire';\nimport { useAuiState } from '@assistant-ui/store';\nimport { type InfiniteData, useInfiniteQuery } from '@tanstack/react-query';\nimport { useCallback, useMemo, useRef, useState } from 'react';\nimport {\n DEEP_AGENT_HISTORY_LANE_COMMAND,\n DEEP_AGENT_HISTORY_MESSAGE_COMMAND,\n DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION,\n DEEP_AGENT_MAX_LANE_PAGE,\n} from './generated/runconfig-contract';\nimport { buildHistoryMessageCommand, readHistoryMessageResult } from './message-window';\nimport { readDeepAgentProtocol } from './protocol';\nimport { nestedMessagesFromArtifact } from './subagents';\nimport { hasStatewireThreadExtras } from './thread-extras';\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 entryId = (entry: unknown): string | undefined => {\n const id = isRecord(entry) ? entry.id : undefined;\n return typeof id === 'string' ? id : undefined;\n};\n\n/**\n * The `history/lane` read command on the statewire command union, so\n * `sendCommand({ type: 'history/lane', … })` typechecks wherever the deep-agent\n * host is driven (an attach-ACL read, like `history/message`).\n */\ndeclare module '@assistant-ui/core' {\n namespace Assistant {\n interface Commands {\n /** A page of one card's nested transcript. */\n historyLane: HistoryLaneCommand;\n }\n }\n}\n\n/**\n * What one `history/lane` read pages: a card's nested transcript, by the card's\n * message id (a finished card or a running placeholder), or an in-eval\n * dispatch's lane, by its dispatch id.\n */\nexport type DeepAgentLaneTarget =\n | { readonly messageId: string; readonly lane?: undefined }\n | { readonly lane: string; readonly messageId?: undefined };\n\n/** The `history/lane` command: a page of one card's or lane's steps, oldest first. */\nexport type HistoryLaneCommand = {\n readonly type: typeof DEEP_AGENT_HISTORY_LANE_COMMAND;\n /** Entries in the page (`1..DEEP_AGENT_MAX_LANE_PAGE`). */\n readonly before: number;\n /** An entry id: the page holds the entries strictly older than it. Without it, the newest. */\n readonly at?: string;\n} & ({ readonly messageId: string } | { readonly lane: string });\n\nexport function buildHistoryLaneCommand({\n target,\n at,\n}: {\n target: DeepAgentLaneTarget;\n at?: string | undefined;\n}): HistoryLaneCommand {\n return {\n type: DEEP_AGENT_HISTORY_LANE_COMMAND,\n ...(target.lane !== undefined ? { lane: target.lane } : { messageId: target.messageId }),\n before: DEEP_AGENT_MAX_LANE_PAGE,\n ...(at !== undefined && { at }),\n };\n}\n\n/** One page `history/lane` answered. */\nexport interface HistoryLanePage {\n /** The card it pages; `null` for a lane. */\n readonly messageId: string | null;\n /** The in-eval lane it pages; `null` for a card (a host that predates lanes leaves it out). */\n readonly lane: string | null;\n /** The page's entries, oldest first; an entry without a string id is never in one. */\n readonly steps: readonly LangChainMessage[];\n /** Whether entries older than the page remain. */\n readonly hasEarlier: boolean;\n /** Entries the card's transcript, or the lane's checkpoint, stores. */\n readonly total: number;\n}\n\nconst nonEmpty = (value: unknown): string | null =>\n typeof value === 'string' && value ? value : null;\n\nexport function readHistoryLanePage(payload: unknown): HistoryLanePage | null {\n if (!isRecord(payload)) return null;\n const { steps, more, total } = payload;\n const messageId = nonEmpty(payload.messageId);\n const lane = nonEmpty(payload.lane);\n if ((messageId === null) === (lane === null) || !Array.isArray(steps)) return null;\n if (!isRecord(more) || typeof more.before !== 'boolean' || !isCount(total)) return null;\n return {\n messageId,\n lane,\n steps: steps.filter((step): step is LangChainMessage => entryId(step) !== undefined),\n hasEarlier: more.before,\n total,\n };\n}\n\n/** Whether a page answers a read of `target`. */\nconst answers = (page: HistoryLanePage, target: DeepAgentLaneTarget): boolean =>\n target.lane !== undefined ? page.lane === target.lane : page.messageId === target.messageId;\n\n/**\n * Whether `history/lane` was refused because the lane's entries carry no ids\n * to page by: the host names `history/message` as the way to read the card.\n */\nexport function isWholeCardRefusal(error: unknown): boolean {\n const failure = isRecord(error) ? error.failure : undefined;\n return (\n isRecord(failure) &&\n failure.fate === 'rejected' &&\n typeof failure.message === 'string' &&\n failure.message.includes(DEEP_AGENT_HISTORY_MESSAGE_COMMAND)\n );\n}\n\n/** The tool calls an assistant entry makes. */\nconst callCount = (entry: LangChainMessage): number =>\n entry.type === 'ai' ? (entry.tool_calls?.length ?? 0) : 0;\n\n/**\n * A card's transcript with its paged history read in: the history (whole,\n * oldest first), then the card's own entries newer than the last one the\n * history holds — what the lane did since the history was read. The card's\n * entries older than that one and not in the history yet (a page cut short by\n * its size, or a turn the card keeps for a result it holds) come first, so the\n * view never shows less than the card. An entry the card also carries is the\n * card's copy, which is the newer one: a page is a snapshot, which can catch a\n * step mid-stream, and leaves every inline image a placeholder. The exception\n * is a turn the card keeps cut to the calls it holds results for, which\n * carries fewer calls than the page's copy. Without history, the card's own\n * entries. `whole` history is the card's entire transcript as it was read;\n * when none of its entries can be matched to the card's (they carry no ids),\n * it stands alone.\n */\nexport function mergeLaneHistory({\n history,\n carried,\n whole = false,\n}: {\n history: readonly LangChainMessage[];\n carried: readonly LangChainMessage[];\n whole?: boolean;\n}): readonly LangChainMessage[] {\n if (history.length === 0) return carried;\n const held = new Set<string>();\n for (const entry of history) {\n const id = entryId(entry);\n if (id !== undefined) held.add(id);\n }\n let anchor = -1;\n for (let index = carried.length - 1; index >= 0; index -= 1) {\n const id = entryId(carried[index]);\n if (id !== undefined && held.has(id)) {\n anchor = index;\n break;\n }\n }\n if (anchor < 0) return whole ? history : [...history, ...carried];\n const own = new Map<string, LangChainMessage>();\n for (const entry of carried) {\n const id = entryId(entry);\n if (id !== undefined) own.set(id, entry);\n }\n const read = history.map((entry) => {\n const id = entryId(entry);\n const mine = id === undefined ? undefined : own.get(id);\n return mine !== undefined && callCount(mine) >= callCount(entry) ? mine : entry;\n });\n const older = carried.slice(0, anchor).filter((entry) => {\n const id = entryId(entry);\n return id !== undefined && !held.has(id);\n });\n return [...older, ...read, ...carried.slice(anchor + 1)];\n}\n\n/** What a surface shows of one card's or lane's steps. */\nexport interface DeepAgentLaneHistoryState {\n /** The steps with the history read so far; the steps it carries before any. */\n readonly steps: readonly LangChainMessage[];\n /** Entries the transcript stores, when it is cut (a checkpointed lane's, once a page counted them). */\n readonly total: number | undefined;\n /** The host answers `history/lane` for this card or lane, and has not refused it. */\n readonly available: boolean;\n /** Entries older than the ones read remain, and can be asked for. */\n readonly hasEarlier: boolean;\n readonly loading: boolean;\n /** Read the page before the earliest entry read so far (the newest page first). */\n readonly loadEarlier: () => void;\n}\n\n/** One `history/lane` page as the pager holds it. */\ninterface LanePageData {\n /** The page's entries, oldest first. */\n readonly steps: readonly LangChainMessage[];\n readonly hasEarlier: boolean;\n readonly total: number;\n /** The card's whole transcript, read with `history/message`. */\n readonly whole: boolean;\n}\n\n/** One key per card or lane, so a card and a lane never share history or a refusal. */\nconst laneTargetKey = (target: DeepAgentLaneTarget): string =>\n target.lane !== undefined ? `lane:${target.lane}` : `card:${target.messageId}`;\n\n/**\n * The query key one card's or lane's pages are cached under. A finished card or\n * lane never changes, so its pages are kept while it is cached; a running one\n * is read afresh by each surface that mounts it (`mount`), since an old page of\n * a lane that kept running could leave a gap before the steps it carries now.\n */\nexport const deepAgentLaneHistoryQueryKey = ({\n target,\n mount,\n}: {\n target: string;\n mount?: number | undefined;\n}) => ['athena-deep-agent', 'history-lane', target, ...(mount === undefined ? [] : [mount])];\n\nlet mountCount = 0;\nconst nextMount = (): number => {\n mountCount += 1;\n return mountCount;\n};\n\ntype SendCommand = StatewireThread.Extras['sendCommand'];\n\n/** One page of `target`: `history/lane`, or the card whole when its entries carry no ids. */\nasync function readLanePage({\n sendCommand,\n target,\n at,\n}: {\n sendCommand: SendCommand;\n target: DeepAgentLaneTarget;\n at: string | undefined;\n}): Promise<LanePageData> {\n try {\n const page = readHistoryLanePage(await sendCommand(buildHistoryLaneCommand({ target, at })));\n if (page === null || !answers(page, target)) {\n throw new Error('history/lane answered another card or lane');\n }\n return { steps: page.steps, hasEarlier: page.hasEarlier, total: page.total, whole: false };\n } catch (error) {\n if (target.messageId === undefined || !isWholeCardRefusal(error)) throw error;\n const result = readHistoryMessageResult(\n await sendCommand(buildHistoryMessageCommand({ messageId: target.messageId }))\n );\n if (result === null || result.messageId !== target.messageId) {\n throw new Error('history/message answered another message');\n }\n const card: unknown = result.message;\n const steps = nestedMessagesFromArtifact(isRecord(card) ? card.artifact : undefined);\n return { steps, hasEarlier: false, total: steps.length, whole: true };\n }\n}\n\n/**\n * Pages one card's transcript, or one in-eval lane, through `history/lane` for\n * a surface that shows it whole, as a TanStack infinite query. `auto` reads\n * the newest page as soon as it is cut (an open transcript drawer); otherwise\n * nothing is read until `loadEarlier`. A card whose message id changes (its\n * result replaced the running placeholder) is a new query. A refusal is the\n * query's error: never retried or refetched, so it costs one command, and the\n * surface stays on the steps it carries with no error.\n */\nexport function useDeepAgentLaneHistory({\n messageId,\n lane,\n carried,\n total,\n finished = false,\n checkpointed = false,\n auto = false,\n}: {\n /** The card's message id, for a `task` lane. */\n messageId?: string | undefined;\n /** The dispatch id, for an in-eval lane; wins over `messageId`. Neither: nothing to page. */\n lane?: string | undefined;\n /** The steps the card or the lane's registry entry carries. */\n carried: readonly LangChainMessage[];\n /** The cut marker's `messages`; `undefined` while every step rides. */\n total: number | undefined;\n /** The cut marker says the lane finished (only a host serving `history/lane` cuts a card then). */\n finished?: boolean;\n /**\n * No steps ride: an in-eval lane a later run or a reopen left only its\n * summary and namespace. It carries no steps and no marker, `history/lane`\n * pages its subagent's own steps from its checkpoint, and the first page\n * names their total.\n */\n checkpointed?: boolean;\n auto?: boolean;\n}): DeepAgentLaneHistoryState {\n const sendCommand = useAuiState((s) =>\n hasStatewireThreadExtras(s.thread.extras)\n ? (s.thread.extras as StatewireThread.Extras).sendCommand\n : undefined\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 sendRef = useRef(sendCommand);\n sendRef.current = sendCommand;\n const [mount] = useState(nextMount);\n const [asked, setAsked] = useState(false);\n\n const target = useMemo<DeepAgentLaneTarget | undefined>(\n () =>\n lane !== undefined ? { lane } : messageId !== undefined ? { messageId } : undefined,\n [lane, messageId]\n );\n // A checkpointed lane's steps were left off once its run had ended.\n const settled = finished || checkpointed;\n const askable =\n (total !== undefined || checkpointed) &&\n target !== undefined &&\n sendCommand !== undefined &&\n (target.lane !== undefined || settled || hostVersion >= DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION);\n\n const query = useInfiniteQuery<\n LanePageData,\n Error,\n InfiniteData<LanePageData, string | undefined>,\n readonly unknown[],\n string | undefined\n >({\n queryKey: deepAgentLaneHistoryQueryKey({\n target: target === undefined ? '' : laneTargetKey(target),\n mount: settled ? undefined : mount,\n }),\n queryFn: ({ pageParam }) => {\n const send = sendRef.current;\n if (target === undefined || send === undefined) {\n return Promise.reject(new Error('no statewire thread to read the lane from'));\n }\n return readLanePage({ sendCommand: send, target, at: pageParam });\n },\n initialPageParam: undefined,\n getNextPageParam: (last) => (last.hasEarlier ? entryId(last.steps[0]) : undefined),\n enabled: askable && (auto || asked),\n retry: false,\n retryOnMount: false,\n staleTime: Number.POSITIVE_INFINITY,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n });\n\n const pages = query.data?.pages;\n const history = useMemo(() => {\n if (pages === undefined || pages.length === 0) return null;\n // Pages arrive newest first; each is strictly older than the one before.\n const entries = [...pages].reverse().flatMap((page) => page.steps);\n return { entries, whole: pages[0]?.whole === true, total: pages[0]?.total ?? 0 };\n }, [pages]);\n const available = askable && !query.isError;\n const steps = useMemo(\n () =>\n history === null\n ? carried\n : mergeLaneHistory({ history: history.entries, carried, whole: history.whole }),\n [history, carried]\n );\n // Before its first page, a checkpointed lane has every step still to read.\n const hasEarlier =\n available &&\n (history === null ? checkpointed || steps.length < (total ?? 0) : query.hasNextPage);\n const loading = query.isFetching;\n const { fetchNextPage } = query;\n const loadEarlier = useCallback(() => {\n if (!hasEarlier || loading) return;\n if (history === null) setAsked(true);\n else void fetchNextPage();\n }, [fetchNextPage, hasEarlier, history, loading]);\n\n return {\n steps,\n // A lane read without a marker (a checkpointed one) counts what its pages say.\n total: total === undefined ? history?.total : Math.max(total, history?.total ?? 0),\n available,\n hasEarlier,\n loading,\n loadEarlier,\n };\n}\n"],"names":["DEEP_AGENT_HISTORY_LANE_COMMAND","DEEP_AGENT_MAX_LANE_PAGE","DEEP_AGENT_HISTORY_MESSAGE_COMMAND","readHistoryMessageResult","buildHistoryMessageCommand","nestedMessagesFromArtifact","useAuiState","hasStatewireThreadExtras","readDeepAgentProtocol","useRef","useState","useMemo","DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION","useInfiniteQuery","_a","useCallback"],"mappings":";;;;;;;;;;AAwDA,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,UAAU,CAAC,UAAuC;AACtD,QAAM,KAAK,SAAS,KAAK,IAAI,MAAM,KAAK;AACxC,SAAO,OAAO,OAAO,WAAW,KAAK;AACvC;AAkCO,SAAS,wBAAwB;AAAA,EACtC;AAAA,EACA;AACF,GAGuB;AACrB,SAAO;AAAA,IACL,MAAMA,kBAAAA;AAAAA,IACN,GAAI,OAAO,SAAS,SAAY,EAAE,MAAM,OAAO,SAAS,EAAE,WAAW,OAAO,UAAA;AAAA,IAC5E,QAAQC,kBAAAA;AAAAA,IACR,GAAI,OAAO,UAAa,EAAE,GAAA;AAAA,EAAG;AAEjC;AAgBA,MAAM,WAAW,CAAC,UAChB,OAAO,UAAU,YAAY,QAAQ,QAAQ;AAExC,SAAS,oBAAoB,SAA0C;AAC5E,MAAI,CAAC,SAAS,OAAO,EAAG,QAAO;AAC/B,QAAM,EAAE,OAAO,MAAM,MAAA,IAAU;AAC/B,QAAM,YAAY,SAAS,QAAQ,SAAS;AAC5C,QAAM,OAAO,SAAS,QAAQ,IAAI;AAClC,MAAK,cAAc,UAAW,SAAS,SAAS,CAAC,MAAM,QAAQ,KAAK,E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,SAAS,SAAS,OAAO,QAAQ,OAAO;AAAA,IAClF,CAAC,SAAS,OAAO;AAAA,EAAA;AAGnB,QAAM,aACJ,cACC,YAAY,OAAO,gBAAgB,MAAM,UAAU,SAAS,KAAK,MAAM;AAC1E,QAAM,UAAU,MAAM;AACtB,QAAM,EAAE,kBAAkB;AAC1B,QAAM,cAAcI,MAAAA,YAAY,MAAM;AACpC,QAAI,CAAC,cAAc,QAAS;AAC5B,QAAI,YAAY,KAAM,UAAS,IAAI;AAAA,cACzB,cAAA;AAAA,EACZ,GAAG,CAAC,eAAe,YAAY,SAAS,OAAO,CAAC;AAEhD,SAAO;AAAA,IACL;AAAA;AAAA,IAEA,OAAO,UAAU,SAAY,mCAAS,QAAQ,KAAK,IAAI,QAAO,mCAAS,UAAS,CAAC;AAAA,IACjF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;;;;;;;"}
@@ -0,0 +1,175 @@
1
+ /**
2
+ * A card's whole nested transcript on demand — the client half of agora's
3
+ * `history/lane` read command.
4
+ *
5
+ * A card's own document carries its nested transcript (a `task` subagent's
6
+ * lane) cut to its newest entries whenever older ones are left off — a running
7
+ * card always, and on a version-2 view a finished one too — counting the whole
8
+ * stored transcript under `athena_lane_truncated`. `history/lane`
9
+ * `{messageId, before, at?}` answers a page of it: the newest `before` entries,
10
+ * or those strictly older than `at`, oldest first, each projected like a
11
+ * followed lane step (every inline image a placeholder), with
12
+ * `{more: {before}, total}`. {@link useDeepAgentLaneHistory} pages one card's
13
+ * transcript for a surface that shows it whole, and {@link mergeLaneHistory}
14
+ * reads the pages in under the card's own live entries.
15
+ *
16
+ * An in-eval dispatch's lane (`task()` inside `eval`) streams the same way on
17
+ * its `ptc_subagents` registry entry: its newest steps, the marker counting the
18
+ * lane, running or finished. `history/lane` `{lane, before, at?}` pages it by
19
+ * the dispatch id (the registry key, never with `messageId`), and answers the
20
+ * same page with `lane` set and `messageId` null. A lane whose steps no longer
21
+ * ride pages the same way from its subagent checkpoint once agora recorded its
22
+ * namespace (`ns`), `checkpointed`: a previous run's lane in this activation
23
+ * (a later run left its registry entry only its summary and `ns`), or a
24
+ * reopened session's (the registry died with the activation that streamed it,
25
+ * and the summary its eval persisted records `ns`). It carries no steps, and
26
+ * the first page names the total.
27
+ *
28
+ * Only a cut card or lane is paged. A finished card is cut only by a host that
29
+ * serves `history/lane`, so it is always asked, and so is a cut in-eval lane
30
+ * (a client that never sends `lane` needs no gate); a running card is asked
31
+ * only when the host's `protocol` lane advertises
32
+ * `DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION`. A card whose entries carry no ids
33
+ * cannot be paged: the host says to read the card whole with
34
+ * `history/message`, and that one read stands for the lane. Any other refusal
35
+ * (an older pod answers `history/lane` as an unknown command, or wants a
36
+ * `messageId`; a lane with no recorded checkpoint) leaves the surface on the
37
+ * entries it carries: no error, and that mount never asks again.
38
+ *
39
+ * Surfaces opt in. A surface that pages nothing ships none of this.
40
+ */
41
+ import type { LangChainMessage } from '@assistant-ui/react-langgraph';
42
+ import { DEEP_AGENT_HISTORY_LANE_COMMAND } from './generated/runconfig-contract';
43
+ /**
44
+ * The `history/lane` read command on the statewire command union, so
45
+ * `sendCommand({ type: 'history/lane', … })` typechecks wherever the deep-agent
46
+ * host is driven (an attach-ACL read, like `history/message`).
47
+ */
48
+ declare module '@assistant-ui/core' {
49
+ namespace Assistant {
50
+ interface Commands {
51
+ /** A page of one card's nested transcript. */
52
+ historyLane: HistoryLaneCommand;
53
+ }
54
+ }
55
+ }
56
+ /**
57
+ * What one `history/lane` read pages: a card's nested transcript, by the card's
58
+ * message id (a finished card or a running placeholder), or an in-eval
59
+ * dispatch's lane, by its dispatch id.
60
+ */
61
+ export type DeepAgentLaneTarget = {
62
+ readonly messageId: string;
63
+ readonly lane?: undefined;
64
+ } | {
65
+ readonly lane: string;
66
+ readonly messageId?: undefined;
67
+ };
68
+ /** The `history/lane` command: a page of one card's or lane's steps, oldest first. */
69
+ export type HistoryLaneCommand = {
70
+ readonly type: typeof DEEP_AGENT_HISTORY_LANE_COMMAND;
71
+ /** Entries in the page (`1..DEEP_AGENT_MAX_LANE_PAGE`). */
72
+ readonly before: number;
73
+ /** An entry id: the page holds the entries strictly older than it. Without it, the newest. */
74
+ readonly at?: string;
75
+ } & ({
76
+ readonly messageId: string;
77
+ } | {
78
+ readonly lane: string;
79
+ });
80
+ export declare function buildHistoryLaneCommand({ target, at, }: {
81
+ target: DeepAgentLaneTarget;
82
+ at?: string | undefined;
83
+ }): HistoryLaneCommand;
84
+ /** One page `history/lane` answered. */
85
+ export interface HistoryLanePage {
86
+ /** The card it pages; `null` for a lane. */
87
+ readonly messageId: string | null;
88
+ /** The in-eval lane it pages; `null` for a card (a host that predates lanes leaves it out). */
89
+ readonly lane: string | null;
90
+ /** The page's entries, oldest first; an entry without a string id is never in one. */
91
+ readonly steps: readonly LangChainMessage[];
92
+ /** Whether entries older than the page remain. */
93
+ readonly hasEarlier: boolean;
94
+ /** Entries the card's transcript, or the lane's checkpoint, stores. */
95
+ readonly total: number;
96
+ }
97
+ export declare function readHistoryLanePage(payload: unknown): HistoryLanePage | null;
98
+ /**
99
+ * Whether `history/lane` was refused because the lane's entries carry no ids
100
+ * to page by: the host names `history/message` as the way to read the card.
101
+ */
102
+ export declare function isWholeCardRefusal(error: unknown): boolean;
103
+ /**
104
+ * A card's transcript with its paged history read in: the history (whole,
105
+ * oldest first), then the card's own entries newer than the last one the
106
+ * history holds — what the lane did since the history was read. The card's
107
+ * entries older than that one and not in the history yet (a page cut short by
108
+ * its size, or a turn the card keeps for a result it holds) come first, so the
109
+ * view never shows less than the card. An entry the card also carries is the
110
+ * card's copy, which is the newer one: a page is a snapshot, which can catch a
111
+ * step mid-stream, and leaves every inline image a placeholder. The exception
112
+ * is a turn the card keeps cut to the calls it holds results for, which
113
+ * carries fewer calls than the page's copy. Without history, the card's own
114
+ * entries. `whole` history is the card's entire transcript as it was read;
115
+ * when none of its entries can be matched to the card's (they carry no ids),
116
+ * it stands alone.
117
+ */
118
+ export declare function mergeLaneHistory({ history, carried, whole, }: {
119
+ history: readonly LangChainMessage[];
120
+ carried: readonly LangChainMessage[];
121
+ whole?: boolean;
122
+ }): readonly LangChainMessage[];
123
+ /** What a surface shows of one card's or lane's steps. */
124
+ export interface DeepAgentLaneHistoryState {
125
+ /** The steps with the history read so far; the steps it carries before any. */
126
+ readonly steps: readonly LangChainMessage[];
127
+ /** Entries the transcript stores, when it is cut (a checkpointed lane's, once a page counted them). */
128
+ readonly total: number | undefined;
129
+ /** The host answers `history/lane` for this card or lane, and has not refused it. */
130
+ readonly available: boolean;
131
+ /** Entries older than the ones read remain, and can be asked for. */
132
+ readonly hasEarlier: boolean;
133
+ readonly loading: boolean;
134
+ /** Read the page before the earliest entry read so far (the newest page first). */
135
+ readonly loadEarlier: () => void;
136
+ }
137
+ /**
138
+ * The query key one card's or lane's pages are cached under. A finished card or
139
+ * lane never changes, so its pages are kept while it is cached; a running one
140
+ * is read afresh by each surface that mounts it (`mount`), since an old page of
141
+ * a lane that kept running could leave a gap before the steps it carries now.
142
+ */
143
+ export declare const deepAgentLaneHistoryQueryKey: ({ target, mount, }: {
144
+ target: string;
145
+ mount?: number | undefined;
146
+ }) => (string | number)[];
147
+ /**
148
+ * Pages one card's transcript, or one in-eval lane, through `history/lane` for
149
+ * a surface that shows it whole, as a TanStack infinite query. `auto` reads
150
+ * the newest page as soon as it is cut (an open transcript drawer); otherwise
151
+ * nothing is read until `loadEarlier`. A card whose message id changes (its
152
+ * result replaced the running placeholder) is a new query. A refusal is the
153
+ * query's error: never retried or refetched, so it costs one command, and the
154
+ * surface stays on the steps it carries with no error.
155
+ */
156
+ export declare function useDeepAgentLaneHistory({ messageId, lane, carried, total, finished, checkpointed, auto, }: {
157
+ /** The card's message id, for a `task` lane. */
158
+ messageId?: string | undefined;
159
+ /** The dispatch id, for an in-eval lane; wins over `messageId`. Neither: nothing to page. */
160
+ lane?: string | undefined;
161
+ /** The steps the card or the lane's registry entry carries. */
162
+ carried: readonly LangChainMessage[];
163
+ /** The cut marker's `messages`; `undefined` while every step rides. */
164
+ total: number | undefined;
165
+ /** The cut marker says the lane finished (only a host serving `history/lane` cuts a card then). */
166
+ finished?: boolean;
167
+ /**
168
+ * No steps ride: an in-eval lane a later run or a reopen left only its
169
+ * summary and namespace. It carries no steps and no marker, `history/lane`
170
+ * pages its subagent's own steps from its checkpoint, and the first page
171
+ * names their total.
172
+ */
173
+ checkpointed?: boolean;
174
+ auto?: boolean;
175
+ }): DeepAgentLaneHistoryState;