@onda-lang/wasm-compiler 0.8.6 → 0.8.7

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/api.md CHANGED
@@ -121,8 +121,10 @@ versions rather than guessing layout compatibility.
121
121
  `createParamControl(metadata)` validates one scalar parameter descriptor and returns a reusable
122
122
  `OndaPreparedParamControl`. For an array, `createParamControl(metadata, index)` prepares one element;
123
123
  `paramElementMetadata(metadata, index)` projects its scalar descriptor, default, and storage offset.
124
- The Web Audio adapter accepts indexed names such as `offsets[1]` in `setParam` and
125
- `setParamNormalized`, and exact-length arrays in `setParam("offsets", values)`.
124
+ The Web Audio adapter exposes `setParamElement(nameOrIndex, element, value)` and
125
+ `setParamElementNormalized(nameOrIndex, element, normalized)` for individual scalar or fixed-array
126
+ elements. Indexed names such as `offsets[1]` remain accepted by `setParam` and
127
+ `setParamNormalized`; exact-length arrays use `setParam("offsets", values)`.
126
128
  `createParamDomain(domain)` does the same from already-decoded values.
127
129
  Prepared controls expose `constrainPlain`, `normalizedToPlain`, and `plainToNormalized` methods.
128
130
 
@@ -144,7 +146,8 @@ contract.
144
146
  every generated init or process entry. Generated event entries reset before input preflight, so
145
147
  rejected input returns empty batches. After a successful generated call,
146
148
  `readDelegateBatch` or `readPrintBatch` validates the result counters.
147
- `decodeDelegateRecords` converts delegate payloads using `metadata.delegates`.
149
+ `decodeDelegateBatch` validates and decodes a complete delegate batch in one call;
150
+ `decodeDelegateRecords` decodes an already-isolated storage region using `metadata.delegates`.
148
151
  `decodePrintRecords` preserves primitive types and source sites; `formatPrintRecords` and
149
152
  `formatPrintBatch` add canonical text formatting. Both decoded record types expose a `sequence` from
150
153
  the host-reset call-local counter; merge that call's two arrays by this field when presenting one
@@ -186,27 +189,36 @@ The package root re-exports the common artifact validation and file helpers. The
186
189
  - `compileOndaProcessorModule(artifact)` validates and compiles a reusable module off the render thread.
187
190
  - `ondaAudioWorkletNodeOptions(artifact, options?)` builds low-level node options.
188
191
  - `createOndaAudioProcessor(context, artifact, options?)` allocates an uninitialized adapter.
189
- - `createOndaAudioProcessorInitialized(context, artifact, options?)` allocates and fully initializes it.
192
+ - `createOndaAudioProcessorInitialized(context, artifact, options?)` allocates it, requests full
193
+ initialization through the status-bearing control protocol, and resolves only on success.
190
194
  - `flattenedAudioChannelCount(ports?)` totals declared physical channels with validation.
191
195
 
192
196
  `OndaAudioProcessorOptions` accepts initial plain parameter values, external buffers, event,
193
197
  delegate, and print capacities, an optional construction-time `onPrint` listener, a precompiled
194
198
  module, custom node options, and an `AudioWorkletNode` constructor. Pass `onPrint` when using the
195
- initialized constructor if initialization output must be observed; registering a listener after
199
+ initialized factory if initialization output must be observed; registering a listener after
196
200
  construction cannot replay output from an execution that has already completed. The artifact sample
197
201
  rate must equal the context sample rate and it must expose at least one audio input or output.
198
202
  Print and delegate delivery uses a bounded `SharedArrayBuffer` ring and requires cross-origin
199
203
  isolation in browsers; ordinary audio processing remains available when shared memory is absent.
200
204
  Low-level callers that manually pair the returned node options with `OndaAudioProcessor` must pass
201
- `processorOptions.executionOutputRing` as the adapter constructor's fourth argument.
205
+ the artifact metadata as the adapter constructor's second argument and
206
+ `processorOptions.executionOutputRing` as its fourth argument. Event encoding and numeric
207
+ unknown-index classification require that metadata.
202
208
 
