@onda-lang/webaudio 0.7.4 → 0.8.0

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/README.md CHANGED
@@ -1,13 +1,19 @@
1
1
  # Onda Web Audio adapter
2
2
 
3
+ See [api.md](api.md) for the complete public Web API shared with the released package.
4
+
3
5
  This optional package hosts a complete wasm32 Onda processor artifact in an `AudioWorklet`. It is a
4
6
  reference adapter for the generic Onda processor ABI; Web Audio is not required by the compiler or
5
7
  by native and relocatable-WebAssembly object consumers.
6
8
 
7
9
  ```js
8
- import { createOndaAudioProcessor } from "@onda-lang/webaudio";
10
+ import {
11
+ createOndaAudioProcessorInitialized,
12
+ ONDA_INIT_FULL,
13
+ ONDA_INIT_PRESERVE_PINNED,
14
+ } from "@onda-lang/webaudio";
9
15
 
10
- const processor = await createOndaAudioProcessor(audioContext, artifact, {
16
+ const processor = await createOndaAudioProcessorInitialized(audioContext, artifact, {
11
17
  params: { gain: 0.5 },
12
18
  buffers: {},
13
19
  });
@@ -15,12 +21,27 @@ processor.node.connect(audioContext.destination);
15
21
  await processor.setParam("gain", 0.75);
16
22
  await processor.setParamNormalized("cutoff", 0.5);
17
23
  const snapshot = await processor.snapshot();
24
+ await processor.init(ONDA_INIT_PRESERVE_PINNED);
25
+ await processor.init(ONDA_INIT_FULL);
18
26
  ```
19
27
 
20
28
  The adapter registers `onda-wasm-processor`, derives Web Audio channel options from artifact
21
29
  metadata, marshals declared scalar widths, schedules arbitrary render quanta across Onda compile
22
30
  blocks, and provides request/response helpers for parameters, events, buffers, control outputs,
23
- reset, and portable snapshots.
31
+ initialization, and portable snapshots.
32
+
33
+ `createOndaAudioProcessor()` is allocation-only. This lets a host configure parameters before the
34
+ first initializer run:
35
+
36
+ ```js
37
+ const processor = await createOndaAudioProcessor(audioContext, artifact);
38
+ await processor.setParam("gain", 0.75);
39
+ await processor.init(ONDA_INIT_FULL);
40
+ ```
41
+
42
+ Until full initialization succeeds, the worklet emits silence and rejects stateful control
43
+ operations. Successful initialization switches it to the initialized process callback, so the
44
+ steady-state audio callback does not retain a lifecycle branch.
24
45
 
25
46
  ## Parameters
26
47
 
@@ -68,6 +89,83 @@ Audio processor must expose at least one audio input or output, because an empty
68
89
  does not carry a render-quantum frame count. Control-only artifacts remain usable through the generic
69
90
  processor ABI in a non-Web-Audio host.
70
91
 
