# Adaptive Music v0.8.1 handoff ## Repository state The original workspace's Git metadata is read-only. Before v0.8.1 changes, its 157 tracked and untracked source files matched the clean local release commit `1ed6b4c` byte for byte. The original HEAD `987122f` is that commit's parent. Develop on `v0.8.1-firefox` in the remote-free `.local/v080-release-checkout`. Its `main` branch retains `1ed6b4c`. The operator reported Gitea published v0.8.0 from `95b0427`. That object is absent in both local Git databases. The published commit's ancestry can be checked if its Git object is supplied offline. A read-only check of the authorized private Foundry route confirmed the installed manifest is v0.8.0 and all 28 runtime files match `1ed6b4c`. The v0.8.1 archive is built from a clean checkout and its source is compared against its local commit. Read its exact commit in `dist/releases/v0.8.1/release.json`. Gitea access and production deployment are outside this work. ## Installed v0.8.0 macOS acceptance - **Operator pass:** Chrome connectivity, credentials after quitting and reopening Chrome, automatic scene playlist activation, background-tab audio, remote player audio over WAN, and smooth transitions. The operator heard no stuttering or crackling during their session. - **Operator fail:** macOS Firefox connectivity. - **Combat follow-up:** assigned battle music worked when used as ambient, while normal combat left ambient playing. The operator could not find the boss designation. Combat, restoration, boss and manual controls need hands-on acceptance with the corrected candidate. ## v0.8.1 native combat correction The native token HUD created an unlinked encounter on Foundry 14.371 and D&D 5e 6.1.2. Installed v0.8.0 ignored it even after the native tracker started round 1. Use the Combatant token scene when the encounter has no explicit scene. The tracker now has a GM-only **Boss encounter** option and shows the playback mode and **Return to automation** for a manual override. The same combat and boss assignment can change mode without restarting the queue. Use distinct playlists to verify the audible changes. The authorized GUI run and its hook trace live under ignored `.local/v081-combat-gui-*`. See [TESTING.md](TESTING.md) and [USER-ACCEPTANCE.md](USER-ACCEPTANCE.md) for the reproduced lifecycle and steps. The Chromium browser preview used three distinct cues and restored ambient at 30, 33 and 46 seconds across normal, boss and manual-override encounters. It verified turn and round continuity, End Combat cancellation, scene changes, and returning from the manual hold. The server still reported v0.8.0 during the previews. Headed Firefox repeated the normal combat lifecycle against the same runtime and restored ambient at 9 seconds. ## v0.8.1 Firefox investigation - The two WSS routes opened with HTTP 101 in Mozilla Firefox 161.0.1 on Ubuntu from the anonymous Foundry origin and the MA origin using the native WebSocket. Trusted TLS and the authorized private route were retained. - The isolated stock-Firefox policy test reproduced enforced CSP, report-only CSP, a server-side Origin rejection and a mismatched TLS certificate. Browser script saw Origin rejection and TLS rejection as opaque upgrade failures. - The candidate improves the token-free report with manual Connect failure stage and time, per-route duration and post-probe permission states. Audio, credential storage and the authenticated transport are outside the change. The original macOS failure needs the browser-side capture described in [USER-ACCEPTANCE.md](USER-ACCEPTANCE.md#capture-the-firefox-failure). - The private stock browser, scripts and raw reports under `.local/v081-*` are test-only. See [sanitized v0.8.1 evidence](evidence/v0.8.1-live.json). ## Historical v0.8.0 audit checkpoint - The development world keeps **Christmas — Adaptive Music demo** active with Christmas music assigned. **Dûr-Khazrak — Adaptive Music demo** has distinct ambient, combat and boss cues and a prepared, unstarted encounter with the Dûr-Khazrak Champion. Its ambient uses a development playlist as a stand-in. The authorized catalog contained no identifiable dwarven soundtrack. - The preview host reported v0.7.2 during the automated audit. The operator subsequently installed v0.8.0 and carried out the checks above. - Automated release regressions passed with 110 JavaScript and 17 Python tests. The dependency, repository and upstream provenance checks passed. The updated Chromium, Firefox and Linux WebKit credential fixture closed and reopened persistent browser profiles and tested rejection by a synthetic MA auth endpoint after simulated revocation. The real preview verified same-receiver auto-attachment after a page reload, Disconnect and Forget. - MA-side revocation with a disposable token and Mac sleep/wake still need operator acceptance. The focused Ubuntu Firefox background check measured listener audio before switching tabs and could not establish that the GM page became hidden. The package targets Foundry VTT 14.371 and MA 2.10.6. It uses the pinned Sendspin SDK and browser-hosted audio. The user authorized the existing test accounts and dedicated MA token for the private development-world acceptance runs on December 4. See [the evidence](evidence/v0.8.0-live.json), [the verification guide](TESTING.md) and [the contributor rules](AGENTS.md). | Work | Candidate implementation | | --- | --- | | AM-005 browser compatibility | Staged, token-free transport diagnostics. Live Chromium and Firefox use the private development route. Linux WebKit provides an engine check. | | AM-007 audio continuity | A bounded sample-contiguous PCM timeline and persistent established WebRTC media across signaling expiry. Live measurements count silent render blocks, verify rate and reject prolonged silence. | | AM-008 trusted-device credentials | Explicit browser-local AES-GCM retention with reconnect, Disconnect and Forget Credentials. Account address and portable references retain their v0.7.2 formats. | | AM-009 native Foundry integration | Native Scene Configuration fields, draggable MA catalog, world/boss defaults and real scene/combat hooks. Native soundtracks remain under Foundry's controller. | | AM-010 gameplay controls | Token toolbar and sidebar launch points, transport, volume, repeat, manual override and return to scene music. The one dedicated MA queue uses sequential fades. | ## Results and open acceptance - The original Firefox report is preserved under `.local/v080-original-firefox-soak.json`. It recorded 1,800 wall-clock measurement seconds and successful ambient restoration at 37 seconds. Both listeners then recorded about 763 seconds of continuous terminal silence and the Stop/Enable check failed. The first ZIP preview passed initial ambient playback but timed out selecting Repeat. The repeat field now has an explicit accessible name for Firefox and for the harness. - The first Chromium GUI review connected to MA, then timed out in the sidebar and scene configuration workflow. The refreshed sidebar updates an existing render and preserves its expanded state. The review now reports individual stages, verifies the pointer drag and measures both listeners. Current raw reports and logs are in `.local/foundry-v080-review-chromium.json`, `.local/v080-audit-chromium-review.log` and `.local/v080-audit-firefox-soak.log`. Match the UTC start time and ZIP hash before attributing results to a given run. - Chromium's headless run exercised the real Foundry native UI, including pointer drag, two scene assignments, both controls launch points, combat, a boss override and ambient restoration. A first combat choice was rejected during playlist preparation. For a reproducible review, set `AM_REVIEW_PLAYLIST_INDEXES` to the three comma-separated zero-based catalog entries that passed preparation in `.local/v080-catalog-readiness.json`. - The corrected Firefox continuity run started at 00:29 UTC on December 5 and passed 1,800 measured seconds, including ordered restoration at 37 seconds, listener Stop/Enable and reload. The development-world cleanup passed. The Chromium review uses the same tested ZIP and runtime asset hash. See the sanitized JSON for phase measurements and the raw report under `.local/`. - The Chromium review passed native scene assignment and pointer drag, both playback launchers, combat and boss cues, ambient restoration at 10 seconds, manual override and return, pause, resume, seek, skip and stop. It reconnected the same receiver after reload without replacing its queue. Disconnect and Forget Credentials both prevented automatic reconnection after another reload. The final headed review disabled Playwright focus emulation in a private test tool copy. A real cover tab hid the GM document for 12 seconds. Its audio clock advanced, the GM output analyser measured audio, and both listeners continued receiving audio. Earlier trials with focus emulation kept the page visible. See `.local/v080-normal-visibility-playwright/focus-fixture.json` for the tool modification and hashes. - The isolated WebRTC fixture passed signaling expiry and revocation in Chromium and Firefox. Linux WebKit's default ICE did not connect. Forced relay via local coturn passed audio and expiry/revocation without microphone access. The extracted binary and signed-package hashes are in `.local/v080-turn-fixture/`. Future runs can set `AM_LOOPBACK_TURN_CONFIG` to a private fixture grant and use `--webkit-only`. - These v0.8.0 automated browser previews exercised real Foundry and MA with archive assets while the server reported v0.7.2. See the separate installed v0.8.0 manual results above. The bundle is locally staged under `dist/releases/v0.8.0/`. The install ZIP is `adaptive-music.zip` and the outer archive also includes complete source, checksums, licenses and evidence. The prior review restored the development world's active scene, automation setting and account connection and removed temporary combats. The final audit prepared the two demo scenes and activated Christmas for the operator. The prior hostname override was restored from its saved backup. The focused Firefox check used a process-local DNS mapping with normal TLS validation. ## Findings and source map - MA 2.10.6 assigns all authenticated API sessions using a restricted token to the newest Sendspin browser receiver using the same token. This was directly reproduced when the native MA reference player and the Foundry receiver shared the test token. Foundry kept receiving audio but `players/get` returned `InsufficientPermissions` (22), preventing combat control. Run those tests serially, or use separately authorized tokens. The matching upstream code is `set_sendspin_player_for_token` in MA's tagged webserver controller. Adaptive Music keeps its original API session and reports queue-rights loss in `src/audio/gm-host.mjs`, `src/providers/ma/websocket.mjs` and `src/foundry/connection-wizard.mjs`. This explains the reproduced permission failure. The cause of the Mac Firefox failure remains open. - The v0.7.2 per-packet time mapping causes edge gaps and overlaps when Web Audio time advances in render quanta. The rendered-tone fixture detected 86–97 short dropouts per seven-second measurement across the tested rate pairs and engines. The new scheduler detected zero in the same fixture. A prior two-minute live Firefox interval also detected zero short digital dropouts at the GM and both players. See `src/audio/pcm-timeline.mjs`, `src/audio/gm-host.mjs`, `src/audio/peer-audio.mjs` and `scripts/browser-continuity-worklet.mjs`. Natural track silence, an intentional transition, a network concealment event and a scheduler gap are different signals. - A headed installed-baseline Chromium attempt authenticated and paired but timed out waiting for a newly registered MA queue. Retain that result alongside the operator’s working Mac baseline. Setup already retries a successful null queue lookup briefly. Check `src/providers/ma/client.mjs` and `src/audio/gm-host.mjs` if it recurs. - Credential lifecycle and auto-reconnect are in `src/foundry/receiver-vault.mjs`, `src/foundry/account-connection.mjs`, `src/foundry/module.mjs` and `src/foundry/connection-wizard.mjs`. The browser profile and enabled same-origin modules are trusted. The token cannot follow a GM account to a different browser without that GM entering it there. Token rotation can require reassigning older token-derived playlist references. - Native UI and automation are in `src/foundry/configuration.mjs`, `src/foundry/music-editor.mjs`, `src/foundry/runtime.mjs`, `src/core/scene-music.mjs` and `src/core/controller.mjs`. Playback UI is in `src/foundry/playback-panel.mjs` and `src/foundry/setup.mjs`. True simultaneous crossfade between arbitrary playlists would require both streams to be independently available at the same time. MA track-to-track crossfade within one queue is separate. GM logout or closing the last GM tab ends live playback. ## Environment and commands Use Ubuntu, Python 3, Node 24.23.0 or newer within the supported release line, and the existing Playwright tools. System `node` on this machine is Node 18. The development browser tools and browser binaries are ignored local paths. The headless tests exercise isolated browser APIs. The headed tests use Xvfb with software GL for the actual Foundry graphical workflows. ```sh export PATH="/home/ubuntu/.nvm/versions/node/v24.23.0/bin:$PATH" export PLAYWRIGHT_BROWSERS_PATH="$PWD/.local/browsers" npm test python3 -m unittest discover -s tests -v python3 scripts/audit_repository.py python3 scripts/verify_upstream.py npm audit --json node scripts/check_setup_browser.mjs export AM_PLAYWRIGHT_MODULE="$PWD/.local/dev-browser-tools/node_modules/playwright/index.mjs" export LIBGL_ALWAYS_SOFTWARE=1 xvfb-run -a node scripts/check_pcm_continuity.mjs --headed --webkit node scripts/check_device_credentials_browser.mjs --webkit # Run the desktop review after any background playback test has exited. umask 077 AM_PLAYWRIGHT_MODULE="$PWD/.local/v080-normal-visibility-playwright/node_modules/playwright/index.mjs" \ xvfb-run -a -s '-screen 0 1600x1050x24 +extension GLX' \ node scripts/check_foundry_private_route.mjs --headed --playback --package-preview dist/releases/v0.8.0/adaptive-music.zip --review \ > .local/v080-candidate-chromium-review.log 2>&1 # Start another soak when changes require a retest. xvfb-run -a -s '-screen 0 1600x1050x24 +extension GLX' \ node scripts/check_foundry_private_route.mjs --headed --firefox --playback --package-preview dist/releases/v0.8.0/adaptive-music.zip --continuity \ > .local/v080-candidate-firefox-soak.log 2>&1 # Build the current candidate from the clean local release checkout. python3 .local/v080-release-checkout/scripts/release.py --output "$PWD/dist/releases/v0.8.1" python3 scripts/release.py --validate dist/releases/v0.8.1/adaptive-music.zip (cd dist/releases/v0.8.1 && sha256sum -c SHA256SUMS && sha256sum -c adaptive-music-release-v0.8.1.zip.sha256) ``` The headed browser tests use the authorized private Nginx HTTPS route and retain normal TLS validation. Firefox and WebKit used a temporary Ubuntu hostname override which has been restored. After an authorized future test, restore an identical temporary override with `cmp -s /etc/hosts .local/v080-hosts.new && sudo -n install -m 0644 -o root -g root .local/v080-hosts.before /etc/hosts`. If the comparison fails, preserve subsequent edits and remove only the test change marked `adaptive-music-test-v080` using the backup as a reference. ## Authorization and private configuration - Use the dedicated Foundry development world and the three test accounts listed in the ignored development-world configuration. The runner checks whether the GM account is available before joining. - Use only the authorized private HTTPS proxy and the dedicated MA test credential and receivers. GM authorization covers isolated development scenes, test combatants, playlists, diagnostics, receiver creation and playback. Leave production campaigns, core, other modules, network infrastructure and household MA/Sonos targets untouched. - `.local/live-environment.json` contains the private HTTPS origins and proxy address. `.local/foundry-development.json` holds the test-world/account mapping. `.local/ma-token` holds the dedicated token. The private runners read them directly and load the token through `loadMAToken('.local')` from `gateway/private-config.mjs`. Pass the directory or file path to tools and retain the value in process memory. Avoid printing configuration values or raw auth frames. Do not paste them into an Ollama prompt, transcript or issue. - Keep `.local/` mode 0700 and private input files mode 0600. Use sanitized aggregate evidence in Git. Local browser profiles, raw reports, screenshots and route backups belong under `.local/`. Run the repository audit before staging or committing anything newly generated. - Keep source commits and bundles local. Do not access, fetch from, push to, or publish a release on the Gitea repository.