ssml-builder-js 2.15.0 → 2.17.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.
package/dist/elements.mjs CHANGED
@@ -33,12 +33,12 @@ import {
33
33
  registerSsmlCompletionProvider,
34
34
  resolveExpressAsStyles,
35
35
  updateEditableText
36
- } from "./chunk-BDY2Q2JL.mjs";
36
+ } from "./chunk-SLZ7PE6W.mjs";
37
37
  import {
38
38
  buildSsml,
39
39
  parseSsml,
40
40
  validateAzureSsml
41
- } from "./chunk-WXFLUCLR.mjs";
41
+ } from "./chunk-5AZWURHW.mjs";
42
42
  import "./chunk-6S5ODO6A.mjs";
43
43
 
44
44
  // packages/ssml-editor-react/src/ssmlInsertions.ts
@@ -183,6 +183,18 @@ interface SsmlDiagnostic {
183
183
  message: string;
184
184
  severity: SsmlDiagnosticSeverity;
185
185
  source: SsmlDiagnosticSource;
186
+ /** Structured location and source metadata; message parsing is not required. */
187
+ targetNodePath?: string[];
188
+ /** Alias retained for callers using the shorter terminology. */
189
+ nodePath?: string[];
190
+ range?: {
191
+ start: number;
192
+ end: number;
193
+ };
194
+ tagName?: string;
195
+ attributeName?: string;
196
+ voiceName?: string;
197
+ chunkIndex?: number;
186
198
  }
