@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
@@ -1,25 +1,30 @@
1
1
  import { anthropic } from "@ai-sdk/anthropic";
2
- import { cleanAssetSections, cleanLogoSections, FACT_TYPES, FONT_USES, factKey, gradientCss, PROJECT_FILE_KINDS, PROJECT_LIMITS, parseGradient, RULE_MARKS, textStyleLine, } from "@engenty/wizards-shared/projects";
2
+ import { CONFIRM_ACTION_TOOL } from "@engenty/wizards-shared/assistant";
3
+ import { textClassOf } from "@engenty/wizards-shared/definition";
4
+ import { cleanAssetSections, cleanLogoSections, FACT_TYPES, FONT_USES, factKey, gradientCss, parseGradient, RULE_MARKS, SPACE_FILE_KINDS, SPACE_LIMITS, textStyleLine, } from "@engenty/wizards-shared/spaces";
5
+ import { pickedClass } from "@engenty/wizards-shared/tiers";
3
6
  import { createTool } from "@mastra/core/tools";
4
7
  import { nanoid } from "nanoid";
5
8
  import { z } from "zod";
6
9
  import { knowsTools } from "../assistant/knows.js";
10
+ import { subjectsOfGoose } from "../broker/rwx.js";
7
11
  import { currentFeatures } from "../features.js";
8
12
  import { managed } from "../manage.js";
9
- import { chatModel, contextWindowOf, costOf, gatewayTools, totalUsage, usageOf, } from "../models.js";
13
+ import { chatModel, contextWindowOf, costOf, currentTier, gatewayTools, searchAllowed, textModel, totalUsage, usageOf, } from "../models.js";
10
14
  import { prompt } from "../prompts.js";
11
15
  import { contentPolicy } from "../safety.js";
12
16
  import { knowledgeCounts } from "../services/knowledge.js";
13
- import { addProjectFileFromUrl, projectFileContent, projectFiles, updateProjectFile, } from "../services/project-files.js";
14
- import { documentText } from "../services/project-index.js";
15
- import { ownedProject, updateProject } from "../services/projects.js";
16
17
  import { activeSkills, skillList } from "../services/skills.js";
17
18
  import { categoryRows } from "../services/space-categories.js";
19
+ import { addSpaceFileFromUrl, spaceFileContent, spaceFiles, updateSpaceFile, } from "../services/space-files.js";
20
+ import { documentText } from "../services/space-index.js";
21
+ import { ownedSpace, updateSpace } from "../services/spaces.js";
18
22
  import { currentTenant } from "../tenants/tenant.js";
19
23
  import { serverText } from "../texts.js";
20
24
  import { assistantPageOf, assistantToolsOf } from "../tools/plugin.js";
21
25
  import { attempt as attemptTool, imageOutput } from "../tools/shared.js";
22
26
  import { skillToolsOf } from "../tools/skills.js";
27
+ import { gooseConnectionTools } from "./goose-connections.js";
23
28
  import { spaceAgent } from "./space-agent.js";
24
29
  import { chatTurnWay } from "./subscription.js";
25
30
  import { readWebsite } from "./website.js";
@@ -28,12 +33,17 @@ export function signalText(taken) {
28
33
  return prompt("goose", "signal", { messages: taken.map((s) => s.message).join("\n\n") });
29
34
  }
30
35
  const MAX_STEPS = 24;
