@ecsplico/editor 3.5.1 → 4.0.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 (583) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/dist/adapters/direct-ai.d.ts +4 -4
  3. package/dist/adapters/direct-ai.js +2 -2
  4. package/dist/adapters/direct-ai.js.map +1 -1
  5. package/dist/adapters/document-state.d.ts +1 -1
  6. package/dist/adapters/document-state.js.map +1 -1
  7. package/dist/adapters/forge.d.ts +2 -2
  8. package/dist/adapters/forge.js.map +1 -1
  9. package/dist/adapters/nitro.d.ts +11 -3
  10. package/dist/adapters/nitro.js +3 -1
  11. package/dist/adapters/nitro.js.map +1 -1
  12. package/dist/adapters/shared.d.ts +6 -6
  13. package/dist/adapters/shared.js.map +1 -1
  14. package/dist/code/CodeSurface.vue.d.ts +3 -3
  15. package/dist/config/index.d.ts +14 -14
  16. package/dist/config/index.js +8 -8
  17. package/dist/config/index.js.map +1 -1
  18. package/dist/core/backend-types.d.ts +3 -3
  19. package/dist/core/backend-types.js.map +1 -1
  20. package/dist/core/backend.d.ts +4 -4
  21. package/dist/core/backend.js.map +1 -1
  22. package/dist/core/block-convert.d.ts +1 -1
  23. package/dist/core/block-convert.js +5 -5
  24. package/dist/core/block-convert.js.map +1 -1
  25. package/dist/core/block-transfer.d.ts +8 -4
  26. package/dist/core/block-transfer.js +23 -14
  27. package/dist/core/block-transfer.js.map +1 -1
  28. package/dist/core/capabilities.d.ts +113 -0
  29. package/dist/core/capabilities.js +155 -0
  30. package/dist/core/capabilities.js.map +1 -0
  31. package/dist/core/command-types.d.ts +1 -1
  32. package/dist/core/context.js.map +1 -1
  33. package/dist/core/convert.d.ts +5 -5
  34. package/dist/core/convert.js +5 -5
  35. package/dist/core/convert.js.map +1 -1
  36. package/dist/core/core-feature.js +1 -1
  37. package/dist/core/define-editor.d.ts +2 -2
  38. package/dist/core/define-editor.js +34 -6
  39. package/dist/core/define-editor.js.map +1 -1
  40. package/dist/core/derivation.d.ts +119 -0
  41. package/dist/core/derivation.js +187 -0
  42. package/dist/core/derivation.js.map +1 -0
  43. package/dist/core/derive.d.ts +61 -0
  44. package/dist/core/derive.js +69 -0
  45. package/dist/core/derive.js.map +1 -0
  46. package/dist/core/extension-points.d.ts +16 -0
  47. package/dist/core/feature-context.d.ts +5 -1
  48. package/dist/core/feature-context.js +10 -3
  49. package/dist/core/feature-context.js.map +1 -1
  50. package/dist/core/feature.d.ts +41 -19
  51. package/dist/core/feature.js.map +1 -1
  52. package/dist/core/fences.js +1 -1
  53. package/dist/core/fences.js.map +1 -1
  54. package/dist/core/index.d.ts +6 -2
  55. package/dist/core/index.js +5 -1
  56. package/dist/core/pipeline.d.ts +14 -5
  57. package/dist/core/pipeline.js +19 -7
  58. package/dist/core/pipeline.js.map +1 -1
  59. package/dist/core/properties.d.ts +22 -0
  60. package/dist/core/properties.js +17 -0
  61. package/dist/core/properties.js.map +1 -0
  62. package/dist/core/schema/block-ids.js +5 -5
  63. package/dist/core/schema/block-ids.js.map +1 -1
  64. package/dist/core/schema/index.d.ts +2 -1
  65. package/dist/core/schema/index.js +2 -1
  66. package/dist/core/schema/index.js.map +1 -1
  67. package/dist/core/schema/opaque-fence.d.ts +4 -4
  68. package/dist/core/schema/opaque-fence.js +7 -7
  69. package/dist/core/schema/opaque-fence.js.map +1 -1
  70. package/dist/core/schema/persisted-names.d.ts +58 -0
  71. package/dist/core/schema/persisted-names.js +96 -0
  72. package/dist/core/schema/persisted-names.js.map +1 -0
  73. package/dist/core/toolbar-items.js +1 -1
  74. package/dist/core/toolbar-items.js.map +1 -1
  75. package/dist/core/util.js +5 -1
  76. package/dist/core/util.js.map +1 -1
  77. package/dist/document/DocumentSurface.vue.d.ts +3 -3
  78. package/dist/features/ai/agent-ops.js +1 -1
  79. package/dist/features/ai/ai-review.js +1 -1
  80. package/dist/features/ai/assistant.d.ts +4 -4
  81. package/dist/features/ai/assistant.js +1 -1
  82. package/dist/features/ai/assistant.js.map +1 -1
  83. package/dist/features/ai/components/AiSelectionMenu.js +1 -1
  84. package/dist/features/ai/components/AiSelectionMenu.js.map +1 -1
  85. package/dist/features/ai/components/ModelQuickSwitch.js +7 -7
  86. package/dist/features/ai/components/ModelQuickSwitch.js.map +1 -1
  87. package/dist/features/ai/components/ModelQuickSwitch.vue.d.ts +4 -4
  88. package/dist/features/ai/components/SettingsAiTab.js +8 -8
  89. package/dist/features/ai/components/SettingsAiTab.js.map +1 -1
  90. package/dist/features/ai/components/SettingsModelProfiles.js +1 -1
  91. package/dist/features/ai/components/SettingsModelProfiles.js.map +1 -1
  92. package/dist/features/ai/document-chat-model.d.ts +2 -2
  93. package/dist/features/ai/document-chat-model.js +5 -5
  94. package/dist/features/ai/document-chat-model.js.map +1 -1
  95. package/dist/features/ai/document-chat.js +2 -2
  96. package/dist/features/ai/document-chat.js.map +1 -1
  97. package/dist/features/ai/feature.d.ts +2 -2
  98. package/dist/features/ai/feature.js +2 -2
  99. package/dist/features/ai/feature.js.map +1 -1
  100. package/dist/features/ai/ghost-autocomplete.d.ts +4 -4
  101. package/dist/features/ai/ghost-autocomplete.js +1 -1
  102. package/dist/features/ai/ghost-autocomplete.js.map +1 -1
  103. package/dist/features/ai/index.d.ts +3 -3
  104. package/dist/features/ai/index.js +2 -2
  105. package/dist/features/ai/model-profiles.d.ts +9 -9
  106. package/dist/features/ai/model-profiles.js +13 -13
  107. package/dist/features/ai/model-profiles.js.map +1 -1
  108. package/dist/features/ai/protocol/agent-ops.d.ts +2 -2
  109. package/dist/features/ai/protocol/agent-ops.js +1 -1
  110. package/dist/features/ai/protocol/agent-ops.js.map +1 -1
  111. package/dist/features/ai/protocol/block-lines.d.ts +7 -7
  112. package/dist/features/ai/protocol/block-lines.js +10 -10
  113. package/dist/features/ai/protocol/block-lines.js.map +1 -1
  114. package/dist/features/ai/protocol/chat.d.ts +5 -5
  115. package/dist/features/ai/protocol/chat.js +12 -12
  116. package/dist/features/ai/protocol/chat.js.map +1 -1
  117. package/dist/features/ai/protocol/generate.d.ts +1 -1
  118. package/dist/features/ai/protocol/generate.js +1 -1
  119. package/dist/features/ai/protocol/generate.js.map +1 -1
  120. package/dist/features/ai/protocol/index.d.ts +3 -3
  121. package/dist/features/ai/protocol/index.js +2 -2
  122. package/dist/features/ai/protocol/models.d.ts +3 -3
  123. package/dist/features/ai/protocol/models.js +3 -3
  124. package/dist/features/ai/protocol/models.js.map +1 -1
  125. package/dist/features/ai/protocol/schemas.d.ts +1 -1
  126. package/dist/features/ai/protocol/schemas.js +1 -1
  127. package/dist/features/ai/protocol/schemas.js.map +1 -1
  128. package/dist/features/ai/protocol/tasks.d.ts +5 -5
  129. package/dist/features/ai/protocol/tasks.js +12 -12
  130. package/dist/features/ai/protocol/tasks.js.map +1 -1
  131. package/dist/features/ai/react/AiSelectionMenu.js.map +1 -1
  132. package/dist/features/ai/react/ModelQuickSwitch.d.ts +4 -4
  133. package/dist/features/ai/react/ModelQuickSwitch.js +6 -6
  134. package/dist/features/ai/react/ModelQuickSwitch.js.map +1 -1
  135. package/dist/features/ai/react/SettingsAiTab.d.ts +1 -1
  136. package/dist/features/ai/react/SettingsAiTab.js +8 -8
  137. package/dist/features/ai/react/SettingsAiTab.js.map +1 -1
  138. package/dist/features/ai/react/SettingsModelProfiles.d.ts +1 -1
  139. package/dist/features/ai/react/SettingsModelProfiles.js +1 -1
  140. package/dist/features/ai/react/SettingsModelProfiles.js.map +1 -1
  141. package/dist/features/ai/react/use-ai-assistant.d.ts +1 -1
  142. package/dist/features/ai/react/use-ai-assistant.js +1 -1
  143. package/dist/features/ai/react/use-ai-assistant.js.map +1 -1
  144. package/dist/features/ai/react/use-model-profiles.d.ts +5 -5
  145. package/dist/features/ai/react/use-model-profiles.js +2 -2
  146. package/dist/features/ai/react/use-model-profiles.js.map +1 -1
  147. package/dist/features/ai/use-ai-assistant.d.ts +1 -1
  148. package/dist/features/ai/use-ai-assistant.js +1 -1
  149. package/dist/features/ai/use-ai-assistant.js.map +1 -1
  150. package/dist/features/ai/use-model-profiles.d.ts +4 -4
  151. package/dist/features/ai/use-model-profiles.js +2 -2
  152. package/dist/features/ai/use-model-profiles.js.map +1 -1
  153. package/dist/features/block-ui/block-actions.d.ts +8 -4
  154. package/dist/features/block-ui/block-actions.js +38 -22
  155. package/dist/features/block-ui/block-actions.js.map +1 -1
  156. package/dist/features/block-ui/block-target.d.ts +29 -0
  157. package/dist/features/block-ui/block-target.js +63 -0
  158. package/dist/features/block-ui/block-target.js.map +1 -0
  159. package/dist/features/block-ui/components/BlockHandles.js +3 -3
  160. package/dist/features/block-ui/components/BlockHandles.js.map +1 -1
  161. package/dist/features/block-ui/components/BlockUi.js +11 -23
  162. package/dist/features/block-ui/components/BlockUi.js.map +1 -1
  163. package/dist/features/block-ui/feature.d.ts +3 -2
  164. package/dist/features/block-ui/feature.js +3 -2
  165. package/dist/features/block-ui/feature.js.map +1 -1
  166. package/dist/features/block-ui/handle-geometry.js +12 -23
  167. package/dist/features/block-ui/handle-geometry.js.map +1 -1
  168. package/dist/features/block-ui/index.d.ts +2 -1
  169. package/dist/features/block-ui/index.js +2 -1
  170. package/dist/features/block-ui/react/BlockHandles.d.ts +1 -1
  171. package/dist/features/block-ui/react/BlockHandles.js +4 -4
  172. package/dist/features/block-ui/react/BlockHandles.js.map +1 -1
  173. package/dist/features/block-ui/react/BlockUi.js +13 -25
  174. package/dist/features/block-ui/react/BlockUi.js.map +1 -1
  175. package/dist/features/comments/model.js +1 -1
  176. package/dist/features/composites/accepted-children.d.ts +5 -4
  177. package/dist/features/composites/accepted-children.js +26 -26
  178. package/dist/features/composites/accepted-children.js.map +1 -1
  179. package/dist/features/composites/ai-brief.d.ts +4 -4
  180. package/dist/features/composites/ai-brief.js +14 -12
  181. package/dist/features/composites/ai-brief.js.map +1 -1
  182. package/dist/features/composites/anchors.d.ts +1 -1
  183. package/dist/features/composites/anchors.js.map +1 -1
  184. package/dist/features/composites/baskets.d.ts +1 -1
  185. package/dist/features/composites/baskets.js.map +1 -1
  186. package/dist/features/composites/bibliography-command.d.ts +1 -1
  187. package/dist/features/composites/bibliography-form.js +1 -1
  188. package/dist/features/composites/bibliography-form.js.map +1 -1
  189. package/dist/features/composites/bibliography.js.map +1 -1
  190. package/dist/features/composites/block-types-json.d.ts +38 -0
  191. package/dist/features/composites/block-types-json.js +122 -0
  192. package/dist/features/composites/block-types-json.js.map +1 -0
  193. package/dist/features/composites/block-types.d.ts +119 -0
  194. package/dist/features/composites/block-types.js +343 -0
  195. package/dist/features/composites/block-types.js.map +1 -0
  196. package/dist/features/composites/capabilities.js +109 -0
  197. package/dist/features/composites/capabilities.js.map +1 -0
  198. package/dist/features/composites/components/BibliographyEditor.js +5 -5
  199. package/dist/features/composites/components/BibliographyEditor.js.map +1 -1
  200. package/dist/features/composites/components/CompositeBasketMenu.js +2 -2
  201. package/dist/features/composites/components/CompositeBasketMenu.js.map +1 -1
  202. package/dist/features/composites/components/CompositeChrome.js +18 -8
  203. package/dist/features/composites/components/CompositeChrome.js.map +1 -1
  204. package/dist/features/composites/components/CompositeChrome.vue.d.ts +1 -1
  205. package/dist/features/composites/components/CompositeDetails.js +11 -10
  206. package/dist/features/composites/components/CompositeDetails.js.map +1 -1
  207. package/dist/features/composites/components/CompositeDetails.vue.d.ts +1 -1
  208. package/dist/features/composites/components/CompositeFieldEditor.js +7 -7
  209. package/dist/features/composites/components/CompositeFieldEditor.js.map +1 -1
  210. package/dist/features/composites/components/CompositeFieldEditor.vue.d.ts +5 -5
  211. package/dist/features/composites/components/CompositeInspector.js +136 -113
  212. package/dist/features/composites/components/CompositeInspector.js.map +1 -1
  213. package/dist/features/composites/components/CompositeInspector.vue.d.ts +3 -3
  214. package/dist/features/composites/components/CompositeStatusMenu.js +2 -2
  215. package/dist/features/composites/components/CompositeStatusMenu.js.map +1 -1
  216. package/dist/features/composites/components/CompositeSummaryEditor.js +1 -1
  217. package/dist/features/composites/components/CompositeSummaryEditor.js.map +1 -1
  218. package/dist/features/composites/components/CompositeSummaryEditor.vue.d.ts +1 -1
  219. package/dist/features/composites/components/CompositeTable.js +2 -2
  220. package/dist/features/composites/components/CompositeTable.js.map +1 -1
  221. package/dist/features/composites/components/CompositeTagsEditor.js +1 -1
  222. package/dist/features/composites/components/CompositeTagsEditor.js.map +1 -1
  223. package/dist/features/composites/components/CompositeTagsEditor.vue.d.ts +1 -1
  224. package/dist/features/composites/components/CompositeView.js +19 -17
  225. package/dist/features/composites/components/CompositeView.js.map +1 -1
  226. package/dist/features/composites/components/DerivationBadge.js +15 -6
  227. package/dist/features/composites/components/DerivationBadge.js.map +1 -1
  228. package/dist/features/composites/components/FocusChip.js +1 -1
  229. package/dist/features/composites/components/FocusChip.js.map +1 -1
  230. package/dist/features/composites/components/FocusChip.vue.d.ts +1 -1
  231. package/dist/features/composites/components/ReferenceFieldSelect.js +3 -3
  232. package/dist/features/composites/components/ReferenceFieldSelect.js.map +1 -1
  233. package/dist/features/composites/components/ReferenceView.js +1 -1
  234. package/dist/features/composites/components/ReferenceView.js.map +1 -1
  235. package/dist/features/composites/components/SettingsEditingTab.js +18 -18
  236. package/dist/features/composites/components/SettingsEditingTab.js.map +1 -1
  237. package/dist/features/composites/components/SettingsEditingTab.vue.d.ts +3 -3
  238. package/dist/features/composites/convert.d.ts +4 -4
  239. package/dist/features/composites/convert.js +27 -28
  240. package/dist/features/composites/convert.js.map +1 -1
  241. package/dist/features/composites/derived-chrome.js +34 -28
  242. package/dist/features/composites/derived-chrome.js.map +1 -1
  243. package/dist/features/composites/editing-settings-keys.js +6 -6
  244. package/dist/features/composites/editing-settings-keys.js.map +1 -1
  245. package/dist/features/composites/feature.d.ts +10 -10
  246. package/dist/features/composites/feature.js +58 -46
  247. package/dist/features/composites/feature.js.map +1 -1
  248. package/dist/features/composites/fences.d.ts +3 -3
  249. package/dist/features/composites/fences.js +18 -13
  250. package/dist/features/composites/fences.js.map +1 -1
  251. package/dist/features/composites/focus.d.ts +10 -10
  252. package/dist/features/composites/focus.js +11 -11
  253. package/dist/features/composites/focus.js.map +1 -1
  254. package/dist/features/composites/heading-composites.d.ts +5 -5
  255. package/dist/features/composites/heading-composites.js +13 -16
  256. package/dist/features/composites/heading-composites.js.map +1 -1
  257. package/dist/features/composites/index.d.ts +20 -18
  258. package/dist/features/composites/index.js +9 -7
  259. package/dist/features/composites/inspector-model.d.ts +45 -22
  260. package/dist/features/composites/inspector-model.js +53 -14
  261. package/dist/features/composites/inspector-model.js.map +1 -1
  262. package/dist/features/composites/legacy.d.ts +5 -4
  263. package/dist/features/composites/legacy.js +16 -23
  264. package/dist/features/composites/legacy.js.map +1 -1
  265. package/dist/features/composites/markdown-export.js +3 -3
  266. package/dist/features/composites/markdown-export.js.map +1 -1
  267. package/dist/features/composites/merge.d.ts +8 -7
  268. package/dist/features/composites/merge.js +39 -12
  269. package/dist/features/composites/merge.js.map +1 -1
  270. package/dist/features/composites/meta-display.js +5 -5
  271. package/dist/features/composites/meta-display.js.map +1 -1
  272. package/dist/features/composites/meta-keys.d.ts +5 -5
  273. package/dist/features/composites/meta-keys.js +8 -8
  274. package/dist/features/composites/meta-keys.js.map +1 -1
  275. package/dist/features/composites/node-views.d.ts +3 -3
  276. package/dist/features/composites/node-views.js +2 -2
  277. package/dist/features/composites/node-views.js.map +1 -1
  278. package/dist/features/composites/nodes.d.ts +13 -13
  279. package/dist/features/composites/nodes.js +100 -77
  280. package/dist/features/composites/nodes.js.map +1 -1
  281. package/dist/features/composites/outline.d.ts +15 -12
  282. package/dist/features/composites/outline.js +24 -21
  283. package/dist/features/composites/outline.js.map +1 -1
  284. package/dist/features/composites/properties.d.ts +51 -0
  285. package/dist/features/composites/properties.js +89 -0
  286. package/dist/features/composites/properties.js.map +1 -0
  287. package/dist/features/composites/react/BibliographyEditor.js +5 -5
  288. package/dist/features/composites/react/BibliographyEditor.js.map +1 -1
  289. package/dist/features/composites/react/CompositeBasketMenu.js +2 -2
  290. package/dist/features/composites/react/CompositeBasketMenu.js.map +1 -1
  291. package/dist/features/composites/react/CompositeChrome.d.ts +1 -1
  292. package/dist/features/composites/react/CompositeChrome.js +15 -6
  293. package/dist/features/composites/react/CompositeChrome.js.map +1 -1
  294. package/dist/features/composites/react/CompositeDetails.d.ts +1 -1
  295. package/dist/features/composites/react/CompositeDetails.js +11 -10
  296. package/dist/features/composites/react/CompositeDetails.js.map +1 -1
  297. package/dist/features/composites/react/CompositeFieldEditor.d.ts +5 -5
  298. package/dist/features/composites/react/CompositeFieldEditor.js +6 -6
  299. package/dist/features/composites/react/CompositeFieldEditor.js.map +1 -1
  300. package/dist/features/composites/react/CompositeInspector.d.ts +3 -3
  301. package/dist/features/composites/react/CompositeInspector.js +142 -128
  302. package/dist/features/composites/react/CompositeInspector.js.map +1 -1
  303. package/dist/features/composites/react/CompositeStatusMenu.js +2 -2
  304. package/dist/features/composites/react/CompositeStatusMenu.js.map +1 -1
  305. package/dist/features/composites/react/CompositeSummaryEditor.d.ts +1 -1
  306. package/dist/features/composites/react/CompositeSummaryEditor.js +1 -1
  307. package/dist/features/composites/react/CompositeSummaryEditor.js.map +1 -1
  308. package/dist/features/composites/react/CompositeTable.d.ts +1 -1
  309. package/dist/features/composites/react/CompositeTable.js +3 -3
  310. package/dist/features/composites/react/CompositeTable.js.map +1 -1
  311. package/dist/features/composites/react/CompositeTagsEditor.d.ts +1 -1
  312. package/dist/features/composites/react/CompositeTagsEditor.js +1 -1
  313. package/dist/features/composites/react/CompositeTagsEditor.js.map +1 -1
  314. package/dist/features/composites/react/CompositeView.js +17 -15
  315. package/dist/features/composites/react/CompositeView.js.map +1 -1
  316. package/dist/features/composites/react/DerivationBadge.js +13 -4
  317. package/dist/features/composites/react/DerivationBadge.js.map +1 -1
  318. package/dist/features/composites/react/FocusChip.d.ts +1 -1
  319. package/dist/features/composites/react/FocusChip.js +1 -1
  320. package/dist/features/composites/react/FocusChip.js.map +1 -1
  321. package/dist/features/composites/react/ReferenceFieldSelect.js +3 -3
  322. package/dist/features/composites/react/ReferenceFieldSelect.js.map +1 -1
  323. package/dist/features/composites/react/ReferenceView.d.ts +1 -1
  324. package/dist/features/composites/react/ReferenceView.js +1 -1
  325. package/dist/features/composites/react/ReferenceView.js.map +1 -1
  326. package/dist/features/composites/react/SettingsEditingTab.d.ts +4 -4
  327. package/dist/features/composites/react/SettingsEditingTab.js +20 -20
  328. package/dist/features/composites/react/SettingsEditingTab.js.map +1 -1
  329. package/dist/features/composites/react.js +1 -1
  330. package/dist/features/composites/react.js.map +1 -1
  331. package/dist/features/composites/reference-ai.js +1 -1
  332. package/dist/features/composites/reference-ai.js.map +1 -1
  333. package/dist/features/composites/reference-label.d.ts +3 -3
  334. package/dist/features/composites/reference-label.js +6 -6
  335. package/dist/features/composites/reference-label.js.map +1 -1
  336. package/dist/features/composites/reference-suggestion.d.ts +1 -1
  337. package/dist/features/composites/reference-suggestion.js +3 -3
  338. package/dist/features/composites/reference-suggestion.js.map +1 -1
  339. package/dist/features/composites/reference-text.d.ts +2 -2
  340. package/dist/features/composites/reference-text.js +4 -4
  341. package/dist/features/composites/reference-text.js.map +1 -1
  342. package/dist/features/composites/reference.d.ts +3 -3
  343. package/dist/features/composites/reference.js +1 -1
  344. package/dist/features/composites/reference.js.map +1 -1
  345. package/dist/features/composites/reveal-source.d.ts +3 -3
  346. package/dist/features/composites/reveal-source.js +6 -6
  347. package/dist/features/composites/reveal-source.js.map +1 -1
  348. package/dist/features/composites/rows-model.d.ts +2 -2
  349. package/dist/features/composites/rows-model.js +4 -3
  350. package/dist/features/composites/rows-model.js.map +1 -1
  351. package/dist/features/composites/rows.d.ts +16 -28
  352. package/dist/features/composites/rows.js +20 -54
  353. package/dist/features/composites/rows.js.map +1 -1
  354. package/dist/features/composites/schema.d.ts +12 -11
  355. package/dist/features/composites/schema.js +10 -9
  356. package/dist/features/composites/schema.js.map +1 -1
  357. package/dist/features/composites/source.d.ts +20 -0
  358. package/dist/features/composites/source.js +40 -0
  359. package/dist/features/composites/source.js.map +1 -0
  360. package/dist/features/composites/split.d.ts +11 -11
  361. package/dist/features/composites/split.js +20 -20
  362. package/dist/features/composites/split.js.map +1 -1
  363. package/dist/features/composites/structure-mode.js +3 -3
  364. package/dist/features/composites/structure-mode.js.map +1 -1
  365. package/dist/features/composites/table-model.js +2 -2
  366. package/dist/features/composites/table-model.js.map +1 -1
  367. package/dist/features/composites/use-composite-inspector.js +3 -1
  368. package/dist/features/composites/use-composite-inspector.js.map +1 -1
  369. package/dist/features/composites/use-composite-rows.d.ts +2 -2
  370. package/dist/features/composites/use-composite-rows.js.map +1 -1
  371. package/dist/features/composites/vue.js +1 -1
  372. package/dist/features/composites/vue.js.map +1 -1
  373. package/dist/features/image-studio/components/ImageStudioDialog.js +1 -1
  374. package/dist/features/image-studio/components/ImageStudioDialog.js.map +1 -1
  375. package/dist/features/image-studio/components/ImageStudioDialog.vue.d.ts +1 -1
  376. package/dist/features/image-studio/components/ImageStudioView.js.map +1 -1
  377. package/dist/features/image-studio/feature.d.ts +1 -1
  378. package/dist/features/image-studio/feature.js +1 -1
  379. package/dist/features/image-studio/feature.js.map +1 -1
  380. package/dist/features/image-studio/node-core.d.ts +3 -3
  381. package/dist/features/image-studio/node-core.js +1 -1
  382. package/dist/features/image-studio/node-core.js.map +1 -1
  383. package/dist/features/image-studio/node-store.d.ts +1 -1
  384. package/dist/features/image-studio/node-store.js +1 -1
  385. package/dist/features/image-studio/node-store.js.map +1 -1
  386. package/dist/features/image-studio/react/ImageStudioDialog.d.ts +1 -1
  387. package/dist/features/image-studio/react/ImageStudioDialog.js +1 -1
  388. package/dist/features/image-studio/react/ImageStudioDialog.js.map +1 -1
  389. package/dist/features/image-studio/react/ImageStudioView.js +1 -1
  390. package/dist/features/image-studio/react/ImageStudioView.js.map +1 -1
  391. package/dist/features/image-studio/react/store.d.ts +3 -3
  392. package/dist/features/image-studio/react/store.js.map +1 -1
  393. package/dist/features/image-studio/react.d.ts +1 -1
  394. package/dist/features/image-studio/react.js +1 -1
  395. package/dist/features/image-studio/react.js.map +1 -1
  396. package/dist/features/image-studio/schema.d.ts +1 -1
  397. package/dist/features/image-studio/schema.js +1 -1
  398. package/dist/features/image-studio/schema.js.map +1 -1
  399. package/dist/features/image-studio/state.d.ts +3 -3
  400. package/dist/features/image-studio/state.js +2 -2
  401. package/dist/features/image-studio/state.js.map +1 -1
  402. package/dist/features/image-studio/store.d.ts +3 -3
  403. package/dist/features/image-studio/vue.d.ts +1 -1
  404. package/dist/features/image-studio/vue.js +1 -1
  405. package/dist/features/image-studio/vue.js.map +1 -1
  406. package/dist/features/media/index.js +1 -1
  407. package/dist/features/media/react/AudioRecorderModal.js +1 -1
  408. package/dist/features/media/react.js +1 -1
  409. package/dist/features/mentions/tag.js +2 -1
  410. package/dist/features/mentions/tag.js.map +1 -1
  411. package/dist/features/themes/components/SettingsAppearanceTab.js +1 -1
  412. package/dist/features/themes/components/SettingsAppearanceTab.js.map +1 -1
  413. package/dist/features/themes/feature.d.ts +1 -1
  414. package/dist/features/themes/feature.js.map +1 -1
  415. package/dist/features/themes/react/SettingsAppearanceTab.d.ts +1 -1
  416. package/dist/features/themes/react/SettingsAppearanceTab.js +1 -1
  417. package/dist/features/themes/react/SettingsAppearanceTab.js.map +1 -1
  418. package/dist/features/themes/theme-runtime.js +1 -1
  419. package/dist/features/themes/theme-runtime.js.map +1 -1
  420. package/dist/features/transcript/TranscriptSegmentView.js +1 -1
  421. package/dist/features/transcript/TranscriptSegmentView.js.map +1 -1
  422. package/dist/features/transcript/react/TranscriptSegmentView.js +1 -1
  423. package/dist/features/transcript/react/TranscriptSegmentView.js.map +1 -1
  424. package/dist/features/transcript/segment-node.js.map +1 -1
  425. package/dist/features/transfer/feature.js +1 -1
  426. package/dist/features/transfer/feature.js.map +1 -1
  427. package/dist/features/transfer/transforms.d.ts +4 -4
  428. package/dist/features/transfer/transforms.js +12 -12
  429. package/dist/features/transfer/transforms.js.map +1 -1
  430. package/dist/i18n/de/ai.js +4 -4
  431. package/dist/i18n/de/ai.js.map +1 -1
  432. package/dist/i18n/de/authors.js +1 -1
  433. package/dist/i18n/de/authors.js.map +1 -1
  434. package/dist/i18n/de/comments.js +1 -1
  435. package/dist/i18n/de/comments.js.map +1 -1
  436. package/dist/i18n/de/composites.js +62 -59
  437. package/dist/i18n/de/composites.js.map +1 -1
  438. package/dist/i18n/de/image-studio.js +2 -2
  439. package/dist/i18n/de/image-studio.js.map +1 -1
  440. package/dist/i18n/de/integrations.js +20 -20
  441. package/dist/i18n/de/integrations.js.map +1 -1
  442. package/dist/i18n/de/markdown.js +1 -1
  443. package/dist/i18n/de/markdown.js.map +1 -1
  444. package/dist/i18n/de/palette.js +1 -1
  445. package/dist/i18n/de/palette.js.map +1 -1
  446. package/dist/i18n/de/themes.js +3 -3
  447. package/dist/i18n/de/themes.js.map +1 -1
  448. package/dist/i18n/de/transfer.js +2 -2
  449. package/dist/i18n/de/transfer.js.map +1 -1
  450. package/dist/i18n/de/tree.js +6 -6
  451. package/dist/i18n/de/tree.js.map +1 -1
  452. package/dist/i18n/de.d.ts +101 -98
  453. package/dist/i18n/en/ai.js +2 -2
  454. package/dist/i18n/en/ai.js.map +1 -1
  455. package/dist/i18n/en/composites.js +64 -61
  456. package/dist/i18n/en/composites.js.map +1 -1
  457. package/dist/i18n/en/integrations.js +9 -9
  458. package/dist/i18n/en/integrations.js.map +1 -1
  459. package/dist/i18n/en/markdown.js +1 -1
  460. package/dist/i18n/en/markdown.js.map +1 -1
  461. package/dist/i18n/en/palette.js +1 -1
  462. package/dist/i18n/en/palette.js.map +1 -1
  463. package/dist/i18n/en/themes.js +4 -4
  464. package/dist/i18n/en/themes.js.map +1 -1
  465. package/dist/i18n/en/tree.js +5 -5
  466. package/dist/i18n/en/tree.js.map +1 -1
  467. package/dist/index.d.ts +4 -1
  468. package/dist/integrations/composite-ai/bibliography-fetch.d.ts +6 -6
  469. package/dist/integrations/composite-ai/bibliography-fetch.js +19 -19
  470. package/dist/integrations/composite-ai/bibliography-fetch.js.map +1 -1
  471. package/dist/integrations/composite-ai/composite-fill.d.ts +4 -4
  472. package/dist/integrations/composite-ai/composite-fill.js +5 -5
  473. package/dist/integrations/composite-ai/composite-fill.js.map +1 -1
  474. package/dist/integrations/composite-ai/composite-summary.d.ts +2 -2
  475. package/dist/integrations/composite-ai/composite-summary.js +5 -5
  476. package/dist/integrations/composite-ai/composite-summary.js.map +1 -1
  477. package/dist/integrations/composite-ai/derive.d.ts +17 -17
  478. package/dist/integrations/composite-ai/derive.js +27 -26
  479. package/dist/integrations/composite-ai/derive.js.map +1 -1
  480. package/dist/integrations/composite-ai/index.d.ts +14 -15
  481. package/dist/integrations/composite-ai/index.js +98 -77
  482. package/dist/integrations/composite-ai/index.js.map +1 -1
  483. package/dist/integrations/composite-ai/outline-sanitize.d.ts +1 -1
  484. package/dist/integrations/composite-ai/outline-sanitize.js +1 -1
  485. package/dist/integrations/composite-ai/outline-sanitize.js.map +1 -1
  486. package/dist/integrations/composite-ai/rendition.d.ts +9 -9
  487. package/dist/integrations/composite-ai/rendition.js +27 -27
  488. package/dist/integrations/composite-ai/rendition.js.map +1 -1
  489. package/dist/integrations/composite-ai/split.d.ts +8 -8
  490. package/dist/integrations/composite-ai/split.js +12 -12
  491. package/dist/integrations/composite-ai/split.js.map +1 -1
  492. package/dist/integrations/composite-ai/transfer-transforms.d.ts +2 -2
  493. package/dist/integrations/composite-ai/transfer-transforms.js +12 -12
  494. package/dist/integrations/composite-ai/transfer-transforms.js.map +1 -1
  495. package/dist/integrations/composite-media/index.d.ts +4 -3
  496. package/dist/integrations/composite-media/index.js +20 -14
  497. package/dist/integrations/composite-media/index.js.map +1 -1
  498. package/dist/markdown/MarkdownSurface.vue.d.ts +7 -7
  499. package/dist/markdown/document.js +1 -1
  500. package/dist/markdown/document.js.map +1 -1
  501. package/dist/nuxt/module.d.ts +30 -24
  502. package/dist/nuxt/module.js.map +1 -1
  503. package/dist/nuxt/runtime/server/plugins/editor-server.js +3 -2
  504. package/dist/nuxt/runtime/server/plugins/editor-server.js.map +1 -1
  505. package/dist/presets/compose.d.ts +6 -6
  506. package/dist/presets/compose.js +8 -5
  507. package/dist/presets/compose.js.map +1 -1
  508. package/dist/react/AdvancedEditor.d.ts +2 -2
  509. package/dist/react/AdvancedEditor.js +1 -1
  510. package/dist/react/AdvancedEditor.js.map +1 -1
  511. package/dist/react/compose.d.ts +1 -1
  512. package/dist/react/compose.js +2 -2
  513. package/dist/react/compose.js.map +1 -1
  514. package/dist/react/composed-surface.d.ts +5 -5
  515. package/dist/react/composed-surface.js +2 -2
  516. package/dist/react/composed-surface.js.map +1 -1
  517. package/dist/server/ai.d.ts +7 -7
  518. package/dist/server/ai.js +1 -1
  519. package/dist/server/ai.js.map +1 -1
  520. package/dist/server/auth.d.ts +1 -1
  521. package/dist/server/collab-state.d.ts +1 -1
  522. package/dist/server/collab-state.js.map +1 -1
  523. package/dist/server/collab.d.ts +4 -4
  524. package/dist/server/collab.js +22 -17
  525. package/dist/server/collab.js.map +1 -1
  526. package/dist/server/handlers/ai.d.ts +9 -6
  527. package/dist/server/handlers/ai.js +13 -17
  528. package/dist/server/handlers/ai.js.map +1 -1
  529. package/dist/server/handlers/context.d.ts +4 -0
  530. package/dist/server/handlers/context.js.map +1 -1
  531. package/dist/server/handlers/editor.d.ts +33 -32
  532. package/dist/server/handlers/editor.js +13 -8
  533. package/dist/server/handlers/editor.js.map +1 -1
  534. package/dist/server/handlers/images.d.ts +1 -1
  535. package/dist/server/handlers/images.js +1 -1
  536. package/dist/server/handlers/images.js.map +1 -1
  537. package/dist/server/host.d.ts +4 -0
  538. package/dist/server/host.js +10 -2
  539. package/dist/server/host.js.map +1 -1
  540. package/dist/server/index.d.ts +3 -3
  541. package/dist/server/ports.d.ts +8 -8
  542. package/dist/server/ports.js.map +1 -1
  543. package/dist/settings/index.d.ts +20 -19
  544. package/dist/settings/index.js +25 -24
  545. package/dist/settings/index.js.map +1 -1
  546. package/dist/settings/migrate.d.ts +18 -0
  547. package/dist/settings/migrate.js +46 -0
  548. package/dist/settings/migrate.js.map +1 -0
  549. package/dist/settings/values.d.ts +12 -12
  550. package/dist/settings/values.js +11 -11
  551. package/dist/settings/values.js.map +1 -1
  552. package/dist/styles/composites.css +10 -10
  553. package/dist/tree/DocumentTree.js +12 -5
  554. package/dist/tree/DocumentTree.js.map +1 -1
  555. package/dist/tree/drop-rules.js +5 -5
  556. package/dist/tree/drop-rules.js.map +1 -1
  557. package/dist/tree/react/DocumentTree.js +14 -5
  558. package/dist/tree/react/DocumentTree.js.map +1 -1
  559. package/dist/tree/tree-host.js +6 -6
  560. package/dist/tree/tree-host.js.map +1 -1
  561. package/dist/tree/tree-items.js +34 -28
  562. package/dist/tree/tree-items.js.map +1 -1
  563. package/dist/tree/tree-model.js +16 -16
  564. package/dist/tree/tree-model.js.map +1 -1
  565. package/dist/tree/tree-rows.js +2 -2
  566. package/dist/tree/tree-rows.js.map +1 -1
  567. package/dist/tree/tree-view-model.d.ts +2 -2
  568. package/dist/tree/tree-view-model.js.map +1 -1
  569. package/dist/vue/AdvancedEditor.js +2 -2
  570. package/dist/vue/AdvancedEditor.js.map +1 -1
  571. package/dist/vue/AdvancedEditor.vue.d.ts +10 -10
  572. package/dist/vue/SimpleEditor.vue.d.ts +4 -4
  573. package/dist/vue/components/EditorSurface.vue.d.ts +4 -4
  574. package/dist/vue/compose.d.ts +1 -1
  575. package/dist/vue/compose.js +2 -2
  576. package/dist/vue/compose.js.map +1 -1
  577. package/package.json +1 -1
  578. package/dist/features/composites/derivation.d.ts +0 -62
  579. package/dist/features/composites/derivation.js +0 -102
  580. package/dist/features/composites/derivation.js.map +0 -1
  581. package/dist/features/composites/kinds.d.ts +0 -83
  582. package/dist/features/composites/kinds.js +0 -285
  583. package/dist/features/composites/kinds.js.map +0 -1
