Release v0.6.0 - Music Assistant wizard and automatic listener connections
Validate and generate manual release / package (push) Waiting to run

This commit is contained in:
Jason committed 2026-12-03 20:11:10 -05:00
1 parent 5319177c58
commit eb9536f903
26 files changed
+1553 -764

No files matched your search

+174 -140
View File
@@ -1,150 +1,184 @@
# Adaptive Music 0.5.0 — manual release and installation
# Adaptive Music 0.6.0 — setup and manual publication
Module ID **adaptive-music**, author **CheddahBoxMB**, Foundry generation **14**;
system-independent, no mandatory Foundry modules. Native operation needs only this
module ZIP. No container, VM/LXC, Ubuntu sandbox, core patch or automatically installed
OS service is required. GM-local MA/WebRTC audio remains experimental; limitations
and measured results are in ARCHITECTURE.md and evidence/browser-audio.json.
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.
## Build offline without Git credentials or a remote
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.
From this repository (Python 3 standard library; local Git metadata is optional):
## GM setup
```
Open Settings → Adaptive Music setup → Configure music.
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.
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.
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.
## 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 |
| --- | --- |
| 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. |
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.
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.
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.
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.
| 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. |
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.5.0/adaptive-music.zip
python3 scripts/release.py --validate dist/releases/v0.6.0/adaptive-music.zip
```
This creates `dist/releases/v0.5.0/adaptive-music-release-v0.5.0.zip`. It contains:
`adaptive-music.zip`, standalone `module.json`, `adaptive-music-source.zip`, README,
this INSTALL guide, CHANGELOG, LICENSE, THIRD-PARTY-NOTICES, all vendor license
texts, `release.json` and `SHA256SUMS`. The SDK bundle is committed, so packaging
needs no npm installation, browser download, network, Git token or Git-host access.
The builder never verifies, contacts, creates or pushes a remote repository.
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.
For another host, for example your own public GitHub repository:
```
python3 scripts/release.py --repository https://github.com/OWNER/adaptive-music --output dist/github-release
```
Use a real destination under your control. The generated manifest's `url`, stable
`manifest` and version-specific `download` are changed together. The builder does
not write to the Git host or alter the root manifest. It validates identity, v14
compatibility, import/assets closure, SDK hash, licenses, private-file exclusion and
public HTTPS URL shape locally. This cannot prove that a planned URL exists.
## Upload to the planned Gitea destination manually
Planned repository (existence/access **not checked**):
`https://cheddahboxmb.duckdns.org/CheddahBoxMB/adaptive-music`
1. On your own initiative, use Gitea's web UI to create/confirm that repository and
enable public read access to the source manifest and release attachments. Foundry
must be able to fetch them without Git credentials. This exposes release files,
not MA. This agent has not accessed or authenticated with your Gitea server.
2. Unpack the **source archive**, not the outer release bundle, into the repository
using your normal Git/web upload workflow. Preserve directory structure, notices,
scripts and the generated root `module.json`. Exclude `.local/`, node_modules,
private deployment files and credentials. Do not upload an outer bundle as the
module contents. If web upload cannot preserve folders, use your own local Git
client; no credential is needed by the release builder itself.
3. Create tag/release **v0.5.0** for this version. Keep that tag immutable. Paste the
CHANGELOG entry into the release notes. Do not mark this unverified development
release as Foundry-verified or production-ready.
4. Upload **adaptive-music.zip** and **module.json** as release attachments with
those exact names. Upload source/archive, SHA256SUMS, docs/notices or the full
outer bundle as additional review artifacts. Never use the source ZIP or outer
bundle as the module download attachment.
5. After publishing, manually verify anonymous downloads and checksums. The module
ZIP should resolve at:
`https://cheddahboxmb.duckdns.org/CheddahBoxMB/adaptive-music/releases/download/v0.5.0/adaptive-music.zip`
6. Ensure `main/module.json` is the generated standalone manifest. The stable
installation/update URL is:
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`
This URL is deliberately stable across releases. Do not give Foundry a tag-specific
manifest URL if you expect automatic version discovery.
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.
No URL above was requested by the build/validation process. Uploading/publishing is
manual; no token, remote connection, automatic push or release publication is used.
## Install and update through Foundry
Once the public manifest and release attachments actually exist:
1. In isolated Foundry v14 Setup → Add-on Modules → Install Module, paste the stable
manifest URL above and install. Enable Adaptive Music in the isolated world.
2. Configure Settings → Adaptive Music setup: select dedicated native music playlists,
save ownership/reload, set world/scene ambient/combat/boss/native fallback choices,
then enable automation. Sound effects/AmbientSound are excluded. Automation
defaults off. Test real v14.371 behavior before considering production use.
3. For later versions, preserve the module ID and stable manifest URL. Bump semantic
version in module.json/package.json/lockfile, update CHANGELOG and build a new
immutable tag-specific release. The versioned ZIP URL must change with version.
4. Publish new attachments **before promoting the new standalone manifest to main**.
Prepare on a release branch/tag if needed, leaving the previous main manifest
untouched until assets are available. Never overwrite a previous version's ZIP.
5. Foundry Setup → Update Modules should discover the newer manifest version and
download its new ZIP while keeping world/document settings. This is the standard
update contract and is validated structurally, not measured against your server.
GitHub uses the same ZIP and upload process, with a stable generated manifest at
`https://raw.githubusercontent.com/OWNER/adaptive-music/main/module.json` and ZIP at
`https://github.com/OWNER/adaptive-music/releases/download/v0.5.0/adaptive-music.zip`.
Optional pinned GitHub/Gitea CI workflows only test/build artifacts for manual
publication on an already provisioned runner. They install no runner/service or
runtime infrastructure. CI/host execution has not been validated on your Gitea.
## GM-local MA and WebRTC experiment
The intended module-only path is: private MA → official Sendspin JS SDK in the GM
browser → Web Audio → encrypted WebRTC audio tracks → authorized player browsers.
Foundry module sockets carry only encrypted bounded SDP/control, never continuous
raw audio or an MA token. No STUN/TURN service is silently selected. Per-listener
invitations must be delivered privately, not posted to a module socket/public flag.
The GM must be able to reach MA privately over a browser-allowed secure connection.
An HTTPS Foundry page cannot be assumed to access plain HTTP/ws MA just because the
Sendspin payload is encrypted. CSP, local-network permissions and server Origin policy also apply. The GM-local control adapter uses the official /ws API because HTTP /api CORS preflight is not enabled in the inspected MA pin.
No mixed-content bypass or public MA route is provided. Browser-local MA credentials
are visible to that GM/user and any compromised code running in their browser;
this design does not claim otherwise. Players never receive those credentials.
Developer API (explicit operator actions; no automatic playback on module enable):
- `api = game.modules.get('adaptive-music').api`
- `api.readGMCatalog(profile)` reads through GM-local authentication.
- `api.startGMHost(profile)` must be invoked directly by a user gesture with automation
stopped and the optional companion disconnected. `profile` stays in GM memory.
- `api.inviteListener(userId, {iceServers: []})` creates a unique expiring invitation.
Deliver it over a private authenticated channel to that participant.
- Player gesture: `api.listenWebRTC(invitation)`. No microphone/control channel.
- `api.peerStats()` returns sanitized bandwidth/jitter statistics.
- `api.closeGMHost()` tears down the local host. MA state recovery still requires
the existing guarded bounded test procedure; do not assume tab closure restores MA.
The private profile requires MA origin/token, pinned existing DEV ID/name/provider,
approved providers, a base64 32-byte catalogKey and namespace retained privately,
plus the **existing DEV Sendspin identity and pairing storage**, and `webSocketAuthLogSafe: true` only after verifying that MA raw WebSocket payload logging at VERBOSE is disabled. The pinned server would otherwise log the auth frame/token; no logging configuration was changed or verified here. No real profile is bundled or
stored in world settings/flags/localStorage. `campaign` is supplied by the module.
Use only previously approved generated synthetic sequences and explicit synthetic
playback opt-in; real library playlist playback is a separate authorization gate.
The current sandbox has **no existing DEV private identity**. The module refuses to
register a random replacement or hijack a name-matching player. The GM must privately
supply an authorized export of the existing web player's identity, or separately
approve a new dedicated identity and update the target/account binding. No such
provisioning has occurred. Synthetic files also still need to be reachable by MA.
WebRTC without a configured relay cannot guarantee remote connections behind all
NAT/firewall combinations. TURN, if required, must be an explicitly approved existing
service with short-lived credentials; no new container/VM or service is installed.
The GM's upload scales with listener count and their browser must stay running.
Startup also requires one active GM, a browser Web Lock and a reconciled empty idle test target. Read-only identity checks can inspect the known unavailable target during operator handover; every mutation still rechecks full availability/topology. GM loss stops forwarding, invalidates automation authority and requires explicit
reconciliation/reconnection; no seamless handover or distributed MA fence is claimed.
If browser access/NAT/GM-availability gates cannot be satisfied, an optional minimal
co-located worker on the **existing Foundry host** is the fallback design. Its source
is retained in gateway/ and branch experimental/companion-0.4.0. It is not installed,
started or required by the module. Any host placement, TLS route or manual service
registration needs separate approval; MA remains private. No core modifications.
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.