@teamlearners/clawops 0.4.0 → 0.5.3
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 +9 -0
- package/dist/agent/index.cjs +660 -181
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +72 -15
- package/dist/agent/index.d.ts +72 -15
- package/dist/agent/index.js +660 -182
- package/dist/agent/index.js.map +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -5
- package/dist/index.d.ts +8 -5
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +38 -12
package/dist/agent/index.d.cts
CHANGED
|
@@ -142,7 +142,10 @@ interface ClearAudioFn {
|
|
|
142
142
|
(): void;
|
|
143
143
|
}
|
|
144
144
|
interface HangupFn {
|
|
145
|
-
(): void
|
|
145
|
+
(): void | Promise<void>;
|
|
146
|
+
}
|
|
147
|
+
interface SendDtmfFn {
|
|
148
|
+
(digit: string): Promise<void>;
|
|
146
149
|
}
|
|
147
150
|
declare class CallSession {
|
|
148
151
|
readonly callId: string;
|
|
@@ -156,6 +159,11 @@ declare class CallSession {
|
|
|
156
159
|
private _sendAudioFn;
|
|
157
160
|
private _clearAudioFn;
|
|
158
161
|
private _hangupFn;
|
|
162
|
+
/** @internal */ _sendDtmfFn: SendDtmfFn | null;
|
|
163
|
+
/** @internal */ _isTransportConnected: (() => boolean) | null;
|
|
164
|
+
private _dtmfCollectorActive;
|
|
165
|
+
private _dtmfResolvers;
|
|
166
|
+
private _dtmfBuffer;
|
|
159
167
|
private _handlers;
|
|
160
168
|
private _endedPromise;
|
|
161
169
|
private _resolveEnded;
|
|
@@ -170,13 +178,24 @@ declare class CallSession {
|
|
|
170
178
|
get status(): CallStatus;
|
|
171
179
|
get duration(): number;
|
|
172
180
|
/** Bind transport functions (called internally by the agent). */
|
|
173
|
-
_bindTransport(send: SendAudioFn, clear: ClearAudioFn, hangup: HangupFn): void;
|
|
181
|
+
_bindTransport(send: SendAudioFn, clear: ClearAudioFn, hangup: HangupFn, sendDtmf?: SendDtmfFn, isConnected?: () => boolean): void;
|
|
174
182
|
/** Send PCM16 or ulaw audio to the caller. */
|
|
175
183
|
sendAudio(audio: Buffer): void;
|
|
176
184
|
/** Clear any queued outbound audio. */
|
|
177
185
|
clearAudio(): void;
|
|
178
|
-
/** Hang up the call. */
|
|
179
|
-
hangup(): void
|
|
186
|
+
/** Hang up the call, waiting for pending audio to finish. */
|
|
187
|
+
hangup(): Promise<void>;
|
|
188
|
+
/** @internal Route a received DTMF digit to an active collector or buffer. */
|
|
189
|
+
_routeDtmf(digit: string): void;
|
|
190
|
+
/** Collect DTMF digits from the caller. */
|
|
191
|
+
collectDtmf(options: {
|
|
192
|
+
maxDigits: number;
|
|
193
|
+
finishOnKey?: string;
|
|
194
|
+
timeout?: number;
|
|
195
|
+
secure?: boolean;
|
|
196
|
+
}): Promise<string>;
|
|
197
|
+
/** Send a sequence of DTMF digits. */
|
|
198
|
+
sendDtmfSequence(digits: string): Promise<void>;
|
|
180
199
|
/** Register an event handler. */
|
|
181
200
|
on(event: string, handler: SessionEventHandler): void;
|
|
182
201
|
/** Wait for the call to end. */
|
|
@@ -187,6 +206,22 @@ declare class CallSession {
|
|
|
187
206
|
_emit(event: string, ...args: any[]): void;
|
|
188
207
|
}
|
|
189
208
|
|
|
209
|
+
/**
|
|
210
|
+
* Built-in tool definitions and selection constants.
|
|
211
|
+
*/
|
|
212
|
+
declare enum BuiltinTool {
|
|
213
|
+
/** 전화 종료 도구. AI가 대화 완료 시 통화를 종료합니다. */
|
|
214
|
+
HANG_UP = "hang_up",
|
|
215
|
+
/** DTMF 수집 도구. 사용자의 키패드 입력을 수집합니다. */
|
|
216
|
+
COLLECT_DTMF = "collect_dtmf",
|
|
217
|
+
/** DTMF 전송 도구. ARS 탐색이나 내선번호 입력에 사용합니다. */
|
|
218
|
+
SEND_DTMF = "send_dtmf",
|
|
219
|
+
/** 모든 내장 도구를 활성화합니다. (기본값) */
|
|
220
|
+
ALL = "all",
|
|
221
|
+
/** 모든 내장 도구를 비활성화합니다. */
|
|
222
|
+
NONE = "none"
|
|
223
|
+
}
|
|
224
|
+
|
|
190
225
|
/**
|
|
191
226
|
* Base interfaces for the voice agent pipeline.
|
|
192
227
|
*/
|
|
@@ -224,6 +259,8 @@ interface Session {
|
|
|
224
259
|
start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
|
|
225
260
|
/** Feed raw audio into the session. */
|
|
226
261
|
feedAudio(audio: Buffer): void;
|
|
262
|
+
/** Feed DTMF digits into the LLM context and trigger a response. */
|
|
263
|
+
feedDtmf?(digits: string): Promise<void>;
|
|
227
264
|
/** Stop the session. */
|
|
228
265
|
stop(): Promise<void>;
|
|
229
266
|
}
|
|
@@ -293,7 +330,7 @@ declare function resetTracingConfig(): void;
|
|
|
293
330
|
* ClawOpsAgent - main agent class for handling voice calls.
|
|
294
331
|
*/
|
|
295
332
|
|
|
296
|
-
type AgentEventType = 'call_start' | 'call_end' | 'call_failed' | 'transcript';
|
|
333
|
+
type AgentEventType = 'call_start' | 'call_end' | 'call_failed' | 'transcript' | 'dtmf';
|
|
297
334
|
type AgentEventHandler = (...args: any[]) => void | Promise<void>;
|
|
298
335
|
interface ClawOpsAgentOptions {
|
|
299
336
|
/** ClawOps API key. Falls back to CLAWOPS_API_KEY env var. */
|
|
@@ -314,6 +351,10 @@ interface ClawOpsAgentOptions {
|
|
|
314
351
|
mcpServers?: Array<MCPServerStdio | MCPServerHTTP>;
|
|
315
352
|
/** Tracing configuration. */
|
|
316
353
|
tracing?: TracingConfig;
|
|
354
|
+
/** 활성화할 내장 도구. Default: BuiltinTool.ALL */
|
|
355
|
+
builtinTools?: BuiltinTool | BuiltinTool[];
|
|
356
|
+
/** Debounce time (ms) for passive DTMF accumulation. Default: 500 */
|
|
357
|
+
passiveDtmfDebounceMs?: number;
|
|
317
358
|
}
|
|
318
359
|
declare class ClawOpsAgent {
|
|
319
360
|
private _apiKey;
|
|
@@ -328,6 +369,12 @@ declare class ClawOpsAgent {
|
|
|
328
369
|
private _recording;
|
|
329
370
|
private _recordingPath;
|
|
330
371
|
private _activeSessions;
|
|
372
|
+
private _builtinTools;
|
|
373
|
+
private _passiveDtmfDebounceMs;
|
|
374
|
+
private _passiveDtmfBuffer;
|
|
375
|
+
private _passiveDtmfTimer;
|
|
376
|
+
private _passiveDtmfCallId;
|
|
377
|
+
private _callSessions;
|
|
331
378
|
constructor(options: ClawOpsAgentOptions);
|
|
332
379
|
/**
|
|
333
380
|
* Register a function tool.
|
|
@@ -366,6 +413,7 @@ declare class ClawOpsAgent {
|
|
|
366
413
|
private _handleOutboundReady;
|
|
367
414
|
private _handleRinging;
|
|
368
415
|
private _handleFailed;
|
|
416
|
+
private _onDtmfEvent;
|
|
369
417
|
private _startCallSession;
|
|
370
418
|
}
|
|
371
419
|
|
|
@@ -436,6 +484,8 @@ declare class OpenAIRealtime implements Session {
|
|
|
436
484
|
private _language;
|
|
437
485
|
private _eagerness;
|
|
438
486
|
private _greeting;
|
|
487
|
+
private _builtinTools;
|
|
488
|
+
setBuiltinTools(tools: Set<BuiltinTool>): void;
|
|
439
489
|
private _ws;
|
|
440
490
|
private _call;
|
|
441
491
|
private _tools;
|
|
@@ -445,12 +495,15 @@ declare class OpenAIRealtime implements Session {
|
|
|
445
495
|
private _responseStartTs;
|
|
446
496
|
private _sentAudioChunks;
|
|
447
497
|
private _audioRemainder;
|
|
498
|
+
private _responseInProgress;
|
|
499
|
+
private _onResponseDone;
|
|
448
500
|
constructor(options?: OpenAIRealtimeOptions);
|
|
449
501
|
/** Inject per-call ToolRegistry. */
|
|
450
502
|
setToolRegistry(registry: ToolRegistry): void;
|
|
451
503
|
/** Inject per-call AudioRecorder. */
|
|
452
504
|
setRecorder(recorder: AudioRecorder): void;
|
|
453
505
|
start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
|
|
506
|
+
feedDtmf(digits: string): Promise<void>;
|
|
454
507
|
feedAudio(audio: Buffer): void;
|
|
455
508
|
stop(): Promise<void>;
|
|
456
509
|
private _sendSessionUpdate;
|
|
@@ -458,13 +511,15 @@ declare class OpenAIRealtime implements Session {
|
|
|
458
511
|
private _handleAudioDelta;
|
|
459
512
|
private _handleTruncation;
|
|
460
513
|
private _handleToolCall;
|
|
514
|
+
private _waitForResponseDone;
|
|
461
515
|
private _send;
|
|
462
516
|
}
|
|
463
517
|
|
|
464
518
|
/**
|
|
465
519
|
* Google Gemini Realtime API session (speech-to-speech).
|
|
466
520
|
*
|
|
467
|
-
*
|
|
521
|
+
* Uses @google/genai SDK's live.connect() method.
|
|
522
|
+
* Matches Python SDK's GeminiRealtime implementation (v0.14.0).
|
|
468
523
|
*/
|
|
469
524
|
|
|
470
525
|
interface GeminiRealtimeOptions {
|
|
@@ -480,8 +535,6 @@ interface GeminiRealtimeOptions {
|
|
|
480
535
|
language?: string;
|
|
481
536
|
/** Send initial greeting. Default: true */
|
|
482
537
|
greeting?: boolean;
|
|
483
|
-
/** Generation config overrides. */
|
|
484
|
-
generationConfig?: Record<string, unknown>;
|
|
485
538
|
}
|
|
486
539
|
declare class GeminiRealtime implements Session {
|
|
487
540
|
private _apiKey;
|
|
@@ -490,26 +543,26 @@ declare class GeminiRealtime implements Session {
|
|
|
490
543
|
private _voice;
|
|
491
544
|
private _language;
|
|
492
545
|
private _greeting;
|
|
493
|
-
private
|
|
494
|
-
private _ws;
|
|
546
|
+
private _session;
|
|
495
547
|
private _call;
|
|
496
548
|
private _tools;
|
|
497
549
|
private _recorder;
|
|
498
550
|
private _closed;
|
|
499
551
|
private _sentAudioChunks;
|
|
500
552
|
private _audioRemainder;
|
|
553
|
+
private _builtinTools;
|
|
554
|
+
private _toolCallInProgress;
|
|
501
555
|
constructor(options?: GeminiRealtimeOptions);
|
|
502
556
|
/** Inject per-call ToolRegistry. */
|
|
503
557
|
setToolRegistry(registry: ToolRegistry): void;
|
|
504
558
|
/** Inject per-call AudioRecorder. */
|
|
505
559
|
setRecorder(recorder: AudioRecorder): void;
|
|
560
|
+
setBuiltinTools(tools: Set<BuiltinTool>): void;
|
|
506
561
|
start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
|
|
507
562
|
feedAudio(audio: Buffer): void;
|
|
563
|
+
feedDtmf(digits: string): Promise<void>;
|
|
508
564
|
stop(): Promise<void>;
|
|
509
|
-
private
|
|
510
|
-
private _waitSetupComplete;
|
|
511
|
-
private _sendGreeting;
|
|
512
|
-
private _receiveLoop;
|
|
565
|
+
private _buildToolSchemas;
|
|
513
566
|
private _handleMessage;
|
|
514
567
|
private _handleAudioData;
|
|
515
568
|
private _flushAudioRemainder;
|
|
@@ -561,16 +614,20 @@ declare class PipelineSession implements Session {
|
|
|
561
614
|
private _audioBuffer;
|
|
562
615
|
private _running;
|
|
563
616
|
private _speaking;
|
|
617
|
+
private _builtinTools;
|
|
564
618
|
constructor(options: PipelineSessionOptions);
|
|
565
619
|
setToolRegistry(registry: ToolRegistry): void;
|
|
566
620
|
setRecorder(recorder: AudioRecorder): void;
|
|
621
|
+
setBuiltinTools(tools: Set<BuiltinTool>): void;
|
|
567
622
|
start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
|
|
568
623
|
feedAudio(audio: Buffer): void;
|
|
624
|
+
feedDtmf(digits: string): Promise<void>;
|
|
569
625
|
stop(): Promise<void>;
|
|
570
626
|
private _runSttLoop;
|
|
571
627
|
private _createAudioStream;
|
|
572
628
|
private _generateGreeting;
|
|
573
629
|
private _handleUserSpeech;
|
|
630
|
+
private _buildEffectiveTools;
|
|
574
631
|
private _respond;
|
|
575
632
|
private _handleToolCall;
|
|
576
633
|
private _synthesizeAndSend;
|
|
@@ -877,4 +934,4 @@ declare class XaiLLM implements LLM {
|
|
|
877
934
|
}): AsyncGenerator<LLMChunk>;
|
|
878
935
|
}
|
|
879
936
|
|
|
880
|
-
export { type AgentEventType, AnthropicLLM, type AnthropicLLMOptions, AudioRecorder, type CallDirection, CallSession, type CallStatus, ClawOpsAgent, type ClawOpsAgentOptions, type ConversationMessage, DECODE_TABLE, DeepSeekLLM, type DeepSeekLLMOptions, DeepgramSTT, type DeepgramSTTOptions, ElevenLabsTTS, type ElevenLabsTTSOptions, FireworksLLM, type FireworksLLMOptions, type FunctionTool, GeminiLLM, type GeminiLLMOptions, GeminiRealtime, type GeminiRealtimeOptions, GroqLLM, type GroqLLMOptions, type LLM, type LLMChunk, MCPClient, type MCPServerConfig, type MCPServerHTTP, type MCPServerStdio, MistralLLM, type MistralLLMOptions, OllamaLLM, type OllamaLLMOptions, OpenAICompatLLM, type OpenAICompatLLMOptions, OpenAILLM, type OpenAILLMOptions, OpenAIRealtime, type OpenAIRealtimeOptions, type OpenAIToolDefinition, PerplexityLLM, type PerplexityLLMOptions, PipelineSession, type PipelineSessionOptions, type STT, type Session, type SpeechEvent, type TTS, TogetherLLM, type TogetherLLMOptions, ToolRegistry, type TracingConfig, XaiLLM, type XaiLLMOptions, functionTool, getTracingConfig, mcpServerHTTP, mcpServerStdio, pcm16ToUlaw, resamplePcm16, resetTracingConfig, setTracingConfig, ulawToPcm16, zodToToolParams };
|
|
937
|
+
export { type AgentEventType, AnthropicLLM, type AnthropicLLMOptions, AudioRecorder, BuiltinTool, type CallDirection, CallSession, type CallStatus, ClawOpsAgent, type ClawOpsAgentOptions, type ConversationMessage, DECODE_TABLE, DeepSeekLLM, type DeepSeekLLMOptions, DeepgramSTT, type DeepgramSTTOptions, ElevenLabsTTS, type ElevenLabsTTSOptions, FireworksLLM, type FireworksLLMOptions, type FunctionTool, GeminiLLM, type GeminiLLMOptions, GeminiRealtime, type GeminiRealtimeOptions, GroqLLM, type GroqLLMOptions, type LLM, type LLMChunk, MCPClient, type MCPServerConfig, type MCPServerHTTP, type MCPServerStdio, MistralLLM, type MistralLLMOptions, OllamaLLM, type OllamaLLMOptions, OpenAICompatLLM, type OpenAICompatLLMOptions, OpenAILLM, type OpenAILLMOptions, OpenAIRealtime, type OpenAIRealtimeOptions, type OpenAIToolDefinition, PerplexityLLM, type PerplexityLLMOptions, PipelineSession, type PipelineSessionOptions, type STT, type Session, type SpeechEvent, type TTS, TogetherLLM, type TogetherLLMOptions, ToolRegistry, type TracingConfig, XaiLLM, type XaiLLMOptions, functionTool, getTracingConfig, mcpServerHTTP, mcpServerStdio, pcm16ToUlaw, resamplePcm16, resetTracingConfig, setTracingConfig, ulawToPcm16, zodToToolParams };
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -142,7 +142,10 @@ interface ClearAudioFn {
|
|
|
142
142
|
(): void;
|
|
143
143
|
}
|
|
144
144
|
interface HangupFn {
|
|
145
|
-
(): void
|
|
145
|
+
(): void | Promise<void>;
|
|
146
|
+
}
|
|
147
|
+
interface SendDtmfFn {
|
|
148
|
+
(digit: string): Promise<void>;
|
|
146
149
|
}
|
|
147
150
|
declare class CallSession {
|
|
148
151
|
readonly callId: string;
|
|
@@ -156,6 +159,11 @@ declare class CallSession {
|
|
|
156
159
|
private _sendAudioFn;
|
|
157
160
|
private _clearAudioFn;
|
|
158
161
|
private _hangupFn;
|
|
162
|
+
/** @internal */ _sendDtmfFn: SendDtmfFn | null;
|
|
163
|
+
/** @internal */ _isTransportConnected: (() => boolean) | null;
|
|
164
|
+
private _dtmfCollectorActive;
|
|
165
|
+
private _dtmfResolvers;
|
|
166
|
+
private _dtmfBuffer;
|
|
159
167
|
private _handlers;
|
|
160
168
|
private _endedPromise;
|
|
161
169
|
private _resolveEnded;
|
|
@@ -170,13 +178,24 @@ declare class CallSession {
|
|
|
170
178
|
get status(): CallStatus;
|
|
171
179
|
get duration(): number;
|
|
172
180
|
/** Bind transport functions (called internally by the agent). */
|
|
173
|
-
_bindTransport(send: SendAudioFn, clear: ClearAudioFn, hangup: HangupFn): void;
|
|
181
|
+
_bindTransport(send: SendAudioFn, clear: ClearAudioFn, hangup: HangupFn, sendDtmf?: SendDtmfFn, isConnected?: () => boolean): void;
|
|
174
182
|
/** Send PCM16 or ulaw audio to the caller. */
|
|
175
183
|
sendAudio(audio: Buffer): void;
|
|
176
184
|
/** Clear any queued outbound audio. */
|
|
177
185
|
clearAudio(): void;
|
|
178
|
-
/** Hang up the call. */
|
|
179
|
-
hangup(): void
|
|
186
|
+
/** Hang up the call, waiting for pending audio to finish. */
|
|
187
|
+
hangup(): Promise<void>;
|
|
188
|
+
/** @internal Route a received DTMF digit to an active collector or buffer. */
|
|
189
|
+
_routeDtmf(digit: string): void;
|
|
190
|
+
/** Collect DTMF digits from the caller. */
|
|
191
|
+
collectDtmf(options: {
|
|
192
|
+
maxDigits: number;
|
|
193
|
+
finishOnKey?: string;
|
|
194
|
+
timeout?: number;
|
|
195
|
+
secure?: boolean;
|
|
196
|
+
}): Promise<string>;
|
|
197
|
+
/** Send a sequence of DTMF digits. */
|
|
198
|
+
sendDtmfSequence(digits: string): Promise<void>;
|
|
180
199
|
/** Register an event handler. */
|
|
181
200
|
on(event: string, handler: SessionEventHandler): void;
|
|
182
201
|
/** Wait for the call to end. */
|
|
@@ -187,6 +206,22 @@ declare class CallSession {
|
|
|
187
206
|
_emit(event: string, ...args: any[]): void;
|
|
188
207
|
}
|
|
189
208
|
|
|
209
|
+
/**
|
|
210
|
+
* Built-in tool definitions and selection constants.
|
|
211
|
+
*/
|
|
212
|
+
declare enum BuiltinTool {
|
|
213
|
+
/** 전화 종료 도구. AI가 대화 완료 시 통화를 종료합니다. */
|
|
214
|
+
HANG_UP = "hang_up",
|
|
215
|
+
/** DTMF 수집 도구. 사용자의 키패드 입력을 수집합니다. */
|
|
216
|
+
COLLECT_DTMF = "collect_dtmf",
|
|
217
|
+
/** DTMF 전송 도구. ARS 탐색이나 내선번호 입력에 사용합니다. */
|
|
218
|
+
SEND_DTMF = "send_dtmf",
|
|
219
|
+
/** 모든 내장 도구를 활성화합니다. (기본값) */
|
|
220
|
+
ALL = "all",
|
|
221
|
+
/** 모든 내장 도구를 비활성화합니다. */
|
|
222
|
+
NONE = "none"
|
|
223
|
+
}
|
|
224
|
+
|
|
190
225
|
/**
|
|
191
226
|
* Base interfaces for the voice agent pipeline.
|
|
192
227
|
*/
|
|
@@ -224,6 +259,8 @@ interface Session {
|
|
|
224
259
|
start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
|
|
225
260
|
/** Feed raw audio into the session. */
|
|
226
261
|
feedAudio(audio: Buffer): void;
|
|
262
|
+
/** Feed DTMF digits into the LLM context and trigger a response. */
|
|
263
|
+
feedDtmf?(digits: string): Promise<void>;
|
|
227
264
|
/** Stop the session. */
|
|
228
265
|
stop(): Promise<void>;
|
|
229
266
|
}
|
|
@@ -293,7 +330,7 @@ declare function resetTracingConfig(): void;
|
|
|
293
330
|
* ClawOpsAgent - main agent class for handling voice calls.
|
|
294
331
|
*/
|
|
295
332
|
|
|
296
|
-
type AgentEventType = 'call_start' | 'call_end' | 'call_failed' | 'transcript';
|
|
333
|
+
type AgentEventType = 'call_start' | 'call_end' | 'call_failed' | 'transcript' | 'dtmf';
|
|
297
334
|
type AgentEventHandler = (...args: any[]) => void | Promise<void>;
|
|
298
335
|
interface ClawOpsAgentOptions {
|
|
299
336
|
/** ClawOps API key. Falls back to CLAWOPS_API_KEY env var. */
|
|
@@ -314,6 +351,10 @@ interface ClawOpsAgentOptions {
|
|
|
314
351
|
mcpServers?: Array<MCPServerStdio | MCPServerHTTP>;
|
|
315
352
|
/** Tracing configuration. */
|
|
316
353
|
tracing?: TracingConfig;
|
|
354
|
+
/** 활성화할 내장 도구. Default: BuiltinTool.ALL */
|
|
355
|
+
builtinTools?: BuiltinTool | BuiltinTool[];
|
|
356
|
+
/** Debounce time (ms) for passive DTMF accumulation. Default: 500 */
|
|
357
|
+
passiveDtmfDebounceMs?: number;
|
|
317
358
|
}
|
|
318
359
|
declare class ClawOpsAgent {
|
|
319
360
|
private _apiKey;
|
|
@@ -328,6 +369,12 @@ declare class ClawOpsAgent {
|
|
|
328
369
|
private _recording;
|
|
329
370
|
private _recordingPath;
|
|
330
371
|
private _activeSessions;
|
|
372
|
+
private _builtinTools;
|
|
373
|
+
private _passiveDtmfDebounceMs;
|
|
374
|
+
private _passiveDtmfBuffer;
|
|
375
|
+
private _passiveDtmfTimer;
|
|
376
|
+
private _passiveDtmfCallId;
|
|
377
|
+
private _callSessions;
|
|
331
378
|
constructor(options: ClawOpsAgentOptions);
|
|
332
379
|
/**
|
|
333
380
|
* Register a function tool.
|
|
@@ -366,6 +413,7 @@ declare class ClawOpsAgent {
|
|
|
366
413
|
private _handleOutboundReady;
|
|
367
414
|
private _handleRinging;
|
|
368
415
|
private _handleFailed;
|
|
416
|
+
private _onDtmfEvent;
|
|
369
417
|
private _startCallSession;
|
|
370
418
|
}
|
|
371
419
|
|
|
@@ -436,6 +484,8 @@ declare class OpenAIRealtime implements Session {
|
|
|
436
484
|
private _language;
|
|
437
485
|
private _eagerness;
|
|
438
486
|
private _greeting;
|
|
487
|
+
private _builtinTools;
|
|
488
|
+
setBuiltinTools(tools: Set<BuiltinTool>): void;
|
|
439
489
|
private _ws;
|
|
440
490
|
private _call;
|
|
441
491
|
private _tools;
|
|
@@ -445,12 +495,15 @@ declare class OpenAIRealtime implements Session {
|
|
|
445
495
|
private _responseStartTs;
|
|
446
496
|
private _sentAudioChunks;
|
|
447
497
|
private _audioRemainder;
|
|
498
|
+
private _responseInProgress;
|
|
499
|
+
private _onResponseDone;
|
|
448
500
|
constructor(options?: OpenAIRealtimeOptions);
|
|
449
501
|
/** Inject per-call ToolRegistry. */
|
|
450
502
|
setToolRegistry(registry: ToolRegistry): void;
|
|
451
503
|
/** Inject per-call AudioRecorder. */
|
|
452
504
|
setRecorder(recorder: AudioRecorder): void;
|
|
453
505
|
start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
|
|
506
|
+
feedDtmf(digits: string): Promise<void>;
|
|
454
507
|
feedAudio(audio: Buffer): void;
|
|
455
508
|
stop(): Promise<void>;
|
|
456
509
|
private _sendSessionUpdate;
|
|
@@ -458,13 +511,15 @@ declare class OpenAIRealtime implements Session {
|
|
|
458
511
|
private _handleAudioDelta;
|
|
459
512
|
private _handleTruncation;
|
|
460
513
|
private _handleToolCall;
|
|
514
|
+
private _waitForResponseDone;
|
|
461
515
|
private _send;
|
|
462
516
|
}
|
|
463
517
|
|
|
464
518
|
/**
|
|
465
519
|
* Google Gemini Realtime API session (speech-to-speech).
|
|
466
520
|
*
|
|
467
|
-
*
|
|
521
|
+
* Uses @google/genai SDK's live.connect() method.
|
|
522
|
+
* Matches Python SDK's GeminiRealtime implementation (v0.14.0).
|
|
468
523
|
*/
|
|
469
524
|
|
|
470
525
|
interface GeminiRealtimeOptions {
|
|
@@ -480,8 +535,6 @@ interface GeminiRealtimeOptions {
|
|
|
480
535
|
language?: string;
|
|
481
536
|
/** Send initial greeting. Default: true */
|
|
482
537
|
greeting?: boolean;
|
|
483
|
-
/** Generation config overrides. */
|
|
484
|
-
generationConfig?: Record<string, unknown>;
|
|
485
538
|
}
|
|
486
539
|
declare class GeminiRealtime implements Session {
|
|
487
540
|
private _apiKey;
|
|
@@ -490,26 +543,26 @@ declare class GeminiRealtime implements Session {
|
|
|
490
543
|
private _voice;
|
|
491
544
|
private _language;
|
|
492
545
|
private _greeting;
|
|
493
|
-
private
|
|
494
|
-
private _ws;
|
|
546
|
+
private _session;
|
|
495
547
|
private _call;
|
|
496
548
|
private _tools;
|
|
497
549
|
private _recorder;
|
|
498
550
|
private _closed;
|
|
499
551
|
private _sentAudioChunks;
|
|
500
552
|
private _audioRemainder;
|
|
553
|
+
private _builtinTools;
|
|
554
|
+
private _toolCallInProgress;
|
|
501
555
|
constructor(options?: GeminiRealtimeOptions);
|
|
502
556
|
/** Inject per-call ToolRegistry. */
|
|
503
557
|
setToolRegistry(registry: ToolRegistry): void;
|
|
504
558
|
/** Inject per-call AudioRecorder. */
|
|
505
559
|
setRecorder(recorder: AudioRecorder): void;
|
|
560
|
+
setBuiltinTools(tools: Set<BuiltinTool>): void;
|
|
506
561
|
start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
|
|
507
562
|
feedAudio(audio: Buffer): void;
|
|
563
|
+
feedDtmf(digits: string): Promise<void>;
|
|
508
564
|
stop(): Promise<void>;
|
|
509
|
-
private
|
|
510
|
-
private _waitSetupComplete;
|
|
511
|
-
private _sendGreeting;
|
|
512
|
-
private _receiveLoop;
|
|
565
|
+
private _buildToolSchemas;
|
|
513
566
|
private _handleMessage;
|
|
514
567
|
private _handleAudioData;
|
|
515
568
|
private _flushAudioRemainder;
|
|
@@ -561,16 +614,20 @@ declare class PipelineSession implements Session {
|
|
|
561
614
|
private _audioBuffer;
|
|
562
615
|
private _running;
|
|
563
616
|
private _speaking;
|
|
617
|
+
private _builtinTools;
|
|
564
618
|
constructor(options: PipelineSessionOptions);
|
|
565
619
|
setToolRegistry(registry: ToolRegistry): void;
|
|
566
620
|
setRecorder(recorder: AudioRecorder): void;
|
|
621
|
+
setBuiltinTools(tools: Set<BuiltinTool>): void;
|
|
567
622
|
start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
|
|
568
623
|
feedAudio(audio: Buffer): void;
|
|
624
|
+
feedDtmf(digits: string): Promise<void>;
|
|
569
625
|
stop(): Promise<void>;
|
|
570
626
|
private _runSttLoop;
|
|
571
627
|
private _createAudioStream;
|
|
572
628
|
private _generateGreeting;
|
|
573
629
|
private _handleUserSpeech;
|
|
630
|
+
private _buildEffectiveTools;
|
|
574
631
|
private _respond;
|
|
575
632
|
private _handleToolCall;
|
|
576
633
|
private _synthesizeAndSend;
|
|
@@ -877,4 +934,4 @@ declare class XaiLLM implements LLM {
|
|
|
877
934
|
}): AsyncGenerator<LLMChunk>;
|
|
878
935
|
}
|
|
879
936
|
|
|
880
|
-
export { type AgentEventType, AnthropicLLM, type AnthropicLLMOptions, AudioRecorder, type CallDirection, CallSession, type CallStatus, ClawOpsAgent, type ClawOpsAgentOptions, type ConversationMessage, DECODE_TABLE, DeepSeekLLM, type DeepSeekLLMOptions, DeepgramSTT, type DeepgramSTTOptions, ElevenLabsTTS, type ElevenLabsTTSOptions, FireworksLLM, type FireworksLLMOptions, type FunctionTool, GeminiLLM, type GeminiLLMOptions, GeminiRealtime, type GeminiRealtimeOptions, GroqLLM, type GroqLLMOptions, type LLM, type LLMChunk, MCPClient, type MCPServerConfig, type MCPServerHTTP, type MCPServerStdio, MistralLLM, type MistralLLMOptions, OllamaLLM, type OllamaLLMOptions, OpenAICompatLLM, type OpenAICompatLLMOptions, OpenAILLM, type OpenAILLMOptions, OpenAIRealtime, type OpenAIRealtimeOptions, type OpenAIToolDefinition, PerplexityLLM, type PerplexityLLMOptions, PipelineSession, type PipelineSessionOptions, type STT, type Session, type SpeechEvent, type TTS, TogetherLLM, type TogetherLLMOptions, ToolRegistry, type TracingConfig, XaiLLM, type XaiLLMOptions, functionTool, getTracingConfig, mcpServerHTTP, mcpServerStdio, pcm16ToUlaw, resamplePcm16, resetTracingConfig, setTracingConfig, ulawToPcm16, zodToToolParams };
|
|
937
|
+
export { type AgentEventType, AnthropicLLM, type AnthropicLLMOptions, AudioRecorder, BuiltinTool, type CallDirection, CallSession, type CallStatus, ClawOpsAgent, type ClawOpsAgentOptions, type ConversationMessage, DECODE_TABLE, DeepSeekLLM, type DeepSeekLLMOptions, DeepgramSTT, type DeepgramSTTOptions, ElevenLabsTTS, type ElevenLabsTTSOptions, FireworksLLM, type FireworksLLMOptions, type FunctionTool, GeminiLLM, type GeminiLLMOptions, GeminiRealtime, type GeminiRealtimeOptions, GroqLLM, type GroqLLMOptions, type LLM, type LLMChunk, MCPClient, type MCPServerConfig, type MCPServerHTTP, type MCPServerStdio, MistralLLM, type MistralLLMOptions, OllamaLLM, type OllamaLLMOptions, OpenAICompatLLM, type OpenAICompatLLMOptions, OpenAILLM, type OpenAILLMOptions, OpenAIRealtime, type OpenAIRealtimeOptions, type OpenAIToolDefinition, PerplexityLLM, type PerplexityLLMOptions, PipelineSession, type PipelineSessionOptions, type STT, type Session, type SpeechEvent, type TTS, TogetherLLM, type TogetherLLMOptions, ToolRegistry, type TracingConfig, XaiLLM, type XaiLLMOptions, functionTool, getTracingConfig, mcpServerHTTP, mcpServerStdio, pcm16ToUlaw, resamplePcm16, resetTracingConfig, setTracingConfig, ulawToPcm16, zodToToolParams };
|