@engenty/wizards-runtime 0.12.2 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) hide show
  1. package/apps/runtime/dist/agents/architect.js +8 -7
  2. package/apps/runtime/dist/agents/goose-connections.js +82 -0
  3. package/apps/runtime/dist/agents/space-agent.js +9 -2
  4. package/apps/runtime/dist/agents/studio-assistant.js +126 -71
  5. package/apps/runtime/dist/agents/website.js +1 -1
  6. package/apps/runtime/dist/app.js +28 -3
  7. package/apps/runtime/dist/assistant/knows.js +6 -5
  8. package/apps/runtime/dist/authoring/guide.js +25 -5
  9. package/apps/runtime/dist/broker/account.js +166 -0
  10. package/apps/runtime/dist/broker/call.js +417 -0
  11. package/apps/runtime/dist/broker/caller.js +10 -0
  12. package/apps/runtime/dist/broker/grant.js +152 -0
  13. package/apps/runtime/dist/broker/host.js +51 -0
  14. package/apps/runtime/dist/broker/index.js +8 -0
  15. package/apps/runtime/dist/broker/kept.js +31 -0
  16. package/apps/runtime/dist/broker/log.js +240 -0
  17. package/apps/runtime/dist/broker/registry.js +9 -0
  18. package/apps/runtime/dist/broker/rwx.js +367 -0
  19. package/apps/runtime/dist/broker/send.js +189 -0
  20. package/apps/runtime/dist/connectors/builtin.js +1 -1
  21. package/apps/runtime/dist/connectors/external.js +38 -37
  22. package/apps/runtime/dist/connectors/index.js +30 -91
  23. package/apps/runtime/dist/connectors/mail.js +0 -8
  24. package/apps/runtime/dist/connectors/person-sign-ins.js +73 -0
  25. package/apps/runtime/dist/connectors/plugin-connections.js +65 -92
  26. package/apps/runtime/dist/connectors/smtp.js +1 -1
  27. package/apps/runtime/dist/connectors/space-connections.js +436 -0
  28. package/apps/runtime/dist/credits/estimate.js +3 -3
  29. package/apps/runtime/dist/db/adopt.js +3 -3
  30. package/apps/runtime/dist/db/client.js +9 -0
  31. package/apps/runtime/dist/db/live-triggers.js +65 -23
  32. package/apps/runtime/dist/db/migrations/tenant/0027_work_chats.sql +52 -0
  33. package/apps/runtime/dist/db/migrations/tenant/0028_chat_approvals.sql +17 -0
  34. package/apps/runtime/dist/db/migrations/tenant/0029_work_chats_live.sql +49 -0
  35. package/apps/runtime/dist/db/migrations/tenant/0031_space.sql +624 -0
  36. package/apps/runtime/dist/db/migrations/tenant/0032_rwx_rule.sql +18 -0
  37. package/apps/runtime/dist/db/migrations/tenant/0033_broker_log.sql +23 -0
  38. package/apps/runtime/dist/db/migrations/tenant/0034_space_connection.sql +35 -0
  39. package/apps/runtime/dist/db/migrations/tenant/0035_run_grant.sql +1 -0
  40. package/apps/runtime/dist/db/migrations/tenant/0036_approval_held_for.sql +1 -0
  41. package/apps/runtime/dist/db/migrations/tenant/0037_ways_out.sql +5 -0
  42. package/apps/runtime/dist/db/migrations/tenant/0038_heard.sql +11 -0
  43. package/apps/runtime/dist/db/migrations/tenant/0039_members_studio.sql +1 -0
  44. package/apps/runtime/dist/db/migrations/tenant/meta/0027_snapshot.json +383 -155
  45. package/apps/runtime/dist/db/migrations/tenant/meta/0028_snapshot.json +4468 -0
  46. package/apps/runtime/dist/db/migrations/tenant/meta/0029_snapshot.json +4475 -0
  47. package/apps/runtime/dist/db/migrations/tenant/meta/0030_snapshot.json +4629 -0
  48. package/apps/runtime/dist/db/migrations/tenant/meta/0031_snapshot.json +4629 -0
  49. package/apps/runtime/dist/db/migrations/tenant/meta/0032_snapshot.json +4757 -0
  50. package/apps/runtime/dist/db/migrations/tenant/meta/0033_snapshot.json +5039 -0
  51. package/apps/runtime/dist/db/migrations/tenant/meta/0034_snapshot.json +5022 -0
  52. package/apps/runtime/dist/db/migrations/tenant/meta/0035_snapshot.json +5029 -0
  53. package/apps/runtime/dist/db/migrations/tenant/meta/0036_snapshot.json +5037 -0
  54. package/apps/runtime/dist/db/migrations/tenant/meta/0037_snapshot.json +5076 -0
  55. package/apps/runtime/dist/db/migrations/tenant/meta/0038_snapshot.json +5145 -0
  56. package/apps/runtime/dist/db/migrations/tenant/meta/0039_snapshot.json +5153 -0
  57. package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +86 -2
  58. package/apps/runtime/dist/db/schema.js +295 -72
  59. package/apps/runtime/dist/docs/dev/architecture.md +215 -0
  60. package/apps/runtime/dist/docs/dev/broker.md +298 -0
  61. package/apps/runtime/dist/docs/dev/index.md +5 -1
  62. package/apps/runtime/dist/docs/dev/integration/index.md +2 -0
  63. package/apps/runtime/dist/docs/dev/meta.json +3 -0
  64. package/apps/runtime/dist/docs/dev/plugins/connections.md +8 -5
  65. package/apps/runtime/dist/docs/dev/plugins/events.md +1 -1
  66. package/apps/runtime/dist/docs/dev/plugins/examples.md +1 -0
  67. package/apps/runtime/dist/docs/dev/plugins/index.md +2 -2
  68. package/apps/runtime/dist/docs/dev/plugins/reference.md +3 -2
  69. package/apps/runtime/dist/docs/dev/plugins/space.md +16 -6
  70. package/apps/runtime/dist/docs/dev/plugins/studio.md +2 -2
  71. package/apps/runtime/dist/docs/dev/plugins/tools.md +0 -1
  72. package/apps/runtime/dist/docs/dev/skills.md +16 -9
  73. package/apps/runtime/dist/docs/dev/wizard-format/agent-steps.md +59 -6
  74. package/apps/runtime/dist/docs/dev/wizard-format/lists-and-connections.md +17 -2
  75. package/apps/runtime/dist/docs/dev/wizard-format/templates.md +2 -0
  76. package/apps/runtime/dist/docs/dev/wizard-format/views-and-widgets.md +22 -2
  77. package/apps/runtime/dist/docs/user-guide/capabilities.md +132 -0
  78. package/apps/runtime/dist/docs/user-guide/cloud-sync.md +2 -0
  79. package/apps/runtime/dist/docs/user-guide/command-line.md +1 -0
  80. package/apps/runtime/dist/docs/user-guide/connectors.md +63 -7
  81. package/apps/runtime/dist/docs/user-guide/index.md +10 -1
  82. package/apps/runtime/dist/docs/user-guide/meta.json +6 -1
  83. package/apps/runtime/dist/docs/user-guide/models.md +105 -30
  84. package/apps/runtime/dist/docs/user-guide/protocol.md +80 -0
  85. package/apps/runtime/dist/docs/user-guide/skills.md +8 -4
  86. package/apps/runtime/dist/docs/user-guide/space.md +5 -4
  87. package/apps/runtime/dist/docs/user-guide/together.md +29 -2
  88. package/apps/runtime/dist/docs/user-guide/troubleshooting.md +2 -2
  89. package/apps/runtime/dist/docs/user-guide/work-mode.md +128 -0
  90. package/apps/runtime/dist/engenty/connections-external/build-connector.js +2 -5
  91. package/apps/runtime/dist/engenty/connections-external/importer/classify.js +72 -0
  92. package/apps/runtime/dist/engenty/connections-google/connectors/gmail.js +1 -1
  93. package/apps/runtime/dist/engenty/connections-microsoft/outlook.js +3 -2
  94. package/apps/runtime/dist/engenty/connections-sdk/types.js +2 -0
  95. package/apps/runtime/dist/engenty/connections-slack/connector.js +2 -1
  96. package/apps/runtime/dist/engine/decide.js +1 -1
  97. package/apps/runtime/dist/engine/requirements.js +139 -11
  98. package/apps/runtime/dist/engine/resources.js +43 -12
  99. package/apps/runtime/dist/engine/runner.js +121 -27
  100. package/apps/runtime/dist/engine/steps.js +42 -16
  101. package/apps/runtime/dist/engine/template.js +35 -1
  102. package/apps/runtime/dist/env.js +9 -4
  103. package/apps/runtime/dist/index.js +18 -2
  104. package/apps/runtime/dist/link-preview.js +9 -0
  105. package/apps/runtime/dist/live/feed.js +2 -2
  106. package/apps/runtime/dist/live/origin.js +2 -2
  107. package/apps/runtime/dist/live/views.js +51 -26
  108. package/apps/runtime/dist/manage.js +32 -0
  109. package/apps/runtime/dist/mcp/flow-app.js +1 -1
  110. package/apps/runtime/dist/mcp/handler.js +55 -1
  111. package/apps/runtime/dist/mcp/seen.js +47 -0
  112. package/apps/runtime/dist/mcp/tools.js +75 -34
  113. package/apps/runtime/dist/models.js +203 -12
  114. package/apps/runtime/dist/motion-graphics/project.js +8 -8
  115. package/apps/runtime/dist/motion-graphics/step.js +2 -2
  116. package/apps/runtime/dist/motion-graphics/tools.js +1 -1
  117. package/apps/runtime/dist/plugins/events.js +2 -2
  118. package/apps/runtime/dist/plugins/jobs.js +4 -1
  119. package/apps/runtime/dist/plugins/loader.js +2 -2
  120. package/apps/runtime/dist/prompts/architect.md +3 -3
  121. package/apps/runtime/dist/prompts/authoring.md +46 -12
  122. package/apps/runtime/dist/prompts/goose.md +14 -13
  123. package/apps/runtime/dist/prompts/mcp.md +6 -6
  124. package/apps/runtime/dist/prompts/safety.md +18 -0
  125. package/apps/runtime/dist/prompts/services.md +4 -4
  126. package/apps/runtime/dist/prompts/step.md +3 -3
  127. package/apps/runtime/dist/prompts/tools.md +39 -10
  128. package/apps/runtime/dist/routes/api.js +31 -20
  129. package/apps/runtime/dist/routes/broker.js +316 -0
  130. package/apps/runtime/dist/routes/connections.js +71 -0
  131. package/apps/runtime/dist/routes/delivery.js +25 -0
  132. package/apps/runtime/dist/routes/discover.js +17 -0
  133. package/apps/runtime/dist/routes/live.js +11 -1
  134. package/apps/runtime/dist/routes/marketplace.js +3 -3
  135. package/apps/runtime/dist/routes/person.js +4 -1
  136. package/apps/runtime/dist/routes/plugins.js +3 -1
  137. package/apps/runtime/dist/routes/rules.js +26 -0
  138. package/apps/runtime/dist/routes/runs.js +59 -33
  139. package/apps/runtime/dist/routes/skills.js +6 -6
  140. package/apps/runtime/dist/routes/studio.js +256 -148
  141. package/apps/runtime/dist/routes/work.js +199 -0
  142. package/apps/runtime/dist/safety.js +60 -18
  143. package/apps/runtime/dist/sandbox/index.js +27 -0
  144. package/apps/runtime/dist/services/access.js +38 -17
  145. package/apps/runtime/dist/services/api.js +38 -13
  146. package/apps/runtime/dist/services/architect.js +3 -3
  147. package/apps/runtime/dist/services/assistant-chats.js +9 -1
  148. package/apps/runtime/dist/services/brand.js +12 -12
  149. package/apps/runtime/dist/services/broker-bell.js +69 -0
  150. package/apps/runtime/dist/services/broker-notify.js +127 -0
  151. package/apps/runtime/dist/services/client-steps.js +79 -0
  152. package/apps/runtime/dist/services/cloud.js +42 -42
  153. package/apps/runtime/dist/services/command-risk.js +51 -0
  154. package/apps/runtime/dist/services/discover.js +85 -0
  155. package/apps/runtime/dist/services/knowledge-model.js +13 -13
  156. package/apps/runtime/dist/services/knowledge.js +117 -80
  157. package/apps/runtime/dist/services/manage-reports.js +77 -7
  158. package/apps/runtime/dist/services/marketplace.js +7 -31
  159. package/apps/runtime/dist/services/members-studio.js +165 -0
  160. package/apps/runtime/dist/services/onboarding.js +22 -22
  161. package/apps/runtime/dist/services/package-file.js +1 -1
  162. package/apps/runtime/dist/services/package.js +22 -22
  163. package/apps/runtime/dist/services/pages.js +13 -9
  164. package/apps/runtime/dist/services/runs.js +4 -3
  165. package/apps/runtime/dist/services/seen.js +55 -0
  166. package/apps/runtime/dist/services/shares.js +28 -13
  167. package/apps/runtime/dist/services/site.js +23 -23
  168. package/apps/runtime/dist/services/skills-registry.js +15 -15
  169. package/apps/runtime/dist/services/skills.js +44 -44
  170. package/apps/runtime/dist/services/space-categories.js +35 -35
  171. package/apps/runtime/dist/services/space-data.js +130 -111
  172. package/apps/runtime/dist/services/{project-files.js → space-files.js} +84 -75
  173. package/apps/runtime/dist/services/{project-index.js → space-index.js} +116 -73
  174. package/apps/runtime/dist/services/space-origin.js +19 -11
  175. package/apps/runtime/dist/services/spaces.js +478 -598
  176. package/apps/runtime/dist/services/synced-spaces.js +668 -0
  177. package/apps/runtime/dist/services/themes.js +15 -15
  178. package/apps/runtime/dist/services/widgets.js +6 -6
  179. package/apps/runtime/dist/services/wizards.js +112 -38
  180. package/apps/runtime/dist/services/work-ai.js +257 -0
  181. package/apps/runtime/dist/services/work-approvals.js +104 -0
  182. package/apps/runtime/dist/services/work-chats.js +908 -0
  183. package/apps/runtime/dist/services/work-connections.js +90 -0
  184. package/apps/runtime/dist/services/work-files.js +85 -0
  185. package/apps/runtime/dist/services/work-mastra.js +73 -0
  186. package/apps/runtime/dist/services/work-sandbox.js +42 -0
  187. package/apps/runtime/dist/sharing/files.js +14 -4
  188. package/apps/runtime/dist/sharing/index.js +40 -39
  189. package/apps/runtime/dist/sharing/jobs.js +67 -17
  190. package/apps/runtime/dist/sharing/targets/connector.js +10 -6
  191. package/apps/runtime/dist/sharing/targets/email.js +10 -8
  192. package/apps/runtime/dist/sharing/targets/slack.js +10 -8
  193. package/apps/runtime/dist/sharing/targets/storage.js +6 -4
  194. package/apps/runtime/dist/store/index.js +14 -3
  195. package/apps/runtime/dist/store/shared-lists.js +4 -2
  196. package/apps/runtime/dist/sync/apply.js +2 -2
  197. package/apps/runtime/dist/sync/client.js +113 -113
  198. package/apps/runtime/dist/sync/hub.js +41 -41
  199. package/apps/runtime/dist/sync/log.js +12 -12
  200. package/apps/runtime/dist/sync/records.js +118 -120
  201. package/apps/runtime/dist/texts.js +44 -2
  202. package/apps/runtime/dist/tools/connections.js +112 -0
  203. package/apps/runtime/dist/tools/connector.js +157 -67
  204. package/apps/runtime/dist/tools/index.js +31 -15
  205. package/apps/runtime/dist/tools/mail.js +40 -11
  206. package/apps/runtime/dist/tools/pages.js +11 -5
  207. package/apps/runtime/dist/tools/plugin.js +43 -7
  208. package/apps/runtime/dist/tools/skills.js +1 -1
  209. package/apps/runtime/dist/tools/{project.js → space.js} +30 -25
  210. package/apps/runtime/dist/tools/store.js +3 -2
  211. package/apps/runtime/dist/widgets/step.js +10 -10
  212. package/apps/web/dist/assets/AboutDialog-DgfeipUc.js +1 -0
  213. package/apps/web/dist/assets/CapabilitiesPage-BoYJvgIu.js +2 -0
  214. package/apps/web/dist/assets/{ChangelogDialog-CKLgFL6r.js → ChangelogDialog-Duab4zTO.js} +1 -1
  215. package/apps/web/dist/assets/{CodeEditor-B3nto_26.js → CodeEditor-nxoOt8ge.js} +1 -1
  216. package/apps/web/dist/assets/EditorPage-ZrgGpYMC.js +3 -0
  217. package/apps/web/dist/assets/{FlowPreview-zJCtixSi.js → FlowPreview-aMfwcPul.js} +1 -1
  218. package/apps/web/dist/assets/LangSwitch-DpD0inR4.js +1 -0
  219. package/apps/web/dist/assets/Marketplace-CpzD9pNQ.js +2 -0
  220. package/apps/web/dist/assets/NewWizardChannels-IB18afWN.js +1 -0
  221. package/apps/web/dist/assets/NewWizardPage-rYbcmPGG.js +7 -0
  222. package/apps/web/dist/assets/OnboardingPage-ztHT01ah.js +1 -0
  223. package/apps/web/dist/assets/PreviewPane-DviWTLfi.js +9 -0
  224. package/apps/web/dist/assets/PublicRunner-C2geZhhM.js +1 -0
  225. package/apps/web/dist/assets/ReadOnly-kSb_Kbdm.js +1 -0
  226. package/apps/web/dist/assets/SettingsPage-DM2h8N0J.js +2 -0
  227. package/apps/web/dist/assets/SetupPage-Wfyz6xH4.js +1 -0
  228. package/apps/web/dist/assets/SharePage-CyWQorWB.js +1 -0
  229. package/apps/web/dist/assets/SkillEditor-CqQMg2MC.js +1 -0
  230. package/apps/web/dist/assets/Skills-CnhpgoOA.js +9 -0
  231. package/apps/web/dist/assets/SpacePage-q4Bk3N7k.js +2 -0
  232. package/apps/web/dist/assets/UpdateCheck-C2CE6CC3.js +2 -0
  233. package/apps/web/dist/assets/changelog-B6hN1Cp7.js +1 -0
  234. package/apps/web/dist/assets/circle-alert-C8Ma-bPY.js +1 -0
  235. package/apps/web/dist/assets/circle-check-Bu9Z3mlJ.js +1 -0
  236. package/apps/web/dist/assets/code-editor-CfTGqOpp.js +2 -0
  237. package/apps/web/dist/assets/{code-xml-Hx7YxCg0.js → code-xml-B4kLFZSj.js} +1 -1
  238. package/apps/web/dist/assets/connection-sign-in-CIiv0t2p.js +1 -0
  239. package/apps/web/dist/assets/esm-Xwn4GtqG.js +7 -0
  240. package/apps/web/dist/assets/{eye-BkMFLnYu.js → eye-BpoKpIdt.js} +1 -1
  241. package/apps/web/dist/assets/host-BrP-ENHg.css +1 -0
  242. package/apps/web/dist/assets/host-DJ7-p0Sc.js +118 -0
  243. package/apps/web/dist/assets/i18n-BJ7Ld6O6.js +55 -0
  244. package/apps/web/dist/assets/index-D18DvnxX.css +1 -0
  245. package/apps/web/dist/assets/index-D2akynS-.js +10 -0
  246. package/apps/web/dist/assets/logo-BpnjXTRy.js +1 -0
  247. package/apps/web/dist/assets/oss-credits-IdX5bc71.js +1 -0
  248. package/apps/web/dist/assets/{phone-DMfwuh9V.js → phone-Ctvf-Am-.js} +1 -1
  249. package/apps/web/dist/assets/read-aloud-Da_RSm2S.js +1 -0
  250. package/apps/web/dist/assets/{runners-D5qz6b_s.js → runners-CyIvJIHr.js} +1 -1
  251. package/apps/web/dist/assets/scroll-text-ChrjRu9Y.js +1 -0
  252. package/apps/web/dist/assets/session-SXPtTWRK.js +2 -0
  253. package/apps/web/dist/assets/theme-CbTcTFWy.js +11 -0
  254. package/apps/web/dist/assets/ui-Uqnx1UpK.js +82 -0
  255. package/apps/web/dist/assets/{upload-DQJwLSGj.js → upload-BchUnQGV.js} +1 -1
  256. package/apps/web/dist/assets/{useMutation-C20c2EH3.js → useMutation-DEkZhp5c.js} +1 -1
  257. package/apps/web/dist/assets/{volume-2-CC5qamYT.js → volume-2-CU_oy81Z.js} +1 -1
  258. package/apps/web/dist/assets/with-selector-CoMyWBAX.js +1 -0
  259. package/apps/web/dist/index.html +17 -10
  260. package/apps/web/dist/mcp/flow.html +119 -64
  261. package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +20 -10
  262. package/node_modules/@engenty/wizards-shared/dist/assistant.d.ts +7 -1
  263. package/node_modules/@engenty/wizards-shared/dist/assistant.js +11 -1
  264. package/node_modules/@engenty/wizards-shared/dist/connectors.d.ts +236 -2
  265. package/node_modules/@engenty/wizards-shared/dist/connectors.js +52 -2
  266. package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +257 -8
  267. package/node_modules/@engenty/wizards-shared/dist/definition.js +113 -15
  268. package/node_modules/@engenty/wizards-shared/dist/discover.d.ts +21 -0
  269. package/node_modules/@engenty/wizards-shared/dist/discover.js +1 -0
  270. package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +38 -2
  271. package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +38 -2
  272. package/node_modules/@engenty/wizards-shared/dist/fit.js +1 -1
  273. package/node_modules/@engenty/wizards-shared/dist/json-schema.d.ts +1 -1
  274. package/node_modules/@engenty/wizards-shared/dist/json-schema.js +1 -1
  275. package/node_modules/@engenty/wizards-shared/dist/live.d.ts +2 -2
  276. package/node_modules/@engenty/wizards-shared/dist/live.js +1 -1
  277. package/node_modules/@engenty/wizards-shared/dist/marketplace.d.ts +0 -5
  278. package/node_modules/@engenty/wizards-shared/dist/marketplace.js +3 -1
  279. package/node_modules/@engenty/wizards-shared/dist/run.d.ts +115 -6
  280. package/node_modules/@engenty/wizards-shared/dist/run.js +135 -0
  281. package/node_modules/@engenty/wizards-shared/dist/runner-texts.d.ts +15 -1
  282. package/node_modules/@engenty/wizards-shared/dist/runner-texts.js +14 -0
  283. package/node_modules/@engenty/wizards-shared/dist/rwx.d.ts +42 -0
  284. package/node_modules/@engenty/wizards-shared/dist/rwx.js +29 -0
  285. package/node_modules/@engenty/wizards-shared/dist/skills.d.ts +1 -1
  286. package/node_modules/@engenty/wizards-shared/dist/space-data.d.ts +2 -2
  287. package/node_modules/@engenty/wizards-shared/dist/{projects.d.ts → spaces.d.ts} +39 -15
  288. package/node_modules/@engenty/wizards-shared/dist/{projects.js → spaces.js} +16 -9
  289. package/node_modules/@engenty/wizards-shared/dist/store.d.ts +7 -2
  290. package/node_modules/@engenty/wizards-shared/dist/surface.d.ts +35 -4
  291. package/node_modules/@engenty/wizards-shared/dist/surface.js +121 -3
  292. package/node_modules/@engenty/wizards-shared/dist/sync.d.ts +1 -1
  293. package/node_modules/@engenty/wizards-shared/dist/theme-look.js +1 -1
  294. package/node_modules/@engenty/wizards-shared/dist/tiers.d.ts +195 -0
  295. package/node_modules/@engenty/wizards-shared/dist/tiers.js +98 -0
  296. package/node_modules/@engenty/wizards-shared/dist/wizard-package.d.ts +2 -2
  297. package/node_modules/@engenty/wizards-shared/dist/wizard-package.js +3 -3
  298. package/package.json +4 -1
  299. package/plugin/.claude-plugin/plugin.json +1 -1
  300. package/plugin/plugin.json +1 -1
  301. package/plugin/skills/build-wizard/SKILL.md +1 -1
  302. package/apps/runtime/dist/services/projects.js +0 -473
  303. package/apps/web/dist/assets/AboutDialog-CLgnoYTI.js +0 -1
  304. package/apps/web/dist/assets/EditorPage-D9JDdAAI.js +0 -3
  305. package/apps/web/dist/assets/Marketplace-D4e0Oac9.js +0 -2
  306. package/apps/web/dist/assets/NewWizardChannels-B4N7GIYh.js +0 -1
  307. package/apps/web/dist/assets/NewWizardPage-Dpt0Mzk8.js +0 -7
  308. package/apps/web/dist/assets/OnboardingPage-CDoYVjRC.js +0 -1
  309. package/apps/web/dist/assets/PreviewPane-DPB5nEd5.js +0 -10
  310. package/apps/web/dist/assets/ProjectPage-408YOoNa.js +0 -10
  311. package/apps/web/dist/assets/PublicRunner-BZ66xdRX.js +0 -1
  312. package/apps/web/dist/assets/ReadOnly-C9oGMkUB.js +0 -1
  313. package/apps/web/dist/assets/SettingsPage-Dq3AZwJS.js +0 -2
  314. package/apps/web/dist/assets/SetupPage-CP3lbyZc.js +0 -1
  315. package/apps/web/dist/assets/SharePage-DdMm1Y8K.js +0 -1
  316. package/apps/web/dist/assets/SkillEditor-b5NMFB90.js +0 -1
  317. package/apps/web/dist/assets/changelog-82-DHogQ.js +0 -1
  318. package/apps/web/dist/assets/esm-BdxDT9Km.js +0 -7
  319. package/apps/web/dist/assets/i18n-CKKh3Pn0.js +0 -55
  320. package/apps/web/dist/assets/index-Cy2NHzAx.js +0 -49
  321. package/apps/web/dist/assets/index-wR_-1hfN.css +0 -1
  322. package/apps/web/dist/assets/lock-CGXM95Mi.js +0 -1
  323. package/apps/web/dist/assets/logo-CGNoptDg.js +0 -1
  324. package/apps/web/dist/assets/oss-credits-DpRWUPjD.js +0 -1
  325. package/apps/web/dist/assets/session-DRy0k0nh.js +0 -2
  326. package/apps/web/dist/assets/theme-DNPm6r4e.js +0 -11
  327. package/apps/web/dist/assets/ui-CwFQAfE-.js +0 -83
  328. /package/apps/runtime/dist/db/migrations/tenant/{0027_space_skill.sql → 0030_space_skill.sql} +0 -0
