@xybrid/react-native 0.10.0-rc1

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.
Files changed (87) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +298 -0
  3. package/android/build.gradle +61 -0
  4. package/android/src/main/AndroidManifest.xml +1 -0
  5. package/android/src/main/java/ai/xybrid/reactnative/XybridCodec.kt +481 -0
  6. package/android/src/main/java/ai/xybrid/reactnative/XybridHandles.kt +139 -0
  7. package/android/src/main/java/ai/xybrid/reactnative/XybridModule.kt +665 -0
  8. package/android/src/main/java/ai/xybrid/reactnative/XybridPackage.kt +27 -0
  9. package/ios/XybridCodec.swift +508 -0
  10. package/ios/XybridHandles.swift +191 -0
  11. package/ios/XybridModule.mm +494 -0
  12. package/ios/XybridModuleImpl.swift +887 -0
  13. package/ios/XybridSwift/Xybrid.swift +1401 -0
  14. package/ios/XybridSwift/xybrid_bolt.swift +3198 -0
  15. package/ios/xybrid_natives.rb +178 -0
  16. package/lib/commonjs/NativeXybrid.js +24 -0
  17. package/lib/commonjs/base64.js +45 -0
  18. package/lib/commonjs/cancel.js +35 -0
  19. package/lib/commonjs/context.js +67 -0
  20. package/lib/commonjs/envelope.js +79 -0
  21. package/lib/commonjs/errors.js +61 -0
  22. package/lib/commonjs/index.js +59 -0
  23. package/lib/commonjs/model.js +307 -0
  24. package/lib/commonjs/pipeline.js +55 -0
  25. package/lib/commonjs/presets.js +32 -0
  26. package/lib/commonjs/session.js +76 -0
  27. package/lib/commonjs/types.js +10 -0
  28. package/lib/commonjs/wire.js +285 -0
  29. package/lib/commonjs/xybrid.js +133 -0
  30. package/lib/module/NativeXybrid.js +22 -0
  31. package/lib/module/base64.js +41 -0
  32. package/lib/module/cancel.js +29 -0
  33. package/lib/module/context.js +60 -0
  34. package/lib/module/envelope.js +73 -0
  35. package/lib/module/errors.js +56 -0
  36. package/lib/module/index.js +36 -0
  37. package/lib/module/model.js +298 -0
  38. package/lib/module/pipeline.js +48 -0
  39. package/lib/module/presets.js +27 -0
  40. package/lib/module/session.js +69 -0
  41. package/lib/module/types.js +9 -0
  42. package/lib/module/wire.js +271 -0
  43. package/lib/module/xybrid.js +127 -0
  44. package/lib/typescript/NativeXybrid.d.ts +68 -0
  45. package/lib/typescript/NativeXybrid.d.ts.map +1 -0
  46. package/lib/typescript/base64.d.ts +5 -0
  47. package/lib/typescript/base64.d.ts.map +1 -0
  48. package/lib/typescript/cancel.d.ts +24 -0
  49. package/lib/typescript/cancel.d.ts.map +1 -0
  50. package/lib/typescript/context.d.ts +40 -0
  51. package/lib/typescript/context.d.ts.map +1 -0
  52. package/lib/typescript/envelope.d.ts +51 -0
  53. package/lib/typescript/envelope.d.ts.map +1 -0
  54. package/lib/typescript/errors.d.ts +12 -0
  55. package/lib/typescript/errors.d.ts.map +1 -0
  56. package/lib/typescript/index.d.ts +28 -0
  57. package/lib/typescript/index.d.ts.map +1 -0
  58. package/lib/typescript/model.d.ts +211 -0
  59. package/lib/typescript/model.d.ts.map +1 -0
  60. package/lib/typescript/pipeline.d.ts +35 -0
  61. package/lib/typescript/pipeline.d.ts.map +1 -0
  62. package/lib/typescript/presets.d.ts +21 -0
  63. package/lib/typescript/presets.d.ts.map +1 -0
  64. package/lib/typescript/session.d.ts +50 -0
  65. package/lib/typescript/session.d.ts.map +1 -0
  66. package/lib/typescript/types.d.ts +313 -0
  67. package/lib/typescript/types.d.ts.map +1 -0
  68. package/lib/typescript/wire.d.ts +130 -0
  69. package/lib/typescript/wire.d.ts.map +1 -0
  70. package/lib/typescript/xybrid.d.ts +89 -0
  71. package/lib/typescript/xybrid.d.ts.map +1 -0
  72. package/package.json +88 -0
  73. package/react-native-xybrid.podspec +50 -0
  74. package/src/NativeXybrid.ts +131 -0
  75. package/src/base64.ts +43 -0
  76. package/src/cancel.ts +47 -0
  77. package/src/context.ts +70 -0
  78. package/src/envelope.ts +115 -0
  79. package/src/errors.ts +67 -0
  80. package/src/index.ts +91 -0
  81. package/src/model.ts +408 -0
  82. package/src/pipeline.ts +66 -0
  83. package/src/presets.ts +36 -0
  84. package/src/session.ts +76 -0
  85. package/src/types.ts +362 -0
  86. package/src/wire.ts +408 -0
  87. package/src/xybrid.ts +176 -0
