@wardby/cli 0.5.3 → 0.6.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 +33 -0
- package/README.md +25 -14
- package/dist/claude-coding-worker/context.d.ts +22 -0
- package/dist/claude-coding-worker/context.js +92 -0
- package/dist/claude-coding-worker/driver.d.ts +7 -1
- package/dist/claude-coding-worker/driver.js +38 -5
- package/dist/claude-coding-worker/sdk.js +13 -4
- package/dist/cli-help.d.ts +1 -1
- package/dist/cli-help.js +5 -2
- package/dist/cli-native-mode.d.ts +9 -0
- package/dist/cli-native-mode.js +20 -0
- package/dist/cli.d.ts +3 -1
- package/dist/cli.js +141 -5
- package/dist/coding/claude-context.d.ts +45 -0
- package/dist/coding/claude-context.js +434 -0
- package/dist/coding/profile.d.ts +12 -0
- package/dist/coding/profile.js +6 -0
- package/dist/coding/protocol.d.ts +104 -0
- package/dist/coding/protocol.js +87 -3
- package/dist/coding-worker/artifact.d.ts +8 -0
- package/dist/coding-worker/artifact.js +2 -2
- package/dist/coding-worker/driver.js +2 -0
- package/dist/coding-worker/sdk.d.ts +6 -0
- package/dist/coding-worker/sdk.js +1 -0
- package/dist/coding-worker/skills.d.ts +23 -0
- package/dist/coding-worker/skills.js +117 -0
- package/dist/coding-worker/types.d.ts +2 -0
- package/dist/config/github-allowed-accounts.d.ts +15 -0
- package/dist/config/github-allowed-accounts.js +36 -0
- package/dist/config/low-power.d.ts +12 -0
- package/dist/config/low-power.js +18 -0
- package/dist/config/mobile.d.ts +12 -0
- package/dist/config/mobile.js +18 -0
- package/dist/config/providers.d.ts +53 -0
- package/dist/config/providers.js +92 -6
- package/dist/core/db.d.ts +16 -6
- package/dist/core/db.js +12 -10
- package/dist/core/dispatch.d.ts +11 -0
- package/dist/core/dispatch.js +36 -1
- package/dist/core/engine-native.js +9 -5
- package/dist/core/host-events.d.ts +49 -3
- package/dist/core/host-events.js +289 -15
- package/dist/core/issue-bridge.js +42 -2
- package/dist/core/issue-events.js +12 -1
- package/dist/core/issue-status.js +14 -3
- package/dist/core/merge-order-check.d.ts +129 -0
- package/dist/core/merge-order-check.js +336 -0
- package/dist/core/notification-dispatcher.d.ts +70 -0
- package/dist/core/notification-dispatcher.js +368 -0
- package/dist/core/notification-templates.d.ts +25 -0
- package/dist/core/notification-templates.js +105 -0
- package/dist/core/notifications.d.ts +10 -0
- package/dist/core/notifications.js +38 -0
- package/dist/core/pg-auth.d.ts +22 -0
- package/dist/core/pg-auth.js +152 -0
- package/dist/core/power-composition.d.ts +16 -0
- package/dist/core/power-composition.js +37 -0
- package/dist/core/power-idle.d.ts +14 -0
- package/dist/core/power-idle.js +30 -0
- package/dist/core/power.d.ts +71 -0
- package/dist/core/power.js +202 -0
- package/dist/core/reconciler.d.ts +4 -2
- package/dist/core/reconciler.js +29 -5
- package/dist/core/related-pull-requests.d.ts +48 -4
- package/dist/core/related-pull-requests.js +113 -11
- package/dist/core/repo-access.d.ts +15 -0
- package/dist/core/repo-access.js +66 -0
- package/dist/core/review-fix.d.ts +37 -0
- package/dist/core/review-fix.js +207 -6
- package/dist/core/review-host-tools.d.ts +20 -0
- package/dist/core/review-host-tools.js +58 -2
- package/dist/core/runner.d.ts +336 -3
- package/dist/core/runner.js +894 -317
- package/dist/core/secret-broker-config.d.ts +103 -0
- package/dist/core/secret-broker-config.js +112 -0
- package/dist/core/secrets.d.ts +39 -4
- package/dist/core/secrets.js +148 -40
- package/dist/core/workflow-event-recorder.d.ts +14 -0
- package/dist/core/workflow-event-recorder.js +120 -0
- package/dist/core/workflow-events.d.ts +82 -0
- package/dist/core/workflow-events.js +44 -0
- package/dist/core/workflow-run-events.d.ts +16 -0
- package/dist/core/workflow-run-events.js +40 -0
- package/dist/generated/prisma/browser.d.ts +58 -0
- package/dist/generated/prisma/client.d.ts +58 -0
- package/dist/generated/prisma/commonInputTypes.d.ts +150 -0
- package/dist/generated/prisma/enums.d.ts +27 -0
- package/dist/generated/prisma/enums.js +23 -0
- package/dist/generated/prisma/internal/class.d.ts +88 -0
- package/dist/generated/prisma/internal/class.js +4 -4
- package/dist/generated/prisma/internal/prismaNamespace.d.ts +772 -1
- package/dist/generated/prisma/internal/prismaNamespace.js +135 -4
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.d.ts +139 -0
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.js +135 -4
- package/dist/generated/prisma/models/Agent.d.ts +360 -1
- package/dist/generated/prisma/models/CodingAgentProfile.d.ts +73 -1
- package/dist/generated/prisma/models/CodingRun.d.ts +205 -1
- package/dist/generated/prisma/models/DeferredReview.d.ts +78 -1
- package/dist/generated/prisma/models/NativeGatewayCall.d.ts +1675 -0
- package/dist/generated/prisma/models/NativeGatewayCall.js +1 -0
- package/dist/generated/prisma/models/NativeGatewaySession.d.ts +1517 -0
- package/dist/generated/prisma/models/NativeGatewaySession.js +1 -0
- package/dist/generated/prisma/models/NativeWarmWorker.d.ts +1296 -0
- package/dist/generated/prisma/models/NativeWarmWorker.js +1 -0
- package/dist/generated/prisma/models/NotificationChannel.d.ts +1543 -0
- package/dist/generated/prisma/models/NotificationChannel.js +1 -0
- package/dist/generated/prisma/models/NotificationDelivery.d.ts +1502 -0
- package/dist/generated/prisma/models/NotificationDelivery.js +1 -0
- package/dist/generated/prisma/models/NotificationThread.d.ts +1090 -0
- package/dist/generated/prisma/models/NotificationThread.js +1 -0
- package/dist/generated/prisma/models/Run.d.ts +826 -1
- package/dist/generated/prisma/models/RunHostCheck.d.ts +36 -1
- package/dist/generated/prisma/models/Secret.d.ts +37 -1
- package/dist/generated/prisma/models/SecretBrokerChange.d.ts +1101 -0
- package/dist/generated/prisma/models/SecretBrokerChange.js +1 -0
- package/dist/generated/prisma/models/WorkflowEvent.d.ts +1422 -0
- package/dist/generated/prisma/models/WorkflowEvent.js +1 -0
- package/dist/generated/prisma/models.d.ts +8 -0
- package/dist/help/build.js +4 -2
- package/dist/help/catalog.d.ts +1 -1
- package/dist/help/catalog.js +31 -6
- package/dist/help-index.json +1363 -176
- package/dist/import/create.js +17 -0
- package/dist/import/neutral-schema.d.ts +6 -2
- package/dist/import/neutral-schema.js +2 -0
- package/dist/mcp/auth/access.d.ts +1 -0
- package/dist/mcp/auth/repo-authorization.js +14 -0
- package/dist/mcp/auth/resource-server.d.ts +2 -1
- package/dist/mcp/auth/resource-server.js +7 -2
- package/dist/mcp/auth/self-hosted/browser.d.ts +1 -1
- package/dist/mcp/auth/self-hosted/browser.js +19 -6
- package/dist/mcp/context.d.ts +6 -0
- package/dist/mcp/host-events/github-ingress.d.ts +23 -1
- package/dist/mcp/host-events/github-ingress.js +68 -0
- package/dist/mcp/index.d.ts +13 -0
- package/dist/mcp/index.js +59 -10
- package/dist/mcp/tools/agents.js +82 -11
- package/dist/mcp/tools/notification-channels.d.ts +2 -0
- package/dist/mcp/tools/notification-channels.js +293 -0
- package/dist/mcp/tools/power.d.ts +2 -0
- package/dist/mcp/tools/power.js +77 -0
- package/dist/mcp/tools/runs.d.ts +0 -6
- package/dist/mcp/tools/runs.js +7 -2
- package/dist/mcp/tools/secret-broker-compat.d.ts +12 -0
- package/dist/mcp/tools/secret-broker-compat.js +23 -0
- package/dist/mcp/tools/secret-elicitation-form.d.ts +22 -2
- package/dist/mcp/tools/secret-elicitation-form.js +200 -10
- package/dist/mcp/tools/secret-elicitation-server.js +8 -1
- package/dist/mcp/tools/secret-elicitation.d.ts +38 -3
- package/dist/mcp/tools/secret-elicitation.js +110 -12
- package/dist/mcp/tools/secrets.js +184 -7
- package/dist/mcp/tools/tools.d.ts +1 -1
- package/dist/mcp/tools/tools.js +22 -2
- package/dist/native-worker/composition.d.ts +23 -0
- package/dist/native-worker/composition.js +77 -0
- package/dist/native-worker/docker-isolation.d.ts +65 -0
- package/dist/native-worker/docker-isolation.js +183 -0
- package/dist/native-worker/docker-launcher.d.ts +74 -0
- package/dist/native-worker/docker-launcher.js +237 -0
- package/dist/native-worker/gateway-server.d.ts +39 -0
- package/dist/native-worker/gateway-server.js +315 -0
- package/dist/native-worker/gateway.d.ts +44 -0
- package/dist/native-worker/gateway.js +197 -0
- package/dist/native-worker/http-server.d.ts +22 -0
- package/dist/native-worker/http-server.js +109 -0
- package/dist/native-worker/http-transport.d.ts +17 -0
- package/dist/native-worker/http-transport.js +88 -0
- package/dist/native-worker/kubernetes-isolation.d.ts +90 -0
- package/dist/native-worker/kubernetes-isolation.js +218 -0
- package/dist/native-worker/kubernetes-launcher.d.ts +102 -0
- package/dist/native-worker/kubernetes-launcher.js +335 -0
- package/dist/native-worker/launch.d.ts +45 -0
- package/dist/native-worker/launch.js +44 -0
- package/dist/native-worker/ledger.d.ts +109 -0
- package/dist/native-worker/ledger.js +192 -0
- package/dist/native-worker/loopback.d.ts +12 -0
- package/dist/native-worker/loopback.js +49 -0
- package/dist/native-worker/main.d.ts +7 -0
- package/dist/native-worker/main.js +74 -0
- package/dist/native-worker/protocol.d.ts +744 -0
- package/dist/native-worker/protocol.js +200 -0
- package/dist/native-worker/sandbox-executor.d.ts +68 -0
- package/dist/native-worker/sandbox-executor.js +210 -0
- package/dist/native-worker/stdio.d.ts +29 -0
- package/dist/native-worker/stdio.js +188 -0
- package/dist/native-worker/warm-delivery.d.ts +16 -0
- package/dist/native-worker/warm-delivery.js +33 -0
- package/dist/native-worker/warm-pool-ledger.d.ts +39 -0
- package/dist/native-worker/warm-pool-ledger.js +73 -0
- package/dist/native-worker/warm-pool.d.ts +107 -0
- package/dist/native-worker/warm-pool.js +283 -0
- package/dist/native-worker/worker.d.ts +17 -0
- package/dist/native-worker/worker.js +115 -0
- package/dist/providers/auth/authorization-server.d.ts +3 -0
- package/dist/providers/auth/index.js +2 -0
- package/dist/providers/auth/self-hosted.d.ts +13 -1
- package/dist/providers/auth/self-hosted.js +54 -4
- package/dist/providers/chat/fake.d.ts +46 -0
- package/dist/providers/chat/fake.js +39 -0
- package/dist/providers/chat/index.d.ts +4 -0
- package/dist/providers/chat/index.js +8 -0
- package/dist/providers/chat/slack.d.ts +37 -0
- package/dist/providers/chat/slack.js +105 -0
- package/dist/providers/chat/types.d.ts +42 -0
- package/dist/providers/chat/types.js +19 -0
- package/dist/providers/engine/types.d.ts +19 -0
- package/dist/providers/engine/types.js +22 -0
- package/dist/providers/executor/composition.d.ts +24 -1
- package/dist/providers/executor/composition.js +39 -6
- package/dist/providers/executor/container.d.ts +24 -1
- package/dist/providers/executor/container.js +101 -11
- package/dist/providers/executor/dbos.d.ts +42 -0
- package/dist/providers/executor/dbos.js +118 -12
- package/dist/providers/executor/deferred.d.ts +56 -0
- package/dist/providers/executor/deferred.js +119 -0
- package/dist/providers/executor/routing.d.ts +37 -10
- package/dist/providers/executor/routing.js +73 -32
- package/dist/providers/executor/types.d.ts +12 -0
- package/dist/providers/jobs/docker.js +3 -3
- package/dist/providers/jobs/fake-kubernetes-api.d.ts +21 -2
- package/dist/providers/jobs/fake-kubernetes-api.js +42 -1
- package/dist/providers/jobs/kubernetes-api.d.ts +17 -1
- package/dist/providers/jobs/kubernetes-api.js +7 -0
- package/dist/providers/jobs/kubernetes-client.d.ts +10 -1
- package/dist/providers/jobs/kubernetes-client.js +52 -3
- package/dist/providers/jobs/kubernetes-dry-run-fixture.d.ts +6 -1
- package/dist/providers/jobs/kubernetes-dry-run-fixture.js +6 -3
- package/dist/providers/jobs/kubernetes-isolation.d.ts +3 -1
- package/dist/providers/jobs/kubernetes-isolation.js +6 -0
- package/dist/providers/jobs/kubernetes-platform.d.ts +4 -1
- package/dist/providers/jobs/kubernetes-platform.js +38 -1
- package/dist/providers/jobs/kubernetes-preflight.d.ts +2 -1
- package/dist/providers/jobs/kubernetes-preflight.js +4 -2
- package/dist/providers/jobs/kubernetes.d.ts +36 -1
- package/dist/providers/jobs/kubernetes.js +74 -4
- package/dist/providers/jobs/metadata-probes.d.ts +11 -0
- package/dist/providers/jobs/metadata-probes.js +13 -0
- package/dist/providers/jobs/types.d.ts +9 -0
- package/dist/providers/review-host/github.d.ts +11 -1
- package/dist/providers/review-host/github.js +50 -0
- package/dist/providers/review-host/types.d.ts +23 -0
- package/dist/providers/vcs/github.d.ts +32 -6
- package/dist/providers/vcs/github.js +74 -16
- package/dist/quickstart/coding-seed.d.ts +10 -3
- package/dist/quickstart/coding-seed.js +74 -3
- package/dist/quickstart/images.d.ts +2 -0
- package/dist/quickstart/images.js +7 -1
- package/dist/quickstart/reviewer-prompt.d.ts +1 -1
- package/dist/quickstart/reviewer-prompt.js +1 -1
- package/dist/quickstart-images.json +1 -1
- package/dist/sandbox/brokered-fetch.d.ts +23 -0
- package/dist/sandbox/brokered-fetch.js +37 -0
- package/dist/sandbox/host-functions.d.ts +34 -0
- package/dist/sandbox/host-functions.js +144 -80
- package/dist/sandbox/prelude.js +7 -1
- package/dist/sandbox/run-in-sandbox.d.ts +19 -0
- package/dist/sandbox/run-in-sandbox.js +28 -10
- package/dist/sandbox/safe-fetch.d.ts +2 -0
- package/dist/sandbox/safe-fetch.js +3 -1
- package/dist/sandbox/secret-broker-sigv4.d.ts +2 -0
- package/dist/sandbox/secret-broker-sigv4.js +49 -0
- package/dist/sandbox/secret-broker.d.ts +34 -0
- package/dist/sandbox/secret-broker.js +162 -0
- package/dist/sandbox/user-tool.d.ts +14 -0
- package/dist/sandbox/user-tool.js +32 -0
- package/dist/serve.js +18 -0
- package/dist/viewer/api-schema.d.ts +210 -14
- package/dist/viewer/api-schema.js +22 -0
- package/dist/viewer/build-schemas.js +4 -1
- package/dist/viewer/event-bus.d.ts +6 -0
- package/dist/viewer/event-bus.js +16 -7
- package/dist/viewer/graph.d.ts +5 -2
- package/dist/viewer/graph.js +7 -2
- package/dist/viewer/http.d.ts +0 -1
- package/dist/viewer/http.js +2 -2
- package/dist/viewer/infra.js +25 -2
- package/dist/viewer/limits.d.ts +4 -0
- package/dist/viewer/limits.js +4 -0
- package/dist/viewer/openapi.d.ts +15 -0
- package/dist/viewer/openapi.js +172 -0
- package/docs/README.md +7 -0
- package/docs/agent-recipes.md +57 -8
- package/docs/architecture-runtime.md +16 -1
- package/docs/code-review-agents.md +139 -5
- package/docs/coding-agent-setup.md +113 -5
- package/docs/coding-packages.md +4 -2
- package/docs/coding-services.md +3 -1
- package/docs/coding-worker-byo-images.md +198 -6
- package/docs/coding-worker-isolation.md +68 -14
- package/docs/getting-started-gke.md +225 -9
- package/docs/getting-started-identity-provider.md +21 -10
- package/docs/getting-started.md +5 -4
- package/docs/jira-agents.md +5 -1
- package/docs/native-sandbox.md +635 -0
- package/docs/release-verification.md +9 -0
- package/docs/security-deployment.md +113 -12
- package/docs/slack-notifications.md +252 -0
- package/docs/tool-secrets.md +252 -0
- package/docs/viewer-api.md +46 -5
- package/docs/viewer-api.openapi.yml +1404 -0
- package/help/admin-viewer.md +6 -2
- package/help/agent-recipes.md +27 -0
- package/help/architecture-agent.md +1 -1
- package/help/brokered-secrets.md +79 -0
- package/help/build-claude-code-image.md +131 -0
- package/help/build-worker-image.md +3 -6
- package/help/code-review-agents.md +68 -6
- package/help/deploy-gke.md +8 -1
- package/help/deployment-targets.md +25 -14
- package/help/errors/coding-provider-not-configured.md +2 -2
- package/help/errors/database-auth-invalid.md +28 -0
- package/help/errors/github-account-not-allowed.md +25 -0
- package/help/errors/low-power-disabled.md +29 -0
- package/help/errors/low-power-scale-forbidden.md +35 -0
- package/help/errors/low-power-wake-timeout.md +30 -0
- package/help/errors/mobile-disabled.md +31 -0
- package/help/errors/native-sandbox-capacity.md +22 -0
- package/help/errors/native-sandbox-deadline-exceeded.md +19 -0
- package/help/errors/native-sandbox-docker-failed.md +20 -0
- package/help/errors/native-sandbox-gateway-unavailable.md +21 -0
- package/help/errors/native-sandbox-image-not-pinned.md +19 -0
- package/help/errors/native-sandbox-isolation-mismatch.md +20 -0
- package/help/errors/native-sandbox-network-unenforced.md +22 -0
- package/help/errors/native-sandbox-requires-catalog.md +31 -0
- package/help/errors/native-sandbox-unavailable.md +19 -0
- package/help/errors/native-sandbox-warm-delivery-failed.md +21 -0
- package/help/errors/native-sandbox-worker-exited.md +20 -0
- package/help/errors/native-sandbox-worker-lost.md +20 -0
- package/help/errors/native-sandbox-worker-unready.md +22 -0
- package/help/errors/secret-broker-body-invalid.md +26 -0
- package/help/errors/secret-broker-changed.md +20 -0
- package/help/errors/secret-broker-config-invalid.md +30 -0
- package/help/errors/secret-broker-conflict.md +27 -0
- package/help/errors/secret-broker-destination-denied.md +28 -0
- package/help/errors/secret-broker-value-invalid.md +28 -0
- package/help/errors/secret-brokered.md +24 -0
- package/help/errors/secret-not-brokered.md +25 -0
- package/help/errors/slack-auth-failed.md +48 -0
- package/help/errors/slack-channel-unreachable.md +39 -0
- package/help/errors/slack-not-configured.md +33 -0
- package/help/getting-started.md +4 -5
- package/help/github.md +18 -1
- package/help/identity-and-access.md +5 -1
- package/help/local-repositories.md +2 -3
- package/help/low-power-mode.md +125 -0
- package/help/merge-order-check.md +117 -0
- package/help/mobile-app.md +54 -0
- package/help/native-sandbox.md +136 -0
- package/help/observability.md +8 -0
- package/help/related-pull-requests.md +70 -9
- package/help/repo-instructions-and-skills.md +91 -0
- package/help/review-fix-rounds.md +10 -0
- package/help/slack-notifications.md +62 -0
- package/help/troubleshooting/coding-workers.md +21 -0
- package/package.json +11 -4
- package/prisma/migrations/20261009000003_native_execution_mode/migration.sql +12 -0
- package/prisma/migrations/20261009000004_native_gateway_ledger/migration.sql +65 -0
- package/prisma/migrations/20261009000005_native_gateway_call_child_agent/migration.sql +5 -0
- package/prisma/migrations/20261009000006_run_deferred_start_stop/migration.sql +14 -0
- package/prisma/migrations/20261009000007_native_gateway_network_ready/migration.sql +5 -0
- package/prisma/migrations/20261010000001_workflow_notifications/migration.sql +99 -0
- package/prisma/migrations/20261011000001_native_gateway_session_status_index/migration.sql +2 -0
- package/prisma/migrations/20261012000001_native_warm_worker/migration.sql +32 -0
- package/prisma/migrations/20261013000001_coding_run_merge_order/migration.sql +2 -0
- package/prisma/migrations/20261013000001_secret_broker/migration.sql +17 -0
- package/prisma/migrations/20261013000002_deferred_review_request/migration.sql +4 -0
- package/prisma/migrations/20261014000000_repo_skills/migration.sql +15 -0
- package/prisma/migrations/20261015000001_coding_run_merge_order_index/migration.sql +2 -0
- package/prisma/migrations/20261015000002_no_change_rereview/migration.sql +2 -0
- package/prisma/schema.prisma +362 -91
package/dist/config/providers.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* code change. The `assembleProviders` factory (which constructs the concrete
|
|
7
7
|
* adapters) is added once the adapters exist.
|
|
8
8
|
*/
|
|
9
|
-
import { KUBERNETES_PLATFORMS } from "../providers/jobs/kubernetes-platform.js";
|
|
9
|
+
import { GVISOR_RUNTIME_CLASS, KUBERNETES_PLATFORMS, platformProfile, } from "../providers/jobs/kubernetes-platform.js";
|
|
10
|
+
import { loadMobileConfig } from "./mobile.js";
|
|
10
11
|
/** Read provider selection from environment variables, defaulting to portable. */
|
|
11
12
|
export function loadProviderConfig(env = process.env) {
|
|
12
13
|
return {
|
|
@@ -137,6 +138,30 @@ export function loadJiraConfig(env = process.env) {
|
|
|
137
138
|
...(epicLinkField ? { epicLinkField } : {}),
|
|
138
139
|
};
|
|
139
140
|
}
|
|
141
|
+
/** Slack workflow notifications; null when WARDBY_SLACK_BOT_TOKEN is unset (and no other Slack variable is). */
|
|
142
|
+
export function loadSlackConfig(env = process.env) {
|
|
143
|
+
const token = env.WARDBY_SLACK_BOT_TOKEN?.trim();
|
|
144
|
+
const base = env.WARDBY_SLACK_API_BASE_URL?.trim();
|
|
145
|
+
const customizeRaw = env.WARDBY_SLACK_CUSTOMIZE?.trim().toLowerCase();
|
|
146
|
+
if (!token) {
|
|
147
|
+
if (base || customizeRaw)
|
|
148
|
+
throw new Error("WARDBY_SLACK_API_BASE_URL/WARDBY_SLACK_CUSTOMIZE need WARDBY_SLACK_BOT_TOKEN.");
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
if (!token.startsWith("xoxb-"))
|
|
152
|
+
throw new Error("WARDBY_SLACK_BOT_TOKEN must be a bot token (xoxb-…).");
|
|
153
|
+
let apiBaseUrl = "https://slack.com/api";
|
|
154
|
+
if (base) {
|
|
155
|
+
const url = new URL(base);
|
|
156
|
+
if (url.protocol !== "https:")
|
|
157
|
+
throw new Error("WARDBY_SLACK_API_BASE_URL must be an https URL.");
|
|
158
|
+
apiBaseUrl = base.replace(/\/+$/, "");
|
|
159
|
+
}
|
|
160
|
+
if (customizeRaw && customizeRaw !== "true" && customizeRaw !== "false") {
|
|
161
|
+
throw new Error("WARDBY_SLACK_CUSTOMIZE must be true or false.");
|
|
162
|
+
}
|
|
163
|
+
return { botToken: token, apiBaseUrl, customize: customizeRaw === "true" };
|
|
164
|
+
}
|
|
140
165
|
function optionalPositiveNumber(value, name, fallback) {
|
|
141
166
|
if (value === undefined)
|
|
142
167
|
return fallback;
|
|
@@ -195,11 +220,67 @@ export function loadContainerExecutorConfig(env = process.env) {
|
|
|
195
220
|
additionalWorkerImages,
|
|
196
221
|
};
|
|
197
222
|
}
|
|
198
|
-
/**
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
223
|
+
/** The native gateway Service (and Deployment) name when NATIVE_GATEWAY_SERVICE is unset. */
|
|
224
|
+
export const DEFAULT_NATIVE_GATEWAY_SERVICE = "wardby-native-gateway";
|
|
225
|
+
/** Undefined when NATIVE_SANDBOX_LAUNCHER is unset (sandbox-mode runs then fail closed). Throws on a bad configuration. */
|
|
226
|
+
export function loadNativeSandboxConfig(env = process.env) {
|
|
227
|
+
const launcher = env.NATIVE_SANDBOX_LAUNCHER?.trim();
|
|
228
|
+
if (!launcher)
|
|
229
|
+
return undefined;
|
|
230
|
+
if (launcher !== "docker" && launcher !== "kubernetes") {
|
|
231
|
+
throw new Error(`NATIVE_SANDBOX_LAUNCHER must be "docker" or "kubernetes" (got "${launcher}").`);
|
|
232
|
+
}
|
|
233
|
+
const workerImage = imageVariable(env.NATIVE_SANDBOX_WORKER_IMAGE);
|
|
234
|
+
if (!workerImage)
|
|
235
|
+
throw new Error(`NATIVE_SANDBOX_WORKER_IMAGE is required when NATIVE_SANDBOX_LAUNCHER=${launcher}.`);
|
|
236
|
+
const gatewayUrl = env.NATIVE_GATEWAY_URL?.trim();
|
|
237
|
+
if (gatewayUrl && !/^https?:\/\/[^\s]+$/.test(gatewayUrl)) {
|
|
238
|
+
throw new Error(`NATIVE_GATEWAY_URL must be an http(s) URL (got "${gatewayUrl}").`);
|
|
239
|
+
}
|
|
240
|
+
const common = {
|
|
241
|
+
workerImage,
|
|
242
|
+
...(gatewayUrl ? { gatewayUrl } : {}),
|
|
243
|
+
cpus: optionalPositiveNumber(env.NATIVE_SANDBOX_CPUS, "NATIVE_SANDBOX_CPUS", 1),
|
|
244
|
+
memoryMb: optionalPositiveInteger(env.NATIVE_SANDBOX_MEMORY_MB, "NATIVE_SANDBOX_MEMORY_MB") ?? 512,
|
|
245
|
+
pids: optionalPositiveInteger(env.NATIVE_SANDBOX_PIDS, "NATIVE_SANDBOX_PIDS") ?? 128,
|
|
246
|
+
...optionalField("maxConcurrent", optionalPositiveInteger(env.NATIVE_SANDBOX_MAX_CONCURRENT, "NATIVE_SANDBOX_MAX_CONCURRENT")),
|
|
247
|
+
warmPoolSize: optionalBoundedInteger(env.NATIVE_SANDBOX_WARM_POOL_SIZE?.trim() || undefined, "NATIVE_SANDBOX_WARM_POOL_SIZE", 0, 50) ?? 0,
|
|
248
|
+
warmMaxAgeMs: optionalBoundedInteger(env.NATIVE_SANDBOX_WARM_MAX_AGE_MS?.trim() || undefined, "NATIVE_SANDBOX_WARM_MAX_AGE_MS", 60_000, 21_600_000) ?? 1_800_000,
|
|
249
|
+
};
|
|
250
|
+
if (launcher === "kubernetes") {
|
|
251
|
+
// A cluster pulls by registry digest; a local image id means nothing to it.
|
|
252
|
+
if (!/@sha256:[0-9a-f]{64}$/.test(workerImage)) {
|
|
253
|
+
throw new Error("NATIVE_SANDBOX_WORKER_IMAGE must be a registry digest (repo@sha256:...) when NATIVE_SANDBOX_LAUNCHER=kubernetes.");
|
|
254
|
+
}
|
|
255
|
+
const namespace = env.NATIVE_SANDBOX_NAMESPACE?.trim() || env.KUBERNETES_NAMESPACE?.trim() || "wardby-coding";
|
|
256
|
+
const runtimeClassName = env.NATIVE_SANDBOX_RUNTIME_CLASS?.trim() || env.KUBERNETES_RUNTIME_CLASS?.trim() || undefined;
|
|
257
|
+
const context = env.KUBERNETES_CONTEXT?.trim() || undefined;
|
|
258
|
+
// The platform and run priority class are the coding launcher's settings, validated the same way.
|
|
259
|
+
const cluster = loadKubernetesJobConfig({
|
|
260
|
+
KUBERNETES_PLATFORM: env.KUBERNETES_PLATFORM,
|
|
261
|
+
KUBERNETES_RUN_PRIORITY_CLASS: env.NATIVE_SANDBOX_PRIORITY_CLASS?.trim() || env.KUBERNETES_RUN_PRIORITY_CLASS,
|
|
262
|
+
});
|
|
263
|
+
if (platformProfile(cluster.platform).requiresGvisor && runtimeClassName !== GVISOR_RUNTIME_CLASS) {
|
|
264
|
+
throw new Error(`KUBERNETES_PLATFORM=${cluster.platform} runs native workers only under gVisor: set NATIVE_SANDBOX_RUNTIME_CLASS (or KUBERNETES_RUNTIME_CLASS) to ${GVISOR_RUNTIME_CLASS} (found ${runtimeClassName ?? "unset"}).`);
|
|
265
|
+
}
|
|
266
|
+
return {
|
|
267
|
+
launcher,
|
|
268
|
+
...common,
|
|
269
|
+
namespace,
|
|
270
|
+
gatewayService: env.NATIVE_GATEWAY_SERVICE?.trim() || DEFAULT_NATIVE_GATEWAY_SERVICE,
|
|
271
|
+
platform: cluster.platform,
|
|
272
|
+
...(context ? { context } : {}),
|
|
273
|
+
...(runtimeClassName ? { runtimeClassName } : {}),
|
|
274
|
+
...optionalField("priorityClassName", cluster.priorityClassName),
|
|
275
|
+
...optionalField("readyTimeoutMs", optionalBoundedInteger(env.NATIVE_SANDBOX_READY_TIMEOUT_MS, "NATIVE_SANDBOX_READY_TIMEOUT_MS", 1_000, 1_800_000)),
|
|
276
|
+
...optionalField("enforcementTimeoutMs", optionalBoundedInteger(env.NATIVE_SANDBOX_ENFORCEMENT_TIMEOUT_MS, "NATIVE_SANDBOX_ENFORCEMENT_TIMEOUT_MS", 1_000, 600_000)),
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
const gatewayContainer = env.NATIVE_GATEWAY_CONTAINER?.trim();
|
|
280
|
+
if (!gatewayContainer)
|
|
281
|
+
throw new Error("NATIVE_GATEWAY_CONTAINER is required when NATIVE_SANDBOX_LAUNCHER=docker.");
|
|
282
|
+
return { launcher, ...common, gatewayContainer };
|
|
283
|
+
}
|
|
203
284
|
export function loadShutdownDrainSeconds(env = process.env) {
|
|
204
285
|
const value = env.SHUTDOWN_DRAIN_SECONDS?.trim();
|
|
205
286
|
if (!value)
|
|
@@ -293,6 +374,7 @@ export function loadAuthConfig(env = process.env) {
|
|
|
293
374
|
signingKey: env.AUTH_SIGNING_KEY,
|
|
294
375
|
credentialHashKey: env.AUTH_CREDENTIAL_HASH_KEY,
|
|
295
376
|
maxClients: env.AUTH_MAX_CLIENTS ? Number(env.AUTH_MAX_CLIENTS) : undefined,
|
|
377
|
+
mobile: loadMobileConfig(env),
|
|
296
378
|
};
|
|
297
379
|
}
|
|
298
380
|
/** Read secret-cipher config (the app-key master key) from the environment. */
|
|
@@ -309,3 +391,7 @@ export function loadDbosConfig(env = process.env) {
|
|
|
309
391
|
executorId: env.DBOS_EXECUTOR_ID ?? crypto.randomUUID(),
|
|
310
392
|
};
|
|
311
393
|
}
|
|
394
|
+
/** `{ [key]: value }` when value is set, else nothing: for spreading optional fields under exactOptionalPropertyTypes. */
|
|
395
|
+
function optionalField(key, value) {
|
|
396
|
+
return (value === undefined ? {} : { [key]: value });
|
|
397
|
+
}
|
package/dist/core/db.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { PoolConfig } from "pg";
|
|
1
2
|
import { PrismaClient } from "#prisma";
|
|
3
|
+
import { type DatabaseAuth, type PgAuthOptions } from "./pg-auth.js";
|
|
2
4
|
/**
|
|
3
5
|
* Connection-pool sizing for the node-postgres pool behind @prisma/adapter-pg.
|
|
4
6
|
*
|
|
@@ -28,13 +30,21 @@ export interface PoolSettings {
|
|
|
28
30
|
connectionTimeoutMillis: number;
|
|
29
31
|
}
|
|
30
32
|
export declare function poolSettings(connectionString: string): PoolSettings;
|
|
33
|
+
export interface PrismaClientOptions {
|
|
34
|
+
/** Overrides the pool size for a caller that sizes its own pools
|
|
35
|
+
* (the coding proxy keeps its ledger and its package registry apart). */
|
|
36
|
+
poolMax?: number;
|
|
37
|
+
/** Defaults to DATABASE_AUTH (see pg-auth.ts). */
|
|
38
|
+
auth?: DatabaseAuth;
|
|
39
|
+
/** Test seam for rds-iam (environment, token signer, CA file reader). */
|
|
40
|
+
pgAuth?: PgAuthOptions;
|
|
41
|
+
}
|
|
42
|
+
/** The pg pool config behind every Prisma client: auth (pg-auth.ts) plus pool sizing. */
|
|
43
|
+
export declare function prismaPgConfig(url: string, options?: PrismaClientOptions): PoolConfig;
|
|
31
44
|
/**
|
|
32
45
|
* The one way wardby builds a Prisma client. `url` defaults to DATABASE_URL
|
|
33
|
-
* as read at call time.
|
|
46
|
+
* as read at call time. How it authenticates follows DATABASE_AUTH
|
|
47
|
+
* (password by default, or rds-iam; see pg-auth.ts).
|
|
34
48
|
*/
|
|
35
|
-
|
|
36
|
-
* (the coding proxy keeps its ledger and its package registry apart). */
|
|
37
|
-
export declare function createPrismaClient(url?: string | undefined, options?: {
|
|
38
|
-
poolMax?: number;
|
|
39
|
-
}): PrismaClient;
|
|
49
|
+
export declare function createPrismaClient(url?: string | undefined, options?: PrismaClientOptions): PrismaClient;
|
|
40
50
|
export declare const prisma: PrismaClient;
|
package/dist/core/db.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { availableParallelism } from "node:os";
|
|
2
2
|
import { PrismaPg } from "@prisma/adapter-pg";
|
|
3
3
|
import { PrismaClient } from "#prisma";
|
|
4
|
+
import { databaseAuthFromEnv, pgConnectionConfig } from "./pg-auth.js";
|
|
4
5
|
/**
|
|
5
6
|
* Connection-pool sizing for the node-postgres pool behind @prisma/adapter-pg.
|
|
6
7
|
*
|
|
@@ -56,20 +57,21 @@ class MissingUrlAdapter extends PrismaPg {
|
|
|
56
57
|
throw new Error("DATABASE_URL is not set: cannot connect to the database.");
|
|
57
58
|
}
|
|
58
59
|
}
|
|
60
|
+
/** The pg pool config behind every Prisma client: auth (pg-auth.ts) plus pool sizing. */
|
|
61
|
+
export function prismaPgConfig(url, options = {}) {
|
|
62
|
+
return {
|
|
63
|
+
...pgConnectionConfig(url, options.auth ?? databaseAuthFromEnv(), options.pgAuth),
|
|
64
|
+
...poolSettings(url),
|
|
65
|
+
...(options.poolMax !== undefined ? { max: options.poolMax } : {}),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
59
68
|
/**
|
|
60
69
|
* The one way wardby builds a Prisma client. `url` defaults to DATABASE_URL
|
|
61
|
-
* as read at call time.
|
|
70
|
+
* as read at call time. How it authenticates follows DATABASE_AUTH
|
|
71
|
+
* (password by default, or rds-iam; see pg-auth.ts).
|
|
62
72
|
*/
|
|
63
|
-
/** `poolMax` overrides the pool size for a caller that sizes its own pools
|
|
64
|
-
* (the coding proxy keeps its ledger and its package registry apart). */
|
|
65
73
|
export function createPrismaClient(url = process.env.DATABASE_URL, options = {}) {
|
|
66
|
-
const adapter = url
|
|
67
|
-
? new PrismaPg({
|
|
68
|
-
connectionString: url,
|
|
69
|
-
...poolSettings(url),
|
|
70
|
-
...(options.poolMax !== undefined ? { max: options.poolMax } : {}),
|
|
71
|
-
})
|
|
72
|
-
: new MissingUrlAdapter({ connectionString: "" });
|
|
74
|
+
const adapter = url ? new PrismaPg(prismaPgConfig(url, options)) : new MissingUrlAdapter({ connectionString: "" });
|
|
73
75
|
return new PrismaClient({ adapter });
|
|
74
76
|
}
|
|
75
77
|
export const prisma = createPrismaClient();
|
package/dist/core/dispatch.d.ts
CHANGED
|
@@ -28,6 +28,17 @@ export interface DispatchRunOptions {
|
|
|
28
28
|
* exclusive with `codingBaseRef`. Coding agents only.
|
|
29
29
|
*/
|
|
30
30
|
continuesCodingRunId?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The step in the delegating agent's declared merge order for this coding
|
|
33
|
+
* run (1 = merge first; equal numbers mean no order between them). Integer
|
|
34
|
+
* 1-99, validated by the caller (the delegate_to_* tool's mergeOrder
|
|
35
|
+
* argument); throws `Error("invalid_merge_order")` otherwise. Coding agents
|
|
36
|
+
* only; ignored for a native agent (no CodingRun to store it on). A
|
|
37
|
+
* continuation (`continuesCodingRunId`) that omits this inherits the pull
|
|
38
|
+
* request's effective value: the newest non-null `mergeOrder` among the
|
|
39
|
+
* root coding run and its continuations.
|
|
40
|
+
*/
|
|
41
|
+
mergeOrder?: number;
|
|
31
42
|
now?: Date;
|
|
32
43
|
lockAgent?: boolean;
|
|
33
44
|
task?: {
|
package/dist/core/dispatch.js
CHANGED
|
@@ -227,8 +227,37 @@ ownerId) {
|
|
|
227
227
|
headRef: root.headRef,
|
|
228
228
|
continuationOf: { runId: root.runId },
|
|
229
229
|
rootCodingRunId: root.runId,
|
|
230
|
+
mergeOrder: await effectiveMergeOrder(reader, root.runId),
|
|
230
231
|
};
|
|
231
232
|
}
|
|
233
|
+
/**
|
|
234
|
+
* The pull request's current merge step: the newest non-null mergeOrder
|
|
235
|
+
* (by run start) among the root coding run and every continuation of it
|
|
236
|
+
* (CodingRun.rootCodingRunId, indexed), or null when none set one. A
|
|
237
|
+
* continuation that omits mergeOrder inherits this, so an earlier
|
|
238
|
+
* continuation's override is kept rather than reverting to the root's.
|
|
239
|
+
*/
|
|
240
|
+
async function effectiveMergeOrder(reader, rootRunId) {
|
|
241
|
+
const newest = await reader.codingRun.findFirst({
|
|
242
|
+
where: { OR: [{ runId: rootRunId }, { rootCodingRunId: rootRunId }], mergeOrder: { not: null } },
|
|
243
|
+
orderBy: [{ run: { startedAt: "desc" } }, { runId: "desc" }],
|
|
244
|
+
select: { mergeOrder: true },
|
|
245
|
+
});
|
|
246
|
+
return newest?.mergeOrder ?? null;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Resolves the CodingRun's mergeOrder: the caller's own value if given (an
|
|
250
|
+
* integer 1-99; anything else throws), else the inherited effective value
|
|
251
|
+
* (undefined for a fresh branch), else null (no order).
|
|
252
|
+
*/
|
|
253
|
+
function resolveMergeOrder(options, inherited) {
|
|
254
|
+
if (options.mergeOrder === undefined)
|
|
255
|
+
return inherited ?? null;
|
|
256
|
+
if (!Number.isInteger(options.mergeOrder) || options.mergeOrder < 1 || options.mergeOrder > 99) {
|
|
257
|
+
throw new Error("invalid_merge_order");
|
|
258
|
+
}
|
|
259
|
+
return options.mergeOrder;
|
|
260
|
+
}
|
|
232
261
|
/** Read failures that are the file's fault rather than the host's: reported as an invalid declaration. */
|
|
233
262
|
const UNREADABLE_DECLARATION = {
|
|
234
263
|
github_file_too_large: `it is larger than ${MAX_SERVICE_DECLARATION_BYTES} bytes`,
|
|
@@ -439,6 +468,8 @@ export async function dispatchRun(options) {
|
|
|
439
468
|
agentId: agent.id,
|
|
440
469
|
trigger: options.trigger ?? "manual",
|
|
441
470
|
executionManaged: true,
|
|
471
|
+
// Fixed for the run's life: the executor routes on this, never on the agent's current setting.
|
|
472
|
+
nativeExecutionMode: agent.kind === "native" ? agent.nativeExecutionMode : null,
|
|
442
473
|
parentRunId: options.parentRunId,
|
|
443
474
|
grantedParentMemoryKeys: options.grantedParentMemoryKeys ?? [],
|
|
444
475
|
taskOverride: options.taskOverride,
|
|
@@ -478,8 +509,9 @@ export async function dispatchRun(options) {
|
|
|
478
509
|
const budgetUsd = codingBudget.budgetUsd;
|
|
479
510
|
// Resolved once: before the transaction when the declaration was read from it.
|
|
480
511
|
const branch = declarationRead?.branch ?? (await resolveCodingBranch(tx, options, agent.codingProfile, agent.ownerId));
|
|
481
|
-
const { baseRef, continuationOf, rootCodingRunId } = branch;
|
|
512
|
+
const { baseRef, continuationOf, rootCodingRunId, mergeOrder: inheritedMergeOrder } = branch;
|
|
482
513
|
const headRef = branch.headRef ?? `wardby/run-${run.id}`;
|
|
514
|
+
const mergeOrder = resolveMergeOrder(options, inheritedMergeOrder);
|
|
483
515
|
const input = CodingTaskInputSchema.parse({
|
|
484
516
|
schemaVersion: CODING_PROTOCOL_VERSION,
|
|
485
517
|
runId: run.id,
|
|
@@ -523,8 +555,11 @@ export async function dispatchRun(options) {
|
|
|
523
555
|
toolImage,
|
|
524
556
|
budgetReservedUsd: budgetUsd,
|
|
525
557
|
rootCodingRunId,
|
|
558
|
+
mergeOrder,
|
|
526
559
|
workspaceDiskMb: agent.codingProfile.workspaceDiskMb,
|
|
527
560
|
maxTurns: agent.codingProfile.maxTurns,
|
|
561
|
+
repoSkills: agent.codingProfile.repoSkills,
|
|
562
|
+
claudeBareMode: agent.codingProfile.claudeBareMode,
|
|
528
563
|
// Fixed here so a run's tracing never changes mid-run.
|
|
529
564
|
debugTrace: agent.codingProfile.debugTraceUntil != null &&
|
|
530
565
|
now.getTime() < agent.codingProfile.debugTraceUntil.getTime(),
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* lives behind a seam (a future LangGraph engine swaps in here) and why
|
|
7
7
|
* the budget guardrail must stay above whichever engine is running.
|
|
8
8
|
*/
|
|
9
|
-
import { runStepInline } from "../providers/engine/types.js";
|
|
9
|
+
import { RunOwnershipLostError, runStepInline } from "../providers/engine/types.js";
|
|
10
10
|
import { applyPreflightSafetyMargin, checkTokenCalibration, estimateInputCost, isOverBudget } from "./budget.js";
|
|
11
11
|
import { logger } from "./logger.js";
|
|
12
12
|
import { UNTRUSTED_CONTEXT_TAG, UNTRUSTED_TOOL_OUTPUT_TAG, wrapUntrusted } from "./untrusted-content.js";
|
|
@@ -197,11 +197,15 @@ export class NativeEngine {
|
|
|
197
197
|
engineLog.info({ turn, toolCallIds: batch.map((i) => toolCalls[i].id) }, "running tool calls concurrently");
|
|
198
198
|
const settled = await Promise.allSettled(batch.map((i) => runCall(i)));
|
|
199
199
|
const rejections = settled.filter((outcome) => outcome.status === "rejected");
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
// An ownership loss wins over an ordinary failure: this attempt no longer owns the run, so it
|
|
201
|
+
// must stop without a terminal write rather than fail the run for the attempt that does.
|
|
202
|
+
const thrown = rejections.find((r) => r.reason instanceof RunOwnershipLostError) ?? rejections[0];
|
|
203
|
+
for (const extra of rejections) {
|
|
204
|
+
if (extra !== thrown)
|
|
205
|
+
engineLog.warn({ turn, err: extra.reason }, "concurrent tool call also failed");
|
|
202
206
|
}
|
|
203
|
-
if (
|
|
204
|
-
throw
|
|
207
|
+
if (thrown)
|
|
208
|
+
throw thrown.reason;
|
|
205
209
|
settled.forEach((outcome, position) => {
|
|
206
210
|
results[batch[position]] = outcome.value;
|
|
207
211
|
});
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* module decides which agents run. See
|
|
6
6
|
* docs/private/2026-09-25-code-review-host-design.md §6.3.
|
|
7
7
|
*/
|
|
8
|
-
import type
|
|
8
|
+
import { type PrismaClient } from "#prisma";
|
|
9
9
|
import type { Executor } from "../providers/executor/types.js";
|
|
10
10
|
import type { IssueTrackerRegistry } from "../providers/issue-tracker/types.js";
|
|
11
|
-
import type { HostEvent, ReviewHostRegistry } from "../providers/review-host/types.js";
|
|
11
|
+
import type { CodeReviewHost, HostEvent, ReviewHostRegistry } from "../providers/review-host/types.js";
|
|
12
12
|
import { type OpenSibling } from "./related-pull-requests.js";
|
|
13
13
|
import { type RepoAccessGate } from "./repo-access.js";
|
|
14
14
|
import { type DriftScope } from "../knowledge/relevance.js";
|
|
@@ -84,12 +84,58 @@ export declare function siblingContinuationHints(siblings: readonly OpenSibling[
|
|
|
84
84
|
*/
|
|
85
85
|
export declare function mentionTaskText(event: MentionEvent, siblings?: readonly OpenSibling[]): string;
|
|
86
86
|
export declare function unknownPriorRunBody(priorRunId: string): string;
|
|
87
|
+
export interface ReviewTarget {
|
|
88
|
+
agentId: string;
|
|
89
|
+
checkName: string;
|
|
90
|
+
}
|
|
91
|
+
/** A review run's task: the head to review, plus any extra context its trigger adds. */
|
|
92
|
+
export declare function reviewTaskText(repository: string, prNumber: number, headSha: string, context?: {
|
|
93
|
+
task: string;
|
|
94
|
+
untrustedContext: string;
|
|
95
|
+
}): string;
|
|
96
|
+
/** Starts one review run per target on a pull request head; returns the started run ids. */
|
|
97
|
+
export declare function startReviews(deps: ReviewStartDeps, host: CodeReviewHost, repository: string, prNumber: number, headSha: string, targets: ReviewTarget[],
|
|
98
|
+
/** True for automatic triggers; an explicit re-run or `@wardby review` always runs. */
|
|
99
|
+
skipReviewedCommits?: boolean,
|
|
100
|
+
/**
|
|
101
|
+
* Extra context for this review: `task` (written by wardby, trusted) is appended to the
|
|
102
|
+
* review task; `untrustedContext` (anything a model or a person wrote) travels separately,
|
|
103
|
+
* delivered as data.
|
|
104
|
+
*/
|
|
105
|
+
context?: {
|
|
106
|
+
task: string;
|
|
107
|
+
untrustedContext: string;
|
|
108
|
+
}): Promise<string[]>;
|
|
87
109
|
/**
|
|
88
110
|
* The reconciler's fallback for deferred reviews: drops rows older than
|
|
89
111
|
* DEFERRED_REVIEW_MAX_AGE_MS, and starts (regardless of CI) those waiting
|
|
90
112
|
* longer than DEFERRED_REVIEW_MAX_WAIT_MS, at most DEFERRED_REVIEW_BATCH per
|
|
91
113
|
* pass, oldest first. Covers CI that never reported, ran very long, or whose
|
|
92
|
-
* completion webhook was missed.
|
|
114
|
+
* completion webhook was missed. Rows waiting for a delegating run (reason
|
|
115
|
+
* "request") are released the same way once they are that old, but only when
|
|
116
|
+
* that run is terminal (or gone): a lead the reconciler marked lost never
|
|
117
|
+
* reaches its finalizer. Never throws; returns the runs started.
|
|
93
118
|
*/
|
|
94
119
|
export declare function startDeferredReviews(deps: ReviewStartDeps, now?: Date): Promise<string[]>;
|
|
120
|
+
/**
|
|
121
|
+
* The run whose finish a review of this pull request waits for: the root of
|
|
122
|
+
* the run tree when the PR's opening coding run was delegated (it has a
|
|
123
|
+
* parent run) and that root is not terminal yet; otherwise null (a
|
|
124
|
+
* non-delegated coding PR, a finished request, or an unknown marker). A lead's
|
|
125
|
+
* delegate_to_* calls block until each child is terminal, so a terminal root
|
|
126
|
+
* means every sibling coding run of the request has finished and opened its
|
|
127
|
+
* pull request. A continuation's marker resolves to its root coding run, then
|
|
128
|
+
* up that run's parents. `repository`, when given, must be the coding run's.
|
|
129
|
+
*/
|
|
130
|
+
export declare function requestLeadRunId(db: Pick<HostEventDb, "$queryRaw">, prMarkerRunId: string, repository?: string): Promise<string | null>;
|
|
131
|
+
/**
|
|
132
|
+
* The delegating run `leadRunId` is terminal (it succeeded, failed, or was
|
|
133
|
+
* cancelled): releases every review that waited for it. A reviewer linked
|
|
134
|
+
* with waitForCi whose head's CI is still pending is handed to CI (the row
|
|
135
|
+
* becomes reason "ci", its max wait counted from now); every other row is
|
|
136
|
+
* started (claimed by delete, so concurrent releases start each review once).
|
|
137
|
+
* Called from the lead's finalizer, after the related pull requests sections
|
|
138
|
+
* were rewritten. Never throws.
|
|
139
|
+
*/
|
|
140
|
+
export declare function startDeferredForRequest(deps: ReviewStartDeps, leadRunId: string): Promise<void>;
|
|
95
141
|
export declare function routeHostEvent(event: HostEvent, deps: RouteHostEventDeps): Promise<RouteResult>;
|