@hmharness/cli 0.14.11 → 0.14.13

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
@@ -308,11 +308,19 @@ async function repl(yes, initialHistory, initialSessionId) {
308
308
  continue;
309
309
  }
310
310
  if (line === '/ops' || line === '/ops scan') {
311
- const { harmonyOpsStatus, harmonyOpsRadarScan } = await import('@hmharness/domain-ops');
312
- const r = line === '/ops'
313
- ? await harmonyOpsStatus.execute({}, { cwd: process.cwd(), home })
314
- : await harmonyOpsRadarScan.execute({}, { cwd: process.cwd(), home });
315
- stdout.write(r.output + '\n');
311
+ const { harmonyOpsRadarScan, opsStatus, describeSources } = await import('@hmharness/domain-ops');
312
+ if (line === '/ops') {
313
+ const s = await opsStatus(home);
314
+ stdout.write((s.lastScan
315
+ ? t.opsRadarLine(s.scans, s.lastScan.replace('T', ' ').slice(0, 19))
316
+ : t.opsRadarNone) + '\n');
317
+ stdout.write(t.opsWatchingLabel + ' ' + describeSources(s.sources) + '\n');
318
+ stdout.write(DIM(t.opsHint) + '\n');
319
+ }
320
+ else {
321
+ const r = await harmonyOpsRadarScan.execute({}, { cwd: process.cwd(), home });
322
+ stdout.write(r.output + '\n');
323
+ }
316
324
  continue;
317
325
  }
318
326
  if (line === '/bench') {
@@ -744,7 +752,7 @@ flags:
744
752
  }
745
753
  if (cmd === 'ops') {
746
754
  await initHome();
747
- const { harmonyOpsRadarScan, harmonyOpsRadarBrief, harmonyOpsStatus } = await import('@hmharness/domain-ops');
755
+ const { harmonyOpsRadarScan, harmonyOpsRadarBrief } = await import('@hmharness/domain-ops');
748
756
  const sub = rest[0] ?? 'status';
749
757
  const ctx = { cwd: process.cwd(), home: homeDir() };
750
758
  if (sub === 'scan') {
@@ -766,8 +774,16 @@ flags:
766
774
  }
767
775
  }
768
776
  else {
769
- const r = await harmonyOpsStatus.execute({}, ctx);
770
- stdout.write(r.output + '\n');
777
+ // bare `hmh ops` (= status): localized human view, not raw keys
778
+ const { opsStatus, describeSources } = await import('@hmharness/domain-ops');
779
+ const cfgNow = await loadConfig();
780
+ const ot = strings((cfgNow.locale ?? 'zh'));
781
+ const s = await opsStatus(ctx.home);
782
+ stdout.write((s.lastScan
783
+ ? ot.opsRadarLine(s.scans, s.lastScan.replace('T', ' ').slice(0, 19))
784
+ : ot.opsRadarNone) + '\n');
785
+ stdout.write(ot.opsWatchingLabel + ' ' + describeSources(s.sources) + '\n');
786
+ stdout.write(DIM(ot.opsHint) + '\n');
771
787
  }
772
788
  return;
773
789
  }
