ssml-builder-js 2.18.0 → 2.19.1

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/README.md CHANGED
@@ -921,6 +921,8 @@ v2.17.0 では `customMerger`、`outputMimeType`、`postMergeValidator` をチ
921
921
 
922
922
  v2.18.0 では `resumeChunks` に SSML・音声設定・出力形式のフィンガープリントを付与し、不一致のキャッシュを自動的に再合成します。`PartialChunkSynthesisResult.chunkStates` は成功、直接失敗、連鎖キャンセル、未実行を区別します。`totalJobMs` は単一合成にも適用され、上限を超える `Retry-After` は待機せずタイムアウトになります。`AzureTtsClient` の既定値として再試行、キャンセル、結合器、MIME、結合後検証、再開検証を注入できます。RAW 音声はサンプリング周波数、ビット深度、codec、フレーム境界を検証します。
923
923
 
924
+ v2.19.0 では、再開フィンガープリントに SSML、voice、言語、出力形式、リージョン、endpoint、custom headers、スキーマバージョンを含め、環境の異なるキャッシュの再利用を防ぎます。`resumeChunkIndices` の欠落は `IncompleteChunkSetError` で結合前に拒否され、`ChunkExecutionState.error` は JSON 化可能な `SerializedChunkError` になります。単一合成を含む URL 検証、再試行、チャンク合成、結合は絶対 deadline で制限され、Ogg/WebM/RAW Opus/SILK の実体ヘッダーも検証します。Visual editor は `expressAs` などの別名を正規化し、neural-HD の非対応タグを表示します。
925
+
924
926
  `validateAzureSsml` の `urlValidation` オプションは URL の重複排除、キャッシュ、`concurrency`、`signal`、`timeoutMs` を制御します。
925
927
 
926
928
  For long documents, use `synthesizeSsmlChunks` or `AzureTtsClient.synthesizeChunks`; `onProgress` reports completed chunks while audio and synchronization offsets are merged. `synthesizeSsmlSafe(client, ssml, { validation })` validates before synthesis and returns a discriminated result without calling Azure when static validation fails.
@@ -933,6 +935,8 @@ In v2.17.0, configure `customMerger`, `outputMimeType`, and `postMergeValidator`
933
935
 
934
936
  In v2.18.0, `resumeChunks` carries a fingerprint of the SSML, voice settings, and output format; stale cache entries are automatically re-synthesized. `PartialChunkSynthesisResult.chunkStates` distinguishes succeeded, directly failed, chained-cancelled, and pending chunks. `totalJobMs` also bounds single synthesis, and an over-budget `Retry-After` fails immediately without sleeping. `AzureTtsClient` accepts retry, cancellation, merger, MIME, post-merge validation, and resume-validation defaults. RAW audio now validates sample rate, bit depth, codec, and frame alignment.
935
937
 
938
+ In v2.19.0, resume fingerprints include SSML, voice, language, output format, region, endpoint, custom headers, and schema version so cached chunks cannot cross synthesis environments. Missing `resumeChunkIndices` are rejected before merge with `IncompleteChunkSetError`, and `ChunkExecutionState.error` is a JSON-serializable `SerializedChunkError`. URL validation, retries, chunk synthesis, and merging share an absolute deadline, including single synthesis. Ogg/WebM/RAW Opus/SILK payloads receive concrete container or header validation, and the visual editor normalizes aliases such as `expressAs` while showing neural-HD unsupported tags.
939
+
936
940
  The `urlValidation` option of `validateAzureSsml` provides URL deduplication, in-memory caching, bounded `concurrency`, `signal`, and `timeoutMs` controls.
937
941
 
938
942
  The public updater CLI is `npx ssml-builder sync-voices --region eastus --output ./azure-voices.json`. It reads the key from `AZURE_SPEECH_KEY` (or `--key`) and regions from `AZURE_SPEECH_REGION(S)` (or `--region(s)`).
@@ -275,4 +275,4 @@ interface AzureVoiceCatalogMetadata {
275
275
  regionDiffs?: Readonly<Record<string, readonly string[]>>;
276
276
  }
277
277
 
278
- export type { AzureValidationOptions as A, SsmlDiagnostic as S, SsmlTextRange as a, SsmlSourceTextSegment as b, SsmlSourceMarker as c, SsmlDocument as d, SsmlElement as e, AzureVoiceCatalogMetadata as f };
278
+ export type { AzureVoiceCatalogMetadata as A, SsmlDocument as S, SsmlElement as a, SsmlTextRange as b, SsmlSourceTextSegment as c, SsmlSourceMarker as d, SsmlDiagnostic as e, AzureValidationOptions as f };
@@ -275,4 +275,4 @@ interface AzureVoiceCatalogMetadata {
275
275
  regionDiffs?: Readonly<Record<string, readonly string[]>>;
276
276
  }
