@engenty/wizards-runtime 0.13.0 → 0.14.1
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 +26 -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/{0027_space_skill.sql → 0030_space_skill.sql} +8 -8
- 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-SpDcn8VZ.js +1 -0
- package/apps/web/dist/assets/CapabilitiesPage-Bgnm_3dk.js +2 -0
- package/apps/web/dist/assets/{ChangelogDialog-SwyId00t.js → ChangelogDialog-DAnjV6cZ.js} +1 -1
- package/apps/web/dist/assets/{CodeEditor-BwZsk5Al.js → CodeEditor-nxoOt8ge.js} +1 -1
- package/apps/web/dist/assets/EditorPage-B98C-9Nv.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-D8IYLg_S.js +1 -0
- package/apps/web/dist/assets/NewWizardPage-DlBt0Mfq.js +7 -0
- package/apps/web/dist/assets/OnboardingPage-ztHT01ah.js +1 -0
- package/apps/web/dist/assets/PreviewPane-DC1kAi3x.js +9 -0
- package/apps/web/dist/assets/PublicRunner-D6lKP0j8.js +1 -0
- package/apps/web/dist/assets/ReadOnly-DFsuKPCw.js +1 -0
- package/apps/web/dist/assets/SettingsPage-DkHeCO2c.js +2 -0
- package/apps/web/dist/assets/SetupPage-DZ8xRkfS.js +1 -0
- package/apps/web/dist/assets/SharePage-494ZPsjQ.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-CWlU_BZP.js +2 -0
- package/apps/web/dist/assets/UpdateCheck-BKNkNJyG.js +2 -0
- package/apps/web/dist/assets/changelog-BhMZS-rs.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-Cngd_QDO.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-C0WQlRKB.js +118 -0
- package/apps/web/dist/assets/i18n-BJ7Ld6O6.js +55 -0
- package/apps/web/dist/assets/index-ClVtdDUZ.js +10 -0
- package/apps/web/dist/assets/index-D18DvnxX.css +1 -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-BCau3f6O.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
|
@@ -11,10 +11,12 @@ import { nanoid } from "nanoid";
|
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import { asImpersonator } from "../auth/impersonation.js";
|
|
13
13
|
import { principalOf } from "../auth/index.js";
|
|
14
|
+
import { keptStepIds } from "../broker/index.js";
|
|
14
15
|
import { MARK_FOCUSED_PERSONAL } from "../browser/snapshot.js";
|
|
15
16
|
import { clientOf, clientRefused } from "../clients.js";
|
|
16
17
|
import { ConnectError, connectionViews, connectWithCredentials, disconnect, findConnection, finishOAuth, oauthStateLang, oauthStateRun, startOAuth, } from "../connectors/index.js";
|
|
17
18
|
import { finishPluginOAuth, pluginStateTenant } from "../connectors/plugin-connections.js";
|
|
19
|
+
import { finishSpaceConnectionOAuth, spaceConnectionStateTenant, } from "../connectors/space-connections.js";
|
|
18
20
|
import { db, schema, withTenant } from "../db/client.js";
|
|
19
21
|
import { answerAsk, pendingAsk } from "../engine/asks.js";
|
|
20
22
|
import { answerDevice, offerDevice, openDeviceCalls } from "../engine/device.js";
|
|
@@ -23,7 +25,7 @@ import { fieldErrorsIn } from "../engine/input.js";
|
|
|
23
25
|
import { fromOwner } from "../engine/owner.js";
|
|
24
26
|
import { pushAvailable, setPushDevice } from "../engine/push.js";
|
|
25
27
|
import { liveResources } from "../engine/resources.js";
|
|
26
|
-
import { cancel, createRun, editOutput, GuestBudgetError, goBack, NoCreditsError,
|
|
28
|
+
import { cancel, createRun, editOutput, GuestBudgetError, goBack, NoCreditsError, RunConflict, RunInputError, retry, reviewStep, runView, spaceIdOf, submitPage, talkAllowed, } from "../engine/runner.js";
|
|
27
29
|
import { basePath, env } from "../env.js";
|
|
28
30
|
import { loadAsset, saveAsset } from "../files/storage.js";
|
|
29
31
|
import { checkUpload } from "../files/upload-check.js";
|
|
@@ -39,7 +41,7 @@ import { runTicketValid, verifySignedUrl } from "../secrets/signing.js";
|
|
|
39
41
|
import { brandView } from "../services/brand.js";
|
|
40
42
|
import { ServiceError } from "../services/errors.js";
|
|
41
43
|
import { publicRunners, servePageRunner } from "../services/runners.js";
|
|
42
|
-
import { sharedRun, shareImage, shareRun, shareView, unshareRun } from "../services/shares.js";
|
|
44
|
+
import { sharedRun, sharedStepIds, shareImage, shareRun, shareView, unshareRun, } from "../services/shares.js";
|
|
43
45
|
import { shippedFontCss, shippedFontFile } from "../services/shipped-fonts.js";
|
|
44
46
|
import { isLangCode, storedTranslation, translateResult, translationFor, uiTexts, } from "../services/translations.js";
|
|
45
47
|
import { isIconFile, wizardAvatarSvg, wizardIcon } from "../services/wizard-icon.js";
|
|
@@ -140,9 +142,21 @@ async function accessibleRun(c, runId, opts = {}) {
|
|
|
140
142
|
}
|
|
141
143
|
return null;
|
|
142
144
|
}
|
|
143
|
-
|
|
145
|
+
/** Whether a signed-in member of the run's organization is looking, not the guest who ran it. */
|
|
146
|
+
async function memberViewing(c, run) {
|
|
147
|
+
const user = await principalOf(c);
|
|
148
|
+
return !!user && user.tenantId === run.tenantId;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* What a step of a guest's run made from a connection the space keeps for its members stays in
|
|
152
|
+
* the space: the guest's page says so; a member looking at the run (Ergebnisse) sees it.
|
|
153
|
+
*/
|
|
154
|
+
async function hiddenFrom(c, run) {
|
|
155
|
+
return (await memberViewing(c, run)) ? new Set() : keptStepIds(run);
|
|
156
|
+
}
|
|
157
|
+
async function viewOf(run, hide = new Set()) {
|
|
144
158
|
const w = await db.query.wizard.findFirst({ where: eq(schema.wizard.id, run.wizardId) });
|
|
145
|
-
return runView(run, await brandView(w?.
|
|
159
|
+
return runView(run, await brandView(w?.spaceId ?? "", run.definition.themes), hide);
|
|
146
160
|
}
|
|
147
161
|
function commandError(c, err) {
|
|
148
162
|
if (err instanceof RunInputError) {
|
|
@@ -256,7 +270,7 @@ async function publicBody(c, w, original, as) {
|
|
|
256
270
|
costume: def.costume,
|
|
257
271
|
intro: def.intro ?? null,
|
|
258
272
|
// `?theme=`: the theme the page showing the wizard asks for (an embed's `data-theme`).
|
|
259
|
-
brand: await brandView(w.
|
|
273
|
+
brand: await brandView(w.spaceId, def.themes, c.req.query("theme")?.slice(0, 80)),
|
|
260
274
|
turnstileSiteKey: env.turnstile.siteKey || null,
|
|
261
275
|
available: !reason,
|
|
262
276
|
unavailableReason: reason && noteText(reason, requestLang(c)),
|
|
@@ -535,9 +549,9 @@ export const publicRoutes = new Hono()
|
|
|
535
549
|
// frames load it from here, so any origin may.
|
|
536
550
|
.get("/fonts/:id", async (c) => {
|
|
537
551
|
const id = c.req.param("id");
|
|
538
|
-
const row = await db.query.
|
|
552
|
+
const row = await db.query.spaceFile.findFirst({ where: eq(schema.spaceFile.id, id) });
|
|
539
553
|
const p = row
|
|
540
|
-
? await db.query.
|
|
554
|
+
? await db.query.space.findFirst({ where: eq(schema.space.id, row.spaceId) })
|
|
541
555
|
: null;
|
|
542
556
|
const named = p?.brand.fonts?.some((f) => f.source && "file" in f.source && f.source.file === id);
|
|
543
557
|
const found = named && row?.mime.startsWith("font/") ? await loadAsset(id) : null;
|
|
@@ -560,7 +574,7 @@ export const runRoutes = new Hono()
|
|
|
560
574
|
if (!run) {
|
|
561
575
|
return c.json(notFoundAnswer(c), 404);
|
|
562
576
|
}
|
|
563
|
-
return c.json(await viewOf(run));
|
|
577
|
+
return c.json(await viewOf(run, await hiddenFrom(c, run)));
|
|
564
578
|
})
|
|
565
579
|
.get("/:id/stream", async (c) => {
|
|
566
580
|
const id = c.req.param("id");
|
|
@@ -568,6 +582,7 @@ export const runRoutes = new Hono()
|
|
|
568
582
|
if (!first) {
|
|
569
583
|
return c.json(notFoundAnswer(c), 404);
|
|
570
584
|
}
|
|
585
|
+
const member = await memberViewing(c, first);
|
|
571
586
|
return streamSSE(c, async (stream) => {
|
|
572
587
|
let pending = false;
|
|
573
588
|
let closed = false;
|
|
@@ -580,7 +595,8 @@ export const runRoutes = new Hono()
|
|
|
580
595
|
pending = false;
|
|
581
596
|
const run = await db.query.run.findFirst({ where: eq(schema.run.id, id) });
|
|
582
597
|
if (run && !closed) {
|
|
583
|
-
|
|
598
|
+
const hide = member ? new Set() : await keptStepIds(run);
|
|
599
|
+
await stream.writeSSE({ event: "view", data: JSON.stringify(await viewOf(run, hide)) });
|
|
584
600
|
}
|
|
585
601
|
};
|
|
586
602
|
// Calls the runner put to the device the run is watched from, each sent once per stream.
|
|
@@ -603,7 +619,10 @@ export const runRoutes = new Hono()
|
|
|
603
619
|
closed = true;
|
|
604
620
|
unsubscribe();
|
|
605
621
|
});
|
|
606
|
-
await stream.writeSSE({
|
|
622
|
+
await stream.writeSSE({
|
|
623
|
+
event: "view",
|
|
624
|
+
data: JSON.stringify(await viewOf(first, member ? new Set() : await keptStepIds(first))),
|
|
625
|
+
});
|
|
607
626
|
await sendDeviceCalls();
|
|
608
627
|
while (!closed) {
|
|
609
628
|
await stream.sleep(20_000);
|
|
@@ -958,14 +977,18 @@ export const runRoutes = new Hono()
|
|
|
958
977
|
if (!run) {
|
|
959
978
|
return c.notFound();
|
|
960
979
|
}
|
|
961
|
-
|
|
980
|
+
const assetId = c.req.param("assetId");
|
|
981
|
+
// The files of a step whose output stays in the space are not the guest's to open.
|
|
982
|
+
const hidden = [...(await hiddenFrom(c, run))].some((id) => run.state.outputs[id]?.assets?.some((a) => a.id === assetId));
|
|
983
|
+
return hidden ? c.notFound() : serveAsset(c, run, assetId);
|
|
962
984
|
})
|
|
963
985
|
.get("/:id/steps/:stepId/download", async (c) => {
|
|
964
986
|
const run = await accessibleRun(c, c.req.param("id"), { signed: true });
|
|
965
|
-
|
|
987
|
+
const stepId = c.req.param("stepId");
|
|
988
|
+
if (!run || (await hiddenFrom(c, run)).has(stepId)) {
|
|
966
989
|
return c.notFound();
|
|
967
990
|
}
|
|
968
|
-
return serveDownload(c, run,
|
|
991
|
+
return serveDownload(c, run, stepId, c.req.query("format"));
|
|
969
992
|
})
|
|
970
993
|
// --- a running step waits for the person ------------------------------------
|
|
971
994
|
.post("/:id/ask/:askId", async (c) => {
|
|
@@ -1154,15 +1177,13 @@ export const runRoutes = new Hono()
|
|
|
1154
1177
|
// --- the person's accounts ----------------------------------------------------
|
|
1155
1178
|
.post("/:id/connections/:connectionId/oauth/:connectorId", async (c) => {
|
|
1156
1179
|
const run = await accessibleRun(c, c.req.param("id"));
|
|
1157
|
-
const
|
|
1158
|
-
const connection = run
|
|
1159
|
-
? await findConnection(run, c.req.param("connectionId"), projectId)
|
|
1160
|
-
: null;
|
|
1180
|
+
const spaceId = run ? await spaceIdOf(run) : "";
|
|
1181
|
+
const connection = run ? await findConnection(run, c.req.param("connectionId"), spaceId) : null;
|
|
1161
1182
|
if (!run || !connection) {
|
|
1162
1183
|
return c.json(notFoundAnswer(c), 404);
|
|
1163
1184
|
}
|
|
1164
1185
|
try {
|
|
1165
|
-
const url = await startOAuth(scopeOf(run), await
|
|
1186
|
+
const url = await startOAuth(scopeOf(run), await spaceIdOf(run), run.id, connection, c.req.param("connectorId"), requestLang(c));
|
|
1166
1187
|
return c.json({ url });
|
|
1167
1188
|
}
|
|
1168
1189
|
catch (err) {
|
|
@@ -1174,10 +1195,8 @@ export const runRoutes = new Hono()
|
|
|
1174
1195
|
})
|
|
1175
1196
|
.post("/:id/connections/:connectionId/credentials/:connectorId", async (c) => {
|
|
1176
1197
|
const run = await accessibleRun(c, c.req.param("id"));
|
|
1177
|
-
const
|
|
1178
|
-
const connection = run
|
|
1179
|
-
? await findConnection(run, c.req.param("connectionId"), projectId)
|
|
1180
|
-
: null;
|
|
1198
|
+
const spaceId = run ? await spaceIdOf(run) : "";
|
|
1199
|
+
const connection = run ? await findConnection(run, c.req.param("connectionId"), spaceId) : null;
|
|
1181
1200
|
if (!run || !connection) {
|
|
1182
1201
|
return c.json(notFoundAnswer(c), 404);
|
|
1183
1202
|
}
|
|
@@ -1185,7 +1204,7 @@ export const runRoutes = new Hono()
|
|
|
1185
1204
|
.object({ values: z.record(z.string(), z.string().max(500)) })
|
|
1186
1205
|
.parse(await c.req.json());
|
|
1187
1206
|
try {
|
|
1188
|
-
const label = await connectWithCredentials(scopeOf(run),
|
|
1207
|
+
const label = await connectWithCredentials(scopeOf(run), spaceId, connection, c.req.param("connectorId"), values);
|
|
1189
1208
|
signalChanged(run.id);
|
|
1190
1209
|
return c.json({ ok: true, label });
|
|
1191
1210
|
}
|
|
@@ -1302,7 +1321,7 @@ export const runRoutes = new Hono()
|
|
|
1302
1321
|
lists,
|
|
1303
1322
|
files: await storeFiles(scope),
|
|
1304
1323
|
connections: [
|
|
1305
|
-
...(await connectionViews(run.definition.connections ?? [], scope, await
|
|
1324
|
+
...(await connectionViews(run.definition.connections ?? [], scope, await spaceIdOf(run), requestLang(c))).filter((x) => x.account),
|
|
1306
1325
|
...forSharing,
|
|
1307
1326
|
],
|
|
1308
1327
|
keepsSignIns: secrets.some((s) => s.slot === "browser"),
|
|
@@ -1417,7 +1436,7 @@ export const runRoutes = new Hono()
|
|
|
1417
1436
|
if (!run) {
|
|
1418
1437
|
return c.json({ error: "not found" }, 404);
|
|
1419
1438
|
}
|
|
1420
|
-
return c.json(await shareOverview(run, await
|
|
1439
|
+
return c.json(await shareOverview(run, await spaceIdOf(run), await isMember(c, run), langOf(c)));
|
|
1421
1440
|
})
|
|
1422
1441
|
.get("/:id/share/targets/:key/choices/:field", async (c) => {
|
|
1423
1442
|
const run = await accessibleRun(c, c.req.param("id"));
|
|
@@ -1511,15 +1530,21 @@ export const connectCallback = new Hono().get("/callback", async (c) => {
|
|
|
1511
1530
|
let said = c.req.query("error") === "exchange_failed"
|
|
1512
1531
|
? { code: "connectFailed" }
|
|
1513
1532
|
: { code: "connectCancelled" };
|
|
1514
|
-
// A plugin's sign-in (server.connections)
|
|
1533
|
+
// A plugin's sign-in (server.connections) and a space connection's name their tenant; a wizard's names its run.
|
|
1515
1534
|
const pluginTenant = state ? pluginStateTenant(state) : null;
|
|
1516
|
-
const
|
|
1535
|
+
const spaceTenant = state ? spaceConnectionStateTenant(state) : null;
|
|
1536
|
+
const tenant = state
|
|
1537
|
+
? (pluginTenant ?? spaceTenant ?? (await tenantOfRun(oauthStateRun(state) ?? "")))
|
|
1538
|
+
: null;
|
|
1517
1539
|
const answer = ticket ? { ticket } : code ? { code } : null;
|
|
1518
1540
|
if (answer && state && tenant) {
|
|
1519
1541
|
try {
|
|
1520
1542
|
if (pluginTenant) {
|
|
1521
1543
|
await withTenant(tenant, () => finishPluginOAuth(answer, state));
|
|
1522
1544
|
}
|
|
1545
|
+
else if (spaceTenant) {
|
|
1546
|
+
await withTenant(tenant, () => finishSpaceConnectionOAuth(answer, state));
|
|
1547
|
+
}
|
|
1523
1548
|
else {
|
|
1524
1549
|
const done = await withTenant(tenant, () => finishOAuth(answer, state));
|
|
1525
1550
|
signalChanged(done.runId);
|
|
@@ -1606,10 +1631,6 @@ async function serveDownload(c, run, stepId, rawFormat) {
|
|
|
1606
1631
|
}
|
|
1607
1632
|
return sendDownload(c, download);
|
|
1608
1633
|
}
|
|
1609
|
-
/** Steps a shared link shows: the result's deliverables — never uploads or in-between steps. */
|
|
1610
|
-
function sharedStepIds(run) {
|
|
1611
|
-
return new Set(run.definition.steps.flatMap((s) => s.type === "result" ? s.deliverables.map((d) => d.from) : []));
|
|
1612
|
-
}
|
|
1613
1634
|
/** `/api/shares/:token` — a shared result, readable by anyone holding the link until it expires. */
|
|
1614
1635
|
export const shareRoutes = new Hono()
|
|
1615
1636
|
// What a shared link shows is someone's result: never in a search engine.
|
|
@@ -1643,13 +1664,13 @@ export const shareRoutes = new Hono()
|
|
|
1643
1664
|
return c.notFound();
|
|
1644
1665
|
}
|
|
1645
1666
|
const assetId = c.req.param("assetId");
|
|
1646
|
-
const allowed = [...sharedStepIds(run)].some((id) => run.state.outputs[id]?.assets?.some((a) => a.id === assetId));
|
|
1667
|
+
const allowed = [...(await sharedStepIds(run))].some((id) => run.state.outputs[id]?.assets?.some((a) => a.id === assetId));
|
|
1647
1668
|
return allowed ? serveAsset(c, run, assetId) : c.notFound();
|
|
1648
1669
|
})
|
|
1649
1670
|
.get("/:token/steps/:stepId/download", async (c) => {
|
|
1650
1671
|
const run = await sharedRun(c.req.param("token"));
|
|
1651
1672
|
const stepId = c.req.param("stepId");
|
|
1652
|
-
if (!run || !sharedStepIds(run).has(stepId)) {
|
|
1673
|
+
if (!run || !(await sharedStepIds(run)).has(stepId)) {
|
|
1653
1674
|
return c.notFound();
|
|
1654
1675
|
}
|
|
1655
1676
|
return serveDownload(c, run, stepId, c.req.query("format"));
|
|
@@ -27,8 +27,8 @@ const uploadLimit = bodyLimit({
|
|
|
27
27
|
onError: (c) => c.json({ error: say(c, "tooLarge"), code: "too_large" }, 413),
|
|
28
28
|
});
|
|
29
29
|
export const skillRoutes = new Hono()
|
|
30
|
-
.get("/
|
|
31
|
-
.post("/
|
|
30
|
+
.get("/spaces/:id/skills", async (c) => c.json(await listSkills(c.get("user").id, c.req.param("id"))))
|
|
31
|
+
.post("/spaces/:id/skills", async (c) => {
|
|
32
32
|
const body = z
|
|
33
33
|
.object({
|
|
34
34
|
name: z.string().max(200),
|
|
@@ -39,7 +39,7 @@ export const skillRoutes = new Hono()
|
|
|
39
39
|
.parse(await c.req.json());
|
|
40
40
|
return c.json(await createSkill(c.get("user").id, c.req.param("id"), body));
|
|
41
41
|
})
|
|
42
|
-
.post("/
|
|
42
|
+
.post("/spaces/:id/skills/upload", uploadLimit, async (c) => {
|
|
43
43
|
const file = (await c.req.formData()).get("file");
|
|
44
44
|
if (!(file instanceof File)) {
|
|
45
45
|
throw new ServiceError("invalid", note("chooseFile"));
|
|
@@ -49,12 +49,12 @@ export const skillRoutes = new Hono()
|
|
|
49
49
|
data: new Uint8Array(await file.arrayBuffer()),
|
|
50
50
|
}));
|
|
51
51
|
})
|
|
52
|
-
.get("/
|
|
53
|
-
.get("/
|
|
52
|
+
.get("/spaces/:id/skills/registry", async (c) => c.json(await searchSkills(c.get("user").id, c.req.param("id"), c.req.query("q") ?? "")))
|
|
53
|
+
.get("/spaces/:id/skills/registry/preview", async (c) => {
|
|
54
54
|
const ref = z.string().regex(SKILL_REF).parse(c.req.query("ref"));
|
|
55
55
|
return c.json(await previewSkill(c.get("user").id, c.req.param("id"), ref));
|
|
56
56
|
})
|
|
57
|
-
.post("/
|
|
57
|
+
.post("/spaces/:id/skills/registry", async (c) => {
|
|
58
58
|
const body = z
|
|
59
59
|
.object({ ref: z.string().regex(SKILL_REF), mode: z.enum(SKILL_MODES).optional() })
|
|
60
60
|
.parse(await c.req.json());
|