@athenaintel/react 0.57.2 → 0.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (852) hide show
  1. package/README.md +795 -12
  2. package/dist/agent-runtime/src/addressed-agents.cjs +16 -0
  3. package/dist/agent-runtime/src/addressed-agents.cjs.map +1 -0
  4. package/dist/agent-runtime/src/addressed-agents.d.ts +30 -0
  5. package/dist/agent-runtime/src/addressed-agents.js +16 -0
  6. package/dist/agent-runtime/src/addressed-agents.js.map +1 -0
  7. package/dist/agent-runtime/src/answer-label.cjs +4 -3
  8. package/dist/agent-runtime/src/answer-label.cjs.map +1 -1
  9. package/dist/agent-runtime/src/answer-label.d.ts +13 -6
  10. package/dist/agent-runtime/src/answer-label.js +4 -3
  11. package/dist/agent-runtime/src/answer-label.js.map +1 -1
  12. package/dist/agent-runtime/src/chat-outbox-attachments.cjs.map +1 -1
  13. package/dist/agent-runtime/src/chat-outbox-attachments.d.ts +1 -1
  14. package/dist/agent-runtime/src/chat-outbox-attachments.js.map +1 -1
  15. package/dist/agent-runtime/src/chat-outbox-entry.cjs +101 -0
  16. package/dist/agent-runtime/src/chat-outbox-entry.cjs.map +1 -0
  17. package/dist/agent-runtime/src/chat-outbox-entry.d.ts +99 -0
  18. package/dist/agent-runtime/src/chat-outbox-entry.js +101 -0
  19. package/dist/agent-runtime/src/chat-outbox-entry.js.map +1 -0
  20. package/dist/agent-runtime/src/chat-outbox-legacy.cjs +252 -0
  21. package/dist/agent-runtime/src/chat-outbox-legacy.cjs.map +1 -0
  22. package/dist/agent-runtime/src/chat-outbox-legacy.d.ts +96 -0
  23. package/dist/agent-runtime/src/chat-outbox-legacy.js +252 -0
  24. package/dist/agent-runtime/src/chat-outbox-legacy.js.map +1 -0
  25. package/dist/agent-runtime/src/chat-outbox-policy.cjs +30 -0
  26. package/dist/agent-runtime/src/chat-outbox-policy.cjs.map +1 -0
  27. package/dist/agent-runtime/src/chat-outbox-policy.d.ts +42 -0
  28. package/dist/agent-runtime/src/chat-outbox-policy.js +30 -0
  29. package/dist/agent-runtime/src/chat-outbox-policy.js.map +1 -0
  30. package/dist/agent-runtime/src/chat-outbox-storage.cjs +306 -0
  31. package/dist/agent-runtime/src/chat-outbox-storage.cjs.map +1 -0
  32. package/dist/agent-runtime/src/chat-outbox-storage.d.ts +194 -0
  33. package/dist/agent-runtime/src/chat-outbox-storage.js +306 -0
  34. package/dist/agent-runtime/src/chat-outbox-storage.js.map +1 -0
  35. package/dist/agent-runtime/src/chat-outbox-thread.cjs +21 -94
  36. package/dist/agent-runtime/src/chat-outbox-thread.cjs.map +1 -1
  37. package/dist/agent-runtime/src/chat-outbox-thread.d.ts +22 -18
  38. package/dist/agent-runtime/src/chat-outbox-thread.js +21 -94
  39. package/dist/agent-runtime/src/chat-outbox-thread.js.map +1 -1
  40. package/dist/agent-runtime/src/chat-outbox.cjs +492 -547
  41. package/dist/agent-runtime/src/chat-outbox.cjs.map +1 -1
  42. package/dist/agent-runtime/src/chat-outbox.d.ts +110 -142
  43. package/dist/agent-runtime/src/chat-outbox.js +492 -547
  44. package/dist/agent-runtime/src/chat-outbox.js.map +1 -1
  45. package/dist/agent-runtime/src/composer-markdown.cjs +0 -16
  46. package/dist/agent-runtime/src/composer-markdown.cjs.map +1 -1
  47. package/dist/agent-runtime/src/composer-markdown.d.ts +1 -1
  48. package/dist/agent-runtime/src/composer-markdown.js +1 -17
  49. package/dist/agent-runtime/src/composer-markdown.js.map +1 -1
  50. package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs +3 -1
  51. package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -1
  52. package/dist/agent-runtime/src/deep-agent-transport-recipe.d.ts +8 -1
  53. package/dist/agent-runtime/src/deep-agent-transport-recipe.js +3 -1
  54. package/dist/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -1
  55. package/dist/agent-runtime/src/dictation-preferences.d.ts +356 -0
  56. package/dist/agent-runtime/src/dictation-record.d.ts +279 -0
  57. package/dist/agent-runtime/src/dictation-session.d.ts +106 -7
  58. package/dist/agent-runtime/src/dictation-snippets.d.ts +9 -0
  59. package/dist/agent-runtime/src/dictation-transfer.d.ts +142 -0
  60. package/dist/agent-runtime/src/edit-command.cjs.map +1 -1
  61. package/dist/agent-runtime/src/edit-command.d.ts +1 -1
  62. package/dist/agent-runtime/src/edit-command.js.map +1 -1
  63. package/dist/agent-runtime/src/errors.cjs +1 -0
  64. package/dist/agent-runtime/src/errors.cjs.map +1 -1
  65. package/dist/agent-runtime/src/errors.js +1 -0
  66. package/dist/agent-runtime/src/errors.js.map +1 -1
  67. package/dist/agent-runtime/src/generated/runconfig-contract.cjs +24 -0
  68. package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
  69. package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +3 -3
  70. package/dist/agent-runtime/src/generated/runconfig-contract.js +24 -0
  71. package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
  72. package/dist/agent-runtime/src/index.d.ts +14 -8
  73. package/dist/agent-runtime/src/lane-follow.cjs +289 -0
  74. package/dist/agent-runtime/src/lane-follow.cjs.map +1 -0
  75. package/dist/agent-runtime/src/lane-follow.js +289 -0
  76. package/dist/agent-runtime/src/lane-follow.js.map +1 -0
  77. package/dist/agent-runtime/src/lane-images.cjs +387 -0
  78. package/dist/agent-runtime/src/lane-images.cjs.map +1 -0
  79. package/dist/agent-runtime/src/lane-images.js +387 -0
  80. package/dist/agent-runtime/src/lane-images.js.map +1 -0
  81. package/dist/agent-runtime/src/message-window.js +1 -1
  82. package/dist/agent-runtime/src/messages.cjs +19 -1
  83. package/dist/agent-runtime/src/messages.cjs.map +1 -1
  84. package/dist/agent-runtime/src/messages.d.ts +8 -0
  85. package/dist/agent-runtime/src/messages.js +21 -3
  86. package/dist/agent-runtime/src/messages.js.map +1 -1
  87. package/dist/agent-runtime/src/named-agents.cjs +301 -0
  88. package/dist/agent-runtime/src/named-agents.cjs.map +1 -0
  89. package/dist/agent-runtime/src/named-agents.d.ts +246 -0
  90. package/dist/agent-runtime/src/named-agents.js +301 -0
  91. package/dist/agent-runtime/src/named-agents.js.map +1 -0
  92. package/dist/agent-runtime/src/offline-status.cjs.map +1 -1
  93. package/dist/agent-runtime/src/offline-status.d.ts +93 -2
  94. package/dist/agent-runtime/src/offline-status.js.map +1 -1
  95. package/dist/agent-runtime/src/ptc-subcalls.cjs +41 -0
  96. package/dist/agent-runtime/src/ptc-subcalls.cjs.map +1 -0
  97. package/dist/agent-runtime/src/ptc-subcalls.js +41 -0
  98. package/dist/agent-runtime/src/ptc-subcalls.js.map +1 -0
  99. package/dist/agent-runtime/src/queue.cjs +2 -2
  100. package/dist/agent-runtime/src/queue.cjs.map +1 -1
  101. package/dist/agent-runtime/src/queue.d.ts +20 -25
  102. package/dist/agent-runtime/src/queue.js +2 -2
  103. package/dist/agent-runtime/src/queue.js.map +1 -1
  104. package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs +314 -84
  105. package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
  106. package/dist/agent-runtime/src/quota-safe-local-storage-session.d.ts +137 -40
  107. package/dist/agent-runtime/src/quota-safe-local-storage-session.js +318 -88
  108. package/dist/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -1
  109. package/dist/agent-runtime/src/run-send.cjs +54 -0
  110. package/dist/agent-runtime/src/run-send.cjs.map +1 -0
  111. package/dist/agent-runtime/src/run-send.d.ts +51 -0
  112. package/dist/agent-runtime/src/run-send.js +54 -0
  113. package/dist/agent-runtime/src/run-send.js.map +1 -0
  114. package/dist/agent-runtime/src/running-tool-placeholder.cjs +6 -0
  115. package/dist/agent-runtime/src/running-tool-placeholder.cjs.map +1 -1
  116. package/dist/agent-runtime/src/running-tool-placeholder.js +6 -0
  117. package/dist/agent-runtime/src/running-tool-placeholder.js.map +1 -1
  118. package/dist/agent-runtime/src/runtime.d.ts +9 -5
  119. package/dist/agent-runtime/src/sealed-idb.cjs +64 -0
  120. package/dist/agent-runtime/src/sealed-idb.cjs.map +1 -1
  121. package/dist/agent-runtime/src/sealed-idb.d.ts +16 -0
  122. package/dist/agent-runtime/src/sealed-idb.js +64 -0
  123. package/dist/agent-runtime/src/sealed-idb.js.map +1 -1
  124. package/dist/agent-runtime/src/send-recovery.cjs +90 -118
  125. package/dist/agent-runtime/src/send-recovery.cjs.map +1 -1
  126. package/dist/agent-runtime/src/send-recovery.d.ts +25 -29
  127. package/dist/agent-runtime/src/send-recovery.js +90 -118
  128. package/dist/agent-runtime/src/send-recovery.js.map +1 -1
  129. package/dist/agent-runtime/src/statewire-diagnostics.d.ts +4 -1
  130. package/dist/agent-runtime/src/statewire-held-sends.cjs +191 -0
  131. package/dist/agent-runtime/src/statewire-held-sends.cjs.map +1 -0
  132. package/dist/agent-runtime/src/statewire-held-sends.d.ts +119 -0
  133. package/dist/agent-runtime/src/statewire-held-sends.js +191 -0
  134. package/dist/agent-runtime/src/statewire-held-sends.js.map +1 -0
  135. package/dist/agent-runtime/src/statewire-state.cjs +4 -0
  136. package/dist/agent-runtime/src/statewire-state.cjs.map +1 -1
  137. package/dist/agent-runtime/src/statewire-state.js +4 -0
  138. package/dist/agent-runtime/src/statewire-state.js.map +1 -1
  139. package/dist/agent-runtime/src/statewire-transport.cjs +8 -2
  140. package/dist/agent-runtime/src/statewire-transport.cjs.map +1 -1
  141. package/dist/agent-runtime/src/statewire-transport.d.ts +14 -5
  142. package/dist/agent-runtime/src/statewire-transport.js +8 -2
  143. package/dist/agent-runtime/src/statewire-transport.js.map +1 -1
  144. package/dist/agent-runtime/src/subagent-transcripts.cjs +1 -23
  145. package/dist/agent-runtime/src/subagent-transcripts.cjs.map +1 -1
  146. package/dist/agent-runtime/src/subagent-transcripts.js +3 -25
  147. package/dist/agent-runtime/src/subagent-transcripts.js.map +1 -1
  148. package/dist/agent-runtime/src/subagents.cjs +22 -29
  149. package/dist/agent-runtime/src/subagents.cjs.map +1 -1
  150. package/dist/agent-runtime/src/subagents.js +23 -30
  151. package/dist/agent-runtime/src/subagents.js.map +1 -1
  152. package/dist/agent-runtime/src/thread-extras.cjs +27 -19
  153. package/dist/agent-runtime/src/thread-extras.cjs.map +1 -1
  154. package/dist/agent-runtime/src/thread-extras.d.ts +19 -6
  155. package/dist/agent-runtime/src/thread-extras.js +27 -19
  156. package/dist/agent-runtime/src/thread-extras.js.map +1 -1
  157. package/dist/agent-runtime/src/thread-handoff-flow-machine.d.ts +8 -8
  158. package/dist/agent-runtime/src/tool-metadata.cjs +19 -0
  159. package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -1
  160. package/dist/agent-runtime/src/tool-metadata.js +19 -0
  161. package/dist/agent-runtime/src/tool-metadata.js.map +1 -1
  162. package/dist/agent-runtime/src/tool-names.cjs +21 -0
  163. package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
  164. package/dist/agent-runtime/src/tool-names.d.ts +8 -0
  165. package/dist/agent-runtime/src/tool-names.js +21 -0
  166. package/dist/agent-runtime/src/tool-names.js.map +1 -1
  167. package/dist/agent-runtime/src/typed-interrupt-kinds.cjs +247 -0
  168. package/dist/agent-runtime/src/typed-interrupt-kinds.cjs.map +1 -0
  169. package/dist/agent-runtime/src/typed-interrupt-kinds.d.ts +173 -0
  170. package/dist/agent-runtime/src/typed-interrupt-kinds.js +247 -0
  171. package/dist/agent-runtime/src/typed-interrupt-kinds.js.map +1 -0
  172. package/dist/agent-runtime/src/typed-interrupts.cjs +48 -0
  173. package/dist/agent-runtime/src/typed-interrupts.cjs.map +1 -0
  174. package/dist/agent-runtime/src/typed-interrupts.d.ts +75 -0
  175. package/dist/agent-runtime/src/typed-interrupts.js +48 -0
  176. package/dist/agent-runtime/src/typed-interrupts.js.map +1 -0
  177. package/dist/agent-runtime/src/types.d.ts +1 -1
  178. package/dist/agent-runtime/src/use-conversation-list.cjs +1 -0
  179. package/dist/agent-runtime/src/use-conversation-list.cjs.map +1 -1
  180. package/dist/agent-runtime/src/use-conversation-list.d.ts +7 -0
  181. package/dist/agent-runtime/src/use-conversation-list.js +1 -0
  182. package/dist/agent-runtime/src/use-conversation-list.js.map +1 -1
  183. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +46 -29
  184. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -1
  185. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +14 -22
  186. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +46 -29
  187. package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -1
  188. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +78 -14
  189. package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
  190. package/dist/agent-runtime/src/use-deep-agent-runtime.d.ts +34 -7
  191. package/dist/agent-runtime/src/use-deep-agent-runtime.js +79 -15
  192. package/dist/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
  193. package/dist/agent-runtime/src/use-deep-agent-thread.cjs +16 -1
  194. package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
  195. package/dist/agent-runtime/src/use-deep-agent-thread.d.ts +7 -2
  196. package/dist/agent-runtime/src/use-deep-agent-thread.js +16 -1
  197. package/dist/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
  198. package/dist/agent-runtime/src/use-deep-agent-voice.cjs +30 -4
  199. package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -1
  200. package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +22 -4
  201. package/dist/agent-runtime/src/use-deep-agent-voice.js +30 -4
  202. package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -1
  203. package/dist/agent-runtime/src/withdrawn-turns.d.ts +5 -4
  204. package/dist/agent-runtime/src/word-device-fit.d.ts +174 -0
  205. package/dist/agent-runtime/src/work-in.d.ts +127 -0
  206. package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
  207. package/dist/assets/AthenaAssetEmbed.d.ts +6 -1
  208. package/dist/assets/AthenaAssetEmbed.js.map +1 -1
  209. package/dist/assets/asset-panel-store.cjs +13 -5
  210. package/dist/assets/asset-panel-store.cjs.map +1 -1
  211. package/dist/assets/asset-panel-store.d.ts +33 -2
  212. package/dist/assets/asset-panel-store.js +13 -5
  213. package/dist/assets/asset-panel-store.js.map +1 -1
  214. package/dist/auth/AthenaCredentialSourceContext.cjs +11 -0
  215. package/dist/auth/AthenaCredentialSourceContext.cjs.map +1 -1
  216. package/dist/auth/AthenaCredentialSourceContext.d.ts +6 -0
  217. package/dist/auth/AthenaCredentialSourceContext.js +11 -0
  218. package/dist/auth/AthenaCredentialSourceContext.js.map +1 -1
  219. package/dist/auth/account-identity.cjs +13 -2
  220. package/dist/auth/account-identity.cjs.map +1 -1
  221. package/dist/auth/account-identity.d.ts +9 -0
  222. package/dist/auth/account-identity.js +13 -2
  223. package/dist/auth/account-identity.js.map +1 -1
  224. package/dist/auth/credential-source.cjs +20 -4
  225. package/dist/auth/credential-source.cjs.map +1 -1
  226. package/dist/auth/credential-source.d.ts +9 -0
  227. package/dist/auth/credential-source.js +20 -4
  228. package/dist/auth/credential-source.js.map +1 -1
  229. package/dist/catalog/chat-pickers.cjs +31 -0
  230. package/dist/catalog/chat-pickers.cjs.map +1 -1
  231. package/dist/catalog/chat-pickers.d.ts +17 -0
  232. package/dist/catalog/chat-pickers.js +33 -2
  233. package/dist/catalog/chat-pickers.js.map +1 -1
  234. package/dist/catalog/runtime-catalog.cjs +63 -3
  235. package/dist/catalog/runtime-catalog.cjs.map +1 -1
  236. package/dist/catalog/runtime-catalog.d.ts +63 -3
  237. package/dist/catalog/runtime-catalog.js +64 -4
  238. package/dist/catalog/runtime-catalog.js.map +1 -1
  239. package/dist/chat/AthenaChat.cjs +301 -98
  240. package/dist/chat/AthenaChat.cjs.map +1 -1
  241. package/dist/chat/AthenaChat.d.ts +80 -4
  242. package/dist/chat/AthenaChat.js +302 -99
  243. package/dist/chat/AthenaChat.js.map +1 -1
  244. package/dist/chat/StatewireApprovalCard.cjs +35 -5
  245. package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
  246. package/dist/chat/StatewireApprovalCard.d.ts +55 -2
  247. package/dist/chat/StatewireApprovalCard.js +37 -7
  248. package/dist/chat/StatewireApprovalCard.js.map +1 -1
  249. package/dist/chat/StatewireQueuedMessages.cjs +17 -2
  250. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
  251. package/dist/chat/StatewireQueuedMessages.d.ts +8 -45
  252. package/dist/chat/StatewireQueuedMessages.js +18 -3
  253. package/dist/chat/StatewireQueuedMessages.js.map +1 -1
  254. package/dist/chat/chat-agent-mentions.cjs +70 -0
  255. package/dist/chat/chat-agent-mentions.cjs.map +1 -0
  256. package/dist/chat/chat-agent-mentions.d.ts +13 -0
  257. package/dist/chat/chat-agent-mentions.js +70 -0
  258. package/dist/chat/chat-agent-mentions.js.map +1 -0
  259. package/dist/chat/composer-actions.cjs +12 -0
  260. package/dist/chat/composer-actions.cjs.map +1 -0
  261. package/dist/chat/composer-actions.d.ts +22 -0
  262. package/dist/chat/composer-actions.js +12 -0
  263. package/dist/chat/composer-actions.js.map +1 -0
  264. package/dist/chat/follow-up-suggestions.cjs +185 -0
  265. package/dist/chat/follow-up-suggestions.cjs.map +1 -0
  266. package/dist/chat/follow-up-suggestions.d.ts +64 -0
  267. package/dist/chat/follow-up-suggestions.js +185 -0
  268. package/dist/chat/follow-up-suggestions.js.map +1 -0
  269. package/dist/chat/super-grouping/ToolTimeline.cjs +4 -3
  270. package/dist/chat/super-grouping/ToolTimeline.cjs.map +1 -1
  271. package/dist/chat/super-grouping/ToolTimeline.d.ts +7 -3
  272. package/dist/chat/super-grouping/ToolTimeline.js +4 -3
  273. package/dist/chat/super-grouping/ToolTimeline.js.map +1 -1
  274. package/dist/chat/turn-changes.cjs +284 -0
  275. package/dist/chat/turn-changes.cjs.map +1 -0
  276. package/dist/chat/turn-changes.d.ts +130 -0
  277. package/dist/chat/turn-changes.js +284 -0
  278. package/dist/chat/turn-changes.js.map +1 -0
  279. package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.cjs +31 -0
  280. package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.cjs.map +1 -0
  281. package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.d.ts +31 -0
  282. package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.js +31 -0
  283. package/dist/chat/typed-interrupts/StatewireTypedInterruptCard.js.map +1 -0
  284. package/dist/chat/typed-interrupts/approval-cards.cjs +250 -0
  285. package/dist/chat/typed-interrupts/approval-cards.cjs.map +1 -0
  286. package/dist/chat/typed-interrupts/approval-cards.d.ts +22 -0
  287. package/dist/chat/typed-interrupts/approval-cards.js +250 -0
  288. package/dist/chat/typed-interrupts/approval-cards.js.map +1 -0
  289. package/dist/chat/typed-interrupts/form-cards.cjs +289 -0
  290. package/dist/chat/typed-interrupts/form-cards.cjs.map +1 -0
  291. package/dist/chat/typed-interrupts/form-cards.d.ts +6 -0
  292. package/dist/chat/typed-interrupts/form-cards.js +289 -0
  293. package/dist/chat/typed-interrupts/form-cards.js.map +1 -0
  294. package/dist/chat/typed-interrupts/interrupt-card-shell.cjs +182 -0
  295. package/dist/chat/typed-interrupts/interrupt-card-shell.cjs.map +1 -0
  296. package/dist/chat/typed-interrupts/interrupt-card-shell.d.ts +47 -0
  297. package/dist/chat/typed-interrupts/interrupt-card-shell.js +182 -0
  298. package/dist/chat/typed-interrupts/interrupt-card-shell.js.map +1 -0
  299. package/dist/chat/typed-interrupts/json-schema-form.cjs +388 -0
  300. package/dist/chat/typed-interrupts/json-schema-form.cjs.map +1 -0
  301. package/dist/chat/typed-interrupts/json-schema-form.d.ts +33 -0
  302. package/dist/chat/typed-interrupts/json-schema-form.js +388 -0
  303. package/dist/chat/typed-interrupts/json-schema-form.js.map +1 -0
  304. package/dist/chat/typed-interrupts/questionnaire-card.cjs +449 -0
  305. package/dist/chat/typed-interrupts/questionnaire-card.cjs.map +1 -0
  306. package/dist/chat/typed-interrupts/questionnaire-card.d.ts +20 -0
  307. package/dist/chat/typed-interrupts/questionnaire-card.js +449 -0
  308. package/dist/chat/typed-interrupts/questionnaire-card.js.map +1 -0
  309. package/dist/chat/typed-interrupts/request-file-card.cjs +159 -0
  310. package/dist/chat/typed-interrupts/request-file-card.cjs.map +1 -0
  311. package/dist/chat/typed-interrupts/request-file-card.d.ts +2 -0
  312. package/dist/chat/typed-interrupts/request-file-card.js +159 -0
  313. package/dist/chat/typed-interrupts/request-file-card.js.map +1 -0
  314. package/dist/chat/typed-interrupts/toolkit-selection-card.cjs +189 -0
  315. package/dist/chat/typed-interrupts/toolkit-selection-card.cjs.map +1 -0
  316. package/dist/chat/typed-interrupts/toolkit-selection-card.d.ts +23 -0
  317. package/dist/chat/typed-interrupts/toolkit-selection-card.js +189 -0
  318. package/dist/chat/typed-interrupts/toolkit-selection-card.js.map +1 -0
  319. package/dist/chat/typed-interrupts/typed-interrupt-body.cjs +26 -0
  320. package/dist/chat/typed-interrupts/typed-interrupt-body.cjs.map +1 -0
  321. package/dist/chat/typed-interrupts/typed-interrupt-body.d.ts +3 -0
  322. package/dist/chat/typed-interrupts/typed-interrupt-body.js +26 -0
  323. package/dist/chat/typed-interrupts/typed-interrupt-body.js.map +1 -0
  324. package/dist/chat/typed-interrupts/typed-interrupt-graphql.cjs +105 -0
  325. package/dist/chat/typed-interrupts/typed-interrupt-graphql.cjs.map +1 -0
  326. package/dist/chat/typed-interrupts/typed-interrupt-graphql.d.ts +29 -0
  327. package/dist/chat/typed-interrupts/typed-interrupt-graphql.js +105 -0
  328. package/dist/chat/typed-interrupts/typed-interrupt-graphql.js.map +1 -0
  329. package/dist/chat/typed-interrupts/typed-interrupt-notice.cjs +70 -0
  330. package/dist/chat/typed-interrupts/typed-interrupt-notice.cjs.map +1 -0
  331. package/dist/chat/typed-interrupts/typed-interrupt-notice.d.ts +45 -0
  332. package/dist/chat/typed-interrupts/typed-interrupt-notice.js +70 -0
  333. package/dist/chat/typed-interrupts/typed-interrupt-notice.js.map +1 -0
  334. package/dist/chat/typed-interrupts/typed-interrupt-panel.cjs +76 -0
  335. package/dist/chat/typed-interrupts/typed-interrupt-panel.cjs.map +1 -0
  336. package/dist/chat/typed-interrupts/typed-interrupt-panel.d.ts +11 -0
  337. package/dist/chat/typed-interrupts/typed-interrupt-panel.js +76 -0
  338. package/dist/chat/typed-interrupts/typed-interrupt-panel.js.map +1 -0
  339. package/dist/chat/typed-interrupts/typed-interrupt-types.d.ts +46 -0
  340. package/dist/chat/typed-interrupts/use-interrupt-draft.cjs +106 -0
  341. package/dist/chat/typed-interrupts/use-interrupt-draft.cjs.map +1 -0
  342. package/dist/chat/typed-interrupts/use-interrupt-draft.d.ts +29 -0
  343. package/dist/chat/typed-interrupts/use-interrupt-draft.js +106 -0
  344. package/dist/chat/typed-interrupts/use-interrupt-draft.js.map +1 -0
  345. package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.cjs +231 -0
  346. package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.cjs.map +1 -0
  347. package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.d.ts +66 -0
  348. package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.js +231 -0
  349. package/dist/chat/typed-interrupts/use-statewire-typed-interrupt.js.map +1 -0
  350. package/dist/chat-ui/composer/composer-named-agents.cjs +13 -0
  351. package/dist/chat-ui/composer/composer-named-agents.cjs.map +1 -0
  352. package/dist/chat-ui/composer/composer-named-agents.d.ts +20 -0
  353. package/dist/chat-ui/composer/composer-named-agents.js +13 -0
  354. package/dist/chat-ui/composer/composer-named-agents.js.map +1 -0
  355. package/dist/chat-ui/composer/slash-command-menu.cjs +143 -0
  356. package/dist/chat-ui/composer/slash-command-menu.cjs.map +1 -0
  357. package/dist/chat-ui/composer/slash-command-menu.d.ts +19 -0
  358. package/dist/chat-ui/composer/slash-command-menu.js +143 -0
  359. package/dist/chat-ui/composer/slash-command-menu.js.map +1 -0
  360. package/dist/chat-ui/composer/slash-commands-extension.cjs +51 -0
  361. package/dist/chat-ui/composer/slash-commands-extension.cjs.map +1 -0
  362. package/dist/chat-ui/composer/slash-commands-extension.d.ts +39 -0
  363. package/dist/chat-ui/composer/slash-commands-extension.js +51 -0
  364. package/dist/chat-ui/composer/slash-commands-extension.js.map +1 -0
  365. package/dist/chat-ui/composer/slash-commands.cjs +74 -0
  366. package/dist/chat-ui/composer/slash-commands.cjs.map +1 -0
  367. package/dist/chat-ui/composer/slash-commands.d.ts +82 -0
  368. package/dist/chat-ui/composer/slash-commands.js +74 -0
  369. package/dist/chat-ui/composer/slash-commands.js.map +1 -0
  370. package/dist/chat-ui/composer/tiptap-composer.cjs +135 -9
  371. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
  372. package/dist/chat-ui/composer/tiptap-composer.d.ts +61 -2
  373. package/dist/chat-ui/composer/tiptap-composer.js +135 -9
  374. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
  375. package/dist/chat-ui/index.cjs +5 -0
  376. package/dist/chat-ui/index.cjs.map +1 -1
  377. package/dist/chat-ui/index.d.ts +4 -2
  378. package/dist/chat-ui/index.js +5 -0
  379. package/dist/chat-ui/index.js.map +1 -1
  380. package/dist/chat-ui/mentions/mention-chip.cjs +10 -4
  381. package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
  382. package/dist/chat-ui/mentions/mention-chip.js +11 -5
  383. package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
  384. package/dist/chat-ui/mentions/mention-extension.cjs +8 -1
  385. package/dist/chat-ui/mentions/mention-extension.cjs.map +1 -1
  386. package/dist/chat-ui/mentions/mention-extension.js +8 -1
  387. package/dist/chat-ui/mentions/mention-extension.js.map +1 -1
  388. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.cjs +1 -0
  389. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.cjs.map +1 -1
  390. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.js +1 -0
  391. package/dist/chat-ui/mentions/suggestions/components/get-scope-name.js.map +1 -1
  392. package/dist/chat-ui/mentions/suggestions/components/mention-icon.cjs +20 -2
  393. package/dist/chat-ui/mentions/suggestions/components/mention-icon.cjs.map +1 -1
  394. package/dist/chat-ui/mentions/suggestions/components/mention-icon.d.ts +10 -1
  395. package/dist/chat-ui/mentions/suggestions/components/mention-icon.js +22 -4
  396. package/dist/chat-ui/mentions/suggestions/components/mention-icon.js.map +1 -1
  397. package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs +1 -1
  398. package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs.map +1 -1
  399. package/dist/chat-ui/mentions/suggestions/components/menu-item.js +1 -1
  400. package/dist/chat-ui/mentions/suggestions/components/menu-item.js.map +1 -1
  401. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +45 -0
  402. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
  403. package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +48 -0
  404. package/dist/chat-ui/mentions/suggestions/data/api-client.js +45 -0
  405. package/dist/chat-ui/mentions/suggestions/data/api-client.js.map +1 -1
  406. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icon-names.generated.cjs +89 -0
  407. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icon-names.generated.cjs.map +1 -0
  408. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icon-names.generated.d.ts +8 -0
  409. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icon-names.generated.js +89 -0
  410. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icon-names.generated.js.map +1 -0
  411. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs +140 -116
  412. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs.map +1 -1
  413. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.d.ts +46 -12
  414. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js +141 -117
  415. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js.map +1 -1
  416. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +272 -25
  417. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -1
  418. package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +88 -10
  419. package/dist/chat-ui/mentions/suggestions/data/sources/index.js +274 -27
  420. package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
  421. package/dist/chat-ui/mentions/suggestions/data/types.cjs.map +1 -1
  422. package/dist/chat-ui/mentions/suggestions/data/types.d.ts +27 -1
  423. package/dist/chat-ui/mentions/suggestions/data/types.js.map +1 -1
  424. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs +56 -5
  425. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs.map +1 -1
  426. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.d.ts +26 -6
  427. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js +57 -6
  428. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js.map +1 -1
  429. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.cjs +34 -17
  430. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.cjs.map +1 -1
  431. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.d.ts +19 -1
  432. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.js +35 -18
  433. package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.js.map +1 -1
  434. package/dist/chat-ui/mentions/use-asset-icon-app-url.cjs +12 -0
  435. package/dist/chat-ui/mentions/use-asset-icon-app-url.cjs.map +1 -0
  436. package/dist/chat-ui/mentions/use-asset-icon-app-url.d.ts +8 -0
  437. package/dist/chat-ui/mentions/use-asset-icon-app-url.js +12 -0
  438. package/dist/chat-ui/mentions/use-asset-icon-app-url.js.map +1 -0
  439. package/dist/chat-ui/statewire.d.ts +1 -1
  440. package/dist/chat-ui/thread/statewire-history-edge.cjs +15 -0
  441. package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
  442. package/dist/chat-ui/thread/statewire-history-edge.d.ts +4 -1
  443. package/dist/chat-ui/thread/statewire-history-edge.js +15 -0
  444. package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
  445. package/dist/collab/client.cjs +41 -6
  446. package/dist/collab/client.cjs.map +1 -1
  447. package/dist/collab/client.d.ts +38 -7
  448. package/dist/collab/client.js +41 -6
  449. package/dist/collab/client.js.map +1 -1
  450. package/dist/composer/ComposerAttachedReferences.cjs +119 -0
  451. package/dist/composer/ComposerAttachedReferences.cjs.map +1 -0
  452. package/dist/composer/ComposerAttachedReferences.d.ts +26 -0
  453. package/dist/composer/ComposerAttachedReferences.js +119 -0
  454. package/dist/composer/ComposerAttachedReferences.js.map +1 -0
  455. package/dist/composer/ComposerNamedAgents.cjs +63 -0
  456. package/dist/composer/ComposerNamedAgents.cjs.map +1 -0
  457. package/dist/composer/ComposerNamedAgents.d.ts +16 -0
  458. package/dist/composer/ComposerNamedAgents.js +63 -0
  459. package/dist/composer/ComposerNamedAgents.js.map +1 -0
  460. package/dist/composer/attached-references.cjs +159 -0
  461. package/dist/composer/attached-references.cjs.map +1 -0
  462. package/dist/composer/attached-references.d.ts +86 -0
  463. package/dist/composer/attached-references.js +159 -0
  464. package/dist/composer/attached-references.js.map +1 -0
  465. package/dist/composer/build-composed-message.cjs +14 -7
  466. package/dist/composer/build-composed-message.cjs.map +1 -1
  467. package/dist/composer/build-composed-message.d.ts +6 -1
  468. package/dist/composer/build-composed-message.js +14 -7
  469. package/dist/composer/build-composed-message.js.map +1 -1
  470. package/dist/composer/composer-handoff.cjs +6 -2
  471. package/dist/composer/composer-handoff.cjs.map +1 -1
  472. package/dist/composer/composer-handoff.d.ts +7 -1
  473. package/dist/composer/composer-handoff.js +6 -2
  474. package/dist/composer/composer-handoff.js.map +1 -1
  475. package/dist/composer/folder-upload.cjs +149 -0
  476. package/dist/composer/folder-upload.cjs.map +1 -0
  477. package/dist/composer/folder-upload.d.ts +79 -0
  478. package/dist/composer/folder-upload.js +149 -0
  479. package/dist/composer/folder-upload.js.map +1 -0
  480. package/dist/composer/index.d.ts +1 -1
  481. package/dist/composer/staged-message-metadata.cjs +12 -0
  482. package/dist/composer/staged-message-metadata.cjs.map +1 -0
  483. package/dist/composer/staged-message-metadata.d.ts +15 -0
  484. package/dist/composer/staged-message-metadata.js +12 -0
  485. package/dist/composer/staged-message-metadata.js.map +1 -0
  486. package/dist/composer/useAttachToChat.cjs +35 -0
  487. package/dist/composer/useAttachToChat.cjs.map +1 -0
  488. package/dist/composer/useAttachToChat.d.ts +54 -0
  489. package/dist/composer/useAttachToChat.js +35 -0
  490. package/dist/composer/useAttachToChat.js.map +1 -0
  491. package/dist/composer/useAttachedReferencesComposerProps.cjs +19 -0
  492. package/dist/composer/useAttachedReferencesComposerProps.cjs.map +1 -0
  493. package/dist/composer/useAttachedReferencesComposerProps.d.ts +12 -0
  494. package/dist/composer/useAttachedReferencesComposerProps.js +19 -0
  495. package/dist/composer/useAttachedReferencesComposerProps.js.map +1 -0
  496. package/dist/composer/useFileUpload.cjs +95 -7
  497. package/dist/composer/useFileUpload.cjs.map +1 -1
  498. package/dist/composer/useFileUpload.d.ts +21 -2
  499. package/dist/composer/useFileUpload.js +95 -7
  500. package/dist/composer/useFileUpload.js.map +1 -1
  501. package/dist/data/athena-api-error.cjs +125 -0
  502. package/dist/data/athena-api-error.cjs.map +1 -0
  503. package/dist/data/athena-api-error.d.ts +96 -0
  504. package/dist/data/athena-api-error.js +125 -0
  505. package/dist/data/athena-api-error.js.map +1 -0
  506. package/dist/data/athena-data-client.cjs +106 -0
  507. package/dist/data/athena-data-client.cjs.map +1 -0
  508. package/dist/data/athena-data-client.d.ts +74 -0
  509. package/dist/data/athena-data-client.js +106 -0
  510. package/dist/data/athena-data-client.js.map +1 -0
  511. package/dist/data/athena-member.cjs +93 -0
  512. package/dist/data/athena-member.cjs.map +1 -0
  513. package/dist/data/athena-member.d.ts +125 -0
  514. package/dist/data/athena-member.js +93 -0
  515. package/dist/data/athena-member.js.map +1 -0
  516. package/dist/data/athena-request.cjs +460 -0
  517. package/dist/data/athena-request.cjs.map +1 -0
  518. package/dist/data/athena-request.d.ts +120 -0
  519. package/dist/data/athena-request.js +460 -0
  520. package/dist/data/athena-request.js.map +1 -0
  521. package/dist/data/use-athena-fetch.cjs +14 -0
  522. package/dist/data/use-athena-fetch.cjs.map +1 -0
  523. package/dist/data/use-athena-fetch.d.ts +19 -0
  524. package/dist/data/use-athena-fetch.js +14 -0
  525. package/dist/data/use-athena-fetch.js.map +1 -0
  526. package/dist/data/use-athena-graphql.cjs +66 -0
  527. package/dist/data/use-athena-graphql.cjs.map +1 -0
  528. package/dist/data/use-athena-graphql.d.ts +56 -0
  529. package/dist/data/use-athena-graphql.js +66 -0
  530. package/dist/data/use-athena-graphql.js.map +1 -0
  531. package/dist/data/use-athena-rest.cjs +33 -0
  532. package/dist/data/use-athena-rest.cjs.map +1 -0
  533. package/dist/data/use-athena-rest.d.ts +21 -0
  534. package/dist/data/use-athena-rest.js +33 -0
  535. package/dist/data/use-athena-rest.js.map +1 -0
  536. package/dist/data/use-semantic-query.cjs +44 -0
  537. package/dist/data/use-semantic-query.cjs.map +1 -0
  538. package/dist/data/use-semantic-query.d.ts +92 -0
  539. package/dist/data/use-semantic-query.js +44 -0
  540. package/dist/data/use-semantic-query.js.map +1 -0
  541. package/dist/diagnostics/athena-diagnostics.cjs.map +1 -1
  542. package/dist/diagnostics/athena-diagnostics.d.ts +5 -1
  543. package/dist/diagnostics/athena-diagnostics.js.map +1 -1
  544. package/dist/diagnostics/errors.cjs +7 -0
  545. package/dist/diagnostics/errors.cjs.map +1 -1
  546. package/dist/diagnostics/errors.d.ts +7 -0
  547. package/dist/diagnostics/errors.js +7 -0
  548. package/dist/diagnostics/errors.js.map +1 -1
  549. package/dist/index.cjs +155 -11
  550. package/dist/index.cjs.map +1 -1
  551. package/dist/index.d.ts +72 -13
  552. package/dist/index.js +148 -4
  553. package/dist/index.js.map +1 -1
  554. package/dist/keryx-http/src/initial-sync.cjs +64 -16
  555. package/dist/keryx-http/src/initial-sync.cjs.map +1 -1
  556. package/dist/keryx-http/src/initial-sync.d.ts +31 -1
  557. package/dist/keryx-http/src/initial-sync.js +64 -16
  558. package/dist/keryx-http/src/initial-sync.js.map +1 -1
  559. package/dist/keryx-http/src/own-awareness.cjs +20 -0
  560. package/dist/keryx-http/src/own-awareness.cjs.map +1 -0
  561. package/dist/keryx-http/src/own-awareness.d.ts +50 -0
  562. package/dist/keryx-http/src/own-awareness.js +20 -0
  563. package/dist/keryx-http/src/own-awareness.js.map +1 -0
  564. package/dist/keryx-http/src/update-attributions.cjs +26 -1
  565. package/dist/keryx-http/src/update-attributions.cjs.map +1 -1
  566. package/dist/keryx-http/src/update-attributions.d.ts +10 -1
  567. package/dist/keryx-http/src/update-attributions.js +26 -1
  568. package/dist/keryx-http/src/update-attributions.js.map +1 -1
  569. package/dist/offline/chat-outbox.cjs +262 -26
  570. package/dist/offline/chat-outbox.cjs.map +1 -1
  571. package/dist/offline/chat-outbox.d.ts +90 -12
  572. package/dist/offline/chat-outbox.js +263 -27
  573. package/dist/offline/chat-outbox.js.map +1 -1
  574. package/dist/provider/AthenaProvider.cjs +60 -22
  575. package/dist/provider/AthenaProvider.cjs.map +1 -1
  576. package/dist/provider/AthenaProvider.d.ts +24 -8
  577. package/dist/provider/AthenaProvider.js +61 -23
  578. package/dist/provider/AthenaProvider.js.map +1 -1
  579. package/dist/react/package.json.cjs +1 -1
  580. package/dist/react/package.json.js +1 -1
  581. package/dist/references/src/anchors/parse.cjs +11 -1
  582. package/dist/references/src/anchors/parse.cjs.map +1 -1
  583. package/dist/references/src/anchors/parse.js +11 -1
  584. package/dist/references/src/anchors/parse.js.map +1 -1
  585. package/dist/references/src/anchors/schemas.d.ts +1 -0
  586. package/dist/references/src/anchors/serialize.cjs +1 -0
  587. package/dist/references/src/anchors/serialize.cjs.map +1 -1
  588. package/dist/references/src/anchors/serialize.js +1 -0
  589. package/dist/references/src/anchors/serialize.js.map +1 -1
  590. package/dist/references/src/anchors/types.cjs +5 -0
  591. package/dist/references/src/anchors/types.cjs.map +1 -1
  592. package/dist/references/src/anchors/types.d.ts +9 -0
  593. package/dist/references/src/anchors/types.js +5 -0
  594. package/dist/references/src/anchors/types.js.map +1 -1
  595. package/dist/references/src/attachable.cjs +149 -0
  596. package/dist/references/src/attachable.cjs.map +1 -0
  597. package/dist/references/src/attachable.d.ts +87 -0
  598. package/dist/references/src/attachable.js +149 -0
  599. package/dist/references/src/attachable.js.map +1 -0
  600. package/dist/references/src/schemas.d.ts +2 -0
  601. package/dist/runtime/StatewirePlanModeLaneSync.cjs +93 -0
  602. package/dist/runtime/StatewirePlanModeLaneSync.cjs.map +1 -0
  603. package/dist/runtime/StatewirePlanModeLaneSync.d.ts +34 -0
  604. package/dist/runtime/StatewirePlanModeLaneSync.js +93 -0
  605. package/dist/runtime/StatewirePlanModeLaneSync.js.map +1 -0
  606. package/dist/runtime/StatewireThreadConfigLaneSync.cjs +2 -0
  607. package/dist/runtime/StatewireThreadConfigLaneSync.cjs.map +1 -1
  608. package/dist/runtime/StatewireThreadConfigLaneSync.d.ts +4 -0
  609. package/dist/runtime/StatewireThreadConfigLaneSync.js +2 -0
  610. package/dist/runtime/StatewireThreadConfigLaneSync.js.map +1 -1
  611. package/dist/runtime/statewire-plan-mode.cjs +71 -0
  612. package/dist/runtime/statewire-plan-mode.cjs.map +1 -0
  613. package/dist/runtime/statewire-plan-mode.d.ts +88 -0
  614. package/dist/runtime/statewire-plan-mode.js +71 -0
  615. package/dist/runtime/statewire-plan-mode.js.map +1 -0
  616. package/dist/runtime/statewire-run-config.cjs +3 -1
  617. package/dist/runtime/statewire-run-config.cjs.map +1 -1
  618. package/dist/runtime/statewire-run-config.d.ts +7 -0
  619. package/dist/runtime/statewire-run-config.js +3 -1
  620. package/dist/runtime/statewire-run-config.js.map +1 -1
  621. package/dist/runtime/statewire-session-key.cjs +11 -5
  622. package/dist/runtime/statewire-session-key.cjs.map +1 -1
  623. package/dist/runtime/statewire-session-key.d.ts +22 -10
  624. package/dist/runtime/statewire-session-key.js +11 -5
  625. package/dist/runtime/statewire-session-key.js.map +1 -1
  626. package/dist/runtime/useAthenaStatewireRuntime.cjs +64 -9
  627. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
  628. package/dist/runtime/useAthenaStatewireRuntime.d.ts +26 -10
  629. package/dist/runtime/useAthenaStatewireRuntime.js +66 -11
  630. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
  631. package/dist/search/useAthenaAssets.cjs +394 -0
  632. package/dist/search/useAthenaAssets.cjs.map +1 -0
  633. package/dist/search/useAthenaAssets.d.ts +186 -0
  634. package/dist/search/useAthenaAssets.js +394 -0
  635. package/dist/search/useAthenaAssets.js.map +1 -0
  636. package/dist/sheet-range/index.cjs +4 -0
  637. package/dist/sheet-range/index.cjs.map +1 -1
  638. package/dist/sheet-range/index.d.ts +4 -2
  639. package/dist/sheet-range/index.js +4 -0
  640. package/dist/sheet-range/index.js.map +1 -1
  641. package/dist/sheet-range/query-range.cjs +102 -0
  642. package/dist/sheet-range/query-range.cjs.map +1 -0
  643. package/dist/sheet-range/query-range.d.ts +46 -0
  644. package/dist/sheet-range/query-range.js +102 -0
  645. package/dist/sheet-range/query-range.js.map +1 -0
  646. package/dist/styles.css +1 -1
  647. package/dist/subagents/index.cjs +49 -0
  648. package/dist/subagents/index.cjs.map +1 -0
  649. package/dist/subagents/index.d.ts +16 -0
  650. package/dist/subagents/index.js +49 -0
  651. package/dist/subagents/index.js.map +1 -0
  652. package/dist/subagents/lane-follow.cjs +19 -0
  653. package/dist/subagents/lane-follow.cjs.map +1 -0
  654. package/dist/subagents/lane-follow.d.ts +9 -0
  655. package/dist/subagents/lane-follow.js +19 -0
  656. package/dist/subagents/lane-follow.js.map +1 -0
  657. package/dist/subagents/lane-model.cjs +178 -0
  658. package/dist/subagents/lane-model.cjs.map +1 -0
  659. package/dist/subagents/lane-model.d.ts +140 -0
  660. package/dist/subagents/lane-model.js +178 -0
  661. package/dist/subagents/lane-model.js.map +1 -0
  662. package/dist/subagents/lane-parts.cjs +517 -0
  663. package/dist/subagents/lane-parts.cjs.map +1 -0
  664. package/dist/subagents/lane-parts.d.ts +130 -0
  665. package/dist/subagents/lane-parts.js +517 -0
  666. package/dist/subagents/lane-parts.js.map +1 -0
  667. package/dist/subagents/subagent-lane-group.cjs +215 -0
  668. package/dist/subagents/subagent-lane-group.cjs.map +1 -0
  669. package/dist/subagents/subagent-lane-group.d.ts +67 -0
  670. package/dist/subagents/subagent-lane-group.js +215 -0
  671. package/dist/subagents/subagent-lane-group.js.map +1 -0
  672. package/dist/subagents/subagent-transcript-drawer.cjs +431 -0
  673. package/dist/subagents/subagent-transcript-drawer.cjs.map +1 -0
  674. package/dist/subagents/subagent-transcript-drawer.d.ts +78 -0
  675. package/dist/subagents/subagent-transcript-drawer.js +431 -0
  676. package/dist/subagents/subagent-transcript-drawer.js.map +1 -0
  677. package/dist/subagents/task-subagent-group.cjs +115 -0
  678. package/dist/subagents/task-subagent-group.cjs.map +1 -0
  679. package/dist/subagents/task-subagent-group.d.ts +36 -0
  680. package/dist/subagents/task-subagent-group.js +115 -0
  681. package/dist/subagents/task-subagent-group.js.map +1 -0
  682. package/dist/subagents/use-omitted-images-in-view.cjs +68 -0
  683. package/dist/subagents/use-omitted-images-in-view.cjs.map +1 -0
  684. package/dist/subagents/use-omitted-images-in-view.d.ts +21 -0
  685. package/dist/subagents/use-omitted-images-in-view.js +68 -0
  686. package/dist/subagents/use-omitted-images-in-view.js.map +1 -0
  687. package/dist/threads/Inbox.cjs +2 -2
  688. package/dist/threads/Inbox.cjs.map +1 -1
  689. package/dist/threads/SessionList.cjs +6 -6
  690. package/dist/threads/SessionList.cjs.map +1 -1
  691. package/dist/threads/SessionsPage.cjs +13 -7
  692. package/dist/threads/SessionsPage.cjs.map +1 -1
  693. package/dist/threads/SessionsPage.d.ts +10 -1
  694. package/dist/threads/SessionsPage.js +9 -3
  695. package/dist/threads/SessionsPage.js.map +1 -1
  696. package/dist/threads/session-list-model.cjs.map +1 -1
  697. package/dist/threads/session-list-model.d.ts +2 -1
  698. package/dist/threads/session-list-model.js.map +1 -1
  699. package/dist/threads/session-row-parts.cjs +3 -3
  700. package/dist/threads/session-row-parts.cjs.map +1 -1
  701. package/dist/threads/sessions-page-model.cjs +13 -5
  702. package/dist/threads/sessions-page-model.cjs.map +1 -1
  703. package/dist/threads/sessions-page-model.d.ts +7 -0
  704. package/dist/threads/sessions-page-model.js +11 -3
  705. package/dist/threads/sessions-page-model.js.map +1 -1
  706. package/dist/threads/sessions-page-storage.cjs +8 -8
  707. package/dist/threads/sessions-page-storage.cjs.map +1 -1
  708. package/dist/threads/sessions-page-storage.d.ts +5 -1
  709. package/dist/threads/sessions-page-storage.js +8 -8
  710. package/dist/threads/sessions-page-storage.js.map +1 -1
  711. package/dist/threads/statewire-thread-list.cjs +14 -2
  712. package/dist/threads/statewire-thread-list.cjs.map +1 -1
  713. package/dist/threads/statewire-thread-list.d.ts +11 -2
  714. package/dist/threads/statewire-thread-list.js +14 -2
  715. package/dist/threads/statewire-thread-list.js.map +1 -1
  716. package/dist/threads/use-athena-sessions.cjs +1 -0
  717. package/dist/threads/use-athena-sessions.cjs.map +1 -1
  718. package/dist/threads/use-athena-sessions.d.ts +7 -0
  719. package/dist/threads/use-athena-sessions.js +1 -0
  720. package/dist/threads/use-athena-sessions.js.map +1 -1
  721. package/dist/threads/use-athena-thread-agent.cjs +31 -0
  722. package/dist/threads/use-athena-thread-agent.cjs.map +1 -0
  723. package/dist/threads/use-athena-thread-agent.d.ts +38 -0
  724. package/dist/threads/use-athena-thread-agent.js +31 -0
  725. package/dist/threads/use-athena-thread-agent.js.map +1 -0
  726. package/dist/threads/use-athena-thread-plan-mode.cjs +18 -0
  727. package/dist/threads/use-athena-thread-plan-mode.cjs.map +1 -0
  728. package/dist/threads/use-athena-thread-plan-mode.d.ts +18 -0
  729. package/dist/threads/use-athena-thread-plan-mode.js +18 -0
  730. package/dist/threads/use-athena-thread-plan-mode.js.map +1 -0
  731. package/dist/threads/use-rest-conversation-history.d.ts +1 -0
  732. package/dist/tools/agent-creations.cjs +97 -0
  733. package/dist/tools/agent-creations.cjs.map +1 -0
  734. package/dist/tools/agent-creations.d.ts +38 -0
  735. package/dist/tools/agent-creations.js +97 -0
  736. package/dist/tools/agent-creations.js.map +1 -0
  737. package/dist/tools/agent-highlights.cjs +100 -0
  738. package/dist/tools/agent-highlights.cjs.map +1 -0
  739. package/dist/tools/agent-highlights.d.ts +57 -0
  740. package/dist/tools/agent-highlights.js +100 -0
  741. package/dist/tools/agent-highlights.js.map +1 -0
  742. package/dist/tools/append-document-tool-ui.cjs +1 -0
  743. package/dist/tools/append-document-tool-ui.cjs.map +1 -1
  744. package/dist/tools/append-document-tool-ui.d.ts +7 -0
  745. package/dist/tools/append-document-tool-ui.js +2 -1
  746. package/dist/tools/append-document-tool-ui.js.map +1 -1
  747. package/dist/tools/auto-open-tools.cjs +144 -71
  748. package/dist/tools/auto-open-tools.cjs.map +1 -1
  749. package/dist/tools/auto-open-tools.d.ts +131 -1
  750. package/dist/tools/auto-open-tools.js +145 -72
  751. package/dist/tools/auto-open-tools.js.map +1 -1
  752. package/dist/tools/browser-tool-uis.cjs +594 -0
  753. package/dist/tools/browser-tool-uis.cjs.map +1 -0
  754. package/dist/tools/browser-tool-uis.d.ts +8 -0
  755. package/dist/tools/browser-tool-uis.js +594 -0
  756. package/dist/tools/browser-tool-uis.js.map +1 -0
  757. package/dist/tools/computer-asset-tool-uis.cjs +313 -0
  758. package/dist/tools/computer-asset-tool-uis.cjs.map +1 -0
  759. package/dist/tools/computer-asset-tool-uis.d.ts +5 -0
  760. package/dist/tools/computer-asset-tool-uis.js +313 -0
  761. package/dist/tools/computer-asset-tool-uis.js.map +1 -0
  762. package/dist/tools/document-edit-tool-uis.cjs +218 -0
  763. package/dist/tools/document-edit-tool-uis.cjs.map +1 -0
  764. package/dist/tools/document-edit-tool-uis.d.ts +40 -0
  765. package/dist/tools/document-edit-tool-uis.js +218 -0
  766. package/dist/tools/document-edit-tool-uis.js.map +1 -0
  767. package/dist/tools/drive-tool-uis.cjs +429 -0
  768. package/dist/tools/drive-tool-uis.cjs.map +1 -0
  769. package/dist/tools/drive-tool-uis.d.ts +121 -0
  770. package/dist/tools/drive-tool-uis.js +429 -0
  771. package/dist/tools/drive-tool-uis.js.map +1 -0
  772. package/dist/tools/email-calendar-tool-uis.cjs +789 -0
  773. package/dist/tools/email-calendar-tool-uis.cjs.map +1 -0
  774. package/dist/tools/email-calendar-tool-uis.d.ts +129 -0
  775. package/dist/tools/email-calendar-tool-uis.js +789 -0
  776. package/dist/tools/email-calendar-tool-uis.js.map +1 -0
  777. package/dist/tools/ontology-tool-uis.cjs +83 -0
  778. package/dist/tools/ontology-tool-uis.cjs.map +1 -0
  779. package/dist/tools/ontology-tool-uis.d.ts +9 -0
  780. package/dist/tools/ontology-tool-uis.js +83 -0
  781. package/dist/tools/ontology-tool-uis.js.map +1 -0
  782. package/dist/tools/orchestration-tool-uis.cjs +586 -0
  783. package/dist/tools/orchestration-tool-uis.cjs.map +1 -0
  784. package/dist/tools/orchestration-tool-uis.d.ts +141 -0
  785. package/dist/tools/orchestration-tool-uis.js +586 -0
  786. package/dist/tools/orchestration-tool-uis.js.map +1 -0
  787. package/dist/tools/presentation-edit-tool-uis.cjs +516 -0
  788. package/dist/tools/presentation-edit-tool-uis.cjs.map +1 -0
  789. package/dist/tools/presentation-edit-tool-uis.d.ts +73 -0
  790. package/dist/tools/presentation-edit-tool-uis.js +516 -0
  791. package/dist/tools/presentation-edit-tool-uis.js.map +1 -0
  792. package/dist/tools/project-tool-uis.cjs +213 -0
  793. package/dist/tools/project-tool-uis.cjs.map +1 -0
  794. package/dist/tools/project-tool-uis.d.ts +14 -0
  795. package/dist/tools/project-tool-uis.js +213 -0
  796. package/dist/tools/project-tool-uis.js.map +1 -0
  797. package/dist/tools/sandbox-tool-uis.cjs +491 -0
  798. package/dist/tools/sandbox-tool-uis.cjs.map +1 -0
  799. package/dist/tools/sandbox-tool-uis.d.ts +116 -0
  800. package/dist/tools/sandbox-tool-uis.js +491 -0
  801. package/dist/tools/sandbox-tool-uis.js.map +1 -0
  802. package/dist/tools/sheet-query-tool-ui.cjs +138 -0
  803. package/dist/tools/sheet-query-tool-ui.cjs.map +1 -0
  804. package/dist/tools/sheet-query-tool-ui.d.ts +15 -0
  805. package/dist/tools/sheet-query-tool-ui.js +138 -0
  806. package/dist/tools/sheet-query-tool-ui.js.map +1 -0
  807. package/dist/tools/studio-screenshot-tool-uis.cjs +262 -0
  808. package/dist/tools/studio-screenshot-tool-uis.cjs.map +1 -0
  809. package/dist/tools/studio-screenshot-tool-uis.d.ts +52 -0
  810. package/dist/tools/studio-screenshot-tool-uis.js +262 -0
  811. package/dist/tools/studio-screenshot-tool-uis.js.map +1 -0
  812. package/dist/tools/subagent-task-tool-ui.cjs +24 -475
  813. package/dist/tools/subagent-task-tool-ui.cjs.map +1 -1
  814. package/dist/tools/subagent-task-tool-ui.d.ts +19 -103
  815. package/dist/tools/subagent-task-tool-ui.js +28 -479
  816. package/dist/tools/subagent-task-tool-ui.js.map +1 -1
  817. package/dist/tools/tool-summary.cjs +36 -0
  818. package/dist/tools/tool-summary.cjs.map +1 -1
  819. package/dist/tools/tool-summary.js +36 -0
  820. package/dist/tools/tool-summary.js.map +1 -1
  821. package/dist/tools/tool-uis.cjs +181 -53
  822. package/dist/tools/tool-uis.cjs.map +1 -1
  823. package/dist/tools/tool-uis.d.ts +40 -0
  824. package/dist/tools/tool-uis.js +183 -55
  825. package/dist/tools/tool-uis.js.map +1 -1
  826. package/dist/typed-interrupts/index.cjs +15 -0
  827. package/dist/typed-interrupts/index.cjs.map +1 -0
  828. package/dist/typed-interrupts/index.d.ts +20 -0
  829. package/dist/typed-interrupts/index.js +15 -0
  830. package/dist/typed-interrupts/index.js.map +1 -0
  831. package/dist/version.cjs +4 -0
  832. package/dist/version.cjs.map +1 -1
  833. package/dist/version.d.ts +9 -0
  834. package/dist/version.js +4 -0
  835. package/dist/version.js.map +1 -1
  836. package/dist/workbench/live-desktop-api.cjs +2 -1
  837. package/dist/workbench/live-desktop-api.cjs.map +1 -1
  838. package/dist/workbench/live-desktop-api.js +2 -1
  839. package/dist/workbench/live-desktop-api.js.map +1 -1
  840. package/dist/workbench/session-workbench-panes.cjs +6 -6
  841. package/dist/workbench/session-workbench-panes.cjs.map +1 -1
  842. package/dist/workbench/session-workspace-api.cjs +7 -2
  843. package/dist/workbench/session-workspace-api.cjs.map +1 -1
  844. package/dist/workbench/session-workspace-api.d.ts +10 -0
  845. package/dist/workbench/session-workspace-api.js +7 -2
  846. package/dist/workbench/session-workspace-api.js.map +1 -1
  847. package/package.json +28 -6
  848. package/dist/agent-runtime/src/chat-outbox-store.cjs +0 -510
  849. package/dist/agent-runtime/src/chat-outbox-store.cjs.map +0 -1
  850. package/dist/agent-runtime/src/chat-outbox-store.d.ts +0 -210
  851. package/dist/agent-runtime/src/chat-outbox-store.js +0 -510
  852. package/dist/agent-runtime/src/chat-outbox-store.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"mention-chip.cjs","sources":["../../../src/chat-ui/mentions/mention-chip.tsx"],"sourcesContent":["/**\n * Mention chip rendering for message display.\n *\n * Parses [@name](mention://type?...) markdown links and renders them\n * as styled inline chips matching the Olympus mention style.\n * Used in both user messages (inline text) and assistant messages (markdown links).\n */\n\nimport {\n isValidElement,\n useContext,\n useState,\n type FC,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport {\n formatScreenPoint,\n isScreenPointHref,\n parseScreenPointHref,\n} from \"@athenaintel/agent-runtime\";\nimport {\n type AssetReference,\n decodeFromAssetMentionUri,\n decodeFromAssetSpacesUrl,\n encodeToAssetSpacesUrl,\n formatReferenceAnchor,\n} from \"@athenaintel/references/asset-links\";\nimport {\n CrosshairIcon,\n DatabaseIcon,\n FileCodeIcon,\n FileIcon,\n FileTextIcon,\n FolderIcon,\n Globe2Icon,\n HeadphonesIcon,\n ImageIcon,\n type LucideIcon,\n MailIcon,\n MessageSquareIcon,\n MonitorIcon,\n PresentationIcon,\n SheetIcon,\n UserIcon,\n VideoIcon,\n} from \"lucide-react\";\nimport { cn } from \"../../lib/utils\";\nimport { createOlympusAssetUrl } from \"../lib/asset-urls\";\nimport { MentionAuthCtx } from \"./suggestions/data/api-client\";\nimport { assetTypeToThumb } from \"./suggestions/data/sources/asset-type-icons\";\nimport { useMemberAvatarUrl } from \"./use-member-avatar\";\nimport { useMentionAsset } from \"./use-mention-asset\";\n\nconst SPACES_MENTION_PATH = /\\/dashboard\\/spaces\\/?\\?/;\n\nfunction isSpacesMentionUrl(url: string): boolean {\n return SPACES_MENTION_PATH.test(url);\n}\n\nfunction getSpacesAssetType(url: URL): string | null {\n const assetType =\n url.searchParams.get(\"assetType\") ||\n url.searchParams.get(\"asset_type\") ||\n url.searchParams.get(\"type\");\n return assetType === \"sheet\" ? \"spreadsheet\" : assetType;\n}\n\n/**\n * Where in the asset a citation points, as its chip shows it. The anchor is\n * read and labelled by `@athenaintel/references` — the same parser and labels\n * Olympus's mention chips use — so a chip reads `jwt.py:12-25`, `p.5` or\n * `Slide 3` in every Athena chat.\n */\nexport interface MentionChipCitation {\n /** The anchor type (`page`, `file_line_range`, `slide`, …). */\n anchorType: string;\n /** The short label drawn after the name (`p.5`, `jwt.py:12-25`). */\n label: string;\n /**\n * The place spelled out (`Page 5`, `agora/…/jwt.py:12-25`), without the\n * excerpt: the tooltip when the link carries no excerpt, and part of the\n * chip's accessible name when it holds a word.\n */\n description: string;\n}\n\n/** The citation an asset link's anchor names, or undefined for a plain mention or an anchor nobody can read. */\nfunction citationOf(reference: AssetReference): MentionChipCitation | undefined {\n const { anchor, meta } = reference;\n if (!anchor) return undefined;\n const label = formatReferenceAnchor(anchor, \"short\", meta);\n if (!label) return undefined;\n const { excerpt: _excerpt, ...place } = meta ?? {};\n return {\n anchorType: anchor.type,\n label,\n description: formatReferenceAnchor(anchor, \"long\", place) ?? label,\n };\n}\n\n/**\n * The chip's icon for an asset type when the host serves no asset-type SVGs.\n * A compact set on purpose: the chip renders in every message (and Olympus's\n * main layout reaches it through the queued-message tray), so it carries a\n * dozen icons rather than the `@` menu's whole map.\n */\nconst ASSET_CHIP_ICONS: Record<string, LucideIcon> = {\n document: FileTextIcon,\n word_document: FileTextIcon,\n markdown: FileTextIcon,\n txt: FileTextIcon,\n pdf: FileTextIcon,\n spreadsheet: SheetIcon,\n table: SheetIcon,\n presentation: PresentationIcon,\n powerpoint_deck: PresentationIcon,\n presentation_pptx_studio: PresentationIcon,\n pptx: PresentationIcon,\n image: ImageIcon,\n figure: ImageIcon,\n canvas: ImageIcon,\n video: VideoIcon,\n meeting: VideoIcon,\n video_session: VideoIcon,\n audio: HeadphonesIcon,\n voice_memo: HeadphonesIcon,\n phone_call: HeadphonesIcon,\n email: MailIcon,\n email_message: MailIcon,\n live_email_thread: MailIcon,\n live_calendar_event: MailIcon,\n python: FileCodeIcon,\n javascript: FileCodeIcon,\n typescript: FileCodeIcon,\n json: FileCodeIcon,\n yaml: FileCodeIcon,\n database: DatabaseIcon,\n catalog: DatabaseIcon,\n drive: DatabaseIcon,\n dataset: DatabaseIcon,\n semantic_model: DatabaseIcon,\n query_snippet: DatabaseIcon,\n folder: FolderIcon,\n gdrive_folder: FolderIcon,\n project: FolderIcon,\n collection: FolderIcon,\n session: MessageSquareIcon,\n computer: MonitorIcon,\n desktop_session: MonitorIcon,\n user_interface: MonitorIcon,\n application: MonitorIcon,\n html: Globe2Icon,\n web_page: Globe2Icon,\n browse_session: Globe2Icon,\n};\n\nfunction assetChipIcon(assetType: string | undefined): LucideIcon {\n return (assetType && ASSET_CHIP_ICONS[assetType.toLowerCase()]) || FileIcon;\n}\n\n/**\n * GitHub's mark (Octicons `mark-github`), drawn by a repository file's\n * citation. Lucide carries no brand icons and an SDK app serves none of\n * Olympus's, so the chip brings its own. Only a GitHub repository catalog\n * serves `file_line_range` anchors (`ASSET_ANCHOR_REGISTRY`; agora's\n * `_CATALOG_ANCHORS_BY_PROVIDER`), so the anchor alone names the provider.\n */\nfunction GitHubMarkIcon({ className }: { className?: string }) {\n return (\n <svg\n viewBox=\"0 0 16 16\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n className={className}\n data-chip-icon=\"github\"\n >\n <path d=\"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z\" />\n </svg>\n );\n}\n\n/** Past this many characters a place may not show whole in the chip, so the tooltip spells it out. */\nconst PLACE_FITS_CHARS = 20;\n\n/** `route.ts:18-24` as the file's name and its lines, so a long name shortens while its lines stay. */\nfunction splitFileLines(label: string): { file: string; lines: string } {\n const colon = label.lastIndexOf(\":\");\n return colon > 0\n ? { file: label.slice(0, colon), lines: label.slice(colon) }\n : { file: label, lines: \"\" };\n}\n\n/**\n * Whether a name already says where its citation points: the place's label or\n * its spelled-out form, or a name ending in the label (`Q4 report p.5`,\n * `olympus/…/route.ts:18-24`). The chip then draws the place once.\n */\nfunction restatesPlace(name: string, citation: MentionChipCitation): boolean {\n const said = name.trim().toLowerCase();\n const label = citation.label.toLowerCase();\n return said === label || said === citation.description.toLowerCase() || said.endsWith(label);\n}\n\n/**\n * The link's own label when it tells the reader something the chip does not\n * already show: not the place again (a path, `file:lines`), not the asset's\n * name. The tooltip keeps it, since the chip shows the asset and the place.\n */\nfunction informativeLabel({\n label,\n shown,\n citation,\n}: {\n label: string;\n shown: readonly (string | null | undefined)[];\n citation: MentionChipCitation | undefined;\n}): string | null {\n const trimmed = label.trim();\n if (!trimmed || !SPEAKABLE.test(trimmed)) return null;\n if (PLACEHOLDER_LABELS.has(trimmed.toLowerCase())) return null;\n if (citation && restatesPlace(trimmed, citation)) return null;\n // Every word of it already shown (`Tesla Q3 report` beside `Tesla Q3\n // Earnings Report`, `demo-app-monorepo` beside the repository's title).\n const shownWords = new Set(\n [...shown, citation?.description].flatMap((text) => (text ? wordsOf(text) : [])),\n );\n return wordsOf(trimmed).every((word) => shownWords.has(word)) ? null : trimmed;\n}\n\nfunction wordsOf(text: string): string[] {\n return text.toLowerCase().match(/[\\p{L}\\p{N}]+/gu) ?? [];\n}\n\n/** A label with a letter or digit in it; `§` or `•` alone says nothing read aloud. */\nconst SPEAKABLE = /[\\p{L}\\p{N}]/u;\n\n/** Labels that name nothing: agora's read_asset citations all read `Citation`. */\nconst PLACEHOLDER_LABELS: ReadonlySet<string> = new Set([\"citation\", \"source\", \"link\", \"here\"]);\n\n/** The asset reference an asset link decodes to, or null when it does not parse. */\nfunction decodeAssetLink(\n url: URL,\n decode: (url: URL) => AssetReference,\n): AssetReference | null {\n try {\n return decode(url);\n } catch {\n return null;\n }\n}\n\n// ── Mention link component for markdown renderer ──\n\n/**\n * Custom <a> renderer for MarkdownTextPrimitive.\n * Intercepts mention:// links and renders them as chips.\n * Falls through to a normal link for non-mention URLs.\n */\nfunction personEmailForMention(\n parsed: ReturnType<typeof parseMentionUrl>,\n): string | undefined {\n if (parsed.type !== \"person\") return undefined;\n return parsed.email || (parsed.id.includes(\"@\") ? parsed.id : undefined);\n}\n\n/**\n * The text a link's children read as. Markdown can hand a link several children, some of them\n * elements (an escaped `_` or a `*` in a URL splits its text), and stringifying an element gives\n * `[object Object]`.\n */\nfunction textOf(node: ReactNode): string {\n if (typeof node === \"string\" || typeof node === \"number\") return String(node);\n if (Array.isArray(node)) return node.map(textOf).join(\"\");\n if (isValidElement<{ children?: ReactNode }>(node)) return textOf(node.props.children);\n return \"\";\n}\n\nexport const MentionLink: FC<{\n href?: string;\n children?: ReactNode;\n interactive?: boolean;\n}> = ({ href, children, interactive = true }) => {\n if (\n href &&\n (href.startsWith(\"mention://\") || isSpacesMentionUrl(href))\n ) {\n const name = textOf(children).trim().replace(/^@/, \"\");\n\n const parsed = parseMentionUrl(href);\n\n return (\n <MentionChip\n name={name || parsed.name}\n type={parsed.type}\n personEmail={personEmailForMention(parsed)}\n assetIds={parsed.assetIds}\n assetType={parsed.assetType}\n citation={parsed.citation}\n thumbnailUrl={parsed.thumbnailUrl}\n sourceHref={isSpacesMentionUrl(href) ? href : parsed.sourceHref}\n interactive={interactive}\n />\n );\n }\n\n if (href?.startsWith(\"chrome-extension://\")) {\n return <span>{children}</span>;\n }\n\n if (isScreenPointHref(href)) {\n return <ScreenPointChip href={href}>{children}</ScreenPointChip>;\n }\n\n // Normal link — render as-is\n return (\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </a>\n );\n};\n\n// ── The chip pill ──\n\n/**\n * Olympus's mention pill (`mentionPillClassName`: 20px high, 16px icon, the\n * place in `text-xs`) in the provider's theme tokens, so a dark theme keeps it\n * legible, and `box-border` so its height holds without a host's CSS reset.\n * Every chat chip draws it: an asset or citation chip, a web source, a screen\n * point. Only stock Tailwind sizes: Olympus renders these chips (the queued\n * message tray) with a stylesheet that does not scan this package, so an\n * arbitrary value would reach it unstyled. `not-prose` matters: assistant\n * messages render inside Tailwind Typography's `prose`, whose\n * zero-specificity `img` margins (~1.7em top/bottom) would otherwise inflate\n * the chip's icon into a tall card that breaks the sentence flow around it.\n */\nexport const CHIP_PILL_CLASS =\n \"not-prose box-border inline-flex h-5 items-center gap-1.5 whitespace-nowrap rounded-md border border-border bg-muted px-1 py-0.5 align-middle font-normal leading-none text-foreground no-underline\";\n/** A chip that opens something. */\nexport const CHIP_LINK_CLASS =\n \"cursor-pointer transition-colors hover:bg-accent hover:text-accent-foreground hover:no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1\";\nexport const CHIP_ICON_CLASS = \"size-4 shrink-0\";\n\n// ── Inline screen-point chip ──\n\n/**\n * Renders an `athena-point://` link as a non-navigating coordinate chip.\n * Surfaces without screenshot context (extension side panel, SDK consumers)\n * get the label plus the coordinates; malformed points fall back to text.\n */\nexport const ScreenPointChip: FC<{\n href: string;\n children?: ReactNode;\n}> = ({ href, children }) => {\n const parsed = parseScreenPointHref(href);\n if (!parsed.ok) {\n return <span>{children}</span>;\n }\n const description = formatScreenPoint(parsed.point);\n return (\n <span\n className={cn(CHIP_PILL_CLASS, \"max-w-[260px]\")}\n title={description}\n aria-label={description}\n data-screen-point=\"valid\"\n >\n <CrosshairIcon className={CHIP_ICON_CLASS} aria-hidden=\"true\" />\n <span className=\"min-w-0 max-w-[180px] overflow-hidden text-ellipsis\">\n {children}\n </span>\n <span className=\"shrink-0 text-xs text-muted-foreground\">\n {parsed.point.x}, {parsed.point.y}\n </span>\n </span>\n );\n};\n\n// ── Inline mention chip ──\n\nexport const MentionChip: FC<{\n name: string;\n type?: string;\n assetIds?: string[];\n /** The asset's type (`document`, `catalog`, …): picks the icon until (or unless) the asset is looked up. */\n assetType?: string;\n /** Where in the asset the link points: its label follows the name. */\n citation?: MentionChipCitation;\n personEmail?: string;\n thumbnailUrl?: string;\n sourceHref?: string;\n interactive?: boolean;\n}> = ({\n name,\n type,\n assetIds,\n assetType,\n citation,\n personEmail,\n thumbnailUrl,\n sourceHref,\n interactive = true,\n}) => {\n const auth = useContext(MentionAuthCtx);\n const memberAvatarUrl = useMemberAvatarUrl(personEmail);\n const [erroredAvatarUrl, setErroredAvatarUrl] = useState<string>();\n const excerpt = sourceHref ? readSourceExcerpt(sourceHref) : null;\n // A repository file's lines read as the file (`route.ts:18-24`): the chip\n // opens that file, and every citation in a reply names the same repository,\n // whatever label the model wrote.\n const repositoryFile =\n citation?.anchorType === \"file_line_range\"\n ? { ...splitFileLines(citation.label), label: citation.label }\n : null;\n // The asset as agora has it, read the way Olympus's chips read it: its own\n // title and type. Until it answers, and for an asset the viewer cannot read,\n // the link's label and `type=` stand in. Not asked for a repository file,\n // which reads as its file whatever the catalog is called.\n const asset = useMentionAsset(\n type === \"asset\" && assetIds?.length === 1 && !repositoryFile ? assetIds[0] : undefined,\n );\n const assetTitle = asset?.title || null;\n const chipName = repositoryFile?.label ?? assetTitle ?? name;\n // The place follows a name that does not already say it, as `[p.5]`.\n const placeLabel =\n citation && !repositoryFile && !restatesPlace(chipName, citation)\n ? citation.label\n : null;\n // The tooltip: what the model called it (when the chip does not show it),\n // the repository a file is in and the file's whole path, the cited passage.\n // The place spelled out stands in for a passage the citation does not carry,\n // and for a place too long to show whole (a long sheet name).\n const tooltip =\n citation || excerpt\n ? tooltipText({\n lines: [\n informativeLabel({ label: name, shown: [chipName, assetTitle], citation }),\n repositoryFile ? assetTitle : null,\n repositoryFile || !excerpt || (placeLabel?.length ?? 0) > PLACE_FITS_CHARS\n ? citation?.description\n : null,\n ],\n excerpt,\n })\n : null;\n const assetRootHref =\n type === \"asset\" && assetIds?.length\n ? createOlympusAssetUrl({\n appUrl: auth?.appUrl,\n backendUrl: auth?.backendUrl,\n assetIds,\n })\n : null;\n const href = (() => {\n if (!assetRootHref || !sourceHref) return assetRootHref;\n try {\n const source = new URL(sourceHref, \"https://app.athenaintel.com\");\n const destination = new URL(assetRootHref);\n for (const [key, value] of source.searchParams) {\n destination.searchParams.set(key, value);\n }\n destination.searchParams.set(\"asset_ids\", assetIds?.join(\",\") ?? \"\");\n return destination.toString();\n } catch {\n return assetRootHref;\n }\n })();\n const className = cn(CHIP_PILL_CLASS, \"max-w-[275px]\", href && CHIP_LINK_CLASS);\n // A host's asset-type SVG follows the looked-up type, when it serves them.\n const chipThumbnailUrl = repositoryFile\n ? undefined\n : (asset?.assetType && assetTypeToThumb(asset.assetType)) || thumbnailUrl;\n const AssetIcon = assetChipIcon(asset?.assetType || assetType);\n const contents = (\n <>\n {repositoryFile ? (\n <GitHubMarkIcon className={CHIP_ICON_CLASS} />\n ) : chipThumbnailUrl ? (\n <img\n src={chipThumbnailUrl}\n alt=\"\"\n className={CHIP_ICON_CLASS}\n draggable={false}\n />\n ) : type === \"asset\" || type === \"folder\" ? (\n // A host that bundles no asset-type SVGs (computer apps, most SDK\n // apps) still gets the type's icon.\n <AssetIcon className={CHIP_ICON_CLASS} aria-hidden=\"true\" />\n ) : type === \"webpage\" ? (\n <Globe2Icon className={CHIP_ICON_CLASS} aria-hidden=\"true\" />\n ) : type === \"person\" ? (\n memberAvatarUrl && erroredAvatarUrl !== memberAvatarUrl ? (\n <img\n src={memberAvatarUrl}\n alt=\"\"\n className={cn(CHIP_ICON_CLASS, \"rounded-full object-cover\")}\n draggable={false}\n onError={() => setErroredAvatarUrl(memberAvatarUrl)}\n />\n ) : (\n <UserIcon className={CHIP_ICON_CLASS} aria-hidden=\"true\" />\n )\n ) : null}\n {repositoryFile ? (\n <span\n className=\"flex min-w-0 items-center\"\n data-citation-anchor=\"file_line_range\"\n >\n <span className=\"min-w-0 overflow-hidden text-ellipsis\">\n {repositoryFile.file}\n </span>\n <span className=\"shrink-0 text-muted-foreground\">{repositoryFile.lines}</span>\n </span>\n ) : (\n <span\n className={cn(\n \"max-w-[180px] overflow-hidden text-ellipsis\",\n // A long place may shorten the name, never make it vanish.\n placeLabel && \"min-w-8\",\n )}\n >\n {chipName}\n </span>\n )}\n {citation && placeLabel && (\n <>\n {/* Copied or read as text, the place stays a word apart from the name; a flex row draws no space. */}{\" \"}\n <span\n className=\"flex min-w-0 items-center text-xs text-muted-foreground\"\n data-citation-anchor={citation.anchorType}\n >\n [<span className=\"min-w-0 overflow-hidden text-ellipsis\">{placeLabel}</span>]\n </span>\n </>\n )}\n </>\n );\n\n if (href && interactive) {\n const speakablePlace = citation && SPEAKABLE.test(citation.description);\n return (\n <a\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={className}\n aria-label={\n repositoryFile && citation\n ? `Open ${citation.description} in Spaces`\n : placeLabel && citation && speakablePlace\n ? `Open ${chipName} at ${citation.description} in Spaces`\n : `Open ${chipName} in Spaces`\n }\n title={tooltip ?? `Open ${chipName} in Spaces`}\n data-excerpt={excerpt ?? undefined}\n // The asset without its place: what a click names the opened asset.\n data-mention-name={repositoryFile ? (assetTitle ?? name) : chipName}\n >\n {contents}\n </a>\n );\n }\n\n return (\n <span\n className={className}\n title={tooltip ?? undefined}\n data-excerpt={excerpt ?? undefined}\n >\n {contents}\n </span>\n );\n};\n\n/**\n * A chip's tooltip: the lines that say something, each once, then the cited\n * passage, quoted when it shares the tooltip with other lines.\n */\nfunction tooltipText({\n lines,\n excerpt,\n}: {\n lines: readonly (string | null | undefined)[];\n excerpt: string | null;\n}): string | null {\n const kept: string[] = [];\n for (const line of lines) {\n const trimmed = line?.trim();\n if (trimmed && !kept.includes(trimmed)) kept.push(trimmed);\n }\n if (excerpt) kept.push(kept.length ? `“${excerpt}”` : excerpt);\n return kept.length ? kept.join(\"\\n\") : null;\n}\n\n/** The `excerpt` a Spaces citation URL carries, or null. */\nfunction readSourceExcerpt(href: string): string | null {\n try {\n const excerpt = new URL(href, \"https://app.athenaintel.com\").searchParams\n .get(\"excerpt\")\n ?.trim();\n return excerpt ? excerpt : null;\n } catch {\n return null;\n }\n}\n\n/**\n * The label an asset citation chip falls back to when the model wrote none\n * (`[](…/spaces/?asset_ids=…&page=5)`): the cited location, else \"Asset\" — a\n * chip must never render as an empty box.\n */\nfunction citationFallbackLabel(params: URLSearchParams): string {\n const start = params.get(\"start_page\") ?? params.get(\"page\");\n const end = params.get(\"end_page\");\n if (start && end && end !== start) return `Pages ${start}–${end}`;\n if (start) return `Page ${start}`;\n return \"Asset\";\n}\n\n// ── Parse mention:// URLs ──\n\nexport function parseMentionUrl(url: string): {\n type: string;\n name: string;\n id: string;\n email?: string;\n assetIds?: string[];\n assetType?: string;\n citation?: MentionChipCitation;\n /**\n * For a `mention://asset` citation, the Spaces link to its place (anchor and\n * excerpt), so the chip opens there; a Spaces mention is its own link.\n */\n sourceHref?: string;\n thumbnailUrl?: string;\n} {\n try {\n if (isSpacesMentionUrl(url)) {\n const parsed = new URL(url, \"https://app.athenaintel.com\");\n const assetIds = (parsed.searchParams.get(\"asset_ids\") ?? \"\")\n .split(\",\")\n .map((id) => id.trim())\n .filter(Boolean);\n const id = assetIds[0] ?? \"\";\n const assetType = getSpacesAssetType(parsed);\n // A link to several assets names no one place in any of them.\n const reference =\n assetIds.length === 1\n ? decodeAssetLink(parsed, decodeFromAssetSpacesUrl)\n : null;\n const citation = reference ? citationOf(reference) : undefined;\n return {\n type: \"asset\",\n name:\n assetIds.length > 1\n ? `${assetIds.length} assets`\n : (citation?.description ??\n citationFallbackLabel(parsed.searchParams)),\n id,\n assetIds,\n assetType: assetType ?? undefined,\n citation,\n thumbnailUrl: assetTypeToThumb(assetType),\n };\n }\n // mention://tool?name=...&description=...\n // mention://asset?id=...&assetType=project&thumb=../icons/files/ic-project.svg\n const u = new URL(url);\n const type = u.hostname || u.pathname.replace(/^\\/\\//, \"\").split(\"?\")[0];\n const isWebpage = type === \"webpage\";\n const id = isWebpage\n ? u.searchParams.get(\"tab_id\") || \"\"\n : u.searchParams.get(\"id\") || u.searchParams.get(\"name\") || \"\";\n const name = isWebpage\n ? u.searchParams.get(\"title\") || \"This webpage\"\n : u.searchParams.get(\"name\") || id;\n\n // Get thumbnail: prefer explicit thumb param, then derive from assetType\n let thumbnailUrl = u.searchParams.get(\"thumb\") || undefined;\n if (!thumbnailUrl) {\n const assetType = u.searchParams.get(\"assetType\");\n if (assetType) {\n thumbnailUrl = assetTypeToThumb(assetType);\n } else if (type === \"asset\" || type === \"folder\") {\n thumbnailUrl = assetTypeToThumb(type === \"folder\" ? \"folder\" : null);\n }\n }\n\n const reference =\n type === \"asset\" ? decodeAssetLink(u, decodeFromAssetMentionUri) : null;\n\n return {\n type,\n name,\n id,\n email: type === \"person\" ? u.searchParams.get(\"email\") || undefined : undefined,\n assetIds: type === \"asset\" && id ? [id] : undefined,\n assetType:\n type === \"asset\" || type === \"folder\"\n ? u.searchParams.get(\"assetType\") ||\n reference?.meta?.assetType ||\n (type === \"folder\" ? \"folder\" : undefined)\n : undefined,\n citation: reference ? citationOf(reference) : undefined,\n sourceHref:\n reference && (reference.anchor || reference.meta?.excerpt)\n ? encodeToAssetSpacesUrl(reference)\n : undefined,\n thumbnailUrl,\n };\n } catch {\n return { type: \"unknown\", name: \"\", id: \"\" };\n }\n}\n\nfunction htmlAttribute(attributes: string, name: string): string | null {\n const escapedName = name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const match = new RegExp(\n `(?:^|\\\\s)${escapedName}\\\\s*=\\\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\\\s>]+))`,\n \"i\",\n ).exec(attributes);\n return match?.[1] ?? match?.[2] ?? match?.[3] ?? null;\n}\n\nfunction decodeHtmlAttribute(value: string): string {\n return value\n .replace(/&amp;/gi, \"&\")\n .replace(/&quot;/gi, '\"')\n .replace(/&#39;|&apos;/gi, \"'\")\n .replace(/&lt;/gi, \"<\")\n .replace(/&gt;/gi, \">\");\n}\n\n/** Turn complete model-emitted URL citation anchors into safe Markdown links. */\nexport function normalizeAthenaMentionHtml(text: string): string {\n return text.replace(\n /<a\\b([^>]*)>([\\s\\S]*?)<\\/a>/gi,\n (original, attributes: string, rawLabel: string) => {\n const className = htmlAttribute(attributes, \"class\") ?? \"\";\n const type = htmlAttribute(attributes, \"data-type\") ?? \"\";\n if (!className.split(/\\s+/).includes(\"mention\") || type !== \"url\") {\n return original;\n }\n\n const rawUrl =\n htmlAttribute(attributes, \"data-url\") ??\n htmlAttribute(attributes, \"href\");\n if (!rawUrl) return original;\n const url = decodeHtmlAttribute(rawUrl);\n let normalizedUrl: string;\n try {\n const parsed = new URL(url);\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n return original;\n }\n normalizedUrl = parsed.toString();\n } catch {\n return original;\n }\n\n const label = decodeHtmlAttribute(rawLabel.replace(/<[^>]*>/g, \"\"))\n .trim()\n .replace(/([\\\\[\\]])/g, \"\\\\$1\");\n return label ? `[${label}](<${normalizedUrl}>)` : original;\n },\n );\n}\n// ── Parse mention markdown in plain text ──\n\n// The label may hold balanced brackets one level deep (`[@Plan [Q3]](…)`) or a lone `[`.\nconst MENTION_RE =\n /\\[@((?:\\[[^[\\]]*\\](?!\\((?:[a-z][a-z0-9+.-]*:\\/\\/|\\/))|[^\\]])*)\\]\\(((?:mention:\\/\\/|(?:https?:\\/\\/[^)\\s]+)?\\/dashboard\\/spaces\\/?\\?)[^)]+)\\)/g;\n\n/**\n * Parse text containing [@name](mention://...) patterns into\n * an array of string segments and MentionChip elements.\n */\nexport function parseMentionsInText(text: string): (string | ReactElement)[] {\n const parts: (string | ReactElement)[] = [];\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n MENTION_RE.lastIndex = 0;\n\n while ((match = MENTION_RE.exec(text)) !== null) {\n if (match.index > lastIndex) {\n parts.push(text.slice(lastIndex, match.index));\n }\n\n const name = match[1];\n const url = match[2];\n const parsed = parseMentionUrl(url);\n\n parts.push(\n <MentionChip\n key={`mention-${match.index}`}\n name={name || parsed.name}\n type={parsed.type}\n personEmail={personEmailForMention(parsed)}\n assetIds={parsed.assetIds}\n assetType={parsed.assetType}\n citation={parsed.citation}\n thumbnailUrl={parsed.thumbnailUrl}\n sourceHref={isSpacesMentionUrl(url) ? url : parsed.sourceHref}\n />\n );\n\n lastIndex = match.index + match[0].length;\n }\n\n if (lastIndex < text.length) {\n parts.push(text.slice(lastIndex));\n }\n\n return parts.length > 0 ? parts : [text];\n}\n\n/** The text as a reader sees it: each `[@name](…)` mention becomes `@name`. */\nexport function mentionsToPlainText(text: string): string {\n return text.replace(MENTION_RE, (_match, name: string, url: string) => {\n return `@${name || parseMentionUrl(url).name}`;\n });\n}\n"],"names":["formatReferenceAnchor","FileTextIcon","SheetIcon","PresentationIcon","ImageIcon","VideoIcon","HeadphonesIcon","MailIcon","FileCodeIcon","DatabaseIcon","FolderIcon","MessageSquareIcon","MonitorIcon","Globe2Icon","FileIcon","jsx","isValidElement","isScreenPointHref","parseScreenPointHref","formatScreenPoint","jsxs","cn","CrosshairIcon","useContext","MentionAuthCtx","useMemberAvatarUrl","useState","useMentionAsset","createOlympusAssetUrl","assetTypeToThumb","Fragment","UserIcon","id","reference","decodeFromAssetSpacesUrl","decodeFromAssetMentionUri","encodeToAssetSpacesUrl"],"mappings":";;;;;;;;;;;;;;;AAsDA,MAAM,sBAAsB;AAE5B,SAAS,mBAAmB,KAAsB;AAChD,SAAO,oBAAoB,KAAK,GAAG;AACrC;AAEA,SAAS,mBAAmB,KAAyB;AACnD,QAAM,YACJ,IAAI,aAAa,IAAI,WAAW,KAChC,IAAI,aAAa,IAAI,YAAY,KACjC,IAAI,aAAa,IAAI,MAAM;AAC7B,SAAO,cAAc,UAAU,gBAAgB;AACjD;AAsBA,SAAS,WAAW,WAA4D;AAC9E,QAAM,EAAE,QAAQ,KAAA,IAAS;AACzB,MAAI,CAAC,OAAQ,QAAO;AACpB,QAAM,QAAQA,OAAAA,sBAAsB,QAAQ,SAAS,IAAI;AACzD,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,EAAE,SAAS,UAAU,GAAG,MAAA,IAAU,QAAQ,CAAA;AAChD,SAAO;AAAA,IACL,YAAY,OAAO;AAAA,IACnB;AAAA,IACA,aAAaA,OAAAA,sBAAsB,QAAQ,QAAQ,KAAK,KAAK;AAAA,EAAA;AAEjE;AAQA,MAAM,mBAA+C;AAAA,EACnD,UAAUC,YAAAA;AAAAA,EACV,eAAeA,YAAAA;AAAA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;;;;;;;;;"}
