@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,7 +1,8 @@
1
- import { PROJECT_LIMITS, projectFileLimit, } from "@engenty/wizards-shared/projects";
2
1
  import { note } from "@engenty/wizards-shared/run";
2
+ import { SPACE_LIMITS, spaceFileLimit, } from "@engenty/wizards-shared/spaces";
3
3
  import { generateText } from "ai";
4
4
  import { and, asc, count, eq, max } from "drizzle-orm";
5
+ import { assertRwx } from "../broker/rwx.js";
5
6
  import { db, schema } from "../db/client.js";
6
7
  import { documentMime, UnreadableDocument } from "../documents/parse.js";
7
8
  import { loadAsset, removeAsset, replaceAsset, saveAsset } from "../files/storage.js";
@@ -11,11 +12,11 @@ import { spaceFileChanged } from "../plugins/events.js";
11
12
  import { prompt } from "../prompts.js";
12
13
  import { dropLinks, putLink } from "../tenants/control.js";
13
14
  import { safeFetch } from "../tools/net-guard.js";
14
- import { requireWritableProject } from "./access.js";
15
+ import { requireWritableSpace } from "./access.js";
15
16
  import { notFound, ServiceError } from "./errors.js";
16
17
  import { convertDocument, fillCategories } from "./knowledge-model.js";
17
- import { dropIndex, indexedFile, keepText, queueIndex } from "./project-index.js";
18
18
  import { setItemCategories } from "./space-categories.js";
19
+ import { dropIndex, indexedFile, keepText, queueIndex } from "./space-index.js";
19
20
  /** Reading a file takes seconds to a few minutes; a row still `pending` after this was cut off. */
20
21
  const STALE_MS = 15 * 60_000;
21
22
  const SEEN_BY_MODEL = ["image/png", "image/jpeg", "image/webp", "image/gif"];
@@ -37,25 +38,33 @@ export function fileView(row) {
37
38
  createdAt: row.createdAt.toISOString(),
38
39
  };
39
40
  }
