Move library collections as a group and map v2 identity refs.

Collapsed collection actions now move, rename, delete, and rerun every part so chains stay together. Identity mode follows the v2u3 Ref2VA picture wiring.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-08-26 22:56:37 -05:00
co-authored by Cursor
parent f54e8da857
commit e334cb7a7a
28 changed files with 1125 additions and 293 deletions
+32 -4
View File
@@ -129,6 +129,8 @@ function inputRoots() {
const roots = [
process.env.COMFY_INPUT_DIR || join(local, 'Comfy-Desktop', 'ComfyUI-Shared', 'input')
]
const cwd = process.env.COMFY_LAUNCH_CWD
if (cwd) roots.push(join(cwd, 'input'))
const installs = join(local, 'Comfy-Desktop', 'ComfyUI-Installs')
try {
for (const dir of readdirSync(installs, { withFileTypes: true })) {
@@ -136,7 +138,14 @@ function inputRoots() {
roots.push(join(installs, dir.name, 'ComfyUI', 'input'))
}
} catch { /* ignore */ }
return roots
return [...new Set(roots)]
}
function outputRoots() {
const roots = [sharedRoots().output]
const cwd = process.env.COMFY_LAUNCH_CWD
if (cwd) roots.push(join(cwd, 'output'))
return [...new Set(roots)]
}
function safeFile(root, subfolder, filename) {
@@ -171,7 +180,6 @@ function readJson(req) {
}
function purgeDesktopFiles(body) {
const roots = sharedRoots()
const deleted = []
const imageName = String(body?.imageName || body?.filename || '')
const imageSub = String(body?.imageSubfolder || '')
@@ -189,8 +197,28 @@ function purgeDesktopFiles(body) {
const video = body?.video || null
const videoName = String(video?.filename || '')
if (videoName) {
const outputPath = safeFile(roots.output, video.subfolder || 'video', videoName)
if (removeFile(outputPath)) deleted.push(outputPath)
for (const root of outputRoots()) {
const nested = safeFile(root, video.subfolder || 'video', videoName)
if (removeFile(nested)) deleted.push(nested)
const flat = safeFile(root, '', videoName)
if (removeFile(flat)) deleted.push(flat)
}
}
const output = body?.output || null
const outputName = String(output?.filename || '')
if (outputName) {
const type = String(output?.type || 'output')
const sub = String(output?.subfolder || '')
const rootsForType = type === 'input' ? inputRoots() : outputRoots()
for (const root of rootsForType) {
if (!existsSync(root)) continue
const nested = safeFile(root, sub, outputName)
if (removeFile(nested)) deleted.push(nested)
if (sub) {
const flat = safeFile(root, '', outputName)
if (removeFile(flat)) deleted.push(flat)
}
}
}
console.log(JSON.stringify({ src: 'comfy-host-agent', event: 'purge', deleted: deleted.length, files: deleted.map((path) => basename(path)), imageName }))
return { ok: true, deleted }