Replace stale host agent on boot and document one-click Startup install.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+30
-8
@@ -1,6 +1,26 @@
|
||||
# YuE2 music engine
|
||||
|
||||
`engine: "yue2"` is standalone [YuE2](https://github.com/multimodal-art-projection/YuE) (`m-a-p/YuE2-3B` + `m-a-p/YuE2-Vae`). It never submits a Comfy graph. `engine: "yue"` remains YuEGP in code. ACE / ACE 1.5 keep their Comfy workflows.
|
||||
`engine: "yue2"` is the only music engine in the app. Standalone [YuE2](https://github.com/multimodal-art-projection/YuE) (`m-a-p/YuE2-3B` + `m-a-p/YuE2-Vae`). It never submits a Comfy graph. ACE / YuEGP are removed from the picker and generate API; leave ACE Comfy checkpoints on disk.
|
||||
|
||||
## Desktop agent at boot (one click)
|
||||
|
||||
Wrong agent on 8199 → `/yue2/status` returns `{"ok":false,"error":"not found"}` while Comfy images still work.
|
||||
|
||||
Fix once from this clone:
|
||||
|
||||
```powershell
|
||||
.\scripts\install-comfy-host-agent-launchers.ps1
|
||||
```
|
||||
|
||||
That rewrites Desktop, Start Menu, and **Windows Startup** shortcuts to this clone, and retargets the `AIGen Comfy Host Agent` scheduled task when it exists. Each launch **kills** any old `comfy-host-agent` / listener on 8199, then starts `scripts/comfy-host-agent.mjs` (imports `yue2-host.mjs`).
|
||||
|
||||
After install: double-click Desktop **Start Comfy Host Agent**, or reboot. Confirm:
|
||||
|
||||
```text
|
||||
GET http://127.0.0.1:8199/yue2/status → 200 { configured, busy, backend: "yue2" }
|
||||
```
|
||||
|
||||
Do not guess which `node.exe` to kill — the launcher replaces it.
|
||||
|
||||
## What this host already has (5080 desktop)
|
||||
|
||||
@@ -8,7 +28,7 @@ Ran on this machine:
|
||||
|
||||
1. `scripts/setup-yue2.ps1` → checkout + venv + CUDA torch + weight download
|
||||
2. `scripts/cleanup-yue-v1.ps1` → named YuE v1 / YuEGP weight folders removed
|
||||
3. Host agent code mounts `POST/GET /yue2/jobs` (same pattern as `/yuegp/jobs`)
|
||||
3. Host agent mounts `POST/GET /yue2/jobs`
|
||||
|
||||
Paths written:
|
||||
|
||||
@@ -23,7 +43,7 @@ Paths written:
|
||||
|
||||
`aigen-ready.json` points `model` / `vae` at those local folders so Generate does not need a first-click HF pull. CUDA check: `torch 2.11.0+cu128` on `NVIDIA GeForce RTX 5080`.
|
||||
|
||||
After deploying this branch, restart the **desktop host connector** once so it loads `yue2-host.mjs`. Do not restart Coolify from the agent; the user triggers the existing xAIGen-dev Coolify rebuild.
|
||||
After deploying this branch, run the installer above (or the Desktop shortcut) once so 8199 serves YuE2. Do not restart Coolify from the agent; live apps that track `main` rebuild on push.
|
||||
|
||||
## Env vars
|
||||
|
||||
@@ -35,7 +55,7 @@ After deploying this branch, restart the **desktop host connector** once so it l
|
||||
| `YUE2_MODEL` | Local model dir or HF id |
|
||||
| `YUE2_VAE` | Local VAE dir or HF id |
|
||||
|
||||
App uses existing `COMFY_CONTROL_URL` + token. One GPU owner via the shared reservation (Comfy stopped while YuE2 runs). One song. Unload after decode. OOM is visible; no fallback to `yue`.
|
||||
App uses existing `COMFY_CONTROL_URL` + token. One GPU owner via the shared reservation (Comfy stopped while YuE2 runs). One song. Unload after decode. OOM is visible; no ACE/YuEGP fallback.
|
||||
|
||||
## Call path
|
||||
|
||||
@@ -60,19 +80,21 @@ Duration 30–150 s (default 60). One non-empty lyric section (same validation a
|
||||
- `C:\Users\ianjm\Development\YuEGP\inference\xcodec_mini_infer`
|
||||
- `C:\Users\ianjm\Development\YuEGP\aigen-jobs`
|
||||
|
||||
HF cache YuE-s1 / YuE-s2 / xcodec entries were already absent (skipped). ACE checkpoints (`ace_step_v1_3.5b.safetensors`, `ace_step_1.5_turbo_aio.safetensors`) and other Comfy model trees were left alone. `scripts/yuegp-*` and `server/utils/yueGp.ts` remain in git.
|
||||
HF cache YuE-s1 / YuE-s2 / xcodec entries were already absent (skipped). ACE checkpoints (`ace_step_v1_3.5b.safetensors`, `ace_step_1.5_turbo_aio.safetensors`) and other Comfy model trees were left alone on disk.
|
||||
|
||||
## Re-run setup (only if rebuilding the machine)
|
||||
|
||||
```powershell
|
||||
.\scripts\setup-yue2.ps1
|
||||
.\scripts\cleanup-yue-v1.ps1
|
||||
.\scripts\install-comfy-host-agent-launchers.ps1
|
||||
```
|
||||
|
||||
Setup reuses existing `models\YuE2-3B` / `YuE2-Vae` when present, then force-reinstalls CUDA torch after the editable package install.
|
||||
|
||||
## Validation
|
||||
|
||||
- JS: `node --test tests/yue2.test.mjs tests/yuegp.test.mjs`
|
||||
- Python: `py -3 -m unittest tests.test_yue2_worker tests.test_yuegp_worker`
|
||||
- No full song was generated in this agent session.
|
||||
- JS: `node --test tests/yue2.test.mjs`
|
||||
- Python: `py -3 -m unittest tests.test_yue2_worker`
|
||||
- After agent restart: `GET /yue2/status` returns 200.
|
||||
- Do not claim a song generated unless one ran after the agent restart.
|
||||
|
||||
@@ -1,26 +1,48 @@
|
||||
# Installs Desktop + Start Menu shortcuts that start the Comfy host agent
|
||||
# without Cursor. The scheduled task still starts the agent at logon.
|
||||
# Installs Desktop, Start Menu, and Windows Startup shortcuts that start THIS
|
||||
# clone's Comfy host agent (YuE2) and replace any stale process on 8199.
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$root = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
|
||||
$vbs = Join-Path $root 'scripts\launch-comfy-host-agent.vbs'
|
||||
$startPs1 = Join-Path $root 'scripts\start-comfy-host-agent.ps1'
|
||||
if (-not (Test-Path $vbs)) { throw "Missing $vbs" }
|
||||
if (-not (Test-Path $startPs1)) { throw "Missing $startPs1" }
|
||||
|
||||
$shell = New-Object -ComObject WScript.Shell
|
||||
$desktop = [Environment]::GetFolderPath('Desktop')
|
||||
$programs = Join-Path ([Environment]::GetFolderPath('StartMenu')) 'Programs\AIGen'
|
||||
$startup = [Environment]::GetFolderPath('Startup')
|
||||
New-Item -ItemType Directory -Force -Path $programs | Out-Null
|
||||
|
||||
function Save-Shortcut([string]$dir) {
|
||||
$path = Join-Path $dir 'Start Comfy Host Agent.lnk'
|
||||
function Save-Shortcut([string]$dir, [string]$name = 'Start Comfy Host Agent.lnk') {
|
||||
$path = Join-Path $dir $name
|
||||
$lnk = $shell.CreateShortcut($path)
|
||||
$lnk.TargetPath = (Join-Path $env:SystemRoot 'System32\wscript.exe')
|
||||
$lnk.Arguments = "//B `"$vbs`""
|
||||
$lnk.WorkingDirectory = $root
|
||||
$lnk.WindowStyle = 7
|
||||
$lnk.Description = 'Start the AIGen Comfy host agent in the background'
|
||||
$lnk.Description = 'Start THIS AIGen Comfy host agent (YuE2) and replace any stale agent on 8199'
|
||||
$lnk.Save()
|
||||
$path
|
||||
}
|
||||
|
||||
Save-Shortcut $desktop
|
||||
Save-Shortcut $programs
|
||||
$saved = @(
|
||||
(Save-Shortcut $desktop),
|
||||
(Save-Shortcut $programs),
|
||||
(Save-Shortcut $startup 'AIGen Comfy Host Agent.lnk')
|
||||
)
|
||||
|
||||
# Point the scheduled task at this clone when it already exists.
|
||||
$taskName = 'AIGen Comfy Host Agent'
|
||||
$existing = schtasks /Query /TN $taskName 2>$null
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
$hidden = Join-Path $root 'scripts\start-comfy-host-agent-hidden.vbs'
|
||||
$tr = "wscript.exe //B `"$hidden`""
|
||||
schtasks /Change /TN $taskName /TR $tr | Out-Null
|
||||
Write-Host "Updated scheduled task '$taskName' -> $hidden"
|
||||
}
|
||||
|
||||
Write-Host "Installed launchers for $root"
|
||||
$saved | ForEach-Object { Write-Host " $_" }
|
||||
Write-Host ''
|
||||
Write-Host 'One click: double-click Desktop "Start Comfy Host Agent", or log off/on so Startup runs it.'
|
||||
Write-Host 'That replaces any old node on 8199 with this clone (YuE2 /yue2/status).'
|
||||
|
||||
@@ -1,35 +1,14 @@
|
||||
' Start the Comfy host agent with no window. Safe to run when Cursor is closed.
|
||||
' Uses the "AIGen Comfy Host Agent" scheduled task when it exists.
|
||||
' Start THIS clone's Comfy host agent (YuE2). Replaces any stale agent on 8199.
|
||||
' Safe to run at logon / from Startup / Desktop shortcut when Cursor is closed.
|
||||
Option Explicit
|
||||
Dim sh, fso, root, node, agent, rc
|
||||
Dim sh, fso, root, ps1
|
||||
Set sh = CreateObject("WScript.Shell")
|
||||
Set fso = CreateObject("Scripting.FileSystemObject")
|
||||
|
||||
If AgentRunning() Then WScript.Quit 0
|
||||
|
||||
On Error Resume Next
|
||||
rc = sh.Run("schtasks /run /tn ""AIGen Comfy Host Agent""", 0, True)
|
||||
On Error GoTo 0
|
||||
WScript.Sleep 1200
|
||||
If AgentRunning() Then WScript.Quit 0
|
||||
|
||||
root = fso.GetParentFolderName(WScript.ScriptFullName)
|
||||
root = fso.GetParentFolderName(root)
|
||||
node = """C:\Program Files\nodejs\node.exe"""
|
||||
agent = """" & root & "\scripts\comfy-host-agent.mjs"""
|
||||
If Not fso.FileExists(Replace(node, """", "")) Then WScript.Quit 1
|
||||
sh.CurrentDirectory = root
|
||||
sh.Run node & " " & agent, 0, False
|
||||
ps1 = root & "\scripts\start-comfy-host-agent.ps1"
|
||||
If Not fso.FileExists(ps1) Then WScript.Quit 1
|
||||
|
||||
Function AgentRunning()
|
||||
Dim svc, query, item
|
||||
AgentRunning = False
|
||||
Set svc = GetObject("winmgmts:\\.\root\cimv2")
|
||||
Set query = svc.ExecQuery("SELECT CommandLine FROM Win32_Process WHERE Name='node.exe'")
|
||||
For Each item In query
|
||||
If InStr(LCase("" & item.CommandLine), "comfy-host-agent") > 0 Then
|
||||
AgentRunning = True
|
||||
Exit Function
|
||||
End If
|
||||
Next
|
||||
End Function
|
||||
sh.CurrentDirectory = root
|
||||
sh.Run "powershell.exe -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File """ & ps1 & """", 0, False
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
' Launch the Comfy host agent with no console window.
|
||||
' Window style 0 = hidden. Wait = True so Task Scheduler keeps the task marked Running.
|
||||
' Launch the Comfy host agent with no console window (Task Scheduler wait mode).
|
||||
' Replaces any stale agent on 8199, then runs THIS clone's agent until it exits.
|
||||
Option Explicit
|
||||
Dim sh, root, node, agent
|
||||
Dim sh, fso, root, ps1
|
||||
Set sh = CreateObject("WScript.Shell")
|
||||
root = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName)
|
||||
root = CreateObject("Scripting.FileSystemObject").GetParentFolderName(root)
|
||||
node = """C:\Program Files\nodejs\node.exe"""
|
||||
agent = """" & root & "\scripts\comfy-host-agent.mjs"""
|
||||
Set fso = CreateObject("Scripting.FileSystemObject")
|
||||
|
||||
root = fso.GetParentFolderName(WScript.ScriptFullName)
|
||||
root = fso.GetParentFolderName(root)
|
||||
ps1 = root & "\scripts\start-comfy-host-agent.ps1"
|
||||
If Not fso.FileExists(ps1) Then WScript.Quit 1
|
||||
|
||||
sh.CurrentDirectory = root
|
||||
sh.Run node & " " & agent, 0, True
|
||||
' Wait=True so Task Scheduler keeps the task marked Running while the agent lives.
|
||||
sh.Run "powershell.exe -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File """ & ps1 & """ -Wait", 0, True
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
# Replace any stale Comfy host agent, then start THIS clone's agent on 8199.
|
||||
# Called by launch-comfy-host-agent.vbs (Startup / Desktop / Start Menu).
|
||||
# -Wait: run in-foreground for Task Scheduler (keeps task marked Running).
|
||||
param([switch]$Wait)
|
||||
$ErrorActionPreference = 'SilentlyContinue'
|
||||
$root = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
|
||||
$node = 'C:\Program Files\nodejs\node.exe'
|
||||
$agent = Join-Path $root 'scripts\comfy-host-agent.mjs'
|
||||
if (-not (Test-Path $node)) { throw "Missing $node" }
|
||||
if (-not (Test-Path $agent)) { throw "Missing $agent" }
|
||||
|
||||
Get-CimInstance Win32_Process -Filter "Name='node.exe'" |
|
||||
Where-Object { $_.CommandLine -match 'comfy-host-agent' } |
|
||||
ForEach-Object { Stop-Process -Id $_.ProcessId -Force }
|
||||
|
||||
Get-NetTCPConnection -LocalPort 8199 -State Listen -ErrorAction SilentlyContinue |
|
||||
ForEach-Object { Stop-Process -Id $_.OwningProcess -Force }
|
||||
|
||||
Start-Sleep -Milliseconds 400
|
||||
|
||||
if ($Wait) {
|
||||
Set-Location $root
|
||||
& $node $agent
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
$psi = New-Object System.Diagnostics.ProcessStartInfo
|
||||
$psi.FileName = $node
|
||||
$psi.Arguments = "`"$agent`""
|
||||
$psi.WorkingDirectory = $root
|
||||
$psi.UseShellExecute = $false
|
||||
$psi.CreateNoWindow = $true
|
||||
$psi.WindowStyle = [System.Diagnostics.ProcessWindowStyle]::Hidden
|
||||
[void][System.Diagnostics.Process]::Start($psi)
|
||||
Reference in New Issue
Block a user