@engenty/wizards-runtime 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +101 -67
- package/apps/runtime/dist/agents/website.js +1 -1
- package/apps/runtime/dist/app.js +17 -1
- 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/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 +40 -5
- 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/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 +16 -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/resources.js +43 -12
- package/apps/runtime/dist/engine/runner.js +75 -23
- package/apps/runtime/dist/engine/steps.js +30 -12
- package/apps/runtime/dist/engine/template.js +18 -1
- package/apps/runtime/dist/env.js +9 -4
- package/apps/runtime/dist/index.js +18 -2
- 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 +7 -0
- package/apps/runtime/dist/mcp/flow-app.js +1 -1
- package/apps/runtime/dist/mcp/tools.js +75 -34
- package/apps/runtime/dist/models.js +1 -1
- package/apps/runtime/dist/motion-graphics/project.js +8 -8
- 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 +7 -7
- package/apps/runtime/dist/prompts/mcp.md +6 -6
- package/apps/runtime/dist/prompts/services.md +4 -4
- package/apps/runtime/dist/prompts/step.md +2 -2
- 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/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 +54 -33
- package/apps/runtime/dist/routes/skills.js +6 -6
- package/apps/runtime/dist/routes/studio.js +153 -144
- package/apps/runtime/dist/routes/work.js +199 -0
- 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 +74 -7
- 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 +7 -7
- 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 +23 -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 -612
- 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 +38 -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 +28 -13
- 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-SwyId00t.js → ChangelogDialog-Duab4zTO.js} +1 -1
- package/apps/web/dist/assets/{CodeEditor-BwZsk5Al.js → CodeEditor-nxoOt8ge.js} +1 -1
- package/apps/web/dist/assets/EditorPage-ZrgGpYMC.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-DtSpjVTl.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-TwKzzMtA.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-Brd-xPUJ.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-DhkHteoJ.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-G-XYaDgR.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-BYZTwJTD.js → upload-BchUnQGV.js} +1 -1
- package/apps/web/dist/assets/{useMutation-D0QP_k2-.js → useMutation-DEkZhp5c.js} +1 -1
- package/apps/web/dist/assets/{volume-2-CVHoxdGM.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 +6 -1
- package/node_modules/@engenty/wizards-shared/dist/assistant.js +6 -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 +150 -8
- package/node_modules/@engenty/wizards-shared/dist/definition.js +46 -11
- 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 +26 -2
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +26 -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.js +3 -1
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +54 -6
- package/node_modules/@engenty/wizards-shared/dist/run.js +85 -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/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-B-JxkELB.js +0 -1
- package/apps/web/dist/assets/EditorPage-DQ_2FOzI.js +0 -3
- package/apps/web/dist/assets/Marketplace-DoH4YO3D.js +0 -2
- package/apps/web/dist/assets/NewWizardChannels-Tgoexgj4.js +0 -1
- package/apps/web/dist/assets/NewWizardPage-B24AF482.js +0 -7
- package/apps/web/dist/assets/OnboardingPage-BEvq4slJ.js +0 -1
- package/apps/web/dist/assets/PreviewPane-B_v7Y8R7.js +0 -10
- package/apps/web/dist/assets/ProjectPage-ClRuhFJo.js +0 -10
- package/apps/web/dist/assets/PublicRunner-MicrpVsv.js +0 -1
- package/apps/web/dist/assets/ReadOnly-BXjv-MSv.js +0 -1
- package/apps/web/dist/assets/SettingsPage-DY8O1r43.js +0 -2
- package/apps/web/dist/assets/SetupPage-BOVkVpMu.js +0 -1
- package/apps/web/dist/assets/SharePage-DXGzJSnR.js +0 -1
- package/apps/web/dist/assets/SkillEditor-BzzTDeaU.js +0 -1
- package/apps/web/dist/assets/changelog-BLdS-0Bj.js +0 -1
- package/apps/web/dist/assets/esm-BdxDT9Km.js +0 -7
- package/apps/web/dist/assets/i18n-8-Sw11tB.js +0 -55
- package/apps/web/dist/assets/index-OsdQFHmh.js +0 -49
- package/apps/web/dist/assets/index-QPipX5Fi.css +0 -1
- package/apps/web/dist/assets/lock-C0uxcOlq.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-BWI-KENJ.js +0 -2
- package/apps/web/dist/assets/theme-D7krsx0_.js +0 -11
- package/apps/web/dist/assets/ui-DSXG3f49.js +0 -83
- /package/apps/runtime/dist/db/migrations/tenant/{0027_space_skill.sql → 0030_space_skill.sql} +0 -0
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { runTheme } from "@engenty/wizards-shared/
|
|
1
|
+
import { runTheme } from "@engenty/wizards-shared/spaces";
|
|
2
2
|
import { freeThemeId, MAX_SPACE_THEMES, themeContentKey, themeIdProblem, themeSchema, } from "@engenty/wizards-shared/theme";
|
|
3
3
|
import { eq } from "drizzle-orm";
|
|
4
4
|
import { db, schema } from "../db/client.js";
|
|
5
5
|
import { spaceChanged } from "../plugins/events.js";
|
|
6
6
|
import { requireBuild, requireWritable } from "./access.js";
|
|
7
7
|
import { ServiceError } from "./errors.js";
|
|
8
|
-
import {
|
|
8
|
+
import { ownedSpace } from "./spaces.js";
|
|
9
9
|
/**
|
|
10
10
|
* The space's themes, which of its wizards name each, the brand's fonts for headings and text
|
|
11
11
|
* (what `brand` means in a theme of this space) and the brand's named colours.
|
|
12
12
|
*/
|
|
13
|
-
export async function listThemes(userId,
|
|
14
|
-
const p = await
|
|
13
|
+
export async function listThemes(userId, spaceId) {
|
|
14
|
+
const p = await ownedSpace(userId, spaceId);
|
|
15
15
|
const wizards = await db.query.wizard.findMany({
|
|
16
16
|
columns: { id: true, title: true, draft: true },
|
|
17
|
-
where: eq(schema.wizard.
|
|
17
|
+
where: eq(schema.wizard.spaceId, p.id),
|
|
18
18
|
});
|
|
19
19
|
const { display, body, faces } = runTheme(p.brand);
|
|
20
20
|
return {
|
|
@@ -47,19 +47,19 @@ function checkedTheme(raw, origin) {
|
|
|
47
47
|
}
|
|
48
48
|
return parsed.data;
|
|
49
49
|
}
|
|
50
|
-
async function writeThemes(
|
|
50
|
+
async function writeThemes(spaceId, themes) {
|
|
51
51
|
if (themes.length > MAX_SPACE_THEMES) {
|
|
52
52
|
throw new ServiceError("invalid", `A space keeps at most ${MAX_SPACE_THEMES} themes.`);
|
|
53
53
|
}
|
|
54
54
|
await db
|
|
55
|
-
.update(schema.
|
|
55
|
+
.update(schema.space)
|
|
56
56
|
.set({ themes, updatedAt: new Date() })
|
|
57
|
-
.where(eq(schema.
|
|
58
|
-
spaceChanged("space.updated",
|
|
57
|
+
.where(eq(schema.space.id, spaceId));
|
|
58
|
+
spaceChanged("space.updated", spaceId);
|
|
59
59
|
}
|
|
60
60
|
/** Adds the theme to the space, or replaces the one with its id. */
|
|
61
|
-
export async function saveTheme(userId,
|
|
62
|
-
const p = await
|
|
61
|
+
export async function saveTheme(userId, spaceId, raw) {
|
|
62
|
+
const p = await ownedSpace(userId, spaceId);
|
|
63
63
|
await requireWritable(p);
|
|
64
64
|
await requireBuild();
|
|
65
65
|
const theme = checkedTheme(raw, "studio");
|
|
@@ -68,8 +68,8 @@ export async function saveTheme(userId, projectId, raw) {
|
|
|
68
68
|
return theme;
|
|
69
69
|
}
|
|
70
70
|
/** Removes the theme. Wizards that name it show the next theme of their chain, or the brand. */
|
|
71
|
-
export async function deleteTheme(userId,
|
|
72
|
-
const p = await
|
|
71
|
+
export async function deleteTheme(userId, spaceId, themeId) {
|
|
72
|
+
const p = await ownedSpace(userId, spaceId);
|
|
73
73
|
await requireWritable(p);
|
|
74
74
|
await requireBuild();
|
|
75
75
|
await writeThemes(p.id, p.themes.filter((t) => t.id !== themeId));
|
|
@@ -79,11 +79,11 @@ export async function deleteTheme(userId, projectId, themeId) {
|
|
|
79
79
|
* the same content is the space's own; one with a known id and other content comes in under a
|
|
80
80
|
* free id. Answers how ids were renamed, for the wizard's `themes`.
|
|
81
81
|
*/
|
|
82
|
-
export async function importThemes(
|
|
82
|
+
export async function importThemes(spaceId, incoming) {
|
|
83
83
|
if (!incoming.length) {
|
|
84
84
|
return {};
|
|
85
85
|
}
|
|
86
|
-
const p = await db.query.
|
|
86
|
+
const p = await db.query.space.findFirst({ where: eq(schema.space.id, spaceId) });
|
|
87
87
|
if (!p) {
|
|
88
88
|
return {};
|
|
89
89
|
}
|
|
@@ -3,7 +3,7 @@ import { probeWidget } from "../widgets/render.js";
|
|
|
3
3
|
import { widgetPreviewHtml } from "../widgets/step.js";
|
|
4
4
|
import { notFound, ServiceError } from "./errors.js";
|
|
5
5
|
import { draftFiles } from "./files.js";
|
|
6
|
-
import {
|
|
6
|
+
import { ownedSpace } from "./spaces.js";
|
|
7
7
|
import { ownedWizard } from "./wizards.js";
|
|
8
8
|
async function draftWidget(userId, wizardId, stepId) {
|
|
9
9
|
const w = await ownedWizard(userId, wizardId);
|
|
@@ -18,17 +18,17 @@ async function draftWidget(userId, wizardId, stepId) {
|
|
|
18
18
|
if (!files.some((f) => f.path === step.entry)) {
|
|
19
19
|
throw new ServiceError("invalid", `The widget file ${step.entry} is not in the workspace yet.`);
|
|
20
20
|
}
|
|
21
|
-
return { step, files,
|
|
21
|
+
return { step, files, space: await ownedSpace(userId, w.spaceId) };
|
|
22
22
|
}
|
|
23
23
|
/** The draft widget with its sample data, as one HTML file — the studio shows it before any run. */
|
|
24
24
|
export async function draftWidgetPreview(userId, wizardId, stepId, data) {
|
|
25
|
-
const { step, files,
|
|
26
|
-
return widgetPreviewHtml(step, files,
|
|
25
|
+
const { step, files, space } = await draftWidget(userId, wizardId, stepId);
|
|
26
|
+
return widgetPreviewHtml(step, files, space, data);
|
|
27
27
|
}
|
|
28
28
|
/** Loads the draft widget in Chromium: what broke, whether it animates, and how it looks. */
|
|
29
29
|
export async function checkDraftWidget(userId, wizardId, stepId, data) {
|
|
30
|
-
const { step, files,
|
|
31
|
-
const html = await widgetPreviewHtml(step, files,
|
|
30
|
+
const { step, files, space } = await draftWidget(userId, wizardId, stepId);
|
|
31
|
+
const html = await widgetPreviewHtml(step, files, space, data);
|
|
32
32
|
const probe = await probeWidget(html, widgetSize(step));
|
|
33
33
|
return { ...probe, size: widgetSize(step), bytes: Buffer.byteLength(html) };
|
|
34
34
|
}
|
|
@@ -4,7 +4,8 @@ import { note } from "@engenty/wizards-shared/run";
|
|
|
4
4
|
import { and, desc, eq, sql } from "drizzle-orm";
|
|
5
5
|
import { nanoid } from "nanoid";
|
|
6
6
|
import { applyOps, OpError } from "../authoring/ops.js";
|
|
7
|
-
import { listConnectors } from "../connectors/external.js";
|
|
7
|
+
import { listConnectors, resolveConnector } from "../connectors/external.js";
|
|
8
|
+
import { listSpaceConnections } from "../connectors/space-connections.js";
|
|
8
9
|
import { db, schema } from "../db/client.js";
|
|
9
10
|
import { env } from "../env.js";
|
|
10
11
|
import { saidOf } from "../model-errors.js";
|
|
@@ -12,16 +13,17 @@ import { pluginToolsOf } from "../plugins/registry.js";
|
|
|
12
13
|
import { dropLinks, putLink } from "../tenants/control.js";
|
|
13
14
|
import { currentTenant } from "../tenants/tenant.js";
|
|
14
15
|
import { serverText } from "../texts.js";
|
|
15
|
-
import { requireAdmin, requireBuild, requireWritable,
|
|
16
|
+
import { requireAdmin, requireBuild, requireWritable, requireWritableSpace } from "./access.js";
|
|
16
17
|
import { changedSteps, emitDraftChanged } from "./draft-events.js";
|
|
17
18
|
import { notFound, ServiceError } from "./errors.js";
|
|
18
19
|
import { copyFiles, draftFiles, sameFiles, seedFiles } from "./files.js";
|
|
19
20
|
import { forgetWizardLinks } from "./links.js";
|
|
20
21
|
import { pushWizards } from "./manage-reports.js";
|
|
21
22
|
import { asLang, countInstall, marketplaceWizard } from "./marketplace.js";
|
|
23
|
+
import { requireMaker } from "./members-studio.js";
|
|
22
24
|
import { pushPages } from "./pages.js";
|
|
23
|
-
import { defaultProject, ownedProject } from "./projects.js";
|
|
24
25
|
import { checkRunnerSettings } from "./runners.js";
|
|
26
|
+
import { defaultSpace, ownedSpace } from "./spaces.js";
|
|
25
27
|
import { saveTheme } from "./themes.js";
|
|
26
28
|
/** The wizard a new one starts as, in the language of whoever makes it. */
|
|
27
29
|
function blankWizard(lang) {
|
|
@@ -61,16 +63,16 @@ export async function ownedWizard(_userId, wizardId) {
|
|
|
61
63
|
}
|
|
62
64
|
return w;
|
|
63
65
|
}
|
|
64
|
-
/** The wizard, for a change: refused where its
|
|
66
|
+
/** The wizard, for a change: refused where its space is a local install's or nothing is built here. */
|
|
65
67
|
export async function writableWizard(userId, wizardId) {
|
|
66
68
|
const w = await ownedWizard(userId, wizardId);
|
|
67
|
-
await
|
|
69
|
+
await requireWritableSpace(w.spaceId);
|
|
68
70
|
return w;
|
|
69
71
|
}
|
|
70
72
|
export function wizardSummary(w) {
|
|
71
73
|
return {
|
|
72
74
|
id: w.id,
|
|
73
|
-
|
|
75
|
+
spaceId: w.spaceId,
|
|
74
76
|
title: w.title,
|
|
75
77
|
description: w.draft.description,
|
|
76
78
|
avatar: w.draft.avatar,
|
|
@@ -81,6 +83,8 @@ export function wizardSummary(w) {
|
|
|
81
83
|
shareToken: w.shareToken,
|
|
82
84
|
shareEnabled: w.shareEnabled,
|
|
83
85
|
dailyRunLimit: w.dailyRunLimit,
|
|
86
|
+
/** How many emails guests' runs send per day, from any address. */
|
|
87
|
+
dailyMailLimit: w.dailyMailLimit,
|
|
84
88
|
/** How it is offered; null: the link opens the page, the chat is on beside it. */
|
|
85
89
|
runners: w.runners,
|
|
86
90
|
/** Its page offers it in the viewer's language, translated on request. */
|
|
@@ -89,9 +93,9 @@ export function wizardSummary(w) {
|
|
|
89
93
|
updatedAt: w.updatedAt.toISOString(),
|
|
90
94
|
};
|
|
91
95
|
}
|
|
92
|
-
export async function listWizards(_userId,
|
|
96
|
+
export async function listWizards(_userId, spaceId) {
|
|
93
97
|
const rows = await db.query.wizard.findMany({
|
|
94
|
-
where: and(eq(schema.wizard.tenantId, currentTenant()),
|
|
98
|
+
where: and(eq(schema.wizard.tenantId, currentTenant()), spaceId ? eq(schema.wizard.spaceId, spaceId) : undefined),
|
|
95
99
|
orderBy: [desc(schema.wizard.updatedAt)],
|
|
96
100
|
});
|
|
97
101
|
return rows.map(wizardSummary);
|
|
@@ -113,19 +117,19 @@ export async function publishedVersion(w) {
|
|
|
113
117
|
});
|
|
114
118
|
return v ?? null;
|
|
115
119
|
}
|
|
116
|
-
/** Connections must name connectors the
|
|
117
|
-
async function connectorIssues(
|
|
120
|
+
/** Connections must name connectors the space has imported, and actions those connectors have. */
|
|
121
|
+
async function connectorIssues(spaceId, draft) {
|
|
118
122
|
const wanted = (draft.connections ?? []).filter((c) => c.connector);
|
|
119
123
|
if (!wanted.length) {
|
|
120
124
|
return [];
|
|
121
125
|
}
|
|
122
126
|
const issues = [];
|
|
123
|
-
const connectors = await listConnectors(
|
|
127
|
+
const connectors = await listConnectors(spaceId);
|
|
124
128
|
for (const connection of wanted) {
|
|
125
129
|
const connector = connectors.find((c) => c.id === connection.connector);
|
|
126
130
|
if (!connector) {
|
|
127
131
|
issues.push({
|
|
128
|
-
message: `Connection "${connection.id}" uses connector "${connection.connector}", which this
|
|
132
|
+
message: `Connection "${connection.id}" uses connector "${connection.connector}", which this space has not imported.`,
|
|
129
133
|
});
|
|
130
134
|
continue;
|
|
131
135
|
}
|
|
@@ -159,18 +163,89 @@ async function pluginIssues(draft) {
|
|
|
159
163
|
}
|
|
160
164
|
return issues;
|
|
161
165
|
}
|
|
162
|
-
/**
|
|
163
|
-
|
|
166
|
+
/**
|
|
167
|
+
* A draft's connections of the space (A4 of docs/plans/capabilities.md): the connection must exist;
|
|
168
|
+
* on one that signs in as the space an AI step only reads, so a write action it lists is refused;
|
|
169
|
+
* a fixed `call` step names an action the connector has and the connection is for.
|
|
170
|
+
*/
|
|
171
|
+
async function spaceConnectionIssues(spaceId, draft) {
|
|
172
|
+
const connections = draft.connections ?? [];
|
|
173
|
+
const fixed = draft.steps.filter((s) => s.type === "agent" && s.call && "connection" in s.call);
|
|
174
|
+
if (!connections.some((c) => c.spaceConnection) && !fixed.length) {
|
|
175
|
+
return [];
|
|
176
|
+
}
|
|
177
|
+
const issues = [];
|
|
178
|
+
const rows = await listSpaceConnections(spaceId);
|
|
179
|
+
const connectors = new Map();
|
|
180
|
+
const connectorOf = async (id) => {
|
|
181
|
+
if (!connectors.has(id)) {
|
|
182
|
+
connectors.set(id, (await resolveConnector(spaceId, id))?.connector ?? null);
|
|
183
|
+
}
|
|
184
|
+
return connectors.get(id) ?? null;
|
|
185
|
+
};
|
|
186
|
+
for (const connection of connections) {
|
|
187
|
+
const row = connection.spaceConnection
|
|
188
|
+
? rows.find((r) => r.id === connection.spaceConnection)
|
|
189
|
+
: null;
|
|
190
|
+
if (connection.spaceConnection && !row) {
|
|
191
|
+
issues.push({
|
|
192
|
+
message: `Connection "${connection.id}" names the space's connection "${connection.spaceConnection}", which this space does not have.`,
|
|
193
|
+
});
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
const connector = await connectorOf(row?.connectorId ?? connection.connector ?? "");
|
|
197
|
+
if (!connector) {
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
const name = connection.title ?? connector.name;
|
|
201
|
+
if (row?.signIn === "space") {
|
|
202
|
+
const writes = (connection.actions ?? []).filter((id) => {
|
|
203
|
+
const action = connector.actions.find((a) => a.id === id);
|
|
204
|
+
return action && action.group !== "read";
|
|
205
|
+
});
|
|
206
|
+
for (const step of draft.steps) {
|
|
207
|
+
if (step.type !== "agent" || step.call || !step.connections?.includes(connection.id)) {
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
for (const id of writes) {
|
|
211
|
+
issues.push({
|
|
212
|
+
stepId: step.id,
|
|
213
|
+
message: `Step "${step.id}": "${id}" writes in ${name}, which signs in as the space. An AI step only reads there; put the write in a step with "call".`,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
for (const step of fixed.filter((s) => s.call.connection === connection.id)) {
|
|
219
|
+
const action = connector.actions.find((a) => a.id === step.call.action);
|
|
220
|
+
if (!action) {
|
|
221
|
+
issues.push({
|
|
222
|
+
stepId: step.id,
|
|
223
|
+
message: `Step "${step.id}": ${name} has no action "${step.call.action}".`,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
else if (row?.actions.length && !row.actions.includes(action.id)) {
|
|
227
|
+
issues.push({
|
|
228
|
+
stepId: step.id,
|
|
229
|
+
message: `Step "${step.id}": the connection ${name} is not for "${action.id}".`,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return issues;
|
|
235
|
+
}
|
|
236
|
+
/** Everything wrong with a draft: its structure, its workspace files, its space's connectors and plugins. */
|
|
237
|
+
export async function checkDraft(spaceId, draft, files) {
|
|
164
238
|
return [
|
|
165
239
|
...validateWizard(draft, files),
|
|
166
|
-
...(await connectorIssues(
|
|
240
|
+
...(await connectorIssues(spaceId, draft)),
|
|
241
|
+
...(await spaceConnectionIssues(spaceId, draft)),
|
|
167
242
|
...(await pluginIssues(draft)),
|
|
168
243
|
];
|
|
169
244
|
}
|
|
170
|
-
/** Validator issues of the draft, checked against its workspace and the
|
|
245
|
+
/** Validator issues of the draft, checked against its workspace and the space's connectors. */
|
|
171
246
|
export async function draftIssues(w) {
|
|
172
247
|
const files = await draftFiles(w.id);
|
|
173
|
-
return checkDraft(w.
|
|
248
|
+
return checkDraft(w.spaceId, w.draft, files.map((f) => f.path));
|
|
174
249
|
}
|
|
175
250
|
/** The draft with its validator issues and whether it differs from the published version. */
|
|
176
251
|
export async function wizardState(w) {
|
|
@@ -180,7 +255,7 @@ export async function wizardState(w) {
|
|
|
180
255
|
...wizardSummary(w),
|
|
181
256
|
draft: w.draft,
|
|
182
257
|
files,
|
|
183
|
-
issues: await checkDraft(w.
|
|
258
|
+
issues: await checkDraft(w.spaceId, w.draft, files.map((f) => f.path)),
|
|
184
259
|
dirty: !published ||
|
|
185
260
|
JSON.stringify(published.definition) !== JSON.stringify(w.draft) ||
|
|
186
261
|
!sameFiles(published.files, files),
|
|
@@ -242,13 +317,12 @@ export function parseDraft(raw, files) {
|
|
|
242
317
|
return { draft: parsed.data, issues: validateWizard(parsed.data, files) };
|
|
243
318
|
}
|
|
244
319
|
export async function createWizard(userId, input, writer = { source: "studio" }) {
|
|
245
|
-
// Asked first: a tenant that builds nothing here has no
|
|
320
|
+
// Asked first: a tenant that builds nothing here has no space of its own to name.
|
|
246
321
|
await requireBuild();
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
await requireWritable(project);
|
|
322
|
+
const named = () => (input.spaceId ? ownedSpace(userId, input.spaceId) : defaultSpace(userId));
|
|
323
|
+
await requireMaker(async () => (await named()).id);
|
|
324
|
+
const space = await named();
|
|
325
|
+
await requireWritable(space);
|
|
252
326
|
const starter = input.starterId
|
|
253
327
|
? await marketplaceWizard(input.starterId, asLang(input.lang))
|
|
254
328
|
: undefined;
|
|
@@ -270,7 +344,7 @@ export async function createWizard(userId, input, writer = { source: "studio" })
|
|
|
270
344
|
const shareToken = newShareToken();
|
|
271
345
|
await db.insert(schema.wizard).values({
|
|
272
346
|
id,
|
|
273
|
-
|
|
347
|
+
spaceId: space.id,
|
|
274
348
|
tenantId: currentTenant(),
|
|
275
349
|
title: draft.title,
|
|
276
350
|
draft,
|
|
@@ -308,7 +382,7 @@ export async function writeDraft(userId, wizardId, input, writer = { source: "st
|
|
|
308
382
|
const files = await draftFiles(w.id);
|
|
309
383
|
const paths = files.map((f) => f.path);
|
|
310
384
|
const { draft } = parseDraft(input.definition, paths);
|
|
311
|
-
const issues = await checkDraft(w.
|
|
385
|
+
const issues = await checkDraft(w.spaceId, draft, paths);
|
|
312
386
|
const [row] = await db
|
|
313
387
|
.update(schema.wizard)
|
|
314
388
|
.set({
|
|
@@ -349,7 +423,7 @@ export async function editWizard(userId, wizardId, input, writer) {
|
|
|
349
423
|
// A theme belongs to the space: it is saved there first, and the ops put it into the chain.
|
|
350
424
|
for (const op of input.ops) {
|
|
351
425
|
if (op.op === "set_theme") {
|
|
352
|
-
await saveTheme(userId, w.
|
|
426
|
+
await saveTheme(userId, w.spaceId, op.theme);
|
|
353
427
|
}
|
|
354
428
|
}
|
|
355
429
|
let definition;
|
|
@@ -366,8 +440,8 @@ export async function editWizard(userId, wizardId, input, writer) {
|
|
|
366
440
|
}
|
|
367
441
|
export async function updateWizardSettings(userId, wizardId, patch) {
|
|
368
442
|
const w = await writableWizard(userId, wizardId);
|
|
369
|
-
if (patch.
|
|
370
|
-
await requireWritable(await
|
|
443
|
+
if (patch.spaceId) {
|
|
444
|
+
await requireWritable(await ownedSpace(userId, patch.spaceId));
|
|
371
445
|
}
|
|
372
446
|
const runners = patch.runners ? await checkRunnerSettings(patch.runners) : undefined;
|
|
373
447
|
await db
|
|
@@ -396,14 +470,14 @@ export async function rotateShareLink(userId, wizardId) {
|
|
|
396
470
|
return { shareToken: token, shareUrl: shareUrl(token) };
|
|
397
471
|
}
|
|
398
472
|
export async function duplicateWizard(userId, wizardId) {
|
|
399
|
-
await
|
|
473
|
+
await requireMaker(async () => (await writableWizard(userId, wizardId)).spaceId);
|
|
400
474
|
const w = await writableWizard(userId, wizardId);
|
|
401
475
|
const id = nanoid(12);
|
|
402
476
|
const draft = { ...w.draft, title: `${w.draft.title} (Kopie)` };
|
|
403
477
|
const shareToken = newShareToken();
|
|
404
478
|
await db.insert(schema.wizard).values({
|
|
405
479
|
id,
|
|
406
|
-
|
|
480
|
+
spaceId: w.spaceId,
|
|
407
481
|
tenantId: currentTenant(),
|
|
408
482
|
title: draft.title,
|
|
409
483
|
draft,
|
|
@@ -423,13 +497,13 @@ export async function deleteWizard(userId, wizardId) {
|
|
|
423
497
|
await db
|
|
424
498
|
.delete(schema.wizard)
|
|
425
499
|
.where(and(eq(schema.wizard.id, wizardId), eq(schema.wizard.tenantId, currentTenant())));
|
|
426
|
-
await unlistWizard(w.
|
|
500
|
+
await unlistWizard(w.spaceId, wizardId);
|
|
427
501
|
pushWizards();
|
|
428
502
|
}
|
|
429
503
|
/** A wizard that is gone leaves its space's public page, which is sent again without it. */
|
|
430
|
-
async function unlistWizard(
|
|
431
|
-
const p = await db.query.
|
|
432
|
-
where: eq(schema.
|
|
504
|
+
async function unlistWizard(spaceId, wizardId) {
|
|
505
|
+
const p = await db.query.space.findFirst({
|
|
506
|
+
where: eq(schema.space.id, spaceId),
|
|
433
507
|
columns: { page: true },
|
|
434
508
|
});
|
|
435
509
|
if (!p?.page?.wizards.includes(wizardId)) {
|
|
@@ -437,18 +511,18 @@ async function unlistWizard(projectId, wizardId) {
|
|
|
437
511
|
}
|
|
438
512
|
const { [wizardId]: _gone, ...examples } = p.page.examples;
|
|
439
513
|
await db
|
|
440
|
-
.update(schema.
|
|
514
|
+
.update(schema.space)
|
|
441
515
|
.set({
|
|
442
516
|
page: { ...p.page, wizards: p.page.wizards.filter((id) => id !== wizardId), examples },
|
|
443
517
|
updatedAt: new Date(),
|
|
444
518
|
})
|
|
445
|
-
.where(eq(schema.
|
|
519
|
+
.where(eq(schema.space.id, spaceId));
|
|
446
520
|
pushPages();
|
|
447
521
|
}
|
|
448
522
|
/** A wizard with validator issues is never published — same rule for studio and MCP. */
|
|
449
523
|
export async function requireClean(w) {
|
|
450
524
|
const files = await draftFiles(w.id);
|
|
451
|
-
const issues = await checkDraft(w.
|
|
525
|
+
const issues = await checkDraft(w.spaceId, w.draft, files.map((f) => f.path));
|
|
452
526
|
if (issues.length) {
|
|
453
527
|
throw new ServiceError("has_issues", note("wizardStillErrors"), { issues });
|
|
454
528
|
}
|