@agent-native/core 0.110.3 → 0.111.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 (380) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/core/CHANGELOG.md +11 -0
  3. package/corpus/core/docs/content/components.mdx +7 -0
  4. package/corpus/core/docs/content/locales/ar-SA/components.mdx +4 -2
  5. package/corpus/core/docs/content/locales/de-DE/components.mdx +4 -2
  6. package/corpus/core/docs/content/locales/es-ES/components.mdx +4 -2
  7. package/corpus/core/docs/content/locales/fr-FR/components.mdx +4 -2
  8. package/corpus/core/docs/content/locales/hi-IN/components.mdx +3 -2
  9. package/corpus/core/docs/content/locales/ja-JP/components.mdx +3 -2
  10. package/corpus/core/docs/content/locales/ko-KR/components.mdx +3 -2
  11. package/corpus/core/docs/content/locales/pt-BR/components.mdx +4 -2
  12. package/corpus/core/docs/content/locales/zh-CN/components.mdx +3 -2
  13. package/corpus/core/docs/content/locales/zh-TW/components.mdx +3 -2
  14. package/corpus/core/docs/content/toolkit-agent-ux.mdx +8 -3
  15. package/corpus/core/migration-manifest.json +133 -266
  16. package/corpus/core/package.json +32 -33
  17. package/corpus/core/scripts/check-dist-imports.mjs +25 -1
  18. package/corpus/core/scripts/finalize-build.mjs +59 -2
  19. package/corpus/core/src/client/AgentAskPopover.tsx +1 -1
  20. package/corpus/core/src/client/AgentPanel.tsx +1 -1
  21. package/corpus/core/src/client/AssistantChat.tsx +12 -14
  22. package/corpus/core/src/client/NewWorkspaceAppFlow.tsx +1 -1
  23. package/corpus/core/src/client/agent-chat-adapter.ts +1 -1
  24. package/corpus/core/src/client/blocks/RegistryBlockDataProvider.tsx +121 -0
  25. package/corpus/core/src/client/blocks/index.ts +6 -0
  26. package/corpus/core/src/client/chat/attachment-adapters.ts +4 -5
  27. package/corpus/core/src/client/chat/index.ts +0 -1
  28. package/corpus/core/src/client/chat/message-components.tsx +2 -2
  29. package/corpus/core/src/client/code-agent-chat-adapter.ts +2 -2
  30. package/corpus/core/src/client/collab/index.ts +0 -22
  31. package/corpus/core/src/client/composer/index.ts +5 -66
  32. package/corpus/core/src/client/composer/runtime-adapters.tsx +123 -0
  33. package/corpus/core/src/client/composer/use-mention-search.ts +2 -79
  34. package/corpus/core/src/client/composer/wired-components.tsx +53 -0
  35. package/corpus/core/src/client/extensions/ExtensionViewer.tsx +1 -1
  36. package/corpus/core/src/client/extensions/ExtensionsListPage.tsx +1 -1
  37. package/corpus/core/src/client/extensions/ExtensionsSidebarSection.tsx +1 -1
  38. package/corpus/core/src/client/index.ts +0 -156
  39. package/corpus/core/src/client/resources/ResourceEditor.tsx +29 -681
  40. package/corpus/core/src/client/resources/ResourcesPanel.tsx +1 -1
  41. package/corpus/core/src/client/settings/AutomationsSection.tsx +1 -1
  42. package/corpus/core/src/client/sharing/index.ts +0 -4
  43. package/corpus/core/src/client/tombstone/agent-presence-chip.ts +17 -0
  44. package/corpus/core/src/client/tombstone/editor.ts +265 -0
  45. package/corpus/core/src/client/tombstone/live-cursor-overlay.ts +21 -0
  46. package/corpus/core/src/client/tombstone/presence-bar.ts +17 -0
  47. package/corpus/core/src/client/tombstone/recent-edit-highlights.ts +17 -0
  48. package/corpus/core/src/client/tombstone/remote-selection-rings.ts +21 -0
  49. package/corpus/core/src/client/tombstone/rich-markdown-editor.ts +265 -0
  50. package/corpus/core/src/client/tombstone/ui-dialog.ts +49 -0
  51. package/corpus/core/src/client/tombstone/ui-dropdown-menu.ts +69 -0
  52. package/corpus/core/src/client/tombstone/ui-hover-card.ts +21 -0
  53. package/corpus/core/src/client/tombstone/ui-popover.ts +25 -0
  54. package/corpus/core/src/client/tombstone/ui-sheet.ts +49 -0
  55. package/corpus/core/src/client/tombstone/ui-tooltip.ts +29 -0
  56. package/corpus/core/src/client/tombstone/visual-style-controls.ts +61 -0
  57. package/corpus/core/src/client/uploads/index.ts +5 -0
  58. package/corpus/core/src/client/{rich-markdown-editor/uploadEditorImage.ts → uploads/upload-editor-image.ts} +11 -4
  59. package/corpus/core/src/package-lifecycle/tombstone.ts +16 -2
  60. package/corpus/core/src/package-lifecycle/upgrade-error.ts +23 -5
  61. package/corpus/core/src/testing.ts +1 -4
  62. package/corpus/core/src/vite/client.ts +62 -22
  63. package/corpus/templates/content/app/components/editor/VisualEditor.tsx +2 -4
  64. package/corpus/templates/content/app/components/editor/extensions/registryBlocks.ts +1 -1
  65. package/corpus/templates/content/app/components/editor/registrySlashItems.ts +53 -52
  66. package/corpus/templates/plan/app/components/editor/PlanBlockNode.tsx +2 -2
  67. package/corpus/templates/plan/app/components/editor/planSlashCommands.ts +1 -1
  68. package/corpus/templates/plan/app/components/plan/DocumentArea.tsx +1 -1
  69. package/corpus/templates/plan/app/components/plan/PlanImageNode.tsx +1 -1
  70. package/corpus/templates/plan/app/components/plan/PlanMarkdownEditor.tsx +1 -1
  71. package/dist/catalog.json +1 -0
  72. package/dist/client/AgentAskPopover.js +1 -1
  73. package/dist/client/AgentAskPopover.js.map +1 -1
  74. package/dist/client/AgentPanel.js +1 -1
  75. package/dist/client/AgentPanel.js.map +1 -1
  76. package/dist/client/AssistantChat.d.ts +2 -2
  77. package/dist/client/AssistantChat.d.ts.map +1 -1
  78. package/dist/client/AssistantChat.js +5 -6
  79. package/dist/client/AssistantChat.js.map +1 -1
  80. package/dist/client/NewWorkspaceAppFlow.js +1 -1
  81. package/dist/client/NewWorkspaceAppFlow.js.map +1 -1
  82. package/dist/client/agent-chat-adapter.d.ts.map +1 -1
  83. package/dist/client/agent-chat-adapter.js +1 -1
  84. package/dist/client/agent-chat-adapter.js.map +1 -1
  85. package/dist/client/blocks/RegistryBlockDataProvider.d.ts +7 -0
  86. package/dist/client/blocks/RegistryBlockDataProvider.d.ts.map +1 -0
  87. package/dist/client/blocks/RegistryBlockDataProvider.js +54 -0
  88. package/dist/client/blocks/RegistryBlockDataProvider.js.map +1 -0
  89. package/dist/client/blocks/index.d.ts +2 -0
  90. package/dist/client/blocks/index.d.ts.map +1 -1
  91. package/dist/client/blocks/index.js +1 -0
  92. package/dist/client/blocks/index.js.map +1 -1
  93. package/dist/client/chat/attachment-adapters.d.ts.map +1 -1
  94. package/dist/client/chat/attachment-adapters.js +1 -1
  95. package/dist/client/chat/attachment-adapters.js.map +1 -1
  96. package/dist/client/chat/index.d.ts +0 -1
  97. package/dist/client/chat/index.d.ts.map +1 -1
  98. package/dist/client/chat/index.js +0 -1
  99. package/dist/client/chat/index.js.map +1 -1
  100. package/dist/client/chat/message-components.d.ts.map +1 -1
  101. package/dist/client/chat/message-components.js +2 -2
  102. package/dist/client/chat/message-components.js.map +1 -1
  103. package/dist/client/code-agent-chat-adapter.d.ts.map +1 -1
  104. package/dist/client/code-agent-chat-adapter.js +1 -1
  105. package/dist/client/code-agent-chat-adapter.js.map +1 -1
  106. package/dist/client/collab/index.d.ts +0 -5
  107. package/dist/client/collab/index.d.ts.map +1 -1
  108. package/dist/client/collab/index.js +0 -5
  109. package/dist/client/collab/index.js.map +1 -1
  110. package/dist/client/composer/index.d.ts +3 -11
  111. package/dist/client/composer/index.d.ts.map +1 -1
  112. package/dist/client/composer/index.js +3 -10
  113. package/dist/client/composer/index.js.map +1 -1
  114. package/dist/client/composer/runtime-adapters.d.ts +5 -0
  115. package/dist/client/composer/runtime-adapters.d.ts.map +1 -0
  116. package/dist/client/composer/runtime-adapters.js +85 -0
  117. package/dist/client/composer/runtime-adapters.js.map +1 -0
  118. package/dist/client/composer/use-mention-search.d.ts +1 -2
  119. package/dist/client/composer/use-mention-search.d.ts.map +1 -1
  120. package/dist/client/composer/use-mention-search.js +2 -69
  121. package/dist/client/composer/use-mention-search.js.map +1 -1
  122. package/dist/client/composer/wired-components.d.ts +10 -0
  123. package/dist/client/composer/wired-components.d.ts.map +1 -0
  124. package/dist/client/composer/wired-components.js +20 -0
  125. package/dist/client/composer/wired-components.js.map +1 -0
  126. package/dist/client/extensions/ExtensionViewer.js +1 -1
  127. package/dist/client/extensions/ExtensionViewer.js.map +1 -1
  128. package/dist/client/extensions/ExtensionsListPage.js +1 -1
  129. package/dist/client/extensions/ExtensionsListPage.js.map +1 -1
  130. package/dist/client/extensions/ExtensionsSidebarSection.js +1 -1
  131. package/dist/client/extensions/ExtensionsSidebarSection.js.map +1 -1
  132. package/dist/client/index.d.ts +0 -10
  133. package/dist/client/index.d.ts.map +1 -1
  134. package/dist/client/index.js +0 -26
  135. package/dist/client/index.js.map +1 -1
  136. package/dist/client/resources/ResourceEditor.d.ts.map +1 -1
  137. package/dist/client/resources/ResourceEditor.js +14 -532
  138. package/dist/client/resources/ResourceEditor.js.map +1 -1
  139. package/dist/client/resources/ResourcesPanel.js +1 -1
  140. package/dist/client/resources/ResourcesPanel.js.map +1 -1
  141. package/dist/client/settings/AutomationsSection.js +1 -1
  142. package/dist/client/settings/AutomationsSection.js.map +1 -1
  143. package/dist/client/sharing/index.d.ts +0 -1
  144. package/dist/client/sharing/index.d.ts.map +1 -1
  145. package/dist/client/sharing/index.js +0 -1
  146. package/dist/client/sharing/index.js.map +1 -1
  147. package/dist/client/tombstone/agent-presence-chip.d.ts +6 -0
  148. package/dist/client/tombstone/agent-presence-chip.d.ts.map +1 -0
  149. package/dist/client/tombstone/agent-presence-chip.js +5 -0
  150. package/dist/client/tombstone/agent-presence-chip.js.map +1 -0
  151. package/dist/client/tombstone/editor.d.ts +128 -0
  152. package/dist/client/tombstone/editor.d.ts.map +1 -0
  153. package/dist/client/tombstone/editor.js +76 -0
  154. package/dist/client/tombstone/editor.js.map +1 -0
  155. package/dist/client/tombstone/live-cursor-overlay.d.ts +8 -0
  156. package/dist/client/tombstone/live-cursor-overlay.d.ts.map +1 -0
  157. package/dist/client/tombstone/live-cursor-overlay.js +5 -0
  158. package/dist/client/tombstone/live-cursor-overlay.js.map +1 -0
  159. package/dist/client/tombstone/presence-bar.d.ts +6 -0
  160. package/dist/client/tombstone/presence-bar.d.ts.map +1 -0
  161. package/dist/client/tombstone/presence-bar.js +5 -0
  162. package/dist/client/tombstone/presence-bar.js.map +1 -0
  163. package/dist/client/tombstone/recent-edit-highlights.d.ts +6 -0
  164. package/dist/client/tombstone/recent-edit-highlights.d.ts.map +1 -0
  165. package/dist/client/tombstone/recent-edit-highlights.js +5 -0
  166. package/dist/client/tombstone/recent-edit-highlights.js.map +1 -0
  167. package/dist/client/tombstone/remote-selection-rings.d.ts +8 -0
  168. package/dist/client/tombstone/remote-selection-rings.d.ts.map +1 -0
  169. package/dist/client/tombstone/remote-selection-rings.js +5 -0
  170. package/dist/client/tombstone/remote-selection-rings.js.map +1 -0
  171. package/dist/client/tombstone/rich-markdown-editor.d.ts +128 -0
  172. package/dist/client/tombstone/rich-markdown-editor.d.ts.map +1 -0
  173. package/dist/client/tombstone/rich-markdown-editor.js +76 -0
  174. package/dist/client/tombstone/rich-markdown-editor.js.map +1 -0
  175. package/dist/client/tombstone/ui-dialog.d.ts +22 -0
  176. package/dist/client/tombstone/ui-dialog.d.ts.map +1 -0
  177. package/dist/client/tombstone/ui-dialog.js +23 -0
  178. package/dist/client/tombstone/ui-dialog.js.map +1 -0
  179. package/dist/client/tombstone/ui-dropdown-menu.d.ts +32 -0
  180. package/dist/client/tombstone/ui-dropdown-menu.d.ts.map +1 -0
  181. package/dist/client/tombstone/ui-dropdown-menu.js +33 -0
  182. package/dist/client/tombstone/ui-dropdown-menu.js.map +1 -0
  183. package/dist/client/tombstone/ui-hover-card.d.ts +8 -0
  184. package/dist/client/tombstone/ui-hover-card.d.ts.map +1 -0
  185. package/dist/client/tombstone/ui-hover-card.js +9 -0
  186. package/dist/client/tombstone/ui-hover-card.js.map +1 -0
  187. package/dist/client/tombstone/ui-popover.d.ts +10 -0
  188. package/dist/client/tombstone/ui-popover.d.ts.map +1 -0
  189. package/dist/client/tombstone/ui-popover.js +11 -0
  190. package/dist/client/tombstone/ui-popover.js.map +1 -0
  191. package/dist/client/tombstone/ui-sheet.d.ts +22 -0
  192. package/dist/client/tombstone/ui-sheet.d.ts.map +1 -0
  193. package/dist/client/tombstone/ui-sheet.js +23 -0
  194. package/dist/client/tombstone/ui-sheet.js.map +1 -0
  195. package/dist/client/tombstone/ui-tooltip.d.ts +12 -0
  196. package/dist/client/tombstone/ui-tooltip.d.ts.map +1 -0
  197. package/dist/client/tombstone/ui-tooltip.js +13 -0
  198. package/dist/client/tombstone/ui-tooltip.js.map +1 -0
  199. package/dist/client/tombstone/visual-style-controls.d.ts +28 -0
  200. package/dist/client/tombstone/visual-style-controls.d.ts.map +1 -0
  201. package/dist/client/tombstone/visual-style-controls.js +23 -0
  202. package/dist/client/tombstone/visual-style-controls.js.map +1 -0
  203. package/dist/client/uploads/index.d.ts +1 -0
  204. package/dist/client/uploads/index.d.ts.map +1 -1
  205. package/dist/client/uploads/index.js +1 -0
  206. package/dist/client/uploads/index.js.map +1 -1
  207. package/dist/client/{rich-markdown-editor/uploadEditorImage.d.ts → uploads/upload-editor-image.d.ts} +8 -4
  208. package/dist/client/uploads/upload-editor-image.d.ts.map +1 -0
  209. package/dist/client/{rich-markdown-editor/uploadEditorImage.js → uploads/upload-editor-image.js} +2 -2
  210. package/dist/client/uploads/upload-editor-image.js.map +1 -0
  211. package/dist/collab/awareness.d.ts +2 -2
  212. package/dist/collab/awareness.d.ts.map +1 -1
  213. package/dist/notifications/routes.d.ts +3 -3
  214. package/dist/package-lifecycle/tombstone.d.ts.map +1 -1
  215. package/dist/package-lifecycle/tombstone.js +13 -3
  216. package/dist/package-lifecycle/tombstone.js.map +1 -1
  217. package/dist/package-lifecycle/upgrade-error.d.ts +2 -2
  218. package/dist/package-lifecycle/upgrade-error.d.ts.map +1 -1
  219. package/dist/package-lifecycle/upgrade-error.js +8 -5
  220. package/dist/package-lifecycle/upgrade-error.js.map +1 -1
  221. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  222. package/dist/server/transcribe-voice.d.ts +1 -1
  223. package/dist/testing.d.ts +1 -3
  224. package/dist/testing.d.ts.map +1 -1
  225. package/dist/testing.js +1 -3
  226. package/dist/testing.js.map +1 -1
  227. package/dist/vite/client.d.ts.map +1 -1
  228. package/dist/vite/client.js +26 -22
  229. package/dist/vite/client.js.map +1 -1
  230. package/docs/content/components.mdx +7 -0
  231. package/docs/content/locales/ar-SA/components.mdx +4 -2
  232. package/docs/content/locales/de-DE/components.mdx +4 -2
  233. package/docs/content/locales/es-ES/components.mdx +4 -2
  234. package/docs/content/locales/fr-FR/components.mdx +4 -2
  235. package/docs/content/locales/hi-IN/components.mdx +3 -2
  236. package/docs/content/locales/ja-JP/components.mdx +3 -2
  237. package/docs/content/locales/ko-KR/components.mdx +3 -2
  238. package/docs/content/locales/pt-BR/components.mdx +4 -2
  239. package/docs/content/locales/zh-CN/components.mdx +3 -2
  240. package/docs/content/locales/zh-TW/components.mdx +3 -2
  241. package/docs/content/toolkit-agent-ux.mdx +8 -3
  242. package/migration-manifest.json +133 -266
  243. package/package.json +31 -32
  244. package/corpus/core/src/client/composer/AgentComposerFrame.tsx +0 -59
  245. package/corpus/core/src/client/composer/ComposerPlusMenu.tsx +0 -988
  246. package/corpus/core/src/client/composer/MentionPopover.tsx +0 -412
  247. package/corpus/core/src/client/composer/PastedTextChip.tsx +0 -150
  248. package/corpus/core/src/client/composer/PromptComposer.tsx +0 -714
  249. package/corpus/core/src/client/composer/RealtimeVoiceMode.tsx +0 -860
  250. package/corpus/core/src/client/composer/TiptapComposer.tsx +0 -2928
  251. package/corpus/core/src/client/composer/VoiceButton.tsx +0 -262
  252. package/corpus/core/src/client/composer/asset-picker-url.ts +0 -80
  253. package/corpus/core/src/client/composer/attachment-accept.ts +0 -71
  254. package/corpus/core/src/client/composer/draft-key.ts +0 -7
  255. package/corpus/core/src/client/composer/extensions/FileReference.tsx +0 -55
  256. package/corpus/core/src/client/composer/extensions/MentionReference.tsx +0 -93
  257. package/corpus/core/src/client/composer/extensions/SkillReference.tsx +0 -56
  258. package/corpus/core/src/client/composer/pasted-text.ts +0 -160
  259. package/corpus/core/src/client/composer/prompt-attachments.ts +0 -70
  260. package/corpus/core/src/client/composer/realtime-voice-audio-level.ts +0 -64
  261. package/corpus/core/src/client/composer/realtime-voice-transcript.ts +0 -134
  262. package/corpus/core/src/client/composer/types.ts +0 -66
  263. package/corpus/core/src/client/composer/use-file-search.ts +0 -63
  264. package/corpus/core/src/client/composer/use-skills.ts +0 -44
  265. package/corpus/core/src/client/composer/useRealtimeVoiceMode.tsx +0 -2095
  266. package/corpus/core/src/client/composer/useVoiceDictation.ts +0 -1155
  267. package/corpus/core/src/client/editor/index.ts +0 -1
  268. package/corpus/core/src/client/rich-markdown-editor/RegistryBlockNode.tsx +0 -799
  269. package/corpus/core/src/client/rich-markdown-editor/index.ts +0 -70
  270. package/corpus/core/src/client/rich-markdown-editor/registrySlashCommands.ts +0 -112
  271. package/dist/client/composer/AgentComposerFrame.d.ts +0 -19
  272. package/dist/client/composer/AgentComposerFrame.d.ts.map +0 -1
  273. package/dist/client/composer/AgentComposerFrame.js +0 -14
  274. package/dist/client/composer/AgentComposerFrame.js.map +0 -1
  275. package/dist/client/composer/ComposerPlusMenu.d.ts +0 -17
  276. package/dist/client/composer/ComposerPlusMenu.d.ts.map +0 -1
  277. package/dist/client/composer/ComposerPlusMenu.js +0 -501
  278. package/dist/client/composer/ComposerPlusMenu.js.map +0 -1
  279. package/dist/client/composer/MentionPopover.d.ts +0 -29
  280. package/dist/client/composer/MentionPopover.d.ts.map +0 -1
  281. package/dist/client/composer/MentionPopover.js +0 -180
  282. package/dist/client/composer/MentionPopover.js.map +0 -1
  283. package/dist/client/composer/PastedTextChip.d.ts +0 -9
  284. package/dist/client/composer/PastedTextChip.d.ts.map +0 -1
  285. package/dist/client/composer/PastedTextChip.js +0 -47
  286. package/dist/client/composer/PastedTextChip.js.map +0 -1
  287. package/dist/client/composer/PromptComposer.d.ts +0 -115
  288. package/dist/client/composer/PromptComposer.d.ts.map +0 -1
  289. package/dist/client/composer/PromptComposer.js +0 -299
  290. package/dist/client/composer/PromptComposer.js.map +0 -1
  291. package/dist/client/composer/RealtimeVoiceMode.d.ts +0 -104
  292. package/dist/client/composer/RealtimeVoiceMode.d.ts.map +0 -1
  293. package/dist/client/composer/RealtimeVoiceMode.js +0 -245
  294. package/dist/client/composer/RealtimeVoiceMode.js.map +0 -1
  295. package/dist/client/composer/TiptapComposer.d.ts +0 -222
  296. package/dist/client/composer/TiptapComposer.d.ts.map +0 -1
  297. package/dist/client/composer/TiptapComposer.js +0 -1834
  298. package/dist/client/composer/TiptapComposer.js.map +0 -1
  299. package/dist/client/composer/VoiceButton.d.ts +0 -23
  300. package/dist/client/composer/VoiceButton.d.ts.map +0 -1
  301. package/dist/client/composer/VoiceButton.js +0 -100
  302. package/dist/client/composer/VoiceButton.js.map +0 -1
  303. package/dist/client/composer/asset-picker-url.d.ts +0 -16
  304. package/dist/client/composer/asset-picker-url.d.ts.map +0 -1
  305. package/dist/client/composer/asset-picker-url.js +0 -64
  306. package/dist/client/composer/asset-picker-url.js.map +0 -1
  307. package/dist/client/composer/attachment-accept.d.ts +0 -9
  308. package/dist/client/composer/attachment-accept.d.ts.map +0 -1
  309. package/dist/client/composer/attachment-accept.js +0 -65
  310. package/dist/client/composer/attachment-accept.js.map +0 -1
  311. package/dist/client/composer/draft-key.d.ts +0 -2
  312. package/dist/client/composer/draft-key.d.ts.map +0 -1
  313. package/dist/client/composer/draft-key.js +0 -8
  314. package/dist/client/composer/draft-key.js.map +0 -1
  315. package/dist/client/composer/extensions/FileReference.d.ts +0 -3
  316. package/dist/client/composer/extensions/FileReference.d.ts.map +0 -1
  317. package/dist/client/composer/extensions/FileReference.js +0 -36
  318. package/dist/client/composer/extensions/FileReference.js.map +0 -1
  319. package/dist/client/composer/extensions/MentionReference.d.ts +0 -3
  320. package/dist/client/composer/extensions/MentionReference.d.ts.map +0 -1
  321. package/dist/client/composer/extensions/MentionReference.js +0 -66
  322. package/dist/client/composer/extensions/MentionReference.js.map +0 -1
  323. package/dist/client/composer/extensions/SkillReference.d.ts +0 -3
  324. package/dist/client/composer/extensions/SkillReference.d.ts.map +0 -1
  325. package/dist/client/composer/extensions/SkillReference.js +0 -40
  326. package/dist/client/composer/extensions/SkillReference.js.map +0 -1
  327. package/dist/client/composer/pasted-text.d.ts +0 -31
  328. package/dist/client/composer/pasted-text.d.ts.map +0 -1
  329. package/dist/client/composer/pasted-text.js +0 -130
  330. package/dist/client/composer/pasted-text.js.map +0 -1
  331. package/dist/client/composer/prompt-attachments.d.ts +0 -11
  332. package/dist/client/composer/prompt-attachments.d.ts.map +0 -1
  333. package/dist/client/composer/prompt-attachments.js +0 -45
  334. package/dist/client/composer/prompt-attachments.js.map +0 -1
  335. package/dist/client/composer/realtime-voice-audio-level.d.ts +0 -14
  336. package/dist/client/composer/realtime-voice-audio-level.d.ts.map +0 -1
  337. package/dist/client/composer/realtime-voice-audio-level.js +0 -47
  338. package/dist/client/composer/realtime-voice-audio-level.js.map +0 -1
  339. package/dist/client/composer/realtime-voice-transcript.d.ts +0 -26
  340. package/dist/client/composer/realtime-voice-transcript.d.ts.map +0 -1
  341. package/dist/client/composer/realtime-voice-transcript.js +0 -103
  342. package/dist/client/composer/realtime-voice-transcript.js.map +0 -1
  343. package/dist/client/composer/types.d.ts +0 -60
  344. package/dist/client/composer/types.d.ts.map +0 -1
  345. package/dist/client/composer/types.js +0 -2
  346. package/dist/client/composer/types.js.map +0 -1
  347. package/dist/client/composer/use-file-search.d.ts +0 -6
  348. package/dist/client/composer/use-file-search.d.ts.map +0 -1
  349. package/dist/client/composer/use-file-search.js +0 -52
  350. package/dist/client/composer/use-file-search.js.map +0 -1
  351. package/dist/client/composer/use-skills.d.ts +0 -7
  352. package/dist/client/composer/use-skills.d.ts.map +0 -1
  353. package/dist/client/composer/use-skills.js +0 -39
  354. package/dist/client/composer/use-skills.js.map +0 -1
  355. package/dist/client/composer/useRealtimeVoiceMode.d.ts +0 -172
  356. package/dist/client/composer/useRealtimeVoiceMode.d.ts.map +0 -1
  357. package/dist/client/composer/useRealtimeVoiceMode.js +0 -1648
  358. package/dist/client/composer/useRealtimeVoiceMode.js.map +0 -1
  359. package/dist/client/composer/useVoiceDictation.d.ts +0 -57
  360. package/dist/client/composer/useVoiceDictation.d.ts.map +0 -1
  361. package/dist/client/composer/useVoiceDictation.js +0 -975
  362. package/dist/client/composer/useVoiceDictation.js.map +0 -1
  363. package/dist/client/editor/index.d.ts +0 -2
  364. package/dist/client/editor/index.d.ts.map +0 -1
  365. package/dist/client/editor/index.js +0 -2
  366. package/dist/client/editor/index.js.map +0 -1
  367. package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts +0 -130
  368. package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts.map +0 -1
  369. package/dist/client/rich-markdown-editor/RegistryBlockNode.js +0 -426
  370. package/dist/client/rich-markdown-editor/RegistryBlockNode.js.map +0 -1
  371. package/dist/client/rich-markdown-editor/index.d.ts +0 -5
  372. package/dist/client/rich-markdown-editor/index.d.ts.map +0 -1
  373. package/dist/client/rich-markdown-editor/index.js +0 -5
  374. package/dist/client/rich-markdown-editor/index.js.map +0 -1
  375. package/dist/client/rich-markdown-editor/registrySlashCommands.d.ts +0 -60
  376. package/dist/client/rich-markdown-editor/registrySlashCommands.d.ts.map +0 -1
  377. package/dist/client/rich-markdown-editor/registrySlashCommands.js +0 -51
  378. package/dist/client/rich-markdown-editor/registrySlashCommands.js.map +0 -1
  379. package/dist/client/rich-markdown-editor/uploadEditorImage.d.ts.map +0 -1
  380. package/dist/client/rich-markdown-editor/uploadEditorImage.js.map +0 -1
