Release v0.6.0 - Music Assistant wizard and automatic listener connections
Validate and generate manual release / package (push) Waiting to run
Validate and generate manual release / package (push) Waiting to run
This commit is contained in:
1 parent
5319177c58
commit
eb9536f903
26 files changed
+1553
-764
No files matched your search
+98
-176
@@ -1,193 +1,115 @@
|
||||
# Adaptive Music architecture — 0.5.0 local release candidate
|
||||
# Adaptive Music architecture — 0.6.0
|
||||
|
||||
Independent project by **CheddahBoxMB**, system-independent, targeting Foundry
|
||||
**v14.371** and MA **2.10.6**. Standard distribution is **one Foundry module ZIP**
|
||||
with a stable Git-hosted manifest and immutable version-specific download URL.
|
||||
No mandatory Foundry modules, containers, VMs/LXCs, sandbox runtime, core patches,
|
||||
OS-service installer, subscription or telemetry. Planned Gitea URLs are configured
|
||||
but the host/repository has not been contacted or confirmed to exist.
|
||||
Independent project by CheddahBoxMB, system-independent, targeting Foundry v14.371
|
||||
and MA 2.10.6. Standard distribution is one Foundry module ZIP. No additional module,
|
||||
container, VM/LXC, OS service, subscription, telemetry or core patch is required.
|
||||
The user reports successful v0.5.0 publication/install/activation and window rendering;
|
||||
this revision's live MA/Foundry audio is not verified.
|
||||
|
||||
## Decision after reevaluation
|
||||
## Connection and catalog
|
||||
|
||||
The 0.4.0 companion is **not a mandatory architecture**. Native playback and all
|
||||
scene/world/combat/boss/manual rules remain entirely module-local. The preferred
|
||||
MA experiment is a trusted GM-browser host using the official Sendspin browser
|
||||
SDK, Web Audio and WebRTC audio tracks. Its feasibility is conditional on secure
|
||||
private MA reachability, an authorized existing receiver identity, GM availability,
|
||||
participant capabilities and a working ICE path. It cannot yet be represented as
|
||||
reliable module-only remote MA audio for arbitrary networks.
|
||||
`connection-wizard.mjs` mounts into the GM ApplicationV2 setup. It collects the MA
|
||||
origin, private access token, exact dedicated receiver name, existing private
|
||||
identity/pairing backup and ownership/logging/playback acknowledgments. There are
|
||||
no credential-bearing world settings, localStorage entries, URLs or logs. The private
|
||||
connection profile lives in module closure memory until disconnect/reload. A trusted
|
||||
GM can inspect their own browser memory; all same-origin code must be trusted.
|
||||
|
||||
The validated companion remains under `gateway/` and local branch
|
||||
`experimental/companion-0.4.0`; provider/catalog/restoration code is preserved.
|
||||
Shared Web Crypto transport/provider implementations now serve both GM and optional
|
||||
companion, with compatibility exports at the original gateway paths. All original
|
||||
regressions remain. If the browser gates cannot be met, propose one manually run,
|
||||
restricted process **co-located on the existing Foundry host**. No new machine,
|
||||
container or automatic service is proposed or deployed. Placement/routing and any
|
||||
manual service registration require explicit approval after concrete review.
|
||||
The pinned SDK derives the one known receiver ID from the imported X25519 private
|
||||
identity. The wizard queries only `players/get` for that ID, checks the exact name
|
||||
and Sendspin provider, then validates standalone topology with the shared MA client.
|
||||
It never enumerates household players or registers a new receiver. The selector
|
||||
contains only this verified imported receiver; import a different authorized backup
|
||||
to select a different dedicated receiver. Selection alone grants no household control.
|
||||
Read-only setup allows the existing receiver to be unavailable during handover; writes
|
||||
still require an available/enabled standalone target with its own active queue.
|
||||
|
||||
A fixed `providers` read filtered to music supplies account-authorized provider IDs.
|
||||
The existing bounded catalog reader paginates library playlists/radios, validates
|
||||
provider mappings and returns opaque HMAC references and display names. Normal
|
||||
selectors show playlists; radio and synthetic transport remain outside normal setup.
|
||||
Catalog keys derive from the private identity and world ID, so reconnecting with the
|
||||
same identity/world preserves selections. A full legacy profile can retain its
|
||||
catalogKey/namespace. Saved references never contain upstream URIs or credentials.
|
||||
|
||||
The `/ws` API uses first-message token authentication and bounded correlated responses;
|
||||
`/sendspin` uses first-message authentication followed by official SDK Noise transport.
|
||||
No HTTP CORS dependency or arbitrary MA proxy is introduced. The SDK/dependency
|
||||
versions, hashes and licenses remain unchanged from v0.5.0. No upstream install hooks.
|
||||
|
||||
## Audio and automatic listeners
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
F[Foundry scene and combat policy] --> C[Existing serialized controller]
|
||||
C --> N[Owned native playlist provider]
|
||||
C --> M[Shared guarded MA provider in trusted GM browser]
|
||||
M -->|private authenticated API WebSocket| A[Private MA 2.10.6]
|
||||
A -->|authenticated Sendspin to pinned existing identity| S[Official SDK in GM browser]
|
||||
S --> W[Web Audio MediaStream]
|
||||
W -->|DTLS SRTP media tracks| P[Authorized player browsers]
|
||||
G[Foundry module socket] <-->|bounded encrypted SDP only| S
|
||||
G <-->|bounded encrypted SDP only| P
|
||||
C[Scene and combat controller] --> N[Owned Foundry playlists]
|
||||
C --> G[Guarded provider in GM browser]
|
||||
G -->|Private authenticated WSS| MA[Music Assistant]
|
||||
MA -->|Authenticated Sendspin| S[GM SDK and Web Audio]
|
||||
S -->|DTLS SRTP audio| P[Active player browsers]
|
||||
U[Permission controlled User public keys] --> E[Encrypted invitation bootstrap]
|
||||
E --> P
|
||||
S <-->|Encrypted bounded SDP via Foundry module socket| P
|
||||
```
|
||||
|
||||
No raw audio or MA token uses the ordinary module socket. No MA HTTP/WS/Sendspin
|
||||
proxy is exposed to players. No microphone is requested and no RTC control data
|
||||
channel is accepted. A GM's credentials are **not hidden from that GM/browser user**;
|
||||
all code executing in that browser origin must be trusted. Other player browsers
|
||||
never receive the MA credential, SDK identity, private queue snapshots or endpoint.
|
||||
At ready each client generates a memory-only non-extractable P-256 private key and
|
||||
publishes only its public key and random epoch to its own User document flag.
|
||||
Foundry's server-enforced User update permissions are the authentication boundary;
|
||||
socket `from`/`isGM` claims alone are never trusted. The single active GM derives an
|
||||
AES-GCM key by ECDH with the intended active non-GM's current document public key.
|
||||
Only an encrypted expiring audio invitation is broadcast, bound to world, sender,
|
||||
recipient and both epochs. Players authenticate against the current active GM's
|
||||
User public key. Tampering, unknown fields, replay, wrong world/recipient/epoch,
|
||||
expired capability and role changes fail closed. Document permission behavior must
|
||||
also be checked with distinct users in real Foundry before live acceptance.
|
||||
|
||||
## What is measured
|
||||
The invitation contains a unique per-peer 256-bit capability, never MA credentials,
|
||||
SDK keys or endpoint. The existing SignalCodec then encrypts/authenticates bounded
|
||||
SDP/ICE/DTLS signaling with session/peer/direction/sequence/expiry binding. Audio uses
|
||||
WebRTC audio tracks, never PCM over Foundry sockets. No microphone, video or data
|
||||
channel. Up to eight peers; fresh invites replace each user's prior peer. Invitations
|
||||
last 30 minutes and renew after 20 minutes; failed peers are retried on the 15-second
|
||||
reconciliation timer. New logins/key epochs trigger delivery. Default ICE servers
|
||||
are empty. Optional private backup `listenerNetwork` holds explicit ICE settings.
|
||||
|
||||
`evidence/browser-audio.json`: actual Chromium **143.0.7499.4**, two independent
|
||||
listener browser contexts, original 440 Hz synthetic PCM encoded in Sendspin binary
|
||||
frames and decoded by the pinned official SDK, Web Audio -> WebRTC -> HTMLAudio /
|
||||
listener analyser. Both listeners had signal after **1,757 ms**, FFT peak **445.3125
|
||||
Hz** (bin resolution around the 440 Hz source), RMS about **0.054**, aggregate GM RTP
|
||||
payload **42.3 kbps** over **4.766 seconds**. Four encrypted signaling messages,
|
||||
maximum **2,078 bytes**; no audio on the signaling channel. Localhost, no TURN, no
|
||||
MA/Noise handshake, no real Foundry socket, no hardware audibility claim, no WAN,
|
||||
interlistener skew or long-run drift measurement. These are synthetic path results,
|
||||
not MA playlist playback or synchronization verification.
|
||||
The listener automatically negotiates and attempts playback. If autoplay is denied,
|
||||
Campaign audio → Enable Audio uses a direct click. Stop Audio opts out until Enable
|
||||
Audio. The same HTMLAudioElement survives normal renewals. Latest tab publishing a
|
||||
User key receives subsequent invitations; use one audio tab per account. Reloads,
|
||||
network failures, browser suspends and relay expiry can require reconnecting.
|
||||
The GM also hears decoded audio and can resume their AudioContext through the UI.
|
||||
|
||||
Live dedicated target/queue reads still verify the existing DEV identity and an
|
||||
empty idle queue. `module-only-prerequisites.json`: the configured MA origin is
|
||||
HTTP, the HTTPS-host access policy rejects it as mixed content, and no authorized
|
||||
DEV private SDK identity is available locally. **Zero new Sendspin connections,
|
||||
identities or playback mutations.** Earlier read-only catalogs and bounded idle
|
||||
controls remain separate evidence; synthetic ingestion previously failed.
|
||||
## Policy, authority and fallback
|
||||
|
||||
## Browser access and GM-local authentication
|
||||
Manual override/silence > explicit eligible boss > started scene combat > scene
|
||||
ambient > world default > silence. Scene/world flags and module settings persist
|
||||
ambient/combat/boss/native fallback references. Legacy assignments and native ownership
|
||||
remain supported. Effects and AmbientSound documents are outside the owned music set.
|
||||
Bosses use explicit module flags, not system actor schemas. Boss/manual controls are
|
||||
in a disclosure; companion/synthetic/manual capability tools require advanced development.
|
||||
|
||||
`GMAudioHost` uses a private, memory-only profile supplied by the GM, with canonical
|
||||
MA origin, dedicated target ID/name/provider, approved provider filter, catalog key/
|
||||
namespace and existing SDK identity/pairing storage. Nothing is saved into Foundry
|
||||
settings, flags, browser localStorage, module socket or a release. Catalog IDs remain
|
||||
HMAC-derived and stable when the operator retains the same private key/namespace.
|
||||
Explicit catalog playback opt-in enables registered static catalog playlists through
|
||||
the existing serialized guarded provider. Dynamic/shuffled/autoplay/overlay/ended or
|
||||
nonstandard speed states remain unsupported. Every mutation checks campaign/session/
|
||||
generation, current authority, exact target/name/provider, standalone topology and own
|
||||
active queue. Startup requires an empty idle queue. Signed five-minute snapshots retain
|
||||
ordered duplicates, index, whole-second position, pause/state and repeat. Ambiguous
|
||||
writes latch closed; no blind retry or arbitrary queue transfer/group/global stop.
|
||||
Native fallback uses only explicitly owned Foundry playlists and does not reconcile
|
||||
an uncertain active MA target automatically.
|
||||
|
||||
The official public `/ws` control API avoids dependence on cross-origin HTTP `/api`
|
||||
preflight, which is not configured for that route in the inspected MA pin. The same
|
||||
fixed client command allowlist, response bounds, timeout, redirect policy, target
|
||||
checks and registered-media rules are preserved through the WebSocket adapter.
|
||||
Its initial auth command carries the GM's token in a private connection, never a
|
||||
URL; unsolicited events are discarded. The Sendspin `/sendspin` connection uses
|
||||
the official frontend's first-message auth pattern, then the official SDK's Noise
|
||||
transport. The SDK's fixed roles include controller/metadata; it runs only in the
|
||||
trusted GM host, never as a supposedly restricted player listener.
|
||||
A single active GM plus same-origin Web Lock excludes common duplicate GM tabs.
|
||||
This is not a distributed MA server-side fence. Foundry disconnect/GM role loss ends
|
||||
forwarding and writes; it does not guarantee crash restoration. No seamless GM
|
||||
handover, long-run drift/synchronization guarantee, crossfade or simultaneous layers.
|
||||
The optional companion remains in gateway/ as development source. No host worker or
|
||||
TLS route is installed; any production change requires separate authorization.
|
||||
|
||||
A source-derived privacy gate matters: pinned MA `websocket_client.py` logs raw
|
||||
received frames at VERBOSE, including auth. The GM profile requires an explicit
|
||||
operator `webSocketAuthLogSafe` acknowledgment after ensuring such payload logging
|
||||
is disabled. This has **not** been verified live or changed by the agent. No live
|
||||
WebSocket token test was attempted. The module logs no credential and does not
|
||||
modify MA logging/core. An adapter cannot redact the remote server's own logs.
|
||||
## Evidence
|
||||
|
||||
HTTPS Foundry -> plain HTTP/ws private MA is not a generally portable browser path,
|
||||
even with encrypted Sendspin payloads. CSP, browser local-network access rules,
|
||||
Origin policy, TLS trust and private routing still apply. Current policy refuses
|
||||
that deployment rather than disabling browser protections. Local-network exceptions
|
||||
in particular browsers are not a cross-browser guarantee. A private trusted HTTPS/
|
||||
WSS MA endpoint reachable by the GM, or the approved co-located restricted worker,
|
||||
is required. Players do not need MA network access.
|
||||
|
||||
SDK identity is derived from an X25519 private key. A player name or ID alone cannot
|
||||
reconstruct it. The code checks the supplied identity matches **Adaptive Music DEV**
|
||||
before any receiver connection; no random replacement, discovery-and-select, pairing
|
||||
or internal virtual-player provisioning occurs. Operator-controlled handover from
|
||||
the original web player is needed. Read-only identity/topology checks may inspect
|
||||
the known unavailable target during handover; every mutation still requires full
|
||||
availability, exact name/provider, own active queue and standalone topology.
|
||||
|
||||
## WebRTC signaling, authorization and transport
|
||||
|
||||
Foundry's supported `game.socket`/module channel is a relay, not an authenticated
|
||||
claim of sender identity. We do **not** trust a payload `userId`/`isGM` or assume
|
||||
that broadcast destinations enforce confidentiality. The GM explicitly issues a
|
||||
unique short-lived 256-bit per-listener invitation, delivered over an authenticated
|
||||
private channel outside the module broadcast. Possession authorizes only that peer;
|
||||
it does not prove a Foundry login cryptographically, and a recipient can forward
|
||||
its own capability/audio. No automatically broadcast bootstrap exists.
|
||||
|
||||
`SignalCodec` authenticates/encrypts SDP (including ICE addresses/DTLS fingerprints)
|
||||
with AES-GCM, session/peer/direction/sequence binding, nonce, expiry, size/type limits
|
||||
and replay checks rechecked after asynchronous decryption. A listener can affect
|
||||
only its own peer; another peer has another key. `PeerAudio` permits one recvonly
|
||||
listener offer and audio-only answer, rejects video/data/outbound listener audio,
|
||||
bounds peers, drops unknown frames, permits at most two explicit ICE restarts, and
|
||||
revokes on expiry, disconnect or authorization reconciliation. Continuous media is
|
||||
browser-managed DTLS-SRTP, never JSON PCM over Foundry sockets.
|
||||
|
||||
Default ICE servers are **empty**: no silent external STUN/TURN or telemetry.
|
||||
Operator-provided STUN/TURN configuration is explicit. TURN credentials must be
|
||||
short-lived; relay-only mode requires TURN and avoids direct peer candidates.
|
||||
Authorized peers can inspect their own ICE/network details and credentials. Direct
|
||||
P2P may disclose GM/peer network addresses to the authorized peer; encryption hides
|
||||
SDP from other world clients, not its intended recipient. No secrets are protected
|
||||
from the browser's own user. Existing public-interface references:
|
||||
[Foundry Game/socket](https://foundryvtt.com/api/v14/classes/foundry.Game.html),
|
||||
[WebRTC connectivity](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Connectivity),
|
||||
[mixed content](https://developer.mozilla.org/en-US/docs/Web/Security/Defenses/Mixed_content).
|
||||
|
||||
Symmetric NAT, CGNAT, UDP filtering and restrictive corporate networks can need TURN;
|
||||
STUN alone cannot guarantee connectivity. A relay must already exist or be separately
|
||||
approved, not installed as another container/VM by this module. One GM peer connection
|
||||
per listener means approximately linear GM upload/encoding cost. The 42.3 kbps local
|
||||
measurement is two listeners and short synthetic content, not a capacity promise.
|
||||
Browser jitter buffers, suspend/background policy and output devices introduce
|
||||
independent playout delay: Sendspin's upstream timestamps do not create synchronized
|
||||
WebRTC outputs automatically. Measure WAN jitter/skew and 30-minute drift before any
|
||||
sync guarantee. Crossfade and concurrent ambient layers remain unimplemented.
|
||||
|
||||
## Authority, lifecycle and restoration
|
||||
|
||||
Policy remains manual (including silence) > explicit eligible boss > started active
|
||||
combat for the scene > scene ambient > world default > silence. Bosses use module
|
||||
flags/priority, no actor HP/schema. Scene/world assignments, explicit native fallback,
|
||||
legacy flag migration, snapshots, interrupted paused offsets and duplicate ordered
|
||||
occurrences are preserved. Ambient is currently the single interrupted base queue;
|
||||
AmbientSound and effects remain untouched. Optional companion control retains its
|
||||
expiring fenced lease; native document ownership stays explicitly opted in.
|
||||
|
||||
GM-local control shares the same serialized, generation-checked provider and target
|
||||
checks. A Web Lock excludes duplicate GM tabs on the same origin; startup requires
|
||||
one active GM and a known empty idle target. This is **not a distributed server fence**
|
||||
and cannot prevent a malicious/stale independent GM client with its own MA token.
|
||||
The module refuses automatic split-brain handover and invalidates authority on
|
||||
Foundry disconnect. Permanent strict multi-writer fencing needs the approved worker.
|
||||
No browser-only design can manufacture an MA server-side compare-and-swap lease.
|
||||
|
||||
GM loss stops WebRTC forwarding and automated writes; it cannot guarantee immediate
|
||||
restoration after a crashed/offline browser, and already delivered audio cannot be
|
||||
revoked from a recipient. SDK-adopted sockets do not auto-reconnect. Explicit reconnect
|
||||
requires target reconciliation, same identity, secure access, new peer invitations
|
||||
and role checks. Native fallback cannot silently bypass an uncertain active MA target.
|
||||
|
||||
The preserved MA snapshots are signed, scoped to campaign/session/fence/generation,
|
||||
expire after five minutes and carry ordered occurrences, index, whole-second offset,
|
||||
pause/state and repeat. Capture repeats pagination; restore stages ordered items,
|
||||
checks them and seeks. Shuffled/dynamic/autoplay/overlay/ended/nonstandard speed
|
||||
states are unsupported. Remote ambiguity latches closed rather than retrying blindly.
|
||||
Restart/crash durability, shuffled restoration and true cross-client fencing remain
|
||||
acceptance gates. The bounded live harness still captures/restores original state;
|
||||
closing an experimental GM tab is not claimed to restore MA automatically.
|
||||
|
||||
## Optional minimal co-located fallback
|
||||
|
||||
If secure private browser reachability, network traversal or GM uptime is unacceptable,
|
||||
review a single non-root worker on the **existing Foundry host**, using existing host
|
||||
runtime/network capacity and protected state. It would terminate only the dedicated
|
||||
MA receiver, hold credentials server-side, enforce controller/listener authorization
|
||||
and expose restricted campaign audio/control through the existing TLS origin. It
|
||||
must never forward arbitrary MA API/WS/Sendspin messages. Existing `gateway/` code is
|
||||
a validated starting point, but actual Sendspin termination, durability and production
|
||||
security remain work. No system service is installed automatically, no host is
|
||||
provisioned and no Foundry/MA core is changed. Any real route/placement/deployment
|
||||
must be proposed concretely and approved first; nothing is deployed here.
|
||||
Offline tests and a Chromium DOM fixture cover this revision. Historical
|
||||
`evidence/browser-audio.json` measured two local synthetic listeners using the official
|
||||
PCM decoder, Web Audio and WebRTC: signal at 1.757 s, about 42.3 kbit/s aggregate RTP.
|
||||
It was not Foundry, real MA, WAN, audibility or synchronization verification. Prior
|
||||
read-only catalog/target checks and idle queue controls remain separate evidence.
|
||||
No new credential use, receiver registration, production connection or playback
|
||||
mutation was performed for v0.6.0. See TESTING.md for remaining acceptance gates.
|
||||
Reference in new issue
Block a user