@connekz/connekz-agent 0.9.0 → 0.12.0
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/connekz-agent.css +1 -1
- package/dist/connekz-agent.es.js +1495 -1544
- package/dist/connekz-agent.umd.js +10 -10
- package/package.json +2 -1
- package/types.d.ts +90 -40
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@connekz/connekz-agent",
|
|
3
3
|
"private": false,
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.12.0",
|
|
6
6
|
"description": "A package for Connekz clients to integrate Connekz Agent into their applications.",
|
|
7
7
|
"main": "dist/connekz-agent.umd.js",
|
|
8
8
|
"module": "dist/connekz-agent.es.js",
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
"typescript": "~5.8.0",
|
|
89
89
|
"typescript-eslint": "^8.31.1",
|
|
90
90
|
"vite": "^6.2.4",
|
|
91
|
+
"vite-plugin-dts": "^4.5.4",
|
|
91
92
|
"vite-plugin-vue-devtools": "^7.7.2",
|
|
92
93
|
"vue-tsc": "^2.2.8"
|
|
93
94
|
}
|
package/types.d.ts
CHANGED
|
@@ -1,60 +1,110 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export type ToolCallPayload = {
|
|
2
|
+
arguments: Record<string, any>;
|
|
3
|
+
name: string;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Enum for voice agent statuses
|
|
8
|
+
*/
|
|
9
|
+
export enum VoiceAgentStatus {
|
|
10
|
+
DISCONNECTED = 'DISCONNECTED',
|
|
11
|
+
STOPPED = 'STOPPED',
|
|
12
|
+
INITIATING = 'INITIATING',
|
|
13
|
+
LISTENING = 'LISTENING',
|
|
14
|
+
SPEAKING = 'SPEAKING',
|
|
15
|
+
SLEEPING = 'SLEEPING',
|
|
16
|
+
USER_SPEAKING = 'USER_SPEAKING',
|
|
17
|
+
THINKING = 'THINKING',
|
|
18
|
+
EXECUTING = 'EXECUTING',
|
|
19
|
+
ERROR = 'ERROR',
|
|
20
|
+
IDLE = 'IDLE',
|
|
21
|
+
}
|
|
3
22
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
23
|
+
export interface ConnekzConversation {
|
|
24
|
+
role: 'user' | 'ai';
|
|
25
|
+
message: string;
|
|
26
|
+
at: string; // ISO date string
|
|
27
|
+
conversationId: number;
|
|
28
|
+
forcedDisplay?: boolean; // Whether force to display this message
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Export types for consumers of the package
|
|
32
|
+
export type ConnekzOptions = {
|
|
33
|
+
clientId: string; // Client ID for the connekz instance
|
|
34
|
+
clientSecret: string; // Client secret for the connekz instance
|
|
35
|
+
chatWindow?: {
|
|
36
|
+
mountElementId: string;
|
|
37
|
+
disableTalkMode?: boolean;
|
|
38
|
+
disableChatMode?: boolean;
|
|
39
|
+
} | undefined;
|
|
40
|
+
aiSphere?: {
|
|
41
|
+
mountElementId: string;
|
|
42
|
+
themeColor?: string;
|
|
43
|
+
};
|
|
44
|
+
transcription?: {
|
|
45
|
+
mountElementId: string;
|
|
46
|
+
};
|
|
47
|
+
connekzControls?: {
|
|
48
|
+
mountElementId: string;
|
|
49
|
+
}
|
|
8
50
|
userIdentity?: string;
|
|
9
|
-
baseUrl?: string;
|
|
51
|
+
baseUrl?: string; // Base URL for the connekz instance
|
|
10
52
|
};
|
|
11
53
|
|
|
12
|
-
|
|
13
|
-
export
|
|
14
|
-
|
|
54
|
+
export type ConnekzAgentStatus = VoiceAgentStatus;
|
|
55
|
+
export type ConnekzTranscript = ConnekzConversation;
|
|
56
|
+
export type ConnekzToolCallPayload = ToolCallPayload;
|
|
57
|
+
|
|
58
|
+
// New: Subscription types
|
|
59
|
+
export type Unsubscriber = () => void;
|
|
60
|
+
export interface SocketSubscribeAPI {
|
|
61
|
+
onIsConnectingChange: (cb: (value: boolean) => void) => Unsubscriber;
|
|
62
|
+
onIsConnectedChange: (cb: (value: boolean) => void) => Unsubscriber;
|
|
15
63
|
}
|
|
16
64
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
65
|
+
export interface AgentSubscribeAPI {
|
|
66
|
+
onAgentStatusChange: (cb: (value: VoiceAgentStatus) => void) => Unsubscriber;
|
|
67
|
+
onMicStatusChange: (cb: (value: 'active' | 'muted') => void) => Unsubscriber;
|
|
68
|
+
onUserWaveformUpdate: (cb: (value: number) => void) => Unsubscriber;
|
|
69
|
+
onAgentWaveformUpdate: (cb: (value: number) => void) => Unsubscriber;
|
|
70
|
+
onTranscriptUpdate: (cb: (value: readonly ConnekzConversation[]) => void) => Unsubscriber;
|
|
71
|
+
onToolCall: (cb: (payload: ConnekzToolCallPayload) => Promise<string>) => Unsubscriber;
|
|
72
|
+
}
|
|
21
73
|
|
|
22
|
-
//
|
|
23
|
-
export interface
|
|
24
|
-
|
|
74
|
+
// Headless Socket API exposure (initial values + actions + subs)
|
|
75
|
+
export interface ConnekzSocketAPI {
|
|
76
|
+
connect: (force?: boolean) => void;
|
|
77
|
+
disconnect: () => void;
|
|
78
|
+
cleanup: () => void;
|
|
79
|
+
subscribe: SocketSubscribeAPI;
|
|
25
80
|
}
|
|
26
81
|
|
|
27
|
-
//
|
|
28
|
-
export
|
|
82
|
+
// Headless Voice Agent API exposure (initial values + actions + subs)
|
|
83
|
+
export interface VoiceAgentAPI {
|
|
84
|
+
startAgent: () => Promise<void>;
|
|
85
|
+
stopAgent: () => void;
|
|
86
|
+
makeSleep: () => void;
|
|
87
|
+
injectMessage: (messageText: string) => void;
|
|
88
|
+
startCaptureTest: () => void;
|
|
89
|
+
stopCaptureTest: () => void;
|
|
90
|
+
playCapturedAudio: () => void;
|
|
91
|
+
toggleMic: () => void;
|
|
92
|
+
subscribe: AgentSubscribeAPI;
|
|
93
|
+
}
|
|
29
94
|
|
|
30
95
|
// Define the return type of initConnekzChat
|
|
31
|
-
export interface
|
|
96
|
+
export interface ConnekzInstance {
|
|
32
97
|
unmount: () => void;
|
|
98
|
+
connekzSocket: ConnekzSocketAPI;
|
|
99
|
+
connekzAgent: VoiceAgentAPI;
|
|
33
100
|
}
|
|
34
101
|
|
|
35
102
|
/**
|
|
36
103
|
* Initializes the Connekz chat widget in a specified DOM element.
|
|
37
|
-
*
|
|
104
|
+
*
|
|
38
105
|
* @param options - Configuration options for the chat widget.
|
|
39
106
|
* @returns An instance of the chat widget with methods to interact with it.
|
|
40
107
|
*/
|
|
41
|
-
export default function
|
|
42
|
-
|
|
43
|
-
declare module '@connekz/connekz-agent';
|
|
44
|
-
|
|
45
|
-
declare module '*.webp' {
|
|
46
|
-
const value: string;
|
|
47
|
-
export default value;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
declare module '*.png' {
|
|
51
|
-
const value: string;
|
|
52
|
-
export default value;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
declare module '*.svg' {
|
|
56
|
-
const value: string;
|
|
57
|
-
export default value;
|
|
58
|
-
}
|
|
108
|
+
export default function initConnekz(options: ConnekzOptions): ConnekzInstance;
|
|
59
109
|
|
|
60
|
-
|
|
110
|
+
declare module '@connekz/connekz-agent';
|