react-native-nobodywho 2.2.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,
@@ -126,6 +128,20 @@ export async function downloadModel(modelPath: string, headers: Map<string, stri
126
128
  throw __error;
127
129
  }
128
130
  }
131
+ /**
132
+ * Returns every cached `.gguf` model paired with its byte size.
133
+ */
134
+ export function getCachedModels(): Array<CachedModel> /*throws*/ {
135
+ return FfiConverterArrayTypeCachedModel.lift(
136
+ uniffiCaller.rustCallWithError(
137
+ /*liftError:*/ FfiConverterTypeNobodyWhoError.lift.bind(FfiConverterTypeNobodyWhoError),
138
+ /*caller:*/ (callStatus) => {
139
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_func_get_cached_models(
140
+ callStatus);
141
+ },
142
+ /*liftString:*/ FfiConverterString.lift,
143
+ ));
144
+ }
129
145
  /**
130
146
  * Load a GGUF model from a local path or remote URL.
131
147
  *
@@ -161,6 +177,34 @@ export async function loadModel(modelPath: string, useGpu: boolean, projectionMo
161
177
  throw __error;
162
178
  }
163
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
+ }
164
208
  /**
165
209
  * Create a sampler that constrains output using a Lark grammar via llguidance.
166
210
  */
@@ -302,6 +346,8 @@ export function samplerPresetTopP(topP: /*f32*/number): SamplerConfigInterface {
302
346
 
303
347
 
304
348
 
349
+
350
+
305
351
  /**
306
352
  * Callback interface for download progress reporting. Implement this in your
307
353
  * language to receive `(downloadedBytes, totalBytes)` events while a remote
@@ -431,6 +477,8 @@ const FfiConverterTypeRustToolCallback = new FfiConverterCallback<RustToolCallba
431
477
 
432
478
 
433
479
 
480
+
481
+
434
482
  export type Asset = {
435
483
  id: string,
436
484
  path: string
@@ -489,6 +537,125 @@ const FfiConverterTypeAsset = (() => {
489
537
  })();
490
538
 
491
539
 
540
+ /**
541
+ * A cached `.gguf` model and its on-disk size.
542
+ */
543
+ export type CachedModel = {
544
+ path: string,
545
+ size: /*u64*/bigint
546
+ }
547
+
548
+ /**
549
+ * Generated factory for {@link CachedModel} record objects.
550
+ */
551
+ export const CachedModel = (() => {
552
+ const defaults = () => ({
553
+ });
554
+ const create = (() => {
555
+ return uniffiCreateRecord<CachedModel, ReturnType<typeof defaults>>(defaults);
556
+ })();
557
+ return Object.freeze({
558
+ /**
559
+ * Create a frozen instance of {@link CachedModel}, with defaults specified
560
+ * in Rust, in the {@link nobodywho} crate.
561
+ */
562
+ create,
563
+
564
+ /**
565
+ * Create a frozen instance of {@link CachedModel}, with defaults specified
566
+ * in Rust, in the {@link nobodywho} crate.
567
+ */
568
+ new: create,
569
+
570
+ /**
571
+ * Defaults specified in the {@link nobodywho} crate.
572
+ */
573
+ defaults: () => Object.freeze(defaults()) as Partial<CachedModel>,
574
+
575
+ });
576
+ })();
577
+
578
+ const FfiConverterTypeCachedModel = (() => {
579
+ type TypeName = CachedModel;
580
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
581
+ read(from: RustBuffer): TypeName {
582
+ return {
583
+ path: FfiConverterString.read(from),
584
+ size: FfiConverterUInt64.read(from)
585
+ };
586
+ }
587
+ write(value: TypeName, into: RustBuffer): void {
588
+ FfiConverterString.write(value.path, into);
589
+ FfiConverterUInt64.write(value.size, into);
590
+ }
591
+ allocationSize(value: TypeName): number {
592
+ return FfiConverterString.allocationSize(value.path) +
593
+ FfiConverterUInt64.allocationSize(value.size);
594
+
595
+ }
596
+ };
597
+ return new FFIConverter();
598
+ })();
599
+
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
+
492
659
  /**
493
660
  * A pending tool call waiting for resolution from the language binding.
494
661
  */
