@koreaaitel/sdk 0.62.1 → 0.62.2

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.
@@ -2,8 +2,8 @@
2
2
 
3
3
  var chunkLLPMUDNE_cjs = require('../chunk-LLPMUDNE.cjs');
4
4
  var chunkB3QB5WPI_cjs = require('../chunk-B3QB5WPI.cjs');
5
- var chunk5ZH3XGLJ_cjs = require('../chunk-5ZH3XGLJ.cjs');
6
- require('../chunk-LPQFS6AS.cjs');
5
+ var chunkPDE4I4MV_cjs = require('../chunk-PDE4I4MV.cjs');
6
+ require('../chunk-TCIIGMEU.cjs');
7
7
  var path = require('path');
8
8
  var fs = require('fs');
9
9
  var crypto = require('crypto');
@@ -218,7 +218,7 @@ var ControlWebSocket = class {
218
218
  _connectedReject = null;
219
219
  _connectedPromise;
220
220
  _rejected = null;
221
- _log = chunk5ZH3XGLJ_cjs.NOOP_LOGGER;
221
+ _log = chunkPDE4I4MV_cjs.NOOP_LOGGER;
222
222
  _pingTimer = null;
223
223
  // Lame duck: this process is stepping down. It must NOT reconnect for any reason — a
224
224
  // reconnect evicts whichever process has taken the slot in the meantime, and that one never
@@ -563,7 +563,7 @@ async function startHealthServer(port, isReady, log) {
563
563
  var MCPClient = class {
564
564
  _servers = /* @__PURE__ */ new Map();
565
565
  _clients = /* @__PURE__ */ new Map();
566
- _log = chunk5ZH3XGLJ_cjs.NOOP_LOGGER;
566
+ _log = chunkPDE4I4MV_cjs.NOOP_LOGGER;
567
567
  setLogger(logger) {
568
568
  this._log = logger;
569
569
  }
@@ -718,7 +718,7 @@ var PLAYOUT_QUIET_MS = 300;
718
718
  var MediaWebSocket = class {
719
719
  constructor(options = {}) {
720
720
  this.options = options;
721
- if (options.expectedMediaProfile !== void 0) chunk5ZH3XGLJ_cjs.mediaContract(options.expectedMediaProfile);
721
+ if (options.expectedMediaProfile !== void 0) chunkPDE4I4MV_cjs.mediaContract(options.expectedMediaProfile);
722
722
  this._formatValidated = options.expectedMediaProfile === void 0;
723
723
  }
724
724
  _ws = null;
@@ -732,7 +732,7 @@ var MediaWebSocket = class {
732
732
  _markWaiters = /* @__PURE__ */ new Map();
733
733
  /** 마지막으로 오디오를 큐에 넣은 시각(ms). 재생 끝 판정의 「조용한 구간」 기준. */
734
734
  _lastAudioAt = 0;
735
- _log = chunk5ZH3XGLJ_cjs.NOOP_LOGGER;
735
+ _log = chunkPDE4I4MV_cjs.NOOP_LOGGER;
736
736
  _formatValidated;
737
737
  setLogger(logger) {
738
738
  this._log = logger;
@@ -922,7 +922,7 @@ var MediaWebSocket = class {
922
922
  case "start": {
923
923
  if (this.options.expectedMediaProfile !== void 0) {
924
924
  try {
925
- chunk5ZH3XGLJ_cjs.validateMediaFormat(
925
+ chunkPDE4I4MV_cjs.validateMediaFormat(
926
926
  this.options.expectedMediaProfile,
927
927
  msg["start"]?.["mediaFormat"] ?? {}
928
928
  );
@@ -1032,7 +1032,7 @@ var AudioRecorder = class {
1032
1032
  _started = false;
1033
1033
  _baseTs = null;
1034
1034
  _outCursor = 0;
1035
- _log = chunk5ZH3XGLJ_cjs.NOOP_LOGGER;
1035
+ _log = chunkPDE4I4MV_cjs.NOOP_LOGGER;
1036
1036
  setLogger(logger) {
1037
1037
  this._log = logger;
1038
1038
  }
@@ -1195,7 +1195,7 @@ var IncomingCall = class {
1195
1195
  this.forwardedFrom = init.forwardedFrom ?? null;
1196
1196
  this._onReject = init.onReject;
1197
1197
  this._onDecide = init.onDecide;
1198
- this._log = init.logger ?? chunk5ZH3XGLJ_cjs.NOOP_LOGGER;
1198
+ this._log = init.logger ?? chunkPDE4I4MV_cjs.NOOP_LOGGER;
1199
1199
  }
1200
1200
  /** 거절했으면 `true`. */
1201
1201
  get rejected() {
@@ -1220,7 +1220,7 @@ var IncomingCall = class {
1220
1220
  * - 부르는 즉시 결정된다 — 선별 함수가 뒤에 더 일해도 기다리지 않는다.
1221
1221
  */
1222
1222
  async transfer(to, opts = {}) {
1223
- const payload = chunk5ZH3XGLJ_cjs.buildTransferPayload(to, { ...opts, mode: "blind", afterTransfer: "terminate" });
1223
+ const payload = chunkPDE4I4MV_cjs.buildTransferPayload(to, { ...opts, mode: "blind", afterTransfer: "terminate" });
1224
1224
  if (this._state === "closed") {
1225
1225
  this._log.warn(
1226
1226
  { callId: this.callId, to },
@@ -1348,7 +1348,7 @@ function generateComfortTone(volume = 0.12) {
1348
1348
  }
1349
1349
  }
1350
1350
  const pcm = int16ArrayToBuffer(concatInt16Arrays(...parts));
1351
- const ulaw = chunk5ZH3XGLJ_cjs.pcm16ToUlaw(pcm);
1351
+ const ulaw = chunkPDE4I4MV_cjs.pcm16ToUlaw(pcm);
1352
1352
  const chunks = [];
1353
1353
  for (let i = 0; i < ulaw.length; i += CHUNK_SIZE) {
1354
1354
  chunks.push(ulaw.subarray(i, i + CHUNK_SIZE));
@@ -1405,9 +1405,9 @@ function loadHoldAudio(source) {
1405
1405
  pcmData = mono;
1406
1406
  }
1407
1407
  if (sampleRate !== SAMPLE_RATE2) {
1408
- pcmData = chunk5ZH3XGLJ_cjs.resamplePcm16(pcmData, sampleRate, SAMPLE_RATE2);
1408
+ pcmData = chunkPDE4I4MV_cjs.resamplePcm16(pcmData, sampleRate, SAMPLE_RATE2);
1409
1409
  }
1410
- const ulaw = chunk5ZH3XGLJ_cjs.pcm16ToUlaw(pcmData);
1410
+ const ulaw = chunkPDE4I4MV_cjs.pcm16ToUlaw(pcmData);
1411
1411
  const chunks = [];
1412
1412
  for (let i = 0; i < ulaw.length; i += CHUNK_SIZE) {
1413
1413
  chunks.push(ulaw.subarray(i, i + CHUNK_SIZE));
@@ -1775,7 +1775,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
1775
1775
  this._recording = options.recording ?? false;
1776
1776
  this._recordingPath = options.recordingPath ?? "./recordings";
1777
1777
  this._mcpServers = options.mcpServers ?? [];
1778
- this._builtinTools = chunk5ZH3XGLJ_cjs.resolveBuiltinTools(options.builtinTools ?? "all" /* ALL */);
1778
+ this._builtinTools = chunkPDE4I4MV_cjs.resolveBuiltinTools(options.builtinTools ?? "all" /* ALL */);
1779
1779
  this._passiveDtmfDebounceMs = options.passiveDtmfDebounceMs ?? 2e3;
1780
1780
  this._passiveDtmfFinishKey = options.passiveDtmfFinishKey === void 0 ? "#" : options.passiveDtmfFinishKey;
1781
1781
  this._passiveDtmfMaxDigits = options.passiveDtmfMaxDigits ?? null;
@@ -1796,9 +1796,9 @@ var ClawOpsAgent = class _ClawOpsAgent {
1796
1796
  if (options.tracing) {
1797
1797
  setTracingConfig(options.tracing);
1798
1798
  }
1799
- this._log = chunk5ZH3XGLJ_cjs.createAgentLogger(options.logger);
1799
+ this._log = chunkPDE4I4MV_cjs.createAgentLogger(options.logger);
1800
1800
  clearStaleReadyMarker(this._log);
1801
- this._pipelineLog = chunk5ZH3XGLJ_cjs.createPipelineLogger(this._log);
1801
+ this._pipelineLog = chunkPDE4I4MV_cjs.createPipelineLogger(this._log);
1802
1802
  this._isPipelineSession = "_stt" in this._session && "_llm" in this._session;
1803
1803
  if (options.toolConfig?.holdAudio) {
1804
1804
  this._holdAudioChunks = loadHoldAudio(options.toolConfig.holdAudio);
@@ -1931,7 +1931,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
1931
1931
  await this._controlWs.connect();
1932
1932
  await this._controlWs.waitConnected();
1933
1933
  try {
1934
- this._controlWs.send({ event: "agent.hello", sdk: chunk5ZH3XGLJ_cjs.getSdkInfo() });
1934
+ this._controlWs.send({ event: "agent.hello", sdk: chunkPDE4I4MV_cjs.getSdkInfo() });
1935
1935
  } catch {
1936
1936
  }
1937
1937
  this._ready = true;
@@ -2229,7 +2229,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
2229
2229
  throw new chunkB3QB5WPI_cjs.AgentError(`\uBC1C\uC2E0 \uC2E4\uD328 (${resp.status}): ${error["error"] ?? ""}`);
2230
2230
  }
2231
2231
  const data = await resp.json();
2232
- const callSession = new chunk5ZH3XGLJ_cjs.CallSession({
2232
+ const callSession = new chunkPDE4I4MV_cjs.CallSession({
2233
2233
  callId: data["callId"],
2234
2234
  fromNumber: this._fromNumber,
2235
2235
  toNumber: to,
@@ -2335,7 +2335,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
2335
2335
  const callId = event["callId"];
2336
2336
  const fromNumber = event["from"] ?? "";
2337
2337
  const mediaUrl = event["mediaUrl"] ?? "";
2338
- const session = new chunk5ZH3XGLJ_cjs.CallSession({
2338
+ const session = new chunkPDE4I4MV_cjs.CallSession({
2339
2339
  callId,
2340
2340
  fromNumber,
2341
2341
  toNumber: this._fromNumber,
@@ -2457,7 +2457,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
2457
2457
  const callId = event["callId"];
2458
2458
  const fromNumber = event["from"] ?? "";
2459
2459
  const mediaUrl = event["mediaUrl"] ?? "";
2460
- const session = new chunk5ZH3XGLJ_cjs.CallSession({
2460
+ const session = new chunkPDE4I4MV_cjs.CallSession({
2461
2461
  callId,
2462
2462
  fromNumber,
2463
2463
  toNumber: this._fromNumber,
@@ -2565,7 +2565,7 @@ var ClawOpsAgent = class _ClawOpsAgent {
2565
2565
  const mediaUrl = event["mediaUrl"] ?? "";
2566
2566
  let session = this._activeSessions.get(callId);
2567
2567
  if (!session) {
2568
- session = new chunk5ZH3XGLJ_cjs.CallSession({
2568
+ session = new chunkPDE4I4MV_cjs.CallSession({
2569
2569
  callId,
2570
2570
  fromNumber: this._fromNumber,
2571
2571
  toNumber: event["to"] ?? "",
@@ -2793,9 +2793,9 @@ var ClawOpsAgent = class _ClawOpsAgent {
2793
2793
  let latestMediaTs = 0;
2794
2794
  session._bindTransport(
2795
2795
  (audio) => {
2796
- const gained = chunk5ZH3XGLJ_cjs.applyUlawGain(audio, this._txGain);
2796
+ const gained = chunkPDE4I4MV_cjs.applyUlawGain(audio, this._txGain);
2797
2797
  if (recorder) {
2798
- recorder.writeOutbound(chunk5ZH3XGLJ_cjs.ulawToPcm16(gained), latestMediaTs);
2798
+ recorder.writeOutbound(chunkPDE4I4MV_cjs.ulawToPcm16(gained), latestMediaTs);
2799
2799
  }
2800
2800
  mediaWs.sendAudio(gained.toString("base64"));
2801
2801
  session.recordFirstResponse();
@@ -2836,9 +2836,9 @@ var ClawOpsAgent = class _ClawOpsAgent {
2836
2836
  this._callSessions.set(session.callId, sessionHandler);
2837
2837
  mediaWs.onAudio((ulawAudio, timestamp) => {
2838
2838
  latestMediaTs = timestamp;
2839
- const gained = chunk5ZH3XGLJ_cjs.applyUlawGain(ulawAudio, this._rxGain);
2839
+ const gained = chunkPDE4I4MV_cjs.applyUlawGain(ulawAudio, this._rxGain);
2840
2840
  if (recorder) {
2841
- recorder.writeInbound(chunk5ZH3XGLJ_cjs.ulawToPcm16(gained), timestamp);
2841
+ recorder.writeInbound(chunkPDE4I4MV_cjs.ulawToPcm16(gained), timestamp);
2842
2842
  }
2843
2843
  if (sessionHandler) {
2844
2844
  sessionHandler.feedAudio(gained, timestamp);
@@ -2954,7 +2954,7 @@ var PipelineSession = class {
2954
2954
  _speaking = false;
2955
2955
  _builtinTools = null;
2956
2956
  _holdAudioChunks = null;
2957
- _log = chunk5ZH3XGLJ_cjs.NOOP_LOGGER;
2957
+ _log = chunkPDE4I4MV_cjs.NOOP_LOGGER;
2958
2958
  constructor(options) {
2959
2959
  this._stt = options.stt;
2960
2960
  this._llm = options.llm;
@@ -3016,7 +3016,7 @@ var PipelineSession = class {
3016
3016
  */
3017
3017
  async prewarm(tools) {
3018
3018
  if (tools) this._tools = tools;
3019
- this._callSession = new chunk5ZH3XGLJ_cjs.BufferingCall();
3019
+ this._callSession = new chunkPDE4I4MV_cjs.BufferingCall();
3020
3020
  this._running = true;
3021
3021
  this._conversation = [];
3022
3022
  this._log.info("PipelineSession prewarmed");
@@ -3039,7 +3039,7 @@ var PipelineSession = class {
3039
3039
  async attach(callSession) {
3040
3040
  const prev = this._callSession;
3041
3041
  this._callSession = callSession;
3042
- chunk5ZH3XGLJ_cjs.attachBuffered(prev, callSession);
3042
+ chunkPDE4I4MV_cjs.attachBuffered(prev, callSession);
3043
3043
  }
3044
3044
  async start(callSession, tools) {
3045
3045
  this._tools = tools ?? null;
@@ -3086,8 +3086,8 @@ var PipelineSession = class {
3086
3086
  while (this._running) {
3087
3087
  if (this._audioBuffer.length > 0) {
3088
3088
  const ulaw = this._audioBuffer.shift();
3089
- const pcm8k = chunk5ZH3XGLJ_cjs.ulawToPcm16(ulaw);
3090
- const pcm16k = chunk5ZH3XGLJ_cjs.resamplePcm16(pcm8k, 8e3, 16e3);
3089
+ const pcm8k = chunkPDE4I4MV_cjs.ulawToPcm16(ulaw);
3090
+ const pcm16k = chunkPDE4I4MV_cjs.resamplePcm16(pcm8k, 8e3, 16e3);
3091
3091
  yield pcm16k;
3092
3092
  } else {
3093
3093
  await new Promise((resolve) => setTimeout(resolve, 20));
@@ -3103,7 +3103,7 @@ var PipelineSession = class {
3103
3103
  await this._respond();
3104
3104
  }
3105
3105
  _buildEffectiveTools() {
3106
- const builtinSchemas = chunk5ZH3XGLJ_cjs.getBuiltinToolSchemas(this._builtinTools, "chat");
3106
+ const builtinSchemas = chunkPDE4I4MV_cjs.getBuiltinToolSchemas(this._builtinTools, "chat");
3107
3107
  const dtmfSchemas = builtinSchemas.filter((s) => {
3108
3108
  const name = s["function"]?.["name"];
3109
3109
  return name === "collect_dtmf" || name === "send_dtmf";
@@ -3152,8 +3152,8 @@ var PipelineSession = class {
3152
3152
  const { id, name, arguments: argsStr } = chunk.toolCall;
3153
3153
  try {
3154
3154
  const args = JSON.parse(argsStr);
3155
- if (chunk5ZH3XGLJ_cjs.BUILTIN_TOOL_NAMES.has(name) && this._callSession && !(this._callSession instanceof chunk5ZH3XGLJ_cjs.BufferingCall)) {
3156
- const result2 = await chunk5ZH3XGLJ_cjs.executeBuiltinTool(name, args, this._callSession);
3155
+ if (chunkPDE4I4MV_cjs.BUILTIN_TOOL_NAMES.has(name) && this._callSession && !(this._callSession instanceof chunkPDE4I4MV_cjs.BufferingCall)) {
3156
+ const result2 = await chunkPDE4I4MV_cjs.executeBuiltinTool(name, args, this._callSession);
3157
3157
  if (result2 !== null) {
3158
3158
  if (name === "hang_up") return;
3159
3159
  this._conversation.push({ role: "tool", content: result2, tool_call_id: id, name });
@@ -3161,11 +3161,11 @@ var PipelineSession = class {
3161
3161
  return;
3162
3162
  }
3163
3163
  }
3164
- if (chunk5ZH3XGLJ_cjs.BUILTIN_TOOL_NAMES.has(name) && this._callSession instanceof chunk5ZH3XGLJ_cjs.BufferingCall) {
3164
+ if (chunkPDE4I4MV_cjs.BUILTIN_TOOL_NAMES.has(name) && this._callSession instanceof chunkPDE4I4MV_cjs.BufferingCall) {
3165
3165
  this._log.warn("Builtin tool %s called before answer \u2014 deferring", name);
3166
3166
  this._conversation.push({
3167
3167
  role: "tool",
3168
- content: chunk5ZH3XGLJ_cjs.CALL_NOT_READY_RESULT,
3168
+ content: chunkPDE4I4MV_cjs.CALL_NOT_READY_RESULT,
3169
3169
  tool_call_id: id,
3170
3170
  name
3171
3171
  });
@@ -3174,7 +3174,7 @@ var PipelineSession = class {
3174
3174
  }
3175
3175
  if (!this._tools) return;
3176
3176
  this._callSession?.recordToolCall();
3177
- const player = this._holdAudioChunks && this._callSession && !(this._callSession instanceof chunk5ZH3XGLJ_cjs.BufferingCall) ? new HoldAudioPlayer(this._callSession, this._holdAudioChunks) : null;
3177
+ const player = this._holdAudioChunks && this._callSession && !(this._callSession instanceof chunkPDE4I4MV_cjs.BufferingCall) ? new HoldAudioPlayer(this._callSession, this._holdAudioChunks) : null;
3178
3178
  player?.start();
3179
3179
  let result;
3180
3180
  try {
@@ -3225,8 +3225,8 @@ var PipelineSession = class {
3225
3225
  sampleRate: this._sampleRate
3226
3226
  })) {
3227
3227
  if (!this._running || !this._speaking) break;
3228
- const pcm8k = chunk5ZH3XGLJ_cjs.resamplePcm16(audioChunk, this._sampleRate, 8e3);
3229
- const ulaw = chunk5ZH3XGLJ_cjs.pcm16ToUlaw(pcm8k);
3228
+ const pcm8k = chunkPDE4I4MV_cjs.resamplePcm16(audioChunk, this._sampleRate, 8e3);
3229
+ const ulaw = chunkPDE4I4MV_cjs.pcm16ToUlaw(pcm8k);
3230
3230
  for (let off = 0; off < ulaw.length; off += 160) {
3231
3231
  let chunk = ulaw.subarray(off, off + 160);
3232
3232
  if (chunk.length < 160) {
@@ -3254,7 +3254,7 @@ var OpenAIRealtime = class {
3254
3254
  _language;
3255
3255
  _turnDetection;
3256
3256
  _greeting;
3257
- _log = chunk5ZH3XGLJ_cjs.NOOP_LOGGER;
3257
+ _log = chunkPDE4I4MV_cjs.NOOP_LOGGER;
3258
3258
  _builtinTools = null;
3259
3259
  /**
3260
3260
  * 마지막 session.update 로 LLM 에 알린 tool 이름들. attach() 가 이 값과 현재
@@ -3332,7 +3332,7 @@ var OpenAIRealtime = class {
3332
3332
  /** Open WS + session.update + (optional) response.create without a CallSession. */
3333
3333
  async prewarm(tools) {
3334
3334
  if (tools) this._tools = tools;
3335
- this._call = new chunk5ZH3XGLJ_cjs.BufferingCall();
3335
+ this._call = new chunkPDE4I4MV_cjs.BufferingCall();
3336
3336
  this._closed = false;
3337
3337
  this._playback = null;
3338
3338
  this._latestMediaTs = 0;
@@ -3374,7 +3374,7 @@ var OpenAIRealtime = class {
3374
3374
  this._resyncTools();
3375
3375
  const prev = this._call;
3376
3376
  this._call = callSession;
3377
- chunk5ZH3XGLJ_cjs.attachBuffered(prev, callSession);
3377
+ chunkPDE4I4MV_cjs.attachBuffered(prev, callSession);
3378
3378
  }
3379
3379
  async start(callSession, tools) {
3380
3380
  if (tools) this._tools = tools;
@@ -3435,7 +3435,7 @@ var OpenAIRealtime = class {
3435
3435
  /** Current tool schemas: user tools + builtin tools (flat realtime format). */
3436
3436
  _currentToolSchemas() {
3437
3437
  const toolSchemas = this._tools ? this._tools.toOpenAITools().map((t) => ({ type: "function", ...t.function })) : [];
3438
- toolSchemas.push(...chunk5ZH3XGLJ_cjs.getBuiltinToolSchemas(this._builtinTools, "realtime"));
3438
+ toolSchemas.push(...chunkPDE4I4MV_cjs.getBuiltinToolSchemas(this._builtinTools, "realtime"));
3439
3439
  return toolSchemas;
3440
3440
  }
3441
3441
  /**
@@ -3608,9 +3608,9 @@ var OpenAIRealtime = class {
3608
3608
  const controller = new AbortController();
3609
3609
  this._pendingToolCalls.set(callId, controller);
3610
3610
  try {
3611
- if (chunk5ZH3XGLJ_cjs.BUILTIN_TOOL_NAMES.has(funcName) && this._call && !(this._call instanceof chunk5ZH3XGLJ_cjs.BufferingCall)) {
3611
+ if (chunkPDE4I4MV_cjs.BUILTIN_TOOL_NAMES.has(funcName) && this._call && !(this._call instanceof chunkPDE4I4MV_cjs.BufferingCall)) {
3612
3612
  const args = JSON.parse(item["arguments"] ?? "{}");
3613
- const result2 = await chunk5ZH3XGLJ_cjs.executeBuiltinTool(funcName, args, this._call);
3613
+ const result2 = await chunkPDE4I4MV_cjs.executeBuiltinTool(funcName, args, this._call);
3614
3614
  if (result2 !== null) {
3615
3615
  if (funcName === "hang_up") return;
3616
3616
  if (controller.signal.aborted) return;
@@ -3627,7 +3627,7 @@ var OpenAIRealtime = class {
3627
3627
  return;
3628
3628
  }
3629
3629
  }
3630
- if (chunk5ZH3XGLJ_cjs.BUILTIN_TOOL_NAMES.has(funcName) && this._call instanceof chunk5ZH3XGLJ_cjs.BufferingCall) {
3630
+ if (chunkPDE4I4MV_cjs.BUILTIN_TOOL_NAMES.has(funcName) && this._call instanceof chunkPDE4I4MV_cjs.BufferingCall) {
3631
3631
  this._log.warn("Builtin tool %s called before answer \u2014 deferring", funcName);
3632
3632
  await this._waitForResponseDone();
3633
3633
  this._send({
@@ -3635,7 +3635,7 @@ var OpenAIRealtime = class {
3635
3635
  item: {
3636
3636
  type: "function_call_output",
3637
3637
  call_id: callId,
3638
- output: chunk5ZH3XGLJ_cjs.CALL_NOT_READY_RESULT
3638
+ output: chunkPDE4I4MV_cjs.CALL_NOT_READY_RESULT
3639
3639
  }
3640
3640
  });
3641
3641
  this._send({ type: "response.create" });
@@ -3656,7 +3656,7 @@ var OpenAIRealtime = class {
3656
3656
  return;
3657
3657
  }
3658
3658
  let result;
3659
- const player = this._holdAudioChunks && this._call && !(this._call instanceof chunk5ZH3XGLJ_cjs.BufferingCall) ? new HoldAudioPlayer(this._call, this._holdAudioChunks) : null;
3659
+ const player = this._holdAudioChunks && this._call && !(this._call instanceof chunkPDE4I4MV_cjs.BufferingCall) ? new HoldAudioPlayer(this._call, this._holdAudioChunks) : null;
3660
3660
  player?.start();
3661
3661
  try {
3662
3662
  const args = JSON.parse(item["arguments"] ?? "{}");
@@ -3841,7 +3841,7 @@ var GeminiRealtime = class _GeminiRealtime {
3841
3841
  _toolDrainTimer = null;
3842
3842
  _lastAudioTime = 0;
3843
3843
  _holdAudioChunks = null;
3844
- _log = chunk5ZH3XGLJ_cjs.NOOP_LOGGER;
3844
+ _log = chunkPDE4I4MV_cjs.NOOP_LOGGER;
3845
3845
  constructor(options = {}) {
3846
3846
  this._apiKey = options.apiKey ?? process.env["GOOGLE_API_KEY"] ?? "";
3847
3847
  this._systemPrompt = options.systemPrompt ?? "";
@@ -3988,7 +3988,7 @@ var GeminiRealtime = class _GeminiRealtime {
3988
3988
  /** Open Live session (no CallSession). Audio deltas accumulate into BufferingCall until attach(). */
3989
3989
  async prewarm(tools) {
3990
3990
  if (tools) this._tools = tools;
3991
- this._call = new chunk5ZH3XGLJ_cjs.BufferingCall();
3991
+ this._call = new chunkPDE4I4MV_cjs.BufferingCall();
3992
3992
  this._closed = false;
3993
3993
  this._stopping = false;
3994
3994
  this._resumptionHandle = null;
@@ -4201,7 +4201,7 @@ var GeminiRealtime = class _GeminiRealtime {
4201
4201
  this._log.error("Gemini Live session lost: %s \u2014 hanging up", reason);
4202
4202
  this._closed = true;
4203
4203
  const call = this._call;
4204
- if (!call || call instanceof chunk5ZH3XGLJ_cjs.BufferingCall) return;
4204
+ if (!call || call instanceof chunkPDE4I4MV_cjs.BufferingCall) return;
4205
4205
  try {
4206
4206
  call._emit("session_lost", reason);
4207
4207
  } catch (err) {
@@ -4217,7 +4217,7 @@ var GeminiRealtime = class _GeminiRealtime {
4217
4217
  async attach(callSession) {
4218
4218
  const prev = this._call;
4219
4219
  this._call = callSession;
4220
- chunk5ZH3XGLJ_cjs.attachBuffered(prev, callSession);
4220
+ chunkPDE4I4MV_cjs.attachBuffered(prev, callSession);
4221
4221
  }
4222
4222
  async start(callSession, tools) {
4223
4223
  if (tools) this._tools = tools;
@@ -4226,8 +4226,8 @@ var GeminiRealtime = class _GeminiRealtime {
4226
4226
  }
4227
4227
  feedAudio(audio) {
4228
4228
  if (this._session && !this._closed) {
4229
- const pcm8k = chunk5ZH3XGLJ_cjs.ulawToPcm16(audio);
4230
- const pcm16k = chunk5ZH3XGLJ_cjs.resamplePcm16(pcm8k, 8e3, 16e3);
4229
+ const pcm8k = chunkPDE4I4MV_cjs.ulawToPcm16(audio);
4230
+ const pcm16k = chunkPDE4I4MV_cjs.resamplePcm16(pcm8k, 8e3, 16e3);
4231
4231
  this._session.sendRealtimeInput({
4232
4232
  audio: {
4233
4233
  data: Buffer.from(pcm16k).toString("base64"),
@@ -4272,7 +4272,7 @@ var GeminiRealtime = class _GeminiRealtime {
4272
4272
  t.function.parameters ?? { type: "object", properties: {} }
4273
4273
  )
4274
4274
  })) : [];
4275
- const builtinDefs = chunk5ZH3XGLJ_cjs.getBuiltinToolSchemas(this._builtinTools, "gemini");
4275
+ const builtinDefs = chunkPDE4I4MV_cjs.getBuiltinToolSchemas(this._builtinTools, "gemini");
4276
4276
  this._declaredBehavior.clear();
4277
4277
  this._declaredScheduling.clear();
4278
4278
  for (const def of toolDefs) {
@@ -4434,8 +4434,8 @@ var GeminiRealtime = class _GeminiRealtime {
4434
4434
  if (scheduling) resp["scheduling"] = scheduling;
4435
4435
  return resp;
4436
4436
  };
4437
- if (chunk5ZH3XGLJ_cjs.BUILTIN_TOOL_NAMES.has(name) && this._call && !(this._call instanceof chunk5ZH3XGLJ_cjs.BufferingCall)) {
4438
- const result = await chunk5ZH3XGLJ_cjs.executeBuiltinTool(name, args, this._call);
4437
+ if (chunkPDE4I4MV_cjs.BUILTIN_TOOL_NAMES.has(name) && this._call && !(this._call instanceof chunkPDE4I4MV_cjs.BufferingCall)) {
4438
+ const result = await chunkPDE4I4MV_cjs.executeBuiltinTool(name, args, this._call);
4439
4439
  if (result !== null) {
4440
4440
  if (name === "hang_up") {
4441
4441
  this._log.info("hang_up: ending call");
@@ -4445,9 +4445,9 @@ var GeminiRealtime = class _GeminiRealtime {
4445
4445
  return withScheduling({ ...base, response: { result } }, false);
4446
4446
  }
4447
4447
  }
4448
- if (chunk5ZH3XGLJ_cjs.BUILTIN_TOOL_NAMES.has(name) && this._call instanceof chunk5ZH3XGLJ_cjs.BufferingCall) {
4448
+ if (chunkPDE4I4MV_cjs.BUILTIN_TOOL_NAMES.has(name) && this._call instanceof chunkPDE4I4MV_cjs.BufferingCall) {
4449
4449
  this._log.warn("Builtin tool %s called before answer \u2014 deferring", name);
4450
- return withScheduling({ ...base, response: { result: chunk5ZH3XGLJ_cjs.CALL_NOT_READY_RESULT } }, false);
4450
+ return withScheduling({ ...base, response: { result: chunkPDE4I4MV_cjs.CALL_NOT_READY_RESULT } }, false);
4451
4451
  }
4452
4452
  if (!this._tools || !this._tools.has(name)) {
4453
4453
  this._log.error("Unknown tool: %s", name);
@@ -4471,8 +4471,8 @@ var GeminiRealtime = class _GeminiRealtime {
4471
4471
  _handleAudioData(b64Data) {
4472
4472
  if (!this._call) return;
4473
4473
  const pcm24k = Buffer.from(b64Data, "base64");
4474
- const pcm8k = chunk5ZH3XGLJ_cjs.resamplePcm16(pcm24k, 24e3, 8e3);
4475
- const ulaw = chunk5ZH3XGLJ_cjs.pcm16ToUlaw(pcm8k);
4474
+ const pcm8k = chunkPDE4I4MV_cjs.resamplePcm16(pcm24k, 24e3, 8e3);
4475
+ const ulaw = chunkPDE4I4MV_cjs.pcm16ToUlaw(pcm8k);
4476
4476
  const combined = Buffer.concat([this._audioRemainder, ulaw]);
4477
4477
  const chunkSize = 160;
4478
4478
  const fullEnd = Math.floor(combined.length / chunkSize) * chunkSize;
@@ -4516,7 +4516,7 @@ var GeminiRealtime = class _GeminiRealtime {
4516
4516
  const functionCalls = toolCall.functionCalls;
4517
4517
  if (!functionCalls) return;
4518
4518
  const responses = [];
4519
- const player = this._holdAudioChunks && this._call && !(this._call instanceof chunk5ZH3XGLJ_cjs.BufferingCall) && holdAudioAllowed(functionCalls.map((fc) => fc.name ?? "")) ? new HoldAudioPlayer(this._call, this._holdAudioChunks) : null;
4519
+ const player = this._holdAudioChunks && this._call && !(this._call instanceof chunkPDE4I4MV_cjs.BufferingCall) && holdAudioAllowed(functionCalls.map((fc) => fc.name ?? "")) ? new HoldAudioPlayer(this._call, this._holdAudioChunks) : null;
4520
4520
  player?.start();
4521
4521
  try {
4522
4522
  for (const fc of functionCalls) {
@@ -4543,7 +4543,7 @@ var GeminiRealtime = class _GeminiRealtime {
4543
4543
  // src/agent/pipeline/stt/deepgram-stt.ts
4544
4544
  var DeepgramSTT = class {
4545
4545
  _options;
4546
- _log = chunk5ZH3XGLJ_cjs.NOOP_LOGGER;
4546
+ _log = chunkPDE4I4MV_cjs.NOOP_LOGGER;
4547
4547
  get provider() {
4548
4548
  return "deepgram";
4549
4549
  }
@@ -4670,7 +4670,7 @@ var DeepgramSTT = class {
4670
4670
  // src/agent/pipeline/tts/elevenlabs-tts.ts
4671
4671
  var ElevenLabsTTS = class {
4672
4672
  _options;
4673
- _log = chunk5ZH3XGLJ_cjs.NOOP_LOGGER;
4673
+ _log = chunkPDE4I4MV_cjs.NOOP_LOGGER;
4674
4674
  get provider() {
4675
4675
  return "elevenlabs";
4676
4676
  }
@@ -5419,59 +5419,59 @@ clearStaleReadyMarker();
5419
5419
 
5420
5420
  Object.defineProperty(exports, "BUILTIN_TOOL_NAMES", {
5421
5421
  enumerable: true,
5422
- get: function () { return chunk5ZH3XGLJ_cjs.BUILTIN_TOOL_NAMES; }
5422
+ get: function () { return chunkPDE4I4MV_cjs.BUILTIN_TOOL_NAMES; }
5423
5423
  });
5424
5424
  Object.defineProperty(exports, "BuiltinTool", {
5425
5425
  enumerable: true,
5426
- get: function () { return chunk5ZH3XGLJ_cjs.BuiltinTool; }
5426
+ get: function () { return chunkPDE4I4MV_cjs.BuiltinTool; }
5427
5427
  });
5428
5428
  Object.defineProperty(exports, "CallSession", {
5429
5429
  enumerable: true,
5430
- get: function () { return chunk5ZH3XGLJ_cjs.CallSession; }
5430
+ get: function () { return chunkPDE4I4MV_cjs.CallSession; }
5431
5431
  });
5432
5432
  Object.defineProperty(exports, "DECODE_TABLE", {
5433
5433
  enumerable: true,
5434
- get: function () { return chunk5ZH3XGLJ_cjs.DECODE_TABLE; }
5434
+ get: function () { return chunkPDE4I4MV_cjs.DECODE_TABLE; }
5435
5435
  });
5436
5436
  Object.defineProperty(exports, "DtmfCollectorBusyError", {
5437
5437
  enumerable: true,
5438
- get: function () { return chunk5ZH3XGLJ_cjs.DtmfCollectorBusyError; }
5438
+ get: function () { return chunkPDE4I4MV_cjs.DtmfCollectorBusyError; }
5439
5439
  });
5440
5440
  Object.defineProperty(exports, "MediaProfile", {
5441
5441
  enumerable: true,
5442
- get: function () { return chunk5ZH3XGLJ_cjs.MediaProfile; }
5442
+ get: function () { return chunkPDE4I4MV_cjs.MediaProfile; }
5443
5443
  });
5444
5444
  Object.defineProperty(exports, "createAgentLogger", {
5445
5445
  enumerable: true,
5446
- get: function () { return chunk5ZH3XGLJ_cjs.createAgentLogger; }
5446
+ get: function () { return chunkPDE4I4MV_cjs.createAgentLogger; }
5447
5447
  });
5448
5448
  Object.defineProperty(exports, "createPipelineLogger", {
5449
5449
  enumerable: true,
5450
- get: function () { return chunk5ZH3XGLJ_cjs.createPipelineLogger; }
5450
+ get: function () { return chunkPDE4I4MV_cjs.createPipelineLogger; }
5451
5451
  });
5452
5452
  Object.defineProperty(exports, "executeBuiltinTool", {
5453
5453
  enumerable: true,
5454
- get: function () { return chunk5ZH3XGLJ_cjs.executeBuiltinTool; }
5454
+ get: function () { return chunkPDE4I4MV_cjs.executeBuiltinTool; }
5455
5455
  });
5456
5456
  Object.defineProperty(exports, "getBuiltinToolSchemas", {
5457
5457
  enumerable: true,
5458
- get: function () { return chunk5ZH3XGLJ_cjs.getBuiltinToolSchemas; }
5458
+ get: function () { return chunkPDE4I4MV_cjs.getBuiltinToolSchemas; }
5459
5459
  });
5460
5460
  Object.defineProperty(exports, "isBuiltinTool", {
5461
5461
  enumerable: true,
5462
- get: function () { return chunk5ZH3XGLJ_cjs.isBuiltinTool; }
5462
+ get: function () { return chunkPDE4I4MV_cjs.isBuiltinTool; }
5463
5463
  });
5464
5464
  Object.defineProperty(exports, "pcm16ToUlaw", {
5465
5465
  enumerable: true,
5466
- get: function () { return chunk5ZH3XGLJ_cjs.pcm16ToUlaw; }
5466
+ get: function () { return chunkPDE4I4MV_cjs.pcm16ToUlaw; }
5467
5467
  });
5468
5468
  Object.defineProperty(exports, "resamplePcm16", {
5469
5469
  enumerable: true,
5470
- get: function () { return chunk5ZH3XGLJ_cjs.resamplePcm16; }
5470
+ get: function () { return chunkPDE4I4MV_cjs.resamplePcm16; }
5471
5471
  });
5472
5472
  Object.defineProperty(exports, "ulawToPcm16", {
5473
5473
  enumerable: true,
5474
- get: function () { return chunk5ZH3XGLJ_cjs.ulawToPcm16; }
5474
+ get: function () { return chunkPDE4I4MV_cjs.ulawToPcm16; }
5475
5475
  });
5476
5476
  exports.AnthropicLLM = AnthropicLLM;
5477
5477
  exports.AudioRecorder = AudioRecorder;
@@ -1,8 +1,8 @@
1
1
  import { DEFAULT_BASE_URL } from '../chunk-35XJNMFU.js';
2
2
  import { AgentConnectionError, AgentAuthRejectedError, AgentError } from '../chunk-T4ZQXFTN.js';
3
- import { NOOP_LOGGER, mediaContract, validateMediaFormat, buildTransferPayload, resolveBuiltinTools, createAgentLogger, createPipelineLogger, getSdkInfo, CallSession, BufferingCall, attachBuffered, ulawToPcm16, resamplePcm16, getBuiltinToolSchemas, BUILTIN_TOOL_NAMES, executeBuiltinTool, CALL_NOT_READY_RESULT, pcm16ToUlaw, applyUlawGain } from '../chunk-DO6A7FLM.js';
4
- export { BUILTIN_TOOL_NAMES, BuiltinTool, CallSession, DECODE_TABLE, DtmfCollectorBusyError, MediaProfile, createAgentLogger, createPipelineLogger, executeBuiltinTool, getBuiltinToolSchemas, isBuiltinTool, pcm16ToUlaw, resamplePcm16, ulawToPcm16 } from '../chunk-DO6A7FLM.js';
5
- import '../chunk-3QH5DUA2.js';
3
+ import { NOOP_LOGGER, mediaContract, validateMediaFormat, buildTransferPayload, resolveBuiltinTools, createAgentLogger, createPipelineLogger, getSdkInfo, CallSession, BufferingCall, attachBuffered, ulawToPcm16, resamplePcm16, getBuiltinToolSchemas, BUILTIN_TOOL_NAMES, executeBuiltinTool, CALL_NOT_READY_RESULT, pcm16ToUlaw, applyUlawGain } from '../chunk-ZFBHUDJB.js';
4
+ export { BUILTIN_TOOL_NAMES, BuiltinTool, CallSession, DECODE_TABLE, DtmfCollectorBusyError, MediaProfile, createAgentLogger, createPipelineLogger, executeBuiltinTool, getBuiltinToolSchemas, isBuiltinTool, pcm16ToUlaw, resamplePcm16, ulawToPcm16 } from '../chunk-ZFBHUDJB.js';
5
+ import '../chunk-I7N2GTBL.js';
6
6
  import * as path from 'path';
7
7
  import { basename } from 'path';
8
8
  import * as fs from 'fs';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunk5ZH3XGLJ_cjs = require('../../chunk-5ZH3XGLJ.cjs');
4
- require('../../chunk-LPQFS6AS.cjs');
3
+ var chunkPDE4I4MV_cjs = require('../../chunk-PDE4I4MV.cjs');
4
+ require('../../chunk-TCIIGMEU.cjs');
5
5
 
6
6
  // src/agent/livekit/io.ts
7
7
  var SAMPLE_RATE = 8e3;
@@ -41,7 +41,7 @@ async function loadClawOpsIO() {
41
41
  class ClawOpsAudioInput {
42
42
  constructor(profile = "mulaw_8000" /* MULAW_8000 */) {
43
43
  this.profile = profile;
44
- this._profile = chunk5ZH3XGLJ_cjs.mediaContract(profile);
44
+ this._profile = chunkPDE4I4MV_cjs.mediaContract(profile);
45
45
  this._stream = new ReadableStream({
46
46
  start: (c) => {
47
47
  this._controller = c;
@@ -71,7 +71,7 @@ async function loadClawOpsIO() {
71
71
  const ulaw = audio;
72
72
  const samples = new Int16Array(this.profile === "mulaw_8000" /* MULAW_8000 */ ? ulaw.length : ulaw.length / 2);
73
73
  for (let i = 0; i < samples.length; i++) {
74
- samples[i] = this.profile === "mulaw_8000" /* MULAW_8000 */ ? chunk5ZH3XGLJ_cjs.DECODE_TABLE[ulaw[i]] : ulaw.readInt16LE(i * 2);
74
+ samples[i] = this.profile === "mulaw_8000" /* MULAW_8000 */ ? chunkPDE4I4MV_cjs.DECODE_TABLE[ulaw[i]] : ulaw.readInt16LE(i * 2);
75
75
  }
76
76
  const frame = new AudioFrame(samples, this._profile.sampleRate, 1, samples.length);
77
77
  try {
@@ -101,9 +101,9 @@ async function loadClawOpsIO() {
101
101
  }
102
102
  class ClawOpsAudioOutput extends AudioOutputBase {
103
103
  constructor(call, profile = "mulaw_8000" /* MULAW_8000 */) {
104
- super(chunk5ZH3XGLJ_cjs.mediaContract(profile).sampleRate, void 0, { pause: false });
104
+ super(chunkPDE4I4MV_cjs.mediaContract(profile).sampleRate, void 0, { pause: false });
105
105
  this.profile = profile;
106
- this._profile = chunk5ZH3XGLJ_cjs.mediaContract(profile);
106
+ this._profile = chunkPDE4I4MV_cjs.mediaContract(profile);
107
107
  this._call = call;
108
108
  }
109
109
  _call;
@@ -146,7 +146,7 @@ async function loadClawOpsIO() {
146
146
  }
147
147
  this._pushedDurationMs += frame.samplesPerChannel / frame.sampleRate * 1e3;
148
148
  const pcm = Buffer.from(frame.data.buffer, frame.data.byteOffset, frame.data.byteLength);
149
- const encoded = this.profile === "mulaw_8000" /* MULAW_8000 */ ? chunk5ZH3XGLJ_cjs.pcm16ToUlaw(pcm) : Buffer.alloc(frame.data.length * 2);
149
+ const encoded = this.profile === "mulaw_8000" /* MULAW_8000 */ ? chunkPDE4I4MV_cjs.pcm16ToUlaw(pcm) : Buffer.alloc(frame.data.length * 2);
150
150
  if (this.profile === "pcm_s16le_16000" /* PCM_S16LE_16000 */) {
151
151
  for (let i = 0; i < frame.data.length; i++) encoded.writeInt16LE(frame.data[i], i * 2);
152
152
  }
@@ -338,7 +338,7 @@ async function transferAndWait(args, call, ctx) {
338
338
  const allowedBefore = speech?.allowInterruptions;
339
339
  if (speech) ctx.disallowInterruptions?.();
340
340
  try {
341
- const transfer = call.transfer(args["to"], chunk5ZH3XGLJ_cjs.transferOptionsFromArgs(args));
341
+ const transfer = call.transfer(args["to"], chunkPDE4I4MV_cjs.transferOptionsFromArgs(args));
342
342
  const lost = call._transferConnectionLost?.();
343
343
  try {
344
344
  return await waitForTransferResult(transfer, lost?.promise);
@@ -396,7 +396,7 @@ function createClawOpsPhoneTools(llm, options) {
396
396
  };
397
397
  const exclude = options.excludeNames ?? /* @__PURE__ */ new Set();
398
398
  const ignoreFlag = llm.ToolFlag?.IGNORE_ON_ENTER;
399
- const schemas = chunk5ZH3XGLJ_cjs.getBuiltinToolSchemas(options.enabled, "chat");
399
+ const schemas = chunkPDE4I4MV_cjs.getBuiltinToolSchemas(options.enabled, "chat");
400
400
  const tools = [];
401
401
  for (const schema of schemas) {
402
402
  const { name, description, parameters } = schema.function;
@@ -421,7 +421,7 @@ function createClawOpsPhoneTools(llm, options) {
421
421
  if (name === "hang_up") {
422
422
  return hangUp(requireCall(), opts?.ctx);
423
423
  }
424
- return await chunk5ZH3XGLJ_cjs.executeBuiltinTool(name, args ?? {}, requireCall()) ?? "";
424
+ return await chunkPDE4I4MV_cjs.executeBuiltinTool(name, args ?? {}, requireCall()) ?? "";
425
425
  }
426
426
  })
427
427
  );
@@ -443,7 +443,7 @@ function createClawOpsPhoneTools(llm, options) {
443
443
  var LiveKitSession = class {
444
444
  constructor(create, options = {}) {
445
445
  this.options = options;
446
- chunk5ZH3XGLJ_cjs.mediaContract(options.mediaProfile ?? "mulaw_8000" /* MULAW_8000 */);
446
+ chunkPDE4I4MV_cjs.mediaContract(options.mediaProfile ?? "mulaw_8000" /* MULAW_8000 */);
447
447
  this._create = create;
448
448
  }
449
449
  _create;
@@ -460,7 +460,7 @@ var LiveKitSession = class {
460
460
  _userToolCtx = null;
461
461
  _toolRegistry = null;
462
462
  _builtinTools = null;
463
- _log = chunk5ZH3XGLJ_cjs.NOOP_LOGGER;
463
+ _log = chunkPDE4I4MV_cjs.NOOP_LOGGER;
464
464
  // 동적 로드한 agents-js 네임스페이스 (boot 시 캐시).
465
465
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
466
466
  _llm = null;
@@ -496,7 +496,7 @@ var LiveKitSession = class {
496
496
  this._output.setCall(callSession);
497
497
  this._target = callSession;
498
498
  await this._applyTools(callSession);
499
- chunk5ZH3XGLJ_cjs.attachBuffered(prev, callSession);
499
+ chunkPDE4I4MV_cjs.attachBuffered(prev, callSession);
500
500
  }
501
501
  feedAudio(audio, _timestamp) {
502
502
  this._input?.pushAudio(audio);
@@ -523,7 +523,7 @@ var LiveKitSession = class {
523
523
  this._llm = agents.llm;
524
524
  this._StopResponse = agents.voice?.StopResponse;
525
525
  const { ClawOpsAudioInput, ClawOpsAudioOutput } = io;
526
- const target = call ?? new chunk5ZH3XGLJ_cjs.BufferingCall();
526
+ const target = call ?? new chunkPDE4I4MV_cjs.BufferingCall();
527
527
  const [session, agent] = await this._create(call);
528
528
  this._validate(session, agent);
529
529
  const input = new ClawOpsAudioInput(this.options.mediaProfile);