Docs / game-compose-v0.1

Game Compose manifest v0.1 — SUPERSEDED DRAFT

Source: specs/game-compose-v0.1.md

Status: SUPERSEDED / historical. Do not implement from this document. The authoritative, implemented contract is game-compose.schema.json (apiVersion: gamecomposer.dev/v0.2) as described in docs/GAMECOMPOSER-SPEC.md. This file is retained only to record the design lineage of item 159. Every capability below is a target proposal; nothing here is evidence of an implemented feature or of playability.

No playability claim. There is no launch → input → display E2E pass record for any emulator/game pair. Facts not established by a reviewed artifact are UNKNOWN. The implemented behavior is summarized in the reconciliation table below and in the authoritative spec.

Reconciliation with the implemented v0.2 manifest and SDK

The shipped gamecomposer.yml and both example manifests use apiVersion: gamecomposer.dev/v0.2 with a services mapping. The Python loader (gamecomposer/core.py) validates them against the authoritative schema; gamecomposer/runtime.py implements the Kiri lifecycle. The differences below are intentional and are not to be read as defects in the implementation.

Concept in this v0.1 draft Implemented v0.2 contract Status
apiVersion: gamecompose.dev/v0.1 apiVersion: gamecomposer.dev/v0.2 (schema const) EVIDENCED (schema)
runtime.engine: auto / kiri / docker / podman; "runtime-neutral" runtime.engine: kiri only; no extra keys EVIDENCED (schema, gamecomposer.yml)
File game-compose.yaml; JSON valid after YAML parsing gamecomposer.yml default; .json parsed with json.loads, other suffixes via YAML EVIDENCED (cli.py, core.py)
One services mapping of sessions Same shape retained; 1–64 entries, keys ^[a-z][a-z0-9_-]{0,62}$ EVIDENCED (schema)
depends_on acyclic, topological start / reverse stop Implemented (order, _names, _dependents_outside) EVIDENCED (core.py, runtime.py)
console: platform, model, generation, systemAssets platform (required), model (optional); generation / systemAssets rejected EVIDENCED (schema additionalProperties: false)
environment: OCI image, command, args, workingDir, env, no guest OS os (enum), distribution, exactly one of image / build, command, args, workingDir, env. Only os: linux launches EVIDENCED (schema, _capability_check)
emulator: executable + args (no source) source (path or url+sha256), executable, args EVIDENCED (schema)
game: title, assets[] with license, optional platform title, source, optional platform; no assets / license field EVIDENCED (schema)
Operator-supplied assets; never fetch ROMs during up HTTPS URL sources with required SHA-256 are downloaded and verified during up; local paths also supported EVIDENCED (_source_path)
controls: gamepads + logical mapping Same shape; gamepads > 0 without browser output fails preflight EVIDENCED (schema, _capability_check)
resources: CPU / memory limits cpus, memory; passed to Kiri, enforcement UNKNOWN EVIDENCED (code) / UNKNOWN (enforcement)
storage: saves + writable Same; overlap rejected, mounted at /gamecomposer/{saves,user} EVIDENCED (_ensure_dirs)
network: none baseline, allow with allowlist mode: none or bridge only; no allow / allowlist EVIDENCED (schema)
outputs: local, browser-local, web-stream video / audio: browser-local or none; optional port. No web-stream EVIDENCED (schema)
outputs.web-stream capability-gated remote streaming Not represented in v0.2; native remote streaming is not implemented UNKNOWN / out of scope
Capability list (oci.run, input.gamepad, output.*.web-stream, …) RuntimeAdapter.capabilities() declared but not consulted by the Kiri adapter; no endpoint UNKNOWN (target only)
CLI game-compose config/up/ps/logs/stop/down CLI gamecompose (alias game-compose) with config, up, ps, status, logs, stop, down EVIDENCED (cli.py, pyproject.toml)
Unknown fields are validation errors Enforced by schema additionalProperties: false in Python; TS parser preserves them EVIDENCED / UNKNOWN (TS)

The v0.1 example and prose below remain as a historical record only and are not the contract to implement.


