@abelxiaoxing/cadence 1.8.3 → 2.0.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/README.md +324 -111
- package/THIRD_PARTY_NOTICES.md +15 -0
- package/agents/design-explorer.md +14 -26
- package/agents/diagnosis-worker.md +14 -25
- package/agents/implementation-worker.md +16 -35
- package/config/.env.example +2 -5
- package/config/workflow-task.example.json +7 -0
- package/docs/remote-access.md +60 -0
- package/docs/reuse-and-distribution.md +44 -0
- package/docs/service-management.md +108 -0
- package/licenses/bundled-web.txt +6245 -0
- package/licenses/pi-web-ui-MIT.txt +21 -0
- package/licenses/pi-web-ui-reuse.md +22 -0
- package/package.json +94 -21
- package/src/index.ts +22 -1807
- package/src/native-build.ts +6 -0
- package/src/native-client.ts +103 -0
- package/src/native-export.ts +58 -0
- package/src/native-history.ts +359 -0
- package/src/operator-cli.mjs +453 -1937
- package/src/plan-proposal.ts +87 -0
- package/src/sdk-worker.mjs +549 -0
- package/src/service/contracts/active.ts +82 -0
- package/src/service/contracts/budget.ts +148 -0
- package/src/service/contracts/build.ts +67 -0
- package/src/service/contracts/capture.ts +48 -0
- package/src/service/contracts/core.ts +33 -0
- package/src/service/contracts/current.ts +261 -0
- package/src/service/contracts/domain.ts +68 -0
- package/src/service/contracts/history.ts +2245 -0
- package/src/service/contracts/models.ts +139 -0
- package/src/service/coordination.ts +862 -0
- package/src/service/private-files.ts +204 -0
- package/src/service-cli.mjs +5592 -0
- package/src/service-client.ts +747 -0
- package/src/service-contract.ts +245 -0
- package/src/service-host.mjs +22382 -0
- package/src/service-http-client.ts +425 -0
- package/src/service-wire.ts +372 -0
- package/src/task-shell.ts +1045 -0
- package/src/task-store.ts +479 -0
- package/src/task-types.ts +184 -0
- package/src/verification-diagnostics.ts +29 -72
- package/src/worker-capture.mjs +1197 -0
- package/src/worker-public.mjs +1753 -0
- package/src/worker-redaction.mjs +608 -0
- package/src/worker-tools.mjs +202 -0
- package/web/dist/assets/KaTeX_AMS-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_AMS-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_AMS-Regular.woff2 +0 -0
- package/web/dist/assets/KaTeX_Caligraphic-Bold.ttf +0 -0
- package/web/dist/assets/KaTeX_Caligraphic-Bold.woff +0 -0
- package/web/dist/assets/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/web/dist/assets/KaTeX_Caligraphic-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_Caligraphic-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/web/dist/assets/KaTeX_Fraktur-Bold.ttf +0 -0
- package/web/dist/assets/KaTeX_Fraktur-Bold.woff +0 -0
- package/web/dist/assets/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/web/dist/assets/KaTeX_Fraktur-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_Fraktur-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/web/dist/assets/KaTeX_Main-Bold.ttf +0 -0
- package/web/dist/assets/KaTeX_Main-Bold.woff +0 -0
- package/web/dist/assets/KaTeX_Main-Bold.woff2 +0 -0
- package/web/dist/assets/KaTeX_Main-BoldItalic.ttf +0 -0
- package/web/dist/assets/KaTeX_Main-BoldItalic.woff +0 -0
- package/web/dist/assets/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/web/dist/assets/KaTeX_Main-Italic.ttf +0 -0
- package/web/dist/assets/KaTeX_Main-Italic.woff +0 -0
- package/web/dist/assets/KaTeX_Main-Italic.woff2 +0 -0
- package/web/dist/assets/KaTeX_Main-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_Main-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_Main-Regular.woff2 +0 -0
- package/web/dist/assets/KaTeX_Math-BoldItalic.ttf +0 -0
- package/web/dist/assets/KaTeX_Math-BoldItalic.woff +0 -0
- package/web/dist/assets/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/web/dist/assets/KaTeX_Math-Italic.ttf +0 -0
- package/web/dist/assets/KaTeX_Math-Italic.woff +0 -0
- package/web/dist/assets/KaTeX_Math-Italic.woff2 +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Bold.ttf +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Bold.woff +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Italic.ttf +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Italic.woff +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/web/dist/assets/KaTeX_Script-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_Script-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_Script-Regular.woff2 +0 -0
- package/web/dist/assets/KaTeX_Size1-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_Size1-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_Size1-Regular.woff2 +0 -0
- package/web/dist/assets/KaTeX_Size2-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_Size2-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_Size2-Regular.woff2 +0 -0
- package/web/dist/assets/KaTeX_Size3-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_Size3-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_Size3-Regular.woff2 +0 -0
- package/web/dist/assets/KaTeX_Size4-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_Size4-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_Size4-Regular.woff2 +0 -0
- package/web/dist/assets/KaTeX_Typewriter-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_Typewriter-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/web/dist/assets/cadence.css +2 -0
- package/web/dist/assets/cadence.js +7 -0
- package/web/dist/assets/markdown.js +296 -0
- package/web/dist/assets/react.js +9 -0
- package/web/dist/assets/rolldown-runtime.js +1 -0
- package/web/dist/assets/timeline-client.js +41 -0
- package/web/dist/assets/vis-timeline.css +1274 -0
- package/web/dist/assets/vis-timeline.js +32 -0
- package/web/dist/index.html +18 -0
- package/web/dist/manifest.json +505 -0
- package/config/plan-draft.example.json +0 -125
- package/config/plan-draft.multiple-tasks.example.json +0 -375
- package/config/plan-draft.quick.example.json +0 -78
- package/config/routes.example.json +0 -39
- package/prompts/abel-design.md +0 -382
- package/prompts/abel-diagnose.md +0 -71
- package/prompts/abel-implement.md +0 -284
- package/prompts/abel-init.md +0 -52
- package/src/activation.ts +0 -44
- package/src/activity-contracts.ts +0 -82
- package/src/agent-registry.ts +0 -53
- package/src/apply-transaction.ts +0 -1437
- package/src/artifact-store.ts +0 -213
- package/src/build-windows-job.mjs +0 -95
- package/src/candidate-artifact.ts +0 -143
- package/src/candidate-patch.ts +0 -271
- package/src/candidate-workspace.ts +0 -80
- package/src/canonical.ts +0 -16
- package/src/change-contract-schema.ts +0 -191
- package/src/change-contract.ts +0 -324
- package/src/change-verification.ts +0 -1617
- package/src/child-budget.ts +0 -58
- package/src/child-model.ts +0 -142
- package/src/child-session.ts +0 -640
- package/src/contracts.ts +0 -2476
- package/src/control-contracts.ts +0 -382
- package/src/delivery-compiler.ts +0 -1805
- package/src/delivery-revision.ts +0 -42
- package/src/design-control.ts +0 -1299
- package/src/design-diagnostics.ts +0 -181
- package/src/design-journal.ts +0 -1773
- package/src/directory-sync.ts +0 -36
- package/src/durable-contracts.ts +0 -231
- package/src/durable-workflow.ts +0 -978
- package/src/evidence-draft.ts +0 -122
- package/src/execution-profile.ts +0 -64
- package/src/execution-retention.ts +0 -77
- package/src/file-snapshot.ts +0 -163
- package/src/implement-continuation.ts +0 -559
- package/src/implement-graph.ts +0 -690
- package/src/implement-plan.ts +0 -72
- package/src/install-config.d.mts +0 -6
- package/src/isolation-backend.ts +0 -353
- package/src/model-source.ts +0 -22
- package/src/openspec-cli.ts +0 -494
- package/src/operator-cli-entry.mjs +0 -24
- package/src/operator-tools.ts +0 -309
- package/src/package-candidate.ts +0 -227
- package/src/package-delivery.ts +0 -486
- package/src/package-state.ts +0 -320
- package/src/package-verification.ts +0 -635
- package/src/package-workflow.ts +0 -342
- package/src/packet-runtime.ts +0 -570
- package/src/parent-provider.ts +0 -375
- package/src/phase-execution.ts +0 -2259
- package/src/pi-adapter.ts +0 -19
- package/src/plan-draft-summary.ts +0 -527
- package/src/plan-draft.ts +0 -502
- package/src/remove-path.ts +0 -32
- package/src/route-policy.ts +0 -545
- package/src/run-state.ts +0 -420
- package/src/run-store.ts +0 -1179
- package/src/safe-path.ts +0 -77
- package/src/scoped-grep-worker.mjs +0 -23
- package/src/scoped-tools.ts +0 -775
- package/src/single-task-draft.ts +0 -142
- package/src/sqlite-schema.ts +0 -171
- package/src/state-root.ts +0 -215
- package/src/storage-schema.ts +0 -360
- package/src/subagent-activity.ts +0 -1417
- package/src/submit-tool.ts +0 -950
- package/src/task-ledger.ts +0 -1338
- package/src/transport-budget.ts +0 -52
- package/src/verification-capability.ts +0 -1191
- package/src/verification-environment-io.ts +0 -389
- package/src/verification-environment.ts +0 -162
- package/src/verification-identity.ts +0 -77
- package/src/verification-scan.ts +0 -64
- package/src/windows-job-backend.ts +0 -419
- package/src/windows-job.c +0 -149
- package/src/worker-broker.ts +0 -806
- package/src/workflow-engine.ts +0 -28
- package/src/workflow-policy.ts +0 -1679
- package/src/workflow-recovery-policy.ts +0 -97
- package/src/workflow-scheduling.ts +0 -105
- package/src/workflow-state-machine.ts +0 -4355
- package/src/workflow-status.ts +0 -576
- package/src/workspace-io-entry.mjs +0 -76
- package/src/workspace-io-worker.mjs +0 -1312
- package/src/workspace-io.ts +0 -89
- package/src/workspace-store.ts +0 -634
package/src/package-workflow.ts
DELETED
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
-
import { homedir } from "node:os";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import type { WorkflowActivityUpdate } from "./activity-contracts.ts";
|
|
5
|
-
import { loadAgentDefinitions } from "./agent-registry.ts";
|
|
6
|
-
import type {
|
|
7
|
-
DesignEvidenceResult,
|
|
8
|
-
StructuredVerificationContract,
|
|
9
|
-
} from "./contracts.ts";
|
|
10
|
-
import { validateControlCommand } from "./control-contracts.ts";
|
|
11
|
-
import { DesignController } from "./design-control.ts";
|
|
12
|
-
import { executionProfile } from "./execution-profile.ts";
|
|
13
|
-
import type { PackageContext } from "./model-source.ts";
|
|
14
|
-
import { inspectOpenSpecDelivery } from "./openspec-cli.ts";
|
|
15
|
-
import { proposePackageCandidate } from "./package-candidate.ts";
|
|
16
|
-
import { packageDeliverySource } from "./package-delivery.ts";
|
|
17
|
-
import { acquirePackageState } from "./package-state.ts";
|
|
18
|
-
import {
|
|
19
|
-
changeVerificationResult,
|
|
20
|
-
executePackageVerification,
|
|
21
|
-
phaseVerificationResult,
|
|
22
|
-
} from "./package-verification.ts";
|
|
23
|
-
import {
|
|
24
|
-
inspectRoutePolicy,
|
|
25
|
-
loadRoutePolicy,
|
|
26
|
-
type RoutePolicyResolution,
|
|
27
|
-
unavailableRoutePolicy,
|
|
28
|
-
} from "./route-policy.ts";
|
|
29
|
-
import { resolveStateRoot } from "./state-root.ts";
|
|
30
|
-
import { VerificationFeedback } from "./verification-diagnostics.ts";
|
|
31
|
-
import { captureVerificationEnvironmentIdentity } from "./verification-environment.ts";
|
|
32
|
-
import { coalesceVerificationScans } from "./verification-scan.ts";
|
|
33
|
-
import { openDurableWorkflowEngine } from "./workflow-engine.ts";
|
|
34
|
-
export interface PackageWorkflowService {
|
|
35
|
-
execute(
|
|
36
|
-
command: unknown,
|
|
37
|
-
context?: PackageContext,
|
|
38
|
-
signal?: AbortSignal,
|
|
39
|
-
onActivity?: (event: WorkflowActivityUpdate) => void,
|
|
40
|
-
): Promise<Record<string, unknown>>;
|
|
41
|
-
executeDesign(request: unknown): Promise<Record<string, unknown>>;
|
|
42
|
-
executeAmendment(
|
|
43
|
-
change: string,
|
|
44
|
-
batchId: string,
|
|
45
|
-
request: unknown,
|
|
46
|
-
): Promise<Record<string, unknown>>;
|
|
47
|
-
assertDesignRun(runId: string): void;
|
|
48
|
-
recordDesignEvidence(input: {
|
|
49
|
-
runId: string;
|
|
50
|
-
evidence: DesignEvidenceResult;
|
|
51
|
-
}): unknown;
|
|
52
|
-
close(): void | Promise<void>;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function affectedVerification(
|
|
56
|
-
task: Parameters<
|
|
57
|
-
Parameters<typeof openDurableWorkflowEngine>[0]["proposeCandidate"]
|
|
58
|
-
>[0]["task"],
|
|
59
|
-
): StructuredVerificationContract {
|
|
60
|
-
if (task.affectedVerification) {
|
|
61
|
-
return structuredClone(task.affectedVerification);
|
|
62
|
-
}
|
|
63
|
-
const finalPhase = task.phases.refactor ?? task.phases.green;
|
|
64
|
-
const verification = structuredClone(finalPhase.verification);
|
|
65
|
-
const affected = [...new Set(task.impactClosure.affectedSuite)].sort();
|
|
66
|
-
if (affected.length === 0) return verification;
|
|
67
|
-
if (verification.kind === "vitest") {
|
|
68
|
-
return { ...verification, testFiles: affected };
|
|
69
|
-
}
|
|
70
|
-
if (verification.kind === "steps") {
|
|
71
|
-
return {
|
|
72
|
-
...verification,
|
|
73
|
-
steps: verification.steps.map((step) =>
|
|
74
|
-
step.kind === "vitest" ? { ...step, testFiles: affected } : step,
|
|
75
|
-
),
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
return verification;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export function openPackageWorkflowService(
|
|
82
|
-
initialContext: PackageContext,
|
|
83
|
-
): PackageWorkflowService {
|
|
84
|
-
const state = acquirePackageState(
|
|
85
|
-
resolveStateRoot({
|
|
86
|
-
consumerRoot: path.resolve(initialContext.cwd),
|
|
87
|
-
xdgStateHome: process.env.XDG_STATE_HOME,
|
|
88
|
-
}),
|
|
89
|
-
);
|
|
90
|
-
try {
|
|
91
|
-
const service = openPreparedPackageWorkflowService(initialContext);
|
|
92
|
-
const notice = (result: Record<string, unknown>) =>
|
|
93
|
-
state.notice ? { ...result, packageStateReset: state.notice } : result;
|
|
94
|
-
return {
|
|
95
|
-
...service,
|
|
96
|
-
async execute(...args) {
|
|
97
|
-
return notice(await service.execute(...args));
|
|
98
|
-
},
|
|
99
|
-
async executeDesign(...args) {
|
|
100
|
-
return notice(await service.executeDesign(...args));
|
|
101
|
-
},
|
|
102
|
-
async executeAmendment(...args) {
|
|
103
|
-
return notice(await service.executeAmendment(...args));
|
|
104
|
-
},
|
|
105
|
-
async close() {
|
|
106
|
-
// Never release ownership while an executor or storage connection may survive.
|
|
107
|
-
await service.close();
|
|
108
|
-
state.close();
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
} catch (error) {
|
|
112
|
-
state.close();
|
|
113
|
-
throw error;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function openPreparedPackageWorkflowService(
|
|
118
|
-
initialContext: PackageContext,
|
|
119
|
-
): PackageWorkflowService {
|
|
120
|
-
const consumerRoot = path.resolve(initialContext.cwd);
|
|
121
|
-
const routeResolution = loadRoutePolicy({
|
|
122
|
-
cwd: consumerRoot,
|
|
123
|
-
home: homedir(),
|
|
124
|
-
...(initialContext.model ? { parentModel: initialContext.model } : {}),
|
|
125
|
-
});
|
|
126
|
-
const stateRoot = resolveStateRoot({
|
|
127
|
-
consumerRoot,
|
|
128
|
-
xdgStateHome: process.env.XDG_STATE_HOME,
|
|
129
|
-
});
|
|
130
|
-
const contexts = new AsyncLocalStorage<PackageContext>();
|
|
131
|
-
const feedback = new AsyncLocalStorage<VerificationFeedback>();
|
|
132
|
-
const verify: typeof executePackageVerification = async (input) => {
|
|
133
|
-
const result = await executePackageVerification(input);
|
|
134
|
-
feedback.getStore()?.observe(result);
|
|
135
|
-
return result;
|
|
136
|
-
};
|
|
137
|
-
const design = DesignController.open({
|
|
138
|
-
consumerRoot,
|
|
139
|
-
stateRoot,
|
|
140
|
-
inspectOpenSpec: inspectOpenSpecDelivery,
|
|
141
|
-
});
|
|
142
|
-
try {
|
|
143
|
-
const implementationAgent = loadAgentDefinitions().find(
|
|
144
|
-
(agent) => agent.role === "implementation-worker",
|
|
145
|
-
);
|
|
146
|
-
if (!implementationAgent) {
|
|
147
|
-
throw new Error("implementation-worker-agent-unavailable");
|
|
148
|
-
}
|
|
149
|
-
const hostLimit = (name: string, fallback: number): number => {
|
|
150
|
-
const value =
|
|
151
|
-
process.env[name] === undefined ? fallback : Number(process.env[name]);
|
|
152
|
-
if (!Number.isSafeInteger(value) || value < 1)
|
|
153
|
-
throw new Error("verification-host-limit-invalid");
|
|
154
|
-
return value;
|
|
155
|
-
};
|
|
156
|
-
const maxReportBytes = hostLimit(
|
|
157
|
-
"ABEL_VERIFICATION_MAX_REPORT_BYTES",
|
|
158
|
-
64 * 1024 * 1024,
|
|
159
|
-
);
|
|
160
|
-
const workHardLimit = hostLimit("ABEL_WORK_MAX_UNITS", 512);
|
|
161
|
-
const engine = openDurableWorkflowEngine({
|
|
162
|
-
workHardLimit,
|
|
163
|
-
awaitPostApplySettlement: true,
|
|
164
|
-
verificationPolicy: `report-file-v5:${JSON.stringify(executionProfile())}`,
|
|
165
|
-
verificationEnvironment: coalesceVerificationScans(
|
|
166
|
-
(plan: import("./implement-plan.ts").ImplementPlan, signal) =>
|
|
167
|
-
captureVerificationEnvironmentIdentity(
|
|
168
|
-
consumerRoot,
|
|
169
|
-
[
|
|
170
|
-
...plan.tasks.flatMap((task) => [
|
|
171
|
-
...Object.values(task.phases).map(
|
|
172
|
-
(phase) => phase.verification,
|
|
173
|
-
),
|
|
174
|
-
task.affectedVerification,
|
|
175
|
-
...(task.baselineVerification
|
|
176
|
-
? [task.baselineVerification]
|
|
177
|
-
: []),
|
|
178
|
-
task.repairVerification,
|
|
179
|
-
]),
|
|
180
|
-
plan.verification.baseline.fullSuite,
|
|
181
|
-
plan.verification.change.fullSuite,
|
|
182
|
-
plan.verification.change.postApply,
|
|
183
|
-
...(plan.verification.agentsCheckpoint.verification
|
|
184
|
-
? [plan.verification.agentsCheckpoint.verification]
|
|
185
|
-
: []),
|
|
186
|
-
],
|
|
187
|
-
signal,
|
|
188
|
-
),
|
|
189
|
-
),
|
|
190
|
-
consumerRoot,
|
|
191
|
-
stateRoot,
|
|
192
|
-
deliverySource: packageDeliverySource(consumerRoot, {
|
|
193
|
-
verifyGateProof: (input) => design.verifyGateProof(input),
|
|
194
|
-
verifyFinalizedDelivery: (input) =>
|
|
195
|
-
design.verifyFinalizedDelivery(input),
|
|
196
|
-
}),
|
|
197
|
-
routePolicy: routeResolution.ok
|
|
198
|
-
? routeResolution.policy
|
|
199
|
-
: unavailableRoutePolicy(),
|
|
200
|
-
proposeCandidate: (input) =>
|
|
201
|
-
proposePackageCandidate(
|
|
202
|
-
input,
|
|
203
|
-
contexts.getStore(),
|
|
204
|
-
implementationAgent,
|
|
205
|
-
feedback.getStore()?.current(),
|
|
206
|
-
),
|
|
207
|
-
verifyPhase: async (input) =>
|
|
208
|
-
phaseVerificationResult(
|
|
209
|
-
await verify({
|
|
210
|
-
maxReportBytes,
|
|
211
|
-
executionWritePaths: input.executionWritePaths,
|
|
212
|
-
root: input.root,
|
|
213
|
-
dependencyOwner: consumerRoot,
|
|
214
|
-
executionOwnerRoot: stateRoot.rootDir,
|
|
215
|
-
verification: input.verification,
|
|
216
|
-
signal: input.signal,
|
|
217
|
-
}),
|
|
218
|
-
),
|
|
219
|
-
verifyChange: async (input) => {
|
|
220
|
-
const verifications = input.verification
|
|
221
|
-
? [input.verification]
|
|
222
|
-
: input.plan.tasks.map((task) => affectedVerification(task));
|
|
223
|
-
let failure: ReturnType<typeof changeVerificationResult> | undefined;
|
|
224
|
-
for (const verification of verifications) {
|
|
225
|
-
const result = await verify({
|
|
226
|
-
maxReportBytes,
|
|
227
|
-
executionWritePaths: input.plan.tasks.flatMap((task) =>
|
|
228
|
-
Object.values(task.phases).flatMap((phase) => [
|
|
229
|
-
...phase.write,
|
|
230
|
-
...phase.delete,
|
|
231
|
-
]),
|
|
232
|
-
),
|
|
233
|
-
root: input.root,
|
|
234
|
-
dependencyOwner: consumerRoot,
|
|
235
|
-
executionOwnerRoot: stateRoot.rootDir,
|
|
236
|
-
verification,
|
|
237
|
-
signal: input.signal,
|
|
238
|
-
});
|
|
239
|
-
const observed = changeVerificationResult(result);
|
|
240
|
-
if (!observed.ok) {
|
|
241
|
-
if (observed.kind !== "verification") return observed;
|
|
242
|
-
if (failure && !failure.ok && failure.kind === "verification") {
|
|
243
|
-
failure.failureIdentities = [
|
|
244
|
-
...new Set([
|
|
245
|
-
...(failure.failureIdentities ?? []),
|
|
246
|
-
...(observed.failureIdentities ?? []),
|
|
247
|
-
]),
|
|
248
|
-
];
|
|
249
|
-
failure.attributionReliable =
|
|
250
|
-
failure.attributionReliable !== false &&
|
|
251
|
-
observed.attributionReliable !== false;
|
|
252
|
-
} else failure = observed;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
if (failure) return failure;
|
|
256
|
-
return {
|
|
257
|
-
ok: true,
|
|
258
|
-
exitCode: 0,
|
|
259
|
-
classification: "expected-green",
|
|
260
|
-
};
|
|
261
|
-
},
|
|
262
|
-
});
|
|
263
|
-
return {
|
|
264
|
-
async execute(
|
|
265
|
-
command: unknown,
|
|
266
|
-
context = initialContext,
|
|
267
|
-
signal,
|
|
268
|
-
onActivity,
|
|
269
|
-
) {
|
|
270
|
-
const operationRouteResolution = loadRoutePolicy({
|
|
271
|
-
cwd: consumerRoot,
|
|
272
|
-
home: homedir(),
|
|
273
|
-
...(context.model ? { parentModel: context.model } : {}),
|
|
274
|
-
});
|
|
275
|
-
engine.updateRoutePolicy(
|
|
276
|
-
operationRouteResolution.ok
|
|
277
|
-
? operationRouteResolution.policy
|
|
278
|
-
: unavailableRoutePolicy(),
|
|
279
|
-
);
|
|
280
|
-
const validation = validateControlCommand(command);
|
|
281
|
-
if (!validation.ok) {
|
|
282
|
-
const error = new Error(validation.code);
|
|
283
|
-
error.name = "ControlCommandError";
|
|
284
|
-
throw error;
|
|
285
|
-
}
|
|
286
|
-
return feedback.run(new VerificationFeedback(), () =>
|
|
287
|
-
contexts.run(context, async () => {
|
|
288
|
-
const outcome = await engine.execute(
|
|
289
|
-
validation.value,
|
|
290
|
-
signal,
|
|
291
|
-
onActivity,
|
|
292
|
-
);
|
|
293
|
-
const routePolicy = visibleRoutePolicyStatus(
|
|
294
|
-
operationRouteResolution,
|
|
295
|
-
engine.routePolicyStatus(),
|
|
296
|
-
);
|
|
297
|
-
return {
|
|
298
|
-
...outcome,
|
|
299
|
-
routePolicy,
|
|
300
|
-
verificationDiagnostics: feedback.getStore()?.current() ?? [],
|
|
301
|
-
};
|
|
302
|
-
}),
|
|
303
|
-
);
|
|
304
|
-
},
|
|
305
|
-
executeDesign(request: unknown) {
|
|
306
|
-
return design.execute(request);
|
|
307
|
-
},
|
|
308
|
-
executeAmendment(change: string, batchId: string, request: unknown) {
|
|
309
|
-
return engine.amend(change, batchId, request, (assertAuthority) =>
|
|
310
|
-
design.executeWithAuthority(request, assertAuthority),
|
|
311
|
-
);
|
|
312
|
-
},
|
|
313
|
-
assertDesignRun(runId: string) {
|
|
314
|
-
design.assertDesignRun(runId);
|
|
315
|
-
},
|
|
316
|
-
recordDesignEvidence(input) {
|
|
317
|
-
return design.recordEvidence(input);
|
|
318
|
-
},
|
|
319
|
-
async close() {
|
|
320
|
-
contexts.disable();
|
|
321
|
-
await engine.close();
|
|
322
|
-
feedback.disable();
|
|
323
|
-
design.close();
|
|
324
|
-
},
|
|
325
|
-
};
|
|
326
|
-
} catch (error) {
|
|
327
|
-
design.close();
|
|
328
|
-
throw error;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
function visibleRoutePolicyStatus(
|
|
333
|
-
resolution: RoutePolicyResolution,
|
|
334
|
-
brokerStatus: Record<string, unknown> | undefined,
|
|
335
|
-
): Record<string, unknown> {
|
|
336
|
-
if (!resolution.ok) return inspectRoutePolicy(resolution);
|
|
337
|
-
const inspected = brokerStatus ?? inspectRoutePolicy(resolution);
|
|
338
|
-
return {
|
|
339
|
-
...inspected,
|
|
340
|
-
source: { kind: resolution.source.kind },
|
|
341
|
-
};
|
|
342
|
-
}
|