277
277
 
278
- export type { AzureValidationOptions as A, SsmlDiagnostic as S, SsmlTextRange as a, SsmlSourceTextSegment as b, SsmlSourceMarker as c, SsmlDocument as d, SsmlElement as e, AzureVoiceCatalogMetadata as f };
278
+ export type { AzureVoiceCatalogMetadata as A, SsmlDocument as S, SsmlElement as a, SsmlTextRange as b, SsmlSourceTextSegment as c, SsmlSourceMarker as d, SsmlDiagnostic as e, AzureValidationOptions as f };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
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 SsmlDiagnostic, A as AzureValidationOptions, a as SsmlTextRange, b as SsmlSourceTextSegment, c as SsmlSourceMarker } from './index.d-B2WddTa4.mjs';
2
+ import { b as SsmlTextRange, c as SsmlSourceTextSegment, d as SsmlSourceMarker, e as SsmlDiagnostic, f as AzureValidationOptions } from './index.d-4kqVuH29.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";
@@ -47,7 +47,19 @@ declare const OUTPUT_FORMATS: {
47
47
  type AzureTtsOutputFormat = keyof typeof OUTPUT_FORMATS;
48
48
  declare function resolveMimeType(outputFormat: string): string;
49
49
 
50
- type SynthesisErrorKind = "validation-error" | "azure-api-error" | "merge-error" | "audio-format-mismatch" | "unsupported-format-error" | "cancelled" | "timeout";
50
+ type SynthesisErrorKind = "validation-error" | "azure-api-error" | "merge-error" | "audio-format-mismatch" | "unsupported-format-error" | "cancelled" | "timeout" | "incomplete-chunk-set";
51
+ type SerializedChunkErrorCode = "VALIDATION_ERROR" | "AZURE_API_ERROR" | "TIMEOUT" | "CANCELLED" | "MERGE_ERROR" | "FORMAT_MISMATCH";
52
+ interface SerializedChunkError {
53
+ code: SerializedChunkErrorCode;
54
+ phase: "url-validation" | "synthesis" | "merge";
55
+ message: string;
56
+ isOriginalFailure: boolean;
57
+ isRetryable: boolean;
58
+ httpStatus?: number;
59
+ details?: Record<string, unknown>;
60
+ }
61
+ /** Backward-compatible name used by persisted execution-state consumers. */
62
+ type SerializedExecutionError = SerializedChunkError;
51
63
  declare class AzureTtsError extends Error {
52
64
  readonly kind: "azure-api-error";
53
65
  readonly status: number;
@@ -71,6 +83,12 @@ declare class SynthesisTimeoutError extends Error {
71
83
  readonly kind: "timeout";
72
84
  constructor(message: string);
73
85
  }
86
+ declare class IncompleteChunkSetError extends Error {
87
+ readonly kind: "incomplete-chunk-set";
88
+ readonly totalChunks: number;
89
+ readonly missingChunkIndices: readonly number[];
90
+ constructor(totalChunks: number, missingChunkIndices: readonly number[]);
91
+ }
74
92
  declare class MergeError extends Error {
75
93
  readonly kind: "merge-error";
76
94
  readonly cause: unknown;
@@ -88,106 +106,8 @@ declare class UnsupportedMergeFormatError extends Error {
88
106
  readonly format: string;
89
107
  constructor(format: string);
90
108
  }
91
- type AzureTtsSynthesisError = AzureTtsError | MergeError | AudioFormatMismatchError | UnsupportedMergeFormatError | SynthesisCancelledError | SynthesisTimeoutError;
92
-
93
- declare class AzureTtsClient {
94
- #private;
95
- constructor(options: AzureTtsClientOptions);
96
- synthesize(ssml: string): Promise<ArrayBuffer>;
97
- synthesizeSsml(ssml: string, options?: Partial<TtsConfig>): Promise<SsmlSynthesisResult>;
98
- synthesizeChunks(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeChunksOptions): Promise<SsmlSynthesisResult>;
99
- synthesizeSsmlSafe(ssml: string, options?: SynthesizeSsmlSafeOptions): Promise<SsmlSynthesisSafeResult>;
100
- synthesizeChunksSafe(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeSsmlChunksSafeOptions): Promise<SsmlSynthesisChunksSafeResult>;
101
- synthesizeSsmlChunksSafe(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeSsmlChunksSafeOptions): Promise<SsmlSynthesisChunksSafeResult>;
102
- }
103
-
104
- interface SsmlValidationError {
105
- readonly kind: "validation-error";
106
- readonly message: string;
107
- readonly diagnostics: readonly SsmlDiagnostic[];
108
- }
109
- type SsmlSynthesisError = SsmlValidationError | AzureTtsSynthesisError;
110
- declare class ChunkValidationError extends Error {
111
- readonly kind: "validation-error";
112
- readonly chunkIndex: number;
113
- readonly diagnostics: readonly SsmlDiagnostic[];
114
- constructor(chunkIndex: number, diagnostics: readonly SsmlDiagnostic[]);
115
- }
116
- interface ChunkDiagnostics {
117
- readonly chunkIndex: number;
118
- readonly diagnostics: readonly SsmlDiagnostic[];
119
- }
120
- declare class BatchChunkValidationError extends ChunkValidationError {
121
- readonly chunkDiagnostics: readonly ChunkDiagnostics[];
122
- readonly totalErrorCount: number;
123
- readonly errorCount: number;
124
- readonly totalErrors: number;
125
- constructor(chunkDiagnostics: readonly ChunkDiagnostics[]);
126
- }
127
- type Result<T, E> = {
128
- readonly ok: true;
129
- readonly success: true;
130
- readonly status: "success";
131
- readonly value: T;
132
- } | (E extends {
133
- readonly kind: infer Kind extends SynthesisErrorKind;
134
- } ? {
135
- readonly ok: false;
136
- readonly success: false;
137
- readonly status: Kind;
138
- readonly error: E;
139
- readonly partialResult?: PartialChunkSynthesisResult;
140
- } : {
141
- readonly ok: false;
142
- readonly success: false;
143
- readonly status: SynthesisErrorKind;
144
- readonly error: E;
145
- readonly partialResult?: PartialChunkSynthesisResult;
146
- });
147
- type SynthesisResult<T, E> = Result<T, E>;
148
- type Success<T> = Extract<Result<T, never>, {
149
- readonly ok: true;
150
- }>;
151
- type ValidationErrorResult = Extract<Result<never, SsmlValidationError>, {
152
- readonly status: "validation-error";
153
- }>;
154
- type AzureApiErrorResult = Extract<Result<never, AzureTtsError>, {
155
- readonly status: "azure-api-error";
156
- }>;
157
- type SsmlSynthesisSafeResult = Result<SsmlSynthesisResult, never> | Result<never, SsmlValidationError> | Result<never, SsmlSynthesisError>;
158
- interface SynthesizeSsmlSafeOptions extends AzureValidationOptions {
159
- /** Optional nested form for callers that want to keep validation settings grouped. */
160
- validation?: AzureValidationOptions;
161
- signal?: AbortSignal;
162
- timeouts?: SynthesisTimeouts;
163
- }
164
- interface SynthesizeSsmlChunksSafeOptions extends AzureValidationOptions {
165
- validation?: AzureValidationOptions;
166
- outputFormat?: string;
167
- signal?: AbortSignal;
168
- timeoutMs?: number;
169
- timeouts?: SynthesisTimeouts;
170
- sourceNodePath?: string[];
171
- onProgress?: (event: SynthesisProgressEvent) => void;
172
- concurrency?: number;
173
- retryOptions?: RetryOptions;
174
- cancelOnFailure?: boolean;
175
- resumeChunks?: readonly SynthesizedChunk[];
176
- resumeChunkIndices?: readonly number[];
177
- customMerger?: CustomAudioMerger;
178
- outputMimeType?: string;
179
- postMergeValidator?: PostMergeValidator;
180
- resumeValidation?: ResumeValidationMode;
181
- }
182
- type SsmlSynthesisChunksSafeResult = Result<SsmlSynthesisResult, never> | Result<never, ChunkValidationError> | Result<never, BatchChunkValidationError> | Result<never, SsmlSynthesisError | ChunkValidationError>;
183
- interface SynthesisClient {
184
- synthesizeSsml(ssml: string, options?: Partial<SynthesizeChunksOptions>): Promise<SsmlSynthesisResult>;
185
- synthesizeChunks?(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeChunksOptions): Promise<SsmlSynthesisResult>;
186
- }
187
- /** Validates SSML before invoking Azure and converts validation/API failures to one result shape. */
188
- declare function synthesizeSsmlSafe(client: Pick<AzureTtsClient, "synthesizeSsml"> | SynthesisClient, ssml: string, options?: SynthesizeSsmlSafeOptions): Promise<SsmlSynthesisSafeResult>;
189
- /** Validates every chunk before synthesis and returns a chunk-addressable result. */
190
- declare function synthesizeSsmlChunksSafe(client: Pick<AzureTtsClient, "synthesizeSsml" | "synthesizeChunks"> | SynthesisClient, chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeSsmlChunksSafeOptions): Promise<SsmlSynthesisChunksSafeResult>;
109
+ type AzureTtsSynthesisError = AzureTtsError | MergeError | AudioFormatMismatchError | UnsupportedMergeFormatError | SynthesisCancelledError | SynthesisTimeoutError | IncompleteChunkSetError;
110
+ declare function serializeChunkError(error: unknown, phase: SerializedChunkError["phase"], isOriginalFailure: boolean): SerializedChunkError;
191
111
 
192
112
  interface TtsConfig {
193
113
  signal?: AbortSignal;
@@ -197,6 +117,8 @@ interface TtsConfig {
197
117
  subscriptionKey: string;
198
118
  region: string;
199
119
  outputFormat?: string;
120
+ customHeaders?: Readonly<Record<string, string>>;
121
+ fingerprintSchemaVersion?: string;
200
122
  /** Original plain-text range represented by this synthesis request. */
201
123
  sourceTextRange?: {
202
124
  start: number;
@@ -332,6 +254,8 @@ interface SsmlSynthesisChunk {
332
254
  interface SynthesizeChunksOptions {
333
255
  onProgress?: (event: SynthesisProgressEvent) => void;
334
256
  outputFormat?: AzureTtsOutputFormat | string;
257
+ customHeaders?: Readonly<Record<string, string>>;
258
+ fingerprintSchemaVersion?: string;
335
259
  signal?: AbortSignal;
336
260
  timeoutMs?: number;
337
261
  timeouts?: SynthesisTimeouts;
@@ -363,7 +287,7 @@ type ChunkExecutionStatus = "succeeded" | "failed" | "cancelled" | "pending";
363
287
  interface ChunkExecutionState {
364
288
  chunkIndex: number;
365
289
  status: ChunkExecutionStatus;
366
- error?: AzureTtsError | SsmlValidationError;
290
+ error?: SerializedChunkError;
367
291
  isOriginalFailure?: boolean;
368
292
  canResume: boolean;
369
293
  result?: SsmlSynthesisResult;
@@ -407,6 +331,8 @@ interface AzureTtsClientOptions {
407
331
  region: string;
408
332
  endpoint?: string;
409
333
  outputFormat?: string;
334
+ customHeaders?: Readonly<Record<string, string>>;
335
+ fingerprintSchemaVersion?: string;
410
336
  logger?: AzureTtsLogger;
411
337
  onProgress?: (event: SynthesisProgressEvent) => void;
412
338
  concurrency?: number;
@@ -418,6 +344,120 @@ interface AzureTtsClientOptions {
418
344
  resumeValidation?: ResumeValidationMode;
419
345
  }
420
346
 
347
+ /** Coordinates one absolute deadline across validation, synthesis, retries, and merging. */
348
+ declare class DeadlineController {
349
+ #private;
350
+ readonly deadlineAtMs: number | undefined;
351
+ readonly signal: AbortSignal;
352
+ constructor(totalJobMs: number | undefined, parent?: AbortSignal);
353
+ get timedOut(): boolean;
354
+ get remainingMs(): number;
355
+ throwIfExpired(): void;
356
+ abort(): void;
357
+ dispose(): void;
358
+ }
359
+
360
+ interface SsmlValidationError {
361
+ readonly kind: "validation-error";
362
+ readonly message: string;
363
+ readonly diagnostics: readonly SsmlDiagnostic[];
364
+ }
365
+ type SsmlSynthesisError = SsmlValidationError | AzureTtsSynthesisError;
366
+ declare class ChunkValidationError extends Error {
367
+ readonly kind: "validation-error";
368
+ readonly chunkIndex: number;
369
+ readonly diagnostics: readonly SsmlDiagnostic[];
370
+ constructor(chunkIndex: number, diagnostics: readonly SsmlDiagnostic[]);
371
+ }
372
+ interface ChunkDiagnostics {
373
+ readonly chunkIndex: number;
374
+ readonly diagnostics: readonly SsmlDiagnostic[];
375
+ }
376
+ declare class BatchChunkValidationError extends ChunkValidationError {
377
+ readonly chunkDiagnostics: readonly ChunkDiagnostics[];
378
+ readonly totalErrorCount: number;
379
+ readonly errorCount: number;
380
+ readonly totalErrors: number;
381
+ constructor(chunkDiagnostics: readonly ChunkDiagnostics[]);
382
+ }
383
+ type Result<T, E> = {
384
+ readonly ok: true;
385
+ readonly success: true;
386
+ readonly status: "success";
387
+ readonly value: T;
388
+ } | (E extends {
389
+ readonly kind: infer Kind extends SynthesisErrorKind;
390
+ } ? {
391
+ readonly ok: false;
392
+ readonly success: false;
393
+ readonly status: Kind;
394
+ readonly error: E;
395
+ readonly partialResult?: PartialChunkSynthesisResult;
396
+ } : {
397
+ readonly ok: false;
398
+ readonly success: false;
399
+ readonly status: SynthesisErrorKind;
400
+ readonly error: E;
401
+ readonly partialResult?: PartialChunkSynthesisResult;
402
+ });
403
+ type SynthesisResult<T, E> = Result<T, E>;
404
+ type Success<T> = Extract<Result<T, never>, {
405
+ readonly ok: true;
406
+ }>;
407
+ type ValidationErrorResult = Extract<Result<never, SsmlValidationError>, {
408
+ readonly status: "validation-error";
409
+ }>;
410
+ type AzureApiErrorResult = Extract<Result<never, AzureTtsError>, {
411
+ readonly status: "azure-api-error";
412
+ }>;
413
+ type SsmlSynthesisSafeResult = Result<SsmlSynthesisResult, never> | Result<never, SsmlValidationError> | Result<never, SsmlSynthesisError>;
414
+ interface SynthesizeSsmlSafeOptions extends AzureValidationOptions {
415
+ /** Optional nested form for callers that want to keep validation settings grouped. */
416
+ validation?: AzureValidationOptions;
417
+ signal?: AbortSignal;
418
+ timeouts?: SynthesisTimeouts;
419
+ }
420
+ interface SynthesizeSsmlChunksSafeOptions extends AzureValidationOptions {
421
+ validation?: AzureValidationOptions;
422
+ outputFormat?: string;
423
+ customHeaders?: Readonly<Record<string, string>>;
424
+ fingerprintSchemaVersion?: string;
425
+ signal?: AbortSignal;
426
+ timeoutMs?: number;
427
+ timeouts?: SynthesisTimeouts;
428
+ sourceNodePath?: string[];
429
+ onProgress?: (event: SynthesisProgressEvent) => void;
430
+ concurrency?: number;
431
+ retryOptions?: RetryOptions;
432
+ cancelOnFailure?: boolean;
433
+ resumeChunks?: readonly SynthesizedChunk[];
434
+ resumeChunkIndices?: readonly number[];
435
+ customMerger?: CustomAudioMerger;
436
+ outputMimeType?: string;
437
+ postMergeValidator?: PostMergeValidator;
438
+ resumeValidation?: ResumeValidationMode;
439
+ }
440
+ type SsmlSynthesisChunksSafeResult = Result<SsmlSynthesisResult, never> | Result<never, ChunkValidationError> | Result<never, BatchChunkValidationError> | Result<never, SsmlSynthesisError | ChunkValidationError>;
441
+ interface SynthesisClient {
442
+ synthesizeSsml(ssml: string, options?: Partial<SynthesizeChunksOptions>): Promise<SsmlSynthesisResult>;
443
+ synthesizeChunks?(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeChunksOptions): Promise<SsmlSynthesisResult>;
444
+ }
445
+ /** Validates SSML before invoking Azure and converts validation/API failures to one result shape. */
446
+ declare function synthesizeSsmlSafe(client: Pick<AzureTtsClient, "synthesizeSsml"> | SynthesisClient, ssml: string, options?: SynthesizeSsmlSafeOptions): Promise<SsmlSynthesisSafeResult>;
447
+ /** Validates every chunk before synthesis and returns a chunk-addressable result. */
448
+ declare function synthesizeSsmlChunksSafe(client: Pick<AzureTtsClient, "synthesizeSsml" | "synthesizeChunks"> | SynthesisClient, chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeSsmlChunksSafeOptions): Promise<SsmlSynthesisChunksSafeResult>;
449
+
450
+ declare class AzureTtsClient {
451
+ #private;
452
+ constructor(options: AzureTtsClientOptions);
453
+ synthesize(ssml: string): Promise<ArrayBuffer>;
454
+ synthesizeSsml(ssml: string, options?: Partial<TtsConfig>): Promise<SsmlSynthesisResult>;
455
+ synthesizeChunks(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeChunksOptions): Promise<SsmlSynthesisResult>;
456
+ synthesizeSsmlSafe(ssml: string, options?: SynthesizeSsmlSafeOptions): Promise<SsmlSynthesisSafeResult>;
457
+ synthesizeChunksSafe(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeSsmlChunksSafeOptions): Promise<SsmlSynthesisChunksSafeResult>;
458
+ synthesizeSsmlChunksSafe(chunks: readonly (SsmlSynthesisChunk | string)[], options?: SynthesizeSsmlChunksSafeOptions): Promise<SsmlSynthesisChunksSafeResult>;
459
+ }
460
+
421
461
  type MergeAudioFormat = "wav" | "mp3" | "raw";
422
462
  interface MergeAudioOptions {
423
463
  format: AzureTtsOutputFormat;
@@ -430,10 +470,21 @@ type InputAudioSpecs = AudioSpecification[];
430
470
  * The complete SSML is included so changes to voice, language, prosody, or text
431
471
  * invalidate a cached result even when those settings are nested in the markup.
432
472
  */
433
- declare function computeChunkFingerprint(ssml: string, outputFormat?: string): string;
473
+ interface ChunkFingerprintOptions {
474
+ outputFormat?: string;
475
+ region?: string;
476
+ endpoint?: string;
477
+ voice?: string;
478
+ lang?: string;
479
+ schemaVersion?: string;
480
+ fingerprintSchemaVersion?: string;
481
+ customHeaders?: Readonly<Record<string, string>>;
482
+ }
483
+ declare function computeChunkFingerprint(ssml: string, outputFormat?: string, options?: Omit<ChunkFingerprintOptions, "outputFormat">): string;
434
484
  interface MergeSynthesisOptions extends MergeAudioOptions {
435
485
  customMerger?: CustomAudioMerger;
436
486
  postMergeValidator?: PostMergeValidator;
487
+ deadline?: DeadlineController;
437
488
  }
438
489
  type AsyncMergeSynthesisOptions = MergeSynthesisOptions & {
439
490
  customMerger: NonNullable<MergeSynthesisOptions["customMerger"]>;
@@ -485,4 +536,4 @@ interface AzureVoiceCatalog {
485
536
  /** Fetches and deduplicates the current Azure Speech voice catalog for one or more regions. */
486
537
  declare function fetchAzureVoiceCatalog(options: FetchAzureVoiceCatalogOptions): Promise<AzureVoiceCatalog>;
487
538
 
488
- 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, type ChunkExecutionState, type ChunkExecutionStatus, 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 ResumeValidationMode, 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, computeChunkFingerprint, fetchAzureVoiceCatalog, getRetryAfterDelayMs, inspectAudioSpecification, mergeAudioBuffers, mergeSynthesisResults, resolveMergeAudioFormat, resolveMimeType, synthesizeSpeech, synthesizeSsml, synthesizeSsmlChunks, synthesizeSsmlChunksSafe, synthesizeSsmlSafe };
539
+ 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, type ChunkExecutionState, type ChunkExecutionStatus, type ChunkFingerprintOptions, ChunkValidationError, type CustomAudioMerger, type CustomMergerContext, DEFAULT_OUTPUT_FORMAT, DeadlineController, type FetchAzureVoiceCatalogOptions, type FetchedAzureVoiceCatalogMetadata, IncompleteChunkSetError, type InputAudioSpecs, type MappingStatus, type MergeAudioFormat, type MergeAudioOptions, MergeError, type MergeSynthesisOptions, type MergedSynthesisResult, type PartialChunkSynthesisResult, type PartialSynthesisResult, type PostMergeValidator, type Result, type ResumeValidationMode, type RetryOptions, type SerializedChunkError, type SerializedChunkErrorCode, type SerializedExecutionError, 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, computeChunkFingerprint, fetchAzureVoiceCatalog, getRetryAfterDelayMs, inspectAudioSpecification, mergeAudioBuffers, mergeSynthesisResults, resolveMergeAudioFormat, resolveMimeType, serializeChunkError, synthesizeSpeech, synthesizeSsml, synthesizeSsmlChunks, synthesizeSsmlChunksSafe, synthesizeSsmlSafe };