203
209
  ### `OndaAudioProcessor`
204
210
 
205
211
  The adapter exposes its `node` and validated `metadata`, plus these operations:
206
212
 
207
- - `setParam(nameOrIndex, plain)` and `setParamNormalized(nameOrIndex, normalized)`.
208
- - `trigger(nameOrIndex, values?)` for input events.
209
- - `onDelegates(listener)` and `onPrint(listener)`, each returning an unsubscribe function.
213
+ - `setParam(nameOrIndex, plain)` and `setParamNormalized(nameOrIndex, normalized)` for whole
214
+ parameters.
215
+ - `setParamElement(nameOrIndex, element, plain)` and
216
+ `setParamElementNormalized(nameOrIndex, element, normalized)` for one scalar or fixed-array
217
+ element.
218
+ - `trigger(nameOrIndex, values?)` for input events. Unknown nonnegative numeric indices are
219
+ successful no-ops, matching native dispatch; unknown names and negative indices are rejected.
220
+ - `onExecutionError(listener)`, `onDelegates(listener)`, and `onPrint(listener)`, each returning an
221
+ unsubscribe function.
210
222
  - `init(mode)`, `snapshot()`, and `restoreSnapshot(bytes)`.
211
223
  - `readControlOutputs()` and `readBuffer(nameOrIndex)`.
212
224
  - `request(type, fields?, transfer?)` for adapter protocol extensions.
@@ -224,7 +236,24 @@ each init, event, or process segment.
224
236
 
225
237
  `ONDA_INIT_FULL` clears and initializes all physical state. `ONDA_INIT_PRESERVE_PINNED` retains
226
238
  pinned state according to the processor ABI. The package also re-exports the prepared and one-shot
227
- parameter conversion helpers.
239
+ parameter conversion helpers. Snapshot restoration performs its internal full initialization
240
+ silently, without delivering init prints or delegates.
241
+
242
+ Raw WebAssembly exports use the same generated status values as native processor objects:
243
+ `PROCESSOR_EXECUTION_OK` (`0`), `PROCESSOR_EXECUTION_RUNTIME_SAFETY_FAILURE` (`1`), and event-only
244
+ `PROCESSOR_EXECUTION_INPUT_REJECTED` (`2`). The Web Audio adapter translates host-side validation
245
+ problems into rejected promises before generated execution. It also rejects init and event promises
246
+ when generated code returns a nonzero status: status `1` invalidates the live processor, while event
247
+ status `2` preserves it. These generated failures use `OndaExecutionError`, whose `operation` and
248
+ `status` fields retain the machine-readable failure. The Web Audio root re-exports all three
249
+ `PROCESSOR_EXECUTION_*` constants for direct comparison. Render-time process failure invalidates the
250
+ processor and silences subsequent callbacks. `onExecutionError(listener)` receives its typed
251
+ `OndaExecutionError`; requested init and event failures remain on their promise rejection path and
252
+ are not reported twice.
253
+ The raw `@onda-lang/processor-abi` package exposes `PROCESSOR_BEGIN_BLOCK`,
254
+ `PROCESSOR_END_BLOCK`, and `PROCESSOR_FULL_BLOCK` for native and direct WebAssembly hosts that use
255
+ segmented processing. Web Audio schedules render quanta internally and has no segmented-process
256
+ method.
228
257
 
229
258
  `@onda-lang/webaudio/worklet` is the side-effect-only AudioWorklet registration module and has no
230
259
  named exports.
@@ -271,8 +300,11 @@ PRINT_RECORD_HEADER_SIZE_BYTES
271
300
  PROCESSOR_ABI_VERSION
272
301
  PROCESSOR_ARTIFACT_FORMAT
273
302
  PROCESSOR_ARTIFACT_FORMAT_VERSION
303
+ PROCESSOR_BEGIN_BLOCK
304
+ PROCESSOR_END_BLOCK
274
305
  PROCESSOR_EXECUTION_OK
275
306
  PROCESSOR_EXECUTION_RUNTIME_SAFETY_FAILURE
307
+ PROCESSOR_FULL_BLOCK
276
308
  PROCESSOR_INIT_FULL
