@openclaw/voice-call 2026.8.2 → 2026.9.1

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,8 +1,9 @@
1
- import { T as REALTIME_VOICE_END_CALL_TOOL_NAME, o as canonicalizeVoiceCallMediaBase64, x as resolveVoiceCallPublicPathPrefix } from "./runtime-entry-CJkbbEgg.js";
1
+ import { d as REALTIME_VOICE_END_CALL_TOOL_NAME, s as resolveVoiceCallPublicPathPrefix } from "./config-DQwvsxeV.js";
2
+ import { o as canonicalizeVoiceCallMediaBase64 } from "./runtime-entry-gE2Yd4V8.js";
2
3
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
3
4
  import { asNullableRecord, asOptionalObjectRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
4
5
  import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
5
- import { REALTIME_VOICE_AGENT_CONSULT_TOOL_NAME, REALTIME_VOICE_AUDIO_FORMAT_G711_ULAW_8KHZ, buildRealtimeVoiceAgentConsultWorkingResponse, calculateMulawRms, createRealtimeVoiceSessionHarness, createSpeechThresholdGate, readRealtimeVoiceConsultQuestion, readSpeakableRealtimeVoiceToolResult } from "openclaw/plugin-sdk/realtime-voice";
6
+ import { REALTIME_VOICE_AGENT_CONSULT_TOOL_NAME, REALTIME_VOICE_AUDIO_FORMAT_G711_ULAW_8KHZ, buildRealtimeVoiceAgentConsultWorkingResponse, buildRealtimeVoiceAgentErrorProviderResult, calculateMulawRms, createRealtimeVoiceSessionHarness, createSpeechThresholdGate, readRealtimeVoiceConsultQuestion, readSpeakableRealtimeVoiceToolResult } from "openclaw/plugin-sdk/realtime-voice";
6
7
  import { normalizeWebhookPath } from "openclaw/plugin-sdk/webhook-ingress";
7
8
  import { isFutureDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
8
9
  import { randomUUID } from "node:crypto";
@@ -1396,7 +1397,11 @@ var RealtimeCallHandler = class {
1396
1397
  console.log(`[voice-call] realtime forced agent consult completed callId=${params.callId} providerCallId=${params.callSid} elapsedMs=${Date.now() - startedAt}`);
1397
1398
  this.consumePartialUserTranscript(params.callId, params.userTranscriptOwner, params.handle.question);
1398
1399
  } catch (error) {
1399
- if (!state.cancelled) console.warn(`[voice-call] realtime forced agent consult failed callId=${params.callId} providerCallId=${params.callSid} error=${formatErrorMessage(error)}`);
1400
+ if (!state.cancelled) {
1401
+ const result = buildRealtimeVoiceAgentErrorProviderResult(error);
1402
+ const failed = "error" in result;
1403
+ (failed ? console.warn : console.log)(`[voice-call] realtime forced agent consult ${failed ? "failed" : "cancelled"} callId=${params.callId} providerCallId=${params.callSid}${failed ? ` error=${result.error}` : ""}`);
1404
+ }
1400
1405
  } finally {
1401
1406
  if (!state.cancelled) {
1402
1407
  if (this.forcedConsultsByCallId.get(params.callId) !== state) coordinator.remove(params.handle);
@@ -1497,7 +1502,7 @@ var RealtimeCallHandler = class {
1497
1502
  const handler = this.toolHandlers.get(name);
1498
1503
  const startedAt = Date.now();
1499
1504
  const hasResultError = (result) => {
1500
- return Boolean(result && typeof result === "object" && !Array.isArray(result) && "error" in result);
1505
+ return result !== null && typeof result === "object" && !Array.isArray(result) && "error" in result;
1501
1506
  };
1502
1507
  const emitFinalToolEvent = (result) => {
1503
1508
  harness.emit({
@@ -1556,7 +1561,7 @@ var RealtimeCallHandler = class {
1556
1561
  return;
1557
1562
  }
1558
1563
  forcedConsult.sendSpeechPrompt = false;
1559
- const result = await forcedConsult.promise.catch((error) => ({ error: formatErrorMessage(error) }));
1564
+ const result = await forcedConsult.promise.catch(buildRealtimeVoiceAgentErrorProviderResult);
1560
1565
  if (forcedConsult.cancelled || forcedConsult.owner !== bridge || this.forcedConsultsByCallId.get(callId) !== forcedConsult) return;
1561
1566
  await submitFinalToolResult(result);
1562
1567
  return;
@@ -1605,18 +1610,18 @@ var RealtimeCallHandler = class {
1605
1610
  console.log(`[voice-call] realtime tool call executing callId=${callId} tool=${name} hasHandler=${Boolean(handler)}`);
1606
1611
  return !handler ? { error: `Tool "${name}" not available` } : await handler(handlerArgs, callId, context);
1607
1612
  } catch (error) {
1608
- return { error: formatErrorMessage(error) };
1613
+ return buildRealtimeVoiceAgentErrorProviderResult(error);
1609
1614
  }
1610
1615
  })().then(completeConsult);
1611
1616
  try {
1612
1617
  const outcome = await waitForNativeConsult(state);
1613
1618
  if (outcome.kind === "cancelled") return;
1614
1619
  const result = outcome.result;
1615
- const status = result && typeof result === "object" && !Array.isArray(result) && "error" in result ? "error" : "ok";
1616
- const error = status === "error" && result && typeof result === "object" && !Array.isArray(result) ? formatErrorMessage(result.error ?? "unknown") : void 0;
1617
- console.log(`[voice-call] realtime tool call completed callId=${callId} tool=${name} status=${status} elapsedMs=${Date.now() - startedAt}${error ? ` error=${error}` : ""}`);
1620
+ const failed = hasResultError(result);
1621
+ const error = failed ? formatErrorMessage(result.error ?? "unknown") : void 0;
1622
+ console.log(`[voice-call] realtime tool call completed callId=${callId} tool=${name} status=${failed ? "error" : "ok"} elapsedMs=${Date.now() - startedAt}${error ? ` error=${error}` : ""}`);
1618
1623
  await submitFinalToolResult(result);
1619
- if (status === "ok") this.consumePartialUserTranscript(callId, userTranscriptOwner, state.partialUserTranscript);
1624
+ if (!failed) this.consumePartialUserTranscript(callId, userTranscriptOwner, state.partialUserTranscript);
1620
1625
  } finally {
1621
1626
  if (this.nativeConsultsInFlightByCallId.get(callId) === state) this.nativeConsultsInFlightByCallId.delete(callId);
1622
1627
  }
@@ -1624,13 +1629,15 @@ var RealtimeCallHandler = class {
1624
1629
  }
1625
1630
  console.log(`[voice-call] realtime tool call executing callId=${callId} tool=${name} hasHandler=${Boolean(handler)}`);
1626
1631
  const context = { partialUserTranscript: this.resolveUserTranscriptContext(callId, userTranscriptOwner) };
1627
- const handlerArgs = name === REALTIME_VOICE_AGENT_CONSULT_TOOL_NAME ? withFallbackConsultQuestion(args, context.partialUserTranscript) : args;
1628
- const result = !handler ? { error: `Tool "${name}" not available` } : await handler(handlerArgs, callId, context).catch((error) => ({ error: formatErrorMessage(error) }));
1629
- const status = result && typeof result === "object" && !Array.isArray(result) && "error" in result ? "error" : "ok";
1630
- const error = status === "error" && result && typeof result === "object" && !Array.isArray(result) ? formatErrorMessage(result.error ?? "unknown") : void 0;
1631
- console.log(`[voice-call] realtime tool call completed callId=${callId} tool=${name} status=${status} elapsedMs=${Date.now() - startedAt}${error ? ` error=${error}` : ""}`);
1632
+ let result;
1633
+ try {
1634
+ result = !handler ? { error: `Tool "${name}" not available` } : await handler(args, callId, context);
1635
+ } catch (error) {
1636
+ result = buildRealtimeVoiceAgentErrorProviderResult(error);
1637
+ }
1638
+ const error = hasResultError(result) ? formatErrorMessage(result.error ?? "unknown") : void 0;
1639
+ console.log(`[voice-call] realtime tool call completed callId=${callId} tool=${name} status=${error === void 0 ? "ok" : "error"} elapsedMs=${Date.now() - startedAt}${error ? ` error=${error}` : ""}`);
1632
1640
  await submitFinalToolResult(result);
1633
- if (name === REALTIME_VOICE_AGENT_CONSULT_TOOL_NAME && status === "ok") this.consumePartialUserTranscript(callId, userTranscriptOwner, context.partialUserTranscript);
1634
1641
  }
1635
1642
  };
1636
1643
  //#endregion
@@ -1,4 +1,5 @@
1
- import { S as resolveVoiceCallSessionKey, h as resolveCallAgentId, m as resolveVoiceResponseModel } from "./runtime-entry-CJkbbEgg.js";
1
+ import { c as resolveVoiceCallSessionKey } from "./config-DQwvsxeV.js";
2
+ import { h as resolveCallAgentId, m as resolveVoiceResponseModel } from "./runtime-entry-gE2Yd4V8.js";
2
3
  import { filterStringEntries, isRecord, normalizeLowercaseStringOrEmpty, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
3
4
  import { resolveAgentConfig } from "openclaw/plugin-sdk/agent-scope-runtime";
4
5
  import crypto from "node:crypto";
@@ -1,6 +1,6 @@
1
1
  import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
2
- import { isRequestBodyLimitError, readRequestBodyWithLimit, requestBodyErrorToText } from "openclaw/plugin-sdk/webhook-request-guards";
2
+ import { isRequestBodyLimitError, readRequestBodyWithLimit, requestBodyErrorToText, sendHttpRequestRejection } from "openclaw/plugin-sdk/webhook-request-guards";
3
3
  import { fetchWithSsrFGuard, isBlockedHostnameOrIp } from "openclaw/plugin-sdk/ssrf-runtime";
4
4
  import { TtsAutoSchema, TtsConfigSchema, TtsModeSchema, TtsProviderSchema } from "openclaw/plugin-sdk/tts-runtime";
5
5
  import { sleep } from "openclaw/plugin-sdk/runtime-env";
6
- export { TtsAutoSchema, TtsConfigSchema, TtsModeSchema, TtsProviderSchema, definePluginEntry, fetchWithSsrFGuard, isBlockedHostnameOrIp, isRequestBodyLimitError, readRequestBodyWithLimit, requestBodyErrorToText, sleep };
6
+ export { TtsAutoSchema, TtsConfigSchema, TtsModeSchema, TtsProviderSchema, definePluginEntry, fetchWithSsrFGuard, isBlockedHostnameOrIp, isRequestBodyLimitError, readRequestBodyWithLimit, requestBodyErrorToText, sendHttpRequestRejection, sleep };