Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: guard window.acDISK_SEND against duplicate module instance overwrite

When importWithRetry races WS blob URL + HTTP imports, both module
instances execute top-level code. The second overwrites acDISK_SEND
with its own diskSends array while boot() uses the first module's
consumeDiskSends — splitting the queue so session:started never
arrives at disk.mjs.

Guard acDISK_SEND and AC master volume functions to only bind from
the first module instance that loads.

+17 -7
+17 -7
system/public/aesthetic.computer/bios.mjs
··· 644 644 // Store original URL parameters for refresh functionality 645 645 let preservedParams = {}; 646 646 647 - window.acDISK_SEND = function (message) { 648 - !diskSendsConsumed ? diskSends.push(message) : window.acSEND(message); 649 - }; 647 + // Guard: When WS + HTTP module imports race (importWithRetry), both module 648 + // instances execute top-level code. The second overwrites window.acDISK_SEND 649 + // with its own diskSends array while boot() uses the first module's 650 + // consumeDiskSends — splitting the queue so session:started never arrives. 651 + if (!window.acDISK_SEND) { 652 + window.acDISK_SEND = function (message) { 653 + !diskSendsConsumed ? diskSends.push(message) : window.acSEND(message); 654 + }; 655 + } 650 656 651 657 // 🔊 Master volume control (for desktop app sliders, etc.) 652 658 // NOTE: These must be at module scope so window.AC.setMasterVolume works before boot() ··· 686 692 } 687 693 688 694 window.AC = window.AC || {}; 689 - window.AC.setMasterVolume = (value) => applyMasterVolume(value); 690 - window.AC.getMasterVolume = () => masterVolume; 691 - window.acSetMasterVolume = window.AC.setMasterVolume; 692 - window.acGetMasterVolume = window.AC.getMasterVolume; 695 + // Guard module-scoped closures against duplicate-instance overwrite (same race as acDISK_SEND) 696 + if (!window.AC._biosGuarded) { 697 + window.AC._biosGuarded = true; 698 + window.AC.setMasterVolume = (value) => applyMasterVolume(value); 699 + window.AC.getMasterVolume = () => masterVolume; 700 + window.acSetMasterVolume = window.AC.setMasterVolume; 701 + window.acGetMasterVolume = window.AC.getMasterVolume; 702 + } 693 703 694 704 // 🔍 CDP Debug State - Expose piece state for browser automation 695 705 // Pieces can call `_send({ type: "debug:state", content: {...} })` to update this