@engenty/wizards-runtime 0.13.0 → 0.14.1

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 +26 -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/{0027_space_skill.sql → 0030_space_skill.sql} +8 -8
  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 +40 -5
  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/protocol.md +80 -0
  84. package/apps/runtime/dist/docs/user-guide/skills.md +8 -4
  85. package/apps/runtime/dist/docs/user-guide/space.md +5 -4
  86. package/apps/runtime/dist/docs/user-guide/together.md +16 -2
  87. package/apps/runtime/dist/docs/user-guide/troubleshooting.md +2 -2
  88. package/apps/runtime/dist/docs/user-guide/work-mode.md +128 -0
  89. package/apps/runtime/dist/engenty/connections-external/build-connector.js +2 -5
  90. package/apps/runtime/dist/engenty/connections-external/importer/classify.js +72 -0
  91. package/apps/runtime/dist/engenty/connections-google/connectors/gmail.js +1 -1
  92. package/apps/runtime/dist/engenty/connections-microsoft/outlook.js +3 -2
  93. package/apps/runtime/dist/engenty/connections-sdk/types.js +2 -0
  94. package/apps/runtime/dist/engenty/connections-slack/connector.js +2 -1
  95. package/apps/runtime/dist/engine/resources.js +43 -12
  96. package/apps/runtime/dist/engine/runner.js +75 -23
  97. package/apps/runtime/dist/engine/steps.js +30 -12
  98. package/apps/runtime/dist/engine/template.js +18 -1
  99. package/apps/runtime/dist/env.js +9 -4
  100. package/apps/runtime/dist/index.js +18 -2
  101. package/apps/runtime/dist/live/feed.js +2 -2
  102. package/apps/runtime/dist/live/origin.js +2 -2
  103. package/apps/runtime/dist/live/views.js +51 -26
  104. package/apps/runtime/dist/manage.js +7 -0
  105. package/apps/runtime/dist/mcp/flow-app.js +1 -1
  106. package/apps/runtime/dist/mcp/tools.js +75 -34
  107. package/apps/runtime/dist/models.js +1 -1
  108. package/apps/runtime/dist/motion-graphics/project.js +8 -8
  109. package/apps/runtime/dist/motion-graphics/tools.js +1 -1
  110. package/apps/runtime/dist/plugins/events.js +2 -2
  111. package/apps/runtime/dist/plugins/jobs.js +4 -1
  112. package/apps/runtime/dist/plugins/loader.js +2 -2
  113. package/apps/runtime/dist/prompts/architect.md +3 -3
  114. package/apps/runtime/dist/prompts/authoring.md +46 -12
  115. package/apps/runtime/dist/prompts/goose.md +7 -7
  116. package/apps/runtime/dist/prompts/mcp.md +6 -6
  117. package/apps/runtime/dist/prompts/services.md +4 -4
  118. package/apps/runtime/dist/prompts/step.md +2 -2
  119. package/apps/runtime/dist/prompts/tools.md +39 -10
  120. package/apps/runtime/dist/routes/api.js +31 -20
  121. package/apps/runtime/dist/routes/broker.js +316 -0
  122. package/apps/runtime/dist/routes/connections.js +71 -0
  123. package/apps/runtime/dist/routes/delivery.js +25 -0
  124. package/apps/runtime/dist/routes/discover.js +17 -0
  125. package/apps/runtime/dist/routes/live.js +11 -1
  126. package/apps/runtime/dist/routes/person.js +4 -1
  127. package/apps/runtime/dist/routes/plugins.js +3 -1
  128. package/apps/runtime/dist/routes/rules.js +26 -0
  129. package/apps/runtime/dist/routes/runs.js +54 -33
  130. package/apps/runtime/dist/routes/skills.js +6 -6
  131. package/apps/runtime/dist/routes/studio.js +153 -144
  132. package/apps/runtime/dist/routes/work.js +199 -0
  133. package/apps/runtime/dist/sandbox/index.js +27 -0
  134. package/apps/runtime/dist/services/access.js +38 -17
  135. package/apps/runtime/dist/services/api.js +38 -13
  136. package/apps/runtime/dist/services/architect.js +3 -3
  137. package/apps/runtime/dist/services/assistant-chats.js +9 -1
  138. package/apps/runtime/dist/services/brand.js +12 -12
  139. package/apps/runtime/dist/services/broker-bell.js +69 -0
  140. package/apps/runtime/dist/services/broker-notify.js +127 -0
  141. package/apps/runtime/dist/services/client-steps.js +79 -0
  142. package/apps/runtime/dist/services/cloud.js +42 -42
  143. package/apps/runtime/dist/services/command-risk.js +51 -0
  144. package/apps/runtime/dist/services/discover.js +85 -0
  145. package/apps/runtime/dist/services/knowledge-model.js +13 -13
  146. package/apps/runtime/dist/services/knowledge.js +117 -80
  147. package/apps/runtime/dist/services/manage-reports.js +74 -7
  148. package/apps/runtime/dist/services/members-studio.js +165 -0
  149. package/apps/runtime/dist/services/onboarding.js +22 -22
  150. package/apps/runtime/dist/services/package-file.js +1 -1
  151. package/apps/runtime/dist/services/package.js +22 -22
  152. package/apps/runtime/dist/services/pages.js +7 -7
  153. package/apps/runtime/dist/services/runs.js +4 -3
  154. package/apps/runtime/dist/services/seen.js +55 -0
  155. package/apps/runtime/dist/services/shares.js +23 -13
  156. package/apps/runtime/dist/services/site.js +23 -23
  157. package/apps/runtime/dist/services/skills-registry.js +15 -15
  158. package/apps/runtime/dist/services/skills.js +44 -44
  159. package/apps/runtime/dist/services/space-categories.js +35 -35
  160. package/apps/runtime/dist/services/space-data.js +130 -111
  161. package/apps/runtime/dist/services/{project-files.js → space-files.js} +84 -75
  162. package/apps/runtime/dist/services/{project-index.js → space-index.js} +116 -73
  163. package/apps/runtime/dist/services/space-origin.js +19 -11
  164. package/apps/runtime/dist/services/spaces.js +478 -612
  165. package/apps/runtime/dist/services/synced-spaces.js +668 -0
  166. package/apps/runtime/dist/services/themes.js +15 -15
  167. package/apps/runtime/dist/services/widgets.js +6 -6
  168. package/apps/runtime/dist/services/wizards.js +112 -38
  169. package/apps/runtime/dist/services/work-ai.js +257 -0
  170. package/apps/runtime/dist/services/work-approvals.js +104 -0
  171. package/apps/runtime/dist/services/work-chats.js +908 -0
  172. package/apps/runtime/dist/services/work-connections.js +90 -0
  173. package/apps/runtime/dist/services/work-files.js +85 -0
  174. package/apps/runtime/dist/services/work-mastra.js +73 -0
  175. package/apps/runtime/dist/services/work-sandbox.js +42 -0
  176. package/apps/runtime/dist/sharing/files.js +14 -4
  177. package/apps/runtime/dist/sharing/index.js +40 -39
  178. package/apps/runtime/dist/sharing/jobs.js +67 -17
  179. package/apps/runtime/dist/sharing/targets/connector.js +10 -6
  180. package/apps/runtime/dist/sharing/targets/email.js +10 -8
  181. package/apps/runtime/dist/sharing/targets/slack.js +10 -8
  182. package/apps/runtime/dist/sharing/targets/storage.js +6 -4
  183. package/apps/runtime/dist/store/index.js +14 -3
  184. package/apps/runtime/dist/store/shared-lists.js +4 -2
  185. package/apps/runtime/dist/sync/apply.js +2 -2
  186. package/apps/runtime/dist/sync/client.js +113 -113
  187. package/apps/runtime/dist/sync/hub.js +41 -41
  188. package/apps/runtime/dist/sync/log.js +12 -12
  189. package/apps/runtime/dist/sync/records.js +118 -120
  190. package/apps/runtime/dist/texts.js +38 -2
  191. package/apps/runtime/dist/tools/connections.js +112 -0
  192. package/apps/runtime/dist/tools/connector.js +157 -67
  193. package/apps/runtime/dist/tools/index.js +28 -13
  194. package/apps/runtime/dist/tools/mail.js +40 -11
  195. package/apps/runtime/dist/tools/pages.js +11 -5
  196. package/apps/runtime/dist/tools/plugin.js +43 -7
  197. package/apps/runtime/dist/tools/skills.js +1 -1
  198. package/apps/runtime/dist/tools/{project.js → space.js} +30 -25
  199. package/apps/runtime/dist/tools/store.js +3 -2
  200. package/apps/runtime/dist/widgets/step.js +10 -10
  201. package/apps/web/dist/assets/AboutDialog-SpDcn8VZ.js +1 -0
  202. package/apps/web/dist/assets/CapabilitiesPage-Bgnm_3dk.js +2 -0
  203. package/apps/web/dist/assets/{ChangelogDialog-SwyId00t.js → ChangelogDialog-DAnjV6cZ.js} +1 -1
  204. package/apps/web/dist/assets/{CodeEditor-BwZsk5Al.js → CodeEditor-nxoOt8ge.js} +1 -1
  205. package/apps/web/dist/assets/EditorPage-B98C-9Nv.js +3 -0
  206. package/apps/web/dist/assets/{FlowPreview-DtSpjVTl.js → FlowPreview-aMfwcPul.js} +1 -1
  207. package/apps/web/dist/assets/LangSwitch-DpD0inR4.js +1 -0
  208. package/apps/web/dist/assets/Marketplace-CpzD9pNQ.js +2 -0
  209. package/apps/web/dist/assets/NewWizardChannels-D8IYLg_S.js +1 -0
  210. package/apps/web/dist/assets/NewWizardPage-DlBt0Mfq.js +7 -0
  211. package/apps/web/dist/assets/OnboardingPage-ztHT01ah.js +1 -0
  212. package/apps/web/dist/assets/PreviewPane-DC1kAi3x.js +9 -0
  213. package/apps/web/dist/assets/PublicRunner-D6lKP0j8.js +1 -0
  214. package/apps/web/dist/assets/ReadOnly-DFsuKPCw.js +1 -0
  215. package/apps/web/dist/assets/SettingsPage-DkHeCO2c.js +2 -0
  216. package/apps/web/dist/assets/SetupPage-DZ8xRkfS.js +1 -0
  217. package/apps/web/dist/assets/SharePage-494ZPsjQ.js +1 -0
  218. package/apps/web/dist/assets/SkillEditor-CqQMg2MC.js +1 -0
  219. package/apps/web/dist/assets/Skills-CnhpgoOA.js +9 -0
  220. package/apps/web/dist/assets/SpacePage-CWlU_BZP.js +2 -0
  221. package/apps/web/dist/assets/UpdateCheck-BKNkNJyG.js +2 -0
  222. package/apps/web/dist/assets/changelog-BhMZS-rs.js +1 -0
  223. package/apps/web/dist/assets/circle-alert-C8Ma-bPY.js +1 -0
  224. package/apps/web/dist/assets/circle-check-Bu9Z3mlJ.js +1 -0
  225. package/apps/web/dist/assets/code-editor-CfTGqOpp.js +2 -0
  226. package/apps/web/dist/assets/{code-xml-TwKzzMtA.js → code-xml-B4kLFZSj.js} +1 -1
  227. package/apps/web/dist/assets/connection-sign-in-Cngd_QDO.js +1 -0
  228. package/apps/web/dist/assets/esm-Xwn4GtqG.js +7 -0
  229. package/apps/web/dist/assets/{eye-Brd-xPUJ.js → eye-BpoKpIdt.js} +1 -1
  230. package/apps/web/dist/assets/host-BrP-ENHg.css +1 -0
  231. package/apps/web/dist/assets/host-C0WQlRKB.js +118 -0
  232. package/apps/web/dist/assets/i18n-BJ7Ld6O6.js +55 -0
  233. package/apps/web/dist/assets/index-ClVtdDUZ.js +10 -0
  234. package/apps/web/dist/assets/index-D18DvnxX.css +1 -0
  235. package/apps/web/dist/assets/logo-BpnjXTRy.js +1 -0
  236. package/apps/web/dist/assets/oss-credits-IdX5bc71.js +1 -0
  237. package/apps/web/dist/assets/{phone-DhkHteoJ.js → phone-Ctvf-Am-.js} +1 -1
  238. package/apps/web/dist/assets/read-aloud-Da_RSm2S.js +1 -0
  239. package/apps/web/dist/assets/{runners-G-XYaDgR.js → runners-CyIvJIHr.js} +1 -1
  240. package/apps/web/dist/assets/scroll-text-ChrjRu9Y.js +1 -0
  241. package/apps/web/dist/assets/session-SXPtTWRK.js +2 -0
  242. package/apps/web/dist/assets/theme-BCau3f6O.js +11 -0
  243. package/apps/web/dist/assets/ui-Uqnx1UpK.js +82 -0
  244. package/apps/web/dist/assets/{upload-BYZTwJTD.js → upload-BchUnQGV.js} +1 -1
  245. package/apps/web/dist/assets/{useMutation-D0QP_k2-.js → useMutation-DEkZhp5c.js} +1 -1
  246. package/apps/web/dist/assets/{volume-2-CVHoxdGM.js → volume-2-CU_oy81Z.js} +1 -1
  247. package/apps/web/dist/assets/with-selector-CoMyWBAX.js +1 -0
  248. package/apps/web/dist/index.html +17 -10
  249. package/apps/web/dist/mcp/flow.html +119 -64
  250. package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +20 -10
  251. package/node_modules/@engenty/wizards-shared/dist/assistant.d.ts +6 -1
  252. package/node_modules/@engenty/wizards-shared/dist/assistant.js +6 -1
  253. package/node_modules/@engenty/wizards-shared/dist/connectors.d.ts +236 -2
  254. package/node_modules/@engenty/wizards-shared/dist/connectors.js +52 -2
  255. package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +150 -8
  256. package/node_modules/@engenty/wizards-shared/dist/definition.js +46 -11
  257. package/node_modules/@engenty/wizards-shared/dist/discover.d.ts +21 -0
  258. package/node_modules/@engenty/wizards-shared/dist/discover.js +1 -0
  259. package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +26 -2
  260. package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +26 -2
  261. package/node_modules/@engenty/wizards-shared/dist/fit.js +1 -1
  262. package/node_modules/@engenty/wizards-shared/dist/json-schema.d.ts +1 -1
  263. package/node_modules/@engenty/wizards-shared/dist/json-schema.js +1 -1
  264. package/node_modules/@engenty/wizards-shared/dist/live.d.ts +2 -2
  265. package/node_modules/@engenty/wizards-shared/dist/live.js +1 -1
  266. package/node_modules/@engenty/wizards-shared/dist/marketplace.js +3 -1
  267. package/node_modules/@engenty/wizards-shared/dist/run.d.ts +54 -6
  268. package/node_modules/@engenty/wizards-shared/dist/run.js +85 -0
  269. package/node_modules/@engenty/wizards-shared/dist/runner-texts.d.ts +15 -1
  270. package/node_modules/@engenty/wizards-shared/dist/runner-texts.js +14 -0
  271. package/node_modules/@engenty/wizards-shared/dist/rwx.d.ts +42 -0
  272. package/node_modules/@engenty/wizards-shared/dist/rwx.js +29 -0
  273. package/node_modules/@engenty/wizards-shared/dist/skills.d.ts +1 -1
  274. package/node_modules/@engenty/wizards-shared/dist/space-data.d.ts +2 -2
  275. package/node_modules/@engenty/wizards-shared/dist/{projects.d.ts → spaces.d.ts} +39 -15
  276. package/node_modules/@engenty/wizards-shared/dist/{projects.js → spaces.js} +16 -9
  277. package/node_modules/@engenty/wizards-shared/dist/store.d.ts +7 -2
  278. package/node_modules/@engenty/wizards-shared/dist/surface.d.ts +35 -4
  279. package/node_modules/@engenty/wizards-shared/dist/surface.js +121 -3
  280. package/node_modules/@engenty/wizards-shared/dist/sync.d.ts +1 -1
  281. package/node_modules/@engenty/wizards-shared/dist/theme-look.js +1 -1
  282. package/node_modules/@engenty/wizards-shared/dist/wizard-package.d.ts +2 -2
  283. package/node_modules/@engenty/wizards-shared/dist/wizard-package.js +3 -3
  284. package/package.json +4 -1
  285. package/plugin/.claude-plugin/plugin.json +1 -1
  286. package/plugin/plugin.json +1 -1
  287. package/plugin/skills/build-wizard/SKILL.md +1 -1
  288. package/apps/runtime/dist/services/projects.js +0 -473
  289. package/apps/web/dist/assets/AboutDialog-B-JxkELB.js +0 -1
  290. package/apps/web/dist/assets/EditorPage-DQ_2FOzI.js +0 -3
  291. package/apps/web/dist/assets/Marketplace-DoH4YO3D.js +0 -2
  292. package/apps/web/dist/assets/NewWizardChannels-Tgoexgj4.js +0 -1
  293. package/apps/web/dist/assets/NewWizardPage-B24AF482.js +0 -7
  294. package/apps/web/dist/assets/OnboardingPage-BEvq4slJ.js +0 -1
  295. package/apps/web/dist/assets/PreviewPane-B_v7Y8R7.js +0 -10
  296. package/apps/web/dist/assets/ProjectPage-ClRuhFJo.js +0 -10
  297. package/apps/web/dist/assets/PublicRunner-MicrpVsv.js +0 -1
  298. package/apps/web/dist/assets/ReadOnly-BXjv-MSv.js +0 -1
  299. package/apps/web/dist/assets/SettingsPage-DY8O1r43.js +0 -2
  300. package/apps/web/dist/assets/SetupPage-BOVkVpMu.js +0 -1
  301. package/apps/web/dist/assets/SharePage-DXGzJSnR.js +0 -1
  302. package/apps/web/dist/assets/SkillEditor-BzzTDeaU.js +0 -1
  303. package/apps/web/dist/assets/changelog-BLdS-0Bj.js +0 -1
  304. package/apps/web/dist/assets/esm-BdxDT9Km.js +0 -7
  305. package/apps/web/dist/assets/i18n-8-Sw11tB.js +0 -55
  306. package/apps/web/dist/assets/index-OsdQFHmh.js +0 -49
  307. package/apps/web/dist/assets/index-QPipX5Fi.css +0 -1
  308. package/apps/web/dist/assets/lock-C0uxcOlq.js +0 -1
  309. package/apps/web/dist/assets/logo-CGNoptDg.js +0 -1
  310. package/apps/web/dist/assets/oss-credits-DpRWUPjD.js +0 -1
  311. package/apps/web/dist/assets/session-BWI-KENJ.js +0 -2
  312. package/apps/web/dist/assets/theme-D7krsx0_.js +0 -11
  313. package/apps/web/dist/assets/ui-DSXG3f49.js +0 -83
