@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
|
@@ -8,6 +8,9 @@ import { machineTranslated, translateDefinition } from "@engenty/wizards-shared/
|
|
|
8
8
|
import { eq } from "drizzle-orm";
|
|
9
9
|
import { nanoid } from "nanoid";
|
|
10
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";
|
|
11
14
|
import { connectionViews } from "../connectors/index.js";
|
|
12
15
|
import { addLocalCost, canSpend, releaseRun, reserveForRun, syncRunCost, } from "../credits/credits.js";
|
|
13
16
|
import { estimateRun } from "../credits/estimate.js";
|
|
@@ -22,9 +25,9 @@ import { runEnded } from "../plugins/events.js";
|
|
|
22
25
|
import { prompt } from "../prompts.js";
|
|
23
26
|
import { ContentBlockedError, checkGuestInput, checkGuestText, guestChecksOn, guestRun, } from "../safety.js";
|
|
24
27
|
import { reportRun } from "../services/manage-reports.js";
|
|
25
|
-
import { projectFiles } from "../services/project-files.js";
|
|
26
|
-
import { projectProfile } from "../services/projects.js";
|
|
27
28
|
import { switchedOffRunners } from "../services/runners.js";
|
|
29
|
+
import { spaceFiles } from "../services/space-files.js";
|
|
30
|
+
import { spaceProfile } from "../services/spaces.js";
|
|
28
31
|
import { storedTranslation } from "../services/translations.js";
|
|
29
32
|
import { latestShareJob } from "../sharing/state.js";
|
|
30
33
|
import { listRows, listSecrets, scopeOf } from "../store/index.js";
|
|
@@ -85,16 +88,16 @@ async function concurrencyLimit(tenant) {
|
|
|
85
88
|
async function loadRun(runId) {
|
|
86
89
|
return db.query.run.findFirst({ where: eq(schema.run.id, runId) });
|
|
87
90
|
}
|
|
88
|
-
/** The
|
|
89
|
-
export async function
|
|
91
|
+
/** The space a run's wizard belongs to — where its imported connectors live. */
|
|
92
|
+
export async function spaceIdOf(run) {
|
|
90
93
|
const w = await db.query.wizard.findFirst({ where: eq(schema.wizard.id, run.wizardId) });
|
|
91
|
-
return w?.
|
|
94
|
+
return w?.spaceId ?? "";
|
|
92
95
|
}
|
|
93
|
-
export async function
|
|
96
|
+
export async function loadSpace(run) {
|
|
94
97
|
const w = await db.query.wizard.findFirst({ where: eq(schema.wizard.id, run.wizardId) });
|
|
95
|
-
const p = w && (await db.query.
|
|
98
|
+
const p = w && (await db.query.space.findFirst({ where: eq(schema.space.id, w.spaceId) }));
|
|
96
99
|
if (!p) {
|
|
97
|
-
throw new Error("
|
|
100
|
+
throw new Error("space missing");
|
|
98
101
|
}
|
|
99
102
|
return p;
|
|
100
103
|
}
|
|
@@ -192,12 +195,15 @@ export async function createRun(input) {
|
|
|
192
195
|
if (!held) {
|
|
193
196
|
throw new NoCreditsError();
|
|
194
197
|
}
|
|
198
|
+
// What the run may reach outside, from the definition it starts on: fixed here, never widened.
|
|
199
|
+
const grant = grantOf(input.definition);
|
|
195
200
|
await db.insert(schema.run).values({
|
|
196
201
|
id,
|
|
197
202
|
wizardId: input.wizardId,
|
|
198
203
|
tenantId: currentTenant(),
|
|
199
204
|
definition: input.definition,
|
|
200
205
|
files: input.files,
|
|
206
|
+
grant,
|
|
201
207
|
version: input.version,
|
|
202
208
|
mode: input.mode,
|
|
203
209
|
runner: input.runner ?? null,
|
|
@@ -217,6 +223,10 @@ export async function createRun(input) {
|
|
|
217
223
|
? new Date(Date.now() + env.limits.resultTtlDays * 24 * 60 * 60 * 1000)
|
|
218
224
|
: null,
|
|
219
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
|
+
}
|
|
220
230
|
await indexRun({ runId: id, visitorId: input.visitorId, ipHash: input.ipHash });
|
|
221
231
|
reportRun(id, first.type === "page" ? "waiting_input" : "running");
|
|
222
232
|
if (first.type !== "page") {
|
|
@@ -224,6 +234,29 @@ export async function createRun(input) {
|
|
|
224
234
|
}
|
|
225
235
|
return id;
|
|
226
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
|
+
}
|
|
227
260
|
/**
|
|
228
261
|
* Puts the run to work: in line in the control database, and — when this process is a runner
|
|
229
262
|
* (`runner`, `all`) — taken at once if the tenant has a slot. The studio and the doors leave it
|
|
@@ -403,12 +436,13 @@ export async function pageContext(run, step) {
|
|
|
403
436
|
function viewContext(ctx) {
|
|
404
437
|
return { known: ctx.known, options: ctx.options, cards: ctx.cards, decidedFields: ctx.decided };
|
|
405
438
|
}
|
|
406
|
-
/** The wizard's lists with the person's rows, by list id. */
|
|
407
|
-
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) {
|
|
408
441
|
const scope = scopeOf(run);
|
|
442
|
+
const who = subjectsOf({ holder: holder ?? (await runHolder(run)), store: scope });
|
|
409
443
|
const out = {};
|
|
410
444
|
for (const def of run.definition.lists ?? []) {
|
|
411
|
-
out[def.id] = { def, rows: await listRows(scope, def) };
|
|
445
|
+
out[def.id] = { def, rows: await listRows(scope, def, who) };
|
|
412
446
|
}
|
|
413
447
|
return out;
|
|
414
448
|
}
|
|
@@ -416,16 +450,18 @@ async function storedLists(run) {
|
|
|
416
450
|
* What a step works with. A share job works with the same — the run's browser, store and
|
|
417
451
|
* answers — under a step id, progress lines and questions of its own.
|
|
418
452
|
*/
|
|
419
|
-
export async function makeContext(run,
|
|
453
|
+
export async function makeContext(run, space, state, signal, own = {}) {
|
|
420
454
|
const store = scopeOf(run);
|
|
421
455
|
const resources = resourcesFor(run.id);
|
|
422
|
-
resources.bind(store);
|
|
456
|
+
resources.bind(store, run);
|
|
423
457
|
const stepId = own.stepId ?? run.cursor ?? "";
|
|
458
|
+
const holder = await runHolder(run);
|
|
424
459
|
return {
|
|
425
460
|
runId: run.id,
|
|
426
461
|
tenantId: run.tenantId,
|
|
427
462
|
test: run.mode === "test",
|
|
428
463
|
stepId,
|
|
464
|
+
holder,
|
|
429
465
|
store,
|
|
430
466
|
def: run.definition,
|
|
431
467
|
lang: run.lang,
|
|
@@ -434,11 +470,11 @@ export async function makeContext(run, project, state, signal, own = {}) {
|
|
|
434
470
|
scope: {
|
|
435
471
|
def: run.definition,
|
|
436
472
|
state,
|
|
437
|
-
brand:
|
|
438
|
-
lists: await storedLists(run),
|
|
473
|
+
brand: spaceProfile(space),
|
|
474
|
+
lists: await storedLists(run, holder),
|
|
439
475
|
},
|
|
440
|
-
|
|
441
|
-
|
|
476
|
+
space,
|
|
477
|
+
spaceFiles: (await spaceFiles(space.id)).filter((f) => f.status === "ready"),
|
|
442
478
|
signal,
|
|
443
479
|
resources,
|
|
444
480
|
ask: own.ask ??
|
|
@@ -670,10 +706,10 @@ async function drive(runId, signal) {
|
|
|
670
706
|
return;
|
|
671
707
|
}
|
|
672
708
|
await emitEvent(runId, step.id, "step_started", step.working ?? step.title);
|
|
673
|
-
const
|
|
709
|
+
const space = await loadSpace(run);
|
|
674
710
|
const state = structuredClone(run.state);
|
|
675
711
|
try {
|
|
676
|
-
const ctx = await makeContext(run,
|
|
712
|
+
const ctx = await makeContext(run, space, state, signal);
|
|
677
713
|
// A guest's answers are checked once before any model works on them, and what a step
|
|
678
714
|
// wrote for a guest before it is kept (docs/plans/guest-content-guards.md).
|
|
679
715
|
const guest = guestRun(run) && (await guestChecksOn());
|
|
@@ -756,7 +792,7 @@ export async function submitPage(runId, stepId, input) {
|
|
|
756
792
|
throw new RunInputError(errors);
|
|
757
793
|
}
|
|
758
794
|
const connections = step.fields.some((f) => f.kind === "connection")
|
|
759
|
-
? await connectionViews(run.definition.connections ?? [], scopeOf(run), await
|
|
795
|
+
? await connectionViews(run.definition.connections ?? [], scopeOf(run), await spaceIdOf(run), textLang(wizardLang(run.definition)))
|
|
760
796
|
: [];
|
|
761
797
|
for (const field of step.fields) {
|
|
762
798
|
if (field.kind === "image" || field.kind === "file") {
|
|
@@ -978,7 +1014,11 @@ export async function talkAllowed(run) {
|
|
|
978
1014
|
const { enabled } = w?.runners ?? DEFAULT_RUNNER_SETTINGS;
|
|
979
1015
|
return enabled.some((id) => CONVERSATION_RUNNERS.includes(id) && !off.has(id));
|
|
980
1016
|
}
|
|
981
|
-
|
|
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()) {
|
|
982
1022
|
// In the viewer's language every text of the view is the translation; ids and values stay.
|
|
983
1023
|
const memory = run.lang ? await storedTranslation(run.wizardId, run.lang) : null;
|
|
984
1024
|
const translated = memory ? translateDefinition(run.definition, memory) : null;
|
|
@@ -1016,6 +1056,15 @@ export async function runView(run, brand) {
|
|
|
1016
1056
|
.filter((s) => Boolean(s))
|
|
1017
1057
|
.map(async (s) => {
|
|
1018
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
|
+
}
|
|
1019
1068
|
return {
|
|
1020
1069
|
step: s,
|
|
1021
1070
|
output: run.state.outputs[s.id] ?? null,
|
|
@@ -1058,7 +1107,10 @@ export async function runView(run, brand) {
|
|
|
1058
1107
|
}
|
|
1059
1108
|
: {}),
|
|
1060
1109
|
closed,
|
|
1061
|
-
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)),
|
|
1062
1114
|
shown,
|
|
1063
1115
|
progress: { done: run.status === "done" ? def.steps.length : index, total: def.steps.length },
|
|
1064
1116
|
canBack: run.state.history.length > 0 && run.status !== "running",
|
|
@@ -1069,7 +1121,7 @@ export async function runView(run, brand) {
|
|
|
1069
1121
|
ask: run.status === "running" ? run.ask : null,
|
|
1070
1122
|
lists,
|
|
1071
1123
|
connections: step?.type === "page" && step.fields.some((f) => f.kind === "connection")
|
|
1072
|
-
? await connectionViews(def.connections ?? [], scopeOf(run), await
|
|
1124
|
+
? await connectionViews(def.connections ?? [], scopeOf(run), await spaceIdOf(run), textLang(wizardLang(def)))
|
|
1073
1125
|
: [],
|
|
1074
1126
|
keeps: Boolean(def.lists?.length || def.connections?.length) ||
|
|
1075
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
2
|
import { allFields, classIdOf, dataRef, isDecisionStep, langNameEn, localeOf, stepShape, templateRefs, textClassOf, wizardLang, } from "@engenty/wizards-shared/definition";
|
|
3
|
-
import { mainLogo, ruleLines, runTheme } from "@engenty/wizards-shared/projects";
|
|
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, renderTask, 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 &&
|
|
@@ -484,6 +498,10 @@ export async function runAgentStep(step, ctx) {
|
|
|
484
498
|
});
|
|
485
499
|
const uploads = await personUploads(ctx);
|
|
486
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
|
+
}
|
|
487
505
|
// A step without tools of its own and without uploads: the run's device may answer it alone.
|
|
488
506
|
attachTools(resolved, tools, step.tools.length === 0 && uploads.length === 0);
|
|
489
507
|
const photos = await seenPhotos(step, ctx, resolved, uploads);
|
|
@@ -502,11 +520,11 @@ export async function runAgentStep(step, ctx) {
|
|
|
502
520
|
`Today is ${today(ctx)}.`,
|
|
503
521
|
brandBlock(ctx),
|
|
504
522
|
// Knowledge: what the space holds for its wizards, and how to find and read it.
|
|
505
|
-
await knowledgeBlock(ctx.
|
|
523
|
+
await knowledgeBlock(ctx.space.id),
|
|
506
524
|
// Skills: always on whole, on demand by name and description (docs/plans/skills.md).
|
|
507
525
|
skillsBlock(await skillsOf(ctx), {
|
|
508
526
|
tools: takesTools(resolved),
|
|
509
|
-
sandbox: step.tools.includes("sandbox") && sandboxCapabilities() !== null,
|
|
527
|
+
sandbox: step.tools.includes("sandbox") && ctx.resources.sandboxCapabilities() !== null,
|
|
510
528
|
}),
|
|
511
529
|
// What the space's plugins hold for its wizards: a wiki, questions and answers.
|
|
512
530
|
...(await spaceContextOf(ctx)).blocks,
|
|
@@ -669,7 +687,7 @@ function entriesOf(step, ctx) {
|
|
|
669
687
|
}
|
|
670
688
|
/** The document templates a document step can name; each is a `document.*` section. */
|
|
671
689
|
const DOCUMENT_TEMPLATES = new Set(["invoice", "offer", "briefing", "letter", "report", "free"]);
|
|
672
|
-
/** 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. */
|
|
673
691
|
function placeableImages(step, ctx) {
|
|
674
692
|
const out = [];
|
|
675
693
|
const index = ctx.def.steps.indexOf(step);
|
|
@@ -699,7 +717,7 @@ function placeableImages(step, ctx) {
|
|
|
699
717
|
}
|
|
700
718
|
}
|
|
701
719
|
}
|
|
702
|
-
const logos = ctx.
|
|
720
|
+
const logos = ctx.spaceFiles.filter((f) => f.kind === "logo");
|
|
703
721
|
const main = mainLogo(logos, ctx.scope.brand.logoSections);
|
|
704
722
|
for (const f of logos) {
|
|
705
723
|
const section = logoSectionLine(ctx.scope.brand.logoSections, f.id);
|
|
@@ -713,7 +731,7 @@ function placeableImages(step, ctx) {
|
|
|
713
731
|
});
|
|
714
732
|
}
|
|
715
733
|
for (const p of ctx.scope.brand.patterns ?? []) {
|
|
716
|
-
const file = ctx.
|
|
734
|
+
const file = ctx.spaceFiles.find((f) => f.id === p.file);
|
|
717
735
|
const section = ctx.scope.brand.colorSections?.find((s) => s.id === p.section);
|
|
718
736
|
if (file) {
|
|
719
737
|
out.push({
|
|
@@ -722,12 +740,12 @@ function placeableImages(step, ctx) {
|
|
|
722
740
|
});
|
|
723
741
|
}
|
|
724
742
|
}
|
|
725
|
-
for (const f of ctx.
|
|
743
|
+
for (const f of ctx.spaceFiles) {
|
|
726
744
|
if (f.kind === "asset" && f.mime.startsWith("image/")) {
|
|
727
745
|
const section = assetSectionLine(ctx.scope.brand.assetSections, f.id);
|
|
728
746
|
out.push({
|
|
729
747
|
id: f.id,
|
|
730
|
-
label: `${f.description || f.name} (from the
|
|
748
|
+
label: `${f.description || f.name} (from the space's assets${section ? `, section ${section}` : ""})`,
|
|
731
749
|
});
|
|
732
750
|
}
|
|
733
751
|
}
|
|
@@ -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");
|
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
|
|
@@ -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,
|
|
@@ -39,8 +39,8 @@ export async function followFor(tenantId, install, since, hear) {
|
|
|
39
39
|
if (e.event === "changes") {
|
|
40
40
|
const spaces = new Set();
|
|
41
41
|
for (const x of e.items) {
|
|
42
|
-
if (x.
|
|
43
|
-
spaces.add(x.
|
|
42
|
+
if (x.spaceId && !(x.seq !== undefined && pushedBy(tenantId, install, x.seq))) {
|
|
43
|
+
spaces.add(x.spaceId);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
// Its own push only: the number moves on, nothing to pull.
|
|
@@ -4,20 +4,21 @@ import { eq } from "drizzle-orm";
|
|
|
4
4
|
import { listConnectors } from "../connectors/external.js";
|
|
5
5
|
import { db, schema } from "../db/client.js";
|
|
6
6
|
import { embeddingModel } from "../models.js";
|
|
7
|
-
import { mayBuild,
|
|
7
|
+
import { mayBuild, spaceWritable } from "../services/access.js";
|
|
8
8
|
import { cloudLinked, cloudState } from "../services/cloud.js";
|
|
9
9
|
import { ServiceError } from "../services/errors.js";
|
|
10
|
+
import { closedToMe, studioOpen } from "../services/members-studio.js";
|
|
10
11
|
import { presentIn } from "../services/presence.js";
|
|
11
|
-
import { fileView, projectFiles } from "../services/project-files.js";
|
|
12
|
-
import { listProjects, ownedProject } from "../services/projects.js";
|
|
13
12
|
import { getPage, getRow, getTableHeader } from "../services/space-data.js";
|
|
13
|
+
import { fileView, spaceFiles } from "../services/space-files.js";
|
|
14
|
+
import { listSpaces, ownedSpace } from "../services/spaces.js";
|
|
14
15
|
import { publishedDefinition, translationsOf } from "../services/translations.js";
|
|
15
16
|
import { listWizards, ownedWizard, wizardMessages, wizardState } from "../services/wizards.js";
|
|
16
17
|
/** The spaces, as the studio lists them. */
|
|
17
18
|
export async function spacesView(r) {
|
|
18
|
-
const
|
|
19
|
+
const spaces = await listSpaces(r.userId, r.lang);
|
|
19
20
|
const build = await mayBuild();
|
|
20
|
-
return
|
|
21
|
+
return Promise.all(spaces.map(async (p) => ({
|
|
21
22
|
id: p.id,
|
|
22
23
|
name: p.name,
|
|
23
24
|
brand: p.brand,
|
|
@@ -29,12 +30,18 @@ export async function spacesView(r) {
|
|
|
29
30
|
origin: p.origin,
|
|
30
31
|
syncedAt: p.syncedAt?.toISOString() ?? null,
|
|
31
32
|
readOnly: p.origin === "local" || !build,
|
|
32
|
-
|
|
33
|
+
/** „Mitglieder dürfen ins Studio“: the organization's members build here too. */
|
|
34
|
+
membersStudio: p.membersStudio,
|
|
35
|
+
/** Whether this person reaches the space's Studio: a member only by the rule above. */
|
|
36
|
+
studio: await studioOpen(p),
|
|
37
|
+
/** How the admins hear of the broker's critical lines: Work's bell, the hourly mail. */
|
|
38
|
+
notify: p.notify,
|
|
39
|
+
})));
|
|
33
40
|
}
|
|
34
41
|
/** A space's wizards, as its cards show them. */
|
|
35
|
-
export async function wizardsView(r,
|
|
36
|
-
await
|
|
37
|
-
const wizards = await listWizards(r.userId,
|
|
42
|
+
export async function wizardsView(r, spaceId) {
|
|
43
|
+
await ownedSpace(r.userId, spaceId);
|
|
44
|
+
const wizards = await listWizards(r.userId, spaceId);
|
|
38
45
|
// A local install with an account: where each wizard stands in its cloud, for the cards.
|
|
39
46
|
const linked = await cloudLinked();
|
|
40
47
|
return Promise.all(wizards.map(async (w) => ({ ...w, cloud: linked ? await cloudState(w.id) : null })));
|
|
@@ -43,11 +50,11 @@ export async function wizardsView(r, projectId) {
|
|
|
43
50
|
export async function wizardView(r, id) {
|
|
44
51
|
const w = await ownedWizard(r.userId, id);
|
|
45
52
|
const messages = await wizardMessages(w.id);
|
|
46
|
-
const
|
|
53
|
+
const space = await ownedSpace(r.userId, w.spaceId);
|
|
47
54
|
return {
|
|
48
55
|
...(await wizardState(w)),
|
|
49
56
|
/** Shown and run here, changed elsewhere: a local install's wizard, or nothing is built here. */
|
|
50
|
-
readOnly: !(await
|
|
57
|
+
readOnly: !(await spaceWritable(space)),
|
|
51
58
|
blank: messages.length === 0 && !w.starter,
|
|
52
59
|
messages: messages.map((m) => ({
|
|
53
60
|
id: m.id,
|
|
@@ -75,18 +82,18 @@ export async function translationsView(r, wizardId) {
|
|
|
75
82
|
};
|
|
76
83
|
}
|
|
77
84
|
/** What a space holds for all its wizards. */
|
|
78
|
-
export async function filesView(r,
|
|
79
|
-
const
|
|
85
|
+
export async function filesView(r, spaceId) {
|
|
86
|
+
const space = await ownedSpace(r.userId, spaceId);
|
|
80
87
|
return {
|
|
81
|
-
files: (await
|
|
88
|
+
files: (await spaceFiles(space.id)).map(fileView),
|
|
82
89
|
/** Whether documents get vectors, or the index works on keywords alone. */
|
|
83
90
|
embeddings: Boolean(await embeddingModel().catch(() => null)),
|
|
84
91
|
};
|
|
85
92
|
}
|
|
86
93
|
/** The connectors a space's wizards can name. */
|
|
87
|
-
export async function connectorsView(r,
|
|
88
|
-
const
|
|
89
|
-
return listConnectors(
|
|
94
|
+
export async function connectorsView(r, spaceId) {
|
|
95
|
+
const space = await ownedSpace(r.userId, spaceId);
|
|
96
|
+
return listConnectors(space.id);
|
|
90
97
|
}
|
|
91
98
|
// --- one item, for the live stream ------------------------------------------------------------
|
|
92
99
|
const gone = (err) => err instanceof ServiceError && err.code === "not_found";
|
|
@@ -97,41 +104,59 @@ const gone = (err) => err instanceof ServiceError && err.code === "not_found";
|
|
|
97
104
|
const ITEM_VIEWS = {
|
|
98
105
|
space: async (r, x) => (await spacesView(r)).find((s) => s.id === x.item) ?? null,
|
|
99
106
|
wizard: async (r, x) => {
|
|
100
|
-
const summary = x.
|
|
101
|
-
? (await wizardsView(r, x.
|
|
107
|
+
const summary = x.spaceId
|
|
108
|
+
? (await wizardsView(r, x.spaceId)).find((w) => w.id === x.item)
|
|
102
109
|
: undefined;
|
|
103
110
|
return summary ? { summary, detail: await wizardView(r, x.item) } : null;
|
|
104
111
|
},
|
|
105
112
|
translation: async (r, x) => (x.parent ? translationsView(r, x.parent) : null),
|
|
106
113
|
message: null,
|
|
107
|
-
page: (r, x) => getPage(r.userId, x.item),
|
|
108
|
-
table: (r, x) => getTableHeader(r.userId, x.item),
|
|
114
|
+
page: (r, x) => getPage(r.userId, x.item, r.who),
|
|
115
|
+
table: (r, x) => getTableHeader(r.userId, x.item, r.who),
|
|
109
116
|
row: async (r, x) => {
|
|
110
|
-
const row = x.parent ? await getRow(r.userId, x.parent, x.item) : null;
|
|
117
|
+
const row = x.parent ? await getRow(r.userId, x.parent, x.item, r.who) : null;
|
|
111
118
|
return row ? { ...row, tableId: x.parent } : null;
|
|
112
119
|
},
|
|
113
120
|
category: null,
|
|
121
|
+
// Work's chats: the studio reads the chat and the sidebar again (routes/live.ts checks each).
|
|
122
|
+
chat: null,
|
|
114
123
|
presence: async (_r, x) => x.parent ? presentIn(x.parent, x.item.slice(x.parent.length + 1)) : [],
|
|
115
124
|
file: async (_r, x) => {
|
|
116
|
-
const row = await db.query.
|
|
125
|
+
const row = await db.query.spaceFile.findFirst({ where: eq(schema.spaceFile.id, x.item) });
|
|
117
126
|
return row ? fileView(row) : null;
|
|
118
127
|
},
|
|
119
128
|
// The studio asks for the space's skills again: a list of names, no view of its own.
|
|
120
129
|
skill: null,
|
|
121
130
|
connector: async (r, x) => {
|
|
122
|
-
if (!x.
|
|
131
|
+
if (!x.spaceId) {
|
|
123
132
|
return null;
|
|
124
133
|
}
|
|
125
|
-
const id = x.item.slice(x.
|
|
126
|
-
return (await connectorsView(r, x.
|
|
134
|
+
const id = x.item.slice(x.spaceId.length + 1);
|
|
135
|
+
return (await connectorsView(r, x.spaceId)).find((c) => c.id === id) ?? null;
|
|
127
136
|
},
|
|
128
137
|
};
|
|
138
|
+
/**
|
|
139
|
+
* What the Studio alone shows of a space: a member whose Studio the space is closed to gets no view
|
|
140
|
+
* of these, and the browser asks the studio API, which refuses it (services/members-studio.ts).
|
|
141
|
+
* The space itself, its files and connectors are what Work reads in every space.
|
|
142
|
+
*/
|
|
143
|
+
const STUDIO_KINDS = new Set([
|
|
144
|
+
"wizard",
|
|
145
|
+
"translation",
|
|
146
|
+
"page",
|
|
147
|
+
"table",
|
|
148
|
+
"row",
|
|
149
|
+
"presence",
|
|
150
|
+
]);
|
|
129
151
|
export async function itemView(r, x) {
|
|
130
152
|
const read = ITEM_VIEWS[x.kind];
|
|
131
153
|
if (!read) {
|
|
132
154
|
return undefined;
|
|
133
155
|
}
|
|
134
156
|
try {
|
|
157
|
+
if (x.spaceId && STUDIO_KINDS.has(x.kind) && (await closedToMe(x.spaceId))) {
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
135
160
|
return await read(r, x);
|
|
136
161
|
}
|
|
137
162
|
catch (err) {
|