@athenaintel/react 0.57.2 → 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 (799) hide show
  1. package/README.md +759 -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 +290 -97
  238. package/dist/chat/AthenaChat.cjs.map +1 -1
  239. package/dist/chat/AthenaChat.d.ts +80 -4
  240. package/dist/chat/AthenaChat.js +290 -97
  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 +56 -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 +57 -20
  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 +3 -1
  583. package/dist/runtime/statewire-run-config.cjs.map +1 -1
  584. package/dist/runtime/statewire-run-config.d.ts +7 -0
  585. package/dist/runtime/statewire-run-config.js +3 -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 +6 -6
  656. package/dist/threads/SessionList.cjs.map +1 -1
  657. package/dist/threads/SessionsPage.cjs +13 -7
  658. package/dist/threads/SessionsPage.cjs.map +1 -1
  659. package/dist/threads/SessionsPage.d.ts +10 -1
  660. package/dist/threads/SessionsPage.js +9 -3
  661. package/dist/threads/SessionsPage.js.map +1 -1
  662. package/dist/threads/session-list-model.cjs.map +1 -1
  663. package/dist/threads/session-list-model.d.ts +2 -1
  664. package/dist/threads/session-list-model.js.map +1 -1
  665. package/dist/threads/session-row-parts.cjs +3 -3
  666. package/dist/threads/session-row-parts.cjs.map +1 -1
  667. package/dist/threads/sessions-page-model.cjs +13 -5
  668. package/dist/threads/sessions-page-model.cjs.map +1 -1
  669. package/dist/threads/sessions-page-model.d.ts +7 -0
  670. package/dist/threads/sessions-page-model.js +11 -3
  671. package/dist/threads/sessions-page-model.js.map +1 -1
  672. package/dist/threads/sessions-page-storage.cjs +8 -8
  673. package/dist/threads/sessions-page-storage.cjs.map +1 -1
  674. package/dist/threads/sessions-page-storage.d.ts +5 -1
  675. package/dist/threads/sessions-page-storage.js +8 -8
  676. package/dist/threads/sessions-page-storage.js.map +1 -1
  677. package/dist/threads/use-athena-sessions.cjs +1 -0
  678. package/dist/threads/use-athena-sessions.cjs.map +1 -1
  679. package/dist/threads/use-athena-sessions.d.ts +7 -0
  680. package/dist/threads/use-athena-sessions.js +1 -0
  681. package/dist/threads/use-athena-sessions.js.map +1 -1
  682. package/dist/threads/use-athena-thread-agent.cjs +31 -0
  683. package/dist/threads/use-athena-thread-agent.cjs.map +1 -0
  684. package/dist/threads/use-athena-thread-agent.d.ts +38 -0
  685. package/dist/threads/use-athena-thread-agent.js +31 -0
  686. package/dist/threads/use-athena-thread-agent.js.map +1 -0
  687. package/dist/threads/use-athena-thread-plan-mode.cjs +18 -0
  688. package/dist/threads/use-athena-thread-plan-mode.cjs.map +1 -0
  689. package/dist/threads/use-athena-thread-plan-mode.d.ts +18 -0
  690. package/dist/threads/use-athena-thread-plan-mode.js +18 -0
  691. package/dist/threads/use-athena-thread-plan-mode.js.map +1 -0
  692. package/dist/threads/use-rest-conversation-history.d.ts +1 -0
  693. package/dist/tools/agent-creations.cjs +97 -0
  694. package/dist/tools/agent-creations.cjs.map +1 -0
  695. package/dist/tools/agent-creations.d.ts +38 -0
  696. package/dist/tools/agent-creations.js +97 -0
  697. package/dist/tools/agent-creations.js.map +1 -0
  698. package/dist/tools/agent-highlights.cjs +100 -0
  699. package/dist/tools/agent-highlights.cjs.map +1 -0
  700. package/dist/tools/agent-highlights.d.ts +57 -0
  701. package/dist/tools/agent-highlights.js +100 -0
  702. package/dist/tools/agent-highlights.js.map +1 -0
  703. package/dist/tools/append-document-tool-ui.cjs +1 -0
  704. package/dist/tools/append-document-tool-ui.cjs.map +1 -1
  705. package/dist/tools/append-document-tool-ui.d.ts +7 -0
  706. package/dist/tools/append-document-tool-ui.js +2 -1
  707. package/dist/tools/append-document-tool-ui.js.map +1 -1
  708. package/dist/tools/auto-open-tools.cjs +144 -71
  709. package/dist/tools/auto-open-tools.cjs.map +1 -1
  710. package/dist/tools/auto-open-tools.d.ts +131 -1
  711. package/dist/tools/auto-open-tools.js +145 -72
  712. package/dist/tools/auto-open-tools.js.map +1 -1
  713. package/dist/tools/browser-tool-uis.cjs +594 -0
  714. package/dist/tools/browser-tool-uis.cjs.map +1 -0
  715. package/dist/tools/browser-tool-uis.d.ts +8 -0
  716. package/dist/tools/browser-tool-uis.js +594 -0
  717. package/dist/tools/browser-tool-uis.js.map +1 -0
  718. package/dist/tools/computer-asset-tool-uis.cjs +313 -0
  719. package/dist/tools/computer-asset-tool-uis.cjs.map +1 -0
  720. package/dist/tools/computer-asset-tool-uis.d.ts +5 -0
  721. package/dist/tools/computer-asset-tool-uis.js +313 -0
  722. package/dist/tools/computer-asset-tool-uis.js.map +1 -0
  723. package/dist/tools/document-edit-tool-uis.cjs +218 -0
  724. package/dist/tools/document-edit-tool-uis.cjs.map +1 -0
  725. package/dist/tools/document-edit-tool-uis.d.ts +40 -0
  726. package/dist/tools/document-edit-tool-uis.js +218 -0
  727. package/dist/tools/document-edit-tool-uis.js.map +1 -0
  728. package/dist/tools/drive-tool-uis.cjs +425 -0
  729. package/dist/tools/drive-tool-uis.cjs.map +1 -0
  730. package/dist/tools/drive-tool-uis.d.ts +120 -0
  731. package/dist/tools/drive-tool-uis.js +425 -0
  732. package/dist/tools/drive-tool-uis.js.map +1 -0
  733. package/dist/tools/email-calendar-tool-uis.cjs +789 -0
  734. package/dist/tools/email-calendar-tool-uis.cjs.map +1 -0
  735. package/dist/tools/email-calendar-tool-uis.d.ts +129 -0
  736. package/dist/tools/email-calendar-tool-uis.js +789 -0
  737. package/dist/tools/email-calendar-tool-uis.js.map +1 -0
  738. package/dist/tools/ontology-tool-uis.cjs +83 -0
  739. package/dist/tools/ontology-tool-uis.cjs.map +1 -0
  740. package/dist/tools/ontology-tool-uis.d.ts +9 -0
  741. package/dist/tools/ontology-tool-uis.js +83 -0
  742. package/dist/tools/ontology-tool-uis.js.map +1 -0
  743. package/dist/tools/orchestration-tool-uis.cjs +586 -0
  744. package/dist/tools/orchestration-tool-uis.cjs.map +1 -0
  745. package/dist/tools/orchestration-tool-uis.d.ts +141 -0
  746. package/dist/tools/orchestration-tool-uis.js +586 -0
  747. package/dist/tools/orchestration-tool-uis.js.map +1 -0
  748. package/dist/tools/presentation-edit-tool-uis.cjs +516 -0
  749. package/dist/tools/presentation-edit-tool-uis.cjs.map +1 -0
  750. package/dist/tools/presentation-edit-tool-uis.d.ts +73 -0
  751. package/dist/tools/presentation-edit-tool-uis.js +516 -0
  752. package/dist/tools/presentation-edit-tool-uis.js.map +1 -0
  753. package/dist/tools/project-tool-uis.cjs +213 -0
  754. package/dist/tools/project-tool-uis.cjs.map +1 -0
  755. package/dist/tools/project-tool-uis.d.ts +14 -0
  756. package/dist/tools/project-tool-uis.js +213 -0
  757. package/dist/tools/project-tool-uis.js.map +1 -0
  758. package/dist/tools/sandbox-tool-uis.cjs +491 -0
  759. package/dist/tools/sandbox-tool-uis.cjs.map +1 -0
  760. package/dist/tools/sandbox-tool-uis.d.ts +116 -0
  761. package/dist/tools/sandbox-tool-uis.js +491 -0
  762. package/dist/tools/sandbox-tool-uis.js.map +1 -0
  763. package/dist/tools/sheet-query-tool-ui.cjs +138 -0
  764. package/dist/tools/sheet-query-tool-ui.cjs.map +1 -0
  765. package/dist/tools/sheet-query-tool-ui.d.ts +15 -0
  766. package/dist/tools/sheet-query-tool-ui.js +138 -0
  767. package/dist/tools/sheet-query-tool-ui.js.map +1 -0
  768. package/dist/tools/studio-screenshot-tool-uis.cjs +262 -0
  769. package/dist/tools/studio-screenshot-tool-uis.cjs.map +1 -0
  770. package/dist/tools/studio-screenshot-tool-uis.d.ts +52 -0
  771. package/dist/tools/studio-screenshot-tool-uis.js +262 -0
  772. package/dist/tools/studio-screenshot-tool-uis.js.map +1 -0
  773. package/dist/tools/subagent-task-tool-ui.cjs +24 -475
  774. package/dist/tools/subagent-task-tool-ui.cjs.map +1 -1
  775. package/dist/tools/subagent-task-tool-ui.d.ts +19 -103
  776. package/dist/tools/subagent-task-tool-ui.js +28 -479
  777. package/dist/tools/subagent-task-tool-ui.js.map +1 -1
  778. package/dist/tools/tool-summary.cjs +36 -0
  779. package/dist/tools/tool-summary.cjs.map +1 -1
  780. package/dist/tools/tool-summary.js +36 -0
  781. package/dist/tools/tool-summary.js.map +1 -1
  782. package/dist/tools/tool-uis.cjs +181 -53
  783. package/dist/tools/tool-uis.cjs.map +1 -1
  784. package/dist/tools/tool-uis.d.ts +40 -0
  785. package/dist/tools/tool-uis.js +183 -55
  786. package/dist/tools/tool-uis.js.map +1 -1
  787. package/dist/typed-interrupts/index.cjs +15 -0
  788. package/dist/typed-interrupts/index.cjs.map +1 -0
  789. package/dist/typed-interrupts/index.d.ts +20 -0
  790. package/dist/typed-interrupts/index.js +15 -0
  791. package/dist/typed-interrupts/index.js.map +1 -0
  792. package/dist/workbench/session-workbench-panes.cjs +6 -6
  793. package/dist/workbench/session-workbench-panes.cjs.map +1 -1
  794. package/package.json +28 -6
  795. package/dist/agent-runtime/src/chat-outbox-store.cjs +0 -510
  796. package/dist/agent-runtime/src/chat-outbox-store.cjs.map +0 -1
  797. package/dist/agent-runtime/src/chat-outbox-store.d.ts +0 -210
  798. package/dist/agent-runtime/src/chat-outbox-store.js +0 -510
  799. package/dist/agent-runtime/src/chat-outbox-store.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../../src/chat-ui/mentions/suggestions/data/sources/index.ts"],"sourcesContent":["/**\n * Mention data sources shared by every chat host.\n *\n * Each source function implements the SourceFn interface:\n * (context: SourceContext) => Promise<SourceResult>\n *\n * Sources are either:\n * - FETCHERS: Call GraphQL API (assets, folders, team, etc.)\n * - TRANSFORMERS: Return static/local data (root categories, host-provided items)\n */\n\nimport type {\n MenuItem,\n MentionTool,\n SourceFn,\n SourceResult,\n SourceToRegister,\n FetchMetadata,\n WebpageMention,\n} from \"../types\";\nimport { MentionMenuSection } from \"../types\";\nimport {\n fetchGraphQL,\n SIMPLE_SEARCH_QUERY,\n PAGINATED_ASSETS_QUERY,\n WORKSPACE_MEMBERS_QUERY,\n TOOL_CATALOG_QUERY,\n type MentionAuthContext,\n type AssetResult,\n type WorkspaceMember,\n type ToolCatalogResult,\n} from \"../api-client\";\nimport { assetTypeToThumb, assetTypeToIcon } from \"./asset-type-icons\";\n\n// ── Helpers ──\n\nfunction assetToMenuItem(asset: AssetResult): MenuItem {\n const isFolder = asset.athenaOriginalType === \"folder\";\n const displayType = asset.athenaConvertedType || asset.athenaOriginalType;\n return {\n id: asset.id,\n name: asset.title || \"Untitled\",\n type: isFolder ? \"folder\" : \"asset\",\n thumbnailUrl: assetTypeToThumb(displayType),\n fallbackIcon: assetTypeToIcon(displayType),\n navigatesToScope: isFolder ? asset.id : undefined,\n visibleInScopes: new Set(),\n updatedAt: asset.updatedAt ?? undefined,\n extra: {\n athenaOriginalType: asset.athenaOriginalType,\n athenaConvertedType: asset.athenaConvertedType,\n parentFolderId: asset.parentFolderId,\n },\n };\n}\n\nasync function querySimpleSearch(\n auth: MentionAuthContext,\n opts: {\n query?: string;\n limit: number;\n offset: number;\n includeTypes?: string[];\n excludeTypes?: string[];\n },\n): Promise<{ items: MenuItem[]; hasMore: boolean }> {\n const searchRequest: Record<string, any> = {\n query: opts.query?.trim() || \"\",\n type: opts.includeTypes || [],\n notType: opts.excludeTypes || [],\n limit: opts.limit,\n offset: opts.offset,\n };\n\n const input = {\n searchRequest,\n returnFullAsset: true,\n shouldCalculateTotal: false,\n sort: { field: \"UPDATED_AT\", direction: \"DESC\" },\n filterColumns: { isArchived: false, isHidden: false },\n };\n\n const data = await fetchGraphQL<{\n simpleSearch: { assets: AssetResult[]; totalCount: number };\n }>(auth, SIMPLE_SEARCH_QUERY, { input });\n\n const assets = data.simpleSearch?.assets || [];\n return {\n items: assets.map(assetToMenuItem),\n hasMore: assets.length === opts.limit,\n };\n}\n\n// ══════════════════════════════════════════════════════════════════════\n// ROOT CATEGORIES (Transformer)\n// ══════════════════════════════════════════════════════════════════════\n\nexport interface RootCategoriesConfig {\n categories: string[];\n getWebpages: () => readonly WebpageMention[];\n}\n\nconst CATEGORY_DEFS: Record<\n string,\n { name: string; icon: string; scope: string }\n> = {\n favorites: { name: \"Favorites\", icon: \"star\", scope: \"favorites\" },\n assets: { name: \"Assets\", icon: \"file-text\", scope: \"athena_assets\" },\n projects: {\n name: \"Projects\",\n icon: \"folder-kanban\",\n scope: \"athena_projects\",\n },\n browse_profiles: {\n name: \"Browse Profiles\",\n icon: \"globe\",\n scope: \"athena_browse_profiles\",\n },\n folders: { name: \"Folders\", icon: \"folder\", scope: \"athena_folders\" },\n tools: { name: \"Tools\", icon: \"wrench\", scope: \"tools\" },\n toolkits: { name: \"Toolkits\", icon: \"package\", scope: \"toolkits\" },\n team: { name: \"Team\", icon: \"users\", scope: \"team\" },\n drives: { name: \"Drives\", icon: \"hard-drive\", scope: \"drive_catalogs\" },\n};\n\nfunction webpageDescription(webpage: WebpageMention): string {\n try {\n const hostname = new URL(webpage.url).hostname;\n return webpage.isCurrent ? `${webpage.title} · ${hostname}` : hostname;\n } catch {\n return webpage.title;\n }\n}\n\nfunction webpageToMenuItem(webpage: WebpageMention): MenuItem {\n return {\n id: `webpage-tab-${webpage.tabId}`,\n name: webpage.isCurrent ? \"This webpage\" : webpage.title,\n type: \"tab\",\n thumbnailUrl: assetTypeToThumb(\"web_page\"),\n fallbackIcon: \"globe\",\n visibleInScopes: new Set([\"root\"]),\n description: webpageDescription(webpage),\n url: webpage.url,\n menuSection: webpage.isCurrent\n ? MentionMenuSection.CURRENT_WEBPAGE\n : MentionMenuSection.OTHER_WEBPAGES,\n extra: {\n tabId: webpage.tabId,\n title: webpage.title,\n isCurrent: webpage.isCurrent,\n },\n };\n}\n\nexport function buildRootMenuItems({\n categories,\n webpages,\n}: {\n categories: readonly string[];\n webpages: readonly WebpageMention[];\n}): MenuItem[] {\n const webpageItems = webpages.map(webpageToMenuItem);\n const categoryItems = categories\n .filter((cat: string) => CATEGORY_DEFS[cat])\n .map((cat: string) => {\n const def = CATEGORY_DEFS[cat];\n return {\n id: cat,\n name: def.name,\n type: \"menu\" as const,\n fallbackIcon: def.icon,\n visibleInScopes: new Set([\"root\"]),\n navigatesToScope: def.scope,\n isNavigationOnly: true,\n menuSection: MentionMenuSection.LIBRARY,\n };\n });\n\n return [...webpageItems, ...categoryItems];\n}\n\nexport const transformRootCategories: SourceFn<RootCategoriesConfig> = async (\n context,\n) => {\n const { sourceConfig } = context;\n const items = buildRootMenuItems({\n categories: sourceConfig.categories,\n webpages: sourceConfig.getWebpages(),\n });\n\n return { items, pagination: { hasMore: false } };\n};\n\n// ══════════════════════════════════════════════════════════════════════\n// ASSETS (Fetcher) — All non-folder assets via SimpleSearch\n// ══════════════════════════════════════════════════════════════════════\n\nexport interface AssetsConfig {\n auth: MentionAuthContext;\n limit?: number;\n}\n\nexport const fetchAssets: SourceFn<AssetsConfig> = async (context) => {\n const { query, fetchState, sourceConfig } = context;\n const limit = sourceConfig.limit ?? 50;\n const meta = (fetchState.meta as FetchMetadata) || {};\n const offset = meta.validatedCount || 0;\n\n const result = await querySimpleSearch(sourceConfig.auth, {\n query,\n limit,\n offset,\n excludeTypes: [\"folder\", \"catalog\", \"session\"],\n });\n\n return {\n items: result.items,\n pagination: { hasMore: result.hasMore },\n };\n};\n\n// ══════════════════════════════════════════════════════════════════════\n// FAVORITES (Fetcher) — Favorited assets\n// ══════════════════════════════════════════════════════════════════════\n\nexport interface FavoritesConfig {\n auth: MentionAuthContext;\n limit?: number;\n}\n\nexport const fetchFavorites: SourceFn<FavoritesConfig> = async (context) => {\n const { query, fetchState, sourceConfig } = context;\n const limit = sourceConfig.limit ?? 50;\n const meta = (fetchState.meta as FetchMetadata) || {};\n const offset = meta.validatedCount || 0;\n\n const data = await fetchGraphQL<{\n getPaginatedAssetsForWorkspace: AssetResult[];\n }>(sourceConfig.auth, PAGINATED_ASSETS_QUERY, {\n limit,\n offset,\n parentFolderId: null,\n filterTypes: null,\n filterColumns: {\n isFavorited: true,\n isArchived: false,\n isHidden: false,\n },\n });\n\n const assets = data.getPaginatedAssetsForWorkspace || [];\n const items = assets.map(assetToMenuItem);\n\n return {\n items,\n pagination: { hasMore: assets.length === limit },\n };\n};\n\n// ══════════════════════════════════════════════════════════════════════\n// FOLDERS (Fetcher) — All folders as flat list\n// ══════════════════════════════════════════════════════════════════════\n\nexport interface FoldersConfig {\n auth: MentionAuthContext;\n limit?: number;\n}\n\nexport const fetchFolders: SourceFn<FoldersConfig> = async (context) => {\n const { query, fetchState, sourceConfig } = context;\n const limit = sourceConfig.limit ?? 50;\n const meta = (fetchState.meta as FetchMetadata) || {};\n const offset = meta.validatedCount || 0;\n\n const result = await querySimpleSearch(sourceConfig.auth, {\n query,\n limit,\n offset,\n includeTypes: [\"folder\"],\n });\n\n return {\n items: result.items,\n pagination: { hasMore: result.hasMore },\n };\n};\n\n// ══════════════════════════════════════════════════════════════════════\n// FOLDER CONTENTS (Fetcher) — Contents of a specific folder\n// ══════════════════════════════════════════════════════════════════════\n\nexport interface FolderContentsConfig {\n auth: MentionAuthContext;\n limit?: number;\n}\n\nexport const fetchFolderContents: SourceFn<FolderContentsConfig> = async (\n context,\n) => {\n const { scope, query, fetchState, sourceConfig } = context;\n const limit = sourceConfig.limit ?? 50;\n const meta = (fetchState.meta as FetchMetadata) || {};\n const offset = meta.validatedCount || 0;\n\n // Scope IS the folder ID (or 'internal_drive' for root)\n const parentFolderId = scope === \"internal_drive\" ? null : scope;\n\n const data = await fetchGraphQL<{\n getPaginatedAssetsForWorkspace: AssetResult[];\n }>(sourceConfig.auth, PAGINATED_ASSETS_QUERY, {\n limit,\n offset,\n parentFolderId,\n filterTypes: null,\n filterColumns: {\n isArchived: false,\n isHidden: false,\n ...(query ? { title: [{ op: \"LIKE\", value: `%${query}%` }] } : {}),\n },\n });\n\n const rawAssets = data.getPaginatedAssetsForWorkspace || [];\n // Exclude catalogs from folder contents\n const assets = rawAssets.filter(\n (a) =>\n a.athenaConvertedType !== \"catalog\" && a.athenaOriginalType !== \"catalog\",\n );\n const items = assets.map(assetToMenuItem);\n\n return {\n items,\n pagination: {\n hasMore: rawAssets.length === limit,\n consumedCount: rawAssets.length,\n },\n };\n};\n\n// ══════════════════════════════════════════════════════════════════════\n// PROJECTS (Fetcher) — Project assets\n// ══════════════════════════════════════════════════════════════════════\n\nexport interface TypedAssetsConfig {\n auth: MentionAuthContext;\n includeOnlyTypes: string[];\n limit?: number;\n}\n\nexport const fetchTypedAssets: SourceFn<TypedAssetsConfig> = async (\n context,\n) => {\n const { query, fetchState, sourceConfig } = context;\n const limit = sourceConfig.limit ?? 50;\n const meta = (fetchState.meta as FetchMetadata) || {};\n const offset = meta.validatedCount || 0;\n\n const result = await querySimpleSearch(sourceConfig.auth, {\n query,\n limit,\n offset,\n includeTypes: sourceConfig.includeOnlyTypes,\n });\n\n return {\n items: result.items,\n pagination: { hasMore: result.hasMore },\n };\n};\n\n// ══════════════════════════════════════════════════════════════════════\n// TEAM (Fetcher) — Workspace members\n// ══════════════════════════════════════════════════════════════════════\n\nexport interface TeamConfig {\n auth: MentionAuthContext;\n /** Shared member loader, so browsing Team and searching read one fetch. */\n loadTeam?: () => Promise<MenuItem[]>;\n}\n\n// Person mentions are keyed on email (`mention://person?id=<email>&email=…`),\n// so a member without one cannot be mentioned.\nfunction memberToMenuItem(\n member: WorkspaceMember & { email: string },\n): MenuItem {\n const displayName =\n [member.firstName, member.lastName].filter(Boolean).join(\" \").trim() ||\n member.email;\n\n return {\n id: member.email,\n name: displayName,\n type: \"user\" as const,\n fallbackIcon: \"user\",\n thumbnailUrl: member.avatarUrl || undefined,\n visibleInScopes: new Set<string>(),\n email: member.email,\n extra: { isAdmin: member.isAdmin },\n };\n}\n\nasync function queryTeam(auth: MentionAuthContext): Promise<MenuItem[]> {\n if (!auth.workspaceId) return [];\n const data = await fetchGraphQL<{ getUsersInWorkspace: WorkspaceMember[] }>(\n auth,\n WORKSPACE_MEMBERS_QUERY,\n { workspaceId: auth.workspaceId },\n );\n return (data.getUsersInWorkspace || [])\n .filter((member): member is WorkspaceMember & { email: string } =>\n Boolean(member.email),\n )\n .map(memberToMenuItem);\n}\n\n/**\n * One workspace-member fetch per store: every keystroke of a root search\n * reads the same list. A failed fetch is forgotten so the next one retries.\n */\nexport function createTeamLoader(\n auth: MentionAuthContext,\n): () => Promise<MenuItem[]> {\n let pending: Promise<MenuItem[]> | null = null;\n return () => {\n pending ??= queryTeam(auth).catch((error: unknown) => {\n pending = null;\n throw error;\n });\n return pending;\n };\n}\n\nexport const fetchTeam: SourceFn<TeamConfig> = async (context) => {\n const { auth, loadTeam } = context.sourceConfig;\n const items = await (loadTeam ? loadTeam() : queryTeam(auth));\n return { items, pagination: { hasMore: false } };\n};\n\n// Asset results never wait on the roster for longer than this; a slow roster\n// lands on a later keystroke, which reads the same pending request.\nconst TEAM_WAIT_MS = 1500;\n\nfunction withinTeamWait(members: Promise<MenuItem[]>): Promise<MenuItem[]> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n const timeout = new Promise<MenuItem[]>((resolve) => {\n timer = setTimeout(() => resolve([]), TEAM_WAIT_MS);\n });\n return Promise.race([members.catch(() => []), timeout]).finally(() =>\n clearTimeout(timer),\n );\n}\n\n/**\n * Add workspace members to a root search's first page, so `@<name>` finds\n * people beside assets (the cache filters them by the query). Like\n * `withProvidedTools`, `consumedCount` stays the server's row count so the\n * members never advance the asset offset; a failed member fetch leaves the\n * asset results alone.\n */\nexport function withTeam<TConfig>(\n source: SourceFn<TConfig>,\n loadTeam: () => Promise<MenuItem[]>,\n): SourceFn<TConfig> {\n // Members come from Athena: while it can't be reached, only what the wrapped source can list\n // without it stands in (a host's own tools).\n return keepOfflineItems(source, async (context) => {\n const meta = (context.fetchState.meta as FetchMetadata) || {};\n const isFirstPage = (meta.validatedCount || 0) === 0;\n const [result, team] = await Promise.all([\n source(context),\n isFirstPage && context.query?.trim()\n ? withinTeamWait(loadTeam())\n : Promise.resolve([]),\n ]);\n if (team.length === 0) return result;\n return {\n ...result,\n items: [...team, ...result.items],\n pagination: {\n ...result.pagination,\n hasMore: result.pagination?.hasMore ?? false,\n consumedCount: result.pagination?.consumedCount ?? result.items.length,\n },\n };\n });\n}\n\n// ══════════════════════════════════════════════════════════════════════\n// TOOLS / TOOLKITS (Fetcher) — Mentionable tool catalog\n// ══════════════════════════════════════════════════════════════════════\n\nexport interface ToolCatalogConfig {\n auth: MentionAuthContext;\n}\n\n// getToolkitToToolsMapping is already filtered server-side for the\n// authenticated user (admin-only entries, beta allowlist, workspace registry),\n// so only mention/menu visibility is applied here.\nasync function queryToolCatalog(\n auth: MentionAuthContext,\n): Promise<ToolCatalogResult[\"getToolkitToToolsMapping\"]> {\n const data = await fetchGraphQL<ToolCatalogResult>(auth, TOOL_CATALOG_QUERY);\n return data.getToolkitToToolsMapping;\n}\n\nexport const fetchTools: SourceFn<ToolCatalogConfig> = async (context) => {\n const catalog = await queryToolCatalog(context.sourceConfig.auth);\n\n const items: MenuItem[] = catalog.tools\n .filter((tool) => tool.isMentionable)\n .map((tool) => ({\n id: tool.id,\n name: tool.name,\n type: \"tool\" as const,\n fallbackIcon: tool.icon,\n description: tool.description ?? undefined,\n visibleInScopes: new Set<string>(),\n ...(tool.adminOnly ? { extra: { isAdminOnly: true } } : {}),\n }));\n\n return { items, pagination: { hasMore: false } };\n};\n\nexport const fetchToolkits: SourceFn<ToolCatalogConfig> = async (context) => {\n const catalog = await queryToolCatalog(context.sourceConfig.auth);\n\n const items: MenuItem[] = catalog.toolkits\n .filter((toolkit) => toolkit.isMentionable && !toolkit.hideFromMenu)\n .map((toolkit) => ({\n id: toolkit.name,\n name: toolkit.displayName,\n type: \"toolkit\" as const,\n fallbackIcon: toolkit.icon,\n description: toolkit.description || undefined,\n visibleInScopes: new Set<string>(),\n ...(toolkit.onlyAdmin ? { extra: { isAdminOnly: true } } : {}),\n }));\n\n return { items, pagination: { hasMore: false } };\n};\n\n// ══════════════════════════════════════════════════════════════════════\n// DRIVES (Fetcher) — Drive catalog assets\n// ══════════════════════════════════════════════════════════════════════\n\nexport interface DrivesConfig {\n auth: MentionAuthContext;\n}\n\nexport const fetchDrives: SourceFn<DrivesConfig> = async (context) => {\n const { fetchState, sourceConfig } = context;\n const meta = (fetchState.meta as FetchMetadata) || {};\n const offset = meta.validatedCount || 0;\n\n const result = await querySimpleSearch(sourceConfig.auth, {\n limit: 50,\n offset,\n includeTypes: [\"catalog\"],\n });\n\n // Drive catalogs are navigation-only (navigate into them to see contents)\n const items: MenuItem[] = result.items.map((item) => ({\n ...item,\n type: \"drive_catalog\" as const,\n fallbackIcon: \"hard-drive\",\n isNavigationOnly: true,\n navigatesToScope: item.id,\n }));\n\n // Register folder contents source for each catalog\n const sources: SourceToRegister[] = items.map((item) => ({\n scope: item.id,\n sourceFn: fetchFolderContents,\n sourceConfig: { auth: sourceConfig.auth, limit: 50 },\n }));\n\n return {\n items,\n pagination: { hasMore: result.hasMore },\n sources,\n };\n};\n\n// ══════════════════════════════════════════════════════════════════════\n// GLOBAL SEARCH (Fetcher) — Aggregated search across all sources\n// ══════════════════════════════════════════════════════════════════════\n\nexport interface GlobalSearchConfig {\n auth: MentionAuthContext;\n}\n\nexport const fetchGlobalSearch: SourceFn<GlobalSearchConfig> = async (\n context,\n) => {\n const { query, fetchState, sourceConfig } = context;\n if (!query?.trim()) return { items: [], pagination: { hasMore: false } };\n\n const meta = (fetchState.meta as FetchMetadata) || {};\n const offset = meta.validatedCount || 0;\n\n const result = await querySimpleSearch(sourceConfig.auth, {\n query,\n limit: 50,\n offset,\n excludeTypes: [\"catalog\", \"session\"],\n });\n\n return {\n items: result.items,\n pagination: { hasMore: result.hasMore },\n };\n};\n\n// ══════════════════════════════════════════════════════════════════════\n// HOST-PROVIDED TOOLS (Transformer) — a host's own Tools / Toolkits list\n// ══════════════════════════════════════════════════════════════════════\n\nexport interface ProvidedToolsConfig {\n getTools: () => readonly MentionTool[];\n type: MentionTool[\"type\"];\n}\n\n/** Menu items for a host-provided tool list, in the host's order. */\nexport function providedToolMenuItems(\n tools: readonly MentionTool[],\n type?: MentionTool[\"type\"],\n): MenuItem[] {\n return tools\n .filter((tool) => type === undefined || tool.type === type)\n .map((tool) => ({\n id: tool.id,\n name: tool.name,\n type: tool.type,\n fallbackIcon: tool.icon ?? (tool.type === \"toolkit\" ? \"Package\" : \"Wrench\"),\n description: tool.description,\n visibleInScopes: new Set<string>(),\n }));\n}\n\nexport const transformProvidedTools: SourceFn<ProvidedToolsConfig> = async (\n context,\n) => ({\n items: providedToolMenuItems(\n context.sourceConfig.getTools(),\n context.sourceConfig.type,\n ),\n pagination: { hasMore: false },\n});\n\n/**\n * Prepend a host's tool list to another source's items so a root query matches\n * them the way it matches assets (the cache filters by query and sorts\n * toolkits first). The wrapped source's offset bookkeeping is preserved:\n * `consumedCount` stays the number of rows the server returned, so the added\n * items never advance the next page's offset.\n */\nexport function withProvidedTools<TConfig>(\n source: SourceFn<TConfig>,\n getTools: () => readonly MentionTool[],\n): SourceFn<TConfig> {\n const wrapped: SourceFn<TConfig> = async (context) => {\n const result = await source(context);\n return {\n ...result,\n items: [...providedToolMenuItems(getTools()), ...result.items],\n pagination: {\n ...result.pagination,\n hasMore: result.pagination?.hasMore ?? false,\n consumedCount: result.pagination?.consumedCount ?? result.items.length,\n },\n };\n };\n // The host's tools are the host's own: while Athena can't be reached, a search still finds them.\n OFFLINE_ITEMS.set(wrapped as SourceFn, () => providedToolMenuItems(getTools()));\n return wrapped;\n}\n\n/**\n * What a source that asks Athena can still list while Athena can't be reached: the host's own items\n * it carries (a host's tool list), by source. The source itself is never called then.\n */\nconst OFFLINE_ITEMS = new WeakMap<SourceFn, () => MenuItem[]>();\n\n/** `wrapped` keeps what `inner` lists without Athena (a wrapper that adds Athena's items alone). */\nfunction keepOfflineItems<TConfig>(\n inner: SourceFn<TConfig>,\n wrapped: SourceFn<TConfig>,\n): SourceFn<TConfig> {\n const offline = OFFLINE_ITEMS.get(inner as SourceFn);\n if (offline) OFFLINE_ITEMS.set(wrapped as SourceFn, offline);\n return wrapped;\n}\n\n/**\n * The host's own items a source asking Athena can still list while Athena can't be reached (a\n * root search's host tools), unfiltered; none for a source that holds no such items.\n */\nexport function offlineItemsOf(sourceFn: SourceFn): MenuItem[] {\n return OFFLINE_ITEMS.get(sourceFn)?.() ?? [];\n}\n\n// ══════════════════════════════════════════════════════════════════════\n// LOCAL SOURCES — what a scope can show while Athena can't be reached\n// ══════════════════════════════════════════════════════════════════════\n\n/**\n * The transformers: they read only what the host already holds (its tabs, its\n * own tool list), so their scopes keep working while Athena can't be reached.\n * Every other source asks Athena.\n */\nconst LOCAL_SOURCES: ReadonlySet<SourceFn> = new Set<SourceFn>([\n transformRootCategories,\n transformProvidedTools,\n]);\n\n/** Whether a scope's source asks Athena for its items (a fetcher, not a transformer). */\nexport function sourceAsksAthena(sourceFn: SourceFn): boolean {\n return !LOCAL_SOURCES.has(sourceFn);\n}\n"],"names":[],"mappings":";;;AAoCA,SAAS,gBAAgB,OAA8B;AACrD,QAAM,WAAW,MAAM,uBAAuB;AAC9C,QAAM,cAAc,MAAM,uBAAuB,MAAM;AACvD,SAAO;AAAA,IACL,IAAI,MAAM;AAAA,IACV,MAAM,MAAM,SAAS;AAAA,IACrB,MAAM,WAAW,WAAW;AAAA,IAC5B,cAAc,iBAAiB,WAAW;AAAA,IAC1C,cAAc,gBAAgB,WAAW;AAAA,IACzC,kBAAkB,WAAW,MAAM,KAAK;AAAA,IACxC,qCAAqB,IAAA;AAAA,IACrB,WAAW,MAAM,aAAa;AAA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aACI;AAAA,EACJ,OAAO;AAAA,IACL,QAAQ,aAAa,SAAA;AAAA,IACrB,QAAQ,aAAa;AAAA,EAAA;AAAA,EAEvB,YAAY,EAAE,SAAS,MAAA;AACzB;AASO,SAAS,kBACd,QACA,UACmB;AACnB,QAAM,UAA6B,OAAO,YAAY;;AACpD,UAAM,SAAS,MAAM,OAAO,OAAO;AACnC,WAAO;AAAA,MACL,GAAG;AAAA,MACH,OAAO,CAAC,GAAG,sBAAsB,UAAU,GAAG,GAAG,OAAO,KAAK;AAAA,MAC7D,YAAY;AAAA,QACV,GAAG,OAAO;AAAA,QACV,WAAS,YAAO,eAAP,mBAAmB,YAAW;AAAA,QACvC,iBAAe,YAAO,eAAP,mBAAmB,kBAAiB,OAAO,MAAM;AAAA,MAAA;AAAA,IAClE;AAAA,EAEJ;AAEA,gBAAc,IAAI,SAAqB,MAAM,sBAAsB,SAAA,CAAU,CAAC;AAC9E,SAAO;AACT;AAMA,MAAM,oCAAoB,QAAA;AAG1B,SAAS,iBACP,OACA,SACmB;AACnB,QAAM,UAAU,cAAc,IAAI,KAAiB;AACnD,MAAI,QAAS,eAAc,IAAI,SAAqB,OAAO;AAC3D,SAAO;AACT;AAMO,SAAS,eAAe,UAAgC;;AAC7D,WAAO,mBAAc,IAAI,QAAQ,MAA1B,yBAAmC,CAAA;AAC5C;AAWA,MAAM,oCAA2C,IAAc;AAAA,EAC7D;AAAA,EACA;AACF,CAAC;AAGM,SAAS,iBAAiB,UAA6B;AAC5D,SAAO,CAAC,cAAc,IAAI,QAAQ;AACpC;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../../src/chat-ui/mentions/suggestions/data/sources/index.ts"],"sourcesContent":["/**\n * Mention data sources shared by every chat host.\n *\n * Each source function implements the SourceFn interface:\n * (context: SourceContext) => Promise<SourceResult>\n *\n * Sources are either:\n * - FETCHERS: Call GraphQL API (assets, folders, team, etc.)\n * - TRANSFORMERS: Return static/local data (root categories, host-provided items)\n */\n\nimport type {\n MenuItem,\n MentionChatAgent,\n MentionTool,\n SourceFn,\n SourceResult,\n SourceToRegister,\n FetchMetadata,\n WebpageMention,\n} from \"../types\";\nimport { MentionMenuSection } from \"../types\";\nimport {\n fetchGraphQL,\n SIMPLE_SEARCH_QUERY,\n PAGINATED_ASSETS_QUERY,\n WORKSPACE_MEMBERS_QUERY,\n WORKSPACE_GROUPS_QUERY,\n PERSON_MENTION_CANDIDATES_QUERY,\n TOOL_CATALOG_QUERY,\n type MentionAuthContext,\n type AssetResult,\n type WorkspaceMember,\n type WorkspaceGroup,\n type PersonMentionCandidate,\n type ToolCatalogResult,\n} from \"../api-client\";\nimport { filterItems } from \"../utils/filter-items\";\nimport { assetTypeToThumb, assetTypeToIcon } from \"./asset-type-icons\";\n\n// ── Helpers ──\n\nfunction assetToMenuItem(asset: AssetResult): MenuItem {\n const isFolder = asset.athenaOriginalType === \"folder\";\n const displayType = asset.athenaConvertedType || asset.athenaOriginalType;\n return {\n id: asset.id,\n name: asset.title || \"Untitled\",\n type: isFolder ? \"folder\" : \"asset\",\n thumbnailUrl: assetTypeToThumb(displayType),\n fallbackIcon: assetTypeToIcon(displayType),\n navigatesToScope: isFolder ? asset.id : undefined,\n visibleInScopes: new Set(),\n updatedAt: asset.updatedAt ?? undefined,\n extra: {\n athenaOriginalType: asset.athenaOriginalType,\n athenaConvertedType: asset.athenaConvertedType,\n parentFolderId: asset.parentFolderId,\n },\n };\n}\n\nasync function querySimpleSearch(\n auth: MentionAuthContext,\n opts: {\n query?: string;\n limit: number;\n offset: number;\n includeTypes?: string[];\n excludeTypes?: string[];\n },\n): Promise<{ items: MenuItem[]; hasMore: boolean }> {\n const searchRequest: Record<string, any> = {\n query: opts.query?.trim() || \"\",\n type: opts.includeTypes || [],\n notType: opts.excludeTypes || [],\n limit: opts.limit,\n offset: opts.offset,\n };\n\n const input = {\n searchRequest,\n returnFullAsset: true,\n shouldCalculateTotal: false,\n sort: { field: \"UPDATED_AT\", direction: \"DESC\" },\n filterColumns: { isArchived: false, isHidden: false },\n };\n\n const data = await fetchGraphQL<{\n simpleSearch: { assets: AssetResult[]; totalCount: number };\n }>(auth, SIMPLE_SEARCH_QUERY, { input });\n\n const assets = data.simpleSearch?.assets || [];\n return {\n items: assets.map(assetToMenuItem),\n hasMore: assets.length === opts.limit,\n };\n}\n\n// ══════════════════════════════════════════════════════════════════════\n// ROOT CATEGORIES (Transformer)\n// ══════════════════════════════════════════════════════════════════════\n\n/** The scope of the composer's Agents section (Olympus's `CHAT_AGENTS_SCOPE`). */\nexport const CHAT_AGENTS_SCOPE = \"athena_chat_agents\";\n\nexport interface RootCategoriesConfig {\n categories: string[];\n getWebpages: () => readonly WebpageMention[];\n /**\n * The agents the Agents category offers now: the category shows only while\n * there is one to name (it hides once eight are named, or for a viewer who is\n * offered none).\n */\n getChatAgents?: () => readonly MentionChatAgent[];\n}\n\nconst CATEGORY_DEFS: Record<\n string,\n { name: string; icon: string; scope: string }\n> = {\n favorites: { name: \"Favorites\", icon: \"star\", scope: \"favorites\" },\n assets: { name: \"Assets\", icon: \"file-text\", scope: \"athena_assets\" },\n projects: {\n name: \"Projects\",\n icon: \"folder-kanban\",\n scope: \"athena_projects\",\n },\n browse_profiles: {\n name: \"Browse Profiles\",\n icon: \"globe\",\n scope: \"athena_browse_profiles\",\n },\n folders: { name: \"Folders\", icon: \"folder\", scope: \"athena_folders\" },\n tools: { name: \"Tools\", icon: \"wrench\", scope: \"tools\" },\n toolkits: { name: \"Toolkits\", icon: \"package\", scope: \"toolkits\" },\n team: { name: \"Team\", icon: \"users\", scope: \"team\" },\n agents: { name: \"Agents\", icon: \"bot\", scope: CHAT_AGENTS_SCOPE },\n drives: { name: \"Drives\", icon: \"hard-drive\", scope: \"drive_catalogs\" },\n};\n\nfunction webpageDescription(webpage: WebpageMention): string {\n try {\n const hostname = new URL(webpage.url).hostname;\n return webpage.isCurrent ? `${webpage.title} · ${hostname}` : hostname;\n } catch {\n return webpage.title;\n }\n}\n\nfunction webpageToMenuItem(webpage: WebpageMention): MenuItem {\n return {\n id: `webpage-tab-${webpage.tabId}`,\n name: webpage.isCurrent ? \"This webpage\" : webpage.title,\n type: \"tab\",\n thumbnailUrl: assetTypeToThumb(\"web_page\"),\n fallbackIcon: \"globe\",\n visibleInScopes: new Set([\"root\"]),\n description: webpageDescription(webpage),\n url: webpage.url,\n menuSection: webpage.isCurrent\n ? MentionMenuSection.CURRENT_WEBPAGE\n : MentionMenuSection.OTHER_WEBPAGES,\n extra: {\n tabId: webpage.tabId,\n title: webpage.title,\n isCurrent: webpage.isCurrent,\n },\n };\n}\n\nexport function buildRootMenuItems({\n categories,\n webpages,\n hasChatAgents = false,\n}: {\n categories: readonly string[];\n webpages: readonly WebpageMention[];\n /** Whether the Agents category has an agent to offer (it shows only then). */\n hasChatAgents?: boolean;\n}): MenuItem[] {\n const webpageItems = webpages.map(webpageToMenuItem);\n const categoryItems = categories\n .filter((cat: string) => CATEGORY_DEFS[cat])\n .filter((cat: string) => cat !== \"agents\" || hasChatAgents)\n .map((cat: string) => {\n const def = CATEGORY_DEFS[cat];\n return {\n id: cat,\n name: def.name,\n type: \"menu\" as const,\n fallbackIcon: def.icon,\n visibleInScopes: new Set([\"root\"]),\n navigatesToScope: def.scope,\n isNavigationOnly: true,\n menuSection: MentionMenuSection.LIBRARY,\n };\n });\n\n return [...webpageItems, ...categoryItems];\n}\n\nexport const transformRootCategories: SourceFn<RootCategoriesConfig> = async (\n context,\n) => {\n const { sourceConfig } = context;\n const items = buildRootMenuItems({\n categories: sourceConfig.categories,\n webpages: sourceConfig.getWebpages(),\n hasChatAgents: (sourceConfig.getChatAgents?.().length ?? 0) > 0,\n });\n\n return { items, pagination: { hasMore: false } };\n};\n\n// ══════════════════════════════════════════════════════════════════════\n// ASSETS (Fetcher) — All non-folder assets via SimpleSearch\n// ══════════════════════════════════════════════════════════════════════\n\nexport interface AssetsConfig {\n auth: MentionAuthContext;\n limit?: number;\n}\n\nexport const fetchAssets: SourceFn<AssetsConfig> = async (context) => {\n const { query, fetchState, sourceConfig } = context;\n const limit = sourceConfig.limit ?? 50;\n const meta = (fetchState.meta as FetchMetadata) || {};\n const offset = meta.validatedCount || 0;\n\n const result = await querySimpleSearch(sourceConfig.auth, {\n query,\n limit,\n offset,\n excludeTypes: [\"folder\", \"catalog\", \"session\"],\n });\n\n return {\n items: result.items,\n pagination: { hasMore: result.hasMore },\n };\n};\n\n// ══════════════════════════════════════════════════════════════════════\n// FAVORITES (Fetcher) — Favorited assets\n// ══════════════════════════════════════════════════════════════════════\n\nexport interface FavoritesConfig {\n auth: MentionAuthContext;\n limit?: number;\n}\n\nexport const fetchFavorites: SourceFn<FavoritesConfig> = async (context) => {\n const { query, fetchState, sourceConfig } = context;\n const limit = sourceConfig.limit ?? 50;\n const meta = (fetchState.meta as FetchMetadata) || {};\n const offset = meta.validatedCount || 0;\n\n const data = await fetchGraphQL<{\n getPaginatedAssetsForWorkspace: AssetResult[];\n }>(sourceConfig.auth, PAGINATED_ASSETS_QUERY, {\n limit,\n offset,\n parentFolderId: null,\n filterTypes: null,\n filterColumns: {\n isFavorited: true,\n isArchived: false,\n isHidden: false,\n },\n });\n\n const assets = data.getPaginatedAssetsForWorkspace || [];\n const items = assets.map(assetToMenuItem);\n\n return {\n items,\n pagination: { hasMore: assets.length === limit },\n };\n};\n\n// ══════════════════════════════════════════════════════════════════════\n// FOLDERS (Fetcher) — All folders as flat list\n// ══════════════════════════════════════════════════════════════════════\n\nexport interface FoldersConfig {\n auth: MentionAuthContext;\n limit?: number;\n}\n\nexport const fetchFolders: SourceFn<FoldersConfig> = async (context) => {\n const { query, fetchState, sourceConfig } = context;\n const limit = sourceConfig.limit ?? 50;\n const meta = (fetchState.meta as FetchMetadata) || {};\n const offset = meta.validatedCount || 0;\n\n const result = await querySimpleSearch(sourceConfig.auth, {\n query,\n limit,\n offset,\n includeTypes: [\"folder\"],\n });\n\n return {\n items: result.items,\n pagination: { hasMore: result.hasMore },\n };\n};\n\n// ══════════════════════════════════════════════════════════════════════\n// FOLDER CONTENTS (Fetcher) — Contents of a specific folder\n// ══════════════════════════════════════════════════════════════════════\n\nexport interface FolderContentsConfig {\n auth: MentionAuthContext;\n limit?: number;\n}\n\nexport const fetchFolderContents: SourceFn<FolderContentsConfig> = async (\n context,\n) => {\n const { scope, query, fetchState, sourceConfig } = context;\n const limit = sourceConfig.limit ?? 50;\n const meta = (fetchState.meta as FetchMetadata) || {};\n const offset = meta.validatedCount || 0;\n\n // Scope IS the folder ID (or 'internal_drive' for root)\n const parentFolderId = scope === \"internal_drive\" ? null : scope;\n\n const data = await fetchGraphQL<{\n getPaginatedAssetsForWorkspace: AssetResult[];\n }>(sourceConfig.auth, PAGINATED_ASSETS_QUERY, {\n limit,\n offset,\n parentFolderId,\n filterTypes: null,\n filterColumns: {\n isArchived: false,\n isHidden: false,\n ...(query ? { title: [{ op: \"LIKE\", value: `%${query}%` }] } : {}),\n },\n });\n\n const rawAssets = data.getPaginatedAssetsForWorkspace || [];\n // Exclude catalogs from folder contents\n const assets = rawAssets.filter(\n (a) =>\n a.athenaConvertedType !== \"catalog\" && a.athenaOriginalType !== \"catalog\",\n );\n const items = assets.map(assetToMenuItem);\n\n return {\n items,\n pagination: {\n hasMore: rawAssets.length === limit,\n consumedCount: rawAssets.length,\n },\n };\n};\n\n// ══════════════════════════════════════════════════════════════════════\n// PROJECTS (Fetcher) — Project assets\n// ══════════════════════════════════════════════════════════════════════\n\nexport interface TypedAssetsConfig {\n auth: MentionAuthContext;\n includeOnlyTypes: string[];\n limit?: number;\n}\n\nexport const fetchTypedAssets: SourceFn<TypedAssetsConfig> = async (\n context,\n) => {\n const { query, fetchState, sourceConfig } = context;\n const limit = sourceConfig.limit ?? 50;\n const meta = (fetchState.meta as FetchMetadata) || {};\n const offset = meta.validatedCount || 0;\n\n const result = await querySimpleSearch(sourceConfig.auth, {\n query,\n limit,\n offset,\n includeTypes: sourceConfig.includeOnlyTypes,\n });\n\n return {\n items: result.items,\n pagination: { hasMore: result.hasMore },\n };\n};\n\n// ══════════════════════════════════════════════════════════════════════\n// TEAM (Fetcher) — Workspace members, the viewer's people, the workspace's groups\n// ══════════════════════════════════════════════════════════════════════\n\n/** Loads the Team list; browsing Team and every root search read one fetch. */\nexport type TeamLoader = () => Promise<MenuItem[]>;\n\nexport interface TeamConfig {\n auth: MentionAuthContext;\n /** Shared member loader, so browsing Team and searching read one fetch. */\n loadTeam?: TeamLoader;\n}\n\nexport interface TeamLoaderOptions {\n /**\n * Whether the viewer is an Athena admin, read at each load: while Person is in\n * preview the ranked people are an admin's alone, as in Olympus.\n */\n getIsAdmin?: () => boolean;\n}\n\n/**\n * Where a Team item names the saved person asset it stands for: a root search\n * drops that asset's own row, since the person is already listed once, as\n * themselves (Olympus's `SAVED_PERSON_ASSET_ID_EXTRA`).\n */\nexport const SAVED_PERSON_ASSET_ID_EXTRA = \"savedPersonAssetId\";\n\n/** How many of the viewer's people Team reads (agora's most). */\nconst PERSON_CANDIDATES_LIMIT = 500;\n\nfunction normalizeEmail(email: string | null | undefined): string {\n return (email ?? \"\").trim().toLowerCase();\n}\n\ntype MemberWithEmail = WorkspaceMember & { email: string };\n\ntype TeamEntry =\n | {\n kind: \"member\";\n member: MemberWithEmail;\n savedName: string | null;\n savedPersonAssetId: string | null;\n }\n | { kind: \"saved\"; person: PersonMentionCandidate };\n\n/**\n * One ordered Team list, as Olympus ranks it: the viewer's people in their\n * order (most recently talked to first) — a member under the name the viewer\n * saved them as, a saved person who is not a member as themselves — then the\n * members the ranking did not reach. Without people the members keep their\n * order.\n */\nexport function rankTeam({\n members,\n people,\n}: {\n members: readonly MemberWithEmail[];\n people: readonly PersonMentionCandidate[];\n}): TeamEntry[] {\n if (people.length === 0) {\n return members.map((member) => ({\n kind: \"member\",\n member,\n savedName: null,\n savedPersonAssetId: null,\n }));\n }\n const membersByEmail = new Map(\n members.map((member) => [normalizeEmail(member.email), member]),\n );\n const placed = new Set<MemberWithEmail>();\n const entries: TeamEntry[] = [];\n for (const person of people) {\n const member = membersByEmail.get(normalizeEmail(person.email));\n if (member) {\n if (placed.has(member)) continue;\n placed.add(member);\n entries.push({\n kind: \"member\",\n member,\n savedName: person.savedPersonAssetId ? person.displayName : null,\n savedPersonAssetId: person.savedPersonAssetId ?? null,\n });\n } else if (person.savedPersonAssetId) {\n entries.push({ kind: \"saved\", person });\n }\n }\n for (const member of members) {\n if (!placed.has(member)) {\n entries.push({ kind: \"member\", member, savedName: null, savedPersonAssetId: null });\n }\n }\n return entries;\n}\n\n// Person mentions are keyed on email (`mention://person?id=<email>&email=…`),\n// so a member without one cannot be mentioned.\nfunction memberToMenuItem({\n member,\n savedName,\n savedPersonAssetId,\n}: {\n member: MemberWithEmail;\n savedName: string | null;\n savedPersonAssetId: string | null;\n}): MenuItem {\n // The viewer's own name for them, else first + last name, else the email.\n const displayName =\n savedName ||\n [member.firstName, member.lastName].filter(Boolean).join(\" \").trim() ||\n member.email;\n\n return {\n id: member.email,\n name: displayName,\n type: \"user\" as const,\n fallbackIcon: \"user\",\n thumbnailUrl: member.avatarUrl || undefined,\n visibleInScopes: new Set<string>(),\n email: member.email,\n extra: {\n isAdmin: member.isAdmin,\n ...(savedPersonAssetId ? { [SAVED_PERSON_ASSET_ID_EXTRA]: savedPersonAssetId } : {}),\n },\n };\n}\n\n/** A saved person who is not a member mentions like a member: a person reference keyed on email. */\nfunction savedPersonToMenuItem(person: PersonMentionCandidate): MenuItem {\n return {\n id: person.email,\n name: person.displayName,\n type: \"user\" as const,\n fallbackIcon: \"user\",\n thumbnailUrl: person.photoUrl || undefined,\n visibleInScopes: new Set<string>(),\n email: person.email,\n ...(person.savedPersonAssetId\n ? { extra: { [SAVED_PERSON_ASSET_ID_EXTRA]: person.savedPersonAssetId } }\n : {}),\n };\n}\n\nfunction groupMemberCount(count: number): string {\n return count === 1 ? \"1 member\" : `${count} members`;\n}\n\n/**\n * A workspace group: a pointer to the group, not to its members\n * (`mention://group?id=…&name=…`). It shares nothing and notifies nobody, which\n * is why the row shows the member count rather than the members.\n */\nfunction groupToMenuItem(group: WorkspaceGroup): MenuItem {\n return {\n id: group.id,\n name: group.name,\n type: \"group\" as const,\n fallbackIcon: \"users\",\n description: groupMemberCount(group.memberCount),\n visibleInScopes: new Set<string>(),\n extra: {\n memberCount: group.memberCount,\n ...(group.slug ? { slug: group.slug } : {}),\n },\n };\n}\n\nasync function queryMembers(\n auth: MentionAuthContext & { workspaceId: string },\n): Promise<MemberWithEmail[]> {\n const data = await fetchGraphQL<{ getUsersInWorkspace: WorkspaceMember[] }>(\n auth,\n WORKSPACE_MEMBERS_QUERY,\n { workspaceId: auth.workspaceId },\n );\n return (data.getUsersInWorkspace || []).filter(\n (member): member is MemberWithEmail => Boolean(member.email),\n );\n}\n\n/** The workspace's groups, archived ones never offered; none from an agora that predates groups. */\nasync function queryGroups(\n auth: MentionAuthContext & { workspaceId: string },\n): Promise<WorkspaceGroup[]> {\n try {\n const data = await fetchGraphQL<{ getWorkspaceGroups: WorkspaceGroup[] }>(\n auth,\n WORKSPACE_GROUPS_QUERY,\n { workspaceId: auth.workspaceId },\n );\n return (data.getWorkspaceGroups || []).filter((group) => group.archivedAt == null);\n } catch {\n return [];\n }\n}\n\n/** The viewer's people, for an admin; none when agora refuses them (Person's gate, an older agora). */\nasync function queryPeople(auth: MentionAuthContext): Promise<PersonMentionCandidate[]> {\n try {\n const data = await fetchGraphQL<{ personMentionCandidates: PersonMentionCandidate[] }>(\n auth,\n PERSON_MENTION_CANDIDATES_QUERY,\n { limit: PERSON_CANDIDATES_LIMIT },\n );\n return data.personMentionCandidates || [];\n } catch {\n return [];\n }\n}\n\n/**\n * The Team list Olympus offers: the members (ranked by the viewer's people for\n * an admin, with the people they saved who are not members), then the\n * workspace's groups. The members' read decides: when it fails the list fails,\n * and the next load asks again.\n */\nasync function queryTeam(\n auth: MentionAuthContext,\n { isAdmin }: { isAdmin: boolean },\n): Promise<MenuItem[]> {\n const { workspaceId } = auth;\n if (!workspaceId) return [];\n const scoped = { ...auth, workspaceId };\n const [members, groups, people] = await Promise.all([\n queryMembers(scoped),\n queryGroups(scoped),\n isAdmin ? queryPeople(auth) : Promise.resolve<PersonMentionCandidate[]>([]),\n ]);\n return [\n ...rankTeam({ members, people }).map((entry) =>\n entry.kind === \"member\" ? memberToMenuItem(entry) : savedPersonToMenuItem(entry.person),\n ),\n ...groups.map(groupToMenuItem),\n ];\n}\n\n/**\n * One Team fetch per store (and per admin answer): every keystroke of a root\n * search reads the same list. A failed fetch is forgotten so the next one\n * retries.\n */\nexport function createTeamLoader(\n auth: MentionAuthContext,\n { getIsAdmin = () => false }: TeamLoaderOptions = {},\n): TeamLoader {\n let pending: { isAdmin: boolean; team: Promise<MenuItem[]> } | null = null;\n return () => {\n const isAdmin = getIsAdmin();\n if (pending?.isAdmin !== isAdmin) {\n const team = queryTeam(auth, { isAdmin }).catch((error: unknown) => {\n if (pending?.team === team) pending = null;\n throw error;\n });\n pending = { isAdmin, team };\n }\n return pending.team;\n };\n}\n\nexport const fetchTeam: SourceFn<TeamConfig> = async (context) => {\n const { auth, loadTeam } = context.sourceConfig;\n const items = await (loadTeam ? loadTeam() : queryTeam(auth, { isAdmin: false }));\n return { items, pagination: { hasMore: false } };\n};\n\n// Asset results never wait on the roster for longer than this; a slow roster\n// lands on a later keystroke, which reads the same pending request.\nconst TEAM_WAIT_MS = 1500;\n\nfunction withinTeamWait(members: Promise<MenuItem[]>): Promise<MenuItem[]> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n const timeout = new Promise<MenuItem[]>((resolve) => {\n timer = setTimeout(() => resolve([]), TEAM_WAIT_MS);\n });\n return Promise.race([members.catch(() => []), timeout]).finally(() =>\n clearTimeout(timer),\n );\n}\n\n/** The saved person assets Team lists, each with its person row. */\nfunction savedPeopleListedAsPeople(team: readonly MenuItem[]): ReadonlyMap<string, MenuItem> {\n const rows = new Map<string, MenuItem>();\n for (const item of team) {\n const assetId: unknown = item.extra?.[SAVED_PERSON_ASSET_ID_EXTRA];\n if (item.type === \"user\" && typeof assetId === \"string\") rows.set(assetId, item);\n }\n return rows;\n}\n\n/**\n * Drops the asset row of a saved person Team lists: one person is one row, the\n * person mention. A query only the asset answers (a pasted asset id) keeps the\n * asset row, since the person row cannot match it.\n */\nfunction withoutListedSavedPeople({\n items,\n listed,\n query,\n}: {\n items: MenuItem[];\n listed: ReadonlyMap<string, MenuItem>;\n query: string;\n}): MenuItem[] {\n if (listed.size === 0) return items;\n return items.filter((item) => {\n if (item.type === \"user\") return true;\n const person = listed.get(item.id);\n if (!person) return true;\n return (\n filterItems([item], query, \"global_search\").length > 0 &&\n filterItems([person], query, \"global_search\").length === 0\n );\n });\n}\n\n/**\n * Add the Team list to a root search's first page, so `@<name>` finds people\n * and groups beside assets (the cache filters them by the query), and drop the\n * asset row of a saved person Team lists, on every page. Like\n * `withProvidedTools`, `consumedCount` stays the server's row count so the\n * members never advance the asset offset; a failed member fetch leaves the\n * asset results alone.\n */\nexport function withTeam<TConfig>(\n source: SourceFn<TConfig>,\n loadTeam: TeamLoader,\n): SourceFn<TConfig> {\n // Members come from Athena: while it can't be reached, only what the wrapped source can list\n // without it stands in (a host's own tools).\n return keepOfflineItems(source, async (context) => {\n const meta = (context.fetchState.meta as FetchMetadata) || {};\n const isFirstPage = (meta.validatedCount || 0) === 0;\n const query = context.query?.trim() ?? \"\";\n const [result, team] = await Promise.all([\n source(context),\n query ? withinTeamWait(loadTeam()) : Promise.resolve([]),\n ]);\n if (team.length === 0) return result;\n const items = withoutListedSavedPeople({\n items: result.items,\n listed: savedPeopleListedAsPeople(team),\n query,\n });\n return {\n ...result,\n items: isFirstPage ? [...team, ...items] : items,\n pagination: {\n ...result.pagination,\n hasMore: result.pagination?.hasMore ?? false,\n consumedCount: result.pagination?.consumedCount ?? result.items.length,\n },\n };\n });\n}\n\n// ══════════════════════════════════════════════════════════════════════\n// TOOLS / TOOLKITS (Fetcher) — Mentionable tool catalog\n// ══════════════════════════════════════════════════════════════════════\n\nexport interface ToolCatalogConfig {\n auth: MentionAuthContext;\n}\n\n// getToolkitToToolsMapping is already filtered server-side for the\n// authenticated user (admin-only entries, beta allowlist, workspace registry),\n// so only mention/menu visibility is applied here.\nasync function queryToolCatalog(\n auth: MentionAuthContext,\n): Promise<ToolCatalogResult[\"getToolkitToToolsMapping\"]> {\n const data = await fetchGraphQL<ToolCatalogResult>(auth, TOOL_CATALOG_QUERY);\n return data.getToolkitToToolsMapping;\n}\n\nexport const fetchTools: SourceFn<ToolCatalogConfig> = async (context) => {\n const catalog = await queryToolCatalog(context.sourceConfig.auth);\n\n const items: MenuItem[] = catalog.tools\n .filter((tool) => tool.isMentionable)\n .map((tool) => ({\n id: tool.id,\n name: tool.name,\n type: \"tool\" as const,\n fallbackIcon: tool.icon,\n description: tool.description ?? undefined,\n visibleInScopes: new Set<string>(),\n ...(tool.adminOnly ? { extra: { isAdminOnly: true } } : {}),\n }));\n\n return { items, pagination: { hasMore: false } };\n};\n\nexport const fetchToolkits: SourceFn<ToolCatalogConfig> = async (context) => {\n const catalog = await queryToolCatalog(context.sourceConfig.auth);\n\n const items: MenuItem[] = catalog.toolkits\n .filter((toolkit) => toolkit.isMentionable && !toolkit.hideFromMenu)\n .map((toolkit) => ({\n id: toolkit.name,\n name: toolkit.displayName,\n type: \"toolkit\" as const,\n fallbackIcon: toolkit.icon,\n description: toolkit.description || undefined,\n visibleInScopes: new Set<string>(),\n ...(toolkit.onlyAdmin ? { extra: { isAdminOnly: true } } : {}),\n }));\n\n return { items, pagination: { hasMore: false } };\n};\n\n// ══════════════════════════════════════════════════════════════════════\n// DRIVES (Fetcher) — Drive catalog assets\n// ══════════════════════════════════════════════════════════════════════\n\nexport interface DrivesConfig {\n auth: MentionAuthContext;\n}\n\nexport const fetchDrives: SourceFn<DrivesConfig> = async (context) => {\n const { fetchState, sourceConfig } = context;\n const meta = (fetchState.meta as FetchMetadata) || {};\n const offset = meta.validatedCount || 0;\n\n const result = await querySimpleSearch(sourceConfig.auth, {\n limit: 50,\n offset,\n includeTypes: [\"catalog\"],\n });\n\n // Drive catalogs are navigation-only (navigate into them to see contents)\n const items: MenuItem[] = result.items.map((item) => ({\n ...item,\n type: \"drive_catalog\" as const,\n fallbackIcon: \"hard-drive\",\n isNavigationOnly: true,\n navigatesToScope: item.id,\n }));\n\n // Register folder contents source for each catalog\n const sources: SourceToRegister[] = items.map((item) => ({\n scope: item.id,\n sourceFn: fetchFolderContents,\n sourceConfig: { auth: sourceConfig.auth, limit: 50 },\n }));\n\n return {\n items,\n pagination: { hasMore: result.hasMore },\n sources,\n };\n};\n\n// ══════════════════════════════════════════════════════════════════════\n// GLOBAL SEARCH (Fetcher) — Aggregated search across all sources\n// ══════════════════════════════════════════════════════════════════════\n\nexport interface GlobalSearchConfig {\n auth: MentionAuthContext;\n}\n\nexport const fetchGlobalSearch: SourceFn<GlobalSearchConfig> = async (\n context,\n) => {\n const { query, fetchState, sourceConfig } = context;\n if (!query?.trim()) return { items: [], pagination: { hasMore: false } };\n\n const meta = (fetchState.meta as FetchMetadata) || {};\n const offset = meta.validatedCount || 0;\n\n const result = await querySimpleSearch(sourceConfig.auth, {\n query,\n limit: 50,\n offset,\n excludeTypes: [\"catalog\", \"session\"],\n });\n\n return {\n items: result.items,\n pagination: { hasMore: result.hasMore },\n };\n};\n\n// ══════════════════════════════════════════════════════════════════════\n// HOST-PROVIDED TOOLS (Transformer) — a host's own Tools / Toolkits list\n// ══════════════════════════════════════════════════════════════════════\n\nexport interface ProvidedToolsConfig {\n getTools: () => readonly MentionTool[];\n type: MentionTool[\"type\"];\n}\n\n/** Menu items for a host-provided tool list, in the host's order. */\nexport function providedToolMenuItems(\n tools: readonly MentionTool[],\n type?: MentionTool[\"type\"],\n): MenuItem[] {\n return tools\n .filter((tool) => type === undefined || tool.type === type)\n .map((tool) => ({\n id: tool.id,\n name: tool.name,\n type: tool.type,\n fallbackIcon: tool.icon ?? (tool.type === \"toolkit\" ? \"Package\" : \"Wrench\"),\n description: tool.description,\n visibleInScopes: new Set<string>(),\n }));\n}\n\nexport const transformProvidedTools: SourceFn<ProvidedToolsConfig> = async (\n context,\n) => ({\n items: providedToolMenuItems(\n context.sourceConfig.getTools(),\n context.sourceConfig.type,\n ),\n pagination: { hasMore: false },\n});\n\n/**\n * Prepend a host's tool list to another source's items so a root query matches\n * them the way it matches assets (the cache filters by query and sorts\n * toolkits first). The wrapped source's offset bookkeeping is preserved:\n * `consumedCount` stays the number of rows the server returned, so the added\n * items never advance the next page's offset.\n */\nexport function withProvidedTools<TConfig>(\n source: SourceFn<TConfig>,\n getTools: () => readonly MentionTool[],\n): SourceFn<TConfig> {\n const wrapped: SourceFn<TConfig> = async (context) => {\n const result = await source(context);\n return {\n ...result,\n items: [...providedToolMenuItems(getTools()), ...result.items],\n pagination: {\n ...result.pagination,\n hasMore: result.pagination?.hasMore ?? false,\n consumedCount: result.pagination?.consumedCount ?? result.items.length,\n },\n };\n };\n // The host's tools are the host's own: while Athena can't be reached, a search still finds them.\n OFFLINE_ITEMS.set(wrapped as SourceFn, () => providedToolMenuItems(getTools()));\n return wrapped;\n}\n\n/**\n * What a source that asks Athena can still list while Athena can't be reached: the host's own items\n * it carries (a host's tool list), by source. The source itself is never called then.\n */\nconst OFFLINE_ITEMS = new WeakMap<SourceFn, () => MenuItem[]>();\n\n/** `wrapped` keeps what `inner` lists without Athena (a wrapper that adds Athena's items alone). */\nfunction keepOfflineItems<TConfig>(\n inner: SourceFn<TConfig>,\n wrapped: SourceFn<TConfig>,\n): SourceFn<TConfig> {\n const offline = OFFLINE_ITEMS.get(inner as SourceFn);\n if (offline) OFFLINE_ITEMS.set(wrapped as SourceFn, offline);\n return wrapped;\n}\n\n/**\n * The host's own items a source asking Athena can still list while Athena can't be reached (a\n * root search's host tools), unfiltered; none for a source that holds no such items.\n */\nexport function offlineItemsOf(sourceFn: SourceFn): MenuItem[] {\n return OFFLINE_ITEMS.get(sourceFn)?.() ?? [];\n}\n\n// ══════════════════════════════════════════════════════════════════════\n// CHAT AGENTS (Transformer) — the agents a chat message can name\n// ══════════════════════════════════════════════════════════════════════\n\n/** Item ids stay apart from every other item's (asset ids, tool names) in the shared cache. */\nconst CHAT_AGENT_ITEM_ID_PREFIX = \"agent:\";\n\nexport interface ChatAgentsConfig {\n /** Reactive getter for the agents offered now. */\n getAgents: () => readonly MentionChatAgent[];\n}\n\n/**\n * The menu item that names `agent`: choosing it names the agent for the\n * message (a chip on the composer's To line) and never writes a mention into\n * the text.\n */\nexport function chatAgentMenuItem(agent: MentionChatAgent): MenuItem {\n return {\n id: `${CHAT_AGENT_ITEM_ID_PREFIX}${agent.ref}`,\n name: agent.name,\n type: \"agent\" as const,\n fallbackIcon: agent.icon || \"bot\",\n visibleInScopes: new Set<string>(),\n extra: { agentRef: agent.ref, agentAssetId: agent.assetId },\n };\n}\n\n/** The agent an `agent` item names, or `null` for any other item. */\nexport function chatAgentFromMenuItem(item: MenuItem): MentionChatAgent | null {\n if (item.type !== \"agent\") return null;\n const ref: unknown = item.extra?.agentRef;\n if (typeof ref !== \"string\" || !ref) return null;\n const assetId: unknown = item.extra?.agentAssetId;\n return {\n ref,\n name: item.name,\n assetId: typeof assetId === \"string\" && assetId ? assetId : null,\n icon: item.fallbackIcon,\n };\n}\n\n/**\n * The agents the composer offers (`MentionChatAgents.getAgents`): the person's\n * own assistant and the collab agents the agent picker lists, minus those\n * already named. agora checks every name a message carries, so nothing here\n * gates.\n */\nexport const transformChatAgents: SourceFn<ChatAgentsConfig> = async (context) => {\n const items = context.sourceConfig.getAgents().map(chatAgentMenuItem);\n return { items, pagination: { hasMore: false, totalCount: items.length } };\n};\n\n/**\n * Prepend the agents offered now to a root search, so typing an agent's name\n * after `@` finds it beside assets (the cache filters them by the query).\n * `consumedCount` stays the wrapped source's row count, so the agents never\n * advance the next page's offset. The agents are the host's own list: while\n * Athena can't be reached, a search still finds them.\n */\nexport function withChatAgents<TConfig>(\n source: SourceFn<TConfig>,\n getAgents: () => readonly MentionChatAgent[],\n): SourceFn<TConfig> {\n const wrapped: SourceFn<TConfig> = async (context) => {\n const result = await source(context);\n const agents = getAgents().map(chatAgentMenuItem);\n if (agents.length === 0) return result;\n return {\n ...result,\n items: [...agents, ...result.items],\n pagination: {\n ...result.pagination,\n hasMore: result.pagination?.hasMore ?? false,\n consumedCount: result.pagination?.consumedCount ?? result.items.length,\n },\n };\n };\n const inner = OFFLINE_ITEMS.get(source as SourceFn);\n OFFLINE_ITEMS.set(wrapped as SourceFn, () => [\n ...getAgents().map(chatAgentMenuItem),\n ...(inner?.() ?? []),\n ]);\n return wrapped;\n}\n\n// ══════════════════════════════════════════════════════════════════════\n// LOCAL SOURCES — what a scope can show while Athena can't be reached\n// ══════════════════════════════════════════════════════════════════════\n\n/**\n * The transformers: they read only what the host already holds (its tabs, its\n * own tool list, the agents it offers to name), so their scopes keep working\n * while Athena can't be reached.\n * Every other source asks Athena.\n */\nconst LOCAL_SOURCES: ReadonlySet<SourceFn> = new Set<SourceFn>([\n transformRootCategories,\n transformProvidedTools,\n transformChatAgents,\n]);\n\n/** Whether a scope's source asks Athena for its items (a fetcher, not a transformer). */\nexport function sourceAsksAthena(sourceFn: SourceFn): boolean {\n return !LOCAL_SOURCES.has(sourceFn);\n}\n"],"names":[],"mappings":";;;;AA0CA,SAAS,gBAAgB,OAA8B;AACrD,QAAM,WAAW,MAAM,uBAAuB;AAC9C,QAAM,cAAc,MAAM,uBAAuB,MAAM;AACvD,SAAO;AAAA,IACL,IAAI,MAAM;AAAA,IACV,MAAM,MAAM,SAAS;AAAA,IACrB,MAAM,WAAW,WAAW;AAAA,IAC5B,cAAc,iBAAiB,WAAW;AAAA,IAC1C,cAAc,gBAAgB,WAAW;AAAA,IACzC,kBAAkB,WAAW,MAAM,KAAK;AAAA,IACxC,qCAAqB,IAAA;AAAA,IACrB,WAAW,MAAM,aAAa;AAAA,IAC9B,OAAO;AAAA,MACL,oBAAoB,MAAM;AAAA,MAC1B,qBAAqB,MAAM;AAAA,MAC3B,gBAAgB,MAAM;AAAA,IAAA;AAAA,EACxB;AAEJ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,IAAc;AAAA,EAC7D;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGM,SAAS,iBAAiB,UAA6B;AAC5D,SAAO,CAAC,cAAc,IAAI,QAAQ;AACpC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","sources":["../../../../../src/chat-ui/mentions/suggestions/data/types.ts"],"sourcesContent":["/**\n * Core types for mention suggestions data layer\n */\n\n/**\n * MenuScope - A navigable container in the mention menu hierarchy\n *\n * Conceptual model:\n * - SCOPE = Container/Group you navigate INTO (e.g., \"athena_assets\", \"folder_123\")\n * - ITEM = Individual mentionable thing you SELECT (e.g., specific asset, tool)\n *\n * Scopes form a navigation hierarchy:\n * root → athena_assets → folder_123 → subfolder_456\n *\n * Items can be visible in multiple scopes simultaneously:\n * Asset \"Report.pdf\" is in both \"folder_123\" AND \"asset_search\" results\n */\nexport type MenuScope = string;\n\nexport const MentionMenuSection = {\n CURRENT_WEBPAGE: \"current-webpage\",\n OTHER_WEBPAGES: \"other-webpages\",\n LIBRARY: \"library\",\n} as const;\n\nexport type MentionMenuSection =\n (typeof MentionMenuSection)[keyof typeof MentionMenuSection];\n\nexport interface WebpageMention {\n tabId: number;\n title: string;\n url: string;\n isCurrent: boolean;\n}\n\nexport interface WebpageMentionScope {\n primaryTabId: number;\n tabGroupId: number | null;\n allowedTabIds: readonly number[];\n}\n\n/**\n * Selector result - provides current state + loading indicators\n * Used by the UI to get immediate access to data and loading state\n */\nexport interface MenuItemsSelector {\n items: MenuItem[];\n isFetching: boolean;\n hasMore: boolean;\n}\n\n/**\n * MenuItem - individual mentionable item\n * Icon fields match MentionIcon component props exactly - no transforms needed at render time!\n *\n * Multi-scope system: Items can belong to multiple scopes simultaneously\n * Example: An asset can be visible in 'athena_assets', 'folder_123', and 'my_spaces'\n */\nexport interface MenuItem {\n id: string;\n name: string;\n type:\n | 'menu'\n | 'asset'\n | 'folder'\n | 'tool'\n | 'toolkit'\n | 'drive'\n | 'user'\n | 'task'\n | 'tab'\n | 'workspace_item'\n | 'drive_catalog'\n | 'placeholder';\n\n // Icon fields (match MentionIcon component props)\n thumbnailUrl?: string; // For assets: URL/path to thumbnail (e.g., from AthenaTypeToThumb)\n fallbackIcon: string; // For menus/tools: Lucide icon name (e.g., 'Folder', 'Wrench') or emoji\n\n // Multi-scope membership: Which menu scopes this item is visible in\n // Items can belong to multiple scopes simultaneously\n visibleInScopes: Set<MenuScope>; // e.g., Set(['athena_assets', 'folder_123', 'my_spaces'])\n\n // Navigation capability: If present, this item can be navigated into\n // When user selects this item, navigate to this scope\n navigatesToScope?: MenuScope;\n\n // Navigation-only flag: If true, item CANNOT be inserted as mention (only navigate)\n // Use for root categories that are pure navigation containers\n isNavigationOnly?: boolean; // Default: false (most items are mentionable)\n\n // Type-specific metadata\n extra?: Record<string, any>;\n description?: string;\n url?: string;\n menuSection?: MentionMenuSection;\n updatedAt?: string;\n email?: string; // For user type\n version?: string; // For versioned assets\n\n // Legacy compatibility\n parentMenuId?: string;\n}\n\n/**\n * FetchState - fetch status and pagination state for a specific query\n * Managed by orchestrator, not returned by sources\n */\nexport interface FetchState {\n isFetching: boolean;\n hasNextPage: boolean;\n fetchNext: (() => void) | null;\n error: Error | null; // Track errors to prevent infinite retry loops\n\n // Source-specific pagination metadata (offset, cursor, page token, etc.)\n // Each source stores what IT needs between calls\n // Orchestrator doesn't care what's in here!\n meta: unknown;\n}\n\n/**\n * FetchMetadata - Common metadata fields used by orchestrator\n * Sources can extend this with their own fields (e.g., pageToken, cursor)\n */\nexport interface FetchMetadata {\n // Orchestrator fields\n validatedCount?: number; // Number of items fetched and validated so far\n fetchAttempts?: number; // Number of fetch attempts (for safety limits)\n // Source-specific fields can be added via extension or intersection\n [key: string]: unknown;\n}\n\n/**\n * New source to register dynamically\n * Returned by sources when they discover navigable items (folders, catalogs, etc.)\n */\nexport interface SourceToRegister {\n scope: MenuScope; // The scope ID to register\n sourceFn: SourceFn; // The source function to use for this scope\n sourceConfig?: any; // Configuration for the source\n isFlat?: boolean; // Whether this scope should be flat (no navigation arrows)\n}\n\n/**\n * Scope binding to register dynamically\n * Binds a browse scope to a search scope (hot scope swap on query)\n */\nexport interface ScopeBindingToRegister {\n browseScope: MenuScope; // The scope shown when browsing (no query)\n searchScope: MenuScope; // The scope shown when searching (has query)\n}\n\n/**\n * Source result - returned by all source functions\n *\n * Sources come in two flavors:\n * 1. TRANSFORMERS - Transform existing data (no API calls)\n * Examples: tools, toolkits, workspace members, opened spaces\n * Pattern: Read from store/ref → transform → return items\n *\n * 2. FETCHERS - Fetch from API (async operations)\n * Examples: internal assets, folders, SharePoint items\n * Pattern: Call GraphQL/REST → transform response → return items\n *\n * 3. HYBRID - Behavior depends on query\n * Example: Root menu (transformer when no query, fetcher with query)\n *\n * Original design: Sources can return new sources to register!\n * This allows discovered items (folders, catalogs) to be dynamically registered\n * without circular dependencies (orchestrator handles registration centrally)\n */\nexport interface SourceResult {\n // Items to add/update (source sets navigatesToScope on navigable items)\n // Orchestrator will tag these items with the current scope\n items: MenuItem[];\n\n // Pagination metadata (what we learned from this fetch)\n // All sources return this - orchestrator uses it\n pagination?: {\n hasMore: boolean;\n totalCount?: number;\n // Rows the source consumed from the server for this page. Defaults to\n // `items.length`; sources that drop rows after fetching must report the\n // pre-filter count so the next offset does not re-read the same rows.\n consumedCount?: number;\n };\n\n // Source-specific metadata (e.g., pageToken for SharePoint, cursor for pagination)\n // Orchestrator merges this into fetchState.meta for the next fetch\n meta?: Record<string, unknown>;\n\n // New sources to register (for discovered navigable items)\n // Orchestrator will register these in the registry\n sources?: SourceToRegister[];\n\n // New bindings to register (for hot scope swap on query)\n // Example: catalogId → catalogId_search\n bindings?: ScopeBindingToRegister[];\n}\n\n/**\n * Source function context\n *\n * Sources are pure functions - just fetch/transform and return items!\n * Orchestrator handles sync/deduplication via Cache.addItems() with scope tagging\n */\nexport interface SourceContext<TConfig = any> {\n scope: MenuScope; // Current scope we're fetching for\n query: string; // User's search query\n fetchState: FetchState; // Pagination state for this query (includes source-specific meta)\n sourceConfig: TConfig; // Source configuration (can include getters for reactive data!)\n}\n\n/**\n * Source function type\n *\n * Pure function that provides items for a scope + query combination.\n * Can be a transformer (reads from store) or fetcher (calls API).\n * State (pagination, sourceConfig) is stored externally in registry entry.\n */\nexport type SourceFn<TConfig = any> = (context: SourceContext<TConfig>) => Promise<SourceResult>;\n\n/**\n * A host-provided candidate for the Tools / Toolkits categories. A host that\n * hands the composer a list of these replaces the server tool catalog for\n * those categories with its own (AthenaChat offers the toolkits its provider\n * enabled, or whatever the host passes through `mentionTools`).\n */\nexport interface MentionTool {\n id: string;\n name: string;\n description?: string;\n /** Lucide icon name (`Package`, `Wrench`, …) or an emoji. */\n icon?: string;\n type: 'tool' | 'toolkit';\n}\n"],"names":[],"mappings":";;AAmBO,MAAM,qBAAqB;AAAA,EAChC,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,SAAS;AACX;;"}