@@ -1,5 +1,5 @@
1
- import { factKey, PROJECT_LIMITS } from "@engenty/wizards-shared/projects";
2
1
  import { note } from "@engenty/wizards-shared/run";
2
+ import { factKey, SPACE_LIMITS } from "@engenty/wizards-shared/spaces";
3
3
  import { nanoid } from "nanoid";
4
4
  import { z } from "zod";
5
5
  import { runStudioAssistant } from "../agents/studio-assistant.js";
@@ -8,14 +8,14 @@ import { errorText } from "../model-errors.js";
8
8
  import { prompt } from "../prompts.js";
9
9
  import { currentTenant } from "../tenants/tenant.js";
10
10
  import { serverText } from "../texts.js";
11
- import { projectWritable, requireWritable } from "./access.js";
11
+ import { requireWritable, spaceWritable } from "./access.js";
12
12
  import { apiSpace, apiSpaceDetails } from "./api.js";
13
13
  import { openChat, turnHistory } from "./assistant-chats.js";
14
14
  import { mainLogoId } from "./brand.js";
15
15
  import { ServiceError } from "./errors.js";
16
- import { addProjectFile } from "./project-files.js";
17
- import { brandColorSchema, ownedProject, updateProject } from "./projects.js";
18
16
  import { listOrigin, putOriginPage, removeOrigin } from "./space-data.js";
