@engenty/wizards-runtime 0.0.0-stage → 0.7.6
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 +95 -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 +231 -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/sandbox.js +77 -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 +212 -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 +197 -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 +86 -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 +279 -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/agentos-package.js +73 -0
- package/apps/runtime/dist/sandbox/agentos.js +162 -0
- package/apps/runtime/dist/sandbox/docker.js +45 -0
- package/apps/runtime/dist/sandbox/index.js +52 -0
- package/apps/runtime/dist/sandbox/install.js +122 -0
- package/apps/runtime/dist/sandbox/mastra.js +71 -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 +657 -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-DYgXPagX.js +1 -0
- package/apps/web/dist/assets/ChangelogDialog-BXqBW8j3.js +1 -0
- package/apps/web/dist/assets/ChatView-CK2--tsE.js +10 -0
- package/apps/web/dist/assets/EditorPage-jvcwyXbU.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-CV9uYzbv.js +16 -0
- package/apps/web/dist/assets/NewWizardChannels-BakW5q6s.js +1 -0
- package/apps/web/dist/assets/NewWizardPage-BoA-LJuW.js +7 -0
- package/apps/web/dist/assets/OnboardingPage-DaD1XnOe.js +1 -0
- package/apps/web/dist/assets/ProjectPage-BFgk1DEv.js +1 -0
- package/apps/web/dist/assets/PublicRunner-C9MwEvxy.js +1 -0
- package/apps/web/dist/assets/ReadOnly-DC2Kp7l8.js +1 -0
- package/apps/web/dist/assets/RunDrawer-CY6NZSrI.js +4 -0
- package/apps/web/dist/assets/RunnerView-BT26XgcY.js +1 -0
- package/apps/web/dist/assets/SettingsPage-AFt9IDLt.js +1 -0
- package/apps/web/dist/assets/SetupPage-DtFYAbwJ.js +1 -0
- package/apps/web/dist/assets/SharePage-t2xwNS61.js +1 -0
- package/apps/web/dist/assets/changelog-CATQFxCQ.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-Drw7FMTQ.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,93 @@
|
|
|
1
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { resolveEnv, run } from "./env.js";
|
|
4
|
+
import { failureOf, HarnessModel, lastJson, runClient, } from "./model.js";
|
|
5
|
+
/**
|
|
6
|
+
* Cursor Agent: `cursor-agent -p` answers on the Cursor sign-in. The call's folder is its
|
|
7
|
+
* workspace: the instructions as AGENTS.md, the tools as an MCP server in .cursor/mcp.json.
|
|
8
|
+
* The answer is asked for as JSON where a schema is wanted.
|
|
9
|
+
*/
|
|
10
|
+
export const CURSOR_BIN = process.env.CURSOR_AGENT_BIN?.trim() || "cursor-agent";
|
|
11
|
+
/** "auto" = the model the client picks itself; a binding `cursor/<model>` names one. */
|
|
12
|
+
const CLASSES = {
|
|
13
|
+
classifier: "auto",
|
|
14
|
+
standard: "auto",
|
|
15
|
+
high: "auto",
|
|
16
|
+
highest: "auto",
|
|
17
|
+
};
|
|
18
|
+
/** The escape sequences a terminal app draws with. */
|
|
19
|
+
const ANSI = new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*[A-Za-z]`, "g");
|
|
20
|
+
const spec = {
|
|
21
|
+
id: "cursor",
|
|
22
|
+
passThrough: /^CURSOR_API_KEY$/,
|
|
23
|
+
keyVars: ["CURSOR_API_KEY"],
|
|
24
|
+
async auth(env) {
|
|
25
|
+
try {
|
|
26
|
+
const { stdout, stderr } = await run(CURSOR_BIN, ["status"], { timeout: 15_000, env });
|
|
27
|
+
// The client draws on the terminal even here: the control sequences are taken out.
|
|
28
|
+
const text = `${stdout}\n${stderr}`.replace(ANSI, "");
|
|
29
|
+
if (/not logged in/i.test(text) || !/logged in/i.test(text)) {
|
|
30
|
+
return "none";
|
|
31
|
+
}
|
|
32
|
+
return env.CURSOR_API_KEY ? "api_key" : "subscription";
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return "none";
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
class CursorModel extends HarnessModel {
|
|
40
|
+
provider = "cursor-agent";
|
|
41
|
+
async invoke(call) {
|
|
42
|
+
if (call.system) {
|
|
43
|
+
writeFileSync(join(call.dir, "AGENTS.md"), call.system);
|
|
44
|
+
}
|
|
45
|
+
if (call.bridgeUrl) {
|
|
46
|
+
mkdirSync(join(call.dir, ".cursor"), { recursive: true });
|
|
47
|
+
writeFileSync(join(call.dir, ".cursor", "mcp.json"), JSON.stringify({ mcpServers: { step: { url: call.bridgeUrl } } }));
|
|
48
|
+
}
|
|
49
|
+
const args = ["-p", "--output-format", "json", "--workspace", call.dir, "--approve-mcps"];
|
|
50
|
+
if (this.modelId !== "auto") {
|
|
51
|
+
args.push("--model", this.modelId);
|
|
52
|
+
}
|
|
53
|
+
if (!call.bridgeUrl) {
|
|
54
|
+
// Nothing to work through: the client answers, it does not edit.
|
|
55
|
+
args.push("--mode", "ask");
|
|
56
|
+
}
|
|
57
|
+
const { stdout, stderr, code } = await runClient(CURSOR_BIN, args, {
|
|
58
|
+
cwd: call.dir,
|
|
59
|
+
env: (await resolveEnv(spec)).env,
|
|
60
|
+
signal: call.signal,
|
|
61
|
+
stdin: call.prompt,
|
|
62
|
+
});
|
|
63
|
+
const event = lastJson(stdout);
|
|
64
|
+
if (!event) {
|
|
65
|
+
throw failureOf(this.harness, stderr.trim() || `exit ${code}`);
|
|
66
|
+
}
|
|
67
|
+
if (event.is_error) {
|
|
68
|
+
throw failureOf(this.harness, String(event.result ?? "error"));
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
text: typeof event.result === "string" ? event.result : JSON.stringify(event.result ?? ""),
|
|
72
|
+
sessionId: event.session_id,
|
|
73
|
+
meta: { durationMs: event.duration_ms ?? 0 },
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export const cursor = {
|
|
78
|
+
...spec,
|
|
79
|
+
name: "Cursor Agent",
|
|
80
|
+
bin: CURSOR_BIN,
|
|
81
|
+
classes: CLASSES,
|
|
82
|
+
async version(env) {
|
|
83
|
+
try {
|
|
84
|
+
const { stdout } = await run(CURSOR_BIN, ["--version"], { timeout: 10_000, env });
|
|
85
|
+
return stdout.trim().split("\n").pop()?.trim() || null;
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
login: { args: ["login"], interactive: false },
|
|
92
|
+
model: (alias, effort) => new CursorModel(cursor, alias || "auto", effort),
|
|
93
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { execFile, spawn } from "node:child_process";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { promisify } from "node:util";
|
|
4
|
+
import { layout } from "../cli/home.js";
|
|
5
|
+
export const run = promisify(execFile);
|
|
6
|
+
let shellEnv = null;
|
|
7
|
+
/** The person's login shell, asked once: a desktop app and a bare dev server start without its variables. */
|
|
8
|
+
export function loginShellEnv() {
|
|
9
|
+
shellEnv ??= new Promise((done) => {
|
|
10
|
+
const shell = process.env.SHELL || "/bin/zsh";
|
|
11
|
+
// In a session of its own, away from the terminal `wizards` runs in: an interactive
|
|
12
|
+
// shell takes over that terminal for its job control and keeps it when it ends, and Ctrl-C
|
|
13
|
+
// then reaches nobody. (execFile cannot do this: it drops `detached`.)
|
|
14
|
+
const child = spawn(shell, ["-l", "-i", "-c", "env"], {
|
|
15
|
+
detached: true,
|
|
16
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
17
|
+
timeout: 10_000,
|
|
18
|
+
env: {
|
|
19
|
+
HOME: process.env.HOME,
|
|
20
|
+
USER: process.env.USER,
|
|
21
|
+
PATH: process.env.PATH,
|
|
22
|
+
TERM: "dumb",
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
let stdout = "";
|
|
26
|
+
child.stdout.setEncoding("utf8");
|
|
27
|
+
child.stdout.on("data", (chunk) => {
|
|
28
|
+
stdout += chunk;
|
|
29
|
+
});
|
|
30
|
+
child.on("error", () => done({}));
|
|
31
|
+
child.on("close", (code) => {
|
|
32
|
+
const out = {};
|
|
33
|
+
for (const line of code === 0 ? stdout.split("\n") : []) {
|
|
34
|
+
const at = line.indexOf("=");
|
|
35
|
+
if (at > 0) {
|
|
36
|
+
out[line.slice(0, at)] = line.slice(at + 1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
done(out);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
return shellEnv;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The environment a client gets: its sign-in as the login shell sets it (else as this process
|
|
46
|
+
* has it), PATH as the shell has it so the client is found from a GUI app too, and nothing else —
|
|
47
|
+
* no key of ours, no session of a parent client.
|
|
48
|
+
*/
|
|
49
|
+
export function pickEnv(shell, own, passThrough,
|
|
50
|
+
/** Folders before the shell's PATH: the clients the setup installed. */
|
|
51
|
+
first = []) {
|
|
52
|
+
const picked = {};
|
|
53
|
+
const source = Object.keys(shell).length ? shell : own;
|
|
54
|
+
for (const [key, value] of Object.entries(source)) {
|
|
55
|
+
if (passThrough.test(key) && value) {
|
|
56
|
+
picked[key] = value;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const path = [...first, ...(shell.PATH ?? "").split(":"), ...(own.PATH ?? "").split(":")].filter(Boolean);
|
|
60
|
+
return {
|
|
61
|
+
...picked,
|
|
62
|
+
PATH: [...new Set(path)].join(":"),
|
|
63
|
+
HOME: own.HOME,
|
|
64
|
+
USER: own.USER,
|
|
65
|
+
LANG: "en_US.UTF-8",
|
|
66
|
+
TERM: "dumb",
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export function stripKeys(env, keyVars) {
|
|
70
|
+
const bare = { ...env };
|
|
71
|
+
for (const key of keyVars) {
|
|
72
|
+
delete bare[key];
|
|
73
|
+
}
|
|
74
|
+
return bare;
|
|
75
|
+
}
|
|
76
|
+
/** Where the setup installs clients from npm, whoever started this runtime. */
|
|
77
|
+
const installed = () => [join(layout().clients, "bin")];
|
|
78
|
+
const resolved = new Map();
|
|
79
|
+
/**
|
|
80
|
+
* The environment a client runs in, decided once: the subscription sign-in comes first — it is
|
|
81
|
+
* what the person installed the client for — so a key the shell sets is held back while the
|
|
82
|
+
* client is signed in without it, and used only where it is the one way in.
|
|
83
|
+
*/
|
|
84
|
+
export function resolveEnv(spec) {
|
|
85
|
+
let pending = resolved.get(spec.id);
|
|
86
|
+
if (!pending) {
|
|
87
|
+
pending = (async () => {
|
|
88
|
+
const withKey = pickEnv(await loginShellEnv(), process.env, spec.passThrough, installed());
|
|
89
|
+
const bare = stripKeys(withKey, spec.keyVars);
|
|
90
|
+
const own = await spec.auth(bare);
|
|
91
|
+
if (own !== "none") {
|
|
92
|
+
return { env: bare, auth: own };
|
|
93
|
+
}
|
|
94
|
+
if (spec.keyVars.some((key) => withKey[key])) {
|
|
95
|
+
const keyed = await spec.auth(withKey);
|
|
96
|
+
if (keyed !== "none") {
|
|
97
|
+
return { env: withKey, auth: "api_key" };
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return { env: bare, auth: "none" };
|
|
101
|
+
})();
|
|
102
|
+
resolved.set(spec.id, pending);
|
|
103
|
+
}
|
|
104
|
+
return pending;
|
|
105
|
+
}
|
|
106
|
+
/** The environment of a sign-in: the client on its own, without a key of the shell, in a real terminal. */
|
|
107
|
+
export async function loginEnv(spec) {
|
|
108
|
+
const bare = stripKeys(pickEnv(await loginShellEnv(), process.env, spec.passThrough, installed()), spec.keyVars);
|
|
109
|
+
return { ...bare, TERM: "xterm-256color", COLORTERM: "truecolor" };
|
|
110
|
+
}
|
|
111
|
+
/** The client's sign-in right now, on its own: asked again and again while the person signs in. */
|
|
112
|
+
export async function freshAuth(spec) {
|
|
113
|
+
return spec.auth(await loginEnv(spec));
|
|
114
|
+
}
|
|
115
|
+
/** Forgets what was decided: the person may just have signed in or changed their shell. */
|
|
116
|
+
export function forgetEnv(id) {
|
|
117
|
+
shellEnv = null;
|
|
118
|
+
if (id) {
|
|
119
|
+
resolved.delete(id);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
resolved.clear();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { mkdirSync } from "node:fs";
|
|
2
|
+
import { installCommand } from "../cli/clients.js";
|
|
3
|
+
import { inherited, runtimePath } from "../cli/environment.js";
|
|
4
|
+
import { layout } from "../cli/home.js";
|
|
5
|
+
import { CLIENTS, vendorApp } from "../cli/machine.js";
|
|
6
|
+
import { antigravity } from "./antigravity.js";
|
|
7
|
+
import { claude } from "./claude.js";
|
|
8
|
+
import { codex } from "./codex.js";
|
|
9
|
+
import { cursor } from "./cursor.js";
|
|
10
|
+
import { forgetEnv, loginShellEnv, resolveEnv } from "./env.js";
|
|
11
|
+
export { HarnessModel, notInstalled, signedOut } from "./model.js";
|
|
12
|
+
export { HARNESS_IDS } from "./types.js";
|
|
13
|
+
/**
|
|
14
|
+
* The AI clients this runtime can run as a model, in the order the setup offers them. The first
|
|
15
|
+
* one installed is the one the setup recommends.
|
|
16
|
+
*/
|
|
17
|
+
export const HARNESSES = [codex, claude, antigravity, cursor];
|
|
18
|
+
export function harness(id) {
|
|
19
|
+
return HARNESSES.find((h) => h.id === id) ?? null;
|
|
20
|
+
}
|
|
21
|
+
/** Whether a binding's vendor names a client: `claude/sonnet`, `codex/default`. */
|
|
22
|
+
export function isHarnessVendor(vendor) {
|
|
23
|
+
return HARNESSES.some((h) => h.id === vendor);
|
|
24
|
+
}
|
|
25
|
+
const detected = new Map();
|
|
26
|
+
/** One client, as it is now; asked again after a minute — it may get installed or signed in meanwhile. */
|
|
27
|
+
export async function detectHarness(id, force = false) {
|
|
28
|
+
const h = harness(id);
|
|
29
|
+
if (!h) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const hit = detected.get(id);
|
|
33
|
+
if (!force && hit && Date.now() - hit.at < 60_000) {
|
|
34
|
+
return hit.value;
|
|
35
|
+
}
|
|
36
|
+
if (force) {
|
|
37
|
+
// The person may just have signed in or set a key in their shell.
|
|
38
|
+
forgetEnv(id);
|
|
39
|
+
}
|
|
40
|
+
const client = CLIENTS.find((c) => c.id === id);
|
|
41
|
+
let value = {
|
|
42
|
+
id,
|
|
43
|
+
name: h.name,
|
|
44
|
+
install: client ? installCommand(client, layout()) : "",
|
|
45
|
+
app: client ? vendorApp(client) : null,
|
|
46
|
+
version: null,
|
|
47
|
+
auth: "none",
|
|
48
|
+
interactiveLogin: h.login.interactive,
|
|
49
|
+
images: Boolean(h.image),
|
|
50
|
+
};
|
|
51
|
+
try {
|
|
52
|
+
const { env, auth } = await resolveEnv(h);
|
|
53
|
+
const version = await h.version(env);
|
|
54
|
+
if (version) {
|
|
55
|
+
value = { ...value, version, auth };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
// not installed
|
|
60
|
+
}
|
|
61
|
+
detected.set(id, { at: Date.now(), value });
|
|
62
|
+
return value;
|
|
63
|
+
}
|
|
64
|
+
/** Every client this runtime knows, installed or not. */
|
|
65
|
+
export function detectHarnesses(force = false) {
|
|
66
|
+
return Promise.all(HARNESSES.map((h) => detectHarness(h.id, force)));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* What the inline terminal runs to install a client: the command the terminal setup runs, shown
|
|
70
|
+
* first. A client from npm goes into the install's own prefix with the npm of its own Node.
|
|
71
|
+
*/
|
|
72
|
+
export async function installSpec(id) {
|
|
73
|
+
const client = CLIENTS.find((c) => c.id === id);
|
|
74
|
+
if (!client) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
const paths = layout();
|
|
78
|
+
mkdirSync(paths.clients, { recursive: true });
|
|
79
|
+
const shell = await loginShellEnv();
|
|
80
|
+
return {
|
|
81
|
+
bin: "bash",
|
|
82
|
+
args: [
|
|
83
|
+
"-c",
|
|
84
|
+
'printf "\\033[2m$ %s\\033[0m\\n\\n" "$1"; set -o pipefail; eval "$1"',
|
|
85
|
+
"install",
|
|
86
|
+
installCommand(client, paths),
|
|
87
|
+
],
|
|
88
|
+
env: {
|
|
89
|
+
...inherited(process.env),
|
|
90
|
+
PATH: runtimePath(paths, { ...process.env, PATH: shell.PATH || process.env.PATH }),
|
|
91
|
+
TERM: "xterm-256color",
|
|
92
|
+
COLORTERM: "truecolor",
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { note } from "@engenty-wizards/shared/run";
|
|
5
|
+
import { nanoid } from "nanoid";
|
|
6
|
+
import { env } from "../env.js";
|
|
7
|
+
import { openBridge } from "../mcp/bridge.js";
|
|
8
|
+
import { ModelUnavailableError } from "../model-errors.js";
|
|
9
|
+
import { extensionOf, jsonInstruction, parseJsonAnswer, renderPrompt } from "./prompt.js";
|
|
10
|
+
const workDir = join(env.dataDir, "harness");
|
|
11
|
+
export const signedOut = (h) => note("clientNotSignedIn", { name: h.name });
|
|
12
|
+
export const notInstalled = (h) => note("clientNotInstalled", { name: h.name });
|
|
13
|
+
export const notServed = (h) => note("clientAccountNotServed", { name: h.name });
|
|
14
|
+
export const exhausted = (h) => h.exhausted ?? note("clientNoCredit", { name: h.name });
|
|
15
|
+
/** The failure a client reports, as the person should read it. */
|
|
16
|
+
export function failureOf(h, detail) {
|
|
17
|
+
// The client's own words stay in the log: the sentence below sums them up for the person.
|
|
18
|
+
console.warn(`[${h.id}] ${detail.replace(/\s+/g, " ").trim().slice(0, 1500)}`);
|
|
19
|
+
if (/credit balance|billing|too low|usage limit|quota|insufficient|rate.?limit|\b429\b/i.test(detail)) {
|
|
20
|
+
return new ModelUnavailableError(exhausted(h));
|
|
21
|
+
}
|
|
22
|
+
// Signed in, but the vendor no longer serves that account with this client: signing in again
|
|
23
|
+
// with the same account changes nothing.
|
|
24
|
+
if (/IneligibleTier|no longer supported|UNSUPPORTED_CLIENT|not eligible/i.test(detail)) {
|
|
25
|
+
return new ModelUnavailableError(notServed(h));
|
|
26
|
+
}
|
|
27
|
+
if (/authenticat|log ?in|logged in|oauth|credential|unauthori[sz]ed|\b401\b|api key/i.test(detail)) {
|
|
28
|
+
return new ModelUnavailableError(signedOut(h));
|
|
29
|
+
}
|
|
30
|
+
return new Error(`${h.name}: ${detail}`.slice(0, 500));
|
|
31
|
+
}
|
|
32
|
+
/** Runs a client once with the prompt on stdin; a client that is not there raises ENOENT. */
|
|
33
|
+
export function runClient(bin, args, opts) {
|
|
34
|
+
return new Promise((resolve, reject) => {
|
|
35
|
+
const child = spawn(bin, args, {
|
|
36
|
+
cwd: opts.cwd,
|
|
37
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
38
|
+
signal: opts.signal,
|
|
39
|
+
env: opts.env,
|
|
40
|
+
});
|
|
41
|
+
let stdout = "";
|
|
42
|
+
let stderr = "";
|
|
43
|
+
child.stdout.on("data", (chunk) => {
|
|
44
|
+
stdout += String(chunk);
|
|
45
|
+
});
|
|
46
|
+
child.stderr.on("data", (chunk) => {
|
|
47
|
+
stderr = (stderr + String(chunk)).slice(-4000);
|
|
48
|
+
});
|
|
49
|
+
child.on("error", reject);
|
|
50
|
+
child.on("close", (code) => resolve({ stdout, stderr, code }));
|
|
51
|
+
child.stdin.on("error", () => {
|
|
52
|
+
// The client went away before reading the prompt; `close` reports it.
|
|
53
|
+
});
|
|
54
|
+
child.stdin.end(opts.stdin ?? "");
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/** The last line of an output that is a JSON object. */
|
|
58
|
+
export function lastJson(stdout) {
|
|
59
|
+
for (const line of stdout.trim().split("\n").reverse()) {
|
|
60
|
+
try {
|
|
61
|
+
const value = JSON.parse(line);
|
|
62
|
+
if (value && typeof value === "object") {
|
|
63
|
+
return value;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
// not it
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
export class HarnessModel {
|
|
73
|
+
specificationVersion = "v3";
|
|
74
|
+
modelId;
|
|
75
|
+
supportedUrls = {};
|
|
76
|
+
/** Whether the client validates structured output against the schema itself. */
|
|
77
|
+
nativeSchema = false;
|
|
78
|
+
/** Whether the client runs a call's tools (over the bridge); else they are left out, with a warning. */
|
|
79
|
+
usesTools = true;
|
|
80
|
+
/** Whether the client searches the web with a tool of its own, tools of the call or not. */
|
|
81
|
+
searchesWeb = true;
|
|
82
|
+
effort;
|
|
83
|
+
harness;
|
|
84
|
+
executors = new Map();
|
|
85
|
+
constructor(harness, alias, effort) {
|
|
86
|
+
this.harness = harness;
|
|
87
|
+
this.modelId = alias;
|
|
88
|
+
this.effort = effort;
|
|
89
|
+
}
|
|
90
|
+
/** The tools a call may name, by the names the agent gives them: the client runs them over the bridge. */
|
|
91
|
+
attach(tools) {
|
|
92
|
+
for (const [name, tool] of Object.entries(tools)) {
|
|
93
|
+
const t = tool;
|
|
94
|
+
if (typeof t?.execute === "function") {
|
|
95
|
+
this.executors.set(name, t);
|
|
96
|
+
if (t.id) {
|
|
97
|
+
this.executors.set(t.id, t);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
async doGenerate(options) {
|
|
103
|
+
const dir = join(workDir, nanoid(10));
|
|
104
|
+
mkdirSync(dir, { recursive: true });
|
|
105
|
+
const { system, prompt, files, warnings } = renderPrompt(options.prompt, dir);
|
|
106
|
+
const bridged = [];
|
|
107
|
+
let webSearch = false;
|
|
108
|
+
for (const tool of options.tools ?? []) {
|
|
109
|
+
// The client searches with its own tool; naming `web_search` is what switches it on.
|
|
110
|
+
if (tool.type === "function" && tool.name === "web_search" && this.searchesWeb) {
|
|
111
|
+
webSearch = true;
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (tool.type !== "function" || !this.usesTools) {
|
|
115
|
+
warnings.push({ type: "unsupported", feature: `tool ${tool.name}` });
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
const executor = this.executors.get(tool.name);
|
|
119
|
+
if (!executor?.execute) {
|
|
120
|
+
warnings.push({
|
|
121
|
+
type: "unsupported",
|
|
122
|
+
feature: `tool ${tool.name}`,
|
|
123
|
+
details: "no executor",
|
|
124
|
+
});
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
bridged.push({
|
|
128
|
+
name: tool.name,
|
|
129
|
+
description: tool.description,
|
|
130
|
+
inputSchema: tool.inputSchema,
|
|
131
|
+
execute: (input) => executor.execute(input),
|
|
132
|
+
toModelOutput: executor.toModelOutput,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
for (const key of ["temperature", "topP", "topK", "seed", "stopSequences"]) {
|
|
136
|
+
if (options[key] !== undefined) {
|
|
137
|
+
warnings.push({ type: "unsupported", feature: key });
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
const structured = options.responseFormat?.type === "json";
|
|
141
|
+
const schema = structured && options.responseFormat?.type === "json"
|
|
142
|
+
? (options.responseFormat.schema ?? null)
|
|
143
|
+
: null;
|
|
144
|
+
const bridge = bridged.length ? openBridge(bridged) : null;
|
|
145
|
+
try {
|
|
146
|
+
const answer = await this.invoke({
|
|
147
|
+
dir,
|
|
148
|
+
system: structured && !this.nativeSchema
|
|
149
|
+
? [system, jsonInstruction(schema)].filter(Boolean).join("\n\n")
|
|
150
|
+
: system,
|
|
151
|
+
prompt,
|
|
152
|
+
files,
|
|
153
|
+
bridgeUrl: bridge?.url ?? null,
|
|
154
|
+
schema: this.nativeSchema ? schema : null,
|
|
155
|
+
webSearch,
|
|
156
|
+
effort: this.effort,
|
|
157
|
+
signal: options.abortSignal,
|
|
158
|
+
});
|
|
159
|
+
const u = answer.usage ?? {};
|
|
160
|
+
const cacheRead = u.cacheRead ?? 0;
|
|
161
|
+
const cacheWrite = u.cacheWrite ?? 0;
|
|
162
|
+
const input = u.input ?? 0;
|
|
163
|
+
return {
|
|
164
|
+
content: [
|
|
165
|
+
{
|
|
166
|
+
type: "text",
|
|
167
|
+
text: structured ? JSON.stringify(parseJsonAnswer(answer.text)) : answer.text,
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
finishReason: { unified: "stop", raw: answer.stopReason },
|
|
171
|
+
usage: {
|
|
172
|
+
inputTokens: {
|
|
173
|
+
total: input,
|
|
174
|
+
noCache: Math.max(0, input - cacheRead - cacheWrite),
|
|
175
|
+
cacheRead,
|
|
176
|
+
cacheWrite,
|
|
177
|
+
},
|
|
178
|
+
outputTokens: { total: u.output ?? 0, text: u.output ?? 0, reasoning: undefined },
|
|
179
|
+
raw: u,
|
|
180
|
+
},
|
|
181
|
+
providerMetadata: { [this.provider]: answer.meta ?? {} },
|
|
182
|
+
response: { id: answer.sessionId, modelId: this.modelId },
|
|
183
|
+
warnings,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
catch (err) {
|
|
187
|
+
if (err.code === "ENOENT") {
|
|
188
|
+
throw new ModelUnavailableError(notInstalled(this.harness));
|
|
189
|
+
}
|
|
190
|
+
throw err;
|
|
191
|
+
}
|
|
192
|
+
finally {
|
|
193
|
+
bridge?.close();
|
|
194
|
+
rmSync(dir, { recursive: true, force: true });
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/** The answer as one piece: the client prints it when it is done. */
|
|
198
|
+
async doStream(options) {
|
|
199
|
+
const result = await this.doGenerate(options);
|
|
200
|
+
const text = result.content.find((c) => c.type === "text");
|
|
201
|
+
const parts = [
|
|
202
|
+
{ type: "stream-start", warnings: result.warnings },
|
|
203
|
+
{ type: "response-metadata", ...result.response },
|
|
204
|
+
{ type: "text-start", id: "0" },
|
|
205
|
+
{ type: "text-delta", id: "0", delta: text?.type === "text" ? text.text : "" },
|
|
206
|
+
{ type: "text-end", id: "0" },
|
|
207
|
+
{
|
|
208
|
+
type: "finish",
|
|
209
|
+
usage: result.usage,
|
|
210
|
+
finishReason: result.finishReason,
|
|
211
|
+
providerMetadata: result.providerMetadata,
|
|
212
|
+
},
|
|
213
|
+
];
|
|
214
|
+
return {
|
|
215
|
+
stream: new ReadableStream({
|
|
216
|
+
start(controller) {
|
|
217
|
+
for (const part of parts) {
|
|
218
|
+
controller.enqueue(part);
|
|
219
|
+
}
|
|
220
|
+
controller.close();
|
|
221
|
+
},
|
|
222
|
+
}),
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/** A client that makes images on the person's sign-in: one client run per image. */
|
|
227
|
+
export class HarnessImageModel {
|
|
228
|
+
specificationVersion = "v3";
|
|
229
|
+
modelId;
|
|
230
|
+
maxImagesPerCall = 1;
|
|
231
|
+
harness;
|
|
232
|
+
constructor(harness, alias) {
|
|
233
|
+
this.harness = harness;
|
|
234
|
+
this.modelId = alias;
|
|
235
|
+
}
|
|
236
|
+
async doGenerate(options) {
|
|
237
|
+
const dir = join(workDir, nanoid(10));
|
|
238
|
+
mkdirSync(dir, { recursive: true });
|
|
239
|
+
const warnings = [];
|
|
240
|
+
const files = [];
|
|
241
|
+
for (const file of options.files ?? []) {
|
|
242
|
+
if (file.type !== "file") {
|
|
243
|
+
warnings.push({ type: "unsupported", feature: "image url" });
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
const path = join(dir, `ref-${files.length + 1}.${extensionOf(file.mediaType)}`);
|
|
247
|
+
writeFileSync(path, typeof file.data === "string" ? Buffer.from(file.data, "base64") : file.data);
|
|
248
|
+
files.push(path);
|
|
249
|
+
}
|
|
250
|
+
for (const key of ["size", "seed", "mask"]) {
|
|
251
|
+
if (options[key] !== undefined) {
|
|
252
|
+
warnings.push({ type: "unsupported", feature: key });
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
try {
|
|
256
|
+
const image = await this.invoke({
|
|
257
|
+
dir,
|
|
258
|
+
prompt: options.prompt ?? "",
|
|
259
|
+
files,
|
|
260
|
+
aspectRatio: options.aspectRatio,
|
|
261
|
+
signal: options.abortSignal,
|
|
262
|
+
});
|
|
263
|
+
return {
|
|
264
|
+
images: [image],
|
|
265
|
+
warnings,
|
|
266
|
+
response: { timestamp: new Date(), modelId: this.modelId, headers: undefined },
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
catch (err) {
|
|
270
|
+
if (err.code === "ENOENT") {
|
|
271
|
+
throw new ModelUnavailableError(notInstalled(this.harness));
|
|
272
|
+
}
|
|
273
|
+
throw err;
|
|
274
|
+
}
|
|
275
|
+
finally {
|
|
276
|
+
rmSync(dir, { recursive: true, force: true });
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|