@engenty/wizards-runtime 0.12.2 → 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 (328) 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 +126 -71
  5. package/apps/runtime/dist/agents/website.js +1 -1
  6. package/apps/runtime/dist/app.js +28 -3
  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/credits/estimate.js +3 -3
  29. package/apps/runtime/dist/db/adopt.js +3 -3
  30. package/apps/runtime/dist/db/client.js +9 -0
  31. package/apps/runtime/dist/db/live-triggers.js +65 -23
  32. package/apps/runtime/dist/db/migrations/tenant/0027_work_chats.sql +52 -0
  33. package/apps/runtime/dist/db/migrations/tenant/0028_chat_approvals.sql +17 -0
  34. package/apps/runtime/dist/db/migrations/tenant/0029_work_chats_live.sql +49 -0
  35. package/apps/runtime/dist/db/migrations/tenant/0031_space.sql +624 -0
  36. package/apps/runtime/dist/db/migrations/tenant/0032_rwx_rule.sql +18 -0
  37. package/apps/runtime/dist/db/migrations/tenant/0033_broker_log.sql +23 -0
  38. package/apps/runtime/dist/db/migrations/tenant/0034_space_connection.sql +35 -0
  39. package/apps/runtime/dist/db/migrations/tenant/0035_run_grant.sql +1 -0
  40. package/apps/runtime/dist/db/migrations/tenant/0036_approval_held_for.sql +1 -0
  41. package/apps/runtime/dist/db/migrations/tenant/0037_ways_out.sql +5 -0
  42. package/apps/runtime/dist/db/migrations/tenant/0038_heard.sql +11 -0
  43. package/apps/runtime/dist/db/migrations/tenant/0039_members_studio.sql +1 -0
  44. package/apps/runtime/dist/db/migrations/tenant/meta/0027_snapshot.json +383 -155
  45. package/apps/runtime/dist/db/migrations/tenant/meta/0028_snapshot.json +4468 -0
  46. package/apps/runtime/dist/db/migrations/tenant/meta/0029_snapshot.json +4475 -0
  47. package/apps/runtime/dist/db/migrations/tenant/meta/0030_snapshot.json +4629 -0
  48. package/apps/runtime/dist/db/migrations/tenant/meta/0031_snapshot.json +4629 -0
  49. package/apps/runtime/dist/db/migrations/tenant/meta/0032_snapshot.json +4757 -0
  50. package/apps/runtime/dist/db/migrations/tenant/meta/0033_snapshot.json +5039 -0
  51. package/apps/runtime/dist/db/migrations/tenant/meta/0034_snapshot.json +5022 -0
  52. package/apps/runtime/dist/db/migrations/tenant/meta/0035_snapshot.json +5029 -0
  53. package/apps/runtime/dist/db/migrations/tenant/meta/0036_snapshot.json +5037 -0
  54. package/apps/runtime/dist/db/migrations/tenant/meta/0037_snapshot.json +5076 -0
  55. package/apps/runtime/dist/db/migrations/tenant/meta/0038_snapshot.json +5145 -0
  56. package/apps/runtime/dist/db/migrations/tenant/meta/0039_snapshot.json +5153 -0
  57. package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +86 -2
  58. package/apps/runtime/dist/db/schema.js +295 -72
  59. package/apps/runtime/dist/docs/dev/architecture.md +215 -0
  60. package/apps/runtime/dist/docs/dev/broker.md +298 -0
  61. package/apps/runtime/dist/docs/dev/index.md +5 -1
  62. package/apps/runtime/dist/docs/dev/integration/index.md +2 -0
  63. package/apps/runtime/dist/docs/dev/meta.json +3 -0
  64. package/apps/runtime/dist/docs/dev/plugins/connections.md +8 -5
  65. package/apps/runtime/dist/docs/dev/plugins/events.md +1 -1
  66. package/apps/runtime/dist/docs/dev/plugins/examples.md +1 -0
  67. package/apps/runtime/dist/docs/dev/plugins/index.md +2 -2
  68. package/apps/runtime/dist/docs/dev/plugins/reference.md +3 -2
  69. package/apps/runtime/dist/docs/dev/plugins/space.md +16 -6
  70. package/apps/runtime/dist/docs/dev/plugins/studio.md +2 -2
  71. package/apps/runtime/dist/docs/dev/plugins/tools.md +0 -1
  72. package/apps/runtime/dist/docs/dev/skills.md +16 -9
  73. package/apps/runtime/dist/docs/dev/wizard-format/agent-steps.md +59 -6
  74. package/apps/runtime/dist/docs/dev/wizard-format/lists-and-connections.md +17 -2
  75. package/apps/runtime/dist/docs/dev/wizard-format/templates.md +2 -0
  76. package/apps/runtime/dist/docs/dev/wizard-format/views-and-widgets.md +22 -2
  77. package/apps/runtime/dist/docs/user-guide/capabilities.md +132 -0
  78. package/apps/runtime/dist/docs/user-guide/cloud-sync.md +2 -0
  79. package/apps/runtime/dist/docs/user-guide/command-line.md +1 -0
  80. package/apps/runtime/dist/docs/user-guide/connectors.md +63 -7
  81. package/apps/runtime/dist/docs/user-guide/index.md +10 -1
  82. package/apps/runtime/dist/docs/user-guide/meta.json +6 -1
  83. package/apps/runtime/dist/docs/user-guide/models.md +105 -30
  84. package/apps/runtime/dist/docs/user-guide/protocol.md +80 -0
  85. package/apps/runtime/dist/docs/user-guide/skills.md +8 -4
  86. package/apps/runtime/dist/docs/user-guide/space.md +5 -4
  87. package/apps/runtime/dist/docs/user-guide/together.md +29 -2
  88. package/apps/runtime/dist/docs/user-guide/troubleshooting.md +2 -2
  89. package/apps/runtime/dist/docs/user-guide/work-mode.md +128 -0
  90. package/apps/runtime/dist/engenty/connections-external/build-connector.js +2 -5
  91. package/apps/runtime/dist/engenty/connections-external/importer/classify.js +72 -0
  92. package/apps/runtime/dist/engenty/connections-google/connectors/gmail.js +1 -1
  93. package/apps/runtime/dist/engenty/connections-microsoft/outlook.js +3 -2
  94. package/apps/runtime/dist/engenty/connections-sdk/types.js +2 -0
  95. package/apps/runtime/dist/engenty/connections-slack/connector.js +2 -1
  96. package/apps/runtime/dist/engine/decide.js +1 -1
  97. package/apps/runtime/dist/engine/requirements.js +139 -11
  98. package/apps/runtime/dist/engine/resources.js +43 -12
  99. package/apps/runtime/dist/engine/runner.js +121 -27
  100. package/apps/runtime/dist/engine/steps.js +42 -16
  101. package/apps/runtime/dist/engine/template.js +35 -1
  102. package/apps/runtime/dist/env.js +9 -4
  103. package/apps/runtime/dist/index.js +18 -2
  104. package/apps/runtime/dist/link-preview.js +9 -0
  105. package/apps/runtime/dist/live/feed.js +2 -2
  106. package/apps/runtime/dist/live/origin.js +2 -2
  107. package/apps/runtime/dist/live/views.js +51 -26
  108. package/apps/runtime/dist/manage.js +32 -0
  109. package/apps/runtime/dist/mcp/flow-app.js +1 -1
  110. package/apps/runtime/dist/mcp/handler.js +55 -1
  111. package/apps/runtime/dist/mcp/seen.js +47 -0
  112. package/apps/runtime/dist/mcp/tools.js +75 -34
  113. package/apps/runtime/dist/models.js +203 -12
  114. package/apps/runtime/dist/motion-graphics/project.js +8 -8
  115. package/apps/runtime/dist/motion-graphics/step.js +2 -2
  116. package/apps/runtime/dist/motion-graphics/tools.js +1 -1
  117. package/apps/runtime/dist/plugins/events.js +2 -2
  118. package/apps/runtime/dist/plugins/jobs.js +4 -1
  119. package/apps/runtime/dist/plugins/loader.js +2 -2
  120. package/apps/runtime/dist/prompts/architect.md +3 -3
  121. package/apps/runtime/dist/prompts/authoring.md +46 -12
  122. package/apps/runtime/dist/prompts/goose.md +14 -13
  123. package/apps/runtime/dist/prompts/mcp.md +6 -6
  124. package/apps/runtime/dist/prompts/safety.md +18 -0
  125. package/apps/runtime/dist/prompts/services.md +4 -4
  126. package/apps/runtime/dist/prompts/step.md +3 -3
  127. package/apps/runtime/dist/prompts/tools.md +39 -10
  128. package/apps/runtime/dist/routes/api.js +31 -20
  129. package/apps/runtime/dist/routes/broker.js +316 -0
  130. package/apps/runtime/dist/routes/connections.js +71 -0
  131. package/apps/runtime/dist/routes/delivery.js +25 -0
  132. package/apps/runtime/dist/routes/discover.js +17 -0
  133. package/apps/runtime/dist/routes/live.js +11 -1
  134. package/apps/runtime/dist/routes/marketplace.js +3 -3
  135. package/apps/runtime/dist/routes/person.js +4 -1
  136. package/apps/runtime/dist/routes/plugins.js +3 -1
  137. package/apps/runtime/dist/routes/rules.js +26 -0
  138. package/apps/runtime/dist/routes/runs.js +59 -33
  139. package/apps/runtime/dist/routes/skills.js +6 -6
  140. package/apps/runtime/dist/routes/studio.js +256 -148
  141. package/apps/runtime/dist/routes/work.js +199 -0
  142. package/apps/runtime/dist/safety.js +60 -18
  143. package/apps/runtime/dist/sandbox/index.js +27 -0
  144. package/apps/runtime/dist/services/access.js +38 -17
  145. package/apps/runtime/dist/services/api.js +38 -13
  146. package/apps/runtime/dist/services/architect.js +3 -3
  147. package/apps/runtime/dist/services/assistant-chats.js +9 -1
  148. package/apps/runtime/dist/services/brand.js +12 -12
  149. package/apps/runtime/dist/services/broker-bell.js +69 -0
  150. package/apps/runtime/dist/services/broker-notify.js +127 -0
  151. package/apps/runtime/dist/services/client-steps.js +79 -0
  152. package/apps/runtime/dist/services/cloud.js +42 -42
  153. package/apps/runtime/dist/services/command-risk.js +51 -0
  154. package/apps/runtime/dist/services/discover.js +85 -0
  155. package/apps/runtime/dist/services/knowledge-model.js +13 -13
  156. package/apps/runtime/dist/services/knowledge.js +117 -80
  157. package/apps/runtime/dist/services/manage-reports.js +77 -7
  158. package/apps/runtime/dist/services/marketplace.js +7 -31
  159. package/apps/runtime/dist/services/members-studio.js +165 -0
  160. package/apps/runtime/dist/services/onboarding.js +22 -22
  161. package/apps/runtime/dist/services/package-file.js +1 -1
  162. package/apps/runtime/dist/services/package.js +22 -22
  163. package/apps/runtime/dist/services/pages.js +13 -9
  164. package/apps/runtime/dist/services/runs.js +4 -3
  165. package/apps/runtime/dist/services/seen.js +55 -0
  166. package/apps/runtime/dist/services/shares.js +28 -13
  167. package/apps/runtime/dist/services/site.js +23 -23
  168. package/apps/runtime/dist/services/skills-registry.js +15 -15
  169. package/apps/runtime/dist/services/skills.js +44 -44
  170. package/apps/runtime/dist/services/space-categories.js +35 -35
  171. package/apps/runtime/dist/services/space-data.js +130 -111
  172. package/apps/runtime/dist/services/{project-files.js → space-files.js} +84 -75
  173. package/apps/runtime/dist/services/{project-index.js → space-index.js} +116 -73
  174. package/apps/runtime/dist/services/space-origin.js +19 -11
  175. package/apps/runtime/dist/services/spaces.js +478 -598
  176. package/apps/runtime/dist/services/synced-spaces.js +668 -0
  177. package/apps/runtime/dist/services/themes.js +15 -15
  178. package/apps/runtime/dist/services/widgets.js +6 -6
  179. package/apps/runtime/dist/services/wizards.js +112 -38
  180. package/apps/runtime/dist/services/work-ai.js +257 -0
  181. package/apps/runtime/dist/services/work-approvals.js +104 -0
  182. package/apps/runtime/dist/services/work-chats.js +908 -0
  183. package/apps/runtime/dist/services/work-connections.js +90 -0
  184. package/apps/runtime/dist/services/work-files.js +85 -0
  185. package/apps/runtime/dist/services/work-mastra.js +73 -0
  186. package/apps/runtime/dist/services/work-sandbox.js +42 -0
  187. package/apps/runtime/dist/sharing/files.js +14 -4
  188. package/apps/runtime/dist/sharing/index.js +40 -39
  189. package/apps/runtime/dist/sharing/jobs.js +67 -17
  190. package/apps/runtime/dist/sharing/targets/connector.js +10 -6
  191. package/apps/runtime/dist/sharing/targets/email.js +10 -8
  192. package/apps/runtime/dist/sharing/targets/slack.js +10 -8
  193. package/apps/runtime/dist/sharing/targets/storage.js +6 -4
  194. package/apps/runtime/dist/store/index.js +14 -3
  195. package/apps/runtime/dist/store/shared-lists.js +4 -2
  196. package/apps/runtime/dist/sync/apply.js +2 -2
  197. package/apps/runtime/dist/sync/client.js +113 -113
  198. package/apps/runtime/dist/sync/hub.js +41 -41
  199. package/apps/runtime/dist/sync/log.js +12 -12
  200. package/apps/runtime/dist/sync/records.js +118 -120
  201. package/apps/runtime/dist/texts.js +44 -2
  202. package/apps/runtime/dist/tools/connections.js +112 -0
  203. package/apps/runtime/dist/tools/connector.js +157 -67
  204. package/apps/runtime/dist/tools/index.js +31 -15
  205. package/apps/runtime/dist/tools/mail.js +40 -11
  206. package/apps/runtime/dist/tools/pages.js +11 -5
  207. package/apps/runtime/dist/tools/plugin.js +43 -7
  208. package/apps/runtime/dist/tools/skills.js +1 -1
  209. package/apps/runtime/dist/tools/{project.js → space.js} +30 -25
  210. package/apps/runtime/dist/tools/store.js +3 -2
  211. package/apps/runtime/dist/widgets/step.js +10 -10
  212. package/apps/web/dist/assets/AboutDialog-DgfeipUc.js +1 -0
  213. package/apps/web/dist/assets/CapabilitiesPage-BoYJvgIu.js +2 -0
  214. package/apps/web/dist/assets/{ChangelogDialog-CKLgFL6r.js → ChangelogDialog-Duab4zTO.js} +1 -1
  215. package/apps/web/dist/assets/{CodeEditor-B3nto_26.js → CodeEditor-nxoOt8ge.js} +1 -1
  216. package/apps/web/dist/assets/EditorPage-ZrgGpYMC.js +3 -0
  217. package/apps/web/dist/assets/{FlowPreview-zJCtixSi.js → FlowPreview-aMfwcPul.js} +1 -1
  218. package/apps/web/dist/assets/LangSwitch-DpD0inR4.js +1 -0
  219. package/apps/web/dist/assets/Marketplace-CpzD9pNQ.js +2 -0
  220. package/apps/web/dist/assets/NewWizardChannels-IB18afWN.js +1 -0
  221. package/apps/web/dist/assets/NewWizardPage-rYbcmPGG.js +7 -0
  222. package/apps/web/dist/assets/OnboardingPage-ztHT01ah.js +1 -0
  223. package/apps/web/dist/assets/PreviewPane-DviWTLfi.js +9 -0
  224. package/apps/web/dist/assets/PublicRunner-C2geZhhM.js +1 -0
  225. package/apps/web/dist/assets/ReadOnly-kSb_Kbdm.js +1 -0
  226. package/apps/web/dist/assets/SettingsPage-DM2h8N0J.js +2 -0
  227. package/apps/web/dist/assets/SetupPage-Wfyz6xH4.js +1 -0
  228. package/apps/web/dist/assets/SharePage-CyWQorWB.js +1 -0
  229. package/apps/web/dist/assets/SkillEditor-CqQMg2MC.js +1 -0
  230. package/apps/web/dist/assets/Skills-CnhpgoOA.js +9 -0
  231. package/apps/web/dist/assets/SpacePage-q4Bk3N7k.js +2 -0
  232. package/apps/web/dist/assets/UpdateCheck-C2CE6CC3.js +2 -0
  233. package/apps/web/dist/assets/changelog-B6hN1Cp7.js +1 -0
  234. package/apps/web/dist/assets/circle-alert-C8Ma-bPY.js +1 -0
  235. package/apps/web/dist/assets/circle-check-Bu9Z3mlJ.js +1 -0
  236. package/apps/web/dist/assets/code-editor-CfTGqOpp.js +2 -0
  237. package/apps/web/dist/assets/{code-xml-Hx7YxCg0.js → code-xml-B4kLFZSj.js} +1 -1
  238. package/apps/web/dist/assets/connection-sign-in-CIiv0t2p.js +1 -0
  239. package/apps/web/dist/assets/esm-Xwn4GtqG.js +7 -0
  240. package/apps/web/dist/assets/{eye-BkMFLnYu.js → eye-BpoKpIdt.js} +1 -1
  241. package/apps/web/dist/assets/host-BrP-ENHg.css +1 -0
  242. package/apps/web/dist/assets/host-DJ7-p0Sc.js +118 -0
  243. package/apps/web/dist/assets/i18n-BJ7Ld6O6.js +55 -0
  244. package/apps/web/dist/assets/index-D18DvnxX.css +1 -0
  245. package/apps/web/dist/assets/index-D2akynS-.js +10 -0
  246. package/apps/web/dist/assets/logo-BpnjXTRy.js +1 -0
  247. package/apps/web/dist/assets/oss-credits-IdX5bc71.js +1 -0
  248. package/apps/web/dist/assets/{phone-DMfwuh9V.js → phone-Ctvf-Am-.js} +1 -1
  249. package/apps/web/dist/assets/read-aloud-Da_RSm2S.js +1 -0
  250. package/apps/web/dist/assets/{runners-D5qz6b_s.js → runners-CyIvJIHr.js} +1 -1
  251. package/apps/web/dist/assets/scroll-text-ChrjRu9Y.js +1 -0
  252. package/apps/web/dist/assets/session-SXPtTWRK.js +2 -0
  253. package/apps/web/dist/assets/theme-CbTcTFWy.js +11 -0
  254. package/apps/web/dist/assets/ui-Uqnx1UpK.js +82 -0
  255. package/apps/web/dist/assets/{upload-DQJwLSGj.js → upload-BchUnQGV.js} +1 -1
  256. package/apps/web/dist/assets/{useMutation-C20c2EH3.js → useMutation-DEkZhp5c.js} +1 -1
  257. package/apps/web/dist/assets/{volume-2-CC5qamYT.js → volume-2-CU_oy81Z.js} +1 -1
  258. package/apps/web/dist/assets/with-selector-CoMyWBAX.js +1 -0
  259. package/apps/web/dist/index.html +17 -10
  260. package/apps/web/dist/mcp/flow.html +119 -64
  261. package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +20 -10
  262. package/node_modules/@engenty/wizards-shared/dist/assistant.d.ts +7 -1
  263. package/node_modules/@engenty/wizards-shared/dist/assistant.js +11 -1
  264. package/node_modules/@engenty/wizards-shared/dist/connectors.d.ts +236 -2
  265. package/node_modules/@engenty/wizards-shared/dist/connectors.js +52 -2
  266. package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +257 -8
  267. package/node_modules/@engenty/wizards-shared/dist/definition.js +113 -15
  268. package/node_modules/@engenty/wizards-shared/dist/discover.d.ts +21 -0
  269. package/node_modules/@engenty/wizards-shared/dist/discover.js +1 -0
  270. package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +38 -2
  271. package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +38 -2
  272. package/node_modules/@engenty/wizards-shared/dist/fit.js +1 -1
  273. package/node_modules/@engenty/wizards-shared/dist/json-schema.d.ts +1 -1
  274. package/node_modules/@engenty/wizards-shared/dist/json-schema.js +1 -1
  275. package/node_modules/@engenty/wizards-shared/dist/live.d.ts +2 -2
  276. package/node_modules/@engenty/wizards-shared/dist/live.js +1 -1
  277. package/node_modules/@engenty/wizards-shared/dist/marketplace.d.ts +0 -5
  278. package/node_modules/@engenty/wizards-shared/dist/marketplace.js +3 -1
  279. package/node_modules/@engenty/wizards-shared/dist/run.d.ts +115 -6
  280. package/node_modules/@engenty/wizards-shared/dist/run.js +135 -0
  281. package/node_modules/@engenty/wizards-shared/dist/runner-texts.d.ts +15 -1
  282. package/node_modules/@engenty/wizards-shared/dist/runner-texts.js +14 -0
  283. package/node_modules/@engenty/wizards-shared/dist/rwx.d.ts +42 -0
  284. package/node_modules/@engenty/wizards-shared/dist/rwx.js +29 -0
  285. package/node_modules/@engenty/wizards-shared/dist/skills.d.ts +1 -1
  286. package/node_modules/@engenty/wizards-shared/dist/space-data.d.ts +2 -2
  287. package/node_modules/@engenty/wizards-shared/dist/{projects.d.ts → spaces.d.ts} +39 -15
  288. package/node_modules/@engenty/wizards-shared/dist/{projects.js → spaces.js} +16 -9
  289. package/node_modules/@engenty/wizards-shared/dist/store.d.ts +7 -2
  290. package/node_modules/@engenty/wizards-shared/dist/surface.d.ts +35 -4
  291. package/node_modules/@engenty/wizards-shared/dist/surface.js +121 -3
  292. package/node_modules/@engenty/wizards-shared/dist/sync.d.ts +1 -1
  293. package/node_modules/@engenty/wizards-shared/dist/theme-look.js +1 -1
  294. package/node_modules/@engenty/wizards-shared/dist/tiers.d.ts +195 -0
  295. package/node_modules/@engenty/wizards-shared/dist/tiers.js +98 -0
  296. package/node_modules/@engenty/wizards-shared/dist/wizard-package.d.ts +2 -2
  297. package/node_modules/@engenty/wizards-shared/dist/wizard-package.js +3 -3
  298. package/package.json +4 -1
  299. package/plugin/.claude-plugin/plugin.json +1 -1
  300. package/plugin/plugin.json +1 -1
  301. package/plugin/skills/build-wizard/SKILL.md +1 -1
  302. package/apps/runtime/dist/services/projects.js +0 -473
  303. package/apps/web/dist/assets/AboutDialog-CLgnoYTI.js +0 -1
  304. package/apps/web/dist/assets/EditorPage-D9JDdAAI.js +0 -3
  305. package/apps/web/dist/assets/Marketplace-D4e0Oac9.js +0 -2
  306. package/apps/web/dist/assets/NewWizardChannels-B4N7GIYh.js +0 -1
  307. package/apps/web/dist/assets/NewWizardPage-Dpt0Mzk8.js +0 -7
  308. package/apps/web/dist/assets/OnboardingPage-CDoYVjRC.js +0 -1
  309. package/apps/web/dist/assets/PreviewPane-DPB5nEd5.js +0 -10
  310. package/apps/web/dist/assets/ProjectPage-408YOoNa.js +0 -10
  311. package/apps/web/dist/assets/PublicRunner-BZ66xdRX.js +0 -1
  312. package/apps/web/dist/assets/ReadOnly-C9oGMkUB.js +0 -1
  313. package/apps/web/dist/assets/SettingsPage-Dq3AZwJS.js +0 -2
  314. package/apps/web/dist/assets/SetupPage-CP3lbyZc.js +0 -1
  315. package/apps/web/dist/assets/SharePage-DdMm1Y8K.js +0 -1
  316. package/apps/web/dist/assets/SkillEditor-b5NMFB90.js +0 -1
  317. package/apps/web/dist/assets/changelog-82-DHogQ.js +0 -1
  318. package/apps/web/dist/assets/esm-BdxDT9Km.js +0 -7
  319. package/apps/web/dist/assets/i18n-CKKh3Pn0.js +0 -55
  320. package/apps/web/dist/assets/index-Cy2NHzAx.js +0 -49
  321. package/apps/web/dist/assets/index-wR_-1hfN.css +0 -1
  322. package/apps/web/dist/assets/lock-CGXM95Mi.js +0 -1
  323. package/apps/web/dist/assets/logo-CGNoptDg.js +0 -1
  324. package/apps/web/dist/assets/oss-credits-DpRWUPjD.js +0 -1
  325. package/apps/web/dist/assets/session-DRy0k0nh.js +0 -2
  326. package/apps/web/dist/assets/theme-DNPm6r4e.js +0 -11
  327. package/apps/web/dist/assets/ui-CwFQAfE-.js +0 -83
  328. /package/apps/runtime/dist/db/migrations/tenant/{0027_space_skill.sql → 0030_space_skill.sql} +0 -0
