poke-crucible 0.1.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 +21 -0
- package/README.md +192 -0
- package/dist/battle/pairing.d.ts +25 -0
- package/dist/battle/pairing.js +59 -0
- package/dist/battle/pairing.js.map +1 -0
- package/dist/battle/pool.d.ts +25 -0
- package/dist/battle/pool.js +97 -0
- package/dist/battle/pool.js.map +1 -0
- package/dist/battle/run-battle.d.ts +13 -0
- package/dist/battle/run-battle.js +49 -0
- package/dist/battle/run-battle.js.map +1 -0
- package/dist/battle/worker.d.ts +1 -0
- package/dist/battle/worker.js +21 -0
- package/dist/battle/worker.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +326 -0
- package/dist/cli.js.map +1 -0
- package/dist/critic/agent-sdk-model.d.ts +27 -0
- package/dist/critic/agent-sdk-model.js +21 -0
- package/dist/critic/agent-sdk-model.js.map +1 -0
- package/dist/critic/critique.d.ts +21 -0
- package/dist/critic/critique.js +51 -0
- package/dist/critic/critique.js.map +1 -0
- package/dist/critic/evidence.d.ts +24 -0
- package/dist/critic/evidence.js +17 -0
- package/dist/critic/evidence.js.map +1 -0
- package/dist/critic/llm.d.ts +34 -0
- package/dist/critic/llm.js +23 -0
- package/dist/critic/llm.js.map +1 -0
- package/dist/critic/parse.d.ts +5 -0
- package/dist/critic/parse.js +84 -0
- package/dist/critic/parse.js.map +1 -0
- package/dist/critic/prompt.d.ts +14 -0
- package/dist/critic/prompt.js +56 -0
- package/dist/critic/prompt.js.map +1 -0
- package/dist/critic/types.d.ts +52 -0
- package/dist/critic/types.js +2 -0
- package/dist/critic/types.js.map +1 -0
- package/dist/designer/agent-sdk-model.d.ts +30 -0
- package/dist/designer/agent-sdk-model.js +62 -0
- package/dist/designer/agent-sdk-model.js.map +1 -0
- package/dist/designer/design.d.ts +12 -0
- package/dist/designer/design.js +218 -0
- package/dist/designer/design.js.map +1 -0
- package/dist/designer/fitness.d.ts +25 -0
- package/dist/designer/fitness.js +24 -0
- package/dist/designer/fitness.js.map +1 -0
- package/dist/designer/model.d.ts +14 -0
- package/dist/designer/model.js +27 -0
- package/dist/designer/model.js.map +1 -0
- package/dist/designer/mutate.d.ts +31 -0
- package/dist/designer/mutate.js +209 -0
- package/dist/designer/mutate.js.map +1 -0
- package/dist/designer/rng.d.ts +17 -0
- package/dist/designer/rng.js +40 -0
- package/dist/designer/rng.js.map +1 -0
- package/dist/designer/types.d.ts +103 -0
- package/dist/designer/types.js +2 -0
- package/dist/designer/types.js.map +1 -0
- package/dist/evaluate.d.ts +11 -0
- package/dist/evaluate.js +99 -0
- package/dist/evaluate.js.map +1 -0
- package/dist/gauntlet/gauntlet.d.ts +18 -0
- package/dist/gauntlet/gauntlet.js +41 -0
- package/dist/gauntlet/gauntlet.js.map +1 -0
- package/dist/gauntlet/teams-g1.d.ts +23 -0
- package/dist/gauntlet/teams-g1.js +476 -0
- package/dist/gauntlet/teams-g1.js.map +1 -0
- package/dist/gauntlet/teams-g2.d.ts +14 -0
- package/dist/gauntlet/teams-g2.js +725 -0
- package/dist/gauntlet/teams-g2.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/llm/agent-query.d.ts +21 -0
- package/dist/llm/agent-query.js +70 -0
- package/dist/llm/agent-query.js.map +1 -0
- package/dist/pilot/damage.d.ts +34 -0
- package/dist/pilot/damage.js +75 -0
- package/dist/pilot/damage.js.map +1 -0
- package/dist/pilot/eval-pilot.d.ts +39 -0
- package/dist/pilot/eval-pilot.js +161 -0
- package/dist/pilot/eval-pilot.js.map +1 -0
- package/dist/pilot/pilot.d.ts +71 -0
- package/dist/pilot/pilot.js +290 -0
- package/dist/pilot/pilot.js.map +1 -0
- package/dist/ranking.d.ts +25 -0
- package/dist/ranking.js +40 -0
- package/dist/ranking.js.map +1 -0
- package/dist/seed.d.ts +13 -0
- package/dist/seed.js +42 -0
- package/dist/seed.js.map +1 -0
- package/dist/team.d.ts +29 -0
- package/dist/team.js +100 -0
- package/dist/team.js.map +1 -0
- package/dist/types.d.ts +77 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +57 -0
package/dist/cli.js
ADDED
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* CLI — a thin wrapper over {@link evaluate} and {@link critiqueTeam}: parse
|
|
4
|
+
* arguments, read Team pastes, print results, write files. Holds no logic worth
|
|
5
|
+
* testing on its own (per the PRD).
|
|
6
|
+
*
|
|
7
|
+
* poke-crucible eval [options] <team-file...> rank Teams by Strength
|
|
8
|
+
* poke-crucible critique [options] <team-file> LLM critique of one Team
|
|
9
|
+
*
|
|
10
|
+
* With no team file, a single Team paste is read from stdin.
|
|
11
|
+
*/
|
|
12
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
13
|
+
import { evaluate } from './evaluate.js';
|
|
14
|
+
import { critiqueTeam } from './critic/critique.js';
|
|
15
|
+
import { AgentSdkCritiqueModel, DEFAULT_CRITIC_MODEL } from './critic/agent-sdk-model.js';
|
|
16
|
+
import { design } from './designer/design.js';
|
|
17
|
+
import { StubDesignerModel } from './designer/model.js';
|
|
18
|
+
import { AgentSdkDesignerModel, DEFAULT_DESIGNER_MODEL } from './designer/agent-sdk-model.js';
|
|
19
|
+
function parseArgs(argv) {
|
|
20
|
+
const args = { files: [], mode: 'gauntlet' };
|
|
21
|
+
for (let i = 0; i < argv.length; i++) {
|
|
22
|
+
const a = argv[i];
|
|
23
|
+
switch (a) {
|
|
24
|
+
case 'eval':
|
|
25
|
+
break; // optional subcommand
|
|
26
|
+
case '-h':
|
|
27
|
+
case '--help':
|
|
28
|
+
break; // handled in main() before dispatch
|
|
29
|
+
case '--mode':
|
|
30
|
+
args.mode = argv[++i] ?? 'gauntlet';
|
|
31
|
+
break;
|
|
32
|
+
case '--battles':
|
|
33
|
+
args.battles = Number(argv[++i]);
|
|
34
|
+
break;
|
|
35
|
+
case '--seed':
|
|
36
|
+
args.seed = argv[++i];
|
|
37
|
+
break;
|
|
38
|
+
case '--gauntlet-version':
|
|
39
|
+
args.gauntletVersion = argv[++i];
|
|
40
|
+
break;
|
|
41
|
+
case '--out':
|
|
42
|
+
args.out = argv[++i] ?? args.out;
|
|
43
|
+
break;
|
|
44
|
+
case '--model':
|
|
45
|
+
args.model = argv[++i];
|
|
46
|
+
break;
|
|
47
|
+
case '--effort':
|
|
48
|
+
args.effort = argv[++i];
|
|
49
|
+
break;
|
|
50
|
+
case '--population':
|
|
51
|
+
args.population = Number(argv[++i]);
|
|
52
|
+
break;
|
|
53
|
+
case '--generations':
|
|
54
|
+
args.generations = Number(argv[++i]);
|
|
55
|
+
break;
|
|
56
|
+
case '--no-llm':
|
|
57
|
+
args.noLlm = true;
|
|
58
|
+
break;
|
|
59
|
+
case '--concurrency':
|
|
60
|
+
i++; // applied to the environment in main(), before any Battle runs
|
|
61
|
+
break;
|
|
62
|
+
default:
|
|
63
|
+
if (a.startsWith('-'))
|
|
64
|
+
throw new Error(`Unknown option: ${a}`);
|
|
65
|
+
args.files.push(a);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return args;
|
|
69
|
+
}
|
|
70
|
+
function readStdin() {
|
|
71
|
+
try {
|
|
72
|
+
return readFileSync(0, 'utf8');
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return '';
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const USAGE = `poke-crucible — evaluate and critique Gen 3 OU Teams
|
|
79
|
+
|
|
80
|
+
Usage:
|
|
81
|
+
poke-crucible eval [options] <team-file...> rank Teams by Strength
|
|
82
|
+
poke-crucible critique [options] <team-file> LLM critique of one Team
|
|
83
|
+
|
|
84
|
+
eval options:
|
|
85
|
+
--mode <gauntlet|round-robin> Opposition mode (default: gauntlet)
|
|
86
|
+
--battles <N> Battles per pairing (default: 100)
|
|
87
|
+
--seed <string> Master seed for reproducibility
|
|
88
|
+
--gauntlet-version <v> Gauntlet version (gauntlet mode)
|
|
89
|
+
--out <file> Structured results file (default: poke-crucible-results.json)
|
|
90
|
+
|
|
91
|
+
critique options:
|
|
92
|
+
--model <id> Critic model (default: ${DEFAULT_CRITIC_MODEL}; runs on your Claude subscription)
|
|
93
|
+
--effort <low|medium|high|xhigh|max> Reasoning effort (default: low)
|
|
94
|
+
--battles <N> Battles for the underlying evaluation (default: 100)
|
|
95
|
+
--seed <string> Master seed
|
|
96
|
+
--gauntlet-version <v> Gauntlet version
|
|
97
|
+
--out <file> Critique JSON file (default: poke-crucible-critique.json)
|
|
98
|
+
|
|
99
|
+
design options:
|
|
100
|
+
--population <N> Teams per generation (default: 8)
|
|
101
|
+
--generations <N> Generations to run (default: 4)
|
|
102
|
+
--battles <N> Battles per pairing for fitness (default: 16)
|
|
103
|
+
--model <id> / --effort <...> Designer LLM model / effort (default: ${DEFAULT_DESIGNER_MODEL}, low)
|
|
104
|
+
--no-llm Random operators only — no subscription call
|
|
105
|
+
--seed <string> Master seed
|
|
106
|
+
--gauntlet-version <v> Gauntlet version
|
|
107
|
+
--out <file> Design JSON file (default: poke-crucible-design.json)
|
|
108
|
+
|
|
109
|
+
shared:
|
|
110
|
+
--concurrency <N> Run Battles across N worker threads (default: 1)
|
|
111
|
+
-h, --help Show this help
|
|
112
|
+
|
|
113
|
+
With no team file, critique reads a paste from stdin; design searches from scratch.`;
|
|
114
|
+
function pct(x) {
|
|
115
|
+
return `${(x * 100).toFixed(1)}%`;
|
|
116
|
+
}
|
|
117
|
+
function printReport(result) {
|
|
118
|
+
const lines = [];
|
|
119
|
+
lines.push('');
|
|
120
|
+
lines.push(`Mode: ${result.mode}` +
|
|
121
|
+
(result.gauntletVersion ? ` Gauntlet: ${result.gauntletVersion}` : '') +
|
|
122
|
+
` Seed: ${result.seed} Battles/pairing: ${result.battlesPerPairing}`);
|
|
123
|
+
if (result.errors.length > 0) {
|
|
124
|
+
lines.push('');
|
|
125
|
+
lines.push('Illegal Teams (not run):');
|
|
126
|
+
for (const e of result.errors) {
|
|
127
|
+
lines.push(` ✗ ${e.team}`);
|
|
128
|
+
for (const p of e.problems)
|
|
129
|
+
lines.push(` - ${p}`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
lines.push('');
|
|
133
|
+
const header = ['#', 'Team', 'Strength', '95% CI', 'Battles'];
|
|
134
|
+
const rows = result.ranking.map((r, i) => [
|
|
135
|
+
String(i + 1),
|
|
136
|
+
r.team,
|
|
137
|
+
pct(r.strength),
|
|
138
|
+
`${pct(r.ci95[0])}–${pct(r.ci95[1])}`,
|
|
139
|
+
String(r.battles),
|
|
140
|
+
]);
|
|
141
|
+
lines.push(...formatTable(header, rows));
|
|
142
|
+
for (const r of result.ranking) {
|
|
143
|
+
lines.push('');
|
|
144
|
+
lines.push(`${r.team} — per matchup:`);
|
|
145
|
+
for (const m of [...r.matchups].sort((a, b) => a.winRate - b.winRate)) {
|
|
146
|
+
const label = m.archetype ? `${m.opponent} [${m.archetype}]` : m.opponent;
|
|
147
|
+
lines.push(` ${pct(m.winRate).padStart(6)} vs ${label}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
process.stdout.write(lines.join('\n') + '\n');
|
|
151
|
+
}
|
|
152
|
+
function formatTable(header, rows) {
|
|
153
|
+
const widths = header.map((h, c) => Math.max(h.length, ...rows.map((r) => (r[c] ?? '').length)));
|
|
154
|
+
const fmt = (cells) => cells.map((c, i) => c.padEnd(widths[i])).join(' ').trimEnd();
|
|
155
|
+
return [fmt(header), fmt(widths.map((w) => '-'.repeat(w))), ...rows.map(fmt)];
|
|
156
|
+
}
|
|
157
|
+
function printCritique(c) {
|
|
158
|
+
const lines = [];
|
|
159
|
+
lines.push('');
|
|
160
|
+
lines.push(`Critique: ${c.team} Strength ${pct(c.strength)} Model: ${c.model}` +
|
|
161
|
+
(c.gauntletVersion ? ` Gauntlet: ${c.gauntletVersion}` : '') +
|
|
162
|
+
` Seed: ${c.seed}`);
|
|
163
|
+
lines.push('');
|
|
164
|
+
lines.push(c.overall);
|
|
165
|
+
if (c.weaknesses.length > 0) {
|
|
166
|
+
lines.push('');
|
|
167
|
+
lines.push('Weaknesses:');
|
|
168
|
+
for (const w of c.weaknesses) {
|
|
169
|
+
const by = w.exploitedBy.length > 0 ? ` (vs ${w.exploitedBy.join(', ')})` : '';
|
|
170
|
+
lines.push(` [${w.severity.toUpperCase()}] ${w.summary}${by}`);
|
|
171
|
+
if (w.mechanism)
|
|
172
|
+
lines.push(` ${w.mechanism}`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (c.fixes.length > 0) {
|
|
176
|
+
lines.push('');
|
|
177
|
+
lines.push('Suggested fixes:');
|
|
178
|
+
for (const f of c.fixes) {
|
|
179
|
+
lines.push(` - ${f.change}`);
|
|
180
|
+
if (f.rationale)
|
|
181
|
+
lines.push(` ${f.rationale}`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (c.caveats.length > 0) {
|
|
185
|
+
lines.push('');
|
|
186
|
+
lines.push('Caveats:');
|
|
187
|
+
for (const cav of c.caveats)
|
|
188
|
+
lines.push(` - ${cav}`);
|
|
189
|
+
}
|
|
190
|
+
process.stdout.write(lines.join('\n') + '\n');
|
|
191
|
+
}
|
|
192
|
+
async function runEval(argv) {
|
|
193
|
+
const args = parseArgs(argv);
|
|
194
|
+
if (args.mode !== 'gauntlet' && args.mode !== 'round-robin') {
|
|
195
|
+
throw new Error(`--mode must be "gauntlet" or "round-robin", got "${args.mode}"`);
|
|
196
|
+
}
|
|
197
|
+
const teams = args.files.length > 0 ? args.files.map((f) => readFileSync(f, 'utf8')) : [readStdin()];
|
|
198
|
+
if (teams.every((t) => t.trim() === '')) {
|
|
199
|
+
process.stderr.write('No Teams provided.\n\n' + USAGE + '\n');
|
|
200
|
+
process.exitCode = 1;
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
const opposition = args.mode === 'gauntlet'
|
|
204
|
+
? { mode: 'gauntlet', gauntletVersion: args.gauntletVersion }
|
|
205
|
+
: { mode: 'round-robin' };
|
|
206
|
+
const input = { teams, opposition };
|
|
207
|
+
if (args.battles !== undefined)
|
|
208
|
+
input.battlesPerPairing = args.battles;
|
|
209
|
+
if (args.seed !== undefined)
|
|
210
|
+
input.seed = args.seed;
|
|
211
|
+
const result = await evaluate(input);
|
|
212
|
+
const out = args.out ?? 'poke-crucible-results.json';
|
|
213
|
+
printReport(result);
|
|
214
|
+
writeFileSync(out, JSON.stringify(result, null, 2), 'utf8');
|
|
215
|
+
process.stdout.write(`\nResults written to ${out}\n`);
|
|
216
|
+
}
|
|
217
|
+
async function runCritique(argv) {
|
|
218
|
+
// Reuse the shared parser; critique adds --model and defaults --out.
|
|
219
|
+
const args = parseArgs(argv);
|
|
220
|
+
const model = args.model ?? DEFAULT_CRITIC_MODEL;
|
|
221
|
+
const effort = args.effort;
|
|
222
|
+
const out = args.out ?? 'poke-crucible-critique.json';
|
|
223
|
+
const paste = (args.files[0] ? readFileSync(args.files[0], 'utf8') : readStdin()).trim();
|
|
224
|
+
if (!paste) {
|
|
225
|
+
process.stderr.write('No Team provided.\n\n' + USAGE + '\n');
|
|
226
|
+
process.exitCode = 1;
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
const critique = await critiqueTeam(paste, new AgentSdkCritiqueModel({ model, ...(effort ? { effort } : {}) }), {
|
|
230
|
+
...(args.seed !== undefined ? { seed: args.seed } : {}),
|
|
231
|
+
...(args.gauntletVersion !== undefined ? { gauntletVersion: args.gauntletVersion } : {}),
|
|
232
|
+
...(args.battles !== undefined ? { battlesPerPairing: args.battles } : {}),
|
|
233
|
+
});
|
|
234
|
+
printCritique(critique);
|
|
235
|
+
writeFileSync(out, JSON.stringify(critique, null, 2), 'utf8');
|
|
236
|
+
process.stdout.write(`\nCritique written to ${out}\n`);
|
|
237
|
+
}
|
|
238
|
+
function printDesign(result) {
|
|
239
|
+
const lines = [''];
|
|
240
|
+
lines.push(`Design: ${result.discovered.length} Teams over ${result.generations} generations` +
|
|
241
|
+
` Gauntlet: ${result.gauntletVersion} Pilot: ${result.pilot} Seed: ${result.seed}`);
|
|
242
|
+
if (result.errors.length > 0) {
|
|
243
|
+
lines.push('');
|
|
244
|
+
lines.push('Illegal seed Teams (excluded):');
|
|
245
|
+
for (const e of result.errors)
|
|
246
|
+
lines.push(` ✗ ${e.team}: ${e.problems.join('; ')}`);
|
|
247
|
+
}
|
|
248
|
+
lines.push('');
|
|
249
|
+
const header = ['#', 'Fitness', 'Strength', 'Archetype', 'Origin', 'Lead'];
|
|
250
|
+
const rows = result.discovered.map((d, i) => [
|
|
251
|
+
String(i + 1),
|
|
252
|
+
pct(d.fitness),
|
|
253
|
+
pct(d.strength),
|
|
254
|
+
d.archetype + (d.novel ? ' *' : ''),
|
|
255
|
+
d.lineage.operator ? `${d.lineage.origin}/${d.lineage.operator}` : d.lineage.origin,
|
|
256
|
+
(d.paste.split('\n')[0] ?? '').split(' @ ')[0] ?? '',
|
|
257
|
+
]);
|
|
258
|
+
lines.push(...formatTable(header, rows));
|
|
259
|
+
const best = result.discovered[0];
|
|
260
|
+
if (best) {
|
|
261
|
+
lines.push('');
|
|
262
|
+
lines.push('Best Team:');
|
|
263
|
+
lines.push(best.paste);
|
|
264
|
+
}
|
|
265
|
+
process.stdout.write(lines.join('\n') + '\n');
|
|
266
|
+
}
|
|
267
|
+
async function runDesign(argv) {
|
|
268
|
+
const args = parseArgs(argv);
|
|
269
|
+
const out = args.out ?? 'poke-crucible-design.json';
|
|
270
|
+
const seedText = args.files[0] ? readFileSync(args.files[0], 'utf8') : readStdin();
|
|
271
|
+
const budget = {};
|
|
272
|
+
if (args.population !== undefined)
|
|
273
|
+
budget.population = args.population;
|
|
274
|
+
if (args.generations !== undefined)
|
|
275
|
+
budget.generations = args.generations;
|
|
276
|
+
if (args.battles !== undefined)
|
|
277
|
+
budget.battlesPerPairing = args.battles;
|
|
278
|
+
const input = { budget };
|
|
279
|
+
if (seedText.trim())
|
|
280
|
+
input.seedTeams = seedText;
|
|
281
|
+
if (args.seed !== undefined)
|
|
282
|
+
input.seed = args.seed;
|
|
283
|
+
if (args.gauntletVersion !== undefined)
|
|
284
|
+
input.gauntletVersion = args.gauntletVersion;
|
|
285
|
+
const useLlm = !args.noLlm;
|
|
286
|
+
const model = useLlm
|
|
287
|
+
? new AgentSdkDesignerModel({
|
|
288
|
+
model: args.model ?? DEFAULT_DESIGNER_MODEL,
|
|
289
|
+
...(args.effort ? { effort: args.effort } : {}),
|
|
290
|
+
})
|
|
291
|
+
: new StubDesignerModel();
|
|
292
|
+
// With the LLM on, the Critic explains each generation's best Team and drives
|
|
293
|
+
// the mutation proposals (PRD: the Critic sources candidate mutations).
|
|
294
|
+
const options = useLlm ? { critic: new AgentSdkCritiqueModel() } : {};
|
|
295
|
+
const result = await design(input, model, options);
|
|
296
|
+
printDesign(result);
|
|
297
|
+
writeFileSync(out, JSON.stringify(result, null, 2), 'utf8');
|
|
298
|
+
process.stdout.write(`\nDesign written to ${out}\n`);
|
|
299
|
+
}
|
|
300
|
+
async function main() {
|
|
301
|
+
const rawArgs = process.argv.slice(2);
|
|
302
|
+
if (rawArgs.includes('-h') || rawArgs.includes('--help')) {
|
|
303
|
+
process.stdout.write(USAGE + '\n');
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
// Run Battles across worker threads (default 1 = inline). Set before any run.
|
|
307
|
+
const ci = rawArgs.indexOf('--concurrency');
|
|
308
|
+
if (ci >= 0 && rawArgs[ci + 1])
|
|
309
|
+
process.env['POKE_CONCURRENCY'] = rawArgs[ci + 1];
|
|
310
|
+
const command = rawArgs[0];
|
|
311
|
+
if (command === 'critique') {
|
|
312
|
+
await runCritique(rawArgs.slice(1));
|
|
313
|
+
}
|
|
314
|
+
else if (command === 'design') {
|
|
315
|
+
await runDesign(rawArgs.slice(1));
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
// Default command is `eval`; strip an explicit leading `eval` token.
|
|
319
|
+
await runEval(command === 'eval' ? rawArgs.slice(1) : rawArgs);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
main().catch((err) => {
|
|
323
|
+
process.stderr.write(`Error: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
324
|
+
process.exitCode = 1;
|
|
325
|
+
});
|
|
326
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;GASG;AACH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAe,MAAM,6BAA6B,CAAC;AAEvG,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAmB9F,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,IAAI,GAAY,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;QACnB,QAAQ,CAAC,EAAE,CAAC;YACV,KAAK,MAAM;gBACT,MAAM,CAAC,sBAAsB;YAC/B,KAAK,IAAI,CAAC;YACV,KAAK,QAAQ;gBACX,MAAM,CAAC,oCAAoC;YAC7C,KAAK,QAAQ;gBACX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AG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The live {@link CritiqueModel}, backed by the Claude Agent SDK, running on the
|
|
3
|
+
* maintainer's Claude subscription (individual use — ADR / PRD Slice 2). It just
|
|
4
|
+
* assembles the critique prompt and delegates the headless call to the shared
|
|
5
|
+
* {@link runAgentQuery} helper (which handles tools-off, auth, and the timeout).
|
|
6
|
+
*/
|
|
7
|
+
import type { CritiqueModel } from './llm.js';
|
|
8
|
+
import type { CritiquePrompt } from './prompt.js';
|
|
9
|
+
import { type Effort } from '../llm/agent-query.js';
|
|
10
|
+
export type { Effort };
|
|
11
|
+
/** Default Critic model (a Sonnet-tier model; overridable). */
|
|
12
|
+
export declare const DEFAULT_CRITIC_MODEL = "claude-sonnet-5";
|
|
13
|
+
export interface AgentSdkModelOptions {
|
|
14
|
+
/** Model id/alias passed to the Agent SDK (e.g. `claude-sonnet-5`, `sonnet`). */
|
|
15
|
+
model?: string;
|
|
16
|
+
/** Reasoning effort (default `low`). */
|
|
17
|
+
effort?: Effort;
|
|
18
|
+
/** Wall-clock cap per critique (default 90s). */
|
|
19
|
+
timeoutMs?: number;
|
|
20
|
+
}
|
|
21
|
+
export declare class AgentSdkCritiqueModel implements CritiqueModel {
|
|
22
|
+
readonly name: string;
|
|
23
|
+
private readonly effort;
|
|
24
|
+
private readonly timeoutMs;
|
|
25
|
+
constructor(options?: AgentSdkModelOptions);
|
|
26
|
+
complete(prompt: CritiquePrompt): Promise<string>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { runAgentQuery } from '../llm/agent-query.js';
|
|
2
|
+
/** Default Critic model (a Sonnet-tier model; overridable). */
|
|
3
|
+
export const DEFAULT_CRITIC_MODEL = 'claude-sonnet-5';
|
|
4
|
+
export class AgentSdkCritiqueModel {
|
|
5
|
+
name;
|
|
6
|
+
effort;
|
|
7
|
+
timeoutMs;
|
|
8
|
+
constructor(options = {}) {
|
|
9
|
+
this.name = options.model ?? DEFAULT_CRITIC_MODEL;
|
|
10
|
+
this.effort = options.effort ?? 'low';
|
|
11
|
+
this.timeoutMs = options.timeoutMs ?? 90_000;
|
|
12
|
+
}
|
|
13
|
+
async complete(prompt) {
|
|
14
|
+
return runAgentQuery(prompt.system, prompt.user, {
|
|
15
|
+
model: this.name,
|
|
16
|
+
effort: this.effort,
|
|
17
|
+
timeoutMs: this.timeoutMs,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=agent-sdk-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-sdk-model.js","sourceRoot":"","sources":["../../src/critic/agent-sdk-model.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAe,MAAM,uBAAuB,CAAC;AAInE,+DAA+D;AAC/D,MAAM,CAAC,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AAWtD,MAAM,OAAO,qBAAqB;IACvB,IAAI,CAAS;IACL,MAAM,CAAS;IACf,SAAS,CAAS;IAEnC,YAAY,UAAgC,EAAE;QAC5C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,KAAK,IAAI,oBAAoB,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,MAAsB;QACnC,OAAO,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE;YAC/C,KAAK,EAAE,IAAI,CAAC,IAAI;YAChB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Critic seam. `critique` turns one Team's Slice-1 result into a structured
|
|
3
|
+
* {@link Critique} via an injected {@link CritiqueModel} — so it never touches
|
|
4
|
+
* the simulation core or the LLM transport directly. `critiqueTeam` is a
|
|
5
|
+
* convenience that runs `evaluate()` for a single Team first.
|
|
6
|
+
*/
|
|
7
|
+
import { type EvaluateRuntimeOptions } from '../evaluate.js';
|
|
8
|
+
import type { Critique, CritiqueInput } from './types.js';
|
|
9
|
+
import type { CritiqueModel } from './llm.js';
|
|
10
|
+
/** Critique one Team from its precomputed evaluation row. Retries once on
|
|
11
|
+
* unparseable model output before giving up. */
|
|
12
|
+
export declare function critique(input: CritiqueInput, model: CritiqueModel): Promise<Critique>;
|
|
13
|
+
export interface CritiqueTeamOptions {
|
|
14
|
+
name?: string;
|
|
15
|
+
seed?: string;
|
|
16
|
+
gauntletVersion?: string;
|
|
17
|
+
battlesPerPairing?: number;
|
|
18
|
+
runtime?: EvaluateRuntimeOptions;
|
|
19
|
+
}
|
|
20
|
+
/** Evaluate a single Team against the Gauntlet, then critique it. */
|
|
21
|
+
export declare function critiqueTeam(paste: string, model: CritiqueModel, options?: CritiqueTeamOptions): Promise<Critique>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Critic seam. `critique` turns one Team's Slice-1 result into a structured
|
|
3
|
+
* {@link Critique} via an injected {@link CritiqueModel} — so it never touches
|
|
4
|
+
* the simulation core or the LLM transport directly. `critiqueTeam` is a
|
|
5
|
+
* convenience that runs `evaluate()` for a single Team first.
|
|
6
|
+
*/
|
|
7
|
+
import { evaluate } from '../evaluate.js';
|
|
8
|
+
import { buildContext } from './evidence.js';
|
|
9
|
+
import { buildPrompt } from './prompt.js';
|
|
10
|
+
import { CritiqueParseError, parseCritique } from './parse.js';
|
|
11
|
+
/** Critique one Team from its precomputed evaluation row. Retries once on
|
|
12
|
+
* unparseable model output before giving up. */
|
|
13
|
+
export async function critique(input, model) {
|
|
14
|
+
const prompt = buildPrompt(buildContext(input));
|
|
15
|
+
let lastError;
|
|
16
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
17
|
+
const text = await model.complete(prompt);
|
|
18
|
+
try {
|
|
19
|
+
return parseCritique(text, input, model.name);
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
if (!(e instanceof CritiqueParseError))
|
|
23
|
+
throw e;
|
|
24
|
+
lastError = e;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
throw new CritiqueParseError(`model output could not be parsed after 2 attempts: ${lastError?.message ?? 'unknown'}`);
|
|
28
|
+
}
|
|
29
|
+
/** Evaluate a single Team against the Gauntlet, then critique it. */
|
|
30
|
+
export async function critiqueTeam(paste, model, options = {}) {
|
|
31
|
+
const opposition = options.gauntletVersion !== undefined
|
|
32
|
+
? { mode: 'gauntlet', gauntletVersion: options.gauntletVersion }
|
|
33
|
+
: { mode: 'gauntlet' };
|
|
34
|
+
const result = await evaluate({
|
|
35
|
+
teams: [{ name: options.name ?? 'Team', paste }],
|
|
36
|
+
opposition,
|
|
37
|
+
...(options.battlesPerPairing !== undefined
|
|
38
|
+
? { battlesPerPairing: options.battlesPerPairing }
|
|
39
|
+
: {}),
|
|
40
|
+
...(options.seed !== undefined ? { seed: options.seed } : {}),
|
|
41
|
+
}, options.runtime ?? {});
|
|
42
|
+
const row = result.ranking[0];
|
|
43
|
+
if (!row) {
|
|
44
|
+
throw new Error(`Team could not be evaluated: ${result.errors.map((e) => e.problems.join('; ')).join(' | ')}`);
|
|
45
|
+
}
|
|
46
|
+
const input = { paste, row, seed: result.seed };
|
|
47
|
+
if (result.gauntletVersion)
|
|
48
|
+
input.gauntletVersion = result.gauntletVersion;
|
|
49
|
+
return critique(input, model);
|
|
50
|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
|
+
/**
|
|
2
|
+
* Evidence builder — turns a Slice-1 {@link StrengthRow} into a compact,
|
|
3
|
+
* faithful context for the model: the Team, its overall Strength, and its
|
|
4
|
+
* best/worst matchups. Deliberately does not do Pokémon reasoning itself
|
|
5
|
+
* (identifying "hazard-weak", "no special wall", etc. is the LLM's job) — it
|
|
6
|
+
* only selects and shapes the evidence.
|
|
7
|
+
*/
|
|
8
|
+
import type { MatchupResult } from '../types.js';
|
|
9
|
+
import type { CritiqueInput } from './types.js';
|
|
10
|
+
export interface CritiqueContext {
|
|
11
|
+
team: string;
|
|
12
|
+
paste: string;
|
|
13
|
+
strength: number;
|
|
14
|
+
battles: number;
|
|
15
|
+
/** The worst matchups, ascending win-rate. */
|
|
16
|
+
worst: MatchupResult[];
|
|
17
|
+
/** The best matchups, descending win-rate. */
|
|
18
|
+
best: MatchupResult[];
|
|
19
|
+
/** Every matchup, for the full table in the prompt. */
|
|
20
|
+
all: MatchupResult[];
|
|
21
|
+
seed: string;
|
|
22
|
+
gauntletVersion?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function buildContext(input: CritiqueInput, worstN?: number, bestN?: number): CritiqueContext;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function buildContext(input, worstN = 4, bestN = 2) {
|
|
2
|
+
const byWinRate = [...input.row.matchups].sort((a, b) => a.winRate - b.winRate);
|
|
3
|
+
const context = {
|
|
4
|
+
team: input.row.team,
|
|
5
|
+
paste: input.paste,
|
|
6
|
+
strength: input.row.strength,
|
|
7
|
+
battles: input.row.battles,
|
|
8
|
+
worst: byWinRate.slice(0, worstN),
|
|
9
|
+
best: byWinRate.slice(Math.max(0, byWinRate.length - bestN)).reverse(),
|
|
10
|
+
all: input.row.matchups,
|
|
11
|
+
seed: input.seed,
|
|
12
|
+
};
|
|
13
|
+
if (input.gauntletVersion)
|
|
14
|
+
context.gauntletVersion = input.gauntletVersion;
|
|
15
|
+
return context;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=evidence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence.js","sourceRoot":"","sources":["../../src/critic/evidence.ts"],"names":[],"mappings":"AAyBA,MAAM,UAAU,YAAY,CAAC,KAAoB,EAAE,MAAM,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC;IACtE,MAAM,SAAS,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC;IAChF,MAAM,OAAO,GAAoB;QAC/B,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI;QACpB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,QAAQ;QAC5B,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO;QAC1B,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC;QACjC,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE;QACtE,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,QAAQ;QACvB,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC;IACF,IAAI,KAAK,CAAC,eAAe;QAAE,OAAO,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;IAC3E,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Critic's model seam. The rest of the Critic depends only on this small
|
|
3
|
+
* interface, so every non-LLM path is unit-testable with {@link StubCritiqueModel}
|
|
4
|
+
* and no subscription call.
|
|
5
|
+
*
|
|
6
|
+
* THE REAL IMPLEMENTATION (deferred — needs the maintainer's go-ahead + install):
|
|
7
|
+
* a client backed by the Claude Agent SDK (`@anthropic-ai/claude-agent-sdk`),
|
|
8
|
+
* running on the maintainer's Claude Max subscription (individual use). It calls
|
|
9
|
+
* `query({ prompt, options })` with ALL built-in tools disabled (`allowedTools:
|
|
10
|
+
* []`) — the Critic only reasons over the context we pass in — and concatenates
|
|
11
|
+
* the assistant text. Auth is the Claude Code OAuth flow (`claude` login or
|
|
12
|
+
* `CLAUDE_CODE_OAUTH_TOKEN`); `ANTHROPIC_API_KEY` must be UNSET or it shadows the
|
|
13
|
+
* OAuth token and reverts to pay-per-token. See docs/prd-slice-2-critic.md.
|
|
14
|
+
*/
|
|
15
|
+
import type { CritiquePrompt } from './prompt.js';
|
|
16
|
+
export interface CritiqueModel {
|
|
17
|
+
/** Model identifier, recorded on the Critique for reproducibility. */
|
|
18
|
+
readonly name: string;
|
|
19
|
+
/** Return the model's raw text response to the prompt. */
|
|
20
|
+
complete(prompt: CritiquePrompt): Promise<string>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A deterministic stand-in for tests and offline development: returns a fixed
|
|
24
|
+
* response (or a sequence, one per call) without any network or subscription.
|
|
25
|
+
*/
|
|
26
|
+
export declare class StubCritiqueModel implements CritiqueModel {
|
|
27
|
+
readonly name: string;
|
|
28
|
+
private readonly responses;
|
|
29
|
+
private calls;
|
|
30
|
+
constructor(response: string | string[], name?: string);
|
|
31
|
+
complete(_prompt: CritiquePrompt): Promise<string>;
|
|
32
|
+
/** How many times the model was asked to complete (useful in tests). */
|
|
33
|
+
get callCount(): number;
|
|
34
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A deterministic stand-in for tests and offline development: returns a fixed
|
|
3
|
+
* response (or a sequence, one per call) without any network or subscription.
|
|
4
|
+
*/
|
|
5
|
+
export class StubCritiqueModel {
|
|
6
|
+
name;
|
|
7
|
+
responses;
|
|
8
|
+
calls = 0;
|
|
9
|
+
constructor(response, name = 'stub') {
|
|
10
|
+
this.responses = Array.isArray(response) ? response : [response];
|
|
11
|
+
this.name = name;
|
|
12
|
+
}
|
|
13
|
+
async complete(_prompt) {
|
|
14
|
+
const i = Math.min(this.calls, this.responses.length - 1);
|
|
15
|
+
this.calls += 1;
|
|
16
|
+
return this.responses[i] ?? '';
|
|
17
|
+
}
|
|
18
|
+
/** How many times the model was asked to complete (useful in tests). */
|
|
19
|
+
get callCount() {
|
|
20
|
+
return this.calls;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=llm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llm.js","sourceRoot":"","sources":["../../src/critic/llm.ts"],"names":[],"mappings":"AAuBA;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IACnB,IAAI,CAAS;IACL,SAAS,CAAW;IAC7B,KAAK,GAAG,CAAC,CAAC;IAElB,YAAY,QAA2B,EAAE,IAAI,GAAG,MAAM;QACpD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QACjE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAuB;QACpC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC1D,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACjC,CAAC;IAED,wEAAwE;IACxE,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF"}
|