@openclaw/voice-call 2026.9.6 → 2026.9.7

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.
Files changed (62) hide show
  1. package/assets/icon.png +0 -0
  2. package/dist/.setup/{cli-D6j7ppuN.mjs → cli-D6uwMXyS.mjs} +6 -10
  3. package/dist/.setup/{config-72FnMWHb.mjs → config-Ds7xoZbI.mjs} +27 -30
  4. package/dist/.setup/{guarded-json-api-exU4Hutw.mjs → guarded-json-api-Bqc6QS8A.mjs} +23 -17
  5. package/dist/.setup/{mock-CcYEAUhV.mjs → mock-ClWW6Ufu.mjs} +34 -53
  6. package/dist/.setup/{plivo-BGJda1Uz.mjs → plivo-69ObrQPk.mjs} +17 -42
  7. package/dist/.setup/realtime-agent-context.legacy-DAEWY27o.mjs +53 -0
  8. package/dist/.setup/{realtime-handler-DlFmdSPn.mjs → realtime-handler-BgDPcPZt.mjs} +34 -53
  9. package/dist/.setup/{response-generator-hZyGIjO4.mjs → response-generator-BzKrJMEb.mjs} +2 -2
  10. package/dist/.setup/{runtime-entry-dDRm6RgA.mjs → runtime-entry-BNOQRXii.mjs} +82 -297
  11. package/dist/.setup/{telnyx-BV56PXr-.mjs → telnyx-DjFGCfy1.mjs} +19 -55
  12. package/dist/.setup/{twilio-BMb-7cu-.mjs → twilio-Bp3gfmUB.mjs} +29 -78
  13. package/dist/.setup/{store-path-B1j1up4_.mjs → utils-B5pnM_Ij.mjs} +14 -6
  14. package/dist/api.js +5 -1
  15. package/dist/doctor-contract-api.js +186 -15
  16. package/dist/index.js +6 -42
  17. package/dist/runtime-entry.js +1 -1
  18. package/node_modules/typebox/build/compile/code.mjs +1 -2
  19. package/node_modules/typebox/build/compile/validator.mjs +5 -1
  20. package/node_modules/typebox/build/format/iri.mjs +16 -9
  21. package/node_modules/typebox/build/guard/emit.mjs +2 -2
  22. package/node_modules/typebox/build/guard/guard.d.mts +7 -5
  23. package/node_modules/typebox/build/guard/guard.mjs +14 -9
  24. package/node_modules/typebox/build/guard/index.mjs +6 -0
  25. package/node_modules/typebox/build/guard/unicode/unicode.d.mts +6 -0
  26. package/node_modules/typebox/build/guard/unicode/unicode.mjs +35 -0
  27. package/node_modules/typebox/build/guard/{string.mjs → unicode/unicode_segment.mjs} +16 -19
  28. package/node_modules/typebox/build/schema/build.mjs +2 -3
  29. package/node_modules/typebox/build/schema/engine/_pathing.d.mts +1 -0
  30. package/node_modules/typebox/build/schema/engine/_pathing.mjs +11 -0
  31. package/node_modules/typebox/build/schema/engine/_refine.mjs +13 -5
  32. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +2 -1
  33. package/node_modules/typebox/build/schema/engine/dependencies.mjs +2 -1
  34. package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +2 -1
  35. package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +1 -1
  36. package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +2 -2
  37. package/node_modules/typebox/build/schema/engine/format.mjs +9 -2
  38. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +3 -2
  39. package/node_modules/typebox/build/schema/engine/properties.mjs +3 -2
  40. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -1
  41. package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +1 -1
  42. package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +2 -2
  43. package/node_modules/typebox/build/schema/engine/ref.d.mts +1 -1
  44. package/node_modules/typebox/build/schema/engine/ref.mjs +2 -2
  45. package/node_modules/typebox/build/schema/engine/schema.mjs +24 -24
  46. package/node_modules/typebox/build/schema/parse.mjs +3 -0
  47. package/node_modules/typebox/build/schema/pointer/pointer.d.mts +1 -6
  48. package/node_modules/typebox/build/schema/pointer/pointer.mjs +47 -64
  49. package/node_modules/typebox/build/system/settings/internal.d.mts +2 -0
  50. package/node_modules/typebox/build/system/settings/internal.mjs +20 -0
  51. package/node_modules/typebox/build/system/settings/settings.d.mts +11 -0
  52. package/node_modules/typebox/build/system/settings/settings.mjs +14 -0
  53. package/node_modules/typebox/build/type/extends/inference.d.mts +1 -1
  54. package/node_modules/typebox/build/type/extends/inference.mjs +15 -2
  55. package/node_modules/typebox/build/type/extends/tuple.d.mts +2 -1
  56. package/node_modules/typebox/build/type/extends/tuple.mjs +21 -1
  57. package/node_modules/typebox/build/value/parse/parse.mjs +10 -4
  58. package/node_modules/typebox/package.json +1 -1
  59. package/node_modules/typebox/readme.md +3 -1
  60. package/package.json +5 -5
  61. package/dist/runtime-api.js +0 -6
  62. /package/node_modules/typebox/build/guard/{string.d.mts → unicode/unicode_segment.d.mts} +0 -0
