@engenty/wizards-runtime 0.0.0-stage → 0.7.5
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/LICENSE +110 -0
- package/README.md +214 -2
- package/apps/runtime/dist/agents/architect.js +444 -0
- package/apps/runtime/dist/agents/studio-assistant.js +883 -0
- package/apps/runtime/dist/agents/subscription.js +207 -0
- package/apps/runtime/dist/agents/thought.js +21 -0
- package/apps/runtime/dist/agents/website.js +480 -0
- package/apps/runtime/dist/app.js +359 -0
- package/apps/runtime/dist/apple/wizards-apple +0 -0
- package/apps/runtime/dist/assistant/browser.js +26 -0
- package/apps/runtime/dist/assistant/docs.js +158 -0
- package/apps/runtime/dist/assistant/knows.js +353 -0
- package/apps/runtime/dist/assistant/primer.js +26 -0
- package/apps/runtime/dist/assistant/runs.js +24 -0
- package/apps/runtime/dist/auth/account.js +175 -0
- package/apps/runtime/dist/auth/device.js +112 -0
- package/apps/runtime/dist/auth/index.js +358 -0
- package/apps/runtime/dist/auth/keys.js +55 -0
- package/apps/runtime/dist/auth/local-ticket.js +26 -0
- package/apps/runtime/dist/authoring/example.js +74 -0
- package/apps/runtime/dist/authoring/guide.js +433 -0
- package/apps/runtime/dist/authoring/ops.js +117 -0
- package/apps/runtime/dist/browser/fast/action-space.js +160 -0
- package/apps/runtime/dist/browser/fast/classifier.js +91 -0
- package/apps/runtime/dist/browser/fast/decide.js +171 -0
- package/apps/runtime/dist/browser/fast/driver.js +141 -0
- package/apps/runtime/dist/browser/fast/instructions.js +33 -0
- package/apps/runtime/dist/browser/fast/run.js +249 -0
- package/apps/runtime/dist/browser/fast/span-picker.js +153 -0
- package/apps/runtime/dist/browser/fast/text-helper.js +178 -0
- package/apps/runtime/dist/browser/snapshot.js +335 -0
- package/apps/runtime/dist/cli/account.js +385 -0
- package/apps/runtime/dist/cli/autostart.js +182 -0
- package/apps/runtime/dist/cli/autoupdate.js +221 -0
- package/apps/runtime/dist/cli/clients.js +44 -0
- package/apps/runtime/dist/cli/connect.js +540 -0
- package/apps/runtime/dist/cli/environment.js +93 -0
- package/apps/runtime/dist/cli/exec.js +45 -0
- package/apps/runtime/dist/cli/features.js +50 -0
- package/apps/runtime/dist/cli/home.js +88 -0
- package/apps/runtime/dist/cli/install-env.js +33 -0
- package/apps/runtime/dist/cli/machine.js +107 -0
- package/apps/runtime/dist/cli/main.js +222 -0
- package/apps/runtime/dist/cli/mcp.js +136 -0
- package/apps/runtime/dist/cli/menu.js +202 -0
- package/apps/runtime/dist/cli/processes.js +72 -0
- package/apps/runtime/dist/cli/report.js +66 -0
- package/apps/runtime/dist/cli/setup.js +335 -0
- package/apps/runtime/dist/cli/start.js +276 -0
- package/apps/runtime/dist/cli/status.js +203 -0
- package/apps/runtime/dist/cli/ui.js +59 -0
- package/apps/runtime/dist/cli/uninstall-main.js +20 -0
- package/apps/runtime/dist/cli/uninstall.js +231 -0
- package/apps/runtime/dist/cli/update.js +86 -0
- package/apps/runtime/dist/cli/validate.js +75 -0
- package/apps/runtime/dist/cli/versions.js +123 -0
- package/apps/runtime/dist/connectors/builtin.js +86 -0
- package/apps/runtime/dist/connectors/external.js +409 -0
- package/apps/runtime/dist/connectors/gmail.js +107 -0
- package/apps/runtime/dist/connectors/imap.js +261 -0
- package/apps/runtime/dist/connectors/index.js +325 -0
- package/apps/runtime/dist/connectors/mail.js +72 -0
- package/apps/runtime/dist/connectors/outlook.js +90 -0
- package/apps/runtime/dist/connectors/plugin-connections.js +343 -0
- package/apps/runtime/dist/connectors/via-account.js +65 -0
- package/apps/runtime/dist/credits/credits.js +100 -0
- package/apps/runtime/dist/credits/estimate.js +152 -0
- package/apps/runtime/dist/db/adopt.js +149 -0
- package/apps/runtime/dist/db/client.js +173 -0
- package/apps/runtime/dist/db/control-schema.js +133 -0
- package/apps/runtime/dist/db/migrations/control/0000_last_absorbing_man.sql +47 -0
- package/apps/runtime/dist/db/migrations/control/0001_gorgeous_nicolaos.sql +41 -0
- package/apps/runtime/dist/db/migrations/control/0002_secret_penance.sql +1 -0
- package/apps/runtime/dist/db/migrations/control/0003_nasty_mordo.sql +3 -0
- package/apps/runtime/dist/db/migrations/control/0004_breezy_eddie_brock.sql +6 -0
- package/apps/runtime/dist/db/migrations/control/0005_chilly_oracle.sql +1 -0
- package/apps/runtime/dist/db/migrations/control/0006_sleepy_mojo.sql +1 -0
- package/apps/runtime/dist/db/migrations/control/0007_common_the_hand.sql +15 -0
- package/apps/runtime/dist/db/migrations/control/0008_runner.sql +8 -0
- package/apps/runtime/dist/db/migrations/control/0009_plugin_claim.sql +9 -0
- package/apps/runtime/dist/db/migrations/control/0010_tan_snowbird.sql +6 -0
- package/apps/runtime/dist/db/migrations/control/meta/0000_snapshot.json +311 -0
- package/apps/runtime/dist/db/migrations/control/meta/0001_snapshot.json +599 -0
- package/apps/runtime/dist/db/migrations/control/meta/0002_snapshot.json +607 -0
- package/apps/runtime/dist/db/migrations/control/meta/0003_snapshot.json +311 -0
- package/apps/runtime/dist/db/migrations/control/meta/0004_snapshot.json +350 -0
- package/apps/runtime/dist/db/migrations/control/meta/0005_snapshot.json +358 -0
- package/apps/runtime/dist/db/migrations/control/meta/0006_snapshot.json +365 -0
- package/apps/runtime/dist/db/migrations/control/meta/0007_snapshot.json +460 -0
- package/apps/runtime/dist/db/migrations/control/meta/0008_snapshot.json +505 -0
- package/apps/runtime/dist/db/migrations/control/meta/0009_snapshot.json +561 -0
- package/apps/runtime/dist/db/migrations/control/meta/0010_snapshot.json +600 -0
- package/apps/runtime/dist/db/migrations/control/meta/_journal.json +83 -0
- package/apps/runtime/dist/db/migrations/tenant/0000_eminent_freak.sql +188 -0
- package/apps/runtime/dist/db/migrations/tenant/0001_salty_master_chief.sql +1 -0
- package/apps/runtime/dist/db/migrations/tenant/0002_cloudy_firebird.sql +1 -0
- package/apps/runtime/dist/db/migrations/tenant/0003_brown_warbound.sql +52 -0
- package/apps/runtime/dist/db/migrations/tenant/0004_romantic_nocturne.sql +6 -0
- package/apps/runtime/dist/db/migrations/tenant/0005_reflective_forgotten_one.sql +2 -0
- package/apps/runtime/dist/db/migrations/tenant/0006_hard_war_machine.sql +30 -0
- package/apps/runtime/dist/db/migrations/tenant/0007_space_data.sql +43 -0
- package/apps/runtime/dist/db/migrations/tenant/0008_run_event_note.sql +1 -0
- package/apps/runtime/dist/db/migrations/tenant/0009_knowledge.sql +104 -0
- package/apps/runtime/dist/db/migrations/tenant/0010_plugin_connection.sql +15 -0
- package/apps/runtime/dist/db/migrations/tenant/0011_runners.sql +2 -0
- package/apps/runtime/dist/db/migrations/tenant/0012_assistant_chat.sql +40 -0
- package/apps/runtime/dist/db/migrations/tenant/0013_run_origin.sql +1 -0
- package/apps/runtime/dist/db/migrations/tenant/0014_run_answer.sql +2 -0
- package/apps/runtime/dist/db/migrations/tenant/0015_device_calls.sql +13 -0
- package/apps/runtime/dist/db/migrations/tenant/0016_even_trish_tilby.sql +12 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0000_snapshot.json +1323 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0001_snapshot.json +1330 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0002_snapshot.json +1337 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0003_snapshot.json +1605 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0004_snapshot.json +1645 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0005_snapshot.json +1659 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0006_snapshot.json +1696 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0007_snapshot.json +2012 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0008_snapshot.json +2019 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0009_snapshot.json +2837 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0010_snapshot.json +2942 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0011_snapshot.json +2956 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0012_snapshot.json +3132 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0013_snapshot.json +3139 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0014_snapshot.json +3154 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0015_snapshot.json +3243 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0016_snapshot.json +3326 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +125 -0
- package/apps/runtime/dist/db/schema.js +602 -0
- package/apps/runtime/dist/debug.js +196 -0
- package/apps/runtime/dist/docs/dev/index.md +41 -0
- package/apps/runtime/dist/docs/dev/meta.json +7 -0
- package/apps/runtime/dist/docs/dev/plugins/connections.md +74 -0
- package/apps/runtime/dist/docs/dev/plugins/events.md +89 -0
- package/apps/runtime/dist/docs/dev/plugins/examples.md +101 -0
- package/apps/runtime/dist/docs/dev/plugins/index.md +78 -0
- package/apps/runtime/dist/docs/dev/plugins/layout.md +90 -0
- package/apps/runtime/dist/docs/dev/plugins/meta.json +28 -0
- package/apps/runtime/dist/docs/dev/plugins/quick-start.md +94 -0
- package/apps/runtime/dist/docs/dev/plugins/reference.md +348 -0
- package/apps/runtime/dist/docs/dev/plugins/reloading.md +76 -0
- package/apps/runtime/dist/docs/dev/plugins/routes.md +185 -0
- package/apps/runtime/dist/docs/dev/plugins/runners.md +230 -0
- package/apps/runtime/dist/docs/dev/plugins/server.md +281 -0
- package/apps/runtime/dist/docs/dev/plugins/shipping.md +79 -0
- package/apps/runtime/dist/docs/dev/plugins/space.md +297 -0
- package/apps/runtime/dist/docs/dev/plugins/starters.md +70 -0
- package/apps/runtime/dist/docs/dev/plugins/studio.md +363 -0
- package/apps/runtime/dist/docs/dev/plugins/styling.md +129 -0
- package/apps/runtime/dist/docs/dev/plugins/tables.md +104 -0
- package/apps/runtime/dist/docs/dev/plugins/tools.md +139 -0
- package/apps/runtime/dist/docs/dev/wizard-format.md +125 -0
- package/apps/runtime/dist/docs/meta.json +3 -0
- package/apps/runtime/dist/docs/user/ai-apps.md +112 -0
- package/apps/runtime/dist/docs/user/assistant.md +77 -0
- package/apps/runtime/dist/docs/user/build-a-wizard.md +116 -0
- package/apps/runtime/dist/docs/user/command-line.md +83 -0
- package/apps/runtime/dist/docs/user/connectors.md +90 -0
- package/apps/runtime/dist/docs/user/create-account.md +52 -0
- package/apps/runtime/dist/docs/user/data.md +66 -0
- package/apps/runtime/dist/docs/user/first-start.md +60 -0
- package/apps/runtime/dist/docs/user/index.md +49 -0
- package/apps/runtime/dist/docs/user/install.md +123 -0
- package/apps/runtime/dist/docs/user/local-only.md +42 -0
- package/apps/runtime/dist/docs/user/meta.json +32 -0
- package/apps/runtime/dist/docs/user/models.md +156 -0
- package/apps/runtime/dist/docs/user/plugins.md +71 -0
- package/apps/runtime/dist/docs/user/run.md +98 -0
- package/apps/runtime/dist/docs/user/server.md +52 -0
- package/apps/runtime/dist/docs/user/space.md +126 -0
- package/apps/runtime/dist/docs/user/steps.md +220 -0
- package/apps/runtime/dist/docs/user/test-and-share.md +224 -0
- package/apps/runtime/dist/docs/user/troubleshooting.md +67 -0
- package/apps/runtime/dist/docs/user/wordpress.md +121 -0
- package/apps/runtime/dist/documents/parse.js +246 -0
- package/apps/runtime/dist/engenty/connections-external/build-connector.js +193 -0
- package/apps/runtime/dist/engenty/connections-external/errors.js +11 -0
- package/apps/runtime/dist/engenty/connections-external/import-service.js +270 -0
- package/apps/runtime/dist/engenty/connections-external/importer/classify.js +34 -0
- package/apps/runtime/dist/engenty/connections-external/importer/map-auth.js +185 -0
- package/apps/runtime/dist/engenty/connections-external/importer/normalize-mcp.js +63 -0
- package/apps/runtime/dist/engenty/connections-external/importer/normalize-openapi.js +130 -0
- package/apps/runtime/dist/engenty/connections-external/invoke/http-invoker.js +143 -0
- package/apps/runtime/dist/engenty/connections-external/invoke/mcp-client.js +143 -0
- package/apps/runtime/dist/engenty/connections-external/net/guarded-fetch.js +119 -0
- package/apps/runtime/dist/engenty/connections-external/oauth-dcr.js +88 -0
- package/apps/runtime/dist/engenty/connections-external/registry-client.js +336 -0
- package/apps/runtime/dist/engenty/connections-external/registry-source.js +82 -0
- package/apps/runtime/dist/engenty/connections-external/types.js +7 -0
- package/apps/runtime/dist/engenty/connections-github/connector.js +209 -0
- package/apps/runtime/dist/engenty/connections-google/connectors/calendar.js +381 -0
- package/apps/runtime/dist/engenty/connections-google/connectors/contacts.js +94 -0
- package/apps/runtime/dist/engenty/connections-google/connectors/drive.js +290 -0
- package/apps/runtime/dist/engenty/connections-google/connectors/gmail.js +567 -0
- package/apps/runtime/dist/engenty/connections-google/definitions.js +11 -0
- package/apps/runtime/dist/engenty/connections-google/shared.js +73 -0
- package/apps/runtime/dist/engenty/connections-hubspot/connector.js +140 -0
- package/apps/runtime/dist/engenty/connections-microsoft/action.js +17 -0
- package/apps/runtime/dist/engenty/connections-microsoft/graph.js +114 -0
- package/apps/runtime/dist/engenty/connections-microsoft/onedrive.js +286 -0
- package/apps/runtime/dist/engenty/connections-microsoft/outlook.js +492 -0
- package/apps/runtime/dist/engenty/connections-s3/s3.js +328 -0
- package/apps/runtime/dist/engenty/connections-sdk/files-capability.js +86 -0
- package/apps/runtime/dist/engenty/connections-sdk/oauth2.js +150 -0
- package/apps/runtime/dist/engenty/connections-sdk/registry.js +89 -0
- package/apps/runtime/dist/engenty/connections-sdk/storage-capability.js +84 -0
- package/apps/runtime/dist/engenty/connections-sdk/types.js +30 -0
- package/apps/runtime/dist/engenty/connections-slack/connector.js +360 -0
- package/apps/runtime/dist/engenty/csv-import/csv-matrix.js +178 -0
- package/apps/runtime/dist/engenty/csv-import/import-sources.js +87 -0
- package/apps/runtime/dist/engenty/csv-import/parse-csv.js +129 -0
- package/apps/runtime/dist/engenty/csv-import/serialize-csv.js +20 -0
- package/apps/runtime/dist/engenty/csv-import/types.js +1 -0
- package/apps/runtime/dist/engenty/csv-import/xlsx-workbook.js +159 -0
- package/apps/runtime/dist/engenty/doc-converter/interface.js +9 -0
- package/apps/runtime/dist/engenty/doc-converter/page-break.js +92 -0
- package/apps/runtime/dist/engenty/doc-converter/providers/local/index.js +72 -0
- package/apps/runtime/dist/engenty/document-scanner/schemas/classifier.js +30 -0
- package/apps/runtime/dist/engenty/document-scanner/schemas/index.js +4 -0
- package/apps/runtime/dist/engenty/document-scanner/schemas/invoice.js +73 -0
- package/apps/runtime/dist/engenty/document-scanner/schemas/receipt.js +63 -0
- package/apps/runtime/dist/engenty/document-scanner/schemas/shared.js +40 -0
- package/apps/runtime/dist/engenty/search-index/chunks.js +164 -0
- package/apps/runtime/dist/engenty/search-index/contracts.js +9 -0
- package/apps/runtime/dist/engenty/shims/connections-sdk.js +39 -0
- package/apps/runtime/dist/engenty/shims/plugin-sdk.js +1 -0
- package/apps/runtime/dist/engenty/shims/web-ingest.js +19 -0
- package/apps/runtime/dist/engenty/web-ingest/ssrf.js +277 -0
- package/apps/runtime/dist/engine/asks.js +82 -0
- package/apps/runtime/dist/engine/decide.js +82 -0
- package/apps/runtime/dist/engine/device.js +194 -0
- package/apps/runtime/dist/engine/events.js +128 -0
- package/apps/runtime/dist/engine/input.js +208 -0
- package/apps/runtime/dist/engine/owner.js +32 -0
- package/apps/runtime/dist/engine/prepare.js +90 -0
- package/apps/runtime/dist/engine/push.js +58 -0
- package/apps/runtime/dist/engine/requirements.js +355 -0
- package/apps/runtime/dist/engine/resources.js +198 -0
- package/apps/runtime/dist/engine/runner.js +970 -0
- package/apps/runtime/dist/engine/steps.js +1000 -0
- package/apps/runtime/dist/engine/surface.js +91 -0
- package/apps/runtime/dist/engine/template.js +240 -0
- package/apps/runtime/dist/engine/types.js +4 -0
- package/apps/runtime/dist/env.js +295 -0
- package/apps/runtime/dist/features.js +123 -0
- package/apps/runtime/dist/files/blobs.js +22 -0
- package/apps/runtime/dist/files/objects.js +86 -0
- package/apps/runtime/dist/files/storage.js +120 -0
- package/apps/runtime/dist/files/web-images.js +101 -0
- package/apps/runtime/dist/film/project.js +257 -0
- package/apps/runtime/dist/film/skills.js +91 -0
- package/apps/runtime/dist/film/sounds.js +122 -0
- package/apps/runtime/dist/film/step.js +289 -0
- package/apps/runtime/dist/film/tools.js +99 -0
- package/apps/runtime/dist/geocode.js +58 -0
- package/apps/runtime/dist/harness/antigravity.js +129 -0
- package/apps/runtime/dist/harness/apple.js +270 -0
- package/apps/runtime/dist/harness/claude.js +147 -0
- package/apps/runtime/dist/harness/codex.js +229 -0
- package/apps/runtime/dist/harness/cursor.js +93 -0
- package/apps/runtime/dist/harness/env.js +124 -0
- package/apps/runtime/dist/harness/index.js +95 -0
- package/apps/runtime/dist/harness/model.js +279 -0
- package/apps/runtime/dist/harness/prompt.js +121 -0
- package/apps/runtime/dist/harness/terminal.js +194 -0
- package/apps/runtime/dist/harness/types.js +7 -0
- package/apps/runtime/dist/index.js +113 -0
- package/apps/runtime/dist/limits.js +81 -0
- package/apps/runtime/dist/link-preview.js +60 -0
- package/apps/runtime/dist/log.js +106 -0
- package/apps/runtime/dist/manage.js +249 -0
- package/apps/runtime/dist/mcp/auth.js +161 -0
- package/apps/runtime/dist/mcp/bridge.js +59 -0
- package/apps/runtime/dist/mcp/flow-app.js +97 -0
- package/apps/runtime/dist/mcp/handler.js +54 -0
- package/apps/runtime/dist/mcp/scopes.js +14 -0
- package/apps/runtime/dist/mcp/seen.js +65 -0
- package/apps/runtime/dist/mcp/tools.js +572 -0
- package/apps/runtime/dist/media/conversation.js +167 -0
- package/apps/runtime/dist/media/ffmpeg.js +121 -0
- package/apps/runtime/dist/media/generate.js +120 -0
- package/apps/runtime/dist/media/marking.js +121 -0
- package/apps/runtime/dist/media/transcribe.js +198 -0
- package/apps/runtime/dist/model-errors.js +42 -0
- package/apps/runtime/dist/models.js +1164 -0
- package/apps/runtime/dist/plugin.js +61 -0
- package/apps/runtime/dist/plugins/channels.js +78 -0
- package/apps/runtime/dist/plugins/claims.js +56 -0
- package/apps/runtime/dist/plugins/discovery.js +155 -0
- package/apps/runtime/dist/plugins/events.js +63 -0
- package/apps/runtime/dist/plugins/jobs.js +64 -0
- package/apps/runtime/dist/plugins/loader.js +508 -0
- package/apps/runtime/dist/plugins/migrations.js +69 -0
- package/apps/runtime/dist/plugins/pro-keys.js +34 -0
- package/apps/runtime/dist/plugins/pro-state.js +83 -0
- package/apps/runtime/dist/plugins/pro.js +310 -0
- package/apps/runtime/dist/plugins/public.js +44 -0
- package/apps/runtime/dist/plugins/registry.js +122 -0
- package/apps/runtime/dist/plugins/runs.js +210 -0
- package/apps/runtime/dist/render/browser-path.js +54 -0
- package/apps/runtime/dist/render/chromium.js +98 -0
- package/apps/runtime/dist/render/convert.js +158 -0
- package/apps/runtime/dist/render/downloads.js +299 -0
- package/apps/runtime/dist/render/guard.js +25 -0
- package/apps/runtime/dist/render/shaped.js +137 -0
- package/apps/runtime/dist/routes/api.js +440 -0
- package/apps/runtime/dist/routes/debug.js +42 -0
- package/apps/runtime/dist/routes/delivery.js +90 -0
- package/apps/runtime/dist/routes/internal.js +81 -0
- package/apps/runtime/dist/routes/lang.js +25 -0
- package/apps/runtime/dist/routes/marketplace.js +43 -0
- package/apps/runtime/dist/routes/plugin-public.js +113 -0
- package/apps/runtime/dist/routes/plugins.js +212 -0
- package/apps/runtime/dist/routes/runs.js +1422 -0
- package/apps/runtime/dist/routes/studio.js +1629 -0
- package/apps/runtime/dist/routes/wizard-stream.js +30 -0
- package/apps/runtime/dist/running.js +39 -0
- package/apps/runtime/dist/sandbox/docker.js +75 -0
- package/apps/runtime/dist/sandbox/index.js +23 -0
- package/apps/runtime/dist/sandbox/types.js +1 -0
- package/apps/runtime/dist/secrets/crypto.js +28 -0
- package/apps/runtime/dist/secrets/signing.js +52 -0
- package/apps/runtime/dist/secrets/vault.js +59 -0
- package/apps/runtime/dist/services/access.js +88 -0
- package/apps/runtime/dist/services/api.js +248 -0
- package/apps/runtime/dist/services/architect.js +95 -0
- package/apps/runtime/dist/services/assistant-chats.js +311 -0
- package/apps/runtime/dist/services/brand.js +85 -0
- package/apps/runtime/dist/services/cloud.js +456 -0
- package/apps/runtime/dist/services/draft-events.js +27 -0
- package/apps/runtime/dist/services/engenty-shapes.js +71 -0
- package/apps/runtime/dist/services/errors.js +29 -0
- package/apps/runtime/dist/services/files.js +178 -0
- package/apps/runtime/dist/services/knowledge-model.js +559 -0
- package/apps/runtime/dist/services/knowledge.js +721 -0
- package/apps/runtime/dist/services/links.js +16 -0
- package/apps/runtime/dist/services/marketplace.js +492 -0
- package/apps/runtime/dist/services/onboarding.js +152 -0
- package/apps/runtime/dist/services/package-file.js +82 -0
- package/apps/runtime/dist/services/package.js +170 -0
- package/apps/runtime/dist/services/profile.js +51 -0
- package/apps/runtime/dist/services/project-files.js +439 -0
- package/apps/runtime/dist/services/project-index.js +707 -0
- package/apps/runtime/dist/services/projects.js +387 -0
- package/apps/runtime/dist/services/relevance.js +58 -0
- package/apps/runtime/dist/services/runners.js +178 -0
- package/apps/runtime/dist/services/runs.js +524 -0
- package/apps/runtime/dist/services/shares.js +130 -0
- package/apps/runtime/dist/services/site.js +270 -0
- package/apps/runtime/dist/services/space-categories.js +861 -0
- package/apps/runtime/dist/services/space-data.js +792 -0
- package/apps/runtime/dist/services/space-origin.js +207 -0
- package/apps/runtime/dist/services/spaces.js +656 -0
- package/apps/runtime/dist/services/translations.js +306 -0
- package/apps/runtime/dist/services/widgets.js +34 -0
- package/apps/runtime/dist/services/wizard-icon.js +157 -0
- package/apps/runtime/dist/services/wizards.js +420 -0
- package/apps/runtime/dist/settings.js +16 -0
- package/apps/runtime/dist/store/errors.js +4 -0
- package/apps/runtime/dist/store/index.js +299 -0
- package/apps/runtime/dist/store/shared-lists.js +123 -0
- package/apps/runtime/dist/tenants/control.js +238 -0
- package/apps/runtime/dist/tenants/tenant.js +26 -0
- package/apps/runtime/dist/texts.js +207 -0
- package/apps/runtime/dist/tools/browser.js +703 -0
- package/apps/runtime/dist/tools/connector.js +204 -0
- package/apps/runtime/dist/tools/index.js +291 -0
- package/apps/runtime/dist/tools/mail.js +104 -0
- package/apps/runtime/dist/tools/net-guard.js +170 -0
- package/apps/runtime/dist/tools/pages.js +81 -0
- package/apps/runtime/dist/tools/plugin.js +180 -0
- package/apps/runtime/dist/tools/project.js +154 -0
- package/apps/runtime/dist/tools/shared.js +69 -0
- package/apps/runtime/dist/tools/store.js +238 -0
- package/apps/runtime/dist/update.js +113 -0
- package/apps/runtime/dist/widgets/bundle.js +99 -0
- package/apps/runtime/dist/widgets/render.js +329 -0
- package/apps/runtime/dist/widgets/runtime.js +108 -0
- package/apps/runtime/dist/widgets/script.js +30 -0
- package/apps/runtime/dist/widgets/step.js +223 -0
- package/apps/web/dist/ai-labels/ai-black.svg +20 -0
- package/apps/web/dist/ai-labels/ai-generated-black.svg +31 -0
- package/apps/web/dist/ai-labels/ai-generated-white.svg +32 -0
- package/apps/web/dist/ai-labels/ai-modified-black.svg +30 -0
- package/apps/web/dist/ai-labels/ai-modified-white.svg +31 -0
- package/apps/web/dist/ai-labels/ai-white.svg +21 -0
- package/apps/web/dist/assets/AboutDialog-D4mvc-zu.js +1 -0
- package/apps/web/dist/assets/ChangelogDialog-DLqpJsF6.js +1 -0
- package/apps/web/dist/assets/ChatView-3laypRcE.js +10 -0
- package/apps/web/dist/assets/EditorPage-BalA5U2Y.js +3 -0
- package/apps/web/dist/assets/FlowPreview-CusP7ci9.js +1 -0
- package/apps/web/dist/assets/Harness-BrP-ENHg.css +1 -0
- package/apps/web/dist/assets/Harness-iYLtOLaK.js +16 -0
- package/apps/web/dist/assets/NewWizardChannels-CbwJ9A56.js +1 -0
- package/apps/web/dist/assets/NewWizardPage-BOBYiB9i.js +7 -0
- package/apps/web/dist/assets/OnboardingPage-CUwCiVIr.js +1 -0
- package/apps/web/dist/assets/ProjectPage-Bb16MdYG.js +1 -0
- package/apps/web/dist/assets/PublicRunner-BCt7Q6C-.js +1 -0
- package/apps/web/dist/assets/ReadOnly-kIHX2TEy.js +1 -0
- package/apps/web/dist/assets/RunDrawer-hZ9oeSXu.js +4 -0
- package/apps/web/dist/assets/RunnerView-DUS9fPmx.js +1 -0
- package/apps/web/dist/assets/SettingsPage-BzwR50fi.js +1 -0
- package/apps/web/dist/assets/SetupPage-gAp7rPxp.js +1 -0
- package/apps/web/dist/assets/SharePage-DqZWHva_.js +1 -0
- package/apps/web/dist/assets/changelog-DugmCNSf.js +1 -0
- package/apps/web/dist/assets/engenty-eXZ-EAwd.js +1 -0
- package/apps/web/dist/assets/esm-DXeMu8Lb.js +7 -0
- package/apps/web/dist/assets/fluffy-engenty-ClRou7yu.js +456 -0
- package/apps/web/dist/assets/index-AfUa8xKD.css +1 -0
- package/apps/web/dist/assets/index-C5Sm7tTR.js +14 -0
- package/apps/web/dist/assets/jsx-runtime-BNakU3Ej.js +1 -0
- package/apps/web/dist/assets/lock-R_CfU0Xo.js +1 -0
- package/apps/web/dist/assets/oss-credits-cZ9NUaLZ.js +1 -0
- package/apps/web/dist/assets/pdfmake-Cx9scTbD.js +228 -0
- package/apps/web/dist/assets/phone-CgrIS4_-.js +1 -0
- package/apps/web/dist/assets/preload-helper-CNEI7N0N.js +1 -0
- package/apps/web/dist/assets/qr-scanner-worker.min-CJaXo3yu.js +98 -0
- package/apps/web/dist/assets/qr-scanner.min-C_UI0gH-.js +1 -0
- package/apps/web/dist/assets/rolldown-runtime-hePW80VL.js +1 -0
- package/apps/web/dist/assets/settings-menu-2IMOOlLl.js +1 -0
- package/apps/web/dist/assets/ui-dzGvc3xk.js +137 -0
- package/apps/web/dist/assets/upload-BSuTilFF.js +1 -0
- package/apps/web/dist/assets/vfs_fonts-DllDSYt1.js +1 -0
- package/apps/web/dist/embed.js +266 -0
- package/apps/web/dist/favicon.svg +1 -0
- package/apps/web/dist/icons/apple-touch-icon.png +0 -0
- package/apps/web/dist/icons/icon-192.png +0 -0
- package/apps/web/dist/icons/icon-512.png +0 -0
- package/apps/web/dist/icons/icon-maskable-512.png +0 -0
- package/apps/web/dist/index.html +48 -0
- package/apps/web/dist/install.sh +577 -0
- package/apps/web/dist/manifest.webmanifest +21 -0
- package/apps/web/dist/mcp/flow.html +980 -0
- package/apps/web/dist/sw.js +15 -0
- package/bin/wizards.mjs +288 -0
- package/modules/README.md +15 -0
- package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +1150 -0
- package/node_modules/@engenty/wizards/dist/plugin/index.js +4 -0
- package/node_modules/@engenty/wizards/dist/plugin/studio.d.ts +322 -0
- package/node_modules/@engenty/wizards/dist/plugin/studio.js +4 -0
- package/node_modules/@engenty/wizards/dist/plugin/thread.d.ts +174 -0
- package/node_modules/@engenty/wizards/dist/plugin/thread.js +821 -0
- package/node_modules/@engenty/wizards/package.json +11 -0
- package/node_modules/@engenty-wizards/shared/dist/assistant.d.ts +174 -0
- package/node_modules/@engenty-wizards/shared/dist/assistant.js +65 -0
- package/node_modules/@engenty-wizards/shared/dist/changes.d.ts +22 -0
- package/node_modules/@engenty-wizards/shared/dist/changes.js +61 -0
- package/node_modules/@engenty-wizards/shared/dist/connectors.d.ts +77 -0
- package/node_modules/@engenty-wizards/shared/dist/connectors.js +2 -0
- package/node_modules/@engenty-wizards/shared/dist/decision.d.ts +76 -0
- package/node_modules/@engenty-wizards/shared/dist/decision.js +147 -0
- package/node_modules/@engenty-wizards/shared/dist/definition.d.ts +2922 -0
- package/node_modules/@engenty-wizards/shared/dist/definition.js +1920 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns-format.d.ts +5 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns-format.js +132 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns-value.d.ts +11 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns-value.js +209 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns.d.ts +532 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns.js +217 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/index.d.ts +3 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/index.js +3 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/search-index/catalog-lexical.d.ts +14 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/search-index/catalog-lexical.js +166 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/search-index/catalog-rank.d.ts +33 -0
- package/node_modules/@engenty-wizards/shared/dist/engenty/search-index/catalog-rank.js +99 -0
- package/node_modules/@engenty-wizards/shared/dist/feature-flags.d.ts +78 -0
- package/node_modules/@engenty-wizards/shared/dist/feature-flags.js +70 -0
- package/node_modules/@engenty-wizards/shared/dist/features.d.ts +41 -0
- package/node_modules/@engenty-wizards/shared/dist/features.js +89 -0
- package/node_modules/@engenty-wizards/shared/dist/fit.d.ts +71 -0
- package/node_modules/@engenty-wizards/shared/dist/fit.js +382 -0
- package/node_modules/@engenty-wizards/shared/dist/json-schema.d.ts +14 -0
- package/node_modules/@engenty-wizards/shared/dist/json-schema.js +66 -0
- package/node_modules/@engenty-wizards/shared/dist/knowledge.d.ts +199 -0
- package/node_modules/@engenty-wizards/shared/dist/knowledge.js +68 -0
- package/node_modules/@engenty-wizards/shared/dist/marketplace-entry.d.ts +35 -0
- package/node_modules/@engenty-wizards/shared/dist/marketplace-entry.js +107 -0
- package/node_modules/@engenty-wizards/shared/dist/marketplace-search.d.ts +20 -0
- package/node_modules/@engenty-wizards/shared/dist/marketplace-search.js +136 -0
- package/node_modules/@engenty-wizards/shared/dist/marketplace.d.ts +227 -0
- package/node_modules/@engenty-wizards/shared/dist/marketplace.js +354 -0
- package/node_modules/@engenty-wizards/shared/dist/merge.d.ts +7 -0
- package/node_modules/@engenty-wizards/shared/dist/merge.js +40 -0
- package/node_modules/@engenty-wizards/shared/dist/numbers.d.ts +24 -0
- package/node_modules/@engenty-wizards/shared/dist/numbers.js +54 -0
- package/node_modules/@engenty-wizards/shared/dist/projects.d.ts +224 -0
- package/node_modules/@engenty-wizards/shared/dist/projects.js +319 -0
- package/node_modules/@engenty-wizards/shared/dist/providers.d.ts +101 -0
- package/node_modules/@engenty-wizards/shared/dist/providers.js +390 -0
- package/node_modules/@engenty-wizards/shared/dist/run.d.ts +680 -0
- package/node_modules/@engenty-wizards/shared/dist/run.js +620 -0
- package/node_modules/@engenty-wizards/shared/dist/runner-texts.d.ts +546 -0
- package/node_modules/@engenty-wizards/shared/dist/runner-texts.js +523 -0
- package/node_modules/@engenty-wizards/shared/dist/runners.d.ts +93 -0
- package/node_modules/@engenty-wizards/shared/dist/runners.js +146 -0
- package/node_modules/@engenty-wizards/shared/dist/shape.d.ts +102 -0
- package/node_modules/@engenty-wizards/shared/dist/shape.js +318 -0
- package/node_modules/@engenty-wizards/shared/dist/space-data.d.ts +89 -0
- package/node_modules/@engenty-wizards/shared/dist/space-data.js +47 -0
- package/node_modules/@engenty-wizards/shared/dist/store.d.ts +117 -0
- package/node_modules/@engenty-wizards/shared/dist/store.js +81 -0
- package/node_modules/@engenty-wizards/shared/dist/surface.d.ts +115 -0
- package/node_modules/@engenty-wizards/shared/dist/surface.js +442 -0
- package/node_modules/@engenty-wizards/shared/dist/texts.d.ts +45 -0
- package/node_modules/@engenty-wizards/shared/dist/texts.js +54 -0
- package/node_modules/@engenty-wizards/shared/dist/translation.d.ts +23 -0
- package/node_modules/@engenty-wizards/shared/dist/translation.js +154 -0
- package/node_modules/@engenty-wizards/shared/dist/wizard-package.d.ts +48 -0
- package/node_modules/@engenty-wizards/shared/dist/wizard-package.js +49 -0
- package/node_modules/@engenty-wizards/shared/dist/workspace.d.ts +16 -0
- package/node_modules/@engenty-wizards/shared/dist/workspace.js +51 -0
- package/node_modules/@engenty-wizards/shared/package.json +10 -0
- package/package.json +77 -4
- package/plugin/.claude-plugin/plugin.json +9 -0
- package/plugin/.mcp.json +8 -0
- package/plugin/commands/wizard.md +8 -0
- package/plugin/skills/build-wizard/SKILL.md +27 -0
- package/plugin/skills/use-wizard/SKILL.md +18 -0
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import { note } from "@engenty-wizards/shared/run";
|
|
2
|
+
import { and, asc, eq } from "drizzle-orm";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { db, schema } from "../db/client.js";
|
|
5
|
+
import { buildImportedConnector, mcpHeaders, } from "../engenty/connections-external/build-connector.js";
|
|
6
|
+
import { ImportValidationError } from "../engenty/connections-external/errors.js";
|
|
7
|
+
import { assembleRecord, connectorIdFromSlug, prepareSource, resolveRequiredHeaders, surfaceRequiresAuth, toolPrefixFromSlug, } from "../engenty/connections-external/import-service.js";
|
|
8
|
+
import { createGuardedFetch } from "../engenty/connections-external/net/guarded-fetch.js";
|
|
9
|
+
import { discoverImportableSources, discoverOAuthFacts, registryDiscover, registrySearch, resolveMcpTransport, } from "../engenty/connections-external/registry-client.js";
|
|
10
|
+
import { resolveRegistrySource } from "../engenty/connections-external/registry-source.js";
|
|
11
|
+
import { encryptToken } from "../engenty/shims/connections-sdk.js";
|
|
12
|
+
import { env } from "../env.js";
|
|
13
|
+
import { requireAdmin, requireWritableProject } from "../services/access.js";
|
|
14
|
+
import { ServiceError } from "../services/errors.js";
|
|
15
|
+
import { BUILTIN_CONNECTORS, builtinConnector, missingSetup, usable } from "./builtin.js";
|
|
16
|
+
/**
|
|
17
|
+
* Imported connectors: any service becomes a connector from its OpenAPI spec or MCP server,
|
|
18
|
+
* found through the integrations registry or pasted as a URL. Searching, normalising, auth
|
|
19
|
+
* mapping and invoking are engenty's (`apps/runtime/src/engenty/connections-external`); kept here is what
|
|
20
|
+
* engenty leaves to its host — where the records live and who may import.
|
|
21
|
+
*/
|
|
22
|
+
// engenty's dynamic client registration reads the redirect from this variable.
|
|
23
|
+
process.env.CONNECTIONS_REDIRECT_URI ??=
|
|
24
|
+
env.connectRedirectUrl || `${env.appUrl}/api/connect/callback`;
|
|
25
|
+
const where = (projectId, id) => and(eq(schema.projectConnector.projectId, projectId), eq(schema.projectConnector.id, id));
|
|
26
|
+
async function load(projectId, id) {
|
|
27
|
+
const row = await db.query.projectConnector.findFirst({ where: where(projectId, id) });
|
|
28
|
+
return row?.record ?? null;
|
|
29
|
+
}
|
|
30
|
+
async function save(projectId, record) {
|
|
31
|
+
await db
|
|
32
|
+
.insert(schema.projectConnector)
|
|
33
|
+
.values({ projectId, id: record.id, record })
|
|
34
|
+
.onConflictDoUpdate({
|
|
35
|
+
target: [schema.projectConnector.projectId, schema.projectConnector.id],
|
|
36
|
+
set: { record, updatedAt: new Date() },
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const actionView = (a) => ({
|
|
40
|
+
id: a.id,
|
|
41
|
+
summary: (a.summary || a.description).slice(0, 160),
|
|
42
|
+
group: a.classification,
|
|
43
|
+
});
|
|
44
|
+
function view(record) {
|
|
45
|
+
const auth = record.auth_config;
|
|
46
|
+
const needsOAuthClient = auth.kind === "oauth2" && !record.client_id_enc && !(auth.dcr && auth.registration_endpoint);
|
|
47
|
+
return {
|
|
48
|
+
usable: !needsOAuthClient,
|
|
49
|
+
missingSetup: null,
|
|
50
|
+
id: record.id,
|
|
51
|
+
name: record.name,
|
|
52
|
+
domain: record.domain,
|
|
53
|
+
sourceKind: record.source_kind,
|
|
54
|
+
sourceUrl: record.source_url,
|
|
55
|
+
toolPrefix: record.tool_prefix,
|
|
56
|
+
auth: auth.kind,
|
|
57
|
+
needsOAuthClient,
|
|
58
|
+
toolsPending: record.source_kind === "mcp" && record.actions.length === 0,
|
|
59
|
+
actions: record.actions.map(actionView),
|
|
60
|
+
importedAt: record.imported_at,
|
|
61
|
+
refreshedAt: record.refreshed_at,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** What the admin can fix is told as it is; anything else is the registry or the source failing. */
|
|
65
|
+
function importFailure(err) {
|
|
66
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
67
|
+
return new ServiceError(err instanceof ImportValidationError ? "invalid" : "refused", message);
|
|
68
|
+
}
|
|
69
|
+
/** What the studio, the architect and MCP clients send to import a connector. */
|
|
70
|
+
export const connectorImportSchema = z.object({
|
|
71
|
+
domain: z.string().min(1).max(253),
|
|
72
|
+
sourceKind: z.enum(["openapi", "mcp"]),
|
|
73
|
+
sourceUrl: z.string().url(),
|
|
74
|
+
id: z.string().min(2).max(60),
|
|
75
|
+
toolPrefix: z.string().min(2).max(31),
|
|
76
|
+
name: z.string().min(1).max(120).optional(),
|
|
77
|
+
actions: z.array(z.string()).max(500).optional(),
|
|
78
|
+
oauthClientId: z.string().max(500).optional(),
|
|
79
|
+
oauthClientSecret: z.string().max(500).optional(),
|
|
80
|
+
});
|
|
81
|
+
// --- the registry ----------------------------------------------------------------
|
|
82
|
+
export async function searchRegistry(query) {
|
|
83
|
+
const results = await registrySearch({ query, limit: 12 });
|
|
84
|
+
return results.map((r) => ({
|
|
85
|
+
domain: r.domain,
|
|
86
|
+
name: r.name,
|
|
87
|
+
description: r.description,
|
|
88
|
+
kinds: r.kinds.filter((k) => k === "openapi" || k === "mcp"),
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
export async function registryService(domain) {
|
|
92
|
+
const { parsed } = await registryDiscover(domain).catch((err) => {
|
|
93
|
+
throw importFailure(err);
|
|
94
|
+
});
|
|
95
|
+
return {
|
|
96
|
+
domain: parsed.domain,
|
|
97
|
+
summary: parsed.summary ?? parsed.description ?? null,
|
|
98
|
+
sources: discoverImportableSources(parsed).map((s) => ({
|
|
99
|
+
sourceKind: s.source_kind,
|
|
100
|
+
sourceUrl: s.source_url,
|
|
101
|
+
name: s.surface.name,
|
|
102
|
+
blocked: s.blocked_reason,
|
|
103
|
+
auth: s.surface.auth.status,
|
|
104
|
+
suggestedId: connectorIdFromSlug(s.surface.slug),
|
|
105
|
+
suggestedToolPrefix: toolPrefixFromSlug(s.surface.slug),
|
|
106
|
+
})),
|
|
107
|
+
credentials: Object.values(parsed.credentials).map((c) => ({
|
|
108
|
+
label: c.label ?? c.type,
|
|
109
|
+
setup: c.setup ?? null,
|
|
110
|
+
url: c.generateUrl ?? null,
|
|
111
|
+
})),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* OAuth facts straight from an MCP server. The registry says "OAuth, see the server's well-known
|
|
116
|
+
* document" for most MCP servers but probes only the service's main domain, so its own document
|
|
117
|
+
* carries no endpoints for them. The server publishes them itself (RFC 9728, RFC 8414).
|
|
118
|
+
*/
|
|
119
|
+
async function probeOAuth(sourceUrl) {
|
|
120
|
+
const guarded = createGuardedFetch();
|
|
121
|
+
const json = async (url) => {
|
|
122
|
+
const res = await guarded(url, {
|
|
123
|
+
headers: { accept: "application/json" },
|
|
124
|
+
signal: AbortSignal.timeout(10_000),
|
|
125
|
+
}).catch(() => null);
|
|
126
|
+
return res?.ok
|
|
127
|
+
? (await res.json().catch(() => null))
|
|
128
|
+
: null;
|
|
129
|
+
};
|
|
130
|
+
const origin = new URL(sourceUrl).origin;
|
|
131
|
+
const resource = await json(`${origin}/.well-known/oauth-protected-resource`);
|
|
132
|
+
const issuer = resource?.authorization_servers?.[0] ?? origin;
|
|
133
|
+
const server = (await json(`${issuer.replace(/\/+$/, "")}/.well-known/oauth-authorization-server`)) ??
|
|
134
|
+
(await json(`${origin}/.well-known/oauth-authorization-server`));
|
|
135
|
+
const text = (v) => (typeof v === "string" && v ? v : undefined);
|
|
136
|
+
const list = (v) => (Array.isArray(v) ? v.filter((x) => typeof x === "string") : []);
|
|
137
|
+
const authorizationEndpoint = text(server?.authorization_endpoint);
|
|
138
|
+
const tokenEndpoint = text(server?.token_endpoint);
|
|
139
|
+
if (!(authorizationEndpoint && tokenEndpoint)) {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
const registrationEndpoint = text(server?.registration_endpoint);
|
|
143
|
+
const scopes = list(server?.scopes_supported);
|
|
144
|
+
return {
|
|
145
|
+
authorizationEndpoint,
|
|
146
|
+
tokenEndpoint,
|
|
147
|
+
grantTypes: list(server?.grant_types_supported),
|
|
148
|
+
// A long list is a catalogue, not what one client should ask for.
|
|
149
|
+
scopes: scopes.length <= 8 ? scopes : [],
|
|
150
|
+
...(registrationEndpoint ? { registrationEndpoint, dcr: true } : {}),
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
/** Fetch and normalise a source with the facts the registry holds about it. */
|
|
154
|
+
async function prepare(input) {
|
|
155
|
+
const resolved = input.domain
|
|
156
|
+
? await resolveRegistrySource({ domain: input.domain, sourceUrl: input.sourceUrl })
|
|
157
|
+
: { discover: null, surface: null };
|
|
158
|
+
const { surface } = resolved;
|
|
159
|
+
if (input.sourceKind === "mcp" &&
|
|
160
|
+
resolved.discover &&
|
|
161
|
+
surfaceRequiresAuth(surface) &&
|
|
162
|
+
!discoverOAuthFacts(resolved.discover.parsed)) {
|
|
163
|
+
const oauth = await probeOAuth(input.sourceUrl);
|
|
164
|
+
if (oauth) {
|
|
165
|
+
const parsed = resolved.discover.parsed;
|
|
166
|
+
resolved.discover.parsed = {
|
|
167
|
+
...parsed,
|
|
168
|
+
detect: { ...parsed.detect, auth: { ...parsed.detect?.auth, oauth } },
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
const blockers = [];
|
|
173
|
+
if (surface) {
|
|
174
|
+
try {
|
|
175
|
+
resolveRequiredHeaders(surface);
|
|
176
|
+
}
|
|
177
|
+
catch (err) {
|
|
178
|
+
blockers.push(err.message);
|
|
179
|
+
}
|
|
180
|
+
if (surface.variables.length) {
|
|
181
|
+
blockers.push(`this source needs ${surface.variables.map((v) => v.name).join(", ")} in its address — paste the resolved URL instead`);
|
|
182
|
+
}
|
|
183
|
+
if (input.sourceKind === "mcp" && !resolveMcpTransport(surface)) {
|
|
184
|
+
blockers.push(`unsupported MCP transport (${surface.transports.join(", ")})`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
const prepared = await prepareSource({
|
|
188
|
+
deferMcpTools: input.sourceKind === "mcp" && surfaceRequiresAuth(surface),
|
|
189
|
+
requiredHeaders: !blockers.length && surface ? resolveRequiredHeaders(surface) : [],
|
|
190
|
+
sourceKind: input.sourceKind,
|
|
191
|
+
sourceUrl: input.sourceUrl,
|
|
192
|
+
specOverrides: surface?.spec_overrides ?? [],
|
|
193
|
+
transport: surface ? resolveMcpTransport(surface) : null,
|
|
194
|
+
});
|
|
195
|
+
return { ...resolved, prepared, blockers };
|
|
196
|
+
}
|
|
197
|
+
export async function previewSource(input) {
|
|
198
|
+
const { prepared, blockers } = await prepare(input).catch((err) => {
|
|
199
|
+
throw importFailure(err);
|
|
200
|
+
});
|
|
201
|
+
return {
|
|
202
|
+
title: prepared.normalized.title,
|
|
203
|
+
actions: prepared.normalized.actions.map(actionView),
|
|
204
|
+
blockers,
|
|
205
|
+
dropped: prepared.normalized.dropped_count,
|
|
206
|
+
toolsPending: prepared.deferred_mcp_tools === true,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
// --- a project's connectors --------------------------------------------------------
|
|
210
|
+
async function builtinView(connector) {
|
|
211
|
+
const ready = await usable(connector);
|
|
212
|
+
return {
|
|
213
|
+
id: connector.id,
|
|
214
|
+
name: connector.name,
|
|
215
|
+
domain: "",
|
|
216
|
+
sourceKind: "builtin",
|
|
217
|
+
sourceUrl: "",
|
|
218
|
+
toolPrefix: connector.toolPrefix,
|
|
219
|
+
auth: connector.auth.kind === "oauth2" ? "oauth2" : "api_key",
|
|
220
|
+
usable: ready,
|
|
221
|
+
missingSetup: ready ? null : missingSetup(connector),
|
|
222
|
+
needsOAuthClient: false,
|
|
223
|
+
toolsPending: false,
|
|
224
|
+
actions: connector.actions.map((a) => ({
|
|
225
|
+
id: a.id,
|
|
226
|
+
summary: a.summary.slice(0, 160),
|
|
227
|
+
group: a.group,
|
|
228
|
+
})),
|
|
229
|
+
importedAt: "",
|
|
230
|
+
refreshedAt: null,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
/** Every connector a wizard of the project can name: the built-in ones, then its imports. */
|
|
234
|
+
export async function listConnectors(projectId) {
|
|
235
|
+
const rows = await db.query.projectConnector.findMany({
|
|
236
|
+
where: eq(schema.projectConnector.projectId, projectId),
|
|
237
|
+
orderBy: [asc(schema.projectConnector.createdAt)],
|
|
238
|
+
});
|
|
239
|
+
return [
|
|
240
|
+
...(await Promise.all(BUILTIN_CONNECTORS.map(builtinView))),
|
|
241
|
+
...rows.map((r) => view(r.record)),
|
|
242
|
+
];
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* A connector by id, ready to run, with the JSON schema of each action's input: a built-in one,
|
|
246
|
+
* or one the project imported.
|
|
247
|
+
*/
|
|
248
|
+
export async function resolveConnector(projectId, id) {
|
|
249
|
+
const builtin = builtinConnector(id);
|
|
250
|
+
if (builtin) {
|
|
251
|
+
return {
|
|
252
|
+
connector: builtin,
|
|
253
|
+
imported: false,
|
|
254
|
+
inputSchema: (actionId) => {
|
|
255
|
+
const action = builtin.actions.find((a) => a.id === actionId);
|
|
256
|
+
try {
|
|
257
|
+
return action ? z.toJSONSchema(action.inputSchema) : {};
|
|
258
|
+
}
|
|
259
|
+
catch {
|
|
260
|
+
return {};
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
const found = await importedConnector(projectId, id);
|
|
266
|
+
return found
|
|
267
|
+
? {
|
|
268
|
+
connector: found.connector,
|
|
269
|
+
imported: true,
|
|
270
|
+
inputSchema: (actionId) => found.record.actions.find((a) => a.id === actionId)?.input_json_schema ?? {},
|
|
271
|
+
}
|
|
272
|
+
: null;
|
|
273
|
+
}
|
|
274
|
+
export async function importConnector(userId, projectId, input) {
|
|
275
|
+
await requireWritableProject(projectId);
|
|
276
|
+
await requireAdmin();
|
|
277
|
+
if (await load(projectId, input.id)) {
|
|
278
|
+
throw new ServiceError("invalid", note("connectorAlreadyExistsSpace", { id: input.id }));
|
|
279
|
+
}
|
|
280
|
+
try {
|
|
281
|
+
const { discover, surface, prepared } = await prepare(input);
|
|
282
|
+
const { record, warnings } = assembleRecord({
|
|
283
|
+
actionFilter: input.actions ?? null,
|
|
284
|
+
discover: discover?.parsed ?? null,
|
|
285
|
+
domain: input.domain,
|
|
286
|
+
id: input.id,
|
|
287
|
+
importedBy: userId,
|
|
288
|
+
name: input.name ?? null,
|
|
289
|
+
oauthClient: input.oauthClientId && input.oauthClientSecret
|
|
290
|
+
? { clientId: input.oauthClientId, clientSecret: input.oauthClientSecret }
|
|
291
|
+
: null,
|
|
292
|
+
prepared,
|
|
293
|
+
// The registry's own document is not kept: the record holds what was made of it.
|
|
294
|
+
rawDiscover: null,
|
|
295
|
+
sourceKind: input.sourceKind,
|
|
296
|
+
sourceUrl: input.sourceUrl,
|
|
297
|
+
surface,
|
|
298
|
+
tenantId: projectId,
|
|
299
|
+
toolPrefix: input.toolPrefix,
|
|
300
|
+
});
|
|
301
|
+
const { skippedActions } = buildImportedConnector(record);
|
|
302
|
+
if (skippedActions.length) {
|
|
303
|
+
warnings.push(`${skippedActions.length} action(s) have an input the tools cannot express`);
|
|
304
|
+
}
|
|
305
|
+
await save(projectId, record);
|
|
306
|
+
return { connector: view(record), warnings };
|
|
307
|
+
}
|
|
308
|
+
catch (err) {
|
|
309
|
+
throw err instanceof ServiceError ? err : importFailure(err);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Imports a registry service by its domain, for callers that do not pick a source by hand (the
|
|
314
|
+
* architect, MCP clients): the first importable source of the wanted kind, MCP before OpenAPI —
|
|
315
|
+
* an MCP server is the service's own, curated set of actions.
|
|
316
|
+
*/
|
|
317
|
+
export async function importFromRegistry(userId, projectId, input) {
|
|
318
|
+
await requireWritableProject(projectId);
|
|
319
|
+
await requireAdmin();
|
|
320
|
+
const service = await registryService(input.domain);
|
|
321
|
+
const order = input.kind ? [input.kind] : ["mcp", "openapi"];
|
|
322
|
+
const source = order
|
|
323
|
+
.flatMap((kind) => service.sources.filter((s) => s.sourceKind === kind))
|
|
324
|
+
.find((s) => !s.blocked);
|
|
325
|
+
if (!source) {
|
|
326
|
+
const why = service.sources.map((s) => `${s.sourceKind}: ${s.blocked}`).join("; ");
|
|
327
|
+
throw new ServiceError("invalid", `${input.domain} has nothing that can be imported${why ? ` (${why})` : ""}.`);
|
|
328
|
+
}
|
|
329
|
+
const taken = (await listConnectors(projectId)).find((c) => c.id === source.suggestedId);
|
|
330
|
+
if (taken) {
|
|
331
|
+
return { connector: taken, warnings: ["already imported"] };
|
|
332
|
+
}
|
|
333
|
+
return importConnector(userId, projectId, {
|
|
334
|
+
domain: service.domain,
|
|
335
|
+
sourceKind: source.sourceKind,
|
|
336
|
+
sourceUrl: source.sourceUrl,
|
|
337
|
+
id: source.suggestedId,
|
|
338
|
+
toolPrefix: source.suggestedToolPrefix,
|
|
339
|
+
...(source.name ? { name: source.name } : {}),
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
export async function removeConnector(projectId, id) {
|
|
343
|
+
await requireWritableProject(projectId);
|
|
344
|
+
await requireAdmin();
|
|
345
|
+
await db.delete(schema.projectConnector).where(where(projectId, id));
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Re-reads the source and replaces the connector's actions. An MCP server that only lists its
|
|
349
|
+
* tools to a signed-in account needs that account's token.
|
|
350
|
+
*/
|
|
351
|
+
export async function refreshConnector(projectId, id, accessToken) {
|
|
352
|
+
await requireWritableProject(projectId);
|
|
353
|
+
const record = await load(projectId, id);
|
|
354
|
+
if (!record) {
|
|
355
|
+
throw new ServiceError("not_found", note("connectorNotExist"));
|
|
356
|
+
}
|
|
357
|
+
try {
|
|
358
|
+
const { surface } = record.registry_surface_slug
|
|
359
|
+
? await resolveRegistrySource({ domain: record.domain, sourceUrl: record.source_url })
|
|
360
|
+
: { surface: null };
|
|
361
|
+
const requiredHeaders = surface ? resolveRequiredHeaders(surface) : record.required_headers;
|
|
362
|
+
const transport = record.source_kind === "mcp"
|
|
363
|
+
? ((surface ? resolveMcpTransport(surface) : null) ??
|
|
364
|
+
record.mcp_transport ??
|
|
365
|
+
"streamable-http")
|
|
366
|
+
: null;
|
|
367
|
+
const prepared = await prepareSource({
|
|
368
|
+
deferOnUnauthorized: false,
|
|
369
|
+
mcpHeaders: accessToken ? mcpHeaders(record, accessToken) : undefined,
|
|
370
|
+
requiredHeaders,
|
|
371
|
+
sourceKind: record.source_kind,
|
|
372
|
+
sourceUrl: record.source_url,
|
|
373
|
+
specOverrides: surface?.spec_overrides ?? [],
|
|
374
|
+
transport,
|
|
375
|
+
});
|
|
376
|
+
const updated = {
|
|
377
|
+
...record,
|
|
378
|
+
actions: prepared.normalized.actions,
|
|
379
|
+
base_url: record.base_url ?? prepared.normalized.base_url,
|
|
380
|
+
mcp_transport: transport,
|
|
381
|
+
refreshed_at: new Date().toISOString(),
|
|
382
|
+
required_headers: requiredHeaders,
|
|
383
|
+
spec_hash: prepared.spec_hash,
|
|
384
|
+
};
|
|
385
|
+
await save(projectId, updated);
|
|
386
|
+
return view(updated);
|
|
387
|
+
}
|
|
388
|
+
catch (err) {
|
|
389
|
+
throw importFailure(err);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
/** The connector as engenty's framework runs it: actions with handlers, auth with its flows. */
|
|
393
|
+
export async function importedConnector(projectId, id) {
|
|
394
|
+
const record = await load(projectId, id);
|
|
395
|
+
if (!record) {
|
|
396
|
+
return null;
|
|
397
|
+
}
|
|
398
|
+
// The record is read at call time, so a client registered a moment ago is the one used.
|
|
399
|
+
let current = record;
|
|
400
|
+
const { connector } = buildImportedConnector(record, () => current, async (client) => {
|
|
401
|
+
current = {
|
|
402
|
+
...current,
|
|
403
|
+
client_id_enc: encryptToken(client.clientId),
|
|
404
|
+
client_secret_enc: client.clientSecret ? encryptToken(client.clientSecret) : null,
|
|
405
|
+
};
|
|
406
|
+
await save(projectId, current);
|
|
407
|
+
});
|
|
408
|
+
return { connector, record };
|
|
409
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { GOOGLE_OAUTH2, googleJson } from "../engenty/connections-google/shared.js";
|
|
2
|
+
import { htmlToMarkdown } from "../render/convert.js";
|
|
3
|
+
import { dayAfter, mailActions, snippetOf, } from "./mail.js";
|
|
4
|
+
const GMAIL_API = "https://gmail.googleapis.com/gmail/v1/users/me";
|
|
5
|
+
const SCOPE_READONLY = "https://www.googleapis.com/auth/gmail.readonly";
|
|
6
|
+
const header = (payload, name) => payload?.headers?.find((h) => h.name.toLowerCase() === name.toLowerCase())?.value ?? null;
|
|
7
|
+
function body(payload, mime) {
|
|
8
|
+
if (!payload) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
if (payload.mimeType === mime && payload.body?.data) {
|
|
12
|
+
return Buffer.from(payload.body.data, "base64url").toString("utf8");
|
|
13
|
+
}
|
|
14
|
+
for (const part of payload.parts ?? []) {
|
|
15
|
+
const found = body(part, mime);
|
|
16
|
+
if (found) {
|
|
17
|
+
return found;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
function attachments(payload, out = []) {
|
|
23
|
+
if (payload?.filename && payload.body?.attachmentId) {
|
|
24
|
+
out.push({
|
|
25
|
+
id: payload.body.attachmentId,
|
|
26
|
+
name: payload.filename,
|
|
27
|
+
mime: payload.mimeType ?? "application/octet-stream",
|
|
28
|
+
size: payload.body.size ?? null,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
for (const part of payload?.parts ?? []) {
|
|
32
|
+
attachments(part, out);
|
|
33
|
+
}
|
|
34
|
+
return out;
|
|
35
|
+
}
|
|
36
|
+
function toMessage(raw) {
|
|
37
|
+
const html = body(raw.payload, "text/html");
|
|
38
|
+
const text = body(raw.payload, "text/plain") ?? (html ? htmlToMarkdown(html) : (raw.snippet ?? ""));
|
|
39
|
+
return {
|
|
40
|
+
id: raw.id,
|
|
41
|
+
date: raw.internalDate ? new Date(Number(raw.internalDate)).toISOString() : null,
|
|
42
|
+
from: header(raw.payload, "From"),
|
|
43
|
+
to: (header(raw.payload, "To") ?? "")
|
|
44
|
+
.split(",")
|
|
45
|
+
.map((s) => s.trim())
|
|
46
|
+
.filter(Boolean),
|
|
47
|
+
subject: header(raw.payload, "Subject"),
|
|
48
|
+
snippet: raw.snippet ?? snippetOf(text),
|
|
49
|
+
attachments: attachments(raw.payload),
|
|
50
|
+
text,
|
|
51
|
+
html,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/** Gmail's own search syntax: `{a b}` is "a OR b", dates are `after:`/`before:` days. */
|
|
55
|
+
function query(input) {
|
|
56
|
+
const quoted = (input.terms ?? []).map((t) => (/\s/.test(t) ? `"${t.replace(/"/g, "")}"` : t));
|
|
57
|
+
return [
|
|
58
|
+
quoted.length ? `{${quoted.join(" ")}}` : "",
|
|
59
|
+
input.from ? `from:${input.from}` : "",
|
|
60
|
+
input.since ? `after:${input.since.replace(/-/g, "/")}` : "",
|
|
61
|
+
input.until ? `before:${dayAfter(input.until).replace(/-/g, "/")}` : "",
|
|
62
|
+
input.has_attachment ? "has:attachment" : "",
|
|
63
|
+
]
|
|
64
|
+
.filter(Boolean)
|
|
65
|
+
.join(" ");
|
|
66
|
+
}
|
|
67
|
+
const getMessage = (ctx, id) => googleJson(ctx, `${GMAIL_API}/messages/${encodeURIComponent(id)}?format=full`);
|
|
68
|
+
const backend = {
|
|
69
|
+
async search(input, ctx) {
|
|
70
|
+
const url = new URL(`${GMAIL_API}/messages`);
|
|
71
|
+
url.searchParams.set("q", query(input));
|
|
72
|
+
url.searchParams.set("maxResults", String(input.limit ?? 40));
|
|
73
|
+
const list = await googleJson(ctx, url.toString());
|
|
74
|
+
const out = [];
|
|
75
|
+
const ids = (list.messages ?? []).map((m) => m.id);
|
|
76
|
+
for (let i = 0; i < ids.length; i += 10) {
|
|
77
|
+
const batch = await Promise.all(ids.slice(i, i + 10).map((id) => getMessage(ctx, id)));
|
|
78
|
+
out.push(...batch.map(toMessage));
|
|
79
|
+
}
|
|
80
|
+
return out.map(({ text: _text, html: _html, to: _to, ...summary }) => summary);
|
|
81
|
+
},
|
|
82
|
+
async read(id, ctx) {
|
|
83
|
+
return toMessage(await getMessage(ctx, id));
|
|
84
|
+
},
|
|
85
|
+
async attachment(id, attachmentId, ctx) {
|
|
86
|
+
const info = attachments((await getMessage(ctx, id)).payload).find((a) => a.id === attachmentId);
|
|
87
|
+
const data = await googleJson(ctx, `${GMAIL_API}/messages/${encodeURIComponent(id)}/attachments/${encodeURIComponent(attachmentId)}`);
|
|
88
|
+
if (!data.data) {
|
|
89
|
+
throw new Error("gmail attachment has no data");
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
name: info?.name ?? "attachment",
|
|
93
|
+
mime: info?.mime ?? "application/octet-stream",
|
|
94
|
+
data_base64: Buffer.from(data.data, "base64url").toString("base64"),
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
export const gmailConnector = {
|
|
99
|
+
id: "mail-gmail",
|
|
100
|
+
moduleId: "wizards-mail",
|
|
101
|
+
name: "Gmail",
|
|
102
|
+
description: "Read mail in a Gmail or Google Workspace account.",
|
|
103
|
+
icon: "logo:gmail",
|
|
104
|
+
toolPrefix: "mail",
|
|
105
|
+
auth: { kind: "oauth2", oauth2: GOOGLE_OAUTH2 },
|
|
106
|
+
actions: mailActions(backend, [SCOPE_READONLY]),
|
|
107
|
+
};
|