@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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
1
2
|
import { marginOf, } from "@engenty/wizards-shared/decision";
|
|
2
3
|
import { branchValues, cardsFromData, conditionsOf, dataRef, followRules, formatsFor, isDecidedField, LIST_FORMATS, listRef, loopKey, MAX_SHOWN_FIELDS, optionsFromData, otherwiseOf, pageNeeds, textLang, whenHolds, wizardLang, } from "@engenty/wizards-shared/definition";
|
|
3
4
|
import { note, saidText, } from "@engenty/wizards-shared/run";
|
|
@@ -7,6 +8,9 @@ import { machineTranslated, translateDefinition } from "@engenty/wizards-shared/
|
|
|
7
8
|
import { eq } from "drizzle-orm";
|
|
8
9
|
import { nanoid } from "nanoid";
|
|
9
10
|
import { currentImpersonator } from "../auth/impersonation.js";
|
|
11
|
+
import { grantNote, grantOf, kindOf } from "../broker/index.js";
|
|
12
|
+
import { runHolder, subjectsOf } from "../broker/rwx.js";
|
|
13
|
+
import { resolveConnector } from "../connectors/external.js";
|
|
10
14
|
import { connectionViews } from "../connectors/index.js";
|
|
11
15
|
import { addLocalCost, canSpend, releaseRun, reserveForRun, syncRunCost, } from "../credits/credits.js";
|
|
12
16
|
import { estimateRun } from "../credits/estimate.js";
|
|
@@ -16,13 +20,14 @@ import { saveAsset } from "../files/storage.js";
|
|
|
16
20
|
import { managed, tenantInfo } from "../manage.js";
|
|
17
21
|
import { hasFfmpeg } from "../media/ffmpeg.js";
|
|
18
22
|
import { NotedError, noteOf, saidOf } from "../model-errors.js";
|
|
19
|
-
import { conversationAvailable, freeTierRefusal, freeTierText, ModelUnavailableError, noteFreeTierRefusal, } from "../models.js";
|
|
23
|
+
import { conversationAvailable, freeTierRefusal, freeTierText, ModelUnavailableError, noteFreeTierRefusal, takeMasked, } from "../models.js";
|
|
20
24
|
import { runEnded } from "../plugins/events.js";
|
|
21
25
|
import { prompt } from "../prompts.js";
|
|
26
|
+
import { ContentBlockedError, checkGuestInput, checkGuestText, guestChecksOn, guestRun, } from "../safety.js";
|
|
22
27
|
import { reportRun } from "../services/manage-reports.js";
|
|
23
|
-
import { projectFiles } from "../services/project-files.js";
|
|
24
|
-
import { projectProfile } from "../services/projects.js";
|
|
25
28
|
import { switchedOffRunners } from "../services/runners.js";
|
|
29
|
+
import { spaceFiles } from "../services/space-files.js";
|
|
30
|
+
import { spaceProfile } from "../services/spaces.js";
|
|
26
31
|
import { storedTranslation } from "../services/translations.js";
|
|
27
32
|
import { latestShareJob } from "../sharing/state.js";
|
|
28
33
|
import { listRows, listSecrets, scopeOf } from "../store/index.js";
|
|
@@ -34,7 +39,7 @@ import { clearDeviceCalls } from "./device.js";
|
|
|
34
39
|
import { emitEvent, recentEvents, signalChanged } from "./events.js";
|
|
35
40
|
import { readPageInput } from "./input.js";
|
|
36
41
|
import { pushRun } from "./push.js";
|
|
37
|
-
import { blockingMessage, closedChoices, missingModelsSaid, openValue, stepsWithoutModel, } from "./requirements.js";
|
|
42
|
+
import { blockingMessage, closedChoices, maskedNote, missingModelsSaid, openValue, stepsWithoutModel, tierRefusalSaid, } from "./requirements.js";
|
|
38
43
|
import { releaseResources, resourcesFor } from "./resources.js";
|
|
39
44
|
import { outputSchema, runAutomaticStep } from "./steps.js";
|
|
40
45
|
import { answersAsText, resolveRef } from "./template.js";
|
|
@@ -83,16 +88,16 @@ async function concurrencyLimit(tenant) {
|
|
|
83
88
|
async function loadRun(runId) {
|
|
84
89
|
return db.query.run.findFirst({ where: eq(schema.run.id, runId) });
|
|
85
90
|
}
|
|
86
|
-
/** The
|
|
87
|
-
export async function
|
|
91
|
+
/** The space a run's wizard belongs to — where its imported connectors live. */
|
|
92
|
+
export async function spaceIdOf(run) {
|
|
88
93
|
const w = await db.query.wizard.findFirst({ where: eq(schema.wizard.id, run.wizardId) });
|
|
89
|
-
return w?.
|
|
94
|
+
return w?.spaceId ?? "";
|
|
90
95
|
}
|
|
91
|
-
export async function
|
|
96
|
+
export async function loadSpace(run) {
|
|
92
97
|
const w = await db.query.wizard.findFirst({ where: eq(schema.wizard.id, run.wizardId) });
|
|
93
|
-
const p = w && (await db.query.
|
|
98
|
+
const p = w && (await db.query.space.findFirst({ where: eq(schema.space.id, w.spaceId) }));
|
|
94
99
|
if (!p) {
|
|
95
|
-
throw new Error("
|
|
100
|
+
throw new Error("space missing");
|
|
96
101
|
}
|
|
97
102
|
return p;
|
|
98
103
|
}
|
|
@@ -153,10 +158,23 @@ function friendly(err) {
|
|
|
153
158
|
* as that note, so a runner shows it in its language; the run's error is in the wizard's.
|
|
154
159
|
*/
|
|
155
160
|
async function failRun(run, stepId, err) {
|
|
156
|
-
const said = noteOf(err) ?? friendly(err);
|
|
161
|
+
const said = noteOf(err) ?? (await tierRefusalSaid(err)) ?? friendly(err);
|
|
157
162
|
const message = saidText(said, textLang(wizardLang(run.definition)));
|
|
158
163
|
await emitEvent(run.id, stepId, "error", said);
|
|
159
|
-
|
|
164
|
+
// What the content rules stopped is kept on the run: Manage hears of it with the failed turn.
|
|
165
|
+
const blocked = err instanceof ContentBlockedError
|
|
166
|
+
? (await db.query.run.findFirst({
|
|
167
|
+
where: eq(schema.run.id, run.id),
|
|
168
|
+
columns: { state: true },
|
|
169
|
+
}))?.state
|
|
170
|
+
: undefined;
|
|
171
|
+
await updateRun(run.id, {
|
|
172
|
+
status: "failed",
|
|
173
|
+
error: message,
|
|
174
|
+
...(blocked && err instanceof ContentBlockedError
|
|
175
|
+
? { state: { ...blocked, blocked: err.kind } }
|
|
176
|
+
: {}),
|
|
177
|
+
});
|
|
160
178
|
}
|
|
161
179
|
// --- creating & driving ------------------------------------------------------
|
|
162
180
|
export async function createRun(input) {
|
|
@@ -177,12 +195,15 @@ export async function createRun(input) {
|
|
|
177
195
|
if (!held) {
|
|
178
196
|
throw new NoCreditsError();
|
|
179
197
|
}
|
|
198
|
+
// What the run may reach outside, from the definition it starts on: fixed here, never widened.
|
|
199
|
+
const grant = grantOf(input.definition);
|
|
180
200
|
await db.insert(schema.run).values({
|
|
181
201
|
id,
|
|
182
202
|
wizardId: input.wizardId,
|
|
183
203
|
tenantId: currentTenant(),
|
|
184
204
|
definition: input.definition,
|
|
185
205
|
files: input.files,
|
|
206
|
+
grant,
|
|
186
207
|
version: input.version,
|
|
187
208
|
mode: input.mode,
|
|
188
209
|
runner: input.runner ?? null,
|
|
@@ -202,6 +223,10 @@ export async function createRun(input) {
|
|
|
202
223
|
? new Date(Date.now() + env.limits.resultTtlDays * 24 * 60 * 60 * 1000)
|
|
203
224
|
: null,
|
|
204
225
|
});
|
|
226
|
+
const may = grantNote(grant, input.definition, await grantConnectors(input.wizardId, input.definition));
|
|
227
|
+
if (may) {
|
|
228
|
+
await emitEvent(id, first.id, "info", may);
|
|
229
|
+
}
|
|
205
230
|
await indexRun({ runId: id, visitorId: input.visitorId, ipHash: input.ipHash });
|
|
206
231
|
reportRun(id, first.type === "page" ? "waiting_input" : "running");
|
|
207
232
|
if (first.type !== "page") {
|
|
@@ -209,6 +234,29 @@ export async function createRun(input) {
|
|
|
209
234
|
}
|
|
210
235
|
return id;
|
|
211
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* The wizard's connectors as the space has them, by connection id, for the line that says what
|
|
239
|
+
* the run may do: their names, and what kind each action is. A connector the space does not have
|
|
240
|
+
* is left out; the line then names the connection as the definition does.
|
|
241
|
+
*/
|
|
242
|
+
async function grantConnectors(wizardId, definition) {
|
|
243
|
+
const out = {};
|
|
244
|
+
const imported = (definition.connections ?? []).filter((c) => c.connector);
|
|
245
|
+
if (!imported.length) {
|
|
246
|
+
return out;
|
|
247
|
+
}
|
|
248
|
+
const spaceId = await spaceIdOf({ wizardId });
|
|
249
|
+
for (const c of imported) {
|
|
250
|
+
const resolved = await resolveConnector(spaceId, c.connector).catch(() => null);
|
|
251
|
+
if (resolved) {
|
|
252
|
+
out[c.id] = {
|
|
253
|
+
name: resolved.connector.name,
|
|
254
|
+
kinds: Object.fromEntries(resolved.connector.actions.map((a) => [a.id, kindOf(a.group)])),
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return out;
|
|
259
|
+
}
|
|
212
260
|
/**
|
|
213
261
|
* Puts the run to work: in line in the control database, and — when this process is a runner
|
|
214
262
|
* (`runner`, `all`) — taken at once if the tenant has a slot. The studio and the doors leave it
|
|
@@ -388,12 +436,13 @@ export async function pageContext(run, step) {
|
|
|
388
436
|
function viewContext(ctx) {
|
|
389
437
|
return { known: ctx.known, options: ctx.options, cards: ctx.cards, decidedFields: ctx.decided };
|
|
390
438
|
}
|
|
391
|
-
/** The wizard's lists with the person's rows, by list id. */
|
|
392
|
-
async function storedLists(run) {
|
|
439
|
+
/** The wizard's lists with the person's rows, by list id; a shared list's as its holder may read them. */
|
|
440
|
+
async function storedLists(run, holder) {
|
|
393
441
|
const scope = scopeOf(run);
|
|
442
|
+
const who = subjectsOf({ holder: holder ?? (await runHolder(run)), store: scope });
|
|
394
443
|
const out = {};
|
|
395
444
|
for (const def of run.definition.lists ?? []) {
|
|
396
|
-
out[def.id] = { def, rows: await listRows(scope, def) };
|
|
445
|
+
out[def.id] = { def, rows: await listRows(scope, def, who) };
|
|
397
446
|
}
|
|
398
447
|
return out;
|
|
399
448
|
}
|
|
@@ -401,16 +450,18 @@ async function storedLists(run) {
|
|
|
401
450
|
* What a step works with. A share job works with the same — the run's browser, store and
|
|
402
451
|
* answers — under a step id, progress lines and questions of its own.
|
|
403
452
|
*/
|
|
404
|
-
export async function makeContext(run,
|
|
453
|
+
export async function makeContext(run, space, state, signal, own = {}) {
|
|
405
454
|
const store = scopeOf(run);
|
|
406
455
|
const resources = resourcesFor(run.id);
|
|
407
|
-
resources.bind(store);
|
|
456
|
+
resources.bind(store, run);
|
|
408
457
|
const stepId = own.stepId ?? run.cursor ?? "";
|
|
458
|
+
const holder = await runHolder(run);
|
|
409
459
|
return {
|
|
410
460
|
runId: run.id,
|
|
411
461
|
tenantId: run.tenantId,
|
|
412
462
|
test: run.mode === "test",
|
|
413
463
|
stepId,
|
|
464
|
+
holder,
|
|
414
465
|
store,
|
|
415
466
|
def: run.definition,
|
|
416
467
|
lang: run.lang,
|
|
@@ -419,11 +470,11 @@ export async function makeContext(run, project, state, signal, own = {}) {
|
|
|
419
470
|
scope: {
|
|
420
471
|
def: run.definition,
|
|
421
472
|
state,
|
|
422
|
-
brand:
|
|
423
|
-
lists: await storedLists(run),
|
|
473
|
+
brand: spaceProfile(space),
|
|
474
|
+
lists: await storedLists(run, holder),
|
|
424
475
|
},
|
|
425
|
-
|
|
426
|
-
|
|
476
|
+
space,
|
|
477
|
+
spaceFiles: (await spaceFiles(space.id)).filter((f) => f.status === "ready"),
|
|
427
478
|
signal,
|
|
428
479
|
resources,
|
|
429
480
|
ask: own.ask ??
|
|
@@ -655,19 +706,42 @@ async function drive(runId, signal) {
|
|
|
655
706
|
return;
|
|
656
707
|
}
|
|
657
708
|
await emitEvent(runId, step.id, "step_started", step.working ?? step.title);
|
|
658
|
-
const
|
|
709
|
+
const space = await loadSpace(run);
|
|
659
710
|
const state = structuredClone(run.state);
|
|
660
711
|
try {
|
|
661
|
-
const
|
|
712
|
+
const ctx = await makeContext(run, space, state, signal);
|
|
713
|
+
// A guest's answers are checked once before any model works on them, and what a step
|
|
714
|
+
// wrote for a guest before it is kept (docs/plans/guest-content-guards.md).
|
|
715
|
+
const guest = guestRun(run) && (await guestChecksOn());
|
|
716
|
+
if (guest) {
|
|
717
|
+
const answers = [answersAsText(ctx.scope), ...Object.values(state.notes)].join("\n");
|
|
718
|
+
const hash = createHash("sha256").update(answers).digest("base64url").slice(0, 24);
|
|
719
|
+
if (state.inputChecked !== hash) {
|
|
720
|
+
await checkGuestInput({ text: answers, call: ctx.call, signal });
|
|
721
|
+
state.inputChecked = hash;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
const output = await runAutomaticStep(step, ctx);
|
|
662
725
|
if (signal.aborted) {
|
|
663
726
|
return;
|
|
664
727
|
}
|
|
728
|
+
if (guest) {
|
|
729
|
+
await checkGuestText({
|
|
730
|
+
text: output.text || (output.json ? JSON.stringify(output.json) : ""),
|
|
731
|
+
call: ctx.call,
|
|
732
|
+
signal,
|
|
733
|
+
});
|
|
734
|
+
}
|
|
665
735
|
await syncRunCost(runId);
|
|
666
736
|
state.outputs[step.id] = output;
|
|
667
737
|
delete state.notes[step.id];
|
|
668
738
|
delete state.redo?.[step.id];
|
|
669
739
|
const cursor = await advance(run, step.id, state);
|
|
670
740
|
await updateRun(runId, { state, cursor, status: cursor ? "running" : "done", error: null });
|
|
741
|
+
const masked = takeMasked(runId, step.id);
|
|
742
|
+
if (masked) {
|
|
743
|
+
await emitEvent(runId, step.id, "info", maskedNote(masked));
|
|
744
|
+
}
|
|
671
745
|
await emitEvent(runId, step.id, "step_done", step.title);
|
|
672
746
|
}
|
|
673
747
|
catch (err) {
|
|
@@ -718,7 +792,7 @@ export async function submitPage(runId, stepId, input) {
|
|
|
718
792
|
throw new RunInputError(errors);
|
|
719
793
|
}
|
|
720
794
|
const connections = step.fields.some((f) => f.kind === "connection")
|
|
721
|
-
? await connectionViews(run.definition.connections ?? [], scopeOf(run), await
|
|
795
|
+
? await connectionViews(run.definition.connections ?? [], scopeOf(run), await spaceIdOf(run), textLang(wizardLang(run.definition)))
|
|
722
796
|
: [];
|
|
723
797
|
for (const field of step.fields) {
|
|
724
798
|
if (field.kind === "image" || field.kind === "file") {
|
|
@@ -819,6 +893,10 @@ export async function reviewStep(runId, stepId, action) {
|
|
|
819
893
|
else {
|
|
820
894
|
state.outputs[target] = editedJson(run.definition, target, output, edit);
|
|
821
895
|
}
|
|
896
|
+
// A guest's own words in a result are held to the same rules as what a step wrote.
|
|
897
|
+
if (guestRun(run) && (await guestChecksOn())) {
|
|
898
|
+
await checkGuestText({ text: typeof edit === "string" ? edit : JSON.stringify(edit) });
|
|
899
|
+
}
|
|
822
900
|
}
|
|
823
901
|
state.history.push(stepId);
|
|
824
902
|
const cursor = await advance(run, stepId, state);
|
|
@@ -936,7 +1014,11 @@ export async function talkAllowed(run) {
|
|
|
936
1014
|
const { enabled } = w?.runners ?? DEFAULT_RUNNER_SETTINGS;
|
|
937
1015
|
return enabled.some((id) => CONVERSATION_RUNNERS.includes(id) && !off.has(id));
|
|
938
1016
|
}
|
|
939
|
-
|
|
1017
|
+
/**
|
|
1018
|
+
* The run as the viewer sees it. `hide`: steps whose output stays in the space (broker/kept.ts):
|
|
1019
|
+
* shown with no output and `kept`, left out of `outputs`; empty for a member, or a member's run.
|
|
1020
|
+
*/
|
|
1021
|
+
export async function runView(run, brand, hide = new Set()) {
|
|
940
1022
|
// In the viewer's language every text of the view is the translation; ids and values stay.
|
|
941
1023
|
const memory = run.lang ? await storedTranslation(run.wizardId, run.lang) : null;
|
|
942
1024
|
const translated = memory ? translateDefinition(run.definition, memory) : null;
|
|
@@ -974,6 +1056,15 @@ export async function runView(run, brand) {
|
|
|
974
1056
|
.filter((s) => Boolean(s))
|
|
975
1057
|
.map(async (s) => {
|
|
976
1058
|
const deliverable = step?.type === "result" ? step.deliverables.find((d) => d.from === s.id) : undefined;
|
|
1059
|
+
if (hide.has(s.id) && run.state.outputs[s.id]) {
|
|
1060
|
+
return {
|
|
1061
|
+
step: s,
|
|
1062
|
+
output: null,
|
|
1063
|
+
formats: [],
|
|
1064
|
+
label: deliverable?.label ?? null,
|
|
1065
|
+
kept: true,
|
|
1066
|
+
};
|
|
1067
|
+
}
|
|
977
1068
|
return {
|
|
978
1069
|
step: s,
|
|
979
1070
|
output: run.state.outputs[s.id] ?? null,
|
|
@@ -1016,7 +1107,10 @@ export async function runView(run, brand) {
|
|
|
1016
1107
|
}
|
|
1017
1108
|
: {}),
|
|
1018
1109
|
closed,
|
|
1019
|
-
outputs: Object.fromEntries(shownIds
|
|
1110
|
+
outputs: Object.fromEntries(shownIds
|
|
1111
|
+
.filter((id) => !hide.has(id))
|
|
1112
|
+
.map((id) => [id, run.state.outputs[id]])
|
|
1113
|
+
.filter(([, o]) => o)),
|
|
1020
1114
|
shown,
|
|
1021
1115
|
progress: { done: run.status === "done" ? def.steps.length : index, total: def.steps.length },
|
|
1022
1116
|
canBack: run.state.history.length > 0 && run.status !== "running",
|
|
@@ -1027,7 +1121,7 @@ export async function runView(run, brand) {
|
|
|
1027
1121
|
ask: run.status === "running" ? run.ask : null,
|
|
1028
1122
|
lists,
|
|
1029
1123
|
connections: step?.type === "page" && step.fields.some((f) => f.kind === "connection")
|
|
1030
|
-
? await connectionViews(def.connections ?? [], scopeOf(run), await
|
|
1124
|
+
? await connectionViews(def.connections ?? [], scopeOf(run), await spaceIdOf(run), textLang(wizardLang(def)))
|
|
1031
1125
|
: [],
|
|
1032
1126
|
keeps: Boolean(def.lists?.length || def.connections?.length) ||
|
|
1033
1127
|
// An account connected for sharing is kept too, and can be deleted the same way.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { pOf } from "@engenty/wizards-shared/decision";
|
|
2
|
-
import { allFields, dataRef, isDecisionStep, langNameEn, localeOf, stepShape, templateRefs, wizardLang, } from "@engenty/wizards-shared/definition";
|
|
3
|
-
import { mainLogo, ruleLines, runTheme } from "@engenty/wizards-shared/projects";
|
|
2
|
+
import { allFields, classIdOf, dataRef, isDecisionStep, langNameEn, localeOf, stepShape, templateRefs, textClassOf, wizardLang, } from "@engenty/wizards-shared/definition";
|
|
4
3
|
import { note as runNote } from "@engenty/wizards-shared/run";
|
|
5
4
|
import { fitData, labelOf, recordsOf, shapeJsonSchema, shapeLines, shapeZod, titleKey, } from "@engenty/wizards-shared/shape";
|
|
5
|
+
import { mainLogo, ruleLines, runTheme } from "@engenty/wizards-shared/spaces";
|
|
6
6
|
import { validateSurface, } from "@engenty/wizards-shared/surface";
|
|
7
7
|
import { Agent } from "@mastra/core/agent";
|
|
8
8
|
import { generateText, jsonSchema, Output, parsePartialJson } from "ai";
|
|
@@ -14,8 +14,8 @@ import { agentModel, attachTools, costOf, isHarnessVendor, takesTools, textModel
|
|
|
14
14
|
import { runMotionGraphicsStep } from "../motion-graphics/step.js";
|
|
15
15
|
import { prompt } from "../prompts.js";
|
|
16
16
|
import { contentPolicy } from "../safety.js";
|
|
17
|
-
import { sandboxCapabilities } from "../sandbox/index.js";
|
|
18
17
|
import { knowledgeBlock } from "../services/knowledge.js";
|
|
18
|
+
import { callConnection } from "../tools/connector.js";
|
|
19
19
|
import { buildStepTools } from "../tools/index.js";
|
|
20
20
|
import { callPluginTool, spaceContextOf } from "../tools/plugin.js";
|
|
21
21
|
import { skillsBlock, skillsOf } from "../tools/skills.js";
|
|
@@ -24,7 +24,7 @@ import { runWidgetStep } from "../widgets/step.js";
|
|
|
24
24
|
import { decide } from "./decide.js";
|
|
25
25
|
import { prepareInputs } from "./prepare.js";
|
|
26
26
|
import { runSurfaceStep } from "./surface.js";
|
|
27
|
-
import { answersAsText, assetSectionLine, colorLine, factLines, logoSectionLine, renderTemplate, resolveRef, typeLines, } from "./template.js";
|
|
27
|
+
import { answersAsText, assetSectionLine, colorLine, factLines, linkLines, logoSectionLine, renderTask, renderTemplate, resolveRef, typeLines, voiceLines, } from "./template.js";
|
|
28
28
|
import { StepError } from "./types.js";
|
|
29
29
|
/** Today's date as the wizard's people write it. */
|
|
30
30
|
function today(ctx) {
|
|
@@ -38,8 +38,15 @@ function brandBlock(ctx) {
|
|
|
38
38
|
const b = ctx.scope.brand;
|
|
39
39
|
const parts = [
|
|
40
40
|
b.name,
|
|
41
|
+
b.brandName && b.brandName !== b.name ? `Brand name, written as it is: ${b.brandName}` : "",
|
|
42
|
+
b.tagline ? `Tagline: ${b.tagline}` : "",
|
|
41
43
|
b.about,
|
|
44
|
+
b.voice?.length ? `How the brand speaks, in its words:\n${voiceLines(b.voice)}` : "",
|
|
45
|
+
b.voiceRules?.length
|
|
46
|
+
? `Rules for what the brand says, in its words:\n${ruleLines(b.voiceRules)}`
|
|
47
|
+
: "",
|
|
42
48
|
b.facts?.length ? `Facts:\n${factLines(b.facts)}` : "",
|
|
49
|
+
b.links?.length ? `Where the brand is found:\n${linkLines(b.links)}` : "",
|
|
43
50
|
b.colors?.length
|
|
44
51
|
? `Colours (the first is the accent): ${colorLine(b.colors, b.colorSections, b.gradients)}`
|
|
45
52
|
: "",
|
|
@@ -457,10 +464,17 @@ function callInput(value, ctx) {
|
|
|
457
464
|
}
|
|
458
465
|
return value;
|
|
459
466
|
}
|
|
460
|
-
/**
|
|
467
|
+
/**
|
|
468
|
+
* A step's `call`: one plugin tool or one action of a connection, no model; its answer is the
|
|
469
|
+
* step's json output as it is. A connection's action runs through the broker as the step, with
|
|
470
|
+
* the fields the wizard fixed: the one way a run writes as the space.
|
|
471
|
+
*/
|
|
461
472
|
async function runCallStep(step, ctx) {
|
|
462
473
|
// What it is doing is the step's `working` line, shown as it starts, and what the tool says.
|
|
463
|
-
const
|
|
474
|
+
const input = callInput(step.call.input, ctx);
|
|
475
|
+
const answer = "tool" in step.call
|
|
476
|
+
? await callPluginTool(step.call.tool, input, ctx)
|
|
477
|
+
: await callConnection(step.call, input, ctx);
|
|
464
478
|
if (answer &&
|
|
465
479
|
typeof answer === "object" &&
|
|
466
480
|
"error" in answer &&
|
|
@@ -477,9 +491,17 @@ export async function runAgentStep(step, ctx) {
|
|
|
477
491
|
if (step.each) {
|
|
478
492
|
return runAgentEach(step, ctx);
|
|
479
493
|
}
|
|
480
|
-
const resolved = await textModel(step.model ?? "standard", {
|
|
494
|
+
const resolved = await textModel(textClassOf(step.model ?? "standard"), {
|
|
495
|
+
...ctx.call,
|
|
496
|
+
effort: step.effort,
|
|
497
|
+
makerClass: step.maker ? classIdOf(step, "standard") : undefined,
|
|
498
|
+
});
|
|
481
499
|
const uploads = await personUploads(ctx);
|
|
482
500
|
const { tools, assets, instructions } = await buildStepTools(step, ctx, resolved, uploads);
|
|
501
|
+
// A step written for the sandbox on a run without one works on in text: said in the run's log.
|
|
502
|
+
if (step.tools.includes("sandbox") && !ctx.resources.sandboxCapabilities()) {
|
|
503
|
+
await ctx.emit("info", { code: "noSandbox" });
|
|
504
|
+
}
|
|
483
505
|
// A step without tools of its own and without uploads: the run's device may answer it alone.
|
|
484
506
|
attachTools(resolved, tools, step.tools.length === 0 && uploads.length === 0);
|
|
485
507
|
const photos = await seenPhotos(step, ctx, resolved, uploads);
|
|
@@ -498,11 +520,11 @@ export async function runAgentStep(step, ctx) {
|
|
|
498
520
|
`Today is ${today(ctx)}.`,
|
|
499
521
|
brandBlock(ctx),
|
|
500
522
|
// Knowledge: what the space holds for its wizards, and how to find and read it.
|
|
501
|
-
await knowledgeBlock(ctx.
|
|
523
|
+
await knowledgeBlock(ctx.space.id),
|
|
502
524
|
// Skills: always on whole, on demand by name and description (docs/plans/skills.md).
|
|
503
525
|
skillsBlock(await skillsOf(ctx), {
|
|
504
526
|
tools: takesTools(resolved),
|
|
505
|
-
sandbox: step.tools.includes("sandbox") && sandboxCapabilities() !== null,
|
|
527
|
+
sandbox: step.tools.includes("sandbox") && ctx.resources.sandboxCapabilities() !== null,
|
|
506
528
|
}),
|
|
507
529
|
// What the space's plugins hold for its wizards: a wiki, questions and answers.
|
|
508
530
|
...(await spaceContextOf(ctx)).blocks,
|
|
@@ -511,7 +533,7 @@ export async function runAgentStep(step, ctx) {
|
|
|
511
533
|
.filter(Boolean)
|
|
512
534
|
.join("\n\n");
|
|
513
535
|
const request = [
|
|
514
|
-
`# TASK\n${
|
|
536
|
+
`# TASK\n${renderTask(step.instructions, ctx.scope)}`,
|
|
515
537
|
answersBlock(ctx),
|
|
516
538
|
photos.length
|
|
517
539
|
? prompt("step", "photos", {
|
|
@@ -665,7 +687,7 @@ function entriesOf(step, ctx) {
|
|
|
665
687
|
}
|
|
666
688
|
/** The document templates a document step can name; each is a `document.*` section. */
|
|
667
689
|
const DOCUMENT_TEMPLATES = new Set(["invoice", "offer", "briefing", "letter", "report", "free"]);
|
|
668
|
-
/** Images a document may place: earlier generated images, uploads, the
|
|
690
|
+
/** Images a document may place: earlier generated images, uploads, the space's logos and images. */
|
|
669
691
|
function placeableImages(step, ctx) {
|
|
670
692
|
const out = [];
|
|
671
693
|
const index = ctx.def.steps.indexOf(step);
|
|
@@ -695,7 +717,7 @@ function placeableImages(step, ctx) {
|
|
|
695
717
|
}
|
|
696
718
|
}
|
|
697
719
|
}
|
|
698
|
-
const logos = ctx.
|
|
720
|
+
const logos = ctx.spaceFiles.filter((f) => f.kind === "logo");
|
|
699
721
|
const main = mainLogo(logos, ctx.scope.brand.logoSections);
|
|
700
722
|
for (const f of logos) {
|
|
701
723
|
const section = logoSectionLine(ctx.scope.brand.logoSections, f.id);
|
|
@@ -709,7 +731,7 @@ function placeableImages(step, ctx) {
|
|
|
709
731
|
});
|
|
710
732
|
}
|
|
711
733
|
for (const p of ctx.scope.brand.patterns ?? []) {
|
|
712
|
-
const file = ctx.
|
|
734
|
+
const file = ctx.spaceFiles.find((f) => f.id === p.file);
|
|
713
735
|
const section = ctx.scope.brand.colorSections?.find((s) => s.id === p.section);
|
|
714
736
|
if (file) {
|
|
715
737
|
out.push({
|
|
@@ -718,12 +740,12 @@ function placeableImages(step, ctx) {
|
|
|
718
740
|
});
|
|
719
741
|
}
|
|
720
742
|
}
|
|
721
|
-
for (const f of ctx.
|
|
743
|
+
for (const f of ctx.spaceFiles) {
|
|
722
744
|
if (f.kind === "asset" && f.mime.startsWith("image/")) {
|
|
723
745
|
const section = assetSectionLine(ctx.scope.brand.assetSections, f.id);
|
|
724
746
|
out.push({
|
|
725
747
|
id: f.id,
|
|
726
|
-
label: `${f.description || f.name} (from the
|
|
748
|
+
label: `${f.description || f.name} (from the space's assets${section ? `, section ${section}` : ""})`,
|
|
727
749
|
});
|
|
728
750
|
}
|
|
729
751
|
}
|
|
@@ -774,7 +796,11 @@ async function writeHtml(step, ctx, kind) {
|
|
|
774
796
|
const request = [`# BRIEF\n${brief}`, answersBlock(ctx), await revisionBlock(ctx, step.id)]
|
|
775
797
|
.filter(Boolean)
|
|
776
798
|
.join("\n\n");
|
|
777
|
-
const writer = await textModel(step.model ?? "standard", {
|
|
799
|
+
const writer = await textModel(textClassOf(step.model ?? "standard"), {
|
|
800
|
+
...ctx.call,
|
|
801
|
+
effort: step.effort,
|
|
802
|
+
makerClass: step.maker ? classIdOf(step, "standard") : undefined,
|
|
803
|
+
});
|
|
778
804
|
const result = await generateText({
|
|
779
805
|
model: writer.model,
|
|
780
806
|
system,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { allFields, isAudioValue, isLocationValue, itemsTotals, localeOf, locationText, wizardLang, } from "@engenty/wizards-shared/definition";
|
|
2
2
|
import { formatMoney } from "@engenty/wizards-shared/numbers";
|
|
3
|
-
import { fontLicenseWords, gradientCss, textStyleLine, } from "@engenty/wizards-shared/
|
|
3
|
+
import { fontLicenseWords, gradientCss, textStyleLine, } from "@engenty/wizards-shared/spaces";
|
|
4
4
|
import { listAsMarkdown } from "@engenty/wizards-shared/store";
|
|
5
5
|
import { prompt } from "../prompts.js";
|
|
6
6
|
const TEMPLATE_RE = /\{\{\s*([^}]+?)\s*\}\}/g;
|
|
@@ -31,6 +31,14 @@ export function itemsAsMarkdown(field, value, values, lang = "en") {
|
|
|
31
31
|
export function factLines(facts) {
|
|
32
32
|
return facts.map((f) => `${f.label}: ${f.value}`).join("\n");
|
|
33
33
|
}
|
|
34
|
+
/** The brand's voice as a model reads it: each block under its title. */
|
|
35
|
+
export function voiceLines(voice) {
|
|
36
|
+
return voice.map((b) => (b.title ? `${b.title}: ${b.text}` : b.text)).join("\n");
|
|
37
|
+
}
|
|
38
|
+
/** Links as lines a model reads: "Label: address". */
|
|
39
|
+
export function linkLines(links) {
|
|
40
|
+
return links.map((l) => (l.label ? `${l.label}: ${l.url}` : l.url)).join("\n");
|
|
41
|
+
}
|
|
34
42
|
/**
|
|
35
43
|
* The colours as a model reads them; a section's after the standard ones. A gradients section
|
|
36
44
|
* names its gradients as CSS, each with what it is for.
|
|
@@ -86,6 +94,15 @@ function brandRef(brand, key) {
|
|
|
86
94
|
return brand.name ?? "";
|
|
87
95
|
case "about":
|
|
88
96
|
return brand.about ?? "";
|
|
97
|
+
// The brand's own name where it has one, else the title.
|
|
98
|
+
case "brandName":
|
|
99
|
+
return brand.brandName || brand.name || "";
|
|
100
|
+
case "tagline":
|
|
101
|
+
return brand.tagline ?? "";
|
|
102
|
+
case "voice":
|
|
103
|
+
return voiceLines(brand.voice ?? []);
|
|
104
|
+
case "links":
|
|
105
|
+
return linkLines(brand.links ?? []);
|
|
89
106
|
// What the free "details" text once held is now the description and the facts.
|
|
90
107
|
case "details":
|
|
91
108
|
return [brand.about, factLines(brand.facts ?? [])].filter(Boolean).join("\n");
|
|
@@ -225,6 +242,23 @@ export function resolveRef(ref, scope) {
|
|
|
225
242
|
export function renderTemplate(template, scope) {
|
|
226
243
|
return template.replace(TEMPLATE_RE, (_m, ref) => stringify(resolveRef(ref.trim(), scope)));
|
|
227
244
|
}
|
|
245
|
+
const REFERENCE_KINDS = new Set(["image", "file", "signature"]);
|
|
246
|
+
/**
|
|
247
|
+
* A step's task with what the person typed marked as data: a field's value in `<data field="…">`,
|
|
248
|
+
* so a model tells the wizard's instructions from a visitor's words (prompts/step.md,
|
|
249
|
+
* ground_rules). Files and images stay names a tool reads; the rest as `renderTemplate`.
|
|
250
|
+
*/
|
|
251
|
+
export function renderTask(template, scope) {
|
|
252
|
+
return template.replace(TEMPLATE_RE, (_m, ref) => {
|
|
253
|
+
const value = stringify(resolveRef(ref.trim(), scope));
|
|
254
|
+
const head = ref.trim().split(".")[0];
|
|
255
|
+
const field = allFields(scope.def).find((f) => f.id === head);
|
|
256
|
+
if (!field || REFERENCE_KINDS.has(field.kind) || value === "") {
|
|
257
|
+
return value;
|
|
258
|
+
}
|
|
259
|
+
return `<data field="${head}">${value.replaceAll("</data>", "")}</data>`;
|
|
260
|
+
});
|
|
261
|
+
}
|
|
228
262
|
/** Everything the person entered so far, readable — handed to agents as data. */
|
|
229
263
|
export function answersAsText(scope) {
|
|
230
264
|
const lines = [];
|
package/apps/runtime/dist/env.js
CHANGED
|
@@ -194,7 +194,7 @@ export const env = {
|
|
|
194
194
|
video: str("MODEL_VIDEO", "google/veo-3.1-fast-generate-001"),
|
|
195
195
|
audio: str("MODEL_AUDIO", "google/gemini-3.5-flash-lite"),
|
|
196
196
|
speech: str("MODEL_SPEECH", "google/gemini-3.8-flash-tts"),
|
|
197
|
-
/** Vectors for a
|
|
197
|
+
/** Vectors for a space's document index; not a class a step names. */
|
|
198
198
|
embedding: str("MODEL_EMBEDDING", "openai/text-embedding-3-small"),
|
|
199
199
|
},
|
|
200
200
|
/**
|
|
@@ -216,6 +216,11 @@ export const env = {
|
|
|
216
216
|
* or empty for the first one that is ready here.
|
|
217
217
|
*/
|
|
218
218
|
sandbox: str("SANDBOX_ENABLED", "1") === "1" ? str("SANDBOX").toLowerCase() : "off",
|
|
219
|
+
/**
|
|
220
|
+
* The engine for a guest's run (a visitor's, a channel's): `off` or `agentos`, never Docker;
|
|
221
|
+
* `agentos` only when it is ready here (sandbox/index.ts, pickGuestEngine).
|
|
222
|
+
*/
|
|
223
|
+
sandboxGuests: str("SANDBOX_GUESTS", "off").toLowerCase(),
|
|
219
224
|
sandboxImage,
|
|
220
225
|
/** Where `wizards sandbox add` installs the engines that aren't part of the runtime. */
|
|
221
226
|
sandboxEngines: enginesDir(),
|
|
@@ -276,11 +281,11 @@ export const env = {
|
|
|
276
281
|
/** Runs of one tenant that work at the same time; the Manage-App can set another number per tenant. */
|
|
277
282
|
concurrentRuns: num("LIMIT_CONCURRENT_RUNS", 4),
|
|
278
283
|
/**
|
|
279
|
-
*
|
|
284
|
+
* Spaces a tenant works with. One: the studio shows no space switcher. The Manage-App
|
|
280
285
|
* can set another number per tenant; the database holds any number either way.
|
|
281
286
|
*/
|
|
282
|
-
|
|
283
|
-
/** Wizards a local install may keep on this runtime in its synced
|
|
287
|
+
spaces: num("LIMIT_SPACES", 1),
|
|
288
|
+
/** Wizards a local install may keep on this runtime in its synced space. */
|
|
284
289
|
syncedWizards: num("LIMIT_SYNCED_WIZARDS", 50),
|
|
285
290
|
/** End-user runs (no account) and their shared links are deleted after this many days. */
|
|
286
291
|
resultTtlDays: num("RESULT_TTL_DAYS", 7),
|
|
@@ -19,6 +19,7 @@ import { clearRunning, writeRunning } from "./running.js";
|
|
|
19
19
|
import { reportAllWizards } from "./services/manage-reports.js";
|
|
20
20
|
import { syncMarketplace } from "./services/marketplace.js";
|
|
21
21
|
import { purgeExpiredRuns } from "./services/shares.js";
|
|
22
|
+
import { dropChatSandboxes } from "./services/work-sandbox.js";
|
|
22
23
|
import { purgeUnusedStores } from "./store/index.js";
|
|
23
24
|
import { compactLog } from "./sync/log.js";
|
|
24
25
|
import { forgetRunner, registerRunner } from "./tenants/control.js";
|
|
@@ -104,11 +105,25 @@ async function purge() {
|
|
|
104
105
|
void purge().catch((err) => console.error("[retention]", err));
|
|
105
106
|
// Assets came into the index later than documents: what is not there yet goes in once.
|
|
106
107
|
if (env.serves.studio) {
|
|
107
|
-
const { indexMissingAssets } = await import("./services/
|
|
108
|
+
const { indexMissingAssets } = await import("./services/space-index.js");
|
|
108
109
|
for (const id of await knownTenants()) {
|
|
109
|
-
void withTenant(id, () => indexMissingAssets()).catch((err) => console.error(`[
|
|
110
|
+
void withTenant(id, () => indexMissingAssets()).catch((err) => console.error(`[space-index ${id}]`, err));
|
|
110
111
|
}
|
|
111
112
|
}
|
|
113
|
+
// The broker is heard (docs/plans/broker.md, "Notifications"): a guest's critical lines go to
|
|
114
|
+
// the Manage-App at once, the rest daily; the admins of each space get a mail once an hour where
|
|
115
|
+
// none of them was in the app. The studio alone, so several runners don't send the same mail.
|
|
116
|
+
if (env.serves.studio) {
|
|
117
|
+
const { startCriticalReports } = await import("./services/manage-reports.js");
|
|
118
|
+
startCriticalReports();
|
|
119
|
+
const { sendCriticalMails } = await import("./services/broker-notify.js");
|
|
120
|
+
const criticalMails = async () => {
|
|
121
|
+
for (const id of await knownTenants()) {
|
|
122
|
+
await withTenant(id, () => sendCriticalMails()).catch((err) => console.error(`[broker] the hourly mail for ${id}:`, err.message));
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
setInterval(() => void criticalMails(), 3600_000).unref();
|
|
126
|
+
}
|
|
112
127
|
setInterval(() => void purge().catch((err) => console.error("[retention]", err)), 3600_000).unref();
|
|
113
128
|
// A runtime that runs alone sends again what did not arrive in its account's cloud.
|
|
114
129
|
if (!managed) {
|
|
@@ -133,6 +148,7 @@ async function shutdown(code = 0) {
|
|
|
133
148
|
await forgetRunner().catch(() => undefined);
|
|
134
149
|
}
|
|
135
150
|
await closeBrowser();
|
|
151
|
+
await dropChatSandboxes();
|
|
136
152
|
process.exit(code);
|
|
137
153
|
}
|
|
138
154
|
// A process that hangs (docs/plans/health-and-status.md) ends, after saying what hangs; the
|
|
@@ -2,6 +2,7 @@ import { and, eq } from "drizzle-orm";
|
|
|
2
2
|
import { db, schema } from "./db/client.js";
|
|
3
3
|
import { env } from "./env.js";
|
|
4
4
|
import { escapeHtml } from "./render/convert.js";
|
|
5
|
+
import { guestRun } from "./safety.js";
|
|
5
6
|
import { sharedRun, shareView } from "./services/shares.js";
|
|
6
7
|
function tags(p) {
|
|
7
8
|
const t = [
|
|
@@ -32,6 +33,14 @@ export async function linkPreview(path) {
|
|
|
32
33
|
return null;
|
|
33
34
|
}
|
|
34
35
|
const view = await shareView(run);
|
|
36
|
+
// A guest's result stays private: the card names the wizard, never what it made.
|
|
37
|
+
if (guestRun(run)) {
|
|
38
|
+
return tags({
|
|
39
|
+
title: view.wizard.title,
|
|
40
|
+
description: view.wizard.description,
|
|
41
|
+
url: `${env.publicUrl}/s/${share[1]}`,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
35
44
|
return tags({
|
|
36
45
|
title: view.title === view.wizard.title ? view.title : `${view.title} · ${view.wizard.title}`,
|
|
37
46
|
description: view.message ?? view.wizard.description,
|
|
@@ -18,10 +18,10 @@ export async function oldestSeq() {
|
|
|
18
18
|
}
|
|
19
19
|
/** The changes after `since`, oldest first, at most `limit`. */
|
|
20
20
|
export async function changesAfter(since, limit) {
|
|
21
|
-
const rows = await db.all(sql `SELECT seq,
|
|
21
|
+
const rows = await db.all(sql `SELECT seq, space_id, kind, op, item, parent FROM live_change WHERE seq > ${since} ORDER BY seq LIMIT ${limit}`);
|
|
22
22
|
return rows.map((r) => ({
|
|
23
23
|
seq: r.seq,
|
|
24
|
-
|
|
24
|
+
spaceId: r.space_id,
|
|
25
25
|
kind: r.kind,
|
|
26
26
|
op: r.op,
|
|
27
27
|
item: r.item,
|