@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
package/apps/runtime/dist/app.js
CHANGED
|
@@ -25,7 +25,10 @@ import { MCP_RESOURCE, SCOPES } from "./mcp/scopes.js";
|
|
|
25
25
|
import { openCommand } from "./open-command.js";
|
|
26
26
|
import { PLUGIN_NAME, pluginArchive, pluginMarketplace } from "./plugin.js";
|
|
27
27
|
import { apiRoutes } from "./routes/api.js";
|
|
28
|
+
import { brokerRoutes } from "./routes/broker.js";
|
|
29
|
+
import { connectionRoutes } from "./routes/connections.js";
|
|
28
30
|
import { browserReport, localDebugRoutes } from "./routes/debug.js";
|
|
31
|
+
import { discoverRoutes } from "./routes/discover.js";
|
|
29
32
|
import { internalRoutes } from "./routes/internal.js";
|
|
30
33
|
import { notFoundAnswer, requestLang, say, spelledFor } from "./routes/lang.js";
|
|
31
34
|
import { liveRoutes } from "./routes/live.js";
|
|
@@ -35,15 +38,19 @@ import { personRoutes } from "./routes/person.js";
|
|
|
35
38
|
import { publicPluginRoutes } from "./routes/plugin-public.js";
|
|
36
39
|
import { pluginRoutes } from "./routes/plugins.js";
|
|
37
40
|
import { reportRoutes } from "./routes/reports.js";
|
|
41
|
+
import { ruleRoutes } from "./routes/rules.js";
|
|
38
42
|
import { clientIp, connectCallback, publicRoutes, runRoutes, shareRoutes } from "./routes/runs.js";
|
|
39
43
|
import { runtimeSettingsRoutes } from "./routes/runtime-settings.js";
|
|
40
44
|
import { skillRoutes } from "./routes/skills.js";
|
|
41
45
|
import { studio } from "./routes/studio.js";
|
|
42
46
|
import { wizardStream } from "./routes/wizard-stream.js";
|
|
47
|
+
import { workRoutes } from "./routes/work.js";
|
|
43
48
|
import { runTicketValid } from "./secrets/signing.js";
|
|
44
49
|
import { asRole } from "./services/access.js";
|
|
45
50
|
import { ServiceError } from "./services/errors.js";
|
|
51
|
+
import { membersStudioGate } from "./services/members-studio.js";
|
|
46
52
|
import { servePageRunner } from "./services/runners.js";
|
|
53
|
+
import { markSeen } from "./services/seen.js";
|
|
47
54
|
import { afterStudioWrite, beforeStudioLoad } from "./sync/client.js";
|
|
48
55
|
import { tenantOfLink, tenantStatus } from "./tenants/control.js";
|
|
49
56
|
const app = new Hono();
|
|
@@ -233,7 +240,7 @@ if (serves.doors) {
|
|
|
233
240
|
});
|
|
234
241
|
}
|
|
235
242
|
/** The studio's requests that open an item: a wizard, a page, a table, a skill, a space. */
|
|
236
|
-
const STUDIO_LOADS = /\/api\/studio\/(wizards\/[^/]+|pages\/[^/]+|tables\/[^/]+|skills\/[^/]+|
|
|
243
|
+
const STUDIO_LOADS = /\/api\/studio\/(wizards\/[^/]+|pages\/[^/]+|tables\/[^/]+|skills\/[^/]+|spaces(\/[^/]+(\/(data|knowledge|files|wizards|page|skills))?)?)$/;
|
|
237
244
|
if (serves.studio) {
|
|
238
245
|
/** Studio requests act as the signed-in person, inside that person's tenant. */
|
|
239
246
|
app.use("/api/studio/*", async (c, next) => {
|
|
@@ -251,6 +258,8 @@ if (serves.studio) {
|
|
|
251
258
|
}, 403);
|
|
252
259
|
}
|
|
253
260
|
c.set("user", user);
|
|
261
|
+
// The person is here: the hourly mail of the broker's lines waits (services/seen.ts).
|
|
262
|
+
void withTenant(user.tenantId, () => markSeen(user.id)).catch(() => undefined);
|
|
254
263
|
// A save: open studios hear of it now, not at the next tick (live/hub.ts).
|
|
255
264
|
const writes = c.req.method !== "GET";
|
|
256
265
|
if (managed) {
|
|
@@ -280,6 +289,8 @@ if (serves.studio) {
|
|
|
280
289
|
}
|
|
281
290
|
});
|
|
282
291
|
});
|
|
292
|
+
// A member reaches a space's studio only where its admins opened it (behind `capabilities`).
|
|
293
|
+
app.use("/api/studio/*", membersStudioGate);
|
|
283
294
|
const mcp = mcpHandler();
|
|
284
295
|
app.on(["GET", "POST", "DELETE"], "/api/mcp", (c) => mcp(c.req.raw));
|
|
285
296
|
}
|
|
@@ -309,7 +320,12 @@ if (serves.studio) {
|
|
|
309
320
|
app.route("/api/studio/organization", organizationRoutes);
|
|
310
321
|
app.route("/api/studio/person", personRoutes);
|
|
311
322
|
app.route("/api/studio", skillRoutes);
|
|
323
|
+
app.route("/api/studio", discoverRoutes);
|
|
324
|
+
app.route("/api/studio", ruleRoutes);
|
|
325
|
+
app.route("/api/studio", connectionRoutes);
|
|
326
|
+
app.route("/api/studio", brokerRoutes);
|
|
312
327
|
app.route("/api/studio/runtime", runtimeSettingsRoutes);
|
|
328
|
+
app.route("/api/studio/work", workRoutes);
|
|
313
329
|
app.route("/api/studio", studio);
|
|
314
330
|
app.route("/api/v1", apiRoutes);
|
|
315
331
|
app.route("/api/local/debug", localDebugRoutes);
|
|
@@ -4,6 +4,7 @@ import { z } from "zod";
|
|
|
4
4
|
import { accountOverview, accountToken, linkedAccount } from "../auth/account.js";
|
|
5
5
|
import { authoringGuide } from "../authoring/guide.js";
|
|
6
6
|
import { listConnectors } from "../connectors/external.js";
|
|
7
|
+
import { guideSpaceConnections } from "../connectors/space-connections.js";
|
|
7
8
|
import { db, schema } from "../db/client.js";
|
|
8
9
|
import { env } from "../env.js";
|
|
9
10
|
import { detectHarnesses } from "../harness/index.js";
|
|
@@ -68,7 +69,7 @@ export function knowsTools(ctx) {
|
|
|
68
69
|
inputSchema: z.object({ from: z.number().int().min(0).optional() }),
|
|
69
70
|
execute: ({ from }) => attempt(async () => {
|
|
70
71
|
ctx.doing(serverText(ctx.lang, "doingAuthoringGuide"));
|
|
71
|
-
const guide = authoringGuide(ctx.
|
|
72
|
+
const guide = authoringGuide(ctx.space ? await listConnectors(ctx.space.id) : [], await pluginToolsOf(user.tenantId), ctx.space ? await guideSpaceConnections(ctx.space.id) : []);
|
|
72
73
|
const start = Math.min(from ?? 0, guide.length);
|
|
73
74
|
return {
|
|
74
75
|
text: guide.slice(start, start + 14_000),
|
|
@@ -239,11 +240,11 @@ export function knowsTools(ctx) {
|
|
|
239
240
|
description: prompt("goose", "tool.wizards"),
|
|
240
241
|
inputSchema: z.object({}),
|
|
241
242
|
execute: () => attempt(async () => {
|
|
242
|
-
if (!ctx.
|
|
243
|
+
if (!ctx.space) {
|
|
243
244
|
return { note: "No space is open." };
|
|
244
245
|
}
|
|
245
246
|
return {
|
|
246
|
-
wizards: (await listWizards(user.id, ctx.
|
|
247
|
+
wizards: (await listWizards(user.id, ctx.space.id)).map((w) => ({
|
|
247
248
|
id: w.id,
|
|
248
249
|
title: w.title,
|
|
249
250
|
description: w.description,
|
|
@@ -264,7 +265,7 @@ export function knowsTools(ctx) {
|
|
|
264
265
|
limit: z.number().int().min(1).max(40).optional(),
|
|
265
266
|
}),
|
|
266
267
|
execute: ({ status, limit }) => attempt(async () => {
|
|
267
|
-
if (!ctx.
|
|
268
|
+
if (!ctx.space) {
|
|
268
269
|
return { note: "No space is open." };
|
|
269
270
|
}
|
|
270
271
|
const rows = await db
|
|
@@ -280,7 +281,7 @@ export function knowsTools(ctx) {
|
|
|
280
281
|
})
|
|
281
282
|
.from(schema.run)
|
|
282
283
|
.innerJoin(schema.wizard, eq(schema.wizard.id, schema.run.wizardId))
|
|
283
|
-
.where(and(eq(schema.wizard.
|
|
284
|
+
.where(and(eq(schema.wizard.spaceId, ctx.space.id), status ? eq(schema.run.status, status) : undefined))
|
|
284
285
|
.orderBy(desc(schema.run.createdAt))
|
|
285
286
|
.limit(limit ?? 15);
|
|
286
287
|
return {
|
|
@@ -14,6 +14,20 @@ function connectorsLine(connectors) {
|
|
|
14
14
|
});
|
|
15
15
|
return prompt("authoring", "line.connectors", { connectors: lines.join("\n") });
|
|
16
16
|
}
|
|
17
|
+
function spaceConnectionsLine(connections) {
|
|
18
|
+
if (!connections.length) {
|
|
19
|
+
return "";
|
|
20
|
+
}
|
|
21
|
+
const lines = connections.map((c) => {
|
|
22
|
+
const actions = c.actions
|
|
23
|
+
.slice(0, 40)
|
|
24
|
+
.map((a) => `${a.id}${a.group === "read" ? "" : ` (${a.group})`}`)
|
|
25
|
+
.join(", ");
|
|
26
|
+
const who = c.signIn === "space" ? "signs in as the space" : "each person signs in";
|
|
27
|
+
return `- ${c.id} — ${c.name} (${c.connector}), ${who}, actions: ${actions || prompt("authoring", "line.connectors.no_actions")}`;
|
|
28
|
+
});
|
|
29
|
+
return prompt("authoring", "line.space_connections", { connections: lines.join("\n") });
|
|
30
|
+
}
|
|
17
31
|
/** The tools this app's plugins add; nothing where there are none. */
|
|
18
32
|
function pluginToolsLine(tools) {
|
|
19
33
|
if (!tools.length) {
|
|
@@ -22,21 +36,27 @@ function pluginToolsLine(tools) {
|
|
|
22
36
|
const lines = tools.map((t) => `- ${t.id} — ${t.description}`);
|
|
23
37
|
return prompt("authoring", "line.plugin_tools", { tools: lines.join("\n") });
|
|
24
38
|
}
|
|
25
|
-
/** What the
|
|
26
|
-
export function
|
|
27
|
-
return [
|
|
39
|
+
/** What the space offers agent steps: its connectors, its connections and plugin tools. */
|
|
40
|
+
export function spaceLines(connectors, pluginTools, connections = []) {
|
|
41
|
+
return [
|
|
42
|
+
connectorsLine(connectors),
|
|
43
|
+
spaceConnectionsLine(connections),
|
|
44
|
+
pluginToolsLine(pluginTools),
|
|
45
|
+
]
|
|
46
|
+
.filter(Boolean)
|
|
47
|
+
.join("\n\n");
|
|
28
48
|
}
|
|
29
49
|
export function exampleWizard() {
|
|
30
50
|
return JSON.stringify(EXAMPLE_WIZARD, null, 2);
|
|
31
51
|
}
|
|
32
52
|
/** The guide an MCP client reads before it writes a wizard. */
|
|
33
|
-
export function authoringGuide(connectors = [], pluginTools = []) {
|
|
53
|
+
export function authoringGuide(connectors = [], pluginTools = [], connections = []) {
|
|
34
54
|
return prompt("authoring", "guide", {
|
|
35
55
|
schema: prompt("authoring", "schema"),
|
|
36
56
|
principles: prompt("authoring", "principles", { sandbox: sandboxGuideLine() }),
|
|
37
57
|
widgets: prompt("authoring", "widgets"),
|
|
38
58
|
surfaces: prompt("authoring", "surfaces"),
|
|
39
|
-
|
|
59
|
+
space_tools: spaceLines(connectors, pluginTools, connections),
|
|
40
60
|
schema_url: WIZARD_SCHEMA_URL,
|
|
41
61
|
example: exampleWizard(),
|
|
42
62
|
});
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { and, eq } from "drizzle-orm";
|
|
2
|
+
import { connectorFetch, resolveEnv } from "../connectors/builtin.js";
|
|
3
|
+
import { candidates, connectorFor, open, slot, } from "../connectors/index.js";
|
|
4
|
+
import { refreshThroughAccount } from "../connectors/via-account.js";
|
|
5
|
+
import { db, schema } from "../db/client.js";
|
|
6
|
+
import { refreshAccessToken } from "../engenty/connections-sdk/oauth2.js";
|
|
7
|
+
import { seal, unseal } from "../secrets/crypto.js";
|
|
8
|
+
import { getSecret, putSecret } from "../store/index.js";
|
|
9
|
+
import { currentTenant } from "../tenants/tenant.js";
|
|
10
|
+
/**
|
|
11
|
+
* The account a wizard's connection (or a share target's) holds for this store: the person who
|
|
12
|
+
* runs the wizard connected it. `null` when nothing is connected.
|
|
13
|
+
*/
|
|
14
|
+
export async function wizardAccount(scope, connection, spaceId) {
|
|
15
|
+
const stored = await getSecret(scope, slot(connection.id));
|
|
16
|
+
if (!stored) {
|
|
17
|
+
const only = connection.connector ? (await candidates(connection, spaceId))[0] : undefined;
|
|
18
|
+
return only && open(only)
|
|
19
|
+
? { connector: only, label: only.name, ctx: actionContext(scope, connection, only, "{}", []) }
|
|
20
|
+
: null;
|
|
21
|
+
}
|
|
22
|
+
const connector = await connectorFor(connection, stored.provider, spaceId);
|
|
23
|
+
let data = stored.data;
|
|
24
|
+
const fresh = await refreshed(connector, data);
|
|
25
|
+
if (fresh) {
|
|
26
|
+
data = fresh;
|
|
27
|
+
await putSecret(scope, slot(connection.id), connector.id, stored.label, data);
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
connector,
|
|
31
|
+
label: stored.label,
|
|
32
|
+
ctx: actionContext(scope, connection, connector, data.accessToken, data.scopes, stored),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function actionContext(scope, connection, connector, accessToken, scopes, stored) {
|
|
36
|
+
return {
|
|
37
|
+
accessToken,
|
|
38
|
+
fetchImpl: connectorFetch,
|
|
39
|
+
log: () => undefined,
|
|
40
|
+
connection: {
|
|
41
|
+
id: connection.id,
|
|
42
|
+
connector_id: connector.id,
|
|
43
|
+
auth_kind: connector.auth.kind,
|
|
44
|
+
autonomous_mode: "read_only",
|
|
45
|
+
connected_by: null,
|
|
46
|
+
created_at: (stored?.createdAt ?? new Date()).toISOString(),
|
|
47
|
+
display_name: stored?.label ?? connector.name,
|
|
48
|
+
error_message: null,
|
|
49
|
+
external_account: stored?.label ?? null,
|
|
50
|
+
granted_scopes: scopes,
|
|
51
|
+
owner_user_id: null,
|
|
52
|
+
space_id: null,
|
|
53
|
+
status: "active",
|
|
54
|
+
tenant_id: scope.wizardId,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** Fresh tokens where the ones kept run out within five minutes; the same ones else. */
|
|
59
|
+
async function refreshed(connector, data) {
|
|
60
|
+
const expires = data.expiresAt ? Date.parse(data.expiresAt) : null;
|
|
61
|
+
if (connector.auth.kind !== "oauth2" ||
|
|
62
|
+
!data.refreshToken ||
|
|
63
|
+
expires === null ||
|
|
64
|
+
expires - Date.now() >= 5 * 60_000) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
const tokens = data.via === "account"
|
|
68
|
+
? await refreshThroughAccount(data.refreshToken)
|
|
69
|
+
: await refreshAccessToken({
|
|
70
|
+
config: connector.auth.oauth2,
|
|
71
|
+
refreshToken: data.refreshToken,
|
|
72
|
+
resolveEnv,
|
|
73
|
+
});
|
|
74
|
+
return {
|
|
75
|
+
...(data.via ? { via: data.via } : {}),
|
|
76
|
+
accessToken: tokens.accessToken,
|
|
77
|
+
refreshToken: tokens.refreshToken ?? data.refreshToken,
|
|
78
|
+
expiresAt: tokens.expiresAt?.toISOString() ?? null,
|
|
79
|
+
scopes: tokens.grantedScopes.length ? tokens.grantedScopes : data.scopes,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/** Whose sign-in a `person` connection opens for: a person, an admin, or Goose for its person. */
|
|
83
|
+
const signsInThemselves = (who) => (who.kind === "person" || who.kind === "admin" || who.kind === "goose") && Boolean(who.id);
|
|
84
|
+
/**
|
|
85
|
+
* The account a connection of the space holds for this caller: the space's own sign-in, or the
|
|
86
|
+
* caller's where each person signs in. `null` when nobody has signed in yet. Tokens that run out
|
|
87
|
+
* within five minutes are refreshed and written back.
|
|
88
|
+
*/
|
|
89
|
+
export async function spaceAccount(row, connector, who) {
|
|
90
|
+
let sealed;
|
|
91
|
+
let label;
|
|
92
|
+
let signedInAt;
|
|
93
|
+
let write;
|
|
94
|
+
if (row.signIn === "space") {
|
|
95
|
+
sealed = row.secret;
|
|
96
|
+
label = row.label ?? connector.name;
|
|
97
|
+
signedInAt = row.setUpAt;
|
|
98
|
+
write = (secret) => db
|
|
99
|
+
.update(schema.spaceConnection)
|
|
100
|
+
.set({ secret, updatedAt: new Date() })
|
|
101
|
+
.where(eq(schema.spaceConnection.id, row.id));
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
if (!signsInThemselves(who)) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
const own = await db.query.spaceConnectionSignIn.findFirst({
|
|
108
|
+
where: and(eq(schema.spaceConnectionSignIn.connectionId, row.id), eq(schema.spaceConnectionSignIn.userId, who.id)),
|
|
109
|
+
});
|
|
110
|
+
if (!own) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
sealed = own.secret;
|
|
114
|
+
label = own.label;
|
|
115
|
+
signedInAt = own.signedInAt;
|
|
116
|
+
write = (secret) => db
|
|
117
|
+
.update(schema.spaceConnectionSignIn)
|
|
118
|
+
.set({ secret, updatedAt: new Date() })
|
|
119
|
+
.where(and(eq(schema.spaceConnectionSignIn.connectionId, row.id), eq(schema.spaceConnectionSignIn.userId, own.userId)));
|
|
120
|
+
}
|
|
121
|
+
if (!sealed) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
let data = unseal(sealed);
|
|
125
|
+
if (!data) {
|
|
126
|
+
throw new Error("The connection's keys cannot be read here. Sign in again.");
|
|
127
|
+
}
|
|
128
|
+
const fresh = await refreshed(connector, data);
|
|
129
|
+
if (fresh) {
|
|
130
|
+
data = fresh;
|
|
131
|
+
await write(seal(data));
|
|
132
|
+
}
|
|
133
|
+
const ctx = {
|
|
134
|
+
accessToken: data.accessToken,
|
|
135
|
+
fetchImpl: connectorFetch,
|
|
136
|
+
log: () => undefined,
|
|
137
|
+
connection: {
|
|
138
|
+
id: row.id,
|
|
139
|
+
connector_id: connector.id,
|
|
140
|
+
auth_kind: connector.auth.kind,
|
|
141
|
+
autonomous_mode: "read_only",
|
|
142
|
+
connected_by: row.setUpBy,
|
|
143
|
+
created_at: signedInAt.toISOString(),
|
|
144
|
+
display_name: row.name,
|
|
145
|
+
error_message: null,
|
|
146
|
+
external_account: label,
|
|
147
|
+
granted_scopes: data.scopes,
|
|
148
|
+
owner_user_id: null,
|
|
149
|
+
space_id: row.spaceId,
|
|
150
|
+
status: "active",
|
|
151
|
+
tenant_id: currentTenant(),
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
return { connector, ctx, label };
|
|
155
|
+
}
|
|
156
|
+
/** „Letzte Nutzung“: the connection was just used. */
|
|
157
|
+
export async function markUsed(row) {
|
|
158
|
+
await db
|
|
159
|
+
.update(schema.spaceConnection)
|
|
160
|
+
.set({ lastUsedAt: new Date() })
|
|
161
|
+
.where(eq(schema.spaceConnection.id, row.id));
|
|
162
|
+
}
|
|
163
|
+
/** A secret of a store that is no connection: the browser's kept sign-ins. */
|
|
164
|
+
export function keptSecret(scope, slot) {
|
|
165
|
+
return getSecret(scope, slot);
|
|
166
|
+
}
|