@@ -1217,6 +1384,13 @@ export interface RustChatInterface {
1217
1384
  * Send a message and get a token stream for the response.
1218
1385
  */
1219
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;
1220
1394
  /**
1221
1395
  * Send a multimodal prompt (text + images/audio) and get a token stream.
1222
1396
  *
@@ -1232,6 +1406,10 @@ export interface RustChatInterface {
1232
1406
  * Get the current sampler configuration as a JSON string.
1233
1407
  */
1234
1408
  getSamplerConfigJson(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
1409
+ /**
1410
+ * Get context usage statistics.
1411
+ */
1412
+ getStats(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<ChatStats>;
1235
1413
  /**
1236
1414
  * Get the current system prompt.
1237
1415
  */
@@ -1272,6 +1450,15 @@ export interface RustChatInterface {
1272
1450
  * Stop the current generation.
1273
1451
  */
1274
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>>;
1275
1462
  }
1276
1463
 
1277
1464
 
@@ -1322,6 +1509,25 @@ export class RustChat extends UniffiAbstractObject implements RustChatInterface
1322
1509
  ));
1323
1510
  }
1324
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
+
1325
1531
  /**
1326
1532
  * Send a multimodal prompt (text + images/audio) and get a token stream.
1327
1533
  *
@@ -1401,6 +1607,37 @@ async getSamplerConfigJson(asyncOpts_?: { signal: AbortSignal }): Promise<strin
1401
1607
  }
1402
1608
  }
1403
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
+
1404
1641
  /**
1405
1642
  * Get the current system prompt.
1406
1643
  */
@@ -1691,6 +1928,69 @@ async setTools(tools: Array<RustToolInterface>, asyncOpts_?: { signal: AbortSig
1691
1928
  );
1692
1929
  }
1693
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
+
1694
1994
 
1695
1995
  /**
1696
1996
  * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
@@ -2091,6 +2391,7 @@ const FfiConverterTypeRustEncoder = new FfiConverterObject(uniffiTypeRustEncode
2091
2391
 
2092
2392
  export interface RustModelInterface {
2093
2393
 
2394
+ maxCtx() : /*u32*/number;
2094
2395
  }
2095
2396
 
2096
2397
 
