@hmharness/agent 0.23.52 → 0.23.55

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.
@@ -161,7 +161,7 @@ export class CognitiveRunRecorder {
161
161
  tags: ['run', success ? 'ok' : 'fail', traj.environment.id],
162
162
  });
163
163
  }
164
- const primary = [...written].sort((a, b) => b.traj.metrics.actions - a.traj.metrics.actions)[0];
164
+ const primary = written.toSorted((a, b) => b.traj.metrics.actions - a.traj.metrics.actions)[0];
165
165
  return { trajectoryId: primary.traj.id };
166
166
  }
167
167
  catch {
package/dist/gate.js CHANGED
@@ -49,7 +49,7 @@ export async function buildConditionedGate(home, tau) {
49
49
  const usable = all.filter((t) => t.steps.length > 0 && t.environment.id === 'terminal');
50
50
  // deterministic split (seed 1) — analysis-only, no decision leakage
51
51
  const rng = mulberry32(hashSeed('p2a-intervention-1'));
52
- const shuffled = [...usable].sort(() => rng() - 0.5);
52
+ const shuffled = usable.toSorted(() => rng() - 0.5);
53
53
  const train = shuffled.slice(0, Math.floor(shuffled.length * 0.7));
54
54
  const bump = (m, k, ok) => {
55
55
  const e = m.get(k) ?? { s: 0, f: 0 };
package/dist/i18n.d.ts CHANGED
@@ -197,5 +197,9 @@ export interface Strings {
197
197
  webNotRunning: string;
198
198
  webRunning: (pid: number, port: number) => string;
199
199
  tuiWebLinked: (port: number) => string;
200
+ /** the evolution daemon rides with the web one: `web stop` stops it, `web status` reports it */
201
+ evoStopped: string;
202
+ evoRunning: (pid: number) => string;
203
+ evoNotRunning: string;
200
204
  }
201
205
  export declare function strings(locale?: Locale): Strings;
package/dist/i18n.js CHANGED
@@ -167,6 +167,9 @@ const zh = {
167
167
  webNotRunning: 'hmh web 未在运行',
168
168
  webRunning: (pid, port) => `hmh web 运行中 (pid ${pid}) → http://127.0.0.1:${port}`,
169
169
  tuiWebLinked: (port) => `网页端已就绪 → http://127.0.0.1:${port}(本对话可在浏览器继续;hmh web stop 停止)`,
170
+ evoStopped: '后台进化守护已停止(hmh web start 会重新拉起)',
171
+ evoRunning: (pid) => `后台进化守护运行中 (pid ${pid}) · hmh web stop 一并停止`,
172
+ evoNotRunning: '后台进化守护未在运行',
170
173
  };
171
174
  const en = {
172
175
  replHint: 'type a task, or /exit to quit',
@@ -337,6 +340,9 @@ const en = {
337
340
  webNotRunning: 'hmh web is not running',
338
341
  webRunning: (pid, port) => `hmh web running (pid ${pid}) -> http://127.0.0.1:${port}`,
339
342
  tuiWebLinked: (port) => `web UI ready -> http://127.0.0.1:${port} (this conversation continues in the browser; hmh web stop to stop)`,
343
+ evoStopped: 'evolution daemon stopped (hmh web start brings it back)',
344
+ evoRunning: (pid) => `evolution daemon running (pid ${pid}) · hmh web stop stops it too`,
345
+ evoNotRunning: 'evolution daemon is not running',
340
346
  };
341
347
  export function strings(locale = 'zh') {
342
348
  return locale === 'en' ? en : zh;
package/dist/project.js CHANGED
@@ -18,7 +18,7 @@
18
18
  import { appendFile, cp, mkdir, mkdtemp, readFile, readdir, rm, writeFile } from 'node:fs/promises';
19
19
  import { execFile as execCb } from 'node:child_process';
20
20
  import { tmpdir } from 'node:os';
21
- import { join, resolve } from 'node:path';
21
+ import { join, resolve, basename, relative } from 'node:path';
22
22
  import { sandbox } from '@hmharness/sandbox';
23
23
  /** blueprint lifecycle: created→active→paused(=resumable)→completed→archived */
24
24
  const TRANSITIONS = {
@@ -233,7 +233,10 @@ export async function restoreCheckpoint(home, rec, checkpointId) {
233
233
  const tarFile = join(dir, '..', `cp-${Date.now()}.tar`);
234
234
  await git(['archive', '--format=tar', `--output=${tarFile}`, cpRef.tree], { cwd: rec.workspace, timeoutMs: 120_000 });
235
235
  await new Promise((res, rej) => {
236
- execCb('tar', ['-xf', tarFile, '-C', dir], { timeout: 120_000, windowsHide: true }, (err) => err ? rej(err) : res());
236
+ // relative paths from the temp dir: an absolute `C:\…` argument makes GNU tar
237
+ // (first on PATH under Git Bash/MSYS) read the drive letter as a remote host
238
+ // ("tar: Cannot connect to C: resolve failed"); Windows' own bsdtar takes both
239
+ execCb('tar', ['-xf', basename(tarFile), '-C', relative(tmpdir(), dir)], { cwd: tmpdir(), timeout: 120_000, windowsHide: true }, (err) => err ? rej(err) : res());
237
240
  });
238
241
  await rm(tarFile, { force: true });
239
242
  }
package/dist/tools.js CHANGED
@@ -5,8 +5,9 @@
5
5
  * guard on obviously destructive one-liners; approvals live in the kernel.
6
6
  */
7
7
  import { exec } from 'node:child_process';
8
- import { copyFile, readFile, readdir, writeFile } from 'node:fs/promises';
9
- import { isAbsolute, join, resolve } from 'node:path';
8
+ import { existsSync } from 'node:fs';
9
+ import { copyFile, mkdir, readFile, readdir, writeFile } from 'node:fs/promises';
10
+ import { dirname, isAbsolute, join, resolve } from 'node:path';
10
11
  import { promisify } from 'node:util';
11
12
  import { chatVision, homeDir, isBareProbe, isVisionRefusal, loadConfig, visionProviderChain } from '@hmharness/kernel';
12
13
  import { cognitiveQueryTool } from "./cognitive-tools.js";
@@ -70,8 +71,15 @@ export const writeFileTool = {
70
71
  const bak = p + '.bak-' + new Date().toISOString().replace(/[:.]/g, '-');
71
72
  await copyFile(p, bak).then(() => { backupNote = ` (backup: ${bak})`; }).catch(() => { });
72
73
  }
74
+ // a new file in a folder that does not exist yet is the normal shape of new
75
+ // work (a first module under a new directory). Until 0.23.55 it failed with
76
+ // ENOENT and cost a round trip through a shell mkdir - a dead end without one
77
+ const parent = dirname(p);
78
+ const newDir = !existsSync(parent);
79
+ if (newDir)
80
+ await mkdir(parent, { recursive: true });
73
81
  await writeFile(p, String(args.content ?? ''), 'utf8');
74
- return { output: `wrote ${String(args.content ?? '').length} chars to ${p}${backupNote}` };
82
+ return { output: `wrote ${String(args.content ?? '').length} chars to ${p}${newDir ? ' (created directory ' + parent + ')' : ''}${backupNote}` };
75
83
  }
76
84
  catch (err) {
77
85
  return { output: String(err), isError: true };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmharness/agent",
3
- "version": "0.23.52",
3
+ "version": "0.23.55",
4
4
  "description": "hmharness agent execution layer: base tools, system prompt, sub-agent spawn, and the shared task runner that frontends (cli, web) drive.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -15,16 +15,16 @@
15
15
  "build": "tsc -p tsconfig.build.json"
16
16
  },
17
17
  "dependencies": {
18
- "@hmharness/cognitive": "0.23.52",
19
- "@hmharness/domain-harmony": "0.23.52",
20
- "@hmharness/domain-ops": "0.23.52",
21
- "@hmharness/evolution": "0.23.52",
22
- "@hmharness/kernel": "0.23.52",
23
- "@hmharness/observability": "0.23.52",
24
- "@hmharness/sandbox": "0.23.52",
25
- "@hmharness/lsp": "0.23.52",
26
- "@hmharness/browser": "0.23.52",
27
- "@hmharness/extension": "0.23.52"
18
+ "@hmharness/cognitive": "0.23.55",
19
+ "@hmharness/domain-harmony": "0.23.55",
20
+ "@hmharness/domain-ops": "0.23.55",
21
+ "@hmharness/evolution": "0.23.55",
22
+ "@hmharness/kernel": "0.23.55",
23
+ "@hmharness/observability": "0.23.55",
24
+ "@hmharness/sandbox": "0.23.55",
25
+ "@hmharness/lsp": "0.23.55",
26
+ "@hmharness/browser": "0.23.55",
27
+ "@hmharness/extension": "0.23.55"
28
28
  },
29
29
  "files": [
30
30
  "dist"