@hmharness/cli 0.16.5 → 0.18.0
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/evolution-daemon.d.ts +7 -0
- package/dist/evolution-daemon.js +59 -43
- package/dist/main.js +156 -20
- package/package.json +5 -5
|
@@ -3,6 +3,12 @@ export interface EvolDaemonStatus {
|
|
|
3
3
|
pid?: number;
|
|
4
4
|
started: boolean;
|
|
5
5
|
}
|
|
6
|
+
/** Build the runner source. Plain CJS - verified with node --check in the
|
|
7
|
+
* daemon tests (the 0.14.25 version was silently broken ESM-in-CJS).
|
|
8
|
+
* entryAbs: absolute path of the CLI's dist/main.js - the runner lives in
|
|
9
|
+
* HMH_HOME, so relative resolution never finds the installed CLI (second
|
|
10
|
+
* latent bug in the old runner). */
|
|
11
|
+
export declare function daemonRunnerSource(pidFile: string, entryAbs: string): string;
|
|
6
12
|
/**
|
|
7
13
|
* Idempotent: if the daemon is already alive, return its pid. Otherwise
|
|
8
14
|
* spawn a detached node process that runs evolution cycles on a schedule.
|
|
@@ -10,3 +16,4 @@ export interface EvolDaemonStatus {
|
|
|
10
16
|
*/
|
|
11
17
|
export declare function ensureEvolutionDaemon(): EvolDaemonStatus;
|
|
12
18
|
export declare function stopEvolutionDaemon(): boolean;
|
|
19
|
+
export declare function daemonPidFileAlive(home: string): boolean;
|
package/dist/evolution-daemon.js
CHANGED
|
@@ -6,13 +6,18 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Lifecycle: starts automatically on `hmh tui` / `hmh web` / any command that
|
|
8
8
|
* calls ensureEvolutionDaemon(). Runs one evolution cycle every
|
|
9
|
-
* `evolution.autoEveryHours` hours (default 6h), then sleeps.
|
|
9
|
+
* `evolution.autoEveryHours` hours (default 6h), then sleeps. After each
|
|
10
|
+
* evolve cycle it also runs the auto-finetune gate (2026-09-25: labels past
|
|
11
|
+
* threshold -> pairs exported -> uploaded -> cloud training submitted, all
|
|
12
|
+
* unattended; `hmh auto-finetune` itself decides whether anything is due).
|
|
10
13
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
14
|
+
* 2026-09-25 bugfix: the runner used to be a .cjs file with top-level await
|
|
15
|
+
* + ESM import statements - a SyntaxError at module load, so the daemon died
|
|
16
|
+
* instantly on every start since 0.14.25 and the PID file was never written.
|
|
17
|
+
* The runner is now plain CJS (require only) and verified with node --check.
|
|
13
18
|
*/
|
|
14
19
|
import { spawn } from 'node:child_process';
|
|
15
|
-
import { readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
20
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync, openSync } from 'node:fs';
|
|
16
21
|
import { join } from 'node:path';
|
|
17
22
|
import { homeDir } from '@hmharness/kernel';
|
|
18
23
|
const EVOL_DAEMON_PID = 'evolution-daemon.pid';
|
|
@@ -36,6 +41,50 @@ function daemonPid(home) {
|
|
|
36
41
|
return null;
|
|
37
42
|
}
|
|
38
43
|
}
|
|
44
|
+
/** Build the runner source. Plain CJS - verified with node --check in the
|
|
45
|
+
* daemon tests (the 0.14.25 version was silently broken ESM-in-CJS).
|
|
46
|
+
* entryAbs: absolute path of the CLI's dist/main.js - the runner lives in
|
|
47
|
+
* HMH_HOME, so relative resolution never finds the installed CLI (second
|
|
48
|
+
* latent bug in the old runner). */
|
|
49
|
+
export function daemonRunnerSource(pidFile, entryAbs) {
|
|
50
|
+
const entryJson = JSON.stringify(entryAbs);
|
|
51
|
+
return `
|
|
52
|
+
const { execFile } = require('node:child_process');
|
|
53
|
+
const { writeFileSync, unlinkSync } = require('node:fs');
|
|
54
|
+
const { join } = require('node:path');
|
|
55
|
+
const home = process.env.HMH_HOME || join(require('node:os').homedir(), '.hmharness');
|
|
56
|
+
const hmhBin = process.execPath;
|
|
57
|
+
const hmhEntry = ${entryJson};
|
|
58
|
+
const HOURS = Number(process.env.HMH_EVOLVE_EVERY_HOURS || 6);
|
|
59
|
+
function stamp() { return new Date().toISOString(); }
|
|
60
|
+
function runHmh(args, timeoutMs) {
|
|
61
|
+
return new Promise((resolve) => {
|
|
62
|
+
execFile(hmhBin, [hmhEntry, ...args], { timeout: timeoutMs, windowsHide: true }, (err, stdout, stderr) => {
|
|
63
|
+
resolve({ err, out: String(stdout || '') + String(stderr || '') });
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
async function cycle() {
|
|
68
|
+
try {
|
|
69
|
+
const evo = await runHmh(['evolve'], 600000);
|
|
70
|
+
console.log(stamp(), 'evolve cycle done', evo.err ? ('err ' + String(evo.err).slice(0, 120)) : '');
|
|
71
|
+
} catch (e) { console.error(stamp(), 'evolve error:', String(e).slice(0, 200)); }
|
|
72
|
+
// finetune gate after every evolve cycle - the command itself decides
|
|
73
|
+
// (labels threshold, no running job, cooldown, kill-switch) so an
|
|
74
|
+
// unattended run is always safe and cheap when nothing is due
|
|
75
|
+
try {
|
|
76
|
+
const ft = await runHmh(['auto-finetune', '--submit'], 900000);
|
|
77
|
+
const interesting = ft.out.split('\\n').filter((l) => l.includes('\\u2713') || l.includes('\\u5fae\\u8c03') || l.includes('ERR')).slice(0, 3);
|
|
78
|
+
console.log(stamp(), 'finetune gate:', interesting.join(' | ') || 'not due');
|
|
79
|
+
} catch (e) { console.error(stamp(), 'finetune error:', String(e).slice(0, 200)); }
|
|
80
|
+
}
|
|
81
|
+
writeFileSync(join(home, '${pidFile}'), String(process.pid));
|
|
82
|
+
setTimeout(cycle, 30000);
|
|
83
|
+
setInterval(cycle, HOURS * 3600000);
|
|
84
|
+
process.on('SIGTERM', () => { try { unlinkSync(join(home, '${pidFile}')); } catch {} process.exit(0); });
|
|
85
|
+
process.on('SIGINT', () => { try { unlinkSync(join(home, '${pidFile}')); } catch {} process.exit(0); });
|
|
86
|
+
`;
|
|
87
|
+
}
|
|
39
88
|
/**
|
|
40
89
|
* Idempotent: if the daemon is already alive, return its pid. Otherwise
|
|
41
90
|
* spawn a detached node process that runs evolution cycles on a schedule.
|
|
@@ -47,46 +96,10 @@ export function ensureEvolutionDaemon() {
|
|
|
47
96
|
const existing = daemonPid(home);
|
|
48
97
|
if (existing)
|
|
49
98
|
return { running: true, pid: existing, started: false };
|
|
50
|
-
const entry = join(import.meta.dirname ?? '.', 'evolution-daemon-runner.mjs');
|
|
51
|
-
// inline runner: import the CLI main and call runEvolution on a timer
|
|
52
|
-
const runnerCode = `
|
|
53
|
-
const { runEvolution } = await import('./dist/evolution-evolve.js').catch(() => ({}));
|
|
54
|
-
// fallback: use the CLI's evolve path
|
|
55
|
-
import { execFile } from 'node:child_process';
|
|
56
|
-
import { join } from 'node:path';
|
|
57
|
-
const home = process.env.HMH_HOME || join(require('node:os').homedir(), '.hmharness');
|
|
58
|
-
const hmhBin = process.execPath;
|
|
59
|
-
const hmhEntry = join(import.meta.dirname, 'dist', 'main.js');
|
|
60
|
-
const HOURS = Number(process.env.HMH_EVOLVE_EVERY_HOURS || 6);
|
|
61
|
-
async function cycle() {
|
|
62
|
-
try {
|
|
63
|
-
const { execFile: ef } = await import('node:child_process');
|
|
64
|
-
const { promisify } = await import('node:util');
|
|
65
|
-
const run = promisify(ef);
|
|
66
|
-
const r = await run(hmhBin, [hmhEntry, 'evolve'], { timeout: 600000, cwd: home }).catch(e => ({ stdout: String(e.stdout || ''), stderr: String(e.stderr || '') }));
|
|
67
|
-
console.log(new Date().toISOString(), 'evolve cycle done');
|
|
68
|
-
} catch (e) { console.error(new Date().toISOString(), 'evolve error:', String(e).slice(0, 200)); }
|
|
69
|
-
}
|
|
70
|
-
// write pid immediately
|
|
71
|
-
require('node:fs').writeFileSync(join(home, '${EVOL_DAEMON_PID}'), String(process.pid));
|
|
72
|
-
// run first cycle after 30s (let the caller finish startup), then every N hours
|
|
73
|
-
setTimeout(cycle, 30000);
|
|
74
|
-
setInterval(cycle, HOURS * 3600000);
|
|
75
|
-
// cleanup on exit
|
|
76
|
-
process.on('SIGTERM', () => { require('node:fs').unlinkSync(join(home, '${EVOL_DAEMON_PID}')); process.exit(0); });
|
|
77
|
-
process.on('SIGINT', () => { try { require('node:fs').unlinkSync(join(home, '${EVOL_DAEMON_PID}')); } catch {} process.exit(0); });
|
|
78
|
-
`;
|
|
79
|
-
// write the runner to a temp file in HMH_HOME
|
|
80
99
|
const runnerPath = join(home, 'evolution-daemon-runner.cjs');
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return require('node:fs').openSync(join(home, EVOL_DAEMON_LOG), 'a');
|
|
85
|
-
}
|
|
86
|
-
catch {
|
|
87
|
-
return 0;
|
|
88
|
-
}
|
|
89
|
-
})();
|
|
100
|
+
const entryAbs = join(import.meta.dirname ?? '.', 'main.js');
|
|
101
|
+
writeFileSync(runnerPath, daemonRunnerSource(EVOL_DAEMON_PID, entryAbs), 'utf8');
|
|
102
|
+
const log = openSync(join(home, EVOL_DAEMON_LOG), 'a');
|
|
90
103
|
const child = spawn(process.execPath, [runnerPath], {
|
|
91
104
|
detached: true,
|
|
92
105
|
stdio: ['ignore', log, log],
|
|
@@ -111,3 +124,6 @@ export function stopEvolutionDaemon() {
|
|
|
111
124
|
catch { }
|
|
112
125
|
return true;
|
|
113
126
|
}
|
|
127
|
+
export function daemonPidFileAlive(home) {
|
|
128
|
+
return existsSync(join(home, EVOL_DAEMON_PID)) && daemonPid(home) !== null;
|
|
129
|
+
}
|
package/dist/main.js
CHANGED
|
@@ -36,6 +36,16 @@ const CYAN = (s) => `\x1b[36m${s}\x1b[0m`;
|
|
|
36
36
|
const YELLOW = (s) => `\x1b[33m${s}\x1b[0m`;
|
|
37
37
|
const GREEN = (s) => `\x1b[32m${s}\x1b[0m`;
|
|
38
38
|
const RED = (s) => `\x1b[31m${s}\x1b[0m`;
|
|
39
|
+
/** The fine-tune API lives on bigmodel.cn - find the user's ONE Zhipu
|
|
40
|
+
* provider entry (glm) so auto-finetune needs no new configuration.
|
|
41
|
+
* Returns its model too: the main model is the FIRST fine-tune candidate. */
|
|
42
|
+
function zhipuProviderOf(cfg) {
|
|
43
|
+
for (const p of Object.values(cfg.providers ?? {})) {
|
|
44
|
+
if (p.baseUrl?.includes('bigmodel.cn') && p.apiKey)
|
|
45
|
+
return { apiKey: p.apiKey, baseUrl: p.baseUrl, model: p.model };
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
39
49
|
async function uiStrings() {
|
|
40
50
|
const cfg = await loadConfig();
|
|
41
51
|
return strings((cfg.locale ?? 'zh'));
|
|
@@ -1015,34 +1025,160 @@ flags:
|
|
|
1015
1025
|
return;
|
|
1016
1026
|
}
|
|
1017
1027
|
if (cmd === 'auto-finetune') {
|
|
1018
|
-
// 2026-09-
|
|
1019
|
-
//
|
|
1020
|
-
//
|
|
1021
|
-
//
|
|
1028
|
+
// 2026-09-25: the cloud fine-tuning loop is CLOSED. Default run exports
|
|
1029
|
+
// the accumulated DPO pairs, converts them to the provider DPO row
|
|
1030
|
+
// format and uploads train/validation files (free) - everything is then
|
|
1031
|
+
// staged for one-command submission. Job creation is PAID, so it needs
|
|
1032
|
+
// --submit. The user never touches a local GPU or Python again.
|
|
1022
1033
|
await initHome();
|
|
1023
1034
|
const home = homeDir();
|
|
1035
|
+
const CF = await import('@hmharness/evolution');
|
|
1036
|
+
const flag = (name) => (rest.find((a) => a.startsWith(`--${name}=`)) ?? '').split('=').slice(1).join('=');
|
|
1037
|
+
if (rest.includes('--status')) {
|
|
1038
|
+
const cfgS = await loadConfig();
|
|
1039
|
+
const zp = zhipuProviderOf(cfgS);
|
|
1040
|
+
if (!zp) {
|
|
1041
|
+
stdout.write(RED('未找到智谱 provider(config.json providers 中需有 baseUrl 含 bigmodel.cn 的条目,如 glm)\n'));
|
|
1042
|
+
return;
|
|
1043
|
+
}
|
|
1044
|
+
const jobs = await CF.listFineTuneJobs({ apiKey: zp.apiKey, baseUrl: zp.baseUrl, limit: 10 });
|
|
1045
|
+
const local = await CF.readLocalFineTuneJobs(home);
|
|
1046
|
+
stdout.write('云端微调任务(最近 ' + jobs.length + ' 条):\n');
|
|
1047
|
+
for (const j of jobs)
|
|
1048
|
+
stdout.write(' ' + (j.id ?? '?').padEnd(38) + ' ' + String(j.status ?? '?').padEnd(12) + ' ' + String(j.model ?? '') + (j.fine_tuned_model ? ' → ' + j.fine_tuned_model : '') + '\n');
|
|
1049
|
+
if (local.length) {
|
|
1050
|
+
stdout.write('本机提交记录:\n');
|
|
1051
|
+
for (const l of local)
|
|
1052
|
+
stdout.write(' ' + l.time + ' ' + (l.id ?? '?') + ' ' + String(l.status ?? '') + '\n');
|
|
1053
|
+
}
|
|
1054
|
+
if (!jobs.length && !local.length)
|
|
1055
|
+
stdout.write('(还没有任何微调任务)\n');
|
|
1056
|
+
return;
|
|
1057
|
+
}
|
|
1058
|
+
// provider: the user's ONE Zhipu key already in config (zero new setup)
|
|
1024
1059
|
const cfgFT = await loadConfig();
|
|
1025
|
-
const
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1060
|
+
const zp = zhipuProviderOf(cfgFT);
|
|
1061
|
+
if (!zp) {
|
|
1062
|
+
stdout.write(RED('未找到智谱 provider:请在 config.json 的 providers 里配置 glm(baseUrl 含 bigmodel.cn)。只需这一个密钥。\n'));
|
|
1063
|
+
return;
|
|
1064
|
+
}
|
|
1065
|
+
// unattended safety rails (2026-09-25 "configure one key, forget it"):
|
|
1066
|
+
// kill-switch finetune.auto=false, at most one active cloud job, and a
|
|
1067
|
+
// cooldown between submissions - the daemon calls this same command, so
|
|
1068
|
+
// a run that is "not due" exits here without any API cost.
|
|
1069
|
+
const ftCfg = cfgFT.finetune ?? {};
|
|
1070
|
+
const submit = rest.includes('--submit');
|
|
1071
|
+
const cooldownDays = ftCfg.cooldownDays ?? 7;
|
|
1072
|
+
const maxPairs = Math.min(ftCfg.maxPairs ?? 4000, 20000);
|
|
1073
|
+
if (submit && ftCfg.auto === false) {
|
|
1074
|
+
stdout.write('自动微调已关闭(config finetune.auto=false)——本次跳过\n');
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1077
|
+
if (submit) {
|
|
1078
|
+
const localJobs = await CF.readLocalFineTuneJobs(home);
|
|
1079
|
+
const lastAt = localJobs.length ? new Date(localJobs[localJobs.length - 1].time).getTime() : 0;
|
|
1080
|
+
const dueMs = cooldownDays * 86400000;
|
|
1081
|
+
if (Date.now() - lastAt < dueMs) {
|
|
1082
|
+
stdout.write(DIM(`冷却中(上次提交 ${cooldownDays} 天内)——本次跳过\n`));
|
|
1083
|
+
return;
|
|
1084
|
+
}
|
|
1085
|
+
try {
|
|
1086
|
+
const running = (await CF.listFineTuneJobs({ apiKey: zp.apiKey, baseUrl: zp.baseUrl, limit: 20 }))
|
|
1087
|
+
.some((j) => ['queued', 'running', 'pending', 'training'].includes(String(j.status ?? '').toLowerCase()));
|
|
1088
|
+
if (running) {
|
|
1089
|
+
stdout.write(DIM('云端已有进行中的微调任务——本次跳过\n'));
|
|
1090
|
+
return;
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
catch { /* status check failed - fail open to the gates below */ }
|
|
1094
|
+
}
|
|
1095
|
+
// 2026-09-25 user call: novices never pick a fine-tune base. Try the
|
|
1096
|
+
// user's MAIN model first (glm-5.3 today answers 微调功能未开放), then
|
|
1097
|
+
// silently fall down the documented ladder. --model= stays as override.
|
|
1098
|
+
const forced = flag('model');
|
|
1099
|
+
let model;
|
|
1100
|
+
if (forced) {
|
|
1101
|
+
model = forced;
|
|
1102
|
+
stdout.write('云端微调模型(手动指定):' + model + '\n');
|
|
1103
|
+
}
|
|
1104
|
+
else {
|
|
1105
|
+
model = await CF.pickFineTuneModel({
|
|
1106
|
+
apiKey: zp.apiKey, baseUrl: zp.baseUrl, mainModel: zp.model,
|
|
1107
|
+
log: (l) => stdout.write(DIM(l + '\n')),
|
|
1108
|
+
});
|
|
1109
|
+
stdout.write('云端微调模型:' + model + (model !== zp.model ? DIM('(主模型 ' + zp.model + ' 暂不可微调,已自动改用)') : '') + '\n');
|
|
1110
|
+
}
|
|
1111
|
+
// labels gate (same as before)
|
|
1112
|
+
const judgeLabels = await CF.readJudgeLabels(home);
|
|
1030
1113
|
const { readLabels } = await import('@hmharness/evolution');
|
|
1031
1114
|
const humanLabels = await readLabels(home);
|
|
1032
|
-
stdout.write('
|
|
1115
|
+
stdout.write('评审标签:' + judgeLabels.length + ' 条评审 + ' + humanLabels.length + ' 条历史人标\n');
|
|
1033
1116
|
if (judgeLabels.length + humanLabels.length < 50) {
|
|
1034
|
-
stdout.write('
|
|
1117
|
+
stdout.write('标签还不够(需 ≥50,当前 ' + (judgeLabels.length + humanLabels.length) + ')——继续正常使用,评审智能体会自动积累\n');
|
|
1035
1118
|
return;
|
|
1036
1119
|
}
|
|
1037
|
-
//
|
|
1038
|
-
const
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1120
|
+
// pairs: reuse dpo-pairs.jsonl, exporting it fresh if absent (zero-config)
|
|
1121
|
+
const pairsFile = join(home, 'evolution', 'dpo-pairs.jsonl');
|
|
1122
|
+
try {
|
|
1123
|
+
await readFile(pairsFile, 'utf8');
|
|
1124
|
+
}
|
|
1125
|
+
catch {
|
|
1126
|
+
const { execFile: efFT } = await import('node:child_process');
|
|
1127
|
+
stdout.write(DIM('正在导出偏好对(hmh reward export-dpo)…\n'));
|
|
1128
|
+
await new Promise(r => efFT(process.execPath, [import.meta.filename ?? '', 'reward', 'export-dpo'], { timeout: 300000 }, () => r()));
|
|
1129
|
+
}
|
|
1130
|
+
let rows = [];
|
|
1131
|
+
try {
|
|
1132
|
+
rows = (await readFile(pairsFile, 'utf8')).trim().split('\n').filter(Boolean).map((l) => JSON.parse(l));
|
|
1133
|
+
}
|
|
1134
|
+
catch { /* re-export failed */ }
|
|
1135
|
+
if (!rows.length) {
|
|
1136
|
+
stdout.write(RED('偏好对导出为空——先运行 hmh judge 积累评审标签\n'));
|
|
1137
|
+
return;
|
|
1138
|
+
}
|
|
1139
|
+
const trainRows = rows.filter((r) => r.split !== 'eval').slice(0, maxPairs);
|
|
1140
|
+
const evalRows = rows.filter((r) => r.split === 'eval');
|
|
1141
|
+
stdout.write('偏好对:' + rows.length + (trainRows.length < rows.filter((r) => r.split !== 'eval').length ? DIM('(本次训练用前 ' + maxPairs + ' 条控制成本)') : '') + '(train ' + trainRows.length + ' / eval ' + evalRows.length + ')\n');
|
|
1142
|
+
const trainJsonl = CF.toDpoJsonl(trainRows);
|
|
1143
|
+
const evalJsonl = CF.toDpoJsonl(evalRows);
|
|
1144
|
+
stdout.write('本地预估 token:train ~' + CF.estimateTokens(trainJsonl).toLocaleString() + ' / eval ~' + CF.estimateTokens(evalJsonl).toLocaleString() + DIM('(上传后以官方分词统计为准)') + '\n');
|
|
1145
|
+
// upload (free) - provider token stats come back exact
|
|
1146
|
+
const stamp = new Date().toISOString().slice(0, 10).replaceAll('-', '');
|
|
1147
|
+
let upTrain;
|
|
1148
|
+
let upEval = null;
|
|
1149
|
+
try {
|
|
1150
|
+
upTrain = await CF.uploadFineTuneFile({ apiKey: zp.apiKey, baseUrl: zp.baseUrl, filename: `hmh-dpo-train-${stamp}.jsonl`, jsonl: trainJsonl });
|
|
1151
|
+
stdout.write(GREEN('✓') + ' 训练文件已上传:' + upTrain.id + '(' + upTrain.samples + ' 样本,官方统计 ' + upTrain.tokens.toLocaleString() + ' tokens)\n');
|
|
1152
|
+
if (evalRows.length) {
|
|
1153
|
+
upEval = await CF.uploadFineTuneFile({ apiKey: zp.apiKey, baseUrl: zp.baseUrl, filename: `hmh-dpo-eval-${stamp}.jsonl`, jsonl: evalJsonl });
|
|
1154
|
+
stdout.write(GREEN('✓') + ' 验证文件已上传:' + upEval.id + '(' + upEval.samples + ' 样本)\n');
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
catch (err) {
|
|
1158
|
+
stdout.write(RED('上传失败:' + String(err) + '\n'));
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
if (!rest.includes('--submit')) {
|
|
1162
|
+
// files staged; the daemon submits automatically on its next cycle,
|
|
1163
|
+
// or the user can fire it now
|
|
1164
|
+
stdout.write('\n已就绪。后台会自动提交训练(每 ' + cooldownDays + ' 天最多一次,单任务上限 ' + maxPairs + ' 对,config finetune.auto=false 可关闭自动);\n');
|
|
1165
|
+
stdout.write(DIM('也可以现在手动提交:hmh auto-finetune --submit · 查看进度:hmh auto-finetune --status\n'));
|
|
1166
|
+
return;
|
|
1167
|
+
}
|
|
1168
|
+
// PAID step - explicit --submit only
|
|
1169
|
+
try {
|
|
1170
|
+
const job = await CF.createFineTuneJob({
|
|
1171
|
+
apiKey: zp.apiKey, baseUrl: zp.baseUrl, model,
|
|
1172
|
+
trainingFile: upTrain.id, validationFile: upEval?.id, suffix: 'hmh',
|
|
1173
|
+
});
|
|
1174
|
+
await CF.recordFineTuneJob(home, job, { model, trainFile: upTrain.id, evalFile: upEval?.id, pairs: rows.length });
|
|
1175
|
+
stdout.write(GREEN('✓ 微调任务已创建:' + (job.id ?? '?') + '(状态 ' + String(job.status ?? '?') + ')\n'));
|
|
1176
|
+
stdout.write('训练完成后,用返回的模型编码(fine_tuned_model)即可直接调用。\n');
|
|
1177
|
+
stdout.write(DIM('查看进度:hmh auto-finetune --status\n'));
|
|
1178
|
+
}
|
|
1179
|
+
catch (err) {
|
|
1180
|
+
stdout.write(RED('任务创建失败(上传的文件仍保留在云端可复用):' + String(err) + '\n'));
|
|
1181
|
+
}
|
|
1046
1182
|
return;
|
|
1047
1183
|
}
|
|
1048
1184
|
if (cmd === 'evolve-auto') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hmharness/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
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",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@hmharness/kernel": "0.9.6",
|
|
47
47
|
"@hmharness/observability": "0.7.4",
|
|
48
|
-
"@hmharness/evolution": "0.14.
|
|
48
|
+
"@hmharness/evolution": "0.14.23",
|
|
49
49
|
"@hmharness/domain-harmony": "0.13.8",
|
|
50
50
|
"@hmharness/domain-ops": "0.8.3",
|
|
51
|
-
"@hmharness/agent": "0.14.
|
|
52
|
-
"@hmharness/evaluation": "0.8.
|
|
51
|
+
"@hmharness/agent": "0.14.18",
|
|
52
|
+
"@hmharness/evaluation": "0.8.6",
|
|
53
53
|
"@hmharness/web": "0.9.4",
|
|
54
|
-
"@hmharness/sandbox": "0.8.
|
|
54
|
+
"@hmharness/sandbox": "0.8.5"
|
|
55
55
|
}
|
|
56
56
|
}
|