@openclaw/voice-call 2026.5.2 → 2026.5.3-beta.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.
Files changed (126) hide show
  1. package/dist/api.js +2 -0
  2. package/dist/call-status-CXldV5o8.js +32 -0
  3. package/dist/cli-metadata.js +12 -0
  4. package/dist/config-7w04YpHh.js +548 -0
  5. package/dist/config-compat-B0me39_4.js +129 -0
  6. package/dist/guarded-json-api-Btx5EE4w.js +591 -0
  7. package/dist/http-headers-BrnxBasF.js +10 -0
  8. package/dist/index.js +1284 -0
  9. package/dist/mock-CeKvfVEd.js +135 -0
  10. package/dist/plivo-B-a7KFoT.js +393 -0
  11. package/dist/realtime-handler-B63CIDP2.js +325 -0
  12. package/dist/realtime-transcription.runtime-B2h70y2W.js +2 -0
  13. package/dist/realtime-voice.runtime-Bkh4nvLn.js +2 -0
  14. package/dist/response-generator-BrcmwDZU.js +182 -0
  15. package/dist/response-model-CyF5K80p.js +12 -0
  16. package/dist/runtime-api.js +6 -0
  17. package/dist/runtime-entry-88ytYAQa.js +3119 -0
  18. package/dist/runtime-entry.js +2 -0
  19. package/dist/setup-api.js +37 -0
  20. package/dist/telnyx-jjBE8boz.js +260 -0
  21. package/dist/twilio-1OqbcXLL.js +676 -0
  22. package/dist/voice-mapping-BYDGdWGx.js +40 -0
  23. package/package.json +14 -6
  24. package/api.ts +0 -16
  25. package/cli-metadata.ts +0 -10
  26. package/config-api.ts +0 -12
  27. package/index.test.ts +0 -943
  28. package/index.ts +0 -794
  29. package/runtime-api.ts +0 -20
  30. package/runtime-entry.ts +0 -1
  31. package/setup-api.ts +0 -47
  32. package/src/allowlist.test.ts +0 -18
  33. package/src/allowlist.ts +0 -19
  34. package/src/cli.ts +0 -845
  35. package/src/config-compat.test.ts +0 -120
  36. package/src/config-compat.ts +0 -227
  37. package/src/config.test.ts +0 -479
  38. package/src/config.ts +0 -808
  39. package/src/core-bridge.ts +0 -14
  40. package/src/deep-merge.test.ts +0 -40
  41. package/src/deep-merge.ts +0 -23
  42. package/src/gateway-continue-operation.ts +0 -200
  43. package/src/http-headers.test.ts +0 -16
  44. package/src/http-headers.ts +0 -15
  45. package/src/manager/context.ts +0 -42
  46. package/src/manager/events.test.ts +0 -581
  47. package/src/manager/events.ts +0 -288
  48. package/src/manager/lifecycle.ts +0 -53
  49. package/src/manager/lookup.test.ts +0 -52
  50. package/src/manager/lookup.ts +0 -35
  51. package/src/manager/outbound.test.ts +0 -528
  52. package/src/manager/outbound.ts +0 -486
  53. package/src/manager/state.ts +0 -48
  54. package/src/manager/store.ts +0 -106
  55. package/src/manager/timers.test.ts +0 -129
  56. package/src/manager/timers.ts +0 -113
  57. package/src/manager/twiml.test.ts +0 -13
  58. package/src/manager/twiml.ts +0 -17
  59. package/src/manager.closed-loop.test.ts +0 -236
  60. package/src/manager.inbound-allowlist.test.ts +0 -188
  61. package/src/manager.notify.test.ts +0 -377
  62. package/src/manager.restore.test.ts +0 -183
  63. package/src/manager.test-harness.ts +0 -127
  64. package/src/manager.ts +0 -392
  65. package/src/media-stream.test.ts +0 -768
  66. package/src/media-stream.ts +0 -708
  67. package/src/providers/base.ts +0 -97
  68. package/src/providers/mock.test.ts +0 -78
  69. package/src/providers/mock.ts +0 -185
  70. package/src/providers/plivo.test.ts +0 -93
  71. package/src/providers/plivo.ts +0 -601
  72. package/src/providers/shared/call-status.test.ts +0 -24
  73. package/src/providers/shared/call-status.ts +0 -24
  74. package/src/providers/shared/guarded-json-api.test.ts +0 -106
  75. package/src/providers/shared/guarded-json-api.ts +0 -42
  76. package/src/providers/telnyx.test.ts +0 -340
  77. package/src/providers/telnyx.ts +0 -394
  78. package/src/providers/twilio/api.test.ts +0 -145
  79. package/src/providers/twilio/api.ts +0 -93
  80. package/src/providers/twilio/twiml-policy.test.ts +0 -84
  81. package/src/providers/twilio/twiml-policy.ts +0 -87
  82. package/src/providers/twilio/webhook.ts +0 -34
  83. package/src/providers/twilio.test.ts +0 -591
  84. package/src/providers/twilio.ts +0 -861
  85. package/src/providers/twilio.types.ts +0 -17
  86. package/src/realtime-defaults.ts +0 -3
  87. package/src/realtime-fast-context.test.ts +0 -88
  88. package/src/realtime-fast-context.ts +0 -165
  89. package/src/realtime-transcription.runtime.ts +0 -4
  90. package/src/realtime-voice.runtime.ts +0 -5
  91. package/src/response-generator.test.ts +0 -321
  92. package/src/response-generator.ts +0 -318
  93. package/src/response-model.test.ts +0 -71
  94. package/src/response-model.ts +0 -23
  95. package/src/runtime.test.ts +0 -536
  96. package/src/runtime.ts +0 -510
  97. package/src/telephony-audio.test.ts +0 -61
  98. package/src/telephony-audio.ts +0 -12
  99. package/src/telephony-tts.test.ts +0 -196
  100. package/src/telephony-tts.ts +0 -235
  101. package/src/test-fixtures.ts +0 -73
  102. package/src/tts-provider-voice.test.ts +0 -34
  103. package/src/tts-provider-voice.ts +0 -21
  104. package/src/tunnel.test.ts +0 -166
  105. package/src/tunnel.ts +0 -314
  106. package/src/types.ts +0 -291
  107. package/src/utils.test.ts +0 -17
  108. package/src/utils.ts +0 -14
  109. package/src/voice-mapping.test.ts +0 -34
  110. package/src/voice-mapping.ts +0 -68
  111. package/src/webhook/realtime-handler.test.ts +0 -598
  112. package/src/webhook/realtime-handler.ts +0 -485
  113. package/src/webhook/stale-call-reaper.test.ts +0 -88
  114. package/src/webhook/stale-call-reaper.ts +0 -38
  115. package/src/webhook/tailscale.test.ts +0 -214
  116. package/src/webhook/tailscale.ts +0 -129
  117. package/src/webhook-exposure.test.ts +0 -33
  118. package/src/webhook-exposure.ts +0 -84
  119. package/src/webhook-security.test.ts +0 -770
  120. package/src/webhook-security.ts +0 -994
  121. package/src/webhook.hangup-once.lifecycle.test.ts +0 -135
  122. package/src/webhook.test.ts +0 -1470
  123. package/src/webhook.ts +0 -908
  124. package/src/webhook.types.ts +0 -5
  125. package/src/websocket-test-support.ts +0 -72
  126. package/tsconfig.json +0 -16
