@teamlearners/clawops 0.5.1 → 0.5.4

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.
@@ -1,4 +1,6 @@
1
1
  import { z } from 'zod';
2
+ import { Logger } from 'pino';
3
+ export { Logger } from 'pino';
2
4
 
3
5
  /**
4
6
  * Tool registry for function-calling in voice agent pipelines.
@@ -74,6 +76,8 @@ interface MCPServerConfig {
74
76
  declare class MCPClient {
75
77
  private _servers;
76
78
  private _clients;
79
+ private _log;
80
+ setLogger(logger: Logger): void;
77
81
  /** Add an MCP server configuration. */
78
82
  addServer(name: string, config: MCPServerConfig & Record<string, unknown>): void;
79
83
  /** Connect to all configured MCP servers and discover tools. */
@@ -128,6 +132,7 @@ declare function mcpServerHTTP(options: {
128
132
  * CallSession represents an active phone call and provides methods to
129
133
  * send audio, hang up, and listen for lifecycle events.
130
134
  */
135
+
131
136
  type CallDirection = 'inbound' | 'outbound';
132
137
  type CallStatus = 'ringing' | 'active' | 'ended';
133
138
  /**
@@ -142,7 +147,10 @@ interface ClearAudioFn {
142
147
  (): void;
143
148
  }
144
149
  interface HangupFn {
145
- (): void;
150
+ (): void | Promise<void>;
151
+ }
152
+ interface SendDtmfFn {
153
+ (digit: string): Promise<void>;
146
154
  }
147
155
  declare class CallSession {
148
156
  readonly callId: string;
@@ -156,6 +164,12 @@ declare class CallSession {
156
164
  private _sendAudioFn;
157
165
  private _clearAudioFn;
158
166
  private _hangupFn;
167
+ /** @internal */ _sendDtmfFn: SendDtmfFn | null;
168
+ /** @internal */ _isTransportConnected: (() => boolean) | null;
169
+ private _dtmfCollectorActive;
170
+ private _dtmfResolvers;
171
+ private _dtmfBuffer;
172
+ private _log;
159
173
  private _handlers;
160
174
  private _endedPromise;
161
175
  private _resolveEnded;
@@ -167,16 +181,28 @@ declare class CallSession {
167
181
  direction: CallDirection;
168
182
  metadata?: Record<string, unknown>;
169
183
  });
184
+ setLogger(logger: Logger): void;
170
185
  get status(): CallStatus;
171
186
  get duration(): number;
172
187
  /** Bind transport functions (called internally by the agent). */
173
- _bindTransport(send: SendAudioFn, clear: ClearAudioFn, hangup: HangupFn): void;
188
+ _bindTransport(send: SendAudioFn, clear: ClearAudioFn, hangup: HangupFn, sendDtmf?: SendDtmfFn, isConnected?: () => boolean): void;
174
189
  /** Send PCM16 or ulaw audio to the caller. */
175
190
  sendAudio(audio: Buffer): void;
176
191
  /** Clear any queued outbound audio. */
177
192
  clearAudio(): void;
178
- /** Hang up the call. */
179
- hangup(): void;
193
+ /** Hang up the call, waiting for pending audio to finish. */
194
+ hangup(): Promise<void>;
195
+ /** @internal Route a received DTMF digit to an active collector or buffer. */
196
+ _routeDtmf(digit: string): void;
197
+ /** Collect DTMF digits from the caller. */
198
+ collectDtmf(options: {
199
+ maxDigits: number;
200
+ finishOnKey?: string;
201
+ timeout?: number;
202
+ secure?: boolean;
203
+ }): Promise<string>;
204
+ /** Send a sequence of DTMF digits. */
205
+ sendDtmfSequence(digits: string): Promise<void>;
180
206
  /** Register an event handler. */
181
207
  on(event: string, handler: SessionEventHandler): void;
182
208
  /** Wait for the call to end. */
@@ -187,6 +213,22 @@ declare class CallSession {
187
213
  _emit(event: string, ...args: any[]): void;
188
214
  }
189
215
 
216
+ /**
217
+ * Built-in tool definitions and selection constants.
218
+ */
219
+ declare enum BuiltinTool {
220
+ /** 전화 종료 도구. AI가 대화 완료 시 통화를 종료합니다. */
221
+ HANG_UP = "hang_up",
222
+ /** DTMF 수집 도구. 사용자의 키패드 입력을 수집합니다. */
223
+ COLLECT_DTMF = "collect_dtmf",
224
+ /** DTMF 전송 도구. ARS 탐색이나 내선번호 입력에 사용합니다. */
225
+ SEND_DTMF = "send_dtmf",
226
+ /** 모든 내장 도구를 활성화합니다. (기본값) */
227
+ ALL = "all",
228
+ /** 모든 내장 도구를 비활성화합니다. */
229
+ NONE = "none"
230
+ }
231
+
190
232
  /**
191
233
  * Base interfaces for the voice agent pipeline.
192
234
  */
@@ -224,8 +266,12 @@ interface Session {
224
266
  start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
225
267
  /** Feed raw audio into the session. */
226
268
  feedAudio(audio: Buffer): void;
269
+ /** Feed DTMF digits into the LLM context and trigger a response. */
270
+ feedDtmf?(digits: string): Promise<void>;
227
271
  /** Stop the session. */
228
272
  stop(): Promise<void>;
273
+ /** Set the logger instance for this session. */
274
+ setLogger?(logger: Logger): void;
229
275
  }
230
276
  /**
231
277
  * Speech-to-Text provider interface.
@@ -293,7 +339,7 @@ declare function resetTracingConfig(): void;
293
339
  * ClawOpsAgent - main agent class for handling voice calls.
294
340
  */
295
341
 
296
- type AgentEventType = 'call_start' | 'call_end' | 'call_failed' | 'transcript';
342
+ type AgentEventType = 'call_start' | 'call_end' | 'call_failed' | 'transcript' | 'dtmf';
297
343
  type AgentEventHandler = (...args: any[]) => void | Promise<void>;
298
344
  interface ClawOpsAgentOptions {
299
345
  /** ClawOps API key. Falls back to CLAWOPS_API_KEY env var. */
@@ -314,6 +360,12 @@ interface ClawOpsAgentOptions {
314
360
  mcpServers?: Array<MCPServerStdio | MCPServerHTTP>;
315
361
  /** Tracing configuration. */
316
362
  tracing?: TracingConfig;
363
+ /** 활성화할 내장 도구. Default: BuiltinTool.ALL */
364
+ builtinTools?: BuiltinTool | BuiltinTool[];
365
+ /** Debounce time (ms) for passive DTMF accumulation. Default: 500 */
366
+ passiveDtmfDebounceMs?: number;
367
+ /** Custom pino logger instance. If omitted, a default logger is created. */
368
+ logger?: Logger;
317
369
  }
318
370
  declare class ClawOpsAgent {
319
371
  private _apiKey;
@@ -328,6 +380,15 @@ declare class ClawOpsAgent {
328
380
  private _recording;
329
381
  private _recordingPath;
330
382
  private _activeSessions;
383
+ private _builtinTools;
384
+ private _passiveDtmfDebounceMs;
385
+ private _passiveDtmfBuffer;
386
+ private _passiveDtmfTimer;
387
+ private _passiveDtmfCallId;
388
+ private _callSessions;
389
+ private _log;
390
+ private _pipelineLog;
391
+ private _isPipelineSession;
331
392
  constructor(options: ClawOpsAgentOptions);
332
393
  /**
333
394
  * Register a function tool.
@@ -366,6 +427,7 @@ declare class ClawOpsAgent {
366
427
  private _handleOutboundReady;
367
428
  private _handleRinging;
368
429
  private _handleFailed;
430
+ private _onDtmfEvent;
369
431
  private _startCallSession;
370
432
  }
371
433
 
@@ -396,6 +458,8 @@ declare class AudioRecorder {
396
458
  private _mixWritten;
397
459
  private _startTime;
398
460
  private _started;
461
+ private _log;
462
+ setLogger(logger: Logger): void;
399
463
  constructor(recordingPath: string, callId: string);
400
464
  start(): void;
401
465
  private _expectedBytes;
@@ -436,6 +500,10 @@ declare class OpenAIRealtime implements Session {
436
500
  private _language;
437
501
  private _eagerness;
438
502
  private _greeting;
503
+ private _log;
504
+ private _builtinTools;
505
+ setLogger(logger: Logger): void;
506
+ setBuiltinTools(tools: Set<BuiltinTool>): void;
439
507
  private _ws;
440
508
  private _call;
441
509
  private _tools;
@@ -445,12 +513,15 @@ declare class OpenAIRealtime implements Session {
445
513
  private _responseStartTs;
446
514
  private _sentAudioChunks;
447
515
  private _audioRemainder;
516
+ private _responseInProgress;
517
+ private _onResponseDone;
448
518
  constructor(options?: OpenAIRealtimeOptions);
449
519
  /** Inject per-call ToolRegistry. */
450
520
  setToolRegistry(registry: ToolRegistry): void;
451
521
  /** Inject per-call AudioRecorder. */
452
522
  setRecorder(recorder: AudioRecorder): void;
453
523
  start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
524
+ feedDtmf(digits: string): Promise<void>;
454
525
  feedAudio(audio: Buffer): void;
455
526
  stop(): Promise<void>;
456
527
  private _sendSessionUpdate;
@@ -458,6 +529,7 @@ declare class OpenAIRealtime implements Session {
458
529
  private _handleAudioDelta;
459
530
  private _handleTruncation;
460
531
  private _handleToolCall;
532
+ private _waitForResponseDone;
461
533
  private _send;
462
534
  }
463
535
 
@@ -496,13 +568,19 @@ declare class GeminiRealtime implements Session {
496
568
  private _closed;
497
569
  private _sentAudioChunks;
498
570
  private _audioRemainder;
571
+ private _builtinTools;
572
+ private _toolCallInProgress;
573
+ private _log;
499
574
  constructor(options?: GeminiRealtimeOptions);
500
575
  /** Inject per-call ToolRegistry. */
501
576
  setToolRegistry(registry: ToolRegistry): void;
502
577
  /** Inject per-call AudioRecorder. */
503
578
  setRecorder(recorder: AudioRecorder): void;
579
+ setBuiltinTools(tools: Set<BuiltinTool>): void;
580
+ setLogger(logger: Logger): void;
504
581
  start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
505
582
  feedAudio(audio: Buffer): void;
583
+ feedDtmf(digits: string): Promise<void>;
506
584
  stop(): Promise<void>;
507
585
  private _buildToolSchemas;
508
586
  private _handleMessage;
@@ -556,16 +634,22 @@ declare class PipelineSession implements Session {
556
634
  private _audioBuffer;
557
635
  private _running;
558
636
  private _speaking;
637
+ private _builtinTools;
638
+ private _log;
559
639
  constructor(options: PipelineSessionOptions);
560
640
  setToolRegistry(registry: ToolRegistry): void;
561
641
  setRecorder(recorder: AudioRecorder): void;
642
+ setBuiltinTools(tools: Set<BuiltinTool>): void;
643
+ setLogger(logger: Logger): void;
562
644
  start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
563
645
  feedAudio(audio: Buffer): void;
646
+ feedDtmf(digits: string): Promise<void>;
564
647
  stop(): Promise<void>;
565
648
  private _runSttLoop;
566
649
  private _createAudioStream;
567
650
  private _generateGreeting;
568
651
  private _handleUserSpeech;
652
+ private _buildEffectiveTools;
569
653
  private _respond;
570
654
  private _handleToolCall;
571
655
  private _synthesizeAndSend;
@@ -597,6 +681,8 @@ interface DeepgramSTTOptions {
597
681
  }
598
682
  declare class DeepgramSTT implements STT {
599
683
  private _options;
684
+ private _log;
685
+ setLogger(logger: Logger): void;
600
686
  constructor(options?: DeepgramSTTOptions);
601
687
  transcribe(audioStream: AsyncIterable<Buffer>, options?: {
602
688
  language?: string;
@@ -626,6 +712,8 @@ interface ElevenLabsTTSOptions {
626
712
  }
627
713
  declare class ElevenLabsTTS implements TTS {
628
714
  private _options;
715
+ private _log;
716
+ setLogger(logger: Logger): void;
629
717
  constructor(options?: ElevenLabsTTSOptions);
630
718
  synthesize(text: string | AsyncIterable<string>, options?: {
631
719
  voice?: string;
@@ -872,4 +960,23 @@ declare class XaiLLM implements LLM {
872
960
  }): AsyncGenerator<LLMChunk>;
873
961
  }
874
962
 
875
- 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 };
963
+ /**
964
+ * Logger factory for the ClawOps agent module.
965
+ *
966
+ * Provides a 2-level hierarchy matching the Python SDK:
967
+ * - clawops.agent (core: agent, session, control-ws, media-ws, recorder, mcp, realtime)
968
+ * - clawops.agent.pipeline (pipeline: pipeline-session, stt, tts)
969
+ */
970
+
971
+ /**
972
+ * Create or return an agent-level logger.
973
+ * If no user logger is provided, returns the default pino instance.
974
+ */
975
+ declare function createAgentLogger(userLogger?: Logger): Logger;
976
+ /**
977
+ * Create a pipeline child logger from a parent agent logger.
978
+ * Adds `{ module: 'pipeline' }` to all log entries.
979
+ */
980
+ declare function createPipelineLogger(parent: Logger): Logger;
981
+
982
+ 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, createAgentLogger, createPipelineLogger, functionTool, getTracingConfig, mcpServerHTTP, mcpServerStdio, pcm16ToUlaw, resamplePcm16, resetTracingConfig, setTracingConfig, ulawToPcm16, zodToToolParams };
@@ -1,4 +1,6 @@
1
1
  import { z } from 'zod';
2
+ import { Logger } from 'pino';
3
+ export { Logger } from 'pino';
2
4
 
3
5
  /**
4
6
  * Tool registry for function-calling in voice agent pipelines.
@@ -74,6 +76,8 @@ interface MCPServerConfig {
74
76
  declare class MCPClient {
75
77
  private _servers;
76
78
  private _clients;
79
+ private _log;
80
+ setLogger(logger: Logger): void;
77
81
  /** Add an MCP server configuration. */
78
82
  addServer(name: string, config: MCPServerConfig & Record<string, unknown>): void;
79
83
  /** Connect to all configured MCP servers and discover tools. */
@@ -128,6 +132,7 @@ declare function mcpServerHTTP(options: {
128
132
  * CallSession represents an active phone call and provides methods to
129
133
  * send audio, hang up, and listen for lifecycle events.
130
134
  */
135
+
131
136
  type CallDirection = 'inbound' | 'outbound';
132
137
  type CallStatus = 'ringing' | 'active' | 'ended';
133
138
  /**
@@ -142,7 +147,10 @@ interface ClearAudioFn {
142
147
  (): void;
143
148
  }
144
149
  interface HangupFn {
145
- (): void;
150
+ (): void | Promise<void>;
151
+ }
152
+ interface SendDtmfFn {
153
+ (digit: string): Promise<void>;
146
154
  }
147
155
  declare class CallSession {
148
156
  readonly callId: string;
@@ -156,6 +164,12 @@ declare class CallSession {
156
164
  private _sendAudioFn;
157
165
  private _clearAudioFn;
158
166
  private _hangupFn;
167
+ /** @internal */ _sendDtmfFn: SendDtmfFn | null;
168
+ /** @internal */ _isTransportConnected: (() => boolean) | null;
169
+ private _dtmfCollectorActive;
170
+ private _dtmfResolvers;
171
+ private _dtmfBuffer;
172
+ private _log;
159
173
  private _handlers;
160
174
  private _endedPromise;
161
175
  private _resolveEnded;
@@ -167,16 +181,28 @@ declare class CallSession {
167
181
  direction: CallDirection;
168
182
  metadata?: Record<string, unknown>;
169
183
  });
184
+ setLogger(logger: Logger): void;
170
185
  get status(): CallStatus;
171
186
  get duration(): number;
172
187
  /** Bind transport functions (called internally by the agent). */
173
- _bindTransport(send: SendAudioFn, clear: ClearAudioFn, hangup: HangupFn): void;
188
+ _bindTransport(send: SendAudioFn, clear: ClearAudioFn, hangup: HangupFn, sendDtmf?: SendDtmfFn, isConnected?: () => boolean): void;
174
189
  /** Send PCM16 or ulaw audio to the caller. */
175
190
  sendAudio(audio: Buffer): void;
176
191
  /** Clear any queued outbound audio. */
177
192
  clearAudio(): void;
178
- /** Hang up the call. */
179
- hangup(): void;
193
+ /** Hang up the call, waiting for pending audio to finish. */
194
+ hangup(): Promise<void>;
195
+ /** @internal Route a received DTMF digit to an active collector or buffer. */
196
+ _routeDtmf(digit: string): void;
197
+ /** Collect DTMF digits from the caller. */
198
+ collectDtmf(options: {
199
+ maxDigits: number;
200
+ finishOnKey?: string;
201
+ timeout?: number;
202
+ secure?: boolean;
203
+ }): Promise<string>;
204
+ /** Send a sequence of DTMF digits. */
205
+ sendDtmfSequence(digits: string): Promise<void>;
180
206
  /** Register an event handler. */
181
207
  on(event: string, handler: SessionEventHandler): void;
182
208
  /** Wait for the call to end. */
@@ -187,6 +213,22 @@ declare class CallSession {
187
213
  _emit(event: string, ...args: any[]): void;
188
214
  }
189
215
 
216
+ /**
217
+ * Built-in tool definitions and selection constants.
218
+ */
219
+ declare enum BuiltinTool {
220
+ /** 전화 종료 도구. AI가 대화 완료 시 통화를 종료합니다. */
221
+ HANG_UP = "hang_up",
222
+ /** DTMF 수집 도구. 사용자의 키패드 입력을 수집합니다. */
223
+ COLLECT_DTMF = "collect_dtmf",
224
+ /** DTMF 전송 도구. ARS 탐색이나 내선번호 입력에 사용합니다. */
225
+ SEND_DTMF = "send_dtmf",
226
+ /** 모든 내장 도구를 활성화합니다. (기본값) */
227
+ ALL = "all",
228
+ /** 모든 내장 도구를 비활성화합니다. */
229
+ NONE = "none"
230
+ }
231
+
190
232
  /**
191
233
  * Base interfaces for the voice agent pipeline.
192
234
  */
@@ -224,8 +266,12 @@ interface Session {
224
266
  start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
225
267
  /** Feed raw audio into the session. */
226
268
  feedAudio(audio: Buffer): void;
269
+ /** Feed DTMF digits into the LLM context and trigger a response. */
270
+ feedDtmf?(digits: string): Promise<void>;
227
271
  /** Stop the session. */
228
272
  stop(): Promise<void>;
273
+ /** Set the logger instance for this session. */
274
+ setLogger?(logger: Logger): void;
229
275
  }
230
276
  /**
231
277
  * Speech-to-Text provider interface.
@@ -293,7 +339,7 @@ declare function resetTracingConfig(): void;
293
339
  * ClawOpsAgent - main agent class for handling voice calls.
294
340
  */
295
341
 
296
- type AgentEventType = 'call_start' | 'call_end' | 'call_failed' | 'transcript';
342
+ type AgentEventType = 'call_start' | 'call_end' | 'call_failed' | 'transcript' | 'dtmf';
297
343
  type AgentEventHandler = (...args: any[]) => void | Promise<void>;
298
344
  interface ClawOpsAgentOptions {
299
345
  /** ClawOps API key. Falls back to CLAWOPS_API_KEY env var. */
@@ -314,6 +360,12 @@ interface ClawOpsAgentOptions {
314
360
  mcpServers?: Array<MCPServerStdio | MCPServerHTTP>;
315
361
  /** Tracing configuration. */
316
362
  tracing?: TracingConfig;
363
+ /** 활성화할 내장 도구. Default: BuiltinTool.ALL */
364
+ builtinTools?: BuiltinTool | BuiltinTool[];
365
+ /** Debounce time (ms) for passive DTMF accumulation. Default: 500 */
366
+ passiveDtmfDebounceMs?: number;
367
+ /** Custom pino logger instance. If omitted, a default logger is created. */
368
+ logger?: Logger;
317
369
  }
318
370
  declare class ClawOpsAgent {
319
371
  private _apiKey;
@@ -328,6 +380,15 @@ declare class ClawOpsAgent {
328
380
  private _recording;
329
381
  private _recordingPath;
330
382
  private _activeSessions;
383
+ private _builtinTools;
384
+ private _passiveDtmfDebounceMs;
385
+ private _passiveDtmfBuffer;
386
+ private _passiveDtmfTimer;
387
+ private _passiveDtmfCallId;
388
+ private _callSessions;
389
+ private _log;
390
+ private _pipelineLog;
391
+ private _isPipelineSession;
331
392
  constructor(options: ClawOpsAgentOptions);
332
393
  /**
333
394
  * Register a function tool.
@@ -366,6 +427,7 @@ declare class ClawOpsAgent {
366
427
  private _handleOutboundReady;
367
428
  private _handleRinging;
368
429
  private _handleFailed;
430
+ private _onDtmfEvent;
369
431
  private _startCallSession;
370
432
  }
371
433
 
@@ -396,6 +458,8 @@ declare class AudioRecorder {
396
458
  private _mixWritten;
397
459
  private _startTime;
398
460
  private _started;
461
+ private _log;
462
+ setLogger(logger: Logger): void;
399
463
  constructor(recordingPath: string, callId: string);
400
464
  start(): void;
401
465
  private _expectedBytes;
@@ -436,6 +500,10 @@ declare class OpenAIRealtime implements Session {
436
500
  private _language;
437
501
  private _eagerness;
438
502
  private _greeting;
503
+ private _log;
504
+ private _builtinTools;
505
+ setLogger(logger: Logger): void;
506
+ setBuiltinTools(tools: Set<BuiltinTool>): void;
439
507
  private _ws;
440
508
  private _call;
441
509
  private _tools;
@@ -445,12 +513,15 @@ declare class OpenAIRealtime implements Session {
445
513
  private _responseStartTs;
446
514
  private _sentAudioChunks;
447
515
  private _audioRemainder;
516
+ private _responseInProgress;
517
+ private _onResponseDone;
448
518
  constructor(options?: OpenAIRealtimeOptions);
449
519
  /** Inject per-call ToolRegistry. */
450
520
  setToolRegistry(registry: ToolRegistry): void;
451
521
  /** Inject per-call AudioRecorder. */
452
522
  setRecorder(recorder: AudioRecorder): void;
453
523
  start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
524
+ feedDtmf(digits: string): Promise<void>;
454
525
  feedAudio(audio: Buffer): void;
455
526
  stop(): Promise<void>;
456
527
  private _sendSessionUpdate;
@@ -458,6 +529,7 @@ declare class OpenAIRealtime implements Session {
458
529
  private _handleAudioDelta;
459
530
  private _handleTruncation;
460
531
  private _handleToolCall;
532
+ private _waitForResponseDone;
461
533
  private _send;
462
534
  }
463
535
 
@@ -496,13 +568,19 @@ declare class GeminiRealtime implements Session {
496
568
  private _closed;
497
569
  private _sentAudioChunks;
498
570
  private _audioRemainder;
571
+ private _builtinTools;
572
+ private _toolCallInProgress;
573
+ private _log;
499
574
  constructor(options?: GeminiRealtimeOptions);
500
575
  /** Inject per-call ToolRegistry. */
501
576
  setToolRegistry(registry: ToolRegistry): void;
502
577
  /** Inject per-call AudioRecorder. */
503
578
  setRecorder(recorder: AudioRecorder): void;
579
+ setBuiltinTools(tools: Set<BuiltinTool>): void;
580
+ setLogger(logger: Logger): void;
504
581
  start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
505
582
  feedAudio(audio: Buffer): void;
583
+ feedDtmf(digits: string): Promise<void>;
506
584
  stop(): Promise<void>;
507
585
  private _buildToolSchemas;
508
586
  private _handleMessage;
@@ -556,16 +634,22 @@ declare class PipelineSession implements Session {
556
634
  private _audioBuffer;
557
635
  private _running;
558
636
  private _speaking;
637
+ private _builtinTools;
638
+ private _log;
559
639
  constructor(options: PipelineSessionOptions);
560
640
  setToolRegistry(registry: ToolRegistry): void;
561
641
  setRecorder(recorder: AudioRecorder): void;
642
+ setBuiltinTools(tools: Set<BuiltinTool>): void;
643
+ setLogger(logger: Logger): void;
562
644
  start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
563
645
  feedAudio(audio: Buffer): void;
646
+ feedDtmf(digits: string): Promise<void>;
564
647
  stop(): Promise<void>;
565
648
  private _runSttLoop;
566
649
  private _createAudioStream;
567
650
  private _generateGreeting;
568
651
  private _handleUserSpeech;
652
+ private _buildEffectiveTools;
569
653
  private _respond;
570
654
  private _handleToolCall;
571
655
  private _synthesizeAndSend;
@@ -597,6 +681,8 @@ interface DeepgramSTTOptions {
597
681
  }
598
682
  declare class DeepgramSTT implements STT {
599
683
  private _options;
684
+ private _log;
685
+ setLogger(logger: Logger): void;
600
686
  constructor(options?: DeepgramSTTOptions);
601
687
  transcribe(audioStream: AsyncIterable<Buffer>, options?: {
602
688
  language?: string;
@@ -626,6 +712,8 @@ interface ElevenLabsTTSOptions {
626
712
  }
627
713
  declare class ElevenLabsTTS implements TTS {
628
714
  private _options;
715
+ private _log;
716
+ setLogger(logger: Logger): void;
629
717
  constructor(options?: ElevenLabsTTSOptions);
630
718
  synthesize(text: string | AsyncIterable<string>, options?: {
631
719
  voice?: string;
@@ -872,4 +960,23 @@ declare class XaiLLM implements LLM {
872
960
  }): AsyncGenerator<LLMChunk>;
873
961
  }
874
962
 
875
- 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 };
963
+ /**
964
+ * Logger factory for the ClawOps agent module.
965
+ *
966
+ * Provides a 2-level hierarchy matching the Python SDK:
967
+ * - clawops.agent (core: agent, session, control-ws, media-ws, recorder, mcp, realtime)
968
+ * - clawops.agent.pipeline (pipeline: pipeline-session, stt, tts)
969
+ */
970
+
971
+ /**
972
+ * Create or return an agent-level logger.
973
+ * If no user logger is provided, returns the default pino instance.
974
+ */
975
+ declare function createAgentLogger(userLogger?: Logger): Logger;
976
+ /**
977
+ * Create a pipeline child logger from a parent agent logger.
978
+ * Adds `{ module: 'pipeline' }` to all log entries.
979
+ */
980
+ declare function createPipelineLogger(parent: Logger): Logger;
981
+
982
+ 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, createAgentLogger, createPipelineLogger, functionTool, getTracingConfig, mcpServerHTTP, mcpServerStdio, pcm16ToUlaw, resamplePcm16, resetTracingConfig, setTracingConfig, ulawToPcm16, zodToToolParams };