@framers/agentos 0.1.110 → 0.1.112

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/dist/api/agency.d.ts.map +1 -1
  2. package/dist/api/agency.js +38 -2
  3. package/dist/api/agency.js.map +1 -1
  4. package/dist/api/agent.js +1 -1
  5. package/dist/api/agent.js.map +1 -1
  6. package/dist/api/strategies/debate.d.ts.map +1 -1
  7. package/dist/api/strategies/debate.js.map +1 -1
  8. package/dist/api/strategies/graph.d.ts.map +1 -1
  9. package/dist/api/strategies/graph.js +1 -2
  10. package/dist/api/strategies/graph.js.map +1 -1
  11. package/dist/api/strategies/hierarchical.d.ts.map +1 -1
  12. package/dist/api/strategies/hierarchical.js +1 -2
  13. package/dist/api/strategies/hierarchical.js.map +1 -1
  14. package/dist/api/strategies/index.d.ts +1 -9
  15. package/dist/api/strategies/index.d.ts.map +1 -1
  16. package/dist/api/strategies/index.js +1 -11
  17. package/dist/api/strategies/index.js.map +1 -1
  18. package/dist/api/strategies/parallel.d.ts.map +1 -1
  19. package/dist/api/strategies/parallel.js +23 -4
  20. package/dist/api/strategies/parallel.js.map +1 -1
  21. package/dist/api/strategies/review-loop.d.ts.map +1 -1
  22. package/dist/api/strategies/review-loop.js.map +1 -1
  23. package/dist/api/strategies/sequential.d.ts.map +1 -1
  24. package/dist/api/strategies/sequential.js +1 -2
  25. package/dist/api/strategies/sequential.js.map +1 -1
  26. package/dist/api/strategies/shared.d.ts +8 -0
  27. package/dist/api/strategies/shared.d.ts.map +1 -1
  28. package/dist/api/strategies/shared.js +10 -1
  29. package/dist/api/strategies/shared.js.map +1 -1
  30. package/dist/api/types.d.ts +6 -0
  31. package/dist/api/types.d.ts.map +1 -1
  32. package/dist/api/types.js.map +1 -1
  33. package/dist/memory/AgentMemory.d.ts +2 -1
  34. package/dist/memory/AgentMemory.d.ts.map +1 -1
  35. package/dist/memory/AgentMemory.js +1 -1
  36. package/dist/memory/AgentMemory.js.map +1 -1
  37. package/dist/memory/CognitiveMemoryManager.d.ts.map +1 -1
  38. package/dist/memory/CognitiveMemoryManager.js +7 -2
  39. package/dist/memory/CognitiveMemoryManager.js.map +1 -1
  40. package/dist/memory/facade/Memory.d.ts.map +1 -1
  41. package/dist/memory/facade/Memory.js +6 -9
  42. package/dist/memory/facade/Memory.js.map +1 -1
  43. package/dist/memory/store/MemoryStore.d.ts +9 -0
  44. package/dist/memory/store/MemoryStore.d.ts.map +1 -1
  45. package/dist/memory/store/MemoryStore.js +66 -6
  46. package/dist/memory/store/MemoryStore.js.map +1 -1
  47. package/dist/memory/store/SqliteMemoryGraph.d.ts.map +1 -1
  48. package/dist/memory/store/SqliteMemoryGraph.js +27 -13
  49. package/dist/memory/store/SqliteMemoryGraph.js.map +1 -1
  50. package/dist/speech/FallbackProxy.d.ts +194 -41
  51. package/dist/speech/FallbackProxy.d.ts.map +1 -1
  52. package/dist/speech/FallbackProxy.js +155 -32
  53. package/dist/speech/FallbackProxy.js.map +1 -1
  54. package/dist/speech/SpeechProviderResolver.d.ts +278 -36
  55. package/dist/speech/SpeechProviderResolver.d.ts.map +1 -1
  56. package/dist/speech/SpeechProviderResolver.js +306 -40
  57. package/dist/speech/SpeechProviderResolver.js.map +1 -1
  58. package/dist/speech/providers/AssemblyAISTTProvider.d.ts +119 -19
  59. package/dist/speech/providers/AssemblyAISTTProvider.d.ts.map +1 -1
  60. package/dist/speech/providers/AssemblyAISTTProvider.js +153 -25
  61. package/dist/speech/providers/AssemblyAISTTProvider.js.map +1 -1
  62. package/dist/speech/providers/AzureSpeechSTTProvider.d.ts +121 -17
  63. package/dist/speech/providers/AzureSpeechSTTProvider.d.ts.map +1 -1
  64. package/dist/speech/providers/AzureSpeechSTTProvider.js +122 -14
  65. package/dist/speech/providers/AzureSpeechSTTProvider.js.map +1 -1
  66. package/dist/speech/providers/AzureSpeechTTSProvider.d.ts +130 -15
  67. package/dist/speech/providers/AzureSpeechTTSProvider.d.ts.map +1 -1
  68. package/dist/speech/providers/AzureSpeechTTSProvider.js +163 -18
  69. package/dist/speech/providers/AzureSpeechTTSProvider.js.map +1 -1
  70. package/dist/speech/providers/BuiltInAdaptiveVadProvider.d.ts +159 -0
  71. package/dist/speech/providers/BuiltInAdaptiveVadProvider.d.ts.map +1 -1
  72. package/dist/speech/providers/BuiltInAdaptiveVadProvider.js +119 -0
  73. package/dist/speech/providers/BuiltInAdaptiveVadProvider.js.map +1 -1
  74. package/dist/speech/providers/DeepgramBatchSTTProvider.d.ts +102 -16
  75. package/dist/speech/providers/DeepgramBatchSTTProvider.d.ts.map +1 -1
  76. package/dist/speech/providers/DeepgramBatchSTTProvider.js +108 -13
  77. package/dist/speech/providers/DeepgramBatchSTTProvider.js.map +1 -1
  78. package/dist/speech/providers/ElevenLabsTextToSpeechProvider.d.ts +149 -0
  79. package/dist/speech/providers/ElevenLabsTextToSpeechProvider.d.ts.map +1 -1
  80. package/dist/speech/providers/ElevenLabsTextToSpeechProvider.js +137 -2
  81. package/dist/speech/providers/ElevenLabsTextToSpeechProvider.js.map +1 -1
  82. package/dist/speech/providers/OpenAITextToSpeechProvider.d.ts +125 -0
  83. package/dist/speech/providers/OpenAITextToSpeechProvider.d.ts.map +1 -1
  84. package/dist/speech/providers/OpenAITextToSpeechProvider.js +128 -4
  85. package/dist/speech/providers/OpenAITextToSpeechProvider.js.map +1 -1
  86. package/dist/speech/providers/OpenAIWhisperSpeechToTextProvider.d.ts +110 -0
  87. package/dist/speech/providers/OpenAIWhisperSpeechToTextProvider.d.ts.map +1 -1
  88. package/dist/speech/providers/OpenAIWhisperSpeechToTextProvider.js +115 -0
  89. package/dist/speech/providers/OpenAIWhisperSpeechToTextProvider.js.map +1 -1
  90. package/dist/voice/CallManager.d.ts.map +1 -1
  91. package/dist/voice/CallManager.js +9 -1
  92. package/dist/voice/CallManager.js.map +1 -1
  93. package/dist/voice/MediaStreamParser.d.ts +115 -6
  94. package/dist/voice/MediaStreamParser.d.ts.map +1 -1
  95. package/dist/voice/MediaStreamParser.js +44 -0
  96. package/dist/voice/MediaStreamParser.js.map +1 -1
  97. package/dist/voice/TelephonyStreamTransport.d.ts +112 -20
  98. package/dist/voice/TelephonyStreamTransport.d.ts.map +1 -1
  99. package/dist/voice/TelephonyStreamTransport.js +136 -30
  100. package/dist/voice/TelephonyStreamTransport.js.map +1 -1
  101. package/dist/voice/parsers/PlivoMediaStreamParser.d.ts +64 -6
  102. package/dist/voice/parsers/PlivoMediaStreamParser.d.ts.map +1 -1
  103. package/dist/voice/parsers/PlivoMediaStreamParser.js +67 -6
  104. package/dist/voice/parsers/PlivoMediaStreamParser.js.map +1 -1
  105. package/dist/voice/parsers/TelnyxMediaStreamParser.d.ts +55 -8
  106. package/dist/voice/parsers/TelnyxMediaStreamParser.d.ts.map +1 -1
  107. package/dist/voice/parsers/TelnyxMediaStreamParser.js +60 -9
  108. package/dist/voice/parsers/TelnyxMediaStreamParser.js.map +1 -1
  109. package/dist/voice/parsers/TwilioMediaStreamParser.d.ts +73 -11
  110. package/dist/voice/parsers/TwilioMediaStreamParser.d.ts.map +1 -1
  111. package/dist/voice/parsers/TwilioMediaStreamParser.js +81 -12
  112. package/dist/voice/parsers/TwilioMediaStreamParser.js.map +1 -1
  113. package/dist/voice/providers/plivo.d.ts +108 -12
  114. package/dist/voice/providers/plivo.d.ts.map +1 -1
  115. package/dist/voice/providers/plivo.js +106 -9
  116. package/dist/voice/providers/plivo.js.map +1 -1
  117. package/dist/voice/providers/telnyx.d.ts +110 -20
  118. package/dist/voice/providers/telnyx.d.ts.map +1 -1
  119. package/dist/voice/providers/telnyx.js +111 -20
  120. package/dist/voice/providers/telnyx.js.map +1 -1
  121. package/dist/voice/providers/twilio.d.ts +91 -13
  122. package/dist/voice/providers/twilio.d.ts.map +1 -1
  123. package/dist/voice/providers/twilio.js +94 -14
  124. package/dist/voice/providers/twilio.js.map +1 -1
  125. package/dist/voice/twiml.d.ts +70 -12
  126. package/dist/voice/twiml.d.ts.map +1 -1
  127. package/dist/voice/twiml.js +70 -12
  128. package/dist/voice/twiml.js.map +1 -1
  129. package/dist/voice/types.d.ts +142 -15
  130. package/dist/voice/types.d.ts.map +1 -1
  131. package/dist/voice/types.js +34 -3
  132. package/dist/voice/types.js.map +1 -1
  133. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AzureSpeechTTSProvider.js","sourceRoot":"","sources":["../../../src/speech/providers/AzureSpeechTTSProvider.ts"],"names":[],"mappings":"AAmCA;;;;GAIG;AACH,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,IAAI;SACR,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;GAKG;AACH,SAAS,SAAS,CAAC,IAAY,EAAE,KAAa;IAC5C,OAAO,CACL,oFAAoF;QACpF,gBAAgB,KAAK,KAAK,SAAS,CAAC,IAAI,CAAC,UAAU;QACnD,UAAU,CACX,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,QAAQ,CAAC,KAAsB;IACtC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC;IAC3C,OAAO;QACL,EAAE,EAAE,KAAK,CAAC,SAAS;QACnB,IAAI,EAAE,KAAK,CAAC,WAAW;QACvB,MAAM,EACJ,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,SAAS;YAC9D,CAAC,CAAE,MAAwC;YAC3C,CAAC,CAAC,MAAM;QACZ,IAAI,EAAE,KAAK,CAAC,UAAU;QACtB,QAAQ,EAAE,kBAAkB;KAC7B,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,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AAC,EAAE,6CAA6C;YACtD,SAAS,EAAE,KAAK;YAChB,YAAY,EAAE,IAAI,CAAC,WAAW;YAC9B,KAAK,EAAE;gBACL,UAAU,EAAE,IAAI,CAAC,MAAM;gBACvB,SAAS,EAAE,kBAAkB;aAC9B;SACF,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,mBAAmB;QACvB,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;QACpC,MAAM,GAAG,GAAG,WAAW,MAAM,yDAAyD,CAAC;QAEvF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE;YACzC,OAAO,EAAE,EAAE,2BAA2B,EAAE,GAAG,EAAE;SAC9C,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,mCAAmC,QAAQ,CAAC,MAAM,MAAM,OAAO,EAAE,CAAC,CAAC;QACrF,CAAC;QAED,MAAM,MAAM,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAsB,CAAC;QAC5D,OAAO,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;CACF"}
