@lokutor/sdk 1.1.10 → 1.1.12

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/index.d.mts CHANGED
@@ -97,6 +97,28 @@ interface Viseme {
97
97
  c: string;
98
98
  t: number;
99
99
  }
100
+ /**
101
+ * Tool definition for LLM function calling (OpenAI format)
102
+ */
103
+ interface ToolDefinition {
104
+ type: 'function';
105
+ function: {
106
+ name: string;
107
+ description: string;
108
+ parameters: {
109
+ type: 'object';
110
+ properties: Record<string, any>;
111
+ required?: string[];
112
+ };
113
+ };
114
+ }
115
+ /**
116
+ * Event data for tool execution
117
+ */
118
+ interface ToolCall {
119
+ name: string;
120
+ arguments: string;
121
+ }
100
122
 
101
123
  /**
102
124
  * Main client for Lokutor Voice Agent SDK
@@ -109,6 +131,7 @@ declare class VoiceAgentClient {
109
131
  prompt: string;
110
132
  voice: VoiceStyle;
111
133
  language: Language;
134
+ tools: ToolDefinition[];
112
135
  private onTranscription?;
113
136
  private onResponse?;
114
137
  private onAudioCallback?;
@@ -119,12 +142,21 @@ declare class VoiceAgentClient {
119
142
  private messages;
120
143
  private visemeListeners;
121
144
  private wantVisemes;
145
+ private audioManager;
146
+ private enableAudio;
147
+ private currentGeneration;
148
+ private isUserDisconnect;
149
+ private reconnecting;
150
+ private reconnectAttempts;
151
+ private maxReconnectAttempts;
122
152
  constructor(config: LokutorConfig & {
123
153
  prompt: string;
124
154
  voice?: VoiceStyle;
125
155
  language?: Language;
126
156
  visemes?: boolean;
127
157
  onVisemes?: (visemes: Viseme[]) => void;
158
+ enableAudio?: boolean;
159
+ tools?: ToolDefinition[];
128
160
  });
129
161
  /**
130
162
  * Connect to the Lokutor Voice Agent server
@@ -155,6 +187,15 @@ declare class VoiceAgentClient {
155
187
  * Disconnect from the server
156
188
  */
157
189
  disconnect(): void;
190
+ /**
191
+ * Toggles the microphone mute state (if managed by client)
192
+ * returns the new mute state
193
+ */
194
+ toggleMute(): boolean;
195
+ /**
196
+ * Gets the microphone volume amplitude 0-1 (if managed by client)
197
+ */
198
+ getAmplitude(): number;
158
199
  /**
159
200
  * Update the system prompt mid-conversation
160
201
  */
