@hmharness/cli 0.8.4 → 0.10.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/dist/main.js +125 -0
- package/package.json +4 -4
package/dist/main.js
CHANGED
|
@@ -28,6 +28,7 @@ import { listSkills, listDrafts, promoteSkill, runBench, runEvolution, rollbackS
|
|
|
28
28
|
import { harmonyTools } from '@hmharness/domain-harmony';
|
|
29
29
|
import { baseTools, buildRegistry, buildSystemPrompt, runAgentTask, strings } from '@hmharness/agent';
|
|
30
30
|
const DIM = (s) => `\x1b[2m${s}\x1b[0m`;
|
|
31
|
+
const BOLD = (s) => `\x1b[1m${s}\x1b[0m`;
|
|
31
32
|
const CYAN = (s) => `\x1b[36m${s}\x1b[0m`;
|
|
32
33
|
const YELLOW = (s) => `\x1b[33m${s}\x1b[0m`;
|
|
33
34
|
const GREEN = (s) => `\x1b[32m${s}\x1b[0m`;
|
|
@@ -344,6 +345,12 @@ usage:
|
|
|
344
345
|
hmh experiment [list|show <id>|run <id> [--cases=N]|promote <id> [--human]|
|
|
345
346
|
rollback <target>] evolution candidates: control/treatment
|
|
346
347
|
bench arms + statistical promotion gate (V2 M9)
|
|
348
|
+
hmh dataset [list|build [ver]|show <ver> [--train|--eval]]
|
|
349
|
+
trajectory -> versioned, redacted, split dataset (V2 M10)
|
|
350
|
+
hmh route shadow-router stats: agreement rate + outcome split (V2 M10)
|
|
351
|
+
hmh readiness the RL gate: six conditions measured from real evidence (V2 M11)
|
|
352
|
+
hmh pipeline "<task>" role pipeline: plan→code→test→review→judge (+repair loop,
|
|
353
|
+
VERDICT gate) - V3 first slice (ADR-0006)
|
|
347
354
|
hmh web start|stop|status web UI as a silent background daemon (no window,
|
|
348
355
|
survives closing everything; log ~/.hmharness/web.log)
|
|
349
356
|
hmh web [--port=7788] web UI in the foreground (debugging)
|
|
@@ -763,6 +770,124 @@ flags:
|
|
|
763
770
|
await startServer({ port: Number.isFinite(port) ? port : 7788, host: '127.0.0.1' });
|
|
764
771
|
return; // startServer keeps the process alive
|
|
765
772
|
}
|
|
773
|
+
if (cmd === 'pipeline') {
|
|
774
|
+
// V3 first slice (ADR-0006): plan -> code -> test -> review -> judge with
|
|
775
|
+
// a bounded repair loop; the judge's VERDICT line is the only stage gate.
|
|
776
|
+
const task = rest.join(' ').trim();
|
|
777
|
+
if (!task) {
|
|
778
|
+
stdout.write('usage: hmh pipeline "<task>" [--repairs=N] [--turns=N]\n');
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
781
|
+
await initHome();
|
|
782
|
+
const home = homeDir();
|
|
783
|
+
const cfg2 = await loadConfig();
|
|
784
|
+
const { reg: preg, clients: preClients } = await buildRegistry({ announce: false });
|
|
785
|
+
const A = await import('@hmharness/agent');
|
|
786
|
+
stdout.write(DIM(`pipeline: plan → code → test → review → judge (route ${cfg2.provider.model})\n`));
|
|
787
|
+
try {
|
|
788
|
+
const r = await A.runPipeline({
|
|
789
|
+
task,
|
|
790
|
+
provider: resolveProvider(cfg2, 'chat'),
|
|
791
|
+
registry: preg,
|
|
792
|
+
ctx: { cwd: process.cwd(), home },
|
|
793
|
+
model: cfg2.provider.model,
|
|
794
|
+
home,
|
|
795
|
+
locale: cfg2.locale,
|
|
796
|
+
maxRepairs: Number((rest.find((a) => a.startsWith('--repairs=')) ?? '').slice(10)) || 2,
|
|
797
|
+
maxTurnsPerStage: Number((rest.find((a) => a.startsWith('--turns=')) ?? '').slice(8)) || 6,
|
|
798
|
+
});
|
|
799
|
+
for (const s of r.stages) {
|
|
800
|
+
const mark = s.verdict === 'PASS' ? GREEN('PASS') : s.verdict === 'FAIL' ? RED('FAIL') : DIM('····');
|
|
801
|
+
stdout.write(` ${mark} ${YELLOW(s.stage.padEnd(9))} #${s.attempt} ${DIM(`${s.turns}t ${s.toolUses}tools`)}\n`);
|
|
802
|
+
}
|
|
803
|
+
const verdict = r.finalVerdict === 'PASS' ? GREEN('VERDICT: PASS') : RED(`VERDICT: ${r.finalVerdict}`);
|
|
804
|
+
stdout.write(`${verdict} ${DIM(`· status ${r.status} · repairs ${r.repairsUsed} · report ${home}\\pipelines\\${r.pipelineId}`)}\n`);
|
|
805
|
+
}
|
|
806
|
+
catch (err) {
|
|
807
|
+
stdout.write(RED(String(err)) + '\n');
|
|
808
|
+
}
|
|
809
|
+
finally {
|
|
810
|
+
for (const c of preClients)
|
|
811
|
+
c.close();
|
|
812
|
+
}
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
if (cmd === 'dataset') {
|
|
816
|
+
// V2 M10: trajectory -> versioned dataset (filter/dedupe/reward/split)
|
|
817
|
+
await initHome();
|
|
818
|
+
const home = homeDir();
|
|
819
|
+
const E = await import('@hmharness/evolution');
|
|
820
|
+
const sub = rest[0] ?? 'list';
|
|
821
|
+
if (sub === 'build') {
|
|
822
|
+
const version = rest[1] && !rest[1].startsWith('--') ? rest[1] : undefined;
|
|
823
|
+
stdout.write(DIM('building dataset from runs/ …\n'));
|
|
824
|
+
const r = await E.buildDataset(home, { version });
|
|
825
|
+
const c = r.manifest.counts;
|
|
826
|
+
stdout.write(GREEN('✓') + ` ${r.manifest.version}: scanned ${c.scanned} → kept ${c.kept} (dropped ${c.dropped}, dupes ${c.duplicates})\n`);
|
|
827
|
+
stdout.write(` train ${c.train} / eval ${c.eval} (seed ${r.manifest.splitSeed}) · filter ${r.manifest.filterFingerprint}\n`);
|
|
828
|
+
stdout.write(` dir: ${r.dir}\n`);
|
|
829
|
+
return;
|
|
830
|
+
}
|
|
831
|
+
if (sub === 'list') {
|
|
832
|
+
const all = await E.listDatasets(home);
|
|
833
|
+
if (all.length === 0) {
|
|
834
|
+
stdout.write('no dataset versions (hmh dataset build)\n');
|
|
835
|
+
return;
|
|
836
|
+
}
|
|
837
|
+
for (const m of all)
|
|
838
|
+
stdout.write(`${CYAN(m.version)} ${DIM(m.createdAt)} · kept ${m.counts.kept} (train ${m.counts.train}/eval ${m.counts.eval}) · filter ${m.filterFingerprint}\n`);
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
841
|
+
if (sub === 'show') {
|
|
842
|
+
const version = rest[1] ?? '';
|
|
843
|
+
const split = rest.includes('--eval') ? 'eval' : rest.includes('--train') ? 'train' : undefined;
|
|
844
|
+
const samples = await E.loadDataset(home, version, split);
|
|
845
|
+
if (samples.length === 0) {
|
|
846
|
+
stdout.write('no such dataset version or empty split\n');
|
|
847
|
+
return;
|
|
848
|
+
}
|
|
849
|
+
for (const s of samples.slice(0, 30)) {
|
|
850
|
+
stdout.write(`${s.reward.toFixed(1)} ${s.outcome.padEnd(12)} ${YELLOW(`t${s.turns}`)} ${DIM(s.runId.slice(0, 22))} ${s.task.slice(0, 56).replace(/\s+/g, ' ')}\n`);
|
|
851
|
+
}
|
|
852
|
+
if (samples.length > 30)
|
|
853
|
+
stdout.write(DIM(`… ${samples.length - 30} more\n`));
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
stdout.write('usage: hmh dataset [list|build [version]|show <version> [--train|--eval]]\n');
|
|
857
|
+
return;
|
|
858
|
+
}
|
|
859
|
+
if (cmd === 'route') {
|
|
860
|
+
// V2 M10 shadow router stats: how often the adaptive suggestion disagrees
|
|
861
|
+
// with the live route, and whether disagreement correlates with outcomes
|
|
862
|
+
await initHome();
|
|
863
|
+
const home = homeDir();
|
|
864
|
+
const { routingStats } = await import('@hmharness/kernel');
|
|
865
|
+
const s = await routingStats(home);
|
|
866
|
+
stdout.write(`routing outcomes: ${s.total} · shadow agreed ${s.agreed} (disagreement ${(s.disagreementRate * 100).toFixed(0)}%)\n`);
|
|
867
|
+
for (const [reason, n] of Object.entries(s.byReason))
|
|
868
|
+
stdout.write(` ${DIM(reason)}: ${n}\n`);
|
|
869
|
+
if (s.successAgree !== null)
|
|
870
|
+
stdout.write(`success when agreed: ${(s.successAgree * 100).toFixed(0)}%${s.successDisagree !== null ? ` · when disagreed: ${(s.successDisagree * 100).toFixed(0)}%` : ''}\n`);
|
|
871
|
+
else
|
|
872
|
+
stdout.write(DIM('agreement/success split needs >=8 labeled rows per side\n'));
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
if (cmd === 'readiness') {
|
|
876
|
+
// V2 M11: the RL gate. All six conditions measured from real evidence;
|
|
877
|
+
// closed gate names the optimization to do instead. No bypass exists.
|
|
878
|
+
await initHome();
|
|
879
|
+
const home = homeDir();
|
|
880
|
+
const { rlReadiness } = await import('@hmharness/evolution');
|
|
881
|
+
const r = await rlReadiness(home);
|
|
882
|
+
stdout.write(BOLD(r.verdict === 'rl-eligible' ? GREEN('RL-ELIGIBLE') : YELLOW('OPTIMIZE-FIRST')) + '\n');
|
|
883
|
+
for (const c of r.conditions) {
|
|
884
|
+
const mark = c.met ? GREEN('✓') : RED('✗');
|
|
885
|
+
stdout.write(` ${mark} ${c.id.padEnd(28)} ${String(c.current).slice(0, 40)} (need: ${String(c.threshold).slice(0, 44)})\n`);
|
|
886
|
+
}
|
|
887
|
+
if (r.recommendedLever)
|
|
888
|
+
stdout.write(DIM(`\nrecommended lever: ${r.recommendedLever} (skill/prompt/router optimization first - blueprint M11)\n`));
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
766
891
|
if (cmd === 'project') {
|
|
767
892
|
// V2 M8 project runtime (ADR-0002): checkpoints are plumbing snapshots -
|
|
768
893
|
// the user's index/refs/worktree are never touched; restore materializes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hmharness/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
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,12 +43,12 @@
|
|
|
43
43
|
"build": "tsc -p tsconfig.build.json"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@hmharness/kernel": "0.
|
|
46
|
+
"@hmharness/kernel": "0.9.0",
|
|
47
47
|
"@hmharness/observability": "0.7.0",
|
|
48
|
-
"@hmharness/evolution": "0.
|
|
48
|
+
"@hmharness/evolution": "0.9.0",
|
|
49
49
|
"@hmharness/domain-harmony": "0.8.0",
|
|
50
50
|
"@hmharness/domain-ops": "0.8.0",
|
|
51
|
-
"@hmharness/agent": "0.
|
|
51
|
+
"@hmharness/agent": "0.10.0",
|
|
52
52
|
"@hmharness/evaluation": "0.8.0",
|
|
53
53
|
"@hmharness/web": "0.8.2"
|
|
54
54
|
}
|