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.
- package/.pi/capabilities/zob-public-runtime-capabilities.json +16 -17
- package/.pi/extensions/zob-harness/index.ts +1 -1
- package/.pi/extensions/zob-harness/src/domains/autonomy/autonomous-runtime/dry-run.ts +1107 -0
- package/.pi/extensions/zob-harness/src/domains/autonomy/autonomous-runtime/report-writers.ts +325 -0
- package/.pi/extensions/zob-harness/src/domains/autonomy/autonomous-runtime/smoke-run.ts +1286 -0
- package/.pi/extensions/zob-harness/src/domains/autonomy/autonomous-runtime/types.ts +30 -0
- package/.pi/extensions/zob-harness/src/domains/autonomy/autonomous-runtime/validation.ts +184 -0
- package/.pi/extensions/zob-harness/src/domains/autonomy/autonomous-runtime.ts +4 -2912
- package/.pi/extensions/zob-harness/src/domains/compute/compute-profile.ts +2 -1
- package/.pi/extensions/zob-harness/src/domains/coms/coms-v2/registry.ts +24 -3
- package/.pi/extensions/zob-harness/src/domains/coms/coms-v2/types.ts +1 -0
- package/.pi/extensions/zob-harness/src/domains/coms/coms-v2/zpeer.ts +5 -3
- package/.pi/extensions/zob-harness/src/domains/delegation/child-runner.ts +28 -3
- package/.pi/extensions/zob-harness/src/domains/goal/goal-todos/constants.ts +19 -0
- package/.pi/extensions/zob-harness/src/domains/goal/goal-todos/formatting.ts +148 -0
- package/.pi/extensions/zob-harness/src/domains/goal/goal-todos/normalize.ts +476 -0
- package/.pi/extensions/zob-harness/src/domains/goal/goal-todos/operations.ts +393 -0
- package/.pi/extensions/zob-harness/src/domains/goal/goal-todos/parsing.ts +277 -0
- package/.pi/extensions/zob-harness/src/domains/goal/goal-todos/reducer.ts +110 -0
- package/.pi/extensions/zob-harness/src/domains/goal/goal-todos.ts +6 -1429
- package/.pi/extensions/zob-harness/src/domains/governance/governed-requests.ts +3 -1
- package/.pi/extensions/zob-harness/src/domains/governance/merge-queue.ts +3 -1
- package/.pi/extensions/zob-harness/src/domains/governance/sandbox/helpers.ts +124 -0
- package/.pi/extensions/zob-harness/src/domains/governance/sandbox/runners.ts +444 -0
- package/.pi/extensions/zob-harness/src/domains/governance/sandbox/simulation.ts +569 -0
- package/.pi/extensions/zob-harness/src/domains/governance/sandbox/types.ts +127 -0
- package/.pi/extensions/zob-harness/src/domains/governance/sandbox/validation.ts +273 -0
- package/.pi/extensions/zob-harness/src/domains/governance/sandbox.ts +4 -1508
- package/.pi/extensions/zob-harness/src/domains/governance/worker-pool.ts +3 -1
- package/.pi/extensions/zob-harness/src/domains/governance/workspace-claims.ts +3 -1
- package/.pi/extensions/zob-harness/src/domains/orchestration/room.ts +8 -2
- package/.pi/extensions/zob-harness/src/domains/promotion/coms.ts +8 -1
- package/.pi/extensions/zob-harness/src/runtime/commands/autonomy.ts +188 -0
- package/.pi/extensions/zob-harness/src/runtime/commands/compute.ts +165 -0
- package/.pi/extensions/zob-harness/src/runtime/commands/daemon.ts +191 -0
- package/.pi/extensions/zob-harness/src/runtime/commands/delegates.ts +47 -0
- package/.pi/extensions/zob-harness/src/runtime/commands/goal.ts +70 -0
- package/.pi/extensions/zob-harness/src/runtime/commands/intent.ts +383 -0
- package/.pi/extensions/zob-harness/src/runtime/commands/misc.ts +229 -0
- package/.pi/extensions/zob-harness/src/runtime/commands/project-dna.ts +130 -0
- package/.pi/extensions/zob-harness/src/runtime/commands/types.ts +3 -0
- package/.pi/extensions/zob-harness/src/runtime/commands/zcommit.ts +145 -0
- package/.pi/extensions/zob-harness/src/runtime/commands/zlive.ts +1606 -0
- package/.pi/extensions/zob-harness/src/runtime/commands/zmode.ts +42 -0
- package/.pi/extensions/zob-harness/src/runtime/commands.ts +26 -3109
- package/.pi/extensions/zob-harness/src/runtime/events.ts +67 -33
- package/.pi/extensions/zob-harness/src/runtime/goal-runtime/commands.ts +194 -0
- package/.pi/extensions/zob-harness/src/runtime/goal-runtime/events.ts +81 -0
- package/.pi/extensions/zob-harness/src/runtime/goal-runtime/state.ts +662 -0
- package/.pi/extensions/zob-harness/src/runtime/goal-runtime/tools.ts +1005 -0
- package/.pi/extensions/zob-harness/src/runtime/goal-runtime.ts +5 -1949
- package/.pi/extensions/zob-harness/src/runtime/tools-delegation/helpers.ts +786 -0
- package/.pi/extensions/zob-harness/src/runtime/tools-delegation/register.ts +1120 -0
- package/.pi/extensions/zob-harness/src/runtime/tools-delegation/types.ts +77 -0
- package/.pi/extensions/zob-harness/src/runtime/tools-delegation.ts +1 -1904
- package/.pi/extensions/zob-harness/src/runtime/zob-intro.ts +46 -15
- package/.pi/factories/project-dna/batch-manifest.json +1 -1
- package/.pi/factories/project-dna/pilot-manifest.json +1 -1
- package/.pi/factories/project-dna/smoke-manifest.json +1 -1
- package/README.md +29 -8
- package/package.json +14 -5
- package/scripts/git-ops/commit-policy-smoke.mjs +33 -6
- package/scripts/goal-todo/child-goal-ref-smoke.mjs +30 -3
- package/scripts/goal-todo/handoff-static-smoke.mjs +31 -3
- package/scripts/harness-intake/lib/cli-io.mjs +89 -0
- package/scripts/harness-intake/lib/constants.mjs +59 -0
- package/scripts/harness-intake/lib/infer-spec.mjs +127 -0
- package/scripts/harness-intake/lib/profiles.mjs +458 -0
- package/scripts/harness-intake/lib/run-init.mjs +307 -0
- package/scripts/harness-intake/lib/scan.mjs +266 -0
- package/scripts/harness-intake/lib/tmux.mjs +92 -0
- package/scripts/harness-intake/lib/validate.mjs +152 -0
- package/scripts/harness-intake/lib.mjs +8 -1521
- package/scripts/harness-switch/static-smoke.mjs +1 -1
- package/scripts/model-catalog/validate-economy.mjs +3 -1
- package/scripts/model-catalog/validate.mjs +3 -1
- package/scripts/project-dna/scan/scan.mjs +5 -2
- package/scripts/project-dna/scan/validate-scan-artifacts.mjs +3 -1
- package/scripts/project-dna/validation/validate-ontology.mjs +3 -1
- package/scripts/project-dna/validation/validate-scaffold.mjs +2 -2
- package/scripts/zagent-static-smoke.mjs +30 -2
- package/scripts/zpeer-local-e2e-smoke.mjs +18 -0
- package/scripts/zpeer-static-smoke.mjs +40 -5
- package/scripts/zteam-hot-add/smoke.mjs +30 -2
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { basename, join } from "node:path";
|
|
3
|
+
import { repoRel, resolveRunDir, writeJson, writeText } from "./cli-io.mjs";
|
|
4
|
+
import { SCHEMA_PREFIX } from "./constants.mjs";
|
|
5
|
+
import { buildProfiles, writeProfileArtifacts } from "./profiles.mjs";
|
|
6
|
+
import { HARNESS_INTAKE_AGENTS, initializeRun } from "./run-init.mjs";
|
|
7
|
+
import { scanSources } from "./scan.mjs";
|
|
8
|
+
|
|
9
|
+
export function validateRun(runIdOrDir) {
|
|
10
|
+
const runDir = resolveRunDir(runIdOrDir);
|
|
11
|
+
const required = [
|
|
12
|
+
"request.md",
|
|
13
|
+
"inferred-run-spec.json",
|
|
14
|
+
"manifest.json",
|
|
15
|
+
"agentic-plan.json",
|
|
16
|
+
"artifact-contracts.json",
|
|
17
|
+
"autonomous-status.md",
|
|
18
|
+
"sources-index.json",
|
|
19
|
+
"source-risk-report.json",
|
|
20
|
+
"harness-profile.json",
|
|
21
|
+
"skills-profile.json",
|
|
22
|
+
"commands-profile.json",
|
|
23
|
+
"prompt-patterns.json",
|
|
24
|
+
"sessions-analysis.json",
|
|
25
|
+
"workflow-patterns.json",
|
|
26
|
+
"team-candidates.json",
|
|
27
|
+
"factory-candidates.json",
|
|
28
|
+
];
|
|
29
|
+
const errors = [];
|
|
30
|
+
const warnings = [];
|
|
31
|
+
for (const file of required) {
|
|
32
|
+
if (!existsSync(join(runDir, file))) errors.push(`missing ${file}`);
|
|
33
|
+
}
|
|
34
|
+
const spec = readJsonIfExists(join(runDir, "inferred-run-spec.json"));
|
|
35
|
+
const sources = readJsonIfExists(join(runDir, "sources-index.json"));
|
|
36
|
+
const sessions = readJsonIfExists(join(runDir, "sessions-analysis.json"));
|
|
37
|
+
const teams = readJsonIfExists(join(runDir, "team-candidates.json"));
|
|
38
|
+
const factories = readJsonIfExists(join(runDir, "factory-candidates.json"));
|
|
39
|
+
const artifactContracts = readJsonIfExists(join(runDir, "artifact-contracts.json"));
|
|
40
|
+
if (spec && spec.schema !== `${SCHEMA_PREFIX}.inferred-run-spec.v1`) errors.push("inferred-run-spec schema mismatch");
|
|
41
|
+
if (sources && sources.schema !== `${SCHEMA_PREFIX}.sources-index.v1`) errors.push("sources-index schema mismatch");
|
|
42
|
+
if (artifactContracts && artifactContracts.schema !== `${SCHEMA_PREFIX}.artifact-contracts.v1`) errors.push("artifact-contracts schema mismatch");
|
|
43
|
+
if (artifactContracts?.startup_file_delivery_required !== true) errors.push("artifact-contracts must require startup file delivery");
|
|
44
|
+
if (artifactContracts?.raw_prompt_transport_line_by_line !== false) errors.push("artifact-contracts must set raw_prompt_transport_line_by_line=false");
|
|
45
|
+
if (sessions?.status === "analyzed" && spec?.sessions?.authorized !== true) errors.push("sessions were analyzed without recorded authorization");
|
|
46
|
+
if ((sources?.sources ?? []).some((source) => source.contains_possible_secret)) errors.push("source index includes possible secret-like content/path; review source-risk-report.json");
|
|
47
|
+
if (!Array.isArray(teams?.candidates) || teams.candidates.length < 1) errors.push("team-candidates must include at least one candidate");
|
|
48
|
+
if (!Array.isArray(factories?.candidates) || factories.candidates.length < 1) warnings.push("no factory candidates produced");
|
|
49
|
+
const generatedDir = join(runDir, "generated-proposals");
|
|
50
|
+
if (!existsSync(generatedDir)) errors.push("missing generated-proposals directory");
|
|
51
|
+
for (const agent of HARNESS_INTAKE_AGENTS) {
|
|
52
|
+
const kickoffPath = join(runDir, "kickoff", `${agent.id}-kickoff.md`);
|
|
53
|
+
if (!existsSync(kickoffPath)) errors.push(`missing kickoff file for ${agent.id}`);
|
|
54
|
+
}
|
|
55
|
+
const dispatch = readJsonIfExists(join(runDir, "tmux", "kickoff-dispatch.json"));
|
|
56
|
+
if (dispatch) {
|
|
57
|
+
if (dispatch.startup_file_delivery !== true) errors.push("tmux kickoff-dispatch must set startup_file_delivery=true");
|
|
58
|
+
if (dispatch.raw_prompt_transport_line_by_line !== false) errors.push("tmux kickoff-dispatch must set raw_prompt_transport_line_by_line=false");
|
|
59
|
+
if (dispatch.post_start_tmux_paste_disabled !== true) errors.push("tmux kickoff-dispatch must set post_start_tmux_paste_disabled=true");
|
|
60
|
+
if (!Array.isArray(dispatch.panes) || dispatch.panes.length !== HARNESS_INTAKE_AGENTS.length) errors.push("tmux kickoff-dispatch panes must cover every harness-intake agent");
|
|
61
|
+
}
|
|
62
|
+
const validation = {
|
|
63
|
+
schema: `${SCHEMA_PREFIX}.validation.v1`,
|
|
64
|
+
run_id: spec?.run_id ?? basename(runDir),
|
|
65
|
+
status: errors.length ? "fail" : "pass",
|
|
66
|
+
no_ship: errors.length > 0,
|
|
67
|
+
errors,
|
|
68
|
+
warnings,
|
|
69
|
+
checked_files: required,
|
|
70
|
+
source_project_modified: false,
|
|
71
|
+
activation_performed: false,
|
|
72
|
+
quarantine_only: true,
|
|
73
|
+
validated_at: new Date().toISOString(),
|
|
74
|
+
};
|
|
75
|
+
writeJson(join(runDir, "validation.json"), validation);
|
|
76
|
+
const oracle = {
|
|
77
|
+
schema: `${SCHEMA_PREFIX}.oracle-review.v1`,
|
|
78
|
+
verdict: errors.length ? "FAIL" : warnings.length ? "WARN" : "PASS",
|
|
79
|
+
no_ship: errors.length > 0,
|
|
80
|
+
confidence: errors.length ? "HIGH" : "MEDIUM",
|
|
81
|
+
evidence_refs: required.filter((file) => existsSync(join(runDir, file))),
|
|
82
|
+
blocking_issues: errors,
|
|
83
|
+
non_blocking_notes: warnings,
|
|
84
|
+
reviewed_at: new Date().toISOString(),
|
|
85
|
+
compliance: "deterministic local validation; no activation; no source mutation",
|
|
86
|
+
};
|
|
87
|
+
writeJson(join(runDir, "oracle-review.json"), oracle);
|
|
88
|
+
if (errors.length) {
|
|
89
|
+
writeText(join(runDir, "NO_SHIP.sentinel"), `${errors.join("\n")}\n`);
|
|
90
|
+
} else {
|
|
91
|
+
const mode = spec?.mode === "pilot" ? "PILOT_PASSED.sentinel" : spec?.mode === "batch" ? "BATCH_PASSED.sentinel" : "SMOKE_PASSED.sentinel";
|
|
92
|
+
writeText(join(runDir, mode), "pass\n");
|
|
93
|
+
writeText(join(runDir, "DONE.sentinel"), "done\n");
|
|
94
|
+
}
|
|
95
|
+
writeJson(join(runDir, "status.json"), {
|
|
96
|
+
schema: `${SCHEMA_PREFIX}.status.v1`,
|
|
97
|
+
run_id: spec?.run_id ?? basename(runDir),
|
|
98
|
+
status: validation.status,
|
|
99
|
+
no_ship: validation.no_ship,
|
|
100
|
+
phase: "validation",
|
|
101
|
+
run_dir: repoRel(runDir),
|
|
102
|
+
updated_at: new Date().toISOString(),
|
|
103
|
+
});
|
|
104
|
+
return validation;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function readJsonIfExists(path) {
|
|
108
|
+
if (!existsSync(path)) return undefined;
|
|
109
|
+
try {
|
|
110
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
111
|
+
} catch {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function writeSourceArtifacts(runDir, sourceIndex) {
|
|
117
|
+
writeJson(join(runDir, "sources-index.json"), sourceIndex);
|
|
118
|
+
const risky = (sourceIndex.sources ?? []).filter((source) => source.contains_possible_secret || source.secret_like_reasons?.length);
|
|
119
|
+
const report = {
|
|
120
|
+
schema: `${SCHEMA_PREFIX}.source-risk-report.v1`,
|
|
121
|
+
run_id: sourceIndex.run_id,
|
|
122
|
+
status: risky.length ? "review-required" : "pass",
|
|
123
|
+
no_ship: risky.length > 0,
|
|
124
|
+
source_project_modified: false,
|
|
125
|
+
risks: risky.map((source) => ({ source_id: source.source_id, path: source.path, reasons: source.secret_like_reasons })),
|
|
126
|
+
skipped_secret_like_paths: (sourceIndex.skipped ?? []).filter((row) => String(row.reason).startsWith("forbidden:")),
|
|
127
|
+
};
|
|
128
|
+
writeJson(join(runDir, "source-risk-report.json"), report);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function runFullAnalysis(spec, opts = {}) {
|
|
132
|
+
const { runDir } = initializeRun(spec);
|
|
133
|
+
if (opts.prepareOnly) {
|
|
134
|
+
return { schema: `${SCHEMA_PREFIX}.launch-result.v1`, status: "prepared", no_ship: false, run_id: spec.run_id, run_dir: repoRel(runDir), prepared_only: true };
|
|
135
|
+
}
|
|
136
|
+
const sourcesIndex = scanSources(spec);
|
|
137
|
+
writeSourceArtifacts(runDir, sourcesIndex);
|
|
138
|
+
const profiles = buildProfiles(spec, sourcesIndex);
|
|
139
|
+
writeProfileArtifacts(runDir, profiles);
|
|
140
|
+
const validation = validateRun(runDir);
|
|
141
|
+
return {
|
|
142
|
+
schema: `${SCHEMA_PREFIX}.launch-result.v1`,
|
|
143
|
+
status: validation.status,
|
|
144
|
+
no_ship: validation.no_ship,
|
|
145
|
+
run_id: spec.run_id,
|
|
146
|
+
run_dir: repoRel(runDir),
|
|
147
|
+
target: spec.target.input,
|
|
148
|
+
harness_hint: spec.harness_hint,
|
|
149
|
+
validation_ref: `${repoRel(runDir)}/validation.json`,
|
|
150
|
+
generated_proposals_ref: `${repoRel(runDir)}/generated-proposals`,
|
|
151
|
+
};
|
|
152
|
+
}
|