31
- /** The system prompt: these sections of prompts/goose.md, in this order. */
32
- function system() {
36
+ /**
37
+ * The system prompt: these sections of prompts/goose.md, in this order. `capabilities`: Skills
38
+ * live in Fähigkeiten, at its address.
39
+ */
40
+ function system(capabilities) {
33
41
  return [
34
42
  prompt("goose", "persona"),
35
43
  prompt("goose", "voice"),
36
- prompt("goose", "primer"),
44
+ prompt("goose", "primer", {
45
+ skills: capabilities ? "/capabilities/skills" : "/skills",
46
+ }),
37
47
  prompt("goose", "knows"),
38
48
  prompt("goose", "page"),
39
49
  prompt("goose", "space"),
@@ -80,13 +90,13 @@ function activity(tool, args, lang) {
80
90
  }
81
91
  /** A tool failure the model can read and fix, instead of a crashed turn: the whole message. */
82
92
  const attempt = (run) => attemptTool(run, { limit: Number.POSITIVE_INFINITY });
83
- async function projectState(userId, projectId) {
84
- const p = await ownedProject(userId, projectId);
85
- const files = await projectFiles(projectId);
86
- const categories = await categoryRows(projectId);
93
+ async function spaceState(userId, spaceId) {
94
+ const p = await ownedSpace(userId, spaceId);
95
+ const files = await spaceFiles(spaceId);
96
+ const categories = await categoryRows(spaceId);
87
97
  return {
88
98
  knowledge: {
89
- ...(await knowledgeCounts(projectId)),
99
+ ...(await knowledgeCounts(spaceId)),
90
100
  categories: categories.map((c) => `${c.name} (${c.type}${c.proposed ? ", proposed" : ""})`),
91
101
  },
92
102
  title: p.brand.name ?? "",
@@ -170,10 +180,10 @@ async function projectState(userId, projectId) {
170
180
  })),
171
181
  };
172
182
  }
173
- function spaceTools(input, project, wrote, on) {
183
+ export function gooseSpaceTools(input, space, wrote, on) {
174
184
  const { signal } = input;
175
185
  const userId = input.user.id;
176
- const projectId = project.id;
186
+ const spaceId = space.id;
177
187
  // Said from inside the tool: an installed AI client runs tools without the stream showing it.
178
188
  const doing = (tool, args = {}) => {
179
189
  const label = activity(tool, args, input.lang);
@@ -181,7 +191,7 @@ function spaceTools(input, project, wrote, on) {
181
191
  input.onActivity?.(label);
182
192
  }
183
193
  };
184
- // Tools of one step run together; writes to the project's row take turns.
194
+ // Tools of one step run together; writes to the space's row take turns.
185
195
  let turn = Promise.resolve();
186
196
  const inTurn = (run) => {
187
197
  const next = turn.then(run, run);
@@ -204,13 +214,29 @@ function spaceTools(input, project, wrote, on) {
204
214
  inputSchema: z.object({
205
215
  title: z.string().max(120).optional(),
206
216
  about: z.string().max(8000).optional(),
217
+ brandName: z.string().max(120).optional(),
218
+ tagline: z.string().max(200).optional(),
219
+ voice: z
220
+ .array(z.object({ title: z.string().max(80), text: z.string().min(1).max(2000) }))
221
+ .max(12)
222
+ .optional()
223
+ .describe("Replaces the brand's voice blocks"),
224
+ links: z
225
+ .array(z.object({ label: z.string().max(80), url: z.string().min(1).max(600) }))
226
+ .max(20)
227
+ .optional()
228
+ .describe("Replaces the brand's links"),
207
229
  }),
208
- execute: ({ title, about }) => attempt(() => inTurn(async () => {
230
+ execute: ({ title, about, brandName, tagline, voice, links }) => attempt(() => inTurn(async () => {
209
231
  doing("set_profile");
210
- await updateProject(userId, projectId, {
232
+ await updateSpace(userId, spaceId, {
211
233
  brand: {
212
234
  ...(title !== undefined ? { name: title } : {}),
213
235
  ...(about !== undefined ? { about } : {}),
236
+ ...(brandName !== undefined ? { brandName } : {}),
237
+ ...(tagline !== undefined ? { tagline } : {}),
238
+ ...(voice ? { voice: voice.map((b) => ({ id: nanoid(10), ...b })) } : {}),
239
+ ...(links ? { links: links.map((l) => ({ id: nanoid(10), ...l })) } : {}),
214
240
  },
215
241
  });
216
242
  wrote();
@@ -231,7 +257,7 @@ function spaceTools(input, project, wrote, on) {
231
257
  }),
232
258
  execute: ({ facts }) => attempt(() => inTurn(async () => {
233
259
  doing("set_facts");
234
- const p = await ownedProject(userId, projectId);
260
+ const p = await ownedSpace(userId, spaceId);
235
261
  const next = [...p.facts];
236
262
  for (const f of facts) {
237
263
  const label = f.label.trim();
@@ -249,10 +275,10 @@ function spaceTools(input, project, wrote, on) {
249
275
  });
250
276
  }
251
277
  }
252
- if (next.length > PROJECT_LIMITS.facts) {
253
- throw new Error(`A project holds at most ${PROJECT_LIMITS.facts} facts.`);
278
+ if (next.length > SPACE_LIMITS.facts) {
279
+ throw new Error(`A space holds at most ${SPACE_LIMITS.facts} facts.`);
254
280
  }
255
- await updateProject(userId, projectId, { facts: next });
281
+ await updateSpace(userId, spaceId, { facts: next });
256
282
  wrote();
257
283
  return { ok: true, facts: next.length };
258
284
  })),
@@ -263,10 +289,10 @@ function spaceTools(input, project, wrote, on) {
263
289
  inputSchema: z.object({ labels: z.array(z.string()).min(1) }),
264
290
  execute: ({ labels }) => attempt(() => inTurn(async () => {
265
291
  doing("remove_facts");
266
- const p = await ownedProject(userId, projectId);
292
+ const p = await ownedSpace(userId, spaceId);
267
293
  const gone = new Set(labels.map((l) => l.trim().toLowerCase()));
268
294
  const next = p.facts.filter((f) => !gone.has(f.label.toLowerCase()));
269
- await updateProject(userId, projectId, { facts: next });
295
+ await updateSpace(userId, spaceId, { facts: next });
270
296
  wrote();
271
297
  return { ok: true, removed: p.facts.length - next.length };
272
298
  })),
@@ -281,10 +307,10 @@ function spaceTools(input, project, wrote, on) {
281
307
  value: z.string().regex(/^#[0-9a-fA-F]{6}$/),
282
308
  section: z.string().max(80).optional().describe("A section's title"),
283
309
  }))
284
- .max(PROJECT_LIMITS.colors),
310
+ .max(SPACE_LIMITS.colors),
285
311
  sections: z
286
312
  .array(z.object({ title: z.string().min(1).max(80) }))
287
- .max(PROJECT_LIMITS.logoSections)
313
+ .max(SPACE_LIMITS.logoSections)
288
314
  .optional(),
289
315
  }),
290
316
  execute: ({ colors, sections }) => attempt(() => inTurn(async () => {
@@ -292,7 +318,7 @@ function spaceTools(input, project, wrote, on) {
292
318
  if (!on.brandSections && (sections || colors.some((c) => c.section))) {
293
319
  throw new Error("Colour sections are not available in this studio: pass the colours without them.");
294
320
  }
295
- const p = await ownedProject(userId, projectId);
321
+ const p = await ownedSpace(userId, spaceId);
296
322
  const groups = sections
297
323
  ? sections.map((s) => ({
298
324
  id: p.brand.colorSections?.find((x) => x.title === s.title)?.id ?? nanoid(10),
@@ -303,7 +329,7 @@ function spaceTools(input, project, wrote, on) {
303
329
  if (unknown.length) {
304
330
  throw new Error(`No colour section named: ${unknown.map((c) => c.section).join(", ")}`);
305
331
  }
306
- await updateProject(userId, projectId, {
332
+ await updateSpace(userId, spaceId, {
307
333
  brand: {
308
334
  colors: colors.map(({ section, ...c }) => {
309
335
  const id = groups.find((s) => s.title === section)?.id;
@@ -329,16 +355,16 @@ function spaceTools(input, project, wrote, on) {
329
355
  .describe("When to use these logos, in the person's language"),
330
356
  logos: z.array(z.string()).describe("Ids of the space's logo files, in order"),
331
357
  }))
332
- .max(PROJECT_LIMITS.logoSections),
358
+ .max(SPACE_LIMITS.logoSections),
333
359
  }),
334
360
  execute: ({ sections }) => attempt(() => inTurn(async () => {
335
361
  doing("set_logo_sections");
336
- const logos = (await projectFiles(projectId, "logo")).map((f) => f.id);
362
+ const logos = (await spaceFiles(spaceId, "logo")).map((f) => f.id);
337
363
  const unknown = sections.flatMap((s) => s.logos).filter((id) => !logos.includes(id));
338
364
  if (unknown.length) {
339
365
  throw new Error(`Not a logo of this space: ${unknown.join(", ")}`);
340
366
  }
341
- await updateProject(userId, projectId, {
367
+ await updateSpace(userId, spaceId, {
342
368
  brand: {
343
369
  logoSections: cleanLogoSections(sections.map((s) => ({ ...s, id: nanoid(10) })), logos),
344
370
  },
@@ -356,16 +382,16 @@ function spaceTools(input, project, wrote, on) {
356
382
  title: z.string().min(1).max(80),
357
383
  assets: z.array(z.string()).describe("Ids of the space's asset files, in order"),
358
384
  }))
359
- .max(PROJECT_LIMITS.logoSections),
385
+ .max(SPACE_LIMITS.logoSections),
360
386
  }),
361
387
  execute: ({ sections }) => attempt(() => inTurn(async () => {
362
388
  doing("set_asset_sections");
363
- const assets = (await projectFiles(projectId, "asset")).map((f) => f.id);
389
+ const assets = (await spaceFiles(spaceId, "asset")).map((f) => f.id);
364
390
  const unknown = sections.flatMap((s) => s.assets).filter((id) => !assets.includes(id));
365
391
  if (unknown.length) {
366
392
  throw new Error(`Not an asset of this space: ${unknown.join(", ")}`);
367
393
  }
368
- await updateProject(userId, projectId, {
394
+ await updateSpace(userId, spaceId, {
369
395
  brand: {
370
396
  assetSections: cleanAssetSections(sections.map((s) => ({ ...s, id: nanoid(10) })), assets),
371
397
  },
@@ -393,7 +419,7 @@ function spaceTools(input, project, wrote, on) {
393
419
  .optional()
394
420
  .describe("All the licence allows it for, only where a source says so"),
395
421
  }))
396
- .max(PROJECT_LIMITS.fonts),
422
+ .max(SPACE_LIMITS.fonts),
397
423
  textStyles: z
398
424
  .array(z.object({
399
425
  name: z.string().min(1).max(60),
@@ -404,17 +430,17 @@ function spaceTools(input, project, wrote, on) {
404
430
  tracking: z.number().min(-20).max(50).describe("Letter spacing, % of the size"),
405
431
  uppercase: z.boolean().optional(),
406
432
  }))
407
- .max(PROJECT_LIMITS.textStyles)
433
+ .max(SPACE_LIMITS.textStyles)
408
434
  .optional(),
409
435
  }),
410
436
  execute: ({ fonts, textStyles }) => attempt(() => inTurn(async () => {
411
437
  doing("set_typography");
412
- const p = await ownedProject(userId, projectId);
438
+ const p = await ownedSpace(userId, spaceId);
413
439
  const faces = fonts.map((f) => ({
414
440
  ...f,
415
441
  id: p.brand.fonts?.find((x) => x.family === f.family)?.id ?? nanoid(10),
416
442
  }));
417
- await updateProject(userId, projectId, {
443
+ await updateSpace(userId, spaceId, {
418
444
  brand: {
419
445
  fonts: faces,
420
446
  ...(textStyles
@@ -443,11 +469,11 @@ function spaceTools(input, project, wrote, on) {
443
469
  description: z.string().max(400).optional().describe("When to use it"),
444
470
  css: z.string().max(1000),
445
471
  }))
446
- .max(PROJECT_LIMITS.gradients),
472
+ .max(SPACE_LIMITS.gradients),
447
473
  }),
448
474
  execute: ({ section, gradients }) => attempt(() => inTurn(async () => {
449
475
  doing("set_gradients");
450
- const p = await ownedProject(userId, projectId);
476
+ const p = await ownedSpace(userId, spaceId);
451
477
  const sections = p.brand.colorSections ?? [];
452
478
  const found = sections.find((s) => s.title === section && s.kind === "gradients");
453
479
  const id = found?.id ?? nanoid(10);
@@ -456,7 +482,7 @@ function spaceTools(input, project, wrote, on) {
456
482
  if (bad.length) {
457
483
  throw new Error(`Not a gradient with hex stops: ${bad.join(", ")}`);
458
484
  }
459
- await updateProject(userId, projectId, {
485
+ await updateSpace(userId, spaceId, {
460
486
  brand: {
461
487
  colorSections: found
462
488
  ? sections
@@ -490,11 +516,11 @@ function spaceTools(input, project, wrote, on) {
490
516
  .optional()
491
517
  .describe("do, dont, important, question, number; none for a plain note"),
492
518
  }))
493
- .max(PROJECT_LIMITS.logoRules),
519
+ .max(SPACE_LIMITS.logoRules),
494
520
  }),
495
521
  execute: ({ of, rules }) => attempt(() => inTurn(async () => {
496
522
  doing("set_rules");
497
- await updateProject(userId, projectId, {
523
+ await updateSpace(userId, spaceId, {
498
524
  brand: of === "logos"
499
525
  ? { logoRules: rules }
500
526
  : of === "colors"
@@ -510,7 +536,7 @@ function spaceTools(input, project, wrote, on) {
510
536
  description: prompt("goose", "tool.save_file"),
511
537
  inputSchema: z.object({
512
538
  url: z.string(),
513
- kind: z.enum(PROJECT_FILE_KINDS),
539
+ kind: z.enum(SPACE_FILE_KINDS),
514
540
  description: z
515
541
  .string()
516
542
  .max(600)
@@ -519,7 +545,7 @@ function spaceTools(input, project, wrote, on) {
519
545
  }),
520
546
  execute: ({ url, kind, description }) => attempt(async () => {
521
547
  doing("save_file", { kind });
522
- const row = await addProjectFileFromUrl(projectId, { url, kind, description, signal });
548
+ const row = await addSpaceFileFromUrl(spaceId, { url, kind, description, signal });
523
549
  wrote();
524
550
  return { ok: true, id: row.id, name: row.name, mime: row.mime, size: row.size };
525
551
  }),
@@ -530,7 +556,7 @@ function spaceTools(input, project, wrote, on) {
530
556
  inputSchema: z.object({ id: z.string(), description: z.string().max(600) }),
531
557
  execute: ({ id, description }) => attempt(async () => {
532
558
  doing("describe_file");
533
- await updateProjectFile(projectId, id, { description });
559
+ await updateSpaceFile(spaceId, id, { description });
534
560
  wrote();
535
561
  return { ok: true };
536
562
  }),
@@ -544,7 +570,7 @@ function spaceTools(input, project, wrote, on) {
544
570
  }),
545
571
  execute: ({ id, from }) => attempt(async () => {
546
572
  doing("look_at_file");
547
- const { row, data } = await projectFileContent(projectId, id);
573
+ const { row, data } = await spaceFileContent(spaceId, id, subjectsOfGoose(userId, input.user.role));
548
574
  if (row.kind === "document") {
549
575
  const text = await documentText(row);
550
576
  if (!text) {
@@ -633,13 +659,19 @@ function traced(tools, input, record) {
633
659
  };
634
660
  }
635
661
  }
636
- /** The part of the space page a route stands on. */
662
+ /** The part of the space page a route stands on; Skills have their own address, or Fähigkeiten's. */
637
663
  function partOf(route) {
638
- const m = route.match(/^\/space\/(info|brand|knowledge|data|results|skills)/);
639
- return m ? m[1] : route === "/space" ? "info" : null;
664
+ const m = route.match(/^\/space\/(info|brand|knowledge|data|results)/);
665
+ return m
666
+ ? m[1]
667
+ : route === "/space"
668
+ ? "info"
669
+ : /^\/(skills|capabilities\/skills)\b/.test(route)
670
+ ? "skills"
671
+ : null;
640
672
  }
641
673
  /** How large each tool is in the prompt: its description and its schema, in characters. */
642
- function toolSizes(tools) {
674
+ export function toolSizes(tools) {
643
675
  return Object.entries(tools)
644
676
  .map(([name, tool]) => {
645
677
  let schema = "";
@@ -653,6 +685,23 @@ function toolSizes(tools) {
653
685
  })
654
686
  .sort((a, b) => b.chars - a.chars);
655
687
  }
688
+ /**
689
+ * The model of a turn: the tier's class the person picked, on the credits, where the organization
690
+ * has a tier; else the chat's way, with its more capable model for extra effort.
691
+ */
692
+ async function assistantModel(way, input) {
693
+ const tier = input.model && way === "models" ? await currentTier() : null;
694
+ // A model id picked in the chooser asks for the class it runs on; anything else is no pick.
695
+ const picked = tier && input.model ? pickedClass(tier, input.model) : null;
696
+ if (!picked) {
697
+ return chatModel(way, input.extra ? "high" : "standard");
698
+ }
699
+ return textModel(textClassOf(picked.cls), {
700
+ purpose: "assistant",
701
+ makerClass: picked.maker ? `${picked.maker}/${picked.cls}` : undefined,
702
+ effort: input.extra ? "high" : undefined,
703
+ });
704
+ }
656
705
  /** One turn of the studio assistant. */
657
706
  export async function runStudioAssistant(input) {
658
707
  // How often the space or a plugin's data changed: a part of the answer changed something when
@@ -660,14 +709,14 @@ export async function runStudioAssistant(input) {
660
709
  let changes = 0;
661
710
  // The way the settings chose for the studio's chats: on a client, its tools reach it over MCP.
662
711
  const way = await chatTurnWay(managed);
663
- const resolved = await chatModel(way, input.extra ? "high" : "standard");
712
+ const resolved = await assistantModel(way, input);
664
713
  const wrote = () => {
665
714
  changes++;
666
715
  input.onChanged?.();
667
716
  };
668
717
  const cards = [];
669
- const { project } = input;
670
- const space = project && input.writable ? project : null;
718
+ const { space } = input;
719
+ const writable = space && input.writable ? space : null;
671
720
  const switches = await currentFeatures();
672
721
  const brandOn = {
673
722
  brandSections: switches.brandSections === true,
@@ -677,7 +726,7 @@ export async function runStudioAssistant(input) {
677
726
  const tools = {
678
727
  ...knowsTools({
679
728
  user: input.user,
680
- project: project ? { id: project.id, name: project.name } : null,
729
+ space: space ? { id: space.id, name: space.name } : null,
681
730
  lang: input.lang,
682
731
  chatId: input.chat.id,
683
732
  doing: (label) => input.onActivity?.(label),
@@ -686,7 +735,7 @@ export async function runStudioAssistant(input) {
686
735
  input.onCard?.(card);
687
736
  },
688
737
  }),
689
- ...(space ? spaceTools(input, space, wrote, brandOn) : {}),
738
+ ...(writable ? gooseSpaceTools(input, writable, wrote, brandOn) : {}),
690
739
  };
691
740
  // On everyday effort the chat can offer extra effort for work that asks for more: a card with
692
741
  // a button, while it goes on answering.
@@ -710,10 +759,10 @@ export async function runStudioAssistant(input) {
710
759
  });
711
760
  }
712
761
  // What the tenant's plugins let the assistant do besides: a source of knowledge, say.
713
- if (space) {
762
+ if (writable) {
714
763
  Object.assign(tools, await assistantToolsOf({
715
764
  tenantId: currentTenant(),
716
- space: { id: space.id, name: space.name },
765
+ space: { id: writable.id, name: writable.name },
717
766
  userId: input.user.id,
718
767
  signal: input.signal ?? new AbortController().signal,
719
768
  emit: (message) => input.onActivity?.(message),
@@ -724,14 +773,18 @@ export async function runStudioAssistant(input) {
724
773
  },
725
774
  }));
726
775
  }
776
+ // The person's own sign-ins to the spaces' connections (goose-connections.ts): reads run, a
777
+ // write asks them on a card. Never a connection that signs in as the space.
778
+ Object.assign(tools, await gooseConnectionTools(input));
727
779
  // The space's skills (docs/plans/skills.md): Goose reads them as a step does.
728
- const skills = project && switches.skills === true ? await activeSkills(project.id) : null;
729
- const allSkills = project && switches.skills === true ? await skillList(project.id) : [];
780
+ const skills = space && switches.skills === true ? await activeSkills(space.id) : null;
781
+ const allSkills = space && switches.skills === true ? await skillList(space.id) : [];
730
782
  if (skills) {
731
783
  Object.assign(tools, skillToolsOf(skills, (name) => input.onActivity?.(serverText(input.lang, "doingReadSkill", { name }))));
732
784
  }
733
785
  for (const spec of input.browserTools) {
734
- if (tools[spec.name]) {
786
+ // The confirm card is the runtime's to show, never the model's to call.
787
+ if (tools[spec.name] || spec.name === CONFIRM_ACTION_TOOL) {
735
788
  continue;
736
789
  }
737
790
  const tool = browserTool(input, spec);
@@ -741,13 +794,15 @@ export async function runStudioAssistant(input) {
741
794
  }
742
795
  const toolCalls = [];
743
796
  traced(tools, input, toolCalls);
744
- if (resolved.vendor === "anthropic") {
797
+ // The organization's tier may allow no web search.
798
+ const search = await searchAllowed();
799
+ if (search && resolved.vendor === "anthropic") {
745
800
  tools.web_search = anthropic.tools.webSearch_20250305({ maxUses: 5 });
746
801
  }
747
- else if (resolved.gateway) {
802
+ else if (search && resolved.gateway) {
748
803
  tools.web_search = gatewayTools.perplexitySearch({ maxResults: 6 });
749
804
  }
750
- const instructions = system();
805
+ const instructions = system(switches.capabilities === true);
751
806
  const agent = spaceAgent({
752
807
  id: "studio-assistant",
753
808
  name: "Studio assistant",
@@ -756,8 +811,8 @@ export async function runStudioAssistant(input) {
756
811
  tools,
757
812
  });
758
813
  const page = input.page;
759
- const pluginPage = page?.plugin && project
760
- ? await assistantPageOf(currentTenant(), page.plugin, { id: project.id, name: project.name })
814
+ const pluginPage = page?.plugin && space
815
+ ? await assistantPageOf(currentTenant(), page.plugin, { id: space.id, name: space.name })
761
816
  : null;
762
817
  const part = page ? partOf(page.route) : null;
763
818
  const { history } = input;
@@ -786,10 +841,10 @@ export async function runStudioAssistant(input) {
786
841
  ...pluginPage.blocks,
787
842
  ].join("\n\n")
788
843
  : "",
789
- space
790
- ? `The space now:\n\`\`\`json\n${JSON.stringify(await projectState(input.user.id, space.id))}\n\`\`\``
791
- : project
792
- ? prompt("goose", "turn.space_read_only", { name: project.name })
844
+ writable
845
+ ? `The space now:\n\`\`\`json\n${JSON.stringify(await spaceState(input.user.id, writable.id))}\n\`\`\``
846
+ : space
847
+ ? prompt("goose", "turn.space_read_only", { name: space.name })
793
848
  : "No space is open.",
794
849
  part === "knowledge" ? prompt("goose", "turn.knowledge") : "",
795
850
  allSkills.length
@@ -800,7 +855,7 @@ export async function runStudioAssistant(input) {
800
855
  : part === "skills"
801
856
  ? prompt("goose", "turn.skills_empty")
802
857
  : "",
803
- space && !(brandOn.brandSections && brandOn.brandRules && brandOn.typography)
858
+ writable && !(brandOn.brandSections && brandOn.brandRules && brandOn.typography)
804
859
  ? prompt("goose", "turn.off", {
805
860
  missing: [
806
861
  brandOn.brandSections ? "" : "sections of logos and colours, gradients and patterns",
@@ -1,4 +1,4 @@
1
- import { FONT_WEIGHTS } from "@engenty/wizards-shared/projects";
1
+ import { FONT_WEIGHTS } from "@engenty/wizards-shared/spaces";
2
2
  import { webContext } from "../render/chromium.js";
3
3
  import { htmlToMarkdown } from "../render/convert.js";
4
4
  import { safeFetch } from "../tools/net-guard.js";
@@ -25,7 +25,10 @@ import { MCP_RESOURCE, SCOPES } from "./mcp/scopes.js";
25
25
  import { openCommand } from "./open-command.js";
26
26
  import { PLUGIN_NAME, pluginArchive, pluginMarketplace } from "./plugin.js";
27
27
  import { apiRoutes } from "./routes/api.js";
28
+ import { brokerRoutes } from "./routes/broker.js";
29
+ import { connectionRoutes } from "./routes/connections.js";
28
30
  import { browserReport, localDebugRoutes } from "./routes/debug.js";
31
+ import { discoverRoutes } from "./routes/discover.js";
29
32
  import { internalRoutes } from "./routes/internal.js";
30
33
  import { notFoundAnswer, requestLang, say, spelledFor } from "./routes/lang.js";
31
34
  import { liveRoutes } from "./routes/live.js";
@@ -35,15 +38,19 @@ import { personRoutes } from "./routes/person.js";
35
38
  import { publicPluginRoutes } from "./routes/plugin-public.js";
36
39
  import { pluginRoutes } from "./routes/plugins.js";
37
40
  import { reportRoutes } from "./routes/reports.js";
41
+ import { ruleRoutes } from "./routes/rules.js";
38
42
  import { clientIp, connectCallback, publicRoutes, runRoutes, shareRoutes } from "./routes/runs.js";
39
43
  import { runtimeSettingsRoutes } from "./routes/runtime-settings.js";
40
44
  import { skillRoutes } from "./routes/skills.js";
41
45
  import { studio } from "./routes/studio.js";
42
46
  import { wizardStream } from "./routes/wizard-stream.js";
47
+ import { workRoutes } from "./routes/work.js";
43
48
  import { runTicketValid } from "./secrets/signing.js";
44
49
  import { asRole } from "./services/access.js";
45
50
  import { ServiceError } from "./services/errors.js";
51
+ import { membersStudioGate } from "./services/members-studio.js";
46
52
  import { servePageRunner } from "./services/runners.js";
53
+ import { markSeen } from "./services/seen.js";
47
54
  import { afterStudioWrite, beforeStudioLoad } from "./sync/client.js";
48
55
  import { tenantOfLink, tenantStatus } from "./tenants/control.js";
49
56
  const app = new Hono();
@@ -233,7 +240,7 @@ if (serves.doors) {
233
240
  });
234
241
  }
235
242
  /** The studio's requests that open an item: a wizard, a page, a table, a skill, a space. */
236
- const STUDIO_LOADS = /\/api\/studio\/(wizards\/[^/]+|pages\/[^/]+|tables\/[^/]+|skills\/[^/]+|projects(\/[^/]+(\/(data|knowledge|files|wizards|page|skills))?)?)$/;
243
+ const STUDIO_LOADS = /\/api\/studio\/(wizards\/[^/]+|pages\/[^/]+|tables\/[^/]+|skills\/[^/]+|spaces(\/[^/]+(\/(data|knowledge|files|wizards|page|skills))?)?)$/;
237
244
  if (serves.studio) {
238
245
  /** Studio requests act as the signed-in person, inside that person's tenant. */
239
246
  app.use("/api/studio/*", async (c, next) => {
@@ -251,6 +258,8 @@ if (serves.studio) {
251
258
  }, 403);
252
259
  }
253
260
  c.set("user", user);
261
+ // The person is here: the hourly mail of the broker's lines waits (services/seen.ts).
262
+ void withTenant(user.tenantId, () => markSeen(user.id)).catch(() => undefined);
254
263
  // A save: open studios hear of it now, not at the next tick (live/hub.ts).
255
264
  const writes = c.req.method !== "GET";
256
265
  if (managed) {
@@ -280,6 +289,8 @@ if (serves.studio) {
280
289
  }
281
290
  });
282
291
  });
292
+ // A member reaches a space's studio only where its admins opened it (behind `capabilities`).
293
+ app.use("/api/studio/*", membersStudioGate);
283
294
  const mcp = mcpHandler();
284
295
  app.on(["GET", "POST", "DELETE"], "/api/mcp", (c) => mcp(c.req.raw));
285
296
  }
@@ -309,7 +320,12 @@ if (serves.studio) {
309
320
  app.route("/api/studio/organization", organizationRoutes);
310
321
  app.route("/api/studio/person", personRoutes);
311
322
  app.route("/api/studio", skillRoutes);
323
+ app.route("/api/studio", discoverRoutes);
324
+ app.route("/api/studio", ruleRoutes);
325
+ app.route("/api/studio", connectionRoutes);
326
+ app.route("/api/studio", brokerRoutes);
312
327
  app.route("/api/studio/runtime", runtimeSettingsRoutes);
328
+ app.route("/api/studio/work", workRoutes);
313
329
  app.route("/api/studio", studio);
314
330
  app.route("/api/v1", apiRoutes);
315
331
  app.route("/api/local/debug", localDebugRoutes);
@@ -428,9 +444,18 @@ if (existsSync(webDir)) {
428
444
  .replace(/<link rel="apple-touch-icon"[^>]*>/, `<link rel="apple-touch-icon" href="${own}/icons/apple-touch-icon.png" />`)
429
445
  .replace(/<link rel="icon"[^>]*>/, `<link rel="icon" href="${own}/icons/favicon.png" type="image/png" />`)
430
446
  : html;
431
- return c.html(preview
447
+ // A result and a run are someone's own: search engines leave them out. A wizard's start
448
+ // page stays findable.
449
+ const personal = /^\/s\/|^\/w\/[^/]+\/[^/]+\/./.test(c.req.path);
450
+ if (personal) {
451
+ c.header("X-Robots-Tag", "noindex, nofollow");
452
+ }
453
+ const withPreview = preview
432
454
  ? page.replace(/<title>[^<]*<\/title>/, "").replace("</head>", `${preview}\n</head>`)
433
- : page);
455
+ : page;
456
+ return c.html(personal
457
+ ? withPreview.replace("</head>", `<meta name="robots" content="noindex, nofollow">\n</head>`)
458
+ : withPreview);
434
459
  });
435
460
  }
436
461
  export default app;
@@ -4,6 +4,7 @@ import { z } from "zod";
4
4
  import { accountOverview, accountToken, linkedAccount } from "../auth/account.js";
5
5
  import { authoringGuide } from "../authoring/guide.js";
6
6
  import { listConnectors } from "../connectors/external.js";
7
+ import { guideSpaceConnections } from "../connectors/space-connections.js";
7
8
  import { db, schema } from "../db/client.js";
8
9
  import { env } from "../env.js";
9
10
  import { detectHarnesses } from "../harness/index.js";
@@ -68,7 +69,7 @@ export function knowsTools(ctx) {
68
69
  inputSchema: z.object({ from: z.number().int().min(0).optional() }),
69
70
  execute: ({ from }) => attempt(async () => {
70
71
  ctx.doing(serverText(ctx.lang, "doingAuthoringGuide"));
71
- const guide = authoringGuide(ctx.project ? await listConnectors(ctx.project.id) : [], await pluginToolsOf(user.tenantId));
72
+ const guide = authoringGuide(ctx.space ? await listConnectors(ctx.space.id) : [], await pluginToolsOf(user.tenantId), ctx.space ? await guideSpaceConnections(ctx.space.id) : []);
72
73
  const start = Math.min(from ?? 0, guide.length);
73
74
  return {
74
75
  text: guide.slice(start, start + 14_000),
@@ -239,11 +240,11 @@ export function knowsTools(ctx) {
239
240
  description: prompt("goose", "tool.wizards"),
240
241
  inputSchema: z.object({}),
241
242
  execute: () => attempt(async () => {
242
- if (!ctx.project) {
243
+ if (!ctx.space) {
243
244
  return { note: "No space is open." };
244
245
  }
245
246
  return {
246
- wizards: (await listWizards(user.id, ctx.project.id)).map((w) => ({
247
+ wizards: (await listWizards(user.id, ctx.space.id)).map((w) => ({
247
248
  id: w.id,
248
249
  title: w.title,
249
250
  description: w.description,
@@ -264,7 +265,7 @@ export function knowsTools(ctx) {
264
265
  limit: z.number().int().min(1).max(40).optional(),
265
266
  }),
266
267
  execute: ({ status, limit }) => attempt(async () => {
267
- if (!ctx.project) {
268
+ if (!ctx.space) {
268
269
  return { note: "No space is open." };
269
270
  }
270
271
  const rows = await db
@@ -280,7 +281,7 @@ export function knowsTools(ctx) {
280
281
  })
281
282
  .from(schema.run)
282
283
  .innerJoin(schema.wizard, eq(schema.wizard.id, schema.run.wizardId))
283
- .where(and(eq(schema.wizard.projectId, ctx.project.id), status ? eq(schema.run.status, status) : undefined))
284
+ .where(and(eq(schema.wizard.spaceId, ctx.space.id), status ? eq(schema.run.status, status) : undefined))
284
285
  .orderBy(desc(schema.run.createdAt))
285
286
  .limit(limit ?? 15);
286
287
  return {