1
+ {"version":3,"file":"mention-chip.cjs","sources":["../../../src/chat-ui/mentions/mention-chip.tsx"],"sourcesContent":["/**\n * Mention chip rendering for message display.\n *\n * Parses [@name](mention://type?...) markdown links and renders them\n * as styled inline chips matching the Olympus mention style.\n * Used in both user messages (inline text) and assistant messages (markdown links).\n */\n\nimport {\n isValidElement,\n useContext,\n useState,\n type FC,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport {\n formatScreenPoint,\n isScreenPointHref,\n parseScreenPointHref,\n} from \"@athenaintel/agent-runtime\";\nimport {\n type AssetReference,\n decodeFromAssetMentionUri,\n decodeFromAssetSpacesUrl,\n encodeToAssetSpacesUrl,\n formatReferenceAnchor,\n} from \"@athenaintel/references/asset-links\";\nimport {\n CrosshairIcon,\n DatabaseIcon,\n FileCodeIcon,\n FileIcon,\n FileTextIcon,\n FolderIcon,\n Globe2Icon,\n HeadphonesIcon,\n ImageIcon,\n type LucideIcon,\n MailIcon,\n MessageSquareIcon,\n MonitorIcon,\n PresentationIcon,\n SheetIcon,\n UserIcon,\n UsersIcon,\n VideoIcon,\n} from \"lucide-react\";\nimport { cn } from \"../../lib/utils\";\nimport { createOlympusAssetUrl } from \"../lib/asset-urls\";\nimport { MentionAuthCtx } from \"./suggestions/data/api-client\";\nimport { assetTypeToThumb } from \"./suggestions/data/sources/asset-type-icons\";\nimport { useAssetIconAppUrl } from \"./use-asset-icon-app-url\";\nimport { useThumbnailLoadFailure } from \"./suggestions/components/mention-icon\";\nimport { useMemberAvatarUrl } from \"./use-member-avatar\";\nimport { useMentionAsset } from \"./use-mention-asset\";\n\nconst SPACES_MENTION_PATH = /\\/dashboard\\/spaces\\/?\\?/;\n\nfunction isSpacesMentionUrl(url: string): boolean {\n return SPACES_MENTION_PATH.test(url);\n}\n\nfunction getSpacesAssetType(url: URL): string | null {\n const assetType =\n url.searchParams.get(\"assetType\") ||\n url.searchParams.get(\"asset_type\") ||\n url.searchParams.get(\"type\");\n return assetType === \"sheet\" ? \"spreadsheet\" : assetType;\n}\n\n/**\n * Where in the asset a citation points, as its chip shows it. The anchor is\n * read and labelled by `@athenaintel/references` — the same parser and labels\n * Olympus's mention chips use — so a chip reads `jwt.py:12-25`, `p.5` or\n * `Slide 3` in every Athena chat.\n */\nexport interface MentionChipCitation {\n /** The anchor type (`page`, `file_line_range`, `slide`, …). */\n anchorType: string;\n /** The short label drawn after the name (`p.5`, `jwt.py:12-25`). */\n label: string;\n /**\n * The place spelled out (`Page 5`, `agora/…/jwt.py:12-25`), without the\n * excerpt: the tooltip when the link carries no excerpt, and part of the\n * chip's accessible name when it holds a word.\n */\n description: string;\n}\n\n/** The citation an asset link's anchor names, or undefined for a plain mention or an anchor nobody can read. */\nfunction citationOf(reference: AssetReference): MentionChipCitation | undefined {\n const { anchor, meta } = reference;\n if (!anchor) return undefined;\n const label = formatReferenceAnchor(anchor, \"short\", meta);\n if (!label) return undefined;\n const { excerpt: _excerpt, ...place } = meta ?? {};\n return {\n anchorType: anchor.type,\n label,\n description: formatReferenceAnchor(anchor, \"long\", place) ?? label,\n };\n}\n\n/**\n * The chip's icon for an asset type when its SVG is not available (no icon\n * source, or the SVG failed to load).\n * A compact set on purpose: the chip renders in every message (and Olympus's\n * main layout reaches it through the queued-message tray), so it carries a\n * dozen icons rather than the `@` menu's whole map.\n */\nconst ASSET_CHIP_ICONS: Record<string, LucideIcon> = {\n document: FileTextIcon,\n word_document: FileTextIcon,\n markdown: FileTextIcon,\n txt: FileTextIcon,\n pdf: FileTextIcon,\n spreadsheet: SheetIcon,\n table: SheetIcon,\n presentation: PresentationIcon,\n powerpoint_deck: PresentationIcon,\n presentation_pptx_studio: PresentationIcon,\n pptx: PresentationIcon,\n image: ImageIcon,\n figure: ImageIcon,\n canvas: ImageIcon,\n video: VideoIcon,\n meeting: VideoIcon,\n video_session: VideoIcon,\n audio: HeadphonesIcon,\n voice_memo: HeadphonesIcon,\n phone_call: HeadphonesIcon,\n email: MailIcon,\n email_message: MailIcon,\n live_email_thread: MailIcon,\n live_calendar_event: MailIcon,\n python: FileCodeIcon,\n javascript: FileCodeIcon,\n typescript: FileCodeIcon,\n json: FileCodeIcon,\n yaml: FileCodeIcon,\n database: DatabaseIcon,\n catalog: DatabaseIcon,\n drive: DatabaseIcon,\n dataset: DatabaseIcon,\n semantic_model: DatabaseIcon,\n query_snippet: DatabaseIcon,\n folder: FolderIcon,\n gdrive_folder: FolderIcon,\n project: FolderIcon,\n collection: FolderIcon,\n session: MessageSquareIcon,\n computer: MonitorIcon,\n desktop_session: MonitorIcon,\n user_interface: MonitorIcon,\n application: MonitorIcon,\n html: Globe2Icon,\n web_page: Globe2Icon,\n browse_session: Globe2Icon,\n};\n\nfunction assetChipIcon(assetType: string | undefined): LucideIcon {\n return (assetType && ASSET_CHIP_ICONS[assetType.toLowerCase()]) || FileIcon;\n}\n\n/**\n * GitHub's mark (Octicons `mark-github`), drawn by a repository file's\n * citation. Lucide carries no brand icons and an SDK app serves none of\n * Olympus's, so the chip brings its own. Only a GitHub repository catalog\n * serves `file_line_range` anchors (`ASSET_ANCHOR_REGISTRY`; agora's\n * `_CATALOG_ANCHORS_BY_PROVIDER`), so the anchor alone names the provider.\n */\nfunction GitHubMarkIcon({ className }: { className?: string }) {\n return (\n <svg\n viewBox=\"0 0 16 16\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n className={className}\n data-chip-icon=\"github\"\n >\n <path d=\"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z\" />\n </svg>\n );\n}\n\n/** Past this many characters a place may not show whole in the chip, so the tooltip spells it out. */\nconst PLACE_FITS_CHARS = 20;\n\n/** `route.ts:18-24` as the file's name and its lines, so a long name shortens while its lines stay. */\nfunction splitFileLines(label: string): { file: string; lines: string } {\n const colon = label.lastIndexOf(\":\");\n return colon > 0\n ? { file: label.slice(0, colon), lines: label.slice(colon) }\n : { file: label, lines: \"\" };\n}\n\n/**\n * Whether a name already says where its citation points: the place's label or\n * its spelled-out form, or a name ending in the label (`Q4 report p.5`,\n * `olympus/…/route.ts:18-24`). The chip then draws the place once.\n */\nfunction restatesPlace(name: string, citation: MentionChipCitation): boolean {\n const said = name.trim().toLowerCase();\n const label = citation.label.toLowerCase();\n return said === label || said === citation.description.toLowerCase() || said.endsWith(label);\n}\n\n/**\n * The link's own label when it tells the reader something the chip does not\n * already show: not the place again (a path, `file:lines`), not the asset's\n * name. The tooltip keeps it, since the chip shows the asset and the place.\n */\nfunction informativeLabel({\n label,\n shown,\n citation,\n}: {\n label: string;\n shown: readonly (string | null | undefined)[];\n citation: MentionChipCitation | undefined;\n}): string | null {\n const trimmed = label.trim();\n if (!trimmed || !SPEAKABLE.test(trimmed)) return null;\n if (PLACEHOLDER_LABELS.has(trimmed.toLowerCase())) return null;\n if (citation && restatesPlace(trimmed, citation)) return null;\n // Every word of it already shown (`Tesla Q3 report` beside `Tesla Q3\n // Earnings Report`, `demo-app-monorepo` beside the repository's title).\n const shownWords = new Set(\n [...shown, citation?.description].flatMap((text) => (text ? wordsOf(text) : [])),\n );\n return wordsOf(trimmed).every((word) => shownWords.has(word)) ? null : trimmed;\n}\n\nfunction wordsOf(text: string): string[] {\n return text.toLowerCase().match(/[\\p{L}\\p{N}]+/gu) ?? [];\n}\n\n/** A label with a letter or digit in it; `§` or `•` alone says nothing read aloud. */\nconst SPEAKABLE = /[\\p{L}\\p{N}]/u;\n\n/** Labels that name nothing: agora's read_asset citations all read `Citation`. */\nconst PLACEHOLDER_LABELS: ReadonlySet<string> = new Set([\"citation\", \"source\", \"link\", \"here\"]);\n\n/** The asset reference an asset link decodes to, or null when it does not parse. */\nfunction decodeAssetLink(\n url: URL,\n decode: (url: URL) => AssetReference,\n): AssetReference | null {\n try {\n return decode(url);\n } catch {\n return null;\n }\n}\n\n// ── Mention link component for markdown renderer ──\n\n/**\n * Custom <a> renderer for MarkdownTextPrimitive.\n * Intercepts mention:// links and renders them as chips.\n * Falls through to a normal link for non-mention URLs.\n */\nfunction personEmailForMention(\n parsed: ReturnType<typeof parseMentionUrl>,\n): string | undefined {\n if (parsed.type !== \"person\") return undefined;\n return parsed.email || (parsed.id.includes(\"@\") ? parsed.id : undefined);\n}\n\n/**\n * The text a link's children read as. Markdown can hand a link several children, some of them\n * elements (an escaped `_` or a `*` in a URL splits its text), and stringifying an element gives\n * `[object Object]`.\n */\nfunction textOf(node: ReactNode): string {\n if (typeof node === \"string\" || typeof node === \"number\") return String(node);\n if (Array.isArray(node)) return node.map(textOf).join(\"\");\n if (isValidElement<{ children?: ReactNode }>(node)) return textOf(node.props.children);\n return \"\";\n}\n\nexport const MentionLink: FC<{\n href?: string;\n children?: ReactNode;\n interactive?: boolean;\n}> = ({ href, children, interactive = true }) => {\n if (\n href &&\n (href.startsWith(\"mention://\") || isSpacesMentionUrl(href))\n ) {\n const name = textOf(children).trim().replace(/^@/, \"\");\n\n const parsed = parseMentionUrl(href);\n\n return (\n <MentionChip\n name={name || parsed.name}\n type={parsed.type}\n personEmail={personEmailForMention(parsed)}\n assetIds={parsed.assetIds}\n assetType={parsed.assetType}\n citation={parsed.citation}\n thumbnailUrl={parsed.thumbnailUrl}\n sourceHref={isSpacesMentionUrl(href) ? href : parsed.sourceHref}\n interactive={interactive}\n />\n );\n }\n\n if (href?.startsWith(\"chrome-extension://\")) {\n return <span>{children}</span>;\n }\n\n if (isScreenPointHref(href)) {\n return <ScreenPointChip href={href}>{children}</ScreenPointChip>;\n }\n\n // Normal link — render as-is\n return (\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </a>\n );\n};\n\n// ── The chip pill ──\n\n/**\n * Olympus's mention pill (`mentionPillClassName`: 20px high, 16px icon, the\n * place in `text-xs`) in the provider's theme tokens, so a dark theme keeps it\n * legible, and `box-border` so its height holds without a host's CSS reset.\n * Every chat chip draws it: an asset or citation chip, a web source, a screen\n * point. Only stock Tailwind sizes: Olympus renders these chips (the queued\n * message tray) with a stylesheet that does not scan this package, so an\n * arbitrary value would reach it unstyled. `not-prose` matters: assistant\n * messages render inside Tailwind Typography's `prose`, whose\n * zero-specificity `img` margins (~1.7em top/bottom) would otherwise inflate\n * the chip's icon into a tall card that breaks the sentence flow around it.\n */\nexport const CHIP_PILL_CLASS =\n \"not-prose box-border inline-flex h-5 items-center gap-1.5 whitespace-nowrap rounded-md border border-border bg-muted px-1 py-0.5 align-middle font-normal leading-none text-foreground no-underline\";\n/** A chip that opens something. */\nexport const CHIP_LINK_CLASS =\n \"cursor-pointer transition-colors hover:bg-accent hover:text-accent-foreground hover:no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1\";\nexport const CHIP_ICON_CLASS = \"size-4 shrink-0\";\n\n// ── Inline screen-point chip ──\n\n/**\n * Renders an `athena-point://` link as a non-navigating coordinate chip.\n * Surfaces without screenshot context (extension side panel, SDK consumers)\n * get the label plus the coordinates; malformed points fall back to text.\n */\nexport const ScreenPointChip: FC<{\n href: string;\n children?: ReactNode;\n}> = ({ href, children }) => {\n const parsed = parseScreenPointHref(href);\n if (!parsed.ok) {\n return <span>{children}</span>;\n }\n const description = formatScreenPoint(parsed.point);\n return (\n <span\n className={cn(CHIP_PILL_CLASS, \"max-w-[260px]\")}\n title={description}\n aria-label={description}\n data-screen-point=\"valid\"\n >\n <CrosshairIcon className={CHIP_ICON_CLASS} aria-hidden=\"true\" />\n <span className=\"min-w-0 max-w-[180px] overflow-hidden text-ellipsis\">\n {children}\n </span>\n <span className=\"shrink-0 text-xs text-muted-foreground\">\n {parsed.point.x}, {parsed.point.y}\n </span>\n </span>\n );\n};\n\n// ── Inline mention chip ──\n\nexport const MentionChip: FC<{\n name: string;\n type?: string;\n assetIds?: string[];\n /** The asset's type (`document`, `catalog`, …): picks the icon until (or unless) the asset is looked up. */\n assetType?: string;\n /** Where in the asset the link points: its label follows the name. */\n citation?: MentionChipCitation;\n personEmail?: string;\n thumbnailUrl?: string;\n sourceHref?: string;\n interactive?: boolean;\n}> = ({\n name,\n type,\n assetIds,\n assetType,\n citation,\n personEmail,\n thumbnailUrl,\n sourceHref,\n interactive = true,\n}) => {\n const auth = useContext(MentionAuthCtx);\n const iconAppUrl = useAssetIconAppUrl();\n const memberAvatarUrl = useMemberAvatarUrl(personEmail);\n const [erroredAvatarUrl, setErroredAvatarUrl] = useState<string>();\n const excerpt = sourceHref ? readSourceExcerpt(sourceHref) : null;\n // A repository file's lines read as the file (`route.ts:18-24`): the chip\n // opens that file, and every citation in a reply names the same repository,\n // whatever label the model wrote.\n const repositoryFile =\n citation?.anchorType === \"file_line_range\"\n ? { ...splitFileLines(citation.label), label: citation.label }\n : null;\n // The asset as agora has it, read the way Olympus's chips read it: its own\n // title and type. Until it answers, and for an asset the viewer cannot read,\n // the link's label and `type=` stand in. Not asked for a repository file,\n // which reads as its file whatever the catalog is called.\n const asset = useMentionAsset(\n type === \"asset\" && assetIds?.length === 1 && !repositoryFile ? assetIds[0] : undefined,\n );\n const assetTitle = asset?.title || null;\n const chipName = repositoryFile?.label ?? assetTitle ?? name;\n // The place follows a name that does not already say it, as `[p.5]`.\n const placeLabel =\n citation && !repositoryFile && !restatesPlace(chipName, citation)\n ? citation.label\n : null;\n // The tooltip: what the model called it (when the chip does not show it),\n // the repository a file is in and the file's whole path, the cited passage.\n // The place spelled out stands in for a passage the citation does not carry,\n // and for a place too long to show whole (a long sheet name).\n const tooltip =\n citation || excerpt\n ? tooltipText({\n lines: [\n informativeLabel({ label: name, shown: [chipName, assetTitle], citation }),\n repositoryFile ? assetTitle : null,\n repositoryFile || !excerpt || (placeLabel?.length ?? 0) > PLACE_FITS_CHARS\n ? citation?.description\n : null,\n ],\n excerpt,\n })\n : null;\n const assetRootHref =\n type === \"asset\" && assetIds?.length\n ? createOlympusAssetUrl({\n appUrl: auth?.appUrl,\n backendUrl: auth?.backendUrl,\n assetIds,\n })\n : null;\n const href = (() => {\n if (!assetRootHref || !sourceHref) return assetRootHref;\n try {\n const source = new URL(sourceHref, \"https://app.athenaintel.com\");\n const destination = new URL(assetRootHref);\n for (const [key, value] of source.searchParams) {\n destination.searchParams.set(key, value);\n }\n destination.searchParams.set(\"asset_ids\", assetIds?.join(\",\") ?? \"\");\n return destination.toString();\n } catch {\n return assetRootHref;\n }\n })();\n const className = cn(CHIP_PILL_CLASS, \"max-w-[275px]\", href && CHIP_LINK_CLASS);\n // The asset-type SVG follows the looked-up type, then the link's own\n // thumbnail or `type=`, from the chat's Athena web app (or the host's copy).\n // One that cannot load (a strict CSP, offline) gives way to the type's\n // Lucide icon below.\n const typeThumbnailUrl = repositoryFile\n ? undefined\n : (asset?.assetType && assetTypeToThumb(asset.assetType, { appUrl: iconAppUrl })) ||\n thumbnailUrl ||\n (type === \"asset\" || type === \"folder\"\n ? assetTypeToThumb(type === \"folder\" ? \"folder\" : assetType, { appUrl: iconAppUrl })\n : undefined);\n const typeThumbnail = useThumbnailLoadFailure(typeThumbnailUrl);\n const chipThumbnailUrl = typeThumbnail.failed ? undefined : typeThumbnailUrl;\n const AssetIcon = assetChipIcon(asset?.assetType || assetType);\n const contents = (\n <>\n {repositoryFile ? (\n <GitHubMarkIcon className={CHIP_ICON_CLASS} />\n ) : chipThumbnailUrl ? (\n <img\n ref={typeThumbnail.imageRef}\n src={chipThumbnailUrl}\n alt=\"\"\n className={CHIP_ICON_CLASS}\n draggable={false}\n />\n ) : type === \"asset\" || type === \"folder\" ? (\n // Outside a provider with no host copy of the SVGs, or when one\n // cannot load, the chip still draws the type's icon.\n <AssetIcon className={CHIP_ICON_CLASS} aria-hidden=\"true\" />\n ) : type === \"webpage\" ? (\n <Globe2Icon className={CHIP_ICON_CLASS} aria-hidden=\"true\" />\n ) : type === \"person\" ? (\n memberAvatarUrl && erroredAvatarUrl !== memberAvatarUrl ? (\n <img\n src={memberAvatarUrl}\n alt=\"\"\n className={cn(CHIP_ICON_CLASS, \"rounded-full object-cover\")}\n draggable={false}\n onError={() => setErroredAvatarUrl(memberAvatarUrl)}\n />\n ) : (\n <UserIcon className={CHIP_ICON_CLASS} aria-hidden=\"true\" />\n )\n ) : type === \"group\" ? (\n <UsersIcon className={CHIP_ICON_CLASS} aria-hidden=\"true\" />\n ) : null}\n {repositoryFile ? (\n <span\n className=\"flex min-w-0 items-center\"\n data-citation-anchor=\"file_line_range\"\n >\n <span className=\"min-w-0 overflow-hidden text-ellipsis\">\n {repositoryFile.file}\n </span>\n <span className=\"shrink-0 text-muted-foreground\">{repositoryFile.lines}</span>\n </span>\n ) : (\n <span\n className={cn(\n \"max-w-[180px] overflow-hidden text-ellipsis\",\n // A long place may shorten the name, never make it vanish.\n placeLabel && \"min-w-8\",\n )}\n >\n {chipName}\n </span>\n )}\n {citation && placeLabel && (\n <>\n {/* Copied or read as text, the place stays a word apart from the name; a flex row draws no space. */}{\" \"}\n <span\n className=\"flex min-w-0 items-center text-xs text-muted-foreground\"\n data-citation-anchor={citation.anchorType}\n >\n [<span className=\"min-w-0 overflow-hidden text-ellipsis\">{placeLabel}</span>]\n </span>\n </>\n )}\n </>\n );\n\n if (href && interactive) {\n const speakablePlace = citation && SPEAKABLE.test(citation.description);\n return (\n <a\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={className}\n aria-label={\n repositoryFile && citation\n ? `Open ${citation.description} in Spaces`\n : placeLabel && citation && speakablePlace\n ? `Open ${chipName} at ${citation.description} in Spaces`\n : `Open ${chipName} in Spaces`\n }\n title={tooltip ?? `Open ${chipName} in Spaces`}\n data-excerpt={excerpt ?? undefined}\n // The asset without its place: what a click names the opened asset.\n data-mention-name={repositoryFile ? (assetTitle ?? name) : chipName}\n >\n {contents}\n </a>\n );\n }\n\n return (\n <span\n className={className}\n title={tooltip ?? undefined}\n data-excerpt={excerpt ?? undefined}\n >\n {contents}\n </span>\n );\n};\n\n/**\n * A chip's tooltip: the lines that say something, each once, then the cited\n * passage, quoted when it shares the tooltip with other lines.\n */\nfunction tooltipText({\n lines,\n excerpt,\n}: {\n lines: readonly (string | null | undefined)[];\n excerpt: string | null;\n}): string | null {\n const kept: string[] = [];\n for (const line of lines) {\n const trimmed = line?.trim();\n if (trimmed && !kept.includes(trimmed)) kept.push(trimmed);\n }\n if (excerpt) kept.push(kept.length ? `“${excerpt}”` : excerpt);\n return kept.length ? kept.join(\"\\n\") : null;\n}\n\n/** The `excerpt` a Spaces citation URL carries, or null. */\nfunction readSourceExcerpt(href: string): string | null {\n try {\n const excerpt = new URL(href, \"https://app.athenaintel.com\").searchParams\n .get(\"excerpt\")\n ?.trim();\n return excerpt ? excerpt : null;\n } catch {\n return null;\n }\n}\n\n/**\n * The label an asset citation chip falls back to when the model wrote none\n * (`[](…/spaces/?asset_ids=…&page=5)`): the cited location, else \"Asset\" — a\n * chip must never render as an empty box.\n */\nfunction citationFallbackLabel(params: URLSearchParams): string {\n const start = params.get(\"start_page\") ?? params.get(\"page\");\n const end = params.get(\"end_page\");\n if (start && end && end !== start) return `Pages ${start}–${end}`;\n if (start) return `Page ${start}`;\n return \"Asset\";\n}\n\n// ── Parse mention:// URLs ──\n\nexport function parseMentionUrl(url: string): {\n type: string;\n name: string;\n id: string;\n email?: string;\n assetIds?: string[];\n assetType?: string;\n citation?: MentionChipCitation;\n /**\n * For a `mention://asset` citation, the Spaces link to its place (anchor and\n * excerpt), so the chip opens there; a Spaces mention is its own link.\n */\n sourceHref?: string;\n thumbnailUrl?: string;\n} {\n try {\n if (isSpacesMentionUrl(url)) {\n const parsed = new URL(url, \"https://app.athenaintel.com\");\n const assetIds = (parsed.searchParams.get(\"asset_ids\") ?? \"\")\n .split(\",\")\n .map((id) => id.trim())\n .filter(Boolean);\n const id = assetIds[0] ?? \"\";\n const assetType = getSpacesAssetType(parsed);\n // A link to several assets names no one place in any of them.\n const reference =\n assetIds.length === 1\n ? decodeAssetLink(parsed, decodeFromAssetSpacesUrl)\n : null;\n const citation = reference ? citationOf(reference) : undefined;\n return {\n type: \"asset\",\n name:\n assetIds.length > 1\n ? `${assetIds.length} assets`\n : (citation?.description ??\n citationFallbackLabel(parsed.searchParams)),\n id,\n assetIds,\n assetType: assetType ?? undefined,\n citation,\n thumbnailUrl: assetTypeToThumb(assetType),\n };\n }\n // mention://tool?name=...&description=...\n // mention://asset?id=...&assetType=project&thumb=../icons/files/ic-project.svg\n const u = new URL(url);\n const type = u.hostname || u.pathname.replace(/^\\/\\//, \"\").split(\"?\")[0];\n const isWebpage = type === \"webpage\";\n const id = isWebpage\n ? u.searchParams.get(\"tab_id\") || \"\"\n : u.searchParams.get(\"id\") || u.searchParams.get(\"name\") || \"\";\n const name = isWebpage\n ? u.searchParams.get(\"title\") || \"This webpage\"\n : u.searchParams.get(\"name\") || id;\n\n // Get thumbnail: prefer explicit thumb param, then derive from assetType\n let thumbnailUrl = u.searchParams.get(\"thumb\") || undefined;\n if (!thumbnailUrl) {\n const assetType = u.searchParams.get(\"assetType\");\n if (assetType) {\n thumbnailUrl = assetTypeToThumb(assetType);\n } else if (type === \"asset\" || type === \"folder\") {\n thumbnailUrl = assetTypeToThumb(type === \"folder\" ? \"folder\" : null);\n }\n }\n\n const reference =\n type === \"asset\" ? decodeAssetLink(u, decodeFromAssetMentionUri) : null;\n\n return {\n type,\n name,\n id,\n email: type === \"person\" ? u.searchParams.get(\"email\") || undefined : undefined,\n assetIds: type === \"asset\" && id ? [id] : undefined,\n assetType:\n type === \"asset\" || type === \"folder\"\n ? u.searchParams.get(\"assetType\") ||\n reference?.meta?.assetType ||\n (type === \"folder\" ? \"folder\" : undefined)\n : undefined,\n citation: reference ? citationOf(reference) : undefined,\n sourceHref:\n reference && (reference.anchor || reference.meta?.excerpt)\n ? encodeToAssetSpacesUrl(reference)\n : undefined,\n thumbnailUrl,\n };\n } catch {\n return { type: \"unknown\", name: \"\", id: \"\" };\n }\n}\n\nfunction htmlAttribute(attributes: string, name: string): string | null {\n const escapedName = name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const match = new RegExp(\n `(?:^|\\\\s)${escapedName}\\\\s*=\\\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\\\s>]+))`,\n \"i\",\n ).exec(attributes);\n return match?.[1] ?? match?.[2] ?? match?.[3] ?? null;\n}\n\nfunction decodeHtmlAttribute(value: string): string {\n return value\n .replace(/&amp;/gi, \"&\")\n .replace(/&quot;/gi, '\"')\n .replace(/&#39;|&apos;/gi, \"'\")\n .replace(/&lt;/gi, \"<\")\n .replace(/&gt;/gi, \">\");\n}\n\n/** Turn complete model-emitted URL citation anchors into safe Markdown links. */\nexport function normalizeAthenaMentionHtml(text: string): string {\n return text.replace(\n /<a\\b([^>]*)>([\\s\\S]*?)<\\/a>/gi,\n (original, attributes: string, rawLabel: string) => {\n const className = htmlAttribute(attributes, \"class\") ?? \"\";\n const type = htmlAttribute(attributes, \"data-type\") ?? \"\";\n if (!className.split(/\\s+/).includes(\"mention\") || type !== \"url\") {\n return original;\n }\n\n const rawUrl =\n htmlAttribute(attributes, \"data-url\") ??\n htmlAttribute(attributes, \"href\");\n if (!rawUrl) return original;\n const url = decodeHtmlAttribute(rawUrl);\n let normalizedUrl: string;\n try {\n const parsed = new URL(url);\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n return original;\n }\n normalizedUrl = parsed.toString();\n } catch {\n return original;\n }\n\n const label = decodeHtmlAttribute(rawLabel.replace(/<[^>]*>/g, \"\"))\n .trim()\n .replace(/([\\\\[\\]])/g, \"\\\\$1\");\n return label ? `[${label}](<${normalizedUrl}>)` : original;\n },\n );\n}\n// ── Parse mention markdown in plain text ──\n\n// The label may hold balanced brackets one level deep (`[@Plan [Q3]](…)`) or a lone `[`.\nconst MENTION_RE =\n /\\[@((?:\\[[^[\\]]*\\](?!\\((?:[a-z][a-z0-9+.-]*:\\/\\/|\\/))|[^\\]])*)\\]\\(((?:mention:\\/\\/|(?:https?:\\/\\/[^)\\s]+)?\\/dashboard\\/spaces\\/?\\?)[^)]+)\\)/g;\n\n/**\n * Parse text containing [@name](mention://...) patterns into\n * an array of string segments and MentionChip elements.\n */\nexport function parseMentionsInText(text: string): (string | ReactElement)[] {\n const parts: (string | ReactElement)[] = [];\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n MENTION_RE.lastIndex = 0;\n\n while ((match = MENTION_RE.exec(text)) !== null) {\n if (match.index > lastIndex) {\n parts.push(text.slice(lastIndex, match.index));\n }\n\n const name = match[1];\n const url = match[2];\n const parsed = parseMentionUrl(url);\n\n parts.push(\n <MentionChip\n key={`mention-${match.index}`}\n name={name || parsed.name}\n type={parsed.type}\n personEmail={personEmailForMention(parsed)}\n assetIds={parsed.assetIds}\n assetType={parsed.assetType}\n citation={parsed.citation}\n thumbnailUrl={parsed.thumbnailUrl}\n sourceHref={isSpacesMentionUrl(url) ? url : parsed.sourceHref}\n />\n );\n\n lastIndex = match.index + match[0].length;\n }\n\n if (lastIndex < text.length) {\n parts.push(text.slice(lastIndex));\n }\n\n return parts.length > 0 ? parts : [text];\n}\n\n/** The text as a reader sees it: each `[@name](…)` mention becomes `@name`. */\nexport function mentionsToPlainText(text: string): string {\n return text.replace(MENTION_RE, (_match, name: string, url: string) => {\n return `@${name || parseMentionUrl(url).name}`;\n });\n}\n"],"names":["formatReferenceAnchor","FileTextIcon","SheetIcon","PresentationIcon","ImageIcon","VideoIcon","HeadphonesIcon","MailIcon","FileCodeIcon","DatabaseIcon","FolderIcon","MessageSquareIcon","MonitorIcon","Globe2Icon","FileIcon","jsx","isValidElement","isScreenPointHref","parseScreenPointHref","formatScreenPoint","jsxs","cn","CrosshairIcon","useContext","MentionAuthCtx","useAssetIconAppUrl","useMemberAvatarUrl","useState","useMentionAsset","createOlympusAssetUrl","assetTypeToThumb","useThumbnailLoadFailure","Fragment","UserIcon","UsersIcon","id","reference","decodeFromAssetSpacesUrl","decodeFromAssetMentionUri","encodeToAssetSpacesUrl"],"mappings":";;;;;;;;;;;;;;;;;AAyDA,MAAM,sBAAsB;AAE5B,SAAS,mBAAmB,KAAsB;AAChD,SAAO,oBAAoB,KAAK,GAAG;AACrC;AAEA,SAAS,mBAAmB,KAAyB;AACnD,QAAM,YACJ,IAAI,aAAa,IAAI,WAAW,KAChC,IAAI,aAAa,IAAI,YAAY,KACjC,IAAI,aAAa,IAAI,MAAM;AAC7B,SAAO,cAAc,UAAU,gBAAgB;AACjD;AAsBA,SAAS,WAAW,WAA4D;AAC9E,QAAM,EAAE,QAAQ,KAAA,IAAS;AACzB,MAAI,CAAC,OAAQ,QAAO;AACpB,QAAM,QAAQA,OAAAA,sBAAsB,QAAQ,SAAS,IAAI;AACzD,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,EAAE,SAAS,UAAU,GAAG,MAAA,IAAU,QAAQ,CAAA;AAChD,SAAO;AAAA,IACL,YAAY,OAAO;AAAA,IACnB;AAAA,IACA,aAAaA,OAAAA,sBAAsB,QAAQ,QAAQ,KAAK,KAAK;AAAA,EAAA;AAEjE;AASA,MAAM,mBAA+C;AAAA,EACnD,UAAUC,YAAAA;AAAAA,EACV,eAAeA,YAAAA;AAAAA,EACf,UAAUA,YAAAA;AAAAA,EACV,KAAKA,YAAAA;AAAAA,EACL,KAAKA,YAAAA;AAAAA,EACL,aAAaC,YAAAA;AAAAA,EACb,OAAOA,YAAAA;AAAAA,EACP,cAAcC,YAAAA;AAAAA,EACd,iBAAiBA,YAA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IAAI;AACzC;AAGO,SAAS,oBAAoB,MAAsB;AACxD,SAAO,KAAK,QAAQ,YAAY,CAAC,QAAQ,MAAc,QAAgB;AACrE,WAAO,IAAI,QAAQ,gBAAgB,GAAG,EAAE,IAAI;AAAA,EAC9C,CAAC;AACH;;;;;;;;;;;"}
@@ -3,10 +3,12 @@ import { useContext, useState, isValidElement } from "react";
3
3
  import { formatReferenceAnchor } from "../../references/src/anchors/format.js";
