@itsthelore/proofkeeper 2026.6.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/LICENSE +201 -0
- package/NOTICE +10 -0
- package/README.md +207 -0
- package/dist/agent/adapters/claude.d.ts +93 -0
- package/dist/agent/adapters/claude.d.ts.map +1 -0
- package/dist/agent/adapters/claude.js +96 -0
- package/dist/agent/adapters/claude.js.map +1 -0
- package/dist/agent/drive.d.ts +53 -0
- package/dist/agent/drive.d.ts.map +1 -0
- package/dist/agent/drive.js +194 -0
- package/dist/agent/drive.js.map +1 -0
- package/dist/agent/loop.d.ts +40 -0
- package/dist/agent/loop.d.ts.map +1 -0
- package/dist/agent/loop.js +29 -0
- package/dist/agent/loop.js.map +1 -0
- package/dist/agent/model.d.ts +43 -0
- package/dist/agent/model.d.ts.map +1 -0
- package/dist/agent/model.js +10 -0
- package/dist/agent/model.js.map +1 -0
- package/dist/agent/observe.d.ts +48 -0
- package/dist/agent/observe.d.ts.map +1 -0
- package/dist/agent/observe.js +65 -0
- package/dist/agent/observe.js.map +1 -0
- package/dist/agent/tools.d.ts +74 -0
- package/dist/agent/tools.d.ts.map +1 -0
- package/dist/agent/tools.js +257 -0
- package/dist/agent/tools.js.map +1 -0
- package/dist/cli.d.ts +61 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +648 -0
- package/dist/cli.js.map +1 -0
- package/dist/compiler/actions.d.ts +101 -0
- package/dist/compiler/actions.d.ts.map +1 -0
- package/dist/compiler/actions.js +13 -0
- package/dist/compiler/actions.js.map +1 -0
- package/dist/compiler/compiler.d.ts +25 -0
- package/dist/compiler/compiler.d.ts.map +1 -0
- package/dist/compiler/compiler.js +42 -0
- package/dist/compiler/compiler.js.map +1 -0
- package/dist/compiler/emit.d.ts +21 -0
- package/dist/compiler/emit.d.ts.map +1 -0
- package/dist/compiler/emit.js +164 -0
- package/dist/compiler/emit.js.map +1 -0
- package/dist/compiler/http.d.ts +30 -0
- package/dist/compiler/http.d.ts.map +1 -0
- package/dist/compiler/http.js +30 -0
- package/dist/compiler/http.js.map +1 -0
- package/dist/compiler/recorder.d.ts +62 -0
- package/dist/compiler/recorder.d.ts.map +1 -0
- package/dist/compiler/recorder.js +148 -0
- package/dist/compiler/recorder.js.map +1 -0
- package/dist/compiler/summary.d.ts +11 -0
- package/dist/compiler/summary.d.ts.map +1 -0
- package/dist/compiler/summary.js +56 -0
- package/dist/compiler/summary.js.map +1 -0
- package/dist/compiler/terminal.d.ts +42 -0
- package/dist/compiler/terminal.d.ts.map +1 -0
- package/dist/compiler/terminal.js +47 -0
- package/dist/compiler/terminal.js.map +1 -0
- package/dist/compiler/types.d.ts +25 -0
- package/dist/compiler/types.d.ts.map +1 -0
- package/dist/compiler/types.js +10 -0
- package/dist/compiler/types.js.map +1 -0
- package/dist/coverage/graph.d.ts +55 -0
- package/dist/coverage/graph.d.ts.map +1 -0
- package/dist/coverage/graph.js +87 -0
- package/dist/coverage/graph.js.map +1 -0
- package/dist/coverage/model.d.ts +36 -0
- package/dist/coverage/model.d.ts.map +1 -0
- package/dist/coverage/model.js +57 -0
- package/dist/coverage/model.js.map +1 -0
- package/dist/coverage/report.d.ts +27 -0
- package/dist/coverage/report.d.ts.map +1 -0
- package/dist/coverage/report.js +45 -0
- package/dist/coverage/report.js.map +1 -0
- package/dist/coverage/source.d.ts +23 -0
- package/dist/coverage/source.d.ts.map +1 -0
- package/dist/coverage/source.js +48 -0
- package/dist/coverage/source.js.map +1 -0
- package/dist/fidelity/gate.d.ts +34 -0
- package/dist/fidelity/gate.d.ts.map +1 -0
- package/dist/fidelity/gate.js +38 -0
- package/dist/fidelity/gate.js.map +1 -0
- package/dist/index.d.ts +69 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/learning/store.d.ts +44 -0
- package/dist/learning/store.d.ts.map +1 -0
- package/dist/learning/store.js +64 -0
- package/dist/learning/store.js.map +1 -0
- package/dist/qa/concurrency.d.ts +7 -0
- package/dist/qa/concurrency.d.ts.map +1 -0
- package/dist/qa/concurrency.js +21 -0
- package/dist/qa/concurrency.js.map +1 -0
- package/dist/qa/run-qa.d.ts +87 -0
- package/dist/qa/run-qa.d.ts.map +1 -0
- package/dist/qa/run-qa.js +106 -0
- package/dist/qa/run-qa.js.map +1 -0
- package/dist/qa/run-scoped.d.ts +82 -0
- package/dist/qa/run-scoped.d.ts.map +1 -0
- package/dist/qa/run-scoped.js +96 -0
- package/dist/qa/run-scoped.js.map +1 -0
- package/dist/runner/playwright-report.d.ts +52 -0
- package/dist/runner/playwright-report.d.ts.map +1 -0
- package/dist/runner/playwright-report.js +90 -0
- package/dist/runner/playwright-report.js.map +1 -0
- package/dist/runner/playwright-runner.d.ts +38 -0
- package/dist/runner/playwright-runner.d.ts.map +1 -0
- package/dist/runner/playwright-runner.js +73 -0
- package/dist/runner/playwright-runner.js.map +1 -0
- package/dist/runner/types.d.ts +45 -0
- package/dist/runner/types.d.ts.map +1 -0
- package/dist/runner/types.js +10 -0
- package/dist/runner/types.js.map +1 -0
- package/dist/scaffold/scaffold.d.ts +22 -0
- package/dist/scaffold/scaffold.d.ts.map +1 -0
- package/dist/scaffold/scaffold.js +34 -0
- package/dist/scaffold/scaffold.js.map +1 -0
- package/dist/scope/config.d.ts +89 -0
- package/dist/scope/config.d.ts.map +1 -0
- package/dist/scope/config.js +172 -0
- package/dist/scope/config.js.map +1 -0
- package/dist/scope/diff-scope.d.ts +31 -0
- package/dist/scope/diff-scope.d.ts.map +1 -0
- package/dist/scope/diff-scope.js +42 -0
- package/dist/scope/diff-scope.js.map +1 -0
- package/dist/scope/glob.d.ts +17 -0
- package/dist/scope/glob.d.ts.map +1 -0
- package/dist/scope/glob.js +50 -0
- package/dist/scope/glob.js.map +1 -0
- package/dist/writeback/comment.d.ts +103 -0
- package/dist/writeback/comment.d.ts.map +1 -0
- package/dist/writeback/comment.js +150 -0
- package/dist/writeback/comment.js.map +1 -0
- package/dist/writeback/gateways/github-rest.d.ts +66 -0
- package/dist/writeback/gateways/github-rest.d.ts.map +1 -0
- package/dist/writeback/gateways/github-rest.js +107 -0
- package/dist/writeback/gateways/github-rest.js.map +1 -0
- package/dist/writeback/merge.d.ts +27 -0
- package/dist/writeback/merge.d.ts.map +1 -0
- package/dist/writeback/merge.js +89 -0
- package/dist/writeback/merge.js.map +1 -0
- package/dist/writeback/proposal.d.ts +52 -0
- package/dist/writeback/proposal.d.ts.map +1 -0
- package/dist/writeback/proposal.js +79 -0
- package/dist/writeback/proposal.js.map +1 -0
- package/dist/writeback/proposer.d.ts +94 -0
- package/dist/writeback/proposer.d.ts.map +1 -0
- package/dist/writeback/proposer.js +79 -0
- package/dist/writeback/proposer.js.map +1 -0
- package/dist/writeback/verified-by.d.ts +56 -0
- package/dist/writeback/verified-by.d.ts.map +1 -0
- package/dist/writeback/verified-by.js +60 -0
- package/dist/writeback/verified-by.js.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rendering for the coverage read-model: a human table and a stable JSON
|
|
3
|
+
* contract. Both are pure — given a {@link CoverageReport} they return a
|
|
4
|
+
* string; the CLI owns writing it out.
|
|
5
|
+
*/
|
|
6
|
+
import type { CoverageReport } from "./model.js";
|
|
7
|
+
/** Stable machine contract for `proofkeeper coverage --json`. */
|
|
8
|
+
export interface CoverageJson {
|
|
9
|
+
schema_version: "1";
|
|
10
|
+
source: string;
|
|
11
|
+
total: number;
|
|
12
|
+
verified: number;
|
|
13
|
+
unverified: {
|
|
14
|
+
id: string;
|
|
15
|
+
title: string;
|
|
16
|
+
status: string;
|
|
17
|
+
}[];
|
|
18
|
+
verifiedDetail: {
|
|
19
|
+
id: string;
|
|
20
|
+
targets: string[];
|
|
21
|
+
}[];
|
|
22
|
+
}
|
|
23
|
+
export declare function toJson(report: CoverageReport): CoverageJson;
|
|
24
|
+
export declare function renderJson(report: CoverageReport): string;
|
|
25
|
+
/** A compact, human-readable coverage summary with a table of gaps. */
|
|
26
|
+
export declare function renderHuman(report: CoverageReport): string;
|
|
27
|
+
//# sourceMappingURL=report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/coverage/report.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,iEAAiE;AACjE,MAAM,WAAW,YAAY;IAC3B,cAAc,EAAE,GAAG,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5D,cAAc,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;CACrD;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,YAAY,CAS3D;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAEzD;AAED,uEAAuE;AACvE,wBAAgB,WAAW,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CA4B1D"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rendering for the coverage read-model: a human table and a stable JSON
|
|
3
|
+
* contract. Both are pure — given a {@link CoverageReport} they return a
|
|
4
|
+
* string; the CLI owns writing it out.
|
|
5
|
+
*/
|
|
6
|
+
export function toJson(report) {
|
|
7
|
+
return {
|
|
8
|
+
schema_version: "1",
|
|
9
|
+
source: report.source,
|
|
10
|
+
total: report.total,
|
|
11
|
+
verified: report.verified.length,
|
|
12
|
+
unverified: report.unverified.map(({ id, title, status }) => ({ id, title, status })),
|
|
13
|
+
verifiedDetail: report.verified.map((c) => ({ id: c.id, targets: c.verifiedBy })),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function renderJson(report) {
|
|
17
|
+
return JSON.stringify(toJson(report), null, 2);
|
|
18
|
+
}
|
|
19
|
+
/** A compact, human-readable coverage summary with a table of gaps. */
|
|
20
|
+
export function renderHuman(report) {
|
|
21
|
+
const lines = [];
|
|
22
|
+
const src = report.source ? ` (${report.source})` : "";
|
|
23
|
+
const verified = report.verified.length;
|
|
24
|
+
const unverified = report.unverified.length;
|
|
25
|
+
lines.push(`Proofkeeper coverage${src}`);
|
|
26
|
+
if (report.total === 0) {
|
|
27
|
+
lines.push("No capabilities (requirement artifacts) found in the graph.");
|
|
28
|
+
return lines.join("\n");
|
|
29
|
+
}
|
|
30
|
+
lines.push(`${verified}/${report.total} capabilities verified, ${unverified} unverified.`);
|
|
31
|
+
if (unverified > 0) {
|
|
32
|
+
lines.push("");
|
|
33
|
+
lines.push("Unverified capabilities:");
|
|
34
|
+
const idWidth = Math.max(2, ...report.unverified.map((c) => c.id.length));
|
|
35
|
+
const statusWidth = Math.max(6, ...report.unverified.map((c) => c.status.length));
|
|
36
|
+
for (const c of report.unverified) {
|
|
37
|
+
lines.push(` ${c.id.padEnd(idWidth)} ${c.status.padEnd(statusWidth)} ${c.title}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
lines.push("All capabilities have at least one verifying test.");
|
|
42
|
+
}
|
|
43
|
+
return lines.join("\n");
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/coverage/report.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH,MAAM,UAAU,MAAM,CAAC,MAAsB;IAC3C,OAAO;QACL,cAAc,EAAE,GAAG;QACnB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB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AAM,CAAC,KAAK,2BAA2B,UAAU,cAAc,CAAC,CAAC;IAE3F,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;QACnB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QACvC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QAC1E,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QAClF,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YAClC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;QACvF,CAAC;IACH,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How the coverage read-model obtains a graph export.
|
|
3
|
+
*
|
|
4
|
+
* Two source modes, both staying on the contract-consumer side of the boundary
|
|
5
|
+
* (ADR-063, ADR-083):
|
|
6
|
+
*
|
|
7
|
+
* - `--graph-file`: read a `rac export --graph` JSON file. The primary,
|
|
8
|
+
* fully-offline, fully-testable path.
|
|
9
|
+
* - `--corpus`: a convenience that shells out to `rac export --graph <dir>`
|
|
10
|
+
* when the `rac` CLI is on PATH. We consume its published JSON output — we
|
|
11
|
+
* never import the engine.
|
|
12
|
+
*/
|
|
13
|
+
import { type Graph } from "./graph.js";
|
|
14
|
+
/** Load and parse a graph export from a JSON file. */
|
|
15
|
+
export declare function loadGraphFromFile(path: string): Promise<Graph>;
|
|
16
|
+
/**
|
|
17
|
+
* Produce a graph export by invoking `rac export --graph <dir>`.
|
|
18
|
+
*
|
|
19
|
+
* Requires the `rac` CLI on PATH. We treat its stdout as the published
|
|
20
|
+
* contract and parse it exactly as we would a file.
|
|
21
|
+
*/
|
|
22
|
+
export declare function loadGraphFromCorpus(corpusDir: string, racBin?: string): Promise<Graph>;
|
|
23
|
+
//# sourceMappingURL=source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../src/coverage/source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,EAA+B,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAIrE,sDAAsD;AACtD,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAQpE;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,SAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAa3F"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How the coverage read-model obtains a graph export.
|
|
3
|
+
*
|
|
4
|
+
* Two source modes, both staying on the contract-consumer side of the boundary
|
|
5
|
+
* (ADR-063, ADR-083):
|
|
6
|
+
*
|
|
7
|
+
* - `--graph-file`: read a `rac export --graph` JSON file. The primary,
|
|
8
|
+
* fully-offline, fully-testable path.
|
|
9
|
+
* - `--corpus`: a convenience that shells out to `rac export --graph <dir>`
|
|
10
|
+
* when the `rac` CLI is on PATH. We consume its published JSON output — we
|
|
11
|
+
* never import the engine.
|
|
12
|
+
*/
|
|
13
|
+
import { execFile } from "node:child_process";
|
|
14
|
+
import { readFile } from "node:fs/promises";
|
|
15
|
+
import { promisify } from "node:util";
|
|
16
|
+
import { GraphParseError, parseGraph } from "./graph.js";
|
|
17
|
+
const execFileAsync = promisify(execFile);
|
|
18
|
+
/** Load and parse a graph export from a JSON file. */
|
|
19
|
+
export async function loadGraphFromFile(path) {
|
|
20
|
+
let text;
|
|
21
|
+
try {
|
|
22
|
+
text = await readFile(path, "utf8");
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
throw new GraphParseError(`could not read graph file '${path}': ${err.message}`);
|
|
26
|
+
}
|
|
27
|
+
return parseGraph(text);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Produce a graph export by invoking `rac export --graph <dir>`.
|
|
31
|
+
*
|
|
32
|
+
* Requires the `rac` CLI on PATH. We treat its stdout as the published
|
|
33
|
+
* contract and parse it exactly as we would a file.
|
|
34
|
+
*/
|
|
35
|
+
export async function loadGraphFromCorpus(corpusDir, racBin = "rac") {
|
|
36
|
+
let stdout;
|
|
37
|
+
try {
|
|
38
|
+
({ stdout } = await execFileAsync(racBin, ["export", corpusDir, "--graph"], {
|
|
39
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
throw new GraphParseError(`failed to run '${racBin} export ${corpusDir} --graph': ${err.message}. ` +
|
|
44
|
+
`Is the rac CLI installed and on PATH? You can also pass --graph-file directly.`);
|
|
45
|
+
}
|
|
46
|
+
return parseGraph(stdout);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.js","sourceRoot":"","sources":["../../src/coverage/source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,QAAQ,EA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ative 3 (the moat's acceptance bar).
|
|
3
|
+
*
|
|
4
|
+
* A compiled test earns trust only by surviving N re-runs green and stable.
|
|
5
|
+
* This gate has real logic: it re-runs a candidate through a {@link Runner} N
|
|
6
|
+
* times against a single target and accepts it iff every run passed. Anything
|
|
7
|
+
* less is quarantined, not committed. That stability is what lets a reviewer
|
|
8
|
+
* trust a committed test without running it locally.
|
|
9
|
+
*/
|
|
10
|
+
import type { CompiledTest, Runner, RunTarget } from "../runner/types.js";
|
|
11
|
+
export interface FidelityOptions {
|
|
12
|
+
/** How many times to re-run the candidate. */
|
|
13
|
+
n: number;
|
|
14
|
+
/** The single target to assess stability against. */
|
|
15
|
+
target: RunTarget;
|
|
16
|
+
/** Parallelism passed through to the runner per attempt. */
|
|
17
|
+
parallelism?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface FidelityVerdict {
|
|
20
|
+
testId: string;
|
|
21
|
+
/** Accepted iff all `attempts` runs passed. */
|
|
22
|
+
stable: boolean;
|
|
23
|
+
attempts: number;
|
|
24
|
+
passed: number;
|
|
25
|
+
/** Per-attempt pass/fail, in order. */
|
|
26
|
+
runs: boolean[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Assess a candidate test's fidelity by re-running it `n` times.
|
|
30
|
+
*
|
|
31
|
+
* @throws {RangeError} when `n < 1`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function assessFidelity(runner: Runner, test: CompiledTest, options: FidelityOptions): Promise<FidelityVerdict>;
|
|
34
|
+
//# sourceMappingURL=gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/fidelity/gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE1E,MAAM,WAAW,eAAe;IAC9B,8CAA8C;IAC9C,CAAC,EAAE,MAAM,CAAC;IACV,qDAAqD;IACrD,MAAM,EAAE,SAAS,CAAC;IAClB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,IAAI,EAAE,OAAO,EAAE,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,eAAe,CAAC,CAwB1B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The fidelity gate — Proofkeeper Initiative 3 (the moat's acceptance bar).
|
|
3
|
+
*
|
|
4
|
+
* A compiled test earns trust only by surviving N re-runs green and stable.
|
|
5
|
+
* This gate has real logic: it re-runs a candidate through a {@link Runner} N
|
|
6
|
+
* times against a single target and accepts it iff every run passed. Anything
|
|
7
|
+
* less is quarantined, not committed. That stability is what lets a reviewer
|
|
8
|
+
* trust a committed test without running it locally.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Assess a candidate test's fidelity by re-running it `n` times.
|
|
12
|
+
*
|
|
13
|
+
* @throws {RangeError} when `n < 1`.
|
|
14
|
+
*/
|
|
15
|
+
export async function assessFidelity(runner, test, options) {
|
|
16
|
+
if (options.n < 1) {
|
|
17
|
+
throw new RangeError(`fidelity requires at least one run, got n=${options.n}`);
|
|
18
|
+
}
|
|
19
|
+
const runs = [];
|
|
20
|
+
for (let attempt = 0; attempt < options.n; attempt++) {
|
|
21
|
+
const results = await runner.run([test], {
|
|
22
|
+
targets: [options.target],
|
|
23
|
+
parallelism: options.parallelism,
|
|
24
|
+
});
|
|
25
|
+
// One test, one target ⇒ a single result. Treat a missing result as failure.
|
|
26
|
+
const passed = results.length > 0 && results.every((r) => r.status === "passed");
|
|
27
|
+
runs.push(passed);
|
|
28
|
+
}
|
|
29
|
+
const passed = runs.filter(Boolean).length;
|
|
30
|
+
return {
|
|
31
|
+
testId: test.id,
|
|
32
|
+
stable: passed === options.n,
|
|
33
|
+
attempts: options.n,
|
|
34
|
+
passed,
|
|
35
|
+
runs,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=gate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate.js","sourceRoot":"","sources":["../../src/fidelity/gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAuBH;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAc,EACd,IAAkB,EAClB,OAAwB;IAExB,IAAI,OAAO,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;QAClB,MAAM,IAAI,UAAU,CAAC,6CAA6C,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IACjF,CAAC;IAED,MAAM,IAAI,GAAc,EAAE,CAAC;IAC3B,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC;QACrD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE;YACvC,OAAO,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;YACzB,WAAW,EAAE,OAAO,CAAC,WAAW;SACjC,CAAC,CAAC;QACH,6EAA6E;QAC7E,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC;QACjF,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpB,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;IAC3C,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,EAAE;QACf,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;QAC5B,QAAQ,EAAE,OAAO,CAAC,CAAC;QACnB,MAAM;QACN,IAAI;KACL,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public API for @itsthelore/proofkeeper.
|
|
3
|
+
*
|
|
4
|
+
* The coverage read-model is the working v0.0.1 surface; the runner, compiler,
|
|
5
|
+
* fidelity gate, agent loop, and write-back are interfaces and skeletons that
|
|
6
|
+
* fix the drive→compile→fidelity→run→write-back shape (see README scope).
|
|
7
|
+
*/
|
|
8
|
+
export { parseGraph, GraphParseError, VERIFIED_BY } from "./coverage/graph.js";
|
|
9
|
+
export type { Graph, GraphNode, GraphEdge } from "./coverage/graph.js";
|
|
10
|
+
export { computeCoverage, CAPABILITY_TYPE } from "./coverage/model.js";
|
|
11
|
+
export type { CoverageReport, CapabilityCoverage } from "./coverage/model.js";
|
|
12
|
+
export { renderHuman, renderJson, toJson } from "./coverage/report.js";
|
|
13
|
+
export type { CoverageJson } from "./coverage/report.js";
|
|
14
|
+
export { loadGraphFromFile, loadGraphFromCorpus } from "./coverage/source.js";
|
|
15
|
+
export type { Runner, RunResult, RunOptions, RunStatus, RunTarget, CompiledTest, } from "./runner/types.js";
|
|
16
|
+
export { PlaywrightRunner } from "./runner/playwright-runner.js";
|
|
17
|
+
export type { PlaywrightRunnerOptions } from "./runner/playwright-runner.js";
|
|
18
|
+
export { parseReport, reduceReport, ReportParseError } from "./runner/playwright-report.js";
|
|
19
|
+
export type { Action, Locator, RecordedSession } from "./compiler/actions.js";
|
|
20
|
+
export { emitSpec } from "./compiler/emit.js";
|
|
21
|
+
export { Recorder } from "./compiler/recorder.js";
|
|
22
|
+
export type { RecorderOptions } from "./compiler/recorder.js";
|
|
23
|
+
export type { Compiler, CandidateTest } from "./compiler/types.js";
|
|
24
|
+
export { CodegenCompiler, NotImplementedCompiler } from "./compiler/compiler.js";
|
|
25
|
+
export type { CodegenCompilerOptions } from "./compiler/compiler.js";
|
|
26
|
+
export { runCommand, evalOutputMatch } from "./compiler/terminal.js";
|
|
27
|
+
export type { CommandResult, OutputAssertion } from "./compiler/terminal.js";
|
|
28
|
+
export { httpRequest, jsonPath } from "./compiler/http.js";
|
|
29
|
+
export type { HttpResponse, HttpRequestInput, JsonScalar } from "./compiler/http.js";
|
|
30
|
+
export { summarizeSession } from "./compiler/summary.js";
|
|
31
|
+
export { FileLearningStore, InMemoryLearningStore } from "./learning/store.js";
|
|
32
|
+
export type { LearningStore, FailureRecord } from "./learning/store.js";
|
|
33
|
+
export { assessFidelity } from "./fidelity/gate.js";
|
|
34
|
+
export type { FidelityOptions, FidelityVerdict } from "./fidelity/gate.js";
|
|
35
|
+
export { runQa, selectCapability, defaultGoal } from "./qa/run-qa.js";
|
|
36
|
+
export type { QaDeps, QaOptions, QaResult } from "./qa/run-qa.js";
|
|
37
|
+
export { runScopedQa, collectFailureSuggestions, DEFAULT_SCOPED_CONCURRENCY } from "./qa/run-scoped.js";
|
|
38
|
+
export type { ScopedQaDeps, ScopedQaOptions, ScopedQaResult, ScopedCapabilityResult, FailureSuggestion } from "./qa/run-scoped.js";
|
|
39
|
+
export { mapPool } from "./qa/concurrency.js";
|
|
40
|
+
export { scopeCapabilities } from "./scope/diff-scope.js";
|
|
41
|
+
export type { ScopeResult, ScopedCapability } from "./scope/diff-scope.js";
|
|
42
|
+
export { parseConfig, ConfigParseError, resolveTarget, authContext, personaContext } from "./scope/config.js";
|
|
43
|
+
export type { ProofkeeperConfig, CapabilityConfig, EnvironmentConfig, AuthConfig, PersonaConfig, FailureLearningStrategy, ResolvedTarget, } from "./scope/config.js";
|
|
44
|
+
export { globToRegExp, matchesAnyGlob } from "./scope/glob.js";
|
|
45
|
+
export { scaffoldConfig, renderScaffoldedConfig } from "./scaffold/scaffold.js";
|
|
46
|
+
export type { ScaffoldOptions } from "./scaffold/scaffold.js";
|
|
47
|
+
export { runAgentLoop } from "./agent/loop.js";
|
|
48
|
+
export type { AgentLoopDeps, AgentLoopOptions, AgentLoopResult } from "./agent/loop.js";
|
|
49
|
+
export type { ModelClient, ModelRequest, ModelResponse, ToolCall } from "./agent/model.js";
|
|
50
|
+
export { AutonomousDriver, runDrive } from "./agent/drive.js";
|
|
51
|
+
export type { DriveOptions, DriveResult } from "./agent/drive.js";
|
|
52
|
+
export { DRIVE_TOOLS, LOCATOR_GUIDANCE, TERMINAL_GUIDANCE, HTTP_GUIDANCE, parseLocator, parseRunCommand, parseExpectOutput, parseExpectExit, parseRequest, parseExpectStatus, parseExpectJson, ToolArgumentError, } from "./agent/tools.js";
|
|
53
|
+
export type { DriveTool, RunCommandArgs, OutputAssertionArgs, RequestArgs, ExpectJsonArgs } from "./agent/tools.js";
|
|
54
|
+
export { observePage, renderObservation, createPageMonitor } from "./agent/observe.js";
|
|
55
|
+
export type { PageObservation, PageMonitor } from "./agent/observe.js";
|
|
56
|
+
export { ClaudeModelClient, DEFAULT_CLAUDE_MODEL, toAnthropicMessages, toAnthropicTools, fromAnthropicResponse, } from "./agent/adapters/claude.js";
|
|
57
|
+
export type { ClaudeModelClientOptions, AnthropicLike } from "./agent/adapters/claude.js";
|
|
58
|
+
export { renderVerifiedBySection, renderVerifiedByItem, verificationRefs, proposeVerifiedBy, VERIFIED_BY_HEADING, } from "./writeback/verified-by.js";
|
|
59
|
+
export type { VerificationLink, VerifiedByProposal } from "./writeback/verified-by.js";
|
|
60
|
+
export { mergeVerifiedBy } from "./writeback/merge.js";
|
|
61
|
+
export { buildProposal, linksFromResults } from "./writeback/proposal.js";
|
|
62
|
+
export type { BuildProposalInput, WriteBackProposal } from "./writeback/proposal.js";
|
|
63
|
+
export { renderWriteBackComment, renderCoverageComment, renderScopedQaComment, commentCoverageStatus, upsertComment, SCOPED_QA_MARKER, WRITE_BACK_MARKER, COVERAGE_MARKER, } from "./writeback/comment.js";
|
|
64
|
+
export type { FidelitySummary, CoverageCommentOptions, ScopedQaCommentInput, ScopedQaCommentRow } from "./writeback/comment.js";
|
|
65
|
+
export { GitHubWriteBackProposer } from "./writeback/proposer.js";
|
|
66
|
+
export type { RepoGateway, WriteBackProposer, WriteBackInput, WriteBackResult, GitHubWriteBackProposerOptions, } from "./writeback/proposer.js";
|
|
67
|
+
export { GitHubRestGateway } from "./writeback/gateways/github-rest.js";
|
|
68
|
+
export type { GitHubRestGatewayOptions } from "./writeback/gateways/github-rest.js";
|
|
69
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC/E,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACvE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACvE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAG9E,YAAY,EACV,MAAM,EACN,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,EACT,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,YAAY,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OA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EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,YAAY,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public API for @itsthelore/proofkeeper.
|
|
3
|
+
*
|
|
4
|
+
* The coverage read-model is the working v0.0.1 surface; the runner, compiler,
|
|
5
|
+
* fidelity gate, agent loop, and write-back are interfaces and skeletons that
|
|
6
|
+
* fix the drive→compile→fidelity→run→write-back shape (see README scope).
|
|
7
|
+
*/
|
|
8
|
+
// Coverage read-model (Initiative 1) — the working surface.
|
|
9
|
+
export { parseGraph, GraphParseError, VERIFIED_BY } from "./coverage/graph.js";
|
|
10
|
+
export { computeCoverage, CAPABILITY_TYPE } from "./coverage/model.js";
|
|
11
|
+
export { renderHuman, renderJson, toJson } from "./coverage/report.js";
|
|
12
|
+
export { loadGraphFromFile, loadGraphFromCorpus } from "./coverage/source.js";
|
|
13
|
+
export { PlaywrightRunner } from "./runner/playwright-runner.js";
|
|
14
|
+
export { parseReport, reduceReport, ReportParseError } from "./runner/playwright-report.js";
|
|
15
|
+
export { emitSpec } from "./compiler/emit.js";
|
|
16
|
+
export { Recorder } from "./compiler/recorder.js";
|
|
17
|
+
export { CodegenCompiler, NotImplementedCompiler } from "./compiler/compiler.js";
|
|
18
|
+
export { runCommand, evalOutputMatch } from "./compiler/terminal.js";
|
|
19
|
+
export { httpRequest, jsonPath } from "./compiler/http.js";
|
|
20
|
+
export { summarizeSession } from "./compiler/summary.js";
|
|
21
|
+
// Failure-learning — remember failed attempts, steer the next drive.
|
|
22
|
+
export { FileLearningStore, InMemoryLearningStore } from "./learning/store.js";
|
|
23
|
+
// Fidelity gate (Initiative 3 — the moat's acceptance bar).
|
|
24
|
+
export { assessFidelity } from "./fidelity/gate.js";
|
|
25
|
+
// The QA loop behind one command — the autonomous-QA spine (Initiatives 1–5 wired).
|
|
26
|
+
export { runQa, selectCapability, defaultGoal } from "./qa/run-qa.js";
|
|
27
|
+
// PR-triggered, diff-scoped QA.
|
|
28
|
+
export { runScopedQa, collectFailureSuggestions, DEFAULT_SCOPED_CONCURRENCY } from "./qa/run-scoped.js";
|
|
29
|
+
export { mapPool } from "./qa/concurrency.js";
|
|
30
|
+
export { scopeCapabilities } from "./scope/diff-scope.js";
|
|
31
|
+
export { parseConfig, ConfigParseError, resolveTarget, authContext, personaContext } from "./scope/config.js";
|
|
32
|
+
export { globToRegExp, matchesAnyGlob } from "./scope/glob.js";
|
|
33
|
+
// Config scaffolding — the in-scope MVP of `/install-qa`.
|
|
34
|
+
export { scaffoldConfig, renderScaffoldedConfig } from "./scaffold/scaffold.js";
|
|
35
|
+
// Agent loop (Initiatives 2–4 wired) and the BYO-model boundary.
|
|
36
|
+
export { runAgentLoop } from "./agent/loop.js";
|
|
37
|
+
export { AutonomousDriver, runDrive } from "./agent/drive.js";
|
|
38
|
+
export { DRIVE_TOOLS, LOCATOR_GUIDANCE, TERMINAL_GUIDANCE, HTTP_GUIDANCE, parseLocator, parseRunCommand, parseExpectOutput, parseExpectExit, parseRequest, parseExpectStatus, parseExpectJson, ToolArgumentError, } from "./agent/tools.js";
|
|
39
|
+
export { observePage, renderObservation, createPageMonitor } from "./agent/observe.js";
|
|
40
|
+
// Reference BYO-model adapter (optional — Anthropic Claude API).
|
|
41
|
+
export { ClaudeModelClient, DEFAULT_CLAUDE_MODEL, toAnthropicMessages, toAnthropicTools, fromAnthropicResponse, } from "./agent/adapters/claude.js";
|
|
42
|
+
// Write-back (Initiative 5 — propose-only, human-reviewed PR).
|
|
43
|
+
export { renderVerifiedBySection, renderVerifiedByItem, verificationRefs, proposeVerifiedBy, VERIFIED_BY_HEADING, } from "./writeback/verified-by.js";
|
|
44
|
+
export { mergeVerifiedBy } from "./writeback/merge.js";
|
|
45
|
+
export { buildProposal, linksFromResults } from "./writeback/proposal.js";
|
|
46
|
+
export { renderWriteBackComment, renderCoverageComment, renderScopedQaComment, commentCoverageStatus, upsertComment, SCOPED_QA_MARKER, WRITE_BACK_MARKER, COVERAGE_MARKER, } from "./writeback/comment.js";
|
|
47
|
+
export { GitHubWriteBackProposer } from "./writeback/proposer.js";
|
|
48
|
+
export { GitHubRestGateway } from "./writeback/gateways/github-rest.js";
|
|
49
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,4DAA4D;AAC5D,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE/E,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEvE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAW9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAI5F,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEjF,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAErE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,qEAAqE;AACrE,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAG/E,4DAA4D;AAC5D,OAAO,EAAE,cAA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AAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAQlE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Failure-learning — Proofkeeper remembers what went wrong so a re-run does not
|
|
3
|
+
* repeat it (Factory automated-qa's "learns from failures"). When a drive does
|
|
4
|
+
* not finish or its compiled test fails the fidelity gate, the run is recorded
|
|
5
|
+
* against the capability; the next drive of that capability is handed the prior
|
|
6
|
+
* reasons so the model can avoid the same dead ends.
|
|
7
|
+
*
|
|
8
|
+
* {@link LearningStore} is pluggable (no hard persistence dependency). The
|
|
9
|
+
* default {@link FileLearningStore} keeps one JSON file per capability under
|
|
10
|
+
* `.proofkeeper/learnings/`; {@link InMemoryLearningStore} is for tests and
|
|
11
|
+
* ephemeral runs.
|
|
12
|
+
*/
|
|
13
|
+
/** A recorded failed attempt at verifying a capability. */
|
|
14
|
+
export interface FailureRecord {
|
|
15
|
+
capabilityId: string;
|
|
16
|
+
/** What was attempted, when known. */
|
|
17
|
+
goal?: string;
|
|
18
|
+
/** Why it failed — e.g. "unstable: 1/3 re-runs green" or "drive did not finish". */
|
|
19
|
+
reason: string;
|
|
20
|
+
/** Model turns the drive took, when known. */
|
|
21
|
+
steps?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface LearningStore {
|
|
24
|
+
recordFailure(record: FailureRecord): Promise<void>;
|
|
25
|
+
/** Prior failures for a capability, oldest first. */
|
|
26
|
+
priorFailures(capabilityId: string): Promise<FailureRecord[]>;
|
|
27
|
+
}
|
|
28
|
+
/** Persists failures as one JSON array per capability under a directory. */
|
|
29
|
+
export declare class FileLearningStore implements LearningStore {
|
|
30
|
+
private readonly dir;
|
|
31
|
+
constructor(options?: {
|
|
32
|
+
dir?: string;
|
|
33
|
+
});
|
|
34
|
+
private file;
|
|
35
|
+
recordFailure(record: FailureRecord): Promise<void>;
|
|
36
|
+
priorFailures(capabilityId: string): Promise<FailureRecord[]>;
|
|
37
|
+
}
|
|
38
|
+
/** An in-memory store for tests and ephemeral runs. */
|
|
39
|
+
export declare class InMemoryLearningStore implements LearningStore {
|
|
40
|
+
private readonly byId;
|
|
41
|
+
recordFailure(record: FailureRecord): Promise<void>;
|
|
42
|
+
priorFailures(capabilityId: string): Promise<FailureRecord[]>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/learning/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,2DAA2D;AAC3D,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oFAAoF;IACpF,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,qDAAqD;IACrD,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;CAC/D;AAOD,4EAA4E;AAC5E,qBAAa,iBAAkB,YAAW,aAAa;IACrD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;gBAEjB,OAAO,GAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAA;KAAO;IAI1C,OAAO,CAAC,IAAI;IAIN,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAOnD,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;CAcpE;AAED,uDAAuD;AACvD,qBAAa,qBAAsB,YAAW,aAAa;IACzD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAsC;IAE3D,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAOnD,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;CAG9D"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Failure-learning — Proofkeeper remembers what went wrong so a re-run does not
|
|
3
|
+
* repeat it (Factory automated-qa's "learns from failures"). When a drive does
|
|
4
|
+
* not finish or its compiled test fails the fidelity gate, the run is recorded
|
|
5
|
+
* against the capability; the next drive of that capability is handed the prior
|
|
6
|
+
* reasons so the model can avoid the same dead ends.
|
|
7
|
+
*
|
|
8
|
+
* {@link LearningStore} is pluggable (no hard persistence dependency). The
|
|
9
|
+
* default {@link FileLearningStore} keeps one JSON file per capability under
|
|
10
|
+
* `.proofkeeper/learnings/`; {@link InMemoryLearningStore} is for tests and
|
|
11
|
+
* ephemeral runs.
|
|
12
|
+
*/
|
|
13
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
14
|
+
import { join } from "node:path";
|
|
15
|
+
/** Deterministic, filesystem-safe slug for a capability id. */
|
|
16
|
+
function slug(value) {
|
|
17
|
+
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "capability";
|
|
18
|
+
}
|
|
19
|
+
/** Persists failures as one JSON array per capability under a directory. */
|
|
20
|
+
export class FileLearningStore {
|
|
21
|
+
dir;
|
|
22
|
+
constructor(options = {}) {
|
|
23
|
+
this.dir = options.dir ?? join(".proofkeeper", "learnings");
|
|
24
|
+
}
|
|
25
|
+
file(capabilityId) {
|
|
26
|
+
return join(this.dir, `${slug(capabilityId)}.json`);
|
|
27
|
+
}
|
|
28
|
+
async recordFailure(record) {
|
|
29
|
+
const existing = await this.priorFailures(record.capabilityId);
|
|
30
|
+
existing.push(record);
|
|
31
|
+
await mkdir(this.dir, { recursive: true });
|
|
32
|
+
await writeFile(this.file(record.capabilityId), JSON.stringify(existing, null, 2) + "\n", "utf8");
|
|
33
|
+
}
|
|
34
|
+
async priorFailures(capabilityId) {
|
|
35
|
+
let text;
|
|
36
|
+
try {
|
|
37
|
+
text = await readFile(this.file(capabilityId), "utf8");
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return []; // no history yet
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
const parsed = JSON.parse(text);
|
|
44
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return []; // corrupt history is treated as none, never fatal
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** An in-memory store for tests and ephemeral runs. */
|
|
52
|
+
export class InMemoryLearningStore {
|
|
53
|
+
byId = new Map();
|
|
54
|
+
recordFailure(record) {
|
|
55
|
+
const list = this.byId.get(record.capabilityId) ?? [];
|
|
56
|
+
list.push(record);
|
|
57
|
+
this.byId.set(record.capabilityId, list);
|
|
58
|
+
return Promise.resolve();
|
|
59
|
+
}
|
|
60
|
+
priorFailures(capabilityId) {
|
|
61
|
+
return Promise.resolve([...(this.byId.get(capabilityId) ?? [])]);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/learning/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,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D,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC,CAAC,iBAAiB;QAC9B,CAAC;QACD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAY,CAAC;YAC3C,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAE,MAA0B,CAAC,CAAC,CAAC,EAAE,CAAC;QAClE,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC,CAAC,kDAAkD;QAC/D,CAAC;IACH,CAAC;CACF;AAED,uDAAuD;AACvD,MAAM,OAAO,qBAAqB;IACf,IAAI,GAAG,IAAI,GAAG,EAA2B,CAAC;IAE3D,aAAa,CAAC,MAAqB;QACjC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;QACtD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QACzC,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,aAAa,CAAC,YAAoB;QAChC,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACnE,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A tiny, dependency-free bounded-concurrency map. Runs `fn` over `items` with
|
|
3
|
+
* at most `limit` in flight and returns results in **input order** (each result
|
|
4
|
+
* is written to its own index), so parallel execution stays deterministic.
|
|
5
|
+
*/
|
|
6
|
+
export declare function mapPool<T, R>(items: readonly T[], limit: number, fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
|
|
7
|
+
//# sourceMappingURL=concurrency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concurrency.d.ts","sourceRoot":"","sources":["../../src/qa/concurrency.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAsB,OAAO,CAAC,CAAC,EAAE,CAAC,EAChC,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GACzC,OAAO,CAAC,CAAC,EAAE,CAAC,CAed"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A tiny, dependency-free bounded-concurrency map. Runs `fn` over `items` with
|
|
3
|
+
* at most `limit` in flight and returns results in **input order** (each result
|
|
4
|
+
* is written to its own index), so parallel execution stays deterministic.
|
|
5
|
+
*/
|
|
6
|
+
export async function mapPool(items, limit, fn) {
|
|
7
|
+
const results = new Array(items.length);
|
|
8
|
+
let next = 0;
|
|
9
|
+
async function worker() {
|
|
10
|
+
for (;;) {
|
|
11
|
+
const index = next++;
|
|
12
|
+
if (index >= items.length)
|
|
13
|
+
return;
|
|
14
|
+
results[index] = await fn(items[index], index);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const workerCount = Math.max(1, Math.min(limit, items.length));
|
|
18
|
+
await Promise.all(Array.from({ length: workerCount }, () => worker()));
|
|
19
|
+
return results;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=concurrency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concurrency.js","sourceRoot":"","sources":["../../src/qa/concurrency.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,KAAmB,EACnB,KAAa,EACb,EAA0C;IAE1C,MAAM,OAAO,GAAG,IAAI,KAAK,CAAI,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,IAAI,GAAG,CAAC,CAAC;IAEb,KAAK,UAAU,MAAM;QACnB,SAAS,CAAC;YACR,MAAM,KAAK,GAAG,IAAI,EAAE,CAAC;YACrB,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM;gBAAE,OAAO;YAClC,OAAO,CAAC,KAAK,CAAC,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,KAAK,CAAE,EAAE,KAAK,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/D,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACvE,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The QA loop behind one command — Proofkeeper's autonomous-QA spine.
|
|
3
|
+
*
|
|
4
|
+
* It wires the already-real pieces into a single autonomous pass: pick an
|
|
5
|
+
* unverified capability from the coverage read-model (Initiative 1), drive the
|
|
6
|
+
* product to record a session (Initiative 2), compile it and gate it on
|
|
7
|
+
* fidelity, then run the accepted test (Initiatives 3–4), and — only if it is
|
|
8
|
+
* stable and a proposer is wired — propose the `## Verified By` write-back as a
|
|
9
|
+
* human-reviewed pull request (Initiative 5).
|
|
10
|
+
*
|
|
11
|
+
* The drive is injected as a {@link QaDeps.drive} seam, not constructed here: a
|
|
12
|
+
* browser-backed driver supplies it at the CLI, a scripted double supplies it in
|
|
13
|
+
* tests. That keeps this orchestrator pure of any browser or model dependency
|
|
14
|
+
* and unit-testable end to end.
|
|
15
|
+
*/
|
|
16
|
+
import type { Graph } from "../coverage/graph.js";
|
|
17
|
+
import { type CapabilityCoverage } from "../coverage/model.js";
|
|
18
|
+
import type { Compiler } from "../compiler/types.js";
|
|
19
|
+
import type { Runner, RunTarget } from "../runner/types.js";
|
|
20
|
+
import { type AgentLoopResult } from "../agent/loop.js";
|
|
21
|
+
import type { DriveOptions, DriveResult } from "../agent/drive.js";
|
|
22
|
+
import type { WriteBackProposer, WriteBackResult } from "../writeback/proposer.js";
|
|
23
|
+
import type { LearningStore } from "../learning/store.js";
|
|
24
|
+
/**
|
|
25
|
+
* Pick the capability to verify: the named one if given (verified or not — a
|
|
26
|
+
* re-verify is allowed), otherwise the first unverified capability.
|
|
27
|
+
*
|
|
28
|
+
* @throws when a named capability is absent, or when nothing is unverified and
|
|
29
|
+
* no capability was named.
|
|
30
|
+
*/
|
|
31
|
+
export declare function selectCapability(graph: Graph, capabilityId?: string): CapabilityCoverage;
|
|
32
|
+
/** A default goal derived from the capability, used when the caller gives none. */
|
|
33
|
+
export declare function defaultGoal(capability: CapabilityCoverage): string;
|
|
34
|
+
export interface QaDeps {
|
|
35
|
+
/**
|
|
36
|
+
* Drive the product to produce a recorded session. The CLI backs this with a
|
|
37
|
+
* real browser + a {@link ModelClient}; tests back it with a double.
|
|
38
|
+
*/
|
|
39
|
+
drive(options: DriveOptions): Promise<DriveResult>;
|
|
40
|
+
compiler: Compiler;
|
|
41
|
+
runner: Runner;
|
|
42
|
+
/** Optional: when present and the test is stable, propose the write-back PR. */
|
|
43
|
+
proposer?: WriteBackProposer;
|
|
44
|
+
/** Optional: remembers failed attempts and feeds prior reasons into the drive. */
|
|
45
|
+
learning?: LearningStore;
|
|
46
|
+
}
|
|
47
|
+
export interface QaOptions {
|
|
48
|
+
/** Parsed `rac export --graph` output to read coverage from. */
|
|
49
|
+
graph: Graph;
|
|
50
|
+
/** Verify this capability; defaults to the first unverified one. */
|
|
51
|
+
capabilityId?: string;
|
|
52
|
+
/** Product entry point the drive navigates to first. */
|
|
53
|
+
startUrl: string;
|
|
54
|
+
/** Goal for the model; defaults to {@link defaultGoal}. */
|
|
55
|
+
goal?: string;
|
|
56
|
+
/** The target the compiled test is gated and run against. */
|
|
57
|
+
target: RunTarget;
|
|
58
|
+
/** Fidelity re-run count (the moat's acceptance bar). */
|
|
59
|
+
n: number;
|
|
60
|
+
/** Cap on model turns during the drive. */
|
|
61
|
+
maxSteps?: number;
|
|
62
|
+
/** When set, the drive emits a Markdown test plan before acting. */
|
|
63
|
+
plan?: boolean;
|
|
64
|
+
/** Extra context appended to the goal (e.g. environment restrictions, auth). */
|
|
65
|
+
goalContext?: string;
|
|
66
|
+
/** When set (and a proposer is wired), propose a Verified By write-back. */
|
|
67
|
+
propose?: {
|
|
68
|
+
targetPath: string;
|
|
69
|
+
baseBranch?: string;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export interface QaResult {
|
|
73
|
+
capability: CapabilityCoverage;
|
|
74
|
+
drive: DriveResult;
|
|
75
|
+
loop: AgentLoopResult;
|
|
76
|
+
/** True iff the compiled test passed the fidelity gate. */
|
|
77
|
+
verified: boolean;
|
|
78
|
+
/** Present only when a write-back was attempted (stable + proposer + propose). */
|
|
79
|
+
writeBack?: WriteBackResult;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Run the full QA loop for one capability: select → drive → compile → fidelity →
|
|
83
|
+
* run → (optional) propose. Returns the outcome; never throws on an unstable
|
|
84
|
+
* test (that is a verdict, surfaced in {@link QaResult.verified}).
|
|
85
|
+
*/
|
|
86
|
+
export declare function runQa(deps: QaDeps, options: QaOptions): Promise<QaResult>;
|
|
87
|
+
//# sourceMappingURL=run-qa.d.ts.map
|