vinylgauntlet/assets/enqueue.py
type-two 8e967407c1 Tier 2 complete: digging, treasure rooms, the Archive, infinite mazes
- Digging: hold E (or DIG touch button) by a crate wall, 2s rooted channel, once
  per tile. Loot: 70% +200 vibe, 25% gold record, 4% grail (full vibe), 1%
  bootleg (every bin on the level erupts).
- Treasure rooms: every 3rd level, 20s bonus room strewn with gold, no enemies,
  booth exits instantly, "CLOSING TIME" when the timer dies.
- THE ARCHIVE (4th theme): FLUX-generated dark tileset, real darkness via
  RenderTexture with radial glow holes at player + lamps, dust mites spawn in
  packs of 3, Mite Queen miniboss (12 HP, broods mites every 5s, airhorn-immune,
  drops 3 gold + 1000 pts). Archive tune pool: 195 dnb/hardcore/breakbeat/
  electro 12"s (718 total tunes now).
- Infinite: levels past the 4 authored maps are deterministic seeded mazes
  (recursive backtracker + loops + rooms), difficulty scales with depth.

All verified in-browser via engine stepping.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 17:35:42 +10:00

55 lines
2.1 KiB
Python

#!/usr/bin/env python3
"""Enqueue Vinyl Gauntlet's asset queue into MODELBEAST as flux_local jobs.
Runs from the MODELBEAST checkout (imports its server modules) and inserts jobs
straight into the jobs table as the owner — the jobs table IS the queue. After
running, restart the MB server (scripts/serve.sh) so the runner picks them up.
cd ~/MODELBEAST && ./venvs/... no — use the app env:
/opt/homebrew/bin/uv run python /path/to/vinylgauntlet/assets/enqueue.py
Writes assets/queue.lock.json mapping job_id -> asset name so outputs can be
collected later from data/jobs/<job_id>/.
"""
import json, sys
from pathlib import Path
MB = Path.home() / "MODELBEAST"
sys.path.insert(0, str(MB))
import server.db as db # noqa: E402
import server.runner as runner # noqa: E402
HERE = Path(__file__).resolve().parent
q = json.loads((HERE / (sys.argv[1] if len(sys.argv) > 1 else "queue.json")).read_text())
styles = q["style"]
defaults = q["defaults"]
con = db.connect()
owner = con.execute("SELECT id FROM users WHERE role='owner' LIMIT 1").fetchone()["id"]
lock = []
for i, item in enumerate(q["items"]):
prompt = f"{item['prompt']}. {styles[item['style']]}"
params = {
"prompt": prompt,
"model": defaults["model"],
"steps": defaults["steps"],
"width": item["w"],
"height": item["h"],
"seed": item.get("seed", 7 + i), # per-asset fixed seed = reproducible
}
job_id = db.new_id()
outdir = runner.JOBS_DIR / job_id
outdir.mkdir(parents=True, exist_ok=True)
con.execute(
"INSERT INTO jobs (id, operator, status, asset_id, asset_ids, params, outdir, created_at, user_id) "
"VALUES (?, 'flux_local', 'queued', NULL, '[]', ?, ?, ?, ?)",
(job_id, json.dumps(params), str(outdir), db.now(), owner),
)
lock.append({"job_id": job_id, "name": item["name"], "seed": params["seed"]})
print(f"queued {item['name']:20s} {job_id}")
con.commit()
(HERE / "queue.lock.json").write_text(json.dumps(lock, indent=2))
print(f"\n{len(lock)} jobs queued. Restart MB to run: cd ~/MODELBEAST && scripts/serve.sh")