@hmharness/cli 0.19.1 → 0.19.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.
Files changed (2) hide show
  1. package/dist/main.js +70 -1
  2. package/package.json +12 -12
package/dist/main.js CHANGED
@@ -915,8 +915,77 @@ 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
+ }
958
+ if (sub === 'drift') {
959
+ // GOAL-005 on live data: did recorded runs actually serve their goals?
960
+ const { analyzeGoalDrift } = await import('@hmharness/cognitive');
961
+ const views = await analyzeGoalDrift(homeDir());
962
+ if (views.length === 0) {
963
+ stdout.write('(尚无带目标的轨迹——设置会话目标后再跑任务)\n');
964
+ return;
965
+ }
966
+ for (const v of views.slice(0, 10)) {
967
+ stdout.write(` ${v.driftScore.toFixed(2).padEnd(5)} ${v.recommendation.padEnd(22)} ${v.goalDescription.slice(0, 60)}\n`);
968
+ for (const s of v.signals.slice(0, 2))
969
+ stdout.write(DIM(` ${s}\n`));
970
+ }
971
+ return;
972
+ }
973
+ if (sub === 'skills') {
974
+ // SK-002 on live data: repeated successful action runs as candidates
975
+ const { skillCandidatesFromHistory } = await import('@hmharness/cognitive');
976
+ const candidates = await skillCandidatesFromHistory(homeDir());
977
+ if (candidates.length === 0) {
978
+ stdout.write('(暂无技能候选——需要≥2 条含≥2 步成功动作序列的轨迹)\n');
979
+ return;
980
+ }
981
+ for (const c of candidates) {
982
+ stdout.write(` [${c.status}] ${c.name}\n`);
983
+ stdout.write(` 流程: ${c.procedure.join(' → ')} · 证据 ${c.evidenceTrajectories} 条轨迹(晋升仍需过基准门禁)\n`);
984
+ }
985
+ return;
986
+ }
918
987
  if (sub !== 'status') {
919
- stdout.write('用法: hmh cognitive status — 认知子系统状态(记忆五层/轨迹库/进化审计/环境注册表)\n');
988
+ stdout.write('用法: hmh cognitive status|world-model|diagnose|bench|drift|skills — 认知子系统与世界模型\n');
920
989
  return;
921
990
  }
922
991
  const { cognitiveStatus, formatCognitiveStatus } = await import('@hmharness/cognitive');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmharness/cli",
3
- "version": "0.19.1",
3
+ "version": "0.19.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.19.1",
47
- "@hmharness/cognitive": "0.19.1",
48
- "@hmharness/domain-harmony": "0.19.1",
49
- "@hmharness/domain-ops": "0.19.1",
50
- "@hmharness/environments": "0.19.1",
51
- "@hmharness/evaluation": "0.19.1",
52
- "@hmharness/evolution": "0.19.1",
53
- "@hmharness/kernel": "0.19.1",
54
- "@hmharness/observability": "0.19.1",
55
- "@hmharness/sandbox": "0.19.1",
56
- "@hmharness/web": "0.19.1",
46
+ "@hmharness/agent": "0.19.3",
47
+ "@hmharness/cognitive": "0.19.3",
48
+ "@hmharness/domain-harmony": "0.19.3",
49
+ "@hmharness/domain-ops": "0.19.3",
50
+ "@hmharness/environments": "0.19.3",
51
+ "@hmharness/evaluation": "0.19.3",
52
+ "@hmharness/evolution": "0.19.3",
53
+ "@hmharness/kernel": "0.19.3",
54
+ "@hmharness/observability": "0.19.3",
55
+ "@hmharness/sandbox": "0.19.3",
56
+ "@hmharness/web": "0.19.3",
57
57
  "qrcode": "^1.5.4"
58
58
  }
59
59
  }