92
+ Call `processor.close()` when the adapter is no longer used. Closing is idempotent and terminal: it
93
+ rejects pending requests, removes listeners, and makes subsequent operations fail immediately. The
94
+ wrapped `AudioWorkletNode` and `AudioContext` remain caller-owned.
95
+
96
+ ## Prints
97
+
98
+ Authored `print(...)` occurrences leave generated execution as bounded typed records. The worklet
99
+ copies those records into a preallocated `SharedArrayBuffer` ring without formatting or allocating
100
+ during audio rendering; the main-side adapter drains the ring and turns them into canonical,
101
+ newline-terminated text:
102
+
103
+ ```js
104
+ const processor = await createOndaAudioProcessorInitialized(context, artifact, {
105
+ printCapacityBytes: 128 * 1024,
106
+ // Register during construction to include output from authored init code.
107
+ onPrint: ({ text, entries, overflowCount, transportDropCount }) => {
108
+ logView.append(text);
109
+ if (overflowCount) console.warn(`${overflowCount} generated print records were dropped`);
110
+ if (transportDropCount) console.warn(`${transportDropCount} print records missed UI transport`);
111
+ },
112
+ });
113
+ ```
114
+
115
+ `text` is ready to write or display and contains one newline-terminated line per occurrence.
116
+ `entries` retains typed values and source/log-site metadata for source-aware consumers. Generated
117
+ batch overflow and bounded worklet-to-main transport loss are reported separately; loss-only
118
+ notifications are delivered even when no later authored print arrives. Capacity defaults to 64 KiB
119
+ and can be set to zero to suppress host delivery without suppressing argument evaluation. Print
120
+ collection is inactive while no listener is registered, avoiding record packing and transport work
121
+ in the render callback. Listeners added later with `processor.onPrint(...)` receive subsequent
122
+ executions; use the construction option above when initialized-code output must be observed.
123
+ See the internal [print host integration](../../docs/printing.md) reference for scalar formatting,
124
+ source metadata, and the equivalent Rust, C, and raw processor APIs.
125
+
126
+ ## Delegates
127
+
128
+ Top-level delegates are delivered after generated execution through `onDelegates()`. The worklet
129
+ uses reusable storage allocated during construction; listeners run while the main-side adapter
130
+ drains the shared ring, not as callbacks inside generated DSP code.
131
+
132
+ ```js
133
+ const processor = await createOndaAudioProcessorInitialized(context, artifact, {
134
+ delegateCapacityBytes: 128 * 1024,
135
+ });
136
+
137
+ const unsubscribe = processor.onDelegates(({
138
+ occurrences,
139
+ overflowCount,
140
+ transportDropCount,
141
+ }) => {
142
+ for (const occurrence of occurrences) {
143
+ console.log(occurrence.name, occurrence.values);
144
+ }
145
+ if (overflowCount) console.warn(`${overflowCount} delegate records were dropped`);
146
+ if (transportDropCount) {
147
+ console.warn(`${transportDropCount} delegate records were dropped in transport`);
148
+ }
149
+ });
150
+ ```
151
+
152
+ Capacity defaults to 64 KiB and can be set to zero to disable host collection. It is a host policy,
153
+ not a compiler-computable exact whole-call size: occurrence counts and slice payload lengths may be
154
+ runtime-dependent. The worklet supplies delegate storage to generated code only while at least one
155
+ listener is registered, and decoding happens on the main side. `overflowCount` reports insufficient
156
+ configured capacity; `transportDropCount` separately reports records discarded by the bounded
157
+ worklet-to-main queue. Internal Onda `when` handlers still run in either case. See the internal
158
+ [delegate host integration](../../docs/delegates.md) reference for sizing and lifecycle details.
159
+
160
+ When print and delegate listeners are both active, the adapter invokes them in authored order for
161
+ each init, event, or process segment. It may split one stream's batch around an occurrence from the
162
+ other stream; ordering intentionally does not span separate generated calls.
163
+
164
+ Print and delegate delivery requires `SharedArrayBuffer`. Browser deployments must therefore be
165
+ cross-origin isolated, normally with `Cross-Origin-Opener-Policy: same-origin` and
166
+ `Cross-Origin-Embedder-Policy: require-corp` (or `credentialless`). Audio processing remains usable
167
+ without those headers, but registering an output listener fails with a clear error.
168
+
71
169
  ## Real-time behavior
72
170
 
73
171
  `createOndaAudioProcessor` compiles the processor's `WebAssembly.Module` concurrently with worklet
@@ -78,16 +176,17 @@ compile once and reuse the module:
78
176
  ```js
79
177
  import {
80
178
  compileOndaProcessorModule,
81
- createOndaAudioProcessor,
179
+ createOndaAudioProcessorInitialized,
82
180
  } from "@onda-lang/webaudio";
83
181
 
84
182
  const compiledModule = await compileOndaProcessorModule(artifact);
85
- const left = await createOndaAudioProcessor(context, artifact, { compiledModule });
86
- const right = await createOndaAudioProcessor(context, artifact, { compiledModule });
183
+ const left = await createOndaAudioProcessorInitialized(context, artifact, { compiledModule });
184
+ const right = await createOndaAudioProcessorInitialized(context, artifact, { compiledModule });
87
185
  ```
88
186
 
89
- After construction, the normal f32 render callback reuses cached Wasm-memory views and performs no
90
- host-side allocation or memory growth. Full-block f32 inputs and outputs use typed-array bulk copies;
187
+ After construction, the normal f32 render callback reuses cached Wasm and shared-ring views and
188
+ performs no host-side allocation or memory growth, including while transporting print and delegate
189
+ records. Full-block f32 inputs and outputs use typed-array bulk copies;
91
190
  segmented callbacks and other ABI scalar widths use preallocated typed views with conversion loops
