react-native-nobodywho 2.3.0 → 2.4.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.
@@ -45,9 +45,11 @@ import {
45
45
  type UniffiRustCallStatus,
46
46
  AbstractFfiConverterByteArray,
47
47
  FfiConverterArray,
48
+ FfiConverterArrayBuffer,
48
49
  FfiConverterBool,
49
50
  FfiConverterCallback,
50
51
  FfiConverterFloat32,
52
+ FfiConverterInt16,
51
53
  FfiConverterInt32,
52
54
  FfiConverterMap,
53
55
  FfiConverterObject,
@@ -175,6 +177,34 @@ export async function loadModel(modelPath: string, useGpu: boolean, projectionMo
175
177
  throw __error;
176
178
  }
177
179
  }
180
+ /**
181
+ * Create a TTS synthesizer.
182
+ */
183
+ export async function loadTts(source: string, architecture: string | undefined, voice: string | undefined, language: string | undefined, speed: /*f32*/number | undefined, steps: /*u32*/number | undefined, silenceDuration: /*f32*/number | undefined, device: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise<RustTtsInterface> /*throws*/ {
184
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
185
+ try {
186
+ return await uniffiRustCallAsync(
187
+ /*rustCaller:*/ uniffiCaller,
188
+ /*rustFutureFunc:*/ () => {
189
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_load_tts(FfiConverterString.lower(source),FfiConverterOptionalString.lower(architecture),FfiConverterOptionalString.lower(voice),FfiConverterOptionalString.lower(language),FfiConverterOptionalFloat32.lower(speed),FfiConverterOptionalUInt32.lower(steps),FfiConverterOptionalFloat32.lower(silenceDuration),FfiConverterOptionalString.lower(device)
190
+ );
191
+ },
192
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_u64,
193
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_u64,
194
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_u64,
195
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_u64,
196
+ /*liftFunc:*/ FfiConverterTypeRustTts.lift.bind(FfiConverterTypeRustTts),
197
+ /*liftString:*/ FfiConverterString.lift,
198
+ /*asyncOpts:*/ asyncOpts_,
199
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
200
+ );
201
+ } catch (__error: any) {
202
+ if (uniffiIsDebug && __error instanceof Error) {
203
+ __error.stack = __stack;
204
+ }
205
+ throw __error;
206
+ }
207
+ }
178
208
  /**
179
209
  * Create a sampler that constrains output using a Lark grammar via llguidance.
180
210
  */
@@ -316,6 +346,8 @@ export function samplerPresetTopP(topP: /*f32*/number): SamplerConfigInterface {
316
346
 
317
347
 
318
348
 
349
+
350
+
319
351
  /**
320
352
  * Callback interface for download progress reporting. Implement this in your
321
353
  * language to receive `(downloadedBytes, totalBytes)` events while a remote
@@ -445,6 +477,8 @@ const FfiConverterTypeRustToolCallback = new FfiConverterCallback<RustToolCallba
445
477
 
446
478
 
447
479
 
480
+
481
+
448
482
  export type Asset = {
449
483
  id: string,
450
484
  path: string
@@ -564,6 +598,64 @@ const FfiConverterTypeCachedModel = (() => {
564
598
  })();
565
599
 
566
600
 
601
+ export type ChatStats = {
602
+ contextSize: /*u32*/number,
603
+ contextUsed: /*u32*/number
604
+ }
605
+
606
+ /**
607
+ * Generated factory for {@link ChatStats} record objects.
608
+ */
609
+ export const ChatStats = (() => {
610
+ const defaults = () => ({
611
+ });
612
+ const create = (() => {
613
+ return uniffiCreateRecord<ChatStats, ReturnType<typeof defaults>>(defaults);
614
+ })();
615
+ return Object.freeze({
616
+ /**
617
+ * Create a frozen instance of {@link ChatStats}, with defaults specified
618
+ * in Rust, in the {@link nobodywho} crate.
619
+ */
620
+ create,
621
+
622
+ /**
623
+ * Create a frozen instance of {@link ChatStats}, with defaults specified
624
+ * in Rust, in the {@link nobodywho} crate.
625
+ */
626
+ new: create,
627
+
628
+ /**
629
+ * Defaults specified in the {@link nobodywho} crate.
630
+ */
631
+ defaults: () => Object.freeze(defaults()) as Partial<ChatStats>,
632
+
633
+ });
634
+ })();
635
+
636
+ const FfiConverterTypeChatStats = (() => {
637
+ type TypeName = ChatStats;
638
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
639
+ read(from: RustBuffer): TypeName {
640
+ return {
641
+ contextSize: FfiConverterUInt32.read(from),
642
+ contextUsed: FfiConverterUInt32.read(from)
643
+ };
644
+ }
645
+ write(value: TypeName, into: RustBuffer): void {
646
+ FfiConverterUInt32.write(value.contextSize, into);
647
+ FfiConverterUInt32.write(value.contextUsed, into);
648
+ }
649
+ allocationSize(value: TypeName): number {
650
+ return FfiConverterUInt32.allocationSize(value.contextSize) +
651
+ FfiConverterUInt32.allocationSize(value.contextUsed);
652
+
653
+ }
654
+ };
655
+ return new FFIConverter();
656
+ })();
657
+
658
+
567
659
  /**
568
660
  * A pending tool call waiting for resolution from the language binding.
569
661
  */