@@ -5,27 +5,26 @@ import { bulletsTransform, summaryTransform, transferRequest } from "./transfer-
5
5
  import { CompositeBodyResult, fillComposite, generateCompositeBody } from "./composite-fill.js";
6
6
  import { COMPOSITE_BODY_START, compositeSourceText, summarizeComposite } from "./composite-summary.js";
7
7
  import { RenditionOptions, canCreateRendition, canRegenerateRendition, createRendition, regenerateRendition } from "./rendition.js";
8
- import { canDeriveAfter, derivableKindsOf, deriveComposite, discardDerived, isDerivableSource, writeDerivedBody } from "./derive.js";
8
+ import { canDeriveAfter, derivableBlockTypesOf, deriveComposite, discardDerived, isDerivableSource, writeDerivedBody } from "./derive.js";
9
9
  import { canFetchBibliography, doiOf, fetchBibliography } from "./bibliography-fetch.js";
10
10
  import { OutlineEntry, OutlineHeading, applyOutline, collectHeadings, parseOutlineResponse, sanitizeOutline } from "./outline-sanitize.js";
11
11
  import { bodyUnchanged, splitByInsertedHeadings, splitCompositeWithAi } from "./split.js";
12
12
  //#region src/integrations/composite-ai/index.d.ts
13
13
  /**
14
- * AI on composites (requires `composites`, `ai`, `media`): the „Baustein füllen (KI)“ block action (on composites of
15
- * kinds with an `ai` configuration: brief + document → task `fill-block`, the result opens the diff review over the
16
- * body), the „Zusammenfassung erzeugen“ block action (streams a
17
- * summary of a composite's body into its description), the „Lesefassung erzeugen“ / „Neu erzeugen (ersetzen)“
18
- * actions of source-holding Bausteine (`ai.extract`: a rendition child with the transcript, full text or description of
19
- * the source; a recording needs the app's public AI configuration to enable transcription),
20
- * and the composite-structure form of AI results: with `composite` structure an AI result that
21
- * has a heading is inserted as a `section` composite fence, otherwise (and in flat structure) the base AI heading
22
- * is used. It is the preset's single `formatAiResult` contributor. The base AI feature and the composites feature do
23
- * not know it. Framework-free: notices go through the surface's `ctx.notify`, the model through the app's
24
- * `modelProfiles(ctx.app)`. Also „Mit KI in (Unter-)Bausteine teilen“ (block actions on composites: the model inserts
25
- * headings, the body is split at them) and „Gliederung bereinigen (KI)“ (⌘K command and block action on headings:
26
- * repairs the heading outline of the whole document).
14
+ * AI on Typed blocks (requires `composites`, `ai`, `media`): the „Block füllen (KI)“ block action (on Typed blocks of Block
15
+ * types with the `ai-brief` capability: brief + document → task `fill-block`, the result opens the diff review over the
16
+ * body), the „Zusammenfassung erzeugen (KI)“ block action (streams a summary of a Typed block's body into its description),
17
+ * the „Create readable rendition“ / „Regenerate (replace)“ actions of Typed blocks of a Block type with a Source (`ai.extract`:
18
+ * a rendition child with the transcript, full text or description of the Source; a recording needs the app's public AI
19
+ * configuration to enable transcription), „Ableiten (KI)“ (a Derived block of another Block type), the bibliography fetch,
20
+ * and the formatting of AI results in `structured` structure: an AI result that has a heading is inserted as a `section`
21
+ * Typed block fence; otherwise, and in `flat` structure, the base AI heading is used. It is the preset's single
22
+ * `formatAiResult` contributor. The base AI feature and the composites feature do not know it. Framework-free: notices go
23
+ * through the surface's `ctx.notify`, the model through the app's `modelProfiles(ctx.app)`. Also „Mit KI in Unterblöcke teilen“ /
24
+ * „Mit KI in Blöcke teilen“ (block actions on Typed blocks: the model inserts headings, the body is split at them) and
25
+ * „Gliederung bereinigen (KI)“ (⌘K command and block action on headings: repairs the heading outline of the whole document).
27
26
  */
