@engenty/wizards-runtime 0.12.2 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) hide show
  1. package/apps/runtime/dist/agents/architect.js +8 -7
  2. package/apps/runtime/dist/agents/goose-connections.js +82 -0
  3. package/apps/runtime/dist/agents/space-agent.js +9 -2
  4. package/apps/runtime/dist/agents/studio-assistant.js +126 -71
  5. package/apps/runtime/dist/agents/website.js +1 -1
  6. package/apps/runtime/dist/app.js +28 -3
  7. package/apps/runtime/dist/assistant/knows.js +6 -5
  8. package/apps/runtime/dist/authoring/guide.js +25 -5
  9. package/apps/runtime/dist/broker/account.js +166 -0
  10. package/apps/runtime/dist/broker/call.js +417 -0
  11. package/apps/runtime/dist/broker/caller.js +10 -0
  12. package/apps/runtime/dist/broker/grant.js +152 -0
  13. package/apps/runtime/dist/broker/host.js +51 -0
  14. package/apps/runtime/dist/broker/index.js +8 -0
  15. package/apps/runtime/dist/broker/kept.js +31 -0
  16. package/apps/runtime/dist/broker/log.js +240 -0
  17. package/apps/runtime/dist/broker/registry.js +9 -0
  18. package/apps/runtime/dist/broker/rwx.js +367 -0
  19. package/apps/runtime/dist/broker/send.js +189 -0
  20. package/apps/runtime/dist/connectors/builtin.js +1 -1
  21. package/apps/runtime/dist/connectors/external.js +38 -37
  22. package/apps/runtime/dist/connectors/index.js +30 -91
  23. package/apps/runtime/dist/connectors/mail.js +0 -8
  24. package/apps/runtime/dist/connectors/person-sign-ins.js +73 -0
  25. package/apps/runtime/dist/connectors/plugin-connections.js +65 -92
  26. package/apps/runtime/dist/connectors/smtp.js +1 -1
  27. package/apps/runtime/dist/connectors/space-connections.js +436 -0
  28. package/apps/runtime/dist/credits/estimate.js +3 -3
  29. package/apps/runtime/dist/db/adopt.js +3 -3
  30. package/apps/runtime/dist/db/client.js +9 -0
  31. package/apps/runtime/dist/db/live-triggers.js +65 -23
  32. package/apps/runtime/dist/db/migrations/tenant/0027_work_chats.sql +52 -0
  33. package/apps/runtime/dist/db/migrations/tenant/0028_chat_approvals.sql +17 -0
  34. package/apps/runtime/dist/db/migrations/tenant/0029_work_chats_live.sql +49 -0
  35. package/apps/runtime/dist/db/migrations/tenant/0031_space.sql +624 -0
  36. package/apps/runtime/dist/db/migrations/tenant/0032_rwx_rule.sql +18 -0
  37. package/apps/runtime/dist/db/migrations/tenant/0033_broker_log.sql +23 -0
  38. package/apps/runtime/dist/db/migrations/tenant/0034_space_connection.sql +35 -0
  39. package/apps/runtime/dist/db/migrations/tenant/0035_run_grant.sql +1 -0
  40. package/apps/runtime/dist/db/migrations/tenant/0036_approval_held_for.sql +1 -0
  41. package/apps/runtime/dist/db/migrations/tenant/0037_ways_out.sql +5 -0
  42. package/apps/runtime/dist/db/migrations/tenant/0038_heard.sql +11 -0
  43. package/apps/runtime/dist/db/migrations/tenant/0039_members_studio.sql +1 -0
  44. package/apps/runtime/dist/db/migrations/tenant/meta/0027_snapshot.json +383 -155
  45. package/apps/runtime/dist/db/migrations/tenant/meta/0028_snapshot.json +4468 -0
  46. package/apps/runtime/dist/db/migrations/tenant/meta/0029_snapshot.json +4475 -0
  47. package/apps/runtime/dist/db/migrations/tenant/meta/0030_snapshot.json +4629 -0
  48. package/apps/runtime/dist/db/migrations/tenant/meta/0031_snapshot.json +4629 -0
  49. package/apps/runtime/dist/db/migrations/tenant/meta/0032_snapshot.json +4757 -0
  50. package/apps/runtime/dist/db/migrations/tenant/meta/0033_snapshot.json +5039 -0
  51. package/apps/runtime/dist/db/migrations/tenant/meta/0034_snapshot.json +5022 -0
  52. package/apps/runtime/dist/db/migrations/tenant/meta/0035_snapshot.json +5029 -0
  53. package/apps/runtime/dist/db/migrations/tenant/meta/0036_snapshot.json +5037 -0
  54. package/apps/runtime/dist/db/migrations/tenant/meta/0037_snapshot.json +5076 -0
  55. package/apps/runtime/dist/db/migrations/tenant/meta/0038_snapshot.json +5145 -0
  56. package/apps/runtime/dist/db/migrations/tenant/meta/0039_snapshot.json +5153 -0
  57. package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +86 -2
  58. package/apps/runtime/dist/db/schema.js +295 -72
  59. package/apps/runtime/dist/docs/dev/architecture.md +215 -0
  60. package/apps/runtime/dist/docs/dev/broker.md +298 -0
  61. package/apps/runtime/dist/docs/dev/index.md +5 -1
  62. package/apps/runtime/dist/docs/dev/integration/index.md +2 -0
  63. package/apps/runtime/dist/docs/dev/meta.json +3 -0
  64. package/apps/runtime/dist/docs/dev/plugins/connections.md +8 -5
  65. package/apps/runtime/dist/docs/dev/plugins/events.md +1 -1
  66. package/apps/runtime/dist/docs/dev/plugins/examples.md +1 -0
  67. package/apps/runtime/dist/docs/dev/plugins/index.md +2 -2
  68. package/apps/runtime/dist/docs/dev/plugins/reference.md +3 -2
  69. package/apps/runtime/dist/docs/dev/plugins/space.md +16 -6
  70. package/apps/runtime/dist/docs/dev/plugins/studio.md +2 -2
  71. package/apps/runtime/dist/docs/dev/plugins/tools.md +0 -1
  72. package/apps/runtime/dist/docs/dev/skills.md +16 -9
  73. package/apps/runtime/dist/docs/dev/wizard-format/agent-steps.md +59 -6
  74. package/apps/runtime/dist/docs/dev/wizard-format/lists-and-connections.md +17 -2
  75. package/apps/runtime/dist/docs/dev/wizard-format/templates.md +2 -0
  76. package/apps/runtime/dist/docs/dev/wizard-format/views-and-widgets.md +22 -2
  77. package/apps/runtime/dist/docs/user-guide/capabilities.md +132 -0
  78. package/apps/runtime/dist/docs/user-guide/cloud-sync.md +2 -0
  79. package/apps/runtime/dist/docs/user-guide/command-line.md +1 -0
  80. package/apps/runtime/dist/docs/user-guide/connectors.md +63 -7
  81. package/apps/runtime/dist/docs/user-guide/index.md +10 -1
  82. package/apps/runtime/dist/docs/user-guide/meta.json +6 -1
  83. package/apps/runtime/dist/docs/user-guide/models.md +105 -30
  84. package/apps/runtime/dist/docs/user-guide/protocol.md +80 -0
  85. package/apps/runtime/dist/docs/user-guide/skills.md +8 -4
  86. package/apps/runtime/dist/docs/user-guide/space.md +5 -4
  87. package/apps/runtime/dist/docs/user-guide/together.md +29 -2
  88. package/apps/runtime/dist/docs/user-guide/troubleshooting.md +2 -2
  89. package/apps/runtime/dist/docs/user-guide/work-mode.md +128 -0
  90. package/apps/runtime/dist/engenty/connections-external/build-connector.js +2 -5
  91. package/apps/runtime/dist/engenty/connections-external/importer/classify.js +72 -0
  92. package/apps/runtime/dist/engenty/connections-google/connectors/gmail.js +1 -1
  93. package/apps/runtime/dist/engenty/connections-microsoft/outlook.js +3 -2
  94. package/apps/runtime/dist/engenty/connections-sdk/types.js +2 -0
  95. package/apps/runtime/dist/engenty/connections-slack/connector.js +2 -1
  96. package/apps/runtime/dist/engine/decide.js +1 -1
  97. package/apps/runtime/dist/engine/requirements.js +139 -11
  98. package/apps/runtime/dist/engine/resources.js +43 -12
  99. package/apps/runtime/dist/engine/runner.js +121 -27
  100. package/apps/runtime/dist/engine/steps.js +42 -16
  101. package/apps/runtime/dist/engine/template.js +35 -1
  102. package/apps/runtime/dist/env.js +9 -4
  103. package/apps/runtime/dist/index.js +18 -2
  104. package/apps/runtime/dist/link-preview.js +9 -0
  105. package/apps/runtime/dist/live/feed.js +2 -2
  106. package/apps/runtime/dist/live/origin.js +2 -2
  107. package/apps/runtime/dist/live/views.js +51 -26
  108. package/apps/runtime/dist/manage.js +32 -0
  109. package/apps/runtime/dist/mcp/flow-app.js +1 -1
  110. package/apps/runtime/dist/mcp/handler.js +55 -1
  111. package/apps/runtime/dist/mcp/seen.js +47 -0
  112. package/apps/runtime/dist/mcp/tools.js +75 -34
  113. package/apps/runtime/dist/models.js +203 -12
  114. package/apps/runtime/dist/motion-graphics/project.js +8 -8
  115. package/apps/runtime/dist/motion-graphics/step.js +2 -2
  116. package/apps/runtime/dist/motion-graphics/tools.js +1 -1
  117. package/apps/runtime/dist/plugins/events.js +2 -2
  118. package/apps/runtime/dist/plugins/jobs.js +4 -1
  119. package/apps/runtime/dist/plugins/loader.js +2 -2
  120. package/apps/runtime/dist/prompts/architect.md +3 -3
  121. package/apps/runtime/dist/prompts/authoring.md +46 -12
  122. package/apps/runtime/dist/prompts/goose.md +14 -13
  123. package/apps/runtime/dist/prompts/mcp.md +6 -6
  124. package/apps/runtime/dist/prompts/safety.md +18 -0
  125. package/apps/runtime/dist/prompts/services.md +4 -4
  126. package/apps/runtime/dist/prompts/step.md +3 -3
  127. package/apps/runtime/dist/prompts/tools.md +39 -10
  128. package/apps/runtime/dist/routes/api.js +31 -20
  129. package/apps/runtime/dist/routes/broker.js +316 -0
  130. package/apps/runtime/dist/routes/connections.js +71 -0
  131. package/apps/runtime/dist/routes/delivery.js +25 -0
  132. package/apps/runtime/dist/routes/discover.js +17 -0
  133. package/apps/runtime/dist/routes/live.js +11 -1
  134. package/apps/runtime/dist/routes/marketplace.js +3 -3
  135. package/apps/runtime/dist/routes/person.js +4 -1
  136. package/apps/runtime/dist/routes/plugins.js +3 -1
  137. package/apps/runtime/dist/routes/rules.js +26 -0
  138. package/apps/runtime/dist/routes/runs.js +59 -33
  139. package/apps/runtime/dist/routes/skills.js +6 -6
  140. package/apps/runtime/dist/routes/studio.js +256 -148
  141. package/apps/runtime/dist/routes/work.js +199 -0
  142. package/apps/runtime/dist/safety.js +60 -18
  143. package/apps/runtime/dist/sandbox/index.js +27 -0
  144. package/apps/runtime/dist/services/access.js +38 -17
  145. package/apps/runtime/dist/services/api.js +38 -13
  146. package/apps/runtime/dist/services/architect.js +3 -3
  147. package/apps/runtime/dist/services/assistant-chats.js +9 -1
  148. package/apps/runtime/dist/services/brand.js +12 -12
  149. package/apps/runtime/dist/services/broker-bell.js +69 -0
  150. package/apps/runtime/dist/services/broker-notify.js +127 -0
  151. package/apps/runtime/dist/services/client-steps.js +79 -0
  152. package/apps/runtime/dist/services/cloud.js +42 -42
  153. package/apps/runtime/dist/services/command-risk.js +51 -0
  154. package/apps/runtime/dist/services/discover.js +85 -0
  155. package/apps/runtime/dist/services/knowledge-model.js +13 -13
  156. package/apps/runtime/dist/services/knowledge.js +117 -80
  157. package/apps/runtime/dist/services/manage-reports.js +77 -7
  158. package/apps/runtime/dist/services/marketplace.js +7 -31
  159. package/apps/runtime/dist/services/members-studio.js +165 -0
  160. package/apps/runtime/dist/services/onboarding.js +22 -22
  161. package/apps/runtime/dist/services/package-file.js +1 -1
  162. package/apps/runtime/dist/services/package.js +22 -22
  163. package/apps/runtime/dist/services/pages.js +13 -9
  164. package/apps/runtime/dist/services/runs.js +4 -3
  165. package/apps/runtime/dist/services/seen.js +55 -0
  166. package/apps/runtime/dist/services/shares.js +28 -13
  167. package/apps/runtime/dist/services/site.js +23 -23
  168. package/apps/runtime/dist/services/skills-registry.js +15 -15
  169. package/apps/runtime/dist/services/skills.js +44 -44
  170. package/apps/runtime/dist/services/space-categories.js +35 -35
  171. package/apps/runtime/dist/services/space-data.js +130 -111
  172. package/apps/runtime/dist/services/{project-files.js → space-files.js} +84 -75
  173. package/apps/runtime/dist/services/{project-index.js → space-index.js} +116 -73
  174. package/apps/runtime/dist/services/space-origin.js +19 -11
  175. package/apps/runtime/dist/services/spaces.js +478 -598
  176. package/apps/runtime/dist/services/synced-spaces.js +668 -0
  177. package/apps/runtime/dist/services/themes.js +15 -15
  178. package/apps/runtime/dist/services/widgets.js +6 -6
  179. package/apps/runtime/dist/services/wizards.js +112 -38
  180. package/apps/runtime/dist/services/work-ai.js +257 -0
  181. package/apps/runtime/dist/services/work-approvals.js +104 -0
  182. package/apps/runtime/dist/services/work-chats.js +908 -0
  183. package/apps/runtime/dist/services/work-connections.js +90 -0
  184. package/apps/runtime/dist/services/work-files.js +85 -0
  185. package/apps/runtime/dist/services/work-mastra.js +73 -0
  186. package/apps/runtime/dist/services/work-sandbox.js +42 -0
  187. package/apps/runtime/dist/sharing/files.js +14 -4
  188. package/apps/runtime/dist/sharing/index.js +40 -39
  189. package/apps/runtime/dist/sharing/jobs.js +67 -17
  190. package/apps/runtime/dist/sharing/targets/connector.js +10 -6
  191. package/apps/runtime/dist/sharing/targets/email.js +10 -8
  192. package/apps/runtime/dist/sharing/targets/slack.js +10 -8
  193. package/apps/runtime/dist/sharing/targets/storage.js +6 -4
  194. package/apps/runtime/dist/store/index.js +14 -3
  195. package/apps/runtime/dist/store/shared-lists.js +4 -2
  196. package/apps/runtime/dist/sync/apply.js +2 -2
  197. package/apps/runtime/dist/sync/client.js +113 -113
  198. package/apps/runtime/dist/sync/hub.js +41 -41
  199. package/apps/runtime/dist/sync/log.js +12 -12
  200. package/apps/runtime/dist/sync/records.js +118 -120
  201. package/apps/runtime/dist/texts.js +44 -2
  202. package/apps/runtime/dist/tools/connections.js +112 -0
  203. package/apps/runtime/dist/tools/connector.js +157 -67
  204. package/apps/runtime/dist/tools/index.js +31 -15
  205. package/apps/runtime/dist/tools/mail.js +40 -11
  206. package/apps/runtime/dist/tools/pages.js +11 -5
  207. package/apps/runtime/dist/tools/plugin.js +43 -7
  208. package/apps/runtime/dist/tools/skills.js +1 -1
  209. package/apps/runtime/dist/tools/{project.js → space.js} +30 -25
  210. package/apps/runtime/dist/tools/store.js +3 -2
  211. package/apps/runtime/dist/widgets/step.js +10 -10
  212. package/apps/web/dist/assets/AboutDialog-DgfeipUc.js +1 -0
  213. package/apps/web/dist/assets/CapabilitiesPage-BoYJvgIu.js +2 -0
  214. package/apps/web/dist/assets/{ChangelogDialog-CKLgFL6r.js → ChangelogDialog-Duab4zTO.js} +1 -1
  215. package/apps/web/dist/assets/{CodeEditor-B3nto_26.js → CodeEditor-nxoOt8ge.js} +1 -1
  216. package/apps/web/dist/assets/EditorPage-ZrgGpYMC.js +3 -0
  217. package/apps/web/dist/assets/{FlowPreview-zJCtixSi.js → FlowPreview-aMfwcPul.js} +1 -1
  218. package/apps/web/dist/assets/LangSwitch-DpD0inR4.js +1 -0
  219. package/apps/web/dist/assets/Marketplace-CpzD9pNQ.js +2 -0
  220. package/apps/web/dist/assets/NewWizardChannels-IB18afWN.js +1 -0
  221. package/apps/web/dist/assets/NewWizardPage-rYbcmPGG.js +7 -0
  222. package/apps/web/dist/assets/OnboardingPage-ztHT01ah.js +1 -0
  223. package/apps/web/dist/assets/PreviewPane-DviWTLfi.js +9 -0
  224. package/apps/web/dist/assets/PublicRunner-C2geZhhM.js +1 -0
  225. package/apps/web/dist/assets/ReadOnly-kSb_Kbdm.js +1 -0
  226. package/apps/web/dist/assets/SettingsPage-DM2h8N0J.js +2 -0
  227. package/apps/web/dist/assets/SetupPage-Wfyz6xH4.js +1 -0
  228. package/apps/web/dist/assets/SharePage-CyWQorWB.js +1 -0
  229. package/apps/web/dist/assets/SkillEditor-CqQMg2MC.js +1 -0
  230. package/apps/web/dist/assets/Skills-CnhpgoOA.js +9 -0
  231. package/apps/web/dist/assets/SpacePage-q4Bk3N7k.js +2 -0
  232. package/apps/web/dist/assets/UpdateCheck-C2CE6CC3.js +2 -0
  233. package/apps/web/dist/assets/changelog-B6hN1Cp7.js +1 -0
  234. package/apps/web/dist/assets/circle-alert-C8Ma-bPY.js +1 -0
  235. package/apps/web/dist/assets/circle-check-Bu9Z3mlJ.js +1 -0
  236. package/apps/web/dist/assets/code-editor-CfTGqOpp.js +2 -0
  237. package/apps/web/dist/assets/{code-xml-Hx7YxCg0.js → code-xml-B4kLFZSj.js} +1 -1
  238. package/apps/web/dist/assets/connection-sign-in-CIiv0t2p.js +1 -0
  239. package/apps/web/dist/assets/esm-Xwn4GtqG.js +7 -0
  240. package/apps/web/dist/assets/{eye-BkMFLnYu.js → eye-BpoKpIdt.js} +1 -1
  241. package/apps/web/dist/assets/host-BrP-ENHg.css +1 -0
  242. package/apps/web/dist/assets/host-DJ7-p0Sc.js +118 -0
  243. package/apps/web/dist/assets/i18n-BJ7Ld6O6.js +55 -0
  244. package/apps/web/dist/assets/index-D18DvnxX.css +1 -0
  245. package/apps/web/dist/assets/index-D2akynS-.js +10 -0
  246. package/apps/web/dist/assets/logo-BpnjXTRy.js +1 -0
  247. package/apps/web/dist/assets/oss-credits-IdX5bc71.js +1 -0
  248. package/apps/web/dist/assets/{phone-DMfwuh9V.js → phone-Ctvf-Am-.js} +1 -1
  249. package/apps/web/dist/assets/read-aloud-Da_RSm2S.js +1 -0
  250. package/apps/web/dist/assets/{runners-D5qz6b_s.js → runners-CyIvJIHr.js} +1 -1
  251. package/apps/web/dist/assets/scroll-text-ChrjRu9Y.js +1 -0
  252. package/apps/web/dist/assets/session-SXPtTWRK.js +2 -0
  253. package/apps/web/dist/assets/theme-CbTcTFWy.js +11 -0
  254. package/apps/web/dist/assets/ui-Uqnx1UpK.js +82 -0
  255. package/apps/web/dist/assets/{upload-DQJwLSGj.js → upload-BchUnQGV.js} +1 -1
  256. package/apps/web/dist/assets/{useMutation-C20c2EH3.js → useMutation-DEkZhp5c.js} +1 -1
  257. package/apps/web/dist/assets/{volume-2-CC5qamYT.js → volume-2-CU_oy81Z.js} +1 -1
  258. package/apps/web/dist/assets/with-selector-CoMyWBAX.js +1 -0
  259. package/apps/web/dist/index.html +17 -10
  260. package/apps/web/dist/mcp/flow.html +119 -64
  261. package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +20 -10
  262. package/node_modules/@engenty/wizards-shared/dist/assistant.d.ts +7 -1
  263. package/node_modules/@engenty/wizards-shared/dist/assistant.js +11 -1
  264. package/node_modules/@engenty/wizards-shared/dist/connectors.d.ts +236 -2
  265. package/node_modules/@engenty/wizards-shared/dist/connectors.js +52 -2
  266. package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +257 -8
  267. package/node_modules/@engenty/wizards-shared/dist/definition.js +113 -15
  268. package/node_modules/@engenty/wizards-shared/dist/discover.d.ts +21 -0
  269. package/node_modules/@engenty/wizards-shared/dist/discover.js +1 -0
  270. package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +38 -2
  271. package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +38 -2
  272. package/node_modules/@engenty/wizards-shared/dist/fit.js +1 -1
  273. package/node_modules/@engenty/wizards-shared/dist/json-schema.d.ts +1 -1
  274. package/node_modules/@engenty/wizards-shared/dist/json-schema.js +1 -1
  275. package/node_modules/@engenty/wizards-shared/dist/live.d.ts +2 -2
  276. package/node_modules/@engenty/wizards-shared/dist/live.js +1 -1
  277. package/node_modules/@engenty/wizards-shared/dist/marketplace.d.ts +0 -5
  278. package/node_modules/@engenty/wizards-shared/dist/marketplace.js +3 -1
  279. package/node_modules/@engenty/wizards-shared/dist/run.d.ts +115 -6
  280. package/node_modules/@engenty/wizards-shared/dist/run.js +135 -0
  281. package/node_modules/@engenty/wizards-shared/dist/runner-texts.d.ts +15 -1
  282. package/node_modules/@engenty/wizards-shared/dist/runner-texts.js +14 -0
  283. package/node_modules/@engenty/wizards-shared/dist/rwx.d.ts +42 -0
  284. package/node_modules/@engenty/wizards-shared/dist/rwx.js +29 -0
  285. package/node_modules/@engenty/wizards-shared/dist/skills.d.ts +1 -1
  286. package/node_modules/@engenty/wizards-shared/dist/space-data.d.ts +2 -2
  287. package/node_modules/@engenty/wizards-shared/dist/{projects.d.ts → spaces.d.ts} +39 -15
  288. package/node_modules/@engenty/wizards-shared/dist/{projects.js → spaces.js} +16 -9
  289. package/node_modules/@engenty/wizards-shared/dist/store.d.ts +7 -2
  290. package/node_modules/@engenty/wizards-shared/dist/surface.d.ts +35 -4
  291. package/node_modules/@engenty/wizards-shared/dist/surface.js +121 -3
  292. package/node_modules/@engenty/wizards-shared/dist/sync.d.ts +1 -1
  293. package/node_modules/@engenty/wizards-shared/dist/theme-look.js +1 -1
  294. package/node_modules/@engenty/wizards-shared/dist/tiers.d.ts +195 -0
  295. package/node_modules/@engenty/wizards-shared/dist/tiers.js +98 -0
  296. package/node_modules/@engenty/wizards-shared/dist/wizard-package.d.ts +2 -2
  297. package/node_modules/@engenty/wizards-shared/dist/wizard-package.js +3 -3
  298. package/package.json +4 -1
  299. package/plugin/.claude-plugin/plugin.json +1 -1
  300. package/plugin/plugin.json +1 -1
  301. package/plugin/skills/build-wizard/SKILL.md +1 -1
  302. package/apps/runtime/dist/services/projects.js +0 -473
  303. package/apps/web/dist/assets/AboutDialog-CLgnoYTI.js +0 -1
  304. package/apps/web/dist/assets/EditorPage-D9JDdAAI.js +0 -3
  305. package/apps/web/dist/assets/Marketplace-D4e0Oac9.js +0 -2
  306. package/apps/web/dist/assets/NewWizardChannels-B4N7GIYh.js +0 -1
  307. package/apps/web/dist/assets/NewWizardPage-Dpt0Mzk8.js +0 -7
  308. package/apps/web/dist/assets/OnboardingPage-CDoYVjRC.js +0 -1
  309. package/apps/web/dist/assets/PreviewPane-DPB5nEd5.js +0 -10
  310. package/apps/web/dist/assets/ProjectPage-408YOoNa.js +0 -10
  311. package/apps/web/dist/assets/PublicRunner-BZ66xdRX.js +0 -1
  312. package/apps/web/dist/assets/ReadOnly-C9oGMkUB.js +0 -1
  313. package/apps/web/dist/assets/SettingsPage-Dq3AZwJS.js +0 -2
  314. package/apps/web/dist/assets/SetupPage-CP3lbyZc.js +0 -1
  315. package/apps/web/dist/assets/SharePage-DdMm1Y8K.js +0 -1
  316. package/apps/web/dist/assets/SkillEditor-b5NMFB90.js +0 -1
  317. package/apps/web/dist/assets/changelog-82-DHogQ.js +0 -1
  318. package/apps/web/dist/assets/esm-BdxDT9Km.js +0 -7
  319. package/apps/web/dist/assets/i18n-CKKh3Pn0.js +0 -55
  320. package/apps/web/dist/assets/index-Cy2NHzAx.js +0 -49
  321. package/apps/web/dist/assets/index-wR_-1hfN.css +0 -1
  322. package/apps/web/dist/assets/lock-CGXM95Mi.js +0 -1
  323. package/apps/web/dist/assets/logo-CGNoptDg.js +0 -1
  324. package/apps/web/dist/assets/oss-credits-DpRWUPjD.js +0 -1
  325. package/apps/web/dist/assets/session-DRy0k0nh.js +0 -2
  326. package/apps/web/dist/assets/theme-DNPm6r4e.js +0 -11
  327. package/apps/web/dist/assets/ui-CwFQAfE-.js +0 -83
  328. /package/apps/runtime/dist/db/migrations/tenant/{0027_space_skill.sql → 0030_space_skill.sql} +0 -0
