@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
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool-name rules shared by every path that creates or attaches a Tool
|
|
3
|
+
* (MCP create_tool/attach_tool, `wardby tool create|attach`, the importer)
|
|
4
|
+
* and by the runner that dispatches them.
|
|
5
|
+
*
|
|
6
|
+
* Tool names are unique per owner, not globally (schema.prisma), so one
|
|
7
|
+
* agent could otherwise end up holding two same-named tools -- say its own
|
|
8
|
+
* `foo` plus a public `foo`. The runtime dispatches by name (runner.ts), so
|
|
9
|
+
* the model would see a duplicate tool name and one tool would silently
|
|
10
|
+
* shadow the other; every attach path refuses that instead
|
|
11
|
+
* (findSameNamedAttachedTool), and the runner asserts it at load time.
|
|
12
|
+
*/
|
|
13
|
+
import type { Prisma, PrismaClient, Tool } from "#prisma";
|
|
14
|
+
/** The runner's synthesized sub-agent tools are `delegate_to_<boundName>`. */
|
|
15
|
+
export declare const DELEGATE_TOOL_PREFIX = "delegate_to_";
|
|
16
|
+
/**
|
|
17
|
+
* Why `name` can't be a user tool's name, or undefined if it can. Each
|
|
18
|
+
* reserved name is checked by the runner before user tools, so a user tool
|
|
19
|
+
* with one of these names could be created but never reached.
|
|
20
|
+
*/
|
|
21
|
+
export declare function reservedToolNameReason(name: string): string | undefined;
|
|
22
|
+
/** Names appearing more than once, each reported once, in first-seen order. */
|
|
23
|
+
export declare function duplicateToolNames(names: readonly string[]): string[];
|
|
24
|
+
export type ToolLookupDb = Pick<PrismaClient | Prisma.TransactionClient, "tool" | "agentTool">;
|
|
25
|
+
/**
|
|
26
|
+
* A tool other than `tool` that is already attached to `agentId` under the
|
|
27
|
+
* same name, or null. Run it inside the attaching transaction (attach_tool's
|
|
28
|
+
* is Serializable) so a concurrent attach can't slip in between.
|
|
29
|
+
*/
|
|
30
|
+
export declare function findSameNamedAttachedTool(db: Pick<ToolLookupDb, "agentTool">, agentId: string, tool: Pick<Tool, "id" | "name">): Promise<Pick<Tool, "id" | "name" | "ownerId"> | null>;
|
|
31
|
+
/**
|
|
32
|
+
* Resolves a CLI tool reference: an id, else a name. A name is no longer
|
|
33
|
+
* unique across owners, so more than one match is refused -- with the
|
|
34
|
+
* candidate ids, so the operator can pass one -- rather than guessed at.
|
|
35
|
+
*/
|
|
36
|
+
export declare function resolveToolRef(db: Pick<ToolLookupDb, "tool">, ref: string): Promise<{
|
|
37
|
+
ok: true;
|
|
38
|
+
tool: Tool;
|
|
39
|
+
} | {
|
|
40
|
+
ok: false;
|
|
41
|
+
error: string;
|
|
42
|
+
}>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { MEMORY_TOOL_NAMES } from "./memory-tools.js";
|
|
2
|
+
import { SUBAGENT_MEMORY_TOOL_NAMES } from "./subagent-memory-tools.js";
|
|
3
|
+
import { ISSUE_TRACKER_TOOL_NAMES } from "./issue-tracker-tools.js";
|
|
4
|
+
/** The runner's synthesized sub-agent tools are `delegate_to_<boundName>`. */
|
|
5
|
+
export const DELEGATE_TOOL_PREFIX = "delegate_to_";
|
|
6
|
+
/**
|
|
7
|
+
* Why `name` can't be a user tool's name, or undefined if it can. Each
|
|
8
|
+
* reserved name is checked by the runner before user tools, so a user tool
|
|
9
|
+
* with one of these names could be created but never reached.
|
|
10
|
+
*/
|
|
11
|
+
export function reservedToolNameReason(name) {
|
|
12
|
+
if (MEMORY_TOOL_NAMES.has(name))
|
|
13
|
+
return `Tool name "${name}" is reserved for the built-in agent-memory tools.`;
|
|
14
|
+
if (SUBAGENT_MEMORY_TOOL_NAMES.has(name)) {
|
|
15
|
+
return `Tool name "${name}" is reserved for the built-in sub-agent memory tools.`;
|
|
16
|
+
}
|
|
17
|
+
if (ISSUE_TRACKER_TOOL_NAMES.has(name))
|
|
18
|
+
return `Tool name "${name}" is reserved for the built-in Jira tools.`;
|
|
19
|
+
if (name.startsWith(DELEGATE_TOOL_PREFIX)) {
|
|
20
|
+
return `Tool names starting with "${DELEGATE_TOOL_PREFIX}" are reserved for sub-agent delegation tools.`;
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
/** Names appearing more than once, each reported once, in first-seen order. */
|
|
25
|
+
export function duplicateToolNames(names) {
|
|
26
|
+
const seen = new Set();
|
|
27
|
+
const duplicates = new Set();
|
|
28
|
+
for (const name of names) {
|
|
29
|
+
if (seen.has(name))
|
|
30
|
+
duplicates.add(name);
|
|
31
|
+
seen.add(name);
|
|
32
|
+
}
|
|
33
|
+
return [...duplicates];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A tool other than `tool` that is already attached to `agentId` under the
|
|
37
|
+
* same name, or null. Run it inside the attaching transaction (attach_tool's
|
|
38
|
+
* is Serializable) so a concurrent attach can't slip in between.
|
|
39
|
+
*/
|
|
40
|
+
export async function findSameNamedAttachedTool(db, agentId, tool) {
|
|
41
|
+
const clash = await db.agentTool.findFirst({
|
|
42
|
+
where: { agentId, toolId: { not: tool.id }, tool: { name: tool.name } },
|
|
43
|
+
select: { tool: { select: { id: true, name: true, ownerId: true } } },
|
|
44
|
+
});
|
|
45
|
+
return clash?.tool ?? null;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Resolves a CLI tool reference: an id, else a name. A name is no longer
|
|
49
|
+
* unique across owners, so more than one match is refused -- with the
|
|
50
|
+
* candidate ids, so the operator can pass one -- rather than guessed at.
|
|
51
|
+
*/
|
|
52
|
+
export async function resolveToolRef(db, ref) {
|
|
53
|
+
const byId = await db.tool.findUnique({ where: { id: ref } });
|
|
54
|
+
if (byId)
|
|
55
|
+
return { ok: true, tool: byId };
|
|
56
|
+
const byName = await db.tool.findMany({ where: { name: ref } });
|
|
57
|
+
if (byName.length === 0)
|
|
58
|
+
return { ok: false, error: `unknown tool "${ref}".` };
|
|
59
|
+
if (byName.length > 1) {
|
|
60
|
+
const candidates = byName.map((t) => `${t.id} (owner: ${t.ownerId ?? "public"})`).join(", ");
|
|
61
|
+
return {
|
|
62
|
+
ok: false,
|
|
63
|
+
error: `ambiguous: ${byName.length} tools named "${ref}"; pass the tool id instead (${candidates}).`,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return { ok: true, tool: byName[0] };
|
|
67
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one place untrusted text is fenced for the model. Tool results
|
|
3
|
+
* (engine-native.ts) and a run's untrusted context (the parts of a trigger
|
|
4
|
+
* nobody vetted, e.g. a GitHub issue's title and description) are delivered
|
|
5
|
+
* inside wrapper tags; a run's task is fenced in the system prompt by
|
|
6
|
+
* run_task tags (runner.ts). Every one of those tags is only a boundary if
|
|
7
|
+
* the content inside cannot write it, so all wrapped text passes through
|
|
8
|
+
* neutraliseWrapperTags first (H5-6 / E-09).
|
|
9
|
+
*/
|
|
10
|
+
export declare const UNTRUSTED_TOOL_OUTPUT_TAG = "untrusted_tool_output";
|
|
11
|
+
export declare const UNTRUSTED_CONTEXT_TAG = "untrusted_context";
|
|
12
|
+
export declare const RUN_TASK_TAG = "run_task";
|
|
13
|
+
/** Makes every fence-like tag in `content` inert. Idempotent. */
|
|
14
|
+
export declare function neutraliseWrapperTags(content: string): string;
|
|
15
|
+
/** `content` between `<tag>` and `</tag>`, unable to close or reopen either fence itself. */
|
|
16
|
+
export declare function wrapUntrusted(tag: string, content: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Stores a run's task and its untrusted context in the one Run.taskOverride
|
|
19
|
+
* column: the task, then a wrapped context block. Both parts are
|
|
20
|
+
* neutralised, so the stored text holds exactly one real context opener.
|
|
21
|
+
*/
|
|
22
|
+
export declare function composeTaskOverride(task: string, untrustedContext?: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* The inverse of composeTaskOverride, read by the runner. Everything from the
|
|
25
|
+
* first context opener on is context. A producer that wrote the opener
|
|
26
|
+
* without composeTaskOverride (a webhook caller, a delegating model) can only
|
|
27
|
+
* demote its own text into the untrusted context, never promote any.
|
|
28
|
+
*/
|
|
29
|
+
export declare function splitTaskOverride(taskOverride: string): {
|
|
30
|
+
task: string;
|
|
31
|
+
untrustedContext?: string;
|
|
32
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one place untrusted text is fenced for the model. Tool results
|
|
3
|
+
* (engine-native.ts) and a run's untrusted context (the parts of a trigger
|
|
4
|
+
* nobody vetted, e.g. a GitHub issue's title and description) are delivered
|
|
5
|
+
* inside wrapper tags; a run's task is fenced in the system prompt by
|
|
6
|
+
* run_task tags (runner.ts). Every one of those tags is only a boundary if
|
|
7
|
+
* the content inside cannot write it, so all wrapped text passes through
|
|
8
|
+
* neutraliseWrapperTags first (H5-6 / E-09).
|
|
9
|
+
*/
|
|
10
|
+
export const UNTRUSTED_TOOL_OUTPUT_TAG = "untrusted_tool_output";
|
|
11
|
+
export const UNTRUSTED_CONTEXT_TAG = "untrusted_context";
|
|
12
|
+
export const RUN_TASK_TAG = "run_task";
|
|
13
|
+
/** Invisible characters (zero-width, bidi controls, soft hyphen, variation selectors, tag characters, ...). */
|
|
14
|
+
const IGNORABLE = "\\p{Default_Ignorable_Code_Point}";
|
|
15
|
+
/** "<" and its common lookalikes: fullwidth, small, angle brackets, single guillemet. */
|
|
16
|
+
const BRACKET = "[<\\uFF1C\\uFE64\\u2329\\u3008\\u27E8\\u2039]";
|
|
17
|
+
/** Between the bracket and the name: whitespace, invisibles, and any number of slashes, backslashes or slash lookalikes. */
|
|
18
|
+
const LEAD = `[\\s${IGNORABLE}/\\\\\\uFF0F\\u2215\\u2044\\u29F8]*`;
|
|
19
|
+
/** Between "run" and "task": whitespace, invisibles, "_", "-" and their dash/fullwidth lookalikes. */
|
|
20
|
+
const JOIN = `[\\s${IGNORABLE}_\\-\\u2010-\\u2015\\uFF3F\\uFF0D]*`;
|
|
21
|
+
/** One ASCII letter or its fullwidth form (the `i` flag covers either case). */
|
|
22
|
+
const letter = (ch) => `[${ch}${String.fromCharCode(0xff41 + ch.charCodeAt(0) - 0x61)}]`;
|
|
23
|
+
/** A word whose letters may be separated by invisible characters. */
|
|
24
|
+
const word = (w) => [...w].map(letter).join(`[${IGNORABLE}]*`);
|
|
25
|
+
/**
|
|
26
|
+
* A bracket that could be read as opening or closing one of the fences: a
|
|
27
|
+
* "<" or lookalike, then LEAD, then the start of a fence name ("untrusted…"
|
|
28
|
+
* or "run_task" / "run-task" / "run task"), in any case, with invisible
|
|
29
|
+
* characters or fullwidth letters allowed inside the name. Only the bracket
|
|
30
|
+
* is replaced, with "<", so the rest of the text is unchanged.
|
|
31
|
+
*
|
|
32
|
+
* Linear time (I-1): every starred class is followed by a letter it cannot
|
|
33
|
+
* contain, so it has exactly one way to match, and a failed attempt at one
|
|
34
|
+
* bracket gives back each character at most once. Homoglyphs from other
|
|
35
|
+
* scripts inside the name (a Cyrillic "е") are not caught.
|
|
36
|
+
*/
|
|
37
|
+
const FENCE_TAG_LIKE = new RegExp(`${BRACKET}(?=${LEAD}(?:${word("untrusted")}|${word("run")}${JOIN}${word("task")}))`, "giu");
|
|
38
|
+
/** Makes every fence-like tag in `content` inert. Idempotent. */
|
|
39
|
+
export function neutraliseWrapperTags(content) {
|
|
40
|
+
return content.replace(FENCE_TAG_LIKE, "<");
|
|
41
|
+
}
|
|
42
|
+
/** `content` between `<tag>` and `</tag>`, unable to close or reopen either fence itself. */
|
|
43
|
+
export function wrapUntrusted(tag, content) {
|
|
44
|
+
return `<${tag}>\n${neutraliseWrapperTags(content)}\n</${tag}>`;
|
|
45
|
+
}
|
|
46
|
+
const CONTEXT_OPEN = `<${UNTRUSTED_CONTEXT_TAG}>\n`;
|
|
47
|
+
const CONTEXT_CLOSE = `\n</${UNTRUSTED_CONTEXT_TAG}>`;
|
|
48
|
+
/**
|
|
49
|
+
* Stores a run's task and its untrusted context in the one Run.taskOverride
|
|
50
|
+
* column: the task, then a wrapped context block. Both parts are
|
|
51
|
+
* neutralised, so the stored text holds exactly one real context opener.
|
|
52
|
+
*/
|
|
53
|
+
export function composeTaskOverride(task, untrustedContext) {
|
|
54
|
+
const safeTask = neutraliseWrapperTags(task);
|
|
55
|
+
return untrustedContext ? `${safeTask}\n\n${wrapUntrusted(UNTRUSTED_CONTEXT_TAG, untrustedContext)}` : safeTask;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The inverse of composeTaskOverride, read by the runner. Everything from the
|
|
59
|
+
* first context opener on is context. A producer that wrote the opener
|
|
60
|
+
* without composeTaskOverride (a webhook caller, a delegating model) can only
|
|
61
|
+
* demote its own text into the untrusted context, never promote any.
|
|
62
|
+
*/
|
|
63
|
+
export function splitTaskOverride(taskOverride) {
|
|
64
|
+
const at = taskOverride.startsWith(CONTEXT_OPEN) ? 0 : taskOverride.indexOf(`\n${CONTEXT_OPEN}`);
|
|
65
|
+
if (at < 0)
|
|
66
|
+
return { task: taskOverride };
|
|
67
|
+
const task = taskOverride.slice(0, at).trimEnd();
|
|
68
|
+
let rest = taskOverride.slice(at === 0 ? CONTEXT_OPEN.length : at + 1 + CONTEXT_OPEN.length);
|
|
69
|
+
if (rest.endsWith(CONTEXT_CLOSE))
|
|
70
|
+
rest = rest.slice(0, -CONTEXT_CLOSE.length);
|
|
71
|
+
return { task, untrustedContext: rest };
|
|
72
|
+
}
|
package/dist/core/webhooks.d.ts
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import type { PrismaClient, Webhook } from "#prisma";
|
|
2
2
|
import type { Executor } from "../providers/executor/types.js";
|
|
3
|
+
import type { IssueTrackerRegistry } from "../providers/issue-tracker/types.js";
|
|
3
4
|
export type WebhookMetadata = Pick<Webhook, "id" | "agentId" | "status" | "ownerId" | "createdAt" | "lastFiredAt">;
|
|
4
5
|
/** Creates a webhook and returns the raw secret ONCE — only its hash is ever stored. */
|
|
5
6
|
export declare function createWebhook(agentId: string, ownerId: string, db: PrismaClient): Promise<{
|
|
6
7
|
id: string;
|
|
7
8
|
secret: string;
|
|
8
9
|
}>;
|
|
9
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Webhooks the principal created, plus every webhook on an agent it owns
|
|
12
|
+
* (the agent owner must be able to see standing triggers others hold on
|
|
13
|
+
* its agent). `all` (the stdio operator) lists every webhook.
|
|
14
|
+
*/
|
|
15
|
+
export declare function listWebhooks(principalId: string, db: PrismaClient, opts?: {
|
|
16
|
+
all?: boolean;
|
|
17
|
+
}): Promise<WebhookMetadata[]>;
|
|
10
18
|
export declare function deleteWebhook(id: string, db: PrismaClient): Promise<void>;
|
|
11
19
|
export type ResolveWebhookRunResult = {
|
|
12
20
|
ok: true;
|
|
@@ -14,10 +22,17 @@ export type ResolveWebhookRunResult = {
|
|
|
14
22
|
} | {
|
|
15
23
|
ok: false;
|
|
16
24
|
reason: "not_found" | "invalid_secret" | "disabled";
|
|
25
|
+
} | {
|
|
26
|
+
ok: false;
|
|
27
|
+
reason: "invalid_issue";
|
|
28
|
+
message: string;
|
|
17
29
|
};
|
|
18
30
|
/**
|
|
19
31
|
* Validates the presented secret and, if valid + enabled, enqueues a run via
|
|
20
32
|
* the exact same `createRun` path `trigger_agent`/the scheduler use — the
|
|
21
33
|
* budget guardrail applies identically regardless of what triggered the run.
|
|
22
34
|
*/
|
|
23
|
-
export declare function resolveWebhookRun(id: string, presentedSecret: string, db: PrismaClient, executor: Executor, codingTask?: string
|
|
35
|
+
export declare function resolveWebhookRun(id: string, presentedSecret: string, db: PrismaClient, executor: Executor, codingTask?: string, opts?: {
|
|
36
|
+
issue?: unknown;
|
|
37
|
+
issueTrackers?: IssueTrackerRegistry;
|
|
38
|
+
}): Promise<ResolveWebhookRunResult>;
|
package/dist/core/webhooks.js
CHANGED
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
* is always 32 bytes, so there's no length-mismatch case to special-case).
|
|
10
10
|
*/
|
|
11
11
|
import { createHash, randomBytes, timingSafeEqual } from "node:crypto";
|
|
12
|
+
import { AttributionError, explicitAttribution, RESPONSE_PATH_SNAPSHOT_BUDGET, } from "./attribution.js";
|
|
12
13
|
import { dispatchRun } from "./dispatch.js";
|
|
14
|
+
import { atLeast, effectiveAccess } from "./grants.js";
|
|
13
15
|
function hashSecret(secret) {
|
|
14
16
|
return createHash("sha256").update(secret).digest("hex");
|
|
15
17
|
}
|
|
@@ -39,8 +41,15 @@ export async function createWebhook(agentId, ownerId, db) {
|
|
|
39
41
|
const webhook = await db.webhook.create({ data: { agentId, ownerId, secretHash: hashSecret(secret) } });
|
|
40
42
|
return { id: webhook.id, secret };
|
|
41
43
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Webhooks the principal created, plus every webhook on an agent it owns
|
|
46
|
+
* (the agent owner must be able to see standing triggers others hold on
|
|
47
|
+
* its agent). `all` (the stdio operator) lists every webhook.
|
|
48
|
+
*/
|
|
49
|
+
export async function listWebhooks(principalId, db, opts = {}) {
|
|
50
|
+
const webhooks = await db.webhook.findMany({
|
|
51
|
+
where: opts.all ? {} : { OR: [{ ownerId: principalId }, { agent: { ownerId: principalId } }] },
|
|
52
|
+
});
|
|
44
53
|
return webhooks.map(({ id, agentId, status, ownerId: owner, createdAt, lastFiredAt }) => ({
|
|
45
54
|
id,
|
|
46
55
|
agentId,
|
|
@@ -58,7 +67,7 @@ export async function deleteWebhook(id, db) {
|
|
|
58
67
|
* the exact same `createRun` path `trigger_agent`/the scheduler use — the
|
|
59
68
|
* budget guardrail applies identically regardless of what triggered the run.
|
|
60
69
|
*/
|
|
61
|
-
export async function resolveWebhookRun(id, presentedSecret, db, executor, codingTask) {
|
|
70
|
+
export async function resolveWebhookRun(id, presentedSecret, db, executor, codingTask, opts = {}) {
|
|
62
71
|
const webhook = await db.webhook.findUnique({ where: { id } });
|
|
63
72
|
if (!webhook)
|
|
64
73
|
return { ok: false, reason: "not_found" };
|
|
@@ -72,12 +81,29 @@ export async function resolveWebhookRun(id, presentedSecret, db, executor, codin
|
|
|
72
81
|
if (codingTask !== undefined && !taskAllowed(agent.kind, agent.codingProfile)) {
|
|
73
82
|
return { ok: false, reason: "disabled" };
|
|
74
83
|
}
|
|
84
|
+
// An invalid or unlinked issue refuses the call before any run exists.
|
|
85
|
+
let attribution;
|
|
86
|
+
if (opts.issue !== undefined) {
|
|
87
|
+
try {
|
|
88
|
+
attribution = await explicitAttribution(db, opts.issueTrackers, agent.id, opts.issue, {
|
|
89
|
+
...RESPONSE_PATH_SNAPSHOT_BUDGET,
|
|
90
|
+
field: "wardbyIssue",
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
if (err instanceof AttributionError)
|
|
95
|
+
return { ok: false, reason: "invalid_issue", message: err.message };
|
|
96
|
+
throw err;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
75
99
|
let rejected = "disabled";
|
|
76
100
|
const dispatched = await dispatchRun({
|
|
77
101
|
db,
|
|
78
102
|
executor,
|
|
103
|
+
selfDefects: { db, issueTrackers: opts.issueTrackers },
|
|
79
104
|
agentId: agent.id,
|
|
80
105
|
trigger: "webhook",
|
|
106
|
+
attribution,
|
|
81
107
|
// Coding agents keep the existing per-agent opt-in (allowWebhookTaskOverride);
|
|
82
108
|
// a native agent's system prompt has no per-run input at all otherwise, so
|
|
83
109
|
// accepting task text over an authenticated webhook call needs no separate
|
|
@@ -85,6 +111,9 @@ export async function resolveWebhookRun(id, presentedSecret, db, executor, codin
|
|
|
85
111
|
// to modify a real repository.
|
|
86
112
|
codingTask: agent.kind === "coding" ? codingTask : undefined,
|
|
87
113
|
taskOverride: agent.kind === "native" ? codingTask : undefined,
|
|
114
|
+
// The webhook is its creator's standing trigger: its runs are visible to
|
|
115
|
+
// the creator (and the agent owner), like a trigger_agent call.
|
|
116
|
+
triggeredById: webhook.ownerId,
|
|
88
117
|
beforePersist: async (tx, currentAgent) => {
|
|
89
118
|
const current = await tx.webhook.findUnique({ where: { id } });
|
|
90
119
|
if (!current) {
|
|
@@ -103,6 +132,16 @@ export async function resolveWebhookRun(id, presentedSecret, db, executor, codin
|
|
|
103
132
|
rejected = "disabled";
|
|
104
133
|
return false;
|
|
105
134
|
}
|
|
135
|
+
// The creator must still be allowed to trigger the agent (resource-
|
|
136
|
+
// sharing grants spec §3.10): its owner, or a holder of execute. Read
|
|
137
|
+
// through tx, so a revoke or make_owner takes effect on the next fire.
|
|
138
|
+
// A webhook on a formerly public agent keeps firing through the
|
|
139
|
+
// migration's everyone-execute grant.
|
|
140
|
+
const creatorAccess = await effectiveAccess(tx, "agent", currentAgent, current.ownerId);
|
|
141
|
+
if (!atLeast("agent", creatorAccess, "execute")) {
|
|
142
|
+
rejected = "disabled";
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
106
145
|
await tx.webhook.update({ where: { id }, data: { lastFiredAt: new Date() } });
|
|
107
146
|
return true;
|
|
108
147
|
},
|
|
@@ -111,6 +111,29 @@ export type CodingAgentProfile = Prisma.CodingAgentProfileModel;
|
|
|
111
111
|
* one coding run. Policy is copied from the profile before work starts.
|
|
112
112
|
*/
|
|
113
113
|
export type CodingRun = Prisma.CodingRunModel;
|
|
114
|
+
/**
|
|
115
|
+
* Model CodingService
|
|
116
|
+
* Coding-run services (docs/coding-services.md): the catalog a repository's
|
|
117
|
+
* .wardby/services.yaml names entries from. Admin-managed over MCP
|
|
118
|
+
* (list/get_service: agents:read; create/update/delete_service:
|
|
119
|
+
* services:manage, audit-logged).
|
|
120
|
+
* Built-in rows ship with wardby, seeded by migration, and change only with a
|
|
121
|
+
* wardby release. `kind` is "sidecar" (a fresh instance in each run's pod);
|
|
122
|
+
* "external" is reserved.
|
|
123
|
+
*/
|
|
124
|
+
export type CodingService = Prisma.CodingServiceModel;
|
|
125
|
+
/**
|
|
126
|
+
* Model CodingRunServiceStatus
|
|
127
|
+
* Live start-up state of one coding-run service (one row per run x
|
|
128
|
+
* service), written by the job launcher as it observes the service, for
|
|
129
|
+
* display only (the viewer). The run's CodingRun.services
|
|
130
|
+
* snapshot says what was started; this says how far each one got.
|
|
131
|
+
* `attempts` is the readiness probes made so far, known only where wardby
|
|
132
|
+
* runs the probe itself (Docker); `reason` is a fixed identifier
|
|
133
|
+
* (image_unavailable, start_failed, exited, probe_failed, timed_out),
|
|
134
|
+
* never probe output.
|
|
135
|
+
*/
|
|
136
|
+
export type CodingRunServiceStatus = Prisma.CodingRunServiceStatusModel;
|
|
114
137
|
/**
|
|
115
138
|
* Model CodingProxySession
|
|
116
139
|
* Trusted-boundary state for one coding run. Only a capability digest and an
|
|
@@ -123,6 +146,43 @@ export type CodingProxySession = Prisma.CodingProxySessionModel;
|
|
|
123
146
|
* crash or truncated provider stream can never create new spendable budget.
|
|
124
147
|
*/
|
|
125
148
|
export type CodingProxyRequest = Prisma.CodingProxyRequestModel;
|
|
149
|
+
/**
|
|
150
|
+
* Model RegistryAllowance
|
|
151
|
+
* One package a run's profile has approved from a given ecosystem, resolved
|
|
152
|
+
* once at dispatch (see CodingRun.packageAllowlist) and used to gate every
|
|
153
|
+
* proxy fetch for the run's lifetime.
|
|
154
|
+
*/
|
|
155
|
+
export type RegistryAllowance = Prisma.RegistryAllowanceModel;
|
|
156
|
+
/**
|
|
157
|
+
* Model RegistryFetch
|
|
158
|
+
* Audit ledger of every package fetch the registry proxy served or refused
|
|
159
|
+
* for a run.
|
|
160
|
+
*/
|
|
161
|
+
export type RegistryFetch = Prisma.RegistryFetchModel;
|
|
162
|
+
/**
|
|
163
|
+
* Model RegistryVersionFact
|
|
164
|
+
* Immutable facts about one published package version, read from the
|
|
165
|
+
* registry itself (never from a lockfile) by lockfile verification: its
|
|
166
|
+
* publish time, integrity, download URL and declared dependencies
|
|
167
|
+
* ([{ key, name, range }], aliases resolved). Stored once and reused
|
|
168
|
+
* forever; allow/deny decisions are never cached here.
|
|
169
|
+
*/
|
|
170
|
+
export type RegistryVersionFact = Prisma.RegistryVersionFactModel;
|
|
171
|
+
/**
|
|
172
|
+
* Model RegistryApprovedVersion
|
|
173
|
+
* One exact package version a run's lockfile plan (POST
|
|
174
|
+
* /registry/<ecosystem>/-/plan) verified and approved: a download of it is
|
|
175
|
+
* served directly, integrity-checked against this value.
|
|
176
|
+
*/
|
|
177
|
+
export type RegistryApprovedVersion = Prisma.RegistryApprovedVersionModel;
|
|
178
|
+
/**
|
|
179
|
+
* Model RegistryPlanRefusal
|
|
180
|
+
* One exact package version a run's lockfile plan refused for a reason
|
|
181
|
+
* intrinsic to the registry's name@version (too new, an advisory, not
|
|
182
|
+
* published, no integrity, hosted elsewhere): a download of it is answered
|
|
183
|
+
* from here with the same code and reason, without a graph walk.
|
|
184
|
+
*/
|
|
185
|
+
export type RegistryPlanRefusal = Prisma.RegistryPlanRefusalModel;
|
|
126
186
|
/**
|
|
127
187
|
* Model SchedulerLease
|
|
128
188
|
* Phase 2: single-row-per-scope lease so exactly one scheduler process
|
|
@@ -136,6 +196,16 @@ export type SchedulerLease = Prisma.SchedulerLeaseModel;
|
|
|
136
196
|
* Created on first sight (find-or-create by subject).
|
|
137
197
|
*/
|
|
138
198
|
export type Principal = Prisma.PrincipalModel;
|
|
199
|
+
/**
|
|
200
|
+
* Model ResourceGrant
|
|
201
|
+
* Explicit sharing of one resource with one grantee (docs/private/
|
|
202
|
+
* 2026-09-26-resource-sharing-grants-spec-and-plan.md). Polymorphic on
|
|
203
|
+
* (resourceType, resourceId) -- no FK to the resource, so every resource
|
|
204
|
+
* delete path removes its grants in the same transaction. Levels are
|
|
205
|
+
* ordered per type and validated in code (core/grants.ts), like
|
|
206
|
+
* AgentRepository.provider, so a new type or level needs no enum migration.
|
|
207
|
+
*/
|
|
208
|
+
export type ResourceGrant = Prisma.ResourceGrantModel;
|
|
139
209
|
/**
|
|
140
210
|
* Model Task
|
|
141
211
|
*
|
|
@@ -226,3 +296,99 @@ export type OAuthFamily = Prisma.OAuthFamilyModel;
|
|
|
226
296
|
*
|
|
227
297
|
*/
|
|
228
298
|
export type AuthRateLimit = Prisma.AuthRateLimitModel;
|
|
299
|
+
/**
|
|
300
|
+
* Model AgentRepository
|
|
301
|
+
* Which repositories on which code-review host a native agent may act on,
|
|
302
|
+
* and which host events trigger it. See
|
|
303
|
+
* docs/private/2026-09-25-code-review-host-design.md §4.1.
|
|
304
|
+
*/
|
|
305
|
+
export type AgentRepository = Prisma.AgentRepositoryModel;
|
|
306
|
+
/**
|
|
307
|
+
* Model RunHostCheck
|
|
308
|
+
* The host check a run owns, so the review tool can complete it and the
|
|
309
|
+
* run finalizer can close it if the run ends without publishing.
|
|
310
|
+
*/
|
|
311
|
+
export type RunHostCheck = Prisma.RunHostCheckModel;
|
|
312
|
+
/**
|
|
313
|
+
* Model RunHostStatus
|
|
314
|
+
* De-duplicates host webhook redeliveries; pruned after 7 days.
|
|
315
|
+
* The status comment wardby posts on the issue or pull request whose
|
|
316
|
+
* @-mention started this run ("working on it"), edited with the outcome
|
|
317
|
+
* when the run ends. One per mention run.
|
|
318
|
+
*/
|
|
319
|
+
export type RunHostStatus = Prisma.RunHostStatusModel;
|
|
320
|
+
/**
|
|
321
|
+
* Model HostEventDelivery
|
|
322
|
+
*
|
|
323
|
+
*/
|
|
324
|
+
export type HostEventDelivery = Prisma.HostEventDeliveryModel;
|
|
325
|
+
/**
|
|
326
|
+
* Model HostIdentity
|
|
327
|
+
* A principal's verified identity on a code-review host (GitHub today),
|
|
328
|
+
* linked through the host's user-authorization flow (link_host_account).
|
|
329
|
+
* Only the numeric user id and login are stored, never a user token. A host
|
|
330
|
+
* user belongs to at most one principal.
|
|
331
|
+
*/
|
|
332
|
+
export type HostIdentity = Prisma.HostIdentityModel;
|
|
333
|
+
/**
|
|
334
|
+
* Model HostIdentityLinkRequest
|
|
335
|
+
* An in-flight host identity link (link_host_account): the OAuth state and
|
|
336
|
+
* PKCE verifier, then, after the host's callback, the verified user and the
|
|
337
|
+
* hash of the one-time confirmation code the same principal must submit.
|
|
338
|
+
* Lives 10 minutes.
|
|
339
|
+
*/
|
|
340
|
+
export type HostIdentityLinkRequest = Prisma.HostIdentityLinkRequestModel;
|
|
341
|
+
/**
|
|
342
|
+
* Model AgentIssueProject
|
|
343
|
+
* Which issue-tracker projects (Jira today) a native agent may act on, and
|
|
344
|
+
* which issue events trigger it. Admin-approved in phase 1 (no way to verify
|
|
345
|
+
* an owner's Jira access). See
|
|
346
|
+
* docs/private/2026-09-30-jira-issue-tracker-design.md §3.
|
|
347
|
+
*/
|
|
348
|
+
export type AgentIssueProject = Prisma.AgentIssueProjectModel;
|
|
349
|
+
/**
|
|
350
|
+
* Model IssueFingerprint
|
|
351
|
+
* Dedupe record: an issue wardby created for a fingerprint (several over time — regressions).
|
|
352
|
+
*/
|
|
353
|
+
export type IssueFingerprint = Prisma.IssueFingerprintModel;
|
|
354
|
+
/**
|
|
355
|
+
* Model IssuePullRequest
|
|
356
|
+
* A pull request wardby opened for a tracker issue (the Jira -> code bridge). Provider-neutral on both sides.
|
|
357
|
+
* Deliberately no foreign keys to Agent or Run: audit-style rows that survive agent/run deletion.
|
|
358
|
+
*/
|
|
359
|
+
export type IssuePullRequest = Prisma.IssuePullRequestModel;
|
|
360
|
+
/**
|
|
361
|
+
* Model RunIssueStatus
|
|
362
|
+
* The status comment wardby posts on the Jira issue whose event started this
|
|
363
|
+
* run ("working on it"), edited with the outcome when the run ends.
|
|
364
|
+
*/
|
|
365
|
+
export type RunIssueStatus = Prisma.RunIssueStatusModel;
|
|
366
|
+
/**
|
|
367
|
+
* Model WorkItem
|
|
368
|
+
* Latest known state of an issue/epic in an external tracker (Jira, later
|
|
369
|
+
* Linear). Shared by every run attributed to it; titles are refreshed by the
|
|
370
|
+
* next snapshot, so reports always show current names.
|
|
371
|
+
*/
|
|
372
|
+
export type WorkItem = Prisma.WorkItemModel;
|
|
373
|
+
/**
|
|
374
|
+
* Model RunAttribution
|
|
375
|
+
* Which work item a run's cost belongs to, with its parent frozen as of
|
|
376
|
+
* dispatch. Written in dispatchRun's persist transaction; child runs copy
|
|
377
|
+
* their parent's row (source "inherited"). Control-plane data only.
|
|
378
|
+
*/
|
|
379
|
+
export type RunAttribution = Prisma.RunAttributionModel;
|
|
380
|
+
/**
|
|
381
|
+
* Model RunModelUsage
|
|
382
|
+
* Per-run, per-model usage by priced token kind. Sum of costUsd over a
|
|
383
|
+
* run's rows equals Run.costUsd (to Run.costUsd's 6 decimal places).
|
|
384
|
+
*/
|
|
385
|
+
export type RunModelUsage = Prisma.RunModelUsageModel;
|
|
386
|
+
/**
|
|
387
|
+
* Model ModelCatalogEntry
|
|
388
|
+
* A deployment's override of the shipped model catalog
|
|
389
|
+
* (src/providers/llm/catalog-shipped.ts), written by set_model /
|
|
390
|
+
* disable_model (models:admin). A row fully replaces the shipped entry with
|
|
391
|
+
* the same key; enabled=false removes the model; a row with no shipped match
|
|
392
|
+
* adds one. Rates are the provider's exact published numbers (sourceUrl).
|
|
393
|
+
*/
|
|
394
|
+
export type ModelCatalogEntry = Prisma.ModelCatalogEntryModel;
|