@connekz/connekz-agent 2.0.0 → 2.3.2
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/CHANGELOG.md +66 -0
- package/README.md +28 -1
- package/dist/connekz-agent.es.js +2483 -2454
- package/dist/connekz-agent.umd.js +11 -11
- package/package.json +2 -3
- package/types.d.ts +35 -3
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@connekz/connekz-agent",
|
|
3
3
|
"private": false,
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.3.2",
|
|
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",
|
|
@@ -22,8 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"import": "./dist/connekz-agent.es.js",
|
|
24
24
|
"require": "./dist/connekz-agent.umd.js"
|
|
25
|
-
}
|
|
26
|
-
"./connekz-agent.css": "./dist/connekz-agent.css"
|
|
25
|
+
}
|
|
27
26
|
},
|
|
28
27
|
"scripts": {
|
|
29
28
|
"dev": "vite",
|
package/types.d.ts
CHANGED
|
@@ -28,6 +28,17 @@ export type ConnekzTranscript = {
|
|
|
28
28
|
forcedDisplay?: boolean; // Whether force to display this message
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* A single message in the full conversation history returned by
|
|
33
|
+
* `connekzAgent.getConversation()`. Covers both voice and text turns.
|
|
34
|
+
*/
|
|
35
|
+
export type ConnekzConversationMessage = {
|
|
36
|
+
id?: string; // Server message id (absent for not-yet-persisted local messages)
|
|
37
|
+
role: 'user' | 'ai' | 'system';
|
|
38
|
+
message: string;
|
|
39
|
+
at: string; // ISO date string (message createdAt)
|
|
40
|
+
}
|
|
41
|
+
|
|
31
42
|
// Export types for consumers of the package
|
|
32
43
|
export type ConnekzOptions = {
|
|
33
44
|
clientId: string; // Client ID for the connekz instance
|
|
@@ -88,11 +99,11 @@ export interface SocketSubscribeAPI {
|
|
|
88
99
|
}
|
|
89
100
|
|
|
90
101
|
export interface AgentSubscribeAPI {
|
|
91
|
-
onAgentStatusChange: (cb: (value:
|
|
102
|
+
onAgentStatusChange: (cb: (value: ConnekzAgentStatus) => void) => Unsubscriber;
|
|
92
103
|
onMicStatusChange: (cb: (value: 'active' | 'muted') => void) => Unsubscriber;
|
|
93
104
|
onUserWaveformUpdate: (cb: (value: number) => void) => Unsubscriber;
|
|
94
105
|
onAgentWaveformUpdate: (cb: (value: number) => void) => Unsubscriber;
|
|
95
|
-
onTranscriptUpdate: (cb: (value: readonly
|
|
106
|
+
onTranscriptUpdate: (cb: (value: readonly ConnekzTranscript[]) => void) => Unsubscriber;
|
|
96
107
|
onToolCall: (cb: (payload: ConnekzToolCallPayload) => Promise<string>) => Unsubscriber;
|
|
97
108
|
onConnectionQualityChange: (cb: (value: ConnectionQuality) => void) => Unsubscriber;
|
|
98
109
|
onError: (cb: (value: ConnekzError) => void) => Unsubscriber;
|
|
@@ -110,12 +121,33 @@ export interface ConnekzSocketAPI {
|
|
|
110
121
|
export interface VoiceAgentAPI {
|
|
111
122
|
startAgent: () => Promise<void>;
|
|
112
123
|
stopAgent: () => void;
|
|
113
|
-
makeSleep: () => void;
|
|
114
124
|
injectMessage: (messageText: string) => void;
|
|
125
|
+
/**
|
|
126
|
+
* Load on-demand memories/tools (created with Load Mode "On-Demand" in the
|
|
127
|
+
* portal) into the current session by slug. Calling again replaces the
|
|
128
|
+
* previous set; an empty array clears all on-demand items. Safe to call
|
|
129
|
+
* before startAgent() — pending slugs apply when the session starts.
|
|
130
|
+
*/
|
|
131
|
+
setSessionTools: (slugs: string[]) => void;
|
|
115
132
|
startCaptureTest: () => void;
|
|
116
133
|
stopCaptureTest: () => void;
|
|
117
134
|
playCapturedAudio: () => void;
|
|
118
135
|
toggleMic: () => void;
|
|
136
|
+
/**
|
|
137
|
+
* Returns the full conversation history for the current thread as a
|
|
138
|
+
* chronological snapshot (ascending by time). Includes BOTH voice and text
|
|
139
|
+
* turns — seeded from the server thread history and kept live as new messages
|
|
140
|
+
* arrive. Returns an empty array before any conversation exists.
|
|
141
|
+
*
|
|
142
|
+
* Typical use: call this inside an `onToolCall` handler (e.g. when a booking
|
|
143
|
+
* tool fires) to capture the transcript and forward it to your own backend.
|
|
144
|
+
*/
|
|
145
|
+
getConversation: () => ConnekzConversationMessage[];
|
|
146
|
+
/**
|
|
147
|
+
* Returns the current chat thread id, or null before a thread is established.
|
|
148
|
+
* Useful for correlating a captured transcript with the server-side thread.
|
|
149
|
+
*/
|
|
150
|
+
getThreadId: () => string | null;
|
|
119
151
|
subscribe: AgentSubscribeAPI;
|
|
120
152
|
}
|
|
121
153
|
|