@happyvertical/speech 0.97.0 → 0.99.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.
Files changed (77) hide show
  1. package/AGENT.md +31 -3
  2. package/README.md +310 -2
  3. package/dist/__tests__/fake-websocket.d.ts +38 -0
  4. package/dist/__tests__/fake-websocket.d.ts.map +1 -0
  5. package/dist/adapters/local/abort.d.ts +6 -0
  6. package/dist/adapters/local/abort.d.ts.map +1 -0
  7. package/dist/adapters/local/audio.d.ts +45 -0
  8. package/dist/adapters/local/audio.d.ts.map +1 -0
  9. package/dist/adapters/local/env.d.ts +15 -0
  10. package/dist/adapters/local/env.d.ts.map +1 -0
  11. package/dist/adapters/local/runtime.d.ts +58 -0
  12. package/dist/adapters/local/runtime.d.ts.map +1 -0
  13. package/dist/adapters/local/transcriber.d.ts +40 -0
  14. package/dist/adapters/local/transcriber.d.ts.map +1 -0
  15. package/dist/adapters/local/transformers-shim.d.ts +8 -0
  16. package/dist/adapters/local/transformers-shim.d.ts.map +1 -0
  17. package/dist/adapters/local/types.d.ts +92 -0
  18. package/dist/adapters/local/types.d.ts.map +1 -0
  19. package/dist/adapters/local/worker.d.ts +118 -0
  20. package/dist/adapters/local/worker.d.ts.map +1 -0
  21. package/dist/adapters/openai-compatible.d.ts +2 -1
  22. package/dist/adapters/openai-compatible.d.ts.map +1 -1
  23. package/dist/adapters/openai-realtime.d.ts +48 -0
  24. package/dist/adapters/openai-realtime.d.ts.map +1 -0
  25. package/dist/adapters/voxtral-realtime.d.ts +44 -0
  26. package/dist/adapters/voxtral-realtime.d.ts.map +1 -0
  27. package/dist/chunks/errors-CQBX3OPS.js +41 -0
  28. package/dist/chunks/errors-CQBX3OPS.js.map +1 -0
  29. package/dist/chunks/registry-C_5BakmM.js +306 -0
  30. package/dist/chunks/registry-C_5BakmM.js.map +1 -0
  31. package/dist/chunks/websocket-CR9uXAuS.js +44 -0
  32. package/dist/chunks/websocket-CR9uXAuS.js.map +1 -0
  33. package/dist/conversation/openai-webrtc.d.ts +4 -0
  34. package/dist/conversation/openai-webrtc.d.ts.map +1 -0
  35. package/dist/conversation/types.d.ts +60 -0
  36. package/dist/conversation/types.d.ts.map +1 -0
  37. package/dist/conversation-server.d.ts +40 -0
  38. package/dist/conversation-server.d.ts.map +1 -0
  39. package/dist/conversation-server.js +174 -0
  40. package/dist/conversation-server.js.map +1 -0
  41. package/dist/conversation.d.ts +4 -0
  42. package/dist/conversation.d.ts.map +1 -0
  43. package/dist/conversation.js +346 -0
  44. package/dist/conversation.js.map +1 -0
  45. package/dist/index.d.ts +9 -0
  46. package/dist/index.d.ts.map +1 -1
  47. package/dist/index.js +1824 -326
  48. package/dist/index.js.map +1 -1
  49. package/dist/local.d.ts +21 -0
  50. package/dist/local.d.ts.map +1 -0
  51. package/dist/local.js +964 -0
  52. package/dist/local.js.map +1 -0
  53. package/dist/shared/env.d.ts +5 -0
  54. package/dist/shared/env.d.ts.map +1 -1
  55. package/dist/shared/factory.d.ts.map +1 -1
  56. package/dist/shared/pcm.d.ts +21 -0
  57. package/dist/shared/pcm.d.ts.map +1 -0
  58. package/dist/shared/realtime-auth.d.ts +34 -0
  59. package/dist/shared/realtime-auth.d.ts.map +1 -0
  60. package/dist/shared/realtime-session.d.ts +240 -0
  61. package/dist/shared/realtime-session.d.ts.map +1 -0
  62. package/dist/shared/registry.d.ts +9 -0
  63. package/dist/shared/registry.d.ts.map +1 -0
  64. package/dist/shared/streaming-client-secret.d.ts +90 -0
  65. package/dist/shared/streaming-client-secret.d.ts.map +1 -0
  66. package/dist/shared/streaming-factory.d.ts +65 -0
  67. package/dist/shared/streaming-factory.d.ts.map +1 -0
  68. package/dist/shared/streaming-types.d.ts +303 -0
  69. package/dist/shared/streaming-types.d.ts.map +1 -0
  70. package/dist/shared/turn-limit.d.ts +84 -0
  71. package/dist/shared/turn-limit.d.ts.map +1 -0
  72. package/dist/shared/types.d.ts +24 -6
  73. package/dist/shared/types.d.ts.map +1 -1
  74. package/dist/shared/websocket.d.ts +56 -0
  75. package/dist/shared/websocket.d.ts.map +1 -0
  76. package/metadata.json +9 -2
  77. package/package.json +27 -3
