@engenty/wizards-runtime 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. package/apps/runtime/dist/agents/architect.js +8 -7
  2. package/apps/runtime/dist/agents/goose-connections.js +82 -0
  3. package/apps/runtime/dist/agents/space-agent.js +9 -2
  4. package/apps/runtime/dist/agents/studio-assistant.js +101 -67
  5. package/apps/runtime/dist/agents/website.js +1 -1
  6. package/apps/runtime/dist/app.js +17 -1
  7. package/apps/runtime/dist/assistant/knows.js +6 -5
  8. package/apps/runtime/dist/authoring/guide.js +25 -5
  9. package/apps/runtime/dist/broker/account.js +166 -0
  10. package/apps/runtime/dist/broker/call.js +417 -0
  11. package/apps/runtime/dist/broker/caller.js +10 -0
  12. package/apps/runtime/dist/broker/grant.js +152 -0
  13. package/apps/runtime/dist/broker/host.js +51 -0
  14. package/apps/runtime/dist/broker/index.js +8 -0
  15. package/apps/runtime/dist/broker/kept.js +31 -0
  16. package/apps/runtime/dist/broker/log.js +240 -0
  17. package/apps/runtime/dist/broker/registry.js +9 -0
  18. package/apps/runtime/dist/broker/rwx.js +367 -0
  19. package/apps/runtime/dist/broker/send.js +189 -0
  20. package/apps/runtime/dist/connectors/builtin.js +1 -1
  21. package/apps/runtime/dist/connectors/external.js +38 -37
  22. package/apps/runtime/dist/connectors/index.js +30 -91
  23. package/apps/runtime/dist/connectors/mail.js +0 -8
  24. package/apps/runtime/dist/connectors/person-sign-ins.js +73 -0
  25. package/apps/runtime/dist/connectors/plugin-connections.js +65 -92
  26. package/apps/runtime/dist/connectors/smtp.js +1 -1
  27. package/apps/runtime/dist/connectors/space-connections.js +436 -0
  28. package/apps/runtime/dist/db/adopt.js +3 -3
  29. package/apps/runtime/dist/db/client.js +9 -0
  30. package/apps/runtime/dist/db/live-triggers.js +65 -23
  31. package/apps/runtime/dist/db/migrations/tenant/0027_work_chats.sql +52 -0
  32. package/apps/runtime/dist/db/migrations/tenant/0028_chat_approvals.sql +17 -0
  33. package/apps/runtime/dist/db/migrations/tenant/0029_work_chats_live.sql +49 -0
  34. package/apps/runtime/dist/db/migrations/tenant/0031_space.sql +624 -0
  35. package/apps/runtime/dist/db/migrations/tenant/0032_rwx_rule.sql +18 -0
  36. package/apps/runtime/dist/db/migrations/tenant/0033_broker_log.sql +23 -0
  37. package/apps/runtime/dist/db/migrations/tenant/0034_space_connection.sql +35 -0
  38. package/apps/runtime/dist/db/migrations/tenant/0035_run_grant.sql +1 -0
  39. package/apps/runtime/dist/db/migrations/tenant/0036_approval_held_for.sql +1 -0
  40. package/apps/runtime/dist/db/migrations/tenant/0037_ways_out.sql +5 -0
  41. package/apps/runtime/dist/db/migrations/tenant/0038_heard.sql +11 -0
  42. package/apps/runtime/dist/db/migrations/tenant/0039_members_studio.sql +1 -0
  43. package/apps/runtime/dist/db/migrations/tenant/meta/0027_snapshot.json +383 -155
  44. package/apps/runtime/dist/db/migrations/tenant/meta/0028_snapshot.json +4468 -0
  45. package/apps/runtime/dist/db/migrations/tenant/meta/0029_snapshot.json +4475 -0
  46. package/apps/runtime/dist/db/migrations/tenant/meta/0030_snapshot.json +4629 -0
  47. package/apps/runtime/dist/db/migrations/tenant/meta/0031_snapshot.json +4629 -0
  48. package/apps/runtime/dist/db/migrations/tenant/meta/0032_snapshot.json +4757 -0
  49. package/apps/runtime/dist/db/migrations/tenant/meta/0033_snapshot.json +5039 -0
  50. package/apps/runtime/dist/db/migrations/tenant/meta/0034_snapshot.json +5022 -0
  51. package/apps/runtime/dist/db/migrations/tenant/meta/0035_snapshot.json +5029 -0
  52. package/apps/runtime/dist/db/migrations/tenant/meta/0036_snapshot.json +5037 -0
  53. package/apps/runtime/dist/db/migrations/tenant/meta/0037_snapshot.json +5076 -0
  54. package/apps/runtime/dist/db/migrations/tenant/meta/0038_snapshot.json +5145 -0
  55. package/apps/runtime/dist/db/migrations/tenant/meta/0039_snapshot.json +5153 -0
  56. package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +86 -2
  57. package/apps/runtime/dist/db/schema.js +295 -72
  58. package/apps/runtime/dist/docs/dev/architecture.md +215 -0
  59. package/apps/runtime/dist/docs/dev/broker.md +298 -0
  60. package/apps/runtime/dist/docs/dev/index.md +5 -1
  61. package/apps/runtime/dist/docs/dev/integration/index.md +2 -0
  62. package/apps/runtime/dist/docs/dev/meta.json +3 -0
  63. package/apps/runtime/dist/docs/dev/plugins/connections.md +8 -5
  64. package/apps/runtime/dist/docs/dev/plugins/events.md +1 -1
  65. package/apps/runtime/dist/docs/dev/plugins/examples.md +1 -0
  66. package/apps/runtime/dist/docs/dev/plugins/index.md +2 -2
  67. package/apps/runtime/dist/docs/dev/plugins/reference.md +3 -2
  68. package/apps/runtime/dist/docs/dev/plugins/space.md +16 -6
  69. package/apps/runtime/dist/docs/dev/plugins/studio.md +2 -2
  70. package/apps/runtime/dist/docs/dev/plugins/tools.md +0 -1
  71. package/apps/runtime/dist/docs/dev/skills.md +16 -9
  72. package/apps/runtime/dist/docs/dev/wizard-format/agent-steps.md +40 -5
  73. package/apps/runtime/dist/docs/dev/wizard-format/lists-and-connections.md +17 -2
  74. package/apps/runtime/dist/docs/dev/wizard-format/templates.md +2 -0
  75. package/apps/runtime/dist/docs/dev/wizard-format/views-and-widgets.md +22 -2
  76. package/apps/runtime/dist/docs/user-guide/capabilities.md +132 -0
  77. package/apps/runtime/dist/docs/user-guide/cloud-sync.md +2 -0
  78. package/apps/runtime/dist/docs/user-guide/command-line.md +1 -0
  79. package/apps/runtime/dist/docs/user-guide/connectors.md +63 -7
  80. package/apps/runtime/dist/docs/user-guide/index.md +10 -1
  81. package/apps/runtime/dist/docs/user-guide/meta.json +6 -1
  82. package/apps/runtime/dist/docs/user-guide/protocol.md +80 -0
  83. package/apps/runtime/dist/docs/user-guide/skills.md +8 -4
  84. package/apps/runtime/dist/docs/user-guide/space.md +5 -4
  85. package/apps/runtime/dist/docs/user-guide/together.md +16 -2
  86. package/apps/runtime/dist/docs/user-guide/troubleshooting.md +2 -2
  87. package/apps/runtime/dist/docs/user-guide/work-mode.md +128 -0
  88. package/apps/runtime/dist/engenty/connections-external/build-connector.js +2 -5
  89. package/apps/runtime/dist/engenty/connections-external/importer/classify.js +72 -0
  90. package/apps/runtime/dist/engenty/connections-google/connectors/gmail.js +1 -1
  91. package/apps/runtime/dist/engenty/connections-microsoft/outlook.js +3 -2
  92. package/apps/runtime/dist/engenty/connections-sdk/types.js +2 -0
  93. package/apps/runtime/dist/engenty/connections-slack/connector.js +2 -1
  94. package/apps/runtime/dist/engine/resources.js +43 -12
  95. package/apps/runtime/dist/engine/runner.js +75 -23
  96. package/apps/runtime/dist/engine/steps.js +30 -12
  97. package/apps/runtime/dist/engine/template.js +18 -1
  98. package/apps/runtime/dist/env.js +9 -4
  99. package/apps/runtime/dist/index.js +18 -2
  100. package/apps/runtime/dist/live/feed.js +2 -2
  101. package/apps/runtime/dist/live/origin.js +2 -2
  102. package/apps/runtime/dist/live/views.js +51 -26
  103. package/apps/runtime/dist/manage.js +7 -0
  104. package/apps/runtime/dist/mcp/flow-app.js +1 -1
  105. package/apps/runtime/dist/mcp/tools.js +75 -34
  106. package/apps/runtime/dist/models.js +1 -1
  107. package/apps/runtime/dist/motion-graphics/project.js +8 -8
  108. package/apps/runtime/dist/motion-graphics/tools.js +1 -1
  109. package/apps/runtime/dist/plugins/events.js +2 -2
  110. package/apps/runtime/dist/plugins/jobs.js +4 -1
  111. package/apps/runtime/dist/plugins/loader.js +2 -2
  112. package/apps/runtime/dist/prompts/architect.md +3 -3
  113. package/apps/runtime/dist/prompts/authoring.md +46 -12
  114. package/apps/runtime/dist/prompts/goose.md +7 -7
  115. package/apps/runtime/dist/prompts/mcp.md +6 -6
  116. package/apps/runtime/dist/prompts/services.md +4 -4
  117. package/apps/runtime/dist/prompts/step.md +2 -2
  118. package/apps/runtime/dist/prompts/tools.md +39 -10
  119. package/apps/runtime/dist/routes/api.js +31 -20
  120. package/apps/runtime/dist/routes/broker.js +316 -0
  121. package/apps/runtime/dist/routes/connections.js +71 -0
  122. package/apps/runtime/dist/routes/delivery.js +25 -0
  123. package/apps/runtime/dist/routes/discover.js +17 -0
  124. package/apps/runtime/dist/routes/live.js +11 -1
  125. package/apps/runtime/dist/routes/person.js +4 -1
  126. package/apps/runtime/dist/routes/plugins.js +3 -1
  127. package/apps/runtime/dist/routes/rules.js +26 -0
  128. package/apps/runtime/dist/routes/runs.js +54 -33
  129. package/apps/runtime/dist/routes/skills.js +6 -6
  130. package/apps/runtime/dist/routes/studio.js +153 -144
  131. package/apps/runtime/dist/routes/work.js +199 -0
  132. package/apps/runtime/dist/sandbox/index.js +27 -0
  133. package/apps/runtime/dist/services/access.js +38 -17
  134. package/apps/runtime/dist/services/api.js +38 -13
  135. package/apps/runtime/dist/services/architect.js +3 -3
  136. package/apps/runtime/dist/services/assistant-chats.js +9 -1
  137. package/apps/runtime/dist/services/brand.js +12 -12
  138. package/apps/runtime/dist/services/broker-bell.js +69 -0
  139. package/apps/runtime/dist/services/broker-notify.js +127 -0
  140. package/apps/runtime/dist/services/client-steps.js +79 -0
  141. package/apps/runtime/dist/services/cloud.js +42 -42
  142. package/apps/runtime/dist/services/command-risk.js +51 -0
  143. package/apps/runtime/dist/services/discover.js +85 -0
  144. package/apps/runtime/dist/services/knowledge-model.js +13 -13
  145. package/apps/runtime/dist/services/knowledge.js +117 -80
  146. package/apps/runtime/dist/services/manage-reports.js +74 -7
  147. package/apps/runtime/dist/services/members-studio.js +165 -0
  148. package/apps/runtime/dist/services/onboarding.js +22 -22
  149. package/apps/runtime/dist/services/package-file.js +1 -1
  150. package/apps/runtime/dist/services/package.js +22 -22
  151. package/apps/runtime/dist/services/pages.js +7 -7
  152. package/apps/runtime/dist/services/runs.js +4 -3
  153. package/apps/runtime/dist/services/seen.js +55 -0
  154. package/apps/runtime/dist/services/shares.js +23 -13
  155. package/apps/runtime/dist/services/site.js +23 -23
  156. package/apps/runtime/dist/services/skills-registry.js +15 -15
  157. package/apps/runtime/dist/services/skills.js +44 -44
  158. package/apps/runtime/dist/services/space-categories.js +35 -35
  159. package/apps/runtime/dist/services/space-data.js +130 -111
  160. package/apps/runtime/dist/services/{project-files.js → space-files.js} +84 -75
  161. package/apps/runtime/dist/services/{project-index.js → space-index.js} +116 -73
  162. package/apps/runtime/dist/services/space-origin.js +19 -11
  163. package/apps/runtime/dist/services/spaces.js +478 -612
  164. package/apps/runtime/dist/services/synced-spaces.js +668 -0
  165. package/apps/runtime/dist/services/themes.js +15 -15
  166. package/apps/runtime/dist/services/widgets.js +6 -6
  167. package/apps/runtime/dist/services/wizards.js +112 -38
  168. package/apps/runtime/dist/services/work-ai.js +257 -0
  169. package/apps/runtime/dist/services/work-approvals.js +104 -0
  170. package/apps/runtime/dist/services/work-chats.js +908 -0
  171. package/apps/runtime/dist/services/work-connections.js +90 -0
  172. package/apps/runtime/dist/services/work-files.js +85 -0
  173. package/apps/runtime/dist/services/work-mastra.js +73 -0
  174. package/apps/runtime/dist/services/work-sandbox.js +42 -0
  175. package/apps/runtime/dist/sharing/files.js +14 -4
  176. package/apps/runtime/dist/sharing/index.js +40 -39
  177. package/apps/runtime/dist/sharing/jobs.js +67 -17
  178. package/apps/runtime/dist/sharing/targets/connector.js +10 -6
  179. package/apps/runtime/dist/sharing/targets/email.js +10 -8
  180. package/apps/runtime/dist/sharing/targets/slack.js +10 -8
  181. package/apps/runtime/dist/sharing/targets/storage.js +6 -4
  182. package/apps/runtime/dist/store/index.js +14 -3
  183. package/apps/runtime/dist/store/shared-lists.js +4 -2
  184. package/apps/runtime/dist/sync/apply.js +2 -2
  185. package/apps/runtime/dist/sync/client.js +113 -113
  186. package/apps/runtime/dist/sync/hub.js +41 -41
  187. package/apps/runtime/dist/sync/log.js +12 -12
  188. package/apps/runtime/dist/sync/records.js +118 -120
  189. package/apps/runtime/dist/texts.js +38 -2
  190. package/apps/runtime/dist/tools/connections.js +112 -0
  191. package/apps/runtime/dist/tools/connector.js +157 -67
  192. package/apps/runtime/dist/tools/index.js +28 -13
  193. package/apps/runtime/dist/tools/mail.js +40 -11
  194. package/apps/runtime/dist/tools/pages.js +11 -5
  195. package/apps/runtime/dist/tools/plugin.js +43 -7
  196. package/apps/runtime/dist/tools/skills.js +1 -1
  197. package/apps/runtime/dist/tools/{project.js → space.js} +30 -25
  198. package/apps/runtime/dist/tools/store.js +3 -2
  199. package/apps/runtime/dist/widgets/step.js +10 -10
  200. package/apps/web/dist/assets/AboutDialog-DgfeipUc.js +1 -0
  201. package/apps/web/dist/assets/CapabilitiesPage-BoYJvgIu.js +2 -0
  202. package/apps/web/dist/assets/{ChangelogDialog-SwyId00t.js → ChangelogDialog-Duab4zTO.js} +1 -1
  203. package/apps/web/dist/assets/{CodeEditor-BwZsk5Al.js → CodeEditor-nxoOt8ge.js} +1 -1
  204. package/apps/web/dist/assets/EditorPage-ZrgGpYMC.js +3 -0
  205. package/apps/web/dist/assets/{FlowPreview-DtSpjVTl.js → FlowPreview-aMfwcPul.js} +1 -1
  206. package/apps/web/dist/assets/LangSwitch-DpD0inR4.js +1 -0
  207. package/apps/web/dist/assets/Marketplace-CpzD9pNQ.js +2 -0
  208. package/apps/web/dist/assets/NewWizardChannels-IB18afWN.js +1 -0
  209. package/apps/web/dist/assets/NewWizardPage-rYbcmPGG.js +7 -0
  210. package/apps/web/dist/assets/OnboardingPage-ztHT01ah.js +1 -0
  211. package/apps/web/dist/assets/PreviewPane-DviWTLfi.js +9 -0
  212. package/apps/web/dist/assets/PublicRunner-C2geZhhM.js +1 -0
  213. package/apps/web/dist/assets/ReadOnly-kSb_Kbdm.js +1 -0
  214. package/apps/web/dist/assets/SettingsPage-DM2h8N0J.js +2 -0
  215. package/apps/web/dist/assets/SetupPage-Wfyz6xH4.js +1 -0
  216. package/apps/web/dist/assets/SharePage-CyWQorWB.js +1 -0
  217. package/apps/web/dist/assets/SkillEditor-CqQMg2MC.js +1 -0
  218. package/apps/web/dist/assets/Skills-CnhpgoOA.js +9 -0
  219. package/apps/web/dist/assets/SpacePage-q4Bk3N7k.js +2 -0
  220. package/apps/web/dist/assets/UpdateCheck-C2CE6CC3.js +2 -0
  221. package/apps/web/dist/assets/changelog-B6hN1Cp7.js +1 -0
  222. package/apps/web/dist/assets/circle-alert-C8Ma-bPY.js +1 -0
  223. package/apps/web/dist/assets/circle-check-Bu9Z3mlJ.js +1 -0
  224. package/apps/web/dist/assets/code-editor-CfTGqOpp.js +2 -0
  225. package/apps/web/dist/assets/{code-xml-TwKzzMtA.js → code-xml-B4kLFZSj.js} +1 -1
  226. package/apps/web/dist/assets/connection-sign-in-CIiv0t2p.js +1 -0
  227. package/apps/web/dist/assets/esm-Xwn4GtqG.js +7 -0
  228. package/apps/web/dist/assets/{eye-Brd-xPUJ.js → eye-BpoKpIdt.js} +1 -1
  229. package/apps/web/dist/assets/host-BrP-ENHg.css +1 -0
  230. package/apps/web/dist/assets/host-DJ7-p0Sc.js +118 -0
  231. package/apps/web/dist/assets/i18n-BJ7Ld6O6.js +55 -0
  232. package/apps/web/dist/assets/index-D18DvnxX.css +1 -0
  233. package/apps/web/dist/assets/index-D2akynS-.js +10 -0
  234. package/apps/web/dist/assets/logo-BpnjXTRy.js +1 -0
  235. package/apps/web/dist/assets/oss-credits-IdX5bc71.js +1 -0
  236. package/apps/web/dist/assets/{phone-DhkHteoJ.js → phone-Ctvf-Am-.js} +1 -1
  237. package/apps/web/dist/assets/read-aloud-Da_RSm2S.js +1 -0
  238. package/apps/web/dist/assets/{runners-G-XYaDgR.js → runners-CyIvJIHr.js} +1 -1
  239. package/apps/web/dist/assets/scroll-text-ChrjRu9Y.js +1 -0
  240. package/apps/web/dist/assets/session-SXPtTWRK.js +2 -0
  241. package/apps/web/dist/assets/theme-CbTcTFWy.js +11 -0
  242. package/apps/web/dist/assets/ui-Uqnx1UpK.js +82 -0
  243. package/apps/web/dist/assets/{upload-BYZTwJTD.js → upload-BchUnQGV.js} +1 -1
  244. package/apps/web/dist/assets/{useMutation-D0QP_k2-.js → useMutation-DEkZhp5c.js} +1 -1
  245. package/apps/web/dist/assets/{volume-2-CVHoxdGM.js → volume-2-CU_oy81Z.js} +1 -1
  246. package/apps/web/dist/assets/with-selector-CoMyWBAX.js +1 -0
  247. package/apps/web/dist/index.html +17 -10
  248. package/apps/web/dist/mcp/flow.html +119 -64
  249. package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +20 -10
  250. package/node_modules/@engenty/wizards-shared/dist/assistant.d.ts +6 -1
  251. package/node_modules/@engenty/wizards-shared/dist/assistant.js +6 -1
  252. package/node_modules/@engenty/wizards-shared/dist/connectors.d.ts +236 -2
  253. package/node_modules/@engenty/wizards-shared/dist/connectors.js +52 -2
  254. package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +150 -8
  255. package/node_modules/@engenty/wizards-shared/dist/definition.js +46 -11
  256. package/node_modules/@engenty/wizards-shared/dist/discover.d.ts +21 -0
  257. package/node_modules/@engenty/wizards-shared/dist/discover.js +1 -0
  258. package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +26 -2
  259. package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +26 -2
  260. package/node_modules/@engenty/wizards-shared/dist/fit.js +1 -1
  261. package/node_modules/@engenty/wizards-shared/dist/json-schema.d.ts +1 -1
  262. package/node_modules/@engenty/wizards-shared/dist/json-schema.js +1 -1
  263. package/node_modules/@engenty/wizards-shared/dist/live.d.ts +2 -2
  264. package/node_modules/@engenty/wizards-shared/dist/live.js +1 -1
  265. package/node_modules/@engenty/wizards-shared/dist/marketplace.js +3 -1
  266. package/node_modules/@engenty/wizards-shared/dist/run.d.ts +54 -6
  267. package/node_modules/@engenty/wizards-shared/dist/run.js +85 -0
  268. package/node_modules/@engenty/wizards-shared/dist/runner-texts.d.ts +15 -1
  269. package/node_modules/@engenty/wizards-shared/dist/runner-texts.js +14 -0
  270. package/node_modules/@engenty/wizards-shared/dist/rwx.d.ts +42 -0
  271. package/node_modules/@engenty/wizards-shared/dist/rwx.js +29 -0
  272. package/node_modules/@engenty/wizards-shared/dist/skills.d.ts +1 -1
  273. package/node_modules/@engenty/wizards-shared/dist/space-data.d.ts +2 -2
  274. package/node_modules/@engenty/wizards-shared/dist/{projects.d.ts → spaces.d.ts} +39 -15
  275. package/node_modules/@engenty/wizards-shared/dist/{projects.js → spaces.js} +16 -9
  276. package/node_modules/@engenty/wizards-shared/dist/store.d.ts +7 -2
  277. package/node_modules/@engenty/wizards-shared/dist/surface.d.ts +35 -4
  278. package/node_modules/@engenty/wizards-shared/dist/surface.js +121 -3
  279. package/node_modules/@engenty/wizards-shared/dist/sync.d.ts +1 -1
  280. package/node_modules/@engenty/wizards-shared/dist/theme-look.js +1 -1
  281. package/node_modules/@engenty/wizards-shared/dist/wizard-package.d.ts +2 -2
  282. package/node_modules/@engenty/wizards-shared/dist/wizard-package.js +3 -3
  283. package/package.json +4 -1
  284. package/plugin/.claude-plugin/plugin.json +1 -1
  285. package/plugin/plugin.json +1 -1
  286. package/plugin/skills/build-wizard/SKILL.md +1 -1
  287. package/apps/runtime/dist/services/projects.js +0 -473
  288. package/apps/web/dist/assets/AboutDialog-B-JxkELB.js +0 -1
  289. package/apps/web/dist/assets/EditorPage-DQ_2FOzI.js +0 -3
  290. package/apps/web/dist/assets/Marketplace-DoH4YO3D.js +0 -2
  291. package/apps/web/dist/assets/NewWizardChannels-Tgoexgj4.js +0 -1
  292. package/apps/web/dist/assets/NewWizardPage-B24AF482.js +0 -7
  293. package/apps/web/dist/assets/OnboardingPage-BEvq4slJ.js +0 -1
  294. package/apps/web/dist/assets/PreviewPane-B_v7Y8R7.js +0 -10
  295. package/apps/web/dist/assets/ProjectPage-ClRuhFJo.js +0 -10
  296. package/apps/web/dist/assets/PublicRunner-MicrpVsv.js +0 -1
  297. package/apps/web/dist/assets/ReadOnly-BXjv-MSv.js +0 -1
  298. package/apps/web/dist/assets/SettingsPage-DY8O1r43.js +0 -2
  299. package/apps/web/dist/assets/SetupPage-BOVkVpMu.js +0 -1
  300. package/apps/web/dist/assets/SharePage-DXGzJSnR.js +0 -1
  301. package/apps/web/dist/assets/SkillEditor-BzzTDeaU.js +0 -1
  302. package/apps/web/dist/assets/changelog-BLdS-0Bj.js +0 -1
  303. package/apps/web/dist/assets/esm-BdxDT9Km.js +0 -7
  304. package/apps/web/dist/assets/i18n-8-Sw11tB.js +0 -55
  305. package/apps/web/dist/assets/index-OsdQFHmh.js +0 -49
  306. package/apps/web/dist/assets/index-QPipX5Fi.css +0 -1
  307. package/apps/web/dist/assets/lock-C0uxcOlq.js +0 -1
  308. package/apps/web/dist/assets/logo-CGNoptDg.js +0 -1
  309. package/apps/web/dist/assets/oss-credits-DpRWUPjD.js +0 -1
  310. package/apps/web/dist/assets/session-BWI-KENJ.js +0 -2
  311. package/apps/web/dist/assets/theme-D7krsx0_.js +0 -11
  312. package/apps/web/dist/assets/ui-DSXG3f49.js +0 -83
  313. /package/apps/runtime/dist/db/migrations/tenant/{0027_space_skill.sql → 0030_space_skill.sql} +0 -0