@@ -1,7 +1,7 @@
1
- import { d as REALTIME_VOICE_END_CALL_TOOL_NAME, s as resolveVoiceCallPublicPathPrefix } from "./config-72FnMWHb.mjs";
2
- import { c as canonicalizeVoiceCallMediaBase64, o as WebSocket, s as WebSocketServer } from "./runtime-entry-dDRm6RgA.mjs";
1
+ import { d as REALTIME_VOICE_END_CALL_TOOL_NAME, s as resolveVoiceCallPublicPathPrefix } from "./config-Ds7xoZbI.mjs";
2
+ import { c as canonicalizeVoiceCallMediaBase64, o as WebSocket, s as WebSocketServer } from "./runtime-entry-BNOQRXii.mjs";
3
3
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
4
- import { asNullableRecord, asOptionalObjectRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
4
+ import { asNullableRecord, asOptionalObjectRecord, asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  import { createSubsystemLogger } from "openclaw/plugin-sdk/runtime-env";
6
6
  import { REALTIME_VOICE_AGENT_CONSULT_TOOL_NAME, REALTIME_VOICE_AUDIO_FORMAT_G711_ULAW_8KHZ, buildRealtimeVoiceAgentConsultWorkingResponse, buildRealtimeVoiceAgentErrorProviderResult, calculateMulawRms, createRealtimeVoiceSessionHarness, createSpeechThresholdGate, readRealtimeVoiceConsultQuestion, readSpeakableRealtimeVoiceToolResult, resolveRealtimeVoiceBargeIn, resolveRealtimeVoiceSessionPolicy } from "openclaw/plugin-sdk/realtime-voice";
7
7
  import { normalizeWebhookPath } from "openclaw/plugin-sdk/webhook-ingress";
@@ -266,13 +266,9 @@ function tryParseJson(rawMessage) {
266
266
  } catch {}
267
267
  return null;
268
268
  }
269
- /** Read an object-valued field from a parsed frame. */
270
- function readRecordField(record, field) {
271
- return asOptionalObjectRecord(record[field]);
272
- }
273
269
  /** Parse a common provider media frame. */
274
270
  function parseMediaFrame(msg) {
275
- const mediaData = readRecordField(msg, "media");
271
+ const mediaData = asOptionalObjectRecord(msg.media);
276
272
  const payload = typeof mediaData?.payload === "string" ? mediaData.payload : void 0;
277
273
  const canonicalPayload = payload ? canonicalizeVoiceCallMediaBase64(payload) : void 0;
278
274
  if (!canonicalPayload) return { kind: "ignored" };
@@ -285,35 +281,30 @@ function parseMediaFrame(msg) {
285
281
  }
286
282
  /** Parse a common provider mark frame. */
287
283
  function parseMarkFrame(msg) {
288
- const markData = readRecordField(msg, "mark");
284
+ const markData = asOptionalObjectRecord(msg.mark);
289
285
  return {
290
286
  kind: "mark",
291
287
  name: typeof markData?.name === "string" ? markData.name : void 0
292
288
  };
293
289
  }
294
- /** Parse common media, mark, and stop frames shared by supported providers. */
295
- function parseCommonInboundFrame(event, msg) {
296
- if (event === "media") return parseMediaFrame(msg);
297
- if (event === "mark") return parseMarkFrame(msg);
298
- if (event === "stop") return { kind: "stop" };
299
- }
300
290
  /** Parse one provider frame with provider-specific start/error hooks. */
301
291
  function parseProviderInboundFrame(rawMessage, parseStartFrame, parseExtraFrame) {
302
292
  const msg = tryParseJson(rawMessage);
303
293
  if (!msg) return { kind: "ignored" };
304
294
  const event = msg.event;
305
- if (event === "start") return parseStartFrame(msg) ?? { kind: "ignored" };
306
- return parseCommonInboundFrame(event, msg) ?? parseExtraFrame?.(event, msg) ?? { kind: "ignored" };
307
- }
308
- /** Include streamSid only when Twilio has already supplied one. */
309
- function withOptionalStreamSid(streamSid) {
310
- return streamSid === void 0 ? {} : { streamSid };
295
+ switch (event) {
296
+ case "start": return parseStartFrame(msg) ?? { kind: "ignored" };
297
+ case "media": return parseMediaFrame(msg);
298
+ case "mark": return parseMarkFrame(msg);
299
+ case "stop": return { kind: "stop" };
300
+ default: return parseExtraFrame?.(event, msg) ?? { kind: "ignored" };
301
+ }
311
302
  }
312
303
  /** Serialize a provider media frame. */
313
304
  function serializeMediaFrame(payloadBase64, streamSid) {
314
305
  return JSON.stringify({
315
306
  event: "media",
316
- ...withOptionalStreamSid(streamSid),
307
+ streamSid,
317
308
  media: { payload: payloadBase64 }
318
309
  });
319
310
  }
@@ -321,14 +312,14 @@ function serializeMediaFrame(payloadBase64, streamSid) {
321
312
  function serializeClearFrame(streamSid) {
322
313
  return JSON.stringify({
323
314
  event: "clear",
324
- ...withOptionalStreamSid(streamSid)
315
+ streamSid
325
316
  });
326
317
  }
327
318
  /** Serialize a provider mark frame. */
328
319
  function serializeMarkFrame(name, streamSid) {
329
320
  return JSON.stringify({
330
321
  event: "mark",
331
- ...withOptionalStreamSid(streamSid),
322
+ streamSid,
332
323
  mark: { name }
333
324
  });
334
325
  }
@@ -341,7 +332,7 @@ var TwilioStreamFrameAdapter = class {
341
332
  /** Parse one Twilio websocket message into a normalized frame. */
342
333
  parseInbound(rawMessage) {
343
334
  return parseProviderInboundFrame(rawMessage, (msg) => {
344
- const startData = readRecordField(msg, "start");
335
+ const startData = asOptionalObjectRecord(msg.start);
345
336
  const streamSid = typeof startData?.streamSid === "string" ? startData.streamSid : "";
346
337
  const callSid = typeof startData?.callSid === "string" ? startData.callSid : "";
347
338
  if (!streamSid || !callSid) return;
@@ -375,7 +366,7 @@ var TelnyxStreamFrameAdapter = class {
375
366
  parseInbound(rawMessage) {
376
367
  return parseProviderInboundFrame(rawMessage, (msg) => {
377
368
  const topLevelStreamId = typeof msg.stream_id === "string" && msg.stream_id ? msg.stream_id : void 0;
378
- const startData = readRecordField(msg, "start");
369
+ const startData = asOptionalObjectRecord(msg.start);
379
370
  const providerCallId = typeof startData?.call_control_id === "string" && startData.call_control_id ? startData.call_control_id : void 0;
380
371
  if (!topLevelStreamId || !providerCallId) return;
381
372
  return {
@@ -385,7 +376,7 @@ var TelnyxStreamFrameAdapter = class {
385
376
  };
386
377
  }, (event, msg) => {
387
378
  if (event !== "error") return;
388
- const errorData = readRecordField(msg, "payload");
379
+ const errorData = asOptionalObjectRecord(msg.payload);
389
380
  return {
390
381
  kind: "error",
391
382
  code: typeof errorData?.code === "string" || typeof errorData?.code === "number" ? String(errorData.code) : void 0,
@@ -431,14 +422,6 @@ function buildGreetingInstructions(baseInstructions, greeting) {
431
422
  const intro = "Start the call by greeting the caller naturally. Include this greeting in your first spoken reply:";
432
423
  return baseInstructions ? `${baseInstructions}\n\n${intro} "${trimmedGreeting}"` : `${intro} "${trimmedGreeting}"`;
433
424
  }
434
- function readConsultArgText(args, key) {
435
- if (!args || typeof args !== "object" || Array.isArray(args)) return;
436
- const value = args[key];
437
- return typeof value === "string" && value.trim() ? value.trim() : void 0;
438
- }
439
- function readConsultQuestionText(args) {
440
- return readRealtimeVoiceConsultQuestion(args);
441
- }
442
425
  function normalizeTranscriptText(text) {
443
426
  return text.replace(/\s+/g, " ").trim();
444
427
  }
@@ -487,11 +470,11 @@ function limitPartialUserTranscript(text) {
487
470
  return tail.replace(/^\S+\s+/, "").trimStart() || tail.trimStart();
488
471
  }
489
472
  function withFallbackConsultQuestion(args, fallback) {
490
- const providerQuestion = readConsultQuestionText(args);
473
+ const providerQuestion = readRealtimeVoiceConsultQuestion(args);
491
474
  const question = fallback?.trim();
492
475
  if (providerQuestion) {
493
476
  if (question && providerQuestion.length <= 40 && question.length >= providerQuestion.length + 8) {
494
- const context = readConsultArgText(args, "context");
477
+ const context = normalizeOptionalString(asOptionalRecord(args)?.context);
495
478
  const fallbackContext = `Realtime provider supplied a shorter consult question: ${providerQuestion}`;
496
479
  return args && typeof args === "object" && !Array.isArray(args) ? {
497
480
  ...args,
@@ -1702,25 +1685,23 @@ var RealtimeCallHandler = class {
1702
1685
  ...callerMeta.from ? { from: callerMeta.from } : {},
1703
1686
  ...callerMeta.to ? { to: callerMeta.to } : {}
1704
1687
  };
1705
- const callRecord = await this.resolveRealtimeCall(callSid, callerMeta, baseFields);
1706
- if (!callRecord) return null;
1707
- return {
1708
- callRecord,
1709
- baseFields
1710
- };
1711
- }
1712
- async resolveRealtimeCall(callSid, callerMeta, baseFields) {
1688
+ let callRecord;
1713
1689
  if (callerMeta.callId) {
1714
1690
  const call = await this.manager.getCallForStream(callerMeta.callId);
1715
- return call?.providerCallId === callSid ? call : null;
1691
+ callRecord = call?.providerCallId === callSid ? call : void 0;
1692
+ } else {
1693
+ await this.manager.processEvent({
1694
+ id: `realtime-initiated-${callSid}`,
1695
+ callId: callSid,
1696
+ type: "call.initiated",
1697
+ ...baseFields
1698
+ });
1699
+ callRecord = this.manager.getCallByProviderCallId(callSid);
1716
1700
  }
1717
- await this.manager.processEvent({
1718
- id: `realtime-initiated-${callSid}`,
1719
- callId: callSid,
1720
- type: "call.initiated",
1721
- ...baseFields
1722
- });
1723
- return this.manager.getCallByProviderCallId(callSid) ?? null;
1701
+ return callRecord ? {
1702
+ callRecord,
1703
+ baseFields
1704
+ } : null;
1724
1705
  }
1725
1706
  async executeEndCallTool(params) {
1726
1707
  const binding = this.activeTelephonyBindingsByCallId.get(params.callId);
@@ -1,5 +1,5 @@
1
- import { c as resolveVoiceCallSessionKey } from "./config-72FnMWHb.mjs";
2
- import { _ as resolveCallAgentId, g as resolveVoiceResponseModel } from "./runtime-entry-dDRm6RgA.mjs";
1
+ import { c as resolveVoiceCallSessionKey } from "./config-Ds7xoZbI.mjs";
2
+ import { _ as resolveCallAgentId, g as resolveVoiceResponseModel } from "./runtime-entry-BNOQRXii.mjs";
3
3
  import { filterStringEntries, isRecord, normalizeLowercaseStringOrEmpty, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  import { resolveAgentConfig } from "openclaw/plugin-sdk/agent-scope-runtime";
5
5
  import { isValidAgentHarnessSessionStoreEntry } from "openclaw/plugin-sdk/session-store-runtime";