@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,74 @@
1
+ export { AthenaAssetAttachmentAdapter, type AthenaAssetAttachmentAdapterOptions, type ChatAssetMentionHandler, type ChatAssetUploadResponse, getChatAssetMentionHandler, registerChatAssetMentionHandler, sniffAssetTypeForFile, uploadChatAsset, type UploadChatAssetOptions, uploadedChatAsset, type UploadedChatAsset, } from "./asset-attachment";
2
+ export { ATHENA_ASSET_DRAG_MIME, type AthenaAssetDrop, FLEXLAYOUT_DRAG_TEXT_SENTINEL, FLEXLAYOUT_TAB_DRAG_MIME, isAthenaAssetDrag, readAthenaAssetDrop, serializeAthenaAssetDrag, } from "./athena-asset-drag";
3
+ export { CLIENT_TOOL_INTERRUPT_SOURCE, clientToolCallArgs, type ClientToolCachedResume, type ClientToolCallRequest, type ClientToolDefinition, clientToolErrorEnvelope, type ClientToolErrorEnvelope, type ClientToolHandler, type ClientToolHandlerContext, type ClientToolInterruptPayload, type ClientToolRequestTracker, type ClientToolResumeAttempt, type ClientToolResultEnvelope, clientToolResultsResumeValue, clientToolRunConfigEntries, clientToolSuccessEnvelope, type ClientToolSuccessEnvelope, createClientToolRequestTracker, type CreateClientToolRequestTrackerOptions, hasClientToolInterruptSource, isClientToolInterrupt, type RegisteredClientTool, } from "./client-tools";
4
+ export { CLIENT_TOOL_WRITE_DECLINED_MESSAGE, type ClientToolBridgeTool, type ClientToolCallSettledEvent, clientToolClaimKey, type ClientToolWriteConsentDecision, defaultMissingClientToolMessage, executeClientToolBatch, type ExecuteClientToolBatchOptions, isPendingClientToolRequest, jsonSafeClientToolResult, useStatewireClientToolBridge, type UseStatewireClientToolBridgeOptions, } from "./client-tool-bridge";
5
+ export { conversationIndexFingerprint, conversationIndexId, conversationIndexUrlFromStatewireUrl, type ConversationIndexEntry, type ConversationWatchActivity, useConversationIndex, type UseConversationIndexOptions, type UseConversationIndexResult, watchActivityFingerprint, } from "./conversation-index";
6
+ export { cancelConversationListCaches, CONVERSATION_ATTENTIONS, CONVERSATION_LIST_DEFAULT_SCOPE_KEY, CONVERSATION_LIST_QUERY_KEY_ROOT, type ConversationAttention, type ConversationAttentionSource, type ConversationListFetcher, type ConversationListFetchParams, type ConversationListFilter, type ConversationListPage, conversationListFilterKey, conversationListQueryKeys, type ConversationPullRequest, type ConversationSummary, type ConversationWake, deriveConversationAttention, invalidateConversationListCaches, isConversationRunning, mergeConversationIndexIntoPage, mergeConversationPages, normalizeConversationListFilter, patchConversationListCaches, patchConversationsInPage, prependConversationToPage, removeConversationFromListCaches, removeConversationFromPage, summaryFromConversationIndexEntry, } from "./conversation-list";
7
+ export { CATEGORY_EMOJI, defaultToolDisplayMeta, describeDelegation, describeNamed, describePackage, describePath, describeQuery, describeRange, describeSql, describeTable, describeToolArgs, describeUrl, formatToolName, getCategoryEmoji, getToolDisplayMeta, hasToolDisplayMeta, isInlineTool, knownToolNames, TOOL_DISPLAY_META, type ToolArgsDescriber, type ToolCategory, toolActiveLabel, toolCompletedLabel, type ToolDisplayMeta, type ToolDisplayMetaEntry, type ToolIconKey, toolStatusLabel, type ToolStatusLabelState, truncateLine, } from "./tool-metadata";
8
+ export { classifyToolResult, isRecord, isRejectedToolResult, isToolResultSuccess, parseJsonRecord, readRejectedToolResult, type RejectedToolResult, resultMessage, resultRecord, stringField, type ToolCallStatusLike, toolFailure, type ToolFailure, type ToolResultClassification, type ToolResultState, } from "./tool-result";
9
+ export { type ConversationListController, useConversationList, type UseConversationListOptions, } from "./use-conversation-list";
10
+ export { CLIENT_TOOL_RESULT_STATUS_ERROR, CLIENT_TOOL_RESULT_STATUS_SUCCESS, CLIENT_TOOL_RESULT_STATUSES, type ClientToolResultEnvelopeContract, type ClientToolResultStatus, DEEP_AGENT_CONTEXT_PROTOCOL, DEEP_AGENT_CUT_LANE_DOCUMENT, DEEP_AGENT_DEFAULT_MESSAGE_WINDOW, DEEP_AGENT_FOLLOW_TOOL_CALL_ID_KEY, DEEP_AGENT_INTEREST_PROTOCOL, DEEP_AGENT_LANE_CUT_PROTOCOL_VERSION, DEEP_AGENT_LANE_FOLLOW_PROTOCOL_VERSION, DEEP_AGENT_MAIN_NS, DEEP_AGENT_MAX_FOLLOWED_STEPS, DEEP_AGENT_MAX_LANE_PAGE, DEEP_AGENT_HISTORY_IMAGE_COMMAND, DEEP_AGENT_HISTORY_LANE_COMMAND, DEEP_AGENT_HISTORY_LANE_IMAGE_COMMAND, DEEP_AGENT_HISTORY_LANE_PAGE_CHARS, DEEP_AGENT_HISTORY_MESSAGE_COMMAND, DEEP_AGENT_HISTORY_TOOL_OUTPUT_COMMAND, DEEP_AGENT_INLINE_IMAGE_WIRE_BUDGET, DEEP_AGENT_MAX_INTERESTS, DEEP_AGENT_MAX_MESSAGE_WINDOW, DEEP_AGENT_MESSAGE_WINDOW_HEADER, DEEP_AGENT_MIN_MESSAGE_WINDOW, DEEP_AGENT_OMITTED_IMAGE_KEY, DEEP_AGENT_OMITTED_IMAGE_PLACEHOLDER_URL, DEEP_AGENT_PROTOCOL_STATE_KEY, DEEP_AGENT_PROTOCOL_VERSION, DEEP_AGENT_PROTOCOL_VERSION_HEADER, DEEP_AGENT_REPEATS_RESULT_KEY, DEEP_AGENT_RUNNING_LANE_WIRE_MESSAGES, DEEP_AGENT_RUNTIME_MARKER, DEEP_AGENT_TRUNCATED_CONTENT_KEY, DEEP_AGENT_TRUNCATED_LANE_KEY, KNOWN_START_CHANNEL_SET, KNOWN_START_CHANNELS, type KnownStartChannel, RUN_CONFIG_COMPANION_CUSTOM_KEYS, RUN_CONFIG_CUSTOM_KEY_SET, RUN_CONFIG_CUSTOM_KEYS, RUN_CONFIG_PARSED_CUSTOM_KEYS, RUN_CONFIG_PER_SEND_CUSTOM_KEY_SET, RUN_CONFIG_PER_SEND_CUSTOM_KEYS, type RunConfigCustomKey, type RunConfigPerSendCustomKey, DEEP_AGENT_CONFIG_COMMANDS, DEEP_AGENT_CONFIG_STATE_KEY, THREAD_CONFIG_CUSTOM_KEY_SET, THREAD_CONFIG_CUSTOM_KEYS, type ThreadConfigCustomKey, } from "./generated/runconfig-contract";
11
+ export { COLLAB_AGENT_CHANNEL_SESSION_MISMATCH, CONVERSATION_ARCHIVED, CONVERSATION_ARCHIVED_MESSAGE, isConversationArchivedRejection, isLegacyThreadReadOnlyRejection, isStatewireChannelTeardown, isStatewireCommandAuthContextExpired, isStatewireExpiredVerdict, isStatewireRewindAnchorRejection, projectDeepAgentConnection, readRetryableCommandRejection, readRetryableRunRefusal, readRunStartRefusal, type RetryableCommandRejection, type RetryableRunRefusal, type RunStartRefusal, STATEWIRE_COMMAND_AUTH_CONTEXT_EXPIRED, statewireRejectionCode, statewireRejectionDetailMessage, statewireRejectionPayload, type StatewireRejectionPayload, statewireTransportOutcome, } from "./errors";
12
+ export { type ParsedExecuteOutput, parseExecuteOutput, type ShellCommandSummary, summarizeShellCommand, } from "./execute-output";
13
+ export { type AbandonedInputRequest, type ApprovalResumeLock, asHitlApproval, canApproveForSession, DEFAULT_INTERRUPT_PAUSED_MESSAGE, fanLaneDecision, findAbandonedInterrupt, HITL_PENDING_RESUME_GRACE_MS, HITL_REJECT_REASON, HITL_RESUME_TRANSPORT_RETRIES, type HitlActionDecision, type HitlApprovalPayload, actionRequestToolCallIds, hitlResumeActionDecisions, hitlResumeApprove, hitlResumeApproveForSession, INTERRUPT_DECLINE_REASON, interruptMirrorPayload, interruptResumeDecline, hitlResumeReject, isApprovalCardInterrupt, isPendingInterrupt, isResumeTransportLoss, isSystemPauseInterrupt, laneInterruptIds, type PendingActionRequest, type PendingApprovalContext, type PendingApprovalFact, type PendingApprovalWarning, parsePendingApprovalContext, pendingActionRequests, readAbandonedInputRequests, readInterruptMessage, readInterruptMirror, readQueuedLaneDecisions, toolCallIdsAwaitingApproval, useApprovalResumeLock, type UseApprovalResumeLockOptions, } from "./interrupts";
14
+ export { buildQueueEditCommand, buildStatewireQueueRows, describeQueueSendFailure, isFailedSendEntryRace, isQueueEntryUnsettled, QUEUE_AUTO_CONTINUE_DELAY_MS, type QueueEditCommand, queueEntryText, queueLaneFlags, type QueueLaneFlags, readPrioritizedQueueIds, showQueueRowSendNow, showQueueRowSteer, type StatewireQueueRow, userStopBlocksQueueAutoContinue, } from "./queue";
15
+ export { createDeepAgentSendRecovery, type DeepAgentSendRecovery, type DeepAgentSendRecoveryOptions, shouldAutoRetryFailedSend, } from "./send-recovery";
16
+ export { hasStatewireThreadExtras, readStatewireFailedSendLane, requireStatewireFailedActions, type StatewireFailedActions, type StatewireFailedSendEntry, type StatewireFailedSendLane, } from "./thread-extras";
17
+ export { applyRunErrorStatus, ATHENA_ERRORS_KEY, ATHENA_HANDOFF_KEY, ATHENA_QUEUED_LANE_KEY, ATHENA_RUN_MARKER_CANCELLED, ATHENA_RUN_MARKER_FAILED, ATHENA_RUN_MARKER_KEY, ATHENA_RUN_MARKER_SOURCE_KEY, ATHENA_STOP_SOURCE_INSTANCE_CLOSED, ATHENA_STOP_SOURCE_POD_DRAIN, ATHENA_STOP_SOURCE_SEND_NOW, ATHENA_STOP_SOURCE_VOICE_STEER, ATHENA_TERMINATION_REASON_KEY, convertDeepAgentLangChainMessage, convertDeepAgentState, type ConvertDeepAgentStateOptions, createDeepAgentMaterialize, createDeepAgentMessageConversionCache, type DeepAgentConversionMemory, deepAgentMaterialize, type DeepAgentMaterializeOptions, DeepAgentMessageConversionCache, deepAgentRowKey, isConvertibleChatMessage, isDrainRunMarker, isLangGraphState, isMessageHiddenFromFrontend, isQueuedLaneMessage, isServerUpdateStopSource, isSilentRunMarker, laneTailMessages, liftBranchIntoMetadata, liftCompactionBoundaryIntoMetadata, liftConversationStatsIntoMetadata, liftErrorsIntoMetadata, liftHandoffSummaryIntoMetadata, liftModelIntoMetadata, liftRunMarkerIntoMetadata, liftTerminationIntoMetadata, liftToolMessageMetadataIntoArtifact, liftTruncatedToolOutputIntoArtifact, markPreliminaryToolResults, messageConverter, nativeStepUsage, PENDING_ASSISTANT_MESSAGE_ID, readMessageErrorsFromSourceMessages, readRunMarkerFromSourceMessages, readSoleRunMarker, type RunMarkerInfo, sanitizeLangChainMessages, substituteToolOutput, withPendingAssistantMessage, } from "./messages";
18
+ export { ATHENA_TRUNCATED_TOOL_OUTPUT_ARTIFACT_KEY, buildHistoryMessageCommand, buildToolOutputCommand, clampMessageWindowSize, type DeepAgentInterestChainEntry, type DeepAgentInterestRequest, type DeepAgentInterestResolution, type DeepAgentMessageWindow, type DeepAgentMessageWindowDeclaration, headInterestRequest, type HistoryMessageCommand, type HistoryMessageResult, interestsCovered, pageInterestRequest, pageInterestRequests, readDeepAgentInterestDocument, readDeepAgentInterestResolution, readDeepAgentMessageWindow, readHistoryMessageResult, readToolOutputResult, readTruncatedToolContent, readTruncatedToolOutputArtifact, type ToolOutputCommand, type ToolOutputResult, type TruncatedToolContent, type TruncatedToolOutputArtifact, withDeclaredMessageWindow, } from "./message-window";
19
+ export { buildHistoryLaneCommand, type DeepAgentLaneHistoryState, type DeepAgentLaneTarget, deepAgentLaneHistoryQueryKey, type HistoryLaneCommand, type HistoryLanePage, isWholeCardRefusal, mergeLaneHistory, readHistoryLanePage, useDeepAgentLaneHistory, } from "./lane-history";
20
+ export { buildHistoryLaneImageCommand, type DeepAgentLaneImagesState, deepAgentLaneImageQueryKey, type HistoryLaneImageChunk, type HistoryLaneImageCommand, type InlineImage, type InlineImageChunk, type LaneImageRef, laneImageKey, omittedLaneImages, readChunkedInlineImage, readHistoryLaneImageChunk, readInlineImageChunk, readLaneImage, readLaneImageTile, showLaneImages, useDeepAgentLaneImages, } from "./lane-images";
21
+ export { createDeepAgentLaneFollowRegistry, type DeepAgentLaneFollowRegistry, type DeepAgentLaneFollowRequest, type DeepAgentLaneFollows, isLaneFollowRequest, laneFollowRequest, mergeFollowedLane, readDeepAgentFollowedWindow, readDeepAgentLaneFollows, useDeepAgentLaneFollow, useDeepAgentLaneFollowSync, type UseDeepAgentLaneFollowSyncOptions, } from "./lane-follow";
22
+ export { buildDeepAgentEditCommand, type DeepAgentPreparedMessageMetadata, type DeepAgentStatewireExtras, isSourceBelowLoadedWindow, loadOlderDeepAgentHistoryPage, MAX_EDIT_ANCHOR_HISTORY_LOADS, readDeepAgentStatewireExtras, resolveDeepAgentEditCommand, resolveWireAnchorMessageId, } from "./edit-command";
23
+ export { DEEP_AGENT_MAX_CHAINED_HISTORY_LOADS, type DeepAgentHistoryLoadEvent, type DeepAgentWindowSyncMessage, type DeepAgentWindowSyncState, useDeepAgentMessageWindow, useDeepAgentWindowSync, type UseDeepAgentWindowSyncOptions, } from "./use-deep-agent-window-sync";
24
+ export { useDeepAgentMessageEditSubmit } from "./use-deep-agent-edit-submit";
25
+ export { createDeepAgentToolOutputStore, type DeepAgentToolOutputEntry, type DeepAgentToolOutputStore, type DeepAgentToolOutputStoreOptions, } from "./tool-outputs";
26
+ export { claimDeepAgentFailedSendText, type DeepAgentFailedSend, type DeepAgentWithdrawableTurn, type DeepAgentWithdrawnFromRun, type DeepAgentWithdrawnTurns, type DeepAgentWithdrawnTurnVerdict, readDeepAgentFailedSends, readDeepAgentWithdrawableTurn, readDeepAgentWithdrawnTurnVerdict, } from "./withdrawn-turns";
27
+ export { DEEP_AGENT_COMPOSER_MARKDOWN_KEY, isComposerMarkdownOfText, readDeepAgentComposerMarkdown, resetStagedComposerMarkdown, STAGED_COMPOSER_MARKDOWN_TTL_MS, stageComposerMarkdown, takeStagedComposerMarkdownMetadata, trimComposerDraft, withDeepAgentComposerMarkdown, withStagedComposerMarkdown, } from "./composer-markdown";
28
+ export { ATHENA_MESSAGE_AUTHOR_KEY, type DeepAgentMessageAuthor, isSameMessageAuthor, laneEntryAuthor, readMessageAuthor, } from "./message-author";
29
+ export { AIMessage, enrichStreamMessage, getMessageText, modelNameFromMessage, type StreamMessage, ToolMessage, } from "./message-text";
30
+ export { hideUnterminatedMarkdownLink, UNTERMINATED_LABEL_HOLD_LIMIT, UNTERMINATED_LINK_HOLD_LIMIT, } from "./streaming-markdown";
31
+ export { DEFAULT_CUA_SCREENSHOT_SIZE, describeScreenPointError, findScreenPointLinks, fitScreenBasis, formatScreenPoint, isScreenPointHref, parseScreenPointHref, SCREEN_POINT_HREF_PREFIX, SCREEN_POINT_HOST, SCREEN_POINT_PROTOCOL, sameScreenSize, type ScreenBasisFit, type ScreenPoint, type ScreenPointParseError, type ScreenPointParseResult, screenPointFraction, type ScreenSize, serializeScreenPointHref, } from "./screen-point";
32
+ export { type DeepAgentModelContextHost, registerDeepAgentRunConfig, } from "./model-context";
33
+ export { type CompletedPtcParent, extractCompletedPtcParents, type PtcSubcall, ptcSubcallsFromArtifact, } from "./ptc-subcalls";
34
+ export { isRunningToolPlaceholder, isRunningToolPlaceholderArtifact, } from "./running-tool-placeholder";
35
+ export { convertSubagentTranscript, createSubagentLaneConversion, createSubagentTranscriptConversionCache, type SubagentLaneConversion, withLaneReport, withRepeatedResult, } from "./subagent-transcripts";
36
+ export { countSubagentStatuses, deriveEvalSubagents, finalizeOrphanedSubagents, isTerminalSubagentStatus, nestedMessagesFromArtifact, nestedTodosFromArtifact, ORPHANED_SUBAGENT_OUTPUT, ptcSubagentsFromArtifact, readLaneUsage, readTruncatedLane, type SubagentDiscoverySnapshot, type SubagentLaneSource, type SubagentStatus, type SubagentStatusCounts, type SubagentTokenUsage, subagentAwaitingApproval, subagentToolCallAwaitingApproval, type TaskSiblingGroup, type TokenCounts, type TruncatedLane, taskSiblingGroup, taskSubagentsOfThread, taskSubagentsOfTurn, transcriptStepUsage, turnToolCallsAwaitingApproval, useTurnToolCallsAwaitingApproval, } from "./subagents";
37
+ export { ASYNC_TASK_TOOL_NAMES, CANCEL_ASYNC_TASK_TOOL_NAME, CHECK_ASYNC_TASK_TOOL_NAME, EDIT_FILE_TOOL_NAME, EVAL_TOOL_NAME, EXECUTE_PRESENTATION_CODE_TOOL_NAME, EXECUTE_SPREADSHEET_CODE_TOOL_NAME, EXECUTE_TOOL_NAME, EXECUTE_WORD_DOCUMENT_CODE_TOOL_NAME, type FileToolArgs, LIST_ASYNC_TASKS_TOOL_NAME, PTC_PARENT_TOOL_NAMES, RUN_PYTHON_CODE_TOOL_NAME, salientToolCallDetail, START_ASYNC_TASK_TOOL_NAME, TASK_TOOL_NAME, UPDATE_ASYNC_TASK_TOOL_NAME, WRITE_FILE_TOOL_NAME, } from "./tool-names";
38
+ export { buildOptimisticHumanContent, type OptimisticContentPart, } from "./optimistic-content";
39
+ export { DEEP_AGENT_DEFAULT_CLIENT_PROTOCOL_VERSION, type DeepAgentProtocolDeclaration, type DeepAgentProtocolStatus, type DeepAgentWireProtocol, declaredDeepAgentProtocolVersion, isDeepAgentHostState, projectDeepAgentProtocol, readDeepAgentProtocol, withDeclaredProtocolVersion, } from "./protocol";
40
+ export { AUTH_DENIAL_PARK_THRESHOLD, type AuthDenialTrackerState, initialAuthDenialTrackerState, observeAuthDenial, } from "./auth-denial";
41
+ export { isStorageQuotaError, parkIncompatibleSessionCommands, QuotaSafeLocalStorageSession, readFailedSendStampsFromRecord, readPersistedFailedSendStamps, type SessionStorageDegradation, } from "./quota-safe-local-storage-session";
42
+ export { createStatewireDiagnosticsRecorder, type StatewireDiagnosticsCommandUpdate, type StatewireDiagnosticsEntry, type StatewireDiagnosticsRecorder, type StatewireDiagnosticsRecorderOptions, } from "./statewire-diagnostics";
43
+ export { DEEP_AGENT_PRE_STREAM_STATE, isDeepAgentStateHydrated, pairDeepAgentStateWithThread, readDeepAgentStateThreadId, readDeepAgentStreamValues, } from "./statewire-state";
44
+ export { StatewireSuspended, type SuspendedStatewireOptions, } from "./statewire-suspended";
45
+ export { createDeepAgentThreadSnapshotCache, type CreatedDeepAgentThreadSnapshotCache, type DeepAgentThreadSnapshotCache, type DeepAgentThreadSnapshotCacheChange, type DeepAgentThreadSnapshotCacheOptions, toThreadSnapshotSeed, } from "./thread-snapshot-cache";
46
+ export { classifyThreadSnapshotForMirror, createThreadSnapshotMirror, MAX_MIRRORED_SNAPSHOT_MESSAGES, MAX_MIRRORED_SNAPSHOTS_PER_OWNER, type MirroredList, type MirroredThreadSnapshot, SNAPSHOT_MIRROR_DEBOUNCE_MS, THREAD_SNAPSHOT_MIRROR_DATABASE, type ThreadSnapshotKeyPurpose, type ThreadSnapshotMirror, type ThreadSnapshotMirrorOptions, } from "./thread-snapshot-mirror";
47
+ export { CHAT_EDIT_KEPT_MESSAGE, CHAT_EDIT_UNREACHABLE_LABEL, CHAT_OUTBOX_ASK_AFTER_MS, CHAT_OUTBOX_ATTACHMENT_CHECK_TIMEOUT_MS, CHAT_OUTBOX_CLAIM_LEASE_MS, CHAT_OUTBOX_COUNTDOWN_MS, ChatEditUnreachableError, type ChatOutbox, type ChatOutboxCommandUpdate, type ChatOutboxElsewhere, type ChatOutboxEvent, type ChatOutboxInput, type ChatOutboxOptions, type ChatOutboxRow, type ChatOutboxRowState, type ChatOutboxSignal, type ChatOutboxSnapshot, type ChatOutboxThreadPort, type ChatOutboxThreadReadiness, chatOutboxCommandMessageId, chatOutboxFailureMessage, createChatOutbox, } from "./chat-outbox";
48
+ export { CHAT_OUTBOX_DATABASE, CHAT_OUTBOX_FORMAT, type ChatOutboxAttachment, type ChatOutboxClaim, type ChatOutboxClaimResult, type ChatOutboxEntry, type ChatOutboxFailure, type ChatOutboxFailureReason, type ChatOutboxFile, type ChatOutboxKeyPurpose, type ChatOutboxRecord, type ChatOutboxStore, createIndexedDbChatOutboxStore, createMemoryChatOutboxStore, type IndexedDbChatOutboxStoreOptions, parseChatOutboxEntry, readChatOutboxClaim, readChatOutboxFailure, withChatOutboxMemoryFallback, } from "./chat-outbox-store";
49
+ export { type ChatOutboxAssetReadResponse, type ChatOutboxAttachmentCheck, type ChatOutboxAttachmentVerdict, chatOutboxAttachmentPath, createChatOutboxAttachmentCheck, } from "./chat-outbox-attachments";
50
+ export { buildChatOutboxSendCommand, type ChatOutboxClientHost, type ChatOutboxSendCommand, type ChatOutboxWireMessage, chatOutboxHeldIds, chatOutboxReadiness, chatOutboxWireAnchorId, chatOutboxWireMessage, createStatewireChatOutboxPort, } from "./chat-outbox-thread";
51
+ export { allChatOutboxSignals, browserOnlineSignal, documentVisibleSignal, windowInFrontSignal, } from "./chat-outbox-signals";
52
+ export { DeepAgentChatOutboxContext, forwardChatOutboxCommand, useChatOutboxReachable, useChatOutboxSnapshot, useDeepAgentChatOutbox, useDeepAgentChatOutboxContext, type UseDeepAgentChatOutboxOptions, } from "./use-deep-agent-chat-outbox";
53
+ export { createDurableThreadSnapshotCache, type DurableThreadSnapshotCache, type DurableThreadSnapshotCacheOptions, OFFLINE_SNAPSHOT_MAX_AGE_MS, } from "./durable-thread-snapshot-cache";
54
+ export { createDeepAgentThreadPrewarmPool, type DeepAgentPrewarmDiscardReason, type DeepAgentPrewarmTransportFactory, type DeepAgentThreadPrewarmPool, type DeepAgentThreadPrewarmPoolOptions, type PrewarmedDeepAgentHello, } from "./thread-prewarm";
55
+ export { createDeepAgentThreadPrewarmController, type DeepAgentPrewarmReason, type DeepAgentThreadPrewarmController, type DeepAgentThreadPrewarmControllerOptions, deepAgentPrewarmGateKey, } from "./thread-prewarm-controller";
56
+ export { attachRetryGate, type AttachRetryGate, createAttachInstrumentation, createAttachRetryGate, type DeepAgentAttachTimingEvent, type DeepAgentWakeRefusal, instrumentAttachSocket, MAX_RETRY_AFTER_MS, parseRetryAfterFromCloseReason, parseRetryAfterHeaderMs, } from "./statewire-attach-observer";
57
+ export { classifyWakeRefusal, createDeepAgentAttachTransport, type DeepAgentAttachTransportOptions, type DeepAgentWakeFetch, type DeepAgentWakeOptions, type DeepAgentWakeResult, deepAgentThreadUrl, PINBOARD_PLACEMENT_REFUSAL_ERRORS, PINNED_TRANSIENT_WORKER_REFUSALS, WAKE_WORKER_REFUSAL_FLOOR_MS, wakeDeepAgentThread, } from "./deep-agent-transport-recipe";
58
+ export { DEEP_AGENT_STATEWIRE_PROTOCOL, DEEP_AGENT_STATEWIRE_PROTOCOL_VERSION, DEEP_AGENT_STATEWIRE_WIRE_VERSION, statewireTransport, type StatewireTransportOptions, } from "./statewire-transport";
59
+ export { DeepAgentConnectionContext, type DeepAgentStaleRunReason, type DeepAgentThreadStatus, readRunLive, resolveRunLive, resolveStaleRunReason, useDeepAgentConnection, useDeepAgentThreadStatus, } from "./thread-status";
60
+ export { BACK_ONLINE_MS, chatSocketCannotReach, chatSocketOutage, useBrowserOnline, useChatSocketReachability, } from "./chat-socket-reachability";
61
+ export { type DeepAgentConfigControllerInputs, type DeepAgentConfigWriteResult, type DeepAgentServerConfig, type DeepAgentServerConfigEvent, foldPendingConfigOps, isConfigSyncUnavailableRejection, isConfigWriteForbiddenRejection, readConfigVersion, readServerConfig, readThreadServerConfig, useDeepAgentConfig, useDeepAgentConfigController, type UseDeepAgentConfigOptions, type UseDeepAgentConfigResult, } from "./use-deep-agent-config";
62
+ export { applyConfigPatch, applyToolsDisable, applyToolsEnable, diffThreadConfig, pickPerSendCustom, pickThreadConfigCustom, readDeclinedToolkitIds, readEnabledTools, type ThreadConfigCustom, type ThreadConfigPatch, } from "./config-mutations";
63
+ export { DEEP_AGENT_CONNECTION_STATUSES, type DeepAgentConnectionState, type DeepAgentConnectionStatus, type DeepAgentLaneProjection, type DeepAgentStreamValues, type LangGraphState, type PtcSubagentEntry, type Todo, } from "./types";
64
+ export { classifyVoiceStartError, type DeepAgentVoiceDiagnostic, type DeepAgentVoiceDiagnosticEvent, type DeepAgentVoiceFailure, type DeepAgentVoiceFailureKind, type DeepAgentVoiceFailureStage, type DeepAgentVoiceLiveKitAdapter, type DeepAgentVoiceLiveKitAnswer, type DeepAgentVoiceLiveKitSession, type DeepAgentVoiceModelOption, type DeepAgentVoicePhase, type DeepAgentVoiceRemoteStream, type DeepAgentVoiceToolCall, type DeepAgentVoiceTransport, type DeepAgentVoiceWireState, describeVoiceFailure, describeVoiceWireError, float32FromPcm16, formatVoiceElapsed, parseVoiceLiveKitAnswer, parseVoiceModelOptions, pcm16FromFloat32, useDeepAgentVoice, useVoiceElapsed, type UseDeepAgentVoiceOptions, type UseDeepAgentVoiceReturn, VOICE_LIVEKIT_ANSWER_PREFIX, VOICE_LIVEKIT_OFFER, VOICE_RELAY_ANSWER_PREFIX, VOICE_RELAY_SAMPLE_RATE, VOICE_WEBSOCKET_OFFER, voiceRelayUrl, } from "./use-deep-agent-voice";
65
+ export { type DeepAgentVoiceWireError } from "./types";
66
+ export { describeVoiceUpdateToolCall, isSpokenTurnTextPart, isVoiceDelegationMessage, VOICE_DELEGATION_ID_PREFIX, VOICE_LIVE_KEY, VOICE_LIVE_TYPED_HINT, VOICE_SOURCE_DELEGATION, VOICE_SOURCE_SPOKEN, VOICE_SOURCE_TYPED, VOICE_TURN_IDS_KEY, VOICE_UPDATE_TOOL_NAME, type VoiceMessageMarker, type VoiceProvenance, type VoiceUpdateToolCall, voiceProvenanceLabel, voiceUpdateStatusLabel, } from "./voice-presentation";
67
+ export { groupSpokenUserTurns, isSpokenUserTurn } from "./voice-turn-grouping";
68
+ export { canPersistDeepAgentSession, type DeepAgentPendingSession, type DeepAgentRunConfigRegistration, type DeepAgentSessionPersistence, type DeepAgentThreadElement, type DeepAgentThreadStateClientHost, logUnhandledStatewireError, useDeepAgentRuntime, type UseDeepAgentRuntimeOptions, } from "./use-deep-agent-runtime";
69
+ export { type DeepAgentAttachSource, type DeepAgentHeadersResolver, readSessionPersisted, type RunningSnapshot, shouldNotifyRunningChange, useDeepAgentThread, type UseDeepAgentThreadOptions, } from "./use-deep-agent-thread";
70
+ export { GITHUB_EVENT_SOURCE_KEY, type GithubWakeEvent, githubWakeEventLabel, githubWakeEventUrl, githubWakeMarkerText, githubWakeReference, isGithubWakeMessage, readGithubWakeEvent, } from "./github-wake-event";
71
+ export { githubSubscriptionHeadline, isSubscriptionWakeMessage, readSubscriptionWakeEvent, SUBSCRIPTION_EVENT_KEY, type SubscriptionWakeChange, type SubscriptionWakeEvent, type SubscriptionWakeGithub, subscriptionPlaceWords, subscriptionWakeDetail, subscriptionWakeGithub, subscriptionWakeHeadline, } from "./subscription-wake-event";
72
+ export { describeTerminationReason, readRuntimeMessageFromSourceMessages, readSoleRuntimeMessageKind, readTerminationReason, runtimeMessageMarkerText, TERMINATION_REASONS, type AthenaRuntimeMessage, type AthenaRuntimeMessageKind, type AthenaRuntimeMessageSeverity, type AthenaTerminationReason, type TerminationDescription, } from "./runtime-messages";
73
+ export { buildHandoffQrSvg, buildMobileHandoffSchemeUrl, classifyHandoffTransportError, type CreateThreadHandoffInput, type CreateThreadHandoffResponse, createThreadHandoffResponseSchema, describeHandoffTransportError, type DestinationReadiness, HANDOFF_DESTINATION_LABELS, HANDOFF_DESTINATIONS, HANDOFF_URL_PARAM, type HandoffDestination, type HandoffDestinationPresentation, type HandoffEnvironment, HandoffGoneError, type HandoffLaunch, type HandoffOutcome, HandoffPermanentError, type HandoffReadinessResponse, type HandoffReadinessState, type HandoffSource, type HandoffState, type HandoffTransportErrorKind, handoffHttpError, handoffReadinessResponseSchema, handoffStateSchema, isHandoffGoneError, isHandoffPermanentError, isRetryableHandoffHttpStatus, isOfficeHandoffDestination, isServerHandoffDestination, isTerminalHandoffState, type MobileHandoffLaunch, type MobileLaunchMode, mobileHandoffLaunchSchema, OFFICE_HANDOFF_DESTINATIONS, type OfficeHandoffDestination, type OfficeHandoffLaunch, officeHandoffLaunchSchema, parseHandoffIdParam, presentHandoffDestination, readinessByDestination, SERVER_HANDOFF_DESTINATIONS, type ServerHandoffDestination, selectMobileLaunchMode, type ThreadHandoffTransport, type ThreadHandoffView, threadHandoffViewSchema, waitForHandoffOutcome, type WaitForHandoffOutcomeOptions, } from "./thread-handoff";
74
+ export { DEFAULT_MOBILE_HANDOFF_TIMEOUT_MS, DEFAULT_OFFICE_HANDOFF_TIMEOUT_MS, type StartThreadHandoffInput, type ThreadHandoffFlowCallbacks, type ThreadHandoffFlowController, type ThreadHandoffFlowPhase, useThreadHandoffFlow, type UseThreadHandoffFlowOptions, } from "./use-thread-handoff-flow";
@@ -111,6 +111,22 @@ function laneInterruptIds(actionRequests) {
111
111
  }