@@ -4,9 +4,10 @@ import { isTextMime } from "@engenty/wizards-shared/workspace";
4
4
  import { Agent } from "@mastra/core/agent";
5
5
  import { createTool } from "@mastra/core/tools";
6
6
  import { z } from "zod";
7
- import { exampleWizard, projectLines, } from "../authoring/guide.js";
7
+ import { exampleWizard, spaceLines, } from "../authoring/guide.js";
8
8
  import { wizardOpSchema } from "../authoring/ops.js";
9
9
  import { importFromRegistry, listConnectors, searchRegistry } from "../connectors/external.js";
10
+ import { guideSpaceConnections } from "../connectors/space-connections.js";
10
11
  import { agentModel, attachTools, chatModel, costOf, gatewayTools, totalUsage, } from "../models.js";
11
12
  import { pluginToolsOf } from "../plugins/registry.js";
12
13
  import { prompt } from "../prompts.js";
@@ -23,14 +24,14 @@ import { attempt as attemptTool, imageOutput } from "../tools/shared.js";
23
24
  import { runScript } from "../widgets/script.js";
24
25
  import { thoughtLine } from "./thought.js";
25
26
  const MAX_STEPS = 45;
26
- function systemPrompt(connectors, pluginTools) {
27
+ function systemPrompt(connectors, pluginTools, connections) {
27
28
  return `${prompt("architect", "system", {
28
29
  persona: prompt("architect", "persona"),
29
30
  schema: prompt("authoring", "schema"),
30
31
  principles: prompt("authoring", "principles", { sandbox: sandboxGuideLine() }),
31
32
  widgets: prompt("authoring", "widgets"),
32
33
  surfaces: prompt("authoring", "surfaces"),
33
- project_tools: projectLines(connectors, pluginTools),
34
+ space_tools: spaceLines(connectors, pluginTools, connections),
34
35
  example: exampleWizard(),
35
36
  how_you_work: prompt("architect", "how_you_work"),
36
37
  })}\n\n${contentPolicy()}`;
@@ -80,7 +81,7 @@ const attempt = (run) => attemptTool(run, { limit: Number.POSITIVE_INFINITY });
80
81
  function buildTools(input, resolved, wrote) {
81
82
  const { userId, wizardId } = input;
82
83
  const signal = input.signal;
83
- const projectId = async () => (await ownedWizard(userId, wizardId)).projectId;
84
+ const spaceId = async () => (await ownedWizard(userId, wizardId)).spaceId;
84
85
  const tools = {
85
86
  find_connectors: createTool({
86
87
  id: "find_connectors",
@@ -99,7 +100,7 @@ function buildTools(input, resolved, wrote) {
99
100
  .describe("Default: the service's MCP server if it has one, else its OpenAPI spec."),
100
101
  }),
101
102
  execute: async ({ domain, kind }) => attempt(async () => {
102
- const result = await importFromRegistry(userId, await projectId(), { domain, kind });
103
+ const result = await importFromRegistry(userId, await spaceId(), { domain, kind });
103
104
  wrote();
104
105
  return result;
105
106
  }),
@@ -108,7 +109,7 @@ function buildTools(input, resolved, wrote) {
108
109
  id: "list_connectors",
109
110
  description: prompt("mcp", "tool.list_connectors"),
110
111
  inputSchema: z.object({}),
111
- execute: async () => attempt(async () => ({ connectors: await listConnectors(await projectId()) })),
112
+ execute: async () => attempt(async () => ({ connectors: await listConnectors(await spaceId()) })),
112
113
  }),
113
114
  replace_wizard: createTool({
114
115
  id: "replace_wizard",
@@ -316,7 +317,7 @@ export async function runArchitect(input) {
316
317
  // The system prompt is long and identical on every turn: cache it.
317
318
  instructions: {
318
319
  role: "system",
319
- content: systemPrompt(input.connectors, await pluginToolsOf(currentTenant())),
320
+ content: systemPrompt(input.connectors, await pluginToolsOf(currentTenant()), await guideSpaceConnections(w.spaceId)),
320
321
  providerOptions: { anthropic: { cacheControl: { type: "ephemeral" } } },
321
322
  },
322
323
  model: agentModel(resolved),
@@ -0,0 +1,82 @@
1
+ import { CONFIRM_ACTION_TOOL } from "@engenty/wizards-shared/assistant";
2
+ import { and, eq } from "drizzle-orm";
3
+ import { nanoid } from "nanoid";
4
+ import { db, schema } from "../db/client.js";
5
+ import { prompt } from "../prompts.js";
6
+ import { isAdminRole } from "../services/access.js";
7
+ import { closedToMe } from "../services/members-studio.js";
8
+ import { callConnection, connectionResult, connectionToolsOf, makeConnectionTools, usableConnections, } from "../tools/connections.js";
9
+ import { attempt } from "../tools/shared.js";
10
+ /*
11
+ * Goose's connections (docs/plans/capabilities.md, "Who sees what"): a personal copilot works
12
+ * with its person's own sign-ins alone. Its tools are the connections in which each person signs
13
+ * in, in the spaces where this person has, within their audience. Reads run; a write, a send or a
14
+ * delete asks the person first, on a card in Goose's own chat (the browser's `confirm_action`),
15
+ * with no hold for the admins: it is the person's own account. A connection that signs in as the
16
+ * space is never among them.
17
+ */
18
+ /** The widest the person sees of what would be sent. */
19
+ const ASK_INPUT = 4000;
20
+ /** The person's own sign-ins, with the connection each belongs to. */
21
+ async function signedInConnections(userId) {
22
+ const rows = await db
23
+ .select({ row: schema.spaceConnection })
24
+ .from(schema.spaceConnectionSignIn)
25
+ .innerJoin(schema.spaceConnection, eq(schema.spaceConnection.id, schema.spaceConnectionSignIn.connectionId))
26
+ .where(and(eq(schema.spaceConnectionSignIn.userId, userId), eq(schema.spaceConnection.signIn, "person")));
27
+ return rows.map((r) => r.row);
28
+ }
29
+ /**
30
+ * Asks the person on a card in Goose's chat, where the browser offers one; `undefined` where it
31
+ * does not (an installed AI client as the model), so the broker answers that nobody can be asked.
32
+ */
33
+ function confirmInChat(input) {
34
+ if (!input.browserTools.some((t) => t.name === CONFIRM_ACTION_TOOL)) {
35
+ return undefined;
36
+ }
37
+ return async (ask) => {
38
+ if (ask.kind !== "confirm") {
39
+ return null;
40
+ }
41
+ const call = {
42
+ toolCallId: nanoid(10),
43
+ toolCallName: CONFIRM_ACTION_TOOL,
44
+ args: {
45
+ service: ask.service,
46
+ action: ask.action.summary,
47
+ destructive: ask.action.destructive,
48
+ input: ask.input.slice(0, ASK_INPUT),
49
+ },
50
+ };
51
+ input.onToolCall?.(call);
52
+ const out = (await input.callBrowser(call));
53
+ input.onToolResult?.({ toolCallId: call.toolCallId, content: JSON.stringify(out ?? null) });
54
+ return out?.confirmed === true ? { type: "done" } : { type: "skip" };
55
+ };
56
+ }
57
+ const serviceOf = (tool) => `${tool.row.name} (${tool.connector.name})`;
58
+ /** Goose's tools for its person's connections; none where they signed in to none. */
59
+ export async function gooseConnectionTools(input) {
60
+ const userId = input.user.id;
61
+ const who = { kind: "goose", id: userId, admin: isAdminRole(input.user.role) };
62
+ // Not in a space whose Studio is closed to a member: Goose is the Studio's.
63
+ const signedIn = [];
64
+ for (const row of await signedInConnections(userId)) {
65
+ if (!(await closedToMe(row.spaceId))) {
66
+ signedIn.push(row);
67
+ }
68
+ }
69
+ const tools = connectionToolsOf(await usableConnections(signedIn, who));
70
+ if (!tools.length) {
71
+ return {};
72
+ }
73
+ const where = (tool) => ({ chatId: input.chat.id, spaceId: tool.row.spaceId });
74
+ const ask = confirmInChat(input);
75
+ return makeConnectionTools({
76
+ tools,
77
+ who,
78
+ where,
79
+ writeNote: () => prompt("tools", "connection.asks_person"),
80
+ write: (tool, fields) => attempt(async () => connectionResult(await callConnection(tool, who, where(tool), fields, ask ? { ask } : {}), serviceOf(tool))),
81
+ }).tools;
82
+ }
@@ -36,10 +36,17 @@ export function cacheMarks(prompt) {
36
36
  return historyEnd || stepEnd ? marked(message) : message;
37
37
  });
38
38
  }
39
- const cacheMarksProcessor = {
39
+ /** The input processor that sets those marks on each request. */
40
+ export const cacheMarksProcessor = {
40
41
  id: "cache-marks",
41
42
  processLLMRequest: ({ prompt }) => ({ prompt: cacheMarks(prompt) }),
42
43
  };
44
+ /** Instructions as a system message with Anthropic's cache mark. */
45
+ export const markedInstructions = (content) => ({
46
+ role: "system",
47
+ content,
48
+ providerOptions: EPHEMERAL,
49
+ });
43
50
  /** The agent for a request: its model, instructions and tools. */
44
51
  export function spaceAgent(options) {
45
52
  const tools = sortedTools(options.tools);
@@ -47,7 +54,7 @@ export function spaceAgent(options) {
47
54
  return new Agent({
48
55
  id: options.id,
49
56
  name: options.name,
50
- instructions: { role: "system", content: options.instructions, providerOptions: EPHEMERAL },
57
+ instructions: markedInstructions(options.instructions),
51
58
  model: agentModel(options.resolved),
52
59
  tools: tools,
53
60
  inputProcessors: [cacheMarksProcessor],
@@ -1,27 +1,30 @@
1
1
  import { anthropic } from "@ai-sdk/anthropic";
2
+ import { CONFIRM_ACTION_TOOL } from "@engenty/wizards-shared/assistant";
2
3
  import { textClassOf } from "@engenty/wizards-shared/definition";
3
- import { cleanAssetSections, cleanLogoSections, FACT_TYPES, FONT_USES, factKey, gradientCss, PROJECT_FILE_KINDS, PROJECT_LIMITS, parseGradient, RULE_MARKS, textStyleLine, } from "@engenty/wizards-shared/projects";
4
+ import { cleanAssetSections, cleanLogoSections, FACT_TYPES, FONT_USES, factKey, gradientCss, parseGradient, RULE_MARKS, SPACE_FILE_KINDS, SPACE_LIMITS, textStyleLine, } from "@engenty/wizards-shared/spaces";
4
5
  import { pickedClass } from "@engenty/wizards-shared/tiers";
5
6
  import { createTool } from "@mastra/core/tools";
6
7
  import { nanoid } from "nanoid";
7
8
  import { z } from "zod";
8
9
  import { knowsTools } from "../assistant/knows.js";
10
+ import { subjectsOfGoose } from "../broker/rwx.js";
9
11
  import { currentFeatures } from "../features.js";
10
12
  import { managed } from "../manage.js";
11
13
  import { chatModel, contextWindowOf, costOf, currentTier, gatewayTools, searchAllowed, textModel, totalUsage, usageOf, } from "../models.js";
12
14
  import { prompt } from "../prompts.js";
13
15
  import { contentPolicy } from "../safety.js";
14
16
  import { knowledgeCounts } from "../services/knowledge.js";
15
- import { addProjectFileFromUrl, projectFileContent, projectFiles, updateProjectFile, } from "../services/project-files.js";
16
- import { documentText } from "../services/project-index.js";
17
- import { ownedProject, updateProject } from "../services/projects.js";
18
17
  import { activeSkills, skillList } from "../services/skills.js";
19
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";
20
22
  import { currentTenant } from "../tenants/tenant.js";
21
23
  import { serverText } from "../texts.js";
22
24
  import { assistantPageOf, assistantToolsOf } from "../tools/plugin.js";
23
25
  import { attempt as attemptTool, imageOutput } from "../tools/shared.js";
24
26
  import { skillToolsOf } from "../tools/skills.js";
27
+ import { gooseConnectionTools } from "./goose-connections.js";
25
28
  import { spaceAgent } from "./space-agent.js";
26
29
  import { chatTurnWay } from "./subscription.js";
27
30
  import { readWebsite } from "./website.js";
@@ -30,12 +33,17 @@ export function signalText(taken) {
30
33
  return prompt("goose", "signal", { messages: taken.map((s) => s.message).join("\n\n") });
31
34
  }
32
35
  const MAX_STEPS = 24;
33
- /** The system prompt: these sections of prompts/goose.md, in this order. */
34
- 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) {
35
41
  return [
36
42
  prompt("goose", "persona"),
37
43
  prompt("goose", "voice"),
38
- prompt("goose", "primer"),
44
+ prompt("goose", "primer", {
45
+ skills: capabilities ? "/capabilities/skills" : "/skills",
46
+ }),
39
47
  prompt("goose", "knows"),
40
48
  prompt("goose", "page"),
41
49
  prompt("goose", "space"),
@@ -82,13 +90,13 @@ function activity(tool, args, lang) {
82
90
  }
83
91
  /** A tool failure the model can read and fix, instead of a crashed turn: the whole message. */
84
92
  const attempt = (run) => attemptTool(run, { limit: Number.POSITIVE_INFINITY });
85
- async function projectState(userId, projectId) {
86
- const p = await ownedProject(userId, projectId);
87
- const files = await projectFiles(projectId);
88
- 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);
89
97
  return {
90
98
  knowledge: {
91
- ...(await knowledgeCounts(projectId)),
99
+ ...(await knowledgeCounts(spaceId)),
92
100
  categories: categories.map((c) => `${c.name} (${c.type}${c.proposed ? ", proposed" : ""})`),
93
101
  },
94
102
  title: p.brand.name ?? "",
@@ -172,10 +180,10 @@ async function projectState(userId, projectId) {
172
180
  })),
173
181
  };
174
182
  }
175
- function spaceTools(input, project, wrote, on) {
183
+ export function gooseSpaceTools(input, space, wrote, on) {
176
184
  const { signal } = input;
177
185
  const userId = input.user.id;
178
- const projectId = project.id;
186
+ const spaceId = space.id;
179
187
  // Said from inside the tool: an installed AI client runs tools without the stream showing it.
180
188
  const doing = (tool, args = {}) => {
181
189
  const label = activity(tool, args, input.lang);
@@ -183,7 +191,7 @@ function spaceTools(input, project, wrote, on) {
183
191
  input.onActivity?.(label);
184
192
  }
185
193
  };
186
- // 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.
187
195
  let turn = Promise.resolve();
188
196
  const inTurn = (run) => {
189
197
  const next = turn.then(run, run);
@@ -206,13 +214,29 @@ function spaceTools(input, project, wrote, on) {
206
214
  inputSchema: z.object({
207
215
  title: z.string().max(120).optional(),
208
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"),
209
229
  }),
210
- execute: ({ title, about }) => attempt(() => inTurn(async () => {
230
+ execute: ({ title, about, brandName, tagline, voice, links }) => attempt(() => inTurn(async () => {
211
231
  doing("set_profile");
212
- await updateProject(userId, projectId, {
232
+ await updateSpace(userId, spaceId, {
213
233
  brand: {
214
234
  ...(title !== undefined ? { name: title } : {}),
215
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 })) } : {}),
216
240
  },
217
241
  });
218
242
  wrote();
@@ -233,7 +257,7 @@ function spaceTools(input, project, wrote, on) {
233
257
  }),
234
258
  execute: ({ facts }) => attempt(() => inTurn(async () => {
235
259
  doing("set_facts");
236
- const p = await ownedProject(userId, projectId);
260
+ const p = await ownedSpace(userId, spaceId);
237
261
  const next = [...p.facts];
238
262
  for (const f of facts) {
239
263
  const label = f.label.trim();
@@ -251,10 +275,10 @@ function spaceTools(input, project, wrote, on) {
251
275
  });
252
276
  }
253
277
  }
254
- if (next.length > PROJECT_LIMITS.facts) {
255
- 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.`);
256
280
  }
257
- await updateProject(userId, projectId, { facts: next });
281
+ await updateSpace(userId, spaceId, { facts: next });
258
282
  wrote();
259
283
  return { ok: true, facts: next.length };
260
284
  })),
@@ -265,10 +289,10 @@ function spaceTools(input, project, wrote, on) {
265
289
  inputSchema: z.object({ labels: z.array(z.string()).min(1) }),
266
290
  execute: ({ labels }) => attempt(() => inTurn(async () => {
267
291
  doing("remove_facts");
268
- const p = await ownedProject(userId, projectId);
292
+ const p = await ownedSpace(userId, spaceId);
269
293
  const gone = new Set(labels.map((l) => l.trim().toLowerCase()));
270
294
  const next = p.facts.filter((f) => !gone.has(f.label.toLowerCase()));
271
- await updateProject(userId, projectId, { facts: next });
295
+ await updateSpace(userId, spaceId, { facts: next });
272
296
  wrote();
273
297
  return { ok: true, removed: p.facts.length - next.length };
274
298
  })),
@@ -283,10 +307,10 @@ function spaceTools(input, project, wrote, on) {
283
307
  value: z.string().regex(/^#[0-9a-fA-F]{6}$/),
284
308
  section: z.string().max(80).optional().describe("A section's title"),
285
309
  }))
286
- .max(PROJECT_LIMITS.colors),
310
+ .max(SPACE_LIMITS.colors),
287
311
  sections: z
288
312
  .array(z.object({ title: z.string().min(1).max(80) }))
289
- .max(PROJECT_LIMITS.logoSections)
313
+ .max(SPACE_LIMITS.logoSections)
290
314
  .optional(),
291
315
  }),
292
316
  execute: ({ colors, sections }) => attempt(() => inTurn(async () => {
@@ -294,7 +318,7 @@ function spaceTools(input, project, wrote, on) {
294
318
  if (!on.brandSections && (sections || colors.some((c) => c.section))) {
295
319
  throw new Error("Colour sections are not available in this studio: pass the colours without them.");
296
320
  }
297
- const p = await ownedProject(userId, projectId);
321
+ const p = await ownedSpace(userId, spaceId);
298
322
  const groups = sections
299
323
  ? sections.map((s) => ({
300
324
  id: p.brand.colorSections?.find((x) => x.title === s.title)?.id ?? nanoid(10),
@@ -305,7 +329,7 @@ function spaceTools(input, project, wrote, on) {
305
329
  if (unknown.length) {
306
330
  throw new Error(`No colour section named: ${unknown.map((c) => c.section).join(", ")}`);
307
331
  }
308
- await updateProject(userId, projectId, {
332
+ await updateSpace(userId, spaceId, {
309
333
  brand: {
310
334
  colors: colors.map(({ section, ...c }) => {
311
335
  const id = groups.find((s) => s.title === section)?.id;
@@ -331,16 +355,16 @@ function spaceTools(input, project, wrote, on) {
331
355
  .describe("When to use these logos, in the person's language"),
332
356
  logos: z.array(z.string()).describe("Ids of the space's logo files, in order"),
333
357
  }))
334
- .max(PROJECT_LIMITS.logoSections),
358
+ .max(SPACE_LIMITS.logoSections),
335
359
  }),
336
360
  execute: ({ sections }) => attempt(() => inTurn(async () => {
337
361
  doing("set_logo_sections");
338
- const logos = (await projectFiles(projectId, "logo")).map((f) => f.id);
362
+ const logos = (await spaceFiles(spaceId, "logo")).map((f) => f.id);
339
363
  const unknown = sections.flatMap((s) => s.logos).filter((id) => !logos.includes(id));
340
364
  if (unknown.length) {
341
365
  throw new Error(`Not a logo of this space: ${unknown.join(", ")}`);
342
366
  }
343
- await updateProject(userId, projectId, {
367
+ await updateSpace(userId, spaceId, {
344
368
  brand: {
345
369
  logoSections: cleanLogoSections(sections.map((s) => ({ ...s, id: nanoid(10) })), logos),
346
370
  },
@@ -358,16 +382,16 @@ function spaceTools(input, project, wrote, on) {
358
382
  title: z.string().min(1).max(80),
359
383
  assets: z.array(z.string()).describe("Ids of the space's asset files, in order"),
360
384
  }))
361
- .max(PROJECT_LIMITS.logoSections),
385
+ .max(SPACE_LIMITS.logoSections),
362
386
  }),
363
387
  execute: ({ sections }) => attempt(() => inTurn(async () => {
364
388
  doing("set_asset_sections");
365
- const assets = (await projectFiles(projectId, "asset")).map((f) => f.id);
389
+ const assets = (await spaceFiles(spaceId, "asset")).map((f) => f.id);
366
390
  const unknown = sections.flatMap((s) => s.assets).filter((id) => !assets.includes(id));
367
391
  if (unknown.length) {
368
392
  throw new Error(`Not an asset of this space: ${unknown.join(", ")}`);
369
393
  }
370
- await updateProject(userId, projectId, {
394
+ await updateSpace(userId, spaceId, {
371
395
  brand: {
372
396
  assetSections: cleanAssetSections(sections.map((s) => ({ ...s, id: nanoid(10) })), assets),
373
397
  },
@@ -395,7 +419,7 @@ function spaceTools(input, project, wrote, on) {
395
419
  .optional()
396
420
  .describe("All the licence allows it for, only where a source says so"),
397
421
  }))
398
- .max(PROJECT_LIMITS.fonts),
422
+ .max(SPACE_LIMITS.fonts),
399
423
  textStyles: z
400
424
  .array(z.object({
401
425
  name: z.string().min(1).max(60),
@@ -406,17 +430,17 @@ function spaceTools(input, project, wrote, on) {
406
430
  tracking: z.number().min(-20).max(50).describe("Letter spacing, % of the size"),
407
431
  uppercase: z.boolean().optional(),
408
432
  }))
409
- .max(PROJECT_LIMITS.textStyles)
433
+ .max(SPACE_LIMITS.textStyles)
410
434
  .optional(),
411
435
  }),
412
436
  execute: ({ fonts, textStyles }) => attempt(() => inTurn(async () => {
413
437
  doing("set_typography");
414
- const p = await ownedProject(userId, projectId);
438
+ const p = await ownedSpace(userId, spaceId);
415
439
  const faces = fonts.map((f) => ({
416
440
  ...f,
417
441
  id: p.brand.fonts?.find((x) => x.family === f.family)?.id ?? nanoid(10),
418
442
  }));
419
- await updateProject(userId, projectId, {
443
+ await updateSpace(userId, spaceId, {
420
444
  brand: {
421
445
  fonts: faces,
422
446
  ...(textStyles
@@ -445,11 +469,11 @@ function spaceTools(input, project, wrote, on) {
445
469
  description: z.string().max(400).optional().describe("When to use it"),
446
470
  css: z.string().max(1000),
447
471
  }))
448
- .max(PROJECT_LIMITS.gradients),
472
+ .max(SPACE_LIMITS.gradients),
449
473
  }),
450
474
  execute: ({ section, gradients }) => attempt(() => inTurn(async () => {
451
475
  doing("set_gradients");
452
- const p = await ownedProject(userId, projectId);
476
+ const p = await ownedSpace(userId, spaceId);
453
477
  const sections = p.brand.colorSections ?? [];
454
478
  const found = sections.find((s) => s.title === section && s.kind === "gradients");
455
479
  const id = found?.id ?? nanoid(10);
@@ -458,7 +482,7 @@ function spaceTools(input, project, wrote, on) {
458
482
  if (bad.length) {
459
483
  throw new Error(`Not a gradient with hex stops: ${bad.join(", ")}`);
460
484
  }
461
- await updateProject(userId, projectId, {
485
+ await updateSpace(userId, spaceId, {
462
486
  brand: {
463
487
  colorSections: found
464
488
  ? sections
@@ -492,11 +516,11 @@ function spaceTools(input, project, wrote, on) {
492
516
  .optional()
493
517
  .describe("do, dont, important, question, number; none for a plain note"),
494
518
  }))
495
- .max(PROJECT_LIMITS.logoRules),
519
+ .max(SPACE_LIMITS.logoRules),
496
520
  }),
497
521
  execute: ({ of, rules }) => attempt(() => inTurn(async () => {
498
522
  doing("set_rules");
499
- await updateProject(userId, projectId, {
523
+ await updateSpace(userId, spaceId, {
500
524
  brand: of === "logos"
501
525
  ? { logoRules: rules }
502
526
  : of === "colors"
@@ -512,7 +536,7 @@ function spaceTools(input, project, wrote, on) {
512
536
  description: prompt("goose", "tool.save_file"),
513
537
  inputSchema: z.object({
514
538
  url: z.string(),
515
- kind: z.enum(PROJECT_FILE_KINDS),
539
+ kind: z.enum(SPACE_FILE_KINDS),
516
540
  description: z
517
541
  .string()
518
542
  .max(600)
@@ -521,7 +545,7 @@ function spaceTools(input, project, wrote, on) {
521
545
  }),
522
546
  execute: ({ url, kind, description }) => attempt(async () => {
523
547
  doing("save_file", { kind });
524
- const row = await addProjectFileFromUrl(projectId, { url, kind, description, signal });
548
+ const row = await addSpaceFileFromUrl(spaceId, { url, kind, description, signal });
525
549
  wrote();
526
550
  return { ok: true, id: row.id, name: row.name, mime: row.mime, size: row.size };
527
551
  }),
@@ -532,7 +556,7 @@ function spaceTools(input, project, wrote, on) {
532
556
  inputSchema: z.object({ id: z.string(), description: z.string().max(600) }),
533
557
  execute: ({ id, description }) => attempt(async () => {
534
558
  doing("describe_file");
535
- await updateProjectFile(projectId, id, { description });
559
+ await updateSpaceFile(spaceId, id, { description });
536
560
  wrote();
537
561
  return { ok: true };
538
562
  }),
@@ -546,7 +570,7 @@ function spaceTools(input, project, wrote, on) {
546
570
  }),
547
571
  execute: ({ id, from }) => attempt(async () => {
548
572
  doing("look_at_file");
549
- const { row, data } = await projectFileContent(projectId, id);
573
+ const { row, data } = await spaceFileContent(spaceId, id, subjectsOfGoose(userId, input.user.role));
550
574
  if (row.kind === "document") {
551
575
  const text = await documentText(row);
552
576
  if (!text) {
@@ -635,13 +659,19 @@ function traced(tools, input, record) {
635
659
  };
636
660
  }
637
661
  }
638
- /** 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. */
639
663
  function partOf(route) {
640
- const m = route.match(/^\/space\/(info|brand|knowledge|data|results|skills)/);
641
- 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;
642
672
  }
643
673
  /** How large each tool is in the prompt: its description and its schema, in characters. */
644
- function toolSizes(tools) {
674
+ export function toolSizes(tools) {
645
675
  return Object.entries(tools)
646
676
  .map(([name, tool]) => {
647
677
  let schema = "";
@@ -685,8 +715,8 @@ export async function runStudioAssistant(input) {
685
715
  input.onChanged?.();
686
716
  };
687
717
  const cards = [];
688
- const { project } = input;
689
- const space = project && input.writable ? project : null;
718
+ const { space } = input;
719
+ const writable = space && input.writable ? space : null;
690
720
  const switches = await currentFeatures();
691
721
  const brandOn = {
692
722
  brandSections: switches.brandSections === true,
@@ -696,7 +726,7 @@ export async function runStudioAssistant(input) {
696
726
  const tools = {
697
727
  ...knowsTools({
698
728
  user: input.user,
699
- project: project ? { id: project.id, name: project.name } : null,
729
+ space: space ? { id: space.id, name: space.name } : null,
700
730
  lang: input.lang,
701
731
  chatId: input.chat.id,
702
732
  doing: (label) => input.onActivity?.(label),
@@ -705,7 +735,7 @@ export async function runStudioAssistant(input) {
705
735
  input.onCard?.(card);
706
736
  },
707
737
  }),
708
- ...(space ? spaceTools(input, space, wrote, brandOn) : {}),
738
+ ...(writable ? gooseSpaceTools(input, writable, wrote, brandOn) : {}),
709
739
  };
710
740
  // On everyday effort the chat can offer extra effort for work that asks for more: a card with
711
741
  // a button, while it goes on answering.
@@ -729,10 +759,10 @@ export async function runStudioAssistant(input) {
729
759
  });
730
760
  }
731
761
  // What the tenant's plugins let the assistant do besides: a source of knowledge, say.
732
- if (space) {
762
+ if (writable) {
733
763
  Object.assign(tools, await assistantToolsOf({
734
764
  tenantId: currentTenant(),
735
- space: { id: space.id, name: space.name },
765
+ space: { id: writable.id, name: writable.name },
736
766
  userId: input.user.id,
737
767
  signal: input.signal ?? new AbortController().signal,
738
768
  emit: (message) => input.onActivity?.(message),
@@ -743,14 +773,18 @@ export async function runStudioAssistant(input) {
743
773
  },
744
774
  }));
745
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));
746
779
  // The space's skills (docs/plans/skills.md): Goose reads them as a step does.
747
- const skills = project && switches.skills === true ? await activeSkills(project.id) : null;
748
- 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) : [];
749
782
  if (skills) {
750
783
  Object.assign(tools, skillToolsOf(skills, (name) => input.onActivity?.(serverText(input.lang, "doingReadSkill", { name }))));
751
784
  }
752
785
  for (const spec of input.browserTools) {
753
- 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) {
754
788
  continue;
755
789
  }
756
790
  const tool = browserTool(input, spec);
@@ -768,7 +802,7 @@ export async function runStudioAssistant(input) {
768
802
  else if (search && resolved.gateway) {
769
803
  tools.web_search = gatewayTools.perplexitySearch({ maxResults: 6 });
770
804
  }
771
- const instructions = system();
805
+ const instructions = system(switches.capabilities === true);
772
806
  const agent = spaceAgent({
773
807
  id: "studio-assistant",
774
808
  name: "Studio assistant",
@@ -777,8 +811,8 @@ export async function runStudioAssistant(input) {
777
811
  tools,
778
812
  });
779
813
  const page = input.page;
780
- const pluginPage = page?.plugin && project
781
- ? 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 })
782
816
  : null;
783
817
  const part = page ? partOf(page.route) : null;
784
818
  const { history } = input;
@@ -807,10 +841,10 @@ export async function runStudioAssistant(input) {
807
841
  ...pluginPage.blocks,
808
842
  ].join("\n\n")
809
843
  : "",
810
- space
811
- ? `The space now:\n\`\`\`json\n${JSON.stringify(await projectState(input.user.id, space.id))}\n\`\`\``
812
- : project
813
- ? 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 })
814
848
  : "No space is open.",
815
849
  part === "knowledge" ? prompt("goose", "turn.knowledge") : "",
816
850
  allSkills.length
@@ -821,7 +855,7 @@ export async function runStudioAssistant(input) {
821
855
  : part === "skills"
822
856
  ? prompt("goose", "turn.skills_empty")
823
857
  : "",
824
- space && !(brandOn.brandSections && brandOn.brandRules && brandOn.typography)
858
+ writable && !(brandOn.brandSections && brandOn.brandRules && brandOn.typography)
825
859
  ? prompt("goose", "turn.off", {
826
860
  missing: [
827
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";