@hmharness/cli 0.22.2 → 0.22.3
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/ablate-task.d.ts +12 -0
- package/dist/ablate-task.js +34 -14
- package/package.json +12 -12
package/dist/ablate-task.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/** A run's outcome, signal-separated: a crash (timeout/rate-limit/provider)
|
|
2
|
+
* is INFRASTRUCTURE noise, not the model answering wrong — mixing them
|
|
3
|
+
* poisons the effect estimate (the -8.3% artifact). Crash = the run did
|
|
4
|
+
* not complete (r.ok === false) regardless of whether a partial onFinal
|
|
5
|
+
* reply exists — a timed-out arm is a crash even when it had replied. */
|
|
6
|
+
type RunVerdict = 'pass' | 'wrong' | 'crash';
|
|
7
|
+
export declare function verdictOf(r: {
|
|
8
|
+
ok: boolean;
|
|
9
|
+
output: string;
|
|
10
|
+
error?: string;
|
|
11
|
+
}, check: (out: string) => boolean): RunVerdict;
|
|
1
12
|
export declare function runTaskAblation(write: (s: string) => void, home: () => string, runs: number, difficulty?: 'easy' | 'mid' | 'hard' | 'bench', filter?: string): Promise<void>;
|
|
2
13
|
/**
|
|
3
14
|
* Bare-arm calibration (the v0.21.3 lesson, implemented): BEFORE an ablation
|
|
@@ -6,3 +17,4 @@ export declare function runTaskAblation(write: (s: string) => void, home: () =>
|
|
|
6
17
|
* failure — the author's intuition about difficulty is not the instrument.
|
|
7
18
|
*/
|
|
8
19
|
export declare function runBareCalibration(write: (s: string) => void, difficulty: 'easy' | 'mid' | 'hard' | 'bench', probes: number, home: () => string, filter?: string): Promise<void>;
|
|
20
|
+
export {};
|
package/dist/ablate-task.js
CHANGED
|
@@ -21,6 +21,7 @@ import { join } from 'node:path';
|
|
|
21
21
|
const GREEN = (s) => `\x1b[32m${s}\x1b[0m`;
|
|
22
22
|
const RED = (s) => `\x1b[31m${s}\x1b[0m`;
|
|
23
23
|
const DIM = (s) => `\x1b[2m${s}\x1b[0m`;
|
|
24
|
+
const YELLOW = (s) => `\x1b[33m${s}\x1b[0m`;
|
|
24
25
|
const bySubstring = (expect) => (output) => output.includes(expect);
|
|
25
26
|
/** deterministic, verifiable mini-tasks (exact substring must appear) */
|
|
26
27
|
const TASKS = [
|
|
@@ -118,6 +119,11 @@ async function runOnce(task, bare, timeoutMs) {
|
|
|
118
119
|
process.env.HMH_NO_COGNITIVE = prev;
|
|
119
120
|
}
|
|
120
121
|
}
|
|
122
|
+
export function verdictOf(r, check) {
|
|
123
|
+
if (!r.ok)
|
|
124
|
+
return 'crash'; // run died (timeout / rate-limit / provider error)
|
|
125
|
+
return check(r.output) ? 'pass' : 'wrong';
|
|
126
|
+
}
|
|
121
127
|
export async function runTaskAblation(write, home, runs, difficulty = 'easy', filter) {
|
|
122
128
|
const homeDir = home();
|
|
123
129
|
const pool = await poolOf(difficulty, home, filter);
|
|
@@ -125,19 +131,30 @@ export async function runTaskAblation(write, home, runs, difficulty = 'easy', fi
|
|
|
125
131
|
let withOk = 0;
|
|
126
132
|
let bareOk = 0;
|
|
127
133
|
let total = 0;
|
|
134
|
+
let withCrash = 0;
|
|
135
|
+
let bareCrash = 0;
|
|
136
|
+
let cleanPairs = 0; // pairs where BOTH arms produced a reply (model-vs-model)
|
|
128
137
|
const details = [];
|
|
129
138
|
for (let r = 1; r <= runs; r++) {
|
|
130
139
|
for (const t of pool) {
|
|
131
140
|
total += 1;
|
|
132
141
|
const a = await runOnce(t.text, false, 240_000);
|
|
133
142
|
const b = await runOnce(t.text, true, 240_000);
|
|
134
|
-
const
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
143
|
+
const av = verdictOf(a, t.check);
|
|
144
|
+
const bv = verdictOf(b, t.check);
|
|
145
|
+
if (av === 'crash')
|
|
146
|
+
withCrash += 1;
|
|
147
|
+
if (bv === 'crash')
|
|
148
|
+
bareCrash += 1;
|
|
149
|
+
if (av !== 'crash' && bv !== 'crash') {
|
|
150
|
+
cleanPairs += 1;
|
|
151
|
+
withOk += av === 'pass' ? 1 : 0;
|
|
152
|
+
bareOk += bv === 'pass' ? 1 : 0;
|
|
153
|
+
}
|
|
154
|
+
details.push({ label: t.label, with: av, bare: bv });
|
|
155
|
+
const mark = (v) => (v === 'pass' ? GREEN('✓') : v === 'wrong' ? RED('✗') : YELLOW('⚡'));
|
|
156
|
+
const note = av === 'crash' || bv === 'crash' ? DIM(` ⚡ ${String(a.error ?? b.error).slice(0, 60)}`) : '';
|
|
157
|
+
write(` ${t.label.padEnd(24)} 认知 ${mark(av)} · 裸 ${mark(bv)}${note}\n`);
|
|
141
158
|
}
|
|
142
159
|
}
|
|
143
160
|
const record = {
|
|
@@ -145,15 +162,18 @@ export async function runTaskAblation(write, home, runs, difficulty = 'easy', fi
|
|
|
145
162
|
type: 'terminal-task',
|
|
146
163
|
difficulty,
|
|
147
164
|
runs,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
165
|
+
// clean stats: only pairs where both arms answered (model-vs-model)
|
|
166
|
+
withCognitive: { pass: withOk, total: cleanPairs },
|
|
167
|
+
bare: { pass: bareOk, total: cleanPairs },
|
|
168
|
+
crashes: { withArm: withCrash, bareArm: bareCrash },
|
|
169
|
+
harnessDelta: cleanPairs ? Number(((withOk - bareOk) / cleanPairs).toFixed(3)) : null,
|
|
151
170
|
details,
|
|
152
171
|
};
|
|
153
172
|
await mkdir(join(homeDir, 'cognitive'), { recursive: true }).catch(() => undefined);
|
|
154
173
|
await appendFile(join(homeDir, 'cognitive', 'ablation.jsonl'), JSON.stringify(record) + '\n', 'utf8').catch(() => undefined);
|
|
155
|
-
write(`结论 · 认知层 ${withOk}/${
|
|
156
|
-
write(
|
|
174
|
+
write(`结论 · 认知层 ${withOk}/${cleanPairs} vs 裸 ${bareOk}/${cleanPairs}(干净对 ${cleanPairs}/${total},⚡基础设施中断 认知${withCrash}/裸${bareCrash} 已剔除)`);
|
|
175
|
+
write(record.harnessDelta === null ? ' → 干净对不足,无读数\n' : ` → harness 结果层净贡献 ${(record.harnessDelta * 100).toFixed(1)}%\n`);
|
|
176
|
+
write(DIM('(⚡=超时/限流/provider 错误:非模型答错,混入会污染效应估计——v0.22.2 教训)\n'));
|
|
157
177
|
}
|
|
158
178
|
/**
|
|
159
179
|
* Bare-arm calibration (the v0.21.3 lesson, implemented): BEFORE an ablation
|
|
@@ -168,8 +188,8 @@ export async function runBareCalibration(write, difficulty, probes, home, filter
|
|
|
168
188
|
let fails = 0;
|
|
169
189
|
for (let i = 0; i < probes; i++) {
|
|
170
190
|
const r = await runOnce(t.text, true, 240_000);
|
|
171
|
-
if (!t.check(r.output))
|
|
172
|
-
fails += 1;
|
|
191
|
+
if (!r.ok || !t.check(r.output))
|
|
192
|
+
fails += 1; // a crashed probe counts as a bare failure (infrastructure, not model-competence — note it in the band reading)
|
|
173
193
|
}
|
|
174
194
|
const rate = Number((fails / probes).toFixed(2));
|
|
175
195
|
const band = rate === 0 ? '地板(剔除)' : rate >= 1 ? '天花板(剔除)' : rate >= 0.2 && rate <= 0.8 ? '可测带 ✓' : '边缘';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hmharness/cli",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.3",
|
|
4
4
|
"description": "hmharness command line: one-shot tasks, an interactive REPL, a fullscreen TUI, the web frontend, and direct tool invocation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
"build": "tsc -p tsconfig.build.json"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@hmharness/agent": "0.22.
|
|
47
|
-
"@hmharness/cognitive": "0.22.
|
|
48
|
-
"@hmharness/domain-harmony": "0.22.
|
|
49
|
-
"@hmharness/domain-ops": "0.22.
|
|
50
|
-
"@hmharness/environments": "0.22.
|
|
51
|
-
"@hmharness/evaluation": "0.22.
|
|
52
|
-
"@hmharness/evolution": "0.22.
|
|
53
|
-
"@hmharness/kernel": "0.22.
|
|
54
|
-
"@hmharness/observability": "0.22.
|
|
55
|
-
"@hmharness/sandbox": "0.22.
|
|
56
|
-
"@hmharness/web": "0.22.
|
|
46
|
+
"@hmharness/agent": "0.22.3",
|
|
47
|
+
"@hmharness/cognitive": "0.22.3",
|
|
48
|
+
"@hmharness/domain-harmony": "0.22.3",
|
|
49
|
+
"@hmharness/domain-ops": "0.22.3",
|
|
50
|
+
"@hmharness/environments": "0.22.3",
|
|
51
|
+
"@hmharness/evaluation": "0.22.3",
|
|
52
|
+
"@hmharness/evolution": "0.22.3",
|
|
53
|
+
"@hmharness/kernel": "0.22.3",
|
|
54
|
+
"@hmharness/observability": "0.22.3",
|
|
55
|
+
"@hmharness/sandbox": "0.22.3",
|
|
56
|
+
"@hmharness/web": "0.22.3",
|
|
57
57
|
"qrcode": "^1.5.4"
|
|
58
58
|
}
|
|
59
59
|
}
|