@engenty/wizards-runtime 0.13.0 → 0.14.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 (313) hide show
  1. package/apps/runtime/dist/agents/architect.js +8 -7
  2. package/apps/runtime/dist/agents/goose-connections.js +82 -0
  3. package/apps/runtime/dist/agents/space-agent.js +9 -2
  4. package/apps/runtime/dist/agents/studio-assistant.js +101 -67
  5. package/apps/runtime/dist/agents/website.js +1 -1
  6. package/apps/runtime/dist/app.js +17 -1
  7. package/apps/runtime/dist/assistant/knows.js +6 -5
  8. package/apps/runtime/dist/authoring/guide.js +25 -5
  9. package/apps/runtime/dist/broker/account.js +166 -0
  10. package/apps/runtime/dist/broker/call.js +417 -0
  11. package/apps/runtime/dist/broker/caller.js +10 -0
  12. package/apps/runtime/dist/broker/grant.js +152 -0
  13. package/apps/runtime/dist/broker/host.js +51 -0
  14. package/apps/runtime/dist/broker/index.js +8 -0
  15. package/apps/runtime/dist/broker/kept.js +31 -0
  16. package/apps/runtime/dist/broker/log.js +240 -0
  17. package/apps/runtime/dist/broker/registry.js +9 -0
  18. package/apps/runtime/dist/broker/rwx.js +367 -0
  19. package/apps/runtime/dist/broker/send.js +189 -0
  20. package/apps/runtime/dist/connectors/builtin.js +1 -1
  21. package/apps/runtime/dist/connectors/external.js +38 -37
  22. package/apps/runtime/dist/connectors/index.js +30 -91
  23. package/apps/runtime/dist/connectors/mail.js +0 -8
  24. package/apps/runtime/dist/connectors/person-sign-ins.js +73 -0
  25. package/apps/runtime/dist/connectors/plugin-connections.js +65 -92
  26. package/apps/runtime/dist/connectors/smtp.js +1 -1
  27. package/apps/runtime/dist/connectors/space-connections.js +436 -0
  28. package/apps/runtime/dist/db/adopt.js +3 -3
  29. package/apps/runtime/dist/db/client.js +9 -0
  30. package/apps/runtime/dist/db/live-triggers.js +65 -23
  31. package/apps/runtime/dist/db/migrations/tenant/0027_work_chats.sql +52 -0
  32. package/apps/runtime/dist/db/migrations/tenant/0028_chat_approvals.sql +17 -0
  33. package/apps/runtime/dist/db/migrations/tenant/0029_work_chats_live.sql +49 -0
  34. package/apps/runtime/dist/db/migrations/tenant/0031_space.sql +624 -0
  35. package/apps/runtime/dist/db/migrations/tenant/0032_rwx_rule.sql +18 -0
  36. package/apps/runtime/dist/db/migrations/tenant/0033_broker_log.sql +23 -0
  37. package/apps/runtime/dist/db/migrations/tenant/0034_space_connection.sql +35 -0
  38. package/apps/runtime/dist/db/migrations/tenant/0035_run_grant.sql +1 -0
  39. package/apps/runtime/dist/db/migrations/tenant/0036_approval_held_for.sql +1 -0
  40. package/apps/runtime/dist/db/migrations/tenant/0037_ways_out.sql +5 -0
  41. package/apps/runtime/dist/db/migrations/tenant/0038_heard.sql +11 -0
  42. package/apps/runtime/dist/db/migrations/tenant/0039_members_studio.sql +1 -0
  43. package/apps/runtime/dist/db/migrations/tenant/meta/0027_snapshot.json +383 -155
  44. package/apps/runtime/dist/db/migrations/tenant/meta/0028_snapshot.json +4468 -0
  45. package/apps/runtime/dist/db/migrations/tenant/meta/0029_snapshot.json +4475 -0
  46. package/apps/runtime/dist/db/migrations/tenant/meta/0030_snapshot.json +4629 -0
  47. package/apps/runtime/dist/db/migrations/tenant/meta/0031_snapshot.json +4629 -0
  48. package/apps/runtime/dist/db/migrations/tenant/meta/0032_snapshot.json +4757 -0
  49. package/apps/runtime/dist/db/migrations/tenant/meta/0033_snapshot.json +5039 -0
  50. package/apps/runtime/dist/db/migrations/tenant/meta/0034_snapshot.json +5022 -0
  51. package/apps/runtime/dist/db/migrations/tenant/meta/0035_snapshot.json +5029 -0
  52. package/apps/runtime/dist/db/migrations/tenant/meta/0036_snapshot.json +5037 -0
  53. package/apps/runtime/dist/db/migrations/tenant/meta/0037_snapshot.json +5076 -0
  54. package/apps/runtime/dist/db/migrations/tenant/meta/0038_snapshot.json +5145 -0
  55. package/apps/runtime/dist/db/migrations/tenant/meta/0039_snapshot.json +5153 -0
  56. package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +86 -2
  57. package/apps/runtime/dist/db/schema.js +295 -72
  58. package/apps/runtime/dist/docs/dev/architecture.md +215 -0
  59. package/apps/runtime/dist/docs/dev/broker.md +298 -0
  60. package/apps/runtime/dist/docs/dev/index.md +5 -1
  61. package/apps/runtime/dist/docs/dev/integration/index.md +2 -0
  62. package/apps/runtime/dist/docs/dev/meta.json +3 -0
  63. package/apps/runtime/dist/docs/dev/plugins/connections.md +8 -5
  64. package/apps/runtime/dist/docs/dev/plugins/events.md +1 -1
  65. package/apps/runtime/dist/docs/dev/plugins/examples.md +1 -0
  66. package/apps/runtime/dist/docs/dev/plugins/index.md +2 -2
  67. package/apps/runtime/dist/docs/dev/plugins/reference.md +3 -2
  68. package/apps/runtime/dist/docs/dev/plugins/space.md +16 -6
  69. package/apps/runtime/dist/docs/dev/plugins/studio.md +2 -2
  70. package/apps/runtime/dist/docs/dev/plugins/tools.md +0 -1
  71. package/apps/runtime/dist/docs/dev/skills.md +16 -9
  72. package/apps/runtime/dist/docs/dev/wizard-format/agent-steps.md +40 -5
  73. package/apps/runtime/dist/docs/dev/wizard-format/lists-and-connections.md +17 -2
  74. package/apps/runtime/dist/docs/dev/wizard-format/templates.md +2 -0
  75. package/apps/runtime/dist/docs/dev/wizard-format/views-and-widgets.md +22 -2
  76. package/apps/runtime/dist/docs/user-guide/capabilities.md +132 -0
  77. package/apps/runtime/dist/docs/user-guide/cloud-sync.md +2 -0
  78. package/apps/runtime/dist/docs/user-guide/command-line.md +1 -0
  79. package/apps/runtime/dist/docs/user-guide/connectors.md +63 -7
  80. package/apps/runtime/dist/docs/user-guide/index.md +10 -1
  81. package/apps/runtime/dist/docs/user-guide/meta.json +6 -1
  82. package/apps/runtime/dist/docs/user-guide/protocol.md +80 -0
  83. package/apps/runtime/dist/docs/user-guide/skills.md +8 -4
  84. package/apps/runtime/dist/docs/user-guide/space.md +5 -4
  85. package/apps/runtime/dist/docs/user-guide/together.md +16 -2
  86. package/apps/runtime/dist/docs/user-guide/troubleshooting.md +2 -2
  87. package/apps/runtime/dist/docs/user-guide/work-mode.md +128 -0
  88. package/apps/runtime/dist/engenty/connections-external/build-connector.js +2 -5
  89. package/apps/runtime/dist/engenty/connections-external/importer/classify.js +72 -0
  90. package/apps/runtime/dist/engenty/connections-google/connectors/gmail.js +1 -1
  91. package/apps/runtime/dist/engenty/connections-microsoft/outlook.js +3 -2
  92. package/apps/runtime/dist/engenty/connections-sdk/types.js +2 -0
  93. package/apps/runtime/dist/engenty/connections-slack/connector.js +2 -1
  94. package/apps/runtime/dist/engine/resources.js +43 -12
  95. package/apps/runtime/dist/engine/runner.js +75 -23
  96. package/apps/runtime/dist/engine/steps.js +30 -12
  97. package/apps/runtime/dist/engine/template.js +18 -1
  98. package/apps/runtime/dist/env.js +9 -4
  99. package/apps/runtime/dist/index.js +18 -2
  100. package/apps/runtime/dist/live/feed.js +2 -2
  101. package/apps/runtime/dist/live/origin.js +2 -2
  102. package/apps/runtime/dist/live/views.js +51 -26
  103. package/apps/runtime/dist/manage.js +7 -0
  104. package/apps/runtime/dist/mcp/flow-app.js +1 -1
  105. package/apps/runtime/dist/mcp/tools.js +75 -34
  106. package/apps/runtime/dist/models.js +1 -1
  107. package/apps/runtime/dist/motion-graphics/project.js +8 -8
  108. package/apps/runtime/dist/motion-graphics/tools.js +1 -1
  109. package/apps/runtime/dist/plugins/events.js +2 -2
  110. package/apps/runtime/dist/plugins/jobs.js +4 -1
  111. package/apps/runtime/dist/plugins/loader.js +2 -2
  112. package/apps/runtime/dist/prompts/architect.md +3 -3
  113. package/apps/runtime/dist/prompts/authoring.md +46 -12
  114. package/apps/runtime/dist/prompts/goose.md +7 -7
  115. package/apps/runtime/dist/prompts/mcp.md +6 -6
  116. package/apps/runtime/dist/prompts/services.md +4 -4
  117. package/apps/runtime/dist/prompts/step.md +2 -2
  118. package/apps/runtime/dist/prompts/tools.md +39 -10
  119. package/apps/runtime/dist/routes/api.js +31 -20
  120. package/apps/runtime/dist/routes/broker.js +316 -0
  121. package/apps/runtime/dist/routes/connections.js +71 -0
  122. package/apps/runtime/dist/routes/delivery.js +25 -0
  123. package/apps/runtime/dist/routes/discover.js +17 -0
  124. package/apps/runtime/dist/routes/live.js +11 -1
  125. package/apps/runtime/dist/routes/person.js +4 -1
  126. package/apps/runtime/dist/routes/plugins.js +3 -1
  127. package/apps/runtime/dist/routes/rules.js +26 -0
  128. package/apps/runtime/dist/routes/runs.js +54 -33
  129. package/apps/runtime/dist/routes/skills.js +6 -6
  130. package/apps/runtime/dist/routes/studio.js +153 -144
  131. package/apps/runtime/dist/routes/work.js +199 -0
  132. package/apps/runtime/dist/sandbox/index.js +27 -0
  133. package/apps/runtime/dist/services/access.js +38 -17
  134. package/apps/runtime/dist/services/api.js +38 -13
  135. package/apps/runtime/dist/services/architect.js +3 -3
  136. package/apps/runtime/dist/services/assistant-chats.js +9 -1
  137. package/apps/runtime/dist/services/brand.js +12 -12
  138. package/apps/runtime/dist/services/broker-bell.js +69 -0
  139. package/apps/runtime/dist/services/broker-notify.js +127 -0
  140. package/apps/runtime/dist/services/client-steps.js +79 -0
  141. package/apps/runtime/dist/services/cloud.js +42 -42
  142. package/apps/runtime/dist/services/command-risk.js +51 -0
  143. package/apps/runtime/dist/services/discover.js +85 -0
  144. package/apps/runtime/dist/services/knowledge-model.js +13 -13
  145. package/apps/runtime/dist/services/knowledge.js +117 -80
  146. package/apps/runtime/dist/services/manage-reports.js +74 -7
  147. package/apps/runtime/dist/services/members-studio.js +165 -0
  148. package/apps/runtime/dist/services/onboarding.js +22 -22
  149. package/apps/runtime/dist/services/package-file.js +1 -1
  150. package/apps/runtime/dist/services/package.js +22 -22
  151. package/apps/runtime/dist/services/pages.js +7 -7
  152. package/apps/runtime/dist/services/runs.js +4 -3
  153. package/apps/runtime/dist/services/seen.js +55 -0
  154. package/apps/runtime/dist/services/shares.js +23 -13
  155. package/apps/runtime/dist/services/site.js +23 -23
  156. package/apps/runtime/dist/services/skills-registry.js +15 -15
  157. package/apps/runtime/dist/services/skills.js +44 -44
  158. package/apps/runtime/dist/services/space-categories.js +35 -35
  159. package/apps/runtime/dist/services/space-data.js +130 -111
  160. package/apps/runtime/dist/services/{project-files.js → space-files.js} +84 -75
  161. package/apps/runtime/dist/services/{project-index.js → space-index.js} +116 -73
  162. package/apps/runtime/dist/services/space-origin.js +19 -11
  163. package/apps/runtime/dist/services/spaces.js +478 -612
  164. package/apps/runtime/dist/services/synced-spaces.js +668 -0
  165. package/apps/runtime/dist/services/themes.js +15 -15
  166. package/apps/runtime/dist/services/widgets.js +6 -6
  167. package/apps/runtime/dist/services/wizards.js +112 -38
  168. package/apps/runtime/dist/services/work-ai.js +257 -0
  169. package/apps/runtime/dist/services/work-approvals.js +104 -0
  170. package/apps/runtime/dist/services/work-chats.js +908 -0
  171. package/apps/runtime/dist/services/work-connections.js +90 -0
  172. package/apps/runtime/dist/services/work-files.js +85 -0
  173. package/apps/runtime/dist/services/work-mastra.js +73 -0
  174. package/apps/runtime/dist/services/work-sandbox.js +42 -0
  175. package/apps/runtime/dist/sharing/files.js +14 -4
  176. package/apps/runtime/dist/sharing/index.js +40 -39
  177. package/apps/runtime/dist/sharing/jobs.js +67 -17
  178. package/apps/runtime/dist/sharing/targets/connector.js +10 -6
  179. package/apps/runtime/dist/sharing/targets/email.js +10 -8
  180. package/apps/runtime/dist/sharing/targets/slack.js +10 -8
  181. package/apps/runtime/dist/sharing/targets/storage.js +6 -4
  182. package/apps/runtime/dist/store/index.js +14 -3
  183. package/apps/runtime/dist/store/shared-lists.js +4 -2
  184. package/apps/runtime/dist/sync/apply.js +2 -2
  185. package/apps/runtime/dist/sync/client.js +113 -113
  186. package/apps/runtime/dist/sync/hub.js +41 -41
  187. package/apps/runtime/dist/sync/log.js +12 -12
  188. package/apps/runtime/dist/sync/records.js +118 -120
  189. package/apps/runtime/dist/texts.js +38 -2
  190. package/apps/runtime/dist/tools/connections.js +112 -0
  191. package/apps/runtime/dist/tools/connector.js +157 -67
  192. package/apps/runtime/dist/tools/index.js +28 -13
  193. package/apps/runtime/dist/tools/mail.js +40 -11
  194. package/apps/runtime/dist/tools/pages.js +11 -5
  195. package/apps/runtime/dist/tools/plugin.js +43 -7
  196. package/apps/runtime/dist/tools/skills.js +1 -1
  197. package/apps/runtime/dist/tools/{project.js → space.js} +30 -25
  198. package/apps/runtime/dist/tools/store.js +3 -2
  199. package/apps/runtime/dist/widgets/step.js +10 -10
  200. package/apps/web/dist/assets/AboutDialog-DgfeipUc.js +1 -0
  201. package/apps/web/dist/assets/CapabilitiesPage-BoYJvgIu.js +2 -0
  202. package/apps/web/dist/assets/{ChangelogDialog-SwyId00t.js → ChangelogDialog-Duab4zTO.js} +1 -1
  203. package/apps/web/dist/assets/{CodeEditor-BwZsk5Al.js → CodeEditor-nxoOt8ge.js} +1 -1
  204. package/apps/web/dist/assets/EditorPage-ZrgGpYMC.js +3 -0
  205. package/apps/web/dist/assets/{FlowPreview-DtSpjVTl.js → FlowPreview-aMfwcPul.js} +1 -1
  206. package/apps/web/dist/assets/LangSwitch-DpD0inR4.js +1 -0
  207. package/apps/web/dist/assets/Marketplace-CpzD9pNQ.js +2 -0
  208. package/apps/web/dist/assets/NewWizardChannels-IB18afWN.js +1 -0
  209. package/apps/web/dist/assets/NewWizardPage-rYbcmPGG.js +7 -0
  210. package/apps/web/dist/assets/OnboardingPage-ztHT01ah.js +1 -0
  211. package/apps/web/dist/assets/PreviewPane-DviWTLfi.js +9 -0
  212. package/apps/web/dist/assets/PublicRunner-C2geZhhM.js +1 -0
  213. package/apps/web/dist/assets/ReadOnly-kSb_Kbdm.js +1 -0
  214. package/apps/web/dist/assets/SettingsPage-DM2h8N0J.js +2 -0
  215. package/apps/web/dist/assets/SetupPage-Wfyz6xH4.js +1 -0
  216. package/apps/web/dist/assets/SharePage-CyWQorWB.js +1 -0
  217. package/apps/web/dist/assets/SkillEditor-CqQMg2MC.js +1 -0
  218. package/apps/web/dist/assets/Skills-CnhpgoOA.js +9 -0
  219. package/apps/web/dist/assets/SpacePage-q4Bk3N7k.js +2 -0
  220. package/apps/web/dist/assets/UpdateCheck-C2CE6CC3.js +2 -0
  221. package/apps/web/dist/assets/changelog-B6hN1Cp7.js +1 -0
  222. package/apps/web/dist/assets/circle-alert-C8Ma-bPY.js +1 -0
  223. package/apps/web/dist/assets/circle-check-Bu9Z3mlJ.js +1 -0
  224. package/apps/web/dist/assets/code-editor-CfTGqOpp.js +2 -0
  225. package/apps/web/dist/assets/{code-xml-TwKzzMtA.js → code-xml-B4kLFZSj.js} +1 -1
  226. package/apps/web/dist/assets/connection-sign-in-CIiv0t2p.js +1 -0
  227. package/apps/web/dist/assets/esm-Xwn4GtqG.js +7 -0
  228. package/apps/web/dist/assets/{eye-Brd-xPUJ.js → eye-BpoKpIdt.js} +1 -1
  229. package/apps/web/dist/assets/host-BrP-ENHg.css +1 -0
  230. package/apps/web/dist/assets/host-DJ7-p0Sc.js +118 -0
  231. package/apps/web/dist/assets/i18n-BJ7Ld6O6.js +55 -0
  232. package/apps/web/dist/assets/index-D18DvnxX.css +1 -0
  233. package/apps/web/dist/assets/index-D2akynS-.js +10 -0
  234. package/apps/web/dist/assets/logo-BpnjXTRy.js +1 -0
  235. package/apps/web/dist/assets/oss-credits-IdX5bc71.js +1 -0
  236. package/apps/web/dist/assets/{phone-DhkHteoJ.js → phone-Ctvf-Am-.js} +1 -1
  237. package/apps/web/dist/assets/read-aloud-Da_RSm2S.js +1 -0
  238. package/apps/web/dist/assets/{runners-G-XYaDgR.js → runners-CyIvJIHr.js} +1 -1
  239. package/apps/web/dist/assets/scroll-text-ChrjRu9Y.js +1 -0
  240. package/apps/web/dist/assets/session-SXPtTWRK.js +2 -0
  241. package/apps/web/dist/assets/theme-CbTcTFWy.js +11 -0
  242. package/apps/web/dist/assets/ui-Uqnx1UpK.js +82 -0
  243. package/apps/web/dist/assets/{upload-BYZTwJTD.js → upload-BchUnQGV.js} +1 -1
  244. package/apps/web/dist/assets/{useMutation-D0QP_k2-.js → useMutation-DEkZhp5c.js} +1 -1
  245. package/apps/web/dist/assets/{volume-2-CVHoxdGM.js → volume-2-CU_oy81Z.js} +1 -1
  246. package/apps/web/dist/assets/with-selector-CoMyWBAX.js +1 -0
  247. package/apps/web/dist/index.html +17 -10
  248. package/apps/web/dist/mcp/flow.html +119 -64
  249. package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +20 -10
  250. package/node_modules/@engenty/wizards-shared/dist/assistant.d.ts +6 -1
  251. package/node_modules/@engenty/wizards-shared/dist/assistant.js +6 -1
  252. package/node_modules/@engenty/wizards-shared/dist/connectors.d.ts +236 -2
  253. package/node_modules/@engenty/wizards-shared/dist/connectors.js +52 -2
  254. package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +150 -8
  255. package/node_modules/@engenty/wizards-shared/dist/definition.js +46 -11
  256. package/node_modules/@engenty/wizards-shared/dist/discover.d.ts +21 -0
  257. package/node_modules/@engenty/wizards-shared/dist/discover.js +1 -0
  258. package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +26 -2
  259. package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +26 -2
  260. package/node_modules/@engenty/wizards-shared/dist/fit.js +1 -1
  261. package/node_modules/@engenty/wizards-shared/dist/json-schema.d.ts +1 -1
  262. package/node_modules/@engenty/wizards-shared/dist/json-schema.js +1 -1
  263. package/node_modules/@engenty/wizards-shared/dist/live.d.ts +2 -2
  264. package/node_modules/@engenty/wizards-shared/dist/live.js +1 -1
  265. package/node_modules/@engenty/wizards-shared/dist/marketplace.js +3 -1
  266. package/node_modules/@engenty/wizards-shared/dist/run.d.ts +54 -6
  267. package/node_modules/@engenty/wizards-shared/dist/run.js +85 -0
  268. package/node_modules/@engenty/wizards-shared/dist/runner-texts.d.ts +15 -1
  269. package/node_modules/@engenty/wizards-shared/dist/runner-texts.js +14 -0
  270. package/node_modules/@engenty/wizards-shared/dist/rwx.d.ts +42 -0
  271. package/node_modules/@engenty/wizards-shared/dist/rwx.js +29 -0
  272. package/node_modules/@engenty/wizards-shared/dist/skills.d.ts +1 -1
  273. package/node_modules/@engenty/wizards-shared/dist/space-data.d.ts +2 -2
  274. package/node_modules/@engenty/wizards-shared/dist/{projects.d.ts → spaces.d.ts} +39 -15
  275. package/node_modules/@engenty/wizards-shared/dist/{projects.js → spaces.js} +16 -9
  276. package/node_modules/@engenty/wizards-shared/dist/store.d.ts +7 -2
  277. package/node_modules/@engenty/wizards-shared/dist/surface.d.ts +35 -4
  278. package/node_modules/@engenty/wizards-shared/dist/surface.js +121 -3
  279. package/node_modules/@engenty/wizards-shared/dist/sync.d.ts +1 -1
  280. package/node_modules/@engenty/wizards-shared/dist/theme-look.js +1 -1
  281. package/node_modules/@engenty/wizards-shared/dist/wizard-package.d.ts +2 -2
  282. package/node_modules/@engenty/wizards-shared/dist/wizard-package.js +3 -3
  283. package/package.json +4 -1
  284. package/plugin/.claude-plugin/plugin.json +1 -1
  285. package/plugin/plugin.json +1 -1
  286. package/plugin/skills/build-wizard/SKILL.md +1 -1
  287. package/apps/runtime/dist/services/projects.js +0 -473
  288. package/apps/web/dist/assets/AboutDialog-B-JxkELB.js +0 -1
  289. package/apps/web/dist/assets/EditorPage-DQ_2FOzI.js +0 -3
  290. package/apps/web/dist/assets/Marketplace-DoH4YO3D.js +0 -2
  291. package/apps/web/dist/assets/NewWizardChannels-Tgoexgj4.js +0 -1
  292. package/apps/web/dist/assets/NewWizardPage-B24AF482.js +0 -7
  293. package/apps/web/dist/assets/OnboardingPage-BEvq4slJ.js +0 -1
  294. package/apps/web/dist/assets/PreviewPane-B_v7Y8R7.js +0 -10
  295. package/apps/web/dist/assets/ProjectPage-ClRuhFJo.js +0 -10
  296. package/apps/web/dist/assets/PublicRunner-MicrpVsv.js +0 -1
  297. package/apps/web/dist/assets/ReadOnly-BXjv-MSv.js +0 -1
  298. package/apps/web/dist/assets/SettingsPage-DY8O1r43.js +0 -2
  299. package/apps/web/dist/assets/SetupPage-BOVkVpMu.js +0 -1
  300. package/apps/web/dist/assets/SharePage-DXGzJSnR.js +0 -1
  301. package/apps/web/dist/assets/SkillEditor-BzzTDeaU.js +0 -1
  302. package/apps/web/dist/assets/changelog-BLdS-0Bj.js +0 -1
  303. package/apps/web/dist/assets/esm-BdxDT9Km.js +0 -7
  304. package/apps/web/dist/assets/i18n-8-Sw11tB.js +0 -55
  305. package/apps/web/dist/assets/index-OsdQFHmh.js +0 -49
  306. package/apps/web/dist/assets/index-QPipX5Fi.css +0 -1
  307. package/apps/web/dist/assets/lock-C0uxcOlq.js +0 -1
  308. package/apps/web/dist/assets/logo-CGNoptDg.js +0 -1
  309. package/apps/web/dist/assets/oss-credits-DpRWUPjD.js +0 -1
  310. package/apps/web/dist/assets/session-BWI-KENJ.js +0 -2
  311. package/apps/web/dist/assets/theme-D7krsx0_.js +0 -11
  312. package/apps/web/dist/assets/ui-DSXG3f49.js +0 -83
  313. /package/apps/runtime/dist/db/migrations/tenant/{0027_space_skill.sql → 0030_space_skill.sql} +0 -0
