phonic 0.31.7 → 0.31.9

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 (89) hide show
  1. package/README.md +1 -0
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/api/resources/agents/client/Client.d.ts +3 -0
  4. package/dist/cjs/api/resources/agents/client/Client.js +3 -0
  5. package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +3 -0
  6. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +3 -0
  7. package/dist/cjs/api/resources/agents/client/requests/UpsertAgentRequest.d.ts +1 -0
  8. package/dist/cjs/api/resources/conversations/client/Client.js +4 -3
  9. package/dist/cjs/api/resources/conversations/client/Socket.d.ts +1 -1
  10. package/dist/cjs/api/resources/conversations/client/requests/ConversationsSipOutboundCallRequest.d.ts +2 -0
  11. package/dist/cjs/api/resources/conversations/client/requests/OutboundCallRequest.d.ts +5 -1
  12. package/dist/cjs/api/resources/conversations/types/ConversationsOutboundCallResponse.d.ts +2 -4
  13. package/dist/cjs/api/resources/conversations/types/ConversationsSipOutboundCallResponse.d.ts +2 -6
  14. package/dist/cjs/api/types/Agent.d.ts +2 -0
  15. package/dist/cjs/api/types/ConfigPayload.d.ts +2 -0
  16. package/dist/cjs/api/types/Conversation.d.ts +2 -0
  17. package/dist/cjs/api/types/CreateAgentRequest.d.ts +2 -0
  18. package/dist/cjs/api/types/OutboundCallConfig.d.ts +2 -0
  19. package/dist/cjs/api/types/OutboundCallInitiatedResponse.d.ts +6 -0
  20. package/dist/cjs/api/types/{InterruptedResponsePayload.js → OutboundCallInitiatedResponse.js} +1 -3
  21. package/dist/cjs/api/types/OutboundDryRunResponse.d.ts +6 -0
  22. package/dist/cjs/api/{resources/agents/client/requests/AgentsRemoveCustomPhoneNumberRequest.js → types/OutboundDryRunResponse.js} +1 -3
  23. package/dist/cjs/api/types/SipOutboundCallInitiatedResponse.d.ts +8 -0
  24. package/dist/cjs/api/types/{AudioFinishedPayload.js → SipOutboundCallInitiatedResponse.js} +1 -3
  25. package/dist/cjs/api/types/SipOutboundDryRunResponse.d.ts +8 -0
  26. package/dist/cjs/api/{resources/agents/types/AgentsRemoveCustomPhoneNumberResponse.js → types/SipOutboundDryRunResponse.js} +1 -3
  27. package/dist/cjs/api/types/index.d.ts +4 -0
  28. package/dist/cjs/api/types/index.js +4 -0
  29. package/dist/cjs/version.d.ts +1 -1
  30. package/dist/cjs/version.js +1 -1
  31. package/dist/esm/BaseClient.mjs +2 -2
  32. package/dist/esm/api/resources/agents/client/Client.d.mts +3 -0
  33. package/dist/esm/api/resources/agents/client/Client.mjs +3 -0
  34. package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +3 -0
  35. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +3 -0
  36. package/dist/esm/api/resources/agents/client/requests/UpsertAgentRequest.d.mts +1 -0
  37. package/dist/esm/api/resources/conversations/client/Client.mjs +4 -3
  38. package/dist/esm/api/resources/conversations/client/Socket.d.mts +1 -1
  39. package/dist/esm/api/resources/conversations/client/requests/ConversationsSipOutboundCallRequest.d.mts +2 -0
  40. package/dist/esm/api/resources/conversations/client/requests/OutboundCallRequest.d.mts +5 -1
  41. package/dist/esm/api/resources/conversations/types/ConversationsOutboundCallResponse.d.mts +2 -4
  42. package/dist/esm/api/resources/conversations/types/ConversationsSipOutboundCallResponse.d.mts +2 -6
  43. package/dist/esm/api/types/Agent.d.mts +2 -0
  44. package/dist/esm/api/types/ConfigPayload.d.mts +2 -0
  45. package/dist/esm/api/types/Conversation.d.mts +2 -0
  46. package/dist/esm/api/types/CreateAgentRequest.d.mts +2 -0
  47. package/dist/esm/api/types/OutboundCallConfig.d.mts +2 -0
  48. package/dist/esm/api/types/OutboundCallInitiatedResponse.d.mts +6 -0
  49. package/dist/esm/api/types/OutboundCallInitiatedResponse.mjs +2 -0
  50. package/dist/esm/api/types/OutboundDryRunResponse.d.mts +6 -0
  51. package/dist/esm/api/types/OutboundDryRunResponse.mjs +2 -0
  52. package/dist/esm/api/types/SipOutboundCallInitiatedResponse.d.mts +8 -0
  53. package/dist/esm/api/types/SipOutboundCallInitiatedResponse.mjs +2 -0
  54. package/dist/esm/api/types/SipOutboundDryRunResponse.d.mts +8 -0
  55. package/dist/esm/api/types/SipOutboundDryRunResponse.mjs +2 -0
  56. package/dist/esm/api/types/index.d.mts +4 -0
  57. package/dist/esm/api/types/index.mjs +4 -0
  58. package/dist/esm/version.d.mts +1 -1
  59. package/dist/esm/version.mjs +1 -1
  60. package/package.json +7 -7
  61. package/reference.md +6 -1
  62. package/dist/cjs/api/resources/agents/client/requests/AgentsRemoveCustomPhoneNumberRequest.d.ts +0 -16
  63. package/dist/cjs/api/resources/agents/types/AgentsRemoveCustomPhoneNumberResponse.d.ts +0 -6
  64. package/dist/cjs/api/types/AudioFinishedPayload.d.ts +0 -6
  65. package/dist/cjs/api/types/InterruptedResponsePayload.d.ts +0 -8
  66. package/dist/cjs/api/types/IsUserSpeakingPayload.d.ts +0 -8
  67. package/dist/cjs/api/types/IsUserSpeakingPayload.js +0 -5
  68. package/dist/cjs/api/types/SetTwilioCallSidPayload.d.ts +0 -8
  69. package/dist/cjs/api/types/SetTwilioCallSidPayload.js +0 -5
  70. package/dist/cjs/core/fetcher/ResponseWithBody.d.ts +0 -4
  71. package/dist/cjs/core/fetcher/ResponseWithBody.js +0 -6
  72. package/dist/esm/api/resources/agents/client/requests/AgentsRemoveCustomPhoneNumberRequest.d.mts +0 -16
  73. package/dist/esm/api/resources/agents/client/requests/AgentsRemoveCustomPhoneNumberRequest.mjs +0 -4
  74. package/dist/esm/api/resources/agents/types/AgentsRemoveCustomPhoneNumberResponse.d.mts +0 -6
  75. package/dist/esm/api/resources/agents/types/AgentsRemoveCustomPhoneNumberResponse.mjs +0 -4
  76. package/dist/esm/api/types/AudioFinishedPayload.d.mts +0 -6
  77. package/dist/esm/api/types/AudioFinishedPayload.mjs +0 -4
  78. package/dist/esm/api/types/InterruptedResponsePayload.d.mts +0 -8
  79. package/dist/esm/api/types/InterruptedResponsePayload.mjs +0 -4
  80. package/dist/esm/api/types/IsUserSpeakingPayload.d.mts +0 -8
  81. package/dist/esm/api/types/IsUserSpeakingPayload.mjs +0 -4
  82. package/dist/esm/api/types/SetTwilioCallSidPayload.d.mts +0 -8
  83. package/dist/esm/api/types/SetTwilioCallSidPayload.mjs +0 -4
  84. package/dist/esm/core/fetcher/ResponseWithBody.d.mts +0 -4
  85. package/dist/esm/core/fetcher/ResponseWithBody.mjs +0 -3
  86. package/dist/index.d.mts +0 -686
  87. package/dist/index.d.ts +0 -686
  88. package/dist/index.js +0 -643
  89. package/dist/index.mjs +0 -606