@@ -0,0 +1,307 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ModelDownload = exports.Model = exports.ModelLoader = void 0;
7
+ const NativeXybrid_1 = __importDefault(require("./NativeXybrid"));
8
+ const cancel_1 = require("./cancel");
9
+ const session_1 = require("./session");
10
+ const wire_1 = require("./wire");
11
+ function toWireSource(source) {
12
+ switch (source.kind) {
13
+ case 'registry':
14
+ case 'registrySpeculative':
15
+ return { kind: source.kind, value: source.id };
16
+ case 'bundle':
17
+ case 'directory':
18
+ case 'modelFile':
19
+ return { kind: source.kind, value: source.path };
20
+ case 'huggingFace':
21
+ return {
22
+ kind: source.kind,
23
+ value: source.repo,
24
+ ...(source.revision ? { revision: source.revision } : {}),
25
+ };
26
+ }
27
+ }
28
+ /**
29
+ * A cheap description of a model. Creating one does no I/O; {@link load}
30
+ * resolves, downloads if needed, and loads it.
31
+ */
32
+ class ModelLoader {
33
+ constructor(source) {
34
+ this.source = source;
35
+ }
36
+ /** Describe any source. */
37
+ static from(source) {
38
+ return new ModelLoader(source);
39
+ }
40
+ /** A model from the Xybrid registry. The recommended path. */
41
+ static fromRegistry(id) {
42
+ return new ModelLoader({ kind: 'registry', id });
43
+ }
44
+ /**
45
+ * Serve from the cloud gateway while the registry weights download in the
46
+ * background, instead of blocking on the download. `load()` then resolves
47
+ * almost immediately with a model that switches to on-device by itself.
48
+ * Needs an API key and an uncached model — {@link willSpeculate} tells you
49
+ * up front — otherwise it behaves like {@link fromRegistry}. LLM/chat only.
50
+ */
51
+ static fromRegistrySpeculative(id) {
52
+ return new ModelLoader({ kind: 'registrySpeculative', id });
53
+ }
54
+ /** A local `.xyb` bundle. */
55
+ static fromBundle(path) {
56
+ return new ModelLoader({ kind: 'bundle', path });
57
+ }
58
+ /** A local directory containing `model_metadata.json`. */
59
+ static fromDirectory(path) {
60
+ return new ModelLoader({ kind: 'directory', path });
61
+ }
62
+ /** A Hugging Face repository (`org/repo` or `org/repo:variant`), optionally pinned. */
63
+ static fromHuggingFace(repo, options = {}) {
64
+ return new ModelLoader({ kind: 'huggingFace', repo, ...options });
65
+ }
66
+ /** A raw GGUF file; `model_metadata.json` is generated next to it if absent. */
67
+ static fromModelFile(path) {
68
+ return new ModelLoader({ kind: 'modelFile', path });
69
+ }
70
+ /** Resolve, download if needed, and load. Rejects with a typed `xybrid_*` code. */
71
+ async load() {
72
+ return new Model(await NativeXybrid_1.default.loadModel(toWireSource(this.source)));
73
+ }
74
+ /**
75
+ * Whether {@link load} would actually speculate: a speculative source, an
76
+ * API key, and a model not yet cached. Never touches the network.
77
+ */
78
+ async willSpeculate() {
79
+ if (this.source.kind !== 'registrySpeculative')
80
+ return false;
81
+ return NativeXybrid_1.default.willSpeculate(this.source.id);
82
+ }
83
+ /**
84
+ * Start downloading the weights in the background without loading them —
85
+ * the object to drive a progress bar from. The download fills the cache, so
86
+ * the {@link load} afterwards returns at once. Resolves `null` for sources
87
+ * with nothing to fetch (bundle, directory, Hugging Face, model file).
88
+ */
89
+ async download(options = {}) {
90
+ const { source } = this;
91
+ if (source.kind !== 'registry' && source.kind !== 'registrySpeculative')
92
+ return null;
93
+ return new ModelDownload(await NativeXybrid_1.default.startDownload(source.id, options.platform ?? null));
94
+ }
95
+ }
96
+ exports.ModelLoader = ModelLoader;
97
+ /** A model loaded in native memory. Call {@link release} when done with it. */
98
+ class Model {
99
+ /** @internal Use {@link ModelLoader.load}. */
100
+ constructor(
101
+ /** Opaque native handle — not the model id; see {@link info}. */
102
+ handle) {
103
+ this.handle = handle;
104
+ }
105
+ /** Identity and capabilities, in one native call. */
106
+ async info() {
107
+ const raw = (await NativeXybrid_1.default.modelInfo(this.handle));
108
+ return {
109
+ ...raw,
110
+ defaultGenerationConfig: (0, wire_1.fromWireGenerationConfig)(raw.defaultGenerationConfig),
111
+ };
112
+ }
113
+ /** Whether the weights are resident (false after {@link unload} until the next run). */
114
+ isLoaded() {
115
+ return NativeXybrid_1.default.isLoaded(this.handle);
116
+ }
117
+ /**
118
+ * Run one inference. Pass sampling parameters under `generationConfig`,
119
+ * a conversation under `context`, and an `AbortSignal` under `signal`.
120
+ */
121
+ async run(envelope, options = {}) {
122
+ const wireEnvelope = (0, wire_1.toWireEnvelope)(envelope);
123
+ const cancel = await (0, cancel_1.bindCancel)(options.signal);
124
+ try {
125
+ const wire = await NativeXybrid_1.default.run(this.handle, wireEnvelope, (0, wire_1.toWireRunOptions)(options, { context: options.context?.handle, cancel: cancel.token }));
126
+ return (0, wire_1.fromWireResult)(wire);
127
+ }
128
+ finally {
129
+ await cancel.release();
130
+ }
131
+ }
132
+ /**
133
+ * Stream inference token by token. Yields each {@link StreamToken}; the
134
+ * final {@link InferenceResult} is the generator's return value.
135
+ *
136
+ * ```ts
137
+ * for await (const token of model.runStreaming(Envelope.text('Hi'))) {
138
+ * setText((prev) => prev + token.token);
139
+ * }
140
+ * ```
141
+ *
142
+ * Generation stops natively when iteration ends — completion, `break`, a
143
+ * thrown error, or an aborted `signal`. A generator that is merely
144
+ * abandoned is never cleaned up (JS runs no `finally` on GC), so on
145
+ * unmount abort the signal or call `gen.return()`.
146
+ *
147
+ * When the turn ends on tool calls, the terminal token carries `toolCalls`
148
+ * and `rawText` (pass it to `Envelope.toolResults`).
149
+ */
150
+ async *runStreaming(envelope, options = {}) {
151
+ const wireEnvelope = (0, wire_1.toWireEnvelope)(envelope);
152
+ const cancel = await (0, cancel_1.bindCancel)(options.signal);
153
+ let stream = null;
154
+ try {
155
+ stream = await NativeXybrid_1.default.streamStart(this.handle, wireEnvelope, (0, wire_1.toWireRunOptions)(options, { context: options.context?.handle, cancel: cancel.token }));
156
+ for (;;) {
157
+ const event = (await NativeXybrid_1.default.streamNext(stream));
158
+ // `null`: the stream was disposed underneath us (model released).
159
+ if (event == null)
160
+ return undefined;
161
+ switch (event.kind) {
162
+ case 'token':
163
+ yield (0, wire_1.fromWireStreamToken)(event.token);
164
+ break;
165
+ case 'complete':
166
+ return (0, wire_1.fromWireResult)(event.result);
167
+ default:
168
+ throw new Error(`Unexpected stream event: ${String(event.kind)}`);
169
+ }
170
+ }
171
+ }
172
+ finally {
173
+ // Disposing aborts native generation; idempotent after completion.
174
+ if (stream !== null)
175
+ await NativeXybrid_1.default.dispose(stream).catch(() => { });
176
+ await cancel.release();
177
+ }
178
+ }
179
+ /**
180
+ * Open a live ASR session: feed microphone PCM in, read partial transcripts
181
+ * out. Audio must be Float32, mono, 16 kHz. Rejects with
182
+ * `xybrid_streaming_unsupported` for a model that cannot stream.
183
+ */
184
+ async stream(config = {}) {
185
+ return new session_1.StreamingSession(await NativeXybrid_1.default.openStreamingSession(this.handle, config));
186
+ }
187
+ /** Prime the model so first-token latency measures inference, not cold start. */
188
+ warmup() {
189
+ return NativeXybrid_1.default.warmup(this.handle);
190
+ }
191
+ /**
192
+ * Free the weights while keeping this handle valid — the next run reloads
193
+ * them. Contrast with {@link release}, which frees the handle.
194
+ */
195
+ unload() {
196
+ return NativeXybrid_1.default.unload(this.handle);
197
+ }
198
+ /**
199
+ * Whether runs are currently answered by the cloud because the local
200
+ * weights aren't ready (speculative loads). Predicts the next run;
201
+ * `InferenceResult.executionTarget` reports what a finished run did.
202
+ */
203
+ isCloudServing() {
204
+ return NativeXybrid_1.default.isCloudServing(this.handle);
205
+ }
206
+ /** Download progress of a speculative load; `ready` at 1.0 for local models. */
207
+ async downloadStatus() {
208
+ return (0, wire_1.fromWireDownloadStatus)((await NativeXybrid_1.default.downloadStatus(this.handle)));
209
+ }
210
+ /**
211
+ * Yield the speculative download's status whenever it changes, ending
212
+ * after a terminal state. A local model yields one `ready` frame.
213
+ */
214
+ downloadProgress(options = {}) {
215
+ return pollDownload(() => this.downloadStatus(), options.intervalMs);
216
+ }
217
+ /**
218
+ * Wait natively until the download settles or `timeoutMs` elapses, then
219
+ * report it. `0` makes it a non-blocking read.
220
+ */
221
+ async awaitDownload(timeoutMs) {
222
+ return (0, wire_1.fromWireDownloadStatus)((await NativeXybrid_1.default.awaitDownload(this.handle, timeoutMs)));
223
+ }
224
+ /** TTS voices; empty for models without voices. */
225
+ async voices() {
226
+ return (await NativeXybrid_1.default.voices(this.handle));
227
+ }
228
+ /** The default TTS voice, if the model has voices. */
229
+ async defaultVoice() {
230
+ return (await NativeXybrid_1.default.defaultVoice(this.handle));
231
+ }
232
+ /** One TTS voice by id. */
233
+ async voice(voiceId) {
234
+ return (await NativeXybrid_1.default.voice(this.handle, voiceId));
235
+ }
236
+ /**
237
+ * Free the native model — weights live in the native heap, so release
238
+ * models you no longer need. Also stops token streams started from it.
239
+ * Later calls on this instance reject with `xybrid_handle`.
240
+ */
241
+ release() {
242
+ return NativeXybrid_1.default.dispose(this.handle);
243
+ }
244
+ }
245
+ exports.Model = Model;
246
+ const TERMINAL_STATES = new Set(['ready', 'failed', 'cancelled']);
247
+ /**
248
+ * Poll `read` and yield each changed status, ending after a terminal state.
249
+ * The native side throttles its own updates (~10/s), so a 200 ms default
250
+ * loses nothing a progress bar can show.
251
+ */
252
+ async function* pollDownload(read, intervalMs = 200) {
253
+ const delay = Math.max(16, intervalMs);
254
+ let previous = null;
255
+ for (;;) {
256
+ const status = await read();
257
+ if (previous === null ||
258
+ status.state !== previous.state ||
259
+ status.downloadedBytes !== previous.downloadedBytes ||
260
+ status.progress !== previous.progress) {
261
+ yield status;
262
+ previous = status;
263
+ }
264
+ if (TERMINAL_STATES.has(status.state))
265
+ return;
266
+ await new Promise((resolve) => setTimeout(resolve, delay));
267
+ }
268
+ }
269
+ /**
270
+ * A model download running in the background, separate from loading. Start
271
+ * one with {@link ModelLoader.download}. Releasing the handle does not stop
272
+ * the transfer — call {@link cancel}.
273
+ */
274
+ class ModelDownload {
275
+ /** @internal */
276
+ constructor(handle) {
277
+ this.handle = handle;
278
+ }
279
+ /** Progress, bytes and state in one consistent read. */
280
+ async status() {
281
+ return (0, wire_1.fromWireDownloadStatus)((await NativeXybrid_1.default.downloadHandleStatus(this.handle)));
282
+ }
283
+ /** The failure message once the download failed, else `null`. */
284
+ error() {
285
+ return NativeXybrid_1.default.downloadHandleError(this.handle);
286
+ }
287
+ /** Stop the transfer. The status then settles on `cancelled`. */
288
+ cancel() {
289
+ return NativeXybrid_1.default.cancelDownload(this.handle);
290
+ }
291
+ /**
292
+ * Yield the status whenever it changes, ending after a terminal state
293
+ * (`ready`, `failed`, `cancelled`). Polls natively every `intervalMs`.
294
+ *
295
+ * ```ts
296
+ * for await (const s of download.progress()) setProgress(s.progress);
297
+ * ```
298
+ */
299
+ progress(options = {}) {
300
+ return pollDownload(() => this.status(), options.intervalMs);
301
+ }
302
+ /** Free the handle (the transfer keeps going unless cancelled). */
303
+ release() {
304
+ return NativeXybrid_1.default.dispose(this.handle);
305
+ }
306
+ }
307
+ exports.ModelDownload = ModelDownload;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Pipeline = void 0;
7
+ const NativeXybrid_1 = __importDefault(require("./NativeXybrid"));
8
+ const wire_1 = require("./wire");
9
+ /**
10
+ * A multi-stage pipeline (e.g. ASR → LLM → TTS) defined in YAML. A run
11
+ * returns every stage's output, so a voice assistant can show what it heard
12
+ * and what it answered while it plays the audio:
13
+ *
14
+ * ```ts
15
+ * const pipeline = await Pipeline.fromFile(path);
16
+ * const result = await pipeline.run(Envelope.audio(pcmBase64));
17
+ * const heard = result.stages.find((s) => s.stageId === 'asr')?.text;
18
+ * ```
19
+ */
20
+ class Pipeline {
21
+ constructor(
22
+ /** Opaque native handle. */
23
+ handle) {
24
+ this.handle = handle;
25
+ }
26
+ /** Parse and load a pipeline from YAML content. */
27
+ static async fromYaml(yaml) {
28
+ return new Pipeline(await NativeXybrid_1.default.loadPipeline({ kind: 'yaml', value: yaml }));
29
+ }
30
+ /** Read, parse and load a pipeline YAML file. */
31
+ static async fromFile(path) {
32
+ return new Pipeline(await NativeXybrid_1.default.loadPipeline({ kind: 'file', value: path }));
33
+ }
34
+ /** Load a pipeline bundle. */
35
+ static async fromBundle(path) {
36
+ return new Pipeline(await NativeXybrid_1.default.loadPipeline({ kind: 'bundle', value: path }));
37
+ }
38
+ /** Name and stage ids, in execution order. */
39
+ async info() {
40
+ return (await NativeXybrid_1.default.pipelineInfo(this.handle));
41
+ }
42
+ /**
43
+ * Run every stage, downloading any missing model first. Per-stage
44
+ * generation settings belong in the YAML; only `correlationId` applies here.
45
+ */
46
+ async run(envelope, options = {}) {
47
+ const wire = await NativeXybrid_1.default.runPipeline(this.handle, (0, wire_1.toWireEnvelope)(envelope), options.correlationId !== undefined ? { correlationId: options.correlationId } : null);
48
+ return (0, wire_1.fromWirePipelineResult)(wire);
49
+ }
50
+ /** Free the native pipeline. */
51
+ release() {
52
+ return NativeXybrid_1.default.dispose(this.handle);
53
+ }
54
+ }
55
+ exports.Pipeline = Pipeline;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GenerationConfigs = void 0;
4
+ exports.greedy = greedy;
5
+ exports.creative = creative;
6
+ // Generation-config presets with the same values as the Swift and Kotlin
7
+ // `GenerationConfigs`. Pure TS — no native call.
8
+ /**
9
+ * Greedy decoding (deterministic, temperature 0): the usual choice for
10
+ * extraction and tool calling.
11
+ */
12
+ function greedy(options = {}) {
13
+ return {
14
+ temperature: 0.0,
15
+ topP: 1.0,
16
+ topK: 0,
17
+ stopSequences: [],
18
+ ...options,
19
+ };
20
+ }
21
+ /** Higher temperature, for more varied output. */
22
+ function creative(options = {}) {
23
+ return {
24
+ temperature: 0.9,
25
+ topP: 0.95,
26
+ topK: 50,
27
+ stopSequences: [],
28
+ ...options,
29
+ };
30
+ }
31
+ /** Preset factories for {@link GenerationConfig}. */
32
+ exports.GenerationConfigs = { greedy, creative };
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.StreamingSession = void 0;
7
+ const NativeXybrid_1 = __importDefault(require("./NativeXybrid"));
8
+ const base64_1 = require("./base64");
9
+ /**
10
+ * A live ASR session: feed microphone PCM in, read partial transcripts out.
11
+ * Open one with `model.stream()`.
12
+ *
13
+ * ```ts
14
+ * const session = await model.stream();
15
+ * (async () => {
16
+ * for await (const partial of session.partials()) setCaption(partial.text);
17
+ * })();
18
+ * // from your audio callback (Float32, mono, 16 kHz):
19
+ * await session.feed(samples);
20
+ * // when the user stops talking:
21
+ * const transcript = await session.flush();
22
+ * await session.release();
23
+ * ```
24
+ */
25
+ class StreamingSession {
26
+ /** @internal Use `model.stream()`. */
27
+ constructor(
28
+ /** Opaque native handle. */
29
+ handle) {
30
+ this.handle = handle;
31
+ }
32
+ /**
33
+ * Queue PCM samples (Float32, mono, 16 kHz). Transcription happens off the
34
+ * JS thread; this only waits when the native queue is full.
35
+ */
36
+ feed(samples) {
37
+ return NativeXybrid_1.default.sessionFeed(this.handle, (0, base64_1.float32ToBase64)(samples));
38
+ }
39
+ /**
40
+ * Partial transcripts as they arrive, ending when the session finishes
41
+ * (after {@link flush} or {@link cancel}). Each partial is cumulative:
42
+ * render it in place of the previous one. Use one iterator per session.
43
+ */
44
+ async *partials() {
45
+ for (;;) {
46
+ const partial = (await NativeXybrid_1.default.sessionNextPartial(this.handle));
47
+ if (partial == null)
48
+ return;
49
+ yield partial;
50
+ }
51
+ }
52
+ /**
53
+ * Drain the buffered audio and return the complete transcript. The session
54
+ * is over afterwards.
55
+ */
56
+ flush() {
57
+ return NativeXybrid_1.default.sessionFlush(this.handle);
58
+ }
59
+ /** Start over on fresh audio without reloading the model. */
60
+ reset() {
61
+ return NativeXybrid_1.default.sessionReset(this.handle);
62
+ }
63
+ /** Stop and discard buffered audio — the "user walked away" path. */
64
+ cancel() {
65
+ return NativeXybrid_1.default.sessionCancel(this.handle);
66
+ }
67
+ /** Whether the session still accepts audio. */
68
+ isRunning() {
69
+ return NativeXybrid_1.default.sessionIsRunning(this.handle);
70
+ }
71
+ /** Free the native session (cancelling it if still running). */
72
+ release() {
73
+ return NativeXybrid_1.default.dispose(this.handle);
74
+ }
75
+ }
76
+ exports.StreamingSession = StreamingSession;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ // Public types. They mirror the bolt `#[data]` records in
3
+ // crates/xybrid-bolt/src/lib.rs field for field (camelCase), so a value means
4
+ // the same thing here as in the Swift and Kotlin SDKs. tests/parity.test.mjs
5
+ // fails when bolt gains a field or export that is neither mapped here nor
6
+ // listed as intentionally excluded in parity.json.
7
+ //
8
+ // Binary payloads (audio, images) cross as base64 strings: TurboModules have
9
+ // no ArrayBuffer type. See README "Binary payloads".
10
+ Object.defineProperty(exports, "__esModule", { value: true });