@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
@@ -0,0 +1,125 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ var _a, _b;
5
+ const AthenaApiErrorKind = {
6
+ /** Agora answered with an error status (4xx or 5xx). */
7
+ Http: "http",
8
+ /** Agora answered a GraphQL operation with errors (a refused read, an invalid query), or with no data. */
9
+ GraphQL: "graphql",
10
+ /** No answer came: offline, a refused CORS preflight, a dropped connection. */
11
+ Network: "network",
12
+ /** No answer came within the request's `timeoutMs`, so the SDK abandoned it. */
13
+ Timeout: "timeout",
14
+ /** The provider could not resolve a credential: its `getToken` threw. */
15
+ Credential: "credential",
16
+ /** The answer could not be read: not the JSON it said it was, or cut off. */
17
+ Response: "response",
18
+ /** The SDK refused to send the request (the message says why). */
19
+ Request: "request"
20
+ };
21
+ const ATHENA_API_ERROR = Symbol.for("athena-sdk.AthenaApiError");
22
+ class AthenaApiError extends (_b = Error, _a = ATHENA_API_ERROR, _b) {
23
+ constructor(options) {
24
+ super(options.message, options.cause === void 0 ? void 0 : { cause: options.cause });
25
+ __publicField(this, _a, true);
26
+ __publicField(this, "kind");
27
+ /**
28
+ * The HTTP status agora answered with: a GraphQL error answered with 200 says
29
+ * 200. `0` when no answer came (`network`, `timeout`, `credential`,
30
+ * `request`).
31
+ */
32
+ __publicField(this, "status");
33
+ /**
34
+ * Agora's machine-readable code: the first GraphQL error's
35
+ * `extensions.code`, or a REST error's `detail.code`. `null` when it gave
36
+ * none.
37
+ */
38
+ __publicField(this, "code");
39
+ /** Every GraphQL error of the answer; empty for other failures. */
40
+ __publicField(this, "errors");
41
+ /** A REST error's `detail` (FastAPI's envelope), else its body as read; `undefined` when there was none. */
42
+ __publicField(this, "detail");
43
+ /**
44
+ * How long agora asked the caller to wait before trying again (`Retry-After`,
45
+ * or the `retryAfterSeconds` of a rate-limit refusal), in ms; `null` when it
46
+ * did not say.
47
+ */
48
+ __publicField(this, "retryAfterMs");
49
+ /** The request's method. */
50
+ __publicField(this, "method");
51
+ /** The request's path, without its query string. */
52
+ __publicField(this, "path");
53
+ this.name = "AthenaApiError";
54
+ this.kind = options.kind;
55
+ this.status = options.status ?? 0;
56
+ this.code = options.code ?? null;
57
+ this.errors = options.errors ?? [];
58
+ this.detail = options.detail;
59
+ this.retryAfterMs = options.retryAfterMs ?? null;
60
+ this.method = options.method;
61
+ this.path = options.path;
62
+ }
63
+ toJSON() {
64
+ return {
65
+ name: this.name,
66
+ kind: this.kind,
67
+ status: this.status,
68
+ code: this.code,
69
+ message: this.message,
70
+ errors: this.errors,
71
+ detail: this.detail,
72
+ retryAfterMs: this.retryAfterMs,
73
+ method: this.method,
74
+ path: this.path
75
+ };
76
+ }
77
+ }
78
+ function isAthenaApiError(value) {
79
+ return value instanceof AthenaApiError || typeof value === "object" && value !== null && Reflect.get(value, ATHENA_API_ERROR) === true;
80
+ }
81
+ function isRecord(value) {
82
+ return typeof value === "object" && value !== null && !Array.isArray(value);
83
+ }
84
+ function graphQLErrorEntries(body) {
85
+ const errors = isRecord(body) ? body.errors : void 0;
86
+ if (!Array.isArray(errors)) return [];
87
+ return errors.flatMap((entry) => {
88
+ if (!isRecord(entry) || typeof entry.message !== "string") return [];
89
+ const path = Array.isArray(entry.path) ? entry.path.filter((part) => typeof part === "string" || typeof part === "number") : void 0;
90
+ return [
91
+ {
92
+ message: entry.message,
93
+ ...path ? { path } : {},
94
+ ...isRecord(entry.extensions) ? { extensions: entry.extensions } : {}
95
+ }
96
+ ];
97
+ });
98
+ }
99
+ function graphQLErrorCode(entry) {
100
+ var _a2;
101
+ const code = (_a2 = entry == null ? void 0 : entry.extensions) == null ? void 0 : _a2.code;
102
+ return typeof code === "string" ? code : null;
103
+ }
104
+ function restErrorDetail(body) {
105
+ const detail = isRecord(body) && "detail" in body ? body.detail : body;
106
+ if (typeof detail === "string") {
107
+ return { detail, code: null, message: detail || null, retryAfterSeconds: null };
108
+ }
109
+ if (!isRecord(detail)) return { detail, code: null, message: null, retryAfterSeconds: null };
110
+ return {
111
+ detail,
112
+ code: typeof detail.code === "string" ? detail.code : null,
113
+ message: typeof detail.message === "string" ? detail.message : null,
114
+ retryAfterSeconds: typeof detail.retryAfterSeconds === "number" && Number.isFinite(detail.retryAfterSeconds) ? detail.retryAfterSeconds : null
115
+ };
116
+ }
117
+ export {
118
+ AthenaApiError,
119
+ AthenaApiErrorKind,
120
+ graphQLErrorCode,
121
+ graphQLErrorEntries,
122
+ isAthenaApiError,
123
+ restErrorDetail
124
+ };
125
+ //# sourceMappingURL=athena-api-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"athena-api-error.js","sources":["../../src/data/athena-api-error.ts"],"sourcesContent":["/**\n * What the SDK's data layer throws (`useAthenaFetch`, `useAthenaGraphQL`,\n * `useAthenaGraphQLMutation`, `useAthenaRest`, `useSemanticQuery`): one typed\n * error that says how a request failed (`kind`), with the HTTP status, agora's\n * machine-readable code and its message. A request its caller cancelled is the\n * one exception: it rejects with the abort's own reason, as `fetch` does.\n */\n\n/** How a request failed. */\nexport const AthenaApiErrorKind = {\n /** Agora answered with an error status (4xx or 5xx). */\n Http: 'http',\n /** Agora answered a GraphQL operation with errors (a refused read, an invalid query), or with no data. */\n GraphQL: 'graphql',\n /** No answer came: offline, a refused CORS preflight, a dropped connection. */\n Network: 'network',\n /** No answer came within the request's `timeoutMs`, so the SDK abandoned it. */\n Timeout: 'timeout',\n /** The provider could not resolve a credential: its `getToken` threw. */\n Credential: 'credential',\n /** The answer could not be read: not the JSON it said it was, or cut off. */\n Response: 'response',\n /** The SDK refused to send the request (the message says why). */\n Request: 'request',\n} as const;\nexport type AthenaApiErrorKind = (typeof AthenaApiErrorKind)[keyof typeof AthenaApiErrorKind];\n\n/** One entry of a GraphQL answer's `errors`. */\nexport interface AthenaGraphQLErrorEntry {\n message: string;\n path?: readonly (string | number)[];\n /** Agora puts its `code` here (`UNAUTHORIZED`, `BAD_USER_INPUT`, `RATE_LIMITED`…). */\n extensions?: Readonly<Record<string, unknown>>;\n}\n\nexport interface AthenaApiErrorOptions {\n kind: AthenaApiErrorKind;\n message: string;\n /** The HTTP status agora answered with; `0` (the default) when no answer came. */\n status?: number;\n code?: string | null;\n errors?: readonly AthenaGraphQLErrorEntry[];\n detail?: unknown;\n retryAfterMs?: number | null;\n method: string;\n path: string;\n cause?: unknown;\n}\n\n/** Marks an `AthenaApiError` across copies of the SDK (a host bundling two builds). */\nconst ATHENA_API_ERROR: unique symbol = Symbol.for('athena-sdk.AthenaApiError');\n\nexport class AthenaApiError extends Error {\n readonly [ATHENA_API_ERROR] = true;\n readonly kind: AthenaApiErrorKind;\n /**\n * The HTTP status agora answered with: a GraphQL error answered with 200 says\n * 200. `0` when no answer came (`network`, `timeout`, `credential`,\n * `request`).\n */\n readonly status: number;\n /**\n * Agora's machine-readable code: the first GraphQL error's\n * `extensions.code`, or a REST error's `detail.code`. `null` when it gave\n * none.\n */\n readonly code: string | null;\n /** Every GraphQL error of the answer; empty for other failures. */\n readonly errors: readonly AthenaGraphQLErrorEntry[];\n /** A REST error's `detail` (FastAPI's envelope), else its body as read; `undefined` when there was none. */\n readonly detail: unknown;\n /**\n * How long agora asked the caller to wait before trying again (`Retry-After`,\n * or the `retryAfterSeconds` of a rate-limit refusal), in ms; `null` when it\n * did not say.\n */\n readonly retryAfterMs: number | null;\n /** The request's method. */\n readonly method: string;\n /** The request's path, without its query string. */\n readonly path: string;\n\n constructor(options: AthenaApiErrorOptions) {\n super(options.message, options.cause === undefined ? undefined : { cause: options.cause });\n this.name = 'AthenaApiError';\n this.kind = options.kind;\n this.status = options.status ?? 0;\n this.code = options.code ?? null;\n this.errors = options.errors ?? [];\n this.detail = options.detail;\n this.retryAfterMs = options.retryAfterMs ?? null;\n this.method = options.method;\n this.path = options.path;\n }\n\n toJSON(): Record<string, unknown> {\n return {\n name: this.name,\n kind: this.kind,\n status: this.status,\n code: this.code,\n message: this.message,\n errors: this.errors,\n detail: this.detail,\n retryAfterMs: this.retryAfterMs,\n method: this.method,\n path: this.path,\n };\n }\n}\n\n/** Whether `value` is an `AthenaApiError`, from this copy of the SDK or another. */\nexport function isAthenaApiError(value: unknown): value is AthenaApiError {\n return (\n value instanceof AthenaApiError ||\n (typeof value === 'object' && value !== null && Reflect.get(value, ATHENA_API_ERROR) === true)\n );\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/** The `errors` of a GraphQL answer, read leniently: entries without a string message are dropped. */\nexport function graphQLErrorEntries(body: unknown): AthenaGraphQLErrorEntry[] {\n const errors = isRecord(body) ? body.errors : undefined;\n if (!Array.isArray(errors)) return [];\n return errors.flatMap((entry): AthenaGraphQLErrorEntry[] => {\n if (!isRecord(entry) || typeof entry.message !== 'string') return [];\n const path = Array.isArray(entry.path)\n ? entry.path.filter((part): part is string | number => typeof part === 'string' || typeof part === 'number')\n : undefined;\n return [\n {\n message: entry.message,\n ...(path ? { path } : {}),\n ...(isRecord(entry.extensions) ? { extensions: entry.extensions } : {}),\n },\n ];\n });\n}\n\n/** The string `extensions.code` of a GraphQL error, if it has one. */\nexport function graphQLErrorCode(entry: AthenaGraphQLErrorEntry | undefined): string | null {\n const code = entry?.extensions?.code;\n return typeof code === 'string' ? code : null;\n}\n\n/**\n * What a REST error body says: FastAPI's `{ detail }` envelope, whose detail\n * is a string or agora's structured `{ code, message, retryAfterSeconds }`.\n */\nexport function restErrorDetail(body: unknown): {\n detail: unknown;\n code: string | null;\n message: string | null;\n retryAfterSeconds: number | null;\n} {\n const detail = isRecord(body) && 'detail' in body ? body.detail : body;\n if (typeof detail === 'string') {\n return { detail, code: null, message: detail || null, retryAfterSeconds: null };\n }\n if (!isRecord(detail)) return { detail, code: null, message: null, retryAfterSeconds: null };\n return {\n detail,\n code: typeof detail.code === 'string' ? detail.code : null,\n message: typeof detail.message === 'string' ? detail.message : null,\n retryAfterSeconds:\n typeof detail.retryAfterSeconds === 'number' && Number.isFinite(detail.retryAfterSeconds)\n ? detail.retryAfterSeconds\n : null,\n };\n}\n"],"names":["_a"],"mappings":";;;AASO;AAAA,MAAM,qBAAqB;AAAA;AAAA,EAEhC,MAAM;AAAA;AAAA,EAEN,SAAS;AAAA;AAAA,EAET,SAAS;AAAA;AAAA,EAET,SAAS;AAAA;AAAA,EAET,YAAY;AAAA;AAAA,EAEZ,UAAU;AAAA;AAAA,EAEV,SAAS;AACX;AA0BA,MAAM,mBAAkC,OAAO,IAAI,2BAA2B;AAEvE,MAAM,wBAAuB,YACxB,uBADwB,IAAM;AAAA,EA8BxC,YAAY,SAAgC;AAC1C,UAAM,QAAQ,SAAS,QAAQ,UAAU,SAAY,SAAY,EAAE,OAAO,QAAQ,MAAA,CAAO;AA9B3F,wBAAU,IAAoB;AACrB;AAMA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AAAA;AAEA;AAAA;AAMA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AAAA;AAEA;AAAA;AAIP,SAAK,OAAO;AACZ,SAAK,OAAO,QAAQ;AACpB,SAAK,SAAS,QAAQ,UAAU;AAChC,SAAK,OAAO,QAAQ,QAAQ;AAC5B,SAAK,SAAS,QAAQ,UAAU,CAAA;AAChC,SAAK,SAAS,QAAQ;AACtB,SAAK,eAAe,QAAQ,gBAAgB;AAC5C,SAAK,SAAS,QAAQ;AACtB,SAAK,OAAO,QAAQ;AAAA,EACtB;AAAA,EAEA,SAAkC;AAChC,WAAO;AAAA,MACL,MAAM,KAAK;AAAA,MACX,MAAM,KAAK;AAAA,MACX,QAAQ,KAAK;AAAA,MACb,MAAM,KAAK;AAAA,MACX,SAAS,KAAK;AAAA,MACd,QAAQ,KAAK;AAAA,MACb,QAAQ,KAAK;AAAA,MACb,cAAc,KAAK;AAAA,MACnB,QAAQ,KAAK;AAAA,MACb,MAAM,KAAK;AAAA,IAAA;AAAA,EAEf;AACF;AAGO,SAAS,iBAAiB,OAAyC;AACxE,SACE,iBAAiB,kBAChB,OAAO,UAAU,YAAY,UAAU,QAAQ,QAAQ,IAAI,OAAO,gBAAgB,MAAM;AAE7F;AAEA,SAAS,SAAS,OAAkD;AAClE,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAGO,SAAS,oBAAoB,MAA0C;AAC5E,QAAM,SAAS,SAAS,IAAI,IAAI,KAAK,SAAS;AAC9C,MAAI,CAAC,MAAM,QAAQ,MAAM,UAAU,CAAA;AACnC,SAAO,OAAO,QAAQ,CAAC,UAAqC;AAC1D,QAAI,CAAC,SAAS,KAAK,KAAK,OAAO,MAAM,YAAY,SAAU,QAAO,CAAA;AAClE,UAAM,OAAO,MAAM,QAAQ,MAAM,IAAI,IACjC,MAAM,KAAK,OAAO,CAAC,SAAkC,OAAO,SAAS,YAAY,OAAO,SAAS,QAAQ,IACzG;AACJ,WAAO;AAAA,MACL;AAAA,QACE,SAAS,MAAM;AAAA,QACf,GAAI,OAAO,EAAE,KAAA,IAAS,CAAA;AAAA,QACtB,GAAI,SAAS,MAAM,UAAU,IAAI,EAAE,YAAY,MAAM,eAAe,CAAA;AAAA,MAAC;AAAA,IACvE;AAAA,EAEJ,CAAC;AACH;AAGO,SAAS,iBAAiB,OAA2D;AAtIrF,MAAAA;AAuIL,QAAM,QAAOA,MAAA,+BAAO,eAAP,gBAAAA,IAAmB;AAChC,SAAO,OAAO,SAAS,WAAW,OAAO;AAC3C;AAMO,SAAS,gBAAgB,MAK9B;AACA,QAAM,SAAS,SAAS,IAAI,KAAK,YAAY,OAAO,KAAK,SAAS;AAClE,MAAI,OAAO,WAAW,UAAU;AAC9B,WAAO,EAAE,QAAQ,MAAM,MAAM,SAAS,UAAU,MAAM,mBAAmB,KAAA;AAAA,EAC3E;AACA,MAAI,CAAC,SAAS,MAAM,EAAG,QAAO,EAAE,QAAQ,MAAM,MAAM,SAAS,MAAM,mBAAmB,KAAA;AACtF,SAAO;AAAA,IACL;AAAA,IACA,MAAM,OAAO,OAAO,SAAS,WAAW,OAAO,OAAO;AAAA,IACtD,SAAS,OAAO,OAAO,YAAY,WAAW,OAAO,UAAU;AAAA,IAC/D,mBACE,OAAO,OAAO,sBAAsB,YAAY,OAAO,SAAS,OAAO,iBAAiB,IACpF,OAAO,oBACP;AAAA,EAAA;AAEV;"}
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const reactQuery = require("@tanstack/react-query");
5
+ const require$$0 = require("react");
6
+ const accountIdentity = require("../auth/account-identity.cjs");
7
+ const AthenaAuthContext = require("../auth/AthenaAuthContext.cjs");
8
+ const AthenaCredentialSourceContext = require("../auth/AthenaCredentialSourceContext.cjs");
9
+ const AthenaContext = require("../provider/AthenaContext.cjs");
10
+ const athenaApiError = require("./athena-api-error.cjs");
11
+ const athenaRequest = require("./athena-request.cjs");
12
+ const AthenaDataQueryClientContext = require$$0.createContext(null);
13
+ function AthenaDataQueryClientProvider({ children }) {
14
+ const [client] = require$$0.useState(() => new reactQuery.QueryClient());
15
+ require$$0.useEffect(() => {
16
+ client.mount();
17
+ return () => client.unmount();
18
+ }, [client]);
19
+ return /* @__PURE__ */ jsxRuntime.jsx(AthenaDataQueryClientContext.Provider, { value: client, children });
20
+ }
21
+ function useAthenaDataQueryClient() {
22
+ const own = require$$0.useContext(AthenaDataQueryClientContext);
23
+ const inContext = require$$0.useContext(reactQuery.QueryClientContext);
24
+ const fallback = require$$0.useRef(null);
25
+ if (own) return own;
26
+ if (inContext) return inContext;
27
+ fallback.current ?? (fallback.current = new reactQuery.QueryClient());
28
+ return fallback.current;
29
+ }
30
+ const AthenaDataKind = {
31
+ GraphQL: "graphql",
32
+ Rest: "rest",
33
+ SemanticQuery: "semantic-query"
34
+ };
35
+ function useAthenaDataScope() {
36
+ var _a, _b;
37
+ const { backendUrl, apiKey, token } = AthenaContext.useAthenaConfig();
38
+ const principal = ((_b = (_a = require$$0.useContext(AthenaAuthContext.AthenaAuthContext)) == null ? void 0 : _a.user) == null ? void 0 : _b.userId) ?? "";
39
+ const scopeEpoch = AthenaCredentialSourceContext.useAthenaCredentialScopeEpoch();
40
+ const [apiKeyPart, heldTokenPart] = accountIdentity.credentialKeyParts({ apiKey, heldToken: token });
41
+ return require$$0.useMemo(
42
+ () => ["athena-sdk", "data", backendUrl, principal, apiKeyPart, heldTokenPart, scopeEpoch],
43
+ [backendUrl, principal, apiKeyPart, heldTokenPart, scopeEpoch]
44
+ );
45
+ }
46
+ const ATHENA_DATA_STALE_MS = 3e4;
47
+ const MAX_TRANSIENT_RETRIES = 2;
48
+ const MAX_RETRY_DELAY_MS = 3e4;
49
+ const MAX_HINTED_RETRY_DELAY_MS = 6e4;
50
+ function retryAthenaRead(failureCount, error) {
51
+ if (!athenaApiError.isAthenaApiError(error) || failureCount >= MAX_TRANSIENT_RETRIES) return false;
52
+ if (error.kind === athenaApiError.AthenaApiErrorKind.Network) return true;
53
+ return error.kind === athenaApiError.AthenaApiErrorKind.Http && error.status >= 500;
54
+ }
55
+ function athenaRetryDelay(failureCount, error) {
56
+ if (athenaApiError.isAthenaApiError(error) && error.retryAfterMs !== null) {
57
+ return Math.min(error.retryAfterMs, MAX_HINTED_RETRY_DELAY_MS);
58
+ }
59
+ return Math.min(1e3 * 2 ** failureCount, MAX_RETRY_DELAY_MS);
60
+ }
61
+ function enabledAnd(enabled, ready) {
62
+ if (typeof enabled === "function") return (query) => ready && enabled(query);
63
+ return ready && (enabled ?? true);
64
+ }
65
+ function inScope(queryKey, scope) {
66
+ return scope.every((part, at) => Object.is(queryKey[at], part));
67
+ }
68
+ function matchesFilter(queryKey, scope, filter) {
69
+ var _a;
70
+ if (!filter) return true;
71
+ const kind = queryKey[scope.length];
72
+ const subject = queryKey[scope.length + 1];
73
+ if (typeof subject !== "string") return false;
74
+ if (kind === AthenaDataKind.GraphQL) {
75
+ const operationName = queryKey[scope.length + 3];
76
+ const name = (_a = athenaRequest.selectedGraphQLOperation(subject, typeof operationName === "string" ? operationName : null)) == null ? void 0 : _a.name;
77
+ return typeof name === "string" && (filter.operationNames ?? []).includes(name);
78
+ }
79
+ if (kind === AthenaDataKind.Rest) {
80
+ return (filter.paths ?? []).some((prefix) => subject.startsWith(prefix));
81
+ }
82
+ if (kind === AthenaDataKind.SemanticQuery) {
83
+ return (filter.semanticModelIds ?? []).includes(subject);
84
+ }
85
+ return false;
86
+ }
87
+ function useInvalidateAthenaQueries() {
88
+ const client = useAthenaDataQueryClient();
89
+ const scope = useAthenaDataScope();
90
+ return require$$0.useCallback(
91
+ (filter) => client.invalidateQueries({
92
+ predicate: ({ queryKey }) => inScope(queryKey, scope) && matchesFilter(queryKey, scope, filter)
93
+ }),
94
+ [client, scope]
95
+ );
96
+ }
97
+ exports.ATHENA_DATA_STALE_MS = ATHENA_DATA_STALE_MS;
98
+ exports.AthenaDataKind = AthenaDataKind;
99
+ exports.AthenaDataQueryClientProvider = AthenaDataQueryClientProvider;
100
+ exports.athenaRetryDelay = athenaRetryDelay;
101
+ exports.enabledAnd = enabledAnd;
102
+ exports.retryAthenaRead = retryAthenaRead;
103
+ exports.useAthenaDataQueryClient = useAthenaDataQueryClient;
104
+ exports.useAthenaDataScope = useAthenaDataScope;
105
+ exports.useInvalidateAthenaQueries = useInvalidateAthenaQueries;
106
+ //# sourceMappingURL=athena-data-client.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"athena-data-client.cjs","sources":["../../src/data/athena-data-client.tsx"],"sourcesContent":["/**\n * What every data hook shares: the SDK's own `QueryClient` (one per\n * `AthenaProvider`, so a host needs no `QueryClientProvider` and the hooks\n * never write into a host's cache), the identity every cache key starts with,\n * and the retry rule.\n *\n * Cache isolation: every key starts with the backend, the signed-in person,\n * the credential's fingerprint (the API key's, and who the held token acts as\n * and in which workspace, never the secret) and the provider's credential\n * scope epoch, which moves once a host's `getToken` hands out a token that\n * acts as someone else or is scoped to another workspace or org. A switch of\n * person, key or workspace therefore reads under new keys and never serves the\n * previous identity's answers.\n */\nimport {\n QueryClient,\n QueryClientContext,\n type QueryKey,\n} from '@tanstack/react-query';\nimport {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { credentialKeyParts } from '../auth/account-identity';\nimport { AthenaAuthContext } from '../auth/AthenaAuthContext';\nimport { useAthenaCredentialScopeEpoch } from '../auth/AthenaCredentialSourceContext';\nimport { useAthenaConfig } from '../provider/AthenaContext';\nimport { AthenaApiErrorKind, isAthenaApiError } from './athena-api-error';\nimport { selectedGraphQLOperation } from './athena-request';\n\nconst AthenaDataQueryClientContext = createContext<QueryClient | null>(null);\n\n/**\n * Gives the data hooks under it one `QueryClient` of their own for as long as\n * it is mounted (`AthenaProvider` mounts it). Mounted as `QueryClientProvider`\n * mounts a client, so reads refetch on reconnect and, when asked, on focus.\n */\nexport function AthenaDataQueryClientProvider({ children }: { children: ReactNode }) {\n const [client] = useState(() => new QueryClient());\n useEffect(() => {\n client.mount();\n return () => client.unmount();\n }, [client]);\n return (\n <AthenaDataQueryClientContext.Provider value={client}>{children}</AthenaDataQueryClientContext.Provider>\n );\n}\n\n/**\n * The data hooks' client: the provider's own, else (a provider-less tree, as in\n * a host's tests) a `QueryClient` in context, else one of the calling hook's.\n */\nexport function useAthenaDataQueryClient(): QueryClient {\n const own = useContext(AthenaDataQueryClientContext);\n const inContext = useContext(QueryClientContext);\n const fallback = useRef<QueryClient | null>(null);\n if (own) return own;\n if (inContext) return inContext;\n fallback.current ??= new QueryClient();\n return fallback.current;\n}\n\n/**\n * The first parts of every data key: whose reads they are. After the two tags:\n * the backend, the signed-in person (`''` when the provider knows none), the\n * API key's fingerprint, who the held token acts as and where, and the scope\n * epoch.\n */\nexport type AthenaDataScope = readonly ['athena-sdk', 'data', string, string, string, string, number];\n\n/** What a data key holds after its scope. */\nexport const AthenaDataKind = {\n GraphQL: 'graphql',\n Rest: 'rest',\n SemanticQuery: 'semantic-query',\n} as const;\nexport type AthenaDataKind = (typeof AthenaDataKind)[keyof typeof AthenaDataKind];\n\n/** The scope the provider's reads are cached under now (see the module comment). */\nexport function useAthenaDataScope(): AthenaDataScope {\n const { backendUrl, apiKey, token } = useAthenaConfig();\n const principal = useContext(AthenaAuthContext)?.user?.userId ?? '';\n const scopeEpoch = useAthenaCredentialScopeEpoch();\n const [apiKeyPart, heldTokenPart] = credentialKeyParts({ apiKey, heldToken: token });\n return useMemo(\n () => ['athena-sdk', 'data', backendUrl, principal, apiKeyPart, heldTokenPart, scopeEpoch] as const,\n [backendUrl, principal, apiKeyPart, heldTokenPart, scopeEpoch],\n );\n}\n\n/** How long an answer serves another read of the same thing before agora is asked again. */\nexport const ATHENA_DATA_STALE_MS = 30_000;\n\nconst MAX_TRANSIENT_RETRIES = 2;\nconst MAX_RETRY_DELAY_MS = 30_000;\nconst MAX_HINTED_RETRY_DELAY_MS = 60_000;\n\n/**\n * Whether a failed read is asked again: only what may answer differently a\n * moment later (no answer at all, or a 5xx), twice at most. A 4xx (a 429 the\n * transport already waited out included), a GraphQL error, a timeout, a\n * credential that could not be resolved and an unreadable answer are not.\n */\nexport function retryAthenaRead(failureCount: number, error: unknown): boolean {\n if (!isAthenaApiError(error) || failureCount >= MAX_TRANSIENT_RETRIES) return false;\n if (error.kind === AthenaApiErrorKind.Network) return true;\n return error.kind === AthenaApiErrorKind.Http && error.status >= 500;\n}\n\n/** The wait before asking again: what agora asked for (`Retry-After`), else 1 s, 2 s, 4 s… */\nexport function athenaRetryDelay(failureCount: number, error: unknown): number {\n if (isAthenaApiError(error) && error.retryAfterMs !== null) {\n return Math.min(error.retryAfterMs, MAX_HINTED_RETRY_DELAY_MS);\n }\n return Math.min(1_000 * 2 ** failureCount, MAX_RETRY_DELAY_MS);\n}\n\n/** `enabled` as a host passed it, and also `ready`. */\nexport function enabledAnd<TQuery>(\n enabled: boolean | ((query: TQuery) => boolean) | undefined,\n ready: boolean,\n): boolean | ((query: TQuery) => boolean) {\n if (typeof enabled === 'function') return (query: TQuery) => ready && enabled(query);\n return ready && (enabled ?? true);\n}\n\n/** Which of the current identity's reads to read again; every field is optional, and none means all. */\nexport interface AthenaDataQueryFilter {\n /** GraphQL reads whose operation has one of these names. */\n operationNames?: readonly string[];\n /** REST reads whose path starts with one of these. */\n paths?: readonly string[];\n /** Semantic queries of these models. */\n semanticModelIds?: readonly string[];\n}\n\nfunction inScope(queryKey: QueryKey, scope: AthenaDataScope): boolean {\n return scope.every((part, at) => Object.is(queryKey[at], part));\n}\n\nfunction matchesFilter(\n queryKey: QueryKey,\n scope: AthenaDataScope,\n filter: AthenaDataQueryFilter | undefined,\n): boolean {\n if (!filter) return true;\n const kind = queryKey[scope.length];\n const subject = queryKey[scope.length + 1];\n if (typeof subject !== 'string') return false;\n if (kind === AthenaDataKind.GraphQL) {\n // The operation the read runs: the one its `operationName` names, else its document's only one.\n const operationName = queryKey[scope.length + 3];\n const name = selectedGraphQLOperation(subject, typeof operationName === 'string' ? operationName : null)?.name;\n return typeof name === 'string' && (filter.operationNames ?? []).includes(name);\n }\n if (kind === AthenaDataKind.Rest) {\n return (filter.paths ?? []).some((prefix) => subject.startsWith(prefix));\n }\n if (kind === AthenaDataKind.SemanticQuery) {\n return (filter.semanticModelIds ?? []).includes(subject);\n }\n return false;\n}\n\n/**\n * Answers a function that has the current identity's data reads read again:\n * those `filter` names, or every one without it. Reads on screen are sent at\n * once; the rest read again when next shown. Call it after a write that\n * changes what they answer.\n */\nexport function useInvalidateAthenaQueries(): (filter?: AthenaDataQueryFilter) => Promise<void> {\n const client = useAthenaDataQueryClient();\n const scope = useAthenaDataScope();\n return useCallback(\n (filter?: AthenaDataQueryFilter) =>\n client.invalidateQueries({\n predicate: ({ queryKey }) => inScope(queryKey, scope) && matchesFilter(queryKey, scope, filter),\n }),\n [client, scope],\n );\n}\n"],"names":["createContext","useState","QueryClient","useEffect","useContext","QueryClientContext","useRef","useAthenaConfig","AthenaAuthContext","useAthenaCredentialScopeEpoch","credentialKeyParts","useMemo","isAthenaApiError","AthenaApiErrorKind","selectedGraphQLOperation","useCallback"],"mappings":"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"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * What every data hook shares: the SDK's own `QueryClient` (one per
3
+ * `AthenaProvider`, so a host needs no `QueryClientProvider` and the hooks
4
+ * never write into a host's cache), the identity every cache key starts with,
5
+ * and the retry rule.
6
+ *
7
+ * Cache isolation: every key starts with the backend, the signed-in person,
8
+ * the credential's fingerprint (the API key's, and who the held token acts as
9
+ * and in which workspace, never the secret) and the provider's credential
10
+ * scope epoch, which moves once a host's `getToken` hands out a token that
11
+ * acts as someone else or is scoped to another workspace or org. A switch of
12
+ * person, key or workspace therefore reads under new keys and never serves the
13
+ * previous identity's answers.
14
+ */
15
+ import { QueryClient } from '@tanstack/react-query';
16
+ import { type ReactNode } from 'react';
17
+ /**
18
+ * Gives the data hooks under it one `QueryClient` of their own for as long as
19
+ * it is mounted (`AthenaProvider` mounts it). Mounted as `QueryClientProvider`
20
+ * mounts a client, so reads refetch on reconnect and, when asked, on focus.
21
+ */
22
+ export declare function AthenaDataQueryClientProvider({ children }: {
23
+ children: ReactNode;
24
+ }): import("react").JSX.Element;
25
+ /**
26
+ * The data hooks' client: the provider's own, else (a provider-less tree, as in
27
+ * a host's tests) a `QueryClient` in context, else one of the calling hook's.
28
+ */
29
+ export declare function useAthenaDataQueryClient(): QueryClient;
30
+ /**
31
+ * The first parts of every data key: whose reads they are. After the two tags:
32
+ * the backend, the signed-in person (`''` when the provider knows none), the
33
+ * API key's fingerprint, who the held token acts as and where, and the scope
34
+ * epoch.
35
+ */
36
+ export type AthenaDataScope = readonly ['athena-sdk', 'data', string, string, string, string, number];
37
+ /** What a data key holds after its scope. */
38
+ export declare const AthenaDataKind: {
39
+ readonly GraphQL: 'graphql';
40
+ readonly Rest: 'rest';
41
+ readonly SemanticQuery: 'semantic-query';
42
+ };
43
+ export type AthenaDataKind = (typeof AthenaDataKind)[keyof typeof AthenaDataKind];
44
+ /** The scope the provider's reads are cached under now (see the module comment). */
45
+ export declare function useAthenaDataScope(): AthenaDataScope;
46
+ /** How long an answer serves another read of the same thing before agora is asked again. */
47
+ export declare const ATHENA_DATA_STALE_MS = 30000;
48
+ /**
49
+ * Whether a failed read is asked again: only what may answer differently a
50
+ * moment later (no answer at all, or a 5xx), twice at most. A 4xx (a 429 the
51
+ * transport already waited out included), a GraphQL error, a timeout, a
52
+ * credential that could not be resolved and an unreadable answer are not.
53
+ */
54
+ export declare function retryAthenaRead(failureCount: number, error: unknown): boolean;
55
+ /** The wait before asking again: what agora asked for (`Retry-After`), else 1 s, 2 s, 4 s… */
56
+ export declare function athenaRetryDelay(failureCount: number, error: unknown): number;
57
+ /** `enabled` as a host passed it, and also `ready`. */
58
+ export declare function enabledAnd<TQuery>(enabled: boolean | ((query: TQuery) => boolean) | undefined, ready: boolean): boolean | ((query: TQuery) => boolean);
59
+ /** Which of the current identity's reads to read again; every field is optional, and none means all. */
60
+ export interface AthenaDataQueryFilter {
61
+ /** GraphQL reads whose operation has one of these names. */
62
+ operationNames?: readonly string[];
63
+ /** REST reads whose path starts with one of these. */
64
+ paths?: readonly string[];
65
+ /** Semantic queries of these models. */
66
+ semanticModelIds?: readonly string[];
67
+ }
68
+ /**
69
+ * Answers a function that has the current identity's data reads read again:
70
+ * those `filter` names, or every one without it. Reads on screen are sent at
71
+ * once; the rest read again when next shown. Call it after a write that
72
+ * changes what they answer.
73
+ */
74
+ export declare function useInvalidateAthenaQueries(): (filter?: AthenaDataQueryFilter) => Promise<void>;
@@ -0,0 +1,106 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { QueryClient, QueryClientContext } from "@tanstack/react-query";
3
+ import { useCallback, useState, useEffect, useContext, useMemo, useRef, createContext } from "react";
4
+ import { credentialKeyParts } from "../auth/account-identity.js";
5
+ import { AthenaAuthContext } from "../auth/AthenaAuthContext.js";
6
+ import { useAthenaCredentialScopeEpoch } from "../auth/AthenaCredentialSourceContext.js";
7
+ import { useAthenaConfig } from "../provider/AthenaContext.js";
8
+ import { isAthenaApiError, AthenaApiErrorKind } from "./athena-api-error.js";
9
+ import { selectedGraphQLOperation } from "./athena-request.js";
10
+ const AthenaDataQueryClientContext = createContext(null);
11
+ function AthenaDataQueryClientProvider({ children }) {
12
+ const [client] = useState(() => new QueryClient());
13
+ useEffect(() => {
14
+ client.mount();
15
+ return () => client.unmount();
16
+ }, [client]);
17
+ return /* @__PURE__ */ jsx(AthenaDataQueryClientContext.Provider, { value: client, children });
18
+ }
19
+ function useAthenaDataQueryClient() {
20
+ const own = useContext(AthenaDataQueryClientContext);
21
+ const inContext = useContext(QueryClientContext);
22
+ const fallback = useRef(null);
23
+ if (own) return own;
24
+ if (inContext) return inContext;
25
+ fallback.current ?? (fallback.current = new QueryClient());
26
+ return fallback.current;
27
+ }
28
+ const AthenaDataKind = {
29
+ GraphQL: "graphql",
30
+ Rest: "rest",
31
+ SemanticQuery: "semantic-query"
32
+ };
33
+ function useAthenaDataScope() {
34
+ var _a, _b;
35
+ const { backendUrl, apiKey, token } = useAthenaConfig();
36
+ const principal = ((_b = (_a = useContext(AthenaAuthContext)) == null ? void 0 : _a.user) == null ? void 0 : _b.userId) ?? "";
37
+ const scopeEpoch = useAthenaCredentialScopeEpoch();
38
+ const [apiKeyPart, heldTokenPart] = credentialKeyParts({ apiKey, heldToken: token });
39
+ return useMemo(
40
+ () => ["athena-sdk", "data", backendUrl, principal, apiKeyPart, heldTokenPart, scopeEpoch],
41
+ [backendUrl, principal, apiKeyPart, heldTokenPart, scopeEpoch]
42
+ );
43
+ }
44
+ const ATHENA_DATA_STALE_MS = 3e4;
45
+ const MAX_TRANSIENT_RETRIES = 2;
46
+ const MAX_RETRY_DELAY_MS = 3e4;
47
+ const MAX_HINTED_RETRY_DELAY_MS = 6e4;
48
+ function retryAthenaRead(failureCount, error) {
49
+ if (!isAthenaApiError(error) || failureCount >= MAX_TRANSIENT_RETRIES) return false;
50
+ if (error.kind === AthenaApiErrorKind.Network) return true;
51
+ return error.kind === AthenaApiErrorKind.Http && error.status >= 500;
52
+ }
53
+ function athenaRetryDelay(failureCount, error) {
54
+ if (isAthenaApiError(error) && error.retryAfterMs !== null) {
55
+ return Math.min(error.retryAfterMs, MAX_HINTED_RETRY_DELAY_MS);
56
+ }
57
+ return Math.min(1e3 * 2 ** failureCount, MAX_RETRY_DELAY_MS);
58
+ }
59
+ function enabledAnd(enabled, ready) {
60
+ if (typeof enabled === "function") return (query) => ready && enabled(query);
61
+ return ready && (enabled ?? true);
62
+ }
63
+ function inScope(queryKey, scope) {
64
+ return scope.every((part, at) => Object.is(queryKey[at], part));
65
+ }
66
+ function matchesFilter(queryKey, scope, filter) {
67
+ var _a;
68
+ if (!filter) return true;
69
+ const kind = queryKey[scope.length];
70
+ const subject = queryKey[scope.length + 1];
71
+ if (typeof subject !== "string") return false;
72
+ if (kind === AthenaDataKind.GraphQL) {
73
+ const operationName = queryKey[scope.length + 3];
74
+ const name = (_a = selectedGraphQLOperation(subject, typeof operationName === "string" ? operationName : null)) == null ? void 0 : _a.name;
75
+ return typeof name === "string" && (filter.operationNames ?? []).includes(name);
76
+ }
77
+ if (kind === AthenaDataKind.Rest) {
78
+ return (filter.paths ?? []).some((prefix) => subject.startsWith(prefix));
79
+ }
80
+ if (kind === AthenaDataKind.SemanticQuery) {
81
+ return (filter.semanticModelIds ?? []).includes(subject);
82
+ }
83
+ return false;
84
+ }
85
+ function useInvalidateAthenaQueries() {
86
+ const client = useAthenaDataQueryClient();
87
+ const scope = useAthenaDataScope();
88
+ return useCallback(
89
+ (filter) => client.invalidateQueries({
90
+ predicate: ({ queryKey }) => inScope(queryKey, scope) && matchesFilter(queryKey, scope, filter)
91
+ }),
92
+ [client, scope]
93
+ );
94
+ }
95
+ export {
96
+ ATHENA_DATA_STALE_MS,
97
+ AthenaDataKind,
98
+ AthenaDataQueryClientProvider,
99
+ athenaRetryDelay,
100
+ enabledAnd,
101
+ retryAthenaRead,
102
+ useAthenaDataQueryClient,
103
+ useAthenaDataScope,
104
+ useInvalidateAthenaQueries
105
+ };
106
+ //# sourceMappingURL=athena-data-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"athena-data-client.js","sources":["../../src/data/athena-data-client.tsx"],"sourcesContent":["/**\n * What every data hook shares: the SDK's own `QueryClient` (one per\n * `AthenaProvider`, so a host needs no `QueryClientProvider` and the hooks\n * never write into a host's cache), the identity every cache key starts with,\n * and the retry rule.\n *\n * Cache isolation: every key starts with the backend, the signed-in person,\n * the credential's fingerprint (the API key's, and who the held token acts as\n * and in which workspace, never the secret) and the provider's credential\n * scope epoch, which moves once a host's `getToken` hands out a token that\n * acts as someone else or is scoped to another workspace or org. A switch of\n * person, key or workspace therefore reads under new keys and never serves the\n * previous identity's answers.\n */\nimport {\n QueryClient,\n QueryClientContext,\n type QueryKey,\n} from '@tanstack/react-query';\nimport {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { credentialKeyParts } from '../auth/account-identity';\nimport { AthenaAuthContext } from '../auth/AthenaAuthContext';\nimport { useAthenaCredentialScopeEpoch } from '../auth/AthenaCredentialSourceContext';\nimport { useAthenaConfig } from '../provider/AthenaContext';\nimport { AthenaApiErrorKind, isAthenaApiError } from './athena-api-error';\nimport { selectedGraphQLOperation } from './athena-request';\n\nconst AthenaDataQueryClientContext = createContext<QueryClient | null>(null);\n\n/**\n * Gives the data hooks under it one `QueryClient` of their own for as long as\n * it is mounted (`AthenaProvider` mounts it). Mounted as `QueryClientProvider`\n * mounts a client, so reads refetch on reconnect and, when asked, on focus.\n */\nexport function AthenaDataQueryClientProvider({ children }: { children: ReactNode }) {\n const [client] = useState(() => new QueryClient());\n useEffect(() => {\n client.mount();\n return () => client.unmount();\n }, [client]);\n return (\n <AthenaDataQueryClientContext.Provider value={client}>{children}</AthenaDataQueryClientContext.Provider>\n );\n}\n\n/**\n * The data hooks' client: the provider's own, else (a provider-less tree, as in\n * a host's tests) a `QueryClient` in context, else one of the calling hook's.\n */\nexport function useAthenaDataQueryClient(): QueryClient {\n const own = useContext(AthenaDataQueryClientContext);\n const inContext = useContext(QueryClientContext);\n const fallback = useRef<QueryClient | null>(null);\n if (own) return own;\n if (inContext) return inContext;\n fallback.current ??= new QueryClient();\n return fallback.current;\n}\n\n/**\n * The first parts of every data key: whose reads they are. After the two tags:\n * the backend, the signed-in person (`''` when the provider knows none), the\n * API key's fingerprint, who the held token acts as and where, and the scope\n * epoch.\n */\nexport type AthenaDataScope = readonly ['athena-sdk', 'data', string, string, string, string, number];\n\n/** What a data key holds after its scope. */\nexport const AthenaDataKind = {\n GraphQL: 'graphql',\n Rest: 'rest',\n SemanticQuery: 'semantic-query',\n} as const;\nexport type AthenaDataKind = (typeof AthenaDataKind)[keyof typeof AthenaDataKind];\n\n/** The scope the provider's reads are cached under now (see the module comment). */\nexport function useAthenaDataScope(): AthenaDataScope {\n const { backendUrl, apiKey, token } = useAthenaConfig();\n const principal = useContext(AthenaAuthContext)?.user?.userId ?? '';\n const scopeEpoch = useAthenaCredentialScopeEpoch();\n const [apiKeyPart, heldTokenPart] = credentialKeyParts({ apiKey, heldToken: token });\n return useMemo(\n () => ['athena-sdk', 'data', backendUrl, principal, apiKeyPart, heldTokenPart, scopeEpoch] as const,\n [backendUrl, principal, apiKeyPart, heldTokenPart, scopeEpoch],\n );\n}\n\n/** How long an answer serves another read of the same thing before agora is asked again. */\nexport const ATHENA_DATA_STALE_MS = 30_000;\n\nconst MAX_TRANSIENT_RETRIES = 2;\nconst MAX_RETRY_DELAY_MS = 30_000;\nconst MAX_HINTED_RETRY_DELAY_MS = 60_000;\n\n/**\n * Whether a failed read is asked again: only what may answer differently a\n * moment later (no answer at all, or a 5xx), twice at most. A 4xx (a 429 the\n * transport already waited out included), a GraphQL error, a timeout, a\n * credential that could not be resolved and an unreadable answer are not.\n */\nexport function retryAthenaRead(failureCount: number, error: unknown): boolean {\n if (!isAthenaApiError(error) || failureCount >= MAX_TRANSIENT_RETRIES) return false;\n if (error.kind === AthenaApiErrorKind.Network) return true;\n return error.kind === AthenaApiErrorKind.Http && error.status >= 500;\n}\n\n/** The wait before asking again: what agora asked for (`Retry-After`), else 1 s, 2 s, 4 s… */\nexport function athenaRetryDelay(failureCount: number, error: unknown): number {\n if (isAthenaApiError(error) && error.retryAfterMs !== null) {\n return Math.min(error.retryAfterMs, MAX_HINTED_RETRY_DELAY_MS);\n }\n return Math.min(1_000 * 2 ** failureCount, MAX_RETRY_DELAY_MS);\n}\n\n/** `enabled` as a host passed it, and also `ready`. */\nexport function enabledAnd<TQuery>(\n enabled: boolean | ((query: TQuery) => boolean) | undefined,\n ready: boolean,\n): boolean | ((query: TQuery) => boolean) {\n if (typeof enabled === 'function') return (query: TQuery) => ready && enabled(query);\n return ready && (enabled ?? true);\n}\n\n/** Which of the current identity's reads to read again; every field is optional, and none means all. */\nexport interface AthenaDataQueryFilter {\n /** GraphQL reads whose operation has one of these names. */\n operationNames?: readonly string[];\n /** REST reads whose path starts with one of these. */\n paths?: readonly string[];\n /** Semantic queries of these models. */\n semanticModelIds?: readonly string[];\n}\n\nfunction inScope(queryKey: QueryKey, scope: AthenaDataScope): boolean {\n return scope.every((part, at) => Object.is(queryKey[at], part));\n}\n\nfunction matchesFilter(\n queryKey: QueryKey,\n scope: AthenaDataScope,\n filter: AthenaDataQueryFilter | undefined,\n): boolean {\n if (!filter) return true;\n const kind = queryKey[scope.length];\n const subject = queryKey[scope.length + 1];\n if (typeof subject !== 'string') return false;\n if (kind === AthenaDataKind.GraphQL) {\n // The operation the read runs: the one its `operationName` names, else its document's only one.\n const operationName = queryKey[scope.length + 3];\n const name = selectedGraphQLOperation(subject, typeof operationName === 'string' ? operationName : null)?.name;\n return typeof name === 'string' && (filter.operationNames ?? []).includes(name);\n }\n if (kind === AthenaDataKind.Rest) {\n return (filter.paths ?? []).some((prefix) => subject.startsWith(prefix));\n }\n if (kind === AthenaDataKind.SemanticQuery) {\n return (filter.semanticModelIds ?? []).includes(subject);\n }\n return false;\n}\n\n/**\n * Answers a function that has the current identity's data reads read again:\n * those `filter` names, or every one without it. Reads on screen are sent at\n * once; the rest read again when next shown. Call it after a write that\n * changes what they answer.\n */\nexport function useInvalidateAthenaQueries(): (filter?: AthenaDataQueryFilter) => Promise<void> {\n const client = useAthenaDataQueryClient();\n const scope = useAthenaDataScope();\n return useCallback(\n (filter?: AthenaDataQueryFilter) =>\n client.invalidateQueries({\n predicate: ({ queryKey }) => inScope(queryKey, scope) && matchesFilter(queryKey, scope, filter),\n }),\n [client, scope],\n );\n}\n"],"names":[],"mappings":"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"}
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
6
+ const athenaApiError = require("./athena-api-error.cjs");
7
+ const athenaRequest = require("./athena-request.cjs");
8
+ const useAthenaRest = require("./use-athena-rest.cjs");
9
+ const ATHENA_BUNDLE_KEY_PATTERN = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;
10
+ const ATHENA_BUNDLE_KEY_MAX_LENGTH = 63;
11
+ const ATHENA_MEMBER_KEY_PATTERN = /^[a-z][a-z0-9_]{0,62}$/;
12
+ class AthenaMemberNotFoundError extends Error {
13
+ constructor(memberName, options) {
14
+ super(`No member named ${memberName} here, or you can't open it.`, options);
15
+ /** The name that didn't resolve (`support-desk/support_agent`). */
16
+ __publicField(this, "memberName");
17
+ this.name = "AthenaMemberNotFoundError";
18
+ this.memberName = memberName;
19
+ }
20
+ }
21
+ function parseAthenaMemberName(value) {
22
+ if (typeof value !== "string") return null;
23
+ const slash = value.indexOf("/");
24
+ if (slash < 0) return null;
25
+ const bundleKey = value.slice(0, slash);
26
+ const memberKey = value.slice(slash + 1);
27
+ if (bundleKey.length > ATHENA_BUNDLE_KEY_MAX_LENGTH || !ATHENA_BUNDLE_KEY_PATTERN.test(bundleKey) || !ATHENA_MEMBER_KEY_PATTERN.test(memberKey)) {
28
+ return null;
29
+ }
30
+ return { bundleKey, memberKey };
31
+ }
32
+ function isAthenaMemberName(value) {
33
+ return parseAthenaMemberName(value) !== null;
34
+ }
35
+ function athenaMemberPath({ bundleKey, memberKey }) {
36
+ return `/api/v0/bundles/${encodeURIComponent(bundleKey)}/members/${encodeURIComponent(memberKey)}`;
37
+ }
38
+ function memberParams({
39
+ track,
40
+ workspaceId
41
+ }) {
42
+ const params = {};
43
+ if (track) params.track = track;
44
+ if (workspaceId) params.workspace_id = workspaceId;
45
+ return Object.keys(params).length > 0 ? params : void 0;
46
+ }
47
+ async function resolveAthenaMember({
48
+ name,
49
+ track,
50
+ workspaceId,
51
+ signal,
52
+ ...config
53
+ }) {
54
+ const parsed = parseAthenaMemberName(name);
55
+ const path = parsed ? athenaMemberPath(parsed) : "/api/v0/bundles";
56
+ if (parsed === null) {
57
+ throw new athenaApiError.AthenaApiError({
58
+ kind: athenaApiError.AthenaApiErrorKind.Request,
59
+ message: `${JSON.stringify(name)} isn't a member name: write <bundle key>/<member key>, e.g. support-desk/support_agent.`,
60
+ method: "GET",
61
+ path
62
+ });
63
+ }
64
+ try {
65
+ return await athenaRequest.athenaFetchJson(config, path, {
66
+ method: "GET",
67
+ params: memberParams({ track, workspaceId }),
68
+ signal
69
+ });
70
+ } catch (error) {
71
+ if (athenaApiError.isAthenaApiError(error) && error.status === 404) {
72
+ throw new AthenaMemberNotFoundError(name, { cause: error });
73
+ }
74
+ throw error;
75
+ }
76
+ }
77
+ function useAthenaMember(name, { track, workspaceId, ...options } = {}) {
78
+ const parsed = name === null ? null : parseAthenaMemberName(name);
79
+ return useAthenaRest.useAthenaRest(parsed ? athenaMemberPath(parsed) : null, {
80
+ ...options,
81
+ params: memberParams({ track, workspaceId })
82
+ });
83
+ }
84
+ exports.ATHENA_BUNDLE_KEY_MAX_LENGTH = ATHENA_BUNDLE_KEY_MAX_LENGTH;
85
+ exports.ATHENA_BUNDLE_KEY_PATTERN = ATHENA_BUNDLE_KEY_PATTERN;
86
+ exports.ATHENA_MEMBER_KEY_PATTERN = ATHENA_MEMBER_KEY_PATTERN;
87
+ exports.AthenaMemberNotFoundError = AthenaMemberNotFoundError;
88
+ exports.athenaMemberPath = athenaMemberPath;
89
+ exports.isAthenaMemberName = isAthenaMemberName;
90
+ exports.parseAthenaMemberName = parseAthenaMemberName;
91
+ exports.resolveAthenaMember = resolveAthenaMember;
92
+ exports.useAthenaMember = useAthenaMember;
93
+ //# sourceMappingURL=athena-member.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"athena-member.cjs","sources":["../../src/data/athena-member.ts"],"sourcesContent":["/**\n * Bundle member names: `support-desk/support_agent` resolved to this place's\n * own asset (Bundle Phase 2; docs/plans/2026-11-09-bundle-phase-2-plan.md §6.3).\n *\n * A bundle names each member by a permanent key, and each workspace or\n * deployment that holds the bundle (the source and every copy) has its own\n * asset behind that key. Code that names `<bundle key>/<member key>` keeps\n * working in every place, where a raw `asset_…` id names one place's asset only.\n * Agora resolves a name through one route,\n * `GET /api/v0/bundles/{bundle_key}/members/{member_key}`, in the caller's\n * workspace: it answers only a member the caller may open, and every refusal is\n * the same 404 a name that doesn't exist gets.\n *\n * - {@link resolveAthenaMember}: one read, outside React (a script holding an\n * API key, a server).\n * - {@link useAthenaMember}: the same read as a cached query, as the provider's\n * signed-in person.\n */\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { AthenaApiError, AthenaApiErrorKind, isAthenaApiError } from './athena-api-error';\nimport { type AthenaRequestConfig, athenaFetchJson } from './athena-request';\nimport { type UseAthenaRestOptions, useAthenaRest } from './use-athena-rest';\n\n/** A bundle key: lowercase words joined by single hyphens, at most 63 characters (`support-desk`). */\nexport const ATHENA_BUNDLE_KEY_PATTERN = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;\n/** The longest bundle key. */\nexport const ATHENA_BUNDLE_KEY_MAX_LENGTH = 63;\n/** A member key: a lowercase letter, then letters, digits and underscores, 63 at most (`support_agent`). */\nexport const ATHENA_MEMBER_KEY_PATTERN = /^[a-z][a-z0-9_]{0,62}$/;\n\n/** A parsed `<bundle key>/<member key>`. */\nexport interface AthenaMemberName {\n bundleKey: string;\n memberKey: string;\n}\n\n/** The revision a track serves of a member: its version id and content digest. */\nexport interface AthenaMemberRevision {\n version_id: string;\n /** `sha256:…`, the same in every place holding this revision; `null` for a version cut before digests. */\n digest: string | null;\n digest_alg: string | null;\n}\n\n/** A member name resolved in the caller's place, as agora answers it. */\nexport interface AthenaMember {\n bundle_key: string;\n member_key: string;\n /** This place's asset for the member. */\n asset_id: string;\n /** The member asset's type (`collab_agent`, `user_interface`…). */\n type: string;\n /** How the member joins the bundle: `ships`, `pin`, `pin+notify` or `follow`. */\n link: string;\n /** The track the answer read; `null` when none was asked for. */\n track: string | null;\n /** With a track, the revision it serves of the member (`null` when followed); `null` without a track. */\n revision: AthenaMemberRevision | null;\n}\n\n/**\n * A member name that doesn't resolve for the caller: no such bundle or member in\n * the caller's workspace, or one the caller can't open. Agora answers the two\n * alike, so this error doesn't tell them apart either.\n */\nexport class AthenaMemberNotFoundError extends Error {\n /** The name that didn't resolve (`support-desk/support_agent`). */\n readonly memberName: string;\n\n constructor(memberName: string, options?: { cause?: unknown }) {\n super(`No member named ${memberName} here, or you can't open it.`, options);\n this.name = 'AthenaMemberNotFoundError';\n this.memberName = memberName;\n }\n}\n\n/** `value` as `<bundle key>/<member key>`, or `null`. An `asset_…` id never parses: it holds no `/`. */\nexport function parseAthenaMemberName(value: unknown): AthenaMemberName | null {\n if (typeof value !== 'string') return null;\n const slash = value.indexOf('/');\n if (slash < 0) return null;\n const bundleKey = value.slice(0, slash);\n const memberKey = value.slice(slash + 1);\n if (\n bundleKey.length > ATHENA_BUNDLE_KEY_MAX_LENGTH ||\n !ATHENA_BUNDLE_KEY_PATTERN.test(bundleKey) ||\n !ATHENA_MEMBER_KEY_PATTERN.test(memberKey)\n ) {\n return null;\n }\n return { bundleKey, memberKey };\n}\n\n/** Whether `value` is a member name (`<bundle key>/<member key>`). */\nexport function isAthenaMemberName(value: unknown): value is string {\n return parseAthenaMemberName(value) !== null;\n}\n\n/** The members route's path for a parsed name. */\nexport function athenaMemberPath({ bundleKey, memberKey }: AthenaMemberName): string {\n return `/api/v0/bundles/${encodeURIComponent(bundleKey)}/members/${encodeURIComponent(memberKey)}`;\n}\n\nexport interface ResolveAthenaMemberOptions extends AthenaRequestConfig {\n /** `<bundle key>/<member key>`, e.g. `support-desk/support_agent`. */\n name: string;\n /** A track's key (`production`, `pilot`…): also answer the revision it serves. The caller must be on the track. */\n track?: string;\n /**\n * The workspace to resolve in. Optional for a person in one workspace and for a credential bound to\n * one; a person in several names it (else agora answers `400 workspace_required`).\n */\n workspaceId?: string;\n /** Cancels the read; it then rejects with the abort's reason. */\n signal?: AbortSignal;\n}\n\nfunction memberParams({\n track,\n workspaceId,\n}: {\n track?: string;\n workspaceId?: string;\n}): Record<string, string> | undefined {\n const params: Record<string, string> = {};\n if (track) params.track = track;\n if (workspaceId) params.workspace_id = workspaceId;\n return Object.keys(params).length > 0 ? params : undefined;\n}\n\n/**\n * Resolve a member name to this place's asset, as the credential's person, in\n * the workspace `workspaceId` names (or their only one). Sent as every SDK request is (the token from `getToken` or\n * `token`, else `apiKey`; under `backendUrl` only).\n *\n * Throws {@link AthenaMemberNotFoundError} when the name doesn't resolve for\n * the caller, an `AthenaApiError` of kind `request` for a string that isn't a\n * member name (nothing is sent), and an `AthenaApiError` for any other failure.\n *\n * ```ts\n * const agent = await resolveAthenaMember({\n * backendUrl: 'https://api.athenaintel.com',\n * apiKey: process.env.ATHENA_API_KEY,\n * name: 'support-desk/support_agent',\n * });\n * agent.asset_id; // this workspace's own agent\n * ```\n */\nexport async function resolveAthenaMember({\n name,\n track,\n workspaceId,\n signal,\n ...config\n}: ResolveAthenaMemberOptions): Promise<AthenaMember> {\n const parsed = parseAthenaMemberName(name);\n const path = parsed ? athenaMemberPath(parsed) : '/api/v0/bundles';\n if (parsed === null) {\n throw new AthenaApiError({\n kind: AthenaApiErrorKind.Request,\n message: `${JSON.stringify(name)} isn't a member name: write <bundle key>/<member key>, e.g. support-desk/support_agent.`,\n method: 'GET',\n path,\n });\n }\n try {\n return await athenaFetchJson<AthenaMember>(config, path, {\n method: 'GET',\n params: memberParams({ track, workspaceId }),\n signal,\n });\n } catch (error) {\n if (isAthenaApiError(error) && error.status === 404) {\n throw new AthenaMemberNotFoundError(name, { cause: error });\n }\n throw error;\n }\n}\n\n/** `useAthenaMember`'s options: a track, and TanStack Query's (`enabled`, `select`…). */\nexport type UseAthenaMemberOptions = Omit<UseAthenaRestOptions<AthenaMember>, 'params'> & {\n /** A track's key: also answer the revision it serves (part of the cache key). */\n track?: string;\n /** The workspace to resolve in, for a person in several (part of the cache key). */\n workspaceId?: string;\n};\n\n/**\n * The asset a member name resolves to, as the provider's signed-in person: a\n * cached query on the SDK's QueryClient (`useAthenaRest` on the members route).\n * `null`, or a string that isn't a member name, holds the read idle (check with\n * {@link isAthenaMemberName}). A name that doesn't resolve for the person fails\n * with an `AthenaApiError` whose `status` is 404 and `code` `member_not_found`.\n *\n * ```tsx\n * const agent = useAthenaMember('support-desk/support_agent');\n * if (agent.data) startChat({ agentId: agent.data.asset_id });\n * ```\n */\nexport function useAthenaMember(\n name: string | null,\n { track, workspaceId, ...options }: UseAthenaMemberOptions = {},\n): UseQueryResult<AthenaMember, AthenaApiError> {\n const parsed = name === null ? null : parseAthenaMemberName(name);\n return useAthenaRest<AthenaMember>(parsed ? athenaMemberPath(parsed) : null, {\n ...options,\n params: memberParams({ track, workspaceId }),\n });\n}\n"],"names":["AthenaApiError","AthenaApiErrorKind","athenaFetchJson","isAthenaApiError","useAthenaRest"],"mappings":";;;;;;;;AAwBO,MAAM,4BAA4B;AAElC,MAAM,+BAA+B;AAErC,MAAM,4BAA4B;AAqClC,MAAM,kCAAkC,MAAM;AAAA,EAInD,YAAY,YAAoB,SAA+B;AAC7D,UAAM,mBAAmB,UAAU,gCAAgC,OAAO;AAHnE;AAAA;AAIP,SAAK,OAAO;AACZ,SAAK,aAAa;AAAA,EACpB;AACF;AAGO,SAAS,sBAAsB,OAAyC;AAC7E,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,QAAM,QAAQ,MAAM,QAAQ,GAAG;AAC/B,MAAI,QAAQ,EAAG,QAAO;AACtB,QAAM,YAAY,MAAM,MAAM,GAAG,KAAK;AACtC,QAAM,YAAY,MAAM,MAAM,QAAQ,CAAC;AACvC,MACE,UAAU,SAAS,gCACnB,CAAC,0BAA0B,KAAK,SAAS,KACzC,CAAC,0BAA0B,KAAK,SAAS,GACzC;AACA,WAAO;AAAA,EACT;AACA,SAAO,EAAE,WAAW,UAAA;AACtB;AAGO,SAAS,mBAAmB,OAAiC;AAClE,SAAO,sBAAsB,KAAK,MAAM;AAC1C;AAGO,SAAS,iBAAiB,EAAE,WAAW,aAAuC;AACnF,SAAO,mBAAmB,mBAAmB,SAAS,CAAC,YAAY,mBAAmB,SAAS,CAAC;AAClG;AAgBA,SAAS,aAAa;AAAA,EACpB;AAAA,EACA;AACF,GAGuC;AACrC,QAAM,SAAiC,CAAA;AACvC,MAAI,cAAc,QAAQ;AAC1B,MAAI,oBAAoB,eAAe;AACvC,SAAO,OAAO,KAAK,MAAM,EAAE,SAAS,IAAI,SAAS;AACnD;AAoBA,eAAsB,oBAAoB;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAsD;AACpD,QAAM,SAAS,sBAAsB,IAAI;AACzC,QAAM,OAAO,SAAS,iBAAiB,MAAM,IAAI;AACjD,MAAI,WAAW,MAAM;AACnB,UAAM,IAAIA,eAAAA,eAAe;AAAA,MACvB,MAAMC,eAAAA,mBAAmB;AAAA,MACzB,SAAS,GAAG,KAAK,UAAU,IAAI,CAAC;AAAA,MAChC,QAAQ;AAAA,MACR;AAAA,IAAA,CACD;AAAA,EACH;AACA,MAAI;AACF,WAAO,MAAMC,cAAAA,gBAA8B,QAAQ,MAAM;AAAA,MACvD,QAAQ;AAAA,MACR,QAAQ,aAAa,EAAE,OAAO,aAAa;AAAA,MAC3C;AAAA,IAAA,CACD;AAAA,EACH,SAAS,OAAO;AACd,QAAIC,eAAAA,iBAAiB,KAAK,KAAK,MAAM,WAAW,KAAK;AACnD,YAAM,IAAI,0BAA0B,MAAM,EAAE,OAAO,OAAO;AAAA,IAC5D;AACA,UAAM;AAAA,EACR;AACF;AAsBO,SAAS,gBACd,MACA,EAAE,OAAO,aAAa,GAAG,QAAA,IAAoC,IACf;AAC9C,QAAM,SAAS,SAAS,OAAO,OAAO,sBAAsB,IAAI;AAChE,SAAOC,cAAAA,cAA4B,SAAS,iBAAiB,MAAM,IAAI,MAAM;AAAA,IAC3E,GAAG;AAAA,IACH,QAAQ,aAAa,EAAE,OAAO,aAAa;AAAA,EAAA,CAC5C;AACH;;;;;;;;;;"}