@athenaintel/react 0.57.1 → 0.59.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 (811) hide show
  1. package/README.md +778 -9
  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.map +1 -1
  46. package/dist/agent-runtime/src/composer-markdown.d.ts +1 -1
  47. package/dist/agent-runtime/src/composer-markdown.js.map +1 -1
  48. package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs +3 -1
  49. package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -1
  50. package/dist/agent-runtime/src/deep-agent-transport-recipe.d.ts +8 -1
  51. package/dist/agent-runtime/src/deep-agent-transport-recipe.js +3 -1
  52. package/dist/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -1
  53. package/dist/agent-runtime/src/dictation-preferences.d.ts +356 -0
  54. package/dist/agent-runtime/src/dictation-record.d.ts +279 -0
  55. package/dist/agent-runtime/src/dictation-session.d.ts +106 -7
  56. package/dist/agent-runtime/src/dictation-snippets.d.ts +9 -0
  57. package/dist/agent-runtime/src/dictation-transfer.d.ts +142 -0
  58. package/dist/agent-runtime/src/edit-command.cjs.map +1 -1
  59. package/dist/agent-runtime/src/edit-command.d.ts +1 -1
  60. package/dist/agent-runtime/src/edit-command.js.map +1 -1
  61. package/dist/agent-runtime/src/errors.cjs +1 -0
  62. package/dist/agent-runtime/src/errors.cjs.map +1 -1
  63. package/dist/agent-runtime/src/errors.js +1 -0
  64. package/dist/agent-runtime/src/errors.js.map +1 -1
  65. package/dist/agent-runtime/src/generated/runconfig-contract.cjs +24 -0
  66. package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
  67. package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +3 -3
  68. package/dist/agent-runtime/src/generated/runconfig-contract.js +24 -0
  69. package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
  70. package/dist/agent-runtime/src/index.d.ts +14 -8
  71. package/dist/agent-runtime/src/lane-follow.cjs +289 -0
  72. package/dist/agent-runtime/src/lane-follow.cjs.map +1 -0
  73. package/dist/agent-runtime/src/lane-follow.js +289 -0
  74. package/dist/agent-runtime/src/lane-follow.js.map +1 -0
  75. package/dist/agent-runtime/src/lane-images.cjs +387 -0
  76. package/dist/agent-runtime/src/lane-images.cjs.map +1 -0
  77. package/dist/agent-runtime/src/lane-images.js +387 -0
  78. package/dist/agent-runtime/src/lane-images.js.map +1 -0
  79. package/dist/agent-runtime/src/message-window.js +1 -1
  80. package/dist/agent-runtime/src/messages.cjs +19 -1
  81. package/dist/agent-runtime/src/messages.cjs.map +1 -1
  82. package/dist/agent-runtime/src/messages.d.ts +8 -0
  83. package/dist/agent-runtime/src/messages.js +21 -3
  84. package/dist/agent-runtime/src/messages.js.map +1 -1
  85. package/dist/agent-runtime/src/named-agents.cjs +301 -0
  86. package/dist/agent-runtime/src/named-agents.cjs.map +1 -0
  87. package/dist/agent-runtime/src/named-agents.d.ts +246 -0
  88. package/dist/agent-runtime/src/named-agents.js +301 -0
  89. package/dist/agent-runtime/src/named-agents.js.map +1 -0
  90. package/dist/agent-runtime/src/offline-status.cjs.map +1 -1
  91. package/dist/agent-runtime/src/offline-status.d.ts +66 -2
  92. package/dist/agent-runtime/src/offline-status.js.map +1 -1
  93. package/dist/agent-runtime/src/ptc-subcalls.cjs +41 -0
  94. package/dist/agent-runtime/src/ptc-subcalls.cjs.map +1 -0
  95. package/dist/agent-runtime/src/ptc-subcalls.js +41 -0
  96. package/dist/agent-runtime/src/ptc-subcalls.js.map +1 -0
  97. package/dist/agent-runtime/src/queue.cjs +2 -2
  98. package/dist/agent-runtime/src/queue.cjs.map +1 -1
  99. package/dist/agent-runtime/src/queue.d.ts +20 -25
  100. package/dist/agent-runtime/src/queue.js +2 -2
  101. package/dist/agent-runtime/src/queue.js.map +1 -1
  102. package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs +314 -84
  103. package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
  104. package/dist/agent-runtime/src/quota-safe-local-storage-session.d.ts +137 -40
  105. package/dist/agent-runtime/src/quota-safe-local-storage-session.js +318 -88
  106. package/dist/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -1
  107. package/dist/agent-runtime/src/run-send.cjs +54 -0
  108. package/dist/agent-runtime/src/run-send.cjs.map +1 -0
  109. package/dist/agent-runtime/src/run-send.d.ts +51 -0
  110. package/dist/agent-runtime/src/run-send.js +54 -0
  111. package/dist/agent-runtime/src/run-send.js.map +1 -0
  112. package/dist/agent-runtime/src/running-tool-placeholder.cjs +6 -0
  113. package/dist/agent-runtime/src/running-tool-placeholder.cjs.map +1 -1
  114. package/dist/agent-runtime/src/running-tool-placeholder.js +6 -0
  115. package/dist/agent-runtime/src/running-tool-placeholder.js.map +1 -1
  116. package/dist/agent-runtime/src/runtime.d.ts +9 -5
  117. package/dist/agent-runtime/src/sealed-idb.cjs +64 -0
  118. package/dist/agent-runtime/src/sealed-idb.cjs.map +1 -1
  119. package/dist/agent-runtime/src/sealed-idb.d.ts +16 -0
  120. package/dist/agent-runtime/src/sealed-idb.js +64 -0
  121. package/dist/agent-runtime/src/sealed-idb.js.map +1 -1
  122. package/dist/agent-runtime/src/send-recovery.cjs +90 -118
  123. package/dist/agent-runtime/src/send-recovery.cjs.map +1 -1
  124. package/dist/agent-runtime/src/send-recovery.d.ts +25 -29
  125. package/dist/agent-runtime/src/send-recovery.js +90 -118
  126. package/dist/agent-runtime/src/send-recovery.js.map +1 -1
  127. package/dist/agent-runtime/src/statewire-diagnostics.d.ts +4 -1
  128. package/dist/agent-runtime/src/statewire-held-sends.cjs +191 -0
  129. package/dist/agent-runtime/src/statewire-held-sends.cjs.map +1 -0
  130. package/dist/agent-runtime/src/statewire-held-sends.d.ts +119 -0
  131. package/dist/agent-runtime/src/statewire-held-sends.js +191 -0
  132. package/dist/agent-runtime/src/statewire-held-sends.js.map +1 -0
  133. package/dist/agent-runtime/src/statewire-state.cjs +4 -0
  134. package/dist/agent-runtime/src/statewire-state.cjs.map +1 -1
  135. package/dist/agent-runtime/src/statewire-state.js +4 -0
  136. package/dist/agent-runtime/src/statewire-state.js.map +1 -1
  137. package/dist/agent-runtime/src/statewire-transport.cjs +8 -2
  138. package/dist/agent-runtime/src/statewire-transport.cjs.map +1 -1
  139. package/dist/agent-runtime/src/statewire-transport.d.ts +14 -5
  140. package/dist/agent-runtime/src/statewire-transport.js +8 -2
  141. package/dist/agent-runtime/src/statewire-transport.js.map +1 -1
  142. package/dist/agent-runtime/src/subagent-transcripts.cjs +1 -23
  143. package/dist/agent-runtime/src/subagent-transcripts.cjs.map +1 -1
  144. package/dist/agent-runtime/src/subagent-transcripts.js +3 -25
  145. package/dist/agent-runtime/src/subagent-transcripts.js.map +1 -1
  146. package/dist/agent-runtime/src/subagents.cjs +22 -29
  147. package/dist/agent-runtime/src/subagents.cjs.map +1 -1
  148. package/dist/agent-runtime/src/subagents.js +23 -30
  149. package/dist/agent-runtime/src/subagents.js.map +1 -1
  150. package/dist/agent-runtime/src/thread-extras.cjs +27 -19
  151. package/dist/agent-runtime/src/thread-extras.cjs.map +1 -1
  152. package/dist/agent-runtime/src/thread-extras.d.ts +19 -6
  153. package/dist/agent-runtime/src/thread-extras.js +27 -19
  154. package/dist/agent-runtime/src/thread-extras.js.map +1 -1
  155. package/dist/agent-runtime/src/thread-handoff-flow-machine.d.ts +8 -8
  156. package/dist/agent-runtime/src/tool-metadata.cjs +12 -0
  157. package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -1
  158. package/dist/agent-runtime/src/tool-metadata.js +12 -0
  159. package/dist/agent-runtime/src/tool-metadata.js.map +1 -1
  160. package/dist/agent-runtime/src/tool-names.cjs +21 -0
  161. package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
  162. package/dist/agent-runtime/src/tool-names.d.ts +8 -0
  163. package/dist/agent-runtime/src/tool-names.js +21 -0
  164. package/dist/agent-runtime/src/tool-names.js.map +1 -1
  165. package/dist/agent-runtime/src/typed-interrupt-kinds.cjs +247 -0
  166. package/dist/agent-runtime/src/typed-interrupt-kinds.cjs.map +1 -0
  167. package/dist/agent-runtime/src/typed-interrupt-kinds.d.ts +173 -0
  168. package/dist/agent-runtime/src/typed-interrupt-kinds.js +247 -0
  169. package/dist/agent-runtime/src/typed-interrupt-kinds.js.map +1 -0
  170. package/dist/agent-runtime/src/typed-interrupts.cjs +48 -0
  171. package/dist/agent-runtime/src/typed-interrupts.cjs.map +1 -0
  172. package/dist/agent-runtime/src/typed-interrupts.d.ts +75 -0
  173. package/dist/agent-runtime/src/typed-interrupts.js +48 -0
  174. package/dist/agent-runtime/src/typed-interrupts.js.map +1 -0
  175. package/dist/agent-runtime/src/types.d.ts +1 -1
  176. package/dist/agent-runtime/src/use-conversation-list.cjs +1 -0
  177. package/dist/agent-runtime/src/use-conversation-list.cjs.map +1 -1
  178. package/dist/agent-runtime/src/use-conversation-list.d.ts +7 -0
  179. package/dist/agent-runtime/src/use-conversation-list.js +1 -0
  180. package/dist/agent-runtime/src/use-conversation-list.js.map +1 -1
  181. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +46 -29
  182. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -1
  183. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +14 -22
  184. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +46 -29
  185. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -1
  186. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +78 -14
  187. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
  188. package/dist/agent-runtime/src/use-deep-agent-runtime.d.ts +34 -7
  189. package/dist/agent-runtime/src/use-deep-agent-runtime.js +79 -15
  190. package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
  191. package/dist/agent-runtime/src/use-deep-agent-thread.cjs +16 -1
  192. package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
  193. package/dist/agent-runtime/src/use-deep-agent-thread.d.ts +7 -2
  194. package/dist/agent-runtime/src/use-deep-agent-thread.js +16 -1
  195. package/dist/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
  196. package/dist/agent-runtime/src/use-deep-agent-voice.cjs +30 -4
  197. package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -1
  198. package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +22 -4
  199. package/dist/agent-runtime/src/use-deep-agent-voice.js +30 -4
  200. package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -1
  201. package/dist/agent-runtime/src/withdrawn-turns.d.ts +5 -4
  202. package/dist/agent-runtime/src/word-device-fit.d.ts +174 -0
  203. package/dist/agent-runtime/src/work-in.d.ts +127 -0
  204. package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
  205. package/dist/assets/AthenaAssetEmbed.d.ts +6 -1
  206. package/dist/assets/AthenaAssetEmbed.js.map +1 -1
  207. package/dist/assets/asset-panel-store.cjs +13 -5
  208. package/dist/assets/asset-panel-store.cjs.map +1 -1
  209. package/dist/assets/asset-panel-store.d.ts +33 -2
  210. package/dist/assets/asset-panel-store.js +13 -5
  211. package/dist/assets/asset-panel-store.js.map +1 -1
  212. package/dist/auth/AthenaCredentialSourceContext.cjs +11 -0
  213. package/dist/auth/AthenaCredentialSourceContext.cjs.map +1 -1
  214. package/dist/auth/AthenaCredentialSourceContext.d.ts +6 -0
  215. package/dist/auth/AthenaCredentialSourceContext.js +11 -0
  216. package/dist/auth/AthenaCredentialSourceContext.js.map +1 -1
  217. package/dist/auth/account-identity.cjs +13 -2
  218. package/dist/auth/account-identity.cjs.map +1 -1
  219. package/dist/auth/account-identity.d.ts +9 -0
  220. package/dist/auth/account-identity.js +13 -2
  221. package/dist/auth/account-identity.js.map +1 -1
  222. package/dist/auth/credential-source.cjs +20 -4
  223. package/dist/auth/credential-source.cjs.map +1 -1
  224. package/dist/auth/credential-source.d.ts +9 -0
  225. package/dist/auth/credential-source.js +20 -4
  226. package/dist/auth/credential-source.js.map +1 -1
  227. package/dist/catalog/chat-pickers.cjs +31 -0
  228. package/dist/catalog/chat-pickers.cjs.map +1 -1
  229. package/dist/catalog/chat-pickers.d.ts +17 -0
  230. package/dist/catalog/chat-pickers.js +33 -2
  231. package/dist/catalog/chat-pickers.js.map +1 -1
  232. package/dist/catalog/runtime-catalog.cjs +63 -3
  233. package/dist/catalog/runtime-catalog.cjs.map +1 -1
  234. package/dist/catalog/runtime-catalog.d.ts +63 -3
  235. package/dist/catalog/runtime-catalog.js +64 -4
  236. package/dist/catalog/runtime-catalog.js.map +1 -1
  237. package/dist/chat/AthenaChat.cjs +337 -99
  238. package/dist/chat/AthenaChat.cjs.map +1 -1
  239. package/dist/chat/AthenaChat.d.ts +80 -4
  240. package/dist/chat/AthenaChat.js +337 -99
  241. package/dist/chat/AthenaChat.js.map +1 -1
  242. package/dist/chat/StatewireApprovalCard.cjs +35 -5
  243. package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
  244. package/dist/chat/StatewireApprovalCard.d.ts +55 -2
  245. package/dist/chat/StatewireApprovalCard.js +37 -7
  246. package/dist/chat/StatewireApprovalCard.js.map +1 -1
  247. package/dist/chat/StatewireQueuedMessages.cjs +17 -2
  248. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
  249. package/dist/chat/StatewireQueuedMessages.d.ts +8 -45
  250. package/dist/chat/StatewireQueuedMessages.js +18 -3
  251. package/dist/chat/StatewireQueuedMessages.js.map +1 -1
  252. package/dist/chat/chat-agent-mentions.cjs +70 -0
  253. package/dist/chat/chat-agent-mentions.cjs.map +1 -0
  254. package/dist/chat/chat-agent-mentions.d.ts +13 -0
  255. package/dist/chat/chat-agent-mentions.js +70 -0
  256. package/dist/chat/chat-agent-mentions.js.map +1 -0
  257. package/dist/chat/composer-actions.cjs +12 -0
  258. package/dist/chat/composer-actions.cjs.map +1 -0
  259. package/dist/chat/composer-actions.d.ts +22 -0
  260. package/dist/chat/composer-actions.js +12 -0
  261. package/dist/chat/composer-actions.js.map +1 -0
  262. package/dist/chat/follow-up-suggestions.cjs +185 -0
  263. package/dist/chat/follow-up-suggestions.cjs.map +1 -0
  264. package/dist/chat/follow-up-suggestions.d.ts +64 -0
  265. package/dist/chat/follow-up-suggestions.js +185 -0
  266. package/dist/chat/follow-up-suggestions.js.map +1 -0
  267. package/dist/chat/super-grouping/ToolTimeline.cjs +4 -3
  268. package/dist/chat/super-grouping/ToolTimeline.cjs.map +1 -1
  269. package/dist/chat/super-grouping/ToolTimeline.d.ts +7 -3
  270. package/dist/chat/super-grouping/ToolTimeline.js +4 -3
  271. package/dist/chat/super-grouping/ToolTimeline.js.map +1 -1
  272. package/dist/chat/turn-changes.cjs +284 -0
  273. package/dist/chat/turn-changes.cjs.map +1 -0
  274. package/dist/chat/turn-changes.d.ts +130 -0
  275. package/dist/chat/turn-changes.js +284 -0
  276. package/dist/chat/turn-changes.js.map +1 -0
  277. package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.cjs +31 -0
  278. package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.cjs.map +1 -0
  279. package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.d.ts +31 -0
  280. package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.js +31 -0
  281. package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.js.map +1 -0
  282. package/dist/chat/typed-interrupts/approval-cards.cjs +250 -0
  283. package/dist/chat/typed-interrupts/approval-cards.cjs.map +1 -0
  284. package/dist/chat/typed-interrupts/approval-cards.d.ts +22 -0
  285. package/dist/chat/typed-interrupts/approval-cards.js +250 -0
  286. package/dist/chat/typed-interrupts/approval-cards.js.map +1 -0
  287. package/dist/chat/typed-interrupts/form-cards.cjs +289 -0
  288. package/dist/chat/typed-interrupts/form-cards.cjs.map +1 -0
  289. package/dist/chat/typed-interrupts/form-cards.d.ts +6 -0
  290. package/dist/chat/typed-interrupts/form-cards.js +289 -0
  291. package/dist/chat/typed-interrupts/form-cards.js.map +1 -0
  292. package/dist/chat/typed-interrupts/interrupt-card-shell.cjs +182 -0
  293. package/dist/chat/typed-interrupts/interrupt-card-shell.cjs.map +1 -0
  294. package/dist/chat/typed-interrupts/interrupt-card-shell.d.ts +47 -0
  295. package/dist/chat/typed-interrupts/interrupt-card-shell.js +182 -0
  296. package/dist/chat/typed-interrupts/interrupt-card-shell.js.map +1 -0
  297. package/dist/chat/typed-interrupts/json-schema-form.cjs +388 -0
  298. package/dist/chat/typed-interrupts/json-schema-form.cjs.map +1 -0
  299. package/dist/chat/typed-interrupts/json-schema-form.d.ts +33 -0
  300. package/dist/chat/typed-interrupts/json-schema-form.js +388 -0
  301. package/dist/chat/typed-interrupts/json-schema-form.js.map +1 -0
  302. package/dist/chat/typed-interrupts/questionnaire-card.cjs +449 -0
  303. package/dist/chat/typed-interrupts/questionnaire-card.cjs.map +1 -0
  304. package/dist/chat/typed-interrupts/questionnaire-card.d.ts +20 -0
  305. package/dist/chat/typed-interrupts/questionnaire-card.js +449 -0
  306. package/dist/chat/typed-interrupts/questionnaire-card.js.map +1 -0
  307. package/dist/chat/typed-interrupts/request-file-card.cjs +159 -0
  308. package/dist/chat/typed-interrupts/request-file-card.cjs.map +1 -0
  309. package/dist/chat/typed-interrupts/request-file-card.d.ts +2 -0
  310. package/dist/chat/typed-interrupts/request-file-card.js +159 -0
  311. package/dist/chat/typed-interrupts/request-file-card.js.map +1 -0
  312. package/dist/chat/typed-interrupts/toolkit-selection-card.cjs +189 -0
  313. package/dist/chat/typed-interrupts/toolkit-selection-card.cjs.map +1 -0
  314. package/dist/chat/typed-interrupts/toolkit-selection-card.d.ts +23 -0
  315. package/dist/chat/typed-interrupts/toolkit-selection-card.js +189 -0
  316. package/dist/chat/typed-interrupts/toolkit-selection-card.js.map +1 -0
  317. package/dist/chat/typed-interrupts/typed-interrupt-body.cjs +26 -0
  318. package/dist/chat/typed-interrupts/typed-interrupt-body.cjs.map +1 -0
  319. package/dist/chat/typed-interrupts/typed-interrupt-body.d.ts +3 -0
  320. package/dist/chat/typed-interrupts/typed-interrupt-body.js +26 -0
  321. package/dist/chat/typed-interrupts/typed-interrupt-body.js.map +1 -0
  322. package/dist/chat/typed-interrupts/typed-interrupt-graphql.cjs +105 -0
  323. package/dist/chat/typed-interrupts/typed-interrupt-graphql.cjs.map +1 -0
  324. package/dist/chat/typed-interrupts/typed-interrupt-graphql.d.ts +29 -0
  325. package/dist/chat/typed-interrupts/typed-interrupt-graphql.js +105 -0
  326. package/dist/chat/typed-interrupts/typed-interrupt-graphql.js.map +1 -0
  327. package/dist/chat/typed-interrupts/typed-interrupt-notice.cjs +70 -0
  328. package/dist/chat/typed-interrupts/typed-interrupt-notice.cjs.map +1 -0
  329. package/dist/chat/typed-interrupts/typed-interrupt-notice.d.ts +45 -0
  330. package/dist/chat/typed-interrupts/typed-interrupt-notice.js +70 -0
  331. package/dist/chat/typed-interrupts/typed-interrupt-notice.js.map +1 -0
  332. package/dist/chat/typed-interrupts/typed-interrupt-panel.cjs +76 -0
  333. package/dist/chat/typed-interrupts/typed-interrupt-panel.cjs.map +1 -0
  334. package/dist/chat/typed-interrupts/typed-interrupt-panel.d.ts +11 -0
  335. package/dist/chat/typed-interrupts/typed-interrupt-panel.js +76 -0
  336. package/dist/chat/typed-interrupts/typed-interrupt-panel.js.map +1 -0
  337. package/dist/chat/typed-interrupts/typed-interrupt-types.d.ts +46 -0
  338. package/dist/chat/typed-interrupts/use-interrupt-draft.cjs +106 -0
  339. package/dist/chat/typed-interrupts/use-interrupt-draft.cjs.map +1 -0
  340. package/dist/chat/typed-interrupts/use-interrupt-draft.d.ts +29 -0
  341. package/dist/chat/typed-interrupts/use-interrupt-draft.js +106 -0
  342. package/dist/chat/typed-interrupts/use-interrupt-draft.js.map +1 -0
  343. package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.cjs +231 -0
  344. package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.cjs.map +1 -0
  345. package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.d.ts +66 -0
  346. package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.js +231 -0
  347. package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.js.map +1 -0
  348. package/dist/chat-ui/composer/composer-named-agents.cjs +13 -0
  349. package/dist/chat-ui/composer/composer-named-agents.cjs.map +1 -0
  350. package/dist/chat-ui/composer/composer-named-agents.d.ts +20 -0
  351. package/dist/chat-ui/composer/composer-named-agents.js +13 -0
  352. package/dist/chat-ui/composer/composer-named-agents.js.map +1 -0
  353. package/dist/chat-ui/composer/slash-command-menu.cjs +143 -0
  354. package/dist/chat-ui/composer/slash-command-menu.cjs.map +1 -0
  355. package/dist/chat-ui/composer/slash-command-menu.d.ts +19 -0
  356. package/dist/chat-ui/composer/slash-command-menu.js +143 -0
  357. package/dist/chat-ui/composer/slash-command-menu.js.map +1 -0
  358. package/dist/chat-ui/composer/slash-commands-extension.cjs +51 -0
  359. package/dist/chat-ui/composer/slash-commands-extension.cjs.map +1 -0
  360. package/dist/chat-ui/composer/slash-commands-extension.d.ts +39 -0
  361. package/dist/chat-ui/composer/slash-commands-extension.js +51 -0
  362. package/dist/chat-ui/composer/slash-commands-extension.js.map +1 -0
  363. package/dist/chat-ui/composer/slash-commands.cjs +74 -0
  364. package/dist/chat-ui/composer/slash-commands.cjs.map +1 -0
  365. package/dist/chat-ui/composer/slash-commands.d.ts +82 -0
  366. package/dist/chat-ui/composer/slash-commands.js +74 -0
  367. package/dist/chat-ui/composer/slash-commands.js.map +1 -0
  368. package/dist/chat-ui/composer/tiptap-composer.cjs +135 -9
  369. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
  370. package/dist/chat-ui/composer/tiptap-composer.d.ts +61 -2
  371. package/dist/chat-ui/composer/tiptap-composer.js +135 -9
  372. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
  373. package/dist/chat-ui/index.cjs +3 -0
  374. package/dist/chat-ui/index.cjs.map +1 -1
  375. package/dist/chat-ui/index.d.ts +3 -2
  376. package/dist/chat-ui/index.js +3 -0
  377. package/dist/chat-ui/index.js.map +1 -1
  378. package/dist/chat-ui/mentions/mention-chip.cjs +1 -1
  379. package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
  380. package/dist/chat-ui/mentions/mention-chip.js +2 -2
  381. package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
  382. package/dist/chat-ui/mentions/mention-extension.cjs +8 -1
  383. package/dist/chat-ui/mentions/mention-extension.cjs.map +1 -1
  384. package/dist/chat-ui/mentions/mention-extension.js +8 -1
  385. package/dist/chat-ui/mentions/mention-extension.js.map +1 -1
  386. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.cjs +1 -0
  387. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.cjs.map +1 -1
  388. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.js +1 -0
  389. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.js.map +1 -1
  390. package/dist/chat-ui/mentions/suggestions/components/mention-icon.cjs +2 -0
  391. package/dist/chat-ui/mentions/suggestions/components/mention-icon.cjs.map +1 -1
  392. package/dist/chat-ui/mentions/suggestions/components/mention-icon.js +3 -1
  393. package/dist/chat-ui/mentions/suggestions/components/mention-icon.js.map +1 -1
  394. package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs +1 -1
  395. package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs.map +1 -1
  396. package/dist/chat-ui/mentions/suggestions/components/menu-item.js +1 -1
  397. package/dist/chat-ui/mentions/suggestions/components/menu-item.js.map +1 -1
  398. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +36 -0
  399. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
  400. package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +42 -0
  401. package/dist/chat-ui/mentions/suggestions/data/api-client.js +36 -0
  402. package/dist/chat-ui/mentions/suggestions/data/api-client.js.map +1 -1
  403. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +235 -19
  404. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -1
  405. package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +88 -10
  406. package/dist/chat-ui/mentions/suggestions/data/sources/index.js +236 -20
  407. package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
  408. package/dist/chat-ui/mentions/suggestions/data/types.cjs.map +1 -1
  409. package/dist/chat-ui/mentions/suggestions/data/types.d.ts +27 -1
  410. package/dist/chat-ui/mentions/suggestions/data/types.js.map +1 -1
  411. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs +56 -5
  412. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs.map +1 -1
  413. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.d.ts +26 -6
  414. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js +57 -6
  415. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js.map +1 -1
  416. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.cjs +34 -17
  417. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.cjs.map +1 -1
  418. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.d.ts +19 -1
  419. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.js +35 -18
  420. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.js.map +1 -1
  421. package/dist/chat-ui/statewire.d.ts +1 -1
  422. package/dist/chat-ui/thread/statewire-history-edge.cjs +15 -0
  423. package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
  424. package/dist/chat-ui/thread/statewire-history-edge.d.ts +4 -1
  425. package/dist/chat-ui/thread/statewire-history-edge.js +15 -0
  426. package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
  427. package/dist/collab/client.cjs +17 -5
  428. package/dist/collab/client.cjs.map +1 -1
  429. package/dist/collab/client.d.ts +22 -7
  430. package/dist/collab/client.js +17 -5
  431. package/dist/collab/client.js.map +1 -1
  432. package/dist/composer/ComposerAttachedReferences.cjs +119 -0
  433. package/dist/composer/ComposerAttachedReferences.cjs.map +1 -0
  434. package/dist/composer/ComposerAttachedReferences.d.ts +26 -0
  435. package/dist/composer/ComposerAttachedReferences.js +119 -0
  436. package/dist/composer/ComposerAttachedReferences.js.map +1 -0
  437. package/dist/composer/ComposerNamedAgents.cjs +63 -0
  438. package/dist/composer/ComposerNamedAgents.cjs.map +1 -0
  439. package/dist/composer/ComposerNamedAgents.d.ts +16 -0
  440. package/dist/composer/ComposerNamedAgents.js +63 -0
  441. package/dist/composer/ComposerNamedAgents.js.map +1 -0
  442. package/dist/composer/attached-references.cjs +159 -0
  443. package/dist/composer/attached-references.cjs.map +1 -0
  444. package/dist/composer/attached-references.d.ts +86 -0
  445. package/dist/composer/attached-references.js +159 -0
  446. package/dist/composer/attached-references.js.map +1 -0
  447. package/dist/composer/build-composed-message.cjs +14 -7
  448. package/dist/composer/build-composed-message.cjs.map +1 -1
  449. package/dist/composer/build-composed-message.d.ts +6 -1
  450. package/dist/composer/build-composed-message.js +14 -7
  451. package/dist/composer/build-composed-message.js.map +1 -1
  452. package/dist/composer/composer-handoff.cjs +6 -2
  453. package/dist/composer/composer-handoff.cjs.map +1 -1
  454. package/dist/composer/composer-handoff.d.ts +7 -1
  455. package/dist/composer/composer-handoff.js +6 -2
  456. package/dist/composer/composer-handoff.js.map +1 -1
  457. package/dist/composer/folder-upload.cjs +149 -0
  458. package/dist/composer/folder-upload.cjs.map +1 -0
  459. package/dist/composer/folder-upload.d.ts +79 -0
  460. package/dist/composer/folder-upload.js +149 -0
  461. package/dist/composer/folder-upload.js.map +1 -0
  462. package/dist/composer/index.d.ts +1 -1
  463. package/dist/composer/useAttachToChat.cjs +35 -0
  464. package/dist/composer/useAttachToChat.cjs.map +1 -0
  465. package/dist/composer/useAttachToChat.d.ts +54 -0
  466. package/dist/composer/useAttachToChat.js +35 -0
  467. package/dist/composer/useAttachToChat.js.map +1 -0
  468. package/dist/composer/useAttachedReferencesComposerProps.cjs +19 -0
  469. package/dist/composer/useAttachedReferencesComposerProps.cjs.map +1 -0
  470. package/dist/composer/useAttachedReferencesComposerProps.d.ts +12 -0
  471. package/dist/composer/useAttachedReferencesComposerProps.js +19 -0
  472. package/dist/composer/useAttachedReferencesComposerProps.js.map +1 -0
  473. package/dist/composer/useFileUpload.cjs +95 -7
  474. package/dist/composer/useFileUpload.cjs.map +1 -1
  475. package/dist/composer/useFileUpload.d.ts +21 -2
  476. package/dist/composer/useFileUpload.js +95 -7
  477. package/dist/composer/useFileUpload.js.map +1 -1
  478. package/dist/data/athena-api-error.cjs +125 -0
  479. package/dist/data/athena-api-error.cjs.map +1 -0
  480. package/dist/data/athena-api-error.d.ts +96 -0
  481. package/dist/data/athena-api-error.js +125 -0
  482. package/dist/data/athena-api-error.js.map +1 -0
  483. package/dist/data/athena-data-client.cjs +106 -0
  484. package/dist/data/athena-data-client.cjs.map +1 -0
  485. package/dist/data/athena-data-client.d.ts +74 -0
  486. package/dist/data/athena-data-client.js +106 -0
  487. package/dist/data/athena-data-client.js.map +1 -0
  488. package/dist/data/athena-member.cjs +93 -0
  489. package/dist/data/athena-member.cjs.map +1 -0
  490. package/dist/data/athena-member.d.ts +125 -0
  491. package/dist/data/athena-member.js +93 -0
  492. package/dist/data/athena-member.js.map +1 -0
  493. package/dist/data/athena-request.cjs +458 -0
  494. package/dist/data/athena-request.cjs.map +1 -0
  495. package/dist/data/athena-request.d.ts +120 -0
  496. package/dist/data/athena-request.js +458 -0
  497. package/dist/data/athena-request.js.map +1 -0
  498. package/dist/data/use-athena-fetch.cjs +14 -0
  499. package/dist/data/use-athena-fetch.cjs.map +1 -0
  500. package/dist/data/use-athena-fetch.d.ts +19 -0
  501. package/dist/data/use-athena-fetch.js +14 -0
  502. package/dist/data/use-athena-fetch.js.map +1 -0
  503. package/dist/data/use-athena-graphql.cjs +66 -0
  504. package/dist/data/use-athena-graphql.cjs.map +1 -0
  505. package/dist/data/use-athena-graphql.d.ts +56 -0
  506. package/dist/data/use-athena-graphql.js +66 -0
  507. package/dist/data/use-athena-graphql.js.map +1 -0
  508. package/dist/data/use-athena-rest.cjs +33 -0
  509. package/dist/data/use-athena-rest.cjs.map +1 -0
  510. package/dist/data/use-athena-rest.d.ts +21 -0
  511. package/dist/data/use-athena-rest.js +33 -0
  512. package/dist/data/use-athena-rest.js.map +1 -0
  513. package/dist/data/use-semantic-query.cjs +44 -0
  514. package/dist/data/use-semantic-query.cjs.map +1 -0
  515. package/dist/data/use-semantic-query.d.ts +92 -0
  516. package/dist/data/use-semantic-query.js +44 -0
  517. package/dist/data/use-semantic-query.js.map +1 -0
  518. package/dist/diagnostics/athena-diagnostics.cjs.map +1 -1
  519. package/dist/diagnostics/athena-diagnostics.d.ts +5 -1
  520. package/dist/diagnostics/athena-diagnostics.js.map +1 -1
  521. package/dist/diagnostics/errors.cjs +7 -0
  522. package/dist/diagnostics/errors.cjs.map +1 -1
  523. package/dist/diagnostics/errors.d.ts +7 -0
  524. package/dist/diagnostics/errors.js +7 -0
  525. package/dist/diagnostics/errors.js.map +1 -1
  526. package/dist/index.cjs +155 -11
  527. package/dist/index.cjs.map +1 -1
  528. package/dist/index.d.ts +72 -13
  529. package/dist/index.js +148 -4
  530. package/dist/index.js.map +1 -1
  531. package/dist/keryx-http/src/initial-sync.cjs +64 -16
  532. package/dist/keryx-http/src/initial-sync.cjs.map +1 -1
  533. package/dist/keryx-http/src/initial-sync.d.ts +31 -1
  534. package/dist/keryx-http/src/initial-sync.js +64 -16
  535. package/dist/keryx-http/src/initial-sync.js.map +1 -1
  536. package/dist/keryx-http/src/own-awareness.cjs +20 -0
  537. package/dist/keryx-http/src/own-awareness.cjs.map +1 -0
  538. package/dist/keryx-http/src/own-awareness.d.ts +50 -0
  539. package/dist/keryx-http/src/own-awareness.js +20 -0
  540. package/dist/keryx-http/src/own-awareness.js.map +1 -0
  541. package/dist/keryx-http/src/update-attributions.cjs +26 -1
  542. package/dist/keryx-http/src/update-attributions.cjs.map +1 -1
  543. package/dist/keryx-http/src/update-attributions.d.ts +10 -1
  544. package/dist/keryx-http/src/update-attributions.js +26 -1
  545. package/dist/keryx-http/src/update-attributions.js.map +1 -1
  546. package/dist/offline/chat-outbox.cjs +262 -26
  547. package/dist/offline/chat-outbox.cjs.map +1 -1
  548. package/dist/offline/chat-outbox.d.ts +90 -12
  549. package/dist/offline/chat-outbox.js +263 -27
  550. package/dist/offline/chat-outbox.js.map +1 -1
  551. package/dist/provider/AthenaProvider.cjs +63 -19
  552. package/dist/provider/AthenaProvider.cjs.map +1 -1
  553. package/dist/provider/AthenaProvider.d.ts +24 -8
  554. package/dist/provider/AthenaProvider.js +66 -22
  555. package/dist/provider/AthenaProvider.js.map +1 -1
  556. package/dist/react/package.json.cjs +1 -1
  557. package/dist/react/package.json.js +1 -1
  558. package/dist/references/src/anchors/types.cjs +5 -0
  559. package/dist/references/src/anchors/types.cjs.map +1 -1
  560. package/dist/references/src/anchors/types.js +5 -0
  561. package/dist/references/src/anchors/types.js.map +1 -1
  562. package/dist/references/src/attachable.cjs +149 -0
  563. package/dist/references/src/attachable.cjs.map +1 -0
  564. package/dist/references/src/attachable.d.ts +87 -0
  565. package/dist/references/src/attachable.js +149 -0
  566. package/dist/references/src/attachable.js.map +1 -0
  567. package/dist/runtime/StatewirePlanModeLaneSync.cjs +93 -0
  568. package/dist/runtime/StatewirePlanModeLaneSync.cjs.map +1 -0
  569. package/dist/runtime/StatewirePlanModeLaneSync.d.ts +34 -0
  570. package/dist/runtime/StatewirePlanModeLaneSync.js +93 -0
  571. package/dist/runtime/StatewirePlanModeLaneSync.js.map +1 -0
  572. package/dist/runtime/StatewireThreadConfigLaneSync.cjs +2 -0
  573. package/dist/runtime/StatewireThreadConfigLaneSync.cjs.map +1 -1
  574. package/dist/runtime/StatewireThreadConfigLaneSync.d.ts +4 -0
  575. package/dist/runtime/StatewireThreadConfigLaneSync.js +2 -0
  576. package/dist/runtime/StatewireThreadConfigLaneSync.js.map +1 -1
  577. package/dist/runtime/statewire-plan-mode.cjs +71 -0
  578. package/dist/runtime/statewire-plan-mode.cjs.map +1 -0
  579. package/dist/runtime/statewire-plan-mode.d.ts +88 -0
  580. package/dist/runtime/statewire-plan-mode.js +71 -0
  581. package/dist/runtime/statewire-plan-mode.js.map +1 -0
  582. package/dist/runtime/statewire-run-config.cjs +18 -1
  583. package/dist/runtime/statewire-run-config.cjs.map +1 -1
  584. package/dist/runtime/statewire-run-config.d.ts +20 -0
  585. package/dist/runtime/statewire-run-config.js +18 -1
  586. package/dist/runtime/statewire-run-config.js.map +1 -1
  587. package/dist/runtime/statewire-session-key.cjs +11 -5
  588. package/dist/runtime/statewire-session-key.cjs.map +1 -1
  589. package/dist/runtime/statewire-session-key.d.ts +22 -10
  590. package/dist/runtime/statewire-session-key.js +11 -5
  591. package/dist/runtime/statewire-session-key.js.map +1 -1
  592. package/dist/runtime/useAthenaStatewireRuntime.cjs +65 -8
  593. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
  594. package/dist/runtime/useAthenaStatewireRuntime.d.ts +26 -10
  595. package/dist/runtime/useAthenaStatewireRuntime.js +67 -10
  596. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
  597. package/dist/search/useAthenaAssets.cjs +394 -0
  598. package/dist/search/useAthenaAssets.cjs.map +1 -0
  599. package/dist/search/useAthenaAssets.d.ts +186 -0
  600. package/dist/search/useAthenaAssets.js +394 -0
  601. package/dist/search/useAthenaAssets.js.map +1 -0
  602. package/dist/sheet-range/index.cjs +4 -0
  603. package/dist/sheet-range/index.cjs.map +1 -1
  604. package/dist/sheet-range/index.d.ts +4 -2
  605. package/dist/sheet-range/index.js +4 -0
  606. package/dist/sheet-range/index.js.map +1 -1
  607. package/dist/sheet-range/query-range.cjs +102 -0
  608. package/dist/sheet-range/query-range.cjs.map +1 -0
  609. package/dist/sheet-range/query-range.d.ts +46 -0
  610. package/dist/sheet-range/query-range.js +102 -0
  611. package/dist/sheet-range/query-range.js.map +1 -0
  612. package/dist/styles.css +1 -1
  613. package/dist/subagents/index.cjs +49 -0
  614. package/dist/subagents/index.cjs.map +1 -0
  615. package/dist/subagents/index.d.ts +16 -0
  616. package/dist/subagents/index.js +49 -0
  617. package/dist/subagents/index.js.map +1 -0
  618. package/dist/subagents/lane-follow.cjs +19 -0
  619. package/dist/subagents/lane-follow.cjs.map +1 -0
  620. package/dist/subagents/lane-follow.d.ts +9 -0
  621. package/dist/subagents/lane-follow.js +19 -0
  622. package/dist/subagents/lane-follow.js.map +1 -0
  623. package/dist/subagents/lane-model.cjs +178 -0
  624. package/dist/subagents/lane-model.cjs.map +1 -0
  625. package/dist/subagents/lane-model.d.ts +140 -0
  626. package/dist/subagents/lane-model.js +178 -0
  627. package/dist/subagents/lane-model.js.map +1 -0
  628. package/dist/subagents/lane-parts.cjs +517 -0
  629. package/dist/subagents/lane-parts.cjs.map +1 -0
  630. package/dist/subagents/lane-parts.d.ts +130 -0
  631. package/dist/subagents/lane-parts.js +517 -0
  632. package/dist/subagents/lane-parts.js.map +1 -0
  633. package/dist/subagents/subagent-lane-group.cjs +215 -0
  634. package/dist/subagents/subagent-lane-group.cjs.map +1 -0
  635. package/dist/subagents/subagent-lane-group.d.ts +67 -0
  636. package/dist/subagents/subagent-lane-group.js +215 -0
  637. package/dist/subagents/subagent-lane-group.js.map +1 -0
  638. package/dist/subagents/subagent-transcript-drawer.cjs +431 -0
  639. package/dist/subagents/subagent-transcript-drawer.cjs.map +1 -0
  640. package/dist/subagents/subagent-transcript-drawer.d.ts +78 -0
  641. package/dist/subagents/subagent-transcript-drawer.js +431 -0
  642. package/dist/subagents/subagent-transcript-drawer.js.map +1 -0
  643. package/dist/subagents/task-subagent-group.cjs +115 -0
  644. package/dist/subagents/task-subagent-group.cjs.map +1 -0
  645. package/dist/subagents/task-subagent-group.d.ts +36 -0
  646. package/dist/subagents/task-subagent-group.js +115 -0
  647. package/dist/subagents/task-subagent-group.js.map +1 -0
  648. package/dist/subagents/use-omitted-images-in-view.cjs +68 -0
  649. package/dist/subagents/use-omitted-images-in-view.cjs.map +1 -0
  650. package/dist/subagents/use-omitted-images-in-view.d.ts +21 -0
  651. package/dist/subagents/use-omitted-images-in-view.js +68 -0
  652. package/dist/subagents/use-omitted-images-in-view.js.map +1 -0
  653. package/dist/threads/Inbox.cjs +2 -2
  654. package/dist/threads/Inbox.cjs.map +1 -1
  655. package/dist/threads/SessionList.cjs +27 -24
  656. package/dist/threads/SessionList.cjs.map +1 -1
  657. package/dist/threads/SessionList.js +22 -19
  658. package/dist/threads/SessionList.js.map +1 -1
  659. package/dist/threads/SessionsPage.cjs +13 -7
  660. package/dist/threads/SessionsPage.cjs.map +1 -1
  661. package/dist/threads/SessionsPage.d.ts +10 -1
  662. package/dist/threads/SessionsPage.js +9 -3
  663. package/dist/threads/SessionsPage.js.map +1 -1
  664. package/dist/threads/live-session-rows.cjs +207 -0
  665. package/dist/threads/live-session-rows.cjs.map +1 -0
  666. package/dist/threads/live-session-rows.d.ts +175 -0
  667. package/dist/threads/live-session-rows.js +207 -0
  668. package/dist/threads/live-session-rows.js.map +1 -0
  669. package/dist/threads/session-list-model.cjs.map +1 -1
  670. package/dist/threads/session-list-model.d.ts +2 -1
  671. package/dist/threads/session-list-model.js.map +1 -1
  672. package/dist/threads/session-row-parts.cjs +3 -3
  673. package/dist/threads/session-row-parts.cjs.map +1 -1
  674. package/dist/threads/sessions-page-model.cjs +13 -5
  675. package/dist/threads/sessions-page-model.cjs.map +1 -1
  676. package/dist/threads/sessions-page-model.d.ts +7 -0
  677. package/dist/threads/sessions-page-model.js +11 -3
  678. package/dist/threads/sessions-page-model.js.map +1 -1
  679. package/dist/threads/sessions-page-storage.cjs +8 -8
  680. package/dist/threads/sessions-page-storage.cjs.map +1 -1
  681. package/dist/threads/sessions-page-storage.d.ts +5 -1
  682. package/dist/threads/sessions-page-storage.js +8 -8
  683. package/dist/threads/sessions-page-storage.js.map +1 -1
  684. package/dist/threads/statewire-thread-list.cjs +173 -20
  685. package/dist/threads/statewire-thread-list.cjs.map +1 -1
  686. package/dist/threads/statewire-thread-list.d.ts +44 -1
  687. package/dist/threads/statewire-thread-list.js +174 -21
  688. package/dist/threads/statewire-thread-list.js.map +1 -1
  689. package/dist/threads/use-athena-sessions.cjs +1 -0
  690. package/dist/threads/use-athena-sessions.cjs.map +1 -1
  691. package/dist/threads/use-athena-sessions.d.ts +7 -0
  692. package/dist/threads/use-athena-sessions.js +1 -0
  693. package/dist/threads/use-athena-sessions.js.map +1 -1
  694. package/dist/threads/use-athena-thread-agent.cjs +31 -0
  695. package/dist/threads/use-athena-thread-agent.cjs.map +1 -0
  696. package/dist/threads/use-athena-thread-agent.d.ts +38 -0
  697. package/dist/threads/use-athena-thread-agent.js +31 -0
  698. package/dist/threads/use-athena-thread-agent.js.map +1 -0
  699. package/dist/threads/use-athena-thread-plan-mode.cjs +18 -0
  700. package/dist/threads/use-athena-thread-plan-mode.cjs.map +1 -0
  701. package/dist/threads/use-athena-thread-plan-mode.d.ts +18 -0
  702. package/dist/threads/use-athena-thread-plan-mode.js +18 -0
  703. package/dist/threads/use-athena-thread-plan-mode.js.map +1 -0
  704. package/dist/threads/use-rest-conversation-history.d.ts +1 -0
  705. package/dist/tools/agent-creations.cjs +97 -0
  706. package/dist/tools/agent-creations.cjs.map +1 -0
  707. package/dist/tools/agent-creations.d.ts +38 -0
  708. package/dist/tools/agent-creations.js +97 -0
  709. package/dist/tools/agent-creations.js.map +1 -0
  710. package/dist/tools/agent-highlights.cjs +100 -0
  711. package/dist/tools/agent-highlights.cjs.map +1 -0
  712. package/dist/tools/agent-highlights.d.ts +57 -0
  713. package/dist/tools/agent-highlights.js +100 -0
  714. package/dist/tools/agent-highlights.js.map +1 -0
  715. package/dist/tools/append-document-tool-ui.cjs +1 -0
  716. package/dist/tools/append-document-tool-ui.cjs.map +1 -1
  717. package/dist/tools/append-document-tool-ui.d.ts +7 -0
  718. package/dist/tools/append-document-tool-ui.js +2 -1
  719. package/dist/tools/append-document-tool-ui.js.map +1 -1
  720. package/dist/tools/auto-open-tools.cjs +144 -71
  721. package/dist/tools/auto-open-tools.cjs.map +1 -1
  722. package/dist/tools/auto-open-tools.d.ts +131 -1
  723. package/dist/tools/auto-open-tools.js +145 -72
  724. package/dist/tools/auto-open-tools.js.map +1 -1
  725. package/dist/tools/browser-tool-uis.cjs +594 -0
  726. package/dist/tools/browser-tool-uis.cjs.map +1 -0
  727. package/dist/tools/browser-tool-uis.d.ts +8 -0
  728. package/dist/tools/browser-tool-uis.js +594 -0
  729. package/dist/tools/browser-tool-uis.js.map +1 -0
  730. package/dist/tools/computer-asset-tool-uis.cjs +313 -0
  731. package/dist/tools/computer-asset-tool-uis.cjs.map +1 -0
  732. package/dist/tools/computer-asset-tool-uis.d.ts +5 -0
  733. package/dist/tools/computer-asset-tool-uis.js +313 -0
  734. package/dist/tools/computer-asset-tool-uis.js.map +1 -0
  735. package/dist/tools/document-edit-tool-uis.cjs +218 -0
  736. package/dist/tools/document-edit-tool-uis.cjs.map +1 -0
  737. package/dist/tools/document-edit-tool-uis.d.ts +40 -0
  738. package/dist/tools/document-edit-tool-uis.js +218 -0
  739. package/dist/tools/document-edit-tool-uis.js.map +1 -0
  740. package/dist/tools/drive-tool-uis.cjs +425 -0
  741. package/dist/tools/drive-tool-uis.cjs.map +1 -0
  742. package/dist/tools/drive-tool-uis.d.ts +120 -0
  743. package/dist/tools/drive-tool-uis.js +425 -0
  744. package/dist/tools/drive-tool-uis.js.map +1 -0
  745. package/dist/tools/email-calendar-tool-uis.cjs +789 -0
  746. package/dist/tools/email-calendar-tool-uis.cjs.map +1 -0
  747. package/dist/tools/email-calendar-tool-uis.d.ts +129 -0
  748. package/dist/tools/email-calendar-tool-uis.js +789 -0
  749. package/dist/tools/email-calendar-tool-uis.js.map +1 -0
  750. package/dist/tools/ontology-tool-uis.cjs +83 -0
  751. package/dist/tools/ontology-tool-uis.cjs.map +1 -0
  752. package/dist/tools/ontology-tool-uis.d.ts +9 -0
  753. package/dist/tools/ontology-tool-uis.js +83 -0
  754. package/dist/tools/ontology-tool-uis.js.map +1 -0
  755. package/dist/tools/orchestration-tool-uis.cjs +586 -0
  756. package/dist/tools/orchestration-tool-uis.cjs.map +1 -0
  757. package/dist/tools/orchestration-tool-uis.d.ts +141 -0
  758. package/dist/tools/orchestration-tool-uis.js +586 -0
  759. package/dist/tools/orchestration-tool-uis.js.map +1 -0
  760. package/dist/tools/presentation-edit-tool-uis.cjs +516 -0
  761. package/dist/tools/presentation-edit-tool-uis.cjs.map +1 -0
  762. package/dist/tools/presentation-edit-tool-uis.d.ts +73 -0
  763. package/dist/tools/presentation-edit-tool-uis.js +516 -0
  764. package/dist/tools/presentation-edit-tool-uis.js.map +1 -0
  765. package/dist/tools/project-tool-uis.cjs +213 -0
  766. package/dist/tools/project-tool-uis.cjs.map +1 -0
  767. package/dist/tools/project-tool-uis.d.ts +14 -0
  768. package/dist/tools/project-tool-uis.js +213 -0
  769. package/dist/tools/project-tool-uis.js.map +1 -0
  770. package/dist/tools/sandbox-tool-uis.cjs +491 -0
  771. package/dist/tools/sandbox-tool-uis.cjs.map +1 -0
  772. package/dist/tools/sandbox-tool-uis.d.ts +116 -0
  773. package/dist/tools/sandbox-tool-uis.js +491 -0
  774. package/dist/tools/sandbox-tool-uis.js.map +1 -0
  775. package/dist/tools/sheet-query-tool-ui.cjs +138 -0
  776. package/dist/tools/sheet-query-tool-ui.cjs.map +1 -0
  777. package/dist/tools/sheet-query-tool-ui.d.ts +15 -0
  778. package/dist/tools/sheet-query-tool-ui.js +138 -0
  779. package/dist/tools/sheet-query-tool-ui.js.map +1 -0
  780. package/dist/tools/studio-screenshot-tool-uis.cjs +262 -0
  781. package/dist/tools/studio-screenshot-tool-uis.cjs.map +1 -0
  782. package/dist/tools/studio-screenshot-tool-uis.d.ts +52 -0
  783. package/dist/tools/studio-screenshot-tool-uis.js +262 -0
  784. package/dist/tools/studio-screenshot-tool-uis.js.map +1 -0
  785. package/dist/tools/subagent-task-tool-ui.cjs +24 -475
  786. package/dist/tools/subagent-task-tool-ui.cjs.map +1 -1
  787. package/dist/tools/subagent-task-tool-ui.d.ts +19 -103
  788. package/dist/tools/subagent-task-tool-ui.js +28 -479
  789. package/dist/tools/subagent-task-tool-ui.js.map +1 -1
  790. package/dist/tools/tool-summary.cjs +36 -0
  791. package/dist/tools/tool-summary.cjs.map +1 -1
  792. package/dist/tools/tool-summary.js +36 -0
  793. package/dist/tools/tool-summary.js.map +1 -1
  794. package/dist/tools/tool-uis.cjs +181 -53
  795. package/dist/tools/tool-uis.cjs.map +1 -1
  796. package/dist/tools/tool-uis.d.ts +40 -0
  797. package/dist/tools/tool-uis.js +183 -55
  798. package/dist/tools/tool-uis.js.map +1 -1
  799. package/dist/typed-interrupts/index.cjs +15 -0
  800. package/dist/typed-interrupts/index.cjs.map +1 -0
  801. package/dist/typed-interrupts/index.d.ts +20 -0
  802. package/dist/typed-interrupts/index.js +15 -0
  803. package/dist/typed-interrupts/index.js.map +1 -0
  804. package/dist/workbench/session-workbench-panes.cjs +6 -6
  805. package/dist/workbench/session-workbench-panes.cjs.map +1 -1
  806. package/package.json +28 -6
  807. package/dist/agent-runtime/src/chat-outbox-store.cjs +0 -510
  808. package/dist/agent-runtime/src/chat-outbox-store.cjs.map +0 -1
  809. package/dist/agent-runtime/src/chat-outbox-store.d.ts +0 -210
  810. package/dist/agent-runtime/src/chat-outbox-store.js +0 -510
  811. package/dist/agent-runtime/src/chat-outbox-store.js.map +0 -1
