@engenty/wizards-runtime 0.14.2 → 0.16.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 (263) hide show
  1. package/apps/runtime/dist/agents/studio-assistant.js +180 -4
  2. package/apps/runtime/dist/agents/website.js +10 -5
  3. package/apps/runtime/dist/app.js +27 -2
  4. package/apps/runtime/dist/auth/index.js +5 -0
  5. package/apps/runtime/dist/broker/account.js +5 -0
  6. package/apps/runtime/dist/broker/call.js +2 -0
  7. package/apps/runtime/dist/broker/host.js +1 -0
  8. package/apps/runtime/dist/broker/index.js +5 -0
  9. package/apps/runtime/dist/broker/rwx.js +293 -11
  10. package/apps/runtime/dist/cli/main.js +7 -0
  11. package/apps/runtime/dist/cli/move-files.js +68 -0
  12. package/apps/runtime/dist/cli/move-folder-sources.js +120 -0
  13. package/apps/runtime/dist/connectors/plugin-connections.js +74 -4
  14. package/apps/runtime/dist/db/migrations/tenant/0040_rwx_elements.sql +21 -0
  15. package/apps/runtime/dist/db/migrations/tenant/0041_broker_log_client.sql +1 -0
  16. package/apps/runtime/dist/db/migrations/tenant/0042_client_spaces.sql +16 -0
  17. package/apps/runtime/dist/db/migrations/tenant/0043_space_member_invite.sql +19 -0
  18. package/apps/runtime/dist/db/migrations/tenant/0044_client_portal.sql +8 -0
  19. package/apps/runtime/dist/db/migrations/tenant/0045_client_portal_no_slug.sql +2 -0
  20. package/apps/runtime/dist/db/migrations/tenant/0046_space_file_hash.sql +2 -0
  21. package/apps/runtime/dist/db/migrations/tenant/0047_knowledge_folders.sql +3 -0
  22. package/apps/runtime/dist/db/migrations/tenant/0048_space_chunk_kind.sql +1 -0
  23. package/apps/runtime/dist/db/migrations/tenant/0049_knowledge_sources.sql +57 -0
  24. package/apps/runtime/dist/db/migrations/tenant/0050_dateien.sql +71 -0
  25. package/apps/runtime/dist/db/migrations/tenant/0051_dateien_drafts.sql +23 -0
  26. package/apps/runtime/dist/db/migrations/tenant/0052_dateien_plugin_kinds.sql +5 -0
  27. package/apps/runtime/dist/db/migrations/tenant/0053_dateien_file_title.sql +3 -0
  28. package/apps/runtime/dist/db/migrations/tenant/0054_dateien_ocr.sql +14 -0
  29. package/apps/runtime/dist/db/migrations/tenant/0055_dateien_doc_reread.sql +3 -0
  30. package/apps/runtime/dist/db/migrations/tenant/meta/0040_snapshot.json +5153 -0
  31. package/apps/runtime/dist/db/migrations/tenant/meta/0041_snapshot.json +5160 -0
  32. package/apps/runtime/dist/db/migrations/tenant/meta/0042_snapshot.json +5286 -0
  33. package/apps/runtime/dist/db/migrations/tenant/meta/0043_snapshot.json +5293 -0
  34. package/apps/runtime/dist/db/migrations/tenant/meta/0044_snapshot.json +5344 -0
  35. package/apps/runtime/dist/db/migrations/tenant/meta/0045_snapshot.json +5329 -0
  36. package/apps/runtime/dist/db/migrations/tenant/meta/0046_snapshot.json +5343 -0
  37. package/apps/runtime/dist/db/migrations/tenant/meta/0047_snapshot.json +5391 -0
  38. package/apps/runtime/dist/db/migrations/tenant/meta/0048_snapshot.json +5398 -0
  39. package/apps/runtime/dist/db/migrations/tenant/meta/0049_snapshot.json +5793 -0
  40. package/apps/runtime/dist/db/migrations/tenant/meta/0050_snapshot.json +6288 -0
  41. package/apps/runtime/dist/db/migrations/tenant/meta/0051_snapshot.json +6461 -0
  42. package/apps/runtime/dist/db/migrations/tenant/meta/0052_snapshot.json +6497 -0
  43. package/apps/runtime/dist/db/migrations/tenant/meta/0053_snapshot.json +6504 -0
  44. package/apps/runtime/dist/db/migrations/tenant/meta/0054_snapshot.json +6504 -0
  45. package/apps/runtime/dist/db/migrations/tenant/meta/0055_snapshot.json +6504 -0
  46. package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +112 -0
  47. package/apps/runtime/dist/db/schema.js +296 -5
  48. package/apps/runtime/dist/docs/dev/api.md +49 -2
  49. package/apps/runtime/dist/docs/dev/architecture.md +13 -2
  50. package/apps/runtime/dist/docs/dev/plugins/connections.md +30 -2
  51. package/apps/runtime/dist/docs/dev/plugins/index.md +1 -1
  52. package/apps/runtime/dist/docs/dev/plugins/reference.md +7 -4
  53. package/apps/runtime/dist/docs/dev/plugins/server.md +11 -5
  54. package/apps/runtime/dist/docs/dev/plugins/space.md +130 -4
  55. package/apps/runtime/dist/docs/dev/plugins/studio.md +13 -3
  56. package/apps/runtime/dist/docs/user-guide/command-line.md +2 -0
  57. package/apps/runtime/dist/docs/user-guide/plugins.md +1 -1
  58. package/apps/runtime/dist/docs/user-guide/space.md +6 -6
  59. package/apps/runtime/dist/docs/user-guide/steps.md +1 -1
  60. package/apps/runtime/dist/documents/ocr.js +72 -0
  61. package/apps/runtime/dist/documents/parse.js +81 -12
  62. package/apps/runtime/dist/elements/caller.js +47 -0
  63. package/apps/runtime/dist/elements/catalogue.js +14 -0
  64. package/apps/runtime/dist/elements/connections.js +60 -0
  65. package/apps/runtime/dist/elements/gate.js +81 -0
  66. package/apps/runtime/dist/elements/knowledge.js +308 -0
  67. package/apps/runtime/dist/elements/outside.js +103 -0
  68. package/apps/runtime/dist/elements/specs.js +102 -0
  69. package/apps/runtime/dist/elements/wizards.js +72 -0
  70. package/apps/runtime/dist/engenty/connections-google/connectors/drive.js +3 -0
  71. package/apps/runtime/dist/engenty/connections-microsoft/onedrive.js +3 -0
  72. package/apps/runtime/dist/engenty/connections-s3/s3.js +6 -0
  73. package/apps/runtime/dist/engine/runner.js +19 -2
  74. package/apps/runtime/dist/engine/steps.js +1 -1
  75. package/apps/runtime/dist/env.js +11 -2
  76. package/apps/runtime/dist/files/blobs.js +57 -1
  77. package/apps/runtime/dist/files/objects.js +1 -0
  78. package/apps/runtime/dist/files/pictures.js +41 -0
  79. package/apps/runtime/dist/files/storage.js +14 -26
  80. package/apps/runtime/dist/files/thumbs.js +77 -0
  81. package/apps/runtime/dist/files/upload-check.js +2 -2
  82. package/apps/runtime/dist/index.js +22 -0
  83. package/apps/runtime/dist/live/views.js +2 -1
  84. package/apps/runtime/dist/manage.js +4 -1
  85. package/apps/runtime/dist/mcp/elements.js +88 -0
  86. package/apps/runtime/dist/mcp/handler.js +2 -0
  87. package/apps/runtime/dist/mcp/scopes.js +5 -0
  88. package/apps/runtime/dist/mcp/tools.js +5 -0
  89. package/apps/runtime/dist/models.js +82 -13
  90. package/apps/runtime/dist/mounts/cache.js +71 -0
  91. package/apps/runtime/dist/mounts/drafts.js +367 -0
  92. package/apps/runtime/dist/mounts/folder.js +148 -0
  93. package/apps/runtime/dist/mounts/mounts.js +1315 -0
  94. package/apps/runtime/dist/mounts/source.js +179 -0
  95. package/apps/runtime/dist/mounts/units.js +97 -0
  96. package/apps/runtime/dist/move-files.js +4 -0
  97. package/apps/runtime/dist/plugins/loader.js +73 -1
  98. package/apps/runtime/dist/plugins/registry.js +2 -0
  99. package/apps/runtime/dist/prompts/authoring.md +2 -2
  100. package/apps/runtime/dist/prompts/goose.md +13 -1
  101. package/apps/runtime/dist/prompts/tools.md +8 -2
  102. package/apps/runtime/dist/render/convert.js +188 -1
  103. package/apps/runtime/dist/routes/api.js +7 -2
  104. package/apps/runtime/dist/routes/client-contract.js +164 -0
  105. package/apps/runtime/dist/routes/client-spaces.js +58 -0
  106. package/apps/runtime/dist/routes/dateien.js +173 -0
  107. package/apps/runtime/dist/routes/elements.js +76 -0
  108. package/apps/runtime/dist/routes/plugins.js +2 -1
  109. package/apps/runtime/dist/routes/runs.js +24 -10
  110. package/apps/runtime/dist/routes/studio.js +168 -8
  111. package/apps/runtime/dist/secrets/signing.js +16 -0
  112. package/apps/runtime/dist/services/client-portal.js +439 -0
  113. package/apps/runtime/dist/services/client-spaces.js +228 -0
  114. package/apps/runtime/dist/services/cloud.js +2 -0
  115. package/apps/runtime/dist/services/knowledge-model.js +24 -8
  116. package/apps/runtime/dist/services/knowledge.js +72 -42
  117. package/apps/runtime/dist/services/links.js +17 -0
  118. package/apps/runtime/dist/services/members-studio.js +5 -1
  119. package/apps/runtime/dist/services/page-pictures.js +162 -0
  120. package/apps/runtime/dist/services/runs.js +22 -6
  121. package/apps/runtime/dist/services/space-categories.js +41 -5
  122. package/apps/runtime/dist/services/space-data.js +165 -8
  123. package/apps/runtime/dist/services/space-files.js +102 -19
  124. package/apps/runtime/dist/services/space-index.js +384 -41
  125. package/apps/runtime/dist/services/space-origin.js +25 -1
  126. package/apps/runtime/dist/services/space-sources.js +937 -0
  127. package/apps/runtime/dist/services/spaces.js +60 -12
  128. package/apps/runtime/dist/services/synced-spaces.js +10 -1
  129. package/apps/runtime/dist/services/work-ai.js +53 -24
  130. package/apps/runtime/dist/services/work-chats.js +3 -2
  131. package/apps/runtime/dist/services/work-connections.js +2 -2
  132. package/apps/runtime/dist/sharing/index.js +2 -0
  133. package/apps/runtime/dist/store/index.js +29 -8
  134. package/apps/runtime/dist/store/shared-lists.js +30 -17
  135. package/apps/runtime/dist/sync/records.js +22 -27
  136. package/apps/runtime/dist/texts.js +4 -0
  137. package/apps/runtime/dist/tools/index.js +5 -4
  138. package/apps/runtime/dist/tools/pages.js +1 -1
  139. package/apps/runtime/dist/tools/skills.js +80 -54
  140. package/apps/runtime/dist/tools/space.js +8 -152
  141. package/apps/runtime/dist/widgets/step.js +2 -1
  142. package/apps/web/dist/assets/AboutDialog-0q4P80yv.js +1 -0
  143. package/apps/web/dist/assets/BlockEditor-CUYFH_CU.js +173 -0
  144. package/apps/web/dist/assets/BlockEditor-CtW6lw0y.css +1 -0
  145. package/apps/web/dist/assets/CapabilitiesPage-BlZP8DYb.js +2 -0
  146. package/apps/web/dist/assets/{ChangelogDialog-D_dQOMIq.js → ChangelogDialog-CDN7kMs1.js} +1 -1
  147. package/apps/web/dist/assets/{CodeEditor-nxoOt8ge.js → CodeEditor-D-Y16fdk.js} +1 -1
  148. package/apps/web/dist/assets/EditorPage-CrMVsgUt.js +3 -0
  149. package/apps/web/dist/assets/{FlowPreview-aMfwcPul.js → FlowPreview-DXnk7m9P.js} +1 -1
  150. package/apps/web/dist/assets/{LangSwitch-DpD0inR4.js → LangSwitch-Dkd0FBIH.js} +1 -1
  151. package/apps/web/dist/assets/Marketplace-Cty40VwG.js +2 -0
  152. package/apps/web/dist/assets/NewWizardChannels-Czool7s1.js +1 -0
  153. package/apps/web/dist/assets/NewWizardPage-CfVe_4a2.js +7 -0
  154. package/apps/web/dist/assets/OnboardingPage-D3SEpTmt.js +1 -0
  155. package/apps/web/dist/assets/PreviewPane-CQDKQO6z.js +7 -0
  156. package/apps/web/dist/assets/PublicRunner-BDZNnlQw.js +1 -0
  157. package/apps/web/dist/assets/ReadOnly-B7MUySpC.js +1 -0
  158. package/apps/web/dist/assets/SettingsPage-Bgurv3l2.js +2 -0
  159. package/apps/web/dist/assets/SetupPage-C3km8vqv.js +1 -0
  160. package/apps/web/dist/assets/{SharePage-N80EhoD7.js → SharePage-UwEJBIzq.js} +1 -1
  161. package/apps/web/dist/assets/SkillEditor-BaEiqqXl.js +1 -0
  162. package/apps/web/dist/assets/Skills-Bv6XbKxc.js +9 -0
  163. package/apps/web/dist/assets/SpacePage-D9PXLSU_.js +2 -0
  164. package/apps/web/dist/assets/UpdateCheck-C7I43zFZ.js +2 -0
  165. package/apps/web/dist/assets/changelog-DwgWiSZb.js +1 -0
  166. package/apps/web/dist/assets/circle-check-DDLzlcXP.js +1 -0
  167. package/apps/web/dist/assets/code-DsnwzN1x.js +1 -0
  168. package/apps/web/dist/assets/code-editor-Ca5EAxmd.js +2 -0
  169. package/apps/web/dist/assets/code-xml-S4IFi5Jc.js +1 -0
  170. package/apps/web/dist/assets/connection-sign-in-hI3HXhq4.js +1 -0
  171. package/apps/web/dist/assets/{dist-H1UN89OA.js → dist-B3Ray2U5.js} +1 -1
  172. package/apps/web/dist/assets/dist-CQpLJoQZ.js +10 -0
  173. package/apps/web/dist/assets/{dist-GlRRx9Xl.js → dist-D1uGQ_tB.js} +1 -1
  174. package/apps/web/dist/assets/{dist-BdDd1FxP.js → dist-DFI-tsfx.js} +1 -1
  175. package/apps/web/dist/assets/eye-TJSuiHHO.js +1 -0
  176. package/apps/web/dist/assets/floating-ui.dom-pwdNGv4b.js +1 -0
  177. package/apps/web/dist/assets/host-D5hNHbhF.js +125 -0
  178. package/apps/web/dist/assets/i18n-BBzMbGoo.js +55 -0
  179. package/apps/web/dist/assets/index-CyBrvupM.js +10 -0
  180. package/apps/web/dist/assets/index-w-3J3ZJ9.css +1 -0
  181. package/apps/web/dist/assets/{json-CEsfHdlZ.js → json-Ce3iHrtf.js} +1 -1
  182. package/apps/web/dist/assets/link-CPL8pB1P.js +1 -0
  183. package/apps/web/dist/assets/list-checks-DaxmUPqK.js +1 -0
  184. package/apps/web/dist/assets/{markdown-5-I9_izp.js → markdown-hqKQy2pp.js} +1 -1
  185. package/apps/web/dist/assets/marked.esm-DQ7XA7AC.js +67 -0
  186. package/apps/web/dist/assets/oss-credits-BrwV0a4F.js +1 -0
  187. package/apps/web/dist/assets/pdf-Dg-raaUo.js +54 -0
  188. package/apps/web/dist/assets/pdf.worker.min-68CMzziE.js +1 -0
  189. package/apps/web/dist/assets/pdf.worker.min-CjEcRF4W.mjs +28 -0
  190. package/apps/web/dist/assets/phone-B4uKDBFq.js +1 -0
  191. package/apps/web/dist/assets/read-aloud-Bfp9_bUY.js +1 -0
  192. package/apps/web/dist/assets/{runners-CyIvJIHr.js → runners-CUpBpSji.js} +1 -1
  193. package/apps/web/dist/assets/scroll-text-BEnPzQEi.js +1 -0
  194. package/apps/web/dist/assets/session-CMQo8P-G.js +2 -0
  195. package/apps/web/dist/assets/table-5B9G3oA6.js +1 -0
  196. package/apps/web/dist/assets/theme-CdX0marK.js +11 -0
  197. package/apps/web/dist/assets/ui-BCfu5sia.js +16 -0
  198. package/apps/web/dist/assets/upload-CAlHC232.js +1 -0
  199. package/apps/web/dist/assets/{useMutation-DEkZhp5c.js → useMutation-1fV4Nnxq.js} +1 -1
  200. package/apps/web/dist/assets/viewers-ChriFcRy.js +2 -0
  201. package/apps/web/dist/assets/volume-2-BqlBtCIJ.js +1 -0
  202. package/apps/web/dist/assets/w3c-keyname-BOAvb0qz.js +1 -0
  203. package/apps/web/dist/assets/xlsx-CuSbHU4R.js +141 -0
  204. package/apps/web/dist/index.html +19 -14
  205. package/apps/web/dist/mcp/flow.html +2 -2
  206. package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +223 -4
  207. package/node_modules/@engenty/wizards/dist/plugin/mount.d.ts +123 -0
  208. package/node_modules/@engenty/wizards/dist/plugin/mount.js +7 -0
  209. package/node_modules/@engenty/wizards/dist/plugin/studio.d.ts +110 -1
  210. package/node_modules/@engenty/wizards-shared/dist/connectors.d.ts +1 -1
  211. package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +24 -0
  212. package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +24 -0
  213. package/node_modules/@engenty/wizards-shared/dist/knowledge.d.ts +33 -4
  214. package/node_modules/@engenty/wizards-shared/dist/run.d.ts +6 -0
  215. package/node_modules/@engenty/wizards-shared/dist/run.js +12 -0
  216. package/node_modules/@engenty/wizards-shared/dist/rwx.d.ts +21 -4
  217. package/node_modules/@engenty/wizards-shared/dist/rwx.js +30 -3
  218. package/node_modules/@engenty/wizards-shared/dist/spaces.d.ts +11 -1
  219. package/node_modules/@engenty/wizards-shared/dist/spaces.js +9 -2
  220. package/node_modules/@engenty/wizards-shared/dist/text-merge.d.ts +6 -0
  221. package/node_modules/@engenty/wizards-shared/dist/text-merge.js +25 -0
  222. package/package.json +3 -1
  223. package/plugin/.claude-plugin/plugin.json +1 -1
  224. package/plugin/README.md +3 -0
  225. package/plugin/plugin.json +1 -1
  226. package/plugin/skills/work-in-space/SKILL.md +16 -0
  227. package/apps/web/dist/assets/AboutDialog-Cag3RJuT.js +0 -1
  228. package/apps/web/dist/assets/CapabilitiesPage-BQYiN0gT.js +0 -2
  229. package/apps/web/dist/assets/EditorPage-C4_8LsQN.js +0 -3
  230. package/apps/web/dist/assets/Marketplace-CpzD9pNQ.js +0 -2
  231. package/apps/web/dist/assets/NewWizardChannels-CcE3UMVb.js +0 -1
  232. package/apps/web/dist/assets/NewWizardPage-BzN7zrQx.js +0 -7
  233. package/apps/web/dist/assets/OnboardingPage-ztHT01ah.js +0 -1
  234. package/apps/web/dist/assets/PreviewPane-BabMbBZI.js +0 -9
  235. package/apps/web/dist/assets/PublicRunner-D-JmtqCi.js +0 -1
  236. package/apps/web/dist/assets/ReadOnly-GAORKKqV.js +0 -1
  237. package/apps/web/dist/assets/SettingsPage-BKAiYmXl.js +0 -2
  238. package/apps/web/dist/assets/SetupPage-C1EZZHIp.js +0 -1
  239. package/apps/web/dist/assets/SkillEditor-CqQMg2MC.js +0 -1
  240. package/apps/web/dist/assets/Skills-CnhpgoOA.js +0 -9
  241. package/apps/web/dist/assets/SpacePage-CRR8JvV1.js +0 -2
  242. package/apps/web/dist/assets/UpdateCheck-CfXZBQNv.js +0 -2
  243. package/apps/web/dist/assets/changelog-6MqC8Vy8.js +0 -1
  244. package/apps/web/dist/assets/circle-alert-C8Ma-bPY.js +0 -1
  245. package/apps/web/dist/assets/circle-check-Bu9Z3mlJ.js +0 -1
  246. package/apps/web/dist/assets/code-editor-CfTGqOpp.js +0 -2
  247. package/apps/web/dist/assets/code-xml-B4kLFZSj.js +0 -1
  248. package/apps/web/dist/assets/connection-sign-in-B2D0O8W-.js +0 -1
  249. package/apps/web/dist/assets/dist-EBVTpvRr.js +0 -10
  250. package/apps/web/dist/assets/eye-BpoKpIdt.js +0 -1
  251. package/apps/web/dist/assets/host-BlKXX7YK.js +0 -118
  252. package/apps/web/dist/assets/i18n-BJ7Ld6O6.js +0 -55
  253. package/apps/web/dist/assets/index-66tE1oti.js +0 -10
  254. package/apps/web/dist/assets/index-D18DvnxX.css +0 -1
  255. package/apps/web/dist/assets/oss-credits-IdX5bc71.js +0 -1
  256. package/apps/web/dist/assets/phone-Ctvf-Am-.js +0 -1
  257. package/apps/web/dist/assets/read-aloud-Da_RSm2S.js +0 -1
  258. package/apps/web/dist/assets/scroll-text-ChrjRu9Y.js +0 -1
  259. package/apps/web/dist/assets/session-SXPtTWRK.js +0 -2
  260. package/apps/web/dist/assets/theme-Br1S0j5h.js +0 -11
  261. package/apps/web/dist/assets/ui-Uqnx1UpK.js +0 -82
  262. package/apps/web/dist/assets/upload-BchUnQGV.js +0 -1
  263. package/apps/web/dist/assets/volume-2-CU_oy81Z.js +0 -1
