@octoseq/visualiser 0.1.0-main.6402764 → 0.1.0-main.994cb4e

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octoseq/visualiser",
3
- "version": "0.1.0-main.6402764",
3
+ "version": "0.1.0-main.994cb4e",
4
4
  "description": "WASM-based visualiser for Octoseq",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -18,12 +18,30 @@ export class WasmVisualiser {
18
18
  * The signal will be available as `inputs.<name>` in Rhai scripts.
19
19
  */
20
20
  push_signal(name: string, samples: Float32Array, sample_rate: number): void;
21
+ /**
22
+ * Run script in analysis mode to collect debug.emit() signals.
23
+ *
24
+ * This runs the script headlessly across the full track duration,
25
+ * collecting all debug.emit() calls without rendering.
26
+ *
27
+ * Returns a JSON-serialized AnalysisResultJson.
28
+ */
29
+ run_analysis(script: string, duration: number, time_step: number): string;
21
30
  /**
22
31
  * Clear all named signals.
23
32
  */
24
33
  clear_signals(): void;
25
34
  set_sigmoid_k(k: number): void;
35
+ /**
36
+ * Isolate a single entity for rendering (useful for debugging).
37
+ * Only this entity will be rendered.
38
+ */
39
+ isolate_entity(entity_id: bigint): void;
26
40
  push_zoom_data(samples: Float32Array, sample_rate: number): void;
41
+ /**
42
+ * Clear entity isolation, resume normal rendering.
43
+ */
44
+ clear_isolation(): void;
27
45
  /**
28
46
  * Get current state values for debugging.
29
47
  * Returns [time, scene_entity_count, mesh_count, line_count]
@@ -33,7 +51,113 @@ export class WasmVisualiser {
33
51
  * Get the last script error message, if any.
34
52
  */
35
53
  get_script_error(): string | undefined;
54
+ /**
55
+ * Get the list of available signal names.
56
+ * Returns a JSON array of signal names.
57
+ */
58
+ get_signal_names(): string;
59
+ /**
60
+ * Push pre-extracted events for a band.
61
+ *
62
+ * Events are extracted by the TypeScript layer using the existing peak picker,
63
+ * then pushed here for script access via `inputs.bands[id].events`.
64
+ *
65
+ * The JSON format should be an array of event objects with:
66
+ * - time: f32
67
+ * - weight: f32
68
+ * - beat_position: Option<f32>
69
+ * - beat_phase: Option<f32>
70
+ * - cluster_id: Option<u32>
71
+ *
72
+ * Returns true if successful, false if parsing failed.
73
+ */
74
+ push_band_events(band_id: string, events_json: string): boolean;
75
+ /**
76
+ * Push a band-scoped signal for use in scripts.
77
+ * The signal will be available as `inputs.bands[band_id].{feature}` in Rhai scripts.
78
+ * Stores under both band_id and band_label for dual-access support.
79
+ *
80
+ * - `band_id`: The unique ID of the frequency band.
81
+ * - `band_label`: The user-visible label of the band.
82
+ * - `feature`: Signal type ("energy", "onset", "flux").
83
+ * - `samples`: Signal data.
84
+ * - `sample_rate`: Sample rate of the signal.
85
+ */
86
+ push_band_signal(band_id: string, band_label: string, feature: string, samples: Float32Array, sample_rate: number): void;
87
+ /**
88
+ * Set the musical time structure for beat-aware signal processing.
89
+ * The JSON format matches the TypeScript MusicalTimeStructure type.
90
+ * Returns true if successful, false if parsing failed.
91
+ */
92
+ set_musical_time(json: string): boolean;
93
+ /**
94
+ * Clear all band event streams.
95
+ */
96
+ clear_band_events(): void;
97
+ /**
98
+ * Set debug visualization options.
99
+ */
100
+ set_debug_options(wireframe: boolean, bounding_boxes: boolean): void;
101
+ /**
102
+ * Clear all band signals.
103
+ */
104
+ clear_band_signals(): void;
105
+ /**
106
+ * Clear the musical time structure.
107
+ * Beat-aware operations will fall back to 120 BPM default.
108
+ */
109
+ clear_musical_time(): void;
110
+ /**
111
+ * Get frequency bounds for all active bands at a given time.
112
+ * Returns a JSON array of { bandId, label, lowHz, highHz, enabled } objects.
113
+ */
114
+ get_band_bounds_at(time: number): string;
36
115
  push_rotation_data(samples: Float32Array, sample_rate: number): void;
116
+ /**
117
+ * Check if frequency bands are currently set.
118
+ */
119
+ has_frequency_bands(): boolean;
120
+ /**
121
+ * Set the frequency band structure for band-aware processing.
122
+ * The JSON format matches the TypeScript FrequencyBandStructure type.
123
+ * Returns true if successful, false if parsing failed.
124
+ */
125
+ set_frequency_bands(json: string): boolean;
126
+ /**
127
+ * Get the number of events for a specific band.
128
+ * Returns 0 if no events are stored for this band.
129
+ */
130
+ get_band_event_count(band_id: string): number;
131
+ /**
132
+ * Get list of band keys (IDs and labels) that have signals.
133
+ * Returns a JSON array of strings.
134
+ */
135
+ get_band_signal_keys(): string;
136
+ /**
137
+ * Clear the frequency band structure.
138
+ */
139
+ clear_frequency_bands(): void;
140
+ /**
141
+ * Get the number of frequency bands.
142
+ */
143
+ get_frequency_band_count(): number;
144
+ /**
145
+ * Run script in analysis mode with event extraction support.
146
+ *
147
+ * This runs the script headlessly across the full track duration,
148
+ * collecting all debug.emit() calls AND extracting events from
149
+ * any signal.pick.events() calls.
150
+ *
151
+ * Returns a JSON-serialized ExtendedAnalysisResultJson.
152
+ */
153
+ run_analysis_with_events(script: string, duration: number, time_step: number): string;
154
+ /**
155
+ * Drain and return any pending structured script diagnostics as JSON.
156
+ *
157
+ * Intended for UI consumption. Calling this clears the pending diagnostics
158
+ * queue so repeated polling does not duplicate messages.
159
+ */
160
+ take_script_diagnostics_json(): string;
37
161
  constructor();
38
162
  render(dt: number): void;
39
163
  resize(width: number, height: number): void;
@@ -43,6 +167,15 @@ export class WasmVisualiser {
43
167
 
44
168
  export function create_visualiser(canvas: HTMLCanvasElement): Promise<WasmVisualiser>;
45
169
 
170
+ /**
171
+ * Get the host-defined Script API metadata as a JSON string.
172
+ *
173
+ * This is a stable, versioned description of the scripting API surface and is
174
+ * intended to drive editor UX (autocomplete/hover/docs) and future language
175
+ * bindings.
176
+ */
177
+ export function get_script_api_metadata_json(): string;
178
+
46
179
  export function init_panic_hook(): void;
47
180
 
48
181
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
@@ -51,25 +184,46 @@ export interface InitOutput {
51
184
  readonly memory: WebAssembly.Memory;
52
185
  readonly __wbg_wasmvisualiser_free: (a: number, b: number) => void;
53
186
  readonly create_visualiser: (a: any) => any;
187
+ readonly get_script_api_metadata_json: () => [number, number];
188
+ readonly wasmvisualiser_clear_band_events: (a: number) => void;
189
+ readonly wasmvisualiser_clear_band_signals: (a: number) => void;
190
+ readonly wasmvisualiser_clear_frequency_bands: (a: number) => void;
191
+ readonly wasmvisualiser_clear_isolation: (a: number) => void;
192
+ readonly wasmvisualiser_clear_musical_time: (a: number) => void;
54
193
  readonly wasmvisualiser_clear_signals: (a: number) => void;
194
+ readonly wasmvisualiser_get_band_bounds_at: (a: number, b: number) => [number, number];
195
+ readonly wasmvisualiser_get_band_event_count: (a: number, b: number, c: number) => number;
196
+ readonly wasmvisualiser_get_band_signal_keys: (a: number) => [number, number];
55
197
  readonly wasmvisualiser_get_current_vals: (a: number) => [number, number];
198
+ readonly wasmvisualiser_get_frequency_band_count: (a: number) => number;
56
199
  readonly wasmvisualiser_get_script_error: (a: number) => [number, number];
200
+ readonly wasmvisualiser_get_signal_names: (a: number) => [number, number];
201
+ readonly wasmvisualiser_has_frequency_bands: (a: number) => number;
57
202
  readonly wasmvisualiser_has_script: (a: number) => number;
203
+ readonly wasmvisualiser_isolate_entity: (a: number, b: bigint) => void;
58
204
  readonly wasmvisualiser_load_script: (a: number, b: number, c: number) => number;
59
205
  readonly wasmvisualiser_new: () => number;
206
+ readonly wasmvisualiser_push_band_events: (a: number, b: number, c: number, d: number, e: number) => number;
207
+ readonly wasmvisualiser_push_band_signal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
60
208
  readonly wasmvisualiser_push_data: (a: number, b: number, c: number, d: number) => void;
61
209
  readonly wasmvisualiser_push_signal: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
62
210
  readonly wasmvisualiser_push_zoom_data: (a: number, b: number, c: number, d: number) => void;
63
211
  readonly wasmvisualiser_render: (a: number, b: number) => void;
64
212
  readonly wasmvisualiser_resize: (a: number, b: number, c: number) => void;
213
+ readonly wasmvisualiser_run_analysis: (a: number, b: number, c: number, d: number, e: number) => [number, number];
214
+ readonly wasmvisualiser_run_analysis_with_events: (a: number, b: number, c: number, d: number, e: number) => [number, number];
215
+ readonly wasmvisualiser_set_debug_options: (a: number, b: number, c: number) => void;
216
+ readonly wasmvisualiser_set_frequency_bands: (a: number, b: number, c: number) => number;
217
+ readonly wasmvisualiser_set_musical_time: (a: number, b: number, c: number) => number;
65
218
  readonly wasmvisualiser_set_sigmoid_k: (a: number, b: number) => void;
66
219
  readonly wasmvisualiser_set_time: (a: number, b: number) => void;
67
- readonly init_panic_hook: () => void;
220
+ readonly wasmvisualiser_take_script_diagnostics_json: (a: number) => [number, number];
68
221
  readonly wasmvisualiser_push_rotation_data: (a: number, b: number, c: number, d: number) => void;
69
- readonly wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7: (a: number, b: number, c: any) => void;
70
- readonly wasm_bindgen__closure__destroy__hf5eaa61ced318e08: (a: number, b: number) => void;
222
+ readonly init_panic_hook: () => void;
71
223
  readonly wasm_bindgen__convert__closures_____invoke__h9d1c5a23ecfcd5c8: (a: number, b: number, c: any) => void;
72
224
  readonly wasm_bindgen__closure__destroy__heb49a8f426ac2d2e: (a: number, b: number) => void;
225
+ readonly wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7: (a: number, b: number, c: any) => void;
226
+ readonly wasm_bindgen__closure__destroy__hf5eaa61ced318e08: (a: number, b: number) => void;
73
227
  readonly wasm_bindgen__convert__closures_____invoke__h320f3d825d3712ba: (a: number, b: number, c: any, d: any) => void;
74
228
  readonly __wbindgen_malloc: (a: number, b: number) => number;
75
229
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
package/pkg/visualiser.js CHANGED
@@ -241,14 +241,14 @@ if (!('encodeInto' in cachedTextEncoder)) {
241
241
 
242
242
  let WASM_VECTOR_LEN = 0;
243
243
 
244
- function wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7(arg0, arg1, arg2) {
245
- wasm.wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7(arg0, arg1, arg2);
246
- }
247
-
248
244
  function wasm_bindgen__convert__closures_____invoke__h9d1c5a23ecfcd5c8(arg0, arg1, arg2) {
249
245
  wasm.wasm_bindgen__convert__closures_____invoke__h9d1c5a23ecfcd5c8(arg0, arg1, arg2);
250
246
  }
251
247
 
248
+ function wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7(arg0, arg1, arg2) {
249
+ wasm.wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7(arg0, arg1, arg2);
250
+ }
251
+
252
252
  function wasm_bindgen__convert__closures_____invoke__h320f3d825d3712ba(arg0, arg1, arg2, arg3) {
253
253
  wasm.wasm_bindgen__convert__closures_____invoke__h320f3d825d3712ba(arg0, arg1, arg2, arg3);
254
254
  }
@@ -319,6 +319,32 @@ export class WasmVisualiser {
319
319
  const len1 = WASM_VECTOR_LEN;
320
320
  wasm.wasmvisualiser_push_signal(this.__wbg_ptr, ptr0, len0, ptr1, len1, sample_rate);
321
321
  }
322
+ /**
323
+ * Run script in analysis mode to collect debug.emit() signals.
324
+ *
325
+ * This runs the script headlessly across the full track duration,
326
+ * collecting all debug.emit() calls without rendering.
327
+ *
328
+ * Returns a JSON-serialized AnalysisResultJson.
329
+ * @param {string} script
330
+ * @param {number} duration
331
+ * @param {number} time_step
332
+ * @returns {string}
333
+ */
334
+ run_analysis(script, duration, time_step) {
335
+ let deferred2_0;
336
+ let deferred2_1;
337
+ try {
338
+ const ptr0 = passStringToWasm0(script, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
339
+ const len0 = WASM_VECTOR_LEN;
340
+ const ret = wasm.wasmvisualiser_run_analysis(this.__wbg_ptr, ptr0, len0, duration, time_step);
341
+ deferred2_0 = ret[0];
342
+ deferred2_1 = ret[1];
343
+ return getStringFromWasm0(ret[0], ret[1]);
344
+ } finally {
345
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
346
+ }
347
+ }
322
348
  /**
323
349
  * Clear all named signals.
324
350
  */
@@ -331,6 +357,14 @@ export class WasmVisualiser {
331
357
  set_sigmoid_k(k) {
332
358
  wasm.wasmvisualiser_set_sigmoid_k(this.__wbg_ptr, k);
333
359
  }
360
+ /**
361
+ * Isolate a single entity for rendering (useful for debugging).
362
+ * Only this entity will be rendered.
363
+ * @param {bigint} entity_id
364
+ */
365
+ isolate_entity(entity_id) {
366
+ wasm.wasmvisualiser_isolate_entity(this.__wbg_ptr, entity_id);
367
+ }
334
368
  /**
335
369
  * @param {Float32Array} samples
336
370
  * @param {number} sample_rate
@@ -340,6 +374,12 @@ export class WasmVisualiser {
340
374
  const len0 = WASM_VECTOR_LEN;
341
375
  wasm.wasmvisualiser_push_zoom_data(this.__wbg_ptr, ptr0, len0, sample_rate);
342
376
  }
377
+ /**
378
+ * Clear entity isolation, resume normal rendering.
379
+ */
380
+ clear_isolation() {
381
+ wasm.wasmvisualiser_clear_isolation(this.__wbg_ptr);
382
+ }
343
383
  /**
344
384
  * Get current state values for debugging.
345
385
  * Returns [time, scene_entity_count, mesh_count, line_count]
@@ -364,6 +404,134 @@ export class WasmVisualiser {
364
404
  }
365
405
  return v1;
366
406
  }
407
+ /**
408
+ * Get the list of available signal names.
409
+ * Returns a JSON array of signal names.
410
+ * @returns {string}
411
+ */
412
+ get_signal_names() {
413
+ let deferred1_0;
414
+ let deferred1_1;
415
+ try {
416
+ const ret = wasm.wasmvisualiser_get_signal_names(this.__wbg_ptr);
417
+ deferred1_0 = ret[0];
418
+ deferred1_1 = ret[1];
419
+ return getStringFromWasm0(ret[0], ret[1]);
420
+ } finally {
421
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
422
+ }
423
+ }
424
+ /**
425
+ * Push pre-extracted events for a band.
426
+ *
427
+ * Events are extracted by the TypeScript layer using the existing peak picker,
428
+ * then pushed here for script access via `inputs.bands[id].events`.
429
+ *
430
+ * The JSON format should be an array of event objects with:
431
+ * - time: f32
432
+ * - weight: f32
433
+ * - beat_position: Option<f32>
434
+ * - beat_phase: Option<f32>
435
+ * - cluster_id: Option<u32>
436
+ *
437
+ * Returns true if successful, false if parsing failed.
438
+ * @param {string} band_id
439
+ * @param {string} events_json
440
+ * @returns {boolean}
441
+ */
442
+ push_band_events(band_id, events_json) {
443
+ const ptr0 = passStringToWasm0(band_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
444
+ const len0 = WASM_VECTOR_LEN;
445
+ const ptr1 = passStringToWasm0(events_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
446
+ const len1 = WASM_VECTOR_LEN;
447
+ const ret = wasm.wasmvisualiser_push_band_events(this.__wbg_ptr, ptr0, len0, ptr1, len1);
448
+ return ret !== 0;
449
+ }
450
+ /**
451
+ * Push a band-scoped signal for use in scripts.
452
+ * The signal will be available as `inputs.bands[band_id].{feature}` in Rhai scripts.
453
+ * Stores under both band_id and band_label for dual-access support.
454
+ *
455
+ * - `band_id`: The unique ID of the frequency band.
456
+ * - `band_label`: The user-visible label of the band.
457
+ * - `feature`: Signal type ("energy", "onset", "flux").
458
+ * - `samples`: Signal data.
459
+ * - `sample_rate`: Sample rate of the signal.
460
+ * @param {string} band_id
461
+ * @param {string} band_label
462
+ * @param {string} feature
463
+ * @param {Float32Array} samples
464
+ * @param {number} sample_rate
465
+ */
466
+ push_band_signal(band_id, band_label, feature, samples, sample_rate) {
467
+ const ptr0 = passStringToWasm0(band_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
468
+ const len0 = WASM_VECTOR_LEN;
469
+ const ptr1 = passStringToWasm0(band_label, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
470
+ const len1 = WASM_VECTOR_LEN;
471
+ const ptr2 = passStringToWasm0(feature, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
472
+ const len2 = WASM_VECTOR_LEN;
473
+ const ptr3 = passArrayF32ToWasm0(samples, wasm.__wbindgen_malloc);
474
+ const len3 = WASM_VECTOR_LEN;
475
+ wasm.wasmvisualiser_push_band_signal(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, sample_rate);
476
+ }
477
+ /**
478
+ * Set the musical time structure for beat-aware signal processing.
479
+ * The JSON format matches the TypeScript MusicalTimeStructure type.
480
+ * Returns true if successful, false if parsing failed.
481
+ * @param {string} json
482
+ * @returns {boolean}
483
+ */
484
+ set_musical_time(json) {
485
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
486
+ const len0 = WASM_VECTOR_LEN;
487
+ const ret = wasm.wasmvisualiser_set_musical_time(this.__wbg_ptr, ptr0, len0);
488
+ return ret !== 0;
489
+ }
490
+ /**
491
+ * Clear all band event streams.
492
+ */
493
+ clear_band_events() {
494
+ wasm.wasmvisualiser_clear_band_events(this.__wbg_ptr);
495
+ }
496
+ /**
497
+ * Set debug visualization options.
498
+ * @param {boolean} wireframe
499
+ * @param {boolean} bounding_boxes
500
+ */
501
+ set_debug_options(wireframe, bounding_boxes) {
502
+ wasm.wasmvisualiser_set_debug_options(this.__wbg_ptr, wireframe, bounding_boxes);
503
+ }
504
+ /**
505
+ * Clear all band signals.
506
+ */
507
+ clear_band_signals() {
508
+ wasm.wasmvisualiser_clear_band_signals(this.__wbg_ptr);
509
+ }
510
+ /**
511
+ * Clear the musical time structure.
512
+ * Beat-aware operations will fall back to 120 BPM default.
513
+ */
514
+ clear_musical_time() {
515
+ wasm.wasmvisualiser_clear_musical_time(this.__wbg_ptr);
516
+ }
517
+ /**
518
+ * Get frequency bounds for all active bands at a given time.
519
+ * Returns a JSON array of { bandId, label, lowHz, highHz, enabled } objects.
520
+ * @param {number} time
521
+ * @returns {string}
522
+ */
523
+ get_band_bounds_at(time) {
524
+ let deferred1_0;
525
+ let deferred1_1;
526
+ try {
527
+ const ret = wasm.wasmvisualiser_get_band_bounds_at(this.__wbg_ptr, time);
528
+ deferred1_0 = ret[0];
529
+ deferred1_1 = ret[1];
530
+ return getStringFromWasm0(ret[0], ret[1]);
531
+ } finally {
532
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
533
+ }
534
+ }
367
535
  /**
368
536
  * @param {Float32Array} samples
369
537
  * @param {number} sample_rate
@@ -373,6 +541,116 @@ export class WasmVisualiser {
373
541
  const len0 = WASM_VECTOR_LEN;
374
542
  wasm.wasmvisualiser_push_data(this.__wbg_ptr, ptr0, len0, sample_rate);
375
543
  }
544
+ /**
545
+ * Check if frequency bands are currently set.
546
+ * @returns {boolean}
547
+ */
548
+ has_frequency_bands() {
549
+ const ret = wasm.wasmvisualiser_has_frequency_bands(this.__wbg_ptr);
550
+ return ret !== 0;
551
+ }
552
+ /**
553
+ * Set the frequency band structure for band-aware processing.
554
+ * The JSON format matches the TypeScript FrequencyBandStructure type.
555
+ * Returns true if successful, false if parsing failed.
556
+ * @param {string} json
557
+ * @returns {boolean}
558
+ */
559
+ set_frequency_bands(json) {
560
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
561
+ const len0 = WASM_VECTOR_LEN;
562
+ const ret = wasm.wasmvisualiser_set_frequency_bands(this.__wbg_ptr, ptr0, len0);
563
+ return ret !== 0;
564
+ }
565
+ /**
566
+ * Get the number of events for a specific band.
567
+ * Returns 0 if no events are stored for this band.
568
+ * @param {string} band_id
569
+ * @returns {number}
570
+ */
571
+ get_band_event_count(band_id) {
572
+ const ptr0 = passStringToWasm0(band_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
573
+ const len0 = WASM_VECTOR_LEN;
574
+ const ret = wasm.wasmvisualiser_get_band_event_count(this.__wbg_ptr, ptr0, len0);
575
+ return ret >>> 0;
576
+ }
577
+ /**
578
+ * Get list of band keys (IDs and labels) that have signals.
579
+ * Returns a JSON array of strings.
580
+ * @returns {string}
581
+ */
582
+ get_band_signal_keys() {
583
+ let deferred1_0;
584
+ let deferred1_1;
585
+ try {
586
+ const ret = wasm.wasmvisualiser_get_band_signal_keys(this.__wbg_ptr);
587
+ deferred1_0 = ret[0];
588
+ deferred1_1 = ret[1];
589
+ return getStringFromWasm0(ret[0], ret[1]);
590
+ } finally {
591
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
592
+ }
593
+ }
594
+ /**
595
+ * Clear the frequency band structure.
596
+ */
597
+ clear_frequency_bands() {
598
+ wasm.wasmvisualiser_clear_frequency_bands(this.__wbg_ptr);
599
+ }
600
+ /**
601
+ * Get the number of frequency bands.
602
+ * @returns {number}
603
+ */
604
+ get_frequency_band_count() {
605
+ const ret = wasm.wasmvisualiser_get_frequency_band_count(this.__wbg_ptr);
606
+ return ret >>> 0;
607
+ }
608
+ /**
609
+ * Run script in analysis mode with event extraction support.
610
+ *
611
+ * This runs the script headlessly across the full track duration,
612
+ * collecting all debug.emit() calls AND extracting events from
613
+ * any signal.pick.events() calls.
614
+ *
615
+ * Returns a JSON-serialized ExtendedAnalysisResultJson.
616
+ * @param {string} script
617
+ * @param {number} duration
618
+ * @param {number} time_step
619
+ * @returns {string}
620
+ */
621
+ run_analysis_with_events(script, duration, time_step) {
622
+ let deferred2_0;
623
+ let deferred2_1;
624
+ try {
625
+ const ptr0 = passStringToWasm0(script, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
626
+ const len0 = WASM_VECTOR_LEN;
627
+ const ret = wasm.wasmvisualiser_run_analysis_with_events(this.__wbg_ptr, ptr0, len0, duration, time_step);
628
+ deferred2_0 = ret[0];
629
+ deferred2_1 = ret[1];
630
+ return getStringFromWasm0(ret[0], ret[1]);
631
+ } finally {
632
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
633
+ }
634
+ }
635
+ /**
636
+ * Drain and return any pending structured script diagnostics as JSON.
637
+ *
638
+ * Intended for UI consumption. Calling this clears the pending diagnostics
639
+ * queue so repeated polling does not duplicate messages.
640
+ * @returns {string}
641
+ */
642
+ take_script_diagnostics_json() {
643
+ let deferred1_0;
644
+ let deferred1_1;
645
+ try {
646
+ const ret = wasm.wasmvisualiser_take_script_diagnostics_json(this.__wbg_ptr);
647
+ deferred1_0 = ret[0];
648
+ deferred1_1 = ret[1];
649
+ return getStringFromWasm0(ret[0], ret[1]);
650
+ } finally {
651
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
652
+ }
653
+ }
376
654
  constructor() {
377
655
  const ret = wasm.wasmvisualiser_new();
378
656
  this.__wbg_ptr = ret >>> 0;
@@ -419,6 +697,27 @@ export function create_visualiser(canvas) {
419
697
  return ret;
420
698
  }
421
699
 
700
+ /**
701
+ * Get the host-defined Script API metadata as a JSON string.
702
+ *
703
+ * This is a stable, versioned description of the scripting API surface and is
704
+ * intended to drive editor UX (autocomplete/hover/docs) and future language
705
+ * bindings.
706
+ * @returns {string}
707
+ */
708
+ export function get_script_api_metadata_json() {
709
+ let deferred1_0;
710
+ let deferred1_1;
711
+ try {
712
+ const ret = wasm.get_script_api_metadata_json();
713
+ deferred1_0 = ret[0];
714
+ deferred1_1 = ret[1];
715
+ return getStringFromWasm0(ret[0], ret[1]);
716
+ } finally {
717
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
718
+ }
719
+ }
720
+
422
721
  export function init_panic_hook() {
423
722
  wasm.init_panic_hook();
424
723
  }
@@ -1273,18 +1572,13 @@ function __wbg_get_imports() {
1273
1572
  imports.wbg.__wbg_writeTexture_246118eb2f5a1592 = function(arg0, arg1, arg2, arg3, arg4) {
1274
1573
  arg0.writeTexture(arg1, arg2, arg3, arg4);
1275
1574
  };
1276
- imports.wbg.__wbindgen_cast_1ad8672233d2fd7b = function(arg0, arg1) {
1277
- // Cast intrinsic for `Closure(Closure { dtor_idx: 2007, function: Function { arguments: [Externref], shim_idx: 2008, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1278
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hf5eaa61ced318e08, wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7);
1279
- return ret;
1280
- };
1281
1575
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
1282
1576
  // Cast intrinsic for `Ref(String) -> Externref`.
1283
1577
  const ret = getStringFromWasm0(arg0, arg1);
1284
1578
  return ret;
1285
1579
  };
1286
- imports.wbg.__wbindgen_cast_762879c56a766cac = function(arg0, arg1) {
1287
- // Cast intrinsic for `Closure(Closure { dtor_idx: 1873, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 1874, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1580
+ imports.wbg.__wbindgen_cast_76d0cfa31f1ac8a4 = function(arg0, arg1) {
1581
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 2169, function: Function { arguments: [NamedExternref("GPUUncapturedErrorEvent")], shim_idx: 2170, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1288
1582
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__heb49a8f426ac2d2e, wasm_bindgen__convert__closures_____invoke__h9d1c5a23ecfcd5c8);
1289
1583
  return ret;
1290
1584
  };
@@ -1293,6 +1587,11 @@ function __wbg_get_imports() {
1293
1587
  const ret = getArrayU8FromWasm0(arg0, arg1);
1294
1588
  return ret;
1295
1589
  };
1590
+ imports.wbg.__wbindgen_cast_cf6801dce1a51fdc = function(arg0, arg1) {
1591
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 2301, function: Function { arguments: [Externref], shim_idx: 2302, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1592
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hf5eaa61ced318e08, wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7);
1593
+ return ret;
1594
+ };
1296
1595
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
1297
1596
  // Cast intrinsic for `F64 -> Externref`.
1298
1597
  const ret = arg0;
Binary file
@@ -3,25 +3,46 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const __wbg_wasmvisualiser_free: (a: number, b: number) => void;
5
5
  export const create_visualiser: (a: any) => any;
6
+ export const get_script_api_metadata_json: () => [number, number];
7
+ export const wasmvisualiser_clear_band_events: (a: number) => void;
8
+ export const wasmvisualiser_clear_band_signals: (a: number) => void;
9
+ export const wasmvisualiser_clear_frequency_bands: (a: number) => void;
10
+ export const wasmvisualiser_clear_isolation: (a: number) => void;
11
+ export const wasmvisualiser_clear_musical_time: (a: number) => void;
6
12
  export const wasmvisualiser_clear_signals: (a: number) => void;
13
+ export const wasmvisualiser_get_band_bounds_at: (a: number, b: number) => [number, number];
14
+ export const wasmvisualiser_get_band_event_count: (a: number, b: number, c: number) => number;
15
+ export const wasmvisualiser_get_band_signal_keys: (a: number) => [number, number];
7
16
  export const wasmvisualiser_get_current_vals: (a: number) => [number, number];
17
+ export const wasmvisualiser_get_frequency_band_count: (a: number) => number;
8
18
  export const wasmvisualiser_get_script_error: (a: number) => [number, number];
19
+ export const wasmvisualiser_get_signal_names: (a: number) => [number, number];
20
+ export const wasmvisualiser_has_frequency_bands: (a: number) => number;
9
21
  export const wasmvisualiser_has_script: (a: number) => number;
22
+ export const wasmvisualiser_isolate_entity: (a: number, b: bigint) => void;
10
23
  export const wasmvisualiser_load_script: (a: number, b: number, c: number) => number;
11
24
  export const wasmvisualiser_new: () => number;
25
+ export const wasmvisualiser_push_band_events: (a: number, b: number, c: number, d: number, e: number) => number;
26
+ export const wasmvisualiser_push_band_signal: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
12
27
  export const wasmvisualiser_push_data: (a: number, b: number, c: number, d: number) => void;
13
28
  export const wasmvisualiser_push_signal: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
14
29
  export const wasmvisualiser_push_zoom_data: (a: number, b: number, c: number, d: number) => void;
15
30
  export const wasmvisualiser_render: (a: number, b: number) => void;
16
31
  export const wasmvisualiser_resize: (a: number, b: number, c: number) => void;
32
+ export const wasmvisualiser_run_analysis: (a: number, b: number, c: number, d: number, e: number) => [number, number];
33
+ export const wasmvisualiser_run_analysis_with_events: (a: number, b: number, c: number, d: number, e: number) => [number, number];
34
+ export const wasmvisualiser_set_debug_options: (a: number, b: number, c: number) => void;
35
+ export const wasmvisualiser_set_frequency_bands: (a: number, b: number, c: number) => number;
36
+ export const wasmvisualiser_set_musical_time: (a: number, b: number, c: number) => number;
17
37
  export const wasmvisualiser_set_sigmoid_k: (a: number, b: number) => void;
18
38
  export const wasmvisualiser_set_time: (a: number, b: number) => void;
19
- export const init_panic_hook: () => void;
39
+ export const wasmvisualiser_take_script_diagnostics_json: (a: number) => [number, number];
20
40
  export const wasmvisualiser_push_rotation_data: (a: number, b: number, c: number, d: number) => void;
21
- export const wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7: (a: number, b: number, c: any) => void;
22
- export const wasm_bindgen__closure__destroy__hf5eaa61ced318e08: (a: number, b: number) => void;
41
+ export const init_panic_hook: () => void;
23
42
  export const wasm_bindgen__convert__closures_____invoke__h9d1c5a23ecfcd5c8: (a: number, b: number, c: any) => void;
24
43
  export const wasm_bindgen__closure__destroy__heb49a8f426ac2d2e: (a: number, b: number) => void;
44
+ export const wasm_bindgen__convert__closures_____invoke__h53437a38721e89f7: (a: number, b: number, c: any) => void;
45
+ export const wasm_bindgen__closure__destroy__hf5eaa61ced318e08: (a: number, b: number) => void;
25
46
  export const wasm_bindgen__convert__closures_____invoke__h320f3d825d3712ba: (a: number, b: number, c: any, d: any) => void;
26
47
  export const __wbindgen_malloc: (a: number, b: number) => number;
27
48
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;