@touchcastllc/napster-companion-api-dev 2.1.0-alpha.3 → 2.1.0-alpha.5
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/lib/index.d.ts +1 -8
- package/lib/index.esm.js +1 -1
- package/lib/index.js +1 -1
- package/lib/index.standalone.js +1 -1
- package/lib/stores/index.d.ts +1 -1
- package/lib/stores/selectors.d.ts +0 -1
- package/lib/stores/slices/avatarSlice.d.ts +1 -2
- package/lib/types/errors.d.ts +1 -18
- package/lib/types/index.d.ts +9 -95
- package/package.json +2 -12
- package/lib/services/faceTracking.d.ts +0 -13
- package/lib/utils/mouthDetection.d.ts +0 -24
package/lib/stores/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { store } from "./store";
|
|
|
2
2
|
export type { RootState } from "./store";
|
|
3
3
|
export { setOnFeaturesUpdateCallback } from "./middleware/featuresUpdateMiddleware";
|
|
4
4
|
export * from "./selectors";
|
|
5
|
-
export { setSessionId, setTransport, setStopInteraction, setMuted, setMicUnavailable, setMicRecoveryOpen, setMicSourceMuted,
|
|
5
|
+
export { setSessionId, setTransport, setStopInteraction, setMuted, setMicUnavailable, setMicRecoveryOpen, setMicSourceMuted, setVolume, setAvatarSpeaking, setScreenSharing, setUserTalking, setConnectionToken, setCloseConnectionHandler, setSessionTerminatedByServer, resetAvatar, } from "./slices/avatarSlice";
|
|
6
6
|
export { setSessionStatus, resetSession } from "./slices/sessionSlice";
|
|
7
7
|
export type { SessionStatus } from "./slices/sessionSlice";
|
|
8
8
|
export { setFeatures, resetFeatures, setDebugMode } from "./slices/appSlice";
|
|
@@ -11,7 +11,6 @@ export declare const selectMuted: (state: RootState) => boolean;
|
|
|
11
11
|
export declare const selectMicUnavailable: (state: RootState) => boolean;
|
|
12
12
|
export declare const selectMicRecoveryOpen: (state: RootState) => boolean;
|
|
13
13
|
export declare const selectMicSourceMuted: (state: RootState) => boolean;
|
|
14
|
-
export declare const selectAutoMicActive: (state: RootState) => boolean;
|
|
15
14
|
export declare const selectAvatarSpeaking: (state: RootState) => boolean;
|
|
16
15
|
export declare const selectUserTalking: (state: RootState) => boolean;
|
|
17
16
|
export declare const selectConnectionToken: (state: RootState) => string | undefined;
|
|
@@ -7,7 +7,6 @@ export interface AvatarState {
|
|
|
7
7
|
micUnavailable: boolean;
|
|
8
8
|
micRecoveryOpen: boolean;
|
|
9
9
|
micSourceMuted: boolean;
|
|
10
|
-
autoMicActive: boolean;
|
|
11
10
|
volume: number;
|
|
12
11
|
avatarSpeaking: boolean;
|
|
13
12
|
isScreenSharing: boolean;
|
|
@@ -16,5 +15,5 @@ export interface AvatarState {
|
|
|
16
15
|
closeConnectionHandler?: () => void;
|
|
17
16
|
sessionTerminatedByServer: boolean;
|
|
18
17
|
}
|
|
19
|
-
export declare const setSessionId: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setSessionId">, setTransport: import("@reduxjs/toolkit").ActionCreatorWithPayload<Transport | null, "avatar/setTransport">, setStopInteraction: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setStopInteraction">, setMuted: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setMuted">, setMicUnavailable: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setMicUnavailable">, setMicRecoveryOpen: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setMicRecoveryOpen">, setMicSourceMuted: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setMicSourceMuted">,
|
|
18
|
+
export declare const setSessionId: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setSessionId">, setTransport: import("@reduxjs/toolkit").ActionCreatorWithPayload<Transport | null, "avatar/setTransport">, setStopInteraction: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setStopInteraction">, setMuted: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setMuted">, setMicUnavailable: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setMicUnavailable">, setMicRecoveryOpen: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setMicRecoveryOpen">, setMicSourceMuted: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setMicSourceMuted">, setVolume: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, "avatar/setVolume">, setAvatarSpeaking: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setAvatarSpeaking">, setScreenSharing: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setScreenSharing">, setUserTalking: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setUserTalking">, setConnectionToken: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setConnectionToken">, setCloseConnectionHandler: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<(() => void) | undefined, "avatar/setCloseConnectionHandler">, setSessionTerminatedByServer: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setSessionTerminatedByServer">, resetAvatar: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"avatar/resetAvatar">;
|
|
20
19
|
export declare const avatarReducer: import("redux").Reducer<AvatarState>;
|
package/lib/types/errors.d.ts
CHANGED
|
@@ -42,24 +42,12 @@ export declare class ConnectionError extends SDKError {
|
|
|
42
42
|
export declare class WebRTCError extends SDKError {
|
|
43
43
|
constructor(message: string, context?: Record<string, unknown>);
|
|
44
44
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Feature related errors
|
|
47
|
-
*/
|
|
48
|
-
export declare class FeatureError extends SDKError {
|
|
49
|
-
constructor(message: string, context?: Record<string, unknown>);
|
|
50
|
-
}
|
|
51
45
|
/**
|
|
52
46
|
* Media related errors (video, audio)
|
|
53
47
|
*/
|
|
54
48
|
export declare class MediaError extends SDKError {
|
|
55
49
|
constructor(message: string, context?: Record<string, unknown>);
|
|
56
50
|
}
|
|
57
|
-
/**
|
|
58
|
-
* Face tracking related errors
|
|
59
|
-
*/
|
|
60
|
-
export declare class FaceTrackingError extends SDKError {
|
|
61
|
-
constructor(message: string, code: string, context?: Record<string, unknown>);
|
|
62
|
-
}
|
|
63
51
|
/**
|
|
64
52
|
* Error codes enum for consistent error identification
|
|
65
53
|
*/
|
|
@@ -80,14 +68,9 @@ export declare enum ErrorCodes {
|
|
|
80
68
|
INVALID_CONFIGURATION = "INVALID_CONFIGURATION",
|
|
81
69
|
MISSING_REQUIRED_CONFIG = "MISSING_REQUIRED_CONFIG",
|
|
82
70
|
FEATURE_NOT_SUPPORTED = "FEATURE_NOT_SUPPORTED",
|
|
83
|
-
FEATURE_DISABLED = "FEATURE_DISABLED",
|
|
84
71
|
MEDIA_ACCESS_DENIED = "MEDIA_ACCESS_DENIED",
|
|
85
72
|
MEDIA_DEVICE_ERROR = "MEDIA_DEVICE_ERROR",
|
|
86
|
-
VIDEO_LOAD_ERROR = "VIDEO_LOAD_ERROR"
|
|
87
|
-
CAMERA_PERMISSION_DENIED = "CAMERA_PERMISSION_DENIED",
|
|
88
|
-
CAMERA_NOT_FOUND = "CAMERA_NOT_FOUND",
|
|
89
|
-
MODEL_LOAD_FAILED = "MODEL_LOAD_FAILED",
|
|
90
|
-
DETECTION_FAILED = "DETECTION_FAILED"
|
|
73
|
+
VIDEO_LOAD_ERROR = "VIDEO_LOAD_ERROR"
|
|
91
74
|
}
|
|
92
75
|
/**
|
|
93
76
|
* Type guard to check if an error is an SDK error
|
package/lib/types/index.d.ts
CHANGED
|
@@ -15,19 +15,6 @@ export declare enum Position {
|
|
|
15
15
|
TOP_LEFT = "top-left",
|
|
16
16
|
CENTER = "center"
|
|
17
17
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Function definition for AI companion function calling.
|
|
20
|
-
* Functions allow the AI companion to invoke external tools or actions
|
|
21
|
-
* during a conversation.
|
|
22
|
-
*/
|
|
23
|
-
export interface CompanionFunction {
|
|
24
|
-
/** Unique function name the AI can invoke. */
|
|
25
|
-
name: string;
|
|
26
|
-
/** Human-readable description of what the function does. */
|
|
27
|
-
description?: string;
|
|
28
|
-
/** JSON-Schema style parameter definitions. */
|
|
29
|
-
parameters?: Record<string, unknown>;
|
|
30
|
-
}
|
|
31
18
|
/**
|
|
32
19
|
* A full function definition registered inline at runtime via
|
|
33
20
|
* `set_settings.inline_functions`. Mirrors the backend's function record: a
|
|
@@ -65,7 +52,10 @@ export interface SendMessageData {
|
|
|
65
52
|
trigger_response: boolean;
|
|
66
53
|
/** Optional ID of the previous message in the conversation thread */
|
|
67
54
|
previous_item_id?: string;
|
|
68
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* With `trigger_response: true`, the agent finishes its current speech
|
|
57
|
+
* before replying.
|
|
58
|
+
*/
|
|
69
59
|
delay?: boolean;
|
|
70
60
|
}
|
|
71
61
|
/**
|
|
@@ -83,8 +73,11 @@ export type SetSettingsCommand = {
|
|
|
83
73
|
data: {
|
|
84
74
|
/** Session/connection modality (e.g. `"video"` for the avatar connection). */
|
|
85
75
|
modality?: string;
|
|
86
|
-
/**
|
|
87
|
-
|
|
76
|
+
/**
|
|
77
|
+
* IDs of functions already registered on the backend — not definitions.
|
|
78
|
+
* To register a definition at runtime, use `inline_functions`.
|
|
79
|
+
*/
|
|
80
|
+
functions?: string[];
|
|
88
81
|
/**
|
|
89
82
|
* Full function definitions provided inline at runtime. Used to register
|
|
90
83
|
* tools MID-SESSION — e.g. the WebMCP bridge pushes the page's live
|
|
@@ -239,83 +232,6 @@ export interface FeatureConfig {
|
|
|
239
232
|
enabled: boolean;
|
|
240
233
|
};
|
|
241
234
|
}
|
|
242
|
-
/**
|
|
243
|
-
* Face tracking is not part of the public API (CA-1149): nothing here is
|
|
244
|
-
* exported from the package, `FeatureConfig` has no `faceTracking` key and
|
|
245
|
-
* the instance has no start/stop methods. The service stays in the source
|
|
246
|
-
* tree, reachable only from the SDK's own private methods.
|
|
247
|
-
*/
|
|
248
|
-
export interface FaceTrackingFeatureConfig {
|
|
249
|
-
enabled: boolean;
|
|
250
|
-
/** Detection rate in FPS. Default 15, max 30. */
|
|
251
|
-
fps?: number;
|
|
252
|
-
/** Mouth opening ratio threshold. Default 0.015. */
|
|
253
|
-
talkingThreshold?: number;
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Configuration for the face tracking service.
|
|
257
|
-
*/
|
|
258
|
-
export interface FaceTrackingConfig {
|
|
259
|
-
/** Detection rate in frames per second. Default 15, max 30. */
|
|
260
|
-
fps?: number;
|
|
261
|
-
/** Mouth opening ratio threshold to determine talking state. Default 0.015. */
|
|
262
|
-
talkingThreshold?: number;
|
|
263
|
-
/** Number of frames for rolling average smoothing. Default 5. */
|
|
264
|
-
smoothingFrames?: number;
|
|
265
|
-
/** Camera video width. Default 640. */
|
|
266
|
-
videoWidth?: number;
|
|
267
|
-
/** Camera video height. Default 480. */
|
|
268
|
-
videoHeight?: number;
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Normalized mouth landmark positions (0–1 range).
|
|
272
|
-
*/
|
|
273
|
-
export interface MouthLandmarks {
|
|
274
|
-
topLip: {
|
|
275
|
-
x: number;
|
|
276
|
-
y: number;
|
|
277
|
-
};
|
|
278
|
-
bottomLip: {
|
|
279
|
-
x: number;
|
|
280
|
-
y: number;
|
|
281
|
-
};
|
|
282
|
-
leftCorner: {
|
|
283
|
-
x: number;
|
|
284
|
-
y: number;
|
|
285
|
-
};
|
|
286
|
-
rightCorner: {
|
|
287
|
-
x: number;
|
|
288
|
-
y: number;
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Face tracking data emitted on each detection frame.
|
|
293
|
-
*/
|
|
294
|
-
export interface FaceTrackingData {
|
|
295
|
-
/** 468 normalized face landmarks (x, y, z in 0–1 range). */
|
|
296
|
-
landmarks: Array<{
|
|
297
|
-
x: number;
|
|
298
|
-
y: number;
|
|
299
|
-
z: number;
|
|
300
|
-
}>;
|
|
301
|
-
/** Normalized mouth landmark positions, or null if not detected. */
|
|
302
|
-
mouthLandmarks: MouthLandmarks | null;
|
|
303
|
-
/** Whether the user is currently talking based on smoothed mouth-opening ratio. */
|
|
304
|
-
isTalking: boolean;
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Controller returned by createFaceTrackingService for managing the detection lifecycle.
|
|
308
|
-
*/
|
|
309
|
-
export interface FaceTrackingController {
|
|
310
|
-
/** Initialize camera + model and start the detection loop. */
|
|
311
|
-
start(): Promise<void>;
|
|
312
|
-
/** Pause detection and stop camera, but keep the model loaded for fast restart. */
|
|
313
|
-
stop(): void;
|
|
314
|
-
/** Whether the detection loop is currently running. */
|
|
315
|
-
isActive(): boolean;
|
|
316
|
-
/** Full teardown: stop + dispose model + null all refs. */
|
|
317
|
-
destroy(): void;
|
|
318
|
-
}
|
|
319
235
|
export interface StyleConfig {
|
|
320
236
|
/** Avatar visual style: "round" | "rectangle" | "silhouette" (Default: "round").
|
|
321
237
|
*
|
|
@@ -639,8 +555,6 @@ export interface NapsterCompanionApiInstance {
|
|
|
639
555
|
readonly sessionId: string | undefined;
|
|
640
556
|
/** Set the position of the SDK on screen (see `Position`). */
|
|
641
557
|
setPosition: (position: Position) => void;
|
|
642
|
-
/** Clear any programmatic position and revert to the configured/default position. */
|
|
643
|
-
clearPosition: () => void;
|
|
644
558
|
/** Update style configuration (e.g., view: round/silhouette/rectangle). */
|
|
645
559
|
updateStyle: (newStyle: Partial<NonNullable<NapsterCompanionApiConfig["style"]>>) => void;
|
|
646
560
|
/** Enable a named feature (one of the keys from `FeatureConfig`).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@touchcastllc/napster-companion-api-dev",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.5",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"napster",
|
|
6
6
|
"companion-api",
|
|
@@ -38,17 +38,7 @@
|
|
|
38
38
|
"!lib/**/*.spec.*"
|
|
39
39
|
],
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@reduxjs/toolkit": "^2.0.0"
|
|
42
|
-
"@tensorflow-models/face-landmarks-detection": "^1.0.0",
|
|
43
|
-
"@tensorflow/tfjs": "^4.0.0"
|
|
44
|
-
},
|
|
45
|
-
"peerDependenciesMeta": {
|
|
46
|
-
"@tensorflow/tfjs": {
|
|
47
|
-
"optional": true
|
|
48
|
-
},
|
|
49
|
-
"@tensorflow-models/face-landmarks-detection": {
|
|
50
|
-
"optional": true
|
|
51
|
-
}
|
|
41
|
+
"@reduxjs/toolkit": "^2.0.0"
|
|
52
42
|
},
|
|
53
43
|
"publishConfig": {
|
|
54
44
|
"access": "public"
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { FaceTrackingConfig, FaceTrackingData, FaceTrackingController } from "../types";
|
|
2
|
-
interface FaceTrackingCallbacks {
|
|
3
|
-
onData?: (data: FaceTrackingData | null) => void;
|
|
4
|
-
onError?: (error: Error) => void;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Creates a vanilla-JS face tracking service using TensorFlow.js + MediaPipe Face Mesh.
|
|
8
|
-
*
|
|
9
|
-
* Lazy-loads @tensorflow/tfjs and @tensorflow-models/face-landmarks-detection
|
|
10
|
-
* only when start() is called, keeping the main bundle small (~2MB deferred).
|
|
11
|
-
*/
|
|
12
|
-
export declare function createFaceTrackingService(config?: FaceTrackingConfig, callbacks?: FaceTrackingCallbacks): FaceTrackingController;
|
|
13
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { MouthLandmarks } from "../types";
|
|
2
|
-
/**
|
|
3
|
-
* Creates a rolling average smoother for mouth-opening ratios.
|
|
4
|
-
*/
|
|
5
|
-
export declare function createMouthOpeningSmoothing(windowSize?: number): {
|
|
6
|
-
push(value: number): number;
|
|
7
|
-
reset(): void;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Calculates mouth opening ratio and normalized mouth landmarks from raw keypoints.
|
|
11
|
-
*
|
|
12
|
-
* @param keypoints - Raw face mesh keypoints (pixel coordinates)
|
|
13
|
-
* @param videoWidth - Video width for normalization
|
|
14
|
-
* @param videoHeight - Video height for normalization
|
|
15
|
-
* @returns Mouth landmarks (normalized 0–1) and raw opening ratio, or null if landmarks are missing
|
|
16
|
-
*/
|
|
17
|
-
export declare function calculateMouthOpening(keypoints: Array<{
|
|
18
|
-
x: number;
|
|
19
|
-
y: number;
|
|
20
|
-
z?: number;
|
|
21
|
-
}>, videoWidth: number, videoHeight: number): {
|
|
22
|
-
mouthLandmarks: MouthLandmarks;
|
|
23
|
-
openingRatio: number;
|
|
24
|
-
} | null;
|