@viji-dev/core 0.5.4 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -218,6 +218,14 @@ export declare class AudioSystem {
218
218
  private lastPhaseLogTime;
219
219
  private onsetLogBuffer;
220
220
  private debugMode;
221
+ /**
222
+ * One-way lifecycle flag flipped at the top of `resetAudioState()`.
223
+ * Gates re-entry into `ensureAudioContext()` and the public stream-mutation
224
+ * entry points so an in-flight async caller (e.g. a worker RPC firing
225
+ * mid-teardown) cannot resurrect a fresh `AudioContext` after destroy
226
+ * has already nulled the field. AudioSystem is single-use after reset.
227
+ */
228
+ private destroyed;
221
229
  private diagnosticLogger;
222
230
  private onsetDetection;
223
231
  private essentiaOnsetDetection;
@@ -419,8 +427,13 @@ export declare class AudioSystem {
419
427
  /**
420
428
  * Reset all audio state (called when destroying).
421
429
  * Disconnects all channels, closes AudioContext, resets all modules.
430
+ *
431
+ * Returns a Promise that resolves once `AudioContext.close()` has fully
432
+ * transitioned the context to `closed`. Callers tearing the system down
433
+ * (e.g. `VijiCore.destroy()`) MUST await this; otherwise Blink keeps the
434
+ * context alive in `Pending activities` and leaks ~4 MB per cycle.
422
435
  */
423
- resetAudioState(): void;
436
+ resetAudioState(): Promise<void>;
424
437
  /**
425
438
  * Add an additional audio stream (lightweight analysis, no beat detection).
426
439
  * @param streamIndex Global stream index (from VijiCore: AUDIO_ADDITIONAL_BASE + n or AUDIO_DEVICE_BASE + n)
@@ -442,9 +455,12 @@ export declare class AudioSystem {
442
455
  getChannelCount(): number;
443
456
  /**
444
457
  * Record a tap for the specified instrument onset.
445
- * `options.skipRecognition` retains visual envelope + session timing but
446
- * bypasses the recognition pipeline used by host-side relay of forwarded
447
- * tap messages where another core is doing the authoritative recognition.
458
+ * `options.skipRecognition` opts the tap out of the recognition pipeline
459
+ * only (no IOI accumulation, no `tryRecognizePattern`, no `applyPattern`).
460
+ * Mode still flips `'auto' 'tapping'` so the visual envelope and
461
+ * audio-event filter run; only the pattern-detection pipeline is bypassed.
462
+ * Used by host-side relay of forwarded tap messages where another core
463
+ * owns the authoritative recognition.
448
464
  */
449
465
  tapOnset(instrument: InstrumentType, options?: {
450
466
  skipRecognition?: boolean;
@@ -2251,7 +2267,7 @@ declare type TrackingState = 'TRACKING' | 'LOCKED' | 'BREAKDOWN' | 'LOST';
2251
2267
  /** Returned by `on*` listener registration calls; invoke to unsubscribe. */
2252
2268
  export declare type Unsubscribe = () => void;
2253
2269
 
2254
- export declare const VERSION = "0.5.4";
2270
+ export declare const VERSION = "0.5.6";
2255
2271
 
2256
2272
  /**
2257
2273
  * Real-time video API: drawable frame, dimensions, and the source-side
@@ -3023,13 +3039,17 @@ export declare class VijiCore {
3023
3039
  * First tap switches the instrument from auto to tapping mode.
3024
3040
  * If a repeating pattern is recognized, it continues after tapping stops.
3025
3041
  *
3026
- * `options.skipRecognition: true` keeps the visual envelope and session
3027
- * timing but bypasses pattern recognition entirely (no IOI accumulation,
3028
- * no mode transition, no `applyPattern`, no `handlePatternTap`). Use
3029
- * this when relaying tap messages from another instance that owns the
3030
- * authoritative recognition (e.g. host receiving forwarded controller
3031
- * taps over WebRTC). The receiving core's mode is then driven only by
3032
- * `importSessionState` from the authoritative sender.
3042
+ * `options.skipRecognition: true` opts the tap out of the **recognition
3043
+ * pipeline only** no `tapIOIs` accumulation, no `tryRecognizePattern`,
3044
+ * no `applyPattern`, no `handlePatternTap`. Mode still flips
3045
+ * `'auto' 'tapping'` on the first tap of a session (and back to
3046
+ * `'auto'` on the 5s timeout). The mode flip is load-bearing for
3047
+ * `processFrame`'s drain of `pendingTapEvents`, the audio-event filter
3048
+ * that prevents music+tap doubling, and `onModeChange` consumers. Use
3049
+ * `skipRecognition` when relaying tap messages from another instance
3050
+ * that owns the authoritative recognition (e.g. host receiving
3051
+ * controller taps over WebRTC); the receiving core's pattern is then
3052
+ * driven only by `importSessionState` from the authoritative sender.
3033
3053
  *
3034
3054
  * The `MIN_TAP_INTERVAL_MS` debounce still applies regardless of the
3035
3055
  * `skipRecognition` flag.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A, V, a, b } from "./index-_PbbZgmh.js";
1
+ import { A, V, a, b } from "./index-Yg6_UX8C.js";
2
2
  export {
3
3
  A as AudioSystem,
4
4
  V as VERSION,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viji-dev/core",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "description": "Universal execution engine for Viji Creative scenes",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",