@speechos/core 0.2.6 → 0.2.8
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 +19 -1
- package/dist/config.d.ts +19 -1
- package/dist/index.cjs +36 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +34 -5
- package/dist/index.js.map +1 -1
- package/dist/state.d.cts +2 -1
- package/dist/state.d.ts +2 -1
- package/dist/types.d.cts +60 -2
- package/dist/types.d.ts +60 -2
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
export { speechOS } from "./speechos.js";
|
|
8
8
|
export { events, SpeechOSEventEmitter } from "./events.js";
|
|
9
9
|
export { state, createStateManager } from "./state.js";
|
|
10
|
-
export { getConfig, setConfig, resetConfig, updateUserId, validateConfig, DEFAULT_HOST, } from "./config.js";
|
|
10
|
+
export { getConfig, setConfig, resetConfig, updateUserId, validateConfig, getSettingsToken, clearSettingsToken, getFetchHandler, DEFAULT_HOST, } from "./config.js";
|
|
11
11
|
export { livekit, Deferred } from "./livekit.js";
|
|
12
12
|
export { websocket } from "./websocket.js";
|
|
13
13
|
export { getBackend } from "./backend.js";
|
|
14
14
|
export type { VoiceBackend } from "./backend.js";
|
|
15
|
-
export type { SpeechOSCoreConfig, SpeechOSState, SpeechOSAction, SpeechOSEventMap, StateChangeCallback, UnsubscribeFn, RecordingState, LiveKitTokenResponse, ServerErrorMessage, ErrorSource, UserVocabularyData, CommandArgument, CommandDefinition, CommandResult, SessionSettings, VoiceSessionOptions, WebSocketLike, WebSocketFactory, } from "./types.js";
|
|
15
|
+
export type { SpeechOSCoreConfig, SpeechOSState, SpeechOSAction, SpeechOSEventMap, StateChangeCallback, UnsubscribeFn, RecordingState, LiveKitTokenResponse, ServerErrorMessage, ErrorSource, UserVocabularyData, CommandArgument, CommandDefinition, CommandResult, SessionSettings, VoiceSessionOptions, WebSocketLike, WebSocketFactory, FetchOptions, FetchResponse, FetchHandler, } from "./types.js";
|
|
16
16
|
export declare const VERSION = "0.1.0";
|
package/dist/index.d.ts
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
export { speechOS } from "./speechos.js";
|
|
8
8
|
export { events, SpeechOSEventEmitter } from "./events.js";
|
|
9
9
|
export { state, createStateManager } from "./state.js";
|
|
10
|
-
export { getConfig, setConfig, resetConfig, updateUserId, validateConfig, DEFAULT_HOST, } from "./config.js";
|
|
10
|
+
export { getConfig, setConfig, resetConfig, updateUserId, validateConfig, getSettingsToken, clearSettingsToken, getFetchHandler, DEFAULT_HOST, } from "./config.js";
|
|
11
11
|
export { livekit, Deferred } from "./livekit.js";
|
|
12
12
|
export { websocket } from "./websocket.js";
|
|
13
13
|
export { getBackend } from "./backend.js";
|
|
14
14
|
export type { VoiceBackend } from "./backend.js";
|
|
15
|
-
export type { SpeechOSCoreConfig, SpeechOSState, SpeechOSAction, SpeechOSEventMap, StateChangeCallback, UnsubscribeFn, RecordingState, LiveKitTokenResponse, ServerErrorMessage, ErrorSource, UserVocabularyData, CommandArgument, CommandDefinition, CommandResult, SessionSettings, VoiceSessionOptions, WebSocketLike, WebSocketFactory, } from "./types.js";
|
|
15
|
+
export type { SpeechOSCoreConfig, SpeechOSState, SpeechOSAction, SpeechOSEventMap, StateChangeCallback, UnsubscribeFn, RecordingState, LiveKitTokenResponse, ServerErrorMessage, ErrorSource, UserVocabularyData, CommandArgument, CommandDefinition, CommandResult, SessionSettings, VoiceSessionOptions, WebSocketLike, WebSocketFactory, FetchOptions, FetchResponse, FetchHandler, } from "./types.js";
|
|
16
16
|
export declare const VERSION = "0.1.0";
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,9 @@ const defaultConfig = {
|
|
|
13
13
|
userId: "",
|
|
14
14
|
host: DEFAULT_HOST,
|
|
15
15
|
debug: false,
|
|
16
|
-
webSocketFactory: void 0
|
|
16
|
+
webSocketFactory: void 0,
|
|
17
|
+
fetchHandler: void 0,
|
|
18
|
+
settingsToken: void 0
|
|
17
19
|
};
|
|
18
20
|
/**
|
|
19
21
|
* Validates and merges user config with defaults
|
|
@@ -27,7 +29,9 @@ function validateConfig(userConfig) {
|
|
|
27
29
|
userId: userConfig.userId ?? defaultConfig.userId,
|
|
28
30
|
host: userConfig.host ?? defaultConfig.host,
|
|
29
31
|
debug: userConfig.debug ?? defaultConfig.debug,
|
|
30
|
-
webSocketFactory: userConfig.webSocketFactory ?? defaultConfig.webSocketFactory
|
|
32
|
+
webSocketFactory: userConfig.webSocketFactory ?? defaultConfig.webSocketFactory,
|
|
33
|
+
fetchHandler: userConfig.fetchHandler ?? defaultConfig.fetchHandler,
|
|
34
|
+
settingsToken: userConfig.settingsToken ?? defaultConfig.settingsToken
|
|
31
35
|
};
|
|
32
36
|
}
|
|
33
37
|
/**
|
|
@@ -64,6 +68,29 @@ function updateUserId(userId) {
|
|
|
64
68
|
};
|
|
65
69
|
}
|
|
66
70
|
/**
|
|
71
|
+
* Get the settings token from the current configuration
|
|
72
|
+
* @returns The settings token or undefined if not configured
|
|
73
|
+
*/
|
|
74
|
+
function getSettingsToken() {
|
|
75
|
+
return currentConfig.settingsToken;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Clear the settings token (e.g., when it expires)
|
|
79
|
+
*/
|
|
80
|
+
function clearSettingsToken() {
|
|
81
|
+
currentConfig = {
|
|
82
|
+
...currentConfig,
|
|
83
|
+
settingsToken: void 0
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get the fetch handler from the current configuration
|
|
88
|
+
* @returns The fetch handler or undefined if not configured
|
|
89
|
+
*/
|
|
90
|
+
function getFetchHandler() {
|
|
91
|
+
return currentConfig.fetchHandler;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
67
94
|
* LocalStorage key for anonymous ID persistence
|
|
68
95
|
*/
|
|
69
96
|
const ANONYMOUS_ID_KEY = "speechos_anonymous_id";
|
|
@@ -316,14 +343,16 @@ var StateManager = class {
|
|
|
316
343
|
});
|
|
317
344
|
}
|
|
318
345
|
/**
|
|
319
|
-
* Complete the recording flow and return to idle
|
|
346
|
+
* Complete the recording flow and return to idle.
|
|
347
|
+
* Keeps widget visible but collapsed (just mic button, no action bubbles).
|
|
320
348
|
*/
|
|
321
349
|
completeRecording() {
|
|
322
350
|
this.setState({
|
|
323
351
|
recordingState: "idle",
|
|
324
352
|
activeAction: null,
|
|
325
353
|
isConnected: false,
|
|
326
|
-
isMicEnabled: false
|
|
354
|
+
isMicEnabled: false,
|
|
355
|
+
isExpanded: false
|
|
327
356
|
});
|
|
328
357
|
}
|
|
329
358
|
/**
|
|
@@ -2241,5 +2270,5 @@ function getBackend() {
|
|
|
2241
2270
|
const VERSION = "0.1.0";
|
|
2242
2271
|
|
|
2243
2272
|
//#endregion
|
|
2244
|
-
export { DEFAULT_HOST, Deferred, SpeechOSEventEmitter, VERSION, createStateManager, events, getBackend, getConfig, livekit, resetConfig, setConfig, speechOS, state, updateUserId, validateConfig, websocket };
|
|
2273
|
+
export { DEFAULT_HOST, Deferred, SpeechOSEventEmitter, VERSION, clearSettingsToken, createStateManager, events, getBackend, getConfig, getFetchHandler, getSettingsToken, livekit, resetConfig, setConfig, speechOS, state, updateUserId, validateConfig, websocket };
|
|
2245
2274
|
//# sourceMappingURL=index.js.map
|