dominus-sdk-nodejs 3.0.1 → 3.0.3

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 (92) hide show
  1. package/README.md +4 -5
  2. package/dist/index.d.ts +22 -25
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +22 -27
  5. package/dist/index.js.map +1 -1
  6. package/dist/lib/cache.d.ts +1 -1
  7. package/dist/lib/cache.d.ts.map +1 -1
  8. package/dist/lib/cache.js +2 -2
  9. package/dist/lib/cache.js.map +1 -1
  10. package/dist/lib/client.d.ts +68 -16
  11. package/dist/lib/client.d.ts.map +1 -1
  12. package/dist/lib/client.js +217 -73
  13. package/dist/lib/client.js.map +1 -1
  14. package/dist/lib/config.d.ts +7 -0
  15. package/dist/lib/config.d.ts.map +1 -1
  16. package/dist/lib/config.js +10 -5
  17. package/dist/lib/config.js.map +1 -1
  18. package/dist/lib/crypto.d.ts +3 -3
  19. package/dist/lib/crypto.js +3 -3
  20. package/dist/lib/errors.d.ts +12 -0
  21. package/dist/lib/errors.d.ts.map +1 -1
  22. package/dist/lib/errors.js +82 -1
  23. package/dist/lib/errors.js.map +1 -1
  24. package/dist/namespaces/artifacts.d.ts +15 -5
  25. package/dist/namespaces/artifacts.d.ts.map +1 -1
  26. package/dist/namespaces/artifacts.js +14 -7
  27. package/dist/namespaces/artifacts.js.map +1 -1
  28. package/dist/namespaces/auth.d.ts.map +1 -1
  29. package/dist/namespaces/auth.js +4 -5
  30. package/dist/namespaces/auth.js.map +1 -1
  31. package/dist/namespaces/authority.d.ts +502 -0
  32. package/dist/namespaces/authority.d.ts.map +1 -0
  33. package/dist/namespaces/authority.js +975 -0
  34. package/dist/namespaces/authority.js.map +1 -0
  35. package/dist/namespaces/db.d.ts +38 -2
  36. package/dist/namespaces/db.d.ts.map +1 -1
  37. package/dist/namespaces/db.js +50 -6
  38. package/dist/namespaces/db.js.map +1 -1
  39. package/dist/namespaces/files.d.ts +10 -2
  40. package/dist/namespaces/files.d.ts.map +1 -1
  41. package/dist/namespaces/files.js +9 -3
  42. package/dist/namespaces/files.js.map +1 -1
  43. package/dist/namespaces/health.d.ts +2 -6
  44. package/dist/namespaces/health.d.ts.map +1 -1
  45. package/dist/namespaces/health.js +9 -15
  46. package/dist/namespaces/health.js.map +1 -1
  47. package/dist/namespaces/logs.d.ts +2 -0
  48. package/dist/namespaces/logs.d.ts.map +1 -1
  49. package/dist/namespaces/logs.js +3 -1
  50. package/dist/namespaces/logs.js.map +1 -1
  51. package/dist/namespaces/portal.d.ts +1 -1
  52. package/dist/namespaces/portal.js +1 -1
  53. package/dist/namespaces/secrets.d.ts +34 -1
  54. package/dist/namespaces/secrets.d.ts.map +1 -1
  55. package/dist/namespaces/secrets.js +68 -4
  56. package/dist/namespaces/secrets.js.map +1 -1
  57. package/dist/namespaces/sync.d.ts +5 -1
  58. package/dist/namespaces/sync.d.ts.map +1 -1
  59. package/dist/namespaces/sync.js +4 -2
  60. package/dist/namespaces/sync.js.map +1 -1
  61. package/docs/architecture.md +6 -8
  62. package/docs/routes-services.md +15 -12
  63. package/docs/usage-reference.md +20 -20
  64. package/package.json +4 -4
  65. package/dist/namespaces/open.d.ts +0 -27
  66. package/dist/namespaces/open.d.ts.map +0 -1
  67. package/dist/namespaces/open.js +0 -46
  68. package/dist/namespaces/open.js.map +0 -1
  69. package/dist/namespaces/oracle/OracleSession.d.ts +0 -92
  70. package/dist/namespaces/oracle/OracleSession.d.ts.map +0 -1
  71. package/dist/namespaces/oracle/OracleSession.js +0 -219
  72. package/dist/namespaces/oracle/OracleSession.js.map +0 -1
  73. package/dist/namespaces/oracle/index.d.ts +0 -78
  74. package/dist/namespaces/oracle/index.d.ts.map +0 -1
  75. package/dist/namespaces/oracle/index.js +0 -87
  76. package/dist/namespaces/oracle/index.js.map +0 -1
  77. package/dist/namespaces/oracle/internal/AudioCapture.d.ts +0 -42
  78. package/dist/namespaces/oracle/internal/AudioCapture.d.ts.map +0 -1
  79. package/dist/namespaces/oracle/internal/AudioCapture.js +0 -316
  80. package/dist/namespaces/oracle/internal/AudioCapture.js.map +0 -1
  81. package/dist/namespaces/oracle/internal/OracleWebSocket.d.ts +0 -81
  82. package/dist/namespaces/oracle/internal/OracleWebSocket.d.ts.map +0 -1
  83. package/dist/namespaces/oracle/internal/OracleWebSocket.js +0 -209
  84. package/dist/namespaces/oracle/internal/OracleWebSocket.js.map +0 -1
  85. package/dist/namespaces/oracle/internal/VADGate.d.ts +0 -76
  86. package/dist/namespaces/oracle/internal/VADGate.d.ts.map +0 -1
  87. package/dist/namespaces/oracle/internal/VADGate.js +0 -260
  88. package/dist/namespaces/oracle/internal/VADGate.js.map +0 -1
  89. package/dist/namespaces/oracle/types.d.ts +0 -98
  90. package/dist/namespaces/oracle/types.d.ts.map +0 -1
  91. package/dist/namespaces/oracle/types.js +0 -28
  92. package/dist/namespaces/oracle/types.js.map +0 -1
