zob-harness 0.9.0 → 0.9.2

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.
Files changed (84) hide show
  1. package/.pi/capabilities/zob-public-runtime-capabilities.json +16 -17
  2. package/.pi/extensions/zob-harness/index.ts +1 -1
  3. package/.pi/extensions/zob-harness/src/domains/autonomy/autonomous-runtime/dry-run.ts +1107 -0
  4. package/.pi/extensions/zob-harness/src/domains/autonomy/autonomous-runtime/report-writers.ts +325 -0
  5. package/.pi/extensions/zob-harness/src/domains/autonomy/autonomous-runtime/smoke-run.ts +1286 -0
  6. package/.pi/extensions/zob-harness/src/domains/autonomy/autonomous-runtime/types.ts +30 -0
  7. package/.pi/extensions/zob-harness/src/domains/autonomy/autonomous-runtime/validation.ts +184 -0
  8. package/.pi/extensions/zob-harness/src/domains/autonomy/autonomous-runtime.ts +4 -2912
  9. package/.pi/extensions/zob-harness/src/domains/compute/compute-profile.ts +2 -1
  10. package/.pi/extensions/zob-harness/src/domains/coms/coms-v2/registry.ts +24 -3
  11. package/.pi/extensions/zob-harness/src/domains/coms/coms-v2/types.ts +1 -0
  12. package/.pi/extensions/zob-harness/src/domains/coms/coms-v2/zpeer.ts +5 -3
  13. package/.pi/extensions/zob-harness/src/domains/delegation/child-runner.ts +28 -3
  14. package/.pi/extensions/zob-harness/src/domains/goal/goal-todos/constants.ts +19 -0
  15. package/.pi/extensions/zob-harness/src/domains/goal/goal-todos/formatting.ts +148 -0
  16. package/.pi/extensions/zob-harness/src/domains/goal/goal-todos/normalize.ts +476 -0
  17. package/.pi/extensions/zob-harness/src/domains/goal/goal-todos/operations.ts +393 -0
  18. package/.pi/extensions/zob-harness/src/domains/goal/goal-todos/parsing.ts +277 -0
  19. package/.pi/extensions/zob-harness/src/domains/goal/goal-todos/reducer.ts +110 -0
  20. package/.pi/extensions/zob-harness/src/domains/goal/goal-todos.ts +6 -1429
  21. package/.pi/extensions/zob-harness/src/domains/governance/governed-requests.ts +3 -1
  22. package/.pi/extensions/zob-harness/src/domains/governance/merge-queue.ts +3 -1
  23. package/.pi/extensions/zob-harness/src/domains/governance/sandbox/helpers.ts +124 -0
  24. package/.pi/extensions/zob-harness/src/domains/governance/sandbox/runners.ts +444 -0
  25. package/.pi/extensions/zob-harness/src/domains/governance/sandbox/simulation.ts +569 -0
  26. package/.pi/extensions/zob-harness/src/domains/governance/sandbox/types.ts +127 -0
  27. package/.pi/extensions/zob-harness/src/domains/governance/sandbox/validation.ts +273 -0
  28. package/.pi/extensions/zob-harness/src/domains/governance/sandbox.ts +4 -1508
  29. package/.pi/extensions/zob-harness/src/domains/governance/worker-pool.ts +3 -1
  30. package/.pi/extensions/zob-harness/src/domains/governance/workspace-claims.ts +3 -1
  31. package/.pi/extensions/zob-harness/src/domains/orchestration/room.ts +8 -2
  32. package/.pi/extensions/zob-harness/src/domains/promotion/coms.ts +8 -1
  33. package/.pi/extensions/zob-harness/src/runtime/commands/autonomy.ts +188 -0
  34. package/.pi/extensions/zob-harness/src/runtime/commands/compute.ts +165 -0
  35. package/.pi/extensions/zob-harness/src/runtime/commands/daemon.ts +191 -0
  36. package/.pi/extensions/zob-harness/src/runtime/commands/delegates.ts +47 -0
  37. package/.pi/extensions/zob-harness/src/runtime/commands/goal.ts +70 -0
  38. package/.pi/extensions/zob-harness/src/runtime/commands/intent.ts +383 -0
  39. package/.pi/extensions/zob-harness/src/runtime/commands/misc.ts +229 -0
  40. package/.pi/extensions/zob-harness/src/runtime/commands/project-dna.ts +130 -0
  41. package/.pi/extensions/zob-harness/src/runtime/commands/types.ts +3 -0
  42. package/.pi/extensions/zob-harness/src/runtime/commands/zcommit.ts +145 -0
  43. package/.pi/extensions/zob-harness/src/runtime/commands/zlive.ts +1606 -0
  44. package/.pi/extensions/zob-harness/src/runtime/commands/zmode.ts +42 -0
  45. package/.pi/extensions/zob-harness/src/runtime/commands.ts +26 -3109
  46. package/.pi/extensions/zob-harness/src/runtime/events.ts +67 -33
  47. package/.pi/extensions/zob-harness/src/runtime/goal-runtime/commands.ts +194 -0
  48. package/.pi/extensions/zob-harness/src/runtime/goal-runtime/events.ts +81 -0
  49. package/.pi/extensions/zob-harness/src/runtime/goal-runtime/state.ts +662 -0
  50. package/.pi/extensions/zob-harness/src/runtime/goal-runtime/tools.ts +1005 -0
  51. package/.pi/extensions/zob-harness/src/runtime/goal-runtime.ts +5 -1949
  52. package/.pi/extensions/zob-harness/src/runtime/tools-delegation/helpers.ts +786 -0
  53. package/.pi/extensions/zob-harness/src/runtime/tools-delegation/register.ts +1120 -0
  54. package/.pi/extensions/zob-harness/src/runtime/tools-delegation/types.ts +77 -0
  55. package/.pi/extensions/zob-harness/src/runtime/tools-delegation.ts +1 -1904
  56. package/.pi/extensions/zob-harness/src/runtime/zob-intro.ts +46 -15
  57. package/.pi/factories/project-dna/batch-manifest.json +1 -1
  58. package/.pi/factories/project-dna/pilot-manifest.json +1 -1
  59. package/.pi/factories/project-dna/smoke-manifest.json +1 -1
  60. package/README.md +29 -8
  61. package/package.json +14 -5
  62. package/scripts/git-ops/commit-policy-smoke.mjs +33 -6
  63. package/scripts/goal-todo/child-goal-ref-smoke.mjs +30 -3
  64. package/scripts/goal-todo/handoff-static-smoke.mjs +31 -3
  65. package/scripts/harness-intake/lib/cli-io.mjs +89 -0
  66. package/scripts/harness-intake/lib/constants.mjs +59 -0
  67. package/scripts/harness-intake/lib/infer-spec.mjs +127 -0
  68. package/scripts/harness-intake/lib/profiles.mjs +458 -0
  69. package/scripts/harness-intake/lib/run-init.mjs +307 -0
  70. package/scripts/harness-intake/lib/scan.mjs +266 -0
  71. package/scripts/harness-intake/lib/tmux.mjs +92 -0
  72. package/scripts/harness-intake/lib/validate.mjs +152 -0
  73. package/scripts/harness-intake/lib.mjs +8 -1521
  74. package/scripts/harness-switch/static-smoke.mjs +1 -1
  75. package/scripts/model-catalog/validate-economy.mjs +3 -1
  76. package/scripts/model-catalog/validate.mjs +3 -1
  77. package/scripts/project-dna/scan/scan.mjs +5 -2
  78. package/scripts/project-dna/scan/validate-scan-artifacts.mjs +3 -1
  79. package/scripts/project-dna/validation/validate-ontology.mjs +3 -1
  80. package/scripts/project-dna/validation/validate-scaffold.mjs +2 -2
  81. package/scripts/zagent-static-smoke.mjs +30 -2
  82. package/scripts/zpeer-local-e2e-smoke.mjs +18 -0
  83. package/scripts/zpeer-static-smoke.mjs +40 -5
  84. package/scripts/zteam-hot-add/smoke.mjs +30 -2