@@ -1292,6 +1384,13 @@ export interface RustChatInterface {
1292
1384
  * Send a message and get a token stream for the response.
1293
1385
  */
1294
1386
  ask(message: string) : RustTokenStreamInterface;
1387
+ /**
1388
+ * Send a JSON-encoded prompt and get a token stream.
1389
+ *
1390
+ * `json` must be a valid JSON string. The wrapper layer is responsible for
1391
+ * serializing native objects (dicts, arrays, etc.) to JSON before calling this.
1392
+ */
1393
+ askWithJsonPrompt(json: string) /*throws*/: RustTokenStreamInterface;
1295
1394
  /**
1296
1395
  * Send a multimodal prompt (text + images/audio) and get a token stream.
1297
1396
  *
@@ -1307,6 +1406,10 @@ export interface RustChatInterface {
1307
1406
  * Get the current sampler configuration as a JSON string.
1308
1407
  */
1309
1408
  getSamplerConfigJson(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
1409
+ /**
1410
+ * Get context usage statistics.
1411
+ */
1412
+ getStats(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ChatStats>;
1310
1413
  /**
1311
1414
  * Get the current system prompt.
1312
1415
  */
@@ -1347,6 +1450,15 @@ export interface RustChatInterface {
1347
1450
  * Stop the current generation.
1348
1451
  */
1349
1452
  stopGeneration() : void;
1453
+ /**
1454
+ * Tokenize a plain text string and return the token IDs.
1455
+ */
1456
+ tokenize(message: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array</*i32*/number | undefined>>;
1457
+ /**
1458
+ * Tokenize a multimodal prompt and return the token IDs.
1459
+ * Text tokens produce an integer ID; image/audio embedding slots produce null.
1460
+ */
1461
+ tokenizeWithPrompt(parts: Array<PromptPart>, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Array</*i32*/number | undefined>>;
1350
1462
  }
1351
1463
 
1352
1464
 
@@ -1397,6 +1509,25 @@ export class RustChat extends UniffiAbstractObject implements RustChatInterface
1397
1509
  ));
1398
1510
  }
1399
1511
 
1512
+ /**
1513
+ * Send a JSON-encoded prompt and get a token stream.
1514
+ *
1515
+ * `json` must be a valid JSON string. The wrapper layer is responsible for
1516
+ * serializing native objects (dicts, arrays, etc.) to JSON before calling this.
1517
+ */
1518
+ askWithJsonPrompt(json: string): RustTokenStreamInterface /*throws*/ {
1519
+ return FfiConverterTypeRustTokenStream.lift(
1520
+ uniffiCaller.rustCallWithError(
1521
+ /*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
1522
+ /*caller:*/ (callStatus) => {
1523
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_ask_with_json_prompt(uniffiTypeRustChatObjectFactory.clonePointer(this),
1524
+ FfiConverterString.lower(json),
1525
+ callStatus);
1526
+ },
1527
+ /*liftString:*/ FfiConverterString.lift,
1528
+ ));
1529
+ }
1530
+
1400
1531
  /**
1401
1532
  * Send a multimodal prompt (text + images/audio) and get a token stream.
1402
1533
  *
@@ -1476,6 +1607,37 @@ async getSamplerConfigJson(asyncOpts_?: { signal: AbortSignal }): Promise<strin
1476
1607
  }
1477
1608
  }
1478
1609
 
1610
+ /**
1611
+ * Get context usage statistics.
1612
+ */
1613
+ async getStats(asyncOpts_?: { signal: AbortSignal }): Promise<ChatStats> /*throws*/ {
1614
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1615
+ try {
1616
+ return await uniffiRustCallAsync(
1617
+ /*rustCaller:*/ uniffiCaller,
1618
+ /*rustFutureFunc:*/ () => {
1619
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_get_stats(
1620
+ uniffiTypeRustChatObjectFactory.clonePointer(this)
1621
+
1622
+ );
1623
+ },
1624
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
1625
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
1626
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
1627
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
1628
+ /*liftFunc:*/ FfiConverterTypeChatStats.lift.bind(FfiConverterTypeChatStats),
1629
+ /*liftString:*/ FfiConverterString.lift,
1630
+ /*asyncOpts:*/ asyncOpts_,
1631
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1632
+ );
1633
+ } catch (__error: any) {
1634
+ if (uniffiIsDebug && __error instanceof Error) {
1635
+ __error.stack = __stack;
1636
+ }
1637
+ throw __error;
1638
+ }
1639
+ }
1640
+
1479
1641
  /**
1480
1642
  * Get the current system prompt.
1481
1643
  */
@@ -1766,6 +1928,69 @@ async setTools(tools: Array<RustToolInterface>, asyncOpts_?: { signal: AbortSig
1766
1928
  );
1767
1929
  }
1768
1930
 
1931
+ /**
1932
+ * Tokenize a plain text string and return the token IDs.
1933
+ */
1934
+ async tokenize(message: string, asyncOpts_?: { signal: AbortSignal }): Promise<Array</*i32*/number | undefined>> /*throws*/ {
1935
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1936
+ try {
1937
+ return await uniffiRustCallAsync(
1938
+ /*rustCaller:*/ uniffiCaller,
1939
+ /*rustFutureFunc:*/ () => {
1940
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_tokenize(
1941
+ uniffiTypeRustChatObjectFactory.clonePointer(this),
1942
+ FfiConverterString.lower(message)
1943
+ );
1944
+ },
1945
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
1946
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
1947
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
1948
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
1949
+ /*liftFunc:*/ FfiConverterArrayOptionalInt32.lift.bind(FfiConverterArrayOptionalInt32),
1950
+ /*liftString:*/ FfiConverterString.lift,
1951
+ /*asyncOpts:*/ asyncOpts_,
1952
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1953
+ );
1954
+ } catch (__error: any) {
1955
+ if (uniffiIsDebug && __error instanceof Error) {
1956
+ __error.stack = __stack;
1957
+ }
1958
+ throw __error;
1959
+ }
1960
+ }
1961
+
1962
+ /**
1963
+ * Tokenize a multimodal prompt and return the token IDs.
1964
+ * Text tokens produce an integer ID; image/audio embedding slots produce null.
1965
+ */
1966
+ async tokenizeWithPrompt(parts: Array<PromptPart>, asyncOpts_?: { signal: AbortSignal }): Promise<Array</*i32*/number | undefined>> /*throws*/ {
1967
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1968
+ try {
1969
+ return await uniffiRustCallAsync(
1970
+ /*rustCaller:*/ uniffiCaller,
1971
+ /*rustFutureFunc:*/ () => {
1972
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustchat_tokenize_with_prompt(
1973
+ uniffiTypeRustChatObjectFactory.clonePointer(this),
1974
+ FfiConverterArrayTypePromptPart.lower(parts)
1975
+ );
1976
+ },
1977
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
1978
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
1979
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
1980
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
1981
+ /*liftFunc:*/ FfiConverterArrayOptionalInt32.lift.bind(FfiConverterArrayOptionalInt32),
1982
+ /*liftString:*/ FfiConverterString.lift,
1983
+ /*asyncOpts:*/ asyncOpts_,
1984
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
1985
+ );
1986
+ } catch (__error: any) {
1987
+ if (uniffiIsDebug && __error instanceof Error) {
1988
+ __error.stack = __stack;
1989
+ }
1990
+ throw __error;
1991
+ }
1992
+ }
1993
+
1769
1994
 
1770
1995
  /**
1771
1996
  * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
@@ -2166,6 +2391,7 @@ const FfiConverterTypeRustEncoder = new FfiConverterObject(uniffiTypeRustEncode
2166
2391
 
2167
2392
  export interface RustModelInterface {
2168
2393
 
2394
+ maxCtx() : /*u32*/number;
2169
2395
  }
2170
2396
 
2171
2397
 
@@ -2184,6 +2410,16 @@ private constructor(pointer: UniffiHandle) {
2184
2410
 
2185
2411
 
2186
2412
 
2413
+ maxCtx(): /*u32*/number {
2414
+ return FfiConverterUInt32.lift(uniffiCaller.rustCall(
2415
+ /*caller:*/ (callStatus) => {
2416
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rustmodel_max_ctx(uniffiTypeRustModelObjectFactory.clonePointer(this),
2417
+ callStatus);
2418
+ },
2419
+ /*liftString:*/ FfiConverterString.lift,
2420
+ ));
2421
+ }
2422
+
2187
2423
 
2188
2424
  /**
2189
2425
  * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
@@ -2259,83 +2495,422 @@ const uniffiTypeRustModelObjectFactory: UniffiObjectFactory<RustModelInterface>
2259
2495
  const FfiConverterTypeRustModel = new FfiConverterObject(uniffiTypeRustModelObjectFactory);
2260
2496
 
2261
2497
 
2262
- export interface RustTokenStreamInterface {
2498
+ /**
2499
+ * Speech-to-text handle. Wraps `nobodywho::stt::Stt`.
2500
+ * Use `transcribe_file` or `transcribe_pcm` to get a `RustSTTStream`.
2501
+ */
2502
+ export interface RustSttInterface {
2263
2503
 
2264
2504
  /**
2265
- * Wait for the full response to complete and return it.
2505
+ * Start transcribing an audio file (WAV / MP3).
2506
+ * Returns a `RustSTTStream` to consume tokens as they are generated.
2266
2507
  */
2267
- completed(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
2508
+ transcribeFile(path: string) /*throws*/: RustSttStreamInterface;
2268
2509
  /**
2269
- * Get the next token. Returns None when generation is complete, or an error if generation failed.
2510
+ * Start transcribing raw i16 PCM samples (e.g. from a microphone stream).
2511
+ * `sample_rate` is the capture rate in Hz; the backend resamples to 16 kHz internally.
2270
2512
  */
2271
- nextToken(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string | undefined>;
2513
+ transcribePcm(samples: Array</*i16*/number>, sampleRate: /*u32*/number) /*throws*/: RustSttStreamInterface;
2272
2514
  }
2273
2515
 
2274
2516
 
2275
- export class RustTokenStream extends UniffiAbstractObject implements RustTokenStreamInterface {
2517
+ /**
2518
+ * Speech-to-text handle. Wraps `nobodywho::stt::Stt`.
2519
+ * Use `transcribe_file` or `transcribe_pcm` to get a `RustSTTStream`.
2520
+ */
2521
+ export class RustStt extends UniffiAbstractObject implements RustSttInterface {
2276
2522
 
2277
- readonly [uniffiTypeNameSymbol] = "RustTokenStream";
2523
+ readonly [uniffiTypeNameSymbol] = "RustStt";
2278
2524
  readonly [destructorGuardSymbol]: UniffiGcObject;
2279
2525
  readonly [pointerLiteralSymbol]: UniffiHandle;
2280
- // No primary constructor declared for this class.
2281
- private constructor(pointer: UniffiHandle) {
2282
- super();
2283
- this[pointerLiteralSymbol] = pointer;
2284
- this[destructorGuardSymbol] = uniffiTypeRustTokenStreamObjectFactory.bless(pointer);
2285
- }
2526
+ /**
2527
+ * Create an STT handle. `source` is a HuggingFace repo (`hf://owner/repo`,
2528
+ * e.g. `"hf://onnx-community/whisper-base"`) or a local directory path.
2529
+ * `language` is an ISO 639-1 code (e.g. `"en"`); pass `None` to auto-detect.
2530
+ * `quantization` selects the ONNX precision variant to download and load:
2531
+ * one of `"default"`, `"fp16"`, `"int8"`, `"uint8"`, `"bnb4"`, `"q4"`, `"q4f16"`, `"quantized"`;
2532
+ * pass `None` to use `"default"`.
2533
+ */
2534
+ constructor(source: string, language: string | undefined, quantization: string | undefined) /*throws*/ {
2535
+ super();
2536
+ const pointer =
2537
+
2538
+ uniffiCaller.rustCallWithError(
2539
+ /*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
2540
+ /*caller:*/ (callStatus) => {
2541
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_constructor_ruststt_new(
2542
+ FfiConverterString.lower(source),
2543
+ FfiConverterOptionalString.lower(language),
2544
+ FfiConverterOptionalString.lower(quantization),
2545
+ callStatus);
2546
+ },
2547
+ /*liftString:*/ FfiConverterString.lift,
2548
+ );
2549
+ this[pointerLiteralSymbol] = pointer;
2550
+ this[destructorGuardSymbol] = uniffiTypeRustSttObjectFactory.bless(pointer);
2551
+ }
2286
2552
 
2287
2553
 
2288
2554
 
2289
2555
 
2290
2556
  /**
2291
- * Wait for the full response to complete and return it.
2557
+ * Start transcribing an audio file (WAV / MP3).
2558
+ * Returns a `RustSTTStream` to consume tokens as they are generated.
2292
2559
  */
2293
- async completed(asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
2294
- const __stack = uniffiIsDebug ? new Error().stack : undefined;
2295
- try {
2296
- return await uniffiRustCallAsync(
2297
- /*rustCaller:*/ uniffiCaller,
2298
- /*rustFutureFunc:*/ () => {
2299
- return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rusttokenstream_completed(
2300
- uniffiTypeRustTokenStreamObjectFactory.clonePointer(this)
2301
-
2302
- );
2560
+ transcribeFile(path: string): RustSttStreamInterface /*throws*/ {
2561
+ return FfiConverterTypeRustSTTStream.lift(
2562
+ uniffiCaller.rustCallWithError(
2563
+ /*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
2564
+ /*caller:*/ (callStatus) => {
2565
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_ruststt_transcribe_file(uniffiTypeRustSttObjectFactory.clonePointer(this),
2566
+ FfiConverterString.lower(path),
2567
+ callStatus);
2303
2568
  },
2304
- /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
2305
- /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
2306
- /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
2307
- /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
2308
- /*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
2309
2569
  /*liftString:*/ FfiConverterString.lift,
2310
- /*asyncOpts:*/ asyncOpts_,
2311
- /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
2312
- );
2313
- } catch (__error: any) {
2314
- if (uniffiIsDebug && __error instanceof Error) {
2315
- __error.stack = __stack;
2316
- }
2317
- throw __error;
2318
- }
2570
+ ));
2319
2571
  }
2320
2572
 
2321
2573
  /**
2322
- * Get the next token. Returns None when generation is complete, or an error if generation failed.
2574
+ * Start transcribing raw i16 PCM samples (e.g. from a microphone stream).
2575
+ * `sample_rate` is the capture rate in Hz; the backend resamples to 16 kHz internally.
2323
2576
  */
2324
- async nextToken(asyncOpts_?: { signal: AbortSignal }): Promise<string | undefined> /*throws*/ {
2325
- const __stack = uniffiIsDebug ? new Error().stack : undefined;
2326
- try {
2327
- return await uniffiRustCallAsync(
2328
- /*rustCaller:*/ uniffiCaller,
2329
- /*rustFutureFunc:*/ () => {
2330
- return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rusttokenstream_next_token(
2331
- uniffiTypeRustTokenStreamObjectFactory.clonePointer(this)
2332
-
2333
- );
2577
+ transcribePcm(samples: Array</*i16*/number>, sampleRate: /*u32*/number): RustSttStreamInterface /*throws*/ {
2578
+ return FfiConverterTypeRustSTTStream.lift(
2579
+ uniffiCaller.rustCallWithError(
2580
+ /*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
2581
+ /*caller:*/ (callStatus) => {
2582
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_ruststt_transcribe_pcm(uniffiTypeRustSttObjectFactory.clonePointer(this),
2583
+ FfiConverterArrayInt16.lower(samples),
2584
+ FfiConverterUInt32.lower(sampleRate),
2585
+ callStatus);
2334
2586
  },
2335
- /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
2336
- /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
2337
- /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
2338
- /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
2587
+ /*liftString:*/ FfiConverterString.lift,
2588
+ ));
2589
+ }
2590
+
2591
+
2592
+ /**
2593
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
2594
+ */
2595
+ uniffiDestroy(): void {
2596
+ const ptr = (this as any)[destructorGuardSymbol];
2597
+ if (ptr !== undefined) {
2598
+ const pointer = uniffiTypeRustSttObjectFactory.pointer(this);
2599
+ uniffiTypeRustSttObjectFactory.freePointer(pointer);
2600
+ uniffiTypeRustSttObjectFactory.unbless(ptr);
2601
+ delete (this as any)[destructorGuardSymbol];
2602
+ }
2603
+ }
2604
+
2605
+ static instanceOf(obj: any): obj is RustStt {
2606
+ return uniffiTypeRustSttObjectFactory.isConcreteType(obj);
2607
+ }
2608
+
2609
+
2610
+ }
2611
+
2612
+ const uniffiTypeRustSttObjectFactory: UniffiObjectFactory<RustSttInterface> = (() => {
2613
+
2614
+ return {
2615
+ create(pointer: UniffiHandle): RustSttInterface {
2616
+ const instance = Object.create(RustStt.prototype);
2617
+ instance[pointerLiteralSymbol] = pointer;
2618
+ instance[destructorGuardSymbol] = this.bless(pointer);
2619
+ instance[uniffiTypeNameSymbol] = "RustStt";
2620
+ return instance;
2621
+ },
2622
+
2623
+
2624
+ bless(p: UniffiHandle): UniffiGcObject {
2625
+ return uniffiCaller.rustCall(
2626
+ /*caller:*/ (status) =>
2627
+ nativeModule().ubrn_uniffi_internal_fn_method_ruststt_ffi__bless_pointer(p, status),
2628
+ /*liftString:*/ FfiConverterString.lift
2629
+ );
2630
+ },
2631
+
2632
+ unbless(ptr: UniffiGcObject) {
2633
+ ptr.markDestroyed();
2634
+ },
2635
+
2636
+ pointer(obj: RustSttInterface): UniffiHandle {
2637
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
2638
+ throw new UniffiInternalError.UnexpectedNullPointer();
2639
+ }
2640
+ return (obj as any)[pointerLiteralSymbol];
2641
+ },
2642
+
2643
+ clonePointer(obj: RustSttInterface): UniffiHandle {
2644
+ const pointer = this.pointer(obj);
2645
+ return uniffiCaller.rustCall(
2646
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_ruststt(pointer, callStatus),
2647
+ /*liftString:*/ FfiConverterString.lift
2648
+ );
2649
+ },
2650
+
2651
+ freePointer(pointer: UniffiHandle): void {
2652
+ uniffiCaller.rustCall(
2653
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_ruststt(pointer, callStatus),
2654
+ /*liftString:*/ FfiConverterString.lift
2655
+ );
2656
+ },
2657
+
2658
+ isConcreteType(obj: any): obj is RustSttInterface {
2659
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "RustStt";
2660
+ },
2661
+ }})();
2662
+ // FfiConverter for RustSttInterface
2663
+ const FfiConverterTypeRustSTT = new FfiConverterObject(uniffiTypeRustSttObjectFactory);
2664
+
2665
+
2666
+ /**
2667
+ * A stream of transcript tokens from a Whisper STT run.
2668
+ */
2669
+ export interface RustSttStreamInterface {
2670
+
2671
+ /**
2672
+ * Wait for transcription to finish and return the full transcript.
2673
+ */
2674
+ completed(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
2675
+ /**
2676
+ * Get the next transcript token. Returns `None` when transcription is complete.
2677
+ */
2678
+ nextToken(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string | undefined>;
2679
+ }
2680
+
2681
+
2682
+ /**
2683
+ * A stream of transcript tokens from a Whisper STT run.
2684
+ */
2685
+ export class RustSttStream extends UniffiAbstractObject implements RustSttStreamInterface {
2686
+
2687
+ readonly [uniffiTypeNameSymbol] = "RustSttStream";
2688
+ readonly [destructorGuardSymbol]: UniffiGcObject;
2689
+ readonly [pointerLiteralSymbol]: UniffiHandle;
2690
+ // No primary constructor declared for this class.
2691
+ private constructor(pointer: UniffiHandle) {
2692
+ super();
2693
+ this[pointerLiteralSymbol] = pointer;
2694
+ this[destructorGuardSymbol] = uniffiTypeRustSttStreamObjectFactory.bless(pointer);
2695
+ }
2696
+
2697
+
2698
+
2699
+
2700
+ /**
2701
+ * Wait for transcription to finish and return the full transcript.
2702
+ */
2703
+ async completed(asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
2704
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
2705
+ try {
2706
+ return await uniffiRustCallAsync(
2707
+ /*rustCaller:*/ uniffiCaller,
2708
+ /*rustFutureFunc:*/ () => {
2709
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_ruststtstream_completed(
2710
+ uniffiTypeRustSttStreamObjectFactory.clonePointer(this)
2711
+
2712
+ );
2713
+ },
2714
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
2715
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
2716
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
2717
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
2718
+ /*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
2719
+ /*liftString:*/ FfiConverterString.lift,
2720
+ /*asyncOpts:*/ asyncOpts_,
2721
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
2722
+ );
2723
+ } catch (__error: any) {
2724
+ if (uniffiIsDebug && __error instanceof Error) {
2725
+ __error.stack = __stack;
2726
+ }
2727
+ throw __error;
2728
+ }
2729
+ }
2730
+
2731
+ /**
2732
+ * Get the next transcript token. Returns `None` when transcription is complete.
2733
+ */
2734
+ async nextToken(asyncOpts_?: { signal: AbortSignal }): Promise<string | undefined> /*throws*/ {
2735
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
2736
+ try {
2737
+ return await uniffiRustCallAsync(
2738
+ /*rustCaller:*/ uniffiCaller,
2739
+ /*rustFutureFunc:*/ () => {
2740
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_ruststtstream_next_token(
2741
+ uniffiTypeRustSttStreamObjectFactory.clonePointer(this)
2742
+
2743
+ );
2744
+ },
2745
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
2746
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
2747
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
2748
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
2749
+ /*liftFunc:*/ FfiConverterOptionalString.lift.bind(FfiConverterOptionalString),
2750
+ /*liftString:*/ FfiConverterString.lift,
2751
+ /*asyncOpts:*/ asyncOpts_,
2752
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
2753
+ );
2754
+ } catch (__error: any) {
2755
+ if (uniffiIsDebug && __error instanceof Error) {
2756
+ __error.stack = __stack;
2757
+ }
2758
+ throw __error;
2759
+ }
2760
+ }
2761
+
2762
+
2763
+ /**
2764
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
2765
+ */
2766
+ uniffiDestroy(): void {
2767
+ const ptr = (this as any)[destructorGuardSymbol];
2768
+ if (ptr !== undefined) {
2769
+ const pointer = uniffiTypeRustSttStreamObjectFactory.pointer(this);
2770
+ uniffiTypeRustSttStreamObjectFactory.freePointer(pointer);
2771
+ uniffiTypeRustSttStreamObjectFactory.unbless(ptr);
2772
+ delete (this as any)[destructorGuardSymbol];
2773
+ }
2774
+ }
2775
+
2776
+ static instanceOf(obj: any): obj is RustSttStream {
2777
+ return uniffiTypeRustSttStreamObjectFactory.isConcreteType(obj);
2778
+ }
2779
+
2780
+
2781
+ }
2782
+
2783
+ const uniffiTypeRustSttStreamObjectFactory: UniffiObjectFactory<RustSttStreamInterface> = (() => {
2784
+
2785
+ return {
2786
+ create(pointer: UniffiHandle): RustSttStreamInterface {
2787
+ const instance = Object.create(RustSttStream.prototype);
2788
+ instance[pointerLiteralSymbol] = pointer;
2789
+ instance[destructorGuardSymbol] = this.bless(pointer);
2790
+ instance[uniffiTypeNameSymbol] = "RustSttStream";
2791
+ return instance;
2792
+ },
2793
+
2794
+
2795
+ bless(p: UniffiHandle): UniffiGcObject {
2796
+ return uniffiCaller.rustCall(
2797
+ /*caller:*/ (status) =>
2798
+ nativeModule().ubrn_uniffi_internal_fn_method_ruststtstream_ffi__bless_pointer(p, status),
2799
+ /*liftString:*/ FfiConverterString.lift
2800
+ );
2801
+ },
2802
+
2803
+ unbless(ptr: UniffiGcObject) {
2804
+ ptr.markDestroyed();
2805
+ },
2806
+
2807
+ pointer(obj: RustSttStreamInterface): UniffiHandle {
2808
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
2809
+ throw new UniffiInternalError.UnexpectedNullPointer();
2810
+ }
2811
+ return (obj as any)[pointerLiteralSymbol];
2812
+ },
2813
+
2814
+ clonePointer(obj: RustSttStreamInterface): UniffiHandle {
2815
+ const pointer = this.pointer(obj);
2816
+ return uniffiCaller.rustCall(
2817
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_ruststtstream(pointer, callStatus),
2818
+ /*liftString:*/ FfiConverterString.lift
2819
+ );
2820
+ },
2821
+
2822
+ freePointer(pointer: UniffiHandle): void {
2823
+ uniffiCaller.rustCall(
2824
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_ruststtstream(pointer, callStatus),
2825
+ /*liftString:*/ FfiConverterString.lift
2826
+ );
2827
+ },
2828
+
2829
+ isConcreteType(obj: any): obj is RustSttStreamInterface {
2830
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "RustSttStream";
2831
+ },
2832
+ }})();
2833
+ // FfiConverter for RustSttStreamInterface
2834
+ const FfiConverterTypeRustSTTStream = new FfiConverterObject(uniffiTypeRustSttStreamObjectFactory);
2835
+
2836
+
2837
+ export interface RustTokenStreamInterface {
2838
+
2839
+ /**
2840
+ * Wait for the full response to complete and return it.
2841
+ */
2842
+ completed(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
2843
+ /**
2844
+ * Get the next token. Returns None when generation is complete, or an error if generation failed.
2845
+ */
2846
+ nextToken(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string | undefined>;
2847
+ }
2848
+
2849
+
2850
+ export class RustTokenStream extends UniffiAbstractObject implements RustTokenStreamInterface {
2851
+
2852
+ readonly [uniffiTypeNameSymbol] = "RustTokenStream";
2853
+ readonly [destructorGuardSymbol]: UniffiGcObject;
2854
+ readonly [pointerLiteralSymbol]: UniffiHandle;
2855
+ // No primary constructor declared for this class.
2856
+ private constructor(pointer: UniffiHandle) {
2857
+ super();
2858
+ this[pointerLiteralSymbol] = pointer;
2859
+ this[destructorGuardSymbol] = uniffiTypeRustTokenStreamObjectFactory.bless(pointer);
2860
+ }
2861
+
2862
+
2863
+
2864
+
2865
+ /**
2866
+ * Wait for the full response to complete and return it.
2867
+ */
2868
+ async completed(asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
2869
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
2870
+ try {
2871
+ return await uniffiRustCallAsync(
2872
+ /*rustCaller:*/ uniffiCaller,
2873
+ /*rustFutureFunc:*/ () => {
2874
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rusttokenstream_completed(
2875
+ uniffiTypeRustTokenStreamObjectFactory.clonePointer(this)
2876
+
2877
+ );
2878
+ },
2879
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
2880
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
2881
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
2882
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
2883
+ /*liftFunc:*/ FfiConverterString.lift.bind(FfiConverterString),
2884
+ /*liftString:*/ FfiConverterString.lift,
2885
+ /*asyncOpts:*/ asyncOpts_,
2886
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
2887
+ );
2888
+ } catch (__error: any) {
2889
+ if (uniffiIsDebug && __error instanceof Error) {
2890
+ __error.stack = __stack;
2891
+ }
2892
+ throw __error;
2893
+ }
2894
+ }
2895
+
2896
+ /**
2897
+ * Get the next token. Returns None when generation is complete, or an error if generation failed.
2898
+ */
2899
+ async nextToken(asyncOpts_?: { signal: AbortSignal }): Promise<string | undefined> /*throws*/ {
2900
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
2901
+ try {
2902
+ return await uniffiRustCallAsync(
2903
+ /*rustCaller:*/ uniffiCaller,
2904
+ /*rustFutureFunc:*/ () => {
2905
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rusttokenstream_next_token(
2906
+ uniffiTypeRustTokenStreamObjectFactory.clonePointer(this)
2907
+
2908
+ );
2909
+ },
2910
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
2911
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
2912
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
2913
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
2339
2914
  /*liftFunc:*/ FfiConverterOptionalString.lift.bind(FfiConverterOptionalString),
2340
2915
  /*liftString:*/ FfiConverterString.lift,
2341
2916
  /*asyncOpts:*/ asyncOpts_,
@@ -2622,6 +3197,176 @@ const uniffiTypeRustToolObjectFactory: UniffiObjectFactory<RustToolInterface> =
2622
3197
  const FfiConverterTypeRustTool = new FfiConverterObject(uniffiTypeRustToolObjectFactory);
2623
3198
 
2624
3199
 
3200
+ export interface RustTtsInterface {
3201
+
3202
+ /**
3203
+ * Synthesize text and return WAV bytes.
3204
+ */
3205
+ synthesize(text: string) /*throws*/: ArrayBuffer;
3206
+ /**
3207
+ * Synthesize text asynchronously and return WAV bytes.
3208
+ */
3209
+ synthesizeAsync(text: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ArrayBuffer>;
3210
+ }
3211
+
3212
+
3213
+ export class RustTts extends UniffiAbstractObject implements RustTtsInterface {
3214
+
3215
+ readonly [uniffiTypeNameSymbol] = "RustTts";
3216
+ readonly [destructorGuardSymbol]: UniffiGcObject;
3217
+ readonly [pointerLiteralSymbol]: UniffiHandle;
3218
+ /**
3219
+ * Create a TTS synthesizer.
3220
+ */
3221
+ constructor(source: string, architecture: string | undefined, voice: string | undefined, language: string | undefined, speed: /*f32*/number | undefined, steps: /*u32*/number | undefined, silenceDuration: /*f32*/number | undefined, device: string | undefined) /*throws*/ {
3222
+ super();
3223
+ const pointer =
3224
+
3225
+ uniffiCaller.rustCallWithError(
3226
+ /*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
3227
+ /*caller:*/ (callStatus) => {
3228
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_constructor_rusttts_new(
3229
+ FfiConverterString.lower(source),
3230
+ FfiConverterOptionalString.lower(architecture),
3231
+ FfiConverterOptionalString.lower(voice),
3232
+ FfiConverterOptionalString.lower(language),
3233
+ FfiConverterOptionalFloat32.lower(speed),
3234
+ FfiConverterOptionalUInt32.lower(steps),
3235
+ FfiConverterOptionalFloat32.lower(silenceDuration),
3236
+ FfiConverterOptionalString.lower(device),
3237
+ callStatus);
3238
+ },
3239
+ /*liftString:*/ FfiConverterString.lift,
3240
+ );
3241
+ this[pointerLiteralSymbol] = pointer;
3242
+ this[destructorGuardSymbol] = uniffiTypeRustTtsObjectFactory.bless(pointer);
3243
+ }
3244
+
3245
+
3246
+
3247
+
3248
+ /**
3249
+ * Synthesize text and return WAV bytes.
3250
+ */
3251
+ synthesize(text: string): ArrayBuffer /*throws*/ {
3252
+ return FfiConverterArrayBuffer.lift(
3253
+ uniffiCaller.rustCallWithError(
3254
+ /*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
3255
+ /*caller:*/ (callStatus) => {
3256
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rusttts_synthesize(uniffiTypeRustTtsObjectFactory.clonePointer(this),
3257
+ FfiConverterString.lower(text),
3258
+ callStatus);
3259
+ },
3260
+ /*liftString:*/ FfiConverterString.lift,
3261
+ ));
3262
+ }
3263
+
3264
+ /**
3265
+ * Synthesize text asynchronously and return WAV bytes.
3266
+ */
3267
+ async synthesizeAsync(text: string, asyncOpts_?: { signal: AbortSignal }): Promise<ArrayBuffer> /*throws*/ {
3268
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
3269
+ try {
3270
+ return await uniffiRustCallAsync(
3271
+ /*rustCaller:*/ uniffiCaller,
3272
+ /*rustFutureFunc:*/ () => {
3273
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rusttts_synthesize_async(
3274
+ uniffiTypeRustTtsObjectFactory.clonePointer(this),
3275
+ FfiConverterString.lower(text)
3276
+ );
3277
+ },
3278
+ /*pollFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_poll_rust_buffer,
3279
+ /*cancelFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_cancel_rust_buffer,
3280
+ /*completeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_complete_rust_buffer,
3281
+ /*freeFunc:*/ nativeModule().ubrn_ffi_nobodywho_uniffi_rust_future_free_rust_buffer,
3282
+ /*liftFunc:*/ FfiConverterArrayBuffer.lift.bind(FfiConverterArrayBuffer),
3283
+ /*liftString:*/ FfiConverterString.lift,
3284
+ /*asyncOpts:*/ asyncOpts_,
3285
+ /*errorHandler:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError)
3286
+ );
3287
+ } catch (__error: any) {
3288
+ if (uniffiIsDebug && __error instanceof Error) {
3289
+ __error.stack = __stack;
3290
+ }
3291
+ throw __error;
3292
+ }
3293
+ }
3294
+
3295
+
3296
+ /**
3297
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
3298
+ */
3299
+ uniffiDestroy(): void {
3300
+ const ptr = (this as any)[destructorGuardSymbol];
3301
+ if (ptr !== undefined) {
3302
+ const pointer = uniffiTypeRustTtsObjectFactory.pointer(this);
3303
+ uniffiTypeRustTtsObjectFactory.freePointer(pointer);
3304
+ uniffiTypeRustTtsObjectFactory.unbless(ptr);
3305
+ delete (this as any)[destructorGuardSymbol];
3306
+ }
3307
+ }
3308
+
3309
+ static instanceOf(obj: any): obj is RustTts {
3310
+ return uniffiTypeRustTtsObjectFactory.isConcreteType(obj);
3311
+ }
3312
+
3313
+
3314
+ }
3315
+
3316
+ const uniffiTypeRustTtsObjectFactory: UniffiObjectFactory<RustTtsInterface> = (() => {
3317
+
3318
+ return {
3319
+ create(pointer: UniffiHandle): RustTtsInterface {
3320
+ const instance = Object.create(RustTts.prototype);
3321
+ instance[pointerLiteralSymbol] = pointer;
3322
+ instance[destructorGuardSymbol] = this.bless(pointer);
3323
+ instance[uniffiTypeNameSymbol] = "RustTts";
3324
+ return instance;
3325
+ },
3326
+
3327
+
3328
+ bless(p: UniffiHandle): UniffiGcObject {
3329
+ return uniffiCaller.rustCall(
3330
+ /*caller:*/ (status) =>
3331
+ nativeModule().ubrn_uniffi_internal_fn_method_rusttts_ffi__bless_pointer(p, status),
3332
+ /*liftString:*/ FfiConverterString.lift
3333
+ );
3334
+ },
3335
+
3336
+ unbless(ptr: UniffiGcObject) {
3337
+ ptr.markDestroyed();
3338
+ },
3339
+
3340
+ pointer(obj: RustTtsInterface): UniffiHandle {
3341
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
3342
+ throw new UniffiInternalError.UnexpectedNullPointer();
3343
+ }
3344
+ return (obj as any)[pointerLiteralSymbol];
3345
+ },
3346
+
3347
+ clonePointer(obj: RustTtsInterface): UniffiHandle {
3348
+ const pointer = this.pointer(obj);
3349
+ return uniffiCaller.rustCall(
3350
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_clone_rusttts(pointer, callStatus),
3351
+ /*liftString:*/ FfiConverterString.lift
3352
+ );
3353
+ },
3354
+
3355
+ freePointer(pointer: UniffiHandle): void {
3356
+ uniffiCaller.rustCall(
3357
+ /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_free_rusttts(pointer, callStatus),
3358
+ /*liftString:*/ FfiConverterString.lift
3359
+ );
3360
+ },
3361
+
3362
+ isConcreteType(obj: any): obj is RustTtsInterface {
3363
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === "RustTts";
3364
+ },
3365
+ }})();
3366
+ // FfiConverter for RustTtsInterface
3367
+ const FfiConverterTypeRustTts = new FfiConverterObject(uniffiTypeRustTtsObjectFactory);
3368
+
3369
+
2625
3370
  export interface SamplerBuilderInterface {
2626
3371
 
2627
3372
  /**
@@ -3130,6 +3875,14 @@ const FfiConverterTypeSamplerConfig = new FfiConverterObject(uniffiTypeSamplerC
3130
3875
  const FfiConverterOptionalTypeRustDownloadProgressCallback = new FfiConverterOptional(FfiConverterTypeRustDownloadProgressCallback);
3131
3876
 
3132
3877
 
3878
+ // FfiConverter for /*f32*/number | undefined
3879
+ const FfiConverterOptionalFloat32 = new FfiConverterOptional(FfiConverterFloat32);
3880
+
3881
+
3882
+ // FfiConverter for /*i32*/number | undefined
3883
+ const FfiConverterOptionalInt32 = new FfiConverterOptional(FfiConverterInt32);
3884
+
3885
+
3133
3886
  // FfiConverter for PendingToolCall | undefined
3134
3887
  const FfiConverterOptionalTypePendingToolCall = new FfiConverterOptional(FfiConverterTypePendingToolCall);
3135
3888
 
@@ -3146,6 +3899,10 @@ const FfiConverterOptionalUInt32 = new FfiConverterOptional(FfiConverterUInt32);
3146
3899
  const FfiConverterArrayFloat32 = new FfiConverterArray(FfiConverterFloat32);
3147
3900
 
3148
3901
 
3902
+ // FfiConverter for Array</*i16*/number>
3903
+ const FfiConverterArrayInt16 = new FfiConverterArray(FfiConverterInt16);
3904
+
3905
+
3149
3906
  // FfiConverter for Array<Asset>
3150
3907
  const FfiConverterArrayTypeAsset = new FfiConverterArray(FfiConverterTypeAsset);
3151
3908
 
@@ -3194,6 +3951,10 @@ const FfiConverterArrayTypePromptPart = new FfiConverterArray(FfiConverterTypePr
3194
3951
  const FfiConverterArrayTypeRustTool = new FfiConverterArray(FfiConverterTypeRustTool);
3195
3952
 
3196
3953
 
3954
+ // FfiConverter for Array</*i32*/number | undefined>
3955
+ const FfiConverterArrayOptionalInt32 = new FfiConverterArray(FfiConverterOptionalInt32);
3956
+
3957
+
3197
3958
  // FfiConverter for Array<RustToolInterface> | undefined
3198
3959
  const FfiConverterOptionalArrayTypeRustTool = new FfiConverterOptional(FfiConverterArrayTypeRustTool);
3199
3960
 
@@ -3227,6 +3988,9 @@ function uniffiEnsureInitialized() {
3227
3988
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_load_model() !== 33587) {
3228
3989
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_load_model");
3229
3990
  }
3991
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_load_tts() !== 61935) {
3992
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_load_tts");
3993
+ }
3230
3994
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_grammar() !== 13698) {
3231
3995
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_grammar");
3232
3996
  }
@@ -3263,6 +4027,9 @@ function uniffiEnsureInitialized() {
3263
4027
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_ask() !== 53575) {
3264
4028
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_ask");
3265
4029
  }
4030
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_ask_with_json_prompt() !== 63877) {
4031
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_ask_with_json_prompt");
4032
+ }
3266
4033
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_ask_with_prompt() !== 65089) {
3267
4034
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_ask_with_prompt");
3268
4035
  }
@@ -3272,6 +4039,9 @@ function uniffiEnsureInitialized() {
3272
4039
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_get_sampler_config_json() !== 33078) {
3273
4040
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_get_sampler_config_json");
3274
4041
  }
4042
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_get_stats() !== 59932) {
4043
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_get_stats");
4044
+ }
3275
4045
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_get_system_prompt() !== 57727) {
3276
4046
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_get_system_prompt");
3277
4047
  }
@@ -3302,6 +4072,12 @@ function uniffiEnsureInitialized() {
3302
4072
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_stop_generation() !== 24711) {
3303
4073
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_stop_generation");
3304
4074
  }
4075
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_tokenize() !== 52520) {
4076
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_tokenize");
4077
+ }
4078
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_tokenize_with_prompt() !== 60528) {
4079
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_tokenize_with_prompt");
4080
+ }
3305
4081
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustcrossencoder_rank() !== 55500) {
3306
4082
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustcrossencoder_rank");
3307
4083
  }
@@ -3311,6 +4087,21 @@ function uniffiEnsureInitialized() {
3311
4087
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustencoder_encode() !== 52601) {
3312
4088
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustencoder_encode");
3313
4089
  }
4090
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustmodel_max_ctx() !== 52004) {
4091
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustmodel_max_ctx");
4092
+ }
4093
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_ruststt_transcribe_file() !== 43975) {
4094
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_ruststt_transcribe_file");
4095
+ }
4096
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_ruststt_transcribe_pcm() !== 61166) {
4097
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_ruststt_transcribe_pcm");
4098
+ }
4099
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_ruststtstream_completed() !== 22443) {
4100
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_ruststtstream_completed");
4101
+ }
4102
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_ruststtstream_next_token() !== 38526) {
4103
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_ruststtstream_next_token");
4104
+ }
3314
4105
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_completed() !== 26060) {
3315
4106
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_completed");
3316
4107
  }
@@ -3326,6 +4117,12 @@ function uniffiEnsureInitialized() {
3326
4117
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttool_resolve_pending_call() !== 10096) {
3327
4118
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttool_resolve_pending_call");
3328
4119
  }
4120
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttts_synthesize() !== 56024) {
4121
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttts_synthesize");
4122
+ }
4123
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttts_synthesize_async() !== 54670) {
4124
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttts_synthesize_async");
4125
+ }
3329
4126
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_dist() !== 23376) {
3330
4127
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_dist");
3331
4128
  }
@@ -3380,12 +4177,18 @@ function uniffiEnsureInitialized() {
3380
4177
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustencoder_new() !== 27902) {
3381
4178
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rustencoder_new");
3382
4179
  }
4180
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_ruststt_new() !== 44850) {
4181
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_ruststt_new");
4182
+ }
3383
4183
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rusttool_new() !== 9431) {
3384
4184
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rusttool_new");
3385
4185
  }
3386
4186
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rusttool_new_async() !== 54521) {
3387
4187
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rusttool_new_async");
3388
4188
  }
4189
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rusttts_new() !== 24110) {
4190
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rusttts_new");
4191
+ }
3389
4192
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_samplerbuilder_new() !== 50214) {
3390
4193
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_samplerbuilder_new");
3391
4194
  }
@@ -3408,6 +4211,7 @@ export default Object.freeze({
3408
4211
  converters: {
3409
4212
  FfiConverterTypeAsset,
3410
4213
  FfiConverterTypeCachedModel,
4214
+ FfiConverterTypeChatStats,
3411
4215
  FfiConverterTypeMessage,
3412
4216
  FfiConverterTypeNobodyWhoError,
3413
4217
  FfiConverterTypePendingToolCall,
@@ -3416,8 +4220,11 @@ export default Object.freeze({
3416
4220
  FfiConverterTypeRustCrossEncoder,
3417
4221
  FfiConverterTypeRustEncoder,
3418
4222
  FfiConverterTypeRustModel,
4223
+ FfiConverterTypeRustSTT,
4224
+ FfiConverterTypeRustSTTStream,
3419
4225
  FfiConverterTypeRustTokenStream,
3420
4226
  FfiConverterTypeRustTool,
4227
+ FfiConverterTypeRustTts,
3421
4228
  FfiConverterTypeSamplerBuilder,
3422
4229
  FfiConverterTypeSamplerConfig,
3423
4230
  FfiConverterTypeToolCall,