277
309
  PROCESSOR_INIT_PRESERVE_PINNED
278
310
  PROCESSOR_SNAPSHOT_FORMAT_VERSION
@@ -281,6 +313,7 @@ createParamControl
281
313
  paramElementMetadata
282
314
  createParamDomain
283
315
  createProcessorArtifactFiles
316
+ decodeDelegateBatch
284
317
  decodeDelegateRecords
285
318
  decodePrintRecords
286
319
  formatPrintBatch
@@ -320,12 +353,19 @@ OndaArtifactError
320
353
  OndaBinaryenError
321
354
  OndaBinaryenOptions
322
355
  OndaProcessorArtifact
356
+ OndaProcessorInitMode
323
357
  OndaProcessorMetadata
324
358
  PROCESSOR_ABI_VERSION
325
359
  PROCESSOR_ARTIFACT_FORMAT
326
360
  PROCESSOR_ARTIFACT_FORMAT_VERSION
361
+ PROCESSOR_BEGIN_BLOCK
362
+ PROCESSOR_END_BLOCK
363
+ PROCESSOR_EXECUTION_INPUT_REJECTED
327
364
  PROCESSOR_EXECUTION_OK
328
365
  PROCESSOR_EXECUTION_RUNTIME_SAFETY_FAILURE
366
+ PROCESSOR_FULL_BLOCK
367
+ PROCESSOR_INIT_FULL
368
+ PROCESSOR_INIT_PRESERVE_PINNED
329
369
  PROCESSOR_SNAPSHOT_FORMAT_VERSION
330
370
  SUPPORTED_MIR_SCHEMA_VERSION
331
371
  compileTrustedMir
@@ -366,6 +406,7 @@ OndaLspAnalysisOptions
366
406
  OndaLspMessage
367
407
  OndaMaterializedProjectFile
368
408
  OndaProcessorArtifact
409
+ OndaProcessorInitMode
369
410
  OndaProcessorMetadata
370
411
  OndaProjectBufferInfo
371
412
  OndaProjectCapabilities
@@ -383,8 +424,14 @@ OndaWorkerLike
383
424
  PROCESSOR_ABI_VERSION
384
425
  PROCESSOR_ARTIFACT_FORMAT
385
426
  PROCESSOR_ARTIFACT_FORMAT_VERSION
427
+ PROCESSOR_BEGIN_BLOCK
428
+ PROCESSOR_END_BLOCK
429
+ PROCESSOR_EXECUTION_INPUT_REJECTED
386
430
  PROCESSOR_EXECUTION_OK
387
431
  PROCESSOR_EXECUTION_RUNTIME_SAFETY_FAILURE
432
+ PROCESSOR_FULL_BLOCK
433
+ PROCESSOR_INIT_FULL
434
+ PROCESSOR_INIT_PRESERVE_PINNED
388
435
  PROCESSOR_SNAPSHOT_FORMAT_VERSION
389
436
  WorkerCompilerOptions
390
437
  createCompiler
@@ -408,11 +455,16 @@ OndaAudioProcessor
408
455
  OndaAudioProcessorOptions
409
456
  OndaAudioPrintBatch
410
457
  OndaAudioPrintListener
458
+ OndaExecutionError
459
+ OndaExecutionErrorListener
411
460
  OndaInitMode
412
461
  OndaParamDomain
413
462
  OndaPreparedParamControl
414
463
  OndaProcessorArtifact
415
464
  OndaProcessorMetadata
465
+ PROCESSOR_EXECUTION_INPUT_REJECTED
466
+ PROCESSOR_EXECUTION_OK
467
+ PROCESSOR_EXECUTION_RUNTIME_SAFETY_FAILURE
416
468
  compileOndaProcessorModule
417
469
  constrainParamPlain
418
470
  createOndaAudioProcessor
