@wardby/cli 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +34 -4
- package/README.md +41 -4
- package/dist/claude-coding-worker/driver.d.ts +6 -1
- package/dist/claude-coding-worker/driver.js +27 -1
- package/dist/claude-coding-worker/main.js +2 -0
- package/dist/claude-coding-worker/tool-socket.d.ts +9 -0
- package/dist/claude-coding-worker/tool-socket.js +26 -0
- package/dist/cli-help.d.ts +1 -1
- package/dist/cli-help.js +13 -4
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +219 -29
- package/dist/coding/collect-exclude.d.ts +25 -0
- package/dist/coding/collect-exclude.js +76 -0
- package/dist/coding/profile.d.ts +67 -22
- package/dist/coding/profile.js +58 -25
- package/dist/coding/protected-path-wording.d.ts +24 -0
- package/dist/coding/protected-path-wording.js +55 -0
- package/dist/coding/protected-paths.d.ts +31 -0
- package/dist/coding/protected-paths.js +48 -0
- package/dist/coding/protocol.d.ts +75 -4
- package/dist/coding/protocol.js +107 -7
- package/dist/coding/registry/adapters.d.ts +2 -0
- package/dist/coding/registry/adapters.js +9 -0
- package/dist/coding/registry/allowlist.d.ts +9 -0
- package/dist/coding/registry/allowlist.js +28 -0
- package/dist/coding/registry/json-scan.d.ts +55 -0
- package/dist/coding/registry/json-scan.js +191 -0
- package/dist/coding/registry/lockfiles.d.ts +6 -0
- package/dist/coding/registry/lockfiles.js +89 -0
- package/dist/coding/registry/npm-lockfile.d.ts +9 -0
- package/dist/coding/registry/npm-lockfile.js +73 -0
- package/dist/coding/registry/npm-plan.d.ts +29 -0
- package/dist/coding/registry/npm-plan.js +289 -0
- package/dist/coding/registry/npm.d.ts +7 -0
- package/dist/coding/registry/npm.js +252 -0
- package/dist/coding/registry/pypi.d.ts +4 -0
- package/dist/coding/registry/pypi.js +210 -0
- package/dist/coding/registry/report.d.ts +37 -0
- package/dist/coding/registry/report.js +31 -0
- package/dist/coding/registry/token.d.ts +4 -0
- package/dist/coding/registry/token.js +7 -0
- package/dist/coding/registry/types.d.ts +286 -0
- package/dist/coding/registry/types.js +19 -0
- package/dist/coding/registry/worker-config.d.ts +14 -0
- package/dist/coding/registry/worker-config.js +31 -0
- package/dist/coding/services/builtins.d.ts +22 -0
- package/dist/coding/services/builtins.js +85 -0
- package/dist/coding/services/catalog.d.ts +443 -0
- package/dist/coding/services/catalog.js +159 -0
- package/dist/coding/services/declaration.d.ts +11 -0
- package/dist/coding/services/declaration.js +114 -0
- package/dist/coding/services/note.d.ts +8 -0
- package/dist/coding/services/note.js +15 -0
- package/dist/coding/services/resolve.d.ts +25 -0
- package/dist/coding/services/resolve.js +50 -0
- package/dist/coding/services/wording.d.ts +25 -0
- package/dist/coding/services/wording.js +70 -0
- package/dist/coding-proxy/main.js +24 -4
- package/dist/coding-worker/artifact.d.ts +6 -0
- package/dist/coding-worker/debug-trace.d.ts +37 -0
- package/dist/coding-worker/debug-trace.js +117 -0
- package/dist/coding-worker/driver.d.ts +13 -1
- package/dist/coding-worker/driver.js +102 -13
- package/dist/coding-worker/errors.js +8 -0
- package/dist/coding-worker/main.js +10 -2
- package/dist/coding-worker/sdk.d.ts +2 -2
- package/dist/coding-worker/sdk.js +7 -2
- package/dist/coding-worker/types.d.ts +3 -0
- package/dist/config/providers.d.ts +41 -0
- package/dist/config/providers.js +66 -0
- package/dist/core/budget-groups.d.ts +108 -5
- package/dist/core/budget-groups.js +125 -19
- package/dist/core/budget-wording.d.ts +22 -0
- package/dist/core/budget-wording.js +55 -0
- package/dist/core/datastores.js +18 -2
- package/dist/core/db.d.ts +5 -1
- package/dist/core/db.js +8 -2
- package/dist/core/dispatch.d.ts +33 -6
- package/dist/core/dispatch.js +260 -43
- package/dist/core/engine-native.js +27 -10
- package/dist/core/grants.d.ts +86 -0
- package/dist/core/grants.js +126 -0
- package/dist/core/host-events.d.ts +49 -0
- package/dist/core/host-events.js +257 -0
- package/dist/core/host-identity-links.d.ts +54 -0
- package/dist/core/host-identity-links.js +189 -0
- package/dist/core/host-status.d.ts +61 -0
- package/dist/core/host-status.js +211 -0
- package/dist/core/in-flight-runs.d.ts +8 -0
- package/dist/core/in-flight-runs.js +56 -0
- package/dist/core/provider-wording.d.ts +12 -0
- package/dist/core/provider-wording.js +44 -0
- package/dist/core/reconciler.d.ts +38 -2
- package/dist/core/reconciler.js +86 -2
- package/dist/core/repo-access.d.ts +99 -0
- package/dist/core/repo-access.js +136 -0
- package/dist/core/review-host-checks.d.ts +11 -0
- package/dist/core/review-host-checks.js +41 -0
- package/dist/core/review-host-tools.d.ts +47 -0
- package/dist/core/review-host-tools.js +347 -0
- package/dist/core/run-heartbeat.d.ts +27 -0
- package/dist/core/run-heartbeat.js +54 -0
- package/dist/core/runner.d.ts +30 -8
- package/dist/core/runner.js +237 -40
- package/dist/core/secrets.d.ts +11 -2
- package/dist/core/secrets.js +25 -6
- package/dist/core/subagent-memory-tools.d.ts +1 -1
- package/dist/core/subagent-memory-tools.js +16 -3
- package/dist/core/tool-admin.d.ts +81 -0
- package/dist/core/tool-admin.js +129 -0
- package/dist/core/tool-names.d.ts +42 -0
- package/dist/core/tool-names.js +64 -0
- package/dist/core/untrusted-content.d.ts +32 -0
- package/dist/core/untrusted-content.js +72 -0
- package/dist/core/webhooks.d.ts +8 -1
- package/dist/core/webhooks.js +23 -2
- package/dist/generated/prisma/browser.d.ts +100 -0
- package/dist/generated/prisma/client.d.ts +100 -0
- package/dist/generated/prisma/commonInputTypes.d.ts +30 -0
- package/dist/generated/prisma/enums.d.ts +6 -0
- package/dist/generated/prisma/enums.js +6 -1
- package/dist/generated/prisma/internal/class.d.ts +143 -0
- package/dist/generated/prisma/internal/class.js +4 -4
- package/dist/generated/prisma/internal/prismaNamespace.d.ts +1746 -577
- package/dist/generated/prisma/internal/prismaNamespace.js +179 -6
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.d.ts +186 -0
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.js +179 -6
- package/dist/generated/prisma/models/Agent.d.ts +294 -1
- package/dist/generated/prisma/models/AgentRepository.d.ts +1425 -0
- package/dist/generated/prisma/models/AgentRepository.js +1 -0
- package/dist/generated/prisma/models/AgentTool.d.ts +95 -1
- package/dist/generated/prisma/models/AuthUser.d.ts +56 -1
- package/dist/generated/prisma/models/CodingAgentProfile.d.ts +258 -7
- package/dist/generated/prisma/models/CodingProxySession.d.ts +123 -2
- package/dist/generated/prisma/models/CodingRun.d.ts +1276 -95
- package/dist/generated/prisma/models/CodingService.d.ts +1348 -0
- package/dist/generated/prisma/models/CodingService.js +1 -0
- package/dist/generated/prisma/models/HostEventDelivery.d.ts +946 -0
- package/dist/generated/prisma/models/HostEventDelivery.js +1 -0
- package/dist/generated/prisma/models/HostIdentity.d.ts +1232 -0
- package/dist/generated/prisma/models/HostIdentity.js +1 -0
- package/dist/generated/prisma/models/HostIdentityLinkRequest.d.ts +1473 -0
- package/dist/generated/prisma/models/HostIdentityLinkRequest.js +1 -0
- package/dist/generated/prisma/models/Principal.d.ts +455 -0
- package/dist/generated/prisma/models/RegistryAllowance.d.ts +1148 -0
- package/dist/generated/prisma/models/RegistryAllowance.js +1 -0
- package/dist/generated/prisma/models/RegistryApprovedVersion.d.ts +1219 -0
- package/dist/generated/prisma/models/RegistryApprovedVersion.js +1 -0
- package/dist/generated/prisma/models/RegistryFetch.d.ts +1428 -0
- package/dist/generated/prisma/models/RegistryFetch.js +1 -0
- package/dist/generated/prisma/models/RegistryPlanRefusal.d.ts +1294 -0
- package/dist/generated/prisma/models/RegistryPlanRefusal.js +1 -0
- package/dist/generated/prisma/models/RegistryVersionFact.d.ts +1085 -0
- package/dist/generated/prisma/models/RegistryVersionFact.js +1 -0
- package/dist/generated/prisma/models/ResourceGrant.d.ts +1437 -0
- package/dist/generated/prisma/models/ResourceGrant.js +1 -0
- package/dist/generated/prisma/models/Run.d.ts +389 -1
- package/dist/generated/prisma/models/RunHostCheck.d.ts +1239 -0
- package/dist/generated/prisma/models/RunHostCheck.js +1 -0
- package/dist/generated/prisma/models/RunHostStatus.d.ts +1315 -0
- package/dist/generated/prisma/models/RunHostStatus.js +1 -0
- package/dist/generated/prisma/models/Tool.d.ts +15 -3
- package/dist/generated/prisma/models.d.ts +13 -0
- package/dist/help/build.d.ts +1 -0
- package/dist/help/build.js +9 -0
- package/dist/help/catalog.d.ts +24 -0
- package/dist/help/catalog.js +160 -0
- package/dist/help/cli.d.ts +2 -0
- package/dist/help/cli.js +65 -0
- package/dist/help/runtime.d.ts +3 -0
- package/dist/help/runtime.js +44 -0
- package/dist/help/search.d.ts +9 -0
- package/dist/help/search.js +104 -0
- package/dist/help-index.json +660 -0
- package/dist/import/cli-args.js +3 -2
- package/dist/import/create.d.ts +5 -0
- package/dist/import/create.js +67 -13
- package/dist/import/index.js +19 -9
- package/dist/import/neutral-schema.d.ts +11 -11
- package/dist/mcp/auth/access.d.ts +70 -0
- package/dist/mcp/auth/access.js +58 -0
- package/dist/mcp/auth/grants-cli.d.ts +149 -0
- package/dist/mcp/auth/grants-cli.js +518 -0
- package/dist/mcp/auth/host-account-cli.d.ts +2 -0
- package/dist/mcp/auth/host-account-cli.js +47 -0
- package/dist/mcp/auth/ownership.d.ts +26 -52
- package/dist/mcp/auth/ownership.js +19 -14
- package/dist/mcp/auth/repo-authorization.d.ts +22 -0
- package/dist/mcp/auth/repo-authorization.js +51 -0
- package/dist/mcp/auth/resource-server.d.ts +31 -2
- package/dist/mcp/auth/resource-server.js +84 -3
- package/dist/mcp/auth/self-hosted/browser.js +2 -2
- package/dist/mcp/auth/self-hosted/cli.js +47 -13
- package/dist/mcp/auth/self-hosted/credentials.d.ts +20 -2
- package/dist/mcp/auth/self-hosted/credentials.js +62 -4
- package/dist/mcp/auth/self-hosted/session.d.ts +2 -1
- package/dist/mcp/context.d.ts +27 -1
- package/dist/mcp/errors.d.ts +25 -6
- package/dist/mcp/errors.js +98 -0
- package/dist/mcp/host-events/github-ingress.d.ts +36 -0
- package/dist/mcp/host-events/github-ingress.js +92 -0
- package/dist/mcp/host-events/github-user-callback.d.ts +18 -0
- package/dist/mcp/host-events/github-user-callback.js +50 -0
- package/dist/mcp/index.d.ts +8 -1
- package/dist/mcp/index.js +106 -16
- package/dist/mcp/server.js +27 -9
- package/dist/mcp/tools/agents.js +446 -48
- package/dist/mcp/tools/budget-groups.js +3 -3
- package/dist/mcp/tools/datastore.js +22 -15
- package/dist/mcp/tools/grants.d.ts +2 -0
- package/dist/mcp/tools/grants.js +239 -0
- package/dist/mcp/tools/help.d.ts +5 -0
- package/dist/mcp/tools/help.js +67 -0
- package/dist/mcp/tools/host-accounts.d.ts +2 -0
- package/dist/mcp/tools/host-accounts.js +114 -0
- package/dist/mcp/tools/memory.d.ts +7 -1
- package/dist/mcp/tools/memory.js +5 -5
- package/dist/mcp/tools/repositories.d.ts +2 -0
- package/dist/mcp/tools/repositories.js +181 -0
- package/dist/mcp/tools/runs.d.ts +6 -0
- package/dist/mcp/tools/runs.js +60 -6
- package/dist/mcp/tools/scheduling.js +3 -6
- package/dist/mcp/tools/secrets.js +18 -6
- package/dist/mcp/tools/services.d.ts +2 -0
- package/dist/mcp/tools/services.js +222 -0
- package/dist/mcp/tools/subagents.js +52 -16
- package/dist/mcp/tools/tools.d.ts +41 -0
- package/dist/mcp/tools/tools.js +201 -40
- package/dist/mcp/tools/trigger.js +36 -6
- package/dist/mcp/tools/webhooks.js +15 -4
- package/dist/mcp/transport/streamable-http.d.ts +10 -0
- package/dist/mcp/transport/streamable-http.js +32 -2
- package/dist/providers/auth/delegating.d.ts +19 -0
- package/dist/providers/auth/delegating.js +71 -0
- package/dist/providers/auth/index.d.ts +2 -0
- package/dist/providers/auth/index.js +11 -0
- package/dist/providers/auth/self-hosted.d.ts +2 -1
- package/dist/providers/auth/self-hosted.js +16 -4
- package/dist/providers/auth/types.d.ts +6 -0
- package/dist/providers/coding-proxy/memory-ledger.d.ts +3 -0
- package/dist/providers/coding-proxy/memory-ledger.js +21 -2
- package/dist/providers/coding-proxy/metering.d.ts +4 -0
- package/dist/providers/coding-proxy/metering.js +28 -2
- package/dist/providers/coding-proxy/prisma-ledger.d.ts +17 -0
- package/dist/providers/coding-proxy/prisma-ledger.js +50 -5
- package/dist/providers/coding-proxy/proxy.d.ts +13 -0
- package/dist/providers/coding-proxy/proxy.js +479 -18
- package/dist/providers/coding-proxy/registry/audit.d.ts +131 -0
- package/dist/providers/coding-proxy/registry/audit.js +380 -0
- package/dist/providers/coding-proxy/registry/bounded-fetch.d.ts +16 -0
- package/dist/providers/coding-proxy/registry/bounded-fetch.js +77 -0
- package/dist/providers/coding-proxy/registry/plan.d.ts +58 -0
- package/dist/providers/coding-proxy/registry/plan.js +304 -0
- package/dist/providers/coding-proxy/registry/prisma-store.d.ts +34 -0
- package/dist/providers/coding-proxy/registry/prisma-store.js +151 -0
- package/dist/providers/coding-proxy/registry/service.d.ts +213 -0
- package/dist/providers/coding-proxy/registry/service.js +1137 -0
- package/dist/providers/coding-proxy/registry/store.d.ts +127 -0
- package/dist/providers/coding-proxy/registry/store.js +70 -0
- package/dist/providers/coding-proxy/runtime.d.ts +17 -0
- package/dist/providers/coding-proxy/runtime.js +63 -0
- package/dist/providers/coding-proxy/secure-fetch.js +0 -1
- package/dist/providers/coding-proxy/server.d.ts +11 -0
- package/dist/providers/coding-proxy/server.js +163 -0
- package/dist/providers/coding-proxy/types.d.ts +15 -0
- package/dist/providers/engine/types.d.ts +10 -0
- package/dist/providers/executor/build.d.ts +2 -2
- package/dist/providers/executor/composition.d.ts +3 -0
- package/dist/providers/executor/composition.js +19 -0
- package/dist/providers/executor/container.d.ts +105 -3
- package/dist/providers/executor/container.js +296 -20
- package/dist/providers/executor/dbos.d.ts +2 -3
- package/dist/providers/executor/in-process.d.ts +2 -3
- package/dist/providers/executor/routing.d.ts +7 -0
- package/dist/providers/executor/routing.js +13 -0
- package/dist/providers/executor/types.d.ts +22 -0
- package/dist/providers/jobs/claude-tool-setup.d.ts +23 -0
- package/dist/providers/jobs/claude-tool-setup.js +50 -0
- package/dist/providers/jobs/collect-prune.d.ts +7 -0
- package/dist/providers/jobs/collect-prune.js +27 -0
- package/dist/providers/jobs/docker-isolation.d.ts +48 -3
- package/dist/providers/jobs/docker-isolation.js +213 -22
- package/dist/providers/jobs/docker-services.d.ts +35 -0
- package/dist/providers/jobs/docker-services.js +191 -0
- package/dist/providers/jobs/docker.d.ts +49 -2
- package/dist/providers/jobs/docker.js +279 -32
- package/dist/providers/jobs/fake-kubernetes-api.d.ts +1 -0
- package/dist/providers/jobs/fake-kubernetes-api.js +12 -3
- package/dist/providers/jobs/kubernetes-isolation.d.ts +17 -2
- package/dist/providers/jobs/kubernetes-isolation.js +238 -57
- package/dist/providers/jobs/kubernetes-platform.d.ts +10 -4
- package/dist/providers/jobs/kubernetes-platform.js +11 -5
- package/dist/providers/jobs/kubernetes-preflight.js +3 -0
- package/dist/providers/jobs/kubernetes.d.ts +21 -2
- package/dist/providers/jobs/kubernetes.js +112 -21
- package/dist/providers/jobs/types.d.ts +18 -0
- package/dist/providers/llm/anthropic.js +6 -2
- package/dist/providers/llm/bedrock.js +2 -1
- package/dist/providers/llm/claude-messages.d.ts +5 -1
- package/dist/providers/llm/claude-messages.js +1 -0
- package/dist/providers/llm/claude-provider.d.ts +3 -1
- package/dist/providers/llm/claude-provider.js +5 -1
- package/dist/providers/llm/index.d.ts +1 -1
- package/dist/providers/llm/index.js +1 -1
- package/dist/providers/llm/pricing-anthropic.d.ts +10 -0
- package/dist/providers/llm/pricing-anthropic.js +32 -14
- package/dist/providers/llm/pricing-bedrock-claude.d.ts +8 -0
- package/dist/providers/llm/pricing-bedrock-claude.js +9 -0
- package/dist/providers/llm/routing.d.ts +10 -1
- package/dist/providers/llm/routing.js +18 -0
- package/dist/providers/llm/types.d.ts +12 -0
- package/dist/providers/llm/types.js +8 -1
- package/dist/providers/review-host/diff-lines.d.ts +16 -0
- package/dist/providers/review-host/diff-lines.js +59 -0
- package/dist/providers/review-host/github-events.d.ts +6 -0
- package/dist/providers/review-host/github-events.js +180 -0
- package/dist/providers/review-host/github-user-auth.d.ts +38 -0
- package/dist/providers/review-host/github-user-auth.js +128 -0
- package/dist/providers/review-host/github.d.ts +57 -0
- package/dist/providers/review-host/github.js +567 -0
- package/dist/providers/review-host/index.d.ts +12 -0
- package/dist/providers/review-host/index.js +30 -0
- package/dist/providers/review-host/review-format.d.ts +19 -0
- package/dist/providers/review-host/review-format.js +59 -0
- package/dist/providers/review-host/types.d.ts +284 -0
- package/dist/providers/review-host/types.js +24 -0
- package/dist/providers/vcs/git.d.ts +16 -6
- package/dist/providers/vcs/git.js +77 -13
- package/dist/providers/vcs/github.d.ts +74 -3
- package/dist/providers/vcs/github.js +195 -15
- package/dist/providers/vcs/types.d.ts +42 -4
- package/dist/quickstart/index.js +13 -2
- package/dist/sandbox/fetch-policy.d.ts +20 -2
- package/dist/sandbox/fetch-policy.js +64 -3
- package/dist/sandbox/host-functions.d.ts +9 -1
- package/dist/sandbox/host-functions.js +12 -5
- package/dist/serve.js +1 -1
- package/dist/wardby-bin.js +6 -0
- package/docs/README.md +30 -0
- package/docs/architecture-runtime.md +90 -0
- package/docs/assets/brand/wardby-icon-512.png +0 -0
- package/docs/assets/brand/wardby-icon.svg +16 -0
- package/docs/assets/brand/wardby-mascot-profile-512.png +0 -0
- package/docs/assets/brand/wardby-mascot.png +0 -0
- package/docs/assets/brand/wardby-mascot.svg +5 -0
- package/docs/assets/wardby-workflow.svg +106 -0
- package/docs/code-review-agents.md +481 -0
- package/docs/coding-agent-setup.md +172 -0
- package/docs/coding-packages.md +455 -0
- package/docs/coding-services.md +300 -0
- package/docs/coding-worker-byo-images.md +98 -0
- package/docs/coding-worker-isolation.md +1061 -0
- package/docs/getting-started-gke.md +615 -0
- package/docs/getting-started-identity-provider.md +308 -0
- package/docs/getting-started.md +133 -0
- package/docs/observability.md +53 -0
- package/docs/release-verification.md +66 -0
- package/docs/security-deployment.md +657 -0
- package/help/code-review-agents.md +31 -0
- package/help/coding-packages.md +31 -0
- package/help/coding-services.md +71 -0
- package/help/creating-agents.md +68 -0
- package/help/deploy-gke.md +39 -0
- package/help/deployment-targets.md +39 -0
- package/help/errors/budget-group-exhausted.md +25 -0
- package/help/errors/docker-isolation-unsupported.md +26 -0
- package/help/errors/protected-path.md +45 -0
- package/help/errors/repo-access.md +27 -0
- package/help/errors/service-declaration-invalid.md +27 -0
- package/help/errors/service-declaration-unavailable.md +25 -0
- package/help/errors/service-launcher-unsupported.md +30 -0
- package/help/errors/service-not-allowed.md +27 -0
- package/help/errors/service-unknown.md +23 -0
- package/help/errors/service-unready.md +49 -0
- package/help/getting-started.md +31 -0
- package/help/github.md +30 -0
- package/help/identity-and-access.md +39 -0
- package/help/mcp.md +30 -0
- package/help/native-capabilities.md +30 -0
- package/help/observability.md +41 -0
- package/help/operating-agents.md +30 -0
- package/help/security.md +27 -0
- package/help/troubleshooting/budgets.md +26 -0
- package/help/troubleshooting/coding-workers.md +47 -0
- package/help/troubleshooting/repository-access.md +27 -0
- package/package.json +12 -3
- package/prisma/migrations/20260925010000_coding_collect_exclude/migration.sql +8 -0
- package/prisma/migrations/20260925015000_allowed_egress_default/migration.sql +8 -0
- package/prisma/migrations/20260925020000_coding_package_registry/migration.sql +55 -0
- package/prisma/migrations/20260925030000_tool_name_per_owner/migration.sql +11 -0
- package/prisma/migrations/20260926010000_run_trigger_host_event/migration.sql +7 -0
- package/prisma/migrations/20260926020000_code_review_hosts/migration.sql +53 -0
- package/prisma/migrations/20260926030000_auth_user_roles/migration.sql +9 -0
- package/prisma/migrations/20260926040000_agent_effort/migration.sql +6 -0
- package/prisma/migrations/20260926050000_registry_lockfile_plan/migration.sql +32 -0
- package/prisma/migrations/20260926050000_repo_access_authorization/migration.sql +82 -0
- package/prisma/migrations/20260926060000_registry_plan_refusal/migration.sql +19 -0
- package/prisma/migrations/20260926100000_registry_plan_refusal_published_at/migration.sql +5 -0
- package/prisma/migrations/20260926190000_run_host_status/migration.sql +18 -0
- package/prisma/migrations/20260926210000_run_host_status_at_dispatch/migration.sql +5 -0
- package/prisma/migrations/20260927010000_resource_grants/migration.sql +72 -0
- package/prisma/migrations/20260927020000_proxy_session_budget_exhausted/migration.sql +3 -0
- package/prisma/migrations/20260927030000_coding_debug_trace/migration.sql +4 -0
- package/prisma/migrations/20260927040000_proxy_session_upstream_failure/migration.sql +3 -0
- package/prisma/migrations/20260927050000_coding_run_services/migration.sql +74 -0
- package/prisma/migrations/20260928000000_coding_run_tool_image/migration.sql +5 -0
- package/prisma/schema.prisma +407 -21
package/dist/mcp/index.js
CHANGED
|
@@ -1,28 +1,53 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* MCP composition root: assembles the real providers, builds one
|
|
3
|
+
* WardbyMcpServer, registers every tool module, and starts whichever
|
|
4
|
+
* transport MCP_TRANSPORT selects. No business logic lives here — this
|
|
5
|
+
* file only wires together pieces every earlier task already built and
|
|
6
|
+
* tested on their own.
|
|
7
|
+
*
|
|
8
|
+
* stdio vs. HTTP diverge on two things a live smoke test surfaced (see the
|
|
9
|
+
* ledger): stdio needs no `MCP_CANONICAL_URI` (there's no HTTP endpoint or
|
|
10
|
+
* OAuth challenge to identify) and constructs no real `AuthProvider` at all
|
|
11
|
+
* (per the design: "stdio local mode: no token; the operator is trusted") —
|
|
12
|
+
* building one unconditionally would make `wardby mcp` over stdio fail on
|
|
13
|
+
* missing `AUTH_JWKS_URI`/`AUTH_SIGNING_KEY` a deployment running stdio-only
|
|
14
|
+
* never needed to set.
|
|
15
|
+
*/
|
|
16
|
+
import { loadProviderConfig, loadMcpConfig, loadShutdownDrainSeconds, loadAuthConfig, loadGitHubEventConfig, loadGitHubVcsConfig, } from "../config/providers.js";
|
|
2
17
|
import { prisma } from "../core/db.js";
|
|
18
|
+
import { waitForInFlightRuns } from "../core/in-flight-runs.js";
|
|
3
19
|
import { NativeEngine } from "../core/engine-native.js";
|
|
4
20
|
import { resolveLlmRegistrations, RoutingLlmProvider } from "../providers/llm/index.js";
|
|
5
21
|
import { PostgresDatastore } from "../providers/datastore/index.js";
|
|
6
22
|
import { PostgresAgentMemory } from "../providers/memory/index.js";
|
|
7
23
|
import { buildConfiguredExecutor, buildExecutor } from "../providers/executor/index.js";
|
|
8
24
|
import { buildSecretCipher } from "../providers/secrets/index.js";
|
|
25
|
+
import { buildHostUserAuthorizers, buildReviewHosts } from "../providers/review-host/index.js";
|
|
26
|
+
import { createRepoAccessGate } from "../core/repo-access.js";
|
|
27
|
+
import { userCallbackPath } from "../core/host-identity-links.js";
|
|
9
28
|
import { buildAuthProvider } from "../providers/auth/index.js";
|
|
29
|
+
import { GitHubAppClient } from "../providers/vcs/github.js";
|
|
10
30
|
import { buildMcpServer } from "./server.js";
|
|
11
31
|
import { countUnattendedSchedules, unattendedSchedulesWarning } from "./unattended-schedules.js";
|
|
12
32
|
import { runStdioServer } from "./transport/stdio.js";
|
|
13
33
|
import { startHttpServer } from "./transport/streamable-http.js";
|
|
14
34
|
import { resolvePrincipal } from "./auth/principal.js";
|
|
15
|
-
import { SCOPES_SUPPORTED } from "./auth/resource-server.js";
|
|
35
|
+
import { ROLE_NAMES, SCOPES_SUPPORTED } from "./auth/resource-server.js";
|
|
16
36
|
import { canonicalUrl } from "./transport/http-limits.js";
|
|
17
37
|
import { registerAgentTools } from "./tools/agents.js";
|
|
38
|
+
import { registerServiceTools } from "./tools/services.js";
|
|
18
39
|
import { registerBudgetGroupTools } from "./tools/budget-groups.js";
|
|
19
40
|
import { registerModelTools } from "./tools/models.js";
|
|
41
|
+
import { registerHelpTools } from "./tools/help.js";
|
|
20
42
|
import { registerTriggerTool } from "./tools/trigger.js";
|
|
21
43
|
import { registerToolAuthoringTools } from "./tools/tools.js";
|
|
22
44
|
import { registerSchedulingTools } from "./tools/scheduling.js";
|
|
23
45
|
import { registerRunTools } from "./tools/runs.js";
|
|
24
46
|
import { registerDatastoreTools } from "./tools/datastore.js";
|
|
25
47
|
import { registerSubAgentTools } from "./tools/subagents.js";
|
|
48
|
+
import { registerGrantTools } from "./tools/grants.js";
|
|
49
|
+
import { registerRepositoryTools } from "./tools/repositories.js";
|
|
50
|
+
import { registerHostAccountTools } from "./tools/host-accounts.js";
|
|
26
51
|
import { registerMemoryTools } from "./tools/memory.js";
|
|
27
52
|
import { registerSecretsTools } from "./tools/secrets.js";
|
|
28
53
|
import { registerWebhookTools } from "./tools/webhooks.js";
|
|
@@ -45,17 +70,44 @@ async function warnIfNothingWillFireSchedules() {
|
|
|
45
70
|
}
|
|
46
71
|
/** Placeholder identifier for stdio, which has no HTTP endpoint to name. Never surfaced: stdio's fixed context always holds every scope, so no scope challenge is ever built against it. */
|
|
47
72
|
const STDIO_PLACEHOLDER_URI = "urn:wardby:local-stdio";
|
|
73
|
+
/**
|
|
74
|
+
* stdio's one fixed identity: the local operator (LOCAL_PRINCIPAL), trusted
|
|
75
|
+
* with every supported scope and every role — whoever can start the
|
|
76
|
+
* process already holds the database and its keys.
|
|
77
|
+
*/
|
|
78
|
+
export function localOperatorContext(principal, providers, db) {
|
|
79
|
+
return {
|
|
80
|
+
principal,
|
|
81
|
+
scopes: new Set(SCOPES_SUPPORTED),
|
|
82
|
+
roles: [...ROLE_NAMES],
|
|
83
|
+
// Full access to every resource (resource-sharing grants spec §3.9),
|
|
84
|
+
// but never past the binding rules.
|
|
85
|
+
operator: true,
|
|
86
|
+
canonicalUri: STDIO_PLACEHOLDER_URI,
|
|
87
|
+
providers,
|
|
88
|
+
db,
|
|
89
|
+
clientSupportsTasks: false,
|
|
90
|
+
// Placeholder — server.ts's resolveCtx overwrites this with the
|
|
91
|
+
// current call's real mcpReq on every dispatch.
|
|
92
|
+
mcpReq: { requestState: () => undefined },
|
|
93
|
+
};
|
|
94
|
+
}
|
|
48
95
|
/** Registers the full Phase 4 tool surface — every module, in one place. */
|
|
49
96
|
export function registerAllTools(mcp, opts) {
|
|
50
97
|
registerAgentTools(mcp);
|
|
98
|
+
registerServiceTools(mcp);
|
|
51
99
|
registerBudgetGroupTools(mcp);
|
|
52
100
|
registerModelTools(mcp);
|
|
101
|
+
registerHelpTools(mcp);
|
|
53
102
|
registerTriggerTool(mcp);
|
|
54
103
|
registerToolAuthoringTools(mcp);
|
|
55
104
|
registerSchedulingTools(mcp);
|
|
56
105
|
registerRunTools(mcp);
|
|
57
106
|
registerDatastoreTools(mcp);
|
|
58
107
|
registerSubAgentTools(mcp);
|
|
108
|
+
registerGrantTools(mcp);
|
|
109
|
+
registerRepositoryTools(mcp);
|
|
110
|
+
registerHostAccountTools(mcp);
|
|
59
111
|
registerMemoryTools(mcp);
|
|
60
112
|
registerSecretsTools(mcp, {
|
|
61
113
|
buildElicitationUrl: opts.secretElicitationUrl,
|
|
@@ -75,6 +127,11 @@ export function buildMcpProviders() {
|
|
|
75
127
|
const secrets = buildSecretCipher(providerConfig);
|
|
76
128
|
const datastore = new PostgresDatastore(prisma, secrets);
|
|
77
129
|
const memory = new PostgresAgentMemory(prisma);
|
|
130
|
+
const reviewHosts = buildReviewHosts();
|
|
131
|
+
const hostUserAuthorizers = buildHostUserAuthorizers();
|
|
132
|
+
// One gate (and one cache) for the whole process: set-time checks in the
|
|
133
|
+
// MCP tools, repo_* calls in native runs, coding runs, and host events.
|
|
134
|
+
const repoAccess = createRepoAccessGate({ db: prisma, hosts: reviewHosts });
|
|
78
135
|
// `nativeProviders` is passed by reference into buildExecutor, and native
|
|
79
136
|
// runs it drives read `this.providers.executor` at call time (not at
|
|
80
137
|
// construction time) — so patching `.executor` on afterward, once the
|
|
@@ -83,11 +140,13 @@ export function buildMcpProviders() {
|
|
|
83
140
|
// through the same composed executor everything else uses. There's no
|
|
84
141
|
// way to hand the native executor a reference to its own wrapping
|
|
85
142
|
// RoutingExecutor before that wrapper is constructed.
|
|
86
|
-
const nativeProviders = { llm, engine, datastore, secrets, memory };
|
|
143
|
+
const nativeProviders = { llm, engine, datastore, secrets, memory, reviewHosts, repoAccess };
|
|
87
144
|
const nativeExecutor = buildExecutor(providerConfig, nativeProviders, prisma);
|
|
88
|
-
const executor = buildConfiguredExecutor({ native: nativeExecutor, db: prisma, providerConfig });
|
|
145
|
+
const executor = buildConfiguredExecutor({ native: nativeExecutor, db: prisma, providerConfig, repoAccess });
|
|
89
146
|
nativeProviders.executor = executor;
|
|
90
|
-
return {
|
|
147
|
+
return {
|
|
148
|
+
providers: { llm, engine, datastore, secrets, executor, memory, reviewHosts, hostUserAuthorizers, repoAccess },
|
|
149
|
+
};
|
|
91
150
|
}
|
|
92
151
|
/** Awaits `promise` (if any), logging and swallowing a rejection instead of propagating it. */
|
|
93
152
|
async function closeQuietly(promise, what) {
|
|
@@ -101,6 +160,8 @@ async function closeQuietly(promise, what) {
|
|
|
101
160
|
/** The real CLI entry point: `wardby mcp`. Reads config from the environment, starts stdio or HTTP per MCP_TRANSPORT. */
|
|
102
161
|
export async function startMcp(options = {}) {
|
|
103
162
|
const mcpConfig = loadMcpConfig();
|
|
163
|
+
// Parsed up front so a malformed value fails at startup, not at shutdown.
|
|
164
|
+
const drainSeconds = loadShutdownDrainSeconds();
|
|
104
165
|
const providers = options.providers ?? buildMcpProviders().providers;
|
|
105
166
|
await providers.executor.launch?.();
|
|
106
167
|
if (!options.schedulerAttached)
|
|
@@ -120,17 +181,7 @@ export async function startMcp(options = {}) {
|
|
|
120
181
|
// local identity for the whole connection, per the design's own
|
|
121
182
|
// "stdio local mode: no token; the operator is trusted."
|
|
122
183
|
const principal = await resolvePrincipal(mcpConfig.localPrincipal, prisma);
|
|
123
|
-
mcp.setFixedContext(
|
|
124
|
-
principal,
|
|
125
|
-
scopes: new Set(SCOPES_SUPPORTED),
|
|
126
|
-
canonicalUri: STDIO_PLACEHOLDER_URI,
|
|
127
|
-
providers,
|
|
128
|
-
db: prisma,
|
|
129
|
-
clientSupportsTasks: false,
|
|
130
|
-
// Placeholder — server.ts's resolveCtx overwrites this with the
|
|
131
|
-
// current call's real mcpReq on every dispatch.
|
|
132
|
-
mcpReq: { requestState: () => undefined },
|
|
133
|
-
});
|
|
184
|
+
mcp.setFixedContext(localOperatorContext(principal, providers, prisma));
|
|
134
185
|
const stdio = runStdioServer(mcp);
|
|
135
186
|
return {
|
|
136
187
|
close: async () => {
|
|
@@ -159,6 +210,40 @@ export async function startMcp(options = {}) {
|
|
|
159
210
|
secretElicitationUrl: (token) => Promise.resolve(`${httpOrigin}${SECRET_ELICITATION_PATH}?t=${encodeURIComponent(token)}`),
|
|
160
211
|
secretElicitationProtocol: mcpConfig.secretElicitationProtocol,
|
|
161
212
|
});
|
|
213
|
+
const eventConfig = loadGitHubEventConfig();
|
|
214
|
+
const githubConfig = loadGitHubVcsConfig();
|
|
215
|
+
const reviewHosts = providers.reviewHosts;
|
|
216
|
+
const hostEvents = eventConfig.webhookSecret && reviewHosts?.github && githubConfig.appId && githubConfig.privateKey
|
|
217
|
+
? {
|
|
218
|
+
github: {
|
|
219
|
+
db: prisma,
|
|
220
|
+
executor: providers.executor,
|
|
221
|
+
hosts: reviewHosts,
|
|
222
|
+
repoAccess: providers.repoAccess ?? createRepoAccessGate({ db: prisma, hosts: reviewHosts }),
|
|
223
|
+
webhookSecret: eventConfig.webhookSecret,
|
|
224
|
+
appIdentity: (() => {
|
|
225
|
+
const client = new GitHubAppClient({
|
|
226
|
+
appId: githubConfig.appId,
|
|
227
|
+
privateKey: githubConfig.privateKey,
|
|
228
|
+
apiVersion: githubConfig.apiVersion,
|
|
229
|
+
});
|
|
230
|
+
return () => client.appIdentity();
|
|
231
|
+
})(),
|
|
232
|
+
},
|
|
233
|
+
}
|
|
234
|
+
: undefined;
|
|
235
|
+
mcpLog.info({ enabled: Boolean(hostEvents) }, "GitHub host events ingress");
|
|
236
|
+
const githubAuthorizer = providers.hostUserAuthorizers?.github;
|
|
237
|
+
const hostUserAuth = githubAuthorizer
|
|
238
|
+
? {
|
|
239
|
+
github: {
|
|
240
|
+
db: prisma,
|
|
241
|
+
authorizer: githubAuthorizer,
|
|
242
|
+
redirectUri: `${httpOrigin}${userCallbackPath("github")}`,
|
|
243
|
+
},
|
|
244
|
+
}
|
|
245
|
+
: undefined;
|
|
246
|
+
mcpLog.info({ enabled: Boolean(hostUserAuth) }, "GitHub account linking");
|
|
162
247
|
const http = await startHttpServer({
|
|
163
248
|
mcp,
|
|
164
249
|
config: {
|
|
@@ -170,6 +255,8 @@ export async function startMcp(options = {}) {
|
|
|
170
255
|
},
|
|
171
256
|
auth: { authProvider, db: prisma, providers },
|
|
172
257
|
selfHosted,
|
|
258
|
+
hostEvents,
|
|
259
|
+
hostUserAuth,
|
|
173
260
|
});
|
|
174
261
|
const cleanupTimer = selfHosted
|
|
175
262
|
? setInterval(() => {
|
|
@@ -181,6 +268,9 @@ export async function startMcp(options = {}) {
|
|
|
181
268
|
if (cleanupTimer)
|
|
182
269
|
clearInterval(cleanupTimer);
|
|
183
270
|
await closeQuietly(http.close(), "HTTP transport close");
|
|
271
|
+
// Let the runs this instance is executing finish before the executor
|
|
272
|
+
// closes under them; a run abandoned here is lost, never resumed.
|
|
273
|
+
await waitForInFlightRuns(drainSeconds * 1000);
|
|
184
274
|
await closeQuietly(providers.executor.close?.(), "executor close");
|
|
185
275
|
},
|
|
186
276
|
};
|
package/dist/mcp/server.js
CHANGED
|
@@ -25,9 +25,10 @@
|
|
|
25
25
|
import { McpServer, fromJsonSchema, createRequestStateCodec, CLIENT_CAPABILITIES_META_KEY, } from "@modelcontextprotocol/server";
|
|
26
26
|
import { randomBytes } from "node:crypto";
|
|
27
27
|
import { requireScope } from "./auth/resource-server.js";
|
|
28
|
-
import { McpError } from "./errors.js";
|
|
28
|
+
import { McpError, mapPrismaError } from "./errors.js";
|
|
29
29
|
import { TASKS_EXTENSION_ID, clientSupportsTasks } from "./capabilities.js";
|
|
30
|
-
import {
|
|
30
|
+
import { readableAgentsWhere } from "./auth/access.js";
|
|
31
|
+
import { grantedIds } from "../core/grants.js";
|
|
31
32
|
import { logger } from "../core/logger.js";
|
|
32
33
|
const REQUEST_STATE_KEY_BYTES = 32;
|
|
33
34
|
/**
|
|
@@ -97,6 +98,7 @@ export function buildMcpServer(opts) {
|
|
|
97
98
|
return {
|
|
98
99
|
principal: extra.principal,
|
|
99
100
|
scopes: new Set(authInfo.scopes),
|
|
101
|
+
roles: extra.roles ?? [],
|
|
100
102
|
canonicalUri: opts.config.canonicalUri,
|
|
101
103
|
providers: opts.providers,
|
|
102
104
|
db: opts.db,
|
|
@@ -130,7 +132,14 @@ export function buildMcpServer(opts) {
|
|
|
130
132
|
}, async (args, sdkCtx) => {
|
|
131
133
|
const ctx = resolveCtx(sdkCtx);
|
|
132
134
|
requireScope(ctx, opts.config.canonicalUri, ...requiredScopes);
|
|
133
|
-
|
|
135
|
+
try {
|
|
136
|
+
return await spec.handler(args, ctx);
|
|
137
|
+
}
|
|
138
|
+
catch (err) {
|
|
139
|
+
// A raw Prisma error would reach the client verbatim (the SDK
|
|
140
|
+
// renders any thrown error's message) -- see mapPrismaError.
|
|
141
|
+
throw mapPrismaError(err);
|
|
142
|
+
}
|
|
134
143
|
});
|
|
135
144
|
}
|
|
136
145
|
// Non-spec (extension) methods need a { params, result } schema bundle
|
|
@@ -143,7 +152,12 @@ export function buildMcpServer(opts) {
|
|
|
143
152
|
mcpServer.server.setRequestHandler(method, { params: PERMISSIVE_SCHEMA }, async (params, sdkCtx) => {
|
|
144
153
|
const ctx = resolveCtx(sdkCtx);
|
|
145
154
|
requireScope(ctx, opts.config.canonicalUri, ...scope);
|
|
146
|
-
|
|
155
|
+
try {
|
|
156
|
+
return (await handler(params, ctx));
|
|
157
|
+
}
|
|
158
|
+
catch (err) {
|
|
159
|
+
throw mapPrismaError(err);
|
|
160
|
+
}
|
|
147
161
|
});
|
|
148
162
|
}
|
|
149
163
|
// One MCP prompt per Agent this connection can see, so a client that
|
|
@@ -154,12 +168,16 @@ export function buildMcpServer(opts) {
|
|
|
154
168
|
// resolves it per-dispatch from the SDK's own per-call ServerContext,
|
|
155
169
|
// not at factory time) — stdio's fixedContext IS set by now
|
|
156
170
|
// (mcp/index.ts calls setFixedContext before serveStdio ever invokes
|
|
157
|
-
// this factory), so stdio sees every agent it
|
|
158
|
-
// HTTP conservatively falls back to
|
|
159
|
-
//
|
|
160
|
-
//
|
|
171
|
+
// this factory), so stdio sees every agent it can read;
|
|
172
|
+
// HTTP conservatively falls back to agents shared with everyone (a
|
|
173
|
+
// grant of at least read) until this factory can see request-scoped
|
|
174
|
+
// identity; stdio sees what its principal can read (the operator: all).
|
|
175
|
+
// A DB hiccup here must not break tool registration — this is a
|
|
176
|
+
// discoverability nicety, not core function.
|
|
161
177
|
try {
|
|
162
|
-
const where = fixedContext
|
|
178
|
+
const where = fixedContext
|
|
179
|
+
? await readableAgentsWhere(fixedContext, opts.db)
|
|
180
|
+
: { id: { in: await grantedIds(opts.db, "agent", null, "read") } };
|
|
163
181
|
const agents = await opts.db.agent.findMany({ where });
|
|
164
182
|
for (const agent of agents) {
|
|
165
183
|
mcpServer.registerPrompt(agent.name, {
|