comfyui-mcp 0.49.0 → 0.49.2
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 +5 -10
- package/dist/comfyui/cloud-client.js +2 -2
- package/dist/comfyui/cloud-client.js.map +1 -1
- package/dist/config.js +22 -0
- package/dist/config.js.map +1 -1
- package/dist/orchestrator/agent-backend.js +9 -0
- package/dist/orchestrator/agent-backend.js.map +1 -1
- package/dist/orchestrator/antigravity-backend.js +3 -2
- package/dist/orchestrator/antigravity-backend.js.map +1 -1
- package/dist/orchestrator/call-tool-admission.js +160 -0
- package/dist/orchestrator/call-tool-admission.js.map +1 -0
- package/dist/orchestrator/chatgpt-oauth-backend.js +3 -2
- package/dist/orchestrator/chatgpt-oauth-backend.js.map +1 -1
- package/dist/orchestrator/claude-backend.js +300 -3
- package/dist/orchestrator/claude-backend.js.map +1 -1
- package/dist/orchestrator/codex-backend.js +3 -2
- package/dist/orchestrator/codex-backend.js.map +1 -1
- package/dist/orchestrator/gemini-backend.js +3 -2
- package/dist/orchestrator/gemini-backend.js.map +1 -1
- package/dist/orchestrator/grok-backend.js +5 -3
- package/dist/orchestrator/grok-backend.js.map +1 -1
- package/dist/orchestrator/index.js +169 -137
- package/dist/orchestrator/index.js.map +1 -1
- package/dist/orchestrator/ollama-backend.js +3 -2
- package/dist/orchestrator/ollama-backend.js.map +1 -1
- package/dist/orchestrator/panel-agent.js +89 -19
- package/dist/orchestrator/panel-agent.js.map +1 -1
- package/dist/orchestrator/panel-tools.js +955 -81
- package/dist/orchestrator/panel-tools.js.map +1 -1
- package/dist/orchestrator/pi-backend.js +3 -2
- package/dist/orchestrator/pi-backend.js.map +1 -1
- package/dist/orchestrator/session-store.js +22 -0
- package/dist/orchestrator/session-store.js.map +1 -1
- package/dist/services/civitai-resolver.js +22 -7
- package/dist/services/civitai-resolver.js.map +1 -1
- package/dist/services/comfy-cli.js +1 -1
- package/dist/services/download-jobs.js +1 -1
- package/dist/services/extra-paths.js +7 -7
- package/dist/services/extra-paths.js.map +1 -1
- package/dist/services/graph-query.js +10 -4
- package/dist/services/graph-query.js.map +1 -1
- package/dist/services/manager-config.js +11 -2
- package/dist/services/manager-config.js.map +1 -1
- package/dist/services/model-resolver.js +4 -4
- package/dist/services/model-resolver.js.map +1 -1
- package/dist/services/node-authoring.js +3 -3
- package/dist/services/node-authoring.js.map +1 -1
- package/dist/services/node-dev.js +3 -3
- package/dist/services/node-dev.js.map +1 -1
- package/dist/services/node-management.js +185 -9
- package/dist/services/node-management.js.map +1 -1
- package/dist/services/node-snapshots.js +117 -12
- package/dist/services/node-snapshots.js.map +1 -1
- package/dist/services/node-verify.js +1 -1
- package/dist/services/node-verify.js.map +1 -1
- package/dist/services/output-dir.js +1 -1
- package/dist/services/output-dir.js.map +1 -1
- package/dist/services/panel-installer.js +466 -6
- package/dist/services/panel-installer.js.map +1 -1
- package/dist/services/panel-pending-cancel.js +446 -0
- package/dist/services/panel-pending-cancel.js.map +1 -0
- package/dist/services/panel-pin-guard.js +50 -3
- package/dist/services/panel-pin-guard.js.map +1 -1
- package/dist/services/panel-sync.js +3 -20
- package/dist/services/panel-sync.js.map +1 -1
- package/dist/services/process-control.js +132 -8
- package/dist/services/process-control.js.map +1 -1
- package/dist/services/queue-manager.js +1 -1
- package/dist/services/queue-manager.js.map +1 -1
- package/dist/services/queue-monitor.js +1 -1
- package/dist/services/queue-monitor.js.map +1 -1
- package/dist/services/queue-monitor.self-attribution.test.js +1 -1
- package/dist/services/queue-monitor.self-attribution.test.js.map +1 -1
- package/dist/services/ui-bridge.js +180 -17
- package/dist/services/ui-bridge.js.map +1 -1
- package/dist/services/update-comfyui.js +29 -2
- package/dist/services/update-comfyui.js.map +1 -1
- package/dist/services/workspace-env.js +3 -3
- package/dist/services/workspace-env.js.map +1 -1
- package/dist/tools/api-nodes.js +1 -1
- package/dist/tools/api-nodes.js.map +1 -1
- package/dist/tools/batches.js +1 -1
- package/dist/tools/batches.js.map +1 -1
- package/dist/tools/compact.js +32 -6
- package/dist/tools/compact.js.map +1 -1
- package/dist/tools/extra-paths.js +1 -1
- package/dist/tools/extra-paths.js.map +1 -1
- package/dist/tools/generate-3d.js +2 -2
- package/dist/tools/generate-3d.js.map +1 -1
- package/dist/tools/install-panel.js +62 -22
- package/dist/tools/install-panel.js.map +1 -1
- package/dist/tools/model-explorer.js +175 -117
- package/dist/tools/model-explorer.js.map +1 -1
- package/dist/tools/queue-management.js +117 -135
- package/dist/tools/queue-management.js.map +1 -1
- package/dist/tools/run-template.js +4 -4
- package/dist/tools/run-template.js.map +1 -1
- package/dist/tools/vocabulary.js +123 -19
- package/dist/tools/vocabulary.js.map +1 -1
- package/dist/tools/workflow-autoload.js +5 -5
- package/dist/tools/workflow-autoload.js.map +1 -1
- package/dist/tools/workflow-execute.js +1 -1
- package/dist/tools/workflow-execute.js.map +1 -1
- package/dist/tools/workspace-env.js +53 -28
- package/dist/tools/workspace-env.js.map +1 -1
- package/docs/design/panel-surface.txt +1 -0
- package/docs/design/tool-surface.txt +3 -0
- package/package.json +2 -2
- package/plugin/commands/batch.md +1 -1
- package/plugin/commands/gen.md +2 -2
- package/plugin/scripts/monitor-progress.mjs +1 -1
- package/plugin/skills/comfyui-core/SKILL.md +15 -13
- package/plugin/skills/director/SKILL.md +1 -1
- package/plugin/skills/ltxv2-video/SKILL.md +1 -1
- package/plugin/skills/troubleshooting/SKILL.md +1 -1
- package/plugin/skills/video-extend/SKILL.md +1 -1
- package/plugin/skills/workflow-layout/SKILL.md +4 -5
- package/scripts/arena-scenarios.mjs +5 -5
- package/scripts/check-tool-vocabulary.mts +9 -0
- package/scripts/gen-tool-docs.ts +31 -10
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
//
|
|
5
5
|
// Policy (decided by the user):
|
|
6
6
|
// - on load → install if MISSING (install-if-missing only, see ensurePanelInstalled).
|
|
7
|
-
// - explicit `update` action → pull the latest nightly on demand.
|
|
7
|
+
// - explicit `update` action → pull the latest nightly on demand. When
|
|
8
|
+
// ComfyUI-Manager provably no-ops the update (stale legacy 3.x, #724) and
|
|
9
|
+
// the panel dir is a real git checkout, fall back to a pinned `git merge --ff-only`
|
|
10
|
+
// on the panel repo, verified on disk by the same #639 machinery.
|
|
8
11
|
// - target version is always "nightly" (the registry git-HEAD channel) — there
|
|
9
12
|
// is no clean semver to diff, so we never churn an existing install on load.
|
|
10
13
|
//
|
|
@@ -16,15 +19,17 @@
|
|
|
16
19
|
// - opt-out env COMFYUI_MCP_PANEL_AUTOINSTALL=0/false disables auto-ensure.
|
|
17
20
|
// - install/update/reinstall queue via ComfyUI-Manager; ComfyUI must be
|
|
18
21
|
// RESTARTED to load the new/updated node (we never auto-restart).
|
|
22
|
+
import { execFileSync } from "node:child_process";
|
|
19
23
|
import { existsSync, lstatSync, readFileSync, readdirSync, realpathSync, statSync, } from "node:fs";
|
|
20
24
|
import { basename, isAbsolute, join } from "node:path";
|
|
21
|
-
import {
|
|
25
|
+
import { isLocalMode } from "../config.js";
|
|
22
26
|
import { logger } from "../utils/logger.js";
|
|
23
27
|
import { parsePyproject } from "./node-authoring.js";
|
|
24
|
-
import { installCustomNode, updateCustomNode, reinstallCustomNode, } from "./node-management.js";
|
|
28
|
+
import { installCustomNode, updateCustomNode, reinstallCustomNode, nonInteractiveGitEnv, } from "./node-management.js";
|
|
25
29
|
import { getSystemStats } from "../comfyui/client.js";
|
|
26
30
|
import { describePanelPin, getPanelPinState, PANEL_PIN_ENV_VAR, } from "./panel-settings.js";
|
|
27
31
|
import { withPanelMutationLock } from "./panel-pin-guard.js";
|
|
32
|
+
import { resolveEffectiveComfyUIBase } from "./workspace-env.js";
|
|
28
33
|
/** Comfy Registry id (also pyproject [project].name). Authoritative for detection. */
|
|
29
34
|
export const PANEL_REGISTRY_ID = "comfyui-agent-panel";
|
|
30
35
|
/** Always install/update/reinstall the panel from the registry git-HEAD channel. */
|
|
@@ -131,9 +136,112 @@ export function resolveGitRevision(dir) {
|
|
|
131
136
|
return undefined;
|
|
132
137
|
}
|
|
133
138
|
}
|
|
139
|
+
/** Hard cap on the #724 fallback git fetch/merge (a fetch + fast-forward). */
|
|
140
|
+
const PANEL_GIT_PULL_TIMEOUT_MS = 180_000;
|
|
141
|
+
/** `git status` is local metadata — a short cap is plenty. */
|
|
142
|
+
const PANEL_GIT_STATUS_TIMEOUT_MS = 30_000;
|
|
143
|
+
/**
|
|
144
|
+
* Run a read-or-mutate git command in the panel checkout, never prompting for
|
|
145
|
+
* credentials (nonInteractiveGitEnv). Returns trimmed stdout. THROWS a
|
|
146
|
+
* PanelInstallError with git's stderr on any failure — a clean exit is the
|
|
147
|
+
* only signal the command actually did its work.
|
|
148
|
+
*/
|
|
149
|
+
function runGit(dir, args, timeoutMs) {
|
|
150
|
+
try {
|
|
151
|
+
const out = execFileSync("git", args, {
|
|
152
|
+
cwd: dir,
|
|
153
|
+
encoding: "utf-8",
|
|
154
|
+
timeout: timeoutMs,
|
|
155
|
+
env: nonInteractiveGitEnv(),
|
|
156
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
157
|
+
});
|
|
158
|
+
return (out ?? "").trim();
|
|
159
|
+
}
|
|
160
|
+
catch (err) {
|
|
161
|
+
const e = err;
|
|
162
|
+
const detail = [e.stdout, e.stderr]
|
|
163
|
+
.map((b) => (b == null ? "" : b.toString()))
|
|
164
|
+
.join("")
|
|
165
|
+
.trim();
|
|
166
|
+
throw new PanelInstallError(`git ${args.join(" ")} in ${dir} failed: ${detail || e.message || "unknown error"}`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* `git status --porcelain` in the panel's checkout — the #724 fallback's
|
|
171
|
+
* CLEANLINESS gate. Empty output = clean; anything else (modified tracked
|
|
172
|
+
* files, staged changes, untracked files) means the fallback must REFUSE:
|
|
173
|
+
* `git pull --ff-only` only refuses local edits that OVERLAP the fast-forward,
|
|
174
|
+
* so edits in untouched paths would be silently carried through our mutation.
|
|
175
|
+
* THROWS when git itself fails, which callers must treat as "cannot prove
|
|
176
|
+
* clean" — never as clean.
|
|
177
|
+
*/
|
|
178
|
+
export function gitStatusPorcelain(dir) {
|
|
179
|
+
return runGit(dir, ["status", "--porcelain"], PANEL_GIT_STATUS_TIMEOUT_MS);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* `git fetch --quiet` — refresh the tracked remote ref without touching the
|
|
183
|
+
* worktree. THROWS a PanelInstallError with git's stderr on any failure.
|
|
184
|
+
*/
|
|
185
|
+
export function gitFetch(dir) {
|
|
186
|
+
runGit(dir, ["fetch", "--quiet"], PANEL_GIT_PULL_TIMEOUT_MS);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* `git merge --ff-only <rev>` in the panel's own checkout — the #724 fallback
|
|
190
|
+
* for hosts where ComfyUI-Manager provably no-ops updates (stale legacy 3.x).
|
|
191
|
+
* The rev is PINNED: the caller fetched once, proved no ignored-file
|
|
192
|
+
* collision against this exact sha, and only then merges it — a `git pull`
|
|
193
|
+
* would fetch AGAIN and could apply a newer, uninspected commit (codex gate).
|
|
194
|
+
* `--ff-only` can only fast-forward: it never merges, never rebases, and
|
|
195
|
+
* refuses a diverged checkout. Callers MUST gate it on gitStatusPorcelain
|
|
196
|
+
* first — a fast-forward does NOT refuse dirty paths it doesn't overlap, and
|
|
197
|
+
* comfyui-mcp never mutates a dirty checkout. THROWS a PanelInstallError with
|
|
198
|
+
* git's stderr on any failure.
|
|
199
|
+
*/
|
|
200
|
+
export function gitMergeFfOnly(dir, rev) {
|
|
201
|
+
return runGit(dir, ["merge", "--ff-only", rev], PANEL_GIT_PULL_TIMEOUT_MS);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* `git rev-parse --show-toplevel` for the #724 fallback: a `.git` pointer
|
|
205
|
+
* proves metadata exists, NOT that this directory is the worktree ROOT — a
|
|
206
|
+
* copied/stale gitdir could make status/pull mutate a sibling checkout while
|
|
207
|
+
* the report credits the panel repo (codex gate). THROWS on any failure;
|
|
208
|
+
* callers refuse unless the resolved root IS the panel dir.
|
|
209
|
+
*/
|
|
210
|
+
export function gitWorktreeRoot(dir) {
|
|
211
|
+
return runGit(dir, ["rev-parse", "--show-toplevel"], PANEL_GIT_STATUS_TIMEOUT_MS).trim();
|
|
212
|
+
}
|
|
213
|
+
/** `git rev-parse @{upstream}` — the sha the checkout tracks. THROWS when no
|
|
214
|
+
* upstream is configured; the "at upstream tip" claim requires this proof. */
|
|
215
|
+
export function gitUpstreamRev(dir) {
|
|
216
|
+
return runGit(dir, ["rev-parse", "@{upstream}"], PANEL_GIT_STATUS_TIMEOUT_MS).trim();
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Ignored-file collision proof for the #724 fallback (codex gate): `git status
|
|
220
|
+
* --porcelain` omits ignored files, and a fast-forward does NOT protect them —
|
|
221
|
+
* when the remote newly tracks a path that is locally ignored, the merge
|
|
222
|
+
* silently overwrites the local file. Intersect the ignored untracked files
|
|
223
|
+
* with the diff HEAD..upstreamRev, where upstreamRev is the SAME pinned sha
|
|
224
|
+
* the caller then merges, so the proof covers the exact mutation. THROWS
|
|
225
|
+
* (PanelInstallError) when the proof cannot be computed — callers treat that
|
|
226
|
+
* as "cannot prove safe", never as safe.
|
|
227
|
+
*/
|
|
228
|
+
export function gitIgnoredPullConflicts(dir, upstreamRev) {
|
|
229
|
+
const ignored = runGit(dir, ["ls-files", "--others", "--ignored", "--exclude-standard", "-z"], PANEL_GIT_STATUS_TIMEOUT_MS)
|
|
230
|
+
.split("\0")
|
|
231
|
+
.filter(Boolean);
|
|
232
|
+
if (ignored.length === 0)
|
|
233
|
+
return [];
|
|
234
|
+
const incoming = new Set(runGit(dir, ["diff", "--name-only", "-z", "HEAD", upstreamRev], PANEL_GIT_STATUS_TIMEOUT_MS)
|
|
235
|
+
.split("\0")
|
|
236
|
+
.filter(Boolean));
|
|
237
|
+
return ignored.filter((f) => incoming.has(f));
|
|
238
|
+
}
|
|
134
239
|
export const defaultDeps = {
|
|
135
240
|
isLocalMode: () => isLocalMode(),
|
|
136
|
-
|
|
241
|
+
// Keep panel management aligned with get_environment, downloads, and
|
|
242
|
+
// comfy-cli: an explicit COMFYUI_PATH wins, then a saved default workspace
|
|
243
|
+
// is a valid local install when this target is not remote (#700).
|
|
244
|
+
comfyuiPath: () => resolveEffectiveComfyUIBase(),
|
|
137
245
|
env: () => process.env,
|
|
138
246
|
existsSync,
|
|
139
247
|
probeFile: (p) => {
|
|
@@ -177,6 +285,12 @@ export const defaultDeps = {
|
|
|
177
285
|
readdir: (p) => readdirSync(p),
|
|
178
286
|
readFile: (p) => readFileSync(p, "utf-8"),
|
|
179
287
|
gitRevision: (dir) => resolveGitRevision(dir),
|
|
288
|
+
gitStatusPorcelain: (dir) => gitStatusPorcelain(dir),
|
|
289
|
+
gitFetch: (dir) => gitFetch(dir),
|
|
290
|
+
gitMergeFfOnly: (dir, rev) => gitMergeFfOnly(dir, rev),
|
|
291
|
+
gitWorktreeRoot: (dir) => gitWorktreeRoot(dir),
|
|
292
|
+
gitUpstreamRev: (dir) => gitUpstreamRev(dir),
|
|
293
|
+
gitIgnoredPullConflicts: (dir, rev) => gitIgnoredPullConflicts(dir, rev),
|
|
180
294
|
readPin: () => getPanelPinState(),
|
|
181
295
|
isReachable: async () => {
|
|
182
296
|
try {
|
|
@@ -580,7 +694,12 @@ function describePanelShadow(canonicalDir, deps) {
|
|
|
580
694
|
`web-served and can win registration by sort order — the browser may load the ` +
|
|
581
695
|
`OLD panel. Move them OUT of custom_nodes, then hard-refresh the ComfyUI tab (#641)`);
|
|
582
696
|
}
|
|
583
|
-
|
|
697
|
+
/**
|
|
698
|
+
* The explicit opt-out applies to every unattended panel mutation. A user who
|
|
699
|
+
* disables on-load installation must not get an automatic version sync later
|
|
700
|
+
* merely because a desktop tab says hello.
|
|
701
|
+
*/
|
|
702
|
+
export function isPanelAutoInstallDisabled(env = process.env) {
|
|
584
703
|
const v = (env.COMFYUI_MCP_PANEL_AUTOINSTALL ?? "").trim().toLowerCase();
|
|
585
704
|
return v === "0" || v === "false" || v === "no" || v === "off";
|
|
586
705
|
}
|
|
@@ -597,7 +716,7 @@ function withTimeout(p, ms) {
|
|
|
597
716
|
});
|
|
598
717
|
}
|
|
599
718
|
async function ensureInner(deps) {
|
|
600
|
-
if (
|
|
719
|
+
if (isPanelAutoInstallDisabled(deps.env())) {
|
|
601
720
|
return {
|
|
602
721
|
action: "skipped",
|
|
603
722
|
reason: "COMFYUI_MCP_PANEL_AUTOINSTALL disabled",
|
|
@@ -845,6 +964,32 @@ export function looksLikeManagerNoOp(details) {
|
|
|
845
964
|
const incoherent = c.total !== undefined && c.done !== undefined && c.done > c.total;
|
|
846
965
|
return nothingEnqueued || incoherent;
|
|
847
966
|
}
|
|
967
|
+
/**
|
|
968
|
+
* The PROVEN legacy-3.x empty-queue signature — the ONLY queue state that may
|
|
969
|
+
* authorize the #724 git fallback (codex gate). total_count, done_count,
|
|
970
|
+
* in_progress_count and is_processing are REQUIRED by the Manager's status
|
|
971
|
+
* contract (QueueStatus in node-management): each must be PRESENT and exactly
|
|
972
|
+
* 0/false — a missing field is unproven, never a default-safe zero. The one
|
|
973
|
+
* optional field, pending_count (absent on legacy 3.x), must be 0 when
|
|
974
|
+
* reported. The broader looksLikeManagerNoOp also matches incoherent counts
|
|
975
|
+
* (done > total), which is fine as a FAILURE diagnostic but must never
|
|
976
|
+
* authorize a git mutation: a partial, malformed, or contradictory response
|
|
977
|
+
* is not proof of the stale-3.x no-op.
|
|
978
|
+
*/
|
|
979
|
+
export function isProvenLegacyEmptyQueue(details) {
|
|
980
|
+
const c = readQueueCounts(details);
|
|
981
|
+
if (!(c.total === 0 && c.done === 0 && c.inProgress === 0 && c.processing === false)) {
|
|
982
|
+
return false;
|
|
983
|
+
}
|
|
984
|
+
// pending_count is optional (absent on legacy 3.x) — but a REPORTED value
|
|
985
|
+
// must be a real numeric 0. A malformed one ("1", null, …) normalizes to
|
|
986
|
+
// undefined in readQueueCounts, which must read as UNPROVEN, not absent.
|
|
987
|
+
if (details && typeof details === "object" && "pending_count" in details) {
|
|
988
|
+
const p = details.pending_count;
|
|
989
|
+
return typeof p === "number" && p === 0;
|
|
990
|
+
}
|
|
991
|
+
return true;
|
|
992
|
+
}
|
|
848
993
|
/**
|
|
849
994
|
* Decide whether an `update` actually advanced the panel on disk. Heart of the
|
|
850
995
|
* #639 fix.
|
|
@@ -924,6 +1069,247 @@ function finalizeUpdate(verdict, post, result) {
|
|
|
924
1069
|
`may be stale (#424). RESTART ComfyUI and re-check the version, or reinstall ` +
|
|
925
1070
|
`the panel from source.`);
|
|
926
1071
|
}
|
|
1072
|
+
/**
|
|
1073
|
+
* The #724 fallback for the update path: ComfyUI-Manager provably no-op'd the
|
|
1074
|
+
* update (the stale legacy-3.x signature), but the panel dir is a REAL git
|
|
1075
|
+
* checkout — so update it without the Manager, exactly like the manual
|
|
1076
|
+
* workaround from the issue (`git pull --ff-only` in the panel repo), then run
|
|
1077
|
+
* the SAME #639 verification over the result (fresh on-disk re-read, #641
|
|
1078
|
+
* shadow scan, proven movement) rather than trusting git's output text.
|
|
1079
|
+
*
|
|
1080
|
+
* Two refusals guard the pull itself:
|
|
1081
|
+
* - DIRTY WORKTREE: a fast-forward only refuses local edits it OVERLAPS, so
|
|
1082
|
+
* the checkout must be PROVEN clean (git status --porcelain) before we
|
|
1083
|
+
* mutate it. Anything else — or a cleanliness check that itself fails —
|
|
1084
|
+
* refuses the fallback rather than carry/clobber local state.
|
|
1085
|
+
* - DIRECTORY BINDING: `dir` is the checkout the pre-op git proof belongs to
|
|
1086
|
+
* (enforced by the caller). The post-pull verification must describe that
|
|
1087
|
+
* SAME directory; a re-detection landing elsewhere makes the pre/post
|
|
1088
|
+
* comparison meaningless and is refused.
|
|
1089
|
+
*
|
|
1090
|
+
* Success still REQUIRES proven movement on disk. The one new honest outcome
|
|
1091
|
+
* is "already current": a pinned `git merge --ff-only` fast-forwarded to the fetched remote and
|
|
1092
|
+
* found HEAD not behind — proof of currency the Manager queue counts could
|
|
1093
|
+
* never give — so that reports "already up to date" (NOT "updated"; nothing
|
|
1094
|
+
* changed, no restart needed). A failed pull throws with BOTH diagnostics; it
|
|
1095
|
+
* never reads as "nothing to pull".
|
|
1096
|
+
*/
|
|
1097
|
+
async function updateViaGitCheckoutFallback(opts) {
|
|
1098
|
+
const { deps, dir, previousVersion, previousRev, result } = opts;
|
|
1099
|
+
// PRE-PULL REVISION GATE — the post-Manager detection's HEAD must be
|
|
1100
|
+
// readable before we mutate. An unreadable revision at this point means the
|
|
1101
|
+
// no-op verdict itself is unprovable (a head-only Manager advance looks
|
|
1102
|
+
// identical), so firing a pull would mutate on a false premise and then
|
|
1103
|
+
// misreport git-applied work or a tip it cannot see (codex gate). Fail
|
|
1104
|
+
// closed BEFORE any mutation, never pull.
|
|
1105
|
+
const prePullRev = deps.gitRevision(dir);
|
|
1106
|
+
if (!prePullRev) {
|
|
1107
|
+
throw new PanelInstallError(`Panel update did NOT apply: ComfyUI-Manager reported the queue drained ` +
|
|
1108
|
+
`but the panel checkout's HEAD revision is unreadable at ${dir}, so ` +
|
|
1109
|
+
`whether it updated (a nightly advance with no version bump) is ` +
|
|
1110
|
+
`UNVERIFIABLE — the git fallback does not fire on an unprovable no-op. ` +
|
|
1111
|
+
`Check the panel repo (git log) and ComfyUI-Manager on the host, then ` +
|
|
1112
|
+
`re-check install_panel(action='status').`);
|
|
1113
|
+
}
|
|
1114
|
+
// WORKTREE-ROOT GATE — `.git` proves metadata exists, not that this dir is
|
|
1115
|
+
// the checkout ROOT. A copied/stale gitdir would let status/pull mutate a
|
|
1116
|
+
// sibling repo and credit the panel with that repo's moved HEAD. Require the
|
|
1117
|
+
// resolved toplevel to BE the panel dir (same path identity as the #641
|
|
1118
|
+
// shadow code). Any failure here is "cannot prove", which refuses.
|
|
1119
|
+
let worktreeRoot;
|
|
1120
|
+
try {
|
|
1121
|
+
worktreeRoot = deps.gitWorktreeRoot(dir);
|
|
1122
|
+
}
|
|
1123
|
+
catch (err) {
|
|
1124
|
+
throw new PanelInstallError(`Panel update did NOT apply: ComfyUI-Manager never enqueued the update (the ` +
|
|
1125
|
+
`stale legacy 3.x silent no-op, #639/#724), and the git fallback is ` +
|
|
1126
|
+
`REFUSED: could not prove ${dir} is the panel repo's worktree root (git ` +
|
|
1127
|
+
`rev-parse failed — ${err instanceof Error ? err.message : String(err)}). ` +
|
|
1128
|
+
`Update the panel repo manually, then RESTART ComfyUI.`);
|
|
1129
|
+
}
|
|
1130
|
+
if (!samePathCI(worktreeRoot, dir, deps)) {
|
|
1131
|
+
throw new PanelInstallError(`Refusing the panel update git fallback: the git worktree root resolves to ` +
|
|
1132
|
+
`${worktreeRoot}, NOT the panel directory ${dir} — status/pull would ` +
|
|
1133
|
+
`mutate a DIFFERENT checkout than the one we verified (a copied or stale ` +
|
|
1134
|
+
`gitdir pointer). Nothing was done; check how the panel dir's .git got ` +
|
|
1135
|
+
`there, then update the correct repo manually and RESTART ComfyUI.`);
|
|
1136
|
+
}
|
|
1137
|
+
// CLEANLINESS GATE — never mutate a dirty checkout. A porcelain failure is
|
|
1138
|
+
// "cannot prove clean", which refuses exactly like a dirty one.
|
|
1139
|
+
let porcelain;
|
|
1140
|
+
try {
|
|
1141
|
+
porcelain = deps.gitStatusPorcelain(dir).trim();
|
|
1142
|
+
}
|
|
1143
|
+
catch (err) {
|
|
1144
|
+
throw new PanelInstallError(`Panel update did NOT apply: ComfyUI-Manager never enqueued the update (the ` +
|
|
1145
|
+
`stale legacy 3.x silent no-op, #639/#724), and the git fallback is ` +
|
|
1146
|
+
`REFUSED: could not confirm the panel repo at ${dir} is clean (git ` +
|
|
1147
|
+
`status failed — ${err instanceof Error ? err.message : String(err)}). ` +
|
|
1148
|
+
`Update the panel repo manually (git pull in ${dir}), then RESTART ComfyUI.`);
|
|
1149
|
+
}
|
|
1150
|
+
if (porcelain !== "") {
|
|
1151
|
+
throw new PanelInstallError(`Refusing the panel update git fallback: the panel repo at ${dir} has ` +
|
|
1152
|
+
`UNCOMMITTED changes or untracked files (git status --porcelain):\n` +
|
|
1153
|
+
`${porcelain}\ncomfyui-mcp never mutates a dirty checkout — a ` +
|
|
1154
|
+
`fast-forward could carry or clobber that local state. Commit, stash, or ` +
|
|
1155
|
+
`discard the changes (or update the panel repo manually), then retry. ` +
|
|
1156
|
+
`(ComfyUI-Manager also no-op'd this update — the stale legacy 3.x ` +
|
|
1157
|
+
`signature, #639/#724 — so updating it on the host restores the Manager ` +
|
|
1158
|
+
`path: git pull in custom_nodes/ComfyUI-Manager, or pip install -U ` +
|
|
1159
|
+
`comfyui_manager.)`);
|
|
1160
|
+
}
|
|
1161
|
+
// PINNED FETCH — fetch ONCE, then bind every later proof and the mutation
|
|
1162
|
+
// itself to the fetched upstream sha. A `git pull` would fetch a SECOND
|
|
1163
|
+
// time; a commit landing between the two fetches could newly track an
|
|
1164
|
+
// ignored local path and slip past the collision proof into the merge
|
|
1165
|
+
// (codex gate). The rev we inspect is the rev we merge — no race.
|
|
1166
|
+
let targetRev;
|
|
1167
|
+
try {
|
|
1168
|
+
deps.gitFetch(dir);
|
|
1169
|
+
targetRev = deps.gitUpstreamRev(dir);
|
|
1170
|
+
}
|
|
1171
|
+
catch (err) {
|
|
1172
|
+
throw new PanelInstallError(`Panel update did NOT apply: ComfyUI-Manager never enqueued the update (the ` +
|
|
1173
|
+
`stale legacy 3.x silent no-op, #639/#724), and the git fallback is ` +
|
|
1174
|
+
`REFUSED: could not fetch/resolve the upstream revision for ${dir} ` +
|
|
1175
|
+
`(${err instanceof Error ? err.message : String(err)}). Update the ` +
|
|
1176
|
+
`panel repo manually (git pull in ${dir}), then RESTART ComfyUI.`);
|
|
1177
|
+
}
|
|
1178
|
+
// IGNORED-FILE GATE — porcelain omits ignored files, but a fast-forward does
|
|
1179
|
+
// NOT protect them: when the remote newly tracks a path that is locally
|
|
1180
|
+
// ignored, the merge silently overwrites the local file (codex gate). Refuse
|
|
1181
|
+
// on any proven collision against the PINNED rev; a proof failure also
|
|
1182
|
+
// refuses (fail closed).
|
|
1183
|
+
let ignoredConflicts;
|
|
1184
|
+
try {
|
|
1185
|
+
ignoredConflicts = deps.gitIgnoredPullConflicts(dir, targetRev);
|
|
1186
|
+
}
|
|
1187
|
+
catch (err) {
|
|
1188
|
+
throw new PanelInstallError(`Panel update did NOT apply: ComfyUI-Manager never enqueued the update (the ` +
|
|
1189
|
+
`stale legacy 3.x silent no-op, #639/#724), and the git fallback is ` +
|
|
1190
|
+
`REFUSED: could not prove the pull would not silently overwrite ignored ` +
|
|
1191
|
+
`local files in ${dir} (${err instanceof Error ? err.message : String(err)}). ` +
|
|
1192
|
+
`Update the panel repo manually (git pull in ${dir}), then RESTART ComfyUI.`);
|
|
1193
|
+
}
|
|
1194
|
+
if (ignoredConflicts.length > 0) {
|
|
1195
|
+
const shown = ignoredConflicts.slice(0, 5).join(", ");
|
|
1196
|
+
const more = ignoredConflicts.length > 5 ? ` (+${ignoredConflicts.length - 5} more)` : "";
|
|
1197
|
+
throw new PanelInstallError(`Refusing the panel update git fallback: ${ignoredConflicts.length} locally-IGNORED ` +
|
|
1198
|
+
`file(s) in ${dir} would be SILENTLY OVERWRITTEN by the fast-forward ` +
|
|
1199
|
+
`(git protects untracked files from checkout, but not ignored ones): ` +
|
|
1200
|
+
`${shown}${more}. Move or delete them (or git add them), then retry — ` +
|
|
1201
|
+
`or update the panel repo manually. (ComfyUI-Manager also no-op'd this ` +
|
|
1202
|
+
`update — the stale legacy 3.x signature, #639/#724.)`);
|
|
1203
|
+
}
|
|
1204
|
+
let gitOutput;
|
|
1205
|
+
try {
|
|
1206
|
+
gitOutput = deps.gitMergeFfOnly(dir, targetRev);
|
|
1207
|
+
}
|
|
1208
|
+
catch (err) {
|
|
1209
|
+
// The Manager no-op'd AND the direct merge failed — name both, truthfully.
|
|
1210
|
+
throw new PanelInstallError(`Panel update did NOT apply: nothing changed on disk at ${dir} (installed ` +
|
|
1211
|
+
`version still ${previousVersion ?? "unknown"}). ComfyUI-Manager never ` +
|
|
1212
|
+
`enqueued the update (the stale legacy 3.x silent no-op, #639/#724), and ` +
|
|
1213
|
+
`the direct git fallback on the panel repo failed too — ` +
|
|
1214
|
+
`${err instanceof Error ? err.message : String(err)}. ` +
|
|
1215
|
+
`Fix: update ComfyUI-Manager on the host (git pull in custom_nodes/` +
|
|
1216
|
+
`ComfyUI-Manager, or pip install -U comfyui_manager) and retry, or update ` +
|
|
1217
|
+
`the panel repo manually (git pull in ${dir}), then RESTART ComfyUI.`);
|
|
1218
|
+
}
|
|
1219
|
+
// The merge ran clean — VERIFY with the same machinery (#639/#641): re-read
|
|
1220
|
+
// the installed identity FRESH from disk, fail closed on a shadow, require
|
|
1221
|
+
// proven movement. Never infer success from git's output.
|
|
1222
|
+
const post = await detectPanelInstall(deps);
|
|
1223
|
+
if (!post.installed || !post.version) {
|
|
1224
|
+
throw new PanelInstallError(`Could not verify the panel update applied: the pack is ${post.installed ? "present but its version is unreadable" : "not present"} at ${dir} after the pinned fast-forward succeeded. NOT reporting success. ` +
|
|
1225
|
+
`Re-check the pack and retry, then RESTART ComfyUI.`);
|
|
1226
|
+
}
|
|
1227
|
+
// DIRECTORY BINDING — the verification must describe the SAME checkout we
|
|
1228
|
+
// pulled; a re-detection resolving a different dir means the pre/post
|
|
1229
|
+
// identity comparison would span two repos. Refuse rather than claim either.
|
|
1230
|
+
if (!post.dir || !samePathCI(dir, post.dir, deps)) {
|
|
1231
|
+
throw new PanelInstallError(`Could not verify the panel update applied: after the pinned fast-forward in ` +
|
|
1232
|
+
`${dir}, re-detection resolved a DIFFERENT panel dir ` +
|
|
1233
|
+
`(${post.dir ?? "none"}), so the before/after comparison would not ` +
|
|
1234
|
+
`describe the checkout that was pulled. NOT reporting success — check ` +
|
|
1235
|
+
`custom_nodes for duplicate or moved panel dirs, then re-check the ` +
|
|
1236
|
+
`installed version.`);
|
|
1237
|
+
}
|
|
1238
|
+
assertNoPanelShadow("update", post.dir, deps);
|
|
1239
|
+
// REVISION PROOF — after a pull, the checkout's HEAD must be READABLE. An
|
|
1240
|
+
// unreadable rev is NOT "at tip": a pull that advanced HEAD without a
|
|
1241
|
+
// version bump would otherwise fall through to "already up to date" with
|
|
1242
|
+
// zero evidence either way (codex gate). Fail closed, never at-tip.
|
|
1243
|
+
if (!post.gitRev) {
|
|
1244
|
+
throw new PanelInstallError(`Could not verify the panel update applied: the pinned fast-forward ran clean ` +
|
|
1245
|
+
`in ${dir}, but the checkout's HEAD revision is unreadable afterward, ` +
|
|
1246
|
+
`so whether it moved (a nightly advance with no version bump) is ` +
|
|
1247
|
+
`UNVERIFIABLE. NOT reporting success and NOT reporting "already at ` +
|
|
1248
|
+
`tip" — check the panel repo (git log), then re-check ` +
|
|
1249
|
+
`install_panel(action='status').`);
|
|
1250
|
+
}
|
|
1251
|
+
const verdict = classifyPanelUpdate({
|
|
1252
|
+
previousVersion,
|
|
1253
|
+
installedVersion: post.version,
|
|
1254
|
+
previousRev,
|
|
1255
|
+
installedRev: post.gitRev,
|
|
1256
|
+
}, result.details);
|
|
1257
|
+
if (verdict.outcome === "updated") {
|
|
1258
|
+
const from = verdict.previousVersion ?? verdict.previousRev?.slice(0, 8) ?? "?";
|
|
1259
|
+
const to = verdict.installedVersion ?? verdict.installedRev?.slice(0, 8) ?? "?";
|
|
1260
|
+
// The embedded result came from the Manager call that no-op'd — its own
|
|
1261
|
+
// message may credit ComfyUI-Manager. The report must not contradict the
|
|
1262
|
+
// git-fallback path that actually did the work (codex gate).
|
|
1263
|
+
const fallbackMessage = `Panel updated (${from} → ${to}) via a pinned git merge --ff-only on the panel repo ` +
|
|
1264
|
+
`(${dir}), verified on disk: ComfyUI-Manager no-op'd the update (stale ` +
|
|
1265
|
+
`legacy 3.x, #724), so the update was applied directly from git. RESTART ` +
|
|
1266
|
+
`ComfyUI to load the updated panel node.`;
|
|
1267
|
+
const honestResult = { ...result, message: fallbackMessage };
|
|
1268
|
+
return {
|
|
1269
|
+
action: "update",
|
|
1270
|
+
result: honestResult,
|
|
1271
|
+
restartRequired: true,
|
|
1272
|
+
message: fallbackMessage,
|
|
1273
|
+
previousVersion,
|
|
1274
|
+
installedVersion: post.version,
|
|
1275
|
+
};
|
|
1276
|
+
}
|
|
1277
|
+
// Nothing moved even though git pull exited clean. Before claiming “at the
|
|
1278
|
+
// upstream tip”, PROVE it: HEAD must equal the tracked upstream sha — a
|
|
1279
|
+
// locally-AHEAD checkout (committed local work) also exits pull cleanly and
|
|
1280
|
+
// would otherwise be blessed as upstream currency (codex gate). No upstream
|
|
1281
|
+
// configured or a mismatch → unverifiable, never “at tip”.
|
|
1282
|
+
let upstreamRev;
|
|
1283
|
+
try {
|
|
1284
|
+
upstreamRev = deps.gitUpstreamRev(dir);
|
|
1285
|
+
}
|
|
1286
|
+
catch {
|
|
1287
|
+
upstreamRev = undefined;
|
|
1288
|
+
}
|
|
1289
|
+
if (!upstreamRev || upstreamRev !== post.gitRev) {
|
|
1290
|
+
throw new PanelInstallError(`Could not verify the panel is current: the pinned fast-forward ran clean in ` +
|
|
1291
|
+
`${dir}, but ${!upstreamRev ? "no upstream is configured, so currency is UNPROVABLE" : `HEAD (${post.gitRev?.slice(0, 8)}) does not match the tracked upstream (${upstreamRev.slice(0, 8)}) — the checkout has committed local work upstream doesn't have`}. ` +
|
|
1292
|
+
`NOT reporting "at upstream tip" and NOT reporting an update. Check the ` +
|
|
1293
|
+
`panel repo (git status / git log), then re-check install_panel(action='status').`);
|
|
1294
|
+
}
|
|
1295
|
+
// HEAD === upstream: git FETCHED the remote and proved the checkout current.
|
|
1296
|
+
// That is genuine proof of currency — report "already up to date" honestly
|
|
1297
|
+
// (NOT "updated"; nothing changed, no restart). The embedded result came
|
|
1298
|
+
// from the Manager call that no-op'd — override its message too, so the
|
|
1299
|
+
// report never credits the Manager for a verification git did (codex gate).
|
|
1300
|
+
const atTipMessage = `Panel is already at the upstream tip (${post.version}) — ComfyUI-Manager ` +
|
|
1301
|
+
`no-op'd the update (stale legacy 3.x, #724), but a pinned git merge ` +
|
|
1302
|
+
`--ff-only on ${dir} verified the checkout is current (git: ` +
|
|
1303
|
+
`${gitOutput || "no output"}). Nothing changed on disk; no restart needed.`;
|
|
1304
|
+
return {
|
|
1305
|
+
action: "update",
|
|
1306
|
+
result: { ...result, message: atTipMessage },
|
|
1307
|
+
restartRequired: false,
|
|
1308
|
+
message: atTipMessage,
|
|
1309
|
+
previousVersion,
|
|
1310
|
+
installedVersion: post.version,
|
|
1311
|
+
};
|
|
1312
|
+
}
|
|
927
1313
|
/**
|
|
928
1314
|
* install/update/reinstall the panel. LOCAL-only and refuses dev symlinks.
|
|
929
1315
|
* Targets the "nightly" channel unless a version is given. Caller must RESTART
|
|
@@ -990,6 +1376,80 @@ export async function runPanelActionInner(action, deps, opts = {}) {
|
|
|
990
1376
|
previousRev,
|
|
991
1377
|
installedRev: post.gitRev,
|
|
992
1378
|
}, result.details);
|
|
1379
|
+
// #724 — the Manager PROVABLY no-op'd (the stale legacy-3.x signature), and
|
|
1380
|
+
// the panel dir is a real git checkout (a pre-op HEAD resolved; a registry
|
|
1381
|
+
// zip has no .git, and a dev symlink was refused above). The verified
|
|
1382
|
+
// Manager path is a dead end on that host tier, so fall back to
|
|
1383
|
+
// a pinned `git merge --ff-only` on the panel repo and verify THAT the same way
|
|
1384
|
+
// instead of only surfacing the error.
|
|
1385
|
+
if (verdict.outcome === "no-op" && previousRev && post.dir) {
|
|
1386
|
+
// SIGNATURE GATE — only the PROVEN empty queue (total 0 AND done 0,
|
|
1387
|
+
// nothing pending/in-progress, not processing) authorizes a git
|
|
1388
|
+
// mutation. The broader no-op signature also matches incoherent counts
|
|
1389
|
+
// (done > total): a malformed or contradictory response is a failure
|
|
1390
|
+
// diagnostic, never proof of the stale-3.x state this fallback exists
|
|
1391
|
+
// to repair (codex gate).
|
|
1392
|
+
if (!isProvenLegacyEmptyQueue(result.details)) {
|
|
1393
|
+
const c = readQueueCounts(result.details);
|
|
1394
|
+
throw new PanelInstallError(`Panel update did NOT apply: nothing changed on disk, and the Manager's ` +
|
|
1395
|
+
`queue counts are NOT the proven legacy-3.x empty-queue signature ` +
|
|
1396
|
+
`(need total 0 AND done 0 with nothing pending/in-progress; got ` +
|
|
1397
|
+
`total=${c.total ?? "?"}, done=${c.done ?? "?"}, pending=${c.pending ?? "?"}, ` +
|
|
1398
|
+
`in_progress=${c.inProgress ?? "?"}) — the git fallback does not fire on ` +
|
|
1399
|
+
`an incoherent or partial signature. Update ComfyUI-Manager on the host ` +
|
|
1400
|
+
`and retry, or update the panel repo manually (git pull in ${post.dir}), ` +
|
|
1401
|
+
`then RESTART ComfyUI.`);
|
|
1402
|
+
}
|
|
1403
|
+
// DIALECT GATE — the empty-queue signature only MEANS "stale Manager 3.x"
|
|
1404
|
+
// on a legacy host. On a v4 host (or with the dialect unproven) the same
|
|
1405
|
+
// signature is an outage/failed enqueue, and a git mutation is not
|
|
1406
|
+
// warranted (codex gate): report the unverified no-op instead of pulling.
|
|
1407
|
+
// Probe the dialect of the SAME Manager the update call used — the
|
|
1408
|
+
// base travels back on the result (a mid-op retarget must not let a
|
|
1409
|
+
// v2-host outage read as 'legacy' from another endpoint, codex gate).
|
|
1410
|
+
let dialect;
|
|
1411
|
+
if (deps.detectManagerDialect) {
|
|
1412
|
+
dialect = await deps.detectManagerDialect(result.managerBase);
|
|
1413
|
+
}
|
|
1414
|
+
else {
|
|
1415
|
+
try {
|
|
1416
|
+
const { detectManagerApi } = await import("./node-management.js");
|
|
1417
|
+
dialect = await detectManagerApi(result.managerBase);
|
|
1418
|
+
}
|
|
1419
|
+
catch {
|
|
1420
|
+
dialect = undefined;
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
if (dialect !== "legacy") {
|
|
1424
|
+
throw new PanelInstallError(`Panel update did NOT apply: nothing changed on disk, and the Manager's ` +
|
|
1425
|
+
`API dialect here is ${dialect ?? "unproven"}, NOT the legacy 3.x whose ` +
|
|
1426
|
+
`silent no-op this matches (#724) — so the git fallback does not fire ` +
|
|
1427
|
+
`(an empty queue on this host is an outage or a failed enqueue, not the ` +
|
|
1428
|
+
`stale-3.x signature). Update ComfyUI-Manager on the host and retry, or ` +
|
|
1429
|
+
`update the panel repo manually (git pull in ${post.dir}), then RESTART ComfyUI.`);
|
|
1430
|
+
}
|
|
1431
|
+
// Bind the fallback to ONE directory: the git proof (previousRev) belongs
|
|
1432
|
+
// to the ORIGINAL detection, so the pull and the post verification must
|
|
1433
|
+
// target that same checkout. A re-detection that resolves a DIFFERENT
|
|
1434
|
+
// panel dir means the two reads disagree about what "the panel" is —
|
|
1435
|
+
// pulling there could mutate a repo we never proved, so refuse.
|
|
1436
|
+
if (!detection.dir || !samePathCI(detection.dir, post.dir, deps)) {
|
|
1437
|
+
throw new PanelInstallError(`Panel update did NOT apply: ComfyUI-Manager never enqueued the update ` +
|
|
1438
|
+
`(the stale legacy 3.x silent no-op, #639/#724), and the git fallback ` +
|
|
1439
|
+
`is REFUSED: the panel dir re-detected after the Manager call ` +
|
|
1440
|
+
`(${post.dir}) is not the checkout the pre-update git proof belongs ` +
|
|
1441
|
+
`to (${detection.dir ?? "unresolved"}). Pulling it could mutate the ` +
|
|
1442
|
+
`WRONG repo, so nothing was done. Check custom_nodes for duplicate ` +
|
|
1443
|
+
`or moved panel dirs, then retry.`);
|
|
1444
|
+
}
|
|
1445
|
+
return updateViaGitCheckoutFallback({
|
|
1446
|
+
deps,
|
|
1447
|
+
dir: detection.dir,
|
|
1448
|
+
previousVersion,
|
|
1449
|
+
previousRev,
|
|
1450
|
+
result,
|
|
1451
|
+
});
|
|
1452
|
+
}
|
|
993
1453
|
return finalizeUpdate(verdict, post, result);
|
|
994
1454
|
}
|
|
995
1455
|
// install / reinstall. Same final pin check as the update path above.
|