@mikenguyen69/harness 0.1.0-beta.1
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/LICENSE +21 -0
- package/README.md +43 -0
- package/dist/build-identity.json +1 -0
- package/dist/cancellation.js +138 -0
- package/dist/cli.js +47 -0
- package/dist/dispatch.js +70 -0
- package/dist/help.js +47 -0
- package/dist/internal/agent/adapter/conformance.js +53 -0
- package/dist/internal/agent/adapter/hook.js +113 -0
- package/dist/internal/agent/adapter/install.js +30 -0
- package/dist/internal/agent/adapter/scope.js +55 -0
- package/dist/internal/agent/adapter/session.js +63 -0
- package/dist/internal/agent/adapter/settings.js +51 -0
- package/dist/internal/agent/cli.js +79 -0
- package/dist/internal/agent/evals/index.js +111 -0
- package/dist/internal/agent/index.js +15 -0
- package/dist/internal/agent/ledger-read.js +27 -0
- package/dist/internal/agent/routing/cli.js +104 -0
- package/dist/internal/agent/routing/index.js +123 -0
- package/dist/internal/agent/telemetry/index.js +97 -0
- package/dist/internal/orchestration/activity/index.js +111 -0
- package/dist/internal/orchestration/analyze/index.js +237 -0
- package/dist/internal/orchestration/cli.js +475 -0
- package/dist/internal/orchestration/config/index.js +66 -0
- package/dist/internal/orchestration/doctor/index.js +202 -0
- package/dist/internal/orchestration/forge/index.js +121 -0
- package/dist/internal/orchestration/git/index.js +181 -0
- package/dist/internal/orchestration/harness/cli.js +378 -0
- package/dist/internal/orchestration/harness/index.js +186 -0
- package/dist/internal/orchestration/harness/shim.js +182 -0
- package/dist/internal/orchestration/index.js +29 -0
- package/dist/internal/orchestration/loop/index.js +1107 -0
- package/dist/internal/orchestration/prompts/index.js +199 -0
- package/dist/internal/orchestration/report/index.js +125 -0
- package/dist/internal/orchestration/routes/index.js +85 -0
- package/dist/internal/orchestration/run/index.js +221 -0
- package/dist/internal/orchestration/runner/index.js +90 -0
- package/dist/internal/orchestration/runners/claude/index.js +246 -0
- package/dist/internal/orchestration/runners/claude/sdk.js +198 -0
- package/dist/internal/orchestration/runners/claude/wiring.js +98 -0
- package/dist/internal/orchestration/runners/codex/exec.js +114 -0
- package/dist/internal/orchestration/runners/codex/index.js +72 -0
- package/dist/internal/orchestration/runners/conformance/index.js +169 -0
- package/dist/internal/orchestration/runners/cursor/exec.js +531 -0
- package/dist/internal/orchestration/runners/cursor/index.js +184 -0
- package/dist/internal/orchestration/runners/stub/index.js +168 -0
- package/dist/internal/orchestration/runners/telemetry.js +36 -0
- package/dist/internal/orchestration/runstate/index.js +213 -0
- package/dist/internal/orchestration/runstate/publish.js +115 -0
- package/dist/internal/orchestration/worktree/index.js +89 -0
- package/dist/internal/system/adapters/index.js +19 -0
- package/dist/internal/system/agentops/index.js +16 -0
- package/dist/internal/system/agentops/scope.js +67 -0
- package/dist/internal/system/assets.js +45 -0
- package/dist/internal/system/board/cli.js +56 -0
- package/dist/internal/system/board/index.js +276 -0
- package/dist/internal/system/board/live.js +277 -0
- package/dist/internal/system/calibration/cli.js +45 -0
- package/dist/internal/system/calibration/index.js +141 -0
- package/dist/internal/system/cli.js +174 -0
- package/dist/internal/system/corpus/replay.js +79 -0
- package/dist/internal/system/digest/cli.js +23 -0
- package/dist/internal/system/digest/index.js +145 -0
- package/dist/internal/system/doors/classify.js +94 -0
- package/dist/internal/system/doors/cli.js +184 -0
- package/dist/internal/system/doors/index.js +249 -0
- package/dist/internal/system/doors/metrics.js +47 -0
- package/dist/internal/system/escapes/cli.js +45 -0
- package/dist/internal/system/escapes/index.js +81 -0
- package/dist/internal/system/explore/cli.js +77 -0
- package/dist/internal/system/explore/index.js +91 -0
- package/dist/internal/system/gates/cli.js +43 -0
- package/dist/internal/system/gates/detectors.js +55 -0
- package/dist/internal/system/gates/pre.js +51 -0
- package/dist/internal/system/hub/cli.js +51 -0
- package/dist/internal/system/hub/index.js +146 -0
- package/dist/internal/system/init/index.js +83 -0
- package/dist/internal/system/ledger/cli.js +54 -0
- package/dist/internal/system/ledger/index.js +176 -0
- package/dist/internal/system/manifest/index.js +207 -0
- package/dist/internal/system/provenance/index.js +13 -0
- package/dist/internal/system/report/index.js +15 -0
- package/dist/internal/system/runner/index.js +74 -0
- package/dist/internal/system/runstatus/cli.js +86 -0
- package/dist/internal/system/runstatus/index.js +168 -0
- package/dist/internal/system/sequencer/briefing.js +75 -0
- package/dist/internal/system/sequencer/cli.js +170 -0
- package/dist/internal/system/sequencer/index.js +156 -0
- package/dist/internal/system/spec/cli.js +110 -0
- package/dist/internal/system/spec/index.js +212 -0
- package/dist/internal/system/spec/materialize.js +111 -0
- package/dist/internal/system/spec/openspec-parse.js +83 -0
- package/dist/internal/system/spec/project.js +208 -0
- package/dist/internal/system/substrate/index.js +14 -0
- package/dist/internal/system/system/index.js +159 -0
- package/dist/internal/system/units/index.js +87 -0
- package/dist/internal/system/verify/cli.js +103 -0
- package/dist/internal/system/verify/declined-reasons.js +61 -0
- package/dist/internal/system/verify/index.js +188 -0
- package/dist/internal/system/verify/signing.js +79 -0
- package/dist/paths.js +50 -0
- package/dist/routes.js +93 -0
- package/dist/version.js +30 -0
- package/dist/win32-process-group.js +360 -0
- package/package.json +41 -0
- package/profiles/python/bindings.toml +59 -0
- package/profiles/terraform/bindings.toml +66 -0
- package/profiles/typescript/bindings.toml +64 -0
- package/profiles/typescript/smoke/README.md +8 -0
- package/schema/baseline.schema.json +26 -0
- package/schema/decision-classes.yaml +45 -0
- package/schema/envelope.schema.json +186 -0
- package/schema/ledger-event.schema.json +235 -0
- package/schema/manifest.schema.json +119 -0
- package/schema/routes.schema.json +55 -0
- package/schema/run-status.schema.json +162 -0
- package/schema/session-event.schema.json +74 -0
- package/schema/spec.schema.json +114 -0
- package/schema/system.schema.json +142 -0
- package/templates/ci/verify.yml +23 -0
- package/templates/target-kit/README.md +78 -0
- package/templates/target-kit/component.toml +20 -0
- package/templates/target-kit/orchestration.json +9 -0
- package/templates/target-kit/profiles/target/bindings.toml +6 -0
- package/templates/target-kit/routes.toml +5 -0
- package/templates/target-kit/specs/first-unit.yaml +11 -0
- package/templates/target-kit/system.toml +7 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* shim — the text-output adapter for `harness next` / `harness claim`, used
|
|
3
|
+
* until SH P7.4 (`--json` on both) lands. ISOLATED HERE ON PURPOSE: when the
|
|
4
|
+
* JSON flags ship, this file is deleted and `ShimHarness` is replaced by a
|
|
5
|
+
* straight JSON-parsing `CliHarness`. Nothing else in the loop imports it.
|
|
6
|
+
*
|
|
7
|
+
* Current text shapes it parses (from repos/system-harness/src/sequencer/cli.ts):
|
|
8
|
+
* `harness next` → `component#id\n` lines on stdout, `no ready units` on stderr
|
|
9
|
+
* `harness next --escalated` → same, `no escalated units` on stderr
|
|
10
|
+
* `harness claim <id> --session <s>` → `claimed <id> by <s> (seq N)\n`, exit 0/1
|
|
11
|
+
*
|
|
12
|
+
* The text carries no deps and no mode, so shimmed `next()` returns
|
|
13
|
+
* `deps: []` and `mode: "build"` for every unit — a known degradation. explore
|
|
14
|
+
* parking and dep ordering are only correct once P7.4 delivers structured data;
|
|
15
|
+
* the FakeHarness (which the M1 dry loop actually exercises) has both.
|
|
16
|
+
*/
|
|
17
|
+
import { execFile } from "node:child_process";
|
|
18
|
+
import { promisify } from "node:util";
|
|
19
|
+
const run = promisify(execFile);
|
|
20
|
+
export class ShimHarness {
|
|
21
|
+
opts;
|
|
22
|
+
constructor(opts) {
|
|
23
|
+
this.opts = opts;
|
|
24
|
+
}
|
|
25
|
+
base() {
|
|
26
|
+
return this.opts.ledgerDir ? ["--ledger", this.opts.ledgerDir] : [];
|
|
27
|
+
}
|
|
28
|
+
async call(args) {
|
|
29
|
+
try {
|
|
30
|
+
const { stdout, stderr } = await run(this.opts.bin, args, {
|
|
31
|
+
cwd: this.opts.cwd,
|
|
32
|
+
});
|
|
33
|
+
return { code: 0, stdout, stderr };
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
const err = e;
|
|
37
|
+
return {
|
|
38
|
+
code: typeof err.code === "number" ? err.code : 1,
|
|
39
|
+
stdout: err.stdout ?? "",
|
|
40
|
+
stderr: err.stderr ?? "",
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
parseLines(stdout) {
|
|
45
|
+
return stdout
|
|
46
|
+
.split("\n")
|
|
47
|
+
.map((l) => l.trim())
|
|
48
|
+
.filter(Boolean)
|
|
49
|
+
.map((line) => {
|
|
50
|
+
const hash = line.indexOf("#");
|
|
51
|
+
return hash >= 0
|
|
52
|
+
? {
|
|
53
|
+
component: line.slice(0, hash),
|
|
54
|
+
id: line.slice(hash + 1),
|
|
55
|
+
deps: [],
|
|
56
|
+
mode: "build",
|
|
57
|
+
}
|
|
58
|
+
: { id: line, deps: [], mode: "build" };
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
async next(opts) {
|
|
62
|
+
const args = ["next", ...this.base()];
|
|
63
|
+
if (opts?.only)
|
|
64
|
+
args.push("--only", opts.only);
|
|
65
|
+
const { stdout } = await this.call(args);
|
|
66
|
+
return this.parseLines(stdout);
|
|
67
|
+
}
|
|
68
|
+
async escalated() {
|
|
69
|
+
const { stdout } = await this.call(["next", "--escalated", ...this.base()]);
|
|
70
|
+
return this.parseLines(stdout);
|
|
71
|
+
}
|
|
72
|
+
async units() {
|
|
73
|
+
// The current CLI has no structured status query, so the shim cannot feed
|
|
74
|
+
// the startup sweep. It returns `[]` — the sweep is a no-op behind the shim
|
|
75
|
+
// and only fully functional against the FakeHarness (dry loop) or a real
|
|
76
|
+
// status surface. Filling this is P7.4-adjacent system-harness work.
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
async claim(unitId, session) {
|
|
80
|
+
const { code } = await this.call([
|
|
81
|
+
"claim",
|
|
82
|
+
unitId,
|
|
83
|
+
"--session",
|
|
84
|
+
session,
|
|
85
|
+
...this.base(),
|
|
86
|
+
]);
|
|
87
|
+
if (code !== 0)
|
|
88
|
+
return null;
|
|
89
|
+
// The text `claim` returns no briefing body. Until P7.4, the caller must
|
|
90
|
+
// treat a shimmed claim as "took the unit" only; briefing fields are unknown
|
|
91
|
+
// and the loop cannot run a real dispatch off it. This is why M2 is blocked
|
|
92
|
+
// on P7.4, not on this shim.
|
|
93
|
+
return {
|
|
94
|
+
unitId,
|
|
95
|
+
intent: "(shim: briefing unavailable until harness claim --json — SH P7.4)",
|
|
96
|
+
acceptanceCriteria: [],
|
|
97
|
+
scope: [],
|
|
98
|
+
branch: `unit/${unitId}`,
|
|
99
|
+
mergeFacts: {},
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
async heartbeat(unitId, session) {
|
|
103
|
+
await this.call(["heartbeat", unitId, "--session", session, ...this.base()]);
|
|
104
|
+
}
|
|
105
|
+
async ledgerAppend(event) {
|
|
106
|
+
await this.call([
|
|
107
|
+
"ledger",
|
|
108
|
+
"append",
|
|
109
|
+
"--type",
|
|
110
|
+
event.type,
|
|
111
|
+
"--unit",
|
|
112
|
+
event.unitId,
|
|
113
|
+
...(event.session ? ["--session", event.session] : []),
|
|
114
|
+
...(event.body ? ["--body", JSON.stringify(event.body)] : []),
|
|
115
|
+
...this.base(),
|
|
116
|
+
]);
|
|
117
|
+
}
|
|
118
|
+
async verify(unitId) {
|
|
119
|
+
const { code, stdout, stderr } = await this.call([
|
|
120
|
+
"verify",
|
|
121
|
+
"--unit",
|
|
122
|
+
unitId,
|
|
123
|
+
...this.base(),
|
|
124
|
+
]);
|
|
125
|
+
if (code === 0)
|
|
126
|
+
return { status: "pass" };
|
|
127
|
+
if (code === 2)
|
|
128
|
+
return { status: "halt", evidence: stderr || stdout };
|
|
129
|
+
return { status: "fail", evidence: stderr || stdout };
|
|
130
|
+
}
|
|
131
|
+
async verifySystem(unitId, systemToml) {
|
|
132
|
+
const { code, stdout, stderr } = await this.call([
|
|
133
|
+
"verify",
|
|
134
|
+
"--unit",
|
|
135
|
+
unitId,
|
|
136
|
+
"--system",
|
|
137
|
+
systemToml,
|
|
138
|
+
...this.base(),
|
|
139
|
+
]);
|
|
140
|
+
if (code === 0)
|
|
141
|
+
return { status: "pass" };
|
|
142
|
+
if (code === 2)
|
|
143
|
+
return { status: "halt", evidence: stderr || stdout };
|
|
144
|
+
return { status: "fail", evidence: stderr || stdout };
|
|
145
|
+
}
|
|
146
|
+
async merge(unitId, landedSha, facts) {
|
|
147
|
+
const flags = [];
|
|
148
|
+
if (facts.door === "one-way")
|
|
149
|
+
flags.push("--one-way");
|
|
150
|
+
if (facts.door === "two-way")
|
|
151
|
+
flags.push("--two-way");
|
|
152
|
+
if (facts.addsDependency)
|
|
153
|
+
flags.push("--adds-dependency");
|
|
154
|
+
if (facts.schemaChange)
|
|
155
|
+
flags.push("--schema-change");
|
|
156
|
+
if (facts.security)
|
|
157
|
+
flags.push("--security");
|
|
158
|
+
if (facts.gateExternal)
|
|
159
|
+
flags.push("--gate-external");
|
|
160
|
+
if (facts.artifactProducerChange)
|
|
161
|
+
flags.push("--artifact-producer-change");
|
|
162
|
+
if (facts.mode)
|
|
163
|
+
flags.push("--mode", facts.mode);
|
|
164
|
+
const { code, stdout, stderr } = await this.call([
|
|
165
|
+
"merge",
|
|
166
|
+
unitId,
|
|
167
|
+
"--landed",
|
|
168
|
+
landedSha,
|
|
169
|
+
...flags,
|
|
170
|
+
...this.base(),
|
|
171
|
+
]);
|
|
172
|
+
if (code === 0)
|
|
173
|
+
return { status: "merged", landedSha };
|
|
174
|
+
return {
|
|
175
|
+
status: "door-open",
|
|
176
|
+
doorId: `${unitId}#door`,
|
|
177
|
+
unblock: (stderr || stdout).trim() ||
|
|
178
|
+
`harness door approve ${unitId} --reason "<why>" --who <operator>`,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=shim.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @harness/orchestration — the execution loop.
|
|
3
|
+
*
|
|
4
|
+
* Public surface (v0): the loop primitives and their injectable fakes. The
|
|
5
|
+
* `orchestrate` CLI (./cli.ts) is the runnable entrypoint.
|
|
6
|
+
*/
|
|
7
|
+
export * from "./harness/index.js";
|
|
8
|
+
export * from "./harness/cli.js";
|
|
9
|
+
export * from "./routes/index.js";
|
|
10
|
+
export * from "./runner/index.js";
|
|
11
|
+
export * from "./runstate/index.js";
|
|
12
|
+
export * from "./runstate/publish.js";
|
|
13
|
+
export * from "./loop/index.js";
|
|
14
|
+
export * from "./git/index.js";
|
|
15
|
+
export * from "./config/index.js";
|
|
16
|
+
export * from "./forge/index.js";
|
|
17
|
+
export * from "./run/index.js";
|
|
18
|
+
export * from "./worktree/index.js";
|
|
19
|
+
export * from "./report/index.js";
|
|
20
|
+
export * from "./prompts/index.js";
|
|
21
|
+
export * from "./runners/telemetry.js";
|
|
22
|
+
export * from "./runners/conformance/index.js";
|
|
23
|
+
export { ClaudeRunner } from "./runners/claude/index.js";
|
|
24
|
+
export { CodexRunner } from "./runners/codex/index.js";
|
|
25
|
+
export { CursorRunner } from "./runners/cursor/index.js";
|
|
26
|
+
export { runCodexExec, foldCodexStream, } from "./runners/codex/exec.js";
|
|
27
|
+
export { runCursorAgent, foldCursorOutput, } from "./runners/cursor/exec.js";
|
|
28
|
+
export { runClaudeSession, } from "./runners/claude/sdk.js";
|
|
29
|
+
//# sourceMappingURL=index.js.map
|