@@ -1,20 +1,179 @@
1
1
  import type { AdaptiveVADConfig } from '../../core/audio/AdaptiveVAD.js';
2
2
  import type { CalibrationConfig } from '../../core/audio/EnvironmentalCalibrator.js';
3
3
  import type { SpeechVadDecision, SpeechVadProvider } from '../types.js';
4
+ /**
5
+ * Configuration for the {@link BuiltInAdaptiveVadProvider}.
6
+ *
7
+ * All fields are optional — sensible defaults are applied for 16kHz mono
8
+ * audio with 20ms frames (the standard voice pipeline configuration).
9
+ *
10
+ * @see {@link BuiltInAdaptiveVadProvider} for usage examples
11
+ * @see {@link AdaptiveVADConfig} for detailed VAD tuning parameters
12
+ * @see {@link CalibrationConfig} for environmental calibration settings
13
+ */
4
14
  export interface BuiltInAdaptiveVadProviderConfig {
15
+ /**
16
+ * Audio sample rate in Hz. Must match the actual audio stream.
17
+ * @default 16_000 (16 kHz, standard for voice processing)
18
+ */
5
19
  sampleRate?: number;
20
+ /**
21
+ * Duration of each audio frame in milliseconds. Determines the number
22
+ * of samples expected in each `processFrame()` call.
23
+ * At 16kHz with 20ms frames, each frame is 320 samples.
24
+ * @default 20
25
+ */
6
26
  frameDurationMs?: number;
27
+ /**
28
+ * Environmental calibration settings. Controls how the noise floor and
29
+ * spectral profile are estimated from ambient audio.
30
+ *
31
+ * @see {@link CalibrationConfig} for available options
32
+ */
7
33
  calibration?: CalibrationConfig;
34
+ /**
35
+ * VAD algorithm configuration. Controls speech detection thresholds,
36
+ * minimum speech duration, hangover period, etc.
37
+ *
38
+ * @see {@link AdaptiveVADConfig} for available options
39
+ */
8
40
  vad?: AdaptiveVADConfig;
9
41
  }
