From a089d3ff5f23d6477272cf99b5f5b65982544099 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 24 Oct 2026 00:28:29 +0200 Subject: [PATCH] README front door and contract: Vili is the Idunn target on Yggdrasil Co-Authored-By: Claude Opus 5.5 --- README.md | 24 +++++++++++++++--------- docs/verse-service-contract.md | 9 ++++++--- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index aa0b66e..d9b3cbd 100644 --- a/README.md +++ b/README.md @@ -4,16 +4,16 @@ Vili is the GameCult Persona animation daemon. It owns the bridge from Persona performance intent to body-motion generation. Its backend is Kimodo, run by Vili's own daemon as a CPU-only Python process tree on -Linux. Admission to Idunn on Yggdrasil is the next cut; until then nothing -supervises Vili. +Linux. On Yggdrasil it is the Idunn target `vili`, at `http://10.77.0.1:8824` over +WireGuard. ## Front Door - **Value:** a supervised path from a text prompt to generated body motion. The daemon spawns one resident Kimodo worker, caps its threads, and returns motion artifacts (`motion.npz`, optional BVH) for a job. - **Problem:** Personas and games need generated motion, but cold per-request model loads cost minutes. One daemon owns job identity, worker lifecycle, the thread budget and artifact references, so callers touch no model state. -- **Entry points:** `scripts/vili-daemon.mjs` (the daemon; `npm start`, `npm run health`, `npm test`), `scripts/kimodo-resident-worker.py` (the worker it spawns), `scripts/kimodo-text-encode.py` (the one-shot encoder child), `POST /motion/generate` (see Motion Generation), `docs/verse-service-contract.md` and `docs/motion-pipeline-target.md`. -- **Live:** the process tree below, run by hand: `POST /motion/generate`, `GET /health`, `GET /operator-state`, and the CultCache service store. It produces `motion.npz` and optional BVH on the SOMA skeleton; there is no FBX export. -- **Planned:** admission to Idunn on Yggdrasil with a locked virtual environment, then FBX export and a text-prompt-to-Unity-clip path with no hand steps (`docs/motion-pipeline-target.md`). +- **Entry points:** `scripts/vili-daemon.mjs` (the daemon; `npm start`, `npm test`), `scripts/idunn-entry.mjs` (the process Idunn runs), `deployment/idunn/recipe.toml` (the sealed release), `gamecult-ops` `runbooks/vili-idunn.md` (provisioning and deploy), `scripts/kimodo-resident-worker.py` (the worker it spawns), `scripts/kimodo-text-encode.py` (the one-shot encoder child), `POST /motion/generate` (see Motion Generation), `docs/verse-service-contract.md` and `docs/motion-pipeline-target.md`. +- **Live:** the process tree below, run by hand for development and tests, and as the Idunn target `vili` on Yggdrasil once its first `idunn up` lands: `POST /motion/generate`, `GET /health`, `GET /operator-state`, and the CultCache service store. It produces `motion.npz` and optional BVH on the SOMA skeleton; there is no FBX export. +- **Planned:** FBX export and a text-prompt-to-Unity-clip path with no hand steps (`docs/motion-pipeline-target.md`). ## Authority @@ -37,8 +37,8 @@ vili-daemon.mjs job intake, worker lifecycle, thread cap, nice 10 kimodo-text-encode.py one child per request with cache misses, on CPU ``` -Setup: `git submodule update --init`; in `vendor/CultLib`, `npm ci --ignore-scripts` and -`npm run build --workspace=packages/cultcache-ts`; then `npm ci` here. The worker +Setup: `git submodule update --init` (CultLib, Kimodo, SOMA-X); in `vendor/CultLib`, `npm ci --ignore-scripts` and +`npm run build --workspace=packages/cultcache-ts` and `--workspace=packages/cultnet-ts`; then `npm ci --install-links` here. The worker needs a Python environment with Kimodo's pins and Kimodo itself importable, and a Hugging Face cache (`/hub`) holding the Llama 3 base, both LLM2Vec adapters and the Kimodo checkpoint. Everything runs offline. @@ -59,7 +59,13 @@ The daemon starts the worker on the first job, on a port the worker binds itself and reports in its ready line, and respawns it after an exit. The worker runs at nice 10 with `torch` limited to `--threads` (also `OMP_NUM_THREADS` and `MKL_NUM_THREADS`), so a shared host keeps its other services. Its log is -`/logs/worker.log`. The daemon owns the whole worker process group: it is killed when the worker exits for any reason, on SIGTERM or SIGINT, and at start-up if a crashed daemon left one (`/worker.pid`). A service unit should also own the tree (systemd `KillMode=control-group`). +`/logs/worker.log`. The daemon owns the whole worker process group: it is killed when the worker exits for any reason, on SIGTERM or SIGINT, and, for a hand-run daemon, at start-up if a crashed predecessor left one (`/worker.pid`). Under Idunn the unit's cgroup owns the tree. + +A hand-run daemon holds its state root through a Unix socket lock, `/daemon.lock`: a second daemon on a live root prints that it is held and exits 2, killing nothing; a lock whose owner died is stale and is taken over. + +### On Yggdrasil + +Idunn runs `node vili/scripts/idunn-entry.mjs --state-root --kimodo-commit ` from a sealed release of three trees: `node`, `vili` (the daemon, worker, child, `node_modules`, cultcache-py) and `python` (python-build-standalone CPython 3.12 with the hash-locked packages, Kimodo, MotionCorrection and SOMA-X installed into it; no venv). The weights are the read-only cache `/srv/vili/models`; state is `/var/lib/gamecult/vili`. Idunn's process write lease is the one writer authority: until the daemon holds it, `POST /motion/generate` answers `503 write-lease-pending` and nothing is written; if the lease is lost the worker tree is killed and it answers `503 write-lease-lost`. Idunn proves readiness with its own `POST /cultnet/snapshot` challenge, answered with a signed runtime presence (an `Origin` is still refused). `POST /motion/generate` refuses any POST that carries an `Origin` or is not `application/json` with `403 cross-site`; no route answers a preflight. @@ -68,7 +74,7 @@ Vili writes daemon-owned state to `.vili/vili.service.cc`: operator state, the command boundary and the transport profile. Jobs are `.vili/jobs/.json`, artifacts `.vili/artifacts//`. -Routes: `GET /health`, `GET /operator-state`, `POST /motion/generate`. +Routes: `GET /health`, `GET /operator-state`, `POST /motion/generate`; under Idunn also `POST /cultnet/snapshot`, Idunn's route challenge. ## Motion Generation diff --git a/docs/verse-service-contract.md b/docs/verse-service-contract.md index fb5edb9..d6171f2 100644 --- a/docs/verse-service-contract.md +++ b/docs/verse-service-contract.md @@ -17,13 +17,16 @@ for Odin and Idunn. The request fields and the runtime flags are in `README.md` ## Witnesses -- `.vili/vili.service.cc`: the daemon-owned CultCache store for operator state, +- `.vili/vili.service.cc` (`/var/lib/gamecult/vili/vili.service.cc` under Idunn): the daemon-owned CultCache store for operator state, the command boundary and the transport profile. - `.vili/jobs/{jobId}.json`: accepted animation job records. - `.vili/artifacts/{jobId}/`: generated motion outputs when generation succeeds. - `.vili/embeddings/text-embeddings.cc`: the worker's text-embedding cache. -- `.vili/worker.pid`: the process group of the running worker, so a restarted - daemon can find and kill a worker its crashed predecessor left behind. +- `.vili/worker.pid`: the hand-run daemon's only: the process group of the running + worker, so a restarted hand-run daemon can find and kill a worker its crashed + predecessor left behind. Under Idunn it is never written; the unit's cgroup owns the tree. +- `.vili/daemon.lock` (hand-run) and Idunn's process write lease (Yggdrasil): the + writer authority for the state root. No state is written before the lease is held. - `.vili/logs/worker.log`: the worker's stdout and stderr. ## Command Boundary