@@ -1,12 +1,13 @@
1
1
  import { langOf, wizardLang, } from "@engenty/wizards-shared/definition";
2
2
  import { effortOf } from "@engenty/wizards-shared/marketplace";
3
3
  import { resultsOf } from "@engenty/wizards-shared/marketplace-entry";
4
- import { factType, pageSlugOf, runTheme, } from "@engenty/wizards-shared/projects";
4
+ import { factType, pageSlugOf, runTheme, } from "@engenty/wizards-shared/spaces";
5
5
  import { and, eq, inArray } from "drizzle-orm";
6
6
  import { db, schema } from "../db/client.js";
7
7
  import { env } from "../env.js";
8
8
  import { feature } from "../features.js";
9
9
  import { managed, putPages, tenantInfo } from "../manage.js";
10
+ import { guestRun } from "../safety.js";
10
11
  import { currentTenant } from "../tenants/tenant.js";
11
12
  import { mainLogoId } from "./brand.js";
12
13
  /** About how many rows the teaser's step list has. */
@@ -124,9 +125,9 @@ export async function pageOrganization() {
124
125
  }
125
126
  const tenantId = currentTenant();
126
127
  const organization = await tenantInfo(tenantId);
127
- // Only one space of an organization has its page on (services/projects.ts).
128
- const spaces = await db.query.project.findMany({
129
- where: eq(schema.project.tenantId, tenantId),
128
+ // Only one space of an organization has its page on (services/spaces.ts).
129
+ const spaces = await db.query.space.findMany({
130
+ where: eq(schema.space.tenantId, tenantId),
130
131
  });
131
132
  // Behind its switch the organization has no page: what Manage holds is sent as none.
132
133
  const space = feature("pages", organization.features)
@@ -140,7 +141,7 @@ export async function pageOrganization() {
140
141
  }
141
142
  const listed = page.wizards.length
142
143
  ? await db.query.wizard.findMany({
143
- where: and(eq(schema.wizard.projectId, space.id), inArray(schema.wizard.id, page.wizards), eq(schema.wizard.shareEnabled, true)),
144
+ where: and(eq(schema.wizard.spaceId, space.id), inArray(schema.wizard.id, page.wizards), eq(schema.wizard.shareEnabled, true)),
144
145
  })
145
146
  : [];
146
147
  // Addresses made before hold; a wizard new to the page gets one that is free among them.
@@ -168,10 +169,13 @@ export async function pageOrganization() {
168
169
  const example = exampleToken
169
170
  ? await db.query.run.findFirst({
170
171
  where: and(eq(schema.run.wizardId, w.id), eq(schema.run.shareToken, exampleToken)),
171
- columns: { status: true, expiresAt: true },
172
+ columns: { status: true, expiresAt: true, mode: true, userId: true },
172
173
  })
173
174
  : null;
174
- const shown = example?.status === "done" && !(example.expiresAt && example.expiresAt < new Date());
175
+ // A guest's result is never shown on a public page: only a run a member started.
176
+ const shown = example?.status === "done" &&
177
+ !guestRun(example) &&
178
+ !(example.expiresAt && example.expiresAt < new Date());
175
179
  const slug = kept[w.id] ?? wizardSlug(def.title, taken);
176
180
  if (!kept[w.id]) {
177
181
  made[w.id] = slug;
@@ -191,9 +195,9 @@ export async function pageOrganization() {
191
195
  }
192
196
  if (Object.keys(made).length) {
193
197
  await db
194
- .update(schema.project)
198
+ .update(schema.space)
195
199
  .set({ page: { ...page, slugs: { ...kept, ...made } } })
196
- .where(eq(schema.project.id, space.id));
200
+ .where(eq(schema.space.id, space.id));
197
201
  }
198
202
  if (!wizards.length) {
199
203
  return { ...base, space: null };
@@ -470,6 +470,7 @@ export async function draftStepView(userId, wizardId, stepId, lang) {
470
470
  wizardId: w.id,
471
471
  tenantId: w.tenantId,
472
472
  files: [],
473
+ grant: null,
473
474
  version: null,
474
475
  mode: "test",
475
476
  runner: null,
@@ -497,7 +498,7 @@ export async function draftStepView(userId, wizardId, stepId, lang) {
497
498
  answer: null,
498
499
  shareToken: null,
499
500
  };
500
- const view = await runView(run, await brandView(w.projectId, def.themes));
501
+ const view = await runView(run, await brandView(w.spaceId, def.themes));
501
502
  // What the latest run said while it worked, and when, is its own: nothing works here.
502
503
  return { ...view, events: [] };
503
504
  }
@@ -532,7 +533,7 @@ export async function listRuns(userId, wizardId) {
532
533
  * The results of a space: its wizards' runs that reached their result, newest first, narrowed by
533
534
  * `filter`; and each wizard with how many it has and when its last one came, the latest first.
534
535
  */
535
- export async function listResults(projectId, filter = {}) {
536
+ export async function listResults(spaceId, filter = {}) {
536
537
  const wizards = await db
537
538
  .select({
538
539
  id: schema.wizard.id,
@@ -542,7 +543,7 @@ export async function listResults(projectId, filter = {}) {
542
543
  })
543
544
  .from(schema.wizard)
544
545
  .leftJoin(schema.run, and(eq(schema.run.wizardId, schema.wizard.id), eq(schema.run.status, "done")))
545
- .where(and(eq(schema.wizard.projectId, projectId), eq(schema.wizard.tenantId, currentTenant())))
546
+ .where(and(eq(schema.wizard.spaceId, spaceId), eq(schema.wizard.tenantId, currentTenant())))
546
547
  .groupBy(schema.wizard.id)
547
548
  // Wizards without a result last: SQLite sorts null below every time.
548
549
  .orderBy(desc(max(schema.run.updatedAt)), desc(schema.wizard.updatedAt));
@@ -0,0 +1,55 @@
1
+ import { eq, gt, inArray } from "drizzle-orm";
2
+ import { db, schema } from "../db/client.js";
3
+ /**
4
+ * When a person of the tenant was last in the app, and when they last opened Work's bell
5
+ * (`person_seen`). Every studio request marks the person, once a minute at most; the hourly mail
6
+ * of the broker's critical lines (broker/notify.ts) is skipped while an admin was here, and the
7
+ * bell counts what came in since it was opened (services/broker-bell.ts).
8
+ */
9
+ /** Marked again within this long, a request writes nothing. */
10
+ const AGAIN_MS = 60_000;
11
+ const marked = new Map();
12
+ /** Here, now. */
13
+ export async function markSeen(userId, at = new Date()) {
14
+ const key = `${userId}`;
15
+ const before = marked.get(key) ?? 0;
16
+ if (at.getTime() - before < AGAIN_MS) {
17
+ return;
18
+ }
19
+ marked.set(key, at.getTime());
20
+ await db
21
+ .insert(schema.personSeen)
22
+ .values({ userId, seenAt: at })
23
+ .onConflictDoUpdate({ target: schema.personSeen.userId, set: { seenAt: at } });
24
+ }
25
+ /** The person opened the bell: what is there counts as seen. */
26
+ export async function markBellSeen(userId, at = new Date()) {
27
+ await db
28
+ .insert(schema.personSeen)
29
+ .values({ userId, seenAt: at, bellSeenAt: at })
30
+ .onConflictDoUpdate({
31
+ target: schema.personSeen.userId,
32
+ set: { seenAt: at, bellSeenAt: at },
33
+ });
34
+ }
35
+ /** When the person last opened the bell; null: never. */
36
+ export async function bellSeenAt(userId) {
37
+ const row = await db.query.personSeen.findFirst({
38
+ where: eq(schema.personSeen.userId, userId),
39
+ });
40
+ return row?.bellSeenAt ?? null;
41
+ }
42
+ /** Whether any of these people was in the app after this time. */
43
+ export async function anySeenSince(userIds, since) {
44
+ if (!userIds.length) {
45
+ return false;
46
+ }
47
+ const row = await db.query.personSeen.findFirst({
48
+ where: (t, { and }) => and(inArray(t.userId, userIds), gt(t.seenAt, since)),
49
+ });
50
+ return Boolean(row);
51
+ }
52
+ /** For tests: the throttle forgets. */
53
+ export function forgetSeen() {
54
+ marked.clear();
55
+ }
@@ -1,11 +1,13 @@
1
1
  import { note } from "@engenty/wizards-shared/run";
2
2
  import { and, eq, isNotNull, lt } from "drizzle-orm";
3
3
  import { nanoid } from "nanoid";
4
+ import { keptStepIds } from "../broker/index.js";
4
5
  import { db, schema } from "../db/client.js";
5
6
  import { availableFormats } from "../engine/runner.js";
6
7
  import { env } from "../env.js";
7
8
  import { inlineAssetRefs, loadAsset, loadAssetText, removeAssetFiles, saveAsset, } from "../files/storage.js";
8
9
  import { htmlToPng } from "../render/convert.js";
10
+ import { guestRun } from "../safety.js";
9
11
  import { dropLinks, dropRuns, putLink } from "../tenants/control.js";
10
12
  import { brandView } from "./brand.js";
11
13
  import { ServiceError } from "./errors.js";
@@ -48,20 +50,24 @@ export async function shareView(run) {
48
50
  const result = def.steps.find((s) => s.id === run.cursor && s.type === "result") ??
49
51
  def.steps.findLast((s) => s.type === "result");
50
52
  const deliverables = result?.type === "result" ? result.deliverables : [];
51
- const shown = await Promise.all(deliverables.flatMap((d) => {
53
+ // A guest's link shows nothing a step made from a connection the space keeps for its members.
54
+ const kept = await keptStepIds(run);
55
+ const shown = [];
56
+ for (const d of deliverables) {
52
57
  const step = def.steps.find((s) => s.id === d.from);
53
58
  const output = run.state.outputs[d.from];
54
- return step && output
55
- ? [
56
- (async () => ({
57
- step,
58
- output,
59
- formats: await availableFormats(step, run, d.formats),
60
- label: d.label ?? null,
61
- }))(),
62
- ]
63
- : [];
64
- }));
59
+ if (!(step && output)) {
60
+ continue;
61
+ }
62
+ shown.push(kept.has(step.id)
63
+ ? { step, output: null, formats: [], label: d.label ?? null, kept: true }
64
+ : {
65
+ step,
66
+ output,
67
+ formats: await availableFormats(step, run, d.formats),
68
+ label: d.label ?? null,
69
+ });
70
+ }
65
71
  const w = await db.query.wizard.findFirst({ where: eq(schema.wizard.id, run.wizardId) });
66
72
  return {
67
73
  token: run.shareToken ?? "",
@@ -73,18 +79,27 @@ export async function shareView(run) {
73
79
  avatar: def.avatar,
74
80
  costume: def.costume,
75
81
  },
76
- brand: await brandView(w?.projectId ?? "", def.themes),
82
+ brand: await brandView(w?.spaceId ?? "", def.themes),
77
83
  shown,
78
84
  createdAt: run.createdAt.toISOString(),
79
85
  expiresAt: run.expiresAt?.toISOString() ?? null,
80
86
  wizardUrl: w?.shareEnabled && w.publishedVersion !== null ? `${env.publicUrl}/w/${w.shareToken}` : null,
81
87
  };
82
88
  }
89
+ /** The steps of a shared run whose files the link may serve: its deliverables, less what stays in the space. */
90
+ export async function sharedStepIds(run) {
91
+ const kept = await keptStepIds(run);
92
+ return new Set(run.definition.steps.flatMap((s) => s.type === "result" ? s.deliverables.map((d) => d.from).filter((id) => !kept.has(id)) : []));
93
+ }
83
94
  /**
84
95
  * The picture link previews (X, LinkedIn, WhatsApp, Slack) show: the first image of the result,
85
96
  * a widget's poster, or a document's first screen. Rendered once and kept.
86
97
  */
87
98
  export async function shareImage(run) {
99
+ // A guest's result stays private: link previews get no picture of it.
100
+ if (guestRun(run)) {
101
+ return null;
102
+ }
88
103
  const view = await shareView(run);
89
104
  for (const { output } of view.shown) {
90
105
  const assets = output?.assets ?? [];
@@ -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)