wicked-crew 0.16.4 → 0.16.6
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/dist/api/ask-paths.d.ts +5 -2
- package/dist/api/ask-paths.d.ts.map +1 -1
- package/dist/api/ask-paths.js +6 -3
- package/dist/api/ask-paths.js.map +1 -1
- package/dist/api/chat-scope.d.ts +8 -3
- package/dist/api/chat-scope.d.ts.map +1 -1
- package/dist/api/chat-scope.js +17 -5
- package/dist/api/chat-scope.js.map +1 -1
- package/dist/api/chat-workflow.d.ts +60 -0
- package/dist/api/chat-workflow.d.ts.map +1 -0
- package/dist/api/chat-workflow.js +80 -0
- package/dist/api/chat-workflow.js.map +1 -0
- package/dist/api/endpoint-manifest-live.d.ts.map +1 -1
- package/dist/api/endpoint-manifest-live.js +2 -0
- package/dist/api/endpoint-manifest-live.js.map +1 -1
- package/dist/api/needs.d.ts +116 -0
- package/dist/api/needs.d.ts.map +1 -0
- package/dist/api/needs.js +618 -0
- package/dist/api/needs.js.map +1 -0
- package/dist/api/routes.d.ts +23 -1
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +297 -25
- package/dist/api/routes.js.map +1 -1
- package/dist/api/run-liveness.d.ts +8 -0
- package/dist/api/run-liveness.d.ts.map +1 -1
- package/dist/api/run-liveness.js +39 -7
- package/dist/api/run-liveness.js.map +1 -1
- package/dist/api/run-timing-index.d.ts +6 -0
- package/dist/api/run-timing-index.d.ts.map +1 -1
- package/dist/api/run-timing-index.js +18 -0
- package/dist/api/run-timing-index.js.map +1 -1
- package/dist/api/server.d.ts +8 -0
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +149 -3
- package/dist/api/server.js.map +1 -1
- package/dist/api/system-snapshot.d.ts +7 -15
- package/dist/api/system-snapshot.d.ts.map +1 -1
- package/dist/api/system-snapshot.js +7 -115
- package/dist/api/system-snapshot.js.map +1 -1
- package/dist/core/run-identity.d.ts.map +1 -1
- package/dist/core/run-identity.js +3 -0
- package/dist/core/run-identity.js.map +1 -1
- package/dist/evals/capture.d.ts +93 -0
- package/dist/evals/capture.d.ts.map +1 -0
- package/dist/evals/capture.js +419 -0
- package/dist/evals/capture.js.map +1 -0
- package/dist/evals/replay.d.ts +33 -0
- package/dist/evals/replay.d.ts.map +1 -0
- package/dist/evals/replay.js +87 -0
- package/dist/evals/replay.js.map +1 -0
- package/dist/evals/routes.d.ts +48 -0
- package/dist/evals/routes.d.ts.map +1 -0
- package/dist/evals/routes.js +121 -0
- package/dist/evals/routes.js.map +1 -0
- package/dist/evals/run-cli.d.ts +31 -0
- package/dist/evals/run-cli.d.ts.map +1 -0
- package/dist/evals/run-cli.js +128 -0
- package/dist/evals/run-cli.js.map +1 -0
- package/dist/evals/runner.d.ts +34 -0
- package/dist/evals/runner.d.ts.map +1 -0
- package/dist/evals/runner.js +181 -0
- package/dist/evals/runner.js.map +1 -0
- package/dist/evals/score.d.ts +31 -0
- package/dist/evals/score.d.ts.map +1 -0
- package/dist/evals/score.js +191 -0
- package/dist/evals/score.js.map +1 -0
- package/dist/evals/seed-needs-you.d.ts +17 -0
- package/dist/evals/seed-needs-you.d.ts.map +1 -0
- package/dist/evals/seed-needs-you.js +57 -0
- package/dist/evals/seed-needs-you.js.map +1 -0
- package/dist/evals/seed-rig.d.ts +9 -0
- package/dist/evals/seed-rig.d.ts.map +1 -0
- package/dist/evals/seed-rig.js +156 -0
- package/dist/evals/seed-rig.js.map +1 -0
- package/dist/evals/stats.d.ts +31 -0
- package/dist/evals/stats.d.ts.map +1 -0
- package/dist/evals/stats.js +59 -0
- package/dist/evals/stats.js.map +1 -0
- package/dist/evals/steering.d.ts +9 -0
- package/dist/evals/steering.d.ts.map +1 -0
- package/dist/evals/steering.js +25 -0
- package/dist/evals/steering.js.map +1 -0
- package/dist/evals/store.d.ts +26 -0
- package/dist/evals/store.d.ts.map +1 -0
- package/dist/evals/store.js +96 -0
- package/dist/evals/store.js.map +1 -0
- package/dist/evals/synthetic.d.ts +17 -0
- package/dist/evals/synthetic.d.ts.map +1 -0
- package/dist/evals/synthetic.js +71 -0
- package/dist/evals/synthetic.js.map +1 -0
- package/dist/evals/types.d.ts +29 -0
- package/dist/evals/types.d.ts.map +1 -0
- package/dist/evals/types.js +25 -0
- package/dist/evals/types.js.map +1 -0
- package/dist/evals/workflow.d.ts +33 -0
- package/dist/evals/workflow.d.ts.map +1 -0
- package/dist/evals/workflow.js +66 -0
- package/dist/evals/workflow.js.map +1 -0
- package/dist/insights/analyze-cli.d.ts +18 -0
- package/dist/insights/analyze-cli.d.ts.map +1 -0
- package/dist/insights/analyze-cli.js +71 -0
- package/dist/insights/analyze-cli.js.map +1 -0
- package/dist/insights/analyze.d.ts +136 -0
- package/dist/insights/analyze.d.ts.map +1 -0
- package/dist/insights/analyze.js +358 -0
- package/dist/insights/analyze.js.map +1 -0
- package/dist/insights/review-service.d.ts +127 -0
- package/dist/insights/review-service.d.ts.map +1 -0
- package/dist/insights/review-service.js +392 -0
- package/dist/insights/review-service.js.map +1 -0
- package/dist/insights/routes.d.ts +15 -0
- package/dist/insights/routes.d.ts.map +1 -0
- package/dist/insights/routes.js +66 -0
- package/dist/insights/routes.js.map +1 -0
- package/dist/insights/run-facts.d.ts +64 -0
- package/dist/insights/run-facts.d.ts.map +1 -0
- package/dist/insights/run-facts.js +152 -0
- package/dist/insights/run-facts.js.map +1 -0
- package/dist/insights/stats.d.ts +38 -0
- package/dist/insights/stats.d.ts.map +1 -0
- package/dist/insights/stats.js +102 -0
- package/dist/insights/stats.js.map +1 -0
- package/dist/insights/store.d.ts +89 -0
- package/dist/insights/store.d.ts.map +1 -0
- package/dist/insights/store.js +87 -0
- package/dist/insights/store.js.map +1 -0
- package/dist/insights/workflow.d.ts +22 -0
- package/dist/insights/workflow.d.ts.map +1 -0
- package/dist/insights/workflow.js +39 -0
- package/dist/insights/workflow.js.map +1 -0
- package/dist/qe/ledger.d.ts +15 -0
- package/dist/qe/ledger.d.ts.map +1 -1
- package/dist/qe/ledger.js +24 -0
- package/dist/qe/ledger.js.map +1 -1
- package/dist/schedules/routes.d.ts +48 -0
- package/dist/schedules/routes.d.ts.map +1 -0
- package/dist/schedules/routes.js +72 -0
- package/dist/schedules/routes.js.map +1 -0
- package/dist/schedules/scheduler.d.ts +58 -0
- package/dist/schedules/scheduler.d.ts.map +1 -0
- package/dist/schedules/scheduler.js +194 -0
- package/dist/schedules/scheduler.js.map +1 -0
- package/dist/schedules/store.d.ts +67 -0
- package/dist/schedules/store.d.ts.map +1 -0
- package/dist/schedules/store.js +148 -0
- package/dist/schedules/store.js.map +1 -0
- package/dist/skills/runtime.d.ts +12 -2
- package/dist/skills/runtime.d.ts.map +1 -1
- package/dist/skills/runtime.js +27 -1
- package/dist/skills/runtime.js.map +1 -1
- package/dist/team/routes.d.ts +10 -0
- package/dist/team/routes.d.ts.map +1 -1
- package/dist/team/routes.js +3 -0
- package/dist/team/routes.js.map +1 -1
- package/endpoint-manifest.json +132 -1
- package/package.json +4 -3
- package/workflows/review-recent-work.json +54 -0
- package/workflows/run-evals.json +29 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The statistics the default evals stand on (DES-DEFAULT-EVALS-001 §6, the same rules as DES-RUNS-REVIEW-001 §4).
|
|
3
|
+
* Pure and deterministic: the same cases give the same numbers, byte for byte.
|
|
4
|
+
*
|
|
5
|
+
* - Rates: the Wilson score interval (95 %), honest at small n and always inside [0, 1].
|
|
6
|
+
* - Below {@link MIN_CASES} a figure is "too few cases": the value is still shown, no trend is called.
|
|
7
|
+
* - Calibration (ECE over 10 bins, Brier) needs {@link MIN_CALIBRATION} confident answers.
|
|
8
|
+
*
|
|
9
|
+
* One statistics module: the Wilson interval and the comparison rule are the run review's (`insights/stats.ts`);
|
|
10
|
+
* this module only shapes them into the default evals' wire (`Rate`) and adds calibration.
|
|
11
|
+
*/
|
|
12
|
+
import type { Calibration, Rate, TrendWord } from './types.js';
|
|
13
|
+
export declare const MIN_CASES = 5;
|
|
14
|
+
export declare const MIN_CALIBRATION = 20;
|
|
15
|
+
export declare function round4(v: number | null): number | null;
|
|
16
|
+
/** Wilson score interval for `k` of `n` (95 %). Value and bounds are `null` when n is 0. */
|
|
17
|
+
export declare function rate(k: number, n: number, min?: number): Rate;
|
|
18
|
+
/** Calibration of a confidence against being right: ECE over 10 equal-width bins, and the Brier score. */
|
|
19
|
+
export declare function calibration(points: ReadonlyArray<{
|
|
20
|
+
confidence: number;
|
|
21
|
+
correct: boolean;
|
|
22
|
+
}>): Calibration;
|
|
23
|
+
/**
|
|
24
|
+
* This run's rate against the last run's point value, by the run review's rule (`compare`): notable only when both
|
|
25
|
+
* reach {@link MIN_CASES} and this run's interval EXCLUDES the previous value. Higher agreement is better.
|
|
26
|
+
*/
|
|
27
|
+
export declare function trendOf(now: Rate, previous: {
|
|
28
|
+
value: number | null;
|
|
29
|
+
n: number;
|
|
30
|
+
} | null): TrendWord;
|
|
31
|
+
//# sourceMappingURL=stats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/evals/stats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE/D,eAAO,MAAM,SAAS,IAAa,CAAC;AACpC,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAEtD;AAED,4FAA4F;AAC5F,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,SAAY,GAAG,IAAI,CAIhE;AAED,0GAA0G;AAC1G,wBAAgB,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,GAAG,WAAW,CAgBxG;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE;IAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,CAMlG"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The statistics the default evals stand on (DES-DEFAULT-EVALS-001 §6, the same rules as DES-RUNS-REVIEW-001 §4).
|
|
3
|
+
* Pure and deterministic: the same cases give the same numbers, byte for byte.
|
|
4
|
+
*
|
|
5
|
+
* - Rates: the Wilson score interval (95 %), honest at small n and always inside [0, 1].
|
|
6
|
+
* - Below {@link MIN_CASES} a figure is "too few cases": the value is still shown, no trend is called.
|
|
7
|
+
* - Calibration (ECE over 10 bins, Brier) needs {@link MIN_CALIBRATION} confident answers.
|
|
8
|
+
*
|
|
9
|
+
* One statistics module: the Wilson interval and the comparison rule are the run review's (`insights/stats.ts`);
|
|
10
|
+
* this module only shapes them into the default evals' wire (`Rate`) and adds calibration.
|
|
11
|
+
*/
|
|
12
|
+
import { compare, MIN_SAMPLE, wilson } from '../insights/stats.js';
|
|
13
|
+
export const MIN_CASES = MIN_SAMPLE;
|
|
14
|
+
export const MIN_CALIBRATION = 20;
|
|
15
|
+
export function round4(v) {
|
|
16
|
+
return v === null ? null : Math.round(v * 10_000) / 10_000;
|
|
17
|
+
}
|
|
18
|
+
/** Wilson score interval for `k` of `n` (95 %). Value and bounds are `null` when n is 0. */
|
|
19
|
+
export function rate(k, n, min = MIN_CASES) {
|
|
20
|
+
const iv = wilson(k, n);
|
|
21
|
+
if (n <= 0 || iv === null)
|
|
22
|
+
return { k: 0, n: 0, value: null, lo: null, hi: null, tooFew: true };
|
|
23
|
+
return { k, n, value: round4(k / n), lo: round4(iv.lo), hi: round4(iv.hi), tooFew: n < min };
|
|
24
|
+
}
|
|
25
|
+
/** Calibration of a confidence against being right: ECE over 10 equal-width bins, and the Brier score. */
|
|
26
|
+
export function calibration(points) {
|
|
27
|
+
const n = points.length;
|
|
28
|
+
if (n < MIN_CALIBRATION)
|
|
29
|
+
return { n, ece: null, brier: null, tooFew: true };
|
|
30
|
+
const bins = Array.from({ length: 10 }, () => ({ n: 0, conf: 0, right: 0 }));
|
|
31
|
+
let brier = 0;
|
|
32
|
+
for (const p of points) {
|
|
33
|
+
const c = Math.min(1, Math.max(0, p.confidence));
|
|
34
|
+
const b = bins[Math.min(9, Math.floor(c * 10))];
|
|
35
|
+
b.n += 1;
|
|
36
|
+
b.conf += c;
|
|
37
|
+
b.right += p.correct ? 1 : 0;
|
|
38
|
+
brier += (c - (p.correct ? 1 : 0)) ** 2;
|
|
39
|
+
}
|
|
40
|
+
let ece = 0;
|
|
41
|
+
for (const b of bins)
|
|
42
|
+
if (b.n > 0)
|
|
43
|
+
ece += (b.n / n) * Math.abs(b.right / b.n - b.conf / b.n);
|
|
44
|
+
return { n, ece: round4(ece), brier: round4(brier / n), tooFew: false };
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* This run's rate against the last run's point value, by the run review's rule (`compare`): notable only when both
|
|
48
|
+
* reach {@link MIN_CASES} and this run's interval EXCLUDES the previous value. Higher agreement is better.
|
|
49
|
+
*/
|
|
50
|
+
export function trendOf(now, previous) {
|
|
51
|
+
if (previous === null)
|
|
52
|
+
return 'first-run';
|
|
53
|
+
// A rate marked too few (a caller's own minimum can be above five) never gets a trend (codex/agy r1 on #1167).
|
|
54
|
+
if (now.tooFew)
|
|
55
|
+
return 'too-few';
|
|
56
|
+
const iv = now.lo !== null && now.hi !== null ? { lo: now.lo, hi: now.hi } : null;
|
|
57
|
+
return compare(now.n, iv, previous.n, previous.value, true);
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=stats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stats.js","sourceRoot":"","sources":["../../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C,CAAC,CAAC,CAAC,CAAC;IAC7F,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC1E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,GAAS,EAAE,QAAoD;IACrF,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,WAAW,CAAC;IAC1C,+GAA+G;IAC/G,IAAI,GAAG,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IACjC,MAAM,EAAE,GAAoB,GAAG,CAAC,EAAE,KAAK,IAAI,IAAI,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACnG,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S5 steering firing, folded from the steering evals the daemon already runs (core `governanceEvals`, stored by
|
|
3
|
+
* crew's eval-store). No second mechanism: the latest stored run's per-sample results become cases. The built-in
|
|
4
|
+
* dev-behaviors corpus is synthetic by nature; an imported `evals:<name>` corpus is the operator's own (real).
|
|
5
|
+
*/
|
|
6
|
+
import type { EvalRunDetail } from '../core/types.js';
|
|
7
|
+
import type { EvalCase } from './types.js';
|
|
8
|
+
export declare function steeringCasesFrom(detail: EvalRunDetail | null): EvalCase[];
|
|
9
|
+
//# sourceMappingURL=steering.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steering.d.ts","sourceRoot":"","sources":["../../src/evals/steering.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,GAAG,QAAQ,EAAE,CAiB1E"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S5 steering firing, folded from the steering evals the daemon already runs (core `governanceEvals`, stored by
|
|
3
|
+
* crew's eval-store). No second mechanism: the latest stored run's per-sample results become cases. The built-in
|
|
4
|
+
* dev-behaviors corpus is synthetic by nature; an imported `evals:<name>` corpus is the operator's own (real).
|
|
5
|
+
*/
|
|
6
|
+
export function steeringCasesFrom(detail) {
|
|
7
|
+
if (detail === null)
|
|
8
|
+
return [];
|
|
9
|
+
const real = detail.corpus !== null;
|
|
10
|
+
return detail.results.map((r) => ({
|
|
11
|
+
id: `steering:eval:${detail.id}:${r.sample.id}`,
|
|
12
|
+
suite: 'steering',
|
|
13
|
+
source: real ? 'real' : 'synthetic',
|
|
14
|
+
project: null,
|
|
15
|
+
inputKey: `steering:${r.sample.steering_type}:${r.sample.id}`,
|
|
16
|
+
input: { sample: r.sample.id, steering_type: r.sample.steering_type, corpus: detail.corpus ?? 'built-in' },
|
|
17
|
+
observed: { label: r.fired.length > 0 ? 'block' : 'allow', by: 'replay' },
|
|
18
|
+
expected: {
|
|
19
|
+
label: r.expected === 'deny' ? 'block' : 'allow',
|
|
20
|
+
by: real ? 'operator' : 'fixture',
|
|
21
|
+
why: `a ${r.sample.kind} sample`,
|
|
22
|
+
},
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=steering.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steering.js","sourceRoot":"","sources":["../../src/evals/steering.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,MA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: beside the steering evals, under the daemon state home.
|
|
3
|
+
*
|
|
4
|
+
* <home>/evals/default/runs.jsonl one {@link DefaultEvalSummary} per line (the list)
|
|
5
|
+
* <home>/evals/default/results/<id>.json the full report and its cases (the drilldown)
|
|
6
|
+
*
|
|
7
|
+
* Same posture as `api/eval-store.ts`: the detail is written first (tmp + rename), then the index line, so every
|
|
8
|
+
* listed row has a readable detail; a torn line is skipped on read, never the store.
|
|
9
|
+
*/
|
|
10
|
+
import type { DefaultEvalDetail, DefaultEvalSummary } from './types.js';
|
|
11
|
+
import { type PreviousScores } from './runner.js';
|
|
12
|
+
/** `<eval store root>/default`: the steering eval store's root (its env override, else the state home's `evals`). */
|
|
13
|
+
export declare function defaultEvalsRoot(env?: NodeJS.ProcessEnv): string;
|
|
14
|
+
export type { DefaultEvalDetail };
|
|
15
|
+
export declare class DefaultEvalStore {
|
|
16
|
+
private readonly root;
|
|
17
|
+
constructor(root?: string);
|
|
18
|
+
record(detail: DefaultEvalDetail): Promise<DefaultEvalSummary>;
|
|
19
|
+
/** Newest first. */
|
|
20
|
+
list(): Promise<DefaultEvalSummary[]>;
|
|
21
|
+
get(id: string): Promise<DefaultEvalDetail | null>;
|
|
22
|
+
/** Per suite, the most recent stored score of the same scope (`null` project = every project). A run that
|
|
23
|
+
* skipped a suite is passed over for that suite, so a narrower run never erases a trend baseline. */
|
|
24
|
+
previous(project: string | null): Promise<PreviousScores>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/evals/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAA6B,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAK7E,qHAAqH;AACrH,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAE7E;AAED,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAIlC,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,GAAE,MAA2B;IAExD,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAapE,oBAAoB;IACd,IAAI,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAqBrC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IASxD;0GACsG;IAChG,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,cAAc,CAAC;CAYhE"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where default-eval runs are kept: beside the steering evals, under the daemon state home.
|
|
3
|
+
*
|
|
4
|
+
* <home>/evals/default/runs.jsonl one {@link DefaultEvalSummary} per line (the list)
|
|
5
|
+
* <home>/evals/default/results/<id>.json the full report and its cases (the drilldown)
|
|
6
|
+
*
|
|
7
|
+
* Same posture as `api/eval-store.ts`: the detail is written first (tmp + rename), then the index line, so every
|
|
8
|
+
* listed row has a readable detail; a torn line is skipped on read, never the store.
|
|
9
|
+
*/
|
|
10
|
+
import { appendFile, mkdir, readFile, rename, writeFile } from 'node:fs/promises';
|
|
11
|
+
import { join } from 'node:path';
|
|
12
|
+
import { defaultEvalStoreRoot } from '../api/eval-store.js';
|
|
13
|
+
import { previousScores, summarize } from './runner.js';
|
|
14
|
+
import { SUITE_IDS } from './types.js';
|
|
15
|
+
const SUITE_COUNT = SUITE_IDS.length;
|
|
16
|
+
/** `<eval store root>/default`: the steering eval store's root (its env override, else the state home's `evals`). */
|
|
17
|
+
export function defaultEvalsRoot(env = process.env) {
|
|
18
|
+
return join(defaultEvalStoreRoot(env), 'default');
|
|
19
|
+
}
|
|
20
|
+
const SAFE_ID = /^[A-Za-z0-9_-]{1,80}$/;
|
|
21
|
+
export class DefaultEvalStore {
|
|
22
|
+
root;
|
|
23
|
+
constructor(root = defaultEvalsRoot()) {
|
|
24
|
+
this.root = root;
|
|
25
|
+
}
|
|
26
|
+
async record(detail) {
|
|
27
|
+
if (!SAFE_ID.test(detail.report.id))
|
|
28
|
+
throw new Error(`default evals: unsafe run id ${detail.report.id}`);
|
|
29
|
+
const results = join(this.root, 'results');
|
|
30
|
+
await mkdir(results, { recursive: true });
|
|
31
|
+
const file = join(results, `${detail.report.id}.json`);
|
|
32
|
+
const tmp = `${file}.tmp.${process.pid}`;
|
|
33
|
+
await writeFile(tmp, JSON.stringify(detail));
|
|
34
|
+
await rename(tmp, file);
|
|
35
|
+
const summary = summarize(detail.report);
|
|
36
|
+
await appendFile(join(this.root, 'runs.jsonl'), `${JSON.stringify(summary)}\n`);
|
|
37
|
+
return summary;
|
|
38
|
+
}
|
|
39
|
+
/** Newest first. */
|
|
40
|
+
async list() {
|
|
41
|
+
let text;
|
|
42
|
+
try {
|
|
43
|
+
text = await readFile(join(this.root, 'runs.jsonl'), 'utf8');
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
if (err.code === 'ENOENT')
|
|
47
|
+
return [];
|
|
48
|
+
throw err;
|
|
49
|
+
}
|
|
50
|
+
const rows = [];
|
|
51
|
+
for (const line of text.split('\n')) {
|
|
52
|
+
if (line.trim() === '')
|
|
53
|
+
continue;
|
|
54
|
+
try {
|
|
55
|
+
const row = JSON.parse(line);
|
|
56
|
+
if (typeof row.id === 'string' && typeof row.createdAt === 'string')
|
|
57
|
+
rows.push(row);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
// a torn line degrades one row, never the list
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return rows.reverse();
|
|
64
|
+
}
|
|
65
|
+
async get(id) {
|
|
66
|
+
if (!SAFE_ID.test(id))
|
|
67
|
+
return null;
|
|
68
|
+
try {
|
|
69
|
+
return JSON.parse(await readFile(join(this.root, 'results', `${id}.json`), 'utf8'));
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/** Per suite, the most recent stored score of the same scope (`null` project = every project). A run that
|
|
76
|
+
* skipped a suite is passed over for that suite, so a narrower run never erases a trend baseline. */
|
|
77
|
+
async previous(project) {
|
|
78
|
+
const out = {};
|
|
79
|
+
for (const row of await this.list()) {
|
|
80
|
+
if (row.project !== project)
|
|
81
|
+
continue;
|
|
82
|
+
if (row.suites !== undefined && row.suites.every((s) => out[s.suite] !== undefined))
|
|
83
|
+
continue;
|
|
84
|
+
const d = await this.get(row.id);
|
|
85
|
+
if (d === null)
|
|
86
|
+
continue;
|
|
87
|
+
for (const [k, v] of Object.entries(previousScores([d.report])))
|
|
88
|
+
if (out[k] === undefined)
|
|
89
|
+
out[k] = v;
|
|
90
|
+
if (Object.keys(out).length === SUITE_COUNT)
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
return out;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/evals/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,SAAS,EAAuB,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC;AAErC,qHAAqH;AACrH,M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CAAC,OAAsB;QACnC,MAAM,GAAG,GAAmB,EAAE,CAAC;QAC/B,KAAK,MAAM,GAAG,IAAI,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;YACpC,IAAI,GAAG,CAAC,OAAO,KAAK,OAAO;gBAAE,SAAS;YACtC,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC;gBAAE,SAAS;YAC9F,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACjC,IAAI,CAAC,KAAK,IAAI;gBAAE,SAAS;YACzB,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;gBAAE,IAAI,GAAG,CAAC,CAAyB,CAAC,KAAK,SAAS;oBAAE,GAAG,CAAC,CAAyB,CAAC,GAAG,CAAC,CAAC;YACtJ,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,WAAW;gBAAE,MAAM;QACrD,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synthetic cases for the edges real data does not cover yet (DES-DEFAULT-EVALS-001 §4). Seeded and deterministic:
|
|
3
|
+
* the same real cases in give the same synthetic cases out. A class gets synthetic cases only while it has fewer than
|
|
4
|
+
* {@link MIN_CASES} real ones, so synthetic data fills gaps and never outweighs what really happened.
|
|
5
|
+
*
|
|
6
|
+
* Synthetic cases carry their input and the expected answer (`by: 'fixture'`) and NO observation: a replay adapter
|
|
7
|
+
* (the current classifier, run on the input) supplies it. A suite with no replay adapter reports them as unscored.
|
|
8
|
+
*/
|
|
9
|
+
import type { EvalCase, SuiteId } from './types.js';
|
|
10
|
+
/** Which suites' synthetic cases a replay adapter can score (the rest are reported as unscored). */
|
|
11
|
+
export declare function syntheticSuites(): SuiteId[];
|
|
12
|
+
/**
|
|
13
|
+
* Synthetic cases for every class that has fewer than {@link MIN_CASES} people-labelled real cases. Templates are
|
|
14
|
+
* taken in order, so the result is deterministic; a class with no template left stops short and says nothing more.
|
|
15
|
+
*/
|
|
16
|
+
export declare function generateSynthetic(real: readonly EvalCase[]): EvalCase[];
|
|
17
|
+
//# sourceMappingURL=synthetic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synthetic.d.ts","sourceRoot":"","sources":["../../src/evals/synthetic.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAyCpD,oGAAoG;AACpG,wBAAgB,eAAe,IAAI,OAAO,EAAE,CAE3C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,QAAQ,EAAE,GAAG,QAAQ,EAAE,CAqBvE"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synthetic cases for the edges real data does not cover yet (DES-DEFAULT-EVALS-001 §4). Seeded and deterministic:
|
|
3
|
+
* the same real cases in give the same synthetic cases out. A class gets synthetic cases only while it has fewer than
|
|
4
|
+
* {@link MIN_CASES} real ones, so synthetic data fills gaps and never outweighs what really happened.
|
|
5
|
+
*
|
|
6
|
+
* Synthetic cases carry their input and the expected answer (`by: 'fixture'`) and NO observation: a replay adapter
|
|
7
|
+
* (the current classifier, run on the input) supplies it. A suite with no replay adapter reports them as unscored.
|
|
8
|
+
*/
|
|
9
|
+
import { MIN_CASES } from './stats.js';
|
|
10
|
+
import { isModelLabelled } from './score.js';
|
|
11
|
+
/** Archetype prompts: short, plain, one per line of work, with the edges the regex is known to miss. */
|
|
12
|
+
const ARCHETYPE = [
|
|
13
|
+
{ label: 'build', inputs: ['Add a median(xs) function to src/math.js with tests', 'Implement retry with backoff in the uploader', 'Fix the off-by-one in pagination', 'Make the export button stop hanging', 'Wire the new settings toggle to the API', 'The login page crashes on submit; fix it'].map((prompt) => ({ prompt })) },
|
|
14
|
+
{ label: 'review', inputs: ['Review PR 1152 for correctness', 'Look over this diff and tell me what is risky', 'Is this migration safe to merge?', 'Check the security of the new upload endpoint', 'Give me a code review of src/actor.rs changes'].map((prompt) => ({ prompt })) },
|
|
15
|
+
{ label: 'explore', inputs: ['Where is wicked-core riskiest to change?', 'How does the floor decide base red?', 'What calls resolveAcceptanceGate?', 'Explain how judges are picked', 'Which modules depend on the event log?'].map((prompt) => ({ prompt })) },
|
|
16
|
+
{ label: 'specify', inputs: ['Write the requirements for project-scoped memories', 'Draft acceptance criteria for the needs-you count', 'Spec out the scheduler API before we build it', 'What should the evals results page show? Write it up as a spec', 'Define the wire shape for default eval reports'].map((prompt) => ({ prompt })) },
|
|
17
|
+
{ label: 'decide', inputs: ['Should we use Wilson or bootstrap intervals here?', 'Pick between SQLite and JSONL for the eval store', 'Do we merge red-base runs into one item or keep them separate?', 'Which seat should judge by default, codex or claude?', 'Choose: one statistics module or two?'].map((prompt) => ({ prompt })) },
|
|
18
|
+
{ label: 'incident', inputs: ['The gateway is down and every run fails with 503', 'Production deploy is failing right now, help', 'All seats are benched and nothing runs', 'The daemon crashed on boot after the upgrade', 'CI is red on main for every PR since an hour ago'].map((prompt) => ({ prompt })) },
|
|
19
|
+
{ label: 'ship', inputs: ['Cut the 0.16.4 release', 'Publish core-ts to npm', 'Tag and release the studio bundle', 'Ship this branch: merge and release', 'Prepare the release notes and tag v1.2.0'].map((prompt) => ({ prompt })) },
|
|
20
|
+
{ label: 'migrate', inputs: ['Migrate the eval store from JSONL to SQLite', 'Upgrade vitest 4 to 5 across the repo', 'Move learn onto the generic scheduler', 'Port the hooks from Python to TypeScript', 'Rename the wire field ask_turn everywhere'].map((prompt) => ({ prompt })) },
|
|
21
|
+
{ label: 'none', inputs: ['Say hi.', 'thanks', 'ok go ahead', 'good', 'what time is it?'].map((prompt) => ({ prompt })) },
|
|
22
|
+
];
|
|
23
|
+
/** Floor evidence shapes, one per class. Unscored until core exposes a replay entry for the floor class. */
|
|
24
|
+
const FLOOR = [
|
|
25
|
+
{ label: 'pass', inputs: [{ condition: null, denialSource: null, failing: [] }] },
|
|
26
|
+
{ label: 'real_fail', inputs: [{ condition: 'floor_failed', denialSource: 'repo_checks', failing: ['test'], headOnly: 2, baseFailing: 0 }] },
|
|
27
|
+
{ label: 'base_red', inputs: [{ condition: 'floor_failed', denialSource: 'repo_checks', failing: ['test'], headOnly: 0, baseFailing: 12 }] },
|
|
28
|
+
{ label: 'inconclusive', inputs: [{ condition: 'floor_failed', denialSource: 'repo_checks_timeout', failing: ['test'] }, { condition: 'floor_failed', denialSource: 'repo_checks', failing: ['test'], flaky: true }] },
|
|
29
|
+
{ label: 'boundary_deny', inputs: [{ condition: 'boundary_deny', denialSource: 'input_governance', failing: [], refusedTool: 'Write' }] },
|
|
30
|
+
];
|
|
31
|
+
const QE = [
|
|
32
|
+
{ label: 'PASS', inputs: [{ reason: 'All criteria satisfied from captured evidence.' }] },
|
|
33
|
+
{ label: 'FAIL', inputs: [{ reason: 'FAIL: the new test fails on the change; criterion 2 is not met.' }] },
|
|
34
|
+
{ label: 'INCONCLUSIVE', inputs: [{ reason: 'inconclusive: ENVIRONMENT_ISSUE, the test runner could not start on the seat.' }] },
|
|
35
|
+
];
|
|
36
|
+
const TEMPLATES = {
|
|
37
|
+
archetype: { templates: ARCHETYPE, replayable: true },
|
|
38
|
+
'floor-class': { templates: FLOOR, replayable: false },
|
|
39
|
+
'qe-verdict': { templates: QE, replayable: false },
|
|
40
|
+
};
|
|
41
|
+
/** Which suites' synthetic cases a replay adapter can score (the rest are reported as unscored). */
|
|
42
|
+
export function syntheticSuites() {
|
|
43
|
+
return Object.keys(TEMPLATES);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Synthetic cases for every class that has fewer than {@link MIN_CASES} people-labelled real cases. Templates are
|
|
47
|
+
* taken in order, so the result is deterministic; a class with no template left stops short and says nothing more.
|
|
48
|
+
*/
|
|
49
|
+
export function generateSynthetic(real) {
|
|
50
|
+
const out = [];
|
|
51
|
+
for (const [suite, spec] of Object.entries(TEMPLATES)) {
|
|
52
|
+
for (const t of spec.templates) {
|
|
53
|
+
const have = real.filter((c) => c.suite === suite && c.source === 'real' && !isModelLabelled(c) && c.expected.label === t.label).length;
|
|
54
|
+
const need = Math.max(0, MIN_CASES - have);
|
|
55
|
+
t.inputs.slice(0, need).forEach((input, i) => {
|
|
56
|
+
out.push({
|
|
57
|
+
id: `${suite}:synthetic:${t.label}:${i}`,
|
|
58
|
+
suite,
|
|
59
|
+
source: 'synthetic',
|
|
60
|
+
project: null,
|
|
61
|
+
inputKey: `${suite}:synthetic:${t.label}:${i}`,
|
|
62
|
+
input,
|
|
63
|
+
observed: null,
|
|
64
|
+
expected: { label: t.label, by: 'fixture', why: 'generated for a class with too few real cases' },
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return out;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=synthetic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synthetic.js","sourceRoot":"","sources":["../../src/evals/synthetic.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAQ7C,wGAAwG;AACxG,MAAM,SAAS,GAAe;IAC5B,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,qDAAqD,EAAE,8CAA8C,EAAE,kCAAkC,EAAE,qCAAqC,EAAE,yCAAyC,EAAE,0CAA0C,CA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
+
*
|
|
4
|
+
* Every suite uses ONE case shape. A case pairs what the system decided (`observed`) with what it should have
|
|
5
|
+
* decided (`expected`), plus where each came from. Real cases are captured from the run store, so the operator's
|
|
6
|
+
* answer at a gate is the label; synthetic cases come from a seeded generator and need a replay adapter (the current
|
|
7
|
+
* classifier run on the case's input) to be scored. The two are never mixed in one figure: a report always gives
|
|
8
|
+
* real, synthetic and combined side by side.
|
|
9
|
+
*/
|
|
10
|
+
import type * as W from 'wicked-crew-api-types';
|
|
11
|
+
/** The eight inference points (DES §2). */
|
|
12
|
+
export declare const SUITE_IDS: readonly ["needs-you", "floor-class", "qe-verdict", "attribution", "steering", "recall", "archetype", "normalization"];
|
|
13
|
+
export type SuiteId = (typeof SUITE_IDS)[number];
|
|
14
|
+
export type CaseSource = W.DefaultEvalCaseSource;
|
|
15
|
+
export type LabelBy = W.DefaultEvalLabelBy;
|
|
16
|
+
export type Answer = W.DefaultEvalAnswer;
|
|
17
|
+
export type Observed = W.DefaultEvalObserved;
|
|
18
|
+
export type Expected = W.DefaultEvalExpected;
|
|
19
|
+
export type CaseEvidence = W.DefaultEvalCaseEvidence;
|
|
20
|
+
export type EvalCase = W.DefaultEvalCase;
|
|
21
|
+
export type Rate = W.DefaultEvalRate;
|
|
22
|
+
export type ClassScore = W.DefaultEvalClassScore;
|
|
23
|
+
export type Calibration = W.DefaultEvalCalibration;
|
|
24
|
+
export type SliceScore = W.DefaultEvalSliceScore;
|
|
25
|
+
export type TrendWord = W.DefaultEvalTrend;
|
|
26
|
+
export type SuiteScore = W.DefaultEvalSuiteScore;
|
|
27
|
+
export type DriftKey = W.DefaultEvalDriftKey;
|
|
28
|
+
export type { DefaultEvalReport, DefaultEvalSummary, DefaultEvalDetail, DefaultEvalSuitesResponse, RunDefaultEvalsBody, ListDefaultEvalRunsResponse, } from 'wicked-crew-api-types';
|
|
29
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.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Default evals (DES-DEFAULT-EVALS-001): the system's own judgments, tested against what really happened.
|
|
3
|
+
*
|
|
4
|
+
* Every suite uses ONE case shape. A case pairs what the system decided (`observed`) with what it should have
|
|
5
|
+
* decided (`expected`), plus where each came from. Real cases are captured from the run store, so the operator's
|
|
6
|
+
* answer at a gate is the label; synthetic cases come from a seeded generator and need a replay adapter (the current
|
|
7
|
+
* classifier run on the case's input) to be scored. The two are never mixed in one figure: a report always gives
|
|
8
|
+
* real, synthetic and combined side by side.
|
|
9
|
+
*/
|
|
10
|
+
/** The eight inference points (DES §2). */
|
|
11
|
+
export const SUITE_IDS = [
|
|
12
|
+
'needs-you',
|
|
13
|
+
'floor-class',
|
|
14
|
+
'qe-verdict',
|
|
15
|
+
'attribution',
|
|
16
|
+
'steering',
|
|
17
|
+
'recall',
|
|
18
|
+
'archetype',
|
|
19
|
+
'normalization',
|
|
20
|
+
];
|
|
21
|
+
// The wire contract lives in wicked-crew-api-types (studio builds against it); these are crew's short names.
|
|
22
|
+
// A suite id added on one side and not the other fails here at compile time.
|
|
23
|
+
const _sameSuites = true;
|
|
24
|
+
void _sameSuites;
|
|
25
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/evals/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,2CAA2C;AAC3C,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,WAAW;IACX,aAAa;IACb,YAAY;IACZ,aAAa;IACb,UAAU;IACV,QAAQ;IACR,WAAW;IACX,eAAe;CACP,CAAC;AAGX,6GAA6G;AAC7G,6EAA6E;AAC7E,MAAM,WAAW,GAAyG,IAAI,CAAC;AAC/H,KAAK,WAAW,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `run-evals` workflow (DES-DEFAULT-EVALS-001 §7) is DATA: `packages/crew/workflows/run-evals.json`. This module
|
|
3
|
+
* reads it, fills its host tokens (`{node}`, `{run_cli}`, `{runs_dir}`) and hands it to the engine, which validates it
|
|
4
|
+
* (`adapter.registerWorkflow`), exactly as the run review's def is handled (`insights/workflow.ts`).
|
|
5
|
+
*
|
|
6
|
+
* The daemon runs the evals itself when it launches the workflow ({@link prepareRunEvalsLaunch}): every launch (a
|
|
7
|
+
* schedule, `/workflow-run-evals`, `POST /runs`) scores this daemon's store in-process, keeps the report where
|
|
8
|
+
* Evaluate reads it, and writes a copy to `<runs dir>/<run>/report.json`. The Tool step only reads that copy back
|
|
9
|
+
* (`run-cli --runs-dir`, found by `$WICKED_RUN_ID`), so it needs no network, no daemon URL and no credentials: a Tool
|
|
10
|
+
* step's environment is cleared to the validator allowlist, and a daemon with required auth would refuse an
|
|
11
|
+
* unauthenticated call anyway.
|
|
12
|
+
*/
|
|
13
|
+
import type { LaunchRunInput, WorkflowDef } from '../core/types.js';
|
|
14
|
+
import type { DefaultEvalReport } from './types.js';
|
|
15
|
+
export declare const RUN_EVALS_WORKFLOW = "run-evals";
|
|
16
|
+
export declare const RUN_EVALS_WORKFLOW_FILE: string;
|
|
17
|
+
/** The Tool step's script beside this module (`.js` in dist). */
|
|
18
|
+
export declare const RUN_EVALS_CLI: string;
|
|
19
|
+
/** Where each run's report copy lives: outside the daemon state home (the worker fence), like the reviews. */
|
|
20
|
+
export declare function defaultEvalRunsDir(env?: NodeJS.ProcessEnv): string;
|
|
21
|
+
export interface RunEvalsTokens {
|
|
22
|
+
node: string;
|
|
23
|
+
runCli: string;
|
|
24
|
+
runsDir: string;
|
|
25
|
+
}
|
|
26
|
+
export declare function fillRunEvalsWorkflow(raw: unknown, tokens: RunEvalsTokens): WorkflowDef;
|
|
27
|
+
export declare function loadRunEvalsWorkflow(tokens: RunEvalsTokens, file?: string): WorkflowDef;
|
|
28
|
+
/**
|
|
29
|
+
* Prepare a `run-evals` launch: run the evals now (`run`, which also keeps the report), write the copy the Tool step
|
|
30
|
+
* reads, and make the launch repo-less, delivering nothing, on no seat.
|
|
31
|
+
*/
|
|
32
|
+
export declare function prepareRunEvalsLaunch(input: LaunchRunInput, run: () => Promise<DefaultEvalReport>, runsDir?: string): Promise<DefaultEvalReport>;
|
|
33
|
+
//# sourceMappingURL=workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/evals/workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,eAAO,MAAM,kBAAkB,cAAc,CAAC;AAC9C,eAAO,MAAM,uBAAuB,QAA4E,CAAC;AACjH,iEAAiE;AACjE,eAAO,MAAM,aAAa,QAA0D,CAAC;AAErF,8GAA8G;AAC9G,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAE/E;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAID,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,GAAG,WAAW,CAkBtF;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,SAA0B,GAAG,WAAW,CAExG;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,cAAc,EACrB,GAAG,EAAE,MAAM,OAAO,CAAC,iBAAiB,CAAC,EACrC,OAAO,GAAE,MAA6B,GACrC,OAAO,CAAC,iBAAiB,CAAC,CAU5B"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `run-evals` workflow (DES-DEFAULT-EVALS-001 §7) is DATA: `packages/crew/workflows/run-evals.json`. This module
|
|
3
|
+
* reads it, fills its host tokens (`{node}`, `{run_cli}`, `{runs_dir}`) and hands it to the engine, which validates it
|
|
4
|
+
* (`adapter.registerWorkflow`), exactly as the run review's def is handled (`insights/workflow.ts`).
|
|
5
|
+
*
|
|
6
|
+
* The daemon runs the evals itself when it launches the workflow ({@link prepareRunEvalsLaunch}): every launch (a
|
|
7
|
+
* schedule, `/workflow-run-evals`, `POST /runs`) scores this daemon's store in-process, keeps the report where
|
|
8
|
+
* Evaluate reads it, and writes a copy to `<runs dir>/<run>/report.json`. The Tool step only reads that copy back
|
|
9
|
+
* (`run-cli --runs-dir`, found by `$WICKED_RUN_ID`), so it needs no network, no daemon URL and no credentials: a Tool
|
|
10
|
+
* step's environment is cleared to the validator allowlist, and a daemon with required auth would refuse an
|
|
11
|
+
* unauthenticated call anyway.
|
|
12
|
+
*/
|
|
13
|
+
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
14
|
+
import { homedir } from 'node:os';
|
|
15
|
+
import { join } from 'node:path';
|
|
16
|
+
import { fileURLToPath } from 'node:url';
|
|
17
|
+
export const RUN_EVALS_WORKFLOW = 'run-evals';
|
|
18
|
+
export const RUN_EVALS_WORKFLOW_FILE = fileURLToPath(new URL('../../workflows/run-evals.json', import.meta.url));
|
|
19
|
+
/** The Tool step's script beside this module (`.js` in dist). */
|
|
20
|
+
export const RUN_EVALS_CLI = fileURLToPath(new URL('./run-cli.js', import.meta.url));
|
|
21
|
+
/** Where each run's report copy lives: outside the daemon state home (the worker fence), like the reviews. */
|
|
22
|
+
export function defaultEvalRunsDir(env = process.env) {
|
|
23
|
+
return env['WICKED_CREW_EVAL_RUNS_DIR'] ?? join(homedir(), '.wicked', 'evals');
|
|
24
|
+
}
|
|
25
|
+
const TOKEN = /\{[a-z_]+\}/u;
|
|
26
|
+
export function fillRunEvalsWorkflow(raw, tokens) {
|
|
27
|
+
for (const [k, v] of Object.entries(tokens)) {
|
|
28
|
+
if (typeof v !== 'string' || v.trim() === '')
|
|
29
|
+
throw new Error(`run-evals: the ${k} token is empty`);
|
|
30
|
+
}
|
|
31
|
+
const def = { ...raw };
|
|
32
|
+
delete def['$comment'];
|
|
33
|
+
const fill = (s) => s.replaceAll('{node}', tokens.node).replaceAll('{run_cli}', tokens.runCli).replaceAll('{runs_dir}', tokens.runsDir);
|
|
34
|
+
const phases = def['phases'].map((p) => {
|
|
35
|
+
const ex = p['executor'];
|
|
36
|
+
if (ex?.type !== 'tool' || !Array.isArray(ex.cmd))
|
|
37
|
+
return p;
|
|
38
|
+
return { ...p, executor: { type: 'tool', cmd: ex.cmd.map(fill) } };
|
|
39
|
+
});
|
|
40
|
+
const out = { ...def, phases };
|
|
41
|
+
// Any {token} left (a misspelt one in the def included) is a packaging error, never a literal argument.
|
|
42
|
+
const left = JSON.stringify(out.phases.map((p) => p.executor ?? null)).match(TOKEN);
|
|
43
|
+
if (left !== null)
|
|
44
|
+
throw new Error(`run-evals: token ${left[0]} was not filled`);
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
export function loadRunEvalsWorkflow(tokens, file = RUN_EVALS_WORKFLOW_FILE) {
|
|
48
|
+
return fillRunEvalsWorkflow(JSON.parse(readFileSync(file, 'utf8')), tokens);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Prepare a `run-evals` launch: run the evals now (`run`, which also keeps the report), write the copy the Tool step
|
|
52
|
+
* reads, and make the launch repo-less, delivering nothing, on no seat.
|
|
53
|
+
*/
|
|
54
|
+
export async function prepareRunEvalsLaunch(input, run, runsDir = defaultEvalRunsDir()) {
|
|
55
|
+
const report = await run();
|
|
56
|
+
const dir = join(runsDir, input.sessionId);
|
|
57
|
+
mkdirSync(dir, { recursive: true });
|
|
58
|
+
writeFileSync(join(dir, 'report.json'), JSON.stringify(report, null, 2));
|
|
59
|
+
input.workflow = RUN_EVALS_WORKFLOW;
|
|
60
|
+
input.clisJson = '[]';
|
|
61
|
+
delete input.repoRef;
|
|
62
|
+
if (input.problem === undefined || input.problem.trim() === '')
|
|
63
|
+
input.problem = 'Run the default evals across every project';
|
|
64
|
+
return report;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../../src/evals/workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKzC,MAAM,CAAC,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAC9C,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,gCAAgC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACjH,iEAAiE;AACjE,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAErF,8GAA8G;AAC9G,MAAM,UAAU,kBAAkB,CAAC,MAAyB,OAAO,CAAC,GAAG;IACrE,OAAO,GAAG,CAAC,2BAA2B,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AACjF,CAAC;AAQD,MAAM,KAAK,GAAG,cAAc,CAAC;AAE7B,MAAM,UAAU,oBAAoB,CAAC,GAAY,EAAE,MAAsB;IACvE,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5C,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,I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,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACjF,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,MAAsB,EAAE,IAAI,GAAG,uBAAuB;IACzF,OAAO,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAY,EAAE,MAAM,CAAC,CAAC;AACzF,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,KAAqB,EACrB,GAAqC,EACrC,UAAkB,kBAAkB,EAAE;IAEtC,MAAM,MAAM,GAAG,MAAM,GAAG,EAAE,CAAC;IAC3B,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC3C,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACpC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACzE,KAAK,CAAC,QAAQ,GAAG,kBAAkB,CAAC;IACpC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC;IACtB,OAAQ,KAA8B,CAAC,OAAO,CAAC;IAC/C,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,KAAK,CAAC,OAAO,GAAG,4CAA4C,CAAC;IAC7H,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* The `review-recent-work` workflow's `analyze` Tool phase (DES-RUNS-REVIEW-001 §3): reads the snapshot crew
|
|
4
|
+
* prepared for this run and writes `facts.json` beside it. Deterministic; the model never runs here.
|
|
5
|
+
*
|
|
6
|
+
* node analyze-cli.js --reviews-dir <dir> # the run's dir is <dir>/$WICKED_RUN_ID (the engine sets it)
|
|
7
|
+
* node analyze-cli.js --dir <run dir> # explicit (tests, by hand)
|
|
8
|
+
*
|
|
9
|
+
* Exit 0 with a one-paragraph summary on stdout; exit 1 with the reason on stderr.
|
|
10
|
+
*/
|
|
11
|
+
import { type Facts } from './analyze.js';
|
|
12
|
+
export declare const SNAPSHOT_FILE = "snapshot.json";
|
|
13
|
+
export declare const FACTS_FILE = "facts.json";
|
|
14
|
+
export declare const REPORT_FILE = "report.json";
|
|
15
|
+
export declare function runDirFrom(argv: readonly string[], env: NodeJS.ProcessEnv): string;
|
|
16
|
+
export declare function summaryOf(f: Facts): string;
|
|
17
|
+
export declare function runAnalyze(dir: string): Facts;
|
|
18
|
+
//# sourceMappingURL=analyze-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze-cli.d.ts","sourceRoot":"","sources":["../../src/insights/analyze-cli.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG;AAKH,OAAO,EAAW,KAAK,KAAK,EAAiB,MAAM,cAAc,CAAC;AAElE,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAC7C,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC,eAAO,MAAM,WAAW,gBAAgB,CAAC;AAIzC,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAYlF;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM,CAO1C;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAW7C"}
|