@@ -0,0 +1,40 @@
1
+ import { Transcriber, TranscriptionRequest, TranscriptResult } from '../../shared/types.js';
2
+ import { AsrOutput } from './runtime.js';
3
+ import { LocalTranscriberOptions } from './types.js';
4
+ /** Small multilingual Whisper (~80 MB at the default q8 quantisation). */
5
+ export declare const DEFAULT_LOCAL_MODEL = "onnx-community/whisper-base";
6
+ /**
7
+ * On-device speech-to-text with transformers.js (Whisper or Moonshine ONNX).
8
+ * Runs on WebGPU/WASM in browsers and onnxruntime-node in Node; no audio
9
+ * leaves the device and no API key is involved.
10
+ */
11
+ export declare class LocalTranscriber implements Transcriber {
12
+ readonly type: "local";
13
+ private readonly options;
14
+ private readonly model;
15
+ private readonly maxBytes;
16
+ private readonly onUsage?;
17
+ private runtime?;
18
+ private readonly pipelines;
19
+ /** Serialises inference: ONNX sessions (especially WebGPU) run one call at a time. */
20
+ private queue;
21
+ constructor(options?: LocalTranscriberOptions);
22
+ /**
23
+ * Downloads (first time) and initialises the model so the first
24
+ * `transcribe()` is fast. Progress goes to `onProgress`.
25
+ */
26
+ preload(model?: string, signal?: AbortSignal): Promise<void>;
27
+ transcribe(request: TranscriptionRequest): Promise<TranscriptResult>;
28
+ /** Waits for in-flight inference, then releases every loaded model session. */
29
+ dispose(): Promise<void>;
30
+ private run;
31
+ private enqueue;
32
+ private loadRuntime;
33
+ private loadPipeline;
34
+ }
35
+ /**
36
+ * Maps transformers.js chunks onto `words` (when word timestamps were
37
+ * requested) or `segments`.
38
+ */
39
+ export declare function mapAsrOutput(output: AsrOutput, wordLevel: boolean): Pick<TranscriptResult, 'text' | 'segments' | 'words'>;
40
+ //# sourceMappingURL=transcriber.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcriber.d.ts","sourceRoot":"","sources":["../../../src/adapters/local/transcriber.ts"],"names":[],"mappings":"AAQA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for the optional `@huggingface/transformers` peer, mapped through
3
+ * `paths` in tsconfig.json. The adapter uses its own structural types
4
+ * (`runtime.ts`) so the package typechecks without compiling the peer's
5
+ * declarations, which fail under this repo's `skipLibCheck: false` (4.3.0).
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=transformers-shim.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformers-shim.d.ts","sourceRoot":"","sources":["../../../src/adapters/local/transformers-shim.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,CAAC"}
@@ -0,0 +1,92 @@
1
+ import { SpeechUsageCallback } from '../../shared/usage.js';
2
+ /**
3
+ * Inference device. `auto` picks WebGPU when the browser exposes a usable
4
+ * adapter (falling back to WASM if WebGPU fails to initialise) and `cpu` in
5
+ * Node. Other values are passed to transformers.js unchanged (Node also
6
+ * supports `cuda`, `dml`, `coreml`, and `webgpu` where onnxruntime-node does).
7
+ */
8
+ export type LocalTranscriberDevice = 'auto' | 'webgpu' | 'wasm' | 'cpu' | 'gpu' | 'cuda' | 'dml' | 'coreml' | (string & {});
9
+ /**
10
+ * Quantisation (`dtype`) forwarded to transformers.js: a single value such as
11
+ * `q8`, `q4`, `fp16`, `fp32`, or a per-file map such as
12
+ * `{ encoder_model: 'fp32', decoder_model_merged: 'q4' }`.
13
+ */
14
+ export type LocalTranscriberDtype = string | Record<string, string>;
15
+ /** Model loading progress, as reported by transformers.js. */
16
+ export interface LocalTranscriberProgress {
17
+ status: string;
18
+ name?: string;
19
+ file?: string;
20
+ progress?: number;
21
+ loaded?: number;
22
+ total?: number;
23
+ [key: string]: unknown;
24
+ }
25
+ export type LocalTranscriberProgressCallback = (progress: LocalTranscriberProgress) => void;
26
+ /** Decoded audio returned by a {@link LocalAudioDecoder}. */
27
+ export interface DecodedAudio {
28
+ /** Mono samples, or one array per channel (downmixed by averaging). */
29
+ samples: Float32Array | Float32Array[];
30
+ sampleRate: number;
31
+ }
32
+ /**
33
+ * Caller-supplied decoder for formats the adapter cannot decode itself, e.g.
34
+ * WebM/Opus, MP4/AAC, MP3, or FLAC in Node (where there is no `AudioContext`).
35
+ * Return any sample rate; the adapter resamples to 16 kHz mono.
36
+ */
37
+ export type LocalAudioDecoder = (audio: {
38
+ bytes: Uint8Array;
39
+ mimeType: string;
40
+ signal?: AbortSignal;
41
+ }) => Promise<DecodedAudio>;
42
+ /** Loader for the transformers.js module, or the module itself. */
43
+ export type LocalTransformersRuntime = Record<string, unknown> | (() => Promise<Record<string, unknown>>);
44
+ /** Settings shared by the `local` transcriber and `getTranscriber()`. */
45
+ export interface LocalTranscriberSettings {
46
+ /** Hugging Face model id. Default `onnx-community/whisper-base`. */
47
+ model?: string;
48
+ /** Inference device. Default `auto`. */
49
+ device?: LocalTranscriberDevice;
50
+ /** Quantisation. Default: transformers.js chooses per device. */
51
+ dtype?: LocalTranscriberDtype;
52
+ /** Model revision (branch, tag, or commit). Default `main`. */
53
+ revision?: string;
54
+ /**
55
+ * Node model cache directory. Browsers always use Cache Storage, so this is
56
+ * ignored there.
57
+ */
58
+ cacheDir?: string;
59
+ /**
60
+ * Custom model host for self-hosted weights, e.g. `https://models.example.com/`.
61
+ * Sets the process-wide transformers.js `env.remoteHost`.
62
+ */
63
+ modelHost?: string;
64
+ /** Called with download and load progress (first load only). */
65
+ onProgress?: LocalTranscriberProgressCallback;
66
+ /** Decoder for formats without a built-in decoder. See {@link LocalAudioDecoder}. */
67
+ decodeAudio?: LocalAudioDecoder;
68
+ /**
69
+ * Whisper chunk length in seconds for audio longer than one 30 s window.
70
+ * Default 30; `0` disables chunking.
71
+ */
72
+ chunkLengthSeconds?: number;
73
+ /** Input byte limit. Default 25 MB; `Infinity` disables it. */
74
+ maxBytes?: number;
75
+ /** Called with usage after every successful transcription. */
76
+ onUsage?: SpeechUsageCallback;
77
+ /**
78
+ * Inject the transformers.js module (or a loader for it), e.g. a CDN build.
79
+ * Default: `import('@huggingface/transformers')`.
80
+ */
81
+ transformers?: LocalTransformersRuntime;
82
+ /**
83
+ * Escape hatch to adjust the process-wide transformers.js `env` (for example
84
+ * `localModelPath`, `allowRemoteModels`, or `backends.onnx.wasm`) before the
85
+ * first model load.
86
+ */
87
+ configureEnv?: (env: Record<string, unknown>) => void;
88
+ }
89
+ export interface LocalTranscriberOptions extends LocalTranscriberSettings {
90
+ type?: 'local';
91
+ }
92
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/adapters/local/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAC9B,MAAM,GACN,QAAQ,GACR,MAAM,GACN,KAAK,GACL,KAAK,GACL,MAAM,GACN,KAAK,GACL,QAAQ,GACR,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEpE,8DAA8D;AAC9D,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,MAAM,gCAAgC,GAAG,CAC7C,QAAQ,EAAE,wBAAwB,KAC/B,IAAI,CAAC;AAEV,6DAA6D;AAC7D,MAAM,WAAW,YAAY;IAC3B,uEAAuE;IACvE,OAAO,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IACvC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AAC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-0,0 +1,118 @@
1
+ import { TimestampGranularity, Transcriber, TranscriptionRequest, TranscriptResult } from '../../shared/types.js';
2
+ import { SpeechUsageCallback } from '../../shared/usage.js';
3
+ import { LocalAudioDecoder, LocalTranscriberOptions, LocalTranscriberProgress, LocalTranscriberProgressCallback } from './types.js';
4
+ /** Minimal `postMessage` endpoint: a `Worker`, `DedicatedWorkerGlobalScope`, or `MessagePort`. */
5
+ export interface LocalWorkerEndpoint {
6
+ postMessage(message: unknown, transfer?: Transferable[]): void;
7
+ addEventListener(type: 'message', listener: (event: MessageEvent) => void): void;
8
+ removeEventListener(type: 'message', listener: (event: MessageEvent) => void): void;
9
+ }
10
+ /** Audio sent to the worker. Its buffers are transferred, not copied. */
11
+ export type LocalWorkerAudio = {
12
+ /** WAV or raw PCM bytes (or any format the worker's `decodeAudio` handles). */
13
+ kind: 'encoded';
14
+ bytes: Uint8Array;
15
+ mimeType: string;
16
+ sampleRate?: number;
17
+ channels?: number;
18
+ } | {
19
+ /** Channels decoded on the main thread; the worker downmixes and resamples. */
20
+ kind: 'decoded';
21
+ samples: Float32Array[];
22
+ sampleRate: number;
23
+ };
24
+ /** Messages from the client to the worker. */
25
+ export type LocalWorkerRequest = {
26
+ kind: 'transcribe';
27
+ id: number;
28
+ audio: LocalWorkerAudio;
29
+ model?: string;
30
+ language?: string;
31
+ timestampGranularities?: TimestampGranularity[];
32
+ } | {
33
+ kind: 'preload';
34
+ id: number;
35
+ model?: string;
36
+ } | {
37
+ kind: 'abort';
38
+ id: number;
39
+ };
40
+ /** Messages from the worker to the client. */
41
+ export type LocalWorkerResponse = {
42
+ kind: 'result';
43
+ id: number;
44
+ result?: TranscriptResult;
45
+ } | {
46
+ kind: 'error';
47
+ id: number;
48
+ error: {
49
+ name: string;
50
+ message: string;
51
+ code?: string;
52
+ };
53
+ } | {
54
+ kind: 'progress';
55
+ progress: LocalTranscriberProgress;
56
+ };
57
+ /**
58
+ * Runs a {@link LocalTranscriber} inside a worker and answers client
59
+ * requests. Call it from your worker module:
60
+ *
61
+ * ```ts
62
+ * // transcriber.worker.ts
63
+ * import { serveLocalTranscriber } from '@happyvertical/speech/local';
64
+ * serveLocalTranscriber({ model: 'onnx-community/whisper-base' });
65
+ * ```
66
+ *
67
+ * Returns a function that stops listening and disposes the model.
68
+ */
69
+ export declare function serveLocalTranscriber(options?: LocalTranscriberOptions, endpoint?: LocalWorkerEndpoint): () => Promise<void>;
70
+ export interface LocalTranscriberWorkerClientOptions {
71
+ /** Encoded input byte limit, checked on the main thread. Default 25 MB. */
72
+ maxBytes?: number;
73
+ /**
74
+ * Main-thread decoder for formats other than WAV and raw PCM. Formats with
75
+ * neither this hook nor `AudioContext` go to the worker's own `decodeAudio`.
76
+ */
77
+ decodeAudio?: LocalAudioDecoder;
78
+ /** Model download/load progress forwarded from the worker. */
79
+ onProgress?: LocalTranscriberProgressCallback;
80
+ /** Called with usage after every successful transcription. */
81
+ onUsage?: SpeechUsageCallback;
82
+ }
83
+ /**
84
+ * Main-thread {@link Transcriber} that delegates inference to a worker running
85
+ * {@link serveLocalTranscriber}.
86
+ *
87
+ * ```ts
88
+ * const worker = new Worker(new URL('./transcriber.worker.ts', import.meta.url), { type: 'module' });
89
+ * const transcriber = new LocalTranscriberWorkerClient(worker, { onProgress });
90
+ * const { text } = await transcriber.transcribe({ audio: recordingBlob });
91
+ * ```
92
+ */
93
+ export declare class LocalTranscriberWorkerClient implements Transcriber {
94
+ readonly type: "local";
95
+ private readonly endpoint;
96
+ private readonly options;
97
+ private readonly calls;
98
+ private nextId;
99
+ private closed;
100
+ /** Aborted by `close()` to reject calls still buffering or decoding. */
101
+ private readonly closing;
102
+ private readonly listener;
103
+ constructor(endpoint: LocalWorkerEndpoint, options?: LocalTranscriberWorkerClientOptions);
104
+ /** Loads the model in the worker ahead of the first transcription. */
105
+ preload(model?: string, signal?: AbortSignal): Promise<void>;
106
+ transcribe(request: TranscriptionRequest): Promise<TranscriptResult>;
107
+ /**
108
+ * Stops listening, rejects in-flight and later calls, and asks the worker to
109
+ * abort posted work. Does not terminate the worker.
110
+ */
111
+ close(): void;
112
+ /** Buffers the input and, only when the worker cannot, decodes it here. */
113
+ private prepare;
114
+ private assertOpen;
115
+ private call;
116
+ private onMessage;
117
+ }
118
+ //# sourceMappingURL=worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../../src/adapters/local/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAWH,OAAO,KAAK,EAEV,oBAAoB,EACpB,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,uBAAuB,CAAC;AAU/B,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACvB,wBAAwB,EACxB,gCAAgC,EACjC,MAAM,YAAY,CAAC;AAEpB,kGAAkG;AAClG,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IAC/D,gBAAgB,CACd,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GACtC,IAAI,CAAC;IACR,mBAAmB,CACjB,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GACtC,IAAI,CAAC;CACT;AAED,yEAAyE;AACzE,MAAM,MAAM,gBAAgB,GACxB;IACE,+EAA+E;IAC/E,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GACD;IACE,+EAA+E;IAC/E,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,YAAY,EAAE,CAA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AC,EAAE,gCAAgC,CAAC;IAC9C,8DAA8D;IAC9D,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B;AAED;;;;;;;;;GASG;AACH,qBAAa,4BAA6B,YAAW,WAAW;IAC9D,QAAQ,CAAC,IAAI,EAAG,OAAO,CAAU;IAEjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAsB;IAC/C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsC;IAC9D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAMlB;IACJ,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,MAAM,CAAS;IACvB,wEAAwE;IACxE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;IACjD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAC2B;gBAGlD,QAAQ,EAAE,mBAAmB,EAC7B,OAAO,GAAE,mCAAwC;IAOnD,sEAAsE;IAChE,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5D,UAAU,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAgC1E;;;OAGG;IACH,KAAK,IAAI,IAAI;IAiBb,2EAA2E;YAC7D,OAAO;IAyDrB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,IAAI;IAiCZ,OAAO,CAAC,SAAS;CAoBlB"}
@@ -2,7 +2,8 @@ import { HttpSpeechAdapter } from '../shared/http.js';
2
2
  import { OpenAICompatibleSpeechSynthesizerOptions, SpeechSynthesizer, SynthesisRequest, SynthesizedSpeech } from '../shared/types.js';
