@teamlearners/clawops 0.16.4 → 0.16.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.
- package/dist/agent/index.cjs +29 -23
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.js +21 -15
- package/dist/agent/index.js.map +1 -1
- package/dist/{chunk-B3SD2KKR.js → chunk-BHGDB52N.js} +3 -3
- package/dist/{chunk-B3SD2KKR.js.map → chunk-BHGDB52N.js.map} +1 -1
- package/dist/{chunk-GTXJFMHN.cjs → chunk-TFYE5DWP.cjs} +3 -3
- package/dist/{chunk-GTXJFMHN.cjs.map → chunk-TFYE5DWP.cjs.map} +1 -1
- package/dist/index.cjs +35 -35
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/agent/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkTFYE5DWP_cjs = require('../chunk-TFYE5DWP.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:
|
|
1082
|
+
version: chunkTFYE5DWP_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 ??
|
|
1765
|
+
this._baseUrl = options.baseUrl ?? chunkTFYE5DWP_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
|
|
1787
|
+
throw new chunkTFYE5DWP_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
|
|
1801
|
+
throw new chunkTFYE5DWP_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
|
|
1837
|
+
throw new chunkTFYE5DWP_cjs.AgentError("API key is required. Set CLAWOPS_API_KEY or pass apiKey option.");
|
|
1838
1838
|
}
|
|
1839
1839
|
if (!this._accountId) {
|
|
1840
|
-
throw new
|
|
1840
|
+
throw new chunkTFYE5DWP_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
|
|
1864
|
+
throw new chunkTFYE5DWP_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
|
|
1915
|
+
throw new chunkTFYE5DWP_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
|
-
|
|
2791
|
-
|
|
2789
|
+
type: "realtime",
|
|
2790
|
+
output_modalities: ["audio"],
|
|
2792
2791
|
instructions: this._systemPrompt,
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
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.
|
|
2814
|
+
case "response.output_audio.delta": {
|
|
2809
2815
|
this._handleAudioDelta(msg);
|
|
2810
2816
|
break;
|
|
2811
2817
|
}
|
|
2812
|
-
case "response.
|
|
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.
|
|
2852
|
+
case "response.output_audio_transcript.done": {
|
|
2847
2853
|
if (this._call) {
|
|
2848
2854
|
this._call._emit("transcript", "assistant", msg["transcript"] ?? "");
|
|
2849
2855
|
}
|