28
27
  export declare function compositeAiFeature(): EditorFeature<never>;
29
28
  //#endregion
30
- export { COMPOSITE_BODY_START, type CompositeBodyResult, type OutlineEntry, type OutlineHeading, type RenditionOptions, applyOutline, bodyUnchanged, bulletsTransform, canCreateRendition, canDeriveAfter, canFetchBibliography, canRegenerateRendition, collectHeadings, compositeSourceText, createRendition, derivableKindsOf, deriveComposite, discardDerived, doiOf, fetchBibliography, fillComposite, generateCompositeBody, isDerivableSource, parseOutlineResponse, regenerateRendition, sanitizeOutline, splitByInsertedHeadings, splitCompositeWithAi, summarizeComposite, summaryTransform, transferRequest, writeDerivedBody };
29
+ export { COMPOSITE_BODY_START, type CompositeBodyResult, type OutlineEntry, type OutlineHeading, type RenditionOptions, applyOutline, bodyUnchanged, bulletsTransform, canCreateRendition, canDeriveAfter, canFetchBibliography, canRegenerateRendition, collectHeadings, compositeSourceText, createRendition, derivableBlockTypesOf, deriveComposite, discardDerived, doiOf, fetchBibliography, fillComposite, generateCompositeBody, isDerivableSource, parseOutlineResponse, regenerateRendition, sanitizeOutline, splitByInsertedHeadings, splitCompositeWithAi, summarizeComposite, summaryTransform, transferRequest, writeDerivedBody };
31
30
  //# sourceMappingURL=index.d.ts.map