112
112
  return ids;
113
113
  }
114
+ const NO_TOOL_CALL_IDS = /* @__PURE__ */ new Set();
115
+ function toolCallIdsAwaitingApproval({
116
+ actionRequests,
117
+ queuedLaneDecisions
118
+ }) {
119
+ let ids;
120
+ for (const request of actionRequests) {
121
+ if (request.toolCallId === void 0) continue;
122
+ if (request.interruptId !== void 0 && queuedLaneDecisions !== void 0 && request.interruptId in queuedLaneDecisions) {
123
+ continue;
124
+ }
125
+ ids ?? (ids = /* @__PURE__ */ new Set());
126
+ ids.add(request.toolCallId);
127
+ }
128
+ return ids ?? NO_TOOL_CALL_IDS;
129
+ }
114
130
  function fanLaneDecision({
115
131
  interruptIds,
116
132
  decision
@@ -286,5 +302,6 @@ exports.readAbandonedInputRequests = readAbandonedInputRequests;
286
302
  exports.readInterruptMessage = readInterruptMessage;
287
303
  exports.readInterruptMirror = readInterruptMirror;
288
304
  exports.readQueuedLaneDecisions = readQueuedLaneDecisions;
305
+ exports.toolCallIdsAwaitingApproval = toolCallIdsAwaitingApproval;
289
306
  exports.useApprovalResumeLock = useApprovalResumeLock;
290
307
  //# sourceMappingURL=interrupts.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"interrupts.cjs","sources":["../../../../agent-runtime/src/interrupts.ts"],"sourcesContent":["/**\n * Human-in-the-loop interrupt primitives shared by every statewire chat\n * surface (Olympus, the React SDK, the Office add-in, the Chrome extension,\n * mobile).\n *\n * The agora deep-agent runtime parks a gated run on an `interrupt` input\n * request whose payload carries the Athena `hitl_approval` shape\n * (`athena_deep_agent/hitl_bridge.py`). A surface answers it with\n * `{ type: 'run/input', requestId, response: { type: 'resume', value } }` —\n * the exact command the backend's resume path consumes. This module holds the\n * payload contract (narrowing, resume values) and the shared resume-lock state\n * machine; rendering stays with each surface.\n *\n * Deliberately parameterized rather than self-wiring: these helpers never call\n * `useStatewireRuns`/`useAuiState` themselves. Each surface reads its own\n * statewire hooks (which its tests already mock) and passes the values in, so\n * the shared semantics cannot drift while per-surface wiring stays testable.\n */\n\nimport type { StatewireThread } from '@assistant-ui/react-statewire';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { hasClientToolInterruptSource } from './client-tools';\nimport { statewireTransportOutcome } from './errors';\nimport { readDeepAgentStreamValues } from './statewire-state';\n\n/** Human-in-the-loop approval payload the agora deep-agent runtime parks a run\n * on (shaped by `athena_deep_agent/hitl_bridge.py`). */\nexport interface HitlApprovalPayload {\n source: string;\n type: string;\n message: string;\n /** Risk headline/facts/warnings, when the host includes them. */\n approval_context?: unknown;\n context?: {\n tool_name?: string;\n tool_id?: string;\n tool_call_id?: string;\n tool_args?: Record<string, unknown>;\n pending_action_count?: number;\n approval_context?: unknown;\n /**\n * Every pending gated call (name + args), in decision order. Absent on\n * older backends — fall back to the single `tool_name`/`tool_args` pair.\n * Per-dispatch payloads also carry each lane's `tool_call_id` (the lane\n * card key) and `interrupt_id` (the lane resume key).\n */\n action_requests?: {\n name?: string;\n args?: Record<string, unknown>;\n tool_call_id?: string;\n interrupt_id?: string;\n /**\n * True when \"approve all for this session\" would take effect for this\n * tool (the workspace allows overriding its approval). Absent on older\n * backends and on non-overridable tools: the option is not offered.\n */\n session_approval_allowed?: boolean;\n /**\n * The decision types the parked gate accepts for this call (`approve`,\n * `reject`, `edit`). Absent on older backends: only approve / reject\n * are known to be accepted.\n */\n allowed_decisions?: string[];\n /** What the backend resolved about this call before asking (display-only). */\n approval_context?: unknown;\n }[];\n /**\n * True when each dispatch parked on its own interrupt: decisions submit\n * per lane via `lane_decisions` and each approved lane starts immediately,\n * instead of the legacy batch where one resume must answer every lane.\n */\n per_dispatch?: boolean;\n };\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/** A pending `interrupt` input request; a present `response` key marks it answered. */\nexport function isPendingInterrupt(\n request: StatewireThread.InputRequestState,\n): request is StatewireThread.CustomInputRequest {\n return request.type === 'interrupt' && !('response' in request);\n}\n\n/**\n * Interrupt sources that were system pauses before the host stamped\n * `requires_user_action: false` on them (a background deep-research wait). Kept\n * only for the deploy skew between an older agora and a newer client; delete\n * once every deployment's raiser stamps the flag.\n */\nconst LEGACY_SYSTEM_PAUSE_INTERRUPT_SOURCES: ReadonlySet<string> = new Set(['deep_research_pending']);\n\n/**\n * A park nobody answers: the agent is still working (a background research\n * wait) and the backend resumes it itself. The raiser stamps\n * `requires_user_action: false`; older raisers are recognised by source.\n */\nexport function isSystemPauseInterrupt(payload: unknown): boolean {\n if (!isRecord(payload)) return false;\n if (payload.requires_user_action === false) return true;\n return (\n typeof payload.source === 'string' && LEGACY_SYSTEM_PAUSE_INTERRUPT_SOURCES.has(payload.source)\n );\n}\n\n/**\n * A pending interrupt an approval card may answer. Two kinds are excluded —\n * client-tool parks (the client-tool bridge owns those, and a generic resume\n * would corrupt the parked tool call) and system pauses (nothing to answer; the\n * backend resumes them). The source checks are deliberately loose so a skewed\n * deploy can never route one here.\n */\nexport function isApprovalCardInterrupt(\n request: StatewireThread.InputRequestState,\n): request is StatewireThread.CustomInputRequest {\n if (!isPendingInterrupt(request)) return false;\n const payload = (request as { payload?: unknown }).payload;\n return !hasClientToolInterruptSource(payload) && !isSystemPauseInterrupt(payload);\n}\n\n/** Narrow an interrupt payload to the Athena HITL approval shape. */\nexport function asHitlApproval(value: unknown): HitlApprovalPayload | null {\n if (!isRecord(value)) return null;\n return value.type === 'hitl' &&\n value.source === 'hitl_approval' &&\n typeof value.message === 'string'\n ? (value as unknown as HitlApprovalPayload)\n : null;\n}\n\n/** Default paused-run copy when an interrupt payload carries no message. */\nexport const DEFAULT_INTERRUPT_PAUSED_MESSAGE =\n 'The agent is paused and waiting for input.';\n\n/** Best-effort human-readable message from any interrupt payload. */\nexport function readInterruptMessage(\n value: unknown,\n fallback: string = DEFAULT_INTERRUPT_PAUSED_MESSAGE,\n): string {\n if (isRecord(value) && typeof value.message === 'string' && value.message.length > 0) {\n return value.message;\n }\n return fallback;\n}\n\n/** One label/value row of a call's resolved approval facts. */\nexport interface PendingApprovalFact {\n label: string;\n value: string;\n}\n\n/** One caution of a call's resolved approval facts. */\nexport interface PendingApprovalWarning {\n severity: 'info' | 'warning' | 'critical';\n message: string;\n}\n\nexport interface PendingApprovalSlackTarget {\n catalog_id: string;\n conversation_id: string | null;\n thread_ts: string | null;\n team_url: string | null;\n people: string[];\n}\n\n/**\n * What the backend resolved about a gated call before asking — e.g. where a\n * Slack write goes and as whom (agora `services/interrupts/approval_context.py`).\n * Display-only; the decision still answers the parked call.\n */\nexport interface PendingApprovalContext {\n facts: PendingApprovalFact[];\n warnings: PendingApprovalWarning[];\n slack_target?: PendingApprovalSlackTarget;\n}\n\nconst APPROVAL_WARNING_SEVERITIES = new Set(['info', 'warning', 'critical']);\n\nfunction isNullableString(value: unknown): value is string | null {\n return value === null || typeof value === 'string';\n}\n\nfunction isStringArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every((entry) => typeof entry === 'string');\n}\n\nfunction parsePendingApprovalSlackTarget(value: unknown): PendingApprovalSlackTarget | undefined {\n if (!isRecord(value) || typeof value.catalog_id !== 'string') return undefined;\n const conversationId = value.conversation_id;\n const threadTs = value.thread_ts;\n const teamUrl = value.team_url;\n const people = value.people === undefined ? [] : value.people;\n if (\n !isNullableString(conversationId) ||\n !isNullableString(threadTs) ||\n !isNullableString(teamUrl) ||\n !isStringArray(people)\n )\n return undefined;\n return {\n catalog_id: value.catalog_id,\n conversation_id: conversationId,\n thread_ts: threadTs,\n team_url: teamUrl,\n people,\n };\n}\n\n/** A call's `approval_context`, or `undefined` when absent or empty. */\nexport function parsePendingApprovalContext(value: unknown): PendingApprovalContext | undefined {\n if (!isRecord(value)) return undefined;\n const facts: PendingApprovalFact[] = Array.isArray(value.facts)\n ? value.facts.flatMap((fact) =>\n isRecord(fact) && typeof fact.label === 'string' && typeof fact.value === 'string'\n ? [{ label: fact.label, value: fact.value }]\n : [],\n )\n : [];\n const warnings: PendingApprovalWarning[] = Array.isArray(value.warnings)\n ? value.warnings.flatMap((warning) => {\n if (!isRecord(warning) || typeof warning.message !== 'string') return [];\n const severity =\n typeof warning.severity === 'string' && APPROVAL_WARNING_SEVERITIES.has(warning.severity)\n ? (warning.severity as PendingApprovalWarning['severity'])\n : 'info';\n return [{ severity, message: warning.message }];\n })\n : [];\n const slackTarget = parsePendingApprovalSlackTarget(value.slack_target);\n return facts.length > 0 || warnings.length > 0 || slackTarget\n ? { facts, warnings, ...(slackTarget ? { slack_target: slackTarget } : {}) }\n : undefined;\n}\n\nexport interface PendingActionRequest {\n name: string;\n args: Record<string, unknown>;\n /** The lane's `task` tool-call id (present on per-dispatch payloads). */\n toolCallId?: string;\n /** The lane's langgraph interrupt id — the `lane_decisions` resume key. */\n interruptId?: string;\n /** Present (true) when a session-wide approval would cover later calls of this tool. */\n sessionApprovalAllowed?: true;\n /** Present (true) when the gate accepts an `edit` decision for this call. */\n editAllowed?: true;\n /** Present when the backend resolved facts about this call before asking. */\n approvalContext?: PendingApprovalContext;\n}\n\n/**\n * Every gated call this approval covers, in decision order. One resume answers\n * ALL of them, so every entry must stay reviewable somewhere. Falls back to\n * the single first-call fields on older backends without `action_requests`.\n */\nexport function pendingActionRequests(hitl: HitlApprovalPayload | null): PendingActionRequest[] {\n const context = hitl?.context;\n if (!context) return [];\n // The payload crosses the wire with only its top-level shape narrowed\n // (`asHitlApproval`), so the nested collection must be validated before any\n // array/property access: a malformed host value must degrade to \"no\n // reviewable entries\", never crash the approval surface.\n const requests: Record<string, unknown>[] = Array.isArray(context.action_requests)\n ? context.action_requests.filter(isRecord)\n : context.tool_name && context.tool_args\n ? [{ name: context.tool_name, args: context.tool_args, tool_call_id: context.tool_call_id }]\n : [];\n return requests.map((request) => {\n const approvalContext = parsePendingApprovalContext(request.approval_context);\n return {\n name: typeof request.name === 'string' ? request.name : 'tool',\n args: isRecord(request.args) ? request.args : {},\n ...(typeof request.tool_call_id === 'string' && { toolCallId: request.tool_call_id }),\n ...(typeof request.interrupt_id === 'string' && { interruptId: request.interrupt_id }),\n ...(request.session_approval_allowed === true && { sessionApprovalAllowed: true }),\n ...(Array.isArray(request.allowed_decisions) &&\n request.allowed_decisions.includes('edit') && { editAllowed: true }),\n ...(approvalContext && { approvalContext }),\n };\n });\n}\n\n/**\n * Whether the card may offer \"approve all for this session\": every pending\n * call must be one the backend stamped as session-approvable, so a batch that\n * mixes in a tool the workspace pinned as always-prompt only offers the\n * one-time answer.\n */\nexport function canApproveForSession(actionRequests: readonly PendingActionRequest[]): boolean {\n return (\n actionRequests.length > 0 &&\n actionRequests.every((request) => request.sessionApprovalAllowed === true)\n );\n}\n\n/** An interrupt a non-resume dispatch dropped, published by the host. */\nexport interface AbandonedInputRequest {\n id: string;\n type: string;\n}\n\n/**\n * `useStatewireState` selector body for the host-published abandoned input\n * requests. Reads through {@link readDeepAgentStreamValues} so the selector is\n * safe on the pre-attach (`undefined`) wire state, and returns the raw array\n * reference so the subscription stays shallow-stable — derive (`.find`) on the\n * result, never inside the selector.\n */\nexport function readAbandonedInputRequests(\n state: unknown,\n): readonly AbandonedInputRequest[] | undefined {\n const abandoned = readDeepAgentStreamValues(state).abandonedInputRequests;\n // Wire value: anything non-array (including a malformed host publication)\n // reads as \"none\" rather than crashing the consuming surface. Identity-\n // preserving for the valid case, so it stays selector-safe.\n return Array.isArray(abandoned)\n ? (abandoned as readonly AbandonedInputRequest[])\n : undefined;\n}\n\n/**\n * `useStatewireState` selector body for the host's mirrored interrupt\n * (`__interrupt__`, the LangGraph `{value, resumable}` wrapper). The mirror\n * is published the moment a lane parks on its gate — while sibling lanes are\n * still streaming and the run manager has NOT yet published an answerable\n * input request. Raw reference, selector-safe; unwrap with\n * {@link interruptMirrorPayload}.\n */\nexport function readInterruptMirror(state: unknown): unknown {\n return readDeepAgentStreamValues(state).__interrupt__;\n}\n\n/** The payload of a mirrored interrupt wrapper, or `undefined` for anything else. */\nexport function interruptMirrorPayload(mirror: unknown): unknown {\n return isRecord(mirror) ? mirror.value : undefined;\n}\n\n/**\n * `useStatewireState` selector body for the per-dispatch lane decisions the\n * host accepted through `run/lane-input` while the run was still streaming\n * (`queuedLaneDecisions`, keyed by langgraph interrupt id). Held until the\n * run parks, then answered as a native `lane_decisions` resume; every attached\n * client reads a queued lane as decided. Raw reference, selector-safe.\n */\nexport function readQueuedLaneDecisions(\n state: unknown,\n): Readonly<Record<string, unknown>> | undefined {\n const queued = readDeepAgentStreamValues(state).queuedLaneDecisions;\n return isRecord(queued) ? queued : undefined;\n}\n\n/**\n * The distinct langgraph interrupt ids a `lane_decisions` resume answers for\n * these gated calls, in first-seen order — or `null` when any call lacks its\n * stamp (a legacy batch payload only a positional resume can answer). A\n * nested HITL request gating several calls contributes one id: the lane is\n * the interrupt, and one decision fans across its calls server-side.\n */\nexport function laneInterruptIds(actionRequests: readonly PendingActionRequest[]): string[] | null {\n if (actionRequests.length === 0) return null;\n const ids: string[] = [];\n for (const request of actionRequests) {\n if (request.interruptId === undefined) return null;\n if (!ids.includes(request.interruptId)) ids.push(request.interruptId);\n }\n return ids;\n}\n\n/** One decision for every lane — the `lane_decisions` map a run-wide approve or reject sends. */\nexport function fanLaneDecision<T>({\n interruptIds,\n decision,\n}: {\n interruptIds: readonly string[];\n decision: T;\n}): Record<string, T> {\n return Object.fromEntries(interruptIds.map((id) => [id, decision]));\n}\n\n/** The abandoned `interrupt` entry, if any — the \"approval was cancelled\" notice. */\nexport function findAbandonedInterrupt(\n abandoned: readonly AbandonedInputRequest[] | undefined,\n): AbandonedInputRequest | undefined {\n return abandoned?.find(\n (request) => isRecord(request) && request.type === 'interrupt' && typeof request.id === 'string',\n );\n}\n\n/** Canonical reason string carried by a user rejection. */\nexport const HITL_REJECT_REASON = 'User rejected the action.';\n\n/**\n * Default {@link UseApprovalResumeLockOptions.pendingResumeGraceMs} for every\n * approval surface: how long a clicked decision waits for its resume run to\n * start before the actions unlock again. Covers a `run/input` the host\n * rejected or a disconnected transport swallowed before any run began — the\n * one failure neither identity-change nor observed-run recovery can detect.\n */\nexport const HITL_PENDING_RESUME_GRACE_MS = 15_000;\n\n/**\n * Default {@link UseApprovalResumeLockOptions.maxTransportRetries}: how many\n * times a decision the transport lost (the websocket dropped or the statewire\n * session reset while the `run/input` was in flight) is re-sent on its own\n * before the user is asked to click again.\n */\nexport const HITL_RESUME_TRANSPORT_RETRIES = 3;\n\n/**\n * The dispatch died client-side without the host ever seeing it — a proven\n * session loss or a gone stream. Safe to re-send the same decision for the\n * same still-parked request. The complement (a server verdict, or the surface\n * unmounting) is not.\n */\nexport function isResumeTransportLoss(error: unknown): boolean {\n const outcome = statewireTransportOutcome(error);\n return outcome === 'session-lost' || outcome === 'stream-gone';\n}\n\n/** `run/input` resume value approving the gated call(s). */\nexport function hitlResumeApprove(): Record<string, string> {\n return { action: 'approve' };\n}\n\n/**\n * `run/input` resume value approving the gated call(s) AND every later call of\n * the same tool(s) on this thread. The backend records the tools from its own\n * parked interrupt (never from this payload), so the value carries no names.\n */\nexport function hitlResumeApproveForSession(): Record<string, string> {\n return { action: 'approve', scope: 'session' };\n}\n\n/** `run/input` resume value rejecting the gated call(s). */\nexport function hitlResumeReject(reason: string = HITL_REJECT_REASON): Record<string, string> {\n return { action: 'reject', reason };\n}\n\n/** One gated call's own answer inside a per-action resume ({@link hitlResumeActionDecisions}). */\nexport type HitlActionDecision =\n | { action: 'approve' }\n | { action: 'reject'; reason: string }\n | { action: 'edit'; edited_args: Record<string, unknown> };\n\n/**\n * The `tool_call_id` of every gated call, in decision order — or `null` when\n * any call lacks one or two calls share one, in which case no per-action\n * resume can be bound to the batch and only the batch answers above apply.\n */\nexport function actionRequestToolCallIds(\n actionRequests: readonly PendingActionRequest[],\n): string[] | null {\n if (actionRequests.length === 0) return null;\n const ids: string[] = [];\n for (const request of actionRequests) {\n if (request.toolCallId === undefined || ids.includes(request.toolCallId)) return null;\n ids.push(request.toolCallId);\n }\n return ids;\n}\n\n/**\n * `run/input` resume value deciding each gated call by its `tool_call_id` —\n * the only channel that carries an edited call. The backend binds every entry\n * to the parked request with that id, takes the tool NAME from its own\n * request (an edit can change a call's arguments, never which tool runs), and\n * refuses the whole answer — nothing runs — unless the map names exactly the\n * parked calls. `edited_args` is the complete argument set the call runs\n * with, not a patch. The envelope `action` mirrors the first entry for hosts\n * that only read the envelope; `action_decisions` is authoritative.\n */\nexport function hitlResumeActionDecisions(\n decisions: Readonly<Record<string, HitlActionDecision>>,\n): Record<string, unknown> {\n const [anchorId, anchor] = Object.entries(decisions)[0] ?? [];\n return {\n action: anchor?.action === 'reject' ? 'reject' : 'approve',\n ...(anchorId !== undefined && { tool_call_id: anchorId }),\n action_decisions: decisions,\n };\n}\n\n/** Canonical reason string carried by a user declining a non-HITL park. */\nexport const INTERRUPT_DECLINE_REASON = 'User declined the request.';\n\n/**\n * `run/input` resume value declining a non-HITL park. `{ action: 'reject' }`\n * is the one value every typed raiser treats as a clean user decline\n * (`FormCancelledError` / `ToolRejectedError`); a generic `continue` would be\n * rejected by their resume schemas and surface as a tool error the agent then\n * improvises around.\n */\nexport function interruptResumeDecline(\n reason: string = INTERRUPT_DECLINE_REASON,\n): Record<string, string> {\n return { action: 'reject', reason };\n}\n\nexport interface UseApprovalResumeLockOptions<TValue> {\n /** The pending interrupt's request id (`undefined` when nothing is parked). */\n requestId: string | undefined;\n /** The surface's thread `isRunning` read (mockable per surface). */\n isRunning: boolean;\n /**\n * Dispatch the `run/input` resume for `requestId` on the surface's transport.\n * Return the dispatch promise so a refused or lost command releases the lock\n * at once and reaches `onResumeRejected`; a `void` return leaves the\n * recovery paths below as the only release.\n */\n sendResume: (requestId: string, value: TValue) => void | Promise<unknown>;\n /**\n * The dispatch `sendResume` returned rejected — the host refused the\n * `run/input` or the transport lost it. The lock is already released when\n * this fires; the surface tells the user, since the request is back on\n * screen with nothing else saying why.\n */\n onResumeRejected?: (error: unknown, requestId: string) => void;\n /**\n * A dispatch the transport lost is being re-sent for the still-parked\n * request; `attempt` counts the retries so far (1-based). Diagnostics only —\n * the lock stays held across the retry.\n */\n onResumeRetry?: (error: unknown, requestId: string, attempt: number) => void;\n /**\n * Automatic re-sends of a decision the transport lost\n * ({@link isResumeTransportLoss}) while the request is still parked. `0`\n * disables retries. Defaults to {@link HITL_RESUME_TRANSPORT_RETRIES}.\n */\n maxTransportRetries?: number;\n /**\n * Re-enable the actions when no resume run started within this window —\n * covers a `run/input` that was rejected or lost before any run began, so\n * neither reset path below can fire. Omit to keep the pre-existing surface\n * behavior of staying locked until a resume run is observed.\n */\n pendingResumeGraceMs?: number;\n}\n\nexport interface ApprovalResumeLock<TValue> {\n /** True after a resume until the request identity changes (or recovery fires). */\n pending: boolean;\n /**\n * Send the resume value, locking the actions. No-op (returns `undefined`)\n * while pending or unparked. Returns the dispatch promise when `sendResume`\n * produced one, so a surface can hold its own state until the host settles.\n */\n resume: (value: TValue) => Promise<unknown> | undefined;\n}\n\n/**\n * Optimistic action lock shared by every approval surface: disable the\n * decision buttons the moment one is clicked, until the request identity\n * changes (it clears after the resume, or a fresh interrupt arrives). This\n * closes the double-click → duplicate-resume window.\n *\n * Recovery paths, in order of specificity:\n * 0. The dispatch itself rejected (a `sendResume` that returned a promise) —\n * released at once, and reported through `onResumeRejected`. A rejection\n * that is a transport loss (the socket dropped mid-flight) is re-sent up to\n * `maxTransportRetries` times first, the lock held throughout, so a flaky\n * connection does not hand the card back to the user for another click.\n * The returned promise settles with the final attempt.\n * 1. Identity change — the resume landed (or a new interrupt replaced the\n * request). Reset during render via React's \"previous value\" pattern.\n * 2. A resume run was observed starting and then settling with the request\n * still pending (failed/cancelled resume) — clear the lock so the user can\n * answer again.\n * 3. Optional grace window ({@link UseApprovalResumeLockOptions.pendingResumeGraceMs})\n * for a `run/input` that never started a run at all.\n */\nexport function useApprovalResumeLock<TValue = Record<string, string>>(\n options: UseApprovalResumeLockOptions<TValue>,\n): ApprovalResumeLock<TValue> {\n const {\n requestId,\n isRunning,\n sendResume,\n pendingResumeGraceMs,\n onResumeRejected,\n onResumeRetry,\n maxTransportRetries = HITL_RESUME_TRANSPORT_RETRIES,\n } = options;\n\n const [pending, setPending] = useState(false);\n // Bumped per re-send so the grace window restarts with each attempt.\n const [attempt, setAttempt] = useState(0);\n const prevRequestIdRef = useRef(requestId);\n if (prevRequestIdRef.current !== requestId) {\n prevRequestIdRef.current = requestId;\n if (pending) setPending(false);\n }\n\n // Track the resume run we kicked off (isRunning observed true→false while\n // pending) and clear `pending` when it ends with the request unresolved.\n const sawResumeRunRef = useRef(false);\n useEffect(() => {\n if (!pending) {\n sawResumeRunRef.current = false;\n return;\n }\n if (isRunning) {\n sawResumeRunRef.current = true;\n return;\n }\n if (sawResumeRunRef.current) {\n sawResumeRunRef.current = false;\n setPending(false);\n }\n }, [pending, isRunning]);\n\n // Pre-start failure recovery: re-enable after the grace window when no\n // resume run began; answering the still-parked request again is exactly\n // what the user needs to be able to do.\n useEffect(() => {\n if (!pending || pendingResumeGraceMs === undefined) return;\n const timer = setTimeout(() => {\n if (!sawResumeRunRef.current) setPending(false);\n }, pendingResumeGraceMs);\n return () => clearTimeout(timer);\n }, [pending, requestId, pendingResumeGraceMs, attempt]);\n\n const sendResumeRef = useRef(sendResume);\n sendResumeRef.current = sendResume;\n const onResumeRejectedRef = useRef(onResumeRejected);\n onResumeRejectedRef.current = onResumeRejected;\n const onResumeRetryRef = useRef(onResumeRetry);\n onResumeRetryRef.current = onResumeRetry;\n const maxTransportRetriesRef = useRef(maxTransportRetries);\n maxTransportRetriesRef.current = maxTransportRetries;\n const currentRequestIdRef = useRef(requestId);\n currentRequestIdRef.current = requestId;\n const pendingRef = useRef(pending);\n pendingRef.current = pending;\n // One token per `resume` call: a settle from an earlier submission must not\n // retry over, or release, a newer one for the same request.\n const submissionRef = useRef(0);\n\n const resume = useCallback(\n (value: TValue): Promise<unknown> | undefined => {\n if (requestId === undefined || pendingRef.current) return undefined;\n const submission = ++submissionRef.current;\n setPending(true);\n pendingRef.current = true;\n setAttempt(0);\n const first: unknown = sendResumeRef.current(requestId, value);\n if (!(first instanceof Promise)) return undefined;\n // The final failure is already reported through `onResumeRejected`;\n // callers that drop the promise must not get an unhandled rejection.\n const outcome = new Promise<unknown>((resolve, reject) => {\n const settle = (dispatched: Promise<unknown>, retries: number) => {\n dispatched.then(resolve, (error: unknown) => {\n // A late refusal for a request the lock has since moved past (the\n // park was re-keyed, or a newer answer is in flight) must neither\n // release that answer's lock nor be reported as a failure of it.\n // The optimistic fold hides the answered request until the fold\n // rolls back, so `undefined` here is not a departure.\n const current = currentRequestIdRef.current;\n if (\n submission !== submissionRef.current ||\n (current !== undefined && current !== requestId)\n ) {\n reject(error);\n return;\n }\n if (retries < maxTransportRetriesRef.current && isResumeTransportLoss(error)) {\n const next = retries + 1;\n onResumeRetryRef.current?.(error, requestId, next);\n setPending(true);\n pendingRef.current = true;\n setAttempt(next);\n const resent: unknown = sendResumeRef.current(requestId, value);\n if (resent instanceof Promise) {\n settle(resent, next);\n return;\n }\n resolve(undefined);\n return;\n }\n setPending(false);\n pendingRef.current = false;\n onResumeRejectedRef.current?.(error, requestId);\n reject(error);\n });\n };\n settle(first, 0);\n });\n outcome.catch(() => {});\n return outcome;\n },\n [requestId],\n );\n\n return { pending, resume };\n}\n"],"names":["hasClientToolInterruptSource","readDeepAgentStreamValues","statewireTransportOutcome","useState","useRef","useEffect","useCallback"],"mappings":";;;;;;AA2EA,SAAS,SAAS,OAAkD;AAClE,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAGO,SAAS,mBACd,SAC+C;AAC/C,SAAO,QAAQ,SAAS,eAAe,EAAE,cAAc;AACzD;AAQA,MAAM,wCAA6D,oBAAI,IAAI,CAAC,uBAAuB,CAAC;AAO7F,SAAS,uBAAuB,SAA2B;AAChE,MAAI,CAAC,SAAS,OAAO,EAAG,QAAO;AAC/B,MAAI,QAAQ,yBAAyB,MAAO,QAAO;AACnD,SACE,OAAO,QAAQ,WAAW,YAAY,sCAAsC,IAAI,QAAQ,MAAM;AAElG;AASO,SAAS,wBACd,SAC+C;AAC/C,MAAI,CAAC,mBAAmB,OAAO,EAAG,QAAO;AACzC,QAAM,UAAW,QAAkC;AACnD,SAAO,CAACA,YAAAA,6BAA6B,OAAO,KAAK,CAAC,uBAAuB,OAAO;AAClF;AAGO,SAAS,eAAe,OAA4C;AACzE,MAAI,CAAC,SAAS,KAAK,EAAG,QAAO;AAC7B,SAAO,MAAM,SAAS,UACpB,MAAM,WAAW,mBACjB,OAAO,MAAM,YAAY,WACtB,QACD;AACN;AAGO,MAAM,mCACX;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AAc,QAAQ,WAAW,KAAK;AAC7D,UAAI,EAAE,iBAAiB,SAAU,QAAO;AAGxC,YAAM,UAAU,IAAI,QAAiB,CAAC,SAAS,WAAW;AACxD,cAAM,SAAS,CAAC,YAA8B,YAAoB;AAChE,qBAAW,KAAK,SAAS,CAAC,UAAmB;;AAM3C,kBAAM,UAAU,oBAAoB;AACpC,gBACE,eAAe,cAAc,WAC5B,YAAY,UAAa,YAAY,WACtC;AACA,qBAAO,KAAK;AACZ;AAAA,YACF;AACA,gBAAI,UAAU,uBAAuB,WAAW,sBAAsB,KAAK,GAAG;AAC5E,oBAAM,OAAO,UAAU;AACvB,qCAAiB,YAAjB,0CAA2B,OAAO,WAAW;AAC7C,yBAAW,IAAI;AACf,yBAAW,UAAU;AACrB,yBAAW,IAAI;AACf,oBAAM,SAAkB,cAAc,QAAQ,WAAW,KAAK;AAC9D,kBAAI,kBAAkB,SAAS;AAC7B,uBAAO,QAAQ,IAAI;AACnB;AAAA,cACF;AACA,sBAAQ,MAAS;AACjB;AAAA,YACF;AACA,uBAAW,KAAK;AAChB,uBAAW,UAAU;AACrB,sCAAoB,YAApB,6CAA8B,OAAO;AACrC,mBAAO,KAAK;AAAA,UACd,CAAC;AAAA,QACH;AACA,eAAO,OAAO,CAAC;AAAA,MACjB,CAAC;AACD,cAAQ,MAAM,MAAM;AAAA,MAAC,CAAC;AACtB,aAAO;AAAA,IACT;AAAA,IACA,CAAC,SAAS;AAAA,EAAA;AAGZ,SAAO,EAAE,SAAS,OAAA;AACpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"interrupts.cjs","sources":["../../../../agent-runtime/src/interrupts.ts"],"sourcesContent":["/**\n * Human-in-the-loop interrupt primitives shared by every statewire chat\n * surface (Olympus, the React SDK, the Office add-in, the Chrome extension,\n * mobile).\n *\n * The agora deep-agent runtime parks a gated run on an `interrupt` input\n * request whose payload carries the Athena `hitl_approval` shape\n * (`athena_deep_agent/hitl_bridge.py`). A surface answers it with\n * `{ type: 'run/input', requestId, response: { type: 'resume', value } }` —\n * the exact command the backend's resume path consumes. This module holds the\n * payload contract (narrowing, resume values) and the shared resume-lock state\n * machine; rendering stays with each surface.\n *\n * Deliberately parameterized rather than self-wiring: these helpers never call\n * `useStatewireRuns`/`useAuiState` themselves. Each surface reads its own\n * statewire hooks (which its tests already mock) and passes the values in, so\n * the shared semantics cannot drift while per-surface wiring stays testable.\n */\n\nimport type { StatewireThread } from '@assistant-ui/react-statewire';\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { hasClientToolInterruptSource } from './client-tools';\nimport { statewireTransportOutcome } from './errors';\nimport { readDeepAgentStreamValues } from './statewire-state';\n\n/** Human-in-the-loop approval payload the agora deep-agent runtime parks a run\n * on (shaped by `athena_deep_agent/hitl_bridge.py`). */\nexport interface HitlApprovalPayload {\n source: string;\n type: string;\n message: string;\n /** Risk headline/facts/warnings, when the host includes them. */\n approval_context?: unknown;\n context?: {\n tool_name?: string;\n tool_id?: string;\n tool_call_id?: string;\n tool_args?: Record<string, unknown>;\n pending_action_count?: number;\n approval_context?: unknown;\n /**\n * Every pending gated call (name + args), in decision order. Absent on\n * older backends — fall back to the single `tool_name`/`tool_args` pair.\n * Per-dispatch payloads also carry each lane's `tool_call_id` (the lane\n * card key) and `interrupt_id` (the lane resume key).\n */\n action_requests?: {\n name?: string;\n args?: Record<string, unknown>;\n tool_call_id?: string;\n interrupt_id?: string;\n /**\n * True when \"approve all for this session\" would take effect for this\n * tool (the workspace allows overriding its approval). Absent on older\n * backends and on non-overridable tools: the option is not offered.\n */\n session_approval_allowed?: boolean;\n /**\n * The decision types the parked gate accepts for this call (`approve`,\n * `reject`, `edit`). Absent on older backends: only approve / reject\n * are known to be accepted.\n */\n allowed_decisions?: string[];\n /** What the backend resolved about this call before asking (display-only). */\n approval_context?: unknown;\n }[];\n /**\n * True when each dispatch parked on its own interrupt: decisions submit\n * per lane via `lane_decisions` and each approved lane starts immediately,\n * instead of the legacy batch where one resume must answer every lane.\n */\n per_dispatch?: boolean;\n };\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/** A pending `interrupt` input request; a present `response` key marks it answered. */\nexport function isPendingInterrupt(\n request: StatewireThread.InputRequestState,\n): request is StatewireThread.CustomInputRequest {\n return request.type === 'interrupt' && !('response' in request);\n}\n\n/**\n * Interrupt sources that were system pauses before the host stamped\n * `requires_user_action: false` on them (a background deep-research wait). Kept\n * only for the deploy skew between an older agora and a newer client; delete\n * once every deployment's raiser stamps the flag.\n */\nconst LEGACY_SYSTEM_PAUSE_INTERRUPT_SOURCES: ReadonlySet<string> = new Set(['deep_research_pending']);\n\n/**\n * A park nobody answers: the agent is still working (a background research\n * wait) and the backend resumes it itself. The raiser stamps\n * `requires_user_action: false`; older raisers are recognised by source.\n */\nexport function isSystemPauseInterrupt(payload: unknown): boolean {\n if (!isRecord(payload)) return false;\n if (payload.requires_user_action === false) return true;\n return (\n typeof payload.source === 'string' && LEGACY_SYSTEM_PAUSE_INTERRUPT_SOURCES.has(payload.source)\n );\n}\n\n/**\n * A pending interrupt an approval card may answer. Two kinds are excluded —\n * client-tool parks (the client-tool bridge owns those, and a generic resume\n * would corrupt the parked tool call) and system pauses (nothing to answer; the\n * backend resumes them). The source checks are deliberately loose so a skewed\n * deploy can never route one here.\n */\nexport function isApprovalCardInterrupt(\n request: StatewireThread.InputRequestState,\n): request is StatewireThread.CustomInputRequest {\n if (!isPendingInterrupt(request)) return false;\n const payload = (request as { payload?: unknown }).payload;\n return !hasClientToolInterruptSource(payload) && !isSystemPauseInterrupt(payload);\n}\n\n/** Narrow an interrupt payload to the Athena HITL approval shape. */\nexport function asHitlApproval(value: unknown): HitlApprovalPayload | null {\n if (!isRecord(value)) return null;\n return value.type === 'hitl' &&\n value.source === 'hitl_approval' &&\n typeof value.message === 'string'\n ? (value as unknown as HitlApprovalPayload)\n : null;\n}\n\n/** Default paused-run copy when an interrupt payload carries no message. */\nexport const DEFAULT_INTERRUPT_PAUSED_MESSAGE =\n 'The agent is paused and waiting for input.';\n\n/** Best-effort human-readable message from any interrupt payload. */\nexport function readInterruptMessage(\n value: unknown,\n fallback: string = DEFAULT_INTERRUPT_PAUSED_MESSAGE,\n): string {\n if (isRecord(value) && typeof value.message === 'string' && value.message.length > 0) {\n return value.message;\n }\n return fallback;\n}\n\n/** One label/value row of a call's resolved approval facts. */\nexport interface PendingApprovalFact {\n label: string;\n value: string;\n}\n\n/** One caution of a call's resolved approval facts. */\nexport interface PendingApprovalWarning {\n severity: 'info' | 'warning' | 'critical';\n message: string;\n}\n\nexport interface PendingApprovalSlackTarget {\n catalog_id: string;\n conversation_id: string | null;\n thread_ts: string | null;\n team_url: string | null;\n people: string[];\n}\n\n/**\n * What the backend resolved about a gated call before asking — e.g. where a\n * Slack write goes and as whom (agora `services/interrupts/approval_context.py`).\n * Display-only; the decision still answers the parked call.\n */\nexport interface PendingApprovalContext {\n facts: PendingApprovalFact[];\n warnings: PendingApprovalWarning[];\n slack_target?: PendingApprovalSlackTarget;\n}\n\nconst APPROVAL_WARNING_SEVERITIES = new Set(['info', 'warning', 'critical']);\n\nfunction isNullableString(value: unknown): value is string | null {\n return value === null || typeof value === 'string';\n}\n\nfunction isStringArray(value: unknown): value is string[] {\n return Array.isArray(value) && value.every((entry) => typeof entry === 'string');\n}\n\nfunction parsePendingApprovalSlackTarget(value: unknown): PendingApprovalSlackTarget | undefined {\n if (!isRecord(value) || typeof value.catalog_id !== 'string') return undefined;\n const conversationId = value.conversation_id;\n const threadTs = value.thread_ts;\n const teamUrl = value.team_url;\n const people = value.people === undefined ? [] : value.people;\n if (\n !isNullableString(conversationId) ||\n !isNullableString(threadTs) ||\n !isNullableString(teamUrl) ||\n !isStringArray(people)\n )\n return undefined;\n return {\n catalog_id: value.catalog_id,\n conversation_id: conversationId,\n thread_ts: threadTs,\n team_url: teamUrl,\n people,\n };\n}\n\n/** A call's `approval_context`, or `undefined` when absent or empty. */\nexport function parsePendingApprovalContext(value: unknown): PendingApprovalContext | undefined {\n if (!isRecord(value)) return undefined;\n const facts: PendingApprovalFact[] = Array.isArray(value.facts)\n ? value.facts.flatMap((fact) =>\n isRecord(fact) && typeof fact.label === 'string' && typeof fact.value === 'string'\n ? [{ label: fact.label, value: fact.value }]\n : [],\n )\n : [];\n const warnings: PendingApprovalWarning[] = Array.isArray(value.warnings)\n ? value.warnings.flatMap((warning) => {\n if (!isRecord(warning) || typeof warning.message !== 'string') return [];\n const severity =\n typeof warning.severity === 'string' && APPROVAL_WARNING_SEVERITIES.has(warning.severity)\n ? (warning.severity as PendingApprovalWarning['severity'])\n : 'info';\n return [{ severity, message: warning.message }];\n })\n : [];\n const slackTarget = parsePendingApprovalSlackTarget(value.slack_target);\n return facts.length > 0 || warnings.length > 0 || slackTarget\n ? { facts, warnings, ...(slackTarget ? { slack_target: slackTarget } : {}) }\n : undefined;\n}\n\nexport interface PendingActionRequest {\n name: string;\n args: Record<string, unknown>;\n /** The lane's `task` tool-call id (present on per-dispatch payloads). */\n toolCallId?: string;\n /** The lane's langgraph interrupt id — the `lane_decisions` resume key. */\n interruptId?: string;\n /** Present (true) when a session-wide approval would cover later calls of this tool. */\n sessionApprovalAllowed?: true;\n /** Present (true) when the gate accepts an `edit` decision for this call. */\n editAllowed?: true;\n /** Present when the backend resolved facts about this call before asking. */\n approvalContext?: PendingApprovalContext;\n}\n\n/**\n * Every gated call this approval covers, in decision order. One resume answers\n * ALL of them, so every entry must stay reviewable somewhere. Falls back to\n * the single first-call fields on older backends without `action_requests`.\n */\nexport function pendingActionRequests(hitl: HitlApprovalPayload | null): PendingActionRequest[] {\n const context = hitl?.context;\n if (!context) return [];\n // The payload crosses the wire with only its top-level shape narrowed\n // (`asHitlApproval`), so the nested collection must be validated before any\n // array/property access: a malformed host value must degrade to \"no\n // reviewable entries\", never crash the approval surface.\n const requests: Record<string, unknown>[] = Array.isArray(context.action_requests)\n ? context.action_requests.filter(isRecord)\n : context.tool_name && context.tool_args\n ? [{ name: context.tool_name, args: context.tool_args, tool_call_id: context.tool_call_id }]\n : [];\n return requests.map((request) => {\n const approvalContext = parsePendingApprovalContext(request.approval_context);\n return {\n name: typeof request.name === 'string' ? request.name : 'tool',\n args: isRecord(request.args) ? request.args : {},\n ...(typeof request.tool_call_id === 'string' && { toolCallId: request.tool_call_id }),\n ...(typeof request.interrupt_id === 'string' && { interruptId: request.interrupt_id }),\n ...(request.session_approval_allowed === true && { sessionApprovalAllowed: true }),\n ...(Array.isArray(request.allowed_decisions) &&\n request.allowed_decisions.includes('edit') && { editAllowed: true }),\n ...(approvalContext && { approvalContext }),\n };\n });\n}\n\n/**\n * Whether the card may offer \"approve all for this session\": every pending\n * call must be one the backend stamped as session-approvable, so a batch that\n * mixes in a tool the workspace pinned as always-prompt only offers the\n * one-time answer.\n */\nexport function canApproveForSession(actionRequests: readonly PendingActionRequest[]): boolean {\n return (\n actionRequests.length > 0 &&\n actionRequests.every((request) => request.sessionApprovalAllowed === true)\n );\n}\n\n/** An interrupt a non-resume dispatch dropped, published by the host. */\nexport interface AbandonedInputRequest {\n id: string;\n type: string;\n}\n\n/**\n * `useStatewireState` selector body for the host-published abandoned input\n * requests. Reads through {@link readDeepAgentStreamValues} so the selector is\n * safe on the pre-attach (`undefined`) wire state, and returns the raw array\n * reference so the subscription stays shallow-stable — derive (`.find`) on the\n * result, never inside the selector.\n */\nexport function readAbandonedInputRequests(\n state: unknown,\n): readonly AbandonedInputRequest[] | undefined {\n const abandoned = readDeepAgentStreamValues(state).abandonedInputRequests;\n // Wire value: anything non-array (including a malformed host publication)\n // reads as \"none\" rather than crashing the consuming surface. Identity-\n // preserving for the valid case, so it stays selector-safe.\n return Array.isArray(abandoned)\n ? (abandoned as readonly AbandonedInputRequest[])\n : undefined;\n}\n\n/**\n * `useStatewireState` selector body for the host's mirrored interrupt\n * (`__interrupt__`, the LangGraph `{value, resumable}` wrapper). The mirror\n * is published the moment a lane parks on its gate — while sibling lanes are\n * still streaming and the run manager has NOT yet published an answerable\n * input request. Raw reference, selector-safe; unwrap with\n * {@link interruptMirrorPayload}.\n */\nexport function readInterruptMirror(state: unknown): unknown {\n return readDeepAgentStreamValues(state).__interrupt__;\n}\n\n/** The payload of a mirrored interrupt wrapper, or `undefined` for anything else. */\nexport function interruptMirrorPayload(mirror: unknown): unknown {\n return isRecord(mirror) ? mirror.value : undefined;\n}\n\n/**\n * `useStatewireState` selector body for the per-dispatch lane decisions the\n * host accepted through `run/lane-input` while the run was still streaming\n * (`queuedLaneDecisions`, keyed by langgraph interrupt id). Held until the\n * run parks, then answered as a native `lane_decisions` resume; every attached\n * client reads a queued lane as decided. Raw reference, selector-safe.\n */\nexport function readQueuedLaneDecisions(\n state: unknown,\n): Readonly<Record<string, unknown>> | undefined {\n const queued = readDeepAgentStreamValues(state).queuedLaneDecisions;\n return isRecord(queued) ? queued : undefined;\n}\n\n/**\n * The distinct langgraph interrupt ids a `lane_decisions` resume answers for\n * these gated calls, in first-seen order — or `null` when any call lacks its\n * stamp (a legacy batch payload only a positional resume can answer). A\n * nested HITL request gating several calls contributes one id: the lane is\n * the interrupt, and one decision fans across its calls server-side.\n */\nexport function laneInterruptIds(actionRequests: readonly PendingActionRequest[]): string[] | null {\n if (actionRequests.length === 0) return null;\n const ids: string[] = [];\n for (const request of actionRequests) {\n if (request.interruptId === undefined) return null;\n if (!ids.includes(request.interruptId)) ids.push(request.interruptId);\n }\n return ids;\n}\n\nconst NO_TOOL_CALL_IDS: ReadonlySet<string> = new Set();\n\n/**\n * The gated calls still waiting on a person, by `tool_call_id`: every call of\n * the approval on screen (the parked request's, or the host's mirror while\n * sibling lanes still stream), less the lanes whose decision the host already\n * holds (`queuedLaneDecisions`, keyed by interrupt id): a lane decided live\n * waits for the run to park, not for anyone. The id is the one join between an\n * approval and the call it gates (a payload names no lane), so a call without\n * one counts for nothing.\n */\nexport function toolCallIdsAwaitingApproval({\n actionRequests,\n queuedLaneDecisions,\n}: {\n actionRequests: readonly PendingActionRequest[];\n queuedLaneDecisions?: Readonly<Record<string, unknown>>;\n}): ReadonlySet<string> {\n let ids: Set<string> | undefined;\n for (const request of actionRequests) {\n if (request.toolCallId === undefined) continue;\n if (\n request.interruptId !== undefined &&\n queuedLaneDecisions !== undefined &&\n request.interruptId in queuedLaneDecisions\n ) {\n continue;\n }\n ids ??= new Set();\n ids.add(request.toolCallId);\n }\n return ids ?? NO_TOOL_CALL_IDS;\n}\n\n/** One decision for every lane — the `lane_decisions` map a run-wide approve or reject sends. */\nexport function fanLaneDecision<T>({\n interruptIds,\n decision,\n}: {\n interruptIds: readonly string[];\n decision: T;\n}): Record<string, T> {\n return Object.fromEntries(interruptIds.map((id) => [id, decision]));\n}\n\n/** The abandoned `interrupt` entry, if any — the \"approval was cancelled\" notice. */\nexport function findAbandonedInterrupt(\n abandoned: readonly AbandonedInputRequest[] | undefined,\n): AbandonedInputRequest | undefined {\n return abandoned?.find(\n (request) => isRecord(request) && request.type === 'interrupt' && typeof request.id === 'string',\n );\n}\n\n/** Canonical reason string carried by a user rejection. */\nexport const HITL_REJECT_REASON = 'User rejected the action.';\n\n/**\n * Default {@link UseApprovalResumeLockOptions.pendingResumeGraceMs} for every\n * approval surface: how long a clicked decision waits for its resume run to\n * start before the actions unlock again. Covers a `run/input` the host\n * rejected or a disconnected transport swallowed before any run began — the\n * one failure neither identity-change nor observed-run recovery can detect.\n */\nexport const HITL_PENDING_RESUME_GRACE_MS = 15_000;\n\n/**\n * Default {@link UseApprovalResumeLockOptions.maxTransportRetries}: how many\n * times a decision the transport lost (the websocket dropped or the statewire\n * session reset while the `run/input` was in flight) is re-sent on its own\n * before the user is asked to click again.\n */\nexport const HITL_RESUME_TRANSPORT_RETRIES = 3;\n\n/**\n * The dispatch died client-side without the host ever seeing it — a proven\n * session loss or a gone stream. Safe to re-send the same decision for the\n * same still-parked request. The complement (a server verdict, or the surface\n * unmounting) is not.\n */\nexport function isResumeTransportLoss(error: unknown): boolean {\n const outcome = statewireTransportOutcome(error);\n return outcome === 'session-lost' || outcome === 'stream-gone';\n}\n\n/** `run/input` resume value approving the gated call(s). */\nexport function hitlResumeApprove(): Record<string, string> {\n return { action: 'approve' };\n}\n\n/**\n * `run/input` resume value approving the gated call(s) AND every later call of\n * the same tool(s) on this thread. The backend records the tools from its own\n * parked interrupt (never from this payload), so the value carries no names.\n */\nexport function hitlResumeApproveForSession(): Record<string, string> {\n return { action: 'approve', scope: 'session' };\n}\n\n/** `run/input` resume value rejecting the gated call(s). */\nexport function hitlResumeReject(reason: string = HITL_REJECT_REASON): Record<string, string> {\n return { action: 'reject', reason };\n}\n\n/** One gated call's own answer inside a per-action resume ({@link hitlResumeActionDecisions}). */\nexport type HitlActionDecision =\n | { action: 'approve' }\n | { action: 'reject'; reason: string }\n | { action: 'edit'; edited_args: Record<string, unknown> };\n\n/**\n * The `tool_call_id` of every gated call, in decision order — or `null` when\n * any call lacks one or two calls share one, in which case no per-action\n * resume can be bound to the batch and only the batch answers above apply.\n */\nexport function actionRequestToolCallIds(\n actionRequests: readonly PendingActionRequest[],\n): string[] | null {\n if (actionRequests.length === 0) return null;\n const ids: string[] = [];\n for (const request of actionRequests) {\n if (request.toolCallId === undefined || ids.includes(request.toolCallId)) return null;\n ids.push(request.toolCallId);\n }\n return ids;\n}\n\n/**\n * `run/input` resume value deciding each gated call by its `tool_call_id` —\n * the only channel that carries an edited call. The backend binds every entry\n * to the parked request with that id, takes the tool NAME from its own\n * request (an edit can change a call's arguments, never which tool runs), and\n * refuses the whole answer — nothing runs — unless the map names exactly the\n * parked calls. `edited_args` is the complete argument set the call runs\n * with, not a patch. The envelope `action` mirrors the first entry for hosts\n * that only read the envelope; `action_decisions` is authoritative.\n */\nexport function hitlResumeActionDecisions(\n decisions: Readonly<Record<string, HitlActionDecision>>,\n): Record<string, unknown> {\n const [anchorId, anchor] = Object.entries(decisions)[0] ?? [];\n return {\n action: anchor?.action === 'reject' ? 'reject' : 'approve',\n ...(anchorId !== undefined && { tool_call_id: anchorId }),\n action_decisions: decisions,\n };\n}\n\n/** Canonical reason string carried by a user declining a non-HITL park. */\nexport const INTERRUPT_DECLINE_REASON = 'User declined the request.';\n\n/**\n * `run/input` resume value declining a non-HITL park. `{ action: 'reject' }`\n * is the one value every typed raiser treats as a clean user decline\n * (`FormCancelledError` / `ToolRejectedError`); a generic `continue` would be\n * rejected by their resume schemas and surface as a tool error the agent then\n * improvises around.\n */\nexport function interruptResumeDecline(\n reason: string = INTERRUPT_DECLINE_REASON,\n): Record<string, string> {\n return { action: 'reject', reason };\n}\n\nexport interface UseApprovalResumeLockOptions<TValue> {\n /** The pending interrupt's request id (`undefined` when nothing is parked). */\n requestId: string | undefined;\n /** The surface's thread `isRunning` read (mockable per surface). */\n isRunning: boolean;\n /**\n * Dispatch the `run/input` resume for `requestId` on the surface's transport.\n * Return the dispatch promise so a refused or lost command releases the lock\n * at once and reaches `onResumeRejected`; a `void` return leaves the\n * recovery paths below as the only release.\n */\n sendResume: (requestId: string, value: TValue) => void | Promise<unknown>;\n /**\n * The dispatch `sendResume` returned rejected — the host refused the\n * `run/input` or the transport lost it. The lock is already released when\n * this fires; the surface tells the user, since the request is back on\n * screen with nothing else saying why.\n */\n onResumeRejected?: (error: unknown, requestId: string) => void;\n /**\n * A dispatch the transport lost is being re-sent for the still-parked\n * request; `attempt` counts the retries so far (1-based). Diagnostics only —\n * the lock stays held across the retry.\n */\n onResumeRetry?: (error: unknown, requestId: string, attempt: number) => void;\n /**\n * Automatic re-sends of a decision the transport lost\n * ({@link isResumeTransportLoss}) while the request is still parked. `0`\n * disables retries. Defaults to {@link HITL_RESUME_TRANSPORT_RETRIES}.\n */\n maxTransportRetries?: number;\n /**\n * Re-enable the actions when no resume run started within this window —\n * covers a `run/input` that was rejected or lost before any run began, so\n * neither reset path below can fire. Omit to keep the pre-existing surface\n * behavior of staying locked until a resume run is observed.\n */\n pendingResumeGraceMs?: number;\n}\n\nexport interface ApprovalResumeLock<TValue> {\n /** True after a resume until the request identity changes (or recovery fires). */\n pending: boolean;\n /**\n * Send the resume value, locking the actions. No-op (returns `undefined`)\n * while pending or unparked. Returns the dispatch promise when `sendResume`\n * produced one, so a surface can hold its own state until the host settles.\n */\n resume: (value: TValue) => Promise<unknown> | undefined;\n}\n\n/**\n * Optimistic action lock shared by every approval surface: disable the\n * decision buttons the moment one is clicked, until the request identity\n * changes (it clears after the resume, or a fresh interrupt arrives). This\n * closes the double-click → duplicate-resume window.\n *\n * Recovery paths, in order of specificity:\n * 0. The dispatch itself rejected (a `sendResume` that returned a promise) —\n * released at once, and reported through `onResumeRejected`. A rejection\n * that is a transport loss (the socket dropped mid-flight) is re-sent up to\n * `maxTransportRetries` times first, the lock held throughout, so a flaky\n * connection does not hand the card back to the user for another click.\n * The returned promise settles with the final attempt.\n * 1. Identity change — the resume landed (or a new interrupt replaced the\n * request). Reset during render via React's \"previous value\" pattern.\n * 2. A resume run was observed starting and then settling with the request\n * still pending (failed/cancelled resume) — clear the lock so the user can\n * answer again.\n * 3. Optional grace window ({@link UseApprovalResumeLockOptions.pendingResumeGraceMs})\n * for a `run/input` that never started a run at all.\n */\nexport function useApprovalResumeLock<TValue = Record<string, string>>(\n options: UseApprovalResumeLockOptions<TValue>,\n): ApprovalResumeLock<TValue> {\n const {\n requestId,\n isRunning,\n sendResume,\n pendingResumeGraceMs,\n onResumeRejected,\n onResumeRetry,\n maxTransportRetries = HITL_RESUME_TRANSPORT_RETRIES,\n } = options;\n\n const [pending, setPending] = useState(false);\n // Bumped per re-send so the grace window restarts with each attempt.\n const [attempt, setAttempt] = useState(0);\n const prevRequestIdRef = useRef(requestId);\n if (prevRequestIdRef.current !== requestId) {\n prevRequestIdRef.current = requestId;\n if (pending) setPending(false);\n }\n\n // Track the resume run we kicked off (isRunning observed true→false while\n // pending) and clear `pending` when it ends with the request unresolved.\n const sawResumeRunRef = useRef(false);\n useEffect(() => {\n if (!pending) {\n sawResumeRunRef.current = false;\n return;\n }\n if (isRunning) {\n sawResumeRunRef.current = true;\n return;\n }\n if (sawResumeRunRef.current) {\n sawResumeRunRef.current = false;\n setPending(false);\n }\n }, [pending, isRunning]);\n\n // Pre-start failure recovery: re-enable after the grace window when no\n // resume run began; answering the still-parked request again is exactly\n // what the user needs to be able to do.\n useEffect(() => {\n if (!pending || pendingResumeGraceMs === undefined) return;\n const timer = setTimeout(() => {\n if (!sawResumeRunRef.current) setPending(false);\n }, pendingResumeGraceMs);\n return () => clearTimeout(timer);\n }, [pending, requestId, pendingResumeGraceMs, attempt]);\n\n const sendResumeRef = useRef(sendResume);\n sendResumeRef.current = sendResume;\n const onResumeRejectedRef = useRef(onResumeRejected);\n onResumeRejectedRef.current = onResumeRejected;\n const onResumeRetryRef = useRef(onResumeRetry);\n onResumeRetryRef.current = onResumeRetry;\n const maxTransportRetriesRef = useRef(maxTransportRetries);\n maxTransportRetriesRef.current = maxTransportRetries;\n const currentRequestIdRef = useRef(requestId);\n currentRequestIdRef.current = requestId;\n const pendingRef = useRef(pending);\n pendingRef.current = pending;\n // One token per `resume` call: a settle from an earlier submission must not\n // retry over, or release, a newer one for the same request.\n const submissionRef = useRef(0);\n\n const resume = useCallback(\n (value: TValue): Promise<unknown> | undefined => {\n if (requestId === undefined || pendingRef.current) return undefined;\n const submission = ++submissionRef.current;\n setPending(true);\n pendingRef.current = true;\n setAttempt(0);\n const first: unknown = sendResumeRef.current(requestId, value);\n if (!(first instanceof Promise)) return undefined;\n // The final failure is already reported through `onResumeRejected`;\n // callers that drop the promise must not get an unhandled rejection.\n const outcome = new Promise<unknown>((resolve, reject) => {\n const settle = (dispatched: Promise<unknown>, retries: number) => {\n dispatched.then(resolve, (error: unknown) => {\n // A late refusal for a request the lock has since moved past (the\n // park was re-keyed, or a newer answer is in flight) must neither\n // release that answer's lock nor be reported as a failure of it.\n // The optimistic fold hides the answered request until the fold\n // rolls back, so `undefined` here is not a departure.\n const current = currentRequestIdRef.current;\n if (\n submission !== submissionRef.current ||\n (current !== undefined && current !== requestId)\n ) {\n reject(error);\n return;\n }\n if (retries < maxTransportRetriesRef.current && isResumeTransportLoss(error)) {\n const next = retries + 1;\n onResumeRetryRef.current?.(error, requestId, next);\n setPending(true);\n pendingRef.current = true;\n setAttempt(next);\n const resent: unknown = sendResumeRef.current(requestId, value);\n if (resent instanceof Promise) {\n settle(resent, next);\n return;\n }\n resolve(undefined);\n return;\n }\n setPending(false);\n pendingRef.current = false;\n onResumeRejectedRef.current?.(error, requestId);\n reject(error);\n });\n };\n settle(first, 0);\n });\n outcome.catch(() => {});\n return outcome;\n },\n [requestId],\n );\n\n return { pending, resume };\n}\n"],"names":["hasClientToolInterruptSource","readDeepAgentStreamValues","statewireTransportOutcome","useState","useRef","useEffect","useCallback"],"mappings":";;;;;;AA2EA,SAAS,SAAS,OAAkD;AAClE,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAGO,SAAS,mBACd,SAC+C;AAC/C,SAAO,QAAQ,SAAS,eAAe,EAAE,cAAc;AACzD;AAQA,MAAM,wCAA6D,oBAAI,IAAI,CAAC,uBAAuB,CAAC;AAO7F,SAAS,uBAAuB,SAA2B;AAChE,MAAI,CAAC,SAAS,OAAO,EAAG,QAAO;AAC/B,MAAI,QAAQ,yBAAyB,MAAO,QAAO;AACnD,SACE,OAAO,QAAQ,WAAW,YAAY,sCAAsC,IAAI,QAAQ,MAAM;AAElG;AASO,SAAS,wBACd,SAC+C;AAC/C,MAAI,CAAC,mBAAmB,OAAO,EAAG,QAAO;AACzC,QAAM,UAAW,QAAkC;AACnD,SAAO,CAACA,YAAAA,6BAA6B,OAAO,KAAK,CAAC,uBAAuB,OAAO;AAClF;AAGO,SAAS,eAAe,OAA4C;AACzE,MAAI,CAAC,SAAS,KAAK,EAAG,QAAO;AAC7B,SAAO,MAAM,SAAS,UACpB,MAAM,WAAW,mBACjB,OAAO,MAAM,YAAY,WACtB,QACD;AACN;AAGO,MAAM,mCACX;AAGK,SAAS,qBACd,OACA,WAAmB,kCAC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