@teamlearners/clawops 0.5.3 → 0.5.5

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
  /**
@@ -164,6 +169,7 @@ declare class CallSession {
164
169
  private _dtmfCollectorActive;
165
170
  private _dtmfResolvers;
166
171
  private _dtmfBuffer;
172
+ private _log;
167
173
  private _handlers;
168
174
  private _endedPromise;
169
175
  private _resolveEnded;
@@ -175,6 +181,7 @@ declare class CallSession {
175
181
  direction: CallDirection;
176
182
  metadata?: Record<string, unknown>;
177
183
  });
184
+ setLogger(logger: Logger): void;
178
185
  get status(): CallStatus;
179
186
  get duration(): number;
180
187
  /** Bind transport functions (called internally by the agent). */
@@ -263,6 +270,8 @@ interface Session {
263
270
  feedDtmf?(digits: string): Promise<void>;
264
271
  /** Stop the session. */
265
272
  stop(): Promise<void>;
273
+ /** Set the logger instance for this session. */
274
+ setLogger?(logger: Logger): void;
266
275
  }
267
276
  /**
268
277
  * Speech-to-Text provider interface.
@@ -355,6 +364,8 @@ interface ClawOpsAgentOptions {
355
364
  builtinTools?: BuiltinTool | BuiltinTool[];
356
365
  /** Debounce time (ms) for passive DTMF accumulation. Default: 500 */
357
366
  passiveDtmfDebounceMs?: number;
367
+ /** Custom pino logger instance. If omitted, a default logger is created. */
368
+ logger?: Logger;
358
369
  }
