dominus-sdk-nodejs-dev 1.2.17 → 1.2.19

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 (33) hide show
  1. package/dist/index.d.ts +10 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +10 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/namespaces/auth.d.ts +9 -0
  6. package/dist/namespaces/auth.d.ts.map +1 -1
  7. package/dist/namespaces/auth.js +60 -0
  8. package/dist/namespaces/auth.js.map +1 -1
  9. package/dist/namespaces/oracle/OracleSession.d.ts +91 -0
  10. package/dist/namespaces/oracle/OracleSession.d.ts.map +1 -0
  11. package/dist/namespaces/oracle/OracleSession.js +187 -0
  12. package/dist/namespaces/oracle/OracleSession.js.map +1 -0
  13. package/dist/namespaces/oracle/index.d.ts +78 -0
  14. package/dist/namespaces/oracle/index.d.ts.map +1 -0
  15. package/dist/namespaces/oracle/index.js +87 -0
  16. package/dist/namespaces/oracle/index.js.map +1 -0
  17. package/dist/namespaces/oracle/internal/AudioCapture.d.ts +42 -0
  18. package/dist/namespaces/oracle/internal/AudioCapture.d.ts.map +1 -0
  19. package/dist/namespaces/oracle/internal/AudioCapture.js +316 -0
  20. package/dist/namespaces/oracle/internal/AudioCapture.js.map +1 -0
  21. package/dist/namespaces/oracle/internal/OracleWebSocket.d.ts +81 -0
  22. package/dist/namespaces/oracle/internal/OracleWebSocket.d.ts.map +1 -0
  23. package/dist/namespaces/oracle/internal/OracleWebSocket.js +204 -0
  24. package/dist/namespaces/oracle/internal/OracleWebSocket.js.map +1 -0
  25. package/dist/namespaces/oracle/internal/VADGate.d.ts +75 -0
  26. package/dist/namespaces/oracle/internal/VADGate.d.ts.map +1 -0
  27. package/dist/namespaces/oracle/internal/VADGate.js +248 -0
  28. package/dist/namespaces/oracle/internal/VADGate.js.map +1 -0
  29. package/dist/namespaces/oracle/types.d.ts +98 -0
  30. package/dist/namespaces/oracle/types.d.ts.map +1 -0
  31. package/dist/namespaces/oracle/types.js +28 -0
  32. package/dist/namespaces/oracle/types.js.map +1 -0
  33. package/package.json +2 -1