@@ -44,10 +44,11 @@ export interface DeepAgentFailedSend {
44
44
  text: string;
45
45
  }
46
46
  /**
47
- * The sends the thread retains in its failed lane (`runs.failed`, read
48
- * structurally off the thread extras). A withdrawn turn never lands there —
49
- * its send was accepted — so the lane tells a failed send's text apart from a
50
- * stop verdict's echo of the same words. Absent extras or lane read as empty.
47
+ * The sends the thread holds for a failure (`runs.held` entries whose outbox
48
+ * entry carries `localMeta.error`, see `readStatewireFailedSends`). A withdrawn
49
+ * turn never lands there — its send was accepted — so the held failures tell a
50
+ * failed send's text apart from a stop verdict's echo of the same words.
51
+ * Absent extras or lane read as empty.
51
52
  */
52
53
  export declare function readDeepAgentFailedSends(extras: unknown): DeepAgentFailedSend[];
53
54
  /**
@@ -0,0 +1,174 @@
1
+ /**
2
+ * Whether a device can hold a Word document in the Word editor, decided before the editor opens it
3
+ * (Word at scale, owner decision D3, 2026-11-05). A device that can't is shown the document's pages
4
+ * as Athena renders them, read-only, and told why: never an editor that runs the device out of
5
+ * memory, crashes the tab or leaves a blank view. Every app reads its limits here: Athena on the
6
+ * web, the desktop app and the phone app.
7
+ *
8
+ * The editor holds the whole document: its room (a Yjs document), the ProseMirror document bound to
9
+ * it, the layout of every page and, today, a hidden editable copy of the whole body in the page's
10
+ * DOM. What it costs grows with the document's ProseMirror nodes, so a document is measured by the
11
+ * nodes and room bytes its import recorded on the asset (`athena_metadata.word_room_nodes`,
12
+ * `word_room_bytes`, written by agora's Word upload import since #50617), or, for a room written
13
+ * before that, by its size on Keryx (a probe each app makes its own way). A device's limit is a
14
+ * number of nodes and a number of room bytes: over either, the document is too large for it. The
15
+ * recorded size is the import's: a room that grew since is weighed at that size (edits rarely grow a
16
+ * document by much; the limits keep a margin, and a phone that still runs out of memory shows the
17
+ * pages). Keeping the size current as the room changes is a follow-up.
18
+ *
19
+ * Measurements behind the limits (Word at scale, 2026-11-02 to 11-05). The documents: A, a 736-page
20
+ * report (232,568 nodes, a 127 MiB room, 37 tables), and B, a 305-page tenancy guide (21,293 nodes,
21
+ * 82 MiB with its pictures in the room, 10,000 tracked changes).
22
+ *
23
+ * - Chrome 156, the editor alone, no Athena shell (R1, `scaling-study.md` §2, 2026-11-05):
24
+ * JS heap after GC and renderer RSS once every page is painted: one page 33 MiB / 446 MiB;
25
+ * B 112 / 1,463 MiB; a 794-page prose document (58,327 nodes) 229 / 1,534 MiB; a 2,000-row
26
+ * table document (89,494 nodes) 379 / 1,930 MiB; A 935 MiB (1,541 before GC) / 4,522 MiB. The
27
+ * live heap is 3.4 to 4.0 KiB a node on every one of them; the renderer is about 450 MiB plus
28
+ * 18 KiB a node (the hidden editor's DOM: 383,000 elements on A), plus decoded pictures.
29
+ * - Chrome 156, the whole asset page with the Athena shell's 0.5 GiB held and 10% of the heap
30
+ * spare (L8, `word-client-memory.md`, 2026-11-03): a 2 GiB heap (the heap Chrome gives a page on
31
+ * an 8 GB machine) opens 162,000 of A's nodes and crashes at 174,000; 150,000 is the limit with
32
+ * margin. A 4 GiB heap (16 GB and more) opens A whole and would open 370,000 such nodes.
33
+ * - Chrome gives a page a JS heap of a quarter of the machine's memory, at most 4 GiB:
34
+ * `performance.memory.jsHeapSizeLimit` says which (4 GiB on 16 GB and more, 2 GiB on 8 GB).
35
+ * `navigator.deviceMemory` says the machine's memory as a power of two: Chrome 156 on a 128 GB
36
+ * Mac says 32 and a 4.09 GiB heap (4,395,630,592 bytes; 2.09 GiB with the heap capped at 2 GiB);
37
+ * older Chromium never says more than 8, so 8 alone never counts as 16 GB: the heap must say so.
38
+ * The desktop app's Electron 45 on the same Mac reports no `deviceMemory` and a heap of
39
+ * 3,760,000,000 bytes (2,330,000,000 capped at 2 GiB): its preload's exact memory says the rest.
40
+ * - Phones: see `PHONE_WORD_EDITOR_BUDGET`.
41
+ *
42
+ * Revisit once the windowed editor (lane L14) lands: it removes most of the hidden editor's DOM
43
+ * (about 0.5 GiB of renderer memory on A), which moves every renderer-bound limit up.
44
+ */
45
+ /** Whether a Word document fits a device's editor. */
46
+ export declare const WordEditorFit: {
47
+ /** The editor opens it. */
48
+ readonly Fits: "fits";
49
+ /** Too large for this device's editor: shown as its pages. */
50
+ readonly TooLarge: "too-large";
51
+ /** Not known: nothing recorded and nothing probed yet, or the device gives no signal. */
52
+ readonly Unknown: "unknown";
53
+ };
54
+ export type WordEditorFit = (typeof WordEditorFit)[keyof typeof WordEditorFit];
55
+ /** How large a Word document's room is: its ProseMirror nodes and its encoded (Yjs V1) bytes. */
56
+ export interface WordRoomSize {
57
+ nodes: number | null;
58
+ bytes: number | null;
59
+ }
60
+ /** The largest Word document a device's editor opens. */
61
+ export interface WordEditorBudget {
62
+ /** The most ProseMirror nodes (text nodes included, as `word_room_nodes` counts them). */
63
+ maxNodes: number;
64
+ /** The most room bytes (as `word_room_bytes` counts them). */
65
+ maxBytes: number;
66
+ }
67
+ /** The metadata keys agora's Word upload import writes (`agora/agora/services/upload/word_upload_import.py`). */
68
+ export declare const WORD_ROOM_NODES_METADATA_KEY = "word_room_nodes";
69
+ export declare const WORD_ROOM_BYTES_METADATA_KEY = "word_room_bytes";
70
+ /**
71
+ * What an asset's metadata records of its room (`athena_metadata`, an object or its JSON). Rooms
72
+ * imported before #50617, and documents never imported from a file, record neither.
73
+ */
74
+ export declare function recordedWordRoomSize(metadata: unknown): WordRoomSize;
75
+ /**
76
+ * A phone's editor (the app's editor page, or the web embed, in one web view). The system ends a
77
+ * web view's content process past its memory limit: about 1.5 GiB on the iPhones the app supports
78
+ * (the limit is the system's and grows with the phone's memory), about the same for Android's
79
+ * renderer. The editor page itself takes about 0.3 GiB before any document.
80
+ *
81
+ * WebKit, the engine of the iPhone's web view (Playwright's WebKit on an M3 Mac, the editor page at
82
+ * an iPhone's 390 x 844 at 3x, staging 2026-11-05; L18): the content process's physical footprint,
83
+ * the number iOS ends a process by, once every page is laid out and the pages are quiet, end / peak
84
+ * (one run, load 60-80; an earlier run read before the last pages agreed within 0.2 GiB):
85
+ *
86
+ * | document | nodes | room | footprint |
87
+ * |---|---|---|---|
88
+ * | one page | 217 | 0.3 MiB | 0.30 / 0.32 GiB |
89
+ * | 100 pages of B's prose | 7,434 | 9.6 MiB | 0.70 / 0.72 GiB |
90
+ * | 200 pages of B's prose | 14,591 | 18.9 MiB | 0.84 / 0.91 GiB |
91
+ * | A's first 10% (62 pages, its tables) | 20,133 | 11.3 MiB | 1.4 / 1.4 GiB |
92
+ * | B (pictures in the room) | 21,293 | 81.9 MiB | 1.3 / 1.4 GiB |
93
+ * | 500 rows of A's table | 23,452 | 11.9 MiB | 1.2 / 1.2 GiB |
94
+ * | 400 pages of B's prose | 29,005 | 37.2 MiB | 1.3 / 1.4 GiB |
95
+ * | A's first 15% | 32,107 | 17.4 MiB | 1.8 / 1.8 GiB |
96
+ * | A's first 20% | 43,917 | 23.2 MiB | 1.6 / 1.6 GiB |
97
+ * | A's first 25% | 55,844 | 29.1 MiB | 1.5 / 1.7 GiB |
98
+ *
99
+ * So 20,000 nodes keeps every kind measured (prose, tables, pictures) at about 1.4 GiB or under
100
+ * with the document open; past it a table-heavy document reaches 1.6 to 1.8 GiB. B (21,293 nodes)
101
+ * reads as pages on a phone. L9's 40,000 (measured 2026-11-02 in JavaScriptCore without a DOM,
102
+ * about 12 KiB a node) would let a table-heavy document past 1.6 GiB. 32 MiB of room is what 20,000
103
+ * nodes of B's prose take (1.35 KiB a node), so the bytes limit only catches rooms heavier than that
104
+ * per node (pictures held in an older room).
105
+ * Measured off the phone (no device or simulator here): refine with a device run.
106
+ *
107
+ * A document the limits let through that still runs the phone out of memory is caught when its
108
+ * page's content process dies, and is shown as its pages from then on.
109
+ */
110
+ export declare const PHONE_WORD_EDITOR_BUDGET: WordEditorBudget;
111
+ /**
112
+ * A computer's limits from what its browser or app says of its memory, or `null` when it says
113
+ * nothing (Safari, Firefox): the editor opens as it always has.
114
+ *
115
+ * - `heapLimitBytes`: the JS heap the page may grow to, `performance.memory.jsHeapSizeLimit`
116
+ * (Chromium browsers and the desktop app).
117
+ * - `memoryBytes`: the machine's memory: exact in the desktop app (its preload reads it), or
118
+ * Chromium's `navigator.deviceMemory` in GiB, a power of two (`memoryAtLeast`: 8 from a Chromium
119
+ * that caps it there, "8 GiB or more").
120
+ */
121
+ export declare function computerWordEditorBudget({ heapLimitBytes, memoryBytes, memoryAtLeast, }: {
122
+ heapLimitBytes: number | null;
123
+ memoryBytes: number | null;
124
+ memoryAtLeast?: boolean;
125
+ }): WordEditorBudget | null;
126
+ /** `navigator.deviceMemory`'s largest value in older Chromium (Chrome 156 reports up to 32). */
127
+ export declare const DEVICE_MEMORY_CAP_GIB = 8;
128
+ /**
129
+ * What a Chromium page says of its memory, from `navigator.deviceMemory` (GiB) and
130
+ * `performance.memory.jsHeapSizeLimit` (bytes), each absent outside Chromium.
131
+ */
132
+ export declare function browserMemorySignals({ deviceMemoryGiB, jsHeapSizeLimit, }: {
133
+ deviceMemoryGiB: unknown;
134
+ jsHeapSizeLimit: unknown;
135
+ }): {
136
+ heapLimitBytes: number | null;
137
+ memoryBytes: number | null;
138
+ memoryAtLeast: boolean;
139
+ };
140
+ /**
141
+ * Whether a document fits a device's editor: over either limit is too large; both known and under
142
+ * fits; anything else (nothing recorded, no signal) is not known.
143
+ */
144
+ export declare function wordEditorFit({ size, budget, }: {
145
+ size: WordRoomSize;
146
+ budget: WordEditorBudget | null;
147
+ }): WordEditorFit;
148
+ /** A room's size as Keryx declared it before its body: exact, or a lower bound (a compressed answer). */
149
+ export interface ProbedWordRoom {
150
+ bytes: number;
151
+ exact: boolean;
152
+ }
153
+ /**
154
+ * Whether a room nothing recorded fits, from its size on Keryx: over the byte limit is too large (a
155
+ * compressed length too: the room is larger still); an exact length under it fits; anything else
156
+ * says nothing.
157
+ */
158
+ export declare function wordEditorFitOfProbe({ probe, budget, }: {
159
+ probe: ProbedWordRoom | null;
160
+ budget: WordEditorBudget | null;
161
+ }): WordEditorFit;
162
+ /** What a device too small for a document says, in Athena's words, wherever it is said. */
163
+ export declare const WORD_TOO_LARGE_COPY: {
164
+ readonly phone: {
165
+ readonly title: "Too large to edit on this phone";
166
+ readonly detail: "You’re reading its pages. Open it on a computer to edit it.";
167
+ };
168
+ readonly computer: {
169
+ readonly title: "Too large to edit on this device";
170
+ readonly detail: "This document needs more memory than this device can give the editor, so you’re reading its pages.";
171
+ readonly openEditor: "Open the editor anyway";
172
+ readonly openEditorHint: "The editor may run out of memory on this device.";
173
+ };
174
+ };
@@ -0,0 +1,127 @@
1
+ /** The `runConfig.custom` key a send names the chat's computer under. */
2
+ export declare const WORK_IN_CUSTOM_KEY = "work_in";
3
+ /** The session asset's `athena_metadata` key agora records the chat's computer under. */
4
+ export declare const WORK_IN_RECORD_KEY = "work_in_computer";
5
+ /** The longest computer title agora records (`work_in.TITLE_MAX_CHARS`). */
6
+ export declare const WORK_IN_TITLE_MAX_CHARS = 120;
7
+ /** What a send carries to pin its chat to a computer. */
8
+ export interface WorkInRunConfigCustom {
9
+ work_in: {
10
+ kind: "computer";
11
+ asset_id: string;
12
+ };
13
+ }
14
+ /**
15
+ * The `runConfig.custom` entry pinning a chat to `assetId`, or an empty object for an id agora
16
+ * would refuse to read (so the chat keeps its own sandbox rather than sending a forged shape).
17
+ */
18
+ export declare function workInRunConfigCustom({ assetId, }: {
19
+ assetId: string | null | undefined;
20
+ }): WorkInRunConfigCustom | Record<string, never>;
21
+ /** The computer a conversation works on, as agora recorded it. */
22
+ export interface WorkInComputer {
23
+ assetId: string;
24
+ /** The computer's title when agora recorded it; `null` in a residency-pinned workspace. */
25
+ title: string | null;
26
+ }
27
+ /**
28
+ * The computer agora recorded for this conversation, for `viewerId`; `null` when there is
29
+ * nothing to show: no record (an older agora, a refused bind, or anyone but the owner, whom agora
30
+ * never serves it), a malformed one, or a record someone else's run wrote.
31
+ */
32
+ export declare function readWorkInRecord({ metadata, viewerId, }: {
33
+ metadata: unknown;
34
+ viewerId: string | null | undefined;
35
+ }): WorkInComputer | null;
36
+ /** The fields of a listed computer {@link computerEditAccess} reads. */
37
+ export interface ListedComputer {
38
+ createdBy?: string | null;
39
+ workspaceAccess?: string | null;
40
+ sharedWith?: ReadonlyArray<{
41
+ userId?: string | null;
42
+ permissionType?: string | null;
43
+ }> | null;
44
+ }
45
+ /**
46
+ * What a computer list can tell of `viewerId`'s edit access to `asset`, from its own fields:
47
+ *
48
+ * - `edit`: they created it, or it is shared with them, or with the whole workspace, to edit;
49
+ * - `group`: they see a private computer through none of those, so through a workspace group,
50
+ * whose level the list doesn't carry (agora's `myEffectivePermission` would cost a read per row);
51
+ * - `view`: shared with them, or the workspace, to view or review only.
52
+ *
53
+ * "Your computers" offers `edit` and `group` (saying a group's level is checked when the chat
54
+ * starts). Display only: agora checks EDIT when the chat binds the computer, every run and every
55
+ * command.
56
+ */
57
+ export declare function computerEditAccess({ asset, viewerId, }: {
58
+ asset: ListedComputer;
59
+ viewerId: string | null | undefined;
60
+ }): "edit" | "group" | "view";
61
+ /** "Cloud · {computer}", the line a chat pinned to a computer shows where its folder would be. */
62
+ export declare function workInCloudLabel({ title }: {
63
+ title: string | null;
64
+ }): string;
65
+ /** The `runConfig.custom` key a folder chat's move to the cloud rides under, beside `work_in`. */
66
+ export declare const WORK_IN_HANDOFF_CUSTOM_KEY = "work_in_handoff";
67
+ /** The `runConfig.custom` key a moved chat's hand-back to its folder rides under. */
68
+ export declare const WORK_IN_HANDBACK_CUSTOM_KEY = "work_in_handback";
69
+ /**
70
+ * Whether `repo` names a hosted repository as agora takes it (`work_in.clean_repo`): a lowercase
71
+ * host with a dot, then two to eight path parts (`github.com/org/repo`), never a scheme, a user,
72
+ * a password or token, a port or a local path.
73
+ */
74
+ export declare function isHandoffRepo(repo: string): boolean;
75
+ /** What a folder chat's move to the cloud names: its branch, origin and where it started. */
76
+ export interface WorkInHandoff {
77
+ /** The chat's own branch (`athena/chat-…`). */
78
+ branch: string;
79
+ /** origin as a host and a path (`github.com/org/repo`). */
80
+ repo: string;
81
+ /** The commit the chat's worktree started from. */
82
+ base: string;
83
+ }
84
+ /** What the move's send carries beside the folder. */
85
+ export interface WorkInHandoffRunConfigCustom extends WorkInRunConfigCustom {
86
+ work_in_handoff: {
87
+ from: "folder";
88
+ branch: string;
89
+ repo: string;
90
+ base: string;
91
+ };
92
+ }
93
+ /**
94
+ * The `runConfig.custom` entries moving a folder chat to `assetId`, or an empty object when any
95
+ * part is one agora would refuse (so no forged move is ever sent).
96
+ */
97
+ export declare function workInHandoffRunConfigCustom({ assetId, handoff, }: {
98
+ assetId: string | null | undefined;
99
+ handoff: WorkInHandoff;
100
+ }): WorkInHandoffRunConfigCustom | Record<string, never>;
101
+ /** What the hand-back's send carries beside the folder. */
102
+ export interface WorkInHandbackRunConfigCustom {
103
+ work_in_handback: {
104
+ to: "folder";
105
+ branch: string;
106
+ };
107
+ }
108
+ /** The `runConfig.custom` entry handing a moved chat back to its folder, or an empty object. */
109
+ export declare function workInHandbackRunConfigCustom({ branch, }: {
110
+ branch: string;
111
+ }): WorkInHandbackRunConfigCustom | Record<string, never>;
112
+ /** A conversation agora recorded as moved to a computer from a folder. */
113
+ export interface WorkInMoved extends WorkInComputer {
114
+ /** The branch it moved with: the client matches it to its own chat's. */
115
+ branch: string;
116
+ /** origin as a host and a path. */
117
+ repo: string;
118
+ }
119
+ /**
120
+ * The move agora recorded for this conversation, for `viewerId`; `null` when it is in no cloud
121
+ * by a move: no record (an older agora, a refused move, after a hand-back, anyone but the
122
+ * owner), a computer chosen in Work in (no handoff), a malformed one, or someone else's.
123
+ */
124
+ export declare function readWorkInHandoff({ metadata, viewerId, }: {
125
+ metadata: unknown;
126
+ viewerId: string | null | undefined;
127
+ }): WorkInMoved | null;
@@ -1 +1 @@
1
- {"version":3,"file":"AthenaAssetEmbed.cjs","sources":["../../src/assets/AthenaAssetEmbed.tsx"],"sourcesContent":["\"use client\";\n\nimport { AlertCircle, Loader2 } from \"lucide-react\";\nimport { type CSSProperties, type FC, type IframeHTMLAttributes, useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { cn } from \"../lib/utils\";\nimport { useAthenaConfig } from \"../provider/AthenaContext\";\nimport {\n ATHENA_ASSET_EMBED_CONFIG_MESSAGE,\n type AthenaAssetCitationActionEvent,\n type AthenaAssetCitationBehavior,\n type AthenaAssetCitationClickEvent,\n type AthenaAssetCitationReference,\n isAthenaAssetCitationActionEvent,\n isAthenaAssetCitationClickEvent,\n isAthenaAssetEmbedReadyEvent,\n isAthenaAssetEmbedContentReadyEvent,\n resolveAthenaAssetCitationActionBehavior,\n resolveAthenaAssetCitationBehavior,\n} from \"./asset-embed-messages\";\nimport {\n buildSdkAssetEmbedUrl,\n DEFAULT_ASSET_EMBED_ALLOW_COMMENTS,\n DEFAULT_ASSET_EMBED_ALLOW_QUICK_EDIT,\n DEFAULT_ASSET_EMBED_DISPLAY_MODE,\n DEFAULT_ASSET_EMBED_READ_ONLY,\n useAssetEmbed,\n} from \"./use-asset-embed\";\n\nexport interface AthenaAssetEmbedProps extends Omit<\n IframeHTMLAttributes<HTMLIFrameElement>,\n \"src\" | \"onError\" | \"onLoad\"\n> {\n assetId: string;\n /** Optional citation target to open inside the embedded asset, such as a PDF page. */\n reference?: AthenaAssetCitationReference;\n /** Defaults to the native full asset experience. */\n displayMode?: \"minimal\" | \"full\";\n /**\n * Defaults to false so authorized users can edit the embedded asset. Any type that keeps comment\n * threads (a Word document, an Athena document, a spreadsheet, a deck, a user interface, a\n * notebook, a PDF, ...) edits only for a viewer signed in to Athena with their own access to the\n * asset: the provider's `token` (or this component's `token`), which this component hands the\n * frame. Anyone else views it read-only.\n */\n readOnly?: boolean;\n /**\n * Offer Quick Edit (⌘J) in a minimal embed (`displayMode=\"minimal\"`): spreadsheets, Word\n * documents and decks, on an editable link (`readOnly: false`) only, to a viewer signed in to\n * Athena with their own access to the asset (the provider's `token`). Billed to the asset's\n * workspace, with an hourly cap per link; the full mode's editors offer it to the signed-in person\n * already. Defaults to false. Ignored with `embedUrl`: a link the host minted says itself.\n */\n allowQuickEdit?: boolean;\n /**\n * The bearer to hand the frame instead of the provider's `token`: for a host that signs its person\n * in with a key it must never hand a frame (Athena's desktop app), the short-lived viewer token\n * agora mints for this link (`POST /api/embed/{token}/viewer-token`), so the frame is the signed-in\n * person. Sent only to the frame's own origin, never in its URL. Without it the provider's `token`\n * goes, as before.\n */\n token?: string;\n /**\n * Show the asset's comment threads, read-only, to everyone holding the link, a viewer who is not\n * signed in included. Without it a minimal embed shows them only to a signed-in viewer with their\n * own access to the asset. No embed writes a comment. Defaults to false. Ignored with\n * `embedUrl`: a link the host minted says itself.\n */\n allowComments?: boolean;\n expiresInSeconds?: number;\n citationBehavior?: AthenaAssetCitationBehavior;\n onCitationClick?: (event: AthenaAssetCitationClickEvent) => void;\n /** Controls the citation popover's actions, including the (+) Open in Spaces button. */\n citationActionBehavior?: AthenaAssetCitationBehavior;\n onCitationAction?: (event: AthenaAssetCitationActionEvent) => void;\n /**\n * An embed link the host minted itself (`POST /api/embed/generate-token`, its `/embed/<token>/`\n * page): the component shows it and mints none. Without it the component mints one with the\n * provider's credentials, as before.\n */\n embedUrl?: string;\n /** The embedded page said it is ready (its bridge's first message): Athena runs in the frame. */\n onReady?: () => void;\n /** The matching asset viewer has committed usable content in this frame. */\n onContentReady?: () => void;\n onLoad?: () => void;\n onError?: (error: Error) => void;\n loadingFallback?: React.ReactNode;\n errorFallback?: React.ReactNode | ((error: Error) => React.ReactNode);\n}\n\nconst DEFAULT_STYLE: CSSProperties = {\n width: \"100%\",\n height: \"100%\",\n border: 0,\n};\nconst AUTH_SYNC_INTERVAL_MS = 60_000;\n\nexport const AthenaAssetEmbed: FC<AthenaAssetEmbedProps> = ({\n assetId,\n reference,\n displayMode = DEFAULT_ASSET_EMBED_DISPLAY_MODE,\n readOnly = DEFAULT_ASSET_EMBED_READ_ONLY,\n allowQuickEdit = DEFAULT_ASSET_EMBED_ALLOW_QUICK_EDIT,\n allowComments = DEFAULT_ASSET_EMBED_ALLOW_COMMENTS,\n expiresInSeconds,\n citationBehavior,\n onCitationClick,\n citationActionBehavior,\n onCitationAction,\n embedUrl: hostEmbedUrl,\n token: frameToken,\n onReady,\n onContentReady,\n onLoad,\n onError,\n loadingFallback,\n errorFallback,\n className,\n style,\n title,\n allow = \"clipboard-read; clipboard-write; fullscreen\",\n ...iframeProps\n}) => {\n const iframeRef = useRef<HTMLIFrameElement | null>(null);\n const athenaConfig = useAthenaConfig();\n const { backendUrl, appUrl, apiKey } = athenaConfig;\n // A link the host minted is shown as given; the hook then mints nothing (no asset to mint for).\n const minted = useAssetEmbed(hostEmbedUrl ? null : assetId, {\n backendUrl,\n appUrl,\n apiKey,\n token: athenaConfig.token,\n getToken: athenaConfig.getToken,\n readOnly,\n expiresInSeconds,\n displayMode,\n allowQuickEdit,\n allowComments,\n });\n const embedUrl = hostEmbedUrl ?? minted.embedUrl;\n const isLoading = hostEmbedUrl ? false : minted.isLoading;\n const error = hostEmbedUrl ? null : minted.error;\n const targetOrigin = useMemo(() => {\n if (!embedUrl) return null;\n try {\n return new URL(embedUrl, window.location.href).origin;\n } catch {\n return null;\n }\n }, [embedUrl]);\n const iframeSrc = useMemo(\n () => (embedUrl ? buildSdkAssetEmbedUrl(embedUrl, reference) : null),\n [embedUrl, reference],\n );\n const effectiveCitationBehavior = resolveAthenaAssetCitationBehavior({\n citationBehavior,\n hasCitationClickHandler: !!onCitationClick,\n });\n const effectiveCitationActionBehavior = resolveAthenaAssetCitationActionBehavior({\n citationActionBehavior,\n hasCitationActionHandler: !!onCitationAction,\n });\n\n const sendConfig = useCallback(() => {\n if (!targetOrigin) return;\n // Read when sent: the provider renews its token behind a getter on a config that stays the\n // same object, so an embed that does not render again still sends the current one.\n const viewerToken = frameToken ?? athenaConfig.token;\n iframeRef.current?.contentWindow?.postMessage(\n {\n type: ATHENA_ASSET_EMBED_CONFIG_MESSAGE,\n version: 1,\n ...(viewerToken ? { token: viewerToken } : {}),\n citationBehavior: effectiveCitationBehavior,\n citationActionBehavior: effectiveCitationActionBehavior,\n },\n targetOrigin,\n );\n }, [frameToken, athenaConfig, effectiveCitationActionBehavior, effectiveCitationBehavior, targetOrigin]);\n\n useEffect(() => {\n if (!embedUrl || !targetOrigin) return;\n const handleMessage = (event: MessageEvent<unknown>) => {\n if (event.origin !== targetOrigin || event.source !== iframeRef.current?.contentWindow) return;\n if (isAthenaAssetEmbedReadyEvent(event.data)) {\n sendConfig();\n onReady?.();\n return;\n }\n if (isAthenaAssetEmbedContentReadyEvent(event.data)) {\n if (event.data.assetId === assetId) onContentReady?.();\n return;\n }\n if (isAthenaAssetCitationClickEvent(event.data)) {\n onCitationClick?.(event.data);\n return;\n }\n if (isAthenaAssetCitationActionEvent(event.data)) {\n onCitationAction?.(event.data);\n }\n };\n window.addEventListener(\"message\", handleMessage);\n return () => window.removeEventListener(\"message\", handleMessage);\n }, [assetId, embedUrl, onCitationAction, onCitationClick, onReady, onContentReady, sendConfig, targetOrigin]);\n\n useEffect(() => {\n if (!embedUrl) return;\n sendConfig();\n const interval = window.setInterval(sendConfig, AUTH_SYNC_INTERVAL_MS);\n return () => window.clearInterval(interval);\n }, [embedUrl, sendConfig]);\n\n useEffect(() => {\n if (error) onError?.(new Error(error));\n }, [error, onError]);\n\n if (isLoading) {\n return (\n loadingFallback ?? (\n <output className=\"athena-sdk-chrome flex h-full w-full items-center justify-center\">\n <Loader2 className=\"size-6 animate-spin text-muted-foreground\" />\n <span className=\"sr-only\">Loading asset</span>\n </output>\n )\n );\n }\n\n if (error) {\n const embedError = new Error(error);\n if (typeof errorFallback === \"function\") return errorFallback(embedError);\n return (\n errorFallback ?? (\n <div\n className=\"athena-sdk-chrome flex h-full w-full items-center justify-center gap-2 p-4 text-sm text-muted-foreground\"\n role=\"alert\"\n >\n <AlertCircle className=\"size-4 text-destructive\" />\n <span>{error}</span>\n </div>\n )\n );\n }\n\n if (!embedUrl) return null;\n\n return (\n <iframe\n {...iframeProps}\n ref={iframeRef}\n src={iframeSrc ?? undefined}\n title={title ?? `Athena asset ${assetId}`}\n allow={allow}\n className={cn(\"block h-full w-full\", className)}\n style={{ ...DEFAULT_STYLE, ...style }}\n onLoad={() => {\n sendConfig();\n onLoad?.();\n }}\n />\n );\n};\n"],"names":["DEFAULT_ASSET_EMBED_DISPLAY_MODE","DEFAULT_ASSET_EMBED_READ_ONLY","DEFAULT_ASSET_EMBED_ALLOW_QUICK_EDIT","DEFAULT_ASSET_EMBED_ALLOW_COMMENTS","useRef","useAthenaConfig","useAssetEmbed","useMemo","buildSdkAssetEmbedUrl","resolveAthenaAssetCitationBehavior","resolveAthenaAssetCitationActionBehavior","useCallback","ATHENA_ASSET_EMBED_CONFIG_MESSAGE","useEffect","isAthenaAssetEmbedReadyEvent","isAthenaAssetEmbedContentReadyEvent","isAthenaAssetCitationClickEvent","isAthenaAssetCitationActionEvent","jsxs","jsx","Loader2","AlertCircle","cn"],"mappings":";;;;;;;;;AA0FA,MAAM,gBAA+B;AAAA,EACnC,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AACV;AACA,MAAM,wBAAwB;AAEvB,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA,cAAcA,cAAAA;AAAAA,EACd,WAAWC,cAAAA;AAAAA,EACX,iBAAiBC,cAAAA;AAAAA,EACjB,gBAAgBC,cAAAA;AAAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,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C,2BAAAA,IAACC,YAAAA,SAAA,EAAQ,WAAU,4CAAA,CAA4C;AAAA,MAC/DD,2BAAAA,IAAC,QAAA,EAAK,WAAU,WAAU,UAAA,gBAAA,CAAa;AAAA,IAAA,GACzC;AAAA,EAGN;AAEA,MAAI,OAAO;AACT,UAAM,aAAa,IAAI,MAAM,KAAK;AAClC,QAAI,OAAO,kBAAkB,WAAY,QAAO,cAAc,UAAU;AACxE,WACE,iBACED,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,MAAK;AAAA,QAEL,UAAA;AAAA,UAAAC,2BAAAA,IAACE,YAAAA,aAAA,EAAY,WAAU,0BAAA,CAA0B;AAAA,UACjDF,2BAAAA,IAAC,UAAM,UAAA,MAAA,CAAM;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIrB;AAEA,MAAI,CAAC,SAAU,QAAO;AAEtB,SACEA,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ,KAAK;AAAA,MACL,KAAK,aAAa;AAAA,MAClB,OAAO,SAAS,gBAAgB,OAAO;AAAA,MACvC;AAAA,MACA,WAAWG,OAAAA,GAAG,uBAAuB,SAAS;AAAA,MAC9C,OAAO,EAAE,GAAG,eAAe,GAAG,MAAA;AAAA,MAC9B,QAAQ,MAAM;AACZ,mBAAA;AACA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN;;"}
1
+ {"version":3,"file":"AthenaAssetEmbed.cjs","sources":["../../src/assets/AthenaAssetEmbed.tsx"],"sourcesContent":["\"use client\";\n\nimport { AlertCircle, Loader2 } from \"lucide-react\";\nimport { type CSSProperties, type FC, type IframeHTMLAttributes, useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { cn } from \"../lib/utils\";\nimport { useAthenaConfig } from \"../provider/AthenaContext\";\nimport {\n ATHENA_ASSET_EMBED_CONFIG_MESSAGE,\n type AthenaAssetCitationActionEvent,\n type AthenaAssetCitationBehavior,\n type AthenaAssetCitationClickEvent,\n type AthenaAssetCitationReference,\n isAthenaAssetCitationActionEvent,\n isAthenaAssetCitationClickEvent,\n isAthenaAssetEmbedReadyEvent,\n isAthenaAssetEmbedContentReadyEvent,\n resolveAthenaAssetCitationActionBehavior,\n resolveAthenaAssetCitationBehavior,\n} from \"./asset-embed-messages\";\nimport {\n buildSdkAssetEmbedUrl,\n DEFAULT_ASSET_EMBED_ALLOW_COMMENTS,\n DEFAULT_ASSET_EMBED_ALLOW_QUICK_EDIT,\n DEFAULT_ASSET_EMBED_DISPLAY_MODE,\n DEFAULT_ASSET_EMBED_READ_ONLY,\n useAssetEmbed,\n} from \"./use-asset-embed\";\n\nexport interface AthenaAssetEmbedProps extends Omit<\n IframeHTMLAttributes<HTMLIFrameElement>,\n \"src\" | \"onError\" | \"onLoad\"\n> {\n assetId: string;\n /** Optional citation target to open inside the embedded asset, such as a PDF page. */\n reference?: AthenaAssetCitationReference;\n /** Defaults to the native full asset experience. */\n displayMode?: \"minimal\" | \"full\";\n /**\n * Defaults to false so authorized users can edit the embedded asset. Any type that keeps comment\n * threads (a Word document, an Athena document, a spreadsheet, a deck, a user interface, a\n * notebook, a PDF, ...) edits only for a viewer signed in to Athena with their own access to the\n * asset: the provider's `token` (or this component's `token`), which this component hands the\n * frame. Anyone else views it read-only.\n */\n readOnly?: boolean;\n /**\n * Offer Quick Edit (⌘J) in a minimal embed (`displayMode=\"minimal\"`): spreadsheets, Word\n * documents and decks, on an editable link (`readOnly: false`) only, to a viewer signed in to\n * Athena with their own access to the asset (the provider's `token`). Billed to the asset's\n * workspace, with an hourly cap per link; the full mode's editors offer it to the signed-in person\n * already. Defaults to false. Ignored with `embedUrl`: a link the host minted says itself.\n */\n allowQuickEdit?: boolean;\n /**\n * The bearer to hand the frame instead of the provider's `token`: for a host that signs its person\n * in with a key it must never hand a frame (Athena's desktop app), the short-lived viewer token\n * agora mints for this link (`POST /api/embed/{token}/viewer-token`), so the frame is the signed-in\n * person. Sent only to the frame's own origin, never in its URL. Without it the provider's `token`\n * goes, as before.\n */\n token?: string;\n /**\n * Show the asset's comment threads, read-only, to everyone holding the link, a viewer who is not\n * signed in included. Without it a minimal embed shows them only to a signed-in viewer with their\n * own access to the asset. No embed writes a comment. Defaults to false. Ignored with\n * `embedUrl`: a link the host minted says itself.\n */\n allowComments?: boolean;\n expiresInSeconds?: number;\n citationBehavior?: AthenaAssetCitationBehavior;\n onCitationClick?: (event: AthenaAssetCitationClickEvent) => void;\n /**\n * Controls the citation popover's actions, including the (+) Open in Spaces button. A host that\n * takes them (`\"host\"`, the default with `onCitationAction`) also gets, as `open-in-spaces`, each\n * member of an embedded folder, project or collection that the person opens, other than a\n * container, and opens it as an asset of its own; with `\"browser\"` the member opens in place.\n */\n citationActionBehavior?: AthenaAssetCitationBehavior;\n onCitationAction?: (event: AthenaAssetCitationActionEvent) => void;\n /**\n * An embed link the host minted itself (`POST /api/embed/generate-token`, its `/embed/<token>/`\n * page): the component shows it and mints none. Without it the component mints one with the\n * provider's credentials, as before.\n */\n embedUrl?: string;\n /** The embedded page said it is ready (its bridge's first message): Athena runs in the frame. */\n onReady?: () => void;\n /** The matching asset viewer has committed usable content in this frame. */\n onContentReady?: () => void;\n onLoad?: () => void;\n onError?: (error: Error) => void;\n loadingFallback?: React.ReactNode;\n errorFallback?: React.ReactNode | ((error: Error) => React.ReactNode);\n}\n\nconst DEFAULT_STYLE: CSSProperties = {\n width: \"100%\",\n height: \"100%\",\n border: 0,\n};\nconst AUTH_SYNC_INTERVAL_MS = 60_000;\n\nexport const AthenaAssetEmbed: FC<AthenaAssetEmbedProps> = ({\n assetId,\n reference,\n displayMode = DEFAULT_ASSET_EMBED_DISPLAY_MODE,\n readOnly = DEFAULT_ASSET_EMBED_READ_ONLY,\n allowQuickEdit = DEFAULT_ASSET_EMBED_ALLOW_QUICK_EDIT,\n allowComments = DEFAULT_ASSET_EMBED_ALLOW_COMMENTS,\n expiresInSeconds,\n citationBehavior,\n onCitationClick,\n citationActionBehavior,\n onCitationAction,\n embedUrl: hostEmbedUrl,\n token: frameToken,\n onReady,\n onContentReady,\n onLoad,\n onError,\n loadingFallback,\n errorFallback,\n className,\n style,\n title,\n allow = \"clipboard-read; clipboard-write; fullscreen\",\n ...iframeProps\n}) => {\n const iframeRef = useRef<HTMLIFrameElement | null>(null);\n const athenaConfig = useAthenaConfig();\n const { backendUrl, appUrl, apiKey } = athenaConfig;\n // A link the host minted is shown as given; the hook then mints nothing (no asset to mint for).\n const minted = useAssetEmbed(hostEmbedUrl ? null : assetId, {\n backendUrl,\n appUrl,\n apiKey,\n token: athenaConfig.token,\n getToken: athenaConfig.getToken,\n readOnly,\n expiresInSeconds,\n displayMode,\n allowQuickEdit,\n allowComments,\n });\n const embedUrl = hostEmbedUrl ?? minted.embedUrl;\n const isLoading = hostEmbedUrl ? false : minted.isLoading;\n const error = hostEmbedUrl ? null : minted.error;\n const targetOrigin = useMemo(() => {\n if (!embedUrl) return null;\n try {\n return new URL(embedUrl, window.location.href).origin;\n } catch {\n return null;\n }\n }, [embedUrl]);\n const iframeSrc = useMemo(\n () => (embedUrl ? buildSdkAssetEmbedUrl(embedUrl, reference) : null),\n [embedUrl, reference],\n );\n const effectiveCitationBehavior = resolveAthenaAssetCitationBehavior({\n citationBehavior,\n hasCitationClickHandler: !!onCitationClick,\n });\n const effectiveCitationActionBehavior = resolveAthenaAssetCitationActionBehavior({\n citationActionBehavior,\n hasCitationActionHandler: !!onCitationAction,\n });\n\n const sendConfig = useCallback(() => {\n if (!targetOrigin) return;\n // Read when sent: the provider renews its token behind a getter on a config that stays the\n // same object, so an embed that does not render again still sends the current one.\n const viewerToken = frameToken ?? athenaConfig.token;\n iframeRef.current?.contentWindow?.postMessage(\n {\n type: ATHENA_ASSET_EMBED_CONFIG_MESSAGE,\n version: 1,\n ...(viewerToken ? { token: viewerToken } : {}),\n citationBehavior: effectiveCitationBehavior,\n citationActionBehavior: effectiveCitationActionBehavior,\n },\n targetOrigin,\n );\n }, [frameToken, athenaConfig, effectiveCitationActionBehavior, effectiveCitationBehavior, targetOrigin]);\n\n useEffect(() => {\n if (!embedUrl || !targetOrigin) return;\n const handleMessage = (event: MessageEvent<unknown>) => {\n if (event.origin !== targetOrigin || event.source !== iframeRef.current?.contentWindow) return;\n if (isAthenaAssetEmbedReadyEvent(event.data)) {\n sendConfig();\n onReady?.();\n return;\n }\n if (isAthenaAssetEmbedContentReadyEvent(event.data)) {\n if (event.data.assetId === assetId) onContentReady?.();\n return;\n }\n if (isAthenaAssetCitationClickEvent(event.data)) {\n onCitationClick?.(event.data);\n return;\n }\n if (isAthenaAssetCitationActionEvent(event.data)) {\n onCitationAction?.(event.data);\n }\n };\n window.addEventListener(\"message\", handleMessage);\n return () => window.removeEventListener(\"message\", handleMessage);\n }, [assetId, embedUrl, onCitationAction, onCitationClick, onReady, onContentReady, sendConfig, targetOrigin]);\n\n useEffect(() => {\n if (!embedUrl) return;\n sendConfig();\n const interval = window.setInterval(sendConfig, AUTH_SYNC_INTERVAL_MS);\n return () => window.clearInterval(interval);\n }, [embedUrl, sendConfig]);\n\n useEffect(() => {\n if (error) onError?.(new Error(error));\n }, [error, onError]);\n\n if (isLoading) {\n return (\n loadingFallback ?? (\n <output className=\"athena-sdk-chrome flex h-full w-full items-center justify-center\">\n <Loader2 className=\"size-6 animate-spin text-muted-foreground\" />\n <span className=\"sr-only\">Loading asset</span>\n </output>\n )\n );\n }\n\n if (error) {\n const embedError = new Error(error);\n if (typeof errorFallback === \"function\") return errorFallback(embedError);\n return (\n errorFallback ?? (\n <div\n className=\"athena-sdk-chrome flex h-full w-full items-center justify-center gap-2 p-4 text-sm text-muted-foreground\"\n role=\"alert\"\n >\n <AlertCircle className=\"size-4 text-destructive\" />\n <span>{error}</span>\n </div>\n )\n );\n }\n\n if (!embedUrl) return null;\n\n return (\n <iframe\n {...iframeProps}\n ref={iframeRef}\n src={iframeSrc ?? undefined}\n title={title ?? `Athena asset ${assetId}`}\n allow={allow}\n className={cn(\"block h-full w-full\", className)}\n style={{ ...DEFAULT_STYLE, ...style }}\n onLoad={() => {\n sendConfig();\n onLoad?.();\n }}\n />\n );\n};\n"],"names":["DEFAULT_ASSET_EMBED_DISPLAY_MODE","DEFAULT_ASSET_EMBED_READ_ONLY","DEFAULT_ASSET_EMBED_ALLOW_QUICK_EDIT","DEFAULT_ASSET_EMBED_ALLOW_COMMENTS","useRef","useAthenaConfig","useAssetEmbed","useMemo","buildSdkAssetEmbedUrl","resolveAthenaAssetCitationBehavior","resolveAthenaAssetCitationActionBehavior","useCallback","ATHENA_ASSET_EMBED_CONFIG_MESSAGE","useEffect","isAthenaAssetEmbedReadyEvent","isAthenaAssetEmbedContentReadyEvent","isAthenaAssetCitationClickEvent","isAthenaAssetCitationActionEvent","jsxs","jsx","Loader2","AlertCircle","cn"],"mappings":";;;;;;;;;AA+FA,MAAM,gBAA+B;AAAA,EACnC,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AACV;AACA,MAAM,wBAAwB;AAEvB,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA,cAAcA,cAAAA;AAAAA,EACd,WAAWC,cAAAA;AAAAA,EACX,iBAAiBC,cAAAA;AAAAA,EACjB,gBAAgBC,cAAAA;AAAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,GAAG;AACL,MAAM;AACJ,QAAM,YAAYC,WAAAA,OAAiC,IAAI;AACvD,QAAM,eAAeC,cAAAA,gBAAA;AACrB,QAAM,EAAE,YAAY,QAAQ,OAAA,IAAW;AAEvC,QAAM,SAASC,cAAAA,cAAc,eAAe,OAAO,SAAS;AAAA,IAC1D;AAAA,IACA;AAAA,IACA;AAAA,I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kBAAkB,WAAY,QAAO,cAAc,UAAU;AACxE,WACE,iBACED,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,MAAK;AAAA,QAEL,UAAA;AAAA,UAAAC,2BAAAA,IAACE,YAAAA,aAAA,EAAY,WAAU,0BAAA,CAA0B;AAAA,UACjDF,2BAAAA,IAAC,UAAM,UAAA,MAAA,CAAM;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIrB;AAEA,MAAI,CAAC,SAAU,QAAO;AAEtB,SACEA,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ,KAAK;AAAA,MACL,KAAK,aAAa;AAAA,MAClB,OAAO,SAAS,gBAAgB,OAAO;AAAA,MACvC;AAAA,MACA,WAAWG,OAAAA,GAAG,uBAAuB,SAAS;AAAA,MAC9C,OAAO,EAAE,GAAG,eAAe,GAAG,MAAA;AAAA,MAC9B,QAAQ,MAAM;AACZ,mBAAA;AACA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN;;"}
@@ -40,7 +40,12 @@ export interface AthenaAssetEmbedProps extends Omit<IframeHTMLAttributes<HTMLIFr
40
40
  expiresInSeconds?: number;