@@ -1,12 +1,10 @@
1
1
  import { withHeading } from "../../features/ai/protocol/tasks.js";
2
2
  import { ABILITY } from "../../core/schema/abilities.js";
3
- import { compositeKind } from "../../features/composites/kinds.js";
4
3
  import { compositeFence } from "../../features/composites/fences.js";
5
- import { compositeKindsOf } from "../../features/composites/nodes.js";
6
4
  import { modelProfiles } from "../../features/ai/model-profiles.js";
7
5
  import { structureOf } from "../../features/composites/structure.js";
8
6
  import { fillComposite, generateCompositeBody } from "./composite-fill.js";
9
- import { canDeriveAfter, derivableKindsOf, deriveComposite, discardDerived, isDerivableSource, writeDerivedBody } from "./derive.js";
7
+ import { canDeriveAfter, derivableBlockTypesOf, deriveComposite, discardDerived, isDerivableSource, writeDerivedBody } from "./derive.js";
10
8
  import { canFetchBibliography, doiOf, fetchBibliography } from "./bibliography-fetch.js";
11
9
  import { COMPOSITE_BODY_START, compositeSourceText, summarizeComposite } from "./composite-summary.js";
12
10
  import { canCreateRendition, canRegenerateRendition, createRendition, regenerateRendition } from "./rendition.js";
@@ -27,109 +25,132 @@ function bibliographyFetchExtensions(ctx) {
27
25
  } })
28
26
  })];
29
27
  }
30
- function compositeAiActions(ctx) {
31
- const ai = ctx.backend.ai;
32
- if (!ai) return [];
28
+ /** Runs `fn` with the AI backend; nothing to run without it (`composeEditor` omits the integration in that case, `available` hides the method). */
29
+ const withAi = (fn) => (ctx) => {
30
+ const ai = ctx.ctx.backend.ai;
31
+ if (ai) fn(ctx, ai);
32
+ };
33
+ const hasAi = ({ ctx }) => !!ctx.backend.ai;
34
+ /**
35
+ * The derive methods of this integration: AI fill (`ai:<type>` content for a Typed block of a Block type with a brief), summary,
36
+ * AI derivation into another Block type, bibliography fetch, and the rendition of a source (transcription, text extraction, description)
37
+ * with its regeneration. Each declares the capability the original needs; the block actions of the same ids are generated from them.
38
+ */
39
+ function compositeAiDeriveMethods() {
33
40
  return [
34
41
  {
35
42
  id: "composite-fill",
36
- label: ctx.t("integrations.compositeFill.action"),
43
+ label: (ctx) => ctx.t("integrations.compositeFill.action"),
37
44
  icon: "i-lucide-wand-sparkles",
38
45
  ability: ABILITY.aiGenerate,
39
46
  order: 25,
40
- isVisible: ({ editor, node }) => node.type.name === "composite" && compositeKind(compositeKindsOf(editor), String(node.attrs.kind)).ai !== void 0,
41
- run: ({ editor, pos }) => {
47
+ requires: ["ai-brief"],
48
+ available: hasAi,
49
+ run: withAi(({ editor, pos, ctx }, ai) => {
42
50
  fillComposite(editor, pos, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t);
43
- }
51
+ })
44
52
  },
45
53
  {
46
54
  id: "composite-summarize",
47
- label: ctx.t("integrations.compositeSummary.action"),
55
+ label: (ctx) => ctx.t("integrations.compositeSummary.action"),
48
56
  icon: "i-lucide-text-quote",
49
57
  ability: ABILITY.compositeSummarize,
50
58
  order: 30,
51
- isVisible: ({ node }) => compositeSourceText(node).trim().length > 0,
52
- run: ({ editor, pos }) => {
59
+ requires: ["container", "title"],
60
+ available: (ctx) => hasAi(ctx) && compositeSourceText(ctx.node).trim().length > 0,
61
+ run: withAi(({ editor, pos, ctx }, ai) => {
53
62
  summarizeComposite(editor, pos, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t);
54
- }
63
+ })
55
64
  },
56
65
  {
57
66
  id: "composite-derive",
58
- label: ctx.t("integrations.compositeDerive.action"),
67
+ label: (ctx) => ctx.t("integrations.compositeDerive.action"),
59
68
  icon: "i-lucide-git-branch",
60
69
  ability: ABILITY.compositeDerive,
61
70
  order: 452,
62
- isVisible: ({ editor, node }) => isDerivableSource(editor, node),
63
- menu: ({ editor, pos }) => derivableKindsOf(editor).map((kind) => ({
64
- label: kind.label,
65
- icon: kind.icon,
66
- disabled: !canDeriveAfter(editor, pos, kind.id),
67
- onSelect: () => {
68
- deriveComposite(editor, pos, kind.id, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t);
69
- }
70
- }))
71
+ requires: ["container", "title"],
72
+ available: (ctx) => hasAi(ctx) && isDerivableSource(ctx.editor, ctx.node),
73
+ menu: ({ editor, pos, ctx }) => {
74
+ const ai = ctx.backend.ai;
75
+ if (!ai) return [];
76
+ return derivableBlockTypesOf(editor).map((kind) => ({
77
+ label: kind.label,
78
+ icon: kind.icon,
79
+ disabled: !canDeriveAfter(editor, pos, kind.id),
80
+ onSelect: () => {
81
+ deriveComposite(editor, pos, kind.id, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t);
82
+ }
83
+ }));
84
+ }
71
85
  },
72
86
  {
73
87
  id: "bibliography-fetch",
74
- label: ctx.t("integrations.bibliographyFetch.action"),
88
+ label: (ctx) => ctx.t("integrations.bibliographyFetch.action"),
75
89
  icon: "i-lucide-book-marked",
76
90
  ability: ABILITY.compositeDerive,
77
91
  order: 453,
78
- isVisible: ({ editor, node }) => canFetchBibliography(editor, node),
79
- run: ({ editor, pos }) => {
92
+ requires: ["bibliography"],
93
+ available: (ctx) => hasAi(ctx) && canFetchBibliography(ctx.editor, ctx.node),
94
+ run: withAi(({ editor, pos, ctx }, ai) => {
80
95
  fetchBibliography(editor, pos, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t, ctx.documentId);
81
- }
96
+ })
82
97
  },
83
98
  {
84
99
  id: "rendition-create",
85
- label: ctx.t("integrations.rendition.action"),
100
+ label: (ctx) => ctx.t("integrations.rendition.action"),
86
101
  icon: "i-lucide-captions",
87
102
  ability: ABILITY.compositeDerive,
88
103
  order: 450,
89
- isVisible: ({ editor, node }) => canCreateRendition(editor, node, !!ctx.ai?.transcription),
90
- run: ({ editor, pos }) => {
104
+ requires: ["source"],
105
+ available: (ctx) => hasAi(ctx) && canCreateRendition(ctx.editor, ctx.node, !!ctx.ctx.ai?.transcription),
106
+ run: withAi(({ editor, pos, ctx }, ai) => {
91
107
  createRendition(editor, pos, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t);
92
- }
108
+ })
93
109
  },
94
110
  {
95
111
  id: "rendition-regenerate",
96
- label: ctx.t("integrations.rendition.regenerate"),
112
+ label: (ctx) => ctx.t("integrations.rendition.regenerate"),
97
113
  icon: "i-lucide-refresh-cw",
98
114
  ability: ABILITY.compositeDerive,
99
115
  order: 451,
100
- isVisible: ({ editor, node, pos }) => canRegenerateRendition(editor, node, pos, !!ctx.ai?.transcription),
101
- run: ({ editor, pos }) => {
116
+ requires: ["derived"],
117
+ available: (ctx) => hasAi(ctx) && canRegenerateRendition(ctx.editor, ctx.node, ctx.pos, !!ctx.ctx.ai?.transcription),
118
+ run: withAi(({ editor, pos, ctx }, ai) => {
102
119
  regenerateRendition(editor, pos, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t);
103
- }
104
- },
105
- ...["children", "siblings"].map((mode) => ({
106
- id: `composite-split-ai-${mode}`,
107
- label: ctx.t(`integrations.compositeSplit.ai.${mode}`),
108
- icon: "i-lucide-sparkles",
109
- ability: ABILITY.aiGenerate,
110
- order: mode === "children" ? 454 : 455,
111
- isVisible: ({ node }) => node.type.name === "composite" && compositeSourceText(node).trim().length > 0,
112
- run: ({ editor, pos }) => {
113
- const { blocks } = ctx.settings.get();
114
- splitCompositeWithAi(editor, pos, mode, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t, {
115
- targetChars: blocks.splitTargetChars,
116
- defaultKind: blocks.defaultKind
117
- });
118
- }
119
- })),
120
- {
121
- id: "outline-sanitize",
122
- label: ctx.t("integrations.outlineSanitize.label"),
123
- icon: "i-lucide-list-tree",
124
- ability: ABILITY.aiGenerate,
125
- order: 456,
126
- isVisible: ({ node }) => node.type.name === "heading",
127
- run: ({ editor }) => {
128
- sanitizeOutline(editor, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t);
129
- }
120
+ })
130
121
  }
131
122
  ];
132
123
  }
124
+ function compositeAiActions(ctx) {
125
+ const ai = ctx.backend.ai;
126
+ if (!ai) return [];
127
+ return [...["children", "siblings"].map((mode) => ({
128
+ id: `composite-split-ai-${mode}`,
129
+ label: ctx.t(`integrations.compositeSplit.ai.${mode}`),
130
+ icon: "i-lucide-sparkles",
131
+ ability: ABILITY.aiGenerate,
132
+ order: mode === "children" ? 454 : 455,
133
+ requires: ["container", "title"],
134
+ isVisible: ({ node }) => compositeSourceText(node).trim().length > 0,
135
+ run: ({ editor, pos }) => {
136
+ const { blocks } = ctx.settings.get();
137
+ splitCompositeWithAi(editor, pos, mode, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t, {
138
+ targetChars: blocks.splitTargetChars,
139
+ defaultBlockType: blocks.defaultBlockType
140
+ });
141
+ }
142
+ })), {
143
+ id: "outline-sanitize",
144
+ label: ctx.t("integrations.outlineSanitize.label"),
145
+ icon: "i-lucide-list-tree",
146
+ ability: ABILITY.aiGenerate,
147
+ order: 456,
148
+ isVisible: ({ node }) => node.type.name === "heading",
149
+ run: ({ editor }) => {
150
+ sanitizeOutline(editor, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t);
151
+ }
152
+ }];
153
+ }
133
154
  /** The ⌘K entry „Gliederung bereinigen (KI)“ (no toolbar button); absent without the AI capability. */
134
155
  function compositeAiCommands(ctx) {
135
156
  const ai = ctx.backend.ai;
@@ -145,19 +166,18 @@ function compositeAiCommands(ctx) {
145
166
  }];
146
167
  }
