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,30 @@
1
+
2
+
3
+ export type AutonomousApplyPolicy = "no_apply" | "sandbox_simulation" | "manual_apply_only" | "auto_apply_in_scope";
4
+ export type AutonomousBudgetProfile = "advisory" | "strict_requested";
5
+ export type AutonomousRisk = "low" | "medium" | "high";
6
+ export type AutonomousLevel = "L4" | "L5" | "L6";
7
+
8
+ export interface AutonomousRuntimeDryRunInput {
9
+ userNeed: string;
10
+ refinedSpec?: string;
11
+ runId?: string;
12
+ constraints?: string[];
13
+ acceptanceCriteria?: string[];
14
+ expectedArtifacts?: string[];
15
+ allowedPaths?: string[];
16
+ forbiddenPaths?: string[];
17
+ allowedSources?: string[];
18
+ maxContextTokens?: number;
19
+ applyPolicy?: AutonomousApplyPolicy;
20
+ budgetProfile?: AutonomousBudgetProfile;
21
+ risk?: AutonomousRisk;
22
+ authorizedAutonomyLevel?: AutonomousLevel;
23
+ userLaunchConfirmed?: boolean;
24
+ launchConfirmedAt?: string;
25
+ allowedActions?: string[];
26
+ }
27
+
28
+ export interface AutonomousReadOnlySmokeRunInput extends AutonomousRuntimeDryRunInput {
29
+ factoryRunId?: string;
30
+ }
@@ -0,0 +1,184 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { sha256 } from "../../../core/utils/hashing.js";
4
+ import { safeFileStem } from "../../../core/utils/paths.js";
5
+ import { isRecord } from "../../../core/utils/records.js";
6
+ import { hasForbiddenBodyKeys, hashes } from "./dry-run.js";
7
+ import { artifactHashIfPresent, readJsonArtifact, validateAutonomousCurrentSourceFingerprintFreshness } from "./smoke-run.js";
8
+
9
+ export function validateAutonomousRuntimeDryRunArtifacts(repoRoot: string, runId: string): Record<string, unknown> {
10
+ const safeRunId = safeFileStem(runId);
11
+ const runDir = join(repoRoot, "reports", "autonomous-runs", safeRunId);
12
+ const requiredArtifacts = ["spec-gate.json", "context-scope.json", "context-lookup.json", "context-pack.json", "runtime-gates.json", "model-routing-plan.json", "run-graph.json", "factory-selection.json", "proof-plan.json", "dry-run-report.json", "validation.json", "final-report.md", "DRY_RUN_READY.sentinel"];
13
+ const jsonArtifacts = requiredArtifacts.filter((name) => name.endsWith(".json"));
14
+ const parsedArtifacts: Record<string, Record<string, unknown> | unknown[]> = {};
15
+ const artifactMetadata = requiredArtifacts.map((name) => {
16
+ const artifactPath = join(runDir, name);
17
+ const present = existsSync(artifactPath);
18
+ if (!present) return { name, path: `reports/autonomous-runs/${safeRunId}/${name}`, present, bodyStored: false };
19
+ if (!name.endsWith(".json")) {
20
+ const raw = readFileSync(artifactPath, "utf8");
21
+ return { name, path: `reports/autonomous-runs/${safeRunId}/${name}`, present, hash: sha256(raw), bodyStored: false };
22
+ }
23
+ const read = readJsonArtifact(artifactPath);
24
+ if (read.parsed) parsedArtifacts[name] = read.parsed;
25
+ return { name, path: `reports/autonomous-runs/${safeRunId}/${name}`, present, hash: read.hash, schema: isRecord(read.parsed) ? read.parsed.schema : undefined, error: read.error, bodyStored: false };
26
+ });
27
+ const artifact = (name: string): Record<string, unknown> => isRecord(parsedArtifacts[name]) ? parsedArtifacts[name] as Record<string, unknown> : {};
28
+ const arrayArtifact = (name: string): unknown[] => Array.isArray(parsedArtifacts[name]) ? parsedArtifacts[name] as unknown[] : [];
29
+ const report = artifact("dry-run-report.json");
30
+ const validation = artifact("validation.json");
31
+ const specGate = artifact("spec-gate.json");
32
+ const contextScope = artifact("context-scope.json");
33
+ const contextLookups = arrayArtifact("context-lookup.json");
34
+ const contextPack = artifact("context-pack.json");
35
+ const runtimeGates = artifact("runtime-gates.json");
36
+ const modelRoutingPlan = artifact("model-routing-plan.json");
37
+ const runGraph = artifact("run-graph.json");
38
+ const factorySelection = artifact("factory-selection.json");
39
+ const proofPlan = artifact("proof-plan.json");
40
+ const proofStages = Array.isArray(proofPlan.stages) ? proofPlan.stages.filter(isRecord) : [];
41
+ const graphEdges = Array.isArray(runGraph.edges) ? runGraph.edges.filter(isRecord) : [];
42
+ const graphNodes = Array.isArray(runGraph.nodes) ? runGraph.nodes.filter(isRecord) : [];
43
+ const modelRoutes = Array.isArray(modelRoutingPlan.routes) ? modelRoutingPlan.routes.filter(isRecord) : [];
44
+ const lookupPlan = isRecord(report.contextPlan) && isRecord(report.contextPlan.lookupPlan) ? report.contextPlan.lookupPlan : {};
45
+ const factoryReadiness = isRecord(factorySelection.factoryReadiness) ? factorySelection.factoryReadiness : {};
46
+ const jsonBodyFree = jsonArtifacts.every((name) => {
47
+ const parsed = parsedArtifacts[name];
48
+ return parsed !== undefined && !hasForbiddenBodyKeys(parsed);
49
+ });
50
+ const checks = [
51
+ { name: "required_artifacts_present", passed: artifactMetadata.every((item) => item.present === true), detail: { requiredArtifacts } },
52
+ { name: "json_artifacts_parse", passed: artifactMetadata.filter((item) => item.name.endsWith(".json")).every((item) => !item.error), detail: { jsonArtifacts } },
53
+ { name: "artifact_schemas", passed: specGate.schema === "zob.autonomous-spec-gate.v1" && contextScope.schema === "zob.context-scope.v1" && contextPack.schema === "zob.context-pack.v1" && runtimeGates.schema === "zob.autonomous-runtime-gates.v1" && modelRoutingPlan.schema === "zob.autonomous-model-routing-plan.v1" && runGraph.schema === "zob.autonomous-run-graph.v1" && factorySelection.schema === "zob.autonomous-factory-selection.v1" && proofPlan.schema === "zob.autonomous-proof-plan.v1" && report.schema === "zob.autonomous-runtime-dry-run.v1" && validation.schema === "zob.autonomous-runtime-dry-run-validation.v1", detail: "expected autonomous dry-run artifact schemas" },
54
+ { name: "spec_gate_scope_locked", passed: specGate.specLocked === true && specGate.allowedPathsRequired === true && specGate.pathGatePassed === true && specGate.applyPolicyRequired === true && specGate.applyPolicyProvided === true && specGate.budgetProfileRequired === true && specGate.budgetProfileProvided === true && specGate.autonomousStrictBudgetRequired === true && specGate.autonomousStrictBudgetSatisfied === true && Array.isArray(specGate.allowedPaths) && specGate.allowedPaths.length > 0 && Array.isArray(specGate.forbiddenPaths) && specGate.forbiddenPaths.length > 0, detail: "autonomous spec lock requires safe bounded allowed_paths, forbidden_paths, explicit apply_policy, and explicit strict_requested budget_profile" },
55
+ { name: "dry_run_safety_flags", passed: report.noExecution === true && report.childDispatchAllowed === false && report.daemonStarted === false && report.productionWritesPerformed === false && report.autoApply === false && report.networkAccessed === false && report.globalAutonomyReady === false && report.globalAutonomyNoShip === true, detail: "report safety posture" },
56
+ { name: "validation_safety_flags", passed: validation.passed === true && validation.noExecution === true && validation.childDispatchAllowed === false && validation.networkAccessed === false && validation.globalAutonomyNoShip === true && validation.sentinel === "DRY_RUN_READY.sentinel", detail: "validation safety posture" },
57
+ { name: "context_lookup_pack_cited_bounded", passed: contextLookups.length > 0 && contextLookups.every((lookup) => isRecord(lookup) && lookup.schema === "zob.brain-lookup-result.v1" && lookup.queryStored === false && lookup.citationRequired === true) && Array.isArray(contextPack.citations) && contextPack.citations.length > 0 && isRecord(contextPack.loadingRules) && contextPack.loadingRules.boundedContextOnly === true && contextPack.loadingRules.agentLoadsEntireCorpus === false, detail: { lookupCount: contextLookups.length, citationCount: Array.isArray(contextPack.citations) ? contextPack.citations.length : 0 } },
58
+ { name: "gbrain_disabled", passed: lookupPlan.gbrainImportEnabled === false && lookupPlan.gbrainEmbedEnabled === false && lookupPlan.gbrainSyncEnabled === false && lookupPlan.gbrainWriteEnabled === false, detail: "P0 dry-run does not import/embed/sync/write GBrain" },
59
+ { name: "runtime_gates_no_execution", passed: runtimeGates.passed === true && isRecord(runtimeGates.autonomousStrictBudgetGate) && runtimeGates.autonomousStrictBudgetGate.strictRequested === true && runtimeGates.autonomousStrictBudgetGate.strictEnabled === false && runtimeGates.autonomousStrictBudgetGate.budgetEnforced === false && runtimeGates.noExecution === true && runtimeGates.childDispatchAllowed === false && runtimeGates.globalBudgetEnforced === false && runtimeGates.globalModelRoutingEnabled === false && runtimeGates.daemonStarted === false && runtimeGates.productionWritesPerformed === false && runtimeGates.autoApply === false && runtimeGates.networkAccessed === false, detail: "runtime gates require strict budget intent while remaining disabled/proposal-only" },
60
+ { name: "model_routing_plan_safe", passed: modelRoutingPlan.routingPlanReady === true && modelRoutingPlan.liveRoutingEnabled === false && modelRoutingPlan.globalLiveRoutingEnabled === false && modelRoutingPlan.modelRouterUsed === false && modelRoutingPlan.routingApplied === false && modelRoutingPlan.childDispatchAllowed === false && modelRoutingPlan.noExecution === true && modelRoutes.some((route) => route.stage === "context_reuse_scout" && route.recommendedModelClass === "cheap_scout") && modelRoutes.some((route) => route.oracleCritical === true && route.recommendedModelClass === "strong_oracle") && modelRoutes.every((route) => route.noExecution === true && route.modelRouterUsed === false && route.routingApplied === false && route.childDispatchAllowed === false), detail: { routeCount: modelRoutes.length, failedChecks: modelRoutingPlan.failedChecks } },
61
+ { name: "run_graph_parent_owned_no_dispatch", passed: runGraph.status === "dry_run_graph_ready" && runGraph.parentOwned === true && runGraph.noExecution === true && runGraph.childDispatchAllowed === false && graphNodes.some((node) => node.id === "model_routing_plan") && graphNodes.some((node) => node.id === "registered_factory_current_source_proof") && graphEdges.length > 0 && graphEdges.every((edge) => edge.parentOwned === true && edge.dispatchAllowed === false), detail: { nodes: graphNodes.length, edges: graphEdges.length } },
62
+ { name: "factory_selection_requires_current_source_proof", passed: factorySelection.currentSourceProofRequired === true && typeof factoryReadiness.registeredBatchReady === "boolean" && factorySelection.proofBeforeExecutionRequired === (factoryReadiness.registeredBatchReady !== true), detail: { selectedFactory: factorySelection.selectedFactory, registeredBatchReady: factoryReadiness.registeredBatchReady } },
63
+ { name: "proof_plan_has_required_gates", passed: ["context_lookup_and_pack", "runtime_gates_preflight", "model_routing_plan", "registered_factory_current_source_proof", "smoke_oracle", "pilot_oracle", "batch"].every((name) => proofStages.some((stage) => stage.name === name)) && proofStages.every((stage) => stage.name === "spec_lock" || stage.dispatchAllowed === false || stage.dispatchAllowed === undefined), detail: { stages: proofStages.map((stage) => stage.name) } },
64
+ { name: "json_artifacts_body_free", passed: jsonBodyFree, detail: "no forbidden plaintext body keys in JSON artifacts" },
65
+ ];
66
+ const failedChecks = checks.filter((check) => !check.passed).map((check) => check.name);
67
+ const result = {
68
+ schema: "zob.autonomous-runtime-dry-run-artifact-validation.v1",
69
+ runId: safeRunId,
70
+ valid: failedChecks.length === 0,
71
+ failedChecks,
72
+ checks,
73
+ artifacts: artifactMetadata,
74
+ noExecution: true,
75
+ childDispatchAllowed: false,
76
+ networkAccessed: false,
77
+ globalAutonomyReady: false,
78
+ globalAutonomyNoShip: true,
79
+ bodyStored: false,
80
+ promptBodiesStored: false,
81
+ outputBodiesStored: false,
82
+ generatedAt: new Date().toISOString(),
83
+ };
84
+ if (hasForbiddenBodyKeys(result)) throw new Error("autonomous dry-run artifact validation would store forbidden plaintext body keys");
85
+ return result;
86
+ }
87
+ export function validateAutonomousReadOnlySmokeRunArtifacts(repoRoot: string, runId: string): Record<string, unknown> {
88
+ const safeRunId = safeFileStem(runId);
89
+ const runDir = join(repoRoot, "reports", "autonomous-runs", safeRunId);
90
+ const requiredArtifacts = ["spec-gate.json", "context-scope.json", "context-pack.json", "runtime-gates.json", "model-routing-plan.json", "model-routing-proof-plan.json", "factory-selection.json", "factory-run-ref.json", "oracle-review.json", "promotion-plan.json", "promotion-proof-plan.json", "scheduler-plan.json", "scheduler-proof-plan.json", "mission-control-plan.json", "mission-control-proof-plan.json", "sandbox-apply-plan.json", "strict-budget-proof-plan.json", "current-source-fingerprint.json", "final-e2e-proof-plan.json", "final-no-ship-oracle.json", "completion-gate.json", "validation.json", "final-report.md", "SMOKE_AUTONOMY_PASSED.sentinel"];
91
+ const jsonArtifacts = requiredArtifacts.filter((name) => name.endsWith(".json"));
92
+ const parsedArtifacts: Record<string, Record<string, unknown>> = {};
93
+ const artifacts = requiredArtifacts.map((name) => {
94
+ const artifactPath = join(runDir, name);
95
+ const present = existsSync(artifactPath);
96
+ if (!present) return { name, path: `reports/autonomous-runs/${safeRunId}/${name}`, present, bodyStored: false };
97
+ if (!name.endsWith(".json")) return { name, path: `reports/autonomous-runs/${safeRunId}/${name}`, present, hash: artifactHashIfPresent(artifactPath), bodyStored: false };
98
+ const read = readJsonArtifact(artifactPath);
99
+ if (isRecord(read.parsed)) parsedArtifacts[name] = read.parsed;
100
+ return { name, path: `reports/autonomous-runs/${safeRunId}/${name}`, present, hash: read.hash, schema: isRecord(read.parsed) ? read.parsed.schema : undefined, error: read.error, bodyStored: false };
101
+ });
102
+ const artifact = (name: string): Record<string, unknown> => parsedArtifacts[name] ?? {};
103
+ const runtimeGates = artifact("runtime-gates.json");
104
+ const modelRoutingPlan = artifact("model-routing-plan.json");
105
+ const modelRoutingProofPlan = artifact("model-routing-proof-plan.json");
106
+ const factorySelection = artifact("factory-selection.json");
107
+ const factoryRunRef = artifact("factory-run-ref.json");
108
+ const oracleReview = artifact("oracle-review.json");
109
+ const promotionPlan = artifact("promotion-plan.json");
110
+ const promotionProofPlan = artifact("promotion-proof-plan.json");
111
+ const schedulerPlan = artifact("scheduler-plan.json");
112
+ const schedulerProofPlan = artifact("scheduler-proof-plan.json");
113
+ const missionControlPlan = artifact("mission-control-plan.json");
114
+ const missionControlProofPlan = artifact("mission-control-proof-plan.json");
115
+ const sandboxApplyPlan = artifact("sandbox-apply-plan.json");
116
+ const strictBudgetProofPlan = artifact("strict-budget-proof-plan.json");
117
+ const currentSourceFingerprint = artifact("current-source-fingerprint.json");
118
+ const finalE2EProofPlan = artifact("final-e2e-proof-plan.json");
119
+ const finalNoShipOracle = artifact("final-no-ship-oracle.json");
120
+ const completionGate = artifact("completion-gate.json");
121
+ const validation = artifact("validation.json");
122
+ const currentSourceFingerprintFreshness = validateAutonomousCurrentSourceFingerprintFreshness(repoRoot, currentSourceFingerprint, factorySelection);
123
+ const factoryRunId = typeof factoryRunRef.factoryRunId === "string" ? factoryRunRef.factoryRunId : "unknown";
124
+ const factoryRunDir = join(repoRoot, "reports", "factory-runs", factoryRunId);
125
+ const finalDoneSentinelPath = join(runDir, "DONE.sentinel");
126
+ const globalReadySentinelPath = join(runDir, "GLOBAL_AUTONOMY_READY.sentinel");
127
+ const finalDoneSentinelPresent = existsSync(finalDoneSentinelPath);
128
+ const globalReadySentinelPresent = existsSync(globalReadySentinelPath);
129
+ const checks = [
130
+ { name: "required_artifacts_present", passed: artifacts.every((item) => item.present === true), detail: { requiredArtifacts } },
131
+ { name: "json_artifacts_parse", passed: artifacts.filter((item) => item.name.endsWith(".json")).every((item) => !item.error), detail: { jsonArtifacts } },
132
+ { name: "artifact_schemas", passed: factoryRunRef.schema === "zob.autonomous-readonly-smoke-factory-run-ref.v1" && oracleReview.schema === "zob.autonomous-readonly-smoke-oracle-review.v1" && promotionPlan.schema === "zob.autonomous-promotion-plan.v1" && promotionProofPlan.schema === "zob.autonomous-promotion-proof-plan.v1" && schedulerPlan.schema === "zob.autonomous-scheduler-plan.v1" && schedulerProofPlan.schema === "zob.autonomous-scheduler-proof-plan.v1" && missionControlPlan.schema === "zob.autonomous-mission-control-plan.v1" && missionControlProofPlan.schema === "zob.autonomous-mission-control-proof-plan.v1" && sandboxApplyPlan.schema === "zob.autonomous-sandbox-apply-plan.v1" && strictBudgetProofPlan.schema === "zob.autonomous-strict-budget-proof-plan.v1" && modelRoutingProofPlan.schema === "zob.autonomous-model-routing-proof-plan.v1" && currentSourceFingerprint.schema === "zob.autonomous-current-source-fingerprint.v1" && finalE2EProofPlan.schema === "zob.autonomous-final-e2e-proof-plan.v1" && finalNoShipOracle.schema === "zob.autonomous-final-no-ship-oracle.v1" && completionGate.schema === "zob.autonomous-completion-gate.v1" && validation.schema === "zob.autonomous-readonly-smoke-validation.v1", detail: "expected Phase 4A/5B/6B/7B/8B/9A/9B/10B/11F smoke artifact schemas" },
133
+ { name: "runtime_and_model_gates_safe", passed: runtimeGates.childDispatchAllowed === false && runtimeGates.daemonStarted === false && runtimeGates.productionWritesPerformed === false && runtimeGates.autoApply === false && modelRoutingPlan.liveRoutingEnabled === false && modelRoutingPlan.globalLiveRoutingEnabled === false && modelRoutingPlan.childDispatchAllowed === false, detail: "runtime/model routing gates remain disabled" },
134
+ { name: "model_routing_proof_plan_gate_only", passed: modelRoutingProofPlan.status === "model_routing_dispatch_gate_proof_ready_global_default_blocked" && modelRoutingProofPlan.modelRoutingProofReady === true && modelRoutingProofPlan.routingDefaultDisabledProofPassed === true && modelRoutingProofPlan.routingOracleProofPassed === true && modelRoutingProofPlan.routingHighContextProofPassed === true && modelRoutingProofPlan.routingSecurityNoDowngradeProofPassed === true && modelRoutingProofPlan.selectedModelsStored === false && modelRoutingProofPlan.selectedModelHashesOnly === true && modelRoutingProofPlan.finalE2ERequirementCleared === false && modelRoutingProofPlan.no_ship === true && Array.isArray(modelRoutingProofPlan.scenarios) && modelRoutingProofPlan.scenarios.some((scenario) => isRecord(scenario) && scenario.name === "routing_oracle_applies_when_enabled" && scenario.selectedModelClass === "strong_oracle" && typeof scenario.selectedModelHash === "string" && scenario.selectedModelStored === false) && modelRoutingProofPlan.globalLiveRoutingEnabled === false && modelRoutingProofPlan.liveAutonomousRoutingApplied === false && modelRoutingProofPlan.modelRouterUsed === false && modelRoutingProofPlan.routingApplied === false && modelRoutingProofPlan.childDispatchAllowed === false && modelRoutingProofPlan.noExecution === true && modelRoutingProofPlan.globalAutonomyReady === false && modelRoutingProofPlan.globalAutonomyNoShip === true, detail: "Phase 6B proves model routing dispatch gate class selection without enabling global/live routing" },
135
+ { name: "factory_selection_existing", passed: factorySelection.selectionStatus === "existing_factory_selected" && typeof factorySelection.selectedFactory === "string", detail: { selectedFactory: factorySelection.selectedFactory } },
136
+ { name: "factory_smoke_completed", passed: factoryRunRef.status === "done" && factoryRunRef.execution === "deterministic" && factoryRunRef.phaseSentinelPresent === true && factoryRunRef.doneSentinelPresent === true && existsSync(join(factoryRunDir, "SMOKE_PASSED.sentinel")) && existsSync(join(factoryRunDir, "DONE.sentinel")), detail: { factoryRunId } },
137
+ { name: "structural_oracle_passed", passed: oracleReview.verdict === "PASS" && oracleReview.no_ship === false && oracleReview.liveOracleDispatched === false, detail: { oracleType: oracleReview.oracleType } },
138
+ { name: "promotion_plan_smoke_to_pilot_gate", passed: isRecord(promotionPlan.smokeGate) && promotionPlan.smokeGate.passed === true && isRecord(promotionPlan.pilotGate) && promotionPlan.pilotGate.preconditionsMet === true && promotionPlan.pilotGate.executionAllowed === false && promotionPlan.pilotGate.dispatchAllowed === false && isRecord(promotionPlan.batchGate) && promotionPlan.batchGate.preconditionsMet === false && promotionPlan.batchGate.batchConcurrencyCapRequired === true && promotionPlan.globalAutonomyNoShip === true, detail: "Phase 7A promotion gates are metadata-only and do not execute pilot/batch" },
139
+ { name: "promotion_proof_plan_execution_blocked", passed: promotionProofPlan.status === "pilot_batch_promotion_proof_ready_execution_blocked" && promotionProofPlan.promotionProofReady === true && promotionProofPlan.smokeToPilotPreconditionsProved === true && promotionProofPlan.pilotExecutionBlockedProofPassed === true && promotionProofPlan.batchExecutionBlockedProofPassed === true && promotionProofPlan.resumeRetryPolicyProofPassed === true && promotionProofPlan.oraclePolicyProofPassed === true && promotionProofPlan.finalE2ERequirementCleared === false && promotionProofPlan.no_ship === true && promotionProofPlan.pilotExecutionAllowed === false && promotionProofPlan.batchExecutionAllowed === false && promotionProofPlan.pilotExecuted === false && promotionProofPlan.batchExecuted === false && promotionProofPlan.childDispatchAllowed === false && promotionProofPlan.noExecutionBeyondSmoke === true && promotionProofPlan.globalAutonomyReady === false && promotionProofPlan.globalAutonomyNoShip === true, detail: "Phase 7B proves pilot/batch promotion prerequisites and blocked execution without running pilot/batch" },
140
+ { name: "scheduler_plan_disabled_bounded", passed: schedulerPlan.schedulerPlanReady === true && schedulerPlan.schedulerExecutionAllowed === false && schedulerPlan.daemonStarted === false && schedulerPlan.autoStartDaemon === false && schedulerPlan.continuousLoop === false && schedulerPlan.childDispatchAllowed === false && isRecord(schedulerPlan.killSwitch) && schedulerPlan.killSwitch.required === true && isRecord(schedulerPlan.workerPool) && schedulerPlan.workerPool.maxWorkers === 1 && isRecord(schedulerPlan.retryPolicy) && schedulerPlan.retryPolicy.retriesCapped === true && isRecord(schedulerPlan.budgetPolicy) && schedulerPlan.budgetPolicy.strictBudgetRequired === true && schedulerPlan.globalAutonomyNoShip === true, detail: "Phase 8A scheduler plan is bounded and disabled by default" },
141
+ { name: "scheduler_proof_plan_execution_blocked", passed: schedulerProofPlan.status === "scheduler_daemon_proof_ready_execution_blocked" && schedulerProofPlan.schedulerProofReady === true && schedulerProofPlan.daemonDefaultDisabledProofPassed === true && schedulerProofPlan.oneWorkerBoundedProofPassed === true && schedulerProofPlan.stopConditionsProofPassed === true && schedulerProofPlan.killSwitchRetryProofPassed === true && schedulerProofPlan.strictBudgetBeforeDispatchProofPassed === true && schedulerProofPlan.alwaysOnApprovalProofPassed === true && schedulerProofPlan.finalE2ERequirementCleared === false && schedulerProofPlan.no_ship === true && schedulerProofPlan.schedulerExecutionAllowed === false && schedulerProofPlan.daemonStarted === false && schedulerProofPlan.autoStartDaemon === false && schedulerProofPlan.continuousLoop === false && schedulerProofPlan.childDispatchAllowed === false && schedulerProofPlan.productionWritesPerformed === false && schedulerProofPlan.autoApply === false && schedulerProofPlan.noExecutionBeyondSmoke === true && schedulerProofPlan.globalAutonomyReady === false && schedulerProofPlan.globalAutonomyNoShip === true, detail: "Phase 8B proves daemon/scheduler policy and blocked execution without starting daemon" },
142
+ { name: "mission_control_plan_proposal_only", passed: missionControlPlan.missionControlPlanReady === true && missionControlPlan.transportDispatch === false && missionControlPlan.networkComsEnabled === false && missionControlPlan.directWorkerWrites === false && missionControlPlan.childDispatchAllowed === false && isRecord(missionControlPlan.commandPolicy) && missionControlPlan.commandPolicy.proposalOnly === true && missionControlPlan.commandPolicy.directWorkerWrites === false && missionControlPlan.commandPolicy.directWorkerCommandBlocked === true && isRecord(missionControlPlan.comsPolicy) && missionControlPlan.comsPolicy.topologyGuardActive === true && missionControlPlan.comsPolicy.hashOnlyLedgers === true && missionControlPlan.globalAutonomyNoShip === true, detail: "Phase 9A Mission Control/coms plan is proposal-only and transport-disabled" },
143
+ { name: "mission_control_proof_plan_execution_blocked", passed: missionControlProofPlan.status === "mission_control_comms_proof_ready_execution_blocked" && missionControlProofPlan.missionControlProofReady === true && missionControlProofPlan.proposalOnlyCommandsProofPassed === true && missionControlProofPlan.topologyHashOnlyCommsProofPassed === true && missionControlProofPlan.directWorkerCommandsBlockedProofPassed === true && missionControlProofPlan.liveTransportNetworkDisabledProofPassed === true && missionControlProofPlan.liveGlobalRoutingApprovalProofPassed === true && missionControlProofPlan.post8bSchedulerBlockedProofPassed === true && missionControlProofPlan.finalE2ERequirementCleared === false && missionControlProofPlan.no_ship === true && missionControlProofPlan.childDispatchAllowed === false && missionControlProofPlan.daemonStarted === false && missionControlProofPlan.directWorkerWrites === false && missionControlProofPlan.transportDispatch === false && missionControlProofPlan.networkComsEnabled === false && missionControlProofPlan.liveRoutingEnabled === false && missionControlProofPlan.globalLiveRoutingEnabled === false && missionControlProofPlan.productionWritesPerformed === false && missionControlProofPlan.autoApply === false && missionControlProofPlan.globalAutonomyReady === false && missionControlProofPlan.globalAutonomyNoShip === true, detail: "Phase 9B proves proposal-only commands, topology/hash-only comms, blocked direct-worker commands, disabled transport/network, and approval-required live/global routing" },
144
+ { name: "sandbox_apply_plan_metadata_only", passed: sandboxApplyPlan.sandboxApplyPlanReady === true && sandboxApplyPlan.productionWritesPerformed === false && sandboxApplyPlan.autoApply === false && sandboxApplyPlan.realApplyExecuted === false && sandboxApplyPlan.childDispatchAllowed === false && sandboxApplyPlan.globalAutonomyNoShip === true && isRecord(sandboxApplyPlan.isolatedTempWorkspace) && sandboxApplyPlan.isolatedTempWorkspace.required === true && sandboxApplyPlan.isolatedTempWorkspace.executed === true && isRecord(sandboxApplyPlan.diffGate) && sandboxApplyPlan.diffGate.diffHashRequired === true && sandboxApplyPlan.diffGate.diffHashesMatch === true && isRecord(sandboxApplyPlan.oracleDiffReview) && sandboxApplyPlan.oracleDiffReview.required === true && sandboxApplyPlan.oracleDiffReview.reviewPassed === true && isRecord(sandboxApplyPlan.rollbackPolicy) && sandboxApplyPlan.rollbackPolicy.rollbackMetadataRequired === true && sandboxApplyPlan.rollbackPolicy.rollbackPrepared === true && isRecord(sandboxApplyPlan.approvalPolicy) && sandboxApplyPlan.approvalPolicy.manualApprovalRequired === true && sandboxApplyPlan.approvalPolicy.approvedForMainWorkspaceApply === false && isRecord(sandboxApplyPlan.manualApplyPreflight) && sandboxApplyPlan.manualApplyPreflight.required === true && sandboxApplyPlan.manualApplyPreflight.preflightPassed === true && sandboxApplyPlan.manualApplyPreflight.executionAllowedByThisTool === false && sandboxApplyPlan.manualApplyPreflight.realApplyExecuted === false && isRecord(sandboxApplyPlan.mainWorkspaceApply) && sandboxApplyPlan.mainWorkspaceApply.realApplyAllowed === false && sandboxApplyPlan.mainWorkspaceApply.realApplyExecuted === false && sandboxApplyPlan.mainWorkspaceApply.productionWritesPerformed === false, detail: "Phase 10B sandbox/apply plan requires temp workspace, diff hash, oracle review, rollback, manual approval, and manual apply preflight while blocking real apply" },
145
+ { name: "strict_budget_proof_plan_gate_only", passed: strictBudgetProofPlan.status === "strict_budget_dispatch_gate_proof_ready_global_default_blocked" && strictBudgetProofPlan.strictBudgetProofReady === true && strictBudgetProofPlan.strictBudgetAllowProofPassed === true && strictBudgetProofPlan.strictBudgetBlockProofPassed === true && strictBudgetProofPlan.strictBudgetDefaultDisabledProofPassed === true && strictBudgetProofPlan.finalE2ERequirementCleared === false && strictBudgetProofPlan.no_ship === true && Array.isArray(strictBudgetProofPlan.scenarios) && strictBudgetProofPlan.scenarios.some((scenario) => isRecord(scenario) && scenario.name === "strict_gate_blocks_exceedance_pre_dispatch" && scenario.wouldBlockDispatch === true && scenario.gateChildDispatchAllowed === false && scenario.dispatchDecision === "block") && strictBudgetProofPlan.globalStrictBudgetEnabled === false && strictBudgetProofPlan.globalBudgetEnforced === false && strictBudgetProofPlan.liveAutonomousBudgetEnforced === false && strictBudgetProofPlan.budgetEnforced === false && strictBudgetProofPlan.strictEnabled === false && strictBudgetProofPlan.childDispatchAllowed === false && strictBudgetProofPlan.noExecution === true && strictBudgetProofPlan.globalAutonomyReady === false && strictBudgetProofPlan.globalAutonomyNoShip === true, detail: "Phase 5B proves strict dispatch gate allow/block/default-disabled behavior without clearing final live strict-budget requirement" },
146
+ { name: "current_source_fingerprint_hash_only", passed: currentSourceFingerprint.status === "current_source_fingerprint_captured" && currentSourceFingerprint.currentSourceFingerprintReady === true && currentSourceFingerprint.currentSourceFingerprintCaptured === true && currentSourceFingerprint.noMockCurrentSourceE2EProved === false && typeof currentSourceFingerprint.fingerprintHash === "string" && /^[a-f0-9]{64}$/.test(currentSourceFingerprint.fingerprintHash) && Array.isArray(currentSourceFingerprint.sourceFiles) && currentSourceFingerprint.sourceFiles.length > 0 && isRecord(currentSourceFingerprint.fileHashes) && Object.values(currentSourceFingerprint.fileHashes).every((hash) => typeof hash === "string" && /^[a-f0-9]{64}$/.test(hash)) && Array.isArray(currentSourceFingerprint.missingFiles) && currentSourceFingerprint.missingFiles.length === 0 && isRecord(currentSourceFingerprint.evidencePolicy) && currentSourceFingerprint.evidencePolicy.hashOnly === true && currentSourceFingerprint.evidencePolicy.sourceBodiesStored === false && isRecord(currentSourceFingerprint.safety) && currentSourceFingerprint.safety.noExecution === true && currentSourceFingerprint.safety.globalAutonomyNoShip === true, detail: "Phase 11C current-source fingerprint captures hash-only source evidence without proving final no-mock E2E" },
147
+ { name: "current_source_fingerprint_fresh", passed: currentSourceFingerprintFreshness.fresh === true && currentSourceFingerprintFreshness.fileHashesMatch === true && currentSourceFingerprintFreshness.fingerprintHashMatches === true && currentSourceFingerprintFreshness.sourceFilesMatch === true && currentSourceFingerprintFreshness.missingFilesMatch === true && currentSourceFingerprintFreshness.currentMissingFiles && Array.isArray(currentSourceFingerprintFreshness.currentMissingFiles) && currentSourceFingerprintFreshness.currentMissingFiles.length === 0, detail: "Phase 11D validator recomputes current source hashes and fails stale/tampered fingerprints" },
148
+ { name: "final_e2e_proof_plan_no_ship", passed: finalE2EProofPlan.status === "blocked_for_final_e2e_proof" && finalE2EProofPlan.finalE2EProofReady === false && finalE2EProofPlan.no_ship === true && Array.isArray(finalE2EProofPlan.blockers) && finalE2EProofPlan.blockers.includes("live_strict_budget_not_enforced") && finalE2EProofPlan.blockers.includes("live_model_routing_not_enabled") && finalE2EProofPlan.blockers.includes("pilot_execution_disabled") && finalE2EProofPlan.blockers.includes("batch_execution_disabled") && finalE2EProofPlan.blockers.includes("final_oracle_missing") && isRecord(finalE2EProofPlan.sentinelPolicy) && finalE2EProofPlan.sentinelPolicy.globalReadySentinelAllowed === false && finalE2EProofPlan.sentinelPolicy.globalReadySentinelPresent === false && isRecord(finalE2EProofPlan.currentSourceProof) && finalE2EProofPlan.currentSourceProof.currentSourceFingerprintCaptured === true && typeof finalE2EProofPlan.currentSourceProof.currentSourceFingerprintHash === "string" && finalE2EProofPlan.currentSourceProof.noMockCurrentSourceE2EProved === false && finalE2EProofPlan.globalAutonomyReady === false && finalE2EProofPlan.globalAutonomyNoShip === true && finalE2EProofPlan.childDispatchAllowed === false && finalE2EProofPlan.productionWritesPerformed === false && finalE2EProofPlan.autoApply === false, detail: "Phase 11C final E2E proof plan references current-source fingerprint while preserving no-ship" },
149
+ { name: "final_no_ship_oracle_blocks_global_autonomy", passed: finalNoShipOracle.verdict === "FAIL" && finalNoShipOracle.no_ship === true && finalNoShipOracle.finalOracleReady === false && finalNoShipOracle.finalOraclePass === false && Array.isArray(finalNoShipOracle.failedChecks) && finalNoShipOracle.failedChecks.includes("final_e2e_proof_ready") && finalNoShipOracle.failedChecks.includes("no_mock_current_source_e2e_proved") && isRecord(finalNoShipOracle.decision) && finalNoShipOracle.decision.globalAutonomyReady === false && finalNoShipOracle.decision.globalAutonomyNoShip === true && finalNoShipOracle.decision.writeGlobalReadySentinelAllowed === false && finalNoShipOracle.globalAutonomyReady === false && finalNoShipOracle.globalAutonomyNoShip === true && finalNoShipOracle.childDispatchAllowed === false && finalNoShipOracle.productionWritesPerformed === false && finalNoShipOracle.autoApply === false, detail: "Phase 11E deterministic final no-ship oracle blocks global autonomy until final E2E proof" },
150
+ { name: "completion_gate_blocks_goal_completion", passed: completionGate.status === "blocked_for_goal_completion" && completionGate.completionReady === false && completionGate.allRequirementsVerified === false && completionGate.no_ship === true && completionGate.updateGoalAllowed === false && completionGate.requiredGoalStatus === "in_progress" && Array.isArray(completionGate.failedChecks) && completionGate.failedChecks.includes("final_e2e_proof_ready") && isRecord(completionGate.decision) && completionGate.decision.updateGoalStatusCompleteAllowed === false && completionGate.decision.globalAutonomyReady === false && completionGate.decision.globalAutonomyNoShip === true && completionGate.decision.writeGlobalReadySentinelAllowed === false && completionGate.globalAutonomyReady === false && completionGate.globalAutonomyNoShip === true && completionGate.childDispatchAllowed === false && completionGate.productionWritesPerformed === false && completionGate.autoApply === false, detail: "Phase 11F completion gate blocks update_goal complete until every final requirement is verified" },
151
+ { name: "final_global_sentinels_absent", passed: finalDoneSentinelPresent === false && globalReadySentinelPresent === false, detail: { doneSentinelPresent: finalDoneSentinelPresent, globalReadySentinelPresent } },
152
+ { name: "validation_passed_scope_limited", passed: validation.passed === true && validation.status === "smoke_autonomy_passed" && validation.no_ship === false && validation.globalAutonomyReady === false && validation.globalAutonomyNoShip === true && validation.childDispatchAllowed === false && validation.productionWritesPerformed === false && validation.autoApply === false, detail: "run-scoped smoke pass without global autonomy" },
153
+ { name: "json_artifacts_body_free", passed: jsonArtifacts.every((name) => isRecord(parsedArtifacts[name]) && !hasForbiddenBodyKeys(parsedArtifacts[name])), detail: "no forbidden plaintext body keys" },
154
+ ];
155
+ const failedChecks = checks.filter((check) => check.passed !== true).map((check) => check.name);
156
+ const result = {
157
+ schema: "zob.autonomous-readonly-smoke-artifact-validation.v1",
158
+ runId: safeRunId,
159
+ valid: failedChecks.length === 0,
160
+ failedChecks,
161
+ checks,
162
+ artifacts,
163
+ finalGlobalSentinels: {
164
+ doneSentinelPresent: finalDoneSentinelPresent,
165
+ globalReadySentinelPresent,
166
+ doneSentinelAllowed: false,
167
+ globalReadySentinelAllowed: false,
168
+ },
169
+ currentSourceFingerprintFreshness,
170
+ globalAutonomyReady: false,
171
+ globalAutonomyNoShip: true,
172
+ childDispatchAllowed: false,
173
+ daemonStarted: false,
174
+ productionWritesPerformed: false,
175
+ autoApply: false,
176
+ liveRoutingEnabled: false,
177
+ bodyStored: false,
178
+ promptBodiesStored: false,
179
+ outputBodiesStored: false,
180
+ generatedAt: new Date().toISOString(),
181
+ };
182
+ if (hasForbiddenBodyKeys(result)) throw new Error("autonomous readonly smoke validation would store forbidden plaintext body keys");
183
+ return result;
184
+ }