@teamlearners/clawops 0.16.4 → 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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkGTXJFMHN_cjs = require('../chunk-GTXJFMHN.cjs');
3
+ var chunkOLGP2XVS_cjs = require('../chunk-OLGP2XVS.cjs');
4
4
  var pino = require('pino');
5
5
  var fs = require('fs');
6
6
  var path = require('path');
@@ -1079,7 +1079,7 @@ var MAX_ERROR_MESSAGE_LENGTH = 200;
1079
1079
  function getSdkInfo() {
1080
1080
  return {
1081
1081
  name: "clawops-node",
1082
- version: chunkGTXJFMHN_cjs.VERSION,
1082
+ version: chunkOLGP2XVS_cjs.VERSION,
1083
1083
  runtime: `node/${process.versions.node}`,
1084
1084
  os: `${process.platform}/${os__default.default.arch()}`
1085
1085
  };
@@ -1762,7 +1762,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
1762
1762
  constructor(options) {
1763
1763
  this._apiKey = options.apiKey ?? process.env["CLAWOPS_API_KEY"] ?? "";
1764
1764
  this._accountId = options.accountId ?? process.env["CLAWOPS_ACCOUNT_ID"] ?? "";
1765
- this._baseUrl = options.baseUrl ?? chunkGTXJFMHN_cjs.DEFAULT_BASE_URL;
1765
+ this._baseUrl = options.baseUrl ?? chunkOLGP2XVS_cjs.DEFAULT_BASE_URL;
1766
1766
  this._fromNumber = options.from;
1767
1767
  this._session = options.session;
1768
1768
  this._recording = options.recording ?? false;
@@ -1784,7 +1784,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
1784
1784
  }
1785
1785
  static _validateGain(name, gain) {
1786
1786
  if (typeof gain !== "number" || !Number.isFinite(gain) || gain < 0) {
1787
- throw new chunkGTXJFMHN_cjs.AgentError(`${name}=${gain} must be a finite number >= 0`);
1787
+ throw new chunkOLGP2XVS_cjs.AgentError(`${name}=${gain} must be a finite number >= 0`);
1788
1788
  }
1789
1789
  return gain;
1790
1790
  }
@@ -1798,7 +1798,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
1798
1798
  tool(nameOrTool, description, parameters, handler) {
1799
1799
  if (typeof nameOrTool === "string") {
1800
1800
  if (!description || !parameters || !handler) {
1801
- throw new chunkGTXJFMHN_cjs.AgentError(
1801
+ throw new chunkOLGP2XVS_cjs.AgentError(
1802
1802
  "tool(name, description, parameters, handler) requires all arguments."
1803
1803
  );
1804
1804
  }
@@ -1834,10 +1834,10 @@ var ClawOpsAgent = class _ClawOpsAgent {
1834
1834
  async connect() {
1835
1835
  if (this._controlWs) return;
1836
1836
  if (!this._apiKey) {
1837
- throw new chunkGTXJFMHN_cjs.AgentError("API key is required. Set CLAWOPS_API_KEY or pass apiKey option.");
1837
+ throw new chunkOLGP2XVS_cjs.AgentError("API key is required. Set CLAWOPS_API_KEY or pass apiKey option.");
1838
1838
  }
1839
1839
  if (!this._accountId) {
1840
- throw new chunkGTXJFMHN_cjs.AgentError(
1840
+ throw new chunkOLGP2XVS_cjs.AgentError(
1841
1841
  "Account ID is required. Set CLAWOPS_ACCOUNT_ID or pass accountId option."
1842
1842
  );
1843
1843
  }
@@ -1861,7 +1861,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
1861
1861
  } catch {
1862
1862
  }
1863
1863
  } catch (err) {
1864
- throw new chunkGTXJFMHN_cjs.AgentConnectionError(
1864
+ throw new chunkOLGP2XVS_cjs.AgentConnectionError(
1865
1865
  `Failed to connect to ClawOps: ${err instanceof Error ? err.message : String(err)}`
1866
1866
  );
1867
1867
  }
@@ -1912,7 +1912,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
1912
1912
  });
1913
1913
  if (resp.status !== 201) {
1914
1914
  const error = await resp.json();
1915
- throw new chunkGTXJFMHN_cjs.AgentError(`\uBC1C\uC2E0 \uC2E4\uD328 (${resp.status}): ${error["error"] ?? ""}`);
1915
+ throw new chunkOLGP2XVS_cjs.AgentError(`\uBC1C\uC2E0 \uC2E4\uD328 (${resp.status}): ${error["error"] ?? ""}`);
1916
1916
  }
1917
1917
  const data = await resp.json();
1918
1918
  const callSession = new CallSession({
@@ -2716,8 +2716,7 @@ var OpenAIRealtime = class {
2716
2716
  const url = `${OPENAI_REALTIME_URL}${this._model}`;
2717
2717
  this._ws = new WebSocket(url, {
2718
2718
  headers: {
2719
- Authorization: `Bearer ${this._apiKey}`,
2720
- "OpenAI-Beta": "realtime=v1"
2719
+ Authorization: `Bearer ${this._apiKey}`
2721
2720
  }
2722
2721
  });
2723
2722
  return new Promise((resolve, reject) => {
@@ -2787,17 +2786,24 @@ var OpenAIRealtime = class {
2787
2786
  this._send({
2788
2787
  type: "session.update",
2789
2788
  session: {
2790
- modalities: ["text", "audio"],
2791
- voice: this._voice,
2789
+ type: "realtime",
2790
+ output_modalities: ["audio"],
2792
2791
  instructions: this._systemPrompt,
2793
- input_audio_format: "g711_ulaw",
2794
- output_audio_format: "g711_ulaw",
2795
- input_audio_transcription: {
2796
- model: "whisper-1",
2797
- language: this._language
2792
+ audio: {
2793
+ input: {
2794
+ format: { type: "audio/pcmu" },
2795
+ noise_reduction: { type: "far_field" },
2796
+ transcription: {
2797
+ model: "gpt-realtime-whisper",
2798
+ language: this._language
2799
+ },
2800
+ turn_detection: this._turnDetection
2801
+ },
2802
+ output: {
2803
+ format: { type: "audio/pcmu" },
2804
+ voice: this._voice
2805
+ }
2798
2806
  },
2799
- input_audio_noise_reduction: { type: "far_field" },
2800
- turn_detection: this._turnDetection,
2801
2807
  tools: toolSchemas
2802
2808
  }
2803
2809
  });
@@ -2805,11 +2811,11 @@ var OpenAIRealtime = class {
2805
2811
  _handleMessage(msg) {
2806
2812
  const type = msg["type"];
2807
2813
  switch (type) {
2808
- case "response.audio.delta": {
2814
+ case "response.output_audio.delta": {
2809
2815
  this._handleAudioDelta(msg);
2810
2816
  break;
2811
2817
  }
2812
- case "response.audio.done": {
2818
+ case "response.output_audio.done": {
2813
2819
  if (this._playback) {
2814
2820
  this._playback.generating = false;
2815
2821
  if (this._playback.audioRemainder.length > 0) {
@@ -2843,7 +2849,7 @@ var OpenAIRealtime = class {
2843
2849
  }
2844
2850
  break;
2845
2851
  }
2846
- case "response.audio_transcript.done": {
2852
+ case "response.output_audio_transcript.done": {
2847
2853
  if (this._call) {
2848
2854
  this._call._emit("transcript", "assistant", msg["transcript"] ?? "");
2849
2855
  }
@@ -4281,6 +4287,7 @@ exports.BUILTIN_TOOL_NAMES = BUILTIN_TOOL_NAMES;
4281
4287
  exports.BuiltinTool = BuiltinTool;
4282
4288
  exports.CallSession = CallSession;
4283
4289
  exports.ClawOpsAgent = ClawOpsAgent;
4290
+ exports.ControlWebSocket = ControlWebSocket;
4284
4291
  exports.DECODE_TABLE = DECODE_TABLE;
4285
4292
  exports.DeepSeekLLM = DeepSeekLLM;
4286
4293
  exports.DeepgramSTT = DeepgramSTT;
@@ -4301,6 +4308,7 @@ exports.PipelineSession = PipelineSession;
4301
4308
  exports.TogetherLLM = TogetherLLM;
4302
4309
  exports.ToolRegistry = ToolRegistry;
4303
4310
  exports.XaiLLM = XaiLLM;
4311
+ exports.buildControlWsUrl = buildControlWsUrl;
4304
4312
  exports.createAgentLogger = createAgentLogger;
4305
4313
  exports.createPipelineLogger = createPipelineLogger;
4306
4314
  exports.executeBuiltinTool = executeBuiltinTool;