@engenty/wizards-runtime 0.12.2 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/runtime/dist/agents/architect.js +8 -7
- package/apps/runtime/dist/agents/goose-connections.js +82 -0
- package/apps/runtime/dist/agents/space-agent.js +9 -2
- package/apps/runtime/dist/agents/studio-assistant.js +126 -71
- package/apps/runtime/dist/agents/website.js +1 -1
- package/apps/runtime/dist/app.js +28 -3
- package/apps/runtime/dist/assistant/knows.js +6 -5
- package/apps/runtime/dist/authoring/guide.js +25 -5
- package/apps/runtime/dist/broker/account.js +166 -0
- package/apps/runtime/dist/broker/call.js +417 -0
- package/apps/runtime/dist/broker/caller.js +10 -0
- package/apps/runtime/dist/broker/grant.js +152 -0
- package/apps/runtime/dist/broker/host.js +51 -0
- package/apps/runtime/dist/broker/index.js +8 -0
- package/apps/runtime/dist/broker/kept.js +31 -0
- package/apps/runtime/dist/broker/log.js +240 -0
- package/apps/runtime/dist/broker/registry.js +9 -0
- package/apps/runtime/dist/broker/rwx.js +367 -0
- package/apps/runtime/dist/broker/send.js +189 -0
- package/apps/runtime/dist/connectors/builtin.js +1 -1
- package/apps/runtime/dist/connectors/external.js +38 -37
- package/apps/runtime/dist/connectors/index.js +30 -91
- package/apps/runtime/dist/connectors/mail.js +0 -8
- package/apps/runtime/dist/connectors/person-sign-ins.js +73 -0
- package/apps/runtime/dist/connectors/plugin-connections.js +65 -92
- package/apps/runtime/dist/connectors/smtp.js +1 -1
- package/apps/runtime/dist/connectors/space-connections.js +436 -0
- package/apps/runtime/dist/credits/estimate.js +3 -3
- package/apps/runtime/dist/db/adopt.js +3 -3
- package/apps/runtime/dist/db/client.js +9 -0
- package/apps/runtime/dist/db/live-triggers.js +65 -23
- package/apps/runtime/dist/db/migrations/tenant/0027_work_chats.sql +52 -0
- package/apps/runtime/dist/db/migrations/tenant/0028_chat_approvals.sql +17 -0
- package/apps/runtime/dist/db/migrations/tenant/0029_work_chats_live.sql +49 -0
- package/apps/runtime/dist/db/migrations/tenant/0031_space.sql +624 -0
- package/apps/runtime/dist/db/migrations/tenant/0032_rwx_rule.sql +18 -0
- package/apps/runtime/dist/db/migrations/tenant/0033_broker_log.sql +23 -0
- package/apps/runtime/dist/db/migrations/tenant/0034_space_connection.sql +35 -0
- package/apps/runtime/dist/db/migrations/tenant/0035_run_grant.sql +1 -0
- package/apps/runtime/dist/db/migrations/tenant/0036_approval_held_for.sql +1 -0
- package/apps/runtime/dist/db/migrations/tenant/0037_ways_out.sql +5 -0
- package/apps/runtime/dist/db/migrations/tenant/0038_heard.sql +11 -0
- package/apps/runtime/dist/db/migrations/tenant/0039_members_studio.sql +1 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0027_snapshot.json +383 -155
- package/apps/runtime/dist/db/migrations/tenant/meta/0028_snapshot.json +4468 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0029_snapshot.json +4475 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0030_snapshot.json +4629 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0031_snapshot.json +4629 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0032_snapshot.json +4757 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0033_snapshot.json +5039 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0034_snapshot.json +5022 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0035_snapshot.json +5029 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0036_snapshot.json +5037 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0037_snapshot.json +5076 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0038_snapshot.json +5145 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0039_snapshot.json +5153 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +86 -2
- package/apps/runtime/dist/db/schema.js +295 -72
- package/apps/runtime/dist/docs/dev/architecture.md +215 -0
- package/apps/runtime/dist/docs/dev/broker.md +298 -0
- package/apps/runtime/dist/docs/dev/index.md +5 -1
- package/apps/runtime/dist/docs/dev/integration/index.md +2 -0
- package/apps/runtime/dist/docs/dev/meta.json +3 -0
- package/apps/runtime/dist/docs/dev/plugins/connections.md +8 -5
- package/apps/runtime/dist/docs/dev/plugins/events.md +1 -1
- package/apps/runtime/dist/docs/dev/plugins/examples.md +1 -0
- package/apps/runtime/dist/docs/dev/plugins/index.md +2 -2
- package/apps/runtime/dist/docs/dev/plugins/reference.md +3 -2
- package/apps/runtime/dist/docs/dev/plugins/space.md +16 -6
- package/apps/runtime/dist/docs/dev/plugins/studio.md +2 -2
- package/apps/runtime/dist/docs/dev/plugins/tools.md +0 -1
- package/apps/runtime/dist/docs/dev/skills.md +16 -9
- package/apps/runtime/dist/docs/dev/wizard-format/agent-steps.md +59 -6
- package/apps/runtime/dist/docs/dev/wizard-format/lists-and-connections.md +17 -2
- package/apps/runtime/dist/docs/dev/wizard-format/templates.md +2 -0
- package/apps/runtime/dist/docs/dev/wizard-format/views-and-widgets.md +22 -2
- package/apps/runtime/dist/docs/user-guide/capabilities.md +132 -0
- package/apps/runtime/dist/docs/user-guide/cloud-sync.md +2 -0
- package/apps/runtime/dist/docs/user-guide/command-line.md +1 -0
- package/apps/runtime/dist/docs/user-guide/connectors.md +63 -7
- package/apps/runtime/dist/docs/user-guide/index.md +10 -1
- package/apps/runtime/dist/docs/user-guide/meta.json +6 -1
- package/apps/runtime/dist/docs/user-guide/models.md +105 -30
- package/apps/runtime/dist/docs/user-guide/protocol.md +80 -0
- package/apps/runtime/dist/docs/user-guide/skills.md +8 -4
- package/apps/runtime/dist/docs/user-guide/space.md +5 -4
- package/apps/runtime/dist/docs/user-guide/together.md +29 -2
- package/apps/runtime/dist/docs/user-guide/troubleshooting.md +2 -2
- package/apps/runtime/dist/docs/user-guide/work-mode.md +128 -0
- package/apps/runtime/dist/engenty/connections-external/build-connector.js +2 -5
- package/apps/runtime/dist/engenty/connections-external/importer/classify.js +72 -0
- package/apps/runtime/dist/engenty/connections-google/connectors/gmail.js +1 -1
- package/apps/runtime/dist/engenty/connections-microsoft/outlook.js +3 -2
- package/apps/runtime/dist/engenty/connections-sdk/types.js +2 -0
- package/apps/runtime/dist/engenty/connections-slack/connector.js +2 -1
- package/apps/runtime/dist/engine/decide.js +1 -1
- package/apps/runtime/dist/engine/requirements.js +139 -11
- package/apps/runtime/dist/engine/resources.js +43 -12
- package/apps/runtime/dist/engine/runner.js +121 -27
- package/apps/runtime/dist/engine/steps.js +42 -16
- package/apps/runtime/dist/engine/template.js +35 -1
- package/apps/runtime/dist/env.js +9 -4
- package/apps/runtime/dist/index.js +18 -2
- package/apps/runtime/dist/link-preview.js +9 -0
- package/apps/runtime/dist/live/feed.js +2 -2
- package/apps/runtime/dist/live/origin.js +2 -2
- package/apps/runtime/dist/live/views.js +51 -26
- package/apps/runtime/dist/manage.js +32 -0
- package/apps/runtime/dist/mcp/flow-app.js +1 -1
- package/apps/runtime/dist/mcp/handler.js +55 -1
- package/apps/runtime/dist/mcp/seen.js +47 -0
- package/apps/runtime/dist/mcp/tools.js +75 -34
- package/apps/runtime/dist/models.js +203 -12
- package/apps/runtime/dist/motion-graphics/project.js +8 -8
- package/apps/runtime/dist/motion-graphics/step.js +2 -2
- package/apps/runtime/dist/motion-graphics/tools.js +1 -1
- package/apps/runtime/dist/plugins/events.js +2 -2
- package/apps/runtime/dist/plugins/jobs.js +4 -1
- package/apps/runtime/dist/plugins/loader.js +2 -2
- package/apps/runtime/dist/prompts/architect.md +3 -3
- package/apps/runtime/dist/prompts/authoring.md +46 -12
- package/apps/runtime/dist/prompts/goose.md +14 -13
- package/apps/runtime/dist/prompts/mcp.md +6 -6
- package/apps/runtime/dist/prompts/safety.md +18 -0
- package/apps/runtime/dist/prompts/services.md +4 -4
- package/apps/runtime/dist/prompts/step.md +3 -3
- package/apps/runtime/dist/prompts/tools.md +39 -10
- package/apps/runtime/dist/routes/api.js +31 -20
- package/apps/runtime/dist/routes/broker.js +316 -0
- package/apps/runtime/dist/routes/connections.js +71 -0
- package/apps/runtime/dist/routes/delivery.js +25 -0
- package/apps/runtime/dist/routes/discover.js +17 -0
- package/apps/runtime/dist/routes/live.js +11 -1
- package/apps/runtime/dist/routes/marketplace.js +3 -3
- package/apps/runtime/dist/routes/person.js +4 -1
- package/apps/runtime/dist/routes/plugins.js +3 -1
- package/apps/runtime/dist/routes/rules.js +26 -0
- package/apps/runtime/dist/routes/runs.js +59 -33
- package/apps/runtime/dist/routes/skills.js +6 -6
- package/apps/runtime/dist/routes/studio.js +256 -148
- package/apps/runtime/dist/routes/work.js +199 -0
- package/apps/runtime/dist/safety.js +60 -18
- package/apps/runtime/dist/sandbox/index.js +27 -0
- package/apps/runtime/dist/services/access.js +38 -17
- package/apps/runtime/dist/services/api.js +38 -13
- package/apps/runtime/dist/services/architect.js +3 -3
- package/apps/runtime/dist/services/assistant-chats.js +9 -1
- package/apps/runtime/dist/services/brand.js +12 -12
- package/apps/runtime/dist/services/broker-bell.js +69 -0
- package/apps/runtime/dist/services/broker-notify.js +127 -0
- package/apps/runtime/dist/services/client-steps.js +79 -0
- package/apps/runtime/dist/services/cloud.js +42 -42
- package/apps/runtime/dist/services/command-risk.js +51 -0
- package/apps/runtime/dist/services/discover.js +85 -0
- package/apps/runtime/dist/services/knowledge-model.js +13 -13
- package/apps/runtime/dist/services/knowledge.js +117 -80
- package/apps/runtime/dist/services/manage-reports.js +77 -7
- package/apps/runtime/dist/services/marketplace.js +7 -31
- package/apps/runtime/dist/services/members-studio.js +165 -0
- package/apps/runtime/dist/services/onboarding.js +22 -22
- package/apps/runtime/dist/services/package-file.js +1 -1
- package/apps/runtime/dist/services/package.js +22 -22
- package/apps/runtime/dist/services/pages.js +13 -9
- package/apps/runtime/dist/services/runs.js +4 -3
- package/apps/runtime/dist/services/seen.js +55 -0
- package/apps/runtime/dist/services/shares.js +28 -13
- package/apps/runtime/dist/services/site.js +23 -23
- package/apps/runtime/dist/services/skills-registry.js +15 -15
- package/apps/runtime/dist/services/skills.js +44 -44
- package/apps/runtime/dist/services/space-categories.js +35 -35
- package/apps/runtime/dist/services/space-data.js +130 -111
- package/apps/runtime/dist/services/{project-files.js → space-files.js} +84 -75
- package/apps/runtime/dist/services/{project-index.js → space-index.js} +116 -73
- package/apps/runtime/dist/services/space-origin.js +19 -11
- package/apps/runtime/dist/services/spaces.js +478 -598
- package/apps/runtime/dist/services/synced-spaces.js +668 -0
- package/apps/runtime/dist/services/themes.js +15 -15
- package/apps/runtime/dist/services/widgets.js +6 -6
- package/apps/runtime/dist/services/wizards.js +112 -38
- package/apps/runtime/dist/services/work-ai.js +257 -0
- package/apps/runtime/dist/services/work-approvals.js +104 -0
- package/apps/runtime/dist/services/work-chats.js +908 -0
- package/apps/runtime/dist/services/work-connections.js +90 -0
- package/apps/runtime/dist/services/work-files.js +85 -0
- package/apps/runtime/dist/services/work-mastra.js +73 -0
- package/apps/runtime/dist/services/work-sandbox.js +42 -0
- package/apps/runtime/dist/sharing/files.js +14 -4
- package/apps/runtime/dist/sharing/index.js +40 -39
- package/apps/runtime/dist/sharing/jobs.js +67 -17
- package/apps/runtime/dist/sharing/targets/connector.js +10 -6
- package/apps/runtime/dist/sharing/targets/email.js +10 -8
- package/apps/runtime/dist/sharing/targets/slack.js +10 -8
- package/apps/runtime/dist/sharing/targets/storage.js +6 -4
- package/apps/runtime/dist/store/index.js +14 -3
- package/apps/runtime/dist/store/shared-lists.js +4 -2
- package/apps/runtime/dist/sync/apply.js +2 -2
- package/apps/runtime/dist/sync/client.js +113 -113
- package/apps/runtime/dist/sync/hub.js +41 -41
- package/apps/runtime/dist/sync/log.js +12 -12
- package/apps/runtime/dist/sync/records.js +118 -120
- package/apps/runtime/dist/texts.js +44 -2
- package/apps/runtime/dist/tools/connections.js +112 -0
- package/apps/runtime/dist/tools/connector.js +157 -67
- package/apps/runtime/dist/tools/index.js +31 -15
- package/apps/runtime/dist/tools/mail.js +40 -11
- package/apps/runtime/dist/tools/pages.js +11 -5
- package/apps/runtime/dist/tools/plugin.js +43 -7
- package/apps/runtime/dist/tools/skills.js +1 -1
- package/apps/runtime/dist/tools/{project.js → space.js} +30 -25
- package/apps/runtime/dist/tools/store.js +3 -2
- package/apps/runtime/dist/widgets/step.js +10 -10
- package/apps/web/dist/assets/AboutDialog-DgfeipUc.js +1 -0
- package/apps/web/dist/assets/CapabilitiesPage-BoYJvgIu.js +2 -0
- package/apps/web/dist/assets/{ChangelogDialog-CKLgFL6r.js → ChangelogDialog-Duab4zTO.js} +1 -1
- package/apps/web/dist/assets/{CodeEditor-B3nto_26.js → CodeEditor-nxoOt8ge.js} +1 -1
- package/apps/web/dist/assets/EditorPage-ZrgGpYMC.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-zJCtixSi.js → FlowPreview-aMfwcPul.js} +1 -1
- package/apps/web/dist/assets/LangSwitch-DpD0inR4.js +1 -0
- package/apps/web/dist/assets/Marketplace-CpzD9pNQ.js +2 -0
- package/apps/web/dist/assets/NewWizardChannels-IB18afWN.js +1 -0
- package/apps/web/dist/assets/NewWizardPage-rYbcmPGG.js +7 -0
- package/apps/web/dist/assets/OnboardingPage-ztHT01ah.js +1 -0
- package/apps/web/dist/assets/PreviewPane-DviWTLfi.js +9 -0
- package/apps/web/dist/assets/PublicRunner-C2geZhhM.js +1 -0
- package/apps/web/dist/assets/ReadOnly-kSb_Kbdm.js +1 -0
- package/apps/web/dist/assets/SettingsPage-DM2h8N0J.js +2 -0
- package/apps/web/dist/assets/SetupPage-Wfyz6xH4.js +1 -0
- package/apps/web/dist/assets/SharePage-CyWQorWB.js +1 -0
- package/apps/web/dist/assets/SkillEditor-CqQMg2MC.js +1 -0
- package/apps/web/dist/assets/Skills-CnhpgoOA.js +9 -0
- package/apps/web/dist/assets/SpacePage-q4Bk3N7k.js +2 -0
- package/apps/web/dist/assets/UpdateCheck-C2CE6CC3.js +2 -0
- package/apps/web/dist/assets/changelog-B6hN1Cp7.js +1 -0
- package/apps/web/dist/assets/circle-alert-C8Ma-bPY.js +1 -0
- package/apps/web/dist/assets/circle-check-Bu9Z3mlJ.js +1 -0
- package/apps/web/dist/assets/code-editor-CfTGqOpp.js +2 -0
- package/apps/web/dist/assets/{code-xml-Hx7YxCg0.js → code-xml-B4kLFZSj.js} +1 -1
- package/apps/web/dist/assets/connection-sign-in-CIiv0t2p.js +1 -0
- package/apps/web/dist/assets/esm-Xwn4GtqG.js +7 -0
- package/apps/web/dist/assets/{eye-BkMFLnYu.js → eye-BpoKpIdt.js} +1 -1
- package/apps/web/dist/assets/host-BrP-ENHg.css +1 -0
- package/apps/web/dist/assets/host-DJ7-p0Sc.js +118 -0
- package/apps/web/dist/assets/i18n-BJ7Ld6O6.js +55 -0
- package/apps/web/dist/assets/index-D18DvnxX.css +1 -0
- package/apps/web/dist/assets/index-D2akynS-.js +10 -0
- package/apps/web/dist/assets/logo-BpnjXTRy.js +1 -0
- package/apps/web/dist/assets/oss-credits-IdX5bc71.js +1 -0
- package/apps/web/dist/assets/{phone-DMfwuh9V.js → phone-Ctvf-Am-.js} +1 -1
- package/apps/web/dist/assets/read-aloud-Da_RSm2S.js +1 -0
- package/apps/web/dist/assets/{runners-D5qz6b_s.js → runners-CyIvJIHr.js} +1 -1
- package/apps/web/dist/assets/scroll-text-ChrjRu9Y.js +1 -0
- package/apps/web/dist/assets/session-SXPtTWRK.js +2 -0
- package/apps/web/dist/assets/theme-CbTcTFWy.js +11 -0
- package/apps/web/dist/assets/ui-Uqnx1UpK.js +82 -0
- package/apps/web/dist/assets/{upload-DQJwLSGj.js → upload-BchUnQGV.js} +1 -1
- package/apps/web/dist/assets/{useMutation-C20c2EH3.js → useMutation-DEkZhp5c.js} +1 -1
- package/apps/web/dist/assets/{volume-2-CC5qamYT.js → volume-2-CU_oy81Z.js} +1 -1
- package/apps/web/dist/assets/with-selector-CoMyWBAX.js +1 -0
- package/apps/web/dist/index.html +17 -10
- package/apps/web/dist/mcp/flow.html +119 -64
- package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +20 -10
- package/node_modules/@engenty/wizards-shared/dist/assistant.d.ts +7 -1
- package/node_modules/@engenty/wizards-shared/dist/assistant.js +11 -1
- package/node_modules/@engenty/wizards-shared/dist/connectors.d.ts +236 -2
- package/node_modules/@engenty/wizards-shared/dist/connectors.js +52 -2
- package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +257 -8
- package/node_modules/@engenty/wizards-shared/dist/definition.js +113 -15
- package/node_modules/@engenty/wizards-shared/dist/discover.d.ts +21 -0
- package/node_modules/@engenty/wizards-shared/dist/discover.js +1 -0
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +38 -2
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +38 -2
- package/node_modules/@engenty/wizards-shared/dist/fit.js +1 -1
- package/node_modules/@engenty/wizards-shared/dist/json-schema.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/json-schema.js +1 -1
- package/node_modules/@engenty/wizards-shared/dist/live.d.ts +2 -2
- package/node_modules/@engenty/wizards-shared/dist/live.js +1 -1
- package/node_modules/@engenty/wizards-shared/dist/marketplace.d.ts +0 -5
- package/node_modules/@engenty/wizards-shared/dist/marketplace.js +3 -1
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +115 -6
- package/node_modules/@engenty/wizards-shared/dist/run.js +135 -0
- package/node_modules/@engenty/wizards-shared/dist/runner-texts.d.ts +15 -1
- package/node_modules/@engenty/wizards-shared/dist/runner-texts.js +14 -0
- package/node_modules/@engenty/wizards-shared/dist/rwx.d.ts +42 -0
- package/node_modules/@engenty/wizards-shared/dist/rwx.js +29 -0
- package/node_modules/@engenty/wizards-shared/dist/skills.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/space-data.d.ts +2 -2
- package/node_modules/@engenty/wizards-shared/dist/{projects.d.ts → spaces.d.ts} +39 -15
- package/node_modules/@engenty/wizards-shared/dist/{projects.js → spaces.js} +16 -9
- package/node_modules/@engenty/wizards-shared/dist/store.d.ts +7 -2
- package/node_modules/@engenty/wizards-shared/dist/surface.d.ts +35 -4
- package/node_modules/@engenty/wizards-shared/dist/surface.js +121 -3
- package/node_modules/@engenty/wizards-shared/dist/sync.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/theme-look.js +1 -1
- package/node_modules/@engenty/wizards-shared/dist/tiers.d.ts +195 -0
- package/node_modules/@engenty/wizards-shared/dist/tiers.js +98 -0
- package/node_modules/@engenty/wizards-shared/dist/wizard-package.d.ts +2 -2
- package/node_modules/@engenty/wizards-shared/dist/wizard-package.js +3 -3
- package/package.json +4 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/plugin/skills/build-wizard/SKILL.md +1 -1
- package/apps/runtime/dist/services/projects.js +0 -473
- package/apps/web/dist/assets/AboutDialog-CLgnoYTI.js +0 -1
- package/apps/web/dist/assets/EditorPage-D9JDdAAI.js +0 -3
- package/apps/web/dist/assets/Marketplace-D4e0Oac9.js +0 -2
- package/apps/web/dist/assets/NewWizardChannels-B4N7GIYh.js +0 -1
- package/apps/web/dist/assets/NewWizardPage-Dpt0Mzk8.js +0 -7
- package/apps/web/dist/assets/OnboardingPage-CDoYVjRC.js +0 -1
- package/apps/web/dist/assets/PreviewPane-DPB5nEd5.js +0 -10
- package/apps/web/dist/assets/ProjectPage-408YOoNa.js +0 -10
- package/apps/web/dist/assets/PublicRunner-BZ66xdRX.js +0 -1
- package/apps/web/dist/assets/ReadOnly-C9oGMkUB.js +0 -1
- package/apps/web/dist/assets/SettingsPage-Dq3AZwJS.js +0 -2
- package/apps/web/dist/assets/SetupPage-CP3lbyZc.js +0 -1
- package/apps/web/dist/assets/SharePage-DdMm1Y8K.js +0 -1
- package/apps/web/dist/assets/SkillEditor-b5NMFB90.js +0 -1
- package/apps/web/dist/assets/changelog-82-DHogQ.js +0 -1
- package/apps/web/dist/assets/esm-BdxDT9Km.js +0 -7
- package/apps/web/dist/assets/i18n-CKKh3Pn0.js +0 -55
- package/apps/web/dist/assets/index-Cy2NHzAx.js +0 -49
- package/apps/web/dist/assets/index-wR_-1hfN.css +0 -1
- package/apps/web/dist/assets/lock-CGXM95Mi.js +0 -1
- package/apps/web/dist/assets/logo-CGNoptDg.js +0 -1
- package/apps/web/dist/assets/oss-credits-DpRWUPjD.js +0 -1
- package/apps/web/dist/assets/session-DRy0k0nh.js +0 -2
- package/apps/web/dist/assets/theme-DNPm6r4e.js +0 -11
- package/apps/web/dist/assets/ui-CwFQAfE-.js +0 -83
- /package/apps/runtime/dist/db/migrations/tenant/{0027_space_skill.sql → 0030_space_skill.sql} +0 -0
|
@@ -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…",
|
|
@@ -117,6 +131,11 @@ const EN = {
|
|
|
117
131
|
desktopSignedIn: "Signed in. Go back to engenty wizards now.",
|
|
118
132
|
ownKeysNotInPlan: "Your own API keys aren’t part of the {plan} plan.",
|
|
119
133
|
ownKeysNotInOrganizationPlan: "Your own API keys aren’t part of the organization’s plan.",
|
|
134
|
+
ownKeysNotInPolicy: "Your organization’s admins don’t allow your own API keys.",
|
|
135
|
+
appSubscriptionRefused: "{organization} doesn’t let {app} read this space: it thinks on your own subscription, outside {tier}. Use the studio, an app with a local model, or ask an admin.",
|
|
136
|
+
appLocalRefused: "{organization} doesn’t let apps with a local model read its spaces, {app} included. Use the studio, or ask an admin.",
|
|
137
|
+
appYourTier: "your organization’s tier",
|
|
138
|
+
appPolicyUnavailable: "The organization’s model policy can’t be checked right now, so {app} can’t read its spaces. Try again in a moment.",
|
|
120
139
|
planUnavailable: "The organization’s plan can’t be checked right now. Try again later.",
|
|
121
140
|
shareEmailName: "Email",
|
|
122
141
|
shareEmailDescription: "As attachments to one or more addresses",
|
|
@@ -129,7 +148,10 @@ const EN = {
|
|
|
129
148
|
shareTooManyAddresses: "At most {max} addresses per email.",
|
|
130
149
|
shareAttachmentsTooLarge: "The attachments are {size} – too large for an email. Choose fewer files or share the link.",
|
|
131
150
|
shareMailboxLimit: "The attachments are too large for this mailbox (at most 3 MB). Choose fewer files or share the link.",
|
|
132
|
-
|
|
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.",
|
|
133
155
|
shareConnectMailbox: "Connect a mailbox first.",
|
|
134
156
|
shareSendingFrom: "Sending from {account}",
|
|
135
157
|
shareSentTo: "Sent to {to}",
|
|
@@ -207,10 +229,25 @@ const EN = {
|
|
|
207
229
|
skillUploadKind: "Upload a SKILL.md, a .zip or a .skill file.",
|
|
208
230
|
skillReadOnly: "A skill from skills.sh stays as it is. Copy it as your own skill to change it.",
|
|
209
231
|
skillsRegistryDown: "skills.sh did not answer. Try again in a moment.",
|
|
232
|
+
connectorsRegistryDown: "integrations.sh did not answer. Try again in a moment.",
|
|
210
233
|
skillsRegistryMissing: "skills.sh has no skill at {ref}.",
|
|
211
234
|
skillUpdateChanged: "skills.sh changed the skill again since you looked. Look at the changes once more.",
|
|
212
235
|
};
|
|
213
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",
|
|
214
251
|
keyUnknown: "Der Anbieter kennt diesen API-Key nicht.",
|
|
215
252
|
providerError: "Der Anbieter antwortet mit Fehler {status}.",
|
|
216
253
|
providerUnreachable: "Der Anbieter ist gerade nicht erreichbar.",
|
|
@@ -322,6 +359,7 @@ const DE = {
|
|
|
322
359
|
desktopSignedIn: "Angemeldet. Geh jetzt zurück zu engenty wizards.",
|
|
323
360
|
ownKeysNotInPlan: "Eigene API-Keys gibt es nicht im Paket {plan}.",
|
|
324
361
|
ownKeysNotInOrganizationPlan: "Eigene API-Keys gibt es nicht im Paket der Organisation.",
|
|
362
|
+
ownKeysNotInPolicy: "Die Admins deiner Organisation erlauben keine eigenen API-Keys.",
|
|
325
363
|
planUnavailable: "Das Paket der Organisation lässt sich gerade nicht prüfen. Versuch es später noch einmal.",
|
|
326
364
|
shareEmailName: "E-Mail",
|
|
327
365
|
shareEmailDescription: "Als Anhang an eine oder mehrere Adressen",
|
|
@@ -334,7 +372,10 @@ const DE = {
|
|
|
334
372
|
shareTooManyAddresses: "Höchstens {max} Adressen pro E-Mail.",
|
|
335
373
|
shareAttachmentsTooLarge: "Die Anhänge sind mit {size} zu groß für eine E-Mail. Wähle weniger Dateien oder teile den Link.",
|
|
336
374
|
shareMailboxLimit: "Die Anhänge sind zu groß für dieses Postfach (höchstens 3 MB). Wähle weniger Dateien oder teile den Link.",
|
|
337
|
-
|
|
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.",
|
|
338
379
|
shareConnectMailbox: "Verbinde zuerst ein Postfach.",
|
|
339
380
|
shareSendingFrom: "Sendet von {account}",
|
|
340
381
|
shareSentTo: "Gesendet an {to}",
|
|
@@ -409,6 +450,7 @@ const DE = {
|
|
|
409
450
|
skillUploadKind: "Lade eine SKILL.md, eine .zip- oder eine .skill-Datei hoch.",
|
|
410
451
|
skillReadOnly: "Ein Skill von skills.sh bleibt, wie er ist. Kopier ihn als eigenen Skill, um ihn zu ändern.",
|
|
411
452
|
skillsRegistryDown: "skills.sh antwortet nicht. Versuch es gleich noch einmal.",
|
|
453
|
+
connectorsRegistryDown: "integrations.sh antwortet nicht. Versuch es gleich noch einmal.",
|
|
412
454
|
skillsRegistryMissing: "Auf skills.sh gibt es keinen Skill unter {ref}.",
|
|
413
455
|
skillUpdateChanged: "skills.sh hat den Skill seitdem wieder geändert. Sieh dir die Änderungen noch einmal an.",
|
|
414
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 {
|
|
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
|
|
14
|
-
* changes the person's account waits for their yes
|
|
15
|
-
*
|
|
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
|
|
84
|
-
*
|
|
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(
|
|
87
|
-
|
|
88
|
-
|
|
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
|
-
/**
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
|
101
|
-
|
|
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
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
-
|
|
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
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
return {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
-
|
|
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(
|
|
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(
|
|
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
|
-
import { gatewayTools, isHarnessVendor } from "../models.js";
|
|
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 {
|
|
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.
|
|
@@ -59,7 +62,8 @@ export async function buildStepTools(step, ctx, resolved, uploads) {
|
|
|
59
62
|
const tools = {};
|
|
60
63
|
const assets = [];
|
|
61
64
|
const allowed = new Set(step.tools);
|
|
62
|
-
|
|
65
|
+
// A tier without web search leaves the tool out; the builder says so before a run.
|
|
66
|
+
if (allowed.has("web_search") && (await searchAllowed())) {
|
|
63
67
|
// Anthropic models search natively; other models search through the AI Gateway's tool.
|
|
64
68
|
if (resolved.vendor === "anthropic") {
|
|
65
69
|
tools.web_search = anthropic.tools.webSearch_20250305({ maxUses: 8 });
|
|
@@ -129,17 +133,28 @@ export async function buildStepTools(step, ctx, resolved, uploads) {
|
|
|
129
133
|
}),
|
|
130
134
|
execute: async ({ method, url, headers, json }) => {
|
|
131
135
|
const safe = await assertPublicUrl(url);
|
|
132
|
-
await
|
|
133
|
-
|
|
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,
|
|
134
140
|
method,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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) };
|
|
139
153
|
},
|
|
140
|
-
body: json !== undefined ? JSON.stringify(json) : undefined,
|
|
141
154
|
});
|
|
142
|
-
return
|
|
155
|
+
return out.ok
|
|
156
|
+
? out.result
|
|
157
|
+
: { error: prompt("tools", "note.host_not_in_grant", { host: safe.hostname }) };
|
|
143
158
|
},
|
|
144
159
|
});
|
|
145
160
|
}
|
|
@@ -147,7 +162,7 @@ export async function buildStepTools(step, ctx, resolved, uploads) {
|
|
|
147
162
|
// The browser is one page, worked step by step, and it asks the person to sign in.
|
|
148
163
|
const browser = allowed.has("browser") ? await browserTools(ctx, assets, files) : {};
|
|
149
164
|
Object.assign(tools, browser);
|
|
150
|
-
// The wizard's lists and files, the documents the person gave and the
|
|
165
|
+
// The wizard's lists and files, the documents the person gave and the space's documents are
|
|
151
166
|
// always at hand. An installed client gets tools over an MCP bridge its CLI starts for every
|
|
152
167
|
// call, seconds of its own: a step with no use for the store goes without its tools, and
|
|
153
168
|
// without others (Knowledge, a workspace file) the client answers without the bridge.
|
|
@@ -157,8 +172,9 @@ export async function buildStepTools(step, ctx, resolved, uploads) {
|
|
|
157
172
|
if (!idle) {
|
|
158
173
|
Object.assign(tools, storeTools(ctx, uploads, files));
|
|
159
174
|
}
|
|
160
|
-
Object.assign(tools, await
|
|
161
|
-
|
|
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;
|
|
162
178
|
Object.assign(tools, await skillTools(ctx, sandbox ? { handle: () => ctx.resources.sandboxHandle(), workdir: sandbox.workdir } : null));
|
|
163
179
|
Object.assign(tools, mailTools(step, ctx, files));
|
|
164
180
|
Object.assign(tools, await connectorTools(step, ctx, files));
|