@hmharness/cli 0.19.8 → 0.20.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.
Files changed (2) hide show
  1. package/dist/main.js +40 -1
  2. package/package.json +12 -12
package/dist/main.js CHANGED
@@ -1111,8 +1111,47 @@ flags:
1111
1111
  }
1112
1112
  return;
1113
1113
  }
1114
+ if (sub === 'replay') {
1115
+ // RD-010: inspect one recorded trajectory step by step
1116
+ const id = rest.find((a) => !a.startsWith('-') && a !== 'replay') ?? 'latest';
1117
+ const { replayTrajectory } = await import('@hmharness/cognitive');
1118
+ const view = await replayTrajectory(homeDir(), id);
1119
+ if (!view) {
1120
+ stdout.write(`轨迹 '${id}' 不存在(hmh cognitive replay [id|latest])\n`);
1121
+ return;
1122
+ }
1123
+ stdout.write(`轨迹 ${view.trajectoryId} · ${view.environmentId} · ${view.steps.length} 步 · ${Math.round((view.metrics.elapsedMs ?? 0) / 1000)}s${view.goal ? `\n 目标: ${view.goal.slice(0, 80)}` : ''}\n`);
1124
+ for (const s of view.steps) {
1125
+ const mark = s.outcome === 'success' ? GREEN('✓') : s.outcome === 'failure' ? RED('✗') : '?';
1126
+ const pred = s.prediction ? DIM(` 预测${Math.round(s.prediction.confidence * 100)}%`) : '';
1127
+ stdout.write(` ${mark} ${String(s.step).padStart(3)} ${s.actionType}${pred}${s.durationMs !== undefined ? DIM(` ${s.durationMs}ms`) : ''}\n`);
1128
+ }
1129
+ return;
1130
+ }
1131
+ if (sub === 'export') {
1132
+ // §18 data governance: everything out, verbatim, one file
1133
+ const { exportCognitiveState } = await import('@hmharness/cognitive');
1134
+ const out = rest.find((a) => a.startsWith('--out='))?.slice(6);
1135
+ const { file, export: exp } = await exportCognitiveState(homeDir(), out);
1136
+ stdout.write(`已导出 → ${file}\n`);
1137
+ stdout.write(` 轨迹 ${exp.trajectoryCount} 条 · 记忆 ${exp.memoryLineCount} 行 · 进化审计 ${exp.auditLineCount} 行 · 多智能体日志 ${exp.multiAgentJsonl.split('\n').filter((l) => l.trim()).length} 行\n`);
1138
+ return;
1139
+ }
1140
+ if (sub === 'purge') {
1141
+ // §18 data governance: delete ONLY the cognitive store, explicit token
1142
+ const confirm = rest.find((a) => a.startsWith('--confirm='))?.slice(10) ?? '';
1143
+ const { purgeCognitiveState } = await import('@hmharness/cognitive');
1144
+ const r = await purgeCognitiveState(homeDir(), confirm);
1145
+ if (!r.ok) {
1146
+ stdout.write(RED(`拒绝删除: ${r.error}\n`));
1147
+ stdout.write(DIM(' 确认要删除认知库(轨迹/记忆/审计,不影响会话与洞察)请加 --confirm=purge-cognitive\n'));
1148
+ return;
1149
+ }
1150
+ stdout.write(`已删除: ${r.removed.join(', ')}\n`);
1151
+ return;
1152
+ }
1114
1153
  if (sub !== 'status') {
1115
- stdout.write('用法: hmh cognitive status|world-model|diagnose|bench|drift|skills|explore|transfer|team|learn — 认知子系统与世界模型\n');
1154
+ stdout.write('用法: hmh cognitive status|world-model|diagnose|bench|drift|skills|explore|transfer|team|learn|replay|export|purge — 认知子系统与世界模型\n');
1116
1155
  return;
1117
1156
  }
1118
1157
  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.8",
3
+ "version": "0.20.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,17 +43,17 @@
43
43
  "build": "tsc -p tsconfig.build.json"
44
44
  },
45
45
  "dependencies": {
46
- "@hmharness/agent": "0.19.8",
47
- "@hmharness/cognitive": "0.19.8",
48
- "@hmharness/domain-harmony": "0.19.8",
49
- "@hmharness/domain-ops": "0.19.8",
50
- "@hmharness/environments": "0.19.8",
51
- "@hmharness/evaluation": "0.19.8",
52
- "@hmharness/evolution": "0.19.8",
53
- "@hmharness/kernel": "0.19.8",
54
- "@hmharness/observability": "0.19.8",
55
- "@hmharness/sandbox": "0.19.8",
56
- "@hmharness/web": "0.19.8",
46
+ "@hmharness/agent": "0.20.0",
47
+ "@hmharness/cognitive": "0.20.0",
48
+ "@hmharness/domain-harmony": "0.20.0",
49
+ "@hmharness/domain-ops": "0.20.0",
50
+ "@hmharness/environments": "0.20.0",
51
+ "@hmharness/evaluation": "0.20.0",
52
+ "@hmharness/evolution": "0.20.0",
53
+ "@hmharness/kernel": "0.20.0",
54
+ "@hmharness/observability": "0.20.0",
55
+ "@hmharness/sandbox": "0.20.0",
56
+ "@hmharness/web": "0.20.0",
57
57
  "qrcode": "^1.5.4"
58
58
  }
59
59
  }