@engenty/wizards-runtime 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. package/apps/runtime/dist/agents/architect.js +8 -7
  2. package/apps/runtime/dist/agents/goose-connections.js +82 -0
  3. package/apps/runtime/dist/agents/space-agent.js +9 -2
  4. package/apps/runtime/dist/agents/studio-assistant.js +101 -67
  5. package/apps/runtime/dist/agents/website.js +1 -1
  6. package/apps/runtime/dist/app.js +17 -1
  7. package/apps/runtime/dist/assistant/knows.js +6 -5
  8. package/apps/runtime/dist/authoring/guide.js +25 -5
  9. package/apps/runtime/dist/broker/account.js +166 -0
  10. package/apps/runtime/dist/broker/call.js +417 -0
  11. package/apps/runtime/dist/broker/caller.js +10 -0
  12. package/apps/runtime/dist/broker/grant.js +152 -0
  13. package/apps/runtime/dist/broker/host.js +51 -0
  14. package/apps/runtime/dist/broker/index.js +8 -0
  15. package/apps/runtime/dist/broker/kept.js +31 -0
  16. package/apps/runtime/dist/broker/log.js +240 -0
  17. package/apps/runtime/dist/broker/registry.js +9 -0
  18. package/apps/runtime/dist/broker/rwx.js +367 -0
  19. package/apps/runtime/dist/broker/send.js +189 -0
  20. package/apps/runtime/dist/connectors/builtin.js +1 -1
  21. package/apps/runtime/dist/connectors/external.js +38 -37
  22. package/apps/runtime/dist/connectors/index.js +30 -91
  23. package/apps/runtime/dist/connectors/mail.js +0 -8
  24. package/apps/runtime/dist/connectors/person-sign-ins.js +73 -0
  25. package/apps/runtime/dist/connectors/plugin-connections.js +65 -92
  26. package/apps/runtime/dist/connectors/smtp.js +1 -1
  27. package/apps/runtime/dist/connectors/space-connections.js +436 -0
  28. package/apps/runtime/dist/db/adopt.js +3 -3
  29. package/apps/runtime/dist/db/client.js +9 -0
  30. package/apps/runtime/dist/db/live-triggers.js +65 -23
  31. package/apps/runtime/dist/db/migrations/tenant/0027_work_chats.sql +52 -0
  32. package/apps/runtime/dist/db/migrations/tenant/0028_chat_approvals.sql +17 -0
  33. package/apps/runtime/dist/db/migrations/tenant/0029_work_chats_live.sql +49 -0
  34. package/apps/runtime/dist/db/migrations/tenant/0031_space.sql +624 -0
  35. package/apps/runtime/dist/db/migrations/tenant/0032_rwx_rule.sql +18 -0
  36. package/apps/runtime/dist/db/migrations/tenant/0033_broker_log.sql +23 -0
  37. package/apps/runtime/dist/db/migrations/tenant/0034_space_connection.sql +35 -0
  38. package/apps/runtime/dist/db/migrations/tenant/0035_run_grant.sql +1 -0
  39. package/apps/runtime/dist/db/migrations/tenant/0036_approval_held_for.sql +1 -0
  40. package/apps/runtime/dist/db/migrations/tenant/0037_ways_out.sql +5 -0
  41. package/apps/runtime/dist/db/migrations/tenant/0038_heard.sql +11 -0
  42. package/apps/runtime/dist/db/migrations/tenant/0039_members_studio.sql +1 -0
  43. package/apps/runtime/dist/db/migrations/tenant/meta/0027_snapshot.json +383 -155
  44. package/apps/runtime/dist/db/migrations/tenant/meta/0028_snapshot.json +4468 -0
  45. package/apps/runtime/dist/db/migrations/tenant/meta/0029_snapshot.json +4475 -0
  46. package/apps/runtime/dist/db/migrations/tenant/meta/0030_snapshot.json +4629 -0
  47. package/apps/runtime/dist/db/migrations/tenant/meta/0031_snapshot.json +4629 -0
  48. package/apps/runtime/dist/db/migrations/tenant/meta/0032_snapshot.json +4757 -0
  49. package/apps/runtime/dist/db/migrations/tenant/meta/0033_snapshot.json +5039 -0
  50. package/apps/runtime/dist/db/migrations/tenant/meta/0034_snapshot.json +5022 -0
  51. package/apps/runtime/dist/db/migrations/tenant/meta/0035_snapshot.json +5029 -0
  52. package/apps/runtime/dist/db/migrations/tenant/meta/0036_snapshot.json +5037 -0
  53. package/apps/runtime/dist/db/migrations/tenant/meta/0037_snapshot.json +5076 -0
  54. package/apps/runtime/dist/db/migrations/tenant/meta/0038_snapshot.json +5145 -0
  55. package/apps/runtime/dist/db/migrations/tenant/meta/0039_snapshot.json +5153 -0
  56. package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +86 -2
  57. package/apps/runtime/dist/db/schema.js +295 -72
  58. package/apps/runtime/dist/docs/dev/architecture.md +215 -0
  59. package/apps/runtime/dist/docs/dev/broker.md +298 -0
  60. package/apps/runtime/dist/docs/dev/index.md +5 -1
  61. package/apps/runtime/dist/docs/dev/integration/index.md +2 -0
  62. package/apps/runtime/dist/docs/dev/meta.json +3 -0
  63. package/apps/runtime/dist/docs/dev/plugins/connections.md +8 -5
  64. package/apps/runtime/dist/docs/dev/plugins/events.md +1 -1
  65. package/apps/runtime/dist/docs/dev/plugins/examples.md +1 -0
  66. package/apps/runtime/dist/docs/dev/plugins/index.md +2 -2
  67. package/apps/runtime/dist/docs/dev/plugins/reference.md +3 -2
  68. package/apps/runtime/dist/docs/dev/plugins/space.md +16 -6
  69. package/apps/runtime/dist/docs/dev/plugins/studio.md +2 -2
  70. package/apps/runtime/dist/docs/dev/plugins/tools.md +0 -1
  71. package/apps/runtime/dist/docs/dev/skills.md +16 -9
  72. package/apps/runtime/dist/docs/dev/wizard-format/agent-steps.md +40 -5
  73. package/apps/runtime/dist/docs/dev/wizard-format/lists-and-connections.md +17 -2
  74. package/apps/runtime/dist/docs/dev/wizard-format/templates.md +2 -0
  75. package/apps/runtime/dist/docs/dev/wizard-format/views-and-widgets.md +22 -2
  76. package/apps/runtime/dist/docs/user-guide/capabilities.md +132 -0
  77. package/apps/runtime/dist/docs/user-guide/cloud-sync.md +2 -0
  78. package/apps/runtime/dist/docs/user-guide/command-line.md +1 -0
  79. package/apps/runtime/dist/docs/user-guide/connectors.md +63 -7
  80. package/apps/runtime/dist/docs/user-guide/index.md +10 -1
  81. package/apps/runtime/dist/docs/user-guide/meta.json +6 -1
  82. package/apps/runtime/dist/docs/user-guide/protocol.md +80 -0
  83. package/apps/runtime/dist/docs/user-guide/skills.md +8 -4
  84. package/apps/runtime/dist/docs/user-guide/space.md +5 -4
  85. package/apps/runtime/dist/docs/user-guide/together.md +16 -2
  86. package/apps/runtime/dist/docs/user-guide/troubleshooting.md +2 -2
  87. package/apps/runtime/dist/docs/user-guide/work-mode.md +128 -0
  88. package/apps/runtime/dist/engenty/connections-external/build-connector.js +2 -5
  89. package/apps/runtime/dist/engenty/connections-external/importer/classify.js +72 -0
  90. package/apps/runtime/dist/engenty/connections-google/connectors/gmail.js +1 -1
  91. package/apps/runtime/dist/engenty/connections-microsoft/outlook.js +3 -2
  92. package/apps/runtime/dist/engenty/connections-sdk/types.js +2 -0
  93. package/apps/runtime/dist/engenty/connections-slack/connector.js +2 -1
  94. package/apps/runtime/dist/engine/resources.js +43 -12
  95. package/apps/runtime/dist/engine/runner.js +75 -23
  96. package/apps/runtime/dist/engine/steps.js +30 -12
  97. package/apps/runtime/dist/engine/template.js +18 -1
  98. package/apps/runtime/dist/env.js +9 -4
  99. package/apps/runtime/dist/index.js +18 -2
  100. package/apps/runtime/dist/live/feed.js +2 -2
  101. package/apps/runtime/dist/live/origin.js +2 -2
  102. package/apps/runtime/dist/live/views.js +51 -26
  103. package/apps/runtime/dist/manage.js +7 -0
  104. package/apps/runtime/dist/mcp/flow-app.js +1 -1
  105. package/apps/runtime/dist/mcp/tools.js +75 -34
  106. package/apps/runtime/dist/models.js +1 -1
  107. package/apps/runtime/dist/motion-graphics/project.js +8 -8
  108. package/apps/runtime/dist/motion-graphics/tools.js +1 -1
  109. package/apps/runtime/dist/plugins/events.js +2 -2
  110. package/apps/runtime/dist/plugins/jobs.js +4 -1
  111. package/apps/runtime/dist/plugins/loader.js +2 -2
  112. package/apps/runtime/dist/prompts/architect.md +3 -3
  113. package/apps/runtime/dist/prompts/authoring.md +46 -12
  114. package/apps/runtime/dist/prompts/goose.md +7 -7
  115. package/apps/runtime/dist/prompts/mcp.md +6 -6
  116. package/apps/runtime/dist/prompts/services.md +4 -4
  117. package/apps/runtime/dist/prompts/step.md +2 -2
  118. package/apps/runtime/dist/prompts/tools.md +39 -10
  119. package/apps/runtime/dist/routes/api.js +31 -20
  120. package/apps/runtime/dist/routes/broker.js +316 -0
  121. package/apps/runtime/dist/routes/connections.js +71 -0
  122. package/apps/runtime/dist/routes/delivery.js +25 -0
  123. package/apps/runtime/dist/routes/discover.js +17 -0
  124. package/apps/runtime/dist/routes/live.js +11 -1
  125. package/apps/runtime/dist/routes/person.js +4 -1
  126. package/apps/runtime/dist/routes/plugins.js +3 -1
  127. package/apps/runtime/dist/routes/rules.js +26 -0
  128. package/apps/runtime/dist/routes/runs.js +54 -33
  129. package/apps/runtime/dist/routes/skills.js +6 -6
  130. package/apps/runtime/dist/routes/studio.js +153 -144
  131. package/apps/runtime/dist/routes/work.js +199 -0
  132. package/apps/runtime/dist/sandbox/index.js +27 -0
  133. package/apps/runtime/dist/services/access.js +38 -17
  134. package/apps/runtime/dist/services/api.js +38 -13
  135. package/apps/runtime/dist/services/architect.js +3 -3
  136. package/apps/runtime/dist/services/assistant-chats.js +9 -1
  137. package/apps/runtime/dist/services/brand.js +12 -12
  138. package/apps/runtime/dist/services/broker-bell.js +69 -0
  139. package/apps/runtime/dist/services/broker-notify.js +127 -0
  140. package/apps/runtime/dist/services/client-steps.js +79 -0
  141. package/apps/runtime/dist/services/cloud.js +42 -42
  142. package/apps/runtime/dist/services/command-risk.js +51 -0
  143. package/apps/runtime/dist/services/discover.js +85 -0
  144. package/apps/runtime/dist/services/knowledge-model.js +13 -13
  145. package/apps/runtime/dist/services/knowledge.js +117 -80
  146. package/apps/runtime/dist/services/manage-reports.js +74 -7
  147. package/apps/runtime/dist/services/members-studio.js +165 -0
  148. package/apps/runtime/dist/services/onboarding.js +22 -22
  149. package/apps/runtime/dist/services/package-file.js +1 -1
  150. package/apps/runtime/dist/services/package.js +22 -22
  151. package/apps/runtime/dist/services/pages.js +7 -7
  152. package/apps/runtime/dist/services/runs.js +4 -3
  153. package/apps/runtime/dist/services/seen.js +55 -0
  154. package/apps/runtime/dist/services/shares.js +23 -13
  155. package/apps/runtime/dist/services/site.js +23 -23
  156. package/apps/runtime/dist/services/skills-registry.js +15 -15
  157. package/apps/runtime/dist/services/skills.js +44 -44
  158. package/apps/runtime/dist/services/space-categories.js +35 -35
  159. package/apps/runtime/dist/services/space-data.js +130 -111
  160. package/apps/runtime/dist/services/{project-files.js → space-files.js} +84 -75
  161. package/apps/runtime/dist/services/{project-index.js → space-index.js} +116 -73
  162. package/apps/runtime/dist/services/space-origin.js +19 -11
  163. package/apps/runtime/dist/services/spaces.js +478 -612
  164. package/apps/runtime/dist/services/synced-spaces.js +668 -0
  165. package/apps/runtime/dist/services/themes.js +15 -15
  166. package/apps/runtime/dist/services/widgets.js +6 -6
  167. package/apps/runtime/dist/services/wizards.js +112 -38
  168. package/apps/runtime/dist/services/work-ai.js +257 -0
  169. package/apps/runtime/dist/services/work-approvals.js +104 -0
  170. package/apps/runtime/dist/services/work-chats.js +908 -0
  171. package/apps/runtime/dist/services/work-connections.js +90 -0
  172. package/apps/runtime/dist/services/work-files.js +85 -0
  173. package/apps/runtime/dist/services/work-mastra.js +73 -0
  174. package/apps/runtime/dist/services/work-sandbox.js +42 -0
  175. package/apps/runtime/dist/sharing/files.js +14 -4
  176. package/apps/runtime/dist/sharing/index.js +40 -39
  177. package/apps/runtime/dist/sharing/jobs.js +67 -17
  178. package/apps/runtime/dist/sharing/targets/connector.js +10 -6
  179. package/apps/runtime/dist/sharing/targets/email.js +10 -8
  180. package/apps/runtime/dist/sharing/targets/slack.js +10 -8
  181. package/apps/runtime/dist/sharing/targets/storage.js +6 -4
  182. package/apps/runtime/dist/store/index.js +14 -3
  183. package/apps/runtime/dist/store/shared-lists.js +4 -2
  184. package/apps/runtime/dist/sync/apply.js +2 -2
  185. package/apps/runtime/dist/sync/client.js +113 -113
  186. package/apps/runtime/dist/sync/hub.js +41 -41
  187. package/apps/runtime/dist/sync/log.js +12 -12
  188. package/apps/runtime/dist/sync/records.js +118 -120
  189. package/apps/runtime/dist/texts.js +38 -2
  190. package/apps/runtime/dist/tools/connections.js +112 -0
  191. package/apps/runtime/dist/tools/connector.js +157 -67
  192. package/apps/runtime/dist/tools/index.js +28 -13
  193. package/apps/runtime/dist/tools/mail.js +40 -11
  194. package/apps/runtime/dist/tools/pages.js +11 -5
  195. package/apps/runtime/dist/tools/plugin.js +43 -7
  196. package/apps/runtime/dist/tools/skills.js +1 -1
  197. package/apps/runtime/dist/tools/{project.js → space.js} +30 -25
  198. package/apps/runtime/dist/tools/store.js +3 -2
  199. package/apps/runtime/dist/widgets/step.js +10 -10
  200. package/apps/web/dist/assets/AboutDialog-DgfeipUc.js +1 -0
  201. package/apps/web/dist/assets/CapabilitiesPage-BoYJvgIu.js +2 -0
  202. package/apps/web/dist/assets/{ChangelogDialog-SwyId00t.js → ChangelogDialog-Duab4zTO.js} +1 -1
  203. package/apps/web/dist/assets/{CodeEditor-BwZsk5Al.js → CodeEditor-nxoOt8ge.js} +1 -1
  204. package/apps/web/dist/assets/EditorPage-ZrgGpYMC.js +3 -0
  205. package/apps/web/dist/assets/{FlowPreview-DtSpjVTl.js → FlowPreview-aMfwcPul.js} +1 -1
  206. package/apps/web/dist/assets/LangSwitch-DpD0inR4.js +1 -0
  207. package/apps/web/dist/assets/Marketplace-CpzD9pNQ.js +2 -0
  208. package/apps/web/dist/assets/NewWizardChannels-IB18afWN.js +1 -0
  209. package/apps/web/dist/assets/NewWizardPage-rYbcmPGG.js +7 -0
  210. package/apps/web/dist/assets/OnboardingPage-ztHT01ah.js +1 -0
  211. package/apps/web/dist/assets/PreviewPane-DviWTLfi.js +9 -0
  212. package/apps/web/dist/assets/PublicRunner-C2geZhhM.js +1 -0
  213. package/apps/web/dist/assets/ReadOnly-kSb_Kbdm.js +1 -0
  214. package/apps/web/dist/assets/SettingsPage-DM2h8N0J.js +2 -0
  215. package/apps/web/dist/assets/SetupPage-Wfyz6xH4.js +1 -0
  216. package/apps/web/dist/assets/SharePage-CyWQorWB.js +1 -0
  217. package/apps/web/dist/assets/SkillEditor-CqQMg2MC.js +1 -0
  218. package/apps/web/dist/assets/Skills-CnhpgoOA.js +9 -0
  219. package/apps/web/dist/assets/SpacePage-q4Bk3N7k.js +2 -0
  220. package/apps/web/dist/assets/UpdateCheck-C2CE6CC3.js +2 -0
  221. package/apps/web/dist/assets/changelog-B6hN1Cp7.js +1 -0
  222. package/apps/web/dist/assets/circle-alert-C8Ma-bPY.js +1 -0
  223. package/apps/web/dist/assets/circle-check-Bu9Z3mlJ.js +1 -0
  224. package/apps/web/dist/assets/code-editor-CfTGqOpp.js +2 -0
  225. package/apps/web/dist/assets/{code-xml-TwKzzMtA.js → code-xml-B4kLFZSj.js} +1 -1
  226. package/apps/web/dist/assets/connection-sign-in-CIiv0t2p.js +1 -0
  227. package/apps/web/dist/assets/esm-Xwn4GtqG.js +7 -0
  228. package/apps/web/dist/assets/{eye-Brd-xPUJ.js → eye-BpoKpIdt.js} +1 -1
  229. package/apps/web/dist/assets/host-BrP-ENHg.css +1 -0
  230. package/apps/web/dist/assets/host-DJ7-p0Sc.js +118 -0
  231. package/apps/web/dist/assets/i18n-BJ7Ld6O6.js +55 -0
  232. package/apps/web/dist/assets/index-D18DvnxX.css +1 -0
  233. package/apps/web/dist/assets/index-D2akynS-.js +10 -0
  234. package/apps/web/dist/assets/logo-BpnjXTRy.js +1 -0
  235. package/apps/web/dist/assets/oss-credits-IdX5bc71.js +1 -0
  236. package/apps/web/dist/assets/{phone-DhkHteoJ.js → phone-Ctvf-Am-.js} +1 -1
  237. package/apps/web/dist/assets/read-aloud-Da_RSm2S.js +1 -0
  238. package/apps/web/dist/assets/{runners-G-XYaDgR.js → runners-CyIvJIHr.js} +1 -1
  239. package/apps/web/dist/assets/scroll-text-ChrjRu9Y.js +1 -0
  240. package/apps/web/dist/assets/session-SXPtTWRK.js +2 -0
  241. package/apps/web/dist/assets/theme-CbTcTFWy.js +11 -0
  242. package/apps/web/dist/assets/ui-Uqnx1UpK.js +82 -0
  243. package/apps/web/dist/assets/{upload-BYZTwJTD.js → upload-BchUnQGV.js} +1 -1
  244. package/apps/web/dist/assets/{useMutation-D0QP_k2-.js → useMutation-DEkZhp5c.js} +1 -1
  245. package/apps/web/dist/assets/{volume-2-CVHoxdGM.js → volume-2-CU_oy81Z.js} +1 -1
  246. package/apps/web/dist/assets/with-selector-CoMyWBAX.js +1 -0
  247. package/apps/web/dist/index.html +17 -10
  248. package/apps/web/dist/mcp/flow.html +119 -64
  249. package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +20 -10
  250. package/node_modules/@engenty/wizards-shared/dist/assistant.d.ts +6 -1
  251. package/node_modules/@engenty/wizards-shared/dist/assistant.js +6 -1
  252. package/node_modules/@engenty/wizards-shared/dist/connectors.d.ts +236 -2
  253. package/node_modules/@engenty/wizards-shared/dist/connectors.js +52 -2
  254. package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +150 -8
  255. package/node_modules/@engenty/wizards-shared/dist/definition.js +46 -11
  256. package/node_modules/@engenty/wizards-shared/dist/discover.d.ts +21 -0
  257. package/node_modules/@engenty/wizards-shared/dist/discover.js +1 -0
  258. package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +26 -2
  259. package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +26 -2
  260. package/node_modules/@engenty/wizards-shared/dist/fit.js +1 -1
  261. package/node_modules/@engenty/wizards-shared/dist/json-schema.d.ts +1 -1
  262. package/node_modules/@engenty/wizards-shared/dist/json-schema.js +1 -1
  263. package/node_modules/@engenty/wizards-shared/dist/live.d.ts +2 -2
  264. package/node_modules/@engenty/wizards-shared/dist/live.js +1 -1
  265. package/node_modules/@engenty/wizards-shared/dist/marketplace.js +3 -1
  266. package/node_modules/@engenty/wizards-shared/dist/run.d.ts +54 -6
  267. package/node_modules/@engenty/wizards-shared/dist/run.js +85 -0
  268. package/node_modules/@engenty/wizards-shared/dist/runner-texts.d.ts +15 -1
  269. package/node_modules/@engenty/wizards-shared/dist/runner-texts.js +14 -0
  270. package/node_modules/@engenty/wizards-shared/dist/rwx.d.ts +42 -0
  271. package/node_modules/@engenty/wizards-shared/dist/rwx.js +29 -0
  272. package/node_modules/@engenty/wizards-shared/dist/skills.d.ts +1 -1
  273. package/node_modules/@engenty/wizards-shared/dist/space-data.d.ts +2 -2
  274. package/node_modules/@engenty/wizards-shared/dist/{projects.d.ts → spaces.d.ts} +39 -15
  275. package/node_modules/@engenty/wizards-shared/dist/{projects.js → spaces.js} +16 -9
  276. package/node_modules/@engenty/wizards-shared/dist/store.d.ts +7 -2
  277. package/node_modules/@engenty/wizards-shared/dist/surface.d.ts +35 -4
  278. package/node_modules/@engenty/wizards-shared/dist/surface.js +121 -3
  279. package/node_modules/@engenty/wizards-shared/dist/sync.d.ts +1 -1
  280. package/node_modules/@engenty/wizards-shared/dist/theme-look.js +1 -1
  281. package/node_modules/@engenty/wizards-shared/dist/wizard-package.d.ts +2 -2
  282. package/node_modules/@engenty/wizards-shared/dist/wizard-package.js +3 -3
  283. package/package.json +4 -1
  284. package/plugin/.claude-plugin/plugin.json +1 -1
  285. package/plugin/plugin.json +1 -1
  286. package/plugin/skills/build-wizard/SKILL.md +1 -1
  287. package/apps/runtime/dist/services/projects.js +0 -473
  288. package/apps/web/dist/assets/AboutDialog-B-JxkELB.js +0 -1
  289. package/apps/web/dist/assets/EditorPage-DQ_2FOzI.js +0 -3
  290. package/apps/web/dist/assets/Marketplace-DoH4YO3D.js +0 -2
  291. package/apps/web/dist/assets/NewWizardChannels-Tgoexgj4.js +0 -1
  292. package/apps/web/dist/assets/NewWizardPage-B24AF482.js +0 -7
  293. package/apps/web/dist/assets/OnboardingPage-BEvq4slJ.js +0 -1
  294. package/apps/web/dist/assets/PreviewPane-B_v7Y8R7.js +0 -10
  295. package/apps/web/dist/assets/ProjectPage-ClRuhFJo.js +0 -10
  296. package/apps/web/dist/assets/PublicRunner-MicrpVsv.js +0 -1
  297. package/apps/web/dist/assets/ReadOnly-BXjv-MSv.js +0 -1
  298. package/apps/web/dist/assets/SettingsPage-DY8O1r43.js +0 -2
  299. package/apps/web/dist/assets/SetupPage-BOVkVpMu.js +0 -1
  300. package/apps/web/dist/assets/SharePage-DXGzJSnR.js +0 -1
  301. package/apps/web/dist/assets/SkillEditor-BzzTDeaU.js +0 -1
  302. package/apps/web/dist/assets/changelog-BLdS-0Bj.js +0 -1
  303. package/apps/web/dist/assets/esm-BdxDT9Km.js +0 -7
  304. package/apps/web/dist/assets/i18n-8-Sw11tB.js +0 -55
  305. package/apps/web/dist/assets/index-OsdQFHmh.js +0 -49
  306. package/apps/web/dist/assets/index-QPipX5Fi.css +0 -1
  307. package/apps/web/dist/assets/lock-C0uxcOlq.js +0 -1
  308. package/apps/web/dist/assets/logo-CGNoptDg.js +0 -1
  309. package/apps/web/dist/assets/oss-credits-DpRWUPjD.js +0 -1
  310. package/apps/web/dist/assets/session-BWI-KENJ.js +0 -2
  311. package/apps/web/dist/assets/theme-D7krsx0_.js +0 -11
  312. package/apps/web/dist/assets/ui-DSXG3f49.js +0 -83
  313. /package/apps/runtime/dist/db/migrations/tenant/{0027_space_skill.sql → 0030_space_skill.sql} +0 -0