187
199
  interface AzureVoiceDefinition {
188
200
  name: string;
@@ -205,6 +217,7 @@ interface AzureValidationOptions {
205
217
  urlValidator?: AzureUrlValidator;
206
218
  /** Source path associated with a chunk being validated. */
207
219
  sourceNodePath?: readonly string[];
220
+ chunkIndex?: number;
208
221
  /** Alias for urlValidator retained for applications that use the longer name. */
209
222
  customUrlValidator?: AzureUrlValidator;
210
223
  /** Controls deduplication, caching, cancellation, and concurrency for URL checks. */
@@ -214,6 +227,8 @@ interface AzureValidationOptions {
214
227
  urlValidatorTimeoutMs?: number;
215
228
  urlValidatorSignal?: AbortSignal;
216
229
  urlValidatorCache?: Map<string, AzureUrlValidationResult>;
230
+ /** Shared runner used by chunk orchestration to deduplicate in-flight checks. */
231
+ urlValidatorRunner?: AzureUrlValidator;
217
232
  languageAliases?: Record<string, string | readonly string[]>;
218
233
  maxLength?: number;
219
234
  /** Maximum XML element nesting depth, counting `<speak>` as depth 1. */
@@ -249,4 +264,15 @@ interface AzureUrlValidationRunnerOptions {
249
264
  timeoutMs?: number;
250
265
  }
251
266
 
252
- export type { AzureValidationOptions as A, SsmlTextRange as S, SsmlSourceTextSegment as a, SsmlSourceMarker as b, SsmlDiagnostic as c, SsmlDocument as d, SsmlElement as e };
267
+ interface AzureVoiceCatalogMetadata {
268
+ apiVersion: string;
269
+ generatedAt: string;
270
+ regions: readonly string[];
271
+ voiceCount: number;
272
+ /** When the bundled snapshot should be refreshed. */
273
+ expiresAt?: string;
274
+ /** Region-specific catalog differences, when known. */
275
+ regionDiffs?: Readonly<Record<string, readonly string[]>>;
276
+ }
277
+
278
+ export type { AzureValidationOptions as A, SsmlTextRange as S, SsmlSourceTextSegment as a, SsmlSourceMarker as b, SsmlDiagnostic as c, SsmlDocument as d, SsmlElement as e, AzureVoiceCatalogMetadata as f };
@@ -183,6 +183,18 @@ interface SsmlDiagnostic {
183
183
  message: string;
184
184
  severity: SsmlDiagnosticSeverity;
185
185
  source: SsmlDiagnosticSource;
186
+ /** Structured location and source metadata; message parsing is not required. */
187
+ targetNodePath?: string[];
188
+ /** Alias retained for callers using the shorter terminology. */
189
+ nodePath?: string[];
190
+ range?: {
191
+ start: number;
192
+ end: number;
193
+ };
194
+ tagName?: string;
195
+ attributeName?: string;
196
+ voiceName?: string;
197
+ chunkIndex?: number;
186
198
  }
187
199
  interface AzureVoiceDefinition {
188
200
  name: string;
@@ -205,6 +217,7 @@ interface AzureValidationOptions {
205
217
  urlValidator?: AzureUrlValidator;
206
218
  /** Source path associated with a chunk being validated. */
207
219
  sourceNodePath?: readonly string[];
220
+ chunkIndex?: number;
208
221
  /** Alias for urlValidator retained for applications that use the longer name. */
209
222
  customUrlValidator?: AzureUrlValidator;
210
223
  /** Controls deduplication, caching, cancellation, and concurrency for URL checks. */
@@ -214,6 +227,8 @@ interface AzureValidationOptions {
214
227
  urlValidatorTimeoutMs?: number;
215
228
  urlValidatorSignal?: AbortSignal;
216
229
  urlValidatorCache?: Map<string, AzureUrlValidationResult>;
230
+ /** Shared runner used by chunk orchestration to deduplicate in-flight checks. */
231
+ urlValidatorRunner?: AzureUrlValidator;
217
232
  languageAliases?: Record<string, string | readonly string[]>;
218
233
  maxLength?: number;
219
234
  /** Maximum XML element nesting depth, counting `<speak>` as depth 1. */
@@ -249,4 +264,15 @@ interface AzureUrlValidationRunnerOptions {
249
264
  timeoutMs?: number;
250
265
  }
251
266
 
252
- export type { AzureValidationOptions as A, SsmlTextRange as S, SsmlSourceTextSegment as a, SsmlSourceMarker as b, SsmlDiagnostic as c, SsmlDocument as d, SsmlElement as e };
267
+ interface AzureVoiceCatalogMetadata {
268
+ apiVersion: string;
269
+ generatedAt: string;
270
+ regions: readonly string[];
271
+ voiceCount: number;
272
+ /** When the bundled snapshot should be refreshed. */
273
+ expiresAt?: string;
274
+ /** Region-specific catalog differences, when known. */
275
+ regionDiffs?: Readonly<Record<string, readonly string[]>>;
276
+ }
277
+
278
+ export type { AzureValidationOptions as A, SsmlTextRange as S, SsmlSourceTextSegment as a, SsmlSourceMarker as b, SsmlDiagnostic as c, SsmlDocument as d, SsmlElement as e, AzureVoiceCatalogMetadata as f };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- export { AudioElement, AzureDiagnosticCode, AzureLanguageNormalizationOptions, AzureSsmlValidationOptions, AzureUrlValidationResult, AzureUrlValidationRunnerOptions, AzureUrlValidator, AzureValidationOptions, AzureVoiceCatalogMetadata, AzureVoiceDefinition, AzureVoiceMetadata, BookmarkElement, BreakElement, BuildPartialSsmlOptions, CustomElement, EmphasisElement, ExpressAsElement, ExtractSsmlTranslatableTextOptions, FromPlainTextToSsmlOptions, LangElement, LexiconElement, MapSsmlTextNodesOptions, MarkElement, MsttsAudioDurationElement, MsttsEmbeddingElement, MsttsSilenceElement, MsttsTtsEmbeddingElement, MsttsVisemeElement, MsttsVoiceConversionElement, NamedElement, ParagraphElement, PhonemeElement, ProsodyElement, SayAsElement, SentenceElement, SplitSsmlOptions, SsmlAttributeValue, SsmlAttributes, SsmlBackgroundAudioNode, SsmlBreakElement, SsmlChunk, SsmlChunkContext, SsmlDiagnostic, SsmlDiagnosticSeverity, SsmlDiagnosticSource, SsmlDialogNode, SsmlDocument, SsmlElement, SsmlElementBase, SsmlEmbeddingNode, SsmlExpressAsElement, SsmlNode, SsmlPartialContext, SsmlPartialProsody, SsmlPartialVoice, SsmlPhonemeElement, SsmlProsodyElement, SsmlSayAsElement, SsmlSourceMap, SsmlSourceMarker, SsmlSourceTextSegment, SsmlStructureIntegrityResult, SsmlStructureMismatch, SsmlText, SsmlTextNodeContext, SsmlTextRange, SsmlTtsEmbeddingNode, SsmlTurnNode, SsmlValidationError, SsmlVoiceConversionNode, SsmlVoiceElement, SubElement, VoiceElement, WordElement, areAzureLanguagesEquivalent, buildPartialSsml, buildSsml, createAzureUrlValidatorRunner, extractSsmlText, extractSsmlTranslatableText, fromPlainTextToSsml, getAzureVoiceCatalogMetadata, getBuiltInVoiceCatalogMetadata, getSsmlSourceMap, isValidAzureAudioDuration, mapSsmlTextNodes, normalizeAzureLanguage, parseSsml, splitSsmlDocument, validateAzureSsml, validateSsml, validateSsmlStructureIntegrity } from './core.mjs';
2
- import { S as SsmlTextRange, a as SsmlSourceTextSegment, b as SsmlSourceMarker, c as SsmlDiagnostic, A as AzureValidationOptions } from './index.d-8BvkB9gz.mjs';
1
+ export { AudioElement, AzureDiagnosticCode, AzureLanguageNormalizationOptions, AzureSsmlValidationOptions, AzureUrlValidationResult, AzureUrlValidationRunnerOptions, AzureUrlValidator, AzureValidationOptions, AzureVoiceCatalogMetadata, AzureVoiceDefinition, AzureVoiceMetadata, BookmarkElement, BreakElement, BuildPartialSsmlOptions, CustomElement, Diagnostic, EmphasisElement, ExpressAsElement, ExtractSsmlTranslatableTextOptions, FromPlainTextToSsmlOptions, LangElement, LexiconElement, MapSsmlTextNodesOptions, MarkElement, MsttsAudioDurationElement, MsttsEmbeddingElement, MsttsSilenceElement, MsttsTtsEmbeddingElement, MsttsVisemeElement, MsttsVoiceConversionElement, NamedElement, ParagraphElement, PhonemeElement, ProsodyElement, SayAsElement, SentenceElement, SplitSsmlOptions, SsmlAttributeValue, SsmlAttributes, SsmlBackgroundAudioNode, SsmlBreakElement, SsmlChunk, SsmlChunkContext, SsmlDiagnostic, SsmlDiagnosticSeverity, SsmlDiagnosticSource, SsmlDialogNode, SsmlDocument, SsmlElement, SsmlElementBase, SsmlEmbeddingNode, SsmlExpressAsElement, SsmlNode, SsmlPartialContext, SsmlPartialProsody, SsmlPartialVoice, SsmlPhonemeElement, SsmlProsodyElement, SsmlSayAsElement, SsmlSourceMap, SsmlSourceMarker, SsmlSourceTextSegment, SsmlStructureIntegrityResult, SsmlStructureMismatch, SsmlText, SsmlTextNodeContext, SsmlTextRange, SsmlTtsEmbeddingNode, SsmlTurnNode, SsmlValidationError, SsmlVoiceConversionNode, SsmlVoiceElement, SubElement, VoiceElement, WordElement, areAzureLanguagesEquivalent, buildPartialSsml, buildSsml, createAzureUrlValidatorRunner, extractSsmlText, extractSsmlTranslatableText, fromPlainTextToSsml, getAzureVoiceCatalogMetadata, getBuiltInVoiceCatalogMetadata, getSsmlSourceMap, isValidAzureAudioDuration, mapSsmlTextNodes, normalizeAzureLanguage, parseSsml, splitSsmlDocument, validateAzureSsml, validateAzureSsmlChunks, validateSsml, validateSsmlStructureIntegrity } from './core.mjs';
2
+ import { S as SsmlTextRange, a as SsmlSourceTextSegment, b as SsmlSourceMarker, c as SsmlDiagnostic, A as AzureValidationOptions } from './index.d-tpKoP1jl.mjs';
3
3
  import * as SpeechSDK from 'microsoft-cognitiveservices-speech-sdk';
4
4
 
5
5
  declare const DEFAULT_OUTPUT_FORMAT = "audio-16khz-128kbitrate-mono-mp3";
@@ -50,6 +50,7 @@ declare function resolveMimeType(outputFormat: string): string;
50
50
  interface TtsConfig {
51
51
  signal?: AbortSignal;
52
52
  timeoutMs?: number;
53
+ timeouts?: SynthesisTimeouts;
53
54
  endpoint?: string;
54
55
  subscriptionKey: string;
55
56
  region: string;
@@ -67,6 +68,39 @@ interface TtsConfig {
67
68
  /** Exact source text segments used to map individual Azure events. */
68
69
  sourceTextSegments?: SsmlSourceTextSegment[];
69
70
  sourceMarkers?: SsmlSourceMarker[];
71
+ concurrency?: number;
72
+ retryOptions?: RetryOptions;
73
+ cancelOnFailure?: boolean;
74
+ resumeChunks?: readonly SynthesizedChunk[];
75
+ resumeChunkIndices?: readonly number[];
76
+ customMerger?: CustomAudioMerger;
77
+ outputMimeType?: string;
78
+ postMergeValidator?: PostMergeValidator;
79
+ }
80
+ type MappingStatus = "exact" | "fallback" | "unmapped";
81
+ interface AudioSpecification {
82
+ format: string;
83
+ mimeType: string;
84
+ codec: "pcm" | "mp3" | "opus" | "silk" | "unknown";
85
+ sampleRate: number;
86
+ channels: number;
87
+ bitrate?: number;
88
+ bitDepth?: number;
89
+ container?: string;
90
+ isVbr?: boolean;
91
+ isCompressed: boolean;
92
+ }
93
+ interface SynthesisTimeouts {
94
+ urlValidationMs?: number;
95
+ perChunkMs?: number;
96
+ chunkWithRetriesMs?: number;
97
+ totalJobMs?: number;
98
+ }
99
+ interface RetryOptions {
100
+ maxRetries: number;
101
+ initialDelayMs: number;
102
+ maxDelayMs: number;
103
+ shouldRetry?: (error: unknown, attempt: number) => boolean;
70
104
  }
71
105
  type SynthesisChunkStatus = "pending" | "synthesizing" | "success" | "failed";
72
106
  interface SsmlSynthesisBoundary {
@@ -86,6 +120,7 @@ interface SsmlSynthesisBoundary {
86
120
  /** Audio offset within the originating chunk before merge. */
87
121
  chunkAudioOffsetMs?: number;
88
122
  requestId?: string;
123
+ mappingStatus: MappingStatus;
89
124
  }
90
125
  interface SsmlSynthesisViseme {
91
126
  visemeId: number;
@@ -99,6 +134,7 @@ interface SsmlSynthesisViseme {
99
134
  originalTextRange?: SsmlTextRange;
100
135
  chunkAudioOffsetMs?: number;
101
136
  requestId?: string;
137
+ mappingStatus: MappingStatus;
102
138
  }
103
139
  interface SsmlSynthesisBookmark {
104
140
  name: string;
@@ -112,6 +148,7 @@ interface SsmlSynthesisBookmark {
112
148
  originalTextRange?: SsmlTextRange;
113
149
  chunkAudioOffsetMs?: number;
114
150
  requestId?: string;
151
+ mappingStatus: MappingStatus;
115
152
  }
116
153
  /** Audio and Azure Speech synchronization events emitted for one SSML request. */
117
154
  interface SsmlSynthesisResult {
@@ -133,6 +170,7 @@ interface SsmlSynthesisResult {
133
170
  };
134
171
  /** MIME type of a result produced by an explicit merge operation. */
135
172
  mimeType?: string;
173
+ audioSpec?: AudioSpecification;
136
174
  }
137
175
  interface MergedSynthesisResult extends SsmlSynthesisResult {
138
176
  mimeType: string;
@@ -152,8 +190,37 @@ interface SynthesizeChunksOptions {
152
190
  outputFormat?: AzureTtsOutputFormat | string;
153
191
  signal?: AbortSignal;
154
192
  timeoutMs?: number;
193
+ timeouts?: SynthesisTimeouts;
155
194
  sourceNodePath?: string[];
195
+ concurrency?: number;
196
+ retryOptions?: RetryOptions;
197
+ cancelOnFailure?: boolean;
198
+ resumeChunks?: readonly SynthesizedChunk[];
199
+ resumeChunkIndices?: readonly number[];
200
+ customMerger?: CustomAudioMerger;
201
+ outputMimeType?: string;
202
+ postMergeValidator?: PostMergeValidator;
156
203
  }
204
+ interface CustomMergerContext {
205
+ format: string;
206
+ outputMimeType: string;
207
+ inputSpecs: readonly AudioSpecification[];
208
+ signal: AbortSignal;
209
+ }
210
+ type CustomAudioMerger = (buffers: ArrayBuffer[], context: CustomMergerContext) => Promise<ArrayBuffer> | ArrayBuffer;
211
+ type PostMergeValidator = (result: MergedSynthesisResult, context: CustomMergerContext) => boolean | undefined | Promise<boolean | undefined>;
212
+ interface SynthesizedChunk extends SsmlSynthesisResult {
213
+ chunkIndex: number;
214
+ }
215
+ interface PartialChunkSynthesisResult {
216
+ synthesizedChunks: readonly SynthesizedChunk[];
217
+ completedChunks: readonly SynthesizedChunk[];
218
+ pendingChunkIndices: readonly number[];
219
+ failedChunkIndices: readonly number[];
220
+ totalChunks: number;
221
+ }
222
+ /** Alias for applications that use the shorter result name. */
223
+ type PartialSynthesisResult = PartialChunkSynthesisResult;
157
224
  interface SynthesisProgressEvent {
158
225
  /** 1-based completed chunk count retained for backward compatibility. */
159
226
  currentChunk: number;
@@ -164,6 +231,9 @@ interface SynthesisProgressEvent {
164
231
  status: SynthesisChunkStatus;
165
232
  durationMs: number;
166
233
  error?: unknown;
234
+ retryAttempt?: number;
235
+ nextRetryDelayMs?: number;
236
+ isRetrying?: boolean;
167
237
  }
168
238
  interface AzureTtsLogger {
169
239
  debug?: (...args: unknown[]) => void;
@@ -174,23 +244,29 @@ interface AzureTtsLogger {
174
244
  interface AzureTtsClientOptions {
175
245
  signal?: AbortSignal;
176
246
  timeoutMs?: number;
247
+ timeouts?: SynthesisTimeouts;
177
248
  subscriptionKey: string;
178
249
  region: string;
179
250
  endpoint?: string;
180
251
  outputFormat?: string;
181
252
  logger?: AzureTtsLogger;
182
253
  onProgress?: (event: SynthesisProgressEvent) => void;
254
+ concurrency?: number;
255
+ retryOptions?: RetryOptions;
183
256
  }
184
257
 
185
- type SynthesisErrorKind = "validation-error" | "azure-api-error" | "merge-error" | "unsupported-format-error" | "cancelled" | "timeout";
258
+ type SynthesisErrorKind = "validation-error" | "azure-api-error" | "merge-error" | "audio-format-mismatch" | "unsupported-format-error" | "cancelled" | "timeout";
186
259
  declare class AzureTtsError extends Error {
187
260
  readonly kind: "azure-api-error";
188
261
  readonly status: number;
189
262
  readonly statusText: string;
190
263
  readonly responseBody: string;
191
264
  readonly requestId: string | null;
192
- constructor(status: number, statusText: string, responseBody: string, requestId: string | null);
265
+ readonly retryAfterMs?: number;
266
+ constructor(status: number, statusText: string, responseBody: string, requestId: string | null, responseHeaders?: Headers | Readonly<Record<string, string>>);
193
267
  }
268
+ /** Reads Retry-After from an error-like value, returning milliseconds when present. */
269
+ declare function getRetryAfterDelayMs(error: unknown): number | undefined;
194
270
  declare class AzureTtsSdkError extends AzureTtsError {
195
271
  readonly errorDetails: string;
196
272
  constructor(errorDetails: string);
@@ -208,13 +284,19 @@ declare class MergeError extends Error {
208
284
  readonly cause: unknown;
209
285
  constructor(message: string, cause?: unknown);
210
286
  }
287
+ /** Thrown when chunk headers describe incompatible audio streams. */
288
+ declare class AudioFormatMismatchError extends Error {
289
+ readonly kind: "audio-format-mismatch";
290
+ readonly inputSpecs: readonly AudioSpecification[];
291
+ constructor(message: string, inputSpecs?: readonly AudioSpecification[]);
292
+ }
211
293
  /** Thrown when audio buffers require container re-multiplexing before they can be merged. */
212
294
  declare class UnsupportedMergeFormatError extends Error {
213
295
  readonly kind: "unsupported-format-error";
214
296
  readonly format: string;
215
297
  constructor(format: string);
216
298
  }
217
- type AzureTtsSynthesisError = AzureTtsError | MergeError | UnsupportedMergeFormatError | SynthesisCancelledError | SynthesisTimeoutError;
299
+ type AzureTtsSynthesisError = AzureTtsError | MergeError | AudioFormatMismatchError | UnsupportedMergeFormatError | SynthesisCancelledError | SynthesisTimeoutError;
218
300
 
219
301
  interface SsmlValidationError {
220
302
  readonly kind: "validation-error";
@@ -228,6 +310,17 @@ declare class ChunkValidationError extends Error {
228
310
  readonly diagnostics: readonly SsmlDiagnostic[];
229
311
  constructor(chunkIndex: number, diagnostics: readonly SsmlDiagnostic[]);
230
312
  }
313
+ interface ChunkDiagnostics {
314
+ readonly chunkIndex: number;
315
+ readonly diagnostics: readonly SsmlDiagnostic[];
316
+ }
317
+ declare class BatchChunkValidationError extends ChunkValidationError {
318
+ readonly chunkDiagnostics: readonly ChunkDiagnostics[];
319
+ readonly totalErrorCount: number;
320
+ readonly errorCount: number;
321
+ readonly totalErrors: number;
322
+ constructor(chunkDiagnostics: readonly ChunkDiagnostics[]);
323
+ }
231
324
  type Result<T, E> = {
232
325
  readonly ok: true;
233
326
  readonly success: true;
@@ -240,11 +333,13 @@ type Result<T, E> = {
240
333
  readonly success: false;
241
334
  readonly status: Kind;
242
335
  readonly error: E;
336
+ readonly partialResult?: PartialChunkSynthesisResult;
243
337
  } : {
244
338
  readonly ok: false;
245
339
  readonly success: false;
246
340
  readonly status: SynthesisErrorKind;
247
341
  readonly error: E;
342
+ readonly partialResult?: PartialChunkSynthesisResult;
248
343
  });
249
344
  type SynthesisResult<T, E> = Result<T, E>;
250
345
  type Success<T> = Extract<Result<T, never>, {
@@ -261,16 +356,26 @@ interface SynthesizeSsmlSafeOptions extends AzureValidationOptions {
261
356
  /** Optional nested form for callers that want to keep validation settings grouped. */
262
357
  validation?: AzureValidationOptions;
263
358
  signal?: AbortSignal;
359
+ timeouts?: SynthesisTimeouts;
264
360
  }
265
361
  interface SynthesizeSsmlChunksSafeOptions extends AzureValidationOptions {
266
362
  validation?: AzureValidationOptions;
267
363
  outputFormat?: string;
268
364
  signal?: AbortSignal;
269
365
  timeoutMs?: number;
366
+ timeouts?: SynthesisTimeouts;
270
367
  sourceNodePath?: string[];
271
368
  onProgress?: (event: SynthesisProgressEvent) => void;
369
+ concurrency?: number;
370
+ retryOptions?: RetryOptions;
371
+ cancelOnFailure?: boolean;
372
+ resumeChunks?: readonly SynthesizedChunk[];
373
+ resumeChunkIndices?: readonly number[];
374
+ customMerger?: CustomAudioMerger;
375
+ outputMimeType?: string;
376
+ postMergeValidator?: PostMergeValidator;
272
377
  }
273
- type SsmlSynthesisChunksSafeResult = Result<SsmlSynthesisResult, never> | Result<never, ChunkValidationError> | Result<never, SsmlSynthesisError | ChunkValidationError>;
378
+ type SsmlSynthesisChunksSafeResult = Result<SsmlSynthesisResult, never> | Result<never, ChunkValidationError> | Result<never, BatchChunkValidationError> | Result<never, SsmlSynthesisError | ChunkValidationError>;
274
379
  interface SynthesisClient {
275
380
  synthesizeSsml(ssml: string, options?: Partial<SynthesizeChunksOptions>): Promise<SsmlSynthesisResult>;
276
381
  synthesizeChunks?(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeChunksOptions): Promise<SsmlSynthesisResult>;
@@ -294,22 +399,29 @@ declare class AzureTtsClient {
294
399
  type MergeAudioFormat = "wav" | "mp3" | "raw";
295
400
  interface MergeAudioOptions {
296
401
  format: AzureTtsOutputFormat;
402
+ signal?: AbortSignal;
403
+ outputMimeType?: string;
297
404
  }
405
+ type InputAudioSpecs = AudioSpecification[];
298
406
  interface MergeSynthesisOptions extends MergeAudioOptions {
299
- customMerger?: (buffers: ArrayBuffer[], format: string) => Promise<ArrayBuffer> | ArrayBuffer;
407
+ customMerger?: CustomAudioMerger;
408
+ postMergeValidator?: PostMergeValidator;
300
409
  }
301
410
  type AsyncMergeSynthesisOptions = MergeSynthesisOptions & {
302
411
  customMerger: NonNullable<MergeSynthesisOptions["customMerger"]>;
303
412
  };
413
+ /** Extracts the stream specification from a WAV/MP3 header and output-format fallback. */
414
+ declare function inspectAudioSpecification(buffer: ArrayBuffer, format: string): AudioSpecification;
304
415
  /** Returns whether the named output format can be safely concatenated without re-multiplexing. */
305
416
  declare function resolveMergeAudioFormat(format: string): MergeAudioFormat | undefined;
306
417
  declare function canMergeAudioFormat(format: string): boolean;
307
418
  /** Merges audio buffers while preserving the invariants of supported containers. */
308
419
  declare function mergeAudioBuffers(buffers: readonly ArrayBuffer[], options: MergeAudioOptions): ArrayBuffer;
309
420
  declare function synthesizeSsml(ssml: string, config: TtsConfig): Promise<SsmlSynthesisResult>;
310
- /** Synthesizes chunks sequentially, annotates synchronization events, and merges the results. */
421
+ /** Synthesizes chunks with bounded concurrency, retries transient failures, and merges in chunk order. */
311
422
  declare function synthesizeSsmlChunks(chunks: readonly (SsmlSynthesisChunk | string)[], config: TtsConfig): Promise<SsmlSynthesisResult>;
312
423
  declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], options: AsyncMergeSynthesisOptions): Promise<MergedSynthesisResult>;
424
+ declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], options: MergeSynthesisOptions): MergedSynthesisResult | Promise<MergedSynthesisResult>;
313
425
  declare function mergeSynthesisResults(results: readonly SsmlSynthesisResult[], options: MergeAudioOptions): MergedSynthesisResult;
314
426
  /** Backward-compatible audio-only synthesis helper. */
315
427
  declare function synthesizeSpeech(ssml: string, config: TtsConfig): Promise<ArrayBuffer>;
@@ -334,6 +446,8 @@ interface FetchedAzureVoiceCatalogMetadata {
334
446
  generatedAt: string;
335
447
  apiVersion: string;
336
448
  regions: readonly string[];
449
+ expiresAt?: string;
450
+ regionDiffs?: Readonly<Record<string, readonly string[]>>;
337
451
  }
338
452
  interface AzureVoiceCatalog {
339
453
  voices: readonly AzureVoiceCatalogVoice[];
@@ -342,4 +456,4 @@ interface AzureVoiceCatalog {
342
456
  /** Fetches and deduplicates the current Azure Speech voice catalog for one or more regions. */
343
457
  declare function fetchAzureVoiceCatalog(options: FetchAzureVoiceCatalogOptions): Promise<AzureVoiceCatalog>;
344
458
 
345
- export { type AzureApiErrorResult, type SsmlValidationError as AzureSsmlValidationError, AzureTtsClient, type AzureTtsClientOptions, AzureTtsError, type AzureTtsLogger, type AzureTtsOutputFormat, AzureTtsSdkError, type AzureTtsSynthesisError, type AzureVoiceCatalog, type AzureVoiceCatalogVoice, ChunkValidationError, DEFAULT_OUTPUT_FORMAT, type FetchAzureVoiceCatalogOptions, type FetchedAzureVoiceCatalogMetadata, type MergeAudioFormat, type MergeAudioOptions, MergeError, type MergeSynthesisOptions, type MergedSynthesisResult, type Result, type SsmlSynthesisBookmark, type SsmlSynthesisBoundary, type SsmlSynthesisChunk, type SsmlSynthesisChunksSafeResult, type SsmlSynthesisError, type SsmlSynthesisResult, type SsmlSynthesisSafeResult, type SsmlSynthesisViseme, type Success, SynthesisCancelledError, type SynthesisChunkStatus, type SynthesisErrorKind, type SynthesisProgressEvent, type SynthesisResult, SynthesisTimeoutError, type SynthesizeChunksOptions, type SynthesizeSsmlChunksSafeOptions, type SynthesizeSsmlSafeOptions, type TtsConfig, UnsupportedMergeFormatError, type ValidationErrorResult, canMergeAudioFormat, fetchAzureVoiceCatalog, mergeAudioBuffers, mergeSynthesisResults, resolveMergeAudioFormat, resolveMimeType, synthesizeSpeech, synthesizeSsml, synthesizeSsmlChunks, synthesizeSsmlChunksSafe, synthesizeSsmlSafe };
459
+ export { AudioFormatMismatchError, type AudioSpecification, type AzureApiErrorResult, type SsmlValidationError as AzureSsmlValidationError, AzureTtsClient, type AzureTtsClientOptions, AzureTtsError, type AzureTtsLogger, type AzureTtsOutputFormat, AzureTtsSdkError, type AzureTtsSynthesisError, type AzureVoiceCatalog, type AzureVoiceCatalogVoice, BatchChunkValidationError, type ChunkDiagnostics, ChunkValidationError, type CustomAudioMerger, type CustomMergerContext, DEFAULT_OUTPUT_FORMAT, type FetchAzureVoiceCatalogOptions, type FetchedAzureVoiceCatalogMetadata, type InputAudioSpecs, type MappingStatus, type MergeAudioFormat, type MergeAudioOptions, MergeError, type MergeSynthesisOptions, type MergedSynthesisResult, type PartialChunkSynthesisResult, type PartialSynthesisResult, type PostMergeValidator, type Result, type RetryOptions, type SsmlSynthesisBookmark, type SsmlSynthesisBoundary, type SsmlSynthesisChunk, type SsmlSynthesisChunksSafeResult, type SsmlSynthesisError, type SsmlSynthesisResult, type SsmlSynthesisSafeResult, type SsmlSynthesisViseme, type Success, SynthesisCancelledError, type SynthesisChunkStatus, type SynthesisErrorKind, type SynthesisProgressEvent, type SynthesisResult, SynthesisTimeoutError, type SynthesisTimeouts, type SynthesizeChunksOptions, type SynthesizeSsmlChunksSafeOptions, type SynthesizeSsmlSafeOptions, type SynthesizedChunk, type TtsConfig, UnsupportedMergeFormatError, type ValidationErrorResult, canMergeAudioFormat, fetchAzureVoiceCatalog, getRetryAfterDelayMs, inspectAudioSpecification, mergeAudioBuffers, mergeSynthesisResults, resolveMergeAudioFormat, resolveMimeType, synthesizeSpeech, synthesizeSsml, synthesizeSsmlChunks, synthesizeSsmlChunksSafe, synthesizeSsmlSafe };