> 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 — 0.4.0 development The companion now connects the browser-safe provider/catalog interface to the existing MA client, fenced control and playback provider. It is a separate server artifact; no gateway code or MA credential is bundled into Foundry. Follow [SETUP.md](SETUP.md) for exact isolated-world setup and infrastructure gates. `development-service.mjs` accepts only fixed controller phases: connect, diagnostics, catalog, renew, release, prepare, snapshot, apply, restore and stop. Server-bound campaign/session/target identity, controller role, lease/fence/generation and operation IDs constrain requests. Preparation and raw signed snapshots stay in server memory behind expiring opaque handles. Prepared handles bind their generation; restore handles bind fenced session and expiry. Same-ID changed payloads deny; replayed operations do not issue duplicate effects. Queue selectors, raw media, upstream commands/paths and proxy operations are not accepted from browsers. `development-http.mjs` binds loopback only, with exact Host/Origin, header-only auth, fixed POST routes, bounded headers/body/responses/connections/request rate and queued work. The browser client uses same-origin relative `/adaptive-music-gateway` routes, credentials omitted and no redirects, with capability codes held in memory only. A private HTTPS route is still an operator infrastructure requirement. No public exposure, proxy/firewall change, CORS wildcard or MA Sendspin pass-through exists. This prototype still lacks permanent hosting, durable fencing/process locks and automatic Foundry login verification. Do not expose it publicly. `run-development.mjs` loads protected ignored `.local/` config and pins the prior verified account's sole target, exact name Adaptive Music DEV and provider. It serves five minutes with separate controller/listener grants and starts no playback. Playback defaults off; explicit synthetic opt-in authorizes only generated sequence IDs. Real MA catalog entries remain selectable for configuration but unplayable under the current authorization. There is no automatic household discovery or selection, queue transfer, grouping or new receiver provisioning. The browser package saves separate scene ambient/combat/boss/native-fallback refs, world defaults and explicit boss flags. Native fallback applies before preparation when MA is disconnected, expired or not authorized for that selection. It never bypasses an uncertain active MA target to start overlapping native audio. The controller still uses one base music layer interrupted by combat/boss/manual; concurrent ambient layers and crossfade are not implemented. The existing `ma-provider.mjs` and `ma-client.mjs` retain fixed guarded commands: play_media, play_index, pause, resume, stop, seek, shuffle, repeat and clear. Every mutation rechecks supported queue modes, active queue identity and exact player/ provider/topology, then authority immediately before dispatch. Registered approved media only; no arbitrary URI injection. Ambiguous responses latch the client closed with `uncertain`, without retries or blind restoration. The public MA API cannot atomically bind topology checks to a write; concurrent external changes and restart reconciliation remain development limitations. Signed snapshots preserve ordered duplicate occurrences, index, whole-second position, state and repeat for supported unshuffled static queues. They expire in five minutes and bind campaign/session/fence/generation. Capture repeats bounded pagination; restore stages items, checks order, then seeks/plays and reapplies pause or idle. Shuffle/dynamic/autoplay/overlay/ended/nonstandard-speed restoration is unsupported. Volume is unchanged. Losing topology/authority can prevent recovery; report it rather than bypass guards. Durable recovery still needs further work. Private `.local/catalog-key` and `.local/catalog-namespace.json` give opaque campaign-scoped catalog IDs persistence across companion restarts. Refresh the catalog to rebuild private mappings; back up those files. Secrets/config require 0600 and directory 0700, owner checks and symlink refusal. MA tokens never enter browser assets/settings/flags/storage/URLs/logs. The upstream user role remains broader than read-only and queue reads lack player filtering in pinned source, so gateway boundaries remain essential even with account filters. Separate listener POST /audio accepts listener capabilities only and streams quiet companion-generated PCM; joining causes no MA effects. Expiry/revocation/backpressure closes active sockets. The packaged Web Audio sink validates PCM and starts only on Enable Audio. This is a **synthetic test stream, not MA/Sendspin audio**. A supported public-interface dedicated receiver, private pairing, audited codecs and protocol/time tests are still needed; see `evidence/SENDSPIN-RECEIVER.md` in the repo. Crossfade remains explicitly unavailable in setup and diagnostics. Actual connected live reading: verified DEV target, **11 playlists / 1 radio**, no MA token/endpoint/target ID in browser-facing responses, playback disabled and zero mutations. This exercised a local HTTP client/companion, not Foundry or TLS. New phase/queue restoration tests use an isolated fake MA HTTP server. Earlier live idle-queue controls/restoration and failed synthetic ingestion remain separately recorded; no new playback mutation occurred in this revision.