@sentropic/llm-mesh 0.31.0 → 0.32.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.
@@ -2,4 +2,5 @@ export * from './contracts.js';
2
2
  export * from './capabilities.js';
3
3
  export * from './catalog.js';
4
4
  export * from './openai-transcription.js';
5
+ export * from './mistral-transcription.js';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/speech/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/speech/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC"}
@@ -2,4 +2,5 @@ export * from './contracts.js';
2
2
  export * from './capabilities.js';
3
3
  export * from './catalog.js';
4
4
  export * from './openai-transcription.js';
5
+ export * from './mistral-transcription.js';
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/speech/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/speech/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1,235 @@
1
+ import type { SpeechBinding, SpeechEngineIdentity, SpeechEvent, SpeechInputFrame, SpeechSession, SpeechSessionReceipt, SpeechSessionRequest } from './contracts.js';
2
+ import type { SpeechCapabilities } from './capabilities.js';
3
+ export declare const MISTRAL_TRANSCRIPTION_PROVIDER_ID = "mistral";
4
+ export declare const MISTRAL_TRANSCRIPTION_ADAPTER_ID = "mistral-transcription";
5
+ export declare const MISTRAL_TRANSCRIPTION_ADAPTER_REVISION = "1";
6
+ export declare const MISTRAL_TRANSCRIPTION_PLACEMENT: "cloud-relay";
7
+ export declare const MISTRAL_TRANSCRIPTION_MODEL_ID = "voxtral-mini-transcribe-realtime-3";
8
+ export declare const MISTRAL_TRANSCRIPTION_WS_URL = "wss://api.mistral.ai/v1/audio/transcriptions/realtime?model=voxtral-mini-transcribe-realtime-3";
9
+ /** The only STT model this adapter serves. The 2602 generation is refused. */
10
+ export declare const mistralTranscriptionModels: readonly ["voxtral-mini-transcribe-realtime-3"];
11
+ export type MistralTranscriptionModelId = (typeof mistralTranscriptionModels)[number];
12
+ /**
13
+ * Served-model check (P2-2): the realtime docs address the wire alias
14
+ * `voxtral-mini-transcribe-realtime-3`, while the model page names the exact
15
+ * preview `voxtral-mini-transcribe-realtime-3-0`. Both name the 3.0 preview
16
+ * generation; anything else served (2602 or unknown) refuses fail-closed.
17
+ */
18
+ export declare const mistralTranscriptionServedModels: readonly ["voxtral-mini-transcribe-realtime-3", "voxtral-mini-transcribe-realtime-3-0"];
19
+ /**
20
+ * Trade speed for accuracy per session. Bounds follow the docs: 80 to 1200,
21
+ * or exactly 2400. No implicit default: the profile pins one.
22
+ */
23
+ export declare const MISTRAL_TRANSCRIPTION_DELAY_MIN_MS = 80;
24
+ export declare const MISTRAL_TRANSCRIPTION_DELAY_MAX_MS = 1200;
25
+ export declare const MISTRAL_TRANSCRIPTION_DELAY_SLOW_MS = 2400;
26
+ /** Independent per-profile configuration. No shared mutable state between profiles. */
27
+ export interface MistralTranscriptionProfileConfig {
28
+ readonly modelId: MistralTranscriptionModelId;
29
+ /** Served model snapshot pinned at admission; never an unreviewed `latest` alias. */
30
+ readonly modelRevision: string;
31
+ /** Wait in ms trading speed for accuracy (80-1200, or exactly 2400). */
32
+ readonly targetStreamingDelayMs: number;
33
+ /** Two-letter ISO 639-1 code. Unset lets the model detect the language. */
34
+ readonly language?: string;
35
+ /** Client-owned turn detection only. Any other value refuses at open. */
36
+ readonly turnDetection?: 'client';
37
+ readonly accountRef?: string;
38
+ }
39
+ export declare const mistralTranscriptionIdentity: (config: MistralTranscriptionProfileConfig) => SpeechEngineIdentity;
40
+ /** Per-profile STT capabilities. TTS is unsupported: synthesis is selected separately. */
41
+ export declare const mistralTranscriptionCapabilities: (config: MistralTranscriptionProfileConfig) => SpeechCapabilities;
42
+ /**
43
+ * Exact `session.update` body. `turn_detection` is omitted (server turn
44
+ * detection unsupported); the provider fixes settings at the first audio.
45
+ */
46
+ export declare const buildMistralSessionUpdate: (config: MistralTranscriptionProfileConfig) => Record<string, unknown>;
47
+ export declare class MistralTranscriptionError extends Error {
48
+ readonly code: 'unknown-model' | 'invalid-config' | 'admission' | 'ceiling' | 'closed' | 'aborted' | 'transport' | 'invalid-format' | 'unsupported-command';
49
+ constructor(code: MistralTranscriptionError['code'], message: string);
50
+ }
51
+ export declare const MISTRAL_TTS_PROVIDER_ID = "mistral";
52
+ export declare const MISTRAL_TTS_ADAPTER_ID = "mistral-tts";
53
+ export declare const MISTRAL_TTS_ADAPTER_REVISION = "1";
54
+ export declare const MISTRAL_TTS_PLACEMENT: "cloud-relay";
55
+ export declare const MISTRAL_TTS_MODEL_ID = "voxtral-mini-tts-3-0";
56
+ export declare const MISTRAL_TTS_ENDPOINT = "https://api.mistral.ai/v1/audio/speech";
57
+ /**
58
+ * Pinned Voxtral 3 preset voices (docs voice library). The mesh pins the
59
+ * selection; voice creation/management stays a console/API operation.
60
+ */
61
+ export declare const mistralTtsVoices: readonly ["voice_478", "voice_447", "voice_485", "voice_3150", "voice_1787", "voice_1786", "voice_1788", "voice_590", "voice_591", "voice_3149", "voice_3147", "voice_592", "voice_3137", "voice_589", "voice_3141", "voice_483", "voice_481", "voice_482", "voice_480", "voice_479", "voice_3143", "voice_3139", "voice_3153", "voice_3146", "voice_3133", "voice_3136", "voice_3135", "voice_3145", "voice_3134", "voice_3154", "voice_3155", "voice_3132", "voice_3138", "voice_3140", "voice_3144", "voice_3142"];
62
+ export type MistralTtsVoiceId = (typeof mistralTtsVoices)[number];
63
+ /** Languages covered by the pinned preset voices (voice implies language). */
64
+ export declare const mistralTtsLanguages: readonly ["en", "fr", "es", "de", "it", "pt", "ar", "ca", "hi", "hu", "ja", "ko", "nl", "no", "pl", "ro", "ru", "tr", "uk", "vi", "zh"];
65
+ /**
66
+ * Response formats the mesh can build. `pcm` covers the advertised pcm16-le
67
+ * output; the exact pcm sample rate is unverified (see the L13 receipt).
68
+ */
69
+ export declare const mistralTtsResponseFormats: readonly ["mp3", "wav", "pcm"];
70
+ export type MistralTtsResponseFormat = (typeof mistralTtsResponseFormats)[number];
71
+ export declare const mistralTtsIdentity: (modelRevision: string) => SpeechEngineIdentity;
72
+ /**
73
+ * TTS selection capabilities. Usage is metered in characters (price
74
+ * separation from STT audio-seconds). Regions stay unset: the speech API
75
+ * documents no region selector, so an explicit region refuses fail-closed.
76
+ * No implicit voice: the request builder requires an explicit voice_id.
77
+ */
78
+ export declare const mistralTtsCapabilities: (modelRevision: string, language?: string) => SpeechCapabilities;
79
+ export interface MistralTtsRequestShape {
80
+ readonly voiceId: string;
81
+ readonly input: string;
82
+ readonly responseFormat: MistralTtsResponseFormat;
83
+ /**
84
+ * Admitted character ceiling (L8 admission data, passed by the composition).
85
+ * The mesh never sends unbounded input: longer text refuses here.
86
+ */
87
+ readonly maxInputCharacters: number;
88
+ }
89
+ /**
90
+ * Exact `POST /v1/audio/speech` body. No implicit voice and no unbounded
91
+ * input: the composition performs the HTTPS call, the mesh only builds the
92
+ * validated shape. Recorded fixtures only.
93
+ */
94
+ export declare const buildMistralTtsRequest: (request: MistralTtsRequestShape) => Record<string, unknown>;
95
+ /**
96
+ * Admission outcome consumed as data (gateway `admitSpeech` runs at
97
+ * composition, L16/API — mesh never imports the gateway). The session
98
+ * refuses to open without it and never exceeds its ceilings.
99
+ */
100
+ export interface MistralTranscriptionAdmission {
101
+ readonly operationId: string;
102
+ readonly holdRef: string;
103
+ readonly pricingRevision: string;
104
+ readonly ceiling: {
105
+ readonly connectedSeconds: number;
106
+ readonly admittedAudioSeconds: number;
107
+ };
108
+ readonly maxDurationMs: number;
109
+ }
110
+ export interface MistralTranscriptionUsageTotals {
111
+ readonly connectedSeconds: number;
112
+ readonly admittedAudioSeconds: number;
113
+ }
114
+ /**
115
+ * Usage sink shaped for the gateway `recordSpeechUsage` / `settleSpeech`
116
+ * calls the composition layer performs. The adapter only measures seconds;
117
+ * pricing stays pinned at admission.
118
+ */
119
+ export interface MistralTranscriptionUsageSink {
120
+ /**
121
+ * Maps to the L8 `recordSpeechUsage` call: operational evidence on the hold,
122
+ * never a charge. The adapter sends `cumulative` totals under a stable
123
+ * eventId so restarts and retries cannot double-count measured seconds.
124
+ */
125
+ record(update: {
126
+ readonly eventId: string;
127
+ readonly revision: number;
128
+ readonly mode: 'cumulative' | 'incremental';
129
+ readonly usage: Partial<MistralTranscriptionUsageTotals>;
130
+ }): void | Promise<void>;
131
+ /**
132
+ * Maps to the L8 `settleSpeech` call. Usage stays absent unless provider-
133
+ * reported (with a monotonic providerRevision): locally measured seconds
134
+ * are estimates, and a usage covering every priced dimension without a
135
+ * providerRevision is rejected by `settleSpeech` as invalid. The
136
+ * `transcription.done` usage block is opaque (no revision semantics
137
+ * documented) and is never settled.
138
+ */
139
+ settle(request: {
140
+ readonly operationId: string;
141
+ readonly outcome: 'completed' | 'cancelled' | 'failed';
142
+ readonly usage?: MistralTranscriptionUsageTotals;
143
+ readonly providerRevision?: number;
144
+ }): void | Promise<void>;
145
+ }
146
+ /** Injectable provider socket. Tests use recorded scripts; never a live call. */
147
+ export interface MistralTranscriptionSocket {
148
+ send(message: string): void;
149
+ messages(): AsyncIterable<string>;
150
+ close(): Promise<void>;
151
+ }
152
+ export interface MistralTranscriptionConnect {
153
+ (url: string, headers: {
154
+ readonly authorization: string;
155
+ readonly originator: string;
156
+ }): Promise<MistralTranscriptionSocket> | MistralTranscriptionSocket;
157
+ }
158
+ export interface MistralTranscriptionOpenOptions {
159
+ readonly request: SpeechSessionRequest;
160
+ readonly admission: MistralTranscriptionAdmission;
161
+ /** Bearer token, used once for the socket handshake and never logged. */
162
+ readonly bearerToken: string;
163
+ readonly connect: MistralTranscriptionConnect;
164
+ readonly usage: MistralTranscriptionUsageSink;
165
+ readonly originator?: string;
166
+ readonly nowMs?: () => number;
167
+ /** Injectable expiry scheduler (tests advance it manually); defaults to setTimeout. */
168
+ readonly schedule?: (delayMs: number, fn: () => void) => () => void;
169
+ readonly signal?: AbortSignal;
170
+ }
171
+ export declare class MistralTranscriptionSession implements SpeechSession {
172
+ readonly receipt: SpeechSessionReceipt;
173
+ readonly events: AsyncIterable<SpeechEvent>;
174
+ private readonly binding;
175
+ private readonly admission;
176
+ private readonly usage;
177
+ private readonly config;
178
+ /** Bound provider dial (URL + handshake); the session holds no key material. */
179
+ private readonly openProviderStream;
180
+ /** Redaction bound at open; handshake failures never echo the token. */
181
+ private readonly redact;
182
+ private readonly nowMs?;
183
+ private readonly openedAtMs;
184
+ private readonly queue;
185
+ private readonly waiters;
186
+ private sequence;
187
+ private eventId;
188
+ private audioSeconds;
189
+ private settled;
190
+ private outcome;
191
+ private readonly signal?;
192
+ private readonly effectiveMaxMs;
193
+ private abortHandler?;
194
+ private expiryCancel?;
195
+ /** In-flight per-turn pumps; external close() joins them. */
196
+ private readonly pumpPromises;
197
+ /** Sockets still opening (phase 1, not yet current); close() tears them down so the join cannot hang. */
198
+ private readonly opening;
199
+ private current?;
200
+ /** UtteranceIds with an emitted final: commit is a no-op, writes refuse. */
201
+ private readonly finalizedIds;
202
+ private usageRevision;
203
+ constructor(receipt: SpeechSessionReceipt, binding: SpeechBinding, admission: MistralTranscriptionAdmission, usage: MistralTranscriptionUsageSink, config: MistralTranscriptionProfileConfig, openProviderStream: () => Promise<MistralTranscriptionSocket>, redact: (message: string) => string, nowMs: (() => number) | undefined, signal: AbortSignal | undefined, schedule: ((delayMs: number, fn: () => void) => () => void) | undefined, maxDurationMs: number);
204
+ private nextId;
205
+ private emit;
206
+ private clock;
207
+ private stream;
208
+ private pushError;
209
+ private recordUsage;
210
+ private emitEmptyFinal;
211
+ write(frame: SpeechInputFrame): Promise<void>;
212
+ command(command: Parameters<SpeechSession['command']>[0]): Promise<void>;
213
+ /**
214
+ * External close joins the turn pumps after tearing the stream down; a
215
+ * close from inside a pump (runTurn catch) skips the join — awaiting its
216
+ * own pump set would hang (L9 mirrors this with its inPump flag).
217
+ */
218
+ close(fromPump?: boolean): Promise<void>;
219
+ private trackPump;
220
+ private makeStream;
221
+ private openStream;
222
+ private runTurn;
223
+ private onDelta;
224
+ private onDone;
225
+ private onFrame;
226
+ }
227
+ /**
228
+ * Open an admitted transcription session. No provider contact happens here:
229
+ * each client turn opens its own stream lazily at the first write, since
230
+ * `input_audio.end` finishes the provider session. The bearer token travels
231
+ * only into the per-turn socket handshakes; failures never echo it. An
232
+ * aborted signal refuses without connecting.
233
+ */
234
+ export declare const openMistralTranscriptionSession: (config: MistralTranscriptionProfileConfig, options: MistralTranscriptionOpenOptions) => Promise<MistralTranscriptionSession>;
235
+ //# sourceMappingURL=mistral-transcription.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mistral-transcription.d.ts","sourceRoot":"","sources":["../../src/speech/mistral-transcription.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAEV,aAAa,EACb,oBAAoB,EACpB,WAAW,EAEX,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EAGrB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D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W,GAAG,SAAS,EAC/B,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC,GAAG,SAAS,EACvE,aAAa,EAAE,MAAM;IAqCvB,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,IAAI;IAMZ,OAAO,CAAC,KAAK;YAIE,MAAM;IAiBrB,OAAO,CAAC,SAAS;YAQH,WAAW;IAczB,OAAO,CAAC,cAAc;IAuBhB,KAAK,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IA0D7C,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IA8D9E;;;;OAIG;IACG,KAAK,CAAC,QAAQ,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAiC5C,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,UAAU;YA4BJ,UAAU;YA2CV,OAAO;IAyErB,OAAO,CAAC,OAAO;IAwBf,OAAO,CAAC,MAAM;IA2Cd,OAAO,CAAC,OAAO;CAgDhB;AAYD;;;;;;GAMG;AACH,eAAO,MAAM,+BAA+B,WAClC,iCAAiC,WAChC,+BAA+B,KACvC,QAAQ,2BAA2B,CAqDrC,CAAC"}
@@ -0,0 +1,881 @@
1
+ import { isValidSpeechAudioFrame } from './contracts.js';
2
+ export const MISTRAL_TRANSCRIPTION_PROVIDER_ID = 'mistral';
3
+ export const MISTRAL_TRANSCRIPTION_ADAPTER_ID = 'mistral-transcription';
4
+ export const MISTRAL_TRANSCRIPTION_ADAPTER_REVISION = '1';
5
+ export const MISTRAL_TRANSCRIPTION_PLACEMENT = 'cloud-relay';
6
+ export const MISTRAL_TRANSCRIPTION_MODEL_ID = 'voxtral-mini-transcribe-realtime-3';
7
+ export const MISTRAL_TRANSCRIPTION_WS_URL = 'wss://api.mistral.ai/v1/audio/transcriptions/realtime?model=voxtral-mini-transcribe-realtime-3';
8
+ /** The only STT model this adapter serves. The 2602 generation is refused. */
9
+ export const mistralTranscriptionModels = ['voxtral-mini-transcribe-realtime-3'];
10
+ /**
11
+ * Served-model check (P2-2): the realtime docs address the wire alias
12
+ * `voxtral-mini-transcribe-realtime-3`, while the model page names the exact
13
+ * preview `voxtral-mini-transcribe-realtime-3-0`. Both name the 3.0 preview
14
+ * generation; anything else served (2602 or unknown) refuses fail-closed.
15
+ */
16
+ export const mistralTranscriptionServedModels = [
17
+ 'voxtral-mini-transcribe-realtime-3',
18
+ 'voxtral-mini-transcribe-realtime-3-0',
19
+ ];
20
+ /**
21
+ * Trade speed for accuracy per session. Bounds follow the docs: 80 to 1200,
22
+ * or exactly 2400. No implicit default: the profile pins one.
23
+ */
24
+ export const MISTRAL_TRANSCRIPTION_DELAY_MIN_MS = 80;
25
+ export const MISTRAL_TRANSCRIPTION_DELAY_MAX_MS = 1200;
26
+ export const MISTRAL_TRANSCRIPTION_DELAY_SLOW_MS = 2400;
27
+ const TRANSCRIPTION_FORMAT = { codec: 'pcm16-le', sampleRateHz: 24000, channels: 1 };
28
+ export const mistralTranscriptionIdentity = (config) => ({
29
+ providerId: MISTRAL_TRANSCRIPTION_PROVIDER_ID,
30
+ modelId: config.modelId,
31
+ modelRevision: config.modelRevision,
32
+ adapterId: MISTRAL_TRANSCRIPTION_ADAPTER_ID,
33
+ adapterRevision: MISTRAL_TRANSCRIPTION_ADAPTER_REVISION,
34
+ placement: MISTRAL_TRANSCRIPTION_PLACEMENT,
35
+ });
36
+ const isNonEmptyString = (value) => typeof value === 'string' && value.length > 0;
37
+ const isDelayMs = (value) => typeof value === 'number' && Number.isSafeInteger(value)
38
+ && ((value >= MISTRAL_TRANSCRIPTION_DELAY_MIN_MS
39
+ && value <= MISTRAL_TRANSCRIPTION_DELAY_MAX_MS) || value === MISTRAL_TRANSCRIPTION_DELAY_SLOW_MS);
40
+ const isLanguageCode = (value) => typeof value === 'string' && /^[a-z]{2}$/u.test(value);
41
+ /** Per-profile STT capabilities. TTS is unsupported: synthesis is selected separately. */
42
+ export const mistralTranscriptionCapabilities = (config) => {
43
+ if (!mistralTranscriptionModels.includes(config.modelId)) {
44
+ throw new MistralTranscriptionError('unknown-model', `unknown Mistral transcription model: ${String(config.modelId)} (2602 models are not served here)`);
45
+ }
46
+ if (!isNonEmptyString(config.modelRevision)) {
47
+ throw new MistralTranscriptionError('invalid-config', 'modelRevision must be a pinned non-empty revision');
48
+ }
49
+ if (!isDelayMs(config.targetStreamingDelayMs)) {
50
+ throw new MistralTranscriptionError('invalid-config', `targetStreamingDelayMs must be 80-1200 or exactly 2400, got ${String(config.targetStreamingDelayMs)}`);
51
+ }
52
+ if (config.language !== undefined && !isLanguageCode(config.language)) {
53
+ throw new MistralTranscriptionError('invalid-config', `language must be a two-letter ISO 639-1 code, got ${String(config.language)}`);
54
+ }
55
+ if (config.turnDetection !== undefined && config.turnDetection !== 'client') {
56
+ throw new MistralTranscriptionError('invalid-config', 'only client turn detection is supported for this profile');
57
+ }
58
+ return {
59
+ binding: mistralTranscriptionIdentity(config),
60
+ ...(config.language ? { languages: [config.language] } : {}),
61
+ features: {
62
+ streamingStt: 'supported',
63
+ partialTranscript: 'supported',
64
+ nativeDuplex: 'unsupported',
65
+ tts: 'unsupported',
66
+ serverVad: 'unsupported',
67
+ clientVad: 'supported',
68
+ manualCommit: 'supported',
69
+ playoutTruncate: 'unsupported',
70
+ toolCancellation: 'unsupported',
71
+ resume: 'unknown',
72
+ },
73
+ inputFormats: [TRANSCRIPTION_FORMAT],
74
+ outputFormats: [],
75
+ usageUnits: ['audio-seconds', 'session-seconds'],
76
+ };
77
+ };
78
+ /**
79
+ * Exact `session.update` body. `turn_detection` is omitted (server turn
80
+ * detection unsupported); the provider fixes settings at the first audio.
81
+ */
82
+ export const buildMistralSessionUpdate = (config) => {
83
+ // Reuse the capability gate so the wire can never carry an unvalidated profile.
84
+ mistralTranscriptionCapabilities(config);
85
+ return {
86
+ type: 'session.update',
87
+ session: {
88
+ audio_format: { encoding: 'pcm_s16le', sample_rate: TRANSCRIPTION_FORMAT.sampleRateHz },
89
+ target_streaming_delay_ms: config.targetStreamingDelayMs,
90
+ ...(config.language ? { language: config.language } : {}),
91
+ },
92
+ };
93
+ };
94
+ export class MistralTranscriptionError extends Error {
95
+ code;
96
+ constructor(code, message) {
97
+ super(message);
98
+ this.name = 'MistralTranscriptionError';
99
+ this.code = code;
100
+ }
101
+ }
102
+ /** Portable base64 for PCM payloads (no node:buffer; mesh stays runtime-agnostic). */
103
+ const base64Of = (payload) => {
104
+ const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
105
+ let out = '';
106
+ for (let i = 0; i < payload.length; i += 3) {
107
+ const a = payload[i] ?? 0;
108
+ const b = payload[i + 1] ?? 0;
109
+ const c = payload[i + 2] ?? 0;
110
+ const triple = (a << 16) | (b << 8) | c;
111
+ out += alphabet[(triple >> 18) & 63] + alphabet[(triple >> 12) & 63]
112
+ + (i + 1 < payload.length ? alphabet[(triple >> 6) & 63] : '=')
113
+ + (i + 2 < payload.length ? alphabet[triple & 63] : '=');
114
+ }
115
+ return out;
116
+ };
117
+ // ---------------------------------------------------------------------------
118
+ // TTS binding/registry (selection data only; no synthesis transport in mesh)
119
+ // ---------------------------------------------------------------------------
120
+ export const MISTRAL_TTS_PROVIDER_ID = 'mistral';
121
+ export const MISTRAL_TTS_ADAPTER_ID = 'mistral-tts';
122
+ export const MISTRAL_TTS_ADAPTER_REVISION = '1';
123
+ export const MISTRAL_TTS_PLACEMENT = 'cloud-relay';
124
+ export const MISTRAL_TTS_MODEL_ID = 'voxtral-mini-tts-3-0';
125
+ export const MISTRAL_TTS_ENDPOINT = 'https://api.mistral.ai/v1/audio/speech';
126
+ /**
127
+ * Pinned Voxtral 3 preset voices (docs voice library). The mesh pins the
128
+ * selection; voice creation/management stays a console/API operation.
129
+ */
130
+ export const mistralTtsVoices = [
131
+ 'voice_478', 'voice_447', 'voice_485', 'voice_3150',
132
+ 'voice_1787', 'voice_1786', 'voice_1788', 'voice_590', 'voice_591', 'voice_3149', 'voice_3147',
133
+ 'voice_592', 'voice_3137', 'voice_589', 'voice_3141',
134
+ 'voice_483', 'voice_481', 'voice_482', 'voice_480', 'voice_479', 'voice_3143',
135
+ 'voice_3139', 'voice_3153', 'voice_3146', 'voice_3133', 'voice_3136', 'voice_3135',
136
+ 'voice_3145', 'voice_3134', 'voice_3154', 'voice_3155', 'voice_3132', 'voice_3138',
137
+ 'voice_3140', 'voice_3144', 'voice_3142',
138
+ ];
139
+ /** Languages covered by the pinned preset voices (voice implies language). */
140
+ export const mistralTtsLanguages = [
141
+ 'en', 'fr', 'es', 'de', 'it', 'pt', 'ar', 'ca', 'hi', 'hu',
142
+ 'ja', 'ko', 'nl', 'no', 'pl', 'ro', 'ru', 'tr', 'uk', 'vi', 'zh',
143
+ ];
144
+ /**
145
+ * Response formats the mesh can build. `pcm` covers the advertised pcm16-le
146
+ * output; the exact pcm sample rate is unverified (see the L13 receipt).
147
+ */
148
+ export const mistralTtsResponseFormats = ['mp3', 'wav', 'pcm'];
149
+ export const mistralTtsIdentity = (modelRevision) => {
150
+ if (!isNonEmptyString(modelRevision)) {
151
+ throw new MistralTranscriptionError('invalid-config', 'TTS modelRevision must be a pinned non-empty revision');
152
+ }
153
+ return {
154
+ providerId: MISTRAL_TTS_PROVIDER_ID,
155
+ modelId: MISTRAL_TTS_MODEL_ID,
156
+ modelRevision,
157
+ adapterId: MISTRAL_TTS_ADAPTER_ID,
158
+ adapterRevision: MISTRAL_TTS_ADAPTER_REVISION,
159
+ placement: MISTRAL_TTS_PLACEMENT,
160
+ };
161
+ };
162
+ /**
163
+ * TTS selection capabilities. Usage is metered in characters (price
164
+ * separation from STT audio-seconds). Regions stay unset: the speech API
165
+ * documents no region selector, so an explicit region refuses fail-closed.
166
+ * No implicit voice: the request builder requires an explicit voice_id.
167
+ */
168
+ export const mistralTtsCapabilities = (modelRevision, language) => {
169
+ if (language !== undefined && !isLanguageCode(language)) {
170
+ throw new MistralTranscriptionError('invalid-config', `language must be a two-letter ISO 639-1 code, got ${String(language)}`);
171
+ }
172
+ return {
173
+ binding: mistralTtsIdentity(modelRevision),
174
+ ...(language ? { languages: [language] } : { languages: [...mistralTtsLanguages] }),
175
+ voices: [...mistralTtsVoices],
176
+ features: {
177
+ streamingStt: 'unsupported',
178
+ partialTranscript: 'unsupported',
179
+ nativeDuplex: 'unsupported',
180
+ tts: 'supported',
181
+ serverVad: 'unsupported',
182
+ clientVad: 'unsupported',
183
+ manualCommit: 'unsupported',
184
+ playoutTruncate: 'unsupported',
185
+ toolCancellation: 'unsupported',
186
+ resume: 'unknown',
187
+ },
188
+ inputFormats: [],
189
+ outputFormats: [{ codec: 'pcm16-le', sampleRateHz: 24000, channels: 1 }],
190
+ usageUnits: ['characters'],
191
+ };
192
+ };
193
+ /**
194
+ * Exact `POST /v1/audio/speech` body. No implicit voice and no unbounded
195
+ * input: the composition performs the HTTPS call, the mesh only builds the
196
+ * validated shape. Recorded fixtures only.
197
+ */
198
+ export const buildMistralTtsRequest = (request) => {
199
+ if (!mistralTtsVoices.includes(request.voiceId)) {
200
+ throw new MistralTranscriptionError('invalid-config', `unknown Mistral TTS voice: ${request.voiceId}`);
201
+ }
202
+ if (!isNonEmptyString(request.input)) {
203
+ throw new MistralTranscriptionError('invalid-config', 'TTS input must be non-empty text');
204
+ }
205
+ if (!(Number.isSafeInteger(request.maxInputCharacters) && request.maxInputCharacters > 0)) {
206
+ throw new MistralTranscriptionError('invalid-config', 'maxInputCharacters must be a positive ceiling');
207
+ }
208
+ if (request.input.length > request.maxInputCharacters) {
209
+ throw new MistralTranscriptionError('invalid-config', `TTS input exceeds the admitted ${request.maxInputCharacters} characters`);
210
+ }
211
+ if (!mistralTtsResponseFormats.includes(request.responseFormat)) {
212
+ throw new MistralTranscriptionError('invalid-config', `responseFormat must be one of ${mistralTtsResponseFormats.join(', ')}`);
213
+ }
214
+ return {
215
+ model: MISTRAL_TTS_MODEL_ID,
216
+ input: request.input,
217
+ voice_id: request.voiceId,
218
+ response_format: request.responseFormat,
219
+ };
220
+ };
221
+ const assertAdmission = (admission) => {
222
+ if (!admission || !isNonEmptyString(admission.operationId) || !isNonEmptyString(admission.holdRef)
223
+ || !isNonEmptyString(admission.pricingRevision)
224
+ || !(admission.ceiling?.connectedSeconds > 0) || !(admission.ceiling?.admittedAudioSeconds > 0)
225
+ || !(admission.maxDurationMs > 0)) {
226
+ throw new MistralTranscriptionError('admission', 'a valid admission (operation, hold, ceilings) is required');
227
+ }
228
+ };
229
+ const monotonicNow = (nowMs) => {
230
+ const now = (nowMs ?? Date.now)();
231
+ if (!Number.isFinite(now) || now < 0)
232
+ throw new MistralTranscriptionError('invalid-config', 'clock must be finite');
233
+ return now;
234
+ };
235
+ const errorEvent = (base, eventId, sequence, reason, retryable) => ({
236
+ schemaVersion: 1,
237
+ speechSessionId: base.speechSessionId,
238
+ connectionEpoch: base.connectionEpoch,
239
+ eventId,
240
+ sequence,
241
+ clock: base.clock,
242
+ type: 'error',
243
+ reason,
244
+ retryable,
245
+ });
246
+ export class MistralTranscriptionSession {
247
+ receipt;
248
+ events;
249
+ binding;
250
+ admission;
251
+ usage;
252
+ config;
253
+ /** Bound provider dial (URL + handshake); the session holds no key material. */
254
+ openProviderStream;
255
+ /** Redaction bound at open; handshake failures never echo the token. */
256
+ redact;
257
+ nowMs;
258
+ openedAtMs;
259
+ queue = [];
260
+ waiters = [];
261
+ sequence = 0;
262
+ eventId = 0;
263
+ audioSeconds = 0;
264
+ settled = false;
265
+ outcome = 'completed';
266
+ signal;
267
+ effectiveMaxMs;
268
+ abortHandler;
269
+ expiryCancel;
270
+ /** In-flight per-turn pumps; external close() joins them. */
271
+ pumpPromises = new Set();
272
+ /** Sockets still opening (phase 1, not yet current); close() tears them down so the join cannot hang. */
273
+ opening = new Set();
274
+ current;
275
+ /** UtteranceIds with an emitted final: commit is a no-op, writes refuse. */
276
+ finalizedIds = new Set();
277
+ usageRevision = 0;
278
+ constructor(receipt, binding, admission, usage, config, openProviderStream, redact, nowMs, signal, schedule, maxDurationMs) {
279
+ this.receipt = receipt;
280
+ this.binding = binding;
281
+ this.admission = admission;
282
+ this.usage = usage;
283
+ this.config = config;
284
+ this.openProviderStream = openProviderStream;
285
+ this.redact = redact;
286
+ this.nowMs = nowMs;
287
+ this.signal = signal;
288
+ this.openedAtMs = monotonicNow(nowMs);
289
+ this.effectiveMaxMs = Math.min(admission.maxDurationMs, maxDurationMs);
290
+ this.events = this.stream();
291
+ const arm = schedule ?? ((delayMs, fn) => {
292
+ const timer = setTimeout(fn, delayMs);
293
+ return () => clearTimeout(timer);
294
+ });
295
+ this.expiryCancel = arm(this.effectiveMaxMs, () => {
296
+ this.pushError('ceiling', false);
297
+ this.outcome = 'cancelled';
298
+ void this.close();
299
+ });
300
+ if (signal) {
301
+ if (signal.aborted) {
302
+ this.outcome = 'cancelled';
303
+ void this.close();
304
+ }
305
+ else {
306
+ this.abortHandler = () => {
307
+ this.outcome = 'cancelled';
308
+ void this.close();
309
+ };
310
+ signal.addEventListener('abort', this.abortHandler, { once: true });
311
+ }
312
+ }
313
+ }
314
+ nextId() {
315
+ this.eventId += 1;
316
+ return `evt-${this.eventId}`;
317
+ }
318
+ emit(event) {
319
+ this.queue.push(event);
320
+ const waiter = this.waiters.shift();
321
+ if (waiter)
322
+ waiter();
323
+ }
324
+ clock() {
325
+ return { id: 'mistral-transcription', monotonicMs: monotonicNow(this.nowMs) };
326
+ }
327
+ async *stream() {
328
+ let index = 0;
329
+ for (;;) {
330
+ while (index >= this.queue.length) {
331
+ if (this.settled)
332
+ return;
333
+ await new Promise((resolve) => this.waiters.push(resolve));
334
+ }
335
+ const event = this.queue[index++];
336
+ // Bound the queue for long sessions: consumed events are dropped.
337
+ if (index > 1024) {
338
+ this.queue.splice(0, index);
339
+ index = 0;
340
+ }
341
+ yield event;
342
+ }
343
+ }
344
+ pushError(reason, retryable) {
345
+ this.sequence += 1;
346
+ this.emit(errorEvent({ speechSessionId: this.receipt.speechSessionId, connectionEpoch: this.receipt.connectionEpoch, clock: this.clock() }, this.nextId(), this.sequence, reason, retryable));
347
+ }
348
+ async recordUsage() {
349
+ // Cumulative operational totals (L8 sums incremental events per eventId,
350
+ // so a per-turn total would double-count); the composition settles from these.
351
+ await this.usage.record({
352
+ eventId: `${this.admission.operationId}:audio`,
353
+ revision: this.usageRevision++,
354
+ mode: 'cumulative',
355
+ usage: {
356
+ admittedAudioSeconds: this.audioSeconds,
357
+ connectedSeconds: Math.max(0, (monotonicNow(this.nowMs) - this.openedAtMs) / 1000),
358
+ },
359
+ });
360
+ }
361
+ emitEmptyFinal(utteranceId) {
362
+ // A commit with no audio since the last turn boundary: the provider
363
+ // would confirm an empty transcript, so the final carries no window.
364
+ this.finalizedIds.add(utteranceId);
365
+ this.sequence += 1;
366
+ const final = {
367
+ schemaVersion: 1,
368
+ speechSessionId: this.receipt.speechSessionId,
369
+ connectionEpoch: this.receipt.connectionEpoch,
370
+ eventId: this.nextId(),
371
+ sequence: this.sequence,
372
+ clock: this.clock(),
373
+ type: 'transcript.final',
374
+ binding: this.binding,
375
+ utteranceId,
376
+ revision: 1,
377
+ text: '',
378
+ language: this.config.language ?? 'und',
379
+ audioInterval: { startMs: 0, endMs: 0 },
380
+ };
381
+ this.emit(final);
382
+ }
383
+ async write(frame) {
384
+ if (this.settled)
385
+ throw new MistralTranscriptionError('closed', 'session is closed');
386
+ if (!isValidSpeechAudioFrame(frame) || frame.type !== 'audio.input') {
387
+ throw new MistralTranscriptionError('invalid-format', 'audio.input frame failed validation');
388
+ }
389
+ if (frame.format.codec !== TRANSCRIPTION_FORMAT.codec
390
+ || frame.format.sampleRateHz !== TRANSCRIPTION_FORMAT.sampleRateHz
391
+ || frame.format.channels !== TRANSCRIPTION_FORMAT.channels) {
392
+ throw new MistralTranscriptionError('invalid-format', 'only pcm16-le 24kHz mono is admitted');
393
+ }
394
+ // Refused audio is never metered: the session bound and the utterance
395
+ // checks run before the reservation, and a failed stream open rolls the
396
+ // reservation back.
397
+ if (monotonicNow(this.nowMs) - this.openedAtMs >= this.effectiveMaxMs) {
398
+ throw new MistralTranscriptionError('ceiling', 'session duration bound reached');
399
+ }
400
+ const open = this.current;
401
+ if (open && !open.abandoned && !open.donePending && open.utteranceId !== frame.utteranceId) {
402
+ throw new MistralTranscriptionError('invalid-format', 'new utteranceId requires a committed or cleared turn');
403
+ }
404
+ // A late capture frame racing a pending commit must not open a second
405
+ // provider stream for the same id: the commit owns the turn until done.
406
+ if (open && !open.abandoned && open.donePending && open.utteranceId === frame.utteranceId) {
407
+ throw new MistralTranscriptionError('invalid-format', 'turn already committed');
408
+ }
409
+ if (this.finalizedIds.has(frame.utteranceId)) {
410
+ throw new MistralTranscriptionError('invalid-format', 'utteranceId already finalized');
411
+ }
412
+ const seconds = frame.sampleCount / frame.format.sampleRateHz;
413
+ if (!(seconds > 0) || this.audioSeconds + seconds > this.admission.ceiling.admittedAudioSeconds) {
414
+ throw new MistralTranscriptionError('ceiling', 'admitted audio ceiling reached');
415
+ }
416
+ this.audioSeconds += seconds;
417
+ let stream = this.current;
418
+ if (!stream || stream.abandoned || stream.donePending) {
419
+ try {
420
+ stream = await this.openStream(frame.utteranceId, frame.capturedAtMs);
421
+ }
422
+ catch (error) {
423
+ this.audioSeconds -= seconds;
424
+ throw error;
425
+ }
426
+ if (this.settled) {
427
+ stream.abandoned = true;
428
+ this.audioSeconds -= seconds;
429
+ await stream.socket.close().catch(() => undefined);
430
+ throw new MistralTranscriptionError('closed', 'session is closed');
431
+ }
432
+ }
433
+ // Capture-domain turn window for the final's audioInterval. The window
434
+ // lives on the per-turn stream, so a later turn can never stretch it.
435
+ if (Number.isFinite(frame.capturedAtMs) && frame.capturedAtMs >= 0) {
436
+ stream.audioEndMs = frame.capturedAtMs + (frame.sampleCount / frame.format.sampleRateHz) * 1000;
437
+ }
438
+ // The payload is encoded and released here; the adapter retains only counters.
439
+ const audio = base64Of(frame.payload);
440
+ stream.socket.send(JSON.stringify({ type: 'input_audio.append', audio }));
441
+ }
442
+ async command(command) {
443
+ if (this.settled && command.type !== 'session.close') {
444
+ throw new MistralTranscriptionError('closed', 'session is closed');
445
+ }
446
+ switch (command.type) {
447
+ case 'input.commit': {
448
+ if (monotonicNow(this.nowMs) - this.openedAtMs >= this.effectiveMaxMs) {
449
+ throw new MistralTranscriptionError('ceiling', 'session duration bound reached');
450
+ }
451
+ // Re-committing a finalized turn is an idempotent no-op: no second
452
+ // final, no usage record. The record stays single per utteranceId.
453
+ if (this.finalizedIds.has(command.utteranceId))
454
+ return;
455
+ const stream = this.current;
456
+ if (!stream || stream.abandoned) {
457
+ this.emitEmptyFinal(command.utteranceId);
458
+ await this.recordUsage();
459
+ return;
460
+ }
461
+ // A commit racing its own pending commit throws instead of joining
462
+ // it: after done the same call is an idempotent no-op, but while the
463
+ // turn is still open the caller holds the wrong turn state, so the
464
+ // refusal surfaces the race instead of silently merging two commits.
465
+ if (stream.donePending) {
466
+ throw new MistralTranscriptionError('invalid-format', 'turn already committed');
467
+ }
468
+ if (stream.utteranceId !== command.utteranceId) {
469
+ throw new MistralTranscriptionError('invalid-format', 'commit for a turn with no open audio');
470
+ }
471
+ stream.donePending = true;
472
+ stream.socket.send(JSON.stringify({ type: 'input_audio.end' }));
473
+ await this.recordUsage();
474
+ // The final was emitted by onDone before this resolves; an
475
+ // abandonment (clear/close/error) resolves with no final.
476
+ await stream.donePromise;
477
+ return;
478
+ }
479
+ case 'input.clear': {
480
+ // Mistral exposes no buffer clear: abandon the open provider stream
481
+ // so late frames cannot resurrect the turn, and reopen lazily.
482
+ const stream = this.current;
483
+ if (stream && !stream.abandoned && stream.utteranceId === command.utteranceId) {
484
+ stream.abandoned = true;
485
+ stream.resolveDone(undefined);
486
+ if (this.current === stream)
487
+ this.current = undefined;
488
+ await stream.socket.close();
489
+ }
490
+ return;
491
+ }
492
+ case 'session.mute': {
493
+ // Mute is enforced by capture (no audio written); the cloud adapter holds no gate.
494
+ return;
495
+ }
496
+ case 'session.close': {
497
+ await this.close();
498
+ return;
499
+ }
500
+ default: {
501
+ throw new MistralTranscriptionError('unsupported-command', 'not applicable to STT-only transcription');
502
+ }
503
+ }
504
+ }
505
+ /**
506
+ * External close joins the turn pumps after tearing the stream down; a
507
+ * close from inside a pump (runTurn catch) skips the join — awaiting its
508
+ * own pump set would hang (L9 mirrors this with its inPump flag).
509
+ */
510
+ async close(fromPump = false) {
511
+ if (this.settled)
512
+ return;
513
+ this.settled = true;
514
+ this.expiryCancel?.();
515
+ this.expiryCancel = undefined;
516
+ if (this.signal && this.abortHandler)
517
+ this.signal.removeEventListener('abort', this.abortHandler);
518
+ const stream = this.current;
519
+ this.current = undefined;
520
+ if (stream && !stream.abandoned) {
521
+ stream.abandoned = true;
522
+ stream.resolveDone(undefined);
523
+ }
524
+ try {
525
+ if (stream)
526
+ await stream.socket.close();
527
+ // A stream still opening is not current yet: close its socket too, so
528
+ // its phase-1 pump ends and the join below cannot wait on the provider.
529
+ for (const opening of [...this.opening]) {
530
+ await opening.close().catch(() => undefined);
531
+ }
532
+ }
533
+ finally {
534
+ // No usage attached: locally measured seconds are operational estimates,
535
+ // not provider-attested finals. The composition settles from the recorded
536
+ // cumulative totals (or provider-reported usage with a revision), so an
537
+ // L8 `settleSpeech` missing-dimension estimate stays valid.
538
+ await this.usage.settle({
539
+ operationId: this.admission.operationId,
540
+ outcome: this.outcome,
541
+ });
542
+ while (this.waiters.length > 0)
543
+ this.waiters.shift()?.();
544
+ if (!fromPump)
545
+ await Promise.allSettled([...this.pumpPromises]);
546
+ }
547
+ }
548
+ trackPump(promise) {
549
+ this.pumpPromises.add(promise);
550
+ void promise.finally(() => {
551
+ this.pumpPromises.delete(promise);
552
+ });
553
+ }
554
+ makeStream(socket, utteranceId, audioStartMs, resolveReady, rejectReady) {
555
+ let resolveDone;
556
+ const donePromise = new Promise((resolve) => {
557
+ resolveDone = resolve;
558
+ });
559
+ const stream = {
560
+ socket,
561
+ utteranceId,
562
+ audioStartMs,
563
+ audioEndMs: audioStartMs,
564
+ text: '',
565
+ revision: 0,
566
+ donePending: false,
567
+ abandoned: false,
568
+ doneReceived: false,
569
+ resolveDone,
570
+ donePromise,
571
+ };
572
+ this.trackPump(this.runTurn(stream, resolveReady, rejectReady));
573
+ return stream;
574
+ }
575
+ async openStream(utteranceId, audioStartMs) {
576
+ let socket;
577
+ try {
578
+ socket = await this.openProviderStream();
579
+ }
580
+ catch (error) {
581
+ const detail = error instanceof Error ? error.message : 'unknown';
582
+ throw new MistralTranscriptionError('transport', `provider connect failed: ${this.redact(detail)}`);
583
+ }
584
+ let resolveReady;
585
+ let rejectReady;
586
+ // The pump resolves once `session.created` arrives; a close ends the
587
+ // socket iteration, so this never awaits past the session teardown.
588
+ const readyPromise = new Promise((resolve, reject) => {
589
+ resolveReady = resolve;
590
+ rejectReady = reject;
591
+ });
592
+ const stream = this.makeStream(socket, utteranceId, audioStartMs, resolveReady, rejectReady);
593
+ this.opening.add(socket);
594
+ try {
595
+ // The update leaves only after the provider created the session.
596
+ await readyPromise;
597
+ socket.send(JSON.stringify(buildMistralSessionUpdate(this.config)));
598
+ }
599
+ catch (error) {
600
+ stream.abandoned = true;
601
+ await socket.close().catch(() => undefined);
602
+ if (error instanceof MistralTranscriptionError)
603
+ throw error;
604
+ const detail = error instanceof Error ? error.message : 'unknown';
605
+ throw new MistralTranscriptionError('transport', `session update failed: ${this.redact(detail)}`);
606
+ }
607
+ finally {
608
+ this.opening.delete(socket);
609
+ }
610
+ const open = this.current;
611
+ if (open && open !== stream && !open.abandoned && !open.donePending) {
612
+ // A concurrent write opened a usable stream first: drop this one.
613
+ stream.abandoned = true;
614
+ stream.resolveDone(undefined);
615
+ await socket.close().catch(() => undefined);
616
+ return open;
617
+ }
618
+ this.current = stream;
619
+ return stream;
620
+ }
621
+ async runTurn(stream, resolveReady, rejectReady) {
622
+ try {
623
+ const iterator = stream.socket.messages()[Symbol.asyncIterator]();
624
+ // Phase 1: the provider opens with `session.created`; anything else
625
+ // first is a protocol violation and the stream never becomes current.
626
+ for (;;) {
627
+ const next = await iterator.next();
628
+ if (next.done) {
629
+ rejectReady(new MistralTranscriptionError('transport', 'provider closed before session.created'));
630
+ return;
631
+ }
632
+ let first;
633
+ try {
634
+ first = JSON.parse(next.value);
635
+ }
636
+ catch {
637
+ rejectReady(new MistralTranscriptionError('transport', 'provider sent a non-JSON frame'));
638
+ return;
639
+ }
640
+ if (typeof first === 'object' && first !== null
641
+ && first.type === 'session.created') {
642
+ const session = first.session;
643
+ const served = typeof session === 'object' && session !== null
644
+ && 'model' in session
645
+ ? session.model
646
+ : undefined;
647
+ if (served !== undefined
648
+ && !(typeof served === 'string'
649
+ && mistralTranscriptionServedModels.includes(served))) {
650
+ rejectReady(new MistralTranscriptionError('transport', `refused served model: ${String(served)}`));
651
+ return;
652
+ }
653
+ resolveReady();
654
+ break;
655
+ }
656
+ rejectReady(new MistralTranscriptionError('transport', 'expected session.created first'));
657
+ return;
658
+ }
659
+ // Phase 2: turn frames until the done, an abandonment, or the close.
660
+ // A provider close without `done` ends the pending commit with a
661
+ // transport error instead of hanging it until the session expiry.
662
+ for (;;) {
663
+ const next = await iterator.next();
664
+ if (next.done) {
665
+ if (!this.settled && !stream.abandoned && !stream.doneReceived) {
666
+ stream.abandoned = true;
667
+ stream.resolveDone(undefined);
668
+ if (this.current === stream)
669
+ this.current = undefined;
670
+ this.pushError('transport', true);
671
+ }
672
+ return;
673
+ }
674
+ if (this.settled || stream.abandoned)
675
+ return;
676
+ this.onFrame(stream, next.value);
677
+ if (stream.doneReceived) {
678
+ await stream.socket.close().catch(() => undefined);
679
+ return;
680
+ }
681
+ }
682
+ }
683
+ catch (error) {
684
+ rejectReady(error);
685
+ if (!this.settled && !stream.abandoned) {
686
+ this.outcome = 'failed';
687
+ this.pushError('transport', false);
688
+ void this.close(true);
689
+ }
690
+ }
691
+ }
692
+ onDelta(stream, text) {
693
+ if (stream.abandoned || stream.doneReceived)
694
+ return;
695
+ // Deltas are final on arrival (no correction pass): append only.
696
+ const start = stream.text.length;
697
+ stream.text += text;
698
+ stream.revision += 1;
699
+ this.sequence += 1;
700
+ const partial = {
701
+ schemaVersion: 1,
702
+ speechSessionId: this.receipt.speechSessionId,
703
+ connectionEpoch: this.receipt.connectionEpoch,
704
+ eventId: this.nextId(),
705
+ sequence: this.sequence,
706
+ clock: this.clock(),
707
+ type: 'transcript.partial',
708
+ binding: this.binding,
709
+ utteranceId: stream.utteranceId,
710
+ revision: stream.revision,
711
+ replaces: { start, end: start },
712
+ text,
713
+ };
714
+ this.emit(partial);
715
+ }
716
+ onDone(stream, text, language) {
717
+ if (stream.abandoned)
718
+ return;
719
+ // A done for an id another stream already finalized (a provider end
720
+ // racing a clear) must never emit a second final: drop the stream.
721
+ if (this.finalizedIds.has(stream.utteranceId) && !stream.doneReceived) {
722
+ stream.abandoned = true;
723
+ stream.resolveDone(undefined);
724
+ if (this.current === stream)
725
+ this.current = undefined;
726
+ void stream.socket.close().catch(() => undefined);
727
+ return;
728
+ }
729
+ this.finalizedIds.add(stream.utteranceId);
730
+ if (stream.doneReceived) {
731
+ this.pushError('invalid-format', true);
732
+ return;
733
+ }
734
+ stream.doneReceived = true;
735
+ stream.revision += 1;
736
+ this.sequence += 1;
737
+ let resolved = this.config.language ?? 'und';
738
+ if (!this.config.language && typeof language === 'string' && language)
739
+ resolved = language;
740
+ const final = {
741
+ schemaVersion: 1,
742
+ speechSessionId: this.receipt.speechSessionId,
743
+ connectionEpoch: this.receipt.connectionEpoch,
744
+ eventId: this.nextId(),
745
+ sequence: this.sequence,
746
+ clock: this.clock(),
747
+ type: 'transcript.final',
748
+ binding: this.binding,
749
+ utteranceId: stream.utteranceId,
750
+ revision: stream.revision,
751
+ text,
752
+ language: resolved,
753
+ audioInterval: { startMs: stream.audioStartMs, endMs: stream.audioEndMs },
754
+ };
755
+ if (this.current === stream)
756
+ this.current = undefined;
757
+ stream.resolveDone(text);
758
+ // The turn stream served its single turn; teardown is best-effort.
759
+ void stream.socket.close().catch(() => undefined);
760
+ this.emit(final);
761
+ }
762
+ onFrame(stream, raw) {
763
+ if (this.settled || stream.abandoned)
764
+ return;
765
+ let frame;
766
+ try {
767
+ frame = JSON.parse(raw);
768
+ }
769
+ catch {
770
+ this.pushError('invalid-format', true);
771
+ return;
772
+ }
773
+ if (!frame || typeof frame !== 'object') {
774
+ this.pushError('invalid-format', true);
775
+ return;
776
+ }
777
+ const record = frame;
778
+ if (record.type === 'session.updated' || record.type === 'session.created'
779
+ || record.type === 'transcription.segment'
780
+ || (typeof record.type === 'string' && record.type.startsWith('turn.'))) {
781
+ // Acks, diarized segments (diarize stays off) and turn events (server
782
+ // turn detection stays off): tolerated for forward compatibility.
783
+ return;
784
+ }
785
+ if (record.type === 'transcription.text.delta') {
786
+ if (typeof record.text !== 'string') {
787
+ this.pushError('invalid-format', true);
788
+ return;
789
+ }
790
+ this.onDelta(stream, record.text);
791
+ return;
792
+ }
793
+ if (record.type === 'transcription.done') {
794
+ if (typeof record.text !== 'string') {
795
+ this.pushError('invalid-format', true);
796
+ return;
797
+ }
798
+ this.onDone(stream, record.text, record.language);
799
+ return;
800
+ }
801
+ if (record.type === 'error') {
802
+ // The turn is over: drop it so a late done cannot resurrect it.
803
+ stream.abandoned = true;
804
+ stream.resolveDone(undefined);
805
+ if (this.current === stream)
806
+ this.current = undefined;
807
+ void stream.socket.close().catch(() => undefined);
808
+ this.pushError('provider-error', false);
809
+ return;
810
+ }
811
+ // Unknown provider event types are tolerated (forward compatibility); the stream continues.
812
+ }
813
+ }
814
+ /**
815
+ * Redact the bearer token from any message before it reaches an error.
816
+ * A provider that echoes the Authorization header must never leak it through
817
+ * session events or thrown errors.
818
+ */
819
+ const redactBearer = (message, token) => {
820
+ if (!token)
821
+ return message;
822
+ return message.split(`Bearer ${token}`).join('Bearer [REDACTED]').split(token).join('[REDACTED]');
823
+ };
824
+ /**
825
+ * Open an admitted transcription session. No provider contact happens here:
826
+ * each client turn opens its own stream lazily at the first write, since
827
+ * `input_audio.end` finishes the provider session. The bearer token travels
828
+ * only into the per-turn socket handshakes; failures never echo it. An
829
+ * aborted signal refuses without connecting.
830
+ */
831
+ export const openMistralTranscriptionSession = async (config, options) => {
832
+ const capabilities = mistralTranscriptionCapabilities(config);
833
+ const binding = {
834
+ ...mistralTranscriptionIdentity(config),
835
+ ...(config.language ? { language: config.language } : {}),
836
+ ...(config.accountRef ? { accountRef: config.accountRef } : {}),
837
+ };
838
+ assertAdmission(options.admission);
839
+ if (!isNonEmptyString(options.bearerToken)) {
840
+ throw new MistralTranscriptionError('invalid-config', 'bearer token is required');
841
+ }
842
+ const { request } = options;
843
+ // TTS bindings are refused here (fail-closed): synthesis is selected
844
+ // separately on the Mistral TTS binding, never through this adapter.
845
+ if (request.pipeline !== 'chained' || request.bindings.stt === undefined
846
+ || request.bindings.stt.providerId !== binding.providerId
847
+ || request.bindings.stt.modelId !== binding.modelId
848
+ || request.bindings.tts !== undefined) {
849
+ throw new MistralTranscriptionError('invalid-config', 'STT-only chained binding for this profile is required');
850
+ }
851
+ for (const format of [...(request.inputFormats ?? []), ...(request.outputFormats ?? [])]) {
852
+ if (format.codec !== TRANSCRIPTION_FORMAT.codec || format.sampleRateHz !== TRANSCRIPTION_FORMAT.sampleRateHz
853
+ || format.channels !== TRANSCRIPTION_FORMAT.channels) {
854
+ throw new MistralTranscriptionError('invalid-config', 'only pcm16-le 24kHz mono is supported');
855
+ }
856
+ }
857
+ if (options.signal?.aborted) {
858
+ throw new MistralTranscriptionError('aborted', 'open aborted before connect');
859
+ }
860
+ const receipt = {
861
+ protocolVersion: 1,
862
+ speechSessionId: `speech-${options.admission.operationId}`,
863
+ connectionEpoch: request.target.controllerEpoch,
864
+ configuration: request.configuration,
865
+ target: request.target,
866
+ pipeline: 'chained',
867
+ micMode: request.micMode,
868
+ stages: { stt: capabilities },
869
+ inputFormat: TRANSCRIPTION_FORMAT,
870
+ };
871
+ // Bind the handshake (URL + authorization) once: per-turn dials reuse it.
872
+ // The session holds no key: failures are redacted through this closure.
873
+ const bearerToken = options.bearerToken;
874
+ const openProviderStream = async () => options.connect(MISTRAL_TRANSCRIPTION_WS_URL, {
875
+ authorization: `Bearer ${bearerToken}`,
876
+ originator: options.originator ?? 'sentropic-llm-mesh',
877
+ });
878
+ const redact = (message) => redactBearer(message, bearerToken);
879
+ return new MistralTranscriptionSession(receipt, binding, options.admission, options.usage, config, openProviderStream, redact, options.nowMs, options.signal, options.schedule, request.maxDurationMs);
880
+ };
881
+ //# sourceMappingURL=mistral-transcription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mistral-transcription.js","sourceRoot":"","sources":["../../src/speech/mistral-transcription.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAGzD,MAAM,CAAC,MAAM,iCAAiC,GAAG,SAAS,CAAC;AAC3D,MAAM,CAAC,MAAM,gCAAgC,GAAG,uBAAuB,CAAC;AACxE,MAAM,CAAC,MAAM,sCAAsC,GAAG,GAAG,CAAC;AAC1D,MAAM,CAAC,MAAM,+BAA+B,GAAG,aAAsB,CAAC;AACtE,MAAM,CAAC,MAAM,8BAA8B,GAAG,oCAAoC,CAAC;AACnF,MAAM,CAAC,MAAM,4BAA4B,GACvC,gGAAgG,CAAC;AAEnG,8EAA8E;AAC9E,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,oCAAoC,CAAU,CAAC;AAG1F;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC9C,oCAAoC;IACpC,sCAAsC;CAC9B,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,EAAE,CAAC;AACrD,MAAM,CAAC,MAAM,kCAAkC,GAAG,IAAI,CAAC;AACvD,MAAM,CAAC,MAAM,mCAAmC,GAAG,IAAI,CAAC;AAgBxD,MAAM,oBAAoB,GAA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1
1
  {
2
2
  "name": "@sentropic/llm-mesh",
3
- "version": "0.31.0",
3
+ "version": "0.32.0",
4
4
  "description": "Provider-agnostic LLM access runtime SDK for Sentropic.",
5
5
  "type": "module",
6
6
  "license": "MIT",