@touchcastllc/napster-companion-api-dev 2.1.0-alpha.2 → 2.1.0-alpha.4
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/README.md +24 -6
- package/lib/constants/events.d.ts +2 -1
- package/lib/index.d.ts +6 -2
- package/lib/index.esm.js +1 -1
- package/lib/index.js +1 -1
- package/lib/index.standalone.js +1 -1
- package/lib/persistence/index.d.ts +9 -0
- package/lib/types/index.d.ts +27 -36
- package/package.json +1 -1
|
@@ -63,6 +63,15 @@ export interface PersistenceController {
|
|
|
63
63
|
* whatever it had underneath.
|
|
64
64
|
*/
|
|
65
65
|
end(): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Session over, but no reload owed for it (a failed token, a dropped connection, the
|
|
68
|
+
* widget being disposed): reveal the page in place while the frame still shows the
|
|
69
|
+
* page the tab is on; once the visitor has navigated inside the frame, leave like
|
|
70
|
+
* `end()` — a top-level load of the frame's page — because revealing would show the
|
|
71
|
+
* page they started on under the url of the one they moved to (CA-1250). Returns
|
|
72
|
+
* `true` if it navigated.
|
|
73
|
+
*/
|
|
74
|
+
unwrap(): boolean;
|
|
66
75
|
/** Remove the iframe + listeners WITHOUT navigating (for a full teardown/destroy). */
|
|
67
76
|
teardown(): void;
|
|
68
77
|
}
|
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
|
|
@@ -116,7 +109,11 @@ export type FunctionCallOutputCommand = {
|
|
|
116
109
|
type: DataChannelMessageType.FUNCTION_CALL_OUTPUT;
|
|
117
110
|
data: FunctionCallOutputData;
|
|
118
111
|
};
|
|
119
|
-
|
|
112
|
+
/** Restarts the server's idle timer; the agent is told nothing (CA-1203). */
|
|
113
|
+
export type ResetInactivityTimeoutCommand = {
|
|
114
|
+
type: DataChannelMessageType.RESET_INACTIVITY_TIMEOUT;
|
|
115
|
+
};
|
|
116
|
+
export type DataChannelCommand = SendMessageCommand | CancelCommand | SetSettingsCommand | StartVideoCommand | StopVideoCommand | FunctionCallOutputCommand | ResetInactivityTimeoutCommand;
|
|
120
117
|
export declare const maxInactiveTimeoutDuration = 180000;
|
|
121
118
|
export declare const defaultCountdownDuration = 30;
|
|
122
119
|
/**
|
|
@@ -222,15 +219,6 @@ export interface FeatureConfig {
|
|
|
222
219
|
controls?: {
|
|
223
220
|
enabled: boolean;
|
|
224
221
|
};
|
|
225
|
-
/** Face tracking feature. When enabled, opens the user's camera and runs
|
|
226
|
-
* real-time face mesh detection via TensorFlow.js + MediaPipe. */
|
|
227
|
-
faceTracking?: {
|
|
228
|
-
enabled: boolean;
|
|
229
|
-
/** Detection rate in FPS. Default 15, max 30. */
|
|
230
|
-
fps?: number;
|
|
231
|
-
/** Mouth opening ratio threshold. Default 0.015. */
|
|
232
|
-
talkingThreshold?: number;
|
|
233
|
-
};
|
|
234
222
|
/** The "big card" placeholder (blurred companion photo + spinner) shown
|
|
235
223
|
* behind the entry/loading/permission-pending/permission-blocked states,
|
|
236
224
|
* and the zoom-in grow animation played when the session becomes ready.
|
|
@@ -244,6 +232,19 @@ export interface FeatureConfig {
|
|
|
244
232
|
enabled: boolean;
|
|
245
233
|
};
|
|
246
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* Face tracking is not part of the public API (CA-1149): nothing here is
|
|
237
|
+
* exported from the package, `FeatureConfig` has no `faceTracking` key and
|
|
238
|
+
* the instance has no start/stop methods. The service stays in the source
|
|
239
|
+
* tree, reachable only from the SDK's own private methods.
|
|
240
|
+
*/
|
|
241
|
+
export interface FaceTrackingFeatureConfig {
|
|
242
|
+
enabled: boolean;
|
|
243
|
+
/** Detection rate in FPS. Default 15, max 30. */
|
|
244
|
+
fps?: number;
|
|
245
|
+
/** Mouth opening ratio threshold. Default 0.015. */
|
|
246
|
+
talkingThreshold?: number;
|
|
247
|
+
}
|
|
247
248
|
/**
|
|
248
249
|
* Configuration for the face tracking service.
|
|
249
250
|
*/
|
|
@@ -608,12 +609,8 @@ export interface NapsterCompanionApiConfig {
|
|
|
608
609
|
onDestroy?: () => void;
|
|
609
610
|
/** Called whenever feature configuration is changed at runtime. */
|
|
610
611
|
onFeaturesUpdate?: (features: FeatureConfig) => void;
|
|
611
|
-
/** Called on each face tracking detection frame with face data (or null if no face detected). */
|
|
612
|
-
onFaceTrackingData?: (data: FaceTrackingData | null) => void;
|
|
613
612
|
/** Called when the screen share state changes (started or stopped). */
|
|
614
613
|
onScreenShareStateChange?: (isSharing: boolean) => void;
|
|
615
|
-
/** Called when a face tracking error occurs (camera denied, model load failure, etc.). */
|
|
616
|
-
onFaceTrackingError?: (error: Error) => void;
|
|
617
614
|
}
|
|
618
615
|
/**
|
|
619
616
|
* Public instance returned by `init`. Use these methods to control the
|
|
@@ -635,8 +632,6 @@ export interface NapsterCompanionApiInstance {
|
|
|
635
632
|
readonly sessionId: string | undefined;
|
|
636
633
|
/** Set the position of the SDK on screen (see `Position`). */
|
|
637
634
|
setPosition: (position: Position) => void;
|
|
638
|
-
/** Clear any programmatic position and revert to the configured/default position. */
|
|
639
|
-
clearPosition: () => void;
|
|
640
635
|
/** Update style configuration (e.g., view: round/silhouette/rectangle). */
|
|
641
636
|
updateStyle: (newStyle: Partial<NonNullable<NapsterCompanionApiConfig["style"]>>) => void;
|
|
642
637
|
/** Enable a named feature (one of the keys from `FeatureConfig`).
|
|
@@ -670,10 +665,6 @@ export interface NapsterCompanionApiInstance {
|
|
|
670
665
|
readonly isScreenSharing: boolean;
|
|
671
666
|
/** Whether screen sharing is supported by the browser and enabled in config. */
|
|
672
667
|
readonly isScreenShareSupported: boolean;
|
|
673
|
-
/** Start face tracking (opens camera, loads model, begins detection loop). */
|
|
674
|
-
startFaceTracking: () => Promise<void>;
|
|
675
|
-
/** Stop face tracking (pauses detection, stops camera; model stays loaded for fast restart). */
|
|
676
|
-
stopFaceTracking: () => void;
|
|
677
668
|
/** Mute the avatar's audio output. */
|
|
678
669
|
muteAudio: () => void;
|
|
679
670
|
/** Unmute the avatar's audio output. */
|