(Original v0.1 draft text follows, unmodified and superseded.)

Game Compose manifest v0.1

Status: Draft proposal. This is a target contract, not an implemented feature. Unsupported fields or capabilities must fail explicitly; adapters must not silently ignore them.

Game Compose is a Compose-like declarative format for bringing up one or more emulated console environments. It does not install an operating system on a physical console, modify console firmware, or promise that arbitrary console hardware can be virtualized. Each service describes the console target, an OCI environment, an emulator process, the game and operator-provided assets, controls, resource limits, storage, network policy, outputs, and lifecycle.

The host/runtime executes the emulator and game. A browser streaming client is separate: requesting web output does not create a video server, remote session, or low-latency input path. Each adapter must advertise and verify those capabilities before launch.

Format and versioning

  • Default filename: game-compose.yaml; JSON is also valid after YAML parsing.
  • Required apiVersion: gamecompose.dev/v0.1.
  • Unknown fields are validation errors. Incompatible changes require a new API version.
  • runtime.engine selects a runtime adapter (auto, kiri, docker, or podman). The manifest contract stays runtime-neutral.
  • Paths are relative to the manifest directory. They must resolve within that project after symlink resolution.
  • Game and system assets are supplied by the operator. The manifest never fetches or redistributes ROMs, BIOS, keys, firmware, or proprietary system files.

Top-level model

services is a mapping of stable service names to independent emulated-console sessions. Service names are identifiers, not display names. Optional depends_on declares startup dependencies. In v0.1 the dependency graph must be acyclic; startup uses topological order and shutdown uses reverse order. A failed dependency prevents dependent services from starting and is reported by name.

Each service contains:

Field Purpose
console Emulated target: platform, optional model/generation, and system files supplied by the operator when needed. This identifies the emulated target; it does not emulate physical hardware by itself.
environment OCI image and process setup: image, command, arguments, working directory, and non-secret environment variables. Pin images by digest for reproducibility.
emulator Emulator executable and argument vector. Values are passed as arguments, never concatenated into a shell command.
game Title, optional platform override, and game assets supplied by the operator. License text is descriptive provenance only.
controls Requested gamepad count and logical button mapping.
resources CPU and memory limits. Limits do not guarantee frame rate or performance.
storage Project-relative save and writable data directories.
network none is the baseline; allow requires explicit destination allowlist.
outputs Requested local, browser-local, or web-stream video/audio sinks. Browser-local means browser-executed emulation through a loopback-served page, not relayed video. Web stream is capability-gated and not implied by OCI execution.
lifecycle Restart behavior and stop grace period.

Example

apiVersion: gamecompose.dev/v0.1
name: retro-room
runtime:
  engine: kiri

services:
  snes-demo:
    console:
      platform: snes
      model: "SNES-compatible"
      generation: "16-bit era"
      systemAssets: []
    environment:
      image: ghcr.io/example/retro-environment:1.0.0
      command: ["/usr/local/bin/session-entry"]
      args: []
      workingDir: /game
      env:
        VIDEO_MODE: fullscreen
    emulator:
      executable: /usr/local/bin/snes-emulator
      args: ["--fullscreen", "/game/roms/0/sample-homebrew.sfc"]
    game:
      title: Sample Homebrew
      assets:
        - path: ./games/sample-homebrew.sfc
          license: "Operator-provided homebrew; verify redistribution terms"
    controls:
      gamepads: 1
      mapping:
        a: south
        b: east
        start: start
        select: back
    resources:
      cpus: 2
      memory: 2GiB
    storage:
      saves: ./data/snes-demo/saves
      writable: ./data/snes-demo/user
    network:
      mode: none
    outputs:
      video: local
      audio: local
    lifecycle:
      restart: never
      stopGraceSeconds: 10

Names and image references are illustrative. The example validates structurally; it does not prove the image exists, that its assets are authorized, or that any runtime can deliver the requested device I/O.

Launch plan

Resolve each OCI image to a platform and digest. Build the process argument vector by appending environment.args and then emulator.executable and emulator.args to environment.command. The environment entry point must launch that emulator and forward stop signals and exit status. An environment image is responsible for emulator-specific flags and configuration. Game Composer passes a normalized controller profile through the chosen device integration and fails preflight when that profile cannot be applied.

