Files
adaptive-music/gateway/SETUP.md
T

94 lines
5.9 KiB
Markdown
Raw Normal View History

2026-12-03 16:11:47 -05:00
> Optional experimental companion fallback. The standard module has no mandatory
> companion or sandbox dependency. See ../ARCHITECTURE.md and ../INSTALL.md for
> the 0.5.0 module-only experiment and remaining deployment gates. This guide
> does not authorize host routing, service installation or production changes.
# Private companion setup — 0.4.0-dev
This is a development companion, not a public deployment. It always binds an
ephemeral **127.0.0.1** port, runs for five minutes, and starts no MA playback on
launch. No firewall, reverse proxy, MA service or production Foundry configuration
has been changed by this project. Node 24.23.0 or later; no npm install is needed.
The module and companion are separate artifacts. Extract the module into an isolated
Foundry Data/modules directory. Extract `adaptive-music-companion-dev.zip` on the
operator's private gateway host (or run the repository). All operator data stays in
an owner-controlled `.local/` directory mode 0700, JSON/secret files mode 0600.
The module ZIP contains only browser code; the companion ZIP contains server code
and notices, never actual endpoint configuration or secrets.
For the existing authorized DEV target, provide private `.local/environment.json`
with `ma_url`, `.local/ma-token`, and `.local/ma-readonly-results.json` generated by
the existing approved read-only probe. The launcher pins that verified account's
sole player, exact name Adaptive Music DEV and provider instance. It does not list
or choose household players. Back up `.local/catalog-key` and
`.local/catalog-namespace.json` to retain catalog IDs across restarts. Corrupt or
unsafe existing namespace/key files fail rather than silently changing IDs.
Create `.local/development-gateway.json` with these operator values (placeholders):
```json
{
"foundryOrigin": "https://foundry.example.invalid",
"proxyHost": true,
"syntheticAudio": true,
"enableSyntheticControl": false
}
```
Use the exact isolated Foundry origin, with no trailing slash/path. HTTPS is
required except for localhost development. `proxyHost: true` requires the preserved
Host header to match that origin. With `proxyHost: false`, only the ephemeral
loopback Host is accepted (for local harnesses, not browser deployment). The process
also requires an exact Origin and header-only grants; it rejects arbitrary paths,
query strings, commands, target selectors, oversized bodies and excess requests.
Run `node gateway/run-development.mjs` from the companion/repository root. The
loopback address is written to `.local/development-gateway-runtime.json`, never
browser settings. The operator must already have, or separately approve and review,
a **private same-origin HTTPS route** `/adaptive-music-gateway` from the isolated
Foundry origin to this local companion, preserving Host, Origin and Authorization,
streaming responses without buffering or token/header logging. Preserve every
existing network restriction. No proxy template was applied, no route has been
created and this build does not bypass mixed-content/private-network protections.
A remote browser cannot reach the operator's loopback listener without that
infrastructure. This ephemeral prototype is not suitable for permanent hosting.
Privately deliver `.local/controller-bootstrap.json` to the elected active GM.
In Foundry settings → Configure Settings → Adaptive Music setup, paste the JSON
into the password field and choose **Connect and load MA catalog**. The field is
cleared and the capability stays in memory only. Do not paste an MA token. The
module never receives one. Diagnostics show target availability, catalog contents,
content authorization and the missing Sendspin/crossfade capabilities. Capabilities
expire after five minutes; get a fresh bootstrap after restarting the companion.
Only the elected active GM should connect; other GMs may configure native music.
Set owned native playlists using checkboxes, reload, then configure world defaults
and each scene's ambient, combat, boss and native fallback choices. Boss combatants
can override playlist, priority and inactive state in setup. Enable automation only
after configuration. MA catalog assignments persist as opaque IDs, but real MA
playlist playback remains disallowed under the current synthetic-only authorization.
Unavailable/unapproved MA assignments choose the explicit scene/world native
fallback or silence before preparing playback. A target with uncertain active MA
playback cannot be bypassed by silently starting fallback audio.
`enableSyntheticControl: true` is an explicit operator opt-in for the **existing
approved generated fixtures only**. It requires `.local/fixture-origin.json` and
MA-readable synthetic files; it adds generated ambient/combat sequence choices.
All real MA catalog IDs remain excluded from playback authorization. The earlier
fixture ingestion attempt failed, so this is still an infrastructure gate. Do not
modify existing playlists or select other MA players to work around it.
For browser audio, give listeners `.local/listener-bootstrap.json` privately. They
open **Campaign audio (development)** and press Enable Audio. The separate listener
grant cannot browse catalog, acquire a lease or control queues. This plays the
companion's quiet synthetic PCM tone through Web Audio; it is independent of the
DEV target and does **not** prove Sendspin/MA audio playback. Closing/stopping audio
or capability expiry/revocation closes the stream. Browser rendering and autoplay
still need actual Foundry/browser validation. Joining never changes any MA player.
For Sendspin audio, a separately approved gateway-owned public-interface receiver,
private pairing/identity storage, codec review and termination are still needed.
No direct MA Sendspin proxy is provided. Crossfade and concurrent ambient layers
remain unimplemented, and the UI says so. See TESTING.md/PROGRESS.md in the repository
for exact offline/live evidence. Do not expose this companion publicly.