@teamlearners/clawops 0.8.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.
@@ -182,6 +182,9 @@ interface HangupFn {
182
182
  interface SendDtmfFn {
183
183
  (digit: string): Promise<void>;
184
184
  }
185
+ interface TransferFn {
186
+ (params: Record<string, unknown>): Promise<Record<string, unknown>>;
187
+ }
185
188
  declare class CallSession {
186
189
  readonly callId: string;
187
190
  readonly fromNumber: string;
@@ -195,6 +198,7 @@ declare class CallSession {
195
198
  private _clearAudioFn;
196
199
  private _hangupFn;
197
200
  /** @internal */ _sendDtmfFn: SendDtmfFn | null;
201
+ /** @internal */ _transferFn: TransferFn | null;
198
202
  /** @internal */ _isTransportConnected: (() => boolean) | null;
199
203
  private _dtmfCollectorActive;
200
204
  private _dtmfResolvers;
@@ -242,6 +246,16 @@ declare class CallSession {
242
246
  }): Promise<string>;
243
247
  /** Send a sequence of DTMF digits. */
244
248
  sendDtmfSequence(digits: string): Promise<void>;
249
+ /** Transfer the call to another destination. */
250
+ transfer(to: string, options?: {
251
+ mode?: 'blind' | 'warm';
252
+ afterTransfer?: 'terminate' | 'return';
253
+ holdMedia?: string;
254
+ whisper?: string;
255
+ context?: Record<string, unknown>;
256
+ callerId?: string;
257
+ timeout?: number;
258
+ }): Promise<Record<string, unknown>>;
245
259
  /** Register an event handler. */
246
260
  on(event: string, handler: SessionEventHandler): void;
247
261
  /** Wait for the call to end. */
@@ -262,6 +276,8 @@ declare enum BuiltinTool {
262
276
  COLLECT_DTMF = "collect_dtmf",
263
277
  /** DTMF 전송 도구. ARS 탐색이나 내선번호 입력에 사용합니다. */
264
278
  SEND_DTMF = "send_dtmf",
279
+ /** 통화 전환 도구. 현재 통화를 다른 번호로 전환합니다. */
280
+ TRANSFER_CALL = "transfer_call",
265
281
  /** 모든 내장 도구를 활성화합니다. (기본값) */
266
282
  ALL = "all",
267
283
  /** 모든 내장 도구를 비활성화합니다. */
@@ -382,6 +398,11 @@ declare function resetTracingConfig(): void;
382
398
 
383
399
  type AgentEventType = 'call_start' | 'call_end' | 'call_failed' | 'transcript' | 'dtmf';
384
400
  type AgentEventHandler = (...args: any[]) => void | Promise<void>;
401
+ /** Tool 실행 관련 설정. */
402
+ interface ToolConfig {
403
+ /** Tool 실행 중 재생할 hold audio. true=기본 차임, string=wav 파일 경로, Buffer=raw ulaw. */
404
+ holdAudio?: boolean | string | Buffer;
405
+ }
385
406
  interface ClawOpsAgentOptions {
386
407
  /** ClawOps API key. Falls back to CLAWOPS_API_KEY env var. */
387
408
  apiKey?: string;
@@ -407,6 +428,8 @@ interface ClawOpsAgentOptions {
407
428
  passiveDtmfDebounceMs?: number;
408
429
  /** Custom pino logger instance. If omitted, a default logger is created. */
409
430
  logger?: Logger;
431
+ /** Tool 실행 관련 설정. */
432
+ toolConfig?: ToolConfig;
410
433
  }
411
434
  declare class ClawOpsAgent {
412
435
  private _apiKey;
@@ -430,6 +453,7 @@ declare class ClawOpsAgent {
430
453
  private _log;
431
454
  private _pipelineLog;
432
455
  private _isPipelineSession;
456
+ private _holdAudioChunks;
433
457
  constructor(options: ClawOpsAgentOptions);
434
458
  /**
435
459
  * Register a function tool.
@@ -620,11 +644,14 @@ declare class PipelineSession implements Session {
620
644
  private _running;
621
645
  private _speaking;
622
646
  private _builtinTools;
647
+ private _holdAudioChunks;
623
648
  private _log;
624
649
  constructor(options: PipelineSessionOptions);
625
650
  setToolRegistry(registry: ToolRegistry): void;
626
651
  setRecorder(recorder: AudioRecorder): void;
627
652
  setBuiltinTools(tools: Set<BuiltinTool>): void;
653
+ /** Tool 실행 중 재생할 hold audio 청크를 설정한다. */
654
+ setHoldAudio(chunks: Buffer[]): void;
628
655
  getTelemetry(): SessionTelemetry;
629
656
  setLogger(logger: Logger): void;
630
657
  start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
@@ -691,11 +718,14 @@ declare class OpenAIRealtime implements Session {
691
718
  private _pendingToolCalls;
692
719
  private _responseInProgress;
693
720
  private _onResponseDone;
721
+ private _holdAudioChunks;
694
722
  constructor(options?: OpenAIRealtimeOptions);
695
723
  /** Inject per-call ToolRegistry. */
696
724
  setToolRegistry(registry: ToolRegistry): void;
697
725
  /** Inject per-call AudioRecorder. */
698
726
  setRecorder(recorder: AudioRecorder): void;
727
+ /** Tool 실행 중 재생할 hold audio 청크를 설정한다. */
728
+ setHoldAudio(chunks: Buffer[]): void;
699
729
  start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
700
730
  feedDtmf(digits: string): Promise<void>;
701
731
  feedAudio(audio: Buffer): void;
@@ -721,7 +751,7 @@ interface GeminiRealtimeOptions {
721
751
  apiKey?: string;
722
752
  /** System prompt / instructions for the AI. */
723
753
  systemPrompt?: string;
724
- /** Model to use. Default: 'gemini-2.5-flash-native-audio-preview-12-2025' */
754
+ /** Model to use. Default: 'gemini-3.1-flash-live-preview' */
725
755
  model?: string;
726
756
  /** Voice name. Default: 'Kore' */
727
757
  voice?: string;
@@ -745,7 +775,10 @@ declare class GeminiRealtime implements Session {
745
775
  private _sentAudioChunks;
746
776
  private _audioRemainder;
747
777
  private _builtinTools;
748
- private _toolCallInProgress;
778
+ private _pendingToolCall;
779
+ private _toolDrainTimer;
780
+ private _lastAudioTime;
781
+ private _holdAudioChunks;
749
782
  private _log;
750
783
  constructor(options?: GeminiRealtimeOptions);
751
784
  /** Inject per-call ToolRegistry. */
@@ -753,6 +786,8 @@ declare class GeminiRealtime implements Session {
753
786
  /** Inject per-call AudioRecorder. */
754
787
  setRecorder(recorder: AudioRecorder): void;
755
788
  setBuiltinTools(tools: Set<BuiltinTool>): void;
789
+ /** Tool 실행 중 재생할 hold audio 청크를 설정한다. */
790
+ setHoldAudio(chunks: Buffer[]): void;
756
791
  setLogger(logger: Logger): void;
757
792
  getTelemetry(): SessionTelemetry;
758
793
  start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
@@ -763,6 +798,8 @@ declare class GeminiRealtime implements Session {
763
798
  private _handleMessage;
764
799
  private _handleAudioData;
765
800
  private _flushAudioRemainder;
801
+ private static readonly TOOL_DRAIN_TIMEOUT;
802
+ private _scheduleToolExecution;
766
803
  private _handleToolCall;
767
804
  }
768
805
 
@@ -1140,4 +1177,4 @@ declare function createAgentLogger(userLogger?: Logger): Logger;
1140
1177
  */
1141
1178
  declare function createPipelineLogger(parent: Logger): Logger;
1142
1179
 
1143
- export { type AgentEventType, AnthropicLLM, type AnthropicLLMOptions, AudioRecorder, BUILTIN_TOOL_NAMES, BuiltinTool, type CallDirection, CallSession, type CallStatus, ClawOpsAgent, type ClawOpsAgentOptions, type ConversationMessage, DECODE_TABLE, DeepSeekLLM, type DeepSeekLLMOptions, DeepgramSTT, type DeepgramSTTOptions, type DtmfEvent, 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, type MediaEvent, type MediaStartEvent, MediaWebSocket, 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, type ToolCallRequest, ToolRegistry, type TracingConfig, XaiLLM, type XaiLLMOptions, createAgentLogger, createPipelineLogger, executeBuiltinTool, functionTool, getBuiltinToolSchemas, getTracingConfig, isBuiltinTool, mcpServerHTTP, mcpServerStdio, pcm16ToUlaw, resamplePcm16, resetTracingConfig, setTracingConfig, ulawToPcm16, zodToToolParams };
1180
+ export { type AgentEventType, AnthropicLLM, type AnthropicLLMOptions, AudioRecorder, BUILTIN_TOOL_NAMES, BuiltinTool, type CallDirection, CallSession, type CallStatus, ClawOpsAgent, type ClawOpsAgentOptions, type ConversationMessage, DECODE_TABLE, DeepSeekLLM, type DeepSeekLLMOptions, DeepgramSTT, type DeepgramSTTOptions, type DtmfEvent, 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, type MediaEvent, type MediaStartEvent, MediaWebSocket, 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, type ToolCallRequest, type ToolConfig, ToolRegistry, type TracingConfig, XaiLLM, type XaiLLMOptions, createAgentLogger, createPipelineLogger, executeBuiltinTool, functionTool, getBuiltinToolSchemas, getTracingConfig, isBuiltinTool, mcpServerHTTP, mcpServerStdio, pcm16ToUlaw, resamplePcm16, resetTracingConfig, setTracingConfig, ulawToPcm16, zodToToolParams };
@@ -182,6 +182,9 @@ interface HangupFn {
182
182
  interface SendDtmfFn {
183
183
  (digit: string): Promise<void>;
184
184
  }
185
+ interface TransferFn {
186
+ (params: Record<string, unknown>): Promise<Record<string, unknown>>;
187
+ }
185
188
  declare class CallSession {
186
189
  readonly callId: string;
187
190
  readonly fromNumber: string;
@@ -195,6 +198,7 @@ declare class CallSession {
195
198
  private _clearAudioFn;
196
199
  private _hangupFn;
197
200
  /** @internal */ _sendDtmfFn: SendDtmfFn | null;
201
+ /** @internal */ _transferFn: TransferFn | null;
198
202
  /** @internal */ _isTransportConnected: (() => boolean) | null;
199
203
  private _dtmfCollectorActive;
200
204
  private _dtmfResolvers;
@@ -242,6 +246,16 @@ declare class CallSession {
242
246
  }): Promise<string>;
243
247
  /** Send a sequence of DTMF digits. */
244
248
  sendDtmfSequence(digits: string): Promise<void>;
249
+ /** Transfer the call to another destination. */
250
+ transfer(to: string, options?: {
251
+ mode?: 'blind' | 'warm';
252
+ afterTransfer?: 'terminate' | 'return';
253
+ holdMedia?: string;
254
+ whisper?: string;
255
+ context?: Record<string, unknown>;
256
+ callerId?: string;
257
+ timeout?: number;
258
+ }): Promise<Record<string, unknown>>;
245
259
  /** Register an event handler. */
246
260
  on(event: string, handler: SessionEventHandler): void;
247
261
  /** Wait for the call to end. */
@@ -262,6 +276,8 @@ declare enum BuiltinTool {
262
276
  COLLECT_DTMF = "collect_dtmf",
263
277
  /** DTMF 전송 도구. ARS 탐색이나 내선번호 입력에 사용합니다. */
264
278
  SEND_DTMF = "send_dtmf",
279
+ /** 통화 전환 도구. 현재 통화를 다른 번호로 전환합니다. */
280
+ TRANSFER_CALL = "transfer_call",
265
281
  /** 모든 내장 도구를 활성화합니다. (기본값) */
266
282
  ALL = "all",
267
283
  /** 모든 내장 도구를 비활성화합니다. */
@@ -382,6 +398,11 @@ declare function resetTracingConfig(): void;
382
398
 
383
399
  type AgentEventType = 'call_start' | 'call_end' | 'call_failed' | 'transcript' | 'dtmf';
384
400
  type AgentEventHandler = (...args: any[]) => void | Promise<void>;
401
+ /** Tool 실행 관련 설정. */
402
+ interface ToolConfig {
403
+ /** Tool 실행 중 재생할 hold audio. true=기본 차임, string=wav 파일 경로, Buffer=raw ulaw. */
404
+ holdAudio?: boolean | string | Buffer;
405
+ }
385
406
  interface ClawOpsAgentOptions {
386
407
  /** ClawOps API key. Falls back to CLAWOPS_API_KEY env var. */
387
408
  apiKey?: string;
@@ -407,6 +428,8 @@ interface ClawOpsAgentOptions {
407
428
  passiveDtmfDebounceMs?: number;
408
429
  /** Custom pino logger instance. If omitted, a default logger is created. */
409
430
  logger?: Logger;
431
+ /** Tool 실행 관련 설정. */
432
+ toolConfig?: ToolConfig;
410
433
  }
411
434
  declare class ClawOpsAgent {
412
435
  private _apiKey;
@@ -430,6 +453,7 @@ declare class ClawOpsAgent {
430
453
  private _log;
431
454
  private _pipelineLog;
432
455
  private _isPipelineSession;
456
+ private _holdAudioChunks;
433
457
  constructor(options: ClawOpsAgentOptions);
434
458
  /**
435
459
  * Register a function tool.
@@ -620,11 +644,14 @@ declare class PipelineSession implements Session {
620
644
  private _running;
621
645
  private _speaking;
622
646
  private _builtinTools;
647
+ private _holdAudioChunks;
623
648
  private _log;
624
649
  constructor(options: PipelineSessionOptions);
625
650
  setToolRegistry(registry: ToolRegistry): void;
626
651
  setRecorder(recorder: AudioRecorder): void;
627
652
  setBuiltinTools(tools: Set<BuiltinTool>): void;
653
+ /** Tool 실행 중 재생할 hold audio 청크를 설정한다. */
654
+ setHoldAudio(chunks: Buffer[]): void;
628
655
  getTelemetry(): SessionTelemetry;
629
656
  setLogger(logger: Logger): void;
630
657
  start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
@@ -691,11 +718,14 @@ declare class OpenAIRealtime implements Session {
691
718
  private _pendingToolCalls;
692
719
  private _responseInProgress;
693
720
  private _onResponseDone;
721
+ private _holdAudioChunks;
694
722
  constructor(options?: OpenAIRealtimeOptions);
695
723
  /** Inject per-call ToolRegistry. */
696
724
  setToolRegistry(registry: ToolRegistry): void;
697
725
  /** Inject per-call AudioRecorder. */
698
726
  setRecorder(recorder: AudioRecorder): void;
727
+ /** Tool 실행 중 재생할 hold audio 청크를 설정한다. */
728
+ setHoldAudio(chunks: Buffer[]): void;
699
729
  start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
700
730
  feedDtmf(digits: string): Promise<void>;
701
731
  feedAudio(audio: Buffer): void;
@@ -721,7 +751,7 @@ interface GeminiRealtimeOptions {
721
751
  apiKey?: string;
722
752
  /** System prompt / instructions for the AI. */
723
753
  systemPrompt?: string;
724
- /** Model to use. Default: 'gemini-2.5-flash-native-audio-preview-12-2025' */
754
+ /** Model to use. Default: 'gemini-3.1-flash-live-preview' */
725
755
  model?: string;
726
756
  /** Voice name. Default: 'Kore' */
727
757
  voice?: string;
@@ -745,7 +775,10 @@ declare class GeminiRealtime implements Session {
745
775
  private _sentAudioChunks;
746
776
  private _audioRemainder;
747
777
  private _builtinTools;
748
- private _toolCallInProgress;
778
+ private _pendingToolCall;
779
+ private _toolDrainTimer;
780
+ private _lastAudioTime;
781
+ private _holdAudioChunks;
749
782
  private _log;
750
783
  constructor(options?: GeminiRealtimeOptions);
751
784
  /** Inject per-call ToolRegistry. */
@@ -753,6 +786,8 @@ declare class GeminiRealtime implements Session {
753
786
  /** Inject per-call AudioRecorder. */
754
787
  setRecorder(recorder: AudioRecorder): void;
755
788
  setBuiltinTools(tools: Set<BuiltinTool>): void;
789
+ /** Tool 실행 중 재생할 hold audio 청크를 설정한다. */
790
+ setHoldAudio(chunks: Buffer[]): void;
756
791
  setLogger(logger: Logger): void;
757
792
  getTelemetry(): SessionTelemetry;
758
793
  start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
@@ -763,6 +798,8 @@ declare class GeminiRealtime implements Session {
763
798
  private _handleMessage;
764
799
  private _handleAudioData;
765
800
  private _flushAudioRemainder;
801
+ private static readonly TOOL_DRAIN_TIMEOUT;
802
+ private _scheduleToolExecution;
766
803
  private _handleToolCall;
767
804
  }
768
805
 
@@ -1140,4 +1177,4 @@ declare function createAgentLogger(userLogger?: Logger): Logger;
1140
1177
  */
1141
1178
  declare function createPipelineLogger(parent: Logger): Logger;
1142
1179
 
1143
- export { type AgentEventType, AnthropicLLM, type AnthropicLLMOptions, AudioRecorder, BUILTIN_TOOL_NAMES, BuiltinTool, type CallDirection, CallSession, type CallStatus, ClawOpsAgent, type ClawOpsAgentOptions, type ConversationMessage, DECODE_TABLE, DeepSeekLLM, type DeepSeekLLMOptions, DeepgramSTT, type DeepgramSTTOptions, type DtmfEvent, 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, type MediaEvent, type MediaStartEvent, MediaWebSocket, 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, type ToolCallRequest, ToolRegistry, type TracingConfig, XaiLLM, type XaiLLMOptions, createAgentLogger, createPipelineLogger, executeBuiltinTool, functionTool, getBuiltinToolSchemas, getTracingConfig, isBuiltinTool, mcpServerHTTP, mcpServerStdio, pcm16ToUlaw, resamplePcm16, resetTracingConfig, setTracingConfig, ulawToPcm16, zodToToolParams };
1180
+ export { type AgentEventType, AnthropicLLM, type AnthropicLLMOptions, AudioRecorder, BUILTIN_TOOL_NAMES, BuiltinTool, type CallDirection, CallSession, type CallStatus, ClawOpsAgent, type ClawOpsAgentOptions, type ConversationMessage, DECODE_TABLE, DeepSeekLLM, type DeepSeekLLMOptions, DeepgramSTT, type DeepgramSTTOptions, type DtmfEvent, 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, type MediaEvent, type MediaStartEvent, MediaWebSocket, 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, type ToolCallRequest, type ToolConfig, ToolRegistry, type TracingConfig, XaiLLM, type XaiLLMOptions, createAgentLogger, createPipelineLogger, executeBuiltinTool, functionTool, getBuiltinToolSchemas, getTracingConfig, isBuiltinTool, mcpServerHTTP, mcpServerStdio, pcm16ToUlaw, resamplePcm16, resetTracingConfig, setTracingConfig, ulawToPcm16, zodToToolParams };