@athenaintel/react 0.57.2 → 0.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (852) hide show
  1. package/README.md +795 -12
  2. package/dist/agent-runtime/src/addressed-agents.cjs +16 -0
  3. package/dist/agent-runtime/src/addressed-agents.cjs.map +1 -0
  4. package/dist/agent-runtime/src/addressed-agents.d.ts +30 -0
  5. package/dist/agent-runtime/src/addressed-agents.js +16 -0
  6. package/dist/agent-runtime/src/addressed-agents.js.map +1 -0
  7. package/dist/agent-runtime/src/answer-label.cjs +4 -3
  8. package/dist/agent-runtime/src/answer-label.cjs.map +1 -1
  9. package/dist/agent-runtime/src/answer-label.d.ts +13 -6
  10. package/dist/agent-runtime/src/answer-label.js +4 -3
  11. package/dist/agent-runtime/src/answer-label.js.map +1 -1
  12. package/dist/agent-runtime/src/chat-outbox-attachments.cjs.map +1 -1
  13. package/dist/agent-runtime/src/chat-outbox-attachments.d.ts +1 -1
  14. package/dist/agent-runtime/src/chat-outbox-attachments.js.map +1 -1
  15. package/dist/agent-runtime/src/chat-outbox-entry.cjs +101 -0
  16. package/dist/agent-runtime/src/chat-outbox-entry.cjs.map +1 -0
  17. package/dist/agent-runtime/src/chat-outbox-entry.d.ts +99 -0
  18. package/dist/agent-runtime/src/chat-outbox-entry.js +101 -0
  19. package/dist/agent-runtime/src/chat-outbox-entry.js.map +1 -0
  20. package/dist/agent-runtime/src/chat-outbox-legacy.cjs +252 -0
  21. package/dist/agent-runtime/src/chat-outbox-legacy.cjs.map +1 -0
  22. package/dist/agent-runtime/src/chat-outbox-legacy.d.ts +96 -0
  23. package/dist/agent-runtime/src/chat-outbox-legacy.js +252 -0
  24. package/dist/agent-runtime/src/chat-outbox-legacy.js.map +1 -0
  25. package/dist/agent-runtime/src/chat-outbox-policy.cjs +30 -0
  26. package/dist/agent-runtime/src/chat-outbox-policy.cjs.map +1 -0
  27. package/dist/agent-runtime/src/chat-outbox-policy.d.ts +42 -0
  28. package/dist/agent-runtime/src/chat-outbox-policy.js +30 -0
  29. package/dist/agent-runtime/src/chat-outbox-policy.js.map +1 -0
  30. package/dist/agent-runtime/src/chat-outbox-storage.cjs +306 -0
  31. package/dist/agent-runtime/src/chat-outbox-storage.cjs.map +1 -0
  32. package/dist/agent-runtime/src/chat-outbox-storage.d.ts +194 -0
  33. package/dist/agent-runtime/src/chat-outbox-storage.js +306 -0
  34. package/dist/agent-runtime/src/chat-outbox-storage.js.map +1 -0
  35. package/dist/agent-runtime/src/chat-outbox-thread.cjs +21 -94
  36. package/dist/agent-runtime/src/chat-outbox-thread.cjs.map +1 -1
  37. package/dist/agent-runtime/src/chat-outbox-thread.d.ts +22 -18
  38. package/dist/agent-runtime/src/chat-outbox-thread.js +21 -94
  39. package/dist/agent-runtime/src/chat-outbox-thread.js.map +1 -1
  40. package/dist/agent-runtime/src/chat-outbox.cjs +492 -547
  41. package/dist/agent-runtime/src/chat-outbox.cjs.map +1 -1
  42. package/dist/agent-runtime/src/chat-outbox.d.ts +110 -142
  43. package/dist/agent-runtime/src/chat-outbox.js +492 -547
  44. package/dist/agent-runtime/src/chat-outbox.js.map +1 -1
  45. package/dist/agent-runtime/src/composer-markdown.cjs +0 -16
  46. package/dist/agent-runtime/src/composer-markdown.cjs.map +1 -1
  47. package/dist/agent-runtime/src/composer-markdown.d.ts +1 -1
  48. package/dist/agent-runtime/src/composer-markdown.js +1 -17
  49. package/dist/agent-runtime/src/composer-markdown.js.map +1 -1
  50. package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs +3 -1
  51. package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -1
  52. package/dist/agent-runtime/src/deep-agent-transport-recipe.d.ts +8 -1
  53. package/dist/agent-runtime/src/deep-agent-transport-recipe.js +3 -1
  54. package/dist/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -1
  55. package/dist/agent-runtime/src/dictation-preferences.d.ts +356 -0
  56. package/dist/agent-runtime/src/dictation-record.d.ts +279 -0
  57. package/dist/agent-runtime/src/dictation-session.d.ts +106 -7
  58. package/dist/agent-runtime/src/dictation-snippets.d.ts +9 -0
  59. package/dist/agent-runtime/src/dictation-transfer.d.ts +142 -0
  60. package/dist/agent-runtime/src/edit-command.cjs.map +1 -1
  61. package/dist/agent-runtime/src/edit-command.d.ts +1 -1
  62. package/dist/agent-runtime/src/edit-command.js.map +1 -1
  63. package/dist/agent-runtime/src/errors.cjs +1 -0
  64. package/dist/agent-runtime/src/errors.cjs.map +1 -1
  65. package/dist/agent-runtime/src/errors.js +1 -0
  66. package/dist/agent-runtime/src/errors.js.map +1 -1
  67. package/dist/agent-runtime/src/generated/runconfig-contract.cjs +24 -0
  68. package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
  69. package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +3 -3
  70. package/dist/agent-runtime/src/generated/runconfig-contract.js +24 -0
  71. package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
  72. package/dist/agent-runtime/src/index.d.ts +14 -8
  73. package/dist/agent-runtime/src/lane-follow.cjs +289 -0
  74. package/dist/agent-runtime/src/lane-follow.cjs.map +1 -0
  75. package/dist/agent-runtime/src/lane-follow.js +289 -0
  76. package/dist/agent-runtime/src/lane-follow.js.map +1 -0
  77. package/dist/agent-runtime/src/lane-images.cjs +387 -0
  78. package/dist/agent-runtime/src/lane-images.cjs.map +1 -0
  79. package/dist/agent-runtime/src/lane-images.js +387 -0
  80. package/dist/agent-runtime/src/lane-images.js.map +1 -0
  81. package/dist/agent-runtime/src/message-window.js +1 -1
  82. package/dist/agent-runtime/src/messages.cjs +19 -1
  83. package/dist/agent-runtime/src/messages.cjs.map +1 -1
  84. package/dist/agent-runtime/src/messages.d.ts +8 -0
  85. package/dist/agent-runtime/src/messages.js +21 -3
  86. package/dist/agent-runtime/src/messages.js.map +1 -1
  87. package/dist/agent-runtime/src/named-agents.cjs +301 -0
  88. package/dist/agent-runtime/src/named-agents.cjs.map +1 -0
  89. package/dist/agent-runtime/src/named-agents.d.ts +246 -0
  90. package/dist/agent-runtime/src/named-agents.js +301 -0
  91. package/dist/agent-runtime/src/named-agents.js.map +1 -0
  92. package/dist/agent-runtime/src/offline-status.cjs.map +1 -1
  93. package/dist/agent-runtime/src/offline-status.d.ts +93 -2
  94. package/dist/agent-runtime/src/offline-status.js.map +1 -1
  95. package/dist/agent-runtime/src/ptc-subcalls.cjs +41 -0
  96. package/dist/agent-runtime/src/ptc-subcalls.cjs.map +1 -0
  97. package/dist/agent-runtime/src/ptc-subcalls.js +41 -0
  98. package/dist/agent-runtime/src/ptc-subcalls.js.map +1 -0
  99. package/dist/agent-runtime/src/queue.cjs +2 -2
  100. package/dist/agent-runtime/src/queue.cjs.map +1 -1
  101. package/dist/agent-runtime/src/queue.d.ts +20 -25
  102. package/dist/agent-runtime/src/queue.js +2 -2
  103. package/dist/agent-runtime/src/queue.js.map +1 -1
  104. package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs +314 -84
  105. package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
  106. package/dist/agent-runtime/src/quota-safe-local-storage-session.d.ts +137 -40
  107. package/dist/agent-runtime/src/quota-safe-local-storage-session.js +318 -88
  108. package/dist/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -1
  109. package/dist/agent-runtime/src/run-send.cjs +54 -0
  110. package/dist/agent-runtime/src/run-send.cjs.map +1 -0
  111. package/dist/agent-runtime/src/run-send.d.ts +51 -0
  112. package/dist/agent-runtime/src/run-send.js +54 -0
  113. package/dist/agent-runtime/src/run-send.js.map +1 -0
  114. package/dist/agent-runtime/src/running-tool-placeholder.cjs +6 -0
  115. package/dist/agent-runtime/src/running-tool-placeholder.cjs.map +1 -1
  116. package/dist/agent-runtime/src/running-tool-placeholder.js +6 -0
  117. package/dist/agent-runtime/src/running-tool-placeholder.js.map +1 -1
  118. package/dist/agent-runtime/src/runtime.d.ts +9 -5
  119. package/dist/agent-runtime/src/sealed-idb.cjs +64 -0
  120. package/dist/agent-runtime/src/sealed-idb.cjs.map +1 -1
  121. package/dist/agent-runtime/src/sealed-idb.d.ts +16 -0
  122. package/dist/agent-runtime/src/sealed-idb.js +64 -0
  123. package/dist/agent-runtime/src/sealed-idb.js.map +1 -1
  124. package/dist/agent-runtime/src/send-recovery.cjs +90 -118
  125. package/dist/agent-runtime/src/send-recovery.cjs.map +1 -1
  126. package/dist/agent-runtime/src/send-recovery.d.ts +25 -29
  127. package/dist/agent-runtime/src/send-recovery.js +90 -118
  128. package/dist/agent-runtime/src/send-recovery.js.map +1 -1
  129. package/dist/agent-runtime/src/statewire-diagnostics.d.ts +4 -1
  130. package/dist/agent-runtime/src/statewire-held-sends.cjs +191 -0
  131. package/dist/agent-runtime/src/statewire-held-sends.cjs.map +1 -0
  132. package/dist/agent-runtime/src/statewire-held-sends.d.ts +119 -0
  133. package/dist/agent-runtime/src/statewire-held-sends.js +191 -0
  134. package/dist/agent-runtime/src/statewire-held-sends.js.map +1 -0
  135. package/dist/agent-runtime/src/statewire-state.cjs +4 -0
  136. package/dist/agent-runtime/src/statewire-state.cjs.map +1 -1
  137. package/dist/agent-runtime/src/statewire-state.js +4 -0
  138. package/dist/agent-runtime/src/statewire-state.js.map +1 -1
  139. package/dist/agent-runtime/src/statewire-transport.cjs +8 -2
  140. package/dist/agent-runtime/src/statewire-transport.cjs.map +1 -1
  141. package/dist/agent-runtime/src/statewire-transport.d.ts +14 -5
  142. package/dist/agent-runtime/src/statewire-transport.js +8 -2
  143. package/dist/agent-runtime/src/statewire-transport.js.map +1 -1
  144. package/dist/agent-runtime/src/subagent-transcripts.cjs +1 -23
  145. package/dist/agent-runtime/src/subagent-transcripts.cjs.map +1 -1
  146. package/dist/agent-runtime/src/subagent-transcripts.js +3 -25
  147. package/dist/agent-runtime/src/subagent-transcripts.js.map +1 -1
  148. package/dist/agent-runtime/src/subagents.cjs +22 -29
  149. package/dist/agent-runtime/src/subagents.cjs.map +1 -1
  150. package/dist/agent-runtime/src/subagents.js +23 -30
  151. package/dist/agent-runtime/src/subagents.js.map +1 -1
  152. package/dist/agent-runtime/src/thread-extras.cjs +27 -19
  153. package/dist/agent-runtime/src/thread-extras.cjs.map +1 -1
  154. package/dist/agent-runtime/src/thread-extras.d.ts +19 -6
  155. package/dist/agent-runtime/src/thread-extras.js +27 -19
  156. package/dist/agent-runtime/src/thread-extras.js.map +1 -1
  157. package/dist/agent-runtime/src/thread-handoff-flow-machine.d.ts +8 -8
  158. package/dist/agent-runtime/src/tool-metadata.cjs +19 -0
  159. package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -1
  160. package/dist/agent-runtime/src/tool-metadata.js +19 -0
  161. package/dist/agent-runtime/src/tool-metadata.js.map +1 -1
  162. package/dist/agent-runtime/src/tool-names.cjs +21 -0
  163. package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
  164. package/dist/agent-runtime/src/tool-names.d.ts +8 -0
  165. package/dist/agent-runtime/src/tool-names.js +21 -0
  166. package/dist/agent-runtime/src/tool-names.js.map +1 -1
  167. package/dist/agent-runtime/src/typed-interrupt-kinds.cjs +247 -0
  168. package/dist/agent-runtime/src/typed-interrupt-kinds.cjs.map +1 -0
  169. package/dist/agent-runtime/src/typed-interrupt-kinds.d.ts +173 -0
  170. package/dist/agent-runtime/src/typed-interrupt-kinds.js +247 -0
  171. package/dist/agent-runtime/src/typed-interrupt-kinds.js.map +1 -0
  172. package/dist/agent-runtime/src/typed-interrupts.cjs +48 -0
  173. package/dist/agent-runtime/src/typed-interrupts.cjs.map +1 -0
  174. package/dist/agent-runtime/src/typed-interrupts.d.ts +75 -0
  175. package/dist/agent-runtime/src/typed-interrupts.js +48 -0
  176. package/dist/agent-runtime/src/typed-interrupts.js.map +1 -0
  177. package/dist/agent-runtime/src/types.d.ts +1 -1
  178. package/dist/agent-runtime/src/use-conversation-list.cjs +1 -0
  179. package/dist/agent-runtime/src/use-conversation-list.cjs.map +1 -1
  180. package/dist/agent-runtime/src/use-conversation-list.d.ts +7 -0
  181. package/dist/agent-runtime/src/use-conversation-list.js +1 -0
  182. package/dist/agent-runtime/src/use-conversation-list.js.map +1 -1
  183. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +46 -29
  184. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -1
  185. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +14 -22
  186. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +46 -29
  187. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -1
  188. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +78 -14
  189. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
  190. package/dist/agent-runtime/src/use-deep-agent-runtime.d.ts +34 -7
  191. package/dist/agent-runtime/src/use-deep-agent-runtime.js +79 -15
  192. package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
  193. package/dist/agent-runtime/src/use-deep-agent-thread.cjs +16 -1
  194. package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
  195. package/dist/agent-runtime/src/use-deep-agent-thread.d.ts +7 -2
  196. package/dist/agent-runtime/src/use-deep-agent-thread.js +16 -1
  197. package/dist/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
  198. package/dist/agent-runtime/src/use-deep-agent-voice.cjs +30 -4
  199. package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -1
  200. package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +22 -4
  201. package/dist/agent-runtime/src/use-deep-agent-voice.js +30 -4
  202. package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -1
  203. package/dist/agent-runtime/src/withdrawn-turns.d.ts +5 -4
  204. package/dist/agent-runtime/src/word-device-fit.d.ts +174 -0
  205. package/dist/agent-runtime/src/work-in.d.ts +127 -0
  206. package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
  207. package/dist/assets/AthenaAssetEmbed.d.ts +6 -1
  208. package/dist/assets/AthenaAssetEmbed.js.map +1 -1
  209. package/dist/assets/asset-panel-store.cjs +13 -5
  210. package/dist/assets/asset-panel-store.cjs.map +1 -1
  211. package/dist/assets/asset-panel-store.d.ts +33 -2
  212. package/dist/assets/asset-panel-store.js +13 -5
  213. package/dist/assets/asset-panel-store.js.map +1 -1
  214. package/dist/auth/AthenaCredentialSourceContext.cjs +11 -0
  215. package/dist/auth/AthenaCredentialSourceContext.cjs.map +1 -1
  216. package/dist/auth/AthenaCredentialSourceContext.d.ts +6 -0
  217. package/dist/auth/AthenaCredentialSourceContext.js +11 -0
  218. package/dist/auth/AthenaCredentialSourceContext.js.map +1 -1
  219. package/dist/auth/account-identity.cjs +13 -2
  220. package/dist/auth/account-identity.cjs.map +1 -1
  221. package/dist/auth/account-identity.d.ts +9 -0
  222. package/dist/auth/account-identity.js +13 -2
  223. package/dist/auth/account-identity.js.map +1 -1
  224. package/dist/auth/credential-source.cjs +20 -4
  225. package/dist/auth/credential-source.cjs.map +1 -1
  226. package/dist/auth/credential-source.d.ts +9 -0
  227. package/dist/auth/credential-source.js +20 -4
  228. package/dist/auth/credential-source.js.map +1 -1
  229. package/dist/catalog/chat-pickers.cjs +31 -0
  230. package/dist/catalog/chat-pickers.cjs.map +1 -1
  231. package/dist/catalog/chat-pickers.d.ts +17 -0
  232. package/dist/catalog/chat-pickers.js +33 -2
  233. package/dist/catalog/chat-pickers.js.map +1 -1
  234. package/dist/catalog/runtime-catalog.cjs +63 -3
  235. package/dist/catalog/runtime-catalog.cjs.map +1 -1
  236. package/dist/catalog/runtime-catalog.d.ts +63 -3
  237. package/dist/catalog/runtime-catalog.js +64 -4
  238. package/dist/catalog/runtime-catalog.js.map +1 -1
  239. package/dist/chat/AthenaChat.cjs +301 -98
  240. package/dist/chat/AthenaChat.cjs.map +1 -1
  241. package/dist/chat/AthenaChat.d.ts +80 -4
  242. package/dist/chat/AthenaChat.js +302 -99
  243. package/dist/chat/AthenaChat.js.map +1 -1
  244. package/dist/chat/StatewireApprovalCard.cjs +35 -5
  245. package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
  246. package/dist/chat/StatewireApprovalCard.d.ts +55 -2
  247. package/dist/chat/StatewireApprovalCard.js +37 -7
  248. package/dist/chat/StatewireApprovalCard.js.map +1 -1
  249. package/dist/chat/StatewireQueuedMessages.cjs +17 -2
  250. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
  251. package/dist/chat/StatewireQueuedMessages.d.ts +8 -45
  252. package/dist/chat/StatewireQueuedMessages.js +18 -3
  253. package/dist/chat/StatewireQueuedMessages.js.map +1 -1
  254. package/dist/chat/chat-agent-mentions.cjs +70 -0
  255. package/dist/chat/chat-agent-mentions.cjs.map +1 -0
  256. package/dist/chat/chat-agent-mentions.d.ts +13 -0
  257. package/dist/chat/chat-agent-mentions.js +70 -0
  258. package/dist/chat/chat-agent-mentions.js.map +1 -0
  259. package/dist/chat/composer-actions.cjs +12 -0
  260. package/dist/chat/composer-actions.cjs.map +1 -0
  261. package/dist/chat/composer-actions.d.ts +22 -0
  262. package/dist/chat/composer-actions.js +12 -0
  263. package/dist/chat/composer-actions.js.map +1 -0
  264. package/dist/chat/follow-up-suggestions.cjs +185 -0
  265. package/dist/chat/follow-up-suggestions.cjs.map +1 -0
  266. package/dist/chat/follow-up-suggestions.d.ts +64 -0
  267. package/dist/chat/follow-up-suggestions.js +185 -0
  268. package/dist/chat/follow-up-suggestions.js.map +1 -0
  269. package/dist/chat/super-grouping/ToolTimeline.cjs +4 -3
  270. package/dist/chat/super-grouping/ToolTimeline.cjs.map +1 -1
  271. package/dist/chat/super-grouping/ToolTimeline.d.ts +7 -3
  272. package/dist/chat/super-grouping/ToolTimeline.js +4 -3
  273. package/dist/chat/super-grouping/ToolTimeline.js.map +1 -1
  274. package/dist/chat/turn-changes.cjs +284 -0
  275. package/dist/chat/turn-changes.cjs.map +1 -0
  276. package/dist/chat/turn-changes.d.ts +130 -0
  277. package/dist/chat/turn-changes.js +284 -0
  278. package/dist/chat/turn-changes.js.map +1 -0
  279. package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.cjs +31 -0
  280. package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.cjs.map +1 -0
  281. package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.d.ts +31 -0
  282. package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.js +31 -0
  283. package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.js.map +1 -0
  284. package/dist/chat/typed-interrupts/approval-cards.cjs +250 -0
  285. package/dist/chat/typed-interrupts/approval-cards.cjs.map +1 -0
  286. package/dist/chat/typed-interrupts/approval-cards.d.ts +22 -0
  287. package/dist/chat/typed-interrupts/approval-cards.js +250 -0
  288. package/dist/chat/typed-interrupts/approval-cards.js.map +1 -0
  289. package/dist/chat/typed-interrupts/form-cards.cjs +289 -0
  290. package/dist/chat/typed-interrupts/form-cards.cjs.map +1 -0
  291. package/dist/chat/typed-interrupts/form-cards.d.ts +6 -0
  292. package/dist/chat/typed-interrupts/form-cards.js +289 -0
  293. package/dist/chat/typed-interrupts/form-cards.js.map +1 -0
  294. package/dist/chat/typed-interrupts/interrupt-card-shell.cjs +182 -0
  295. package/dist/chat/typed-interrupts/interrupt-card-shell.cjs.map +1 -0
  296. package/dist/chat/typed-interrupts/interrupt-card-shell.d.ts +47 -0
  297. package/dist/chat/typed-interrupts/interrupt-card-shell.js +182 -0
  298. package/dist/chat/typed-interrupts/interrupt-card-shell.js.map +1 -0
  299. package/dist/chat/typed-interrupts/json-schema-form.cjs +388 -0
  300. package/dist/chat/typed-interrupts/json-schema-form.cjs.map +1 -0
  301. package/dist/chat/typed-interrupts/json-schema-form.d.ts +33 -0
  302. package/dist/chat/typed-interrupts/json-schema-form.js +388 -0
  303. package/dist/chat/typed-interrupts/json-schema-form.js.map +1 -0
  304. package/dist/chat/typed-interrupts/questionnaire-card.cjs +449 -0
  305. package/dist/chat/typed-interrupts/questionnaire-card.cjs.map +1 -0
  306. package/dist/chat/typed-interrupts/questionnaire-card.d.ts +20 -0
  307. package/dist/chat/typed-interrupts/questionnaire-card.js +449 -0
  308. package/dist/chat/typed-interrupts/questionnaire-card.js.map +1 -0
  309. package/dist/chat/typed-interrupts/request-file-card.cjs +159 -0
  310. package/dist/chat/typed-interrupts/request-file-card.cjs.map +1 -0
  311. package/dist/chat/typed-interrupts/request-file-card.d.ts +2 -0
  312. package/dist/chat/typed-interrupts/request-file-card.js +159 -0
  313. package/dist/chat/typed-interrupts/request-file-card.js.map +1 -0
  314. package/dist/chat/typed-interrupts/toolkit-selection-card.cjs +189 -0
  315. package/dist/chat/typed-interrupts/toolkit-selection-card.cjs.map +1 -0
  316. package/dist/chat/typed-interrupts/toolkit-selection-card.d.ts +23 -0
  317. package/dist/chat/typed-interrupts/toolkit-selection-card.js +189 -0
  318. package/dist/chat/typed-interrupts/toolkit-selection-card.js.map +1 -0
  319. package/dist/chat/typed-interrupts/typed-interrupt-body.cjs +26 -0
  320. package/dist/chat/typed-interrupts/typed-interrupt-body.cjs.map +1 -0
  321. package/dist/chat/typed-interrupts/typed-interrupt-body.d.ts +3 -0
  322. package/dist/chat/typed-interrupts/typed-interrupt-body.js +26 -0
  323. package/dist/chat/typed-interrupts/typed-interrupt-body.js.map +1 -0
  324. package/dist/chat/typed-interrupts/typed-interrupt-graphql.cjs +105 -0
  325. package/dist/chat/typed-interrupts/typed-interrupt-graphql.cjs.map +1 -0
  326. package/dist/chat/typed-interrupts/typed-interrupt-graphql.d.ts +29 -0
  327. package/dist/chat/typed-interrupts/typed-interrupt-graphql.js +105 -0
  328. package/dist/chat/typed-interrupts/typed-interrupt-graphql.js.map +1 -0
  329. package/dist/chat/typed-interrupts/typed-interrupt-notice.cjs +70 -0
  330. package/dist/chat/typed-interrupts/typed-interrupt-notice.cjs.map +1 -0
  331. package/dist/chat/typed-interrupts/typed-interrupt-notice.d.ts +45 -0
  332. package/dist/chat/typed-interrupts/typed-interrupt-notice.js +70 -0
  333. package/dist/chat/typed-interrupts/typed-interrupt-notice.js.map +1 -0
  334. package/dist/chat/typed-interrupts/typed-interrupt-panel.cjs +76 -0
  335. package/dist/chat/typed-interrupts/typed-interrupt-panel.cjs.map +1 -0
  336. package/dist/chat/typed-interrupts/typed-interrupt-panel.d.ts +11 -0
  337. package/dist/chat/typed-interrupts/typed-interrupt-panel.js +76 -0
  338. package/dist/chat/typed-interrupts/typed-interrupt-panel.js.map +1 -0
  339. package/dist/chat/typed-interrupts/typed-interrupt-types.d.ts +46 -0
  340. package/dist/chat/typed-interrupts/use-interrupt-draft.cjs +106 -0
  341. package/dist/chat/typed-interrupts/use-interrupt-draft.cjs.map +1 -0
  342. package/dist/chat/typed-interrupts/use-interrupt-draft.d.ts +29 -0
  343. package/dist/chat/typed-interrupts/use-interrupt-draft.js +106 -0
  344. package/dist/chat/typed-interrupts/use-interrupt-draft.js.map +1 -0
  345. package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.cjs +231 -0
  346. package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.cjs.map +1 -0
  347. package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.d.ts +66 -0
  348. package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.js +231 -0
  349. package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.js.map +1 -0
  350. package/dist/chat-ui/composer/composer-named-agents.cjs +13 -0
  351. package/dist/chat-ui/composer/composer-named-agents.cjs.map +1 -0
  352. package/dist/chat-ui/composer/composer-named-agents.d.ts +20 -0
  353. package/dist/chat-ui/composer/composer-named-agents.js +13 -0
  354. package/dist/chat-ui/composer/composer-named-agents.js.map +1 -0
  355. package/dist/chat-ui/composer/slash-command-menu.cjs +143 -0
  356. package/dist/chat-ui/composer/slash-command-menu.cjs.map +1 -0
  357. package/dist/chat-ui/composer/slash-command-menu.d.ts +19 -0
  358. package/dist/chat-ui/composer/slash-command-menu.js +143 -0
  359. package/dist/chat-ui/composer/slash-command-menu.js.map +1 -0
  360. package/dist/chat-ui/composer/slash-commands-extension.cjs +51 -0
  361. package/dist/chat-ui/composer/slash-commands-extension.cjs.map +1 -0
  362. package/dist/chat-ui/composer/slash-commands-extension.d.ts +39 -0
  363. package/dist/chat-ui/composer/slash-commands-extension.js +51 -0
  364. package/dist/chat-ui/composer/slash-commands-extension.js.map +1 -0
  365. package/dist/chat-ui/composer/slash-commands.cjs +74 -0
  366. package/dist/chat-ui/composer/slash-commands.cjs.map +1 -0
  367. package/dist/chat-ui/composer/slash-commands.d.ts +82 -0
  368. package/dist/chat-ui/composer/slash-commands.js +74 -0
  369. package/dist/chat-ui/composer/slash-commands.js.map +1 -0
  370. package/dist/chat-ui/composer/tiptap-composer.cjs +135 -9
  371. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
  372. package/dist/chat-ui/composer/tiptap-composer.d.ts +61 -2
  373. package/dist/chat-ui/composer/tiptap-composer.js +135 -9
  374. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
  375. package/dist/chat-ui/index.cjs +5 -0
  376. package/dist/chat-ui/index.cjs.map +1 -1
  377. package/dist/chat-ui/index.d.ts +4 -2
  378. package/dist/chat-ui/index.js +5 -0
  379. package/dist/chat-ui/index.js.map +1 -1
  380. package/dist/chat-ui/mentions/mention-chip.cjs +10 -4
  381. package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
  382. package/dist/chat-ui/mentions/mention-chip.js +11 -5
  383. package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
  384. package/dist/chat-ui/mentions/mention-extension.cjs +8 -1
  385. package/dist/chat-ui/mentions/mention-extension.cjs.map +1 -1
  386. package/dist/chat-ui/mentions/mention-extension.js +8 -1
  387. package/dist/chat-ui/mentions/mention-extension.js.map +1 -1
  388. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.cjs +1 -0
  389. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.cjs.map +1 -1
  390. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.js +1 -0
  391. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.js.map +1 -1
  392. package/dist/chat-ui/mentions/suggestions/components/mention-icon.cjs +20 -2
  393. package/dist/chat-ui/mentions/suggestions/components/mention-icon.cjs.map +1 -1
  394. package/dist/chat-ui/mentions/suggestions/components/mention-icon.d.ts +10 -1
  395. package/dist/chat-ui/mentions/suggestions/components/mention-icon.js +22 -4
  396. package/dist/chat-ui/mentions/suggestions/components/mention-icon.js.map +1 -1
  397. package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs +1 -1
  398. package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs.map +1 -1
  399. package/dist/chat-ui/mentions/suggestions/components/menu-item.js +1 -1
  400. package/dist/chat-ui/mentions/suggestions/components/menu-item.js.map +1 -1
  401. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +45 -0
  402. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
  403. package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +48 -0
  404. package/dist/chat-ui/mentions/suggestions/data/api-client.js +45 -0
  405. package/dist/chat-ui/mentions/suggestions/data/api-client.js.map +1 -1
  406. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icon-names.generated.cjs +89 -0
  407. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icon-names.generated.cjs.map +1 -0
  408. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icon-names.generated.d.ts +8 -0
  409. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icon-names.generated.js +89 -0
  410. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icon-names.generated.js.map +1 -0
  411. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs +140 -116
  412. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs.map +1 -1
  413. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.d.ts +46 -12
  414. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js +141 -117
  415. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js.map +1 -1
  416. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +272 -25
  417. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -1
  418. package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +88 -10
  419. package/dist/chat-ui/mentions/suggestions/data/sources/index.js +274 -27
  420. package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
  421. package/dist/chat-ui/mentions/suggestions/data/types.cjs.map +1 -1
  422. package/dist/chat-ui/mentions/suggestions/data/types.d.ts +27 -1
  423. package/dist/chat-ui/mentions/suggestions/data/types.js.map +1 -1
  424. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs +56 -5
  425. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs.map +1 -1
  426. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.d.ts +26 -6
  427. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js +57 -6
  428. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js.map +1 -1
  429. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.cjs +34 -17
  430. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.cjs.map +1 -1
  431. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.d.ts +19 -1
  432. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.js +35 -18
  433. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.js.map +1 -1
  434. package/dist/chat-ui/mentions/use-asset-icon-app-url.cjs +12 -0
  435. package/dist/chat-ui/mentions/use-asset-icon-app-url.cjs.map +1 -0
  436. package/dist/chat-ui/mentions/use-asset-icon-app-url.d.ts +8 -0
  437. package/dist/chat-ui/mentions/use-asset-icon-app-url.js +12 -0
  438. package/dist/chat-ui/mentions/use-asset-icon-app-url.js.map +1 -0
  439. package/dist/chat-ui/statewire.d.ts +1 -1
  440. package/dist/chat-ui/thread/statewire-history-edge.cjs +15 -0
  441. package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
  442. package/dist/chat-ui/thread/statewire-history-edge.d.ts +4 -1
  443. package/dist/chat-ui/thread/statewire-history-edge.js +15 -0
  444. package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
  445. package/dist/collab/client.cjs +41 -6
  446. package/dist/collab/client.cjs.map +1 -1
  447. package/dist/collab/client.d.ts +38 -7
  448. package/dist/collab/client.js +41 -6
  449. package/dist/collab/client.js.map +1 -1
  450. package/dist/composer/ComposerAttachedReferences.cjs +119 -0
  451. package/dist/composer/ComposerAttachedReferences.cjs.map +1 -0
  452. package/dist/composer/ComposerAttachedReferences.d.ts +26 -0
  453. package/dist/composer/ComposerAttachedReferences.js +119 -0
  454. package/dist/composer/ComposerAttachedReferences.js.map +1 -0
  455. package/dist/composer/ComposerNamedAgents.cjs +63 -0
  456. package/dist/composer/ComposerNamedAgents.cjs.map +1 -0
  457. package/dist/composer/ComposerNamedAgents.d.ts +16 -0
  458. package/dist/composer/ComposerNamedAgents.js +63 -0
  459. package/dist/composer/ComposerNamedAgents.js.map +1 -0
  460. package/dist/composer/attached-references.cjs +159 -0
  461. package/dist/composer/attached-references.cjs.map +1 -0
  462. package/dist/composer/attached-references.d.ts +86 -0
  463. package/dist/composer/attached-references.js +159 -0
  464. package/dist/composer/attached-references.js.map +1 -0
  465. package/dist/composer/build-composed-message.cjs +14 -7
  466. package/dist/composer/build-composed-message.cjs.map +1 -1
  467. package/dist/composer/build-composed-message.d.ts +6 -1
  468. package/dist/composer/build-composed-message.js +14 -7
  469. package/dist/composer/build-composed-message.js.map +1 -1
  470. package/dist/composer/composer-handoff.cjs +6 -2
  471. package/dist/composer/composer-handoff.cjs.map +1 -1
  472. package/dist/composer/composer-handoff.d.ts +7 -1
  473. package/dist/composer/composer-handoff.js +6 -2
  474. package/dist/composer/composer-handoff.js.map +1 -1
  475. package/dist/composer/folder-upload.cjs +149 -0
  476. package/dist/composer/folder-upload.cjs.map +1 -0
  477. package/dist/composer/folder-upload.d.ts +79 -0
  478. package/dist/composer/folder-upload.js +149 -0
  479. package/dist/composer/folder-upload.js.map +1 -0
  480. package/dist/composer/index.d.ts +1 -1
  481. package/dist/composer/staged-message-metadata.cjs +12 -0
  482. package/dist/composer/staged-message-metadata.cjs.map +1 -0
  483. package/dist/composer/staged-message-metadata.d.ts +15 -0
  484. package/dist/composer/staged-message-metadata.js +12 -0
  485. package/dist/composer/staged-message-metadata.js.map +1 -0
  486. package/dist/composer/useAttachToChat.cjs +35 -0
  487. package/dist/composer/useAttachToChat.cjs.map +1 -0
  488. package/dist/composer/useAttachToChat.d.ts +54 -0
  489. package/dist/composer/useAttachToChat.js +35 -0
  490. package/dist/composer/useAttachToChat.js.map +1 -0
  491. package/dist/composer/useAttachedReferencesComposerProps.cjs +19 -0
  492. package/dist/composer/useAttachedReferencesComposerProps.cjs.map +1 -0
  493. package/dist/composer/useAttachedReferencesComposerProps.d.ts +12 -0
  494. package/dist/composer/useAttachedReferencesComposerProps.js +19 -0
  495. package/dist/composer/useAttachedReferencesComposerProps.js.map +1 -0
  496. package/dist/composer/useFileUpload.cjs +95 -7
  497. package/dist/composer/useFileUpload.cjs.map +1 -1
  498. package/dist/composer/useFileUpload.d.ts +21 -2
  499. package/dist/composer/useFileUpload.js +95 -7
  500. package/dist/composer/useFileUpload.js.map +1 -1
  501. package/dist/data/athena-api-error.cjs +125 -0
  502. package/dist/data/athena-api-error.cjs.map +1 -0
  503. package/dist/data/athena-api-error.d.ts +96 -0
  504. package/dist/data/athena-api-error.js +125 -0
  505. package/dist/data/athena-api-error.js.map +1 -0
  506. package/dist/data/athena-data-client.cjs +106 -0
  507. package/dist/data/athena-data-client.cjs.map +1 -0
  508. package/dist/data/athena-data-client.d.ts +74 -0
  509. package/dist/data/athena-data-client.js +106 -0
  510. package/dist/data/athena-data-client.js.map +1 -0
  511. package/dist/data/athena-member.cjs +93 -0
  512. package/dist/data/athena-member.cjs.map +1 -0
  513. package/dist/data/athena-member.d.ts +125 -0
  514. package/dist/data/athena-member.js +93 -0
  515. package/dist/data/athena-member.js.map +1 -0
  516. package/dist/data/athena-request.cjs +460 -0
  517. package/dist/data/athena-request.cjs.map +1 -0
  518. package/dist/data/athena-request.d.ts +120 -0
  519. package/dist/data/athena-request.js +460 -0
  520. package/dist/data/athena-request.js.map +1 -0
  521. package/dist/data/use-athena-fetch.cjs +14 -0
  522. package/dist/data/use-athena-fetch.cjs.map +1 -0
  523. package/dist/data/use-athena-fetch.d.ts +19 -0
  524. package/dist/data/use-athena-fetch.js +14 -0
  525. package/dist/data/use-athena-fetch.js.map +1 -0
  526. package/dist/data/use-athena-graphql.cjs +66 -0
  527. package/dist/data/use-athena-graphql.cjs.map +1 -0
  528. package/dist/data/use-athena-graphql.d.ts +56 -0
  529. package/dist/data/use-athena-graphql.js +66 -0
  530. package/dist/data/use-athena-graphql.js.map +1 -0
  531. package/dist/data/use-athena-rest.cjs +33 -0
  532. package/dist/data/use-athena-rest.cjs.map +1 -0
  533. package/dist/data/use-athena-rest.d.ts +21 -0
  534. package/dist/data/use-athena-rest.js +33 -0
  535. package/dist/data/use-athena-rest.js.map +1 -0
  536. package/dist/data/use-semantic-query.cjs +44 -0
  537. package/dist/data/use-semantic-query.cjs.map +1 -0
  538. package/dist/data/use-semantic-query.d.ts +92 -0
  539. package/dist/data/use-semantic-query.js +44 -0
  540. package/dist/data/use-semantic-query.js.map +1 -0
  541. package/dist/diagnostics/athena-diagnostics.cjs.map +1 -1
  542. package/dist/diagnostics/athena-diagnostics.d.ts +5 -1
  543. package/dist/diagnostics/athena-diagnostics.js.map +1 -1
  544. package/dist/diagnostics/errors.cjs +7 -0
  545. package/dist/diagnostics/errors.cjs.map +1 -1
  546. package/dist/diagnostics/errors.d.ts +7 -0
  547. package/dist/diagnostics/errors.js +7 -0
  548. package/dist/diagnostics/errors.js.map +1 -1
  549. package/dist/index.cjs +155 -11
  550. package/dist/index.cjs.map +1 -1
  551. package/dist/index.d.ts +72 -13
  552. package/dist/index.js +148 -4
  553. package/dist/index.js.map +1 -1
  554. package/dist/keryx-http/src/initial-sync.cjs +64 -16
  555. package/dist/keryx-http/src/initial-sync.cjs.map +1 -1
  556. package/dist/keryx-http/src/initial-sync.d.ts +31 -1
  557. package/dist/keryx-http/src/initial-sync.js +64 -16
  558. package/dist/keryx-http/src/initial-sync.js.map +1 -1
  559. package/dist/keryx-http/src/own-awareness.cjs +20 -0
  560. package/dist/keryx-http/src/own-awareness.cjs.map +1 -0
  561. package/dist/keryx-http/src/own-awareness.d.ts +50 -0
  562. package/dist/keryx-http/src/own-awareness.js +20 -0
  563. package/dist/keryx-http/src/own-awareness.js.map +1 -0
  564. package/dist/keryx-http/src/update-attributions.cjs +26 -1
  565. package/dist/keryx-http/src/update-attributions.cjs.map +1 -1
  566. package/dist/keryx-http/src/update-attributions.d.ts +10 -1
  567. package/dist/keryx-http/src/update-attributions.js +26 -1
  568. package/dist/keryx-http/src/update-attributions.js.map +1 -1
  569. package/dist/offline/chat-outbox.cjs +262 -26
  570. package/dist/offline/chat-outbox.cjs.map +1 -1
  571. package/dist/offline/chat-outbox.d.ts +90 -12
  572. package/dist/offline/chat-outbox.js +263 -27
  573. package/dist/offline/chat-outbox.js.map +1 -1
  574. package/dist/provider/AthenaProvider.cjs +60 -22
  575. package/dist/provider/AthenaProvider.cjs.map +1 -1
  576. package/dist/provider/AthenaProvider.d.ts +24 -8
  577. package/dist/provider/AthenaProvider.js +61 -23
  578. package/dist/provider/AthenaProvider.js.map +1 -1
  579. package/dist/react/package.json.cjs +1 -1
  580. package/dist/react/package.json.js +1 -1
  581. package/dist/references/src/anchors/parse.cjs +11 -1
  582. package/dist/references/src/anchors/parse.cjs.map +1 -1
  583. package/dist/references/src/anchors/parse.js +11 -1
  584. package/dist/references/src/anchors/parse.js.map +1 -1
  585. package/dist/references/src/anchors/schemas.d.ts +1 -0
  586. package/dist/references/src/anchors/serialize.cjs +1 -0
  587. package/dist/references/src/anchors/serialize.cjs.map +1 -1
  588. package/dist/references/src/anchors/serialize.js +1 -0
  589. package/dist/references/src/anchors/serialize.js.map +1 -1
  590. package/dist/references/src/anchors/types.cjs +5 -0
  591. package/dist/references/src/anchors/types.cjs.map +1 -1
  592. package/dist/references/src/anchors/types.d.ts +9 -0
  593. package/dist/references/src/anchors/types.js +5 -0
  594. package/dist/references/src/anchors/types.js.map +1 -1
  595. package/dist/references/src/attachable.cjs +149 -0
  596. package/dist/references/src/attachable.cjs.map +1 -0
  597. package/dist/references/src/attachable.d.ts +87 -0
  598. package/dist/references/src/attachable.js +149 -0
  599. package/dist/references/src/attachable.js.map +1 -0
  600. package/dist/references/src/schemas.d.ts +2 -0
  601. package/dist/runtime/StatewirePlanModeLaneSync.cjs +93 -0
  602. package/dist/runtime/StatewirePlanModeLaneSync.cjs.map +1 -0
  603. package/dist/runtime/StatewirePlanModeLaneSync.d.ts +34 -0
  604. package/dist/runtime/StatewirePlanModeLaneSync.js +93 -0
  605. package/dist/runtime/StatewirePlanModeLaneSync.js.map +1 -0
  606. package/dist/runtime/StatewireThreadConfigLaneSync.cjs +2 -0
  607. package/dist/runtime/StatewireThreadConfigLaneSync.cjs.map +1 -1
  608. package/dist/runtime/StatewireThreadConfigLaneSync.d.ts +4 -0
  609. package/dist/runtime/StatewireThreadConfigLaneSync.js +2 -0
  610. package/dist/runtime/StatewireThreadConfigLaneSync.js.map +1 -1
  611. package/dist/runtime/statewire-plan-mode.cjs +71 -0
  612. package/dist/runtime/statewire-plan-mode.cjs.map +1 -0
  613. package/dist/runtime/statewire-plan-mode.d.ts +88 -0
  614. package/dist/runtime/statewire-plan-mode.js +71 -0
  615. package/dist/runtime/statewire-plan-mode.js.map +1 -0
  616. package/dist/runtime/statewire-run-config.cjs +3 -1
  617. package/dist/runtime/statewire-run-config.cjs.map +1 -1
  618. package/dist/runtime/statewire-run-config.d.ts +7 -0
  619. package/dist/runtime/statewire-run-config.js +3 -1
  620. package/dist/runtime/statewire-run-config.js.map +1 -1
  621. package/dist/runtime/statewire-session-key.cjs +11 -5
  622. package/dist/runtime/statewire-session-key.cjs.map +1 -1
  623. package/dist/runtime/statewire-session-key.d.ts +22 -10
  624. package/dist/runtime/statewire-session-key.js +11 -5
  625. package/dist/runtime/statewire-session-key.js.map +1 -1
  626. package/dist/runtime/useAthenaStatewireRuntime.cjs +64 -9
  627. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
  628. package/dist/runtime/useAthenaStatewireRuntime.d.ts +26 -10
  629. package/dist/runtime/useAthenaStatewireRuntime.js +66 -11
  630. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
  631. package/dist/search/useAthenaAssets.cjs +394 -0
  632. package/dist/search/useAthenaAssets.cjs.map +1 -0
  633. package/dist/search/useAthenaAssets.d.ts +186 -0
  634. package/dist/search/useAthenaAssets.js +394 -0
  635. package/dist/search/useAthenaAssets.js.map +1 -0
  636. package/dist/sheet-range/index.cjs +4 -0
  637. package/dist/sheet-range/index.cjs.map +1 -1
  638. package/dist/sheet-range/index.d.ts +4 -2
  639. package/dist/sheet-range/index.js +4 -0
  640. package/dist/sheet-range/index.js.map +1 -1
  641. package/dist/sheet-range/query-range.cjs +102 -0
  642. package/dist/sheet-range/query-range.cjs.map +1 -0
  643. package/dist/sheet-range/query-range.d.ts +46 -0
  644. package/dist/sheet-range/query-range.js +102 -0
  645. package/dist/sheet-range/query-range.js.map +1 -0
  646. package/dist/styles.css +1 -1
  647. package/dist/subagents/index.cjs +49 -0
  648. package/dist/subagents/index.cjs.map +1 -0
  649. package/dist/subagents/index.d.ts +16 -0
  650. package/dist/subagents/index.js +49 -0
  651. package/dist/subagents/index.js.map +1 -0
  652. package/dist/subagents/lane-follow.cjs +19 -0
  653. package/dist/subagents/lane-follow.cjs.map +1 -0
  654. package/dist/subagents/lane-follow.d.ts +9 -0
  655. package/dist/subagents/lane-follow.js +19 -0
  656. package/dist/subagents/lane-follow.js.map +1 -0
  657. package/dist/subagents/lane-model.cjs +178 -0
  658. package/dist/subagents/lane-model.cjs.map +1 -0
  659. package/dist/subagents/lane-model.d.ts +140 -0
  660. package/dist/subagents/lane-model.js +178 -0
  661. package/dist/subagents/lane-model.js.map +1 -0
  662. package/dist/subagents/lane-parts.cjs +517 -0
  663. package/dist/subagents/lane-parts.cjs.map +1 -0
  664. package/dist/subagents/lane-parts.d.ts +130 -0
  665. package/dist/subagents/lane-parts.js +517 -0
  666. package/dist/subagents/lane-parts.js.map +1 -0
  667. package/dist/subagents/subagent-lane-group.cjs +215 -0
  668. package/dist/subagents/subagent-lane-group.cjs.map +1 -0
  669. package/dist/subagents/subagent-lane-group.d.ts +67 -0
  670. package/dist/subagents/subagent-lane-group.js +215 -0
  671. package/dist/subagents/subagent-lane-group.js.map +1 -0
  672. package/dist/subagents/subagent-transcript-drawer.cjs +431 -0
  673. package/dist/subagents/subagent-transcript-drawer.cjs.map +1 -0
  674. package/dist/subagents/subagent-transcript-drawer.d.ts +78 -0
  675. package/dist/subagents/subagent-transcript-drawer.js +431 -0
  676. package/dist/subagents/subagent-transcript-drawer.js.map +1 -0
  677. package/dist/subagents/task-subagent-group.cjs +115 -0
  678. package/dist/subagents/task-subagent-group.cjs.map +1 -0
  679. package/dist/subagents/task-subagent-group.d.ts +36 -0
  680. package/dist/subagents/task-subagent-group.js +115 -0
  681. package/dist/subagents/task-subagent-group.js.map +1 -0
  682. package/dist/subagents/use-omitted-images-in-view.cjs +68 -0
  683. package/dist/subagents/use-omitted-images-in-view.cjs.map +1 -0
  684. package/dist/subagents/use-omitted-images-in-view.d.ts +21 -0
  685. package/dist/subagents/use-omitted-images-in-view.js +68 -0
  686. package/dist/subagents/use-omitted-images-in-view.js.map +1 -0
  687. package/dist/threads/Inbox.cjs +2 -2
  688. package/dist/threads/Inbox.cjs.map +1 -1
  689. package/dist/threads/SessionList.cjs +6 -6
  690. package/dist/threads/SessionList.cjs.map +1 -1
  691. package/dist/threads/SessionsPage.cjs +13 -7
  692. package/dist/threads/SessionsPage.cjs.map +1 -1
  693. package/dist/threads/SessionsPage.d.ts +10 -1
  694. package/dist/threads/SessionsPage.js +9 -3
  695. package/dist/threads/SessionsPage.js.map +1 -1
  696. package/dist/threads/session-list-model.cjs.map +1 -1
  697. package/dist/threads/session-list-model.d.ts +2 -1
  698. package/dist/threads/session-list-model.js.map +1 -1
  699. package/dist/threads/session-row-parts.cjs +3 -3
  700. package/dist/threads/session-row-parts.cjs.map +1 -1
  701. package/dist/threads/sessions-page-model.cjs +13 -5
  702. package/dist/threads/sessions-page-model.cjs.map +1 -1
  703. package/dist/threads/sessions-page-model.d.ts +7 -0
  704. package/dist/threads/sessions-page-model.js +11 -3
  705. package/dist/threads/sessions-page-model.js.map +1 -1
  706. package/dist/threads/sessions-page-storage.cjs +8 -8
  707. package/dist/threads/sessions-page-storage.cjs.map +1 -1
  708. package/dist/threads/sessions-page-storage.d.ts +5 -1
  709. package/dist/threads/sessions-page-storage.js +8 -8
  710. package/dist/threads/sessions-page-storage.js.map +1 -1
  711. package/dist/threads/statewire-thread-list.cjs +14 -2
  712. package/dist/threads/statewire-thread-list.cjs.map +1 -1
  713. package/dist/threads/statewire-thread-list.d.ts +11 -2
  714. package/dist/threads/statewire-thread-list.js +14 -2
  715. package/dist/threads/statewire-thread-list.js.map +1 -1
  716. package/dist/threads/use-athena-sessions.cjs +1 -0
  717. package/dist/threads/use-athena-sessions.cjs.map +1 -1
  718. package/dist/threads/use-athena-sessions.d.ts +7 -0
  719. package/dist/threads/use-athena-sessions.js +1 -0
  720. package/dist/threads/use-athena-sessions.js.map +1 -1
  721. package/dist/threads/use-athena-thread-agent.cjs +31 -0
  722. package/dist/threads/use-athena-thread-agent.cjs.map +1 -0
  723. package/dist/threads/use-athena-thread-agent.d.ts +38 -0
  724. package/dist/threads/use-athena-thread-agent.js +31 -0
  725. package/dist/threads/use-athena-thread-agent.js.map +1 -0
  726. package/dist/threads/use-athena-thread-plan-mode.cjs +18 -0
  727. package/dist/threads/use-athena-thread-plan-mode.cjs.map +1 -0
  728. package/dist/threads/use-athena-thread-plan-mode.d.ts +18 -0
  729. package/dist/threads/use-athena-thread-plan-mode.js +18 -0
  730. package/dist/threads/use-athena-thread-plan-mode.js.map +1 -0
  731. package/dist/threads/use-rest-conversation-history.d.ts +1 -0
  732. package/dist/tools/agent-creations.cjs +97 -0
  733. package/dist/tools/agent-creations.cjs.map +1 -0
  734. package/dist/tools/agent-creations.d.ts +38 -0
  735. package/dist/tools/agent-creations.js +97 -0
  736. package/dist/tools/agent-creations.js.map +1 -0
  737. package/dist/tools/agent-highlights.cjs +100 -0
  738. package/dist/tools/agent-highlights.cjs.map +1 -0
  739. package/dist/tools/agent-highlights.d.ts +57 -0
  740. package/dist/tools/agent-highlights.js +100 -0
  741. package/dist/tools/agent-highlights.js.map +1 -0
  742. package/dist/tools/append-document-tool-ui.cjs +1 -0
  743. package/dist/tools/append-document-tool-ui.cjs.map +1 -1
  744. package/dist/tools/append-document-tool-ui.d.ts +7 -0
  745. package/dist/tools/append-document-tool-ui.js +2 -1
  746. package/dist/tools/append-document-tool-ui.js.map +1 -1
  747. package/dist/tools/auto-open-tools.cjs +144 -71
  748. package/dist/tools/auto-open-tools.cjs.map +1 -1
  749. package/dist/tools/auto-open-tools.d.ts +131 -1
  750. package/dist/tools/auto-open-tools.js +145 -72
  751. package/dist/tools/auto-open-tools.js.map +1 -1
  752. package/dist/tools/browser-tool-uis.cjs +594 -0
  753. package/dist/tools/browser-tool-uis.cjs.map +1 -0
  754. package/dist/tools/browser-tool-uis.d.ts +8 -0
  755. package/dist/tools/browser-tool-uis.js +594 -0
  756. package/dist/tools/browser-tool-uis.js.map +1 -0
  757. package/dist/tools/computer-asset-tool-uis.cjs +313 -0
  758. package/dist/tools/computer-asset-tool-uis.cjs.map +1 -0
  759. package/dist/tools/computer-asset-tool-uis.d.ts +5 -0
  760. package/dist/tools/computer-asset-tool-uis.js +313 -0
  761. package/dist/tools/computer-asset-tool-uis.js.map +1 -0
  762. package/dist/tools/document-edit-tool-uis.cjs +218 -0
  763. package/dist/tools/document-edit-tool-uis.cjs.map +1 -0
  764. package/dist/tools/document-edit-tool-uis.d.ts +40 -0
  765. package/dist/tools/document-edit-tool-uis.js +218 -0
  766. package/dist/tools/document-edit-tool-uis.js.map +1 -0
  767. package/dist/tools/drive-tool-uis.cjs +429 -0
  768. package/dist/tools/drive-tool-uis.cjs.map +1 -0
  769. package/dist/tools/drive-tool-uis.d.ts +121 -0
  770. package/dist/tools/drive-tool-uis.js +429 -0
  771. package/dist/tools/drive-tool-uis.js.map +1 -0
  772. package/dist/tools/email-calendar-tool-uis.cjs +789 -0
  773. package/dist/tools/email-calendar-tool-uis.cjs.map +1 -0
  774. package/dist/tools/email-calendar-tool-uis.d.ts +129 -0
  775. package/dist/tools/email-calendar-tool-uis.js +789 -0
  776. package/dist/tools/email-calendar-tool-uis.js.map +1 -0
  777. package/dist/tools/ontology-tool-uis.cjs +83 -0
  778. package/dist/tools/ontology-tool-uis.cjs.map +1 -0
  779. package/dist/tools/ontology-tool-uis.d.ts +9 -0
  780. package/dist/tools/ontology-tool-uis.js +83 -0
  781. package/dist/tools/ontology-tool-uis.js.map +1 -0
  782. package/dist/tools/orchestration-tool-uis.cjs +586 -0
  783. package/dist/tools/orchestration-tool-uis.cjs.map +1 -0
  784. package/dist/tools/orchestration-tool-uis.d.ts +141 -0
  785. package/dist/tools/orchestration-tool-uis.js +586 -0
  786. package/dist/tools/orchestration-tool-uis.js.map +1 -0
  787. package/dist/tools/presentation-edit-tool-uis.cjs +516 -0
  788. package/dist/tools/presentation-edit-tool-uis.cjs.map +1 -0
  789. package/dist/tools/presentation-edit-tool-uis.d.ts +73 -0
  790. package/dist/tools/presentation-edit-tool-uis.js +516 -0
  791. package/dist/tools/presentation-edit-tool-uis.js.map +1 -0
  792. package/dist/tools/project-tool-uis.cjs +213 -0
  793. package/dist/tools/project-tool-uis.cjs.map +1 -0
  794. package/dist/tools/project-tool-uis.d.ts +14 -0
  795. package/dist/tools/project-tool-uis.js +213 -0
  796. package/dist/tools/project-tool-uis.js.map +1 -0
  797. package/dist/tools/sandbox-tool-uis.cjs +491 -0
  798. package/dist/tools/sandbox-tool-uis.cjs.map +1 -0
  799. package/dist/tools/sandbox-tool-uis.d.ts +116 -0
  800. package/dist/tools/sandbox-tool-uis.js +491 -0
  801. package/dist/tools/sandbox-tool-uis.js.map +1 -0
  802. package/dist/tools/sheet-query-tool-ui.cjs +138 -0
  803. package/dist/tools/sheet-query-tool-ui.cjs.map +1 -0
  804. package/dist/tools/sheet-query-tool-ui.d.ts +15 -0
  805. package/dist/tools/sheet-query-tool-ui.js +138 -0
  806. package/dist/tools/sheet-query-tool-ui.js.map +1 -0
  807. package/dist/tools/studio-screenshot-tool-uis.cjs +262 -0
  808. package/dist/tools/studio-screenshot-tool-uis.cjs.map +1 -0
  809. package/dist/tools/studio-screenshot-tool-uis.d.ts +52 -0
  810. package/dist/tools/studio-screenshot-tool-uis.js +262 -0
  811. package/dist/tools/studio-screenshot-tool-uis.js.map +1 -0
  812. package/dist/tools/subagent-task-tool-ui.cjs +24 -475
  813. package/dist/tools/subagent-task-tool-ui.cjs.map +1 -1
  814. package/dist/tools/subagent-task-tool-ui.d.ts +19 -103
  815. package/dist/tools/subagent-task-tool-ui.js +28 -479
  816. package/dist/tools/subagent-task-tool-ui.js.map +1 -1
  817. package/dist/tools/tool-summary.cjs +36 -0
  818. package/dist/tools/tool-summary.cjs.map +1 -1
  819. package/dist/tools/tool-summary.js +36 -0
  820. package/dist/tools/tool-summary.js.map +1 -1
  821. package/dist/tools/tool-uis.cjs +181 -53
  822. package/dist/tools/tool-uis.cjs.map +1 -1
  823. package/dist/tools/tool-uis.d.ts +40 -0
  824. package/dist/tools/tool-uis.js +183 -55
  825. package/dist/tools/tool-uis.js.map +1 -1
  826. package/dist/typed-interrupts/index.cjs +15 -0
  827. package/dist/typed-interrupts/index.cjs.map +1 -0
  828. package/dist/typed-interrupts/index.d.ts +20 -0
  829. package/dist/typed-interrupts/index.js +15 -0
  830. package/dist/typed-interrupts/index.js.map +1 -0
  831. package/dist/version.cjs +4 -0
  832. package/dist/version.cjs.map +1 -1
  833. package/dist/version.d.ts +9 -0
  834. package/dist/version.js +4 -0
  835. package/dist/version.js.map +1 -1
  836. package/dist/workbench/live-desktop-api.cjs +2 -1
  837. package/dist/workbench/live-desktop-api.cjs.map +1 -1
  838. package/dist/workbench/live-desktop-api.js +2 -1
  839. package/dist/workbench/live-desktop-api.js.map +1 -1
  840. package/dist/workbench/session-workbench-panes.cjs +6 -6
  841. package/dist/workbench/session-workbench-panes.cjs.map +1 -1
  842. package/dist/workbench/session-workspace-api.cjs +7 -2
  843. package/dist/workbench/session-workspace-api.cjs.map +1 -1
  844. package/dist/workbench/session-workspace-api.d.ts +10 -0
  845. package/dist/workbench/session-workspace-api.js +7 -2
  846. package/dist/workbench/session-workspace-api.js.map +1 -1
  847. package/package.json +28 -6
  848. package/dist/agent-runtime/src/chat-outbox-store.cjs +0 -510
  849. package/dist/agent-runtime/src/chat-outbox-store.cjs.map +0 -1
  850. package/dist/agent-runtime/src/chat-outbox-store.d.ts +0 -210
  851. package/dist/agent-runtime/src/chat-outbox-store.js +0 -510
  852. package/dist/agent-runtime/src/chat-outbox-store.js.map +0 -1