@@ -1,120 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import {
3
- VOICE_CALL_LEGACY_CONFIG_REMOVAL_VERSION,
4
- collectVoiceCallLegacyConfigIssues,
5
- formatVoiceCallLegacyConfigWarnings,
6
- migrateVoiceCallLegacyConfigInput,
7
- normalizeVoiceCallLegacyConfigInput,
8
- parseVoiceCallPluginConfig,
9
- } from "./config-compat.js";
10
-
11
- describe("voice-call config compatibility", () => {
12
- it("maps deprecated provider and twilio.from fields into canonical config", () => {
13
- const parsed = parseVoiceCallPluginConfig({
14
- enabled: true,
15
- provider: "log",
16
- twilio: {
17
- from: "+15550001234",
18
- },
19
- });
20
-
21
- expect(parsed.provider).toBe("mock");
22
- expect(parsed.fromNumber).toBe("+15550001234");
23
- });
24
-
25
- it("moves legacy streaming OpenAI fields into streaming.providers.openai", () => {
26
- const normalized = normalizeVoiceCallLegacyConfigInput({
27
- streaming: {
28
- enabled: true,
29
- sttProvider: "openai",
30
- openaiApiKey: "sk-test", // pragma: allowlist secret
31
- sttModel: "gpt-4o-transcribe",
32
- silenceDurationMs: 700,
33
- vadThreshold: 0.4,
34
- },
35
- });
36
-
37
- expect(normalized).toMatchObject({
38
- streaming: {
39
- enabled: true,
40
- provider: "openai",
41
- providers: {
42
- openai: {
43
- apiKey: "sk-test",
44
- model: "gpt-4o-transcribe",
45
- silenceDurationMs: 700,
46
- vadThreshold: 0.4,
47
- },
48
- },
49
- },
50
- });
51
- expect((normalized.streaming as Record<string, unknown>).openaiApiKey).toBeUndefined();
52
- expect((normalized.streaming as Record<string, unknown>).sttModel).toBeUndefined();
53
- });
54
-
55
- it("reports doctor-oriented legacy issues and warnings", () => {
56
- const raw = {
57
- provider: "log",
58
- twilio: {
59
- from: "+15550001234",
60
- },
61
- streaming: {
62
- sttProvider: "openai",
63
- openaiApiKey: "sk-test", // pragma: allowlist secret
64
- },
65
- };
66
-
67
- expect(collectVoiceCallLegacyConfigIssues(raw)).toEqual([
68
- {
69
- path: "provider",
70
- replacement: "provider",
71
- message: 'Replace provider "log" with "mock".',
72
- },
73
- {
74
- path: "twilio.from",
75
- replacement: "fromNumber",
76
- message: "Move twilio.from to fromNumber.",
77
- },
78
- {
79
- path: "streaming.sttProvider",
80
- replacement: "streaming.provider",
81
- message: "Move streaming.sttProvider to streaming.provider.",
82
- },
83
- {
84
- path: "streaming.openaiApiKey",
85
- replacement: "streaming.providers.openai.apiKey",
86
- message: "Move streaming.openaiApiKey to streaming.providers.openai.apiKey.",
87
- },
88
- ]);
89
- expect(
90
- formatVoiceCallLegacyConfigWarnings({
91
- value: raw,
92
- configPathPrefix: "plugins.entries.voice-call.config",
93
- doctorFixCommand: "openclaw doctor --fix",
94
- }),
95
- ).toEqual([
96
- `[voice-call] legacy config keys detected under plugins.entries.voice-call.config; runtime loading will not rewrite them, and support for the legacy shape will be removed in ${VOICE_CALL_LEGACY_CONFIG_REMOVAL_VERSION}. Run "openclaw doctor --fix".`,
97
- '[voice-call] plugins.entries.voice-call.config.provider: Replace provider "log" with "mock".',
98
- "[voice-call] plugins.entries.voice-call.config.twilio.from: Move twilio.from to fromNumber.",
99
- "[voice-call] plugins.entries.voice-call.config.streaming.sttProvider: Move streaming.sttProvider to streaming.provider.",
100
- "[voice-call] plugins.entries.voice-call.config.streaming.openaiApiKey: Move streaming.openaiApiKey to streaming.providers.openai.apiKey.",
101
- ]);
102
- });
103
-
104
- it("returns doctor migration change lines", () => {
105
- const migration = migrateVoiceCallLegacyConfigInput({
106
- value: {
107
- provider: "log",
108
- streaming: {
109
- sttProvider: "openai",
110
- },
111
- },
112
- configPathPrefix: "plugins.entries.voice-call.config",
113
- });
114
-
115
- expect(migration.changes).toEqual([
116
- 'Moved plugins.entries.voice-call.config.provider "log" → "mock".',
117
- "Moved plugins.entries.voice-call.config.streaming.sttProvider → plugins.entries.voice-call.config.streaming.provider.",
118
- ]);
119
- });
120
- });
@@ -1,227 +0,0 @@
1
- import { asOptionalRecord, readStringField } from "openclaw/plugin-sdk/text-runtime";
2
- import type { VoiceCallConfig } from "./config.js";
3
- import { VoiceCallConfigSchema } from "./config.js";
4
-
5
- export const VOICE_CALL_LEGACY_CONFIG_REMOVAL_VERSION = "2026.6.0";
6
-
7
- type VoiceCallLegacyConfigIssue = {
8
- path: string;
9
- replacement: string;
10
- message: string;
11
- };
12
-
13
- const asObject = asOptionalRecord;
14
- const getString = readStringField;
15
-
16
- function getNumber(obj: Record<string, unknown> | undefined, key: string): number | undefined {
17
- const value = obj?.[key];
18
- return typeof value === "number" ? value : undefined;
19
- }
20
-
21
- function mergeProviderConfig(
22
- providersValue: unknown,
23
- providerId: string,
24
- compatValues: Record<string, unknown>,
25
- ): Record<string, unknown> | undefined {
26
- if (Object.keys(compatValues).length === 0) {
27
- return asObject(providersValue);
28
- }
29
-
30
- const providers = asObject(providersValue) ?? {};
31
- const existing = asObject(providers[providerId]) ?? {};
32
- return {
33
- ...providers,
34
- [providerId]: {
35
- ...existing,
36
- ...compatValues,
37
- },
38
- };
39
- }
40
-
41
- export function collectVoiceCallLegacyConfigIssues(value: unknown): VoiceCallLegacyConfigIssue[] {
42
- const raw = asObject(value) ?? {};
43
- const twilio = asObject(raw.twilio);
44
- const streaming = asObject(raw.streaming);
45
-
46
- const issues: VoiceCallLegacyConfigIssue[] = [];
47
- if (raw.provider === "log") {
48
- issues.push({
49
- path: "provider",
50
- replacement: "provider",
51
- message: 'Replace provider "log" with "mock".',
52
- });
53
- }
54
- if (typeof twilio?.from === "string") {
55
- issues.push({
56
- path: "twilio.from",
57
- replacement: "fromNumber",
58
- message: "Move twilio.from to fromNumber.",
59
- });
60
- }
61
- if (typeof streaming?.sttProvider === "string") {
62
- issues.push({
63
- path: "streaming.sttProvider",
64
- replacement: "streaming.provider",
65
- message: "Move streaming.sttProvider to streaming.provider.",
66
- });
67
- }
68
- if (typeof streaming?.openaiApiKey === "string") {
69
- issues.push({
70
- path: "streaming.openaiApiKey",
71
- replacement: "streaming.providers.openai.apiKey",
72
- message: "Move streaming.openaiApiKey to streaming.providers.openai.apiKey.",
73
- });
74
- }
75
- if (typeof streaming?.sttModel === "string") {
76
- issues.push({
77
- path: "streaming.sttModel",
78
- replacement: "streaming.providers.openai.model",
79
- message: "Move streaming.sttModel to streaming.providers.openai.model.",
80
- });
81
- }
82
- if (typeof streaming?.silenceDurationMs === "number") {
83
- issues.push({
84
- path: "streaming.silenceDurationMs",
85
- replacement: "streaming.providers.openai.silenceDurationMs",
86
- message: "Move streaming.silenceDurationMs to streaming.providers.openai.silenceDurationMs.",
87
- });
88
- }
89
- if (typeof streaming?.vadThreshold === "number") {
90
- issues.push({
91
- path: "streaming.vadThreshold",
92
- replacement: "streaming.providers.openai.vadThreshold",
93
- message: "Move streaming.vadThreshold to streaming.providers.openai.vadThreshold.",
94
- });
95
- }
96
-
97
- return issues;
98
- }
99
-
100
- export function formatVoiceCallLegacyConfigWarnings(params: {
101
- value: unknown;
102
- configPathPrefix: string;
103
- doctorFixCommand: string;
104
- }): string[] {
105
- const issues = collectVoiceCallLegacyConfigIssues(params.value);
106
- if (issues.length === 0) {
107
- return [];
108
- }
109
-
110
- return [
111
- `[voice-call] legacy config keys detected under ${params.configPathPrefix}; runtime loading will not rewrite them, and support for the legacy shape will be removed in ${VOICE_CALL_LEGACY_CONFIG_REMOVAL_VERSION}. Run "${params.doctorFixCommand}".`,
112
- ...issues.map(
113
- (issue) => `[voice-call] ${params.configPathPrefix}.${issue.path}: ${issue.message}`,
114
- ),
115
- ];
116
- }
117
-
118
- export function migrateVoiceCallLegacyConfigInput(params: {
119
- value: unknown;
120
- configPathPrefix?: string;
121
- }): {
122
- config: Record<string, unknown>;
123
- changes: string[];
124
- issues: VoiceCallLegacyConfigIssue[];
125
- } {
126
- const raw = asObject(params.value) ?? {};
127
- const twilio = asObject(raw.twilio);
128
- const streaming = asObject(raw.streaming);
129
- const configPathPrefix = params.configPathPrefix ?? "plugins.entries.voice-call.config";
130
- const issues = collectVoiceCallLegacyConfigIssues(raw);
131
-
132
- const legacyStreamingOpenAICompat: Record<string, unknown> = {};
133
- const streamingOpenAIApiKey = getString(streaming, "openaiApiKey");
134
- if (streamingOpenAIApiKey) {
135
- legacyStreamingOpenAICompat.apiKey = streamingOpenAIApiKey;
136
- }
137
- const streamingSttModel = getString(streaming, "sttModel");
138
- if (streamingSttModel) {
139
- legacyStreamingOpenAICompat.model = streamingSttModel;
140
- }
141
- const streamingSilenceDurationMs = getNumber(streaming, "silenceDurationMs");
142
- if (streamingSilenceDurationMs !== undefined) {
143
- legacyStreamingOpenAICompat.silenceDurationMs = streamingSilenceDurationMs;
144
- }
145
- const streamingVadThreshold = getNumber(streaming, "vadThreshold");
146
- if (streamingVadThreshold !== undefined) {
147
- legacyStreamingOpenAICompat.vadThreshold = streamingVadThreshold;
148
- }
149
- const streamingProvider = getString(streaming, "provider");
150
- const legacyStreamingProvider = getString(streaming, "sttProvider");
151
-
152
- const normalizedStreaming: Record<string, unknown> | undefined = streaming
153
- ? {
154
- ...streaming,
155
- provider: streamingProvider ?? legacyStreamingProvider,
156
- providers: mergeProviderConfig(streaming.providers, "openai", legacyStreamingOpenAICompat),
157
- }
158
- : undefined;
159
-
160
- if (normalizedStreaming) {
161
- delete normalizedStreaming.sttProvider;
162
- delete normalizedStreaming.openaiApiKey;
163
- delete normalizedStreaming.sttModel;
164
- delete normalizedStreaming.silenceDurationMs;
165
- delete normalizedStreaming.vadThreshold;
166
- }
167
-
168
- const normalizedTwilio = twilio
169
- ? {
170
- ...twilio,
171
- }
172
- : undefined;
173
- if (normalizedTwilio) {
174
- delete normalizedTwilio.from;
175
- }
176
-
177
- const config = {
178
- ...raw,
179
- provider: raw.provider === "log" ? "mock" : raw.provider,
180
- fromNumber: raw.fromNumber ?? (typeof twilio?.from === "string" ? twilio.from : undefined),
181
- twilio: normalizedTwilio,
182
- streaming: normalizedStreaming,
183
- };
184
-
185
- const changes: string[] = [];
186
- if (raw.provider === "log") {
187
- changes.push(`Moved ${configPathPrefix}.provider "log" → "mock".`);
188
- }
189
- if (typeof twilio?.from === "string" && typeof raw.fromNumber !== "string") {
190
- changes.push(`Moved ${configPathPrefix}.twilio.from → ${configPathPrefix}.fromNumber.`);
191
- }
192
- if (typeof streaming?.sttProvider === "string") {
193
- changes.push(
194
- `Moved ${configPathPrefix}.streaming.sttProvider → ${configPathPrefix}.streaming.provider.`,
195
- );
196
- }
197
- if (typeof streaming?.openaiApiKey === "string") {
198
- changes.push(
199
- `Moved ${configPathPrefix}.streaming.openaiApiKey → ${configPathPrefix}.streaming.providers.openai.apiKey.`,
200
- );
201
- }
202
- if (typeof streaming?.sttModel === "string") {
203
- changes.push(
204
- `Moved ${configPathPrefix}.streaming.sttModel → ${configPathPrefix}.streaming.providers.openai.model.`,
205
- );
206
- }
207
- if (typeof streaming?.silenceDurationMs === "number") {
208
- changes.push(
209
- `Moved ${configPathPrefix}.streaming.silenceDurationMs → ${configPathPrefix}.streaming.providers.openai.silenceDurationMs.`,
210
- );
211
- }
212
- if (typeof streaming?.vadThreshold === "number") {
213
- changes.push(
214
- `Moved ${configPathPrefix}.streaming.vadThreshold → ${configPathPrefix}.streaming.providers.openai.vadThreshold.`,
215
- );
216
- }
217
-
218
- return { config, changes, issues };
219
- }
220
-
221
- export function normalizeVoiceCallLegacyConfigInput(value: unknown): Record<string, unknown> {
222
- return migrateVoiceCallLegacyConfigInput({ value }).config;
223
- }
224
-
225
- export function parseVoiceCallPluginConfig(value: unknown): VoiceCallConfig {
226
- return VoiceCallConfigSchema.parse(normalizeVoiceCallLegacyConfigInput(value));
227
- }