Release v0.7.0 - Automatic pairing and validated MA audio playback
Validate and generate manual release / package (push) Waiting to run

This commit is contained in:
Jason committed 2026-12-04 08:58:47 -05:00
1 parent 83d168f5a1
commit 1ed30567fb
48 files changed
+2717 -742

No files matched your search

+74 -169
View File
@@ -1,184 +1,89 @@
# Adaptive Music 0.6.0 — setup and manual publication
# Install and connect — 0.7.0
One Foundry module ZIP, ID **adaptive-music**, author **CheddahBoxMB**, targeting
Foundry v14.371 and MA 2.10.6. No other Foundry modules, Docker containers, VMs/LXCs
or mandatory services. Native music can be configured without Music Assistant.
## Normal setup
The user reports v0.5.0 installed/activated with D&D 5e 6.1.2 and both windows
rendering. v0.6.0 has offline/fixture validation; live MA audio remains to be tested.
1. Install or update **Adaptive Music** using the existing Foundry manifest URL.
For the staged acceptance build, extract `adaptive-music.zip` into the existing
Foundry user-data `Data/modules/` directory and reload the isolated test world.
The ZIP contains one `adaptive-music/` directory. Do not install the outer release
bundle or source archive as the module.
2. As the single active GM, open Settings → Adaptive Music setup. Enter the private
trusted **HTTPS Music Assistant server address** and the dedicated account’s access
token, then select **Authenticate**. Use the origin, without a subpath or query.
3. Select **Connect audio**. The module automatically creates or reconnects its own
campaign receiver and pairs it to the authenticated account. No receiver identity
export or JSON backup import is needed. The selector includes only this browser’s
campaign-owned receiver; it does not enumerate household speakers.
4. Assign ambient and combat playlists to the selected scene and save assignments.
World defaults and boss/manual controls are optional. Enable music automation.
5. Players connect automatically. If a browser requires activation, open Campaign
audio and select **Enable Audio** once. Keep one audio tab per account.
## GM setup
The token stays in this tab’s memory, including across failed attempts and setup
window closure. Reload or Disconnect forgets it. Receiver identity is encrypted in
this GM browser’s local storage and reused after reauthentication. A changed MA
origin needs a new login and a separately scoped receiver. Clearing site storage
forgets the receiver. Receiver options can name a new receiver; existing remembered
names remain identity-bound. Forget remembered receiver removes the local identity
only, leaving MA resources and queues untouched.
Open Settings → Adaptive Music setup → Configure music.
Connection recovery → Reconnect remembered receiver reuses this tab’s credentials and preserves the queue while pausing automation. Optional existing STUN/TURN settings are in Receiver options; no public ICE service is enabled by default.
1. Enter the **Music Assistant server address**, using a trusted private HTTPS origin
such as `https://ma.example.test` (placeholder). Use the server origin without a
subpath, query, username or password. The browser uses `wss://…/ws` for control
and `wss://…/sendspin` for receiver audio. It does not use cross-origin HTTP `/api`.
2. Enter a **private GM access token** from an MA account authorized for the dedicated
campaign receiver and music providers. Never give this token to players. It remains
only in this GM tab's memory and is cleared from the input after testing.
3. Import the **existing dedicated receiver's private identity/pairing backup** as JSON
and enter its exact MA player name (default: Adaptive Music DEV). A flat Sendspin
storage map or an existing full private GM profile containing `identityStorage`
is accepted, up to 64 KiB. The map must include `sendspin-identity-sk` and the
associated `sendspin-*` pairing/trust records from that receiver's SDK storage.
Keep the complete backup private; never put it in Foundry settings, module files,
chat or a release. Development backups belong in ignored `.local/`, mode 0600.
4. Confirm dedicated campaign ownership and that MA **VERBOSE raw WebSocket frame
logging is disabled**. The pinned MA source can log token-bearing auth frames
at that level. Review this before connecting; the wizard cannot check remote logs.
5. Optionally allow **catalog playlist playback**. Test connection and load playlists
performs read-only authentication/target/provider/catalog checks, with no queue
mutations. The player selector contains only the receiver verified from the
imported private identity. To select another owned receiver, import its matching
backup and name. Household speakers are never enumerated or selected.
6. Stop the original web receiver before handover. Reconcile the dedicated queue to
**empty and idle** in MA. Select **Connect audio** to start the GM SDK receiver.
If time sync/Noise pairing cannot complete, the operation fails closed. Keep one
active GM and one GM host tab. The GM hears receiver audio; Enable GM audio resumes
the context if the browser suspends it.
7. Select dedicated **Foundry music and fallback** playlists, save ownership and reload
if ownership changed. Reconnect MA after reload. Choose world defaults and a scene's
**ambient playlist**, **combat playlist** and optional Foundry fallback. Save assignments.
Boss and manual controls are in their disclosure. Enable music automation when ready.
Reconnecting to an owned nonempty queue preserves it. Apply the automation setting
when ready to resume scene control. Unknown mutation outcomes stop automation and
require review; they are never silently replayed. Pause is emulated for MA 2.10.6
Sendspin by preserving a stopped queue’s index/position in the active GM session.
Crossfade and restoration after a GM crash/reload are not guaranteed. Old experimental identity-based assignments may need playlist reselection once; the remembered v0.7.0 receiver keeps subsequent catalog references stable.
The module cannot reconstruct a receiver identity from a player name/ID or MA token.
It deliberately does not create/register a new receiver. If you have no matching
private SDK backup, MA audio cannot start; native playback still works. Obtain an
authorized backup from the existing dedicated web receiver's operator. The backup
must come from the SDK/browser instance that owns that receiver, not a server API
player export. No generic export feature or production provisioning is assumed.
Malformed/mismatched identities fail before a receiver connection. Existing pairing
trust must match the MA server; this wizard does not silently enable unpaired access.
## Connection diagnostics
Profiles from v0.5.0 may include catalogKey/namespace to preserve legacy opaque IDs.
Otherwise IDs derive consistently from the imported private identity and world ID.
Scene assignments persist across reconnect/reload and display a saved unavailable
choice while offline. Re-enter GM authentication/import the same backup after reload.
Disconnect clears the private profile, stops automation/forwarding and leaves MA queue
state for review; it does not promise automatic restoration after a crash or disconnect.
Setup displays the actual stage: authentication, Sendspin connection, pairing,
clock sync, catalog or ready. It shows decoded frames, GM audio state and connected
listeners. **Check browser connection (no MA token)** tests both WebSocket routes
from the actual Foundry page and identifies enforced CSP blocks. It does not send
an MA authentication frame; normal browser cookies may still accompany the handshake.
**Copy connection diagnostics** supplies a report without address, token, receiver
keys or playlist titles. No browser developer console is required.
## Players
Players need no MA login, address, receiver identity or pasted invitation. Active
non-GM accounts publish only an ephemeral public key through their own Foundry User
document. The connected GM automatically sends individually encrypted expiring audio
invitations, then WebRTC negotiates audio. If sound is blocked by autoplay, open
Settings → Campaign audio → **Enable Audio** once. Stop Audio opts out until enabled
again. No microphone permission is requested. Use one listening tab per account.
Native Foundry playback uses Foundry's existing browser audio controls.
Invitation renewal and new player logins are automatic while the GM stays online.
The default supports up to eight listeners and uses no external STUN/TURN. A network
failure, suspended browser or expired relay credential may need reconnecting. GM loss
stops forwarding; seamless failover, crash restore and exact listener synchronization
are not promised. Client key/permission/socket behavior still needs live v14 acceptance.
## HTTPS/WSS requirements and diagnostics
| Path | Requirement |
| Result | Action |
| --- | --- |
| Remote browser → Foundry | Trusted HTTPS and working Foundry socket. Web Crypto/Web Locks need a secure context. |
| GM browser → MA control | Trusted private HTTPS origin with WSS upgrade on `/ws`; first-message token auth. |
| GM browser → receiver | Same origin's WSS `/sendspin` route, first-message auth and SDK pairing/trust. |
| Player → MA | No route or credential required. Players talk only to Foundry and the GM's WebRTC peer. |
| GM ↔ player media | A viable WebRTC ICE path; restrictive NAT/firewalls may require an existing approved TURN relay. |
| Enforced CSP block | Have the host administrator review an exact trusted WSS-origin allowance in the existing connect-src policy. Do not remove CSP or allow all origins. |
| Socket fails before opening | Compare this browser’s MA page, private DNS/routing and local-network site permission. Browser APIs conceal the precise HTTP/TLS failure. |
| API auth denied | Enter a valid token; the remembered receiver is retained. |
| Sendspin auth/pair/sync fails | Check the separate authenticated /sendspin route and the account’s web-player control permission. |
| Dedicated queue unavailable after pairing | Retry connecting the remembered receiver after MA has registered its queue. |
| Frames arrive but audio is suspended | Select Enable GM audio or the player’s Enable Audio once. |
| Listener fails negotiation | Check its diagnostics and existing network/ICE route. It is automatically retried after timeout. |
| MA error 2 on playlist startup | MA could not find playable media even if catalog metadata exists. Check that content/provider in MA; this is separate from a WebSocket upgrade failure. |
| Unknown queue write | Review the dedicated queue, then deliberately reconnect; no blind retry occurs. |
HTTPS Foundry cannot use plain HTTP/ws MA in the supported configuration, even if
Sendspin encrypts its payload. The module rejects this, including loopback downgrade.
Remote plain HTTP Foundry is also rejected for GM MA connections. Loopback HTTP is
reserved for offline development, not a remote deployment solution. Browser exceptions
are not a supported workaround. Do not enable insecure content, disable certificate
checks or Web security, or expose an unrestricted MA proxy publicly.
Use trusted HTTPS for Foundry and private HTTPS/WSS for both MA `/ws` and `/sendspin`.
Keep Nginx access restrictions, Origin, certificate validation and browser protections.
Keep MA raw-frame VERBOSE logging disabled. No public API/proxy, core modification,
additional container, service, VM or LXC is required by this module. A direct HTTP MA
address cannot be used from HTTPS Foundry. Default ICE does not use a public relay;
remote players still need a viable existing WebRTC path.
A valid solution uses an **existing private trusted TLS endpoint** reachable from the
GM browser: MA's supported TLS endpoint if already available, or an operator-approved
TLS virtual host on existing infrastructure forwarding the authenticated `/ws` and
`/sendspin` WebSocket routes to the private MA service. Preserve upgrade headers,
Origin and MA authentication; use browser-trusted certificates and private access
control. Both routes must work, not just the MA homepage. The origin is dedicated
because the current client resolves routes from `/`; subpath deployments are unsupported.
No route, certificate, Nginx, firewall or service configuration was changed here.
The user's actual HTTP MA endpoint remains blocked until this TLS prerequisite is
satisfied. There is no release-only JavaScript fix for an unreachable/insecure endpoint.
Ubuntu Firefox and Chromium reached the deployed HTTPS endpoints from the Foundry
origin through normal public DNS resolution. The operator’s Mac instead maps MA to
the private proxy; that private proxy’s TCP 443 route times out from Ubuntu before
TLS. A single temporary VM-to-proxy TCP 443 flow has been proposed to the operator
with rollback in ignored .local/PRIVATE-ROUTE-REQUEST.md; it has not been applied.
No persistent DNS or broad proxy change is requested. The original Mac path remains
unverified. Run TESTING.md’s one acceptance sequence before public publication.
Foundry CSP `connect-src` must permit that private WSS origin. MA/reverse proxy must
accept the Foundry browser Origin without stripping authentication. Browser local-network
permission, private DNS/VPN/routing and certificate trust are separate checks; enabling
CORS on `/api` alone does not solve WSS. Browser WebSocket errors intentionally reveal
little. Diagnostics describe likely causes without logging raw upstream responses/tokens.
Inspect browser network status privately if required; never share token-bearing frames.
## Manual Gitea publication
For WAN ICE, a full private backup may include `listenerNetwork` with `iceServers`
and optional `relayOnly: true`. Use only an existing approved STUN/TURN endpoint and
short-lived TURN username/credential/`expires` (Unix milliseconds, at most one hour).
No silent public relay is configured. Relay-only needs TURN. Renew expired relay
credentials by disconnecting and importing an updated private profile. No additional
service, container, VM or machine is installed. Without a viable ICE path, automatic
setup cannot make audio reach a remote browser.
The existing stable manifest and versioned download mechanism is preserved:
| Diagnostic | Action |
| --- | --- |
| Mixed content / insecure context | Supply trusted HTTPS/WSS; do not bypass browser protections. |
| Identity required / mismatch | Import the matching dedicated SDK identity and pairing backup. |
| Dedicated target denied | Check exact name, account target permission and standalone topology. |
| Reconciliation required | Empty/idle the dedicated queue and stop its other web receiver before handover. |
| No catalog providers/items | Check account provider scopes, library contents and provider availability. |
| WSS unavailable | Check TLS trust, both upgrade routes, Origin/CSP, token and private connectivity. |
| Connected but silent | Check MA playback, mute/volume, GM context, player Enable Audio and ICE connectivity. |
| Authority changed | Use one active GM; stop automation and explicitly reconnect. |
- Manifest: `https://cheddahboxmb.duckdns.org/CheddahBoxMB/adaptive-music/raw/branch/main/module.json`
- v0.7.0 asset: `https://cheddahboxmb.duckdns.org/CheddahBoxMB/adaptive-music/releases/download/v0.7.0/adaptive-music.zip`
Reference: [MDN mixed content](https://developer.mozilla.org/en-US/docs/Web/Security/Defenses/Mixed_content),
[Web Audio practices](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Best_practices),
[WebRTC connectivity](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Connectivity),
[Foundry v14 User documents](https://foundryvtt.com/api/v14/classes/foundry.documents.User.html).
Pinned MA/SDK source provenance is in `evidence/upstream.json` and `vendor/provenance.json`.
The network arrangement above is a deployment requirement, not verified connectivity
or authorization to change production. Any such change needs separate concrete review.
## Advanced development
Settings → Show advanced development controls (client setting, defaults off) reveals
optional companion controller/synthetic test controls and manual listener capability
entry. These are not required for normal operation. Companion source remains in
`gateway/`; no companion or co-located worker is installed or started by the module.
## Build and publish manually to the existing Gitea
The repository and v0.5.0 publication are user-reported. This work did not access,
authenticate to, push to or verify the Git server. Existing manifest URL is preserved.
```sh
python3 scripts/release.py
python3 scripts/release.py --validate dist/releases/v0.6.0/adaptive-music.zip
```
Output `dist/releases/v0.6.0/adaptive-music-release-v0.6.0.zip` contains installable
`adaptive-music.zip`, standalone `module.json`, complete `adaptive-music-source.zip`,
docs, notices/licenses, release metadata and SHA256SUMS. An adjacent `.sha256` checks
the outer bundle. Source metadata identifies the base commit; the included source
archive and its digest identify the actual release sources, including current edits.
Packaging is offline, requires no credentials and never contacts the Git server.
1. Back up the world and existing module. Review CHANGELOG and remaining acceptance
limits. Unpack the outer bundle locally; check SHA256SUMS.
2. Import the **source archive contents** through your normal Gitea/local Git workflow,
preserving directories/notices. Do not upload `.local/`, credentials, node_modules
or deployment files. Prepare on a release branch; keep the old main manifest until
the new versioned asset is available.
3. Create immutable tag/release **v0.6.0** in your existing repository. Upload
**adaptive-music.zip** and **module.json** with those exact attachment names.
The source archive, checksums and outer bundle can be extra review artifacts.
4. Confirm the ZIP is anonymously downloadable with the expected checksum at:
`https://cheddahboxmb.duckdns.org/CheddahBoxMB/adaptive-music/releases/download/v0.6.0/adaptive-music.zip`
5. Promote the generated standalone manifest to **main/module.json** only after the
attachment exists. Preserve the existing stable install/update URL:
`https://cheddahboxmb.duckdns.org/CheddahBoxMB/adaptive-music/raw/branch/main/module.json`
6. Use Foundry Setup → Update Modules, then activate in an isolated v14.371 world
and follow TESTING.md. Do not use the source/outer ZIP as Foundry's module download.
No `compatibility.verified` claim is added based on offline checks or v0.5.0 rendering.
Repository base can be changed offline with `--repository https://github.com/OWNER/REPOSITORY`
and a separate `--output dist/alternate-release`. No URL in this guide was contacted
by this build. No automatic publication or production deployment is performed.
These are the established repository’s URLs; this work never contacted Gitea or
verified public asset availability. After acceptance, manually publish the included
source to your existing repository, create tag/release `v0.7.0`, attach
`adaptive-music.zip` and the included manifest/checksums, and update the branch
manifest only after its versioned asset exists. The outer bundle includes full
source, docs, licenses, metadata and SHA256SUMS. Keep the previous immutable release
assets for rollback. To roll back, restore the prior branch manifest/module ZIP;
MA queues and remembered browser identities are not automatically deleted.