3
3
  export declare class OpenAICompatibleSpeechSynthesizer extends HttpSpeechAdapter implements SpeechSynthesizer {
4
4
  readonly type: "openai-compatible";
5
- private readonly speechPath;
5
+ /** Explicit override, resolved relative to `baseUrl` (or absolute). */
6
+ private readonly speechPath?;
6
7
  private readonly defaultModel;
7
8
  private readonly defaultVoice;
8
9
  constructor(options: OpenAICompatibleSpeechSynthesizerOptions);
@@ -1 +1 @@
1
- {"version":3,"file":"openai-compatible.d.ts","sourceRoot":"","sources":["../../src/adapters/openai-compatible.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAGlB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,wCAAwC,EACxC,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAE5B,qBAAa,iCACX,SAAQ,iBACR,YAAW,iBAAiB;IAE5B,QAAQ,CAAC,IAAI,EAAG,mBAAmB,CAAU;IAE7C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAE1B,OAAO,EAAE,wCAAwC;IAOvD,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;CA8BxE"}
1
+ {"version":3,"file":"openai-compatible.d.ts","sourceRoot":"","sources":["../../src/adapters/openai-compatible.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAIlB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,wCAAwC,EACxC,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAE5B,qBAAa,iCACX,SAAQ,iBACR,YAAW,iBAAiB;IAE5B,QAAQ,CAAC,IAAI,EAAG,mBAAmB,CAAU;IAE7C,uEAAuE;IACvE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAE1B,OAAO,EAAE,wCAAwC;IAOvD,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAsCxE"}
@@ -0,0 +1,48 @@
1
+ import { RealtimeProtocol, RealtimeProtocolEvent, RealtimeSessionConfig } from '../shared/realtime-session.js';
2
+ import { OpenAIRealtimeTranscriberOptions, StreamingAudioFormat, StreamingSession, StreamingSessionOptions, StreamingTranscriber, StreamingTurnLimit } from '../shared/streaming-types.js';
3
+ export declare const OPENAI_REALTIME_DEFAULT_URL = "wss://api.openai.com/v1/realtime";
4
+ export declare const OPENAI_REALTIME_DEFAULT_MODEL = "gpt-4o-transcribe";
5
+ /** The OpenAI Realtime transcription wire protocol. */
6
+ export declare const openAIRealtimeProtocol: (extras?: Pick<OpenAIRealtimeTranscriberOptions, "noiseReduction" | "include" | "transcriptionOptions">) => RealtimeProtocol;
7
+ /**
8
+ * The GA transcription session object (`session.type: "transcription"`),
9
+ * shared by `session.update` and the client-secret mint request.
10
+ */
11
+ export declare function openAIRealtimeTranscriptionSession(config: RealtimeSessionConfig, extras?: Pick<OpenAIRealtimeTranscriberOptions, 'noiseReduction' | 'include' | 'transcriptionOptions'>): Record<string, unknown>;
12
+ /** Maps one OpenAI Realtime server event to normalised session events. */
13
+ export declare function parseOpenAIRealtimeEvent(message: unknown): RealtimeProtocolEvent[];
14
+ /**
15
+ * Realtime transcriber for OpenAI and OpenAI-Realtime-compatible servers.
16
+ *
17
+ * Auth: `apiKey` is sent as `Authorization: Bearer` (Node only). In browsers,
18
+ * pass `clientSecret` (an ephemeral client secret minted by your server); it
19
+ * is sent as the `openai-insecure-api-key.<secret>` subprotocol. Supplying
20
+ * `apiKey` or `headers` in a browser throws.
21
+ */
22
+ export declare class OpenAIRealtimeTranscriber implements StreamingTranscriber {
23
+ readonly type = "openai-realtime";
24
+ readonly audioFormat: StreamingAudioFormat;
25
+ private readonly options;
26
+ private readonly url;
27
+ private readonly createWebSocket;
28
+ private readonly protocol;
29
+ constructor(options?: OpenAIRealtimeTranscriberOptions);
30
+ /**
31
+ * A turn limit applies only to `manual` sessions with `maxTurnSeconds` set;
32
+ * under server or semantic VAD the provider ends turns itself.
33
+ */
34
+ turnLimit(options?: StreamingSessionOptions): StreamingTurnLimit | undefined;
35
+ private sessionFormat;
36
+ private resolveTurnLimit;
37
+ private turnDetection;
38
+ start(options?: StreamingSessionOptions): StreamingSession;
39
+ }
40
+ /**
41
+ * Resolves a realtime WebSocket URL: `http(s)` becomes `ws(s)`, a server root
42
+ * gets `/v1/realtime`, a versioned API root gets `/realtime`, and
43
+ * `intent=transcription` is added unless an `intent` is already present. No
44
+ * `model` query parameter is added: the model travels in `session.update`.
45
+ */
46
+ export declare function resolveRealtimeUrl(baseUrl: string): string;
47
+ export declare function resolveOpenAIRealtimeFormat(format: Partial<StreamingAudioFormat> | undefined): StreamingAudioFormat;
48
+ //# sourceMappingURL=openai-realtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai-realtime.d.ts","sourceRoot":"","sources":["../../src/adapters/openai-realtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAUH,OAAO,EAML,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAE3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,gCAAgC,EAChC,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EAEpB,kBAAkB,EACnB,MAAM,8BAA8B,CAAC;AAatC,eAAO,MAAM,2BAA2B,qCAAqC,CAAC;AAC9E,eAAO,MAAM,6BAA6B,sBAAsB,CAAC;AAYjE,uDAAuD;AACvD,eAAO,MAAM,sBAAsB,GACjC,SAAQ,IAAI,CACV,gCAAgC,EAChC,gBAAgB,GAAG,SAAS,GAAG,sBAAsB,CACjD,KACL,gBAuBD,CAAC;AAEH;;;GAGG;AACH,wBAAgB,kCAAkC,CAChD,MAAM,EAAE,qBAAqB,EAC7B,MAAM,GAAE,IAAI,CACV,gCAAgC,EAChC,gBAAgB,GAAG,SAAS,GAAG,sBAAsB,CACjD,GACL,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA4BzB;AAED,0EAA0E;AAC1E,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,OAAO,GACf,qBAAqB,EAAE,CAoFzB;AAED;;;;;;;GAOG;AACH,qBAAa,yBAA0B,YAAW,oBAAoB;IACpE,QAAQ,CAAC,IAAI,qBAAW;IACxB,QAAQ,CAAC,WAAW,EAAE,oBAAoB,CAAC;IAE3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmC;IAC3D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAyB;IACzD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;gBAEhC,OAAO,GAAE,gCAAqC;IAa1D;;;OAGG;IACH,SAAS,CACP,OAAO,GAAE,uBAA4B,GACpC,kBAAkB,GAAG,SAAS;IAOjC,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,gBAAgB;IAgBxB,OAAO,CAAC,aAAa;IASrB,KAAK,CAAC,OAAO,GAAE,uBAA4B,GAAG,gBAAgB;CAwC/D;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAQ1D;AAED,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,SAAS,GAChD,oBAAoB,CAsBtB"}
@@ -0,0 +1,44 @@
1
+ import { RealtimeProtocol, RealtimeProtocolEvent } from '../shared/realtime-session.js';
2
+ import { StreamingAudioFormat, StreamingSession, StreamingSessionOptions, StreamingTranscriber, StreamingTurnLimit, VoxtralRealtimeTranscriberOptions } from '../shared/streaming-types.js';
3
+ /** vLLM's default served model name for Voxtral Mini Realtime. */
4
+ export declare const VOXTRAL_REALTIME_DEFAULT_MODEL = "mistralai/Voxtral-Mini-4B-Realtime-2602";
5
+ /** The only input format vLLM's realtime endpoint accepts. */
6
+ export declare const VOXTRAL_REALTIME_AUDIO_FORMAT: Readonly<StreamingAudioFormat>;
7
+ /** The vLLM realtime wire protocol. */
8
+ export declare const voxtralRealtimeProtocol: () => RealtimeProtocol;
9
+ /** Maps one vLLM realtime server event to normalised session events. */
10
+ export declare function parseVoxtralRealtimeEvent(message: unknown): RealtimeProtocolEvent[];
11
+ /**
12
+ * Realtime transcriber for Voxtral Realtime served by vLLM.
13
+ *
14
+ * - Audio: PCM16, 16 kHz, mono only; write whole samples (even byte counts).
15
+ * - Turns: manual only. vLLM has no VAD; it streams partials continuously and
16
+ * produces one final per `commit()` / `end()`, plus one per automatic
17
+ * rollover when a turn reaches `maxTurnSeconds` (default 270).
18
+ * - `language` and `prompt` are not sent: vLLM's realtime session accepts
19
+ * only `model`.
20
+ * - Auth: `apiKey` → `Authorization: Bearer` (Node only). vLLM has no
21
+ * ephemeral tokens, so browsers must connect through the consumer's own
22
+ * proxy or token gateway, passing that gateway's short-lived `clientSecret`
23
+ * (sent as the `openai-insecure-api-key.<secret>` subprotocol next to
24
+ * `realtime`; the gateway must echo `realtime`).
25
+ */
26
+ export declare class VoxtralRealtimeTranscriber implements StreamingTranscriber {
27
+ readonly type = "voxtral-realtime";
28
+ readonly audioFormat: StreamingAudioFormat;
29
+ private readonly options;
30
+ private readonly url;
31
+ private readonly createWebSocket;
32
+ private readonly protocol;
33
+ constructor(options?: VoxtralRealtimeTranscriberOptions);
34
+ turnLimit(options?: StreamingSessionOptions): StreamingTurnLimit | undefined;
35
+ private resolveTurnLimit;
36
+ start(options?: StreamingSessionOptions): StreamingSession;
37
+ }
38
+ /**
39
+ * Resolves vLLM's realtime WebSocket URL: `http(s)` becomes `ws(s)`, a server
40
+ * root gets `/v1/realtime`, a versioned API root (e.g. a gateway's
41
+ * `/stt/v1`) gets `/realtime`, and a URL ending in `/realtime` is kept.
42
+ */
43
+ export declare function resolveVoxtralRealtimeUrl(baseUrl: string): string;
44
+ //# sourceMappingURL=voxtral-realtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voxtral-realtime.d.ts","source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 var SpeechError = class extends Error {
3
+ code;
4
+ adapter;
5
+ constructor(message, code, adapter) {
6
+ super(message);
7
+ this.code = code;
8
+ this.adapter = adapter;
9
+ this.name = "SpeechError";
10
+ }
11
+ };
12
+ var SpeechConfigurationError = class extends SpeechError {
13
+ constructor(message, adapter) {
14
+ super(message, "SPEECH_CONFIGURATION_ERROR", adapter);
15
+ this.name = "SpeechConfigurationError";
16
+ }
17
+ };
18
+ var InvalidSpeechAdapterError = class extends SpeechError {
19
+ constructor(type, kind) {
20
+ super(`Invalid ${kind} speech adapter type: ${type}`, "INVALID_ADAPTER");
21
+ this.name = "InvalidSpeechAdapterError";
22
+ }
23
+ };
24
+ var SpeechProviderError = class extends SpeechError {
25
+ status;
26
+ responseBody;
27
+ /** Parsed `Retry-After` delay in milliseconds, when the provider sent one. */
28
+ retryAfterMs;
29
+ constructor(adapter, message, options = {}) {
30
+ super(message, "SPEECH_PROVIDER_ERROR", adapter);
31
+ this.name = "SpeechProviderError";
32
+ this.status = options.status;
33
+ this.responseBody = options.responseBody;
34
+ this.retryAfterMs = options.retryAfterMs;
35
+ if (options.cause !== void 0) this.cause = options.cause;
36
+ }
37
+ };
38
+ //#endregion
39
+ export { SpeechProviderError as i, SpeechConfigurationError as n, SpeechError as r, InvalidSpeechAdapterError as t };
40
+
41
+ //# sourceMappingURL=errors-CQBX3OPS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-CQBX3OPS.js","names":[],"sources":["../../src/shared/errors.ts"],"sourcesContent":["export class SpeechError extends Error {\n constructor(\n message: string,\n public code: string,\n public adapter?: string,\n ) {\n super(message);\n this.name = 'SpeechError';\n }\n}\n\nexport class SpeechConfigurationError extends SpeechError {\n constructor(message: string, adapter?: string) {\n super(message, 'SPEECH_CONFIGURATION_ERROR', adapter);\n this.name = 'SpeechConfigurationError';\n }\n}\n\nexport class InvalidSpeechAdapterError extends SpeechError {\n constructor(type: string, kind: string) {\n super(`Invalid ${kind} speech adapter type: ${type}`, 'INVALID_ADAPTER');\n this.name = 'InvalidSpeechAdapterError';\n }\n}\n\nexport class SpeechProviderError extends SpeechError {\n readonly status?: number;\n readonly responseBody?: string;\n /** Parsed `Retry-After` delay in milliseconds, when the provider sent one. */\n readonly retryAfterMs?: number;\n\n constructor(\n adapter: string,\n message: string,\n options: {\n status?: number;\n responseBody?: string;\n retryAfterMs?: number;\n cause?: unknown;\n } = {},\n ) {\n super(message, 'SPEECH_PROVIDER_ERROR', adapter);\n this.name = 'SpeechProviderError';\n this.status = options.status;\n this.responseBody = options.responseBody;\n this.retryAfterMs = options.retryAfterMs;\n if (options.cause !== undefined) {\n this.cause = options.cause;\n }\n }\n}\n"],"mappings":";AAAA,IAAa,cAAb,cAAiC,MAAM;CAG5B;CACA;CAHT,YACE,SACA,MACA,SACA;EACA,MAAM,OAAO;EAHN,KAAA,OAAA;EACA,KAAA,UAAA;EAGP,KAAK,OAAO;CACd;AACF;AAEA,IAAa,2BAAb,cAA8C,YAAY;CACxD,YAAY,SAAiB,SAAkB;EAC7C,MAAM,SAAS,8BAA8B,OAAO;EACpD,KAAK,OAAO;CACd;AACF;AAEA,IAAa,4BAAb,cAA+C,YAAY;CACzD,YAAY,MAAc,MAAc;EACtC,MAAM,WAAW,KAAK,wBAAwB,QAAQ,iBAAiB;EACvE,KAAK,OAAO;CACd;AACF;AAEA,IAAa,sBAAb,cAAyC,YAAY;CACnD;CACA;;CAEA;CAEA,YACE,SACA,SACA,UAKI,CAAC,GACL;EACA,MAAM,SAAS,yBAAyB,OAAO;EAC/C,KAAK,OAAO;EACZ,KAAK,SAAS,QAAQ;EACtB,KAAK,eAAe,QAAQ;EAC5B,KAAK,eAAe,QAAQ;EAC5B,IAAI,QAAQ,UAAU,KAAA,GACpB,KAAK,QAAQ,QAAQ;CAEzB;AACF"}