@teamlearners/clawops 0.16.5 → 0.16.6

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.
@@ -517,6 +517,64 @@ declare class ClawOpsAgent {
517
517
  private _startCallSession;
518
518
  }
519
519
 
520
+ /**
521
+ * Control WebSocket for agent signaling (call.incoming, call.ended, etc.).
522
+ */
523
+
524
+ interface ControlWsOptions {
525
+ baseUrl: string;
526
+ apiKey: string;
527
+ accountId: string;
528
+ /** Phone number to register on. */
529
+ number?: string;
530
+ }
531
+ /**
532
+ * Control event is a flat JSON object with an 'event' field.
533
+ * Example: { "event": "call.incoming", "callId": "xxx", "from": "070...", "mediaUrl": "wss://..." }
534
+ */
535
+ interface ControlEvent {
536
+ event: string;
537
+ [key: string]: unknown;
538
+ }
539
+ type ControlEventHandler = (event: ControlEvent) => void | Promise<void>;
540
+ /**
541
+ * Build the full control WebSocket URL from options.
542
+ * Matches Python SDK: /v1/accounts/{account_id}/agent/listen?number={number}
543
+ */
544
+ declare function buildControlWsUrl(options: ControlWsOptions): string;
545
+ declare class ControlWebSocket {
546
+ private readonly _options;
547
+ private _url;
548
+ private _ws;
549
+ private _handlers;
550
+ private _transferResolvers;
551
+ private _reconnectDelay;
552
+ private _closed;
553
+ private _connectedResolve;
554
+ private _connectedPromise;
555
+ private _log;
556
+ private _pingTimer;
557
+ setLogger(logger: Logger): void;
558
+ constructor(_options: ControlWsOptions);
559
+ /** Register an event handler for a specific event type. */
560
+ on(event: string, handler: ControlEventHandler): void;
561
+ /** Connect to the control WebSocket. */
562
+ connect(): Promise<void>;
563
+ /** Wait until the WebSocket is connected. */
564
+ waitConnected(): Promise<void>;
565
+ /** Request a call transfer and wait for the result. */
566
+ requestTransfer(callId: string, params: Record<string, unknown>): Promise<Record<string, unknown>>;
567
+ /** Send a JSON message over the control WebSocket. */
568
+ send(message: Record<string, unknown>): void;
569
+ /** Close the WebSocket and stop reconnecting. */
570
+ close(): void;
571
+ private _doConnect;
572
+ private _dispatchEvent;
573
+ private _resetPingTimer;
574
+ private _clearPingTimer;
575
+ private _scheduleReconnect;
576
+ }
577
+
520
578
  /**
521
579
  * Media WebSocket for streaming audio to/from the telephony platform.
522
580
  *
@@ -1202,4 +1260,4 @@ declare function createAgentLogger(userLogger?: Logger): Logger;
1202
1260
  */
1203
1261
  declare function createPipelineLogger(parent: Logger): Logger;
1204
1262
 
1205
- 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 };
1263
+ export { type AgentEventType, AnthropicLLM, type AnthropicLLMOptions, AudioRecorder, BUILTIN_TOOL_NAMES, BuiltinTool, type CallDirection, CallSession, type CallStatus, ClawOpsAgent, type ClawOpsAgentOptions, type ControlEvent, ControlWebSocket, type ControlWsOptions, 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, buildControlWsUrl, createAgentLogger, createPipelineLogger, executeBuiltinTool, functionTool, getBuiltinToolSchemas, getTracingConfig, isBuiltinTool, mcpServerHTTP, mcpServerStdio, pcm16ToUlaw, resamplePcm16, resetTracingConfig, setTracingConfig, ulawToPcm16, zodToToolParams };
@@ -517,6 +517,64 @@ declare class ClawOpsAgent {
517
517
  private _startCallSession;
518
518
  }
519
519
 
