@agent-native/core 0.37.3 → 0.39.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 (476) hide show
  1. package/README.md +19 -6
  2. package/dist/action.d.ts +60 -2
  3. package/dist/action.d.ts.map +1 -1
  4. package/dist/action.js +6 -2
  5. package/dist/action.js.map +1 -1
  6. package/dist/agent/production-agent.d.ts +12 -6
  7. package/dist/agent/production-agent.d.ts.map +1 -1
  8. package/dist/agent/production-agent.js +161 -11
  9. package/dist/agent/production-agent.js.map +1 -1
  10. package/dist/agent/types.d.ts +2 -0
  11. package/dist/agent/types.d.ts.map +1 -1
  12. package/dist/agent/types.js.map +1 -1
  13. package/dist/catalog.json +2 -2
  14. package/dist/cli/connect.d.ts.map +1 -1
  15. package/dist/cli/connect.js +15 -0
  16. package/dist/cli/connect.js.map +1 -1
  17. package/dist/cli/create.d.ts.map +1 -1
  18. package/dist/cli/create.js +8 -1
  19. package/dist/cli/create.js.map +1 -1
  20. package/dist/cli/index.js +10 -6
  21. package/dist/cli/index.js.map +1 -1
  22. package/dist/cli/plan-publish-store.d.ts +52 -0
  23. package/dist/cli/plan-publish-store.d.ts.map +1 -0
  24. package/dist/cli/plan-publish-store.js +103 -0
  25. package/dist/cli/plan-publish-store.js.map +1 -0
  26. package/dist/cli/skills.d.ts +30 -4
  27. package/dist/cli/skills.d.ts.map +1 -1
  28. package/dist/cli/skills.js +1240 -339
  29. package/dist/cli/skills.js.map +1 -1
  30. package/dist/cli/templates-meta.js +12 -12
  31. package/dist/cli/templates-meta.js.map +1 -1
  32. package/dist/client/AssistantChat.d.ts +3 -1
  33. package/dist/client/AssistantChat.d.ts.map +1 -1
  34. package/dist/client/AssistantChat.js +65 -15
  35. package/dist/client/AssistantChat.js.map +1 -1
  36. package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
  37. package/dist/client/MultiTabAssistantChat.js +20 -2
  38. package/dist/client/MultiTabAssistantChat.js.map +1 -1
  39. package/dist/client/agent-chat-adapter.d.ts.map +1 -1
  40. package/dist/client/agent-chat-adapter.js +12 -0
  41. package/dist/client/agent-chat-adapter.js.map +1 -1
  42. package/dist/client/agent-engine-key.d.ts +24 -0
  43. package/dist/client/agent-engine-key.d.ts.map +1 -0
  44. package/dist/client/agent-engine-key.js +49 -0
  45. package/dist/client/agent-engine-key.js.map +1 -0
  46. package/dist/client/analytics.d.ts.map +1 -1
  47. package/dist/client/analytics.js +34 -0
  48. package/dist/client/analytics.js.map +1 -1
  49. package/dist/client/blocks/BlockView.d.ts +35 -0
  50. package/dist/client/blocks/BlockView.d.ts.map +1 -0
  51. package/dist/client/blocks/BlockView.js +45 -0
  52. package/dist/client/blocks/BlockView.js.map +1 -0
  53. package/dist/client/blocks/SchemaBlockEditor.d.ts +25 -0
  54. package/dist/client/blocks/SchemaBlockEditor.d.ts.map +1 -0
  55. package/dist/client/blocks/SchemaBlockEditor.js +165 -0
  56. package/dist/client/blocks/SchemaBlockEditor.js.map +1 -0
  57. package/dist/client/blocks/agent.d.ts +30 -0
  58. package/dist/client/blocks/agent.d.ts.map +1 -0
  59. package/dist/client/blocks/agent.js +61 -0
  60. package/dist/client/blocks/agent.js.map +1 -0
  61. package/dist/client/blocks/index.d.ts +51 -0
  62. package/dist/client/blocks/index.d.ts.map +1 -0
  63. package/dist/client/blocks/index.js +67 -0
  64. package/dist/client/blocks/index.js.map +1 -0
  65. package/dist/client/blocks/library/AnnotatedCodeBlock.d.ts +6 -0
  66. package/dist/client/blocks/library/AnnotatedCodeBlock.d.ts.map +1 -0
  67. package/dist/client/blocks/library/AnnotatedCodeBlock.js +135 -0
  68. package/dist/client/blocks/library/AnnotatedCodeBlock.js.map +1 -0
  69. package/dist/client/blocks/library/ApiEndpointBlock.d.ts +20 -0
  70. package/dist/client/blocks/library/ApiEndpointBlock.d.ts.map +1 -0
  71. package/dist/client/blocks/library/ApiEndpointBlock.js +131 -0
  72. package/dist/client/blocks/library/ApiEndpointBlock.js.map +1 -0
  73. package/dist/client/blocks/library/DataModelBlock.d.ts +28 -0
  74. package/dist/client/blocks/library/DataModelBlock.d.ts.map +1 -0
  75. package/dist/client/blocks/library/DataModelBlock.js +222 -0
  76. package/dist/client/blocks/library/DataModelBlock.js.map +1 -0
  77. package/dist/client/blocks/library/DiffBlock.d.ts +6 -0
  78. package/dist/client/blocks/library/DiffBlock.d.ts.map +1 -0
  79. package/dist/client/blocks/library/DiffBlock.js +293 -0
  80. package/dist/client/blocks/library/DiffBlock.js.map +1 -0
  81. package/dist/client/blocks/library/FileTreeBlock.d.ts +23 -0
  82. package/dist/client/blocks/library/FileTreeBlock.d.ts.map +1 -0
  83. package/dist/client/blocks/library/FileTreeBlock.js +225 -0
  84. package/dist/client/blocks/library/FileTreeBlock.js.map +1 -0
  85. package/dist/client/blocks/library/JsonExplorerBlock.d.ts +19 -0
  86. package/dist/client/blocks/library/JsonExplorerBlock.d.ts.map +1 -0
  87. package/dist/client/blocks/library/JsonExplorerBlock.js +171 -0
  88. package/dist/client/blocks/library/JsonExplorerBlock.js.map +1 -0
  89. package/dist/client/blocks/library/MermaidBlock.d.ts +17 -0
  90. package/dist/client/blocks/library/MermaidBlock.d.ts.map +1 -0
  91. package/dist/client/blocks/library/MermaidBlock.js +131 -0
  92. package/dist/client/blocks/library/MermaidBlock.js.map +1 -0
  93. package/dist/client/blocks/library/OpenApiSpecBlock.d.ts +19 -0
  94. package/dist/client/blocks/library/OpenApiSpecBlock.d.ts.map +1 -0
  95. package/dist/client/blocks/library/OpenApiSpecBlock.js +494 -0
  96. package/dist/client/blocks/library/OpenApiSpecBlock.js.map +1 -0
  97. package/dist/client/blocks/library/annotated-code.config.d.ts +58 -0
  98. package/dist/client/blocks/library/annotated-code.config.d.ts.map +1 -0
  99. package/dist/client/blocks/library/annotated-code.config.js +53 -0
  100. package/dist/client/blocks/library/annotated-code.config.js.map +1 -0
  101. package/dist/client/blocks/library/api-endpoint.config.d.ts +71 -0
  102. package/dist/client/blocks/library/api-endpoint.config.d.ts.map +1 -0
  103. package/dist/client/blocks/library/api-endpoint.config.js +91 -0
  104. package/dist/client/blocks/library/api-endpoint.config.js.map +1 -0
  105. package/dist/client/blocks/library/checklist.config.d.ts +36 -0
  106. package/dist/client/blocks/library/checklist.config.d.ts.map +1 -0
  107. package/dist/client/blocks/library/checklist.config.js +25 -0
  108. package/dist/client/blocks/library/checklist.config.js.map +1 -0
  109. package/dist/client/blocks/library/checklist.d.ts +26 -0
  110. package/dist/client/blocks/library/checklist.d.ts.map +1 -0
  111. package/dist/client/blocks/library/checklist.js +78 -0
  112. package/dist/client/blocks/library/checklist.js.map +1 -0
  113. package/dist/client/blocks/library/code-tabs.config.d.ts +36 -0
  114. package/dist/client/blocks/library/code-tabs.config.d.ts.map +1 -0
  115. package/dist/client/blocks/library/code-tabs.config.js +30 -0
  116. package/dist/client/blocks/library/code-tabs.config.js.map +1 -0
  117. package/dist/client/blocks/library/code-tabs.d.ts +3 -0
  118. package/dist/client/blocks/library/code-tabs.d.ts.map +1 -0
  119. package/dist/client/blocks/library/code-tabs.js +165 -0
  120. package/dist/client/blocks/library/code-tabs.js.map +1 -0
  121. package/dist/client/blocks/library/data-model.config.d.ts +72 -0
  122. package/dist/client/blocks/library/data-model.config.d.ts.map +1 -0
  123. package/dist/client/blocks/library/data-model.config.js +59 -0
  124. package/dist/client/blocks/library/data-model.config.js.map +1 -0
  125. package/dist/client/blocks/library/dev-doc-ui.d.ts +49 -0
  126. package/dist/client/blocks/library/dev-doc-ui.d.ts.map +1 -0
  127. package/dist/client/blocks/library/dev-doc-ui.js +50 -0
  128. package/dist/client/blocks/library/dev-doc-ui.js.map +1 -0
  129. package/dist/client/blocks/library/diff.config.d.ts +41 -0
  130. package/dist/client/blocks/library/diff.config.d.ts.map +1 -0
  131. package/dist/client/blocks/library/diff.config.js +34 -0
  132. package/dist/client/blocks/library/diff.config.js.map +1 -0
  133. package/dist/client/blocks/library/file-tree.config.d.ts +59 -0
  134. package/dist/client/blocks/library/file-tree.config.d.ts.map +1 -0
  135. package/dist/client/blocks/library/file-tree.config.js +45 -0
  136. package/dist/client/blocks/library/file-tree.config.js.map +1 -0
  137. package/dist/client/blocks/library/html.config.d.ts +37 -0
  138. package/dist/client/blocks/library/html.config.d.ts.map +1 -0
  139. package/dist/client/blocks/library/html.config.js +46 -0
  140. package/dist/client/blocks/library/html.config.js.map +1 -0
  141. package/dist/client/blocks/library/html.d.ts +21 -0
  142. package/dist/client/blocks/library/html.d.ts.map +1 -0
  143. package/dist/client/blocks/library/html.js +72 -0
  144. package/dist/client/blocks/library/html.js.map +1 -0
  145. package/dist/client/blocks/library/json-explorer.config.d.ts +46 -0
  146. package/dist/client/blocks/library/json-explorer.config.d.ts.map +1 -0
  147. package/dist/client/blocks/library/json-explorer.config.js +28 -0
  148. package/dist/client/blocks/library/json-explorer.config.js.map +1 -0
  149. package/dist/client/blocks/library/mermaid.config.d.ts +32 -0
  150. package/dist/client/blocks/library/mermaid.config.d.ts.map +1 -0
  151. package/dist/client/blocks/library/mermaid.config.js +24 -0
  152. package/dist/client/blocks/library/mermaid.config.js.map +1 -0
  153. package/dist/client/blocks/library/openapi-spec.config.d.ts +49 -0
  154. package/dist/client/blocks/library/openapi-spec.config.d.ts.map +1 -0
  155. package/dist/client/blocks/library/openapi-spec.config.js +24 -0
  156. package/dist/client/blocks/library/openapi-spec.config.js.map +1 -0
  157. package/dist/client/blocks/library/server-specs.d.ts +35 -0
  158. package/dist/client/blocks/library/server-specs.d.ts.map +1 -0
  159. package/dist/client/blocks/library/server-specs.js +171 -0
  160. package/dist/client/blocks/library/server-specs.js.map +1 -0
  161. package/dist/client/blocks/library/specs.d.ts +29 -0
  162. package/dist/client/blocks/library/specs.d.ts.map +1 -0
  163. package/dist/client/blocks/library/specs.js +229 -0
  164. package/dist/client/blocks/library/specs.js.map +1 -0
  165. package/dist/client/blocks/library/table.config.d.ts +30 -0
  166. package/dist/client/blocks/library/table.config.d.ts.map +1 -0
  167. package/dist/client/blocks/library/table.config.js +22 -0
  168. package/dist/client/blocks/library/table.config.js.map +1 -0
  169. package/dist/client/blocks/library/table.d.ts +8 -0
  170. package/dist/client/blocks/library/table.d.ts.map +1 -0
  171. package/dist/client/blocks/library/table.js +109 -0
  172. package/dist/client/blocks/library/table.js.map +1 -0
  173. package/dist/client/blocks/library/tabs.config.d.ts +56 -0
  174. package/dist/client/blocks/library/tabs.config.d.ts.map +1 -0
  175. package/dist/client/blocks/library/tabs.config.js +36 -0
  176. package/dist/client/blocks/library/tabs.config.js.map +1 -0
  177. package/dist/client/blocks/library/tabs.d.ts +20 -0
  178. package/dist/client/blocks/library/tabs.d.ts.map +1 -0
  179. package/dist/client/blocks/library/tabs.js +123 -0
  180. package/dist/client/blocks/library/tabs.js.map +1 -0
  181. package/dist/client/blocks/mdx.d.ts +74 -0
  182. package/dist/client/blocks/mdx.d.ts.map +1 -0
  183. package/dist/client/blocks/mdx.js +205 -0
  184. package/dist/client/blocks/mdx.js.map +1 -0
  185. package/dist/client/blocks/provider.d.ts +25 -0
  186. package/dist/client/blocks/provider.d.ts.map +1 -0
  187. package/dist/client/blocks/provider.js +19 -0
  188. package/dist/client/blocks/provider.js.map +1 -0
  189. package/dist/client/blocks/registry.d.ts +32 -0
  190. package/dist/client/blocks/registry.d.ts.map +1 -0
  191. package/dist/client/blocks/registry.js +65 -0
  192. package/dist/client/blocks/registry.js.map +1 -0
  193. package/dist/client/blocks/schema-form/introspect.d.ts +31 -0
  194. package/dist/client/blocks/schema-form/introspect.d.ts.map +1 -0
  195. package/dist/client/blocks/schema-form/introspect.js +164 -0
  196. package/dist/client/blocks/schema-form/introspect.js.map +1 -0
  197. package/dist/client/blocks/server.d.ts +31 -0
  198. package/dist/client/blocks/server.d.ts.map +1 -0
  199. package/dist/client/blocks/server.js +41 -0
  200. package/dist/client/blocks/server.js.map +1 -0
  201. package/dist/client/blocks/types.d.ts +252 -0
  202. package/dist/client/blocks/types.d.ts.map +1 -0
  203. package/dist/client/blocks/types.js +5 -0
  204. package/dist/client/blocks/types.js.map +1 -0
  205. package/dist/client/composer/ComposerPlusMenu.js +10 -1
  206. package/dist/client/composer/ComposerPlusMenu.js.map +1 -1
  207. package/dist/client/guided-questions.d.ts +68 -0
  208. package/dist/client/guided-questions.d.ts.map +1 -1
  209. package/dist/client/guided-questions.js +158 -3
  210. package/dist/client/guided-questions.js.map +1 -1
  211. package/dist/client/index.d.ts +6 -1
  212. package/dist/client/index.d.ts.map +1 -1
  213. package/dist/client/index.js +24 -1
  214. package/dist/client/index.js.map +1 -1
  215. package/dist/client/rich-markdown-editor/BubbleToolbar.d.ts +37 -0
  216. package/dist/client/rich-markdown-editor/BubbleToolbar.d.ts.map +1 -0
  217. package/dist/client/rich-markdown-editor/BubbleToolbar.js +161 -0
  218. package/dist/client/rich-markdown-editor/BubbleToolbar.js.map +1 -0
  219. package/dist/client/rich-markdown-editor/DragHandle.d.ts +52 -0
  220. package/dist/client/rich-markdown-editor/DragHandle.d.ts.map +1 -0
  221. package/dist/client/rich-markdown-editor/DragHandle.js +403 -0
  222. package/dist/client/rich-markdown-editor/DragHandle.js.map +1 -0
  223. package/dist/client/rich-markdown-editor/ImageExtension.d.ts +63 -0
  224. package/dist/client/rich-markdown-editor/ImageExtension.d.ts.map +1 -0
  225. package/dist/client/rich-markdown-editor/ImageExtension.js +242 -0
  226. package/dist/client/rich-markdown-editor/ImageExtension.js.map +1 -0
  227. package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts +97 -0
  228. package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts.map +1 -0
  229. package/dist/client/rich-markdown-editor/RegistryBlockNode.js +214 -0
  230. package/dist/client/rich-markdown-editor/RegistryBlockNode.js.map +1 -0
  231. package/dist/client/rich-markdown-editor/RichMarkdownEditor.d.ts +51 -0
  232. package/dist/client/rich-markdown-editor/RichMarkdownEditor.d.ts.map +1 -0
  233. package/dist/client/rich-markdown-editor/RichMarkdownEditor.js +37 -0
  234. package/dist/client/rich-markdown-editor/RichMarkdownEditor.js.map +1 -0
  235. package/dist/client/rich-markdown-editor/RunId.d.ts +28 -0
  236. package/dist/client/rich-markdown-editor/RunId.d.ts.map +1 -0
  237. package/dist/client/rich-markdown-editor/RunId.js +60 -0
  238. package/dist/client/rich-markdown-editor/RunId.js.map +1 -0
  239. package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts +85 -0
  240. package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts.map +1 -0
  241. package/dist/client/rich-markdown-editor/SharedRichEditor.js +130 -0
  242. package/dist/client/rich-markdown-editor/SharedRichEditor.js.map +1 -0
  243. package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts +36 -0
  244. package/dist/client/rich-markdown-editor/SlashCommandMenu.d.ts.map +1 -0
  245. package/dist/client/rich-markdown-editor/SlashCommandMenu.js +193 -0
  246. package/dist/client/rich-markdown-editor/SlashCommandMenu.js.map +1 -0
  247. package/dist/client/rich-markdown-editor/extensions.d.ts +166 -0
  248. package/dist/client/rich-markdown-editor/extensions.d.ts.map +1 -0
  249. package/dist/client/rich-markdown-editor/extensions.js +222 -0
  250. package/dist/client/rich-markdown-editor/extensions.js.map +1 -0
  251. package/dist/client/rich-markdown-editor/gfmDoc.d.ts +24 -0
  252. package/dist/client/rich-markdown-editor/gfmDoc.d.ts.map +1 -0
  253. package/dist/client/rich-markdown-editor/gfmDoc.js +83 -0
  254. package/dist/client/rich-markdown-editor/gfmDoc.js.map +1 -0
  255. package/dist/client/rich-markdown-editor/index.d.ts +14 -0
  256. package/dist/client/rich-markdown-editor/index.d.ts.map +1 -0
  257. package/dist/client/rich-markdown-editor/index.js +14 -0
  258. package/dist/client/rich-markdown-editor/index.js.map +1 -0
  259. package/dist/client/rich-markdown-editor/registrySlashCommands.d.ts +46 -0
  260. package/dist/client/rich-markdown-editor/registrySlashCommands.d.ts.map +1 -0
  261. package/dist/client/rich-markdown-editor/registrySlashCommands.js +13 -0
  262. package/dist/client/rich-markdown-editor/registrySlashCommands.js.map +1 -0
  263. package/dist/client/rich-markdown-editor/uploadEditorImage.d.ts +18 -0
  264. package/dist/client/rich-markdown-editor/uploadEditorImage.d.ts.map +1 -0
  265. package/dist/client/rich-markdown-editor/uploadEditorImage.js +57 -0
  266. package/dist/client/rich-markdown-editor/uploadEditorImage.js.map +1 -0
  267. package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts +91 -0
  268. package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts.map +1 -0
  269. package/dist/client/rich-markdown-editor/useCollabReconcile.js +375 -0
  270. package/dist/client/rich-markdown-editor/useCollabReconcile.js.map +1 -0
  271. package/dist/client/track.d.ts +25 -0
  272. package/dist/client/track.d.ts.map +1 -0
  273. package/dist/client/track.js +53 -0
  274. package/dist/client/track.js.map +1 -0
  275. package/dist/client/use-action.d.ts.map +1 -1
  276. package/dist/client/use-action.js +6 -0
  277. package/dist/client/use-action.js.map +1 -1
  278. package/dist/client/use-session.d.ts +3 -2
  279. package/dist/client/use-session.d.ts.map +1 -1
  280. package/dist/client/use-session.js +3 -2
  281. package/dist/client/use-session.js.map +1 -1
  282. package/dist/deploy/build.d.ts +5 -0
  283. package/dist/deploy/build.d.ts.map +1 -1
  284. package/dist/deploy/build.js +67 -1
  285. package/dist/deploy/build.js.map +1 -1
  286. package/dist/extensions/schema.d.ts +1 -1
  287. package/dist/mcp/build-server.d.ts.map +1 -1
  288. package/dist/mcp/build-server.js +9 -2
  289. package/dist/mcp/build-server.js.map +1 -1
  290. package/dist/mcp/server.d.ts +1 -1
  291. package/dist/mcp/server.d.ts.map +1 -1
  292. package/dist/mcp/server.js +35 -2
  293. package/dist/mcp/server.js.map +1 -1
  294. package/dist/provider-api/index.d.ts +1 -1
  295. package/dist/provider-api/index.d.ts.map +1 -1
  296. package/dist/scripts/docs/search.d.ts.map +1 -1
  297. package/dist/scripts/docs/search.js +5 -2
  298. package/dist/scripts/docs/search.js.map +1 -1
  299. package/dist/scripts/runner.d.ts.map +1 -1
  300. package/dist/scripts/runner.js +16 -3
  301. package/dist/scripts/runner.js.map +1 -1
  302. package/dist/server/action-discovery.d.ts.map +1 -1
  303. package/dist/server/action-discovery.js +2 -0
  304. package/dist/server/action-discovery.js.map +1 -1
  305. package/dist/server/action-routes.d.ts.map +1 -1
  306. package/dist/server/action-routes.js +30 -4
  307. package/dist/server/action-routes.js.map +1 -1
  308. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  309. package/dist/server/agent-chat-plugin.js +65 -19
  310. package/dist/server/agent-chat-plugin.js.map +1 -1
  311. package/dist/server/agent-teams.d.ts.map +1 -1
  312. package/dist/server/agent-teams.js +8 -1
  313. package/dist/server/agent-teams.js.map +1 -1
  314. package/dist/server/agents-bundle.d.ts +27 -1
  315. package/dist/server/agents-bundle.d.ts.map +1 -1
  316. package/dist/server/agents-bundle.js +41 -3
  317. package/dist/server/agents-bundle.js.map +1 -1
  318. package/dist/server/auth.d.ts.map +1 -1
  319. package/dist/server/auth.js +76 -3
  320. package/dist/server/auth.js.map +1 -1
  321. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  322. package/dist/server/core-routes-plugin.js +60 -0
  323. package/dist/server/core-routes-plugin.js.map +1 -1
  324. package/dist/server/onboarding-html.d.ts.map +1 -1
  325. package/dist/server/onboarding-html.js +160 -22
  326. package/dist/server/onboarding-html.js.map +1 -1
  327. package/dist/server/sentry.d.ts.map +1 -1
  328. package/dist/server/sentry.js +6 -0
  329. package/dist/server/sentry.js.map +1 -1
  330. package/dist/server/social-og-image.d.ts +2 -1
  331. package/dist/server/social-og-image.d.ts.map +1 -1
  332. package/dist/server/social-og-image.js +24 -4
  333. package/dist/server/social-og-image.js.map +1 -1
  334. package/dist/sharing/schema.d.ts +1 -1
  335. package/dist/styles/agent-native.css +1 -0
  336. package/dist/styles/rich-markdown-editor.css +439 -0
  337. package/dist/templates/default/.agents/skills/actions/SKILL.md +4 -1
  338. package/dist/templates/default/.agents/skills/security/SKILL.md +13 -4
  339. package/dist/templates/default/.agents/skills/storing-data/SKILL.md +15 -3
  340. package/dist/templates/default/AGENTS.md +1 -0
  341. package/dist/templates/default/DEVELOPING.md +2 -0
  342. package/dist/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +10 -3
  343. package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +98 -10
  344. package/dist/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +45 -3
  345. package/dist/templates/workspace-core/.agents/skills/address-feedback/SKILL.md +2 -0
  346. package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +37 -4
  347. package/dist/templates/workspace-core/.agents/skills/automations/SKILL.md +9 -4
  348. package/dist/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +2 -0
  349. package/dist/templates/workspace-core/.agents/skills/client-methods/SKILL.md +106 -0
  350. package/dist/templates/workspace-core/.agents/skills/client-methods/references/legacy-client-fetch-audit-2026-06-03.md +53 -0
  351. package/dist/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +2 -0
  352. package/dist/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +62 -61
  353. package/dist/templates/workspace-core/.agents/skills/context-xray/SKILL.md +47 -0
  354. package/dist/templates/workspace-core/.agents/skills/create-skill/SKILL.md +28 -0
  355. package/dist/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +52 -1
  356. package/dist/templates/workspace-core/.agents/skills/extension-points/SKILL.md +2 -0
  357. package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +95 -433
  358. package/dist/templates/workspace-core/.agents/skills/extensions/references/api.md +285 -0
  359. package/dist/templates/workspace-core/.agents/skills/extensions/references/examples.md +259 -0
  360. package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +398 -0
  361. package/dist/templates/workspace-core/.agents/skills/external-agents/references/mcp-apps-embedding.md +157 -0
  362. package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +17 -0
  363. package/dist/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +13 -2
  364. package/dist/templates/workspace-core/.agents/skills/mvp-followup/SKILL.md +51 -0
  365. package/dist/templates/workspace-core/.agents/skills/observability/SKILL.md +14 -4
  366. package/dist/templates/workspace-core/.agents/skills/onboarding/SKILL.md +13 -1
  367. package/dist/templates/workspace-core/.agents/skills/portability/SKILL.md +27 -5
  368. package/dist/templates/workspace-core/.agents/skills/qa/SKILL.md +24 -8
  369. package/dist/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +53 -7
  370. package/dist/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +43 -10
  371. package/dist/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +2 -0
  372. package/dist/templates/workspace-core/.agents/skills/secrets/SKILL.md +43 -14
  373. package/dist/templates/workspace-core/.agents/skills/security/SKILL.md +50 -1
  374. package/dist/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +4 -2
  375. package/dist/templates/workspace-core/.agents/skills/server-plugins/SKILL.md +11 -1
  376. package/dist/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +15 -0
  377. package/dist/templates/workspace-core/.agents/skills/sharing/SKILL.md +5 -1
  378. package/dist/templates/workspace-core/.agents/skills/storing-data/SKILL.md +48 -19
  379. package/dist/templates/workspace-core/.agents/skills/tracking/SKILL.md +7 -3
  380. package/dist/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +13 -6
  381. package/dist/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +236 -0
  382. package/dist/templates/workspace-core/AGENTS.md +5 -1
  383. package/dist/templates/workspace-root/AGENTS.md +5 -2
  384. package/dist/tracking/route.d.ts +43 -0
  385. package/dist/tracking/route.d.ts.map +1 -0
  386. package/dist/tracking/route.js +85 -0
  387. package/dist/tracking/route.js.map +1 -0
  388. package/dist/vite/client.d.ts.map +1 -1
  389. package/dist/vite/client.js +15 -0
  390. package/dist/vite/client.js.map +1 -1
  391. package/docs/content/a2a-protocol.md +18 -4
  392. package/docs/content/actions.md +87 -0
  393. package/docs/content/agent-mentions.md +2 -1
  394. package/docs/content/authentication.md +2 -1
  395. package/docs/content/client.md +64 -13
  396. package/docs/content/cloneable-saas.md +1 -1
  397. package/docs/content/code-agents-ui.md +17 -11
  398. package/docs/content/context-awareness.md +23 -28
  399. package/docs/content/creating-templates.md +1 -1
  400. package/docs/content/drop-in-agent.md +2 -0
  401. package/docs/content/getting-started.md +2 -2
  402. package/docs/content/key-concepts.md +2 -2
  403. package/docs/content/messaging.md +57 -15
  404. package/docs/content/migration-workbench.md +1 -1
  405. package/docs/content/multi-app-workspace.md +1 -1
  406. package/docs/content/multi-tenancy.md +17 -15
  407. package/docs/content/real-time-collaboration.md +1 -1
  408. package/docs/content/recurring-jobs.md +1 -1
  409. package/docs/content/security.md +2 -2
  410. package/docs/content/server.md +4 -4
  411. package/docs/content/skills-guide.md +30 -0
  412. package/docs/content/template-analytics.md +2 -2
  413. package/docs/content/template-assets.md +17 -1
  414. package/docs/content/template-brain.md +2 -2
  415. package/docs/content/template-calendar.md +1 -1
  416. package/docs/content/template-clips.md +3 -3
  417. package/docs/content/template-content.md +2 -2
  418. package/docs/content/template-design.md +2 -2
  419. package/docs/content/template-dispatch.md +3 -3
  420. package/docs/content/template-forms.md +14 -2
  421. package/docs/content/template-mail.md +1 -3
  422. package/docs/content/template-plan.md +133 -0
  423. package/docs/content/template-slides.md +5 -4
  424. package/docs/content/template-starter.md +4 -4
  425. package/docs/content/template-videos.md +6 -11
  426. package/docs/content/tracking.md +21 -1
  427. package/docs/content/visual-plans.md +74 -0
  428. package/docs/content/workspace.md +9 -9
  429. package/package.json +26 -11
  430. package/src/templates/default/.agents/skills/actions/SKILL.md +4 -1
  431. package/src/templates/default/.agents/skills/security/SKILL.md +13 -4
  432. package/src/templates/default/.agents/skills/storing-data/SKILL.md +15 -3
  433. package/src/templates/default/AGENTS.md +1 -0
  434. package/src/templates/default/DEVELOPING.md +2 -0
  435. package/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +10 -3
  436. package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +98 -10
  437. package/src/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +45 -3
  438. package/src/templates/workspace-core/.agents/skills/address-feedback/SKILL.md +2 -0
  439. package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +37 -4
  440. package/src/templates/workspace-core/.agents/skills/automations/SKILL.md +9 -4
  441. package/src/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +2 -0
  442. package/src/templates/workspace-core/.agents/skills/client-methods/SKILL.md +106 -0
  443. package/src/templates/workspace-core/.agents/skills/client-methods/references/legacy-client-fetch-audit-2026-06-03.md +53 -0
  444. package/src/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +2 -0
  445. package/src/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +62 -61
  446. package/src/templates/workspace-core/.agents/skills/context-xray/SKILL.md +47 -0
  447. package/src/templates/workspace-core/.agents/skills/create-skill/SKILL.md +28 -0
  448. package/src/templates/workspace-core/.agents/skills/delegate-to-agent/SKILL.md +52 -1
  449. package/src/templates/workspace-core/.agents/skills/extension-points/SKILL.md +2 -0
  450. package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +95 -433
  451. package/src/templates/workspace-core/.agents/skills/extensions/references/api.md +285 -0
  452. package/src/templates/workspace-core/.agents/skills/extensions/references/examples.md +259 -0
  453. package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +398 -0
  454. package/src/templates/workspace-core/.agents/skills/external-agents/references/mcp-apps-embedding.md +157 -0
  455. package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +17 -0
  456. package/src/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +13 -2
  457. package/src/templates/workspace-core/.agents/skills/mvp-followup/SKILL.md +51 -0
  458. package/src/templates/workspace-core/.agents/skills/observability/SKILL.md +14 -4
  459. package/src/templates/workspace-core/.agents/skills/onboarding/SKILL.md +13 -1
  460. package/src/templates/workspace-core/.agents/skills/portability/SKILL.md +27 -5
  461. package/src/templates/workspace-core/.agents/skills/qa/SKILL.md +24 -8
  462. package/src/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +53 -7
  463. package/src/templates/workspace-core/.agents/skills/real-time-sync/SKILL.md +43 -10
  464. package/src/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +2 -0
  465. package/src/templates/workspace-core/.agents/skills/secrets/SKILL.md +43 -14
  466. package/src/templates/workspace-core/.agents/skills/security/SKILL.md +50 -1
  467. package/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +4 -2
  468. package/src/templates/workspace-core/.agents/skills/server-plugins/SKILL.md +11 -1
  469. package/src/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +15 -0
  470. package/src/templates/workspace-core/.agents/skills/sharing/SKILL.md +5 -1
  471. package/src/templates/workspace-core/.agents/skills/storing-data/SKILL.md +48 -19
  472. package/src/templates/workspace-core/.agents/skills/tracking/SKILL.md +7 -3
  473. package/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +13 -6
  474. package/src/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +236 -0
  475. package/src/templates/workspace-core/AGENTS.md +5 -1
  476. package/src/templates/workspace-root/AGENTS.md +5 -2
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Back-compat surface for the shared rich markdown editor.
3
+ *
4
+ * The editor core now lives in dedicated modules:
5
+ * - {@link createSharedEditorExtensions} — the ONE extension factory.
6
+ * - {@link useCollabReconcile} — seed / reconcile / lead-client logic.
7
+ * - {@link SlashCommandMenu} / {@link BubbleToolbar} — shared menus.
8
+ * - {@link SharedRichEditor} — the editor component.
9
+ *
10
+ * This file keeps the historical `RichMarkdownEditor` component name (aliased to
11
+ * {@link SharedRichEditor}) and the `createRichMarkdownExtensions` factory so
12
+ * existing embedders and the round-trip / collab specs keep working unchanged.
13
+ */
14
+ import { type RichMarkdownDialect, type RichMarkdownEditorPreset, type RichMarkdownCollabUser } from "./extensions.js";
15
+ import { SharedRichEditor, type SharedRichEditorProps } from "./SharedRichEditor.js";
16
+ import type { Doc as YDoc } from "yjs";
17
+ import type { Awareness } from "y-protocols/awareness";
18
+ export type { RichMarkdownDialect, RichMarkdownEditorPreset, RichMarkdownCollabUser, };
19
+ /** @deprecated Prefer {@link CreateSharedEditorExtensionsOptions}. */
20
+ export interface CreateRichMarkdownExtensionsOptions {
21
+ dialect?: RichMarkdownDialect;
22
+ placeholder?: string;
23
+ /**
24
+ * Yjs document for collaborative editing. When present, the editor binds the
25
+ * shared Collaboration + CollaborationCaret extensions and StarterKit's
26
+ * built-in undo/redo is disabled (Yjs owns history).
27
+ */
28
+ ydoc?: YDoc | null;
29
+ /** Shared awareness instance for live multi-user cursors. */
30
+ awareness?: Awareness | null;
31
+ /** Current user info for the collaborative cursor label. */
32
+ user?: RichMarkdownCollabUser | null;
33
+ }
34
+ /**
35
+ * Back-compat factory preserving today's GFM/plan behavior EXACTLY. Implemented
36
+ * in terms of {@link createSharedEditorExtensions}: it maps the flat
37
+ * `{ ydoc, awareness, user }` collab options into the nested `collab` shape the
38
+ * shared factory expects. The round-trip and collab specs build their `Editor`
39
+ * from this, so its output must stay byte-stable.
40
+ */
41
+ export declare function createRichMarkdownExtensions({ dialect, placeholder, ydoc, awareness, user, }?: CreateRichMarkdownExtensionsOptions): (import("@tiptap/core").Extension<any, any> | import("@tiptap/core").Node<any, any> | import("@tiptap/core").Mark<any, any>)[];
42
+ /** @deprecated Prefer {@link SharedRichEditorProps}. */
43
+ export type RichMarkdownEditorProps = SharedRichEditorProps;
44
+ /**
45
+ * Historical name for {@link SharedRichEditor}. Kept so existing imports
46
+ * (`import { RichMarkdownEditor } from "@agent-native/core/client"`) and the
47
+ * plan editor tests (which assert the source mentions `RichMarkdownEditor`)
48
+ * keep working. New code should import `SharedRichEditor`.
49
+ */
50
+ export declare const RichMarkdownEditor: typeof SharedRichEditor;
51
+ //# sourceMappingURL=RichMarkdownEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RichMarkdownEditor.d.ts","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/RichMarkdownEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC5B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,EAC3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,GAAG,IAAI,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,YAAY,EACV,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,GACvB,CAAC;AAEF,sEAAsE;AACtE,MAAM,WAAW,mCAAmC;IAClD,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC7B,4DAA4D;IAC5D,IAAI,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAAC;CACtC;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,OAAe,EACf,WAAwC,EACxC,IAAW,EACX,SAAgB,EAChB,IAAW,GACZ,GAAE,mCAAwC,kIAM1C;AAED,wDAAwD;AACxD,MAAM,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AAE5D;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,yBAAmB,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Back-compat surface for the shared rich markdown editor.
3
+ *
4
+ * The editor core now lives in dedicated modules:
5
+ * - {@link createSharedEditorExtensions} — the ONE extension factory.
6
+ * - {@link useCollabReconcile} — seed / reconcile / lead-client logic.
7
+ * - {@link SlashCommandMenu} / {@link BubbleToolbar} — shared menus.
8
+ * - {@link SharedRichEditor} — the editor component.
9
+ *
10
+ * This file keeps the historical `RichMarkdownEditor` component name (aliased to
11
+ * {@link SharedRichEditor}) and the `createRichMarkdownExtensions` factory so
12
+ * existing embedders and the round-trip / collab specs keep working unchanged.
13
+ */
14
+ import { createSharedEditorExtensions, } from "./extensions.js";
15
+ import { SharedRichEditor, } from "./SharedRichEditor.js";
16
+ /**
17
+ * Back-compat factory preserving today's GFM/plan behavior EXACTLY. Implemented
18
+ * in terms of {@link createSharedEditorExtensions}: it maps the flat
19
+ * `{ ydoc, awareness, user }` collab options into the nested `collab` shape the
20
+ * shared factory expects. The round-trip and collab specs build their `Editor`
21
+ * from this, so its output must stay byte-stable.
22
+ */
23
+ export function createRichMarkdownExtensions({ dialect = "gfm", placeholder = "Type '/' for commands...", ydoc = null, awareness = null, user = null, } = {}) {
24
+ return createSharedEditorExtensions({
25
+ dialect,
26
+ placeholder,
27
+ collab: ydoc ? { ydoc, awareness, user } : null,
28
+ });
29
+ }
30
+ /**
31
+ * Historical name for {@link SharedRichEditor}. Kept so existing imports
32
+ * (`import { RichMarkdownEditor } from "@agent-native/core/client"`) and the
33
+ * plan editor tests (which assert the source mentions `RichMarkdownEditor`)
34
+ * keep working. New code should import `SharedRichEditor`.
35
+ */
36
+ export const RichMarkdownEditor = SharedRichEditor;
37
+ //# sourceMappingURL=RichMarkdownEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RichMarkdownEditor.js","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/RichMarkdownEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACL,4BAA4B,GAI7B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,GAEjB,MAAM,uBAAuB,CAAC;AA0B/B;;;;;;GAMG;AACH,MAAM,UAAU,4BAA4B,CAAC,EAC3C,OAAO,GAAG,KAAK,EACf,WAAW,GAAG,0BAA0B,EACxC,IAAI,GAAG,IAAI,EACX,SAAS,GAAG,IAAI,EAChB,IAAI,GAAG,IAAI,MAC4B,EAAE;IACzC,OAAO,4BAA4B,CAAC;QAClC,OAAO;QACP,WAAW;QACX,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI;KAChD,CAAC,CAAC;AACL,CAAC;AAKD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC","sourcesContent":["/**\n * Back-compat surface for the shared rich markdown editor.\n *\n * The editor core now lives in dedicated modules:\n * - {@link createSharedEditorExtensions} — the ONE extension factory.\n * - {@link useCollabReconcile} — seed / reconcile / lead-client logic.\n * - {@link SlashCommandMenu} / {@link BubbleToolbar} — shared menus.\n * - {@link SharedRichEditor} — the editor component.\n *\n * This file keeps the historical `RichMarkdownEditor` component name (aliased to\n * {@link SharedRichEditor}) and the `createRichMarkdownExtensions` factory so\n * existing embedders and the round-trip / collab specs keep working unchanged.\n */\nimport {\n createSharedEditorExtensions,\n type RichMarkdownDialect,\n type RichMarkdownEditorPreset,\n type RichMarkdownCollabUser,\n} from \"./extensions.js\";\nimport {\n SharedRichEditor,\n type SharedRichEditorProps,\n} from \"./SharedRichEditor.js\";\nimport type { Doc as YDoc } from \"yjs\";\nimport type { Awareness } from \"y-protocols/awareness\";\n\nexport type {\n RichMarkdownDialect,\n RichMarkdownEditorPreset,\n RichMarkdownCollabUser,\n};\n\n/** @deprecated Prefer {@link CreateSharedEditorExtensionsOptions}. */\nexport interface CreateRichMarkdownExtensionsOptions {\n dialect?: RichMarkdownDialect;\n placeholder?: string;\n /**\n * Yjs document for collaborative editing. When present, the editor binds the\n * shared Collaboration + CollaborationCaret extensions and StarterKit's\n * built-in undo/redo is disabled (Yjs owns history).\n */\n ydoc?: YDoc | null;\n /** Shared awareness instance for live multi-user cursors. */\n awareness?: Awareness | null;\n /** Current user info for the collaborative cursor label. */\n user?: RichMarkdownCollabUser | null;\n}\n\n/**\n * Back-compat factory preserving today's GFM/plan behavior EXACTLY. Implemented\n * in terms of {@link createSharedEditorExtensions}: it maps the flat\n * `{ ydoc, awareness, user }` collab options into the nested `collab` shape the\n * shared factory expects. The round-trip and collab specs build their `Editor`\n * from this, so its output must stay byte-stable.\n */\nexport function createRichMarkdownExtensions({\n dialect = \"gfm\",\n placeholder = \"Type '/' for commands...\",\n ydoc = null,\n awareness = null,\n user = null,\n}: CreateRichMarkdownExtensionsOptions = {}) {\n return createSharedEditorExtensions({\n dialect,\n placeholder,\n collab: ydoc ? { ydoc, awareness, user } : null,\n });\n}\n\n/** @deprecated Prefer {@link SharedRichEditorProps}. */\nexport type RichMarkdownEditorProps = SharedRichEditorProps;\n\n/**\n * Historical name for {@link SharedRichEditor}. Kept so existing imports\n * (`import { RichMarkdownEditor } from \"@agent-native/core/client\"`) and the\n * plan editor tests (which assert the source mentions `RichMarkdownEditor`)\n * keep working. New code should import `SharedRichEditor`.\n */\nexport const RichMarkdownEditor = SharedRichEditor;\n"]}
@@ -0,0 +1,28 @@
1
+ import { Extension } from "@tiptap/core";
2
+ /**
3
+ * Node types that carry the optional `runId` attribute.
4
+ *
5
+ * These are exactly the top-level block nodes a plan's `rich-text` block can
6
+ * serialize to. The plan's `doc ↔ blocks[]` bridge stamps `runId` onto the
7
+ * FIRST node of each rich-text run so a re-parse can map the run back to its
8
+ * originating block id (stable ids across edits). Atom/structured blocks live
9
+ * in their own `planBlock` node and do not need this attribute.
10
+ */
11
+ export declare const RUN_ID_NODE_TYPES: readonly ["paragraph", "heading", "bulletList", "orderedList", "taskList", "blockquote", "codeBlock"];
12
+ /**
13
+ * Tiptap extension that adds a GLOBAL `runId` attribute (default `null`) to the
14
+ * block node types in {@link RUN_ID_NODE_TYPES}.
15
+ *
16
+ * - `renderHTML` emits `data-run-id` only when the attribute is set, so the
17
+ * live editor's DOM carries the id for the doc↔blocks bridge.
18
+ * - `parseHTML` reads `data-run-id` back so a paste / re-parse preserves it.
19
+ * - Markdown serialization deliberately IGNORES `runId`: GFM never emits it.
20
+ * `tiptap-markdown` drops attributes it has no serializer for, so we simply
21
+ * don't register a markdown serializer here — the attribute is invisible to
22
+ * the GFM round-trip and only lives in the ProseMirror JSON / DOM.
23
+ *
24
+ * Used by BOTH the headless `gfmDoc` editor and the live plan editor so the
25
+ * schema is identical on both sides of the bridge.
26
+ */
27
+ export declare const RunId: Extension<any, any>;
28
+ //# sourceMappingURL=RunId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RunId.d.ts","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/RunId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,uGAQpB,CAAC;AAEX;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,KAAK,qBAwBhB,CAAC"}
@@ -0,0 +1,60 @@
1
+ import { Extension } from "@tiptap/core";
2
+ /**
3
+ * Node types that carry the optional `runId` attribute.
4
+ *
5
+ * These are exactly the top-level block nodes a plan's `rich-text` block can
6
+ * serialize to. The plan's `doc ↔ blocks[]` bridge stamps `runId` onto the
7
+ * FIRST node of each rich-text run so a re-parse can map the run back to its
8
+ * originating block id (stable ids across edits). Atom/structured blocks live
9
+ * in their own `planBlock` node and do not need this attribute.
10
+ */
11
+ export const RUN_ID_NODE_TYPES = [
12
+ "paragraph",
13
+ "heading",
14
+ "bulletList",
15
+ "orderedList",
16
+ "taskList",
17
+ "blockquote",
18
+ "codeBlock",
19
+ ];
20
+ /**
21
+ * Tiptap extension that adds a GLOBAL `runId` attribute (default `null`) to the
22
+ * block node types in {@link RUN_ID_NODE_TYPES}.
23
+ *
24
+ * - `renderHTML` emits `data-run-id` only when the attribute is set, so the
25
+ * live editor's DOM carries the id for the doc↔blocks bridge.
26
+ * - `parseHTML` reads `data-run-id` back so a paste / re-parse preserves it.
27
+ * - Markdown serialization deliberately IGNORES `runId`: GFM never emits it.
28
+ * `tiptap-markdown` drops attributes it has no serializer for, so we simply
29
+ * don't register a markdown serializer here — the attribute is invisible to
30
+ * the GFM round-trip and only lives in the ProseMirror JSON / DOM.
31
+ *
32
+ * Used by BOTH the headless `gfmDoc` editor and the live plan editor so the
33
+ * schema is identical on both sides of the bridge.
34
+ */
35
+ export const RunId = Extension.create({
36
+ name: "runId",
37
+ addGlobalAttributes() {
38
+ return [
39
+ {
40
+ types: [...RUN_ID_NODE_TYPES],
41
+ attributes: {
42
+ runId: {
43
+ default: null,
44
+ // Read the id off the rendered DOM so paste / re-parse round-trips.
45
+ parseHTML: (element) => element.getAttribute("data-run-id"),
46
+ // Only emit the attribute when set; an unset (null) runId adds
47
+ // nothing to the DOM so untouched nodes stay clean.
48
+ renderHTML: (attributes) => {
49
+ const runId = attributes.runId;
50
+ if (!runId)
51
+ return {};
52
+ return { "data-run-id": runId };
53
+ },
54
+ },
55
+ },
56
+ },
57
+ ];
58
+ },
59
+ });
60
+ //# sourceMappingURL=RunId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RunId.js","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/RunId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,WAAW;IACX,SAAS;IACT,YAAY;IACZ,aAAa;IACb,UAAU;IACV,YAAY;IACZ,WAAW;CACH,CAAC;AAEX;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,OAAO;IAEb,mBAAmB;QACjB,OAAO;YACL;gBACE,KAAK,EAAE,CAAC,GAAG,iBAAiB,CAAC;gBAC7B,UAAU,EAAE;oBACV,KAAK,EAAE;wBACL,OAAO,EAAE,IAAI;wBACb,oEAAoE;wBACpE,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC;wBAC3D,+DAA+D;wBAC/D,oDAAoD;wBACpD,UAAU,EAAE,CAAC,UAAU,EAAE,EAAE;4BACzB,MAAM,KAAK,GAAI,UAAwC,CAAC,KAAK,CAAC;4BAC9D,IAAI,CAAC,KAAK;gCAAE,OAAO,EAAE,CAAC;4BACtB,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;wBAClC,CAAC;qBACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { Extension } from \"@tiptap/core\";\n\n/**\n * Node types that carry the optional `runId` attribute.\n *\n * These are exactly the top-level block nodes a plan's `rich-text` block can\n * serialize to. The plan's `doc ↔ blocks[]` bridge stamps `runId` onto the\n * FIRST node of each rich-text run so a re-parse can map the run back to its\n * originating block id (stable ids across edits). Atom/structured blocks live\n * in their own `planBlock` node and do not need this attribute.\n */\nexport const RUN_ID_NODE_TYPES = [\n \"paragraph\",\n \"heading\",\n \"bulletList\",\n \"orderedList\",\n \"taskList\",\n \"blockquote\",\n \"codeBlock\",\n] as const;\n\n/**\n * Tiptap extension that adds a GLOBAL `runId` attribute (default `null`) to the\n * block node types in {@link RUN_ID_NODE_TYPES}.\n *\n * - `renderHTML` emits `data-run-id` only when the attribute is set, so the\n * live editor's DOM carries the id for the doc↔blocks bridge.\n * - `parseHTML` reads `data-run-id` back so a paste / re-parse preserves it.\n * - Markdown serialization deliberately IGNORES `runId`: GFM never emits it.\n * `tiptap-markdown` drops attributes it has no serializer for, so we simply\n * don't register a markdown serializer here — the attribute is invisible to\n * the GFM round-trip and only lives in the ProseMirror JSON / DOM.\n *\n * Used by BOTH the headless `gfmDoc` editor and the live plan editor so the\n * schema is identical on both sides of the bridge.\n */\nexport const RunId = Extension.create({\n name: \"runId\",\n\n addGlobalAttributes() {\n return [\n {\n types: [...RUN_ID_NODE_TYPES],\n attributes: {\n runId: {\n default: null,\n // Read the id off the rendered DOM so paste / re-parse round-trips.\n parseHTML: (element) => element.getAttribute(\"data-run-id\"),\n // Only emit the attribute when set; an unset (null) runId adds\n // nothing to the DOM so untouched nodes stay clean.\n renderHTML: (attributes) => {\n const runId = (attributes as { runId?: string | null }).runId;\n if (!runId) return {};\n return { \"data-run-id\": runId };\n },\n },\n },\n },\n ];\n },\n});\n"]}
@@ -0,0 +1,85 @@
1
+ import type { Extension, Node, Mark } from "@tiptap/core";
2
+ import type { Doc as YDoc } from "yjs";
3
+ import type { Awareness } from "y-protocols/awareness";
4
+ import { type RichMarkdownDialect, type RichMarkdownEditorPreset, type RichMarkdownCollabUser, type SharedEditorFeatures } from "./extensions.js";
5
+ import type { ImageUploadFn } from "./ImageExtension.js";
6
+ import { type SlashCommandItem } from "./SlashCommandMenu.js";
7
+ import { type BubbleToolbarItem } from "./BubbleToolbar.js";
8
+ export interface SharedRichEditorProps {
9
+ value: string;
10
+ onChange: (markdown: string) => void;
11
+ onBlur?: () => void;
12
+ contentUpdatedAt?: string | null;
13
+ editable?: boolean;
14
+ dialect?: RichMarkdownDialect;
15
+ preset?: RichMarkdownEditorPreset;
16
+ /** Toggle individual base extensions (tables/tasks/link/codeBlock/image). */
17
+ features?: SharedEditorFeatures;
18
+ /**
19
+ * Injectable image uploader for the shared image block. Used only when
20
+ * `features.image` is on. Pass `uploadEditorImage` (the framework
21
+ * `upload-image` action) for a real uploading image block.
22
+ */
23
+ onImageUpload?: ImageUploadFn | null;
24
+ /**
25
+ * App-specific extensions (Notion nodes, media, drag handles, comment
26
+ * anchors, …) appended after the shared base schema.
27
+ */
28
+ extraExtensions?: Array<Extension | Node | Mark>;
29
+ placeholder?: string;
30
+ className?: string;
31
+ editorClassName?: string;
32
+ interactive?: boolean;
33
+ /**
34
+ * Yjs document for real-time multi-user editing. When provided, prose is
35
+ * authored against the shared Y.Doc and mirrored back to `value` as markdown
36
+ * (still the source of truth). When omitted, the editor is a plain controlled
37
+ * `value`/`onChange` editor — the existing, non-collaborative behavior.
38
+ */
39
+ ydoc?: YDoc | null;
40
+ /** Shared awareness instance for live cursors/presence. */
41
+ awareness?: Awareness | null;
42
+ /** Current user info for the collaborative cursor label. */
43
+ user?: RichMarkdownCollabUser | null;
44
+ /** Override the slash-menu block command list. */
45
+ slashItems?: SlashCommandItem[];
46
+ /** Override the bubble-toolbar item builder. */
47
+ buildBubbleItems?: (editor: import("@tiptap/react").Editor, toggleLink: () => void) => BubbleToolbarItem[];
48
+ /**
49
+ * Override how the editor's content is read into the canonical `value`.
50
+ * Defaults to the tiptap-markdown storage reader. Apps with a custom on-disk
51
+ * format (Content's NFM, the plan's `blocks[]` JSON) pass their serializer so
52
+ * seed/reconcile/onChange all speak the same value space.
53
+ */
54
+ getMarkdown?: (editor: import("@tiptap/react").Editor) => string;
55
+ /** Override how the canonical `value` is applied into the editor (seed + reconcile). */
56
+ setContent?: (editor: import("@tiptap/react").Editor, value: string, options: {
57
+ emitUpdate?: boolean;
58
+ addToHistory?: boolean;
59
+ }) => void;
60
+ /** Canonicalize `value` for the echo / already-in-sync equality checks. */
61
+ normalizeValue?: (value: string) => string;
62
+ /** Override the empty-doc seed predicate (see {@link useCollabReconcile}). */
63
+ shouldSeed?: (info: {
64
+ value: string;
65
+ currentMarkdown: string;
66
+ fragmentLength: number;
67
+ }) => boolean;
68
+ /** Initial "applied" watermark (see {@link useCollabReconcile}). */
69
+ initialAppliedUpdatedAt?: string | null;
70
+ /** Extra class on the editor wrapper (e.g. a drag-handle `wrapperSelector` hook). */
71
+ wrapperClassName?: string;
72
+ }
73
+ /**
74
+ * The single shared rich markdown editor surface. Combines
75
+ * {@link createSharedEditorExtensions} (schema + dialect-keyed markdown +
76
+ * optional collab + app extras), {@link useCollabReconcile} (seed / reconcile /
77
+ * lead-client logic), and the shared {@link SlashCommandMenu} +
78
+ * {@link BubbleToolbar}.
79
+ *
80
+ * With no `ydoc` it is a controlled `value`/`onChange` single-user editor.
81
+ * With a `ydoc` it binds the framework collaboration stack; markdown stays the
82
+ * canonical saved representation while the Y.Doc is transient live state.
83
+ */
84
+ export declare function SharedRichEditor({ value, onChange, onBlur, contentUpdatedAt, editable, dialect, preset, features, onImageUpload, extraExtensions, placeholder, className, editorClassName, interactive, ydoc, awareness, user, slashItems, buildBubbleItems, getMarkdown, setContent, normalizeValue, shouldSeed, initialAppliedUpdatedAt, wrapperClassName, }: SharedRichEditorProps): import("react/jsx-runtime").JSX.Element;
85
+ //# sourceMappingURL=SharedRichEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SharedRichEditor.d.ts","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/SharedRichEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EAAE,GAAG,IAAI,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAMzD,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE3E,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,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AE;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,eAAe,EAAE,MAAM,CAAC;QACxB,cAAc,EAAE,MAAM,CAAC;KACxB,KAAK,OAAO,CAAC;IACd,oEAAoE;IACpE,uBAAuB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,qFAAqF;IACrF,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,QAAe,EACf,OAAe,EACf,MAAe,EACf,QAAQ,EACR,aAAoB,EACpB,eAAe,EACf,WAAwC,EACxC,SAAS,EACT,eAAe,EACf,WAAsB,EACtB,IAAW,EACX,SAAgB,EAChB,IAAW,EACX,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,cAAc,EACd,UAAU,EACV,uBAAuB,EACvB,gBAAgB,GACjB,EAAE,qBAAqB,2CA+IvB"}
@@ -0,0 +1,130 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useMemo, useRef } from "react";
3
+ import { EditorContent, useEditor } from "@tiptap/react";
4
+ import { cn } from "../utils.js";
5
+ import { createSharedEditorExtensions, } from "./extensions.js";
6
+ import { useCollabReconcile, getEditorMarkdown, } from "./useCollabReconcile.js";
7
+ import { SlashCommandMenu } from "./SlashCommandMenu.js";
8
+ import { BubbleToolbar } from "./BubbleToolbar.js";
9
+ /**
10
+ * The single shared rich markdown editor surface. Combines
11
+ * {@link createSharedEditorExtensions} (schema + dialect-keyed markdown +
12
+ * optional collab + app extras), {@link useCollabReconcile} (seed / reconcile /
13
+ * lead-client logic), and the shared {@link SlashCommandMenu} +
14
+ * {@link BubbleToolbar}.
15
+ *
16
+ * With no `ydoc` it is a controlled `value`/`onChange` single-user editor.
17
+ * With a `ydoc` it binds the framework collaboration stack; markdown stays the
18
+ * canonical saved representation while the Y.Doc is transient live state.
19
+ */
20
+ export function SharedRichEditor({ value, onChange, onBlur, contentUpdatedAt, editable = true, dialect = "gfm", preset = "plan", features, onImageUpload = null, extraExtensions, placeholder = "Type '/' for commands...", className, editorClassName, interactive = editable, ydoc = null, awareness = null, user = null, slashItems, buildBubbleItems, getMarkdown, setContent, normalizeValue, shouldSeed, initialAppliedUpdatedAt, wrapperClassName, }) {
21
+ const readMarkdown = getMarkdown ?? getEditorMarkdown;
22
+ const onChangeRef = useRef(onChange);
23
+ const onBlurRef = useRef(onBlur);
24
+ onChangeRef.current = onChange;
25
+ onBlurRef.current = onBlur;
26
+ const extensions = useMemo(() => createSharedEditorExtensions({
27
+ dialect,
28
+ preset,
29
+ placeholder,
30
+ features,
31
+ extraExtensions,
32
+ onImageUpload,
33
+ collab: ydoc ? { ydoc, awareness, user } : null,
34
+ }),
35
+ // `preset` is retained in the dependency list so future preset-specific
36
+ // schema branches re-create the editor; it is currently schema-neutral. The
37
+ // collab inputs are identity-stable per block (one Y.Doc per docId), so they
38
+ // only change on a genuine doc switch — exactly when the editor must
39
+ // re-create to rebind Collaboration.
40
+ [
41
+ dialect,
42
+ placeholder,
43
+ preset,
44
+ features,
45
+ extraExtensions,
46
+ onImageUpload,
47
+ ydoc,
48
+ awareness,
49
+ user?.name,
50
+ user?.email,
51
+ user?.color,
52
+ ]);
53
+ const collab = !!ydoc;
54
+ // The collab hook needs the editor, but useEditor's `onUpdate` needs the
55
+ // hook's guards. Break the cycle with a ref: `onUpdate` reads the guards
56
+ // through `guardsRef`, which is populated right after the hook runs below.
57
+ // `onUpdate` only ever fires after the editor exists, by which point the ref
58
+ // holds the real guards.
59
+ const guardsRef = useRef(null);
60
+ const editor = useEditor({
61
+ extensions,
62
+ // With Collaboration active the prose is owned by the shared Y.XmlFragment.
63
+ // Seeding `content` here too would make the editor initialize from BOTH the
64
+ // prop and the Y.Doc, firing a spurious initial update that could autosave a
65
+ // stale value over newer SQL. The lead-client seed effect populates an empty
66
+ // doc instead. Non-collab editors keep initializing from `value`.
67
+ // With Collaboration the Y.Doc owns the prose (seeded by the lead client).
68
+ // With a custom `setContent` the reconcile seeds the editor too (the raw
69
+ // `value` is not directly settable content — e.g. the plan's blocks JSON),
70
+ // so only the plain markdown path seeds from `value` here.
71
+ content: collab || setContent ? undefined : value,
72
+ editable,
73
+ editorProps: {
74
+ attributes: {
75
+ class: cn("an-rich-md-prose", editorClassName),
76
+ },
77
+ },
78
+ onUpdate: ({ editor, transaction }) => {
79
+ const guards = guardsRef.current;
80
+ if (!guards || guards.shouldIgnoreUpdate(transaction))
81
+ return;
82
+ try {
83
+ const markdown = readMarkdown(editor);
84
+ if (!guards.registerEmitted(markdown))
85
+ return;
86
+ queueMicrotask(() => onChangeRef.current(markdown));
87
+ }
88
+ catch (error) {
89
+ console.error("Markdown serialization error:", error);
90
+ }
91
+ },
92
+ onBlur: () => {
93
+ onBlurRef.current?.();
94
+ },
95
+ });
96
+ const collabState = useCollabReconcile({
97
+ editor,
98
+ ydoc,
99
+ awareness,
100
+ value,
101
+ contentUpdatedAt,
102
+ editable,
103
+ getMarkdown: readMarkdown,
104
+ setContent,
105
+ normalizeValue,
106
+ shouldSeed,
107
+ initialAppliedUpdatedAt,
108
+ });
109
+ guardsRef.current = collabState;
110
+ useEffect(() => {
111
+ if (!editor || editor.isDestroyed)
112
+ return;
113
+ editor.setEditable(editable);
114
+ }, [editable, editor]);
115
+ useEffect(() => () => editor?.destroy(), [editor]);
116
+ const handleWrapperClick = (event) => {
117
+ if (!editable || !editor || editor.isDestroyed)
118
+ return;
119
+ const target = event.target;
120
+ if (target.classList.contains("an-rich-md-wrapper") ||
121
+ target.classList.contains("an-rich-md-clickable")) {
122
+ editor.chain().focus("end").run();
123
+ }
124
+ };
125
+ if (!editor) {
126
+ return (_jsx("div", { className: cn("an-rich-md-wrapper an-rich-md-loading", className), "data-plan-interactive": interactive ? true : undefined }));
127
+ }
128
+ return (_jsxs("div", { className: cn("an-rich-md-wrapper an-rich-md-clickable", !editable && "an-rich-md-wrapper--readonly", wrapperClassName, className), onClick: handleWrapperClick, "data-plan-interactive": interactive ? true : undefined, children: [editable ? (_jsx(BubbleToolbar, { editor: editor, buildItems: buildBubbleItems })) : null, editable ? (_jsx(SlashCommandMenu, { editor: editor, items: slashItems })) : null, _jsx(EditorContent, { editor: editor })] }));
129
+ }
130
+ //# sourceMappingURL=SharedRichEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SharedRichEditor.js","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/SharedRichEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAIzD,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,4BAA4B,GAK7B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,kBAAkB,EAClB,iBAAiB,GAElB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAyB,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,aAAa,EAA0B,MAAM,oBAAoB,CAAC;AAwE3E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,QAAQ,GAAG,IAAI,EACf,OAAO,GAAG,KAAK,EACf,MAAM,GAAG,MAAM,EACf,QAAQ,EACR,aAAa,GAAG,IAAI,EACpB,eAAe,EACf,WAAW,GAAG,0BAA0B,EACxC,SAAS,EACT,eAAe,EACf,WAAW,GAAG,QAAQ,EACtB,IAAI,GAAG,IAAI,EACX,SAAS,GAAG,IAAI,EAChB,IAAI,GAAG,IAAI,EACX,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,cAAc,EACd,UAAU,EACV,uBAAuB,EACvB,gBAAgB,GACM;I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CAAC;AACJ,CAAC","sourcesContent":["import { useEffect, useMemo, useRef } from \"react\";\nimport { EditorContent, useEditor } from \"@tiptap/react\";\nimport type { Extension, Node, Mark } from \"@tiptap/core\";\nimport type { Doc as YDoc } from \"yjs\";\nimport type { Awareness } from \"y-protocols/awareness\";\nimport { cn } from \"../utils.js\";\nimport {\n createSharedEditorExtensions,\n type RichMarkdownDialect,\n type RichMarkdownEditorPreset,\n type RichMarkdownCollabUser,\n type SharedEditorFeatures,\n} from \"./extensions.js\";\nimport type { ImageUploadFn } from \"./ImageExtension.js\";\nimport {\n useCollabReconcile,\n getEditorMarkdown,\n type UseCollabReconcileResult,\n} from \"./useCollabReconcile.js\";\nimport { SlashCommandMenu, type SlashCommandItem } from \"./SlashCommandMenu.js\";\nimport { BubbleToolbar, type BubbleToolbarItem } from \"./BubbleToolbar.js\";\n\nexport interface SharedRichEditorProps {\n value: string;\n onChange: (markdown: string) => void;\n onBlur?: () => void;\n contentUpdatedAt?: string | null;\n editable?: boolean;\n dialect?: RichMarkdownDialect;\n preset?: RichMarkdownEditorPreset;\n /** Toggle individual base extensions (tables/tasks/link/codeBlock/image). */\n features?: SharedEditorFeatures;\n /**\n * Injectable image uploader for the shared image block. Used only when\n * `features.image` is on. Pass `uploadEditorImage` (the framework\n * `upload-image` action) for a real uploading image block.\n */\n onImageUpload?: ImageUploadFn | null;\n /**\n * App-specific extensions (Notion nodes, media, drag handles, comment\n * anchors, …) appended after the shared base schema.\n */\n extraExtensions?: Array<Extension | Node | Mark>;\n placeholder?: string;\n className?: string;\n editorClassName?: string;\n interactive?: boolean;\n /**\n * Yjs document for real-time multi-user editing. When provided, prose is\n * authored against the shared Y.Doc and mirrored back to `value` as markdown\n * (still the source of truth). When omitted, the editor is a plain controlled\n * `value`/`onChange` editor — the existing, non-collaborative behavior.\n */\n ydoc?: YDoc | null;\n /** Shared awareness instance for live cursors/presence. */\n awareness?: Awareness | null;\n /** Current user info for the collaborative cursor label. */\n user?: RichMarkdownCollabUser | null;\n /** Override the slash-menu block command list. */\n slashItems?: SlashCommandItem[];\n /** Override the bubble-toolbar item builder. */\n buildBubbleItems?: (\n editor: import(\"@tiptap/react\").Editor,\n toggleLink: () => void,\n ) => BubbleToolbarItem[];\n /**\n * Override how the editor's content is read into the canonical `value`.\n * Defaults to the tiptap-markdown storage reader. Apps with a custom on-disk\n * format (Content's NFM, the plan's `blocks[]` JSON) pass their serializer so\n * seed/reconcile/onChange all speak the same value space.\n */\n getMarkdown?: (editor: import(\"@tiptap/react\").Editor) => string;\n /** Override how the canonical `value` is applied into the editor (seed + reconcile). */\n setContent?: (\n editor: import(\"@tiptap/react\").Editor,\n value: string,\n options: { emitUpdate?: boolean; addToHistory?: boolean },\n ) => void;\n /** Canonicalize `value` for the echo / already-in-sync equality checks. */\n normalizeValue?: (value: string) => string;\n /** Override the empty-doc seed predicate (see {@link useCollabReconcile}). */\n shouldSeed?: (info: {\n value: string;\n currentMarkdown: string;\n fragmentLength: number;\n }) => boolean;\n /** Initial \"applied\" watermark (see {@link useCollabReconcile}). */\n initialAppliedUpdatedAt?: string | null;\n /** Extra class on the editor wrapper (e.g. a drag-handle `wrapperSelector` hook). */\n wrapperClassName?: string;\n}\n\n/**\n * The single shared rich markdown editor surface. Combines\n * {@link createSharedEditorExtensions} (schema + dialect-keyed markdown +\n * optional collab + app extras), {@link useCollabReconcile} (seed / reconcile /\n * lead-client logic), and the shared {@link SlashCommandMenu} +\n * {@link BubbleToolbar}.\n *\n * With no `ydoc` it is a controlled `value`/`onChange` single-user editor.\n * With a `ydoc` it binds the framework collaboration stack; markdown stays the\n * canonical saved representation while the Y.Doc is transient live state.\n */\nexport function SharedRichEditor({\n value,\n onChange,\n onBlur,\n contentUpdatedAt,\n editable = true,\n dialect = \"gfm\",\n preset = \"plan\",\n features,\n onImageUpload = null,\n extraExtensions,\n placeholder = \"Type '/' for commands...\",\n className,\n editorClassName,\n interactive = editable,\n ydoc = null,\n awareness = null,\n user = null,\n slashItems,\n buildBubbleItems,\n getMarkdown,\n setContent,\n normalizeValue,\n shouldSeed,\n initialAppliedUpdatedAt,\n wrapperClassName,\n}: SharedRichEditorProps) {\n const readMarkdown = getMarkdown ?? getEditorMarkdown;\n const onChangeRef = useRef(onChange);\n const onBlurRef = useRef(onBlur);\n onChangeRef.current = onChange;\n onBlurRef.current = onBlur;\n\n const extensions = useMemo(\n () =>\n createSharedEditorExtensions({\n dialect,\n preset,\n placeholder,\n features,\n extraExtensions,\n onImageUpload,\n collab: ydoc ? { ydoc, awareness, user } : null,\n }),\n // `preset` is retained in the dependency list so future preset-specific\n // schema branches re-create the editor; it is currently schema-neutral. The\n // collab inputs are identity-stable per block (one Y.Doc per docId), so they\n // only change on a genuine doc switch — exactly when the editor must\n // re-create to rebind Collaboration.\n [\n dialect,\n placeholder,\n preset,\n features,\n extraExtensions,\n onImageUpload,\n ydoc,\n awareness,\n user?.name,\n user?.email,\n user?.color,\n ],\n );\n\n const collab = !!ydoc;\n\n // The collab hook needs the editor, but useEditor's `onUpdate` needs the\n // hook's guards. Break the cycle with a ref: `onUpdate` reads the guards\n // through `guardsRef`, which is populated right after the hook runs below.\n // `onUpdate` only ever fires after the editor exists, by which point the ref\n // holds the real guards.\n const guardsRef = useRef<UseCollabReconcileResult | null>(null);\n\n const editor = useEditor({\n extensions,\n // With Collaboration active the prose is owned by the shared Y.XmlFragment.\n // Seeding `content` here too would make the editor initialize from BOTH the\n // prop and the Y.Doc, firing a spurious initial update that could autosave a\n // stale value over newer SQL. The lead-client seed effect populates an empty\n // doc instead. Non-collab editors keep initializing from `value`.\n // With Collaboration the Y.Doc owns the prose (seeded by the lead client).\n // With a custom `setContent` the reconcile seeds the editor too (the raw\n // `value` is not directly settable content — e.g. the plan's blocks JSON),\n // so only the plain markdown path seeds from `value` here.\n content: collab || setContent ? undefined : value,\n editable,\n editorProps: {\n attributes: {\n class: cn(\"an-rich-md-prose\", editorClassName),\n },\n },\n onUpdate: ({ editor, transaction }) => {\n const guards = guardsRef.current;\n if (!guards || guards.shouldIgnoreUpdate(transaction)) return;\n try {\n const markdown = readMarkdown(editor);\n if (!guards.registerEmitted(markdown)) return;\n queueMicrotask(() => onChangeRef.current(markdown));\n } catch (error) {\n console.error(\"Markdown serialization error:\", error);\n }\n },\n onBlur: () => {\n onBlurRef.current?.();\n },\n });\n\n const collabState = useCollabReconcile({\n editor,\n ydoc,\n awareness,\n value,\n contentUpdatedAt,\n editable,\n getMarkdown: readMarkdown,\n setContent,\n normalizeValue,\n shouldSeed,\n initialAppliedUpdatedAt,\n });\n guardsRef.current = collabState;\n\n useEffect(() => {\n if (!editor || editor.isDestroyed) return;\n editor.setEditable(editable);\n }, [editable, editor]);\n\n useEffect(() => () => editor?.destroy(), [editor]);\n\n const handleWrapperClick = (event: React.MouseEvent<HTMLDivElement>) => {\n if (!editable || !editor || editor.isDestroyed) return;\n const target = event.target as HTMLElement;\n if (\n target.classList.contains(\"an-rich-md-wrapper\") ||\n target.classList.contains(\"an-rich-md-clickable\")\n ) {\n editor.chain().focus(\"end\").run();\n }\n };\n\n if (!editor) {\n return (\n <div\n className={cn(\"an-rich-md-wrapper an-rich-md-loading\", className)}\n data-plan-interactive={interactive ? true : undefined}\n />\n );\n }\n\n return (\n <div\n className={cn(\n \"an-rich-md-wrapper an-rich-md-clickable\",\n !editable && \"an-rich-md-wrapper--readonly\",\n wrapperClassName,\n className,\n )}\n onClick={handleWrapperClick}\n data-plan-interactive={interactive ? true : undefined}\n >\n {editable ? (\n <BubbleToolbar editor={editor} buildItems={buildBubbleItems} />\n ) : null}\n {editable ? (\n <SlashCommandMenu editor={editor} items={slashItems} />\n ) : null}\n <EditorContent editor={editor} />\n </div>\n );\n}\n"]}
@@ -0,0 +1,36 @@
1
+ import type { Editor } from "@tiptap/react";
2
+ import { type ImageUploadFn } from "./ImageExtension.js";
3
+ /** A single slash-menu block command. Apps can extend the default list. */
4
+ export interface SlashCommandItem {
5
+ title: string;
6
+ description: string;
7
+ /** Short text glyph shown in the menu (T, H1, tbl, …). */
8
+ icon: string;
9
+ action: (editor: Editor) => void;
10
+ }
11
+ /**
12
+ * The default block commands — Plan's current set. Apps pass their own `items`
13
+ * (typically `[...DEFAULT_SLASH_COMMANDS, ...extra]`) to extend it.
14
+ */
15
+ export declare const DEFAULT_SLASH_COMMANDS: SlashCommandItem[];
16
+ /**
17
+ * Build the `/image` slash command for the shared image block. Requires the
18
+ * editor to mount the shared image extension (`features.image`) and an
19
+ * {@link ImageUploadFn}; the command opens a native file picker and uploads +
20
+ * inserts the chosen image(s). Add it to the list an app passes to
21
+ * {@link SlashCommandMenu} (e.g. `[...DEFAULT_SLASH_COMMANDS, createImageSlashCommand(upload)]`).
22
+ */
23
+ export declare function createImageSlashCommand(upload: ImageUploadFn): SlashCommandItem;
24
+ export interface SlashCommandMenuProps {
25
+ editor: Editor;
26
+ /** Block command list. Defaults to {@link DEFAULT_SLASH_COMMANDS}. */
27
+ items?: SlashCommandItem[];
28
+ }
29
+ /**
30
+ * The shared "/" block-insert menu. Detects a `/query` at the caret, filters the
31
+ * provided command list, and renders a fixed-position picker with keyboard
32
+ * navigation. Extracted from the inline plan menu so apps share one
33
+ * implementation and only swap the command list.
34
+ */
35
+ export declare function SlashCommandMenu({ editor, items, }: SlashCommandMenuProps): import("react/jsx-runtime").JSX.Element;
36
+ //# sourceMappingURL=SlashCommandMenu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SlashCommandMenu.d.ts","sourceRoot":"","sources":["../../../src/client/rich-markdown-editor/SlashCommandMenu.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE7E,2EAA2E;AAC3E,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,gBAAgB,EA2EpD,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,aAAa,GACpB,gBAAgB,CAOlB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,KAAK,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC5B;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,KAA8B,GAC/B,EAAE,qBAAqB,2CAgJvB"}