@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
|
@@ -39,8 +39,8 @@ export async function followFor(tenantId, install, since, hear) {
|
|
|
39
39
|
if (e.event === "changes") {
|
|
40
40
|
const spaces = new Set();
|
|
41
41
|
for (const x of e.items) {
|
|
42
|
-
if (x.
|
|
43
|
-
spaces.add(x.
|
|
42
|
+
if (x.spaceId && !(x.seq !== undefined && pushedBy(tenantId, install, x.seq))) {
|
|
43
|
+
spaces.add(x.spaceId);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
// Its own push only: the number moves on, nothing to pull.
|
|
@@ -4,20 +4,21 @@ import { eq } from "drizzle-orm";
|
|
|
4
4
|
import { listConnectors } from "../connectors/external.js";
|
|
5
5
|
import { db, schema } from "../db/client.js";
|
|
6
6
|
import { embeddingModel } from "../models.js";
|
|
7
|
-
import { mayBuild,
|
|
7
|
+
import { mayBuild, spaceWritable } from "../services/access.js";
|
|
8
8
|
import { cloudLinked, cloudState } from "../services/cloud.js";
|
|
9
9
|
import { ServiceError } from "../services/errors.js";
|
|
10
|
+
import { closedToMe, studioOpen } from "../services/members-studio.js";
|
|
10
11
|
import { presentIn } from "../services/presence.js";
|
|
11
|
-
import { fileView, projectFiles } from "../services/project-files.js";
|
|
12
|
-
import { listProjects, ownedProject } from "../services/projects.js";
|
|
13
12
|
import { getPage, getRow, getTableHeader } from "../services/space-data.js";
|
|
13
|
+
import { fileView, spaceFiles } from "../services/space-files.js";
|
|
14
|
+
import { listSpaces, ownedSpace } from "../services/spaces.js";
|
|
14
15
|
import { publishedDefinition, translationsOf } from "../services/translations.js";
|
|
15
16
|
import { listWizards, ownedWizard, wizardMessages, wizardState } from "../services/wizards.js";
|
|
16
17
|
/** The spaces, as the studio lists them. */
|
|
17
18
|
export async function spacesView(r) {
|
|
18
|
-
const
|
|
19
|
+
const spaces = await listSpaces(r.userId, r.lang);
|
|
19
20
|
const build = await mayBuild();
|
|
20
|
-
return
|
|
21
|
+
return Promise.all(spaces.map(async (p) => ({
|
|
21
22
|
id: p.id,
|
|
22
23
|
name: p.name,
|
|
23
24
|
brand: p.brand,
|
|
@@ -29,12 +30,18 @@ export async function spacesView(r) {
|
|
|
29
30
|
origin: p.origin,
|
|
30
31
|
syncedAt: p.syncedAt?.toISOString() ?? null,
|
|
31
32
|
readOnly: p.origin === "local" || !build,
|
|
32
|
-
|
|
33
|
+
/** „Mitglieder dürfen ins Studio“: the organization's members build here too. */
|
|
34
|
+
membersStudio: p.membersStudio,
|
|
35
|
+
/** Whether this person reaches the space's Studio: a member only by the rule above. */
|
|
36
|
+
studio: await studioOpen(p),
|
|
37
|
+
/** How the admins hear of the broker's critical lines: Work's bell, the hourly mail. */
|
|
38
|
+
notify: p.notify,
|
|
39
|
+
})));
|
|
33
40
|
}
|
|
34
41
|
/** A space's wizards, as its cards show them. */
|
|
35
|
-
export async function wizardsView(r,
|
|
36
|
-
await
|
|
37
|
-
const wizards = await listWizards(r.userId,
|
|
42
|
+
export async function wizardsView(r, spaceId) {
|
|
43
|
+
await ownedSpace(r.userId, spaceId);
|
|
44
|
+
const wizards = await listWizards(r.userId, spaceId);
|
|
38
45
|
// A local install with an account: where each wizard stands in its cloud, for the cards.
|
|
39
46
|
const linked = await cloudLinked();
|
|
40
47
|
return Promise.all(wizards.map(async (w) => ({ ...w, cloud: linked ? await cloudState(w.id) : null })));
|
|
@@ -43,11 +50,11 @@ export async function wizardsView(r, projectId) {
|
|
|
43
50
|
export async function wizardView(r, id) {
|
|
44
51
|
const w = await ownedWizard(r.userId, id);
|
|
45
52
|
const messages = await wizardMessages(w.id);
|
|
46
|
-
const
|
|
53
|
+
const space = await ownedSpace(r.userId, w.spaceId);
|
|
47
54
|
return {
|
|
48
55
|
...(await wizardState(w)),
|
|
49
56
|
/** Shown and run here, changed elsewhere: a local install's wizard, or nothing is built here. */
|
|
50
|
-
readOnly: !(await
|
|
57
|
+
readOnly: !(await spaceWritable(space)),
|
|
51
58
|
blank: messages.length === 0 && !w.starter,
|
|
52
59
|
messages: messages.map((m) => ({
|
|
53
60
|
id: m.id,
|
|
@@ -75,18 +82,18 @@ export async function translationsView(r, wizardId) {
|
|
|
75
82
|
};
|
|
76
83
|
}
|
|
77
84
|
/** What a space holds for all its wizards. */
|
|
78
|
-
export async function filesView(r,
|
|
79
|
-
const
|
|
85
|
+
export async function filesView(r, spaceId) {
|
|
86
|
+
const space = await ownedSpace(r.userId, spaceId);
|
|
80
87
|
return {
|
|
81
|
-
files: (await
|
|
88
|
+
files: (await spaceFiles(space.id)).map(fileView),
|
|
82
89
|
/** Whether documents get vectors, or the index works on keywords alone. */
|
|
83
90
|
embeddings: Boolean(await embeddingModel().catch(() => null)),
|
|
84
91
|
};
|
|
85
92
|
}
|
|
86
93
|
/** The connectors a space's wizards can name. */
|
|
87
|
-
export async function connectorsView(r,
|
|
88
|
-
const
|
|
89
|
-
return listConnectors(
|
|
94
|
+
export async function connectorsView(r, spaceId) {
|
|
95
|
+
const space = await ownedSpace(r.userId, spaceId);
|
|
96
|
+
return listConnectors(space.id);
|
|
90
97
|
}
|
|
91
98
|
// --- one item, for the live stream ------------------------------------------------------------
|
|
92
99
|
const gone = (err) => err instanceof ServiceError && err.code === "not_found";
|
|
@@ -97,41 +104,59 @@ const gone = (err) => err instanceof ServiceError && err.code === "not_found";
|
|
|
97
104
|
const ITEM_VIEWS = {
|
|
98
105
|
space: async (r, x) => (await spacesView(r)).find((s) => s.id === x.item) ?? null,
|
|
99
106
|
wizard: async (r, x) => {
|
|
100
|
-
const summary = x.
|
|
101
|
-
? (await wizardsView(r, x.
|
|
107
|
+
const summary = x.spaceId
|
|
108
|
+
? (await wizardsView(r, x.spaceId)).find((w) => w.id === x.item)
|
|
102
109
|
: undefined;
|
|
103
110
|
return summary ? { summary, detail: await wizardView(r, x.item) } : null;
|
|
104
111
|
},
|
|
105
112
|
translation: async (r, x) => (x.parent ? translationsView(r, x.parent) : null),
|
|
106
113
|
message: null,
|
|
107
|
-
page: (r, x) => getPage(r.userId, x.item),
|
|
108
|
-
table: (r, x) => getTableHeader(r.userId, x.item),
|
|
114
|
+
page: (r, x) => getPage(r.userId, x.item, r.who),
|
|
115
|
+
table: (r, x) => getTableHeader(r.userId, x.item, r.who),
|
|
109
116
|
row: async (r, x) => {
|
|
110
|
-
const row = x.parent ? await getRow(r.userId, x.parent, x.item) : null;
|
|
117
|
+
const row = x.parent ? await getRow(r.userId, x.parent, x.item, r.who) : null;
|
|
111
118
|
return row ? { ...row, tableId: x.parent } : null;
|
|
112
119
|
},
|
|
113
120
|
category: null,
|
|
121
|
+
// Work's chats: the studio reads the chat and the sidebar again (routes/live.ts checks each).
|
|
122
|
+
chat: null,
|
|
114
123
|
presence: async (_r, x) => x.parent ? presentIn(x.parent, x.item.slice(x.parent.length + 1)) : [],
|
|
115
124
|
file: async (_r, x) => {
|
|
116
|
-
const row = await db.query.
|
|
125
|
+
const row = await db.query.spaceFile.findFirst({ where: eq(schema.spaceFile.id, x.item) });
|
|
117
126
|
return row ? fileView(row) : null;
|
|
118
127
|
},
|
|
119
128
|
// The studio asks for the space's skills again: a list of names, no view of its own.
|
|
120
129
|
skill: null,
|
|
121
130
|
connector: async (r, x) => {
|
|
122
|
-
if (!x.
|
|
131
|
+
if (!x.spaceId) {
|
|
123
132
|
return null;
|
|
124
133
|
}
|
|
125
|
-
const id = x.item.slice(x.
|
|
126
|
-
return (await connectorsView(r, x.
|
|
134
|
+
const id = x.item.slice(x.spaceId.length + 1);
|
|
135
|
+
return (await connectorsView(r, x.spaceId)).find((c) => c.id === id) ?? null;
|
|
127
136
|
},
|
|
128
137
|
};
|
|
138
|
+
/**
|
|
139
|
+
* What the Studio alone shows of a space: a member whose Studio the space is closed to gets no view
|
|
140
|
+
* of these, and the browser asks the studio API, which refuses it (services/members-studio.ts).
|
|
141
|
+
* The space itself, its files and connectors are what Work reads in every space.
|
|
142
|
+
*/
|
|
143
|
+
const STUDIO_KINDS = new Set([
|
|
144
|
+
"wizard",
|
|
145
|
+
"translation",
|
|
146
|
+
"page",
|
|
147
|
+
"table",
|
|
148
|
+
"row",
|
|
149
|
+
"presence",
|
|
150
|
+
]);
|
|
129
151
|
export async function itemView(r, x) {
|
|
130
152
|
const read = ITEM_VIEWS[x.kind];
|
|
131
153
|
if (!read) {
|
|
132
154
|
return undefined;
|
|
133
155
|
}
|
|
134
156
|
try {
|
|
157
|
+
if (x.spaceId && STUDIO_KINDS.has(x.kind) && (await closedToMe(x.spaceId))) {
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
135
160
|
return await read(r, x);
|
|
136
161
|
}
|
|
137
162
|
catch (err) {
|
|
@@ -217,6 +217,31 @@ export async function tenantInfo(id, fresh = false) {
|
|
|
217
217
|
export function forgetTenant(id) {
|
|
218
218
|
tenants.delete(id);
|
|
219
219
|
}
|
|
220
|
+
/**
|
|
221
|
+
* Saves the organization's model policy for the admin who asks (`actorId`): the Manage-App checks
|
|
222
|
+
* their role and the plan's ways and answers with the policy as it stands now.
|
|
223
|
+
*/
|
|
224
|
+
export async function saveModelPolicy(tenantId, actorId, modelPolicy) {
|
|
225
|
+
const saved = await call("PUT", `${tenantPath(tenantId)}/model-policy`, { actorId, ...modelPolicy });
|
|
226
|
+
forgetTenant(tenantId);
|
|
227
|
+
return saved.modelPolicy;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Puts the organization on another tier its plan offers, for the admin who asks (`actorId`); the
|
|
231
|
+
* Manage-App refuses one a contract set.
|
|
232
|
+
*/
|
|
233
|
+
export async function saveModelTier(tenantId, actorId, tier) {
|
|
234
|
+
await call("PUT", `${tenantPath(tenantId)}/model-tier`, { actorId, tier });
|
|
235
|
+
forgetTenant(tenantId);
|
|
236
|
+
}
|
|
237
|
+
/** What a model would see of `text` with masking on: the labels given, else the saved ones. */
|
|
238
|
+
export async function tryMasking(tenantId, actorId, text, maskLabels) {
|
|
239
|
+
return call("POST", `${tenantPath(tenantId)}/model-policy/try`, {
|
|
240
|
+
actorId,
|
|
241
|
+
text,
|
|
242
|
+
...(maskLabels ? { maskLabels } : {}),
|
|
243
|
+
});
|
|
244
|
+
}
|
|
220
245
|
/** Renames the organization at the Manage-App; what it answers is the tenant as it stands now. */
|
|
221
246
|
export async function renameTenant(id, name) {
|
|
222
247
|
const value = await call("PATCH", `/v1/tenants/${encodeURIComponent(id)}`, {
|
|
@@ -319,6 +344,13 @@ export function putWizards(tenantId, data) {
|
|
|
319
344
|
export function postRunReport(tenantId, data) {
|
|
320
345
|
return call("POST", `/v1/runs/${encodeURIComponent(tenantId)}`, data);
|
|
321
346
|
}
|
|
347
|
+
/**
|
|
348
|
+
* The broker's critical lines (docs/plans/broker.md, "Notifications"): a guest's at once, the
|
|
349
|
+
* rest once a day. The admin app's Diagnose page and Abuse checks read them.
|
|
350
|
+
*/
|
|
351
|
+
export function postBrokerReport(tenantId, data) {
|
|
352
|
+
return call("POST", `/v1/broker/${encodeURIComponent(tenantId)}`, data);
|
|
353
|
+
}
|
|
322
354
|
/** What a person said at the end of a run. */
|
|
323
355
|
export function postFeedback(tenantId, data) {
|
|
324
356
|
return call("POST", `/v1/feedback/${encodeURIComponent(tenantId)}`, data);
|
|
@@ -84,7 +84,7 @@ export async function flowView(userId, wizardId, options = {}) {
|
|
|
84
84
|
const definition = options.definition ?? published?.definition ?? w.draft;
|
|
85
85
|
// The app's own look unless it asks for one the wizard offers.
|
|
86
86
|
const theme = options.theme && themeOffered(options.theme, definition.themes) ? options.theme : "host";
|
|
87
|
-
const { theme: look } = await brandView(w.
|
|
87
|
+
const { theme: look } = await brandView(w.spaceId, definition.themes, theme);
|
|
88
88
|
return {
|
|
89
89
|
wizard: {
|
|
90
90
|
id: w.id,
|
|
@@ -1,14 +1,64 @@
|
|
|
1
1
|
import { createMcpHandler, McpServer, originValidationResponse, } from "@modelcontextprotocol/server";
|
|
2
2
|
import { withTenant } from "../db/client.js";
|
|
3
3
|
import { env } from "../env.js";
|
|
4
|
+
import { feature } from "../features.js";
|
|
4
5
|
import { nudge } from "../live/hub.js";
|
|
6
|
+
import { managed, tenantInfo } from "../manage.js";
|
|
5
7
|
import { prompt } from "../prompts.js";
|
|
6
8
|
import { asRole } from "../services/access.js";
|
|
7
9
|
import { tenantStatus } from "../tenants/control.js";
|
|
10
|
+
import { serverText } from "../texts.js";
|
|
8
11
|
import { authenticate, principalOf } from "./auth.js";
|
|
9
12
|
import { registerFlowApp } from "./flow-app.js";
|
|
10
|
-
import { noteRequest } from "./seen.js";
|
|
13
|
+
import { appKind, clientNameOf, noteChecked, noteRequest } from "./seen.js";
|
|
11
14
|
import { registerPrompts, registerTools } from "./tools.js";
|
|
15
|
+
/**
|
|
16
|
+
* An app the organization's model policy keeps out of its spaces (`modelPolicy.apps`): its tool
|
|
17
|
+
* calls are answered with a tool error the app shows, before any tool reads the space. Calls of
|
|
18
|
+
* other kinds (listing the tools) go on. Behind `modelTiers`. Best effort: an app is told apart
|
|
19
|
+
* by the name it gives itself, and any name not known as a local app's counts as a subscription.
|
|
20
|
+
*/
|
|
21
|
+
async function appRefusal(who, client, body) {
|
|
22
|
+
const calls = (Array.isArray(body) ? body : [body]).filter((m) => Boolean(m) && typeof m === "object" && m.method === "tools/call");
|
|
23
|
+
// A runtime that runs alone has no organization and no policy.
|
|
24
|
+
if (!calls.length || !managed) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const info = await tenantInfo(who.tenantId).catch(() => null);
|
|
28
|
+
// When the Manage-App can't say what the policy allows, the app waits.
|
|
29
|
+
const policy = info && feature("modelTiers", info.features) ? info.modelPolicy : undefined;
|
|
30
|
+
if (info && !policy) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const kind = appKind(client, who.client);
|
|
34
|
+
const allowed = policy
|
|
35
|
+
? kind === "local"
|
|
36
|
+
? policy.apps.local
|
|
37
|
+
: policy.apps.subscriptions
|
|
38
|
+
: false;
|
|
39
|
+
noteChecked(who.tenantId, client, who.name ?? who.email ?? null, allowed, kind);
|
|
40
|
+
if (allowed) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
const text = !info
|
|
44
|
+
? serverText("en", "appPolicyUnavailable", { app: client })
|
|
45
|
+
: kind === "local"
|
|
46
|
+
? serverText("en", "appLocalRefused", { organization: info.name, app: client })
|
|
47
|
+
: serverText("en", "appSubscriptionRefused", {
|
|
48
|
+
organization: info.name,
|
|
49
|
+
app: client,
|
|
50
|
+
tier: info.tier?.name ?? serverText("en", "appYourTier"),
|
|
51
|
+
});
|
|
52
|
+
const answers = calls.map((call) => ({
|
|
53
|
+
jsonrpc: "2.0",
|
|
54
|
+
id: call.id ?? null,
|
|
55
|
+
result: { content: [{ type: "text", text }], isError: true },
|
|
56
|
+
}));
|
|
57
|
+
return new Response(JSON.stringify(Array.isArray(body) ? answers : answers[0]), {
|
|
58
|
+
status: 200,
|
|
59
|
+
headers: { "content-type": "application/json" },
|
|
60
|
+
});
|
|
61
|
+
}
|
|
12
62
|
/** A wizard definition is a few KB; this leaves room and refuses anything far beyond it. */
|
|
13
63
|
const MAX_BODY_BYTES = 300_000;
|
|
14
64
|
/**
|
|
@@ -48,6 +98,10 @@ export function mcpHandler() {
|
|
|
48
98
|
.json()
|
|
49
99
|
.catch(() => null);
|
|
50
100
|
noteRequest(who.tenantId, authInfo.clientId, who.client, body);
|
|
101
|
+
const refused = await appRefusal(who, clientNameOf(authInfo.clientId, who.client), body);
|
|
102
|
+
if (refused) {
|
|
103
|
+
return refused;
|
|
104
|
+
}
|
|
51
105
|
}
|
|
52
106
|
const answer = await withTenant(who.tenantId, () => asRole(who.role, () => handler.fetch(request, { authInfo })));
|
|
53
107
|
if (request.method === "POST") {
|
|
@@ -63,3 +63,50 @@ export function seenApps(tenantId) {
|
|
|
63
63
|
}
|
|
64
64
|
return out;
|
|
65
65
|
}
|
|
66
|
+
/** The name a sign-in's client gave on `initialize`, else the one its sign-in carries. */
|
|
67
|
+
export function clientNameOf(signIn, client) {
|
|
68
|
+
return names.get(signIn) ?? client;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Apps whose model runs on the member's computer: what they read of a space stays there. Goose
|
|
72
|
+
* is not one: it mostly thinks on a provider's model.
|
|
73
|
+
*/
|
|
74
|
+
const LOCAL_APPS = new Set(["lm-studio"]);
|
|
75
|
+
/**
|
|
76
|
+
* Whether an app thinks on the member's computer (`local`) or on a provider under the member's
|
|
77
|
+
* own subscription, from every name it goes by (the one it gave on `initialize`, its sign-in's).
|
|
78
|
+
* It counts as local only where a name says so and none names another app; any other counts as
|
|
79
|
+
* one on a subscription.
|
|
80
|
+
*/
|
|
81
|
+
export function appKind(...names) {
|
|
82
|
+
const ids = names.flatMap(appIdsOf);
|
|
83
|
+
return ids.length && ids.every((id) => LOCAL_APPS.has(id)) ? "local" : "subscription";
|
|
84
|
+
}
|
|
85
|
+
const checked = new Map();
|
|
86
|
+
/** Counts one tool call of an app the policy allowed or refused. */
|
|
87
|
+
export function noteChecked(tenantId, app, person, allowed, kind) {
|
|
88
|
+
const key = `${tenantId}\n${app}\n${person ?? ""}`;
|
|
89
|
+
const last = checked.get(key) ?? {
|
|
90
|
+
app,
|
|
91
|
+
kind,
|
|
92
|
+
person,
|
|
93
|
+
allowed: 0,
|
|
94
|
+
refused: 0,
|
|
95
|
+
at: 0,
|
|
96
|
+
};
|
|
97
|
+
last.at = Date.now();
|
|
98
|
+
if (allowed) {
|
|
99
|
+
last.allowed++;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
last.refused++;
|
|
103
|
+
}
|
|
104
|
+
checked.set(key, last);
|
|
105
|
+
}
|
|
106
|
+
/** The apps the tenant's members used on its spaces since the runtime started, latest first. */
|
|
107
|
+
export function checkedApps(tenantId) {
|
|
108
|
+
return [...checked]
|
|
109
|
+
.filter(([key]) => key.startsWith(`${tenantId}\n`))
|
|
110
|
+
.map(([, value]) => value)
|
|
111
|
+
.sort((a, b) => b.at - a.at);
|
|
112
|
+
}
|
|
@@ -3,6 +3,7 @@ import { z } from "zod";
|
|
|
3
3
|
import { authoringGuide } from "../authoring/guide.js";
|
|
4
4
|
import { wizardOpSchema } from "../authoring/ops.js";
|
|
5
5
|
import { importFromRegistry, listConnectors, searchRegistry } from "../connectors/external.js";
|
|
6
|
+
import { guideSpaceConnections } from "../connectors/space-connections.js";
|
|
6
7
|
import { RunConflict } from "../engine/runner.js";
|
|
7
8
|
import { pluginToolsOf } from "../plugins/registry.js";
|
|
8
9
|
import { prompt } from "../prompts.js";
|
|
@@ -10,11 +11,12 @@ import { publishAndSync, pushSharing } from "../services/cloud.js";
|
|
|
10
11
|
import { ServiceError } from "../services/errors.js";
|
|
11
12
|
import { deleteFile, listFiles, readFileText, writeFile } from "../services/files.js";
|
|
12
13
|
import { marketplaceWizard, searchMarketplace } from "../services/marketplace.js";
|
|
14
|
+
import { requireStudio } from "../services/members-studio.js";
|
|
13
15
|
import { markAgent, presentIn } from "../services/presence.js";
|
|
14
|
-
import { defaultProject, listProjects, ownedProject } from "../services/projects.js";
|
|
15
16
|
import { answerRunAsk, answerRunPage, controlRun, reviewRun, runReport, startRun, startTestRun, testRunReport, } from "../services/runs.js";
|
|
17
|
+
import { defaultSpace, listSpaces, ownedSpace } from "../services/spaces.js";
|
|
16
18
|
import { checkDraftWidget } from "../services/widgets.js";
|
|
17
|
-
import { createWizard, editWizard, listWizards, ownedWizard, parseDraft, shareUrl, studioUrl, updateWizardSettings, wizardState, writeDraft, } from "../services/wizards.js";
|
|
19
|
+
import { checkDraft, createWizard, editWizard, listWizards, ownedWizard, parseDraft, shareUrl, studioUrl, updateWizardSettings, wizardState, writeDraft, } from "../services/wizards.js";
|
|
18
20
|
import { FLOW_VIEW_KEY, flowAppMeta, flowView } from "./flow-app.js";
|
|
19
21
|
const definition = z
|
|
20
22
|
.record(z.string(), z.unknown())
|
|
@@ -57,6 +59,16 @@ function failure(err) {
|
|
|
57
59
|
function spaceFrom(p) {
|
|
58
60
|
return p.origin === "local" ? "your computer" : "here";
|
|
59
61
|
}
|
|
62
|
+
/** A Studio tool's item: the wizard or the test run it names. */
|
|
63
|
+
async function requireStudioOf(args) {
|
|
64
|
+
const { wizardId, runId } = (args ?? {});
|
|
65
|
+
if (typeof wizardId === "string") {
|
|
66
|
+
await requireStudio("wizards", wizardId);
|
|
67
|
+
}
|
|
68
|
+
else if (typeof runId === "string") {
|
|
69
|
+
await requireStudio("runs", runId);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
60
72
|
function annotationsOf(config) {
|
|
61
73
|
const readOnly = config.readOnly ?? false;
|
|
62
74
|
return {
|
|
@@ -114,6 +126,12 @@ export function registerTools(server, who) {
|
|
|
114
126
|
return result;
|
|
115
127
|
}
|
|
116
128
|
};
|
|
129
|
+
/** The space a Studio tool works in: the one named, or the person's first; refused where closed. */
|
|
130
|
+
const studioSpace = async (spaceId) => {
|
|
131
|
+
const space = spaceId ? await ownedSpace(who.userId, spaceId) : await defaultSpace(who.userId);
|
|
132
|
+
await requireStudio("spaces", space.id);
|
|
133
|
+
return space;
|
|
134
|
+
};
|
|
117
135
|
const tool = (name, scope, config, run) => {
|
|
118
136
|
if (!who.scopes.includes(scope)) {
|
|
119
137
|
return;
|
|
@@ -127,6 +145,9 @@ export function registerTools(server, who) {
|
|
|
127
145
|
// The SDK has parsed `args` with `input` before this runs.
|
|
128
146
|
(async (args) => {
|
|
129
147
|
try {
|
|
148
|
+
if (config.studio) {
|
|
149
|
+
await requireStudioOf(args);
|
|
150
|
+
}
|
|
130
151
|
return ok(await withPresence(args, config.readOnly ?? false, await run(args)));
|
|
131
152
|
}
|
|
132
153
|
catch (err) {
|
|
@@ -147,6 +168,9 @@ export function registerTools(server, who) {
|
|
|
147
168
|
_meta: flowAppMeta,
|
|
148
169
|
}, (async (args) => {
|
|
149
170
|
try {
|
|
171
|
+
if (config.studio) {
|
|
172
|
+
await requireStudioOf(args);
|
|
173
|
+
}
|
|
150
174
|
const { result: plain, view } = await run(args);
|
|
151
175
|
const result = (await withPresence(args, config.readOnly ?? false, plain));
|
|
152
176
|
return {
|
|
@@ -165,14 +189,12 @@ export function registerTools(server, who) {
|
|
|
165
189
|
title: "Authoring guide",
|
|
166
190
|
description: prompt("mcp", "tool.get_authoring_guide"),
|
|
167
191
|
input: z.object({
|
|
168
|
-
|
|
192
|
+
spaceId: z.string().optional().describe("Defaults to the person's first space."),
|
|
169
193
|
}),
|
|
170
194
|
readOnly: true,
|
|
171
|
-
}, async ({
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
: await defaultProject(who.userId);
|
|
175
|
-
return authoringGuide(await listConnectors(project.id), await pluginToolsOf(who.tenantId));
|
|
195
|
+
}, async ({ spaceId }) => {
|
|
196
|
+
const space = await studioSpace(spaceId);
|
|
197
|
+
return authoringGuide(await listConnectors(space.id), await pluginToolsOf(who.tenantId), await guideSpaceConnections(space.id));
|
|
176
198
|
});
|
|
177
199
|
// --- connectors ------------------------------------------------------------
|
|
178
200
|
tool("find_connectors", "wizards:read", {
|
|
@@ -184,27 +206,25 @@ export function registerTools(server, who) {
|
|
|
184
206
|
tool("list_connectors", "wizards:read", {
|
|
185
207
|
title: "List connectors",
|
|
186
208
|
description: prompt("mcp", "tool.list_connectors"),
|
|
187
|
-
input: z.object({
|
|
209
|
+
input: z.object({ spaceId: z.string().optional() }),
|
|
188
210
|
readOnly: true,
|
|
189
|
-
}, async ({
|
|
190
|
-
const
|
|
191
|
-
? await
|
|
192
|
-
: await
|
|
193
|
-
return {
|
|
211
|
+
}, async ({ spaceId }) => {
|
|
212
|
+
const space = spaceId
|
|
213
|
+
? await ownedSpace(who.userId, spaceId)
|
|
214
|
+
: await defaultSpace(who.userId);
|
|
215
|
+
return { spaceId: space.id, connectors: await listConnectors(space.id) };
|
|
194
216
|
});
|
|
195
217
|
tool("import_connector", "wizards:write", {
|
|
196
218
|
title: "Import connector",
|
|
197
219
|
description: prompt("mcp", "tool.import_connector"),
|
|
198
220
|
input: z.object({
|
|
199
|
-
|
|
221
|
+
spaceId: z.string().optional(),
|
|
200
222
|
domain: z.string().describe("A domain from find_connectors, e.g. notion.com"),
|
|
201
223
|
kind: z.enum(["mcp", "openapi"]).optional(),
|
|
202
224
|
}),
|
|
203
|
-
}, async ({
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
: await defaultProject(who.userId);
|
|
207
|
-
return importFromRegistry(who.userId, project.id, { domain, kind });
|
|
225
|
+
}, async ({ spaceId, domain, kind }) => {
|
|
226
|
+
const space = await studioSpace(spaceId);
|
|
227
|
+
return importFromRegistry(who.userId, space.id, { domain, kind });
|
|
208
228
|
});
|
|
209
229
|
tool("list_starters", "wizards:read", {
|
|
210
230
|
title: "List starters",
|
|
@@ -236,12 +256,12 @@ export function registerTools(server, who) {
|
|
|
236
256
|
}
|
|
237
257
|
return starter.definition;
|
|
238
258
|
});
|
|
239
|
-
tool("
|
|
240
|
-
title: "List
|
|
241
|
-
description: prompt("mcp", "tool.
|
|
259
|
+
tool("list_spaces", "wizards:read", {
|
|
260
|
+
title: "List spaces",
|
|
261
|
+
description: prompt("mcp", "tool.list_spaces"),
|
|
242
262
|
input: z.object({}),
|
|
243
263
|
readOnly: true,
|
|
244
|
-
}, async () => (await
|
|
264
|
+
}, async () => (await listSpaces(who.userId)).map((p) => ({
|
|
245
265
|
id: p.id,
|
|
246
266
|
name: p.name,
|
|
247
267
|
from: spaceFrom(p),
|
|
@@ -250,15 +270,15 @@ export function registerTools(server, who) {
|
|
|
250
270
|
tool("list_wizards", "wizards:read", {
|
|
251
271
|
title: "List wizards",
|
|
252
272
|
description: prompt("mcp", "tool.list_wizards"),
|
|
253
|
-
input: z.object({
|
|
273
|
+
input: z.object({ spaceId: z.string().optional() }),
|
|
254
274
|
readOnly: true,
|
|
255
|
-
}, async ({
|
|
256
|
-
const spaces = new Map((await
|
|
257
|
-
return (await listWizards(who.userId,
|
|
258
|
-
const space = spaces.get(w.
|
|
275
|
+
}, async ({ spaceId }) => {
|
|
276
|
+
const spaces = new Map((await listSpaces(who.userId)).map((p) => [p.id, p]));
|
|
277
|
+
return (await listWizards(who.userId, spaceId)).map((w) => {
|
|
278
|
+
const space = spaces.get(w.spaceId);
|
|
259
279
|
return {
|
|
260
280
|
id: w.id,
|
|
261
|
-
|
|
281
|
+
spaceId: w.spaceId,
|
|
262
282
|
space: space?.name ?? null,
|
|
263
283
|
spaceFrom: space ? spaceFrom(space) : null,
|
|
264
284
|
title: w.title,
|
|
@@ -274,11 +294,12 @@ export function registerTools(server, who) {
|
|
|
274
294
|
description: prompt("mcp", "tool.get_wizard"),
|
|
275
295
|
input: z.object({ wizardId: z.string() }),
|
|
276
296
|
readOnly: true,
|
|
297
|
+
studio: true,
|
|
277
298
|
}, async ({ wizardId }) => {
|
|
278
299
|
const s = await wizardState(await ownedWizard(who.userId, wizardId));
|
|
279
300
|
return {
|
|
280
301
|
wizardId: s.id,
|
|
281
|
-
|
|
302
|
+
spaceId: s.spaceId,
|
|
282
303
|
revision: s.revision,
|
|
283
304
|
draft: s.draft,
|
|
284
305
|
issues: s.issues,
|
|
@@ -293,11 +314,16 @@ export function registerTools(server, who) {
|
|
|
293
314
|
tool("validate_wizard", "wizards:read", {
|
|
294
315
|
title: "Validate wizard",
|
|
295
316
|
description: prompt("mcp", "tool.validate_wizard"),
|
|
296
|
-
input: z.object({
|
|
317
|
+
input: z.object({
|
|
318
|
+
definition,
|
|
319
|
+
spaceId: z.string().optional().describe("Defaults to the person's first space."),
|
|
320
|
+
}),
|
|
297
321
|
readOnly: true,
|
|
298
322
|
}, async (args) => {
|
|
299
323
|
try {
|
|
300
|
-
const
|
|
324
|
+
const space = await studioSpace(args.spaceId);
|
|
325
|
+
const { draft } = parseDraft(authored(args.definition));
|
|
326
|
+
const issues = await checkDraft(space.id, draft);
|
|
301
327
|
return { ok: issues.length === 0, issues };
|
|
302
328
|
}
|
|
303
329
|
catch (err) {
|
|
@@ -312,7 +338,7 @@ export function registerTools(server, who) {
|
|
|
312
338
|
title: "Create wizard",
|
|
313
339
|
description: prompt("mcp", "tool.create_wizard"),
|
|
314
340
|
input: z.object({
|
|
315
|
-
|
|
341
|
+
spaceId: z.string().optional().describe("Defaults to the person's first space."),
|
|
316
342
|
definition: definition.optional(),
|
|
317
343
|
starterId: z.string().optional().describe("Copy this starter instead of sending JSON."),
|
|
318
344
|
note,
|
|
@@ -336,6 +362,7 @@ export function registerTools(server, who) {
|
|
|
336
362
|
note,
|
|
337
363
|
}),
|
|
338
364
|
destructive: true,
|
|
365
|
+
studio: true,
|
|
339
366
|
}, async ({ wizardId, ...input }) => {
|
|
340
367
|
const { revision, issues } = await editWizard(who.userId, wizardId, input, writer);
|
|
341
368
|
return { revision, issues };
|
|
@@ -345,6 +372,7 @@ export function registerTools(server, who) {
|
|
|
345
372
|
description: prompt("mcp", "tool.replace_wizard"),
|
|
346
373
|
input: z.object({ wizardId: z.string(), baseRevision, definition, note }),
|
|
347
374
|
destructive: true,
|
|
375
|
+
studio: true,
|
|
348
376
|
}, async ({ wizardId, ...input }) => {
|
|
349
377
|
const { revision, issues } = await writeDraft(who.userId, wizardId, { ...input, definition: authored(input.definition) }, writer);
|
|
350
378
|
return { revision, issues };
|
|
@@ -356,6 +384,7 @@ export function registerTools(server, who) {
|
|
|
356
384
|
input: z.object({ wizardId: z.string() }),
|
|
357
385
|
destructive: true,
|
|
358
386
|
openWorld: true,
|
|
387
|
+
studio: true,
|
|
359
388
|
}, async ({ wizardId }) => publishAndSync(who.userId, wizardId));
|
|
360
389
|
tool("set_sharing", "wizards:publish", {
|
|
361
390
|
title: "Set sharing",
|
|
@@ -367,6 +396,7 @@ export function registerTools(server, who) {
|
|
|
367
396
|
}),
|
|
368
397
|
destructive: true,
|
|
369
398
|
openWorld: true,
|
|
399
|
+
studio: true,
|
|
370
400
|
}, async ({ wizardId, enabled, dailyRunLimit }) => {
|
|
371
401
|
const w = await updateWizardSettings(who.userId, wizardId, {
|
|
372
402
|
shareEnabled: enabled,
|
|
@@ -392,6 +422,7 @@ export function registerTools(server, who) {
|
|
|
392
422
|
acceptReviews: z.boolean().default(true),
|
|
393
423
|
}),
|
|
394
424
|
openWorld: true,
|
|
425
|
+
studio: true,
|
|
395
426
|
}, async ({ wizardId, answers, acceptReviews }) => {
|
|
396
427
|
const { runId } = await startTestRun(who.userId, wizardId, { answers, acceptReviews });
|
|
397
428
|
const report = await runReport(who.userId, runId, 2, "test");
|
|
@@ -414,6 +445,7 @@ export function registerTools(server, who) {
|
|
|
414
445
|
.describe("Wait up to this long while the run is still working."),
|
|
415
446
|
}),
|
|
416
447
|
readOnly: true,
|
|
448
|
+
studio: true,
|
|
417
449
|
}, async ({ runId, waitSeconds }) => testRunReport(who.userId, runId, waitSeconds));
|
|
418
450
|
// --- using wizards: the flow, and runs of the published version -------------
|
|
419
451
|
appTool("show_wizard", "wizards:read", {
|
|
@@ -426,6 +458,10 @@ export function registerTools(server, who) {
|
|
|
426
458
|
readOnly: true,
|
|
427
459
|
}, async ({ wizardId, version }) => {
|
|
428
460
|
const view = await flowView(who.userId, wizardId, { shows: version });
|
|
461
|
+
// The draft is the Studio's; the published wizard is everyone's to run.
|
|
462
|
+
if (view.wizard.shows === "draft") {
|
|
463
|
+
await requireStudio("wizards", wizardId);
|
|
464
|
+
}
|
|
429
465
|
return {
|
|
430
466
|
result: {
|
|
431
467
|
wizardId,
|
|
@@ -543,12 +579,14 @@ export function registerTools(server, who) {
|
|
|
543
579
|
description: prompt("mcp", "tool.list_files"),
|
|
544
580
|
input: z.object({ wizardId: z.string() }),
|
|
545
581
|
readOnly: true,
|
|
582
|
+
studio: true,
|
|
546
583
|
}, async ({ wizardId }) => (await listFiles(who.userId, wizardId)).map(({ path, mime, size }) => ({ path, mime, size })));
|
|
547
584
|
tool("read_file", "wizards:read", {
|
|
548
585
|
title: "Read workspace file",
|
|
549
586
|
description: prompt("mcp", "tool.read_file"),
|
|
550
587
|
input: z.object({ wizardId: z.string(), path: z.string() }),
|
|
551
588
|
readOnly: true,
|
|
589
|
+
studio: true,
|
|
552
590
|
}, async ({ wizardId, path }) => readFileText(who.userId, wizardId, path));
|
|
553
591
|
tool("write_file", "wizards:write", {
|
|
554
592
|
title: "Write workspace file",
|
|
@@ -561,6 +599,7 @@ export function registerTools(server, who) {
|
|
|
561
599
|
mime: z.string().optional(),
|
|
562
600
|
}),
|
|
563
601
|
destructive: true,
|
|
602
|
+
studio: true,
|
|
564
603
|
}, async ({ wizardId, path, content, base64, mime }) => {
|
|
565
604
|
if ((content === undefined) === (base64 === undefined)) {
|
|
566
605
|
throw new ServiceError("invalid", "Pass either content or base64.");
|
|
@@ -572,6 +611,7 @@ export function registerTools(server, who) {
|
|
|
572
611
|
description: prompt("mcp", "tool.delete_file"),
|
|
573
612
|
input: z.object({ wizardId: z.string(), path: z.string() }),
|
|
574
613
|
destructive: true,
|
|
614
|
+
studio: true,
|
|
575
615
|
}, async ({ wizardId, path }) => {
|
|
576
616
|
await deleteFile(who.userId, wizardId, path);
|
|
577
617
|
return { ok: true };
|
|
@@ -592,6 +632,7 @@ export function registerTools(server, who) {
|
|
|
592
632
|
annotations: annotationsOf({ readOnly: true }),
|
|
593
633
|
}, (async ({ wizardId, stepId, data }) => {
|
|
594
634
|
try {
|
|
635
|
+
await requireStudio("wizards", wizardId);
|
|
595
636
|
const r = await checkDraftWidget(who.userId, wizardId, stepId, data);
|
|
596
637
|
return {
|
|
597
638
|
content: [
|