@@ -0,0 +1,215 @@
1
+ ---
2
+ title: Architecture
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
5
+ ---
6
+
7
+ engenty wizards is one server program, the **runtime**, and one web app, the **studio**, that it
8
+ serves. The same code runs on your computer and in the cloud. This page shows the parts and how
9
+ they fit, with the folder each one lives in.
10
+
11
+ ![Studio and Work, two modes split per person, reach the runtime’s studio half. Published Wizards (durable Agents) reach the doors, on the guest side. The runner drives the engine, which reaches the models and, through the broker, the connected services. All of them keep their data in libSQL databases and a file store](../../assets/diagrams/architecture-parts.svg)
12
+
13
+ ## The parts
14
+
15
+ | Part | Folder | What it does |
16
+ |---|---|---|
17
+ | Runtime | `apps/runtime/src` | The server: the API, the step runner, the databases, the models, the broker, the plugins |
18
+ | Studio | `apps/web/src/studio` | Where people build wizards, and where Work mode lives |
19
+ | Runner pages | `apps/web/src/runner` | What a person sees at a wizard’s link: its pages, its chat, the result |
20
+ | Shared | `packages/shared/src` | The wizard definition and its validator, the words the runtime and the studio share, the feature switches |
21
+ | `@engenty/wizards` | `packages/wizards` | What code outside the repository imports: the plugin SDK, `@engenty/wizards-runner`, the OpenUI parts |
22
+ | Modules | `modules/` | Plugins that ship with the runtime |
23
+
24
+ ## Roles of the runtime
25
+
26
+ The runtime reads `RUNTIME_ROLE` at start. It says which half of the routes the process serves
27
+ and whether it takes runs.
28
+
29
+ | Role | Serves |
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 |
32
+ | `doors` | The customers’ half: `/api/public`, shared results, the plugins’ public routes and webhooks, `/embed.js`, the pages `/w/<token>` and `/s/<token>` |
33
+ | `web` | Both halves |
34
+ | `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 |
35
+ | `all` | Everything in one process. The default |
36
+
37
+ Every role serves what both halves need: `/api/health`, `/api/config`, the runs’ API
38
+ (`/api/runs`) and the OAuth callback (`/api/connect`).
39
+
40
+ Studio and Work are two modes of one web app, and the `studio` half serves both: `/api/studio`
41
+ and `/api/studio/work`. They share the sign-in, the tenant database and the broker’s rules. The
42
+ line between them is drawn per person, not per process: `allowedModes`
43
+ (`apps/web/src/lib/mode.ts`) gives the people who build Studio, Work and Client, and everyone else
44
+ Work and Client. Client has no server half of its own. Published wizards come in through `doors`:
45
+ a guest’s run has no person signed in, never gets the Docker sandbox and meets the broker as a
46
+ guest. That is the one boundary between processes.
47
+
48
+ A run from a wizard’s link, in the cloud, where each role is its own process:
49
+
50
+ ![A run in the cloud: the doors write the run and put it in line, a runner claims it and writes the steps, and the doors show the person the next page](../../assets/diagrams/architecture-run.svg)
51
+
52
+ The queue of runs is the control database. A runner claims a run in one statement that also
53
+ counts the tenant’s running runs against its limit, and writes a heartbeat while it drives the
54
+ run. When a runner falls silent, another takes its runs over. Runners register in the control
55
+ database’s `runner` table, and `RUNNER_URL` says where the web reaches one.
56
+
57
+ ## Your computer and the cloud
58
+
59
+ | | On your computer | In the cloud |
60
+ |---|---|---|
61
+ | Processes | One, role `all`, on `127.0.0.1:24368` | `studio`, `doors` and `runner` from one image, plus a Chromium container that holds no secrets |
62
+ | Tenants | One, `local` | One per organization |
63
+ | Databases | libSQL files: `tenants/local.db` and `control.db` in the data folder | libSQL: a control database (`DATABASE_URL`) and one database per tenant, at the address the Manage-App hands out |
64
+ | Files | `objects/` in the data folder | An S3-compatible bucket (`S3_ENDPOINT`, `S3_BUCKET`) |
65
+ | Sign-in | A one-time link the command line opens | The Manage-App’s tokens (OAuth 2.1 / OIDC), which name the person, the tenant and the role |
66
+ | Models | An AI client on the computer (Claude Code, Codex, Antigravity, Cursor Agent), your own API keys, a local model, or a linked account’s credits | The model gateway. The runtime holds no model keys |
67
+
68
+ ![Your computer runs one process with your own AI and keeps its spaces the same as the cloud’s studio. The cloud runs studio, doors and runner behind a proxy, with the Manage-App and the model gateway beside it](../../assets/diagrams/architecture-places.svg)
69
+
70
+ The **Manage-App** runs engenty’s accounts, organizations, plans and credits, and the **model
71
+ gateway** serves the model classes in the cloud. Both are separate apps, not part of this
72
+ repository. A runtime talks to them when `MANAGE_URL` and `GATEWAY_URL` are set. Without them it
73
+ runs alone, as on your computer.
74
+
75
+ A computer signed in to an account keeps its spaces in step with the organization in the cloud
76
+ ([Spaces in the cloud](../user-guide/cloud-sync.md)). What it publishes runs in the cloud, where
77
+ its links work while the computer is off.
78
+
79
+ ## Tenants and spaces
80
+
81
+ A **tenant** is an organization’s data: its own database, its files and its plugins’ tables. The
82
+ runtime sets the tenant once per request, run or background job (`tenants/tenant.ts`), never
83
+ from a request body. The control database holds what spans tenants: the links, the index of
84
+ runs, the sessions and the settings.
85
+
86
+ A **space** lives inside a tenant. It holds what its wizards share and produce: info and brand,
87
+ knowledge, data, files, results, skills and connections. Every AI step knows its space. The
88
+ tenant tables carry a `space_id`, and the code says “space” throughout (`services/spaces.ts`).
89
+
90
+ Each tenant also has a live feed (`live_change`): numbered writes to what a studio shows. An open
91
+ studio reads it and shows what changed elsewhere without a reload (`apps/runtime/src/live/`).
92
+
93
+ ### Tenant isolation
94
+
95
+ Every tenant has a database of its own and its own folder of files. The databases are libSQL,
96
+ reached through Drizzle (`db/client.ts`):
97
+
98
+ - **The control database** is one per runtime: `DATABASE_URL` with `DATABASE_AUTH_TOKEN`, else
99
+ `control.db` in the data folder.
100
+ - **A tenant’s database** is at the address the Manage-App hands out for it, else at
101
+ `TENANT_DB_URL_TEMPLATE` with `{tenant}` filled in, else `tenants/<id>.db` in the data folder.
102
+ Code reaches a tenant’s tables only inside `inTenant()`. Outside it, `db` throws `NoTenantError`.
103
+ - **A tenant’s files** sit under the prefix `t/<tenant>/` in the file store (`files/objects.ts`):
104
+ the data folder, or an S3-compatible bucket when `S3_ENDPOINT` and `S3_BUCKET` are set.
105
+ Deleting a tenant removes that one folder.
106
+
107
+ Inside a tenant, the broker’s RWX rules keep the spaces apart ([The broker](#the-broker)).
108
+
109
+ ![The control database is shared. Each tenant has its own libSQL database and its own prefix in the file store, and the broker’s RWX rules stand between its spaces](../../assets/diagrams/architecture-tenants.svg)
110
+
111
+ ## The engine
112
+
113
+ A wizard is one JSON document ([The wizard format](./wizard-format/index.md)). The step runner
114
+ (`engine/runner.ts`) walks it like a cursor: it shows pages, runs AI steps, goes back, makes a
115
+ step again and follows branches.
116
+
117
+ | Step | Runs on |
118
+ |---|---|
119
+ | `page`, `review`, `result` | The runner pages, with what the person entered |
120
+ | `agent` | A Mastra agent with the step’s tools (`engine/steps.ts`, `tools/index.ts`): web search and fetch, the browser, the sandbox, HTTP, the space’s knowledge and data, connections, MCP, plugins’ tools |
121
+ | `generate`, `widget`, `motion-graphics`, `surface` | The AI SDK’s media calls, the widget bundler and the renderers (`widgets/`, `motion-graphics/`, `render/`) |
122
+
123
+ A step names a **model class** (`classifier`, `low`, `standard`, `high`, plus `image`, `video`,
124
+ `audio`, `speech`), never a model. Which model serves a class is a setting outside the wizard
125
+ (`models.ts`).
126
+
127
+ ![The step runner walks the wizard definition: pages for the person, agent steps with their tools, and the steps that make media](../../assets/diagrams/architecture-engine.svg)
128
+
129
+ ### Sandboxes
130
+
131
+ An agent step with the tool `sandbox` runs shell commands and code in a sandbox. Each run gets
132
+ its own, made on first use and thrown away when the run stops (`engine/resources.ts`).
133
+
134
+ | Engine | What it is |
135
+ |---|---|
136
+ | `docker` | One container per run through the host’s Docker, from the `engenty-sandbox` image (`SANDBOX_IMAGE`) |
137
+ | `agentos` | One VM per run in a helper process, with no Docker: a Linux userland compiled to WebAssembly, Node and Python 3.13. No native programs such as ffmpeg. `wizards sandbox add` installs it. It reaches the npm and PyPI registries and the hosts in `SANDBOX_ALLOW_HOSTS` |
138
+
139
+ `SANDBOX` picks the engine: `docker`, `agentos`, `off`, or nothing for the first one that is ready.
140
+ `SANDBOX_GUESTS` picks the engine for a guest’s run, one that nobody signed in for: `off` (the
141
+ default) or `agentos`, never Docker. With `off`, a guest’s run has no sandbox. A member’s run and
142
+ a Work chat use the server’s engine.
143
+
144
+ ## Skills
145
+
146
+ A skill is a folder in the Agent Skills format, kept in the space. A step reads an always-on skill
147
+ with every prompt and an on-demand one through a tool when its description fits. Where the skill
148
+ may run scripts and the step has the sandbox, its folder goes into the sandbox. [Skills](./skills.md)
149
+ has the format, the tools and the routes.
150
+
151
+ ## Plugins
152
+
153
+ A plugin adds tools for AI steps, routes with tables of their own and pages in the studio. The
154
+ runtime finds plugins in its folders at start and again while it runs: the ones in `modules/`,
155
+ the folders in `PLUGINS_DIR`, then the ones installed on this runtime. A plugin reaches a connection only
156
+ through `server.connections.call`, which goes through the broker as its caller.
157
+ [Plugins](./plugins/index.md) explains how to write one.
158
+
159
+ ## The broker
160
+
161
+ Every call to a connected service goes through one function, `brokerCall`
162
+ (`apps/runtime/src/broker/call.ts`): from a wizard step, a Work chat, Goose, a share target or a
163
+ plugin. It reads the account’s secret (nothing else does), decides allow, ask or deny, runs the
164
+ action and writes one line of the log. Model calls don’t pass it.
165
+
166
+ - **Connections belong to the space.** A connection signs in as the space or as each person,
167
+ is open to admins, members or everyone, and has a rule for each kind of action: read, write,
168
+ delete, send.
169
+ - **A run’s grant** is fixed when the run is created, from the definition it starts on: the
170
+ connections, actions and hosts its steps name. An edit never widens a run under way.
171
+ - **RWX rules** per space say who may read, write and execute which document, table, page or
172
+ other resource. Unset means deny, and a deny wins.
173
+ - **The log** keeps every call. The critical lines reach the admins under the bell in Work.
174
+
175
+ [The broker](./broker.md) has the details. The studio shows all of it under
176
+ [Capabilities](../user-guide/capabilities.md).
177
+
178
+ ![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
+ ## Work mode
181
+
182
+ Work mode has chats with the space’s AI (`services/work-chats.ts`, `services/work-ai.ts`,
183
+ `apps/web/src/studio/work/`). A chat is a Mastra memory thread in the tenant’s database: the
184
+ thread is the chat, the resource is the space. A turn of the space’s AI gets the space’s tools:
185
+ its knowledge, its skills, the chat’s sandbox, the connections open to the person who asked, the
186
+ plugins’ tools and the web. A tool that acts outside the space doesn’t run when it is called. The
187
+ call is held until a person approves it, on every model, also on an AI client that runs the tools
188
+ itself.
189
+
190
+ One turn of the space’s AI with a held call:
191
+
192
+ ![A call outside the space waits at the gate. After Approve the chat runs it once through the broker and tells the AI the outcome](../../assets/diagrams/architecture-work-turn.svg)
193
+
194
+ Each chat gets its own sandbox on its first command. It stays while the chat is in use, so a file
195
+ one turn writes is there for the next, and goes after 30 minutes without a command.
196
+ [Work mode](../user-guide/work-mode.md) shows it from the person’s side. It is behind the
197
+ `workMode` switch.
198
+
199
+ ## Feature switches
200
+
201
+ Parts that ship in the code but are not on for everyone yet sit behind a switch
202
+ (`packages/shared/src/feature-flags.ts`). The runtime asks `feature("name")`, the studio
203
+ `useFeature("name")`. A switch gets its value from four layers, the last one winning:
204
+
205
+ 1. The default the code declares, and each plugin’s switches under its id.
206
+ 2. The `FEATURES` environment variable: `workMode=on,goose=off`.
207
+ 3. The Manage-App, for the organization in the cloud or the account a computer is linked to.
208
+ 4. The `.features` file: `~/.engenty/wizards/.features` on your computer, the repository’s root
209
+ in a checkout, the data folder in the cloud. Same shape as `.env`: one `name=on` or
210
+ `name=off` per line.
211
+
212
+ ![Four layers set a switch: defaults, FEATURES, the Manage-App and the .features file, the upper one winning](../../assets/diagrams/architecture-switches.svg)
213
+
214
+ The runtime reads the file on every call, so a change counts at once. `wizards features` lists
215
+ what counts on a computer.
@@ -0,0 +1,298 @@
1
+ ---
2
+ title: The broker
3
+ description: The one path every connector call takes in engenty wizards – who calls, what decides, what a run may reach, what is logged and heard, the RWX rules and the routes the studio uses.
4
+ version: 0.13.0
5
+ ---
6
+
7
+ Every call a wizard step, a Work chat, Goose, a share target or a plugin makes to a connected
8
+ service goes through one function: `brokerCall` in `apps/runtime/src/broker/call.ts`. The broker
9
+ reads the account’s secret (nothing else does), decides *allow*, *ask* or *deny*, asks where the
10
+ rules say so, runs the action and writes one row of `broker_log`, whatever came of it. Model calls
11
+ don’t pass it.
12
+
13
+ The broker is a library inside the runtime’s processes, not a process of its own. Everything it
14
+ exports comes from `apps/runtime/src/broker/index.ts`. The words the studio shares with it live in
15
+ `packages/shared/src/connectors.ts` and `packages/shared/src/rwx.ts`.
16
+
17
+ ## Words
18
+
19
+ | Word | Means |
20
+ |---|---|
21
+ | Broker | The gate in the runtime every connector call passes. The app never shows the word |
22
+ | Connection | A space’s account at a service (`space_connection`), set up by the space’s admins. It signs in as the space or as each person |
23
+ | A wizard’s own connection | A `connections` entry of a wizard definition. The person running the wizard signs in during the run (`store_secret`) |
24
+ | Grant | What a run may reach outside, fixed when the run is created (`run.grant`) |
25
+ | Approval | An admin’s yes to a call held by „Mit Freigabe“ (With approval) on a connection that signs in as the space |
26
+ | Critical | A log row someone should hear of: one of `CRITICAL_KINDS` |
27
+ | RWX rule | One row of a space’s `subject × resource × r w x` table, behind the `broker` switch |
28
+ | Guest, member, admin | A guest runs a wizard from its link and has no role. A member or an admin (the owner counts as one) is signed in to the organization |
29
+
30
+ ## Who and where
31
+
32
+ Each call carries `who` and `where`.
33
+
34
+ ```ts
35
+ type WhoKind = "guest" | "person" | "admin" | "goose" | "plugin" | "step";
36
+
37
+ interface Who {
38
+ kind: WhoKind;
39
+ id?: string; // the visitor, the person, the plugin or the step
40
+ for?: Who; // a fixed step: whom its run is held for
41
+ admin?: boolean; // Goose for an admin
42
+ }
43
+
44
+ interface Where {
45
+ runId?: string;
46
+ stepId?: string;
47
+ chatId?: string;
48
+ wizardId?: string;
49
+ spaceId?: string;
50
+ mode?: "test" | "live";
51
+ guest?: boolean; // a live run nobody signed in for
52
+ }
53
+ ```
54
+
55
+ - `whoOf(holder, role)` turns a run’s holder into a `Who`: `u:<user>` is a person, or an admin
56
+ for the roles owner and admin. `v:<visitor>` and `r:<run>` are guests.
57
+ - `whereOf(ctx)` and `whereOfRun(run, holder, spaceId)` build `where` for a step or a share job.
58
+ - A plugin never names its caller. The runtime sets it with `withCaller({ who, where }, fn)`
59
+ where it hands the plugin a call, and `server.connections.call` reads it with
60
+ `currentCaller()` (`broker/caller.ts`).
61
+
62
+ `ActionKind` is `read`, `write`, `destructive` or `send`. `kindOf(group)` maps a connector
63
+ action’s group to the kind of the same name. A connector action that mails, messages or posts to
64
+ other people has the group `send` (SMTP’s, Gmail’s and Outlook’s `send_message`, Slack’s
65
+ `post_message`); creating or changing a record is `write`, deleting is `destructive`. An imported
66
+ connector’s action has no such group in its spec, so `groupOf`
67
+ (`connections-external/importer/classify.ts`) guesses it by name: an action that is no read,
68
+ whose id or summary says send, mail, message, post or notify, and not draft, update or delete,
69
+ is a `send`. A caller may name the kind itself, as the mail tools, the share targets and
70
+ `http_request` do.
71
+
72
+ ## Connections
73
+
74
+ `BrokerConnection` is one of two:
75
+
76
+ | `kind` | What it is | Who signs in |
77
+ |---|---|---|
78
+ | `store_secret` | A wizard’s own connection (`def: ConnectionDef`) | The person running the wizard, kept in the run’s store |
79
+ | `space_connection` | A row of `space_connection` with its connector | The space once (`signIn: "space"`), or each person (`signIn: "person"`, rows in `space_connection_sign_in`) |
80
+
81
+ A space connection holds its `audience` (`admins`, `members` or `all`), its `rules` per
82
+ `ActionKind` and optionally the action ids it is for. `DEFAULT_CONNECTION_RULES` start a new one:
83
+ `read: "allow"`, `write: "ask"`, `destructive: "deny"`, `send: "ask"`. `inAudience(audience, who)`
84
+ decides the audience. A fixed step is in the audience of whom its run is held for, and Goose for
85
+ an admin counts as an admin.
86
+
87
+ ## `decide`
88
+
89
+ `decide({ who, where, connection, actionId, kind, grant })` is pure: it reads nothing and runs
90
+ nothing. `brokerCall` uses it for every call, and „Was darf …?“ answers with it. It returns a
91
+ `Decision` with `outcome`, the `rule` that decided, a `reason`, and for an ask of the space’s
92
+ admins `admins: true`. The checks run in this order:
93
+
94
+ 1. **The grant.** A wizard’s own connection in a run, outside the run’s grant: deny, rule `grant`.
95
+ 2. **A space connection:**
96
+ - a plugin’s own job on a connection it set up, outside any run or chat: allow, `own_job`;
97
+ - a caller outside the audience: deny, `audience`;
98
+ - an action the connection is not for: deny, `actions`;
99
+ - a change, delete or send by an AI step on a connection that signs in as the space: deny,
100
+ `ai_step_writes`. Only a fixed `call` step or a Work chat’s confirmed action writes there;
101
+ - otherwise the connection’s rule for the kind, `rules.<kind>`: *deny*, *allow*, or *ask*. An
102
+ ask goes to the person where each person signs in, and to the space’s admins where the space
103
+ signs in.
104
+ 3. **A wizard’s own connection:** deleting always asks (`destructive`). Otherwise the wizard’s
105
+ `connection.policy` for the action decides (`policy.<action>`). Without one, reading is
106
+ allowed (`read`) and anything else asks the person running (`policy`).
107
+
108
+ ## `brokerCall`
109
+
110
+ ```ts
111
+ brokerCall({ who, where, connection, action: { id, kind? }, input, ctx?, handler? })
112
+ → { ok: true, result, account } | { ok: false, refused, reason }
113
+ ```
114
+
115
+ ![brokerCall reads the account, checks the grant, decides, checks a guest’s send and asks where it must, then runs the action. Each check can refuse, and every call goes to broker_log](../../assets/diagrams/broker-order.svg)
116
+
117
+ In order, it:
118
+
119
+ 1. reads the account. A sign-in that ran out and can’t be renewed is logged as `sign_in_failed`
120
+ and refused as `not_connected`;
121
+ 2. checks the grant where one binds the call (`grantBinds`: a wizard’s own connection, in a run,
122
+ and not a share target’s connection);
123
+ 3. refuses a missing account (`not_connected`) or an unknown action (`no_action`);
124
+ 4. asks `decide`. A deny returns its refusal;
125
+ 5. checks a guest’s send (`guestSendCheck`, below);
126
+ 6. on an ask of the admins, runs only with `ctx.approved`. Otherwise it refuses with
127
+ `needs_approval`, and the caller holds the call (a Work chat in `chat_approval`, under the bell);
128
+ 7. on an ask of the person, runs when `ctx.allowed` holds `<connection>:<action>` (“for the rest of
129
+ the run”) or `ctx.confirmed` is set and the call deletes nothing. Otherwise it calls `ctx.ask`.
130
+ With no one to ask it refuses with `nobody`, and on a no with `declined`;
131
+ 8. runs the action (the connector’s handler, or `handler`), marks the space connection used and
132
+ logs the call. An error the action throws is logged and thrown on. A 401 or a lost OAuth grant
133
+ is logged as `sign_in_failed`.
134
+
135
+ `brokerConnected(connection, who)` says whether and as whom a connection is signed in, without the
136
+ secret. `brokerSecret` reads a run’s kept secret that is no connection (the browser’s kept
137
+ sign-ins) through the same log.
138
+
139
+ ### Refusals
140
+
141
+ `BROKER_REFUSALS` in `packages/shared/src/connectors.ts` lists every `refused`, and the Log page
142
+ has words for each:
143
+
144
+ | Refusal | Why |
145
+ |---|---|
146
+ | `not_connected` | Nothing is connected, the person has not signed in, or the sign-in could not be renewed |
147
+ | `no_action` | The connector has no such action |
148
+ | `not_in_grant` | The run’s grant does not include the connection, the action or the host |
149
+ | `denied` | A rule says no: the audience, the connection’s actions, *Nie*, or the grant in `decide` |
150
+ | `declined` | The person asked said no |
151
+ | `nobody` | The rules say ask, and nobody can be asked |
152
+ | `needs_approval` | *Mit Freigabe* on a connection that signs in as the space: the call waits for an admin |
153
+ | `ai_step_writes` | An AI step wanted to change, delete or send as the space |
154
+ | `not_allowed_recipient` | A guest’s send to an address that is neither the run’s own nor in the space’s mail domains |
155
+ | `run_limit` | A guest’s run has sent its mails (`GUEST_MAILS_PER_RUN`, 3) |
156
+ | `day_limit` | The wizard’s guests have sent today’s mails (`wizard.dailyMailLimit`, 50 unless set) |
157
+
158
+ ## The run’s grant
159
+
160
+ `grantOf(definition)` in `broker/grant.ts` is pure: the same definition gives the same grant.
161
+
162
+ ```ts
163
+ interface Grant {
164
+ connections: Record<string, string[]>; // action ids, or the kind "read"
165
+ hosts: string[]; // names, or "*.example.org"
166
+ tools: string[];
167
+ }
168
+ ```
169
+
170
+ - A step’s `connections` add the actions its connection names, or `read` without a list.
171
+ - A fixed step’s `call` adds its one action on its connection.
172
+ - A step’s `hosts` add the hosts `http_request` may reach.
173
+
174
+ `createRun` (`engine/runner.ts`) computes the grant from the definition the run starts on: the
175
+ published one for a live run, the draft for a test run. It keeps the grant in `run.grant`, so an
176
+ edit never widens a run under way. `runGrant(runId)` reads it, and for an older run computes it
177
+ once from the run’s definition and writes it. `inGrant` always lets `list_tools` through.
178
+ `grantNote` writes the run’s first log line (“This run may: …”).
179
+
180
+ ### Hosts, sends and results kept in the space
181
+
182
+ - `brokerHost` (`broker/host.ts`) runs `http_request`. It logs the call as connection
183
+ `host:<name>`, action `http_request`, kind `send`. A guest’s run reaches only the hosts in its
184
+ grant. A member’s run reaches any public host, until the `broker` switch is on.
185
+ - `guestSendCheck` (`broker/send.ts`) lets a guest’s send go only to an address a page field of
186
+ kind `email` collected in the run, or to the space’s `mailDomains`, within the limits above.
187
+ It holds a connection’s send action as well as the email share target. A send whose input
188
+ names no address, such as a Slack post, is refused for a guest.
189
+ - `keptStepIds` (`broker/kept.ts`) names the steps of a guest’s run that read from a space
190
+ connection whose audience is not `all`. Their results stay in the space.
191
+
192
+ ## The log
193
+
194
+ `broker_log` holds one row per call: when and how long, who (`who_kind`, `who_id`), where
195
+ (`run_id`, `step_id`, `chat_id`, `wizard_id`, `space_id`), `connection_id`, `action_id`, `kind`,
196
+ `input_summary`, `outcome`, `rule`, `reason`, `result`, `result_size`, `critical` and
197
+ `critical_kind`. `summarizeInput` keeps the input’s field names and sizes, one clipped value whose
198
+ field name doesn’t look like a secret, and a SHA-256 of the whole. No token, key, password or body
199
+ is ever written. A log that can’t be written never stops the call.
200
+
201
+ `criticalOf(row)` in `broker/log.ts` is the one place that decides whether a row is critical:
202
+
203
+ | `CRITICAL_KINDS` | When |
204
+ |---|---|
205
+ | `refused_write` | A change, delete or send was refused |
206
+ | `outside_audience` | A guest’s call was refused by a connection’s audience |
207
+ | `host_not_in_grant` | `http_request` to a host the grant doesn’t include |
208
+ | `limit_reached` | `run_limit` or `day_limit` |
209
+ | `sign_in_failed` | A sign-in ran out, or the service refused it |
210
+ | `first_use` | A space connection’s first call that ran |
211
+ | `rule_changed` | An admin changed RWX rules, or a connection’s rules or audience (`logRuleChange`) |
212
+
213
+ A critical row goes four ways:
214
+
215
+ - a warning line in the runtime’s own log, so the log ring and `wizards report` carry it;
216
+ - `onCritical` listeners: `services/manage-reports.ts` posts a guest’s rows to the Manage-App at
217
+ once and the rest daily, to `POST /v1/broker/:tenant`;
218
+ - the bell in Work: `GET /api/studio/work/approvals` answers `{ approvals, critical, unseen }` for
219
+ an admin, and `POST /api/studio/work/approvals/seen` marks the lines seen;
220
+ - an hourly mail to the space’s admins (`services/broker-notify.ts`), only when none of them was in
221
+ the app since. It goes through the space’s mail connection that signs in as the space, else the
222
+ server’s address. `space.notify` (`{ bell, mail: "hourly" | "off" }`, `PATCH
223
+ /api/studio/spaces/:id`) turns it off.
224
+
225
+ ### The walk test
226
+
227
+ `reachesOutside(id, reaches)` (`broker/registry.ts`) registers what a tool or share target reaches.
228
+ `test/broker-walk.test.ts` fails on a file that reaches outside without `brokerCall` and without
229
+ registering. A new tool that calls a service registers there.
230
+
231
+ ## RWX and the `broker` switch
232
+
233
+ `broker/rwx.ts` keeps one table of permissions per space (`rwx_rule`): a subject (`guest`,
234
+ `person`, `role`, `goose`, `wizard`, `plugin`), a resource (`document`, `table`, `page`,
235
+ `connection`, `mail`, `host`, `sandbox`, with an id or `*`), and `r`, `w`, `x` each `allow`,
236
+ `deny` or unset.
237
+
238
+ - Unset means deny, and a deny wins over every allow.
239
+ - Every space starts with a seed: owners and admins read, write and execute, members read and
240
+ write, guests read.
241
+ - Readers ask today for `document`, `table` and `page` (`ENFORCED`): the knowledge readers, and
242
+ search filters its hits by `r`. The other resource kinds wait for their reader.
243
+
244
+ All of this is behind the `broker` switch, on by default. With it off, `decide`, `readable` and
245
+ `assertRwx` in `rwx.ts` say yes to everything, the rules routes answer 404, and a member’s
246
+ `http_request` reaches any public host. On, the seed changes nothing until an admin
247
+ writes a deny. No studio page draws the rules yet.
248
+
249
+ Every reader takes its subjects from whoever it serves: the studio’s person (`whoOf(c)`), a
250
+ run’s holder and wizard (`subjectsOf(ctx)`, `runHolder(run)`), Goose for its person. A plugin
251
+ reading a document (`server.spaceData.readFile`) reads as whom it serves, and as itself: a tool
252
+ in a step or a Work chat as its caller (`subjectsOfCaller`), an HTTP route as the person it
253
+ answers, a job as the runtime itself. Anything else reads as the plugin alone, which no seed
254
+ allows. The runtime itself is the subject `SYSTEM`, set with `readingAs([SYSTEM], …)` around a
255
+ plugin’s job (`plugins/jobs.ts`) and nowhere else: no person, guest or run stands behind a job.
256
+ It may read, write and run everything; a deny for the plugin beside it still wins. No rule can
257
+ name it, no helper builds it from a request, `decideWith` knows it only by identity, and
258
+ `test/rwx.test.ts` fails when a new file uses it. A call with no subject at all stays a no.
259
+
260
+ The `capabilities` switch is on by default. It shows the studio’s Capabilities place, opens
261
+ `/spaces/:id/discover` and makes the rule „Mitglieder dürfen ins Studio“ count. It does not turn
262
+ on RWX.
263
+
264
+ ## Routes
265
+
266
+ All under `/api/studio`, for a signed-in person of the organization.
267
+
268
+ | Route | What it does | Who |
269
+ |---|---|---|
270
+ | `GET /spaces/:id/connections` | The space’s connections, each with who set it up | Everyone; a member sees the ones in their audience |
271
+ | `POST /spaces/:id/connections` | Sets one up: connector, name, `signIn`, `audience` | Admins |
272
+ | `PATCH /connections/:id`, `DELETE /connections/:id` | Changes its name, audience, rules or the actions it is for, or removes it | Admins |
273
+ | `POST`, `DELETE /connections/:id/sign-in` | Signs the space in or out: `{ credentials }`, or `{ oauth: true }` for a sign-in page | Admins |
274
+ | `POST`, `DELETE /connections/:id/my-sign-in` | The person’s own sign-in, where each person signs in | Everyone in the audience |
275
+ | `GET /person/sign-ins` | The person’s connections across their spaces | The person |
276
+ | `GET /spaces/:id/rules`, `PUT /spaces/:id/rules`, `DELETE /spaces/:id/rules/:ruleId` | The RWX rules, saved as a whole list | Admins; 404 while `broker` is off |
277
+ | `GET /spaces/:id/broker/log` | The log, newest first. Filters: `connection`, `who`, `outcome`, `result`, `refused`, `critical`, `since`, `until`, `q`; `cursor` with the `next` of the page before, `limit` | Admins (403 for a member) |
278
+ | `GET /spaces/:id/broker/log/:line` | One line, with the run’s grant | Admins |
279
+ | `GET /spaces/:id/broker/ask?who=&for=&resource=&action=&in=` | „Was darf …?“: `decide`’s outcome, rule and reason. Nothing runs and nothing is logged | Admins |
280
+ | `GET /spaces/:id/broker/choices` | The people and the space’s connections with their actions, for the question | Admins |
281
+ | `GET /spaces/:id/discover?q=` | Skills from skills.sh and connectors from integrations.sh, marked where the space has them | Everyone; 404 while `capabilities` is off |
282
+
283
+ ## Not built
284
+
285
+ - **Isolated instances.** Guest runs share the runner process with test runs, and every process
286
+ can open every secret. The plan’s separate runner role for guests and a broker process that
287
+ alone holds the sealing key don’t exist.
288
+ - **The company sign-in.** A third way to sign in, through the organization’s SSO (MCP
289
+ Enterprise-Managed Authorization), is not built.
290
+ - **Plans.** Signing in as each person is not limited to the Team plan.
291
+ - **The Manage-App’s side of the report.** The runtime posts to `POST /v1/broker/:tenant`, and the
292
+ Manage-App has no endpoint for it yet.
293
+ - **More of RWX.** No page in the studio draws the rules, and connections, mail, hosts and the
294
+ sandbox have no reader that asks RWX.
295
+ - A webhook for critical rows, a choice per kind of what notifies, and one connection offered to
296
+ several spaces.
297
+
298
+ The plan behind all of this is `docs/plans/capabilities.md`, with `docs/plans/broker.md`.
@@ -1,23 +1,27 @@
1
1
  ---
2
2
  title: Developer
3
3
  description: The wizard format, wizards in other systems and the runner, and plugins that extend engenty wizards.
4
- version: 0.7.10
4
+ version: 0.13.0
5
5
  ---
6
6
 
7
7
  These pages are for people who write wizards as files, bring them into other systems or extend
8
8
  engenty wizards. A wizard is one JSON document. The runner shows it to people page by page, on
9
9
  its own page, on a website, in a chat or in your own app.
10
10
 
11
+ ![A wizard file and plugins go into the runtime, which brings wizards to their own page, websites, AI apps, your own UI and connected services](../../assets/diagrams/dev-overview.svg)
12
+
11
13
  ## Start here
12
14
 
13
15
  | | |
14
16
  |---|---|
17
+ | [Architecture](./architecture.md) | The runtime and its roles, your computer and the cloud, tenants and spaces, the engine, the broker |
15
18
  | [The wizard format](./wizard-format/index.md) | A wizard as JSON: its steps, fields, templates and branches |
16
19
  | [JSON Schema](./wizard-format/validate.md) | The JSON Schema for your editor and `wizards validate` |
17
20
  | [Integration](./integration/index.md) | A published wizard for people, for AI apps and for your own code |
18
21
  | [Your own UI](./integration/own-ui.md) | Your app draws the run with `@engenty/wizards-runner` |
19
22
  | [Plugins](./plugins/index.md) | Tools for AI steps, routes with their own tables, pages in the studio |
20
23
  | [The API](./api.md) | What a program may rely on, what is private, and how a client names itself |
24
+ | [The broker](./broker.md) | The one path every connector call takes: who calls, what decides, what is logged |
21
25
  | [Licensing](./licensing.md) | The wizard format and the runner are MIT, the rest is FSL-1.1-MIT |
22
26
 
23
27
  ## Wizards as files
@@ -7,6 +7,8 @@ version: 0.7.4
7
7
  A published wizard runs wherever a person can reach it. These pages show how to bring it into
8
8
  other systems, from a plain link to a chat that starts the wizard by itself.
9
9
 
10
+ ![A published wizard reaches people by link, embed and channels, AI apps by MCP, MCP Apps, the Claude Code plugin, marketplaces and OpenUI, and your code through your own UI and results](../../../assets/diagrams/dev-integration.svg)
11
+
10
12
  ## For people
11
13
 
12
14
  | | |
@@ -5,10 +5,13 @@
5
5
  "icon": "SquareTerminal",
6
6
  "pages": [
7
7
  "index",
8
+ "architecture",
8
9
  "wizard-format",
9
10
  "integration",
10
11
  "plugins",
12
+ "skills",
11
13
  "api",
14
+ "broker",
12
15
  "licensing"
13
16
  ]
14
17
  }
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: Accounts
3
3
  description: Accounts a plugin connects for a space, such as a calendar or a mailbox, through the runtime's built-in connectors.
4
- version: 0.5.0
4
+ version: 0.13.0
5
5
  ---
6
6
 
7
7
  A wizard’s connections belong to the person who runs it. A plugin that works for the whole
@@ -33,7 +33,7 @@ const { events } = await server.connections.call<{ events: unknown[] }>(account.
33
33
  | `start({ space, connector, actions, lang? })` | Returns the provider’s sign-in page of an OAuth connector. The provider asks only for the rights that `actions` need. `lang` (`"en"` or `"de"`) is the language of the page the person comes back to; without it, the page follows their browser |
34
34
  | `connect({ space, connector, actions, credentials })` | Connects a connector that takes keys. `credentials` holds the keys by field key. The runtime tries them once at the provider and then keeps them sealed. Keys the provider refuses throw an error with the status `400` and the code `credentials`, whose message says what was wrong. Returns the connection |
35
35
  | `list(space)`, `get(id)` | Return what is connected: `{ id, space, connector, label, actions, createdAt }`, the newest first. `label` is the account as the provider names it, often an email address |
36
- | `call(id, action, input)` | Runs one of the connector’s actions with the account. When the token has run out, the runtime fetches a fresh one first |
36
+ | `call(id, action, input)` | Runs one of the connector’s actions with the account, through the runtime’s broker. When the token has run out, the runtime fetches a fresh one first. The call carries the run or chat it is made in, and the connection’s rules decide: who may use it, and per kind of action whether it runs, waits for the space’s admins or never runs. From a guest’s run (a wizard at its link, nobody signed in) only actions that read go through; a write or delete throws, and the refusal is logged. A plugin’s own job (a sync, a timer) runs every action the connection was made for |
37
37
  | `remove(id)` | Forgets the connection and its tokens |
38
38
 
39
39
  ## Signing in
@@ -69,6 +69,9 @@ window.addEventListener("message", (event) => {
69
69
 
70
70
  ## Where it is kept
71
71
 
72
- The connections are kept in the table `plugin_connection` of the tenant’s database, by plugin
73
- and space. A plugin sees only its own connections. Deleting a space deletes them. Unloading or
74
- removing the plugin leaves them in place.
72
+ A connection a plugin makes is a connection of the space (the table `space_connection` of the
73
+ tenant’s database): it signs in as the space, is open to everyone and starts with the space’s
74
+ default rules (reading runs, a change or a mail waits for the admins’ approval, deleting never).
75
+ The row notes which plugin set it up, and a plugin sees only its own. The space’s admins see it
76
+ with the other connections and may change its name, who may use it and its rules. Deleting a
77
+ space deletes it. Unloading or removing the plugin leaves it in place.
@@ -62,7 +62,7 @@ listeners are done.
62
62
  | `run.id`, `run.wizardId` | The run and its wizard |
63
63
  | `run.mode` | `"live"`: a real run, over the wizard’s link or from an AI app. `"test"`: a test run |
64
64
  | `run.status` | `"done"`, `"failed"` or `"cancelled"` |
65
- | `wizard` | `{ id, title, projectId }` |
65
+ | `wizard` | `{ id, title, spaceId }` |
66
66
  | `values` | What the person answered, by field id |
67
67
 
68
68
  `values` holds the answers as the wizard asked for them. Which fields exist depends on the
@@ -56,6 +56,7 @@ keeps a line for every run that ended and shows them in the studio.
56
56
  | `engenty.plugin.json` | A manifest |
57
57
  | `migrations/0001_init.sql` | A table, `run_log_entry`, with an index |
58
58
  | `migrations/0002_space.sql` | A column added later: the space of each line |
59
+ | `migrations/0003_space_id.sql` | A column renamed, with its index |
59
60
  | `src/schema.ts` | The same table for Drizzle |
60
61
  | `src/plugin.ts` | A listener on the three run events (`run.done`, `run.failed`, `run.cancelled`), two routes (one for admins only, one that filters by space) and a tool, `run-log.recent` |
61
62
  | `ui/messages.ts` | Its texts in English and German |
@@ -15,8 +15,8 @@ loads them from their files and loads a plugin again when its files change.
15
15
  | A runner: a door a wizard runs through, with the run API that drives runs from it | In the share dialog’s channels, at `/w/<token>/<runner>`, on the wizard’s first page | [Runners](./runners.md) |
16
16
  | A runner’s settings and setup in the share dialog | In the share dialog, behind its gear and behind “Set up” in the runner’s row | [Runners](./runners.md#the-runners-part-of-the-share-dialog) |
17
17
  | A block and tools for every AI step of a space | In the steps’ instructions | [The space](./space.md) |
18
- | Pages, tables and files of a space’s Knowledge, with their categories | In Knowledge, and in what `project_search` finds | [The space](./space.md#knowledge-a-plugin-writes) |
19
- | Texts in a space’s search index | In what `project_search` finds | [The space](./space.md#the-search-index) |
18
+ | Pages, tables and files of a space’s Knowledge, with their categories | In Knowledge, and in what `space_search` finds | [The space](./space.md#knowledge-a-plugin-writes) |
19
+ | Texts in a space’s search index | In what `space_search` finds | [The space](./space.md#the-search-index) |
20
20
  | Tools of the studio’s assistant, and their cards | In the assistant’s chat, on every page. For now the assistant is off unless it is switched on | [The space](./space.md#tools-of-the-space-assistant) |
21
21
  | Routes | Below `/api/studio/plugins/<id>`, for programs with a key below `/api/v1/plugins/<id>`; public ones below `/api/public/plugins/<id>`, one for every tenant below `/api/public/plugins/<id>/shared` | [Routes](./routes.md) |
22
22
  | Tables | In every tenant’s database | [Tables](./tables.md) |