41
41
  citationBehavior?: AthenaAssetCitationBehavior;
42
42
  onCitationClick?: (event: AthenaAssetCitationClickEvent) => void;
43
- /** Controls the citation popover's actions, including the (+) Open in Spaces button. */
43
+ /**
44
+ * Controls the citation popover's actions, including the (+) Open in Spaces button. A host that
45
+ * takes them (`"host"`, the default with `onCitationAction`) also gets, as `open-in-spaces`, each
46
+ * member of an embedded folder, project or collection that the person opens, other than a
47
+ * container, and opens it as an asset of its own; with `"browser"` the member opens in place.
48
+ */
44
49
  citationActionBehavior?: AthenaAssetCitationBehavior;
45
50
  onCitationAction?: (event: AthenaAssetCitationActionEvent) => void;
46
51
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"AthenaAssetEmbed.js","sources":["../../src/assets/AthenaAssetEmbed.tsx"],"sourcesContent":["\"use client\";\n\nimport { AlertCircle, Loader2 } from \"lucide-react\";\nimport { type CSSProperties, type FC, type IframeHTMLAttributes, useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { cn } from \"../lib/utils\";\nimport { useAthenaConfig } from \"../provider/AthenaContext\";\nimport {\n ATHENA_ASSET_EMBED_CONFIG_MESSAGE,\n type AthenaAssetCitationActionEvent,\n type AthenaAssetCitationBehavior,\n type AthenaAssetCitationClickEvent,\n type AthenaAssetCitationReference,\n isAthenaAssetCitationActionEvent,\n isAthenaAssetCitationClickEvent,\n isAthenaAssetEmbedReadyEvent,\n isAthenaAssetEmbedContentReadyEvent,\n resolveAthenaAssetCitationActionBehavior,\n resolveAthenaAssetCitationBehavior,\n} from \"./asset-embed-messages\";\nimport {\n buildSdkAssetEmbedUrl,\n DEFAULT_ASSET_EMBED_ALLOW_COMMENTS,\n DEFAULT_ASSET_EMBED_ALLOW_QUICK_EDIT,\n DEFAULT_ASSET_EMBED_DISPLAY_MODE,\n DEFAULT_ASSET_EMBED_READ_ONLY,\n useAssetEmbed,\n} from \"./use-asset-embed\";\n\nexport interface AthenaAssetEmbedProps extends Omit<\n IframeHTMLAttributes<HTMLIFrameElement>,\n \"src\" | \"onError\" | \"onLoad\"\n> {\n assetId: string;\n /** Optional citation target to open inside the embedded asset, such as a PDF page. */\n reference?: AthenaAssetCitationReference;\n /** Defaults to the native full asset experience. */\n displayMode?: \"minimal\" | \"full\";\n /**\n * Defaults to false so authorized users can edit the embedded asset. Any type that keeps comment\n * threads (a Word document, an Athena document, a spreadsheet, a deck, a user interface, a\n * notebook, a PDF, ...) edits only for a viewer signed in to Athena with their own access to the\n * asset: the provider's `token` (or this component's `token`), which this component hands the\n * frame. Anyone else views it read-only.\n */\n readOnly?: boolean;\n /**\n * Offer Quick Edit (⌘J) in a minimal embed (`displayMode=\"minimal\"`): spreadsheets, Word\n * documents and decks, on an editable link (`readOnly: false`) only, to a viewer signed in to\n * Athena with their own access to the asset (the provider's `token`). Billed to the asset's\n * workspace, with an hourly cap per link; the full mode's editors offer it to the signed-in person\n * already. Defaults to false. Ignored with `embedUrl`: a link the host minted says itself.\n */\n allowQuickEdit?: boolean;\n /**\n * The bearer to hand the frame instead of the provider's `token`: for a host that signs its person\n * in with a key it must never hand a frame (Athena's desktop app), the short-lived viewer token\n * agora mints for this link (`POST /api/embed/{token}/viewer-token`), so the frame is the signed-in\n * person. Sent only to the frame's own origin, never in its URL. Without it the provider's `token`\n * goes, as before.\n */\n token?: string;\n /**\n * Show the asset's comment threads, read-only, to everyone holding the link, a viewer who is not\n * signed in included. Without it a minimal embed shows them only to a signed-in viewer with their\n * own access to the asset. No embed writes a comment. Defaults to false. Ignored with\n * `embedUrl`: a link the host minted says itself.\n */\n allowComments?: boolean;\n expiresInSeconds?: number;\n citationBehavior?: AthenaAssetCitationBehavior;\n onCitationClick?: (event: AthenaAssetCitationClickEvent) => void;\n /** Controls the citation popover's actions, including the (+) Open in Spaces button. */\n citationActionBehavior?: AthenaAssetCitationBehavior;\n onCitationAction?: (event: AthenaAssetCitationActionEvent) => void;\n /**\n * An embed link the host minted itself (`POST /api/embed/generate-token`, its `/embed/<token>/`\n * page): the component shows it and mints none. Without it the component mints one with the\n * provider's credentials, as before.\n */\n embedUrl?: string;\n /** The embedded page said it is ready (its bridge's first message): Athena runs in the frame. */\n onReady?: () => void;\n /** The matching asset viewer has committed usable content in this frame. */\n onContentReady?: () => void;\n onLoad?: () => void;\n onError?: (error: Error) => void;\n loadingFallback?: React.ReactNode;\n errorFallback?: React.ReactNode | ((error: Error) => React.ReactNode);\n}\n\nconst DEFAULT_STYLE: CSSProperties = {\n width: \"100%\",\n height: \"100%\",\n border: 0,\n};\nconst AUTH_SYNC_INTERVAL_MS = 60_000;\n\nexport const AthenaAssetEmbed: FC<AthenaAssetEmbedProps> = ({\n assetId,\n reference,\n displayMode = DEFAULT_ASSET_EMBED_DISPLAY_MODE,\n readOnly = DEFAULT_ASSET_EMBED_READ_ONLY,\n allowQuickEdit = DEFAULT_ASSET_EMBED_ALLOW_QUICK_EDIT,\n allowComments = DEFAULT_ASSET_EMBED_ALLOW_COMMENTS,\n expiresInSeconds,\n citationBehavior,\n onCitationClick,\n citationActionBehavior,\n onCitationAction,\n embedUrl: hostEmbedUrl,\n token: frameToken,\n onReady,\n onContentReady,\n onLoad,\n onError,\n loadingFallback,\n errorFallback,\n className,\n style,\n title,\n allow = \"clipboard-read; clipboard-write; fullscreen\",\n ...iframeProps\n}) => {\n const iframeRef = useRef<HTMLIFrameElement | null>(null);\n const athenaConfig = useAthenaConfig();\n const { backendUrl, appUrl, apiKey } = athenaConfig;\n // A link the host minted is shown as given; the hook then mints nothing (no asset to mint for).\n const minted = useAssetEmbed(hostEmbedUrl ? null : assetId, {\n backendUrl,\n appUrl,\n apiKey,\n token: athenaConfig.token,\n getToken: athenaConfig.getToken,\n readOnly,\n expiresInSeconds,\n displayMode,\n allowQuickEdit,\n allowComments,\n });\n const embedUrl = hostEmbedUrl ?? minted.embedUrl;\n const isLoading = hostEmbedUrl ? false : minted.isLoading;\n const error = hostEmbedUrl ? null : minted.error;\n const targetOrigin = useMemo(() => {\n if (!embedUrl) return null;\n try {\n return new URL(embedUrl, window.location.href).origin;\n } catch {\n return null;\n }\n }, [embedUrl]);\n const iframeSrc = useMemo(\n () => (embedUrl ? buildSdkAssetEmbedUrl(embedUrl, reference) : null),\n [embedUrl, reference],\n );\n const effectiveCitationBehavior = resolveAthenaAssetCitationBehavior({\n citationBehavior,\n hasCitationClickHandler: !!onCitationClick,\n });\n const effectiveCitationActionBehavior = resolveAthenaAssetCitationActionBehavior({\n citationActionBehavior,\n hasCitationActionHandler: !!onCitationAction,\n });\n\n const sendConfig = useCallback(() => {\n if (!targetOrigin) return;\n // Read when sent: the provider renews its token behind a getter on a config that stays the\n // same object, so an embed that does not render again still sends the current one.\n const viewerToken = frameToken ?? athenaConfig.token;\n iframeRef.current?.contentWindow?.postMessage(\n {\n type: ATHENA_ASSET_EMBED_CONFIG_MESSAGE,\n version: 1,\n ...(viewerToken ? { token: viewerToken } : {}),\n citationBehavior: effectiveCitationBehavior,\n citationActionBehavior: effectiveCitationActionBehavior,\n },\n targetOrigin,\n );\n }, [frameToken, athenaConfig, effectiveCitationActionBehavior, effectiveCitationBehavior, targetOrigin]);\n\n useEffect(() => {\n if (!embedUrl || !targetOrigin) return;\n const handleMessage = (event: MessageEvent<unknown>) => {\n if (event.origin !== targetOrigin || event.source !== iframeRef.current?.contentWindow) return;\n if (isAthenaAssetEmbedReadyEvent(event.data)) {\n sendConfig();\n onReady?.();\n return;\n }\n if (isAthenaAssetEmbedContentReadyEvent(event.data)) {\n if (event.data.assetId === assetId) onContentReady?.();\n return;\n }\n if (isAthenaAssetCitationClickEvent(event.data)) {\n onCitationClick?.(event.data);\n return;\n }\n if (isAthenaAssetCitationActionEvent(event.data)) {\n onCitationAction?.(event.data);\n }\n };\n window.addEventListener(\"message\", handleMessage);\n return () => window.removeEventListener(\"message\", handleMessage);\n }, [assetId, embedUrl, onCitationAction, onCitationClick, onReady, onContentReady, sendConfig, targetOrigin]);\n\n useEffect(() => {\n if (!embedUrl) return;\n sendConfig();\n const interval = window.setInterval(sendConfig, AUTH_SYNC_INTERVAL_MS);\n return () => window.clearInterval(interval);\n }, [embedUrl, sendConfig]);\n\n useEffect(() => {\n if (error) onError?.(new Error(error));\n }, [error, onError]);\n\n if (isLoading) {\n return (\n loadingFallback ?? (\n <output className=\"athena-sdk-chrome flex h-full w-full items-center justify-center\">\n <Loader2 className=\"size-6 animate-spin text-muted-foreground\" />\n <span className=\"sr-only\">Loading asset</span>\n </output>\n )\n );\n }\n\n if (error) {\n const embedError = new Error(error);\n if (typeof errorFallback === \"function\") return errorFallback(embedError);\n return (\n errorFallback ?? (\n <div\n className=\"athena-sdk-chrome flex h-full w-full items-center justify-center gap-2 p-4 text-sm text-muted-foreground\"\n role=\"alert\"\n >\n <AlertCircle className=\"size-4 text-destructive\" />\n <span>{error}</span>\n </div>\n )\n );\n }\n\n if (!embedUrl) return null;\n\n return (\n <iframe\n {...iframeProps}\n ref={iframeRef}\n src={iframeSrc ?? undefined}\n title={title ?? `Athena asset ${assetId}`}\n allow={allow}\n className={cn(\"block h-full w-full\", className)}\n style={{ ...DEFAULT_STYLE, ...style }}\n onLoad={() => {\n sendConfig();\n onLoad?.();\n }}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;AA0FA,MAAM,gBAA+B;AAAA,EACnC,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AACV;AACA,MAAM,wBAAwB;AAEvB,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,GAAG;AACL,MAAM;AACJ,QAAM,YAAY,OAAiC,IAAI;AACvD,QAAM,eAAe,gBAAA;AACrB,QAAM,EAAE,YAAY,QAAQ,OAAA,IAAW;AAEvC,QAAM,SAAS,cAAc,eAAe,OAAO,SAAS;AAAA,IAC1D;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,aAAa;AAAA,IACpB,UAAU,aAAa;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACD;AACD,QAAM,WAAW,gBAAgB,OAAO;AACxC,QAAM,YAAY,eAAe,QAAQ,OAAO;AAChD,QAAM,QAAQ,eAAe,OAAO,OAAO;AAC3C,QAAM,eAAe,QAAQ,MAAM;AACjC,QAAI,CAAC,SAAU,QAAO;AACtB,QAAI;AACF,aAAO,IAAI,IAAI,UAAU,OAAO,SAAS,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AAO,EAAE,GAAG,eAAe,GAAG,MAAA;AAAA,MAC9B,QAAQ,MAAM;AACZ,mBAAA;AACA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"AthenaAssetEmbed.js","sources":["../../src/assets/AthenaAssetEmbed.tsx"],"sourcesContent":["\"use client\";\n\nimport { AlertCircle, Loader2 } from \"lucide-react\";\nimport { type CSSProperties, type FC, type IframeHTMLAttributes, useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { cn } from \"../lib/utils\";\nimport { useAthenaConfig } from \"../provider/AthenaContext\";\nimport {\n ATHENA_ASSET_EMBED_CONFIG_MESSAGE,\n type AthenaAssetCitationActionEvent,\n type AthenaAssetCitationBehavior,\n type AthenaAssetCitationClickEvent,\n type AthenaAssetCitationReference,\n isAthenaAssetCitationActionEvent,\n isAthenaAssetCitationClickEvent,\n isAthenaAssetEmbedReadyEvent,\n isAthenaAssetEmbedContentReadyEvent,\n resolveAthenaAssetCitationActionBehavior,\n resolveAthenaAssetCitationBehavior,\n} from \"./asset-embed-messages\";\nimport {\n buildSdkAssetEmbedUrl,\n DEFAULT_ASSET_EMBED_ALLOW_COMMENTS,\n DEFAULT_ASSET_EMBED_ALLOW_QUICK_EDIT,\n DEFAULT_ASSET_EMBED_DISPLAY_MODE,\n DEFAULT_ASSET_EMBED_READ_ONLY,\n useAssetEmbed,\n} from \"./use-asset-embed\";\n\nexport interface AthenaAssetEmbedProps extends Omit<\n IframeHTMLAttributes<HTMLIFrameElement>,\n \"src\" | \"onError\" | \"onLoad\"\n> {\n assetId: string;\n /** Optional citation target to open inside the embedded asset, such as a PDF page. */\n reference?: AthenaAssetCitationReference;\n /** Defaults to the native full asset experience. */\n displayMode?: \"minimal\" | \"full\";\n /**\n * Defaults to false so authorized users can edit the embedded asset. Any type that keeps comment\n * threads (a Word document, an Athena document, a spreadsheet, a deck, a user interface, a\n * notebook, a PDF, ...) edits only for a viewer signed in to Athena with their own access to the\n * asset: the provider's `token` (or this component's `token`), which this component hands the\n * frame. Anyone else views it read-only.\n */\n readOnly?: boolean;\n /**\n * Offer Quick Edit (⌘J) in a minimal embed (`displayMode=\"minimal\"`): spreadsheets, Word\n * documents and decks, on an editable link (`readOnly: false`) only, to a viewer signed in to\n * Athena with their own access to the asset (the provider's `token`). Billed to the asset's\n * workspace, with an hourly cap per link; the full mode's editors offer it to the signed-in person\n * already. Defaults to false. Ignored with `embedUrl`: a link the host minted says itself.\n */\n allowQuickEdit?: boolean;\n /**\n * The bearer to hand the frame instead of the provider's `token`: for a host that signs its person\n * in with a key it must never hand a frame (Athena's desktop app), the short-lived viewer token\n * agora mints for this link (`POST /api/embed/{token}/viewer-token`), so the frame is the signed-in\n * person. Sent only to the frame's own origin, never in its URL. Without it the provider's `token`\n * goes, as before.\n */\n token?: string;\n /**\n * Show the asset's comment threads, read-only, to everyone holding the link, a viewer who is not\n * signed in included. Without it a minimal embed shows them only to a signed-in viewer with their\n * own access to the asset. No embed writes a comment. Defaults to false. Ignored with\n * `embedUrl`: a link the host minted says itself.\n */\n allowComments?: boolean;\n expiresInSeconds?: number;\n citationBehavior?: AthenaAssetCitationBehavior;\n onCitationClick?: (event: AthenaAssetCitationClickEvent) => void;\n /**\n * Controls the citation popover's actions, including the (+) Open in Spaces button. A host that\n * takes them (`\"host\"`, the default with `onCitationAction`) also gets, as `open-in-spaces`, each\n * member of an embedded folder, project or collection that the person opens, other than a\n * container, and opens it as an asset of its own; with `\"browser\"` the member opens in place.\n */\n citationActionBehavior?: AthenaAssetCitationBehavior;\n onCitationAction?: (event: AthenaAssetCitationActionEvent) => void;\n /**\n * An embed link the host minted itself (`POST /api/embed/generate-token`, its `/embed/<token>/`\n * page): the component shows it and mints none. Without it the component mints one with the\n * provider's credentials, as before.\n */\n embedUrl?: string;\n /** The embedded page said it is ready (its bridge's first message): Athena runs in the frame. */\n onReady?: () => void;\n /** The matching asset viewer has committed usable content in this frame. */\n onContentReady?: () => void;\n onLoad?: () => void;\n onError?: (error: Error) => void;\n loadingFallback?: React.ReactNode;\n errorFallback?: React.ReactNode | ((error: Error) => React.ReactNode);\n}\n\nconst DEFAULT_STYLE: CSSProperties = {\n width: \"100%\",\n height: \"100%\",\n border: 0,\n};\nconst AUTH_SYNC_INTERVAL_MS = 60_000;\n\nexport const AthenaAssetEmbed: FC<AthenaAssetEmbedProps> = ({\n assetId,\n reference,\n displayMode = DEFAULT_ASSET_EMBED_DISPLAY_MODE,\n readOnly = DEFAULT_ASSET_EMBED_READ_ONLY,\n allowQuickEdit = DEFAULT_ASSET_EMBED_ALLOW_QUICK_EDIT,\n allowComments = DEFAULT_ASSET_EMBED_ALLOW_COMMENTS,\n expiresInSeconds,\n citationBehavior,\n onCitationClick,\n citationActionBehavior,\n onCitationAction,\n embedUrl: hostEmbedUrl,\n token: frameToken,\n onReady,\n onContentReady,\n onLoad,\n onError,\n loadingFallback,\n errorFallback,\n className,\n style,\n title,\n allow = \"clipboard-read; clipboard-write; fullscreen\",\n ...iframeProps\n}) => {\n const iframeRef = useRef<HTMLIFrameElement | null>(null);\n const athenaConfig = useAthenaConfig();\n const { backendUrl, appUrl, apiKey } = athenaConfig;\n // A link the host minted is shown as given; the hook then mints nothing (no asset to mint for).\n const minted = useAssetEmbed(hostEmbedUrl ? null : assetId, {\n backendUrl,\n appUrl,\n apiKey,\n token: athenaConfig.token,\n getToken: athenaConfig.getToken,\n readOnly,\n expiresInSeconds,\n displayMode,\n allowQuickEdit,\n allowComments,\n });\n const embedUrl = hostEmbedUrl ?? minted.embedUrl;\n const isLoading = hostEmbedUrl ? false : minted.isLoading;\n const error = hostEmbedUrl ? null : minted.error;\n const targetOrigin = useMemo(() => {\n if (!embedUrl) return null;\n try {\n return new URL(embedUrl, window.location.href).origin;\n } catch {\n return null;\n }\n }, [embedUrl]);\n const iframeSrc = useMemo(\n () => (embedUrl ? buildSdkAssetEmbedUrl(embedUrl, reference) : null),\n [embedUrl, reference],\n );\n const effectiveCitationBehavior = resolveAthenaAssetCitationBehavior({\n citationBehavior,\n hasCitationClickHandler: !!onCitationClick,\n });\n const effectiveCitationActionBehavior = resolveAthenaAssetCitationActionBehavior({\n citationActionBehavior,\n hasCitationActionHandler: !!onCitationAction,\n });\n\n const sendConfig = useCallback(() => {\n if (!targetOrigin) return;\n // Read when sent: the provider renews its token behind a getter on a config that stays the\n // same object, so an embed that does not render again still sends the current one.\n const viewerToken = frameToken ?? athenaConfig.token;\n iframeRef.current?.contentWindow?.postMessage(\n {\n type: ATHENA_ASSET_EMBED_CONFIG_MESSAGE,\n version: 1,\n ...(viewerToken ? { token: viewerToken } : {}),\n citationBehavior: effectiveCitationBehavior,\n citationActionBehavior: effectiveCitationActionBehavior,\n },\n targetOrigin,\n );\n }, [frameToken, athenaConfig, effectiveCitationActionBehavior, effectiveCitationBehavior, targetOrigin]);\n\n useEffect(() => {\n if (!embedUrl || !targetOrigin) return;\n const handleMessage = (event: MessageEvent<unknown>) => {\n if (event.origin !== targetOrigin || event.source !== iframeRef.current?.contentWindow) return;\n if (isAthenaAssetEmbedReadyEvent(event.data)) {\n sendConfig();\n onReady?.();\n return;\n }\n if (isAthenaAssetEmbedContentReadyEvent(event.data)) {\n if (event.data.assetId === assetId) onContentReady?.();\n return;\n }\n if (isAthenaAssetCitationClickEvent(event.data)) {\n onCitationClick?.(event.data);\n return;\n }\n if (isAthenaAssetCitationActionEvent(event.data)) {\n onCitationAction?.(event.data);\n }\n };\n window.addEventListener(\"message\", handleMessage);\n return () => window.removeEventListener(\"message\", handleMessage);\n }, [assetId, embedUrl, onCitationAction, onCitationClick, onReady, onContentReady, sendConfig, targetOrigin]);\n\n useEffect(() => {\n if (!embedUrl) return;\n sendConfig();\n const interval = window.setInterval(sendConfig, AUTH_SYNC_INTERVAL_MS);\n return () => window.clearInterval(interval);\n }, [embedUrl, sendConfig]);\n\n useEffect(() => {\n if (error) onError?.(new Error(error));\n }, [error, onError]);\n\n if (isLoading) {\n return (\n loadingFallback ?? (\n <output className=\"athena-sdk-chrome flex h-full w-full items-center justify-center\">\n <Loader2 className=\"size-6 animate-spin text-muted-foreground\" />\n <span className=\"sr-only\">Loading asset</span>\n </output>\n )\n );\n }\n\n if (error) {\n const embedError = new Error(error);\n if (typeof errorFallback === \"function\") return errorFallback(embedError);\n return (\n errorFallback ?? (\n <div\n className=\"athena-sdk-chrome flex h-full w-full items-center justify-center gap-2 p-4 text-sm text-muted-foreground\"\n role=\"alert\"\n >\n <AlertCircle className=\"size-4 text-destructive\" />\n <span>{error}</span>\n </div>\n )\n );\n }\n\n if (!embedUrl) return null;\n\n return (\n <iframe\n {...iframeProps}\n ref={iframeRef}\n src={iframeSrc ?? undefined}\n title={title ?? `Athena asset ${assetId}`}\n allow={allow}\n className={cn(\"block h-full w-full\", className)}\n style={{ ...DEFAULT_STYLE, ...style }}\n onLoad={() => {\n sendConfig();\n onLoad?.();\n }}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;AA+FA,MAAM,gBAA+B;AAAA,EACnC,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AACV;AACA,MAAM,wBAAwB;AAEvB,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,GAAG;AACL,MAAM;AACJ,QAAM,YAAY,OAAiC,IAAI;AACvD,QAAM,eAAe,gBAAA;AACrB,QAAM,EAAE,YAAY,QAAQ,OAAA,IAAW;AAEvC,QAAM,SAAS,cAAc,eAAe,OAAO,SAAS;AAAA,IAC1D;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,aAAa;AA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A,UACjD,oBAAC,UAAM,UAAA,MAAA,CAAM;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIrB;AAEA,MAAI,CAAC,SAAU,QAAO;AAEtB,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ,KAAK;AAAA,MACL,KAAK,aAAa;AAAA,MAClB,OAAO,SAAS,gBAAgB,OAAO;AAAA,MACvC;AAAA,MACA,WAAW,GAAG,uBAAuB,SAAS;AAAA,MAC9C,OAAO,EAAE,GAAG,eAAe,GAAG,MAAA;AAAA,MAC9B,QAAQ,MAAM;AACZ,mBAAA;AACA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -13,7 +13,8 @@ function assetOpenRequest({
13
13
  ...(meta == null ? void 0 : meta.type) !== void 0 ? { type: meta.type } : {},
14
14
  ...(meta == null ? void 0 : meta.slideNumber) !== void 0 ? { slideNumber: meta.slideNumber } : {},
15
15
  ...(meta == null ? void 0 : meta.reference) !== void 0 ? { reference: meta.reference } : {},
16
- ...(meta == null ? void 0 : meta.href) !== void 0 ? { href: meta.href } : {}
16
+ ...(meta == null ? void 0 : meta.href) !== void 0 ? { href: meta.href } : {},
17
+ ...(meta == null ? void 0 : meta.autoOpen) !== void 0 ? { autoOpen: meta.autoOpen } : {}
17
18
  };