@@ -0,0 +1,187 @@
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
+ // ========== EVENT CALLBACKS ==========
44
+ /** Called when session is ready to receive speech */
45
+ onReady = null;
46
+ /** Called with interim transcripts (may change) */
47
+ onInterim = null;
48
+ /** Called when a transcript segment is finalized */
49
+ onFinal = null;
50
+ /** Called when user finishes an utterance (trigger for Curator) */
51
+ onUtterance = null;
52
+ /** Called on any error */
53
+ onError = null;
54
+ /** Called when session closes */
55
+ onClose = null;
56
+ /** Called when VAD state changes (for UI indicators) */
57
+ onVADStateChange = null;
58
+ constructor(baseUrl, userToken, options) {
59
+ this.userToken = userToken;
60
+ // Initialize internal components
61
+ this.ws = new OracleWebSocket(baseUrl, {
62
+ pingIntervalMs: options.pingIntervalMs,
63
+ });
64
+ this.vad = new VADGate(options);
65
+ this.audio = new AudioCapture();
66
+ }
67
+ // ========== PUBLIC GETTERS ==========
68
+ /**
69
+ * Check if session is currently active.
70
+ */
71
+ get isActive() {
72
+ return this._isActive;
73
+ }
74
+ /**
75
+ * Get current VAD state.
76
+ */
77
+ get vadState() {
78
+ return this._vadState;
79
+ }
80
+ // ========== LIFECYCLE METHODS ==========
81
+ /**
82
+ * Start the transcription session.
83
+ *
84
+ * - Requests microphone permission
85
+ * - Connects WebSocket to Oracle
86
+ * - Begins VAD-gated audio streaming
87
+ *
88
+ * @throws Error if mic permission denied or connection fails
89
+ */
90
+ async start() {
91
+ if (this._isActive) {
92
+ return;
93
+ }
94
+ try {
95
+ // 1. Initialize VAD
96
+ await this.vad.initialize();
97
+ // 2. Connect WebSocket with first-message auth
98
+ await this.ws.connect(this.userToken);
99
+ // 3. Wire up transcript events
100
+ this.ws.onTranscript = (text, isFinal, speechFinal) => {
101
+ if (!isFinal) {
102
+ this.onInterim?.(text);
103
+ }
104
+ else {
105
+ this.onFinal?.(text);
106
+ }
107
+ if (speechFinal) {
108
+ this.onUtterance?.(text);
109
+ }
110
+ };
111
+ this.ws.onError = (error) => {
112
+ this.onError?.(error);
113
+ };
114
+ this.ws.onClose = () => {
115
+ this._isActive = false;
116
+ this.onClose?.();
117
+ };
118
+ // 4. Start audio capture
119
+ await this.audio.start();
120
+ // 5. Wire audio through VAD gate
121
+ this.audio.onFrame = (pcmFrame) => {
122
+ this.vad.processFrame(pcmFrame);
123
+ };
124
+ // 6. VAD gate controls what gets sent
125
+ this.vad.onSendAudio = (frames) => {
126
+ frames.forEach((frame) => this.ws.sendBinary(frame));
127
+ };
128
+ this.vad.onStateChange = (state) => {
129
+ this._vadState = state;
130
+ this.onVADStateChange?.(state);
131
+ };
132
+ this._isActive = true;
133
+ this.onReady?.();
134
+ }
135
+ catch (error) {
136
+ // Clean up on failure
137
+ await this.cleanup();
138
+ throw error;
139
+ }
140
+ }
141
+ /**
142
+ * Stop the transcription session.
143
+ *
144
+ * - Stops microphone capture
145
+ * - Closes WebSocket connection
146
+ * - Cleans up resources
147
+ */
148
+ async stop() {
149
+ if (!this._isActive) {
150
+ return;
151
+ }
152
+ this._isActive = false;
153
+ await this.cleanup();
154
+ this.onClose?.();
155
+ }
156
+ // ========== PRIVATE METHODS ==========
157
+ /**
158
+ * Clean up all resources.
159
+ */
160
+ async cleanup() {
161
+ // Stop audio capture
162
+ await this.audio.stop();
163
+ // Close WebSocket
164
+ await this.ws.close();
165
+ // Reset VAD state
166
+ this.vad.reset();
167
+ this._vadState = 'idle';
168
+ }
169
+ /**
170
+ * Dispose of all resources (for cleanup on unmount).
171
+ */
172
+ dispose() {
173
+ this.stop().catch(() => { });
174
+ // Clear all callbacks
175
+ this.onReady = null;
176
+ this.onInterim = null;
177
+ this.onFinal = null;
178
+ this.onUtterance = null;
179
+ this.onError = null;
180
+ this.onClose = null;
181
+ this.onVADStateChange = null;
182
+ // Dispose internal components
183
+ this.audio.dispose();
184
+ this.vad.dispose();
185
+ }
186
+ }
187
+ //# sourceMappingURL=OracleSession.js.map
@@ -0,0 +1 @@
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;IAgCd;IA/BF,EAAE,CAAkB;IACpB,GAAG,CAAU;IACb,KAAK,CAAe;IACpB,SAAS,GAAG,KAAK,CAAC;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;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"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Oracle Namespace - Real-time streaming speech-to-text.
3
+ *
4
+ * Oracle 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.oracle.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
+ * OracleNamespace - Factory for creating streaming transcription sessions.
37
+ *
38
+ * The Oracle 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.oracle.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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Oracle Namespace - Real-time streaming speech-to-text.
3
+ *
4
+ * Oracle 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.oracle.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
+ * OracleNamespace - Factory for creating streaming transcription sessions.
36
+ *
37
+ * The Oracle 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.oracle.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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,42 @@
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
@@ -0,0 +1 @@
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"}