@@ -324,6 +365,7 @@ declare class BrowserAudioManager {
324
365
  private scriptProcessor;
325
366
  private analyserNode;
326
367
  private mediaStream;
368
+ private resampler;
327
369
  private nextPlaybackTime;
328
370
  private activeSources;
329
371
  private playbackQueue;
@@ -401,4 +443,4 @@ declare class BrowserAudioManager {
401
443
  isRecording(): boolean;
402
444
  }
403
445
 
404
- export { AUDIO_CONFIG, type AnalyserConfig, type BrowserAudioConfig, BrowserAudioManager, type BrowserAudioOptions, DEFAULT_URLS, Language, type LokutorConfig, StreamResampler, type SynthesizeOptions, TTSClient, type Viseme, VoiceAgentClient, type VoiceAgentOptions, VoiceStyle, applyLowPassFilter, bytesToPcm16, calculateRMS, float32ToPcm16, normalizeAudio, pcm16ToBytes, pcm16ToFloat32, resample, resampleWithAntiAliasing, simpleConversation, simpleTTS };
446
+ export { AUDIO_CONFIG, type AnalyserConfig, type BrowserAudioConfig, BrowserAudioManager, type BrowserAudioOptions, DEFAULT_URLS, Language, type LokutorConfig, StreamResampler, type SynthesizeOptions, TTSClient, type ToolCall, type ToolDefinition, type Viseme, VoiceAgentClient, type VoiceAgentOptions, VoiceStyle, applyLowPassFilter, bytesToPcm16, calculateRMS, float32ToPcm16, normalizeAudio, pcm16ToBytes, pcm16ToFloat32, resample, resampleWithAntiAliasing, simpleConversation, simpleTTS };
package/dist/index.d.ts CHANGED
@@ -97,6 +97,28 @@ interface Viseme {
97
97
  c: string;
98
98
  t: number;
99
99
  }
100
+ /**
101
+ * Tool definition for LLM function calling (OpenAI format)
102
+ */
103
+ interface ToolDefinition {
104
+ type: 'function';
105
+ function: {
106
+ name: string;
107
+ description: string;
108
+ parameters: {
109
+ type: 'object';
110
+ properties: Record<string, any>;
111
+ required?: string[];
112
+ };
113
+ };
114
+ }
115
+ /**
116
+ * Event data for tool execution
117
+ */
118
+ interface ToolCall {
119
+ name: string;
120
+ arguments: string;
121
+ }
100
122
 
101
123
  /**
102
124
  * Main client for Lokutor Voice Agent SDK
@@ -109,6 +131,7 @@ declare class VoiceAgentClient {
109
131
  prompt: string;
110
132
  voice: VoiceStyle;
111
133
  language: Language;
134
+ tools: ToolDefinition[];
112
135
  private onTranscription?;
113
136
  private onResponse?;
114
137
  private onAudioCallback?;
@@ -119,12 +142,21 @@ declare class VoiceAgentClient {
119
142
  private messages;
120
143
  private visemeListeners;
121
144
  private wantVisemes;
145
+ private audioManager;
146
+ private enableAudio;
147
+ private currentGeneration;
148
+ private isUserDisconnect;
149
+ private reconnecting;
150
+ private reconnectAttempts;
151
+ private maxReconnectAttempts;
122
152
  constructor(config: LokutorConfig & {
123
153
  prompt: string;
124
154
  voice?: VoiceStyle;
125
155
  language?: Language;
126
156
  visemes?: boolean;
127
157
  onVisemes?: (visemes: Viseme[]) => void;
158
+ enableAudio?: boolean;
159
+ tools?: ToolDefinition[];
128
160
  });
129
161
  /**
130
162
  * Connect to the Lokutor Voice Agent server
@@ -155,6 +187,15 @@ declare class VoiceAgentClient {
155
187
  * Disconnect from the server
156
188
  */
157
189
  disconnect(): void;
190
+ /**
191
+ * Toggles the microphone mute state (if managed by client)
192
+ * returns the new mute state
193
+ */
194
+ toggleMute(): boolean;
195
+ /**
196
+ * Gets the microphone volume amplitude 0-1 (if managed by client)
197
+ */
198
+ getAmplitude(): number;
158
199
  /**
159
200
  * Update the system prompt mid-conversation
160
201
  */
@@ -324,6 +365,7 @@ declare class BrowserAudioManager {
324
365
  private scriptProcessor;
325
366
  private analyserNode;
326
367
  private mediaStream;
368
+ private resampler;
327
369
  private nextPlaybackTime;
328
370
  private activeSources;
329
371
  private playbackQueue;
@@ -401,4 +443,4 @@ declare class BrowserAudioManager {
401
443
  isRecording(): boolean;
402
444
  }
403
445
 
404
- export { AUDIO_CONFIG, type AnalyserConfig, type BrowserAudioConfig, BrowserAudioManager, type BrowserAudioOptions, DEFAULT_URLS, Language, type LokutorConfig, StreamResampler, type SynthesizeOptions, TTSClient, type Viseme, VoiceAgentClient, type VoiceAgentOptions, VoiceStyle, applyLowPassFilter, bytesToPcm16, calculateRMS, float32ToPcm16, normalizeAudio, pcm16ToBytes, pcm16ToFloat32, resample, resampleWithAntiAliasing, simpleConversation, simpleTTS };
446
+ export { AUDIO_CONFIG, type AnalyserConfig, type BrowserAudioConfig, BrowserAudioManager, type BrowserAudioOptions, DEFAULT_URLS, Language, type LokutorConfig, StreamResampler, type SynthesizeOptions, TTSClient, type ToolCall, type ToolDefinition, type Viseme, VoiceAgentClient, type VoiceAgentOptions, VoiceStyle, applyLowPassFilter, bytesToPcm16, calculateRMS, float32ToPcm16, normalizeAudio, pcm16ToBytes, pcm16ToFloat32, resample, resampleWithAntiAliasing, simpleConversation, simpleTTS };