@wardby/cli 0.1.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 +131 -0
- package/LICENSE +202 -0
- package/NOTICE +2 -0
- package/README.md +282 -0
- package/bin/wardby.js +3 -0
- package/deploy/local/docker-compose.yml +19 -0
- package/dist/claude-coding-worker/driver.d.ts +70 -0
- package/dist/claude-coding-worker/driver.js +128 -0
- package/dist/claude-coding-worker/main.d.ts +2 -0
- package/dist/claude-coding-worker/main.js +41 -0
- package/dist/claude-coding-worker/sdk.d.ts +4 -0
- package/dist/claude-coding-worker/sdk.js +43 -0
- package/dist/claude-coding-worker/tool-relay.d.ts +1 -0
- package/dist/claude-coding-worker/tool-relay.js +9 -0
- package/dist/cli-help.d.ts +1 -0
- package/dist/cli-help.js +20 -0
- package/dist/cli.d.ts +18 -0
- package/dist/cli.js +629 -0
- package/dist/coding/observability.d.ts +59 -0
- package/dist/coding/observability.js +77 -0
- package/dist/coding/profile.d.ts +88 -0
- package/dist/coding/profile.js +137 -0
- package/dist/coding/protocol.d.ts +345 -0
- package/dist/coding/protocol.js +445 -0
- package/dist/coding/provider.d.ts +4 -0
- package/dist/coding/provider.js +18 -0
- package/dist/coding-proxy/main.d.ts +1 -0
- package/dist/coding-proxy/main.js +51 -0
- package/dist/coding-worker/artifact.d.ts +16 -0
- package/dist/coding-worker/artifact.js +37 -0
- package/dist/coding-worker/driver.d.ts +46 -0
- package/dist/coding-worker/driver.js +158 -0
- package/dist/coding-worker/errors.d.ts +1 -0
- package/dist/coding-worker/errors.js +23 -0
- package/dist/coding-worker/isolation-probe.d.ts +1 -0
- package/dist/coding-worker/isolation-probe.js +146 -0
- package/dist/coding-worker/keeper.d.ts +4 -0
- package/dist/coding-worker/keeper.js +29 -0
- package/dist/coding-worker/main.d.ts +2 -0
- package/dist/coding-worker/main.js +43 -0
- package/dist/coding-worker/sdk.d.ts +26 -0
- package/dist/coding-worker/sdk.js +28 -0
- package/dist/coding-worker/types.d.ts +64 -0
- package/dist/coding-worker/types.js +1 -0
- package/dist/config/providers.d.ts +158 -0
- package/dist/config/providers.js +162 -0
- package/dist/core/budget-groups.d.ts +72 -0
- package/dist/core/budget-groups.js +149 -0
- package/dist/core/budget.d.ts +63 -0
- package/dist/core/budget.js +69 -0
- package/dist/core/coding-queue.d.ts +32 -0
- package/dist/core/coding-queue.js +54 -0
- package/dist/core/cron.d.ts +31 -0
- package/dist/core/cron.js +43 -0
- package/dist/core/datastores.d.ts +41 -0
- package/dist/core/datastores.js +105 -0
- package/dist/core/db.d.ts +2 -0
- package/dist/core/db.js +2 -0
- package/dist/core/dispatch.d.ts +81 -0
- package/dist/core/dispatch.js +184 -0
- package/dist/core/engine-native.d.ts +29 -0
- package/dist/core/engine-native.js +259 -0
- package/dist/core/http-runtime.d.ts +7 -0
- package/dist/core/http-runtime.js +101 -0
- package/dist/core/lease.d.ts +13 -0
- package/dist/core/lease.js +22 -0
- package/dist/core/logger.d.ts +13 -0
- package/dist/core/logger.js +45 -0
- package/dist/core/memory-tools.d.ts +11 -0
- package/dist/core/memory-tools.js +122 -0
- package/dist/core/reconciler.d.ts +45 -0
- package/dist/core/reconciler.js +152 -0
- package/dist/core/runner.d.ts +87 -0
- package/dist/core/runner.js +529 -0
- package/dist/core/scheduler.d.ts +47 -0
- package/dist/core/scheduler.js +121 -0
- package/dist/core/secrets.d.ts +46 -0
- package/dist/core/secrets.js +100 -0
- package/dist/core/subagent-memory-tools.d.ts +18 -0
- package/dist/core/subagent-memory-tools.js +121 -0
- package/dist/core/timing.d.ts +7 -0
- package/dist/core/timing.js +7 -0
- package/dist/core/webhooks.d.ts +23 -0
- package/dist/core/webhooks.js +113 -0
- package/dist/env.d.ts +11 -0
- package/dist/env.js +13 -0
- package/dist/import/budgets.d.ts +16 -0
- package/dist/import/budgets.js +21 -0
- package/dist/import/bundle.d.ts +16 -0
- package/dist/import/bundle.js +61 -0
- package/dist/import/cli-args.d.ts +2 -0
- package/dist/import/cli-args.js +44 -0
- package/dist/import/create.d.ts +34 -0
- package/dist/import/create.js +363 -0
- package/dist/import/index.d.ts +25 -0
- package/dist/import/index.js +130 -0
- package/dist/import/model-gate.d.ts +1 -0
- package/dist/import/model-gate.js +3 -0
- package/dist/import/neutral-schema.d.ts +369 -0
- package/dist/import/neutral-schema.js +109 -0
- package/dist/import/preflight.d.ts +41 -0
- package/dist/import/preflight.js +71 -0
- package/dist/import/report.d.ts +5 -0
- package/dist/import/report.js +98 -0
- package/dist/import/tool-scan.d.ts +8 -0
- package/dist/import/tool-scan.js +20 -0
- package/dist/mcp/auth/ownership.d.ts +113 -0
- package/dist/mcp/auth/ownership.js +87 -0
- package/dist/mcp/auth/principal.d.ts +9 -0
- package/dist/mcp/auth/principal.js +9 -0
- package/dist/mcp/auth/resource-server.d.ts +47 -0
- package/dist/mcp/auth/resource-server.js +82 -0
- package/dist/mcp/auth/self-hosted/browser.d.ts +3 -0
- package/dist/mcp/auth/self-hosted/browser.js +273 -0
- package/dist/mcp/auth/self-hosted/cli.d.ts +2 -0
- package/dist/mcp/auth/self-hosted/cli.js +39 -0
- package/dist/mcp/auth/self-hosted/credentials.d.ts +58 -0
- package/dist/mcp/auth/self-hosted/credentials.js +106 -0
- package/dist/mcp/auth/self-hosted/rate-limit.d.ts +13 -0
- package/dist/mcp/auth/self-hosted/rate-limit.js +20 -0
- package/dist/mcp/auth/self-hosted/session.d.ts +36 -0
- package/dist/mcp/auth/self-hosted/session.js +110 -0
- package/dist/mcp/capabilities.d.ts +11 -0
- package/dist/mcp/capabilities.js +10 -0
- package/dist/mcp/context.d.ts +46 -0
- package/dist/mcp/context.js +1 -0
- package/dist/mcp/errors.d.ts +13 -0
- package/dist/mcp/errors.js +22 -0
- package/dist/mcp/index.d.ts +32 -0
- package/dist/mcp/index.js +187 -0
- package/dist/mcp/jsonrpc.d.ts +8 -0
- package/dist/mcp/jsonrpc.js +1 -0
- package/dist/mcp/server.d.ts +107 -0
- package/dist/mcp/server.js +203 -0
- package/dist/mcp/tasks/manager.d.ts +63 -0
- package/dist/mcp/tasks/manager.js +103 -0
- package/dist/mcp/tools/agents.d.ts +2 -0
- package/dist/mcp/tools/agents.js +375 -0
- package/dist/mcp/tools/budget-groups.d.ts +2 -0
- package/dist/mcp/tools/budget-groups.js +136 -0
- package/dist/mcp/tools/datastore.d.ts +2 -0
- package/dist/mcp/tools/datastore.js +217 -0
- package/dist/mcp/tools/memory.d.ts +3 -0
- package/dist/mcp/tools/memory.js +60 -0
- package/dist/mcp/tools/models.d.ts +8 -0
- package/dist/mcp/tools/models.js +15 -0
- package/dist/mcp/tools/runs.d.ts +2 -0
- package/dist/mcp/tools/runs.js +61 -0
- package/dist/mcp/tools/scheduling.d.ts +2 -0
- package/dist/mcp/tools/scheduling.js +48 -0
- package/dist/mcp/tools/secret-elicitation-form.d.ts +22 -0
- package/dist/mcp/tools/secret-elicitation-form.js +93 -0
- package/dist/mcp/tools/secret-elicitation-server.d.ts +5 -0
- package/dist/mcp/tools/secret-elicitation-server.js +57 -0
- package/dist/mcp/tools/secret-elicitation.d.ts +38 -0
- package/dist/mcp/tools/secret-elicitation.js +52 -0
- package/dist/mcp/tools/secrets.d.ts +13 -0
- package/dist/mcp/tools/secrets.js +124 -0
- package/dist/mcp/tools/subagents.d.ts +2 -0
- package/dist/mcp/tools/subagents.js +133 -0
- package/dist/mcp/tools/text-result.d.ts +6 -0
- package/dist/mcp/tools/text-result.js +3 -0
- package/dist/mcp/tools/tools.d.ts +2 -0
- package/dist/mcp/tools/tools.js +211 -0
- package/dist/mcp/tools/trigger.d.ts +2 -0
- package/dist/mcp/tools/trigger.js +120 -0
- package/dist/mcp/tools/webhooks.d.ts +2 -0
- package/dist/mcp/tools/webhooks.js +34 -0
- package/dist/mcp/transport/http-limits.d.ts +17 -0
- package/dist/mcp/transport/http-limits.js +92 -0
- package/dist/mcp/transport/stdio.d.ts +23 -0
- package/dist/mcp/transport/stdio.js +6 -0
- package/dist/mcp/transport/streamable-http.d.ts +34 -0
- package/dist/mcp/transport/streamable-http.js +158 -0
- package/dist/mcp/unattended-schedules.d.ts +15 -0
- package/dist/mcp/unattended-schedules.js +21 -0
- package/dist/mcp/webhooks/ingress.d.ts +17 -0
- package/dist/mcp/webhooks/ingress.js +33 -0
- package/dist/observability/config.d.ts +6 -0
- package/dist/observability/config.js +20 -0
- package/dist/observability/metrics-server.d.ts +11 -0
- package/dist/observability/metrics-server.js +47 -0
- package/dist/observability/metrics.d.ts +36 -0
- package/dist/observability/metrics.js +158 -0
- package/dist/providers/auth/authorization-server.d.ts +41 -0
- package/dist/providers/auth/authorization-server.js +1 -0
- package/dist/providers/auth/delegating.d.ts +44 -0
- package/dist/providers/auth/delegating.js +105 -0
- package/dist/providers/auth/index.d.ts +11 -0
- package/dist/providers/auth/index.js +20 -0
- package/dist/providers/auth/release-gate.d.ts +1 -0
- package/dist/providers/auth/release-gate.js +4 -0
- package/dist/providers/auth/self-hosted.d.ts +78 -0
- package/dist/providers/auth/self-hosted.js +377 -0
- package/dist/providers/auth/subject.d.ts +1 -0
- package/dist/providers/auth/subject.js +6 -0
- package/dist/providers/auth/types.d.ts +63 -0
- package/dist/providers/auth/types.js +22 -0
- package/dist/providers/coding-proxy/deny-port.d.ts +5 -0
- package/dist/providers/coding-proxy/deny-port.js +45 -0
- package/dist/providers/coding-proxy/environment-credentials.d.ts +7 -0
- package/dist/providers/coding-proxy/environment-credentials.js +16 -0
- package/dist/providers/coding-proxy/index.d.ts +7 -0
- package/dist/providers/coding-proxy/index.js +7 -0
- package/dist/providers/coding-proxy/memory-ledger.d.ts +17 -0
- package/dist/providers/coding-proxy/memory-ledger.js +103 -0
- package/dist/providers/coding-proxy/metering.d.ts +20 -0
- package/dist/providers/coding-proxy/metering.js +161 -0
- package/dist/providers/coding-proxy/prisma-ledger.d.ts +15 -0
- package/dist/providers/coding-proxy/prisma-ledger.js +213 -0
- package/dist/providers/coding-proxy/proxy.d.ts +75 -0
- package/dist/providers/coding-proxy/proxy.js +721 -0
- package/dist/providers/coding-proxy/runtime.d.ts +18 -0
- package/dist/providers/coding-proxy/runtime.js +39 -0
- package/dist/providers/coding-proxy/secure-fetch.d.ts +9 -0
- package/dist/providers/coding-proxy/secure-fetch.js +72 -0
- package/dist/providers/coding-proxy/server.d.ts +17 -0
- package/dist/providers/coding-proxy/server.js +139 -0
- package/dist/providers/coding-proxy/types.d.ts +99 -0
- package/dist/providers/coding-proxy/types.js +1 -0
- package/dist/providers/datastore/index.d.ts +2 -0
- package/dist/providers/datastore/index.js +2 -0
- package/dist/providers/datastore/postgres.d.ts +20 -0
- package/dist/providers/datastore/postgres.js +130 -0
- package/dist/providers/datastore/scoped.d.ts +10 -0
- package/dist/providers/datastore/scoped.js +46 -0
- package/dist/providers/datastore/types.d.ts +31 -0
- package/dist/providers/datastore/types.js +7 -0
- package/dist/providers/email/types.d.ts +46 -0
- package/dist/providers/email/types.js +8 -0
- package/dist/providers/engine/index.d.ts +1 -0
- package/dist/providers/engine/index.js +1 -0
- package/dist/providers/engine/types.d.ts +67 -0
- package/dist/providers/engine/types.js +16 -0
- package/dist/providers/executor/build.d.ts +6 -0
- package/dist/providers/executor/build.js +15 -0
- package/dist/providers/executor/composition.d.ts +14 -0
- package/dist/providers/executor/composition.js +123 -0
- package/dist/providers/executor/container.d.ts +184 -0
- package/dist/providers/executor/container.js +936 -0
- package/dist/providers/executor/dbos-status.d.ts +50 -0
- package/dist/providers/executor/dbos-status.js +64 -0
- package/dist/providers/executor/dbos.d.ts +53 -0
- package/dist/providers/executor/dbos.js +269 -0
- package/dist/providers/executor/in-process.d.ts +18 -0
- package/dist/providers/executor/in-process.js +38 -0
- package/dist/providers/executor/index.d.ts +8 -0
- package/dist/providers/executor/index.js +8 -0
- package/dist/providers/executor/routing.d.ts +48 -0
- package/dist/providers/executor/routing.js +70 -0
- package/dist/providers/executor/types.d.ts +55 -0
- package/dist/providers/executor/types.js +1 -0
- package/dist/providers/index.d.ts +43 -0
- package/dist/providers/index.js +18 -0
- package/dist/providers/jobs/docker-isolation.d.ts +166 -0
- package/dist/providers/jobs/docker-isolation.js +724 -0
- package/dist/providers/jobs/docker.d.ts +127 -0
- package/dist/providers/jobs/docker.js +1027 -0
- package/dist/providers/jobs/fake-kubernetes-api.d.ts +98 -0
- package/dist/providers/jobs/fake-kubernetes-api.js +142 -0
- package/dist/providers/jobs/fake.d.ts +23 -0
- package/dist/providers/jobs/fake.js +132 -0
- package/dist/providers/jobs/kubernetes-api.d.ts +60 -0
- package/dist/providers/jobs/kubernetes-api.js +20 -0
- package/dist/providers/jobs/kubernetes-client.d.ts +36 -0
- package/dist/providers/jobs/kubernetes-client.js +171 -0
- package/dist/providers/jobs/kubernetes-dry-run-fixture.d.ts +49 -0
- package/dist/providers/jobs/kubernetes-dry-run-fixture.js +141 -0
- package/dist/providers/jobs/kubernetes-isolation.d.ts +147 -0
- package/dist/providers/jobs/kubernetes-isolation.js +607 -0
- package/dist/providers/jobs/kubernetes-platform.d.ts +177 -0
- package/dist/providers/jobs/kubernetes-platform.js +280 -0
- package/dist/providers/jobs/kubernetes-preflight.d.ts +59 -0
- package/dist/providers/jobs/kubernetes-preflight.js +339 -0
- package/dist/providers/jobs/kubernetes-witness.d.ts +10 -0
- package/dist/providers/jobs/kubernetes-witness.js +193 -0
- package/dist/providers/jobs/kubernetes.d.ts +127 -0
- package/dist/providers/jobs/kubernetes.js +874 -0
- package/dist/providers/jobs/safe-extract.d.ts +9 -0
- package/dist/providers/jobs/safe-extract.js +325 -0
- package/dist/providers/jobs/types.d.ts +78 -0
- package/dist/providers/jobs/types.js +6 -0
- package/dist/providers/jobs/workspace-swap.d.ts +2 -0
- package/dist/providers/jobs/workspace-swap.js +47 -0
- package/dist/providers/llm/anthropic.d.ts +13 -0
- package/dist/providers/llm/anthropic.js +21 -0
- package/dist/providers/llm/bedrock.d.ts +19 -0
- package/dist/providers/llm/bedrock.js +33 -0
- package/dist/providers/llm/claude-messages.d.ts +106 -0
- package/dist/providers/llm/claude-messages.js +157 -0
- package/dist/providers/llm/claude-provider.d.ts +40 -0
- package/dist/providers/llm/claude-provider.js +31 -0
- package/dist/providers/llm/index.d.ts +10 -0
- package/dist/providers/llm/index.js +10 -0
- package/dist/providers/llm/openai.d.ts +23 -0
- package/dist/providers/llm/openai.js +156 -0
- package/dist/providers/llm/pricing-anthropic.d.ts +4 -0
- package/dist/providers/llm/pricing-anthropic.js +30 -0
- package/dist/providers/llm/pricing-bedrock-claude.d.ts +12 -0
- package/dist/providers/llm/pricing-bedrock-claude.js +37 -0
- package/dist/providers/llm/pricing-core.d.ts +26 -0
- package/dist/providers/llm/pricing-core.js +17 -0
- package/dist/providers/llm/pricing.d.ts +30 -0
- package/dist/providers/llm/pricing.js +74 -0
- package/dist/providers/llm/registration.d.ts +8 -0
- package/dist/providers/llm/registration.js +39 -0
- package/dist/providers/llm/routing.d.ts +25 -0
- package/dist/providers/llm/routing.js +32 -0
- package/dist/providers/llm/types.d.ts +85 -0
- package/dist/providers/llm/types.js +12 -0
- package/dist/providers/memory/index.d.ts +2 -0
- package/dist/providers/memory/index.js +2 -0
- package/dist/providers/memory/postgres.d.ts +20 -0
- package/dist/providers/memory/postgres.js +72 -0
- package/dist/providers/memory/types.d.ts +32 -0
- package/dist/providers/memory/types.js +17 -0
- package/dist/providers/secrets/app-key.d.ts +8 -0
- package/dist/providers/secrets/app-key.js +50 -0
- package/dist/providers/secrets/index.d.ts +10 -0
- package/dist/providers/secrets/index.js +13 -0
- package/dist/providers/secrets/transfer-envelope.d.ts +12 -0
- package/dist/providers/secrets/transfer-envelope.js +35 -0
- package/dist/providers/secrets/types.d.ts +18 -0
- package/dist/providers/secrets/types.js +12 -0
- package/dist/providers/storage/types.d.ts +18 -0
- package/dist/providers/storage/types.js +7 -0
- package/dist/providers/vcs/git.d.ts +105 -0
- package/dist/providers/vcs/git.js +710 -0
- package/dist/providers/vcs/github.d.ts +105 -0
- package/dist/providers/vcs/github.js +394 -0
- package/dist/providers/vcs/index.d.ts +6 -0
- package/dist/providers/vcs/index.js +26 -0
- package/dist/providers/vcs/types.d.ts +118 -0
- package/dist/providers/vcs/types.js +1 -0
- package/dist/sandbox/bounded-json.d.ts +2 -0
- package/dist/sandbox/bounded-json.js +36 -0
- package/dist/sandbox/bridge.d.ts +15 -0
- package/dist/sandbox/bridge.js +78 -0
- package/dist/sandbox/eval-core.d.ts +37 -0
- package/dist/sandbox/eval-core.js +159 -0
- package/dist/sandbox/fetch-policy.d.ts +24 -0
- package/dist/sandbox/fetch-policy.js +96 -0
- package/dist/sandbox/generated/zod-to-json-schema.bundle.js +5 -0
- package/dist/sandbox/generated/zod.bundle.js +1 -0
- package/dist/sandbox/host-functions.d.ts +29 -0
- package/dist/sandbox/host-functions.js +168 -0
- package/dist/sandbox/limits.d.ts +39 -0
- package/dist/sandbox/limits.js +39 -0
- package/dist/sandbox/parser-worker/__fixtures__/crash.d.ts +1 -0
- package/dist/sandbox/parser-worker/__fixtures__/crash.js +6 -0
- package/dist/sandbox/parser-worker/__fixtures__/echo.d.ts +1 -0
- package/dist/sandbox/parser-worker/__fixtures__/echo.js +5 -0
- package/dist/sandbox/parser-worker/__fixtures__/reject.d.ts +1 -0
- package/dist/sandbox/parser-worker/__fixtures__/reject.js +5 -0
- package/dist/sandbox/parser-worker/__fixtures__/spin-forever.d.ts +1 -0
- package/dist/sandbox/parser-worker/__fixtures__/spin-forever.js +11 -0
- package/dist/sandbox/parser-worker/pool.d.ts +13 -0
- package/dist/sandbox/parser-worker/pool.js +111 -0
- package/dist/sandbox/parser-worker/worker.d.ts +14 -0
- package/dist/sandbox/parser-worker/worker.js +63 -0
- package/dist/sandbox/pii-redaction.d.ts +1 -0
- package/dist/sandbox/pii-redaction.js +29 -0
- package/dist/sandbox/prelude.d.ts +26 -0
- package/dist/sandbox/prelude.js +408 -0
- package/dist/sandbox/quickjs-module.d.ts +13 -0
- package/dist/sandbox/quickjs-module.js +19 -0
- package/dist/sandbox/run-in-sandbox.d.ts +34 -0
- package/dist/sandbox/run-in-sandbox.js +53 -0
- package/dist/sandbox/safe-fetch.d.ts +26 -0
- package/dist/sandbox/safe-fetch.js +140 -0
- package/dist/sandbox/tool-capabilities.d.ts +66 -0
- package/dist/sandbox/tool-capabilities.js +103 -0
- package/dist/sandbox/zod-params.d.ts +22 -0
- package/dist/sandbox/zod-params.js +60 -0
- package/dist/serve.d.ts +14 -0
- package/dist/serve.js +54 -0
- package/dist/wardby-bin.d.ts +2 -0
- package/dist/wardby-bin.js +20 -0
- package/package.json +123 -0
- package/prisma/migrations/20260905000000_init/migration.sql +34 -0
- package/prisma/migrations/20260905010000_scheduler_durability/migration.sql +31 -0
- package/prisma/migrations/20260905020000_tools_multiturn/migration.sql +47 -0
- package/prisma/migrations/20260905030000_cache_tool_json_schema/migration.sql +13 -0
- package/prisma/migrations/20260906000000_mcp_phase4/migration.sql +115 -0
- package/prisma/migrations/20260906010000_run_final_text/migration.sql +7 -0
- package/prisma/migrations/20260906020000_run_turns/migration.sql +6 -0
- package/prisma/migrations/20260906030000_task_principal_id/migration.sql +5 -0
- package/prisma/migrations/20260906040000_secure_self_hosted_oauth/migration.sql +67 -0
- package/prisma/migrations/20260906050000_phase5_coding_agents/migration.sql +52 -0
- package/prisma/migrations/20260906060000_tool_capability_scoping/migration.sql +22 -0
- package/prisma/migrations/20260906070000_datastore_pii_flag/migration.sql +6 -0
- package/prisma/migrations/20260906080000_secret_elicitation_outcomes/migration.sql +13 -0
- package/prisma/migrations/20260907010000_coding_proxy_ledger/migration.sql +57 -0
- package/prisma/migrations/20260907020000_budget_groups/migration.sql +24 -0
- package/prisma/migrations/20260907030000_coding_webhook_task_override/migration.sql +4 -0
- package/prisma/migrations/20260908010000_run_execution_backend/migration.sql +2 -0
- package/prisma/migrations/20260908020000_coding_run_audit_metadata/migration.sql +7 -0
- package/prisma/migrations/20260910010000_agent_secret_bound_name/migration.sql +16 -0
- package/prisma/migrations/20260911010000_coding_worker_toolchains/migration.sql +5 -0
- package/prisma/migrations/20260912010000_coding_provider_contract/migration.sql +24 -0
- package/prisma/migrations/20260912020000_coding_proxy_protocol/migration.sql +10 -0
- package/prisma/migrations/20260912030000_agent_memory/migration.sql +18 -0
- package/prisma/migrations/20260912040000_named_shared_datastores/migration.sql +68 -0
- package/prisma/migrations/20260913000000_run_trigger_webhook/migration.sql +2 -0
- package/prisma/migrations/20260913010000_agent_sub_agent/migration.sql +32 -0
- package/prisma/migrations/20260913020000_run_task_override/migration.sql +5 -0
- package/prisma/migrations/20260913030000_coding_run_root/migration.sql +11 -0
- package/prisma/migrations/20260922010000_coding_run_queued_at/migration.sql +8 -0
- package/prisma/migrations/20260922020000_coding_workspace_disk/migration.sql +8 -0
- package/prisma/migrations/migration_lock.toml +3 -0
- package/prisma/schema.prisma +723 -0
- package/scripts/git-askpass.sh +11 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { logger } from "../core/logger.js";
|
|
2
|
+
/** A small exporter-neutral aggregate that monitoring adapters can scrape or forward. */
|
|
3
|
+
export class CodingMetrics {
|
|
4
|
+
stages = Object.fromEntries([
|
|
5
|
+
"queued",
|
|
6
|
+
"prepared",
|
|
7
|
+
"launched",
|
|
8
|
+
"running",
|
|
9
|
+
"budget_cutoff",
|
|
10
|
+
"stopping",
|
|
11
|
+
"collected",
|
|
12
|
+
"pull_request_opened",
|
|
13
|
+
"pull_request_updated",
|
|
14
|
+
"terminal",
|
|
15
|
+
"cleanup",
|
|
16
|
+
].map((stage) => [stage, 0]));
|
|
17
|
+
terminalOutcomes = {};
|
|
18
|
+
activeJobs = 0;
|
|
19
|
+
cleanupFailures = 0;
|
|
20
|
+
budgetReservedUsd = 0;
|
|
21
|
+
budgetActualUsd = 0;
|
|
22
|
+
runtimeMsTotal = 0;
|
|
23
|
+
emit(event) {
|
|
24
|
+
this.stages[event.stage] += 1;
|
|
25
|
+
if (event.stage === "launched")
|
|
26
|
+
this.activeJobs += 1;
|
|
27
|
+
if (event.stage === "cleanup") {
|
|
28
|
+
this.activeJobs = Math.max(0, this.activeJobs - 1);
|
|
29
|
+
if (event.cleanupSucceeded === false)
|
|
30
|
+
this.cleanupFailures += 1;
|
|
31
|
+
}
|
|
32
|
+
if (event.stage === "terminal" && event.outcome) {
|
|
33
|
+
this.terminalOutcomes[event.outcome] = (this.terminalOutcomes[event.outcome] ?? 0) + 1;
|
|
34
|
+
}
|
|
35
|
+
if (event.budgetReservedUsd !== undefined)
|
|
36
|
+
this.budgetReservedUsd += event.budgetReservedUsd;
|
|
37
|
+
if (event.budgetActualUsd !== undefined)
|
|
38
|
+
this.budgetActualUsd += event.budgetActualUsd;
|
|
39
|
+
if (event.durationMs !== undefined)
|
|
40
|
+
this.runtimeMsTotal += event.durationMs;
|
|
41
|
+
}
|
|
42
|
+
snapshot() {
|
|
43
|
+
return {
|
|
44
|
+
stages: { ...this.stages },
|
|
45
|
+
terminalOutcomes: { ...this.terminalOutcomes },
|
|
46
|
+
activeJobs: this.activeJobs,
|
|
47
|
+
cleanupFailures: this.cleanupFailures,
|
|
48
|
+
budgetReservedUsd: this.budgetReservedUsd,
|
|
49
|
+
budgetActualUsd: this.budgetActualUsd,
|
|
50
|
+
runtimeMsTotal: this.runtimeMsTotal,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export class PinoCodingRunObserver {
|
|
55
|
+
metrics;
|
|
56
|
+
constructor(metrics = new CodingMetrics()) {
|
|
57
|
+
this.metrics = metrics;
|
|
58
|
+
}
|
|
59
|
+
emit(event) {
|
|
60
|
+
this.metrics.emit(event);
|
|
61
|
+
logger.info({ event: `coding.${event.stage}`, ...event }, "coding run lifecycle");
|
|
62
|
+
}
|
|
63
|
+
snapshot() {
|
|
64
|
+
return this.metrics.snapshot();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/** Default application observer. Production log infrastructure owns retention. */
|
|
68
|
+
export const codingRunObserver = new PinoCodingRunObserver();
|
|
69
|
+
export class InMemoryCodingRunObserver {
|
|
70
|
+
events = [];
|
|
71
|
+
metrics = new CodingMetrics();
|
|
72
|
+
emit(event) {
|
|
73
|
+
const copy = { ...event };
|
|
74
|
+
this.events.push(copy);
|
|
75
|
+
this.metrics.emit(copy);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const MIN_CODING_TIMEOUT_SEC = 60;
|
|
3
|
+
export declare const MAX_CODING_TIMEOUT_SEC = 7200;
|
|
4
|
+
export declare const MAX_ALLOWED_EGRESS_HOSTS = 64;
|
|
5
|
+
export declare const MAX_PROTECTED_PATHS = 128;
|
|
6
|
+
export declare const DEFAULT_PROTECTED_PATHS: readonly [".github/workflows/**", ".github/CODEOWNERS", "CODEOWNERS", "docs/CODEOWNERS"];
|
|
7
|
+
export declare const CodingProfileSchema: z.ZodObject<{
|
|
8
|
+
provider: z.ZodDefault<z.ZodEnum<["codex", "claude-code"]>>;
|
|
9
|
+
repository: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
10
|
+
baseRef: z.ZodDefault<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
11
|
+
defaultTask: z.ZodDefault<z.ZodNullable<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>>>;
|
|
12
|
+
allowWebhookTaskOverride: z.ZodDefault<z.ZodBoolean>;
|
|
13
|
+
timeoutSec: z.ZodDefault<z.ZodNumber>;
|
|
14
|
+
allowedEgress: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>, "many">, string[], string[]>>;
|
|
15
|
+
protectedPaths: z.ZodDefault<z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>, string, string>, "many">, string[], string[]>>;
|
|
16
|
+
toolchain: z.ZodDefault<z.ZodEnum<["node", "node-python"]>>;
|
|
17
|
+
toolchainVersion: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
18
|
+
workerImageRef: z.ZodDefault<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
|
|
19
|
+
workspaceDiskMb: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
|
20
|
+
}, "strict", z.ZodTypeAny, {
|
|
21
|
+
repository: string;
|
|
22
|
+
baseRef: string;
|
|
23
|
+
provider: "codex" | "claude-code";
|
|
24
|
+
defaultTask: string | null;
|
|
25
|
+
allowWebhookTaskOverride: boolean;
|
|
26
|
+
timeoutSec: number;
|
|
27
|
+
allowedEgress: string[];
|
|
28
|
+
protectedPaths: string[];
|
|
29
|
+
toolchain: "node-python" | "node";
|
|
30
|
+
toolchainVersion: string | null;
|
|
31
|
+
workerImageRef: string | null;
|
|
32
|
+
workspaceDiskMb: number | null;
|
|
33
|
+
}, {
|
|
34
|
+
repository: string;
|
|
35
|
+
baseRef?: string | undefined;
|
|
36
|
+
provider?: "codex" | "claude-code" | undefined;
|
|
37
|
+
defaultTask?: string | null | undefined;
|
|
38
|
+
allowWebhookTaskOverride?: boolean | undefined;
|
|
39
|
+
timeoutSec?: number | undefined;
|
|
40
|
+
allowedEgress?: string[] | undefined;
|
|
41
|
+
protectedPaths?: string[] | undefined;
|
|
42
|
+
toolchain?: "node-python" | "node" | undefined;
|
|
43
|
+
toolchainVersion?: string | null | undefined;
|
|
44
|
+
workerImageRef?: string | null | undefined;
|
|
45
|
+
workspaceDiskMb?: number | null | undefined;
|
|
46
|
+
}>;
|
|
47
|
+
export declare const CodingProfilePatchSchema: z.ZodObject<{
|
|
48
|
+
provider: z.ZodOptional<z.ZodEnum<["codex", "claude-code"]>>;
|
|
49
|
+
repository: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
50
|
+
baseRef: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
51
|
+
defaultTask: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>>>;
|
|
52
|
+
allowWebhookTaskOverride: z.ZodOptional<z.ZodBoolean>;
|
|
53
|
+
timeoutSec: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
allowedEgress: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>, string, string>, "many">, string[], string[]>>;
|
|
55
|
+
protectedPaths: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>, string, string>, "many">, string[], string[]>>;
|
|
56
|
+
toolchain: z.ZodOptional<z.ZodEnum<["node", "node-python"]>>;
|
|
57
|
+
toolchainVersion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
58
|
+
workerImageRef: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
|
|
59
|
+
workspaceDiskMb: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
60
|
+
}, "strict", z.ZodTypeAny, {
|
|
61
|
+
repository?: string | undefined;
|
|
62
|
+
baseRef?: string | undefined;
|
|
63
|
+
provider?: "codex" | "claude-code" | undefined;
|
|
64
|
+
defaultTask?: string | null | undefined;
|
|
65
|
+
allowWebhookTaskOverride?: boolean | undefined;
|
|
66
|
+
timeoutSec?: number | undefined;
|
|
67
|
+
allowedEgress?: string[] | undefined;
|
|
68
|
+
protectedPaths?: string[] | undefined;
|
|
69
|
+
toolchain?: "node-python" | "node" | undefined;
|
|
70
|
+
toolchainVersion?: string | null | undefined;
|
|
71
|
+
workerImageRef?: string | null | undefined;
|
|
72
|
+
workspaceDiskMb?: number | null | undefined;
|
|
73
|
+
}, {
|
|
74
|
+
repository?: string | undefined;
|
|
75
|
+
baseRef?: string | undefined;
|
|
76
|
+
provider?: "codex" | "claude-code" | undefined;
|
|
77
|
+
defaultTask?: string | null | undefined;
|
|
78
|
+
allowWebhookTaskOverride?: boolean | undefined;
|
|
79
|
+
timeoutSec?: number | undefined;
|
|
80
|
+
allowedEgress?: string[] | undefined;
|
|
81
|
+
protectedPaths?: string[] | undefined;
|
|
82
|
+
toolchain?: "node-python" | "node" | undefined;
|
|
83
|
+
toolchainVersion?: string | null | undefined;
|
|
84
|
+
workerImageRef?: string | null | undefined;
|
|
85
|
+
workspaceDiskMb?: number | null | undefined;
|
|
86
|
+
}>;
|
|
87
|
+
export type CodingProfile = z.infer<typeof CodingProfileSchema>;
|
|
88
|
+
export type CodingProfilePatch = z.infer<typeof CodingProfilePatchSchema>;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { isIP } from "node:net";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { isImmutableDockerImage } from "../providers/jobs/docker-isolation.js";
|
|
4
|
+
import { MAX_CODING_TASK_BYTES, normalizeGitHubRepository, normalizeGitRef } from "./protocol.js";
|
|
5
|
+
import { CODING_PROVIDERS } from "./provider.js";
|
|
6
|
+
export const MIN_CODING_TIMEOUT_SEC = 60;
|
|
7
|
+
export const MAX_CODING_TIMEOUT_SEC = 7200;
|
|
8
|
+
export const MAX_ALLOWED_EGRESS_HOSTS = 64;
|
|
9
|
+
export const MAX_PROTECTED_PATHS = 128;
|
|
10
|
+
export const DEFAULT_PROTECTED_PATHS = [
|
|
11
|
+
".github/workflows/**",
|
|
12
|
+
".github/CODEOWNERS",
|
|
13
|
+
"CODEOWNERS",
|
|
14
|
+
"docs/CODEOWNERS",
|
|
15
|
+
];
|
|
16
|
+
const MAX_HOST_BYTES = 253;
|
|
17
|
+
const MAX_PROTECTED_PATH_BYTES = 512;
|
|
18
|
+
const INVALID_MULTILINE_CONTROL = /[\u0000\u000B\u000C\u000E-\u001F\u007F]/;
|
|
19
|
+
const INVALID_SINGLE_LINE_CONTROL = /[\u0000-\u001F\u007F]/;
|
|
20
|
+
function byteLength(value) {
|
|
21
|
+
return Buffer.byteLength(value, "utf8");
|
|
22
|
+
}
|
|
23
|
+
const repositorySchema = z
|
|
24
|
+
.string()
|
|
25
|
+
.refine((value) => {
|
|
26
|
+
try {
|
|
27
|
+
normalizeGitHubRepository(value);
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}, "must be a canonical name or uncredentialed github.com repository")
|
|
34
|
+
.transform(normalizeGitHubRepository);
|
|
35
|
+
const baseRefSchema = z
|
|
36
|
+
.string()
|
|
37
|
+
.refine((value) => {
|
|
38
|
+
try {
|
|
39
|
+
normalizeGitRef(value);
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}, "must be a safe branch ref")
|
|
46
|
+
.transform(normalizeGitRef);
|
|
47
|
+
const defaultTaskSchema = z
|
|
48
|
+
.string()
|
|
49
|
+
.refine((value) => byteLength(value) <= MAX_CODING_TASK_BYTES, `must be at most ${MAX_CODING_TASK_BYTES} UTF-8 bytes`)
|
|
50
|
+
.refine((value) => !INVALID_MULTILINE_CONTROL.test(value), "must not contain control characters")
|
|
51
|
+
.refine((value) => value.trim().length > 0, "must not be blank")
|
|
52
|
+
.nullable();
|
|
53
|
+
const egressHostSchema = z
|
|
54
|
+
.string()
|
|
55
|
+
.transform((value) => value.trim().toLowerCase())
|
|
56
|
+
.refine((value) => value.length > 0 && byteLength(value) <= MAX_HOST_BYTES, "must be a bounded hostname")
|
|
57
|
+
.refine((value) => !INVALID_SINGLE_LINE_CONTROL.test(value), "must not contain control characters")
|
|
58
|
+
.refine((value) => isIP(value) === 0, "IP addresses and CIDRs are not allowed")
|
|
59
|
+
.refine((value) => !/^\d+(?:\.\d+){3}$/.test(value), "IP-like hostnames are not allowed")
|
|
60
|
+
.refine((value) => !value.includes("://") &&
|
|
61
|
+
!value.includes("/") &&
|
|
62
|
+
!value.includes("@") &&
|
|
63
|
+
!value.includes(":") &&
|
|
64
|
+
!value.includes("*"), "must be an exact hostname")
|
|
65
|
+
.refine((value) => value !== "localhost" && value.includes("."), "must be a fully qualified hostname")
|
|
66
|
+
.refine((value) => value.split(".").every((label) => /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/.test(label)), "must be a valid ASCII hostname");
|
|
67
|
+
const protectedPathSchema = z
|
|
68
|
+
.string()
|
|
69
|
+
.transform((value) => value.trim())
|
|
70
|
+
.refine((value) => value.length > 0 && byteLength(value) <= MAX_PROTECTED_PATH_BYTES, "must be a bounded path")
|
|
71
|
+
.refine((value) => !INVALID_SINGLE_LINE_CONTROL.test(value), "must not contain control characters")
|
|
72
|
+
.refine((value) => !value.startsWith("/") && !value.startsWith("./") && !value.includes("\\"), "must be a repository-relative POSIX path")
|
|
73
|
+
.refine((value) => !value.split("/").some((part) => part === "" || part === "." || part === ".."), "must not contain empty or traversal components");
|
|
74
|
+
const KNOWN_TOOLCHAINS = ["node", "node-python"];
|
|
75
|
+
const toolchainSchema = z.enum(KNOWN_TOOLCHAINS);
|
|
76
|
+
const toolchainVersionSchema = z.string().trim().min(1).max(32).nullable();
|
|
77
|
+
const workerImageRefSchema = z
|
|
78
|
+
.string()
|
|
79
|
+
.trim()
|
|
80
|
+
.min(1)
|
|
81
|
+
.max(512)
|
|
82
|
+
.refine(isImmutableDockerImage, "must be an immutable repository digest")
|
|
83
|
+
.nullable();
|
|
84
|
+
const workspaceDiskMbSchema = z.number().int().min(64).max(32_768).nullable();
|
|
85
|
+
const codingProfileFields = {
|
|
86
|
+
provider: z.enum(CODING_PROVIDERS),
|
|
87
|
+
repository: repositorySchema,
|
|
88
|
+
baseRef: baseRefSchema,
|
|
89
|
+
defaultTask: defaultTaskSchema,
|
|
90
|
+
allowWebhookTaskOverride: z.boolean(),
|
|
91
|
+
timeoutSec: z.number().int().min(MIN_CODING_TIMEOUT_SEC).max(MAX_CODING_TIMEOUT_SEC),
|
|
92
|
+
toolchain: toolchainSchema,
|
|
93
|
+
toolchainVersion: toolchainVersionSchema,
|
|
94
|
+
workerImageRef: workerImageRefSchema,
|
|
95
|
+
workspaceDiskMb: workspaceDiskMbSchema,
|
|
96
|
+
allowedEgress: z
|
|
97
|
+
.array(egressHostSchema)
|
|
98
|
+
.max(MAX_ALLOWED_EGRESS_HOSTS)
|
|
99
|
+
.transform((hosts) => [...new Set(hosts)]),
|
|
100
|
+
protectedPaths: z
|
|
101
|
+
.array(protectedPathSchema)
|
|
102
|
+
.min(1)
|
|
103
|
+
.max(MAX_PROTECTED_PATHS)
|
|
104
|
+
.transform((paths) => [...new Set(paths)]),
|
|
105
|
+
};
|
|
106
|
+
export const CodingProfileSchema = z
|
|
107
|
+
.object({
|
|
108
|
+
provider: codingProfileFields.provider.default("codex"),
|
|
109
|
+
repository: codingProfileFields.repository,
|
|
110
|
+
baseRef: codingProfileFields.baseRef.default("main"),
|
|
111
|
+
defaultTask: codingProfileFields.defaultTask.default(null),
|
|
112
|
+
allowWebhookTaskOverride: codingProfileFields.allowWebhookTaskOverride.default(false),
|
|
113
|
+
timeoutSec: codingProfileFields.timeoutSec.default(1800),
|
|
114
|
+
allowedEgress: codingProfileFields.allowedEgress.default([]),
|
|
115
|
+
protectedPaths: codingProfileFields.protectedPaths.default([...DEFAULT_PROTECTED_PATHS]),
|
|
116
|
+
toolchain: codingProfileFields.toolchain.default("node"),
|
|
117
|
+
toolchainVersion: codingProfileFields.toolchainVersion.default(null),
|
|
118
|
+
workerImageRef: codingProfileFields.workerImageRef.default(null),
|
|
119
|
+
workspaceDiskMb: codingProfileFields.workspaceDiskMb.default(null),
|
|
120
|
+
})
|
|
121
|
+
.strict();
|
|
122
|
+
export const CodingProfilePatchSchema = z
|
|
123
|
+
.object({
|
|
124
|
+
provider: codingProfileFields.provider.optional(),
|
|
125
|
+
repository: codingProfileFields.repository.optional(),
|
|
126
|
+
baseRef: codingProfileFields.baseRef.optional(),
|
|
127
|
+
defaultTask: codingProfileFields.defaultTask.optional(),
|
|
128
|
+
allowWebhookTaskOverride: codingProfileFields.allowWebhookTaskOverride.optional(),
|
|
129
|
+
timeoutSec: codingProfileFields.timeoutSec.optional(),
|
|
130
|
+
allowedEgress: codingProfileFields.allowedEgress.optional(),
|
|
131
|
+
protectedPaths: codingProfileFields.protectedPaths.optional(),
|
|
132
|
+
toolchain: codingProfileFields.toolchain.optional(),
|
|
133
|
+
toolchainVersion: codingProfileFields.toolchainVersion.optional(),
|
|
134
|
+
workerImageRef: codingProfileFields.workerImageRef.optional(),
|
|
135
|
+
workspaceDiskMb: codingProfileFields.workspaceDiskMb.optional(),
|
|
136
|
+
})
|
|
137
|
+
.strict();
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const CODING_PROTOCOL_VERSION: 1;
|
|
3
|
+
export declare const MAX_CODING_ARTIFACT_BYTES: number;
|
|
4
|
+
export declare const MAX_CODING_TASK_BYTES: number;
|
|
5
|
+
export declare const MAX_CODING_SUMMARY_BYTES: number;
|
|
6
|
+
export declare const MAX_CODING_TESTS = 64;
|
|
7
|
+
export declare const MAX_CODING_TEST_COMMAND_BYTES: number;
|
|
8
|
+
export declare const MAX_TAG_BYTES = 32;
|
|
9
|
+
export declare function normalizeGitHubRepository(value: string): string;
|
|
10
|
+
export declare function normalizeGitRef(value: string): string;
|
|
11
|
+
export declare const CodingBaseRefSchema: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
12
|
+
export declare const CodingTaskOverrideSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
13
|
+
export declare const CodingTaskInputSchema: z.ZodEffects<z.ZodObject<{
|
|
14
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
15
|
+
runId: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>;
|
|
16
|
+
repository: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
17
|
+
baseRef: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
18
|
+
headRef: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
19
|
+
task: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
20
|
+
model: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>;
|
|
21
|
+
budgetUsd: z.ZodNumber;
|
|
22
|
+
deadlineAt: z.ZodString;
|
|
23
|
+
/**
|
|
24
|
+
* Revision-in-place: set when this run pushes a new commit onto the
|
|
25
|
+
* branch/PR the named run
|
|
26
|
+
* (the thread's ROOT CodingRun, always -- never a chain) originally
|
|
27
|
+
* opened, instead of opening a fresh branch of its own. Resolved and
|
|
28
|
+
* verified server-side (dispatch.ts) against the database; this schema
|
|
29
|
+
* only enforces that headRef is internally consistent with it.
|
|
30
|
+
*/
|
|
31
|
+
continuationOf: z.ZodOptional<z.ZodObject<{
|
|
32
|
+
runId: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>;
|
|
33
|
+
}, "strict", z.ZodTypeAny, {
|
|
34
|
+
runId: string;
|
|
35
|
+
}, {
|
|
36
|
+
runId: string;
|
|
37
|
+
}>>;
|
|
38
|
+
}, "strict", z.ZodTypeAny, {
|
|
39
|
+
repository: string;
|
|
40
|
+
schemaVersion: 1;
|
|
41
|
+
runId: string;
|
|
42
|
+
baseRef: string;
|
|
43
|
+
headRef: string;
|
|
44
|
+
task: string;
|
|
45
|
+
model: string;
|
|
46
|
+
budgetUsd: number;
|
|
47
|
+
deadlineAt: string;
|
|
48
|
+
continuationOf?: {
|
|
49
|
+
runId: string;
|
|
50
|
+
} | undefined;
|
|
51
|
+
}, {
|
|
52
|
+
repository: string;
|
|
53
|
+
schemaVersion: 1;
|
|
54
|
+
runId: string;
|
|
55
|
+
baseRef: string;
|
|
56
|
+
headRef: string;
|
|
57
|
+
task: string;
|
|
58
|
+
model: string;
|
|
59
|
+
budgetUsd: number;
|
|
60
|
+
deadlineAt: string;
|
|
61
|
+
continuationOf?: {
|
|
62
|
+
runId: string;
|
|
63
|
+
} | undefined;
|
|
64
|
+
}>, {
|
|
65
|
+
repository: string;
|
|
66
|
+
schemaVersion: 1;
|
|
67
|
+
runId: string;
|
|
68
|
+
baseRef: string;
|
|
69
|
+
headRef: string;
|
|
70
|
+
task: string;
|
|
71
|
+
model: string;
|
|
72
|
+
budgetUsd: number;
|
|
73
|
+
deadlineAt: string;
|
|
74
|
+
continuationOf?: {
|
|
75
|
+
runId: string;
|
|
76
|
+
} | undefined;
|
|
77
|
+
}, {
|
|
78
|
+
repository: string;
|
|
79
|
+
schemaVersion: 1;
|
|
80
|
+
runId: string;
|
|
81
|
+
baseRef: string;
|
|
82
|
+
headRef: string;
|
|
83
|
+
task: string;
|
|
84
|
+
model: string;
|
|
85
|
+
budgetUsd: number;
|
|
86
|
+
deadlineAt: string;
|
|
87
|
+
continuationOf?: {
|
|
88
|
+
runId: string;
|
|
89
|
+
} | undefined;
|
|
90
|
+
}>;
|
|
91
|
+
export declare const CodingAgentOutputSchema: z.ZodEffects<z.ZodObject<{
|
|
92
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
93
|
+
runId: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>, string, string>;
|
|
94
|
+
outcome: z.ZodEnum<["changes_ready", "no_changes", "budget_exhausted"]>;
|
|
95
|
+
summary: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
96
|
+
tests: z.ZodArray<z.ZodObject<{
|
|
97
|
+
command: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
98
|
+
outcome: z.ZodEnum<["passed", "failed", "skipped"]>;
|
|
99
|
+
}, "strict", z.ZodTypeAny, {
|
|
100
|
+
command: string;
|
|
101
|
+
outcome: "passed" | "failed" | "skipped";
|
|
102
|
+
}, {
|
|
103
|
+
command: string;
|
|
104
|
+
outcome: "passed" | "failed" | "skipped";
|
|
105
|
+
}>, "many">;
|
|
106
|
+
tag: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | undefined, string | null | undefined>;
|
|
107
|
+
}, "strict", z.ZodTypeAny, {
|
|
108
|
+
outcome: "changes_ready" | "no_changes" | "budget_exhausted";
|
|
109
|
+
schemaVersion: 1;
|
|
110
|
+
runId: string;
|
|
111
|
+
summary: string;
|
|
112
|
+
tests: {
|
|
113
|
+
command: string;
|
|
114
|
+
outcome: "passed" | "failed" | "skipped";
|
|
115
|
+
}[];
|
|
116
|
+
tag?: string | undefined;
|
|
117
|
+
}, {
|
|
118
|
+
outcome: "changes_ready" | "no_changes" | "budget_exhausted";
|
|
119
|
+
schemaVersion: 1;
|
|
120
|
+
runId: string;
|
|
121
|
+
summary: string;
|
|
122
|
+
tests: {
|
|
123
|
+
command: string;
|
|
124
|
+
outcome: "passed" | "failed" | "skipped";
|
|
125
|
+
}[];
|
|
126
|
+
tag?: string | null | undefined;
|
|
127
|
+
}>, {
|
|
128
|
+
tag?: string | undefined;
|
|
129
|
+
summary: string;
|
|
130
|
+
tests: {
|
|
131
|
+
command: string;
|
|
132
|
+
outcome: "passed" | "failed" | "skipped";
|
|
133
|
+
}[];
|
|
134
|
+
outcome: "changes_ready" | "no_changes" | "budget_exhausted";
|
|
135
|
+
schemaVersion: 1;
|
|
136
|
+
runId: string;
|
|
137
|
+
}, {
|
|
138
|
+
outcome: "changes_ready" | "no_changes" | "budget_exhausted";
|
|
139
|
+
schemaVersion: 1;
|
|
140
|
+
runId: string;
|
|
141
|
+
summary: string;
|
|
142
|
+
tests: {
|
|
143
|
+
command: string;
|
|
144
|
+
outcome: "passed" | "failed" | "skipped";
|
|
145
|
+
}[];
|
|
146
|
+
tag?: string | null | undefined;
|
|
147
|
+
}>;
|
|
148
|
+
export declare const CodingRunResultSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
149
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
150
|
+
outcome: z.ZodEnum<["pull_request_opened", "pull_request_updated", "no_changes", "budget_exhausted"]>;
|
|
151
|
+
repository: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
152
|
+
baseRef: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
153
|
+
headRef: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
154
|
+
commitSha: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
155
|
+
pullRequestUrl: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
156
|
+
pullRequestNumber: z.ZodOptional<z.ZodNumber>;
|
|
157
|
+
summary: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
158
|
+
tests: z.ZodArray<z.ZodObject<{
|
|
159
|
+
command: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, string, string>;
|
|
160
|
+
outcome: z.ZodEnum<["passed", "failed", "skipped"]>;
|
|
161
|
+
}, "strict", z.ZodTypeAny, {
|
|
162
|
+
command: string;
|
|
163
|
+
outcome: "passed" | "failed" | "skipped";
|
|
164
|
+
}, {
|
|
165
|
+
command: string;
|
|
166
|
+
outcome: "passed" | "failed" | "skipped";
|
|
167
|
+
}>, "many">;
|
|
168
|
+
usage: z.ZodObject<{
|
|
169
|
+
tokensIn: z.ZodNumber;
|
|
170
|
+
tokensOut: z.ZodNumber;
|
|
171
|
+
costUsd: z.ZodNumber;
|
|
172
|
+
}, "strict", z.ZodTypeAny, {
|
|
173
|
+
tokensIn: number;
|
|
174
|
+
tokensOut: number;
|
|
175
|
+
costUsd: number;
|
|
176
|
+
}, {
|
|
177
|
+
tokensIn: number;
|
|
178
|
+
tokensOut: number;
|
|
179
|
+
costUsd: number;
|
|
180
|
+
}>;
|
|
181
|
+
tag: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | undefined, string | null | undefined>;
|
|
182
|
+
}, "strict", z.ZodTypeAny, {
|
|
183
|
+
repository: string;
|
|
184
|
+
outcome: "no_changes" | "budget_exhausted" | "pull_request_opened" | "pull_request_updated";
|
|
185
|
+
schemaVersion: 1;
|
|
186
|
+
baseRef: string;
|
|
187
|
+
summary: string;
|
|
188
|
+
tests: {
|
|
189
|
+
command: string;
|
|
190
|
+
outcome: "passed" | "failed" | "skipped";
|
|
191
|
+
}[];
|
|
192
|
+
usage: {
|
|
193
|
+
tokensIn: number;
|
|
194
|
+
tokensOut: number;
|
|
195
|
+
costUsd: number;
|
|
196
|
+
};
|
|
197
|
+
headRef?: string | undefined;
|
|
198
|
+
tag?: string | undefined;
|
|
199
|
+
commitSha?: string | undefined;
|
|
200
|
+
pullRequestUrl?: string | undefined;
|
|
201
|
+
pullRequestNumber?: number | undefined;
|
|
202
|
+
}, {
|
|
203
|
+
repository: string;
|
|
204
|
+
outcome: "no_changes" | "budget_exhausted" | "pull_request_opened" | "pull_request_updated";
|
|
205
|
+
schemaVersion: 1;
|
|
206
|
+
baseRef: string;
|
|
207
|
+
summary: string;
|
|
208
|
+
tests: {
|
|
209
|
+
command: string;
|
|
210
|
+
outcome: "passed" | "failed" | "skipped";
|
|
211
|
+
}[];
|
|
212
|
+
usage: {
|
|
213
|
+
tokensIn: number;
|
|
214
|
+
tokensOut: number;
|
|
215
|
+
costUsd: number;
|
|
216
|
+
};
|
|
217
|
+
headRef?: string | undefined;
|
|
218
|
+
tag?: string | null | undefined;
|
|
219
|
+
commitSha?: string | undefined;
|
|
220
|
+
pullRequestUrl?: string | undefined;
|
|
221
|
+
pullRequestNumber?: number | undefined;
|
|
222
|
+
}>, {
|
|
223
|
+
repository: string;
|
|
224
|
+
outcome: "no_changes" | "budget_exhausted" | "pull_request_opened" | "pull_request_updated";
|
|
225
|
+
schemaVersion: 1;
|
|
226
|
+
baseRef: string;
|
|
227
|
+
summary: string;
|
|
228
|
+
tests: {
|
|
229
|
+
command: string;
|
|
230
|
+
outcome: "passed" | "failed" | "skipped";
|
|
231
|
+
}[];
|
|
232
|
+
usage: {
|
|
233
|
+
tokensIn: number;
|
|
234
|
+
tokensOut: number;
|
|
235
|
+
costUsd: number;
|
|
236
|
+
};
|
|
237
|
+
headRef?: string | undefined;
|
|
238
|
+
tag?: string | undefined;
|
|
239
|
+
commitSha?: string | undefined;
|
|
240
|
+
pullRequestUrl?: string | undefined;
|
|
241
|
+
pullRequestNumber?: number | undefined;
|
|
242
|
+
}, {
|
|
243
|
+
repository: string;
|
|
244
|
+
outcome: "no_changes" | "budget_exhausted" | "pull_request_opened" | "pull_request_updated";
|
|
245
|
+
schemaVersion: 1;
|
|
246
|
+
baseRef: string;
|
|
247
|
+
summary: string;
|
|
248
|
+
tests: {
|
|
249
|
+
command: string;
|
|
250
|
+
outcome: "passed" | "failed" | "skipped";
|
|
251
|
+
}[];
|
|
252
|
+
usage: {
|
|
253
|
+
tokensIn: number;
|
|
254
|
+
tokensOut: number;
|
|
255
|
+
costUsd: number;
|
|
256
|
+
};
|
|
257
|
+
headRef?: string | undefined;
|
|
258
|
+
tag?: string | null | undefined;
|
|
259
|
+
commitSha?: string | undefined;
|
|
260
|
+
pullRequestUrl?: string | undefined;
|
|
261
|
+
pullRequestNumber?: number | undefined;
|
|
262
|
+
}>, {
|
|
263
|
+
tag?: string | undefined;
|
|
264
|
+
summary: string;
|
|
265
|
+
tests: {
|
|
266
|
+
command: string;
|
|
267
|
+
outcome: "passed" | "failed" | "skipped";
|
|
268
|
+
}[];
|
|
269
|
+
repository: string;
|
|
270
|
+
outcome: "no_changes" | "budget_exhausted" | "pull_request_opened" | "pull_request_updated";
|
|
271
|
+
schemaVersion: 1;
|
|
272
|
+
baseRef: string;
|
|
273
|
+
usage: {
|
|
274
|
+
tokensIn: number;
|
|
275
|
+
tokensOut: number;
|
|
276
|
+
costUsd: number;
|
|
277
|
+
};
|
|
278
|
+
headRef?: string | undefined;
|
|
279
|
+
commitSha?: string | undefined;
|
|
280
|
+
pullRequestUrl?: string | undefined;
|
|
281
|
+
pullRequestNumber?: number | undefined;
|
|
282
|
+
}, {
|
|
283
|
+
repository: string;
|
|
284
|
+
outcome: "no_changes" | "budget_exhausted" | "pull_request_opened" | "pull_request_updated";
|
|
285
|
+
schemaVersion: 1;
|
|
286
|
+
baseRef: string;
|
|
287
|
+
summary: string;
|
|
288
|
+
tests: {
|
|
289
|
+
command: string;
|
|
290
|
+
outcome: "passed" | "failed" | "skipped";
|
|
291
|
+
}[];
|
|
292
|
+
usage: {
|
|
293
|
+
tokensIn: number;
|
|
294
|
+
tokensOut: number;
|
|
295
|
+
costUsd: number;
|
|
296
|
+
};
|
|
297
|
+
headRef?: string | undefined;
|
|
298
|
+
tag?: string | null | undefined;
|
|
299
|
+
commitSha?: string | undefined;
|
|
300
|
+
pullRequestUrl?: string | undefined;
|
|
301
|
+
pullRequestNumber?: number | undefined;
|
|
302
|
+
}>;
|
|
303
|
+
export type CodingTaskInput = z.infer<typeof CodingTaskInputSchema>;
|
|
304
|
+
export type CodingAgentOutput = z.infer<typeof CodingAgentOutputSchema>;
|
|
305
|
+
export type CodingRunResult = z.infer<typeof CodingRunResultSchema>;
|
|
306
|
+
/** Parses stored worker output into the only coding result shape callers may receive. */
|
|
307
|
+
export declare function publicCodingRunResult(value: unknown): CodingRunResult | undefined;
|
|
308
|
+
/**
|
|
309
|
+
* The longest span any pattern that needs a trailing anchor can match — URL
|
|
310
|
+
* userinfo (1 061 chars) and a PEM block (6 262). `redactAndTruncate` relies on
|
|
311
|
+
* it: see there. Exported with the patterns themselves so the invariant is
|
|
312
|
+
* TESTED, not merely documented — raising a bound below without raising this
|
|
313
|
+
* fails `protocol.test.ts`'s max-span test rather than silently breaking the
|
|
314
|
+
* window argument.
|
|
315
|
+
*/
|
|
316
|
+
export declare const MAX_REDACTED_SPAN: number;
|
|
317
|
+
/**
|
|
318
|
+
* The patterns that cannot match at all without their trailing anchor (`@`,
|
|
319
|
+
* `-----END …`), which is exactly the property that makes them, and only them,
|
|
320
|
+
* sensitive to the truncation window.
|
|
321
|
+
*/
|
|
322
|
+
export declare const TRAILING_ANCHORED_PATTERNS: {
|
|
323
|
+
urlCredentials: RegExp;
|
|
324
|
+
pemPrivateKey: RegExp;
|
|
325
|
+
};
|
|
326
|
+
export declare function redactTokenShapedValues(value: string): string;
|
|
327
|
+
/**
|
|
328
|
+
* Redact, then truncate to `limit` — for callers that keep only a prefix of a
|
|
329
|
+
* potentially huge string (git output is capped at 2 MiB, an error message is
|
|
330
|
+
* unbounded). Redacting first is the security-critical half: truncating first
|
|
331
|
+
* could cut a credential in two and log the front of it.
|
|
332
|
+
*
|
|
333
|
+
* Scanning megabytes to keep 8 KiB is wasted event-loop time, so redaction runs
|
|
334
|
+
* over `limit + MAX_REDACTED_SPAN` characters instead of the whole string. That
|
|
335
|
+
* is safe because a credential with any character inside `limit` lies entirely
|
|
336
|
+
* within that window: the two patterns that need a trailing anchor to match at
|
|
337
|
+
* all (URL userinfo, PEM) are bounded well under `MAX_REDACTED_SPAN`, and every
|
|
338
|
+
* open-ended pattern still matches — and so still redacts — the part of the
|
|
339
|
+
* secret that falls inside the window. Whatever lies beyond the window is
|
|
340
|
+
* dropped, not logged.
|
|
341
|
+
*/
|
|
342
|
+
export declare function redactAndTruncate(value: string, limit: number): string;
|
|
343
|
+
export declare function parseCodingTaskInputJson(text: string): CodingTaskInput;
|
|
344
|
+
export declare function parseCodingAgentOutputJson(text: string): CodingAgentOutput;
|
|
345
|
+
export declare function parseCodingRunResultJson(text: string): CodingRunResult;
|