@pie-players/pie-tts 0.3.43 → 0.3.45

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
@@ -2,6 +2,9 @@
2
2
 
3
3
  TTS interfaces and types for PIE Assessment Toolkit - Pure TypeScript with no UI dependencies.
4
4
 
5
+ For the cross-package TTS architecture, provider layering, and server/client
6
+ runtime flow, see [TTS Architecture](../../docs/accessibility/tts-architecture.md).
7
+
5
8
  ## Purpose
6
9
 
7
10
  This package provides the foundational interfaces and types for building TTS (Text-to-Speech) providers in the PIE ecosystem. It has **zero dependencies** and no UI framework requirements, making it suitable for:
package/dist/index.d.ts CHANGED
@@ -5,4 +5,3 @@
5
5
  * No UI dependencies - pure TypeScript interfaces.
6
6
  */
7
7
  export type { ITTSProvider, ITTSProviderImplementation, StandardTTSConfig, TTSSpeechSegment, TTSConfig, TTSConfigExtensions, TTSFeature, TTSProviderCapabilities, } from "./provider-interface.js";
8
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG","sourcesContent":["/**\n * @pie-players/pie-tts-core\n *\n * Core TTS interfaces and types for PIE Assessment Toolkit.\n * No UI dependencies - pure TypeScript interfaces.\n */\n\nexport type {\n\tITTSProvider,\n\tITTSProviderImplementation,\n\tStandardTTSConfig,\n\tTTSSpeechSegment,\n\tTTSConfig,\n\tTTSConfigExtensions,\n\tTTSFeature,\n\tTTSProviderCapabilities,\n} from \"./provider-interface.js\";\n"]}
@@ -66,6 +66,11 @@ export interface TTSConfigExtensions {
66
66
  * @example { engine: 'neural' } for AWS Polly
67
67
  */
68
68
  providerOptions?: Record<string, unknown>;
69
+ /**
70
+ * Internal read-along hint used by the assessment toolkit to choose between
71
+ * per-token math highlighting and expression-level math highlighting.
72
+ */
73
+ mathTokenHighlighting?: boolean;
69
74
  }
70
75
  /**
71
76
  * Complete TTS configuration combining standard parameters and extensions.
@@ -211,6 +216,19 @@ export interface TTSProviderCapabilities {
211
216
  * Supports pitch control
212
217
  */
213
218
  supportsPitchControl: boolean;
219
+ /**
220
+ * Supports SSML markup (W3C SSML 1.1) in the text passed to `speak`.
221
+ *
222
+ * When `true`, callers may pass an SSML document (e.g. `<speak>…</speak>`)
223
+ * and the provider will voice the markup rather than read the tags aloud.
224
+ * When `false` or omitted, callers must pass plain text — the browser Web
225
+ * Speech API, for example, speaks tags literally.
226
+ *
227
+ * Treat a missing value as `false`.
228
+ *
229
+ * @standard W3C SSML 1.1
230
+ */
231
+ supportsSSML?: boolean;
214
232
  /**
215
233
  * Maximum text length (if limited)
216
234
  */
