@ggui-ai/negotiator 0.28.0 → 0.29.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/package.json +11 -5
- package/dist/rerank-eval/run-probe-cli.d.ts +0 -3
- package/dist/rerank-eval/run-probe-cli.d.ts.map +0 -1
- package/dist/rerank-eval/run-probe-cli.js +0 -80
- package/dist/synth-bench/cache-key-probe.d.ts +0 -3
- package/dist/synth-bench/cache-key-probe.d.ts.map +0 -1
- package/dist/synth-bench/cache-key-probe.js +0 -177
- package/dist/synth-bench/cli-llm.d.ts +0 -25
- package/dist/synth-bench/cli-llm.d.ts.map +0 -1
- package/dist/synth-bench/cli-llm.js +0 -124
- package/dist/synth-bench/run-bench-cli.d.ts +0 -3
- package/dist/synth-bench/run-bench-cli.d.ts.map +0 -1
- package/dist/synth-bench/run-bench-cli.js +0 -105
- package/dist/synth-bench/run-repair-bench-cli.d.ts +0 -3
- package/dist/synth-bench/run-repair-bench-cli.d.ts.map +0 -1
- package/dist/synth-bench/run-repair-bench-cli.js +0 -86
- package/src/rerank-eval/run-probe-cli.ts +0 -103
- package/src/synth-bench/cache-key-probe.ts +0 -213
- package/src/synth-bench/cli-llm.ts +0 -168
- package/src/synth-bench/run-bench-cli.ts +0 -135
- package/src/synth-bench/run-repair-bench-cli.ts +0 -119
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Synthesizer bench CLI — live LLM probe.
|
|
4
|
-
*
|
|
5
|
-
* Reads ~/.ggui/credentials.json for the Anthropic API key, runs
|
|
6
|
-
* synthesizeContract over BENCH_CORPUS, prints per-shape precision
|
|
7
|
-
* + the redundant-action firing count + p50/p95 latency.
|
|
8
|
-
*
|
|
9
|
-
* Costs ~$0.001 per entry on Haiku 4.5 → roughly $0.05 for the full
|
|
10
|
-
* 50+ corpus run. NOT run in CI; opt-in only.
|
|
11
|
-
*
|
|
12
|
-
* Usage:
|
|
13
|
-
* pnpm -F @ggui-ai/negotiator bench-synth
|
|
14
|
-
* pnpm -F @ggui-ai/negotiator bench-synth -- --limit 10
|
|
15
|
-
* pnpm -F @ggui-ai/negotiator bench-synth -- --shape context+action
|
|
16
|
-
* ANTHROPIC_API_KEY=sk-... pnpm -F @ggui-ai/negotiator bench-synth
|
|
17
|
-
* pnpm -F @ggui-ai/negotiator bench-synth -- --json > report.json
|
|
18
|
-
*
|
|
19
|
-
* Bench-only — not exported from the package index.
|
|
20
|
-
*/
|
|
21
|
-
import { evaluateAgainstCorpus, formatBenchReport } from './run-bench.js';
|
|
22
|
-
import { contractShape } from './corpus.js';
|
|
23
|
-
import {
|
|
24
|
-
DEFAULT_MODEL,
|
|
25
|
-
HAIKU_4_5_PRICE_INPUT_PER_TOKEN,
|
|
26
|
-
HAIKU_4_5_PRICE_OUTPUT_PER_TOKEN,
|
|
27
|
-
buildAnthropicLlmCaller,
|
|
28
|
-
getTokenUsage,
|
|
29
|
-
resolveAnthropicKey,
|
|
30
|
-
} from './cli-llm.js';
|
|
31
|
-
|
|
32
|
-
const SHAPE_FILTERS = [
|
|
33
|
-
'props-only',
|
|
34
|
-
'context-only',
|
|
35
|
-
'context+action',
|
|
36
|
-
'stream',
|
|
37
|
-
'with-gadgets',
|
|
38
|
-
'empty',
|
|
39
|
-
] as const;
|
|
40
|
-
|
|
41
|
-
interface CliArgs {
|
|
42
|
-
limit?: number;
|
|
43
|
-
shapeFilter?: string;
|
|
44
|
-
model: string;
|
|
45
|
-
json: boolean;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function parseArgs(argv: readonly string[]): CliArgs {
|
|
49
|
-
let limit: number | undefined;
|
|
50
|
-
let shapeFilter: string | undefined;
|
|
51
|
-
let model = DEFAULT_MODEL;
|
|
52
|
-
let json = false;
|
|
53
|
-
for (let i = 0; i < argv.length; i++) {
|
|
54
|
-
const a = argv[i];
|
|
55
|
-
if (a === '--limit' && argv[i + 1]) {
|
|
56
|
-
limit = Number(argv[++i]);
|
|
57
|
-
} else if (a === '--shape' && argv[i + 1]) {
|
|
58
|
-
const v = argv[++i]!;
|
|
59
|
-
if ((SHAPE_FILTERS as readonly string[]).includes(v)) {
|
|
60
|
-
shapeFilter = v;
|
|
61
|
-
} else {
|
|
62
|
-
throw new Error(
|
|
63
|
-
`unknown shape: ${v} (expected one of ${SHAPE_FILTERS.join(', ')})`,
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
} else if (a === '--model' && argv[i + 1]) {
|
|
67
|
-
model = argv[++i]!;
|
|
68
|
-
} else if (a === '--json') {
|
|
69
|
-
json = true;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
const result: CliArgs = { model, json };
|
|
73
|
-
if (limit !== undefined) result.limit = limit;
|
|
74
|
-
if (shapeFilter !== undefined) result.shapeFilter = shapeFilter;
|
|
75
|
-
return result;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
async function main(): Promise<void> {
|
|
79
|
-
const args = parseArgs(process.argv.slice(2));
|
|
80
|
-
const apiKey = resolveAnthropicKey('bench-synth');
|
|
81
|
-
const llm = buildAnthropicLlmCaller(apiKey, args.model);
|
|
82
|
-
|
|
83
|
-
if (!args.json) {
|
|
84
|
-
process.stdout.write(`bench-synth: model=${args.model}\n\n`);
|
|
85
|
-
}
|
|
86
|
-
const report = await evaluateAgainstCorpus(
|
|
87
|
-
{ llm },
|
|
88
|
-
{
|
|
89
|
-
...(args.limit !== undefined ? { limit: args.limit } : {}),
|
|
90
|
-
...(args.shapeFilter !== undefined
|
|
91
|
-
? { shapeFilter: args.shapeFilter }
|
|
92
|
-
: {}),
|
|
93
|
-
onProgress: args.json
|
|
94
|
-
? undefined
|
|
95
|
-
: (outcome, idx, total) => {
|
|
96
|
-
const status = outcome.score.pass ? 'OK ' : 'NO ';
|
|
97
|
-
const id = outcome.entry.id.padEnd(28);
|
|
98
|
-
const shape = contractShape(outcome.entry.expected).padEnd(16);
|
|
99
|
-
process.stdout.write(
|
|
100
|
-
`[${status}] ${(idx + 1).toString().padStart(2)}/${total} ${shape} ${id} ${outcome.latencyMs}ms\n`,
|
|
101
|
-
);
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
if (args.json) {
|
|
107
|
-
process.stdout.write(JSON.stringify(report, null, 2));
|
|
108
|
-
process.stdout.write('\n');
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
process.stdout.write('\n');
|
|
113
|
-
process.stdout.write(formatBenchReport(report));
|
|
114
|
-
process.stdout.write('\n\n');
|
|
115
|
-
|
|
116
|
-
const usage = getTokenUsage();
|
|
117
|
-
const totalCost =
|
|
118
|
-
usage.input * HAIKU_4_5_PRICE_INPUT_PER_TOKEN +
|
|
119
|
-
usage.output * HAIKU_4_5_PRICE_OUTPUT_PER_TOKEN;
|
|
120
|
-
const callsMade = report.totals.all - report.totals.synthDeclined;
|
|
121
|
-
const costPerCall = callsMade === 0 ? 0 : totalCost / callsMade;
|
|
122
|
-
process.stdout.write(
|
|
123
|
-
`Tokens: input=${usage.input} output=${usage.output}\n`,
|
|
124
|
-
);
|
|
125
|
-
process.stdout.write(
|
|
126
|
-
`Cost: total=$${totalCost.toFixed(4)} per-call=$${costPerCall.toFixed(4)}\n`,
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
main().catch((err) => {
|
|
131
|
-
process.stderr.write(
|
|
132
|
-
`bench-synth failed: ${err instanceof Error ? err.message : String(err)}\n`,
|
|
133
|
-
);
|
|
134
|
-
process.exit(1);
|
|
135
|
-
});
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Repair bench CLI — live round-trip-quality probe.
|
|
4
|
-
*
|
|
5
|
-
* Runs the production forgiving-handshake create-path
|
|
6
|
-
* (`ensureConformingContract`) over REPAIR_CORPUS and reports the
|
|
7
|
-
* round-trip-usable rate — the contract-quality number the shape bench
|
|
8
|
-
* (bench-synth) cannot see. Reads ~/.ggui/credentials.json (or
|
|
9
|
-
* ANTHROPIC_API_KEY) for the key.
|
|
10
|
-
*
|
|
11
|
-
* Costs ~$0.001 per repaired entry on Haiku 4.5 (clean drafts hit the
|
|
12
|
-
* lint-clean fast path and make NO LLM call). NOT run in CI; opt-in.
|
|
13
|
-
*
|
|
14
|
-
* Usage:
|
|
15
|
-
* pnpm -F @ggui-ai/negotiator bench-repair
|
|
16
|
-
* pnpm -F @ggui-ai/negotiator bench-repair -- --limit 1
|
|
17
|
-
* pnpm -F @ggui-ai/negotiator bench-repair -- --json > repair-report.json
|
|
18
|
-
* ANTHROPIC_API_KEY=sk-... pnpm -F @ggui-ai/negotiator bench-repair
|
|
19
|
-
*
|
|
20
|
-
* Bench-only — not exported from the package index.
|
|
21
|
-
*/
|
|
22
|
-
import {
|
|
23
|
-
evaluateRepairCorpus,
|
|
24
|
-
formatRepairBenchReport,
|
|
25
|
-
} from './run-repair-bench.js';
|
|
26
|
-
import {
|
|
27
|
-
DEFAULT_MODEL,
|
|
28
|
-
HAIKU_4_5_PRICE_INPUT_PER_TOKEN,
|
|
29
|
-
HAIKU_4_5_PRICE_OUTPUT_PER_TOKEN,
|
|
30
|
-
buildAnthropicLlmCaller,
|
|
31
|
-
getTokenUsage,
|
|
32
|
-
resolveAnthropicKey,
|
|
33
|
-
} from './cli-llm.js';
|
|
34
|
-
|
|
35
|
-
interface CliArgs {
|
|
36
|
-
limit?: number;
|
|
37
|
-
model: string;
|
|
38
|
-
json: boolean;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function parseArgs(argv: readonly string[]): CliArgs {
|
|
42
|
-
let limit: number | undefined;
|
|
43
|
-
let model = DEFAULT_MODEL;
|
|
44
|
-
let json = false;
|
|
45
|
-
for (let i = 0; i < argv.length; i++) {
|
|
46
|
-
const a = argv[i];
|
|
47
|
-
if (a === '--limit' && argv[i + 1]) {
|
|
48
|
-
limit = Number(argv[++i]);
|
|
49
|
-
} else if (a === '--model' && argv[i + 1]) {
|
|
50
|
-
model = argv[++i]!;
|
|
51
|
-
} else if (a === '--json') {
|
|
52
|
-
json = true;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
const result: CliArgs = { model, json };
|
|
56
|
-
if (limit !== undefined) result.limit = limit;
|
|
57
|
-
return result;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async function main(): Promise<void> {
|
|
61
|
-
const args = parseArgs(process.argv.slice(2));
|
|
62
|
-
const apiKey = resolveAnthropicKey('bench-repair');
|
|
63
|
-
const llm = buildAnthropicLlmCaller(apiKey, args.model);
|
|
64
|
-
|
|
65
|
-
if (!args.json) {
|
|
66
|
-
process.stdout.write(`bench-repair: model=${args.model}\n\n`);
|
|
67
|
-
}
|
|
68
|
-
const report = await evaluateRepairCorpus(
|
|
69
|
-
{ llm },
|
|
70
|
-
{
|
|
71
|
-
...(args.limit !== undefined ? { limit: args.limit } : {}),
|
|
72
|
-
onProgress: args.json
|
|
73
|
-
? undefined
|
|
74
|
-
: (outcome, idx, total) => {
|
|
75
|
-
const pass =
|
|
76
|
-
outcome.roundTrip !== null
|
|
77
|
-
? outcome.roundTrip.pass
|
|
78
|
-
: outcome.shape.pass;
|
|
79
|
-
const status = pass ? 'OK ' : 'NO ';
|
|
80
|
-
const id = outcome.entry.id.padEnd(22);
|
|
81
|
-
const origin = `origin:${outcome.origin}`.padEnd(13);
|
|
82
|
-
process.stdout.write(
|
|
83
|
-
`[${status}] ${(idx + 1).toString().padStart(2)}/${total} ${origin} ${id} ${outcome.latencyMs}ms\n`,
|
|
84
|
-
);
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
if (args.json) {
|
|
90
|
-
process.stdout.write(JSON.stringify(report, null, 2));
|
|
91
|
-
process.stdout.write('\n');
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
process.stdout.write('\n');
|
|
96
|
-
process.stdout.write(formatRepairBenchReport(report));
|
|
97
|
-
process.stdout.write('\n\n');
|
|
98
|
-
|
|
99
|
-
const usage = getTokenUsage();
|
|
100
|
-
const totalCost =
|
|
101
|
-
usage.input * HAIKU_4_5_PRICE_INPUT_PER_TOKEN +
|
|
102
|
-
usage.output * HAIKU_4_5_PRICE_OUTPUT_PER_TOKEN;
|
|
103
|
-
// Clean drafts (origin agent) make no LLM call — cost is per repaired entry.
|
|
104
|
-
const callsMade = report.totals.originSynth;
|
|
105
|
-
const costPerCall = callsMade === 0 ? 0 : totalCost / callsMade;
|
|
106
|
-
process.stdout.write(
|
|
107
|
-
`Tokens: input=${usage.input} output=${usage.output}\n`,
|
|
108
|
-
);
|
|
109
|
-
process.stdout.write(
|
|
110
|
-
`Cost: total=$${totalCost.toFixed(4)} per-repair=$${costPerCall.toFixed(4)}\n`,
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
main().catch((err) => {
|
|
115
|
-
process.stderr.write(
|
|
116
|
-
`bench-repair failed: ${err instanceof Error ? err.message : String(err)}\n`,
|
|
117
|
-
);
|
|
118
|
-
process.exit(1);
|
|
119
|
-
});
|