@@ -1,20 +1 @@
1
- export {
2
- OndaArtifactError,
3
- PROCESSOR_ABI_VERSION,
4
- PROCESSOR_ARTIFACT_FORMAT,
5
- PROCESSOR_ARTIFACT_FORMAT_VERSION,
6
- PROCESSOR_EXECUTION_OK,
7
- PROCESSOR_EXECUTION_RUNTIME_SAFETY_FAILURE,
8
- PROCESSOR_SNAPSHOT_FORMAT_VERSION,
9
- createProcessorArtifactFiles,
10
- loadProcessorArtifactFiles,
11
- parseProcessorMetadata,
12
- serializeProcessorMetadata,
13
- validateProcessorArtifact,
14
- validateProcessorMetadata,
15
- validateProcessorModule,
16
- } from "@onda-lang/processor-abi";
17
- export type {
18
- OndaProcessorArtifact,
19
- OndaProcessorMetadata,
20
- } from "@onda-lang/processor-abi";
1
+ export * from "@onda-lang/processor-abi";
@@ -15,7 +15,7 @@ import {
15
15
  MATH_KERNEL_STACK_GLOBAL,
16
16
  MAX_MEMORY_PAGES,
17
17
  DEFAULT_OPTIMIZE_LEVEL,
18
- ONDA_PROCESS_FULL_BLOCK,
18
+ PROCESSOR_FULL_BLOCK,
19
19
  DELEGATE_BATCH_USED_OFFSET,
20
20
  DELEGATE_BATCH_RECORD_COUNT_OFFSET,
21
21
  DELEGATE_BATCH_OVERFLOW_OFFSET,
@@ -2443,7 +2443,7 @@ export class MirCompilerCore {
2443
2443
  this.module.i32.ne(
2444
2444
  this.module.i32.and(
2445
2445
  flags(),
2446
- this.module.i32.const(~ONDA_PROCESS_FULL_BLOCK),
2446
+ this.module.i32.const(~PROCESSOR_FULL_BLOCK),
2447
2447
  ),
2448
2448
  this.module.i32.const(0),
2449
2449
  ),
@@ -9,6 +9,7 @@ import {
9
9
  PROCESSOR_ARTIFACT_FORMAT_VERSION,
10
10
  PROCESSOR_EXECUTION_OK,
11
11
  PROCESSOR_EXECUTION_RUNTIME_SAFETY_FAILURE,
12
+ PROCESSOR_FULL_BLOCK,
12
13
  PROCESSOR_SNAPSHOT_FORMAT_VERSION,
13
14
  validateProcessorMetadata,
14
15
  } from "../artifact.js";
@@ -23,6 +24,7 @@ export {
23
24
  PROCESSOR_ARTIFACT_FORMAT_VERSION,
24
25
  PROCESSOR_EXECUTION_OK,
25
26
  PROCESSOR_EXECUTION_RUNTIME_SAFETY_FAILURE,
27
+ PROCESSOR_FULL_BLOCK,
26
28
  PROCESSOR_SNAPSHOT_FORMAT_VERSION,
27
29
  validateProcessorMetadata,
28
30
  };
@@ -35,7 +37,6 @@ export const MATH_KERNEL_STACK_GLOBAL = "__stack_pointer";
35
37
  export const MAX_MEMORY_PAGES = 65_536;
36
38
  export const WASM32_ADDRESS_SPACE_BYTES = MAX_MEMORY_PAGES * PAGE_BYTES;
37
39
  export const DEFAULT_OPTIMIZE_LEVEL = 4;
38
- export const ONDA_PROCESS_FULL_BLOCK = (1 << 0) | (1 << 1);
39
40
  export const DELEGATE_RECORD_HEADER_SIZE = 12;
40
41
  export const DELEGATE_BATCH_STORAGE_OFFSET = 0;
41
42
  export const DELEGATE_BATCH_CAPACITY_OFFSET = 4;
@@ -4,8 +4,14 @@ export {
4
4
  PROCESSOR_ABI_VERSION,
5
5
  PROCESSOR_ARTIFACT_FORMAT,
6
6
  PROCESSOR_ARTIFACT_FORMAT_VERSION,
7
+ PROCESSOR_BEGIN_BLOCK,
8
+ PROCESSOR_END_BLOCK,
9
+ PROCESSOR_EXECUTION_INPUT_REJECTED,
7
10
  PROCESSOR_EXECUTION_OK,
8
11
  PROCESSOR_EXECUTION_RUNTIME_SAFETY_FAILURE,
12
+ PROCESSOR_FULL_BLOCK,
13
+ PROCESSOR_INIT_FULL,
14
+ PROCESSOR_INIT_PRESERVE_PINNED,
9
15
  PROCESSOR_SNAPSHOT_FORMAT_VERSION,
10
16
  createProcessorArtifactFiles,
11
17
  loadProcessorArtifactFiles,
@@ -17,6 +23,7 @@ export {
17
23
  } from "@onda-lang/processor-abi";
18
24
  export type {
19
25
  OndaProcessorArtifact,
26
+ OndaProcessorInitMode,
20
27
  OndaProcessorMetadata,
21
28
  } from "@onda-lang/processor-abi";
22
29
  import type { OndaProcessorArtifact } from "@onda-lang/processor-abi";
@@ -6,8 +6,14 @@ export {
6
6
  PROCESSOR_ABI_VERSION,
7
7
  PROCESSOR_ARTIFACT_FORMAT,
8
8
  PROCESSOR_ARTIFACT_FORMAT_VERSION,
9
+ PROCESSOR_BEGIN_BLOCK,
10
+ PROCESSOR_END_BLOCK,
11
+ PROCESSOR_EXECUTION_INPUT_REJECTED,
9
12
  PROCESSOR_EXECUTION_OK,
10
13
  PROCESSOR_EXECUTION_RUNTIME_SAFETY_FAILURE,
14
+ PROCESSOR_FULL_BLOCK,
15
+ PROCESSOR_INIT_FULL,
16
+ PROCESSOR_INIT_PRESERVE_PINNED,
11
17
  PROCESSOR_SNAPSHOT_FORMAT_VERSION,
12
18
  createProcessorArtifactFiles,
13
19
  loadProcessorArtifactFiles,
package/dist/build.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
- "ondaVersion": "0.8.6",
2
+ "ondaVersion": "0.8.7",
3
3
  "binaryenVersion": "130.0.0",
4
4
  "frontendPackage": "onda_compiler_web",
5
5
  "frontendOptimization": {
6
6
  "tool": "wasm-opt",
7
7
  "binaryenVersion": "130.0.0",
8
8
  "optimizeLevel": 4,
9
- "inputBytes": 10639608,
10
- "outputBytes": 7802146
9
+ "inputBytes": 10615667,
10
+ "outputBytes": 7779655
11
11
  }
12
12
  }
@@ -5,7 +5,7 @@
5
5
  "Francesco Cameli"
6
6
  ],
7
7
  "description": "Browser-safe Onda source-to-MIR compiler",
8
- "version": "0.8.6",
8
+ "version": "0.8.7",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
@@ -675,7 +675,7 @@ SOFTWARE.
675
675
  MIT License (MIT)
676
676
 
677
677
  Used by:
678
- - onda_compiler_web 0.8.6 (https://github.com/onda-lang/onda)
678
+ - onda_compiler_web 0.8.7 (https://github.com/onda-lang/onda)
679
679
 
680
680
  MIT License
681
681
 
@@ -704,13 +704,13 @@ SOFTWARE.
704
704
  MIT License (MIT)
705
705
 
706
706
  Used by:
707
- - onda_frontend 0.8.6
708
- - onda_host_protocol 0.8.6
709
- - onda_lsp 0.8.6
710
- - onda_mir 0.8.6
711
- - onda_processor_abi 0.8.6
712
- - onda_project 0.8.6
713
- - onda_semantics 0.8.6
707
+ - onda_frontend 0.8.7
708
+ - onda_host_protocol 0.8.7
709
+ - onda_lsp 0.8.7
710
+ - onda_mir 0.8.7
711
+ - onda_processor_abi 0.8.7
712
+ - onda_project 0.8.7
713
+ - onda_semantics 0.8.7
714
714
 
715
715
  MIT License
716
716
 
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const ONDA_VERSION = "0.8.6";
1
+ export const ONDA_VERSION = "0.8.7";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onda-lang/wasm-compiler",
3
- "version": "0.8.6",
3
+ "version": "0.8.7",
4
4
  "type": "module",
5
5
  "description": "Onda source-to-WebAssembly compiler for browsers and Node.js",
6
6
  "license": "MIT",
@@ -60,7 +60,7 @@
60
60
  "prepack": "npm run build && node ../../scripts/stage-web-api-docs.mjs"
61
61
  },
62
62
  "dependencies": {
63
- "@onda-lang/processor-abi": "0.8.6",
63
+ "@onda-lang/processor-abi": "0.8.7",
64
64
  "binaryen": "130.0.0"
65
65
  },
66
66
  "publishConfig": {
package/src/index.d.ts CHANGED
@@ -5,8 +5,14 @@ export {
5
5
  PROCESSOR_ABI_VERSION,
6
6
  PROCESSOR_ARTIFACT_FORMAT,
7
7
  PROCESSOR_ARTIFACT_FORMAT_VERSION,
8
+ PROCESSOR_BEGIN_BLOCK,
9
+ PROCESSOR_END_BLOCK,
10
+ PROCESSOR_EXECUTION_INPUT_REJECTED,
8
11
  PROCESSOR_EXECUTION_OK,
9
12
  PROCESSOR_EXECUTION_RUNTIME_SAFETY_FAILURE,
13
+ PROCESSOR_FULL_BLOCK,
14
+ PROCESSOR_INIT_FULL,
15
+ PROCESSOR_INIT_PRESERVE_PINNED,
10
16
  PROCESSOR_SNAPSHOT_FORMAT_VERSION,
11
17
  createProcessorArtifactFiles,
12
18
  loadProcessorArtifactFiles,
@@ -18,6 +24,7 @@ export {
18
24
  } from "@onda-lang/processor-abi";
19
25
  export type {
20
26
  OndaProcessorArtifact,
27
+ OndaProcessorInitMode,
21
28
  OndaProcessorMetadata,
22
29
  } from "@onda-lang/processor-abi";
23
30
  import type { OndaProcessorArtifact } from "@onda-lang/processor-abi";
package/src/index.js CHANGED
@@ -3,8 +3,14 @@ import {
3
3
  PROCESSOR_ABI_VERSION,
4
4
  PROCESSOR_ARTIFACT_FORMAT,
5
5
  PROCESSOR_ARTIFACT_FORMAT_VERSION,
6
+ PROCESSOR_BEGIN_BLOCK,
7
+ PROCESSOR_END_BLOCK,
8
+ PROCESSOR_EXECUTION_INPUT_REJECTED,
6
9
  PROCESSOR_EXECUTION_OK,
7
10
  PROCESSOR_EXECUTION_RUNTIME_SAFETY_FAILURE,
11
+ PROCESSOR_FULL_BLOCK,
12
+ PROCESSOR_INIT_FULL,
13
+ PROCESSOR_INIT_PRESERVE_PINNED,
8
14
  PROCESSOR_SNAPSHOT_FORMAT_VERSION,
9
15
  createProcessorArtifactFiles,
10
16
  loadProcessorArtifactFiles,
@@ -29,8 +35,14 @@ export {
29
35
  PROCESSOR_ABI_VERSION,
30
36
  PROCESSOR_ARTIFACT_FORMAT,
31
37
  PROCESSOR_ARTIFACT_FORMAT_VERSION,
38
+ PROCESSOR_BEGIN_BLOCK,
39
+ PROCESSOR_END_BLOCK,
40
+ PROCESSOR_EXECUTION_INPUT_REJECTED,
32
41
  PROCESSOR_EXECUTION_OK,
33
42
  PROCESSOR_EXECUTION_RUNTIME_SAFETY_FAILURE,
43
+ PROCESSOR_FULL_BLOCK,
44
+ PROCESSOR_INIT_FULL,
45
+ PROCESSOR_INIT_PRESERVE_PINNED,
34
46
  PROCESSOR_SNAPSHOT_FORMAT_VERSION,
35
47
  createProcessorArtifactFiles,
36
48
  loadProcessorArtifactFiles,