@@ -220,4 +238,3 @@ export interface TTSProviderCapabilities {
220
238
  * TTS features for capability checking
221
239
  */
222
240
  export type TTSFeature = "pause" | "resume" | "wordBoundary" | "voiceSelection" | "rateControl" | "pitchControl";
223
- //# sourceMappingURL=provider-interface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider-interface.js","sourceRoot":"","sources":["../src/provider-interface.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
1
+ {"version":3,"file":"provider-interface.js","sourceRoot":"","sources":["../src/provider-interface.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG","sourcesContent":["/**\n * TTS Provider Interfaces\n *\n * Defines the contract for text-to-speech providers.\n * Providers are stateless factories that create configured TTS implementations.\n *\n * Part of PIE TTS Core - No UI dependencies.\n */\n\n/**\n * Standard TTS configuration parameters based on W3C Web Speech API.\n *\n * These are portable across all TTS providers (browser, AWS Polly, Google Cloud, etc.)\n * and align with the W3C Web Speech API specification.\n *\n * @see https://w3c.github.io/speech-api/\n */\nexport interface StandardTTSConfig {\n\t/**\n\t * Voice identifier (provider-specific)\n\t *\n\t * @standard W3C Web Speech API (concept)\n\t * @example \"Joanna\" (Polly), \"en-US-Standard-A\" (Google), browser voice name\n\t */\n\tvoice?: string;\n\n\t/**\n\t * Speech rate (speed multiplier)\n\t *\n\t * @standard W3C Web Speech API\n\t * @range 0.25 to 4.0\n\t * @default 1.0\n\t */\n\trate?: number;\n\n\t/**\n\t * Pitch adjustment\n\t *\n\t * @standard W3C Web Speech API\n\t * @range 0 to 2 (as multiplier)\n\t * @default 1.0\n\t */\n\tpitch?: number;\n}\n\n/**\n * Provider-specific extensions for TTS configuration.\n *\n * These are NOT part of W3C standards and support varies by provider.\n */\nexport interface TTSConfigExtensions {\n\t/**\n\t * Organization/tenant identifier\n\t *\n\t * @extension Application-specific\n\t * @use Multi-tenant applications\n\t */\n\torganizationId?: string;\n\n\t/**\n\t * Provider region or endpoint\n\t *\n\t * @extension Provider-specific\n\t * @example \"us-east-1\" (AWS), \"us-central1\" (Google Cloud)\n\t */\n\tregion?: string;\n\n\t/**\n\t * Arbitrary provider-specific options\n\t *\n\t * @extension Extensibility point\n\t * @example { engine: 'neural' } for AWS Polly\n\t */\n\tproviderOptions?: Record<string, unknown>;\n\n\t/**\n\t * Internal read-along hint used by the assessment toolkit to choose between\n\t * per-token math highlighting and expression-level math highlighting.\n\t */\n\tmathTokenHighlighting?: boolean;\n}\n\n/**\n * Complete TTS configuration combining standard parameters and extensions.\n *\n * @example Basic usage (portable)\n * ```typescript\n * const config: TTSConfig = {\n * voice: \"Joanna\",\n * rate: 1.0,\n * pitch: 1.0\n * };\n * ```\n *\n * @example Advanced usage with extensions\n * ```typescript\n * const config: TTSConfig = {\n * voice: \"Joanna\",\n * rate: 1.0,\n * // Extensions\n * region: \"us-east-1\",\n * organizationId: \"acme-corp\",\n * providerOptions: { engine: \"neural\" }\n * };\n * ```\n */\nexport interface TTSConfig extends StandardTTSConfig, TTSConfigExtensions {}\n\n/**\n * TTS Provider interface\n *\n * Providers are stateless factories that create TTS implementations.\n * They describe capabilities and create configured instances.\n */\nexport interface ITTSProvider {\n\t/**\n\t * Unique identifier for this provider\n\t */\n\treadonly providerId: string;\n\n\t/**\n\t * Human-readable provider name\n\t */\n\treadonly providerName: string;\n\n\t/**\n\t * Provider version\n\t */\n\treadonly version: string;\n\n\t/**\n\t * Initialize and create a configured TTS implementation\n\t */\n\tinitialize(config: TTSConfig): Promise<ITTSProviderImplementation>;\n\n\t/**\n\t * Check if a specific feature is supported\n\t */\n\tsupportsFeature(feature: TTSFeature): boolean;\n\n\t/**\n\t * Get provider capabilities\n\t */\n\tgetCapabilities(): TTSProviderCapabilities;\n\n\t/**\n\t * Clean up provider resources\n\t */\n\tdestroy(): void;\n}\n\n/**\n * TTS Provider Implementation interface\n *\n * The actual TTS implementation that handles playback.\n * Created by ITTSProvider.initialize()\n */\nexport interface ITTSProviderImplementation {\n\t/**\n\t * Speak text\n\t */\n\tspeak(text: string): Promise<void>;\n\n\t/**\n\t * Speak pre-segmented text with optional pause metadata.\n\t *\n\t * Providers that support this can preserve segment boundaries\n\t * while still emitting word boundaries in global offsets.\n\t */\n\tspeakSegments?(segments: TTSSpeechSegment[]): Promise<void>;\n\n\t/**\n\t * Pause playback\n\t */\n\tpause(): void;\n\n\t/**\n\t * Resume playback\n\t */\n\tresume(): void;\n\n\t/**\n\t * Stop playback\n\t */\n\tstop(): void;\n\n\t/**\n\t * Check if currently playing\n\t */\n\tisPlaying(): boolean;\n\n\t/**\n\t * Check if paused\n\t */\n\tisPaused(): boolean;\n\n\t/**\n\t * Word boundary callback (optional)\n\t * Called during speech for word highlighting\n\t */\n\tonWordBoundary?: (word: string, position: number, length?: number) => void;\n}\n\n/**\n * Pre-segmented speech unit with global offsets.\n */\nexport interface TTSSpeechSegment {\n\ttext: string;\n\tstartOffset: number;\n\tpauseMsAfter?: number;\n}\n\n/**\n * TTS Provider capabilities\n *\n * Describes which features a provider supports\n */\nexport interface TTSProviderCapabilities {\n\t/**\n\t * Supports pause/resume\n\t */\n\tsupportsPause: boolean;\n\n\t/**\n\t * Supports resume after pause\n\t */\n\tsupportsResume: boolean;\n\n\t/**\n\t * Supports word boundary events for highlighting\n\t */\n\tsupportsWordBoundary: boolean;\n\n\t/**\n\t * Supports voice selection\n\t */\n\tsupportsVoiceSelection: boolean;\n\n\t/**\n\t * Supports rate control (speed)\n\t */\n\tsupportsRateControl: boolean;\n\n\t/**\n\t * Supports pitch control\n\t */\n\tsupportsPitchControl: boolean;\n\n\t/**\n\t * Supports SSML markup (W3C SSML 1.1) in the text passed to `speak`.\n\t *\n\t * When `true`, callers may pass an SSML document (e.g. `<speak>…</speak>`)\n\t * and the provider will voice the markup rather than read the tags aloud.\n\t * When `false` or omitted, callers must pass plain text — the browser Web\n\t * Speech API, for example, speaks tags literally.\n\t *\n\t * Treat a missing value as `false`.\n\t *\n\t * @standard W3C SSML 1.1\n\t */\n\tsupportsSSML?: boolean;\n\n\t/**\n\t * Maximum text length (if limited)\n\t */\n\tmaxTextLength?: number;\n}\n\n/**\n * TTS features for capability checking\n */\nexport type TTSFeature =\n\t| \"pause\"\n\t| \"resume\"\n\t| \"wordBoundary\"\n\t| \"voiceSelection\"\n\t| \"rateControl\"\n\t| \"pitchControl\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-players/pie-tts",
3
- "version": "0.3.43",
3
+ "version": "0.3.45",
4
4
  "author": "PIE Framework",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EACX,YAAY,EACZ,0BAA0B,EAC1B,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,EACT,mBAAmB,EACnB,UAAU,EACV,uBAAuB,GACvB,MAAM,yBAAyB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"provider-interface.d.ts","sourceRoot":"","sources":["../src/provider-interface.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;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