package/dist/tui.d.ts CHANGED
@@ -120,16 +120,20 @@ export declare class TuiRuntime {
120
120
  private modeTag;
121
121
  /** rows for the `/model ` picker (configured providers first, set by driver) */
122
122
  private modelChoices;
123
- /** Wheel/click handling: SGR mouse reporting is ALWAYS on (enabled with
124
- * ?1000h+?1006h at startup). Cross-terminal wheel support has to come
125
- * from explicit reports: only some terminals translate the wheel to
126
- * arrow keys on the alternate screen, so the wheel would silently do
127
- * nothing on the others (conhost, several Linux terminals, the
128
- * KaihongOS terminal). The wheel drives the transcript (or the open
129
- * palette's selection); clicks only pick rows while a palette is open.
130
- * Native select/copy stays available via Shift+click, the standard
131
- * bypass in mainstream terminals. */
123
+ /** Wheel/click handling (T23, settled design): capture (?1000h+?1006h)
124
+ * is OFF by default - click-drag must stay the terminal's NATIVE
125
+ * selection, always-on capture took that away on every system. The
126
+ * wheel is covered by ?1007 (alternate scroll, enabled at startup):
127
+ * the terminal itself translates wheel -> arrow keys without touching
128
+ * clicks, and the existing arrow path scrolls the transcript. Capture
129
+ * turns on only while a palette is open (clicks choose rows, wheel
130
+ * drives selection) or when the user forces it with /mouse for
131
+ * terminals that honour neither wheel translation nor ?1007 (legacy
132
+ * conhost); Shift+drag still selects on mainstream terminals then. */
132
133
  private mouseReported;
134
+ /** /mouse force flag (persisted as config.json tui.mouse): full-time
135
+ * capture for terminals without any wheel translation */
136
+ private forceMouse;
133
137
  /** tail of an SGR mouse report split across stdin chunks (fast wheel
134
138
  * bursts); prepended to the next chunk so parseWheel sees the sequence */
135
139
  private mousePending;
@@ -211,6 +215,15 @@ export declare class TuiRuntime {
211
215
  frameText: string;
212
216
  };
213
217
  setModeTag(tag: string): void;
218
+ /** Capture is on ONLY while a palette is open or /mouse forced it -
219
+ * native selection must stay native everywhere else; ?1007 covers
220
+ * the wheel without any capture (T23). */
221
+ private syncMouseReporting;
222
+ /** /mouse (T23): force full-time capture for terminals that honour
223
+ * neither wheel->arrow translation nor ?1007. While forced, Shift+drag
224
+ * is the mainstream-terminal escape hatch back to selection. */
225
+ setMouseForced(on: boolean): void;
226
+ isMouseForced(): boolean;
214
227
  /** The palette data source: `/model ` opens the model picker, otherwise
215
228
  * slash commands. (/resume submits straight through to the driver, which
216
229
  * opens the Codex-style full-frame picker - resume-picker.ts.) Rows are
package/dist/tui.js CHANGED
@@ -111,6 +111,7 @@ export const COMMANDS = [
111
111
  { name: '/new', key: 'cmdNew' },
112
112
  { name: '/fork', key: 'cmdFork' },
113
113
  { name: '/copy', key: 'cmdCopy' },
114
+ { name: '/mouse', key: 'cmdMouse' },
114
115
  { name: '/plan', key: 'cmdPlan' },
115
116
  { name: '/goal', key: 'cmdGoal' },
116
117
  { name: '/usage', key: 'cmdUsage' },
@@ -313,16 +314,20 @@ export class TuiRuntime {
313
314
  modeTag = '';
314
315
  /** rows for the `/model ` picker (configured providers first, set by driver) */
315
316
  modelChoices = [];
316
- /** Wheel/click handling: SGR mouse reporting is ALWAYS on (enabled with
317
- * ?1000h+?1006h at startup). Cross-terminal wheel support has to come
318
- * from explicit reports: only some terminals translate the wheel to
319
- * arrow keys on the alternate screen, so the wheel would silently do
320
- * nothing on the others (conhost, several Linux terminals, the
321
- * KaihongOS terminal). The wheel drives the transcript (or the open
322
- * palette's selection); clicks only pick rows while a palette is open.
323
- * Native select/copy stays available via Shift+click, the standard
324
- * bypass in mainstream terminals. */
325
- mouseReported = true;
317
+ /** Wheel/click handling (T23, settled design): capture (?1000h+?1006h)
318
+ * is OFF by default - click-drag must stay the terminal's NATIVE
319
+ * selection, always-on capture took that away on every system. The
320
+ * wheel is covered by ?1007 (alternate scroll, enabled at startup):
321
+ * the terminal itself translates wheel -> arrow keys without touching
322
+ * clicks, and the existing arrow path scrolls the transcript. Capture
323
+ * turns on only while a palette is open (clicks choose rows, wheel
324
+ * drives selection) or when the user forces it with /mouse for
325
+ * terminals that honour neither wheel translation nor ?1007 (legacy
326
+ * conhost); Shift+drag still selects on mainstream terminals then. */
327
+ mouseReported = false;
328
+ /** /mouse force flag (persisted as config.json tui.mouse): full-time
329
+ * capture for terminals without any wheel translation */
330
+ forceMouse = false;
326
331
  /** tail of an SGR mouse report split across stdin chunks (fast wheel
327
332
  * bursts); prepended to the next chunk so parseWheel sees the sequence */
328
333
  mousePending = '';
@@ -356,11 +361,11 @@ export class TuiRuntime {
356
361
  // ?1l forces DECCKM OFF so arrow keys arrive as CSI (\x1b[A) even if a
357
362
  // previous program left the terminal in application cursor mode - in
358
363
  // that mode arrows arrive as SS3 (\x1bOA) and would be silently dropped.
359
- // SGR mouse reporting on from the first frame: the wheel must scroll on
360
- // every terminal, not only the ones that map wheel->arrows themselves.
364
+ // ?1007 alternate scroll: the terminal translates the wheel to arrow
365
+ // keys itself - no click capture, native selection stays native.
361
366
  // Bracketed paste (?2004h): multi-line pastes arrive delimited and
362
367
  // insert as one reviewable input instead of auto-submitting per line.
363
- stdout.write('\x1b[?1049h\x1b[?25l\x1b[2J\x1b[?1l\x1b[?1000h\x1b[?1006h\x1b[?2004h');
368
+ stdout.write('\x1b[?1049h\x1b[?25l\x1b[2J\x1b[?1l\x1b[?1007h\x1b[?2004h');
364
369
  stdin.setRawMode?.(true);
365
370
  stdin.resume();
366
371
  stdin.setEncoding('utf8');
@@ -608,6 +613,27 @@ export class TuiRuntime {
608
613
  this.modeTag = tag;
609
614
  this.dirty = true;
610
615
  }
616
+ /** Capture is on ONLY while a palette is open or /mouse forced it -
617
+ * native selection must stay native everywhere else; ?1007 covers
618
+ * the wheel without any capture (T23). */
619
+ syncMouseReporting() {
620
+ const want = this.forceMouse || this.panelItems(this.input).length > 0;
621
+ if (want === this.mouseReported)
622
+ return;
623
+ this.mouseReported = want;
624
+ stdout.write(want ? '\x1b[?1000h\x1b[?1006h' : '\x1b[?1000l\x1b[?1006l');
625
+ }
626
+ /** /mouse (T23): force full-time capture for terminals that honour
627
+ * neither wheel->arrow translation nor ?1007. While forced, Shift+drag
628
+ * is the mainstream-terminal escape hatch back to selection. */
629
+ setMouseForced(on) {
630
+ this.forceMouse = on;
631
+ this.syncMouseReporting();
632
+ this.dirty = true;
633
+ }
634
+ isMouseForced() {
635
+ return this.forceMouse;
636
+ }
611
637
  /** The palette data source: `/model ` opens the model picker, otherwise
612
638
  * slash commands. (/resume submits straight through to the driver, which
613
639
  * opens the Codex-style full-frame picker - resume-picker.ts.) Rows are
@@ -639,7 +665,7 @@ export class TuiRuntime {
639
665
  clearInterval(this.spinnerTimer);
640
666
  // ?1l restores default CSI cursor keys; reporting off whatever the
641
667
  // modal state was
642
- stdout.write((this.mouseReported ? '\x1b[?1000l\x1b[?1006l' : '') + '\x1b[?2004l' + '\x1b[?1l\x1b[?25h\x1b[?1049l');
668
+ stdout.write((this.mouseReported ? '\x1b[?1000l\x1b[?1006l' : '') + '\x1b[?2004l\x1b[?1007l' + '\x1b[?1l\x1b[?25h\x1b[?1049l');
643
669
  stdin.setRawMode?.(false);
644
670
  stdin.pause();
645
671
  }
@@ -1485,8 +1511,9 @@ export class TuiRuntime {
1485
1511
  this.flushFrame(frame, H);
1486
1512
  return;
1487
1513
  }
1514
+ // capture follows palette/force state (see syncMouseReporting, T23);
1488
1515
  // click rows are re-recorded every frame because screen positions move
1489
- // (mouse reporting is always on - see the mouseReported field note)
1516
+ this.syncMouseReporting();
1490
1517
  this.paletteClickRows.length = 0;
1491
1518
  const spin = '⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏'[this.spinnerFrame] ?? ' ';
1492
1519
  // Header = pure identity strip: logo · model · cwd · skills (+ mode tag
@@ -1887,6 +1914,10 @@ export async function tui(yes, noWeb = false, opts = {}) {
1887
1914
  }
1888
1915
  };
1889
1916
  applyStatusline();
1917
+ // T23: persisted /mouse force (config.json tui.mouse) - for terminals
1918
+ // that honour neither wheel->arrow translation nor ?1007
1919
+ if (cfg.tui?.mouse)
1920
+ rt.setMouseForced(true);
1890
1921
  // Ctrl+T overlay source: transcript + FULL (folded-away) tool outputs (B5)
1891
1922
  rt.setOverlaySource(() => {
1892
1923
  const out = [];
@@ -2180,6 +2211,21 @@ export async function tui(yes, noWeb = false, opts = {}) {
2180
2211
  rt.addText('(clipboard tool unavailable — output follows)\n' + lastAiText.slice(0, 2000), 'dim');
2181
2212
  return;
2182
2213
  }
2214
+ if (line === '/mouse') {
2215
+ // T23: full-time capture toggle for terminals without wheel
2216
+ // translation (?1007 already covers the wheel on mainstream ones);
2217
+ // while forced, Shift+drag is the selection escape hatch
2218
+ const next = !rt.isMouseForced();
2219
+ rt.setMouseForced(next);
2220
+ try {
2221
+ const { patchConfig } = await import('@hmharness/kernel');
2222
+ const merged = { ...(cfg.tui ?? {}), mouse: next };
2223
+ cfg = await patchConfig({ tui: merged });
2224
+ }
2225
+ catch { /* runtime toggle applied even when persisting fails */ }
2226
+ rt.addText(next ? t.cmdMouseOn : t.cmdMouseOff, 'plain');
2227
+ return;
2228
+ }
2183
2229
  if (line === '/plan' || line.startsWith('/plan ')) {
2184
2230
  // M4 B7: plan mode toggle (the directive is injected per-task, so the
2185
2231
  // agent always presents a plan and waits for confirmation first)
@@ -2421,9 +2467,13 @@ export async function tui(yes, noWeb = false, opts = {}) {
2421
2467
  if (line === '/ops') {
2422
2468
  rt.setBusy(true, '/ops');
2423
2469
  try {
2424
- const { harmonyOpsStatus } = await import('@hmharness/domain-ops');
2425
- const r = await harmonyOpsStatus.execute({}, { cwd: process.cwd(), home });
2426
- rt.addText(r.output);
2470
+ const { opsStatus, describeSources } = await import('@hmharness/domain-ops');
2471
+ const s = await opsStatus(home);
2472
+ rt.addText(s.lastScan
2473
+ ? t.opsRadarLine(s.scans, s.lastScan.replace('T', ' ').slice(0, 19))
2474
+ : t.opsRadarNone);
2475
+ rt.addText(t.opsWatchingLabel + ' ' + describeSources(s.sources));
2476
+ rt.addText(DIM(t.opsHint));
2427
2477
  }
2428
2478
  catch (err) {
2429
2479
  rt.addText(String(err), 'err');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmharness/cli",
3
- "version": "0.14.11",
3
+ "version": "0.14.13",
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",
@@ -47,7 +47,7 @@
47
47
  "@hmharness/observability": "0.7.0",
48
48
  "@hmharness/evolution": "0.14.9",
49
49
  "@hmharness/domain-harmony": "0.13.5",
50
- "@hmharness/domain-ops": "0.8.0",
50
+ "@hmharness/domain-ops": "0.8.1",
51
51
  "@hmharness/agent": "0.14.9",
52
52
  "@hmharness/evaluation": "0.8.0",
53
53
  "@hmharness/web": "0.9.1"