@openclaw/voice-call 2026.7.2-beta.7 → 2026.8.1-beta.3

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,4 +1,4 @@
1
- import { n as markWebhookReplay, t as createWebhookReplayCache } from "./webhook-replay-aaP79dI8.js";
1
+ import { n as reserveWebhookReplay, t as createWebhookReplayCache } from "./webhook-replay-FQrEGVSM.js";
2
2
  import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  import crypto from "node:crypto";
4
4
  //#region extensions/voice-call/src/providers/mock.ts
@@ -19,8 +19,7 @@ var MockProvider = class {
19
19
  const key = `mock:${crypto.createHash("sha256").update(requestMaterial).digest("hex")}`;
20
20
  return {
21
21
  ok: true,
22
- verifiedRequestKey: key,
23
- isReplay: markWebhookReplay(this.replayCache, key)
22
+ ...reserveWebhookReplay(this.replayCache, key)
24
23
  };
25
24
  }
26
25
  parseWebhookEvent(ctx, _options) {
@@ -80,10 +79,12 @@ var MockProvider = class {
80
79
  }
81
80
  case "call.speech": {
82
81
  const payload = evt;
82
+ const transcript = payload.transcript ?? "";
83
+ if (!transcript.trim()) return null;
83
84
  return {
84
85
  ...base,
85
86
  type: evt.type,
86
- transcript: payload.transcript ?? "",
87
+ transcript,
87
88
  isFinal: payload.isFinal ?? true,
88
89
  confidence: payload.confidence
89
90
  };
@@ -1,5 +1,5 @@
1
- import { _ as escapeXml, s as getHeader } from "./runtime-entry-D0UJiLfi.js";
2
- import { a as reconstructWebhookUrl, o as verifyPlivoWebhook, t as guardedJsonApiRequest } from "./guarded-json-api-DS9sZa3C.js";
1
+ import { _ as escapeXml, s as getHeader } from "./runtime-entry-DK8kPCGC.js";
2
+ import { a as reconstructWebhookUrl, o as verifyPlivoWebhook, t as guardedJsonApiRequest } from "./guarded-json-api-j4OEG0fR.js";
3
3
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  import crypto from "node:crypto";
5
5
  //#region extensions/voice-call/src/providers/plivo.ts
@@ -11,6 +11,25 @@ function createPlivoRequestDedupeKey(ctx) {
11
11
  return `plivo:fallback:${crypto.createHash("sha256").update(ctx.rawBody).digest("hex")}`;
12
12
  }
13
13
  var PlivoProvider = class PlivoProvider {
14
+ /**
15
+ * Release all process-local metadata owned by one Plivo call.
16
+ * Terminal webhooks can be replayed, so this must stay idempotent.
17
+ */
18
+ releaseCallState(params) {
19
+ if (params.callId) {
20
+ this.callIdToWebhookUrl.delete(params.callId);
21
+ this.pendingSpeakByCallId.delete(params.callId);
22
+ this.pendingListenByCallId.delete(params.callId);
23
+ }
24
+ const callUuid = params.callUuid || (params.providerCallId ? this.requestUuidToCallUuid.get(params.providerCallId) ?? params.providerCallId : void 0);
25
+ if (params.providerCallId) {
26
+ this.requestUuidToCallUuid.delete(params.providerCallId);
27
+ this.callUuidToWebhookUrl.delete(params.providerCallId);
28
+ }
29
+ if (!callUuid) return;
30
+ this.callUuidToWebhookUrl.delete(callUuid);
31
+ for (const [requestUuid, mappedCallUuid] of this.requestUuidToCallUuid) if (mappedCallUuid === callUuid) this.requestUuidToCallUuid.delete(requestUuid);
32
+ }
14
33
  constructor(config, options = {}) {
15
34
  this.name = "plivo";
16
35
  this.requestUuidToCallUuid = /* @__PURE__ */ new Map();
@@ -56,7 +75,8 @@ var PlivoProvider = class PlivoProvider {
56
75
  ok: result.ok,
57
76
  reason: result.reason,
58
77
  isReplay: result.isReplay,
59
- verifiedRequestKey: result.verifiedRequestKey
78
+ verifiedRequestKey: result.verifiedRequestKey,
79
+ releaseReplay: result.releaseReplay
60
80
  };
61
81
  }
62
82
  parseWebhookEvent(ctx, options) {
@@ -157,11 +177,19 @@ var PlivoProvider = class PlivoProvider {
157
177
  ...baseEvent,
158
178
  type: "call.answered"
159
179
  };
160
- if (callStatus === "completed" || callStatus === "busy" || callStatus === "no-answer" || callStatus === "failed") return {
161
- ...baseEvent,
162
- type: "call.ended",
163
- reason: callStatus === "completed" ? "completed" : callStatus === "busy" ? "busy" : callStatus === "no-answer" ? "no-answer" : "failed"
164
- };
180
+ if (callStatus === "completed" || callStatus === "busy" || callStatus === "no-answer" || callStatus === "failed") {
181
+ const event = {
182
+ ...baseEvent,
183
+ type: "call.ended",
184
+ reason: callStatus === "completed" ? "completed" : callStatus === "busy" ? "busy" : callStatus === "no-answer" ? "no-answer" : "failed"
185
+ };
186
+ this.releaseCallState({
187
+ callId: baseEvent.callId || void 0,
188
+ providerCallId: callUuid || requestUuid || void 0,
189
+ callUuid: callUuid || void 0
190
+ });
191
+ return event;
192
+ }
165
193
  if (params.get("Event") === "StartApp" && callUuid) return {
166
194
  ...baseEvent,
167
195
  type: "call.answered"
@@ -206,6 +234,11 @@ var PlivoProvider = class PlivoProvider {
206
234
  endpoint: `/Call/${callUuid}/`,
207
235
  allowNotFound: true
208
236
  });
237
+ this.releaseCallState({
238
+ callId: input.callId,
239
+ providerCallId: input.providerCallId,
240
+ callUuid
241
+ });
209
242
  return;
210
243
  }
211
244
  await this.apiRequest({
@@ -218,6 +251,10 @@ var PlivoProvider = class PlivoProvider {
218
251
  endpoint: `/Request/${input.providerCallId}/`,
219
252
  allowNotFound: true
220
253
  });
254
+ this.releaseCallState({
255
+ callId: input.callId,
256
+ providerCallId: input.providerCallId
257
+ });
221
258
  }
222
259
  resolveCallContext(params) {
223
260
  const callUuid = this.requestUuidToCallUuid.get(params.providerCallId) ?? params.providerCallId;