42
+ /**
43
+ * Built-in voice activity detection (VAD) provider backed by the
44
+ * {@link AdaptiveVAD} engine and {@link EnvironmentalCalibrator}.
45
+ *
46
+ * This is the default VAD provider in AgentOS and requires no external
47
+ * dependencies or API keys. It operates entirely locally on raw audio frames.
48
+ *
49
+ * ## How It Works
50
+ *
51
+ * 1. The {@link EnvironmentalCalibrator} continuously estimates the ambient
52
+ * noise floor and spectral profile from incoming audio frames.
53
+ * 2. The {@link AdaptiveVAD} uses the calibrator's noise profile to set
54
+ * dynamic thresholds for speech detection — louder environments get
55
+ * higher thresholds to avoid false positives.
56
+ * 3. Each `processFrame()` call returns a {@link SpeechVadDecision} with
57
+ * `isSpeech`, `confidence`, the raw VAD result, and the current noise profile.
58
+ *
59
+ * ## Configuration Defaults
60
+ *
61
+ * - Sample rate: 16 kHz (standard for voice pipelines)
62
+ * - Frame duration: 20ms (320 samples per frame)
63
+ * - VAD and calibration: Use sensible defaults from the underlying engines
64
+ *
65
+ * @see {@link BuiltInAdaptiveVadProviderConfig} for configuration options
66
+ * @see {@link AdaptiveVAD} for the underlying VAD algorithm
67
+ * @see {@link EnvironmentalCalibrator} for the noise profiling engine
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * const vad = new BuiltInAdaptiveVadProvider({
72
+ * sampleRate: 16_000,
73
+ * frameDurationMs: 20,
74
+ * vad: { minSpeechDurationMs: 100 },
75
+ * });
76
+ *
77
+ * const frame = new Float32Array(320); // 20ms at 16kHz
78
+ * // ... fill frame with audio samples ...
79
+ * const decision = vad.processFrame(frame);
80
+ * if (decision.isSpeech) {
81
+ * console.log(`Speech detected (confidence: ${decision.confidence})`);
82
+ * }
83
+ * ```
84
+ */
10
85
  export declare class BuiltInAdaptiveVadProvider implements SpeechVadProvider {
86
+ /** Unique provider identifier used for registration and resolution. */
11
87
  readonly id = "agentos-adaptive-vad";
88
+ /** Human-readable display name for UI and logging. */
12
89
  readonly displayName = "AgentOS Adaptive VAD";
90
+ /**
91
+ * Environmental calibrator that estimates the ambient noise profile.
92
+ * Shared with the VAD engine for dynamic threshold adaptation.
93
+ */
13
94
  private readonly calibrator;
95
+ /**
96
+ * Adaptive VAD engine that performs frame-by-frame speech detection
97
+ * using the calibrator's noise profile for dynamic thresholding.
98
+ */
14
99
  private readonly vad;
100
+ /**
101
+ * Creates a new BuiltInAdaptiveVadProvider.
102
+ *
103
+ * Initializes both the environmental calibrator and the adaptive VAD
104
+ * engine with the provided or default configuration.
105
+ *
106
+ * @param config - Optional VAD configuration. All fields default to
107
+ * standard values suitable for 16kHz mono voice audio.
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * // Default configuration (16kHz, 20ms frames)
112
+ * const vad = new BuiltInAdaptiveVadProvider();
113
+ *
114
+ * // Custom configuration
115
+ * const vad = new BuiltInAdaptiveVadProvider({
116
+ * sampleRate: 48_000,
117
+ * frameDurationMs: 10,
118
+ * vad: { minSpeechDurationMs: 200 },
119
+ * });
120
+ * ```
121
+ */
15
122
  constructor(config?: BuiltInAdaptiveVadProviderConfig);
123
+ /**
124
+ * Process a single audio frame and return a speech/non-speech decision.
125
+ *
126
+ * This method must be called sequentially with consecutive audio frames.
127
+ * The VAD maintains internal state (speech onset tracking, hangover counters)
128
+ * that depends on temporal continuity between frames.
129
+ *
130
+ * @param frame - A Float32Array of audio samples for one frame. The expected
131
+ * length is `sampleRate * frameDurationMs / 1000` (e.g. 320 for 16kHz/20ms).
132
+ * Samples should be normalized to the range [-1.0, 1.0].
133
+ * @returns A decision object with `isSpeech`, `confidence`, the raw VAD result,
134
+ * and the current environmental noise profile.
135
+ *
136
+ * @example
137
+ * ```ts
138
+ * const frame = new Float32Array(320);
139
+ * // ... fill with audio samples ...
140
+ * const decision = vad.processFrame(frame);
141
+ * console.log(decision.isSpeech, decision.confidence);
142
+ * ```
143
+ */
16
144
  processFrame(frame: Float32Array): SpeechVadDecision;
145
+ /**
146
+ * Reset the VAD state for a new audio session.
147
+ *
148
+ * Clears internal counters (speech onset tracking, hangover timers) so the
149
+ * VAD starts fresh. Should be called when starting a new conversation turn
150
+ * or after a significant audio gap. Does NOT reset the environmental
151
+ * calibrator — the noise profile persists across resets.
152
+ *
153
+ * @example
154
+ * ```ts
155
+ * // Start a new conversation turn
156
+ * vad.reset();
157
+ * ```
158
+ */
17
159
  reset(): void;
160
+ /**
161
+ * Returns the current environmental noise profile estimated by the calibrator.
162
+ *
163
+ * The noise profile includes the estimated noise floor RMS, spectral shape,
164
+ * and confidence metrics. Returns `null` if insufficient audio has been
165
+ * processed for a reliable estimate.
166
+ *
167
+ * @returns The current noise profile, or `null` if not yet calibrated.
168
+ *
169
+ * @example
170
+ * ```ts
171
+ * const profile = vad.getNoiseProfile();
172
+ * if (profile) {
173
+ * console.log(`Noise floor: ${profile.noiseFloorRms}`);
174
+ * }
175
+ * ```
176
+ */
18
177
  getNoiseProfile(): import("../../core/index.js").NoiseProfile | null;
19
178
  }