4
4
  import { decodeFromAssetMentionUri } from "../../references/src/formats/uri/asset-mention-uri.js";
5
5
  import { decodeFromAssetSpacesUrl, encodeToAssetSpacesUrl } from "../../references/src/formats/uri/asset-spaces-url.js";
6
- import { Globe2Icon, UserIcon, MonitorIcon, MessageSquareIcon, FolderIcon, DatabaseIcon, FileCodeIcon, MailIcon, HeadphonesIcon, VideoIcon, ImageIcon, PresentationIcon, SheetIcon, FileTextIcon, FileIcon, CrosshairIcon } from "lucide-react";
6
+ import { Globe2Icon, UserIcon, UsersIcon, MonitorIcon, MessageSquareIcon, FolderIcon, DatabaseIcon, FileCodeIcon, MailIcon, HeadphonesIcon, VideoIcon, ImageIcon, PresentationIcon, SheetIcon, FileTextIcon, FileIcon, CrosshairIcon } from "lucide-react";
7
7
  import { createOlympusAssetUrl } from "../lib/asset-urls.js";
8
8
  import { MentionAuthCtx } from "./suggestions/data/api-client.js";
9
9
  import { assetTypeToThumb } from "./suggestions/data/sources/asset-type-icons.js";
10
+ import { useAssetIconAppUrl } from "./use-asset-icon-app-url.js";
11
+ import { useThumbnailLoadFailure } from "./suggestions/components/mention-icon.js";
10
12
  import { useMemberAvatarUrl } from "./use-member-avatar.js";