92
191
  (i64 input conversion necessarily creates JavaScript `BigInt` values). External buffers are copied
93
192
  into Wasm with typed-array bulk operations during construction. Missing or `null` bindings install
@@ -98,7 +197,7 @@ nonempty, correctly shaped data.
98
197
  Fixed buffer arrays may be supplied under their logical group name. Each slot is independent:
99
198
 
100
199
  ```js
101
- const processor = await createOndaAudioProcessor(context, artifact, {
200
+ const processor = await createOndaAudioProcessorInitialized(context, artifact, {
102
201
  buffers: {
103
202
  impulse: { data: impulseSamples, channels: 1, sampleRate: 48_000 },
104
203
  bank: [
@@ -112,19 +211,30 @@ const processor = await createOndaAudioProcessor(context, artifact, {
112
211
 
113
212
  Hosts may instead pass a flat array in physical descriptor order or key individual physical names
114
213
  such as `"bank[1]"`. Logical group metadata determines the contiguous slot range; no sample data is
115
- copied when Onda selects a slot while processing.
214
+ copied when Onda selects a slot while processing. Initial descriptors are installed before the
215
+ initialized constructor runs full initialization, so authored top-level and proc init code can
216
+ preprocess the supplied samples once before rendering begins.
116
217
 
117
218
  Artifact descriptors and module exports are validated by the shared, compiler-free
118
219
  `@onda-lang/processor-abi` package before anything reaches the rendering thread.
119
- If generated init, event, or process code returns a nonzero execution status, the adapter reports
120
- an `onda-error`, latches the failed state, and emits silence without re-entering processing. A
121
- successful reset clears the latch after reinitializing state.
220
+ If generated init or event code returns a nonzero execution status, the adapter reports the error
221
+ to the caller. A failing process call reports an `onda-error` and emits silence. Any generated-code
222
+ failure invalidates the live state, so later callbacks remain silent and stateful operations are
223
+ rejected until full initialization or snapshot restoration succeeds.
224
+ `init(ONDA_INIT_PRESERVE_PINNED)` reruns generated initialization
225
+ while preserving pinned roots and task continuations; `init(ONDA_INIT_FULL)` initializes the
226
+ complete physical state and is required before processing an instance returned by
227
+ `createOndaAudioProcessor`. The initialized convenience constructor performs full initialization
228
+ during worklet construction. Neither mode allocates on the successful path, and a
229
+ failure returns the processor to its silent pending state until full initialization or snapshot
230
+ restore succeeds. Suspend or disconnect playback before initialization that performs substantial
231
+ work.
122
232
 
123
233
  Dynamic event storage is also allocated before rendering. Its default capacity is 64 KiB per
124
234
  processor with dynamic events and can be changed explicitly:
125
235
 
126
236
  ```js