20
179
  //# sourceMappingURL=BuiltInAdaptiveVadProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BuiltInAdaptiveVadProvider.d.ts","sourceRoot":"","sources":["../../../src/speech/providers/BuiltInAdaptiveVadProvider.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EAClB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAExE,MAAM,WAAW,gCAAgC;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,GAAG,CAAC,EAAE,iBAAiB,CAAC;CACzB;AAED,qBAAa,0BAA2B,YAAW,iBAAiB;IAClE,SAAgB,EAAE,0BAA0B;IAC5C,SAAgB,WAAW,0BAA0B;IACrD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA0B;IACrD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAc;gBAEtB,MAAM,GAAE,gCAAqC;IAYzD,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,iBAAiB;IAUpD,KAAK,IAAI,IAAI;IAIb,eAAe;CAGhB"}
1
+ {"version":3,"file":"BuiltInAdaptiveVadProvider.d.ts","sourceRoot":"","sources":["../../../src/speech/providers/BuiltInAdaptiveVadProvider.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EAClB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAExE;;;;;;;;;GASG;AACH,MAAM,WAAW,gCAAgC;IAC/C;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAEhC;;;;;OAKG;IACH,GAAG,CAAC,EAAE,iBAAiB,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,qBAAa,0BAA2B,YAAW,iBAAiB;IAClE,uEAAuE;IACvE,SAAgB,EAAE,0BAA0B;IAE5C,sDAAsD;IACtD,SAAgB,WAAW,0BAA0B;IAErD;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA0B;IAErD;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAc;IAElC;;;;;;;;;;;;;;;;;;;;;OAqBG;gBACS,MAAM,GAAE,gCAAqC;IAYzD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,iBAAiB;IAUpD;;;;;;;;;;;;;OAaG;IACH,KAAK,IAAI,IAAI;IAIb;;;;;;;;;;;;;;;;OAgBG;IACH,eAAe;CAGhB"}
@@ -1,8 +1,75 @@
1
1
  import { AdaptiveVAD } from '../../core/audio/AdaptiveVAD.js';
2
2
  import { EnvironmentalCalibrator } from '../../core/audio/EnvironmentalCalibrator.js';
3
+ /**
4
+ * Built-in voice activity detection (VAD) provider backed by the
5
+ * {@link AdaptiveVAD} engine and {@link EnvironmentalCalibrator}.
6
+ *
7
+ * This is the default VAD provider in AgentOS and requires no external
8
+ * dependencies or API keys. It operates entirely locally on raw audio frames.
9
+ *
10
+ * ## How It Works
11
+ *
12
+ * 1. The {@link EnvironmentalCalibrator} continuously estimates the ambient
13
+ * noise floor and spectral profile from incoming audio frames.
14
+ * 2. The {@link AdaptiveVAD} uses the calibrator's noise profile to set
15
+ * dynamic thresholds for speech detection — louder environments get
16
+ * higher thresholds to avoid false positives.
17
+ * 3. Each `processFrame()` call returns a {@link SpeechVadDecision} with
18
+ * `isSpeech`, `confidence`, the raw VAD result, and the current noise profile.
19
+ *
20
+ * ## Configuration Defaults
21
+ *
22
+ * - Sample rate: 16 kHz (standard for voice pipelines)
23
+ * - Frame duration: 20ms (320 samples per frame)
24
+ * - VAD and calibration: Use sensible defaults from the underlying engines
25
+ *
26
+ * @see {@link BuiltInAdaptiveVadProviderConfig} for configuration options
27
+ * @see {@link AdaptiveVAD} for the underlying VAD algorithm
28
+ * @see {@link EnvironmentalCalibrator} for the noise profiling engine
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const vad = new BuiltInAdaptiveVadProvider({
33
+ * sampleRate: 16_000,
34
+ * frameDurationMs: 20,
35
+ * vad: { minSpeechDurationMs: 100 },
36
+ * });
37
+ *
38
+ * const frame = new Float32Array(320); // 20ms at 16kHz
39
+ * // ... fill frame with audio samples ...
40
+ * const decision = vad.processFrame(frame);
41
+ * if (decision.isSpeech) {
42
+ * console.log(`Speech detected (confidence: ${decision.confidence})`);
43
+ * }
44
+ * ```
45
+ */
3
46
  export class BuiltInAdaptiveVadProvider {
47
+ /**
48
+ * Creates a new BuiltInAdaptiveVadProvider.
49
+ *
50
+ * Initializes both the environmental calibrator and the adaptive VAD
51
+ * engine with the provided or default configuration.
52
+ *
53
+ * @param config - Optional VAD configuration. All fields default to
54
+ * standard values suitable for 16kHz mono voice audio.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * // Default configuration (16kHz, 20ms frames)
59
+ * const vad = new BuiltInAdaptiveVadProvider();
60
+ *
61
+ * // Custom configuration
62
+ * const vad = new BuiltInAdaptiveVadProvider({
63
+ * sampleRate: 48_000,
64
+ * frameDurationMs: 10,
65
+ * vad: { minSpeechDurationMs: 200 },
66
+ * });
67
+ * ```
68
+ */
4
69
  constructor(config = {}) {
70
+ /** Unique provider identifier used for registration and resolution. */
5
71
  this.id = 'agentos-adaptive-vad';
72
+ /** Human-readable display name for UI and logging. */
6
73
  this.displayName = 'AgentOS Adaptive VAD';
7
74
  this.calibrator = new EnvironmentalCalibrator({
8
75
  sampleRate: config.sampleRate ?? 16000,
@@ -10,6 +77,27 @@ export class BuiltInAdaptiveVadProvider {
10
77
  });
11
78
  this.vad = new AdaptiveVAD(config.vad ?? {}, this.calibrator, config.frameDurationMs ?? 20);
12
79
  }
80
+ /**
81
+ * Process a single audio frame and return a speech/non-speech decision.
82
+ *
83
+ * This method must be called sequentially with consecutive audio frames.
84
+ * The VAD maintains internal state (speech onset tracking, hangover counters)
85
+ * that depends on temporal continuity between frames.
86
+ *
87
+ * @param frame - A Float32Array of audio samples for one frame. The expected
88
+ * length is `sampleRate * frameDurationMs / 1000` (e.g. 320 for 16kHz/20ms).
89
+ * Samples should be normalized to the range [-1.0, 1.0].
90
+ * @returns A decision object with `isSpeech`, `confidence`, the raw VAD result,
91
+ * and the current environmental noise profile.
92
+ *
93
+ * @example
94
+ * ```ts
95
+ * const frame = new Float32Array(320);
96
+ * // ... fill with audio samples ...
97
+ * const decision = vad.processFrame(frame);
98
+ * console.log(decision.isSpeech, decision.confidence);
99
+ * ```
100
+ */
13
101
  processFrame(frame) {
14
102
  const result = this.vad.processFrame(frame);
15
103
  return {
@@ -19,9 +107,40 @@ export class BuiltInAdaptiveVadProvider {
19
107
  profile: this.calibrator.getCurrentProfile(),
20
108
  };
21
109
  }
110
+ /**
111
+ * Reset the VAD state for a new audio session.
112
+ *
113
+ * Clears internal counters (speech onset tracking, hangover timers) so the
114
+ * VAD starts fresh. Should be called when starting a new conversation turn
115
+ * or after a significant audio gap. Does NOT reset the environmental
116
+ * calibrator — the noise profile persists across resets.
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * // Start a new conversation turn
121
+ * vad.reset();
122
+ * ```
123
+ */
22
124
  reset() {
23
125
  this.vad.resetState();
24
126
  }
127
+ /**
128
+ * Returns the current environmental noise profile estimated by the calibrator.
129
+ *
130
+ * The noise profile includes the estimated noise floor RMS, spectral shape,
131
+ * and confidence metrics. Returns `null` if insufficient audio has been
132
+ * processed for a reliable estimate.
133
+ *
134
+ * @returns The current noise profile, or `null` if not yet calibrated.
135
+ *
136
+ * @example
137
+ * ```ts
138
+ * const profile = vad.getNoiseProfile();
139
+ * if (profile) {
140
+ * console.log(`Noise floor: ${profile.noiseFloorRms}`);
141
+ * }
142
+ * ```
143
+ */
25
144
  getNoiseProfile() {
26
145
  return this.calibrator.getCurrentProfile();
27
146
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BuiltInAdaptiveVadProvider.js","sourceRoot":"","sources":["../../../src/speech/providers/BuiltInAdaptiveVadProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AActF,MAAM,OAAO,0BAA0B;IAMrC,YAAY,SAA2C,EAAE;QALzC,OAAE,GAAG,sBAAsB,CAAC;QAC5B,gBAAW,GAAG,sBAAsB,CAAC;QAKnD,IAAI,CAAC,UAAU,GAAG,IAAI,uBAAuB,CAAC;YAC5C,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,KAAM;YACvC,GAAG,CAAC,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC;SAC9B,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,GAAG,IAAI,WAAW,CACxB,MAAM,CAAC,GAAG,IAAI,EAAE,EAChB,IAAI,CAAC,UAAU,EACf,MAAM,CAAC,eAAe,IAAI,EAAE,CAC7B,CAAC;IACJ,CAAC;IAED,YAAY,CAAC,KAAmB;QAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QAC5C,OAAO;YACL,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,MAAM;YACN,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE;SAC7C,CAAC;IACJ,CAAC;IAED,KAAK;QACH,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;IACxB,CA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aG;IACH,KAAK;QACH,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;IACxB,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,eAAe;QACb,OAAO,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC;IAC7C,CAAC;CACF"}
@@ -1,54 +1,140 @@
1
1
  import type { SpeechAudioInput, SpeechToTextProvider, SpeechTranscriptionOptions, SpeechTranscriptionResult } from '../types.js';
2
- /** Configuration for the DeepgramBatchSTTProvider. */
2
+ /**
3
+ * Configuration for the {@link DeepgramBatchSTTProvider}.
4
+ *
5
+ * @see {@link DeepgramBatchSTTProvider} for usage examples
6
+ */
3
7
  export interface DeepgramBatchSTTProviderConfig {
4
- /** Deepgram API key. */
8
+ /**
9
+ * Deepgram API key used for authentication.
10
+ * Sent as `Authorization: Token <apiKey>` in the request header.
11
+ */
5
12
  apiKey: string;
6
13
  /**
7
14
  * Deepgram model to use for transcription.
15
+ * See https://developers.deepgram.com/docs/models for available models.
8
16
  * @default 'nova-2'
9
17
  */
10
18
  model?: string;
11
19
  /**
12
- * BCP-47 language code, e.g. `'en-US'`.
13
- * When omitted Deepgram uses automatic language detection.
20
+ * BCP-47 language code, e.g. `'en-US'`, `'fr-FR'`, `'de-DE'`.
21
+ * When omitted, Deepgram applies automatic language detection.
22
+ * @default 'en-US' (set at transcribe-time if not configured here)
14
23
  */
15
24
  language?: string;
16
25
  /**
17
- * Custom fetch implementation, useful for testing.
18
- * Defaults to the global `fetch`.
26
+ * Custom fetch implementation for dependency injection in tests.
27
+ * When omitted, the global `fetch` is used. This allows tests to
28
+ * intercept HTTP calls without mocking globals.
29
+ * @default globalThis.fetch
19
30
  */
20
31
  fetchImpl?: typeof fetch;
21
32
  }
22
33
  /**
23
34
  * Speech-to-text provider that uses the Deepgram batch (pre-recorded) REST API.
24
35
  *
25
- * Sends audio as a raw binary body and returns a normalised
26
- * {@link SpeechTranscriptionResult}. Streaming is not supported — use a
27
- * Deepgram streaming adapter for real-time transcription.
36
+ * ## REST API Contract
37
+ *
38
+ * - **Endpoint:** `POST https://api.deepgram.com/v1/listen`
39
+ * - **Authentication:** `Authorization: Token <apiKey>` header
40
+ * - **Content-Type:** Set to the audio's MIME type (e.g. `audio/wav`)
41
+ * - **Body:** Raw audio bytes sent directly (no multipart form)
42
+ * - **Query parameters:** `model`, `punctuate`, `diarize`, `language`
43
+ * - **Response:** JSON containing `results.channels[].alternatives[]` with
44
+ * transcript text, confidence scores, and optional word-level timing
45
+ *
46
+ * ## Word-Level Diarization Mapping
47
+ *
48
+ * When `enableSpeakerDiarization` is `true`, the `diarize=true` query parameter
49
+ * is set. Deepgram then includes a `speaker` field (zero-based integer index) on
50
+ * each word in the response. These speaker indices are preserved through the
51
+ * {@link wordsToSegments} mapping into the normalized result.
52
+ *
53
+ * ## Error Handling
54
+ *
55
+ * Non-2xx responses from Deepgram trigger an `Error` with the HTTP status code
56
+ * and response body text included in the message for debugging. Network-level
57
+ * errors (DNS failures, timeouts) propagate as-is from the fetch implementation.
58
+ *
59
+ * Streaming is NOT supported by this provider — use a Deepgram WebSocket adapter
60
+ * for real-time transcription.
61
+ *
62
+ * @see {@link DeepgramBatchSTTProviderConfig} for configuration options
63
+ * @see {@link wordsToSegments} for the word-to-segment mapping logic
28
64
  *
29
65
  * @example
30
66
  * ```ts
31
- * const provider = new DeepgramBatchSTTProvider({ apiKey: process.env.DEEPGRAM_API_KEY! });
32
- * const result = await provider.transcribe({ data: audioBuffer, mimeType: 'audio/wav' });
67
+ * const provider = new DeepgramBatchSTTProvider({
68
+ * apiKey: process.env.DEEPGRAM_API_KEY!,
69
+ * model: 'nova-2',
70
+ * });
71
+ * const result = await provider.transcribe(
72
+ * { data: audioBuffer, mimeType: 'audio/wav' },
73
+ * { enableSpeakerDiarization: true },
74
+ * );
33
75
  * console.log(result.text);
76
+ * console.log(result.segments?.map(s => `[Speaker ${s.speaker}] ${s.text}`));
34
77
  * ```
35
78
  */
36
79
  export declare class DeepgramBatchSTTProvider implements SpeechToTextProvider {
37
80
  private readonly config;
81
+ /** Unique provider identifier used for registration and resolution. */
38
82
  readonly id = "deepgram-batch";
83
+ /** Human-readable display name for UI and logging. */
39
84
  readonly displayName = "Deepgram (Batch)";
85
+ /** This provider uses synchronous HTTP requests, not WebSocket streaming. */
40
86
  readonly supportsStreaming = false;
87
+ /** Fetch implementation — injected for testability, defaults to global fetch. */
41
88
  private readonly fetchImpl;
89
+ /**
90
+ * Creates a new DeepgramBatchSTTProvider.
91
+ *
92
+ * @param config - Provider configuration including API key and optional defaults.
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * const provider = new DeepgramBatchSTTProvider({
97
+ * apiKey: 'dg-xxxx',
98
+ * model: 'nova-2',
99
+ * language: 'en-US',
100
+ * });
101
+ * ```
102
+ */
42
103
  constructor(config: DeepgramBatchSTTProviderConfig);
43
- /** Returns the human-readable provider name. */
104
+ /**
105
+ * Returns the human-readable provider name.
106
+ *
107
+ * @returns The display name string `'Deepgram (Batch)'`.
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * provider.getProviderName(); // 'Deepgram (Batch)'
112
+ * ```
113
+ */
44
114
  getProviderName(): string;
45
115
  /**
46
116
  * Transcribes an audio buffer using the Deepgram pre-recorded API.
47
117
  *
48
- * @param audio - Raw audio data and associated metadata.
49
- * @param options - Optional transcription settings (language, diarization…).
50
- * @returns A promise resolving to the normalised transcription result.
51
- * @throws When the Deepgram API returns a non-2xx status.
118
+ * Sends the raw audio bytes as the request body (not multipart form) with
119
+ * the appropriate Content-Type header. The response is parsed and normalized
120
+ * into a {@link SpeechTranscriptionResult}.
121
+ *
122
+ * @param audio - Raw audio data and associated metadata (buffer, MIME type,
123
+ * duration). The `data` buffer is sent directly as the request body.
124
+ * @param options - Optional transcription settings. Supports `model`,
125
+ * `language`, and `enableSpeakerDiarization` overrides.
126
+ * @returns A promise resolving to the normalized transcription result with
127
+ * text, confidence, timing, and optional speaker-attributed segments.
128
+ * @throws {Error} When the Deepgram API returns a non-2xx status code.
129
+ * The error message includes the HTTP status and response body for debugging.
130
+ *
131
+ * @example
132
+ * ```ts
133
+ * const result = await provider.transcribe(
134
+ * { data: wavBuffer, mimeType: 'audio/wav', durationSeconds: 5.2 },
135
+ * { language: 'fr-FR', enableSpeakerDiarization: true },
136
+ * );
137
+ * ```
52
138
  */
53
139
  transcribe(audio: SpeechAudioInput, options?: SpeechTranscriptionOptions): Promise<SpeechTranscriptionResult>;
54
140
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DeepgramBatchSTTProvider.d.ts","sourceRoot":"","sources":["../../../src/speech/providers/DeepgramBatchSTTProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,yBAAyB,EAE1B,MAAM,aAAa,CAAC;AAErB,sDAAsD;AACtD,MAAM,WAAW,8BAA8B;IAC7C,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B;AAoDD;;;;;;;;;;;;;GAaG;AACH,qBAAa,wBAAyB,YAAW,oBAAoB;IAOvD,OAAO,CAAC,QAAQ,CAAC,MAAM;IANnC,SAAgB,EAAE,oBAAoB;IACtC,SAAgB,WAAW,sBAAsB;IACjD,SAAgB,iBAAiB,SAAS;IAE1C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAe;gBAEZ,MAAM,EAAE,8BAA8B;IAInE,gDAAgD;IAChD,eAAe,IAAI,MAAM;IAIzB;;;;;;;OAOG;IACG,UAAU,CACd,KAAK,EAAE,gBAAgB,EACvB,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,yBAAyB,CAAC;CAmDtC"}
1
+ {"version":3,"file":"DeepgramBatchSTTProvider.d.ts","sourceRoot":"","sources":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