17
+ import { addSpaceFile } from "./space-files.js";
18
+ import { brandColorSchema, ownedSpace, updateSpace } from "./spaces.js";
19
19
  /*
20
20
  * A website reads itself into a space: the WordPress plugin sends what the site says about
21
21
  * itself (name, tagline, logo, the theme's colours, contact details) and its pages as text. The
@@ -36,7 +36,7 @@ export const siteSchema = z.object({
36
36
  .array(z.object({ label: z.string().min(1).max(80), value: z.string().min(1).max(4000) }))
37
37
  .max(40)
38
38
  .default([]),
39
- colors: z.array(brandColorSchema).max(PROJECT_LIMITS.colors).default([]),
39
+ colors: z.array(brandColorSchema).max(SPACE_LIMITS.colors).default([]),
40
40
  logo: z
41
41
  .object({
42
42
  name: z.string().max(200),
@@ -72,15 +72,15 @@ function forget() {
72
72
  }
73
73
  }
74
74
  /** What the site states, written where the space has nothing yet; the admin's own stays. */
75
- async function fillFromSite(userId, projectId, input) {
76
- const p = await ownedProject(userId, projectId);
75
+ async function fillFromSite(userId, spaceId, input) {
76
+ const p = await ownedSpace(userId, spaceId);
77
77
  const facts = [...p.facts];
78
78
  for (const f of input.facts) {
79
79
  const label = f.label.trim();
80
80
  if (facts.some((x) => x.label.toLowerCase() === label.toLowerCase())) {
81
81
  continue;
82
82
  }
83
- if (facts.length >= PROJECT_LIMITS.facts) {
83
+ if (facts.length >= SPACE_LIMITS.facts) {
84
84
  break;
85
85
  }
86
86
  facts.push({
@@ -90,14 +90,14 @@ async function fillFromSite(userId, projectId, input) {
90
90
  });
91
91
  }
92
92
  const website = facts.some((x) => /^(website|webseite)$/i.test(x.label));
93
- if (!website && facts.length < PROJECT_LIMITS.facts) {
93
+ if (!website && facts.length < SPACE_LIMITS.facts) {
94
94
  facts.push({
95
95
  key: factKey("Website", facts.map((x) => x.key)),
96
96
  label: "Website",
97
97
  value: input.url,
98
98
  });
99
99
  }
100
- await updateProject(userId, projectId, {
100
+ await updateSpace(userId, spaceId, {
101
101
  brand: {
102
102
  ...(p.brand.name ? {} : input.name ? { name: input.name } : {}),
103
103
  ...(p.brand.about ? {} : input.tagline ? { about: input.tagline } : {}),
@@ -107,8 +107,8 @@ async function fillFromSite(userId, projectId, input) {
107
107
  },
108
108
  facts,
109
109
  });
110
- if (input.logo && !(await mainLogoId(projectId))) {
111
- await addProjectFile(projectId, {
110
+ if (input.logo && !(await mainLogoId(spaceId))) {
111
+ await addSpaceFile(spaceId, {
112
112
  kind: "logo",
113
113
  name: input.logo.name,
114
114
  mime: input.logo.mime,
@@ -119,7 +119,7 @@ async function fillFromSite(userId, projectId, input) {
119
119
  }
120
120
  }
121
121
  /** The site's pages as Knowledge: the same page again rewrites, a page gone from the site goes. */
122
- async function writePages(projectId, input) {
122
+ async function writePages(spaceId, input) {
123
123
  const keys = new Set();
124
124
  for (const page of input.pages) {
125
125
  if (!page.markdown.trim()) {
@@ -127,16 +127,16 @@ async function writePages(projectId, input) {
127
127
  }
128
128
  keys.add(page.key);
129
129
  await putOriginPage(SITE_ORIGIN, {
130
- space: projectId,
130
+ space: spaceId,
131
131
  key: page.key,
132
132
  label: page.url ?? null,
133
133
  title: page.title || page.url || "Seite",
134
134
  markdown: page.url ? `Quelle: ${page.url}\n\n${page.markdown}` : page.markdown,
135
135
  });
136
136
  }
137
- for (const item of await listOrigin(SITE_ORIGIN, projectId)) {
137
+ for (const item of await listOrigin(SITE_ORIGIN, spaceId)) {
138
138
  if (item.kind === "page" && !keys.has(item.key)) {
139
- await removeOrigin(SITE_ORIGIN, projectId, item.key);
139
+ await removeOrigin(SITE_ORIGIN, spaceId, item.key);
140
140
  }
141
141
  }
142
142
  return keys.size;
@@ -166,24 +166,24 @@ function assistMessage(input) {
166
166
  .join("\n\n")
167
167
  .slice(0, 7900);
168
168
  }
169
- async function work(job, projectId, input) {
169
+ async function work(job, spaceId, input) {
170
170
  try {
171
171
  const lang = siteLang(input);
172
172
  job.activity = serverText(lang, "siteTakingOver");
173
- await fillFromSite(job.userId, projectId, input);
173
+ await fillFromSite(job.userId, spaceId, input);
174
174
  job.activity = serverText(lang, "siteWritingPages");
175
- job.pages = await writePages(projectId, input);
175
+ job.pages = await writePages(spaceId, input);
176
176
  if (input.assist && (await canSpend())) {
177
177
  job.activity = serverText(lang, "siteReading");
178
- const project = await ownedProject(job.userId, projectId);
178
+ const space = await ownedSpace(job.userId, spaceId);
179
179
  // The person's open assistant chat gives the context; the turn is not stored in it.
180
180
  const chat = await openChat(job.user);
181
181
  const result = await runStudioAssistant({
182
182
  user: job.user,
183
183
  chat,
184
184
  history: await turnHistory(job.user, chat),
185
- project,
186
- writable: await projectWritable(project),
185
+ space,
186
+ writable: await spaceWritable(space),
187
187
  message: assistMessage(input),
188
188
  page: null,
189
189
  browserTools: [],
@@ -200,7 +200,7 @@ async function work(job, projectId, input) {
200
200
  });
201
201
  job.reply = result?.reply ?? "";
202
202
  }
203
- job.space = await apiSpaceDetails(job.userId, projectId);
203
+ job.space = await apiSpaceDetails(job.userId, spaceId);
204
204
  job.status = "done";
205
205
  job.activity = "";
206
206
  }
@@ -2,10 +2,10 @@ import { byteLength, officialSkill, SKILL_REF, } from "@engenty/wizards-shared/s
2
2
  import { and, eq, isNotNull } from "drizzle-orm";
3
3
  import { z } from "zod";
4
4
  import { db, schema } from "../db/client.js";
5
- import { requireWritableProject } from "./access.js";
5
+ import { requireWritableSpace } from "./access.js";
6
6
  import { notFound, ServiceError } from "./errors.js";
7
- import { ownedProject } from "./projects.js";
8
7
  import { asText, blobBytes, checkAlways, checkContent, contentHash, contentOf, insertSkill, keepBlobs, requireSkills, skillBytes, skillRow, } from "./skills.js";
8
+ import { ownedSpace } from "./spaces.js";
9
9
  /**
10
10
  * skills.sh, the open directory of skills (docs/plans/skills.md): its search, and a skill read
11
11
  * whole from its registry address `/r/<owner>/<repo>/<skill>`, which hands out the `SKILL.md`
@@ -58,9 +58,9 @@ const searchAnswer = z.object({
58
58
  .default([]),
59
59
  });
60
60
  /** Skills on skills.sh for a few words, the space's own marked as added. */
61
- export async function searchSkills(userId, projectId, query) {
61
+ export async function searchSkills(userId, spaceId, query) {
62
62
  await requireSkills();
63
- const project = await ownedProject(userId, projectId);
63
+ const space = await ownedSpace(userId, spaceId);
64
64
  const q = query.trim();
65
65
  if (q.length < 2) {
66
66
  return { hits: [] };
@@ -72,7 +72,7 @@ export async function searchSkills(userId, projectId, query) {
72
72
  const added = new Set((await db
73
73
  .select({ origin: schema.spaceSkill.origin })
74
74
  .from(schema.spaceSkill)
75
- .where(and(eq(schema.spaceSkill.projectId, project.id), isNotNull(schema.spaceSkill.origin)))).map((r) => r.origin));
75
+ .where(and(eq(schema.spaceSkill.spaceId, space.id), isNotNull(schema.spaceSkill.origin)))).map((r) => r.origin));
76
76
  const hits = answer.data.skills
77
77
  .filter((s) => SKILL_REF.test(s.id))
78
78
  .map((s) => ({
@@ -115,9 +115,9 @@ export async function readRegistrySkill(ref) {
115
115
  return { ...read, hash: contentHash(read.content) };
116
116
  }
117
117
  /** A skill of skills.sh to look at before it is added: everything it would bring. */
118
- export async function previewSkill(userId, projectId, ref) {
118
+ export async function previewSkill(userId, spaceId, ref) {
119
119
  await requireSkills();
120
- await ownedProject(userId, projectId);
120
+ await ownedSpace(userId, spaceId);
121
121
  const read = await readRegistrySkill(ref);
122
122
  const preview = {
123
123
  ref,
@@ -137,13 +137,13 @@ export async function previewSkill(userId, projectId, ref) {
137
137
  return preview;
138
138
  }
139
139
  /** Adds a skill of skills.sh to the space, as it is there now. */
140
- export async function addRegistrySkill(userId, projectId, input) {
140
+ export async function addRegistrySkill(userId, spaceId, input) {
141
141
  await requireSkills();
142
- const project = await ownedProject(userId, projectId);
143
- await requireWritableProject(project.id);
142
+ const space = await ownedSpace(userId, spaceId);
143
+ await requireWritableSpace(space.id);
144
144
  const read = await readRegistrySkill(input.ref);
145
145
  await keepBlobs(read.blobs);
146
- return insertSkill(project.id, read.content, {
146
+ return insertSkill(space.id, read.content, {
147
147
  source: "skills.sh",
148
148
  mode: input.mode,
149
149
  origin: input.ref,
@@ -158,7 +158,7 @@ export async function skillUpdate(userId, id) {
158
158
  if (!row.origin || row.source !== "skills.sh") {
159
159
  throw notFound();
160
160
  }
161
- await ownedProject(userId, row.projectId);
161
+ await ownedSpace(userId, row.spaceId);
162
162
  const read = await readRegistrySkill(row.origin);
163
163
  if (read.hash === row.originHash) {
164
164
  return { update: null };
@@ -183,15 +183,15 @@ export async function applySkillUpdate(userId, id, hash) {
183
183
  if (!row.origin || row.source !== "skills.sh") {
184
184
  throw notFound();
185
185
  }
186
- await ownedProject(userId, row.projectId);
187
- await requireWritableProject(row.projectId);
186
+ await ownedSpace(userId, row.spaceId);
187
+ await requireWritableSpace(row.spaceId);
188
188
  const read = await readRegistrySkill(row.origin);
189
189
  // Taken only as it was shown: a change since the person looked is shown first.
190
190
  if (read.hash !== hash) {
191
191
  throw new ServiceError("revision_conflict", { server: "skillUpdateChanged" });
192
192
  }
193
193
  const next = checkContent({ ...read.content, name: row.name });
194
- await checkAlways(row.projectId, row.id, row.mode, next.body);
194
+ await checkAlways(row.spaceId, row.id, row.mode, next.body);
195
195
  await keepBlobs(read.blobs);
196
196
  await db
197
197
  .update(schema.spaceSkill)
@@ -8,9 +8,9 @@ import { db, schema } from "../db/client.js";
8
8
  import { currentFeatures } from "../features.js";
9
9
  import { getBlob, putBlob } from "../files/blobs.js";
10
10
  import { currentTenant } from "../tenants/tenant.js";
11
- import { projectWritable, requireWritableProject } from "./access.js";
11
+ import { requireWritableSpace, spaceWritable } from "./access.js";
12
12
  import { notFound, ServiceError } from "./errors.js";
13
- import { ownedProject } from "./projects.js";
13
+ import { ownedSpace } from "./spaces.js";
14
14
  const refuse = (server, params) => new ServiceError("invalid", { server, params });
15
15
  export async function skillsOn() {
16
16
  return featureOn(await currentFeatures(), "skills");
@@ -83,22 +83,22 @@ export function checkContent(c) {
83
83
  }
84
84
  return out;
85
85
  }
86
- async function nameTaken(projectId, name, except) {
86
+ async function nameTaken(spaceId, name, except) {
87
87
  const row = await db.query.spaceSkill.findFirst({
88
- where: and(eq(schema.spaceSkill.projectId, projectId), eq(schema.spaceSkill.name, name), ...(except ? [ne(schema.spaceSkill.id, except)] : [])),
88
+ where: and(eq(schema.spaceSkill.spaceId, spaceId), eq(schema.spaceSkill.name, name), ...(except ? [ne(schema.spaceSkill.id, except)] : [])),
89
89
  columns: { id: true },
90
90
  });
91
91
  return Boolean(row);
92
92
  }
93
93
  /** A name not yet taken in the space: the name itself, else with `-2`, `-3` … */
94
- async function freeName(projectId, name) {
95
- if (!(await nameTaken(projectId, name))) {
94
+ async function freeName(spaceId, name) {
95
+ if (!(await nameTaken(spaceId, name))) {
96
96
  return name;
97
97
  }
98
98
  for (let n = 2; n < 1000; n++) {
99
99
  const suffix = `-${n}`;
100
100
  const next = `${name.slice(0, SKILL_LIMITS.name - suffix.length).replace(/-+$/, "")}${suffix}`;
101
- if (!(await nameTaken(projectId, next))) {
101
+ if (!(await nameTaken(spaceId, next))) {
102
102
  return next;
103
103
  }
104
104
  }
@@ -110,14 +110,14 @@ async function freeName(projectId, name) {
110
110
  * At most five skills always on, their instructions 20,000 characters together: each of them
111
111
  * is in every AI step of the space.
112
112
  */
113
- export async function checkAlways(projectId, id, mode, body) {
113
+ export async function checkAlways(spaceId, id, mode, body) {
114
114
  if (mode !== "always") {
115
115
  return;
116
116
  }
117
117
  const others = await db
118
118
  .select({ id: schema.spaceSkill.id, body: schema.spaceSkill.body })
119
119
  .from(schema.spaceSkill)
120
- .where(and(eq(schema.spaceSkill.projectId, projectId), eq(schema.spaceSkill.mode, "always")));
120
+ .where(and(eq(schema.spaceSkill.spaceId, spaceId), eq(schema.spaceSkill.mode, "always")));
121
121
  const rest = others.filter((o) => o.id !== id);
122
122
  if (rest.length + 1 > SKILL_LIMITS.always) {
123
123
  throw refuse("skillsAlwaysCount");
@@ -152,28 +152,28 @@ export async function skillRow(id) {
152
152
  }
153
153
  return row;
154
154
  }
155
- export async function listSkills(userId, projectId) {
155
+ export async function listSkills(userId, spaceId) {
156
156
  await requireSkills();
157
- const project = await ownedProject(userId, projectId);
157
+ const space = await ownedSpace(userId, spaceId);
158
158
  const rows = await db.query.spaceSkill.findMany({
159
- where: eq(schema.spaceSkill.projectId, project.id),
159
+ where: eq(schema.spaceSkill.spaceId, space.id),
160
160
  orderBy: [asc(schema.spaceSkill.name)],
161
161
  });
162
- return { skills: rows.map(summaryOf), readOnly: !(await projectWritable(project)) };
162
+ return { skills: rows.map(summaryOf), readOnly: !(await spaceWritable(space)) };
163
163
  }
164
164
  export async function getSkill(userId, id) {
165
165
  await requireSkills();
166
166
  const row = await skillRow(id);
167
- const project = await ownedProject(userId, row.projectId);
167
+ const space = await ownedSpace(userId, row.spaceId);
168
168
  return {
169
169
  ...summaryOf(row),
170
- projectId: row.projectId,
170
+ spaceId: row.spaceId,
171
171
  body: row.body,
172
172
  meta: row.meta,
173
173
  fileList: row.files,
174
174
  blobList: row.blobFiles,
175
175
  originHash: row.originHash,
176
- readOnly: !(await projectWritable(project)),
176
+ readOnly: !(await spaceWritable(space)),
177
177
  };
178
178
  }
179
179
  // --- writes ---------------------------------------------------------------------------------
@@ -196,26 +196,26 @@ export async function keepBlobs(blobs) {
196
196
  }
197
197
  }
198
198
  /** Puts a new skill into the space; its name is the one given, or the next free one. */
199
- export async function insertSkill(projectId, content, options) {
199
+ export async function insertSkill(spaceId, content, options) {
200
200
  const checked = checkContent(content);
201
201
  const [{ n }] = await db
202
202
  .select({ n: count() })
203
203
  .from(schema.spaceSkill)
204
- .where(eq(schema.spaceSkill.projectId, projectId));
204
+ .where(eq(schema.spaceSkill.spaceId, spaceId));
205
205
  if (n >= SKILL_LIMITS.perSpace) {
206
206
  throw refuse("skillsTooMany");
207
207
  }
208
- const name = options.rename ? await freeName(projectId, checked.name) : checked.name;
209
- if (!options.rename && (await nameTaken(projectId, name))) {
208
+ const name = options.rename ? await freeName(spaceId, checked.name) : checked.name;
209
+ if (!options.rename && (await nameTaken(spaceId, name))) {
210
210
  throw refuse("skillNameTaken", { name });
211
211
  }
212
212
  const mode = options.mode ?? "demand";
213
- await checkAlways(projectId, null, mode, checked.body);
213
+ await checkAlways(spaceId, null, mode, checked.body);
214
214
  const id = nanoid(12);
215
215
  await db.insert(schema.spaceSkill).values({
216
216
  id,
217
217
  tenantId: currentTenant(),
218
- projectId,
218
+ spaceId,
219
219
  name,
220
220
  description: checked.description,
221
221
  body: checked.body,
@@ -230,11 +230,11 @@ export async function insertSkill(projectId, content, options) {
230
230
  return { id, name };
231
231
  }
232
232
  /** A skill written in the studio: a name, a description and a first heading. */
233
- export async function createSkill(userId, projectId, input) {
233
+ export async function createSkill(userId, spaceId, input) {
234
234
  await requireSkills();
235
- const project = await ownedProject(userId, projectId);
236
- await requireWritableProject(project.id);
237
- return insertSkill(project.id, {
235
+ const space = await ownedSpace(userId, spaceId);
236
+ await requireWritableSpace(space.id);
237
+ return insertSkill(space.id, {
238
238
  name: input.name,
239
239
  description: input.description,
240
240
  body: input.body ?? "",
@@ -250,8 +250,8 @@ export async function createSkill(userId, projectId, input) {
250
250
  export async function updateSkill(userId, id, patch) {
251
251
  await requireSkills();
252
252
  const row = await skillRow(id);
253
- await ownedProject(userId, row.projectId);
254
- await requireWritableProject(row.projectId);
253
+ await ownedSpace(userId, row.spaceId);
254
+ await requireWritableSpace(row.spaceId);
255
255
  const content = { ...patch };
256
256
  if (patch.skillMd !== undefined) {
257
257
  Object.assign(content, readSkillMd(patch.skillMd));
@@ -268,11 +268,11 @@ export async function updateSkill(userId, id, patch) {
268
268
  files: content.files ?? row.files,
269
269
  blobFiles: row.blobFiles,
270
270
  });
271
- if (next.name !== row.name && (await nameTaken(row.projectId, next.name, row.id))) {
271
+ if (next.name !== row.name && (await nameTaken(row.spaceId, next.name, row.id))) {
272
272
  throw refuse("skillNameTaken", { name: next.name });
273
273
  }
274
274
  const mode = patch.mode ?? row.mode;
275
- await checkAlways(row.projectId, row.id, mode, next.body);
275
+ await checkAlways(row.spaceId, row.id, mode, next.body);
276
276
  await db
277
277
  .update(schema.spaceSkill)
278
278
  .set({ ...next, mode, runScripts: patch.runScripts ?? row.runScripts, updatedAt: new Date() })
@@ -282,8 +282,8 @@ export async function updateSkill(userId, id, patch) {
282
282
  export async function deleteSkill(userId, id) {
283
283
  await requireSkills();
284
284
  const row = await skillRow(id);
285
- await ownedProject(userId, row.projectId);
286
- await requireWritableProject(row.projectId);
285
+ await ownedSpace(userId, row.spaceId);
286
+ await requireWritableSpace(row.spaceId);
287
287
  await db.delete(schema.spaceSkill).where(eq(schema.spaceSkill.id, row.id));
288
288
  }
289
289
  /**
@@ -293,9 +293,9 @@ export async function deleteSkill(userId, id) {
293
293
  export async function copySkill(userId, id) {
294
294
  await requireSkills();
295
295
  const row = await skillRow(id);
296
- await ownedProject(userId, row.projectId);
297
- await requireWritableProject(row.projectId);
298
- return insertSkill(row.projectId, {
296
+ await ownedSpace(userId, row.spaceId);
297
+ await requireWritableSpace(row.spaceId);
298
+ return insertSkill(row.spaceId, {
299
299
  name: row.name,
300
300
  description: row.description,
301
301
  body: row.body,
@@ -409,10 +409,10 @@ export function unpackSkill(data) {
409
409
  })));
410
410
  }
411
411
  /** An uploaded `SKILL.md`, `.zip` or `.skill`, as a skill of the space. */
412
- export async function uploadSkill(userId, projectId, file) {
412
+ export async function uploadSkill(userId, spaceId, file) {
413
413
  await requireSkills();
414
- const project = await ownedProject(userId, projectId);
415
- await requireWritableProject(project.id);
414
+ const space = await ownedSpace(userId, spaceId);
415
+ await requireWritableSpace(space.id);
416
416
  const lower = file.name.toLowerCase();
417
417
  let read;
418
418
  if (lower.endsWith(".zip") || lower.endsWith(".skill")) {
@@ -429,14 +429,14 @@ export async function uploadSkill(userId, projectId, file) {
429
429
  throw refuse("skillUploadKind");
430
430
  }
431
431
  await keepBlobs(read.blobs);
432
- const made = await insertSkill(project.id, read.content, { source: "upload", rename: true });
432
+ const made = await insertSkill(space.id, read.content, { source: "upload", rename: true });
433
433
  return { ...made, skipped: read.skipped };
434
434
  }
435
435
  /** A skill as a zip: its folder, named by the skill, as other tools take it. */
436
436
  export async function skillZip(userId, id) {
437
437
  await requireSkills();
438
438
  const row = await skillRow(id);
439
- await ownedProject(userId, row.projectId);
439
+ await ownedSpace(userId, row.spaceId);
440
440
  const enc = new TextEncoder();
441
441
  const files = {
442
442
  [`${row.name}/SKILL.md`]: enc.encode(skillMd(row)),
@@ -451,7 +451,7 @@ export async function skillZip(userId, id) {
451
451
  }
452
452
  // --- for steps and Goose ----------------------------------------------------------------------
453
453
  /** Every skill of the space, off ones too, by name: what Goose is told the space has. */
454
- export async function skillList(projectId) {
454
+ export async function skillList(spaceId) {
455
455
  return db
456
456
  .select({
457
457
  name: schema.spaceSkill.name,
@@ -459,16 +459,16 @@ export async function skillList(projectId) {
459
459
  mode: schema.spaceSkill.mode,
460
460
  })
461
461
  .from(schema.spaceSkill)
462
- .where(eq(schema.spaceSkill.projectId, projectId))
462
+ .where(eq(schema.spaceSkill.spaceId, spaceId))
463
463
  .orderBy(asc(schema.spaceSkill.name));
464
464
  }
465
465
  /** The space's skills that count, by mode: none while the switch is off. */
466
- export async function activeSkills(projectId) {
466
+ export async function activeSkills(spaceId) {
467
467
  if (!(await skillsOn())) {
468
468
  return { always: [], demand: [] };
469
469
  }
470
470
  const rows = await db.query.spaceSkill.findMany({
471
- where: and(eq(schema.spaceSkill.projectId, projectId), ne(schema.spaceSkill.mode, "off")),
471
+ where: and(eq(schema.spaceSkill.spaceId, spaceId), ne(schema.spaceSkill.mode, "off")),
472
472
  orderBy: [asc(schema.spaceSkill.name)],
473
473
  });
474
474
  return {