phonic 0.31.8 → 0.31.10

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 (119) hide show
  1. package/README.md +1 -0
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/Client.d.ts +9 -1
  4. package/dist/cjs/Client.js +1 -1
  5. package/dist/cjs/api/resources/agents/client/Client.d.ts +3 -0
  6. package/dist/cjs/api/resources/agents/client/Client.js +3 -0
  7. package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +3 -0
  8. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +3 -0
  9. package/dist/cjs/api/resources/agents/client/requests/UpsertAgentRequest.d.ts +1 -0
  10. package/dist/cjs/api/resources/conversations/client/Client.d.ts +8 -1
  11. package/dist/cjs/api/resources/conversations/client/Client.js +37 -3
  12. package/dist/cjs/api/resources/conversations/client/Socket.d.ts +2 -1
  13. package/dist/cjs/api/resources/conversations/client/Socket.js +4 -0
  14. package/dist/cjs/api/resources/conversations/client/requests/ConversationsSipOutboundCallRequest.d.ts +2 -0
  15. package/dist/cjs/api/resources/conversations/client/requests/OutboundCallRequest.d.ts +5 -1
  16. package/dist/cjs/api/resources/conversations/types/ConversationsOutboundCallResponse.d.ts +2 -4
  17. package/dist/cjs/api/resources/conversations/types/ConversationsSipOutboundCallResponse.d.ts +2 -6
  18. package/dist/cjs/api/types/Agent.d.ts +2 -0
  19. package/dist/cjs/api/types/ConfigOptions.d.ts +94 -0
  20. package/dist/cjs/api/types/ConfigOptions.js +32 -0
  21. package/dist/cjs/api/types/ConfigPayload.d.ts +2 -88
  22. package/dist/cjs/api/types/ConfigPayload.js +0 -29
  23. package/dist/cjs/api/types/Conversation.d.ts +2 -0
  24. package/dist/cjs/api/types/CreateAgentRequest.d.ts +2 -0
  25. package/dist/cjs/api/types/OutboundCallConfig.d.ts +2 -0
  26. package/dist/cjs/api/types/OutboundCallInitiatedResponse.d.ts +6 -0
  27. package/dist/cjs/api/types/{InterruptedResponsePayload.js → OutboundCallInitiatedResponse.js} +1 -3
  28. package/dist/cjs/api/types/OutboundDryRunResponse.d.ts +6 -0
  29. package/dist/cjs/api/{resources/agents/client/requests/AgentsRemoveCustomPhoneNumberRequest.js → types/OutboundDryRunResponse.js} +1 -3
  30. package/dist/cjs/api/types/ResetPayload.d.ts +5 -0
  31. package/dist/cjs/api/types/{AudioFinishedPayload.js → ResetPayload.js} +1 -3
  32. package/dist/cjs/api/types/SipOutboundCallInitiatedResponse.d.ts +8 -0
  33. package/dist/cjs/api/{resources/agents/types/AgentsRemoveCustomPhoneNumberResponse.js → types/SipOutboundCallInitiatedResponse.js} +1 -3
  34. package/dist/cjs/api/types/SipOutboundDryRunResponse.d.ts +8 -0
  35. package/dist/cjs/api/types/SipOutboundDryRunResponse.js +3 -0
  36. package/dist/cjs/api/types/index.d.ts +6 -0
  37. package/dist/cjs/api/types/index.js +6 -0
  38. package/dist/cjs/custom/ReconnectableConversationsSocket.d.ts +74 -0
  39. package/dist/cjs/custom/ReconnectableConversationsSocket.js +283 -0
  40. package/dist/cjs/custom/index.d.ts +1 -0
  41. package/dist/cjs/custom/index.js +5 -0
  42. package/dist/cjs/index.d.ts +1 -0
  43. package/dist/cjs/index.js +3 -1
  44. package/dist/cjs/version.d.ts +1 -1
  45. package/dist/cjs/version.js +1 -1
  46. package/dist/esm/BaseClient.mjs +2 -2
  47. package/dist/esm/Client.d.mts +9 -1
  48. package/dist/esm/Client.mjs +1 -1
  49. package/dist/esm/api/resources/agents/client/Client.d.mts +3 -0
  50. package/dist/esm/api/resources/agents/client/Client.mjs +3 -0
  51. package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +3 -0
  52. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +3 -0
  53. package/dist/esm/api/resources/agents/client/requests/UpsertAgentRequest.d.mts +1 -0
  54. package/dist/esm/api/resources/conversations/client/Client.d.mts +8 -1
  55. package/dist/esm/api/resources/conversations/client/Client.mjs +37 -3
  56. package/dist/esm/api/resources/conversations/client/Socket.d.mts +2 -1
  57. package/dist/esm/api/resources/conversations/client/Socket.mjs +4 -0
  58. package/dist/esm/api/resources/conversations/client/requests/ConversationsSipOutboundCallRequest.d.mts +2 -0
  59. package/dist/esm/api/resources/conversations/client/requests/OutboundCallRequest.d.mts +5 -1
  60. package/dist/esm/api/resources/conversations/types/ConversationsOutboundCallResponse.d.mts +2 -4
  61. package/dist/esm/api/resources/conversations/types/ConversationsSipOutboundCallResponse.d.mts +2 -6
  62. package/dist/esm/api/types/Agent.d.mts +2 -0
  63. package/dist/esm/api/types/ConfigOptions.d.mts +94 -0
  64. package/dist/esm/api/types/ConfigOptions.mjs +29 -0
  65. package/dist/esm/api/types/ConfigPayload.d.mts +2 -88
  66. package/dist/esm/api/types/ConfigPayload.mjs +1 -28
  67. package/dist/esm/api/types/Conversation.d.mts +2 -0
  68. package/dist/esm/api/types/CreateAgentRequest.d.mts +2 -0
  69. package/dist/esm/api/types/OutboundCallConfig.d.mts +2 -0
  70. package/dist/esm/api/types/OutboundCallInitiatedResponse.d.mts +6 -0
  71. package/dist/esm/api/types/OutboundCallInitiatedResponse.mjs +2 -0
  72. package/dist/esm/api/types/OutboundDryRunResponse.d.mts +6 -0
  73. package/dist/esm/api/types/OutboundDryRunResponse.mjs +2 -0
  74. package/dist/esm/api/types/ResetPayload.d.mts +5 -0
  75. package/dist/esm/api/types/ResetPayload.mjs +2 -0
  76. package/dist/esm/api/types/SipOutboundCallInitiatedResponse.d.mts +8 -0
  77. package/dist/esm/api/types/SipOutboundCallInitiatedResponse.mjs +2 -0
  78. package/dist/esm/api/types/SipOutboundDryRunResponse.d.mts +8 -0
  79. package/dist/esm/api/types/SipOutboundDryRunResponse.mjs +2 -0
  80. package/dist/esm/api/types/index.d.mts +6 -0
  81. package/dist/esm/api/types/index.mjs +6 -0
  82. package/dist/esm/custom/ReconnectableConversationsSocket.d.mts +74 -0
  83. package/dist/esm/custom/ReconnectableConversationsSocket.mjs +246 -0
  84. package/dist/esm/custom/index.d.mts +1 -0
  85. package/dist/esm/custom/index.mjs +1 -0
  86. package/dist/esm/index.d.mts +1 -0
  87. package/dist/esm/index.mjs +1 -0
  88. package/dist/esm/version.d.mts +1 -1
  89. package/dist/esm/version.mjs +1 -1
  90. package/package.json +1 -1
  91. package/reference.md +6 -1
  92. package/dist/cjs/api/resources/agents/client/requests/AgentsRemoveCustomPhoneNumberRequest.d.ts +0 -16
  93. package/dist/cjs/api/resources/agents/types/AgentsRemoveCustomPhoneNumberResponse.d.ts +0 -6
  94. package/dist/cjs/api/types/AudioFinishedPayload.d.ts +0 -6
  95. package/dist/cjs/api/types/InterruptedResponsePayload.d.ts +0 -8
  96. package/dist/cjs/api/types/IsUserSpeakingPayload.d.ts +0 -8
  97. package/dist/cjs/api/types/IsUserSpeakingPayload.js +0 -5
  98. package/dist/cjs/api/types/SetTwilioCallSidPayload.d.ts +0 -8
  99. package/dist/cjs/api/types/SetTwilioCallSidPayload.js +0 -5
  100. package/dist/cjs/core/fetcher/ResponseWithBody.d.ts +0 -4
  101. package/dist/cjs/core/fetcher/ResponseWithBody.js +0 -6
  102. package/dist/esm/api/resources/agents/client/requests/AgentsRemoveCustomPhoneNumberRequest.d.mts +0 -16
  103. package/dist/esm/api/resources/agents/client/requests/AgentsRemoveCustomPhoneNumberRequest.mjs +0 -4
  104. package/dist/esm/api/resources/agents/types/AgentsRemoveCustomPhoneNumberResponse.d.mts +0 -6
  105. package/dist/esm/api/resources/agents/types/AgentsRemoveCustomPhoneNumberResponse.mjs +0 -4
  106. package/dist/esm/api/types/AudioFinishedPayload.d.mts +0 -6
  107. package/dist/esm/api/types/AudioFinishedPayload.mjs +0 -4
  108. package/dist/esm/api/types/InterruptedResponsePayload.d.mts +0 -8
  109. package/dist/esm/api/types/InterruptedResponsePayload.mjs +0 -4
  110. package/dist/esm/api/types/IsUserSpeakingPayload.d.mts +0 -8
  111. package/dist/esm/api/types/IsUserSpeakingPayload.mjs +0 -4
  112. package/dist/esm/api/types/SetTwilioCallSidPayload.d.mts +0 -8
  113. package/dist/esm/api/types/SetTwilioCallSidPayload.mjs +0 -4
  114. package/dist/esm/core/fetcher/ResponseWithBody.d.mts +0 -4
  115. package/dist/esm/core/fetcher/ResponseWithBody.mjs +0 -3
  116. package/dist/index.d.mts +0 -686
  117. package/dist/index.d.ts +0 -686
  118. package/dist/index.js +0 -643
  119. package/dist/index.mjs +0 -606
