@intentius/chant 0.124.108 → 0.124.110
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/dist/__golden__/wave-loop/fan-out-applied.json +12 -6
- package/dist/__golden__/wave-loop/fan-out-apply-fails.json +8 -4
- package/dist/__golden__/wave-loop/fan-out-gated.json +4 -2
- package/dist/__golden__/wave-loop/fan-out-no-members.json +16 -8
- package/dist/__golden__/wave-loop/fan-out-plan-fails.json +8 -4
- package/dist/__golden__/wave-loop/fan-out-same-root.json +4 -2
- package/dist/agent-facts.d.ts +130 -0
- package/dist/agent-facts.js +196 -0
- package/dist/change-risk.d.ts +216 -0
- package/dist/change-risk.js +304 -0
- package/dist/change-set.d.ts +8 -0
- package/dist/ci-agent-alert.d.ts +139 -0
- package/dist/ci-agent-alert.js +342 -0
- package/dist/ci-agent-triggers.d.ts +152 -0
- package/dist/ci-agent-triggers.js +232 -0
- package/dist/ci-agent-verify-failed.d.ts +149 -0
- package/dist/ci-agent-verify-failed.js +191 -0
- package/dist/ci-agent.d.ts +136 -8
- package/dist/ci-agent.js +353 -26
- package/dist/ci-comment-commands.d.ts +8 -0
- package/dist/ci-comment-commands.js +17 -1
- package/dist/ci-comment-reject.d.ts +70 -0
- package/dist/ci-comment-reject.js +135 -0
- package/dist/ci-comment-replies.d.ts +3 -1
- package/dist/ci-comment-replies.js +6 -0
- package/dist/ci-estate/delivery.d.ts +25 -3
- package/dist/ci-estate/delivery.js +28 -9
- package/dist/ci-estate/page.d.ts +7 -3
- package/dist/ci-estate/page.js +19 -4
- package/dist/ci-estate/rows.d.ts +14 -2
- package/dist/ci-estate/rows.js +9 -1
- package/dist/ci-estate.d.ts +5 -2
- package/dist/ci-estate.js +3 -2
- package/dist/ci-handover.d.ts +2 -7
- package/dist/ci-handover.js +3 -20
- package/dist/ci-jobs.d.ts +6 -0
- package/dist/ci-jobs.js +17 -0
- package/dist/ci-note-commands.d.ts +2 -0
- package/dist/ci-note-commands.js +12 -1
- package/dist/ci-product-words.d.ts +151 -1
- package/dist/ci-product-words.js +1390 -3
- package/dist/ci-product.d.ts +100 -4
- package/dist/ci-product.js +99 -3
- package/dist/ci-respond-run.d.ts +9 -0
- package/dist/ci-respond-run.js +35 -4
- package/dist/ci-respond-summary-env.d.ts +56 -0
- package/dist/ci-respond-summary-env.js +81 -0
- package/dist/ci-respond-summary.d.ts +103 -0
- package/dist/ci-respond-summary.js +243 -0
- package/dist/ci-respond.d.ts +4 -2
- package/dist/ci-respond.js +4 -2
- package/dist/cli/command-group.js +1 -1
- package/dist/cli/commands/lint.js +21 -3
- package/dist/cli/handlers/agent.js +49 -4
- package/dist/cli/handlers/approve.js +3 -1
- package/dist/cli/handlers/build.d.ts +97 -1
- package/dist/cli/handlers/build.js +251 -3
- package/dist/cli/handlers/fan-out.js +55 -0
- package/dist/cli/handlers/graph.d.ts +14 -0
- package/dist/cli/handlers/graph.js +58 -3
- package/dist/cli/handlers/lifecycle-health.d.ts +7 -0
- package/dist/cli/handlers/lifecycle-health.js +47 -9
- package/dist/cli/handlers/lifecycle.js +4 -1
- package/dist/cli/handlers/notify-relay.d.ts +2 -2
- package/dist/cli/handlers/notify-relay.js +67 -7
- package/dist/cli/handlers/pipeline-agent.d.ts +30 -0
- package/dist/cli/handlers/pipeline-agent.js +255 -0
- package/dist/cli/handlers/pipeline-artifacts.d.ts +39 -0
- package/dist/cli/handlers/pipeline-artifacts.js +203 -0
- package/dist/cli/handlers/pipeline.d.ts +16 -0
- package/dist/cli/handlers/pipeline.js +112 -0
- package/dist/cli/handlers/pr-comment.js +4 -0
- package/dist/cli/handlers/pr-notes.js +4 -1
- package/dist/cli/handlers/pr.d.ts +20 -0
- package/dist/cli/handlers/pr.js +114 -11
- package/dist/cli/handlers/promote.js +792 -47
- package/dist/cli/handlers/reject.d.ts +84 -0
- package/dist/cli/handlers/reject.js +216 -0
- package/dist/cli/handlers/release.js +4 -2
- package/dist/cli/handlers/replan.d.ts +54 -0
- package/dist/cli/handlers/replan.js +177 -0
- package/dist/cli/handlers/run-generate.d.ts +5 -0
- package/dist/cli/handlers/run-generate.js +31 -4
- package/dist/cli/handlers/run-wave.js +15 -2
- package/dist/cli/handlers/run.js +4 -2
- package/dist/cli/handlers/stage.d.ts +35 -0
- package/dist/cli/handlers/stage.js +90 -0
- package/dist/cli/lsp/server.js +4 -0
- package/dist/cli/main.js +88 -8
- package/dist/cli/parse-args.js +35 -2
- package/dist/cli/registry.d.ts +12 -0
- package/dist/components/auto-release.d.ts +2 -0
- package/dist/components/auto-release.js +1 -0
- package/dist/components/capability.d.ts +40 -0
- package/dist/components/cli-support.d.ts +21 -1
- package/dist/components/cli-support.js +28 -6
- package/dist/components/component.d.ts +23 -4
- package/dist/components/component.schema.json +28 -0
- package/dist/components/declared-reads.d.ts +44 -4
- package/dist/components/declared-reads.js +80 -3
- package/dist/components/discover.d.ts +8 -0
- package/dist/components/discover.js +1 -1
- package/dist/components/driver.d.ts +13 -0
- package/dist/components/driver.js +23 -2
- package/dist/components/environment-sets.d.ts +229 -0
- package/dist/components/environment-sets.js +338 -0
- package/dist/components/fan-out-canary.d.ts +47 -0
- package/dist/components/fan-out-canary.js +58 -0
- package/dist/components/fan-out-run.d.ts +17 -0
- package/dist/components/fan-out-run.js +14 -1
- package/dist/components/fan-out-support.d.ts +7 -0
- package/dist/components/fan-out-support.js +1 -1
- package/dist/components/groups.d.ts +8 -1
- package/dist/components/groups.js +19 -1
- package/dist/components/index.d.ts +5 -2
- package/dist/components/index.js +4 -1
- package/dist/components/pr-cost.d.ts +28 -0
- package/dist/components/pr-cost.js +53 -0
- package/dist/components/pr-pipeline.d.ts +33 -0
- package/dist/components/pr-pipeline.js +32 -5
- package/dist/components/pr-policy.d.ts +33 -2
- package/dist/components/pr-policy.js +5 -2
- package/dist/components/pr-risk.d.ts +42 -0
- package/dist/components/pr-risk.js +74 -0
- package/dist/components/product-pipeline.d.ts +43 -0
- package/dist/components/product-pipeline.js +67 -1
- package/dist/components/promote.d.ts +6 -0
- package/dist/components/promote.js +13 -0
- package/dist/components/release-compile.js +3 -1
- package/dist/components/release-gate.d.ts +6 -1
- package/dist/components/release-gate.js +10 -2
- package/dist/components/step-environments.d.ts +236 -0
- package/dist/components/step-environments.js +392 -0
- package/dist/components/upstream-replan.d.ts +201 -0
- package/dist/components/upstream-replan.js +249 -0
- package/dist/components/verify-step.d.ts +30 -0
- package/dist/components/verify-step.js +27 -0
- package/dist/components/wave-plan.js +6 -2
- package/dist/config-environments.d.ts +4 -2
- package/dist/control/dispatch.d.ts +15 -0
- package/dist/control/dispatch.js +28 -4
- package/dist/cost-estimate.d.ts +188 -0
- package/dist/cost-estimate.js +363 -0
- package/dist/drift-record.d.ts +36 -0
- package/dist/drift-record.js +44 -0
- package/dist/engine-facts.d.ts +105 -0
- package/dist/engine-facts.js +111 -0
- package/dist/exit-codes.d.ts +4 -3
- package/dist/exit-codes.js +4 -3
- package/dist/flag-params.d.ts +2 -2
- package/dist/flag-params.js +9 -4
- package/dist/floor-table.data.js +53 -0
- package/dist/forge-token-vars.d.ts +12 -0
- package/dist/forge-token-vars.js +25 -0
- package/dist/gate-decision.d.ts +3 -1
- package/dist/gate-decision.js +3 -1
- package/dist/gated-waves.d.ts +2 -0
- package/dist/gated-waves.js +1 -0
- package/dist/graph-ir.d.ts +30 -0
- package/dist/graph-ir.js +33 -1
- package/dist/graph-refs.d.ts +26 -0
- package/dist/graph-refs.js +34 -3
- package/dist/graph-schema/graph.schema.json +136 -0
- package/dist/health.d.ts +65 -0
- package/dist/health.js +62 -0
- package/dist/lexicon.d.ts +188 -1
- package/dist/lifecycle/disruption.d.ts +14 -1
- package/dist/lifecycle/disruption.js +5 -1
- package/dist/lifecycle/gate-change-set.d.ts +8 -0
- package/dist/lifecycle/gate-change-set.js +2 -1
- package/dist/lifecycle/gate-ledger.d.ts +26 -0
- package/dist/lifecycle/gate-rejection.d.ts +82 -0
- package/dist/lifecycle/gate-rejection.js +93 -0
- package/dist/lifecycle/gate-seal.d.ts +3 -3
- package/dist/lifecycle/gate-seal.js +5 -5
- package/dist/lifecycle/observe.d.ts +17 -0
- package/dist/lifecycle/observe.js +10 -1
- package/dist/lifecycle/release-cut.js +4 -0
- package/dist/lifecycle/release-ledger.d.ts +8 -0
- package/dist/lifecycle/release-risk.d.ts +137 -0
- package/dist/lifecycle/release-risk.js +214 -0
- package/dist/lifecycle/release-store.d.ts +9 -0
- package/dist/lifecycle/release-store.js +4 -0
- package/dist/lifecycle/stage-log.d.ts +85 -0
- package/dist/lifecycle/stage-log.js +141 -0
- package/dist/lint/canary-checks.d.ts +31 -0
- package/dist/lint/canary-checks.js +45 -0
- package/dist/lint/rule.d.ts +1 -0
- package/dist/lint/rules/evl012-pipeline-fold.d.ts +14 -0
- package/dist/lint/rules/evl012-pipeline-fold.js +30 -0
- package/dist/lint/rules/index.d.ts +1 -0
- package/dist/lint/rules/index.js +3 -0
- package/dist/notify-relay-repo.d.ts +54 -0
- package/dist/notify-relay-repo.js +84 -0
- package/dist/notify-relay.d.ts +53 -3
- package/dist/notify-relay.js +96 -3
- package/dist/notify.d.ts +57 -1
- package/dist/notify.js +7 -1
- package/dist/notify.schema.json +61 -3
- package/dist/observation.d.ts +34 -0
- package/dist/observation.js +14 -1
- package/dist/op/activities/review-agent.d.ts +39 -2
- package/dist/op/activities/review-agent.js +88 -5
- package/dist/op/agent-permit.d.ts +88 -0
- package/dist/op/agent-permit.js +97 -0
- package/dist/op/gate-approval-base.d.ts +8 -0
- package/dist/op/gate-approval-base.js +9 -0
- package/dist/op/gate-approval.d.ts +30 -1
- package/dist/op/gate-approval.js +23 -2
- package/dist/op/gate-quorum.d.ts +114 -8
- package/dist/op/gate-quorum.js +198 -21
- package/dist/op/gate-reject.d.ts +79 -0
- package/dist/op/gate-reject.js +96 -0
- package/dist/op/gate-summary.js +1 -1
- package/dist/op/gate.d.ts +28 -3
- package/dist/op/gate.js +55 -13
- package/dist/op/generate-pipeline.d.ts +15 -1
- package/dist/op/generate-pipeline.js +32 -5
- package/dist/op/index.d.ts +11 -6
- package/dist/op/index.js +10 -5
- package/dist/op/local-executor.d.ts +2 -0
- package/dist/op/local-executor.js +23 -4
- package/dist/op/op-waves-after-plan.d.ts +23 -0
- package/dist/op/op-waves-after-plan.js +12 -1
- package/dist/op/op-waves-capability-spec.d.ts +14 -0
- package/dist/op/op-waves-capability-spec.js +46 -6
- package/dist/op/op-waves-capability.d.ts +21 -13
- package/dist/op/op-waves-capability.js +22 -59
- package/dist/op/op-waves-environment-sets.d.ts +41 -0
- package/dist/op/op-waves-environment-sets.js +82 -0
- package/dist/op/op-waves-quorum-warnings.d.ts +53 -0
- package/dist/op/op-waves-quorum-warnings.js +90 -0
- package/dist/op/op-waves-release-port.d.ts +7 -0
- package/dist/op/op-waves-release-port.js +15 -3
- package/dist/op/op-waves-release.d.ts +15 -0
- package/dist/op/op-waves-release.js +15 -0
- package/dist/op/op-waves-run.d.ts +37 -3
- package/dist/op/op-waves-run.js +141 -18
- package/dist/op/op-waves-soak.d.ts +57 -0
- package/dist/op/op-waves-soak.js +111 -0
- package/dist/op/op-waves-split.d.ts +4 -0
- package/dist/op/op-waves-split.js +4 -0
- package/dist/op/op-waves.d.ts +67 -4
- package/dist/op/op-waves.js +71 -3
- package/dist/pipeline/agent-ajv.d.ts +4 -0
- package/dist/pipeline/agent-ajv.js +14 -0
- package/dist/pipeline/agent-steps.d.ts +329 -0
- package/dist/pipeline/agent-steps.js +602 -0
- package/dist/pipeline/artifacts.d.ts +264 -0
- package/dist/pipeline/artifacts.js +425 -0
- package/dist/pipeline/diff.d.ts +45 -0
- package/dist/pipeline/diff.js +177 -0
- package/dist/pipeline/fold.d.ts +43 -0
- package/dist/pipeline/fold.js +140 -0
- package/dist/pipeline/generate.d.ts +52 -0
- package/dist/pipeline/generate.js +120 -0
- package/dist/pipeline/product.d.ts +225 -0
- package/dist/pipeline/product.js +257 -0
- package/dist/pipeline/promote.d.ts +404 -0
- package/dist/pipeline/promote.js +694 -0
- package/dist/pipeline/read.d.ts +37 -0
- package/dist/pipeline/read.js +58 -0
- package/dist/pipeline/rendered.d.ts +25 -0
- package/dist/pipeline/rendered.js +53 -0
- package/dist/pipeline/soak-checks.d.ts +80 -0
- package/dist/pipeline/soak-checks.js +254 -0
- package/dist/pipeline/soak-gate.d.ts +97 -0
- package/dist/pipeline/soak-gate.js +176 -0
- package/dist/pipeline/soak-sources.d.ts +17 -0
- package/dist/pipeline/soak-sources.js +42 -0
- package/dist/pipeline/soak.d.ts +260 -0
- package/dist/pipeline/soak.js +378 -0
- package/dist/pipeline/spec.d.ts +724 -0
- package/dist/pipeline/spec.js +567 -0
- package/dist/pipeline/stage-ledger.d.ts +187 -0
- package/dist/pipeline/stage-ledger.js +185 -0
- package/dist/pipeline/stage-waves.d.ts +114 -0
- package/dist/pipeline/stage-waves.js +161 -0
- package/dist/pipeline/stages.d.ts +64 -0
- package/dist/pipeline/stages.js +174 -0
- package/dist/pipeline/verify-rollback.d.ts +277 -0
- package/dist/pipeline/verify-rollback.js +393 -0
- package/dist/pipeline.d.ts +142 -0
- package/dist/pipeline.js +143 -0
- package/dist/pr-loop.d.ts +22 -0
- package/dist/pr-loop.js +8 -0
- package/dist/pr-plan-note.d.ts +15 -1
- package/dist/pr-plan-note.js +8 -0
- package/dist/pr-post.d.ts +31 -0
- package/dist/pr-post.js +89 -0
- package/dist/release-floors.d.ts +1 -1
- package/dist/release-floors.js +1 -1
- package/dist/report-store/audit.schema.json +50 -0
- package/dist/report-store/dora.schema.json +331 -0
- package/dist/report-store/estate.schema.json +96 -0
- package/dist/report-store/run.schema.json +14 -0
- package/dist/report-store.d.ts +151 -0
- package/dist/report-store.js +344 -0
- package/dist/run-event.d.ts +7 -2
- package/dist/wave-runtime.mjs +458 -404
- package/dist/workspace/catalog-edges.js +3 -3
- package/dist/workspace/change-set.schema.json +4 -0
- package/dist/workspace/ci-cloud-identity.d.ts +4 -0
- package/dist/workspace/ci-cloud-identity.js +30 -0
- package/dist/workspace/ci-run.js +17 -2
- package/dist/workspace/ci-secrets.d.ts +3 -1
- package/dist/workspace/ci-secrets.js +7 -1
- package/dist/workspace/compose-graph.d.ts +1 -1
- package/dist/workspace/compose-graph.js +3 -1
- package/dist/workspace/declaration.d.ts +27 -0
- package/dist/workspace/declaration.js +35 -0
- package/dist/workspace/declaration.schema.json +56 -0
- package/dist/workspace/graph-cli.js +26 -0
- package/dist/workspace/graph.schema.json +5 -1
- package/dist/workspace/identity-gate-rule.d.ts +4 -0
- package/dist/workspace/identity-gate-rule.js +2 -2
- package/dist/workspace/identity-reject-rule.d.ts +14 -0
- package/dist/workspace/identity-reject-rule.js +24 -0
- package/dist/workspace/identity.d.ts +3 -0
- package/dist/workspace/identity.js +2 -1
- package/dist/workspace/nested-graph.js +2 -0
- package/dist/workspace/pr-report.schema.json +65 -0
- package/dist/workspace/promotion-order.d.ts +19 -4
- package/dist/workspace/promotion-order.js +26 -4
- package/dist/workspace/release-train.d.ts +14 -0
- package/dist/workspace/release-train.js +32 -0
- package/dist/workspace/run-event.schema.json +2 -2
- package/dist/workspace/stack-read-edges.d.ts +19 -0
- package/dist/workspace/stack-read-edges.js +54 -0
- package/dist/workspace/status-gates.d.ts +51 -1
- package/dist/workspace/status-gates.js +60 -0
- package/dist/workspace/status-stages.d.ts +223 -0
- package/dist/workspace/status-stages.js +279 -0
- package/dist/workspace/status.d.ts +45 -1
- package/dist/workspace/status.js +109 -5
- package/dist/workspace/status.schema.json +283 -2
- package/dist/workspace/train-cut.js +5 -2
- package/dist/workspace/train-shell.d.ts +18 -0
- package/dist/workspace/train-shell.js +43 -0
- package/dist/workspace/trust/seal.d.ts +7 -0
- package/dist/workspace/trust/seal.js +9 -0
- package/package.json +5 -1
package/dist/op/op-waves.js
CHANGED
|
@@ -88,9 +88,11 @@
|
|
|
88
88
|
* resolution that cites it and the wave goes on, and any other answer refuses
|
|
89
89
|
* the wave (exit 8). See `./op-waves-run.ts`.
|
|
90
90
|
*/
|
|
91
|
+
import { soakCheckCount, soakProblems } from "../pipeline/soak.js";
|
|
91
92
|
import { gatePointProblems } from "./gate-point.js";
|
|
92
93
|
import { quorumProblems } from "./gate-quorum.js";
|
|
93
94
|
import { notifyConfigProblem } from "../notify.js";
|
|
95
|
+
import { waveSummaryJobEnv, waveSummarySpecProblem } from "../ci-respond-summary-env.js";
|
|
94
96
|
import { WAVE_GATE_NAME_PATTERN, waveGateNameFrom, waveShare } from "../wave-layout.js";
|
|
95
97
|
import { waveOutcomeFileName } from "../wave-blocked.js";
|
|
96
98
|
import { opWavesEvidenceProblems } from "./op-waves-evidence-spec.js";
|
|
@@ -105,6 +107,15 @@ import { CONTROL_DISPATCH_JOB, CONTROL_NAME, controlSettingsProblems, resolveCon
|
|
|
105
107
|
* `dist/notify.js` (#3803), which only a packed release carries.
|
|
106
108
|
*/
|
|
107
109
|
export { notifyVariables } from "../notify.js";
|
|
110
|
+
/**
|
|
111
|
+
* The variables a wave job carries for `wave-refused: summary` (#5335): the
|
|
112
|
+
* spec's `waveSummary` as `CHANT_WAVE_SUMMARY_*` and, on GitHub and Forgejo,
|
|
113
|
+
* the model's key from the secret of its name. Empty unless the spec's
|
|
114
|
+
* `respond` sets `"wave-refused": "summary"`, so other specs render as before.
|
|
115
|
+
*/
|
|
116
|
+
export function opWavesSummaryEnv(spec, forge) {
|
|
117
|
+
return waveSummaryJobEnv(forge, spec.respond?.["wave-refused"], spec.waveSummary);
|
|
118
|
+
}
|
|
108
119
|
export const OP_WAVE_GATE_POLICIES = ["always", "on-destructive", "never"];
|
|
109
120
|
export const GATE_APPROVAL_SOURCES = ["ledger", "pr-review", "sealed", "pull-request"];
|
|
110
121
|
/** A wave's or a spec's `point` as an {@link OpWavePoint}, or undefined when it names none. */
|
|
@@ -324,6 +335,34 @@ export function opWaveOutcomePath(spec, wave, part = {}) {
|
|
|
324
335
|
return `${opWaveOutcomeDir(spec)}/${waveOutcomeFileName(wave, part)}`;
|
|
325
336
|
}
|
|
326
337
|
const NAME = /^[a-z0-9][a-z0-9_-]*$/;
|
|
338
|
+
/** Whether a wave's `failureTolerance` reads (#5324): a whole number, or `"<n>%"` from 0 to 100. */
|
|
339
|
+
export function opWaveFailureToleranceReads(value) {
|
|
340
|
+
return (typeof value === "number" && Number.isInteger(value) && value >= 0) || (typeof value === "string" && /^(100|[1-9]?[0-9])%$/.test(value));
|
|
341
|
+
}
|
|
342
|
+
/** How many failed runs of a wave of `runs` its `failureTolerance` lets through (#5324). */
|
|
343
|
+
export function opWaveToleratedFailures(tolerance, runs) {
|
|
344
|
+
if (tolerance === undefined || !opWaveFailureToleranceReads(tolerance))
|
|
345
|
+
return 0;
|
|
346
|
+
return typeof tolerance === "number" ? tolerance : Math.floor((runs * Number(tolerance.slice(0, -1))) / 100);
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Warnings for a spec's canary wave (#5327), one line each: a canary wave
|
|
350
|
+
* with no soak checks, which holds nothing once it applies, and a canary
|
|
351
|
+
* that is the only wave, which has nothing after it to hold. The spec is
|
|
352
|
+
* not refused: a product's `waves.canary` orders the waves as it did.
|
|
353
|
+
*/
|
|
354
|
+
export function opWavesCanaryWarnings(spec) {
|
|
355
|
+
const first = spec.waves[0];
|
|
356
|
+
if (!first?.canary)
|
|
357
|
+
return [];
|
|
358
|
+
const out = [];
|
|
359
|
+
if (soakCheckCount(first.soak) === 0) {
|
|
360
|
+
out.push(`wave 1 (${first.name}) is the canary and has no soak checks, so the waves after it go on as soon as it applies. Give the canary wave a soak with checks, such as the environment's soak`);
|
|
361
|
+
}
|
|
362
|
+
if (spec.waves.length === 1)
|
|
363
|
+
out.push(`wave 1 (${first.name}) is the canary and the only wave, so no wave waits for it; the stage's soak holds the next stage`);
|
|
364
|
+
return out;
|
|
365
|
+
}
|
|
327
366
|
/** Refuse a spec no job could run, naming what is wrong. */
|
|
328
367
|
export function assertOpWavesSpec(spec) {
|
|
329
368
|
const where = `Op waves "${spec.name}"`;
|
|
@@ -337,6 +376,9 @@ export function assertOpWavesSpec(spec) {
|
|
|
337
376
|
}
|
|
338
377
|
if (!spec.op)
|
|
339
378
|
throw new Error(`${where} names no \`op\`. Name the Op a run runs when it names none.`);
|
|
379
|
+
if (spec.replanDependents !== undefined && !(Array.isArray(spec.replanDependents) && spec.replanDependents.every((m) => typeof m === "string" && m.trim() !== ""))) {
|
|
380
|
+
throw new Error(`${where}: \`replanDependents\` must be a list of member names or patterns.`);
|
|
381
|
+
}
|
|
340
382
|
if (spec.plan !== undefined && spec.planWave !== undefined) {
|
|
341
383
|
throw new Error(`${where} has both \`plan\` and \`planWave\`. A wave is planned one run at a time or all at once; give one.`);
|
|
342
384
|
}
|
|
@@ -411,8 +453,8 @@ export function assertOpWavesSpec(spec) {
|
|
|
411
453
|
if (key === "quorum") {
|
|
412
454
|
// #4290: approval rules, read at base like the policy.
|
|
413
455
|
if (!Array.isArray(value))
|
|
414
|
-
throw new Error(`${where}: approvals.quorum must be a list of rules, each { "targets"?, "count", "roles"?, "notAuthor"? }.`);
|
|
415
|
-
const problems = quorumProblems(value, "approvals.quorum", { notAuthor: true });
|
|
456
|
+
throw new Error(`${where}: approvals.quorum must be a list of rules, each { "name"?, "targets"?, "count", "roles"?, "notAuthor"?, "proven"? } or a group { "name"?, "all" | "any": [...] }.`);
|
|
457
|
+
const problems = quorumProblems(value, "approvals.quorum", { notAuthor: true, proven: true, combine: true });
|
|
416
458
|
if (problems.length > 0)
|
|
417
459
|
throw new Error(`${where}: ${problems.join("; ")}.`);
|
|
418
460
|
continue;
|
|
@@ -518,7 +560,7 @@ export function assertOpWavesSpec(spec) {
|
|
|
518
560
|
if (respond === null || typeof respond !== "object" || Array.isArray(respond))
|
|
519
561
|
throw new Error(`${where}: respond must be an object of event to mode, such as { "wave-refused": "off" }.`);
|
|
520
562
|
// The wave events and their modes, as ../ci-respond.ts's CI_RESPONSES has them.
|
|
521
|
-
const modes = { "wave-refused": ["diff", "off"], "apply-failed": ["triage", "off"] };
|
|
563
|
+
const modes = { "wave-refused": ["diff", "summary", "off"], "apply-failed": ["triage", "off"] };
|
|
522
564
|
for (const [event, mode] of Object.entries(respond)) {
|
|
523
565
|
if (event === "description")
|
|
524
566
|
throw new Error(`${where}: respond: the description check runs in the plan-note job, so an op waves spec takes only wave-refused and apply-failed.`);
|
|
@@ -529,6 +571,11 @@ export function assertOpWavesSpec(spec) {
|
|
|
529
571
|
throw new Error(`${where}: respond: ${event} takes ${allowed.join(" or ")}, not ${JSON.stringify(mode)}.`);
|
|
530
572
|
}
|
|
531
573
|
}
|
|
574
|
+
if (spec.waveSummary !== undefined) {
|
|
575
|
+
const problem = waveSummarySpecProblem(spec.waveSummary);
|
|
576
|
+
if (problem)
|
|
577
|
+
throw new Error(`${where}: waveSummary: ${problem}.`);
|
|
578
|
+
}
|
|
532
579
|
const names = new Set();
|
|
533
580
|
for (const wave of spec.waves) {
|
|
534
581
|
if (!NAME.test(wave.name)) {
|
|
@@ -561,6 +608,27 @@ export function assertOpWavesSpec(spec) {
|
|
|
561
608
|
throw new Error(`${where}: wave "${wave.name}" has discover ${JSON.stringify(wave.discover)}; use true or false.`);
|
|
562
609
|
if (wave.rest !== undefined && typeof wave.rest !== "boolean")
|
|
563
610
|
throw new Error(`${where}: wave "${wave.name}" has rest ${JSON.stringify(wave.rest)}; use true or false.`);
|
|
611
|
+
if (wave.failureTolerance !== undefined && !opWaveFailureToleranceReads(wave.failureTolerance))
|
|
612
|
+
throw new Error(`${where}: wave "${wave.name}" has failureTolerance ${JSON.stringify(wave.failureTolerance)}; use a whole number of runs, or a share such as "10%".`);
|
|
613
|
+
if (wave.soak !== undefined) {
|
|
614
|
+
// #5326: a wave's soak holds the wave after it, so the last wave, and a rest wave that walks the rest in one job, take none.
|
|
615
|
+
const problems = soakProblems(wave.soak, `wave "${wave.name}"`);
|
|
616
|
+
if (wave === spec.waves[spec.waves.length - 1])
|
|
617
|
+
problems.push(`wave "${wave.name}" has soak and is the last wave; a wave's soak holds the wave after it`);
|
|
618
|
+
if (wave.rest)
|
|
619
|
+
problems.push(`wave "${wave.name}" has soak and rest; the waves a rest wave walks run in its one job`);
|
|
620
|
+
if (problems.length > 0)
|
|
621
|
+
throw new Error(`${where}: ${problems.join("; ")}.`);
|
|
622
|
+
}
|
|
623
|
+
if (wave.canary !== undefined) {
|
|
624
|
+
// #5327: the canary applies first, and its soak holds the waves after it in their own jobs.
|
|
625
|
+
if (typeof wave.canary !== "boolean")
|
|
626
|
+
throw new Error(`${where}: wave "${wave.name}" has canary ${JSON.stringify(wave.canary)}; use true or false.`);
|
|
627
|
+
if (wave.canary && wave !== spec.waves[0])
|
|
628
|
+
throw new Error(`${where}: wave "${wave.name}" is a canary wave and not the first wave; the canary applies before every other wave.`);
|
|
629
|
+
if (wave.canary && wave.rest)
|
|
630
|
+
throw new Error(`${where}: wave "${wave.name}" is a canary wave and has rest; the waves a rest wave walks run in its one job, so none of them could wait for the canary's soak.`);
|
|
631
|
+
}
|
|
564
632
|
if (wave.together !== undefined && typeof wave.together !== "boolean")
|
|
565
633
|
throw new Error(`${where}: wave "${wave.name}" has together ${JSON.stringify(wave.together)}; use true or false.`);
|
|
566
634
|
if (wave.together && spec.step === undefined)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Ajv 2020-12 validator class for agent step schemas (#5358), loaded on
|
|
3
|
+
* first use, as `../workspace/ajv2020.ts` loads it. A module of its own so
|
|
4
|
+
* the pipeline spec, which level-0 commands load, reaches no workspace
|
|
5
|
+
* module; the slim wave-job runtime swaps it for its bundled ajv the same
|
|
6
|
+
* way (`../../scripts/build-wave-runtime.mjs`).
|
|
7
|
+
*/
|
|
8
|
+
import { createRequire } from "node:module";
|
|
9
|
+
export function loadAgentAjv() {
|
|
10
|
+
const require = createRequire(import.meta.url);
|
|
11
|
+
// ajv is CommonJS; its class is the default export, or that export's own default.
|
|
12
|
+
const mod = require("ajv/dist/2020");
|
|
13
|
+
return (mod.default ?? mod);
|
|
14
|
+
}
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent steps (#5358): a model's reading of a release, as a step of the
|
|
3
|
+
* stage that takes it, with an answer of a declared shape that later steps,
|
|
4
|
+
* the gate's policy and the risk record read.
|
|
5
|
+
*
|
|
6
|
+
* A stage declares its agent steps under `agentSteps`, by name:
|
|
7
|
+
*
|
|
8
|
+
* {
|
|
9
|
+
* name: "prod",
|
|
10
|
+
* waves: [...],
|
|
11
|
+
* gate: { holds: { policy: true } },
|
|
12
|
+
* agentSteps: {
|
|
13
|
+
* watch: {
|
|
14
|
+
* prompt: "List the services to watch during the soak, from the endpoints staging published.",
|
|
15
|
+
* reads: { endpoint: { stage: "staging", artifact: "endpoint" } },
|
|
16
|
+
* schema: { type: "object", required: ["services"], properties: { services: { type: "array", items: { type: "string" } } } },
|
|
17
|
+
* },
|
|
18
|
+
* notes: { prompt: "Write the release notes' summary.", reads: { watch: { step: "watch" } }, schema: { type: "string" } },
|
|
19
|
+
* },
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* - `reads` names what the step reads, keyed by the name the prompt shows
|
|
23
|
+
* it under: an artifact an earlier stage published for the same release
|
|
24
|
+
* (`{ stage, artifact }`, #5356), or the answer of a step declared before
|
|
25
|
+
* it in the same stage (`{ step }`). A secret artifact reads as where it
|
|
26
|
+
* is kept, never as its value ({@link stageArtifactText}).
|
|
27
|
+
* - `schema` is a JSON Schema (2020-12) the answer must match. `chant build`
|
|
28
|
+
* refuses a schema that does not compile.
|
|
29
|
+
*
|
|
30
|
+
* Where it runs: an agent step answers for the release its stage takes, so
|
|
31
|
+
* it belongs to a stage a release is promoted into. `chant build` refuses
|
|
32
|
+
* one on the first stage, which applies before the merge cuts its release.
|
|
33
|
+
* `chant pipeline agent run --stage <stage> --release <ref>` runs every step
|
|
34
|
+
* of the stage in order ({@link runStageAgentSteps}) in a job that holds a
|
|
35
|
+
* read token only: it reads the ledger, runs the model command in an
|
|
36
|
+
* environment holding the model's key and nothing else, and writes each
|
|
37
|
+
* answer to a file. It writes no ledger line and pushes nothing. The promote
|
|
38
|
+
* job then runs `chant pipeline agent record`, which checks each answer
|
|
39
|
+
* against the schema at base again and records it on `<stage>/agent-answers.jsonl`
|
|
40
|
+
* on `chant/lifecycle`, with the release digest, the prompt's digest and
|
|
41
|
+
* what the command reported it cost, plus one run record per model run
|
|
42
|
+
* under op `<pipeline>-<stage>-<step>`, which the step's `maxRuns` and
|
|
43
|
+
* `maxCostUsd` count as every agent's limits do (`../ci-agent.ts`).
|
|
44
|
+
*
|
|
45
|
+
* An answer that does not parse, or does not match the schema, fails the
|
|
46
|
+
* step: the run exits 1 naming the schema's complaint, the record says
|
|
47
|
+
* `failed` with the same reason, and `chant components promote` holds the
|
|
48
|
+
* stage (exit 3) until every step has a matching answer for the release
|
|
49
|
+
* ({@link stageAgentStepsHold}).
|
|
50
|
+
*
|
|
51
|
+
* What reads an answer:
|
|
52
|
+
* - a later step of the same stage, through `reads: { x: { step } }`;
|
|
53
|
+
* - the gate's policy: with `gate.holds.policy`, the promote runs the
|
|
54
|
+
* workspace's `ci.policy` at base with the answers as `input.agent.<step>`
|
|
55
|
+
* ({@link stageAgentPolicyInput}). A deny refuses the promote;
|
|
56
|
+
* - the risk record (#5325): an answer with `risk: "low" | "medium" |
|
|
57
|
+
* "high"` is one reason `agent.<step>` of the score the stage gate's
|
|
58
|
+
* `holds.risk` reads, weighed as the review's level is
|
|
59
|
+
* ({@link agentStepRiskLevels}, `scoreChangeRisk`'s `agent` fact). It only
|
|
60
|
+
* raises the score;
|
|
61
|
+
* - any other reader: {@link readStageAgentAnswers}.
|
|
62
|
+
*
|
|
63
|
+
* The step never approves and never applies. A stage whose gate policy reads
|
|
64
|
+
* the answers cannot set `gate.policy: never`, and its gate counts a
|
|
65
|
+
* person's approval only: an approval an agent recorded is refused by name
|
|
66
|
+
* ({@link agentStepGateRule}).
|
|
67
|
+
*
|
|
68
|
+
* Off by default: a stage with no `agentSteps` runs no model, and its jobs
|
|
69
|
+
* render as before.
|
|
70
|
+
*/
|
|
71
|
+
import type { AgentUsage } from "../ci-agent.js";
|
|
72
|
+
import type { GateApprovalRule } from "../op/gate.js";
|
|
73
|
+
import { type StageArtifactPort, type StageArtifactRead, type StageArtifactValue } from "./artifacts.js";
|
|
74
|
+
import type { PipelineSpec } from "./spec.js";
|
|
75
|
+
/**
|
|
76
|
+
* The first chant with agent steps (#5358): a stage's `agentSteps` in
|
|
77
|
+
* `.chant/pipeline.ts`, `chant pipeline agent run|record|answer`, the
|
|
78
|
+
* promote's hold on a missing or failed answer, `input.agent.<step>` in the
|
|
79
|
+
* stage gate's policy, and {@link readStageAgentAnswers}. A product
|
|
80
|
+
* feature-detects agent steps on this name.
|
|
81
|
+
*/
|
|
82
|
+
export declare const STAGE_AGENT_STEPS_FLOOR = "0.124.110";
|
|
83
|
+
/** The ledger file a stage's answers are kept in, beside its `releases.jsonl` and `artifacts.jsonl`. */
|
|
84
|
+
export declare const STAGE_AGENT_ANSWERS_FILE = "agent-answers.jsonl";
|
|
85
|
+
/** The record kind a line of {@link STAGE_AGENT_ANSWERS_FILE} carries. A reader skips any other. */
|
|
86
|
+
export declare const STAGE_AGENT_ANSWER_KIND = "stage-agent-answer";
|
|
87
|
+
/** The trigger word a step's run record carries. */
|
|
88
|
+
export declare const AGENT_STEP_TRIGGER = "agent-step";
|
|
89
|
+
/** The ledger environment a step's run records go under, as every agent's do. */
|
|
90
|
+
export declare const AGENT_STEP_RUN_ENV = "local";
|
|
91
|
+
/** Minutes the model command may run unless `timeout` says otherwise. */
|
|
92
|
+
export declare const AGENT_STEP_TIMEOUT_MINUTES = 10;
|
|
93
|
+
/** The variable holding the model's key unless `keyEnv` names another. */
|
|
94
|
+
export declare const AGENT_STEP_KEY_ENV = "ANTHROPIC_API_KEY";
|
|
95
|
+
/** The longest prompt a step declares, in characters. */
|
|
96
|
+
export declare const AGENT_STEP_PROMPT_MAX = 4000;
|
|
97
|
+
/** The largest schema a step declares, as JSON text in bytes. */
|
|
98
|
+
export declare const AGENT_STEP_SCHEMA_MAX_BYTES = 16384;
|
|
99
|
+
/** The keys a step takes. */
|
|
100
|
+
export declare const AGENT_STEP_KEYS: readonly string[];
|
|
101
|
+
/** What a step reads under one name. */
|
|
102
|
+
export type AgentStepRead =
|
|
103
|
+
/** An artifact an earlier stage published for the release this stage takes (#5356). */
|
|
104
|
+
StageArtifactRead
|
|
105
|
+
/** The answer of a step declared before this one in the same stage. */
|
|
106
|
+
| {
|
|
107
|
+
step: string;
|
|
108
|
+
};
|
|
109
|
+
/** One agent step of a stage. */
|
|
110
|
+
export interface PipelineAgentStep {
|
|
111
|
+
/** What the model is asked, in plain words. The inputs and the schema follow it in the prompt. */
|
|
112
|
+
prompt: string;
|
|
113
|
+
/** What the step reads, keyed by the name the prompt shows each under. Absent: nothing. */
|
|
114
|
+
reads?: Record<string, AgentStepRead>;
|
|
115
|
+
/** The JSON Schema (2020-12) the answer must match. */
|
|
116
|
+
schema: Record<string, unknown>;
|
|
117
|
+
/** The model command, run through the shell with the prompt on stdin and the answer on stdout. Default: the review command with `--output-format json`. */
|
|
118
|
+
command?: string;
|
|
119
|
+
/** The variable holding the model's key, the one secret the command sees. Default {@link AGENT_STEP_KEY_ENV}. */
|
|
120
|
+
keyEnv?: string;
|
|
121
|
+
/** Minutes the command may run. Default {@link AGENT_STEP_TIMEOUT_MINUTES}. */
|
|
122
|
+
timeout?: number;
|
|
123
|
+
/** The most runs of this step per day, counted on the run ledger. Absent: no count limit. */
|
|
124
|
+
maxRuns?: number;
|
|
125
|
+
/** The most US dollars this step's runs may cost per day, summed from their run records. Absent: no money limit. */
|
|
126
|
+
maxCostUsd?: number;
|
|
127
|
+
}
|
|
128
|
+
/** One line of `<stage>/agent-answers.jsonl`: one step's answer, or why it has none, for one release. */
|
|
129
|
+
export interface StageAgentAnswerRecord {
|
|
130
|
+
version: 1;
|
|
131
|
+
kind: typeof STAGE_AGENT_ANSWER_KIND;
|
|
132
|
+
pipeline: string;
|
|
133
|
+
stage: string;
|
|
134
|
+
step: string;
|
|
135
|
+
/** The release digest the stage takes. */
|
|
136
|
+
release: string;
|
|
137
|
+
label?: string;
|
|
138
|
+
gitSha?: string;
|
|
139
|
+
at: string;
|
|
140
|
+
/** `answered`: `answer` matches the schema. `failed`: `reason` says why there is no answer. */
|
|
141
|
+
status: "answered" | "failed";
|
|
142
|
+
answer?: StageArtifactValue;
|
|
143
|
+
reason?: string;
|
|
144
|
+
/** `sha256:` over the prompt, when the command ran. */
|
|
145
|
+
promptDigest?: string;
|
|
146
|
+
/** `sha256:` over the schema's JSON text, the schema the answer was checked against. */
|
|
147
|
+
schemaDigest: string;
|
|
148
|
+
/** The model, tokens and cost the command reported. */
|
|
149
|
+
usage?: AgentUsage;
|
|
150
|
+
/** What the step read, by name, without values. */
|
|
151
|
+
reads?: Array<{
|
|
152
|
+
name: string;
|
|
153
|
+
stage?: string;
|
|
154
|
+
artifact?: string;
|
|
155
|
+
step?: string;
|
|
156
|
+
secret?: true;
|
|
157
|
+
}>;
|
|
158
|
+
/** When the model ran, for the run record. */
|
|
159
|
+
started?: string;
|
|
160
|
+
ended?: string;
|
|
161
|
+
}
|
|
162
|
+
/** Where a stage's answers are read and written. */
|
|
163
|
+
export interface StageAgentAnswerPort {
|
|
164
|
+
read(stage: string): Promise<StageAgentAnswerRecord[]>;
|
|
165
|
+
append(stage: string, record: StageAgentAnswerRecord): Promise<void>;
|
|
166
|
+
}
|
|
167
|
+
/** `sha256:` over a schema's JSON text. */
|
|
168
|
+
export declare function agentStepSchemaDigest(schema: unknown): string;
|
|
169
|
+
/** What is wrong with `answer` against `schema`, one line each; empty when it matches. */
|
|
170
|
+
export declare function agentAnswerProblems(schema: unknown, answer: unknown): string[];
|
|
171
|
+
/** What is wrong with a stage's `agentSteps` on its own, one line each. What it reads across stages is {@link stageAgentStepsSpecProblems}'s. */
|
|
172
|
+
export declare function stageAgentStepsProblems(steps: unknown, at: string): string[];
|
|
173
|
+
/**
|
|
174
|
+
* What the pipeline's agent steps read that nothing gives them, one line
|
|
175
|
+
* each (#5358): a step on the first stage, which applies before its release
|
|
176
|
+
* is cut; an artifact read of a stage that is not earlier, or an artifact
|
|
177
|
+
* that stage never publishes; and a stage whose gate policy reads the
|
|
178
|
+
* answers while its gate never waits. `chant build` refuses each.
|
|
179
|
+
*/
|
|
180
|
+
export declare function stageAgentStepsSpecProblems(spec: {
|
|
181
|
+
stages?: unknown;
|
|
182
|
+
}): string[];
|
|
183
|
+
/** A step's settings, every default filled. */
|
|
184
|
+
export interface AgentStepSettings {
|
|
185
|
+
/** The op its run records go under: `<pipeline>-<stage>-<step>`. */
|
|
186
|
+
name: string;
|
|
187
|
+
env: string;
|
|
188
|
+
command: string;
|
|
189
|
+
keyEnv: string;
|
|
190
|
+
timeout: number;
|
|
191
|
+
maxRuns?: number;
|
|
192
|
+
maxCostUsd?: number;
|
|
193
|
+
}
|
|
194
|
+
/** The step's settings with every default filled. `command` defaults to `defaultCommand`, the review command printing JSON. */
|
|
195
|
+
export declare function agentStepSettings(spec: Pick<PipelineSpec, "name">, stage: string, step: string, declared: PipelineAgentStep, defaultCommand: string): AgentStepSettings;
|
|
196
|
+
/** The steps of `stage` in declared order, or none. */
|
|
197
|
+
export declare function stageAgentSteps(spec: Pick<PipelineSpec, "stages">, stage: string): Array<[string, PipelineAgentStep]>;
|
|
198
|
+
/** The variables holding the model keys a stage's steps read, each once, in order. */
|
|
199
|
+
export declare function stageAgentKeyEnvs(spec: Pick<PipelineSpec, "stages">, stage: string): string[];
|
|
200
|
+
/** The records in a ledger file's text, oldest first, malformed lines left out. */
|
|
201
|
+
export declare function parseStageAgentAnswerRecords(text: string): StageAgentAnswerRecord[];
|
|
202
|
+
/** {@link StageAgentAnswerPort} on `chant/lifecycle`, at `<stage>/agent-answers.jsonl`. */
|
|
203
|
+
export declare function gitStageAgentAnswerPort(opts?: {
|
|
204
|
+
cwd?: string;
|
|
205
|
+
member?: string;
|
|
206
|
+
ledgerPrefix?: string;
|
|
207
|
+
}): StageAgentAnswerPort;
|
|
208
|
+
/**
|
|
209
|
+
* The answers `stage`'s steps have for `release` (#5358), the newest record
|
|
210
|
+
* of each step, by step name. A step with no record is absent. This is the
|
|
211
|
+
* read the risk record and any other reader takes: an `answered` record's
|
|
212
|
+
* `answer` matched the schema when it was recorded.
|
|
213
|
+
*/
|
|
214
|
+
export declare function readStageAgentAnswers(port: StageAgentAnswerPort, query: {
|
|
215
|
+
stage: string;
|
|
216
|
+
release: string;
|
|
217
|
+
}): Promise<Record<string, StageAgentAnswerRecord>>;
|
|
218
|
+
/** One step's answer as a policy reads it under `input.agent.<step>`, camelCase as `input.cost` is. */
|
|
219
|
+
export interface PolicyAgentAnswer {
|
|
220
|
+
answer: StageArtifactValue;
|
|
221
|
+
stage: string;
|
|
222
|
+
release: string;
|
|
223
|
+
label?: string;
|
|
224
|
+
promptDigest?: string;
|
|
225
|
+
schemaDigest: string;
|
|
226
|
+
/** What the command reported the run cost, in US dollars. */
|
|
227
|
+
costUsd?: number;
|
|
228
|
+
model?: string;
|
|
229
|
+
at: string;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* `input.agent` for the gate's policy (#5358): each answered step of the
|
|
233
|
+
* stage, by name. A failed step is absent, and the promote holds before any
|
|
234
|
+
* policy runs while one is ({@link stageAgentStepsHold}).
|
|
235
|
+
*/
|
|
236
|
+
export declare function stageAgentPolicyInput(answers: Record<string, StageAgentAnswerRecord>): Record<string, PolicyAgentAnswer>;
|
|
237
|
+
/**
|
|
238
|
+
* The level each answered step names for the risk record (#5325, #5358): an
|
|
239
|
+
* answer that is an object with `risk` of `low`, `medium` or `high`. The
|
|
240
|
+
* scorer weighs each as it weighs the review's level
|
|
241
|
+
* (`scoreChangeRisk`'s `agent` fact). A step whose answer names no level,
|
|
242
|
+
* or a failed one, adds nothing; a failed one holds the stage first.
|
|
243
|
+
*/
|
|
244
|
+
export declare function agentStepRiskLevels(answers: Record<string, StageAgentAnswerRecord>): Record<string, "low" | "medium" | "high">;
|
|
245
|
+
/**
|
|
246
|
+
* Why `stage` holds for `release` (#5358), one line per step: a step with no
|
|
247
|
+
* record, a failed one with its reason, and an answer that does not match
|
|
248
|
+
* the schema the stage declares now. Empty when every step answered.
|
|
249
|
+
*/
|
|
250
|
+
export declare function stageAgentStepsHold(spec: Pick<PipelineSpec, "stages">, stage: string, release: string, answers: Record<string, StageAgentAnswerRecord>): string[];
|
|
251
|
+
/**
|
|
252
|
+
* The approval rule a gate takes while its policy reads agent answers
|
|
253
|
+
* (#5358): an approval an agent recorded never counts, and the wait names
|
|
254
|
+
* why. Combined with the port's own rule by the caller.
|
|
255
|
+
*/
|
|
256
|
+
export declare function agentStepGateRule(gate: string): GateApprovalRule;
|
|
257
|
+
/** The answer as the model printed it: Claude Code's JSON result's text, or the output as it is. */
|
|
258
|
+
export declare function agentStepAnswerText(stdout: string): {
|
|
259
|
+
text: string;
|
|
260
|
+
error?: string;
|
|
261
|
+
};
|
|
262
|
+
/** The JSON value an answer's text holds, a fence around it allowed, or why it holds none. */
|
|
263
|
+
export declare function agentStepAnswerValue(text: string): {
|
|
264
|
+
value: StageArtifactValue;
|
|
265
|
+
} | {
|
|
266
|
+
error: string;
|
|
267
|
+
};
|
|
268
|
+
/** The prompt a step runs with. The inputs are data between tags. */
|
|
269
|
+
export declare function agentStepPrompt(o: {
|
|
270
|
+
pipeline: string;
|
|
271
|
+
stage: string;
|
|
272
|
+
step: string;
|
|
273
|
+
release: string;
|
|
274
|
+
declared: PipelineAgentStep;
|
|
275
|
+
inputs: Record<string, string>;
|
|
276
|
+
quote: (text: string, tags: readonly string[]) => string;
|
|
277
|
+
}): string;
|
|
278
|
+
/** One model run, as {@link runStageAgentSteps} needs it. A failure is an outcome, not a throw. */
|
|
279
|
+
export type AgentStepModel = (o: {
|
|
280
|
+
settings: AgentStepSettings;
|
|
281
|
+
prompt: string;
|
|
282
|
+
}) => Promise<{
|
|
283
|
+
stdout: string;
|
|
284
|
+
exitCode: number | null;
|
|
285
|
+
usage: AgentUsage;
|
|
286
|
+
}>;
|
|
287
|
+
/** What {@link runStageAgentSteps} takes. */
|
|
288
|
+
export interface RunStageAgentStepsInput {
|
|
289
|
+
spec: Pick<PipelineSpec, "name" | "stages">;
|
|
290
|
+
stage: string;
|
|
291
|
+
release: {
|
|
292
|
+
digest: string;
|
|
293
|
+
label?: string | null;
|
|
294
|
+
gitSha?: string;
|
|
295
|
+
};
|
|
296
|
+
/** The command a step runs unless it names its own. */
|
|
297
|
+
defaultCommand: string;
|
|
298
|
+
/** The model's runs. */
|
|
299
|
+
model: AgentStepModel;
|
|
300
|
+
/** Earlier stages' artifacts. Read only. */
|
|
301
|
+
artifacts: StageArtifactPort;
|
|
302
|
+
/** A step's earlier run records, for its limits. Read only. Absent: the limits are not checked, and a step that sets one fails. */
|
|
303
|
+
readRuns?: (settings: AgentStepSettings) => Promise<Array<import("../ci-agent.js").AgentLimitRecord>>;
|
|
304
|
+
/** Whether the job holds the variable named. */
|
|
305
|
+
hasKey: (keyEnv: string) => boolean;
|
|
306
|
+
/** The quoting the prompt uses for data. */
|
|
307
|
+
quote: (text: string, tags: readonly string[]) => string;
|
|
308
|
+
/** The limit check: why a run is over, or undefined. */
|
|
309
|
+
overLimit: (settings: AgentStepSettings, records: ReadonlyArray<import("../ci-agent.js").AgentLimitRecord>, now: Date) => string | undefined;
|
|
310
|
+
digestOf: (text: string) => string;
|
|
311
|
+
now?: () => Date;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Run `stage`'s steps for `release`, in declared order (#5358). Writes
|
|
315
|
+
* nothing: each step's record comes back for `chant pipeline agent record`
|
|
316
|
+
* to check and record. A step that reads a failed step fails too. Never
|
|
317
|
+
* throws for a step's failure.
|
|
318
|
+
*/
|
|
319
|
+
export declare function runStageAgentSteps(input: RunStageAgentStepsInput): Promise<StageAgentAnswerRecord[]>;
|
|
320
|
+
/**
|
|
321
|
+
* Check a record the read-only job wrote against the pipeline at base,
|
|
322
|
+
* before it is recorded (#5358): it names this pipeline, stage and release
|
|
323
|
+
* and a step the stage declares, and an `answered` record's answer matches
|
|
324
|
+
* the schema the stage declares now. A record that does not is recorded as
|
|
325
|
+
* `failed`, saying why; one that names another stage or release is refused.
|
|
326
|
+
*/
|
|
327
|
+
export declare function checkedAgentAnswer(spec: Pick<PipelineSpec, "name" | "stages">, stage: string, release: string, record: unknown): StageAgentAnswerRecord | {
|
|
328
|
+
refused: string;
|
|
329
|
+
};
|