@athenaintel/react 0.41.2 → 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 (451) hide show
  1. package/README.md +108 -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.cjs +158 -0
  48. package/dist/agent-runtime/src/durable-thread-snapshot-cache.cjs.map +1 -0
  49. package/dist/agent-runtime/src/durable-thread-snapshot-cache.d.ts +60 -0
  50. package/dist/agent-runtime/src/durable-thread-snapshot-cache.js +158 -0
  51. package/dist/agent-runtime/src/durable-thread-snapshot-cache.js.map +1 -0
  52. package/dist/agent-runtime/src/edit-command.d.ts +156 -0
  53. package/dist/agent-runtime/src/errors.d.ts +174 -0
  54. package/dist/agent-runtime/src/execute-output.d.ts +31 -0
  55. package/dist/agent-runtime/src/generated/runconfig-contract.cjs +16 -2
  56. package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
  57. package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +202 -0
  58. package/dist/agent-runtime/src/generated/runconfig-contract.js +16 -2
  59. package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
  60. package/dist/agent-runtime/src/github-wake-event.d.ts +77 -0
  61. package/dist/agent-runtime/src/index.d.ts +74 -0
  62. package/dist/agent-runtime/src/interrupts.cjs +17 -0
  63. package/dist/agent-runtime/src/interrupts.cjs.map +1 -1
  64. package/dist/agent-runtime/src/interrupts.d.ts +348 -0
  65. package/dist/agent-runtime/src/interrupts.js +17 -0
  66. package/dist/agent-runtime/src/interrupts.js.map +1 -1
  67. package/dist/agent-runtime/src/lane-follow.d.ts +121 -0
  68. package/dist/agent-runtime/src/lane-history.cjs +209 -0
  69. package/dist/agent-runtime/src/lane-history.cjs.map +1 -0
  70. package/dist/agent-runtime/src/lane-history.d.ts +175 -0
  71. package/dist/agent-runtime/src/lane-history.js +209 -0
  72. package/dist/agent-runtime/src/lane-history.js.map +1 -0
  73. package/dist/agent-runtime/src/lane-images.d.ts +184 -0
  74. package/dist/agent-runtime/src/message-author.d.ts +43 -0
  75. package/dist/agent-runtime/src/message-text.cjs +15 -0
  76. package/dist/agent-runtime/src/message-text.cjs.map +1 -0
  77. package/dist/agent-runtime/src/message-text.d.ts +47 -0
  78. package/dist/agent-runtime/src/message-text.js +15 -0
  79. package/dist/agent-runtime/src/message-text.js.map +1 -0
  80. package/dist/agent-runtime/src/message-window.cjs +15 -1
  81. package/dist/agent-runtime/src/message-window.cjs.map +1 -1
  82. package/dist/agent-runtime/src/message-window.d.ts +159 -0
  83. package/dist/agent-runtime/src/message-window.js +16 -2
  84. package/dist/agent-runtime/src/message-window.js.map +1 -1
  85. package/dist/agent-runtime/src/messages.cjs +88 -4
  86. package/dist/agent-runtime/src/messages.cjs.map +1 -1
  87. package/dist/agent-runtime/src/messages.d.ts +603 -0
  88. package/dist/agent-runtime/src/messages.js +88 -4
  89. package/dist/agent-runtime/src/messages.js.map +1 -1
  90. package/dist/agent-runtime/src/model-context.d.ts +22 -0
  91. package/dist/agent-runtime/src/offline-status.d.ts +157 -0
  92. package/dist/agent-runtime/src/optimistic-content.d.ts +21 -0
  93. package/dist/agent-runtime/src/protocol.cjs +12 -4
  94. package/dist/agent-runtime/src/protocol.cjs.map +1 -1
  95. package/dist/agent-runtime/src/protocol.d.ts +119 -0
  96. package/dist/agent-runtime/src/protocol.js +13 -5
  97. package/dist/agent-runtime/src/protocol.js.map +1 -1
  98. package/dist/agent-runtime/src/ptc-subcalls.d.ts +51 -0
  99. package/dist/agent-runtime/src/queue.d.ts +138 -0
  100. package/dist/agent-runtime/src/quota-safe-local-storage-session.d.ts +154 -0
  101. package/dist/agent-runtime/src/running-tool-placeholder.cjs +11 -0
  102. package/dist/agent-runtime/src/running-tool-placeholder.cjs.map +1 -0
  103. package/dist/agent-runtime/src/running-tool-placeholder.d.ts +25 -0
  104. package/dist/agent-runtime/src/running-tool-placeholder.js +11 -0
  105. package/dist/agent-runtime/src/running-tool-placeholder.js.map +1 -0
  106. package/dist/agent-runtime/src/runtime-messages.d.ts +104 -0
  107. package/dist/agent-runtime/src/screen-point.d.ts +151 -0
  108. package/dist/agent-runtime/src/sealed-idb.cjs +112 -0
  109. package/dist/agent-runtime/src/sealed-idb.cjs.map +1 -0
  110. package/dist/agent-runtime/src/sealed-idb.d.ts +106 -0
  111. package/dist/agent-runtime/src/sealed-idb.js +112 -0
  112. package/dist/agent-runtime/src/sealed-idb.js.map +1 -0
  113. package/dist/agent-runtime/src/send-recovery.d.ts +40 -0
  114. package/dist/agent-runtime/src/statewire-attach-observer.d.ts +194 -0
  115. package/dist/agent-runtime/src/statewire-diagnostics.d.ts +74 -0
  116. package/dist/agent-runtime/src/statewire-state.d.ts +29 -0
  117. package/dist/agent-runtime/src/statewire-suspended.cjs.map +1 -1
  118. package/dist/agent-runtime/src/statewire-suspended.d.ts +27 -0
  119. package/dist/agent-runtime/src/statewire-suspended.js.map +1 -1
  120. package/dist/agent-runtime/src/statewire-transport.d.ts +40 -0
  121. package/dist/agent-runtime/src/streaming-markdown.d.ts +46 -0
  122. package/dist/agent-runtime/src/subagent-transcripts.cjs +209 -0
  123. package/dist/agent-runtime/src/subagent-transcripts.cjs.map +1 -0
  124. package/dist/agent-runtime/src/subagent-transcripts.d.ts +71 -0
  125. package/dist/agent-runtime/src/subagent-transcripts.js +209 -0
  126. package/dist/agent-runtime/src/subagent-transcripts.js.map +1 -0
  127. package/dist/agent-runtime/src/subagents.cjs +253 -0
  128. package/dist/agent-runtime/src/subagents.cjs.map +1 -0
  129. package/dist/agent-runtime/src/subagents.d.ts +311 -0
  130. package/dist/agent-runtime/src/subagents.js +253 -0
  131. package/dist/agent-runtime/src/subagents.js.map +1 -0
  132. package/dist/agent-runtime/src/subscription-wake-event.d.ts +111 -0
  133. package/dist/agent-runtime/src/thread-extras.d.ts +43 -0
  134. package/dist/agent-runtime/src/thread-handoff.d.ts +364 -0
  135. package/dist/agent-runtime/src/thread-prewarm-controller.d.ts +76 -0
  136. package/dist/agent-runtime/src/thread-prewarm.d.ts +118 -0
  137. package/dist/agent-runtime/src/thread-snapshot-cache.d.ts +99 -0
  138. package/dist/agent-runtime/src/thread-snapshot-mirror.cjs +329 -0
  139. package/dist/agent-runtime/src/thread-snapshot-mirror.cjs.map +1 -0
  140. package/dist/agent-runtime/src/thread-snapshot-mirror.d.ts +101 -0
  141. package/dist/agent-runtime/src/thread-snapshot-mirror.js +329 -0
  142. package/dist/agent-runtime/src/thread-snapshot-mirror.js.map +1 -0
  143. package/dist/agent-runtime/src/thread-status.d.ts +53 -0
  144. package/dist/agent-runtime/src/tool-metadata.d.ts +146 -0
  145. package/dist/agent-runtime/src/tool-names.cjs +67 -0
  146. package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
  147. package/dist/agent-runtime/src/tool-names.d.ts +60 -0
  148. package/dist/agent-runtime/src/tool-names.js +68 -1
  149. package/dist/agent-runtime/src/tool-names.js.map +1 -1
  150. package/dist/agent-runtime/src/tool-outputs.d.ts +35 -0
  151. package/dist/agent-runtime/src/tool-result.cjs +1 -0
  152. package/dist/agent-runtime/src/tool-result.cjs.map +1 -1
  153. package/dist/agent-runtime/src/tool-result.d.ts +126 -0
  154. package/dist/agent-runtime/src/tool-result.js +1 -0
  155. package/dist/agent-runtime/src/tool-result.js.map +1 -1
  156. package/dist/agent-runtime/src/types.d.ts +159 -0
  157. package/dist/agent-runtime/src/use-conversation-list.d.ts +76 -0
  158. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +136 -0
  159. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -0
  160. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +64 -0
  161. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +136 -0
  162. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -0
  163. package/dist/agent-runtime/src/use-deep-agent-config.d.ts +169 -0
  164. package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs +13 -0
  165. package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
  166. package/dist/agent-runtime/src/use-deep-agent-edit-submit.d.ts +22 -0
  167. package/dist/agent-runtime/src/use-deep-agent-edit-submit.js +13 -0
  168. package/dist/agent-runtime/src/use-deep-agent-edit-submit.js.map +1 -1
  169. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +20 -2
  170. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
  171. package/dist/agent-runtime/src/use-deep-agent-runtime.d.ts +168 -0
  172. package/dist/agent-runtime/src/use-deep-agent-runtime.js +20 -2
  173. package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
  174. package/dist/agent-runtime/src/use-deep-agent-thread.cjs +12 -4
  175. package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
  176. package/dist/agent-runtime/src/use-deep-agent-thread.d.ts +320 -0
  177. package/dist/agent-runtime/src/use-deep-agent-thread.js +12 -4
  178. package/dist/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
  179. package/dist/agent-runtime/src/use-deep-agent-voice.cjs +999 -0
  180. package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -0
  181. package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +409 -0
  182. package/dist/agent-runtime/src/use-deep-agent-voice.js +999 -0
  183. package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -0
  184. package/dist/agent-runtime/src/use-deep-agent-window-sync.d.ts +102 -0
  185. package/dist/agent-runtime/src/use-historical-edit-attachments.d.ts +2 -0
  186. package/dist/agent-runtime/src/use-thread-handoff-flow.d.ts +84 -0
  187. package/dist/agent-runtime/src/voice-presentation.d.ts +80 -0
  188. package/dist/agent-runtime/src/voice-turn-grouping.d.ts +28 -0
  189. package/dist/agent-runtime/src/voice-wire-types.d.ts +15 -0
  190. package/dist/agent-runtime/src/withdrawn-turns.d.ts +97 -0
  191. package/dist/chat/AthenaChat.cjs +77 -6
  192. package/dist/chat/AthenaChat.cjs.map +1 -1
  193. package/dist/chat/AthenaChat.js +78 -7
  194. package/dist/chat/AthenaChat.js.map +1 -1
  195. package/dist/chat/StatewireApprovalCard.d.ts +1 -1
  196. package/dist/chat/StatewireClientToolBridge.d.ts +1 -1
  197. package/dist/chat/StatewireQueuedMessages.cjs +11 -4
  198. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
  199. package/dist/chat/StatewireQueuedMessages.d.ts +1 -1
  200. package/dist/chat/StatewireQueuedMessages.js +11 -4
  201. package/dist/chat/StatewireQueuedMessages.js.map +1 -1
  202. package/dist/chat/chat-outbox-rows.cjs +223 -0
  203. package/dist/chat/chat-outbox-rows.cjs.map +1 -0
  204. package/dist/chat/chat-outbox-rows.d.ts +29 -0
  205. package/dist/chat/chat-outbox-rows.js +223 -0
  206. package/dist/chat/chat-outbox-rows.js.map +1 -0
  207. package/dist/chat/statewire-approval.d.ts +1 -1
  208. package/dist/chat/statewire-client-tools.d.ts +1 -1
  209. package/dist/chat/super-grouping/SuperGroupingCard.cjs +3 -1
  210. package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
  211. package/dist/chat/super-grouping/SuperGroupingCard.d.ts +7 -1
  212. package/dist/chat/super-grouping/SuperGroupingCard.js +3 -1
  213. package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
  214. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +7 -2
  215. package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -1
  216. package/dist/chat/super-grouping/SuperGroupingTranscript.d.ts +2 -2
  217. package/dist/chat/super-grouping/SuperGroupingTranscript.js +7 -2
  218. package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -1
  219. package/dist/chat/super-grouping/activity-timeline.cjs +19 -11
  220. package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
  221. package/dist/chat/super-grouping/activity-timeline.d.ts +25 -9
  222. package/dist/chat/super-grouping/activity-timeline.js +19 -11
  223. package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
  224. package/dist/chat/use-statewire-approval-request.cjs +36 -0
  225. package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
  226. package/dist/chat/use-statewire-approval-request.d.ts +49 -1
  227. package/dist/chat/use-statewire-approval-request.js +39 -3
  228. package/dist/chat/use-statewire-approval-request.js.map +1 -1
  229. package/dist/chat-ui/composer/tiptap-composer.cjs +102 -3
  230. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
  231. package/dist/chat-ui/composer/tiptap-composer.d.ts +32 -1
  232. package/dist/chat-ui/composer/tiptap-composer.js +103 -4
  233. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
  234. package/dist/chat-ui/header/conversation-history-panel.d.ts +1 -1
  235. package/dist/chat-ui/index.d.ts +1 -1
  236. package/dist/chat-ui/messages/message-components.cjs +15 -0
  237. package/dist/chat-ui/messages/message-components.cjs.map +1 -1
  238. package/dist/chat-ui/messages/message-components.js +15 -0
  239. package/dist/chat-ui/messages/message-components.js.map +1 -1
  240. package/dist/chat-ui/messages/runtime-message.d.ts +1 -1
  241. package/dist/chat-ui/messages/statewire-continue-run.d.ts +1 -1
  242. package/dist/chat-ui/messages/user-edit-composer.cjs +15 -2
  243. package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
  244. package/dist/chat-ui/messages/user-edit-composer.d.ts +4 -2
  245. package/dist/chat-ui/messages/user-edit-composer.js +15 -2
  246. package/dist/chat-ui/messages/user-edit-composer.js.map +1 -1
  247. package/dist/chat-ui/messages/wake-marker.d.ts +1 -1
  248. package/dist/chat-ui/rich-text/chat-text-schema.cjs +1 -0
  249. package/dist/chat-ui/rich-text/chat-text-schema.cjs.map +1 -1
  250. package/dist/chat-ui/rich-text/chat-text-schema.d.ts +3 -0
  251. package/dist/chat-ui/rich-text/chat-text-schema.js +1 -0
  252. package/dist/chat-ui/rich-text/chat-text-schema.js.map +1 -1
  253. package/dist/chat-ui/statewire.cjs +1 -0
  254. package/dist/chat-ui/statewire.cjs.map +1 -1
  255. package/dist/chat-ui/statewire.d.ts +2 -2
  256. package/dist/chat-ui/statewire.js +2 -1
  257. package/dist/chat-ui/thread/statewire-history-edge.d.ts +1 -1
  258. package/dist/composer/AttachmentContext.cjs +8 -4
  259. package/dist/composer/AttachmentContext.cjs.map +1 -1
  260. package/dist/composer/AttachmentContext.d.ts +7 -0
  261. package/dist/composer/AttachmentContext.js +8 -4
  262. package/dist/composer/AttachmentContext.js.map +1 -1
  263. package/dist/composer/build-composed-message.cjs +34 -0
  264. package/dist/composer/build-composed-message.cjs.map +1 -1
  265. package/dist/composer/build-composed-message.d.ts +20 -0
  266. package/dist/composer/build-composed-message.js +35 -1
  267. package/dist/composer/build-composed-message.js.map +1 -1
  268. package/dist/composer/composer-handoff.cjs +39 -2
  269. package/dist/composer/composer-handoff.cjs.map +1 -1
  270. package/dist/composer/composer-handoff.d.ts +28 -3
  271. package/dist/composer/composer-handoff.js +39 -2
  272. package/dist/composer/composer-handoff.js.map +1 -1
  273. package/dist/composer/useAttachFiles.cjs +15 -2
  274. package/dist/composer/useAttachFiles.cjs.map +1 -1
  275. package/dist/composer/useAttachFiles.d.ts +11 -0
  276. package/dist/composer/useAttachFiles.js +15 -2
  277. package/dist/composer/useAttachFiles.js.map +1 -1
  278. package/dist/composer/useSendMessage.cjs.map +1 -1
  279. package/dist/composer/useSendMessage.d.ts +4 -3
  280. package/dist/composer/useSendMessage.js.map +1 -1
  281. package/dist/diagnostics/athena-diagnostics.cjs.map +1 -1
  282. package/dist/diagnostics/athena-diagnostics.d.ts +3 -1
  283. package/dist/diagnostics/athena-diagnostics.js.map +1 -1
  284. package/dist/index.cjs +18 -0
  285. package/dist/index.cjs.map +1 -1
  286. package/dist/index.d.ts +15 -6
  287. package/dist/index.js +19 -1
  288. package/dist/index.js.map +1 -1
  289. package/dist/offline/chat-outbox.cjs +57 -0
  290. package/dist/offline/chat-outbox.cjs.map +1 -0
  291. package/dist/offline/chat-outbox.d.ts +80 -0
  292. package/dist/offline/chat-outbox.js +57 -0
  293. package/dist/offline/chat-outbox.js.map +1 -0
  294. package/dist/offline/offline-history.cjs +77 -0
  295. package/dist/offline/offline-history.cjs.map +1 -0
  296. package/dist/offline/offline-history.d.ts +60 -0
  297. package/dist/offline/offline-history.js +77 -0
  298. package/dist/offline/offline-history.js.map +1 -0
  299. package/dist/provider/AthenaProvider.cjs +206 -9
  300. package/dist/provider/AthenaProvider.cjs.map +1 -1
  301. package/dist/provider/AthenaProvider.d.ts +22 -1
  302. package/dist/provider/AthenaProvider.js +207 -10
  303. package/dist/provider/AthenaProvider.js.map +1 -1
  304. package/dist/provider/statewire-window-context.d.ts +1 -1
  305. package/dist/react/package.json.cjs +1 -1
  306. package/dist/react/package.json.js +1 -1
  307. package/dist/references/src/anchors/file-line-range.d.ts +58 -0
  308. package/dist/references/src/anchors/format.d.ts +21 -0
  309. package/dist/references/src/anchors/message-anchors.d.ts +71 -0
  310. package/dist/references/src/anchors/parse.d.ts +8 -0
  311. package/dist/references/src/anchors/registry-contract.d.ts +24 -0
  312. package/dist/references/src/anchors/registry.d.ts +19 -0
  313. package/dist/references/src/anchors/schemas.d.ts +194 -0
  314. package/dist/references/src/anchors/serialize.d.ts +8 -0
  315. package/dist/references/src/anchors/time.d.ts +78 -0
  316. package/dist/references/src/anchors/types.d.ts +474 -0
  317. package/dist/references/src/asset-bounds.d.ts +27 -0
  318. package/dist/references/src/asset-links.d.ts +23 -0
  319. package/dist/references/src/asset-reference.d.ts +16 -0
  320. package/dist/references/src/formats/format-catalog.d.ts +79 -0
  321. package/dist/references/src/formats/markdown/parse-reference-markdown.d.ts +28 -0
  322. package/dist/references/src/formats/markdown/reference-display-name.d.ts +6 -0
  323. package/dist/references/src/formats/object/asset-object.d.ts +9 -0
  324. package/dist/references/src/formats/object/callable-object.d.ts +6 -0
  325. package/dist/references/src/formats/object/decode-reference-object-payload.d.ts +3 -0
  326. package/dist/references/src/formats/object/external-url-object.d.ts +9 -0
  327. package/dist/references/src/formats/object/group-object.d.ts +9 -0
  328. package/dist/references/src/formats/object/navigation-object.d.ts +9 -0
  329. package/dist/references/src/formats/object/parse-reference-object.d.ts +11 -0
  330. package/dist/references/src/formats/object/person-object.d.ts +9 -0
  331. package/dist/references/src/formats/uri/asset-mention-uri.d.ts +9 -0
  332. package/dist/references/src/formats/uri/asset-spaces-url.d.ts +9 -0
  333. package/dist/references/src/formats/uri/callable-mention-uris.d.ts +9 -0
  334. package/dist/references/src/formats/uri/detect-uri-wire.d.ts +9 -0
  335. package/dist/references/src/formats/uri/group-mention-uri.d.ts +12 -0
  336. package/dist/references/src/formats/uri/navigation-spaces-url.d.ts +14 -0
  337. package/dist/references/src/formats/uri/parse-reference-uri.d.ts +20 -0
  338. package/dist/references/src/formats/uri/person-mention-uri.d.ts +9 -0
  339. package/dist/references/src/formats/uri/template-placeholder.d.ts +12 -0
  340. package/dist/references/src/index.d.ts +47 -0
  341. package/dist/references/src/legacy/index.d.ts +14 -0
  342. package/dist/references/src/legacy/pre-reference-asset-url.d.ts +57 -0
  343. package/dist/references/src/legacy/pre-reference-citation-bridge.d.ts +22 -0
  344. package/dist/references/src/legacy/pre-reference-citation.d.ts +138 -0
  345. package/dist/references/src/legacy/pre-reference-external-url.d.ts +31 -0
  346. package/dist/references/src/legacy/pre-reference-format.d.ts +8 -0
  347. package/dist/references/src/legacy/pre-reference-mention.d.ts +27 -0
  348. package/dist/references/src/legacy/pre-reference-object.d.ts +8 -0
  349. package/dist/references/src/legacy/pre-reference-uri.d.ts +12 -0
  350. package/dist/references/src/legacy.d.ts +2 -0
  351. package/dist/references/src/mention-href-patterns.d.ts +19 -0
  352. package/dist/references/src/mention-node/index.d.ts +5 -0
  353. package/dist/references/src/mention-node/mention-node.d.ts +31 -0
  354. package/dist/references/src/mention-node/resolve-node-attrs.d.ts +27 -0
  355. package/dist/references/src/parse-reference.d.ts +23 -0
  356. package/dist/references/src/schemas.d.ts +463 -0
  357. package/dist/references/src/serialize-reference.d.ts +50 -0
  358. package/dist/references/src/sheet-name.d.ts +10 -0
  359. package/dist/references/src/tool-option-schemas.d.ts +597 -0
  360. package/dist/references/src/types.d.ts +125 -0
  361. package/dist/references/src/version-ref.d.ts +30 -0
  362. package/dist/runtime/statewire-lifecycle.d.ts +1 -1
  363. package/dist/runtime/statewire-model-lane.d.ts +1 -1
  364. package/dist/runtime/statewire-server-lane-context.d.ts +1 -1
  365. package/dist/runtime/statewire-session-key.cjs +7 -0
  366. package/dist/runtime/statewire-session-key.cjs.map +1 -1
  367. package/dist/runtime/statewire-session-key.d.ts +16 -0
  368. package/dist/runtime/statewire-session-key.js +8 -1
  369. package/dist/runtime/statewire-session-key.js.map +1 -1
  370. package/dist/runtime/statewire-session-lane.cjs +48 -0
  371. package/dist/runtime/statewire-session-lane.cjs.map +1 -0
  372. package/dist/runtime/statewire-session-lane.d.ts +29 -0
  373. package/dist/runtime/statewire-session-lane.js +48 -0
  374. package/dist/runtime/statewire-session-lane.js.map +1 -0
  375. package/dist/runtime/statewire-thread-config-lane.d.ts +1 -1
  376. package/dist/runtime/useAthenaStatewireRuntime.cjs +16 -5
  377. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
  378. package/dist/runtime/useAthenaStatewireRuntime.d.ts +15 -1
  379. package/dist/runtime/useAthenaStatewireRuntime.js +17 -6
  380. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
  381. package/dist/styles.css +1 -1
  382. package/dist/threads/api.d.ts +1 -1
  383. package/dist/threads/conversation-list-fetcher.d.ts +1 -1
  384. package/dist/threads/index-triggered-refresh.cjs +164 -0
  385. package/dist/threads/index-triggered-refresh.cjs.map +1 -0
  386. package/dist/threads/index-triggered-refresh.d.ts +70 -0
  387. package/dist/threads/index-triggered-refresh.js +164 -0
  388. package/dist/threads/index-triggered-refresh.js.map +1 -0
  389. package/dist/threads/offline-session-list.cjs +75 -0
  390. package/dist/threads/offline-session-list.cjs.map +1 -0
  391. package/dist/threads/offline-session-list.d.ts +27 -0
  392. package/dist/threads/offline-session-list.js +75 -0
  393. package/dist/threads/offline-session-list.js.map +1 -0
  394. package/dist/threads/pull-request-display.d.ts +1 -1
  395. package/dist/threads/session-list-model.d.ts +1 -1
  396. package/dist/threads/session-list-tab-share.cjs +150 -0
  397. package/dist/threads/session-list-tab-share.cjs.map +1 -0
  398. package/dist/threads/session-list-tab-share.d.ts +73 -0
  399. package/dist/threads/session-list-tab-share.js +150 -0
  400. package/dist/threads/session-list-tab-share.js.map +1 -0
  401. package/dist/threads/session-row-parts.d.ts +1 -1
  402. package/dist/threads/sessions-query.d.ts +1 -1
  403. package/dist/threads/statewire-thread-list.cjs +105 -20
  404. package/dist/threads/statewire-thread-list.cjs.map +1 -1
  405. package/dist/threads/statewire-thread-list.d.ts +31 -3
  406. package/dist/threads/statewire-thread-list.js +107 -22
  407. package/dist/threads/statewire-thread-list.js.map +1 -1
  408. package/dist/threads/thread-prefetcher.d.ts +1 -1
  409. package/dist/threads/use-athena-session-attention.d.ts +1 -1
  410. package/dist/threads/use-athena-sessions.cjs +32 -22
  411. package/dist/threads/use-athena-sessions.cjs.map +1 -1
  412. package/dist/threads/use-athena-sessions.js +33 -23
  413. package/dist/threads/use-athena-sessions.js.map +1 -1
  414. package/dist/threads/use-rest-conversation-history.d.ts +1 -1
  415. package/dist/threads/use-statewire-conversation-history.d.ts +5 -5
  416. package/dist/tiptap-markdown-table/src/markdown-table-serializer.d.ts +56 -0
  417. package/dist/tools/NestedPtcMessages.cjs +14 -9
  418. package/dist/tools/NestedPtcMessages.cjs.map +1 -1
  419. package/dist/tools/NestedPtcMessages.d.ts +9 -0
  420. package/dist/tools/NestedPtcMessages.js +6 -1
  421. package/dist/tools/NestedPtcMessages.js.map +1 -1
  422. package/dist/tools/index.d.ts +1 -1
  423. package/dist/tools/primitives.d.ts +1 -1
  424. package/dist/tools/subagent-task-tool-ui.cjs +494 -0
  425. package/dist/tools/subagent-task-tool-ui.cjs.map +1 -0
  426. package/dist/tools/subagent-task-tool-ui.d.ts +109 -0
  427. package/dist/tools/subagent-task-tool-ui.js +494 -0
  428. package/dist/tools/subagent-task-tool-ui.js.map +1 -0
  429. package/dist/tools/tool-fallback.d.ts +1 -1
  430. package/dist/tools/tool-icons.d.ts +1 -1
  431. package/dist/tools/tool-summary.d.ts +1 -1
  432. package/dist/tools/tool-uis.cjs +4 -0
  433. package/dist/tools/tool-uis.cjs.map +1 -1
  434. package/dist/tools/tool-uis.js +4 -0
  435. package/dist/tools/tool-uis.js.map +1 -1
  436. package/dist/voice/chat.cjs +6 -0
  437. package/dist/voice/chat.cjs.map +1 -0
  438. package/dist/voice/chat.d.ts +2 -0
  439. package/dist/voice/chat.js +6 -0
  440. package/dist/voice/chat.js.map +1 -0
  441. package/dist/voice/livekit-join.cjs +119 -0
  442. package/dist/voice/livekit-join.cjs.map +1 -0
  443. package/dist/voice/livekit-join.d.ts +8 -0
  444. package/dist/voice/livekit-join.js +119 -0
  445. package/dist/voice/livekit-join.js.map +1 -0
  446. package/dist/voice/livekit.cjs +32 -0
  447. package/dist/voice/livekit.cjs.map +1 -0
  448. package/dist/voice/livekit.d.ts +80 -0
  449. package/dist/voice/livekit.js +32 -0
  450. package/dist/voice/livekit.js.map +1 -0
  451. package/package.json +20 -10
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagents.js","sources":["../../../../agent-runtime/src/subagents.ts"],"sourcesContent":["/**\n * Subagent discovery: every subagent lane a deep-agent thread has spawned, as\n * the card view model the surfaces that draw subagent lanes render. Two\n * dispatch paths feed lanes keyed by dispatch id:\n *\n * - top-level `task` tool calls, read from the call's own tool-call part\n * ({@link taskSubagentsOfTurn}): the part's result and `isPreliminary` say\n * where the lane is, and its `messages` (the nested thread\n * `createSubagentTranscriptConversionCache` converts) are the transcript;\n * - in-eval `task()` dispatches ({@link deriveEvalSubagents}), whose only\n * signals are the live `ptc_subagents` state channel and the summaries a\n * finished `eval` ToolMessage persists in `artifact.ptc_subagents`.\n */\nimport {\n getExternalStoreMessages,\n type ThreadMessage,\n type ToolCallMessagePart,\n} from '@assistant-ui/core';\nimport type { LangChainMessage, LangChainToolCall } from '@assistant-ui/react-langgraph';\nimport { useAuiState } from '@assistant-ui/store';\nimport { useMemo } from 'react';\nimport {\n DEEP_AGENT_LANE_USAGE_KEY,\n DEEP_AGENT_TRUNCATED_LANE_KEY,\n} from './generated/runconfig-contract';\nimport { getMessageText } from './message-text';\nimport { convertSubagentTranscript, withRepeatedResult } from './subagent-transcripts';\nimport { EVAL_TOOL_NAME, TASK_TOOL_NAME } from './tool-names';\nimport type { PtcSubagentEntry, Todo } from './types';\n\n/**\n * Where a subagent lane is:\n *\n * - `queued` — the dispatch has not started: a `task` call with no result yet\n * (waiting for a dispatch slot or an approval; the backend shows the running\n * card once the dispatch holds its slot), or an in-eval dispatch waiting for\n * one of the bridge's concurrency slots.\n * - `running` — a `task` call's result is still the backend's running\n * placeholder (its part is `isPreliminary`), and the nested transcript fills\n * in live; or an in-eval dispatch's lifecycle says it runs.\n * - `complete` / `error` — the real result replaced the placeholder; `error`\n * when it is an error result.\n */\nexport type SubagentStatus = 'queued' | 'running' | 'complete' | 'error';\n\n/** True for the settled lifecycle states (`complete` / `error`). */\nexport function isTerminalSubagentStatus(status: SubagentStatus): boolean {\n return status === 'complete' || status === 'error';\n}\n\n/** Aggregate lane lifecycle counts for one fan-out (orchestration strip + header chip). */\nexport interface SubagentStatusCounts {\n total: number;\n queued: number;\n running: number;\n complete: number;\n failed: number;\n /** complete + failed — the settled count progress displays use. */\n terminal: number;\n}\n\nexport function countSubagentStatuses(\n snapshots: readonly SubagentDiscoverySnapshot[]\n): SubagentStatusCounts {\n const counts: SubagentStatusCounts = {\n total: snapshots.length,\n queued: 0,\n running: 0,\n complete: 0,\n failed: 0,\n terminal: 0,\n };\n for (const snapshot of snapshots) {\n if (snapshot.status === 'queued') counts.queued += 1;\n else if (snapshot.status === 'running') counts.running += 1;\n else if (snapshot.status === 'complete') counts.complete += 1;\n else counts.failed += 1;\n }\n counts.terminal = counts.complete + counts.failed;\n return counts;\n}\n\n/**\n * Discovery snapshot for one subagent invocation. Mirrors LangChain's\n * `SubagentDiscoverySnapshot`: `id` is the `task` tool-call id that spawned the\n * subagent (the dispatch id for an in-eval dispatch), so cards nest under the\n * coordinator turn that delegated the work.\n */\nexport interface SubagentDiscoverySnapshot {\n /** The `task` tool-call id that spawned the subagent. */\n id: string;\n /** Subagent type/name, from the `task` call's `subagent_type` arg. */\n name: string;\n /** The one-line task brief from the `task` call's `description` arg. */\n description: string;\n /** Lifecycle state — see {@link SubagentStatus}. */\n status: SubagentStatus;\n /** The call's result text (empty while it is the running placeholder). */\n output?: string;\n /** Number of nested tool calls the subagent made. */\n toolCallCount: number;\n /**\n * The subagent's transcript as a nested thread: a `task` part's native\n * `messages`, or an in-eval dispatch's live transcript converted the same way.\n */\n messages: readonly ThreadMessage[];\n /** Messages in the transcript as the wire carries them, before conversion joins a turn's steps. */\n messageCount: number;\n /**\n * Nested messages the wire left off: a cut card carries its newest steps\n * ({@link readTruncatedLane}) — a running card always, a finished one on a\n * version-2 view — and the rest pages in through `history/lane`; an in-eval\n * dispatch's streamed transcript is cut the same way, running or finished.\n * Absent when the transcript rides whole.\n */\n omittedMessageCount?: number;\n /**\n * Where the lane's steps ride, what `history/lane` pages the rest of the lane\n * under (`useDeepAgentLaneHistory`): a `task` lane's card, an in-eval lane's\n * registry entry while it streams its steps, or, once they no longer ride,\n * its subagent checkpoint (`checkpointed`), when agora recorded where that is\n * (`ns`). Absent for any other in-eval lane with no streamed steps (a summary\n * written before agora recorded the namespace, an older host).\n */\n source?: SubagentLaneSource;\n /** The subagent's own plan, nested by the backend on the task artifact (`subgraph_state.todos`). */\n todos?: Todo[];\n /** The newest tool call in the transcript — the card's \"last action\" ticker. */\n lastToolCall?: LangChainToolCall;\n /** The newest assistant text in the transcript — the card's thought preview. */\n currentText: string;\n /**\n * The `eval` tool-call id that dispatched this subagent, when it was spawned\n * from INSIDE the code interpreter (`task()` in the REPL) rather than by a\n * top-level `task` tool call. The eval card uses it to render lanes for its\n * own dispatches.\n */\n evalId?: string;\n /**\n * Backend-reported runtime for a finished in-eval dispatch (from the terminal\n * lifecycle event). Authoritative over client-side timing — it survives a page\n * refresh, where local first-seen timestamps are gone.\n */\n durationMs?: number;\n /** The model that produced the transcript, from its newest assistant turn's model stamp. */\n model?: string;\n /**\n * The lane's token use: the whole lane's as the host counts it\n * (`DEEP_AGENT_LANE_USAGE_KEY`), else the sum of the native step usage\n * (`metadata.steps[].usage`) of the steps the transcript holds. Absent while\n * no step reports any.\n */\n usage?: SubagentTokenUsage;\n}\n\n/** A subagent lane's token use. */\nexport interface SubagentTokenUsage {\n /** Input tokens, the prompt cache's reads and writes included. */\n readonly inputTokens: number;\n readonly outputTokens: number;\n /**\n * Less than the lane will have used: the lane still runs (its newest step may\n * not have reported yet), or no host total arrived and the sum covers only\n * the steps held of a lane cut to its newest ones.\n */\n readonly partial: boolean;\n}\n\n/** Input and output tokens of some model calls. */\nexport interface TokenCounts {\n readonly inputTokens: number;\n readonly outputTokens: number;\n}\n\nfunction subagentNameFromArgs(args: Readonly<Record<string, unknown>> | undefined): string {\n if (!args) return 'subagent';\n return String(args.subagent_type ?? args.subagentType ?? args.subagent ?? 'subagent');\n}\n\n/**\n * The subagent's streamed transcript as the wire carries it, read from a task\n * ToolMessage's `artifact.subgraph_state.messages` (the shape the backend nests\n * it under — see the route's `_subagent_subgraph_state`).\n */\nexport function nestedMessagesFromArtifact(artifact: unknown): LangChainMessage[] {\n const a = artifact as { subgraph_state?: { messages?: LangChainMessage[] } } | undefined;\n return a?.subgraph_state?.messages ?? [];\n}\n\n/** What the wire left off a cut `task` card's nested transcript. */\nexport interface TruncatedLane {\n /** Nested messages the host holds for the lane. */\n messages: number;\n /** Tool calls across all of them. */\n toolCalls: number;\n /**\n * The card is a finished lane's, cut for a version-2 view. Only a host that\n * serves `history/lane` cuts a finished card.\n */\n finished: boolean;\n}\n\n/**\n * Where a lane's steps ride, and what `history/lane` pages the rest of them\n * under: a `task` lane's card, by its message id, or an in-eval dispatch's\n * `ptc_subagents` registry entry, by its dispatch id.\n */\nexport type SubagentLaneSource = {\n /** The steps as the wire carries them (a card's report restored, {@link withRepeatedResult}). */\n readonly transcript: readonly LangChainMessage[];\n /** The cut marker; absent while every step rides. */\n readonly truncated?: TruncatedLane;\n /**\n * No steps ride, and `history/lane {lane}` pages the subagent's own steps\n * from its checkpoint: an in-eval lane a later run in this activation left\n * only its summary and `ns`, or a reopened session's lane (its registry gone,\n * the summary its eval persisted records `ns`).\n */\n readonly checkpointed?: true;\n} & (\n | {\n /** The card's message id: the running placeholder's, then the result's. */\n readonly messageId: string;\n readonly lane?: undefined;\n }\n | {\n /** The dispatch id: the in-eval lane's registry key. */\n readonly lane: string;\n readonly messageId?: undefined;\n }\n);\n\nconst isCount = (value: unknown): value is number =>\n typeof value === 'number' && Number.isInteger(value) && value >= 0;\n\n/**\n * The cut marker off a `task` card's raw wire message: the host carries only\n * the lane's newest nested steps and names the whole transcript here\n * (`DEEP_AGENT_TRUNCATED_LANE_KEY`), on a running card and, for a version-2\n * view, on a finished one. `null` when the transcript rides whole.\n */\nexport function readTruncatedLane(toolMessage: unknown): TruncatedLane | null {\n if (typeof toolMessage !== 'object' || toolMessage === null) return null;\n const marker = (toolMessage as Record<string, unknown>)[DEEP_AGENT_TRUNCATED_LANE_KEY];\n if (typeof marker !== 'object' || marker === null) return null;\n const { messages, tool_calls: toolCalls, finished } = marker as Record<string, unknown>;\n return isCount(messages) && isCount(toolCalls)\n ? { messages, toolCalls, finished: finished === true }\n : null;\n}\n\n/**\n * The whole lane's token use the host carries on a `task` card's raw wire\n * message or an in-eval lane's `ptc_subagents` entry\n * (`DEEP_AGENT_LANE_USAGE_KEY`), however much of the lane the wire carries.\n * `null` when it carries none (an older host, or no step reported usage).\n */\nexport function readLaneUsage(wire: unknown): TokenCounts | null {\n if (typeof wire !== 'object' || wire === null) return null;\n const usage = (wire as Record<string, unknown>)[DEEP_AGENT_LANE_USAGE_KEY];\n if (typeof usage !== 'object' || usage === null) return null;\n const { input_tokens: inputTokens, output_tokens: outputTokens } = usage as Record<\n string,\n unknown\n >;\n return isCount(inputTokens) && isCount(outputTokens) ? { inputTokens, outputTokens } : null;\n}\n\n/**\n * A lane's token use: the host's total when it sent one, else what the native\n * steps of the transcript held add up to, partial while the lane runs or when\n * that transcript is cut. `undefined` while neither counts anything.\n */\nfunction laneTokenUsage(\n wire: unknown,\n steps: TokenCounts | undefined,\n status: SubagentStatus,\n cut: boolean\n): SubagentTokenUsage | undefined {\n const settled = isTerminalSubagentStatus(status);\n const whole = readLaneUsage(wire);\n if (whole !== null) return { ...whole, partial: !settled };\n return steps === undefined ? undefined : { ...steps, partial: !settled || cut };\n}\n\nconst transcriptStepUsageCache = new WeakMap<readonly ThreadMessage[], TokenCounts | null>();\n\n/**\n * What the model calls of a converted transcript used, from assistant-ui's\n * native step usage (`metadata.steps[].usage`, one step per model call a turn\n * joined). `undefined` when no step reports usage. Memoized per transcript\n * array, which the conversion caches keep while the transcript is unchanged.\n */\nexport function transcriptStepUsage(messages: readonly ThreadMessage[]): TokenCounts | undefined {\n const cached = transcriptStepUsageCache.get(messages);\n if (cached !== undefined) return cached ?? undefined;\n let inputTokens = 0;\n let outputTokens = 0;\n let counted = false;\n for (const message of messages) {\n for (const step of message.metadata.steps ?? []) {\n if (step.usage === undefined) continue;\n inputTokens += step.usage.inputTokens;\n outputTokens += step.usage.outputTokens;\n counted = true;\n }\n }\n const usage = counted ? { inputTokens, outputTokens } : null;\n transcriptStepUsageCache.set(messages, usage);\n return usage ?? undefined;\n}\n\n/**\n * The subagent's own plan, read from a task ToolMessage's\n * `artifact.subgraph_state.todos` (the backend mirrors the subagent's isolated\n * `todos` state channel there — see the route's `_forward_subagent_todos`).\n * `undefined` (not `[]`) when the subagent never wrote a plan, so the UI can\n * distinguish \"no plan\" from \"plan with zero items\".\n */\nexport function nestedTodosFromArtifact(artifact: unknown): Todo[] | undefined {\n const a = artifact as { subgraph_state?: { todos?: unknown } } | undefined;\n const todos = a?.subgraph_state?.todos;\n return Array.isArray(todos) ? (todos as Todo[]) : undefined;\n}\n\n/**\n * The persisted in-eval dispatch summaries from an `eval` ToolMessage's\n * `artifact.ptc_subagents` (written by the backend when the eval ends). Unlike\n * the live `ptc_subagents` state channel — which dies with the stream — these\n * survive checkpoint reload, so reopened sessions can still render each\n * dispatch's terminal status, duration, output, and error.\n */\nexport function ptcSubagentsFromArtifact(artifact: unknown): PtcSubagentEntry[] {\n const a = artifact as { ptc_subagents?: unknown } | undefined;\n const entries = a?.ptc_subagents;\n if (!Array.isArray(entries)) return [];\n return entries.filter(\n (entry): entry is PtcSubagentEntry =>\n !!entry &&\n typeof entry === 'object' &&\n typeof (entry as { id?: unknown }).id === 'string' &&\n !!(entry as { id?: string }).id\n );\n}\n\n/**\n * What one transcript contributes to a lane: the newest assistant text\n * (thought preview), the newest tool call and the count (\"last action\"\n * ticker), the producing model, and the plan recovered from the newest\n * `write_todos` call — the fallback for in-eval lanes, whose isolated `todos`\n * state channel never reaches the wire (the task path nests todos on the\n * artifact instead); the call args carry the same list, so the progress ring\n * can still fill. A pure function of the transcript array.\n */\ninterface TranscriptDerivation {\n currentText: string;\n model: string | undefined;\n lastToolCall: LangChainToolCall | undefined;\n toolCallCount: number;\n todos: Todo[] | undefined;\n}\n\nconst EMPTY_TRANSCRIPT_DERIVATION: TranscriptDerivation = {\n currentText: '',\n model: undefined,\n lastToolCall: undefined,\n toolCallCount: 0,\n todos: undefined,\n};\n\n/**\n * Per-transcript cache for {@link deriveTranscript}: a lane's converted\n * transcript keeps its array while the lane does not change (the conversion\n * caches hand back the previous array), so only lanes still streaming are\n * read again.\n */\nconst transcriptDerivationCache = new WeakMap<readonly ThreadMessage[], TranscriptDerivation>();\n\nfunction deriveTranscript(transcript: readonly ThreadMessage[]): TranscriptDerivation {\n if (transcript.length === 0) return EMPTY_TRANSCRIPT_DERIVATION;\n const cached = transcriptDerivationCache.get(transcript);\n if (cached !== undefined) return cached;\n let currentText = '';\n let model: string | undefined;\n let lastToolCall: LangChainToolCall | undefined;\n let toolCallCount = 0;\n let todos: Todo[] | undefined;\n for (const message of transcript) {\n if (message.role !== 'assistant') continue;\n // A joined turn's `metadata.custom` merges its steps' stamps, the later\n // step's winning (`joinExternalMessages`), so this is the newest stamp.\n const turnModel: unknown = message.metadata?.custom?.model;\n if (typeof turnModel === 'string' && turnModel) model = turnModel;\n for (const part of message.content) {\n if (part.type === 'text') {\n if (part.text) currentText = part.text;\n continue;\n }\n if (part.type !== 'tool-call') continue;\n toolCallCount += 1;\n lastToolCall = { id: part.toolCallId, name: part.toolName, args: part.args };\n if (part.toolName !== 'write_todos') continue;\n const list: unknown = part.args.todos;\n if (Array.isArray(list)) todos = list as Todo[];\n }\n }\n const derivation: TranscriptDerivation = {\n currentText,\n model,\n lastToolCall,\n toolCallCount,\n todos,\n };\n transcriptDerivationCache.set(transcript, derivation);\n return derivation;\n}\n\nconst NO_TRANSCRIPT: readonly ThreadMessage[] = [];\n\n/**\n * The lane of one `task` tool-call part. `toolMessage` is the raw ToolMessage\n * answering it, which carries the wire's cut marker for a running lane.\n */\nfunction taskSubagent(\n part: ToolCallMessagePart,\n toolMessage: LangChainMessage | undefined\n): SubagentDiscoverySnapshot {\n const args: Readonly<Record<string, unknown>> = part.args;\n const transcript = part.messages ?? NO_TRANSCRIPT;\n const derived = deriveTranscript(transcript);\n const messageCount = nestedMessagesFromArtifact(part.artifact).length;\n const lane = readTruncatedLane(toolMessage);\n const todos = nestedTodosFromArtifact(part.artifact);\n const status: SubagentStatus =\n part.result === undefined\n ? 'queued'\n : part.isPreliminary === true\n ? 'running'\n : part.isError === true\n ? 'error'\n : 'complete';\n const usage = laneTokenUsage(\n toolMessage,\n transcriptStepUsage(transcript),\n status,\n lane !== null && lane.messages > messageCount\n );\n return {\n id: part.toolCallId,\n name: subagentNameFromArgs(args),\n description: typeof args.description === 'string' ? args.description : '',\n status,\n ...(part.result !== undefined && { output: getMessageText({ content: part.result }) }),\n toolCallCount: Math.max(derived.toolCallCount, lane?.toolCalls ?? 0),\n messages: transcript,\n messageCount,\n ...(lane !== null && { omittedMessageCount: Math.max(0, lane.messages - messageCount) }),\n ...(typeof toolMessage?.id === 'string' && {\n source: {\n messageId: toolMessage.id,\n transcript: withRepeatedResult(nestedMessagesFromArtifact(part.artifact), part.result),\n ...(lane !== null && { truncated: lane }),\n },\n }),\n ...(todos !== undefined && { todos }),\n ...(derived.lastToolCall !== undefined && { lastToolCall: derived.lastToolCall }),\n currentText: derived.currentText,\n ...(derived.model !== undefined && { model: derived.model }),\n ...(usage !== undefined && { usage }),\n };\n}\n\n/** The raw ToolMessage answering each tool call of a converted turn, from the sources bound to it. */\nfunction toolMessagesOfTurn(message: ThreadMessage): Map<string, LangChainMessage> {\n const byCall = new Map<string, LangChainMessage>();\n for (const source of getExternalStoreMessages<LangChainMessage>(message)) {\n if (source.type === 'tool') byCall.set(source.tool_call_id, source);\n }\n return byCall;\n}\n\n/**\n * Per-part lane cache: a re-converted turn keeps the part object of every call\n * whose ToolMessage did not change (the conversion cache's `keepUnchangedParts`),\n * so a streaming lane re-derives only itself.\n */\nconst taskSubagentByPart = new WeakMap<ToolCallMessagePart, SubagentDiscoverySnapshot>();\nconst taskSubagentsByTurn = new WeakMap<ThreadMessage, ReadonlyMap<string, SubagentDiscoverySnapshot>>();\n\n/**\n * The lane of every `task` call in one converted turn (a `ThreadMessage`, or the\n * message state assistant-ui publishes for it), keyed by tool-call id in call\n * order. Memoized per turn and per part.\n */\nexport function taskSubagentsOfTurn(\n message: ThreadMessage\n): ReadonlyMap<string, SubagentDiscoverySnapshot> {\n const cached = taskSubagentsByTurn.get(message);\n if (cached !== undefined) return cached;\n const lanes = new Map<string, SubagentDiscoverySnapshot>();\n if (message.role === 'assistant') {\n let toolMessages: Map<string, LangChainMessage> | null = null;\n for (const part of message.content) {\n if (part.type !== 'tool-call' || part.toolName !== TASK_TOOL_NAME) continue;\n let lane = taskSubagentByPart.get(part);\n if (lane === undefined) {\n toolMessages ??= toolMessagesOfTurn(message);\n lane = taskSubagent(part, toolMessages.get(part.toolCallId));\n taskSubagentByPart.set(part, lane);\n }\n lanes.set(part.toolCallId, lane);\n }\n }\n taskSubagentsByTurn.set(message, lanes);\n return lanes;\n}\n\n/** The lane of every `task` call in a converted thread, in transcript order. */\nexport function taskSubagentsOfThread(\n messages: readonly ThreadMessage[]\n): SubagentDiscoverySnapshot[] {\n return messages.flatMap((message) => [...taskSubagentsOfTurn(message).values()]);\n}\n\n/**\n * Point a lane at an in-eval dispatch's live transcript, converted into a nested\n * thread, with the live fields it derives. Never regresses a known tool-call\n * count: a countless later event must not reset a lane to \"0 tool calls\".\n */\nfunction applyLaneTranscript(\n snap: SubagentDiscoverySnapshot,\n transcript: readonly LangChainMessage[]\n): void {\n snap.messages = convertSubagentTranscript(transcript, snap.status === 'running');\n snap.messageCount = transcript.length;\n const derived = deriveTranscript(snap.messages);\n if (derived.currentText) snap.currentText = derived.currentText;\n if (derived.model) snap.model = derived.model;\n if (derived.lastToolCall) snap.lastToolCall = derived.lastToolCall;\n snap.toolCallCount = Math.max(snap.toolCallCount, derived.toolCallCount);\n // An in-eval lane has no artifact todos channel: recover the plan from its\n // `write_todos` calls.\n snap.todos = snap.todos ?? derived.todos;\n}\n\n/**\n * The lanes of in-eval dispatches, from two sources: the *persisted* summaries\n * each finished `eval` ToolMessage carries in `artifact.ptc_subagents`\n * (terminal truth; the only source after a session reopen), then the *live*\n * `ptc_subagents` state channel (`ptcSubagents`) for dispatches still\n * streaming. A live entry never downgrades a terminal snapshot back to\n * `running` — a stale lifecycle entry whose terminal event was lost must not\n * resurrect a perpetually-running lane the persisted summary already settled.\n * A lane whose steps no longer ride but whose subagent checkpoint namespace is\n * recorded (`ns`) is `checkpointed`, and `history/lane {lane}` pages its\n * steps: a live entry a later run stripped to its summary, or a persisted\n * summary with no live entry (the registry died with the activation that\n * streamed it). A live entry speaks for its lane over the summary.\n */\nexport function deriveEvalSubagents(\n messages: readonly LangChainMessage[],\n ptcSubagents?: Record<string, PtcSubagentEntry>\n): Map<string, SubagentDiscoverySnapshot> {\n const byDispatchId = new Map<string, SubagentDiscoverySnapshot>();\n // Persisted in-eval dispatch summaries (terminal truth; survives reopen).\n for (const m of messages) {\n if (m.type !== 'tool' || m.name !== EVAL_TOOL_NAME) continue;\n for (const entry of ptcSubagentsFromArtifact(m.artifact)) {\n mergePtcSubagentEntry(byDispatchId, entry, {\n // The eval ended when these summaries were written, so any lane the\n // backend could not settle is a cancelled dispatch, never \"running\".\n status: entry.status === 'complete' ? 'complete' : 'error',\n fallbackEvalId: m.tool_call_id,\n });\n noteCheckpointedLane(byDispatchId.get(entry.id), entry);\n }\n }\n // Live lifecycle entries (the only signal while an eval is still streaming).\n if (ptcSubagents) {\n for (const entry of Object.values(ptcSubagents)) {\n if (!entry || typeof entry !== 'object' || typeof entry.id !== 'string' || !entry.id) {\n continue;\n }\n // This activation's registry speaks for the lane: the steps it streams,\n // else its own namespace, else nothing to page.\n const existing = byDispatchId.get(entry.id);\n if (existing?.source?.checkpointed === true) existing.source = undefined;\n mergePtcSubagentEntry(byDispatchId, entry, {\n status:\n entry.status === 'complete'\n ? 'complete'\n : entry.status === 'error'\n ? 'error'\n : entry.status === 'queued'\n ? 'queued'\n : 'running',\n });\n noteCheckpointedLane(byDispatchId.get(entry.id), entry);\n }\n }\n return byDispatchId;\n}\n\n/** Lifecycle progression order — a merge may only move a lane forward. */\nfunction subagentStatusRank(status: SubagentStatus): number {\n if (status === 'queued') return 0;\n if (status === 'running') return 1;\n return 2;\n}\n\nfunction mergePtcSubagentEntry(\n byDispatchId: Map<string, SubagentDiscoverySnapshot>,\n entry: PtcSubagentEntry,\n options: { status: SubagentStatus; fallbackEvalId?: string }\n): void {\n const { status, fallbackEvalId } = options;\n const existing = byDispatchId.get(entry.id);\n if (existing) {\n // A lane only ever moves FORWARD (queued → running → terminal): a stale\n // entry whose later event was lost must not resurrect a running lane to\n // queued or a finished lane to running — and a settled terminal outcome\n // never flips to the other terminal (first settled source wins).\n if (\n status === existing.status ||\n subagentStatusRank(status) > subagentStatusRank(existing.status)\n ) {\n existing.status = status;\n }\n const evalId = entry.eval_id ?? fallbackEvalId;\n if (evalId) existing.evalId = evalId;\n if (typeof entry.duration_ms === 'number') existing.durationMs = entry.duration_ms;\n // A count only arrives on terminal events; never let a countless later\n // event (or an older backend) regress a known count.\n if (typeof entry.tool_call_count === 'number') {\n existing.toolCallCount = Math.max(existing.toolCallCount, entry.tool_call_count);\n }\n if (Array.isArray(entry.messages) && entry.messages.length > 0) {\n applyLaneTranscript(existing, entry.messages);\n }\n applyLaneCut(existing, entry);\n applyLaneUsage(existing, entry);\n // Prefer the real output (Athena's in-eval output bridge); fall back to the\n // error string only when no (non-empty) output was captured. Same\n // empty-string/nullish rule as the create branch below.\n if (entry.output) existing.output = entry.output;\n else if (entry.error && !existing.output) existing.output = entry.error;\n return;\n }\n // `||` (not `??`) so an empty-string output falls back to the error, matching\n // the merge branch's truthy check above.\n const initialOutput = entry.output || entry.error;\n const evalId = entry.eval_id ?? fallbackEvalId;\n const created: SubagentDiscoverySnapshot = {\n id: entry.id,\n name: String(entry.subagent_type ?? 'subagent'),\n description: entry.label ?? entry.description ?? '',\n status,\n toolCallCount: typeof entry.tool_call_count === 'number' ? entry.tool_call_count : 0,\n messages: NO_TRANSCRIPT,\n messageCount: 0,\n currentText: '',\n ...(evalId ? { evalId } : {}),\n ...(typeof entry.duration_ms === 'number' ? { durationMs: entry.duration_ms } : {}),\n ...(initialOutput ? { output: initialOutput } : {}),\n };\n if (Array.isArray(entry.messages) && entry.messages.length > 0) {\n applyLaneTranscript(created, entry.messages);\n }\n applyLaneCut(created, entry);\n applyLaneUsage(created, entry);\n byDispatchId.set(entry.id, created);\n}\n\n/**\n * Where an in-eval dispatch's streamed steps ride, and what the wire left off\n * them, read off its entry's cut marker (`DEEP_AGENT_TRUNCATED_LANE_KEY`) as a\n * `task` card's is: the steps left off, and the whole lane's tool calls.\n */\nfunction applyLaneCut(snap: SubagentDiscoverySnapshot, entry: PtcSubagentEntry): void {\n const lane = readTruncatedLane(entry);\n if (Array.isArray(entry.messages) && entry.messages.length > 0) {\n snap.source = {\n lane: entry.id,\n transcript: entry.messages,\n ...(lane !== null && { truncated: lane }),\n };\n }\n if (lane === null) return;\n snap.omittedMessageCount = Math.max(0, lane.messages - snap.messageCount);\n snap.toolCallCount = Math.max(snap.toolCallCount, lane.toolCalls);\n}\n\nconst NO_LANE_STEPS: readonly LangChainMessage[] = [];\n\n/**\n * An entry that recorded its subagent's checkpoint namespace (`ns`, a registry\n * entry or the summary an eval persisted, since agora writes it) pages its\n * lane from that checkpoint when no streamed steps carry it.\n */\nfunction noteCheckpointedLane(\n snap: SubagentDiscoverySnapshot | undefined,\n entry: PtcSubagentEntry\n): void {\n if (snap === undefined || snap.source !== undefined) return;\n if (typeof entry.ns !== 'string' || !entry.ns) return;\n snap.source = { lane: entry.id, transcript: NO_LANE_STEPS, checkpointed: true };\n}\n\n/**\n * An in-eval lane's token use, from its entry's host total or the native steps\n * of its live transcript. A merge that brings neither keeps what the lane has.\n */\nfunction applyLaneUsage(snap: SubagentDiscoverySnapshot, entry: PtcSubagentEntry): void {\n const usage = laneTokenUsage(\n entry,\n transcriptStepUsage(snap.messages),\n snap.status,\n (snap.omittedMessageCount ?? 0) > 0\n );\n if (usage !== undefined) snap.usage = usage;\n}\n\n/**\n * The first call of a nested thread with one of `toolCallIds`: the calls a\n * subagent made are the tool-call parts of its transcript, ids included.\n */\nfunction findToolCall({\n messages,\n toolCallIds,\n}: {\n messages: readonly ThreadMessage[] | undefined;\n toolCallIds: ReadonlySet<string>;\n}): ToolCallMessagePart | undefined {\n if (messages === undefined) return undefined;\n for (const message of messages) {\n if (message.role !== 'assistant') continue;\n for (const part of message.content) {\n if (part.type === 'tool-call' && toolCallIds.has(part.toolCallId)) return part;\n }\n }\n return undefined;\n}\n\n/**\n * Whether a subagent lane waits on a person's approval, given the gated calls\n * still waiting on one (`toolCallIdsAwaitingApproval`): its own dispatch is the\n * gated call (a per-dispatch `task` gate), or a call it made is (a gated tool\n * raised inside the delegated subagent). The approval names the gated call's\n * `tool_call_id` and never the lane, and a lane's transcript carries the calls\n * it made with their ids, so the call id is the join. A settled lane waits on\n * nobody.\n */\nexport function subagentAwaitingApproval({\n lane,\n toolCallIds,\n}: {\n lane: Pick<SubagentDiscoverySnapshot, 'id' | 'status' | 'messages'>;\n /** The gated calls still waiting on a decision (`toolCallIdsAwaitingApproval`). */\n toolCallIds: ReadonlySet<string>;\n}): boolean {\n if (toolCallIds.size === 0 || isTerminalSubagentStatus(lane.status)) return false;\n return (\n toolCallIds.has(lane.id) ||\n findToolCall({ messages: lane.messages, toolCallIds }) !== undefined\n );\n}\n\n/**\n * The call a subagent made that waits on a person's approval (a gated tool\n * raised inside the delegated subagent), read off its transcript — what the\n * lane card names while it waits. `undefined` when the lane made none, which\n * includes a lane whose own dispatch is the gated call.\n */\nexport function subagentToolCallAwaitingApproval({\n lane,\n toolCallIds,\n}: {\n lane: Pick<SubagentDiscoverySnapshot, 'status' | 'messages'>;\n /** The gated calls still waiting on a decision (`toolCallIdsAwaitingApproval`). */\n toolCallIds: ReadonlySet<string>;\n}): LangChainToolCall | undefined {\n if (toolCallIds.size === 0 || isTerminalSubagentStatus(lane.status)) return undefined;\n const part = findToolCall({ messages: lane.messages, toolCallIds });\n return part === undefined\n ? undefined\n : { id: part.toolCallId, name: part.toolName, args: part.args };\n}\n\n/**\n * The calls of one converted turn that wait on a person's approval, in turn\n * order: a gated call of the turn itself, or a `task` call not yet settled\n * (no result, or the running placeholder) whose lane holds a gated call — the\n * steps the turn's step list reads as waiting rather than running or done.\n */\nexport function turnToolCallsAwaitingApproval({\n message,\n toolCallIds,\n}: {\n message: ThreadMessage;\n /** The gated calls still waiting on a decision (`toolCallIdsAwaitingApproval`). */\n toolCallIds: ReadonlySet<string>;\n}): string[] {\n if (toolCallIds.size === 0 || message.role !== 'assistant') return [];\n const ids: string[] = [];\n for (const part of message.content) {\n if (part.type !== 'tool-call') continue;\n if (toolCallIds.has(part.toolCallId)) {\n ids.push(part.toolCallId);\n continue;\n }\n if (part.toolName !== TASK_TOOL_NAME) continue;\n const settled = part.result !== undefined && part.isPreliminary !== true;\n if (!settled && findToolCall({ messages: part.messages, toolCallIds }) !== undefined) {\n ids.push(part.toolCallId);\n }\n }\n return ids;\n}\n\nconst NO_WAITING_TOOL_CALLS: ReadonlySet<string> = new Set();\n/** Joins call ids into one selector value; an id never holds it. */\nconst TOOL_CALL_ID_SEPARATOR = '\\n';\n\n/**\n * {@link turnToolCallsAwaitingApproval} for the message in scope: what a\n * turn's step list takes as `waitingToolCallIds`, given the run's waiting\n * calls (`toolCallIdsAwaitingApproval`). Selected as a joined string, so a\n * streamed token re-renders the caller only when the waiting steps change, and\n * the set keeps its identity while they do not. Olympus's activity card and\n * the SDK chat's turns both read it.\n */\nexport function useTurnToolCallsAwaitingApproval(\n toolCallIds: ReadonlySet<string>\n): ReadonlySet<string> {\n const key = useAuiState((s) =>\n toolCallIds.size === 0\n ? ''\n : turnToolCallsAwaitingApproval({ message: s.message, toolCallIds }).join(\n TOOL_CALL_ID_SEPARATOR\n )\n );\n return useMemo(\n () => (key === '' ? NO_WAITING_TOOL_CALLS : new Set(key.split(TOOL_CALL_ID_SEPARATOR))),\n [key]\n );\n}\n\n/** Result text shown for a dispatch whose owning run ended before it finished. */\nexport const ORPHANED_SUBAGENT_OUTPUT =\n 'Interrupted — the run that dispatched this subagent ended before it finished.';\n\n/**\n * Settle snapshots orphaned by their dispatching context: once the owner (e.g.\n * the `eval` tool call whose in-eval `task()` issued them) is itself terminal,\n * nothing can ever deliver a `complete`/`error` lifecycle event for a lane still\n * `queued`/`running` — the dispatch coroutines were cancelled with the eval. Those\n * lanes are coerced to `error` with an interruption message so the UI can't show\n * perpetual \"Running · no activity\" ghosts. Returns the input array unchanged\n * (same reference) when there is nothing to settle.\n */\nexport function finalizeOrphanedSubagents(\n snapshots: readonly SubagentDiscoverySnapshot[],\n ownerTerminal: boolean\n): readonly SubagentDiscoverySnapshot[] {\n if (!ownerTerminal || snapshots.every((s) => isTerminalSubagentStatus(s.status))) {\n return snapshots;\n }\n return snapshots.map((s) =>\n isTerminalSubagentStatus(s.status)\n ? s\n : { ...s, status: 'error', output: s.output || ORPHANED_SUBAGENT_OUTPUT }\n );\n}\n\n/**\n * The `task` tool calls sharing `toolCallId`'s parent AI message — the parallel\n * fan-out siblings, in declaration order. Parallel `task` calls always live on ONE\n * AI message's `tool_calls`, so \"same parent message\" IS the parallelism boundary;\n * sequential delegations sit on separate AI messages and form singleton groups.\n * The FIRST sibling is the group's `anchorId`: its tool-part render draws the whole\n * side-by-side group and the other siblings render nothing, keeping the layout\n * change fully inside the `task` tool UI. Falls back to a singleton group when the\n * parent AI message isn't among `messages` (a turn's bound sources, or a raw\n * transcript).\n */\nexport interface TaskSiblingGroup {\n /** Sibling `task` tool-call ids in declaration order. */\n ids: string[];\n /** The first sibling — the one tool-part render that owns the group's UI. */\n anchorId: string;\n}\n\nexport function taskSiblingGroup(\n messages: readonly LangChainMessage[],\n toolCallId: string\n): TaskSiblingGroup {\n for (const m of messages) {\n if (m.type !== 'ai' || !m.tool_calls) continue;\n if (!m.tool_calls.some((tc) => tc.id === toolCallId)) continue;\n const ids = m.tool_calls\n .filter((tc) => tc.name === TASK_TOOL_NAME && tc.id)\n .map((tc) => tc.id as string);\n if (ids.length > 0) return { ids, anchorId: ids[0] ?? toolCallId };\n break;\n }\n return { ids: [toolCallId], anchorId: toolCallId };\n}\n"],"names":[],"mappings":"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"}
@@ -0,0 +1,111 @@
1
+ /**
2
+ * The asset-subscription delivery that woke a conversation, read from the user
3
+ * turn the delivery started.
4
+ *
5
+ * When an asset subscription fires, agora starts a turn on its conversation
6
+ * with the delivery text the model reads (`render_delivery`), and stamps the
7
+ * facts a person needs beside it under `athena_subscription_event` in the
8
+ * message metadata — server-authoritative like `author`, never sent to the
9
+ * model. The shipped converter exposes that metadata as the thread message's
10
+ * `metadata.custom`, so a surface renders the turn as a compact marker
11
+ * ("Brendon Geils set B4 to Target") instead of a user bubble quoting the
12
+ * delivery text. Olympus draws the same facts as its event card with citation
13
+ * chips; this is the text every other surface shows. The envelope is for
14
+ * RENDERING only: a surface that ignores it degrades to a plain bubble, never
15
+ * to a lost instruction.
16
+ */
17
+ /** `metadata.custom` key agora stamps on a subscription's delivery turn. */
18
+ export declare const SUBSCRIPTION_EVENT_KEY = "athena_subscription_event";
19
+ /** A changed cell or range, and its value now when agora read it. */
20
+ export interface SubscriptionWakeChange {
21
+ /** Where: "B4", "Sheet1!B2:B11", "page 5"; `null` for a place the marker has no words for. */
22
+ place: string | null;
23
+ /** The value now; `null` when agora read none (a busy run's tray, a failed or capped read). */
24
+ value: string | null;
25
+ }
26
+ export interface SubscriptionWakeEvent {
27
+ subscriptionId: string;
28
+ /** `event`: something happened on an asset. `schedule`: a check-in the person set. */
29
+ kind: 'event' | 'schedule';
30
+ assetTitle: string | null;
31
+ eventTypes: string[];
32
+ eventCount: number | null;
33
+ /** Who did it, in words: their name, "You", "An agent", "Athena", "Someone", with others counted. */
34
+ actor: string;
35
+ changes: SubscriptionWakeChange[];
36
+ /** Changed places past the ones `changes` lists (agora caps the list): counted, never named. */
37
+ moreChanges: number;
38
+ /** The ranges the subscription names ("B2:B11"); empty for the whole asset. */
39
+ subscribed: string[];
40
+ /** Where a comment event's thread sits, when its anchor names a place. */
41
+ commentPlace: string | null;
42
+ /** Whether a comment-resolved event resolved (true) or reopened (false); `null` when unsaid. */
43
+ commentResolved: boolean | null;
44
+ /** When the person set a scheduled check-in. */
45
+ scheduleSetAt: string | null;
46
+ /** A scheduled check-in's own words. */
47
+ note: string | null;
48
+ runsLeft: number | null;
49
+ deliveredAt: string | null;
50
+ /** A GitHub event's subject (the envelope's `connector`); `null` for any other event. */
51
+ github: SubscriptionWakeGithub | null;
52
+ }
53
+ /** A GitHub event's subject as agora's chip carries it: ids and a state word, never text. */
54
+ export interface SubscriptionWakeGithub {
55
+ /** `owner/repo`. */
56
+ repo: string | null;
57
+ /** The pull request or issue; `null` when the event names none (a check on no pull request). */
58
+ number: number | null;
59
+ /** `merged` or `closed`, a review's state, or a check's conclusion, lowercased. */
60
+ state: string | null;
61
+ }
62
+ /**
63
+ * Where a reference-standard anchor in agora's wire form points, in words:
64
+ * a range or cell (with its sheet when the anchor names one), a page, a
65
+ * slide; `null` for any other place.
66
+ */
67
+ export declare function subscriptionPlaceWords(anchor: unknown): string | null;
68
+ /**
69
+ * The GitHub subject of an envelope's `connector`, or `null` when the
70
+ * connector is absent or another provider's (Slack).
71
+ */
72
+ export declare function subscriptionWakeGithub(connector: unknown): SubscriptionWakeGithub | null;
73
+ /**
74
+ * The delivery behind a thread message's `metadata.custom`, or `undefined`
75
+ * when the message is not a subscription's delivery (or carries no
76
+ * subscription id). Every other field is read leniently: a field of the wrong
77
+ * shape reads as absent.
78
+ */
79
+ export declare function readSubscriptionWakeEvent(custom: Record<string, unknown> | null | undefined): SubscriptionWakeEvent | undefined;
80
+ /**
81
+ * Whether a thread message is a subscription's delivery. Returns a primitive,
82
+ * so it is safe as a `useAuiState` selector.
83
+ */
84
+ export declare function isSubscriptionWakeMessage(custom: Record<string, unknown> | null | undefined): boolean;
85
+ /**
86
+ * The words for a delivery whose events are all GitHub's, from its first
87
+ * event (the one the chip describes; the detail line counts the rest), or
88
+ * `null` for any other delivery. Olympus's event card says the same.
89
+ */
90
+ export declare function githubSubscriptionHeadline({ eventTypes, github, }: {
91
+ eventTypes: readonly string[];
92
+ github: SubscriptionWakeGithub | null;
93
+ }): string | null;
94
+ /**
95
+ * The marker's line: who did what, where — "Brendon Geils set B4 to Target",
96
+ * "Brendon Geils changed B4" when agora read no value, "Ana Lopez commented
97
+ * on B7", "Brendon Geils set B4 to Target and commented on B7" for a batch
98
+ * that carried both — for GitHub, what happened to the pull request ("A
99
+ * check failed on #47506") — or, for a schedule, "Scheduled check-in you set
100
+ * on Oct 8" (`now` decides "today" and "yesterday").
101
+ */
102
+ export declare function subscriptionWakeHeadline({ event, now, }: {
103
+ event: SubscriptionWakeEvent;
104
+ now?: Date;
105
+ }): string;
106
+ /**
107
+ * The line under it: "Series A Investors · subscribed to B2:B11 · 99 runs
108
+ * left · 3 events" for an asset event; a check-in's note for a schedule.
109
+ * `null` when there is nothing to add.
110
+ */
111
+ export declare function subscriptionWakeDetail(event: SubscriptionWakeEvent): string | null;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The statewire hooks read the NEAREST aui thread's extras and throw when those
3
+ * aren't statewire extras — which is the case inside nested read-only runtimes
4
+ * (e.g. a transcript drawer) and on legacy (non-statewire) threads. Duck-type
5
+ * the pieces the statewire components actually consume; a wider shape check
6
+ * would silently hide live affordances if the library ever drops an unrelated
7
+ * field.
8
+ */
9
+ export declare function hasStatewireThreadExtras(extras: unknown): boolean;
10
+ export interface StatewireFailedActions {
11
+ retryFailed: (messageId: string) => void;
12
+ discardFailed: (messageId: string) => void;
13
+ }
14
+ /** One projected failed run send: the message id plus the failure that
15
+ * retained it (`runs.failed` entry, structurally). */
16
+ export interface StatewireFailedSendEntry {
17
+ id: string;
18
+ sendFailure: {
19
+ fate: string;
20
+ /**
21
+ * Set on an `aborted` send that was never attempted because an earlier
22
+ * send in the same detach batch WAS attempted and settled `lost`: the
23
+ * library cannot know whether that predecessor ran, so the successor
24
+ * must not be re-dispatched ahead of it (`StatewireClient.SendFailure`).
25
+ */
26
+ predecessorLost?: boolean;
27
+ };
28
+ }
29
+ /** The failed-send lane surface the send-recovery controller consumes. */
30
+ export interface StatewireFailedSendLane {
31
+ failed: readonly StatewireFailedSendEntry[];
32
+ /** Re-dispatches the entry against the current thread — same message id,
33
+ * re-anchored — and removes it from the lane. Throws for unknown ids. */
34
+ retryFailed: (messageId: string) => void;
35
+ }
36
+ /**
37
+ * The failed-send lane off a statewire thread's extras, or `null` when the
38
+ * extras are not a statewire thread's (nested read-only runtimes, legacy
39
+ * threads) — same duck-typing posture as {@link hasStatewireThreadExtras}.
40
+ */
41
+ export declare function readStatewireFailedSendLane(extras: unknown): StatewireFailedSendLane | null;
42
+ /** The failed-send lane actions off a statewire thread's extras, or throw. */
43
+ export declare function requireStatewireFailedActions(extras: unknown): StatewireFailedActions;
@@ -0,0 +1,364 @@
1
+ import { z } from 'zod';
2
+ export declare const HANDOFF_DESTINATIONS: readonly ['chrome', 'mobile', 'word', 'powerpoint', 'excel'];
3
+ export type HandoffDestination = (typeof HANDOFF_DESTINATIONS)[number];
4
+ export declare const OFFICE_HANDOFF_DESTINATIONS: readonly ['word', 'powerpoint', 'excel'];
5
+ export type OfficeHandoffDestination = (typeof OFFICE_HANDOFF_DESTINATIONS)[number];
6
+ /** Destinations agora brokers; Chrome is launched page-side by the extension. */
7
+ export declare const SERVER_HANDOFF_DESTINATIONS: readonly ["mobile", "word", "powerpoint", "excel"];
8
+ export type ServerHandoffDestination = (typeof SERVER_HANDOFF_DESTINATIONS)[number];
9
+ export type HandoffSource = 'spaces' | 'chrome' | 'mobile' | 'word' | 'powerpoint' | 'excel';
10
+ export declare const handoffEnvironmentSchema: z.ZodEnum<{
11
+ localhost: "localhost";
12
+ production: "production";
13
+ staging: "staging";
14
+ }>;
15
+ export type HandoffEnvironment = z.infer<typeof handoffEnvironmentSchema>;
16
+ export declare const handoffStateSchema: z.ZodEnum<{
17
+ acknowledged: "acknowledged";
18
+ claimed: "claimed";
19
+ failed: "failed";
20
+ issued: "issued";
21
+ launched: "launched";
22
+ }>;
23
+ export type HandoffState = z.infer<typeof handoffStateSchema>;
24
+ export declare const handoffReadinessStateSchema: z.ZodEnum<{
25
+ not_registered: "not_registered";
26
+ registered: "registered";
27
+ stale: "stale";
28
+ unknown: "unknown";
29
+ unsupported: "unsupported";
30
+ }>;
31
+ export type HandoffReadinessState = z.infer<typeof handoffReadinessStateSchema>;
32
+ export declare const destinationReadinessSchema: z.ZodObject<{
33
+ destination: z.ZodEnum<{
34
+ chrome: "chrome";
35
+ excel: "excel";
36
+ mobile: "mobile";
37
+ powerpoint: "powerpoint";
38
+ word: "word";
39
+ }>;
40
+ state: z.ZodEnum<{
41
+ not_registered: "not_registered";
42
+ registered: "registered";
43
+ stale: "stale";
44
+ unknown: "unknown";
45
+ unsupported: "unsupported";
46
+ }>;
47
+ last_seen_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
48
+ label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ marketplace_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ }, z.core.$strip>;
51
+ export type DestinationReadiness = z.infer<typeof destinationReadinessSchema>;
52
+ export declare const handoffReadinessResponseSchema: z.ZodObject<{
53
+ environment: z.ZodEnum<{
54
+ localhost: "localhost";
55
+ production: "production";
56
+ staging: "staging";
57
+ }>;
58
+ destinations: z.ZodArray<z.ZodObject<{
59
+ destination: z.ZodEnum<{
60
+ chrome: "chrome";
61
+ excel: "excel";
62
+ mobile: "mobile";
63
+ powerpoint: "powerpoint";
64
+ word: "word";
65
+ }>;
66
+ state: z.ZodEnum<{
67
+ not_registered: "not_registered";
68
+ registered: "registered";
69
+ stale: "stale";
70
+ unknown: "unknown";
71
+ unsupported: "unsupported";
72
+ }>;
73
+ last_seen_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
74
+ label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
75
+ marketplace_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
76
+ }, z.core.$strip>>;
77
+ }, z.core.$strip>;
78
+ export type HandoffReadinessResponse = z.infer<typeof handoffReadinessResponseSchema>;
79
+ export declare const threadHandoffViewSchema: z.ZodObject<{
80
+ handoff_id: z.ZodString;
81
+ thread_id: z.ZodString;
82
+ session_asset_id: z.ZodNullable<z.ZodString>;
83
+ source: z.ZodString;
84
+ destination: z.ZodEnum<{
85
+ chrome: "chrome";
86
+ excel: "excel";
87
+ mobile: "mobile";
88
+ powerpoint: "powerpoint";
89
+ word: "word";
90
+ }>;
91
+ environment: z.ZodEnum<{
92
+ localhost: "localhost";
93
+ production: "production";
94
+ staging: "staging";
95
+ }>;
96
+ state: z.ZodEnum<{
97
+ acknowledged: "acknowledged";
98
+ claimed: "claimed";
99
+ failed: "failed";
100
+ issued: "issued";
101
+ launched: "launched";
102
+ }>;
103
+ issued_at: z.ZodString;
104
+ expires_at: z.ZodString;
105
+ claimed_at: z.ZodNullable<z.ZodString>;
106
+ acknowledged_at: z.ZodNullable<z.ZodString>;
107
+ failure_reason: z.ZodNullable<z.ZodString>;
108
+ push_delivered: z.ZodNullable<z.ZodBoolean>;
109
+ }, z.core.$strip>;
110
+ export type ThreadHandoffView = z.infer<typeof threadHandoffViewSchema>;
111
+ export declare const mobileHandoffLaunchSchema: z.ZodObject<{
112
+ kind: z.ZodLiteral<"mobile">;
113
+ push_attempted: z.ZodBoolean;
114
+ push_delivered: z.ZodBoolean;
115
+ device_count: z.ZodNumber;
116
+ link_url: z.ZodString;
117
+ scheme_url: z.ZodString;
118
+ }, z.core.$strip>;
119
+ export type MobileHandoffLaunch = z.infer<typeof mobileHandoffLaunchSchema>;
120
+ export declare const officeHandoffLaunchSchema: z.ZodObject<{
121
+ kind: z.ZodLiteral<"office">;
122
+ host: z.ZodEnum<{
123
+ excel: "excel";
124
+ powerpoint: "powerpoint";
125
+ word: "word";
126
+ }>;
127
+ desktop_url: z.ZodString;
128
+ template_url: z.ZodString;
129
+ web_url: z.ZodString;
130
+ marketplace_url: z.ZodNullable<z.ZodString>;
131
+ }, z.core.$strip>;
132
+ export type OfficeHandoffLaunch = z.infer<typeof officeHandoffLaunchSchema>;
133
+ export declare const chromeHandoffLaunchSchema: z.ZodObject<{
134
+ kind: z.ZodLiteral<"chrome">;
135
+ }, z.core.$strip>;
136
+ export declare const handoffLaunchSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
137
+ kind: z.ZodLiteral<"mobile">;
138
+ push_attempted: z.ZodBoolean;
139
+ push_delivered: z.ZodBoolean;
140
+ device_count: z.ZodNumber;
141
+ link_url: z.ZodString;
142
+ scheme_url: z.ZodString;
143
+ }, z.core.$strip>, z.ZodObject<{
144
+ kind: z.ZodLiteral<"office">;
145
+ host: z.ZodEnum<{
146
+ excel: "excel";
147
+ powerpoint: "powerpoint";
148
+ word: "word";
149
+ }>;
150
+ desktop_url: z.ZodString;
151
+ template_url: z.ZodString;
152
+ web_url: z.ZodString;
153
+ marketplace_url: z.ZodNullable<z.ZodString>;
154
+ }, z.core.$strip>, z.ZodObject<{
155
+ kind: z.ZodLiteral<"chrome">;
156
+ }, z.core.$strip>], "kind">;
157
+ export type HandoffLaunch = z.infer<typeof handoffLaunchSchema>;
158
+ export declare const createThreadHandoffResponseSchema: z.ZodObject<{
159
+ handoff: z.ZodObject<{
160
+ handoff_id: z.ZodString;
161
+ thread_id: z.ZodString;
162
+ session_asset_id: z.ZodNullable<z.ZodString>;
163
+ source: z.ZodString;
164
+ destination: z.ZodEnum<{
165
+ chrome: "chrome";
166
+ excel: "excel";
167
+ mobile: "mobile";
168
+ powerpoint: "powerpoint";
169
+ word: "word";
170
+ }>;
171
+ environment: z.ZodEnum<{
172
+ localhost: "localhost";
173
+ production: "production";
174
+ staging: "staging";
175
+ }>;
176
+ state: z.ZodEnum<{
177
+ acknowledged: "acknowledged";
178
+ claimed: "claimed";
179
+ failed: "failed";
180
+ issued: "issued";
181
+ launched: "launched";
182
+ }>;
183
+ issued_at: z.ZodString;
184
+ expires_at: z.ZodString;
185
+ claimed_at: z.ZodNullable<z.ZodString>;
186
+ acknowledged_at: z.ZodNullable<z.ZodString>;
187
+ failure_reason: z.ZodNullable<z.ZodString>;
188
+ push_delivered: z.ZodNullable<z.ZodBoolean>;
189
+ }, z.core.$strip>;
190
+ launch: z.ZodDiscriminatedUnion<[z.ZodObject<{
191
+ kind: z.ZodLiteral<"mobile">;
192
+ push_attempted: z.ZodBoolean;
193
+ push_delivered: z.ZodBoolean;
194
+ device_count: z.ZodNumber;
195
+ link_url: z.ZodString;
196
+ scheme_url: z.ZodString;
197
+ }, z.core.$strip>, z.ZodObject<{
198
+ kind: z.ZodLiteral<"office">;
199
+ host: z.ZodEnum<{
200
+ excel: "excel";
201
+ powerpoint: "powerpoint";
202
+ word: "word";
203
+ }>;
204
+ desktop_url: z.ZodString;
205
+ template_url: z.ZodString;
206
+ web_url: z.ZodString;
207
+ marketplace_url: z.ZodNullable<z.ZodString>;
208
+ }, z.core.$strip>, z.ZodObject<{
209
+ kind: z.ZodLiteral<"chrome">;
210
+ }, z.core.$strip>], "kind">;
211
+ }, z.core.$strip>;
212
+ export type CreateThreadHandoffResponse = z.infer<typeof createThreadHandoffResponseSchema>;
213
+ export interface CreateThreadHandoffInput {
214
+ threadId: string;
215
+ destination: ServerHandoffDestination;
216
+ source: HandoffSource;
217
+ }
218
+ /**
219
+ * Surface-specific HTTP adapter. Olympus binds it to `apiClient`; the
220
+ * extension binds it to its authenticated fetch. Both must resolve (not
221
+ * reject) with parsed responses so the flow can attribute failures.
222
+ */
223
+ export interface ThreadHandoffTransport {
224
+ getReadiness: (options: {
225
+ signal?: AbortSignal;
226
+ }) => Promise<HandoffReadinessResponse>;
227
+ createHandoff: (input: CreateThreadHandoffInput) => Promise<CreateThreadHandoffResponse>;
228
+ getHandoff: (options: {
229
+ handoffId: string;
230
+ signal?: AbortSignal;
231
+ }) => Promise<ThreadHandoffView>;
232
+ }
233
+ export declare const HANDOFF_DESTINATION_LABELS: Record<HandoffDestination, string>;
234
+ export declare const isOfficeHandoffDestination: (destination: HandoffDestination) => destination is OfficeHandoffDestination;
235
+ export declare const isServerHandoffDestination: (destination: HandoffDestination) => destination is ServerHandoffDestination;
236
+ /** Index a readiness response by destination; missing rows read as `unknown`. */
237
+ export declare const readinessByDestination: (response: HandoffReadinessResponse | null | undefined) => Record<HandoffDestination, DestinationReadiness>;
238
+ /**
239
+ * How a mobile handoff should be presented before the phone answers.
240
+ *
241
+ * - `app`: a fresh push token exists — the phone gets a notification and the
242
+ * QR is only offered as a secondary path.
243
+ * - `qr`: no usable device is known — lead with the QR / link.
244
+ */
245
+ export type MobileLaunchMode = 'app' | 'qr';
246
+ export declare const selectMobileLaunchMode: (readiness: DestinationReadiness | null | undefined) => MobileLaunchMode;
247
+ /**
248
+ * What a "Continue in…" row should say for a destination given its readiness.
249
+ * Shared so Spaces and the extension render identical copy.
250
+ */
251
+ export interface HandoffDestinationPresentation {
252
+ destination: HandoffDestination;
253
+ label: string;
254
+ /** Secondary line under the label; `null` when the row needs no caveat. */
255
+ detail: string | null;
256
+ /**
257
+ * `install` rows do not create a handoff — they point at install help;
258
+ * `unavailable` rows are disabled.
259
+ */
260
+ action: 'handoff' | 'install' | 'unavailable';
261
+ }
262
+ export declare const presentHandoffDestination: ({ destination, readiness, }: {
263
+ destination: HandoffDestination;
264
+ readiness: DestinationReadiness | null | undefined;
265
+ }) => HandoffDestinationPresentation;
266
+ /**
267
+ * QR symbol for a handoff link as a single SVG path in module units, so any
268
+ * surface can render `<svg viewBox="0 0 {size} {size}"><path d={path} /></svg>`
269
+ * without a canvas or an image request.
270
+ */
271
+ export declare const buildHandoffQrSvg: ({ text }: {
272
+ text: string;
273
+ }) => {
274
+ size: number;
275
+ path: string;
276
+ };
277
+ export type HandoffOutcome = {
278
+ status: 'acknowledged';
279
+ handoff: ThreadHandoffView;
280
+ } | {
281
+ status: 'failed';
282
+ handoff: ThreadHandoffView | null;
283
+ reason: string;
284
+ } | {
285
+ status: 'timeout';
286
+ handoff: ThreadHandoffView | null;
287
+ } | {
288
+ status: 'cancelled';
289
+ handoff: ThreadHandoffView | null;
290
+ };
291
+ export declare const isTerminalHandoffState: (state: HandoffState) => boolean;
292
+ export interface WaitForHandoffOutcomeOptions {
293
+ transport: Pick<ThreadHandoffTransport, 'getHandoff'>;
294
+ handoffId: string;
295
+ /** Wall-clock budget; mobile pushes typically land in seconds, Office launches in tens of seconds. */
296
+ timeoutMs: number;
297
+ pollIntervalMs?: number;
298
+ signal?: AbortSignal;
299
+ onUpdate?: (handoff: ThreadHandoffView) => void;
300
+ /** Injected for tests. */
301
+ now?: () => number;
302
+ sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
303
+ }
304
+ /**
305
+ * Poll one handoff until the destination acknowledges, the server marks it
306
+ * failed, the budget elapses, or the caller aborts. Each request is bound to
307
+ * the remaining budget so a stalled response cannot outlive the deadline.
308
+ * Retryable transport errors are retried within the budget; permanent ones
309
+ * (auth, wrong deployment, malformed payload) fail immediately with their
310
+ * actionable message. The last known view is reported.
311
+ */
312
+ export declare function waitForHandoffOutcome({ transport, handoffId, timeoutMs, pollIntervalMs, signal, onUpdate, now, sleep, }: WaitForHandoffOutcomeOptions): Promise<HandoffOutcome>;
313
+ /** Error raised by a transport when the server no longer knows the handoff (404). */
314
+ export declare class HandoffGoneError extends Error {
315
+ constructor(handoffId: string);
316
+ }
317
+ export declare const isHandoffGoneError: (error: unknown) => error is HandoffGoneError;
318
+ /**
319
+ * Transport failure that polling the same handoff can never recover from:
320
+ * the session is signed out, the token belongs to another deployment, the
321
+ * server rejected the request, or the payload did not match the schema.
322
+ */
323
+ export declare class HandoffPermanentError extends Error {
324
+ constructor(message: string, options?: {
325
+ cause?: unknown;
326
+ });
327
+ }
328
+ export declare const isHandoffPermanentError: (error: unknown) => error is HandoffPermanentError;
329
+ export type HandoffTransportErrorKind = 'gone' | 'permanent' | 'retryable';
330
+ /**
331
+ * Shared classification for both transports: only network failures and
332
+ * retryable server statuses keep the poll alive. Schema mismatches surface as
333
+ * `ZodError` from either adapter and are permanent.
334
+ */
335
+ export declare const classifyHandoffTransportError: (error: unknown) => HandoffTransportErrorKind;
336
+ /** 5xx, timeouts and rate limits may clear on the next poll; any other 4xx will not. */
337
+ export declare const isRetryableHandoffHttpStatus: (status: number) => boolean;
338
+ /**
339
+ * Map a non-2xx status to the transport error the poll loop understands.
340
+ * `detail` is the server's actionable message when it sent one.
341
+ */
342
+ export declare const handoffHttpError: ({ handoffId, status, detail, }: {
343
+ handoffId: string;
344
+ status: number;
345
+ detail: string | null;
346
+ }) => Error;
347
+ export declare const describeHandoffTransportError: (error: unknown) => string;
348
+ /** `?handoff=<id>` — the query parameter mobile-web and QR links carry. */
349
+ export declare const HANDOFF_URL_PARAM = "handoff";
350
+ /**
351
+ * Read a handoff id from a URL. Ids are server-issued, URL-safe tokens; anything
352
+ * else is rejected so a tampered link never reaches the claim path.
353
+ */
354
+ export declare const parseHandoffIdParam: (value: string | null | undefined) => string | null;
355
+ /** Athena Mobile's custom URL scheme (`mobile-app-react-native/app.json` → `scheme`). */
356
+ export declare const MOBILE_APP_SCHEME = "athenavisionapplication";
357
+ /**
358
+ * Custom-scheme launch for a handoff — what a phone's browser opens when the
359
+ * Universal/App Link landed on mobile web instead of in the app. Mirrors
360
+ * agora's `_mobile_scheme_url`; carries only the opaque handoff id.
361
+ */
362
+ export declare const buildMobileHandoffSchemeUrl: ({ handoffId }: {
363
+ handoffId: string;
364
+ }) => string;