40
- export function projectFiles(projectId, kind) {
41
- return db.query.projectFile.findMany({
41
+ export function spaceFiles(spaceId, kind) {
42
+ return db.query.spaceFile.findMany({
42
43
  where: kind
43
- ? and(eq(schema.projectFile.projectId, projectId), eq(schema.projectFile.kind, kind))
44
- : eq(schema.projectFile.projectId, projectId),
45
- orderBy: [asc(schema.projectFile.position), asc(schema.projectFile.createdAt)],
44
+ ? and(eq(schema.spaceFile.spaceId, spaceId), eq(schema.spaceFile.kind, kind))
45
+ : eq(schema.spaceFile.spaceId, spaceId),
46
+ orderBy: [asc(schema.spaceFile.position), asc(schema.spaceFile.createdAt)],
46
47
  });
47
48
  }
48
- export async function projectFile(projectId, fileId) {
49
- const row = await db.query.projectFile.findFirst({
50
- where: and(eq(schema.projectFile.id, fileId), eq(schema.projectFile.projectId, projectId)),
49
+ export async function spaceFile(spaceId, fileId) {
50
+ const row = await db.query.spaceFile.findFirst({
51
+ where: and(eq(schema.spaceFile.id, fileId), eq(schema.spaceFile.spaceId, spaceId)),
51
52
  });
52
53
  if (!row) {
53
54
  throw notFound();
54
55
  }
55
56
  return row;
56
57
  }
57
- export async function projectFileContent(projectId, fileId) {
58
- const row = await projectFile(projectId, fileId);
58
+ /**
59
+ * A file's bytes. A document's go out only to a `who` the broker lets read it (broker/rwx.ts),
60
+ * and to nobody when none is given; a logo, pattern or asset is the brand's, not Knowledge, and
61
+ * asks nobody.
62
+ */
63
+ export async function spaceFileContent(spaceId, fileId, who = []) {
64
+ const row = await spaceFile(spaceId, fileId);
65
+ if (row.kind === "document") {
66
+ await assertRwx(spaceId, who, { kind: "document", id: row.id }, "r");
67
+ }
59
68
  const found = await loadAsset(row.id);
60
69
  if (!found) {
61
70
  throw notFound();
@@ -76,8 +85,8 @@ function accepts(kind, mime) {
76
85
  }
77
86
  return true;
78
87
  }
79
- export async function addProjectFile(projectId, input) {
80
- await requireWritableProject(projectId);
88
+ export async function addSpaceFile(spaceId, input) {
89
+ await requireWritableSpace(spaceId);
81
90
  const declared = documentMime(input.name, input.mime) || "application/octet-stream";
82
91
  if (!accepts(input.kind, declared)) {
83
92
  throw new ServiceError("invalid", input.kind === "logo"
@@ -86,7 +95,7 @@ export async function addProjectFile(projectId, input) {
86
95
  ? note("patternImageSvgPng")
87
96
  : note("filesGoHere"));
88
97
  }
89
- const limit = projectFileLimit(input.kind, declared);
98
+ const limit = spaceFileLimit(input.kind, declared);
90
99
  if (!input.data.byteLength || input.data.byteLength > limit) {
91
100
  throw new ServiceError("invalid", note("chooseFileUpTo", { mb: Math.round(limit / 1_000_000) }));
92
101
  }
@@ -98,16 +107,16 @@ export async function addProjectFile(projectId, input) {
98
107
  fallbackName: "datei",
99
108
  });
100
109
  const { mime, data, name } = checked;
101
- const scope = and(eq(schema.projectFile.projectId, projectId), eq(schema.projectFile.kind, input.kind));
110
+ const scope = and(eq(schema.spaceFile.spaceId, spaceId), eq(schema.spaceFile.kind, input.kind));
102
111
  const [{ n, last }] = await db
103
- .select({ n: count(), last: max(schema.projectFile.position) })
104
- .from(schema.projectFile)
112
+ .select({ n: count(), last: max(schema.spaceFile.position) })
113
+ .from(schema.spaceFile)
105
114
  .where(scope);
106
- if (n >= PROJECT_LIMITS.files[input.kind]) {
107
- throw new ServiceError("refused", note("roomMostFiles", { count: PROJECT_LIMITS.files[input.kind] }));
115
+ if (n >= SPACE_LIMITS.files[input.kind]) {
116
+ throw new ServiceError("refused", note("roomMostFiles", { count: SPACE_LIMITS.files[input.kind] }));
108
117
  }
109
118
  const ref = await saveAsset({
110
- kind: input.kind === "logo" ? "logo" : "project",
119
+ kind: input.kind === "logo" ? "logo" : "space",
111
120
  mime,
112
121
  name,
113
122
  data,
@@ -115,10 +124,10 @@ export async function addProjectFile(projectId, input) {
115
124
  const description = input.description?.trim().slice(0, 600) ?? "";
116
125
  const work = input.kind === "document" || (!description && SEEN_BY_MODEL.includes(mime));
117
126
  const [row] = await db
118
- .insert(schema.projectFile)
127
+ .insert(schema.spaceFile)
119
128
  .values({
120
129
  id: ref.id,
121
- projectId,
130
+ spaceId,
122
131
  kind: input.kind,
123
132
  name,
124
133
  mime,
@@ -142,15 +151,15 @@ export async function addProjectFile(projectId, input) {
142
151
  return row;
143
152
  }
144
153
  /**
145
- * Fetches a file from a public web address into the project, as an upload of it would add it.
154
+ * Fetches a file from a public web address into the space, as an upload of it would add it.
146
155
  * A drawing a page holds inline comes as a `data:image/svg+xml` address. A web page where a
147
156
  * picture was asked for is refused with the reason `page`.
148
157
  */
149
- export async function addProjectFileFromUrl(projectId, input) {
158
+ export async function addSpaceFileFromUrl(spaceId, input) {
150
159
  const { url, kind, signal } = input;
151
160
  const inline = url.match(/^data:image\/svg\+xml;base64,([A-Za-z0-9+/=]+)$/);
152
161
  if (inline) {
153
- return addProjectFile(projectId, {
162
+ return addSpaceFile(spaceId, {
154
163
  kind,
155
164
  name: `${kind}.svg`,
156
165
  mime: "image/svg+xml",
@@ -175,12 +184,12 @@ export async function addProjectFileFromUrl(projectId, input) {
175
184
  url: res.url,
176
185
  });
177
186
  }
178
- if (Number(res.headers.get("content-length") ?? 0) > projectFileLimit(kind, mime)) {
187
+ if (Number(res.headers.get("content-length") ?? 0) > spaceFileLimit(kind, mime)) {
179
188
  throw new ServiceError("invalid", note("addressFileTooLarge"));
180
189
  }
181
190
  const data = new Uint8Array(await res.arrayBuffer());
182
191
  const name = decodeURIComponent(new URL(res.url).pathname.split("/").pop() || kind);
183
- return addProjectFile(projectId, {
192
+ return addSpaceFile(spaceId, {
184
193
  kind,
185
194
  name,
186
195
  mime,
@@ -206,11 +215,11 @@ async function slot(run) {
206
215
  waiting.shift()?.();
207
216
  }
208
217
  }
209
- async function projectLine(projectId) {
210
- const p = await db.query.project.findFirst({ where: eq(schema.project.id, projectId) });
218
+ async function spaceLine(spaceId) {
219
+ const p = await db.query.space.findFirst({ where: eq(schema.space.id, spaceId) });
211
220
  return [p?.brand.name || p?.name, p?.brand.about?.slice(0, 300)].filter(Boolean).join(" — ");
212
221
  }
213
- /** One sentence about a picture, for whoever picks among the project's files later. */
222
+ /** One sentence about a picture, for whoever picks among the space's files later. */
214
223
  async function describeImage(row, data) {
215
224
  const seer = await textModel("low");
216
225
  const result = await generateText({
@@ -224,7 +233,7 @@ async function describeImage(row, data) {
224
233
  { type: "file", data, mediaType: row.mime, filename: row.name },
225
234
  {
226
235
  type: "text",
227
- text: `Project: ${await projectLine(row.projectId)}\nFile: ${row.name} (${row.kind})`,
236
+ text: `Space: ${await spaceLine(row.spaceId)}\nFile: ${row.name} (${row.kind})`,
228
237
  },
229
238
  ],
230
239
  },
@@ -253,8 +262,8 @@ async function categorize(row, items, text) {
253
262
  : first?.startsWith("t:")
254
263
  ? { tableId: first.slice(2) }
255
264
  : { fileId: row.id };
256
- const changed = await fillCategories(row.projectId, ref, text || row.description, row.name).catch((err) => {
257
- console.error("[project-file] categories", row.name, err);
265
+ const changed = await fillCategories(row.spaceId, ref, text || row.description, row.name).catch((err) => {
266
+ console.error("[space-file] categories", row.name, err);
258
267
  return false;
259
268
  });
260
269
  if (changed) {
@@ -269,9 +278,9 @@ async function categorize(row, items, text) {
269
278
  async function prepare(row) {
270
279
  await slot(async () => {
271
280
  const set = (values) => db
272
- .update(schema.projectFile)
281
+ .update(schema.spaceFile)
273
282
  .set({ ...values, updatedAt: new Date() })
274
- .where(eq(schema.projectFile.id, row.id));
283
+ .where(eq(schema.spaceFile.id, row.id));
275
284
  try {
276
285
  const found = await loadAsset(row.id);
277
286
  if (!found) {
@@ -302,7 +311,7 @@ async function prepare(row) {
302
311
  spaceFileChanged("space.file.ready", row);
303
312
  }
304
313
  catch (err) {
305
- console.error("[project-file]", row.name, err);
314
+ console.error("[space-file]", row.name, err);
306
315
  await set({
307
316
  status: "failed",
308
317
  error: err instanceof UnreadableDocument ? err.message : "Reading didn’t work. Try again.",
@@ -310,32 +319,32 @@ async function prepare(row) {
310
319
  }
311
320
  });
312
321
  }
313
- export async function reindexProjectFile(projectId, fileId) {
314
- await requireWritableProject(projectId);
315
- const row = await projectFile(projectId, fileId);
322
+ export async function reindexSpaceFile(spaceId, fileId) {
323
+ await requireWritableSpace(spaceId);
324
+ const row = await spaceFile(spaceId, fileId);
316
325
  if (row.kind !== "document") {
317
326
  throw new ServiceError("invalid", note("onlyDocumentsIndex"));
318
327
  }
319
328
  const [pending] = await db
320
- .update(schema.projectFile)
329
+ .update(schema.spaceFile)
321
330
  .set({ status: "pending", error: null, updatedAt: new Date() })
322
- .where(eq(schema.projectFile.id, row.id))
331
+ .where(eq(schema.spaceFile.id, row.id))
323
332
  .returning();
324
333
  void prepare(pending);
325
334
  return pending;
326
335
  }
327
- export async function updateProjectFile(projectId, fileId, patch) {
328
- await requireWritableProject(projectId);
329
- const row = await projectFile(projectId, fileId);
336
+ export async function updateSpaceFile(spaceId, fileId, patch) {
337
+ await requireWritableSpace(spaceId);
338
+ const row = await spaceFile(spaceId, fileId);
330
339
  const [updated] = await db
331
- .update(schema.projectFile)
340
+ .update(schema.spaceFile)
332
341
  .set({
333
342
  ...(patch.name?.trim() ? { name: patch.name.trim().slice(0, 120) } : {}),
334
343
  ...(patch.description !== undefined
335
344
  ? { description: patch.description.trim().slice(0, 600) }
336
345
  : {}),
337
346
  })
338
- .where(eq(schema.projectFile.id, row.id))
347
+ .where(eq(schema.spaceFile.id, row.id))
339
348
  .returning();
340
349
  // Its name and description are what the index finds an asset by.
341
350
  if (indexedFile(updated) && (patch.name !== undefined || patch.description !== undefined)) {
@@ -344,9 +353,9 @@ export async function updateProjectFile(projectId, fileId, patch) {
344
353
  return updated;
345
354
  }
346
355
  /** Puts the files of one kind into the order of `ids`; the first logo is the one end users see. */
347
- export async function orderProjectFiles(projectId, kind, ids) {
348
- await requireWritableProject(projectId);
349
- const rows = await projectFiles(projectId, kind);
356
+ export async function orderSpaceFiles(spaceId, kind, ids) {
357
+ await requireWritableSpace(spaceId);
358
+ const rows = await spaceFiles(spaceId, kind);
350
359
  const order = [...ids.filter((id) => rows.some((r) => r.id === id))];
351
360
  for (const r of rows) {
352
361
  if (!order.includes(r.id)) {
@@ -354,7 +363,7 @@ export async function orderProjectFiles(projectId, kind, ids) {
354
363
  }
355
364
  }
356
365
  for (const [position, id] of order.entries()) {
357
- await db.update(schema.projectFile).set({ position }).where(eq(schema.projectFile.id, id));
366
+ await db.update(schema.spaceFile).set({ position }).where(eq(schema.spaceFile.id, id));
358
367
  }
359
368
  }
360
369
  async function removeRow(row) {
@@ -362,20 +371,20 @@ async function removeRow(row) {
362
371
  // What it was read into goes with it; what a person changed since stays.
363
372
  const { dropConverted } = await import("./knowledge-model.js");
364
373
  await dropConverted(row.id);
365
- await db.delete(schema.projectFile).where(eq(schema.projectFile.id, row.id));
374
+ await db.delete(schema.spaceFile).where(eq(schema.spaceFile.id, row.id));
366
375
  await removeAsset(row.id);
367
376
  if (row.kind === "logo" || row.mime.startsWith("font/")) {
368
377
  await dropLinks([row.id]);
369
378
  }
370
379
  spaceFileChanged("space.file.removed", row);
371
380
  }
372
- export async function removeProjectFile(projectId, fileId) {
373
- await requireWritableProject(projectId);
374
- await removeRow(await projectFile(projectId, fileId));
381
+ export async function removeSpaceFile(spaceId, fileId) {
382
+ await requireWritableSpace(spaceId);
383
+ await removeRow(await spaceFile(spaceId, fileId));
375
384
  }
376
- /** Before a project goes: its files leave the object store and the public links. */
377
- export async function removeProjectFiles(projectId) {
378
- for (const row of await projectFiles(projectId)) {
385
+ /** Before a space goes: its files leave the object store and the public links. */
386
+ export async function removeSpaceFiles(spaceId) {
387
+ for (const row of await spaceFiles(spaceId)) {
379
388
  await removeRow(row);
380
389
  }
381
390
  }
@@ -386,13 +395,13 @@ export async function removeProjectFiles(projectId) {
386
395
  * a step reads of it; without one only its name and description are found.
387
396
  */
388
397
  export async function putOriginFile(origin, input) {
389
- await requireWritableProject(input.space);
398
+ await requireWritableSpace(input.space);
390
399
  const key = input.key.trim().slice(0, 300);
391
- const existing = await db.query.projectFile.findFirst({
392
- where: and(eq(schema.projectFile.projectId, input.space), eq(schema.projectFile.origin, origin), eq(schema.projectFile.originKey, key)),
400
+ const existing = await db.query.spaceFile.findFirst({
401
+ where: and(eq(schema.spaceFile.spaceId, input.space), eq(schema.spaceFile.origin, origin), eq(schema.spaceFile.originKey, key)),
393
402
  });
394
403
  const mime = documentMime(input.name, input.mime) || "application/octet-stream";
395
- if (!input.data.byteLength || input.data.byteLength > projectFileLimit("document", mime)) {
404
+ if (!input.data.byteLength || input.data.byteLength > spaceFileLimit("document", mime)) {
396
405
  throw new ServiceError("invalid", note("emptyTooLargeDocument", { name: input.name }));
397
406
  }
398
407
  const name = input.name.slice(0, 120) || "datei";
@@ -412,21 +421,21 @@ export async function putOriginFile(origin, input) {
412
421
  if (existing) {
413
422
  // New content under the id it has: pages that name it as their original keep it.
414
423
  await replaceAsset(existing.id, { mime, name, data: input.data });
415
- await db.update(schema.projectFile).set(values).where(eq(schema.projectFile.id, existing.id));
424
+ await db.update(schema.spaceFile).set(values).where(eq(schema.spaceFile.id, existing.id));
416
425
  }
417
426
  else {
418
427
  const [{ n, last }] = await db
419
- .select({ n: count(), last: max(schema.projectFile.position) })
420
- .from(schema.projectFile)
421
- .where(and(eq(schema.projectFile.projectId, input.space), eq(schema.projectFile.kind, "document")));
422
- if (n >= PROJECT_LIMITS.files.document) {
423
- throw new ServiceError("refused", note("spaceMostDocuments", { count: PROJECT_LIMITS.files.document }));
428
+ .select({ n: count(), last: max(schema.spaceFile.position) })
429
+ .from(schema.spaceFile)
430
+ .where(and(eq(schema.spaceFile.spaceId, input.space), eq(schema.spaceFile.kind, "document")));
431
+ if (n >= SPACE_LIMITS.files.document) {
432
+ throw new ServiceError("refused", note("spaceMostDocuments", { count: SPACE_LIMITS.files.document }));
424
433
  }
425
- const ref = await saveAsset({ kind: "project", mime, name, data: input.data });
434
+ const ref = await saveAsset({ kind: "space", mime, name, data: input.data });
426
435
  id = ref.id;
427
- await db.insert(schema.projectFile).values({
436
+ await db.insert(schema.spaceFile).values({
428
437
  id: ref.id,
429
- projectId: input.space,
438
+ spaceId: input.space,
430
439
  kind: "document",
431
440
  position: (last ?? -1) + 1,
432
441
  origin,
@@ -441,9 +450,9 @@ export async function putOriginFile(origin, input) {
441
450
  return id;
442
451
  }
443
452
  /** Takes out a plugin's files, by key or all of them in the space; returns how many went. */
444
- export async function removeOriginFiles(origin, projectId, key) {
445
- const rows = await db.query.projectFile.findMany({
446
- where: and(eq(schema.projectFile.projectId, projectId), eq(schema.projectFile.origin, origin), key === undefined ? undefined : eq(schema.projectFile.originKey, key)),
453
+ export async function removeOriginFiles(origin, spaceId, key) {
454
+ const rows = await db.query.spaceFile.findMany({
455
+ where: and(eq(schema.spaceFile.spaceId, spaceId), eq(schema.spaceFile.origin, origin), key === undefined ? undefined : eq(schema.spaceFile.originKey, key)),
447
456
  });
448
457
  for (const row of rows) {
449
458
  await removeRow(row);