@wardby/cli 0.2.1 → 0.4.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 +53 -4
- package/README.md +52 -13
- 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 +14 -4
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +284 -36
- package/dist/coding/base-commit.d.ts +6 -0
- package/dist/coding/base-commit.js +12 -0
- 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 +91 -4
- package/dist/coding/protocol.js +123 -12
- package/dist/coding/provider.d.ts +6 -1
- package/dist/coding/provider.js +16 -9
- 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 +66 -0
- package/dist/config/providers.js +137 -0
- package/dist/core/attribution.d.ts +101 -0
- package/dist/core/attribution.js +208 -0
- package/dist/core/budget-groups.d.ts +120 -10
- package/dist/core/budget-groups.js +133 -24
- package/dist/core/budget-wording.d.ts +22 -0
- package/dist/core/budget-wording.js +55 -0
- package/dist/core/coding-queue.d.ts +3 -0
- package/dist/core/coding-queue.js +6 -2
- package/dist/core/coding-service-status.d.ts +11 -0
- package/dist/core/coding-service-status.js +17 -0
- package/dist/core/cost-report.d.ts +88 -0
- package/dist/core/cost-report.js +248 -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 +74 -7
- package/dist/core/dispatch.js +382 -47
- package/dist/core/engine-native.js +44 -14
- package/dist/core/glob.d.ts +10 -0
- package/dist/core/glob.js +33 -0
- package/dist/core/grants.d.ts +86 -0
- package/dist/core/grants.js +126 -0
- package/dist/core/host-events.d.ts +72 -0
- package/dist/core/host-events.js +597 -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 +78 -0
- package/dist/core/host-status.js +228 -0
- package/dist/core/in-flight-runs.d.ts +8 -0
- package/dist/core/in-flight-runs.js +56 -0
- package/dist/core/issue-bridge.d.ts +60 -0
- package/dist/core/issue-bridge.js +189 -0
- package/dist/core/issue-dedupe.d.ts +70 -0
- package/dist/core/issue-dedupe.js +255 -0
- package/dist/core/issue-events.d.ts +42 -0
- package/dist/core/issue-events.js +155 -0
- package/dist/core/issue-status.d.ts +29 -0
- package/dist/core/issue-status.js +241 -0
- package/dist/core/issue-tracker-tools.d.ts +64 -0
- package/dist/core/issue-tracker-tools.js +850 -0
- package/dist/core/model-usage.d.ts +10 -0
- package/dist/core/model-usage.js +24 -0
- package/dist/core/provider-wording.d.ts +12 -0
- package/dist/core/provider-wording.js +44 -0
- package/dist/core/reconciler.d.ts +42 -2
- package/dist/core/reconciler.js +97 -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 +354 -0
- package/dist/core/run-heartbeat.d.ts +27 -0
- package/dist/core/run-heartbeat.js +54 -0
- package/dist/core/run-pricing.d.ts +61 -0
- package/dist/core/run-pricing.js +56 -0
- package/dist/core/runner.d.ts +33 -8
- package/dist/core/runner.js +410 -62
- package/dist/core/scheduler.d.ts +4 -1
- package/dist/core/scheduler.js +3 -2
- package/dist/core/secrets.d.ts +11 -2
- package/dist/core/secrets.js +25 -6
- package/dist/core/self-defects.d.ts +80 -0
- package/dist/core/self-defects.js +180 -0
- 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 +67 -0
- package/dist/core/untrusted-content.d.ts +32 -0
- package/dist/core/untrusted-content.js +72 -0
- package/dist/core/webhooks.d.ts +17 -2
- package/dist/core/webhooks.js +42 -3
- package/dist/generated/prisma/browser.d.ts +166 -0
- package/dist/generated/prisma/client.d.ts +166 -0
- package/dist/generated/prisma/commonInputTypes.d.ts +152 -52
- package/dist/generated/prisma/enums.d.ts +13 -0
- package/dist/generated/prisma/enums.js +12 -1
- package/dist/generated/prisma/internal/class.d.ts +242 -0
- package/dist/generated/prisma/internal/class.js +4 -4
- package/dist/generated/prisma/internal/prismaNamespace.d.ts +2571 -577
- package/dist/generated/prisma/internal/prismaNamespace.js +312 -6
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.d.ts +328 -0
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.js +312 -6
- package/dist/generated/prisma/models/Agent.d.ts +682 -1
- package/dist/generated/prisma/models/AgentIssueProject.d.ts +1838 -0
- package/dist/generated/prisma/models/AgentIssueProject.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/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 +195 -2
- package/dist/generated/prisma/models/CodingRun.d.ts +1405 -95
- package/dist/generated/prisma/models/CodingRunServiceStatus.d.ts +1404 -0
- package/dist/generated/prisma/models/CodingRunServiceStatus.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/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/IssueFingerprint.d.ts +1183 -0
- package/dist/generated/prisma/models/IssueFingerprint.js +1 -0
- package/dist/generated/prisma/models/IssuePullRequest.d.ts +1255 -0
- package/dist/generated/prisma/models/IssuePullRequest.js +1 -0
- package/dist/generated/prisma/models/ModelCatalogEntry.d.ts +1322 -0
- package/dist/generated/prisma/models/ModelCatalogEntry.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 +1402 -82
- package/dist/generated/prisma/models/RunAttribution.d.ts +1259 -0
- package/dist/generated/prisma/models/RunAttribution.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/RunIssueStatus.d.ts +1199 -0
- package/dist/generated/prisma/models/RunIssueStatus.js +1 -0
- package/dist/generated/prisma/models/RunModelUsage.d.ts +1316 -0
- package/dist/generated/prisma/models/RunModelUsage.js +1 -0
- package/dist/generated/prisma/models/Tool.d.ts +15 -3
- package/dist/generated/prisma/models/WorkItem.d.ts +1408 -0
- package/dist/generated/prisma/models/WorkItem.js +1 -0
- package/dist/generated/prisma/models.d.ts +22 -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 +999 -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 +18 -18
- package/dist/knowledge/check.d.ts +13 -0
- package/dist/knowledge/check.js +69 -0
- package/dist/knowledge/cli.d.ts +14 -0
- package/dist/knowledge/cli.js +67 -0
- package/dist/knowledge/concept.d.ts +54 -0
- package/dist/knowledge/concept.js +78 -0
- package/dist/knowledge/note.d.ts +11 -0
- package/dist/knowledge/note.js +39 -0
- package/dist/knowledge/relevance.d.ts +11 -0
- package/dist/knowledge/relevance.js +14 -0
- package/dist/knowledge/span-hash.d.ts +3 -0
- package/dist/knowledge/span-hash.js +16 -0
- package/dist/mcp/auth/access.d.ts +72 -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 +25 -51
- 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 +33 -2
- package/dist/mcp/auth/resource-server.js +99 -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 +23 -5
- package/dist/mcp/auth/self-hosted/credentials.js +62 -4
- package/dist/mcp/auth/self-hosted/session.d.ts +7 -6
- package/dist/mcp/context.d.ts +30 -1
- package/dist/mcp/errors.d.ts +25 -6
- package/dist/mcp/errors.js +98 -0
- package/dist/mcp/host-events/deliveries.d.ts +9 -0
- package/dist/mcp/host-events/deliveries.js +17 -0
- package/dist/mcp/host-events/github-ingress.d.ts +38 -0
- package/dist/mcp/host-events/github-ingress.js +83 -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/host-events/jira-ingress.d.ts +29 -0
- package/dist/mcp/host-events/jira-ingress.js +92 -0
- package/dist/mcp/index.d.ts +10 -1
- package/dist/mcp/index.js +187 -19
- package/dist/mcp/server.js +32 -11
- package/dist/mcp/tools/agents.js +519 -50
- package/dist/mcp/tools/budget-groups.js +3 -3
- package/dist/mcp/tools/cost-report.d.ts +8 -0
- package/dist/mcp/tools/cost-report.js +60 -0
- 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/issue-projects.d.ts +2 -0
- package/dist/mcp/tools/issue-projects.js +238 -0
- package/dist/mcp/tools/memory.d.ts +7 -1
- package/dist/mcp/tools/memory.js +5 -5
- package/dist/mcp/tools/model-catalog.d.ts +22 -0
- package/dist/mcp/tools/model-catalog.js +423 -0
- package/dist/mcp/tools/repositories.d.ts +2 -0
- package/dist/mcp/tools/repositories.js +182 -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 +65 -7
- package/dist/mcp/tools/webhooks.js +15 -4
- package/dist/mcp/transport/streamable-http.d.ts +15 -0
- package/dist/mcp/transport/streamable-http.js +55 -3
- package/dist/mcp/webhooks/ingress.d.ts +2 -1
- package/dist/mcp/webhooks/ingress.js +9 -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 +10 -2
- package/dist/providers/auth/self-hosted.js +55 -6
- package/dist/providers/auth/types.d.ts +6 -0
- package/dist/providers/coding-proxy/memory-ledger.d.ts +4 -1
- package/dist/providers/coding-proxy/memory-ledger.js +31 -3
- package/dist/providers/coding-proxy/metering.d.ts +6 -1
- package/dist/providers/coding-proxy/metering.js +41 -4
- package/dist/providers/coding-proxy/prisma-ledger.d.ts +17 -0
- package/dist/providers/coding-proxy/prisma-ledger.js +106 -8
- package/dist/providers/coding-proxy/proxy.d.ts +25 -2
- package/dist/providers/coding-proxy/proxy.js +561 -38
- 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 +33 -1
- package/dist/providers/coding-proxy/types.js +12 -1
- package/dist/providers/engine/types.d.ts +29 -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 +28 -1
- package/dist/providers/executor/container.d.ts +134 -4
- package/dist/providers/executor/container.js +394 -37
- package/dist/providers/executor/dbos.d.ts +4 -3
- package/dist/providers/executor/dbos.js +7 -5
- package/dist/providers/executor/in-process.d.ts +2 -3
- package/dist/providers/executor/routing.d.ts +13 -0
- package/dist/providers/executor/routing.js +18 -0
- package/dist/providers/executor/types.d.ts +34 -0
- package/dist/providers/issue-tracker/adf.d.ts +31 -0
- package/dist/providers/issue-tracker/adf.js +181 -0
- package/dist/providers/issue-tracker/index.d.ts +5 -0
- package/dist/providers/issue-tracker/index.js +12 -0
- package/dist/providers/issue-tracker/jira-client.d.ts +41 -0
- package/dist/providers/issue-tracker/jira-client.js +151 -0
- package/dist/providers/issue-tracker/jira-events.d.ts +3 -0
- package/dist/providers/issue-tracker/jira-events.js +98 -0
- package/dist/providers/issue-tracker/jira.d.ts +116 -0
- package/dist/providers/issue-tracker/jira.js +502 -0
- package/dist/providers/issue-tracker/types.d.ts +269 -0
- package/dist/providers/issue-tracker/types.js +16 -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 +53 -2
- package/dist/providers/jobs/docker.js +307 -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 +24 -2
- package/dist/providers/jobs/kubernetes.js +153 -22
- package/dist/providers/jobs/service-state.d.ts +22 -0
- package/dist/providers/jobs/service-state.js +17 -0
- package/dist/providers/jobs/types.d.ts +18 -0
- package/dist/providers/llm/anthropic.d.ts +3 -3
- package/dist/providers/llm/anthropic.js +3 -5
- package/dist/providers/llm/bedrock.d.ts +3 -3
- package/dist/providers/llm/bedrock.js +3 -8
- package/dist/providers/llm/catalog-lookup.d.ts +10 -0
- package/dist/providers/llm/catalog-lookup.js +15 -0
- package/dist/providers/llm/catalog-shipped.d.ts +18 -0
- package/dist/providers/llm/catalog-shipped.js +197 -0
- package/dist/providers/llm/catalog-store.d.ts +58 -0
- package/dist/providers/llm/catalog-store.js +138 -0
- package/dist/providers/llm/catalog-types.d.ts +66 -0
- package/dist/providers/llm/catalog-types.js +64 -0
- package/dist/providers/llm/catalog.d.ts +61 -0
- package/dist/providers/llm/catalog.js +147 -0
- 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 +10 -12
- package/dist/providers/llm/claude-provider.js +15 -6
- package/dist/providers/llm/index.d.ts +9 -6
- package/dist/providers/llm/index.js +8 -5
- package/dist/providers/llm/openai.d.ts +14 -5
- package/dist/providers/llm/openai.js +24 -14
- package/dist/providers/llm/pricing-core.d.ts +5 -3
- package/dist/providers/llm/registration.js +8 -12
- package/dist/providers/llm/routing.d.ts +21 -11
- package/dist/providers/llm/routing.js +47 -13
- 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 +226 -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 +568 -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 +309 -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 +78 -34
- package/dist/providers/vcs/github.d.ts +94 -3
- package/dist/providers/vcs/github.js +223 -17
- package/dist/providers/vcs/types.d.ts +48 -4
- package/dist/quickstart/index.d.ts +2 -0
- package/dist/quickstart/index.js +36 -8
- 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 +8 -2
- package/dist/viewer/api-schema.d.ts +2757 -0
- package/dist/viewer/api-schema.js +165 -0
- package/dist/viewer/build-schemas.d.ts +2 -0
- package/dist/viewer/build-schemas.js +18 -0
- package/dist/viewer/event-bus.d.ts +38 -0
- package/dist/viewer/event-bus.js +232 -0
- package/dist/viewer/graph.d.ts +40 -0
- package/dist/viewer/graph.js +243 -0
- package/dist/viewer/http.d.ts +30 -0
- package/dist/viewer/http.js +133 -0
- package/dist/viewer/run-detail.d.ts +4 -0
- package/dist/viewer/run-detail.js +61 -0
- package/dist/wardby-bin.js +11 -0
- package/docs/README.md +40 -0
- package/docs/agent-recipes.md +383 -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 +508 -0
- package/docs/coding-agent-setup.md +175 -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 +1068 -0
- package/docs/getting-started-gke.md +632 -0
- package/docs/getting-started-identity-provider.md +319 -0
- package/docs/getting-started.md +147 -0
- package/docs/jira-agents.md +649 -0
- package/docs/knowledge.md +387 -0
- package/docs/models.md +221 -0
- package/docs/observability.md +53 -0
- package/docs/release-verification.md +66 -0
- package/docs/security-deployment.md +667 -0
- package/docs/viewer-api.md +142 -0
- package/help/admin-viewer.md +39 -0
- package/help/agent-recipes.md +173 -0
- package/help/architecture-agent.md +189 -0
- package/help/builder-agent.md +80 -0
- package/help/code-review-agents.md +37 -0
- package/help/coding-packages.md +31 -0
- package/help/coding-services.md +71 -0
- package/help/cost-attribution.md +67 -0
- package/help/creating-agents.md +90 -0
- package/help/deploy-gke.md +45 -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/model-unavailable.md +63 -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 +32 -0
- package/help/github.md +48 -0
- package/help/identity-and-access.md +44 -0
- package/help/jira.md +135 -0
- package/help/knowledge.md +47 -0
- package/help/mcp.md +30 -0
- package/help/models.md +90 -0
- package/help/native-capabilities.md +30 -0
- package/help/observability.md +41 -0
- package/help/operating-agents.md +36 -0
- package/help/security.md +27 -0
- package/help/troubleshooting/budgets.md +32 -0
- package/help/troubleshooting/coding-workers.md +47 -0
- package/help/troubleshooting/repository-access.md +27 -0
- package/package.json +14 -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/migrations/20260930000000_jira_issue_projects/migration.sql +34 -0
- package/prisma/migrations/20261001000000_jira_phase2_allowlists/migration.sql +3 -0
- package/prisma/migrations/20261001010000_jira_link_types_allowlist/migration.sql +2 -0
- package/prisma/migrations/20261002000000_jira_coding_bridge/migration.sql +28 -0
- package/prisma/migrations/20261002010000_jira_issue_creation/migration.sql +25 -0
- package/prisma/migrations/20261003000000_issue_cost_attribution/migration.sql +56 -0
- package/prisma/migrations/20261003010000_coding_run_service_status/migration.sql +23 -0
- package/prisma/migrations/20261003020000_viewer_notify/migration.sql +54 -0
- package/prisma/migrations/20261003030000_viewer_notify_fixes/migration.sql +47 -0
- package/prisma/migrations/20261003040000_viewer_indexes/migration.sql +12 -0
- package/prisma/migrations/20261004000000_model_catalog/migration.sql +26 -0
- package/prisma/schema.prisma +663 -21
- package/dist/mcp/tools/models.d.ts +0 -8
- package/dist/mcp/tools/models.js +0 -15
- package/dist/providers/llm/pricing-anthropic.d.ts +0 -4
- package/dist/providers/llm/pricing-anthropic.js +0 -30
- package/dist/providers/llm/pricing-bedrock-claude.d.ts +0 -12
- package/dist/providers/llm/pricing-bedrock-claude.js +0 -37
- package/dist/providers/llm/pricing.d.ts +0 -30
- package/dist/providers/llm/pricing.js +0 -74
|
@@ -13,12 +13,22 @@
|
|
|
13
13
|
* blinds the pre-flight refuse and mid-stream cutoff, and is not allowed.
|
|
14
14
|
*/
|
|
15
15
|
import type { ProviderRegistry } from "../index.js";
|
|
16
|
+
import type { LlmEffort } from "../llm/types.js";
|
|
16
17
|
/** The subset of Agent fields the engine needs — not the Prisma type, to keep this seam Prisma-agnostic. */
|
|
17
18
|
export interface EngineAgent {
|
|
18
19
|
systemPrompt: string;
|
|
19
20
|
model: string;
|
|
20
21
|
budgetUsd: number;
|
|
21
22
|
maxTurns: number;
|
|
23
|
+
/** Reasoning effort sent on every model call; absent = provider default. */
|
|
24
|
+
effort?: LlmEffort;
|
|
25
|
+
/**
|
|
26
|
+
* Background for this run that nobody vetted (e.g. the title and
|
|
27
|
+
* description of the GitHub issue a mention was made on). Delivered in the
|
|
28
|
+
* first user message inside untrusted_context tags, never in the system
|
|
29
|
+
* prompt. Absent = the first user message is just "Begin.".
|
|
30
|
+
*/
|
|
31
|
+
untrustedContext?: string;
|
|
22
32
|
}
|
|
23
33
|
export interface LoadedTool {
|
|
24
34
|
name: string;
|
|
@@ -40,6 +50,19 @@ export interface LoadedTool {
|
|
|
40
50
|
export type StepRunner = <T>(name: string, fn: () => Promise<T>) => Promise<T>;
|
|
41
51
|
/** The no-checkpoint default: run the step body directly. */
|
|
42
52
|
export declare const runStepInline: StepRunner;
|
|
53
|
+
/**
|
|
54
|
+
* Live progress after a completed model turn: absolute cumulative totals,
|
|
55
|
+
* never deltas, so re-delivering one (a DBOS replay re-runs the loop over
|
|
56
|
+
* recorded steps) rewrites the same values instead of double counting.
|
|
57
|
+
*/
|
|
58
|
+
export interface EngineProgress {
|
|
59
|
+
turns: number;
|
|
60
|
+
usage: {
|
|
61
|
+
tokensIn: number;
|
|
62
|
+
tokensOut: number;
|
|
63
|
+
costUsd: number;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
43
66
|
export interface EngineRunContext {
|
|
44
67
|
agent: EngineAgent;
|
|
45
68
|
tools: LoadedTool[];
|
|
@@ -47,6 +70,8 @@ export interface EngineRunContext {
|
|
|
47
70
|
/** Host bridge: validates params (Zod-in-sandbox) then runs the tool body in the WASM sandbox. Never throws — a tool/validation failure is a JSON error result string, fed back to the model as the tool's result. */
|
|
48
71
|
runSandboxTool(name: string, argsJson: string): Promise<string>;
|
|
49
72
|
onText?: (delta: string) => void;
|
|
73
|
+
/** Called after each model turn that completed without error; the engine awaits it. */
|
|
74
|
+
onProgress?: (progress: EngineProgress) => Promise<void>;
|
|
50
75
|
/** See StepRunner. Optional; the in-process executor leaves it unset. */
|
|
51
76
|
step?: StepRunner;
|
|
52
77
|
}
|
|
@@ -59,6 +84,10 @@ export interface EngineResult {
|
|
|
59
84
|
tokensIn: number;
|
|
60
85
|
tokensOut: number;
|
|
61
86
|
costUsd: number;
|
|
87
|
+
/** Subset of tokensIn served from a prompt cache. */
|
|
88
|
+
cachedInputTokens?: number;
|
|
89
|
+
/** Tokens billed for writing prompt-cache entries (not part of tokensIn). */
|
|
90
|
+
cacheWriteTokens?: number;
|
|
62
91
|
};
|
|
63
92
|
error?: string;
|
|
64
93
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PrismaClient } from "#prisma";
|
|
2
|
-
import type {
|
|
2
|
+
import type { NativeRunProviders } from "../../core/runner.js";
|
|
3
3
|
import { type ProviderConfig } from "../../config/providers.js";
|
|
4
4
|
import type { Executor } from "./types.js";
|
|
5
5
|
/** Select the Executor adapter from EXECUTOR. Constructing never connects; call `launch?.()` for that. */
|
|
6
|
-
export declare function buildExecutor(config: Pick<ProviderConfig, "executor">, providers:
|
|
6
|
+
export declare function buildExecutor(config: Pick<ProviderConfig, "executor">, providers: NativeRunProviders, db?: PrismaClient, env?: NodeJS.ProcessEnv): Executor;
|
|
@@ -2,6 +2,7 @@ import type { PrismaClient } from "#prisma";
|
|
|
2
2
|
import { type ProviderConfig } from "../../config/providers.js";
|
|
3
3
|
import type { KubernetesApi } from "../jobs/kubernetes-api.js";
|
|
4
4
|
import type { Executor } from "./types.js";
|
|
5
|
+
import { type RepoAccessGate } from "../../core/repo-access.js";
|
|
5
6
|
export interface ConfiguredExecutorOptions {
|
|
6
7
|
native: Executor;
|
|
7
8
|
db: PrismaClient;
|
|
@@ -9,6 +10,8 @@ export interface ConfiguredExecutorOptions {
|
|
|
9
10
|
providerConfig?: ProviderConfig;
|
|
10
11
|
/** Tests only: replaces the kubeconfig-backed client when JOB_LAUNCHER=kubernetes. */
|
|
11
12
|
kubernetesApi?: KubernetesApi;
|
|
13
|
+
/** Repository authorization for coding runs; built from the configured review hosts when absent. */
|
|
14
|
+
repoAccess?: RepoAccessGate;
|
|
12
15
|
}
|
|
13
16
|
/** Builds container execution only when Docker or Kubernetes is explicitly selected. */
|
|
14
17
|
export declare function buildConfiguredExecutor(options: ConfiguredExecutorOptions): Executor;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { tmpdir } from "node:os";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { loadCodingConcurrencyConfig, loadContainerExecutorConfig, loadGitHubVcsConfig, loadKubernetesJobConfig, loadProviderConfig, } from "../../config/providers.js";
|
|
4
|
+
import { summarizeRegistryFetches } from "../../coding/registry/report.js";
|
|
4
5
|
import { drainCodingQueue } from "../../core/coding-queue.js";
|
|
6
|
+
import { prismaServiceStateReporter } from "../../core/coding-service-status.js";
|
|
5
7
|
import { logger } from "../../core/logger.js";
|
|
6
8
|
import { EnvironmentCredentialResolver } from "../coding-proxy/environment-credentials.js";
|
|
7
9
|
import { CodingProxy } from "../coding-proxy/proxy.js";
|
|
@@ -15,6 +17,9 @@ import { KubernetesJobLauncher } from "../jobs/kubernetes.js";
|
|
|
15
17
|
import { buildVcsProvider } from "../vcs/index.js";
|
|
16
18
|
import { ContainerExecutor, PrismaContainerExecutionStore, RunCapabilityVault } from "./container.js";
|
|
17
19
|
import { PrismaExecutionKindResolver, RoutingExecutor } from "./routing.js";
|
|
20
|
+
import { createRepoAccessGate } from "../../core/repo-access.js";
|
|
21
|
+
import { buildIssueTrackers } from "../issue-tracker/index.js";
|
|
22
|
+
import { buildReviewHosts } from "../review-host/index.js";
|
|
18
23
|
const compositionLog = logger.child({ module: "executor-composition" });
|
|
19
24
|
/** Builds container execution only when Docker or Kubernetes is explicitly selected. */
|
|
20
25
|
export function buildConfiguredExecutor(options) {
|
|
@@ -38,11 +43,21 @@ export function buildConfiguredExecutor(options) {
|
|
|
38
43
|
ledger: new PrismaProxyLedger(options.db),
|
|
39
44
|
credentials: new EnvironmentCredentialResolver(env),
|
|
40
45
|
});
|
|
46
|
+
const onServiceState = prismaServiceStateReporter(options.db);
|
|
41
47
|
let jobs;
|
|
42
48
|
if (providerConfig.jobs === "kubernetes") {
|
|
43
49
|
if (!isRegistryDigest(config.workerImage)) {
|
|
44
50
|
throw new Error("CODING_WORKER_IMAGE must be a registry digest (repo@sha256:...) when JOB_LAUNCHER=kubernetes.");
|
|
45
51
|
}
|
|
52
|
+
for (const image of [config.claudeWorkerImage, config.claudeToolRunnerImage]) {
|
|
53
|
+
if (image !== undefined && !isRegistryDigest(image)) {
|
|
54
|
+
throw new Error("CODING_CLAUDE_WORKER_IMAGE and CODING_CLAUDE_TOOL_RUNNER_IMAGE must be registry digests (repo@sha256:...) when JOB_LAUNCHER=kubernetes.");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const claudePython = config.claudeToolRunnerImages["node-python"]?.["3.12"];
|
|
58
|
+
if (claudePython !== undefined && !isRegistryDigest(claudePython)) {
|
|
59
|
+
throw new Error("CODING_CLAUDE_TOOL_RUNNER_IMAGE_NODE_PYTHON_3_12 must be a registry digest (repo@sha256:...) when JOB_LAUNCHER=kubernetes.");
|
|
60
|
+
}
|
|
46
61
|
const kubernetes = loadKubernetesJobConfig(env);
|
|
47
62
|
// The preflight only runs on the first launch; a configuration that cannot work should
|
|
48
63
|
// fail the process at start-up, not the first coding run an hour later.
|
|
@@ -53,11 +68,13 @@ export function buildConfiguredExecutor(options) {
|
|
|
53
68
|
const api = options.kubernetesApi ?? new ClientNodeKubernetesApi({ context: kubernetes.context });
|
|
54
69
|
const workerImage = config.workerImage;
|
|
55
70
|
jobs = new KubernetesJobLauncher({
|
|
71
|
+
onServiceState,
|
|
56
72
|
api,
|
|
57
73
|
config: kubernetes,
|
|
58
74
|
workspaceRoot,
|
|
59
75
|
resolveCapability: (runId) => capabilities.get(runId),
|
|
60
76
|
readyTimeoutMs: kubernetes.readyTimeoutMs,
|
|
77
|
+
enforcementExecTimeoutMs: kubernetes.enforcementExecTimeoutMs,
|
|
61
78
|
preflight: async () => {
|
|
62
79
|
const { proxyIp } = await runKubernetesPreflight({
|
|
63
80
|
api,
|
|
@@ -74,6 +91,7 @@ export function buildConfiguredExecutor(options) {
|
|
|
74
91
|
else {
|
|
75
92
|
const stateRoot = resolve(config.stateRoot ?? resolve(tmpdir(), "wardby-docker-jobs"));
|
|
76
93
|
jobs = new DockerJobLauncher({
|
|
94
|
+
onServiceState,
|
|
77
95
|
stateRoot,
|
|
78
96
|
workspaceRoot,
|
|
79
97
|
proxyContainer: proxyContainer,
|
|
@@ -87,12 +105,13 @@ export function buildConfiguredExecutor(options) {
|
|
|
87
105
|
},
|
|
88
106
|
});
|
|
89
107
|
}
|
|
108
|
+
const issueTrackers = buildIssueTrackers(env);
|
|
90
109
|
const concurrency = loadCodingConcurrencyConfig(env);
|
|
91
110
|
// The release hook needs the composed RoutingExecutor, which only exists
|
|
92
111
|
// after the ContainerExecutor it wraps is built. The closure reads
|
|
93
112
|
// `composed` only when a run finishes, which is after this function returns.
|
|
94
113
|
const coding = new ContainerExecutor({
|
|
95
|
-
store: new PrismaContainerExecutionStore(options.db, { maxConcurrent: concurrency.maxConcurrent }),
|
|
114
|
+
store: new PrismaContainerExecutionStore(options.db, { maxConcurrent: concurrency.maxConcurrent, issueTrackers }),
|
|
96
115
|
jobs,
|
|
97
116
|
vcs,
|
|
98
117
|
sessions,
|
|
@@ -101,17 +120,25 @@ export function buildConfiguredExecutor(options) {
|
|
|
101
120
|
workerImage: config.workerImage,
|
|
102
121
|
claudeWorkerImage: config.claudeWorkerImage,
|
|
103
122
|
claudeToolRunnerImage: config.claudeToolRunnerImage,
|
|
123
|
+
claudeToolRunnerImages: config.claudeToolRunnerImages,
|
|
104
124
|
additionalWorkerImages: config.additionalWorkerImages,
|
|
105
125
|
credentialRef: config.credentialRef,
|
|
106
126
|
anthropicCredentialRef: config.anthropicCredentialRef,
|
|
107
127
|
limits: { cpus: config.cpus, memoryMb: config.memoryMb, pids: config.pids, diskMb: config.diskMb },
|
|
108
128
|
maxDiskMb: config.maxDiskMb,
|
|
129
|
+
repoAccess: options.repoAccess ?? createRepoAccessGate({ db: options.db, hosts: buildReviewHosts(env) }),
|
|
130
|
+
issueUrl: (provider, key) => (provider === "jira" ? issueTrackers.jira?.issueUrl(key) : undefined),
|
|
131
|
+
registryReport: async (runId) => {
|
|
132
|
+
const rows = await options.db.registryFetch.findMany({ where: { runId }, orderBy: { createdAt: "asc" } });
|
|
133
|
+
return summarizeRegistryFetches(rows);
|
|
134
|
+
},
|
|
109
135
|
onSlotReleased: () => {
|
|
110
136
|
void drainCodingQueue({
|
|
111
137
|
db: options.db,
|
|
112
138
|
executor: composed,
|
|
113
139
|
maxConcurrent: concurrency.maxConcurrent,
|
|
114
140
|
queueTimeoutSec: concurrency.queueTimeoutSec,
|
|
141
|
+
selfDefects: { db: options.db, issueTrackers },
|
|
115
142
|
}).catch((err) => {
|
|
116
143
|
// Never throws: the next scheduler tick drains again.
|
|
117
144
|
compositionLog.warn({ err }, "coding queue drain after a released slot failed");
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import type { PrismaClient } from "#prisma";
|
|
2
|
+
import { type CodingProvider } from "../../coding/provider.js";
|
|
3
|
+
import type { IssueTrackerRegistry } from "../issue-tracker/types.js";
|
|
4
|
+
import { type RepoAccessGate } from "../../core/repo-access.js";
|
|
2
5
|
import { type CodingRunObserver } from "../../coding/observability.js";
|
|
3
6
|
import { type CodingRunResult } from "../../coding/protocol.js";
|
|
4
|
-
import type { ProxyProtocol } from "../coding-proxy/types.js";
|
|
7
|
+
import type { ProxyModelTerms, ProxyProtocol } from "../coding-proxy/types.js";
|
|
5
8
|
import type { JobHandle, JobResourceLimits, WorkspaceJobLauncher } from "../jobs/types.js";
|
|
6
9
|
import type { VcsProvider } from "../vcs/types.js";
|
|
7
10
|
import type { CodingImageSelector, ExecutionRecoveryResult, Executor, PersistedExecutionHandle } from "./types.js";
|
|
11
|
+
/**
|
|
12
|
+
* Claude Code's commands run in its tool runner, which never reports back through the agent, so the
|
|
13
|
+
* host rewrites registry-proxy download URLs in collected lockfiles itself (the Codex driver does it
|
|
14
|
+
* in the worker). Best effort and symlink-safe (lockfiles.ts); a Codex workspace is left alone.
|
|
15
|
+
*/
|
|
16
|
+
export declare function normalizeCollectedLockfiles(provider: string, workspacePath: string): Promise<string[]>;
|
|
8
17
|
export interface ContainerRunSnapshot {
|
|
9
18
|
runId: string;
|
|
10
19
|
status: string;
|
|
@@ -19,11 +28,18 @@ export interface ContainerRunSnapshot {
|
|
|
19
28
|
provider: string;
|
|
20
29
|
model: string;
|
|
21
30
|
timeoutSec: number;
|
|
22
|
-
allowedEgress: unknown;
|
|
23
31
|
protectedPaths: unknown;
|
|
32
|
+
/** Stored per-agent collection paths; see src/coding/collect-exclude.ts. */
|
|
33
|
+
collectExclude: unknown;
|
|
24
34
|
/** Revision-in-place: set when this run continues another run's branch/PR. See preflight(). */
|
|
25
35
|
rootCodingRunId: string | null;
|
|
36
|
+
/** The issue that triggered this run (CodingRun.issueProvider/issueKey); null when none. */
|
|
37
|
+
issueProvider?: string | null;
|
|
38
|
+
issueKey?: string | null;
|
|
26
39
|
budgetUsd: number;
|
|
40
|
+
/** The agent's own per-run budget; `budgetUsd` is less when its budget group had less left. */
|
|
41
|
+
agentBudgetUsd?: number;
|
|
42
|
+
budgetGroupName?: string | null;
|
|
27
43
|
tokensIn: number;
|
|
28
44
|
tokensOut: number;
|
|
29
45
|
costUsd: number;
|
|
@@ -32,7 +48,22 @@ export interface ContainerRunSnapshot {
|
|
|
32
48
|
proxySessionId: string | null;
|
|
33
49
|
result: unknown;
|
|
34
50
|
workerImage: string | null;
|
|
51
|
+
/** Claude's tool-runner image, resolved at dispatch (CodingRun.toolImage); null on older rows and Codex runs. */
|
|
52
|
+
toolImage?: string | null;
|
|
35
53
|
workspaceDiskMb: number | null;
|
|
54
|
+
/** Admin-requested debug trace, fixed at dispatch (CodingRun.debugTrace). */
|
|
55
|
+
debugTrace?: boolean;
|
|
56
|
+
/** Coding-run services resolved at dispatch (CodingRun.services); parsed with parseStoredServices. */
|
|
57
|
+
services?: unknown;
|
|
58
|
+
/** The terminal failure category, once the run has one (CodingRun.failureCategory). */
|
|
59
|
+
failureCategory?: string | null;
|
|
60
|
+
/** The agent's CURRENT coding-profile repository (null if the profile is gone); may differ from `repository`. */
|
|
61
|
+
profileRepository: string | null;
|
|
62
|
+
/** How the profile's repository was authorized (CodingAgentProfile.repositoryAuthorizedVia). */
|
|
63
|
+
repositoryAuthorizedVia: string | null;
|
|
64
|
+
/** The run's catalog entry recorded at dispatch (Run.pricingSnapshot); null on runs from before the catalog. */
|
|
65
|
+
pricingVersion: string | null;
|
|
66
|
+
pricingSnapshot: unknown;
|
|
36
67
|
}
|
|
37
68
|
/**
|
|
38
69
|
* claimed: this caller owns provisioning. unavailable: someone else does, or
|
|
@@ -47,7 +78,7 @@ export interface ContainerExecutionStore {
|
|
|
47
78
|
persistHandle(runId: string, claimId: string, handle: JobHandle): Promise<void>;
|
|
48
79
|
heartbeat(runId: string): Promise<void>;
|
|
49
80
|
complete(runId: string, status: "succeeded" | "budget_exhausted", result: CodingRunResult): Promise<void>;
|
|
50
|
-
terminate(runId: string, status: "failed" | "refused" | "lost" | "cancelled", error: string, audit?: CodingFailureAudit): Promise<void>;
|
|
81
|
+
terminate(runId: string, status: "failed" | "refused" | "lost" | "budget_exhausted" | "cancelled", error: string, audit?: CodingFailureAudit): Promise<void>;
|
|
51
82
|
}
|
|
52
83
|
export interface CodingFailureAudit {
|
|
53
84
|
failureCategory: string;
|
|
@@ -58,13 +89,19 @@ export declare class PrismaContainerExecutionStore implements ContainerExecution
|
|
|
58
89
|
private readonly options;
|
|
59
90
|
constructor(db: PrismaClient, options?: {
|
|
60
91
|
maxConcurrent?: number;
|
|
92
|
+
/** Configured issue trackers: a coding run this store ends failed/lost/budget_exhausted files a self-defect. */
|
|
93
|
+
issueTrackers?: IssueTrackerRegistry;
|
|
61
94
|
});
|
|
95
|
+
/** Best effort (bounded, never throws): only called by the write that made the row terminal, so it files once. */
|
|
96
|
+
private selfDefect;
|
|
97
|
+
/** An empty registry (no Jira site configured) means no self-defect queries at all. */
|
|
98
|
+
private get hasTrackers();
|
|
62
99
|
load(runId: string): Promise<ContainerRunSnapshot | null>;
|
|
63
100
|
claimProvisioning(runId: string, claimId: string): Promise<ProvisioningClaim>;
|
|
64
101
|
persistHandle(runId: string, claimId: string, handle: JobHandle): Promise<void>;
|
|
65
102
|
heartbeat(runId: string): Promise<void>;
|
|
66
103
|
complete(runId: string, status: "succeeded" | "budget_exhausted", result: CodingRunResult): Promise<void>;
|
|
67
|
-
terminate(runId: string, status: "failed" | "refused" | "lost" | "cancelled", error: string, audit?: CodingFailureAudit): Promise<void>;
|
|
104
|
+
terminate(runId: string, status: "failed" | "refused" | "lost" | "budget_exhausted" | "cancelled", error: string, audit?: CodingFailureAudit): Promise<void>;
|
|
68
105
|
}
|
|
69
106
|
export interface CodingSessionController {
|
|
70
107
|
createSession(input: {
|
|
@@ -74,11 +111,17 @@ export interface CodingSessionController {
|
|
|
74
111
|
allowedModels: string[];
|
|
75
112
|
deadlineAt: Date;
|
|
76
113
|
budgetUsd: number;
|
|
114
|
+
/** The run's catalog entry; the proxy prices and shapes the run's requests from it. */
|
|
115
|
+
terms?: ProxyModelTerms;
|
|
77
116
|
}): Promise<{
|
|
78
117
|
id: string;
|
|
79
118
|
capability: string;
|
|
80
119
|
}>;
|
|
81
120
|
cancelSession(sessionId: string): Promise<void>;
|
|
121
|
+
/** Whether the proxy refused a request of this session for budget. */
|
|
122
|
+
budgetExhausted?(sessionId: string): Promise<boolean>;
|
|
123
|
+
/** The code of the first model-provider failure the proxy relayed for this session, if any. */
|
|
124
|
+
upstreamFailure?(sessionId: string): Promise<string | null>;
|
|
82
125
|
}
|
|
83
126
|
/** Plain capabilities live only for the short provisioning window. */
|
|
84
127
|
export declare class RunCapabilityVault {
|
|
@@ -100,6 +143,12 @@ export interface ContainerExecutorOptions {
|
|
|
100
143
|
credentialRef: string;
|
|
101
144
|
claudeWorkerImage?: string;
|
|
102
145
|
claudeToolRunnerImage?: string;
|
|
146
|
+
/**
|
|
147
|
+
* Claude tool-runner images for toolchains beyond the "node" baseline (claudeToolRunnerImage),
|
|
148
|
+
* keyed by toolchain, then version -- the same shape as additionalWorkerImages. Claude's agent
|
|
149
|
+
* image is the same for every toolchain; only the tool runner, which runs the commands, differs.
|
|
150
|
+
*/
|
|
151
|
+
claudeToolRunnerImages?: Record<string, Record<string, string>>;
|
|
103
152
|
anthropicCredentialRef?: string;
|
|
104
153
|
limits: JobResourceLimits;
|
|
105
154
|
/** Operator ceiling (MiB) on CodingRun.workspaceDiskMb; see coding_workspace_disk_exceeds_limit in jobSpec. */
|
|
@@ -117,6 +166,35 @@ export interface ContainerExecutorOptions {
|
|
|
117
166
|
* than on the next scheduler tick. Never called for a run that was queued.
|
|
118
167
|
*/
|
|
119
168
|
onSlotReleased?: () => void;
|
|
169
|
+
/**
|
|
170
|
+
* Loads this run's RegistryFetch ledger (composition.ts wires the Prisma
|
|
171
|
+
* query) so finalizeChanges can surface installed/refused packages in the
|
|
172
|
+
* PR body. Optional so tests and non-registry deployments can omit it;
|
|
173
|
+
* a rejection is swallowed and treated as "nothing to report" since a
|
|
174
|
+
* reporting failure must never fail the run itself.
|
|
175
|
+
*/
|
|
176
|
+
registryReport?: (runId: string) => Promise<RegistryReport>;
|
|
177
|
+
/** Browse URL for an issue of a tracker provider (composition wires the issue-tracker registry); undefined when unconfigured. */
|
|
178
|
+
issueUrl?: (provider: string, key: string) => string | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* Repository authorization: every run is checked, before its workspace is
|
|
181
|
+
* prepared, against the agent owner's current GitHub access (or a recorded
|
|
182
|
+
* admin/grandfathered approval of this exact repository).
|
|
183
|
+
*/
|
|
184
|
+
repoAccess: RepoAccessGate;
|
|
185
|
+
}
|
|
186
|
+
/** A run's deduplicated served packages and refusals (see summarizeRegistryFetches). */
|
|
187
|
+
export interface RegistryReport {
|
|
188
|
+
packages: Array<{
|
|
189
|
+
ecosystem: string;
|
|
190
|
+
name: string;
|
|
191
|
+
version: string;
|
|
192
|
+
}>;
|
|
193
|
+
packageRefusals: Array<{
|
|
194
|
+
ecosystem: string;
|
|
195
|
+
name: string;
|
|
196
|
+
reason: string;
|
|
197
|
+
}>;
|
|
120
198
|
}
|
|
121
199
|
export declare class ContainerExecutor implements Executor {
|
|
122
200
|
private readonly options;
|
|
@@ -155,10 +233,44 @@ export declare class ContainerExecutor implements Executor {
|
|
|
155
233
|
* that is otherwise healthy.
|
|
156
234
|
*/
|
|
157
235
|
private whileHeartbeating;
|
|
236
|
+
/**
|
|
237
|
+
* The run may use its repository only if the agent's current owner still
|
|
238
|
+
* has write on it, or the profile's approval (admin or grandfathered)
|
|
239
|
+
* covers exactly this repository. A profile changed since dispatch no
|
|
240
|
+
* longer covers the run's repository, so that falls back to the owner's
|
|
241
|
+
* access. Throws RepoAccessError (refused before anything is cloned).
|
|
242
|
+
*/
|
|
243
|
+
private authorizeRepository;
|
|
244
|
+
/** The originating issue for the PR title/body: control-plane data from the CodingRun row, key re-validated. */
|
|
245
|
+
private issueFor;
|
|
246
|
+
/** The run's stored model terms; a run from before the catalog resolves them from the current catalog. */
|
|
247
|
+
private modelTerms;
|
|
158
248
|
private preflight;
|
|
159
249
|
private finishTerminal;
|
|
250
|
+
/** The package report is informational: any failure loading it (a
|
|
251
|
+
* rejection, a synchronous throw, or a malformed result) yields no
|
|
252
|
+
* package section rather than failing finalization. */
|
|
253
|
+
private loadRegistryReport;
|
|
160
254
|
private resultFor;
|
|
161
255
|
resolveCodingWorkerImage(selector: CodingImageSelector): string;
|
|
256
|
+
/** Claude's tool-runner image for the agent's toolchain, at dispatch (Executor.resolveCodingToolImage); null for Codex. */
|
|
257
|
+
resolveCodingToolImage(selector: CodingImageSelector): string | null;
|
|
258
|
+
/** The tool runner is what runs a Claude agent's commands, so it is what the toolchain selects. */
|
|
259
|
+
private claudeToolImage;
|
|
260
|
+
/** Coding-run services: the repository's declaration at its base ref (Executor.readCodingServiceDeclaration). */
|
|
261
|
+
readCodingServiceDeclaration(input: {
|
|
262
|
+
repository: string;
|
|
263
|
+
baseRef: string;
|
|
264
|
+
}): Promise<string | null>;
|
|
265
|
+
/** One repository file at the run's base ref (Executor.readCodingRepositoryFile). */
|
|
266
|
+
readCodingRepositoryFile(input: {
|
|
267
|
+
repository: string;
|
|
268
|
+
baseRef: string;
|
|
269
|
+
path: string;
|
|
270
|
+
maxBytes: number;
|
|
271
|
+
}): Promise<string | null>;
|
|
272
|
+
/** The job launcher decides (Kubernetes and Docker start services for both providers). */
|
|
273
|
+
supportsCodingServices(provider: CodingProvider): boolean;
|
|
162
274
|
private requireCurrent;
|
|
163
275
|
private jobSpec;
|
|
164
276
|
private credentialRef;
|
|
@@ -167,6 +279,24 @@ export declare class ContainerExecutor implements Executor {
|
|
|
167
279
|
private preflightForCleanup;
|
|
168
280
|
private abandon;
|
|
169
281
|
private cleanupTerminal;
|
|
282
|
+
/** Whether the proxy refused this run's session for budget. Never throws. */
|
|
283
|
+
private outOfBudget;
|
|
284
|
+
/** The model-provider failure the proxy relayed for this run's session, classified. Never throws. */
|
|
285
|
+
private providerFailure;
|
|
286
|
+
/**
|
|
287
|
+
* A failure the model provider's refusal caused. The persisted error names
|
|
288
|
+
* the class only; the raw upstream code (a fixed identifier, never a message)
|
|
289
|
+
* goes to one operator line an alert can key on, and the failure itself is
|
|
290
|
+
* still logged under its diagnostic id.
|
|
291
|
+
*/
|
|
292
|
+
private providerFailureOf;
|
|
293
|
+
/** The host-safe sentence for a run that ran out of budget. */
|
|
294
|
+
private budgetSentence;
|
|
295
|
+
/**
|
|
296
|
+
* A failure the proxy's budget refusal caused. The failure itself is still
|
|
297
|
+
* logged under its diagnostic id, so the operator keeps the real reason.
|
|
298
|
+
*/
|
|
299
|
+
private budgetFailure;
|
|
170
300
|
private emit;
|
|
171
301
|
private terminal;
|
|
172
302
|
/**
|