@hmharness/cli 0.18.6 → 0.18.8

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 CHANGED
@@ -454,53 +454,53 @@ async function main() {
454
454
  const [cmd, ...rest] = args;
455
455
  const arg = rest.join(' ');
456
456
  if (cmd === 'help' || cmd === '--help' || cmd === '-h') {
457
- stdout.write(`hmh - self-evolving agent harness for HarmonyOS development
458
-
459
- usage:
460
- hmh "do something" one-shot task (full agent loop, streaming)
461
- hmh interactive REPL (conversation memory kept, /help for commands)
462
- hmh resume [id-prefix|--last] continue a past session (bare = full-screen picker,
463
- --last = newest session in this directory)
464
- hmh project [status|checkpoint <label>|restore <id>|pause|resume|complete|
465
- archive|release <ver>] project runtime: git-plumbing
466
- checkpoints (your tree untouched), sandbox
467
- materialization, run continuation (V2 M8)
468
- hmh experiment [list|show <id>|run <id> [--cases=N]|promote <id> [--human]|
469
- rollback <target>] evolution candidates: control/treatment
470
- bench arms + statistical promotion gate (V2 M9)
471
- hmh dataset [list|build [ver]|show <ver> [--train|--eval]]
472
- trajectory -> versioned, redacted, split dataset (V2 M10)
473
- hmh route shadow-router stats: agreement rate + outcome split (V2 M10)
474
- hmh readiness the RL gate: six conditions measured from real evidence (V2 M11)
475
- hmh pipeline "<task>" role pipeline: plan→code→test→review→judge (+repair loop,
476
- VERDICT gate) - V3 first slice (ADR-0006)
477
- hmh web start|stop|status web UI as a silent background daemon (no window,
478
- survives closing everything; log ~/.hmharness/web.log)
479
- hmh web [--port=7788] web UI in the foreground (debugging)
480
- hmh tui [--no-web] fullscreen terminal UI (slash palette, mouse wheel);
481
- also starts the web UI in the background (--no-web skips)
482
- hmh ops [scan|brief|stats|status] ops keeper: radar / npm download stats
483
- hmh knowledge refresh refresh static knowledge (fetch -> diff -> draft)
484
- hmh label [list|<session-id> <1-5> [note]] human reward labeling (RL-gate condition 3)
485
- hmh mcp-serve run as an MCP stdio SERVER: expose harmony_* tools to
486
- Claude Code / Codex / any MCP host
487
- (host config: npx -y @hmharness/cli mcp-serve)
488
- hmh devices|check direct tool run, no model
489
- hmh tools list all registered tools (native + MCP)
490
- hmh mcp show configured MCP servers and their tools
491
- hmh evolve [--every=N] self-evolution cycle (or resident loop)
492
- hmh bench [--impact] run the evolution bench / canary A/B report
493
- hmh skills [--promote|--rollback|--unpromote <name>]
494
- hmh skills add <git-url-or-local-dir> install skills (multi-skill packs supported)
495
- hmh state backup [--full] | restore [id] | remove <id|--all> | list
496
- snapshot / recover the evolution state (skills,
497
- memory, insights, logs); restore parks current
498
- state in a .pre-restore copy first
499
-
500
- flags:
501
- --yes / -y auto-approve gated tools (else they prompt; non-TTY denies)
502
- --locale=zh|en override the UI locale for this run
503
- --help | -h this help
457
+ stdout.write(`hmh - self-evolving agent harness for HarmonyOS development
458
+
459
+ usage:
460
+ hmh "do something" one-shot task (full agent loop, streaming)
461
+ hmh interactive REPL (conversation memory kept, /help for commands)
462
+ hmh resume [id-prefix|--last] continue a past session (bare = full-screen picker,
463
+ --last = newest session in this directory)
464
+ hmh project [status|checkpoint <label>|restore <id>|pause|resume|complete|
465
+ archive|release <ver>] project runtime: git-plumbing
466
+ checkpoints (your tree untouched), sandbox
467
+ materialization, run continuation (V2 M8)
468
+ hmh experiment [list|show <id>|run <id> [--cases=N]|promote <id> [--human]|
469
+ rollback <target>] evolution candidates: control/treatment
470
+ bench arms + statistical promotion gate (V2 M9)
471
+ hmh dataset [list|build [ver]|show <ver> [--train|--eval]]
472
+ trajectory -> versioned, redacted, split dataset (V2 M10)
473
+ hmh route shadow-router stats: agreement rate + outcome split (V2 M10)
474
+ hmh readiness the RL gate: six conditions measured from real evidence (V2 M11)
475
+ hmh pipeline "<task>" role pipeline: plan→code→test→review→judge (+repair loop,
476
+ VERDICT gate) - V3 first slice (ADR-0006)
477
+ hmh web start|stop|status web UI as a silent background daemon (no window,
478
+ survives closing everything; log ~/.hmharness/web.log)
479
+ hmh web [--port=7788] web UI in the foreground (debugging)
480
+ hmh tui [--no-web] fullscreen terminal UI (slash palette, mouse wheel);
481
+ also starts the web UI in the background (--no-web skips)
482
+ hmh ops [scan|brief|stats|status] ops keeper: radar / npm download stats
483
+ hmh knowledge refresh refresh static knowledge (fetch -> diff -> draft)
484
+ hmh label [list|<session-id> <1-5> [note]] human reward labeling (RL-gate condition 3)
485
+ hmh mcp-serve run as an MCP stdio SERVER: expose harmony_* tools to
486
+ Claude Code / Codex / any MCP host
487
+ (host config: npx -y @hmharness/cli mcp-serve)
488
+ hmh devices|check direct tool run, no model
489
+ hmh tools list all registered tools (native + MCP)
490
+ hmh mcp show configured MCP servers and their tools
491
+ hmh evolve [--every=N] self-evolution cycle (or resident loop)
492
+ hmh bench [--impact] run the evolution bench / canary A/B report
493
+ hmh skills [--promote|--rollback|--unpromote <name>]
494
+ hmh skills add <git-url-or-local-dir> install skills (multi-skill packs supported)
495
+ hmh state backup [--full] | restore [id] | remove <id|--all> | list
496
+ snapshot / recover the evolution state (skills,
497
+ memory, insights, logs); restore parks current
498
+ state in a .pre-restore copy first
499
+
500
+ flags:
501
+ --yes / -y auto-approve gated tools (else they prompt; non-TTY denies)
502
+ --locale=zh|en override the UI locale for this run
503
+ --help | -h this help
504
504
  `);
505
505
  return;
506
506
  }
@@ -1175,12 +1175,26 @@ flags:
1175
1175
  trainingFile: upTrain.id, validationFile: upEval?.id, suffix: 'hmh',
1176
1176
  });
1177
1177
  await CF.recordFineTuneJob(home, job, { model, trainFile: upTrain.id, evalFile: upEval?.id, pairs: rows.length });
1178
- stdout.write(GREEN('✓ 微调任务已创建:' + (job.id ?? '?') + '(状态 ' + String(job.status ?? '?') + ')\n'));
1178
+ stdout.write(GREEN('✓') + ' 微调任务已创建:' + (job.id ?? '?') + '(状态 ' + String(job.status ?? '?') + ')\n');
1179
1179
  stdout.write('训练完成后,用返回的模型编码(fine_tuned_model)即可直接调用。\n');
1180
1180
  stdout.write(DIM('查看进度:hmh auto-finetune --status\n'));
1181
1181
  }
1182
1182
  catch (err) {
1183
- stdout.write(RED('任务创建失败(上传的文件仍保留在云端可复用):' + String(err) + '\n'));
1183
+ const msg = String(err);
1184
+ // live finding 2026-09-26: some accounts pass model validation for
1185
+ // glm-4-flash/glm-4.5-air but the job-creation path 500s server-side -
1186
+ // the entitlement is half-open (glm-5.3 answers the clean
1187
+ // "联系客服开放" variant). The uploaded files stay valid, so record
1188
+ // them: a retry after the entitlement opens must NOT re-upload 2.7M tokens.
1189
+ await CF.recordFineTuneJob(home, { id: 'staged-' + stamp, status: 'staged', model }, { trainFile: upTrain.id, evalFile: upEval?.id, pairs: rows.length, error: msg.slice(0, 200) });
1190
+ stdout.write(RED('任务创建失败:' + msg.slice(0, 160) + '\n'));
1191
+ if (/参数校验解析异常/.test(msg)) {
1192
+ stdout.write(YELLOW('该模型在你账号上的微调权限可能未完全开通(对照:glm-5.3 会返回"微调功能未开放,请联系客服开放")。') + '\n');
1193
+ stdout.write(DIM('已上传的 ' + upTrain.id + ' / ' + (upEval?.id ?? '-') + ' 保留在云端并已记录,权限开通后重跑 hmh auto-finetune --submit 无需重新上传。\n'));
1194
+ }
1195
+ else {
1196
+ stdout.write(DIM('上传的文件保留在云端可复用:' + upTrain.id + '\n'));
1197
+ }
1184
1198
  }
1185
1199
  return;
1186
1200
  }
package/dist/tui.d.ts CHANGED
@@ -121,6 +121,12 @@ export declare class TuiRuntime {
121
121
  private version;
122
122
  /** persistent header tag, e.g. the active approval mode (🔥 YOLO) */
123
123
  private modeTag;
124
+ private modePlan;
125
+ /** Rebuild the ALWAYS-VISIBLE header mode badge (2026-09-25 user request:
126
+ * "让人知道此时处在什么模式下运行" - a bare 🔥 told half the story and
127
+ * the default ask mode showed nothing at all). Composed from state, not
128
+ * set ad hoc, so every switch keeps the badge truthful. */
129
+ setModes(yolo: boolean, plan?: boolean): void;
124
130
  /** rows for the `/model ` picker (configured providers first, set by driver) */
125
131
  private modelChoices;
126
132
  /** Wheel/click handling (T23, settled design): capture (?1000h+?1006h)
@@ -223,6 +229,8 @@ export declare class TuiRuntime {
223
229
  transcript: string;
224
230
  frameText: string;
225
231
  };
232
+ /** Legacy single-tag setter kept for compatibility; new code uses
233
+ * setModes(yolo, plan) which composes the full always-visible badge. */
226
234
  setModeTag(tag: string): void;
227
235
  /** Capture is on ONLY while a palette is open or /mouse forced it -
228
236
  * native selection must stay native everywhere else; ?1007 covers
package/dist/tui.js CHANGED
@@ -314,6 +314,20 @@ export class TuiRuntime {
314
314
  version = HMH_VERSION;
315
315
  /** persistent header tag, e.g. the active approval mode (🔥 YOLO) */
316
316
  modeTag = '';
317
+ modePlan = false;
318
+ /** Rebuild the ALWAYS-VISIBLE header mode badge (2026-09-25 user request:
319
+ * "让人知道此时处在什么模式下运行" - a bare 🔥 told half the story and
320
+ * the default ask mode showed nothing at all). Composed from state, not
321
+ * set ad hoc, so every switch keeps the badge truthful. */
322
+ setModes(yolo, plan = this.modePlan) {
323
+ this.modePlan = plan;
324
+ const parts = [];
325
+ parts.push(yolo ? '🔥 YOLO' : `🛡 ${this.t.modeAsk}`);
326
+ if (plan)
327
+ parts.push(`📋 ${this.t.modePlan}`);
328
+ this.modeTag = DIM('[') + parts.join(DIM(' · ')) + DIM(']');
329
+ this.dirty = true;
330
+ }
317
331
  /** rows for the `/model ` picker (configured providers first, set by driver) */
318
332
  modelChoices = [];
319
333
  /** Wheel/click handling (T23, settled design): capture (?1000h+?1006h)
@@ -644,6 +658,8 @@ export class TuiRuntime {
644
658
  })(),
645
659
  };
646
660
  }
661
+ /** Legacy single-tag setter kept for compatibility; new code uses
662
+ * setModes(yolo, plan) which composes the full always-visible badge. */
647
663
  setModeTag(tag) {
648
664
  this.modeTag = tag;
649
665
  this.dirty = true;
@@ -1806,8 +1822,7 @@ export async function tui(yes, noWeb = false, opts = {}) {
1806
1822
  const chatModel = resolveProvider(cfg, 'chat').model;
1807
1823
  rt.configure(chatModel, basename(process.cwd()), skills.length, (cfg.locale ?? 'zh'), HMH_VERSION);
1808
1824
  rt.setModelChoices(listProviders(cfg).map((v) => ({ name: v.name, desc: `${v.model}${v.purposes.length ? ' (' + v.purposes.join('/') + ')' : ''}` })));
1809
- if (autoApprove)
1810
- rt.setModeTag('🔥');
1825
+ rt.setModes(autoApprove); // always-visible badge, ask mode included
1811
1826
  rt.addText(t.tuiWelcome(chatModel), 'dim');
1812
1827
  if (webUp)
1813
1828
  rt.addText(t.tuiWebLinked(DEFAULT_WEB_PORT), 'dim');
@@ -2384,7 +2399,8 @@ export async function tui(yes, noWeb = false, opts = {}) {
2384
2399
  // M4 B7: plan mode toggle (the directive is injected per-task, so the
2385
2400
  // agent always presents a plan and waits for confirmation first)
2386
2401
  planMode = !planMode;
2387
- rt.addText(planMode ? GREEN('🔥') + ' ' + t.cmdPlanOn : t.cmdPlanOff, 'plain');
2402
+ rt.addText(planMode ? GREEN('📋') + ' ' + t.cmdPlanOn : t.cmdPlanOff, 'plain');
2403
+ rt.setModes(autoApprove, planMode); // plan state joins the always-visible badge
2388
2404
  return;
2389
2405
  }
2390
2406
  if (line === '/goal' || line.startsWith('/goal ')) {
@@ -2561,7 +2577,7 @@ export async function tui(yes, noWeb = false, opts = {}) {
2561
2577
  cfg = await patchConfig({ approval: turnOn ? 'auto' : 'ask' });
2562
2578
  }
2563
2579
  catch { /* runtime toggles still applied */ }
2564
- rt.setModeTag(turnOn ? '🔥' : '');
2580
+ rt.setModes(turnOn, planMode);
2565
2581
  rt.addText((turnOn ? t.yoloOn : t.yoloOff) + (turnOn ? '' : ''), 'plain');
2566
2582
  return;
2567
2583
  }
@@ -2570,6 +2586,7 @@ export async function tui(yes, noWeb = false, opts = {}) {
2570
2586
  cfg = await setLocale(target);
2571
2587
  t = strings(target);
2572
2588
  rt.configure(chatModel, basename(process.cwd()), skills.length, target, HMH_VERSION);
2589
+ rt.setModes(autoApprove, planMode); // badge text follows the new locale
2573
2590
  rt.addText(GREEN('✓') + ' ' + t.langSwitched(target));
2574
2591
  return;
2575
2592
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmharness/cli",
3
- "version": "0.18.6",
3
+ "version": "0.18.8",
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,14 +43,14 @@
43
43
  "build": "tsc -p tsconfig.build.json"
44
44
  },
45
45
  "dependencies": {
46
- "@hmharness/kernel": "0.9.7",
47
- "@hmharness/observability": "0.7.4",
48
- "@hmharness/evolution": "0.14.25",
49
- "@hmharness/domain-harmony": "0.13.8",
50
- "@hmharness/domain-ops": "0.8.3",
51
- "@hmharness/agent": "0.14.20",
52
- "@hmharness/evaluation": "0.8.6",
53
- "@hmharness/web": "0.9.7",
54
- "@hmharness/sandbox": "0.8.5"
46
+ "@hmharness/kernel": "*",
47
+ "@hmharness/observability": "*",
48
+ "@hmharness/evolution": "*",
49
+ "@hmharness/domain-harmony": "*",
50
+ "@hmharness/domain-ops": "*",
51
+ "@hmharness/agent": "0.14.21",
52
+ "@hmharness/evaluation": "*",
53
+ "@hmharness/web": "*",
54
+ "@hmharness/sandbox": "*"
55
55
  }
56
56
  }