359
370
  declare class ClawOpsAgent {
360
371
  private _apiKey;
@@ -375,6 +386,9 @@ declare class ClawOpsAgent {
375
386
  private _passiveDtmfTimer;
376
387
  private _passiveDtmfCallId;
377
388
  private _callSessions;
389
+ private _log;
390
+ private _pipelineLog;
391
+ private _isPipelineSession;
378
392
  constructor(options: ClawOpsAgentOptions);
379
393
  /**
380
394
  * Register a function tool.
@@ -444,6 +458,8 @@ declare class AudioRecorder {
444
458
  private _mixWritten;
445
459
  private _startTime;
446
460
  private _started;
461
+ private _log;
462
+ setLogger(logger: Logger): void;
447
463
  constructor(recordingPath: string, callId: string);
448
464
  start(): void;
449
465
  private _expectedBytes;
@@ -484,7 +500,9 @@ declare class OpenAIRealtime implements Session {
484
500
  private _language;
485
501
  private _eagerness;
486
502
  private _greeting;
503
+ private _log;
487
504
  private _builtinTools;
505
+ setLogger(logger: Logger): void;
488
506
  setBuiltinTools(tools: Set<BuiltinTool>): void;
489
507
  private _ws;
490
508
  private _call;
@@ -552,12 +570,14 @@ declare class GeminiRealtime implements Session {
552
570
  private _audioRemainder;
553
571
  private _builtinTools;
554
572
  private _toolCallInProgress;
573
+ private _log;
555
574
  constructor(options?: GeminiRealtimeOptions);
556
575
  /** Inject per-call ToolRegistry. */
557
576
  setToolRegistry(registry: ToolRegistry): void;
558
577
  /** Inject per-call AudioRecorder. */
559
578
  setRecorder(recorder: AudioRecorder): void;
560
579
  setBuiltinTools(tools: Set<BuiltinTool>): void;
580
+ setLogger(logger: Logger): void;
561
581
  start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
562
582
  feedAudio(audio: Buffer): void;
563
583
  feedDtmf(digits: string): Promise<void>;
@@ -615,10 +635,12 @@ declare class PipelineSession implements Session {
615
635
  private _running;
616
636
  private _speaking;
617
637
  private _builtinTools;
638
+ private _log;
618
639
  constructor(options: PipelineSessionOptions);
619
640
  setToolRegistry(registry: ToolRegistry): void;
620
641
  setRecorder(recorder: AudioRecorder): void;
621
642
  setBuiltinTools(tools: Set<BuiltinTool>): void;
643
+ setLogger(logger: Logger): void;
622
644
  start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
623
645
  feedAudio(audio: Buffer): void;
624
646
  feedDtmf(digits: string): Promise<void>;
@@ -659,6 +681,8 @@ interface DeepgramSTTOptions {
659
681
  }
660
682
  declare class DeepgramSTT implements STT {
661
683
  private _options;
684
+ private _log;
685
+ setLogger(logger: Logger): void;
662
686
  constructor(options?: DeepgramSTTOptions);
663
687
  transcribe(audioStream: AsyncIterable<Buffer>, options?: {
664
688
  language?: string;
@@ -688,6 +712,8 @@ interface ElevenLabsTTSOptions {
688
712
  }
689
713
  declare class ElevenLabsTTS implements TTS {
690
714
  private _options;
715
+ private _log;
716
+ setLogger(logger: Logger): void;
691
717
  constructor(options?: ElevenLabsTTSOptions);
692
718
  synthesize(text: string | AsyncIterable<string>, options?: {
693
719
  voice?: string;
@@ -934,4 +960,23 @@ declare class XaiLLM implements LLM {
934
960
  }): AsyncGenerator<LLMChunk>;
935
961
  }
936
962
 
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 };
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
  /**
@@ -164,6 +169,7 @@ declare class CallSession {
164
169
  private _dtmfCollectorActive;
165
170
  private _dtmfResolvers;
166
171
  private _dtmfBuffer;
172
+ private _log;
167
173
  private _handlers;
168
174
  private _endedPromise;
169
175
  private _resolveEnded;
@@ -175,6 +181,7 @@ declare class CallSession {
175
181
  direction: CallDirection;
176
182
  metadata?: Record<string, unknown>;
177
183
  });
184
+ setLogger(logger: Logger): void;
178
185
  get status(): CallStatus;
179
186
  get duration(): number;
180
187
  /** Bind transport functions (called internally by the agent). */
@@ -263,6 +270,8 @@ interface Session {
263
270
  feedDtmf?(digits: string): Promise<void>;
264
271
  /** Stop the session. */
265
272
  stop(): Promise<void>;
273
+ /** Set the logger instance for this session. */
274
+ setLogger?(logger: Logger): void;
266
275
  }
267
276
  /**
268
277
  * Speech-to-Text provider interface.
@@ -355,6 +364,8 @@ interface ClawOpsAgentOptions {
355
364
  builtinTools?: BuiltinTool | BuiltinTool[];
356
365
  /** Debounce time (ms) for passive DTMF accumulation. Default: 500 */
357
366
  passiveDtmfDebounceMs?: number;
367
+ /** Custom pino logger instance. If omitted, a default logger is created. */
368
+ logger?: Logger;
358
369
  }
359
370
  declare class ClawOpsAgent {
360
371
  private _apiKey;
@@ -375,6 +386,9 @@ declare class ClawOpsAgent {
375
386
  private _passiveDtmfTimer;
376
387
  private _passiveDtmfCallId;
377
388
  private _callSessions;
389
+ private _log;
390
+ private _pipelineLog;
391
+ private _isPipelineSession;
378
392
  constructor(options: ClawOpsAgentOptions);
379
393
  /**
380
394
  * Register a function tool.
@@ -444,6 +458,8 @@ declare class AudioRecorder {
444
458
  private _mixWritten;
445
459
  private _startTime;
446
460
  private _started;
461
+ private _log;
462
+ setLogger(logger: Logger): void;
447
463
  constructor(recordingPath: string, callId: string);
448
464
  start(): void;
449
465
  private _expectedBytes;
@@ -484,7 +500,9 @@ declare class OpenAIRealtime implements Session {
484
500
  private _language;
485
501
  private _eagerness;
486
502
  private _greeting;
503
+ private _log;
487
504
  private _builtinTools;
505
+ setLogger(logger: Logger): void;
488
506
  setBuiltinTools(tools: Set<BuiltinTool>): void;
489
507
  private _ws;
490
508
  private _call;
@@ -552,12 +570,14 @@ declare class GeminiRealtime implements Session {
552
570
  private _audioRemainder;
553
571
  private _builtinTools;
554
572
  private _toolCallInProgress;
573
+ private _log;
555
574
  constructor(options?: GeminiRealtimeOptions);
556
575
  /** Inject per-call ToolRegistry. */
557
576
  setToolRegistry(registry: ToolRegistry): void;
558
577
  /** Inject per-call AudioRecorder. */
559
578
  setRecorder(recorder: AudioRecorder): void;
560
579
  setBuiltinTools(tools: Set<BuiltinTool>): void;
580
+ setLogger(logger: Logger): void;
561
581
  start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
562
582
  feedAudio(audio: Buffer): void;
563
583
  feedDtmf(digits: string): Promise<void>;
@@ -615,10 +635,12 @@ declare class PipelineSession implements Session {
615
635
  private _running;
616
636
  private _speaking;
617
637
  private _builtinTools;
638
+ private _log;
618
639
  constructor(options: PipelineSessionOptions);
619
640
  setToolRegistry(registry: ToolRegistry): void;
620
641
  setRecorder(recorder: AudioRecorder): void;
621
642
  setBuiltinTools(tools: Set<BuiltinTool>): void;
643
+ setLogger(logger: Logger): void;
622
644
  start(callSession: CallSession, tools?: ToolRegistry): Promise<void>;
623
645
  feedAudio(audio: Buffer): void;
624
646
  feedDtmf(digits: string): Promise<void>;
@@ -659,6 +681,8 @@ interface DeepgramSTTOptions {
659
681
  }
660
682
  declare class DeepgramSTT implements STT {
661
683
  private _options;
684
+ private _log;
685
+ setLogger(logger: Logger): void;
662
686
  constructor(options?: DeepgramSTTOptions);
663
687
  transcribe(audioStream: AsyncIterable<Buffer>, options?: {
664
688
  language?: string;
@@ -688,6 +712,8 @@ interface ElevenLabsTTSOptions {
688
712
  }
689
713
  declare class ElevenLabsTTS implements TTS {
690
714
  private _options;
715
+ private _log;
716
+ setLogger(logger: Logger): void;
691
717
  constructor(options?: ElevenLabsTTSOptions);
692
718
  synthesize(text: string | AsyncIterable<string>, options?: {
693
719
  voice?: string;
@@ -934,4 +960,23 @@ declare class XaiLLM implements LLM {
934
960
  }): AsyncGenerator<LLMChunk>;
935
961
  }
936
962
 
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 };
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 };