@@ -1,21 +1,21 @@
1
1
  import { noteText } from "@engenty/wizards-shared/run";
2
- import { connectionContext } from "../connectors/index.js";
2
+ import { brokerCall, brokerConnected, brokerSend, GUEST_MAILS_PER_RUN, whereOfRun, whoOf, } from "../broker/index.js";
3
3
  import { askPerson } from "../engine/asks.js";
4
4
  import { signalChanged } from "../engine/events.js";
5
5
  import { releaseResources } from "../engine/resources.js";
6
- import { loadProject, makeContext, projectIdOf } from "../engine/runner.js";
6
+ import { loadSpace, makeContext, spaceIdOf } from "../engine/runner.js";
7
7
  import { env } from "../env.js";
8
8
  import { errorText } from "../model-errors.js";
9
9
  import { ServiceError } from "../services/errors.js";
10
10
  import { shareRun } from "../services/shares.js";
11
- import { scopeOf } from "../store/index.js";
11
+ import { holderOf, scopeOf } from "../store/index.js";
12
12
  import { serverText } from "../texts.js";
13
13
  import { SHARE_STEP } from "./agent.js";
14
14
  import { shareFiles } from "./files.js";
15
15
  import { offeredTargets, targetScope } from "./index.js";
16
16
  import { addJobEvent, createJob, finishJob, jobCount, sentCount, setWorking, workingJob, } from "./state.js";