127
- const processor = await createOndaAudioProcessor(context, artifact, {
237
+ const processor = await createOndaAudioProcessorInitialized(context, artifact, {
128
238
  eventPayloadCapacityBytes: 256 * 1024,
129
239
  });
130
240
  ```
package/api.md ADDED
@@ -0,0 +1,407 @@
1
+ <!-- Generated from docs/web-api.md; do not edit this packaged copy. -->
2
+
3
+ # Web API reference
4
+
5
+ Onda publishes four ECMAScript-module packages for browsers and Node.js:
6
+
7
+ | Package | Purpose |
8
+ | --- | --- |
9
+ | `@onda-lang/wasm-compiler` | Compile Onda source, workspaces, and project images to complete WebAssembly processor artifacts. |
10
+ | `@onda-lang/processor-abi` | Validate artifacts, inspect metadata, prepare parameter controls, and decode raw delegate and print output. |
11
+ | `@onda-lang/binaryen-web` | Lower trusted, version-matched Onda MIR directly to a processor artifact. |
12
+ | `@onda-lang/webaudio` | Host a complete processor artifact in an `AudioWorklet`. |
13
+
14
+ All packages are ESM-only. `@onda-lang/wasm-compiler` and `@onda-lang/binaryen-web` support modern
15
+ browsers and Node.js 20 or newer. Web Audio construction requires a browser environment with
16
+ `AudioWorklet`; the metadata and parameter helpers re-exported by `@onda-lang/webaudio` are ordinary
17
+ synchronous JavaScript.
18
+
19
+ Each published package contains this reference as `api.md`. TypeScript declarations are included
20
+ at every exported module path.
21
+
22
+ ## Compile source and start audio
23
+
24
+ ```js
25
+ import { createCompiler } from "@onda-lang/wasm-compiler";
26
+ import {
27
+ createOndaAudioProcessorInitialized,
28
+ } from "@onda-lang/webaudio";
29
+
30
+ const compiler = await createCompiler();
31
+ const { artifact } = await compiler.compileSource(source, {
32
+ sampleRate: audioContext.sampleRate,
33
+ blockSize: 128,
34
+ });
35
+
36
+ const print = ({ text }) => console.debug(text);
37
+ const processor = await createOndaAudioProcessorInitialized(
38
+ audioContext,
39
+ artifact,
40
+ {
41
+ params: { gain: 0.5 },
42
+ // A construction-time listener also receives prints emitted by init.
43
+ onPrint: print,
44
+ },
45
+ );
46
+ processor.node.connect(audioContext.destination);
47
+
48
+ const stopDelegates = processor.onDelegates(({ occurrences }) => {
49
+ for (const occurrence of occurrences) {
50
+ console.log(occurrence.name, occurrence.values);
51
+ }
52
+ });
53
+ ```
54
+
55
+ Compilation is an offline operation and may allocate. Constructing the adapter compiles or accepts
56
+ a reusable `WebAssembly.Module` before the audio node starts. Normal rendering uses preallocated
57
+ storage. Delegate and print callbacks run on the main side after bounded worklet transport; they do
58
+ not call JavaScript from generated DSP execution.
59
+
60
+ ## `@onda-lang/wasm-compiler`
61
+
62
+ ### `createCompiler(options?)`
63
+
64
+ Creates an `OndaCompilerInstance`. With no options, compilation runs directly on the calling
65
+ JavaScript thread. Pass `{ worker: true }` to run the frontend and backend in a module worker;
66
+ `workerUrl`, `frontendWasm`, and a custom `Worker` constructor are optional integration hooks.
67
+
68
+ The returned instance provides:
69
+
70
+ - `compileSource(source, options?)` and `inspectSourceConstants(source, options?)`.
71
+ - `compileWorkspace(workspace, options?)` and `inspectWorkspaceConstants(workspace, options?)`.
72
+ - `compileProjectImage(bytes, options?)` and `inspectProjectImageConstants(bytes, options?)`.
73
+ - `createProjectImage(sourceGraph, buffers?)`, `inspectProjectImage(bytes)`,
74
+ `loadProjectFiles(files, projectFilePath?)`, and `materializeProjectImage(bytes, names?)`.
75
+ - `encodeBufferAsset(binding)`, `decodeBufferAsset(bytes)`, and `decodeBufferFile(bytes, path?)`.
76
+ - `projectCapabilities()` for supported image, buffer, and standard-library versions.
77
+ - `sendLspMessage(message)` and `setLspAnalysisOptions(options?)` for the embedded language server.
78
+ - `dispose()`, an idempotent terminal release of compiler and worker resources.
79
+
80
+ Compile options accept `sampleRate`, `blockSize`, typed compile-constant overrides, and `codegen`.
81
+ Code generation can select optimization level `0..4`, shrink level `0..2`, strict or fast math,
82
+ SIMD, loop-containing inlining, and optional WAT emission. A successful compilation returns an
83
+ `OndaCompilationResult` containing the artifact, resolved source paths, and the exact source graph
84
+ when one is available.
85
+
86
+ Configuration and lifecycle failures throw `OndaCompilerError`. Authored-source, project, MIR, and
87
+ code-generation failures throw `OndaCompileError`, whose `diagnostics`, `sourceFiles`, and
88
+ `unresolvedSourceFiles` fields support editors and file watchers. `OndaBinaryenError` identifies a
89
+ failure in the MIR-to-Wasm backend.
90
+
91
+ `MIR_SCHEMA_VERSION` is the schema accepted by the bundled backend. `ONDA_VERSION` is the compiler
92
+ version. `createDefaultImports()` returns the imports required by current generated modules; it is
93
+ currently an empty object because artifacts are self-contained.
94
+
95
+ The `@onda-lang/wasm-compiler/artifact` subpath re-exports the complete
96
+ `@onda-lang/processor-abi` surface without loading the compiler. The
97
+ `@onda-lang/wasm-compiler/worker` subpath is a side-effect-only module-worker entry and has no
98
+ named exports.
99
+
100
+ ## `@onda-lang/processor-abi`
101
+
102
+ An `OndaProcessorArtifact` contains WebAssembly bytes, an `OndaProcessorMetadata` descriptor, and
103
+ optional WAT. Treat the bytes and descriptor as one integrity-associated pair.
104
+
105
+ ### Validation and files
106
+
107
+ - `validateProcessorMetadata(metadata, expectedKind?)` validates and returns the current descriptor.
108
+ - `validateProcessorArtifact(artifact, options?)` normalizes bytes and optionally inspects the module.
109
+ - `validateProcessorModule(module, metadata)` verifies a precompiled module against its descriptor.
110
+ - `parseProcessorMetadata(input, expectedKind?)` parses JSON or validates an object.
111
+ - `serializeProcessorMetadata(metadata, space?)` validates before producing newline-terminated JSON.
112
+ - `createProcessorArtifactFiles(artifact, options?)` creates associated `.wasm` and `.onda.json`
113
+ records, including integrity metadata.
114
+ - `loadProcessorArtifactFiles(wasm, metadata)` validates a loaded pair and its integrity association.
115
+
116
+ Failures throw `OndaArtifactError`. Hosts must reject unsupported artifact-format, ABI, and snapshot
117
+ versions rather than guessing layout compatibility.
118
+
119
+ ### Parameter controls
120
+
121
+ `createParamControl(metadata)` validates one scalar parameter descriptor and returns a reusable
122
+ `OndaPreparedParamControl`. `createParamDomain(domain)` does the same from already-decoded values.
123
+ Prepared controls expose `constrainPlain`, `normalizedToPlain`, and `plainToNormalized` methods.
124
+
125
+ The one-shot `constrainParamPlain`, `paramNormalizedToPlain`, and `paramPlainToNormalized`
126
+ functions provide the same behavior. Preparing once is preferable for frequently updated UI:
127
+ validation and decimal descriptor decoding stay off the interaction path. Mappings preserve exact
128
+ endpoints, apply linear, logarithmic, or curved scale, and clamp and snap to the declared grid.
129
+
130
+ ### Delegates and print output
131
+
132
+ Complete wasm32 processor exports receive an optional execution-output descriptor containing
133
+ independently nullable delegate and print batches. Allocate all descriptors and storage before
134
+ real-time execution.
135
+
136
+ `writeDelegateBatch` and `writePrintBatch` initialize reusable batch descriptors.
137
+ `writeExecutionOutput` connects their addresses. Call `resetExecutionOutput` immediately before
138
+ every generated init, process, or event entry. After a successful generated call,
139
+ `readDelegateBatch` or `readPrintBatch` validates the result counters.
140
+ `decodeDelegateRecords` converts delegate payloads using `metadata.delegates`.
141
+ `decodePrintRecords` preserves primitive types and source sites; `formatPrintRecords` and
142
+ `formatPrintBatch` add canonical text formatting. Both decoded record types expose a `sequence` from
143
+ the host-reset call-local counter; merge that call's two arrays by this field when presenting one
144
+ chronological output stream.
145
+
146
+ Batch capacity is host policy. `overflowCount` reports whole records that did not fit; it is not a
147
+ byte count. Consume the returned storage before reusing it for another init, process, or event call.
148
+ See the [language guide](https://onda-lang.org/docs/language/#delegates) for authored semantics and
149
+ the [processor API](https://onda-lang.org/docs/processor-api/#call-scoped-execution-output) for
150
+ physical record layout.
151
+
152
+ The metadata interfaces expose target facts, storage sizes, ports, parameters, states, events,
153
+ delegates, print sites, buffers, and integration profiles. Scalar `i64` values decoded from records
154
+ use `bigint`; booleans use `boolean`; fixed arrays and slices become JavaScript arrays.
155
+
156
+ ## `@onda-lang/binaryen-web`
157
+
158
+ ### `compileTrustedMir(mir, options?)`
159
+
160
+ Lowers MIR emitted by the matching Onda semantic frontend. Input may be compact MessagePack, JSON,
161
+ or an already-decoded object. The function is synchronous and returns an
162
+ `OndaProcessorArtifact`. It is intentionally not a validator for untrusted or hand-authored MIR;
163
+ the producer owns semantic, type, bounds, and resource proofs.
164
+
165
+ `OndaBinaryenOptions` controls the same backend policies exposed through compiler `codegen`.
166
+ `SUPPORTED_MIR_SCHEMA_VERSION` identifies the required producer schema. `createDefaultImports()`
167
+ returns an empty object for current self-contained artifacts. Backend failures throw
168
+ `OndaBinaryenError`.
169
+
170
+ The package root re-exports the common artifact validation and file helpers. The
171
+ `@onda-lang/binaryen-web/artifact` subpath re-exports the complete
172
+ `@onda-lang/processor-abi` module without loading Binaryen.
173
+
174
+ ## `@onda-lang/webaudio`
175
+
176
+ ### Construction
177
+
178
+ - `registerOndaAudioWorklet(context, workletUrl?)` registers the processor once per context.
179
+ - `compileOndaProcessorModule(artifact)` validates and compiles a reusable module off the render thread.
180
+ - `ondaAudioWorkletNodeOptions(artifact, options?)` builds low-level node options.
181
+ - `createOndaAudioProcessor(context, artifact, options?)` allocates an uninitialized adapter.
182
+ - `createOndaAudioProcessorInitialized(context, artifact, options?)` allocates and fully initializes it.
183
+ - `flattenedAudioChannelCount(ports?)` totals declared physical channels with validation.
184
+
185
+ `OndaAudioProcessorOptions` accepts initial plain parameter values, external buffers, event,
186
+ delegate, and print capacities, an optional construction-time `onPrint` listener, a precompiled
187
+ module, custom node options, and an `AudioWorkletNode` constructor. Pass `onPrint` when using the
188
+ initialized constructor if initialization output must be observed; registering a listener after
189
+ construction cannot replay output from an execution that has already completed. The artifact sample
190
+ rate must equal the context sample rate and it must expose at least one audio input or output.
191
+ Print and delegate delivery uses a bounded `SharedArrayBuffer` ring and requires cross-origin
192
+ isolation in browsers; ordinary audio processing remains available when shared memory is absent.
193
+ Low-level callers that manually pair the returned node options with `OndaAudioProcessor` must pass
194
+ `processorOptions.executionOutputRing` as the adapter constructor's fourth argument.
195
+
196
+ ### `OndaAudioProcessor`
197
+
198
+ The adapter exposes its `node` and validated `metadata`, plus these operations:
199
+
200
+ - `setParam(nameOrIndex, plain)` and `setParamNormalized(nameOrIndex, normalized)`.
201
+ - `trigger(nameOrIndex, values?)` for input events.
202
+ - `onDelegates(listener)` and `onPrint(listener)`, each returning an unsubscribe function.
203
+ - `init(mode)`, `snapshot()`, and `restoreSnapshot(bytes)`.
204
+ - `readControlOutputs()` and `readBuffer(nameOrIndex)`.
205
+ - `request(type, fields?, transfer?)` for adapter protocol extensions.
206
+ - `close(reason?)`, an idempotent terminal release of adapter-side resources.
207
+
208
+ Delegate and print batches report `overflowCount` for generated-storage loss and
209
+ `transportDropCount` for bounded worklet-to-main queue loss. Loss-only notifications can arrive
210
+ without occurrences. Collection is enabled only while the corresponding listener set is nonempty;
211
+ setting the capacity to zero disables host delivery even with listeners while preserving language
212
+ evaluation semantics.
213
+
214
+ With both listener types active, the adapter invokes them in call-local sequence order and may split
215
+ a same-stream batch around an intervening occurrence from the other stream. Ordering resets for
216
+ each init, event, or process segment.
217
+
218
+ `ONDA_INIT_FULL` clears and initializes all physical state. `ONDA_INIT_PRESERVE_PINNED` retains
219
+ pinned state according to the processor ABI. The package also re-exports the prepared and one-shot
220
+ parameter conversion helpers.
221
+
222
+ `@onda-lang/webaudio/worklet` is the side-effect-only AudioWorklet registration module and has no
223
+ named exports.
224
+
225
+ ## Complete exported surface
226
+
227
+ The following indexes include runtime values and TypeScript-only types from each package root.
228
+ They are checked against the shipped declarations so additions cannot silently escape this
229
+ reference. Artifact subpaths are complete processor-ABI re-exports; worker and worklet subpaths are
230
+ side-effect-only as described above.
231
+
232
+ ### `@onda-lang/processor-abi`
233
+
234
+ <!-- BEGIN WEB API onda_processor_abi -->
235
+ DELEGATE_BATCH_SIZE_BYTES
236
+ DELEGATE_RECORD_HEADER_SIZE_BYTES
237
+ EXECUTION_OUTPUT_SIZE_BYTES
238
+ OndaArtifactError
239
+ OndaArtifactKind
240
+ OndaBufferArrayMetadata
241
+ OndaBufferMetadata
242
+ OndaDelegateBatch
243
+ OndaDelegateMetadata
244
+ OndaDelegateOccurrence
245
+ OndaDelegateParamMetadata
246
+ OndaEventMetadata
247
+ OndaEventParamMetadata
248
+ OndaIntegrationProfile
249
+ OndaIoMetadata
250
+ OndaLogSiteMetadata
251
+ OndaParamControlMetadata
252
+ OndaParamDomain
253
+ OndaPreparedParamControl
254
+ OndaPrintBatch
255
+ OndaPrintEntry
256
+ OndaProcessorArtifact
257
+ OndaProcessorInitMode
258
+ OndaProcessorMetadata
259
+ OndaScalarType
260
+ OndaStateMetadata
261
+ OndaTargetInfo
262
+ PRINT_BATCH_SIZE_BYTES
263
+ PRINT_RECORD_HEADER_SIZE_BYTES
264
+ PROCESSOR_ABI_VERSION
265
+ PROCESSOR_ARTIFACT_FORMAT
266
+ PROCESSOR_ARTIFACT_FORMAT_VERSION
267
+ PROCESSOR_EXECUTION_OK
268
+ PROCESSOR_EXECUTION_RUNTIME_SAFETY_FAILURE
269
+ PROCESSOR_INIT_FULL
270
+ PROCESSOR_INIT_PRESERVE_PINNED
271
+ PROCESSOR_SNAPSHOT_FORMAT_VERSION
272
+ constrainParamPlain
273
+ createParamControl
274
+ createParamDomain
275
+ createProcessorArtifactFiles
276
+ decodeDelegateRecords
277
+ decodePrintRecords
278
+ formatPrintBatch
279
+ formatPrintRecords
280
+ loadProcessorArtifactFiles
281
+ paramNormalizedToPlain
282
+ paramPlainToNormalized
283
+ parseProcessorMetadata
284
+ readDelegateBatch
285
+ readPrintBatch
286
+ resetExecutionOutput
287
+ serializeProcessorMetadata
288
+ validateProcessorArtifact
289
+ validateProcessorMetadata
290
+ validateProcessorModule
291
+ writeDelegateBatch
292
+ writeExecutionOutput
293
+ writePrintBatch
294
+ <!-- END WEB API onda_processor_abi -->
295
+
296
+ ### `@onda-lang/binaryen-web`
297
+
298
+ <!-- BEGIN WEB API onda_binaryen_web -->
299
+ OndaArtifactError
300
+ OndaBinaryenError
301
+ OndaBinaryenOptions
302
+ OndaProcessorArtifact
303
+ OndaProcessorMetadata
304
+ PROCESSOR_ABI_VERSION
305
+ PROCESSOR_ARTIFACT_FORMAT
306
+ PROCESSOR_ARTIFACT_FORMAT_VERSION
307
+ PROCESSOR_EXECUTION_OK
308
+ PROCESSOR_EXECUTION_RUNTIME_SAFETY_FAILURE
309
+ PROCESSOR_SNAPSHOT_FORMAT_VERSION
310
+ SUPPORTED_MIR_SCHEMA_VERSION
311
+ compileTrustedMir
312
+ createDefaultImports
313
+ createProcessorArtifactFiles
314
+ loadProcessorArtifactFiles
315
+ parseProcessorMetadata
316
+ serializeProcessorMetadata
317
+ validateProcessorArtifact
318
+ validateProcessorMetadata
319
+ validateProcessorModule
320
+ <!-- END WEB API onda_binaryen_web -->
321
+
322
+ ### `@onda-lang/wasm-compiler`
323
+
324
+ <!-- BEGIN WEB API onda_wasm_compiler -->
325
+ DirectCompilerOptions
326
+ MIR_SCHEMA_VERSION
327
+ ONDA_VERSION
328
+ OndaArtifactError
329
+ OndaBinaryenError
330
+ OndaBufferAssetBinding
331
+ OndaBufferData
332
+ OndaBufferElement
333
+ OndaCodegenOptions
334
+ OndaCompilationResult
335
+ OndaCompileConstDescriptor
336
+ OndaCompileConstElement
337
+ OndaCompileConstInspectionOptions
338
+ OndaCompileConstKind
339
+ OndaCompileConstValue
340
+ OndaCompileError
341
+ OndaCompileOptions
342
+ OndaCompilerDiagnostic
343
+ OndaCompilerError
344
+ OndaCompilerInstance
345
+ OndaLspAnalysisOptions
346
+ OndaLspMessage
347
+ OndaMaterializedProjectFile
348
+ OndaProcessorArtifact
349
+ OndaProcessorMetadata
350
+ OndaProjectBufferInfo
351
+ OndaProjectCapabilities
352
+ OndaProjectImageInfo
353
+ OndaProjectMaterialization
354
+ OndaResolvedCompileConstValue
355
+ OndaSerializedProjectImage
356
+ OndaSourceDocument
357
+ OndaSourceGraph
358
+ OndaSourceReferenceKind
359
+ OndaSourceResolution
360
+ OndaSourceWorkspace
361
+ OndaWorkerConstructor
362
+ OndaWorkerLike
363
+ PROCESSOR_ABI_VERSION
364
+ PROCESSOR_ARTIFACT_FORMAT
365
+ PROCESSOR_ARTIFACT_FORMAT_VERSION
366
+ PROCESSOR_EXECUTION_OK
367
+ PROCESSOR_EXECUTION_RUNTIME_SAFETY_FAILURE
368
+ PROCESSOR_SNAPSHOT_FORMAT_VERSION
369
+ WorkerCompilerOptions
370
+ createCompiler
371
+ createDefaultImports
372
+ createProcessorArtifactFiles
373
+ loadProcessorArtifactFiles
374
+ parseProcessorMetadata
375
+ serializeProcessorMetadata
376
+ validateProcessorArtifact
377
+ validateProcessorMetadata
378
+ validateProcessorModule
379
+ <!-- END WEB API onda_wasm_compiler -->
380
+
381
+ ### `@onda-lang/webaudio`
382
+
383
+ <!-- BEGIN WEB API onda_webaudio -->
384
+ ONDA_AUDIO_WORKLET_PROCESSOR_NAME
385
+ ONDA_INIT_FULL
386
+ ONDA_INIT_PRESERVE_PINNED
387
+ OndaAudioProcessor
388
+ OndaAudioProcessorOptions
389
+ OndaAudioPrintBatch
390
+ OndaAudioPrintListener
391
+ OndaInitMode
392
+ OndaParamDomain
393
+ OndaPreparedParamControl
394
+ OndaProcessorArtifact
395
+ OndaProcessorMetadata
396
+ compileOndaProcessorModule
397
+ constrainParamPlain
398
+ createOndaAudioProcessor
399
+ createOndaAudioProcessorInitialized
400
+ createParamControl
401
+ createParamDomain
402
+ flattenedAudioChannelCount
403
+ ondaAudioWorkletNodeOptions
404
+ paramNormalizedToPlain
405
+ paramPlainToNormalized
406
+ registerOndaAudioWorklet
407
+ <!-- END WEB API onda_webaudio -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onda-lang/webaudio",
3
- "version": "0.7.4",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "description": "Optional Web Audio adapter for Onda processor WebAssembly artifacts",
6
6
  "license": "MIT",
@@ -25,14 +25,16 @@
25
25
  },
26
26
  "files": [
27
27
  "src",
28
+ "api.md",
28
29
  "LICENSE",
29
30
  "README.md"
30
31
  ],
31
32
  "scripts": {
32
- "test": "node --test"
33
+ "test": "node --test",
34
+ "prepack": "node ../../scripts/stage-web-api-docs.mjs"
33
35
  },
34
36
  "dependencies": {
35
- "@onda-lang/processor-abi": "0.7.4"
37
+ "@onda-lang/processor-abi": "0.8.0"
36
38
  },
37
39
  "publishConfig": {
38
40
  "access": "public"