11
13
  import { useMentionAsset } from "./use-mention-asset.js";
12
14
  import { isScreenPointHref, parseScreenPointHref, formatScreenPoint } from "../../agent-runtime/src/screen-point.js";
@@ -209,6 +211,7 @@ const MentionChip = ({
209
211
  interactive = true
210
212
  }) => {
211
213
  const auth = useContext(MentionAuthCtx);
214
+ const iconAppUrl = useAssetIconAppUrl();
212
215
  const memberAvatarUrl = useMemberAvatarUrl(personEmail);
213
216
  const [erroredAvatarUrl, setErroredAvatarUrl] = useState();
214
217
  const excerpt = sourceHref ? readSourceExcerpt(sourceHref) : null;
@@ -247,20 +250,23 @@ const MentionChip = ({
247
250
  }
248
251
  })();
249
252
  const className = cn(CHIP_PILL_CLASS, "max-w-[275px]", href && CHIP_LINK_CLASS);
250
- const chipThumbnailUrl = repositoryFile ? void 0 : (asset == null ? void 0 : asset.assetType) && assetTypeToThumb(asset.assetType) || thumbnailUrl;
253
+ const typeThumbnailUrl = repositoryFile ? void 0 : (asset == null ? void 0 : asset.assetType) && assetTypeToThumb(asset.assetType, { appUrl: iconAppUrl }) || thumbnailUrl || (type === "asset" || type === "folder" ? assetTypeToThumb(type === "folder" ? "folder" : assetType, { appUrl: iconAppUrl }) : void 0);
254
+ const typeThumbnail = useThumbnailLoadFailure(typeThumbnailUrl);
255
+ const chipThumbnailUrl = typeThumbnail.failed ? void 0 : typeThumbnailUrl;
251
256
  const AssetIcon = assetChipIcon((asset == null ? void 0 : asset.assetType) || assetType);
