@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,209 @@
1
+ import { useAuiState } from "@assistant-ui/store";
2
+ import { useInfiniteQuery } from "@tanstack/react-query";
3
+ import { useRef, useState, useMemo, useCallback } from "react";
4
+ import { DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION, DEEP_AGENT_MAX_LANE_PAGE, DEEP_AGENT_HISTORY_LANE_COMMAND, DEEP_AGENT_HISTORY_MESSAGE_COMMAND } from "./generated/runconfig-contract.js";
5
+ import { readHistoryMessageResult, buildHistoryMessageCommand } from "./message-window.js";
6
+ import { readDeepAgentProtocol } from "./protocol.js";
7
+ import { nestedMessagesFromArtifact } from "./subagents.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 entryId = (entry) => {
12
+ const id = isRecord(entry) ? entry.id : void 0;
13
+ return typeof id === "string" ? id : void 0;
14
+ };
15
+ function buildHistoryLaneCommand({
16
+ target,
17
+ at
18
+ }) {
19
+ return {
20
+ type: DEEP_AGENT_HISTORY_LANE_COMMAND,
21
+ ...target.lane !== void 0 ? { lane: target.lane } : { messageId: target.messageId },
22
+ before: DEEP_AGENT_MAX_LANE_PAGE,
23
+ ...at !== void 0 && { at }
24
+ };
25
+ }
26
+ const nonEmpty = (value) => typeof value === "string" && value ? value : null;
27
+ function readHistoryLanePage(payload) {
28
+ if (!isRecord(payload)) return null;
29
+ const { steps, more, total } = payload;
30
+ const messageId = nonEmpty(payload.messageId);
31
+ const lane = nonEmpty(payload.lane);
32
+ if (messageId === null === (lane === null) || !Array.isArray(steps)) return null;
33
+ if (!isRecord(more) || typeof more.before !== "boolean" || !isCount(total)) return null;
34
+ return {
35
+ messageId,
36
+ lane,
37
+ steps: steps.filter((step) => entryId(step) !== void 0),
38
+ hasEarlier: more.before,
39
+ total
40
+ };
41
+ }
42
+ const answers = (page, target) => target.lane !== void 0 ? page.lane === target.lane : page.messageId === target.messageId;
43
+ function isWholeCardRefusal(error) {
44
+ const failure = isRecord(error) ? error.failure : void 0;
45
+ return isRecord(failure) && failure.fate === "rejected" && typeof failure.message === "string" && failure.message.includes(DEEP_AGENT_HISTORY_MESSAGE_COMMAND);
46
+ }
47
+ const callCount = (entry) => {
48
+ var _a;
49
+ return entry.type === "ai" ? ((_a = entry.tool_calls) == null ? void 0 : _a.length) ?? 0 : 0;
50
+ };
51
+ function mergeLaneHistory({
52
+ history,
53
+ carried,
54
+ whole = false
55
+ }) {
56
+ if (history.length === 0) return carried;
57
+ const held = /* @__PURE__ */ new Set();
58
+ for (const entry of history) {
59
+ const id = entryId(entry);
60
+ if (id !== void 0) held.add(id);
61
+ }
62
+ let anchor = -1;
63
+ for (let index = carried.length - 1; index >= 0; index -= 1) {
64
+ const id = entryId(carried[index]);
65
+ if (id !== void 0 && held.has(id)) {
66
+ anchor = index;
67
+ break;
68
+ }
69
+ }
70
+ if (anchor < 0) return whole ? history : [...history, ...carried];
71
+ const own = /* @__PURE__ */ new Map();
72
+ for (const entry of carried) {
73
+ const id = entryId(entry);
74
+ if (id !== void 0) own.set(id, entry);
75
+ }
76
+ const read = history.map((entry) => {
77
+ const id = entryId(entry);
78
+ const mine = id === void 0 ? void 0 : own.get(id);
79
+ return mine !== void 0 && callCount(mine) >= callCount(entry) ? mine : entry;
80
+ });
81
+ const older = carried.slice(0, anchor).filter((entry) => {
82
+ const id = entryId(entry);
83
+ return id !== void 0 && !held.has(id);
84
+ });
85
+ return [...older, ...read, ...carried.slice(anchor + 1)];
86
+ }
87
+ const laneTargetKey = (target) => target.lane !== void 0 ? `lane:${target.lane}` : `card:${target.messageId}`;
88
+ const deepAgentLaneHistoryQueryKey = ({
89
+ target,
90
+ mount
91
+ }) => ["athena-deep-agent", "history-lane", target, ...mount === void 0 ? [] : [mount]];
92
+ let mountCount = 0;
93
+ const nextMount = () => {
94
+ mountCount += 1;
95
+ return mountCount;
96
+ };
97
+ async function readLanePage({
98
+ sendCommand,
99
+ target,
100
+ at
101
+ }) {
102
+ try {
103
+ const page = readHistoryLanePage(await sendCommand(buildHistoryLaneCommand({ target, at })));
104
+ if (page === null || !answers(page, target)) {
105
+ throw new Error("history/lane answered another card or lane");
106
+ }
107
+ return { steps: page.steps, hasEarlier: page.hasEarlier, total: page.total, whole: false };
108
+ } catch (error) {
109
+ if (target.messageId === void 0 || !isWholeCardRefusal(error)) throw error;
110
+ const result = readHistoryMessageResult(
111
+ await sendCommand(buildHistoryMessageCommand({ messageId: target.messageId }))
112
+ );
113
+ if (result === null || result.messageId !== target.messageId) {
114
+ throw new Error("history/message answered another message");
115
+ }
116
+ const card = result.message;
117
+ const steps = nestedMessagesFromArtifact(isRecord(card) ? card.artifact : void 0);
118
+ return { steps, hasEarlier: false, total: steps.length, whole: true };
119
+ }
120
+ }
121
+ function useDeepAgentLaneHistory({
122
+ messageId,
123
+ lane,
124
+ carried,
125
+ total,
126
+ finished = false,
127
+ checkpointed = false,
128
+ auto = false
129
+ }) {
130
+ var _a;
131
+ const sendCommand = useAuiState(
132
+ (s) => hasStatewireThreadExtras(s.thread.extras) ? s.thread.extras.sendCommand : void 0
133
+ );
134
+ const hostVersion = useAuiState((s) => {
135
+ var _a2;
136
+ const extras = s.thread.extras;
137
+ return ((_a2 = readDeepAgentProtocol(extras == null ? void 0 : extras.state)) == null ? void 0 : _a2.version) ?? 0;
138
+ });
139
+ const sendRef = useRef(sendCommand);
140
+ sendRef.current = sendCommand;
141
+ const [mount] = useState(nextMount);
142
+ const [asked, setAsked] = useState(false);
143
+ const target = useMemo(
144
+ () => lane !== void 0 ? { lane } : messageId !== void 0 ? { messageId } : void 0,
145
+ [lane, messageId]
146
+ );
147
+ const settled = finished || checkpointed;
148
+ const askable = (total !== void 0 || checkpointed) && target !== void 0 && sendCommand !== void 0 && (target.lane !== void 0 || settled || hostVersion >= DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION);
149
+ const query = useInfiniteQuery({
150
+ queryKey: deepAgentLaneHistoryQueryKey({
151
+ target: target === void 0 ? "" : laneTargetKey(target),
152
+ mount: settled ? void 0 : mount
153
+ }),
154
+ queryFn: ({ pageParam }) => {
155
+ const send = sendRef.current;
156
+ if (target === void 0 || send === void 0) {
157
+ return Promise.reject(new Error("no statewire thread to read the lane from"));
158
+ }
159
+ return readLanePage({ sendCommand: send, target, at: pageParam });
160
+ },
161
+ initialPageParam: void 0,
162
+ getNextPageParam: (last) => last.hasEarlier ? entryId(last.steps[0]) : void 0,
163
+ enabled: askable && (auto || asked),
164
+ retry: false,
165
+ retryOnMount: false,
166
+ staleTime: Number.POSITIVE_INFINITY,
167
+ refetchOnMount: false,
168
+ refetchOnWindowFocus: false,
169
+ refetchOnReconnect: false
170
+ });
171
+ const pages = (_a = query.data) == null ? void 0 : _a.pages;
172
+ const history = useMemo(() => {
173
+ var _a2, _b;
174
+ if (pages === void 0 || pages.length === 0) return null;
175
+ const entries = [...pages].reverse().flatMap((page) => page.steps);
176
+ return { entries, whole: ((_a2 = pages[0]) == null ? void 0 : _a2.whole) === true, total: ((_b = pages[0]) == null ? void 0 : _b.total) ?? 0 };
177
+ }, [pages]);
178
+ const available = askable && !query.isError;
179
+ const steps = useMemo(
180
+ () => history === null ? carried : mergeLaneHistory({ history: history.entries, carried, whole: history.whole }),
181
+ [history, carried]
182
+ );
183
+ const hasEarlier = available && (history === null ? checkpointed || steps.length < (total ?? 0) : query.hasNextPage);
184
+ const loading = query.isFetching;
185
+ const { fetchNextPage } = query;
186
+ const loadEarlier = useCallback(() => {
187
+ if (!hasEarlier || loading) return;
188
+ if (history === null) setAsked(true);
189
+ else void fetchNextPage();
190
+ }, [fetchNextPage, hasEarlier, history, loading]);
191
+ return {
192
+ steps,
193
+ // A lane read without a marker (a checkpointed one) counts what its pages say.
194
+ total: total === void 0 ? history == null ? void 0 : history.total : Math.max(total, (history == null ? void 0 : history.total) ?? 0),
195
+ available,
196
+ hasEarlier,
197
+ loading,
198
+ loadEarlier
199
+ };
200
+ }
201
+ export {
202
+ buildHistoryLaneCommand,
203
+ deepAgentLaneHistoryQueryKey,
204
+ isWholeCardRefusal,
205
+ mergeLaneHistory,
206
+ readHistoryLanePage,
207
+ useDeepAgentLaneHistory
208
+ };
209
+ //# sourceMappingURL=lane-history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lane-history.js","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":["_a"],"mappings":"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"}
@@ -0,0 +1,184 @@
1
+ /**
2
+ * A lane step's inline images on demand — the client half of agora's
3
+ * `history/lane_image` read command.
4
+ *
5
+ * A subagent lane's steps ride (on a cut card, on an in-eval lane's registry
6
+ * entry, and in every `history/lane` page) with each inline image left off: the
7
+ * block keeps its own shape with a neutral PNG tile in its payload slot
8
+ * (`DEEP_AGENT_OMITTED_IMAGE_PLACEHOLDER_URL`) and
9
+ * `athena_image_omitted: {index, chars, mediaType}` beside it, `index` being
10
+ * the block's position in the stored step's content. `history/lane_image`
11
+ * `{messageId | lane, step, index, offset?}` answers that image's `data:` URL
12
+ * in chunks, exactly as `history/image` answers a top-level message's:
13
+ * `{messageId, lane, step, index, mediaType, offset, total, chunk, next}`, the
14
+ * chunks joined in order being the URL and `next` the offset to ask for next
15
+ * (`null` after the last). {@link readChunkedInlineImage} is that loop, for
16
+ * either command.
17
+ *
18
+ * {@link useDeepAgentLaneImages} reads a lane's images for a surface that
19
+ * shows its steps, lazily, one image at a time as its tile comes into view.
20
+ * The steps it hands back carry each image read so far in its block, and each
21
+ * placeholder still waiting tagged with the image it stands for: its payload
22
+ * slot keeps the tile, with a `#athena-lane-image=` fragment naming the step
23
+ * and index ({@link readLaneImageTile}). A `data:` URL's fragment is no part of
24
+ * its data, so the tile still draws, and whatever card draws it, the `<img>`
25
+ * names its own image. Nothing is read until the surface reports a tile
26
+ * (`request`); each image is one TanStack query cached per (card | lane, step,
27
+ * index), and at most two are read at a time. Any refusal (an older pod's
28
+ * unknown command, an unknown card or lane, a step the lane does not hold, no
29
+ * inline image at that index, an offset past its end) leaves that image's
30
+ * tile: no error, and no second ask while the refusal is cached.
31
+ *
32
+ * Surfaces opt in. A surface that reads no lane image ships none of this.
33
+ */
34
+ import type { LangChainMessage } from '@assistant-ui/react-langgraph';
35
+ import type { StatewireThread } from '@assistant-ui/react-statewire';
36
+ import { DEEP_AGENT_HISTORY_LANE_IMAGE_COMMAND } from './generated/runconfig-contract';
37
+ import type { DeepAgentLaneTarget } from './lane-history';
38
+ /**
39
+ * The `history/lane_image` read command on the statewire command union, so
40
+ * `sendCommand({ type: 'history/lane_image', … })` typechecks wherever the
41
+ * deep-agent host is driven (an attach-ACL read, like `history/image`).
42
+ */
43
+ declare module '@assistant-ui/core' {
44
+ namespace Assistant {
45
+ interface Commands {
46
+ /** One chunk of an inline image a lane step carries as a placeholder. */
47
+ historyLaneImage: HistoryLaneImageCommand;
48
+ }
49
+ }
50
+ }
51
+ /** The `history/lane_image` command: one chunk of one lane step's inline image. */
52
+ export type HistoryLaneImageCommand = {
53
+ readonly type: typeof DEEP_AGENT_HISTORY_LANE_IMAGE_COMMAND;
54
+ /** The step's id. */
55
+ readonly step: string;
56
+ /** The block's position in the stored step's content: the placeholder's `athena_image_omitted.index`. */
57
+ readonly index: number;
58
+ /** Where the chunk starts in the image's `data:` URL; the start when absent. */
59
+ readonly offset?: number;
60
+ } & ({
61
+ readonly messageId: string;
62
+ } | {
63
+ readonly lane: string;
64
+ });
65
+ export declare function buildHistoryLaneImageCommand({ target, step, index, offset, }: {
66
+ target: DeepAgentLaneTarget;
67
+ step: string;
68
+ index: number;
69
+ offset?: number;
70
+ }): HistoryLaneImageCommand;
71
+ /** One chunk of an inline image's `data:` URL, as `history/image` and `history/lane_image` answer it. */
72
+ export interface InlineImageChunk {
73
+ readonly index: number;
74
+ /** The image's declared media type; `null` when the store declares none. */
75
+ readonly mediaType: string | null;
76
+ readonly offset: number;
77
+ /** The whole URL's length. */
78
+ readonly total: number;
79
+ readonly chunk: string;
80
+ /** Where the next chunk starts; `null` after the last. */
81
+ readonly next: number | null;
82
+ }
83
+ /** The keys `history/image` and `history/lane_image` answer alike; `null` for anything else. */
84
+ export declare function readInlineImageChunk(payload: unknown): InlineImageChunk | null;
85
+ /** One `history/lane_image` answer: an image chunk, and the card or lane and step it belongs to. */
86
+ export interface HistoryLaneImageChunk extends InlineImageChunk {
87
+ /** The card it reads; `null` for a lane. */
88
+ readonly messageId: string | null;
89
+ /** The in-eval lane it reads; `null` for a card. */
90
+ readonly lane: string | null;
91
+ readonly step: string;
92
+ }
93
+ export declare function readHistoryLaneImageChunk(payload: unknown): HistoryLaneImageChunk | null;
94
+ /** An inline image read whole. */
95
+ export interface InlineImage {
96
+ /** The image's `data:` URL. */
97
+ readonly url: string;
98
+ readonly mediaType: string | null;
99
+ }
100
+ /**
101
+ * Reads one inline image whole, chunk by chunk: the start, then each `next`
102
+ * the host names, until it names none. Each answer must start where it was
103
+ * asked, keep the first answer's `total`, carry the chunk up to `next`, and end
104
+ * the URL exactly at `total`; anything else throws. A cancelled `signal`
105
+ * rejects at once, without waiting for an answer still out. `read` sends one
106
+ * request and returns its answer, checked against the request.
107
+ */
108
+ export declare function readChunkedInlineImage({ read, signal, }: {
109
+ read: (offset: number) => Promise<InlineImageChunk>;
110
+ signal?: AbortSignal | undefined;
111
+ }): Promise<InlineImage>;
112
+ /** One lane step's image: the step's id and the block's stored index (`athena_image_omitted.index`). */
113
+ export interface LaneImageRef {
114
+ readonly step: string;
115
+ readonly index: number;
116
+ }
117
+ /** Every image a lane's steps carry as a placeholder, in step and content order. */
118
+ export declare function omittedLaneImages(steps: readonly LangChainMessage[]): readonly LaneImageRef[];
119
+ /** The key one lane image is held under in a surface's image map. */
120
+ export declare const laneImageKey: ({ step, index }: LaneImageRef) => string;
121
+ /**
122
+ * The image a tile stands for, read off the `src` its `<img>` draws: a waiting
123
+ * placeholder's payload carries `#athena-lane-image=<index>:<step>`. `null` for
124
+ * any other picture (a read image, the host's untagged tile, any URL at all).
125
+ */
126
+ export declare function readLaneImageTile(src: string | null | undefined): LaneImageRef | null;
127
+ /**
128
+ * A lane's steps as a surface shows them: each image `images` holds back in
129
+ * its placeholder's block, and each other placeholder's tile tagged with the
130
+ * image it stands for (see {@link readLaneImageTile}). A step without
131
+ * placeholders is the step itself, and the same steps and images give back the
132
+ * same step objects, so a conversion memory sees an unchanged step as
133
+ * unchanged. Without any placeholder, `steps` itself.
134
+ */
135
+ export declare function showLaneImages({ steps, images, }: {
136
+ steps: readonly LangChainMessage[];
137
+ images: ReadonlyMap<string, InlineImage>;
138
+ }): readonly LangChainMessage[];
139
+ type SendCommand = StatewireThread.Extras['sendCommand'];
140
+ /** One lane image, read whole through `history/lane_image`. */
141
+ export declare function readLaneImage({ sendCommand, target, step, index, signal, }: {
142
+ sendCommand: SendCommand;
143
+ target: DeepAgentLaneTarget;
144
+ step: string;
145
+ index: number;
146
+ signal?: AbortSignal | undefined;
147
+ }): Promise<InlineImage>;
148
+ /** The query key one lane image is cached under: per card or lane, step and index. */
149
+ export declare const deepAgentLaneImageQueryKey: ({ target, step, index, }: {
150
+ target: string;
151
+ step: string;
152
+ index: number;
153
+ }) => (string | number)[];
154
+ /** What a surface shows of a lane's steps, with the images read so far. */
155
+ export interface DeepAgentLaneImagesState {
156
+ /** The steps, each image read so far back in its block and each other placeholder's tile tagged. */
157
+ readonly steps: readonly LangChainMessage[];
158
+ /** Tiles remain whose image nobody asked for yet, on a host the images can be read from. */
159
+ readonly pending: boolean;
160
+ /**
161
+ * Read the image a tile the surface shows stands for ({@link readLaneImageTile}).
162
+ * An image the steps do not carry is never read; asking again costs nothing.
163
+ */
164
+ readonly request: (image: LaneImageRef) => void;
165
+ }
166
+ /**
167
+ * Reads a lane's images as a surface shows them, through `history/lane_image`,
168
+ * each a TanStack query: nothing until `request` names the image a tile stands
169
+ * for, then that image alone, at most two at a time across the tab. A read
170
+ * image is cached per card or lane, step and index, so another surface showing
171
+ * it reads nothing. The card a running `task` lane rides changes id when its
172
+ * result lands: an image this hook already read is kept for the new card,
173
+ * never read again. A refusal is the query's error, never retried or
174
+ * refetched: the image stays its tile.
175
+ */
176
+ export declare function useDeepAgentLaneImages({ messageId, lane, steps, }: {
177
+ /** The card's message id, for a `task` lane. */
178
+ messageId?: string | undefined;
179
+ /** The dispatch id, for an in-eval lane; wins over `messageId`. Neither: nothing is read. */
180
+ lane?: string | undefined;
181
+ /** The steps the surface shows. */
182
+ steps: readonly LangChainMessage[];
183
+ }): DeepAgentLaneImagesState;
184
+ export {};
@@ -0,0 +1,43 @@
1
+ import type { StatewireThread } from '@assistant-ui/react-statewire';
2
+ /**
3
+ * `metadata.custom` key carrying who sent a human turn.
4
+ *
5
+ * The backend stamps it on every persisted human turn from the authenticated
6
+ * sender (`agora/.../message_author.py`), and on the host `meta` of every
7
+ * run-lane entry it admits (`statewire_host._op_meta`), so a queued or
8
+ * just-sent bubble is attributable before the turn is materialised — on every
9
+ * client on the thread, not only the sender's.
10
+ */
11
+ export declare const ATHENA_MESSAGE_AUTHOR_KEY = "author";
12
+ /** Identity of the human who sent a message, as the backend stamps it. */
13
+ export interface DeepAgentMessageAuthor {
14
+ user_id: string;
15
+ name: string | null;
16
+ email: string | null;
17
+ avatar_url: string | null;
18
+ }
19
+ /**
20
+ * Parse an author envelope off a wire value.
21
+ *
22
+ * Tolerates absent optional fields (a principal without a name or picture);
23
+ * an envelope without a string `user_id` is no author at all — an
24
+ * identity-less stamp would only mislead the gate that decides whether a
25
+ * transcript has several human participants.
26
+ */
27
+ export declare function readMessageAuthor(value: unknown): DeepAgentMessageAuthor | null;
28
+ /** Field-wise equality, so hosts can hold a stable identity across renders. */
29
+ export declare function isSameMessageAuthor(a: DeepAgentMessageAuthor | null, b: DeepAgentMessageAuthor | null): boolean;
30
+ /**
31
+ * Who sent a run-lane entry, for its optimistic bubble.
32
+ *
33
+ * Only two sources are trusted. The host stamps `meta` on every entry it
34
+ * admits, so `meta.author` is the server's word on the submitter and is what
35
+ * every OTHER client on the thread renders. An entry with no `meta` at all is
36
+ * this client's own optimistic fold — the send is still in flight — so it is
37
+ * the viewer's (`selfAuthor`), matching what the host stamps on
38
+ * acknowledgment. The entry's client-supplied `metadata` is never consulted:
39
+ * a client that could set it could attribute its words to another
40
+ * collaborator. A host-stamped entry without an author (a host predating the
41
+ * stamp) yields none, so the surface falls back to its own attribution rule.
42
+ */
43
+ export declare function laneEntryAuthor(entry: StatewireThread.RunsQueueEntry, selfAuthor: DeepAgentMessageAuthor | null | undefined): DeepAgentMessageAuthor | null;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ function getMessageText(message) {
4
+ if (!message) return "";
5
+ const { content } = message;
6
+ if (typeof content === "string") return content;
7
+ if (Array.isArray(content)) {
8
+ return content.map(
9
+ (part) => part && typeof part === "object" && "text" in part ? String(part.text ?? "") : ""
10
+ ).filter(Boolean).join("");
11
+ }
12
+ return "";
13
+ }
14
+ exports.getMessageText = getMessageText;
15
+ //# sourceMappingURL=message-text.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-text.cjs","sources":["../../../../agent-runtime/src/message-text.ts"],"sourcesContent":["/**\n * LangChain message text/metadata accessors shared by every surface that reads\n * the deep agent's raw wire messages (Olympus chat, subagent cards, activity\n * panels). Pure parsing only — React selectors over these live with each\n * runtime host (e.g. Olympus `langchain-stream.ts`).\n */\nimport type { LangChainMessage } from '@assistant-ui/react-langgraph';\n\n/** A LangChain message enriched with a `.text` accessor so doc code can read `msg.text`. */\nexport type StreamMessage = LangChainMessage & { text: string };\n\ntype AiMessage = Extract<LangChainMessage, { type: 'ai' }>;\ntype ToolMsg = Extract<LangChainMessage, { type: 'tool' }>;\n\n/**\n * `.text` for any message: string content as-is, or the joined text parts of\n * complex content. Takes anything message-shaped: a tool-call part's result is\n * its ToolMessage's content (`getMessageText({ content: part.result })`).\n */\nexport function getMessageText(\n message: LangChainMessage | { readonly content?: unknown } | null | undefined\n): string {\n if (!message) return '';\n const { content } = message;\n if (typeof content === 'string') return content;\n if (Array.isArray(content)) {\n return content\n .map((part) =>\n part && typeof part === 'object' && 'text' in part\n ? String((part as { text?: unknown }).text ?? '')\n : ''\n )\n .filter(Boolean)\n .join('');\n }\n return '';\n}\n\n/** Mirrors `import { AIMessage } from \"langchain\"` → `AIMessage.isInstance(msg)`. */\nexport const AIMessage = {\n isInstance: (m: LangChainMessage | null | undefined): m is AiMessage => m?.type === 'ai',\n};\n\n/** Mirrors `import { ToolMessage } from \"langchain\"` → `ToolMessage.isInstance(msg)`. */\nexport const ToolMessage = {\n isInstance: (m: LangChainMessage | null | undefined): m is ToolMsg => m?.type === 'tool',\n};\n\n/**\n * Per-source cache for {@link enrichStreamMessage}. Every consumer re-maps the\n * full raw message list per state pass (once per streamed token), so without a\n * cache the whole thread's text is re-derived — and fresh enriched objects\n * allocated — per token per consumer. Object identity is a sound key: statewire\n * folds are copy-on-write, so a message whose content changes is REPLACED (new\n * identity), never mutated in place, and an unchanged message keeps its exact\n * identity across passes (pinned by `statewire-corpus.test.ts`).\n */\nconst enrichedMessageCache = new WeakMap<LangChainMessage, StreamMessage>();\n\n/**\n * The message with its `.text` precomputed — the `useStream`-shaped message\n * element. Memoized per source object: the same raw message yields the\n * IDENTICAL enriched object across calls and consumers, so per-token work is\n * O(changed messages), not O(thread).\n */\nexport function enrichStreamMessage(m: LangChainMessage): StreamMessage {\n const cached = enrichedMessageCache.get(m);\n if (cached !== undefined) return cached;\n const enriched = Object.assign({}, m, { text: getMessageText(m) }) as StreamMessage;\n enrichedMessageCache.set(m, enriched);\n return enriched;\n}\n\n/**\n * The model name a nested AI message reports, if any. The wire messages are full\n * LangChain dumps, so provider metadata rides on `response_metadata` (à la\n * `model_name` / `model`) even though the display-level type omits it.\n */\nexport function modelNameFromMessage(message: LangChainMessage): string | undefined {\n const metadata = (message as { response_metadata?: { model_name?: unknown; model?: unknown } })\n .response_metadata;\n if (typeof metadata?.model_name === 'string' && metadata.model_name) return metadata.model_name;\n if (typeof metadata?.model === 'string' && metadata.model) return metadata.model;\n return undefined;\n}\n"],"names":[],"mappings":";;AAmBO,SAAS,eACd,SACQ;AACR,MAAI,CAAC,QAAS,QAAO;AACrB,QAAM,EAAE,YAAY;AACpB,MAAI,OAAO,YAAY,SAAU,QAAO;AACxC,MAAI,MAAM,QAAQ,OAAO,GAAG;AAC1B,WAAO,QACJ;AAAA,MAAI,CAAC,SACJ,QAAQ,OAAO,SAAS,YAAY,UAAU,OAC1C,OAAQ,KAA4B,QAAQ,EAAE,IAC9C;AAAA,IAAA,EAEL,OAAO,OAAO,EACd,KAAK,EAAE;AAAA,EACZ;AACA,SAAO;AACT;;"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * LangChain message text/metadata accessors shared by every surface that reads
3
+ * the deep agent's raw wire messages (Olympus chat, subagent cards, activity
4
+ * panels). Pure parsing only — React selectors over these live with each
5
+ * runtime host (e.g. Olympus `langchain-stream.ts`).
6
+ */
7
+ import type { LangChainMessage } from '@assistant-ui/react-langgraph';
8
+ /** A LangChain message enriched with a `.text` accessor so doc code can read `msg.text`. */
9
+ export type StreamMessage = LangChainMessage & {
10
+ text: string;
11
+ };
12
+ type AiMessage = Extract<LangChainMessage, {
13
+ type: 'ai';
14
+ }>;
15
+ type ToolMsg = Extract<LangChainMessage, {
16
+ type: 'tool';
17
+ }>;
18
+ /**
19
+ * `.text` for any message: string content as-is, or the joined text parts of
20
+ * complex content. Takes anything message-shaped: a tool-call part's result is
21
+ * its ToolMessage's content (`getMessageText({ content: part.result })`).
22
+ */
23
+ export declare function getMessageText(message: LangChainMessage | {
24
+ readonly content?: unknown;
25
+ } | null | undefined): string;
26
+ /** Mirrors `import { AIMessage } from "langchain"` → `AIMessage.isInstance(msg)`. */
27
+ export declare const AIMessage: {
28
+ isInstance: (m: LangChainMessage | null | undefined) => m is AiMessage;
29
+ };
30
+ /** Mirrors `import { ToolMessage } from "langchain"` → `ToolMessage.isInstance(msg)`. */
31
+ export declare const ToolMessage: {
32
+ isInstance: (m: LangChainMessage | null | undefined) => m is ToolMsg;
33
+ };
34
+ /**
35
+ * The message with its `.text` precomputed — the `useStream`-shaped message
36
+ * element. Memoized per source object: the same raw message yields the
37
+ * IDENTICAL enriched object across calls and consumers, so per-token work is
38
+ * O(changed messages), not O(thread).
39
+ */
40
+ export declare function enrichStreamMessage(m: LangChainMessage): StreamMessage;
41
+ /**
42
+ * The model name a nested AI message reports, if any. The wire messages are full
43
+ * LangChain dumps, so provider metadata rides on `response_metadata` (à la
44
+ * `model_name` / `model`) even though the display-level type omits it.
45
+ */
46
+ export declare function modelNameFromMessage(message: LangChainMessage): string | undefined;
47
+ export {};
@@ -0,0 +1,15 @@
1
+ function getMessageText(message) {
2
+ if (!message) return "";
3
+ const { content } = message;
4
+ if (typeof content === "string") return content;
5
+ if (Array.isArray(content)) {
6
+ return content.map(
7
+ (part) => part && typeof part === "object" && "text" in part ? String(part.text ?? "") : ""
8
+ ).filter(Boolean).join("");
9
+ }
10
+ return "";
11
+ }
12
+ export {
13
+ getMessageText
14
+ };
15
+ //# sourceMappingURL=message-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-text.js","sources":["../../../../agent-runtime/src/message-text.ts"],"sourcesContent":["/**\n * LangChain message text/metadata accessors shared by every surface that reads\n * the deep agent's raw wire messages (Olympus chat, subagent cards, activity\n * panels). Pure parsing only — React selectors over these live with each\n * runtime host (e.g. Olympus `langchain-stream.ts`).\n */\nimport type { LangChainMessage } from '@assistant-ui/react-langgraph';\n\n/** A LangChain message enriched with a `.text` accessor so doc code can read `msg.text`. */\nexport type StreamMessage = LangChainMessage & { text: string };\n\ntype AiMessage = Extract<LangChainMessage, { type: 'ai' }>;\ntype ToolMsg = Extract<LangChainMessage, { type: 'tool' }>;\n\n/**\n * `.text` for any message: string content as-is, or the joined text parts of\n * complex content. Takes anything message-shaped: a tool-call part's result is\n * its ToolMessage's content (`getMessageText({ content: part.result })`).\n */\nexport function getMessageText(\n message: LangChainMessage | { readonly content?: unknown } | null | undefined\n): string {\n if (!message) return '';\n const { content } = message;\n if (typeof content === 'string') return content;\n if (Array.isArray(content)) {\n return content\n .map((part) =>\n part && typeof part === 'object' && 'text' in part\n ? String((part as { text?: unknown }).text ?? '')\n : ''\n )\n .filter(Boolean)\n .join('');\n }\n return '';\n}\n\n/** Mirrors `import { AIMessage } from \"langchain\"` → `AIMessage.isInstance(msg)`. */\nexport const AIMessage = {\n isInstance: (m: LangChainMessage | null | undefined): m is AiMessage => m?.type === 'ai',\n};\n\n/** Mirrors `import { ToolMessage } from \"langchain\"` → `ToolMessage.isInstance(msg)`. */\nexport const ToolMessage = {\n isInstance: (m: LangChainMessage | null | undefined): m is ToolMsg => m?.type === 'tool',\n};\n\n/**\n * Per-source cache for {@link enrichStreamMessage}. Every consumer re-maps the\n * full raw message list per state pass (once per streamed token), so without a\n * cache the whole thread's text is re-derived — and fresh enriched objects\n * allocated — per token per consumer. Object identity is a sound key: statewire\n * folds are copy-on-write, so a message whose content changes is REPLACED (new\n * identity), never mutated in place, and an unchanged message keeps its exact\n * identity across passes (pinned by `statewire-corpus.test.ts`).\n */\nconst enrichedMessageCache = new WeakMap<LangChainMessage, StreamMessage>();\n\n/**\n * The message with its `.text` precomputed — the `useStream`-shaped message\n * element. Memoized per source object: the same raw message yields the\n * IDENTICAL enriched object across calls and consumers, so per-token work is\n * O(changed messages), not O(thread).\n */\nexport function enrichStreamMessage(m: LangChainMessage): StreamMessage {\n const cached = enrichedMessageCache.get(m);\n if (cached !== undefined) return cached;\n const enriched = Object.assign({}, m, { text: getMessageText(m) }) as StreamMessage;\n enrichedMessageCache.set(m, enriched);\n return enriched;\n}\n\n/**\n * The model name a nested AI message reports, if any. The wire messages are full\n * LangChain dumps, so provider metadata rides on `response_metadata` (à la\n * `model_name` / `model`) even though the display-level type omits it.\n */\nexport function modelNameFromMessage(message: LangChainMessage): string | undefined {\n const metadata = (message as { response_metadata?: { model_name?: unknown; model?: unknown } })\n .response_metadata;\n if (typeof metadata?.model_name === 'string' && metadata.model_name) return metadata.model_name;\n if (typeof metadata?.model === 'string' && metadata.model) return metadata.model;\n return undefined;\n}\n"],"names":[],"mappings":"AAmBO,SAAS,eACd,SACQ;AACR,MAAI,CAAC,QAAS,QAAO;AACrB,QAAM,EAAE,YAAY;AACpB,MAAI,OAAO,YAAY,SAAU,QAAO;AACxC,MAAI,MAAM,QAAQ,OAAO,GAAG;AAC1B,WAAO,QACJ;AAAA,MAAI,CAAC,SACJ,QAAQ,OAAO,SAAS,YAAY,UAAU,OAC1C,OAAQ,KAA4B,QAAQ,EAAE,IAC9C;AAAA,IAAA,EAEL,OAAO,OAAO,EACd,KAAK,EAAE;AAAA,EACZ;AACA,SAAO;AACT;"}
@@ -118,7 +118,7 @@ function readDeepAgentMessageWindow(mounted) {
118
118
  const key = document.key;
119
119
  if (document.protocol === runconfigContract.DEEP_AGENT_INTEREST_PROTOCOL && document.main === true) {
120
120
  windows = (_a = readDeepAgentInterestDocument(document.value)) == null ? void 0 : _a.windows;
121
- } else if (document.protocol === statewireTransport.DEEP_AGENT_STATEWIRE_PROTOCOL && key !== null && key.length === 3 && key[1] === runconfigContract.DEEP_AGENT_MAIN_NS) {
121
+ } else if (document.protocol === statewireTransport.DEEP_AGENT_STATEWIRE_PROTOCOL && key !== null && key[1] === runconfigContract.DEEP_AGENT_MAIN_NS && (key.length === 3 || key.length === 4 && key[3] === runconfigContract.DEEP_AGENT_CUT_LANE_DOCUMENT)) {
122
122
  documents.set(key[2], document.value);
123
123
  }
124
124
  }
