@miller-tech/uap 1.50.1 → 1.52.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.
Files changed (54) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/benchmarks/paired/ablation.d.ts +36 -0
  3. package/dist/benchmarks/paired/ablation.d.ts.map +1 -0
  4. package/dist/benchmarks/paired/ablation.js +96 -0
  5. package/dist/benchmarks/paired/ablation.js.map +1 -0
  6. package/dist/benchmarks/paired/adapter.d.ts +95 -0
  7. package/dist/benchmarks/paired/adapter.d.ts.map +1 -0
  8. package/dist/benchmarks/paired/adapter.js +456 -0
  9. package/dist/benchmarks/paired/adapter.js.map +1 -0
  10. package/dist/benchmarks/paired/index.d.ts +17 -0
  11. package/dist/benchmarks/paired/index.d.ts.map +1 -0
  12. package/dist/benchmarks/paired/index.js +17 -0
  13. package/dist/benchmarks/paired/index.js.map +1 -0
  14. package/dist/benchmarks/paired/report.d.ts +61 -0
  15. package/dist/benchmarks/paired/report.d.ts.map +1 -0
  16. package/dist/benchmarks/paired/report.js +204 -0
  17. package/dist/benchmarks/paired/report.js.map +1 -0
  18. package/dist/benchmarks/paired/runner.d.ts +25 -0
  19. package/dist/benchmarks/paired/runner.d.ts.map +1 -0
  20. package/dist/benchmarks/paired/runner.js +125 -0
  21. package/dist/benchmarks/paired/runner.js.map +1 -0
  22. package/dist/benchmarks/paired/scaffold.d.ts +28 -0
  23. package/dist/benchmarks/paired/scaffold.d.ts.map +1 -0
  24. package/dist/benchmarks/paired/scaffold.js +74 -0
  25. package/dist/benchmarks/paired/scaffold.js.map +1 -0
  26. package/dist/benchmarks/paired/stats.d.ts +68 -0
  27. package/dist/benchmarks/paired/stats.d.ts.map +1 -0
  28. package/dist/benchmarks/paired/stats.js +182 -0
  29. package/dist/benchmarks/paired/stats.js.map +1 -0
  30. package/dist/benchmarks/paired/suite.d.ts +43 -0
  31. package/dist/benchmarks/paired/suite.d.ts.map +1 -0
  32. package/dist/benchmarks/paired/suite.js +117 -0
  33. package/dist/benchmarks/paired/suite.js.map +1 -0
  34. package/dist/benchmarks/paired/types.d.ts +195 -0
  35. package/dist/benchmarks/paired/types.d.ts.map +1 -0
  36. package/dist/benchmarks/paired/types.js +111 -0
  37. package/dist/benchmarks/paired/types.js.map +1 -0
  38. package/dist/bin/cli.js +22 -0
  39. package/dist/bin/cli.js.map +1 -1
  40. package/dist/cli/bench.d.ts +21 -0
  41. package/dist/cli/bench.d.ts.map +1 -0
  42. package/dist/cli/bench.js +94 -0
  43. package/dist/cli/bench.js.map +1 -0
  44. package/dist/cli/hooks.d.ts.map +1 -1
  45. package/dist/cli/hooks.js +4 -0
  46. package/dist/cli/hooks.js.map +1 -1
  47. package/docs/benchmarks/PAIRED_HARNESS.md +112 -0
  48. package/docs/benchmarks/README.md +1 -0
  49. package/package.json +1 -1
  50. package/src/policies/enforcers/__pycache__/_common.cpython-312.pyc +0 -0
  51. package/templates/hooks/coordinate-file.sh +94 -0
  52. package/templates/hooks/pre-tool-use-edit-write.sh +36 -1
  53. package/templates/hooks/session-end.sh +29 -6
  54. package/templates/hooks/session-start.sh +17 -1