@@ -281,6 +281,118 @@
281
281
  "when": 1793411368904,
282
282
  "tag": "0039_members_studio",
283
283
  "breakpoints": true
284
+ },
285
+ {
286
+ "idx": 40,
287
+ "version": "6",
288
+ "when": 1793462355176,
289
+ "tag": "0040_rwx_elements",
290
+ "breakpoints": true
291
+ },
292
+ {
293
+ "idx": 41,
294
+ "version": "6",
295
+ "when": 1793462415359,
296
+ "tag": "0041_broker_log_client",
297
+ "breakpoints": true
298
+ },
299
+ {
300
+ "idx": 42,
301
+ "version": "6",
302
+ "when": 1793483673049,
303
+ "tag": "0042_client_spaces",
304
+ "breakpoints": true
305
+ },
306
+ {
307
+ "idx": 43,
308
+ "version": "6",
309
+ "when": 1793484500603,
310
+ "tag": "0043_space_member_invite",
311
+ "breakpoints": true
312
+ },
313
+ {
314
+ "idx": 44,
315
+ "version": "6",
316
+ "when": 1793522503369,
317
+ "tag": "0044_client_portal",
318
+ "breakpoints": true
319
+ },
320
+ {
321
+ "idx": 45,
322
+ "version": "6",
323
+ "when": 1793524595925,
324
+ "tag": "0045_client_portal_no_slug",
325
+ "breakpoints": true
326
+ },
327
+ {
328
+ "idx": 46,
329
+ "version": "6",
330
+ "when": 1793528832589,
331
+ "tag": "0046_space_file_hash",
332
+ "breakpoints": true
333
+ },
334
+ {
335
+ "idx": 47,
336
+ "version": "6",
337
+ "when": 1793530627348,
338
+ "tag": "0047_knowledge_folders",
339
+ "breakpoints": true
340
+ },
341
+ {
342
+ "idx": 48,
343
+ "version": "6",
344
+ "when": 1793530918731,
345
+ "tag": "0048_space_chunk_kind",
346
+ "breakpoints": true
347
+ },
348
+ {
349
+ "idx": 49,
350
+ "version": "6",
351
+ "when": 1793531418985,
352
+ "tag": "0049_knowledge_sources",
353
+ "breakpoints": true
354
+ },
355
+ {
356
+ "idx": 50,
357
+ "version": "6",
358
+ "when": 1793532546956,
359
+ "tag": "0050_dateien",
360
+ "breakpoints": true
361
+ },
362
+ {
363
+ "idx": 51,
364
+ "version": "6",
365
+ "when": 1793533776814,
366
+ "tag": "0051_dateien_drafts",
367
+ "breakpoints": true
368
+ },
369
+ {
370
+ "idx": 52,
371
+ "version": "6",
372
+ "when": 1793534570691,
373
+ "tag": "0052_dateien_plugin_kinds",
374
+ "breakpoints": true
375
+ },
376
+ {
377
+ "idx": 53,
378
+ "version": "6",
379
+ "when": 1793547992117,
380
+ "tag": "0053_dateien_file_title",
381
+ "breakpoints": true
382
+ },
383
+ {
384
+ "idx": 54,
385
+ "version": "6",
386
+ "when": 1793554001311,
387
+ "tag": "0054_dateien_ocr",
388
+ "breakpoints": true
389
+ },
390
+ {
391
+ "idx": 55,
392
+ "version": "6",
393
+ "when": 1793556126014,
394
+ "tag": "0055_dateien_doc_reread",
395
+ "breakpoints": true
284
396
  }