@@ -1,92 +0,0 @@
1
- /**
2
- * OracleSession - Main session class for streaming transcription.
3
- *
4
- * Provides the public API for Oracle streaming:
5
- * - start() / stop() lifecycle
6
- * - Event callbacks for transcripts, VAD state, errors
7
- * - NO sendAudio() exposed - VAD gates all audio automatically
8
- *
9
- * The session handles everything internally:
10
- * - Microphone access and audio capture
11
- * - Resampling to 16kHz mono PCM
12
- * - VAD gating (only sends speech, not silence)
13
- * - WebSocket connection to Oracle
14
- * - Ping/pong keepalive during IDLE
15
- */
16
- import type { VADState, ResolvedOracleSessionOptions } from './types.js';
17
- /**
18
- * OracleSession - Real-time speech-to-text with VAD gating.
19
- *
20
- * Usage:
21
- * ```typescript
22
- * const session = dominus.oracle.createSession(userJwt);
23
- *
24
- * session.onReady = () => console.log('Ready');
25
- * session.onInterim = (text) => setLiveText(text);
26
- * session.onUtterance = (text) => sendToCurator(text);
27
- * session.onVADStateChange = (state) => updateMicIcon(state);
28
- *
29
- * await session.start();
30
- * // ... user speaks ...
31
- * await session.stop();
32
- * ```
33
- */
34
- export declare class OracleSession {
35
- private userToken;
36
- private ws;
37
- private vad;
38
- private audio;
39
- private _isActive;
40
- private _vadState;
41
- private pendingUtterance;
42
- /** Called when session is ready to receive speech */
43
- onReady: (() => void) | null;
44
- /** Called with interim transcripts (may change) */
45
- onInterim: ((text: string) => void) | null;
46
- /** Called when a transcript segment is finalized */
47
- onFinal: ((text: string) => void) | null;
48
- /** Called when user finishes an utterance (trigger for Curator) */
49
- onUtterance: ((text: string) => void) | null;
50
- /** Called on any error */
51
- onError: ((error: Error) => void) | null;
52
- /** Called when session closes */
53
- onClose: (() => void) | null;
54
- /** Called when VAD state changes (for UI indicators) */
55
- onVADStateChange: ((state: VADState) => void) | null;
56
- constructor(baseUrl: string, userToken: string, options: ResolvedOracleSessionOptions);
57
- /**
58
- * Check if session is currently active.
59
- */
60
- get isActive(): boolean;
61
- /**
62
- * Get current VAD state.
63
- */
64
- get vadState(): VADState;
65
- /**
66
- * Start the transcription session.
67
- *
68
- * - Requests microphone permission
69
- * - Connects WebSocket to Oracle
70
- * - Begins VAD-gated audio streaming
71
- *
72
- * @throws Error if mic permission denied or connection fails
73
- */
74
- start(): Promise<void>;
75
- /**
76
- * Stop the transcription session.
77
- *
78
- * - Stops microphone capture
79
- * - Closes WebSocket connection
80
- * - Cleans up resources
81
- */
82
- stop(): Promise<void>;
83
- /**
84
- * Clean up all resources.
85
- */
86
- private cleanup;
87
- /**
88
- * Dispose of all resources (for cleanup on unmount).
89
- */
90
- dispose(): void;
91
- }
92
- //# sourceMappingURL=OracleSession.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OracleSession.d.ts","sourceRoot":"","sources":["../../../src/namespaces/oracle/OracleSession.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,KAAK,EACV,QAAQ,EACR,4BAA4B,EAC7B,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,aAAa;IAqCtB,OAAO,CAAC,SAAS;IApCnB,OAAO,C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 @@
1
- /**
2
- * OracleSession - Main session class for streaming transcription.
3
- *
4
- * Provides the public API for Oracle streaming:
5
- * - start() / stop() lifecycle
6
- * - Event callbacks for transcripts, VAD state, errors
7
- * - NO sendAudio() exposed - VAD gates all audio automatically
8
- *
9
- * The session handles everything internally:
10
- * - Microphone access and audio capture
11
- * - Resampling to 16kHz mono PCM
12
- * - VAD gating (only sends speech, not silence)
13
- * - WebSocket connection to Oracle
14
- * - Ping/pong keepalive during IDLE
15
- */
16
- import { OracleWebSocket } from './internal/OracleWebSocket.js';
17
- import { VADGate } from './internal/VADGate.js';
18
- import { AudioCapture } from './internal/AudioCapture.js';
19
- /**
20
- * OracleSession - Real-time speech-to-text with VAD gating.
21
- *
22
- * Usage:
23
- * ```typescript
24
- * const session = dominus.oracle.createSession(userJwt);
25
- *
26
- * session.onReady = () => console.log('Ready');
27
- * session.onInterim = (text) => setLiveText(text);
28
- * session.onUtterance = (text) => sendToCurator(text);
29
- * session.onVADStateChange = (state) => updateMicIcon(state);
30
- *
31
- * await session.start();
32
- * // ... user speaks ...
33
- * await session.stop();
34
- * ```
35
- */
36
- export class OracleSession {
37
- userToken;
38
- ws;
39
- vad;
40
- audio;
41
- _isActive = false;
42
- _vadState = 'idle';
43
- // Track accumulated transcript for utterance detection
44
- // Since VAD stops sending audio before Deepgram's utterance_end_ms,
45
- // we use VAD TRAILING→IDLE transition as utterance boundary
46
- pendingUtterance = '';
47
- // ========== EVENT CALLBACKS ==========
48
- /** Called when session is ready to receive speech */
49
- onReady = null;
50
- /** Called with interim transcripts (may change) */
51
- onInterim = null;
52
- /** Called when a transcript segment is finalized */
53
- onFinal = null;
54
- /** Called when user finishes an utterance (trigger for Curator) */
55
- onUtterance = null;
56
- /** Called on any error */
57
- onError = null;
58
- /** Called when session closes */
59
- onClose = null;
60
- /** Called when VAD state changes (for UI indicators) */
61
- onVADStateChange = null;
62
- constructor(baseUrl, userToken, options) {
63
- this.userToken = userToken;
64
- // Initialize internal components
65
- this.ws = new OracleWebSocket(baseUrl, {
66
- pingIntervalMs: options.pingIntervalMs,
67
- });
68
- this.vad = new VADGate(options);
69
- this.audio = new AudioCapture();
70
- }
71
- // ========== PUBLIC GETTERS ==========
72
- /**
73
- * Check if session is currently active.
74
- */
75
- get isActive() {
76
- return this._isActive;
77
- }
78
- /**
79
- * Get current VAD state.
80
- */
81
- get vadState() {
82
- return this._vadState;
83
- }
84
- // ========== LIFECYCLE METHODS ==========
85
- /**
86
- * Start the transcription session.
87
- *
88
- * - Requests microphone permission
89
- * - Connects WebSocket to Oracle
90
- * - Begins VAD-gated audio streaming
91
- *
92
- * @throws Error if mic permission denied or connection fails
93
- */
94
- async start() {
95
- if (this._isActive) {
96
- return;
97
- }
98
- try {
99
- // 1. Initialize VAD
100
- await this.vad.initialize();
101
- // 2. Connect WebSocket with first-message auth
102
- await this.ws.connect(this.userToken);
103
- // 3. Wire up transcript events
104
- // Note: Deepgram's speech_final requires 2s silence, but VAD only sends 400ms trailing.
105
- // So we accumulate is_final text and emit on VAD TRAILING→IDLE transition.
106
- this.ws.onTranscript = (text, isFinal, speechFinal) => {
107
- if (!isFinal) {
108
- // Interim: show in live view (may change)
109
- this.onInterim?.(text);
110
- }
111
- else {
112
- // Final: accumulate for utterance
113
- this.onFinal?.(text);
114
- // Accumulate finals - space-separated
115
- if (this.pendingUtterance) {
116
- this.pendingUtterance += ' ' + text;
117
- }
118
- else {
119
- this.pendingUtterance = text;
120
- }
121
- }
122
- // If Deepgram does send speech_final, honor it
123
- if (speechFinal && text) {
124
- this.pendingUtterance = ''; // Clear since we're emitting
125
- this.onUtterance?.(text);
126
- }
127
- };
128
- this.ws.onError = (error) => {
129
- this.onError?.(error);
130
- };
131
- this.ws.onClose = () => {
132
- this._isActive = false;
133
- this.onClose?.();
134
- };
135
- // 4. Start audio capture
136
- await this.audio.start();
137
- // 5. Wire audio through VAD gate
138
- this.audio.onFrame = (pcmFrame) => {
139
- this.vad.processFrame(pcmFrame);
140
- };
141
- // 6. VAD gate controls what gets sent
142
- this.vad.onSendAudio = (frames) => {
143
- frames.forEach((frame) => this.ws.sendBinary(frame));
144
- };
145
- this.vad.onStateChange = (state) => {
146
- const prevState = this._vadState;
147
- this._vadState = state;
148
- this.onVADStateChange?.(state);
149
- // When VAD transitions to IDLE from TRAILING, emit accumulated utterance
150
- // This is our primary utterance boundary since Deepgram's speech_final
151
- // requires 2s silence but VAD only sends 400ms trailing
152
- if (state === 'idle' && (prevState === 'trailing' || prevState === 'speaking')) {
153
- if (this.pendingUtterance.trim()) {
154
- console.log('[OracleSDK] VAD→IDLE: emitting utterance', {
155
- text: this.pendingUtterance.substring(0, 50),
156
- });
157
- this.onUtterance?.(this.pendingUtterance.trim());
158
- this.pendingUtterance = '';
159
- }
160
- }
161
- };
162
- this._isActive = true;
163
- this.onReady?.();
164
- }
165
- catch (error) {
166
- // Clean up on failure
167
- await this.cleanup();
168
- throw error;
169
- }
170
- }
171
- /**
172
- * Stop the transcription session.
173
- *
174
- * - Stops microphone capture
175
- * - Closes WebSocket connection
176
- * - Cleans up resources
177
- */
178
- async stop() {
179
- if (!this._isActive) {
180
- return;
181
- }
182
- this._isActive = false;
183
- await this.cleanup();
184
- this.onClose?.();
185
- }
186
- // ========== PRIVATE METHODS ==========
187
- /**
188
- * Clean up all resources.
189
- */
190
- async cleanup() {
191
- // Stop audio capture
192
- await this.audio.stop();
193
- // Close WebSocket
194
- await this.ws.close();
195
- // Reset VAD state
196
- this.vad.reset();
197
- this._vadState = 'idle';
198
- // Clear pending utterance
199
- this.pendingUtterance = '';
200
- }
201
- /**
202
- * Dispose of all resources (for cleanup on unmount).
203
- */
204
- dispose() {
205
- this.stop().catch(() => { });
206
- // Clear all callbacks
207
- this.onReady = null;
208
- this.onInterim = null;
209
- this.onFinal = null;
210
- this.onUtterance = null;
211
- this.onError = null;
212
- this.onClose = null;
213
- this.onVADStateChange = null;
214
- // Dispose internal components
215
- this.audio.dispose();
216
- this.vad.dispose();
217
- }
218
- }
219
- //# sourceMappingURL=OracleSession.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OracleSession.js","sourceRoot":"","sources":["../../../src/namespaces/oracle/OracleSession.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAM1D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,aAAa;IAqCd;IApCF,EAAE,CAAkB;IACpB,GAAG,CAAU;IACb,KAAK,CAAe;IACpB,SAAS,GAAG,KAAK,CAAC;IAClB,SAAS,GAAa,MAAM,CAAC;IAErC,uDAAuD;IACvD,oEAAoE;IACpE,4DAA4D;IACpD,gBAAgB,GAAG,EAAE,CAAC;IAE9B,wCAAwC;IAExC,qDAAqD;IAC9C,OAAO,GAAwB,IAAI,CAAC;IAE3C,mDAAmD;IAC5C,SAAS,GAAoC,IAAI,CAAC;IAEzD,oDAAoD;IAC7C,OAAO,GAAoC,IAAI,CAAC;IAEvD,mEAAmE;IAC5D,WAAW,GAAoC,IAAI,CAAC;IAE3D,0BAA0B;IACnB,OAAO,GAAoC,IAAI,CAAC;IAEvD,iCAAiC;IAC1B,OAAO,GAAwB,IAAI,CAAC;IAE3C,wDAAwD;IACjD,gBAAgB,GAAuC,IAAI,CAAC;IAEnE,YACE,OAAe,EACP,SAAiB,EACzB,OAAqC;QAD7B,cAAS,GAAT,SAAS,CAAQ;QAGzB,iCAAiC;QACjC,IAAI,CAAC,EAAE,GAAG,IAAI,eAAe,CAAC,OAAO,EAAE;YACrC,cAAc,EAAE,OAAO,CAAC,cAAc;SACvC,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;QAEhC,IAAI,CAAC,KAAK,GAAG,IAAI,YAAY,EAAE,CAAC;IAClC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C,CAAC;QAE5B,sBAAsB;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAE7B,8BAA8B;QAC9B,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC;CACF"}
@@ -1,78 +0,0 @@
1
- /**
2
- * STT Namespace - Real-time streaming speech-to-text.
3
- *
4
- * Provides WebSocket-based streaming transcription via Deepgram,
5
- * with built-in VAD (Voice Activity Detection) for cost optimization.
6
- *
7
- * Key features:
8
- * - Automatic microphone capture and 16kHz resampling
9
- * - VAD gating: only sends audio when speech is detected
10
- * - 4-state VAD machine: IDLE → ARMED → SPEAKING → TRAILING
11
- * - Pre-roll buffer captures word onsets
12
- * - Ping/pong keepalive during IDLE
13
- * - NO sendAudio() exposed - VAD handles everything
14
- *
15
- * Usage:
16
- * ```typescript
17
- * const session = dominus.stt.createSession(userJwt);
18
- *
19
- * session.onReady = () => setListening(true);
20
- * session.onInterim = (text) => setLiveTranscript(text);
21
- * session.onUtterance = (text) => sendToCurator(text);
22
- * session.onVADStateChange = (state) => setMicState(state);
23
- * session.onError = (error) => showError(error);
24
- *
25
- * await session.start();
26
- * // ... user speaks, transcripts flow back ...
27
- * await session.stop();
28
- * ```
29
- */
30
- import type { DominusClient } from '../../lib/client.js';
31
- import { OracleSession } from './OracleSession.js';
32
- import { type OracleSessionOptions } from './types.js';
33
- export type { OracleSessionOptions, VADState } from './types.js';
34
- export { OracleSession } from './OracleSession.js';
35
- /**
36
- * SttNamespace - Factory for creating streaming transcription sessions.
37
- *
38
- * The STT namespace provides a simple API for real-time speech-to-text:
39
- * - createSession() creates a new transcription session
40
- * - Sessions handle mic capture, VAD, WebSocket, and transcripts internally
41
- * - NO raw audio access - VAD is mandatory for cost control
42
- */
43
- export declare class OracleNamespace {
44
- private baseUrl;
45
- constructor(_client: DominusClient);
46
- /**
47
- * Create a streaming transcription session.
48
- *
49
- * The session handles everything internally:
50
- * - Microphone access and audio capture
51
- * - Resampling to 16kHz mono PCM
52
- * - VAD gating (only sends speech, not silence)
53
- * - WebSocket connection to Oracle
54
- * - Reconnection on connection loss
55
- *
56
- * @param userToken - User JWT from portal.login()
57
- * @param options - Optional configuration overrides
58
- * @returns OracleSession ready to start()
59
- *
60
- * @example
61
- * ```typescript
62
- * const session = dominus.stt.createSession(userJwt, {
63
- * prerollMs: 320, // Capture 320ms before speech
64
- * postrollMs: 400, // Continue 400ms after speech
65
- * armedConfirmMs: 80, // Require 80ms to confirm speech
66
- * });
67
- *
68
- * session.onUtterance = (text) => {
69
- * // Called when user finishes speaking
70
- * await sendToCurator(text);
71
- * };
72
- *
73
- * await session.start();
74
- * ```
75
- */
76
- createSession(userToken: string, options?: OracleSessionOptions): OracleSession;
77
- }
78
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/namespaces/oracle/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAEL,KAAK,oBAAoB,EAE1B,MAAM,YAAY,CAAC;AAGpB,YAAY,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;GAOG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,OAAO,CAAS;gBAGZ,OAAO,EAAE,aAAa;IAIlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,aAAa;CAShF"}
@@ -1,87 +0,0 @@
1
- /**
2
- * STT Namespace - Real-time streaming speech-to-text.
3
- *
4
- * Provides WebSocket-based streaming transcription via Deepgram,
5
- * with built-in VAD (Voice Activity Detection) for cost optimization.
6
- *
7
- * Key features:
8
- * - Automatic microphone capture and 16kHz resampling
9
- * - VAD gating: only sends audio when speech is detected
10
- * - 4-state VAD machine: IDLE → ARMED → SPEAKING → TRAILING
11
- * - Pre-roll buffer captures word onsets
12
- * - Ping/pong keepalive during IDLE
13
- * - NO sendAudio() exposed - VAD handles everything
14
- *
15
- * Usage:
16
- * ```typescript
17
- * const session = dominus.stt.createSession(userJwt);
18
- *
19
- * session.onReady = () => setListening(true);
20
- * session.onInterim = (text) => setLiveTranscript(text);
21
- * session.onUtterance = (text) => sendToCurator(text);
22
- * session.onVADStateChange = (state) => setMicState(state);
23
- * session.onError = (error) => showError(error);
24
- *
25
- * await session.start();
26
- * // ... user speaks, transcripts flow back ...
27
- * await session.stop();
28
- * ```
29
- */
30
- import { BASE_URL } from '../../lib/config.js';
31
- import { OracleSession } from './OracleSession.js';
32
- import { DEFAULT_OPTIONS, } from './types.js';
33
- export { OracleSession } from './OracleSession.js';
34
- /**
35
- * SttNamespace - Factory for creating streaming transcription sessions.
36
- *
37
- * The STT namespace provides a simple API for real-time speech-to-text:
38
- * - createSession() creates a new transcription session
39
- * - Sessions handle mic capture, VAD, WebSocket, and transcripts internally
40
- * - NO raw audio access - VAD is mandatory for cost control
41
- */
42
- export class OracleNamespace {
43
- baseUrl;
44
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
45
- constructor(_client) {
46
- this.baseUrl = BASE_URL;
47
- }
48
- /**
49
- * Create a streaming transcription session.
50
- *
51
- * The session handles everything internally:
52
- * - Microphone access and audio capture
53
- * - Resampling to 16kHz mono PCM
54
- * - VAD gating (only sends speech, not silence)
55
- * - WebSocket connection to Oracle
56
- * - Reconnection on connection loss
57
- *
58
- * @param userToken - User JWT from portal.login()
59
- * @param options - Optional configuration overrides
60
- * @returns OracleSession ready to start()
61
- *
62
- * @example
63
- * ```typescript
64
- * const session = dominus.stt.createSession(userJwt, {
65
- * prerollMs: 320, // Capture 320ms before speech
66
- * postrollMs: 400, // Continue 400ms after speech
67
- * armedConfirmMs: 80, // Require 80ms to confirm speech
68
- * });
69
- *
70
- * session.onUtterance = (text) => {
71
- * // Called when user finishes speaking
72
- * await sendToCurator(text);
73
- * };
74
- *
75
- * await session.start();
76
- * ```
77
- */
78
- createSession(userToken, options) {
79
- // Merge options with defaults
80
- const resolvedOptions = {
81
- ...DEFAULT_OPTIONS,
82
- ...options,
83
- };
84
- return new OracleSession(this.baseUrl, userToken, resolvedOptions);
85
- }
86
- }
87
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/namespaces/oracle/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,eAAe,GAGhB,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,OAAO,eAAe;IAClB,OAAO,CAAS;IAExB,6DAA6D;IAC7D,YAAY,OAAsB;QAChC,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC;IAC1B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,aAAa,CAAC,SAAiB,EAAE,OAA8B;QAC7D,8BAA8B;QAC9B,MAAM,eAAe,GAAiC;YACpD,GAAG,eAAe;YAClB,GAAG,OAAO;SACX,CAAC;QAEF,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;IACrE,CAAC;CACF"}
@@ -1,42 +0,0 @@
1
- /**
2
- * AudioCapture - Microphone capture and resampling (INTERNAL)
3
- *
4
- * Handles:
5
- * - getUserMedia microphone access
6
- * - AudioWorklet for low-latency processing
7
- * - Resampling to 16kHz mono if needed
8
- * - Output 20ms frames (640 bytes PCM16)
9
- *
10
- * This module is INTERNAL and should NOT be exported publicly.
11
- */
12
- /**
13
- * AudioCapture - Main class for microphone capture.
14
- *
15
- * Automatically uses AudioWorklet if available, falls back to ScriptProcessor.
16
- * Outputs 20ms frames (640 bytes PCM16) at 16kHz mono.
17
- */
18
- export declare class AudioCapture {
19
- private capture;
20
- private _isCapturing;
21
- /** Callback for each audio frame */
22
- onFrame: ((pcmFrame: ArrayBuffer) => void) | null;
23
- /**
24
- * Check if currently capturing audio.
25
- */
26
- get isCapturing(): boolean;
27
- /**
28
- * Start audio capture from microphone.
29
- *
30
- * @throws Error if microphone permission denied or capture fails
31
- */
32
- start(): Promise<void>;
33
- /**
34
- * Stop audio capture.
35
- */
36
- stop(): Promise<void>;
37
- /**
38
- * Clean up resources.
39
- */
40
- dispose(): void;
41
- }
42
- //# sourceMappingURL=AudioCapture.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AudioCapture.d.ts","sourceRoot":"","sources":["../../../../src/namespaces/oracle/internal/AudioCapture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAiRH;;;;;GAKG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,OAAO,CAAwD;IACvE,OAAO,CAAC,YAAY,CAAS;IAE7B,oCAAoC;IAC7B,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,WAAW,KAAK,IAAI,CAAC,GAAG,IAAI,CAAQ;IAEhE;;OAEG;IACH,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAqC5B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAU3B;;OAEG;IACH,OAAO,IAAI,IAAI;CAIhB"}