252
257
  const contents = /* @__PURE__ */ jsxs(Fragment, { children: [
253
258
  repositoryFile ? /* @__PURE__ */ jsx(GitHubMarkIcon, { className: CHIP_ICON_CLASS }) : chipThumbnailUrl ? /* @__PURE__ */ jsx(
254
259
  "img",
255
260
  {
261
+ ref: typeThumbnail.imageRef,
256
262
  src: chipThumbnailUrl,
257
263
  alt: "",
258
264
  className: CHIP_ICON_CLASS,
259
265
  draggable: false
260
266
  }
261
267
  ) : type === "asset" || type === "folder" ? (
262
- // A host that bundles no asset-type SVGs (computer apps, most SDK
263
- // apps) still gets the type's icon.
268
+ // Outside a provider with no host copy of the SVGs, or when one
269
+ // cannot load, the chip still draws the type's icon.
264
270
  /* @__PURE__ */ jsx(AssetIcon, { className: CHIP_ICON_CLASS, "aria-hidden": "true" })
265
271
  ) : type === "webpage" ? /* @__PURE__ */ jsx(Globe2Icon, { className: CHIP_ICON_CLASS, "aria-hidden": "true" }) : type === "person" ? memberAvatarUrl && erroredAvatarUrl !== memberAvatarUrl ? /* @__PURE__ */ jsx(
266
272
  "img",
@@ -271,7 +277,7 @@ const MentionChip = ({
271
277
  draggable: false,
272
278
  onError: () => setErroredAvatarUrl(memberAvatarUrl)
273
279
  }
274
- ) : /* @__PURE__ */ jsx(UserIcon, { className: CHIP_ICON_CLASS, "aria-hidden": "true" }) : null,
280
+ ) : /* @__PURE__ */ jsx(UserIcon, { className: CHIP_ICON_CLASS, "aria-hidden": "true" }) : type === "group" ? /* @__PURE__ */ jsx(UsersIcon, { className: CHIP_ICON_CLASS, "aria-hidden": "true" }) : null,
275
281
  repositoryFile ? /* @__PURE__ */ jsxs(
276
282
  "span",
277
283
  {
@@ -1 +1 @@
1
- {"version":3,"file":"mention-chip.js","sources":["../../../src/chat-ui/mentions/mention-chip.tsx"],"sourcesContent":["/**\n * Mention chip rendering for message display.\n *\n * Parses [@name](mention://type?...) markdown links and renders them\n * as styled inline chips matching the Olympus mention style.\n * Used in both user messages (inline text) and assistant messages (markdown links).\n */\n\nimport {\n isValidElement,\n useContext,\n useState,\n type FC,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport {\n formatScreenPoint,\n isScreenPointHref,\n parseScreenPointHref,\n} from \"@athenaintel/agent-runtime\";\nimport {\n type AssetReference,\n decodeFromAssetMentionUri,\n decodeFromAssetSpacesUrl,\n encodeToAssetSpacesUrl,\n formatReferenceAnchor,\n} from \"@athenaintel/references/asset-links\";\nimport {\n CrosshairIcon,\n DatabaseIcon,\n FileCodeIcon,\n FileIcon,\n FileTextIcon,\n FolderIcon,\n Globe2Icon,\n HeadphonesIcon,\n ImageIcon,\n type LucideIcon,\n MailIcon,\n MessageSquareIcon,\n MonitorIcon,\n PresentationIcon,\n SheetIcon,\n UserIcon,\n VideoIcon,\n} from \"lucide-react\";\nimport { cn } from \"../../lib/utils\";\nimport { createOlympusAssetUrl } from \"../lib/asset-urls\";\nimport { MentionAuthCtx } from \"./suggestions/data/api-client\";\nimport { assetTypeToThumb } from \"./suggestions/data/sources/asset-type-icons\";\nimport { useMemberAvatarUrl } from \"./use-member-avatar\";\nimport { useMentionAsset } from \"./use-mention-asset\";\n\nconst SPACES_MENTION_PATH = /\\/dashboard\\/spaces\\/?\\?/;\n\nfunction isSpacesMentionUrl(url: string): boolean {\n return SPACES_MENTION_PATH.test(url);\n}\n\nfunction getSpacesAssetType(url: URL): string | null {\n const assetType =\n url.searchParams.get(\"assetType\") ||\n url.searchParams.get(\"asset_type\") ||\n url.searchParams.get(\"type\");\n return assetType === \"sheet\" ? \"spreadsheet\" : assetType;\n}\n\n/**\n * Where in the asset a citation points, as its chip shows it. The anchor is\n * read and labelled by `@athenaintel/references` — the same parser and labels\n * Olympus's mention chips use — so a chip reads `jwt.py:12-25`, `p.5` or\n * `Slide 3` in every Athena chat.\n */\nexport interface MentionChipCitation {\n /** The anchor type (`page`, `file_line_range`, `slide`, …). */\n anchorType: string;\n /** The short label drawn after the name (`p.5`, `jwt.py:12-25`). */\n label: string;\n /**\n * The place spelled out (`Page 5`, `agora/…/jwt.py:12-25`), without the\n * excerpt: the tooltip when the link carries no excerpt, and part of the\n * chip's accessible name when it holds a word.\n */\n description: string;\n}\n\n/** The citation an asset link's anchor names, or undefined for a plain mention or an anchor nobody can read. */\nfunction citationOf(reference: AssetReference): MentionChipCitation | undefined {\n const { anchor, meta } = reference;\n if (!anchor) return undefined;\n const label = formatReferenceAnchor(anchor, \"short\", meta);\n if (!label) return undefined;\n const { excerpt: _excerpt, ...place } = meta ?? {};\n return {\n anchorType: anchor.type,\n label,\n description: formatReferenceAnchor(anchor, \"long\", place) ?? label,\n };\n}\n\n/**\n * The chip's icon for an asset type when the host serves no asset-type SVGs.\n * A compact set on purpose: the chip renders in every message (and Olympus's\n * main layout reaches it through the queued-message tray), so it carries a\n * dozen icons rather than the `@` menu's whole map.\n */\nconst ASSET_CHIP_ICONS: Record<string, LucideIcon> = {\n document: FileTextIcon,\n word_document: FileTextIcon,\n markdown: FileTextIcon,\n txt: FileTextIcon,\n pdf: FileTextIcon,\n spreadsheet: SheetIcon,\n table: SheetIcon,\n presentation: PresentationIcon,\n powerpoint_deck: PresentationIcon,\n presentation_pptx_studio: PresentationIcon,\n pptx: PresentationIcon,\n image: ImageIcon,\n figure: ImageIcon,\n canvas: ImageIcon,\n video: VideoIcon,\n meeting: VideoIcon,\n video_session: VideoIcon,\n audio: HeadphonesIcon,\n voice_memo: HeadphonesIcon,\n phone_call: HeadphonesIcon,\n email: MailIcon,\n email_message: MailIcon,\n live_email_thread: MailIcon,\n live_calendar_event: MailIcon,\n python: FileCodeIcon,\n javascript: FileCodeIcon,\n typescript: FileCodeIcon,\n json: FileCodeIcon,\n yaml: FileCodeIcon,\n database: DatabaseIcon,\n catalog: DatabaseIcon,\n drive: DatabaseIcon,\n dataset: DatabaseIcon,\n semantic_model: DatabaseIcon,\n query_snippet: DatabaseIcon,\n folder: FolderIcon,\n gdrive_folder: FolderIcon,\n project: FolderIcon,\n collection: FolderIcon,\n session: MessageSquareIcon,\n computer: MonitorIcon,\n desktop_session: MonitorIcon,\n user_interface: MonitorIcon,\n application: MonitorIcon,\n html: Globe2Icon,\n web_page: Globe2Icon,\n browse_session: Globe2Icon,\n};\n\nfunction assetChipIcon(assetType: string | undefined): LucideIcon {\n return (assetType && ASSET_CHIP_ICONS[assetType.toLowerCase()]) || FileIcon;\n}\n\n/**\n * GitHub's mark (Octicons `mark-github`), drawn by a repository file's\n * citation. Lucide carries no brand icons and an SDK app serves none of\n * Olympus's, so the chip brings its own. Only a GitHub repository catalog\n * serves `file_line_range` anchors (`ASSET_ANCHOR_REGISTRY`; agora's\n * `_CATALOG_ANCHORS_BY_PROVIDER`), so the anchor alone names the provider.\n */\nfunction GitHubMarkIcon({ className }: { className?: string }) {\n return (\n <svg\n viewBox=\"0 0 16 16\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n className={className}\n data-chip-icon=\"github\"\n >\n <path d=\"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z\" />\n </svg>\n );\n}\n\n/** Past this many characters a place may not show whole in the chip, so the tooltip spells it out. */\nconst PLACE_FITS_CHARS = 20;\n\n/** `route.ts:18-24` as the file's name and its lines, so a long name shortens while its lines stay. */\nfunction splitFileLines(label: string): { file: string; lines: string } {\n const colon = label.lastIndexOf(\":\");\n return colon > 0\n ? { file: label.slice(0, colon), lines: label.slice(colon) }\n : { file: label, lines: \"\" };\n}\n\n/**\n * Whether a name already says where its citation points: the place's label or\n * its spelled-out form, or a name ending in the label (`Q4 report p.5`,\n * `olympus/…/route.ts:18-24`). The chip then draws the place once.\n */\nfunction restatesPlace(name: string, citation: MentionChipCitation): boolean {\n const said = name.trim().toLowerCase();\n const label = citation.label.toLowerCase();\n return said === label || said === citation.description.toLowerCase() || said.endsWith(label);\n}\n\n/**\n * The link's own label when it tells the reader something the chip does not\n * already show: not the place again (a path, `file:lines`), not the asset's\n * name. The tooltip keeps it, since the chip shows the asset and the place.\n */\nfunction informativeLabel({\n label,\n shown,\n citation,\n}: {\n label: string;\n shown: readonly (string | null | undefined)[];\n citation: MentionChipCitation | undefined;\n}): string | null {\n const trimmed = label.trim();\n if (!trimmed || !SPEAKABLE.test(trimmed)) return null;\n if (PLACEHOLDER_LABELS.has(trimmed.toLowerCase())) return null;\n if (citation && restatesPlace(trimmed, citation)) return null;\n // Every word of it already shown (`Tesla Q3 report` beside `Tesla Q3\n // Earnings Report`, `demo-app-monorepo` beside the repository's title).\n const shownWords = new Set(\n [...shown, citation?.description].flatMap((text) => (text ? wordsOf(text) : [])),\n );\n return wordsOf(trimmed).every((word) => shownWords.has(word)) ? null : trimmed;\n}\n\nfunction wordsOf(text: string): string[] {\n return text.toLowerCase().match(/[\\p{L}\\p{N}]+/gu) ?? [];\n}\n\n/** A label with a letter or digit in it; `§` or `•` alone says nothing read aloud. */\nconst SPEAKABLE = /[\\p{L}\\p{N}]/u;\n\n/** Labels that name nothing: agora's read_asset citations all read `Citation`. */\nconst PLACEHOLDER_LABELS: ReadonlySet<string> = new Set([\"citation\", \"source\", \"link\", \"here\"]);\n\n/** The asset reference an asset link decodes to, or null when it does not parse. */\nfunction decodeAssetLink(\n url: URL,\n decode: (url: URL) => AssetReference,\n): AssetReference | null {\n try {\n return decode(url);\n } catch {\n return null;\n }\n}\n\n// ── Mention link component for markdown renderer ──\n\n/**\n * Custom <a> renderer for MarkdownTextPrimitive.\n * Intercepts mention:// links and renders them as chips.\n * Falls through to a normal link for non-mention URLs.\n */\nfunction personEmailForMention(\n parsed: ReturnType<typeof parseMentionUrl>,\n): string | undefined {\n if (parsed.type !== \"person\") return undefined;\n return parsed.email || (parsed.id.includes(\"@\") ? parsed.id : undefined);\n}\n\n/**\n * The text a link's children read as. Markdown can hand a link several children, some of them\n * elements (an escaped `_` or a `*` in a URL splits its text), and stringifying an element gives\n * `[object Object]`.\n */\nfunction textOf(node: ReactNode): string {\n if (typeof node === \"string\" || typeof node === \"number\") return String(node);\n if (Array.isArray(node)) return node.map(textOf).join(\"\");\n if (isValidElement<{ children?: ReactNode }>(node)) return textOf(node.props.children);\n return \"\";\n}\n\nexport const MentionLink: FC<{\n href?: string;\n children?: ReactNode;\n interactive?: boolean;\n}> = ({ href, children, interactive = true }) => {\n if (\n href &&\n (href.startsWith(\"mention://\") || isSpacesMentionUrl(href))\n ) {\n const name = textOf(children).trim().replace(/^@/, \"\");\n\n const parsed = parseMentionUrl(href);\n\n return (\n <MentionChip\n name={name || parsed.name}\n type={parsed.type}\n personEmail={personEmailForMention(parsed)}\n assetIds={parsed.assetIds}\n assetType={parsed.assetType}\n citation={parsed.citation}\n thumbnailUrl={parsed.thumbnailUrl}\n sourceHref={isSpacesMentionUrl(href) ? href : parsed.sourceHref}\n interactive={interactive}\n />\n );\n }\n\n if (href?.startsWith(\"chrome-extension://\")) {\n return <span>{children}</span>;\n }\n\n if (isScreenPointHref(href)) {\n return <ScreenPointChip href={href}>{children}</ScreenPointChip>;\n }\n\n // Normal link — render as-is\n return (\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </a>\n );\n};\n\n// ── The chip pill ──\n\n/**\n * Olympus's mention pill (`mentionPillClassName`: 20px high, 16px icon, the\n * place in `text-xs`) in the provider's theme tokens, so a dark theme keeps it\n * legible, and `box-border` so its height holds without a host's CSS reset.\n * Every chat chip draws it: an asset or citation chip, a web source, a screen\n * point. Only stock Tailwind sizes: Olympus renders these chips (the queued\n * message tray) with a stylesheet that does not scan this package, so an\n * arbitrary value would reach it unstyled. `not-prose` matters: assistant\n * messages render inside Tailwind Typography's `prose`, whose\n * zero-specificity `img` margins (~1.7em top/bottom) would otherwise inflate\n * the chip's icon into a tall card that breaks the sentence flow around it.\n */\nexport const CHIP_PILL_CLASS =\n \"not-prose box-border inline-flex h-5 items-center gap-1.5 whitespace-nowrap rounded-md border border-border bg-muted px-1 py-0.5 align-middle font-normal leading-none text-foreground no-underline\";\n/** A chip that opens something. */\nexport const CHIP_LINK_CLASS =\n \"cursor-pointer transition-colors hover:bg-accent hover:text-accent-foreground hover:no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1\";\nexport const CHIP_ICON_CLASS = \"size-4 shrink-0\";\n\n// ── Inline screen-point chip ──\n\n/**\n * Renders an `athena-point://` link as a non-navigating coordinate chip.\n * Surfaces without screenshot context (extension side panel, SDK consumers)\n * get the label plus the coordinates; malformed points fall back to text.\n */\nexport const ScreenPointChip: FC<{\n href: string;\n children?: ReactNode;\n}> = ({ href, children }) => {\n const parsed = parseScreenPointHref(href);\n if (!parsed.ok) {\n return <span>{children}</span>;\n }\n const description = formatScreenPoint(parsed.point);\n return (\n <span\n className={cn(CHIP_PILL_CLASS, \"max-w-[260px]\")}\n title={description}\n aria-label={description}\n data-screen-point=\"valid\"\n >\n <CrosshairIcon className={CHIP_ICON_CLASS} aria-hidden=\"true\" />\n <span className=\"min-w-0 max-w-[180px] overflow-hidden text-ellipsis\">\n {children}\n </span>\n <span className=\"shrink-0 text-xs text-muted-foreground\">\n {parsed.point.x}, {parsed.point.y}\n </span>\n </span>\n );\n};\n\n// ── Inline mention chip ──\n\nexport const MentionChip: FC<{\n name: string;\n type?: string;\n assetIds?: string[];\n /** The asset's type (`document`, `catalog`, …): picks the icon until (or unless) the asset is looked up. */\n assetType?: string;\n /** Where in the asset the link points: its label follows the name. */\n citation?: MentionChipCitation;\n personEmail?: string;\n thumbnailUrl?: string;\n sourceHref?: string;\n interactive?: boolean;\n}> = ({\n name,\n type,\n assetIds,\n assetType,\n citation,\n personEmail,\n thumbnailUrl,\n sourceHref,\n interactive = true,\n}) => {\n const auth = useContext(MentionAuthCtx);\n const memberAvatarUrl = useMemberAvatarUrl(personEmail);\n const [erroredAvatarUrl, setErroredAvatarUrl] = useState<string>();\n const excerpt = sourceHref ? readSourceExcerpt(sourceHref) : null;\n // A repository file's lines read as the file (`route.ts:18-24`): the chip\n // opens that file, and every citation in a reply names the same repository,\n // whatever label the model wrote.\n const repositoryFile =\n citation?.anchorType === \"file_line_range\"\n ? { ...splitFileLines(citation.label), label: citation.label }\n : null;\n // The asset as agora has it, read the way Olympus's chips read it: its own\n // title and type. Until it answers, and for an asset the viewer cannot read,\n // the link's label and `type=` stand in. Not asked for a repository file,\n // which reads as its file whatever the catalog is called.\n const asset = useMentionAsset(\n type === \"asset\" && assetIds?.length === 1 && !repositoryFile ? assetIds[0] : undefined,\n );\n const assetTitle = asset?.title || null;\n const chipName = repositoryFile?.label ?? assetTitle ?? name;\n // The place follows a name that does not already say it, as `[p.5]`.\n const placeLabel =\n citation && !repositoryFile && !restatesPlace(chipName, citation)\n ? citation.label\n : null;\n // The tooltip: what the model called it (when the chip does not show it),\n // the repository a file is in and the file's whole path, the cited passage.\n // The place spelled out stands in for a passage the citation does not carry,\n // and for a place too long to show whole (a long sheet name).\n const tooltip =\n citation || excerpt\n ? tooltipText({\n lines: [\n informativeLabel({ label: name, shown: [chipName, assetTitle], citation }),\n repositoryFile ? assetTitle : null,\n repositoryFile || !excerpt || (placeLabel?.length ?? 0) > PLACE_FITS_CHARS\n ? citation?.description\n : null,\n ],\n excerpt,\n })\n : null;\n const assetRootHref =\n type === \"asset\" && assetIds?.length\n ? createOlympusAssetUrl({\n appUrl: auth?.appUrl,\n backendUrl: auth?.backendUrl,\n assetIds,\n })\n : null;\n const href = (() => {\n if (!assetRootHref || !sourceHref) return assetRootHref;\n try {\n const source = new URL(sourceHref, \"https://app.athenaintel.com\");\n const destination = new URL(assetRootHref);\n for (const [key, value] of source.searchParams) {\n destination.searchParams.set(key, value);\n }\n destination.searchParams.set(\"asset_ids\", assetIds?.join(\",\") ?? \"\");\n return destination.toString();\n } catch {\n return assetRootHref;\n }\n })();\n const className = cn(CHIP_PILL_CLASS, \"max-w-[275px]\", href && CHIP_LINK_CLASS);\n // A host's asset-type SVG follows the looked-up type, when it serves them.\n const chipThumbnailUrl = repositoryFile\n ? undefined\n : (asset?.assetType && assetTypeToThumb(asset.assetType)) || thumbnailUrl;\n const AssetIcon = assetChipIcon(asset?.assetType || assetType);\n const contents = (\n <>\n {repositoryFile ? (\n <GitHubMarkIcon className={CHIP_ICON_CLASS} />\n ) : chipThumbnailUrl ? (\n <img\n src={chipThumbnailUrl}\n alt=\"\"\n className={CHIP_ICON_CLASS}\n draggable={false}\n />\n ) : type === \"asset\" || type === \"folder\" ? (\n // A host that bundles no asset-type SVGs (computer apps, most SDK\n // apps) still gets the type's icon.\n <AssetIcon className={CHIP_ICON_CLASS} aria-hidden=\"true\" />\n ) : type === \"webpage\" ? (\n <Globe2Icon className={CHIP_ICON_CLASS} aria-hidden=\"true\" />\n ) : type === \"person\" ? (\n memberAvatarUrl && erroredAvatarUrl !== memberAvatarUrl ? (\n <img\n src={memberAvatarUrl}\n alt=\"\"\n className={cn(CHIP_ICON_CLASS, \"rounded-full object-cover\")}\n draggable={false}\n onError={() => setErroredAvatarUrl(memberAvatarUrl)}\n />\n ) : (\n <UserIcon className={CHIP_ICON_CLASS} aria-hidden=\"true\" />\n )\n ) : null}\n {repositoryFile ? (\n <span\n className=\"flex min-w-0 items-center\"\n data-citation-anchor=\"file_line_range\"\n >\n <span className=\"min-w-0 overflow-hidden text-ellipsis\">\n {repositoryFile.file}\n </span>\n <span className=\"shrink-0 text-muted-foreground\">{repositoryFile.lines}</span>\n </span>\n ) : (\n <span\n className={cn(\n \"max-w-[180px] overflow-hidden text-ellipsis\",\n // A long place may shorten the name, never make it vanish.\n placeLabel && \"min-w-8\",\n )}\n >\n {chipName}\n </span>\n )}\n {citation && placeLabel && (\n <>\n {/* Copied or read as text, the place stays a word apart from the name; a flex row draws no space. */}{\" \"}\n <span\n className=\"flex min-w-0 items-center text-xs text-muted-foreground\"\n data-citation-anchor={citation.anchorType}\n >\n [<span className=\"min-w-0 overflow-hidden text-ellipsis\">{placeLabel}</span>]\n </span>\n </>\n )}\n </>\n );\n\n if (href && interactive) {\n const speakablePlace = citation && SPEAKABLE.test(citation.description);\n return (\n <a\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={className}\n aria-label={\n repositoryFile && citation\n ? `Open ${citation.description} in Spaces`\n : placeLabel && citation && speakablePlace\n ? `Open ${chipName} at ${citation.description} in Spaces`\n : `Open ${chipName} in Spaces`\n }\n title={tooltip ?? `Open ${chipName} in Spaces`}\n data-excerpt={excerpt ?? undefined}\n // The asset without its place: what a click names the opened asset.\n data-mention-name={repositoryFile ? (assetTitle ?? name) : chipName}\n >\n {contents}\n </a>\n );\n }\n\n return (\n <span\n className={className}\n title={tooltip ?? undefined}\n data-excerpt={excerpt ?? undefined}\n >\n {contents}\n </span>\n );\n};\n\n/**\n * A chip's tooltip: the lines that say something, each once, then the cited\n * passage, quoted when it shares the tooltip with other lines.\n */\nfunction tooltipText({\n lines,\n excerpt,\n}: {\n lines: readonly (string | null | undefined)[];\n excerpt: string | null;\n}): string | null {\n const kept: string[] = [];\n for (const line of lines) {\n const trimmed = line?.trim();\n if (trimmed && !kept.includes(trimmed)) kept.push(trimmed);\n }\n if (excerpt) kept.push(kept.length ? `“${excerpt}”` : excerpt);\n return kept.length ? kept.join(\"\\n\") : null;\n}\n\n/** The `excerpt` a Spaces citation URL carries, or null. */\nfunction readSourceExcerpt(href: string): string | null {\n try {\n const excerpt = new URL(href, \"https://app.athenaintel.com\").searchParams\n .get(\"excerpt\")\n ?.trim();\n return excerpt ? excerpt : null;\n } catch {\n return null;\n }\n}\n\n/**\n * The label an asset citation chip falls back to when the model wrote none\n * (`[](…/spaces/?asset_ids=…&page=5)`): the cited location, else \"Asset\" — a\n * chip must never render as an empty box.\n */\nfunction citationFallbackLabel(params: URLSearchParams): string {\n const start = params.get(\"start_page\") ?? params.get(\"page\");\n const end = params.get(\"end_page\");\n if (start && end && end !== start) return `Pages ${start}–${end}`;\n if (start) return `Page ${start}`;\n return \"Asset\";\n}\n\n// ── Parse mention:// URLs ──\n\nexport function parseMentionUrl(url: string): {\n type: string;\n name: string;\n id: string;\n email?: string;\n assetIds?: string[];\n assetType?: string;\n citation?: MentionChipCitation;\n /**\n * For a `mention://asset` citation, the Spaces link to its place (anchor and\n * excerpt), so the chip opens there; a Spaces mention is its own link.\n */\n sourceHref?: string;\n thumbnailUrl?: string;\n} {\n try {\n if (isSpacesMentionUrl(url)) {\n const parsed = new URL(url, \"https://app.athenaintel.com\");\n const assetIds = (parsed.searchParams.get(\"asset_ids\") ?? \"\")\n .split(\",\")\n .map((id) => id.trim())\n .filter(Boolean);\n const id = assetIds[0] ?? \"\";\n const assetType = getSpacesAssetType(parsed);\n // A link to several assets names no one place in any of them.\n const reference =\n assetIds.length === 1\n ? decodeAssetLink(parsed, decodeFromAssetSpacesUrl)\n : null;\n const citation = reference ? citationOf(reference) : undefined;\n return {\n type: \"asset\",\n name:\n assetIds.length > 1\n ? `${assetIds.length} assets`\n : (citation?.description ??\n citationFallbackLabel(parsed.searchParams)),\n id,\n assetIds,\n assetType: assetType ?? undefined,\n citation,\n thumbnailUrl: assetTypeToThumb(assetType),\n };\n }\n // mention://tool?name=...&description=...\n // mention://asset?id=...&assetType=project&thumb=../icons/files/ic-project.svg\n const u = new URL(url);\n const type = u.hostname || u.pathname.replace(/^\\/\\//, \"\").split(\"?\")[0];\n const isWebpage = type === \"webpage\";\n const id = isWebpage\n ? u.searchParams.get(\"tab_id\") || \"\"\n : u.searchParams.get(\"id\") || u.searchParams.get(\"name\") || \"\";\n const name = isWebpage\n ? u.searchParams.get(\"title\") || \"This webpage\"\n : u.searchParams.get(\"name\") || id;\n\n // Get thumbnail: prefer explicit thumb param, then derive from assetType\n let thumbnailUrl = u.searchParams.get(\"thumb\") || undefined;\n if (!thumbnailUrl) {\n const assetType = u.searchParams.get(\"assetType\");\n if (assetType) {\n thumbnailUrl = assetTypeToThumb(assetType);\n } else if (type === \"asset\" || type === \"folder\") {\n thumbnailUrl = assetTypeToThumb(type === \"folder\" ? \"folder\" : null);\n }\n }\n\n const reference =\n type === \"asset\" ? decodeAssetLink(u, decodeFromAssetMentionUri) : null;\n\n return {\n type,\n name,\n id,\n email: type === \"person\" ? u.searchParams.get(\"email\") || undefined : undefined,\n assetIds: type === \"asset\" && id ? [id] : undefined,\n assetType:\n type === \"asset\" || type === \"folder\"\n ? u.searchParams.get(\"assetType\") ||\n reference?.meta?.assetType ||\n (type === \"folder\" ? \"folder\" : undefined)\n : undefined,\n citation: reference ? citationOf(reference) : undefined,\n sourceHref:\n reference && (reference.anchor || reference.meta?.excerpt)\n ? encodeToAssetSpacesUrl(reference)\n : undefined,\n thumbnailUrl,\n };\n } catch {\n return { type: \"unknown\", name: \"\", id: \"\" };\n }\n}\n\nfunction htmlAttribute(attributes: string, name: string): string | null {\n const escapedName = name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const match = new RegExp(\n `(?:^|\\\\s)${escapedName}\\\\s*=\\\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\\\s>]+))`,\n \"i\",\n ).exec(attributes);\n return match?.[1] ?? match?.[2] ?? match?.[3] ?? null;\n}\n\nfunction decodeHtmlAttribute(value: string): string {\n return value\n .replace(/&amp;/gi, \"&\")\n .replace(/&quot;/gi, '\"')\n .replace(/&#39;|&apos;/gi, \"'\")\n .replace(/&lt;/gi, \"<\")\n .replace(/&gt;/gi, \">\");\n}\n\n/** Turn complete model-emitted URL citation anchors into safe Markdown links. */\nexport function normalizeAthenaMentionHtml(text: string): string {\n return text.replace(\n /<a\\b([^>]*)>([\\s\\S]*?)<\\/a>/gi,\n (original, attributes: string, rawLabel: string) => {\n const className = htmlAttribute(attributes, \"class\") ?? \"\";\n const type = htmlAttribute(attributes, \"data-type\") ?? \"\";\n if (!className.split(/\\s+/).includes(\"mention\") || type !== \"url\") {\n return original;\n }\n\n const rawUrl =\n htmlAttribute(attributes, \"data-url\") ??\n htmlAttribute(attributes, \"href\");\n if (!rawUrl) return original;\n const url = decodeHtmlAttribute(rawUrl);\n let normalizedUrl: string;\n try {\n const parsed = new URL(url);\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n return original;\n }\n normalizedUrl = parsed.toString();\n } catch {\n return original;\n }\n\n const label = decodeHtmlAttribute(rawLabel.replace(/<[^>]*>/g, \"\"))\n .trim()\n .replace(/([\\\\[\\]])/g, \"\\\\$1\");\n return label ? `[${label}](<${normalizedUrl}>)` : original;\n },\n );\n}\n// ── Parse mention markdown in plain text ──\n\n// The label may hold balanced brackets one level deep (`[@Plan [Q3]](…)`) or a lone `[`.\nconst MENTION_RE =\n /\\[@((?:\\[[^[\\]]*\\](?!\\((?:[a-z][a-z0-9+.-]*:\\/\\/|\\/))|[^\\]])*)\\]\\(((?:mention:\\/\\/|(?:https?:\\/\\/[^)\\s]+)?\\/dashboard\\/spaces\\/?\\?)[^)]+)\\)/g;\n\n/**\n * Parse text containing [@name](mention://...) patterns into\n * an array of string segments and MentionChip elements.\n */\nexport function parseMentionsInText(text: string): (string | ReactElement)[] {\n const parts: (string | ReactElement)[] = [];\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n MENTION_RE.lastIndex = 0;\n\n while ((match = MENTION_RE.exec(text)) !== null) {\n if (match.index > lastIndex) {\n parts.push(text.slice(lastIndex, match.index));\n }\n\n const name = match[1];\n const url = match[2];\n const parsed = parseMentionUrl(url);\n\n parts.push(\n <MentionChip\n key={`mention-${match.index}`}\n name={name || parsed.name}\n type={parsed.type}\n personEmail={personEmailForMention(parsed)}\n assetIds={parsed.assetIds}\n assetType={parsed.assetType}\n citation={parsed.citation}\n thumbnailUrl={parsed.thumbnailUrl}\n sourceHref={isSpacesMentionUrl(url) ? url : parsed.sourceHref}\n />\n );\n\n lastIndex = match.index + match[0].length;\n }\n\n if (lastIndex < text.length) {\n parts.push(text.slice(lastIndex));\n }\n\n return parts.length > 0 ? parts : [text];\n}\n\n/** The text as a reader sees it: each `[@name](…)` mention becomes `@name`. */\nexport function mentionsToPlainText(text: string): string {\n return text.replace(MENTION_RE, (_match, name: string, url: string) => {\n return `@${name || parseMentionUrl(url).name}`;\n });\n}\n"],"names":["id","reference"],"mappings":";;;;;;;;;;;;;AAsDA,MAAM,sBAAsB;AAE5B,SAAS,mBAAmB,KAAsB;AAChD,SAAO,oBAAoB,KAAK,GAAG;AACrC;AAEA,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Q,WAAW,KAAK,IAAI,OAAO,MAAM;AAC/C,QAAI,MAAM,QAAQ,WAAW;AAC3B,YAAM,KAAK,KAAK,MAAM,WAAW,MAAM,KAAK,CAAC;AAAA,IAC/C;AAEA,UAAM,OAAO,MAAM,CAAC;AACpB,UAAM,MAAM,MAAM,CAAC;AACnB,UAAM,SAAS,gBAAgB,GAAG;AAElC,UAAM;AAAA,MACJ;AAAA,QAAC;AAAA,QAAA;AAAA,UAEC,MAAM,QAAQ,OAAO;AAAA,UACrB,MAAM,OAAO;AAAA,UACb,aAAa,sBAAsB,MAAM;AAAA,UACzC,UAAU,OAAO;AAAA,UACjB,WAAW,OAAO;AAAA,UAClB,UAAU,OAAO;AAAA,UACjB,cAAc,OAAO;AAAA,UACrB,YAAY,mBAAmB,GAAG,IAAI,MAAM,OAAO;AAAA,QAAA;AAAA,QAR9C,WAAW,MAAM,KAAK;AAAA,MAAA;AAAA,IAS7B;AAGF,gBAAY,MAAM,QAAQ,MAAM,CAAC,EAAE;AAAA,EACrC;AAEA,MAAI,YAAY,KAAK,QAAQ;AAC3B,UAAM,KAAK,KAAK,MAAM,SAAS,CAAC;AAAA,EAClC;AAEA,SAAO,MAAM,SAAS,IAAI,QAAQ,CAAC,IAAI;AACzC;AAGO,SAAS,oBAAoB,MAAsB;AACxD,SAAO,KAAK,QAAQ,YAAY,CAAC,QAAQ,MAAc,QAAgB;AACrE,WAAO,IAAI,QAAQ,gBAAgB,GAAG,EAAE,IAAI;AAAA,EAC9C,CAAC;AACH;"}
1
+ {"version":3,"file":"mention-chip.js","sources":["../../../src/chat-ui/mentions/mention-chip.tsx"],"sourcesContent":["/**\n * Mention chip rendering for message display.\n *\n * Parses [@name](mention://type?...) markdown links and renders them\n * as styled inline chips matching the Olympus mention style.\n * Used in both user messages (inline text) and assistant messages (markdown links).\n */\n\nimport {\n isValidElement,\n useContext,\n useState,\n type FC,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport {\n formatScreenPoint,\n isScreenPointHref,\n parseScreenPointHref,\n} from \"@athenaintel/agent-runtime\";\nimport {\n type AssetReference,\n decodeFromAssetMentionUri,\n decodeFromAssetSpacesUrl,\n encodeToAssetSpacesUrl,\n formatReferenceAnchor,\n} from \"@athenaintel/references/asset-links\";\nimport {\n CrosshairIcon,\n DatabaseIcon,\n FileCodeIcon,\n FileIcon,\n FileTextIcon,\n FolderIcon,\n Globe2Icon,\n HeadphonesIcon,\n ImageIcon,\n type LucideIcon,\n MailIcon,\n MessageSquareIcon,\n MonitorIcon,\n PresentationIcon,\n SheetIcon,\n UserIcon,\n UsersIcon,\n VideoIcon,\n} from \"lucide-react\";\nimport { cn } from \"../../lib/utils\";\nimport { createOlympusAssetUrl } from \"../lib/asset-urls\";\nimport { MentionAuthCtx } from \"./suggestions/data/api-client\";\nimport { assetTypeToThumb } from \"./suggestions/data/sources/asset-type-icons\";\nimport { useAssetIconAppUrl } from \"./use-asset-icon-app-url\";\nimport { useThumbnailLoadFailure } from \"./suggestions/components/mention-icon\";\nimport { useMemberAvatarUrl } from \"./use-member-avatar\";\nimport { useMentionAsset } from \"./use-mention-asset\";\n\nconst SPACES_MENTION_PATH = /\\/dashboard\\/spaces\\/?\\?/;\n\nfunction isSpacesMentionUrl(url: string): boolean {\n return SPACES_MENTION_PATH.test(url);\n}\n\nfunction getSpacesAssetType(url: URL): string | null {\n const assetType =\n url.searchParams.get(\"assetType\") ||\n url.searchParams.get(\"asset_type\") ||\n url.searchParams.get(\"type\");\n return assetType === \"sheet\" ? \"spreadsheet\" : assetType;\n}\n\n/**\n * Where in the asset a citation points, as its chip shows it. The anchor is\n * read and labelled by `@athenaintel/references` — the same parser and labels\n * Olympus's mention chips use — so a chip reads `jwt.py:12-25`, `p.5` or\n * `Slide 3` in every Athena chat.\n */\nexport interface MentionChipCitation {\n /** The anchor type (`page`, `file_line_range`, `slide`, …). */\n anchorType: string;\n /** The short label drawn after the name (`p.5`, `jwt.py:12-25`). */\n label: string;\n /**\n * The place spelled out (`Page 5`, `agora/…/jwt.py:12-25`), without the\n * excerpt: the tooltip when the link carries no excerpt, and part of the\n * chip's accessible name when it holds a word.\n */\n description: string;\n}\n\n/** The citation an asset link's anchor names, or undefined for a plain mention or an anchor nobody can read. */\nfunction citationOf(reference: AssetReference): MentionChipCitation | undefined {\n const { anchor, meta } = reference;\n if (!anchor) return undefined;\n const label = formatReferenceAnchor(anchor, \"short\", meta);\n if (!label) return undefined;\n const { excerpt: _excerpt, ...place } = meta ?? {};\n return {\n anchorType: anchor.type,\n label,\n description: formatReferenceAnchor(anchor, \"long\", place) ?? label,\n };\n}\n\n/**\n * The chip's icon for an asset type when its SVG is not available (no icon\n * source, or the SVG failed to load).\n * A compact set on purpose: the chip renders in every message (and Olympus's\n * main layout reaches it through the queued-message tray), so it carries a\n * dozen icons rather than the `@` menu's whole map.\n */\nconst ASSET_CHIP_ICONS: Record<string, LucideIcon> = {\n document: FileTextIcon,\n word_document: FileTextIcon,\n markdown: FileTextIcon,\n txt: FileTextIcon,\n pdf: FileTextIcon,\n spreadsheet: SheetIcon,\n table: SheetIcon,\n presentation: PresentationIcon,\n powerpoint_deck: PresentationIcon,\n presentation_pptx_studio: PresentationIcon,\n pptx: PresentationIcon,\n image: ImageIcon,\n figure: ImageIcon,\n canvas: ImageIcon,\n video: VideoIcon,\n meeting: VideoIcon,\n video_session: VideoIcon,\n audio: HeadphonesIcon,\n voice_memo: HeadphonesIcon,\n phone_call: HeadphonesIcon,\n email: MailIcon,\n email_message: MailIcon,\n live_email_thread: MailIcon,\n live_calendar_event: MailIcon,\n python: FileCodeIcon,\n javascript: FileCodeIcon,\n typescript: FileCodeIcon,\n json: FileCodeIcon,\n yaml: FileCodeIcon,\n database: DatabaseIcon,\n catalog: DatabaseIcon,\n drive: DatabaseIcon,\n dataset: DatabaseIcon,\n semantic_model: DatabaseIcon,\n query_snippet: DatabaseIcon,\n folder: FolderIcon,\n gdrive_folder: FolderIcon,\n project: FolderIcon,\n collection: FolderIcon,\n session: MessageSquareIcon,\n computer: MonitorIcon,\n desktop_session: MonitorIcon,\n user_interface: MonitorIcon,\n application: MonitorIcon,\n html: Globe2Icon,\n web_page: Globe2Icon,\n browse_session: Globe2Icon,\n};\n\nfunction assetChipIcon(assetType: string | undefined): LucideIcon {\n return (assetType && ASSET_CHIP_ICONS[assetType.toLowerCase()]) || FileIcon;\n}\n\n/**\n * GitHub's mark (Octicons `mark-github`), drawn by a repository file's\n * citation. Lucide carries no brand icons and an SDK app serves none of\n * Olympus's, so the chip brings its own. Only a GitHub repository catalog\n * serves `file_line_range` anchors (`ASSET_ANCHOR_REGISTRY`; agora's\n * `_CATALOG_ANCHORS_BY_PROVIDER`), so the anchor alone names the provider.\n */\nfunction GitHubMarkIcon({ className }: { className?: string }) {\n return (\n <svg\n viewBox=\"0 0 16 16\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n className={className}\n data-chip-icon=\"github\"\n >\n <path d=\"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z\" />\n </svg>\n );\n}\n\n/** Past this many characters a place may not show whole in the chip, so the tooltip spells it out. */\nconst PLACE_FITS_CHARS = 20;\n\n/** `route.ts:18-24` as the file's name and its lines, so a long name shortens while its lines stay. */\nfunction splitFileLines(label: string): { file: string; lines: string } {\n const colon = label.lastIndexOf(\":\");\n return colon > 0\n ? { file: label.slice(0, colon), lines: label.slice(colon) }\n : { file: label, lines: \"\" };\n}\n\n/**\n * Whether a name already says where its citation points: the place's label or\n * its spelled-out form, or a name ending in the label (`Q4 report p.5`,\n * `olympus/…/route.ts:18-24`). The chip then draws the place once.\n */\nfunction restatesPlace(name: string, citation: MentionChipCitation): boolean {\n const said = name.trim().toLowerCase();\n const label = citation.label.toLowerCase();\n return said === label || said === citation.description.toLowerCase() || said.endsWith(label);\n}\n\n/**\n * The link's own label when it tells the reader something the chip does not\n * already show: not the place again (a path, `file:lines`), not the asset's\n * name. The tooltip keeps it, since the chip shows the asset and the place.\n */\nfunction informativeLabel({\n label,\n shown,\n citation,\n}: {\n label: string;\n shown: readonly (string | null | undefined)[];\n citation: MentionChipCitation | undefined;\n}): string | null {\n const trimmed = label.trim();\n if (!trimmed || !SPEAKABLE.test(trimmed)) return null;\n if (PLACEHOLDER_LABELS.has(trimmed.toLowerCase())) return null;\n if (citation && restatesPlace(trimmed, citation)) return null;\n // Every word of it already shown (`Tesla Q3 report` beside `Tesla Q3\n // Earnings Report`, `demo-app-monorepo` beside the repository's title).\n const shownWords = new Set(\n [...shown, citation?.description].flatMap((text) => (text ? wordsOf(text) : [])),\n );\n return wordsOf(trimmed).every((word) => shownWords.has(word)) ? null : trimmed;\n}\n\nfunction wordsOf(text: string): string[] {\n return text.toLowerCase().match(/[\\p{L}\\p{N}]+/gu) ?? [];\n}\n\n/** A label with a letter or digit in it; `§` or `•` alone says nothing read aloud. */\nconst SPEAKABLE = /[\\p{L}\\p{N}]/u;\n\n/** Labels that name nothing: agora's read_asset citations all read `Citation`. */\nconst PLACEHOLDER_LABELS: ReadonlySet<string> = new Set([\"citation\", \"source\", \"link\", \"here\"]);\n\n/** The asset reference an asset link decodes to, or null when it does not parse. */\nfunction decodeAssetLink(\n url: URL,\n decode: (url: URL) => AssetReference,\n): AssetReference | null {\n try {\n return decode(url);\n } catch {\n return null;\n }\n}\n\n// ── Mention link component for markdown renderer ──\n\n/**\n * Custom <a> renderer for MarkdownTextPrimitive.\n * Intercepts mention:// links and renders them as chips.\n * Falls through to a normal link for non-mention URLs.\n */\nfunction personEmailForMention(\n parsed: ReturnType<typeof parseMentionUrl>,\n): string | undefined {\n if (parsed.type !== \"person\") return undefined;\n return parsed.email || (parsed.id.includes(\"@\") ? parsed.id : undefined);\n}\n\n/**\n * The text a link's children read as. Markdown can hand a link several children, some of them\n * elements (an escaped `_` or a `*` in a URL splits its text), and stringifying an element gives\n * `[object Object]`.\n */\nfunction textOf(node: ReactNode): string {\n if (typeof node === \"string\" || typeof node === \"number\") return String(node);\n if (Array.isArray(node)) return node.map(textOf).join(\"\");\n if (isValidElement<{ children?: ReactNode }>(node)) return textOf(node.props.children);\n return \"\";\n}\n\nexport const MentionLink: FC<{\n href?: string;\n children?: ReactNode;\n interactive?: boolean;\n}> = ({ href, children, interactive = true }) => {\n if (\n href &&\n (href.startsWith(\"mention://\") || isSpacesMentionUrl(href))\n ) {\n const name = textOf(children).trim().replace(/^@/, \"\");\n\n const parsed = parseMentionUrl(href);\n\n return (\n <MentionChip\n name={name || parsed.name}\n type={parsed.type}\n personEmail={personEmailForMention(parsed)}\n assetIds={parsed.assetIds}\n assetType={parsed.assetType}\n citation={parsed.citation}\n thumbnailUrl={parsed.thumbnailUrl}\n sourceHref={isSpacesMentionUrl(href) ? href : parsed.sourceHref}\n interactive={interactive}\n />\n );\n }\n\n if (href?.startsWith(\"chrome-extension://\")) {\n return <span>{children}</span>;\n }\n\n if (isScreenPointHref(href)) {\n return <ScreenPointChip href={href}>{children}</ScreenPointChip>;\n }\n\n // Normal link — render as-is\n return (\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n {children}\n </a>\n );\n};\n\n// ── The chip pill ──\n\n/**\n * Olympus's mention pill (`mentionPillClassName`: 20px high, 16px icon, the\n * place in `text-xs`) in the provider's theme tokens, so a dark theme keeps it\n * legible, and `box-border` so its height holds without a host's CSS reset.\n * Every chat chip draws it: an asset or citation chip, a web source, a screen\n * point. Only stock Tailwind sizes: Olympus renders these chips (the queued\n * message tray) with a stylesheet that does not scan this package, so an\n * arbitrary value would reach it unstyled. `not-prose` matters: assistant\n * messages render inside Tailwind Typography's `prose`, whose\n * zero-specificity `img` margins (~1.7em top/bottom) would otherwise inflate\n * the chip's icon into a tall card that breaks the sentence flow around it.\n */\nexport const CHIP_PILL_CLASS =\n \"not-prose box-border inline-flex h-5 items-center gap-1.5 whitespace-nowrap rounded-md border border-border bg-muted px-1 py-0.5 align-middle font-normal leading-none text-foreground no-underline\";\n/** A chip that opens something. */\nexport const CHIP_LINK_CLASS =\n \"cursor-pointer transition-colors hover:bg-accent hover:text-accent-foreground hover:no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-1\";\nexport const CHIP_ICON_CLASS = \"size-4 shrink-0\";\n\n// ── Inline screen-point chip ──\n\n/**\n * Renders an `athena-point://` link as a non-navigating coordinate chip.\n * Surfaces without screenshot context (extension side panel, SDK consumers)\n * get the label plus the coordinates; malformed points fall back to text.\n */\nexport const ScreenPointChip: FC<{\n href: string;\n children?: ReactNode;\n}> = ({ href, children }) => {\n const parsed = parseScreenPointHref(href);\n if (!parsed.ok) {\n return <span>{children}</span>;\n }\n const description = formatScreenPoint(parsed.point);\n return (\n <span\n className={cn(CHIP_PILL_CLASS, \"max-w-[260px]\")}\n title={description}\n aria-label={description}\n data-screen-point=\"valid\"\n >\n <CrosshairIcon className={CHIP_ICON_CLASS} aria-hidden=\"true\" />\n <span className=\"min-w-0 max-w-[180px] overflow-hidden text-ellipsis\">\n {children}\n </span>\n <span className=\"shrink-0 text-xs text-muted-foreground\">\n {parsed.point.x}, {parsed.point.y}\n </span>\n </span>\n );\n};\n\n// ── Inline mention chip ──\n\nexport const MentionChip: FC<{\n name: string;\n type?: string;\n assetIds?: string[];\n /** The asset's type (`document`, `catalog`, …): picks the icon until (or unless) the asset is looked up. */\n assetType?: string;\n /** Where in the asset the link points: its label follows the name. */\n citation?: MentionChipCitation;\n personEmail?: string;\n thumbnailUrl?: string;\n sourceHref?: string;\n interactive?: boolean;\n}> = ({\n name,\n type,\n assetIds,\n assetType,\n citation,\n personEmail,\n thumbnailUrl,\n sourceHref,\n interactive = true,\n}) => {\n const auth = useContext(MentionAuthCtx);\n const iconAppUrl = useAssetIconAppUrl();\n const memberAvatarUrl = useMemberAvatarUrl(personEmail);\n const [erroredAvatarUrl, setErroredAvatarUrl] = useState<string>();\n const excerpt = sourceHref ? readSourceExcerpt(sourceHref) : null;\n // A repository file's lines read as the file (`route.ts:18-24`): the chip\n // opens that file, and every citation in a reply names the same repository,\n // whatever label the model wrote.\n const repositoryFile =\n citation?.anchorType === \"file_line_range\"\n ? { ...splitFileLines(citation.label), label: citation.label }\n : null;\n // The asset as agora has it, read the way Olympus's chips read it: its own\n // title and type. Until it answers, and for an asset the viewer cannot read,\n // the link's label and `type=` stand in. Not asked for a repository file,\n // which reads as its file whatever the catalog is called.\n const asset = useMentionAsset(\n type === \"asset\" && assetIds?.length === 1 && !repositoryFile ? assetIds[0] : undefined,\n );\n const assetTitle = asset?.title || null;\n const chipName = repositoryFile?.label ?? assetTitle ?? name;\n // The place follows a name that does not already say it, as `[p.5]`.\n const placeLabel =\n citation && !repositoryFile && !restatesPlace(chipName, citation)\n ? citation.label\n : null;\n // The tooltip: what the model called it (when the chip does not show it),\n // the repository a file is in and the file's whole path, the cited passage.\n // The place spelled out stands in for a passage the citation does not carry,\n // and for a place too long to show whole (a long sheet name).\n const tooltip =\n citation || excerpt\n ? tooltipText({\n lines: [\n informativeLabel({ label: name, shown: [chipName, assetTitle], citation }),\n repositoryFile ? assetTitle : null,\n repositoryFile || !excerpt || (placeLabel?.length ?? 0) > PLACE_FITS_CHARS\n ? citation?.description\n : null,\n ],\n excerpt,\n })\n : null;\n const assetRootHref =\n type === \"asset\" && assetIds?.length\n ? createOlympusAssetUrl({\n appUrl: auth?.appUrl,\n backendUrl: auth?.backendUrl,\n assetIds,\n })\n : null;\n const href = (() => {\n if (!assetRootHref || !sourceHref) return assetRootHref;\n try {\n const source = new URL(sourceHref, \"https://app.athenaintel.com\");\n const destination = new URL(assetRootHref);\n for (const [key, value] of source.searchParams) {\n destination.searchParams.set(key, value);\n }\n destination.searchParams.set(\"asset_ids\", assetIds?.join(\",\") ?? \"\");\n return destination.toString();\n } catch {\n return assetRootHref;\n }\n })();\n const className = cn(CHIP_PILL_CLASS, \"max-w-[275px]\", href && CHIP_LINK_CLASS);\n // The asset-type SVG follows the looked-up type, then the link's own\n // thumbnail or `type=`, from the chat's Athena web app (or the host's copy).\n // One that cannot load (a strict CSP, offline) gives way to the type's\n // Lucide icon below.\n const typeThumbnailUrl = repositoryFile\n ? undefined\n : (asset?.assetType && assetTypeToThumb(asset.assetType, { appUrl: iconAppUrl })) ||\n thumbnailUrl ||\n (type === \"asset\" || type === \"folder\"\n ? assetTypeToThumb(type === \"folder\" ? \"folder\" : assetType, { appUrl: iconAppUrl })\n : undefined);\n const typeThumbnail = useThumbnailLoadFailure(typeThumbnailUrl);\n const chipThumbnailUrl = typeThumbnail.failed ? undefined : typeThumbnailUrl;\n const AssetIcon = assetChipIcon(asset?.assetType || assetType);\n const contents = (\n <>\n {repositoryFile ? (\n <GitHubMarkIcon className={CHIP_ICON_CLASS} />\n ) : chipThumbnailUrl ? (\n <img\n ref={typeThumbnail.imageRef}\n src={chipThumbnailUrl}\n alt=\"\"\n className={CHIP_ICON_CLASS}\n draggable={false}\n />\n ) : type === \"asset\" || type === \"folder\" ? (\n // Outside a provider with no host copy of the SVGs, or when one\n // cannot load, the chip still draws the type's icon.\n <AssetIcon className={CHIP_ICON_CLASS} aria-hidden=\"true\" />\n ) : type === \"webpage\" ? (\n <Globe2Icon className={CHIP_ICON_CLASS} aria-hidden=\"true\" />\n ) : type === \"person\" ? (\n memberAvatarUrl && erroredAvatarUrl !== memberAvatarUrl ? (\n <img\n src={memberAvatarUrl}\n alt=\"\"\n className={cn(CHIP_ICON_CLASS, \"rounded-full object-cover\")}\n draggable={false}\n onError={() => setErroredAvatarUrl(memberAvatarUrl)}\n />\n ) : (\n <UserIcon className={CHIP_ICON_CLASS} aria-hidden=\"true\" />\n )\n ) : type === \"group\" ? (\n <UsersIcon className={CHIP_ICON_CLASS} aria-hidden=\"true\" />\n ) : null}\n {repositoryFile ? (\n <span\n className=\"flex min-w-0 items-center\"\n data-citation-anchor=\"file_line_range\"\n >\n <span className=\"min-w-0 overflow-hidden text-ellipsis\">\n {repositoryFile.file}\n </span>\n <span className=\"shrink-0 text-muted-foreground\">{repositoryFile.lines}</span>\n </span>\n ) : (\n <span\n className={cn(\n \"max-w-[180px] overflow-hidden text-ellipsis\",\n // A long place may shorten the name, never make it vanish.\n placeLabel && \"min-w-8\",\n )}\n >\n {chipName}\n </span>\n )}\n {citation && placeLabel && (\n <>\n {/* Copied or read as text, the place stays a word apart from the name; a flex row draws no space. */}{\" \"}\n <span\n className=\"flex min-w-0 items-center text-xs text-muted-foreground\"\n data-citation-anchor={citation.anchorType}\n >\n [<span className=\"min-w-0 overflow-hidden text-ellipsis\">{placeLabel}</span>]\n </span>\n </>\n )}\n </>\n );\n\n if (href && interactive) {\n const speakablePlace = citation && SPEAKABLE.test(citation.description);\n return (\n <a\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={className}\n aria-label={\n repositoryFile && citation\n ? `Open ${citation.description} in Spaces`\n : placeLabel && citation && speakablePlace\n ? `Open ${chipName} at ${citation.description} in Spaces`\n : `Open ${chipName} in Spaces`\n }\n title={tooltip ?? `Open ${chipName} in Spaces`}\n data-excerpt={excerpt ?? undefined}\n // The asset without its place: what a click names the opened asset.\n data-mention-name={repositoryFile ? (assetTitle ?? name) : chipName}\n >\n {contents}\n </a>\n );\n }\n\n return (\n <span\n className={className}\n title={tooltip ?? undefined}\n data-excerpt={excerpt ?? undefined}\n >\n {contents}\n </span>\n );\n};\n\n/**\n * A chip's tooltip: the lines that say something, each once, then the cited\n * passage, quoted when it shares the tooltip with other lines.\n */\nfunction tooltipText({\n lines,\n excerpt,\n}: {\n lines: readonly (string | null | undefined)[];\n excerpt: string | null;\n}): string | null {\n const kept: string[] = [];\n for (const line of lines) {\n const trimmed = line?.trim();\n if (trimmed && !kept.includes(trimmed)) kept.push(trimmed);\n }\n if (excerpt) kept.push(kept.length ? `“${excerpt}”` : excerpt);\n return kept.length ? kept.join(\"\\n\") : null;\n}\n\n/** The `excerpt` a Spaces citation URL carries, or null. */\nfunction readSourceExcerpt(href: string): string | null {\n try {\n const excerpt = new URL(href, \"https://app.athenaintel.com\").searchParams\n .get(\"excerpt\")\n ?.trim();\n return excerpt ? excerpt : null;\n } catch {\n return null;\n }\n}\n\n/**\n * The label an asset citation chip falls back to when the model wrote none\n * (`[](…/spaces/?asset_ids=…&page=5)`): the cited location, else \"Asset\" — a\n * chip must never render as an empty box.\n */\nfunction citationFallbackLabel(params: URLSearchParams): string {\n const start = params.get(\"start_page\") ?? params.get(\"page\");\n const end = params.get(\"end_page\");\n if (start && end && end !== start) return `Pages ${start}–${end}`;\n if (start) return `Page ${start}`;\n return \"Asset\";\n}\n\n// ── Parse mention:// URLs ──\n\nexport function parseMentionUrl(url: string): {\n type: string;\n name: string;\n id: string;\n email?: string;\n assetIds?: string[];\n assetType?: string;\n citation?: MentionChipCitation;\n /**\n * For a `mention://asset` citation, the Spaces link to its place (anchor and\n * excerpt), so the chip opens there; a Spaces mention is its own link.\n */\n sourceHref?: string;\n thumbnailUrl?: string;\n} {\n try {\n if (isSpacesMentionUrl(url)) {\n const parsed = new URL(url, \"https://app.athenaintel.com\");\n const assetIds = (parsed.searchParams.get(\"asset_ids\") ?? \"\")\n .split(\",\")\n .map((id) => id.trim())\n .filter(Boolean);\n const id = assetIds[0] ?? \"\";\n const assetType = getSpacesAssetType(parsed);\n // A link to several assets names no one place in any of them.\n const reference =\n assetIds.length === 1\n ? decodeAssetLink(parsed, decodeFromAssetSpacesUrl)\n : null;\n const citation = reference ? citationOf(reference) : undefined;\n return {\n type: \"asset\",\n name:\n assetIds.length > 1\n ? `${assetIds.length} assets`\n : (citation?.description ??\n citationFallbackLabel(parsed.searchParams)),\n id,\n assetIds,\n assetType: assetType ?? undefined,\n citation,\n thumbnailUrl: assetTypeToThumb(assetType),\n };\n }\n // mention://tool?name=...&description=...\n // mention://asset?id=...&assetType=project&thumb=../icons/files/ic-project.svg\n const u = new URL(url);\n const type = u.hostname || u.pathname.replace(/^\\/\\//, \"\").split(\"?\")[0];\n const isWebpage = type === \"webpage\";\n const id = isWebpage\n ? u.searchParams.get(\"tab_id\") || \"\"\n : u.searchParams.get(\"id\") || u.searchParams.get(\"name\") || \"\";\n const name = isWebpage\n ? u.searchParams.get(\"title\") || \"This webpage\"\n : u.searchParams.get(\"name\") || id;\n\n // Get thumbnail: prefer explicit thumb param, then derive from assetType\n let thumbnailUrl = u.searchParams.get(\"thumb\") || undefined;\n if (!thumbnailUrl) {\n const assetType = u.searchParams.get(\"assetType\");\n if (assetType) {\n thumbnailUrl = assetTypeToThumb(assetType);\n } else if (type === \"asset\" || type === \"folder\") {\n thumbnailUrl = assetTypeToThumb(type === \"folder\" ? \"folder\" : null);\n }\n }\n\n const reference =\n type === \"asset\" ? decodeAssetLink(u, decodeFromAssetMentionUri) : null;\n\n return {\n type,\n name,\n id,\n email: type === \"person\" ? u.searchParams.get(\"email\") || undefined : undefined,\n assetIds: type === \"asset\" && id ? [id] : undefined,\n assetType:\n type === \"asset\" || type === \"folder\"\n ? u.searchParams.get(\"assetType\") ||\n reference?.meta?.assetType ||\n (type === \"folder\" ? \"folder\" : undefined)\n : undefined,\n citation: reference ? citationOf(reference) : undefined,\n sourceHref:\n reference && (reference.anchor || reference.meta?.excerpt)\n ? encodeToAssetSpacesUrl(reference)\n : undefined,\n thumbnailUrl,\n };\n } catch {\n return { type: \"unknown\", name: \"\", id: \"\" };\n }\n}\n\nfunction htmlAttribute(attributes: string, name: string): string | null {\n const escapedName = name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const match = new RegExp(\n `(?:^|\\\\s)${escapedName}\\\\s*=\\\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\\\s>]+))`,\n \"i\",\n ).exec(attributes);\n return match?.[1] ?? match?.[2] ?? match?.[3] ?? null;\n}\n\nfunction decodeHtmlAttribute(value: string): string {\n return value\n .replace(/&amp;/gi, \"&\")\n .replace(/&quot;/gi, '\"')\n .replace(/&#39;|&apos;/gi, \"'\")\n .replace(/&lt;/gi, \"<\")\n .replace(/&gt;/gi, \">\");\n}\n\n/** Turn complete model-emitted URL citation anchors into safe Markdown links. */\nexport function normalizeAthenaMentionHtml(text: string): string {\n return text.replace(\n /<a\\b([^>]*)>([\\s\\S]*?)<\\/a>/gi,\n (original, attributes: string, rawLabel: string) => {\n const className = htmlAttribute(attributes, \"class\") ?? \"\";\n const type = htmlAttribute(attributes, \"data-type\") ?? \"\";\n if (!className.split(/\\s+/).includes(\"mention\") || type !== \"url\") {\n return original;\n }\n\n const rawUrl =\n htmlAttribute(attributes, \"data-url\") ??\n htmlAttribute(attributes, \"href\");\n if (!rawUrl) return original;\n const url = decodeHtmlAttribute(rawUrl);\n let normalizedUrl: string;\n try {\n const parsed = new URL(url);\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n return original;\n }\n normalizedUrl = parsed.toString();\n } catch {\n return original;\n }\n\n const label = decodeHtmlAttribute(rawLabel.replace(/<[^>]*>/g, \"\"))\n .trim()\n .replace(/([\\\\[\\]])/g, \"\\\\$1\");\n return label ? `[${label}](<${normalizedUrl}>)` : original;\n },\n );\n}\n// ── Parse mention markdown in plain text ──\n\n// The label may hold balanced brackets one level deep (`[@Plan [Q3]](…)`) or a lone `[`.\nconst MENTION_RE =\n /\\[@((?:\\[[^[\\]]*\\](?!\\((?:[a-z][a-z0-9+.-]*:\\/\\/|\\/))|[^\\]])*)\\]\\(((?:mention:\\/\\/|(?:https?:\\/\\/[^)\\s]+)?\\/dashboard\\/spaces\\/?\\?)[^)]+)\\)/g;\n\n/**\n * Parse text containing [@name](mention://...) patterns into\n * an array of string segments and MentionChip elements.\n */\nexport function parseMentionsInText(text: string): (string | ReactElement)[] {\n const parts: (string | ReactElement)[] = [];\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n MENTION_RE.lastIndex = 0;\n\n while ((match = MENTION_RE.exec(text)) !== null) {\n if (match.index > lastIndex) {\n parts.push(text.slice(lastIndex, match.index));\n }\n\n const name = match[1];\n const url = match[2];\n const parsed = parseMentionUrl(url);\n\n parts.push(\n <MentionChip\n key={`mention-${match.index}`}\n name={name || parsed.name}\n type={parsed.type}\n personEmail={personEmailForMention(parsed)}\n assetIds={parsed.assetIds}\n assetType={parsed.assetType}\n citation={parsed.citation}\n thumbnailUrl={parsed.thumbnailUrl}\n sourceHref={isSpacesMentionUrl(url) ? url : parsed.sourceHref}\n />\n );\n\n lastIndex = match.index + match[0].length;\n }\n\n if (lastIndex < text.length) {\n parts.push(text.slice(lastIndex));\n }\n\n return parts.length > 0 ? parts : [text];\n}\n\n/** The text as a reader sees it: each `[@name](…)` mention becomes `@name`. */\nexport function mentionsToPlainText(text: string): string {\n return text.replace(MENTION_RE, (_match, name: string, url: string) => {\n return `@${name || parseMentionUrl(url).name}`;\n });\n}\n"],"names":["id","reference"],"mappings":";;;;;;;;;;;;;;;AAyDA,MAAM,sBAAsB;AAE5B,SAAS,mBAAmB,KAAsB;AAChD,SAAO,oBAAoB,KAAK,GAAG;AACrC;AAEA,SAAS,mBAAmB,KAAyB;AACnD,QAAM,YACJ,IAAI,aAAa,IAAI,WAAW,KAChC,IAAI,aAAa,IAAI,YAAY,KACjC,IAAI,aAAa,IAAI,MAAM;AAC7B,SAAO,cAAc,UAAU,gBAAgB;AACjD;AAsBA,SAAS,WAAW,WAA4D;AAC9E,QAAM,EAAE,QAAQ,KAAA,IAAS;AACzB,MAAI,CAAC,OAAQ,Q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AY;AAChB,MAAI;AAEJ,aAAW,YAAY;AAEvB,UAAQ,QAAQ,WAAW,KAAK,IAAI,OAAO,MAAM;AAC/C,QAAI,MAAM,QAAQ,WAAW;AAC3B,YAAM,KAAK,KAAK,MAAM,WAAW,MAAM,KAAK,CAAC;AAAA,IAC/C;AAEA,UAAM,OAAO,MAAM,CAAC;AACpB,UAAM,MAAM,MAAM,CAAC;AACnB,UAAM,SAAS,gBAAgB,GAAG;AAElC,UAAM;AAAA,MACJ;AAAA,QAAC;AAAA,QAAA;AAAA,UAEC,MAAM,QAAQ,OAAO;AAAA,UACrB,MAAM,OAAO;AAAA,UACb,aAAa,sBAAsB,MAAM;AAAA,UACzC,UAAU,OAAO;AAAA,UACjB,WAAW,OAAO;AAAA,UAClB,UAAU,OAAO;AAAA,UACjB,cAAc,OAAO;AAAA,UACrB,YAAY,mBAAmB,GAAG,IAAI,MAAM,OAAO;AAAA,QAAA;AAAA,QAR9C,WAAW,MAAM,KAAK;AAAA,MAAA;AAAA,IAS7B;AAGF,gBAAY,MAAM,QAAQ,MAAM,CAAC,EAAE;AAAA,EACrC;AAEA,MAAI,YAAY,KAAK,QAAQ;AAC3B,UAAM,KAAK,KAAK,MAAM,SAAS,CAAC;AAAA,EAClC;AAEA,SAAO,MAAM,SAAS,IAAI,QAAQ,CAAC,IAAI;AACzC;AAGO,SAAS,oBAAoB,MAAsB;AACxD,SAAO,KAAK,QAAQ,YAAY,CAAC,QAAQ,MAAc,QAAgB;AACrE,WAAO,IAAI,QAAQ,gBAAgB,GAAG,EAAE,IAAI;AAAA,EAC9C,CAAC;AACH;"}
@@ -16,8 +16,14 @@ function makeMentionUrl(attrs) {
16
16
  if (attrs.type === "user") {
17
17
  const params2 = new URLSearchParams({ id: attrs.id });
18
18
  if (attrs.id.includes("@")) params2.set("email", attrs.id);
19
+ if (attrs.name) params2.set("name", attrs.name);
19
20
  return `mention://person?${params2.toString()}`;
20
21
  }
22
+ if (attrs.type === "group") {
23
+ const params2 = new URLSearchParams({ id: attrs.id });
24
+ if (attrs.name) params2.set("name", attrs.name);
25
+ return `mention://group?${params2.toString()}`;
26
+ }
21
27
  if (attrs.type === "tab") {
22
28
  const params2 = new URLSearchParams({
23
29
  tab_id: attrs.id,
@@ -42,11 +48,12 @@ function parseMentionAnchorAttributes({
42
48
  const url = new URL(href);
43
49
  const isWebpage = url.hostname === "webpage";
44
50
  const isPerson = url.hostname === "person";
51
+ const isGroup = url.hostname === "group";
45
52
  return {
46
53
  href,
47
54
  type: isWebpage ? "tab" : isPerson ? "user" : url.hostname || "tool",
48
55
  name: (textContent == null ? void 0 : textContent.replace(/^@/, "")) || "",
49
- id: isWebpage ? url.searchParams.get("tab_id") || "" : isPerson ? url.searchParams.get("id") || url.searchParams.get("email") || "" : url.searchParams.get("name") || url.searchParams.get("id") || "",
56
+ id: isWebpage ? url.searchParams.get("tab_id") || "" : isPerson ? url.searchParams.get("id") || url.searchParams.get("email") || "" : isGroup ? url.searchParams.get("id") || "" : url.searchParams.get("name") || url.searchParams.get("id") || "",
50
57
  title: url.searchParams.get("title") || "",
51
58
  url: url.searchParams.get("url") || "",
52
59
  description: url.searchParams.get("description") || "",
@@ -1 +1 @@
1
- {"version":3,"file":"mention-extension.cjs","sources":["../../../src/chat-ui/mentions/mention-extension.ts"],"sourcesContent":["/**\n * Tiptap Mention Node Extension\n *\n * Defines the mention node type used in the editor. When a mention is\n * inserted, it creates a non-editable inline node with metadata.\n *\n * Renders as a chip with: [icon] Name. Serializes — to plain text and to\n * Markdown alike — as `[@Name](url)`, and parses that link back into a chip.\n */\n\nimport { mergeAttributes, Node } from \"@tiptap/core\";\nimport type { Node as ProseMirrorNode } from \"@tiptap/pm/model\";\n\nexport function makeMentionUrl(attrs: { id: string; type: string; name: string; title?: string; url?: string; description?: string; thumbnailUrl?: string; assetType?: string; href?: string }): string {\n if (attrs.href && (attrs.href.startsWith(\"mention://\") || ASSET_MENTION_HREF.test(attrs.href))) {\n return attrs.href;\n }\n if (attrs.type === \"tool\" || attrs.type === \"toolkit\") {\n return `mention://${attrs.type}?name=${encodeURIComponent(attrs.id)}&description=${encodeURIComponent(attrs.description ?? \"\")}`;\n }\n if (attrs.type === \"asset\") {\n const params = new URLSearchParams({ asset_ids: attrs.id });\n if (attrs.assetType) params.set(\"assetType\", attrs.assetType);\n return `/dashboard/spaces?${params.toString()}`;\n }\n if (attrs.type === \"user\") {\n // The canonical person reference Olympus writes (packages/references\n // `encodeToPersonMentionUri`); members are keyed on their email.\n const params = new URLSearchParams({ id: attrs.id });\n if (attrs.id.includes(\"@\")) params.set(\"email\", attrs.id);\n return `mention://person?${params.toString()}`;\n }\n if (attrs.type === \"tab\") {\n const params = new URLSearchParams({\n tab_id: attrs.id,\n url: attrs.url ?? \"\",\n title: attrs.title ?? attrs.name,\n });\n return `mention://webpage?${params.toString()}`;\n }\n // Include athenaOriginalType and thumbnailUrl so the chip can be reconstructed\n const params = new URLSearchParams();\n params.set(\"id\", attrs.id);\n if (attrs.assetType) params.set(\"assetType\", attrs.assetType);\n if (attrs.thumbnailUrl) params.set(\"thumb\", attrs.thumbnailUrl);\n return `mention://${encodeURIComponent(attrs.type)}?${params.toString()}`;\n}\n\nexport interface MentionNodeAttrs {\n type: string;\n name: string;\n id: string;\n title?: string;\n url?: string;\n description?: string;\n thumbnailUrl?: string;\n fallbackIcon?: string;\n assetType?: string;\n displayAsPreview?: boolean;\n href?: string;\n}\n\n/** The `[@Name](url)` form a mention takes in the outgoing text. */\nexport function serializeMention(attrs: MentionNodeAttrs): string {\n return `[@${attrs.name}](${makeMentionUrl(attrs)})`;\n}\n\nexport function parseMentionAnchorAttributes({\n href,\n textContent,\n}: {\n href: string;\n textContent: string | null;\n}): MentionNodeAttrs {\n const url = new URL(href);\n const isWebpage = url.hostname === \"webpage\";\n const isPerson = url.hostname === \"person\";\n return {\n href,\n type: isWebpage ? \"tab\" : isPerson ? \"user\" : url.hostname || \"tool\",\n name: textContent?.replace(/^@/, \"\") || \"\",\n id: isWebpage\n ? url.searchParams.get(\"tab_id\") || \"\"\n : isPerson\n ? url.searchParams.get(\"id\") || url.searchParams.get(\"email\") || \"\"\n : url.searchParams.get(\"name\") || url.searchParams.get(\"id\") || \"\",\n title: url.searchParams.get(\"title\") || \"\",\n url: url.searchParams.get(\"url\") || \"\",\n description: url.searchParams.get(\"description\") || \"\",\n thumbnailUrl: url.searchParams.get(\"thumb\") || \"\",\n fallbackIcon: \"\",\n assetType: url.searchParams.get(\"assetType\") || \"\",\n };\n}\n\n/** The asset link `makeMentionUrl` writes (`/dashboard/spaces?asset_ids=…`). */\nconst ASSET_MENTION_HREF = /^(?:https?:\\/\\/[^/]+)?\\/dashboard\\/spaces\\/?\\?/;\n\n/**\n * Attributes of an asset mention from its `/dashboard/spaces?asset_ids=…`\n * link, or null for a spaces link that names no asset.\n */\nexport function parseAssetAnchorAttributes({\n href,\n textContent,\n}: {\n href: string;\n textContent: string | null;\n}): MentionNodeAttrs | null {\n if (!ASSET_MENTION_HREF.test(href)) return null;\n const params = new URLSearchParams(href.slice(href.indexOf(\"?\") + 1));\n const id = params.get(\"asset_ids\");\n if (!id) return null;\n return {\n type: \"asset\",\n href,\n name: textContent?.replace(/^@/, \"\") || \"\",\n id,\n assetType: params.get(\"assetType\") || \"\",\n };\n}\n\ninterface MarkdownSerializerState {\n write(text: string): void;\n}\n\n/**\n * ProseMirror tries parse rules by rule priority (default 50), mark rules\n * before node rules at a tie: a serialized mention is an anchor, so its rules\n * must outrank the Link mark's `a[href]` rule or the chip comes back as a\n * plain link.\n */\nconst ANCHOR_RULE_PRIORITY = 100;\n\nexport const MentionExtension = Node.create({\n name: \"mention\",\n group: \"inline\",\n inline: true,\n selectable: false,\n atom: true,\n\n addAttributes() {\n return {\n href: { default: null },\n type: { default: \"tool\" },\n name: { default: \"\" },\n id: { default: \"\" },\n title: { default: \"\" },\n url: { default: \"\" },\n description: { default: \"\" },\n thumbnailUrl: { default: \"\" },\n fallbackIcon: { default: \"\" },\n assetType: { default: \"\" },\n displayAsPreview: { default: false },\n };\n },\n\n /** tiptap-markdown reads this spec so `getMarkdown()` writes the mention, not HTML. */\n addStorage() {\n return {\n markdown: {\n serialize(state: MarkdownSerializerState, node: ProseMirrorNode) {\n state.write(serializeMention(node.attrs as MentionNodeAttrs));\n },\n parse: {\n // The Markdown parser renders the link to an anchor; parseHTML takes it from there.\n },\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: \"span[data-mention]\",\n getAttrs: (dom) => {\n const el = dom as HTMLElement;\n return {\n href: el.getAttribute(\"data-href\"),\n type: el.getAttribute(\"data-type\") || \"tool\",\n name: el.getAttribute(\"data-name\") || el.textContent?.replace(/^@/, \"\") || \"\",\n id: el.getAttribute(\"data-id\") || \"\",\n title: el.getAttribute(\"data-title\") || \"\",\n url: el.getAttribute(\"data-url\") || \"\",\n description: el.getAttribute(\"data-description\") || \"\",\n thumbnailUrl: el.getAttribute(\"data-thumbnail-url\") || \"\",\n fallbackIcon: el.getAttribute(\"data-fallback-icon\") || \"\",\n assetType: el.getAttribute(\"data-asset-type\") || \"\",\n displayAsPreview:\n el.getAttribute(\"data-display-as-preview\") === \"true\",\n };\n },\n },\n {\n tag: \"a[href^='mention://']\",\n priority: ANCHOR_RULE_PRIORITY,\n getAttrs: (dom) => {\n const el = dom as HTMLAnchorElement;\n try {\n return parseMentionAnchorAttributes({\n href: el.getAttribute(\"href\") ?? el.href,\n textContent: el.textContent,\n });\n } catch {\n return false;\n }\n },\n },\n {\n tag: \"a[href]\",\n priority: ANCHOR_RULE_PRIORITY,\n getAttrs: (dom) => {\n const el = dom as HTMLAnchorElement;\n return (\n parseAssetAnchorAttributes({\n href: el.getAttribute(\"href\") ?? \"\",\n textContent: el.textContent,\n }) ?? false\n );\n },\n },\n ];\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const thumbnailUrl = node.attrs.thumbnailUrl;\n\n // Build child elements: [icon] name\n const children: any[] = [];\n\n if (thumbnailUrl) {\n // Render SVG thumbnail as an img element inside the chip\n children.push([\n \"img\",\n {\n src: thumbnailUrl,\n alt: \"\",\n class:\n node.attrs.type === \"user\"\n ? \"mention-chip-icon mention-chip-avatar\"\n : \"mention-chip-icon\",\n draggable: \"false\",\n },\n ]);\n }\n\n children.push([\"span\", { class: \"mention-chip-text\" }, node.attrs.name]);\n\n return [\n \"span\",\n mergeAttributes(HTMLAttributes, {\n \"data-mention\": \"\",\n \"data-href\": node.attrs.href || \"\",\n \"data-type\": node.attrs.type,\n \"data-name\": node.attrs.name,\n \"data-id\": node.attrs.id,\n \"data-title\": node.attrs.title || \"\",\n \"data-url\": node.attrs.url || \"\",\n \"data-thumbnail-url\": node.attrs.thumbnailUrl || \"\",\n \"data-asset-type\": node.attrs.assetType || \"\",\n \"data-display-as-preview\": String(node.attrs.displayAsPreview === true),\n class: \"mention-chip\",\n }),\n ...children,\n ];\n },\n\n renderText({ node }) {\n return serializeMention(node.attrs as MentionNodeAttrs);\n },\n});\n"],"names":["params","Node","mergeAttributes"],"mappings":";;;AAaO,SAAS,eAAe,OAAyK;AACtM,MAAI,MAAM,SAAS,MAAM,KAAK,WAAW,YAAY,KAAK,mBAAmB,KAAK,MAAM,IAAI,IAAI;AAC9F,WAAO,MAAM;AAAA,EACf;AACA,MAAI,MAAM,SAAS,UAAU,MAAM,SAAS,WAAW;AACrD,WAAO,aAAa,MAAM,IAAI,SAAS,mBAAmB,MAAM,EAAE,CAAC,gBAAgB,mBAAmB,MAAM,eAAe,EAAE,CAAC;AAAA,EAChI;AACA,MAAI,MAAM,SAAS,SAAS;AAC1B,UAAMA,UAAS,IAAI,gBAAgB,EAAE,WAAW,MAAM,IAAI;AAC1D,QAAI,MAAM,UAAWA,SAAO,IAAI,aAAa,MAAM,SAAS;AAC5D,WAAO,qBAAqBA,QAAO,SAAA,CAAU;AAAA,EAC/C;AACA,MAAI,MAAM,SAAS,QAAQ;AAGzB,UAAMA,UAAS,IAAI,gBAAgB,EAAE,IAAI,MAAM,IAAI;AACnD,QAAI,MAAM,GAAG,SAA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K;AACX,iBACE,2BAA2B;AAAA,YACzB,MAAM,GAAG,aAAa,MAAM,KAAK;AAAA,YACjC,aAAa,GAAG;AAAA,UAAA,CACjB,KAAK;AAAA,QAEV;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ;AAAA,EAEA,WAAW,EAAE,MAAM,kBAAkB;AACnC,UAAM,eAAe,KAAK,MAAM;AAGhC,UAAM,WAAkB,CAAA;AAExB,QAAI,cAAc;AAEhB,eAAS,KAAK;AAAA,QACZ;AAAA,QACA;AAAA,UACE,KAAK;AAAA,UACL,KAAK;AAAA,UACL,OACE,KAAK,MAAM,SAAS,SAChB,0CACA;AAAA,UACN,WAAW;AAAA,QAAA;AAAA,MACb,CACD;AAAA,IACH;AAEA,aAAS,KAAK,CAAC,QAAQ,EAAE,OAAO,uBAAuB,KAAK,MAAM,IAAI,CAAC;AAEvE,WAAO;AAAA,MACL;AAAA,MACAC,KAAAA,gBAAgB,gBAAgB;AAAA,QAC9B,gBAAgB;AAAA,QAChB,aAAa,KAAK,MAAM,QAAQ;AAAA,QAChC,aAAa,KAAK,MAAM;AAAA,QACxB,aAAa,KAAK,MAAM;AAAA,QACxB,WAAW,KAAK,MAAM;AAAA,QACtB,cAAc,KAAK,MAAM,SAAS;AAAA,QAClC,YAAY,KAAK,MAAM,OAAO;AAAA,QAC9B,sBAAsB,KAAK,MAAM,gBAAgB;AAAA,QACjD,mBAAmB,KAAK,MAAM,aAAa;AAAA,QAC3C,2BAA2B,OAAO,KAAK,MAAM,qBAAqB,IAAI;AAAA,QACtE,OAAO;AAAA,MAAA,CACR;AAAA,MACD,GAAG;AAAA,IAAA;AAAA,EAEP;AAAA,EAEA,WAAW,EAAE,QAAQ;AACnB,WAAO,iBAAiB,KAAK,KAAyB;AAAA,EACxD;AACF,CAAC;;;;;;"}
1
+ {"version":3,"file":"mention-extension.cjs","sources":["../../../src/chat-ui/mentions/mention-extension.ts"],"sourcesContent":["/**\n * Tiptap Mention Node Extension\n *\n * Defines the mention node type used in the editor. When a mention is\n * inserted, it creates a non-editable inline node with metadata.\n *\n * Renders as a chip with: [icon] Name. Serializes — to plain text and to\n * Markdown alike — as `[@Name](url)`, and parses that link back into a chip.\n */\n\nimport { mergeAttributes, Node } from \"@tiptap/core\";\nimport type { Node as ProseMirrorNode } from \"@tiptap/pm/model\";\n\nexport function makeMentionUrl(attrs: { id: string; type: string; name: string; title?: string; url?: string; description?: string; thumbnailUrl?: string; assetType?: string; href?: string }): string {\n if (attrs.href && (attrs.href.startsWith(\"mention://\") || ASSET_MENTION_HREF.test(attrs.href))) {\n return attrs.href;\n }\n if (attrs.type === \"tool\" || attrs.type === \"toolkit\") {\n return `mention://${attrs.type}?name=${encodeURIComponent(attrs.id)}&description=${encodeURIComponent(attrs.description ?? \"\")}`;\n }\n if (attrs.type === \"asset\") {\n const params = new URLSearchParams({ asset_ids: attrs.id });\n if (attrs.assetType) params.set(\"assetType\", attrs.assetType);\n return `/dashboard/spaces?${params.toString()}`;\n }\n if (attrs.type === \"user\") {\n // The canonical person reference Olympus writes (packages/references\n // `encodeToPersonMentionUri`): `id`, `email`, then the name the menu showed.\n // Members are keyed on their email.\n const params = new URLSearchParams({ id: attrs.id });\n if (attrs.id.includes(\"@\")) params.set(\"email\", attrs.id);\n if (attrs.name) params.set(\"name\", attrs.name);\n return `mention://person?${params.toString()}`;\n }\n if (attrs.type === \"group\") {\n // A pointer to the group, not to its members (`encodeToGroupMentionUri`):\n // it shares nothing and notifies nobody.\n const params = new URLSearchParams({ id: attrs.id });\n if (attrs.name) params.set(\"name\", attrs.name);\n return `mention://group?${params.toString()}`;\n }\n if (attrs.type === \"tab\") {\n const params = new URLSearchParams({\n tab_id: attrs.id,\n url: attrs.url ?? \"\",\n title: attrs.title ?? attrs.name,\n });\n return `mention://webpage?${params.toString()}`;\n }\n // Include athenaOriginalType and thumbnailUrl so the chip can be reconstructed\n const params = new URLSearchParams();\n params.set(\"id\", attrs.id);\n if (attrs.assetType) params.set(\"assetType\", attrs.assetType);\n if (attrs.thumbnailUrl) params.set(\"thumb\", attrs.thumbnailUrl);\n return `mention://${encodeURIComponent(attrs.type)}?${params.toString()}`;\n}\n\nexport interface MentionNodeAttrs {\n type: string;\n name: string;\n id: string;\n title?: string;\n url?: string;\n description?: string;\n thumbnailUrl?: string;\n fallbackIcon?: string;\n assetType?: string;\n displayAsPreview?: boolean;\n href?: string;\n}\n\n/** The `[@Name](url)` form a mention takes in the outgoing text. */\nexport function serializeMention(attrs: MentionNodeAttrs): string {\n return `[@${attrs.name}](${makeMentionUrl(attrs)})`;\n}\n\nexport function parseMentionAnchorAttributes({\n href,\n textContent,\n}: {\n href: string;\n textContent: string | null;\n}): MentionNodeAttrs {\n const url = new URL(href);\n const isWebpage = url.hostname === \"webpage\";\n const isPerson = url.hostname === \"person\";\n // A group's `name` is only its label; it is named by its id.\n const isGroup = url.hostname === \"group\";\n return {\n href,\n type: isWebpage ? \"tab\" : isPerson ? \"user\" : url.hostname || \"tool\",\n name: textContent?.replace(/^@/, \"\") || \"\",\n id: isWebpage\n ? url.searchParams.get(\"tab_id\") || \"\"\n : isPerson\n ? url.searchParams.get(\"id\") || url.searchParams.get(\"email\") || \"\"\n : isGroup\n ? url.searchParams.get(\"id\") || \"\"\n : url.searchParams.get(\"name\") || url.searchParams.get(\"id\") || \"\",\n title: url.searchParams.get(\"title\") || \"\",\n url: url.searchParams.get(\"url\") || \"\",\n description: url.searchParams.get(\"description\") || \"\",\n thumbnailUrl: url.searchParams.get(\"thumb\") || \"\",\n fallbackIcon: \"\",\n assetType: url.searchParams.get(\"assetType\") || \"\",\n };\n}\n\n/** The asset link `makeMentionUrl` writes (`/dashboard/spaces?asset_ids=…`). */\nconst ASSET_MENTION_HREF = /^(?:https?:\\/\\/[^/]+)?\\/dashboard\\/spaces\\/?\\?/;\n\n/**\n * Attributes of an asset mention from its `/dashboard/spaces?asset_ids=…`\n * link, or null for a spaces link that names no asset.\n */\nexport function parseAssetAnchorAttributes({\n href,\n textContent,\n}: {\n href: string;\n textContent: string | null;\n}): MentionNodeAttrs | null {\n if (!ASSET_MENTION_HREF.test(href)) return null;\n const params = new URLSearchParams(href.slice(href.indexOf(\"?\") + 1));\n const id = params.get(\"asset_ids\");\n if (!id) return null;\n return {\n type: \"asset\",\n href,\n name: textContent?.replace(/^@/, \"\") || \"\",\n id,\n assetType: params.get(\"assetType\") || \"\",\n };\n}\n\ninterface MarkdownSerializerState {\n write(text: string): void;\n}\n\n/**\n * ProseMirror tries parse rules by rule priority (default 50), mark rules\n * before node rules at a tie: a serialized mention is an anchor, so its rules\n * must outrank the Link mark's `a[href]` rule or the chip comes back as a\n * plain link.\n */\nconst ANCHOR_RULE_PRIORITY = 100;\n\nexport const MentionExtension = Node.create({\n name: \"mention\",\n group: \"inline\",\n inline: true,\n selectable: false,\n atom: true,\n\n addAttributes() {\n return {\n href: { default: null },\n type: { default: \"tool\" },\n name: { default: \"\" },\n id: { default: \"\" },\n title: { default: \"\" },\n url: { default: \"\" },\n description: { default: \"\" },\n thumbnailUrl: { default: \"\" },\n fallbackIcon: { default: \"\" },\n assetType: { default: \"\" },\n displayAsPreview: { default: false },\n };\n },\n\n /** tiptap-markdown reads this spec so `getMarkdown()` writes the mention, not HTML. */\n addStorage() {\n return {\n markdown: {\n serialize(state: MarkdownSerializerState, node: ProseMirrorNode) {\n state.write(serializeMention(node.attrs as MentionNodeAttrs));\n },\n parse: {\n // The Markdown parser renders the link to an anchor; parseHTML takes it from there.\n },\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: \"span[data-mention]\",\n getAttrs: (dom) => {\n const el = dom as HTMLElement;\n return {\n href: el.getAttribute(\"data-href\"),\n type: el.getAttribute(\"data-type\") || \"tool\",\n name: el.getAttribute(\"data-name\") || el.textContent?.replace(/^@/, \"\") || \"\",\n id: el.getAttribute(\"data-id\") || \"\",\n title: el.getAttribute(\"data-title\") || \"\",\n url: el.getAttribute(\"data-url\") || \"\",\n description: el.getAttribute(\"data-description\") || \"\",\n thumbnailUrl: el.getAttribute(\"data-thumbnail-url\") || \"\",\n fallbackIcon: el.getAttribute(\"data-fallback-icon\") || \"\",\n assetType: el.getAttribute(\"data-asset-type\") || \"\",\n displayAsPreview:\n el.getAttribute(\"data-display-as-preview\") === \"true\",\n };\n },\n },\n {\n tag: \"a[href^='mention://']\",\n priority: ANCHOR_RULE_PRIORITY,\n getAttrs: (dom) => {\n const el = dom as HTMLAnchorElement;\n try {\n return parseMentionAnchorAttributes({\n href: el.getAttribute(\"href\") ?? el.href,\n textContent: el.textContent,\n });\n } catch {\n return false;\n }\n },\n },\n {\n tag: \"a[href]\",\n priority: ANCHOR_RULE_PRIORITY,\n getAttrs: (dom) => {\n const el = dom as HTMLAnchorElement;\n return (\n parseAssetAnchorAttributes({\n href: el.getAttribute(\"href\") ?? \"\",\n textContent: el.textContent,\n }) ?? false\n );\n },\n },\n ];\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const thumbnailUrl = node.attrs.thumbnailUrl;\n\n // Build child elements: [icon] name\n const children: any[] = [];\n\n if (thumbnailUrl) {\n // Render SVG thumbnail as an img element inside the chip\n children.push([\n \"img\",\n {\n src: thumbnailUrl,\n alt: \"\",\n class:\n node.attrs.type === \"user\"\n ? \"mention-chip-icon mention-chip-avatar\"\n : \"mention-chip-icon\",\n draggable: \"false\",\n },\n ]);\n }\n\n children.push([\"span\", { class: \"mention-chip-text\" }, node.attrs.name]);\n\n return [\n \"span\",\n mergeAttributes(HTMLAttributes, {\n \"data-mention\": \"\",\n \"data-href\": node.attrs.href || \"\",\n \"data-type\": node.attrs.type,\n \"data-name\": node.attrs.name,\n \"data-id\": node.attrs.id,\n \"data-title\": node.attrs.title || \"\",\n \"data-url\": node.attrs.url || \"\",\n \"data-thumbnail-url\": node.attrs.thumbnailUrl || \"\",\n \"data-asset-type\": node.attrs.assetType || \"\",\n \"data-display-as-preview\": String(node.attrs.displayAsPreview === true),\n class: \"mention-chip\",\n }),\n ...children,\n ];\n },\n\n renderText({ node }) {\n return serializeMention(node.att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