uneeq-js 3.6.4 → 3.6.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/connection-state-manager.d.ts +263 -0
- package/dist/connection-state-manager.spec.d.ts +1 -0
- package/dist/deepgram-stt.d.ts +0 -1
- package/dist/index.js +1 -1
- package/dist/types/ConnectionState.d.ts +103 -0
- package/dist/uneeq.d.ts +3 -0
- package/package.json +1 -1
- package/dist/node_modules_ws_browser_js.index.js +0 -22
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebRTC Connection State Machine
|
|
3
|
+
*
|
|
4
|
+
* This defines all possible states for a WebRTC connection and valid transitions.
|
|
5
|
+
* Prevents invalid state combinations and makes state transitions explicit.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Primary connection state - represents the high-level state of the connection
|
|
9
|
+
*/
|
|
10
|
+
export declare enum ConnectionState {
|
|
11
|
+
/** Initial state - no connection attempt made */
|
|
12
|
+
Idle = "Idle",
|
|
13
|
+
/** Attempting to establish initial WebRTC connection */
|
|
14
|
+
Connecting = "Connecting",
|
|
15
|
+
/** Video stream initializing - waiting for all components (video, data channel, scene) */
|
|
16
|
+
VideoInitializing = "VideoInitializing",
|
|
17
|
+
/** Fully connected and ready for interaction */
|
|
18
|
+
Connected = "Connected",
|
|
19
|
+
/** Connection lost, attempting automatic reconnection */
|
|
20
|
+
Reconnecting = "Reconnecting",
|
|
21
|
+
/** Soft switching to new renderer (old connection still alive) */
|
|
22
|
+
SoftSwitching = "SoftSwitching",
|
|
23
|
+
/** Hard switching to new renderer (old connection dead) */
|
|
24
|
+
HardSwitching = "HardSwitching",
|
|
25
|
+
/** Connection terminated by user */
|
|
26
|
+
Disconnected = "Disconnected",
|
|
27
|
+
/** Connection failed (exhausted retries) */
|
|
28
|
+
Failed = "Failed",
|
|
29
|
+
/** Connection ended with error */
|
|
30
|
+
Error = "Error"
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Sub-states for tracking connection readiness
|
|
34
|
+
*/
|
|
35
|
+
export interface ConnectionReadiness {
|
|
36
|
+
videoInitialized: boolean;
|
|
37
|
+
dataChannelOpen: boolean;
|
|
38
|
+
sceneReady: boolean;
|
|
39
|
+
audioReady: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Switching-specific state
|
|
43
|
+
*/
|
|
44
|
+
export interface SwitchingState {
|
|
45
|
+
/** Reference to the old signaling connection (during switch) */
|
|
46
|
+
oldSignalingId?: string;
|
|
47
|
+
/** Reference to the new signaling connection (during switch) */
|
|
48
|
+
newSignalingId?: string;
|
|
49
|
+
/** Timestamp when switch started */
|
|
50
|
+
startedAt?: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Reconnection-specific state
|
|
54
|
+
*/
|
|
55
|
+
export interface ReconnectionState {
|
|
56
|
+
/** Is reconnection allowed */
|
|
57
|
+
allowed: boolean;
|
|
58
|
+
/** Current reconnection attempt (0 = no attempts yet) */
|
|
59
|
+
attempt: number;
|
|
60
|
+
/** Maximum reconnection attempts before giving up */
|
|
61
|
+
maxAttempts: number;
|
|
62
|
+
/** Reason for reconnection */
|
|
63
|
+
reason?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Complete connection state context
|
|
67
|
+
*/
|
|
68
|
+
export interface ConnectionStateContext {
|
|
69
|
+
/** Primary connection state */
|
|
70
|
+
state: ConnectionState;
|
|
71
|
+
/** Detailed readiness flags for current/old connection */
|
|
72
|
+
readiness: ConnectionReadiness;
|
|
73
|
+
/** Readiness flags for new connection during switching (only populated during soft/hard switch) */
|
|
74
|
+
newConnectionReadiness?: ConnectionReadiness;
|
|
75
|
+
/** Reconnection state */
|
|
76
|
+
reconnection: ReconnectionState;
|
|
77
|
+
/** Switching state */
|
|
78
|
+
switching: SwitchingState;
|
|
79
|
+
/** Timestamp of last state change */
|
|
80
|
+
lastStateChange: number;
|
|
81
|
+
/** History of recent states (for debugging) */
|
|
82
|
+
stateHistory: Array<{
|
|
83
|
+
state: ConnectionState;
|
|
84
|
+
timestamp: number;
|
|
85
|
+
reason?: string;
|
|
86
|
+
}>;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Valid state transitions
|
|
90
|
+
*/
|
|
91
|
+
export declare const VALID_TRANSITIONS: Record<ConnectionState, ConnectionState[]>;
|
|
92
|
+
/**
|
|
93
|
+
* Terminal states - once reached, no further automatic transitions
|
|
94
|
+
*/
|
|
95
|
+
export declare const TERMINAL_STATES: ConnectionState[];
|
|
96
|
+
/**
|
|
97
|
+
* States where user interaction is allowed
|
|
98
|
+
*/
|
|
99
|
+
export declare const INTERACTIVE_STATES: ConnectionState[];
|
|
100
|
+
/**
|
|
101
|
+
* States where reconnection is possible
|
|
102
|
+
*/
|
|
103
|
+
export declare const RECONNECTABLE_STATES: ConnectionState[];
|
package/dist/uneeq.d.ts
CHANGED
|
@@ -3,8 +3,10 @@ import type { CameraAnchorDistance, CameraAnchorHorizontal } from "./webrtc-data
|
|
|
3
3
|
export declare class Uneeq {
|
|
4
4
|
private readonly config;
|
|
5
5
|
private session?;
|
|
6
|
+
private messageSubscription?;
|
|
6
7
|
constructor(config: UneeqConfig);
|
|
7
8
|
init(): void;
|
|
9
|
+
isSessionActive(): boolean;
|
|
8
10
|
private ensureSessionExists;
|
|
9
11
|
chatPrompt(chatPrompt: string): void;
|
|
10
12
|
speak(speech: string): void;
|
|
@@ -15,6 +17,7 @@ export declare class Uneeq {
|
|
|
15
17
|
cameraAnchorDistance(position: CameraAnchorDistance, duration?: number): void;
|
|
16
18
|
cameraAnchorHorizontal(position: CameraAnchorHorizontal, duration?: number): void;
|
|
17
19
|
endSession(): void;
|
|
20
|
+
private resetSessionState;
|
|
18
21
|
unmuteDigitalHuman(): void;
|
|
19
22
|
muteDigitalHuman(): void;
|
|
20
23
|
stopSpeaking(): void;
|
package/package.json
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
4
|
-
* This devtool is neither made for production nor for readable output files.
|
|
5
|
-
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
6
|
-
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
7
|
-
* or disable the default devtool with "devtool: false".
|
|
8
|
-
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
9
|
-
*/
|
|
10
|
-
(Object(typeof self !== "undefined" ? self : this)["webpackChunkUneeq"] = Object(typeof self !== "undefined" ? self : this)["webpackChunkUneeq"] || []).push([["node_modules_ws_browser_js"],{
|
|
11
|
-
|
|
12
|
-
/***/ "./node_modules/ws/browser.js":
|
|
13
|
-
/*!************************************!*\
|
|
14
|
-
!*** ./node_modules/ws/browser.js ***!
|
|
15
|
-
\************************************/
|
|
16
|
-
/***/ ((module) => {
|
|
17
|
-
|
|
18
|
-
eval("\n\nmodule.exports = function () {\n throw new Error(\n 'ws does not work in the browser. Browser clients must use the native ' +\n 'WebSocket object'\n );\n};\n\n\n//# sourceURL=webpack://Uneeq/./node_modules/ws/browser.js?");
|
|
19
|
-
|
|
20
|
-
/***/ })
|
|
21
|
-
|
|
22
|
-
}]);
|