@wardby/cli 0.2.0 → 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 +183 -71
- package/dist/claude-coding-worker/driver.d.ts +7 -1
- package/dist/claude-coding-worker/driver.js +31 -2
- package/dist/claude-coding-worker/main.js +5 -2
- 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 +99 -3
- package/dist/coding/protocol.js +155 -4
- 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 +18 -0
- package/dist/coding-worker/artifact.js +48 -6
- 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 +14 -1
- package/dist/coding-worker/driver.js +106 -14
- package/dist/coding-worker/errors.d.ts +7 -0
- package/dist/coding-worker/errors.js +26 -0
- package/dist/coding-worker/main.js +13 -4
- 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 +109 -6
- 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/coding-queue.d.ts +1 -1
- package/dist/core/datastores.d.ts +1 -1
- package/dist/core/datastores.js +18 -2
- package/dist/core/db.d.ts +40 -2
- package/dist/core/db.js +75 -2
- package/dist/core/dispatch.d.ts +49 -7
- package/dist/core/dispatch.js +290 -45
- 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/http-runtime.js +3 -4
- package/dist/core/in-flight-runs.d.ts +8 -0
- package/dist/core/in-flight-runs.js +56 -0
- package/dist/core/lease.d.ts +1 -1
- package/dist/core/private-directory.d.ts +20 -0
- package/dist/core/private-directory.js +36 -0
- package/dist/core/provider-wording.d.ts +12 -0
- package/dist/core/provider-wording.js +44 -0
- package/dist/core/reconciler.d.ts +39 -3
- 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 +31 -9
- package/dist/core/runner.js +237 -40
- package/dist/core/scheduler.d.ts +1 -1
- package/dist/core/secrets.d.ts +12 -3
- package/dist/core/secrets.js +25 -6
- package/dist/core/subagent-memory-tools.d.ts +2 -2
- 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 +9 -2
- package/dist/core/webhooks.js +23 -2
- package/dist/generated/prisma/browser.d.ts +328 -0
- package/dist/generated/prisma/browser.js +17 -0
- package/dist/generated/prisma/client.d.ts +347 -0
- package/dist/generated/prisma/client.js +34 -0
- package/dist/generated/prisma/commonInputTypes.d.ts +839 -0
- package/dist/generated/prisma/commonInputTypes.js +10 -0
- package/dist/generated/prisma/enums.d.ts +59 -0
- package/dist/generated/prisma/enums.js +59 -0
- package/dist/generated/prisma/internal/class.d.ts +605 -0
- package/dist/generated/prisma/internal/class.js +49 -0
- package/dist/generated/prisma/internal/prismaNamespace.d.ts +4494 -0
- package/dist/generated/prisma/internal/prismaNamespace.js +628 -0
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.d.ts +635 -0
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.js +599 -0
- package/dist/generated/prisma/models/Agent.d.ts +3560 -0
- package/dist/generated/prisma/models/Agent.js +1 -0
- package/dist/generated/prisma/models/AgentDatastore.d.ts +1210 -0
- package/dist/generated/prisma/models/AgentDatastore.js +1 -0
- package/dist/generated/prisma/models/AgentMemory.d.ts +986 -0
- package/dist/generated/prisma/models/AgentMemory.js +1 -0
- package/dist/generated/prisma/models/AgentRepository.d.ts +1425 -0
- package/dist/generated/prisma/models/AgentRepository.js +1 -0
- package/dist/generated/prisma/models/AgentSecret.d.ts +1212 -0
- package/dist/generated/prisma/models/AgentSecret.js +1 -0
- package/dist/generated/prisma/models/AgentSubAgent.d.ts +1217 -0
- package/dist/generated/prisma/models/AgentSubAgent.js +1 -0
- package/dist/generated/prisma/models/AgentTool.d.ts +1403 -0
- package/dist/generated/prisma/models/AgentTool.js +1 -0
- package/dist/generated/prisma/models/AuthFormChallenge.d.ts +1298 -0
- package/dist/generated/prisma/models/AuthFormChallenge.js +1 -0
- package/dist/generated/prisma/models/AuthLoginKey.d.ts +1245 -0
- package/dist/generated/prisma/models/AuthLoginKey.js +1 -0
- package/dist/generated/prisma/models/AuthRateLimit.d.ts +979 -0
- package/dist/generated/prisma/models/AuthRateLimit.js +1 -0
- package/dist/generated/prisma/models/AuthSession.d.ts +1376 -0
- package/dist/generated/prisma/models/AuthSession.js +1 -0
- package/dist/generated/prisma/models/AuthUser.d.ts +1700 -0
- package/dist/generated/prisma/models/AuthUser.js +1 -0
- package/dist/generated/prisma/models/BudgetGroup.d.ts +1548 -0
- package/dist/generated/prisma/models/BudgetGroup.js +1 -0
- package/dist/generated/prisma/models/CodingAgentProfile.d.ts +1681 -0
- package/dist/generated/prisma/models/CodingAgentProfile.js +1 -0
- package/dist/generated/prisma/models/CodingProxyRequest.d.ts +1749 -0
- package/dist/generated/prisma/models/CodingProxyRequest.js +1 -0
- package/dist/generated/prisma/models/CodingProxySession.d.ts +1626 -0
- package/dist/generated/prisma/models/CodingProxySession.js +1 -0
- package/dist/generated/prisma/models/CodingRun.d.ts +3583 -0
- package/dist/generated/prisma/models/CodingRun.js +1 -0
- package/dist/generated/prisma/models/CodingService.d.ts +1348 -0
- package/dist/generated/prisma/models/CodingService.js +1 -0
- package/dist/generated/prisma/models/Datastore.d.ts +1434 -0
- package/dist/generated/prisma/models/Datastore.js +1 -0
- package/dist/generated/prisma/models/DatastoreEntry.d.ts +1314 -0
- package/dist/generated/prisma/models/DatastoreEntry.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/OAuthAuthorizationCode.d.ts +1526 -0
- package/dist/generated/prisma/models/OAuthAuthorizationCode.js +1 -0
- package/dist/generated/prisma/models/OAuthAuthorizationRequest.d.ts +1350 -0
- package/dist/generated/prisma/models/OAuthAuthorizationRequest.js +1 -0
- package/dist/generated/prisma/models/OAuthClient.d.ts +1289 -0
- package/dist/generated/prisma/models/OAuthClient.js +1 -0
- package/dist/generated/prisma/models/OAuthFamily.d.ts +1540 -0
- package/dist/generated/prisma/models/OAuthFamily.js +1 -0
- package/dist/generated/prisma/models/OAuthGrant.d.ts +1280 -0
- package/dist/generated/prisma/models/OAuthGrant.js +1 -0
- package/dist/generated/prisma/models/Principal.d.ts +2245 -0
- package/dist/generated/prisma/models/Principal.js +1 -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 +2669 -0
- package/dist/generated/prisma/models/Run.js +1 -0
- 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/SchedulerLease.d.ts +970 -0
- package/dist/generated/prisma/models/SchedulerLease.js +1 -0
- package/dist/generated/prisma/models/Secret.d.ts +1399 -0
- package/dist/generated/prisma/models/Secret.js +1 -0
- package/dist/generated/prisma/models/SecretElicitationOutcome.d.ts +973 -0
- package/dist/generated/prisma/models/SecretElicitationOutcome.js +1 -0
- package/dist/generated/prisma/models/Task.d.ts +1176 -0
- package/dist/generated/prisma/models/Task.js +1 -0
- package/dist/generated/prisma/models/Tool.d.ts +1490 -0
- package/dist/generated/prisma/models/Tool.js +1 -0
- package/dist/generated/prisma/models/Webhook.d.ts +1386 -0
- package/dist/generated/prisma/models/Webhook.js +1 -0
- package/dist/generated/prisma/models.d.ts +45 -0
- package/dist/generated/prisma/models.js +1 -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 +6 -1
- package/dist/import/create.js +68 -14
- package/dist/import/index.d.ts +1 -1
- 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 +37 -63
- package/dist/mcp/auth/ownership.js +19 -14
- package/dist/mcp/auth/principal.d.ts +1 -1
- 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 +32 -3
- package/dist/mcp/auth/resource-server.js +84 -3
- package/dist/mcp/auth/self-hosted/browser.js +22 -8
- package/dist/mcp/auth/self-hosted/cli.d.ts +1 -1
- package/dist/mcp/auth/self-hosted/cli.js +47 -13
- package/dist/mcp/auth/self-hosted/credentials.d.ts +21 -3
- package/dist/mcp/auth/self-hosted/credentials.js +62 -4
- package/dist/mcp/auth/self-hosted/rate-limit.d.ts +1 -1
- package/dist/mcp/auth/self-hosted/session.d.ts +3 -2
- package/dist/mcp/context.d.ts +28 -2
- 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.d.ts +1 -1
- package/dist/mcp/server.js +27 -9
- package/dist/mcp/shared/page-style.d.ts +16 -0
- package/dist/mcp/shared/page-style.js +129 -0
- package/dist/mcp/tasks/manager.d.ts +1 -1
- package/dist/mcp/tools/agents.js +447 -49
- package/dist/mcp/tools/budget-groups.js +3 -3
- package/dist/mcp/tools/datastore.js +23 -16
- 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 +4 -7
- package/dist/mcp/tools/secret-elicitation-form.d.ts +1 -1
- package/dist/mcp/tools/secret-elicitation-form.js +10 -28
- package/dist/mcp/tools/secret-elicitation.d.ts +1 -1
- 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 +53 -17
- package/dist/mcp/tools/tools.d.ts +41 -0
- package/dist/mcp/tools/tools.js +202 -41
- package/dist/mcp/tools/trigger.js +36 -6
- package/dist/mcp/tools/webhooks.js +15 -4
- package/dist/mcp/transport/streamable-http.d.ts +11 -1
- package/dist/mcp/transport/streamable-http.js +32 -2
- package/dist/mcp/unattended-schedules.d.ts +1 -1
- package/dist/mcp/webhooks/ingress.d.ts +1 -1
- package/dist/providers/auth/delegating.d.ts +19 -0
- package/dist/providers/auth/delegating.js +71 -0
- package/dist/providers/auth/index.d.ts +3 -1
- package/dist/providers/auth/index.js +11 -0
- package/dist/providers/auth/self-hosted.d.ts +4 -3
- 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 +18 -1
- 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 +18 -1
- 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/datastore/postgres.d.ts +1 -1
- package/dist/providers/engine/types.d.ts +10 -0
- package/dist/providers/executor/build.d.ts +3 -3
- package/dist/providers/executor/composition.d.ts +4 -1
- package/dist/providers/executor/composition.js +19 -0
- package/dist/providers/executor/container.d.ts +106 -4
- package/dist/providers/executor/container.js +305 -22
- package/dist/providers/executor/dbos.d.ts +3 -4
- 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 +60 -2
- package/dist/providers/jobs/docker.js +313 -50
- 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 +117 -31
- package/dist/providers/jobs/types.d.ts +20 -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/memory/postgres.d.ts +1 -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 +79 -14
- 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 +34 -32
- package/dist/quickstart/migrate.d.ts +23 -0
- package/dist/quickstart/migrate.js +125 -0
- 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 +30 -11
- package/prisma/migrate.config.mjs +20 -0
- 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 +417 -23
package/dist/cli-help.js
CHANGED
|
@@ -4,12 +4,18 @@ export const CLI_USAGE = `usage:
|
|
|
4
4
|
wardby status
|
|
5
5
|
wardby logs [--tail N] [--follow]
|
|
6
6
|
wardby down [--volumes]
|
|
7
|
-
wardby
|
|
7
|
+
wardby help [list]
|
|
8
|
+
wardby help search <terms>
|
|
9
|
+
wardby help open <article-id>
|
|
10
|
+
wardby agent create --name <n> --model <m> --prompt <p> --budget <usd> [--schedule "<cron>"] [--timezone <tz>] [--max-turns <n>] [--owner <subject>] [--public]
|
|
11
|
+
(owned by --owner or LOCAL_PRINCIPAL; --public shares it with everyone at execute)
|
|
8
12
|
wardby agent list
|
|
9
13
|
wardby agent schedule <name> --cron "<expr>" [--timezone <tz>] [--disable]
|
|
10
14
|
wardby tool create --name <n> --description <d> --params <file> --code <file>
|
|
11
|
-
wardby tool attach <tool-name> <agent-name>
|
|
12
|
-
wardby tool detach <tool-name> <agent-name>
|
|
15
|
+
wardby tool attach <tool-name|tool-id> <agent-name> (grants the capabilities in the agent owner's name)
|
|
16
|
+
wardby tool detach <tool-name|tool-id> <agent-name>
|
|
17
|
+
wardby tool update <tool-name|tool-id> [--description <d>] [--params <file>] [--code <file>]
|
|
18
|
+
wardby tool delete <tool-name|tool-id> [--detach]
|
|
13
19
|
wardby tool list [--agent <name>]
|
|
14
20
|
wardby run <name>
|
|
15
21
|
wardby runs [--agent <name>] [--limit N] [--status <s>]
|
|
@@ -18,7 +24,10 @@ export const CLI_USAGE = `usage:
|
|
|
18
24
|
wardby scheduler [--scope default]
|
|
19
25
|
wardby mcp (MCP_TRANSPORT=stdio|http selects the transport)
|
|
20
26
|
wardby serve [--scope default] (mcp + scheduler + reconciler in one process; http only)
|
|
21
|
-
wardby
|
|
27
|
+
wardby grants migration-report [--json]
|
|
28
|
+
wardby grants adopt-public --owner <subject> [--dry-run] [--keep-everyone-execute]
|
|
29
|
+
wardby grants prune-bindings [--dry-run]
|
|
30
|
+
wardby import <bundle-dir> [--owner <subject>] [--public] [--include-secrets --transfer-key <pem>] [--default-budget <usd>] [--dry-run] [--prefix <p>] [--on-conflict fail|skip|rename] [--allow-open-fetch]
|
|
22
31
|
|
|
23
32
|
options:
|
|
24
33
|
-h, --help Show this help
|
package/dist/cli.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Minimal CLI.
|
|
4
4
|
*
|
|
5
|
-
* wardby agent create --name <n> --model <m> --prompt <p> --budget <usd> [--schedule "<cron>"] [--timezone <tz>] [--memory-enabled]
|
|
5
|
+
* wardby agent create --name <n> --model <m> --prompt <p> --budget <usd> [--schedule "<cron>"] [--timezone <tz>] [--memory-enabled] [--effort <level>]
|
|
6
6
|
* wardby agent list
|
|
7
7
|
* wardby agent schedule <name> --cron "<expr>" [--timezone <tz>] [--disable]
|
|
8
8
|
* wardby run <name>
|
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Minimal CLI.
|
|
4
4
|
*
|
|
5
|
-
* wardby agent create --name <n> --model <m> --prompt <p> --budget <usd> [--schedule "<cron>"] [--timezone <tz>] [--memory-enabled]
|
|
5
|
+
* wardby agent create --name <n> --model <m> --prompt <p> --budget <usd> [--schedule "<cron>"] [--timezone <tz>] [--memory-enabled] [--effort <level>]
|
|
6
6
|
* wardby agent list
|
|
7
7
|
* wardby agent schedule <name> --cron "<expr>" [--timezone <tz>] [--disable]
|
|
8
8
|
* wardby run <name>
|
|
@@ -20,31 +20,40 @@ import { readFileSync } from "node:fs";
|
|
|
20
20
|
import { execFile as execFileCallback } from "node:child_process";
|
|
21
21
|
import { parseArgs } from "node:util";
|
|
22
22
|
import { promisify } from "node:util";
|
|
23
|
-
import { loadCodingConcurrencyConfig, loadContainerExecutorConfig, loadKubernetesJobConfig, loadProviderConfig, } from "./config/providers.js";
|
|
23
|
+
import { loadCodingConcurrencyConfig, loadContainerExecutorConfig, loadKubernetesJobConfig, loadMcpConfig, loadProviderConfig, } from "./config/providers.js";
|
|
24
24
|
import { drainCodingQueue } from "./core/coding-queue.js";
|
|
25
25
|
import { isImmutableDockerImage } from "./providers/jobs/docker-isolation.js";
|
|
26
26
|
import { ClientNodeKubernetesApi } from "./providers/jobs/kubernetes-client.js";
|
|
27
27
|
import { describePreflightFailure, kubernetesPreflight } from "./providers/jobs/kubernetes-preflight.js";
|
|
28
|
-
import { RoutingLlmProvider, resolveLlmRegistrations } from "./providers/llm/index.js";
|
|
28
|
+
import { RoutingLlmProvider, isLlmEffort, modelSupportedEfforts, resolveLlmRegistrations, } from "./providers/llm/index.js";
|
|
29
29
|
import { buildConfiguredExecutor, buildExecutor } from "./providers/executor/index.js";
|
|
30
30
|
import { PostgresDatastore } from "./providers/datastore/index.js";
|
|
31
31
|
import { PostgresAgentMemory } from "./providers/memory/index.js";
|
|
32
32
|
import { buildSecretCipher } from "./providers/secrets/index.js";
|
|
33
33
|
import { prisma } from "./core/db.js";
|
|
34
34
|
import { runAgent } from "./core/runner.js";
|
|
35
|
+
import { cancelRunOnSignal } from "./core/run-heartbeat.js";
|
|
36
|
+
import { buildReviewHosts } from "./providers/review-host/index.js";
|
|
37
|
+
import { createRepoAccessGate } from "./core/repo-access.js";
|
|
35
38
|
import { validateCronExpression } from "./core/cron.js";
|
|
36
39
|
import { startScheduler } from "./core/scheduler.js";
|
|
37
40
|
import { startReconciler } from "./core/reconciler.js";
|
|
38
41
|
import { NativeEngine } from "./core/engine-native.js";
|
|
39
42
|
import { logger } from "./core/logger.js";
|
|
40
43
|
import { deriveJsonSchema } from "./sandbox/zod-params.js";
|
|
44
|
+
import { findSameNamedAttachedTool, reservedToolNameReason, resolveToolRef } from "./core/tool-names.js";
|
|
45
|
+
import { ToolAttachedError, deleteToolGuarded, formatAttachedAgents, formatToolLine, hasToolChanges, prepareToolUpdate, updateToolGuarded, } from "./core/tool-admin.js";
|
|
41
46
|
import { ToolCapabilitiesPatchSchema } from "./sandbox/tool-capabilities.js";
|
|
42
47
|
import { startMcp } from "./mcp/index.js";
|
|
43
48
|
import { startServe } from "./serve.js";
|
|
44
49
|
import { authCommand } from "./mcp/auth/self-hosted/cli.js";
|
|
50
|
+
import { hostAccountCommand } from "./mcp/auth/host-account-cli.js";
|
|
51
|
+
import { grantsCommand, resolveCliAgentOwner } from "./mcp/auth/grants-cli.js";
|
|
52
|
+
import { everyoneGrantData } from "./core/grants.js";
|
|
45
53
|
import { parseImportArgs } from "./import/cli-args.js";
|
|
46
54
|
import { runImport } from "./import/index.js";
|
|
47
55
|
import { CLI_USAGE } from "./cli-help.js";
|
|
56
|
+
import { helpCommand } from "./help/cli.js";
|
|
48
57
|
const cliLog = logger.child({ module: "cli" });
|
|
49
58
|
const RUN_STATUSES = [
|
|
50
59
|
"pending",
|
|
@@ -106,6 +115,9 @@ async function agentCreate(args) {
|
|
|
106
115
|
timezone: { type: "string" },
|
|
107
116
|
"max-turns": { type: "string" },
|
|
108
117
|
"memory-enabled": { type: "boolean" },
|
|
118
|
+
effort: { type: "string" },
|
|
119
|
+
owner: { type: "string" },
|
|
120
|
+
public: { type: "boolean" },
|
|
109
121
|
},
|
|
110
122
|
});
|
|
111
123
|
if (!values.name || !values.model || !values.prompt || !values.budget) {
|
|
@@ -128,17 +140,41 @@ async function agentCreate(args) {
|
|
|
128
140
|
fail(`invalid --schedule/--timezone: ${err instanceof Error ? err.message : String(err)}`);
|
|
129
141
|
}
|
|
130
142
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
model
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
143
|
+
if (values.effort !== undefined) {
|
|
144
|
+
const accepted = modelSupportedEfforts(values.model);
|
|
145
|
+
if (!isLlmEffort(values.effort) || !accepted.includes(values.effort)) {
|
|
146
|
+
fail(`model "${values.model}" does not accept --effort "${values.effort}"` +
|
|
147
|
+
(accepted.length > 0 ? ` (accepted: ${accepted.join(", ")}).` : " (it accepts no effort setting)."));
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// Owned by --owner or the local operator; never owner-less (resource-
|
|
151
|
+
// sharing grants spec §3.8). --public shares it with everyone at execute.
|
|
152
|
+
let ownerId;
|
|
153
|
+
try {
|
|
154
|
+
ownerId = await resolveCliAgentOwner(prisma, values.owner, loadMcpConfig().localPrincipal);
|
|
155
|
+
}
|
|
156
|
+
catch (err) {
|
|
157
|
+
fail(err instanceof Error ? err.message : String(err));
|
|
158
|
+
}
|
|
159
|
+
const agent = await prisma.$transaction(async (tx) => {
|
|
160
|
+
const created = await tx.agent.create({
|
|
161
|
+
data: {
|
|
162
|
+
name: values.name,
|
|
163
|
+
model: values.model,
|
|
164
|
+
systemPrompt: values.prompt,
|
|
165
|
+
budgetUsd,
|
|
166
|
+
schedule: values.schedule ?? null,
|
|
167
|
+
timezone,
|
|
168
|
+
maxTurns,
|
|
169
|
+
memoryEnabled: values["memory-enabled"] ?? false,
|
|
170
|
+
effort: values.effort ?? null,
|
|
171
|
+
ownerId: ownerId,
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
if (values.public) {
|
|
175
|
+
await tx.resourceGrant.create({ data: everyoneGrantData("agent", created.id, "execute", "operator") });
|
|
176
|
+
}
|
|
177
|
+
return created;
|
|
142
178
|
});
|
|
143
179
|
console.log(agent.id);
|
|
144
180
|
}
|
|
@@ -155,6 +191,9 @@ async function toolCreate(args) {
|
|
|
155
191
|
if (!values.name || !values.description || !values.params || !values.code) {
|
|
156
192
|
fail("tool create requires --name, --description, --params <file>, and --code <file>.");
|
|
157
193
|
}
|
|
194
|
+
const reserved = reservedToolNameReason(values.name);
|
|
195
|
+
if (reserved)
|
|
196
|
+
fail(reserved);
|
|
158
197
|
let paramsZod;
|
|
159
198
|
let code;
|
|
160
199
|
try {
|
|
@@ -170,12 +209,19 @@ async function toolCreate(args) {
|
|
|
170
209
|
fail(`could not read --code file "${values.code}": ${err instanceof Error ? err.message : String(err)}`);
|
|
171
210
|
}
|
|
172
211
|
// Fails at registration, not at call time: a malformed schema never gets
|
|
173
|
-
// persisted. The derived schema is cached on the row
|
|
174
|
-
//
|
|
212
|
+
// persisted. The derived schema is cached on the row rather than
|
|
213
|
+
// re-derived per run; MCP update_tool re-derives it whenever paramsZod
|
|
214
|
+
// changes, so it never goes stale.
|
|
175
215
|
const schemaResult = await deriveJsonSchema(paramsZod);
|
|
176
216
|
if (!schemaResult.ok) {
|
|
177
217
|
fail(`invalid --params schema: ${schemaResult.errorMessage}`);
|
|
178
218
|
}
|
|
219
|
+
// CLI tools are public (no owner), and the (ownerId, name) unique index
|
|
220
|
+
// treats NULL owners as distinct, so it can't stop a second public tool
|
|
221
|
+
// with this name -- check here instead.
|
|
222
|
+
if (await prisma.tool.findFirst({ where: { ownerId: null, name: values.name } })) {
|
|
223
|
+
fail(`a public tool named "${values.name}" already exists.`);
|
|
224
|
+
}
|
|
179
225
|
const tool = await prisma.tool.create({
|
|
180
226
|
data: {
|
|
181
227
|
name: values.name,
|
|
@@ -203,11 +249,14 @@ async function toolAttach(args, detach) {
|
|
|
203
249
|
});
|
|
204
250
|
const [toolName, agentName] = positionals;
|
|
205
251
|
if (!toolName || !agentName) {
|
|
206
|
-
fail(`tool ${detach ? "detach" : "attach"} requires <tool-name> <agent-name>.`);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
252
|
+
fail(`tool ${detach ? "detach" : "attach"} requires <tool-name|tool-id> <agent-name>.`);
|
|
253
|
+
}
|
|
254
|
+
// Tool names are unique per owner, not globally: an ambiguous name fails
|
|
255
|
+
// with the candidate ids, and an id is accepted in its place.
|
|
256
|
+
const resolved = await resolveToolRef(prisma, toolName);
|
|
257
|
+
if (!resolved.ok)
|
|
258
|
+
fail(resolved.error);
|
|
259
|
+
const tool = resolved.tool;
|
|
211
260
|
const agent = await prisma.agent.findUnique({ where: { name: agentName } });
|
|
212
261
|
if (!agent)
|
|
213
262
|
fail(`unknown agent "${agentName}".`);
|
|
@@ -229,6 +278,14 @@ async function toolAttach(args, detach) {
|
|
|
229
278
|
(allowedSharedDatastorePrefixes[boundName] ??= []).push(prefix);
|
|
230
279
|
}
|
|
231
280
|
}
|
|
281
|
+
// Same guard as MCP attach_tool: one agent never holds two tools with the
|
|
282
|
+
// same name, since the runtime dispatches by name. Operator-only, so unlike
|
|
283
|
+
// attach_tool this check-then-upsert is not one Serializable transaction
|
|
284
|
+
// (the runner's load-time duplicate check still catches a race).
|
|
285
|
+
const clash = await findSameNamedAttachedTool(prisma, agent.id, tool);
|
|
286
|
+
if (clash) {
|
|
287
|
+
fail(`agent "${agentName}" already has a different tool named "${tool.name}" attached (${clash.id}); detach it first.`);
|
|
288
|
+
}
|
|
232
289
|
const patch = ToolCapabilitiesPatchSchema.safeParse({
|
|
233
290
|
allowedSecrets: values["allow-secret"],
|
|
234
291
|
allowedDatastorePrefixes: values["allow-datastore-prefix"],
|
|
@@ -238,6 +295,10 @@ async function toolAttach(args, detach) {
|
|
|
238
295
|
if (!patch.success) {
|
|
239
296
|
fail(`invalid tool capabilities: ${patch.error.issues.map((i) => i.message).join("; ")}`);
|
|
240
297
|
}
|
|
298
|
+
// The operator is trusted with the database, so it grants these
|
|
299
|
+
// capabilities in the agent owner's name: the runner honours them only
|
|
300
|
+
// with the owner's consent stamp (resource-sharing grants spec §3.4.2).
|
|
301
|
+
// An owner-less agent has no owner to stamp: its capabilities stay inert.
|
|
241
302
|
await prisma.agentTool.upsert({
|
|
242
303
|
where: { agentId_toolId: { agentId: agent.id, toolId: tool.id } },
|
|
243
304
|
create: {
|
|
@@ -247,8 +308,10 @@ async function toolAttach(args, detach) {
|
|
|
247
308
|
allowedDatastorePrefixes: patch.data.allowedDatastorePrefixes ?? [],
|
|
248
309
|
allowedHosts: patch.data.allowedHosts ?? [],
|
|
249
310
|
allowedSharedDatastorePrefixes: patch.data.allowedSharedDatastorePrefixes ?? {},
|
|
311
|
+
capabilitiesGrantedById: agent.ownerId,
|
|
250
312
|
},
|
|
251
313
|
update: {
|
|
314
|
+
capabilitiesGrantedById: agent.ownerId,
|
|
252
315
|
...(patch.data.allowedSecrets !== undefined ? { allowedSecrets: patch.data.allowedSecrets } : {}),
|
|
253
316
|
...(patch.data.allowedDatastorePrefixes !== undefined
|
|
254
317
|
? { allowedDatastorePrefixes: patch.data.allowedDatastorePrefixes }
|
|
@@ -273,16 +336,116 @@ async function toolList(args) {
|
|
|
273
336
|
return;
|
|
274
337
|
}
|
|
275
338
|
for (const a of attached)
|
|
276
|
-
console.log(
|
|
339
|
+
console.log(formatToolLine(a.tool));
|
|
277
340
|
return;
|
|
278
341
|
}
|
|
279
|
-
const tools = await prisma.tool.findMany({ orderBy: { name: "asc" } });
|
|
342
|
+
const tools = await prisma.tool.findMany({ orderBy: [{ name: "asc" }, { id: "asc" }] });
|
|
280
343
|
if (tools.length === 0) {
|
|
281
344
|
console.log("no tools registered.");
|
|
282
345
|
return;
|
|
283
346
|
}
|
|
284
347
|
for (const t of tools)
|
|
285
|
-
console.log(
|
|
348
|
+
console.log(formatToolLine(t));
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* The operator may change any tool, public ones included; only a row that
|
|
352
|
+
* vanished since it was resolved is refused. Thrown rather than fail()ed:
|
|
353
|
+
* it runs inside the transaction, which must roll back, not exit mid-way.
|
|
354
|
+
*/
|
|
355
|
+
function operatorAuthorize(ref) {
|
|
356
|
+
return (tool) => {
|
|
357
|
+
if (!tool)
|
|
358
|
+
throw new Error(`unknown tool "${ref}".`);
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* `wardby tool update <tool-name|tool-id>` -- the operator's counterpart of
|
|
363
|
+
* MCP update_tool, and the only way to change a public tool. Same
|
|
364
|
+
* validation (jsonSchema re-derived from --params) and the same attachment
|
|
365
|
+
* rule, judged against the tool's owner (core/tool-admin.ts).
|
|
366
|
+
*/
|
|
367
|
+
async function toolUpdate(args) {
|
|
368
|
+
const { values, positionals } = parseArgs({
|
|
369
|
+
args,
|
|
370
|
+
allowPositionals: true,
|
|
371
|
+
options: {
|
|
372
|
+
description: { type: "string" },
|
|
373
|
+
params: { type: "string" },
|
|
374
|
+
code: { type: "string" },
|
|
375
|
+
},
|
|
376
|
+
});
|
|
377
|
+
const [ref] = positionals;
|
|
378
|
+
if (!ref)
|
|
379
|
+
fail("tool update requires <tool-name|tool-id>.");
|
|
380
|
+
const readFile = (flag, path) => {
|
|
381
|
+
if (path === undefined)
|
|
382
|
+
return undefined;
|
|
383
|
+
try {
|
|
384
|
+
return readFileSync(path, "utf8");
|
|
385
|
+
}
|
|
386
|
+
catch (err) {
|
|
387
|
+
fail(`could not read ${flag} file "${path}": ${err instanceof Error ? err.message : String(err)}`);
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
const changes = {
|
|
391
|
+
description: values.description,
|
|
392
|
+
paramsZod: readFile("--params", values.params),
|
|
393
|
+
code: readFile("--code", values.code),
|
|
394
|
+
};
|
|
395
|
+
if (!hasToolChanges(changes)) {
|
|
396
|
+
fail("tool update requires at least one of --description, --params <file>, --code <file>.");
|
|
397
|
+
}
|
|
398
|
+
const resolved = await resolveToolRef(prisma, ref);
|
|
399
|
+
if (!resolved.ok)
|
|
400
|
+
fail(resolved.error);
|
|
401
|
+
const prepared = await prepareToolUpdate(changes);
|
|
402
|
+
if (!prepared.ok)
|
|
403
|
+
fail(`invalid --params schema: ${prepared.errorMessage}`);
|
|
404
|
+
try {
|
|
405
|
+
await updateToolGuarded(prisma, resolved.tool.id, prepared.data, operatorAuthorize(ref));
|
|
406
|
+
}
|
|
407
|
+
catch (err) {
|
|
408
|
+
if (err instanceof ToolAttachedError) {
|
|
409
|
+
fail(`tool "${ref}" is attached to agents with a different owner: ${formatAttachedAgents(err.agents)}. Detach it from those agents first, or create a new tool.`);
|
|
410
|
+
}
|
|
411
|
+
throw err;
|
|
412
|
+
}
|
|
413
|
+
console.log(`updated tool ${resolved.tool.id}.`);
|
|
414
|
+
}
|
|
415
|
+
/** `wardby tool delete <tool-name|tool-id> [--detach]` -- MCP delete_tool's rules, public tools included. */
|
|
416
|
+
async function toolDelete(args) {
|
|
417
|
+
const { values, positionals } = parseArgs({
|
|
418
|
+
args,
|
|
419
|
+
allowPositionals: true,
|
|
420
|
+
options: { detach: { type: "boolean" } },
|
|
421
|
+
});
|
|
422
|
+
const [ref] = positionals;
|
|
423
|
+
if (!ref)
|
|
424
|
+
fail("tool delete requires <tool-name|tool-id>.");
|
|
425
|
+
const resolved = await resolveToolRef(prisma, ref);
|
|
426
|
+
if (!resolved.ok)
|
|
427
|
+
fail(resolved.error);
|
|
428
|
+
let detachedFrom;
|
|
429
|
+
try {
|
|
430
|
+
detachedFrom = await deleteToolGuarded(prisma, resolved.tool.id, {
|
|
431
|
+
detach: values.detach ?? false,
|
|
432
|
+
authorize: operatorAuthorize(ref),
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
catch (err) {
|
|
436
|
+
if (!(err instanceof ToolAttachedError))
|
|
437
|
+
throw err;
|
|
438
|
+
if (err.reason === "other_owners") {
|
|
439
|
+
fail(`tool "${ref}" is attached to agents with a different owner: ${formatAttachedAgents(err.agents)}. Detach it from those agents first (wardby tool detach).`);
|
|
440
|
+
}
|
|
441
|
+
if (err.reason === "needs_detach") {
|
|
442
|
+
fail(`tool "${ref}" is still attached to ${formatAttachedAgents(err.agents)}. Pass --detach to detach it and delete it.`);
|
|
443
|
+
}
|
|
444
|
+
fail(`tool "${ref}" is still attached to an agent; nothing was deleted.`);
|
|
445
|
+
}
|
|
446
|
+
console.log(detachedFrom.length > 0
|
|
447
|
+
? `deleted tool ${resolved.tool.id} (detached from ${detachedFrom.join(", ")}).`
|
|
448
|
+
: `deleted tool ${resolved.tool.id}.`);
|
|
286
449
|
}
|
|
287
450
|
async function agentSchedule(args) {
|
|
288
451
|
const [name, ...rest] = args;
|
|
@@ -353,14 +516,22 @@ async function run(name) {
|
|
|
353
516
|
const datastore = buildDatastore(secrets);
|
|
354
517
|
const memory = buildMemory();
|
|
355
518
|
let run;
|
|
519
|
+
// Ctrl-C (or a SIGTERM) records the run as cancelled rather than leaving a
|
|
520
|
+
// `running` row behind.
|
|
521
|
+
let removeSignalHandlers;
|
|
356
522
|
try {
|
|
357
|
-
run = await runAgent(name, { llm, engine, datastore, secrets, memory }, prisma, (delta) => {
|
|
523
|
+
run = await runAgent(name, { llm, engine, datastore, secrets, memory, reviewHosts: buildReviewHosts() }, prisma, (delta) => {
|
|
358
524
|
process.stdout.write(delta);
|
|
525
|
+
}, (created) => {
|
|
526
|
+
removeSignalHandlers = cancelRunOnSignal(prisma, created.id);
|
|
359
527
|
});
|
|
360
528
|
}
|
|
361
529
|
catch (err) {
|
|
362
530
|
fail(err instanceof Error ? err.message : String(err));
|
|
363
531
|
}
|
|
532
|
+
finally {
|
|
533
|
+
removeSignalHandlers?.();
|
|
534
|
+
}
|
|
364
535
|
process.stdout.write("\n");
|
|
365
536
|
const completedAgent = await prisma.agent.findUnique({ where: { id: run.agentId } });
|
|
366
537
|
const budgetUsd = completedAgent ? Number(completedAgent.budgetUsd) : NaN;
|
|
@@ -492,10 +663,13 @@ async function scheduler(args) {
|
|
|
492
663
|
const secrets = buildSecrets();
|
|
493
664
|
const datastore = buildDatastore(secrets);
|
|
494
665
|
const memory = buildMemory();
|
|
495
|
-
const
|
|
496
|
-
|
|
666
|
+
const reviewHosts = buildReviewHosts();
|
|
667
|
+
// One repository-access gate (and cache) for native repo_* calls and coding runs.
|
|
668
|
+
const repoAccess = createRepoAccessGate({ db: prisma, hosts: reviewHosts });
|
|
669
|
+
const nativeExecutor = buildExecutor(config, { llm, engine, datastore, secrets, memory, reviewHosts, repoAccess }, prisma);
|
|
670
|
+
const executor = buildConfiguredExecutor({ native: nativeExecutor, db: prisma, providerConfig: config, repoAccess });
|
|
497
671
|
await executor.launch?.();
|
|
498
|
-
const reconciler = startReconciler({ db: prisma, executor });
|
|
672
|
+
const reconciler = startReconciler({ db: prisma, executor, reviewHosts });
|
|
499
673
|
const sched = startScheduler({
|
|
500
674
|
executor,
|
|
501
675
|
db: prisma,
|
|
@@ -570,9 +744,19 @@ async function importCommand(rest) {
|
|
|
570
744
|
async function main() {
|
|
571
745
|
const [command, ...rest] = process.argv.slice(2);
|
|
572
746
|
try {
|
|
573
|
-
if (command === "auth") {
|
|
747
|
+
if (command === "auth" && rest[0] === "host-account") {
|
|
748
|
+
// Both auth modes: keyed on Principal, not the self-hosted AuthUser.
|
|
749
|
+
await hostAccountCommand(rest.slice(1), prisma);
|
|
750
|
+
}
|
|
751
|
+
else if (command === "grants") {
|
|
752
|
+
await grantsCommand(rest, prisma);
|
|
753
|
+
}
|
|
754
|
+
else if (command === "auth") {
|
|
574
755
|
await authCommand(rest, prisma, process.env.AUTH_CREDENTIAL_HASH_KEY ?? "");
|
|
575
756
|
}
|
|
757
|
+
else if (command === "help") {
|
|
758
|
+
await helpCommand(rest);
|
|
759
|
+
}
|
|
576
760
|
else if (command === "agent" && rest[0] === "create") {
|
|
577
761
|
await agentCreate(rest.slice(1));
|
|
578
762
|
}
|
|
@@ -591,6 +775,12 @@ async function main() {
|
|
|
591
775
|
else if (command === "tool" && rest[0] === "detach") {
|
|
592
776
|
await toolAttach(rest.slice(1), true);
|
|
593
777
|
}
|
|
778
|
+
else if (command === "tool" && rest[0] === "update") {
|
|
779
|
+
await toolUpdate(rest.slice(1));
|
|
780
|
+
}
|
|
781
|
+
else if (command === "tool" && rest[0] === "delete") {
|
|
782
|
+
await toolDelete(rest.slice(1));
|
|
783
|
+
}
|
|
594
784
|
else if (command === "tool" && rest[0] === "list") {
|
|
595
785
|
await toolList(rest.slice(1));
|
|
596
786
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Paths a coding run's workspace never sends back: dependency and cache folders
|
|
3
|
+
* (matched by name at any depth) plus per-agent repository-relative paths. The
|
|
4
|
+
* same set is rendered three ways so the Kubernetes keeper's tar, the Docker
|
|
5
|
+
* staging prune, and Git staging all agree on what "excluded" means.
|
|
6
|
+
*/
|
|
7
|
+
export declare const BUILTIN_COLLECT_EXCLUDE_NAMES: readonly ["node_modules", ".venv", "venv", "__pycache__", ".pytest_cache", ".ruff_cache", ".mypy_cache", ".tox", ".vite", ".cache"];
|
|
8
|
+
export declare const MAX_COLLECT_EXCLUDE_PATHS = 64;
|
|
9
|
+
export interface CollectExclusions {
|
|
10
|
+
names: readonly string[];
|
|
11
|
+
paths: readonly string[];
|
|
12
|
+
}
|
|
13
|
+
export declare function validateCollectExcludePath(value: string): string;
|
|
14
|
+
export declare function collectExclusions(paths: readonly string[]): CollectExclusions;
|
|
15
|
+
/** For values read back from the database or a job record, which are untrusted shapes. */
|
|
16
|
+
export declare function normalizeCollectExclusions(value: unknown): CollectExclusions;
|
|
17
|
+
export declare function isCollectExcluded(relativePath: string, exclusions: CollectExclusions): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* GNU tar options for `tar -C <workspace> -cf - .`, whose member names start with
|
|
20
|
+
* "./". Names are unanchored (they match any path component); paths are anchored
|
|
21
|
+
* to the archive root. An excluded directory's contents are skipped with it.
|
|
22
|
+
*/
|
|
23
|
+
export declare function tarExcludeArgs(exclusions: CollectExclusions): string[];
|
|
24
|
+
/** Git exclude pathspecs, appended after ":/" when staging. */
|
|
25
|
+
export declare function gitExcludePathspecs(exclusions: CollectExclusions): string[];
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Paths a coding run's workspace never sends back: dependency and cache folders
|
|
3
|
+
* (matched by name at any depth) plus per-agent repository-relative paths. The
|
|
4
|
+
* same set is rendered three ways so the Kubernetes keeper's tar, the Docker
|
|
5
|
+
* staging prune, and Git staging all agree on what "excluded" means.
|
|
6
|
+
*/
|
|
7
|
+
export const BUILTIN_COLLECT_EXCLUDE_NAMES = [
|
|
8
|
+
"node_modules",
|
|
9
|
+
".venv",
|
|
10
|
+
"venv",
|
|
11
|
+
"__pycache__",
|
|
12
|
+
".pytest_cache",
|
|
13
|
+
".ruff_cache",
|
|
14
|
+
".mypy_cache",
|
|
15
|
+
".tox",
|
|
16
|
+
".vite",
|
|
17
|
+
".cache",
|
|
18
|
+
];
|
|
19
|
+
export const MAX_COLLECT_EXCLUDE_PATHS = 64;
|
|
20
|
+
const MAX_PATH_BYTES = 512;
|
|
21
|
+
const CONTROL = /[\u0000-\u001F\u007F]/;
|
|
22
|
+
const GLOB = /[*?[\]]/;
|
|
23
|
+
export function validateCollectExcludePath(value) {
|
|
24
|
+
const path = value.trim();
|
|
25
|
+
const valid = path.length > 0 &&
|
|
26
|
+
Buffer.byteLength(path, "utf8") <= MAX_PATH_BYTES &&
|
|
27
|
+
!CONTROL.test(path) &&
|
|
28
|
+
!GLOB.test(path) &&
|
|
29
|
+
!path.includes("\\") &&
|
|
30
|
+
!path.startsWith("/") &&
|
|
31
|
+
!path.startsWith("./") &&
|
|
32
|
+
!path.split("/").some((part) => part === "" || part === "." || part === "..");
|
|
33
|
+
if (!valid)
|
|
34
|
+
throw new Error("collect_exclude_path_invalid");
|
|
35
|
+
return path;
|
|
36
|
+
}
|
|
37
|
+
export function collectExclusions(paths) {
|
|
38
|
+
if (paths.length > MAX_COLLECT_EXCLUDE_PATHS)
|
|
39
|
+
throw new Error("collect_exclude_path_invalid");
|
|
40
|
+
return { names: [...BUILTIN_COLLECT_EXCLUDE_NAMES], paths: [...new Set(paths.map(validateCollectExcludePath))] };
|
|
41
|
+
}
|
|
42
|
+
/** For values read back from the database or a job record, which are untrusted shapes. */
|
|
43
|
+
export function normalizeCollectExclusions(value) {
|
|
44
|
+
if (value === undefined || value === null)
|
|
45
|
+
return collectExclusions([]);
|
|
46
|
+
if (!Array.isArray(value) || !value.every((entry) => typeof entry === "string")) {
|
|
47
|
+
throw new Error("collect_exclude_invalid");
|
|
48
|
+
}
|
|
49
|
+
return collectExclusions(value);
|
|
50
|
+
}
|
|
51
|
+
export function isCollectExcluded(relativePath, exclusions) {
|
|
52
|
+
const segments = relativePath.split("/");
|
|
53
|
+
if (segments.some((segment) => exclusions.names.includes(segment)))
|
|
54
|
+
return true;
|
|
55
|
+
return exclusions.paths.some((path) => relativePath === path || relativePath.startsWith(`${path}/`));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* GNU tar options for `tar -C <workspace> -cf - .`, whose member names start with
|
|
59
|
+
* "./". Names are unanchored (they match any path component); paths are anchored
|
|
60
|
+
* to the archive root. An excluded directory's contents are skipped with it.
|
|
61
|
+
*/
|
|
62
|
+
export function tarExcludeArgs(exclusions) {
|
|
63
|
+
return [
|
|
64
|
+
"--no-anchored",
|
|
65
|
+
...exclusions.names.map((name) => `--exclude=${name}`),
|
|
66
|
+
"--anchored",
|
|
67
|
+
...exclusions.paths.map((path) => `--exclude=./${path}`),
|
|
68
|
+
];
|
|
69
|
+
}
|
|
70
|
+
/** Git exclude pathspecs, appended after ":/" when staging. */
|
|
71
|
+
export function gitExcludePathspecs(exclusions) {
|
|
72
|
+
return [
|
|
73
|
+
...exclusions.names.flatMap((name) => [`:(exclude,glob)**/${name}`, `:(exclude,glob)**/${name}/**`]),
|
|
74
|
+
...exclusions.paths.map((path) => `:(exclude,literal)${path}`),
|
|
75
|
+
];
|
|
76
|
+
}
|