@@ -1,501 +0,0 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useComposerRuntime } from "@assistant-ui/react";
3
- import { IconPlus, IconUpload, IconBulb, IconClock, IconBolt, IconTool, IconPlugConnected, IconPhotoPlus, IconLoader2, IconArrowLeft, IconX, } from "@tabler/icons-react";
4
- import { useState, useRef, useEffect, useMemo, useCallback, } from "react";
5
- import { createPortal } from "react-dom";
6
- import { setAgentChatContextItem } from "../agent-chat.js";
7
- import { agentNativePath } from "../api-path.js";
8
- import { Popover, PopoverTrigger, PopoverContent, } from "../components/ui/popover.js";
9
- import { Tooltip, TooltipContent, TooltipTrigger, } from "../components/ui/tooltip.js";
10
- import { useT } from "../i18n.js";
11
- import { useOrg } from "../org/hooks.js";
12
- import { isMcpIntegrationCatalogAvailable } from "../resources/mcp-integration-catalog.js";
13
- import { McpIntegrationDialog } from "../resources/McpIntegrationDialog.js";
14
- import { useCreateMcpServer, } from "../resources/use-mcp-servers.js";
15
- import { cn } from "../utils.js";
16
- import { createAssetPickerHandoffId, isExternalAssetPickerUrl, standaloneAssetPickerUrl, } from "./asset-picker-url.js";
17
- const DEFAULT_ASSETS_PICKER_URL = "https://assets.agent-native.com/picker";
18
- const EMBED_PROTOCOL = "agent-native.embed";
19
- const EMBED_VERSION = 1;
20
- function assetPickerUrl() {
21
- const env = import.meta.env ?? {};
22
- return env.VITE_AGENT_NATIVE_ASSETS_PICKER_URL || DEFAULT_ASSETS_PICKER_URL;
23
- }
24
- function withEmbeddedParams(url) {
25
- try {
26
- const parsed = new URL(url, window.location.href);
27
- parsed.searchParams.set("embedded", "1");
28
- parsed.searchParams.set("mediaType", "image");
29
- return parsed.toString();
30
- }
31
- catch {
32
- const separator = url.includes("?") ? "&" : "?";
33
- return `${url}${separator}embedded=1&mediaType=image`;
34
- }
35
- }
36
- function assetPickerOrigin(url) {
37
- try {
38
- return new URL(url, window.location.href).origin;
39
- }
40
- catch {
41
- return null;
42
- }
43
- }
44
- function embedEnvelope(type, options = {}) {
45
- return {
46
- protocol: EMBED_PROTOCOL,
47
- version: EMBED_VERSION,
48
- type,
49
- ...options,
50
- };
51
- }
52
- function isEmbedEnvelope(value) {
53
- if (!value || typeof value !== "object" || Array.isArray(value))
54
- return false;
55
- const candidate = value;
56
- return (candidate.protocol === EMBED_PROTOCOL &&
57
- candidate.version === EMBED_VERSION &&
58
- typeof candidate.type === "string");
59
- }
60
- function assetString(value) {
61
- return typeof value === "string" && value.trim() ? value.trim() : null;
62
- }
63
- function assetImageSource(payload) {
64
- if (!payload || typeof payload !== "object")
65
- return null;
66
- const asset = payload;
67
- return (assetString(asset.url) ??
68
- assetString(asset.previewUrl) ??
69
- assetString(asset.downloadUrl) ??
70
- assetString(asset.embedUrl));
71
- }
72
- function assetTitle(payload, url) {
73
- if (payload && typeof payload === "object") {
74
- const title = assetString(payload.title);
75
- if (title)
76
- return title;
77
- const prompt = assetString(payload.prompt);
78
- if (prompt)
79
- return prompt.slice(0, 80);
80
- }
81
- try {
82
- const name = new URL(url).pathname.split("/").filter(Boolean).pop();
83
- return name ? decodeURIComponent(name) : "Generated image";
84
- }
85
- catch {
86
- return "Generated image";
87
- }
88
- }
89
- function assetContext(payload, url) {
90
- const lines = [`Image URL: ${url}`];
91
- if (payload && typeof payload === "object") {
92
- const asset = payload;
93
- const assetId = assetString(asset.assetId);
94
- const libraryId = assetString(asset.libraryId);
95
- const prompt = assetString(asset.prompt);
96
- const altText = assetString(asset.altText);
97
- if (assetId)
98
- lines.push(`Asset ID: ${assetId}`);
99
- if (libraryId)
100
- lines.push(`Library ID: ${libraryId}`);
101
- if (prompt)
102
- lines.push(`Prompt: ${prompt}`);
103
- if (altText)
104
- lines.push(`Alt text: ${altText}`);
105
- }
106
- return lines.join("\n");
107
- }
108
- function slugifyName(value) {
109
- return (value
110
- .toLowerCase()
111
- .replace(/[^a-z0-9]+/g, "-")
112
- .replace(/^-+|-+$/g, "") || "uploaded-skill");
113
- }
114
- function formatAttachmentError(error, fallback) {
115
- return error instanceof Error ? error.message : fallback;
116
- }
117
- function UploadOnlyAttachButton({ onAttachmentError, }) {
118
- const composerRuntime = useComposerRuntime();
119
- const inputRef = useRef(null);
120
- const handleFilesSelected = async (files) => {
121
- if (!files || files.length === 0)
122
- return;
123
- try {
124
- await Promise.all(Array.from(files).map((file) => composerRuntime.addAttachment(file)));
125
- }
126
- catch (error) {
127
- onAttachmentError?.(formatAttachmentError(error, "Could not upload the selected file."));
128
- }
129
- };
130
- return (_jsxs(_Fragment, { children: [_jsx("input", { ref: inputRef, type: "file", multiple: true, className: "hidden", onChange: (event) => {
131
- void handleFilesSelected(event.target.files);
132
- event.target.value = "";
133
- } }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("span", { className: "inline-flex shrink-0", children: _jsx("button", { type: "button", className: "shrink-0 flex h-7 w-7 cursor-pointer items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-accent/50", "aria-label": "Upload", onClick: () => inputRef.current?.click(), children: _jsx(IconPlus, { className: "h-4 w-4" }) }) }) }), _jsx(TooltipContent, { children: "Upload" })] })] }));
134
- }
135
- export function ComposerPlusMenu({ onSelectMode, onAttachmentError, mode = "full", }) {
136
- if (mode === "upload-only") {
137
- return _jsx(UploadOnlyAttachButton, { onAttachmentError: onAttachmentError });
138
- }
139
- return (_jsx(ComposerPlusMenuFull, { onSelectMode: onSelectMode, onAttachmentError: onAttachmentError }));
140
- }
141
- function ComposerPlusMenuFull({ onSelectMode, onAttachmentError, }) {
142
- const t = useT();
143
- const composerRuntime = useComposerRuntime();
144
- const [open, setOpen] = useState(false);
145
- const [assetsPickerOpen, setAssetsPickerOpen] = useState(false);
146
- const [mcpDialogOpen, setMcpDialogOpen] = useState(false);
147
- const [view, setView] = useState("menu");
148
- const showMcpIntegrations = useMemo(() => isMcpIntegrationCatalogAvailable(), []);
149
- const { data: org } = useOrg();
150
- const canCreateOrgMcp = !org?.orgId || org.role === "owner" || org.role === "admin";
151
- const hasOrg = !!org?.orgId;
152
- const defaultMcpScope = hasOrg && canCreateOrgMcp ? "org" : "user";
153
- const createMcp = useCreateMcpServer();
154
- const fileUploadRef = useRef(null);
155
- const skillFileInputRef = useRef(null);
156
- const skillHoverTimerRef = useRef(null);
157
- const [skillUploadSlug, setSkillUploadSlug] = useState("");
158
- const [skillUploadContent, setSkillUploadContent] = useState("");
159
- const [skillUploadFileName, setSkillUploadFileName] = useState("");
160
- const [skillUploadStatus, setSkillUploadStatus] = useState(null);
161
- const [skillUploadBusy, setSkillUploadBusy] = useState(false);
162
- const [skillFlyoutOpen, setSkillFlyoutOpen] = useState(false);
163
- const [skillFlyoutSide, setSkillFlyoutSide] = useState("right");
164
- const skillFlyoutCloseTimerRef = useRef(null);
165
- const openSkillFlyout = (rowEl) => {
166
- if (skillFlyoutCloseTimerRef.current) {
167
- window.clearTimeout(skillFlyoutCloseTimerRef.current);
168
- skillFlyoutCloseTimerRef.current = null;
169
- }
170
- if (rowEl && typeof window !== "undefined") {
171
- const rect = rowEl.getBoundingClientRect();
172
- const FLYOUT_WIDTH = 248;
173
- setSkillFlyoutSide(window.innerWidth - rect.right < FLYOUT_WIDTH ? "left" : "right");
174
- }
175
- setSkillFlyoutOpen(true);
176
- };
177
- const scheduleSkillFlyoutClose = () => {
178
- if (skillFlyoutCloseTimerRef.current)
179
- window.clearTimeout(skillFlyoutCloseTimerRef.current);
180
- skillFlyoutCloseTimerRef.current = window.setTimeout(() => {
181
- setSkillFlyoutOpen(false);
182
- }, 160);
183
- };
184
- useEffect(() => {
185
- if (open) {
186
- setView("menu");
187
- setSkillUploadSlug("");
188
- setSkillUploadContent("");
189
- setSkillUploadFileName("");
190
- setSkillUploadStatus(null);
191
- setSkillUploadBusy(false);
192
- setSkillFlyoutOpen(false);
193
- }
194
- }, [open]);
195
- const handleSkillFileSelected = async (files) => {
196
- if (!files || files.length === 0)
197
- return;
198
- const file = files[0];
199
- const text = await file.text();
200
- const baseName = file.name.replace(/\.[^./]+$/, "");
201
- const slug = slugifyName(baseName.toLowerCase() === "skill" ? "uploaded-skill" : baseName);
202
- setSkillUploadSlug(slug);
203
- setSkillUploadContent(text);
204
- setSkillUploadFileName(file.name);
205
- setSkillUploadStatus(null);
206
- setView("skill-upload");
207
- };
208
- const handleFilesSelected = async (files) => {
209
- if (!files || files.length === 0)
210
- return;
211
- try {
212
- await Promise.all(Array.from(files).map((file) => composerRuntime.addAttachment(file)));
213
- }
214
- catch (error) {
215
- onAttachmentError?.(formatAttachmentError(error, "Could not upload the selected file."));
216
- }
217
- };
218
- const submitSkillUpload = async () => {
219
- if (skillUploadBusy)
220
- return;
221
- const slug = slugifyName(skillUploadSlug || "uploaded-skill");
222
- const path = `skills/${slug}/SKILL.md`;
223
- setSkillUploadBusy(true);
224
- setSkillUploadStatus(null);
225
- try {
226
- const res = await fetch(agentNativePath("/_agent-native/resources"), {
227
- method: "POST",
228
- headers: { "Content-Type": "application/json" },
229
- body: JSON.stringify({
230
- path,
231
- content: skillUploadContent,
232
- mimeType: "text/markdown",
233
- shared: false,
234
- }),
235
- });
236
- if (!res.ok) {
237
- const body = await res.text().catch(() => "");
238
- throw new Error(body || `Upload failed (${res.status})`);
239
- }
240
- setSkillUploadStatus({
241
- kind: "ok",
242
- message: `Skill "${skillUploadFileName || `${slug}/SKILL.md`}" added`,
243
- });
244
- window.setTimeout(() => setOpen(false), 1200);
245
- }
246
- catch (err) {
247
- setSkillUploadStatus({
248
- kind: "err",
249
- message: err?.message || "Failed to save skill file",
250
- });
251
- }
252
- finally {
253
- setSkillUploadBusy(false);
254
- }
255
- };
256
- const menuItems = [
257
- {
258
- icon: _jsx(IconUpload, { className: "h-3.5 w-3.5" }),
259
- label: "Upload File",
260
- desc: "Images, PDFs, text/code, JSON, CSV",
261
- action: () => {
262
- setOpen(false);
263
- setTimeout(() => fileUploadRef.current?.click(), 0);
264
- },
265
- },
266
- {
267
- icon: _jsx(IconPhotoPlus, { className: "h-3.5 w-3.5" }),
268
- label: "Generate Image",
269
- desc: "Open the Assets image picker",
270
- action: () => {
271
- setOpen(false);
272
- setAssetsPickerOpen(true);
273
- },
274
- },
275
- {
276
- icon: _jsx(IconClock, { className: "h-3.5 w-3.5" }),
277
- label: "Schedule Task",
278
- desc: "Run something on a schedule",
279
- action: () => {
280
- onSelectMode?.("job");
281
- setOpen(false);
282
- },
283
- },
284
- {
285
- icon: _jsx(IconBolt, { className: "h-3.5 w-3.5" }),
286
- label: "Create Automation",
287
- desc: "Set up a when-X-do-Y rule",
288
- action: () => {
289
- onSelectMode?.("automation");
290
- setOpen(false);
291
- },
292
- },
293
- {
294
- icon: _jsx(IconTool, { className: "h-3.5 w-3.5" }),
295
- label: "Create Extension",
296
- desc: "Build a mini app extension",
297
- action: () => {
298
- onSelectMode?.("extension");
299
- setOpen(false);
300
- },
301
- },
302
- ...(showMcpIntegrations
303
- ? [
304
- {
305
- icon: _jsx(IconPlugConnected, { className: "h-3.5 w-3.5" }),
306
- label: t("mcpIntegrations.menuLabel"),
307
- desc: t("mcpIntegrations.menuDescription"),
308
- action: () => {
309
- setOpen(false);
310
- setMcpDialogOpen(true);
311
- },
312
- },
313
- ]
314
- : []),
315
- {
316
- icon: _jsx(IconBulb, { className: "h-3.5 w-3.5" }),
317
- label: "Create Skill",
318
- desc: "Teach the agent a new ability",
319
- action: openSkillFlyout,
320
- hoverAction: openSkillFlyout,
321
- },
322
- ];
323
- return (_jsxs(_Fragment, { children: [_jsx("input", { ref: fileUploadRef, type: "file", multiple: true, className: "hidden", onChange: (event) => {
324
- void handleFilesSelected(event.target.files);
325
- event.target.value = "";
326
- } }), _jsx("input", { ref: skillFileInputRef, type: "file", accept: ".md,text/markdown", className: "hidden", onChange: (e) => {
327
- void handleSkillFileSelected(e.target.files);
328
- e.target.value = "";
329
- } }), _jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { type: "button", className: "shrink-0 flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-accent/50 disabled:opacity-30 disabled:cursor-not-allowed", children: _jsx(IconPlus, { className: "h-4 w-4" }) }) }) }), _jsx(TooltipContent, { children: "Add..." })] }), _jsxs(PopoverContent, { side: "top", align: "start", sideOffset: 8, className: cn("p-0 rounded-lg", view === "skill-upload"
330
- ? "max-h-[70vh] w-[calc(100vw-24px)] max-w-[380px] overflow-y-auto"
331
- : "w-[260px]"), style: { fontSize: 13, lineHeight: "normal" }, onOpenAutoFocus: (e) => e.preventDefault(), children: [view === "menu" && (_jsx("div", { className: "py-1", children: menuItems.map((item) => {
332
- const isSkill = item.label === "Create Skill";
333
- return (_jsxs("div", { className: cn("relative", isSkill && "group/skill"), onMouseEnter: (e) => {
334
- if (isSkill) {
335
- openSkillFlyout(e.currentTarget);
336
- return;
337
- }
338
- if (!item.hoverAction)
339
- return;
340
- if (skillHoverTimerRef.current)
341
- window.clearTimeout(skillHoverTimerRef.current);
342
- skillHoverTimerRef.current = window.setTimeout(() => {
343
- item.hoverAction?.();
344
- }, 180);
345
- }, onMouseLeave: () => {
346
- if (isSkill) {
347
- scheduleSkillFlyoutClose();
348
- return;
349
- }
350
- if (skillHoverTimerRef.current) {
351
- window.clearTimeout(skillHoverTimerRef.current);
352
- skillHoverTimerRef.current = null;
353
- }
354
- }, children: [_jsxs("button", { type: "button", onClick: item.action, className: cn("flex w-full items-center gap-2.5 px-3 py-2 text-start hover:bg-accent/50", isSkill && skillFlyoutOpen && "bg-accent/50"), children: [_jsx("span", { className: "text-muted-foreground", children: item.icon }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "text-[12px] font-medium text-foreground", children: item.label }), _jsx("div", { className: "mt-0.5 text-[10px] text-muted-foreground/60", children: item.desc })] }), isSkill && (_jsx("span", { className: "ms-auto text-muted-foreground/60", children: "\u203A" }))] }), isSkill && skillFlyoutOpen && (_jsxs("div", { role: "menu", onMouseEnter: () => openSkillFlyout(), onMouseLeave: scheduleSkillFlyoutClose, className: cn("absolute top-0 z-20 w-[240px] rounded-lg border border-border bg-popover py-1 shadow-md", skillFlyoutSide === "right"
355
- ? "left-full ml-1"
356
- : "right-full mr-1"), children: [_jsxs("button", { type: "button", onClick: () => {
357
- onSelectMode?.("skill");
358
- setSkillFlyoutOpen(false);
359
- setOpen(false);
360
- }, className: "flex w-full items-center gap-2.5 px-3 py-2 text-start hover:bg-accent/50", children: [_jsx("span", { className: "text-muted-foreground", children: _jsx(IconBulb, { className: "h-3.5 w-3.5" }) }), _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "text-[12px] font-medium text-foreground", children: "Create new skill" }), _jsx("div", { className: "mt-0.5 text-[10px] text-muted-foreground/60", children: "Describe a skill and let the agent draft it" })] })] }), _jsxs("button", { type: "button", onClick: () => {
361
- setSkillFlyoutOpen(false);
362
- skillFileInputRef.current?.click();
363
- }, className: "flex w-full items-center gap-2.5 px-3 py-2 text-start hover:bg-accent/50", children: [_jsx("span", { className: "text-muted-foreground", children: _jsx(IconUpload, { className: "h-3.5 w-3.5" }) }), _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "text-[12px] font-medium text-foreground", children: "Upload skill file" }), _jsx("div", { className: "mt-0.5 text-[10px] text-muted-foreground/60", children: "Import an existing SKILL.md file" })] })] })] }))] }, item.label));
364
- }) })), view === "skill-upload" && (_jsxs("div", { className: "p-3", children: [_jsxs("button", { type: "button", onClick: () => setView("menu"), className: "mb-1.5 flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground", children: [_jsx(IconArrowLeft, { className: "h-3 w-3 rtl:-scale-x-100" }), "Back"] }), _jsx("label", { className: "mb-1 block text-[11px] font-semibold text-foreground", children: "Upload skill file" }), _jsxs("p", { className: "mb-2 text-[10px] leading-relaxed text-muted-foreground/60", children: ["Review the content from", " ", _jsx("span", { className: "font-mono", children: skillUploadFileName || "the selected file" }), " ", "before saving."] }), _jsx("label", { className: "mb-1 block text-[10px] font-medium text-muted-foreground", children: "Skill name" }), _jsx("input", { value: skillUploadSlug, onChange: (e) => setSkillUploadSlug(e.target.value), className: "mb-2 w-full rounded-md border border-border bg-background px-2.5 py-1.5 text-[12px] text-foreground outline-none placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-accent", placeholder: "my-skill" }), _jsxs("p", { className: "mb-2 text-[10px] text-muted-foreground/60", children: ["Saved at", " ", _jsxs("span", { className: "font-mono", children: ["skills/", slugifyName(skillUploadSlug || "uploaded-skill"), "/SKILL.md"] })] }), _jsx("label", { className: "mb-1 block text-[10px] font-medium text-muted-foreground", children: "Content" }), _jsx("textarea", { value: skillUploadContent, onChange: (e) => setSkillUploadContent(e.target.value), rows: 10, className: "w-full rounded-md border border-border bg-background px-2.5 py-1.5 font-mono text-[11px] leading-relaxed text-foreground outline-none focus:ring-1 focus:ring-accent" }), skillUploadStatus && (_jsx("div", { className: cn("mt-2 text-[11px] leading-snug", skillUploadStatus.kind === "ok"
365
- ? "text-green-600 dark:text-green-400"
366
- : "text-red-600 dark:text-red-400"), children: skillUploadStatus.message })), _jsxs("div", { className: "mt-2.5 flex justify-end gap-2", children: [_jsx("button", { type: "button", onClick: () => setView("menu"), className: "rounded-md px-3 py-1.5 text-[12px] font-medium text-muted-foreground hover:bg-accent/40", children: "Cancel" }), _jsx("button", { type: "button", onClick: submitSkillUpload, disabled: skillUploadBusy ||
367
- !skillUploadContent.trim() ||
368
- !skillUploadSlug.trim(), className: "rounded-md bg-accent px-3 py-1.5 text-[12px] font-medium text-foreground hover:bg-accent/80 disabled:opacity-40 disabled:pointer-events-none", children: skillUploadBusy ? (_jsx(IconLoader2, { className: "h-3 w-3 animate-spin" })) : ("Save") })] })] }))] })] }), _jsx(McpIntegrationDialog, { open: mcpDialogOpen, onOpenChange: setMcpDialogOpen, defaultScope: defaultMcpScope, canCreateOrgMcp: canCreateOrgMcp, hasOrg: hasOrg, onCreateMcpServer: (args) => createMcp.mutateAsync(args) }), _jsx(AssetsPickerModal, { open: assetsPickerOpen, onOpenChange: setAssetsPickerOpen })] }));
369
- }
370
- function AssetsPickerModal({ open, onOpenChange, }) {
371
- const iframeRef = useRef(null);
372
- const standaloneWindowRef = useRef(null);
373
- const [pickerReady, setPickerReady] = useState(false);
374
- const [standaloneHandoffId, setStandaloneHandoffId] = useState(null);
375
- const sourceUrl = useMemo(() => assetPickerUrl(), []);
376
- const externalPicker = useMemo(() => typeof window !== "undefined" &&
377
- isExternalAssetPickerUrl(sourceUrl, window.location.origin), [sourceUrl]);
378
- const standaloneUrl = useMemo(() => standaloneAssetPickerUrl(sourceUrl, typeof window !== "undefined" ? window.location.href : undefined, {
379
- handoffId: standaloneHandoffId ?? undefined,
380
- returnOrigin: typeof window !== "undefined" ? window.location.origin : undefined,
381
- }), [sourceUrl, standaloneHandoffId]);
382
- const iframeUrl = useMemo(() => withEmbeddedParams(sourceUrl), [sourceUrl]);
383
- const targetOrigin = useMemo(() => assetPickerOrigin(iframeUrl), [iframeUrl]);
384
- const configurePicker = useCallback(() => {
385
- if (!targetOrigin)
386
- return;
387
- iframeRef.current?.contentWindow?.postMessage(embedEnvelope("message", {
388
- name: "configure",
389
- payload: { mediaType: "image", count: 3 },
390
- }), targetOrigin);
391
- }, [targetOrigin]);
392
- useEffect(() => {
393
- if (open) {
394
- setPickerReady(false);
395
- if (externalPicker) {
396
- standaloneWindowRef.current = null;
397
- setStandaloneHandoffId(createAssetPickerHandoffId());
398
- }
399
- else {
400
- setStandaloneHandoffId(null);
401
- }
402
- return;
403
- }
404
- if (!standaloneWindowRef.current)
405
- setStandaloneHandoffId(null);
406
- }, [externalPicker, iframeUrl, open]);
407
- useEffect(() => {
408
- if (!targetOrigin ||
409
- (!open && !standaloneWindowRef.current) ||
410
- (externalPicker && !standaloneHandoffId))
411
- return;
412
- const handleMessage = (event) => {
413
- const expectedSource = externalPicker
414
- ? standaloneWindowRef.current
415
- : iframeRef.current?.contentWindow;
416
- if (!expectedSource || event.source !== expectedSource)
417
- return;
418
- if (event.origin !== targetOrigin)
419
- return;
420
- if (!isEmbedEnvelope(event.data))
421
- return;
422
- if (event.data.type === "ready") {
423
- setPickerReady(true);
424
- configurePicker();
425
- return;
426
- }
427
- if (event.data.type !== "message")
428
- return;
429
- if (externalPicker) {
430
- const payload = event.data.payload;
431
- const handoffId = payload && typeof payload === "object"
432
- ? assetString(payload.handoffId)
433
- : null;
434
- if (handoffId !== standaloneHandoffId)
435
- return;
436
- }
437
- if (event.data.name === "close") {
438
- onOpenChange(false);
439
- return;
440
- }
441
- if (event.data.name !== "chooseImage" &&
442
- event.data.name !== "chooseAsset")
443
- return;
444
- const url = assetImageSource(event.data.payload);
445
- if (!url)
446
- return;
447
- const title = assetTitle(event.data.payload, url);
448
- const assetId = event.data.payload && typeof event.data.payload === "object"
449
- ? assetString(event.data.payload.assetId)
450
- : null;
451
- setAgentChatContextItem({
452
- key: `asset-image:${assetId ?? url}`,
453
- title: `Image: ${title}`,
454
- context: assetContext(event.data.payload, url),
455
- });
456
- standaloneWindowRef.current = null;
457
- setStandaloneHandoffId(null);
458
- onOpenChange(false);
459
- };
460
- const handleKey = (event) => {
461
- if (event.key === "Escape")
462
- onOpenChange(false);
463
- };
464
- window.addEventListener("message", handleMessage);
465
- window.addEventListener("keydown", handleKey);
466
- return () => {
467
- window.removeEventListener("message", handleMessage);
468
- window.removeEventListener("keydown", handleKey);
469
- };
470
- }, [
471
- configurePicker,
472
- externalPicker,
473
- onOpenChange,
474
- open,
475
- standaloneHandoffId,
476
- targetOrigin,
477
- ]);
478
- const openStandalonePicker = useCallback((event) => {
479
- if (!standaloneHandoffId)
480
- return;
481
- event.preventDefault();
482
- const pickerWindow = window.open(standaloneUrl, "_blank");
483
- if (!pickerWindow)
484
- return;
485
- standaloneWindowRef.current = pickerWindow;
486
- onOpenChange(false);
487
- }, [onOpenChange, standaloneHandoffId, standaloneUrl]);
488
- if (!open || typeof document === "undefined")
489
- return null;
490
- return createPortal(_jsx("div", { className: "fixed inset-0 z-[280] flex items-center justify-center bg-black/50 p-3", role: "dialog", "aria-modal": "true", "aria-labelledby": "composer-assets-picker-title", onMouseDown: (event) => {
491
- if (event.target === event.currentTarget)
492
- onOpenChange(false);
493
- }, children: _jsxs("div", { className: "flex h-[min(86vh,760px)] w-[min(96vw,1040px)] flex-col overflow-hidden rounded-xl border border-border bg-background shadow-2xl", children: [_jsxs("div", { className: "flex h-12 shrink-0 items-center justify-between border-b border-border px-4", children: [_jsx("div", { id: "composer-assets-picker-title", className: "text-sm font-medium text-foreground", children: "Generate image" }), _jsx("button", { type: "button", onClick: () => onOpenChange(false), className: "flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground", "aria-label": "Close image picker", children: _jsx(IconX, { className: "h-4 w-4" }) })] }), externalPicker ? (_jsxs("div", { className: "flex min-h-0 flex-1 flex-col items-center justify-center gap-3 p-8 text-center", children: [_jsx("div", { className: "max-w-md text-sm text-muted-foreground", children: "Open Assets in a new tab to sign in and choose an image securely." }), _jsx("a", { href: standaloneUrl, target: "_blank", onClick: openStandalonePicker, className: "inline-flex h-9 items-center justify-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground hover:bg-primary/90", children: "Open Assets image picker" })] })) : targetOrigin ? (_jsxs("div", { className: "relative min-h-0 flex-1 overflow-hidden bg-background", children: [!pickerReady && _jsx(AssetsPickerLoadingSkeleton, {}), _jsx("iframe", { ref: iframeRef, src: iframeUrl, title: "Assets image picker", className: cn("absolute inset-0 h-full w-full border-0 bg-background transition-opacity duration-150", pickerReady ? "opacity-100" : "pointer-events-none opacity-0"), sandbox: "allow-scripts allow-same-origin allow-forms allow-popups allow-downloads", allow: "clipboard-read; clipboard-write; microphone; fullscreen", referrerPolicy: "strict-origin-when-cross-origin", onLoad: () => {
494
- configurePicker();
495
- setPickerReady(true);
496
- } })] })) : (_jsx("div", { className: "flex min-h-0 flex-1 items-center justify-center p-8 text-center text-sm text-muted-foreground", children: "The configured image picker URL is not valid." }))] }) }), document.body);
497
- }
498
- function AssetsPickerLoadingSkeleton() {
499
- return (_jsxs("div", { className: "absolute inset-0 flex flex-col gap-5 p-5", role: "status", "aria-label": "Loading Assets picker", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "h-9 flex-1 animate-pulse rounded-md bg-muted" }), _jsx("div", { className: "h-9 w-24 animate-pulse rounded-md bg-muted" })] }), _jsx("div", { className: "grid min-h-0 flex-1 grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4", children: Array.from({ length: 8 }).map((_, index) => (_jsxs("div", { className: "flex min-w-0 flex-col gap-2", children: [_jsx("div", { className: "aspect-square w-full animate-pulse rounded-lg bg-muted" }), _jsx("div", { className: "h-3 w-3/4 animate-pulse rounded bg-muted" }), _jsx("div", { className: "h-3 w-1/2 animate-pulse rounded bg-muted" })] }, index))) })] }));
500
- }
501
- //# sourceMappingURL=ComposerPlusMenu.js.map