@speechos/core 0.2.4 → 0.2.6
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/dist/config.d.cts +3 -1
- package/dist/config.d.ts +3 -1
- package/dist/index.cjs +25 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +25 -12
- package/dist/index.js.map +1 -1
- package/dist/types.d.cts +41 -1
- package/dist/types.d.ts +41 -1
- package/package.json +1 -1
package/dist/types.d.cts
CHANGED
|
@@ -35,6 +35,13 @@ export interface SpeechOSCoreConfig {
|
|
|
35
35
|
host?: string;
|
|
36
36
|
/** Enable debug logging */
|
|
37
37
|
debug?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Custom WebSocket factory for creating connections.
|
|
40
|
+
* Used by the Chrome extension to route WebSocket traffic through the
|
|
41
|
+
* service worker, bypassing page CSP restrictions.
|
|
42
|
+
* If not provided, uses the native WebSocket constructor.
|
|
43
|
+
*/
|
|
44
|
+
webSocketFactory?: WebSocketFactory;
|
|
38
45
|
}
|
|
39
46
|
/**
|
|
40
47
|
* Session settings passed when starting a voice session
|
|
@@ -187,7 +194,12 @@ export interface SpeechOSEventMap {
|
|
|
187
194
|
"state:change": {
|
|
188
195
|
state: SpeechOSState;
|
|
189
196
|
};
|
|
190
|
-
/** Emitted when transcription is received from
|
|
197
|
+
/** Emitted when intermediate transcription is received from server (indicates audio is being processed) */
|
|
198
|
+
"transcription:interim": {
|
|
199
|
+
transcript: string;
|
|
200
|
+
isFinal: boolean;
|
|
201
|
+
};
|
|
202
|
+
/** Emitted when final transcription is received from the server */
|
|
191
203
|
"transcription:complete": {
|
|
192
204
|
text: string;
|
|
193
205
|
};
|
|
@@ -231,3 +243,31 @@ export type StateChangeCallback = (newState: SpeechOSState, prevState: SpeechOSS
|
|
|
231
243
|
* Unsubscribe function returned by event listeners
|
|
232
244
|
*/
|
|
233
245
|
export type UnsubscribeFn = () => void;
|
|
246
|
+
/**
|
|
247
|
+
* Minimal WebSocket-like interface used by the SDK.
|
|
248
|
+
* This allows the extension to provide a proxy WebSocket that routes
|
|
249
|
+
* traffic through the service worker to bypass page CSP restrictions.
|
|
250
|
+
*/
|
|
251
|
+
export interface WebSocketLike {
|
|
252
|
+
/** Current connection state (0=CONNECTING, 1=OPEN, 2=CLOSING, 3=CLOSED) */
|
|
253
|
+
readonly readyState: number;
|
|
254
|
+
/** Number of bytes of data queued for transmission */
|
|
255
|
+
readonly bufferedAmount: number;
|
|
256
|
+
/** Send data over the connection */
|
|
257
|
+
send(data: string | ArrayBuffer | Blob): void;
|
|
258
|
+
/** Close the connection */
|
|
259
|
+
close(code?: number, reason?: string): void;
|
|
260
|
+
/** Called when connection opens */
|
|
261
|
+
onopen: ((event: Event) => void) | null;
|
|
262
|
+
/** Called when a message is received */
|
|
263
|
+
onmessage: ((event: MessageEvent) => void) | null;
|
|
264
|
+
/** Called when an error occurs */
|
|
265
|
+
onerror: ((event: Event) => void) | null;
|
|
266
|
+
/** Called when connection closes */
|
|
267
|
+
onclose: ((event: CloseEvent) => void) | null;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Factory function type for creating WebSocket-like connections.
|
|
271
|
+
* Used by extensions to provide a proxy WebSocket that bypasses page CSP.
|
|
272
|
+
*/
|
|
273
|
+
export type WebSocketFactory = (url: string) => WebSocketLike;
|
package/dist/types.d.ts
CHANGED
|
@@ -35,6 +35,13 @@ export interface SpeechOSCoreConfig {
|
|
|
35
35
|
host?: string;
|
|
36
36
|
/** Enable debug logging */
|
|
37
37
|
debug?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Custom WebSocket factory for creating connections.
|
|
40
|
+
* Used by the Chrome extension to route WebSocket traffic through the
|
|
41
|
+
* service worker, bypassing page CSP restrictions.
|
|
42
|
+
* If not provided, uses the native WebSocket constructor.
|
|
43
|
+
*/
|
|
44
|
+
webSocketFactory?: WebSocketFactory;
|
|
38
45
|
}
|
|
39
46
|
/**
|
|
40
47
|
* Session settings passed when starting a voice session
|
|
@@ -187,7 +194,12 @@ export interface SpeechOSEventMap {
|
|
|
187
194
|
"state:change": {
|
|
188
195
|
state: SpeechOSState;
|
|
189
196
|
};
|
|
190
|
-
/** Emitted when transcription is received from
|
|
197
|
+
/** Emitted when intermediate transcription is received from server (indicates audio is being processed) */
|
|
198
|
+
"transcription:interim": {
|
|
199
|
+
transcript: string;
|
|
200
|
+
isFinal: boolean;
|
|
201
|
+
};
|
|
202
|
+
/** Emitted when final transcription is received from the server */
|
|
191
203
|
"transcription:complete": {
|
|
192
204
|
text: string;
|
|
193
205
|
};
|
|
@@ -231,3 +243,31 @@ export type StateChangeCallback = (newState: SpeechOSState, prevState: SpeechOSS
|
|
|
231
243
|
* Unsubscribe function returned by event listeners
|
|
232
244
|
*/
|
|
233
245
|
export type UnsubscribeFn = () => void;
|
|
246
|
+
/**
|
|
247
|
+
* Minimal WebSocket-like interface used by the SDK.
|
|
248
|
+
* This allows the extension to provide a proxy WebSocket that routes
|
|
249
|
+
* traffic through the service worker to bypass page CSP restrictions.
|
|
250
|
+
*/
|
|
251
|
+
export interface WebSocketLike {
|
|
252
|
+
/** Current connection state (0=CONNECTING, 1=OPEN, 2=CLOSING, 3=CLOSED) */
|
|
253
|
+
readonly readyState: number;
|
|
254
|
+
/** Number of bytes of data queued for transmission */
|
|
255
|
+
readonly bufferedAmount: number;
|
|
256
|
+
/** Send data over the connection */
|
|
257
|
+
send(data: string | ArrayBuffer | Blob): void;
|
|
258
|
+
/** Close the connection */
|
|
259
|
+
close(code?: number, reason?: string): void;
|
|
260
|
+
/** Called when connection opens */
|
|
261
|
+
onopen: ((event: Event) => void) | null;
|
|
262
|
+
/** Called when a message is received */
|
|
263
|
+
onmessage: ((event: MessageEvent) => void) | null;
|
|
264
|
+
/** Called when an error occurs */
|
|
265
|
+
onerror: ((event: Event) => void) | null;
|
|
266
|
+
/** Called when connection closes */
|
|
267
|
+
onclose: ((event: CloseEvent) => void) | null;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Factory function type for creating WebSocket-like connections.
|
|
271
|
+
* Used by extensions to provide a proxy WebSocket that bypasses page CSP.
|
|
272
|
+
*/
|
|
273
|
+
export type WebSocketFactory = (url: string) => WebSocketLike;
|