17
17
  import { parseRecipients } from "./targets/email.js";
18
- import { ShareError, sayIn } from "./types.js";
18
+ import { line, ShareError, sayIn } from "./types.js";
19
19
  /** What the person filled in does not do: per field, what is wrong. `_files` and `_account` name the other steps. */
20
20
  export class ShareInputError extends Error {
21
21
  fields;
@@ -35,7 +35,9 @@ function publicOrigin() {
35
35
  host === "127.0.0.1" ||
36
36
  host === "[::1]");
37
37
  }
38
- function contextOf(run, projectId, entry, who, job) {
38
+ /** A share target's account, held by the run's store like a wizard's connections. */
39
+ const heldBy = (run, def, spaceId) => ({ kind: "store_secret", def, scope: scopeOf(run), spaceId });
40
+ function contextOf(run, spaceId, entry, who, job) {
39
41
  const connection = entry.target.connection?.() ?? null;
40
42
  const signal = job?.signal ?? new AbortController().signal;
41
43
  const emit = (message) => job ? addJobEvent(run.id, job.id, sayIn(who.lang, message)) : Promise.resolve();
@@ -43,23 +45,71 @@ function contextOf(run, projectId, entry, who, job) {
43
45
  ? Promise.resolve(null)
44
46
  : askPerson(run.id, { ...question, stepId: SHARE_STEP }, signal);
45
47
  return {
46
- ...targetScope(run, projectId, who.lang),
48
+ ...targetScope(run, spaceId, who.lang),
47
49
  signal,
48
50
  member: who.member,
49
51
  sentBefore: job?.sentBefore ?? 0,
50
52
  emit,
51
53
  ask,
52
- account: () => connection ? connectionContext(scopeOf(run), connection, projectId) : Promise.resolve(null),
54
+ connected: () => connection ? brokerConnected(heldBy(run, connection, spaceId)) : Promise.resolve(null),
55
+ call: async (action, input, handler) => {
56
+ const name = sayIn(who.lang, entry.target.name);
57
+ if (!connection) {
58
+ throw new ShareError(line("shareConnectFirst", { name }));
59
+ }
60
+ // The person filled the form and sent it: a write is theirs, nothing asks again.
61
+ const out = await brokerCall({
62
+ who: whoOf(holderOf(run)),
63
+ where: whereOfRun(run, holderOf(run), spaceId),
64
+ connection: heldBy(run, connection, spaceId),
65
+ action,
66
+ input,
67
+ ctx: { ask, confirmed: true },
68
+ handler,
69
+ });
70
+ if (!out.ok) {
71
+ throw new ShareError(out.refused === "not_connected"
72
+ ? line("shareConnectFirst", { name })
73
+ : (refusalLine(out.refused) ?? out.reason));
74
+ }
75
+ return out.result;
76
+ },
77
+ sendFromServer: async (recipients, input, handler) => {
78
+ const out = await brokerSend({
79
+ who: whoOf(holderOf(run)),
80
+ where: whereOfRun(run, holderOf(run), spaceId),
81
+ recipients,
82
+ input,
83
+ handler,
84
+ });
85
+ if (!out.ok) {
86
+ throw new ShareError(refusalLine(out.refused) ?? out.reason);
87
+ }
88
+ return out.result;
89
+ },
53
90
  link: async () => (publicOrigin() ? (await shareRun(run)).url : null),
54
- step: async () => makeContext(run, await loadProject(run), structuredClone(run.state), signal, {
91
+ step: async () => makeContext(run, await loadSpace(run), structuredClone(run.state), signal, {
55
92
  stepId: SHARE_STEP,
56
93
  emit: (_type, message) => emit(typeof message === "string" ? message : noteText(message, who.lang)),
57
94
  ask,
58
95
  }),
59
96
  };
60
97
  }
61
- async function entryOf(run, projectId, key, member) {
62
- const entry = (await offeredTargets(run, projectId, member)).find((e) => e.key === key);
98
+ /** What the person reads when the broker refuses a guest's send; null for the other refusals. */
99
+ function refusalLine(refused) {
100
+ switch (refused) {
101
+ case "not_allowed_recipient":
102
+ return line("shareGuestRecipient");
103
+ case "run_limit":
104
+ return line("shareGuestRunMails", { mails: GUEST_MAILS_PER_RUN });
105
+ case "day_limit":
106
+ return line("shareGuestDayMails");
107
+ default:
108
+ return null;
109
+ }
110
+ }
111
+ async function entryOf(run, spaceId, key, member) {
112
+ const entry = (await offeredTargets(run, spaceId, member)).find((e) => e.key === key);
63
113
  if (!entry) {
64
114
  throw new ServiceError("not_found", { server: "shareTargetUnknown" });
65
115
  }
@@ -81,8 +131,8 @@ export async function startShare(run, request, who) {
81
131
  throw new ServiceError("refused", { server: "shareTooOften" });
82
132
  }
83
133
  const lang = request.lang ?? "en";
84
- const projectId = await projectIdOf(run);
85
- const entry = await entryOf(run, projectId, request.target, who.member);
134
+ const spaceId = await spaceIdOf(run);
135
+ const entry = await entryOf(run, spaceId, request.target, who.member);
86
136
  const { target } = entry;
87
137
  const values = {};
88
138
  const errors = {};
@@ -114,7 +164,7 @@ export async function startShare(run, request, who) {
114
164
  errors._files = serverText(lang, "sharePickFile");
115
165
  }
116
166
  const connection = target.connection?.() ?? null;
117
- if (connection && !(await connectionContext(scopeOf(run), connection, projectId))) {
167
+ if (connection && !(await brokerConnected(heldBy(run, connection, spaceId)))) {
118
168
  errors._account = serverText(lang, "shareConnectAccount");
119
169
  }
120
170
  if (Object.keys(errors).length) {
@@ -129,7 +179,7 @@ export async function startShare(run, request, who) {
129
179
  });
130
180
  const abort = new AbortController();
131
181
  setWorking(run.id, { jobId: job.id, abort });
132
- const ctx = contextOf(run, projectId, entry, { member: who.member, lang }, { id: job.id, signal: abort.signal, sentBefore: await sentCount(run.id, target.id) });
182
+ const ctx = contextOf(run, spaceId, entry, { member: who.member, lang }, { id: job.id, signal: abort.signal, sentBefore: await sentCount(run.id, target.id) });
133
183
  void (async () => {
134
184
  try {
135
185
  if (items.length) {
@@ -177,10 +227,10 @@ export async function cancelShare(runId, jobId) {
177
227
  }
178
228
  /** The choices of a form field that come from the connected account (Slack's channels). */
179
229
  export async function shareChoices(run, key, field, who) {
180
- const projectId = await projectIdOf(run);
181
- const entry = await entryOf(run, projectId, key, who.member);
230
+ const spaceId = await spaceIdOf(run);
231
+ const entry = await entryOf(run, spaceId, key, who.member);
182
232
  if (!entry.target.choices) {
183
233
  return [];
184
234
  }
185
- return entry.target.choices(field, contextOf(run, projectId, entry, who, null));
235
+ return entry.target.choices(field, contextOf(run, spaceId, entry, who, null));
186
236
  }
@@ -1,3 +1,4 @@
1
+ import { reachesOutside } from "../../broker/index.js";
1
2
  import { refreshConnector, resolveConnector } from "../../connectors/external.js";
2
3
  import { toolsOf } from "../../tools/connector.js";
3
4
  import { runShareAgent } from "../agent.js";
@@ -8,12 +9,14 @@ const RULES = [
8
9
  "To send a file, give `file:<name>` with the file's name as listed, where an action's input asks for `*_base64`.",
9
10
  ].join("\n");
10
11
  /**
11
- * The result through any connector that can write: one the product ships, or one the project
12
+ * The result through any connector that can write: one the product ships, or one the space
12
13
  * imported from the integrations registry (Notion, WordPress, an ads account …). The person
13
14
  * says in their words what should happen; an agent does it with the connector's actions.
14
15
  */
15
16
  export function connectorTarget(connector, imported) {
16
17
  const id = `connector:${connector.id}`;
18
+ // Its actions go through the connector tools of the agent step; this is the tool list's refresh.
19
+ reachesOutside(id, { connection: `share:${id}`, action: "list_tools", kind: "read" });
17
20
  const connection = (actions) => ({
18
21
  id: `share:${id}`,
19
22
  connector: connector.id,
@@ -27,7 +30,7 @@ export function connectorTarget(connector, imported) {
27
30
  icon: "plug",
28
31
  takes: "files",
29
32
  agent: true,
30
- // What the project imported it wants to use; what ships with the product is named by the wizard.
33
+ // What the space imported it wants to use; what ships with the product is named by the wizard.
31
34
  byDefault: imported,
32
35
  connection: () => connection(connector.actions.map((a) => a.id)),
33
36
  fields: [
@@ -40,15 +43,16 @@ export function connectorTarget(connector, imported) {
40
43
  },
41
44
  ],
42
45
  async send(input, ctx) {
43
- const account = await ctx.account();
44
- if (!account) {
46
+ if (!(await ctx.connected())) {
45
47
  throw new ShareError(line("shareConnectFirst", { name: connector.name }));
46
48
  }
47
49
  // An MCP server that lists its tools only to a signed-in account: ask it now.
48
50
  if (imported && !connector.actions.length) {
49
- await refreshConnector(ctx.projectId, connector.id, account.ctx.accessToken).catch(() => undefined);
51
+ await ctx
52
+ .call({ id: "list_tools", kind: "read" }, {}, (account) => refreshConnector(ctx.spaceId, connector.id, account.ctx.accessToken))
53
+ .catch(() => undefined);
50
54
  }
51
- const current = (await resolveConnector(ctx.projectId, connector.id))?.connector ?? connector;
55
+ const current = (await resolveConnector(ctx.spaceId, connector.id))?.connector ?? connector;
52
56
  return runShareAgent(ctx, input, {
53
57
  task: `In ${connector.name}: ${input.values.instructions}`,
54
58
  rules: RULES,
@@ -1,13 +1,14 @@
1
+ import { reachesOutside } from "../../broker/index.js";
1
2
  import { MAIL_SENDERS, MailTooLarge, sendAsAccount, sendFromServer, serverSender, } from "../../connectors/smtp.js";
2
3
  import { megabytes } from "../files.js";
3
4
  import { line, ShareError } from "../types.js";
4
5
  /** What mail providers take in one message, with room for the encoding. */
5
6
  const ATTACH_LIMIT = 18_000_000;
6
- /** From the server's own address, people without an account send this much per run. */
7
- const VISITOR_MAILS = 3;
7
+ /** From the server's own address, one of a visitor's mails goes to this many addresses at most. */
8
8
  const VISITOR_RECIPIENTS = 3;
9
9
  const RECIPIENTS = 20;
10
10
  const ADDRESS = /^[^\s@<>,;]+@[^\s@<>,;]+\.[^\s@<>,;]+$/;
11
+ reachesOutside("share:email", { connection: "share:email", action: "send_message", kind: "send" });
11
12
  /** "a@b.at, c@d.at; e@f.at" → the addresses; throws on one that is none. */
12
13
  export function parseRecipients(raw) {
13
14
  const list = raw
@@ -69,11 +70,11 @@ export const emailTarget = {
69
70
  text: (values.message ?? "").trim(),
70
71
  attachments: files.map((f) => ({ name: f.name, mime: f.mime, data: f.data })),
71
72
  };
72
- const account = await ctx.account();
73
+ const account = await ctx.connected();
73
74
  if (account) {
74
75
  await ctx.emit(line("shareSendingFrom", { account: account.label }));
75
76
  try {
76
- await sendAsAccount(account.connector, account.ctx, message);
77
+ await ctx.call({ id: "send_message", kind: "send" }, { to: message.to, subject: message.subject, attachments: message.attachments.length }, (held) => sendAsAccount(held.connector, held.ctx, message));
77
78
  }
78
79
  catch (err) {
79
80
  if (err instanceof MailTooLarge) {
@@ -83,12 +84,13 @@ export const emailTarget = {
83
84
  }
84
85
  }
85
86
  else if (serverSender()) {
86
- // The server's address is everyone's to send from: a visitor gets a few mails per run.
87
- if (!ctx.member && (ctx.sentBefore >= VISITOR_MAILS || to.length > VISITOR_RECIPIENTS)) {
88
- throw new ShareError(line("shareVisitorMails", { mails: VISITOR_MAILS, recipients: VISITOR_RECIPIENTS }));
87
+ // The server's address is everyone's to send from. A visitor's mail goes to a few addresses,
88
+ // and the broker holds a guest's run to its own address or the space's, a few per run and day.
89
+ if (!ctx.member && to.length > VISITOR_RECIPIENTS) {
90
+ throw new ShareError(line("shareVisitorRecipients", { recipients: VISITOR_RECIPIENTS }));
89
91
  }
90
92
  await ctx.emit(line("shareSendingFrom", { account: serverSender() ?? "" }));
91
- await sendFromServer(message);
93
+ await ctx.sendFromServer(to, { to: message.to, subject: message.subject, attachments: message.attachments.length }, () => sendFromServer(message));
92
94
  }
93
95
  else {
94
96
  throw new ShareError(line("shareConnectMailbox"));
@@ -1,4 +1,9 @@
1
+ import { reachesOutside } from "../../broker/index.js";
1
2
  import { line, ShareError } from "../types.js";
3
+ reachesOutside("share:slack", [
4
+ { connection: "share:slack", action: "list_channels", kind: "read" },
5
+ { connection: "share:slack", action: "post_message", kind: "send" },
6
+ ]);
2
7
  /**
3
8
  * A message in a Slack channel, as the person: their text and the link to the result page.
4
9
  * The connector posts text only, so files travel as the link.
@@ -29,26 +34,23 @@ export const slackTarget = {
29
34
  message: [scope.title, scope.text?.slice(0, 2500)].filter(Boolean).join("\n\n"),
30
35
  }),
31
36
  async choices(field, ctx) {
32
- const account = field === "channel" ? await ctx.account() : null;
33
- const list = account?.connector.actions.find((a) => a.id === "list_channels");
34
- if (!account || !list) {
37
+ if (field !== "channel" || !(await ctx.connected())) {
35
38
  return [];
36
39
  }
37
- const { channels } = (await list.handler({ limit: 50 }, account.ctx));
40
+ const { channels } = await ctx.call({ id: "list_channels", kind: "read" }, { limit: 50 });
38
41
  return channels
39
42
  .sort((a, b) => a.name.localeCompare(b.name))
40
43
  .map((c) => ({ value: c.id, label: `${c.is_private ? "🔒 " : "#"}${c.name}` }));
41
44
  },
42
45
  async send({ values }, ctx) {
43
- const account = await ctx.account();
44
- const post = account?.connector.actions.find((a) => a.id === "post_message");
45
- if (!account || !post) {
46
+ const account = await ctx.connected();
47
+ if (!account?.connector.actions.some((a) => a.id === "post_message")) {
46
48
  throw new ShareError(line("shareConnectFirst", { name: "Slack" }));
47
49
  }
48
50
  const link = await ctx.link();
49
51
  const text = [values.message?.trim(), link].filter(Boolean).join("\n\n");
50
52
  await ctx.emit(line("sharePostingAs", { account: account.label }));
51
- await post.handler({ channel: values.channel, text }, account.ctx);
53
+ await ctx.call({ id: "post_message", kind: "send" }, { channel: values.channel, text });
52
54
  return { summary: line("sharePostedSlack") };
53
55
  },
54
56
  };
@@ -1,3 +1,4 @@
1
+ import { reachesOutside } from "../../broker/index.js";
1
2
  import { BUILTIN_CONNECTORS } from "../../connectors/builtin.js";
2
3
  import { line, ShareError } from "../types.js";
3
4
  async function call(ctx, url, init = {}) {
@@ -127,6 +128,8 @@ export function storageTarget(connector) {
127
128
  return null;
128
129
  }
129
130
  const id = `storage:${connector.id}`;
131
+ const action = UPLOAD_ACTION[connector.id] ?? "files_write";
132
+ reachesOutside(id, { connection: `share:${id}`, action, kind: "write" });
130
133
  return {
131
134
  id,
132
135
  name: connector.name,
@@ -137,7 +140,7 @@ export function storageTarget(connector) {
137
140
  connection: () => ({
138
141
  id: `share:${id}`,
139
142
  target: { connectors: [connector.id] },
140
- actions: UPLOAD_ACTION[connector.id] ? [UPLOAD_ACTION[connector.id]] : ["files_write"],
143
+ actions: [action],
141
144
  title: connector.name,
142
145
  }),
143
146
  fields: [
@@ -151,12 +154,11 @@ export function storageTarget(connector) {
151
154
  ],
152
155
  defaults: (scope) => ({ folder: scope.run.definition.title.replace(/\//g, "-") }),
153
156
  async send({ values, files }, ctx) {
154
- const account = await ctx.account();
155
- if (!account) {
157
+ if (!(await ctx.connected())) {
156
158
  throw new ShareError(line("shareConnectFirst", { name: connector.name }));
157
159
  }
158
160
  const folder = (values.folder ?? "").trim();
159
- const link = await upload(account.ctx, folder, files, (file) => ctx.emit(line("shareUploading", { name: file.name })));
161
+ const link = await ctx.call({ id: action, kind: "write" }, { folder, files: files.map((f) => f.name) }, (account) => upload(account.ctx, folder, files, (file) => ctx.emit(line("shareUploading", { name: file.name }))));
160
162
  const where = [connector.name, folder].filter(Boolean).join(" › ");
161
163
  return { summary: line("shareSavedFiles", { count: files.length, where }), url: link };
162
164
  },
@@ -35,10 +35,13 @@ const inList = (scope, list) => and(eq(schema.storeRow.wizardId, scope.wizardId)
35
35
  function toRow(r) {
36
36
  return { id: r.id, cells: r.cells, updatedAt: r.updatedAt.toISOString() };
37
37
  }
38
- /** The rows of a list: the person's, or every run's where the list is shared. */
39
- export async function listRows(scope, def) {
38
+ /**
39
+ * The rows of a list: the person's, or every run's where the list is shared. A shared list is a
40
+ * table of the space, read as `who` may read it (broker/rwx.ts); a person's own rows are theirs.
41
+ */
42
+ export async function listRows(scope, def, who = []) {
40
43
  if (def.shared) {
41
- return sharedRows(scope.wizardId, def);
44
+ return sharedRows(scope.wizardId, def, who);
42
45
  }
43
46
  const rows = await db.query.storeRow.findMany({
44
47
  where: inList(scope, def.id),
@@ -249,6 +252,14 @@ export async function getSecret(scope, slot) {
249
252
  ? { provider: row.provider, label: row.label, data, createdAt: row.createdAt }
250
253
  : null;
251
254
  }
255
+ /** What a secret is, without the secret: who it is for and since when. For a connection's view. */
256
+ export async function peekSecret(scope, slot) {
257
+ const row = await db.query.storeSecret.findFirst({
258
+ where: and(ownSecrets(scope), eq(schema.storeSecret.slot, slot)),
259
+ columns: { provider: true, label: true, createdAt: true },
260
+ });
261
+ return row ?? null;
262
+ }
252
263
  export async function putSecret(scope, slot, provider, label, data) {
253
264
  const sealed = seal(data);
254
265
  await db
@@ -1,6 +1,7 @@
1
1
  import { firstRowAt, newCells, patchCells, rowKey, STORE_LIMITS, } from "@engenty/wizards-shared/store";
2
2
  import { and, asc, eq, inArray } from "drizzle-orm";
3
3
  import { nanoid } from "nanoid";
4
+ import { assertRwx } from "../broker/rwx.js";
4
5
  import { db, schema } from "../db/client.js";
5
6
  import { StoreError } from "./errors.js";
6
7
  const same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
@@ -23,7 +24,7 @@ export async function sharedTable(wizardId, def) {
23
24
  }
24
25
  const wizard = await db.query.wizard.findFirst({
25
26
  where: eq(schema.wizard.id, wizardId),
26
- columns: { projectId: true, tenantId: true },
27
+ columns: { spaceId: true, tenantId: true },
27
28
  });
28
29
  if (!wizard) {
29
30
  throw new StoreError("The wizard is gone.");
@@ -48,8 +49,9 @@ async function touch(tableId) {
48
49
  function toRow(r) {
49
50
  return { id: r.id, cells: r.cells, updatedAt: r.updatedAt.toISOString() };
50
51
  }
51
- export async function sharedRows(wizardId, def) {
52
+ export async function sharedRows(wizardId, def, who) {
52
53
  const table = await sharedTable(wizardId, def);
54
+ await assertRwx(table.spaceId, who, { kind: "table", id: table.id }, "r");
53
55
  const rows = await db.query.spaceTableRow.findMany({
54
56
  where: eq(schema.spaceTableRow.tableId, table.id),
55
57
  orderBy: [asc(schema.spaceTableRow.createdAt), asc(schema.spaceTableRow.id)],
@@ -24,8 +24,8 @@ export async function applyItems(items, options) {
24
24
  for (const x of sorted) {
25
25
  const def = KINDS[x.kind];
26
26
  const after = x.record
27
- ? await def.write(x.projectId, x.item, x.record)
28
- : await def.remove(x.projectId, x.item);
27
+ ? await def.write(x.spaceId, x.item, x.record)
28
+ : await def.remove(x.spaceId, x.item);
29
29
  if (after) {
30
30
  done.push(after);
31
31
  }