@@ -0,0 +1,246 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import * as core from "../core/index.mjs";
11
+ import { ConversationsSocket } from "../api/resources/conversations/client/Socket.mjs";
12
+ import { fromJson } from "../core/json.mjs";
13
+ /** 1006 is the only close code that indicates an unexpected disconnect
14
+ * worth reconnecting for. All other codes (1000, 4000, 4800, etc.)
15
+ * are intentional server-side closes. */
16
+ const ABNORMAL_CLOSURE = 1006;
17
+ const BASE_RECONNECT_DELAY_MS = 500;
18
+ const MAX_RECONNECT_DELAY_MS = 5000;
19
+ /** Safety cap: stop retrying if the server is completely unreachable.
20
+ * In normal operation the server's terminal codes (4800/4801) stop
21
+ * retries much sooner (within the 10s grace period). */
22
+ const MAX_RECONNECT_ATTEMPTS = 10;
23
+ /**
24
+ * Wraps ConversationsSocket with automatic reconnection on 1006.
25
+ *
26
+ * On abnormal closure, creates a brand new ReconnectingWebSocket (via the
27
+ * createReconnectSocket factory) and wraps it in a fresh ConversationsSocket,
28
+ * forwarding all events to user-registered handlers.
29
+ *
30
+ * Retries reconnection with exponential backoff until the server responds
31
+ * with a terminal close code (4800 session expired, 4801 invalid state),
32
+ * the safety cap is reached, or the user calls close().
33
+ *
34
+ * Uses composition rather than inheritance to avoid coupling to the parent's
35
+ * private event handler registration or ReconnectingWebSocket internals.
36
+ */
37
+ export class ReconnectableConversationsSocket {
38
+ constructor(args) {
39
+ this._conversationId = null;
40
+ this._handlers = {};
41
+ this._reconnectAttempts = 0;
42
+ this._isClosed = false;
43
+ this._cleanupWireListeners = null;
44
+ this._pendingReconnect = null;
45
+ this._pendingReplacement = false;
46
+ this._createReconnectSocket = args.createReconnectSocket;
47
+ this._abortSignal = args.abortSignal != undefined ? args.abortSignal : null;
48
+ this._inner = new ConversationsSocket({ socket: args.socket });
49
+ this._wireInner(this._inner, args.socket);
50
+ }
51
+ /** The conversation ID captured from the server's conversation_created message. */
52
+ get conversationId() {
53
+ return this._conversationId;
54
+ }
55
+ get socket() {
56
+ return this._inner.socket;
57
+ }
58
+ get readyState() {
59
+ return this._inner.readyState;
60
+ }
61
+ on(event, callback) {
62
+ this._handlers[event] = callback;
63
+ }
64
+ /** Drop outbound sends when we cannot talk to a live socket (no queue). */
65
+ _safeSend(op) {
66
+ if (this._isClosed || this._pendingReplacement) {
67
+ return;
68
+ }
69
+ if (this._inner.readyState !== core.ReconnectingWebSocket.ReadyState.OPEN) {
70
+ return;
71
+ }
72
+ op(this._inner);
73
+ }
74
+ sendConfig(message) {
75
+ this._safeSend((inner) => inner.sendConfig(message));
76
+ }
77
+ sendAudioChunk(message) {
78
+ this._safeSend((inner) => inner.sendAudioChunk(message));
79
+ }
80
+ sendToolCallOutput(message) {
81
+ this._safeSend((inner) => inner.sendToolCallOutput(message));
82
+ }
83
+ sendUpdateSystemPrompt(message) {
84
+ this._safeSend((inner) => inner.sendUpdateSystemPrompt(message));
85
+ }
86
+ sendAddSystemMessage(message) {
87
+ this._safeSend((inner) => inner.sendAddSystemMessage(message));
88
+ }
89
+ sendSetExternalId(message) {
90
+ this._safeSend((inner) => inner.sendSetExternalId(message));
91
+ }
92
+ sendGenerateReply(message) {
93
+ this._safeSend((inner) => inner.sendGenerateReply(message));
94
+ }
95
+ sendSay(message) {
96
+ this._safeSend((inner) => inner.sendSay(message));
97
+ }
98
+ sendReset(message) {
99
+ this._safeSend((inner) => inner.sendReset(message));
100
+ }
101
+ /**
102
+ * Not supported — reconnection after 1006 is handled automatically.
103
+ * To start a new conversation, create a new socket via client.conversations.connect().
104
+ */
105
+ connect() {
106
+ throw new Error("connect() is not supported on ReconnectableConversationsSocket. "
107
+ + "Reconnection after 1006 is automatic. To start a new conversation, "
108
+ + "call client.conversations.connect() again.");
109
+ }
110
+ close() {
111
+ var _a;
112
+ this._isClosed = true;
113
+ this._pendingReplacement = false;
114
+ if (this._pendingReconnect != null) {
115
+ clearTimeout(this._pendingReconnect);
116
+ this._pendingReconnect = null;
117
+ }
118
+ (_a = this._cleanupWireListeners) === null || _a === void 0 ? void 0 : _a.call(this);
119
+ this._cleanupWireListeners = null;
120
+ this._inner.close();
121
+ }
122
+ waitForOpen() {
123
+ return __awaiter(this, void 0, void 0, function* () {
124
+ return this._inner.waitForOpen();
125
+ });
126
+ }
127
+ _getReconnectDelay() {
128
+ // Exponential backoff: 500ms, 1s, 2s, 4s, capped at 5s
129
+ const delay = BASE_RECONNECT_DELAY_MS * Math.pow(2, this._reconnectAttempts - 1);
130
+ return Math.min(delay, MAX_RECONNECT_DELAY_MS);
131
+ }
132
+ /** Schedule a reconnection attempt after backoff delay. */
133
+ _scheduleReconnect() {
134
+ var _a, _b, _c;
135
+ if (this._isClosed || this._conversationId === null || ((_a = this._abortSignal) === null || _a === void 0 ? void 0 : _a.aborted)) {
136
+ return;
137
+ }
138
+ if (this._reconnectAttempts >= MAX_RECONNECT_ATTEMPTS) {
139
+ this._pendingReplacement = false;
140
+ (_c = (_b = this._handlers).error) === null || _c === void 0 ? void 0 : _c.call(_b, new Error("Max reconnect attempts reached"));
141
+ return;
142
+ }
143
+ // Clear any existing timer to prevent orphaned timeouts
144
+ if (this._pendingReconnect != null) {
145
+ clearTimeout(this._pendingReconnect);
146
+ }
147
+ this._reconnectAttempts++;
148
+ const delay = this._getReconnectDelay();
149
+ this._pendingReplacement = true;
150
+ this._pendingReconnect = setTimeout(() => {
151
+ this._pendingReconnect = null;
152
+ if (this._isClosed) {
153
+ this._pendingReplacement = false;
154
+ return;
155
+ }
156
+ void this._doReconnect();
157
+ }, delay);
158
+ }
159
+ /** Perform the actual reconnection attempt. */
160
+ _doReconnect() {
161
+ return __awaiter(this, void 0, void 0, function* () {
162
+ var _a, _b;
163
+ try {
164
+ const created = this._createReconnectSocket(this._conversationId);
165
+ const newRawSocket = created instanceof Promise ? yield created : created;
166
+ if (this._isClosed || ((_a = this._abortSignal) === null || _a === void 0 ? void 0 : _a.aborted)) {
167
+ this._pendingReplacement = false;
168
+ newRawSocket.close();
169
+ return;
170
+ }
171
+ // Clean up the old socket: remove our custom listeners and close
172
+ // the ConversationsSocket wrapper (which removes its own listeners).
173
+ (_b = this._cleanupWireListeners) === null || _b === void 0 ? void 0 : _b.call(this);
174
+ this._cleanupWireListeners = null;
175
+ try {
176
+ this._inner.close();
177
+ }
178
+ catch ( /* already closed from 1006 */_c) { /* already closed from 1006 */ }
179
+ const newInner = new ConversationsSocket({ socket: newRawSocket });
180
+ this._inner = newInner;
181
+ this._wireInner(newInner, newRawSocket);
182
+ }
183
+ catch (_d) {
184
+ this._pendingReplacement = false;
185
+ // Connection failed — schedule another attempt.
186
+ // The server's grace period (10s) is the natural limit;
187
+ // once it expires, the next attempt will get 4800 and stop.
188
+ this._scheduleReconnect();
189
+ }
190
+ });
191
+ }
192
+ _wireInner(inner, rawSocket) {
193
+ // Forward events from the inner ConversationsSocket to user handlers.
194
+ // Clear _pendingReplacement before calling the user's open handler
195
+ // so that sends inside the handler are not silently dropped.
196
+ inner.on("open", () => {
197
+ var _a, _b;
198
+ this._pendingReplacement = false;
199
+ (_b = (_a = this._handlers).open) === null || _b === void 0 ? void 0 : _b.call(_a);
200
+ });
201
+ inner.on("message", (msg) => { var _a, _b; return (_b = (_a = this._handlers).message) === null || _b === void 0 ? void 0 : _b.call(_a, msg); });
202
+ inner.on("close", (ev) => { var _a, _b; return (_b = (_a = this._handlers).close) === null || _b === void 0 ? void 0 : _b.call(_a, ev); });
203
+ inner.on("error", (err) => { var _a, _b; return (_b = (_a = this._handlers).error) === null || _b === void 0 ? void 0 : _b.call(_a, err); });
204
+ // Intercept raw messages to capture conversation_id and reset reconnect counter
205
+ const onMessage = (event) => {
206
+ try {
207
+ const data = fromJson(event.data);
208
+ if (data && typeof data === "object" && "type" in data) {
209
+ const type = data.type;
210
+ if (type === "conversation_created") {
211
+ this._conversationId = data.conversation_id;
212
+ }
213
+ if (type === "conversation_reconnected") {
214
+ this._reconnectAttempts = 0;
215
+ }
216
+ }
217
+ }
218
+ catch (_a) {
219
+ // ignore — inner socket handles parse errors
220
+ }
221
+ };
222
+ const onClose = (event) => {
223
+ if (this._isClosed) {
224
+ return;
225
+ }
226
+ if (event.code === ABNORMAL_CLOSURE && this._conversationId !== null) {
227
+ // We have a conversation to resume — cancel RWS's built-in
228
+ // auto-reconnect and handle it ourselves with reconnect_conv_id.
229
+ // _handleClose calls _connect() before notifying listeners,
230
+ // but _connect() awaits _wait() which is async. Calling
231
+ // close() synchronously sets _closeCalled = true, which
232
+ // _connect() checks before opening the new socket.
233
+ rawSocket.close();
234
+ this._scheduleReconnect();
235
+ }
236
+ // 1006 without conversationId: let RWS handle transport-level
237
+ // reconnect normally (starts a fresh conversation).
238
+ };
239
+ rawSocket.addEventListener("message", onMessage);
240
+ rawSocket.addEventListener("close", onClose);
241
+ this._cleanupWireListeners = () => {
242
+ rawSocket.removeEventListener("message", onMessage);
243
+ rawSocket.removeEventListener("close", onClose);
244
+ };
245
+ }
246
+ }
@@ -0,0 +1 @@
1
+ export { ReconnectableConversationsSocket } from "./ReconnectableConversationsSocket.mjs";
@@ -0,0 +1 @@
1
+ export { ReconnectableConversationsSocket } from "./ReconnectableConversationsSocket.mjs";
@@ -4,3 +4,4 @@ export { PhonicClient } from "./Client.mjs";
4
4
  export { PhonicEnvironment, type PhonicEnvironmentUrls } from "./environments.mjs";
