@animastor/installer 0.2.4 → 0.2.9
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/README.md +76 -12
- package/ai/install-manifests/image/qwen-image.json +3 -3
- package/ai/install-manifests/video/ltx-2.3.json +9 -9
- package/package.json +1 -1
- package/src/installer/cli.js +524 -70
- package/src/installer/engine/engine.js +153 -8
- package/src/installer/engine/node-deps.js +330 -44
- package/src/installer/engine/overrides.js +375 -0
- package/src/installer/engine/pydeps.js +204 -0
- package/src/installer/engine/summary.js +17 -1
- package/src/installer/engine/worker.js +359 -7
- package/src/installer/management.js +6 -1
- package/src/installer/verification-report.js +19 -5
|
@@ -39,6 +39,7 @@ const prereq = require('./prereq');
|
|
|
39
39
|
const management = require('../management');
|
|
40
40
|
const comfyOwnerMod = require('./comfy-owner');
|
|
41
41
|
const nodeDeps = require('./node-deps');
|
|
42
|
+
const pydeps = require('./pydeps');
|
|
42
43
|
const { createProgressReporter } = require('./progress');
|
|
43
44
|
const { buildVerificationReport } = require('../verification-report');
|
|
44
45
|
|
|
@@ -401,6 +402,10 @@ async function runInstallation(args) {
|
|
|
401
402
|
// a recorded answer survives every run; an explicit flag replaces it.
|
|
402
403
|
const restartPlatform = options.restartPlatformComfy !== undefined ? options.restartPlatformComfy : saved.restartPlatformComfy;
|
|
403
404
|
if (restartPlatform === true || restartPlatform === false) st.installer_options.restartPlatformComfy = restartPlatform;
|
|
405
|
+
// Node-deps record of the dependency gate (overlay, version
|
|
406
|
+
// replacements, accepted conflicts — installer 0.2.6) is written by
|
|
407
|
+
// the CLI before the engine runs: kept, not dropped.
|
|
408
|
+
if (saved.nodeDeps) st.installer_options.nodeDeps = saved.nodeDeps;
|
|
404
409
|
// Hub version seen by this run (bootstrap env) — `animastor doctor`
|
|
405
410
|
// prints it instead of "hub unknown" on later runs.
|
|
406
411
|
// Who runs the ComfyUI, as seen by THIS run (installer 0.2.3): the
|
|
@@ -416,6 +421,11 @@ async function runInstallation(args) {
|
|
|
416
421
|
if (options.hubVersion) st.hub_version = String(options.hubVersion);
|
|
417
422
|
else if (process.env.ANIMASTOR_HUB_VERSION) st.hub_version = process.env.ANIMASTOR_HUB_VERSION;
|
|
418
423
|
}
|
|
424
|
+
// Installer 0.2.5: what the CLI created before the engine ran (node-deps
|
|
425
|
+
// overlay, prestartup custom node) is owned → removed by `uninstall`.
|
|
426
|
+
for (const e of options.ownedServices || []) {
|
|
427
|
+
if (e && e.path && !dryRun) state.addOwnedComponent(st, 'services', e);
|
|
428
|
+
}
|
|
419
429
|
const save = () => state.saveState(io, statePath, st, io.now);
|
|
420
430
|
if (initialState) {
|
|
421
431
|
for (const line of renderResumeSummary(st)) log.info(line);
|
|
@@ -992,6 +1002,21 @@ async function runInstallation(args) {
|
|
|
992
1002
|
}
|
|
993
1003
|
}
|
|
994
1004
|
|
|
1005
|
+
// 4.6a node-classes.json (installer 0.2.7) — the profile's node
|
|
1006
|
+
// classes for the worker's readiness gate (bundle >= 2.2.2). Written
|
|
1007
|
+
// on every run where a bundle is installed (fresh install, update,
|
|
1008
|
+
// re-run); never fatal.
|
|
1009
|
+
if (workerDir && io.fs.existsSync(path.join(workerDir, 'worker.cjs'))) {
|
|
1010
|
+
const nc = worker.writeNodeClasses(io, { workerDir, manifests, log });
|
|
1011
|
+
result.results.worker.push({ id: 'node-classes', node_classes: nc });
|
|
1012
|
+
if (nc.status === 'written' && st.components.worker) {
|
|
1013
|
+
const owned = new Set(st.components.worker.files_installed || []);
|
|
1014
|
+
owned.add(worker.NODE_CLASSES_FILE);
|
|
1015
|
+
st.components.worker.files_installed = Array.from(owned);
|
|
1016
|
+
save();
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
|
|
995
1020
|
// 4.7 Worker Key + .env configuration ----------------------------------------
|
|
996
1021
|
// Runs on EVERY install where the worker is wanted — even full re-runs
|
|
997
1022
|
// whose plan has no worker-key step (nothing left to ask). configureEnv
|
|
@@ -1139,9 +1164,26 @@ async function runInstallation(args) {
|
|
|
1139
1164
|
let workerStart = null;
|
|
1140
1165
|
if (options.startWorker && workerDir && !runtimeFatal) {
|
|
1141
1166
|
const r = await log.step('start worker', async () => {
|
|
1142
|
-
const bundleChanged = result.results.worker.some((x) => x.bundle && (x.bundle.files_installed || []).length > 0);
|
|
1143
|
-
|
|
1167
|
+
const bundleChanged = !!options.bundleRefreshedEarly || result.results.worker.some((x) => x.bundle && (x.bundle.files_installed || []).length > 0);
|
|
1168
|
+
// Installer 0.2.8: a running worker is restarted only when its
|
|
1169
|
+
// configuration changed, and never in the middle of a task
|
|
1170
|
+
// (worker.ensureWorker: wait up to --wait-job-ms, else deferred).
|
|
1171
|
+
const configChanged = [];
|
|
1172
|
+
if (workerConfigChanged) configChanged.push('.env changed by this run');
|
|
1173
|
+
if (bundleChanged) configChanged.push('worker bundle updated by this run');
|
|
1174
|
+
const res = await worker.ensureWorker(io, {
|
|
1175
|
+
workerDir, nodeBin, graceMs: options.workerGraceMs || 3000,
|
|
1176
|
+
configChanged,
|
|
1177
|
+
force: !!options.forceWorkerRestart,
|
|
1178
|
+
boot: !!options.boot,
|
|
1179
|
+
waitJobMs: options.waitJobMs !== undefined ? options.waitJobMs : worker.DEFAULT_WAIT_JOB_MS,
|
|
1180
|
+
pollMs: options.jobPollMs || 5000,
|
|
1181
|
+
sleep: options.sleep || null,
|
|
1182
|
+
log,
|
|
1183
|
+
tool: options.toolCommand || toolCommandFrom(result.results.management_tools),
|
|
1184
|
+
});
|
|
1144
1185
|
workerStart = res;
|
|
1186
|
+
if (res.deferred) throw new Error(res.reason);
|
|
1145
1187
|
if (!res.started || !res.alive) {
|
|
1146
1188
|
// An immediate exit is usually the fail-closed credential
|
|
1147
1189
|
// gate — say so (the fix is a new key, not a re-run).
|
|
@@ -1154,7 +1196,7 @@ async function runInstallation(args) {
|
|
|
1154
1196
|
}
|
|
1155
1197
|
throw new Error(res.reason || 'worker did not start');
|
|
1156
1198
|
}
|
|
1157
|
-
|
|
1199
|
+
|
|
1158
1200
|
// The 90 s "worker → ComfyUI ready" window opens only once
|
|
1159
1201
|
// ComfyUI itself answers (installer 0.2.3) — a ComfyUI that is
|
|
1160
1202
|
// still loading must not eat the worker's time.
|
|
@@ -1172,7 +1214,13 @@ async function runInstallation(args) {
|
|
|
1172
1214
|
return { ...res, ...ready };
|
|
1173
1215
|
});
|
|
1174
1216
|
const res = r.ok ? r.value : { ...(workerStart || {}), started: !!(workerStart && workerStart.started), alive: false, reason: String(r.error && r.error.message) };
|
|
1175
|
-
result.results.worker.push({
|
|
1217
|
+
result.results.worker.push({
|
|
1218
|
+
id: 'worker-process', pid: res.pid || null, started: !!res.started, comfy_ready: !!(workerReady && workerReady.comfy_ready), reason: r.ok ? null : res.reason, log_file: res.logFile || null,
|
|
1219
|
+
action: workerStart ? workerStart.action || null : null,
|
|
1220
|
+
restart_reasons: workerStart ? workerStart.restart_reasons || [] : [],
|
|
1221
|
+
restart_pending: workerStart && workerStart.restart_pending ? workerStart.restart_pending : null,
|
|
1222
|
+
deferred: !!(workerStart && workerStart.deferred),
|
|
1223
|
+
});
|
|
1176
1224
|
if (r.ok) {
|
|
1177
1225
|
startedWorkerPid = res.pid;
|
|
1178
1226
|
state.setArtifact(st, 'worker-process', 'installed', { pid: res.pid });
|
|
@@ -1193,6 +1241,12 @@ async function runInstallation(args) {
|
|
|
1193
1241
|
}
|
|
1194
1242
|
}
|
|
1195
1243
|
|
|
1244
|
+
// "current job: none|<id>" of the doctor result (installer 0.2.8) —
|
|
1245
|
+
// read at the end of the step, from the running worker's own log.
|
|
1246
|
+
if (workerDir && !dryRun) {
|
|
1247
|
+
try { result.results.current_job = worker.currentJobLabel(io, { workerDir }); } catch (_) { result.results.current_job = 'unknown'; }
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1196
1250
|
// 4.9 Verification --------------------------------------------------------------
|
|
1197
1251
|
// A fatal runtime failure means ComfyUI cannot start — skip the live
|
|
1198
1252
|
// start step entirely (it would only spawn a doomed process).
|
|
@@ -1253,6 +1307,51 @@ async function runInstallation(args) {
|
|
|
1253
1307
|
}
|
|
1254
1308
|
}
|
|
1255
1309
|
|
|
1310
|
+
/**
|
|
1311
|
+
* Installer 0.2.5: bring an INSTALLED worker bundle to the version this
|
|
1312
|
+
* installer ships (its bundled copy, else the hub's published bundle) —
|
|
1313
|
+
* called by the CLI BEFORE any check that can end the run early (live E2E
|
|
1314
|
+
* 02.11: installer 0.2.4 stopped at the node-deps gate and left bundle 2.2.0
|
|
1315
|
+
* behind). A missing installation is left to the regular install step.
|
|
1316
|
+
* @returns {Promise<{ status: 'absent'|'current'|'unknown'|'updated'|'failed', have: string|null, want: string|null, files_installed?: string[], reason?: string }>}
|
|
1317
|
+
*/
|
|
1318
|
+
async function refreshInstalledWorkerBundle(io, { workerDir, manifest, repoRoot = null, hubUrl = null, log = null, nodeBin = null }) {
|
|
1319
|
+
if (!workerDir || !manifest || !io.fs.existsSync(path.join(workerDir, 'worker.cjs'))) return { status: 'absent', have: null, want: null };
|
|
1320
|
+
const srcDir = repoBundleSource.resolveRepoBundleDir(io.fs, repoRoot);
|
|
1321
|
+
const have = worker.readPkgVersion(io, workerDir);
|
|
1322
|
+
let want = srcDir ? worker.readPkgVersion(io, srcDir) : null;
|
|
1323
|
+
if (!want && hubUrl && io.http && io.http.fetchJson) {
|
|
1324
|
+
try {
|
|
1325
|
+
const meta = await io.http.fetchJson(`${hubUrl.replace(/\/$/, '')}/worker-bundle/sha256`);
|
|
1326
|
+
if (meta && meta.status === 200 && meta.json && typeof meta.json.version === 'string') want = meta.json.version;
|
|
1327
|
+
} catch (_) { /* hub unreachable */ }
|
|
1328
|
+
}
|
|
1329
|
+
if (!have || !want) return { status: 'unknown', have, want };
|
|
1330
|
+
if (have === want) return { status: 'current', have, want };
|
|
1331
|
+
const wbFiles = ((manifest.worker_bundle || {}).files) || [];
|
|
1332
|
+
const missingFromRepo = wbFiles.filter((f) => !(srcDir && io.fs.existsSync(path.join(srcDir, f))));
|
|
1333
|
+
let bundleDir = null;
|
|
1334
|
+
let bundleTmp = null;
|
|
1335
|
+
try {
|
|
1336
|
+
if (missingFromRepo.length > 0 && hubUrl) {
|
|
1337
|
+
const fetched = await worker.fetchHubWorkerBundle(io, { hubUrl });
|
|
1338
|
+
if (fetched.bundleDir) { bundleDir = fetched.bundleDir; bundleTmp = fetched.tmpDir; }
|
|
1339
|
+
else return { status: 'failed', have, want, reason: `worker bundle fetch failed: ${fetched.reason}` };
|
|
1340
|
+
}
|
|
1341
|
+
const r = worker.installWorkerBundle(io, { workerDir, manifest, repoRoot, bundleDir, hubUrl, httpFetchText: null, log, update: true, nodeBin });
|
|
1342
|
+
if (r.status !== 'installed') return { status: 'failed', have, want, reason: r.reason || r.status };
|
|
1343
|
+
const now = worker.readPkgVersion(io, workerDir);
|
|
1344
|
+
if (now !== want) return { status: 'failed', have, want, reason: `bundle is ${now} after the update, expected ${want}` };
|
|
1345
|
+
return { status: 'updated', have, want, files_installed: r.files_installed || [] };
|
|
1346
|
+
} catch (err) {
|
|
1347
|
+
return { status: 'failed', have, want, reason: err.message };
|
|
1348
|
+
} finally {
|
|
1349
|
+
if (bundleTmp) {
|
|
1350
|
+
try { io.fs.rmSync(bundleTmp, { recursive: true, force: true }); } catch (_) { /* best effort */ }
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1256
1355
|
function pickUpdateTarget(manifest) {
|
|
1257
1356
|
const spec = (manifest.runtime_requirements || {}).comfyui || {};
|
|
1258
1357
|
if (spec.pin && (spec.pin.commit || spec.pin.tag)) return spec.pin;
|
|
@@ -1342,25 +1441,41 @@ async function endToEndChecks(io, { mode, comfyUrl, comfyPort, hubUrl, workerWan
|
|
|
1342
1441
|
return checks;
|
|
1343
1442
|
}
|
|
1344
1443
|
const newKeyFix = `create a new Worker Key in Animastor → Settings → Workers, then run: ${tool} doctor --new-key`;
|
|
1444
|
+
if (workerStart && workerStart.deferred) {
|
|
1445
|
+
// Installer 0.2.8: the worker keeps running (and serving) on its old
|
|
1446
|
+
// configuration; the needed restart was not done — FAILED, exit ≠ 0.
|
|
1447
|
+
checks.push({
|
|
1448
|
+
id: 'worker', ok: false, label: 'Worker restart',
|
|
1449
|
+
detail: String(workerStart.reason || 'restart deferred').replace(/\s+/g, ' '),
|
|
1450
|
+
fix: workerStart.busy_job
|
|
1451
|
+
? `re-run \`${tool} doctor\` when the task finishes (or \`${tool} doctor --wait-job-ms <ms>\` to wait longer); \`${tool} doctor --force\` restarts now and loses the task's result`
|
|
1452
|
+
: `${tool} doctor --force (restarts the worker even if it is busy)`,
|
|
1453
|
+
});
|
|
1454
|
+
checks.push({ id: 'heartbeat', ok: null, label: 'Hub heartbeat (Online)', detail: `not re-checked — the worker (pid ${workerStart.pid}) keeps running on its previous configuration`, fix: null });
|
|
1455
|
+
return checks;
|
|
1456
|
+
}
|
|
1345
1457
|
const r = workerReady || {};
|
|
1458
|
+
// A running worker left as is (installer 0.2.8) is not restarted by
|
|
1459
|
+
// another doctor run — the fix that restarts it is reboot-worker.
|
|
1460
|
+
const rerun = workerStart && workerStart.action === 'left' ? `${tool} reboot-worker` : `${tool} doctor`;
|
|
1346
1461
|
if (r.comfy_ready) {
|
|
1347
1462
|
checks.push({ id: 'worker', ok: true, label: 'Worker → ComfyUI', detail: '"ComfyUI ready" in the worker log', fix: null });
|
|
1348
1463
|
} else {
|
|
1349
1464
|
const reason = (r.reason || (workerStart && workerStart.reason) || 'worker did not start').replace(/\s+/g, ' ');
|
|
1350
1465
|
checks.push({
|
|
1351
1466
|
id: 'worker', ok: false, label: 'Worker → ComfyUI', detail: reason,
|
|
1352
|
-
fix: r.auth_failed ? newKeyFix :
|
|
1467
|
+
fix: r.auth_failed ? newKeyFix : rerun,
|
|
1353
1468
|
});
|
|
1354
1469
|
}
|
|
1355
1470
|
if (r.heartbeat) {
|
|
1356
1471
|
checks.push({ id: 'heartbeat', ok: true, label: 'Hub heartbeat (Online)', detail: hubUrl || null, fix: null });
|
|
1357
1472
|
} else if (!r.comfy_ready) {
|
|
1358
|
-
checks.push({ id: 'heartbeat', ok: false, label: 'Hub heartbeat (Online)', detail: 'not reached — the worker sends heartbeats only after it reached ComfyUI', fix: r.auth_failed ? newKeyFix :
|
|
1473
|
+
checks.push({ id: 'heartbeat', ok: false, label: 'Hub heartbeat (Online)', detail: 'not reached — the worker sends heartbeats only after it reached ComfyUI', fix: r.auth_failed ? newKeyFix : rerun });
|
|
1359
1474
|
} else {
|
|
1360
1475
|
checks.push({
|
|
1361
1476
|
id: 'heartbeat', ok: false, label: 'Hub heartbeat (Online)',
|
|
1362
1477
|
detail: (r.reason || 'no heartbeat confirmed').replace(/\s+/g, ' '),
|
|
1363
|
-
fix: r.auth_failed ? newKeyFix : `check that this machine reaches ${hubUrl} (curl -fsS ${hubUrl}/health), then run: ${
|
|
1478
|
+
fix: r.auth_failed ? newKeyFix : `check that this machine reaches ${hubUrl} (curl -fsS ${hubUrl}/health), then run: ${rerun}`,
|
|
1364
1479
|
});
|
|
1365
1480
|
}
|
|
1366
1481
|
return checks;
|
|
@@ -1426,7 +1541,35 @@ async function runVerification({ io, manifests, roots, options, log, crypto, tok
|
|
|
1426
1541
|
}
|
|
1427
1542
|
if (missingClasses.length === 0) log.info('node classes registered');
|
|
1428
1543
|
}
|
|
1429
|
-
if (missingClasses.length > 0)
|
|
1544
|
+
if (missingClasses.length > 0) {
|
|
1545
|
+
live.comfyui.missing_node_classes = missingClasses;
|
|
1546
|
+
// Installer 0.2.5: say WHY (missing packages / IMPORT FAILED /
|
|
1547
|
+
// restart needed) — "run doctor" alone looped on the live node.
|
|
1548
|
+
try {
|
|
1549
|
+
const ownerInfo = options.comfyOwner || null;
|
|
1550
|
+
const pid = ownerInfo && ownerInfo.pid ? ownerInfo.pid : null;
|
|
1551
|
+
const py = pid ? nodeDeps.pythonOfProcess(io, pid).python : null;
|
|
1552
|
+
let extraPaths = [];
|
|
1553
|
+
if (py && workerDir && ownerInfo && ownerInfo.owner === 'foreign') {
|
|
1554
|
+
const plan = pydeps.planPersistence(io, { python: py, root: comfyuiRoot, base: pydeps.overlayBase(workerDir), create: false });
|
|
1555
|
+
if (plan.kind === 'overlay' && plan.sitePackages && io.fs.existsSync(plan.sitePackages)) extraPaths = [plan.sitePackages];
|
|
1556
|
+
}
|
|
1557
|
+
const logFiles = [
|
|
1558
|
+
workerDir ? path.join(path.dirname(path.resolve(workerDir)), 'logs', 'comfyui-restart.log') : null,
|
|
1559
|
+
comfyuiRoot ? path.join(comfyuiRoot, 'comfyui-installer.log') : null,
|
|
1560
|
+
].filter(Boolean);
|
|
1561
|
+
const diag = await nodeDeps.diagnoseMissingClasses(io, {
|
|
1562
|
+
missingClasses, manifests, root: comfyuiRoot, url: baseUrl, pid, python: py, extraPaths, logFiles,
|
|
1563
|
+
});
|
|
1564
|
+
live.comfyui.missing_node_classes_cause = {
|
|
1565
|
+
kind: diag.kind, detail: diag.detail, log_source: diag.log_source,
|
|
1566
|
+
owner: ownerInfo && ownerInfo.owner === 'foreign' ? 'foreign' : 'managed',
|
|
1567
|
+
};
|
|
1568
|
+
log.info(`node classes missing — cause: ${diag.kind}: ${diag.detail}`);
|
|
1569
|
+
} catch (err) {
|
|
1570
|
+
log.warn(`node classes missing — cause not determined: ${err.message}`);
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1430
1573
|
}
|
|
1431
1574
|
// workflow static validation (no generation) — only meaningful when
|
|
1432
1575
|
// at least one OPTIONAL profile workflow copy is actually installed;
|
|
@@ -1568,6 +1711,8 @@ module.exports = {
|
|
|
1568
1711
|
comfyPortState,
|
|
1569
1712
|
autoPickComfyPort,
|
|
1570
1713
|
platformComfyMissingChecks,
|
|
1714
|
+
refreshInstalledWorkerBundle,
|
|
1715
|
+
writeNodeClasses: worker.writeNodeClasses,
|
|
1571
1716
|
desiredEnvWiring,
|
|
1572
1717
|
endToEndChecks,
|
|
1573
1718
|
CPU_MODE_WARNING,
|