@connekz/connekz-agent 0.9.0 → 0.11.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/types.d.ts +66 -39
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.9.0",
5
+ "version": "0.11.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",
package/types.d.ts CHANGED
@@ -1,60 +1,87 @@
1
- // src/index.d.ts
1
+ // index.d.ts
2
2
  import 'unfonts.css';
3
+ import type {ConnekzConversation} from "@/store/connekz.ts";
4
+ import type {VoiceAgentStatus} from "@/composable/useVoiceAgent.ts";
5
+ import type {ToolCallPayload} from "@/index.ts"; // Added: For ref types in exposure
3
6
 
4
- // Alias AppProps as ConnekzChatOptions
5
- export type ConnekzChatOptions = {
6
- clientId: string;
7
- clientSecret: string;
7
+
8
+ // Export types for consumers of the package
9
+ export type ConnekzOptions = {
10
+ clientId: string; // Client ID for the connekz instance
11
+ clientSecret: string; // Client secret for the connekz instance
12
+ chatWindow?: {
13
+ mountElementId: string;
14
+ disableTalkMode?: boolean;
15
+ disableChatMode?: boolean;
16
+ } | undefined;
17
+ aiSphere?: {
18
+ mountElementId: string;
19
+ themeColor?: string;
20
+ };
21
+ transcription?: {
22
+ mountElementId: string;
23
+ };
24
+ connekzControls?: {
25
+ mountElementId: string;
26
+ }
8
27
  userIdentity?: string;
9
- baseUrl?: string;
28
+ baseUrl?: string; // Base URL for the connekz instance
10
29
  };
11
30
 
12
- // Define the props interface for App.vue
13
- export interface AppProps {
14
- sampleProperty: string; // Sample property for now
31
+ export type ConnekzAgentStatus = VoiceAgentStatus;
32
+ export type ConnekzTranscript = ConnekzConversation;
33
+ export type ConnekzToolCallPayload = ToolCallPayload;
34
+
35
+ // New: Subscription types
36
+ export type Unsubscriber = () => void;
37
+ export interface SocketSubscribeAPI {
38
+ onIsConnectingChange: (cb: (value: boolean) => void) => Unsubscriber;
39
+ onIsConnectedChange: (cb: (value: boolean) => void) => Unsubscriber;
15
40
  }
16
41
 
17
- // Define the emits type for App.vue
18
- export type AppEmits = {
19
- 'sample-event': (value: string) => void;
20
- };
42
+ export interface AgentSubscribeAPI {
43
+ onAgentStatusChange: (cb: (value: VoiceAgentStatus) => void) => Unsubscriber;
44
+ onMicStatusChange: (cb: (value: 'active' | 'muted') => void) => Unsubscriber;
45
+ onUserWaveformUpdate: (cb: (value: number) => void) => Unsubscriber;
46
+ onAgentWaveformUpdate: (cb: (value: number) => void) => Unsubscriber;
47
+ onTranscriptUpdate: (cb: (value: readonly ConnekzConversation[]) => void) => Unsubscriber;
48
+ onToolCall: (cb: (payload: ConnekzToolCallPayload) => Promise<string>) => Unsubscriber;
49
+ }
21
50
 
22
- // Define the exposed functions interface for App.vue
23
- export interface AppExposed {
24
- sampleExposeFunction: (message: string) => void;
51
+ // Headless Socket API exposure (initial values + actions + subs)
52
+ export interface ConnekzSocketAPI {
53
+ connect: (force?: boolean) => void;
54
+ disconnect: () => void;
55
+ cleanup: () => void;
56
+ subscribe: SocketSubscribeAPI;
25
57
  }
26
58
 
27
- // Export types for consumers of the package
28
- export type { AppProps, AppExposed, AppEmits };
59
+ // Headless Voice Agent API exposure (initial values + actions + subs)
60
+ export interface VoiceAgentAPI {
61
+ startAgent: () => Promise<void>;
62
+ stopAgent: () => void;
63
+ makeSleep: () => void;
64
+ injectMessage: (messageText: string) => void;
65
+ startCaptureTest: () => void;
66
+ stopCaptureTest: () => void;
67
+ playCapturedAudio: () => void;
68
+ toggleMic: () => void;
69
+ subscribe: AgentSubscribeAPI;
70
+ }
29
71
 
30
72
  // Define the return type of initConnekzChat
31
- export interface ConnekzChatInstance extends AppEmits, AppExposed {
73
+ export interface ConnekzInstance {
32
74
  unmount: () => void;
75
+ connekzSocket: ConnekzSocketAPI;
76
+ connekzAgent: VoiceAgentAPI;
33
77
  }
34
78
 
35
79
  /**
36
80
  * Initializes the Connekz chat widget in a specified DOM element.
37
- * @param divId - The ID of the parent div where the chat widget will be mounted.
81
+ *
38
82
  * @param options - Configuration options for the chat widget.
39
83
  * @returns An instance of the chat widget with methods to interact with it.
40
84
  */
41
- export default function initConnekzChat(divId: string, options: ConnekzChatOptions): ConnekzChatInstance;
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
- }
85
+ export default function initConnekz(options: ConnekzOptions): ConnekzInstance;
59
86
 
60
- export type GenericColors = 'neutral' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error';
87
+ declare module '@connekz/connekz-agent';