@@ -0,0 +1,182 @@
1
+ /**
2
+ * Paired-comparison statistics for the UAP benchmark.
3
+ *
4
+ * The research is explicit: agent evals are stochastic, so a point estimate is
5
+ * meaningless without a variance measure, and the *paired* design (same task &
6
+ * seed in both arms) is what gives statistical power — it removes between-task
7
+ * variance, the dominant noise source. This module implements:
8
+ *
9
+ * - mean / std / standard error
10
+ * - paired bootstrap confidence interval on a delta (percentile method)
11
+ * - paired permutation test (two-sided) for significance of a delta
12
+ * - McNemar contingency for paired binary outcomes (the gate-value 2x2)
13
+ * - pass@k reducer
14
+ *
15
+ * All randomized procedures take an explicit seed so reports are reproducible
16
+ * (the Mem0/Zep scandal lesson: single-run, non-reproducible numbers are the #1
17
+ * credibility red flag).
18
+ */
19
+ // ---------------------------------------------------------------------------
20
+ // Seeded PRNG (mulberry32) — deterministic, dependency-free.
21
+ // ---------------------------------------------------------------------------
22
+ export function mulberry32(seed) {
23
+ let a = seed >>> 0;
24
+ return function () {
25
+ a |= 0;
26
+ a = (a + 0x6d2b79f5) | 0;
27
+ let t = Math.imul(a ^ (a >>> 15), 1 | a);
28
+ t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
29
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
30
+ };
31
+ }
32
+ // ---------------------------------------------------------------------------
33
+ // Descriptive stats
34
+ // ---------------------------------------------------------------------------
35
+ export function mean(xs) {
36
+ if (xs.length === 0)
37
+ return NaN;
38
+ return xs.reduce((a, b) => a + b, 0) / xs.length;
39
+ }
40
+ export function variance(xs) {
41
+ if (xs.length < 2)
42
+ return 0;
43
+ const m = mean(xs);
44
+ return xs.reduce((a, b) => a + (b - m) * (b - m), 0) / (xs.length - 1);
45
+ }
46
+ export function std(xs) {
47
+ return Math.sqrt(variance(xs));
48
+ }
49
+ export function stderr(xs) {
50
+ if (xs.length === 0)
51
+ return NaN;
52
+ return std(xs) / Math.sqrt(xs.length);
53
+ }
54
+ function percentile(sorted, q) {
55
+ if (sorted.length === 0)
56
+ return NaN;
57
+ const idx = q * (sorted.length - 1);
58
+ const lo = Math.floor(idx);
59
+ const hi = Math.ceil(idx);
60
+ if (lo === hi)
61
+ return sorted[lo];
62
+ const frac = idx - lo;
63
+ return sorted[lo] * (1 - frac) + sorted[hi] * frac;
64
+ }
65
+ /**
66
+ * Paired analysis of a treatment vs baseline metric. `deltas[i]` is
67
+ * (treatment_i - baseline_i) for the i-th paired observation. Returns the mean
68
+ * delta, a bootstrap CI, and a permutation p-value (sign-flip, the correct null
69
+ * for a paired design).
70
+ */
71
+ export function pairedDelta(deltas, opts = {}) {
72
+ const iterations = opts.iterations ?? 10000;
73
+ const confidence = opts.confidence ?? 0.95;
74
+ const rng = mulberry32(opts.seed ?? 1);
75
+ const n = deltas.length;
76
+ if (n === 0) {
77
+ return { meanDelta: NaN, ci: { lower: NaN, upper: NaN }, pValue: NaN, n: 0, significant: false };
78
+ }
79
+ const observed = mean(deltas);
80
+ // --- Bootstrap CI: resample paired deltas with replacement.
81
+ const bootMeans = new Array(iterations);
82
+ for (let b = 0; b < iterations; b++) {
83
+ let acc = 0;
84
+ for (let i = 0; i < n; i++) {
85
+ acc += deltas[(rng() * n) | 0];
86
+ }
87
+ bootMeans[b] = acc / n;
88
+ }
89
+ bootMeans.sort((a, b) => a - b);
90
+ const alpha = 1 - confidence;
91
+ const ci = {
92
+ lower: percentile(bootMeans, alpha / 2),
93
+ upper: percentile(bootMeans, 1 - alpha / 2),
94
+ };
95
+ // --- Permutation test: under H0 the sign of each paired delta is arbitrary,
96
+ // so randomly flip signs and compare |mean| to observed.
97
+ let extreme = 0;
98
+ const absObs = Math.abs(observed);
99
+ for (let p = 0; p < iterations; p++) {
100
+ let acc = 0;
101
+ for (let i = 0; i < n; i++) {
102
+ acc += rng() < 0.5 ? deltas[i] : -deltas[i];
103
+ }
104
+ if (Math.abs(acc / n) >= absObs - 1e-12)
105
+ extreme++;
106
+ }
107
+ const pValue = (extreme + 1) / (iterations + 1);
108
+ return {
109
+ meanDelta: observed,
110
+ ci,
111
+ pValue,
112
+ n,
113
+ significant: ci.lower > 0 || ci.upper < 0,
114
+ };
115
+ }
116
+ /** Exact binomial two-sided tail (used for McNemar on discordant pairs). */
117
+ function binomTwoSided(b, c) {
118
+ const nDisc = b + c;
119
+ if (nDisc === 0)
120
+ return 1;
121
+ // P(X <= min) under Binomial(nDisc, 0.5), doubled, capped at 1.
122
+ const k = Math.min(b, c);
123
+ let logFac = 0;
124
+ const logFacs = new Array(nDisc + 1);
125
+ logFacs[0] = 0;
126
+ for (let i = 1; i <= nDisc; i++) {
127
+ logFac += Math.log(i);
128
+ logFacs[i] = logFac;
129
+ }
130
+ const logChoose = (nn, kk) => logFacs[nn] - logFacs[kk] - logFacs[nn - kk];
131
+ let tail = 0;
132
+ for (let i = 0; i <= k; i++) {
133
+ tail += Math.exp(logChoose(nDisc, i) + nDisc * Math.log(0.5));
134
+ }
135
+ return Math.min(1, 2 * tail);
136
+ }
137
+ export function mcnemar(treatment, baseline) {
138
+ if (treatment.length !== baseline.length) {
139
+ throw new Error('mcnemar: paired arrays must be equal length');
140
+ }
141
+ let bothCorrect = 0;
142
+ let onlyTreatment = 0;
143
+ let onlyBaseline = 0;
144
+ let bothWrong = 0;
145
+ for (let i = 0; i < treatment.length; i++) {
146
+ const t = treatment[i];
147
+ const b = baseline[i];
148
+ if (t && b)
149
+ bothCorrect++;
150
+ else if (t && !b)
151
+ onlyTreatment++;
152
+ else if (!t && b)
153
+ onlyBaseline++;
154
+ else
155
+ bothWrong++;
156
+ }
157
+ return {
158
+ bothCorrect,
159
+ onlyTreatment,
160
+ onlyBaseline,
161
+ bothWrong,
162
+ netGain: onlyTreatment - onlyBaseline,
163
+ pValue: binomTwoSided(onlyTreatment, onlyBaseline),
164
+ n: treatment.length,
165
+ };
166
+ }
167
+ // ---------------------------------------------------------------------------
168
+ // pass@k — probability at least one of k i.i.d. attempts succeeds, using the
169
+ // unbiased estimator from the Codex/HumanEval literature.
170
+ // ---------------------------------------------------------------------------
171
+ export function passAtK(numSamples, numCorrect, k) {
172
+ if (k > numSamples)
173
+ throw new Error('passAtK: k cannot exceed numSamples');
174
+ if (numSamples - numCorrect < k)
175
+ return 1;
176
+ let prod = 1;
177
+ for (let i = 0; i < k; i++) {
178
+ prod *= (numSamples - numCorrect - i) / (numSamples - i);
179
+ }
180
+ return 1 - prod;
181
+ }
182
+ //# sourceMappingURL=stats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stats.js","sourceRoot":"","sources":["../../../src/benchmarks/paired/stats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,8EAA8E;AAC9E,6DAA6D;AAC7D,8EAA8E;AAC9E,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,CAAC;IACn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ACtB,IAAI,CAAC,IAAI,CAAC;YAAE,WAAW,EAAE,CAAC;aACrB,IAAI,CAAC,IAAI,CAAC,CAAC;YAAE,aAAa,EAAE,CAAC;aAC7B,IAAI,CAAC,CAAC,IAAI,CAAC;YAAE,YAAY,EAAE,CAAC;;YAC5B,SAAS,EAAE,CAAC;IACnB,CAAC;IACD,OAAO;QACL,WAAW;QACX,aAAa;QACb,YAAY;QACZ,SAAS;QACT,OAAO,EAAE,aAAa,GAAG,YAAY;QACrC,MAAM,EAAE,aAAa,CAAC,aAAa,EAAE,YAAY,CAAC;QAClD,CAAC,EAAE,SAAS,CAAC,MAAM;KACpB,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,6EAA6E;AAC7E,0DAA0D;AAC1D,8EAA8E;AAC9E,MAAM,UAAU,OAAO,CAAC,UAAkB,EAAE,UAAkB,EAAE,CAAS;IACvE,IAAI,CAAC,GAAG,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IAC3E,IAAI,UAAU,GAAG,UAAU,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC;IAC1C,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,IAAI,IAAI,CAAC,UAAU,GAAG,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,CAAC;AAClB,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Real-gate task-suite loader + verifier.
3
+ *
4
+ * A suite is a directory of task folders:
5
+ *
6
+ * benchmarks/suites/real-gate/
7
+ * <task-id>/
8
+ * task.json # TaskSpec (without `id`; id derives from folder name)
9
+ * repo/ # git fixture in a failing state
10
+ *
11
+ * The `verifyCmd` in task.json is the deterministic ground-truth scorer: it runs
12
+ * inside an isolated copy of `repo/` and must exit 0 iff the task is resolved.
13
+ * No LLM judge — coding tasks give us real test execution as ground truth.
14
+ */
15
+ import { TaskSpec } from './types.js';
16
+ /** Load and validate a single task folder. The folder name becomes the id. */
17
+ export declare function loadTask(taskDir: string): TaskSpec;
18
+ /** Load every task folder under a suite directory (sorted by id for stability). */
19
+ export declare function loadSuite(suiteDir: string): TaskSpec[];
20
+ /** Absolute path to a task's fixture repo, given the suite dir. */
21
+ export declare function taskRepoPath(suiteDir: string, task: TaskSpec): string;
22
+ /**
23
+ * Copy a task's fixture repo into a fresh isolated scratch directory so every
24
+ * run starts from the identical failing state (common-random-numbers principle:
25
+ * only the UAP toggle differs between arms).
26
+ */
27
+ export declare function materializeWorkdir(suiteDir: string, task: TaskSpec, workRoot: string): string;
28
+ /** Make a fresh scratch dir under the OS tmp (used when no workRoot is given). */
29
+ export declare function tmpWorkRoot(): string;
30
+ export interface VerifyResult {
31
+ passed: boolean;
32
+ exitCode: number;
33
+ timedOut: boolean;
34
+ stdout: string;
35
+ stderr: string;
36
+ }
37
+ /** Run the task's deterministic verify command inside `workdir`. */
38
+ export declare function runVerify(task: TaskSpec, workdir: string): VerifyResult;
39
+ /** Run an optional one-time setup command inside `workdir`. */
40
+ export declare function runSetup(task: TaskSpec, workdir: string): VerifyResult | null;
41
+ /** Copy of process.env with GIT_* repository pointers removed. */
42
+ export declare function sanitizedEnv(): NodeJS.ProcessEnv;
43
+ //# sourceMappingURL=suite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suite.d.ts","sourceRoot":"","sources":["../../../src/benchmarks/paired/suite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAeH,OAAO,EAAE,QAAQ,EAAkB,MAAM,YAAY,CAAC;AAEtD,8EAA8E;AAC9E,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAelD;AAED,mFAAmF;AACnF,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,CActD;AAED,mEAAmE;AACnE,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,CAErE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM7F;AAED,kFAAkF;AAClF,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,YAAY,CAiBvE;AAED,+DAA+D;AAC/D,wBAAgB,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAe7E;AAED,kEAAkE;AAClE,wBAAgB,YAAY,IAAI,MAAM,CAAC,UAAU,CAMhD"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Real-gate task-suite loader + verifier.
3
+ *
4
+ * A suite is a directory of task folders:
5
+ *
6
+ * benchmarks/suites/real-gate/
7
+ * <task-id>/
8
+ * task.json # TaskSpec (without `id`; id derives from folder name)
9
+ * repo/ # git fixture in a failing state
10
+ *
11
+ * The `verifyCmd` in task.json is the deterministic ground-truth scorer: it runs
12
+ * inside an isolated copy of `repo/` and must exit 0 iff the task is resolved.
13
+ * No LLM judge — coding tasks give us real test execution as ground truth.
14
+ */
15
+ import { spawnSync } from 'child_process';
16
+ import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, statSync, } from 'fs';
17
+ import { tmpdir } from 'os';
18
+ import { join } from 'path';
19
+ import { TaskSpecSchema } from './types.js';
20
+ /** Load and validate a single task folder. The folder name becomes the id. */
21
+ export function loadTask(taskDir) {
22
+ const specPath = join(taskDir, 'task.json');
23
+ if (!existsSync(specPath)) {
24
+ throw new Error(`Task folder ${taskDir} is missing task.json`);
25
+ }
26
+ const raw = JSON.parse(readFileSync(specPath, 'utf-8'));
27
+ // Folder name is the canonical id unless task.json overrides it.
28
+ const id = raw.id ?? taskDir.split('/').filter(Boolean).pop() ?? 'task';
29
+ const parsed = TaskSpecSchema.parse({ ...raw, id });
30
+ const repoPath = join(taskDir, parsed.repoDir);
31
+ if (!existsSync(repoPath)) {
32
+ throw new Error(`Task ${id}: repo dir '${parsed.repoDir}' not found at ${repoPath}`);
33
+ }
34
+ return parsed;
35
+ }
36
+ /** Load every task folder under a suite directory (sorted by id for stability). */
37
+ export function loadSuite(suiteDir) {
38
+ if (!existsSync(suiteDir)) {
39
+ throw new Error(`Suite directory not found: ${suiteDir}`);
40
+ }
41
+ const entries = readdirSync(suiteDir)
42
+ .filter((name) => !name.startsWith('.'))
43
+ .map((name) => join(suiteDir, name))
44
+ .filter((p) => statSync(p).isDirectory() && existsSync(join(p, 'task.json')));
45
+ const tasks = entries.map(loadTask).sort((a, b) => a.id.localeCompare(b.id));
46
+ if (tasks.length === 0) {
47
+ throw new Error(`No tasks found in suite ${suiteDir}`);
48
+ }
49
+ return tasks;
50
+ }
51
+ /** Absolute path to a task's fixture repo, given the suite dir. */
52
+ export function taskRepoPath(suiteDir, task) {
53
+ return join(suiteDir, task.id, task.repoDir);
54
+ }
55
+ /**
56
+ * Copy a task's fixture repo into a fresh isolated scratch directory so every
57
+ * run starts from the identical failing state (common-random-numbers principle:
58
+ * only the UAP toggle differs between arms).
59
+ */
60
+ export function materializeWorkdir(suiteDir, task, workRoot) {
61
+ mkdirSync(workRoot, { recursive: true });
62
+ const scratch = mkdtempSync(join(workRoot, `${task.id}-`));
63
+ const dest = join(scratch, 'repo');
64
+ cpSync(taskRepoPath(suiteDir, task), dest, { recursive: true });
65
+ return dest;
66
+ }
67
+ /** Make a fresh scratch dir under the OS tmp (used when no workRoot is given). */
68
+ export function tmpWorkRoot() {
69
+ return mkdtempSync(join(tmpdir(), 'uap-bench-'));
70
+ }
71
+ /** Run the task's deterministic verify command inside `workdir`. */
72
+ export function runVerify(task, workdir) {
73
+ const res = spawnSync('bash', ['-lc', task.verifyCmd], {
74
+ cwd: workdir,
75
+ encoding: 'utf-8',
76
+ timeout: task.verifyTimeoutSec * 1000,
77
+ // Strip inherited GIT_* env so a verify that shells out to git targets the
78
+ // scratch repo, not an enclosing worktree (known GIT_DIR poisoning hazard).
79
+ env: sanitizedEnv(),
80
+ });
81
+ const timedOut = res.signal === 'SIGTERM' && res.status === null;
82
+ return {
83
+ passed: res.status === 0 && !timedOut,
84
+ exitCode: res.status ?? (timedOut ? 124 : 1),
85
+ timedOut,
86
+ stdout: res.stdout ?? '',
87
+ stderr: res.stderr ?? '',
88
+ };
89
+ }
90
+ /** Run an optional one-time setup command inside `workdir`. */
91
+ export function runSetup(task, workdir) {
92
+ if (!task.setupCmd)
93
+ return null;
94
+ const res = spawnSync('bash', ['-lc', task.setupCmd], {
95
+ cwd: workdir,
96
+ encoding: 'utf-8',
97
+ timeout: task.verifyTimeoutSec * 1000,
98
+ env: sanitizedEnv(),
99
+ });
100
+ return {
101
+ passed: res.status === 0,
102
+ exitCode: res.status ?? 1,
103
+ timedOut: false,
104
+ stdout: res.stdout ?? '',
105
+ stderr: res.stderr ?? '',
106
+ };
107
+ }
108
+ /** Copy of process.env with GIT_* repository pointers removed. */
109
+ export function sanitizedEnv() {
110
+ const env = { ...process.env };
111
+ for (const key of Object.keys(env)) {
112
+ if (key.startsWith('GIT_'))
113
+ delete env[key];
114
+ }
115
+ return env;
116
+ }
117
+ //# sourceMappingURL=suite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suite.js","sourceRoot":"","sources":["../../../src/benchmarks/paired/suite.ts"],"names":[],"mappings":"AA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ACJ,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,QAAQ,CAAC,IAAc,EAAE,OAAe;IACtD,IAAI,CAAC,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAChC,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE;QACpD,GAAG,EAAE,OAAO;QACZ,QAAQ,EAAE,OAAO;QACjB,OAAO,EAAE,IAAI,CAAC,gBAAgB,GAAG,IAAI;QACrC,GAAG,EAAE,YAAY,EAAE;KACpB,CAAC,CAAC;IACH,OAAO;QACL,MAAM,EAAE,GAAG,CAAC,MAAM,KAAK,CAAC;QACxB,QAAQ,EAAE,GAAG,CAAC,MAAM,IAAI,CAAC;QACzB,QAAQ,EAAE,KAAK;QACf,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,EAAE;QACxB,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,EAAE;KACzB,CAAC;AACJ,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,YAAY;IAC1B,MAAM,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC/B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC;YAAE,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,195 @@
1
+ /**
2
+ * Paired UAP Benchmark Harness — Shared Types
3
+ *
4
+ * Design goal (from the eval-methodology research): measure a *scaffold* layer
5
+ * (UAP) by holding the base model + base agent constant and toggling UAP on/off
6
+ * over the SAME task suite and seeds. The unit of measurement is not a single
7
+ * accuracy number but a *vector* of paired metrics (correctness, tokens, cost,
8
+ * turns, tool-calls, latency), reported with confidence intervals on the paired
9
+ * delta. See ./stats.ts for the statistics and ./report.ts for the framing.
10
+ *
11
+ * This file is the dependency-free core: pure type/Zod definitions reused by the
12
+ * adapter, runner, ablation, and report modules.
13
+ */
14
+ import { z } from 'zod';
15
+ /**
16
+ * A single real-gate benchmark task. Each task is a self-contained git fixture
17
+ * with a failing state and a deterministic `verify` command that is the ground
18
+ * truth: exit 0 => the agent resolved the task. No LLM judge.
19
+ */
20
+ export declare const TaskSpecSchema: z.ZodObject<{
21
+ id: z.ZodString;
22
+ name: z.ZodString;
23
+ /** Natural-language instruction handed verbatim to the agent under test. */
24
+ instruction: z.ZodString;
25
+ difficulty: z.ZodDefault<z.ZodEnum<["easy", "medium", "hard"]>>;
26
+ /** Free-form tags for slicing results (e.g. 'bugfix', 'feature', 'refactor'). */
27
+ tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
28
+ /**
29
+ * Path (relative to the task directory) to the repo fixture that gets copied
30
+ * into an isolated scratch dir for each run. Defaults to 'repo'.
31
+ */
32
+ repoDir: z.ZodDefault<z.ZodString>;
33
+ /**
34
+ * Shell command (run inside the scratch repo) that returns exit 0 iff the
35
+ * task is resolved. This is the deterministic ground-truth scorer (HIDDEN —
36
+ * the agent never sees it).
37
+ */
38
+ verifyCmd: z.ZodString;
39
+ /**
40
+ * Optional VISIBLE in-repo gate command (e.g. `node test.js`) that a
41
+ * gate-enforcing agent runs to self-verify and iterate. Distinct from
42
+ * verifyCmd: this is what the UAP gate loop optimizes against; verifyCmd
43
+ * (a superset) remains the authoritative ground truth. Used by the raw
44
+ * single-shot-vs-gate-loop adapter to isolate gate value.
45
+ */
46
+ gateCmd: z.ZodOptional<z.ZodString>;
47
+ /** Optional setup command run once after the repo is copied, before the agent. */
48
+ setupCmd: z.ZodOptional<z.ZodString>;
49
+ /** Seconds before the verify command is killed and treated as failure. */
50
+ verifyTimeoutSec: z.ZodDefault<z.ZodNumber>;
51
+ /** Seconds before the agent run is killed and treated as failure. */
52
+ agentTimeoutSec: z.ZodDefault<z.ZodNumber>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ id: string;
55
+ name: string;
56
+ instruction: string;
57
+ tags: string[];
58
+ difficulty: "medium" | "easy" | "hard";
59
+ repoDir: string;
60
+ verifyCmd: string;
61
+ verifyTimeoutSec: number;
62
+ agentTimeoutSec: number;
63
+ gateCmd?: string | undefined;
64
+ setupCmd?: string | undefined;
65
+ }, {
66
+ id: string;
67
+ name: string;
68
+ instruction: string;
69
+ verifyCmd: string;
70
+ tags?: string[] | undefined;
71
+ difficulty?: "medium" | "easy" | "hard" | undefined;
72
+ repoDir?: string | undefined;
73
+ gateCmd?: string | undefined;
74
+ setupCmd?: string | undefined;
75
+ verifyTimeoutSec?: number | undefined;
76
+ agentTimeoutSec?: number | undefined;
77
+ }>;
78
+ export type TaskSpec = z.infer<typeof TaskSpecSchema>;
79
+ /**
80
+ * The toggleable UAP components, used by the ablation harness. Turning all of
81
+ * them off is equivalent to the bare-agent baseline; turning all on is full UAP.
82
+ */
83
+ export declare const UAP_COMPONENTS: readonly ["gates", "worktree", "memory", "experts", "skills", "patterns"];
84
+ export type UapComponent = (typeof UAP_COMPONENTS)[number];
85
+ /**
86
+ * A condition is one arm of the experiment: which UAP components are active.
87
+ * `baseline` = all off; `full` = all on; ablations turn exactly one off.
88
+ */
89
+ export interface Condition {
90
+ /** Stable label used in reports, e.g. 'baseline', 'uap-full', 'no-gates'. */
91
+ label: string;
92
+ /** Components enabled for this arm. */
93
+ components: ReadonlySet<UapComponent>;
94
+ }
95
+ export declare function makeBaselineCondition(): Condition;
96
+ export declare function makeFullCondition(): Condition;
97
+ /** True when this condition is the bare-agent baseline (no UAP at all). */
98
+ export declare function isBaseline(c: Condition): boolean;
99
+ export declare const MetricVectorSchema: z.ZodObject<{
100
+ /** Ground truth: did the verify command pass. */
101
+ correct: z.ZodBoolean;
102
+ /** Total tokens (prompt + completion) consumed by the agent, if known. */
103
+ tokens: z.ZodNullable<z.ZodNumber>;
104
+ /** Estimated USD cost, if a price could be applied. */
105
+ costUsd: z.ZodNullable<z.ZodNumber>;
106
+ /** Agent loop iterations / turns, if reported. */
107
+ turns: z.ZodNullable<z.ZodNumber>;
108
+ /** Tool calls made by the agent, if reported. */
109
+ toolCalls: z.ZodNullable<z.ZodNumber>;
110
+ /** Wall-clock latency of the agent run in milliseconds. */
111
+ latencyMs: z.ZodNumber;
112
+ /** Whether the agent produced a well-formed edit (format compliance), if known. */
113
+ wellFormed: z.ZodNullable<z.ZodBoolean>;
114
+ /** Non-fatal note or error message captured during the run. */
115
+ error: z.ZodNullable<z.ZodString>;
116
+ }, "strip", z.ZodTypeAny, {
117
+ error: string | null;
118
+ tokens: number | null;
119
+ latencyMs: number;
120
+ toolCalls: number | null;
121
+ turns: number | null;
122
+ correct: boolean;
123
+ costUsd: number | null;
124
+ wellFormed: boolean | null;
125
+ }, {
126
+ error: string | null;
127
+ tokens: number | null;
128
+ latencyMs: number;
129
+ toolCalls: number | null;
130
+ turns: number | null;
131
+ correct: boolean;
132
+ costUsd: number | null;
133
+ wellFormed: boolean | null;
134
+ }>;
135
+ export type MetricVector = z.infer<typeof MetricVectorSchema>;
136
+ /** The continuous (numeric) metric keys eligible for paired-delta analysis. */
137
+ export declare const CONTINUOUS_METRICS: readonly ["tokens", "costUsd", "turns", "toolCalls", "latencyMs"];
138
+ export type ContinuousMetric = (typeof CONTINUOUS_METRICS)[number];
139
+ /** One execution of one task under one condition at one seed/epoch. */
140
+ export interface RunRecord {
141
+ taskId: string;
142
+ condition: string;
143
+ /** Seed/epoch index — same value pairs runs across conditions for analysis. */
144
+ seed: number;
145
+ metrics: MetricVector;
146
+ /** Adapter that produced this run (e.g. 'mock', 'opencode', 'claude'). */
147
+ adapter: string;
148
+ /** Model identifier the adapter ran against. */
149
+ model: string;
150
+ }
151
+ /**
152
+ * Result returned by an AgentAdapter for a single run, before the verify
153
+ * command is applied. `correct` is filled in by the runner from the verify
154
+ * command, so adapters return everything *except* correctness.
155
+ */
156
+ export interface AgentRunResult {
157
+ tokens: number | null;
158
+ costUsd: number | null;
159
+ turns: number | null;
160
+ toolCalls: number | null;
161
+ wellFormed: boolean | null;
162
+ error: string | null;
163
+ /** Raw stdout/log for debugging and post-hoc audit (HAL-style log inspection). */
164
+ rawLog?: string;
165
+ }
166
+ export interface AgentRunContext {
167
+ task: TaskSpec;
168
+ condition: Condition;
169
+ /** Absolute path to the isolated scratch repo the agent should operate on. */
170
+ workdir: string;
171
+ seed: number;
172
+ model: string;
173
+ }
174
+ export interface AgentAdapter {
175
+ /** Stable adapter id used in reports. */
176
+ readonly id: string;
177
+ /** Drive the agent over `ctx.workdir`. Must not throw on agent failure — */
178
+ /** capture it in `error` and return. May throw only on harness misconfig. */
179
+ run(ctx: AgentRunContext): Promise<AgentRunResult>;
180
+ }
181
+ export interface RunnerConfig {
182
+ tasks: TaskSpec[];
183
+ conditions: Condition[];
184
+ adapter: AgentAdapter;
185
+ model: string;
186
+ /** Number of paired seeds/epochs per (task, condition). Research: >=5. */
187
+ epochs: number;
188
+ /** Max concurrent runs. */
189
+ concurrency: number;
190
+ /** Directory for scratch repos + artifacts. */
191
+ workRoot: string;
192
+ /** Optional progress callback. */
193
+ onProgress?: (done: number, total: number, label: string) => void;
194
+ }
195
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/benchmarks/paired/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;IAGzB,4EAA4E;;;IAG5E,iFAAiF;;IAEjF;;;OAGG;;IAEH;;;;OAIG;;IAEH;;;;;;OAMG;;IAEH,kFAAkF;;IAElF,0EAA0E;;IAE1E,qEAAqE;;;;;;;;;;;;;;;;;;;;;;;;;;EAErE,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,C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