@hmharness/cli 0.4.0 → 0.4.1

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/tui.d.ts CHANGED
@@ -39,6 +39,9 @@ export declare class TuiRuntime {
39
39
  private cwdName;
40
40
  private skillCount;
41
41
  private t;
42
+ /** installed hmharness version, shown in the header (v0.4.0 style);
43
+ * defaults to the running build so even a bare runtime identifies itself */
44
+ private version;
42
45
  /** persistent header tag, e.g. the active approval mode (🔥 YOLO) */
43
46
  private modeTag;
44
47
  /** rows for the `/model ` picker (configured providers first, set by driver) */
@@ -89,7 +92,7 @@ export declare class TuiRuntime {
89
92
  /** The palette data source: `/model ` opens the model picker, otherwise
90
93
  * slash commands. Rows are {name, desc} so both share one renderer. */
91
94
  private panelItems;
92
- configure(model: string, cwdName: string, skillCount: number, locale: Locale): void;
95
+ configure(model: string, cwdName: string, skillCount: number, locale: Locale, version?: string): void;
93
96
  destroy(): void;
94
97
  waitExit(): Promise<void>;
95
98
  private quit;
package/dist/tui.js CHANGED
@@ -12,10 +12,21 @@
12
12
  */
13
13
  import { stdin, stdout } from 'node:process';
14
14
  import { basename } from 'node:path';
15
+ import { createRequire } from 'node:module';
15
16
  import { loadConfig, homeDir, resolveProvider, listProviders, setChatRoute, setLocale, PROVIDER_PRESETS, addProviders, detectLocalProviders } from '@hmharness/kernel';
16
17
  import { listDrafts, listSkills, runBench, runEvolution } from '@hmharness/evolution';
17
18
  import { buildRegistry, runAgentTask, strings } from '@hmharness/agent';
18
19
  import { ensureWebDaemon, DEFAULT_WEB_PORT } from "./web-daemon.js";
20
+ /** installed version, shown in the TUI header (v0.4.0) so users always
21
+ * know which build they are talking to - resolves in both src/ and dist/ */
22
+ const HMH_VERSION = (() => {
23
+ try {
24
+ return createRequire(import.meta.url)('../package.json').version;
25
+ }
26
+ catch {
27
+ return '';
28
+ }
29
+ })();
19
30
  const RESET = '\x1b[0m';
20
31
  const DIM = (s) => `\x1b[2m${s}${RESET}`;
21
32
  const BOLD = (s) => `\x1b[1m${s}${RESET}`;
@@ -148,6 +159,9 @@ export class TuiRuntime {
148
159
  cwdName = '';
149
160
  skillCount = 0;
150
161
  t = strings();
162
+ /** installed hmharness version, shown in the header (v0.4.0 style);
163
+ * defaults to the running build so even a bare runtime identifies itself */
164
+ version = HMH_VERSION;
151
165
  /** persistent header tag, e.g. the active approval mode (🔥 YOLO) */
152
166
  modeTag = '';
153
167
  /** rows for the `/model ` picker (configured providers first, set by driver) */
@@ -270,11 +284,12 @@ export class TuiRuntime {
270
284
  }
271
285
  return matchCommands(input).map((c) => ({ name: c.name, desc: String(this.t[c.key]) }));
272
286
  }
273
- configure(model, cwdName, skillCount, locale) {
287
+ configure(model, cwdName, skillCount, locale, version) {
274
288
  this.model = model;
275
289
  this.cwdName = cwdName;
276
290
  this.skillCount = skillCount;
277
291
  this.t = strings(locale);
292
+ this.version = version ?? HMH_VERSION;
278
293
  this.dirty = true;
279
294
  }
280
295
  destroy() {
@@ -626,7 +641,7 @@ export class TuiRuntime {
626
641
  // old right slot kept showing a stale "idle" - an orphan status.
627
642
  // Moving a thing means deleting it from where it was).
628
643
  // The ONLY live run indicator is the status line above the input box.
629
- const headLeft = ` ${BOLD('⚙ hmh')} ${DIM('·')} ${CYAN(this.model)} ${DIM('·')} ${this.cwdName} ${DIM('·')} ${this.skillCount} ${this.t.tuiSkills}` + (this.modeTag ? ` ${this.modeTag}` : '');
644
+ const headLeft = ` ${BOLD('⚙ hmh')}${this.version ? ` ${DIM('v' + this.version)}` : ''} ${DIM('·')} ${CYAN(this.model)} ${DIM('·')} ${this.cwdName} ${DIM('·')} ${this.skillCount} ${this.t.tuiSkills}` + (this.modeTag ? ` ${this.modeTag}` : '');
630
645
  frame.push(truncateTo(headLeft, W));
631
646
  frame.push(DIM('─'.repeat(W)));
632
647
  const allLines = [];
@@ -824,7 +839,7 @@ export async function tui(yes, noWeb = false) {
824
839
  const rt = new TuiRuntime();
825
840
  const skills = await listSkills(home);
826
841
  const chatModel = resolveProvider(cfg, 'chat').model;
827
- rt.configure(chatModel, basename(process.cwd()), skills.length, (cfg.locale ?? 'zh'));
842
+ rt.configure(chatModel, basename(process.cwd()), skills.length, (cfg.locale ?? 'zh'), HMH_VERSION);
828
843
  rt.setModelChoices(listProviders(cfg).map((v) => ({ name: v.name, desc: `${v.model}${v.purposes.length ? ' (' + v.purposes.join('/') + ')' : ''}` })));
829
844
  if (autoApprove)
830
845
  rt.setModeTag('🔥');
@@ -902,7 +917,7 @@ export async function tui(yes, noWeb = false) {
902
917
  const target = nextLocale(cfg.locale ?? 'zh', line.slice(5));
903
918
  cfg = await setLocale(target);
904
919
  t = strings(target);
905
- rt.configure(chatModel, basename(process.cwd()), skills.length, target);
920
+ rt.configure(chatModel, basename(process.cwd()), skills.length, target, HMH_VERSION);
906
921
  rt.addText(GREEN('✓') + ' ' + t.langSwitched(target));
907
922
  return;
908
923
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmharness/cli",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
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,11 +43,11 @@
43
43
  "build": "tsc -p tsconfig.build.json"
44
44
  },
45
45
  "dependencies": {
46
- "@hmharness/kernel": "0.4.0",
47
- "@hmharness/evolution": "0.4.0",
48
- "@hmharness/domain-harmony": "0.4.0",
49
- "@hmharness/domain-ops": "0.4.0",
50
- "@hmharness/agent": "0.4.0",
51
- "@hmharness/web": "0.4.0"
46
+ "@hmharness/kernel": "0.4.1",
47
+ "@hmharness/evolution": "0.4.1",
48
+ "@hmharness/domain-harmony": "0.4.1",
49
+ "@hmharness/domain-ops": "0.4.1",
50
+ "@hmharness/agent": "0.4.1",
51
+ "@hmharness/web": "0.4.1"
52
52
  }
53
53
  }