@hmharness/cli 0.18.7 → 0.18.9

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
  }
package/dist/tui.d.ts CHANGED
@@ -52,21 +52,6 @@ export declare function renderStatusline(template: string, ctx: {
52
52
  export declare function parseKeySpec(spec: string): string | null;
53
53
  /** The remappable M2/M4 actions and their defaults (B14). */
54
54
  export declare const KEYMAP_DEFAULTS: Record<string, string>;
55
- /**
56
- * SGR mouse wheel decoding: '\x1b[<64;COL;ROWM' is wheel-up (-1), 65 is
57
- * wheel-down (+1), anything else (clicks, drags, plain keys) is 0.
58
- */
59
- export declare function parseWheel(data: string): number;
60
- /**
61
- * SGR reports can split across stdin chunks (fast wheel bursts fragment in
62
- * some terminals). If the buffer ends inside a report - a trailing
63
- * '\x1b[<...' with no terminating M/m yet - slice it off as `pending` for
64
- * the next chunk and hand back only the complete part.
65
- */
66
- export declare function splitMouseReport(data: string): {
67
- data: string;
68
- pending: string;
69
- };
70
55
  /**
71
56
  * Bracketed-paste body cleanup: strip the 200~/201~ markers and any escape
72
57
  * sequences (pasted terminal controls must not leak into the input line),
@@ -121,25 +106,23 @@ export declare class TuiRuntime {
121
106
  private version;
122
107
  /** persistent header tag, e.g. the active approval mode (🔥 YOLO) */
123
108
  private modeTag;
109
+ private modePlan;
110
+ /** Rebuild the ALWAYS-VISIBLE header mode badge (2026-09-25 user request:
111
+ * "让人知道此时处在什么模式下运行" - a bare 🔥 told half the story and
112
+ * the default ask mode showed nothing at all). Composed from state, not
113
+ * set ad hoc, so every switch keeps the badge truthful. */
114
+ setModes(yolo: boolean, plan?: boolean): void;
124
115
  /** rows for the `/model ` picker (configured providers first, set by driver) */
125
116
  private modelChoices;
126
- /** Wheel/click handling (T23, settled design): capture (?1000h+?1006h)
127
- * is OFF by default - click-drag must stay the terminal's NATIVE
128
- * selection, always-on capture took that away on every system. The
129
- * wheel is covered by ?1007 (alternate scroll, enabled at startup):
130
- * the terminal itself translates wheel -> arrow keys without touching
131
- * clicks, and the existing arrow path scrolls the transcript. Capture
132
- * turns on only while a palette is open (clicks choose rows, wheel
133
- * drives selection) or when the user forces it with /mouse for
134
- * terminals that honour neither wheel translation nor ?1007 (legacy
135
- * conhost); Shift+drag still selects on mainstream terminals then. */
136
- private mouseReported;
137
- /** /mouse force flag (persisted as config.json tui.mouse): full-time
138
- * capture for terminals without any wheel translation */
139
- private forceMouse;
140
- /** tail of an SGR mouse report split across stdin chunks (fast wheel
141
- * bursts); prepended to the next chunk so parseWheel sees the sequence */
142
- private mousePending;
117
+ /** Mouse handling (2026-09-26, T24 FINAL - the /mouse saga ends here):
118
+ * the app NEVER turns on mouse capture. The wheel scrolls through the
119
+ * terminal's own ?1007 alternate-scroll translation (enabled at startup,
120
+ * sent with the alt-screen enter sequence) which reports wheel events as
121
+ * plain arrow keys - the existing arrow path scrolls the transcript, and
122
+ * inside an open palette the arrows drive the selection. Click-drag
123
+ * selection/copy stays 100% native at all times, on every system, because
124
+ * there is simply no capture to escape from. The old escape hatches
125
+ * (full-time capture via /mouse, Shift+drag, palette SGR clicks) are gone. */
143
126
  /** bracketed-paste accumulator: non-null while the 201~ end marker has
144
127
  * not arrived yet; everything buffered is literal insert-on-completion */
145
128
  private pasteBuf;
@@ -147,9 +130,6 @@ export declare class TuiRuntime {
147
130
  * TUI's terminal ownership (see installConsoleRedirection) */
148
131
  private restoreConsole;
149
132
  private fatalHandler;
150
- /** screen row of each visible palette item (SGR click hit-testing); the
151
- * render loop records row = frame.length (1-based) as it pushes rows */
152
- private paletteClickRows;
153
133
  /** Ctrl+R incremental history search: { query, matches (history indices), sel } */
154
134
  private histSearch;
155
135
  /** Ctrl+T full-transcript overlay (also the pager base for B9): title + lines + viewport top */
@@ -209,34 +189,22 @@ export declare class TuiRuntime {
209
189
  * with no palette open it just submits the typed input. */
210
190
  private pickHighlighted;
211
191
  /** Introspection probe for headless tests: input line, palette rows, the
212
- * highlighted row index, mouse-reporting state, clickable rows, the
213
- * transcript text, and the last rendered frame (ANSI-stripped). */
192
+ * highlighted row index, the transcript text, and the last rendered
193
+ * frame (ANSI-stripped). */
214
194
  paletteProbe(): {
215
195
  input: string;
216
196
  rows: string[];
217
197
  selected: number;
218
- mouse: boolean;
219
- clickRows: Array<{
220
- row: number;
221
- idx: number;
222
- }>;
223
198
  transcript: string;
224
199
  frameText: string;
225
200
  };
201
+ /** Legacy single-tag setter kept for compatibility; new code uses
202
+ * setModes(yolo, plan) which composes the full always-visible badge. */
226
203
  setModeTag(tag: string): void;
227
- /** Capture is on ONLY while a palette is open or /mouse forced it -
228
- * native selection must stay native everywhere else; ?1007 covers
229
- * the wheel without any capture (T23). */
230
- private syncMouseReporting;
231
- /** /mouse (T23): force full-time capture for terminals that honour
232
- * neither wheel->arrow translation nor ?1007. While forced, Shift+drag
233
- * is the mainstream-terminal escape hatch back to selection. */
234
- setMouseForced(on: boolean): void;
235
- isMouseForced(): boolean;
236
204
  /** The palette data source: `/model ` opens the model picker, otherwise
237
205
  * slash commands. (/resume submits straight through to the driver, which
238
206
  * opens the Codex-style full-frame picker - resume-picker.ts.) Rows are
239
- * {name, desc} so both share one renderer, keyboard and click machinery. */
207
+ * {name, desc} so both share one renderer and keyboard machinery. */
240
208
  private panelItems;
241
209
  configure(model: string, cwdName: string, skillCount: number, locale: Locale, version?: string): void;
242
210
  destroy(): void;
package/dist/tui.js CHANGED
@@ -113,7 +113,6 @@ export const COMMANDS = [
113
113
  { name: '/fork', key: 'cmdFork' },
114
114
  { name: '/copy', key: 'cmdCopy' },
115
115
  { name: '/export', key: 'cmdExport' },
116
- { name: '/mouse', key: 'cmdMouse' },
117
116
  { name: '/plan', key: 'cmdPlan' },
118
117
  { name: '/goal', key: 'cmdGoal' },
119
118
  { name: '/usage', key: 'cmdUsage' },
@@ -216,36 +215,11 @@ export const KEYMAP_DEFAULTS = {
216
215
  transcript: '\x14', // T15: Ctrl+T
217
216
  externalEdit: '\x07', // B12: Ctrl+G
218
217
  };
219
- /**
220
- * SGR mouse wheel decoding: '\x1b[<64;COL;ROWM' is wheel-up (-1), 65 is
221
- * wheel-down (+1), anything else (clicks, drags, plain keys) is 0.
222
- */
223
- export function parseWheel(data) {
224
- const m = data.match(/^\x1b\[<(\d+);\d+;\d+[Mm]/);
225
- if (!m)
226
- return 0;
227
- const btn = Number(m[1]);
228
- if (btn === 64)
229
- return -1;
230
- if (btn === 65)
231
- return 1;
232
- return 0;
233
- }
234
- /**
235
- * SGR reports can split across stdin chunks (fast wheel bursts fragment in
236
- * some terminals). If the buffer ends inside a report - a trailing
237
- * '\x1b[<...' with no terminating M/m yet - slice it off as `pending` for
238
- * the next chunk and hand back only the complete part.
239
- */
240
- export function splitMouseReport(data) {
241
- const cut = data.lastIndexOf('\x1b[<');
242
- if (cut === -1)
243
- return { data, pending: '' };
244
- const tail = data.slice(cut);
245
- return /^\x1b\[<\d+(;\d+)*[Mm]$/.test(tail)
246
- ? { data, pending: '' }
247
- : { data: data.slice(0, cut), pending: tail };
248
- }
218
+ // T24 (2026-09-26): parseWheel/splitMouseReport and every SGR-capture path
219
+ // were REMOVED - the app never enables mouse reporting. The wheel works via
220
+ // the terminal's ?1007 alternate-scroll translation (arrow keys), selection
221
+ // and copy are always native. Do not reintroduce capture modes here; the
222
+ // T21->T23 history showed each one cost native selection somewhere.
249
223
  /**
250
224
  * Bracketed-paste body cleanup: strip the 200~/201~ markers and any escape
251
225
  * sequences (pasted terminal controls must not leak into the input line),
@@ -314,25 +288,31 @@ export class TuiRuntime {
314
288
  version = HMH_VERSION;
315
289
  /** persistent header tag, e.g. the active approval mode (🔥 YOLO) */
316
290
  modeTag = '';
291
+ modePlan = false;
292
+ /** Rebuild the ALWAYS-VISIBLE header mode badge (2026-09-25 user request:
293
+ * "让人知道此时处在什么模式下运行" - a bare 🔥 told half the story and
294
+ * the default ask mode showed nothing at all). Composed from state, not
295
+ * set ad hoc, so every switch keeps the badge truthful. */
296
+ setModes(yolo, plan = this.modePlan) {
297
+ this.modePlan = plan;
298
+ const parts = [];
299
+ parts.push(yolo ? '🔥 YOLO' : `🛡 ${this.t.modeAsk}`);
300
+ if (plan)
301
+ parts.push(`📋 ${this.t.modePlan}`);
302
+ this.modeTag = DIM('[') + parts.join(DIM(' · ')) + DIM(']');
303
+ this.dirty = true;
304
+ }
317
305
  /** rows for the `/model ` picker (configured providers first, set by driver) */
318
306
  modelChoices = [];
319
- /** Wheel/click handling (T23, settled design): capture (?1000h+?1006h)
320
- * is OFF by default - click-drag must stay the terminal's NATIVE
321
- * selection, always-on capture took that away on every system. The
322
- * wheel is covered by ?1007 (alternate scroll, enabled at startup):
323
- * the terminal itself translates wheel -> arrow keys without touching
324
- * clicks, and the existing arrow path scrolls the transcript. Capture
325
- * turns on only while a palette is open (clicks choose rows, wheel
326
- * drives selection) or when the user forces it with /mouse for
327
- * terminals that honour neither wheel translation nor ?1007 (legacy
328
- * conhost); Shift+drag still selects on mainstream terminals then. */
329
- mouseReported = false;
330
- /** /mouse force flag (persisted as config.json tui.mouse): full-time
331
- * capture for terminals without any wheel translation */
332
- forceMouse = false;
333
- /** tail of an SGR mouse report split across stdin chunks (fast wheel
334
- * bursts); prepended to the next chunk so parseWheel sees the sequence */
335
- mousePending = '';
307
+ /** Mouse handling (2026-09-26, T24 FINAL - the /mouse saga ends here):
308
+ * the app NEVER turns on mouse capture. The wheel scrolls through the
309
+ * terminal's own ?1007 alternate-scroll translation (enabled at startup,
310
+ * sent with the alt-screen enter sequence) which reports wheel events as
311
+ * plain arrow keys - the existing arrow path scrolls the transcript, and
312
+ * inside an open palette the arrows drive the selection. Click-drag
313
+ * selection/copy stays 100% native at all times, on every system, because
314
+ * there is simply no capture to escape from. The old escape hatches
315
+ * (full-time capture via /mouse, Shift+drag, palette SGR clicks) are gone. */
336
316
  /** bracketed-paste accumulator: non-null while the 201~ end marker has
337
317
  * not arrived yet; everything buffered is literal insert-on-completion */
338
318
  pasteBuf = null;
@@ -340,9 +320,6 @@ export class TuiRuntime {
340
320
  * TUI's terminal ownership (see installConsoleRedirection) */
341
321
  restoreConsole = null;
342
322
  fatalHandler = null;
343
- /** screen row of each visible palette item (SGR click hit-testing); the
344
- * render loop records row = frame.length (1-based) as it pushes rows */
345
- paletteClickRows = [];
346
323
  /* ---------------- M2: runtime steering modals (codex parity) ---------------- */
347
324
  /** Ctrl+R incremental history search: { query, matches (history indices), sel } */
348
325
  histSearch = null;
@@ -603,8 +580,8 @@ export class TuiRuntime {
603
580
  this.driver?.();
604
581
  }
605
582
  /** Introspection probe for headless tests: input line, palette rows, the
606
- * highlighted row index, mouse-reporting state, clickable rows, the
607
- * transcript text, and the last rendered frame (ANSI-stripped). */
583
+ * highlighted row index, the transcript text, and the last rendered
584
+ * frame (ANSI-stripped). */
608
585
  paletteProbe() {
609
586
  const rows = this.panelItems(this.input);
610
587
  const lines = [];
@@ -626,8 +603,6 @@ export class TuiRuntime {
626
603
  input: this.input,
627
604
  rows: rows.map((r) => r.name),
628
605
  selected: rows.length ? Math.min(this.cmdIdx, rows.length - 1) : -1,
629
- mouse: this.mouseReported,
630
- clickRows: this.paletteClickRows.map((p) => ({ ...p })),
631
606
  transcript: lines.join('\n'),
632
607
  // frame rows: split on the CUP positioning pairs, take the content
633
608
  // halves by parity, strip ANSI. (A 'startsWith ESC' filter used to
@@ -644,35 +619,16 @@ export class TuiRuntime {
644
619
  })(),
645
620
  };
646
621
  }
622
+ /** Legacy single-tag setter kept for compatibility; new code uses
623
+ * setModes(yolo, plan) which composes the full always-visible badge. */
647
624
  setModeTag(tag) {
648
625
  this.modeTag = tag;
649
626
  this.dirty = true;
650
627
  }
651
- /** Capture is on ONLY while a palette is open or /mouse forced it -
652
- * native selection must stay native everywhere else; ?1007 covers
653
- * the wheel without any capture (T23). */
654
- syncMouseReporting() {
655
- const want = this.forceMouse || this.panelItems(this.input).length > 0;
656
- if (want === this.mouseReported)
657
- return;
658
- this.mouseReported = want;
659
- stdout.write(want ? '\x1b[?1000h\x1b[?1006h' : '\x1b[?1000l\x1b[?1006l');
660
- }
661
- /** /mouse (T23): force full-time capture for terminals that honour
662
- * neither wheel->arrow translation nor ?1007. While forced, Shift+drag
663
- * is the mainstream-terminal escape hatch back to selection. */
664
- setMouseForced(on) {
665
- this.forceMouse = on;
666
- this.syncMouseReporting();
667
- this.dirty = true;
668
- }
669
- isMouseForced() {
670
- return this.forceMouse;
671
- }
672
628
  /** The palette data source: `/model ` opens the model picker, otherwise
673
629
  * slash commands. (/resume submits straight through to the driver, which
674
630
  * opens the Codex-style full-frame picker - resume-picker.ts.) Rows are
675
- * {name, desc} so both share one renderer, keyboard and click machinery. */
631
+ * {name, desc} so both share one renderer and keyboard machinery. */
676
632
  panelItems(input) {
677
633
  if (input === '/model' || input.startsWith('/model ')) {
678
634
  const q = input.slice(6).trim().toLowerCase();
@@ -700,7 +656,9 @@ export class TuiRuntime {
700
656
  clearInterval(this.spinnerTimer);
701
657
  // ?1l restores default CSI cursor keys; reporting off whatever the
702
658
  // modal state was
703
- stdout.write((this.mouseReported ? '\x1b[?1000l\x1b[?1006l' : '') + '\x1b[?2004l\x1b[?1007l' + '\x1b[?1l\x1b[?25h\x1b[?1049l');
659
+ // T24: capture is never enabled; reset any reporting mode unconditionally
660
+ // on exit (defensive - covers a stray enable from an older version)
661
+ stdout.write('\x1b[?1000l\x1b[?1006l\x1b[?2004l\x1b[?1007l\x1b[?1l\x1b[?25h\x1b[?1049l');
704
662
  this.restoreConsole?.();
705
663
  if (this.fatalHandler) {
706
664
  process.off('unhandledRejection', this.fatalHandler);
@@ -1190,18 +1148,6 @@ export class TuiRuntime {
1190
1148
  return n;
1191
1149
  }
1192
1150
  onKey(data) {
1193
- // reassemble an SGR mouse report that arrived split across stdin chunks
1194
- // (fast wheel bursts fragment in some terminals) before anything parses
1195
- if (this.mousePending) {
1196
- data = this.mousePending + data;
1197
- this.mousePending = '';
1198
- }
1199
- const split = splitMouseReport(data);
1200
- if (split.pending)
1201
- this.mousePending = split.pending;
1202
- if (!split.data)
1203
- return;
1204
- data = split.data;
1205
1151
  // bracketed paste (T22): buffer until the 201~ end marker, then insert
1206
1152
  // the sanitized body at the caret; keys/bytes outside the markers keep
1207
1153
  // flowing through the normal path (recursion depth stays 1: indexOf
@@ -1244,11 +1190,10 @@ export class TuiRuntime {
1244
1190
  // matches so navigation never silently dies
1245
1191
  if (/^\x1bO[A-H]$/.test(data))
1246
1192
  data = '\x1b[' + data[2];
1247
- // resume picker modal owns every event while open - keyboard AND wheel
1248
- // (codex: the picker runs its own event loop until it resolves)
1193
+ // resume picker modal owns every event while open (codex: the picker
1194
+ // runs its own event loop until it resolves)
1249
1195
  if (this.resumeModal) {
1250
- const wheel = parseWheel(data);
1251
- const key = wheel !== 0 ? (wheel < 0 ? 'up' : 'down') : pickerKey(data);
1196
+ const key = pickerKey(data);
1252
1197
  if (key !== null)
1253
1198
  this.pickerInput(key);
1254
1199
  return;
@@ -1267,43 +1212,9 @@ export class TuiRuntime {
1267
1212
  this.atPalKey(data);
1268
1213
  return;
1269
1214
  }
1270
- // wheel-only mouse routing: 64 = wheel-up, 65 = wheel-down. Reporting
1271
- // is always on, so every other report - click, drag, release - is just
1272
- // swallowed below; the terminal's Shift+click native selection bypasses
1273
- // the app entirely and keeps working.
1274
- const wheel = parseWheel(data);
1275
- if (wheel !== 0) {
1276
- // an open palette takes the wheel: it moves the selection (the list
1277
- // is what the user is driving), the transcript only scrolls when the
1278
- // palette is closed
1279
- const hits = this.panelItems(this.input);
1280
- if (hits.length) {
1281
- this.cmdIdx = Math.max(0, Math.min(hits.length - 1, this.cmdIdx + wheel));
1282
- this.dirty = true;
1283
- return;
1284
- }
1285
- // wheel-up (-1) moves the viewport UP, i.e. further from the bottom
1286
- this.scrollFromBottom = Math.max(0, Math.min(this.totalLines(), this.scrollFromBottom - wheel * 3));
1287
- this.dirty = true;
1288
- return;
1289
- }
1290
- // click-to-choose on the open palette (SGR button-0 press): the
1291
- // terminal-reported row maps 1:1 to the screen row render() recorded
1292
- // for that item, so a click is a row selection + confirm
1293
- if (this.paletteClickRows.length) {
1294
- const click = data.match(/^\x1b\[<0;\d+;(\d+)M$/);
1295
- if (click) {
1296
- const row = Number(click[1]);
1297
- const hitRow = this.paletteClickRows.find((p) => p.row === row);
1298
- if (hitRow) {
1299
- this.cmdIdx = hitRow.idx;
1300
- this.pickHighlighted();
1301
- return;
1302
- }
1303
- }
1304
- }
1305
- // swallow any other SGR mouse report that slips through so it never
1306
- // leaks into the input line as garbage
1215
+ // T24: capture is never enabled, so SGR reports cannot legitimately
1216
+ // arrive - swallow the pattern anyway so a stray report from a weird
1217
+ // terminal never leaks into the input line as garbage
1307
1218
  if (/^\x1b\[<\d+;\d+;\d+[Mm]/.test(data))
1308
1219
  return;
1309
1220
  if (this.approval) {
@@ -1590,10 +1501,6 @@ export class TuiRuntime {
1590
1501
  this.flushFrame(frame, H);
1591
1502
  return;
1592
1503
  }
1593
- // capture follows palette/force state (see syncMouseReporting, T23);
1594
- // click rows are re-recorded every frame because screen positions move
1595
- this.syncMouseReporting();
1596
- this.paletteClickRows.length = 0;
1597
1504
  const spin = '⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏'[this.spinnerFrame] ?? ' ';
1598
1505
  // Header = pure identity strip: logo · model · cwd · skills (+ mode tag
1599
1506
  // when set). NO status word up here at all (T1-v2, design-revised: the
@@ -1657,10 +1564,6 @@ export class TuiRuntime {
1657
1564
  const c = cmdHits[gi];
1658
1565
  const sel = gi === this.cmdIdx;
1659
1566
  frame.push(truncateTo((sel ? '› ' : ' ') + (sel ? CYAN(c.name) : DIM(c.name)) + ' ' + DIM(truncateTo(c.desc, 46)), W - 1));
1660
- // row lands at screen line frame.length (render addresses rows
1661
- // 1-based); only rows that survive the H clip are clickable
1662
- if (frame.length <= H)
1663
- this.paletteClickRows.push({ row: frame.length, idx: gi });
1664
1567
  }
1665
1568
  frame.push(DIM(truncateTo(' ' + this.t.panelHint, W - 1)));
1666
1569
  }
@@ -1806,8 +1709,7 @@ export async function tui(yes, noWeb = false, opts = {}) {
1806
1709
  const chatModel = resolveProvider(cfg, 'chat').model;
1807
1710
  rt.configure(chatModel, basename(process.cwd()), skills.length, (cfg.locale ?? 'zh'), HMH_VERSION);
1808
1711
  rt.setModelChoices(listProviders(cfg).map((v) => ({ name: v.name, desc: `${v.model}${v.purposes.length ? ' (' + v.purposes.join('/') + ')' : ''}` })));
1809
- if (autoApprove)
1810
- rt.setModeTag('🔥');
1712
+ rt.setModes(autoApprove); // always-visible badge, ask mode included
1811
1713
  rt.addText(t.tuiWelcome(chatModel), 'dim');
1812
1714
  if (webUp)
1813
1715
  rt.addText(t.tuiWebLinked(DEFAULT_WEB_PORT), 'dim');
@@ -2007,10 +1909,9 @@ export async function tui(yes, noWeb = false, opts = {}) {
2007
1909
  }
2008
1910
  };
2009
1911
  applyStatusline();
2010
- // T23: persisted /mouse force (config.json tui.mouse) - for terminals
2011
- // that honour neither wheel->arrow translation nor ?1007
2012
- if (cfg.tui?.mouse)
2013
- rt.setMouseForced(true);
1912
+ // T24: config.json tui.mouse is intentionally IGNORED now - the permanent
1913
+ // scheme (?1007 wheel + native selection) has no modes. Leftover values
1914
+ // from older versions are harmless residue.
2014
1915
  // Ctrl+T overlay source: transcript + FULL (folded-away) tool outputs (B5)
2015
1916
  rt.setOverlaySource(() => {
2016
1917
  const out = [];
@@ -2366,25 +2267,18 @@ export async function tui(yes, noWeb = false, opts = {}) {
2366
2267
  return;
2367
2268
  }
2368
2269
  if (line === '/mouse') {
2369
- // T23: full-time capture toggle for terminals without wheel
2370
- // translation (?1007 already covers the wheel on mainstream ones);
2371
- // while forced, Shift+drag is the selection escape hatch
2372
- const next = !rt.isMouseForced();
2373
- rt.setMouseForced(next);
2374
- try {
2375
- const { patchConfig } = await import('@hmharness/kernel');
2376
- const merged = { ...(cfg.tui ?? {}), mouse: next };
2377
- cfg = await patchConfig({ tui: merged });
2378
- }
2379
- catch { /* runtime toggle applied even when persisting fails */ }
2380
- rt.addText(next ? t.cmdMouseOn : t.cmdMouseOff, 'plain');
2270
+ // T24 (2026-09-26): the toggle is GONE - the permanent scheme (wheel
2271
+ // via ?1007 translation + always-native selection) needs no modes.
2272
+ // Tell any muscle memory clearly instead of silently failing.
2273
+ rt.addText(t.cmdMouseRemoved, 'plain');
2381
2274
  return;
2382
2275
  }
2383
2276
  if (line === '/plan' || line.startsWith('/plan ')) {
2384
2277
  // M4 B7: plan mode toggle (the directive is injected per-task, so the
2385
2278
  // agent always presents a plan and waits for confirmation first)
2386
2279
  planMode = !planMode;
2387
- rt.addText(planMode ? GREEN('🔥') + ' ' + t.cmdPlanOn : t.cmdPlanOff, 'plain');
2280
+ rt.addText(planMode ? GREEN('📋') + ' ' + t.cmdPlanOn : t.cmdPlanOff, 'plain');
2281
+ rt.setModes(autoApprove, planMode); // plan state joins the always-visible badge
2388
2282
  return;
2389
2283
  }
2390
2284
  if (line === '/goal' || line.startsWith('/goal ')) {
@@ -2561,7 +2455,7 @@ export async function tui(yes, noWeb = false, opts = {}) {
2561
2455
  cfg = await patchConfig({ approval: turnOn ? 'auto' : 'ask' });
2562
2456
  }
2563
2457
  catch { /* runtime toggles still applied */ }
2564
- rt.setModeTag(turnOn ? '🔥' : '');
2458
+ rt.setModes(turnOn, planMode);
2565
2459
  rt.addText((turnOn ? t.yoloOn : t.yoloOff) + (turnOn ? '' : ''), 'plain');
2566
2460
  return;
2567
2461
  }
@@ -2570,6 +2464,7 @@ export async function tui(yes, noWeb = false, opts = {}) {
2570
2464
  cfg = await setLocale(target);
2571
2465
  t = strings(target);
2572
2466
  rt.configure(chatModel, basename(process.cwd()), skills.length, target, HMH_VERSION);
2467
+ rt.setModes(autoApprove, planMode); // badge text follows the new locale
2573
2468
  rt.addText(GREEN('✓') + ' ' + t.langSwitched(target));
2574
2469
  return;
2575
2470
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmharness/cli",
3
- "version": "0.18.7",
3
+ "version": "0.18.9",
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.22",
52
+ "@hmharness/evaluation": "*",
53
+ "@hmharness/web": "*",
54
+ "@hmharness/sandbox": "*"
55
55
  }
56
56
  }