@@ -39,8 +39,8 @@ export async function followFor(tenantId, install, since, hear) {
39
39
  if (e.event === "changes") {
40
40
  const spaces = new Set();
41
41
  for (const x of e.items) {
42
- if (x.projectId && !(x.seq !== undefined && pushedBy(tenantId, install, x.seq))) {
43
- spaces.add(x.projectId);
42
+ if (x.spaceId && !(x.seq !== undefined && pushedBy(tenantId, install, x.seq))) {
43
+ spaces.add(x.spaceId);
44
44
  }
45
45
  }
46
46
  // Its own push only: the number moves on, nothing to pull.
@@ -4,20 +4,21 @@ import { eq } from "drizzle-orm";
4
4
  import { listConnectors } from "../connectors/external.js";
5
5
  import { db, schema } from "../db/client.js";
6
6
  import { embeddingModel } from "../models.js";
7
- import { mayBuild, projectWritable } from "../services/access.js";
7
+ import { mayBuild, spaceWritable } from "../services/access.js";
8
8
  import { cloudLinked, cloudState } from "../services/cloud.js";
9
9
  import { ServiceError } from "../services/errors.js";
10
+ import { closedToMe, studioOpen } from "../services/members-studio.js";
10
11
  import { presentIn } from "../services/presence.js";
11
- import { fileView, projectFiles } from "../services/project-files.js";
12
- import { listProjects, ownedProject } from "../services/projects.js";
13
12
  import { getPage, getRow, getTableHeader } from "../services/space-data.js";
13
+ import { fileView, spaceFiles } from "../services/space-files.js";
14
+ import { listSpaces, ownedSpace } from "../services/spaces.js";
14
15
  import { publishedDefinition, translationsOf } from "../services/translations.js";
15
16
  import { listWizards, ownedWizard, wizardMessages, wizardState } from "../services/wizards.js";
16
17
  /** The spaces, as the studio lists them. */
17
18
  export async function spacesView(r) {
18
- const projects = await listProjects(r.userId, r.lang);
19
+ const spaces = await listSpaces(r.userId, r.lang);
19
20
  const build = await mayBuild();
20
- return projects.map((p) => ({
21
+ return Promise.all(spaces.map(async (p) => ({
21
22
  id: p.id,
22
23
  name: p.name,
23
24
  brand: p.brand,
@@ -29,12 +30,18 @@ export async function spacesView(r) {
29
30
  origin: p.origin,
30
31
  syncedAt: p.syncedAt?.toISOString() ?? null,
31
32
  readOnly: p.origin === "local" || !build,
32
- }));
33
+ /** „Mitglieder dürfen ins Studio“: the organization's members build here too. */
34
+ membersStudio: p.membersStudio,
35
+ /** Whether this person reaches the space's Studio: a member only by the rule above. */
36
+ studio: await studioOpen(p),
37
+ /** How the admins hear of the broker's critical lines: Work's bell, the hourly mail. */
38
+ notify: p.notify,
39
+ })));
33
40
  }
34
41
  /** A space's wizards, as its cards show them. */
35
- export async function wizardsView(r, projectId) {
36
- await ownedProject(r.userId, projectId);
37
- const wizards = await listWizards(r.userId, projectId);
42
+ export async function wizardsView(r, spaceId) {
43
+ await ownedSpace(r.userId, spaceId);
44
+ const wizards = await listWizards(r.userId, spaceId);
38
45
  // A local install with an account: where each wizard stands in its cloud, for the cards.
39
46
  const linked = await cloudLinked();
40
47
  return Promise.all(wizards.map(async (w) => ({ ...w, cloud: linked ? await cloudState(w.id) : null })));
@@ -43,11 +50,11 @@ export async function wizardsView(r, projectId) {
43
50
  export async function wizardView(r, id) {
44
51
  const w = await ownedWizard(r.userId, id);
45
52
  const messages = await wizardMessages(w.id);
46
- const project = await ownedProject(r.userId, w.projectId);
53
+ const space = await ownedSpace(r.userId, w.spaceId);
47
54
  return {
48
55
  ...(await wizardState(w)),
49
56
  /** Shown and run here, changed elsewhere: a local install's wizard, or nothing is built here. */
50
- readOnly: !(await projectWritable(project)),
57
+ readOnly: !(await spaceWritable(space)),
51
58
  blank: messages.length === 0 && !w.starter,
52
59
  messages: messages.map((m) => ({
53
60
  id: m.id,
@@ -75,18 +82,18 @@ export async function translationsView(r, wizardId) {
75
82
  };
76
83
  }
77
84
  /** What a space holds for all its wizards. */
78
- export async function filesView(r, projectId) {
79
- const project = await ownedProject(r.userId, projectId);
85
+ export async function filesView(r, spaceId) {
86
+ const space = await ownedSpace(r.userId, spaceId);
80
87
  return {
81
- files: (await projectFiles(project.id)).map(fileView),
88
+ files: (await spaceFiles(space.id)).map(fileView),
82
89
  /** Whether documents get vectors, or the index works on keywords alone. */
83
90
  embeddings: Boolean(await embeddingModel().catch(() => null)),
84
91
  };
85
92
  }
86
93
  /** The connectors a space's wizards can name. */
87
- export async function connectorsView(r, projectId) {
88
- const project = await ownedProject(r.userId, projectId);
89
- return listConnectors(project.id);
94
+ export async function connectorsView(r, spaceId) {
95
+ const space = await ownedSpace(r.userId, spaceId);
96
+ return listConnectors(space.id);
90
97
  }
91
98
  // --- one item, for the live stream ------------------------------------------------------------
92
99
  const gone = (err) => err instanceof ServiceError && err.code === "not_found";
@@ -97,41 +104,59 @@ const gone = (err) => err instanceof ServiceError && err.code === "not_found";
97
104
  const ITEM_VIEWS = {
98
105
  space: async (r, x) => (await spacesView(r)).find((s) => s.id === x.item) ?? null,
99
106
  wizard: async (r, x) => {
100
- const summary = x.projectId
101
- ? (await wizardsView(r, x.projectId)).find((w) => w.id === x.item)
107
+ const summary = x.spaceId
108
+ ? (await wizardsView(r, x.spaceId)).find((w) => w.id === x.item)
102
109
  : undefined;
103
110
  return summary ? { summary, detail: await wizardView(r, x.item) } : null;
104
111
  },
105
112
  translation: async (r, x) => (x.parent ? translationsView(r, x.parent) : null),
106
113
  message: null,
107
- page: (r, x) => getPage(r.userId, x.item),
108
- table: (r, x) => getTableHeader(r.userId, x.item),
114
+ page: (r, x) => getPage(r.userId, x.item, r.who),
115
+ table: (r, x) => getTableHeader(r.userId, x.item, r.who),
109
116
  row: async (r, x) => {
110
- const row = x.parent ? await getRow(r.userId, x.parent, x.item) : null;
117
+ const row = x.parent ? await getRow(r.userId, x.parent, x.item, r.who) : null;
111
118
  return row ? { ...row, tableId: x.parent } : null;
112
119
  },
113
120
  category: null,
121
+ // Work's chats: the studio reads the chat and the sidebar again (routes/live.ts checks each).
122
+ chat: null,
114
123
  presence: async (_r, x) => x.parent ? presentIn(x.parent, x.item.slice(x.parent.length + 1)) : [],
115
124
  file: async (_r, x) => {
116
- const row = await db.query.projectFile.findFirst({ where: eq(schema.projectFile.id, x.item) });
125
+ const row = await db.query.spaceFile.findFirst({ where: eq(schema.spaceFile.id, x.item) });
117
126
  return row ? fileView(row) : null;
118
127
  },
119
128
  // The studio asks for the space's skills again: a list of names, no view of its own.
120
129
  skill: null,
121
130
  connector: async (r, x) => {
122
- if (!x.projectId) {
131
+ if (!x.spaceId) {
123
132
  return null;
124
133
  }
125
- const id = x.item.slice(x.projectId.length + 1);
126
- return (await connectorsView(r, x.projectId)).find((c) => c.id === id) ?? null;
134
+ const id = x.item.slice(x.spaceId.length + 1);
135
+ return (await connectorsView(r, x.spaceId)).find((c) => c.id === id) ?? null;
127
136
  },
128
137
  };
138
+ /**
139
+ * What the Studio alone shows of a space: a member whose Studio the space is closed to gets no view
140
+ * of these, and the browser asks the studio API, which refuses it (services/members-studio.ts).
141
+ * The space itself, its files and connectors are what Work reads in every space.
142
+ */
143
+ const STUDIO_KINDS = new Set([
144
+ "wizard",
145
+ "translation",
146
+ "page",
147
+ "table",
148
+ "row",
149
+ "presence",
150
+ ]);
129
151
  export async function itemView(r, x) {
130
152
  const read = ITEM_VIEWS[x.kind];
131
153
  if (!read) {
132
154
  return undefined;
133
155
  }
134
156
  try {
157
+ if (x.spaceId && STUDIO_KINDS.has(x.kind) && (await closedToMe(x.spaceId))) {
158
+ return undefined;
159
+ }
135
160
  return await read(r, x);
136
161
  }
137
162
  catch (err) {
@@ -217,6 +217,31 @@ export async function tenantInfo(id, fresh = false) {
217
217
  export function forgetTenant(id) {
218
218
  tenants.delete(id);
219
219
  }
220
+ /**
221
+ * Saves the organization's model policy for the admin who asks (`actorId`): the Manage-App checks
222
+ * their role and the plan's ways and answers with the policy as it stands now.
223
+ */
224
+ export async function saveModelPolicy(tenantId, actorId, modelPolicy) {
225
+ const saved = await call("PUT", `${tenantPath(tenantId)}/model-policy`, { actorId, ...modelPolicy });
226
+ forgetTenant(tenantId);
227
+ return saved.modelPolicy;
228
+ }
229
+ /**
230
+ * Puts the organization on another tier its plan offers, for the admin who asks (`actorId`); the
231
+ * Manage-App refuses one a contract set.
232
+ */
233
+ export async function saveModelTier(tenantId, actorId, tier) {
234
+ await call("PUT", `${tenantPath(tenantId)}/model-tier`, { actorId, tier });
235
+ forgetTenant(tenantId);
236
+ }
237
+ /** What a model would see of `text` with masking on: the labels given, else the saved ones. */
238
+ export async function tryMasking(tenantId, actorId, text, maskLabels) {
239
+ return call("POST", `${tenantPath(tenantId)}/model-policy/try`, {
240
+ actorId,
241
+ text,
242
+ ...(maskLabels ? { maskLabels } : {}),
243
+ });
244
+ }
220
245
  /** Renames the organization at the Manage-App; what it answers is the tenant as it stands now. */
221
246
  export async function renameTenant(id, name) {
222
247
  const value = await call("PATCH", `/v1/tenants/${encodeURIComponent(id)}`, {
@@ -319,6 +344,13 @@ export function putWizards(tenantId, data) {
319
344
  export function postRunReport(tenantId, data) {
320
345
  return call("POST", `/v1/runs/${encodeURIComponent(tenantId)}`, data);
321
346
  }
347
+ /**
348
+ * The broker's critical lines (docs/plans/broker.md, "Notifications"): a guest's at once, the
349
+ * rest once a day. The admin app's Diagnose page and Abuse checks read them.
350
+ */
351
+ export function postBrokerReport(tenantId, data) {
352
+ return call("POST", `/v1/broker/${encodeURIComponent(tenantId)}`, data);
353
+ }
322
354
  /** What a person said at the end of a run. */
323
355
  export function postFeedback(tenantId, data) {
324
356
  return call("POST", `/v1/feedback/${encodeURIComponent(tenantId)}`, data);
@@ -84,7 +84,7 @@ export async function flowView(userId, wizardId, options = {}) {
84
84
  const definition = options.definition ?? published?.definition ?? w.draft;
85
85
  // The app's own look unless it asks for one the wizard offers.
86
86
  const theme = options.theme && themeOffered(options.theme, definition.themes) ? options.theme : "host";
87
- const { theme: look } = await brandView(w.projectId, definition.themes, theme);
87
+ const { theme: look } = await brandView(w.spaceId, definition.themes, theme);
88
88
  return {
89
89
  wizard: {
90
90
  id: w.id,
@@ -1,14 +1,64 @@
1
1
  import { createMcpHandler, McpServer, originValidationResponse, } from "@modelcontextprotocol/server";
2
2
  import { withTenant } from "../db/client.js";
3
3
  import { env } from "../env.js";
4
+ import { feature } from "../features.js";
4
5
  import { nudge } from "../live/hub.js";
6
+ import { managed, tenantInfo } from "../manage.js";
5
7
  import { prompt } from "../prompts.js";
6
8
  import { asRole } from "../services/access.js";
7
9
  import { tenantStatus } from "../tenants/control.js";
10
+ import { serverText } from "../texts.js";
8
11
  import { authenticate, principalOf } from "./auth.js";
9
12
  import { registerFlowApp } from "./flow-app.js";
10
- import { noteRequest } from "./seen.js";
13
+ import { appKind, clientNameOf, noteChecked, noteRequest } from "./seen.js";
11
14
  import { registerPrompts, registerTools } from "./tools.js";
15
+ /**
16
+ * An app the organization's model policy keeps out of its spaces (`modelPolicy.apps`): its tool
17
+ * calls are answered with a tool error the app shows, before any tool reads the space. Calls of
18
+ * other kinds (listing the tools) go on. Behind `modelTiers`. Best effort: an app is told apart
19
+ * by the name it gives itself, and any name not known as a local app's counts as a subscription.
20
+ */
21
+ async function appRefusal(who, client, body) {
22
+ const calls = (Array.isArray(body) ? body : [body]).filter((m) => Boolean(m) && typeof m === "object" && m.method === "tools/call");
23
+ // A runtime that runs alone has no organization and no policy.
24
+ if (!calls.length || !managed) {
25
+ return null;
26
+ }
27
+ const info = await tenantInfo(who.tenantId).catch(() => null);
28
+ // When the Manage-App can't say what the policy allows, the app waits.
29
+ const policy = info && feature("modelTiers", info.features) ? info.modelPolicy : undefined;
30
+ if (info && !policy) {
31
+ return null;
32
+ }
33
+ const kind = appKind(client, who.client);
34
+ const allowed = policy
35
+ ? kind === "local"
36
+ ? policy.apps.local
37
+ : policy.apps.subscriptions
38
+ : false;
39
+ noteChecked(who.tenantId, client, who.name ?? who.email ?? null, allowed, kind);
40
+ if (allowed) {
41
+ return null;
42
+ }
43
+ const text = !info
44
+ ? serverText("en", "appPolicyUnavailable", { app: client })
45
+ : kind === "local"
46
+ ? serverText("en", "appLocalRefused", { organization: info.name, app: client })
47
+ : serverText("en", "appSubscriptionRefused", {
48
+ organization: info.name,
49
+ app: client,
50
+ tier: info.tier?.name ?? serverText("en", "appYourTier"),
51
+ });
52
+ const answers = calls.map((call) => ({
53
+ jsonrpc: "2.0",
54
+ id: call.id ?? null,
55
+ result: { content: [{ type: "text", text }], isError: true },
56
+ }));
57
+ return new Response(JSON.stringify(Array.isArray(body) ? answers : answers[0]), {
58
+ status: 200,
59
+ headers: { "content-type": "application/json" },
60
+ });
61
+ }
12
62
  /** A wizard definition is a few KB; this leaves room and refuses anything far beyond it. */
13
63
  const MAX_BODY_BYTES = 300_000;
14
64
  /**
@@ -48,6 +98,10 @@ export function mcpHandler() {
48
98
  .json()
49
99
  .catch(() => null);
50
100
  noteRequest(who.tenantId, authInfo.clientId, who.client, body);
101
+ const refused = await appRefusal(who, clientNameOf(authInfo.clientId, who.client), body);
102
+ if (refused) {
103
+ return refused;
104
+ }
51
105
  }
52
106
  const answer = await withTenant(who.tenantId, () => asRole(who.role, () => handler.fetch(request, { authInfo })));
53
107
  if (request.method === "POST") {
@@ -63,3 +63,50 @@ export function seenApps(tenantId) {
63
63
  }
64
64
  return out;
65
65
  }
66
+ /** The name a sign-in's client gave on `initialize`, else the one its sign-in carries. */
67
+ export function clientNameOf(signIn, client) {
68
+ return names.get(signIn) ?? client;
69
+ }
70
+ /**
71
+ * Apps whose model runs on the member's computer: what they read of a space stays there. Goose
72
+ * is not one: it mostly thinks on a provider's model.
73
+ */
74
+ const LOCAL_APPS = new Set(["lm-studio"]);
75
+ /**
76
+ * Whether an app thinks on the member's computer (`local`) or on a provider under the member's
77
+ * own subscription, from every name it goes by (the one it gave on `initialize`, its sign-in's).
78
+ * It counts as local only where a name says so and none names another app; any other counts as
79
+ * one on a subscription.
80
+ */
81
+ export function appKind(...names) {
82
+ const ids = names.flatMap(appIdsOf);
83
+ return ids.length && ids.every((id) => LOCAL_APPS.has(id)) ? "local" : "subscription";
84
+ }
85
+ const checked = new Map();
86
+ /** Counts one tool call of an app the policy allowed or refused. */
87
+ export function noteChecked(tenantId, app, person, allowed, kind) {
88
+ const key = `${tenantId}\n${app}\n${person ?? ""}`;
89
+ const last = checked.get(key) ?? {
90
+ app,
91
+ kind,
92
+ person,
93
+ allowed: 0,
94
+ refused: 0,
95
+ at: 0,
96
+ };
97
+ last.at = Date.now();
98
+ if (allowed) {
99
+ last.allowed++;
100
+ }
101
+ else {
102
+ last.refused++;
103
+ }
104
+ checked.set(key, last);
105
+ }
106
+ /** The apps the tenant's members used on its spaces since the runtime started, latest first. */
107
+ export function checkedApps(tenantId) {
108
+ return [...checked]
109
+ .filter(([key]) => key.startsWith(`${tenantId}\n`))
110
+ .map(([, value]) => value)
111
+ .sort((a, b) => b.at - a.at);
112
+ }
@@ -3,6 +3,7 @@ import { z } from "zod";
3
3
  import { authoringGuide } from "../authoring/guide.js";
4
4
  import { wizardOpSchema } from "../authoring/ops.js";
5
5
  import { importFromRegistry, listConnectors, searchRegistry } from "../connectors/external.js";
6
+ import { guideSpaceConnections } from "../connectors/space-connections.js";
6
7
  import { RunConflict } from "../engine/runner.js";
7
8
  import { pluginToolsOf } from "../plugins/registry.js";
8
9
  import { prompt } from "../prompts.js";
@@ -10,11 +11,12 @@ import { publishAndSync, pushSharing } from "../services/cloud.js";
10
11
  import { ServiceError } from "../services/errors.js";
11
12
  import { deleteFile, listFiles, readFileText, writeFile } from "../services/files.js";
12
13
  import { marketplaceWizard, searchMarketplace } from "../services/marketplace.js";
14
+ import { requireStudio } from "../services/members-studio.js";
13
15
  import { markAgent, presentIn } from "../services/presence.js";
14
- import { defaultProject, listProjects, ownedProject } from "../services/projects.js";
15
16
  import { answerRunAsk, answerRunPage, controlRun, reviewRun, runReport, startRun, startTestRun, testRunReport, } from "../services/runs.js";
17
+ import { defaultSpace, listSpaces, ownedSpace } from "../services/spaces.js";
16
18
  import { checkDraftWidget } from "../services/widgets.js";
17
- import { createWizard, editWizard, listWizards, ownedWizard, parseDraft, shareUrl, studioUrl, updateWizardSettings, wizardState, writeDraft, } from "../services/wizards.js";
19
+ import { checkDraft, createWizard, editWizard, listWizards, ownedWizard, parseDraft, shareUrl, studioUrl, updateWizardSettings, wizardState, writeDraft, } from "../services/wizards.js";
18
20
  import { FLOW_VIEW_KEY, flowAppMeta, flowView } from "./flow-app.js";
19
21
  const definition = z
20
22
  .record(z.string(), z.unknown())
@@ -57,6 +59,16 @@ function failure(err) {
57
59
  function spaceFrom(p) {
58
60
  return p.origin === "local" ? "your computer" : "here";
59
61
  }
62
+ /** A Studio tool's item: the wizard or the test run it names. */
63
+ async function requireStudioOf(args) {
64
+ const { wizardId, runId } = (args ?? {});
65
+ if (typeof wizardId === "string") {
66
+ await requireStudio("wizards", wizardId);
67
+ }
68
+ else if (typeof runId === "string") {
69
+ await requireStudio("runs", runId);
70
+ }
71
+ }
60
72
  function annotationsOf(config) {
61
73
  const readOnly = config.readOnly ?? false;
62
74
  return {
@@ -114,6 +126,12 @@ export function registerTools(server, who) {
114
126
  return result;
115
127
  }
116
128
  };
129
+ /** The space a Studio tool works in: the one named, or the person's first; refused where closed. */
130
+ const studioSpace = async (spaceId) => {
131
+ const space = spaceId ? await ownedSpace(who.userId, spaceId) : await defaultSpace(who.userId);
132
+ await requireStudio("spaces", space.id);
133
+ return space;
134
+ };
117
135
  const tool = (name, scope, config, run) => {
118
136
  if (!who.scopes.includes(scope)) {
119
137
  return;
@@ -127,6 +145,9 @@ export function registerTools(server, who) {
127
145
  // The SDK has parsed `args` with `input` before this runs.
128
146
  (async (args) => {
129
147
  try {
148
+ if (config.studio) {
149
+ await requireStudioOf(args);
150
+ }
130
151
  return ok(await withPresence(args, config.readOnly ?? false, await run(args)));
131
152
  }
132
153
  catch (err) {
@@ -147,6 +168,9 @@ export function registerTools(server, who) {
147
168
  _meta: flowAppMeta,
148
169
  }, (async (args) => {
149
170
  try {
171
+ if (config.studio) {
172
+ await requireStudioOf(args);
173
+ }
150
174
  const { result: plain, view } = await run(args);
151
175
  const result = (await withPresence(args, config.readOnly ?? false, plain));
152
176
  return {
@@ -165,14 +189,12 @@ export function registerTools(server, who) {
165
189
  title: "Authoring guide",
166
190
  description: prompt("mcp", "tool.get_authoring_guide"),
167
191
  input: z.object({
168
- projectId: z.string().optional().describe("Defaults to the person's first project."),
192
+ spaceId: z.string().optional().describe("Defaults to the person's first space."),
169
193
  }),
170
194
  readOnly: true,
171
- }, async ({ projectId }) => {
172
- const project = projectId
173
- ? await ownedProject(who.userId, projectId)
174
- : await defaultProject(who.userId);
175
- return authoringGuide(await listConnectors(project.id), await pluginToolsOf(who.tenantId));
195
+ }, async ({ spaceId }) => {
196
+ const space = await studioSpace(spaceId);
197
+ return authoringGuide(await listConnectors(space.id), await pluginToolsOf(who.tenantId), await guideSpaceConnections(space.id));
176
198
  });
177
199
  // --- connectors ------------------------------------------------------------
178
200
  tool("find_connectors", "wizards:read", {
@@ -184,27 +206,25 @@ export function registerTools(server, who) {
184
206
  tool("list_connectors", "wizards:read", {
185
207
  title: "List connectors",
186
208
  description: prompt("mcp", "tool.list_connectors"),
187
- input: z.object({ projectId: z.string().optional() }),
209
+ input: z.object({ spaceId: z.string().optional() }),
188
210
  readOnly: true,
189
- }, async ({ projectId }) => {
190
- const project = projectId
191
- ? await ownedProject(who.userId, projectId)
192
- : await defaultProject(who.userId);
193
- return { projectId: project.id, connectors: await listConnectors(project.id) };
211
+ }, async ({ spaceId }) => {
212
+ const space = spaceId
213
+ ? await ownedSpace(who.userId, spaceId)
214
+ : await defaultSpace(who.userId);
215
+ return { spaceId: space.id, connectors: await listConnectors(space.id) };
194
216
  });
195
217
  tool("import_connector", "wizards:write", {
196
218
  title: "Import connector",
197
219
  description: prompt("mcp", "tool.import_connector"),
198
220
  input: z.object({
199
- projectId: z.string().optional(),
221
+ spaceId: z.string().optional(),
200
222
  domain: z.string().describe("A domain from find_connectors, e.g. notion.com"),
201
223
  kind: z.enum(["mcp", "openapi"]).optional(),
202
224
  }),
203
- }, async ({ projectId, domain, kind }) => {
204
- const project = projectId
205
- ? await ownedProject(who.userId, projectId)
206
- : await defaultProject(who.userId);
207
- return importFromRegistry(who.userId, project.id, { domain, kind });
225
+ }, async ({ spaceId, domain, kind }) => {
226
+ const space = await studioSpace(spaceId);
227
+ return importFromRegistry(who.userId, space.id, { domain, kind });
208
228
  });
209
229
  tool("list_starters", "wizards:read", {
210
230
  title: "List starters",
@@ -236,12 +256,12 @@ export function registerTools(server, who) {
236
256
  }
237
257
  return starter.definition;
238
258
  });
239
- tool("list_projects", "wizards:read", {
240
- title: "List projects",
241
- description: prompt("mcp", "tool.list_projects"),
259
+ tool("list_spaces", "wizards:read", {
260
+ title: "List spaces",
261
+ description: prompt("mcp", "tool.list_spaces"),
242
262
  input: z.object({}),
243
263
  readOnly: true,
244
- }, async () => (await listProjects(who.userId)).map((p) => ({
264
+ }, async () => (await listSpaces(who.userId)).map((p) => ({
245
265
  id: p.id,
246
266
  name: p.name,
247
267
  from: spaceFrom(p),
@@ -250,15 +270,15 @@ export function registerTools(server, who) {
250
270
  tool("list_wizards", "wizards:read", {
251
271
  title: "List wizards",
252
272
  description: prompt("mcp", "tool.list_wizards"),
253
- input: z.object({ projectId: z.string().optional() }),
273
+ input: z.object({ spaceId: z.string().optional() }),
254
274
  readOnly: true,
255
- }, async ({ projectId }) => {
256
- const spaces = new Map((await listProjects(who.userId)).map((p) => [p.id, p]));
257
- return (await listWizards(who.userId, projectId)).map((w) => {
258
- const space = spaces.get(w.projectId);
275
+ }, async ({ spaceId }) => {
276
+ const spaces = new Map((await listSpaces(who.userId)).map((p) => [p.id, p]));
277
+ return (await listWizards(who.userId, spaceId)).map((w) => {
278
+ const space = spaces.get(w.spaceId);
259
279
  return {
260
280
  id: w.id,
261
- projectId: w.projectId,
281
+ spaceId: w.spaceId,
262
282
  space: space?.name ?? null,
263
283
  spaceFrom: space ? spaceFrom(space) : null,
264
284
  title: w.title,
@@ -274,11 +294,12 @@ export function registerTools(server, who) {
274
294
  description: prompt("mcp", "tool.get_wizard"),
275
295
  input: z.object({ wizardId: z.string() }),
276
296
  readOnly: true,
297
+ studio: true,
277
298
  }, async ({ wizardId }) => {
278
299
  const s = await wizardState(await ownedWizard(who.userId, wizardId));
279
300
  return {
280
301
  wizardId: s.id,
281
- projectId: s.projectId,
302
+ spaceId: s.spaceId,
282
303
  revision: s.revision,
283
304
  draft: s.draft,
284
305
  issues: s.issues,
@@ -293,11 +314,16 @@ export function registerTools(server, who) {
293
314
  tool("validate_wizard", "wizards:read", {
294
315
  title: "Validate wizard",
295
316
  description: prompt("mcp", "tool.validate_wizard"),
296
- input: z.object({ definition }),
317
+ input: z.object({
318
+ definition,
319
+ spaceId: z.string().optional().describe("Defaults to the person's first space."),
320
+ }),
297
321
  readOnly: true,
298
322
  }, async (args) => {
299
323
  try {
300
- const { issues } = parseDraft(authored(args.definition));
324
+ const space = await studioSpace(args.spaceId);
325
+ const { draft } = parseDraft(authored(args.definition));
326
+ const issues = await checkDraft(space.id, draft);
301
327
  return { ok: issues.length === 0, issues };
302
328
  }
303
329
  catch (err) {
@@ -312,7 +338,7 @@ export function registerTools(server, who) {
312
338
  title: "Create wizard",
313
339
  description: prompt("mcp", "tool.create_wizard"),
314
340
  input: z.object({
315
- projectId: z.string().optional().describe("Defaults to the person's first project."),
341
+ spaceId: z.string().optional().describe("Defaults to the person's first space."),
316
342
  definition: definition.optional(),
317
343
  starterId: z.string().optional().describe("Copy this starter instead of sending JSON."),
318
344
  note,
@@ -336,6 +362,7 @@ export function registerTools(server, who) {
336
362
  note,
337
363
  }),
338
364
  destructive: true,
365
+ studio: true,
339
366
  }, async ({ wizardId, ...input }) => {
340
367
  const { revision, issues } = await editWizard(who.userId, wizardId, input, writer);
341
368
  return { revision, issues };
@@ -345,6 +372,7 @@ export function registerTools(server, who) {
345
372
  description: prompt("mcp", "tool.replace_wizard"),
346
373
  input: z.object({ wizardId: z.string(), baseRevision, definition, note }),
347
374
  destructive: true,
375
+ studio: true,
348
376
  }, async ({ wizardId, ...input }) => {
349
377
  const { revision, issues } = await writeDraft(who.userId, wizardId, { ...input, definition: authored(input.definition) }, writer);
350
378
  return { revision, issues };
@@ -356,6 +384,7 @@ export function registerTools(server, who) {
356
384
  input: z.object({ wizardId: z.string() }),
357
385
  destructive: true,
358
386
  openWorld: true,
387
+ studio: true,
359
388
  }, async ({ wizardId }) => publishAndSync(who.userId, wizardId));
360
389
  tool("set_sharing", "wizards:publish", {
361
390
  title: "Set sharing",
@@ -367,6 +396,7 @@ export function registerTools(server, who) {
367
396
  }),
368
397
  destructive: true,
369
398
  openWorld: true,
399
+ studio: true,
370
400
  }, async ({ wizardId, enabled, dailyRunLimit }) => {
371
401
  const w = await updateWizardSettings(who.userId, wizardId, {
372
402
  shareEnabled: enabled,
@@ -392,6 +422,7 @@ export function registerTools(server, who) {
392
422
  acceptReviews: z.boolean().default(true),
393
423
  }),
394
424
  openWorld: true,
425
+ studio: true,
395
426
  }, async ({ wizardId, answers, acceptReviews }) => {
396
427
  const { runId } = await startTestRun(who.userId, wizardId, { answers, acceptReviews });
397
428
  const report = await runReport(who.userId, runId, 2, "test");
@@ -414,6 +445,7 @@ export function registerTools(server, who) {
414
445
  .describe("Wait up to this long while the run is still working."),
415
446
  }),
416
447
  readOnly: true,
448
+ studio: true,
417
449
  }, async ({ runId, waitSeconds }) => testRunReport(who.userId, runId, waitSeconds));
418
450
  // --- using wizards: the flow, and runs of the published version -------------
419
451
  appTool("show_wizard", "wizards:read", {
@@ -426,6 +458,10 @@ export function registerTools(server, who) {
426
458
  readOnly: true,
427
459
  }, async ({ wizardId, version }) => {
428
460
  const view = await flowView(who.userId, wizardId, { shows: version });
461
+ // The draft is the Studio's; the published wizard is everyone's to run.
462
+ if (view.wizard.shows === "draft") {
463
+ await requireStudio("wizards", wizardId);
464
+ }
429
465
  return {
430
466
  result: {
431
467
  wizardId,
@@ -543,12 +579,14 @@ export function registerTools(server, who) {
543
579
  description: prompt("mcp", "tool.list_files"),
544
580
  input: z.object({ wizardId: z.string() }),
545
581
  readOnly: true,
582
+ studio: true,
546
583
  }, async ({ wizardId }) => (await listFiles(who.userId, wizardId)).map(({ path, mime, size }) => ({ path, mime, size })));
547
584
  tool("read_file", "wizards:read", {
548
585
  title: "Read workspace file",
549
586
  description: prompt("mcp", "tool.read_file"),
550
587
  input: z.object({ wizardId: z.string(), path: z.string() }),
551
588
  readOnly: true,
589
+ studio: true,
552
590
  }, async ({ wizardId, path }) => readFileText(who.userId, wizardId, path));
553
591
  tool("write_file", "wizards:write", {
554
592
  title: "Write workspace file",
@@ -561,6 +599,7 @@ export function registerTools(server, who) {
561
599
  mime: z.string().optional(),
562
600
  }),
563
601
  destructive: true,
602
+ studio: true,
564
603
  }, async ({ wizardId, path, content, base64, mime }) => {
565
604
  if ((content === undefined) === (base64 === undefined)) {
566
605
  throw new ServiceError("invalid", "Pass either content or base64.");
@@ -572,6 +611,7 @@ export function registerTools(server, who) {
572
611
  description: prompt("mcp", "tool.delete_file"),
573
612
  input: z.object({ wizardId: z.string(), path: z.string() }),
574
613
  destructive: true,
614
+ studio: true,
575
615
  }, async ({ wizardId, path }) => {
576
616
  await deleteFile(who.userId, wizardId, path);
577
617
  return { ok: true };
@@ -592,6 +632,7 @@ export function registerTools(server, who) {
592
632
  annotations: annotationsOf({ readOnly: true }),
593
633
  }, (async ({ wizardId, stepId, data }) => {
594
634
  try {
635
+ await requireStudio("wizards", wizardId);
595
636
  const r = await checkDraftWidget(who.userId, wizardId, stepId, data);
596
637
  return {
597
638
  content: [