@hmharness/cli 0.19.0 → 0.19.2

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.
Files changed (3) hide show
  1. package/dist/main.js +41 -1
  2. package/dist/tui.js +17 -0
  3. package/package.json +12 -12
package/dist/main.js CHANGED
@@ -915,8 +915,48 @@ flags:
915
915
  // and evolution pipeline adopt them; this command shows what exists.
916
916
  await initHome();
917
917
  const sub = rest.find((a) => !a.startsWith('-'));
918
+ if (sub === 'diagnose') {
919
+ // CL-003 over live data: which learning opportunity pays off now?
920
+ const { diagnoseOpportunities } = await import('@hmharness/cognitive');
921
+ const { opportunities, trajectories } = await diagnoseOpportunities(homeDir());
922
+ stdout.write(`认知诊断(${trajectories} 条轨迹)\n`);
923
+ if (opportunities.length === 0)
924
+ stdout.write(' (暂无满足证据阈值的学习机会)\n');
925
+ for (const o of opportunities) {
926
+ stdout.write(` [${o.suggestedTargets.join('/')}] ${o.signal}\n`);
927
+ stdout.write(DIM(` 证据: ${o.evidence.metric}=${o.evidence.value}(${o.evidence.trajectories.length} 条轨迹)\n`));
928
+ }
929
+ return;
930
+ }
931
+ if (sub === 'bench') {
932
+ // BENCH seed: uniform metrics over recorded runs
933
+ const { benchFromTrajectories } = await import('@hmharness/cognitive');
934
+ const report = await benchFromTrajectories(homeDir());
935
+ if (!report) {
936
+ stdout.write('(尚无轨迹——跑几次任务后再来)\n');
937
+ return;
938
+ }
939
+ const a = report.aggregate;
940
+ stdout.write(`GeneralBench 种子报告 · ${report.environmentId} · ${report.runs} 次运行\n`);
941
+ stdout.write(` 成功率 ${a.successRate} · 动作效率 ${a.actionEfficiency} · 恢复率 ${a.recoveryRate} · 校准 ${a.calibration} · 平均耗时 ${(a.latencyMs / 1000).toFixed(1)}s\n`);
942
+ return;
943
+ }
944
+ if (sub === 'world-model') {
945
+ const { analyzeWorldModel } = await import('@hmharness/cognitive');
946
+ const wm = await analyzeWorldModel(homeDir());
947
+ stdout.write(`世界模型(${wm.trajectoriesReplayed} 轨迹 / ${wm.stepsReplayed} 步回放)\n`);
948
+ if (wm.beliefs.length === 0)
949
+ stdout.write(' (暂无信念——跑几次任务后自动生成)\n');
950
+ for (const b of wm.beliefs.slice(0, 20)) {
951
+ stdout.write(` ${b.actionType.padEnd(26)} 置信 ${b.confidence.toFixed(2)} 证据 ${b.evidenceCount} 次\n`);
952
+ }
953
+ const cal = wm.calibration;
954
+ stdout.write(` 校准: ${cal.resolved} 条预测已裁决${cal.meanError !== undefined ? `,平均误差 ${cal.meanError}` : ''}\n`);
955
+ stdout.write(` 规划门: 可信[${wm.plannerGate.trusted.join(',')}] 存疑[${wm.plannerGate.untrusted.join(',')}] 未知[${wm.plannerGate.unknown.join(',')}]\n`);
956
+ return;
957
+ }
918
958
  if (sub !== 'status') {
919
- stdout.write('用法: hmh cognitive status — 认知子系统状态(记忆五层/轨迹库/进化审计/环境注册表)\n');
959
+ stdout.write('用法: hmh cognitive status|world-model|diagnose|bench — 认知子系统状态与世界模型\n');
920
960
  return;
921
961
  }
922
962
  const { cognitiveStatus, formatCognitiveStatus } = await import('@hmharness/cognitive');
package/dist/tui.js CHANGED
@@ -121,6 +121,7 @@ export const COMMANDS = [
121
121
  { name: '/review', key: 'cmdReview' },
122
122
  { name: '/web', key: 'cmdWeb' },
123
123
  { name: '/remote', key: 'cmdRemote' },
124
+ { name: '/cognitive', key: 'cmdCognitive' },
124
125
  { name: '/exit', key: 'cmdExit' },
125
126
  ];
126
127
  /** Commands whose name starts with the input (input must start with '/'). */
@@ -2442,6 +2443,22 @@ export async function tui(yes, noWeb = false, opts = {}) {
2442
2443
  rt.addText(up ? t.tuiWebLinked(DEFAULT_WEB_PORT) : t.tuiWebHint, 'dim');
2443
2444
  return;
2444
2445
  }
2446
+ if (line === '/cognitive') {
2447
+ // Cognitive OS status (blueprint RD seed): same one-pager as
2448
+ // `hmh cognitive status` — memory layers, trajectories, audit, envs.
2449
+ rt.setBusy(true, '/cognitive');
2450
+ try {
2451
+ const { cognitiveStatus, formatCognitiveStatus } = await import('@hmharness/cognitive');
2452
+ const status = await cognitiveStatus(homeDir());
2453
+ for (const l of formatCognitiveStatus(status).split('\n'))
2454
+ rt.addText(l, 'plain');
2455
+ }
2456
+ catch (err) {
2457
+ rt.addText(String(err), 'err');
2458
+ }
2459
+ rt.setBusy(false);
2460
+ return;
2461
+ }
2445
2462
  if (line === '/remote' || line === '/remote lan' || line === '/remote wan') {
2446
2463
  // 2026-09-28 DSH Desktop pattern: /remote shows a QR of a ONE-TIME
2447
2464
  // pairing link fetched from the running web server (/api/pair-info).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmharness/cli",
3
- "version": "0.19.0",
3
+ "version": "0.19.2",
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.19.0",
47
- "@hmharness/cognitive": "0.19.0",
48
- "@hmharness/domain-harmony": "0.19.0",
49
- "@hmharness/domain-ops": "0.19.0",
50
- "@hmharness/environments": "0.19.0",
51
- "@hmharness/evaluation": "0.19.0",
52
- "@hmharness/evolution": "0.19.0",
53
- "@hmharness/kernel": "0.19.0",
54
- "@hmharness/observability": "0.19.0",
55
- "@hmharness/sandbox": "0.19.0",
56
- "@hmharness/web": "0.19.0",
46
+ "@hmharness/agent": "0.19.2",
47
+ "@hmharness/cognitive": "0.19.2",
48
+ "@hmharness/domain-harmony": "0.19.2",
49
+ "@hmharness/domain-ops": "0.19.2",
50
+ "@hmharness/environments": "0.19.2",
51
+ "@hmharness/evaluation": "0.19.2",
52
+ "@hmharness/evolution": "0.19.2",
53
+ "@hmharness/kernel": "0.19.2",
54
+ "@hmharness/observability": "0.19.2",
55
+ "@hmharness/sandbox": "0.19.2",
56
+ "@hmharness/web": "0.19.2",
57
57
  "qrcode": "^1.5.4"
58
58
  }
59
59
  }