@@ -160,6 +160,18 @@ function readToolOutputResult(payload) {
160
160
  if (typeof messageId !== "string" || !messageId) return null;
161
161
  return { messageId, content };
162
162
  }
163
+ function buildHistoryMessageCommand({
164
+ messageId
165
+ }) {
166
+ return { type: runconfigContract.DEEP_AGENT_HISTORY_MESSAGE_COMMAND, messageId };
167
+ }
168
+ function readHistoryMessageResult(payload) {
169
+ if (typeof payload !== "object" || payload === null) return null;
170
+ const { messageId, message } = payload;
171
+ if (typeof messageId !== "string" || !messageId) return null;
172
+ if (typeof message !== "object" || message === null) return null;
173
+ return { messageId, message };
174
+ }
163
175
  function readTruncatedToolContent(message) {
164
176
  if (typeof message !== "object" || message === null) return null;
165
177
  const marker = message[runconfigContract.DEEP_AGENT_TRUNCATED_CONTENT_KEY];
@@ -177,6 +189,7 @@ function readTruncatedToolOutputArtifact(artifact) {
177
189
  return { chars, messageId };
178
190
  }
179
191
  exports.ATHENA_TRUNCATED_TOOL_OUTPUT_ARTIFACT_KEY = ATHENA_TRUNCATED_TOOL_OUTPUT_ARTIFACT_KEY;
192
+ exports.buildHistoryMessageCommand = buildHistoryMessageCommand;
180
193
  exports.buildToolOutputCommand = buildToolOutputCommand;
181
194
  exports.clampMessageWindowSize = clampMessageWindowSize;
182
195
  exports.headInterestRequest = headInterestRequest;
@@ -186,6 +199,7 @@ exports.pageInterestRequests = pageInterestRequests;
186
199
  exports.readDeepAgentInterestDocument = readDeepAgentInterestDocument;
187
200
  exports.readDeepAgentInterestResolution = readDeepAgentInterestResolution;
188
201
  exports.readDeepAgentMessageWindow = readDeepAgentMessageWindow;
202
+ exports.readHistoryMessageResult = readHistoryMessageResult;
189
203
  exports.readToolOutputResult = readToolOutputResult;
190
204
  exports.readTruncatedToolContent = readTruncatedToolContent;
191
205
  exports.readTruncatedToolOutputArtifact = readTruncatedToolOutputArtifact;