@@ -2109,6 +2410,16 @@ private constructor(pointer: UniffiHandle) {
2109
2410
 
2110
2411
 
2111
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
+
2112
2423
 
2113
2424
  /**
2114
2425
  * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
@@ -2184,41 +2495,380 @@ const uniffiTypeRustModelObjectFactory: UniffiObjectFactory<RustModelInterface>
2184
2495
  const FfiConverterTypeRustModel = new FfiConverterObject(uniffiTypeRustModelObjectFactory);
2185
2496
 
2186
2497
 
2187
- 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 {
2188
2503
 
2189
2504
  /**
2190
- * 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.
2191
2507
  */
2192
- completed(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string>;
2508
+ transcribeFile(path: string) /*throws*/: RustSttStreamInterface;
2193
2509
  /**
2194
- * 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.
2195
2512
  */
2196
- nextToken(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<string | undefined>;
2513
+ transcribePcm(samples: Array</*i16*/number>, sampleRate: /*u32*/number) /*throws*/: RustSttStreamInterface;
2197
2514
  }
2198
2515
 
2199
2516
 
2200
- 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 {
2201
2522
 
2202
- readonly [uniffiTypeNameSymbol] = "RustTokenStream";
2523
+ readonly [uniffiTypeNameSymbol] = "RustStt";
2203
2524
  readonly [destructorGuardSymbol]: UniffiGcObject;
2204
2525
  readonly [pointerLiteralSymbol]: UniffiHandle;
2205
- // No primary constructor declared for this class.
2206
- private constructor(pointer: UniffiHandle) {
2207
- super();
2208
- this[pointerLiteralSymbol] = pointer;
2209
- this[destructorGuardSymbol] = uniffiTypeRustTokenStreamObjectFactory.bless(pointer);
2210
- }
2211
-
2212
-
2213
-
2214
-
2215
2526
  /**
2216
- * Wait for the full response to complete and return it.
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"`.
2217
2533
  */
2218
- async completed(asyncOpts_?: { signal: AbortSignal }): Promise<string> /*throws*/ {
2219
- const __stack = uniffiIsDebug ? new Error().stack : undefined;
2220
- try {
2221
- return await uniffiRustCallAsync(
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
+ }
2552
+
2553
+
2554
+
2555
+
2556
+ /**
2557
+ * Start transcribing an audio file (WAV / MP3).
2558
+ * Returns a `RustSTTStream` to consume tokens as they are generated.
2559
+ */
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);
2568
+ },
2569
+ /*liftString:*/ FfiConverterString.lift,
2570
+ ));
2571
+ }
2572
+
2573
+ /**
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.
2576
+ */
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);
2586
+ },
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(
2222
2872
  /*rustCaller:*/ uniffiCaller,
2223
2873
  /*rustFutureFunc:*/ () => {
2224
2874
  return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_rusttokenstream_completed(
@@ -2547,6 +3197,176 @@ const uniffiTypeRustToolObjectFactory: UniffiObjectFactory<RustToolInterface> =
2547
3197
  const FfiConverterTypeRustTool = new FfiConverterObject(uniffiTypeRustToolObjectFactory);
2548
3198
 
2549
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
+
2550
3370
  export interface SamplerBuilderInterface {
2551
3371
 
2552
3372
  /**
@@ -2581,6 +3401,11 @@ export interface SamplerBuilderInterface {
2581
3401
  * Apply repetition penalties to discourage repeated tokens.
2582
3402
  */
2583
3403
  penalties(penaltyLastN: /*i32*/number, penaltyRepeat: /*f32*/number, penaltyFreq: /*f32*/number, penaltyPresent: /*f32*/number) : SamplerBuilderInterface;
3404
+ /**
3405
+ * Set the RNG seed used by random samplers (`dist`, `mirostat_v1`, `mirostat_v2`, `xtc`).
3406
+ * `greedy` ignores it. If unset, a default seed is used.
3407
+ */
3408
+ seed(seed: /*u32*/number) : SamplerBuilderInterface;
2584
3409
  /**
2585
3410
  * Apply temperature scaling to the probability distribution.
2586
3411
  */
@@ -2752,6 +3577,21 @@ export class SamplerBuilder extends UniffiAbstractObject implements SamplerBuild
2752
3577
  ));
2753
3578
  }
2754
3579
 
3580
+ /**
3581
+ * Set the RNG seed used by random samplers (`dist`, `mirostat_v1`, `mirostat_v2`, `xtc`).
3582
+ * `greedy` ignores it. If unset, a default seed is used.
3583
+ */
3584
+ seed(seed: /*u32*/number): SamplerBuilderInterface {
3585
+ return FfiConverterTypeSamplerBuilder.lift(uniffiCaller.rustCall(
3586
+ /*caller:*/ (callStatus) => {
3587
+ return nativeModule().ubrn_uniffi_nobodywho_uniffi_fn_method_samplerbuilder_seed(uniffiTypeSamplerBuilderObjectFactory.clonePointer(this),
3588
+ FfiConverterUInt32.lower(seed),
3589
+ callStatus);
3590
+ },
3591
+ /*liftString:*/ FfiConverterString.lift,
3592
+ ));
3593
+ }
3594
+
2755
3595
  /**
2756
3596
  * Apply temperature scaling to the probability distribution.
2757
3597
  */
@@ -3035,6 +3875,14 @@ const FfiConverterTypeSamplerConfig = new FfiConverterObject(uniffiTypeSamplerC
3035
3875
  const FfiConverterOptionalTypeRustDownloadProgressCallback = new FfiConverterOptional(FfiConverterTypeRustDownloadProgressCallback);
3036
3876
 
3037
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
+
3038
3886
  // FfiConverter for PendingToolCall | undefined
3039
3887
  const FfiConverterOptionalTypePendingToolCall = new FfiConverterOptional(FfiConverterTypePendingToolCall);
3040
3888
 
@@ -3051,10 +3899,18 @@ const FfiConverterOptionalUInt32 = new FfiConverterOptional(FfiConverterUInt32);
3051
3899
  const FfiConverterArrayFloat32 = new FfiConverterArray(FfiConverterFloat32);
3052
3900
 
3053
3901
 
3902
+ // FfiConverter for Array</*i16*/number>
3903
+ const FfiConverterArrayInt16 = new FfiConverterArray(FfiConverterInt16);
3904
+
3905
+
3054
3906
  // FfiConverter for Array<Asset>
3055
3907
  const FfiConverterArrayTypeAsset = new FfiConverterArray(FfiConverterTypeAsset);
3056
3908
 
3057
3909
 
3910
+ // FfiConverter for Array<CachedModel>
3911
+ const FfiConverterArrayTypeCachedModel = new FfiConverterArray(FfiConverterTypeCachedModel);
3912
+
3913
+
3058
3914
  // FfiConverter for Array<ToolCall>
3059
3915
  const FfiConverterArrayTypeToolCall = new FfiConverterArray(FfiConverterTypeToolCall);
3060
3916
 
@@ -3095,6 +3951,10 @@ const FfiConverterArrayTypePromptPart = new FfiConverterArray(FfiConverterTypePr
3095
3951
  const FfiConverterArrayTypeRustTool = new FfiConverterArray(FfiConverterTypeRustTool);
3096
3952
 
3097
3953
 
3954
+ // FfiConverter for Array</*i32*/number | undefined>
3955
+ const FfiConverterArrayOptionalInt32 = new FfiConverterArray(FfiConverterOptionalInt32);
3956
+
3957
+
3098
3958
  // FfiConverter for Array<RustToolInterface> | undefined
3099
3959
  const FfiConverterOptionalArrayTypeRustTool = new FfiConverterOptional(FfiConverterArrayTypeRustTool);
3100
3960
 
@@ -3122,9 +3982,15 @@ function uniffiEnsureInitialized() {
3122
3982
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_download_model() !== 31331) {
3123
3983
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_download_model");
3124
3984
  }
3985
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_get_cached_models() !== 12002) {
3986
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_get_cached_models");
3987
+ }
3125
3988
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_load_model() !== 33587) {
3126
3989
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_load_model");
3127
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
+ }
3128
3994
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_grammar() !== 13698) {
3129
3995
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_func_sampler_preset_constrain_with_grammar");
3130
3996
  }