285
397
  ]
286
398
  }
@@ -43,9 +43,43 @@ export const space = sqliteTable("space", {
43
43
  */
44
44
  origin: text("origin", { enum: ["local"] }),
45
45
  syncedAt: integer("synced_at", { mode: "timestamp_ms" }),
46
+ /**
47
+ * `client`: a client space under `parentId` (docs/plans/client-spaces.md): one client's data,
48
+ * results and chats, reading the parent's setup. `space`: a space of the organization.
49
+ */
50
+ kind: text("kind", { enum: ["space", "client"] })
51
+ .notNull()
52
+ .default("space"),
53
+ /** The space a client space belongs to; null for a space. Two levels, never more. */
54
+ parentId: text("parent_id").references(() => space.id, {
55
+ onDelete: "cascade",
56
+ }),
46
57
  createdAt: createdAt(),
47
58
  updatedAt: updatedAt(),
48
- }, (t) => [index("space_tenant").on(t.tenantId)]);
59
+ }, (t) => [index("space_tenant").on(t.tenantId), index("space_parent").on(t.parentId)]);
60
+ /**
61
+ * Who of the organization is in a client space (docs/plans/client-spaces.md): `client`, the
62
+ * client's own people, who see only the client spaces they are in; `member`, the firm's people
63
+ * assigned to it. The firm's members see every client space of their space all the same until a
64
+ * space turns "assigned only" on.
65
+ */
66
+ export const spaceMember = sqliteTable("space_member", {
67
+ id: text("id").primaryKey(),
68
+ tenantId: text("tenant_id").notNull(),
69
+ spaceId: text("space_id")
70
+ .notNull()
71
+ .references(() => space.id, { onDelete: "cascade" }),
72
+ /** Null while the person is invited and has not signed in yet. */
73
+ userId: text("user_id"),
74
+ /** The address an invitation went to: the person is found by it on their first sign-in. */
75
+ email: text("email"),
76
+ role: text("role", { enum: ["member", "client"] }).notNull(),
77
+ addedBy: text("added_by").notNull(),
78
+ createdAt: createdAt(),
79
+ }, (t) => [
80
+ uniqueIndex("space_member_key").on(t.spaceId, t.userId),
81
+ index("space_member_user").on(t.userId),
82
+ ]);
49
83
  export const wizard = sqliteTable("wizard", {
50
84
  id: text("id").primaryKey(),
51
85
  spaceId: text("space_id")
@@ -177,6 +211,19 @@ export const run = sqliteTable("run", {
177
211
  */
178
212
  deviceOffer: text("device_offer", { mode: "json" }).$type(),
179
213
  costMicros: integer("cost_micros").notNull().default(0),
214
+ /**
215
+ * The client space a run was started in (docs/plans/client-portal.md): the wizard is its
216
+ * parent's, the run's data and results belong to the client space. Null: a run of its
217
+ * wizard's space.
218
+ */
219
+ clientSpaceId: text("client_space_id").references(() => space.id, {
220
+ onDelete: "cascade",
221
+ }),
222
+ /**
223
+ * When the firm shared the run with the client space's clients, on purpose; null: it stays
224
+ * the firm's. A client's own runs need none.
225
+ */
226
+ clientSharedAt: integer("client_shared_at", { mode: "timestamp_ms" }),
180
227
  /** Set once the result is shared: `/s/<token>` shows it read-only. */
181
228
  shareToken: text("share_token"),
182
229
  sharedAt: integer("shared_at", { mode: "timestamp_ms" }),
@@ -190,6 +237,7 @@ export const run = sqliteTable("run", {
190
237
  index("run_wizard").on(t.wizardId, t.createdAt),
191
238
  index("run_visitor").on(t.visitorId, t.createdAt),
192
239
  index("run_status").on(t.status),
240
+ index("run_client_space").on(t.clientSpaceId, t.createdAt),
193
241
  ]);
194
242
  export const runEvent = sqliteTable("run_event", {
195
243
  id: integer("id").primaryKey({ autoIncrement: true }),
@@ -273,21 +321,31 @@ export const spaceConnector = sqliteTable("space_connector", {
273
321
  }, (t) => [primaryKey({ columns: [t.spaceId, t.id] })]);
274
322
  /**
275
323
  * What a space holds for all its wizards: logos, assets (images, graphics, videos) and
276
- * documents. `id` is the asset the content lives in. The first logo is the one end users see.
324
+ * documents. Its bytes are a blob, by `hash` (files/blobs.ts): the same bytes in Marke and in
325
+ * Wissen are stored once. The first logo is the one end users see.
277
326
  */
278
327
  export const spaceFile = sqliteTable("space_file", {
279
328
  id: text("id").primaryKey(),
280
329
  spaceId: text("space_id")
281
330
  .notNull()
282
331
  .references(() => space.id, { onDelete: "cascade" }),
283
- kind: text("kind", { enum: ["logo", "asset", "document", "pattern"] }).notNull(),
332
+ kind: text("kind", { enum: ["logo", "asset", "document", "pattern", "picture"] }).notNull(),
284
333
  name: text("name").notNull(),
285
334
  mime: text("mime").notNull(),
286
335
  size: integer("size").notNull(),
336
+ /** sha256 of its bytes. Null on a file from before 0.16 until `wizards move-files` moved it. */
337
+ hash: text("hash"),
287
338
  description: text("description").notNull().default(""),
288
339
  /** A web address the file was fetched from, when it was not uploaded. */
289
340
  source: text("source"),
290
341
  position: integer("position").notNull().default(0),
342
+ /**
343
+ * A document's folder in Knowledge: the page it sits in, null at the top. Its path
344
+ * (`files/<name>`) does not follow it. Its folder deleted, it goes to the top.
345
+ */
346
+ parentId: text("parent_id").references(() => spacePage.id, {
347
+ onDelete: "set null",
348
+ }),
291
349
  /** `pending` while it is read, described and indexed. */
292
350
  status: text("status", { enum: ["pending", "ready", "failed"] })
293
351
  .notNull()
@@ -308,6 +366,7 @@ export const spaceFile = sqliteTable("space_file", {
308
366
  }, (t) => [
309
367
  index("space_file_space").on(t.spaceId, t.kind, t.position),
310
368
  uniqueIndex("space_file_origin").on(t.spaceId, t.origin, t.originKey),
369
+ index("space_file_hash").on(t.hash),
311
370
  ]);
312
371
  /**
313
372
  * The index of Knowledge: one unit per section of a page, row of a table, file, summary of a
@@ -351,6 +410,11 @@ export const spaceChunk = sqliteTable("space_chunk", {
351
410
  embedding: blob("embedding", { mode: "buffer" }),
352
411
  /** The model the vector was made with; only vectors of one model are compared. */
353
412
  model: text("model"),
413
+ /**
414
+ * Null: the vector is of the text. `image`: of a picture file, `page`: of a picture of a PDF
415
+ * page (`sheet`); the text is what the words find them by.
416
+ */
417
+ kind: text("kind").$type(),
354
418
  }, (t) => [
355
419
  index("space_chunk_space").on(t.spaceId, t.model),
356
420
  index("space_chunk_file").on(t.fileId),
@@ -360,6 +424,156 @@ export const spaceChunk = sqliteTable("space_chunk", {
360
424
  index("space_chunk_table").on(t.tableId),
361
425
  index("space_chunk_value").on(t.valueId),
362
426
  ]);
427
+ export const spaceMount = sqliteTable("space_mount", {
428
+ id: text("id").primaryKey(),
429
+ tenantId: text("tenant_id").notNull(),
430
+ spaceId: text("space_id")
431
+ .notNull()
432
+ .references(() => space.id, { onDelete: "cascade" }),
433
+ name: text("name").notNull(),
434
+ /** Its name in a wizard's path (`dateien/<slug>/…`), unique in the space. */
435
+ slug: text("slug").notNull(),
436
+ /** Where it lives: `folder` on this computer, else a kind of the plugin (`s3`). */
437
+ kind: text("kind").notNull(),
438
+ /** The plugin that brings the kind; null for a folder of this computer. */
439
+ plugin: text("plugin"),
440
+ /** What the kind needs to reach it: a folder's `path`, or what the plugin's kind kept. */
441
+ source: text("source", { mode: "json" }).$type().notNull(),
442
+ /** Where it lives, in one line for the studio: a path, `s3://bucket/prefix/`. */
443
+ location: text("location"),
444
+ /** Where the source's changes go on from, as its reader said it last. */
445
+ cursor: text("cursor"),
446
+ /** `scanning` while it is listed and read, `away` while its source can't be reached. */
447
+ status: text("status", { enum: ["scanning", "ready", "away"] })
448
+ .notNull()
449
+ .default("scanning"),
450
+ error: text("error"),
451
+ /** When the whole tree was last listed against the rows. */
452
+ scannedAt: integer("scanned_at", { mode: "timestamp_ms" }),
453
+ /**
454
+ * Whether its files may be changed: drafts written back with „Veröffentlichen“. Off unless
455
+ * allowed when mounting or in its settings; who may then is the broker's `w` on the mount.
456
+ */
457
+ writable: integer("writable", { mode: "boolean" }).notNull().default(false),
458
+ /** A category whose value for a file is the folder of the first level it lies in. */
459
+ folderCategoryId: text("folder_category_id").references(() => spaceCategory.id, { onDelete: "set null" }),
460
+ createdBy: text("created_by"),
461
+ createdAt: createdAt(),
462
+ updatedAt: updatedAt(),
463
+ }, (t) => [uniqueIndex("space_mount_slug").on(t.spaceId, t.slug)]);
464
+ /**
465
+ * A file of a mount: where it is, its fingerprint (size and time, its hash), how far it is
466
+ * indexed. Its row stays when it moves or is renamed (found again by its hash), so its
467
+ * categories do.
468
+ */
469
+ export const spaceMountFile = sqliteTable("space_mount_file", {
470
+ id: text("id").primaryKey(),
471
+ mountId: text("mount_id")
472
+ .notNull()
473
+ .references(() => spaceMount.id, { onDelete: "cascade" }),
474
+ spaceId: text("space_id")
475
+ .notNull()
476
+ .references(() => space.id, { onDelete: "cascade" }),
477
+ /** Its path in the mount, with `/`: `Kunden/A1/angebot.pdf`. */
478
+ path: text("path").notNull(),
479
+ /** The source's own id of it, where it keeps one across a move (a drive's): the row follows it. */
480
+ sourceId: text("source_id"),
481
+ name: text("name").notNull(),
482
+ mime: text("mime").notNull(),
483
+ size: integer("size").notNull(),
484
+ /** The source's time of its last change, in milliseconds. */
485
+ modified: integer("modified").notNull(),
486
+ /** sha256 of its bytes, once read. */
487
+ hash: text("hash"),
488
+ /** `pending` until read; `ready` indexed; `skipped` kept out of the index (too large, no text). */
489
+ status: text("status", { enum: ["pending", "ready", "skipped", "failed"] })
490
+ .notNull()
491
+ .default("pending"),
492
+ error: text("error"),
493
+ pages: integer("pages"),
494
+ /** What its text calls itself: a front matter's `title:` or its first heading. */
495
+ title: text("title"),
496
+ /** Whether a thumbnail stands at `derived/m/<mount>/<id>.jpg`. */
497
+ thumb: integer("thumb", { mode: "boolean" }).notNull().default(false),
498
+ createdAt: createdAt(),
499
+ updatedAt: updatedAt(),
500
+ }, (t) => [
501
+ uniqueIndex("space_mount_file_path").on(t.mountId, t.path),
502
+ index("space_mount_file_hash").on(t.mountId, t.hash),
503
+ index("space_mount_file_source").on(t.mountId, t.sourceId),
504
+ index("space_mount_file_status").on(t.mountId, t.status),
505
+ ]);
506
+ /**
507
+ * A unit of a mounted file's index, without its text: where it stands in the file's text
508
+ * (`start`, `end`) or which page it shows, and its vector. Its words are in two contentless FTS5
509
+ * tables (`space_mount_unit_fts`, `space_mount_unit_tri`, rowid = id), written when the file is
510
+ * read; a snippet reads the original again.
511
+ */
512
+ export const spaceMountUnit = sqliteTable("space_mount_unit", {
513
+ id: integer("id").primaryKey({ autoIncrement: true }),
514
+ spaceId: text("space_id")
515
+ .notNull()
516
+ .references(() => space.id, { onDelete: "cascade" }),
517
+ mountId: text("mount_id")
518
+ .notNull()
519
+ .references(() => spaceMount.id, { onDelete: "cascade" }),
520
+ fileId: text("file_id")
521
+ .notNull()
522
+ .references(() => spaceMountFile.id, { onDelete: "cascade" }),
523
+ idx: integer("idx").notNull(),
524
+ /** The section's headings, joined by " › ". */
525
+ heading: text("heading"),
526
+ /** The page of the original it starts on, or the page a `page` unit shows. */
527
+ sheet: integer("sheet"),
528
+ /** Where its passage stands in the file's text, in characters; null for a picture. */
529
+ start: integer("start"),
530
+ end: integer("end"),
531
+ embedding: blob("embedding", { mode: "buffer" }),
532
+ model: text("model"),
533
+ /** Null: the vector is of the text. `image`: of the picture file, `page`: of a PDF page. */
534
+ kind: text("kind").$type(),
535
+ }, (t) => [
536
+ index("space_mount_unit_file").on(t.fileId),
537
+ index("space_mount_unit_space").on(t.spaceId, t.model),
538
+ ]);
539
+ /**
540
+ * A draft of a mounted file: an edit kept in engenty until „Veröffentlichen“ writes it to the
541
+ * source. `base` is the file as it was read when the edit began; the source changed since, the
542
+ * write is refused and `conflict` holds what stands there now. A text file's draft keeps its
543
+ * text and the text it was read as (for the merge); a replaced file keeps its bytes by hash.
544
+ */
545
+ export const spaceMountDraft = sqliteTable("space_mount_draft", {
546
+ id: text("id").primaryKey(),
547
+ spaceId: text("space_id")
548
+ .notNull()
549
+ .references(() => space.id, { onDelete: "cascade" }),
550
+ mountId: text("mount_id")
551
+ .notNull()
552
+ .references(() => spaceMount.id, { onDelete: "cascade" }),
553
+ fileId: text("file_id")
554
+ .notNull()
555
+ .references(() => spaceMountFile.id, { onDelete: "cascade" }),
556
+ /** The file as it was read: its entry at the source and the sha256 of its bytes. */
557
+ base: text("base", { mode: "json" })
558
+ .$type()
559
+ .notNull(),
560
+ /** The draft's text, for a text file. */
561
+ text: text("text"),
562
+ /** The text the file had when it was read, for the merge with a change at the source. */
563
+ baseText: text("base_text"),
564
+ /** The draft's bytes by hash (blobs/), for a file replaced by an upload. */
565
+ blob: text("blob"),
566
+ mime: text("mime"),
567
+ /** What stands at the source now, where it changed since `base`; its text for a text file. */
568
+ conflict: text("conflict", { mode: "json" }).$type(),
569
+ createdBy: text("created_by"),
570
+ updatedBy: text("updated_by"),
571
+ createdAt: createdAt(),
572
+ updatedAt: updatedAt(),
573
+ }, (t) => [
574
+ uniqueIndex("space_mount_draft_file").on(t.fileId),
575
+ index("space_mount_draft_mount").on(t.mountId),
576
+ ]);
363
577
  // --- The space's data -------------------------------------------------------
364
578
  // Tables and pages a space keeps, its own or one of its wizards'. Shared by everyone who works
365
579
  // in the space, unlike the wizard's store below, which belongs to one person.
@@ -382,6 +596,15 @@ export const spaceTable = sqliteTable("space_table", {
382
596
  title: text("title").notNull(),
383
597
  /** Its name in a path (`tables/<slug>`), unique among the space's tables. */
384
598
  slug: text("slug"),
599
+ /**
600
+ * Its folder in Knowledge: the page it sits in, null at the top. Its path does not follow it.
601
+ * Its folder deleted, it goes to the top.
602
+ */
603
+ parentId: text("parent_id").references(() => spacePage.id, {
604
+ onDelete: "set null",
605
+ }),
606
+ /** Its place among its folder's contents, pages and files among them. */
607
+ position: integer("position").notNull().default(0),
385
608
  /** `faq`: a question and its answer per row. */
386
609
  format: text("format", { enum: ["faq"] }),
387
610
  columns: text("columns", { mode: "json" }).$type().notNull(),
@@ -402,7 +625,7 @@ export const spaceTable = sqliteTable("space_table", {
402
625
  updatedAt: updatedAt(),
403
626
  }, (t) => [
404
627
  index("space_table_space").on(t.spaceId, t.wizardId),
405
- uniqueIndex("space_table_list").on(t.wizardId, t.list),
628
+ uniqueIndex("space_table_list").on(t.spaceId, t.wizardId, t.list),
406
629
  uniqueIndex("space_table_origin").on(t.spaceId, t.origin, t.originKey),
407
630
  ]);
408
631
  /** A row of a table: cells by column id. Rows stand in the order they were added. */
@@ -460,6 +683,67 @@ export const spacePage = sqliteTable("space_page", {
460
683
  index("space_page_parent").on(t.parentId, t.position),
461
684
  uniqueIndex("space_page_origin").on(t.spaceId, t.origin, t.originKey),
462
685
  ]);
686
+ export const spaceSource = sqliteTable("space_source", {
687
+ id: text("id").primaryKey(),
688
+ tenantId: text("tenant_id").notNull(),
689
+ spaceId: text("space_id")
690
+ .notNull()
691
+ .references(() => space.id, { onDelete: "cascade" }),
692
+ /** The kind a plugin registered: `website`, `sitemap`, `urls`. */
693
+ kind: text("kind").notNull(),
694
+ /** The plugin that brings the kind; its reader reads the source. */
695
+ plugin: text("plugin").notNull(),
696
+ address: text("address").notNull(),
697
+ label: text("label").notNull(),
698
+ state: text("state", { enum: ["proposed", "taken"] }).notNull(),
699
+ rules: text("rules", { mode: "json" }).$type().notNull(),
700
+ categories: text("categories", { mode: "json" }).$type().notNull(),
701
+ /** Read again every so many hours; null: only when asked. */
702
+ everyHours: integer("every_hours"),
703
+ /** What a signal address of the kind names the source by. */
704
+ token: text("token").notNull(),
705
+ status: text("status", { enum: ["idle", "running", "failed"] }).notNull(),
706
+ error: text("error"),
707
+ lastRunAt: integer("last_run_at", { mode: "timestamp_ms" }),
708
+ createdAt: createdAt(),
709
+ updatedAt: updatedAt(),
710
+ }, (t) => [index("space_source_space").on(t.spaceId), uniqueIndex("space_source_token").on(t.token)]);
711
+ /** One entry a source holds: an address, whether it is in, and what it became. */
712
+ export const spaceSourceEntry = sqliteTable("space_source_entry", {
713
+ id: text("id").primaryKey(),
714
+ sourceId: text("source_id")
715
+ .notNull()
716
+ .references(() => spaceSource.id, { onDelete: "cascade" }),
717
+ address: text("address").notNull(),
718
+ title: text("title"),
719
+ /** Where it stands below the source's folder: the folders' names, outermost first. */
720
+ path: text("path", { mode: "json" }).$type().notNull(),
721
+ included: integer("included", { mode: "boolean" }).notNull(),
722
+ reason: text("reason"),
723
+ decidedBy: text("decided_by", { enum: ["rule", "model", "person"] }),
724
+ status: text("status", { enum: ["new", "done", "check", "failed", "kept"] }).notNull(),
725
+ /** The key it was written under: `e:<id>`, or `dir:<path>` for the text of a folder. */
726
+ itemKey: text("item_key"),
727
+ result: text("result", { mode: "json" }).$type(),
728
+ note: text("note"),
729
+ fingerprint: text("fingerprint"),
730
+ updatedAt: updatedAt(),
731
+ }, (t) => [uniqueIndex("space_source_entry_address").on(t.sourceId, t.address)]);
732
+ /** A run of a source: what it wrote, kept unchanged, failed on and left out, and its log. */
733
+ export const spaceSourceRun = sqliteTable("space_source_run", {
734
+ id: text("id").primaryKey(),
735
+ sourceId: text("source_id")
736
+ .notNull()
737
+ .references(() => spaceSource.id, { onDelete: "cascade" }),
738
+ startedAt: integer("started_at", { mode: "timestamp_ms" }).notNull(),
739
+ endedAt: integer("ended_at", { mode: "timestamp_ms" }),
740
+ status: text("status", { enum: ["running", "done", "failed", "stopped"] }).notNull(),
741
+ written: integer("written").notNull(),
742
+ unchanged: integer("unchanged").notNull(),
743
+ failed: integer("failed").notNull(),
744
+ leftOut: integer("left_out").notNull(),
745
+ log: text("log", { mode: "json" }).$type().notNull(),
746
+ }, (t) => [index("space_source_run_source").on(t.sourceId, t.startedAt)]);
463
747
  // --- Categories -----------------------------------------------------------------
464
748
  // Typed properties that run across Knowledge: set on pages, rows, tables and files, any number of
465
749
  // each, so a step filters before it searches.
@@ -505,7 +789,7 @@ export const spaceCategoryValue = sqliteTable("space_category_value", {
505
789
  createdAt: createdAt(),
506
790
  }, (t) => [uniqueIndex("space_category_value_value").on(t.categoryId, t.value)]);
507
791
  /**
508
- * A category set on an item: exactly one of page, row, table and file. A choice points to its
792
+ * A category set on an item: exactly one of page, row, table, file and mounted file. A choice points to its
509
793
  * value; the other types keep theirs typed: a date as milliseconds, a number, a short text, yes
510
794
  * or no. A choice with several values has a row per value.
511
795
  */
@@ -521,6 +805,10 @@ export const spaceItemCategory = sqliteTable("space_item_category", {
521
805
  rowId: text("row_id").references(() => spaceTableRow.id, { onDelete: "cascade" }),
522
806
  tableId: text("table_id").references(() => spaceTable.id, { onDelete: "cascade" }),
523
807
  fileId: text("file_id").references(() => spaceFile.id, { onDelete: "cascade" }),
808
+ /** A file of a mount in Dateien: the space's categories hold for those too. */
809
+ mountFileId: text("mount_file_id").references(() => spaceMountFile.id, {
810
+ onDelete: "cascade",
811
+ }),
524
812
  valueId: text("value_id").references(() => spaceCategoryValue.id, { onDelete: "cascade" }),
525
813
  text: text("text"),
526
814
  num: real("num"),
@@ -536,6 +824,7 @@ export const spaceItemCategory = sqliteTable("space_item_category", {
536
824
  index("space_item_category_row").on(t.rowId),
537
825
  index("space_item_category_table").on(t.tableId),
538
826
  index("space_item_category_file").on(t.fileId),
827
+ index("space_item_category_mount_file").on(t.mountFileId),
539
828
  ]);
540
829
  // --- Skills -------------------------------------------------------------------------
541
830
  // Instructions in the Agent Skills format the space's wizards follow (docs/plans/skills.md):
@@ -840,6 +1129,8 @@ export const brokerLog = sqliteTable("broker_log", {
840
1129
  runId: text("run_id"),
841
1130
  /** The step of the run that called; null outside a step. */
842
1131
  stepId: text("step_id"),
1132
+ /** The outside client that called, as it names itself (an MCP client, `x-wizards-client`); null inside the runtime. */
1133
+ client: text("client"),
843
1134
  chatId: text("chat_id"),
844
1135
  wizardId: text("wizard_id"),
845
1136
  spaceId: text("space_id"),
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: The API
3
3
  description: What a program may rely on when it talks to a runtime, and what is private.
4
- version: 0.7.7
4
+ version: 0.15.0
5
5
  ---
6
6
 
7
7
  A runtime answers HTTP under `/api`. Three parts are a contract: they are versioned, documented
@@ -12,9 +12,56 @@ and change with notice. Everything else is the studio’s own and changes withou
12
12
  | Part | For | Signed in as |
13
13
  |---|---|---|
14
14
  | `/api/v1/…` | programs that build and publish wizards: the spaces of a local install, importing a wizard | an access token of the account, with scopes (`wizards:read`, `wizards:write`, `wizards:publish`, `runs:test`); see [the Manage-App contract](https://github.com/engenty/engenty-wizards/blob/main/docs/manage-contract.md) |
15
- | `/api/mcp` | AI apps: every tool of [the MCP server](../user-guide/ai-apps.md) | the same tokens, or the local ticket `wizards mcp` carries |
15
+ | `/api/v1/spaces/:spaceId/elements` | programs that use a space: search its knowledge, read its skills, call its connections, run its wizards (see below) | the same tokens, with `data:read`, `elements:read`, `elements:run` |
16
+ | `/api/v1/client/…` | apps for a firm’s clients, like the client portal: their client spaces, what waits for them, chats, files, results, the wizards opened to them (see below) | a token of a person with the role `client`, with `data:read`, `elements:read`, `elements:run` |
17
+ | `/api/mcp` | AI apps: every tool of [the MCP server](../user-guide/ai-apps.md), the space’s elements among them | the same tokens, or the local ticket `wizards mcp` carries |
16
18
  | The public run API: `/api/public/wizards/:token`, `/api/public/wizards/:token/runs`, `/api/public/codes/:code`, `/api/runs/:id/…` | running a published wizard by its link: what the runner in a browser does | nobody; a visitor cookie, or the `x-wizards-visitor` header where a cookie does not survive |
17
19
 
20
+ ## A space’s elements
21
+
22
+ What Studio makes in a space – its knowledge, skills, connections and published wizards – is open
23
+ to programs and AI apps the way a Work chat uses it, as the person the token belongs to.
24
+ `GET /api/v1/spaces/:spaceId/elements` lists the calls the token may make, each with its scope
25
+ and its input as JSON Schema. `POST /api/v1/spaces/:spaceId/elements/:name` with
26
+ `{ "input": { … } }` makes one and answers `{ "result": … }`, or an error with why. The MCP
27
+ server has the same calls as tools, each with a `spaceId`.
28
+
29
+ | Call | Scope | Does |
30
+ |---|---|---|
31
+ | `space_search`, `space_list`, `page_read`, `table_read`, `space_document` | `data:read` | Search and read the space’s knowledge |
32
+ | `skill_list`, `skill_load`, `skill_read` | `elements:read` | Read the space’s skills |
33
+ | `connection_list`, `wizard_list` | `elements:read` | Name the connections' actions and the published wizards |
34
+ | `connection_call`, `wizard_run`, `run_command` | `elements:run` | Call an action, run a wizard, run a skill’s scripts in a sandbox of the space |
35
+
36
+ The space’s rules decide every call, and each is a line of the broker’s log with the client’s
37
+ name (`x-wizards-client`, or the MCP client’s). A space outside the token’s organization is
38
+ refused. A write, a send or a delete on a connection runs only where the space allows it without a
39
+ person’s yes.
40
+
41
+ ## A client’s client spaces
42
+
43
+ A firm works for its clients in client spaces under its space. A client of the organization signs
44
+ in with an account of their own and reaches only the client spaces they are in. The client
45
+ portal (`<team>.wizards.page/portal`) is built on these calls alone, so another app can offer the
46
+ same. `GET /api/v1/client` lists them with their inputs as JSON Schema. A call is
47
+ `POST /api/v1/client/:name`, or `POST /api/v1/client/spaces/:spaceId/:name` for one client space,
48
+ with `{ "input": { … } }`; it answers `{ "result": … }`, or an error with why.
49
+
50
+ | Call | Scope | Gives |
51
+ |---|---|---|
52
+ | `me`, `spaces` | `data:read` | Who you are, your organization, your client spaces with their address (`slug`) and the firm’s brand |
53
+ | `for_you` | `data:read` | Your runs waiting on a page or an answer, the results the firm shared, the wizards you can start |
54
+ | `wizards`, `wizard_start` | `elements:read`, `elements:run` | The firm’s wizards opened to clients, each with its engenty (`avatar`) and its number of steps; a start runs it in your client space |
55
+ | `results`, `run_open` | `data:read` | Your finished runs and those the firm shared; a ticket for one run’s own routes (`/api/runs/:id/…?rt=…`) |
56
+ | `chats`, `chat_messages` | `data:read` | Your chats in the client space and their messages: each message’s `parts` in the order they were written, its text and the views and runs of the firm’s AI as cards |
57
+ | `chat_post` | `elements:run` | Writes in one of your chats, or starts one. The firm’s AI answers every message as you, with the client space’s Knowledge, the wizards opened to you and views; the firm’s people read the chat too |
58
+ | `files` | `data:read` | The client space’s files. One file’s bytes: `GET /api/v1/client/spaces/:spaceId/files/:fileId` |
59
+
60
+ Only a person with the role `client` gets an answer (`403 clients_only` otherwise). A space that is
61
+ not one of yours answers `404`. The firm’s Knowledge and wizards reach you only where the firm
62
+ opened them to clients, and a run the firm makes in your client space only once it is shared with
63
+ you. The calls need the organization’s `clientSpaces` switch.
64
+
18
65
  ## Private
19
66
 
20
67
  `/api/studio/…`, `/api/auth/…` and `/api/internal/…` belong to the studio, the sign-in and the
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: Architecture
3
3
  description: How engenty wizards is built – the runtime and its roles, your computer and the cloud, tenants and spaces, the engine and its sandboxes, skills, plugins, the broker and the feature switches.
4
- version: 0.13.0
4
+ version: 0.15.0
5
5
  ---
6
6
 
7
7
  engenty wizards is one server program, the **runtime**, and one web app, the **studio**, that it
@@ -28,7 +28,8 @@ and whether it takes runs.
28
28
 
29
29
  | Role | Serves |
30
30
  |---|---|
31
- | `studio` | The makers’ half: sign-in, `/api/studio`, the authoring MCP server (`/api/mcp`), the sync from computers (`/api/v1`), `/install.sh`, the studio’s pages |
31
+ | `studio` | The makers’ half: sign-in, `/api/studio`, `/install.sh`, the studio’s pages. Until the cloud routes them to an `api` process, also what `api` serves |
32
+ | `api` | Outside clients: the MCP server (`/api/mcp`) and the API (`/api/v1`), the space’s elements among them, so they scale and fail apart from the studio |
32
33
  | `doors` | The customers’ half: `/api/public`, shared results, the plugins’ public routes and webhooks, `/embed.js`, the pages `/w/<token>` and `/s/<token>` |
33
34
  | `web` | Both halves |
34
35
  | `runner` | Takes the runs that wait and drives them. It serves the routes too, for what only the process holding a run can answer, such as its browser’s screen |
@@ -177,6 +178,16 @@ action and writes one line of the log. Model calls don’t pass it.
177
178
 
178
179
  ![Every caller goes through brokerCall, which checks the grant, the audience and the rule, then runs the action, asks first or refuses, and logs every call](../../assets/diagrams/architecture-broker.svg)
179
180
 
181
+ ## The tool catalogue
182
+
183
+ A space’s elements reach every AI through one list (`apps/runtime/src/elements/`): its knowledge,
184
+ its skills, its published wizards and, for outside clients, its connections. A wizard’s step, a
185
+ Work chat, Goose and the MCP and API clients take their tools from it, for a caller fixed before
186
+ a model sees a tool: no tool takes who calls or for whom. Every call goes through the broker’s
187
+ gate, which decides wizards (`x` to run), skills (`r` to read, `x` for their scripts) and a
188
+ space’s setup (`w`, Goose’s writes) by the RWX rules, and writes a line of the log with the
189
+ client’s name.
190
+
180
191
  ## Work mode
181
192
 
182
193
  Work mode has chats with the space’s AI (`services/work-chats.ts`, `services/work-ai.ts`,