@animastor/installer 0.1.0 → 0.2.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/README.md +89 -1
- package/ai/install-manifests/audio/qwen-tts.json +6 -7
- package/package.json +4 -4
- package/src/installer/cli.js +1036 -211
- package/src/installer/compatibility-resolver.js +58 -11
- package/src/installer/engine/comfy-owner.js +385 -0
- package/src/installer/engine/downloader.js +26 -0
- package/src/installer/engine/engine.js +455 -61
- package/src/installer/engine/fixes.js +96 -0
- package/src/installer/engine/io.js +33 -2
- package/src/installer/engine/node-deps.js +274 -0
- package/src/installer/engine/prereq.js +176 -0
- package/src/installer/engine/probe.js +265 -8
- package/src/installer/engine/summary.js +108 -0
- package/src/installer/engine/tty.js +214 -0
- package/src/installer/engine/worker.js +379 -47
- package/src/installer/install-plan.js +99 -15
- package/src/installer/management.js +336 -12
- package/src/installer/platform/linux.js +17 -0
- package/src/installer/setup-contract.js +35 -23
- package/src/installer/verification-report.js +3 -1
package/src/installer/cli.js
CHANGED
|
@@ -13,13 +13,17 @@
|
|
|
13
13
|
* animastor-installer verify [--profile P[,P2]] [--root PATH] [--worker-dir PATH] [--hub-url URL]
|
|
14
14
|
* animastor-installer resume
|
|
15
15
|
* animastor-installer uninstall [--all] [--yes] [--dry-run] [--state PATH] [--home PATH]
|
|
16
|
+
* animastor-installer start | stop | status | logs [-f] [--lines N] | doctor [--new-key]
|
|
17
|
+
* animastor-installer boot (node startup script: detaches `doctor --yes`, exits 0 at once)
|
|
18
|
+
* (what the `animastor` command in PATH runs)
|
|
16
19
|
*
|
|
17
20
|
* Flags:
|
|
18
21
|
* --profile P Generation profile id (repeatable or comma-separated)
|
|
19
|
-
* --mode MODE managed | existing | shared (default:
|
|
22
|
+
* --mode MODE managed | existing | shared (default: existing when a ComfyUI
|
|
23
|
+
* is found — in ~/ComfyUI or as a running process — else managed)
|
|
20
24
|
* --root PATH ComfyUI root directory (default: ~/ComfyUI)
|
|
21
25
|
* --worker-dir PATH Worker bundle directory (default: ~/animastor/worker)
|
|
22
|
-
* --hub-url URL GPU Hub base URL (default: https://animastor.
|
|
26
|
+
* --hub-url URL GPU Hub base URL (default: https://animastor.org/gpu)
|
|
23
27
|
* --repo-root PATH Animastor repo root (default: derived from cli.js location)
|
|
24
28
|
* --state PATH Install state file path
|
|
25
29
|
* --yes Auto-confirm all prompts
|
|
@@ -29,21 +33,31 @@
|
|
|
29
33
|
|
|
30
34
|
const fs = require('fs');
|
|
31
35
|
const path = require('path');
|
|
32
|
-
const readline = require('readline');
|
|
33
36
|
|
|
34
37
|
const { createRealIo, createDryRunIo } = require('./engine/io');
|
|
35
38
|
const { createLogger } = require('./engine/logger');
|
|
36
39
|
const { createTermRenderer } = require('./engine/term');
|
|
37
40
|
const platforms = require('./platform');
|
|
38
|
-
const
|
|
41
|
+
const probeMod = require('./engine/probe');
|
|
42
|
+
const { probeEnvironment, renderDetection } = probeMod;
|
|
39
43
|
const { runInstallation, loadResumableState, renderResumeSummary } = require('./engine/engine');
|
|
40
44
|
const prereq = require('./engine/prereq');
|
|
41
45
|
const stateStore = require('./engine/state');
|
|
42
46
|
const management = require('./management');
|
|
43
47
|
const resolver = require('./compatibility-resolver');
|
|
44
|
-
const { buildInstallPlan, renderPlanText } = require('./install-plan');
|
|
48
|
+
const { buildInstallPlan, renderPlanText, planNeedsPythonRuntime } = require('./install-plan');
|
|
45
49
|
const manifest = require('./install-manifest');
|
|
46
50
|
const uninstaller = require('./uninstaller');
|
|
51
|
+
const { createPrompt, NoTerminalError } = require('./engine/tty');
|
|
52
|
+
const { renderBanner, renderFinalSummary } = require('./engine/summary');
|
|
53
|
+
const fixes = require('./engine/fixes');
|
|
54
|
+
const workerMod = require('./engine/worker');
|
|
55
|
+
const comfyuiMod = require('./engine/comfyui');
|
|
56
|
+
const comfyOwner = require('./engine/comfy-owner');
|
|
57
|
+
const nodeDeps = require('./engine/node-deps');
|
|
58
|
+
const downloader = require('./engine/downloader');
|
|
59
|
+
const { resolveRepoBundleDir } = require('./worker-bundle-source');
|
|
60
|
+
const engineMod = require('./engine/engine');
|
|
47
61
|
|
|
48
62
|
// ---------------------------------------------------------------------------
|
|
49
63
|
// Paths (platform-specific defaults; the platform adapter owns them)
|
|
@@ -86,12 +100,14 @@ function homeDir() {
|
|
|
86
100
|
|
|
87
101
|
const DEFAULT_ROOT = PLATFORM_ADAPTER.defaultRoot(homeDir());
|
|
88
102
|
const DEFAULT_WORKER_DIR = PLATFORM_ADAPTER.defaultWorkerDir(homeDir());
|
|
89
|
-
const DEFAULT_HUB_URL = 'https://animastor.
|
|
103
|
+
const DEFAULT_HUB_URL = 'https://animastor.org/gpu';
|
|
90
104
|
|
|
91
105
|
// ---------------------------------------------------------------------------
|
|
92
106
|
// Argument parsing
|
|
93
107
|
// ---------------------------------------------------------------------------
|
|
94
108
|
|
|
109
|
+
const BOOLEAN_FLAGS = ['yes', 'dry-run', 'resume', 'start-comfy', 'start-worker', 'no-start-comfy', 'no-start-worker', 'all', 'accept-reference-runtime', 'accept-runtime-change', 'install-tools', 'no-tools', 'new-key', 'follow', 'no-fix', 'restart-platform-comfy', 'no-restart-platform-comfy'];
|
|
110
|
+
|
|
95
111
|
function parseArgs(argv) {
|
|
96
112
|
const args = argv.slice(2);
|
|
97
113
|
const parsed = { command: null, profiles: [], flags: {} };
|
|
@@ -100,12 +116,16 @@ function parseArgs(argv) {
|
|
|
100
116
|
const a = args[i];
|
|
101
117
|
if (a.startsWith('--')) {
|
|
102
118
|
const key = a.slice(2);
|
|
103
|
-
if (
|
|
119
|
+
if (BOOLEAN_FLAGS.includes(key)) {
|
|
104
120
|
parsed.flags[key] = true;
|
|
105
121
|
} else {
|
|
106
122
|
const val = args[++i];
|
|
107
123
|
parsed.flags[key] = val || '';
|
|
108
124
|
}
|
|
125
|
+
} else if (a === '-f') {
|
|
126
|
+
parsed.flags.follow = true;
|
|
127
|
+
} else if (a === '-y') {
|
|
128
|
+
parsed.flags.yes = true;
|
|
109
129
|
} else {
|
|
110
130
|
positional.push(a);
|
|
111
131
|
}
|
|
@@ -132,8 +152,17 @@ function resolveHubUrl(flags) {
|
|
|
132
152
|
return flags['hub-url'] || DEFAULT_HUB_URL;
|
|
133
153
|
}
|
|
134
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Root that holds the bundled worker files and workflows. In the hub
|
|
157
|
+
* installer tarball that is the unpacked `animastor-installer/` itself
|
|
158
|
+
* (worker/worker/, backend/ai/workflows/ next to src/); in a repo checkout
|
|
159
|
+
* it is the repository root. (The tarball case used to resolve OUTSIDE the
|
|
160
|
+
* unpacked bundle, so the bundled worker could never be found.)
|
|
161
|
+
*/
|
|
135
162
|
function resolveRepoRoot(flags) {
|
|
136
|
-
|
|
163
|
+
if (flags['repo-root']) return flags['repo-root'];
|
|
164
|
+
if (resolveRepoBundleDir(fs, CLI_ROOT)) return CLI_ROOT;
|
|
165
|
+
return REPO_ROOT;
|
|
137
166
|
}
|
|
138
167
|
|
|
139
168
|
function resolveStatePath(flags) {
|
|
@@ -208,7 +237,7 @@ function priorToolsDecision(io, statePath) {
|
|
|
208
237
|
* mixing (sudo vs. normal user). On failure prints the exact remediation
|
|
209
238
|
* and exits — the installer never ploughs on into an unrecoverable state.
|
|
210
239
|
*/
|
|
211
|
-
function runHostGates(realIo, { paths, dryRun = false, stateUid = null,
|
|
240
|
+
async function runHostGates(realIo, { paths, dryRun = false, stateUid = null, venvDir = null, needVenv = true, prompt = null, yes = false, log = null }) {
|
|
212
241
|
const uid = prereq.currentUid();
|
|
213
242
|
const ownership = prereq.checkOwnership(realIo, {
|
|
214
243
|
paths,
|
|
@@ -223,76 +252,27 @@ function runHostGates(realIo, { paths, dryRun = false, stateUid = null, deep = t
|
|
|
223
252
|
process.exit(1);
|
|
224
253
|
}
|
|
225
254
|
if (dryRun) return;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
255
|
+
// Only what the plan will ACTUALLY use is checked: a working `existing`
|
|
256
|
+
// ComfyUI with every model/node present never touches a venv, so a
|
|
257
|
+
// missing python3.X-venv must not block (or be installed for) nothing.
|
|
258
|
+
if (!needVenv) return;
|
|
259
|
+
const gateOpts = { python: 'python3', deep: true, existingVenvDir: venvDir };
|
|
260
|
+
const gate = prereq.checkPythonPrerequisites(realIo, gateOpts);
|
|
261
|
+
if (gate.ok) return;
|
|
262
|
+
// root / passwordless sudo: install the package on consent and CONTINUE
|
|
263
|
+
// in this same run ("Install python3.12-venv now? [Y/n]"); --yes installs
|
|
264
|
+
// without asking. Without the privileges the exact command is printed.
|
|
265
|
+
const resolved = await prereq.resolveHostPrerequisite(realIo, {
|
|
266
|
+
failure: gate.failure, opts: gateOpts, prompt, yes, log,
|
|
267
|
+
});
|
|
268
|
+
if (resolved.ok) {
|
|
269
|
+
console.log(`✓ ${resolved.installed.packages.join(' ')} installed — continuing`);
|
|
270
|
+
return;
|
|
231
271
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
// ---------------------------------------------------------------------------
|
|
237
|
-
|
|
238
|
-
function createPrompt() {
|
|
239
|
-
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
240
|
-
return {
|
|
241
|
-
async confirm(question) {
|
|
242
|
-
return new Promise((resolve) => {
|
|
243
|
-
rl.question(`${question} [Yes/No] `, (answer) => {
|
|
244
|
-
resolve(/^(y|yes)$/i.test(answer.trim()));
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
},
|
|
248
|
-
async select(question, options) {
|
|
249
|
-
return new Promise((resolve) => {
|
|
250
|
-
const text = `${question}\n${options.map((o, i) => ` [${i + 1}] ${o}`).join('\n')}\n> `;
|
|
251
|
-
rl.question(text, (answer) => {
|
|
252
|
-
const n = parseInt(answer, 10);
|
|
253
|
-
resolve(options[(n - 1) || 0] || options[0]);
|
|
254
|
-
});
|
|
255
|
-
});
|
|
256
|
-
},
|
|
257
|
-
async secret(question) {
|
|
258
|
-
// TTY: hidden raw-mode input (no echo). Non-TTY (piped input /
|
|
259
|
-
// automation): plain line input. In BOTH cases the value is never
|
|
260
|
-
// echoed to the output stream, never logged, never stored in
|
|
261
|
-
// state, never passed via argv.
|
|
262
|
-
if (process.stdin.isTTY && typeof process.stdin.setRawMode === 'function') {
|
|
263
|
-
return new Promise((resolve) => {
|
|
264
|
-
process.stdout.write(`${question}: `);
|
|
265
|
-
let value = '';
|
|
266
|
-
process.stdin.setRawMode(true);
|
|
267
|
-
process.stdin.resume();
|
|
268
|
-
const onData = (ch) => {
|
|
269
|
-
const c = ch.toString();
|
|
270
|
-
if (c === '\n' || c === '\r') {
|
|
271
|
-
process.stdin.setRawMode(false);
|
|
272
|
-
process.stdin.pause();
|
|
273
|
-
process.stdin.removeListener('data', onData);
|
|
274
|
-
process.stdout.write('\n');
|
|
275
|
-
resolve(value || null);
|
|
276
|
-
} else if (c === '\u0003') { // Ctrl+C
|
|
277
|
-
process.stdin.setRawMode(false);
|
|
278
|
-
process.stdin.pause();
|
|
279
|
-
process.stdin.removeListener('data', onData);
|
|
280
|
-
resolve(null);
|
|
281
|
-
} else if (c === '\u007F' || c === '\b') {
|
|
282
|
-
if (value.length > 0) value = value.slice(0, -1);
|
|
283
|
-
} else {
|
|
284
|
-
value += c;
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
process.stdin.on('data', onData);
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
return new Promise((resolve) => {
|
|
291
|
-
rl.question(`${question}: `, (answer) => resolve(answer ? String(answer) : null));
|
|
292
|
-
});
|
|
293
|
-
},
|
|
294
|
-
close() { rl.close(); },
|
|
295
|
-
};
|
|
272
|
+
console.error('');
|
|
273
|
+
for (const line of prereq.renderRemediation(resolved.failure)) console.error(line);
|
|
274
|
+
if (resolved.install && resolved.install.message) console.error(resolved.install.message);
|
|
275
|
+
process.exit(1);
|
|
296
276
|
}
|
|
297
277
|
|
|
298
278
|
// ---------------------------------------------------------------------------
|
|
@@ -313,6 +293,408 @@ function resolveAndPlan({ manifests, env, mode, decisions }) {
|
|
|
313
293
|
return { report, plan };
|
|
314
294
|
}
|
|
315
295
|
|
|
296
|
+
/**
|
|
297
|
+
* Same as resolveAndPlan, plus the real download size of incomplete model
|
|
298
|
+
* repos (ModelScope listing) so the plan shows exactly what will be
|
|
299
|
+
* downloaded. Network failures leave the size unknown.
|
|
300
|
+
*/
|
|
301
|
+
async function resolveAndPlanWithSizes({ io, manifests, env, mode, decisions }) {
|
|
302
|
+
const report = resolver.resolveInstallation({ manifests, environment: env, mode });
|
|
303
|
+
try { await downloader.annotateMissingModelSizes(io, report, manifests); } catch (_) { /* size unknown */ }
|
|
304
|
+
const plan = buildInstallPlan({ report, manifests, decisions });
|
|
305
|
+
return { report, plan };
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* The question asked for a plan step. Component lists are already printed
|
|
310
|
+
* in the plan (Missing/Actions) — list-type questions get one short line
|
|
311
|
+
* instead of a second copy of the menu; context questions (ComfyUI version
|
|
312
|
+
* decisions) are shown in full because the plan does not contain them.
|
|
313
|
+
*/
|
|
314
|
+
function stepQuestion(step) {
|
|
315
|
+
switch (step.id) {
|
|
316
|
+
case 'custom-nodes': return 'Install the missing custom node(s) listed above?';
|
|
317
|
+
case 'models': return 'Download the missing model file(s) listed above?';
|
|
318
|
+
case 'workflows': return 'Install the optional profile workflows (not required for Animastor)?';
|
|
319
|
+
case 'worker-setup': return 'Install and configure the Animastor worker (listed above)?';
|
|
320
|
+
default: return String(step.prompt.question).replace(/\n\n+/g, '\n');
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/** Versions shown in the banner. Hub/bootstrap versions come from the bootstrap env. */
|
|
325
|
+
function bannerVersions(manifests, flags, { hub = null } = {}) {
|
|
326
|
+
const pkg = require('../../package.json');
|
|
327
|
+
let worker = process.env.ANIMASTOR_WORKER_BUNDLE_VERSION || null;
|
|
328
|
+
if (!worker) {
|
|
329
|
+
const dir = resolveRepoBundleDir(fs, resolveRepoRoot(flags));
|
|
330
|
+
if (dir) worker = workerMod.readPkgVersion({ fs: { readFileSync: fs.readFileSync } }, dir);
|
|
331
|
+
}
|
|
332
|
+
return {
|
|
333
|
+
installer: pkg.version,
|
|
334
|
+
worker,
|
|
335
|
+
profile: manifests.map((m) => m.profile.id).join(' + '),
|
|
336
|
+
profileRevision: manifests.length === 1 ? manifests[0].revision : null,
|
|
337
|
+
hub: process.env.ANIMASTOR_HUB_VERSION || hub || null,
|
|
338
|
+
bootstrap: process.env.ANIMASTOR_BOOTSTRAP_VERSION || null,
|
|
339
|
+
platform: `${PLATFORM_RUNTIME.platform}/${PLATFORM_RUNTIME.deployment}`,
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/** Absolute path of the `animastor` command of this installation. */
|
|
344
|
+
function toolCommandPath(flags) {
|
|
345
|
+
const linkDir = management.defaultLinkDir();
|
|
346
|
+
if (linkDir) {
|
|
347
|
+
const link = path.join(linkDir, 'animastor');
|
|
348
|
+
if (fs.existsSync(link)) return link;
|
|
349
|
+
}
|
|
350
|
+
return path.join(resolveToolsDir(flags), 'animastor');
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Hub version for the banner. The bootstrap exports ANIMASTOR_HUB_VERSION;
|
|
355
|
+
* the install state remembers it; otherwise the hub is asked: GET
|
|
356
|
+
* <hub>/health (when it publishes a version) or the served installer script,
|
|
357
|
+
* whose `export ANIMASTOR_HUB_VERSION="…"` line is exactly what a fresh
|
|
358
|
+
* install receives. Never "hub unknown" while the hub is reachable.
|
|
359
|
+
*/
|
|
360
|
+
async function detectHubVersion(io, hubUrl, { known = null } = {}) {
|
|
361
|
+
if (known) return String(known);
|
|
362
|
+
const base = String(hubUrl || '').replace(/\/$/, '');
|
|
363
|
+
if (!base || !io.http) return null;
|
|
364
|
+
try {
|
|
365
|
+
const health = await io.http.fetchJson(`${base}/health`);
|
|
366
|
+
if (health && health.status === 200 && health.json && health.json.version) return String(health.json.version);
|
|
367
|
+
} catch (_) { /* older hub without a version field */ }
|
|
368
|
+
try {
|
|
369
|
+
const res = await io.http.fetchText(`${base}/installer`);
|
|
370
|
+
const text = res && res.status === 200 ? String(res.text || res.body || '') : '';
|
|
371
|
+
const m = /ANIMASTOR_HUB_VERSION="?([0-9][^"\n]*)"?/.exec(text);
|
|
372
|
+
if (m) return m[1].trim();
|
|
373
|
+
} catch (_) { /* offline — the banner falls back to "unknown" */ }
|
|
374
|
+
return null;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Decisions of a previous run that are reused as the STARTING point of this
|
|
379
|
+
* one: a re-run does not ask again about steps the user already answered
|
|
380
|
+
* (optional workflows declined once stay declined — also for `doctor --yes`
|
|
381
|
+
* on every boot). Secret-related facts are never stored, so nothing leaked
|
|
382
|
+
* can be reused here.
|
|
383
|
+
*/
|
|
384
|
+
const REUSED_DECISION_KEYS = ['comfyui_update', 'install_custom_nodes', 'install_models', 'workflows', 'worker_setup', 'accept_reference_runtime', 'accept_runtime_change'];
|
|
385
|
+
function priorReusableDecisions(state) {
|
|
386
|
+
const out = {};
|
|
387
|
+
const d = state && state.decisions;
|
|
388
|
+
if (!d) return out;
|
|
389
|
+
for (const k of REUSED_DECISION_KEYS) if (d[k] !== undefined) out[k] = d[k];
|
|
390
|
+
return out;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* The boot script (`animastor doctor --yes`, no TTY): one line of output and
|
|
395
|
+
* an exit code, nothing else. `ANIMASTOR_BOOT=1` forces it on a TTY too.
|
|
396
|
+
*/
|
|
397
|
+
function isBootRun(flags, doctor) {
|
|
398
|
+
if (!doctor || flags.yes !== true) return false;
|
|
399
|
+
if (process.env.ANIMASTOR_BOOT === '1') return true;
|
|
400
|
+
return !process.stdout.isTTY;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/** Host packages the boot path must restore when the image dropped them. */
|
|
404
|
+
function missingRequiredHostPackages(io) {
|
|
405
|
+
const out = [];
|
|
406
|
+
if (!probeMod.pickNodeBinary(io)) out.push('nodejs');
|
|
407
|
+
return out;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Should this run wait for the platform's ComfyUI before anything else?
|
|
412
|
+
* (installer 0.2.3) Yes when a wait is configured, no verified foreign
|
|
413
|
+
* instance answers yet, and either nothing runs at all or the recorded
|
|
414
|
+
* installation says the ComfyUI belongs to the platform (type A) — the
|
|
415
|
+
* latter holds even when some other main.py is visible, so the worker is
|
|
416
|
+
* never started before the platform's ComfyUI answers.
|
|
417
|
+
*/
|
|
418
|
+
function shouldWaitForPlatformComfy({ waitMs, instance, state }) {
|
|
419
|
+
if (!(waitMs > 0) || !instance || instance.owner === 'foreign') return false;
|
|
420
|
+
// Type B (installer 0.2.4): the installer created this ComfyUI and starts
|
|
421
|
+
// it itself — there is no platform instance to wait for (with the 600 s
|
|
422
|
+
// default of `animastor boot` that would be ten idle minutes).
|
|
423
|
+
const owned = !!(state && state.components && state.components.comfyui && state.components.comfyui.owned);
|
|
424
|
+
if (owned && !comfyOwner.platformOwnedByRecord(state)) return false;
|
|
425
|
+
return instance.owner === 'none' || comfyOwner.platformOwnedByRecord(state);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* The boot gate (installer 0.2.3): wait for the platform's ComfyUI when
|
|
430
|
+
* shouldWaitForPlatformComfy() says so — progress in the log every 30 s —
|
|
431
|
+
* and decide whether the run may continue.
|
|
432
|
+
* @returns {Promise<{ instance: object, waited: object|null, failed: boolean }>}
|
|
433
|
+
*/
|
|
434
|
+
async function platformComfyGate(io, { state = null, root = null, waitMs = 0, instance = null, logger = null, sleep = null, intervalMs = 3000, progressMs = 30000 } = {}) {
|
|
435
|
+
let inst = instance || await comfyOwner.resolveComfyOwner(io, { state, root });
|
|
436
|
+
if (!shouldWaitForPlatformComfy({ waitMs, instance: inst, state })) return { instance: inst, waited: null, failed: false };
|
|
437
|
+
const info = (line) => { if (logger) logger.info(line); };
|
|
438
|
+
info(`waiting up to ${Math.round(waitMs / 1000)} s for the platform's ComfyUI (process + GET /system_stats)`);
|
|
439
|
+
const waited = await comfyOwner.waitForPlatformComfyUI(io, {
|
|
440
|
+
state, root, timeoutMs: waitMs, intervalMs, progressMs, sleep, onProgress: info,
|
|
441
|
+
});
|
|
442
|
+
inst = waited.instance;
|
|
443
|
+
if (waited.ok) {
|
|
444
|
+
info(`the platform's ComfyUI answers at ${inst.url} (pid ${inst.pid}, after ${Math.round(waited.waited_ms / 1000)} s)`);
|
|
445
|
+
return { instance: inst, waited, failed: false };
|
|
446
|
+
}
|
|
447
|
+
// Nobody will start a ComfyUI for this installation (type A / existing):
|
|
448
|
+
// stop here instead of wiring the worker to the previous boot's address.
|
|
449
|
+
const failed = comfyOwner.platformOwnedByRecord(state) || inst.mode === 'existing';
|
|
450
|
+
if (failed && logger) logger.error(comfyOwner.platformComfyMissingReason(waited.waited_ms, waited.last_seen));
|
|
451
|
+
return { instance: inst, waited, failed };
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Type A, the platform's ComfyUI never came up within --comfy-wait-ms: the
|
|
456
|
+
* result is FAILED with one cause and one fix; the engine (worker start,
|
|
457
|
+
* .env rewrite) does not run, so the worker is never started against the
|
|
458
|
+
* address of a previous boot.
|
|
459
|
+
*/
|
|
460
|
+
function platformComfyMissingResult({ waited, tool, mode }) {
|
|
461
|
+
const reason = comfyOwner.platformComfyMissingReason(waited.waited_ms, waited.last_seen);
|
|
462
|
+
return {
|
|
463
|
+
status: 'failed',
|
|
464
|
+
mode,
|
|
465
|
+
warnings: [],
|
|
466
|
+
blocked: [],
|
|
467
|
+
verification: null,
|
|
468
|
+
results: { comfy_owner: { owner: 'none', mode, url: null }, worker: [] },
|
|
469
|
+
e2e: engineMod.platformComfyMissingChecks({ reason, tool }),
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* May this run restart the PLATFORM's ComfyUI (installer 0.2.4)? An
|
|
475
|
+
* explicit flag wins, then the recorded answer (install-state
|
|
476
|
+
* installer_options.restartPlatformComfy), then the boot default: yes on
|
|
477
|
+
* type A — the node is unattended and nothing else brings the node classes
|
|
478
|
+
* back. An interactive run without a record asks (askRestartPlatformComfy).
|
|
479
|
+
* @returns {{ allowed: boolean|null, source: 'flag'|'state'|'boot'|'unset' }}
|
|
480
|
+
*/
|
|
481
|
+
function restartPlatformComfyDecision(flags, state, { boot = false } = {}) {
|
|
482
|
+
if (flags['restart-platform-comfy']) return { allowed: true, source: 'flag' };
|
|
483
|
+
if (flags['no-restart-platform-comfy']) return { allowed: false, source: 'flag' };
|
|
484
|
+
const rec = state && state.installer_options ? state.installer_options.restartPlatformComfy : undefined;
|
|
485
|
+
if (rec === true || rec === false) return { allowed: rec, source: 'state' };
|
|
486
|
+
if (boot) return { allowed: true, source: 'boot' };
|
|
487
|
+
return { allowed: null, source: 'unset' };
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
const RESTART_PLATFORM_QUESTION = 'After a node restart the pip packages of custom nodes can disappear. May `animastor boot` reinstall them and restart the platform\'s ComfyUI so the nodes load?';
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* The custom-node dependency gate (installer 0.2.4) for a ComfyUI that the
|
|
494
|
+
* PLATFORM runs (type A): check the pip requirements of every required
|
|
495
|
+
* profile node in the Python of the running main.py; install the missing
|
|
496
|
+
* ones (boot / --yes: no question; interactive: one question, which also
|
|
497
|
+
* records the restart option); then — only when restarting the platform's
|
|
498
|
+
* ComfyUI is allowed — stop exactly that pid and wait until the platform
|
|
499
|
+
* started a new one with the node classes. Never starts a ComfyUI itself.
|
|
500
|
+
* @returns {Promise<{ instance, checked: boolean, installed: string[], restarted: boolean, pid_changed: boolean, failed: boolean, reason: string|null, record: object }>}
|
|
501
|
+
*/
|
|
502
|
+
async function platformNodeDepsGate(io, {
|
|
503
|
+
instance, state = null, root, manifests, flags = {}, boot = false, yes = false, prompt = null,
|
|
504
|
+
waitMs = 600000, logger = null, statePath = null, sleep = null, intervalMs = 3000, progressMs = 30000,
|
|
505
|
+
} = {}) {
|
|
506
|
+
const out = { instance, checked: false, installed: [], restarted: false, pid_changed: false, failed: false, reason: null, record: {} };
|
|
507
|
+
if (!instance || instance.owner !== 'foreign' || !instance.pid) return out;
|
|
508
|
+
const info = (line) => { if (logger) logger.info(line); };
|
|
509
|
+
const warn = (line) => { if (logger) logger.warn(line); };
|
|
510
|
+
const decision = restartPlatformComfyDecision(flags, state, { boot });
|
|
511
|
+
let restartAllowed = decision.allowed;
|
|
512
|
+
const interactive = !boot && !yes && !!(prompt && prompt.available);
|
|
513
|
+
|
|
514
|
+
const py = nodeDeps.pythonOfProcess(io, instance.pid);
|
|
515
|
+
if (!py.python) {
|
|
516
|
+
warn(`custom-node dependencies not checked: the Python of the ComfyUI process (pid ${instance.pid}) is unknown (${py.source})`);
|
|
517
|
+
return out;
|
|
518
|
+
}
|
|
519
|
+
const check = nodeDeps.checkNodeDeps(io, { python: py.python, root, manifests });
|
|
520
|
+
out.checked = true;
|
|
521
|
+
for (const e of check.errors) warn(`custom-node dependency check: ${e}`);
|
|
522
|
+
if (check.nodes.length === 0) {
|
|
523
|
+
info(`custom-node dependencies satisfied in ${py.python} (ComfyUI pid ${instance.pid})`);
|
|
524
|
+
if (interactive && restartAllowed === null) {
|
|
525
|
+
restartAllowed = await prompt.confirm(RESTART_PLATFORM_QUESTION, { defaultYes: true });
|
|
526
|
+
out.record.restartPlatformComfy = restartAllowed;
|
|
527
|
+
}
|
|
528
|
+
return out;
|
|
529
|
+
}
|
|
530
|
+
const what = nodeDeps.describeUnsatisfied(check.nodes);
|
|
531
|
+
info(`custom-node dependencies missing in ${py.python} (ComfyUI pid ${instance.pid}): ${what}`);
|
|
532
|
+
let install = boot || yes;
|
|
533
|
+
if (interactive) {
|
|
534
|
+
const restartPart = restartAllowed === false ? '' : ` and restart the platform's ComfyUI (pid ${instance.pid}) so it loads them`;
|
|
535
|
+
install = await prompt.confirm(`Install the missing Python packages — ${what} — into ${py.python}${restartPart}?`, { defaultYes: true });
|
|
536
|
+
if (restartAllowed === null) {
|
|
537
|
+
restartAllowed = install;
|
|
538
|
+
out.record.restartPlatformComfy = install;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
const tool = toolCommandPath(flags);
|
|
542
|
+
if (!install) {
|
|
543
|
+
out.failed = true;
|
|
544
|
+
out.reason = `custom-node dependencies missing in the ComfyUI Python ${py.python}: ${what}`;
|
|
545
|
+
out.fix = `${tool} doctor --yes`;
|
|
546
|
+
return out;
|
|
547
|
+
}
|
|
548
|
+
const constraintsPath = statePath ? path.join(path.dirname(statePath), 'node-deps-constraints.txt') : null;
|
|
549
|
+
const inst = nodeDeps.installNodeDeps(io, { python: py.python, nodes: check.nodes, torch: check.torch, constraintsPath, log: logger });
|
|
550
|
+
out.installed = inst.installed;
|
|
551
|
+
if (!inst.ok) {
|
|
552
|
+
out.failed = true;
|
|
553
|
+
out.reason = inst.failed.map((f) => `${f.directory}: ${f.reason}`).join('; ');
|
|
554
|
+
out.fix = `${tool} doctor`;
|
|
555
|
+
return out;
|
|
556
|
+
}
|
|
557
|
+
const again = nodeDeps.checkNodeDeps(io, { python: py.python, root, manifests });
|
|
558
|
+
if (again.nodes.length > 0) {
|
|
559
|
+
out.failed = true;
|
|
560
|
+
out.reason = `pip finished, but the requirements are still not satisfied in ${py.python}: ${nodeDeps.describeUnsatisfied(again.nodes)}`;
|
|
561
|
+
out.fix = `${tool} doctor`;
|
|
562
|
+
return out;
|
|
563
|
+
}
|
|
564
|
+
info(`custom-node dependencies installed: ${inst.installed.join(', ')}`);
|
|
565
|
+
if (restartAllowed !== true) {
|
|
566
|
+
// A ComfyUI that is not ours is never stopped without the option.
|
|
567
|
+
out.failed = true;
|
|
568
|
+
out.reason = `custom-node dependencies were installed, but the platform's ComfyUI (pid ${instance.pid}) imported the nodes before that and was not restarted (restart of the platform's ComfyUI is off)`;
|
|
569
|
+
out.fix = `restart the ComfyUI from the platform console, or run: ${tool} doctor --restart-platform-comfy`;
|
|
570
|
+
return out;
|
|
571
|
+
}
|
|
572
|
+
const expectClasses = check.nodes.flatMap((n) => n.classes);
|
|
573
|
+
const rr = await nodeDeps.restartPlatformComfyUI(io, {
|
|
574
|
+
pid: instance.pid, timeoutMs: waitMs, intervalMs, expectClasses, sleep, log: logger, onProgress: info, progressMs,
|
|
575
|
+
});
|
|
576
|
+
out.restarted = rr.stopped;
|
|
577
|
+
if (!rr.ok) {
|
|
578
|
+
out.failed = true;
|
|
579
|
+
out.reason = rr.reason;
|
|
580
|
+
out.fix = `when the platform's ComfyUI is up again, run: ${tool} doctor`;
|
|
581
|
+
if (rr.stopped) out.pid_changed = rr.pid != null;
|
|
582
|
+
return out;
|
|
583
|
+
}
|
|
584
|
+
info(`the platform started ComfyUI again: pid ${rr.old_pid} → ${rr.pid} at ${rr.url} (after ${Math.round(rr.waited_ms / 1000)} s), node classes present`);
|
|
585
|
+
out.pid_changed = true;
|
|
586
|
+
out.instance = await comfyOwner.resolveComfyOwner(io, { state, root });
|
|
587
|
+
return out;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/** FAILED result of the dependency gate (the engine — worker start — does not run). */
|
|
591
|
+
function nodeDepsFailedResult({ gate, mode }) {
|
|
592
|
+
return {
|
|
593
|
+
status: 'failed',
|
|
594
|
+
mode,
|
|
595
|
+
warnings: [],
|
|
596
|
+
blocked: [],
|
|
597
|
+
verification: null,
|
|
598
|
+
results: { comfy_owner: { owner: gate.instance && gate.instance.owner, mode, url: (gate.instance && gate.instance.url) || null }, worker: [] },
|
|
599
|
+
e2e: [
|
|
600
|
+
{ id: 'node-deps', ok: false, label: 'Custom-node dependencies', detail: gate.reason, fix: gate.fix || null },
|
|
601
|
+
{ id: 'worker', ok: null, label: 'Worker → ComfyUI', detail: 'not started — the ComfyUI has no node classes for this profile', fix: null },
|
|
602
|
+
],
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/** Store one installer option in install-state.json (a recorded answer). */
|
|
607
|
+
function recordInstallerOption(io, statePath, key, value) {
|
|
608
|
+
const st = stateStore.loadState(io, statePath);
|
|
609
|
+
if (!st) return false;
|
|
610
|
+
st.installer_options = { ...(st.installer_options || {}), [key]: value };
|
|
611
|
+
stateStore.saveState(io, statePath, st, io.now);
|
|
612
|
+
return true;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/** ~/animastor/logs/bootstrap.log — the boot log next to the worker dir. */
|
|
616
|
+
function bootLogPath(flags) {
|
|
617
|
+
return flags['boot-log'] || path.join(path.dirname(resolveWorkerDir(flags)), 'logs', 'bootstrap.log');
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
/** System boot time from /proc/stat (btime) as ISO, or null. */
|
|
621
|
+
function systemBootTime(io) {
|
|
622
|
+
try {
|
|
623
|
+
const m = /^btime\s+(\d+)/m.exec(String(io.fs.readFileSync('/proc/stat', 'utf8')));
|
|
624
|
+
return m ? new Date(Number(m[1]) * 1000).toISOString() : null;
|
|
625
|
+
} catch (_) { return null; }
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
/** The argv of the detached `doctor --yes` that `animastor boot` starts. */
|
|
629
|
+
function bootChildArgs(flags, { cliPath = __filename, defaultWaitMs = 600000 } = {}) {
|
|
630
|
+
const args = [cliPath, 'doctor', '--yes'];
|
|
631
|
+
for (const [k, v] of Object.entries(flags)) {
|
|
632
|
+
if (k === 'profiles' || k === 'yes' || k === 'boot-log' || v === undefined || v === null || v === false) continue;
|
|
633
|
+
if (v === true) args.push(`--${k}`);
|
|
634
|
+
else args.push(`--${k}`, String(v));
|
|
635
|
+
}
|
|
636
|
+
if (flags['comfy-wait-ms'] === undefined || flags['comfy-wait-ms'] === '') {
|
|
637
|
+
if (!process.env.ANIMASTOR_COMFY_WAIT_MS) args.push('--comfy-wait-ms', String(defaultWaitMs));
|
|
638
|
+
}
|
|
639
|
+
return args;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* `animastor boot` (installer 0.2.4) — the WHOLE node startup script. TIR
|
|
644
|
+
* starts its own ComfyUI only AFTER the startup script has finished, so any
|
|
645
|
+
* wait inside the script is a deadlock (live 31.10: doctor gave up 05:19:06,
|
|
646
|
+
* main.py started 05:19:35). boot therefore detaches at once — new session
|
|
647
|
+
* (setsid), stdin /dev/null, stdout/stderr appended to
|
|
648
|
+
* ~/animastor/logs/bootstrap.log under a header with the boot time — and
|
|
649
|
+
* exits 0; the detached `doctor --yes` waits (600 s by default), restores the
|
|
650
|
+
* node dependencies, restarts the platform's ComfyUI when needed and starts
|
|
651
|
+
* the worker.
|
|
652
|
+
*/
|
|
653
|
+
function cmdBoot(flags, { io = createRealIo(), spawn = require('child_process').spawn, execPath = process.execPath, cliPath = __filename, now = () => new Date() } = {}) {
|
|
654
|
+
const logFile = bootLogPath(flags);
|
|
655
|
+
let fd = null;
|
|
656
|
+
try {
|
|
657
|
+
io.fs.mkdirSync(path.dirname(logFile), { recursive: true });
|
|
658
|
+
fd = fs.openSync(logFile, 'a');
|
|
659
|
+
const btime = systemBootTime(io);
|
|
660
|
+
fs.writeSync(fd, `\n===== animastor boot ${now().toISOString()} (system boot ${btime || 'unknown'}) =====\n`);
|
|
661
|
+
const args = bootChildArgs(flags, { cliPath });
|
|
662
|
+
const child = spawn(execPath, args, {
|
|
663
|
+
detached: true,
|
|
664
|
+
stdio: ['ignore', fd, fd],
|
|
665
|
+
cwd: homeDir(),
|
|
666
|
+
env: { ...process.env, ANIMASTOR_BOOT: '1' },
|
|
667
|
+
});
|
|
668
|
+
if (child && typeof child.unref === 'function') child.unref();
|
|
669
|
+
const pid = child && child.pid;
|
|
670
|
+
fs.writeSync(fd, `animastor boot: doctor --yes detached (pid ${pid || '?'}): ${args.slice(1).join(' ')}\n`);
|
|
671
|
+
console.log(`animastor boot: started in the background (pid ${pid || '?'}), log ${logFile}`);
|
|
672
|
+
process.exitCode = 0;
|
|
673
|
+
return { pid: pid || null, logFile, args };
|
|
674
|
+
} catch (err) {
|
|
675
|
+
console.error(`animastor boot: could not start the background run: ${err.message} (log ${logFile})`);
|
|
676
|
+
process.exitCode = 1;
|
|
677
|
+
return { pid: null, logFile, error: err.message };
|
|
678
|
+
} finally {
|
|
679
|
+
if (fd != null) { try { fs.closeSync(fd); } catch (_) { /* closed */ } }
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
/** The one line for the node startup script (printed at the end of an install). */
|
|
684
|
+
function startupScriptLine(flags) {
|
|
685
|
+
const tool = toolCommandPath(flags);
|
|
686
|
+
return `export PATH="$HOME/.local/bin:$PATH"; ${tool} boot`;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/** The `animastor` command recorded for this installation (fix lines). */
|
|
690
|
+
function toolCommand(flags) {
|
|
691
|
+
const tool = path.join(resolveToolsDir(flags), 'animastor');
|
|
692
|
+
const linked = path.join(management.defaultLinkDir() || '', 'animastor');
|
|
693
|
+
if (fs.existsSync(linked) && String(process.env.PATH || '').split(path.delimiter).includes(path.dirname(linked))) return 'animastor';
|
|
694
|
+
if (fs.existsSync(tool)) return tool;
|
|
695
|
+
return 'animastor';
|
|
696
|
+
}
|
|
697
|
+
|
|
316
698
|
/** Secret values collected interactively — memory-only, never persisted. */
|
|
317
699
|
function makeSecretProvider(secrets) {
|
|
318
700
|
if (!secrets || Object.keys(secrets).length === 0) return null;
|
|
@@ -361,16 +743,40 @@ function createScreen() {
|
|
|
361
743
|
});
|
|
362
744
|
}
|
|
363
745
|
|
|
364
|
-
async function cmdInstall(flags) {
|
|
746
|
+
async function cmdInstall(flags, { doctor = false } = {}) {
|
|
747
|
+
const realIo = createRealIo();
|
|
748
|
+
// doctor = the same idempotent install for the RECORDED installation:
|
|
749
|
+
// profiles come from install-state.json unless given explicitly. The
|
|
750
|
+
// recorded MODE is not applied: the mode follows the machine (see
|
|
751
|
+
// engine/comfy-owner.js) — a contradiction is shown and corrected.
|
|
752
|
+
const statePathEarly = resolveStatePath(flags);
|
|
753
|
+
let recorded = null;
|
|
754
|
+
if (doctor) {
|
|
755
|
+
recorded = stateStore.loadState(realIo, statePathEarly);
|
|
756
|
+
if (!recorded || !Array.isArray(recorded.profiles) || recorded.profiles.length === 0) {
|
|
757
|
+
console.error(`No Animastor installation found (state: ${statePathEarly}). Run the install command from the Animastor setup page first.`);
|
|
758
|
+
process.exit(2);
|
|
759
|
+
}
|
|
760
|
+
if (flags.profiles.length === 0) flags.profiles = recorded.profiles.slice();
|
|
761
|
+
}
|
|
365
762
|
if (flags.profiles.length === 0) {
|
|
366
763
|
console.error('error: --profile is required');
|
|
367
764
|
process.exit(1);
|
|
368
765
|
}
|
|
369
|
-
|
|
766
|
+
// Recorded facts reused as the starting point: previous non-secret
|
|
767
|
+
// decisions (no repeated questions) and the hub version for the banner.
|
|
768
|
+
const priorState = recorded || stateStore.loadState(realIo, statePathEarly);
|
|
769
|
+
const boot = isBootRun(flags, doctor);
|
|
770
|
+
// ComfyUI root: --root > ~/ComfyUI (when it holds a ComfyUI) > the root
|
|
771
|
+
// of the user's running ComfyUI process > ~/ComfyUI (managed creates it).
|
|
772
|
+
let runningComfy = probeMod.detectRunningComfyUI(realIo);
|
|
773
|
+
const rootPick = probeMod.resolveComfyRoot(realIo, { explicit: flags.root || null, defaultRoot: DEFAULT_ROOT, running: runningComfy });
|
|
774
|
+
flags.root = rootPick.root;
|
|
775
|
+
const root = rootPick.root;
|
|
370
776
|
const workerDir = resolveWorkerDir(flags);
|
|
371
777
|
const hubUrl = resolveHubUrl(flags);
|
|
372
778
|
const repoRoot = resolveRepoRoot(flags);
|
|
373
|
-
const statePath =
|
|
779
|
+
const statePath = statePathEarly;
|
|
374
780
|
const dryRun = flags['dry-run'] || false;
|
|
375
781
|
const yes = flags.yes || false;
|
|
376
782
|
const crypto = require('crypto');
|
|
@@ -378,167 +784,377 @@ async function cmdInstall(flags) {
|
|
|
378
784
|
// Probing is read-only and always runs against the REAL io. In dry-run
|
|
379
785
|
// mode the guarded io is used ONLY inside the engine, where every
|
|
380
786
|
// mutating operation would throw a "dry-run violation".
|
|
381
|
-
const realIo = createRealIo();
|
|
382
787
|
const screen = createScreen();
|
|
383
788
|
const logger = createLogger({ io: realIo, sink: (line) => screen.print(line) });
|
|
384
789
|
const loadedManifests = flags.profiles.map((p) => manifest.loadManifest(p));
|
|
385
|
-
const
|
|
790
|
+
const hubVersion = doctor
|
|
791
|
+
? await detectHubVersion(realIo, hubUrl, { known: process.env.ANIMASTOR_HUB_VERSION || (priorState && priorState.hub_version) || null })
|
|
792
|
+
: (process.env.ANIMASTOR_HUB_VERSION || null);
|
|
793
|
+
|
|
794
|
+
if (!boot) {
|
|
795
|
+
console.log(renderBanner(bannerVersions(loadedManifests, flags, { hub: hubVersion })));
|
|
796
|
+
if (doctor) console.log('animastor doctor — re-checking the installation and fixing what can be fixed\n');
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
// ONE prompt object for the whole run; every question reads /dev/tty
|
|
800
|
+
// when stdin is the `curl | bash` pipe. Created BEFORE the ownership
|
|
801
|
+
// questions below.
|
|
802
|
+
const prompt = createPrompt();
|
|
803
|
+
|
|
804
|
+
// Restore the PATH block before anything else: the dotfiles are reset on
|
|
805
|
+
// every node boot while ~/.local/bin/animastor survives.
|
|
806
|
+
const pathEntry = management.restoreCommandPath(realIo, { linkDir: management.defaultLinkDir(), home: homeDir() });
|
|
807
|
+
if (!boot && pathEntry.updated.length > 0) console.log(`PATH block restored: ${pathEntry.updated.join(', ')}`);
|
|
808
|
+
|
|
809
|
+
// Host packages that disappeared with the image restart (boot path).
|
|
810
|
+
if (doctor) {
|
|
811
|
+
const missingPkgs = missingRequiredHostPackages(realIo);
|
|
812
|
+
if (missingPkgs.length > 0) {
|
|
813
|
+
const r = await prereq.installMissingHostPackages(realIo, {
|
|
814
|
+
packages: missingPkgs, prompt: boot ? null : prompt, yes, log: logger,
|
|
815
|
+
});
|
|
816
|
+
if (r.installed.length > 0 && !boot) console.log(`✓ installed ${r.installed.join(' ')}`);
|
|
817
|
+
else if (!r.ok && !boot) console.log(`! ${r.message}`);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
// ComfyUI ownership BY FACT: a verified ComfyUI process the installer did
|
|
822
|
+
// not start decides the mode (existing) and the worker address; the
|
|
823
|
+
// installer never starts a second one next to it.
|
|
824
|
+
let instance = await comfyOwner.resolveComfyOwner(realIo, { state: priorState, root });
|
|
825
|
+
const comfyWaitMs = flags['comfy-wait-ms'] !== undefined && flags['comfy-wait-ms'] !== ''
|
|
826
|
+
? Number(flags['comfy-wait-ms'])
|
|
827
|
+
: (Number(process.env.ANIMASTOR_COMFY_WAIT_MS) || (boot ? 180000 : 0));
|
|
828
|
+
// Type A boot: the platform starts ComfyUI AFTER this script — wait for
|
|
829
|
+
// it (process + /system_stats) before the address is recomputed into
|
|
830
|
+
// .env and the worker is started; never start it against the address
|
|
831
|
+
// of a previous boot.
|
|
832
|
+
const windowStart = realIo.now();
|
|
833
|
+
const gate = await platformComfyGate(realIo, { state: priorState, root, waitMs: comfyWaitMs, instance, logger });
|
|
834
|
+
instance = gate.instance;
|
|
835
|
+
if (gate.waited && gate.waited.ok) runningComfy = probeMod.detectRunningComfyUI(realIo);
|
|
836
|
+
if (gate.failed) {
|
|
837
|
+
printResult(platformComfyMissingResult({ waited: gate.waited, tool: toolCommandPath(flags), mode: 'existing' }), { flags, mode: 'existing', boot });
|
|
838
|
+
process.exitCode = 1;
|
|
839
|
+
prompt.close();
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
// Type A (installer 0.2.4): the pip packages of the custom nodes live
|
|
844
|
+
// outside /home and vanish with a node restart — check them in the Python
|
|
845
|
+
// of the platform's main.py, reinstall, and (when allowed) let the
|
|
846
|
+
// platform start its ComfyUI again so the node classes load.
|
|
847
|
+
const recordedPid = priorState && priorState.comfy_owner ? priorState.comfy_owner.pid : null;
|
|
848
|
+
const depsGate = dryRun ? null : await platformNodeDepsGate(realIo, {
|
|
849
|
+
instance, state: priorState, root, manifests: loadedManifests, flags, boot, yes, prompt,
|
|
850
|
+
waitMs: Math.max(60000, comfyWaitMs - (realIo.now() - windowStart)), logger, statePath,
|
|
851
|
+
});
|
|
852
|
+
if (depsGate) {
|
|
853
|
+
instance = depsGate.instance;
|
|
854
|
+
if (depsGate.restarted) runningComfy = probeMod.detectRunningComfyUI(realIo);
|
|
855
|
+
if (depsGate.record.restartPlatformComfy !== undefined) {
|
|
856
|
+
recordInstallerOption(realIo, statePath, 'restartPlatformComfy', depsGate.record.restartPlatformComfy);
|
|
857
|
+
}
|
|
858
|
+
if (depsGate.failed) {
|
|
859
|
+
printResult(nodeDepsFailedResult({ gate: depsGate, mode: instance.mode }), { flags, mode: instance.mode, boot });
|
|
860
|
+
process.exitCode = 1;
|
|
861
|
+
prompt.close();
|
|
862
|
+
return;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
// Node classes are re-checked until the end of the window when the node
|
|
866
|
+
// dependencies were just installed or the ComfyUI is a new process.
|
|
867
|
+
const pidChanged = !!(depsGate && depsGate.pid_changed)
|
|
868
|
+
|| (recordedPid != null && instance.pid != null && Number(recordedPid) !== Number(instance.pid));
|
|
869
|
+
const nodeClassesDeadline = (depsGate && depsGate.installed.length > 0) || pidChanged
|
|
870
|
+
? windowStart + Math.max(comfyWaitMs, 0)
|
|
871
|
+
: null;
|
|
872
|
+
|
|
873
|
+
// The machine decides the mode. An explicit --mode that contradicts it is
|
|
874
|
+
// reported, never silently applied: starting a second ComfyUI next to the
|
|
875
|
+
// platform's is exactly the failure this release fixes.
|
|
876
|
+
const mode = instance.mode;
|
|
877
|
+
if (!boot) {
|
|
878
|
+
if (flags.mode && flags.mode !== instance.mode) {
|
|
879
|
+
console.log(`Mode: ${instance.mode} — ${instance.reason}; --mode ${flags.mode} ignored (the machine decides)`);
|
|
880
|
+
} else {
|
|
881
|
+
console.log(`Mode: ${instance.mode} — ${instance.reason}`);
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
if (instance.conflicts.length > 0 && !boot) {
|
|
885
|
+
console.log('\nThe recorded installation disagrees with this machine:');
|
|
886
|
+
for (const c of instance.conflicts) console.log(` ! ${c.message}`);
|
|
887
|
+
console.log(' → corrected for this run and stored in install-state.json');
|
|
888
|
+
}
|
|
889
|
+
if (instance.stop_offer) {
|
|
890
|
+
const pid = instance.stop_offer.pid;
|
|
891
|
+
const question = `Stop the installer's own ComfyUI (pid ${pid})? The platform instance ${instance.foreign.url} is the real one.`;
|
|
892
|
+
let stopIt = false;
|
|
893
|
+
if (yes) stopIt = true;
|
|
894
|
+
else if (prompt.available) stopIt = await prompt.confirm(question, { defaultYes: true });
|
|
895
|
+
else if (!boot) console.log(` · ${question} (non-interactive — left running; --yes stops it)`);
|
|
896
|
+
if (stopIt) {
|
|
897
|
+
const stopRes = comfyOwner.stopInstallerInstance(realIo, instance.ours);
|
|
898
|
+
if (!boot) console.log(stopRes.stopped ? `✓ installer ComfyUI stopped (pid ${pid})` : `! ${stopRes.reason}`);
|
|
899
|
+
}
|
|
900
|
+
}
|
|
386
901
|
|
|
387
902
|
const env = probeEnvironment(realIo, {
|
|
388
903
|
root, workerDir, crypto,
|
|
389
904
|
workerType: loadedManifests.length === 1 ? (loadedManifests[0].worker_bundle || {}).worker_type : null,
|
|
390
905
|
});
|
|
391
906
|
|
|
392
|
-
//
|
|
393
|
-
//
|
|
394
|
-
|
|
395
|
-
|
|
907
|
+
// The dry-run guard wraps everything handed to the engine so any
|
|
908
|
+
// accidental mutation throws "dry-run violation" instead of executing.
|
|
909
|
+
const io = dryRun ? createDryRunIo(realIo) : realIo;
|
|
910
|
+
|
|
911
|
+
// The plan comes FIRST: the prerequisite check must know whether the
|
|
912
|
+
// Python runtime/venv is used at all (a working `existing` ComfyUI with
|
|
913
|
+
// its models already in place needs none). Previously answered steps
|
|
914
|
+
// (a declined optional workflow, a declined model download) are not
|
|
915
|
+
// asked again.
|
|
916
|
+
const priorDecisions = priorReusableDecisions(priorState);
|
|
917
|
+
const { plan, report: planReport } = await resolveAndPlanWithSizes({ io: realIo, manifests: loadedManifests, env, mode, decisions: priorDecisions });
|
|
918
|
+
|
|
919
|
+
// Prerequisites & ownership BEFORE any prompt/change: a missing
|
|
920
|
+
// python3.X-venv is reported/installed up front (when the plan uses the
|
|
921
|
+
// runtime), not after the user has answered every question.
|
|
922
|
+
await runHostGates(realIo, {
|
|
396
923
|
paths: [root, workerDir, statePath, resolveToolsDir(flags)].filter(Boolean),
|
|
397
924
|
dryRun,
|
|
398
|
-
deep: true,
|
|
399
925
|
venvDir: path.join(root, 'venv'),
|
|
926
|
+
needVenv: planNeedsPythonRuntime({ plan, report: planReport, mode }),
|
|
927
|
+
prompt,
|
|
928
|
+
yes,
|
|
929
|
+
log: logger,
|
|
400
930
|
});
|
|
401
931
|
|
|
402
|
-
//
|
|
403
|
-
//
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
932
|
+
// Mode was printed above with its reason; the questions are asked below
|
|
933
|
+
// one by one — neither is repeated in the plan text.
|
|
934
|
+
if (!boot) {
|
|
935
|
+
console.log(`Profile: ${plan.profiles.join(' + ')}\n`);
|
|
936
|
+
console.log(renderPlanText(plan, planReport, { questions: false, header: false }));
|
|
937
|
+
}
|
|
407
938
|
|
|
408
|
-
|
|
939
|
+
const needPrompt = () => {
|
|
940
|
+
if (!prompt.available) {
|
|
941
|
+
console.error('');
|
|
942
|
+
console.error(require('./engine/tty').NO_TTY_MESSAGE);
|
|
943
|
+
process.exit(3);
|
|
944
|
+
}
|
|
945
|
+
return prompt;
|
|
946
|
+
};
|
|
409
947
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
948
|
+
try {
|
|
949
|
+
// CPU-only mode is always announced explicitly and confirmed before any
|
|
950
|
+
// change: the user must see that performance will be significantly lower.
|
|
951
|
+
const device = env.device || (env.gpu ? 'cuda' : 'cpu');
|
|
952
|
+
if (device === 'cpu' && !dryRun) {
|
|
953
|
+
console.log('\n=========================================================================');
|
|
954
|
+
console.log(' CPU-ONLY MODE: no supported GPU was detected.');
|
|
955
|
+
console.log(' A CPU build of PyTorch will be installed and ComfyUI will run');
|
|
956
|
+
console.log(' with --cpu. Performance will be SIGNIFICANTLY lower.');
|
|
957
|
+
console.log(' This mode is intended for the TTS/audio profile test scenario.');
|
|
958
|
+
console.log('=========================================================================');
|
|
959
|
+
if (!yes) {
|
|
960
|
+
const proceed = await needPrompt().confirm('Continue with the CPU-only installation?');
|
|
961
|
+
if (!proceed) {
|
|
962
|
+
console.log('Aborted — nothing was changed.');
|
|
963
|
+
process.exit(0);
|
|
964
|
+
}
|
|
427
965
|
}
|
|
428
966
|
}
|
|
429
|
-
}
|
|
430
967
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
968
|
+
if (dryRun) {
|
|
969
|
+
console.log('\n[dry-run] zero mutations performed');
|
|
970
|
+
return;
|
|
971
|
+
}
|
|
435
972
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
973
|
+
if (plan.blocked.length > 0) {
|
|
974
|
+
printFinal({ blocked: plan.blocked, tool: toolCommand(flags), mode });
|
|
975
|
+
process.exitCode = 1;
|
|
976
|
+
return;
|
|
977
|
+
}
|
|
440
978
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
//
|
|
445
|
-
|
|
979
|
+
// Auto-fix: one list, one question — instead of warnings. The ComfyUI
|
|
980
|
+
// address comes from the running process (comfy-owner), verified by
|
|
981
|
+
// GET /system_stats, and is recomputed on EVERY run: port and notebook
|
|
982
|
+
// prefix change between boots, so the remembered .env is not trusted.
|
|
983
|
+
const nodePick = probeMod.pickNodeBinary(realIo);
|
|
984
|
+
const port = flags['comfy-port'] ? Number(flags['comfy-port']) : (instance.port || null);
|
|
985
|
+
let probedUrl = instance.url || null;
|
|
986
|
+
if (!probedUrl && (port || mode !== 'managed')) {
|
|
987
|
+
const envNow = workerMod.readEnvValues(realIo, workerDir);
|
|
988
|
+
const pr = await probeMod.probeComfyUrl(realIo, {
|
|
989
|
+
port: port || Number(envNow.COMFY_PORT) || 8188,
|
|
990
|
+
prefixes: [envNow.NOTEBOOK_PATH, runningComfy && runningComfy.baseurl].filter(Boolean),
|
|
991
|
+
});
|
|
992
|
+
probedUrl = pr.url;
|
|
993
|
+
}
|
|
994
|
+
const desired = engineMod.desiredEnvWiring({
|
|
995
|
+
manifests: loadedManifests,
|
|
996
|
+
nodeBin: nodePick ? nodePick.bin : null,
|
|
997
|
+
comfyUrl: probedUrl,
|
|
998
|
+
comfyPort: port,
|
|
999
|
+
hubUrl,
|
|
1000
|
+
hubUrlExplicit: !!flags['hub-url'],
|
|
1001
|
+
});
|
|
1002
|
+
const fixPlan = fixes.planFixes(realIo, {
|
|
1003
|
+
workerDir, desired,
|
|
1004
|
+
sourceBundleDir: resolveRepoBundleDir(fs, repoRoot),
|
|
1005
|
+
sourceVersion: process.env.ANIMASTOR_WORKER_BUNDLE_VERSION || null, // served by the hub (bootstrap)
|
|
1006
|
+
});
|
|
1007
|
+
let applyFixes = true;
|
|
1008
|
+
if (fixPlan.additions.length > 0 && !boot) {
|
|
1009
|
+
console.log(`\nWorker settings to add: ${fixPlan.additions.join(', ')}`);
|
|
1010
|
+
}
|
|
1011
|
+
if (fixPlan.items.length > 0) {
|
|
1012
|
+
if (!boot) {
|
|
1013
|
+
console.log('\nThe installer will fix:');
|
|
1014
|
+
fixPlan.items.forEach((f, i) => console.log(` ${i + 1}. ${f.title}`));
|
|
1015
|
+
}
|
|
1016
|
+
if (flags['no-fix']) applyFixes = false;
|
|
1017
|
+
else if (!yes) applyFixes = await needPrompt().confirm(`Fix ${fixPlan.items.length === 1 ? 'it' : `all ${fixPlan.items.length}`}?`, { defaultYes: true });
|
|
1018
|
+
if (!applyFixes && !boot) console.log('Not fixing — the remaining problems are listed in the result.');
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
const decisions = { ...priorDecisions, apply_fixes: applyFixes };
|
|
1022
|
+
// Management tools (the `animastor` command): part of a normal
|
|
1023
|
+
// installation; --no-tools opts out, a recorded decision is kept.
|
|
446
1024
|
decisions.install_management_tools = await resolveToolsDecision({
|
|
447
|
-
flags, prompt, prior: priorToolsDecision(realIo, statePath),
|
|
1025
|
+
flags, prompt: null, prior: priorToolsDecision(realIo, statePath),
|
|
448
1026
|
});
|
|
449
|
-
// Explicit consent flags apply to interactive runs exactly as they do
|
|
450
|
-
// to --yes runs (parity): without them a reference-grade ComfyUI
|
|
451
|
-
// source (manifest basis=unknown, D1) can never be accepted here.
|
|
452
1027
|
if (flags['accept-reference-runtime']) decisions.accept_reference_runtime = true;
|
|
453
1028
|
if (flags['accept-runtime-change']) decisions.accept_runtime_change = true;
|
|
454
1029
|
// Secret VALUES live only in this closure — never in decisions, logs,
|
|
455
1030
|
// state, or argv. The engine receives them via secretProvider.
|
|
456
1031
|
const secrets = {};
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
1032
|
+
|
|
1033
|
+
if (yes) {
|
|
1034
|
+
// --yes answers everything EXCEPT steps the user already declined:
|
|
1035
|
+
// a "no" to the optional workflows (and to model/node downloads)
|
|
1036
|
+
// is remembered, so a boot-time `doctor --yes` never installs them
|
|
1037
|
+
// behind the user's back.
|
|
1038
|
+
const yd = yesDecisions();
|
|
1039
|
+
for (const k of ['workflows', 'install_models', 'install_custom_nodes']) {
|
|
1040
|
+
if (priorDecisions[k] !== undefined) yd[k] = priorDecisions[k];
|
|
464
1041
|
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
1042
|
+
Object.assign(decisions, yd);
|
|
1043
|
+
} else if (plan.awaiting_decisions.length > 0) {
|
|
1044
|
+
for (const stepId of plan.awaiting_decisions) {
|
|
1045
|
+
const step = plan.steps.find((s) => s.id === stepId);
|
|
1046
|
+
if (!step || !step.prompt) continue;
|
|
1047
|
+
if (stepId === 'worker-key' && decisions.worker_setup === false) {
|
|
1048
|
+
// worker setup was declined — the key prompt is skipped too
|
|
1049
|
+
decisions.worker_key_provided = false;
|
|
1050
|
+
continue;
|
|
1051
|
+
}
|
|
1052
|
+
if (step.kind === 'secret-prompt') {
|
|
1053
|
+
// Re-install over an already configured worker: the key is
|
|
1054
|
+
// in .env — never ask for it again (a key that the hub
|
|
1055
|
+
// REJECTED is replaced via --new-key, not by re-asking).
|
|
1056
|
+
if (stepId === 'worker-key' && !flags['new-key']
|
|
1057
|
+
&& workerMod.hasEnvKey(realIo, workerDir, 'ANIMASTOR_WORKER_TOKEN')) {
|
|
1058
|
+
console.log(`Worker Key: kept from ${path.join(workerDir, '.env')} (already configured — not asked again; use --new-key to replace it)`);
|
|
1059
|
+
decisions.worker_key_provided = true;
|
|
1060
|
+
continue;
|
|
477
1061
|
}
|
|
1062
|
+
// Worker Key step: real hidden input (never a Yes/No confirm —
|
|
1063
|
+
// a typed token must not be misread as an answer). Only the
|
|
1064
|
+
// boolean fact "provided" enters the decisions; the value
|
|
1065
|
+
// itself is handed to the engine through secretProvider.
|
|
1066
|
+
let provided = false;
|
|
1067
|
+
for (const key of step.secret_keys || []) {
|
|
1068
|
+
const value = await needPrompt().secret(`Paste the Worker Key from the Animastor page (${key}, hidden input)`);
|
|
1069
|
+
if (value) {
|
|
1070
|
+
secrets[key] = value;
|
|
1071
|
+
logger.registerSecret(value); // redact from ALL further output
|
|
1072
|
+
provided = true;
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
decisions.worker_key_provided = provided;
|
|
1076
|
+
continue;
|
|
1077
|
+
}
|
|
1078
|
+
// "Cannot be determined automatically — review": there is
|
|
1079
|
+
// nothing to choose; continue with the user's ComfyUI as is.
|
|
1080
|
+
if (stepId === 'comfyui-update' && (step.prompt.options || [])[0] === 'Review') {
|
|
1081
|
+
console.log(`${String(step.prompt.question).split('\n')[0]} — continuing with the installed ComfyUI as is.`);
|
|
1082
|
+
decisions.comfyui_update = 'yes';
|
|
1083
|
+
continue;
|
|
478
1084
|
}
|
|
479
|
-
|
|
480
|
-
|
|
1085
|
+
const answer = await needPrompt().confirm(stepQuestion(step), { defaultYes: true });
|
|
1086
|
+
if (step.consent === 'accept_reference_runtime') {
|
|
1087
|
+
decisions.accept_reference_runtime = answer;
|
|
1088
|
+
continue;
|
|
1089
|
+
}
|
|
1090
|
+
if (stepId === 'comfyui-update') decisions.comfyui_update = answer ? 'yes' : 'no';
|
|
1091
|
+
else if (stepId === 'custom-nodes') decisions.install_custom_nodes = answer;
|
|
1092
|
+
else if (stepId === 'models') decisions.install_models = answer;
|
|
1093
|
+
else if (stepId === 'workflows') decisions.workflows = answer ? 'all' : 'none';
|
|
1094
|
+
else if (stepId === 'worker-setup') decisions.worker_setup = answer;
|
|
1095
|
+
else if (stepId === 'worker-key') decisions.worker_key_provided = answer;
|
|
481
1096
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
1097
|
+
}
|
|
1098
|
+
if (decisions.worker_setup === undefined) decisions.worker_setup = true;
|
|
1099
|
+
|
|
1100
|
+
// doctor --new-key: the current key was rejected — ask for the new one.
|
|
1101
|
+
let replaceWorkerKey = false;
|
|
1102
|
+
if (flags['new-key']) {
|
|
1103
|
+
const value = await needPrompt().secret('Paste the NEW Worker Key from Animastor → Settings → Workers (hidden input)');
|
|
1104
|
+
if (value) {
|
|
1105
|
+
secrets.ANIMASTOR_WORKER_TOKEN = value;
|
|
1106
|
+
logger.registerSecret(value);
|
|
1107
|
+
replaceWorkerKey = true;
|
|
486
1108
|
}
|
|
487
|
-
if (stepId === 'comfyui-update') decisions.comfyui_update = answer ? 'yes' : 'no';
|
|
488
|
-
else if (stepId === 'custom-nodes') decisions.install_custom_nodes = answer;
|
|
489
|
-
else if (stepId === 'models') decisions.install_models = answer;
|
|
490
|
-
else if (stepId === 'workflows') decisions.workflows = answer ? 'all' : 'none';
|
|
491
|
-
else if (stepId === 'worker-setup') decisions.worker_setup = answer;
|
|
492
|
-
else if (stepId === 'worker-key') decisions.worker_key_provided = answer;
|
|
493
1109
|
}
|
|
494
|
-
prompt.close();
|
|
495
1110
|
|
|
496
1111
|
// Re-resolve and rebuild the plan with the recorded decisions — one
|
|
497
1112
|
// call shape, so the rebuilt plan always has a resolution report.
|
|
498
1113
|
const { plan: plan2 } = resolveAndPlan({ manifests: loadedManifests, env, mode, decisions });
|
|
499
|
-
|
|
500
1114
|
if (plan2.awaiting_decisions.length > 0) {
|
|
501
|
-
console.error(
|
|
1115
|
+
console.error(`\nStill awaiting decisions after prompts (${plan2.awaiting_decisions.join(', ')}) — cannot proceed`);
|
|
502
1116
|
process.exit(1);
|
|
503
1117
|
}
|
|
504
1118
|
if (plan2.blocked.length > 0) {
|
|
505
|
-
|
|
506
|
-
process.
|
|
1119
|
+
printFinal({ blocked: plan2.blocked, tool: toolCommand(flags), mode });
|
|
1120
|
+
process.exitCode = 1;
|
|
1121
|
+
return;
|
|
507
1122
|
}
|
|
508
1123
|
|
|
509
1124
|
const result = await runInstallation({
|
|
510
1125
|
manifests: loadedManifests, mode, io,
|
|
511
1126
|
roots: { comfyuiRoot: root, workerDir, statePath, repoRoot, hubUrl, toolsDir: resolveToolsDir(flags) },
|
|
512
1127
|
decisions, secretProvider: makeSecretProvider(secrets),
|
|
513
|
-
logger, crypto, env, dryRun,
|
|
1128
|
+
logger, crypto, env, dryRun,
|
|
1129
|
+
options: {
|
|
1130
|
+
...installOptions(flags, { doctor }), term: screen,
|
|
1131
|
+
runningComfy: mode !== 'managed' ? runningComfy : null,
|
|
1132
|
+
hubUrlExplicit: !!flags['hub-url'],
|
|
1133
|
+
nodeBinary: nodePick,
|
|
1134
|
+
replaceWorkerKey,
|
|
1135
|
+
comfyOwner: instance,
|
|
1136
|
+
comfyWaitMs,
|
|
1137
|
+
nodeClassesDeadline,
|
|
1138
|
+
restartPlatformComfy: restartPlatformComfyDecision(flags, priorState, { boot }).source === 'flag'
|
|
1139
|
+
? !!flags['restart-platform-comfy']
|
|
1140
|
+
: (depsGate && depsGate.record.restartPlatformComfy !== undefined ? depsGate.record.restartPlatformComfy : undefined),
|
|
1141
|
+
hubVersion,
|
|
1142
|
+
},
|
|
514
1143
|
});
|
|
515
|
-
printResult(result);
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
decisions.install_custom_nodes = true;
|
|
522
|
-
decisions.install_models = true;
|
|
523
|
-
decisions.workflows = 'all';
|
|
524
|
-
decisions.worker_setup = true;
|
|
525
|
-
decisions.worker_key_provided = true;
|
|
526
|
-
if (flags['accept-reference-runtime']) decisions.accept_reference_runtime = true;
|
|
527
|
-
if (flags['accept-runtime-change']) decisions.accept_runtime_change = true;
|
|
1144
|
+
printResult(result, { flags, mode, boot, hubVersion });
|
|
1145
|
+
} catch (err) {
|
|
1146
|
+
if (err instanceof NoTerminalError) {
|
|
1147
|
+
console.error('');
|
|
1148
|
+
console.error(err.message);
|
|
1149
|
+
process.exit(3);
|
|
528
1150
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
const result = await runInstallation({
|
|
533
|
-
manifests: loadedManifests, mode, io,
|
|
534
|
-
roots: { comfyuiRoot: root, workerDir, statePath, repoRoot, hubUrl, toolsDir: resolveToolsDir(flags) },
|
|
535
|
-
decisions, logger, crypto, env, dryRun, options: { ...installOptions(flags), term: screen },
|
|
536
|
-
});
|
|
537
|
-
printResult(result);
|
|
1151
|
+
throw err;
|
|
1152
|
+
} finally {
|
|
1153
|
+
prompt.close();
|
|
538
1154
|
}
|
|
539
1155
|
}
|
|
540
1156
|
|
|
541
|
-
function installOptions(flags) {
|
|
1157
|
+
function installOptions(flags, { doctor = false } = {}) {
|
|
542
1158
|
return {
|
|
543
1159
|
// Managed mode starts services by default (engine); these flags only
|
|
544
1160
|
// carry an explicit ON (--start-comfy) or OFF (--no-start-comfy).
|
|
@@ -548,8 +1164,11 @@ function installOptions(flags) {
|
|
|
548
1164
|
// --start-worker: launch the installed worker (node worker.cjs) as a
|
|
549
1165
|
// detached daemon after the bundle+.env steps and check it is alive
|
|
550
1166
|
// during verification. Without it the worker stays stopped (the
|
|
551
|
-
// installer never starts background services unprompted)
|
|
552
|
-
|
|
1167
|
+
// installer never starts background services unprompted) — EXCEPT in
|
|
1168
|
+
// `doctor`, whose job after a node reboot is to bring the worker back.
|
|
1169
|
+
startWorker: flags['start-worker'] === true ? true
|
|
1170
|
+
: flags['no-start-worker'] === true ? false
|
|
1171
|
+
: (doctor ? true : undefined),
|
|
553
1172
|
};
|
|
554
1173
|
}
|
|
555
1174
|
|
|
@@ -585,11 +1204,13 @@ async function cmdResume(flags) {
|
|
|
585
1204
|
// Resume/state semantics after a UID change: an installation created by
|
|
586
1205
|
// another user must never be continued under the current one (that is
|
|
587
1206
|
// how root-owned files end up inside a user's home).
|
|
588
|
-
runHostGates(io, {
|
|
1207
|
+
await runHostGates(io, {
|
|
589
1208
|
paths: [root, statePath, workerDir, resolveToolsDir(flags)].filter(Boolean),
|
|
590
1209
|
dryRun: false,
|
|
591
|
-
deep: true,
|
|
592
1210
|
venvDir: path.join(root, 'venv'),
|
|
1211
|
+
needVenv: true,
|
|
1212
|
+
prompt: createPrompt(),
|
|
1213
|
+
yes: !!flags.yes,
|
|
593
1214
|
stateUid: st.owner_uid != null ? st.owner_uid : null,
|
|
594
1215
|
});
|
|
595
1216
|
|
|
@@ -768,26 +1389,85 @@ async function cmdVerify(flags) {
|
|
|
768
1389
|
console.log(ver.text);
|
|
769
1390
|
}
|
|
770
1391
|
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
1392
|
+
/**
|
|
1393
|
+
* Final block of an install/doctor run: warnings, then ONE result section —
|
|
1394
|
+
* either every check ✓ and "Done", or one line of cause + one exact fix
|
|
1395
|
+
* command per ✗ (no "scroll up").
|
|
1396
|
+
*/
|
|
1397
|
+
/** Blocked steps + host remediation as summary items (shared by both outputs). */
|
|
1398
|
+
function resultExtras(result, tool) {
|
|
1399
|
+
const extra = [];
|
|
1400
|
+
for (const b of result.blocked || []) {
|
|
1401
|
+
let fix = result.remediation && result.remediation.command ? `${result.remediation.command} && ${tool} doctor` : `${tool} doctor`;
|
|
1402
|
+
if (/accept_runtime_change/.test(b.reason || '')) fix = `if ComfyUI already works, this can be ignored; to let the installer replace the runtime run: ${tool} doctor --accept-runtime-change`;
|
|
1403
|
+
else if (/accept_reference_runtime/.test(b.reason || '')) fix = `${tool} doctor --accept-reference-runtime`;
|
|
1404
|
+
extra.push({ ok: false, label: `Step "${b.step}"`, detail: b.reason, fix });
|
|
1405
|
+
}
|
|
1406
|
+
if (result.remediation && (result.blocked || []).length === 0) {
|
|
1407
|
+
extra.push({
|
|
1408
|
+
ok: false,
|
|
1409
|
+
label: 'Host prerequisite',
|
|
1410
|
+
detail: `${result.remediation.summary || result.remediation.code}${result.remediation.package ? ` (package ${result.remediation.package})` : ''}`,
|
|
1411
|
+
fix: result.remediation.command ? `${result.remediation.command} && ${tool} doctor` : `${tool} doctor`,
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1414
|
+
return extra;
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
/**
|
|
1418
|
+
* Boot script output: EXACTLY one line plus the exit code — a node that
|
|
1419
|
+
* reboots must not need a human to read a 200-line plan, and the one line
|
|
1420
|
+
* must say whether the worker is back. `--yes` means zero questions.
|
|
1421
|
+
*/
|
|
1422
|
+
function printOneLineSummary(result, { flags = {}, mode = null } = {}) {
|
|
1423
|
+
const tool = toolCommandPath(flags);
|
|
1424
|
+
const summary = renderFinalSummary({
|
|
1425
|
+
verification: result.verification, e2e: result.e2e || [],
|
|
1426
|
+
extra: resultExtras(result, tool), tool, mode: mode || result.mode,
|
|
1427
|
+
});
|
|
1428
|
+
const owner = result.results && result.results.comfy_owner;
|
|
1429
|
+
const worker = ((result.results && result.results.worker) || []).find((w) => w.id === 'worker-process');
|
|
1430
|
+
const what = [
|
|
1431
|
+
`mode ${mode || result.mode}`,
|
|
1432
|
+
owner && owner.url ? `ComfyUI ${owner.url}` : 'ComfyUI not reachable',
|
|
1433
|
+
worker && worker.started ? `worker pid ${worker.pid}` : 'worker not started',
|
|
1434
|
+
].join(', ');
|
|
1435
|
+
const head = summary.ok ? 'OK' : `FAILED — ${summary.failures.length} problem(s)`;
|
|
1436
|
+
console.log(`animastor doctor: ${head} — ${what} (${tool})`);
|
|
1437
|
+
if (!summary.ok) {
|
|
1438
|
+
for (const f of summary.failures) console.log(` ✗ ${f.label}: ${f.detail || ''}${f.fix ? ` — fix: ${f.fix}` : ''}`);
|
|
1439
|
+
process.exitCode = 1;
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
function printResult(result, { flags = {}, mode = null, boot = false } = {}) {
|
|
1444
|
+
if (boot) {
|
|
1445
|
+
printOneLineSummary(result, { flags, mode });
|
|
1446
|
+
return;
|
|
776
1447
|
}
|
|
777
1448
|
if (result.warnings.length > 0) {
|
|
778
1449
|
console.log('\nWarnings:');
|
|
779
1450
|
for (const w of result.warnings) console.log(` ! ${w}`);
|
|
780
1451
|
}
|
|
1452
|
+
const tool = (result.results && result.results.management_tools && result.results.management_tools.command) || toolCommand(flags);
|
|
1453
|
+
const extra = resultExtras(result, tool);
|
|
1454
|
+
const summary = renderFinalSummary({ verification: result.verification, e2e: result.e2e || [], extra, tool, mode: mode || result.mode });
|
|
1455
|
+
console.log(summary.text);
|
|
1456
|
+
// The full path is printed even when ~/.local/bin is already in PATH:
|
|
1457
|
+
// after a node reboot the PATH block is gone, and a copy-pasted relative
|
|
1458
|
+
// `animastor` must not be the only way to run the command.
|
|
1459
|
+
console.log(`\nAnimastor command: ${toolCommandPath(flags)}`);
|
|
1460
|
+
// The node startup script is this ONE line on both node types (0.2.4).
|
|
1461
|
+
console.log(`Node startup script (one line): ${startupScriptLine(flags)}`);
|
|
781
1462
|
// A failed/blocked installation must be visible in the exit code so
|
|
782
1463
|
// scripts (and the E2E smoke test) can react.
|
|
783
|
-
if (result.status === 'failed' || result.status === 'blocked') process.exitCode = 1;
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
}
|
|
1464
|
+
if (!summary.ok || result.status === 'failed' || result.status === 'blocked') process.exitCode = 1;
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
/** Result block for a plan that is blocked before anything ran. */
|
|
1468
|
+
function printFinal({ blocked = [], tool = 'animastor', mode = null }) {
|
|
1469
|
+
const extra = blocked.map((b) => ({ ok: false, label: `Step "${b.step || b.id || 'plan'}"`, detail: b.reason, fix: `${tool} doctor` }));
|
|
1470
|
+
console.log(renderFinalSummary({ extra, tool, mode }).text);
|
|
791
1471
|
}
|
|
792
1472
|
|
|
793
1473
|
/**
|
|
@@ -991,6 +1671,120 @@ async function cmdRebootComfyUI(flags) {
|
|
|
991
1671
|
}
|
|
992
1672
|
}
|
|
993
1673
|
|
|
1674
|
+
// ---------------------------------------------------------------------------
|
|
1675
|
+
// animastor start | stop | logs | doctor
|
|
1676
|
+
// ---------------------------------------------------------------------------
|
|
1677
|
+
|
|
1678
|
+
/** True when this installation owns its ComfyUI (managed mode). */
|
|
1679
|
+
function ownsComfyUI(targets) {
|
|
1680
|
+
const st = targets.state;
|
|
1681
|
+
return !!(st && ((st.components && st.components.comfyui && st.components.comfyui.owned) || st.mode === 'managed'));
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
/**
|
|
1685
|
+
* animastor start — bring the installation up and PROVE it: the managed
|
|
1686
|
+
* ComfyUI (never the user's own), then the worker; READY only after the
|
|
1687
|
+
* worker logged "ComfyUI ready" and the hub confirmed the heartbeat.
|
|
1688
|
+
*/
|
|
1689
|
+
async function cmdStart(flags) {
|
|
1690
|
+
const io = createRealIo();
|
|
1691
|
+
const targets = managementTargetsOrExit(io, flags, 'Animastor start');
|
|
1692
|
+
if (!targets) return;
|
|
1693
|
+
if (!guardManagementAccess(io, targets)) return;
|
|
1694
|
+
const screen = createScreen();
|
|
1695
|
+
// PATH is re-applied on EVERY start: E2E nodes reset ~/.bashrc and
|
|
1696
|
+
// ~/.profile on boot while ~/.local/bin/animastor survives.
|
|
1697
|
+
const pathEntry = management.restoreCommandPath(io, { linkDir: management.defaultLinkDir(), home: homeDir() });
|
|
1698
|
+
if (pathEntry.updated.length > 0) screen.print(`PATH block restored: ${pathEntry.updated.join(', ')}`);
|
|
1699
|
+
const envVals = workerMod.readEnvValues(io, targets.workerDir);
|
|
1700
|
+
// ComfyUI: mode and address come from the MACHINE (comfy-owner), not from
|
|
1701
|
+
// the remembered .env — the platform's port/prefix change between boots.
|
|
1702
|
+
const instance = await comfyOwner.resolveComfyOwner(io, { state: targets.state, root: targets.comfyuiRoot });
|
|
1703
|
+
const managed = instance.mode === 'managed';
|
|
1704
|
+
const port = instance.port || targets.port || Number(envVals.COMFY_PORT) || 8188;
|
|
1705
|
+
let comfyUrl = instance.url || envVals.COMFY_URL || `http://127.0.0.1:${port}`;
|
|
1706
|
+
let stats = instance.present ? await comfyuiMod.systemStats(io, comfyUrl) : null;
|
|
1707
|
+
if (!stats && managed && targets.comfyuiRoot && io.fs.existsSync(targets.comfyuiRoot)) {
|
|
1708
|
+
await screen.withBusy('Starting ComfyUI', async () => {
|
|
1709
|
+
comfyuiMod.startComfyUI(io, { root: targets.comfyuiRoot, port, device: targets.device });
|
|
1710
|
+
const up = await comfyuiMod.waitForApi(io, `http://127.0.0.1:${port}`, { timeoutMs: flags['verify-timeout-ms'] ? Number(flags['verify-timeout-ms']) : 120000 });
|
|
1711
|
+
if (up.ok) comfyUrl = `http://127.0.0.1:${port}`;
|
|
1712
|
+
});
|
|
1713
|
+
stats = await comfyuiMod.systemStats(io, comfyUrl);
|
|
1714
|
+
}
|
|
1715
|
+
if (!stats && instance.owner === 'foreign') {
|
|
1716
|
+
screen.print(`! the platform's ComfyUI (pid ${instance.pid}) does not answer at ${comfyUrl} yet`);
|
|
1717
|
+
}
|
|
1718
|
+
// Autostart entry kept in sync with the current command (old script → .bak).
|
|
1719
|
+
const wrap = management.ensureStartWorkerWrapper(io, { workerDir: targets.workerDir, animastorPath: toolCommandPath(flags) });
|
|
1720
|
+
if (wrap.status === 'replaced' || wrap.status === 'created') {
|
|
1721
|
+
screen.print(`autostart: ${wrap.path} → animastor start${wrap.backup ? ` (old script: ${wrap.backup})` : ''}`);
|
|
1722
|
+
}
|
|
1723
|
+
let start = null;
|
|
1724
|
+
let ready = null;
|
|
1725
|
+
if (stats) {
|
|
1726
|
+
start = workerMod.startWorker(io, { workerDir: targets.workerDir });
|
|
1727
|
+
if (start.started && start.alive) {
|
|
1728
|
+
if (start.already_running) screen.print(`worker already running (pid ${start.pid})`);
|
|
1729
|
+
ready = await screen.withBusy('Waiting for the worker (ComfyUI ready → hub heartbeat)', () => workerMod.waitForWorkerReady(io, {
|
|
1730
|
+
workerDir: targets.workerDir, pid: start.pid, logFile: start.logFile, logOffset: start.logOffset || 0,
|
|
1731
|
+
}));
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
const checks = await engineMod.endToEndChecks(io, {
|
|
1735
|
+
mode: managed ? 'managed' : 'existing', comfyUrl: stats ? comfyUrl : null, comfyPort: port,
|
|
1736
|
+
hubUrl: envVals.HUB_URL || resolveHubUrl(flags), workerWanted: !!stats, workerStart: start, workerReady: ready,
|
|
1737
|
+
tool: toolCommand(flags),
|
|
1738
|
+
});
|
|
1739
|
+
const summary = renderFinalSummary({ e2e: checks, tool: toolCommand(flags), mode: managed ? 'managed' : 'existing' });
|
|
1740
|
+
for (const line of summary.text.split('\n')) screen.print(line);
|
|
1741
|
+
screen.print(`\nAnimastor command: ${toolCommandPath(flags)}`);
|
|
1742
|
+
process.exitCode = summary.ok ? 0 : 1;
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
/** animastor stop — stop this installation's worker (and its managed ComfyUI; never the user's own). */
|
|
1746
|
+
async function cmdStop(flags) {
|
|
1747
|
+
const io = createRealIo();
|
|
1748
|
+
const targets = managementTargetsOrExit(io, flags, 'Animastor stop');
|
|
1749
|
+
if (!targets) return;
|
|
1750
|
+
if (!guardManagementAccess(io, targets)) return;
|
|
1751
|
+
const w = await workerMod.stopManagedWorker(io, { workerDir: targets.workerDir });
|
|
1752
|
+
console.log(w.stopped ? `✓ worker stopped (pid ${w.pid})` : `· worker: ${w.reason}`);
|
|
1753
|
+
if (ownsComfyUI(targets) && targets.comfyuiRoot) {
|
|
1754
|
+
const pids = comfyuiMod.findManagedComfyUIPids(io, { root: targets.comfyuiRoot });
|
|
1755
|
+
for (const pid of pids) {
|
|
1756
|
+
try { process.kill(pid, 'SIGTERM'); console.log(`✓ ComfyUI stopped (pid ${pid})`); } catch (_) { /* gone */ }
|
|
1757
|
+
}
|
|
1758
|
+
if (pids.length === 0) console.log('· ComfyUI: not running');
|
|
1759
|
+
} else {
|
|
1760
|
+
console.log('· ComfyUI: not managed by Animastor — left running');
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
/** animastor logs [-f] [--lines N] — the worker log of this installation. */
|
|
1765
|
+
async function cmdLogs(flags) {
|
|
1766
|
+
const io = createRealIo();
|
|
1767
|
+
const targets = managementTargetsOrExit(io, flags, 'Animastor logs');
|
|
1768
|
+
if (!targets) return;
|
|
1769
|
+
const file = workerMod.workerLogPath(targets.workerDir);
|
|
1770
|
+
if (!fs.existsSync(file)) {
|
|
1771
|
+
console.log(`no worker log yet (${file}) — start the worker: ${toolCommand(flags)} start`);
|
|
1772
|
+
process.exitCode = 1;
|
|
1773
|
+
return;
|
|
1774
|
+
}
|
|
1775
|
+
const n = String(Number(flags.lines) > 0 ? Number(flags.lines) : 100);
|
|
1776
|
+
console.error(`==> ${file}`);
|
|
1777
|
+
const { spawn } = require('child_process');
|
|
1778
|
+
await new Promise((resolve) => {
|
|
1779
|
+
const child = spawn('tail', flags.follow ? ['-n', n, '-F', file] : ['-n', n, file], { stdio: 'inherit' });
|
|
1780
|
+
child.on('close', (code) => { process.exitCode = code || 0; resolve(); });
|
|
1781
|
+
});
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
async function cmdDoctor(flags) {
|
|
1785
|
+
return cmdInstall(flags, { doctor: true });
|
|
1786
|
+
}
|
|
1787
|
+
|
|
994
1788
|
// ---------------------------------------------------------------------------
|
|
995
1789
|
// Main
|
|
996
1790
|
// ---------------------------------------------------------------------------
|
|
@@ -998,9 +1792,27 @@ async function cmdRebootComfyUI(flags) {
|
|
|
998
1792
|
async function main() {
|
|
999
1793
|
const args = parseArgs(process.argv);
|
|
1000
1794
|
const pkg = require('../../package.json');
|
|
1001
|
-
|
|
1795
|
+
// install/doctor print the full banner; the everyday tool commands stay quiet.
|
|
1796
|
+
if (!['install', 'doctor', 'start', 'stop', 'logs', 'status', 'boot'].includes(args.command)) {
|
|
1797
|
+
console.log(`animastor-installer v${pkg.version} (platform: ${PLATFORM_RUNTIME.platform}, deployment: ${PLATFORM_RUNTIME.deployment})`);
|
|
1798
|
+
}
|
|
1002
1799
|
printPlatformNotices();
|
|
1003
1800
|
switch (args.command) {
|
|
1801
|
+
case 'start':
|
|
1802
|
+
await cmdStart(args.flags);
|
|
1803
|
+
break;
|
|
1804
|
+
case 'stop':
|
|
1805
|
+
await cmdStop(args.flags);
|
|
1806
|
+
break;
|
|
1807
|
+
case 'logs':
|
|
1808
|
+
await cmdLogs(args.flags);
|
|
1809
|
+
break;
|
|
1810
|
+
case 'doctor':
|
|
1811
|
+
await cmdDoctor(args.flags);
|
|
1812
|
+
break;
|
|
1813
|
+
case 'boot':
|
|
1814
|
+
cmdBoot(args.flags);
|
|
1815
|
+
break;
|
|
1004
1816
|
case 'detect':
|
|
1005
1817
|
await cmdDetect(args.flags);
|
|
1006
1818
|
break;
|
|
@@ -1035,7 +1847,7 @@ async function main() {
|
|
|
1035
1847
|
await cmdRebootComfyUI(args.flags);
|
|
1036
1848
|
break;
|
|
1037
1849
|
default:
|
|
1038
|
-
console.error('Usage: animastor-installer <detect|plan|install|verify|validate|resume|uninstall|status|monitor|reboot-worker|reboot-comfyui> [options]');
|
|
1850
|
+
console.error('Usage: animastor-installer <detect|plan|install|verify|validate|resume|uninstall|start|stop|status|logs|doctor|boot|monitor|reboot-worker|reboot-comfyui> [options]');
|
|
1039
1851
|
console.error(' --profile P[,P2] Generation profile id');
|
|
1040
1852
|
console.error(' --mode MODE managed | existing | shared');
|
|
1041
1853
|
console.error(' --root PATH ComfyUI root (default: ~/ComfyUI)');
|
|
@@ -1046,8 +1858,11 @@ async function main() {
|
|
|
1046
1858
|
console.error(' managed mode starts ComfyUI + worker automatically and picks');
|
|
1047
1859
|
console.error(' a free port when 8188 is taken; opt out:');
|
|
1048
1860
|
console.error(' --no-start-comfy --no-start-worker --comfy-port N');
|
|
1049
|
-
console.error(' management
|
|
1050
|
-
console.error(' status |
|
|
1861
|
+
console.error(' management (the `animastor` command in PATH):');
|
|
1862
|
+
console.error(' animastor start | stop | status | logs [-f] | doctor [--new-key] | boot');
|
|
1863
|
+
console.error(' boot: node startup script — detaches `doctor --yes` (log ~/animastor/logs/bootstrap.log), exits 0');
|
|
1864
|
+
console.error(' --restart-platform-comfy / --no-restart-platform-comfy restart the platform ComfyUI after node deps');
|
|
1865
|
+
console.error(' (also: monitor | reboot-worker | reboot-comfyui)');
|
|
1051
1866
|
console.error(' (--state/--root/--worker-dir/--port override discovery)');
|
|
1052
1867
|
console.error(' installer flags: --install-tools / --no-tools / --tools-dir PATH');
|
|
1053
1868
|
console.error(' uninstall flags:');
|
|
@@ -1064,4 +1879,14 @@ if (require.main === module) {
|
|
|
1064
1879
|
});
|
|
1065
1880
|
}
|
|
1066
1881
|
|
|
1067
|
-
module.exports = {
|
|
1882
|
+
module.exports = {
|
|
1883
|
+
stepQuestion, parseArgs, cmdDetect, cmdPlan, cmdInstall, cmdStart, cmdStop, cmdLogs, cmdDoctor,
|
|
1884
|
+
printResult, printOneLineSummary, resultExtras, cmdVerify, cmdValidateManifests, cmdResume,
|
|
1885
|
+
cmdUninstall, cmdStatus, cmdMonitor, cmdRebootWorker, cmdRebootComfyUI, resolveAndPlan,
|
|
1886
|
+
makeSecretProvider, resolveToolsDecision, resolveToolsDir, installOptions, runHostGates,
|
|
1887
|
+
PLATFORM_RUNTIME, printPlatformNotices, homeDir,
|
|
1888
|
+
toolCommand, toolCommandPath, detectHubVersion, priorReusableDecisions, isBootRun,
|
|
1889
|
+
missingRequiredHostPackages, shouldWaitForPlatformComfy, platformComfyGate, platformComfyMissingResult,
|
|
1890
|
+
restartPlatformComfyDecision, platformNodeDepsGate, nodeDepsFailedResult, recordInstallerOption,
|
|
1891
|
+
cmdBoot, bootChildArgs, bootLogPath, startupScriptLine,
|
|
1892
|
+
};
|