147
168
  /**
148
- * AI on composites (requires `composites`, `ai`, `media`): the „Baustein füllen (KI)“ block action (on composites of
149
- * kinds with an `ai` configuration: brief + document → task `fill-block`, the result opens the diff review over the
150
- * body), the „Zusammenfassung erzeugen“ block action (streams a
151
- * summary of a composite's body into its description), the „Lesefassung erzeugen“ / „Neu erzeugen (ersetzen)“
152
- * actions of source-holding Bausteine (`ai.extract`: a rendition child with the transcript, full text or description of
153
- * the source; a recording needs the app's public AI configuration to enable transcription),
154
- * and the composite-structure form of AI results: with `composite` structure an AI result that
155
- * has a heading is inserted as a `section` composite fence, otherwise (and in flat structure) the base AI heading
156
- * is used. It is the preset's single `formatAiResult` contributor. The base AI feature and the composites feature do
157
- * not know it. Framework-free: notices go through the surface's `ctx.notify`, the model through the app's
158
- * `modelProfiles(ctx.app)`. Also „Mit KI in (Unter-)Bausteine teilen“ (block actions on composites: the model inserts
159
- * headings, the body is split at them) and „Gliederung bereinigen (KI)“ (⌘K command and block action on headings:
160
- * repairs the heading outline of the whole document).
169
+ * AI on Typed blocks (requires `composites`, `ai`, `media`): the „Block füllen (KI)“ block action (on Typed blocks of Block
170
+ * types with the `ai-brief` capability: brief + document → task `fill-block`, the result opens the diff review over the
171
+ * body), the „Zusammenfassung erzeugen (KI)“ block action (streams a summary of a Typed block's body into its description),
172
+ * the „Create readable rendition“ / „Regenerate (replace)“ actions of Typed blocks of a Block type with a Source (`ai.extract`:
173
+ * a rendition child with the transcript, full text or description of the Source; a recording needs the app's public AI
174
+ * configuration to enable transcription), „Ableiten (KI)“ (a Derived block of another Block type), the bibliography fetch,
175
+ * and the formatting of AI results in `structured` structure: an AI result that has a heading is inserted as a `section`
176
+ * Typed block fence; otherwise, and in `flat` structure, the base AI heading is used. It is the preset's single
177
+ * `formatAiResult` contributor. The base AI feature and the composites feature do not know it. Framework-free: notices go
178
+ * through the surface's `ctx.notify`, the model through the app's `modelProfiles(ctx.app)`. Also „Mit KI in Unterblöcke teilen“ /
179
+ * „Mit KI in Blöcke teilen“ (block actions on Typed blocks: the model inserts headings, the body is split at them) and
180
+ * „Gliederung bereinigen (KI)“ (⌘K command and block action on headings: repairs the heading outline of the whole document).
161
181
  */
162
182
  function compositeAiFeature() {
163
183
  return {
@@ -169,16 +189,17 @@ function compositeAiFeature() {
169
189
  "media"
170
190
  ],
171
191
  blockActions: compositeAiActions,
192
+ deriveMethods: compositeAiDeriveMethods(),
172
193
  extensions: bibliographyFetchExtensions,
173
194
  commands: compositeAiCommands,
174
195
  formatAiResult: (editor, markdown, heading) => {
175
196
  if (!heading) return markdown;
176
197
  const text = withHeading(heading, markdown);
177
- return structureOf(editor) === "composite" ? compositeFence("section", {}, text) : text;
198
+ return structureOf(editor) === "structured" ? compositeFence("section", {}, text) : text;
178
199
  }
179
200
  };
180
201
  }
181
202
  //#endregion
182
- export { COMPOSITE_BODY_START, applyOutline, bodyUnchanged, bulletsTransform, canCreateRendition, canDeriveAfter, canFetchBibliography, canRegenerateRendition, collectHeadings, compositeAiFeature, compositeSourceText, createRendition, derivableKindsOf, deriveComposite, discardDerived, doiOf, fetchBibliography, fillComposite, generateCompositeBody, isDerivableSource, parseOutlineResponse, regenerateRendition, sanitizeOutline, splitByInsertedHeadings, splitCompositeWithAi, summarizeComposite, summaryTransform, transferRequest, writeDerivedBody };
203
+ export { COMPOSITE_BODY_START, applyOutline, bodyUnchanged, bulletsTransform, canCreateRendition, canDeriveAfter, canFetchBibliography, canRegenerateRendition, collectHeadings, compositeAiFeature, compositeSourceText, createRendition, derivableBlockTypesOf, deriveComposite, discardDerived, doiOf, fetchBibliography, fillComposite, generateCompositeBody, isDerivableSource, parseOutlineResponse, regenerateRendition, sanitizeOutline, splitByInsertedHeadings, splitCompositeWithAi, summarizeComposite, summaryTransform, transferRequest, writeDerivedBody };
183
204
 