@@ -0,0 +1,262 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const reactQuery = require("@tanstack/react-query");
5
+ const lucideReact = require("lucide-react");
6
+ const require$$0 = require("react");
7
+ const assetPanelStore = require("../assets/asset-panel-store.cjs");
8
+ const useAthenaRestQuery = require("../lib/use-athena-rest-query.cjs");
9
+ const AthenaContext = require("../provider/AthenaContext.cjs");
10
+ const credentialRenewal = require("../runtime/credential-renewal.cjs");
11
+ const primitives = require("./primitives.cjs");
12
+ function record(value) {
13
+ return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
14
+ }
15
+ function parseResultString(result) {
16
+ try {
17
+ const parsed = JSON.parse(result);
18
+ return typeof parsed === "string" ? [] : [parsed];
19
+ } catch {
20
+ }
21
+ const items = [];
22
+ for (const line of result.split("\n")) {
23
+ const trimmed = line.trim();
24
+ if (!trimmed) continue;
25
+ try {
26
+ const parsed = JSON.parse(trimmed);
27
+ if (typeof parsed !== "string") items.push(parsed);
28
+ } catch {
29
+ }
30
+ }
31
+ return items;
32
+ }
33
+ function resultObjects(value) {
34
+ const found = [];
35
+ const stack = [value];
36
+ let budget = 2e3;
37
+ while (stack.length > 0 && budget > 0) {
38
+ budget -= 1;
39
+ const item = stack.pop();
40
+ if (typeof item === "string") {
41
+ stack.push(...parseResultString(item));
42
+ continue;
43
+ }
44
+ if (Array.isArray(item)) {
45
+ for (let index = item.length - 1; index >= 0; index -= 1) stack.push(item[index]);
46
+ continue;
47
+ }
48
+ const fields = record(item);
49
+ if (!fields) continue;
50
+ found.push(fields);
51
+ for (const nested of Object.values(fields)) {
52
+ if (nested && typeof nested === "object") stack.push(nested);
53
+ else if (typeof nested === "string" && (nested.startsWith("{") || nested.startsWith("["))) stack.push(nested);
54
+ }
55
+ }
56
+ return found;
57
+ }
58
+ function readStudioScreenshot(...sources) {
59
+ const shot = {
60
+ presignedUrl: null,
61
+ s3Key: null,
62
+ text: null,
63
+ sheetId: null,
64
+ sheetName: null,
65
+ range: null,
66
+ pageCount: null,
67
+ savedAssetId: null
68
+ };
69
+ for (const source of sources) {
70
+ for (const fields of resultObjects(source)) {
71
+ const imageSource = fields.type === "image" ? record(fields.source) : void 0;
72
+ if (imageSource) {
73
+ if (shot.presignedUrl === null && typeof imageSource.presigned_url === "string") {
74
+ shot.presignedUrl = imageSource.presigned_url;
75
+ }
76
+ if (shot.s3Key === null && imageSource.type === "s3_key" && typeof imageSource.data === "string") {
77
+ shot.s3Key = imageSource.data;
78
+ }
79
+ }
80
+ if (shot.presignedUrl === null && typeof fields.presigned_url === "string") shot.presignedUrl = fields.presigned_url;
81
+ if (shot.text === null && fields.type === "text" && typeof fields.text === "string") shot.text = fields.text;
82
+ if (shot.sheetId === null && typeof fields.sheet_id === "number") shot.sheetId = fields.sheet_id;
83
+ if (shot.sheetName === null && typeof fields.sheet_name === "string") shot.sheetName = fields.sheet_name;
84
+ if (shot.range === null && typeof fields.range === "string") shot.range = fields.range;
85
+ if (shot.pageCount === null && typeof fields.page_count === "number") shot.pageCount = fields.page_count;
86
+ if (shot.savedAssetId === null && typeof fields.saved_asset_id === "string" && fields.saved_asset_id !== "") {
87
+ shot.savedAssetId = fields.saved_asset_id;
88
+ }
89
+ }
90
+ }
91
+ return shot;
92
+ }
93
+ const FRESH_URL_STALE_MS = 10 * 60 * 1e3;
94
+ function useFreshPresignedUrlQuery({
95
+ s3Key,
96
+ fallbackUrl
97
+ }) {
98
+ const config = require$$0.useContext(AthenaContext.AthenaContext);
99
+ const baseUrl = config ? config.backendUrl.replace(/\/api\/assistant-ui\/?$/, "") : null;
100
+ const identity = useAthenaRestQuery.useAthenaQueryIdentity({
101
+ apiKey: config == null ? void 0 : config.apiKey,
102
+ token: config == null ? void 0 : config.token,
103
+ getToken: config == null ? void 0 : config.getToken
104
+ });
105
+ const reader = require$$0.useId();
106
+ const query = reactQuery.useQuery({
107
+ queryKey: ["athena", "screenshot-presigned-url", baseUrl, ...identity, s3Key, reader],
108
+ enabled: s3Key !== null && config !== null,
109
+ staleTime: FRESH_URL_STALE_MS,
110
+ gcTime: 0,
111
+ refetchOnWindowFocus: false,
112
+ retry: false,
113
+ queryFn: async ({ signal }) => {
114
+ if (!config || baseUrl === null) return null;
115
+ const response = await credentialRenewal.sendWithCredentialRenewal(
116
+ config,
117
+ (headers) => fetch(`${baseUrl}/api/asset/screenshot-presigned-url`, {
118
+ method: "POST",
119
+ headers: { "Content-Type": "application/json", ...headers },
120
+ body: JSON.stringify({ screenshot_key: s3Key }),
121
+ signal
122
+ })
123
+ );
124
+ if (!response.ok) return null;
125
+ const data = await response.json();
126
+ return typeof data.presigned_url === "string" ? data.presigned_url : null;
127
+ }
128
+ });
129
+ return query.data ?? fallbackUrl;
130
+ }
131
+ function useScreenshotUrl({
132
+ s3Key,
133
+ fallbackUrl
134
+ }) {
135
+ return useFreshPresignedUrlQuery({ s3Key, fallbackUrl });
136
+ }
137
+ function ScreenshotQueryScope({ children }) {
138
+ const queryClient = useAthenaRestQuery.useAthenaQueryClient();
139
+ return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children });
140
+ }
141
+ function createStudioScreenshotToolUI(spec) {
142
+ const Card = ({ toolName, args, result, artifact, status }) => {
143
+ var _a;
144
+ const typedArgs = args;
145
+ const shot = require$$0.useMemo(() => readStudioScreenshot(result, artifact), [result, artifact]);
146
+ const imageUrl = useScreenshotUrl({ s3Key: shot.s3Key, fallbackUrl: shot.presignedUrl });
147
+ const openAsset = assetPanelStore.useAssetPanelStore((s) => s.openAsset);
148
+ const assetId = typeof (typedArgs == null ? void 0 : typedArgs.asset_id) === "string" && typedArgs.asset_id !== "" ? typedArgs.asset_id : null;
149
+ const label = spec.label({ args: typedArgs, shot });
150
+ const detail = ((_a = spec.detail) == null ? void 0 : _a.call(spec, { args: typedArgs, shot })) ?? "";
151
+ const isRunning = (status == null ? void 0 : status.type) === "running";
152
+ const isComplete = (status == null ? void 0 : status.type) === "complete" || !status;
153
+ const hasScreenshot = isComplete && (shot.presignedUrl !== null || shot.s3Key !== null);
154
+ const failed = isComplete && !hasScreenshot;
155
+ const errorMsg = (status == null ? void 0 : status.type) === "incomplete" ? String(status.error ?? status.reason ?? "Capture failed") : null;
156
+ const title = isRunning ? `Capturing screenshot of ${label}...` : failed || errorMsg ? `Failed to capture screenshot of ${label}` : `Screenshot captured for ${label}${detail ? ` ${detail}` : ""}`;
157
+ const open = assetId ? spec.open({ args: typedArgs, shot }) : null;
158
+ return /* @__PURE__ */ jsxRuntime.jsxs(
159
+ primitives.ToolCard,
160
+ {
161
+ icon: spec.icon,
162
+ status: failed ? "incomplete" : (status == null ? void 0 : status.type) ?? "complete",
163
+ title: primitives.truncate(title, 90),
164
+ toolName,
165
+ args: typedArgs,
166
+ result,
167
+ error: errorMsg ?? (failed ? spec.failureNote : null),
168
+ children: [
169
+ hasScreenshot && imageUrl ? /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "studio-screenshot", className: "border-t border-border/40 p-3", children: [
170
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-lg border border-border/50 bg-muted/20", children: /* @__PURE__ */ jsxRuntime.jsx(
171
+ "img",
172
+ {
173
+ src: imageUrl,
174
+ alt: `Screenshot of ${label}`,
175
+ className: spec.imageClassName,
176
+ loading: "lazy"
177
+ }
178
+ ) }),
179
+ shot.savedAssetId ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-2 flex items-center gap-2 text-[11px] text-muted-foreground", children: [
180
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Saved as asset:" }),
181
+ /* @__PURE__ */ jsxRuntime.jsx(
182
+ "button",
183
+ {
184
+ type: "button",
185
+ onClick: () => openAsset(shot.savedAssetId),
186
+ className: "rounded font-mono text-foreground/80 hover:underline",
187
+ children: primitives.truncate(shot.savedAssetId, 28)
188
+ }
189
+ )
190
+ ] }) : null
191
+ ] }) : null,
192
+ hasScreenshot && open && assetId ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2 border-t border-border/40 px-4 py-2", children: /* @__PURE__ */ jsxRuntime.jsxs(
193
+ "button",
194
+ {
195
+ type: "button",
196
+ onClick: () => openAsset(assetId, open.options),
197
+ className: "flex items-center gap-1.5 rounded-md border border-border/60 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",
198
+ children: [
199
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ExternalLinkIcon, { className: "size-3" }),
200
+ open.label
201
+ ]
202
+ }
203
+ ) }) : null
204
+ ]
205
+ }
206
+ );
207
+ };
208
+ const Scoped = (props) => /* @__PURE__ */ jsxRuntime.jsx(ScreenshotQueryScope, { children: /* @__PURE__ */ jsxRuntime.jsx(Card, { ...props }) });
209
+ return Scoped;
210
+ }
211
+ function sheetLabel({ args, shot }) {
212
+ const name = shot.sheetName ?? (typeof (args == null ? void 0 : args.sheet_name) === "string" ? args.sheet_name : null);
213
+ const id = shot.sheetId ?? (typeof (args == null ? void 0 : args.sheet_id) === "number" ? args.sheet_id : null);
214
+ if (name) return `"${name}"`;
215
+ if (id !== null) return `sheet ${id}`;
216
+ return "active sheet";
217
+ }
218
+ function sheetRange({ args, shot }) {
219
+ return shot.range ?? (typeof (args == null ? void 0 : args.cell_range) === "string" ? args.cell_range : null);
220
+ }
221
+ const CaptureSheetScreenshotToolUIImpl = createStudioScreenshotToolUI({
222
+ icon: lucideReact.CameraIcon,
223
+ label: sheetLabel,
224
+ detail: (params) => {
225
+ const range = sheetRange(params);
226
+ return range ? `(${range})` : "";
227
+ },
228
+ imageClassName: "w-full object-contain",
229
+ failureNote: "The screenshot could not be captured. Check that the workbook exists and the sheet or range is valid.",
230
+ open: (params) => {
231
+ const range = sheetRange(params);
232
+ return {
233
+ label: range ? `Open ${range}` : "Open spreadsheet",
234
+ options: { type: "spreadsheet" }
235
+ };
236
+ }
237
+ });
238
+ const CaptureSheetScreenshotToolUI = require$$0.memo(
239
+ CaptureSheetScreenshotToolUIImpl
240
+ );
241
+ CaptureSheetScreenshotToolUI.displayName = "CaptureSheetScreenshotToolUI";
242
+ const PAGE_IMAGE_CLASS = "aspect-[8.5/11] w-full object-contain";
243
+ const CapturePageScreenshotToolUIImpl = createStudioScreenshotToolUI({
244
+ icon: lucideReact.FileTextIcon,
245
+ label: ({ args, shot }) => {
246
+ const page = typeof (args == null ? void 0 : args.page_number) === "number" ? args.page_number : 1;
247
+ return shot.pageCount !== null ? `page ${page} of ${shot.pageCount}` : `page ${page}`;
248
+ },
249
+ imageClassName: PAGE_IMAGE_CLASS,
250
+ failureNote: "The screenshot could not be captured. Check that the document exists and the page number is within range.",
251
+ open: () => ({ label: "Open document", options: { type: "document" } })
252
+ });
253
+ const CapturePageScreenshotToolUI = require$$0.memo(
254
+ CapturePageScreenshotToolUIImpl
255
+ );
256
+ CapturePageScreenshotToolUI.displayName = "CapturePageScreenshotToolUI";
257
+ exports.CapturePageScreenshotToolUI = CapturePageScreenshotToolUI;
258
+ exports.CaptureSheetScreenshotToolUI = CaptureSheetScreenshotToolUI;
259
+ exports.ScreenshotQueryScope = ScreenshotQueryScope;
260
+ exports.readStudioScreenshot = readStudioScreenshot;
261
+ exports.useScreenshotUrl = useScreenshotUrl;
262
+ //# sourceMappingURL=studio-screenshot-tool-uis.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"studio-screenshot-tool-uis.cjs","sources":["../../src/tools/studio-screenshot-tool-uis.tsx"],"sourcesContent":["\"use client\";\n\n/**\n * Screenshots the studio tools take of what they edit, as Athena on the web\n * shows them: a workbook's sheet (`capture_sheet_screenshot`) and a Word\n * document's page (`capture_page_screenshot`), each with what was captured\n * (\"Screenshot captured for \"Q1 Plan\" (A1:F40)\"), the picture, the asset it\n * was saved as, and a button that opens the asset.\n *\n * A screenshot's result carries a presigned URL that expires and the image's\n * storage key, which does not. The picture is shown from a fresh URL agora\n * signs for that key (`POST /api/asset/screenshot-presigned-url`, which signs\n * only objects it resolves and the caller may read), read once per key with\n * TanStack Query, and from the result's own URL meanwhile or when that read\n * fails, so a session reopened later still shows its screenshots. A card\n * rendered outside `AthenaProvider` has no backend to ask and shows the\n * result's own URL.\n */\nimport type { ToolCallMessagePartComponent } from \"@assistant-ui/react\";\nimport { QueryClientProvider, useQuery } from \"@tanstack/react-query\";\nimport { CameraIcon, ExternalLinkIcon, FileTextIcon } from \"lucide-react\";\nimport { type ReactNode, memo, useContext, useId, useMemo } from \"react\";\nimport { type AssetPanelState, useAssetPanelStore } from \"../assets/asset-panel-store\";\nimport { useAthenaQueryClient, useAthenaQueryIdentity } from \"../lib/use-athena-rest-query\";\nimport { AthenaContext } from \"../provider/AthenaContext\";\nimport { sendWithCredentialRenewal } from \"../runtime/credential-renewal\";\nimport { ToolCard, type ToolStatus, truncate } from \"./primitives\";\n\n// ─── Reading a screenshot result ─────────────────────────────────────\n\nfunction record(value: unknown): Record<string, unknown> | undefined {\n return value && typeof value === \"object\" && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined;\n}\n\n/**\n * A result string's content items: one JSON value, or the backend's\n * newline-delimited serialization of a multi-block list (an image block and a\n * note, `{…}\\n{…}`), which a plain `JSON.parse` rejects. A bare string carries\n * no image source.\n */\nfunction parseResultString(result: string): unknown[] {\n try {\n const parsed: unknown = JSON.parse(result);\n return typeof parsed === \"string\" ? [] : [parsed];\n } catch {\n // Newline-delimited below.\n }\n const items: unknown[] = [];\n for (const line of result.split(\"\\n\")) {\n const trimmed = line.trim();\n if (!trimmed) continue;\n try {\n const parsed: unknown = JSON.parse(trimmed);\n if (typeof parsed !== \"string\") items.push(parsed);\n } catch {\n // A plain-text line holds nothing to read.\n }\n }\n return items;\n}\n\n/** Every object a result holds, depth first, through JSON strings and `result` wrappers. */\nfunction resultObjects(value: unknown): Record<string, unknown>[] {\n const found: Record<string, unknown>[] = [];\n const stack: unknown[] = [value];\n let budget = 2_000;\n while (stack.length > 0 && budget > 0) {\n budget -= 1;\n const item = stack.pop();\n if (typeof item === \"string\") {\n stack.push(...parseResultString(item));\n continue;\n }\n if (Array.isArray(item)) {\n for (let index = item.length - 1; index >= 0; index -= 1) stack.push(item[index]);\n continue;\n }\n const fields = record(item);\n if (!fields) continue;\n found.push(fields);\n for (const nested of Object.values(fields)) {\n if (nested && typeof nested === \"object\") stack.push(nested);\n else if (typeof nested === \"string\" && (nested.startsWith(\"{\") || nested.startsWith(\"[\"))) stack.push(nested);\n }\n }\n return found;\n}\n\n/** What a screenshot result says about its picture and what it captured. */\nexport interface StudioScreenshot {\n /** The result's own presigned URL, which expires. */\n presignedUrl: string | null;\n /** The image's storage key (`source.data` of an `s3_key` image source), which does not. */\n s3Key: string | null;\n /** The note the tool returned beside the picture. */\n text: string | null;\n sheetId: number | null;\n sheetName: string | null;\n range: string | null;\n pageCount: number | null;\n /** The asset the screenshot was saved as (`save_as_asset`). */\n savedAssetId: string | null;\n}\n\n/** Reads a screenshot tool's result (and artifact): the first value of each field found. */\nexport function readStudioScreenshot(...sources: unknown[]): StudioScreenshot {\n const shot: StudioScreenshot = {\n presignedUrl: null,\n s3Key: null,\n text: null,\n sheetId: null,\n sheetName: null,\n range: null,\n pageCount: null,\n savedAssetId: null,\n };\n for (const source of sources) {\n for (const fields of resultObjects(source)) {\n const imageSource = fields.type === \"image\" ? record(fields.source) : undefined;\n if (imageSource) {\n if (shot.presignedUrl === null && typeof imageSource.presigned_url === \"string\") {\n shot.presignedUrl = imageSource.presigned_url;\n }\n if (shot.s3Key === null && imageSource.type === \"s3_key\" && typeof imageSource.data === \"string\") {\n shot.s3Key = imageSource.data;\n }\n }\n if (shot.presignedUrl === null && typeof fields.presigned_url === \"string\") shot.presignedUrl = fields.presigned_url;\n if (shot.text === null && fields.type === \"text\" && typeof fields.text === \"string\") shot.text = fields.text;\n if (shot.sheetId === null && typeof fields.sheet_id === \"number\") shot.sheetId = fields.sheet_id;\n if (shot.sheetName === null && typeof fields.sheet_name === \"string\") shot.sheetName = fields.sheet_name;\n if (shot.range === null && typeof fields.range === \"string\") shot.range = fields.range;\n if (shot.pageCount === null && typeof fields.page_count === \"number\") shot.pageCount = fields.page_count;\n if (shot.savedAssetId === null && typeof fields.saved_asset_id === \"string\" && fields.saved_asset_id !== \"\") {\n shot.savedAssetId = fields.saved_asset_id;\n }\n }\n }\n return shot;\n}\n\n// ─── A fresh URL for the picture ─────────────────────────────────────\n\n/** How long a URL agora signed for a key is used before it is asked again. */\nconst FRESH_URL_STALE_MS = 10 * 60 * 1000;\n\nfunction useFreshPresignedUrlQuery({\n s3Key,\n fallbackUrl,\n}: {\n s3Key: string | null;\n fallbackUrl: string | null;\n}): string | null {\n const config = useContext(AthenaContext);\n const baseUrl = config ? config.backendUrl.replace(/\\/api\\/assistant-ui\\/?$/, \"\") : null;\n // A signed URL is a bearer grant to the picture, so no card is handed one\n // another read: the key carries the signed-in principal and a fingerprint\n // of the credential (never the credential itself) and this card's own id,\n // and the entry goes when the card unmounts. Each card asks agora, which\n // runs the read gate for whoever asks, after an account switch too, and\n // behind a host `getToken` whose account the key cannot see.\n const identity = useAthenaQueryIdentity({\n apiKey: config?.apiKey,\n token: config?.token,\n getToken: config?.getToken,\n });\n const reader = useId();\n const query = useQuery({\n queryKey: [\"athena\", \"screenshot-presigned-url\", baseUrl, ...identity, s3Key, reader],\n enabled: s3Key !== null && config !== null,\n staleTime: FRESH_URL_STALE_MS,\n gcTime: 0,\n refetchOnWindowFocus: false,\n retry: false,\n queryFn: async ({ signal }): Promise<string | null> => {\n if (!config || baseUrl === null) return null;\n const response = await sendWithCredentialRenewal(config, (headers) =>\n fetch(`${baseUrl}/api/asset/screenshot-presigned-url`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\", ...headers },\n body: JSON.stringify({ screenshot_key: s3Key }),\n signal,\n }),\n );\n if (!response.ok) return null;\n const data = (await response.json()) as { presigned_url?: unknown };\n return typeof data.presigned_url === \"string\" ? data.presigned_url : null;\n },\n });\n return query.data ?? fallbackUrl;\n}\n\n/**\n * The URL to show a screenshot from: one agora signs afresh for its storage\n * key, else the result's own. Needs a `QueryClient` in context: wrap the card\n * in `ScreenshotQueryScope`, which brings one when the host has none.\n */\nexport function useScreenshotUrl({\n s3Key,\n fallbackUrl,\n}: {\n s3Key: string | null;\n fallbackUrl: string | null;\n}): string | null {\n return useFreshPresignedUrlQuery({ s3Key, fallbackUrl });\n}\n\n/** The host's `QueryClient` when one is in context, else one of the card's own. */\nexport function ScreenshotQueryScope({ children }: { children: ReactNode }) {\n const queryClient = useAthenaQueryClient();\n return <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>;\n}\n\n// ─── The cards ───────────────────────────────────────────────────────\n\ntype OpenAssetOptions = Parameters<AssetPanelState[\"openAsset\"]>[1];\n\ninterface StudioScreenshotSpec {\n /** What was captured, in the card's words (\"“Q1 Plan”\", \"page 2 of 9\"). */\n label: (params: { args: Record<string, unknown> | undefined; shot: StudioScreenshot }) => string;\n /** The completed title's tail after the label (\"(A1:F40)\"); empty for none. */\n detail?: (params: { args: Record<string, unknown> | undefined; shot: StudioScreenshot }) => string;\n icon: typeof CameraIcon;\n /** The picture's box: a page keeps a page's proportions while it loads. */\n imageClassName: string;\n /** What a failed capture says under its title. */\n failureNote: string;\n /** How the asset opens, and the button's words. */\n open: (params: { args: Record<string, unknown> | undefined; shot: StudioScreenshot }) => {\n label: string;\n options: OpenAssetOptions;\n };\n}\n\nfunction createStudioScreenshotToolUI(spec: StudioScreenshotSpec): ToolCallMessagePartComponent {\n const Card: ToolCallMessagePartComponent = ({ toolName, args, result, artifact, status }) => {\n const typedArgs = args as Record<string, unknown> | undefined;\n const shot = useMemo(() => readStudioScreenshot(result, artifact), [result, artifact]);\n const imageUrl = useScreenshotUrl({ s3Key: shot.s3Key, fallbackUrl: shot.presignedUrl });\n const openAsset = useAssetPanelStore((s) => s.openAsset);\n const assetId = typeof typedArgs?.asset_id === \"string\" && typedArgs.asset_id !== \"\" ? typedArgs.asset_id : null;\n const label = spec.label({ args: typedArgs, shot });\n const detail = spec.detail?.({ args: typedArgs, shot }) ?? \"\";\n const isRunning = status?.type === \"running\";\n const isComplete = status?.type === \"complete\" || !status;\n const hasScreenshot = isComplete && (shot.presignedUrl !== null || shot.s3Key !== null);\n const failed = isComplete && !hasScreenshot;\n const errorMsg = status?.type === \"incomplete\" ? String(status.error ?? status.reason ?? \"Capture failed\") : null;\n const title = isRunning\n ? `Capturing screenshot of ${label}...`\n : failed || errorMsg\n ? `Failed to capture screenshot of ${label}`\n : `Screenshot captured for ${label}${detail ? ` ${detail}` : \"\"}`;\n const open = assetId ? spec.open({ args: typedArgs, shot }) : null;\n\n return (\n <ToolCard\n icon={spec.icon}\n status={(failed ? \"incomplete\" : (status?.type ?? \"complete\")) as ToolStatus}\n title={truncate(title, 90)}\n toolName={toolName}\n args={typedArgs}\n result={result}\n error={errorMsg ?? (failed ? spec.failureNote : null)}\n >\n {hasScreenshot && imageUrl ? (\n <div data-slot=\"studio-screenshot\" className=\"border-t border-border/40 p-3\">\n <div className=\"overflow-hidden rounded-lg border border-border/50 bg-muted/20\">\n <img\n src={imageUrl}\n alt={`Screenshot of ${label}`}\n className={spec.imageClassName}\n loading=\"lazy\"\n />\n </div>\n {shot.savedAssetId ? (\n <div className=\"mt-2 flex items-center gap-2 text-[11px] text-muted-foreground\">\n <span>Saved as asset:</span>\n <button\n type=\"button\"\n onClick={() => openAsset(shot.savedAssetId as string)}\n className=\"rounded font-mono text-foreground/80 hover:underline\"\n >\n {truncate(shot.savedAssetId, 28)}\n </button>\n </div>\n ) : null}\n </div>\n ) : null}\n {hasScreenshot && open && assetId ? (\n <div className=\"flex flex-wrap gap-2 border-t border-border/40 px-4 py-2\">\n <button\n type=\"button\"\n onClick={() => openAsset(assetId, open.options)}\n className=\"flex items-center gap-1.5 rounded-md border border-border/60 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground\"\n >\n <ExternalLinkIcon className=\"size-3\" />\n {open.label}\n </button>\n </div>\n ) : null}\n </ToolCard>\n );\n };\n const Scoped: ToolCallMessagePartComponent = (props) => (\n <ScreenshotQueryScope>\n <Card {...props} />\n </ScreenshotQueryScope>\n );\n return Scoped;\n}\n\n/** \"“Q1 Plan”\", \"sheet 3\", or \"active sheet\", as Athena on the web names the captured sheet. */\nfunction sheetLabel({ args, shot }: { args: Record<string, unknown> | undefined; shot: StudioScreenshot }): string {\n const name = shot.sheetName ?? (typeof args?.sheet_name === \"string\" ? args.sheet_name : null);\n const id = shot.sheetId ?? (typeof args?.sheet_id === \"number\" ? args.sheet_id : null);\n if (name) return `\"${name}\"`;\n if (id !== null) return `sheet ${id}`;\n return \"active sheet\";\n}\n\nfunction sheetRange({ args, shot }: { args: Record<string, unknown> | undefined; shot: StudioScreenshot }): string | null {\n return shot.range ?? (typeof args?.cell_range === \"string\" ? args.cell_range : null);\n}\n\nconst CaptureSheetScreenshotToolUIImpl = createStudioScreenshotToolUI({\n icon: CameraIcon,\n label: sheetLabel,\n detail: (params) => {\n const range = sheetRange(params);\n return range ? `(${range})` : \"\";\n },\n imageClassName: \"w-full object-contain\",\n failureNote: \"The screenshot could not be captured. Check that the workbook exists and the sheet or range is valid.\",\n open: (params) => {\n const range = sheetRange(params);\n return {\n label: range ? `Open ${range}` : \"Open spreadsheet\",\n options: { type: \"spreadsheet\" },\n };\n },\n});\n\n/** `capture_sheet_screenshot`: a workbook sheet's screenshot. */\nexport const CaptureSheetScreenshotToolUI = memo(\n CaptureSheetScreenshotToolUIImpl,\n) as unknown as ToolCallMessagePartComponent;\nCaptureSheetScreenshotToolUI.displayName = \"CaptureSheetScreenshotToolUI\";\n\n/** A Word page's proportions (US letter portrait), so the picture's box holds still while it loads. */\nconst PAGE_IMAGE_CLASS = \"aspect-[8.5/11] w-full object-contain\";\n\nconst CapturePageScreenshotToolUIImpl = createStudioScreenshotToolUI({\n icon: FileTextIcon,\n label: ({ args, shot }) => {\n const page = typeof args?.page_number === \"number\" ? args.page_number : 1;\n return shot.pageCount !== null ? `page ${page} of ${shot.pageCount}` : `page ${page}`;\n },\n imageClassName: PAGE_IMAGE_CLASS,\n failureNote: \"The screenshot could not be captured. Check that the document exists and the page number is within range.\",\n open: () => ({ label: \"Open document\", options: { type: \"document\" } }),\n});\n\n/** `capture_page_screenshot`: a Word document page's screenshot. */\nexport const CapturePageScreenshotToolUI = memo(\n CapturePageScreenshotToolUIImpl,\n) as unknown as ToolCallMessagePartComponent;\nCapturePageScreenshotToolUI.displayName = \"CapturePageScreenshotToolUI\";\n"],"names":["useContext","AthenaContext","useAthenaQueryIdentity","useId","useQuery","sendWithCredentialRenewal","useAthenaQueryClient","jsx","QueryClientProvider","useMemo","useAssetPanelStore","jsxs","ToolCard","truncate","ExternalLinkIcon","CameraIcon","memo","FileTextI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AAQ,IAAI;AAAA,EACrF;AAAA,EACA,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,MAAM,OAAO,EAAE,OAAO,iBAAiB,SAAS,EAAE,MAAM,aAAW;AACrE,CAAC;AAGM,MAAM,8BAA8BD,WAAAA;AAAAA,EACzC;AACF;AACA,4BAA4B,cAAc;;;;;;"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Screenshots the studio tools take of what they edit, as Athena on the web
3
+ * shows them: a workbook's sheet (`capture_sheet_screenshot`) and a Word
4
+ * document's page (`capture_page_screenshot`), each with what was captured
5
+ * ("Screenshot captured for "Q1 Plan" (A1:F40)"), the picture, the asset it
6
+ * was saved as, and a button that opens the asset.
7
+ *
8
+ * A screenshot's result carries a presigned URL that expires and the image's
9
+ * storage key, which does not. The picture is shown from a fresh URL agora
10
+ * signs for that key (`POST /api/asset/screenshot-presigned-url`, which signs
11
+ * only objects it resolves and the caller may read), read once per key with
12
+ * TanStack Query, and from the result's own URL meanwhile or when that read
13
+ * fails, so a session reopened later still shows its screenshots. A card
14
+ * rendered outside `AthenaProvider` has no backend to ask and shows the
15
+ * result's own URL.
16
+ */
17
+ import type { ToolCallMessagePartComponent } from "@assistant-ui/react";
18
+ import { type ReactNode } from "react";
19
+ /** What a screenshot result says about its picture and what it captured. */
20
+ export interface StudioScreenshot {
21
+ /** The result's own presigned URL, which expires. */
22
+ presignedUrl: string | null;
23
+ /** The image's storage key (`source.data` of an `s3_key` image source), which does not. */
24
+ s3Key: string | null;
25
+ /** The note the tool returned beside the picture. */
26
+ text: string | null;
27
+ sheetId: number | null;
28
+ sheetName: string | null;
29
+ range: string | null;
30
+ pageCount: number | null;
31
+ /** The asset the screenshot was saved as (`save_as_asset`). */
32
+ savedAssetId: string | null;
33
+ }
34
+ /** Reads a screenshot tool's result (and artifact): the first value of each field found. */
35
+ export declare function readStudioScreenshot(...sources: unknown[]): StudioScreenshot;
36
+ /**
37
+ * The URL to show a screenshot from: one agora signs afresh for its storage
38
+ * key, else the result's own. Needs a `QueryClient` in context: wrap the card
39
+ * in `ScreenshotQueryScope`, which brings one when the host has none.
40
+ */
41
+ export declare function useScreenshotUrl({ s3Key, fallbackUrl, }: {
42
+ s3Key: string | null;
43
+ fallbackUrl: string | null;
44
+ }): string | null;
45
+ /** The host's `QueryClient` when one is in context, else one of the card's own. */
46
+ export declare function ScreenshotQueryScope({ children }: {
47
+ children: ReactNode;
48
+ }): import("react").JSX.Element;
49
+ /** `capture_sheet_screenshot`: a workbook sheet's screenshot. */
50
+ export declare const CaptureSheetScreenshotToolUI: ToolCallMessagePartComponent;
51
+ /** `capture_page_screenshot`: a Word document page's screenshot. */
52
+ export declare const CapturePageScreenshotToolUI: ToolCallMessagePartComponent;
@@ -0,0 +1,262 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { QueryClientProvider, useQuery } from "@tanstack/react-query";
3
+ import { ExternalLinkIcon, CameraIcon, FileTextIcon } from "lucide-react";
4
+ import { memo, useMemo, useContext, useId } from "react";
5
+ import { useAssetPanelStore } from "../assets/asset-panel-store.js";
6
+ import { useAthenaQueryClient, useAthenaQueryIdentity } from "../lib/use-athena-rest-query.js";
7
+ import { AthenaContext } from "../provider/AthenaContext.js";
8
+ import { sendWithCredentialRenewal } from "../runtime/credential-renewal.js";
9
+ import { ToolCard, truncate } from "./primitives.js";
10
+ function record(value) {
11
+ return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
12
+ }
13
+ function parseResultString(result) {
14
+ try {
15
+ const parsed = JSON.parse(result);
16
+ return typeof parsed === "string" ? [] : [parsed];
17
+ } catch {
18
+ }
19
+ const items = [];
20
+ for (const line of result.split("\n")) {
21
+ const trimmed = line.trim();
22
+ if (!trimmed) continue;
23
+ try {
24
+ const parsed = JSON.parse(trimmed);
25
+ if (typeof parsed !== "string") items.push(parsed);
26
+ } catch {
27
+ }
28
+ }
29
+ return items;
30
+ }
31
+ function resultObjects(value) {
32
+ const found = [];
33
+ const stack = [value];
34
+ let budget = 2e3;
35
+ while (stack.length > 0 && budget > 0) {
36
+ budget -= 1;
37
+ const item = stack.pop();
38
+ if (typeof item === "string") {
39
+ stack.push(...parseResultString(item));
40
+ continue;
41
+ }
42
+ if (Array.isArray(item)) {
43
+ for (let index = item.length - 1; index >= 0; index -= 1) stack.push(item[index]);
44
+ continue;
45
+ }
46
+ const fields = record(item);
47
+ if (!fields) continue;
48
+ found.push(fields);
49
+ for (const nested of Object.values(fields)) {
50
+ if (nested && typeof nested === "object") stack.push(nested);
51
+ else if (typeof nested === "string" && (nested.startsWith("{") || nested.startsWith("["))) stack.push(nested);
52
+ }
53
+ }
54
+ return found;
55
+ }
56
+ function readStudioScreenshot(...sources) {
57
+ const shot = {
58
+ presignedUrl: null,
59
+ s3Key: null,
60
+ text: null,
61
+ sheetId: null,
62
+ sheetName: null,
63
+ range: null,
64
+ pageCount: null,
65
+ savedAssetId: null
66
+ };
67
+ for (const source of sources) {
68
+ for (const fields of resultObjects(source)) {
69
+ const imageSource = fields.type === "image" ? record(fields.source) : void 0;
70
+ if (imageSource) {
71
+ if (shot.presignedUrl === null && typeof imageSource.presigned_url === "string") {
72
+ shot.presignedUrl = imageSource.presigned_url;
73
+ }
74
+ if (shot.s3Key === null && imageSource.type === "s3_key" && typeof imageSource.data === "string") {
75
+ shot.s3Key = imageSource.data;
76
+ }
77
+ }
78
+ if (shot.presignedUrl === null && typeof fields.presigned_url === "string") shot.presignedUrl = fields.presigned_url;
79
+ if (shot.text === null && fields.type === "text" && typeof fields.text === "string") shot.text = fields.text;
80
+ if (shot.sheetId === null && typeof fields.sheet_id === "number") shot.sheetId = fields.sheet_id;
81
+ if (shot.sheetName === null && typeof fields.sheet_name === "string") shot.sheetName = fields.sheet_name;
82
+ if (shot.range === null && typeof fields.range === "string") shot.range = fields.range;
83
+ if (shot.pageCount === null && typeof fields.page_count === "number") shot.pageCount = fields.page_count;
84
+ if (shot.savedAssetId === null && typeof fields.saved_asset_id === "string" && fields.saved_asset_id !== "") {
85
+ shot.savedAssetId = fields.saved_asset_id;
86
+ }
87
+ }
88
+ }
89
+ return shot;
90
+ }
91
+ const FRESH_URL_STALE_MS = 10 * 60 * 1e3;
92
+ function useFreshPresignedUrlQuery({
93
+ s3Key,
94
+ fallbackUrl
95
+ }) {
96
+ const config = useContext(AthenaContext);
97
+ const baseUrl = config ? config.backendUrl.replace(/\/api\/assistant-ui\/?$/, "") : null;
98
+ const identity = useAthenaQueryIdentity({
99
+ apiKey: config == null ? void 0 : config.apiKey,
100
+ token: config == null ? void 0 : config.token,
101
+ getToken: config == null ? void 0 : config.getToken
102
+ });
103
+ const reader = useId();
104
+ const query = useQuery({
105
+ queryKey: ["athena", "screenshot-presigned-url", baseUrl, ...identity, s3Key, reader],
106
+ enabled: s3Key !== null && config !== null,
107
+ staleTime: FRESH_URL_STALE_MS,
108
+ gcTime: 0,
109
+ refetchOnWindowFocus: false,
110
+ retry: false,
111
+ queryFn: async ({ signal }) => {
112
+ if (!config || baseUrl === null) return null;
113
+ const response = await sendWithCredentialRenewal(
114
+ config,
115
+ (headers) => fetch(`${baseUrl}/api/asset/screenshot-presigned-url`, {
116
+ method: "POST",
117
+ headers: { "Content-Type": "application/json", ...headers },
118
+ body: JSON.stringify({ screenshot_key: s3Key }),
119
+ signal
120
+ })
121
+ );
122
+ if (!response.ok) return null;
123
+ const data = await response.json();
124
+ return typeof data.presigned_url === "string" ? data.presigned_url : null;
125
+ }
126
+ });
127
+ return query.data ?? fallbackUrl;
128
+ }
129
+ function useScreenshotUrl({
130
+ s3Key,
131
+ fallbackUrl
132
+ }) {
133
+ return useFreshPresignedUrlQuery({ s3Key, fallbackUrl });
134
+ }
135
+ function ScreenshotQueryScope({ children }) {
136
+ const queryClient = useAthenaQueryClient();
137
+ return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children });
138
+ }
139
+ function createStudioScreenshotToolUI(spec) {
140
+ const Card = ({ toolName, args, result, artifact, status }) => {
141
+ var _a;
142
+ const typedArgs = args;
143
+ const shot = useMemo(() => readStudioScreenshot(result, artifact), [result, artifact]);
144
+ const imageUrl = useScreenshotUrl({ s3Key: shot.s3Key, fallbackUrl: shot.presignedUrl });
145
+ const openAsset = useAssetPanelStore((s) => s.openAsset);
146
+ const assetId = typeof (typedArgs == null ? void 0 : typedArgs.asset_id) === "string" && typedArgs.asset_id !== "" ? typedArgs.asset_id : null;
147
+ const label = spec.label({ args: typedArgs, shot });
148
+ const detail = ((_a = spec.detail) == null ? void 0 : _a.call(spec, { args: typedArgs, shot })) ?? "";
149
+ const isRunning = (status == null ? void 0 : status.type) === "running";
150
+ const isComplete = (status == null ? void 0 : status.type) === "complete" || !status;
151
+ const hasScreenshot = isComplete && (shot.presignedUrl !== null || shot.s3Key !== null);
152
+ const failed = isComplete && !hasScreenshot;
153
+ const errorMsg = (status == null ? void 0 : status.type) === "incomplete" ? String(status.error ?? status.reason ?? "Capture failed") : null;
154
+ const title = isRunning ? `Capturing screenshot of ${label}...` : failed || errorMsg ? `Failed to capture screenshot of ${label}` : `Screenshot captured for ${label}${detail ? ` ${detail}` : ""}`;
155
+ const open = assetId ? spec.open({ args: typedArgs, shot }) : null;
156
+ return /* @__PURE__ */ jsxs(
157
+ ToolCard,
158
+ {
159
+ icon: spec.icon,
160
+ status: failed ? "incomplete" : (status == null ? void 0 : status.type) ?? "complete",
161
+ title: truncate(title, 90),
162
+ toolName,
163
+ args: typedArgs,
164
+ result,
165
+ error: errorMsg ?? (failed ? spec.failureNote : null),
166
+ children: [
167
+ hasScreenshot && imageUrl ? /* @__PURE__ */ jsxs("div", { "data-slot": "studio-screenshot", className: "border-t border-border/40 p-3", children: [
168
+ /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-lg border border-border/50 bg-muted/20", children: /* @__PURE__ */ jsx(
169
+ "img",
170
+ {
171
+ src: imageUrl,
172
+ alt: `Screenshot of ${label}`,
173
+ className: spec.imageClassName,
174
+ loading: "lazy"
175
+ }
176
+ ) }),
177
+ shot.savedAssetId ? /* @__PURE__ */ jsxs("div", { className: "mt-2 flex items-center gap-2 text-[11px] text-muted-foreground", children: [
178
+ /* @__PURE__ */ jsx("span", { children: "Saved as asset:" }),
179
+ /* @__PURE__ */ jsx(
180
+ "button",
181
+ {
182
+ type: "button",
183
+ onClick: () => openAsset(shot.savedAssetId),
184
+ className: "rounded font-mono text-foreground/80 hover:underline",
185
+ children: truncate(shot.savedAssetId, 28)
186
+ }
187
+ )
188
+ ] }) : null
189
+ ] }) : null,
190
+ hasScreenshot && open && assetId ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2 border-t border-border/40 px-4 py-2", children: /* @__PURE__ */ jsxs(
191
+ "button",
192
+ {
193
+ type: "button",
194
+ onClick: () => openAsset(assetId, open.options),
195
+ className: "flex items-center gap-1.5 rounded-md border border-border/60 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",
196
+ children: [
197
+ /* @__PURE__ */ jsx(ExternalLinkIcon, { className: "size-3" }),
198
+ open.label
199
+ ]
200
+ }
201
+ ) }) : null
202
+ ]
203
+ }
204
+ );
205
+ };
206
+ const Scoped = (props) => /* @__PURE__ */ jsx(ScreenshotQueryScope, { children: /* @__PURE__ */ jsx(Card, { ...props }) });
207
+ return Scoped;
208
+ }
209
+ function sheetLabel({ args, shot }) {
210
+ const name = shot.sheetName ?? (typeof (args == null ? void 0 : args.sheet_name) === "string" ? args.sheet_name : null);
211
+ const id = shot.sheetId ?? (typeof (args == null ? void 0 : args.sheet_id) === "number" ? args.sheet_id : null);
212
+ if (name) return `"${name}"`;
213
+ if (id !== null) return `sheet ${id}`;
214
+ return "active sheet";
215
+ }
216
+ function sheetRange({ args, shot }) {
217
+ return shot.range ?? (typeof (args == null ? void 0 : args.cell_range) === "string" ? args.cell_range : null);
218
+ }
219
+ const CaptureSheetScreenshotToolUIImpl = createStudioScreenshotToolUI({
220
+ icon: CameraIcon,
221
+ label: sheetLabel,
222
+ detail: (params) => {
223
+ const range = sheetRange(params);
224
+ return range ? `(${range})` : "";
225
+ },
226
+ imageClassName: "w-full object-contain",
227
+ failureNote: "The screenshot could not be captured. Check that the workbook exists and the sheet or range is valid.",
228
+ open: (params) => {
229
+ const range = sheetRange(params);
230
+ return {
231
+ label: range ? `Open ${range}` : "Open spreadsheet",
232
+ options: { type: "spreadsheet" }
233
+ };
234
+ }
235
+ });
236
+ const CaptureSheetScreenshotToolUI = memo(
237
+ CaptureSheetScreenshotToolUIImpl
238
+ );
239
+ CaptureSheetScreenshotToolUI.displayName = "CaptureSheetScreenshotToolUI";
240
+ const PAGE_IMAGE_CLASS = "aspect-[8.5/11] w-full object-contain";
241
+ const CapturePageScreenshotToolUIImpl = createStudioScreenshotToolUI({
242
+ icon: FileTextIcon,
243
+ label: ({ args, shot }) => {
244
+ const page = typeof (args == null ? void 0 : args.page_number) === "number" ? args.page_number : 1;
245
+ return shot.pageCount !== null ? `page ${page} of ${shot.pageCount}` : `page ${page}`;
246
+ },
247
+ imageClassName: PAGE_IMAGE_CLASS,
248
+ failureNote: "The screenshot could not be captured. Check that the document exists and the page number is within range.",
249
+ open: () => ({ label: "Open document", options: { type: "document" } })
250
+ });
251
+ const CapturePageScreenshotToolUI = memo(
252
+ CapturePageScreenshotToolUIImpl
253
+ );
254
+ CapturePageScreenshotToolUI.displayName = "CapturePageScreenshotToolUI";
255
+ export {
256
+ CapturePageScreenshotToolUI,
257
+ CaptureSheetScreenshotToolUI,
258
+ ScreenshotQueryScope,
259
+ readStudioScreenshot,
260
+ useScreenshotUrl
261
+ };
262
+ //# sourceMappingURL=studio-screenshot-tool-uis.js.map