@teamlearners/clawops 0.11.0 → 0.13.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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkCOBPAA3N_cjs = require('../chunk-COBPAA3N.cjs');
3
+ var chunkT563RQOL_cjs = require('../chunk-T563RQOL.cjs');
4
4
  var pino = require('pino');
5
5
  var fs = require('fs');
6
6
  var path = require('path');
@@ -1043,7 +1043,7 @@ var MAX_ERROR_MESSAGE_LENGTH = 200;
1043
1043
  function getSdkInfo() {
1044
1044
  return {
1045
1045
  name: "clawops-node",
1046
- version: chunkCOBPAA3N_cjs.VERSION,
1046
+ version: chunkT563RQOL_cjs.VERSION,
1047
1047
  runtime: `node/${process.versions.node}`,
1048
1048
  os: `${process.platform}/${os__default.default.arch()}`
1049
1049
  };
@@ -1724,7 +1724,7 @@ var ClawOpsAgent = class {
1724
1724
  constructor(options) {
1725
1725
  this._apiKey = options.apiKey ?? process.env["CLAWOPS_API_KEY"] ?? "";
1726
1726
  this._accountId = options.accountId ?? process.env["CLAWOPS_ACCOUNT_ID"] ?? "";
1727
- this._baseUrl = options.baseUrl ?? chunkCOBPAA3N_cjs.DEFAULT_BASE_URL;
1727
+ this._baseUrl = options.baseUrl ?? chunkT563RQOL_cjs.DEFAULT_BASE_URL;
1728
1728
  this._fromNumber = options.from;
1729
1729
  this._session = options.session;
1730
1730
  this._recording = options.recording ?? false;
@@ -1752,7 +1752,7 @@ var ClawOpsAgent = class {
1752
1752
  tool(nameOrTool, description, parameters, handler) {
1753
1753
  if (typeof nameOrTool === "string") {
1754
1754
  if (!description || !parameters || !handler) {
1755
- throw new chunkCOBPAA3N_cjs.AgentError(
1755
+ throw new chunkT563RQOL_cjs.AgentError(
1756
1756
  "tool(name, description, parameters, handler) requires all arguments."
1757
1757
  );
1758
1758
  }
@@ -1788,10 +1788,10 @@ var ClawOpsAgent = class {
1788
1788
  async connect() {
1789
1789
  if (this._controlWs) return;
1790
1790
  if (!this._apiKey) {
1791
- throw new chunkCOBPAA3N_cjs.AgentError("API key is required. Set CLAWOPS_API_KEY or pass apiKey option.");
1791
+ throw new chunkT563RQOL_cjs.AgentError("API key is required. Set CLAWOPS_API_KEY or pass apiKey option.");
1792
1792
  }
1793
1793
  if (!this._accountId) {
1794
- throw new chunkCOBPAA3N_cjs.AgentError(
1794
+ throw new chunkT563RQOL_cjs.AgentError(
1795
1795
  "Account ID is required. Set CLAWOPS_ACCOUNT_ID or pass accountId option."
1796
1796
  );
1797
1797
  }
@@ -1815,7 +1815,7 @@ var ClawOpsAgent = class {
1815
1815
  } catch {
1816
1816
  }
1817
1817
  } catch (err) {
1818
- throw new chunkCOBPAA3N_cjs.AgentConnectionError(
1818
+ throw new chunkT563RQOL_cjs.AgentConnectionError(
1819
1819
  `Failed to connect to ClawOps: ${err instanceof Error ? err.message : String(err)}`
1820
1820
  );
1821
1821
  }
@@ -1866,7 +1866,7 @@ var ClawOpsAgent = class {
1866
1866
  });
1867
1867
  if (resp.status !== 201) {
1868
1868
  const error = await resp.json();
1869
- throw new chunkCOBPAA3N_cjs.AgentError(`\uBC1C\uC2E0 \uC2E4\uD328 (${resp.status}): ${error["error"] ?? ""}`);
1869
+ throw new chunkT563RQOL_cjs.AgentError(`\uBC1C\uC2E0 \uC2E4\uD328 (${resp.status}): ${error["error"] ?? ""}`);
1870
1870
  }
1871
1871
  const data = await resp.json();
1872
1872
  const callSession = new CallSession({
@@ -3013,6 +3013,8 @@ var GeminiRealtime = class _GeminiRealtime {
3013
3013
  _voice;
3014
3014
  _language;
3015
3015
  _greeting;
3016
+ _realtimeInputConfig;
3017
+ _inputAudioTranscription;
3016
3018
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3017
3019
  _session = null;
3018
3020
  _call = null;
@@ -3034,6 +3036,8 @@ var GeminiRealtime = class _GeminiRealtime {
3034
3036
  this._voice = options.voice ?? "Kore";
3035
3037
  this._language = options.language ?? "ko";
3036
3038
  this._greeting = options.greeting ?? true;
3039
+ this._realtimeInputConfig = options.realtimeInputConfig ?? null;
3040
+ this._inputAudioTranscription = options.inputAudioTranscription ?? {};
3037
3041
  }
3038
3042
  /** Inject per-call ToolRegistry. */
3039
3043
  setToolRegistry(registry) {
@@ -3074,11 +3078,8 @@ var GeminiRealtime = class _GeminiRealtime {
3074
3078
  this._closed = false;
3075
3079
  this._sentAudioChunks = 0;
3076
3080
  this._audioRemainder = Buffer.alloc(0);
3077
- if (!this._apiKey) {
3078
- throw new Error("Google API key is required. Set GOOGLE_API_KEY or pass apiKey option.");
3079
- }
3080
3081
  const { GoogleGenAI } = await import('@google/genai/node');
3081
- const client = new GoogleGenAI({ apiKey: this._apiKey });
3082
+ const client = this._apiKey ? new GoogleGenAI({ apiKey: this._apiKey }) : new GoogleGenAI({});
3082
3083
  const config = {
3083
3084
  responseModalities: ["AUDIO"],
3084
3085
  speechConfig: {
@@ -3088,9 +3089,12 @@ var GeminiRealtime = class _GeminiRealtime {
3088
3089
  }
3089
3090
  }
3090
3091
  },
3091
- inputAudioTranscription: {},
3092
+ inputAudioTranscription: this._inputAudioTranscription,
3092
3093
  outputAudioTranscription: {}
3093
3094
  };
3095
+ if (this._realtimeInputConfig) {
3096
+ config["realtimeInputConfig"] = this._realtimeInputConfig;
3097
+ }
3094
3098
  if (this._systemPrompt) {
3095
3099
  config["systemInstruction"] = {
3096
3100
  parts: [{ text: this._systemPrompt }]
@@ -3100,6 +3104,7 @@ var GeminiRealtime = class _GeminiRealtime {
3100
3104
  if (toolSchemas.length > 0) {
3101
3105
  config["tools"] = [{ functionDeclarations: toolSchemas }];
3102
3106
  }
3107
+ this._log.debug({ config }, "Gemini SDK final config");
3103
3108
  this._session = await client.live.connect({
3104
3109
  model: this._model,
3105
3110
  config,
@@ -3845,9 +3850,8 @@ var GeminiLLM = class {
3845
3850
  }
3846
3851
  async *generate(messages, options) {
3847
3852
  const { GoogleGenAI } = await import('@google/genai');
3848
- const client = new GoogleGenAI({
3849
- apiKey: this._options.apiKey ?? process.env["GOOGLE_API_KEY"]
3850
- });
3853
+ const apiKey = this._options.apiKey ?? process.env["GOOGLE_API_KEY"];
3854
+ const client = apiKey ? new GoogleGenAI({ apiKey }) : new GoogleGenAI();
3851
3855
  let systemInstruction;
3852
3856
  const contents = [];
3853
3857
  for (const msg of messages) {