184
205
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/integrations/composite-ai/index.ts"],"sourcesContent":["import { type AnyExtension, Extension } from '@tiptap/core'\nimport type { BlockAction, CommandDef, EditorFeature, FeatureContext } from '../../core'\nimport { ABILITY } from '../../core/schema'\nimport { modelProfiles, withHeading } from '../../features/ai'\nimport { structureOf } from '../../features/composites'\nimport '../../features/composites/bibliography-command'\nimport { compositeFence, compositeKind, compositeKindsOf } from '../../features/composites/schema'\nimport { fillComposite } from './composite-fill'\nimport { canDeriveAfter, derivableKindsOf, deriveComposite, isDerivableSource } from './derive'\nimport { canFetchBibliography, fetchBibliography } from './bibliography-fetch'\nimport { compositeSourceText, summarizeComposite } from './composite-summary'\nimport { canCreateRendition, canRegenerateRendition, createRendition, regenerateRendition } from './rendition'\nimport { sanitizeOutline } from './outline-sanitize'\nimport { splitCompositeWithAi } from './split'\n\nexport { bulletsTransform, summaryTransform, transferRequest } from './transfer-transforms'\n\nexport { type CompositeBodyResult, fillComposite, generateCompositeBody } from './composite-fill'\nexport { COMPOSITE_BODY_START, compositeSourceText, summarizeComposite } from './composite-summary'\nexport { canCreateRendition, canRegenerateRendition, createRendition, regenerateRendition, type RenditionOptions } from './rendition'\nexport { canDeriveAfter, derivableKindsOf, deriveComposite, discardDerived, isDerivableSource, writeDerivedBody } from './derive'\nexport { canFetchBibliography, doiOf, fetchBibliography } from './bibliography-fetch'\nexport { applyOutline, collectHeadings, type OutlineEntry, type OutlineHeading, parseOutlineResponse, sanitizeOutline } from './outline-sanitize'\nexport { bodyUnchanged, splitByInsertedHeadings, splitCompositeWithAi } from './split'\n\n/** The editor command `fetchCompositeBibliography` (declared by composites) behind the bibliography editor's „DOI abrufen“ button; absent without the AI capability. */\nfunction bibliographyFetchExtensions(ctx: FeatureContext): AnyExtension[] {\n const ai = ctx.backend.ai\n if (!ai) return []\n return [Extension.create({\n name: 'compositeBibliographyFetch',\n addCommands: () => ({\n fetchCompositeBibliography: (pos: number) => ({ editor }) => {\n void fetchBibliography(editor, pos, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t, ctx.documentId)\n return true\n },\n }),\n })]\n}\n\nfunction compositeAiActions(ctx: FeatureContext): BlockAction[] {\n const ai = ctx.backend.ai\n // Without the AI capability there is nothing to run (`composeEditor` omits the integration in that case).\n if (!ai) return []\n return [\n {\n id: 'composite-fill',\n label: ctx.t('integrations.compositeFill.action'),\n icon: 'i-lucide-wand-sparkles',\n ability: ABILITY.aiGenerate,\n order: 25,\n isVisible: ({ editor, node }) => node.type.name === 'composite' && compositeKind(compositeKindsOf(editor), String(node.attrs.kind)).ai !== undefined,\n run: ({ editor, pos }) => {\n void fillComposite(editor, pos, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t)\n },\n },\n {\n id: 'composite-summarize',\n label: ctx.t('integrations.compositeSummary.action'),\n icon: 'i-lucide-text-quote',\n ability: ABILITY.compositeSummarize,\n order: 30,\n isVisible: ({ node }) => compositeSourceText(node).trim().length > 0,\n run: ({ editor, pos }) => {\n void summarizeComposite(editor, pos, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t)\n },\n },\n {\n id: 'composite-derive',\n label: ctx.t('integrations.compositeDerive.action'),\n icon: 'i-lucide-git-branch',\n ability: ABILITY.compositeDerive,\n order: 452,\n isVisible: ({ editor, node }) => isDerivableSource(editor, node),\n menu: ({ editor, pos }) => derivableKindsOf(editor).map(kind => ({\n label: kind.label,\n icon: kind.icon,\n disabled: !canDeriveAfter(editor, pos, kind.id),\n onSelect: () => {\n void deriveComposite(editor, pos, kind.id, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t)\n },\n })),\n },\n {\n id: 'bibliography-fetch',\n label: ctx.t('integrations.bibliographyFetch.action'),\n icon: 'i-lucide-book-marked',\n ability: ABILITY.compositeDerive,\n order: 453,\n isVisible: ({ editor, node }) => canFetchBibliography(editor, node),\n run: ({ editor, pos }) => {\n void fetchBibliography(editor, pos, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t, ctx.documentId)\n },\n },\n {\n id: 'rendition-create',\n label: ctx.t('integrations.rendition.action'),\n icon: 'i-lucide-captions',\n ability: ABILITY.compositeDerive,\n order: 450,\n isVisible: ({ editor, node }) => canCreateRendition(editor, node, !!ctx.ai?.transcription),\n run: ({ editor, pos }) => {\n void createRendition(editor, pos, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t)\n },\n },\n {\n id: 'rendition-regenerate',\n label: ctx.t('integrations.rendition.regenerate'),\n icon: 'i-lucide-refresh-cw',\n ability: ABILITY.compositeDerive,\n order: 451,\n isVisible: ({ editor, node, pos }) => canRegenerateRendition(editor, node, pos, !!ctx.ai?.transcription),\n run: ({ editor, pos }) => {\n regenerateRendition(editor, pos, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t)\n },\n },\n ...(['children', 'siblings'] as const).map((mode): BlockAction => ({\n id: `composite-split-ai-${mode}`,\n label: ctx.t(`integrations.compositeSplit.ai.${mode}`),\n icon: 'i-lucide-sparkles',\n ability: ABILITY.aiGenerate,\n order: mode === 'children' ? 454 : 455,\n isVisible: ({ node }) => node.type.name === 'composite' && compositeSourceText(node).trim().length > 0,\n run: ({ editor, pos }) => {\n const { blocks } = ctx.settings.get()\n void splitCompositeWithAi(editor, pos, mode, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t, { targetChars: blocks.splitTargetChars, defaultKind: blocks.defaultKind })\n },\n })),\n {\n id: 'outline-sanitize',\n label: ctx.t('integrations.outlineSanitize.label'),\n icon: 'i-lucide-list-tree',\n ability: ABILITY.aiGenerate,\n order: 456,\n isVisible: ({ node }) => node.type.name === 'heading',\n run: ({ editor }) => {\n void sanitizeOutline(editor, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t)\n },\n },\n ]\n}\n\n/** The ⌘K entry „Gliederung bereinigen (KI)“ (no toolbar button); absent without the AI capability. */\nfunction compositeAiCommands(ctx: FeatureContext): CommandDef<never>[] {\n const ai = ctx.backend.ai\n if (!ai) return []\n return [{\n id: 'outline-sanitize',\n label: ctx.t('integrations.outlineSanitize.label'),\n icon: 'i-lucide-list-tree',\n toolbar: false,\n run: (editor) => {\n void sanitizeOutline(editor, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t)\n },\n }]\n}\n\n/**\n * AI on composites (requires `composites`, `ai`, `media`): the „Baustein füllen (KI)“ block action (on composites of\n * kinds with an `ai` configuration: brief + document → task `fill-block`, the result opens the diff review over the\n * body), the „Zusammenfassung erzeugen“ block action (streams a\n * summary of a composite's body into its description), the „Lesefassung erzeugen“ / „Neu erzeugen (ersetzen)“\n * actions of source-holding Bausteine (`ai.extract`: a rendition child with the transcript, full text or description of\n * the source; a recording needs the app's public AI configuration to enable transcription),\n * and the composite-structure form of AI results: with `composite` structure an AI result that\n * has a heading is inserted as a `section` composite fence, otherwise (and in flat structure) the base AI heading\n * is used. It is the preset's single `formatAiResult` contributor. The base AI feature and the composites feature do\n * not know it. Framework-free: notices go through the surface's `ctx.notify`, the model through the app's\n * `modelProfiles(ctx.app)`. Also „Mit KI in (Unter-)Bausteine teilen“ (block actions on composites: the model inserts\n * headings, the body is split at them) and „Gliederung bereinigen (KI)“ (⌘K command and block action on headings:\n * repairs the heading outline of the whole document).\n */\nexport function compositeAiFeature(): EditorFeature<never> {\n return {\n id: 'composite-ai',\n dimension: 'ai',\n requires: ['composites', 'ai', 'media'],\n blockActions: compositeAiActions,\n extensions: bibliographyFetchExtensions,\n commands: compositeAiCommands,\n formatAiResult: (editor, markdown, heading) => {\n if (!heading) return markdown\n const text = withHeading(heading, markdown)\n return structureOf(editor) === 'composite' ? compositeFence('section', {}, text) : text\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0BA,SAAS,4BAA4B,KAAqC;CACxE,MAAM,KAAK,IAAI,QAAQ;CACvB,IAAI,CAAC,IAAI,OAAO,CAAC;CACjB,OAAO,CAAC,UAAU,OAAO;EACvB,MAAM;EACN,oBAAoB,EAClB,6BAA6B,SAAiB,EAAE,aAAa;GAC3D,kBAAuB,QAAQ,KAAK,IAAI,cAAc,IAAI,GAAG,CAAC,CAAC,UAAU,IAAI,QAAQ,IAAI,GAAG,IAAI,UAAU;GAC1G,OAAO;EACT,EACF;CACF,CAAC,CAAC;AACJ;AAEA,SAAS,mBAAmB,KAAoC;CAC9D,MAAM,KAAK,IAAI,QAAQ;CAEvB,IAAI,CAAC,IAAI,OAAO,CAAC;CACjB,OAAO;EACL;GACE,IAAI;GACJ,OAAO,IAAI,EAAE,mCAAmC;GAChD,MAAM;GACN,SAAS,QAAQ;GACjB,OAAO;GACP,YAAY,EAAE,QAAQ,WAAW,KAAK,KAAK,SAAS,eAAe,cAAc,iBAAiB,MAAM,GAAG,OAAO,KAAK,MAAM,IAAI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,KAAK,KAAK,SAAS;GAC5C,MAAM,EAAE,aAAa;IACnB,gBAAqB,QAAQ,IAAI,cAAc,IAAI,GAAG,CAAC,CAAC,UAAU,IAAI,QAAQ,IAAI,CAAC;GACrF;EACF;CACF;AACF;;AAGA,SAAS,oBAAoB,KAA0C;CACrE,MAAM,KAAK,IAAI,QAAQ;CACvB,IAAI,CAAC,IAAI,OAAO,CAAC;CACjB,OAAO,CAAC;EACN,IAAI;EACJ,OAAO,IAAI,EAAE,oCAAoC;EACjD,MAAM;EACN,SAAS;EACT,MAAM,WAAW;GACf,gBAAqB,QAAQ,IAAI,cAAc,IAAI,GAAG,CAAC,CAAC,UAAU,IAAI,QAAQ,IAAI,CAAC;EACrF;CACF,CAAC;AACH;;;;;;;;;;;;;;;;AAiBA,SAAgB,qBAA2C;CACzD,OAAO;EACL,IAAI;EACJ,WAAW;EACX,UAAU;GAAC;GAAc;GAAM;EAAO;EACtC,cAAc;EACd,YAAY;EACZ,UAAU;EACV,iBAAiB,QAAQ,UAAU,YAAY;GAC7C,IAAI,CAAC,SAAS,OAAO;GACrB,MAAM,OAAO,YAAY,SAAS,QAAQ;GAC1C,OAAO,YAAY,MAAM,MAAM,cAAc,eAAe,WAAW,CAAC,GAAG,IAAI,IAAI;EACrF;CACF;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/integrations/composite-ai/index.ts"],"sourcesContent":["import { type AnyExtension, Extension } from '@tiptap/core'\nimport type { BlockAction, CommandDef, DeriveContext, DeriveMethod, EditorBackend, EditorFeature, FeatureContext } from '../../core'\nimport { ABILITY } from '../../core/schema'\nimport { modelProfiles, withHeading } from '../../features/ai'\nimport { structureOf } from '../../features/composites'\nimport '../../features/composites/bibliography-command'\nimport { compositeFence } from '../../features/composites/schema'\nimport { fillComposite } from './composite-fill'\nimport { canDeriveAfter, derivableBlockTypesOf, deriveComposite, isDerivableSource } from './derive'\nimport { canFetchBibliography, fetchBibliography } from './bibliography-fetch'\nimport { compositeSourceText, summarizeComposite } from './composite-summary'\nimport { canCreateRendition, canRegenerateRendition, createRendition, regenerateRendition } from './rendition'\nimport { sanitizeOutline } from './outline-sanitize'\nimport { splitCompositeWithAi } from './split'\n\nexport { bulletsTransform, summaryTransform, transferRequest } from './transfer-transforms'\n\nexport { type CompositeBodyResult, fillComposite, generateCompositeBody } from './composite-fill'\nexport { COMPOSITE_BODY_START, compositeSourceText, summarizeComposite } from './composite-summary'\nexport { canCreateRendition, canRegenerateRendition, createRendition, regenerateRendition, type RenditionOptions } from './rendition'\nexport { canDeriveAfter, derivableBlockTypesOf, deriveComposite, discardDerived, isDerivableSource, writeDerivedBody } from './derive'\nexport { canFetchBibliography, doiOf, fetchBibliography } from './bibliography-fetch'\nexport { applyOutline, collectHeadings, type OutlineEntry, type OutlineHeading, parseOutlineResponse, sanitizeOutline } from './outline-sanitize'\nexport { bodyUnchanged, splitByInsertedHeadings, splitCompositeWithAi } from './split'\n\n/** The editor command `fetchCompositeBibliography` (declared by composites) behind the bibliography editor's „DOI abrufen“ button; absent without the AI capability. */\nfunction bibliographyFetchExtensions(ctx: FeatureContext): AnyExtension[] {\n const ai = ctx.backend.ai\n if (!ai) return []\n return [Extension.create({\n name: 'compositeBibliographyFetch',\n addCommands: () => ({\n fetchCompositeBibliography: (pos: number) => ({ editor }) => {\n void fetchBibliography(editor, pos, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t, ctx.documentId)\n return true\n },\n }),\n })]\n}\n\n/** Runs `fn` with the AI backend; nothing to run without it (`composeEditor` omits the integration in that case, `available` hides the method). */\nconst withAi = (fn: (ctx: DeriveContext, ai: NonNullable<EditorBackend['ai']>) => void) => (ctx: DeriveContext): void => {\n const ai = ctx.ctx.backend.ai\n if (ai) fn(ctx, ai)\n}\n\nconst hasAi = ({ ctx }: DeriveContext): boolean => !!ctx.backend.ai\n\n/**\n * The derive methods of this integration: AI fill (`ai:<type>` content for a Typed block of a Block type with a brief), summary,\n * AI derivation into another Block type, bibliography fetch, and the rendition of a source (transcription, text extraction, description)\n * with its regeneration. Each declares the capability the original needs; the block actions of the same ids are generated from them.\n */\nfunction compositeAiDeriveMethods(): DeriveMethod[] {\n return [\n {\n id: 'composite-fill',\n label: ctx => ctx.t('integrations.compositeFill.action'),\n icon: 'i-lucide-wand-sparkles',\n ability: ABILITY.aiGenerate,\n order: 25,\n requires: ['ai-brief'],\n available: hasAi,\n run: withAi(({ editor, pos, ctx }, ai) => {\n void fillComposite(editor, pos, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t)\n }),\n },\n {\n id: 'composite-summarize',\n label: ctx => ctx.t('integrations.compositeSummary.action'),\n icon: 'i-lucide-text-quote',\n ability: ABILITY.compositeSummarize,\n order: 30,\n requires: ['container', 'title'],\n available: ctx => hasAi(ctx) && compositeSourceText(ctx.node).trim().length > 0,\n run: withAi(({ editor, pos, ctx }, ai) => {\n void summarizeComposite(editor, pos, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t)\n }),\n },\n {\n id: 'composite-derive',\n label: ctx => ctx.t('integrations.compositeDerive.action'),\n icon: 'i-lucide-git-branch',\n ability: ABILITY.compositeDerive,\n order: 452,\n requires: ['container', 'title'],\n available: ctx => hasAi(ctx) && isDerivableSource(ctx.editor, ctx.node),\n menu: ({ editor, pos, ctx }) => {\n const ai = ctx.backend.ai\n if (!ai) return []\n return derivableBlockTypesOf(editor).map(kind => ({\n label: kind.label,\n icon: kind.icon,\n disabled: !canDeriveAfter(editor, pos, kind.id),\n onSelect: () => {\n void deriveComposite(editor, pos, kind.id, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t)\n },\n }))\n },\n },\n {\n id: 'bibliography-fetch',\n label: ctx => ctx.t('integrations.bibliographyFetch.action'),\n icon: 'i-lucide-book-marked',\n ability: ABILITY.compositeDerive,\n order: 453,\n requires: ['bibliography'],\n available: ctx => hasAi(ctx) && canFetchBibliography(ctx.editor, ctx.node),\n run: withAi(({ editor, pos, ctx }, ai) => {\n void fetchBibliography(editor, pos, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t, ctx.documentId)\n }),\n },\n {\n id: 'rendition-create',\n label: ctx => ctx.t('integrations.rendition.action'),\n icon: 'i-lucide-captions',\n ability: ABILITY.compositeDerive,\n order: 450,\n requires: ['source'],\n available: ctx => hasAi(ctx) && canCreateRendition(ctx.editor, ctx.node, !!ctx.ctx.ai?.transcription),\n run: withAi(({ editor, pos, ctx }, ai) => {\n void createRendition(editor, pos, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t)\n }),\n },\n {\n id: 'rendition-regenerate',\n label: ctx => ctx.t('integrations.rendition.regenerate'),\n icon: 'i-lucide-refresh-cw',\n ability: ABILITY.compositeDerive,\n order: 451,\n requires: ['derived'],\n available: ctx => hasAi(ctx) && canRegenerateRendition(ctx.editor, ctx.node, ctx.pos, !!ctx.ctx.ai?.transcription),\n run: withAi(({ editor, pos, ctx }, ai) => {\n regenerateRendition(editor, pos, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t)\n }),\n },\n ]\n}\n\nfunction compositeAiActions(ctx: FeatureContext): BlockAction[] {\n const ai = ctx.backend.ai\n // Without the AI capability there is nothing to run (`composeEditor` omits the integration in that case).\n if (!ai) return []\n return [\n ...(['children', 'siblings'] as const).map((mode): BlockAction => ({\n id: `composite-split-ai-${mode}`,\n label: ctx.t(`integrations.compositeSplit.ai.${mode}`),\n icon: 'i-lucide-sparkles',\n ability: ABILITY.aiGenerate,\n order: mode === 'children' ? 454 : 455,\n requires: ['container', 'title'],\n isVisible: ({ node }) => compositeSourceText(node).trim().length > 0,\n run: ({ editor, pos }) => {\n const { blocks } = ctx.settings.get()\n void splitCompositeWithAi(editor, pos, mode, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t, { targetChars: blocks.splitTargetChars, defaultBlockType: blocks.defaultBlockType })\n },\n })),\n {\n id: 'outline-sanitize',\n label: ctx.t('integrations.outlineSanitize.label'),\n icon: 'i-lucide-list-tree',\n ability: ABILITY.aiGenerate,\n order: 456,\n isVisible: ({ node }) => node.type.name === 'heading',\n run: ({ editor }) => {\n void sanitizeOutline(editor, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t)\n },\n },\n ]\n}\n\n/** The ⌘K entry „Gliederung bereinigen (KI)“ (no toolbar button); absent without the AI capability. */\nfunction compositeAiCommands(ctx: FeatureContext): CommandDef<never>[] {\n const ai = ctx.backend.ai\n if (!ai) return []\n return [{\n id: 'outline-sanitize',\n label: ctx.t('integrations.outlineSanitize.label'),\n icon: 'i-lucide-list-tree',\n toolbar: false,\n run: (editor) => {\n void sanitizeOutline(editor, ai, modelProfiles(ctx.app).modelRef, ctx.notify, ctx.t)\n },\n }]\n}\n\n/**\n * AI on Typed blocks (requires `composites`, `ai`, `media`): the „Block füllen (KI)“ block action (on Typed blocks of Block\n * types with the `ai-brief` capability: brief + document → task `fill-block`, the result opens the diff review over the\n * body), the „Zusammenfassung erzeugen (KI)“ block action (streams a summary of a Typed block's body into its description),\n * the „Create readable rendition“ / „Regenerate (replace)“ actions of Typed blocks of a Block type with a Source (`ai.extract`:\n * a rendition child with the transcript, full text or description of the Source; a recording needs the app's public AI\n * configuration to enable transcription), „Ableiten (KI)“ (a Derived block of another Block type), the bibliography fetch,\n * and the formatting of AI results in `structured` structure: an AI result that has a heading is inserted as a `section`\n * Typed block fence; otherwise, and in `flat` structure, the base AI heading is used. It is the preset's single\n * `formatAiResult` contributor. The base AI feature and the composites feature do not know it. Framework-free: notices go\n * through the surface's `ctx.notify`, the model through the app's `modelProfiles(ctx.app)`. Also „Mit KI in Unterblöcke teilen“ /\n * „Mit KI in Blöcke teilen“ (block actions on Typed blocks: the model inserts headings, the body is split at them) and\n * „Gliederung bereinigen (KI)“ (⌘K command and block action on headings: repairs the heading outline of the whole document).\n */\nexport function compositeAiFeature(): EditorFeature<never> {\n return {\n id: 'composite-ai',\n dimension: 'ai',\n requires: ['composites', 'ai', 'media'],\n blockActions: compositeAiActions,\n deriveMethods: compositeAiDeriveMethods(),\n extensions: bibliographyFetchExtensions,\n commands: compositeAiCommands,\n formatAiResult: (editor, markdown, heading) => {\n if (!heading) return markdown\n const text = withHeading(heading, markdown)\n return structureOf(editor) === 'structured' ? compositeFence('section', {}, text) : text\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA0BA,SAAS,4BAA4B,KAAqC;CACxE,MAAM,KAAK,IAAI,QAAQ;CACvB,IAAI,CAAC,IAAI,OAAO,CAAC;CACjB,OAAO,CAAC,UAAU,OAAO;EACvB,MAAM;EACN,oBAAoB,EAClB,6BAA6B,SAAiB,EAAE,aAAa;GAC3D,kBAAuB,QAAQ,KAAK,IAAI,cAAc,IAAI,GAAG,CAAC,CAAC,UAAU,IAAI,QAAQ,IAAI,GAAG,IAAI,UAAU;GAC1G,OAAO;EACT,EACF;CACF,CAAC,CAAC;AACJ;;AAGA,MAAM,UAAU,QAA4E,QAA6B;CACvH,MAAM,KAAK,IAAI,IAAI,QAAQ;CAC3B,IAAI,IAAI,GAAG,KAAK,EAAE;AACpB;AAEA,MAAM,SAAS,EAAE,UAAkC,CAAC,CAAC,IAAI,QAAQ;;;;;;AAOjE,SAAS,2BAA2C;CAClD,OAAO;EACL;GACE,IAAI;GACJ,QAAO,QAAO,IAAI,EAAE,mCAAmC;GACvD,MAAM;GACN,SAAS,QAAQ;GACjB,OAAO;GACP,UAAU,CAAC,UAAU;GACrB,WAAW;GACX,KAAK,QAAQ,EAAE,QAAQ,KAAK,OAAO,OAAO;IACxC,cAAmB,QAAQ,KAAK,IAAI,cAAc,IAAI,GAAG,CAAC,CAAC,UAAU,IAAI,QAAQ,IAAI,CAAC;GACxF,CAAC;EACH;EACA;GACE,IAAI;GACJ,QAAO,QAAO,IAAI,EAAE,sCAAsC;GAC1D,MAAM;GACN,SAAS,QAAQ;GACjB,OAAO;GACP,UAAU,CAAC,aAAa,OAAO;GAC/B,YAAW,QAAO,MAAM,GAAG,KAAK,oBAAoB,IAAI,IAAI,CAAC,C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,CAAC,CAAC,UAAU,IAAI,QAAQ,IAAI,GAAG;IAAE,aAAa,OAAO;IAAkB,kBAAkB,OAAO;GAAiB,CAAC;EAC1L;CACF,EAAE,GACF;EACE,IAAI;EACJ,OAAO,IAAI,EAAE,oCAAoC;EACjD,MAAM;EACN,SAAS,QAAQ;EACjB,OAAO;EACP,YAAY,EAAE,WAAW,KAAK,KAAK,SAAS;EAC5C,MAAM,EAAE,aAAa;GACnB,gBAAqB,QAAQ,IAAI,cAAc,IAAI,GAAG,CAAC,CAAC,UAAU,IAAI,QAAQ,IAAI,CAAC;EACrF;CACF,CACF;AACF;;AAGA,SAAS,oBAAoB,KAA0C;CACrE,MAAM,KAAK,IAAI,QAAQ;CACvB,IAAI,CAAC,IAAI,OAAO,CAAC;CACjB,OAAO,CAAC;EACN,IAAI;EACJ,OAAO,IAAI,EAAE,oCAAoC;EACjD,MAAM;EACN,SAAS;EACT,MAAM,WAAW;GACf,gBAAqB,QAAQ,IAAI,cAAc,IAAI,GAAG,CAAC,CAAC,UAAU,IAAI,QAAQ,IAAI,CAAC;EACrF;CACF,CAAC;AACH;;;;;;;;;;;;;;;AAgBA,SAAgB,qBAA2C;CACzD,OAAO;EACL,IAAI;EACJ,WAAW;EACX,UAAU;GAAC;GAAc;GAAM;EAAO;EACtC,cAAc;EACd,eAAe,yBAAyB;EACxC,YAAY;EACZ,UAAU;EACV,iBAAiB,QAAQ,UAAU,YAAY;GAC7C,IAAI,CAAC,SAAS,OAAO;GACrB,MAAM,OAAO,YAAY,SAAS,QAAQ;GAC1C,OAAO,YAAY,MAAM,MAAM,eAAe,eAAe,WAAW,CAAC,GAAG,IAAI,IAAI;EACtF;CACF;AACF"}
@@ -38,7 +38,7 @@ export declare function parseOutlineResponse(text: string, headings: readonly {
38
38
  */
39
39
  export declare function applyOutline(tr: Transaction, headings: readonly OutlineHeading[], outline: readonly OutlineEntry[]): number;
40
40
  /**
41
- * „Gliederung bereinigen (KI)“: sends the headings of the whole document (task `outline-sanitize`, `generate` slot) and
41
+ * „Gliederung bereinigen (KI)“: sends the headings of the whole document (task `outline-sanitize`, `generate` Model role) and
42
42
  * applies the model's repaired outline (levels without gaps, numbering and trailing punctuation gone, empty headings
43
43
  * merged into the next) in one transaction. A malformed answer, or a document whose headings changed while the model
44
44
  * ran, writes nothing and shows a notice. Notices go through `notify`, in the language of `t`.
@@ -75,7 +75,7 @@ function applyOutline(tr, headings, outline) {
75
75
  return changed;
76
76
  }
77
77
  /**
78
- * „Gliederung bereinigen (KI)“: sends the headings of the whole document (task `outline-sanitize`, `generate` slot) and
78
+ * „Gliederung bereinigen (KI)“: sends the headings of the whole document (task `outline-sanitize`, `generate` Model role) and
79
79
  * applies the model's repaired outline (levels without gaps, numbering and trailing punctuation gone, empty headings
80
80
  * merged into the next) in one transaction. A malformed answer, or a document whose headings changed while the model
81
81
  * ran, writes nothing and shows a notice. Notices go through `notify`, in the language of `t`.
@@ -1 +1 @@
1
- {"version":3,"file":"outline-sanitize.js","names":[],"sources":["../../../src/integrations/composite-ai/outline-sanitize.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport type { Node as PMNode } from '@tiptap/pm/model'\nimport type { Transaction } from '@tiptap/pm/state'\nimport type { EditorBackend } from '../../core/backend'\nimport type { Notifier } from '../../core/notify'\nimport type { Translate } from '../../i18n'\nimport { AI_LIMITS, type ModelRef, notifyAiRateLimited, postAiSse } from '../../features/ai'\nimport { headingGroupRange } from '../../features/composites/schema'\n\n/** A heading of the document as the model sees it, plus where it is: `i` is its index in document order, `chars` the text length of the blocks under it up to the next heading of the same or a higher level. */\nexport interface OutlineHeading { i: number, level: number, text: string, chars: number, pos: number }\n\n/** The model's answer for one heading: its level and text (empty: the heading is removed). */\nexport interface OutlineEntry { i: number, level: number, text: string }\n\n/** Every `heading` node of `doc` (any depth, document order). */\nexport function collectHeadings(doc: PMNode): OutlineHeading[] {\n const headings: OutlineHeading[] = []\n doc.descendants((node, pos, parent, index) => {\n if (node.type.name !== 'heading' || !parent) return\n const { to } = headingGroupRange(parent, index)\n let chars = 0\n for (let sibling = index + 1; sibling < to; sibling++) chars += parent.child(sibling).textContent.length\n headings.push({ i: headings.length, level: node.attrs.level as number, text: node.textContent, chars, pos })\n })\n return headings\n}\n\n/**\n * The model's answer as one entry per heading, or `null` when it is not exactly that: a JSON list (a Markdown code\n * fence around it is tolerated) of the same length as `headings`, `i` equal to the position, `level` an integer 1..6,\n * `text` a string.\n */\nexport function parseOutlineResponse(text: string, headings: readonly { i: number }[]): OutlineEntry[] | null {\n let parsed: unknown\n try {\n parsed = JSON.parse(text.trim().replace(/^```(?:json)?\\s*/i, '').replace(/\\s*```$/, ''))\n }\n catch {\n return null\n }\n if (!Array.isArray(parsed) || parsed.length !== headings.length) return null\n const entries: OutlineEntry[] = []\n for (const [index, item] of parsed.entries()) {\n const { i, level, text: value } = (item ?? {}) as Partial<Record<'i' | 'level' | 'text', unknown>>\n if (i !== index || typeof level !== 'number' || !Number.isInteger(level) || level < 1 || level > 6 || typeof value !== 'string') return null\n entries.push({ i, level, text: value.trim() })\n }\n return entries\n}\n\n/**\n * Writes `outline` into `tr` for the `headings` collected from `tr.doc` (so far unchanged): an empty text removes the\n * heading, otherwise its level and, when it differs, its text (as plain text) are set. Runs from the last heading to\n * the first, so the positions of the earlier ones stay valid. Returns how many headings changed.\n */\nexport function applyOutline(tr: Transaction, headings: readonly OutlineHeading[], outline: readonly OutlineEntry[]): number {\n let changed = 0\n for (let index = headings.length - 1; index >= 0; index--) {\n const { pos } = headings[index]!\n const { level, text } = outline[index]!\n const node = tr.doc.nodeAt(pos)\n if (node?.type.name !== 'heading') continue\n if (!text) {\n tr.delete(pos, pos + node.nodeSize)\n changed++\n continue\n }\n const retext = text !== node.textContent\n if (!retext && level === node.attrs.level) continue\n if (level !== node.attrs.level) tr.setNodeMarkup(pos, undefined, { ...node.attrs, level })\n if (retext) tr.replaceWith(pos + 1, pos + 1 + node.content.size, tr.doc.type.schema.text(text))\n changed++\n }\n return changed\n}\n\n/**\n * „Gliederung bereinigen (KI)“: sends the headings of the whole document (task `outline-sanitize`, `generate` slot) and\n * applies the model's repaired outline (levels without gaps, numbering and trailing punctuation gone, empty headings\n * merged into the next) in one transaction. A malformed answer, or a document whose headings changed while the model\n * ran, writes nothing and shows a notice. Notices go through `notify`, in the language of `t`.\n */\nexport async function sanitizeOutline(editor: Editor, ai: NonNullable<EditorBackend['ai']>, modelRef: (slot: 'generate') => ModelRef, notify: Notifier, t: Translate): Promise<void> {\n const headings = collectHeadings(editor.state.doc)\n if (!headings.length) {\n notify({ title: t('integrations.outlineSanitize.none'), kind: 'info' })\n return\n }\n const selection = JSON.stringify(headings.map(({ i, level, text, chars }) => ({ i, level, text, chars })))\n if (selection.length > AI_LIMITS.selection) {\n notify({ title: t('integrations.outlineSanitize.tooLong'), kind: 'error' })\n return\n }\n\n const toastId = 'outline-sanitize'\n const controller = new AbortController()\n const abort = () => controller.abort()\n editor.on('destroy', abort)\n notify({ id: toastId, title: t('integrations.outlineSanitize.running'), kind: 'info', icon: 'i-lucide-loader-circle', duration: 0 })\n let output = ''\n try {\n const outcome = await postAiSse(ai, 'generate', {\n task: 'outline-sanitize',\n prompt: '',\n selection,\n context: '',\n model: modelRef('generate'),\n }, { signal: controller.signal, t, onDelta: (text) => { output += text } })\n\n if (outcome.status === 'aborted' || editor.isDestroyed) return\n if (outcome.status === 'rate-limited') {\n notifyAiRateLimited(notify, t)\n return\n }\n if (outcome.status === 'error') {\n notify({ title: t('integrations.outlineSanitize.failed'), description: outcome.message, kind: 'error' })\n return\n }\n const outline = parseOutlineResponse(output, headings)\n if (!outline) {\n notify({ title: t('integrations.outlineSanitize.invalid'), kind: 'warning' })\n return\n }\n\n const current = collectHeadings(editor.state.doc)\n if (current.length !== headings.length || current.some((heading, index) => heading.pos !== headings[index]!.pos || heading.level !== headings[index]!.level || heading.text !== headings[index]!.text)) {\n notify({ title: t('integrations.outlineSanitize.gone'), kind: 'error' })\n return\n }\n const tr = editor.state.tr\n if (applyOutline(tr, current, outline)) editor.view.dispatch(tr)\n notify({ title: t('integrations.outlineSanitize.done'), kind: 'success', icon: 'i-lucide-list-tree' })\n }\n finally {\n notify.dismiss?.(toastId)\n editor.off('destroy', abort)\n }\n}\n"],"mappings":";;;;;;AAgBA,SAAgB,gBAAgB,KAA+B;CAC7D,MAAM,WAA6B,CAAC;CACpC,IAAI,aAAa,MAAM,KAAK,QAAQ,UAAU;EAC5C,IAAI,KAAK,KAAK,SAAS,aAAa,CAAC,QAAQ;EAC7C,MAAM,EAAE,OAAO,kBAAkB,QAAQ,KAAK;EAC9C,IAAI,QAAQ;EACZ,KAAK,IAAI,UAAU,QAAQ,GAAG,UAAU,IAAI,WAAW,SAAS,OAAO,MAAM,OAAO,CAAC,CAAC,YAAY;EAClG,SAAS,KAAK;GAAE,GAAG,SAAS;GAAQ,OAAO,KAAK,MAAM;GAAiB,MAAM,KAAK;GAAa;GAAO;EAAI,CAAC;CAC7G,CAAC;CACD,OAAO;AACT;;;;;;AAOA,SAAgB,qBAAqB,MAAc,UAA2D;CAC5G,IAAI;CACJ,IAAI;EACF,SAAS,KAAK,MAAM,KAAK,KAAK,CAAC,CAAC,QAAQ,qBAAqB,EAAE,CAAC,CAAC,QAAQ,WAAW,EAAE,CAAC;CACzF,QACM;EACJ,OAAO;CACT;CACA,IAAI,CAAC,MAAM,QAAQ,MAAM,KAAK,OAAO,WAAW,SAAS,QAAQ,OAAO;CACxE,MAAM,UAA0B,CAAC;CACjC,KAAK,MAAM,CAAC,OAAO,SAAS,OAAO,QAAQ,GAAG;EAC5C,MAAM,EAAE,GAAG,OAAO,MAAM,UAAW,QAAQ,CAAC;EAC5C,IAAI,MAAM,SAAS,OAAO,UAAU,YAAY,CAAC,OAAO,UAAU,KAAK,KAAK,QAAQ,KAAK,QAAQ,KAAK,OAAO,UAAU,UAAU,OAAO;EACxI,QAAQ,KAAK;GAAE;GAAG;GAAO,MAAM,MAAM,KAAK;EAAE,CAAC;CAC/C;CACA,OAAO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IAAI,WAAW,KAAK;CAC7B;AACF"}
1
+ {"version":3,"file":"outline-sanitize.js","names":[],"sources":["../../../src/integrations/composite-ai/outline-sanitize.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport type { Node as PMNode } from '@tiptap/pm/model'\nimport type { Transaction } from '@tiptap/pm/state'\nimport type { EditorBackend } from '../../core/backend'\nimport type { Notifier } from '../../core/notify'\nimport type { Translate } from '../../i18n'\nimport { AI_LIMITS, type ModelRef, notifyAiRateLimited, postAiSse } from '../../features/ai'\nimport { headingGroupRange } from '../../features/composites/schema'\n\n/** A heading of the document as the model sees it, plus where it is: `i` is its index in document order, `chars` the text length of the blocks under it up to the next heading of the same or a higher level. */\nexport interface OutlineHeading { i: number, level: number, text: string, chars: number, pos: number }\n\n/** The model's answer for one heading: its level and text (empty: the heading is removed). */\nexport interface OutlineEntry { i: number, level: number, text: string }\n\n/** Every `heading` node of `doc` (any depth, document order). */\nexport function collectHeadings(doc: PMNode): OutlineHeading[] {\n const headings: OutlineHeading[] = []\n doc.descendants((node, pos, parent, index) => {\n if (node.type.name !== 'heading' || !parent) return\n const { to } = headingGroupRange(parent, index)\n let chars = 0\n for (let sibling = index + 1; sibling < to; sibling++) chars += parent.child(sibling).textContent.length\n headings.push({ i: headings.length, level: node.attrs.level as number, text: node.textContent, chars, pos })\n })\n return headings\n}\n\n/**\n * The model's answer as one entry per heading, or `null` when it is not exactly that: a JSON list (a Markdown code\n * fence around it is tolerated) of the same length as `headings`, `i` equal to the position, `level` an integer 1..6,\n * `text` a string.\n */\nexport function parseOutlineResponse(text: string, headings: readonly { i: number }[]): OutlineEntry[] | null {\n let parsed: unknown\n try {\n parsed = JSON.parse(text.trim().replace(/^```(?:json)?\\s*/i, '').replace(/\\s*```$/, ''))\n }\n catch {\n return null\n }\n if (!Array.isArray(parsed) || parsed.length !== headings.length) return null\n const entries: OutlineEntry[] = []\n for (const [index, item] of parsed.entries()) {\n const { i, level, text: value } = (item ?? {}) as Partial<Record<'i' | 'level' | 'text', unknown>>\n if (i !== index || typeof level !== 'number' || !Number.isInteger(level) || level < 1 || level > 6 || typeof value !== 'string') return null\n entries.push({ i, level, text: value.trim() })\n }\n return entries\n}\n\n/**\n * Writes `outline` into `tr` for the `headings` collected from `tr.doc` (so far unchanged): an empty text removes the\n * heading, otherwise its level and, when it differs, its text (as plain text) are set. Runs from the last heading to\n * the first, so the positions of the earlier ones stay valid. Returns how many headings changed.\n */\nexport function applyOutline(tr: Transaction, headings: readonly OutlineHeading[], outline: readonly OutlineEntry[]): number {\n let changed = 0\n for (let index = headings.length - 1; index >= 0; index--) {\n const { pos } = headings[index]!\n const { level, text } = outline[index]!\n const node = tr.doc.nodeAt(pos)\n if (node?.type.name !== 'heading') continue\n if (!text) {\n tr.delete(pos, pos + node.nodeSize)\n changed++\n continue\n }\n const retext = text !== node.textContent\n if (!retext && level === node.attrs.level) continue\n if (level !== node.attrs.level) tr.setNodeMarkup(pos, undefined, { ...node.attrs, level })\n if (retext) tr.replaceWith(pos + 1, pos + 1 + node.content.size, tr.doc.type.schema.text(text))\n changed++\n }\n return changed\n}\n\n/**\n * „Gliederung bereinigen (KI)“: sends the headings of the whole document (task `outline-sanitize`, `generate` Model role) and\n * applies the model's repaired outline (levels without gaps, numbering and trailing punctuation gone, empty headings\n * merged into the next) in one transaction. A malformed answer, or a document whose headings changed while the model\n * ran, writes nothing and shows a notice. Notices go through `notify`, in the language of `t`.\n */\nexport async function sanitizeOutline(editor: Editor, ai: NonNullable<EditorBackend['ai']>, modelRef: (slot: 'generate') => ModelRef, notify: Notifier, t: Translate): Promise<void> {\n const headings = collectHeadings(editor.state.doc)\n if (!headings.length) {\n notify({ title: t('integrations.outlineSanitize.none'), kind: 'info' })\n return\n }\n const selection = JSON.stringify(headings.map(({ i, level, text, chars }) => ({ i, level, text, chars })))\n if (selection.length > AI_LIMITS.selection) {\n notify({ title: t('integrations.outlineSanitize.tooLong'), kind: 'error' })\n return\n }\n\n const toastId = 'outline-sanitize'\n const controller = new AbortController()\n const abort = () => controller.abort()\n editor.on('destroy', abort)\n notify({ id: toastId, title: t('integrations.outlineSanitize.running'), kind: 'info', icon: 'i-lucide-loader-circle', duration: 0 })\n let output = ''\n try {\n const outcome = await postAiSse(ai, 'generate', {\n task: 'outline-sanitize',\n prompt: '',\n selection,\n context: '',\n model: modelRef('generate'),\n }, { signal: controller.signal, t, onDelta: (text) => { output += text } })\n\n if (outcome.status === 'aborted' || editor.isDestroyed) return\n if (outcome.status === 'rate-limited') {\n notifyAiRateLimited(notify, t)\n return\n }\n if (outcome.status === 'error') {\n notify({ title: t('integrations.outlineSanitize.failed'), description: outcome.message, kind: 'error' })\n return\n }\n const outline = parseOutlineResponse(output, headings)\n if (!outline) {\n notify({ title: t('integrations.outlineSanitize.invalid'), kind: 'warning' })\n return\n }\n\n const current = collectHeadings(editor.state.doc)\n if (current.length !== headings.length || current.some((heading, index) => heading.pos !== headings[index]!.pos || heading.level !== headings[index]!.level || heading.text !== headings[index]!.text)) {\n notify({ title: t('integrations.outlineSanitize.gone'), kind: 'error' })\n return\n }\n const tr = editor.state.tr\n if (applyOutline(tr, current, outline)) editor.view.dispatch(tr)\n notify({ title: t('integrations.outlineSanitize.done'), kind: 'success', icon: 'i-lucide-list-tree' })\n }\n finally {\n notify.dismiss?.(toastId)\n editor.off('destroy', abort)\n }\n}\n"],"mappings":";;;;;;AAgBA,SAAgB,gBAAgB,KAA+B;CAC7D,MAAM,WAA6B,CAAC;CACpC,IAAI,aAAa,MAAM,KAAK,QAAQ,UAAU;EAC5C,IAAI,KAAK,KAAK,SAAS,aAAa,CAAC,QAAQ;EAC7C,MAAM,EAAE,OAAO,kBAAkB,QAAQ,KAAK;EAC9C,IAAI,QAAQ;EACZ,KAAK,IAAI,UAAU,QAAQ,GAAG,UAAU,IAAI,WAAW,SAAS,OAAO,MAAM,OAAO,CAAC,CAAC,YAAY;EAClG,SAAS,KAAK;GAAE,GAAG,SAAS;GAAQ,OAAO,KAAK,MAAM;GAAiB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M;GAAQ,CAAC;GACvG;EACF;EACA,MAAM,UAAU,qBAAqB,QAAQ,QAAQ;EACrD,IAAI,CAAC,SAAS;GACZ,OAAO;IAAE,OAAO,EAAE,sCAAsC;IAAG,MAAM;GAAU,CAAC;GAC5E;EACF;EAEA,MAAM,UAAU,gBAAgB,OAAO,MAAM,GAAG;EAChD,IAAI,QAAQ,WAAW,SAAS,UAAU,QAAQ,MAAM,SAAS,UAAU,QAAQ,QAAQ,SAAS,MAAM,CAAE,OAAO,QAAQ,UAAU,SAAS,MAAM,CAAE,SAAS,QAAQ,SAAS,SAAS,MAAM,CAAE,IAAI,GAAG;GACtM,OAAO;IAAE,OAAO,EAAE,mCAAmC;IAAG,MAAM;GAAQ,CAAC;GACvE;EACF;EACA,MAAM,KAAK,OAAO,MAAM;EACxB,IAAI,aAAa,IAAI,SAAS,OAAO,GAAG,OAAO,KAAK,SAAS,EAAE;EAC/D,OAAO;GAAE,OAAO,EAAE,mCAAmC;GAAG,MAAM;GAAW,MAAM;EAAqB,CAAC;CACvG,UACQ;EACN,OAAO,UAAU,OAAO;EACxB,OAAO,IAAI,WAAW,KAAK;CAC7B;AACF"}
@@ -8,7 +8,7 @@ import { Node as Node$1 } from "@tiptap/pm/model";
8
8
  //#region src/integrations/composite-ai/rendition.d.ts
9
9
  export interface RenditionOptions {
10
10
  /**
11
- * Replace the rendition at this position (a child of the source-holding Baustein) in place instead of adding a new one
11
+ * Replace the rendition at this position (a child of the source-holding Typed block) in place instead of adding a new one
12
12
  * after the source: its chrome (title, description, tags) and block id stay, body and derivation are new.
13
13
  */
14
14
  replace?: {
@@ -16,26 +16,26 @@ export interface RenditionOptions {
16
16
  };
17
17
  }
18
18
  /**
19
- * „Lesefassung erzeugen“: extracts the readable content of the source of the Baustein at `pos` (`ai.extract`, method
19
+ * the „Create readable rendition“ action: extracts the readable content of the source of the Typed block at `pos` (`ai.extract`, method
20
20
  * `auto`: transcript with timestamps for audio/video, full text or OCR for a PDF, a description for an image) and adds
21
- * it as a `rendition` Baustein right after the source block, carrying `meta.derivation` (asset, method, model, hashes,
22
- * the stored raw output). Bibliographic data the server found fills an empty `meta.bib` of the Baustein, and the work's
23
- * title an empty Baustein title. With `options.replace` the existing rendition is replaced in place (same block id).
24
- * The Baustein is anchored through its description when the request starts and found again after it ends, so edits
21
+ * it as a `rendition` Typed block right after the source block, carrying `meta.derivation` (asset, method, model, hashes,
22
+ * the stored raw output). Bibliographic data the server found fills an empty `meta.bib` of the Typed block, and the work's
23
+ * title an empty Typed block title. With `options.replace` the existing rendition is replaced in place (same block id).
24
+ * The Typed block is anchored through its description when the request starts and found again after it ends, so edits
25
25
  * while it runs do not misplace the result. Notices go through `notify`, in the language of `t`; the progress notice
26
26
  * stays until the request ends.
27
27
  */
28
28
  export declare function createRendition(editor: Editor, pos: number, ai: NonNullable<EditorBackend['ai']>, modelRef: (slot: 'generate') => ModelRef, notify: Notifier, t: Translate, options?: RenditionOptions): Promise<void>;
29
29
  /**
30
- * Whether „Lesefassung erzeugen“ applies to `node`: a Baustein of a source-holding kind whose source block was
30
+ * Whether the „Create readable rendition“ action applies to `node`: a Typed block of a source-holding Block type whose source block was
31
31
  * found. A recording needs speech-to-text (`transcription`: the app's public configuration enables it); everything else
32
32
  * is extracted by the server.
33
33
  */
34
34
  export declare function canCreateRendition(editor: Editor, node: Node$1, transcription: boolean): boolean;
35
- /** Whether „Neu erzeugen (ersetzen)“ applies to the Baustein `node` at `pos`: an asset-derived rendition inside a Baustein that still has a source. */
35
+ /** Whether „Neu erzeugen (ersetzen)“ applies to the Typed block `node` at `pos`: an asset-derived rendition inside a Typed block that still has a source. */
36
36
  export declare function canRegenerateRendition(editor: Editor, node: Node$1, pos: number, transcription: boolean): boolean;
37
37
  /**
38
- * „Neu erzeugen (ersetzen)“: makes the rendition at `pos` again from the source of its Baustein and replaces it in place
38
+ * „Neu erzeugen (ersetzen)“: makes the rendition at `pos` again from the source of its Typed block and replaces it in place
39
39
  * (`createRendition` with `replace`; the block id stays, so references keep resolving). A rendition whose body was
40
40
  * edited since it was made is not replaced silently: a warning notice offers „Trotzdem ersetzen“, dismissing the notice
41
41
  * cancels. The rendition is found again by its id when the button is pressed.