@hmharness/cli 0.19.3 → 0.19.4
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 +35 -1
- package/package.json +12 -12
package/dist/main.js
CHANGED
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
import readline from 'node:readline/promises';
|
|
25
25
|
import { stdin, stdout } from 'node:process';
|
|
26
26
|
import { readFile } from 'node:fs/promises';
|
|
27
|
+
import { mkdir, rm } from 'node:fs/promises';
|
|
27
28
|
import { join } from 'node:path';
|
|
29
|
+
import { tmpdir } from 'node:os';
|
|
28
30
|
import { stopWebDaemon, startWebDaemon, hmhWebUp, readWebPid } from "./web-daemon.js";
|
|
29
31
|
import { chat, homeDir, resolveProvider, initHome, latestSession, listProviders, listSessions, loadConfig, loadTranscript, mcpServerTools, Registry, runLoop, setChatRoute, setLocale, } from '@hmharness/kernel';
|
|
30
32
|
import { listSkills, listDrafts, promoteSkill, runBench, runEvolution, rollbackSkill, unpromoteSkill, } from '@hmharness/evolution';
|
|
@@ -984,8 +986,40 @@ flags:
|
|
|
984
986
|
}
|
|
985
987
|
return;
|
|
986
988
|
}
|
|
989
|
+
if (sub === 'explore') {
|
|
990
|
+
// blueprint M4: run the exploration engine against a real environment.
|
|
991
|
+
// Unknown affordances get probed under budget; the outcome lands in
|
|
992
|
+
// the trajectory store + episodic index like any task run.
|
|
993
|
+
const actions = Number(rest.find((a) => a.startsWith('--actions='))?.slice(10) ?? 6);
|
|
994
|
+
const home = homeDir();
|
|
995
|
+
const scratch = join(tmpdir(), `hmh-explore-${Date.now().toString(36)}`);
|
|
996
|
+
await mkdir(scratch, { recursive: true });
|
|
997
|
+
try {
|
|
998
|
+
const { runExploration } = await import('@hmharness/cognitive');
|
|
999
|
+
const { TerminalEnvironment } = await import('@hmharness/environments');
|
|
1000
|
+
const summary = await runExploration(home, {
|
|
1001
|
+
environmentId: 'terminal',
|
|
1002
|
+
maxActions: Number.isFinite(actions) ? Math.min(Math.max(actions, 1), 20) : 6,
|
|
1003
|
+
maxCost: 40,
|
|
1004
|
+
env: new TerminalEnvironment({ workspaceDir: scratch, timeoutMs: 15_000 }),
|
|
1005
|
+
});
|
|
1006
|
+
stdout.write(`探索完成 · ${summary.result.actionsTaken} 动作 / ${summary.result.costSpent} 成本单位${summary.result.aborted ? `(${summary.result.aborted === 'budget' ? '预算到限' : summary.result.aborted === 'risk' ? '风险熔断' : '无候选动作'})` : ''}\n`);
|
|
1007
|
+
stdout.write(` 轨迹 ${summary.trajectoryId} 已落盘 · 假设裁决 ${summary.result.hypothesesResolved} 条\n`);
|
|
1008
|
+
for (const h of summary.hypotheses)
|
|
1009
|
+
stdout.write(DIM(` [${h.status}] ${h.claim}\n`));
|
|
1010
|
+
if (summary.worldModelBeliefs.length) {
|
|
1011
|
+
stdout.write(' 信念更新:\n');
|
|
1012
|
+
for (const b of summary.worldModelBeliefs.slice(0, 6))
|
|
1013
|
+
stdout.write(` ${b.actionType.padEnd(22)} 置信 ${b.confidence.toFixed(2)} × ${b.evidenceCount}\n`);
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
finally {
|
|
1017
|
+
await rm(scratch, { recursive: true, force: true }).catch(() => undefined);
|
|
1018
|
+
}
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
987
1021
|
if (sub !== 'status') {
|
|
988
|
-
stdout.write('用法: hmh cognitive status|world-model|diagnose|bench|drift|skills — 认知子系统与世界模型\n');
|
|
1022
|
+
stdout.write('用法: hmh cognitive status|world-model|diagnose|bench|drift|skills|explore — 认知子系统与世界模型\n');
|
|
989
1023
|
return;
|
|
990
1024
|
}
|
|
991
1025
|
const { cognitiveStatus, formatCognitiveStatus } = await import('@hmharness/cognitive');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hmharness/cli",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.4",
|
|
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,17 +43,17 @@
|
|
|
43
43
|
"build": "tsc -p tsconfig.build.json"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@hmharness/agent": "0.19.
|
|
47
|
-
"@hmharness/cognitive": "0.19.
|
|
48
|
-
"@hmharness/domain-harmony": "0.19.
|
|
49
|
-
"@hmharness/domain-ops": "0.19.
|
|
50
|
-
"@hmharness/environments": "0.19.
|
|
51
|
-
"@hmharness/evaluation": "0.19.
|
|
52
|
-
"@hmharness/evolution": "0.19.
|
|
53
|
-
"@hmharness/kernel": "0.19.
|
|
54
|
-
"@hmharness/observability": "0.19.
|
|
55
|
-
"@hmharness/sandbox": "0.19.
|
|
56
|
-
"@hmharness/web": "0.19.
|
|
46
|
+
"@hmharness/agent": "0.19.4",
|
|
47
|
+
"@hmharness/cognitive": "0.19.4",
|
|
48
|
+
"@hmharness/domain-harmony": "0.19.4",
|
|
49
|
+
"@hmharness/domain-ops": "0.19.4",
|
|
50
|
+
"@hmharness/environments": "0.19.4",
|
|
51
|
+
"@hmharness/evaluation": "0.19.4",
|
|
52
|
+
"@hmharness/evolution": "0.19.4",
|
|
53
|
+
"@hmharness/kernel": "0.19.4",
|
|
54
|
+
"@hmharness/observability": "0.19.4",
|
|
55
|
+
"@hmharness/sandbox": "0.19.4",
|
|
56
|
+
"@hmharness/web": "0.19.4",
|
|
57
57
|
"qrcode": "^1.5.4"
|
|
58
58
|
}
|
|
59
59
|
}
|