Stop idle Comfy after 30 minutes and add a Wake GPU poke.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-08-29 17:59:18 -05:00
co-authored by Cursor
parent cdc69d2bd6
commit ad1f4f905a
8 changed files with 283 additions and 26 deletions
+42
View File
@@ -98,17 +98,59 @@ async function controlRequest(path: string, method = 'GET') {
ok?: boolean
http?: boolean
process?: boolean
processUp?: boolean
asleep?: boolean
lastActivityAt?: string | null
idleMs?: number
pid?: number
started?: boolean
already?: boolean
port?: number | null
proxyPort?: number | null
stopped?: boolean
error?: string
status?: number
}
} catch {
return null
}
}
export async function fetchComfyControlStatus() {
return await controlRequest('/status')
}
export async function requestComfyWake() {
const { controlUrl } = settings()
if (!controlUrl) {
throw createError({
statusCode: 503,
statusMessage: 'COMFY_CONTROL_URL is not set. The studio cannot poke the Beast host agent.'
})
}
const remote = await controlRequest('/start', 'POST')
if (!remote) {
throw createError({
statusCode: 503,
statusMessage: 'Beast host agent is unreachable. Confirm it is running on the desktop.'
})
}
if (remote.ok === false) {
throw createError({
statusCode: Number(remote.status) || 502,
statusMessage: 'Beast host agent refused to start Comfy.'
})
}
return {
ok: true,
started: Boolean(remote.started),
already: Boolean(remote.already),
asleep: false,
port: remote.port ?? null,
proxyPort: remote.proxyPort ?? null
}
}
async function findLocalComfyProcess() {
const platform = process.platform
try {