@@ -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 {
@@ -5,9 +5,9 @@ import { and, asc, eq, inArray, isNotNull, or, sql } from "drizzle-orm";
5
5
  import { nanoid } from "nanoid";
6
6
  import { db, schema } from "../db/client.js";
7
7
  import { currentTenant } from "../tenants/tenant.js";
8
- import { requireWritableProject } from "./access.js";
8
+ import { requireWritableSpace } from "./access.js";
9
9
  import { notFound, ServiceError } from "./errors.js";
10
- import { queueIndex } from "./project-index.js";
10
+ import { queueIndex } from "./space-index.js";
11
11
  export function itemKey(ref) {
12
12
  if ("pageId" in ref) {
13
13
  return `p:${ref.pageId}`;
@@ -129,9 +129,9 @@ function cellOf(row, values) {
129
129
  return row.text;
130
130
  }
131
131
  // --- the categories of a space ---------------------------------------------------
132
- export async function categoryRows(projectId) {
132
+ export async function categoryRows(spaceId) {
133
133
  return db.query.spaceCategory.findMany({
134
- where: eq(schema.spaceCategory.projectId, projectId),
134
+ where: eq(schema.spaceCategory.spaceId, spaceId),
135
135
  orderBy: [asc(schema.spaceCategory.position), asc(schema.spaceCategory.name)],
136
136
  });
137
137
  }
@@ -168,8 +168,8 @@ function alike(a, b) {
168
168
  x.slice(i + 1) === y.slice(i));
169
169
  }
170
170
  /** The space's categories with their values, how many items have each, and their ranges. */
171
- export async function listCategories(projectId) {
172
- const rows = await categoryRows(projectId);
171
+ export async function listCategories(spaceId) {
172
+ const rows = await categoryRows(spaceId);
173
173
  if (!rows.length) {
174
174
  return [];
175
175
  }
@@ -289,9 +289,9 @@ async function addValues(categoryId, values) {
289
289
  * Adds a category, or, by a name the space has already, leaves that one as it is apart from
290
290
  * values it does not know yet. `proposed`: shown to be confirmed, never filled before.
291
291
  */
292
- export async function putCategory(projectId, draft, opts = {}) {
292
+ export async function putCategory(spaceId, draft, opts = {}) {
293
293
  const name = checkDraft(draft);
294
- const rows = await categoryRows(projectId);
294
+ const rows = await categoryRows(spaceId);
295
295
  const known = byName(rows, name);
296
296
  if (known) {
297
297
  if (draft.values?.length && known.type === "choice") {
@@ -316,7 +316,7 @@ export async function putCategory(projectId, draft, opts = {}) {
316
316
  .values({
317
317
  id,
318
318
  tenantId: currentTenant(),
319
- projectId,
319
+ spaceId,
320
320
  name,
321
321
  type: draft.type,
322
322
  unit: draft.type === "number" ? (draft.unit?.trim().slice(0, 20) ?? null) : null,
@@ -382,10 +382,10 @@ async function reindexHolders(categoryId) {
382
382
  }
383
383
  export async function updateCategory(categoryId, patch) {
384
384
  const row = await categoryRow(categoryId);
385
- await requireWritableProject(row.projectId);
385
+ await requireWritableSpace(row.spaceId);
386
386
  const name = patch.name !== undefined ? checkDraft({ name: patch.name, type: row.type }) : row.name;
387
387
  if (name !== row.name) {
388
- const clash = byName(await categoryRows(row.projectId), name);
388
+ const clash = byName(await categoryRows(row.spaceId), name);
389
389
  if (clash && clash.id !== row.id) {
390
390
  throw new ServiceError("invalid", note("categoryAlreadyExists", { name }));
391
391
  }
@@ -416,7 +416,7 @@ export async function updateCategory(categoryId, patch) {
416
416
  }
417
417
  export async function deleteCategory(categoryId) {
418
418
  const row = await categoryRow(categoryId);
419
- await requireWritableProject(row.projectId);
419
+ await requireWritableSpace(row.spaceId);
420
420
  await reindexHolders(row.id);
421
421
  await db.delete(schema.spaceCategory).where(eq(schema.spaceCategory.id, row.id));
422
422
  }
@@ -435,7 +435,7 @@ export async function categoryValue(valueId) {
435
435
  }
436
436
  export async function addCategoryValue(categoryId, value) {
437
437
  const category = await categoryRow(categoryId);
438
- await requireWritableProject(category.projectId);
438
+ await requireWritableSpace(category.spaceId);
439
439
  if (category.type !== "choice") {
440
440
  throw new ServiceError("invalid", note("onlyChoiceCategoriesValues"));
441
441
  }
@@ -444,7 +444,7 @@ export async function addCategoryValue(categoryId, value) {
444
444
  }
445
445
  export async function renameCategoryValue(valueId, value) {
446
446
  const { value: row, category } = await valueRow(valueId);
447
- await requireWritableProject(category.projectId);
447
+ await requireWritableSpace(category.spaceId);
448
448
  const next = value.replace(/\s+/g, " ").trim().slice(0, 200);
449
449
  if (!next || next === row.value) {
450
450
  return;
@@ -469,7 +469,7 @@ export async function mergeCategoryValues(fromId, intoId) {
469
469
  if (from.category.id !== into.category.id || fromId === intoId) {
470
470
  throw new ServiceError("invalid", note("onlyValuesOneCategory"));
471
471
  }
472
- await requireWritableProject(from.category.projectId);
472
+ await requireWritableSpace(from.category.spaceId);
473
473
  const t = schema.spaceItemCategory;
474
474
  const moving = await db.query.spaceItemCategory.findMany({ where: eq(t.valueId, fromId) });
475
475
  const having = new Set((await db.query.spaceItemCategory.findMany({ where: eq(t.valueId, intoId) })).map(keyOfRow));
@@ -491,13 +491,13 @@ export async function mergeCategoryValues(fromId, intoId) {
491
491
  }
492
492
  export async function deleteCategoryValue(valueId) {
493
493
  const { value, category } = await valueRow(valueId);
494
- await requireWritableProject(category.projectId);
494
+ await requireWritableSpace(category.spaceId);
495
495
  await reindexHolders(category.id);
496
496
  await db.delete(schema.spaceCategoryValue).where(eq(schema.spaceCategoryValue.id, value.id));
497
497
  }
498
498
  export async function orderCategoryValues(categoryId, ids) {
499
499
  const category = await categoryRow(categoryId);
500
- await requireWritableProject(category.projectId);
500
+ await requireWritableSpace(category.spaceId);
501
501
  for (const [position, id] of ids.entries()) {
502
502
  await db
503
503
  .update(schema.spaceCategoryValue)
@@ -511,8 +511,8 @@ export async function orderCategoryValues(categoryId, ids) {
511
511
  * person set stays when an origin or a model writes again. Names the space has no taken
512
512
  * category for are skipped and returned. True in `changed` when anything changed.
513
513
  */
514
- export async function setItemCategories(projectId, ref, input, by) {
515
- const rows = (await categoryRows(projectId)).filter((c) => !c.proposed);
514
+ export async function setItemCategories(spaceId, ref, input, by) {
515
+ const rows = (await categoryRows(spaceId)).filter((c) => !c.proposed);
516
516
  const t = schema.spaceItemCategory;
517
517
  const current = await db.query.spaceItemCategory.findMany({ where: refWhere(ref) });
518
518
  const unknown = [];
@@ -556,7 +556,7 @@ export async function setItemCategories(projectId, ref, input, by) {
556
556
  }
557
557
  if (next.length) {
558
558
  await db.insert(t).values(next.map((n) => ({
559
- projectId,
559
+ spaceId,
560
560
  categoryId: category.id,
561
561
  ...("pageId" in ref ? { pageId: ref.pageId } : {}),
562
562
  ...("rowId" in ref ? { rowId: ref.rowId } : {}),
@@ -570,20 +570,20 @@ export async function setItemCategories(projectId, ref, input, by) {
570
570
  return { changed, unknown };
571
571
  }
572
572
  /** Whether an item is of the space's own Knowledge. */
573
- async function itemInProject(projectId, ref) {
573
+ async function itemInSpace(spaceId, ref) {
574
574
  if ("pageId" in ref) {
575
575
  const page = await db.query.spacePage.findFirst({
576
576
  where: eq(schema.spacePage.id, ref.pageId),
577
- columns: { projectId: true, wizardId: true },
577
+ columns: { spaceId: true, wizardId: true },
578
578
  });
579
- return page?.projectId === projectId && !page.wizardId;
579
+ return page?.spaceId === spaceId && !page.wizardId;
580
580
  }
581
581
  if ("fileId" in ref) {
582
- const file = await db.query.projectFile.findFirst({
583
- where: eq(schema.projectFile.id, ref.fileId),
584
- columns: { projectId: true },
582
+ const file = await db.query.spaceFile.findFirst({
583
+ where: eq(schema.spaceFile.id, ref.fileId),
584
+ columns: { spaceId: true },
585
585
  });
586
- return file?.projectId === projectId;
586
+ return file?.spaceId === spaceId;
587
587
  }
588
588
  const tableId = "tableId" in ref
589
589
  ? ref.tableId
@@ -594,18 +594,18 @@ async function itemInProject(projectId, ref) {
594
594
  const table = tableId
595
595
  ? await db.query.spaceTable.findFirst({
596
596
  where: eq(schema.spaceTable.id, tableId),
597
- columns: { projectId: true, wizardId: true },
597
+ columns: { spaceId: true, wizardId: true },
598
598
  })
599
599
  : undefined;
600
- return table?.projectId === projectId && !table.wizardId;
600
+ return table?.spaceId === spaceId && !table.wizardId;
601
601
  }
602
602
  /** What a person set from the studio: by the category's id, a list of values or none. */
603
- export async function setItemCategory(projectId, ref, categoryId, values) {
603
+ export async function setItemCategory(spaceId, ref, categoryId, values) {
604
604
  const category = await categoryRow(categoryId);
605
- if (category.projectId !== projectId || !(await itemInProject(projectId, ref))) {
605
+ if (category.spaceId !== spaceId || !(await itemInSpace(spaceId, ref))) {
606
606
  throw notFound();
607
607
  }
608
- const { changed } = await setItemCategories(projectId, ref, { [category.name]: values.length ? values : null }, "person");
608
+ const { changed } = await setItemCategories(spaceId, ref, { [category.name]: values.length ? values : null }, "person");
609
609
  return changed;
610
610
  }
611
611
  /** The categories of items, by `itemKey`. */
@@ -692,7 +692,7 @@ export async function syncColumnCategory(category, rowIds) {
692
692
  columns: { id: true, cells: true },
693
693
  });
694
694
  for (const row of rows) {
695
- await setItemCategories(category.projectId, { rowId: row.id }, {
695
+ await setItemCategories(category.spaceId, { rowId: row.id }, {
696
696
  [category.name]: row.cells[category.columnId] ?? null,
697
697
  }, "origin");
698
698
  }
@@ -795,12 +795,12 @@ async function withSubPages(pageIds) {
795
795
  * belongs to, has every category as asked. Null for no filter. A name the space has no
796
796
  * category for is an error that lists the names there are.
797
797
  */
798
- export async function filterItems(projectId, where) {
798
+ export async function filterItems(spaceId, where) {
799
799
  const entries = Object.entries(where ?? {});
800
800
  if (!entries.length) {
801
801
  return null;
802
802
  }
803
- const rows = (await categoryRows(projectId)).filter((c) => !c.proposed);
803
+ const rows = (await categoryRows(spaceId)).filter((c) => !c.proposed);
804
804
  let result = null;
805
805
  for (const [name, w] of entries) {
806
806
  const category = byName(rows, name);