@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/prisma/schema.prisma
CHANGED
|
@@ -42,12 +42,16 @@ model Agent {
|
|
|
42
42
|
tools AgentTool[]
|
|
43
43
|
maxTurns Int @default(10)
|
|
44
44
|
|
|
45
|
-
// Phase 4: ownership. Null =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
// Phase 4: ownership. Null = owner-less, a transition state only: access
|
|
46
|
+
// then comes from ResourceGrant rows alone (the migration gives everyone
|
|
47
|
+
// execute), and `wardby grants adopt-public` assigns an owner. See
|
|
48
|
+
// ResourceGrant.
|
|
49
|
+
ownerId String?
|
|
50
|
+
owner Principal? @relation(fields: [ownerId], references: [id])
|
|
51
|
+
secrets AgentSecret[]
|
|
52
|
+
datastores AgentDatastore[]
|
|
53
|
+
webhooks Webhook[]
|
|
54
|
+
repositories AgentRepository[]
|
|
51
55
|
|
|
52
56
|
// Phase 7: at most one budget group. Null = uncapped beyond its own budgetUsd.
|
|
53
57
|
budgetGroupId String?
|
|
@@ -59,6 +63,11 @@ model Agent {
|
|
|
59
63
|
/// created for it.
|
|
60
64
|
memoryEnabled Boolean @default(false)
|
|
61
65
|
|
|
66
|
+
/// Un-phased: reasoning effort for native agents (low, medium, high,
|
|
67
|
+
/// xhigh, max). Validated against the model in code, not a DB enum.
|
|
68
|
+
/// Null = the provider's default.
|
|
69
|
+
effort String?
|
|
70
|
+
|
|
62
71
|
/// Un-phased: sub-agent composition edges (see AgentSubAgent below). An
|
|
63
72
|
/// agent can be a parent (has children it can delegate to) and/or a
|
|
64
73
|
/// child (is delegated to by others) independently.
|
|
@@ -134,7 +143,11 @@ enum RunStatus {
|
|
|
134
143
|
/// Phase 3: a WASM-sandboxed, Zod-validated tool a model can call.
|
|
135
144
|
model Tool {
|
|
136
145
|
id String @id @default(cuid())
|
|
137
|
-
name
|
|
146
|
+
/// Unique per owner (@@unique below), not globally: the name is what the
|
|
147
|
+
/// model calls, so what must never repeat is a name within one agent's
|
|
148
|
+
/// attachments — attach_tool, `wardby tool attach` and the importer refuse
|
|
149
|
+
/// a second same-named tool on an agent.
|
|
150
|
+
name String
|
|
138
151
|
description String
|
|
139
152
|
/// Zod schema *source text*; compiled and evaluated inside the sandbox,
|
|
140
153
|
/// never in the host process.
|
|
@@ -143,7 +156,8 @@ model Tool {
|
|
|
143
156
|
/// and cached here — re-deriving it on every run would spin a fresh QuickJS
|
|
144
157
|
/// runtime and evaluate the whole vendored zod bundle per attached tool,
|
|
145
158
|
/// before the first LLM call, on every single run. Safe to cache because
|
|
146
|
-
///
|
|
159
|
+
/// every write of paramsZod (create, and MCP update_tool) re-derives it in
|
|
160
|
+
/// the same write. A run pins the version its load step read.
|
|
147
161
|
jsonSchema Json
|
|
148
162
|
/// Tool body source; run inside the sandbox with the validated params.
|
|
149
163
|
code String
|
|
@@ -151,9 +165,12 @@ model Tool {
|
|
|
151
165
|
updatedAt DateTime @updatedAt
|
|
152
166
|
agents AgentTool[]
|
|
153
167
|
|
|
154
|
-
// Phase 4: ownership. Null =
|
|
168
|
+
// Phase 4: ownership. Null = owner-less (a transition state; tool grants
|
|
169
|
+
// arrive in the resource-sharing grants Phase 2, see ResourceGrant).
|
|
155
170
|
ownerId String?
|
|
156
171
|
owner Principal? @relation(fields: [ownerId], references: [id])
|
|
172
|
+
|
|
173
|
+
@@unique([ownerId, name])
|
|
157
174
|
}
|
|
158
175
|
|
|
159
176
|
/// Phase 3: explicit many-to-many join between Agent and Tool.
|
|
@@ -175,6 +192,17 @@ model AgentTool {
|
|
|
175
192
|
allowedHosts Json @default("[]")
|
|
176
193
|
allowedSharedDatastorePrefixes Json @default("{}")
|
|
177
194
|
|
|
195
|
+
/// Who created the attachment. Audit only: plain text, no FK (same
|
|
196
|
+
/// convention as AgentRepository.authorizedById).
|
|
197
|
+
attachedById String?
|
|
198
|
+
/// The principal whose consent the four capability fields above carry.
|
|
199
|
+
/// The runner honours them only while this equals the agent's CURRENT
|
|
200
|
+
/// ownerId (resource-sharing grants spec §3.4.2): a write-grantee's
|
|
201
|
+
/// attachment, a make_owner transfer, or a pre-grants row nobody vouched
|
|
202
|
+
/// for runs with no secrets, no datastore and no fetch until the owner
|
|
203
|
+
/// re-grants with attach_tool. Plain text, no FK.
|
|
204
|
+
capabilitiesGrantedById String?
|
|
205
|
+
|
|
178
206
|
@@id([agentId, toolId])
|
|
179
207
|
}
|
|
180
208
|
|
|
@@ -270,19 +298,20 @@ enum RunTrigger {
|
|
|
270
298
|
scheduled
|
|
271
299
|
webhook
|
|
272
300
|
subagent
|
|
301
|
+
host_event
|
|
273
302
|
}
|
|
274
303
|
|
|
275
304
|
model Run {
|
|
276
|
-
id String
|
|
277
|
-
agent Agent
|
|
305
|
+
id String @id @default(cuid())
|
|
306
|
+
agent Agent @relation(fields: [agentId], references: [id])
|
|
278
307
|
agentId String
|
|
279
|
-
status RunStatus
|
|
280
|
-
trigger RunTrigger
|
|
281
|
-
tokensIn Int
|
|
282
|
-
tokensOut Int
|
|
283
|
-
costUsd Decimal
|
|
308
|
+
status RunStatus @default(pending)
|
|
309
|
+
trigger RunTrigger @default(manual)
|
|
310
|
+
tokensIn Int @default(0)
|
|
311
|
+
tokensOut Int @default(0)
|
|
312
|
+
costUsd Decimal @default(0) @db.Decimal(10, 6)
|
|
284
313
|
error String?
|
|
285
|
-
startedAt DateTime
|
|
314
|
+
startedAt DateTime @default(now())
|
|
286
315
|
finishedAt DateTime?
|
|
287
316
|
/// Phase 2: beaten by the executor while running; a stale value past
|
|
288
317
|
/// HEARTBEAT_TIMEOUT is how the reconciler finds an orphaned run.
|
|
@@ -295,15 +324,17 @@ model Run {
|
|
|
295
324
|
/// Phase 4: EngineResult.turns, persisted for the same reason as
|
|
296
325
|
/// finalText — MCP's list_runs/get_run need it and it was previously
|
|
297
326
|
/// dropped after the engine returned.
|
|
298
|
-
turns Int
|
|
327
|
+
turns Int @default(0)
|
|
299
328
|
/// Detached executors are recovered by handle rather than inferred from trigger.
|
|
300
|
-
executionManaged Boolean
|
|
329
|
+
executionManaged Boolean @default(false)
|
|
301
330
|
/// Phase 6: which durable executor backend holds this run, if any
|
|
302
331
|
/// ("dbos" = a DBOS workflow whose id equals this run's id). Null for
|
|
303
332
|
/// in-process runs. The reconciler consults the backend before declaring a
|
|
304
333
|
/// stale run lost, and can adopt one orphaned by a dead instance.
|
|
305
334
|
executionBackend String?
|
|
306
335
|
codingRun CodingRun?
|
|
336
|
+
hostCheck RunHostCheck?
|
|
337
|
+
hostStatus RunHostStatus?
|
|
307
338
|
|
|
308
339
|
/// Un-phased: sub-agent dispatch (see AgentSubAgent). Null for a
|
|
309
340
|
/// top-level run; set when this run was created by a parent run's
|
|
@@ -326,6 +357,14 @@ model Run {
|
|
|
326
357
|
/// loaded systemPrompt at run time so the stable prefix stays
|
|
327
358
|
/// prompt-cache-eligible across dispatches.
|
|
328
359
|
taskOverride String?
|
|
360
|
+
/// The principal the run is visible to besides the agent's owner
|
|
361
|
+
/// (resource-sharing grants spec §3.5): the trigger_agent caller, a
|
|
362
|
+
/// webhook's creator, or a sub-agent's parent run's triggerer. Null for
|
|
363
|
+
/// scheduled, host-event and CLI runs, which only the owner sees. Plain
|
|
364
|
+
/// text, no FK.
|
|
365
|
+
triggeredById String?
|
|
366
|
+
|
|
367
|
+
@@index([agentId, triggeredById])
|
|
329
368
|
}
|
|
330
369
|
|
|
331
370
|
/// Phase 5: owner-configured coding behavior. Runtime credentials and opaque
|
|
@@ -339,13 +378,31 @@ model CodingAgentProfile {
|
|
|
339
378
|
defaultTask String?
|
|
340
379
|
allowWebhookTaskOverride Boolean @default(false)
|
|
341
380
|
timeoutSec Int @default(1800)
|
|
342
|
-
|
|
381
|
+
/// Unused; dropped after rollout (see the package-registry plan, Task 14).
|
|
382
|
+
allowedEgress Json @default("[]")
|
|
343
383
|
protectedPaths Json
|
|
384
|
+
collectExclude Json @default("[]")
|
|
344
385
|
toolchain String @default("node")
|
|
345
386
|
toolchainVersion String?
|
|
346
387
|
workerImageRef String?
|
|
347
388
|
/// Per-agent workspace size in MiB; null = CODING_DISK_MB.
|
|
348
389
|
workspaceDiskMb Int?
|
|
390
|
+
packageAllowlist Json @default("{}")
|
|
391
|
+
packagePolicy Json @default("{}")
|
|
392
|
+
/// Admin-requested debug trace: while now < debugTraceUntil, every coding
|
|
393
|
+
/// run of this agent is dispatched with CodingRun.debugTrace set. Null = off.
|
|
394
|
+
debugTraceUntil DateTime?
|
|
395
|
+
/// Coding-run services (docs/coding-services.md): the catalog names
|
|
396
|
+
/// (CodingService.name) this agent's runs may start, any version the catalog
|
|
397
|
+
/// has. Empty = none. Owner-set through update_agent.
|
|
398
|
+
services Json @default("[]")
|
|
399
|
+
|
|
400
|
+
/// How `repository` was authorized for this agent (see AgentRepository.authorizedVia):
|
|
401
|
+
/// "host_permission", "admin", or "grandfathered". Null = never authorized; runs are refused.
|
|
402
|
+
repositoryAuthorizedVia String?
|
|
403
|
+
/// The principal whose GitHub access (or admin approval) authorized it. Audit only, no FK.
|
|
404
|
+
repositoryAuthorizedById String?
|
|
405
|
+
repositoryAuthorizedAt DateTime?
|
|
349
406
|
}
|
|
350
407
|
|
|
351
408
|
/// Phase 5: immutable dispatch inputs plus opaque execution/result state for
|
|
@@ -360,8 +417,10 @@ model CodingRun {
|
|
|
360
417
|
provider String
|
|
361
418
|
model String
|
|
362
419
|
timeoutSec Int
|
|
363
|
-
|
|
420
|
+
/// Unused; dropped after rollout (see the package-registry plan, Task 14).
|
|
421
|
+
allowedEgress Json @default("[]")
|
|
364
422
|
protectedPaths Json
|
|
423
|
+
collectExclude Json @default("[]")
|
|
365
424
|
jobBackend String?
|
|
366
425
|
jobHandle String?
|
|
367
426
|
result Json?
|
|
@@ -371,6 +430,8 @@ model CodingRun {
|
|
|
371
430
|
failureCategory String?
|
|
372
431
|
diagnosticId String?
|
|
373
432
|
workerImage String?
|
|
433
|
+
/// Claude Code's tool-runner image, resolved from the agent's toolchain at dispatch; null for Codex runs.
|
|
434
|
+
toolImage String?
|
|
374
435
|
budgetReservedUsd Decimal @db.Decimal(10, 6)
|
|
375
436
|
/// Phase 12 concurrency queue: set when start() found every coding slot
|
|
376
437
|
/// taken (CODING_MAX_CONCURRENT), cleared when the run claims a slot. A
|
|
@@ -378,6 +439,15 @@ model CodingRun {
|
|
|
378
439
|
queuedAt DateTime?
|
|
379
440
|
/// Per-agent workspace size in MiB; null = CODING_DISK_MB.
|
|
380
441
|
workspaceDiskMb Int?
|
|
442
|
+
packageAllowlist Json @default("{}")
|
|
443
|
+
packagePolicy Json @default("{}")
|
|
444
|
+
/// Fixed at dispatch from the profile's debugTraceUntil: the worker writes a
|
|
445
|
+
/// full stream trace to its own pod log (never to the database).
|
|
446
|
+
debugTrace Boolean @default(false)
|
|
447
|
+
/// Coding-run services resolved at dispatch from the base branch's
|
|
448
|
+
/// .wardby/services.yaml: one snapshot per service (the catalog entry minus
|
|
449
|
+
/// kind), fixed for the run's lifetime. Empty = none.
|
|
450
|
+
services Json @default("[]")
|
|
381
451
|
createdAt DateTime @default(now())
|
|
382
452
|
updatedAt DateTime @updatedAt
|
|
383
453
|
proxySession CodingProxySession?
|
|
@@ -392,12 +462,53 @@ model CodingRun {
|
|
|
392
462
|
rootCodingRun CodingRun? @relation("CodingRunContinuation", fields: [rootCodingRunId], references: [runId])
|
|
393
463
|
continuations CodingRun[] @relation("CodingRunContinuation")
|
|
394
464
|
|
|
465
|
+
registryAllowances RegistryAllowance[]
|
|
466
|
+
registryFetches RegistryFetch[]
|
|
467
|
+
registryApprovedVersions RegistryApprovedVersion[]
|
|
468
|
+
registryPlanRefusals RegistryPlanRefusal[]
|
|
469
|
+
|
|
395
470
|
@@index([jobBackend, jobHandle])
|
|
396
471
|
@@index([failureCategory])
|
|
397
472
|
@@index([queuedAt])
|
|
398
473
|
@@index([rootCodingRunId])
|
|
399
474
|
}
|
|
400
475
|
|
|
476
|
+
/// Coding-run services (docs/coding-services.md): the catalog a repository's
|
|
477
|
+
/// .wardby/services.yaml names entries from. Admin-managed over MCP
|
|
478
|
+
/// (list/get_service: agents:read; create/update/delete_service:
|
|
479
|
+
/// services:manage, audit-logged).
|
|
480
|
+
/// Built-in rows ship with wardby, seeded by migration, and change only with a
|
|
481
|
+
/// wardby release. `kind` is "sidecar" (a fresh instance in each run's pod);
|
|
482
|
+
/// "external" is reserved.
|
|
483
|
+
model CodingService {
|
|
484
|
+
id String @id @default(cuid())
|
|
485
|
+
name String
|
|
486
|
+
version String
|
|
487
|
+
kind String @default("sidecar")
|
|
488
|
+
/// Digest-pinned image reference (repo@sha256:...).
|
|
489
|
+
image String
|
|
490
|
+
port Int
|
|
491
|
+
/// Environment for the service container itself: throwaway per-run values, never secrets.
|
|
492
|
+
serviceEnv Json @default("{}")
|
|
493
|
+
/// Variables the agent's shells receive (DATABASE_URL, PG*, REDIS_URL, ...).
|
|
494
|
+
testEnv Json @default("{}")
|
|
495
|
+
/// { command, periodSeconds, timeoutSeconds, failureThreshold }: the sidecar's startup probe.
|
|
496
|
+
readiness Json
|
|
497
|
+
/// { cpuMillicores, memoryMib, diskMib }: requests equal limits.
|
|
498
|
+
resources Json
|
|
499
|
+
/// Where the service writes its data: an emptyDir in the run pod.
|
|
500
|
+
dataPath String
|
|
501
|
+
/// Further directories the image writes to (socket directory, /tmp): each an emptyDir.
|
|
502
|
+
writablePaths Json @default("[]")
|
|
503
|
+
builtin Boolean @default(false)
|
|
504
|
+
/// The admin who created it. Audit only, no FK; null for built-ins.
|
|
505
|
+
createdById String?
|
|
506
|
+
createdAt DateTime @default(now())
|
|
507
|
+
updatedAt DateTime @updatedAt
|
|
508
|
+
|
|
509
|
+
@@unique([name, version])
|
|
510
|
+
}
|
|
511
|
+
|
|
401
512
|
enum CodingProxySessionStatus {
|
|
402
513
|
active
|
|
403
514
|
cancelled
|
|
@@ -426,6 +537,16 @@ model CodingProxySession {
|
|
|
426
537
|
createdAt DateTime @default(now())
|
|
427
538
|
updatedAt DateTime @updatedAt
|
|
428
539
|
requests CodingProxyRequest[]
|
|
540
|
+
/// Hash of the derived registry-only token (see deriveRegistryToken); the
|
|
541
|
+
/// token itself is never persisted.
|
|
542
|
+
registryTokenHash String? @unique
|
|
543
|
+
/// Set the first time the proxy refuses a request of this session for
|
|
544
|
+
/// budget; lets the executor report the run as out of budget.
|
|
545
|
+
budgetExhaustedAt DateTime?
|
|
546
|
+
/// The upstream error code (a fixed identifier, never a message) of the
|
|
547
|
+
/// first provider failure the proxy relayed for this session; lets the
|
|
548
|
+
/// executor say the model provider refused the run.
|
|
549
|
+
upstreamFailure String?
|
|
429
550
|
|
|
430
551
|
@@index([deadlineAt])
|
|
431
552
|
}
|
|
@@ -458,6 +579,96 @@ model CodingProxyRequest {
|
|
|
458
579
|
@@index([sessionId, status])
|
|
459
580
|
}
|
|
460
581
|
|
|
582
|
+
enum RegistryFetchOutcome {
|
|
583
|
+
served
|
|
584
|
+
refused
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/// One package a run's profile has approved from a given ecosystem, resolved
|
|
588
|
+
/// once at dispatch (see CodingRun.packageAllowlist) and used to gate every
|
|
589
|
+
/// proxy fetch for the run's lifetime.
|
|
590
|
+
model RegistryAllowance {
|
|
591
|
+
runId String
|
|
592
|
+
ecosystem String
|
|
593
|
+
name String
|
|
594
|
+
createdAt DateTime @default(now())
|
|
595
|
+
run CodingRun @relation(fields: [runId], references: [runId], onDelete: Cascade)
|
|
596
|
+
|
|
597
|
+
@@id([runId, ecosystem, name])
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/// Audit ledger of every package fetch the registry proxy served or refused
|
|
601
|
+
/// for a run.
|
|
602
|
+
model RegistryFetch {
|
|
603
|
+
id String @id @default(cuid())
|
|
604
|
+
runId String
|
|
605
|
+
ecosystem String
|
|
606
|
+
name String
|
|
607
|
+
version String?
|
|
608
|
+
filename String?
|
|
609
|
+
integrity String?
|
|
610
|
+
sizeBytes Int?
|
|
611
|
+
outcome RegistryFetchOutcome
|
|
612
|
+
reason String?
|
|
613
|
+
createdAt DateTime @default(now())
|
|
614
|
+
run CodingRun @relation(fields: [runId], references: [runId], onDelete: Cascade)
|
|
615
|
+
|
|
616
|
+
@@index([runId, createdAt])
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/// Immutable facts about one published package version, read from the
|
|
620
|
+
/// registry itself (never from a lockfile) by lockfile verification: its
|
|
621
|
+
/// publish time, integrity, download URL and declared dependencies
|
|
622
|
+
/// ([{ key, name, range }], aliases resolved). Stored once and reused
|
|
623
|
+
/// forever; allow/deny decisions are never cached here.
|
|
624
|
+
model RegistryVersionFact {
|
|
625
|
+
ecosystem String
|
|
626
|
+
name String
|
|
627
|
+
version String
|
|
628
|
+
publishedAt DateTime
|
|
629
|
+
integrity String
|
|
630
|
+
downloadUrl String
|
|
631
|
+
dependencies Json
|
|
632
|
+
createdAt DateTime @default(now())
|
|
633
|
+
|
|
634
|
+
@@id([ecosystem, name, version])
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/// One exact package version a run's lockfile plan (POST
|
|
638
|
+
/// /registry/<ecosystem>/-/plan) verified and approved: a download of it is
|
|
639
|
+
/// served directly, integrity-checked against this value.
|
|
640
|
+
model RegistryApprovedVersion {
|
|
641
|
+
runId String
|
|
642
|
+
ecosystem String
|
|
643
|
+
name String
|
|
644
|
+
version String
|
|
645
|
+
integrity String
|
|
646
|
+
createdAt DateTime @default(now())
|
|
647
|
+
run CodingRun @relation(fields: [runId], references: [runId], onDelete: Cascade)
|
|
648
|
+
|
|
649
|
+
@@id([runId, ecosystem, name, version])
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/// One exact package version a run's lockfile plan refused for a reason
|
|
653
|
+
/// intrinsic to the registry's name@version (too new, an advisory, not
|
|
654
|
+
/// published, no integrity, hosted elsewhere): a download of it is answered
|
|
655
|
+
/// from here with the same code and reason, without a graph walk.
|
|
656
|
+
model RegistryPlanRefusal {
|
|
657
|
+
runId String
|
|
658
|
+
ecosystem String
|
|
659
|
+
name String
|
|
660
|
+
version String
|
|
661
|
+
code String
|
|
662
|
+
reason String
|
|
663
|
+
/// Set for a too-new refusal: the answer re-checks the version's age
|
|
664
|
+
/// against the run's cutoff at answer time, so the refusal lapses.
|
|
665
|
+
publishedAt DateTime?
|
|
666
|
+
createdAt DateTime @default(now())
|
|
667
|
+
run CodingRun @relation(fields: [runId], references: [runId], onDelete: Cascade)
|
|
668
|
+
|
|
669
|
+
@@id([runId, ecosystem, name, version])
|
|
670
|
+
}
|
|
671
|
+
|
|
461
672
|
/// Phase 2: single-row-per-scope lease so exactly one scheduler process
|
|
462
673
|
/// ticks at a time. `holder` is a process instance id (crypto.randomUUID()).
|
|
463
674
|
model SchedulerLease {
|
|
@@ -481,6 +692,46 @@ model Principal {
|
|
|
481
692
|
webhooks Webhook[]
|
|
482
693
|
authUser AuthUser?
|
|
483
694
|
budgetGroups BudgetGroup[]
|
|
695
|
+
|
|
696
|
+
hostIdentities HostIdentity[]
|
|
697
|
+
hostIdentityLinkRequests HostIdentityLinkRequest[]
|
|
698
|
+
grants ResourceGrant[]
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/// Explicit sharing of one resource with one grantee (docs/private/
|
|
702
|
+
/// 2026-09-26-resource-sharing-grants-spec-and-plan.md). Polymorphic on
|
|
703
|
+
/// (resourceType, resourceId) -- no FK to the resource, so every resource
|
|
704
|
+
/// delete path removes its grants in the same transaction. Levels are
|
|
705
|
+
/// ordered per type and validated in code (core/grants.ts), like
|
|
706
|
+
/// AgentRepository.provider, so a new type or level needs no enum migration.
|
|
707
|
+
model ResourceGrant {
|
|
708
|
+
id String @id @default(cuid())
|
|
709
|
+
/// "agent" | "tool" | "budget_group" (later "secret" | "datastore").
|
|
710
|
+
resourceType String
|
|
711
|
+
resourceId String
|
|
712
|
+
/// "principal" | "everyone" (later "group").
|
|
713
|
+
granteeKind String
|
|
714
|
+
granteePrincipalId String?
|
|
715
|
+
granteePrincipal Principal? @relation(fields: [granteePrincipalId], references: [id], onDelete: Cascade)
|
|
716
|
+
/// Normalised grantee identity for uniqueness: "principal:<id>", "everyone"
|
|
717
|
+
/// (later "group:<id>"). Needed because NULL granteePrincipalId values are
|
|
718
|
+
/// distinct in a unique index. Shape enforced by a hand-written CHECK
|
|
719
|
+
/// (ResourceGrant_grantee_shape, not representable here).
|
|
720
|
+
granteeKey String
|
|
721
|
+
/// Per-type ordered level (core/grants.ts LEVELS).
|
|
722
|
+
level String
|
|
723
|
+
/// "owner" (grant_access), "migration_public", "implied_attachment",
|
|
724
|
+
/// "import", "operator". Audit only.
|
|
725
|
+
source String @default("owner")
|
|
726
|
+
/// Principal who created/last changed it. Audit only: plain text, no FK
|
|
727
|
+
/// (same convention as AgentRepository.authorizedById).
|
|
728
|
+
grantedById String?
|
|
729
|
+
createdAt DateTime @default(now())
|
|
730
|
+
updatedAt DateTime @updatedAt
|
|
731
|
+
|
|
732
|
+
@@unique([resourceType, resourceId, granteeKey])
|
|
733
|
+
@@index([granteeKey, resourceType])
|
|
734
|
+
@@index([granteePrincipalId])
|
|
484
735
|
}
|
|
485
736
|
|
|
486
737
|
/// Phase 4: durable handle backing both a triggered run and (reserved,
|
|
@@ -619,6 +870,11 @@ model AuthUser {
|
|
|
619
870
|
principal Principal @relation(fields: [principalId], references: [id])
|
|
620
871
|
displayName String?
|
|
621
872
|
status String @default("enabled")
|
|
873
|
+
/// wardby roles (src/mcp/auth/resource-server.ts ROLE_PERMISSIONS: admin,
|
|
874
|
+
/// package-approver, service-manager), set with `wardby auth user grant`. Empty = member.
|
|
875
|
+
/// A privileged operation needs its scope on the token AND a role here
|
|
876
|
+
/// that grants it; unknown values grant nothing.
|
|
877
|
+
roles String[] @default([])
|
|
622
878
|
createdAt DateTime @default(now())
|
|
623
879
|
updatedAt DateTime @updatedAt
|
|
624
880
|
loginKeys AuthLoginKey[]
|
|
@@ -729,3 +985,133 @@ model AuthRateLimit {
|
|
|
729
985
|
|
|
730
986
|
@@index([expiresAt])
|
|
731
987
|
}
|
|
988
|
+
|
|
989
|
+
/// Which repositories on which code-review host a native agent may act on,
|
|
990
|
+
/// and which host events trigger it. See
|
|
991
|
+
/// docs/private/2026-09-25-code-review-host-design.md §4.1.
|
|
992
|
+
model AgentRepository {
|
|
993
|
+
id String @id @default(cuid())
|
|
994
|
+
agentId String
|
|
995
|
+
agent Agent @relation(fields: [agentId], references: [id], onDelete: Cascade)
|
|
996
|
+
/// "github" today; validated in code so adding a host needs no enum migration.
|
|
997
|
+
provider String
|
|
998
|
+
/// Canonical lower-case owner/name for the provider.
|
|
999
|
+
repository String
|
|
1000
|
+
/// "read" or "write".
|
|
1001
|
+
access String
|
|
1002
|
+
/// Subset of "pull_request", "mention".
|
|
1003
|
+
triggers String[] @default([])
|
|
1004
|
+
/// Only with the "pull_request" trigger (required there); names the agent's
|
|
1005
|
+
/// check. Unique per repository across all links (NULLs are distinct).
|
|
1006
|
+
checkName String?
|
|
1007
|
+
createdAt DateTime @default(now())
|
|
1008
|
+
|
|
1009
|
+
/// How this link was authorized: "host_permission" (the agent owner's
|
|
1010
|
+
/// verified host identity had enough access), "admin" (a wardby admin
|
|
1011
|
+
/// approved it explicitly), or "grandfathered" (existed before
|
|
1012
|
+
/// authorization was enforced). Null = never authorized; use is refused.
|
|
1013
|
+
authorizedVia String?
|
|
1014
|
+
/// The principal who authorized it. Audit only: plain text, no FK.
|
|
1015
|
+
authorizedById String?
|
|
1016
|
+
authorizedAt DateTime?
|
|
1017
|
+
|
|
1018
|
+
@@unique([agentId, provider, repository])
|
|
1019
|
+
@@unique([provider, repository, checkName])
|
|
1020
|
+
@@index([provider, repository])
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
/// The host check a run owns, so the review tool can complete it and the
|
|
1024
|
+
/// run finalizer can close it if the run ends without publishing.
|
|
1025
|
+
model RunHostCheck {
|
|
1026
|
+
runId String @id
|
|
1027
|
+
run Run @relation(fields: [runId], references: [id], onDelete: Cascade)
|
|
1028
|
+
provider String
|
|
1029
|
+
repository String
|
|
1030
|
+
checkId String
|
|
1031
|
+
headSha String
|
|
1032
|
+
/// The pull request the run was dispatched for. The review tool only
|
|
1033
|
+
/// completes or creates a check for this PR. Null on rows written before it
|
|
1034
|
+
/// existed: such a run publishes without a check.
|
|
1035
|
+
prNumber Int?
|
|
1036
|
+
completedAt DateTime?
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
/// De-duplicates host webhook redeliveries; pruned after 7 days.
|
|
1040
|
+
/// The status comment wardby posts on the issue or pull request whose
|
|
1041
|
+
/// @-mention started this run ("working on it"), edited with the outcome
|
|
1042
|
+
/// when the run ends. One per mention run.
|
|
1043
|
+
model RunHostStatus {
|
|
1044
|
+
runId String @id
|
|
1045
|
+
run Run @relation(fields: [runId], references: [id], onDelete: Cascade)
|
|
1046
|
+
provider String
|
|
1047
|
+
repository String
|
|
1048
|
+
/// The issue or pull request number the comment is on.
|
|
1049
|
+
number Int
|
|
1050
|
+
/// "conversation" (issue/PR comment) or "inline" (a reply in a review thread).
|
|
1051
|
+
commentKind String
|
|
1052
|
+
/// Null until the "working on it" comment is posted. The row is written
|
|
1053
|
+
/// with the run, so a run that dies before the comment exists still gets
|
|
1054
|
+
/// an outcome comment (from the reconciler).
|
|
1055
|
+
commentId String?
|
|
1056
|
+
/// For an inline mention: the review comment to reply to when the outcome
|
|
1057
|
+
/// has to be posted as a new comment.
|
|
1058
|
+
replyToReviewCommentId String?
|
|
1059
|
+
createdAt DateTime @default(now())
|
|
1060
|
+
completedAt DateTime?
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
model HostEventDelivery {
|
|
1064
|
+
provider String
|
|
1065
|
+
deliveryId String
|
|
1066
|
+
receivedAt DateTime @default(now())
|
|
1067
|
+
|
|
1068
|
+
@@id([provider, deliveryId])
|
|
1069
|
+
@@index([receivedAt])
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
/// A principal's verified identity on a code-review host (GitHub today),
|
|
1073
|
+
/// linked through the host's user-authorization flow (link_host_account).
|
|
1074
|
+
/// Only the numeric user id and login are stored, never a user token. A host
|
|
1075
|
+
/// user belongs to at most one principal.
|
|
1076
|
+
model HostIdentity {
|
|
1077
|
+
principalId String
|
|
1078
|
+
principal Principal @relation(fields: [principalId], references: [id], onDelete: Cascade)
|
|
1079
|
+
/// "github" today; validated in code.
|
|
1080
|
+
provider String
|
|
1081
|
+
/// The host's numeric user id, as text.
|
|
1082
|
+
hostUserId String
|
|
1083
|
+
/// Last known login; refreshed when the host reports a rename.
|
|
1084
|
+
login String
|
|
1085
|
+
linkedAt DateTime @default(now())
|
|
1086
|
+
updatedAt DateTime @updatedAt
|
|
1087
|
+
|
|
1088
|
+
@@id([principalId, provider])
|
|
1089
|
+
@@unique([provider, hostUserId])
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
/// An in-flight host identity link (link_host_account): the OAuth state and
|
|
1093
|
+
/// PKCE verifier, then, after the host's callback, the verified user and the
|
|
1094
|
+
/// hash of the one-time confirmation code the same principal must submit.
|
|
1095
|
+
/// Lives 10 minutes.
|
|
1096
|
+
model HostIdentityLinkRequest {
|
|
1097
|
+
id String @id @default(cuid())
|
|
1098
|
+
principalId String
|
|
1099
|
+
principal Principal @relation(fields: [principalId], references: [id], onDelete: Cascade)
|
|
1100
|
+
provider String
|
|
1101
|
+
/// sha256 of the OAuth state; the state itself is never stored.
|
|
1102
|
+
stateHash String @unique
|
|
1103
|
+
/// PKCE verifier: useless without the authorization code and the client secret.
|
|
1104
|
+
codeVerifier String
|
|
1105
|
+
hostUserId String?
|
|
1106
|
+
login String?
|
|
1107
|
+
/// sha256 of the confirmation code shown on the callback page.
|
|
1108
|
+
confirmHash String?
|
|
1109
|
+
/// Wrong confirmation codes submitted; the request is dead at 5.
|
|
1110
|
+
attempts Int @default(0)
|
|
1111
|
+
callbackAt DateTime?
|
|
1112
|
+
expiresAt DateTime
|
|
1113
|
+
createdAt DateTime @default(now())
|
|
1114
|
+
|
|
1115
|
+
@@index([principalId])
|
|
1116
|
+
@@index([expiresAt])
|
|
1117
|
+
}
|