1
+ {"version":3,"file":"types.cjs","sources":["../../../../../src/chat-ui/mentions/suggestions/data/types.ts"],"sourcesContent":["/**\n * Core types for mention suggestions data layer\n */\n\n/**\n * MenuScope - A navigable container in the mention menu hierarchy\n *\n * Conceptual model:\n * - SCOPE = Container/Group you navigate INTO (e.g., \"athena_assets\", \"folder_123\")\n * - ITEM = Individual mentionable thing you SELECT (e.g., specific asset, tool)\n *\n * Scopes form a navigation hierarchy:\n * root → athena_assets → folder_123 → subfolder_456\n *\n * Items can be visible in multiple scopes simultaneously:\n * Asset \"Report.pdf\" is in both \"folder_123\" AND \"asset_search\" results\n */\nexport type MenuScope = string;\n\nexport const MentionMenuSection = {\n CURRENT_WEBPAGE: \"current-webpage\",\n OTHER_WEBPAGES: \"other-webpages\",\n LIBRARY: \"library\",\n} as const;\n\nexport type MentionMenuSection =\n (typeof MentionMenuSection)[keyof typeof MentionMenuSection];\n\nexport interface WebpageMention {\n tabId: number;\n title: string;\n url: string;\n isCurrent: boolean;\n}\n\nexport interface WebpageMentionScope {\n primaryTabId: number;\n tabGroupId: number | null;\n allowedTabIds: readonly number[];\n}\n\n/**\n * Selector result - provides current state + loading indicators\n * Used by the UI to get immediate access to data and loading state\n */\nexport interface MenuItemsSelector {\n items: MenuItem[];\n isFetching: boolean;\n hasMore: boolean;\n}\n\n/**\n * MenuItem - individual mentionable item\n * Icon fields match MentionIcon component props exactly - no transforms needed at render time!\n *\n * Multi-scope system: Items can belong to multiple scopes simultaneously\n * Example: An asset can be visible in 'athena_assets', 'folder_123', and 'my_spaces'\n */\nexport interface MenuItem {\n id: string;\n name: string;\n type:\n | 'menu'\n | 'asset'\n | 'folder'\n | 'tool'\n | 'toolkit'\n | 'drive'\n | 'user'\n | 'group'\n | 'agent'\n | 'task'\n | 'tab'\n | 'workspace_item'\n | 'drive_catalog'\n | 'placeholder';\n\n // Icon fields (match MentionIcon component props)\n thumbnailUrl?: string; // For assets: URL/path to thumbnail (e.g., from AthenaTypeToThumb)\n fallbackIcon: string; // For menus/tools: Lucide icon name (e.g., 'Folder', 'Wrench') or emoji\n\n // Multi-scope membership: Which menu scopes this item is visible in\n // Items can belong to multiple scopes simultaneously\n visibleInScopes: Set<MenuScope>; // e.g., Set(['athena_assets', 'folder_123', 'my_spaces'])\n\n // Navigation capability: If present, this item can be navigated into\n // When user selects this item, navigate to this scope\n navigatesToScope?: MenuScope;\n\n // Navigation-only flag: If true, item CANNOT be inserted as mention (only navigate)\n // Use for root categories that are pure navigation containers\n isNavigationOnly?: boolean; // Default: false (most items are mentionable)\n\n // Type-specific metadata\n extra?: Record<string, any>;\n description?: string;\n url?: string;\n menuSection?: MentionMenuSection;\n updatedAt?: string;\n email?: string; // For user type\n version?: string; // For versioned assets\n\n // Legacy compatibility\n parentMenuId?: string;\n}\n\n/**\n * FetchState - fetch status and pagination state for a specific query\n * Managed by orchestrator, not returned by sources\n */\nexport interface FetchState {\n isFetching: boolean;\n hasNextPage: boolean;\n fetchNext: (() => void) | null;\n error: Error | null; // Track errors to prevent infinite retry loops\n\n // Source-specific pagination metadata (offset, cursor, page token, etc.)\n // Each source stores what IT needs between calls\n // Orchestrator doesn't care what's in here!\n meta: unknown;\n}\n\n/**\n * FetchMetadata - Common metadata fields used by orchestrator\n * Sources can extend this with their own fields (e.g., pageToken, cursor)\n */\nexport interface FetchMetadata {\n // Orchestrator fields\n validatedCount?: number; // Number of items fetched and validated so far\n fetchAttempts?: number; // Number of fetch attempts (for safety limits)\n // Source-specific fields can be added via extension or intersection\n [key: string]: unknown;\n}\n\n/**\n * New source to register dynamically\n * Returned by sources when they discover navigable items (folders, catalogs, etc.)\n */\nexport interface SourceToRegister {\n scope: MenuScope; // The scope ID to register\n sourceFn: SourceFn; // The source function to use for this scope\n sourceConfig?: any; // Configuration for the source\n isFlat?: boolean; // Whether this scope should be flat (no navigation arrows)\n}\n\n/**\n * Scope binding to register dynamically\n * Binds a browse scope to a search scope (hot scope swap on query)\n */\nexport interface ScopeBindingToRegister {\n browseScope: MenuScope; // The scope shown when browsing (no query)\n searchScope: MenuScope; // The scope shown when searching (has query)\n}\n\n/**\n * Source result - returned by all source functions\n *\n * Sources come in two flavors:\n * 1. TRANSFORMERS - Transform existing data (no API calls)\n * Examples: tools, toolkits, workspace members, opened spaces\n * Pattern: Read from store/ref → transform → return items\n *\n * 2. FETCHERS - Fetch from API (async operations)\n * Examples: internal assets, folders, SharePoint items\n * Pattern: Call GraphQL/REST → transform response → return items\n *\n * 3. HYBRID - Behavior depends on query\n * Example: Root menu (transformer when no query, fetcher with query)\n *\n * Original design: Sources can return new sources to register!\n * This allows discovered items (folders, catalogs) to be dynamically registered\n * without circular dependencies (orchestrator handles registration centrally)\n */\nexport interface SourceResult {\n // Items to add/update (source sets navigatesToScope on navigable items)\n // Orchestrator will tag these items with the current scope\n items: MenuItem[];\n\n // Pagination metadata (what we learned from this fetch)\n // All sources return this - orchestrator uses it\n pagination?: {\n hasMore: boolean;\n totalCount?: number;\n // Rows the source consumed from the server for this page. Defaults to\n // `items.length`; sources that drop rows after fetching must report the\n // pre-filter count so the next offset does not re-read the same rows.\n consumedCount?: number;\n };\n\n // Source-specific metadata (e.g., pageToken for SharePoint, cursor for pagination)\n // Orchestrator merges this into fetchState.meta for the next fetch\n meta?: Record<string, unknown>;\n\n // New sources to register (for discovered navigable items)\n // Orchestrator will register these in the registry\n sources?: SourceToRegister[];\n\n // New bindings to register (for hot scope swap on query)\n // Example: catalogId → catalogId_search\n bindings?: ScopeBindingToRegister[];\n}\n\n/**\n * Source function context\n *\n * Sources are pure functions - just fetch/transform and return items!\n * Orchestrator handles sync/deduplication via Cache.addItems() with scope tagging\n */\nexport interface SourceContext<TConfig = any> {\n scope: MenuScope; // Current scope we're fetching for\n query: string; // User's search query\n fetchState: FetchState; // Pagination state for this query (includes source-specific meta)\n sourceConfig: TConfig; // Source configuration (can include getters for reactive data!)\n}\n\n/**\n * Source function type\n *\n * Pure function that provides items for a scope + query combination.\n * Can be a transformer (reads from store) or fetcher (calls API).\n * State (pagination, sourceConfig) is stored externally in registry entry.\n */\nexport type SourceFn<TConfig = any> = (context: SourceContext<TConfig>) => Promise<SourceResult>;\n\n/**\n * An agent a chat message can name (identity v7 D13), as the `@` menu's Agents section offers it:\n * choosing one names it for the message (a chip on the composer's To line) and never writes a\n * mention into the text. `ref` is what the send names (`collab_agent:<asset id>`, or `assistant`\n * for the person's own assistant).\n */\nexport interface MentionChatAgent {\n ref: string;\n name: string;\n /** The collab agent asset behind `ref`; `null` for the person's own assistant. */\n assetId: string | null;\n /** A Lucide icon name for the menu row. */\n icon: string;\n}\n\n/**\n * What a composer that names agents hands its `@` menu (`TiptapComposer`'s `chatAgents`): the\n * agents offered now, naming what is chosen, and a way to hear the offer change.\n */\nexport interface MentionChatAgents {\n /** The agents the Agents section offers now (none once eight are named). */\n getAgents: () => readonly MentionChatAgent[];\n /** Name `agents` for the message, in the order chosen. */\n nameAgents: (agents: readonly MentionChatAgent[]) => void;\n /** Called whenever {@link MentionChatAgents.getAgents} would answer differently. */\n subscribe: (listener: () => void) => () => void;\n}\n\n/**\n * A host-provided candidate for the Tools / Toolkits categories. A host that\n * hands the composer a list of these replaces the server tool catalog for\n * those categories with its own (AthenaChat offers the toolkits its provider\n * enabled, or whatever the host passes through `mentionTools`).\n */\nexport interface MentionTool {\n id: string;\n name: string;\n description?: string;\n /** Lucide icon name (`Package`, `Wrench`, …) or an emoji. */\n icon?: string;\n type: 'tool' | 'toolkit';\n}\n"],"names":[],"mappings":";;AAmBO,MAAM,qBAAqB;AAAA,EAChC,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,SAAS;AACX;;"}
@@ -51,7 +51,7 @@ export interface MenuItemsSelector {
51
51
  export interface MenuItem {
52
52
  id: string;
53
53
  name: string;
54
- type: 'menu' | 'asset' | 'folder' | 'tool' | 'toolkit' | 'drive' | 'user' | 'task' | 'tab' | 'workspace_item' | 'drive_catalog' | 'placeholder';
54
+ type: 'menu' | 'asset' | 'folder' | 'tool' | 'toolkit' | 'drive' | 'user' | 'group' | 'agent' | 'task' | 'tab' | 'workspace_item' | 'drive_catalog' | 'placeholder';
55
55
  thumbnailUrl?: string;
56
56
  fallbackIcon: string;
57
57
  visibleInScopes: Set<MenuScope>;
@@ -154,6 +154,32 @@ export interface SourceContext<TConfig = any> {
154
154
  * State (pagination, sourceConfig) is stored externally in registry entry.
155
155
  */
156
156
  export type SourceFn<TConfig = any> = (context: SourceContext<TConfig>) => Promise<SourceResult>;
157
+ /**
158
+ * An agent a chat message can name (identity v7 D13), as the `@` menu's Agents section offers it:
159
+ * choosing one names it for the message (a chip on the composer's To line) and never writes a
160
+ * mention into the text. `ref` is what the send names (`collab_agent:<asset id>`, or `assistant`
161
+ * for the person's own assistant).
162
+ */
163
+ export interface MentionChatAgent {
164
+ ref: string;
165
+ name: string;
166
+ /** The collab agent asset behind `ref`; `null` for the person's own assistant. */
167
+ assetId: string | null;
168
+ /** A Lucide icon name for the menu row. */
169
+ icon: string;
170
+ }
171
+ /**
172
+ * What a composer that names agents hands its `@` menu (`TiptapComposer`'s `chatAgents`): the
173
+ * agents offered now, naming what is chosen, and a way to hear the offer change.
174
+ */
175
+ export interface MentionChatAgents {
176
+ /** The agents the Agents section offers now (none once eight are named). */
177
+ getAgents: () => readonly MentionChatAgent[];
178
+ /** Name `agents` for the message, in the order chosen. */
179
+ nameAgents: (agents: readonly MentionChatAgent[]) => void;
180
+ /** Called whenever {@link MentionChatAgents.getAgents} would answer differently. */
181
+ subscribe: (listener: () => void) => () => void;
182
+ }
157
183
  /**
158
184
  * A host-provided candidate for the Tools / Toolkits categories. A host that
159
185
  * hands the composer a list of these replaces the server tool catalog for
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../../../../../src/chat-ui/mentions/suggestions/data/types.ts"],"sourcesContent":["/**\n * Core types for mention suggestions data layer\n */\n\n/**\n * MenuScope - A navigable container in the mention menu hierarchy\n *\n * Conceptual model:\n * - SCOPE = Container/Group you navigate INTO (e.g., \"athena_assets\", \"folder_123\")\n * - ITEM = Individual mentionable thing you SELECT (e.g., specific asset, tool)\n *\n * Scopes form a navigation hierarchy:\n * root → athena_assets → folder_123 → subfolder_456\n *\n * Items can be visible in multiple scopes simultaneously:\n * Asset \"Report.pdf\" is in both \"folder_123\" AND \"asset_search\" results\n */\nexport type MenuScope = string;\n\nexport const MentionMenuSection = {\n CURRENT_WEBPAGE: \"current-webpage\",\n OTHER_WEBPAGES: \"other-webpages\",\n LIBRARY: \"library\",\n} as const;\n\nexport type MentionMenuSection =\n (typeof MentionMenuSection)[keyof typeof MentionMenuSection];\n\nexport interface WebpageMention {\n tabId: number;\n title: string;\n url: string;\n isCurrent: boolean;\n}\n\nexport interface WebpageMentionScope {\n primaryTabId: number;\n tabGroupId: number | null;\n allowedTabIds: readonly number[];\n}\n\n/**\n * Selector result - provides current state + loading indicators\n * Used by the UI to get immediate access to data and loading state\n */\nexport interface MenuItemsSelector {\n items: MenuItem[];\n isFetching: boolean;\n hasMore: boolean;\n}\n\n/**\n * MenuItem - individual mentionable item\n * Icon fields match MentionIcon component props exactly - no transforms needed at render time!\n *\n * Multi-scope system: Items can belong to multiple scopes simultaneously\n * Example: An asset can be visible in 'athena_assets', 'folder_123', and 'my_spaces'\n */\nexport interface MenuItem {\n id: string;\n name: string;\n type:\n | 'menu'\n | 'asset'\n | 'folder'\n | 'tool'\n | 'toolkit'\n | 'drive'\n | 'user'\n | 'task'\n | 'tab'\n | 'workspace_item'\n | 'drive_catalog'\n | 'placeholder';\n\n // Icon fields (match MentionIcon component props)\n thumbnailUrl?: string; // For assets: URL/path to thumbnail (e.g., from AthenaTypeToThumb)\n fallbackIcon: string; // For menus/tools: Lucide icon name (e.g., 'Folder', 'Wrench') or emoji\n\n // Multi-scope membership: Which menu scopes this item is visible in\n // Items can belong to multiple scopes simultaneously\n visibleInScopes: Set<MenuScope>; // e.g., Set(['athena_assets', 'folder_123', 'my_spaces'])\n\n // Navigation capability: If present, this item can be navigated into\n // When user selects this item, navigate to this scope\n navigatesToScope?: MenuScope;\n\n // Navigation-only flag: If true, item CANNOT be inserted as mention (only navigate)\n // Use for root categories that are pure navigation containers\n isNavigationOnly?: boolean; // Default: false (most items are mentionable)\n\n // Type-specific metadata\n extra?: Record<string, any>;\n description?: string;\n url?: string;\n menuSection?: MentionMenuSection;\n updatedAt?: string;\n email?: string; // For user type\n version?: string; // For versioned assets\n\n // Legacy compatibility\n parentMenuId?: string;\n}\n\n/**\n * FetchState - fetch status and pagination state for a specific query\n * Managed by orchestrator, not returned by sources\n */\nexport interface FetchState {\n isFetching: boolean;\n hasNextPage: boolean;\n fetchNext: (() => void) | null;\n error: Error | null; // Track errors to prevent infinite retry loops\n\n // Source-specific pagination metadata (offset, cursor, page token, etc.)\n // Each source stores what IT needs between calls\n // Orchestrator doesn't care what's in here!\n meta: unknown;\n}\n\n/**\n * FetchMetadata - Common metadata fields used by orchestrator\n * Sources can extend this with their own fields (e.g., pageToken, cursor)\n */\nexport interface FetchMetadata {\n // Orchestrator fields\n validatedCount?: number; // Number of items fetched and validated so far\n fetchAttempts?: number; // Number of fetch attempts (for safety limits)\n // Source-specific fields can be added via extension or intersection\n [key: string]: unknown;\n}\n\n/**\n * New source to register dynamically\n * Returned by sources when they discover navigable items (folders, catalogs, etc.)\n */\nexport interface SourceToRegister {\n scope: MenuScope; // The scope ID to register\n sourceFn: SourceFn; // The source function to use for this scope\n sourceConfig?: any; // Configuration for the source\n isFlat?: boolean; // Whether this scope should be flat (no navigation arrows)\n}\n\n/**\n * Scope binding to register dynamically\n * Binds a browse scope to a search scope (hot scope swap on query)\n */\nexport interface ScopeBindingToRegister {\n browseScope: MenuScope; // The scope shown when browsing (no query)\n searchScope: MenuScope; // The scope shown when searching (has query)\n}\n\n/**\n * Source result - returned by all source functions\n *\n * Sources come in two flavors:\n * 1. TRANSFORMERS - Transform existing data (no API calls)\n * Examples: tools, toolkits, workspace members, opened spaces\n * Pattern: Read from store/ref → transform → return items\n *\n * 2. FETCHERS - Fetch from API (async operations)\n * Examples: internal assets, folders, SharePoint items\n * Pattern: Call GraphQL/REST → transform response → return items\n *\n * 3. HYBRID - Behavior depends on query\n * Example: Root menu (transformer when no query, fetcher with query)\n *\n * Original design: Sources can return new sources to register!\n * This allows discovered items (folders, catalogs) to be dynamically registered\n * without circular dependencies (orchestrator handles registration centrally)\n */\nexport interface SourceResult {\n // Items to add/update (source sets navigatesToScope on navigable items)\n // Orchestrator will tag these items with the current scope\n items: MenuItem[];\n\n // Pagination metadata (what we learned from this fetch)\n // All sources return this - orchestrator uses it\n pagination?: {\n hasMore: boolean;\n totalCount?: number;\n // Rows the source consumed from the server for this page. Defaults to\n // `items.length`; sources that drop rows after fetching must report the\n // pre-filter count so the next offset does not re-read the same rows.\n consumedCount?: number;\n };\n\n // Source-specific metadata (e.g., pageToken for SharePoint, cursor for pagination)\n // Orchestrator merges this into fetchState.meta for the next fetch\n meta?: Record<string, unknown>;\n\n // New sources to register (for discovered navigable items)\n // Orchestrator will register these in the registry\n sources?: SourceToRegister[];\n\n // New bindings to register (for hot scope swap on query)\n // Example: catalogId → catalogId_search\n bindings?: ScopeBindingToRegister[];\n}\n\n/**\n * Source function context\n *\n * Sources are pure functions - just fetch/transform and return items!\n * Orchestrator handles sync/deduplication via Cache.addItems() with scope tagging\n */\nexport interface SourceContext<TConfig = any> {\n scope: MenuScope; // Current scope we're fetching for\n query: string; // User's search query\n fetchState: FetchState; // Pagination state for this query (includes source-specific meta)\n sourceConfig: TConfig; // Source configuration (can include getters for reactive data!)\n}\n\n/**\n * Source function type\n *\n * Pure function that provides items for a scope + query combination.\n * Can be a transformer (reads from store) or fetcher (calls API).\n * State (pagination, sourceConfig) is stored externally in registry entry.\n */\nexport type SourceFn<TConfig = any> = (context: SourceContext<TConfig>) => Promise<SourceResult>;\n\n/**\n * A host-provided candidate for the Tools / Toolkits categories. A host that\n * hands the composer a list of these replaces the server tool catalog for\n * those categories with its own (AthenaChat offers the toolkits its provider\n * enabled, or whatever the host passes through `mentionTools`).\n */\nexport interface MentionTool {\n id: string;\n name: string;\n description?: string;\n /** Lucide icon name (`Package`, `Wrench`, …) or an emoji. */\n icon?: string;\n type: 'tool' | 'toolkit';\n}\n"],"names":[],"mappings":"AAmBO,MAAM,qBAAqB;AAAA,EAChC,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,SAAS;AACX;"}
1
+ {"version":3,"file":"types.js","sources":["../../../../../src/chat-ui/mentions/suggestions/data/types.ts"],"sourcesContent":["/**\n * Core types for mention suggestions data layer\n */\n\n/**\n * MenuScope - A navigable container in the mention menu hierarchy\n *\n * Conceptual model:\n * - SCOPE = Container/Group you navigate INTO (e.g., \"athena_assets\", \"folder_123\")\n * - ITEM = Individual mentionable thing you SELECT (e.g., specific asset, tool)\n *\n * Scopes form a navigation hierarchy:\n * root → athena_assets → folder_123 → subfolder_456\n *\n * Items can be visible in multiple scopes simultaneously:\n * Asset \"Report.pdf\" is in both \"folder_123\" AND \"asset_search\" results\n */\nexport type MenuScope = string;\n\nexport const MentionMenuSection = {\n CURRENT_WEBPAGE: \"current-webpage\",\n OTHER_WEBPAGES: \"other-webpages\",\n LIBRARY: \"library\",\n} as const;\n\nexport type MentionMenuSection =\n (typeof MentionMenuSection)[keyof typeof MentionMenuSection];\n\nexport interface WebpageMention {\n tabId: number;\n title: string;\n url: string;\n isCurrent: boolean;\n}\n\nexport interface WebpageMentionScope {\n primaryTabId: number;\n tabGroupId: number | null;\n allowedTabIds: readonly number[];\n}\n\n/**\n * Selector result - provides current state + loading indicators\n * Used by the UI to get immediate access to data and loading state\n */\nexport interface MenuItemsSelector {\n items: MenuItem[];\n isFetching: boolean;\n hasMore: boolean;\n}\n\n/**\n * MenuItem - individual mentionable item\n * Icon fields match MentionIcon component props exactly - no transforms needed at render time!\n *\n * Multi-scope system: Items can belong to multiple scopes simultaneously\n * Example: An asset can be visible in 'athena_assets', 'folder_123', and 'my_spaces'\n */\nexport interface MenuItem {\n id: string;\n name: string;\n type:\n | 'menu'\n | 'asset'\n | 'folder'\n | 'tool'\n | 'toolkit'\n | 'drive'\n | 'user'\n | 'group'\n | 'agent'\n | 'task'\n | 'tab'\n | 'workspace_item'\n | 'drive_catalog'\n | 'placeholder';\n\n // Icon fields (match MentionIcon component props)\n thumbnailUrl?: string; // For assets: URL/path to thumbnail (e.g., from AthenaTypeToThumb)\n fallbackIcon: string; // For menus/tools: Lucide icon name (e.g., 'Folder', 'Wrench') or emoji\n\n // Multi-scope membership: Which menu scopes this item is visible in\n // Items can belong to multiple scopes simultaneously\n visibleInScopes: Set<MenuScope>; // e.g., Set(['athena_assets', 'folder_123', 'my_spaces'])\n\n // Navigation capability: If present, this item can be navigated into\n // When user selects this item, navigate to this scope\n navigatesToScope?: MenuScope;\n\n // Navigation-only flag: If true, item CANNOT be inserted as mention (only navigate)\n // Use for root categories that are pure navigation containers\n isNavigationOnly?: boolean; // Default: false (most items are mentionable)\n\n // Type-specific metadata\n extra?: Record<string, any>;\n description?: string;\n url?: string;\n menuSection?: MentionMenuSection;\n updatedAt?: string;\n email?: string; // For user type\n version?: string; // For versioned assets\n\n // Legacy compatibility\n parentMenuId?: string;\n}\n\n/**\n * FetchState - fetch status and pagination state for a specific query\n * Managed by orchestrator, not returned by sources\n */\nexport interface FetchState {\n isFetching: boolean;\n hasNextPage: boolean;\n fetchNext: (() => void) | null;\n error: Error | null; // Track errors to prevent infinite retry loops\n\n // Source-specific pagination metadata (offset, cursor, page token, etc.)\n // Each source stores what IT needs between calls\n // Orchestrator doesn't care what's in here!\n meta: unknown;\n}\n\n/**\n * FetchMetadata - Common metadata fields used by orchestrator\n * Sources can extend this with their own fields (e.g., pageToken, cursor)\n */\nexport interface FetchMetadata {\n // Orchestrator fields\n validatedCount?: number; // Number of items fetched and validated so far\n fetchAttempts?: number; // Number of fetch attempts (for safety limits)\n // Source-specific fields can be added via extension or intersection\n [key: string]: unknown;\n}\n\n/**\n * New source to register dynamically\n * Returned by sources when they discover navigable items (folders, catalogs, etc.)\n */\nexport interface SourceToRegister {\n scope: MenuScope; // The scope ID to register\n sourceFn: SourceFn; // The source function to use for this scope\n sourceConfig?: any; // Configuration for the source\n isFlat?: boolean; // Whether this scope should be flat (no navigation arrows)\n}\n\n/**\n * Scope binding to register dynamically\n * Binds a browse scope to a search scope (hot scope swap on query)\n */\nexport interface ScopeBindingToRegister {\n browseScope: MenuScope; // The scope shown when browsing (no query)\n searchScope: MenuScope; // The scope shown when searching (has query)\n}\n\n/**\n * Source result - returned by all source functions\n *\n * Sources come in two flavors:\n * 1. TRANSFORMERS - Transform existing data (no API calls)\n * Examples: tools, toolkits, workspace members, opened spaces\n * Pattern: Read from store/ref → transform → return items\n *\n * 2. FETCHERS - Fetch from API (async operations)\n * Examples: internal assets, folders, SharePoint items\n * Pattern: Call GraphQL/REST → transform response → return items\n *\n * 3. HYBRID - Behavior depends on query\n * Example: Root menu (transformer when no query, fetcher with query)\n *\n * Original design: Sources can return new sources to register!\n * This allows discovered items (folders, catalogs) to be dynamically registered\n * without circular dependencies (orchestrator handles registration centrally)\n */\nexport interface SourceResult {\n // Items to add/update (source sets navigatesToScope on navigable items)\n // Orchestrator will tag these items with the current scope\n items: MenuItem[];\n\n // Pagination metadata (what we learned from this fetch)\n // All sources return this - orchestrator uses it\n pagination?: {\n hasMore: boolean;\n totalCount?: number;\n // Rows the source consumed from the server for this page. Defaults to\n // `items.length`; sources that drop rows after fetching must report the\n // pre-filter count so the next offset does not re-read the same rows.\n consumedCount?: number;\n };\n\n // Source-specific metadata (e.g., pageToken for SharePoint, cursor for pagination)\n // Orchestrator merges this into fetchState.meta for the next fetch\n meta?: Record<string, unknown>;\n\n // New sources to register (for discovered navigable items)\n // Orchestrator will register these in the registry\n sources?: SourceToRegister[];\n\n // New bindings to register (for hot scope swap on query)\n // Example: catalogId → catalogId_search\n bindings?: ScopeBindingToRegister[];\n}\n\n/**\n * Source function context\n *\n * Sources are pure functions - just fetch/transform and return items!\n * Orchestrator handles sync/deduplication via Cache.addItems() with scope tagging\n */\nexport interface SourceContext<TConfig = any> {\n scope: MenuScope; // Current scope we're fetching for\n query: string; // User's search query\n fetchState: FetchState; // Pagination state for this query (includes source-specific meta)\n sourceConfig: TConfig; // Source configuration (can include getters for reactive data!)\n}\n\n/**\n * Source function type\n *\n * Pure function that provides items for a scope + query combination.\n * Can be a transformer (reads from store) or fetcher (calls API).\n * State (pagination, sourceConfig) is stored externally in registry entry.\n */\nexport type SourceFn<TConfig = any> = (context: SourceContext<TConfig>) => Promise<SourceResult>;\n\n/**\n * An agent a chat message can name (identity v7 D13), as the `@` menu's Agents section offers it:\n * choosing one names it for the message (a chip on the composer's To line) and never writes a\n * mention into the text. `ref` is what the send names (`collab_agent:<asset id>`, or `assistant`\n * for the person's own assistant).\n */\nexport interface MentionChatAgent {\n ref: string;\n name: string;\n /** The collab agent asset behind `ref`; `null` for the person's own assistant. */\n assetId: string | null;\n /** A Lucide icon name for the menu row. */\n icon: string;\n}\n\n/**\n * What a composer that names agents hands its `@` menu (`TiptapComposer`'s `chatAgents`): the\n * agents offered now, naming what is chosen, and a way to hear the offer change.\n */\nexport interface MentionChatAgents {\n /** The agents the Agents section offers now (none once eight are named). */\n getAgents: () => readonly MentionChatAgent[];\n /** Name `agents` for the message, in the order chosen. */\n nameAgents: (agents: readonly MentionChatAgent[]) => void;\n /** Called whenever {@link MentionChatAgents.getAgents} would answer differently. */\n subscribe: (listener: () => void) => () => void;\n}\n\n/**\n * A host-provided candidate for the Tools / Toolkits categories. A host that\n * hands the composer a list of these replaces the server tool catalog for\n * those categories with its own (AthenaChat offers the toolkits its provider\n * enabled, or whatever the host passes through `mentionTools`).\n */\nexport interface MentionTool {\n id: string;\n name: string;\n description?: string;\n /** Lucide icon name (`Package`, `Wrench`, …) or an emoji. */\n icon?: string;\n type: 'tool' | 'toolkit';\n}\n"],"names":[],"mappings":"AAmBO,MAAM,qBAAqB;AAAA,EAChC,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,SAAS;AACX;"}
@@ -26,6 +26,7 @@ const ROOT_MENTION_CATEGORIES = [
26
26
  "tools",
27
27
  "toolkits",
28
28
  "team",
29
+ "agents",
29
30
  "drives"
30
31
  ];
31
32
  function providedToolsFingerprint(tools) {
@@ -43,21 +44,30 @@ function buildStore({
43
44
  auth,
44
45
  getWebpages,
45
46
  getTools,
47
+ getChatAgents,
48
+ getIsAdmin,
46
49
  rootCategories,
47
50
  athenaUnavailable
48
51
  }) {
49
52
  const registry = scopeRegistry.createScopeRegistry();
50
53
  const cache = itemCache.createItemCache();
54
+ const offersAgents = rootCategories.includes("agents");
55
+ const offeredChatAgents = () => {
56
+ var _a;
57
+ return offersAgents ? ((_a = getChatAgents()) == null ? void 0 : _a.getAgents()) ?? [] : [];
58
+ };
51
59
  scopeRegistry.registerSource(registry, "root", index.transformRootCategories, {
52
60
  categories: [...rootCategories],
53
- getWebpages
61
+ getWebpages,
62
+ getChatAgents: offeredChatAgents
54
63
  });
55
- const loadTeam = index.createTeamLoader(auth);
64
+ const loadTeam = index.createTeamLoader(auth, { getIsAdmin });
56
65
  const withHostTools = getTools ? index.withProvidedTools(index.fetchGlobalSearch, getTools) : index.fetchGlobalSearch;
66
+ const withPeople = rootCategories.includes("team") ? index.withTeam(withHostTools, loadTeam) : withHostTools;
57
67
  scopeRegistry.registerSource(
58
68
  registry,
59
69
  "global_search",
60
- rootCategories.includes("team") ? index.withTeam(withHostTools, loadTeam) : withHostTools,
70
+ offersAgents ? index.withChatAgents(withPeople, offeredChatAgents) : withPeople,
61
71
  { auth }
62
72
  );
63
73
  scopeRegistry.bindScopes(registry, "root", "global_search");
@@ -98,12 +108,25 @@ function buildStore({
98
108
  scopeRegistry.registerSource(registry, "toolkits", index.fetchToolkits, { auth });
99
109
  }
100
110
  scopeRegistry.registerSource(registry, "team", index.fetchTeam, { auth, loadTeam });
111
+ if (offersAgents) {
112
+ scopeRegistry.registerSource(registry, index.CHAT_AGENTS_SCOPE, index.transformChatAgents, {
113
+ getAgents: offeredChatAgents
114
+ });
115
+ }
101
116
  scopeRegistry.registerSource(registry, "drive_catalogs", index.fetchDrives, { auth });
102
- return new store.Store({
117
+ const store$1 = new store.Store({
103
118
  registry,
104
119
  cache,
105
120
  athenaUnavailable
106
121
  });
122
+ store$1.nameAgents = (items) => {
123
+ const host = offersAgents ? getChatAgents() : void 0;
124
+ const agents = items.flatMap((item) => index.chatAgentFromMenuItem(item) ?? []);
125
+ if (!host || agents.length === 0) return false;
126
+ host.nameAgents(agents);
127
+ return true;
128
+ };
129
+ return store$1;
107
130
  }
108
131
  function sameReason(a, b) {
109
132
  if (a === null || b === null) return a === b;
@@ -113,7 +136,9 @@ function useMentionSuggestions({
113
136
  webpages,
114
137
  tools,
115
138
  rootCategories = ROOT_MENTION_CATEGORIES,
116
- athenaUnavailable = null
139
+ athenaUnavailable = null,
140
+ chatAgents,
141
+ viewerIsAdmin = false
117
142
  }) {
118
143
  const auth = apiClient.useMentionAuth();
119
144
  const webpagesRef = require$$0.useRef(webpages);
@@ -121,6 +146,10 @@ function useMentionSuggestions({
121
146
  const toolsRef = require$$0.useRef(tools);
122
147
  toolsRef.current = tools;
123
148
  const hasProvidedTools = tools !== void 0;
149
+ const chatAgentsRef = require$$0.useRef(chatAgents);
150
+ chatAgentsRef.current = chatAgents;
151
+ const viewerIsAdminRef = require$$0.useRef(viewerIsAdmin);
152
+ viewerIsAdminRef.current = viewerIsAdmin;
124
153
  const athenaUnavailableRef = require$$0.useRef(athenaUnavailable);
125
154
  athenaUnavailableRef.current = athenaUnavailable;
126
155
  const store2 = require$$0.useMemo(
@@ -128,6 +157,8 @@ function useMentionSuggestions({
128
157
  auth,
129
158
  getWebpages: () => webpagesRef.current,
130
159
  getTools: hasProvidedTools ? () => toolsRef.current ?? [] : void 0,
160
+ getChatAgents: () => chatAgentsRef.current,
161
+ getIsAdmin: () => viewerIsAdminRef.current,
131
162
  rootCategories,
132
163
  athenaUnavailable: athenaUnavailableRef.current
133
164
  }),
@@ -188,6 +219,26 @@ function useMentionSuggestions({
188
219
  invalidate("toolkits");
189
220
  invalidate("global_search");
190
221
  }, [invalidate, toolsFingerprint]);
222
+ const offersAgents = rootCategories.includes("agents");
223
+ require$$0.useEffect(() => {
224
+ if (!offersAgents || !chatAgents) return;
225
+ const refresh = () => {
226
+ invalidate(index.CHAT_AGENTS_SCOPE);
227
+ invalidate("root");
228
+ invalidate("global_search");
229
+ };
230
+ refresh();
231
+ return chatAgents.subscribe(refresh);
232
+ }, [chatAgents, invalidate, offersAgents]);
233
+ const offersTeam = rootCategories.includes("team");
234
+ const previousViewerIsAdminRef = require$$0.useRef(viewerIsAdmin);
235
+ require$$0.useEffect(() => {
236
+ if (previousViewerIsAdminRef.current === viewerIsAdmin) return;
237
+ previousViewerIsAdminRef.current = viewerIsAdmin;
238
+ if (!offersTeam) return;
239
+ invalidate("team");
240
+ invalidate("global_search");
241
+ }, [invalidate, offersTeam, viewerIsAdmin]);
191
242
  return { store: store2, invalidate };
192
243
  }
193
244
  exports.ROOT_MENTION_CATEGORIES = ROOT_MENTION_CATEGORIES;
@@ -1 +1 @@
1
- {"version":3,"file":"use-mention-suggestions.cjs","sources":["../../../../../src/chat-ui/mentions/suggestions/data/use-mention-suggestions.ts"],"sourcesContent":["/**\n * Mention Suggestions Store — shared by every Athena chat host (the Chrome\n * side panel, the Office task pane, the SDK's AthenaChat).\n *\n * Full Olympus-style mention store with all categories:\n * Favorites, Assets, Projects, Browse Profiles, Folders,\n * current/group webpages, Team, Workspace, Drives + Global Search (assets,\n * plus workspace members when Team is offered).\n *\n * Uses registry + cache architecture from Olympus with\n * async data fetching via GraphQL. A host may hand the Tools / Toolkits\n * categories its own list instead of the server catalog (`tools`).\n */\n\nimport type { LabelCopy } from \"@athenaintel/agent-runtime/offline-status\";\nimport { Store } from \"@tanstack/store\";\nimport { useEffect, useLayoutEffect, useMemo, useRef } from \"react\";\nimport type { MentionAuthContext } from \"./api-client\";\nimport { useMentionAuth } from \"./api-client\";\nimport { createItemCache, type ItemCache } from \"./item-cache\";\nimport { retryFailedFetches } from \"./orchestrator\";\nimport {\n createScopeRegistry,\n registerSource,\n bindScopes,\n type ScopeRegistry,\n} from \"./scope-registry\";\nimport {\n transformRootCategories,\n fetchAssets,\n fetchFavorites,\n fetchFolders,\n fetchFolderContents,\n fetchTypedAssets,\n fetchTeam,\n fetchTools,\n fetchToolkits,\n fetchDrives,\n fetchGlobalSearch,\n transformProvidedTools,\n withProvidedTools,\n createTeamLoader,\n withTeam,\n} from \"./sources\";\nimport type { MentionTool, WebpageMention } from \"./types\";\n\nexport function webpageMentionFingerprint(\n webpages: readonly WebpageMention[],\n): string {\n return JSON.stringify(\n webpages.map(({ tabId, title, url, isCurrent }) => [\n tabId,\n title,\n url,\n isCurrent,\n ]),\n );\n}\n\n// ── Store types ──\n\nexport interface MentionSuggestionsStoreState {\n registry: ScopeRegistry;\n cache: ItemCache;\n /**\n * Why nothing is asked of Athena right now, or `null` while it answers: the\n * scopes whose source asks Athena fetch nothing and say this instead, while\n * the host's own items (its tabs, its tool list) and what was already loaded\n * still show.\n */\n athenaUnavailable: LabelCopy | null;\n}\n\nexport type MentionSuggestionsStore = Store<MentionSuggestionsStoreState>;\n\n// ── Categories ──\n\n/**\n * All mention menu categories, in display order.\n */\nexport const ROOT_MENTION_CATEGORIES = [\n \"favorites\",\n \"assets\",\n \"projects\",\n \"browse_profiles\",\n \"folders\",\n \"tools\",\n \"toolkits\",\n \"team\",\n \"drives\",\n] as const;\n\nexport type MentionRootCategory = (typeof ROOT_MENTION_CATEGORIES)[number];\n\n// ── Store builder ──\n\n/** Stable fingerprint of a host's tool list, for cache invalidation. */\nexport function providedToolsFingerprint(tools: readonly MentionTool[]): string {\n return JSON.stringify(\n tools.map(({ id, name, type, description, icon }) => [\n id,\n name,\n type,\n description ?? null,\n icon ?? null,\n ]),\n );\n}\n\nfunction buildStore({\n auth,\n getWebpages,\n getTools,\n rootCategories,\n athenaUnavailable,\n}: {\n auth: MentionAuthContext;\n getWebpages: () => readonly WebpageMention[];\n /** Present when the host supplies the Tools / Toolkits list itself. */\n getTools?: () => readonly MentionTool[];\n rootCategories: readonly MentionRootCategory[];\n athenaUnavailable: LabelCopy | null;\n}): MentionSuggestionsStore {\n const registry = createScopeRegistry();\n const cache = createItemCache();\n\n // ── Root categories ──\n registerSource(registry, \"root\", transformRootCategories, {\n categories: [...rootCategories],\n getWebpages,\n });\n\n const loadTeam = createTeamLoader(auth);\n\n // ── Global search (aggregated) ──\n // A host's own tools ride along so a root query finds them beside assets,\n // and so do workspace members when the host offers Team.\n const withHostTools = getTools\n ? withProvidedTools(fetchGlobalSearch, getTools)\n : fetchGlobalSearch;\n registerSource(\n registry,\n \"global_search\",\n rootCategories.includes(\"team\") ? withTeam(withHostTools, loadTeam) : withHostTools,\n { auth },\n );\n bindScopes(registry, \"root\", \"global_search\");\n\n // ── Assets ──\n registerSource(registry, \"athena_assets\", fetchAssets, { auth, limit: 50 });\n\n // ── Favorites ──\n registerSource(registry, \"favorites\", fetchFavorites, { auth, limit: 50 });\n\n // ── Folders (flat list) ──\n registerSource(\n registry,\n \"athena_folders\",\n fetchFolders,\n { auth, limit: 50 },\n true /* isFlat */,\n );\n\n // ── Internal drive (folder navigation root) ──\n registerSource(registry, \"internal_drive\", fetchFolderContents, {\n auth,\n limit: 50,\n });\n\n // ── Projects ──\n registerSource(registry, \"athena_projects\", fetchTypedAssets, {\n auth,\n includeOnlyTypes: [\"project\"],\n limit: 50,\n });\n\n // ── Browse Profiles ──\n registerSource(registry, \"athena_browse_profiles\", fetchTypedAssets, {\n auth,\n includeOnlyTypes: [\"browse_profile\"],\n limit: 50,\n });\n\n // ── Tools & Toolkits ── the server catalog, or the host's own list\n if (getTools) {\n registerSource(registry, \"tools\", transformProvidedTools, {\n getTools,\n type: \"tool\",\n });\n registerSource(registry, \"toolkits\", transformProvidedTools, {\n getTools,\n type: \"toolkit\",\n });\n } else {\n registerSource(registry, \"tools\", fetchTools, { auth });\n registerSource(registry, \"toolkits\", fetchToolkits, { auth });\n }\n\n // ── Team ──\n registerSource(registry, \"team\", fetchTeam, { auth, loadTeam });\n\n // ── Drives (catalogs) ──\n registerSource(registry, \"drive_catalogs\", fetchDrives, { auth });\n\n return new Store<MentionSuggestionsStoreState>({\n registry,\n cache,\n athenaUnavailable,\n });\n}\n\n/** Two reasons say the same thing (a host may hand a new object with the same words). */\nfunction sameReason(a: LabelCopy | null, b: LabelCopy | null): boolean {\n if (a === null || b === null) return a === b;\n return a.label === b.label && a.detail === b.detail;\n}\n\n// ── Hook ──\n\n/**\n * Creates a stable MentionSuggestionsStore.\n * Uses MentionAuthCtx for API credentials.\n */\nexport function useMentionSuggestions({\n webpages,\n tools,\n rootCategories = ROOT_MENTION_CATEGORIES,\n athenaUnavailable = null,\n}: {\n webpages: readonly WebpageMention[];\n /**\n * Host-provided Tools / Toolkits candidates. When set (even empty) they\n * replace the server tool catalog for those categories and join root\n * search results; omitted, the categories fetch the catalog.\n */\n tools?: readonly MentionTool[];\n /** Categories shown at the top level; hosts can narrow the default set. */\n rootCategories?: readonly MentionRootCategory[];\n /**\n * Why nothing may be asked of Athena right now (`NEEDS_CONNECTION` while\n * Athena can't be reached), or `null`. Once it clears, the lookups that\n * failed meanwhile run again.\n */\n athenaUnavailable?: LabelCopy | null;\n}): {\n store: MentionSuggestionsStore;\n invalidate: (scope: string) => void;\n} {\n const auth = useMentionAuth();\n const webpagesRef = useRef(webpages);\n webpagesRef.current = webpages;\n const toolsRef = useRef(tools);\n toolsRef.current = tools;\n const hasProvidedTools = tools !== undefined;\n // Read once per store build: a store rebuilt meanwhile starts where the host stands.\n const athenaUnavailableRef = useRef(athenaUnavailable);\n athenaUnavailableRef.current = athenaUnavailable;\n\n // Depend on primitive values to avoid rebuilding store on object identity changes\n const store = useMemo(\n () =>\n buildStore({\n auth,\n getWebpages: () => webpagesRef.current,\n getTools: hasProvidedTools ? () => toolsRef.current ?? [] : undefined,\n rootCategories,\n athenaUnavailable: athenaUnavailableRef.current,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n auth.backendUrl,\n auth.accessToken,\n auth.apiKey,\n auth.workspaceId,\n auth.userId,\n hasProvidedTools,\n rootCategories.join(\",\"),\n ],\n );\n\n const invalidate = useMemo(\n () => (scope: string) => {\n const state = store.state;\n const { registry, cache } = state;\n\n // Clear scope from cache\n if (cache.items) {\n for (const item of Object.values(cache.items)) {\n item.visibleInScopes.delete(scope);\n }\n // Remove orphaned items\n for (const [id, item] of Object.entries(cache.items)) {\n if (item.visibleInScopes.size === 0) {\n delete cache.items[id];\n }\n }\n }\n\n // Reset fetch states\n if (registry.entries[scope]) {\n registry.entries[scope].fetchStates = {};\n }\n\n store.setState((prev) => ({ ...prev }));\n },\n [store],\n );\n\n // Before the menu's own effects run, so no lookup leaves under a stale answer;\n // a value that changed nothing keeps the store's state (and its readers) as is.\n useLayoutEffect(() => {\n const unavailableBefore = store.state.athenaUnavailable;\n if (sameReason(unavailableBefore, athenaUnavailable)) return;\n store.setState((prev) => ({ ...prev, athenaUnavailable }));\n if (unavailableBefore !== null && athenaUnavailable === null) {\n retryFailedFetches(store);\n }\n }, [athenaUnavailable, store]);\n\n const webpageFingerprint = webpageMentionFingerprint(webpages);\n const previousWebpageFingerprintRef = useRef<string | null>(null);\n\n useEffect(() => {\n if (previousWebpageFingerprintRef.current === webpageFingerprint) return;\n previousWebpageFingerprintRef.current = webpageFingerprint;\n invalidate(\"root\");\n }, [invalidate, webpageFingerprint]);\n\n // A changed tool list drops the cached Tools / Toolkits entries (and the\n // root search results they were folded into) so the next open re-reads it.\n const toolsFingerprint = tools ? providedToolsFingerprint(tools) : null;\n const previousToolsFingerprintRef = useRef<string | null>(null);\n\n useEffect(() => {\n if (previousToolsFingerprintRef.current === toolsFingerprint) return;\n previousToolsFingerprintRef.current = toolsFingerprint;\n if (toolsFingerprint === null) return;\n invalidate(\"tools\");\n invalidate(\"toolkits\");\n invalidate(\"global_search\");\n }, [invalidate, toolsFingerprint]);\n\n return { store, invalidate };\n}\n"],"names":["createScopeRegistry","createItemCache","registerSource","transformRootCategories","createTeamLoader","withProvidedTools","fetchGlobalSearch","withTeam","bindScopes","fetchAssets","fetchFavorites","fetchFolders","fetchFolderContents","fetchTypedAssets","transformProvidedTools","fetchTools","fetchToolkits","fetchTeam","fetchDrives","Store","useMentionAuth","useRef","store","useMemo","useLayoutEffect","retryFailedFetches","useEffect"],"mappings":";;;;;;;;;AA8CO,SAAS,0BACd,UACQ;AACR,SAAO,KAAK;AAAA,IACV,SAAS,IAAI,CAAC,EAAE,OAAO,OAAO,KAAK,gBAAgB;AAAA,MACjD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,CACD;AAAA,EAAA;AAEL;AAuBO,MAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAOO,SAAS,yBAAyB,OAAuC;AAC9E,SAAO,KAAK;AAAA,IACV,MAAM,IAAI,CAAC,EAAE,IAAI,MAAM,MAAM,aAAa,WAAW;AAAA,MACnD;AAAA,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8B,UAAU;AACxC,eAAW,MAAM;AAAA,EACnB,GAAG,CAAC,YAAY,kBAAkB,CAAC;AAInC,QAAM,mBAAmB,QAAQ,yBAAyB,KAAK,IAAI;AACnE,QAAM,8BAA8BL,WAAAA,OAAsB,IAAI;AAE9DK,aAAAA,UAAU,MAAM;AACd,QAAI,4BAA4B,YAAY,iBAAkB;AAC9D,gCAA4B,UAAU;AACtC,QAAI,qBAAqB,KAAM;AAC/B,eAAW,OAAO;AAClB,eAAW,UAAU;AACrB,eAAW,eAAe;AAAA,EAC5B,GAAG,CAAC,YAAY,gBAAgB,CAAC;AAEjC,SAAO,EAAE,OAAAJ,QAAO,WAAA;AAClB;;;;;"}
1
+ {"version":3,"file":"use-mention-suggestions.cjs","sources":["../../../../../src/chat-ui/mentions/suggestions/data/use-mention-suggestions.ts"],"sourcesContent":["/**\n * Mention Suggestions Store — shared by every Athena chat host (the Chrome\n * side panel, the Office task pane, the SDK's AthenaChat).\n *\n * Full Olympus-style mention store with all categories:\n * Favorites, Assets, Projects, Browse Profiles, Folders,\n * current/group webpages, Team (members, the viewer's people, groups), Agents\n * (the agents a message can name, where the host names agents), Drives +\n * Global Search (assets, plus Team and Agents when offered).\n *\n * Uses registry + cache architecture from Olympus with\n * async data fetching via GraphQL. A host may hand the Tools / Toolkits\n * categories its own list instead of the server catalog (`tools`).\n */\n\nimport type { LabelCopy } from \"@athenaintel/agent-runtime/offline-status\";\nimport { Store } from \"@tanstack/store\";\nimport { useEffect, useLayoutEffect, useMemo, useRef } from \"react\";\nimport type { MentionAuthContext } from \"./api-client\";\nimport { useMentionAuth } from \"./api-client\";\nimport { createItemCache, type ItemCache } from \"./item-cache\";\nimport { retryFailedFetches } from \"./orchestrator\";\nimport {\n createScopeRegistry,\n registerSource,\n bindScopes,\n type ScopeRegistry,\n} from \"./scope-registry\";\nimport {\n CHAT_AGENTS_SCOPE,\n chatAgentFromMenuItem,\n transformChatAgents,\n withChatAgents,\n transformRootCategories,\n fetchAssets,\n fetchFavorites,\n fetchFolders,\n fetchFolderContents,\n fetchTypedAssets,\n fetchTeam,\n fetchTools,\n fetchToolkits,\n fetchDrives,\n fetchGlobalSearch,\n transformProvidedTools,\n withProvidedTools,\n createTeamLoader,\n withTeam,\n} from \"./sources\";\nimport type {\n MentionChatAgent,\n MentionChatAgents,\n MentionTool,\n MenuItem,\n WebpageMention,\n} from \"./types\";\n\nexport function webpageMentionFingerprint(\n webpages: readonly WebpageMention[],\n): string {\n return JSON.stringify(\n webpages.map(({ tabId, title, url, isCurrent }) => [\n tabId,\n title,\n url,\n isCurrent,\n ]),\n );\n}\n\n// ── Store types ──\n\nexport interface MentionSuggestionsStoreState {\n registry: ScopeRegistry;\n cache: ItemCache;\n /**\n * Why nothing is asked of Athena right now, or `null` while it answers: the\n * scopes whose source asks Athena fetch nothing and say this instead, while\n * the host's own items (its tabs, its tool list) and what was already loaded\n * still show.\n */\n athenaUnavailable: LabelCopy | null;\n}\n\nexport type MentionSuggestionsStore = Store<MentionSuggestionsStoreState> & {\n /**\n * Names the agents the `agent` items among `items` stand for (the Agents\n * section), in order; `false` when there is none or the composer names no\n * agents (no `chatAgents`), and the text is then left as it was.\n */\n nameAgents?: (items: readonly MenuItem[]) => boolean;\n};\n\n// ── Categories ──\n\n/**\n * All mention menu categories, in display order.\n */\nexport const ROOT_MENTION_CATEGORIES = [\n \"favorites\",\n \"assets\",\n \"projects\",\n \"browse_profiles\",\n \"folders\",\n \"tools\",\n \"toolkits\",\n \"team\",\n \"agents\",\n \"drives\",\n] as const;\n\nexport type MentionRootCategory = (typeof ROOT_MENTION_CATEGORIES)[number];\n\n// ── Store builder ──\n\n/** Stable fingerprint of a host's tool list, for cache invalidation. */\nexport function providedToolsFingerprint(tools: readonly MentionTool[]): string {\n return JSON.stringify(\n tools.map(({ id, name, type, description, icon }) => [\n id,\n name,\n type,\n description ?? null,\n icon ?? null,\n ]),\n );\n}\n\nfunction buildStore({\n auth,\n getWebpages,\n getTools,\n getChatAgents,\n getIsAdmin,\n rootCategories,\n athenaUnavailable,\n}: {\n auth: MentionAuthContext;\n getWebpages: () => readonly WebpageMention[];\n /** Present when the host supplies the Tools / Toolkits list itself. */\n getTools?: () => readonly MentionTool[];\n /** The host's agents to name (`chatAgents`), read when the menu queries and when one is chosen. */\n getChatAgents: () => MentionChatAgents | undefined;\n /** Whether the viewer is an Athena admin (the ranked people are an admin's). */\n getIsAdmin: () => boolean;\n rootCategories: readonly MentionRootCategory[];\n athenaUnavailable: LabelCopy | null;\n}): MentionSuggestionsStore {\n const registry = createScopeRegistry();\n const cache = createItemCache();\n const offersAgents = rootCategories.includes(\"agents\");\n const offeredChatAgents = (): readonly MentionChatAgent[] =>\n offersAgents ? (getChatAgents()?.getAgents() ?? []) : [];\n\n // ── Root categories ──\n registerSource(registry, \"root\", transformRootCategories, {\n categories: [...rootCategories],\n getWebpages,\n getChatAgents: offeredChatAgents,\n });\n\n const loadTeam = createTeamLoader(auth, { getIsAdmin });\n\n // ── Global search (aggregated) ──\n // A host's own tools ride along so a root query finds them beside assets,\n // and so do the Team list when the host offers Team and the agents it\n // offers to name when it offers Agents.\n const withHostTools = getTools\n ? withProvidedTools(fetchGlobalSearch, getTools)\n : fetchGlobalSearch;\n const withPeople = rootCategories.includes(\"team\")\n ? withTeam(withHostTools, loadTeam)\n : withHostTools;\n registerSource(\n registry,\n \"global_search\",\n offersAgents ? withChatAgents(withPeople, offeredChatAgents) : withPeople,\n { auth },\n );\n bindScopes(registry, \"root\", \"global_search\");\n\n // ── Assets ──\n registerSource(registry, \"athena_assets\", fetchAssets, { auth, limit: 50 });\n\n // ── Favorites ──\n registerSource(registry, \"favorites\", fetchFavorites, { auth, limit: 50 });\n\n // ── Folders (flat list) ──\n registerSource(\n registry,\n \"athena_folders\",\n fetchFolders,\n { auth, limit: 50 },\n true /* isFlat */,\n );\n\n // ── Internal drive (folder navigation root) ──\n registerSource(registry, \"internal_drive\", fetchFolderContents, {\n auth,\n limit: 50,\n });\n\n // ── Projects ──\n registerSource(registry, \"athena_projects\", fetchTypedAssets, {\n auth,\n includeOnlyTypes: [\"project\"],\n limit: 50,\n });\n\n // ── Browse Profiles ──\n registerSource(registry, \"athena_browse_profiles\", fetchTypedAssets, {\n auth,\n includeOnlyTypes: [\"browse_profile\"],\n limit: 50,\n });\n\n // ── Tools & Toolkits ── the server catalog, or the host's own list\n if (getTools) {\n registerSource(registry, \"tools\", transformProvidedTools, {\n getTools,\n type: \"tool\",\n });\n registerSource(registry, \"toolkits\", transformProvidedTools, {\n getTools,\n type: \"toolkit\",\n });\n } else {\n registerSource(registry, \"tools\", fetchTools, { auth });\n registerSource(registry, \"toolkits\", fetchToolkits, { auth });\n }\n\n // ── Team ──\n registerSource(registry, \"team\", fetchTeam, { auth, loadTeam });\n\n // ── Agents ── the agents a message can name, where the host names agents\n if (offersAgents) {\n registerSource(registry, CHAT_AGENTS_SCOPE, transformChatAgents, {\n getAgents: offeredChatAgents,\n });\n }\n\n // ── Drives (catalogs) ──\n registerSource(registry, \"drive_catalogs\", fetchDrives, { auth });\n\n const store: MentionSuggestionsStore = new Store<MentionSuggestionsStoreState>({\n registry,\n cache,\n athenaUnavailable,\n });\n store.nameAgents = (items) => {\n const host = offersAgents ? getChatAgents() : undefined;\n const agents = items.flatMap((item) => chatAgentFromMenuItem(item) ?? []);\n if (!host || agents.length === 0) return false;\n host.nameAgents(agents);\n return true;\n };\n return store;\n}\n\n/** Two reasons say the same thing (a host may hand a new object with the same words). */\nfunction sameReason(a: LabelCopy | null, b: LabelCopy | null): boolean {\n if (a === null || b === null) return a === b;\n return a.label === b.label && a.detail === b.detail;\n}\n\n// ── Hook ──\n\n/**\n * Creates a stable MentionSuggestionsStore.\n * Uses MentionAuthCtx for API credentials.\n */\nexport function useMentionSuggestions({\n webpages,\n tools,\n rootCategories = ROOT_MENTION_CATEGORIES,\n athenaUnavailable = null,\n chatAgents,\n viewerIsAdmin = false,\n}: {\n webpages: readonly WebpageMention[];\n /**\n * Host-provided Tools / Toolkits candidates. When set (even empty) they\n * replace the server tool catalog for those categories and join root\n * search results; omitted, the categories fetch the catalog.\n */\n tools?: readonly MentionTool[];\n /** Categories shown at the top level; hosts can narrow the default set. */\n rootCategories?: readonly MentionRootCategory[];\n /**\n * Why nothing may be asked of Athena right now (`NEEDS_CONNECTION` while\n * Athena can't be reached), or `null`. Once it clears, the lookups that\n * failed meanwhile run again.\n */\n athenaUnavailable?: LabelCopy | null;\n /**\n * The agents this composer's messages can name (identity v7 D13), for the\n * Agents category: what it offers, naming what is chosen. Without it the\n * category shows nothing.\n */\n chatAgents?: MentionChatAgents;\n /**\n * Whether the viewer is an Athena admin: Team ranks an admin's people (the\n * people they talked to most recently first, with the people they saved),\n * as Olympus does while Person is in preview.\n */\n viewerIsAdmin?: boolean;\n}): {\n store: MentionSuggestionsStore;\n invalidate: (scope: string) => void;\n} {\n const auth = useMentionAuth();\n const webpagesRef = useRef(webpages);\n webpagesRef.current = webpages;\n const toolsRef = useRef(tools);\n toolsRef.current = tools;\n const hasProvidedTools = tools !== undefined;\n // Read at query and selection time: the store is built once per credential.\n const chatAgentsRef = useRef(chatAgents);\n chatAgentsRef.current = chatAgents;\n const viewerIsAdminRef = useRef(viewerIsAdmin);\n viewerIsAdminRef.current = viewerIsAdmin;\n // Read once per store build: a store rebuilt meanwhile starts where the host stands.\n const athenaUnavailableRef = useRef(athenaUnavailable);\n athenaUnavailableRef.current = athenaUnavailable;\n\n // Depend on primitive values to avoid rebuilding store on object identity changes\n const store = useMemo(\n () =>\n buildStore({\n auth,\n getWebpages: () => webpagesRef.current,\n getTools: hasProvidedTools ? () => toolsRef.current ?? [] : undefined,\n getChatAgents: () => chatAgentsRef.current,\n getIsAdmin: () => viewerIsAdminRef.current,\n rootCategories,\n athenaUnavailable: athenaUnavailableRef.current,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n auth.backendUrl,\n auth.accessToken,\n auth.apiKey,\n auth.workspaceId,\n auth.userId,\n hasProvidedTools,\n rootCategories.join(\",\"),\n ],\n );\n\n const invalidate = useMemo(\n () => (scope: string) => {\n const state = store.state;\n const { registry, cache } = state;\n\n // Clear scope from cache\n if (cache.items) {\n for (const item of Object.values(cache.items)) {\n item.visibleInScopes.delete(scope);\n }\n // Remove orphaned items\n for (const [id, item] of Object.entries(cache.items)) {\n if (item.visibleInScopes.size === 0) {\n delete cache.items[id];\n }\n }\n }\n\n // Reset fetch states\n if (registry.entries[scope]) {\n registry.entries[scope].fetchStates = {};\n }\n\n store.setState((prev) => ({ ...prev }));\n },\n [store],\n );\n\n // Before the menu's own effects run, so no lookup leaves under a stale answer;\n // a value that changed nothing keeps the store's state (and its readers) as is.\n useLayoutEffect(() => {\n const unavailableBefore = store.state.athenaUnavailable;\n if (sameReason(unavailableBefore, athenaUnavailable)) return;\n store.setState((prev) => ({ ...prev, athenaUnavailable }));\n if (unavailableBefore !== null && athenaUnavailable === null) {\n retryFailedFetches(store);\n }\n }, [athenaUnavailable, store]);\n\n const webpageFingerprint = webpageMentionFingerprint(webpages);\n const previousWebpageFingerprintRef = useRef<string | null>(null);\n\n useEffect(() => {\n if (previousWebpageFingerprintRef.current === webpageFingerprint) return;\n previousWebpageFingerprintRef.current = webpageFingerprint;\n invalidate(\"root\");\n }, [invalidate, webpageFingerprint]);\n\n // A changed tool list drops the cached Tools / Toolkits entries (and the\n // root search results they were folded into) so the next open re-reads it.\n const toolsFingerprint = tools ? providedToolsFingerprint(tools) : null;\n const previousToolsFingerprintRef = useRef<string | null>(null);\n\n useEffect(() => {\n if (previousToolsFingerprintRef.current === toolsFingerprint) return;\n previousToolsFingerprintRef.current = toolsFingerprint;\n if (toolsFingerprint === null) return;\n invalidate(\"tools\");\n invalidate(\"toolkits\");\n invalidate(\"global_search\");\n }, [invalidate, toolsFingerprint]);\n\n // What the Agents section offers moves with the host (an agent named or\n // removed, the agent list loading): refresh the section, the root (it hides\n // once nothing is left to name) and the cached search, which embeds it.\n const offersAgents = rootCategories.includes(\"agents\");\n useEffect(() => {\n if (!offersAgents || !chatAgents) return;\n const refresh = (): void => {\n invalidate(CHAT_AGENTS_SCOPE);\n invalidate(\"root\");\n invalidate(\"global_search\");\n };\n refresh();\n return chatAgents.subscribe(refresh);\n }, [chatAgents, invalidate, offersAgents]);\n\n // An admin answer that arrived (or changed) re-reads Team: an admin's is ranked by their people.\n const offersTeam = rootCategories.includes(\"team\");\n const previousViewerIsAdminRef = useRef(viewerIsAdmin);\n useEffect(() => {\n if (previousViewerIsAdminRef.current === viewerIsAdmin) return;\n previousViewerIsAdminRef.current = viewerIsAdmin;\n if (!offersTeam) return;\n invalidate(\"team\");\n invalidate(\"global_search\");\n }, [invalidate, offersTeam, viewerIsAdmin]);\n\n return { store, invalidate };\n}\n"],"names":["createScopeRegistry","createItemCache","registerSource","transformRootCategories","createTeamLoader","withProvidedTools","fetchGlobalSearch","withTeam","withChatAgents","bindScopes","fetchAssets","fetchFavorites","fetchFolders","fetchFolderContents","fetchTypedAssets","transformProvidedTools","fetchTools","fetchToolkits","fetchTeam","CHAT_AGENTS_SCOPE","transformChatAgents","fetchDrives","store","Store","chatAgentFromMenuItem","useMentionAuth","useRef","useMemo","useLayoutEffect","retryFailedFetches","useEffect"],"mappings":";;;;;;;;;AAyDO,SAAS,0BACd,UACQ;AACR,SAAO,KAAK;AAAA,IACV,SAAS,IAAI,CAAC,EAAE,OAAO,OAAO,KAAK,gBAAgB;AAAA,MACjD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,CACD;AAAA,EAAA;AAEL;AA8BO,MAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAOO,SAAS,yBAAyB,OAAuC;AAC9E,SAAO,KAAK;AAAA,IACV,MAAM,IAAI,CAAC,EAAE,IAAI,MAAM,MAAM,aAAa,WAAW;AAAA,MACnD;AAAA,MACA;AAAA,MACA;AAAA,MACA,eAAe;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