18
19
  }
19
20
  const useAssetPanelStore = zustand.create()(
@@ -30,6 +31,7 @@ const useAssetPanelStore = zustand.create()(
30
31
  assetOpeners: [],
31
32
  autoOpenGeneration: 0,
32
33
  autoOpenedAssets: /* @__PURE__ */ new Map(),
34
+ autoOpenedMadeOrShown: /* @__PURE__ */ new Map(),
33
35
  openRequestSeq: 0,
34
36
  registerAssetPanelHost: () => set((state) => ({ assetPanelHostCount: state.assetPanelHostCount + 1 })),
35
37
  unregisterAssetPanelHost: () => set((state) => ({ assetPanelHostCount: Math.max(0, state.assetPanelHostCount - 1) })),
@@ -124,12 +126,18 @@ const useAssetPanelStore = zustand.create()(
124
126
  };
125
127
  }),
126
128
  resetAutoOpen: () => set((s) => ({ autoOpenGeneration: s.autoOpenGeneration + 1 })),
127
- markAutoOpened: (assetId) => {
129
+ markAutoOpened: (assetId, kind = "touched") => {
128
130
  const state = get();
129
- if (state.autoOpenedAssets.get(assetId) === state.autoOpenGeneration) {
130
- return false;
131
+ const generation = state.autoOpenGeneration;
132
+ if (kind === "touched") {
133
+ if (state.autoOpenedAssets.get(assetId) === generation) {
134
+ return false;
135
+ }
136
+ } else {
137
+ if (state.autoOpenedMadeOrShown.get(assetId) === generation) return false;
138
+ state.autoOpenedMadeOrShown.set(assetId, generation);
131
139
  }
132
- state.autoOpenedAssets.set(assetId, state.autoOpenGeneration);
140
+ state.autoOpenedAssets.set(assetId, generation);
133
141
  return true;
134
142
  }
135
143
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"asset-panel-store.cjs","sources":["../../src/assets/asset-panel-store.ts"],"sourcesContent":["import { create } from 'zustand';\nimport { createJSONStorage, persist } from 'zustand/middleware';\nimport type { AthenaAssetCitationReference } from './asset-embed-messages';\n\nexport type AssetType = 'presentation' | 'spreadsheet' | 'document' | 'notebook' | 'unknown';\n\nexport type ViewMode = 'tabs' | 'tiled';\n\nexport interface AssetTab {\n id: string;\n name: string | null;\n type: AssetType;\n slideNumber?: number;\n /** The citation target (anchor + excerpt) the tab was last opened at. */\n reference?: AthenaAssetCitationReference;\n}\n\ninterface ThreadAssetState {\n tabs: AssetTab[];\n activeTabId: string | null;\n isOpen: boolean;\n}\n\n/**\n * Who asked for an asset: the person (a tool card's Open, a citation or asset link in a message)\n * or the SDK's auto-open after a tool created or touched the asset.\n */\nexport type AssetOpenOrigin = 'user' | 'auto';\n\n/** A request to open an asset, as a host's own opener receives it (`AthenaProvider onOpenAsset`). */\nexport interface AssetOpenRequest {\n assetId: string;\n origin: AssetOpenOrigin;\n name?: string;\n type?: AssetType;\n slideNumber?: number;\n /** The citation target (anchor + excerpt) the open should navigate to. */\n reference?: AthenaAssetCitationReference;\n /** The link's own address, when a link asked: a host that opens it on the web keeps every parameter it carried. */\n href?: string;\n}\n\n/**\n * A host's own way to open an asset (a desktop app's tabs, a route of its own). Return `false` to\n * leave the request to the SDK's asset panel.\n */\nexport type AssetOpener = (request: AssetOpenRequest) => boolean | void;\n\nfunction assetOpenRequest({\n assetId,\n meta,\n}: {\n assetId: string;\n meta: Parameters<AssetPanelState['openAsset']>[1];\n}): AssetOpenRequest {\n return {\n assetId,\n origin: meta?.origin ?? 'user',\n ...(meta?.name !== undefined ? { name: meta.name } : {}),\n ...(meta?.type !== undefined ? { type: meta.type } : {}),\n ...(meta?.slideNumber !== undefined ? { slideNumber: meta.slideNumber } : {}),\n ...(meta?.reference !== undefined ? { reference: meta.reference } : {}),\n ...(meta?.href !== undefined ? { href: meta.href } : {}),\n };\n}\n\nexport interface AssetPanelState {\n isOpen: boolean;\n tabs: AssetTab[];\n activeTabId: string | null;\n viewMode: ViewMode;\n isFullscreen: boolean;\n /** The current thread ID. Asset panel state is scoped per thread. */\n currentThreadId: string | null;\n /** Per-thread asset panel state — tabs and active tab persist per thread. */\n threadStates: Record<string, ThreadAssetState>;\n /** Number of registered hosts that can reveal the asset panel. */\n assetPanelHostCount: number;\n /**\n * The hosts' own openers (`AthenaProvider onOpenAsset`), newest last. While one is registered,\n * `openAsset` hands it the request first, and the panel opens the asset only when it returns\n * `false`.\n */\n assetOpeners: AssetOpener[];\n /** Generation counter for auto-open tracking — incremented on reset */\n autoOpenGeneration: number;\n /** Tracks which assets have been auto-opened in the current generation */\n autoOpenedAssets: Map<string, number>;\n /**\n * Advances on every `openAsset` call — a repeat open of the asset already\n * showing included — so a host that hides the panel (a workbench tab) can\n * reveal it for each request. A thread switch restoring that thread's open\n * assets does not advance it. Not persisted.\n */\n openRequestSeq: number;\n registerAssetPanelHost: () => void;\n unregisterAssetPanelHost: () => void;\n /** Registers a host's own opener; returns what unregisters it. */\n registerAssetOpener: (opener: AssetOpener) => () => void;\n /**\n * Opens an asset: a host's opener first, else the asset panel. Returns whether anything shows it:\n * an opener took it, or a mounted asset panel will. `false` (the host declined and no panel is\n * mounted) leaves the asset to whatever asked, such as a link that can still open as a link.\n */\n openAsset: (\n assetId: string,\n meta?: {\n name?: string;\n type?: AssetType;\n slideNumber?: number;\n /** Citation target (anchor + excerpt) the open should navigate to. */\n reference?: AthenaAssetCitationReference;\n /**\n * Swap the active tab for this asset instead of appending another tab.\n * Citation clicks use this: reading references shouldn't accumulate a\n * tab per cited document — the panel behaves as one preview surface.\n * A tab that already exists for the asset is re-targeted either way.\n */\n replaceActiveTab?: boolean;\n /** Who asked (default `'user'`); the SDK's auto-open passes `'auto'`. */\n origin?: AssetOpenOrigin;\n /** The link's own address, when a link asked (handed to a host's opener). */\n href?: string;\n },\n ) => boolean;\n closeTab: (assetId: string) => void;\n setActiveTab: (assetId: string) => void;\n setViewMode: (mode: ViewMode) => void;\n closePanel: () => void;\n toggleFullscreen: () => void;\n /**\n * Switch the active thread. Saves the current thread's asset panel state\n * and restores the new thread's state (if any). Pass null to clear.\n */\n setCurrentThread: (threadId: string | null) => void;\n /** Reset auto-open tracking (increments generation so new assets can auto-open) */\n resetAutoOpen: () => void;\n /** Check if an asset should auto-open, and mark it as opened if so */\n markAutoOpened: (assetId: string) => boolean;\n}\n\nexport const useAssetPanelStore = create<AssetPanelState>()(\n persist(\n (set, get) => ({\n isOpen: false,\n tabs: [],\n activeTabId: null,\n viewMode: 'tabs',\n isFullscreen: false,\n currentThreadId: null,\n threadStates: {},\n assetPanelHostCount: 0,\n assetOpeners: [],\n autoOpenGeneration: 0,\n autoOpenedAssets: new Map(),\n openRequestSeq: 0,\n\n registerAssetPanelHost: () =>\n set((state) => ({ assetPanelHostCount: state.assetPanelHostCount + 1 })),\n\n unregisterAssetPanelHost: () =>\n set((state) => ({ assetPanelHostCount: Math.max(0, state.assetPanelHostCount - 1) })),\n\n registerAssetOpener: (opener) => {\n set((state) => ({ assetOpeners: [...state.assetOpeners, opener] }));\n return () =>\n set((state) => {\n const index = state.assetOpeners.lastIndexOf(opener);\n if (index === -1) return state;\n const assetOpeners = state.assetOpeners.slice();\n assetOpeners.splice(index, 1);\n return { assetOpeners };\n });\n },\n\n openAsset: (assetId, meta) => {\n // A host that opens assets its own way takes the request first; `false` leaves it here.\n const opener = get().assetOpeners.at(-1);\n if (opener && opener(assetOpenRequest({ assetId, meta })) !== false) return true;\n set((s) => {\n const existing = s.tabs.find((t) => t.id === assetId);\n if (existing) {\n const tabs = meta\n ? s.tabs.map((t) =>\n t.id === assetId\n ? {\n ...t,\n name: meta.name ?? t.name,\n type: meta.type ?? t.type,\n slideNumber:\n 'slideNumber' in meta ? meta.slideNumber : t.slideNumber,\n // A repeat citation click re-targets the open tab: the new\n // reference reaches the iframe (src change -> navigation).\n reference:\n 'reference' in meta ? meta.reference : t.reference,\n }\n : t,\n )\n : s.tabs;\n return { isOpen: true, tabs, activeTabId: assetId, openRequestSeq: s.openRequestSeq + 1 };\n }\n const newTab: AssetTab = {\n id: assetId,\n name: meta?.name ?? null,\n type: meta?.type ?? 'unknown',\n slideNumber: meta?.slideNumber,\n reference: meta?.reference,\n };\n if (meta?.replaceActiveTab && s.activeTabId) {\n const activeIndex = s.tabs.findIndex((t) => t.id === s.activeTabId);\n if (activeIndex >= 0) {\n const tabs = s.tabs.slice();\n tabs[activeIndex] = newTab;\n return { isOpen: true, tabs, activeTabId: assetId, openRequestSeq: s.openRequestSeq + 1 };\n }\n }\n return {\n isOpen: true,\n tabs: [...s.tabs, newTab],\n activeTabId: assetId,\n openRequestSeq: s.openRequestSeq + 1,\n };\n });\n return get().assetPanelHostCount > 0;\n },\n\n closeTab: (assetId) =>\n set((s) => {\n const tabs = s.tabs.filter((t) => t.id !== assetId);\n if (tabs.length === 0) {\n return { isOpen: false, tabs: [], activeTabId: null, isFullscreen: false };\n }\n const activeTabId =\n s.activeTabId === assetId\n ? tabs[Math.min(s.tabs.findIndex((t) => t.id === assetId), tabs.length - 1)]?.id ?? null\n : s.activeTabId;\n return { tabs, activeTabId };\n }),\n\n setActiveTab: (assetId) => set({ activeTabId: assetId, viewMode: 'tabs' }),\n\n setViewMode: (mode) => set({ viewMode: mode }),\n\n closePanel: () =>\n set({ isOpen: false, tabs: [], activeTabId: null, viewMode: 'tabs', isFullscreen: false }),\n\n toggleFullscreen: () => set((s) => ({ isFullscreen: !s.isFullscreen })),\n\n setCurrentThread: (threadId) =>\n set((s) => {\n // No-op if same thread\n if (s.currentThreadId === threadId) {\n return s;\n }\n\n // Save current thread's asset state to the map (if we had one)\n const threadStates = { ...s.threadStates };\n if (s.currentThreadId !== null) {\n threadStates[s.currentThreadId] = {\n tabs: s.tabs,\n activeTabId: s.activeTabId,\n isOpen: s.isOpen,\n };\n }\n\n // Restore the new thread's state (or start fresh)\n const restored = threadId !== null ? threadStates[threadId] : undefined;\n\n return {\n currentThreadId: threadId,\n threadStates,\n tabs: restored?.tabs ?? [],\n activeTabId: restored?.activeTabId ?? null,\n isOpen: restored?.isOpen ?? false,\n // Reset transient UI state on thread switch\n isFullscreen: false,\n viewMode: 'tabs',\n };\n }),\n\n resetAutoOpen: () =>\n set((s) => ({ autoOpenGeneration: s.autoOpenGeneration + 1 })),\n\n markAutoOpened: (assetId: string) => {\n const state = get();\n if (state.autoOpenedAssets.get(assetId) === state.autoOpenGeneration) {\n return false; // already auto-opened in this generation\n }\n state.autoOpenedAssets.set(assetId, state.autoOpenGeneration);\n return true;\n },\n }),\n {\n name: 'athena-react-asset-panel',\n partialize: ({\n isOpen,\n tabs,\n activeTabId,\n viewMode,\n isFullscreen,\n currentThreadId,\n threadStates,\n }) => ({\n isOpen,\n tabs,\n activeTabId,\n viewMode,\n isFullscreen,\n currentThreadId,\n threadStates,\n }),\n storage: createJSONStorage(() => sessionStorage),\n },\n ),\n);\n"],"names":["create","persist","createJSONStorage"],"mappings":";;;;AAgDA,SAAS,iBAAiB;AAAA,EACxB;AAAA,EACA;AACF,GAGqB;AACnB,SAAO;AAAA,IACL;AAAA,IACA,SAAQ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AM,WAAW,aAAa,OAAO,aAAa,QAAQ,IAAI;AAE9D,eAAO;AAAA,UACL,iBAAiB;AAAA,UACjB;AAAA,UACA,OAAM,qCAAU,SAAQ,CAAA;AAAA,UACxB,cAAa,qCAAU,gBAAe;AAAA,UACtC,SAAQ,qCAAU,WAAU;AAAA;AAAA,UAE5B,cAAc;AAAA,UACd,UAAU;AAAA,QAAA;AAAA,MAEd,CAAC;AAAA,MAEH,eAAe,MACb,IAAI,CAAC,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAA,EAAI;AAAA,MAE/D,gBAAgB,CAAC,YAAoB;AACnC,cAAM,QAAQ,IAAA;AACd,YAAI,MAAM,iBAAiB,IAAI,OAAO,MAAM,MAAM,oBAAoB;AACpE,iBAAO;AAAA,QACT;AACA,cAAM,iBAAiB,IAAI,SAAS,MAAM,kBAAkB;AAC5D,eAAO;AAAA,MACT;AAAA,IAAA;AAAA,IAEF;AAAA,MACE,MAAM;AAAA,MACN,YAAY,CAAC;AAAA,QACX;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA,OACK;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,MAEF,SAASC,WAAAA,kBAAkB,MAAM,cAAc;AAAA,IAAA;AAAA,EACjD;AAEJ;;"}
1
+ {"version":3,"file":"asset-panel-store.cjs","sources":["../../src/assets/asset-panel-store.ts"],"sourcesContent":["import { create } from 'zustand';\nimport { createJSONStorage, persist } from 'zustand/middleware';\nimport type { AthenaAssetCitationReference } from './asset-embed-messages';\n\nexport type AssetType = 'presentation' | 'spreadsheet' | 'document' | 'notebook' | 'unknown';\n\nexport type ViewMode = 'tabs' | 'tiled';\n\nexport interface AssetTab {\n id: string;\n name: string | null;\n type: AssetType;\n slideNumber?: number;\n /** The citation target (anchor + excerpt) the tab was last opened at. */\n reference?: AthenaAssetCitationReference;\n}\n\ninterface ThreadAssetState {\n tabs: AssetTab[];\n activeTabId: string | null;\n isOpen: boolean;\n}\n\n/**\n * Who asked for an asset: the person (a tool card's Open, a citation or asset link in a message)\n * or the SDK's auto-open after a tool created or touched the asset.\n */\nexport type AssetOpenOrigin = 'user' | 'auto';\n\n/**\n * What the tool behind an auto-open did with the asset: made it (`created`, a create tool or a\n * studio SDK's `Create*`), opened it for the person to see (`shown`, `open_asset_in_workspace`), or\n * only read or changed one that was there (`touched`).\n */\nexport type AssetAutoOpenKind = 'created' | 'shown' | 'touched';\n\n/**\n * Why the SDK opened an asset by itself (`origin: 'auto'`): the tool whose result named it, and\n * what that tool did with it. A host that follows only what the agent makes opens `created`.\n */\nexport interface AssetAutoOpen {\n tool: string;\n kind: AssetAutoOpenKind;\n}\n\n/** A request to open an asset, as a host's own opener receives it (`AthenaProvider onOpenAsset`). */\nexport interface AssetOpenRequest {\n assetId: string;\n origin: AssetOpenOrigin;\n name?: string;\n type?: AssetType;\n slideNumber?: number;\n /** The citation target (anchor + excerpt) the open should navigate to. */\n reference?: AthenaAssetCitationReference;\n /** The link's own address, when a link asked: a host that opens it on the web keeps every parameter it carried. */\n href?: string;\n /** An auto-open's cause: the tool, and whether it made, showed or only touched the asset. */\n autoOpen?: AssetAutoOpen;\n}\n\n/**\n * A host's own way to open an asset (a desktop app's tabs, a route of its own). Return `false` to\n * leave the request to the SDK's asset panel.\n */\nexport type AssetOpener = (request: AssetOpenRequest) => boolean | void;\n\nfunction assetOpenRequest({\n assetId,\n meta,\n}: {\n assetId: string;\n meta: Parameters<AssetPanelState['openAsset']>[1];\n}): AssetOpenRequest {\n return {\n assetId,\n origin: meta?.origin ?? 'user',\n ...(meta?.name !== undefined ? { name: meta.name } : {}),\n ...(meta?.type !== undefined ? { type: meta.type } : {}),\n ...(meta?.slideNumber !== undefined ? { slideNumber: meta.slideNumber } : {}),\n ...(meta?.reference !== undefined ? { reference: meta.reference } : {}),\n ...(meta?.href !== undefined ? { href: meta.href } : {}),\n ...(meta?.autoOpen !== undefined ? { autoOpen: meta.autoOpen } : {}),\n };\n}\n\nexport interface AssetPanelState {\n isOpen: boolean;\n tabs: AssetTab[];\n activeTabId: string | null;\n viewMode: ViewMode;\n isFullscreen: boolean;\n /** The current thread ID. Asset panel state is scoped per thread. */\n currentThreadId: string | null;\n /** Per-thread asset panel state — tabs and active tab persist per thread. */\n threadStates: Record<string, ThreadAssetState>;\n /** Number of registered hosts that can reveal the asset panel. */\n assetPanelHostCount: number;\n /**\n * The hosts' own openers (`AthenaProvider onOpenAsset`), newest last. While one is registered,\n * `openAsset` hands it the request first, and the panel opens the asset only when it returns\n * `false`.\n */\n assetOpeners: AssetOpener[];\n /** Generation counter for auto-open tracking — incremented on reset */\n autoOpenGeneration: number;\n /** Tracks which assets have been auto-opened in the current generation */\n autoOpenedAssets: Map<string, number>;\n /**\n * The assets a tool that made them or showed them to the person auto-opened in the current\n * generation: such an open happens once per asset, and a touch earlier in the generation never\n * holds it.\n */\n autoOpenedMadeOrShown: Map<string, number>;\n /**\n * Advances on every `openAsset` call — a repeat open of the asset already\n * showing included — so a host that hides the panel (a workbench tab) can\n * reveal it for each request. A thread switch restoring that thread's open\n * assets does not advance it. Not persisted.\n */\n openRequestSeq: number;\n registerAssetPanelHost: () => void;\n unregisterAssetPanelHost: () => void;\n /** Registers a host's own opener; returns what unregisters it. */\n registerAssetOpener: (opener: AssetOpener) => () => void;\n /**\n * Opens an asset: a host's opener first, else the asset panel. Returns whether anything shows it:\n * an opener took it, or a mounted asset panel will. `false` (the host declined and no panel is\n * mounted) leaves the asset to whatever asked, such as a link that can still open as a link.\n */\n openAsset: (\n assetId: string,\n meta?: {\n name?: string;\n type?: AssetType;\n slideNumber?: number;\n /** Citation target (anchor + excerpt) the open should navigate to. */\n reference?: AthenaAssetCitationReference;\n /**\n * Swap the active tab for this asset instead of appending another tab.\n * Citation clicks use this: reading references shouldn't accumulate a\n * tab per cited document — the panel behaves as one preview surface.\n * A tab that already exists for the asset is re-targeted either way.\n */\n replaceActiveTab?: boolean;\n /** Who asked (default `'user'`); the SDK's auto-open passes `'auto'`. */\n origin?: AssetOpenOrigin;\n /** The link's own address, when a link asked (handed to a host's opener). */\n href?: string;\n /** An auto-open's cause (handed to a host's opener). */\n autoOpen?: AssetAutoOpen;\n },\n ) => boolean;\n closeTab: (assetId: string) => void;\n setActiveTab: (assetId: string) => void;\n setViewMode: (mode: ViewMode) => void;\n closePanel: () => void;\n toggleFullscreen: () => void;\n /**\n * Switch the active thread. Saves the current thread's asset panel state\n * and restores the new thread's state (if any). Pass null to clear.\n */\n setCurrentThread: (threadId: string | null) => void;\n /** Reset auto-open tracking (increments generation so new assets can auto-open) */\n resetAutoOpen: () => void;\n /**\n * Check if an asset should auto-open, and mark it as opened if so: once per generation, except\n * that a tool that made or showed the asset (`kind`, default `'touched'`) still opens it after a\n * tool that only touched it did (where a runtime nests a script's sub-calls as tool calls, the\n * script's own call can name the deck its `CreatePresentation` made before that sub-call's\n * auto-open runs). An asset made or shown opens once: a later make or show of it in the same\n * generation never takes the person back to it from what they opened since.\n */\n markAutoOpened: (assetId: string, kind?: AssetAutoOpenKind) => boolean;\n}\n\nexport const useAssetPanelStore = create<AssetPanelState>()(\n persist(\n (set, get) => ({\n isOpen: false,\n tabs: [],\n activeTabId: null,\n viewMode: 'tabs',\n isFullscreen: false,\n currentThreadId: null,\n threadStates: {},\n assetPanelHostCount: 0,\n assetOpeners: [],\n autoOpenGeneration: 0,\n autoOpenedAssets: new Map(),\n autoOpenedMadeOrShown: new Map(),\n openRequestSeq: 0,\n\n registerAssetPanelHost: () =>\n set((state) => ({ assetPanelHostCount: state.assetPanelHostCount + 1 })),\n\n unregisterAssetPanelHost: () =>\n set((state) => ({ assetPanelHostCount: Math.max(0, state.assetPanelHostCount - 1) })),\n\n registerAssetOpener: (opener) => {\n set((state) => ({ assetOpeners: [...state.assetOpeners, opener] }));\n return () =>\n set((state) => {\n const index = state.assetOpeners.lastIndexOf(opener);\n if (index === -1) return state;\n const assetOpeners = state.assetOpeners.slice();\n assetOpeners.splice(index, 1);\n return { assetOpeners };\n });\n },\n\n openAsset: (assetId, meta) => {\n // A host that opens assets its own way takes the request first; `false` leaves it here.\n const opener = get().assetOpeners.at(-1);\n if (opener && opener(assetOpenRequest({ assetId, meta })) !== false) return true;\n set((s) => {\n const existing = s.tabs.find((t) => t.id === assetId);\n if (existing) {\n const tabs = meta\n ? s.tabs.map((t) =>\n t.id === assetId\n ? {\n ...t,\n name: meta.name ?? t.name,\n type: meta.type ?? t.type,\n slideNumber:\n 'slideNumber' in meta ? meta.slideNumber : t.slideNumber,\n // A repeat citation click re-targets the open tab: the new\n // reference reaches the iframe (src change -> navigation).\n reference:\n 'reference' in meta ? meta.reference : t.reference,\n }\n : t,\n )\n : s.tabs;\n return { isOpen: true, tabs, activeTabId: assetId, openRequestSeq: s.openRequestSeq + 1 };\n }\n const newTab: AssetTab = {\n id: assetId,\n name: meta?.name ?? null,\n type: meta?.type ?? 'unknown',\n slideNumber: meta?.slideNumber,\n reference: meta?.reference,\n };\n if (meta?.replaceActiveTab && s.activeTabId) {\n const activeIndex = s.tabs.findIndex((t) => t.id === s.activeTabId);\n if (activeIndex >= 0) {\n const tabs = s.tabs.slice();\n tabs[activeIndex] = newTab;\n return { isOpen: true, tabs, activeTabId: assetId, openRequestSeq: s.openRequestSeq + 1 };\n }\n }\n return {\n isOpen: true,\n tabs: [...s.tabs, newTab],\n activeTabId: assetId,\n openRequestSeq: s.openRequestSeq + 1,\n };\n });\n return get().assetPanelHostCount > 0;\n },\n\n closeTab: (assetId) =>\n set((s) => {\n const tabs = s.tabs.filter((t) => t.id !== assetId);\n if (tabs.length === 0) {\n return { isOpen: false, tabs: [], activeTabId: null, isFullscreen: false };\n }\n const activeTabId =\n s.activeTabId === assetId\n ? tabs[Math.min(s.tabs.findIndex((t) => t.id === assetId), tabs.length - 1)]?.id ?? null\n : s.activeTabId;\n return { tabs, activeTabId };\n }),\n\n setActiveTab: (assetId) => set({ activeTabId: assetId, viewMode: 'tabs' }),\n\n setViewMode: (mode) => set({ viewMode: mode }),\n\n closePanel: () =>\n set({ isOpen: false, tabs: [], activeTabId: null, viewMode: 'tabs', isFullscreen: false }),\n\n toggleFullscreen: () => set((s) => ({ isFullscreen: !s.isFullscreen })),\n\n setCurrentThread: (threadId) =>\n set((s) => {\n // No-op if same thread\n if (s.currentThreadId === threadId) {\n return s;\n }\n\n // Save current thread's asset state to the map (if we had one)\n const threadStates = { ...s.threadStates };\n if (s.currentThreadId !== null) {\n threadStates[s.currentThreadId] = {\n tabs: s.tabs,\n activeTabId: s.activeTabId,\n isOpen: s.isOpen,\n };\n }\n\n // Restore the new thread's state (or start fresh)\n const restored = threadId !== null ? threadStates[threadId] : undefined;\n\n return {\n currentThreadId: threadId,\n threadStates,\n tabs: restored?.tabs ?? [],\n activeTabId: restored?.activeTabId ?? null,\n isOpen: restored?.isOpen ?? false,\n // Reset transient UI state on thread switch\n isFullscreen: false,\n viewMode: 'tabs',\n };\n }),\n\n resetAutoOpen: () =>\n set((s) => ({ autoOpenGeneration: s.autoOpenGeneration + 1 })),\n\n markAutoOpened: (assetId: string, kind: AssetAutoOpenKind = 'touched') => {\n const state = get();\n const generation = state.autoOpenGeneration;\n if (kind === 'touched') {\n if (state.autoOpenedAssets.get(assetId) === generation) {\n return false; // already auto-opened in this generation\n }\n } else {\n if (state.autoOpenedMadeOrShown.get(assetId) === generation) return false;\n state.autoOpenedMadeOrShown.set(assetId, generation);\n }\n state.autoOpenedAssets.set(assetId, generation);\n return true;\n },\n }),\n {\n name: 'athena-react-asset-panel',\n partialize: ({\n isOpen,\n tabs,\n activeTabId,\n viewMode,\n isFullscreen,\n currentThreadId,\n threadStates,\n }) => ({\n isOpen,\n tabs,\n activeTabId,\n viewMode,\n isFullscreen,\n currentThreadId,\n threadStates,\n }),\n storage: createJSONStorage(() => sessionStorage),\n },\n ),\n);\n"],"names":["create","persist","createJSONStorage"],"mappings":";;;;AAkEA,SAAS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