@openclaw/voice-call 2026.9.6 → 2026.9.8
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/assets/icon.png +0 -0
- package/dist/.setup/{cli-D6j7ppuN.mjs → cli-D6uwMXyS.mjs} +6 -10
- package/dist/.setup/{config-72FnMWHb.mjs → config-Ds7xoZbI.mjs} +27 -30
- package/dist/.setup/{guarded-json-api-exU4Hutw.mjs → guarded-json-api-Bqc6QS8A.mjs} +23 -17
- package/dist/.setup/{mock-CcYEAUhV.mjs → mock-ClWW6Ufu.mjs} +34 -53
- package/dist/.setup/{plivo-BGJda1Uz.mjs → plivo-69ObrQPk.mjs} +17 -42
- package/dist/.setup/realtime-agent-context.legacy-DAEWY27o.mjs +53 -0
- package/dist/.setup/{realtime-handler-DlFmdSPn.mjs → realtime-handler-BgDPcPZt.mjs} +34 -53
- package/dist/.setup/{response-generator-hZyGIjO4.mjs → response-generator-BzKrJMEb.mjs} +2 -2
- package/dist/.setup/{runtime-entry-dDRm6RgA.mjs → runtime-entry-BNOQRXii.mjs} +82 -297
- package/dist/.setup/{telnyx-BV56PXr-.mjs → telnyx-DjFGCfy1.mjs} +19 -55
- package/dist/.setup/{twilio-BMb-7cu-.mjs → twilio-Bp3gfmUB.mjs} +29 -78
- package/dist/.setup/{store-path-B1j1up4_.mjs → utils-B5pnM_Ij.mjs} +14 -6
- package/dist/api.js +5 -1
- package/dist/doctor-contract-api.js +186 -15
- package/dist/index.js +6 -42
- package/dist/runtime-entry.js +1 -1
- package/node_modules/typebox/build/compile/code.mjs +1 -2
- package/node_modules/typebox/build/compile/validator.mjs +5 -1
- package/node_modules/typebox/build/format/iri.mjs +16 -9
- package/node_modules/typebox/build/guard/emit.mjs +2 -2
- package/node_modules/typebox/build/guard/guard.d.mts +7 -5
- package/node_modules/typebox/build/guard/guard.mjs +14 -9
- package/node_modules/typebox/build/guard/index.mjs +6 -0
- package/node_modules/typebox/build/guard/unicode/unicode.d.mts +6 -0
- package/node_modules/typebox/build/guard/unicode/unicode.mjs +35 -0
- package/node_modules/typebox/build/guard/{string.mjs → unicode/unicode_segment.mjs} +16 -19
- package/node_modules/typebox/build/schema/build.mjs +2 -3
- package/node_modules/typebox/build/schema/engine/_pathing.d.mts +1 -0
- package/node_modules/typebox/build/schema/engine/_pathing.mjs +11 -0
- package/node_modules/typebox/build/schema/engine/_refine.mjs +13 -5
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dependencies.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/format.mjs +9 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/properties.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -1
- package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/ref.d.mts +1 -1
- package/node_modules/typebox/build/schema/engine/ref.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/schema.mjs +24 -24
- package/node_modules/typebox/build/schema/parse.mjs +3 -0
- package/node_modules/typebox/build/schema/pointer/pointer.d.mts +1 -6
- package/node_modules/typebox/build/schema/pointer/pointer.mjs +47 -64
- package/node_modules/typebox/build/system/settings/internal.d.mts +2 -0
- package/node_modules/typebox/build/system/settings/internal.mjs +20 -0
- package/node_modules/typebox/build/system/settings/settings.d.mts +11 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +14 -0
- package/node_modules/typebox/build/type/extends/inference.d.mts +1 -1
- package/node_modules/typebox/build/type/extends/inference.mjs +15 -2
- package/node_modules/typebox/build/type/extends/tuple.d.mts +2 -1
- package/node_modules/typebox/build/type/extends/tuple.mjs +21 -1
- package/node_modules/typebox/build/value/parse/parse.mjs +10 -4
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +3 -1
- package/package.json +5 -5
- package/dist/runtime-api.js +0 -6
- /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-
|
|
2
|
-
import { c as canonicalizeVoiceCallMediaBase64, o as WebSocket, s as WebSocketServer } from "./runtime-entry-
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
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-
|
|
2
|
-
import { _ as resolveCallAgentId, g as resolveVoiceResponseModel } from "./runtime-entry-
|
|
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";
|