5
5
  export { PhonicError, PhonicTimeoutError } from "./errors/index.mjs";
6
6
  export * from "./exports.mjs";
7
+ export { ReconnectableConversationsSocket } from "./custom/index.mjs";
@@ -3,3 +3,4 @@ export { PhonicClient } from "./Client.mjs";
3
3
  export { PhonicEnvironment } from "./environments.mjs";
4
4
  export { PhonicError, PhonicTimeoutError } from "./errors/index.mjs";
5
5
  export * from "./exports.mjs";
6
+ export { ReconnectableConversationsSocket } from "./custom/index.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.31.8";
1
+ export declare const SDK_VERSION = "0.31.10";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.31.8";
1
+ export const SDK_VERSION = "0.31.10";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phonic",
3
- "version": "0.31.8",
3
+ "version": "0.31.10",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/reference.md CHANGED
@@ -117,6 +117,7 @@ await client.agents.create({
117
117
  additional_languages: ["es"],
118
118
  multilingual_mode: "request",
119
119
  boosted_keywords: ["Load ID", "dispatch"],
120
+ min_words_to_interrupt: 1,
120
121
  configuration_endpoint: {
121
122
  url: "https://api.example.com/config",
122
123
  headers: {
@@ -214,6 +215,7 @@ await client.agents.upsert({
214
215
  additional_languages: ["es"],
215
216
  multilingual_mode: "request",
216
217
  boosted_keywords: ["Load ID", "dispatch"],
218
+ min_words_to_interrupt: 1,
217
219
  configuration_endpoint: {
218
220
  url: "https://api.example.com/config",
219
221
  headers: {
@@ -457,6 +459,7 @@ await client.agents.update("nameOrId", {
457
459
  additional_languages: ["es"],
458
460
  multilingual_mode: "request",
459
461
  boosted_keywords: ["Load ID", "dispatch"],
462
+ min_words_to_interrupt: 1,
460
463
  configuration_endpoint: {
461
464
  url: "https://api.example.com/config",
462
465
  headers: {
@@ -2196,8 +2199,10 @@ await client.conversations.outboundCall({
2196
2199
  additional_languages: ["es"],
2197
2200
  multilingual_mode: "request",
2198
2201
  boosted_keywords: ["Load ID", "dispatch"],
2202
+ min_words_to_interrupt: 1,
2199
2203
  tools: ["keypad_input"]
2200
- }
2204
+ },
2205
+ dry_run: false
2201
2206
  });
2202
2207
 
2203
2208
  ```
@@ -1,16 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- /**
5
- * @example
6
- * {
7
- * project: "main",
8
- * phone_number: "+15551234567"
9
- * }
10
- */
11
- export interface AgentsRemoveCustomPhoneNumberRequest {
12
- /** The name of the project containing the agent. Only used when `nameOrId` is a name. */
13
- project?: string;
14
- /** The E.164 formatted phone number to remove (e.g., "+15551234567"). */
15
- phone_number: string;
16
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface AgentsRemoveCustomPhoneNumberResponse {
5
- success: boolean;
6
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface AudioFinishedPayload {
5
- type: "audio_finished";
6
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface InterruptedResponsePayload {
5
- type: "interrupted_response";
6
- /** Truncated AI response text at interruption point */
7
- text: string;
8
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface IsUserSpeakingPayload {
5
- type: "is_user_speaking";
6
- /** Whether the user is currently speaking */
7
- is_user_speaking: boolean;
8
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface SetTwilioCallSidPayload {
5
- type: "set_twilio_call_sid";
6
- /** Encrypted Twilio call data */
7
- encrypted_data: string;
8
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +0,0 @@
1
- export type ResponseWithBody = Response & {
2
- body: ReadableStream<Uint8Array>;
3
- };
4
- export declare function isResponseWithBody(response: Response): response is ResponseWithBody;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isResponseWithBody = isResponseWithBody;
4
- function isResponseWithBody(response) {
5
- return response.body != null;
6
- }
@@ -1,16 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- /**
5
- * @example
6
- * {
7
- * project: "main",
8
- * phone_number: "+15551234567"
9
- * }
10
- */
11
- export interface AgentsRemoveCustomPhoneNumberRequest {
12
- /** The name of the project containing the agent. Only used when `nameOrId` is a name. */
13
- project?: string;
14
- /** The E.164 formatted phone number to remove (e.g., "+15551234567"). */
15
- phone_number: string;
16
- }
@@ -1,4 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface AgentsRemoveCustomPhoneNumberResponse {
5
- success: boolean;
6
- }
@@ -1,4 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface AudioFinishedPayload {
5
- type: "audio_finished";
6
- }
@@ -1,4 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export {};
@@ -1,8 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface InterruptedResponsePayload {
5
- type: "interrupted_response";
6
- /** Truncated AI response text at interruption point */
7
- text: string;
8
- }
@@ -1,4 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export {};
@@ -1,8 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface IsUserSpeakingPayload {
5
- type: "is_user_speaking";
6
- /** Whether the user is currently speaking */
7
- is_user_speaking: boolean;
8
- }
@@ -1,4 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export {};
@@ -1,8 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export interface SetTwilioCallSidPayload {
5
- type: "set_twilio_call_sid";
6
- /** Encrypted Twilio call data */
7
- encrypted_data: string;
8
- }
@@ -1,4 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- export {};
@@ -1,4 +0,0 @@
1
- export type ResponseWithBody = Response & {
2
- body: ReadableStream<Uint8Array>;
3
- };
4
- export declare function isResponseWithBody(response: Response): response is ResponseWithBody;
@@ -1,3 +0,0 @@
1
- export function isResponseWithBody(response) {
2
- return response.body != null;
3
- }