@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
@@ -33,6 +33,20 @@ const EN = {
33
33
  newWizardAsk: "What is it about?",
34
34
  newWizardDone: "Done",
35
35
  templateSetUp: "I have set up the template “{title}” for you. Test it at the top right – or tell me what should be different.",
36
+ criticalMailSubject: {
37
+ one: "{space}: one line from the wizards’ connections to look at",
38
+ other: "{space}: {count} lines from the wizards’ connections to look at",
39
+ },
40
+ criticalMailIntro: "In the last hour the wizards’ connections in {space} saw these lines. None of the admins was in the studio, so they come by mail.",
41
+ criticalMailMore: { one: "… and one more line.", other: "… and {count} more lines." },
42
+ criticalMailOutro: "The bell in Work shows them, and what to do: {url}",
43
+ "criticalKind.refused_write": "Refused: a write, a delete or a send",
44
+ "criticalKind.outside_audience": "A guest reached a connection that is not for guests",
45
+ "criticalKind.host_not_in_grant": "A request to a host the run may not reach",
46
+ "criticalKind.limit_reached": "A limit was reached",
47
+ "criticalKind.sign_in_failed": "A sign-in ran out or was refused",
48
+ "criticalKind.first_use": "A connection was used for the first time",
49
+ "criticalKind.rule_changed": "A rule was changed",
36
50
  imapHint: "Gmail, iCloud, GMX and web.de need an app password (in your account’s security settings), not your normal password.",
37
51
  doingSaveLogo: "Fetching the logo…",
38
52
  doingSaveFile: "Fetching a file…",
@@ -134,7 +148,10 @@ const EN = {
134
148
  shareTooManyAddresses: "At most {max} addresses per email.",
135
149
  shareAttachmentsTooLarge: "The attachments are {size} – too large for an email. Choose fewer files or share the link.",
136
150
  shareMailboxLimit: "The attachments are too large for this mailbox (at most 3 MB). Choose fewer files or share the link.",
137
- shareVisitorMails: "From here, one run sends {mails} emails to at most {recipients} addresses each.",
151
+ shareVisitorRecipients: "From here, an email goes to at most {recipients} addresses.",
152
+ shareGuestRecipient: "From here, an email goes only to the address you gave in the wizard or to the team’s own addresses.",
153
+ shareGuestRunMails: "This run has sent its {mails} emails.",
154
+ shareGuestDayMails: "This wizard has sent its emails for today. Try again tomorrow.",
138
155
  shareConnectMailbox: "Connect a mailbox first.",
139
156
  shareSendingFrom: "Sending from {account}",
140
157
  shareSentTo: "Sent to {to}",
@@ -212,10 +229,25 @@ const EN = {
212
229
  skillUploadKind: "Upload a SKILL.md, a .zip or a .skill file.",
213
230
  skillReadOnly: "A skill from skills.sh stays as it is. Copy it as your own skill to change it.",
214
231
  skillsRegistryDown: "skills.sh did not answer. Try again in a moment.",
232
+ connectorsRegistryDown: "integrations.sh did not answer. Try again in a moment.",
215
233
  skillsRegistryMissing: "skills.sh has no skill at {ref}.",
216
234
  skillUpdateChanged: "skills.sh changed the skill again since you looked. Look at the changes once more.",
217
235
  };
218
236
  const DE = {
237
+ criticalMailSubject: {
238
+ one: "{space}: eine Zeile aus den Verbindungen der Wizards zum Nachsehen",
239
+ other: "{space}: {count} Zeilen aus den Verbindungen der Wizards zum Nachsehen",
240
+ },
241
+ criticalMailIntro: "In der letzten Stunde gab es in den Verbindungen der Wizards in {space} diese Zeilen. Keiner der Admins war im Studio, darum kommen sie per E-Mail.",
242
+ criticalMailMore: { one: "… und eine weitere Zeile.", other: "… und {count} weitere Zeilen." },
243
+ criticalMailOutro: "Die Glocke in Work zeigt sie und was du tun kannst: {url}",
244
+ "criticalKind.refused_write": "Abgelehnt: ein Schreiben, Löschen oder Senden",
245
+ "criticalKind.outside_audience": "Ein Gast hat eine Verbindung erreicht, die nicht für Gäste ist",
246
+ "criticalKind.host_not_in_grant": "Eine Anfrage an einen Host, den der Lauf nicht erreichen darf",
247
+ "criticalKind.limit_reached": "Ein Limit ist erreicht",
248
+ "criticalKind.sign_in_failed": "Eine Anmeldung ist abgelaufen oder wurde abgelehnt",
249
+ "criticalKind.first_use": "Eine Verbindung wurde zum ersten Mal verwendet",
250
+ "criticalKind.rule_changed": "Eine Regel wurde geändert",
219
251
  keyUnknown: "Der Anbieter kennt diesen API-Key nicht.",
220
252
  providerError: "Der Anbieter antwortet mit Fehler {status}.",
221
253
  providerUnreachable: "Der Anbieter ist gerade nicht erreichbar.",
@@ -340,7 +372,10 @@ const DE = {
340
372
  shareTooManyAddresses: "Höchstens {max} Adressen pro E-Mail.",
341
373
  shareAttachmentsTooLarge: "Die Anhänge sind mit {size} zu groß für eine E-Mail. Wähle weniger Dateien oder teile den Link.",
342
374
  shareMailboxLimit: "Die Anhänge sind zu groß für dieses Postfach (höchstens 3 MB). Wähle weniger Dateien oder teile den Link.",
343
- shareVisitorMails: "Von hier gehen pro Lauf {mails} E-Mails an je höchstens {recipients} Adressen.",
375
+ shareVisitorRecipients: "Von hier geht eine E-Mail an höchstens {recipients} Adressen.",
376
+ shareGuestRecipient: "Von hier geht eine E-Mail nur an die Adresse, die du im Wizard angegeben hast, oder an Adressen des Teams.",
377
+ shareGuestRunMails: "Dieser Lauf hat seine {mails} E-Mails gesendet.",
378
+ shareGuestDayMails: "Dieser Wizard hat seine E-Mails für heute gesendet. Versuch es morgen wieder.",
344
379
  shareConnectMailbox: "Verbinde zuerst ein Postfach.",
345
380
  shareSendingFrom: "Sendet von {account}",
346
381
  shareSentTo: "Gesendet an {to}",
@@ -415,6 +450,7 @@ const DE = {
415
450
  skillUploadKind: "Lade eine SKILL.md, eine .zip- oder eine .skill-Datei hoch.",
416
451
  skillReadOnly: "Ein Skill von skills.sh bleibt, wie er ist. Kopier ihn als eigenen Skill, um ihn zu ändern.",
417
452
  skillsRegistryDown: "skills.sh antwortet nicht. Versuch es gleich noch einmal.",
453
+ connectorsRegistryDown: "integrations.sh antwortet nicht. Versuch es gleich noch einmal.",
418
454
  skillsRegistryMissing: "Auf skills.sh gibt es keinen Skill unter {ref}.",
419
455
  skillUpdateChanged: "skills.sh hat den Skill seitdem wieder geändert. Sieh dir die Änderungen noch einmal an.",
420
456
  };
@@ -0,0 +1,112 @@
1
+ import { createTool } from "@mastra/core/tools";
2
+ import { brokerCall, inAudience, kindOf, reachesOutside, } from "../broker/index.js";
3
+ import { resolveConnector } from "../connectors/external.js";
4
+ import { prompt } from "../prompts.js";
5
+ import { attempt, clip } from "./shared.js";
6
+ const TOOL_NAME = /^[a-zA-Z0-9_-]{1,64}$/;
7
+ /** A tool's name: the connector's prefix, the connection (two of one service in a space are two), the action. */
8
+ export const connectionToolName = (connector, row, actionId) => `${connector.toolPrefix}_${row.id}_${actionId}`;
9
+ /**
10
+ * The connections among `rows` this caller may use: in their audience, with their connector, and
11
+ * the actions each is for (every action of the connector where the row names none). A connection
12
+ * whose connector is gone is left out.
13
+ */
14
+ export async function usableConnections(rows, who) {
15
+ const usable = [];
16
+ for (const row of rows) {
17
+ if (!inAudience(row.audience, who)) {
18
+ continue;
19
+ }
20
+ const found = await resolveConnector(row.spaceId, row.connectorId);
21
+ if (!found) {
22
+ continue;
23
+ }
24
+ const actions = found.connector.actions.filter((a) => !row.actions.length || row.actions.includes(a.id));
25
+ usable.push({ row, connector: found.connector, actions });
26
+ }
27
+ return usable;
28
+ }
29
+ /** The connections' actions as the chat's tools, by name; one whose name no model takes is left out. */
30
+ export function connectionToolsOf(connections) {
31
+ const tools = [];
32
+ for (const { row, connector, actions } of connections) {
33
+ for (const action of actions) {
34
+ const name = connectionToolName(connector, row, action.id);
35
+ if (TOOL_NAME.test(name)) {
36
+ const kind = kindOf(action.group);
37
+ reachesOutside(name, { connection: row.id, action: action.id, kind });
38
+ tools.push({ name, row, connector, action, kind });
39
+ }
40
+ }
41
+ }
42
+ return tools;
43
+ }
44
+ /** What the model reads when the broker refuses a call. */
45
+ export function connectionRefusalNote(refused, service) {
46
+ switch (refused) {
47
+ case "not_connected":
48
+ return prompt("tools", "note.connector_not_connected", { service });
49
+ case "nobody":
50
+ return prompt("tools", "note.connection_nobody");
51
+ case "declined":
52
+ return prompt("tools", "note.connector_declined");
53
+ case "needs_approval":
54
+ return prompt("tools", "note.connector_needs_approval", { service });
55
+ default:
56
+ return prompt("tools", "note.connector_refused", { service });
57
+ }
58
+ }
59
+ /** The tool's answer to the model: the action's result as text, or why nothing ran. */
60
+ export function connectionResult(out, service) {
61
+ if (!out.ok) {
62
+ return { error: connectionRefusalNote(out.refused, service) };
63
+ }
64
+ const text = typeof out.result === "string" ? out.result : JSON.stringify(out.result);
65
+ return { result: clip(text ?? "", 8000) };
66
+ }
67
+ /** One action, called through the broker as this caller. */
68
+ export function callConnection(tool, who, where, input, ctx) {
69
+ return brokerCall({
70
+ who,
71
+ where,
72
+ connection: { kind: "space_connection", row: tool.row, connector: tool.connector },
73
+ action: { id: tool.action.id, kind: tool.kind },
74
+ input: input ?? {},
75
+ ctx,
76
+ });
77
+ }
78
+ /** A text that ends as a sentence, so the notes after it read as their own. */
79
+ const sentence = (text) => (/[.!?]$/.test(text.trim()) ? text.trim() : `${text.trim()}.`);
80
+ /**
81
+ * The tools: reads call the broker as `who`; a write, a send or a delete is a confirmed action
82
+ * (`writeNote` says so to the model) that `write` runs. `labels` says how the chat names each
83
+ * tool: the connection, then the action.
84
+ */
85
+ export function makeConnectionTools(options) {
86
+ const tools = {};
87
+ const writes = new Set();
88
+ const labels = {};
89
+ for (const tool of options.tools) {
90
+ const { row, connector, action, name } = tool;
91
+ const service = `${row.name} (${connector.name})`;
92
+ const does = sentence(`${service}: ${action.description || action.summary}`);
93
+ const read = tool.kind === "read";
94
+ tools[name] = createTool({
95
+ id: name,
96
+ description: [does, read ? "" : options.writeNote(tool)]
97
+ .filter(Boolean)
98
+ .join(" ")
99
+ .slice(0, 1100),
100
+ inputSchema: action.inputSchema,
101
+ // A read's failure is the model's to hear; what a confirmed action throws is the chat's.
102
+ execute: (input) => read
103
+ ? attempt(async () => connectionResult(await callConnection(tool, options.who, options.where(tool), input), service))
104
+ : options.write(tool, input),
105
+ });
106
+ if (!read) {
107
+ writes.add(name);
108
+ }
109
+ labels[name] = { plugin: row.name, tool: action.summary || action.id, label: null };
110
+ }
111
+ return { tools, writes, labels };
112
+ }
@@ -1,22 +1,27 @@
1
+ import { note } from "@engenty/wizards-shared/run";
1
2
  import { createTool } from "@mastra/core/tools";
2
3
  import { z } from "zod";
4
+ import { brokerCall, decide, kindOf, reachesOutside, whereOf, } from "../broker/index.js";
3
5
  import { refreshConnector, resolveConnector } from "../connectors/external.js";
4
- import { connectionContext } from "../connectors/index.js";
6
+ import { spaceConnectionOf } from "../connectors/space-connections.js";
7
+ import { StepError } from "../engine/types.js";
5
8
  import { prompt } from "../prompts.js";
6
9
  import { inProgram } from "./code.js";
10
+ import { holderWho, stepWho } from "./plugin.js";
7
11
  import { attempt, clip } from "./shared.js";
8
12
  import { resolveFile } from "./store.js";
9
13
  /** Above this many actions a connector is offered as "find an action, then call it". */
10
14
  const DIRECT_TOOLS = 24;
11
15
  const TOOL_NAME = /^[a-zA-Z0-9_-]{1,64}$/;
12
16
  /**
13
- * The actions of imported connectors a step may use, as tools. Reading is free; anything that
14
- * changes the person's account waits for their yes — engenty's default policy for connectors
15
- * (read: allow, write and destructive: ask), asked of the person who is running the wizard.
17
+ * The actions of connectors a step may use, as tools. On the wizard's own connection reading is
18
+ * free and anything that changes the person's account waits for their yes (read: allow, write
19
+ * and destructive: ask), asked of the person who is running the wizard. On a connection of the
20
+ * space its audience and rules decide (broker/call.ts).
16
21
  */
17
22
  export async function connectorTools(step, ctx, files) {
18
23
  const tools = {};
19
- const connections = (ctx.def.connections ?? []).filter((c) => c.connector && step.connections?.includes(c.id));
24
+ const connections = (ctx.def.connections ?? []).filter((c) => (c.connector || c.spaceConnection) && step.connections?.includes(c.id));
20
25
  for (const connection of connections) {
21
26
  Object.assign(tools, await toolsOf(connection, ctx, files));
22
27
  }
@@ -80,82 +85,167 @@ async function sendContent(input, ctx) {
80
85
  /** A text that ends as a sentence, so the notes after it read as their own. */
81
86
  const sentence = (text) => (/[.!?]$/.test(text.trim()) ? text.trim() : `${text.trim()}.`);
82
87
  /**
83
- * Whether the person is asked before an action runs. The wizard's author can settle it per
84
- * action (a server may call a plain lookup a change); deleting is never taken off the person.
88
+ * Whether the person is asked before an action runs: the broker's decision for this step, with
89
+ * no side effect. The wizard's author can settle it per action (`connection.policy`); deleting is
90
+ * never taken off the person.
85
91
  */
86
- function asks(connection, action) {
87
- if (action.group === "destructive") {
88
- return true;
92
+ function asks(held, action, ctx) {
93
+ return (decide({
94
+ who: holderWho(ctx),
95
+ where: whereOf(ctx),
96
+ connection: held,
97
+ actionId: action.id,
98
+ kind: kindOf(action.group),
99
+ }).outcome === "ask");
100
+ }
101
+ /** What the model reads when the broker refuses a call. */
102
+ function refusalNote(refused, service) {
103
+ switch (refused) {
104
+ case "not_connected":
105
+ return prompt("tools", "note.connector_not_connected", { service });
106
+ case "nobody":
107
+ return inProgram()
108
+ ? prompt("tools", "note.connector_in_program")
109
+ : prompt("tools", "note.connector_nobody");
110
+ case "declined":
111
+ return prompt("tools", "note.connector_declined");
112
+ case "needs_approval":
113
+ return prompt("tools", "note.connector_needs_approval", { service });
114
+ case "ai_step_writes":
115
+ return prompt("tools", "note.connector_ai_step_writes", { service });
116
+ default:
117
+ return prompt("tools", "note.connector_refused", { service });
89
118
  }
90
- return (connection.policy?.[action.id] ?? (action.group === "read" ? "allow" : "ask")) === "ask";
91
119
  }
92
- /** One connection's actions as tools — for a step that lists it, or a share job that sends through it. */
93
- export async function toolsOf(connection, ctx, files) {
94
- const projectId = ctx.project.id;
95
- const id = connection.connector ?? "";
96
- let resolved = await resolveConnector(projectId, id);
120
+ /**
121
+ * The connection behind a wizard's `connections` entry: a connection of the space (its row says
122
+ * which connector and which actions it is for) or the wizard's own sign-in. Null where the space
123
+ * no longer has it. An MCP server that lists its tools only to a signed-in account is asked now
124
+ * that there is one.
125
+ */
126
+ async function heldOf(connection, ctx, who) {
127
+ const spaceId = ctx.space.id;
128
+ const ofSpace = connection.spaceConnection
129
+ ? await spaceConnectionOf(spaceId, connection.spaceConnection)
130
+ : null;
131
+ if (connection.spaceConnection && !ofSpace) {
132
+ return null;
133
+ }
134
+ const id = ofSpace?.connectorId ?? connection.connector ?? "";
135
+ let resolved = await resolveConnector(spaceId, id);
97
136
  if (!resolved) {
98
- return {};
137
+ return null;
99
138
  }
100
- const account = () => connectionContext(ctx.store, connection, projectId);
101
- // An MCP server that lists its tools only to a signed-in account: ask it now that there is one.
139
+ const held = ofSpace
140
+ ? { kind: "space_connection", row: ofSpace, connector: resolved.connector }
141
+ : { kind: "store_secret", def: connection, scope: ctx.store, spaceId };
102
142
  if (resolved.imported && !resolved.connector.actions.length) {
103
- const found = await account();
104
- if (found) {
105
- await refreshConnector(projectId, id, found.ctx.accessToken).catch(() => undefined);
106
- resolved = (await resolveConnector(projectId, id)) ?? resolved;
143
+ const refreshed = await brokerCall({
144
+ who,
145
+ where: whereOf(ctx),
146
+ connection: held,
147
+ action: { id: "list_tools", kind: "read" },
148
+ input: {},
149
+ handler: (account) => refreshConnector(spaceId, id, account.ctx.accessToken),
150
+ }).catch(() => null);
151
+ if (refreshed?.ok) {
152
+ resolved = (await resolveConnector(spaceId, id)) ?? resolved;
153
+ if (held.kind === "space_connection") {
154
+ held.connector = resolved.connector;
155
+ }
107
156
  }
108
157
  }
158
+ return { held, resolved };
159
+ }
160
+ /**
161
+ * A fixed step's `call` on a connection: one action, its input filled from the run's values, no
162
+ * model. It calls as the step, for the person running the wizard, and the broker decides as for
163
+ * any call: on the wizard's own connection a write asks that person; on a connection of the
164
+ * space its rules decide, and this is the one way a run writes as the space. What the broker
165
+ * refuses is the step's error.
166
+ */
167
+ export async function callConnection(call, input, ctx) {
168
+ const connection = (ctx.def.connections ?? []).find((c) => c.id === call.connection);
169
+ if (!connection) {
170
+ throw new StepError(note("stepCallsUnknownConnection", { id: call.connection }));
171
+ }
172
+ const who = stepWho(ctx);
173
+ const found = await heldOf(connection, ctx, who);
174
+ if (!found) {
175
+ throw new StepError(note("connectorGone", { id: connection.spaceConnection ?? connection.connector ?? "" }));
176
+ }
177
+ const { held, resolved } = found;
178
+ const service = connection.title ?? resolved.connector.name;
179
+ const action = resolved.connector.actions.find((a) => a.id === call.action);
180
+ if (!action) {
181
+ throw new StepError(note("connectorNoAction", { name: service, id: call.action }));
182
+ }
183
+ const out = await brokerCall({
184
+ who,
185
+ where: whereOf(ctx),
186
+ connection: held,
187
+ action: { id: action.id, kind: kindOf(action.group) },
188
+ input: input ?? {},
189
+ ctx: { ask: ctx.ask, allowed: ctx.resources.allowed },
190
+ handler: async (account) => {
191
+ await ctx.emit("tool", `${service}: ${action.summary || action.id}`.slice(0, 120));
192
+ return action.handler(await sendContent(input ?? {}, ctx), account.ctx);
193
+ },
194
+ });
195
+ if (!out.ok) {
196
+ throw new StepError(out.refused === "declined" || out.refused === "nobody"
197
+ ? note("stepCallNotAllowed", { service })
198
+ : note("stepCallRefused", { service, action: action.id, reason: out.reason }));
199
+ }
200
+ return out.result;
201
+ }
202
+ /** One connection's actions as tools — for a step that lists it, or a share job that sends through it. */
203
+ export async function toolsOf(connection, ctx, files) {
204
+ const who = holderWho(ctx);
205
+ const found = await heldOf(connection, ctx, who);
206
+ if (!found) {
207
+ return {};
208
+ }
209
+ const { held, resolved } = found;
210
+ const ofSpace = held.kind === "space_connection" ? held.row : null;
211
+ const where = whereOf(ctx);
109
212
  const { connector, inputSchema } = resolved;
110
- const usable = connection.actions
213
+ // The wizard names actions, or gets the reads; a connection of the space narrows them to what it
214
+ // is for, and one that signs in as the space to its reads: a write there is a fixed step's.
215
+ const usable = (connection.actions
111
216
  ? connector.actions.filter((a) => connection.actions?.includes(a.id))
112
- : connector.actions.filter((a) => a.group === "read");
217
+ : connector.actions.filter((a) => a.group === "read"))
218
+ .filter((a) => !ofSpace?.actions.length || ofSpace.actions.includes(a.id))
219
+ .filter((a) => ofSpace?.signIn !== "space" || a.group === "read");
113
220
  const service = connection.title ?? connector.name;
221
+ const prefix = connector.toolPrefix;
222
+ for (const action of usable) {
223
+ reachesOutside(`${prefix}_${action.id}`, {
224
+ connection: connection.id,
225
+ action: action.id,
226
+ kind: kindOf(action.group),
227
+ });
228
+ }
114
229
  const call = (action, input) => attempt(async () => {
115
- const found = await account();
116
- if (!found) {
117
- return {
118
- error: prompt("tools", "note.connector_not_connected", { service }),
119
- };
120
- }
121
- const key = `${connection.id}:${action.id}`;
122
- if (asks(connection, action) && !ctx.resources.allowed.has(key)) {
123
- if (inProgram()) {
124
- return {
125
- error: prompt("tools", "note.connector_in_program"),
126
- };
127
- }
128
- const answer = await ctx.ask({
129
- kind: "confirm",
130
- reason: action.summary || action.id,
131
- service,
132
- action: {
133
- id: action.id,
134
- summary: action.summary,
135
- destructive: action.group === "destructive",
136
- },
137
- input: JSON.stringify(input ?? {}, null, 2).slice(0, 4000),
138
- });
139
- if (!answer) {
140
- return {
141
- error: prompt("tools", "note.connector_nobody"),
142
- };
143
- }
144
- if (answer.type !== "done") {
145
- return {
146
- error: prompt("tools", "note.connector_declined"),
147
- };
148
- }
149
- if (answer.remember) {
150
- ctx.resources.allowed.add(key);
151
- }
230
+ const out = await brokerCall({
231
+ who,
232
+ where,
233
+ connection: held,
234
+ action: { id: action.id, kind: kindOf(action.group) },
235
+ input: input ?? {},
236
+ ctx: { ask: ctx.ask, allowed: ctx.resources.allowed },
237
+ handler: async (account) => {
238
+ await ctx.emit("tool", `${service}: ${action.summary || action.id}`.slice(0, 120));
239
+ return keepContent(await action.handler(await sendContent(input ?? {}, ctx), account.ctx), action, service, files);
240
+ },
241
+ });
242
+ if (!out.ok) {
243
+ return { error: refusalNote(out.refused, service) };
152
244
  }
153
- await ctx.emit("tool", `${service}: ${action.summary || action.id}`.slice(0, 120));
154
- const result = await keepContent(await action.handler(await sendContent(input ?? {}, ctx), found.ctx), action, service, files);
245
+ const result = out.result;
155
246
  const text = typeof result === "string" ? result : JSON.stringify(result);
156
247
  return { result: clip(text ?? "", 8000) };
157
248
  });
158
- const prefix = connector.toolPrefix;
159
249
  const fileNote = prompt("tools", "connector.file_note");
160
250
  const direct = usable.length <= DIRECT_TOOLS && usable.every((a) => TOOL_NAME.test(`${prefix}_${a.id}`));
161
251
  if (direct) {
@@ -165,7 +255,7 @@ export async function toolsOf(connection, ctx, files) {
165
255
  id: `${prefix}_${action.id}`,
166
256
  description: [
167
257
  sentence(`${service}: ${action.description || action.summary}`),
168
- asks(connection, action) ? prompt("tools", "connector.asks") : "",
258
+ asks(held, action, ctx) ? prompt("tools", "connector.asks") : "",
169
259
  fileNote,
170
260
  ]
171
261
  .filter(Boolean)
@@ -201,7 +291,7 @@ export async function toolsOf(connection, ctx, files) {
201
291
  actions: scored.map(({ a }) => ({
202
292
  id: a.id,
203
293
  does: a.summary || a.description.slice(0, 200),
204
- asks_person_first: asks(connection, a),
294
+ asks_person_first: asks(held, a, ctx),
205
295
  input: inputSchema(a.id),
206
296
  })),
207
297
  };
@@ -2,13 +2,14 @@ import { anthropic } from "@ai-sdk/anthropic";
2
2
  import { isTextMime } from "@engenty/wizards-shared/workspace";
3
3
  import { createTool } from "@mastra/core/tools";
4
4
  import { z } from "zod";
5
+ import { brokerHost, reachesOutside, whereOf, whoOf } from "../broker/index.js";
5
6
  import { documentMime, parseDocument } from "../documents/parse.js";
6
7
  import { generateImageMedia } from "../media/generate.js";
7
8
  import { markMedia } from "../media/marking.js";
8
9
  import { gatewayTools, isHarnessVendor, searchAllowed } from "../models.js";
9
10
  import { prompt } from "../prompts.js";
10
11
  import { htmlToMarkdown } from "../render/convert.js";
11
- import { sandboxCapabilities, shellToolDescription } from "../sandbox/index.js";
12
+ import { shellToolDescription } from "../sandbox/index.js";
12
13
  import { snapshotFile } from "../services/files.js";
13
14
  import { hasStoreFiles } from "../store/index.js";
14
15
  import { browserTools } from "./browser.js";
@@ -18,10 +19,12 @@ import { mailTools } from "./mail.js";
18
19
  import { assertPublicUrl, safeFetch } from "./net-guard.js";
19
20
  import { pageTools } from "./pages.js";
20
21
  import { pluginTools, spaceContextOf } from "./plugin.js";
21
- import { projectTools } from "./project.js";
22
22
  import { clip, FileKeeper } from "./shared.js";
23
23
  import { skillTools } from "./skills.js";
24
+ import { spaceTools } from "./space.js";
24
25
  import { storeTools } from "./store.js";
26
+ // A request to a host is a send to that host; the broker holds a guest's run to the hosts in its grant.
27
+ reachesOutside("http_request", { connection: "host", action: "http_request", kind: "send" });
25
28
  /**
26
29
  * Whether a fetched body is text a model can read: a text type, or no type and next to no
27
30
  * bytes that only decode as replacement or control characters.
@@ -130,17 +133,28 @@ export async function buildStepTools(step, ctx, resolved, uploads) {
130
133
  }),
131
134
  execute: async ({ method, url, headers, json }) => {
132
135
  const safe = await assertPublicUrl(url);
133
- await ctx.emit("tool", `${method} ${safe.hostname}${safe.pathname}`);
134
- const res = await safeFetch(safe.toString(), {
136
+ const out = await brokerHost({
137
+ who: whoOf(ctx.store.holder, ctx.holder.kind === "person" ? ctx.holder.role : undefined),
138
+ where: whereOf(ctx),
139
+ url: safe,
135
140
  method,
136
- signal: AbortSignal.any([ctx.signal, AbortSignal.timeout(30_000)]),
137
- headers: {
138
- ...(json !== undefined ? { "content-type": "application/json" } : {}),
139
- ...headers,
141
+ handler: async () => {
142
+ await ctx.emit("tool", `${method} ${safe.hostname}${safe.pathname}`);
143
+ const res = await safeFetch(safe.toString(), {
144
+ method,
145
+ signal: AbortSignal.any([ctx.signal, AbortSignal.timeout(30_000)]),
146
+ headers: {
147
+ ...(json !== undefined ? { "content-type": "application/json" } : {}),
148
+ ...headers,
149
+ },
150
+ body: json !== undefined ? JSON.stringify(json) : undefined,
151
+ });
152
+ return { status: res.status, body: clip(await res.text(), 8000) };
140
153
  },
141
- body: json !== undefined ? JSON.stringify(json) : undefined,
142
154
  });
143
- return { status: res.status, body: clip(await res.text(), 8000) };
155
+ return out.ok
156
+ ? out.result
157
+ : { error: prompt("tools", "note.host_not_in_grant", { host: safe.hostname }) };
144
158
  },
145
159
  });
146
160
  }
@@ -148,7 +162,7 @@ export async function buildStepTools(step, ctx, resolved, uploads) {
148
162
  // The browser is one page, worked step by step, and it asks the person to sign in.
149
163
  const browser = allowed.has("browser") ? await browserTools(ctx, assets, files) : {};
150
164
  Object.assign(tools, browser);
151
- // The wizard's lists and files, the documents the person gave and the project's documents are
165
+ // The wizard's lists and files, the documents the person gave and the space's documents are
152
166
  // always at hand. An installed client gets tools over an MCP bridge its CLI starts for every
153
167
  // call, seconds of its own: a step with no use for the store goes without its tools, and
154
168
  // without others (Knowledge, a workspace file) the client answers without the bridge.
@@ -158,8 +172,9 @@ export async function buildStepTools(step, ctx, resolved, uploads) {
158
172
  if (!idle) {
159
173
  Object.assign(tools, storeTools(ctx, uploads, files));
160
174
  }
161
- Object.assign(tools, await projectTools(ctx));
162
- const sandbox = allowed.has("sandbox") ? sandboxCapabilities() : null;
175
+ Object.assign(tools, await spaceTools(ctx));
176
+ // The run's sandbox: a guest's run has none unless SANDBOX_GUESTS says so (engine/resources.ts).
177
+ const sandbox = allowed.has("sandbox") ? ctx.resources.sandboxCapabilities() : null;
163
178
  Object.assign(tools, await skillTools(ctx, sandbox ? { handle: () => ctx.resources.sandboxHandle(), workdir: sandbox.workdir } : null));
164
179
  Object.assign(tools, mailTools(step, ctx, files));
165
180
  Object.assign(tools, await connectorTools(step, ctx, files));