@@ -0,0 +1,325 @@
1
+ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { runFactoryRun } from "../../factory/run.js";
4
+ import { sha256 } from "../../../core/utils/hashing.js";
5
+ import { safeFileStem } from "../../../core/utils/paths.js";
6
+ import { isRecord } from "../../../core/utils/records.js";
7
+ import type { AutonomousReadOnlySmokeRunInput, AutonomousRuntimeDryRunInput } from "./types.js";
8
+ import { buildAutonomousModelRoutingProofPlan, buildAutonomousRuntimeDryRun, buildAutonomousRuntimeDryRunFinalReport, buildAutonomousRuntimeDryRunValidation, buildAutonomousStrictBudgetProofPlan, hasForbiddenBodyKeys } from "./dry-run.js";
9
+ import { artifactHashIfPresent, buildAutonomousCompletionGate, buildAutonomousCurrentSourceFingerprint, buildAutonomousFinalE2EProofPlan, buildAutonomousFinalNoShipOracle, buildAutonomousMissionControlPlan, buildAutonomousMissionControlProofPlan, buildAutonomousPromotionPlan, buildAutonomousPromotionProofPlan, buildAutonomousReadOnlySmokeFinalReport, buildAutonomousSandboxApplyPlan, buildAutonomousSchedulerPlan, buildAutonomousSchedulerProofPlan, readJsonArtifact, relativeFactoryRunPath, validateAutonomousCurrentSourceFingerprintFreshness } from "./smoke-run.js";
10
+
11
+ export function writeAutonomousRuntimeDryRunReport(repoRoot: string, input: AutonomousRuntimeDryRunInput): Record<string, unknown> {
12
+ const report = buildAutonomousRuntimeDryRun(repoRoot, input);
13
+ const runId = String(report.runId);
14
+ const safeRunId = safeFileStem(runId);
15
+ const runDir = join(repoRoot, "reports", "autonomous-runs", safeRunId);
16
+ mkdirSync(runDir, { recursive: true });
17
+ const specGatePath = join(runDir, "spec-gate.json");
18
+ const contextScopePath = join(runDir, "context-scope.json");
19
+ const contextLookupPath = join(runDir, "context-lookup.json");
20
+ const contextPackPath = join(runDir, "context-pack.json");
21
+ const runtimeGatesPath = join(runDir, "runtime-gates.json");
22
+ const modelRoutingPlanPath = join(runDir, "model-routing-plan.json");
23
+ const runGraphPath = join(runDir, "run-graph.json");
24
+ const factorySelectionPath = join(runDir, "factory-selection.json");
25
+ const proofPlanPath = join(runDir, "proof-plan.json");
26
+ const reportPath = join(runDir, "dry-run-report.json");
27
+ const validationPath = join(runDir, "validation.json");
28
+ const finalReportPath = join(runDir, "final-report.md");
29
+ writeFileSync(specGatePath, `${JSON.stringify(report.specGate, null, 2)}\n`);
30
+ const contextPlan = isRecord(report.contextPlan) ? report.contextPlan : {};
31
+ const contextScope = isRecord(contextPlan.contextScope) ? contextPlan.contextScope : {};
32
+ writeFileSync(contextScopePath, `${JSON.stringify(contextScope, null, 2)}\n`);
33
+ writeFileSync(contextLookupPath, `${JSON.stringify(contextPlan.lookupResults ?? [], null, 2)}\n`);
34
+ writeFileSync(contextPackPath, `${JSON.stringify(contextPlan.contextPack ?? {}, null, 2)}\n`);
35
+ writeFileSync(runtimeGatesPath, `${JSON.stringify(report.runtimeGates, null, 2)}\n`);
36
+ writeFileSync(modelRoutingPlanPath, `${JSON.stringify(report.modelRoutingPlan, null, 2)}\n`);
37
+ writeFileSync(runGraphPath, `${JSON.stringify(report.runGraph, null, 2)}\n`);
38
+ writeFileSync(factorySelectionPath, `${JSON.stringify(report.factorySelection, null, 2)}\n`);
39
+ writeFileSync(proofPlanPath, `${JSON.stringify(report.proofPlan, null, 2)}\n`);
40
+ writeFileSync(reportPath, `${JSON.stringify(report, null, 2)}\n`);
41
+ const validation = buildAutonomousRuntimeDryRunValidation(report);
42
+ writeFileSync(validationPath, `${JSON.stringify(validation, null, 2)}\n`);
43
+ writeFileSync(finalReportPath, buildAutonomousRuntimeDryRunFinalReport(report));
44
+ if (report.status === "dry_run_plan_ready") writeFileSync(join(runDir, "DRY_RUN_READY.sentinel"), "dry-run-ready\n");
45
+ return {
46
+ ...report,
47
+ specGatePath: `reports/autonomous-runs/${safeRunId}/spec-gate.json`,
48
+ contextScopePath: `reports/autonomous-runs/${safeRunId}/context-scope.json`,
49
+ contextLookupPath: `reports/autonomous-runs/${safeRunId}/context-lookup.json`,
50
+ contextPackPath: `reports/autonomous-runs/${safeRunId}/context-pack.json`,
51
+ runtimeGatesPath: `reports/autonomous-runs/${safeRunId}/runtime-gates.json`,
52
+ modelRoutingPlanPath: `reports/autonomous-runs/${safeRunId}/model-routing-plan.json`,
53
+ runGraphPath: `reports/autonomous-runs/${safeRunId}/run-graph.json`,
54
+ factorySelectionPath: `reports/autonomous-runs/${safeRunId}/factory-selection.json`,
55
+ proofPlanPath: `reports/autonomous-runs/${safeRunId}/proof-plan.json`,
56
+ reportPath: `reports/autonomous-runs/${safeRunId}/dry-run-report.json`,
57
+ validationPath: `reports/autonomous-runs/${safeRunId}/validation.json`,
58
+ finalReportPath: `reports/autonomous-runs/${safeRunId}/final-report.md`,
59
+ sentinelPath: report.status === "dry_run_plan_ready" ? `reports/autonomous-runs/${safeRunId}/DRY_RUN_READY.sentinel` : undefined,
60
+ };
61
+ }
62
+ export function writeAutonomousReadOnlySmokeRunReport(repoRoot: string, input: AutonomousReadOnlySmokeRunInput): Record<string, unknown> {
63
+ const runId = safeFileStem(input.runId ?? `autonomous-readonly-smoke-${sha256(input.userNeed || "missing-spec").slice(0, 12)}`);
64
+ const safeRunId = safeFileStem(runId);
65
+ const runDir = join(repoRoot, "reports", "autonomous-runs", safeRunId);
66
+ const smokeAutonomySentinelPath = join(runDir, "SMOKE_AUTONOMY_PASSED.sentinel");
67
+ if (existsSync(smokeAutonomySentinelPath)) throw new Error(`Autonomous smoke run already passed; choose a fresh run_id to avoid stale sentinel reuse: ${runId}`);
68
+ const dryRun = writeAutonomousRuntimeDryRunReport(repoRoot, {
69
+ ...input,
70
+ runId,
71
+ applyPolicy: input.applyPolicy ?? "no_apply",
72
+ budgetProfile: input.budgetProfile ?? "strict_requested",
73
+ });
74
+ const factorySelection = isRecord(dryRun.factorySelection) ? dryRun.factorySelection : {};
75
+ const selectedFactory = typeof factorySelection.selectedFactory === "string" ? factorySelection.selectedFactory : undefined;
76
+ const manifestPath = selectedFactory ? `.pi/factories/${selectedFactory}/smoke-manifest.json` : undefined;
77
+ const factoryRunId = safeFileStem(input.factoryRunId ?? `autonomous-smoke-${safeRunId}`);
78
+ const factoryRunAlreadyExists = existsSync(join(repoRoot, "reports", "factory-runs", factoryRunId));
79
+ const blockers = [
80
+ ...(dryRun.status === "dry_run_plan_ready" ? [] : ["dry_run_not_ready"]),
81
+ ...(isRecord(dryRun.validation) && Array.isArray(dryRun.validation.blockers) ? dryRun.validation.blockers.filter((blocker): blocker is string => typeof blocker === "string") : []),
82
+ ...(isRecord(dryRun.specGate) && dryRun.specGate.applyPolicy === "no_apply" ? [] : ["apply_policy_must_be_no_apply_for_readonly_smoke"]),
83
+ ...(isRecord(dryRun.specGate) && dryRun.specGate.budgetProfile === "strict_requested" ? [] : ["strict_requested_budget_required_for_readonly_smoke"]),
84
+ ...(isRecord(dryRun.runtimeGates) && dryRun.runtimeGates.childDispatchAllowed === false && dryRun.runtimeGates.daemonStarted === false && dryRun.runtimeGates.productionWritesPerformed === false && dryRun.runtimeGates.autoApply === false ? [] : ["runtime_gates_not_readonly_safe"]),
85
+ ...(isRecord(dryRun.modelRoutingPlan) && dryRun.modelRoutingPlan.routingPlanReady === true && dryRun.modelRoutingPlan.liveRoutingEnabled === false && dryRun.modelRoutingPlan.childDispatchAllowed === false ? [] : ["model_routing_plan_not_readonly_safe"]),
86
+ ...(selectedFactory ? [] : ["factory_selection_missing"]),
87
+ ...(factorySelection.selectionStatus === "existing_factory_selected" ? [] : ["selected_factory_must_be_existing_for_readonly_smoke"]),
88
+ ...(manifestPath && existsSync(join(repoRoot, manifestPath)) ? [] : ["selected_factory_smoke_manifest_missing"]),
89
+ ...(factoryRunAlreadyExists ? ["factory_run_id_already_exists"] : []),
90
+ ];
91
+ const shouldRunFactory = blockers.length === 0 && selectedFactory !== undefined && manifestPath !== undefined;
92
+ const factoryRunResult = shouldRunFactory ? runFactoryRun(repoRoot, {
93
+ factory: selectedFactory,
94
+ input_manifest: manifestPath,
95
+ run_id: factoryRunId,
96
+ mode: "smoke",
97
+ max_items: 1,
98
+ execution: "deterministic",
99
+ budget: { strictRequested: true, strictEnabled: false, maxRuns: 1, estimatedRuns: 1, maxParallelChildren: 1, estimatedParallelChildren: 1 },
100
+ model_routing: { enabled: false, risk: input.risk ?? "medium", contextTokens: input.maxContextTokens },
101
+ }) : undefined;
102
+ const factoryRunDir = join(repoRoot, "reports", "factory-runs", factoryRunId);
103
+ const factoryValidationPath = join(factoryRunDir, "validation.json");
104
+ const factoryValidationRead = readJsonArtifact(factoryValidationPath);
105
+ const factoryValidation = isRecord(factoryValidationRead.parsed) ? factoryValidationRead.parsed : {};
106
+ const phaseSentinelPresent = existsSync(join(factoryRunDir, "SMOKE_PASSED.sentinel"));
107
+ const doneSentinelPresent = existsSync(join(factoryRunDir, "DONE.sentinel"));
108
+ const factoryRunRef = {
109
+ schema: "zob.autonomous-readonly-smoke-factory-run-ref.v1",
110
+ runId,
111
+ selectedFactory,
112
+ manifestPath,
113
+ factoryRunId,
114
+ factoryRunPath: relativeFactoryRunPath(factoryRunId),
115
+ status: factoryRunResult?.status ?? "not_started",
116
+ processed: factoryRunResult?.processed ?? 0,
117
+ failed: factoryRunResult?.failed ?? 0,
118
+ execution: "deterministic",
119
+ mode: "smoke",
120
+ reportsOnlyWrites: true,
121
+ productionWritesPerformed: false,
122
+ autoApply: false,
123
+ childDispatchAllowed: false,
124
+ liveChildDispatches: 0,
125
+ daemonStarted: false,
126
+ phaseSentinel: "SMOKE_PASSED.sentinel",
127
+ phaseSentinelPresent,
128
+ doneSentinelPresent,
129
+ validationPath: relativeFactoryRunPath(factoryRunId, "validation.json"),
130
+ validationHash: factoryValidationRead.hash,
131
+ artifactHashes: {
132
+ validation: factoryValidationRead.hash,
133
+ smokeSentinel: artifactHashIfPresent(join(factoryRunDir, "SMOKE_PASSED.sentinel")),
134
+ doneSentinel: artifactHashIfPresent(join(factoryRunDir, "DONE.sentinel")),
135
+ telemetry: artifactHashIfPresent(join(factoryRunDir, "telemetry.json")),
136
+ agenticPlan: artifactHashIfPresent(join(factoryRunDir, "agentic-plan.json")),
137
+ },
138
+ artifacts: factoryRunResult?.artifacts ?? [],
139
+ errors: factoryRunResult?.errors ?? [],
140
+ bodyStored: false,
141
+ promptBodiesStored: false,
142
+ outputBodiesStored: false,
143
+ };
144
+ const oracleChecks = [
145
+ { name: "dry_run_ready", passed: dryRun.status === "dry_run_plan_ready" },
146
+ { name: "context_pack_cited", passed: isRecord(dryRun.contextPlan) && dryRun.contextPlan.contextPackValid === true },
147
+ { name: "runtime_gates_readonly", passed: isRecord(dryRun.runtimeGates) && dryRun.runtimeGates.childDispatchAllowed === false && dryRun.runtimeGates.daemonStarted === false && dryRun.runtimeGates.productionWritesPerformed === false && dryRun.runtimeGates.autoApply === false },
148
+ { name: "model_routing_plan_readonly", passed: isRecord(dryRun.modelRoutingPlan) && dryRun.modelRoutingPlan.routingPlanReady === true && dryRun.modelRoutingPlan.liveRoutingEnabled === false && dryRun.modelRoutingPlan.childDispatchAllowed === false },
149
+ { name: "factory_selection_existing", passed: factorySelection.selectionStatus === "existing_factory_selected" && Boolean(selectedFactory) },
150
+ { name: "factory_smoke_done", passed: factoryRunResult?.status === "done" && factoryRunResult.processed === 1 && factoryRunResult.failed === 0 },
151
+ { name: "factory_validation_passed", passed: factoryValidation.status === "passed" },
152
+ { name: "smoke_sentinel_present", passed: phaseSentinelPresent },
153
+ { name: "done_sentinel_present", passed: doneSentinelPresent },
154
+ ];
155
+ const structuralOraclePassed = blockers.length === 0 && oracleChecks.every((check) => check.passed === true);
156
+ const oracleReview = {
157
+ schema: "zob.autonomous-readonly-smoke-oracle-review.v1",
158
+ runId,
159
+ oracleType: "deterministic_structural",
160
+ verdict: structuralOraclePassed ? "PASS" : "FAIL",
161
+ no_ship: !structuralOraclePassed,
162
+ liveOracleDispatched: false,
163
+ evidenceChecked: true,
164
+ checks: oracleChecks,
165
+ failedChecks: oracleChecks.filter((check) => check.passed !== true).map((check) => check.name),
166
+ evidenceRefs: [
167
+ `reports/autonomous-runs/${safeRunId}/spec-gate.json`,
168
+ `reports/autonomous-runs/${safeRunId}/context-pack.json`,
169
+ `reports/autonomous-runs/${safeRunId}/runtime-gates.json`,
170
+ `reports/autonomous-runs/${safeRunId}/model-routing-plan.json`,
171
+ `reports/autonomous-runs/${safeRunId}/factory-selection.json`,
172
+ `reports/autonomous-runs/${safeRunId}/factory-run-ref.json`,
173
+ relativeFactoryRunPath(factoryRunId, "validation.json"),
174
+ relativeFactoryRunPath(factoryRunId, "SMOKE_PASSED.sentinel"),
175
+ relativeFactoryRunPath(factoryRunId, "DONE.sentinel"),
176
+ ],
177
+ globalAutonomyReady: false,
178
+ globalAutonomyNoShip: true,
179
+ bodyStored: false,
180
+ promptBodiesStored: false,
181
+ outputBodiesStored: false,
182
+ };
183
+ const validation = {
184
+ schema: "zob.autonomous-readonly-smoke-validation.v1",
185
+ runId,
186
+ status: structuralOraclePassed ? "smoke_autonomy_passed" : "blocked",
187
+ passed: structuralOraclePassed,
188
+ no_ship: !structuralOraclePassed,
189
+ smokeRunNoShip: !structuralOraclePassed,
190
+ globalAutonomyReady: false,
191
+ globalAutonomyNoShip: true,
192
+ blockers: [...blockers, ...oracleChecks.filter((check) => check.passed !== true).map((check) => check.name)],
193
+ warnings: ["phase_4a_deterministic_structural_oracle_only", "global_autonomy_no_ship", "reports_only_writes"],
194
+ dryRunReady: dryRun.status === "dry_run_plan_ready",
195
+ selectedFactory,
196
+ factoryRunId,
197
+ factoryRunStatus: factoryRunResult?.status ?? "not_started",
198
+ oracleVerdict: oracleReview.verdict,
199
+ oracleNoShip: oracleReview.no_ship,
200
+ reportsOnlyWrites: true,
201
+ deterministicExecution: true,
202
+ childDispatchAllowed: false,
203
+ liveChildDispatches: 0,
204
+ daemonStarted: false,
205
+ productionWritesPerformed: false,
206
+ autoApply: false,
207
+ liveRoutingEnabled: false,
208
+ globalLiveRoutingEnabled: false,
209
+ sentinel: structuralOraclePassed ? "SMOKE_AUTONOMY_PASSED.sentinel" : undefined,
210
+ bodyStored: false,
211
+ promptBodiesStored: false,
212
+ outputBodiesStored: false,
213
+ generatedAt: new Date().toISOString(),
214
+ };
215
+ const promotionPlan = buildAutonomousPromotionPlan({ runId, selectedFactory, factoryRunRef, oracleReview, validation });
216
+ const promotionProofPlan = buildAutonomousPromotionProofPlan({ runId, promotionPlan, factoryRunRef, oracleReview, validation });
217
+ const schedulerPlan = buildAutonomousSchedulerPlan(repoRoot, { runId, promotionPlan, validation });
218
+ const schedulerProofPlan = buildAutonomousSchedulerProofPlan({ runId, schedulerPlan, validation });
219
+ const missionControlPlan = buildAutonomousMissionControlPlan(repoRoot, { runId, schedulerPlan, validation });
220
+ const strictBudgetProofPlan = buildAutonomousStrictBudgetProofPlan({ runId, runtimeGates: isRecord(dryRun.runtimeGates) ? dryRun.runtimeGates : {}, validation });
221
+ const modelRoutingProofPlan = buildAutonomousModelRoutingProofPlan({ runId, modelRoutingPlan: isRecord(dryRun.modelRoutingPlan) ? dryRun.modelRoutingPlan : {}, validation });
222
+ const missionControlProofPlan = buildAutonomousMissionControlProofPlan({ runId, missionControlPlan, schedulerProofPlan, modelRoutingProofPlan, validation });
223
+ const sandboxApplyPlan = buildAutonomousSandboxApplyPlan(repoRoot, { runId, missionControlPlan, validation });
224
+ const currentSourceFingerprint = buildAutonomousCurrentSourceFingerprint(repoRoot, { runId, factorySelection });
225
+ const finalE2EProofPlan = buildAutonomousFinalE2EProofPlan(repoRoot, {
226
+ runId,
227
+ runtimeGates: isRecord(dryRun.runtimeGates) ? dryRun.runtimeGates : {},
228
+ strictBudgetProofPlan,
229
+ modelRoutingProofPlan,
230
+ modelRoutingPlan: isRecord(dryRun.modelRoutingPlan) ? dryRun.modelRoutingPlan : {},
231
+ factorySelection,
232
+ factoryRunRef,
233
+ oracleReview,
234
+ promotionPlan,
235
+ promotionProofPlan,
236
+ schedulerPlan,
237
+ schedulerProofPlan,
238
+ missionControlPlan,
239
+ missionControlProofPlan,
240
+ sandboxApplyPlan,
241
+ currentSourceFingerprint,
242
+ validation,
243
+ });
244
+ const finalNoShipOracle = buildAutonomousFinalNoShipOracle({ runId, finalE2EProofPlan, currentSourceFingerprint });
245
+ const currentSourceFingerprintFreshness = validateAutonomousCurrentSourceFingerprintFreshness(repoRoot, currentSourceFingerprint, factorySelection);
246
+ const completionGate = buildAutonomousCompletionGate({ runId, finalE2EProofPlan, finalNoShipOracle, currentSourceFingerprintFreshness });
247
+ if (hasForbiddenBodyKeys(factoryRunRef) || hasForbiddenBodyKeys(oracleReview) || hasForbiddenBodyKeys(promotionPlan) || hasForbiddenBodyKeys(promotionProofPlan) || hasForbiddenBodyKeys(schedulerPlan) || hasForbiddenBodyKeys(schedulerProofPlan) || hasForbiddenBodyKeys(missionControlPlan) || hasForbiddenBodyKeys(missionControlProofPlan) || hasForbiddenBodyKeys(sandboxApplyPlan) || hasForbiddenBodyKeys(strictBudgetProofPlan) || hasForbiddenBodyKeys(modelRoutingProofPlan) || hasForbiddenBodyKeys(currentSourceFingerprint) || hasForbiddenBodyKeys(finalE2EProofPlan) || hasForbiddenBodyKeys(finalNoShipOracle) || hasForbiddenBodyKeys(completionGate) || hasForbiddenBodyKeys(validation)) throw new Error("autonomous readonly smoke artifacts would store forbidden plaintext body keys");
248
+ const factoryRunRefPath = join(runDir, "factory-run-ref.json");
249
+ const oracleReviewPath = join(runDir, "oracle-review.json");
250
+ const promotionPlanPath = join(runDir, "promotion-plan.json");
251
+ const promotionProofPlanPath = join(runDir, "promotion-proof-plan.json");
252
+ const schedulerPlanPath = join(runDir, "scheduler-plan.json");
253
+ const schedulerProofPlanPath = join(runDir, "scheduler-proof-plan.json");
254
+ const missionControlPlanPath = join(runDir, "mission-control-plan.json");
255
+ const missionControlProofPlanPath = join(runDir, "mission-control-proof-plan.json");
256
+ const sandboxApplyPlanPath = join(runDir, "sandbox-apply-plan.json");
257
+ const strictBudgetProofPlanPath = join(runDir, "strict-budget-proof-plan.json");
258
+ const modelRoutingProofPlanPath = join(runDir, "model-routing-proof-plan.json");
259
+ const currentSourceFingerprintPath = join(runDir, "current-source-fingerprint.json");
260
+ const finalE2EProofPlanPath = join(runDir, "final-e2e-proof-plan.json");
261
+ const finalNoShipOraclePath = join(runDir, "final-no-ship-oracle.json");
262
+ const completionGatePath = join(runDir, "completion-gate.json");
263
+ const validationPath = join(runDir, "validation.json");
264
+ const finalReportPath = join(runDir, "final-report.md");
265
+ writeFileSync(factoryRunRefPath, `${JSON.stringify(factoryRunRef, null, 2)}\n`);
266
+ writeFileSync(oracleReviewPath, `${JSON.stringify(oracleReview, null, 2)}\n`);
267
+ writeFileSync(promotionPlanPath, `${JSON.stringify(promotionPlan, null, 2)}\n`);
268
+ writeFileSync(promotionProofPlanPath, `${JSON.stringify(promotionProofPlan, null, 2)}\n`);
269
+ writeFileSync(schedulerPlanPath, `${JSON.stringify(schedulerPlan, null, 2)}\n`);
270
+ writeFileSync(schedulerProofPlanPath, `${JSON.stringify(schedulerProofPlan, null, 2)}\n`);
271
+ writeFileSync(missionControlPlanPath, `${JSON.stringify(missionControlPlan, null, 2)}\n`);
272
+ writeFileSync(missionControlProofPlanPath, `${JSON.stringify(missionControlProofPlan, null, 2)}\n`);
273
+ writeFileSync(sandboxApplyPlanPath, `${JSON.stringify(sandboxApplyPlan, null, 2)}\n`);
274
+ writeFileSync(strictBudgetProofPlanPath, `${JSON.stringify(strictBudgetProofPlan, null, 2)}\n`);
275
+ writeFileSync(modelRoutingProofPlanPath, `${JSON.stringify(modelRoutingProofPlan, null, 2)}\n`);
276
+ writeFileSync(currentSourceFingerprintPath, `${JSON.stringify(currentSourceFingerprint, null, 2)}\n`);
277
+ writeFileSync(finalE2EProofPlanPath, `${JSON.stringify(finalE2EProofPlan, null, 2)}\n`);
278
+ writeFileSync(finalNoShipOraclePath, `${JSON.stringify(finalNoShipOracle, null, 2)}\n`);
279
+ writeFileSync(completionGatePath, `${JSON.stringify(completionGate, null, 2)}\n`);
280
+ writeFileSync(validationPath, `${JSON.stringify(validation, null, 2)}\n`);
281
+ writeFileSync(finalReportPath, buildAutonomousReadOnlySmokeFinalReport(validation, factoryRunRef, oracleReview));
282
+ if (structuralOraclePassed) writeFileSync(smokeAutonomySentinelPath, "smoke-autonomy-passed\n");
283
+ return {
284
+ ...dryRun,
285
+ status: validation.status,
286
+ no_ship: validation.no_ship,
287
+ smokeRunNoShip: validation.smokeRunNoShip,
288
+ globalAutonomyReady: false,
289
+ globalAutonomyNoShip: true,
290
+ factoryRunRef,
291
+ oracleReview,
292
+ promotionPlan,
293
+ promotionProofPlan,
294
+ schedulerPlan,
295
+ schedulerProofPlan,
296
+ missionControlPlan,
297
+ missionControlProofPlan,
298
+ sandboxApplyPlan,
299
+ strictBudgetProofPlan,
300
+ modelRoutingProofPlan,
301
+ currentSourceFingerprint,
302
+ finalE2EProofPlan,
303
+ finalNoShipOracle,
304
+ completionGate,
305
+ validation,
306
+ factoryRunRefPath: `reports/autonomous-runs/${safeRunId}/factory-run-ref.json`,
307
+ oracleReviewPath: `reports/autonomous-runs/${safeRunId}/oracle-review.json`,
308
+ promotionPlanPath: `reports/autonomous-runs/${safeRunId}/promotion-plan.json`,
309
+ promotionProofPlanPath: `reports/autonomous-runs/${safeRunId}/promotion-proof-plan.json`,
310
+ schedulerPlanPath: `reports/autonomous-runs/${safeRunId}/scheduler-plan.json`,
311
+ schedulerProofPlanPath: `reports/autonomous-runs/${safeRunId}/scheduler-proof-plan.json`,
312
+ missionControlPlanPath: `reports/autonomous-runs/${safeRunId}/mission-control-plan.json`,
313
+ missionControlProofPlanPath: `reports/autonomous-runs/${safeRunId}/mission-control-proof-plan.json`,
314
+ sandboxApplyPlanPath: `reports/autonomous-runs/${safeRunId}/sandbox-apply-plan.json`,
315
+ strictBudgetProofPlanPath: `reports/autonomous-runs/${safeRunId}/strict-budget-proof-plan.json`,
316
+ modelRoutingProofPlanPath: `reports/autonomous-runs/${safeRunId}/model-routing-proof-plan.json`,
317
+ currentSourceFingerprintPath: `reports/autonomous-runs/${safeRunId}/current-source-fingerprint.json`,
318
+ finalE2EProofPlanPath: `reports/autonomous-runs/${safeRunId}/final-e2e-proof-plan.json`,
319
+ finalNoShipOraclePath: `reports/autonomous-runs/${safeRunId}/final-no-ship-oracle.json`,
320
+ completionGatePath: `reports/autonomous-runs/${safeRunId}/completion-gate.json`,
321
+ validationPath: `reports/autonomous-runs/${safeRunId}/validation.json`,
322
+ finalReportPath: `reports/autonomous-runs/${safeRunId}/final-report.md`,
323
+ smokeSentinelPath: structuralOraclePassed ? `reports/autonomous-runs/${safeRunId}/SMOKE_AUTONOMY_PASSED.sentinel` : undefined,
324
+ };
325
+ }