Mount each game asset read-only at /game/roms/<zero-based-index>/<filename> and each system asset at /game/system/<zero-based-index>/<filename>. Mount the two declared persistent directories at /game/saves and /game/user. The emulator environment configures its save and user-data destinations to those paths. Use separate writable roots per service and reject overlapping writable roots or writable paths that cover a read-only input.

Proposed CLI behavior

These semantics are proposals for the future CLI, not implemented commands:

  • game-compose config: parse, validate, resolve local paths, and print normalized configuration. It must not pull images or execute commands.
  • game-compose up [SERVICE...]: check all requested runtime capabilities, show planned images/mounts/devices/network policy, then start services in dependency order. Do not partially start dependents when a prerequisite fails.
  • game-compose ps: list declared services and observed state (created, starting, running, stopped, failed, unknown) with runtime identity and last error.
  • game-compose logs [SERVICE...]: stream or retrieve logs for only the selected services; preserve service labels and return runtime errors rather than empty success.
  • game-compose stop [SERVICE...]: stop selected services gracefully; default selection is all running services, in reverse dependency order. Preserve save directories.
  • game-compose down [SERVICE...]: stop services and remove their ephemeral runtime resources. Preserve declared host save/data paths unless the operator explicitly chooses a future destructive cleanup option.

Without service arguments, up selects every service. With explicit service names it includes their transitive dependencies. Validate dependency references and cycles before execution. A dependency is satisfied when the runtime observes its process running. This startup rule does not imply application health or ongoing dependency supervision. A failed start blocks dependents and returns a nonzero status. Previously running services and independently started services remain visible in ps.

stop and down refuse a partial selection that would leave an active dependent outside that selection. For a valid selection, stop dependents first. stop retains runtime objects for inspection or restart and down removes the selected services' owned runtime objects. Both preserve saves and user data.

Repeated up reuses an unchanged running service and starts an unchanged stopped service. For changed configuration, v0.1 reports that explicit teardown is required before relaunch. Serialize mutating commands per project and identify owned objects by a stable project ID tied to the canonical manifest path and service name. V0.1 does not promise cross-host scheduling, remote orchestration, hot image upgrades, online game catalogs, account management, or browser streaming.

Capability negotiation

Adapters report concrete capabilities independently, at minimum: oci.run, resource.cpu, resource.memory, storage.project-relative, network.isolated, input.gamepad, network.egress-allowlist, output.video.local, output.audio.local, output.video.browser-local, output.audio.browser-local, output.video.web-stream, and output.audio.web-stream. Browser-local uses loopback publication and browser-side execution; web-stream carries encoded output from a remote game process. The planner compares each request with the selected adapter and host before any service starts. Missing capabilities produce a named error and no silent fallback.

kiri is an adapter candidate, not a promise of complete game support. Do not mark GPU acceleration, host gamepad access, audio routing, or web-stream output as supported without a real end-to-end integration proving it on that host configuration.

Security and content boundaries

  • V0.1 is for emulated console environments. Physical-console OS replacement and firmware flashing are out of scope.
  • Do not fetch game assets from arbitrary URLs during up. Do not bundle or redistribute copyrighted ROMs, BIOS, keys, firmware, or system files. The operator supplies files they are authorized to use.
  • Resolve and validate every asset/storage path against the project root; reject traversal and symlink escapes.
  • Never run an environment as privileged by default. Never mount the runtime socket, user home, secrets, or arbitrary host directories into a service.
  • Set network.mode: none for the baseline. allow must be explicit, adapter-enforced, and validated; no implicit host networking.
  • Treat environment images as executable supply-chain inputs. Show the resolved image reference/digest before first execution; do not infer trust from a tag name.
  • Never interpolate manifest values into shell text. Use executable plus argument vector and a minimal, explicit environment.
  • Browser control or streaming must use a separately designed authenticated transport; never expose an unauthenticated runtime/control socket.

Back to all docs