package/README.md CHANGED
@@ -71,6 +71,7 @@ await client.agents.create({
71
71
  additional_languages: ["es"],
72
72
  multilingual_mode: "request",
73
73
  boosted_keywords: ["Load ID", "dispatch"],
74
+ min_words_to_interrupt: 1,
74
75
  configuration_endpoint: {
75
76
  url: "https://api.example.com/config",
76
77
  headers: {
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "phonic",
46
- "X-Fern-SDK-Version": "0.31.7",
47
- "User-Agent": "phonic/0.31.7",
46
+ "X-Fern-SDK-Version": "0.31.9",
47
+ "User-Agent": "phonic/0.31.9",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -63,6 +63,7 @@ export declare class AgentsClient {
63
63
  * additional_languages: ["es"],
64
64
  * multilingual_mode: "request",
65
65
  * boosted_keywords: ["Load ID", "dispatch"],
66
+ * min_words_to_interrupt: 1,
66
67
  * configuration_endpoint: {
67
68
  * url: "https://api.example.com/config",
68
69
  * headers: {
@@ -111,6 +112,7 @@ export declare class AgentsClient {
111
112
  * additional_languages: ["es"],
112
113
  * multilingual_mode: "request",
113
114
  * boosted_keywords: ["Load ID", "dispatch"],
115
+ * min_words_to_interrupt: 1,
114
116
  * configuration_endpoint: {
115
117
  * url: "https://api.example.com/config",
116
118
  * headers: {
@@ -195,6 +197,7 @@ export declare class AgentsClient {
195
197
  * additional_languages: ["es"],
196
198
  * multilingual_mode: "request",
197
199
  * boosted_keywords: ["Load ID", "dispatch"],
200
+ * min_words_to_interrupt: 1,
198
201
  * configuration_endpoint: {
199
202
  * url: "https://api.example.com/config",
200
203
  * headers: {
@@ -161,6 +161,7 @@ class AgentsClient {
161
161
  * additional_languages: ["es"],
162
162
  * multilingual_mode: "request",
163
163
  * boosted_keywords: ["Load ID", "dispatch"],
164
+ * min_words_to_interrupt: 1,
164
165
  * configuration_endpoint: {
165
166
  * url: "https://api.example.com/config",
166
167
  * headers: {
@@ -258,6 +259,7 @@ class AgentsClient {
258
259
  * additional_languages: ["es"],
259
260
  * multilingual_mode: "request",
260
261
  * boosted_keywords: ["Load ID", "dispatch"],
262
+ * min_words_to_interrupt: 1,
261
263
  * configuration_endpoint: {
262
264
  * url: "https://api.example.com/config",
263
265
  * headers: {
@@ -471,6 +473,7 @@ class AgentsClient {
471
473
  * additional_languages: ["es"],
472
474
  * multilingual_mode: "request",
473
475
  * boosted_keywords: ["Load ID", "dispatch"],
476
+ * min_words_to_interrupt: 1,
474
477
  * configuration_endpoint: {
475
478
  * url: "https://api.example.com/config",
476
479
  * headers: {
@@ -28,6 +28,7 @@ import type * as Phonic from "../../../../index.js";
28
28
  * additional_languages: ["es"],
29
29
  * multilingual_mode: "request",
30
30
  * boosted_keywords: ["Load ID", "dispatch"],
31
+ * min_words_to_interrupt: 1,
31
32
  * configuration_endpoint: {
32
33
  * url: "https://api.example.com/config",
33
34
  * headers: {
@@ -90,6 +91,8 @@ export interface AgentsCreateRequest {
90
91
  multilingual_mode?: Phonic.CreateAgentRequest.MultilingualMode;
91
92
  /** These words, or short phrases, will be more accurately recognized by the agent. */
92
93
  boosted_keywords?: string[];
94
+ /** Minimum number of words required to interrupt the assistant. */
95
+ min_words_to_interrupt?: number;
93
96
  /** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
94
97
  configuration_endpoint?: Phonic.CreateAgentRequest.ConfigurationEndpoint | null;
95
98
  /** Float between 0.0 and 1.0 representing the percentage of inbound calls handled by Agent. Defaults to `1.0`. Requires `phone_number` to be set when less than 1.0. */
@@ -28,6 +28,7 @@ import type * as Phonic from "../../../../index.js";
28
28
  * additional_languages: ["es"],
29
29
  * multilingual_mode: "request",
30
30
  * boosted_keywords: ["Load ID", "dispatch"],
31
+ * min_words_to_interrupt: 1,
31
32
  * configuration_endpoint: {
32
33
  * url: "https://api.example.com/config",
33
34
  * headers: {
@@ -90,6 +91,8 @@ export interface UpdateAgentRequest {
90
91
  multilingual_mode?: UpdateAgentRequest.MultilingualMode;
91
92
  /** These words, or short phrases, will be more accurately recognized by the agent. */
92
93
  boosted_keywords?: string[];
94
+ /** Minimum number of words required to interrupt the assistant. */
95
+ min_words_to_interrupt?: number;
93
96
  /** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
94
97
  configuration_endpoint?: UpdateAgentRequest.ConfigurationEndpoint | null;
95
98
  /** Float between 0.0 and 1.0 representing the percentage of inbound calls handled by Agent. Requires `phone_number` to be set when less than 1.0. */
@@ -28,6 +28,7 @@ import type * as Phonic from "../../../../index.js";
28
28
  * additional_languages: ["es"],
29
29
  * multilingual_mode: "request",
30
30
  * boosted_keywords: ["Load ID", "dispatch"],
31
+ * min_words_to_interrupt: 1,
31
32
  * configuration_endpoint: {
32
33
  * url: "https://api.example.com/config",
33
34
  * headers: {
@@ -745,14 +745,15 @@ class ConversationsClient {
745
745
  }
746
746
  connect() {
747
747
  return __awaiter(this, arguments, void 0, function* (args = {}) {
748
- var _a, _b;
748
+ var _a, _b, _c, _d, _e;
749
749
  const { downstream_websocket_url: downstreamWebsocketUrl, protocols, queryParams, headers, debug, reconnectAttempts, connectionTimeoutInSeconds, abortSignal, } = args;
750
750
  const _queryParams = {
751
751
  downstream_websocket_url: downstreamWebsocketUrl,
752
752
  };
753
- const _headers = Object.assign({}, headers);
753
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
754
+ const _headers = Object.assign(Object.assign(Object.assign({}, ((_a = _authRequest.headers) !== null && _a !== void 0 ? _a : {})), ((_c = (_b = this._options) === null || _b === void 0 ? void 0 : _b.headers) !== null && _c !== void 0 ? _c : {})), headers);
754
755
  const socket = new core.ReconnectingWebSocket({
755
- url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PhonicEnvironment.Default)
756
+ url: core.url.join((_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : ((_e = (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.PhonicEnvironment.Default)
756
757
  .production, "/v1/sts/ws"),
757
758
  protocols: protocols !== null && protocols !== void 0 ? protocols : [],
758
759
  queryParameters: Object.assign(Object.assign({}, _queryParams), queryParams),
@@ -50,7 +50,7 @@ export declare class ConversationsSocket {
50
50
  /** Asserts that the websocket is open. */
51
51
  private assertSocketIsOpen;
52
52
  /** Send a binary payload to the websocket. */
53
- protected sendBinary(payload: ArrayBufferLike | Blob | ArrayBufferView): void;
53
+ protected sendBinary(payload: ArrayBuffer | Blob | ArrayBufferView): void;
54
54
  /** Send a JSON payload to the websocket. */
55
55
  protected sendJson(payload: Phonic.ConfigPayload | Phonic.AudioChunkPayload | Phonic.UpdateSystemPromptPayload | Phonic.AddSystemMessagePayload | Phonic.SetExternalIdPayload | Phonic.ToolCallOutputPayload | Phonic.GenerateReplyPayload | Phonic.SayPayload): void;
56
56
  }
@@ -19,4 +19,6 @@ export interface ConversationsSipOutboundCallRequest {
19
19
  /** Destination phone number in E.164 format. */
20
20
  to_phone_number: string;
21
21
  config?: Phonic.OutboundCallConfig;
22
+ /** If true, validates the outbound call setup without placing a call. Returns HTTP 200 with `conversation_id` and `twilio_call_sid` set to null. */
23
+ dry_run?: boolean;
22
24
  }
@@ -20,12 +20,16 @@ import type * as Phonic from "../../../../index.js";
20
20
  * additional_languages: ["es"],
21
21
  * multilingual_mode: "request",
22
22
  * boosted_keywords: ["Load ID", "dispatch"],
23
+ * min_words_to_interrupt: 1,
23
24
  * tools: ["keypad_input"]
24
- * }
25
+ * },
26
+ * dry_run: false
25
27
  * }
26
28
  */
27
29
  export interface OutboundCallRequest {
28
30
  /** The phone number to call in E.164 format. */
29
31
  to_phone_number: string;
30
32
  config?: Phonic.OutboundCallConfig;
33
+ /** If true, validates the outbound call setup without placing a call. Returns HTTP 200 with `conversation_id` set to null. */
34
+ dry_run?: boolean;
31
35
  }
@@ -1,4 +1,2 @@
1
- export interface ConversationsOutboundCallResponse {
2
- /** The ID of the created conversation. */
3
- conversation_id: string;
4
- }
1
+ import type * as Phonic from "../../../index.js";
2
+ export type ConversationsOutboundCallResponse = Phonic.OutboundDryRunResponse | Phonic.OutboundCallInitiatedResponse;
@@ -1,6 +1,2 @@
1
- export interface ConversationsSipOutboundCallResponse {
2
- /** The ID of the created conversation. */
3
- conversation_id: string;
4
- /** The Twilio Call SID. */
5
- twilio_call_sid: string;
6
- }
1
+ import type * as Phonic from "../../../index.js";
2
+ export type ConversationsSipOutboundCallResponse = Phonic.SipOutboundDryRunResponse | Phonic.SipOutboundCallInitiatedResponse;
@@ -52,6 +52,8 @@ export interface Agent {
52
52
  multilingual_mode: Agent.MultilingualMode;
53
53
  /** These words, or short phrases, will be more accurately recognized by the agent. */
54
54
  boosted_keywords: string[];
55
+ /** Minimum number of words required to interrupt the assistant. */
56
+ min_words_to_interrupt: number;
55
57
  /** When not `null`, the agent will call this endpoint to get configuration options. */
56
58
  configuration_endpoint: Agent.ConfigurationEndpoint | null;
57
59
  /** Float between 0.0 and 1.0 representing the percentage of inbound calls handled by Agent. Requires `phone_number` to be set when less than 1.0. */
@@ -32,6 +32,8 @@ export interface ConfigPayload {
32
32
  vad_min_silence_duration_ms?: number | undefined;
33
33
  /** Voice activity detection threshold */
34
34
  vad_threshold?: number | undefined;
35
+ /** Minimum number of words required to interrupt the assistant. */
36
+ min_words_to_interrupt?: number | undefined;
35
37
  /** Whether to have the no-input poke text be generated by AI */
36
38
  generate_no_input_poke_text?: boolean | undefined;
37
39
  /** Seconds of silence before poke message */
@@ -46,6 +46,8 @@ export interface Conversation {
46
46
  ended_by: Conversation.EndedBy | null;
47
47
  /** These words, or short phrases, are more accurately recognized by the model. */
48
48
  boosted_keywords: string[] | null;
49
+ /** Minimum number of words required to interrupt the assistant. */
50
+ min_words_to_interrupt: number;
49
51
  /** ISO 639-1 language code that sets the agent's default language to recognize and speak. Welcome message and no input poke text should be in this language. */
50
52
  default_language: string;
51
53
  /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
@@ -50,6 +50,8 @@ export interface CreateAgentRequest {
50
50
  multilingual_mode?: CreateAgentRequest.MultilingualMode | undefined;
51
51
  /** These words, or short phrases, will be more accurately recognized by the agent. */
52
52
  boosted_keywords?: string[] | undefined;
53
+ /** Minimum number of words required to interrupt the assistant. */
54
+ min_words_to_interrupt?: number | undefined;
53
55
  /** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
54
56
  configuration_endpoint?: (CreateAgentRequest.ConfigurationEndpoint | null) | undefined;
55
57
  /** Float between 0.0 and 1.0 representing the percentage of inbound calls handled by Agent. Defaults to `1.0`. Requires `phone_number` to be set when less than 1.0. */
@@ -33,6 +33,8 @@ export interface OutboundCallConfig {
33
33
  multilingual_mode?: OutboundCallConfig.MultilingualMode | undefined;
34
34
  /** These words, or short phrases, will be more accurately recognized by the agent. */
35
35
  boosted_keywords?: string[] | undefined;
36
+ /** Minimum number of words required to interrupt the assistant. */
37
+ min_words_to_interrupt?: number | undefined;
36
38
  /** Array of built-in or custom tool names to use. */
37
39
  tools?: OutboundCallConfig.Tools.Item[] | undefined;
38
40
  }
@@ -0,0 +1,6 @@
1
+ export interface OutboundCallInitiatedResponse {
2
+ /** The ID of the created conversation. */
3
+ conversation_id: string;
4
+ /** Always false when a call was placed. */
5
+ dry_run: false;
6
+ }
@@ -1,5 +1,3 @@
1
1
  "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
2
+ // This file was auto-generated by Fern from our API Definition.
5
3
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ export interface OutboundDryRunResponse {
2
+ /** Always null when `dry_run` is true. */
3
+ conversation_id: unknown | null;
4
+ /** Always true for this response. */
5
+ dry_run: true;
6
+ }
@@ -1,5 +1,3 @@
1
1
  "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
2
+ // This file was auto-generated by Fern from our API Definition.
5
3
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ export interface SipOutboundCallInitiatedResponse {
2
+ /** The ID of the created conversation. */
3
+ conversation_id: string;
4
+ /** The Twilio Call SID. */
5
+ twilio_call_sid: string;
6
+ /** Always false when a call was placed. */
7
+ dry_run: false;
8
+ }
@@ -1,5 +1,3 @@
1
1
  "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
2
+ // This file was auto-generated by Fern from our API Definition.
5
3
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ export interface SipOutboundDryRunResponse {
2
+ /** Always null when `dry_run` is true. */
3
+ conversation_id: unknown | null;
4
+ /** Always null when `dry_run` is true. */
5
+ twilio_call_sid: unknown | null;
6
+ /** Always true for this response. */
7
+ dry_run: true;
8
+ }
@@ -1,5 +1,3 @@
1
1
  "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
2
+ // This file was auto-generated by Fern from our API Definition.
5
3
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -29,10 +29,14 @@ export * from "./InputCancelledPayload.js";
29
29
  export * from "./InputTextPayload.js";
30
30
  export * from "./LanguageCode.js";
31
31
  export * from "./OutboundCallConfig.js";
32
+ export * from "./OutboundCallInitiatedResponse.js";
33
+ export * from "./OutboundDryRunResponse.js";
32
34
  export * from "./Project.js";
33
35
  export * from "./ReadyToStartConversationPayload.js";
34
36
  export * from "./SayPayload.js";
35
37
  export * from "./SetExternalIdPayload.js";
38
+ export * from "./SipOutboundCallInitiatedResponse.js";
39
+ export * from "./SipOutboundDryRunResponse.js";
36
40
  export * from "./Task.js";
37
41
  export * from "./Tool.js";
38
42
  export * from "./ToolCallInterruptedPayload.js";
@@ -45,10 +45,14 @@ __exportStar(require("./InputCancelledPayload.js"), exports);
45
45
  __exportStar(require("./InputTextPayload.js"), exports);
46
46
  __exportStar(require("./LanguageCode.js"), exports);
47
47
  __exportStar(require("./OutboundCallConfig.js"), exports);
48
+ __exportStar(require("./OutboundCallInitiatedResponse.js"), exports);
49
+ __exportStar(require("./OutboundDryRunResponse.js"), exports);
48
50
  __exportStar(require("./Project.js"), exports);
49
51
  __exportStar(require("./ReadyToStartConversationPayload.js"), exports);
50
52
  __exportStar(require("./SayPayload.js"), exports);
51
53
  __exportStar(require("./SetExternalIdPayload.js"), exports);
54
+ __exportStar(require("./SipOutboundCallInitiatedResponse.js"), exports);
55
+ __exportStar(require("./SipOutboundDryRunResponse.js"), exports);
52
56
  __exportStar(require("./Task.js"), exports);
53
57
  __exportStar(require("./Tool.js"), exports);
54
58
  __exportStar(require("./ToolCallInterruptedPayload.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.31.7";
1
+ export declare const SDK_VERSION = "0.31.9";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.31.7";
4
+ exports.SDK_VERSION = "0.31.9";
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "phonic",
9
- "X-Fern-SDK-Version": "0.31.7",
10
- "User-Agent": "phonic/0.31.7",
9
+ "X-Fern-SDK-Version": "0.31.9",
10
+ "User-Agent": "phonic/0.31.9",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -63,6 +63,7 @@ export declare class AgentsClient {
63
63
  * additional_languages: ["es"],
64
64
  * multilingual_mode: "request",
65
65
  * boosted_keywords: ["Load ID", "dispatch"],
66
+ * min_words_to_interrupt: 1,
66
67
  * configuration_endpoint: {
67
68
  * url: "https://api.example.com/config",
68
69
  * headers: {
@@ -111,6 +112,7 @@ export declare class AgentsClient {
111
112
  * additional_languages: ["es"],
112
113
  * multilingual_mode: "request",
113
114
  * boosted_keywords: ["Load ID", "dispatch"],
115
+ * min_words_to_interrupt: 1,
114
116
  * configuration_endpoint: {
115
117
  * url: "https://api.example.com/config",
116
118
  * headers: {
@@ -195,6 +197,7 @@ export declare class AgentsClient {
195
197
  * additional_languages: ["es"],
196
198
  * multilingual_mode: "request",
197
199
  * boosted_keywords: ["Load ID", "dispatch"],
200
+ * min_words_to_interrupt: 1,
198
201
  * configuration_endpoint: {
199
202
  * url: "https://api.example.com/config",
200
203
  * headers: {
@@ -125,6 +125,7 @@ export class AgentsClient {
125
125
  * additional_languages: ["es"],
126
126
  * multilingual_mode: "request",
127
127
  * boosted_keywords: ["Load ID", "dispatch"],
128
+ * min_words_to_interrupt: 1,
128
129
  * configuration_endpoint: {
129
130
  * url: "https://api.example.com/config",
130
131
  * headers: {
@@ -222,6 +223,7 @@ export class AgentsClient {
222
223
  * additional_languages: ["es"],
223
224
  * multilingual_mode: "request",
224
225
  * boosted_keywords: ["Load ID", "dispatch"],
226
+ * min_words_to_interrupt: 1,
225
227
  * configuration_endpoint: {
226
228
  * url: "https://api.example.com/config",
227
229
  * headers: {
@@ -435,6 +437,7 @@ export class AgentsClient {
435
437
  * additional_languages: ["es"],
436
438
  * multilingual_mode: "request",
437
439
  * boosted_keywords: ["Load ID", "dispatch"],
440
+ * min_words_to_interrupt: 1,
438
441
  * configuration_endpoint: {
439
442
  * url: "https://api.example.com/config",
440
443
  * headers: {
@@ -28,6 +28,7 @@ import type * as Phonic from "../../../../index.mjs";
28
28
  * additional_languages: ["es"],
29
29
  * multilingual_mode: "request",
30
30
  * boosted_keywords: ["Load ID", "dispatch"],
31
+ * min_words_to_interrupt: 1,
31
32
  * configuration_endpoint: {
32
33
  * url: "https://api.example.com/config",
33
34
  * headers: {
@@ -90,6 +91,8 @@ export interface AgentsCreateRequest {
90
91
  multilingual_mode?: Phonic.CreateAgentRequest.MultilingualMode;
91
92
  /** These words, or short phrases, will be more accurately recognized by the agent. */
92
93
  boosted_keywords?: string[];
94
+ /** Minimum number of words required to interrupt the assistant. */
95
+ min_words_to_interrupt?: number;
93
96
  /** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
94
97
  configuration_endpoint?: Phonic.CreateAgentRequest.ConfigurationEndpoint | null;
95
98
  /** Float between 0.0 and 1.0 representing the percentage of inbound calls handled by Agent. Defaults to `1.0`. Requires `phone_number` to be set when less than 1.0. */
@@ -28,6 +28,7 @@ import type * as Phonic from "../../../../index.mjs";
28
28
  * additional_languages: ["es"],
29
29
  * multilingual_mode: "request",
30
30
  * boosted_keywords: ["Load ID", "dispatch"],
31
+ * min_words_to_interrupt: 1,
31
32
  * configuration_endpoint: {
32
33
  * url: "https://api.example.com/config",
33
34
  * headers: {
@@ -90,6 +91,8 @@ export interface UpdateAgentRequest {
90
91
  multilingual_mode?: UpdateAgentRequest.MultilingualMode;
91
92
  /** These words, or short phrases, will be more accurately recognized by the agent. */
92
93
  boosted_keywords?: string[];
94
+ /** Minimum number of words required to interrupt the assistant. */
95
+ min_words_to_interrupt?: number;
93
96
  /** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
94
97
  configuration_endpoint?: UpdateAgentRequest.ConfigurationEndpoint | null;
95
98
  /** Float between 0.0 and 1.0 representing the percentage of inbound calls handled by Agent. Requires `phone_number` to be set when less than 1.0. */
@@ -28,6 +28,7 @@ import type * as Phonic from "../../../../index.mjs";
28
28
  * additional_languages: ["es"],
29
29
  * multilingual_mode: "request",
30
30
  * boosted_keywords: ["Load ID", "dispatch"],
31
+ * min_words_to_interrupt: 1,
31
32
  * configuration_endpoint: {
32
33
  * url: "https://api.example.com/config",
33
34
  * headers: {
@@ -709,14 +709,15 @@ export class ConversationsClient {
709
709
  }
710
710
  connect() {
711
711
  return __awaiter(this, arguments, void 0, function* (args = {}) {
712
- var _a, _b;
712
+ var _a, _b, _c, _d, _e;
713
713
  const { downstream_websocket_url: downstreamWebsocketUrl, protocols, queryParams, headers, debug, reconnectAttempts, connectionTimeoutInSeconds, abortSignal, } = args;
714
714
  const _queryParams = {
715
715
  downstream_websocket_url: downstreamWebsocketUrl,
716
716
  };
717
- const _headers = Object.assign({}, headers);
717
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
718
+ const _headers = Object.assign(Object.assign(Object.assign({}, ((_a = _authRequest.headers) !== null && _a !== void 0 ? _a : {})), ((_c = (_b = this._options) === null || _b === void 0 ? void 0 : _b.headers) !== null && _c !== void 0 ? _c : {})), headers);
718
719
  const socket = new core.ReconnectingWebSocket({
719
- url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.PhonicEnvironment.Default)
720
+ url: core.url.join((_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : ((_e = (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.PhonicEnvironment.Default)
720
721
  .production, "/v1/sts/ws"),
721
722
  protocols: protocols !== null && protocols !== void 0 ? protocols : [],
722
723
  queryParameters: Object.assign(Object.assign({}, _queryParams), queryParams),
@@ -50,7 +50,7 @@ export declare class ConversationsSocket {
50
50
  /** Asserts that the websocket is open. */
51
51
  private assertSocketIsOpen;
52
52
  /** Send a binary payload to the websocket. */
53
- protected sendBinary(payload: ArrayBufferLike | Blob | ArrayBufferView): void;
53
+ protected sendBinary(payload: ArrayBuffer | Blob | ArrayBufferView): void;
54
54
  /** Send a JSON payload to the websocket. */
55
55
  protected sendJson(payload: Phonic.ConfigPayload | Phonic.AudioChunkPayload | Phonic.UpdateSystemPromptPayload | Phonic.AddSystemMessagePayload | Phonic.SetExternalIdPayload | Phonic.ToolCallOutputPayload | Phonic.GenerateReplyPayload | Phonic.SayPayload): void;
56
56
  }
@@ -19,4 +19,6 @@ export interface ConversationsSipOutboundCallRequest {
19
19
  /** Destination phone number in E.164 format. */
20
20
  to_phone_number: string;
21
21
  config?: Phonic.OutboundCallConfig;
22
+ /** If true, validates the outbound call setup without placing a call. Returns HTTP 200 with `conversation_id` and `twilio_call_sid` set to null. */
23
+ dry_run?: boolean;
22
24
  }
@@ -20,12 +20,16 @@ import type * as Phonic from "../../../../index.mjs";
20
20
  * additional_languages: ["es"],
21
21
  * multilingual_mode: "request",
22
22
  * boosted_keywords: ["Load ID", "dispatch"],
23
+ * min_words_to_interrupt: 1,
23
24
  * tools: ["keypad_input"]
24
- * }
25
+ * },
26
+ * dry_run: false
25
27
  * }
26
28
  */
27
29
  export interface OutboundCallRequest {
28
30
  /** The phone number to call in E.164 format. */
29
31
  to_phone_number: string;
30
32
  config?: Phonic.OutboundCallConfig;
33
+ /** If true, validates the outbound call setup without placing a call. Returns HTTP 200 with `conversation_id` set to null. */
34
+ dry_run?: boolean;
31
35
  }
@@ -1,4 +1,2 @@
1
- export interface ConversationsOutboundCallResponse {
2
- /** The ID of the created conversation. */
3
- conversation_id: string;
4
- }
1
+ import type * as Phonic from "../../../index.mjs";
2
+ export type ConversationsOutboundCallResponse = Phonic.OutboundDryRunResponse | Phonic.OutboundCallInitiatedResponse;
@@ -1,6 +1,2 @@
1
- export interface ConversationsSipOutboundCallResponse {
2
- /** The ID of the created conversation. */
3
- conversation_id: string;
4
- /** The Twilio Call SID. */
5
- twilio_call_sid: string;
6
- }
1
+ import type * as Phonic from "../../../index.mjs";
2
+ export type ConversationsSipOutboundCallResponse = Phonic.SipOutboundDryRunResponse | Phonic.SipOutboundCallInitiatedResponse;
@@ -52,6 +52,8 @@ export interface Agent {
52
52
  multilingual_mode: Agent.MultilingualMode;
53
53
  /** These words, or short phrases, will be more accurately recognized by the agent. */
54
54
  boosted_keywords: string[];
55
+ /** Minimum number of words required to interrupt the assistant. */
56
+ min_words_to_interrupt: number;
55
57
  /** When not `null`, the agent will call this endpoint to get configuration options. */
56
58
  configuration_endpoint: Agent.ConfigurationEndpoint | null;
57
59
  /** Float between 0.0 and 1.0 representing the percentage of inbound calls handled by Agent. Requires `phone_number` to be set when less than 1.0. */
@@ -32,6 +32,8 @@ export interface ConfigPayload {
32
32
  vad_min_silence_duration_ms?: number | undefined;
33
33
  /** Voice activity detection threshold */
34
34
  vad_threshold?: number | undefined;
35
+ /** Minimum number of words required to interrupt the assistant. */
36
+ min_words_to_interrupt?: number | undefined;
35
37
  /** Whether to have the no-input poke text be generated by AI */
36
38
  generate_no_input_poke_text?: boolean | undefined;
37
39
  /** Seconds of silence before poke message */
@@ -46,6 +46,8 @@ export interface Conversation {
46
46
  ended_by: Conversation.EndedBy | null;
47
47
  /** These words, or short phrases, are more accurately recognized by the model. */
48
48
  boosted_keywords: string[] | null;
49
+ /** Minimum number of words required to interrupt the assistant. */
50
+ min_words_to_interrupt: number;
49
51
  /** ISO 639-1 language code that sets the agent's default language to recognize and speak. Welcome message and no input poke text should be in this language. */
50
52
  default_language: string;
51
53
  /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
@@ -50,6 +50,8 @@ export interface CreateAgentRequest {
50
50
  multilingual_mode?: CreateAgentRequest.MultilingualMode | undefined;
51
51
  /** These words, or short phrases, will be more accurately recognized by the agent. */
52
52
  boosted_keywords?: string[] | undefined;
53
+ /** Minimum number of words required to interrupt the assistant. */
54
+ min_words_to_interrupt?: number | undefined;
53
55
  /** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint to get configuration options. */
54
56
  configuration_endpoint?: (CreateAgentRequest.ConfigurationEndpoint | null) | undefined;
55
57
  /** Float between 0.0 and 1.0 representing the percentage of inbound calls handled by Agent. Defaults to `1.0`. Requires `phone_number` to be set when less than 1.0. */
@@ -33,6 +33,8 @@ export interface OutboundCallConfig {
33
33
  multilingual_mode?: OutboundCallConfig.MultilingualMode | undefined;
34
34
  /** These words, or short phrases, will be more accurately recognized by the agent. */
35
35
  boosted_keywords?: string[] | undefined;
36
+ /** Minimum number of words required to interrupt the assistant. */
37
+ min_words_to_interrupt?: number | undefined;
36
38
  /** Array of built-in or custom tool names to use. */
37
39
  tools?: OutboundCallConfig.Tools.Item[] | undefined;
38
40
  }
@@ -0,0 +1,6 @@
1
+ export interface OutboundCallInitiatedResponse {
2
+ /** The ID of the created conversation. */
3
+ conversation_id: string;
4
+ /** Always false when a call was placed. */
5
+ dry_run: false;
6
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,6 @@
1
+ export interface OutboundDryRunResponse {
2
+ /** Always null when `dry_run` is true. */
3
+ conversation_id: unknown | null;
4
+ /** Always true for this response. */
5
+ dry_run: true;
6
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};