@@ -3161,6 +4027,9 @@ function uniffiEnsureInitialized() {
3161
4027
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_ask() !== 53575) {
3162
4028
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_ask");
3163
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
+ }
3164
4033
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_ask_with_prompt() !== 65089) {
3165
4034
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_ask_with_prompt");
3166
4035
  }
@@ -3170,6 +4039,9 @@ function uniffiEnsureInitialized() {
3170
4039
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_get_sampler_config_json() !== 33078) {
3171
4040
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_get_sampler_config_json");
3172
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
+ }
3173
4045
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_get_system_prompt() !== 57727) {
3174
4046
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_get_system_prompt");
3175
4047
  }
@@ -3200,6 +4072,12 @@ function uniffiEnsureInitialized() {
3200
4072
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustchat_stop_generation() !== 24711) {
3201
4073
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustchat_stop_generation");
3202
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
+ }
3203
4081
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustcrossencoder_rank() !== 55500) {
3204
4082
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustcrossencoder_rank");
3205
4083
  }
@@ -3209,6 +4087,21 @@ function uniffiEnsureInitialized() {
3209
4087
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rustencoder_encode() !== 52601) {
3210
4088
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rustencoder_encode");
3211
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
+ }
3212
4105
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_completed() !== 26060) {
3213
4106
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttokenstream_completed");
3214
4107
  }
@@ -3224,6 +4117,12 @@ function uniffiEnsureInitialized() {
3224
4117
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_rusttool_resolve_pending_call() !== 10096) {
3225
4118
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_rusttool_resolve_pending_call");
3226
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
+ }
3227
4126
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_dist() !== 23376) {
3228
4127
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_dist");
3229
4128
  }
@@ -3248,6 +4147,9 @@ function uniffiEnsureInitialized() {
3248
4147
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_penalties() !== 40767) {
3249
4148
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_penalties");
3250
4149
  }
4150
+ if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_seed() !== 25129) {
4151
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_seed");
4152
+ }
3251
4153
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_temperature() !== 8456) {
3252
4154
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_method_samplerbuilder_temperature");
3253
4155
  }
@@ -3275,12 +4177,18 @@ function uniffiEnsureInitialized() {
3275
4177
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rustencoder_new() !== 27902) {
3276
4178
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rustencoder_new");
3277
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
+ }
3278
4183
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rusttool_new() !== 9431) {
3279
4184
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rusttool_new");
3280
4185
  }
3281
4186
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_rusttool_new_async() !== 54521) {
3282
4187
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_rusttool_new_async");
3283
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
+ }
3284
4192
  if (nativeModule().ubrn_uniffi_nobodywho_uniffi_checksum_constructor_samplerbuilder_new() !== 50214) {
3285
4193
  throw new UniffiInternalError.ApiChecksumMismatch("uniffi_nobodywho_uniffi_checksum_constructor_samplerbuilder_new");
3286
4194
  }
@@ -3302,6 +4210,8 @@ export default Object.freeze({
3302
4210
  initialize: uniffiEnsureInitialized,
3303
4211
  converters: {
3304
4212
  FfiConverterTypeAsset,
4213
+ FfiConverterTypeCachedModel,
4214
+ FfiConverterTypeChatStats,
3305
4215
  FfiConverterTypeMessage,
3306
4216
  FfiConverterTypeNobodyWhoError,
3307
4217
  FfiConverterTypePendingToolCall,
@@ -3310,8 +4220,11 @@ export default Object.freeze({
3310
4220
  FfiConverterTypeRustCrossEncoder,
3311
4221
  FfiConverterTypeRustEncoder,
3312
4222
  FfiConverterTypeRustModel,
4223
+ FfiConverterTypeRustSTT,
4224
+ FfiConverterTypeRustSTTStream,
3313
4225
  FfiConverterTypeRustTokenStream,
3314
4226
  FfiConverterTypeRustTool,
4227
+ FfiConverterTypeRustTts,
3315
4228
  FfiConverterTypeSamplerBuilder,
3316
4229
  FfiConverterTypeSamplerConfig,
3317
4230
  FfiConverterTypeToolCall,