520
+ /**
521
+ * Control WebSocket for agent signaling (call.incoming, call.ended, etc.).
522
+ */
523
+
524
+ interface ControlWsOptions {
525
+ baseUrl: string;
526
+ apiKey: string;
527
+ accountId: string;
528
+ /** Phone number to register on. */
529
+ number?: string;
530
+ }
531
+ /**
532
+ * Control event is a flat JSON object with an 'event' field.
533
+ * Example: { "event": "call.incoming", "callId": "xxx", "from": "070...", "mediaUrl": "wss://..." }
534
+ */
535
+ interface ControlEvent {
536
+ event: string;
537
+ [key: string]: unknown;
538
+ }
539
+ type ControlEventHandler = (event: ControlEvent) => void | Promise<void>;
540
+ /**
541
+ * Build the full control WebSocket URL from options.
542
+ * Matches Python SDK: /v1/accounts/{account_id}/agent/listen?number={number}
543
+ */
544
+ declare function buildControlWsUrl(options: ControlWsOptions): string;
545
+ declare class ControlWebSocket {
546
+ private readonly _options;
547
+ private _url;
548
+ private _ws;
549
+ private _handlers;
550
+ private _transferResolvers;
551
+ private _reconnectDelay;
552
+ private _closed;
553
+ private _connectedResolve;
554
+ private _connectedPromise;
555
+ private _log;
556
+ private _pingTimer;
557
+ setLogger(logger: Logger): void;
558
+ constructor(_options: ControlWsOptions);
559
+ /** Register an event handler for a specific event type. */
560
+ on(event: string, handler: ControlEventHandler): void;
561
+ /** Connect to the control WebSocket. */
562
+ connect(): Promise<void>;
563
+ /** Wait until the WebSocket is connected. */
564
+ waitConnected(): Promise<void>;
565
+ /** Request a call transfer and wait for the result. */
566
+ requestTransfer(callId: string, params: Record<string, unknown>): Promise<Record<string, unknown>>;
567
+ /** Send a JSON message over the control WebSocket. */
568
+ send(message: Record<string, unknown>): void;
569
+ /** Close the WebSocket and stop reconnecting. */
570
+ close(): void;
571
+ private _doConnect;
572
+ private _dispatchEvent;
573
+ private _resetPingTimer;
574
+ private _clearPingTimer;
575
+ private _scheduleReconnect;
576
+ }
577
+
520
578
  /**
521
579
  * Media WebSocket for streaming audio to/from the telephony platform.
522
580
  *
@@ -1202,4 +1260,4 @@ declare function createAgentLogger(userLogger?: Logger): Logger;
1202
1260
  */
1203
1261
  declare function createPipelineLogger(parent: Logger): Logger;
1204
1262
 
1205
- 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 };
1263
+ export { type AgentEventType, AnthropicLLM, type AnthropicLLMOptions, AudioRecorder, BUILTIN_TOOL_NAMES, BuiltinTool, type CallDirection, CallSession, type CallStatus, ClawOpsAgent, type ClawOpsAgentOptions, type ControlEvent, ControlWebSocket, type ControlWsOptions, 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, buildControlWsUrl, createAgentLogger, createPipelineLogger, executeBuiltinTool, functionTool, getBuiltinToolSchemas, getTracingConfig, isBuiltinTool, mcpServerHTTP, mcpServerStdio, pcm16ToUlaw, resamplePcm16, resetTracingConfig, setTracingConfig, ulawToPcm16, zodToToolParams };
@@ -1,4 +1,4 @@
1
- import { DEFAULT_BASE_URL, AgentError, AgentConnectionError, VERSION } from '../chunk-BHGDB52N.js';
1
+ import { DEFAULT_BASE_URL, AgentError, AgentConnectionError, VERSION } from '../chunk-RYJF2N7K.js';
2
2
  import pino from 'pino';
3
3
  import * as fs from 'fs';
4
4
  import * as path from 'path';
@@ -4254,6 +4254,6 @@ function mcpServerHTTP(options) {
4254
4254
  };
4255
4255
  }
4256
4256
 
4257
- export { AnthropicLLM, AudioRecorder, BUILTIN_TOOL_NAMES, BuiltinTool, CallSession, ClawOpsAgent, DECODE_TABLE, DeepSeekLLM, DeepgramSTT, ElevenLabsTTS, FireworksLLM, GeminiLLM, GeminiRealtime, GroqLLM, MCPClient, MediaWebSocket, MistralLLM, OllamaLLM, OpenAICompatLLM, OpenAILLM, OpenAIRealtime, PerplexityLLM, PipelineSession, TogetherLLM, ToolRegistry, XaiLLM, createAgentLogger, createPipelineLogger, executeBuiltinTool, functionTool, getBuiltinToolSchemas, getTracingConfig, isBuiltinTool, mcpServerHTTP, mcpServerStdio, pcm16ToUlaw, resamplePcm16, resetTracingConfig, setTracingConfig, ulawToPcm16, zodToToolParams };
4257
+ export { AnthropicLLM, AudioRecorder, BUILTIN_TOOL_NAMES, BuiltinTool, CallSession, ClawOpsAgent, ControlWebSocket, DECODE_TABLE, DeepSeekLLM, DeepgramSTT, ElevenLabsTTS, FireworksLLM, GeminiLLM, GeminiRealtime, GroqLLM, MCPClient, MediaWebSocket, MistralLLM, OllamaLLM, OpenAICompatLLM, OpenAILLM, OpenAIRealtime, PerplexityLLM, PipelineSession, TogetherLLM, ToolRegistry, XaiLLM, buildControlWsUrl, createAgentLogger, createPipelineLogger, executeBuiltinTool, functionTool, getBuiltinToolSchemas, getTracingConfig, isBuiltinTool, mcpServerHTTP, mcpServerStdio, pcm16ToUlaw, resamplePcm16, resetTracingConfig, setTracingConfig, ulawToPcm16, zodToToolParams };
4258
4258
  //# sourceMappingURL=index.js.map
4259
4259
  //# sourceMappingURL=index.js.map