@animastor/installer 0.2.13 → 0.2.15
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 +23 -1
- package/ai/install-manifests/audio/qwen-tts.json +7 -5
- package/package.json +1 -1
- package/src/installer/cli.js +51 -9
- package/src/installer/compatibility-resolver.js +22 -1
- package/src/installer/engine/downloader.js +23 -0
- package/src/installer/engine/engine.js +59 -4
- package/src/installer/engine/logger.js +7 -0
- package/src/installer/engine/nodes.js +124 -30
- package/src/installer/engine/probe.js +60 -7
- package/src/installer/install-plan.js +5 -0
- package/src/installer/setup-contract.js +1 -0
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ published to npm as `@animastor/installer`.
|
|
|
14
14
|
|
|
15
15
|
```
|
|
16
16
|
packages/animastor-installer/
|
|
17
|
-
├── package.json @animastor/installer 0.2.
|
|
17
|
+
├── package.json @animastor/installer 0.2.15, Node >=20, zero runtime deps
|
|
18
18
|
├── src/installer/
|
|
19
19
|
│ ├── cli.js CLI entry (detect/plan/install/verify/resume/uninstall)
|
|
20
20
|
│ ├── index.js Public API entry (10 exports, incl. setupContract)
|
|
@@ -213,6 +213,28 @@ recomputed on every run because the platform's port and notebook prefix change
|
|
|
213
213
|
between boots. Answers already given (a declined optional workflow, a declined
|
|
214
214
|
model download) are remembered and not asked again, also under `--yes`.
|
|
215
215
|
|
|
216
|
+
Model check and download log (0.2.14): besides the standard ComfyUI folders the
|
|
217
|
+
check scans the top folder (`models/<folder>`) of every `target_dir` in the
|
|
218
|
+
loaded manifests, plus `extra_model_paths.yaml` — a file the installer
|
|
219
|
+
downloads is always visible to the check. Present files up to 1 GiB that match
|
|
220
|
+
the manifest size are compared by sha256, larger ones by size. Every model file
|
|
221
|
+
is logged with name, size and outcome (`downloaded`, `present, verified sha256
|
|
222
|
+
— skipped`, `failed: <reason>`). `install`, `doctor` and `resume` append their
|
|
223
|
+
log to `~/animastor/logs/bootstrap.log`, not only `animastor boot`.
|
|
224
|
+
|
|
225
|
+
Custom node updates (0.2.15): a node the installer itself copied from a
|
|
226
|
+
repository subdirectory (marker `.animastor-source.json`, e.g.
|
|
227
|
+
`animastor-voice-ref`) whose commit differs from the manifest pin is updated
|
|
228
|
+
automatically, also in mode `existing` — no question: the pinned copy is staged
|
|
229
|
+
in `<ComfyUI>/.animastor-node-sources/<dir>.new`, the old copy moves to
|
|
230
|
+
`<dir>.prev` (backup of the last update), a failed swap puts the old copy back.
|
|
231
|
+
The plan lists it under Actions (`Update <node>: <old> → <new>`). ComfyUI loads
|
|
232
|
+
the new code only on a restart: a managed ComfyUI is restarted; the platform's
|
|
233
|
+
ComfyUI is restarted when that restart is allowed (`--restart-platform-comfy`
|
|
234
|
+
or the recorded answer), otherwise the result says the old code still runs. A
|
|
235
|
+
git checkout (a user's or third-party node) at another commit stays a review
|
|
236
|
+
item and is never replaced.
|
|
237
|
+
|
|
216
238
|
## Manifest resolution (MANIFEST_ROOT contract)
|
|
217
239
|
|
|
218
240
|
1. `/app/artifacts/install-manifests` (baked container layout)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest_version": "1.0.0",
|
|
3
|
-
"revision": "2026.
|
|
3
|
+
"revision": "2026.12.05-r1",
|
|
4
4
|
"status": "ready",
|
|
5
5
|
"profile": {
|
|
6
6
|
"id": "audio/qwen-tts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"gpu_min_vram_gb": 8,
|
|
31
31
|
"basis": "minimum_supported",
|
|
32
32
|
"reference_gpu": "NVIDIA L40S (46068 MiB)",
|
|
33
|
-
"derivation": "Estimate, not a measured floor (VOICE_REFERENCES.md): every workflow now loads ONE 1.7B repo — narrator/dialogue the Base model only (voice clone from a locked reference), voice-reference the VoiceDesign model only (3.57 GiB weights + 0.65 GiB speech tokenizer ≈ 4.2 GiB)
|
|
33
|
+
"derivation": "Estimate, not a measured floor (VOICE_REFERENCES.md): every workflow now loads ONE 1.7B repo — narrator/dialogue the Base model only (voice clone from a locked reference), voice-reference the VoiceDesign model only (3.57 GiB weights + 0.65 GiB speech tokenizer ≈ 4.2 GiB) and activations; faster-whisper small runs on the CPU since node 1.1.0 (no VRAM); 8 GB leaves headroom. Was 12 GB while the dialogue workflow loaded VoiceDesign + Base together. Known to run on L40S 46 GB; installed on Tesla V100 (E2E, 2026-10-30). Lower it only after a measured run on a smaller card."
|
|
34
34
|
},
|
|
35
35
|
"runtime_requirements": {
|
|
36
36
|
"comfyui": {
|
|
@@ -263,7 +263,7 @@
|
|
|
263
263
|
"source": {
|
|
264
264
|
"kind": "github",
|
|
265
265
|
"repository": "https://github.com/Animastor/animastor-worker",
|
|
266
|
-
"commit": "
|
|
266
|
+
"commit": "3e8faab16ca8168065e6b85e17ad49f7fdaf2638",
|
|
267
267
|
"subdirectory": "comfyui-nodes/animastor-voice-ref",
|
|
268
268
|
"verification": "confirmed"
|
|
269
269
|
}
|
|
@@ -284,7 +284,8 @@
|
|
|
284
284
|
},
|
|
285
285
|
"notes": [
|
|
286
286
|
"Needs the ffmpeg binary on PATH (normalisation to WAV pcm_s16le mono 24 kHz).",
|
|
287
|
-
"faster-whisper
|
|
287
|
+
"Node 1.1.0 (animastor-worker 3e8faab): faster-whisper runs on the CPU (int8) by default — the CUDA path of ctranslate2 4.6.0 crashed the whole ComfyUI natively on a Tesla V100 (sm_70, 05.12.2026); CPU int8: 11 s of audio in ~2 s. GPU only via ANIMASTOR_WHISPER_DEVICE=cuda|auto in the ComfyUI environment. The candidate metadata records whisper_device / compute_type.",
|
|
288
|
+
"An installed copy at an older commit (marker .animastor-source.json) is updated to this pin by installer >= 0.2.15 automatically (old copy kept in .animastor-node-sources/animastor-voice-ref.prev); the platform's ComfyUI is restarted to load the new code when that restart is allowed.",
|
|
288
289
|
"Installed from a SUBDIRECTORY of the repository (install.source.subdirectory); the installer writes .animastor-source.json (repository + commit) into the node folder so the pinned version stays verifiable."
|
|
289
290
|
]
|
|
290
291
|
},
|
|
@@ -665,7 +666,8 @@
|
|
|
665
666
|
"Open question 8: ComfyUI-Manager inclusion (D7)",
|
|
666
667
|
"Open question 12: minimum VRAM is an estimate (12 GB, hardware.derivation) — measure on a smaller card",
|
|
667
668
|
"VOICE_REFERENCES: confirm LoadAudio (core) on the reference fork c4cfee7 via /object_info",
|
|
668
|
-
"VOICE_REFERENCES: ctranslate2 4.6.0 CUDA path on Tesla V100 (sm_70) —
|
|
669
|
+
"VOICE_REFERENCES: ctranslate2 4.6.0 CUDA path on Tesla V100 (sm_70) crashes ComfyUI natively (05.12.2026) — faster-whisper is on the CPU by default since node 1.1.0; the GPU path stays opt-in (ANIMASTOR_WHISPER_DEVICE)",
|
|
670
|
+
"Qwen3-TTS is loaded in bf16; a Tesla V100 (sm_70) has no native bf16 — evaluate fp16 on V100 (separate task)",
|
|
669
671
|
"VOICE_REFERENCES: qwen-tts pip version on the worker (`pip show qwen-tts`)"
|
|
670
672
|
]
|
|
671
673
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@animastor/installer",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.15",
|
|
4
4
|
"description": "Animastor Private GPU Worker installer — self-contained CLI and library for GPU worker setup, verification, and management.",
|
|
5
5
|
"main": "src/installer/index.js",
|
|
6
6
|
"exports": {
|
package/src/installer/cli.js
CHANGED
|
@@ -619,6 +619,7 @@ async function platformNodeDepsGate(io, {
|
|
|
619
619
|
instance, state = null, root, manifests, flags = {}, boot = false, yes = false, prompt = null,
|
|
620
620
|
waitMs = 600000, logger = null, statePath = null, sleep = null, intervalMs = 3000, progressMs = 30000,
|
|
621
621
|
workerDir = null, platformGraceMs = 30000, otherManifests = [], command = 'doctor',
|
|
622
|
+
codeChanged = [],
|
|
622
623
|
} = {}) {
|
|
623
624
|
const out = {
|
|
624
625
|
instance, checked: false, installed: [], restarted: false, pid_changed: false, failed: false, reason: null, record: {},
|
|
@@ -654,6 +655,7 @@ async function platformNodeDepsGate(io, {
|
|
|
654
655
|
out.checked = true;
|
|
655
656
|
for (const e of check.errors) warn(`custom-node dependency check: ${e}`);
|
|
656
657
|
let needRestart = !!(out.prestartup && (out.prestartup.status === 'created' || out.prestartup.status === 'updated'));
|
|
658
|
+
if (Array.isArray(codeChanged) && codeChanged.length > 0) needRestart = true; // 0.2.15: updated node code
|
|
657
659
|
let snapshotOf = null;
|
|
658
660
|
const dropSnap = () => { if (snapshotOf) overridesMod.dropSnapshot(io, snapshotOf); snapshotOf = null; };
|
|
659
661
|
if (check.nodes.length === 0) {
|
|
@@ -793,7 +795,10 @@ async function platformNodeDepsGate(io, {
|
|
|
793
795
|
const have = instance.url ? await comfyuiMod.objectInfoClasses(io, instance.url) : null;
|
|
794
796
|
if (!have && !needRestart) return out; // not answering — the platform gate/verification reports it
|
|
795
797
|
const missingNow = have ? expectClasses.filter((c) => !have.has(c)) : expectClasses;
|
|
796
|
-
|
|
798
|
+
// 0.2.15: an updated node keeps its classes, but the running process still
|
|
799
|
+
// has the OLD code — it is loaded only by a restart
|
|
800
|
+
const codeUpdated = Array.isArray(codeChanged) && codeChanged.length > 0;
|
|
801
|
+
if (missingNow.length === 0 && !codeUpdated) {
|
|
797
802
|
if (needRestart) info(`the running ComfyUI (pid ${instance.pid}) already has the node classes — no restart needed`);
|
|
798
803
|
return out;
|
|
799
804
|
}
|
|
@@ -813,19 +818,25 @@ async function platformNodeDepsGate(io, {
|
|
|
813
818
|
info(`node classes missing in the running ComfyUI (pid ${instance.pid}): ${missingNow.join(', ')} — ${diag.detail}`);
|
|
814
819
|
}
|
|
815
820
|
if (restartAllowed === null && interactive) {
|
|
816
|
-
|
|
821
|
+
const why = missingNow.length === 0
|
|
822
|
+
? `runs the old code of the updated custom node(s) ${codeChanged.join(', ')}`
|
|
823
|
+
: 'loaded the custom nodes before their dependencies were in place';
|
|
824
|
+
restartAllowed = await prompt.confirm(`The running ComfyUI (pid ${instance.pid}) ${why}. Restart it now (same command line, working directory and environment)?`, { defaultYes: true });
|
|
817
825
|
out.record.restartPlatformComfy = restartAllowed;
|
|
818
826
|
}
|
|
819
827
|
if (restartAllowed !== true) {
|
|
820
828
|
// A ComfyUI that is not ours is never stopped without the option.
|
|
821
829
|
out.failed = true;
|
|
822
|
-
out.reason =
|
|
830
|
+
out.reason = missingNow.length === 0
|
|
831
|
+
? `custom node(s) ${codeChanged.join(', ')} updated on disk, but the platform's ComfyUI (pid ${instance.pid}) still runs the old code and was not restarted (restart of the platform's ComfyUI is off)`
|
|
832
|
+
: `custom-node dependencies are in place, 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): ${missingNow.join(', ')} missing`;
|
|
823
833
|
out.fix = `restart the ComfyUI from the platform console, or run: ${tool} doctor --restart-platform-comfy`;
|
|
824
834
|
return out;
|
|
825
835
|
}
|
|
836
|
+
if (codeUpdated) info(`custom node(s) updated: ${codeChanged.join(', ')} — restarting the platform's ComfyUI (pid ${instance.pid}) so it loads the new code`);
|
|
826
837
|
const restartLog = workerDir ? path.join(path.dirname(path.resolve(workerDir)), 'logs', 'comfyui-restart.log') : null;
|
|
827
838
|
const rr = await nodeDeps.restartForeignComfyUI(io, {
|
|
828
|
-
pid: instance.pid, timeoutMs: waitMs, intervalMs, expectClasses: missingNow, sleep, log: logger, onProgress: info, progressMs,
|
|
839
|
+
pid: instance.pid, timeoutMs: waitMs, intervalMs, expectClasses: missingNow.length > 0 ? missingNow : expectClasses, sleep, log: logger, onProgress: info, progressMs,
|
|
829
840
|
platformGraceMs, logFile: restartLog,
|
|
830
841
|
});
|
|
831
842
|
out.restarted = rr.stopped;
|
|
@@ -945,6 +956,30 @@ function bootLogPath(flags) {
|
|
|
945
956
|
return flags['boot-log'] || path.join(path.dirname(resolveWorkerDir(flags)), 'logs', 'bootstrap.log');
|
|
946
957
|
}
|
|
947
958
|
|
|
959
|
+
/**
|
|
960
|
+
* Copy the log of an install/doctor/resume run to bootstrap.log (0.2.14) —
|
|
961
|
+
* before, only `animastor boot` wrote there and an interactive install left no
|
|
962
|
+
* trace. Not when stdout already IS that file (the boot run). Called after the
|
|
963
|
+
* ownership gates, so nothing is created as the wrong user. Never fatal.
|
|
964
|
+
*/
|
|
965
|
+
function teeToBootLog(logger, { io, flags, command, stdoutFd = 1 }) {
|
|
966
|
+
const logFile = bootLogPath(flags);
|
|
967
|
+
try {
|
|
968
|
+
const out = fs.fstatSync(stdoutFd);
|
|
969
|
+
const log = fs.statSync(logFile);
|
|
970
|
+
if (out.ino === log.ino && out.dev === log.dev) return false;
|
|
971
|
+
} catch (_) { /* no log file yet */ }
|
|
972
|
+
try {
|
|
973
|
+
io.fs.mkdirSync(path.dirname(logFile), { recursive: true });
|
|
974
|
+
io.fs.appendFileSync(logFile, `\n===== animastor ${command} ${new Date(io.now()).toISOString()} (installer ${ownVersion()}) =====\n`);
|
|
975
|
+
} catch (err) {
|
|
976
|
+
logger.warn(`${logFile} is not writable: ${err.message}`);
|
|
977
|
+
return false;
|
|
978
|
+
}
|
|
979
|
+
logger.teeTo((line) => { try { io.fs.appendFileSync(logFile, `${line}\n`); } catch (_) { /* the run goes on */ } });
|
|
980
|
+
return true;
|
|
981
|
+
}
|
|
982
|
+
|
|
948
983
|
/** System boot time from /proc/stat (btime) as ISO, or null. */
|
|
949
984
|
function systemBootTime(io) {
|
|
950
985
|
try {
|
|
@@ -1162,9 +1197,8 @@ async function cmdPlan(flags) {
|
|
|
1162
1197
|
const repoRoot = resolveRepoRoot(flags);
|
|
1163
1198
|
const io = createRealIo();
|
|
1164
1199
|
const crypto = require('crypto');
|
|
1165
|
-
const env = probeEnvironment(io, { root, workerDir, crypto, workerType: null });
|
|
1166
|
-
|
|
1167
1200
|
const loadedManifests = flags.profiles.map((p) => manifest.loadManifest(p));
|
|
1201
|
+
const env = await probeMod.hashProbedModels(io, probeEnvironment(io, { root, workerDir, crypto, workerType: null, manifests: loadedManifests }), loadedManifests);
|
|
1168
1202
|
const mode = flags.mode || (env.comfyui && env.comfyui.present ? 'existing' : 'managed');
|
|
1169
1203
|
const { plan } = resolveAndPlan({ manifests: loadedManifests, env, mode, decisions: {} });
|
|
1170
1204
|
console.log(plan.plan_text);
|
|
@@ -1357,7 +1391,9 @@ async function cmdInstall(flags, { doctor = false } = {}) {
|
|
|
1357
1391
|
const env = probeEnvironment(realIo, {
|
|
1358
1392
|
root, workerDir, crypto,
|
|
1359
1393
|
workerType: loadedManifests.length === 1 ? (loadedManifests[0].worker_bundle || {}).worker_type : null,
|
|
1394
|
+
manifests: loadedManifests,
|
|
1360
1395
|
});
|
|
1396
|
+
await probeMod.hashProbedModels(realIo, env, loadedManifests);
|
|
1361
1397
|
|
|
1362
1398
|
// The dry-run guard wraps everything handed to the engine so any
|
|
1363
1399
|
// accidental mutation throws "dry-run violation" instead of executing.
|
|
@@ -1575,6 +1611,7 @@ async function cmdInstall(flags, { doctor = false } = {}) {
|
|
|
1575
1611
|
return;
|
|
1576
1612
|
}
|
|
1577
1613
|
|
|
1614
|
+
teeToBootLog(logger, { io: realIo, flags, command: doctor ? 'doctor' : 'install' });
|
|
1578
1615
|
const result = await runInstallation({
|
|
1579
1616
|
manifests: loadedManifests, mode, io,
|
|
1580
1617
|
roots: { comfyuiRoot: root, workerDir, statePath, repoRoot, hubUrl, toolsDir: resolveToolsDir(flags) },
|
|
@@ -1591,8 +1628,9 @@ async function cmdInstall(flags, { doctor = false } = {}) {
|
|
|
1591
1628
|
? () => prompt.secret('The Worker Key is revoked or wrong. Paste a new Worker Key from Animastor → Settings → Workers (hidden input, Enter = skip)')
|
|
1592
1629
|
: null,
|
|
1593
1630
|
// 0.2.13: the node-deps gate again, for nodes installed by this run
|
|
1594
|
-
platformNodeDeps: async (current) => {
|
|
1631
|
+
platformNodeDeps: async (current, extra = {}) => {
|
|
1595
1632
|
const g = await platformNodeDepsGate(realIo, {
|
|
1633
|
+
codeChanged: extra.codeChanged || [],
|
|
1596
1634
|
instance: current, state: stateStore.loadState(realIo, statePath), root, manifests: loadedManifests, flags, boot, yes, prompt,
|
|
1597
1635
|
waitMs: Math.max(180000, comfyWaitMs), logger, statePath, workerDir,
|
|
1598
1636
|
otherManifests: otherProfileManifests(priorState, flags.profiles, { logger }), command: doctor ? 'doctor' : 'install',
|
|
@@ -1703,6 +1741,7 @@ async function cmdResume(flags) {
|
|
|
1703
1741
|
const env = probeEnvironment(io, {
|
|
1704
1742
|
root, workerDir, crypto,
|
|
1705
1743
|
workerType: loadedManifests.length === 1 ? (loadedManifests[0].worker_bundle || {}).worker_type : null,
|
|
1744
|
+
manifests: loadedManifests,
|
|
1706
1745
|
});
|
|
1707
1746
|
|
|
1708
1747
|
// restored non-secret decisions from state; CLI --yes can still widen them.
|
|
@@ -1717,6 +1756,7 @@ async function cmdResume(flags) {
|
|
|
1717
1756
|
flags, prompt: null, prior: priorToolsDecision(io, statePath),
|
|
1718
1757
|
});
|
|
1719
1758
|
|
|
1759
|
+
teeToBootLog(logger, { io, flags, command: 'resume' });
|
|
1720
1760
|
const result = await runInstallation({
|
|
1721
1761
|
manifests: loadedManifests, mode, io,
|
|
1722
1762
|
roots: { comfyuiRoot: root, workerDir, statePath, repoRoot, hubUrl, toolsDir: resolveToolsDir(flags) },
|
|
@@ -1857,7 +1897,9 @@ async function cmdVerify(flags) {
|
|
|
1857
1897
|
? flags.profiles.map((p) => manifest.loadManifest(p))
|
|
1858
1898
|
: [manifest.loadManifest('image/qwen-image')]; // default
|
|
1859
1899
|
|
|
1860
|
-
const env = probeEnvironment(io, {
|
|
1900
|
+
const env = await probeMod.hashProbedModels(io, probeEnvironment(io, {
|
|
1901
|
+
root, workerDir, crypto, workerType: loadedManifests[0].worker_bundle.worker_type, manifests: loadedManifests,
|
|
1902
|
+
}), loadedManifests);
|
|
1861
1903
|
const report = resolver.resolveInstallation({ manifests: loadedManifests, environment: env, mode: 'existing' });
|
|
1862
1904
|
const { buildVerificationReport } = require('./verification-report');
|
|
1863
1905
|
const ver = buildVerificationReport({ report, live: {} });
|
|
@@ -2397,7 +2439,7 @@ module.exports = {
|
|
|
2397
2439
|
toolCommand, toolCommandPath, detectHubVersion, priorReusableDecisions, applicableDecisions, isBootRun,
|
|
2398
2440
|
missingRequiredHostPackages, shouldWaitForPlatformComfy, platformComfyGate, platformComfyMissingResult,
|
|
2399
2441
|
restartPlatformComfyDecision, platformNodeDepsGate, nodeDepsFailedResult, recordInstallerOption,
|
|
2400
|
-
cmdBoot, bootChildArgs, bootLogPath, startupScriptLine,
|
|
2442
|
+
cmdBoot, bootChildArgs, bootLogPath, teeToBootLog, startupScriptLine,
|
|
2401
2443
|
preflightSelfUpdate, preflightExtras, installedToolsVersion, ownVersion,
|
|
2402
2444
|
nodeDepsOwnedServices, recordOwnedServices, otherProfileManifests, overridesStep,
|
|
2403
2445
|
};
|
|
@@ -56,7 +56,10 @@ const ENTRY_STATUSES = Object.freeze([
|
|
|
56
56
|
'required', 'installed', 'missing', 'incompatible', 'unused', 'unknown',
|
|
57
57
|
]);
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
// 'update' (0.2.15): an installer-copied custom node (subdirectory source with
|
|
60
|
+
// .animastor-source.json) whose commit differs from the manifest pin — replaced
|
|
61
|
+
// by the pinned copy automatically (never a user's git checkout).
|
|
62
|
+
const ACTIONS = Object.freeze(['install', 'skip', 'review', 'none', 'configure', 'update']);
|
|
60
63
|
|
|
61
64
|
const SHARING_VERDICTS = Object.freeze([
|
|
62
65
|
'shared-compatible', 'shared-conflict', 'requires-isolation', 'unknown',
|
|
@@ -464,6 +467,10 @@ function checkCustomNode(dep, env, profiles) {
|
|
|
464
467
|
if (shaMatch(wantCommit, haveCommit)) {
|
|
465
468
|
return { ...base, status: 'installed', grade: 'canonical-version', action: 'skip', found: describeNodeFound(found), notes };
|
|
466
469
|
}
|
|
470
|
+
if (isInstallerCopiedNode(dep, found)) {
|
|
471
|
+
notes.push(`installed by the Animastor installer at ${haveCommit}; the manifest pins ${wantCommit} — updated automatically (the copy is replaced, a backup is kept)`);
|
|
472
|
+
return { ...base, status: 'installed', grade: 'outdated', action: 'update', expected: wantCommit, found: describeNodeFound(found), notes };
|
|
473
|
+
}
|
|
467
474
|
notes.push(`installed commit ${haveCommit} differs from manifest pin ${wantCommit}; in 'existing' mode a git-safe checkout is SUGGESTED, never applied automatically`);
|
|
468
475
|
return { ...base, status: 'incompatible', reason: 'version_mismatch', action: 'review', expected: wantCommit, found: describeNodeFound(found), notes };
|
|
469
476
|
}
|
|
@@ -475,6 +482,18 @@ function checkCustomNode(dep, env, profiles) {
|
|
|
475
482
|
return { ...base, status: 'installed', grade: 'presence', action: 'skip', found: describeNodeFound(found), notes };
|
|
476
483
|
}
|
|
477
484
|
|
|
485
|
+
/**
|
|
486
|
+
* 0.2.15: a node the installer itself copied from a repository SUBDIRECTORY
|
|
487
|
+
* (marker .animastor-source.json, no .git) of the repository the manifest names.
|
|
488
|
+
* Only such a node is updated automatically; a git checkout (the user's or a
|
|
489
|
+
* third-party node) stays a review item.
|
|
490
|
+
*/
|
|
491
|
+
function isInstallerCopiedNode(dep, found) {
|
|
492
|
+
const src = (dep.install && dep.install.source) || {};
|
|
493
|
+
return !!(found && found.animastor_source === true && src.subdirectory && src.commit
|
|
494
|
+
&& src.repository && found.repository && reposEqual(src.repository, found.repository));
|
|
495
|
+
}
|
|
496
|
+
|
|
478
497
|
function describeNodeExpectation(dep) {
|
|
479
498
|
const src = (dep.install && dep.install.source) || {};
|
|
480
499
|
return { directory: dep.install && dep.install.directory, repository: src.repository || null, commit: src.commit || null };
|
|
@@ -1202,6 +1221,7 @@ function resolveInstallation({ manifests, environment = null, mode = 'existing',
|
|
|
1202
1221
|
const incompatible = entries.filter((e) => e.status === 'incompatible').length;
|
|
1203
1222
|
const installPlan = entries.filter((e) => e.action === 'install').map((e) => e.id);
|
|
1204
1223
|
const configurePlan = entries.filter((e) => e.action === 'configure').map((e) => e.id);
|
|
1224
|
+
const updatePlan = entries.filter((e) => e.action === 'update').map((e) => e.id);
|
|
1205
1225
|
const customizedWorkflows = entries.filter((e) => e.kind === 'workflow' && e.grade === 'customized').map((e) => e.id);
|
|
1206
1226
|
|
|
1207
1227
|
// Hard invariant of Phase 1: resolver never plans destructive operations.
|
|
@@ -1227,6 +1247,7 @@ function resolveInstallation({ manifests, environment = null, mode = 'existing',
|
|
|
1227
1247
|
blocking: missingRequired + incompatible,
|
|
1228
1248
|
install_plan: installPlan,
|
|
1229
1249
|
configure_plan: configurePlan,
|
|
1250
|
+
update_plan: updatePlan,
|
|
1230
1251
|
customized_workflows: customizedWorkflows,
|
|
1231
1252
|
},
|
|
1232
1253
|
warnings,
|
|
@@ -168,6 +168,28 @@ async function downloadArtifact(io, spec, opts = {}) {
|
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
/** What a verification grade proved, in log words. */
|
|
172
|
+
const GRADE_TEXT = {
|
|
173
|
+
'checksum-verified': 'verified sha256',
|
|
174
|
+
'checksum-prefix-verified': 'verified sha256 prefix',
|
|
175
|
+
'size-verified': 'verified size',
|
|
176
|
+
'files-verified': 'verified file list',
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* One log line per model file (0.2.14): name, size, outcome —
|
|
181
|
+
* model models/x/a.bin (123 bytes): downloaded, verified sha256
|
|
182
|
+
* model models/x/a.bin (123 bytes): present, verified sha256 — skipped
|
|
183
|
+
* model models/x/a.bin: failed: HTTP 404 from source
|
|
184
|
+
*/
|
|
185
|
+
function modelFileLine({ file, size = null, status, grade = null, reason = null }) {
|
|
186
|
+
const name = `model ${file}${typeof size === 'number' ? ` (${size} bytes)` : ''}`;
|
|
187
|
+
const proof = GRADE_TEXT[grade] || 'not verified (no checksum or size in the manifest)';
|
|
188
|
+
if (status === 'downloaded' || status === 'resumed') return `${name}: downloaded${status === 'resumed' ? ' (resumed)' : ''}, ${proof}`;
|
|
189
|
+
if (status === 'skipped') return `${name}: present, ${proof} — skipped`;
|
|
190
|
+
return `${name}: ${status || 'failed'}: ${reason || grade || 'unknown reason'}`;
|
|
191
|
+
}
|
|
192
|
+
|
|
171
193
|
// ---------------------------------------------------------------------------
|
|
172
194
|
// Platform adapters — manifest source → request headers
|
|
173
195
|
// ---------------------------------------------------------------------------
|
|
@@ -531,6 +553,7 @@ module.exports = {
|
|
|
531
553
|
SIZE_TOLERANCE,
|
|
532
554
|
verifyFile,
|
|
533
555
|
downloadArtifact,
|
|
556
|
+
modelFileLine,
|
|
534
557
|
makeHeaderProvider,
|
|
535
558
|
modelscopeStrategy,
|
|
536
559
|
listModelScopeFiles,
|
|
@@ -273,8 +273,10 @@ async function runInstallation(args) {
|
|
|
273
273
|
: probe.probeEnvironment(io, {
|
|
274
274
|
root: comfyuiRoot, workerDir, crypto,
|
|
275
275
|
workerType: manifests.length === 1 ? (manifests[0].worker_bundle || {}).worker_type : null,
|
|
276
|
+
manifests,
|
|
276
277
|
})
|
|
277
278
|
);
|
|
279
|
+
if (!dryRun) await probe.hashProbedModels(io, env, manifests);
|
|
278
280
|
const device = env.device || (env.gpu ? 'cuda' : 'cpu');
|
|
279
281
|
if (device === 'cpu') {
|
|
280
282
|
result.warnings.push(CPU_MODE_WARNING);
|
|
@@ -698,7 +700,10 @@ async function runInstallation(args) {
|
|
|
698
700
|
}
|
|
699
701
|
}
|
|
700
702
|
const nodesApproved = !runtimeFatal && nodesStep && nodesStep.action && nodesStep.decision === 'yes';
|
|
701
|
-
|
|
703
|
+
// 0.2.15: installer-copied nodes behind the manifest pin are updated
|
|
704
|
+
// without a question — also when nothing is missing (noop step)
|
|
705
|
+
const nodeUpdates = (nodesStep && nodesStep.update) || [];
|
|
706
|
+
if (!runtimeFatal && (nodesApproved || retryDeps.length > 0 || nodeUpdates.length > 0)) {
|
|
702
707
|
const python = platformAdapter.venvPythonBin(path.join(comfyuiRoot, 'venv'));
|
|
703
708
|
// A platform ComfyUI imports with ITS interpreter: pip into
|
|
704
709
|
// <root>/venv is useful only when that is the same Python (0.2.13).
|
|
@@ -712,6 +717,7 @@ async function runInstallation(args) {
|
|
|
712
717
|
...(nodesStep || { id: 'custom-nodes', title: 'Custom nodes' }),
|
|
713
718
|
missing: retryDeps.map((id) => ({ id })),
|
|
714
719
|
review: [],
|
|
720
|
+
update: nodeUpdates,
|
|
715
721
|
};
|
|
716
722
|
const nodeTorchSpec = pickTorchSpec(manifests, decisions, result.warnings, device);
|
|
717
723
|
const r = await log.step('install custom nodes', () => withBusySync('Installing custom nodes', () => nodes.installCustomNodes(io, {
|
|
@@ -770,10 +776,12 @@ async function runInstallation(args) {
|
|
|
770
776
|
// the dependency gate of the platform's ComfyUI ran BEFORE the clone and
|
|
771
777
|
// could not see it, so it runs again (overlay install + restart, 0.2.13).
|
|
772
778
|
let nodeDepsGate = null;
|
|
773
|
-
|
|
779
|
+
// 0.2.15: an UPDATED node (new code, same classes) needs the restart too
|
|
780
|
+
const freshNodes = (result.results.custom_nodes || []).filter((x) => x.status === 'installed' && (x.origin === 'installed' || x.origin === 'updated'));
|
|
781
|
+
const updatedNodes = freshNodes.filter((x) => x.origin === 'updated').map((x) => x.directory);
|
|
774
782
|
if (!runtimeFatal && foreignComfy && freshNodes.length > 0 && options.platformNodeDeps) {
|
|
775
783
|
log.info(`checking the Python dependencies of the installed node(s): ${freshNodes.map((x) => x.directory).join(', ')}`);
|
|
776
|
-
nodeDepsGate = await options.platformNodeDeps(comfyOwner);
|
|
784
|
+
nodeDepsGate = await options.platformNodeDeps(comfyOwner, { codeChanged: updatedNodes });
|
|
777
785
|
Object.assign(st.installer_options, nodeDepsGate.record);
|
|
778
786
|
for (const e of nodeDepsGate.ownedServices || []) state.addOwnedComponent(st, 'services', e);
|
|
779
787
|
result.results.node_deps_overrides = nodeDepsGate.overrides;
|
|
@@ -797,6 +805,10 @@ async function runInstallation(args) {
|
|
|
797
805
|
if (!runtimeFatal && modelsStep && modelsStep.skipped_by_user) {
|
|
798
806
|
log.warn(`model downloads skipped — declined (${modelsStep.missing.length} missing: ${modelsStep.missing.map((x) => x.label).join(', ')})`);
|
|
799
807
|
}
|
|
808
|
+
// Every model file is logged with its outcome (0.2.14) — also the ones
|
|
809
|
+
// the plan found in place, so the plan, this log and the final check
|
|
810
|
+
// speak about the same files.
|
|
811
|
+
logPresentModels(io, { env, report, manifests, log });
|
|
800
812
|
if (!runtimeFatal && modelsStep && modelsStep.action && modelsStep.decision === 'yes') {
|
|
801
813
|
const getHeader = downloader.makeHeaderProvider(process.env);
|
|
802
814
|
const missingIds = (modelsStep.missing || []).map((x) => x.id);
|
|
@@ -823,6 +835,7 @@ async function runInstallation(args) {
|
|
|
823
835
|
const strategy = downloader.modelscopeStrategy(dep);
|
|
824
836
|
if (strategy.mechanism === 'node_auto_download') {
|
|
825
837
|
result.results.models.push({ id: spec.id, status: 'deferred-to-node', reason: strategy.note });
|
|
838
|
+
logModelResult(io, { log, res: { status: 'deferred-to-node', reason: strategy.note }, target: spec.target_path, absTarget });
|
|
826
839
|
state.setArtifact(st, spec.id, 'missing', { note: strategy.note });
|
|
827
840
|
} else if (strategy.mechanism === 'installer_preload') {
|
|
828
841
|
// D2 closed: installer pre-downloads ModelScope repos
|
|
@@ -853,6 +866,9 @@ async function runInstallation(args) {
|
|
|
853
866
|
const res = r.ok ? r.value : { status: 'failed', reason: String(r.error && r.error.message) };
|
|
854
867
|
const status = res.status === 'failed' ? 'failed' : res.status === 'skipped' ? 'verified' : 'installed';
|
|
855
868
|
result.results.models.push({ id: spec.id, ...res });
|
|
869
|
+
logModelResult(io, {
|
|
870
|
+
log, res, target: spec.target_path, absTarget: path.join(loc ? loc.base : comfyuiRoot, dlSpec.target_path),
|
|
871
|
+
});
|
|
856
872
|
if (status === 'installed') {
|
|
857
873
|
state.addOwnedComponent(st, 'models', {
|
|
858
874
|
id: spec.id,
|
|
@@ -866,6 +882,7 @@ async function runInstallation(args) {
|
|
|
866
882
|
continue; // skip the generic downloadArtifact below
|
|
867
883
|
} else {
|
|
868
884
|
result.results.models.push({ id: spec.id, status: 'blocked', reason: strategy.note });
|
|
885
|
+
logModelResult(io, { log, res: { status: 'blocked', reason: strategy.note }, target: spec.target_path, absTarget });
|
|
869
886
|
state.setArtifact(st, spec.id, 'missing', { note: strategy.note });
|
|
870
887
|
}
|
|
871
888
|
if (strategy.mechanism !== 'installer_preload') continue;
|
|
@@ -883,6 +900,7 @@ async function runInstallation(args) {
|
|
|
883
900
|
if (progress && progress.endFile) progress.endFile({ status: r.ok ? r.value.status : 'failed' });
|
|
884
901
|
const res = r.ok ? r.value : { status: 'failed', reason: String(r.error && r.error.message) };
|
|
885
902
|
result.results.models.push({ id: spec.id, ...res });
|
|
903
|
+
logModelResult(io, { log, res, target: spec.target_path, absTarget });
|
|
886
904
|
if (res.status === 'downloaded' || res.status === 'resumed') {
|
|
887
905
|
state.addOwnedComponent(st, 'models', {
|
|
888
906
|
id: spec.id,
|
|
@@ -1438,6 +1456,41 @@ function pickUpdateTarget(manifest) {
|
|
|
1438
1456
|
throw new Error('no update target in manifest');
|
|
1439
1457
|
}
|
|
1440
1458
|
|
|
1459
|
+
/** Log the outcome of one download: a single file, or every file of a repo. */
|
|
1460
|
+
function logModelResult(io, { log, res, target, absTarget }) {
|
|
1461
|
+
const files = res.files && res.files.length > 0 ? res.files : [{ ...res, path: null }];
|
|
1462
|
+
for (const f of files) {
|
|
1463
|
+
let size = null;
|
|
1464
|
+
try {
|
|
1465
|
+
const st = io.fs.statSync(f.path ? path.join(absTarget, f.path) : absTarget);
|
|
1466
|
+
if (st.isFile) size = st.size;
|
|
1467
|
+
} catch (_) { /* not on disk */ }
|
|
1468
|
+
const line = downloader.modelFileLine({ ...f, file: f.path ? `${target}/${f.path}` : target, size });
|
|
1469
|
+
if (f.status === 'failed' || f.status === 'blocked') log.error(line);
|
|
1470
|
+
else log.info(line);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
/** Log the model files the resolver found on disk (they are not downloaded). */
|
|
1475
|
+
function logPresentModels(io, { env, report, manifests, log }) {
|
|
1476
|
+
const sizes = new Map((env.models || []).map((m) => [m.path, m.size_bytes]));
|
|
1477
|
+
for (const e of report.entries) {
|
|
1478
|
+
const dep = findModelDep(manifests, e.id);
|
|
1479
|
+
if (!dep || !e.found || (e.kind !== 'model' && e.kind !== 'model_repo')) continue;
|
|
1480
|
+
const dir = path.posix.normalize(String(dep.target_dir));
|
|
1481
|
+
// a repo lists its files with the full path or relative to its folder
|
|
1482
|
+
const files = e.found.path ? [e.found.path] : (e.found.files || []).map((f) => (sizes.has(f) ? f : `${dir}/${f}`));
|
|
1483
|
+
for (const file of files.filter((f) => !f.endsWith('.part'))) {
|
|
1484
|
+
const size = sizes.get(file);
|
|
1485
|
+
if (e.status === 'incompatible') {
|
|
1486
|
+
log.warn(`${downloader.modelFileLine({ file, size, status: 'left as is', reason: e.reason })} — to download it again, delete the file and repeat the run`);
|
|
1487
|
+
} else {
|
|
1488
|
+
log.info(downloader.modelFileLine({ file, size, status: 'skipped', grade: e.grade }));
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1441
1494
|
function findModelDep(manifests, id) {
|
|
1442
1495
|
for (const m of manifests) {
|
|
1443
1496
|
const dep = (m.dependencies || []).find((d) => d.id === id);
|
|
@@ -1754,7 +1807,9 @@ async function runVerification({ io, manifests, roots, options, log, crypto, tok
|
|
|
1754
1807
|
}
|
|
1755
1808
|
|
|
1756
1809
|
// Re-probe disk state for the final report
|
|
1757
|
-
const envAfter = probe.probeEnvironment(io, {
|
|
1810
|
+
const envAfter = await probe.hashProbedModels(io, probe.probeEnvironment(io, {
|
|
1811
|
+
root: comfyuiRoot, workerDir, crypto, workerType: expectedType, manifests,
|
|
1812
|
+
}), manifests);
|
|
1758
1813
|
const reportAfter = require('../compatibility-resolver').resolveInstallation({
|
|
1759
1814
|
manifests, environment: envAfter, mode: manifests.length > 1 ? 'shared' : 'existing',
|
|
1760
1815
|
});
|
|
@@ -16,12 +16,14 @@ const { redactSecrets, isSecretName } = require('../safety-rules');
|
|
|
16
16
|
function createLogger({ io, sink = null, quiet = false } = {}) {
|
|
17
17
|
const secrets = new Set();
|
|
18
18
|
const lines = [];
|
|
19
|
+
let tee = null;
|
|
19
20
|
|
|
20
21
|
function emit(level, msg) {
|
|
21
22
|
const safe = redact(String(msg), secrets);
|
|
22
23
|
const ts = new Date(io.now()).toISOString();
|
|
23
24
|
const line = `[${ts}] [${level}] ${safe}`;
|
|
24
25
|
lines.push(line);
|
|
26
|
+
if (tee) tee(line);
|
|
25
27
|
if (!quiet) {
|
|
26
28
|
if (sink) sink(line);
|
|
27
29
|
else console.log(line); // eslint-disable-line no-console
|
|
@@ -67,6 +69,11 @@ function createLogger({ io, sink = null, quiet = false } = {}) {
|
|
|
67
69
|
return { ok: false, error: err, ms: io.now() - t0 };
|
|
68
70
|
}
|
|
69
71
|
},
|
|
72
|
+
/** Copy the log to fn: the lines so far, then every new one (redacted). */
|
|
73
|
+
teeTo(fn) {
|
|
74
|
+
lines.forEach((line) => fn(line));
|
|
75
|
+
tee = fn;
|
|
76
|
+
},
|
|
70
77
|
lines,
|
|
71
78
|
isSecretName,
|
|
72
79
|
};
|
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
*
|
|
13
13
|
* Already-installed compatible nodes are KEPT — never reinstalled without
|
|
14
14
|
* need. Incompatible nodes stop their step pending a user decision; no
|
|
15
|
-
* destructive replacement happens automatically.
|
|
15
|
+
* destructive replacement happens automatically — except (0.2.15) a node the
|
|
16
|
+
* installer itself copied from a repository subdirectory (marker
|
|
17
|
+
* .animastor-source.json): it is updated to the manifest pin, old copy kept
|
|
18
|
+
* as <root>/.animastor-node-sources/<dir>.prev.
|
|
16
19
|
*/
|
|
17
20
|
|
|
18
21
|
const path = require('path');
|
|
@@ -61,6 +64,114 @@ function pipInstallRequirements(io, { root, reqPath, python, torchSpec, log = nu
|
|
|
61
64
|
/** marker written into a node installed from a repository subdirectory (probe reads it) */
|
|
62
65
|
const SOURCE_MARKER = '.animastor-source.json';
|
|
63
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Clone src.repository OUTSIDE custom_nodes, check out src.commit, copy
|
|
69
|
+
* src.subdirectory to `dest`, write the source marker; staging is always removed.
|
|
70
|
+
* @returns {null|{status:'blocked'|'failed', reason:string}} null = copied
|
|
71
|
+
*/
|
|
72
|
+
function copySubdirectory(io, { root, dep, dirName, src, dest }) {
|
|
73
|
+
const sub = String(src.subdirectory);
|
|
74
|
+
if (path.isAbsolute(sub) || sub.split(/[\\/]/).includes('..')) {
|
|
75
|
+
return { status: 'blocked', reason: `bad subdirectory ${JSON.stringify(sub)} for ${dep.id}` };
|
|
76
|
+
}
|
|
77
|
+
if (!src.commit) {
|
|
78
|
+
return { status: 'blocked', reason: `${dep.id}: a subdirectory source needs a pinned commit` };
|
|
79
|
+
}
|
|
80
|
+
const staging = path.join(root, '.animastor-node-sources', dirName);
|
|
81
|
+
io.fs.rmSync(staging, { recursive: true, force: true });
|
|
82
|
+
io.fs.mkdirSync(path.dirname(staging), { recursive: true });
|
|
83
|
+
let c = io.exec('git', ['clone', src.repository, staging]);
|
|
84
|
+
if (c.code !== 0) {
|
|
85
|
+
io.fs.rmSync(staging, { recursive: true, force: true });
|
|
86
|
+
return { status: 'failed', reason: `git clone ${src.repository} failed: ${String(c.stderr || c.error).slice(-300)}` };
|
|
87
|
+
}
|
|
88
|
+
c = io.exec('git', ['-C', staging, 'checkout', src.commit]);
|
|
89
|
+
if (c.code !== 0) {
|
|
90
|
+
io.fs.rmSync(staging, { recursive: true, force: true });
|
|
91
|
+
return { status: 'failed', reason: `git checkout ${src.commit} failed: ${String(c.stderr).slice(-300)}` };
|
|
92
|
+
}
|
|
93
|
+
const from = path.join(staging, sub);
|
|
94
|
+
if (!io.fs.isDirectory(from)) {
|
|
95
|
+
io.fs.rmSync(staging, { recursive: true, force: true });
|
|
96
|
+
return { status: 'failed', reason: `subdirectory ${sub} not found in ${src.repository}@${src.commit}` };
|
|
97
|
+
}
|
|
98
|
+
c = io.exec('cp', ['-a', from, dest]);
|
|
99
|
+
io.fs.rmSync(staging, { recursive: true, force: true });
|
|
100
|
+
if (c.code !== 0) return { status: 'failed', reason: `copy of ${sub} failed: ${String(c.stderr || c.error).slice(-300)}` };
|
|
101
|
+
io.fs.writeFileSync(path.join(dest, SOURCE_MARKER), JSON.stringify({ repository: src.repository, commit: src.commit, subdirectory: sub }, null, 2) + '\n');
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function readSourceMarker(io, dir) {
|
|
106
|
+
try {
|
|
107
|
+
const m = JSON.parse(io.fs.readFileSync(path.join(dir, SOURCE_MARKER), 'utf8'));
|
|
108
|
+
return m && typeof m === 'object' ? m : null;
|
|
109
|
+
} catch (_) { return null; }
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* 0.2.15 — update a node the installer copied from a repository subdirectory
|
|
114
|
+
* (marker .animastor-source.json, same repository) to the manifest pin:
|
|
115
|
+
* the pinned copy is staged in <root>/.animastor-node-sources/<dir>.new,
|
|
116
|
+
* the current one moves to <dir>.prev (the backup of the last update), the
|
|
117
|
+
* new one takes its place; a failed swap puts the old copy back. A git
|
|
118
|
+
* checkout or a node without the marker is never touched.
|
|
119
|
+
* @returns {{ status: 'installed'|'blocked'|'failed', origin?: 'updated', directory?, from?, to?, reason? }}
|
|
120
|
+
*/
|
|
121
|
+
function updateCustomNode(io, { root, dep, python = null, torchSpec = null, log = null }) {
|
|
122
|
+
const src = (dep.install && dep.install.source) || {};
|
|
123
|
+
const dirName = (dep.install && dep.install.directory) || dep.name;
|
|
124
|
+
const target = path.join(root, 'custom_nodes', dirName);
|
|
125
|
+
if (!src.subdirectory || !src.commit || !src.repository) {
|
|
126
|
+
return { status: 'blocked', reason: `${dep.id}: only a node pinned to a repository subdirectory + commit is updated automatically` };
|
|
127
|
+
}
|
|
128
|
+
if (!io.fs.isDirectory(target)) return { status: 'failed', reason: `${target} is not there any more — re-run to install it` };
|
|
129
|
+
if (io.fs.existsSync(path.join(target, '.git'))) {
|
|
130
|
+
return { status: 'blocked', reason: `${target} is a git checkout — not replaced automatically` };
|
|
131
|
+
}
|
|
132
|
+
const marker = readSourceMarker(io, target);
|
|
133
|
+
const norm = (u) => String(u || '').replace(/\.git$/, '').replace(/\/+$/, '').toLowerCase();
|
|
134
|
+
if (!marker || norm(marker.repository) !== norm(src.repository)) {
|
|
135
|
+
return { status: 'blocked', reason: `${target} was not installed by the Animastor installer from ${src.repository} — not replaced automatically` };
|
|
136
|
+
}
|
|
137
|
+
const from = typeof marker.commit === 'string' ? marker.commit : null;
|
|
138
|
+
if (from === src.commit) return { status: 'installed', origin: 'pre-existing', directory: dirName, reason: 'already at the manifest pin' };
|
|
139
|
+
|
|
140
|
+
const base = path.join(root, '.animastor-node-sources');
|
|
141
|
+
const fresh = path.join(base, `${dirName}.new`);
|
|
142
|
+
const backup = path.join(base, `${dirName}.prev`);
|
|
143
|
+
io.fs.mkdirSync(base, { recursive: true });
|
|
144
|
+
io.fs.rmSync(fresh, { recursive: true, force: true });
|
|
145
|
+
const staged = copySubdirectory(io, { root, dep, dirName, src, dest: fresh });
|
|
146
|
+
if (staged) {
|
|
147
|
+
io.fs.rmSync(fresh, { recursive: true, force: true });
|
|
148
|
+
return staged;
|
|
149
|
+
}
|
|
150
|
+
io.fs.rmSync(backup, { recursive: true, force: true });
|
|
151
|
+
try {
|
|
152
|
+
io.fs.renameSync(target, backup);
|
|
153
|
+
} catch (err) {
|
|
154
|
+
io.fs.rmSync(fresh, { recursive: true, force: true });
|
|
155
|
+
return { status: 'failed', reason: `could not move the old ${dirName} aside: ${err.message}` };
|
|
156
|
+
}
|
|
157
|
+
try {
|
|
158
|
+
io.fs.renameSync(fresh, target);
|
|
159
|
+
} catch (err) {
|
|
160
|
+
try { io.fs.renameSync(backup, target); } catch (_) { /* reported below */ }
|
|
161
|
+
io.fs.rmSync(fresh, { recursive: true, force: true });
|
|
162
|
+
return { status: 'failed', reason: `could not put the new ${dirName} in place (old copy restored): ${err.message}` };
|
|
163
|
+
}
|
|
164
|
+
const req = path.join(target, 'requirements.txt');
|
|
165
|
+
if (io.fs.existsSync(req) && python) {
|
|
166
|
+
const pip = pipInstallRequirements(io, { root, reqPath: req, python, torchSpec, log });
|
|
167
|
+
if (!pip.ok) {
|
|
168
|
+
return { status: 'installed', origin: 'updated', directory: dirName, from, to: src.commit, pip_output: pip.output, reason: 'updated; python dependencies incomplete — see warnings' };
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (log) log.info(`custom node updated: ${dirName} ${String(from || '?').slice(0, 7)} → ${src.commit.slice(0, 7)} (previous copy: ${backup})`);
|
|
172
|
+
return { status: 'installed', origin: 'updated', directory: dirName, from, to: src.commit };
|
|
173
|
+
}
|
|
174
|
+
|
|
64
175
|
function installCustomNode(io, { root, dep, python = null, torchSpec = null, retryDeps = false, log = null }) {
|
|
65
176
|
const src = (dep.install && dep.install.source) || {};
|
|
66
177
|
const dirName = (dep.install && dep.install.directory) || dep.name;
|
|
@@ -91,35 +202,8 @@ function installCustomNode(io, { root, dep, python = null, torchSpec = null, ret
|
|
|
91
202
|
// animastor-worker/comfyui-nodes/animastor-voice-ref): clone OUTSIDE
|
|
92
203
|
// custom_nodes (ComfyUI would load the whole checkout as a node),
|
|
93
204
|
// check out the pin, copy the subdirectory, record the source.
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
96
|
-
return { status: 'blocked', reason: `bad subdirectory ${JSON.stringify(sub)} for ${dep.id}` };
|
|
97
|
-
}
|
|
98
|
-
if (!src.commit) {
|
|
99
|
-
return { status: 'blocked', reason: `${dep.id}: a subdirectory source needs a pinned commit` };
|
|
100
|
-
}
|
|
101
|
-
const staging = path.join(root, '.animastor-node-sources', dirName);
|
|
102
|
-
io.fs.rmSync(staging, { recursive: true, force: true });
|
|
103
|
-
io.fs.mkdirSync(path.dirname(staging), { recursive: true });
|
|
104
|
-
let c = io.exec('git', ['clone', src.repository, staging]);
|
|
105
|
-
if (c.code !== 0) {
|
|
106
|
-
io.fs.rmSync(staging, { recursive: true, force: true });
|
|
107
|
-
return { status: 'failed', reason: `git clone ${src.repository} failed: ${String(c.stderr || c.error).slice(-300)}` };
|
|
108
|
-
}
|
|
109
|
-
c = io.exec('git', ['-C', staging, 'checkout', src.commit]);
|
|
110
|
-
if (c.code !== 0) {
|
|
111
|
-
io.fs.rmSync(staging, { recursive: true, force: true });
|
|
112
|
-
return { status: 'failed', reason: `git checkout ${src.commit} failed: ${String(c.stderr).slice(-300)}` };
|
|
113
|
-
}
|
|
114
|
-
const from = path.join(staging, sub);
|
|
115
|
-
if (!io.fs.isDirectory(from)) {
|
|
116
|
-
io.fs.rmSync(staging, { recursive: true, force: true });
|
|
117
|
-
return { status: 'failed', reason: `subdirectory ${sub} not found in ${src.repository}@${src.commit}` };
|
|
118
|
-
}
|
|
119
|
-
c = io.exec('cp', ['-a', from, target]);
|
|
120
|
-
io.fs.rmSync(staging, { recursive: true, force: true });
|
|
121
|
-
if (c.code !== 0) return { status: 'failed', reason: `copy of ${sub} failed: ${String(c.stderr || c.error).slice(-300)}` };
|
|
122
|
-
io.fs.writeFileSync(path.join(target, SOURCE_MARKER), JSON.stringify({ repository: src.repository, commit: src.commit, subdirectory: sub }, null, 2) + '\n');
|
|
205
|
+
const staged = copySubdirectory(io, { root, dep, dirName, src, dest: target });
|
|
206
|
+
if (staged) return staged;
|
|
123
207
|
} else {
|
|
124
208
|
let r = io.exec('git', ['clone', src.repository, target]);
|
|
125
209
|
if (r.code !== 0) {
|
|
@@ -169,6 +253,15 @@ function installCustomNodes(io, { root, manifests, planStep, python = null, torc
|
|
|
169
253
|
...installCustomNode(io, { root, dep, python, torchSpec, retryDeps: retryDeps.includes(item.id), log }),
|
|
170
254
|
});
|
|
171
255
|
}
|
|
256
|
+
// 0.2.15: installer-copied nodes behind the manifest pin (resolver action 'update')
|
|
257
|
+
for (const item of planStep.update || []) {
|
|
258
|
+
const dep = findManifestDep(manifests, item.id);
|
|
259
|
+
if (!dep) {
|
|
260
|
+
results.push({ id: item.id, status: 'blocked', reason: 'not found in any manifest' });
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
results.push({ id: item.id, ...updateCustomNode(io, { root, dep, python, torchSpec, log }) });
|
|
264
|
+
}
|
|
172
265
|
for (const item of planStep.review || []) {
|
|
173
266
|
results.push({
|
|
174
267
|
id: item.id,
|
|
@@ -181,5 +274,6 @@ function installCustomNodes(io, { root, manifests, planStep, python = null, torc
|
|
|
181
274
|
|
|
182
275
|
module.exports = {
|
|
183
276
|
installCustomNode,
|
|
277
|
+
updateCustomNode,
|
|
184
278
|
installCustomNodes,
|
|
185
279
|
};
|
|
@@ -94,7 +94,7 @@ function gitInfo(io, dir) {
|
|
|
94
94
|
if (!io.fs.existsSync(marker)) return null;
|
|
95
95
|
try {
|
|
96
96
|
const m = JSON.parse(io.fs.readFileSync(marker, 'utf8'));
|
|
97
|
-
if (m && typeof m.repository === 'string' && typeof m.commit === 'string') return { repository: m.repository, commit: m.commit, tag: null };
|
|
97
|
+
if (m && typeof m.repository === 'string' && typeof m.commit === 'string') return { repository: m.repository, commit: m.commit, tag: null, animastor_source: true };
|
|
98
98
|
} catch (_) { /* unreadable marker → plain directory */ }
|
|
99
99
|
return null;
|
|
100
100
|
}
|
|
@@ -310,6 +310,9 @@ function probeCustomNodes(io, root) {
|
|
|
310
310
|
repository: git ? git.repository : null,
|
|
311
311
|
commit: git ? git.commit : null,
|
|
312
312
|
is_git: git !== null,
|
|
313
|
+
// 0.2.15: copied by the installer from a repository subdirectory
|
|
314
|
+
// (.animastor-source.json) — the installer may update it to the pin
|
|
315
|
+
...(git && git.animastor_source ? { animastor_source: true } : {}),
|
|
313
316
|
});
|
|
314
317
|
}
|
|
315
318
|
return out;
|
|
@@ -417,10 +420,29 @@ function extraModelFolders(io, root) {
|
|
|
417
420
|
}
|
|
418
421
|
}
|
|
419
422
|
|
|
420
|
-
|
|
423
|
+
/**
|
|
424
|
+
* Folders scanned for models: MODEL_DIRS plus the top folder (models/<folder>)
|
|
425
|
+
* of every target_dir the manifests install models into — a file the
|
|
426
|
+
* downloader can write is always a file the check can see (0.2.14).
|
|
427
|
+
*/
|
|
428
|
+
function modelScanDirs(manifests = []) {
|
|
429
|
+
const dirs = new Set(MODEL_DIRS);
|
|
430
|
+
for (const m of manifests || []) {
|
|
431
|
+
for (const dep of m.dependencies || []) {
|
|
432
|
+
if (dep.kind !== 'model' && dep.kind !== 'model_repo') continue;
|
|
433
|
+
const parts = String(dep.target_dir || '').split(/[\\/]+/).filter((p) => p && p !== '.');
|
|
434
|
+
if (parts.length < 2 || parts.includes('..')) continue;
|
|
435
|
+
dirs.add(parts.slice(0, 2).join('/'));
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
return [...dirs];
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
function probeModels(io, root, manifests = []) {
|
|
421
442
|
const out = [];
|
|
422
|
-
|
|
423
|
-
const
|
|
443
|
+
const scanDirs = modelScanDirs(manifests);
|
|
444
|
+
for (const dir of scanDirs) walkModelDir(io, path.join(root, dir), dir, out);
|
|
445
|
+
const seen = new Set(scanDirs.map((d) => path.normalize(path.join(root, d))));
|
|
424
446
|
for (const extra of extraModelFolders(io, root)) {
|
|
425
447
|
const abs = extra.path.replace(/[\\/]+$/, '');
|
|
426
448
|
if (seen.has(path.normalize(abs))) continue; // same as the default layout
|
|
@@ -430,6 +452,34 @@ function probeModels(io, root) {
|
|
|
430
452
|
return out;
|
|
431
453
|
}
|
|
432
454
|
|
|
455
|
+
/** Larger files are checked by size only: hashing 20+ GB on every doctor run takes minutes. */
|
|
456
|
+
const HASH_LIMIT_BYTES = 1024 ** 3;
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Add sha256 to the probed models the manifests carry a checksum for, so the
|
|
460
|
+
* resolver can say "checksum-verified" (0.2.14). Only files of exactly the
|
|
461
|
+
* manifest size are hashed: another size is another file (quant) and stays a
|
|
462
|
+
* matter of the size check. An unreadable file stays without sha256.
|
|
463
|
+
*/
|
|
464
|
+
async function hashProbedModels(io, env, manifests = []) {
|
|
465
|
+
if (!env || !env.root || !Array.isArray(env.models) || !io.hashFile) return env;
|
|
466
|
+
const byPath = new Map(env.models.map((m) => [m.path, m]));
|
|
467
|
+
for (const dep of (manifests || []).flatMap((m) => m.dependencies || [])) {
|
|
468
|
+
if (dep.kind !== 'model' || !dep.checksum || !dep.checksum.value) continue;
|
|
469
|
+
const found = byPath.get(path.posix.join(dep.target_dir, dep.filename));
|
|
470
|
+
if (!found || found.sha256 || found.size_bytes !== dep.size_bytes_approx || found.size_bytes > HASH_LIMIT_BYTES) continue;
|
|
471
|
+
try { found.sha256 = await io.hashFile(modelAbsPath(env.root, found), 'sha256'); } catch (_) { /* size check only */ }
|
|
472
|
+
}
|
|
473
|
+
return env;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/** Absolute path of a probed model (`location` = a folder of extra_model_paths.yaml). */
|
|
477
|
+
function modelAbsPath(root, model) {
|
|
478
|
+
return model.location
|
|
479
|
+
? path.join(model.location, model.path.split('/').slice(2).join('/'))
|
|
480
|
+
: path.join(root, model.path);
|
|
481
|
+
}
|
|
482
|
+
|
|
433
483
|
function sha256OfFile(io, crypto, absPath) {
|
|
434
484
|
const data = io.fs.readFileSync(absPath); // workflows are small; fine
|
|
435
485
|
return crypto.createHash('sha256').update(Buffer.from(data)).digest('hex');
|
|
@@ -490,10 +540,10 @@ function probeWorker(io, workerDir) {
|
|
|
490
540
|
/**
|
|
491
541
|
* Probe the full environment.
|
|
492
542
|
* @param {object} io
|
|
493
|
-
* @param {object} opts { root: ComfyUI root, workerDir, crypto }
|
|
543
|
+
* @param {object} opts { root: ComfyUI root, workerDir, crypto, manifests: loaded manifests (model folders) }
|
|
494
544
|
* @returns resolver-compatible environment object
|
|
495
545
|
*/
|
|
496
|
-
function probeEnvironment(io, { root = null, workerDir = null, crypto = null, workerType = null } = {}) {
|
|
546
|
+
function probeEnvironment(io, { root = null, workerDir = null, crypto = null, workerType = null, manifests = [] } = {}) {
|
|
497
547
|
const env = {
|
|
498
548
|
root,
|
|
499
549
|
comfyui: undefined,
|
|
@@ -526,7 +576,7 @@ function probeEnvironment(io, { root = null, workerDir = null, crypto = null, wo
|
|
|
526
576
|
|
|
527
577
|
if (env.comfyui) {
|
|
528
578
|
env.custom_nodes = probeCustomNodes(io, root);
|
|
529
|
-
env.models = probeModels(io, root);
|
|
579
|
+
env.models = probeModels(io, root, manifests);
|
|
530
580
|
env.python_packages = [];
|
|
531
581
|
if (crypto) env.workflows = probeWorkflows(io, crypto, root);
|
|
532
582
|
} else {
|
|
@@ -595,6 +645,9 @@ module.exports = {
|
|
|
595
645
|
MODEL_DIRS,
|
|
596
646
|
parseExtraModelPaths,
|
|
597
647
|
probeModels,
|
|
648
|
+
modelScanDirs,
|
|
649
|
+
hashProbedModels,
|
|
650
|
+
modelAbsPath,
|
|
598
651
|
pickNodeBinary,
|
|
599
652
|
nodeBinaryVersion,
|
|
600
653
|
nodeMajor,
|
|
@@ -255,6 +255,10 @@ function buildArtifactStep({ id, title, report, kinds, decisionKey, decisions, m
|
|
|
255
255
|
kind: 'prompt',
|
|
256
256
|
missing: missing.map((e) => ({ id: e.id, label: entryLabel(e) })),
|
|
257
257
|
review: review.map((e) => ({ id: e.id, label: entryLabel(e), reason: e.reason || e.status, notes: e.notes || [] })),
|
|
258
|
+
// 0.2.15: installer-copied nodes behind the manifest pin — updated
|
|
259
|
+
// without a question (the engine runs them even when the step is a noop)
|
|
260
|
+
update: report.entries.filter((e) => kinds.includes(e.kind) && e.action === 'update')
|
|
261
|
+
.map((e) => ({ id: e.id, label: entryLabel(e), from: e.found ? e.found.commit : null, to: e.expected || null })),
|
|
258
262
|
...(stepExtra || {}),
|
|
259
263
|
};
|
|
260
264
|
if (missing.length === 0) {
|
|
@@ -730,6 +734,7 @@ function renderPlanText(plan, report, { questions = true, header = true } = {})
|
|
|
730
734
|
const actions = toInstall.filter((e) => !declined.has(e.id)).map(actionLine);
|
|
731
735
|
for (const e of report.entries) {
|
|
732
736
|
if (e.action === 'configure') actions.push(`Configure ${entryLabel(e)} (.env)`);
|
|
737
|
+
if (e.action === 'update') actions.push(`Update ${entryLabel(e)}: ${String((e.found && e.found.commit) || '?').slice(0, 7)} → ${String(e.expected || '?').slice(0, 7)}`);
|
|
733
738
|
}
|
|
734
739
|
if (actions.length > 0) {
|
|
735
740
|
lines.push('Actions:');
|
|
@@ -1137,6 +1137,7 @@ function mapEntryToAction(entry, { mode, downloadSpecs }) {
|
|
|
1137
1137
|
return { ...base, type: 'REVIEW', component: 'runtime', name: RUNTIME_LABELS[entry.component] || entry.component };
|
|
1138
1138
|
}
|
|
1139
1139
|
case 'custom_node': {
|
|
1140
|
+
if (entry.action === 'update') return { ...base, type: 'INSTALL', component: 'custom-node', name: entry.name || entry.id, update: true };
|
|
1140
1141
|
if (entry.status === 'installed') return { ...base, type: 'KEEP', component: 'custom-node', name: entry.name || entry.id };
|
|
1141
1142
|
if (entry.requirement !== 'required') return null; // optional/unknown extras are never auto-installed
|
|
1142
1143
|
return { ...base, type: 'INSTALL', component: 'custom-node', name: entry.name || entry.id };
|