harnery 0.23.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/commands/harness.d.ts +2 -1
- package/dist/commands/harness.d.ts.map +1 -1
- package/dist/commands/harness.js +105 -3
- package/dist/commands/supervisor.d.ts.map +1 -1
- package/dist/commands/supervisor.js +3 -13
- package/dist/commands/work.d.ts.map +1 -1
- package/dist/commands/work.js +2 -7
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +215 -17
- package/dist/core/harnesses/attest.d.ts +48 -0
- package/dist/core/harnesses/attest.d.ts.map +1 -0
- package/dist/core/harnesses/attest.js +110 -0
- package/dist/core/harnesses/attestation.d.ts +75 -0
- package/dist/core/harnesses/attestation.d.ts.map +1 -0
- package/dist/core/harnesses/attestation.js +168 -0
- package/dist/core/harnesses/bench.d.ts +23 -1
- package/dist/core/harnesses/bench.d.ts.map +1 -1
- package/dist/core/harnesses/bench.js +135 -32
- package/dist/core/harnesses/index.d.ts +6 -2
- package/dist/core/harnesses/index.d.ts.map +1 -1
- package/dist/core/harnesses/index.js +3 -1
- package/dist/core/workflow/engine.js +3 -0
- package/dist/core/workflow/index.d.ts +1 -1
- package/dist/core/workflow/index.d.ts.map +1 -1
- package/dist/core/workflow/index.js +1 -1
- package/dist/core/workflow/proof.d.ts +4 -1
- package/dist/core/workflow/proof.d.ts.map +1 -1
- package/dist/core/workflow/proof.js +3 -2
- package/dist/core/workflow/spawn-cursor.d.ts +3 -0
- package/dist/core/workflow/spawn-cursor.d.ts.map +1 -1
- package/dist/core/workflow/spawn-cursor.js +8 -4
- package/dist/core/workflow/types.d.ts +14 -0
- package/dist/core/workflow/types.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/index.d.ts +1 -1
- package/dist/core/workflow/workspaces/index.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/index.js +1 -1
- package/dist/core/workflow/workspaces/integration.d.ts +8 -0
- package/dist/core/workflow/workspaces/integration.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/integration.js +15 -1
- package/dist/core/workflow/workspaces/leases.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/leases.js +19 -2
- package/package.json +1 -1
- package/src/commands/harness.ts +123 -2
- package/src/commands/supervisor.ts +11 -15
- package/src/commands/work.ts +8 -8
- package/src/commands/workflow.ts +268 -20
- package/src/core/harnesses/attest.ts +162 -0
- package/src/core/harnesses/attestation.ts +231 -0
- package/src/core/harnesses/bench.ts +187 -32
- package/src/core/harnesses/index.ts +26 -1
- package/src/core/workflow/engine.ts +3 -0
- package/src/core/workflow/index.ts +1 -0
- package/src/core/workflow/proof.ts +7 -1
- package/src/core/workflow/spawn-cursor.ts +8 -4
- package/src/core/workflow/types.ts +15 -0
- package/src/core/workflow/workspaces/index.ts +5 -1
- package/src/core/workflow/workspaces/integration.ts +17 -1
- package/src/core/workflow/workspaces/leases.ts +24 -2
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The opt-in live probe that produces an attestation (ADR 0038).
|
|
3
|
+
*
|
|
4
|
+
* One bounded turn per harness, through the same `spawn` the workflow engine
|
|
5
|
+
* uses, so what gets attested is the path production takes rather than a
|
|
6
|
+
* parallel test rig.
|
|
7
|
+
*/
|
|
8
|
+
import { profileDigest, sealAttestation, writeAttestation } from "./attestation.js";
|
|
9
|
+
import { probeBinaryVersion } from "./bench.js";
|
|
10
|
+
/** Fixed and content-free, so nothing user-supplied can reach the record and
|
|
11
|
+
* the turn stays as cheap as a turn can be. */
|
|
12
|
+
export const ATTESTATION_PROMPT = "Reply with the single word: ok";
|
|
13
|
+
export const DEFAULT_ATTESTATION_TIMEOUT_MS = 120_000;
|
|
14
|
+
/** Vendor failures arrive as whole console transcripts, banner and prompt echo
|
|
15
|
+
* included. Reports are bounded evidence, so the reason is collapsed to one
|
|
16
|
+
* short line and the echoed prompt is removed. */
|
|
17
|
+
const MAX_NOTE_REASON_CHARS = 200;
|
|
18
|
+
function boundedReason(reason) {
|
|
19
|
+
if (!reason)
|
|
20
|
+
return "no error reported";
|
|
21
|
+
const collapsed = reason.split(ATTESTATION_PROMPT).join("<prompt>").replace(/\s+/g, " ").trim();
|
|
22
|
+
return collapsed.length > MAX_NOTE_REASON_CHARS
|
|
23
|
+
? `${collapsed.slice(0, MAX_NOTE_REASON_CHARS)}…`
|
|
24
|
+
: collapsed;
|
|
25
|
+
}
|
|
26
|
+
export async function runHarnessAttestation(registry, opts = {}) {
|
|
27
|
+
const ids = opts.harnesses?.length ? [...opts.harnesses] : registry.ids();
|
|
28
|
+
const timeoutMs = opts.timeoutMs ?? DEFAULT_ATTESTATION_TIMEOUT_MS;
|
|
29
|
+
const cwd = opts.cwd ?? process.cwd();
|
|
30
|
+
const versionProbe = opts.versionProbe ?? probeBinaryVersion;
|
|
31
|
+
const now = opts.now ?? (() => new Date());
|
|
32
|
+
const results = [];
|
|
33
|
+
for (const id of ids) {
|
|
34
|
+
const adapter = registry.require(id);
|
|
35
|
+
const binaryVersion = versionProbe(adapter.profile.binary);
|
|
36
|
+
if (!binaryVersion) {
|
|
37
|
+
results.push({
|
|
38
|
+
harness: id,
|
|
39
|
+
outcome: "skipped",
|
|
40
|
+
note: `${adapter.profile.binary} not found on PATH`,
|
|
41
|
+
});
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
let result;
|
|
45
|
+
try {
|
|
46
|
+
result = opts.spawn
|
|
47
|
+
? await opts.spawn(id, ATTESTATION_PROMPT, timeoutMs)
|
|
48
|
+
: await adapter.spawn({
|
|
49
|
+
prompt: ATTESTATION_PROMPT,
|
|
50
|
+
timeoutMs,
|
|
51
|
+
maxTurns: 1,
|
|
52
|
+
cwd,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
results.push({
|
|
57
|
+
harness: id,
|
|
58
|
+
outcome: "failed",
|
|
59
|
+
binaryVersion,
|
|
60
|
+
note: `probe threw: ${boundedReason(error.message)}`,
|
|
61
|
+
});
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
// Prerequisite rule: an unreachable subject cannot evidence anything, so a
|
|
65
|
+
// failed turn records nothing at all rather than a page of `unsupported`.
|
|
66
|
+
if (!result.ok) {
|
|
67
|
+
results.push({
|
|
68
|
+
harness: id,
|
|
69
|
+
outcome: "unreachable",
|
|
70
|
+
binaryVersion,
|
|
71
|
+
durationMs: result.durationMs,
|
|
72
|
+
note: `the probe turn did not complete (${boundedReason(result.error)}); nothing recorded`,
|
|
73
|
+
});
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const observations = {
|
|
77
|
+
invocation: "supported",
|
|
78
|
+
finalResult: result.text.trim().length > 0 ? "supported" : "unsupported",
|
|
79
|
+
sessionId: result.sessionId ? "supported" : "unsupported",
|
|
80
|
+
cost: result.costUsd !== undefined ? "supported" : "unsupported",
|
|
81
|
+
};
|
|
82
|
+
const record = sealAttestation({
|
|
83
|
+
schema_version: 1,
|
|
84
|
+
harness: id,
|
|
85
|
+
binary_version: binaryVersion,
|
|
86
|
+
profile_digest: profileDigest(adapter.profile),
|
|
87
|
+
observed_at: now().toISOString(),
|
|
88
|
+
observations,
|
|
89
|
+
});
|
|
90
|
+
if (opts.persist)
|
|
91
|
+
opts.persist(record);
|
|
92
|
+
else
|
|
93
|
+
writeAttestation(record, { coordRoot: opts.coordRoot });
|
|
94
|
+
results.push({
|
|
95
|
+
harness: id,
|
|
96
|
+
outcome: "recorded",
|
|
97
|
+
binaryVersion,
|
|
98
|
+
observations,
|
|
99
|
+
durationMs: result.durationMs,
|
|
100
|
+
note: `observed on ${binaryVersion}`,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
generatedAt: now().toISOString(),
|
|
105
|
+
harnesses: ids,
|
|
106
|
+
results,
|
|
107
|
+
recorded: results.filter((row) => row.outcome === "recorded").length,
|
|
108
|
+
incomplete: results.some((row) => row.outcome !== "recorded"),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable record of what an installed vendor CLI was actually observed doing
|
|
3
|
+
* (ADR 0038).
|
|
4
|
+
*
|
|
5
|
+
* The conformance bench proves Harnery's own planner and normalizer against a
|
|
6
|
+
* committed fixture. That is an adapter check, not a vendor check
|
|
7
|
+
* (ADR 0037). An attestation is the other half: one bounded live turn, its
|
|
8
|
+
* observations, and the vendor version they were observed on.
|
|
9
|
+
*
|
|
10
|
+
* A record stores structural facts only. No prompt text, no completion text,
|
|
11
|
+
* no host paths. It lives under the host's coordination directory and is never
|
|
12
|
+
* published.
|
|
13
|
+
*/
|
|
14
|
+
import type { CapabilitySupport, HarnessId, HarnessProfile } from "./types.js";
|
|
15
|
+
export declare const ATTESTATION_SCHEMA_VERSION = 1;
|
|
16
|
+
/** Dimensions one minimal live turn can honestly establish. Everything else
|
|
17
|
+
* needs a purpose-built scenario and stays outside the record rather than
|
|
18
|
+
* being guessed at. */
|
|
19
|
+
export declare const ATTESTABLE_DIMENSIONS: readonly ["invocation", "finalResult", "sessionId", "cost"];
|
|
20
|
+
export type AttestableDimension = (typeof ATTESTABLE_DIMENSIONS)[number];
|
|
21
|
+
export interface HarnessAttestation {
|
|
22
|
+
schema_version: number;
|
|
23
|
+
harness: HarnessId;
|
|
24
|
+
/** What the vendor binary reported when this was recorded. Staleness is
|
|
25
|
+
* keyed on this, so a vendor upgrade invalidates the record automatically. */
|
|
26
|
+
binary_version: string;
|
|
27
|
+
/** Digest of the capability declaration at record time, so an edited
|
|
28
|
+
* declaration also invalidates the record. */
|
|
29
|
+
profile_digest: string;
|
|
30
|
+
observed_at: string;
|
|
31
|
+
/** Only what the probe actually saw. A dimension absent from this map was
|
|
32
|
+
* not observed, which is not the same as unsupported. */
|
|
33
|
+
observations: Partial<Record<AttestableDimension, CapabilitySupport>>;
|
|
34
|
+
/** Over every field above. A hand-edited record fails to load. */
|
|
35
|
+
record_digest: string;
|
|
36
|
+
}
|
|
37
|
+
export interface AttestationStoreOptions {
|
|
38
|
+
/** Test seam and alternate host. Defaults to the resolved coord root. */
|
|
39
|
+
coordRoot?: string;
|
|
40
|
+
}
|
|
41
|
+
export declare function attestationsDir(opts?: AttestationStoreOptions): string;
|
|
42
|
+
/** Stable identity of a declaration, so editing a claim invalidates the
|
|
43
|
+
* attestation that was recorded against the old one. */
|
|
44
|
+
export declare function profileDigest(profile: HarnessProfile): string;
|
|
45
|
+
export declare function sealAttestation(record: Omit<HarnessAttestation, "record_digest">): HarnessAttestation;
|
|
46
|
+
/** Replace-in-place write. Unlike a workflow record an attestation is meant to
|
|
47
|
+
* be re-recorded, so this is a mutable atomic swap rather than an immutable
|
|
48
|
+
* create. */
|
|
49
|
+
export declare function writeAttestation(record: HarnessAttestation, opts?: AttestationStoreOptions): string;
|
|
50
|
+
/** Null for absent, unreadable, malformed, wrong-schema, or tampered records.
|
|
51
|
+
* A record that fails its own digest is discarded rather than trusted, because
|
|
52
|
+
* the whole point of the file is that it was not hand-written. */
|
|
53
|
+
export declare function readAttestation(harness: HarnessId, opts?: AttestationStoreOptions): HarnessAttestation | null;
|
|
54
|
+
export declare function validateAttestation(value: unknown, harness?: HarnessId): HarnessAttestation | null;
|
|
55
|
+
/** An attestation speaks only for the vendor version and declaration it was
|
|
56
|
+
* recorded against. */
|
|
57
|
+
export declare function isAttestationCurrent(record: HarnessAttestation | null, binaryVersion: string | null, profile: HarnessProfile): record is HarnessAttestation;
|
|
58
|
+
export declare function listAttestations(opts?: AttestationStoreOptions): HarnessAttestation[];
|
|
59
|
+
/** Both harness-derived proof inputs, read once, for a workflow run
|
|
60
|
+
* (ADR 0038). Callers inject the result so the engine performs no capability
|
|
61
|
+
* lookups of its own. A harness with no current attestation simply has no
|
|
62
|
+
* citation; that absence is not a proof unknown. */
|
|
63
|
+
export declare function harnessProofInputs(profiles: readonly HarnessProfile[], opts: AttestationStoreOptions & {
|
|
64
|
+
versionProbe: (binary: string) => string | null;
|
|
65
|
+
}): {
|
|
66
|
+
harnessEvidence: Record<string, {
|
|
67
|
+
toolEvidence: HarnessProfile["capabilities"]["toolEvidence"];
|
|
68
|
+
}>;
|
|
69
|
+
harnessAttestations: Record<string, {
|
|
70
|
+
binary_version: string;
|
|
71
|
+
observed_at: string;
|
|
72
|
+
record_digest: string;
|
|
73
|
+
}>;
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=attestation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attestation.d.ts","sourceRoot":"","sources":["../../../src/core/harnesses/attestation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAaH,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE/E,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAE5C;;uBAEuB;AACvB,eAAO,MAAM,qBAAqB,6DAA8D,CAAC;AAEjG,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzE,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,SAAS,CAAC;IACnB;kFAC8E;IAC9E,cAAc,EAAE,MAAM,CAAC;IACvB;kDAC8C;IAC9C,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB;6DACyD;IACzD,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAC,CAAC;IACtE,kEAAkE;IAClE,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,uBAAuB;IACtC,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,eAAe,CAAC,IAAI,GAAE,uBAA4B,GAAG,MAAM,CAI1E;AAED;wDACwD;AACxD,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,CAM7D;AAMD,wBAAgB,eAAe,CAC7B,MAAM,EAAE,IAAI,CAAC,kBAAkB,EAAE,eAAe,CAAC,GAChD,kBAAkB,CAEpB;AASD;;aAEa;AACb,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,kBAAkB,EAC1B,IAAI,GAAE,uBAA4B,GACjC,MAAM,CAmBR;AAED;;kEAEkE;AAClE,wBAAgB,eAAe,CAC7B,OAAO,EAAE,SAAS,EAClB,IAAI,GAAE,uBAA4B,GACjC,kBAAkB,GAAG,IAAI,CAc3B;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,SAAS,GAClB,kBAAkB,GAAG,IAAI,CAe3B;AAED;uBACuB;AACvB,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,kBAAkB,GAAG,IAAI,EACjC,aAAa,EAAE,MAAM,GAAG,IAAI,EAC5B,OAAO,EAAE,cAAc,GACtB,MAAM,IAAI,kBAAkB,CAI9B;AAED,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,uBAA4B,GAAG,kBAAkB,EAAE,CAczF;AAED;;;oDAGoD;AACpD,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,SAAS,cAAc,EAAE,EACnC,IAAI,EAAE,uBAAuB,GAAG;IAC9B,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;CACjD,GACA;IACD,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,YAAY,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC,cAAc,CAAC,CAAA;KAAE,CAAC,CAAC;IAClG,mBAAmB,EAAE,MAAM,CACzB,MAAM,EACN;QAAE,cAAc,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CACvE,CAAC;CACH,CA2BA"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable record of what an installed vendor CLI was actually observed doing
|
|
3
|
+
* (ADR 0038).
|
|
4
|
+
*
|
|
5
|
+
* The conformance bench proves Harnery's own planner and normalizer against a
|
|
6
|
+
* committed fixture. That is an adapter check, not a vendor check
|
|
7
|
+
* (ADR 0037). An attestation is the other half: one bounded live turn, its
|
|
8
|
+
* observations, and the vendor version they were observed on.
|
|
9
|
+
*
|
|
10
|
+
* A record stores structural facts only. No prompt text, no completion text,
|
|
11
|
+
* no host paths. It lives under the host's coordination directory and is never
|
|
12
|
+
* published.
|
|
13
|
+
*/
|
|
14
|
+
import { mkdirSync, readdirSync, readFileSync, renameSync, unlinkSync, writeFileSync, } from "node:fs";
|
|
15
|
+
import { resolve } from "node:path";
|
|
16
|
+
import { monorepoRoot } from "../agents/coord-client.js";
|
|
17
|
+
import { stableDigest } from "../workflow/durable-record.js";
|
|
18
|
+
export const ATTESTATION_SCHEMA_VERSION = 1;
|
|
19
|
+
/** Dimensions one minimal live turn can honestly establish. Everything else
|
|
20
|
+
* needs a purpose-built scenario and stays outside the record rather than
|
|
21
|
+
* being guessed at. */
|
|
22
|
+
export const ATTESTABLE_DIMENSIONS = ["invocation", "finalResult", "sessionId", "cost"];
|
|
23
|
+
export function attestationsDir(opts = {}) {
|
|
24
|
+
const root = opts.coordRoot ?? monorepoRoot();
|
|
25
|
+
if (!root)
|
|
26
|
+
throw new Error("Not in a coord-aware repo (coord root resolved to null).");
|
|
27
|
+
return resolve(root, ".harnery", "harnesses", "attestations");
|
|
28
|
+
}
|
|
29
|
+
/** Stable identity of a declaration, so editing a claim invalidates the
|
|
30
|
+
* attestation that was recorded against the old one. */
|
|
31
|
+
export function profileDigest(profile) {
|
|
32
|
+
return stableDigest({
|
|
33
|
+
id: profile.id,
|
|
34
|
+
binary: profile.binary,
|
|
35
|
+
capabilities: profile.capabilities,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function digestOf(record) {
|
|
39
|
+
return stableDigest(record);
|
|
40
|
+
}
|
|
41
|
+
export function sealAttestation(record) {
|
|
42
|
+
return { ...record, record_digest: digestOf(record) };
|
|
43
|
+
}
|
|
44
|
+
function attestationPath(harness, opts) {
|
|
45
|
+
if (!/^[a-z0-9][a-z0-9._-]*$/i.test(harness)) {
|
|
46
|
+
throw new Error(`unsafe harness id for an attestation path: ${harness}`);
|
|
47
|
+
}
|
|
48
|
+
return resolve(attestationsDir(opts), `${harness}.json`);
|
|
49
|
+
}
|
|
50
|
+
/** Replace-in-place write. Unlike a workflow record an attestation is meant to
|
|
51
|
+
* be re-recorded, so this is a mutable atomic swap rather than an immutable
|
|
52
|
+
* create. */
|
|
53
|
+
export function writeAttestation(record, opts = {}) {
|
|
54
|
+
const path = attestationPath(record.harness, opts);
|
|
55
|
+
mkdirSync(attestationsDir(opts), { recursive: true, mode: 0o700 });
|
|
56
|
+
const temporary = `${path}.tmp-${process.pid}`;
|
|
57
|
+
try {
|
|
58
|
+
writeFileSync(temporary, `${JSON.stringify(record, null, 2)}\n`, {
|
|
59
|
+
encoding: "utf8",
|
|
60
|
+
mode: 0o600,
|
|
61
|
+
});
|
|
62
|
+
renameSync(temporary, path);
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
try {
|
|
66
|
+
unlinkSync(temporary);
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
// The temp file may never have been created; the original error wins.
|
|
70
|
+
}
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
return path;
|
|
74
|
+
}
|
|
75
|
+
/** Null for absent, unreadable, malformed, wrong-schema, or tampered records.
|
|
76
|
+
* A record that fails its own digest is discarded rather than trusted, because
|
|
77
|
+
* the whole point of the file is that it was not hand-written. */
|
|
78
|
+
export function readAttestation(harness, opts = {}) {
|
|
79
|
+
let raw;
|
|
80
|
+
try {
|
|
81
|
+
raw = readFileSync(attestationPath(harness, opts), "utf8");
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
let parsed;
|
|
87
|
+
try {
|
|
88
|
+
parsed = JSON.parse(raw);
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
return validateAttestation(parsed, harness);
|
|
94
|
+
}
|
|
95
|
+
export function validateAttestation(value, harness) {
|
|
96
|
+
if (!value || typeof value !== "object")
|
|
97
|
+
return null;
|
|
98
|
+
const record = value;
|
|
99
|
+
if (record.schema_version !== ATTESTATION_SCHEMA_VERSION)
|
|
100
|
+
return null;
|
|
101
|
+
if (typeof record.harness !== "string" || (harness && record.harness !== harness))
|
|
102
|
+
return null;
|
|
103
|
+
if (typeof record.binary_version !== "string" || typeof record.profile_digest !== "string") {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
if (typeof record.observed_at !== "string" || typeof record.record_digest !== "string")
|
|
107
|
+
return null;
|
|
108
|
+
if (!record.observations || typeof record.observations !== "object")
|
|
109
|
+
return null;
|
|
110
|
+
const { record_digest, ...body } = record;
|
|
111
|
+
if (digestOf(body) !== record_digest)
|
|
112
|
+
return null;
|
|
113
|
+
return record;
|
|
114
|
+
}
|
|
115
|
+
/** An attestation speaks only for the vendor version and declaration it was
|
|
116
|
+
* recorded against. */
|
|
117
|
+
export function isAttestationCurrent(record, binaryVersion, profile) {
|
|
118
|
+
if (!record || !binaryVersion)
|
|
119
|
+
return false;
|
|
120
|
+
if (record.binary_version !== binaryVersion)
|
|
121
|
+
return false;
|
|
122
|
+
return record.profile_digest === profileDigest(profile);
|
|
123
|
+
}
|
|
124
|
+
export function listAttestations(opts = {}) {
|
|
125
|
+
let names;
|
|
126
|
+
try {
|
|
127
|
+
names = readdirSync(attestationsDir(opts));
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
return [];
|
|
131
|
+
}
|
|
132
|
+
const records = [];
|
|
133
|
+
for (const name of names) {
|
|
134
|
+
if (!name.endsWith(".json"))
|
|
135
|
+
continue;
|
|
136
|
+
const record = readAttestation(name.slice(0, -".json".length), opts);
|
|
137
|
+
if (record)
|
|
138
|
+
records.push(record);
|
|
139
|
+
}
|
|
140
|
+
return records.sort((a, b) => a.harness.localeCompare(b.harness));
|
|
141
|
+
}
|
|
142
|
+
/** Both harness-derived proof inputs, read once, for a workflow run
|
|
143
|
+
* (ADR 0038). Callers inject the result so the engine performs no capability
|
|
144
|
+
* lookups of its own. A harness with no current attestation simply has no
|
|
145
|
+
* citation; that absence is not a proof unknown. */
|
|
146
|
+
export function harnessProofInputs(profiles, opts) {
|
|
147
|
+
const harnessEvidence = {};
|
|
148
|
+
const harnessAttestations = {};
|
|
149
|
+
for (const profile of profiles) {
|
|
150
|
+
harnessEvidence[profile.id] = { toolEvidence: profile.capabilities.toolEvidence };
|
|
151
|
+
let record = null;
|
|
152
|
+
try {
|
|
153
|
+
record = readAttestation(profile.id, opts);
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
// No coord root or unreadable store: run unattested rather than fail.
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
if (!isAttestationCurrent(record, opts.versionProbe(profile.binary), profile))
|
|
160
|
+
continue;
|
|
161
|
+
harnessAttestations[profile.id] = {
|
|
162
|
+
binary_version: record.binary_version,
|
|
163
|
+
observed_at: record.observed_at,
|
|
164
|
+
record_digest: record.record_digest,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
return { harnessEvidence, harnessAttestations };
|
|
168
|
+
}
|
|
@@ -1,13 +1,23 @@
|
|
|
1
|
+
import type { HarnessAttestation } from "./attestation.js";
|
|
1
2
|
import type { HarnessRegistry } from "./registry.js";
|
|
2
3
|
import type { CapabilitySupport, HarnessCapabilityDimension, HarnessId } from "./types.js";
|
|
3
4
|
export type BenchVerdict = "supported" | "partial" | "unsupported" | "not_applicable" | "unknown" | "skipped" | "drift";
|
|
4
|
-
export type BenchDimension = "registration" | "binary" | HarnessCapabilityDimension;
|
|
5
|
+
export type BenchDimension = "registration" | "binary" | "contract" | HarnessCapabilityDimension;
|
|
6
|
+
/** How a result was established (ADR 0037). Orthogonal to the verdict: this
|
|
7
|
+
* answers "how do we know", not "what is true".
|
|
8
|
+
*
|
|
9
|
+
* - `adapter`: checked against Harnery's own planner, normalizer, or fixture.
|
|
10
|
+
* Proves the adapter contract, says nothing about the installed vendor CLI.
|
|
11
|
+
* - `attested`: checked by observing the installed vendor CLI on this host.
|
|
12
|
+
* - `declared`: not checked. The value is the declaration, repeated. */
|
|
13
|
+
export type BenchBasis = "adapter" | "attested" | "declared";
|
|
5
14
|
export interface BenchResult {
|
|
6
15
|
harness: HarnessId;
|
|
7
16
|
dimension: BenchDimension;
|
|
8
17
|
declared: CapabilitySupport | "not_applicable";
|
|
9
18
|
observed: BenchVerdict;
|
|
10
19
|
verdict: BenchVerdict;
|
|
20
|
+
basis: BenchBasis;
|
|
11
21
|
note?: string;
|
|
12
22
|
}
|
|
13
23
|
export interface HarnessBenchReport {
|
|
@@ -16,6 +26,9 @@ export interface HarnessBenchReport {
|
|
|
16
26
|
harnesses: HarnessId[];
|
|
17
27
|
results: BenchResult[];
|
|
18
28
|
summary: Record<BenchVerdict, number>;
|
|
29
|
+
/** Result counts per basis, so a caller can tell a clean report from an
|
|
30
|
+
* unmeasured one without walking every result. */
|
|
31
|
+
basisSummary: Record<BenchBasis, number>;
|
|
19
32
|
drift: boolean;
|
|
20
33
|
skipped: boolean;
|
|
21
34
|
}
|
|
@@ -24,6 +37,15 @@ export interface HarnessBenchOptions {
|
|
|
24
37
|
dimensions?: readonly HarnessCapabilityDimension[];
|
|
25
38
|
/** Test seam and alternate host probe. A null version means unavailable. */
|
|
26
39
|
versionProbe?: (binary: string) => string | null;
|
|
40
|
+
/** Where to look for live attestations (ADR 0038). Defaults to the coord
|
|
41
|
+
* root. Reading them never runs a model turn. */
|
|
42
|
+
coordRoot?: string;
|
|
43
|
+
/** Test seam. Defaults to reading the attestation store. */
|
|
44
|
+
attestationReader?: (harness: HarnessId) => HarnessAttestation | null;
|
|
27
45
|
}
|
|
28
46
|
export declare function runHarnessBench(registry: HarnessRegistry, opts?: HarnessBenchOptions): HarnessBenchReport;
|
|
47
|
+
/** Ask an installed vendor CLI what version it is. Null when it is absent or
|
|
48
|
+
* refuses to answer. Shared with the live attestation probe so both halves of
|
|
49
|
+
* the capability story key on the same string. */
|
|
50
|
+
export declare function probeBinaryVersion(binary: string): string | null;
|
|
29
51
|
//# sourceMappingURL=bench.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bench.d.ts","sourceRoot":"","sources":["../../../src/core/harnesses/bench.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EACV,iBAAiB,EAEjB,0BAA0B,EAC1B,SAAS,EACV,MAAM,YAAY,CAAC;AAGpB,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,SAAS,GACT,aAAa,GACb,gBAAgB,GAChB,SAAS,GACT,SAAS,GACT,OAAO,CAAC;AAEZ,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,QAAQ,GAAG,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"bench.d.ts","sourceRoot":"","sources":["../../../src/core/harnesses/bench.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAuB,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEhF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EACV,iBAAiB,EAEjB,0BAA0B,EAC1B,SAAS,EACV,MAAM,YAAY,CAAC;AAGpB,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,SAAS,GACT,aAAa,GACb,gBAAgB,GAChB,SAAS,GACT,SAAS,GACT,OAAO,CAAC;AAEZ,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,QAAQ,GAAG,UAAU,GAAG,0BAA0B,CAAC;AAEjG;;;;;;wEAMwE;AACxE,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAE7D,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,SAAS,CAAC;IACnB,SAAS,EAAE,cAAc,CAAC;IAC1B,QAAQ,EAAE,iBAAiB,GAAG,gBAAgB,CAAC;IAC/C,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,YAAY,CAAC;IACtB,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,SAAS,EAAE,CAAC;IACvB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IACtC;sDACkD;IAClD,YAAY,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACzC,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,UAAU,CAAC,EAAE,SAAS,0BAA0B,EAAE,CAAC;IACnD,4EAA4E;IAC5E,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IACjD;qDACiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,KAAK,kBAAkB,GAAG,IAAI,CAAC;CACvE;AAgDD,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,eAAe,EACzB,IAAI,GAAE,mBAAwB,GAC7B,kBAAkB,CAwEpB;AA2KD;;kDAEkD;AAClD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIhE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
2
|
import { HARNESS_SPECS } from "../hooks/harness/events.js";
|
|
3
|
+
import { isAttestationCurrent, readAttestation } from "./attestation.js";
|
|
3
4
|
import { HARNESS_CAPABILITY_DIMENSIONS } from "./types.js";
|
|
4
5
|
const EMPTY_SUMMARY = {
|
|
5
6
|
supported: 0,
|
|
@@ -10,12 +11,42 @@ const EMPTY_SUMMARY = {
|
|
|
10
11
|
skipped: 0,
|
|
11
12
|
drift: 0,
|
|
12
13
|
};
|
|
14
|
+
const EMPTY_BASIS_SUMMARY = {
|
|
15
|
+
adapter: 0,
|
|
16
|
+
attested: 0,
|
|
17
|
+
declared: 0,
|
|
18
|
+
};
|
|
19
|
+
/** A stored attestation only counts when it still matches the installed
|
|
20
|
+
* version and the current declaration. A stale one is ignored rather than
|
|
21
|
+
* trusted, so an upgraded vendor CLI silently drops back to adapter basis. */
|
|
22
|
+
function loadAttestation(id, version, adapter, opts) {
|
|
23
|
+
let record = null;
|
|
24
|
+
try {
|
|
25
|
+
record = opts.attestationReader
|
|
26
|
+
? opts.attestationReader(id)
|
|
27
|
+
: readAttestation(id, { coordRoot: opts.coordRoot });
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// No coord root, unreadable store: the bench still runs, just unattested.
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return isAttestationCurrent(record, version, adapter.profile) ? record : null;
|
|
34
|
+
}
|
|
35
|
+
/** First version-shaped token in a string, or null when there is none.
|
|
36
|
+
* Tolerates the vendor prefixes and suffixes real CLIs print, so
|
|
37
|
+
* `codex-cli 0.144.5` and `2.1.197 (Claude Code)` both reduce to a token. */
|
|
38
|
+
function versionToken(value) {
|
|
39
|
+
if (!value)
|
|
40
|
+
return null;
|
|
41
|
+
const match = value.match(/\d+(?:\.\d+)+(?:[-.][0-9a-z]+)*/i);
|
|
42
|
+
return match ? match[0].toLowerCase() : null;
|
|
43
|
+
}
|
|
13
44
|
export function runHarnessBench(registry, opts = {}) {
|
|
14
45
|
const ids = opts.harnesses?.length ? [...opts.harnesses] : registry.ids();
|
|
15
46
|
const dimensions = opts.dimensions?.length
|
|
16
47
|
? [...new Set(opts.dimensions)]
|
|
17
48
|
: [...HARNESS_CAPABILITY_DIMENSIONS];
|
|
18
|
-
const versionProbe = opts.versionProbe ??
|
|
49
|
+
const versionProbe = opts.versionProbe ?? probeBinaryVersion;
|
|
19
50
|
const results = [];
|
|
20
51
|
for (const id of ids) {
|
|
21
52
|
const adapter = registry.require(id);
|
|
@@ -25,6 +56,7 @@ export function runHarnessBench(registry, opts = {}) {
|
|
|
25
56
|
declared: "supported",
|
|
26
57
|
observed: "supported",
|
|
27
58
|
verdict: "supported",
|
|
59
|
+
basis: "adapter",
|
|
28
60
|
note: `${adapter.profile.integrationMode}; ${adapter.profile.authModel}`,
|
|
29
61
|
});
|
|
30
62
|
const version = versionProbe(adapter.profile.binary);
|
|
@@ -34,35 +66,105 @@ export function runHarnessBench(registry, opts = {}) {
|
|
|
34
66
|
declared: "supported",
|
|
35
67
|
observed: version ? "supported" : "skipped",
|
|
36
68
|
verdict: version ? "supported" : "skipped",
|
|
69
|
+
// A skip establishes nothing about the vendor, so it is not an attestation.
|
|
70
|
+
basis: version ? "attested" : "declared",
|
|
37
71
|
note: version ?? `${adapter.profile.binary} not found on PATH`,
|
|
38
72
|
});
|
|
73
|
+
results.push(contractResult(id, adapter, version));
|
|
39
74
|
const observations = observeAdapter(adapter);
|
|
75
|
+
const attestation = loadAttestation(id, version, adapter, opts);
|
|
40
76
|
for (const dimension of dimensions) {
|
|
41
77
|
const claim = adapter.profile.capabilities[dimension];
|
|
42
|
-
const
|
|
78
|
+
const live = attestation?.observations[dimension];
|
|
79
|
+
// A live observation of the installed CLI outranks a fixture check of
|
|
80
|
+
// Harnery's own normalizer. Everything else keeps its adapter basis.
|
|
81
|
+
const { observed, basis } = live
|
|
82
|
+
? { observed: live, basis: "attested" }
|
|
83
|
+
: observations[dimension];
|
|
43
84
|
results.push({
|
|
44
85
|
harness: id,
|
|
45
86
|
dimension,
|
|
46
87
|
declared: claim.support,
|
|
47
88
|
observed,
|
|
48
89
|
verdict: reconcile(claim.support, observed),
|
|
49
|
-
|
|
90
|
+
basis,
|
|
91
|
+
note: live ? `attested on ${attestation?.binary_version}` : claim.note,
|
|
50
92
|
});
|
|
51
93
|
}
|
|
52
94
|
}
|
|
53
95
|
const summary = { ...EMPTY_SUMMARY };
|
|
54
|
-
|
|
96
|
+
const basisSummary = { ...EMPTY_BASIS_SUMMARY };
|
|
97
|
+
for (const result of results) {
|
|
55
98
|
summary[result.verdict]++;
|
|
99
|
+
basisSummary[result.basis]++;
|
|
100
|
+
}
|
|
56
101
|
return {
|
|
57
102
|
generatedAt: new Date().toISOString(),
|
|
58
103
|
mode: "offline",
|
|
59
104
|
harnesses: ids,
|
|
60
105
|
results,
|
|
61
106
|
summary,
|
|
107
|
+
basisSummary,
|
|
62
108
|
drift: summary.drift > 0,
|
|
63
109
|
skipped: summary.skipped > 0,
|
|
64
110
|
};
|
|
65
111
|
}
|
|
112
|
+
/** Compare the vendor contract a declaration was validated against with the
|
|
113
|
+
* one actually installed (ADR 0037). This is the only dimension attested
|
|
114
|
+
* without a model turn, because a version string costs nothing to read.
|
|
115
|
+
*
|
|
116
|
+
* A mismatch is `drift`, not failure: a newer vendor CLI is not automatically
|
|
117
|
+
* broken, but the declaration is no longer backed by an observation. An
|
|
118
|
+
* unrecorded or unparseable declared version stays `unknown` rather than being
|
|
119
|
+
* inferred from the installed one. */
|
|
120
|
+
function contractResult(id, adapter, version) {
|
|
121
|
+
const recorded = adapter.profile.verified;
|
|
122
|
+
const base = { harness: id, dimension: "contract", declared: "supported" };
|
|
123
|
+
if (!version) {
|
|
124
|
+
return {
|
|
125
|
+
...base,
|
|
126
|
+
observed: "skipped",
|
|
127
|
+
verdict: "skipped",
|
|
128
|
+
basis: "declared",
|
|
129
|
+
note: `${adapter.profile.binary} not found on PATH; installed contract unobservable`,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
const declaredToken = versionToken(recorded?.version);
|
|
133
|
+
if (!declaredToken) {
|
|
134
|
+
return {
|
|
135
|
+
...base,
|
|
136
|
+
observed: "unknown",
|
|
137
|
+
verdict: "unknown",
|
|
138
|
+
basis: "declared",
|
|
139
|
+
note: recorded
|
|
140
|
+
? `verified.version "${recorded.version}" is not a version; installed ${version}`
|
|
141
|
+
: `no verified vendor contract recorded; installed ${version}`,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
const installedToken = versionToken(version) ?? version.trim().toLowerCase();
|
|
145
|
+
if (installedToken === declaredToken) {
|
|
146
|
+
return {
|
|
147
|
+
...base,
|
|
148
|
+
observed: "supported",
|
|
149
|
+
verdict: "supported",
|
|
150
|
+
basis: "attested",
|
|
151
|
+
note: `declaration validated against ${recorded?.version} on ${recorded?.date}`,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
return {
|
|
155
|
+
...base,
|
|
156
|
+
observed: "drift",
|
|
157
|
+
verdict: "drift",
|
|
158
|
+
basis: "attested",
|
|
159
|
+
note: `declaration validated against ${recorded?.version} (${recorded?.date}); installed ${version}`,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/** Checked against Harnery's planner, normalizer, or fixture. */
|
|
163
|
+
function fromAdapter(observed) {
|
|
164
|
+
return { observed, basis: "adapter" };
|
|
165
|
+
}
|
|
166
|
+
/** No check exists for this dimension yet. */
|
|
167
|
+
const NOT_CHECKED = { observed: "unknown", basis: "declared" };
|
|
66
168
|
function observeAdapter(adapter) {
|
|
67
169
|
const profile = adapter.profile;
|
|
68
170
|
const effort = profile.effortValues[0];
|
|
@@ -98,43 +200,41 @@ function observeAdapter(adapter) {
|
|
|
98
200
|
: undefined;
|
|
99
201
|
const hookSubcommands = new Set(hookSpec?.events.map((event) => event.subcommand) ?? []);
|
|
100
202
|
return {
|
|
101
|
-
invocation: !planningFailed && argv[0] === profile.binary && argv.includes(request.prompt)
|
|
203
|
+
invocation: fromAdapter(!planningFailed && argv[0] === profile.binary && argv.includes(request.prompt)
|
|
102
204
|
? "supported"
|
|
103
|
-
: "unsupported",
|
|
104
|
-
modelSelection: !planningFailed && argv.includes(request.model ?? "") ? "supported" : "unsupported",
|
|
105
|
-
effortSelection: effort === undefined
|
|
205
|
+
: "unsupported"),
|
|
206
|
+
modelSelection: fromAdapter(!planningFailed && argv.includes(request.model ?? "") ? "supported" : "unsupported"),
|
|
207
|
+
effortSelection: fromAdapter(effort === undefined
|
|
106
208
|
? "unsupported"
|
|
107
209
|
: !planningFailed && argv.some((arg) => arg.includes(effort))
|
|
108
210
|
? "supported"
|
|
109
|
-
: "unsupported",
|
|
110
|
-
maxTurns: !planningFailed && argv.includes(String(request.maxTurns)) ? "supported" : "unsupported",
|
|
111
|
-
finalResult: finalMatches ? "supported" : "unsupported",
|
|
112
|
-
sessionId: sessionObserved === "supported" && normalized?.sessionId !== fixture.sessionId
|
|
211
|
+
: "unsupported"),
|
|
212
|
+
maxTurns: fromAdapter(!planningFailed && argv.includes(String(request.maxTurns)) ? "supported" : "unsupported"),
|
|
213
|
+
finalResult: fromAdapter(finalMatches ? "supported" : "unsupported"),
|
|
214
|
+
sessionId: fromAdapter(sessionObserved === "supported" && normalized?.sessionId !== fixture.sessionId
|
|
113
215
|
? "unsupported"
|
|
114
|
-
: sessionObserved,
|
|
115
|
-
cost: costObserved === "supported" && normalized?.costUsd !== fixture.costUsd
|
|
216
|
+
: sessionObserved),
|
|
217
|
+
cost: fromAdapter(costObserved === "supported" && normalized?.costUsd !== fixture.costUsd
|
|
116
218
|
? "unsupported"
|
|
117
|
-
: costObserved,
|
|
118
|
-
toolEvidence: normalized && "toolEvidence" in normalized ? "supported" : "unsupported",
|
|
119
|
-
policyMapping:
|
|
120
|
-
interruption:
|
|
121
|
-
streaming:
|
|
122
|
-
steering:
|
|
123
|
-
resume:
|
|
124
|
-
images:
|
|
125
|
-
contextTelemetry:
|
|
219
|
+
: costObserved),
|
|
220
|
+
toolEvidence: fromAdapter(normalized && "toolEvidence" in normalized ? "supported" : "unsupported"),
|
|
221
|
+
policyMapping: NOT_CHECKED,
|
|
222
|
+
interruption: NOT_CHECKED,
|
|
223
|
+
streaming: NOT_CHECKED,
|
|
224
|
+
steering: NOT_CHECKED,
|
|
225
|
+
resume: NOT_CHECKED,
|
|
226
|
+
images: NOT_CHECKED,
|
|
227
|
+
contextTelemetry: NOT_CHECKED,
|
|
126
228
|
preCompactionSignal: hookSpec
|
|
127
|
-
? hookSubcommands.has("pre-compact")
|
|
128
|
-
|
|
129
|
-
: "unsupported"
|
|
130
|
-
: "unknown",
|
|
229
|
+
? fromAdapter(hookSubcommands.has("pre-compact") ? "supported" : "unsupported")
|
|
230
|
+
: NOT_CHECKED,
|
|
131
231
|
postCompactionSignal: hookSpec
|
|
132
|
-
? hookSubcommands.has("post-compact") ||
|
|
232
|
+
? fromAdapter(hookSubcommands.has("post-compact") ||
|
|
133
233
|
(adapter.profile.id === "claude-code" && hookSubcommands.has("session-start"))
|
|
134
234
|
? "supported"
|
|
135
|
-
: "unsupported"
|
|
136
|
-
:
|
|
137
|
-
compaction:
|
|
235
|
+
: "unsupported")
|
|
236
|
+
: NOT_CHECKED,
|
|
237
|
+
compaction: NOT_CHECKED,
|
|
138
238
|
};
|
|
139
239
|
}
|
|
140
240
|
function reconcile(declared, observed) {
|
|
@@ -143,7 +243,10 @@ function reconcile(declared, observed) {
|
|
|
143
243
|
}
|
|
144
244
|
return declared === observed ? observed : "drift";
|
|
145
245
|
}
|
|
146
|
-
|
|
246
|
+
/** Ask an installed vendor CLI what version it is. Null when it is absent or
|
|
247
|
+
* refuses to answer. Shared with the live attestation probe so both halves of
|
|
248
|
+
* the capability story key on the same string. */
|
|
249
|
+
export function probeBinaryVersion(binary) {
|
|
147
250
|
const result = spawnSync(binary, ["--version"], { encoding: "utf8", timeout: 5_000 });
|
|
148
251
|
if (result.error || result.status !== 0)
|
|
149
252
|
return null;
|