phonic 0.30.35 → 0.30.37

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 (57) hide show
  1. package/README.md +1 -0
  2. package/dist/cjs/Client.js +2 -2
  3. package/dist/cjs/api/resources/agents/client/Client.d.ts +5 -2
  4. package/dist/cjs/api/resources/agents/client/Client.js +11 -6
  5. package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +6 -2
  6. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +6 -2
  7. package/dist/cjs/api/resources/agents/client/requests/UpsertAgentRequest.d.ts +1 -0
  8. package/dist/cjs/api/resources/auth/client/Client.d.ts +1 -1
  9. package/dist/cjs/api/resources/auth/client/Client.js +5 -3
  10. package/dist/cjs/api/resources/conversations/client/Client.d.ts +2 -1
  11. package/dist/cjs/api/resources/conversations/client/Client.js +6 -3
  12. package/dist/cjs/api/resources/conversations/client/requests/OutboundCallRequest.d.ts +1 -0
  13. package/dist/cjs/api/resources/extractionSchemas/client/Client.d.ts +1 -1
  14. package/dist/cjs/api/resources/extractionSchemas/client/Client.js +5 -3
  15. package/dist/cjs/api/resources/projects/client/Client.d.ts +2 -2
  16. package/dist/cjs/api/resources/projects/client/Client.js +8 -6
  17. package/dist/cjs/api/resources/projects/client/requests/UpdateProjectRequest.d.ts +2 -1
  18. package/dist/cjs/api/resources/tools/client/Client.d.ts +1 -1
  19. package/dist/cjs/api/resources/tools/client/Client.js +5 -3
  20. package/dist/cjs/api/resources/voices/client/Client.d.ts +1 -1
  21. package/dist/cjs/api/resources/voices/client/Client.js +5 -3
  22. package/dist/cjs/api/types/Agent.d.ts +3 -1
  23. package/dist/cjs/api/types/ConfigPayload.d.ts +3 -1
  24. package/dist/cjs/api/types/Conversation.d.ts +3 -1
  25. package/dist/cjs/api/types/CreateAgentRequest.d.ts +5 -2
  26. package/dist/cjs/api/types/OutboundCallConfig.d.ts +3 -1
  27. package/dist/cjs/version.d.ts +1 -1
  28. package/dist/cjs/version.js +1 -1
  29. package/dist/esm/Client.mjs +2 -2
  30. package/dist/esm/api/resources/agents/client/Client.d.mts +5 -2
  31. package/dist/esm/api/resources/agents/client/Client.mjs +11 -6
  32. package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +6 -2
  33. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +6 -2
  34. package/dist/esm/api/resources/agents/client/requests/UpsertAgentRequest.d.mts +1 -0
  35. package/dist/esm/api/resources/auth/client/Client.d.mts +1 -1
  36. package/dist/esm/api/resources/auth/client/Client.mjs +5 -3
  37. package/dist/esm/api/resources/conversations/client/Client.d.mts +2 -1
  38. package/dist/esm/api/resources/conversations/client/Client.mjs +6 -3
  39. package/dist/esm/api/resources/conversations/client/requests/OutboundCallRequest.d.mts +1 -0
  40. package/dist/esm/api/resources/extractionSchemas/client/Client.d.mts +1 -1
  41. package/dist/esm/api/resources/extractionSchemas/client/Client.mjs +5 -3
  42. package/dist/esm/api/resources/projects/client/Client.d.mts +2 -2
  43. package/dist/esm/api/resources/projects/client/Client.mjs +8 -6
  44. package/dist/esm/api/resources/projects/client/requests/UpdateProjectRequest.d.mts +2 -1
  45. package/dist/esm/api/resources/tools/client/Client.d.mts +1 -1
  46. package/dist/esm/api/resources/tools/client/Client.mjs +5 -3
  47. package/dist/esm/api/resources/voices/client/Client.d.mts +1 -1
  48. package/dist/esm/api/resources/voices/client/Client.mjs +5 -3
  49. package/dist/esm/api/types/Agent.d.mts +3 -1
  50. package/dist/esm/api/types/ConfigPayload.d.mts +3 -1
  51. package/dist/esm/api/types/Conversation.d.mts +3 -1
  52. package/dist/esm/api/types/CreateAgentRequest.d.mts +5 -2
  53. package/dist/esm/api/types/OutboundCallConfig.d.mts +3 -1
  54. package/dist/esm/version.d.mts +1 -1
  55. package/dist/esm/version.mjs +1 -1
  56. package/package.json +1 -1
  57. package/reference.md +4 -0
package/README.md CHANGED
@@ -60,6 +60,7 @@ await client.agents.create({
60
60
  },
61
61
  },
62
62
  tools: ["keypad_input"],
63
+ generate_no_input_poke_text: false,
63
64
  no_input_poke_sec: 30,
64
65
  no_input_poke_text: "Are you still there?",
65
66
  languages: ["en", "es"],
@@ -51,8 +51,8 @@ class PhonicClient {
51
51
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
52
52
  "X-Fern-Language": "JavaScript",
53
53
  "X-Fern-SDK-Name": "phonic",
54
- "X-Fern-SDK-Version": "0.30.35",
55
- "User-Agent": "phonic/0.30.35",
54
+ "X-Fern-SDK-Version": "0.30.37",
55
+ "User-Agent": "phonic/0.30.37",
56
56
  "X-Fern-Runtime": core.RUNTIME.type,
57
57
  "X-Fern-Runtime-Version": core.RUNTIME.version,
58
58
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -76,6 +76,7 @@ export declare class Agents {
76
76
  * }
77
77
  * },
78
78
  * tools: ["keypad_input"],
79
+ * generate_no_input_poke_text: false,
79
80
  * no_input_poke_sec: 30,
80
81
  * no_input_poke_text: "Are you still there?",
81
82
  * languages: ["en", "es"],
@@ -121,6 +122,7 @@ export declare class Agents {
121
122
  * }
122
123
  * },
123
124
  * tools: ["keypad_input"],
125
+ * generate_no_input_poke_text: false,
124
126
  * no_input_poke_sec: 30,
125
127
  * no_input_poke_text: "Are you still there?",
126
128
  * languages: ["en", "es"],
@@ -202,6 +204,7 @@ export declare class Agents {
202
204
  * }
203
205
  * },
204
206
  * tools: ["keypad_input"],
207
+ * generate_no_input_poke_text: false,
205
208
  * no_input_poke_sec: 30,
206
209
  * no_input_poke_text: "Are you still there?",
207
210
  * languages: ["en", "es"],
@@ -215,7 +218,7 @@ export declare class Agents {
215
218
  * }
216
219
  * })
217
220
  */
218
- update(nameOrId: string, request: Phonic.UpdateAgentRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdateResponse>;
221
+ update(nameOrId: string, request?: Phonic.UpdateAgentRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdateResponse>;
219
222
  private __update;
220
223
  /**
221
224
  * Adds a custom phone number to an agent. The user must configure their SIP trunk to point to Phonic's SIP server.
@@ -294,5 +297,5 @@ export declare class Agents {
294
297
  */
295
298
  updatePhoneNumber(nameOrId: string, request: Phonic.AgentsUpdatePhoneNumberRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdatePhoneNumberResponse>;
296
299
  private __updatePhoneNumber;
297
- protected _getAuthorizationHeader(): Promise<string | undefined>;
300
+ protected _getAuthorizationHeader(): Promise<string>;
298
301
  }
@@ -166,6 +166,7 @@ class Agents {
166
166
  * }
167
167
  * },
168
168
  * tools: ["keypad_input"],
169
+ * generate_no_input_poke_text: false,
169
170
  * no_input_poke_sec: 30,
170
171
  * no_input_poke_text: "Are you still there?",
171
172
  * languages: ["en", "es"],
@@ -272,6 +273,7 @@ class Agents {
272
273
  * }
273
274
  * },
274
275
  * tools: ["keypad_input"],
276
+ * generate_no_input_poke_text: false,
275
277
  * no_input_poke_sec: 30,
276
278
  * no_input_poke_text: "Are you still there?",
277
279
  * languages: ["en", "es"],
@@ -518,6 +520,7 @@ class Agents {
518
520
  * }
519
521
  * },
520
522
  * tools: ["keypad_input"],
523
+ * generate_no_input_poke_text: false,
521
524
  * no_input_poke_sec: 30,
522
525
  * no_input_poke_text: "Are you still there?",
523
526
  * languages: ["en", "es"],
@@ -531,11 +534,11 @@ class Agents {
531
534
  * }
532
535
  * })
533
536
  */
534
- update(nameOrId, request, requestOptions) {
537
+ update(nameOrId, request = {}, requestOptions) {
535
538
  return core.HttpResponsePromise.fromPromise(this.__update(nameOrId, request, requestOptions));
536
539
  }
537
- __update(nameOrId, request, requestOptions) {
538
- return __awaiter(this, void 0, void 0, function* () {
540
+ __update(nameOrId_1) {
541
+ return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
539
542
  var _a, _b, _c, _d;
540
543
  const { project } = request, _body = __rest(request, ["project"]);
541
544
  const _queryParams = {};
@@ -876,10 +879,12 @@ class Agents {
876
879
  return __awaiter(this, void 0, void 0, function* () {
877
880
  var _a;
878
881
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
879
- if (bearer != null) {
880
- return `Bearer ${bearer}`;
882
+ if (bearer == null) {
883
+ throw new errors.PhonicError({
884
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
885
+ });
881
886
  }
882
- return undefined;
887
+ return `Bearer ${bearer}`;
883
888
  });
884
889
  }
885
890
  }
@@ -24,6 +24,7 @@ import * as Phonic from "../../../../index.js";
24
24
  * }
25
25
  * },
26
26
  * tools: ["keypad_input"],
27
+ * generate_no_input_poke_text: false,
27
28
  * no_input_poke_sec: 30,
28
29
  * no_input_poke_text: "Are you still there?",
29
30
  * languages: ["en", "es"],
@@ -42,7 +43,8 @@ export interface AgentsCreateRequest {
42
43
  project?: string;
43
44
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
44
45
  name: string;
45
- phone_number: Phonic.CreateAgentRequest.PhoneNumber | null;
46
+ /** When set to `null`, the agent will not be associated with a phone number. When set to `"assign-automatically"`, the agent will be assigned a random phone number. When set to `"custom"`, you must provide `custom_phone_numbers`. */
47
+ phone_number?: Phonic.CreateAgentRequest.PhoneNumber | null;
46
48
  /** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
47
49
  custom_phone_number?: string | null;
48
50
  /** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
@@ -71,9 +73,11 @@ export interface AgentsCreateRequest {
71
73
  tools?: Phonic.CreateAgentRequest.Tools.Item[];
72
74
  /** Array of task objects with `name` and `description` fields. */
73
75
  tasks?: Phonic.Task[];
76
+ /** Whether to have the no-input poke text be generated by AI. */
77
+ generate_no_input_poke_text?: boolean;
74
78
  /** Number of seconds of silence before sending a poke message. `null` disables the poke message. */
75
79
  no_input_poke_sec?: number | null;
76
- /** The message to send after the specified silence. */
80
+ /** The message to send after the specified silence. Ignored when generate_no_input_poke_text is true. */
77
81
  no_input_poke_text?: string;
78
82
  /** Seconds of silence before ending the conversation. */
79
83
  no_input_end_conversation_sec?: number;
@@ -24,6 +24,7 @@ import * as Phonic from "../../../../index.js";
24
24
  * }
25
25
  * },
26
26
  * tools: ["keypad_input"],
27
+ * generate_no_input_poke_text: false,
27
28
  * no_input_poke_sec: 30,
28
29
  * no_input_poke_text: "Are you still there?",
29
30
  * languages: ["en", "es"],
@@ -42,7 +43,8 @@ export interface UpdateAgentRequest {
42
43
  project?: string;
43
44
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
44
45
  name?: string;
45
- phone_number: UpdateAgentRequest.PhoneNumber | null;
46
+ /** When set to `null`, the agent will not be associated with a phone number anymore. When set to `"assign-automatically"`, the agent will be assigned a random phone number if it doesn't have one yet. If the agent already has a phone number, `"assign-automatically"` has no effect. When set to `"custom"`, you must provide `custom_phone_numbers`. */
47
+ phone_number?: UpdateAgentRequest.PhoneNumber | null;
46
48
  /** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
47
49
  custom_phone_number?: string | null;
48
50
  /** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
@@ -71,9 +73,11 @@ export interface UpdateAgentRequest {
71
73
  tools?: UpdateAgentRequest.Tools.Item[];
72
74
  /** Array of task objects with `name` and `description` fields. */
73
75
  tasks?: Phonic.Task[];
76
+ /** Whether to have the no-input poke text be generated by AI. */
77
+ generate_no_input_poke_text?: boolean;
74
78
  /** Number of seconds of silence before sending a poke message. `null` disables the poke message. */
75
79
  no_input_poke_sec?: number | null;
76
- /** The message to send after the specified silence. */
80
+ /** The message to send after the specified silence. Ignored when generate_no_input_poke_text is true. */
77
81
  no_input_poke_text?: string;
78
82
  /** Seconds of silence before ending the conversation. */
79
83
  no_input_end_conversation_sec?: number;
@@ -24,6 +24,7 @@ import * as Phonic from "../../../../index.js";
24
24
  * }
25
25
  * },
26
26
  * tools: ["keypad_input"],
27
+ * generate_no_input_poke_text: false,
27
28
  * no_input_poke_sec: 30,
28
29
  * no_input_poke_text: "Are you still there?",
29
30
  * languages: ["en", "es"],
@@ -48,5 +48,5 @@ export declare class Auth {
48
48
  */
49
49
  createSessionToken(request?: Phonic.CreateSessionTokenRequest, requestOptions?: Auth.RequestOptions): core.HttpResponsePromise<Phonic.AuthCreateSessionTokenResponse>;
50
50
  private __createSessionToken;
51
- protected _getAuthorizationHeader(): Promise<string | undefined>;
51
+ protected _getAuthorizationHeader(): Promise<string>;
52
52
  }
@@ -136,10 +136,12 @@ class Auth {
136
136
  return __awaiter(this, void 0, void 0, function* () {
137
137
  var _a;
138
138
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
139
- if (bearer != null) {
140
- return `Bearer ${bearer}`;
139
+ if (bearer == null) {
140
+ throw new errors.PhonicError({
141
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
142
+ });
141
143
  }
142
- return undefined;
144
+ return `Bearer ${bearer}`;
143
145
  });
144
146
  }
145
147
  }
@@ -202,6 +202,7 @@ export declare class Conversations {
202
202
  * "subject": "Chess"
203
203
  * },
204
204
  * voice_id: "sabrina",
205
+ * generate_no_input_poke_text: false,
205
206
  * no_input_poke_sec: 30,
206
207
  * no_input_poke_text: "Are you still there?",
207
208
  * no_input_end_conversation_sec: 180,
@@ -233,5 +234,5 @@ export declare class Conversations {
233
234
  sipOutboundCall(request: Phonic.ConversationsSipOutboundCallRequest, requestOptions?: Conversations.RequestOptions): core.HttpResponsePromise<Phonic.ConversationsSipOutboundCallResponse>;
234
235
  private __sipOutboundCall;
235
236
  connect(args?: Conversations.ConnectArgs): Promise<ConversationsSocket>;
236
- protected _getAuthorizationHeader(): Promise<string | undefined>;
237
+ protected _getAuthorizationHeader(): Promise<string>;
237
238
  }
@@ -710,6 +710,7 @@ class Conversations {
710
710
  * "subject": "Chess"
711
711
  * },
712
712
  * voice_id: "sabrina",
713
+ * generate_no_input_poke_text: false,
713
714
  * no_input_poke_sec: 30,
714
715
  * no_input_poke_text: "Are you still there?",
715
716
  * no_input_end_conversation_sec: 180,
@@ -886,10 +887,12 @@ class Conversations {
886
887
  return __awaiter(this, void 0, void 0, function* () {
887
888
  var _a;
888
889
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
889
- if (bearer != null) {
890
- return `Bearer ${bearer}`;
890
+ if (bearer == null) {
891
+ throw new errors.PhonicError({
892
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
893
+ });
891
894
  }
892
- return undefined;
895
+ return `Bearer ${bearer}`;
893
896
  });
894
897
  }
895
898
  }
@@ -15,6 +15,7 @@ import * as Phonic from "../../../../index.js";
15
15
  * "subject": "Chess"
16
16
  * },
17
17
  * voice_id: "sabrina",
18
+ * generate_no_input_poke_text: false,
18
19
  * no_input_poke_sec: 30,
19
20
  * no_input_poke_text: "Are you still there?",
20
21
  * no_input_end_conversation_sec: 180,
@@ -138,5 +138,5 @@ export declare class ExtractionSchemas {
138
138
  */
139
139
  update(nameOrId: string, request?: Phonic.UpdateExtractionSchemaRequest, requestOptions?: ExtractionSchemas.RequestOptions): core.HttpResponsePromise<Phonic.ExtractionSchemasUpdateResponse>;
140
140
  private __update;
141
- protected _getAuthorizationHeader(): Promise<string | undefined>;
141
+ protected _getAuthorizationHeader(): Promise<string>;
142
142
  }
@@ -461,10 +461,12 @@ class ExtractionSchemas {
461
461
  return __awaiter(this, void 0, void 0, function* () {
462
462
  var _a;
463
463
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
464
- if (bearer != null) {
465
- return `Bearer ${bearer}`;
464
+ if (bearer == null) {
465
+ throw new errors.PhonicError({
466
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
467
+ });
466
468
  }
467
- return undefined;
469
+ return `Bearer ${bearer}`;
468
470
  });
469
471
  }
470
472
  }
@@ -113,7 +113,7 @@ export declare class Projects {
113
113
  * default_agent: "another-agent"
114
114
  * })
115
115
  */
116
- update(nameOrId: string, request: Phonic.UpdateProjectRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsUpdateResponse>;
116
+ update(nameOrId: string, request?: Phonic.UpdateProjectRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsUpdateResponse>;
117
117
  private __update;
118
118
  /**
119
119
  * Returns all conversation evaluation prompts for a project.
@@ -153,5 +153,5 @@ export declare class Projects {
153
153
  */
154
154
  createEvalPrompt(id: string, request: Phonic.CreateConversationEvalPromptRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsCreateEvalPromptResponse>;
155
155
  private __createEvalPrompt;
156
- protected _getAuthorizationHeader(): Promise<string | undefined>;
156
+ protected _getAuthorizationHeader(): Promise<string>;
157
157
  }
@@ -349,11 +349,11 @@ class Projects {
349
349
  * default_agent: "another-agent"
350
350
  * })
351
351
  */
352
- update(nameOrId, request, requestOptions) {
352
+ update(nameOrId, request = {}, requestOptions) {
353
353
  return core.HttpResponsePromise.fromPromise(this.__update(nameOrId, request, requestOptions));
354
354
  }
355
- __update(nameOrId, request, requestOptions) {
356
- return __awaiter(this, void 0, void 0, function* () {
355
+ __update(nameOrId_1) {
356
+ return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
357
357
  var _a, _b, _c, _d;
358
358
  let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
359
359
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
@@ -572,10 +572,12 @@ class Projects {
572
572
  return __awaiter(this, void 0, void 0, function* () {
573
573
  var _a;
574
574
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
575
- if (bearer != null) {
576
- return `Bearer ${bearer}`;
575
+ if (bearer == null) {
576
+ throw new errors.PhonicError({
577
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
578
+ });
577
579
  }
578
- return undefined;
580
+ return `Bearer ${bearer}`;
579
581
  });
580
582
  }
581
583
  }
@@ -11,5 +11,6 @@
11
11
  export interface UpdateProjectRequest {
12
12
  /** The name of the project. Can only contain lowercase letters, numbers and hyphens. Must be unique within the workspace. */
13
13
  name?: string;
14
- default_agent: string | null;
14
+ /** The name of the new project's default agent. Set to `null` to remove the default agent. */
15
+ default_agent?: string | null;
15
16
  }
@@ -210,5 +210,5 @@ export declare class Tools {
210
210
  */
211
211
  update(nameOrId: string, request?: Phonic.UpdateToolRequest, requestOptions?: Tools.RequestOptions): core.HttpResponsePromise<Phonic.ToolsUpdateResponse>;
212
212
  private __update;
213
- protected _getAuthorizationHeader(): Promise<string | undefined>;
213
+ protected _getAuthorizationHeader(): Promise<string>;
214
214
  }
@@ -526,10 +526,12 @@ class Tools {
526
526
  return __awaiter(this, void 0, void 0, function* () {
527
527
  var _a;
528
528
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
529
- if (bearer != null) {
530
- return `Bearer ${bearer}`;
529
+ if (bearer == null) {
530
+ throw new errors.PhonicError({
531
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
532
+ });
531
533
  }
532
- return undefined;
534
+ return `Bearer ${bearer}`;
533
535
  });
534
536
  }
535
537
  }
@@ -61,5 +61,5 @@ export declare class Voices {
61
61
  */
62
62
  get(id: string, requestOptions?: Voices.RequestOptions): core.HttpResponsePromise<Phonic.VoicesGetResponse>;
63
63
  private __get;
64
- protected _getAuthorizationHeader(): Promise<string | undefined>;
64
+ protected _getAuthorizationHeader(): Promise<string>;
65
65
  }
@@ -193,10 +193,12 @@ class Voices {
193
193
  return __awaiter(this, void 0, void 0, function* () {
194
194
  var _a;
195
195
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
196
- if (bearer != null) {
197
- return `Bearer ${bearer}`;
196
+ if (bearer == null) {
197
+ throw new errors.PhonicError({
198
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
199
+ });
198
200
  }
199
- return undefined;
201
+ return `Bearer ${bearer}`;
200
202
  });
201
203
  }
202
204
  }
@@ -37,9 +37,11 @@ export interface Agent {
37
37
  tools: Agent.Tools.Item[];
38
38
  /** Tasks for the agent to complete during the conversation. */
39
39
  tasks: Phonic.Task[];
40
+ /** Whether to have the no-input poke text be generated by AI. */
41
+ generate_no_input_poke_text: boolean;
40
42
  /** Number of seconds of silence before sending a poke message. `null` disables the poke message. */
41
43
  no_input_poke_sec: number | null;
42
- /** The message to send after the specified silence. */
44
+ /** The message to send after the specified silence. Ignored when generate_no_input_poke_text is true. */
43
45
  no_input_poke_text: string;
44
46
  /** Seconds of silence before ending the conversation. */
45
47
  no_input_end_conversation_sec: number;
@@ -39,9 +39,11 @@ export interface ConfigPayload {
39
39
  enable_documents_rag?: boolean;
40
40
  /** Enable transcript RAG */
41
41
  enable_transcripts_rag?: boolean;
42
+ /** Whether to have the no-input poke text be generated by AI */
43
+ generate_no_input_poke_text?: boolean;
42
44
  /** Seconds of silence before poke message */
43
45
  no_input_poke_sec?: number | null;
44
- /** Poke message text */
46
+ /** Poke message text. Ignored when generate_no_input_poke_text is true. */
45
47
  no_input_poke_text?: string;
46
48
  /** Seconds of silence before ending conversation */
47
49
  no_input_end_conversation_sec?: number;
@@ -47,9 +47,11 @@ export interface Conversation {
47
47
  boosted_keywords: string[] | null;
48
48
  /** Array of ISO 639-1 language codes recognized by the model. */
49
49
  languages: string[] | null;
50
+ /** Whether the no-input poke text was generated by AI. */
51
+ generate_no_input_poke_text?: boolean | null;
50
52
  /** Number of seconds of silence before a poke message is sent. `null` means the poke message is disabled. */
51
53
  no_input_poke_sec: number | null;
52
- /** The message to send after the specified silence. Relevant only if `no_input_poke_sec` is not `null`. */
54
+ /** The message to send after the specified silence. Relevant only if `no_input_poke_sec` is not `null`. Ignored when generate_no_input_poke_text is true. */
53
55
  no_input_poke_text: string | null;
54
56
  /** Seconds of silence before the conversation is ended. */
55
57
  no_input_end_conversation_sec: number | null;
@@ -5,7 +5,8 @@ import * as Phonic from "../index.js";
5
5
  export interface CreateAgentRequest {
6
6
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
7
7
  name: string;
8
- phone_number: CreateAgentRequest.PhoneNumber | null;
8
+ /** When set to `null`, the agent will not be associated with a phone number. When set to `"assign-automatically"`, the agent will be assigned a random phone number. When set to `"custom"`, you must provide `custom_phone_numbers`. */
9
+ phone_number?: CreateAgentRequest.PhoneNumber | null;
9
10
  /** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
10
11
  custom_phone_number?: string | null;
11
12
  /** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
@@ -34,9 +35,11 @@ export interface CreateAgentRequest {
34
35
  tools?: CreateAgentRequest.Tools.Item[];
35
36
  /** Array of task objects with `name` and `description` fields. */
36
37
  tasks?: Phonic.Task[];
38
+ /** Whether to have the no-input poke text be generated by AI. */
39
+ generate_no_input_poke_text?: boolean;
37
40
  /** Number of seconds of silence before sending a poke message. `null` disables the poke message. */
38
41
  no_input_poke_sec?: number | null;
39
- /** The message to send after the specified silence. */
42
+ /** The message to send after the specified silence. Ignored when generate_no_input_poke_text is true. */
40
43
  no_input_poke_text?: string;
41
44
  /** Seconds of silence before ending the conversation. */
42
45
  no_input_end_conversation_sec?: number;
@@ -18,9 +18,11 @@ export interface OutboundCallConfig {
18
18
  template_variables?: Record<string, string>;
19
19
  /** The voice ID to use for the agent. */
20
20
  voice_id?: string;
21
+ /** Whether to have the no-input poke text be generated by AI. */
22
+ generate_no_input_poke_text?: boolean;
21
23
  /** Number of seconds of silence before sending a poke message. `null` disables the poke message. */
22
24
  no_input_poke_sec?: number | null;
23
- /** The message to send after the specified silence. */
25
+ /** The message to send after the specified silence. Ignored when generate_no_input_poke_text is true. */
24
26
  no_input_poke_text?: string;
25
27
  /** Seconds of silence before ending the conversation. */
26
28
  no_input_end_conversation_sec?: number;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.30.35";
1
+ export declare const SDK_VERSION = "0.30.37";
@@ -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.30.35";
4
+ exports.SDK_VERSION = "0.30.37";
@@ -15,8 +15,8 @@ export class PhonicClient {
15
15
  this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
16
16
  "X-Fern-Language": "JavaScript",
17
17
  "X-Fern-SDK-Name": "phonic",
18
- "X-Fern-SDK-Version": "0.30.35",
19
- "User-Agent": "phonic/0.30.35",
18
+ "X-Fern-SDK-Version": "0.30.37",
19
+ "User-Agent": "phonic/0.30.37",
20
20
  "X-Fern-Runtime": core.RUNTIME.type,
21
21
  "X-Fern-Runtime-Version": core.RUNTIME.version,
22
22
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -76,6 +76,7 @@ export declare class Agents {
76
76
  * }
77
77
  * },
78
78
  * tools: ["keypad_input"],
79
+ * generate_no_input_poke_text: false,
79
80
  * no_input_poke_sec: 30,
80
81
  * no_input_poke_text: "Are you still there?",
81
82
  * languages: ["en", "es"],
@@ -121,6 +122,7 @@ export declare class Agents {
121
122
  * }
122
123
  * },
123
124
  * tools: ["keypad_input"],
125
+ * generate_no_input_poke_text: false,
124
126
  * no_input_poke_sec: 30,
125
127
  * no_input_poke_text: "Are you still there?",
126
128
  * languages: ["en", "es"],
@@ -202,6 +204,7 @@ export declare class Agents {
202
204
  * }
203
205
  * },
204
206
  * tools: ["keypad_input"],
207
+ * generate_no_input_poke_text: false,
205
208
  * no_input_poke_sec: 30,
206
209
  * no_input_poke_text: "Are you still there?",
207
210
  * languages: ["en", "es"],
@@ -215,7 +218,7 @@ export declare class Agents {
215
218
  * }
216
219
  * })
217
220
  */
218
- update(nameOrId: string, request: Phonic.UpdateAgentRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdateResponse>;
221
+ update(nameOrId: string, request?: Phonic.UpdateAgentRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdateResponse>;
219
222
  private __update;
220
223
  /**
221
224
  * Adds a custom phone number to an agent. The user must configure their SIP trunk to point to Phonic's SIP server.
@@ -294,5 +297,5 @@ export declare class Agents {
294
297
  */
295
298
  updatePhoneNumber(nameOrId: string, request: Phonic.AgentsUpdatePhoneNumberRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdatePhoneNumberResponse>;
296
299
  private __updatePhoneNumber;
297
- protected _getAuthorizationHeader(): Promise<string | undefined>;
300
+ protected _getAuthorizationHeader(): Promise<string>;
298
301
  }
@@ -130,6 +130,7 @@ export class Agents {
130
130
  * }
131
131
  * },
132
132
  * tools: ["keypad_input"],
133
+ * generate_no_input_poke_text: false,
133
134
  * no_input_poke_sec: 30,
134
135
  * no_input_poke_text: "Are you still there?",
135
136
  * languages: ["en", "es"],
@@ -236,6 +237,7 @@ export class Agents {
236
237
  * }
237
238
  * },
238
239
  * tools: ["keypad_input"],
240
+ * generate_no_input_poke_text: false,
239
241
  * no_input_poke_sec: 30,
240
242
  * no_input_poke_text: "Are you still there?",
241
243
  * languages: ["en", "es"],
@@ -482,6 +484,7 @@ export class Agents {
482
484
  * }
483
485
  * },
484
486
  * tools: ["keypad_input"],
487
+ * generate_no_input_poke_text: false,
485
488
  * no_input_poke_sec: 30,
486
489
  * no_input_poke_text: "Are you still there?",
487
490
  * languages: ["en", "es"],
@@ -495,11 +498,11 @@ export class Agents {
495
498
  * }
496
499
  * })
497
500
  */
498
- update(nameOrId, request, requestOptions) {
501
+ update(nameOrId, request = {}, requestOptions) {
499
502
  return core.HttpResponsePromise.fromPromise(this.__update(nameOrId, request, requestOptions));
500
503
  }
501
- __update(nameOrId, request, requestOptions) {
502
- return __awaiter(this, void 0, void 0, function* () {
504
+ __update(nameOrId_1) {
505
+ return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
503
506
  var _a, _b, _c, _d;
504
507
  const { project } = request, _body = __rest(request, ["project"]);
505
508
  const _queryParams = {};
@@ -840,10 +843,12 @@ export class Agents {
840
843
  return __awaiter(this, void 0, void 0, function* () {
841
844
  var _a;
842
845
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
843
- if (bearer != null) {
844
- return `Bearer ${bearer}`;
846
+ if (bearer == null) {
847
+ throw new errors.PhonicError({
848
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
849
+ });
845
850
  }
846
- return undefined;
851
+ return `Bearer ${bearer}`;
847
852
  });
848
853
  }
849
854
  }
@@ -24,6 +24,7 @@ import * as Phonic from "../../../../index.mjs";
24
24
  * }
25
25
  * },
26
26
  * tools: ["keypad_input"],
27
+ * generate_no_input_poke_text: false,
27
28
  * no_input_poke_sec: 30,
28
29
  * no_input_poke_text: "Are you still there?",
29
30
  * languages: ["en", "es"],
@@ -42,7 +43,8 @@ export interface AgentsCreateRequest {
42
43
  project?: string;
43
44
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
44
45
  name: string;
45
- phone_number: Phonic.CreateAgentRequest.PhoneNumber | null;
46
+ /** When set to `null`, the agent will not be associated with a phone number. When set to `"assign-automatically"`, the agent will be assigned a random phone number. When set to `"custom"`, you must provide `custom_phone_numbers`. */
47
+ phone_number?: Phonic.CreateAgentRequest.PhoneNumber | null;
46
48
  /** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
47
49
  custom_phone_number?: string | null;
48
50
  /** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
@@ -71,9 +73,11 @@ export interface AgentsCreateRequest {
71
73
  tools?: Phonic.CreateAgentRequest.Tools.Item[];
72
74
  /** Array of task objects with `name` and `description` fields. */
73
75
  tasks?: Phonic.Task[];
76
+ /** Whether to have the no-input poke text be generated by AI. */
77
+ generate_no_input_poke_text?: boolean;
74
78
  /** Number of seconds of silence before sending a poke message. `null` disables the poke message. */
75
79
  no_input_poke_sec?: number | null;
76
- /** The message to send after the specified silence. */
80
+ /** The message to send after the specified silence. Ignored when generate_no_input_poke_text is true. */
77
81
  no_input_poke_text?: string;
78
82
  /** Seconds of silence before ending the conversation. */
79
83
  no_input_end_conversation_sec?: number;
@@ -24,6 +24,7 @@ import * as Phonic from "../../../../index.mjs";
24
24
  * }
25
25
  * },
26
26
  * tools: ["keypad_input"],
27
+ * generate_no_input_poke_text: false,
27
28
  * no_input_poke_sec: 30,
28
29
  * no_input_poke_text: "Are you still there?",
29
30
  * languages: ["en", "es"],
@@ -42,7 +43,8 @@ export interface UpdateAgentRequest {
42
43
  project?: string;
43
44
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
44
45
  name?: string;
45
- phone_number: UpdateAgentRequest.PhoneNumber | null;
46
+ /** When set to `null`, the agent will not be associated with a phone number anymore. When set to `"assign-automatically"`, the agent will be assigned a random phone number if it doesn't have one yet. If the agent already has a phone number, `"assign-automatically"` has no effect. When set to `"custom"`, you must provide `custom_phone_numbers`. */
47
+ phone_number?: UpdateAgentRequest.PhoneNumber | null;
46
48
  /** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
47
49
  custom_phone_number?: string | null;
48
50
  /** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
@@ -71,9 +73,11 @@ export interface UpdateAgentRequest {
71
73
  tools?: UpdateAgentRequest.Tools.Item[];
72
74
  /** Array of task objects with `name` and `description` fields. */
73
75
  tasks?: Phonic.Task[];
76
+ /** Whether to have the no-input poke text be generated by AI. */
77
+ generate_no_input_poke_text?: boolean;
74
78
  /** Number of seconds of silence before sending a poke message. `null` disables the poke message. */
75
79
  no_input_poke_sec?: number | null;
76
- /** The message to send after the specified silence. */
80
+ /** The message to send after the specified silence. Ignored when generate_no_input_poke_text is true. */
77
81
  no_input_poke_text?: string;
78
82
  /** Seconds of silence before ending the conversation. */
79
83
  no_input_end_conversation_sec?: number;
@@ -24,6 +24,7 @@ import * as Phonic from "../../../../index.mjs";
24
24
  * }
25
25
  * },
26
26
  * tools: ["keypad_input"],
27
+ * generate_no_input_poke_text: false,
27
28
  * no_input_poke_sec: 30,
28
29
  * no_input_poke_text: "Are you still there?",
29
30
  * languages: ["en", "es"],
@@ -48,5 +48,5 @@ export declare class Auth {
48
48
  */
49
49
  createSessionToken(request?: Phonic.CreateSessionTokenRequest, requestOptions?: Auth.RequestOptions): core.HttpResponsePromise<Phonic.AuthCreateSessionTokenResponse>;
50
50
  private __createSessionToken;
51
- protected _getAuthorizationHeader(): Promise<string | undefined>;
51
+ protected _getAuthorizationHeader(): Promise<string>;
52
52
  }
@@ -100,10 +100,12 @@ export class Auth {
100
100
  return __awaiter(this, void 0, void 0, function* () {
101
101
  var _a;
102
102
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
103
- if (bearer != null) {
104
- return `Bearer ${bearer}`;
103
+ if (bearer == null) {
104
+ throw new errors.PhonicError({
105
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
106
+ });
105
107
  }
106
- return undefined;
108
+ return `Bearer ${bearer}`;
107
109
  });
108
110
  }
109
111
  }
@@ -202,6 +202,7 @@ export declare class Conversations {
202
202
  * "subject": "Chess"
203
203
  * },
204
204
  * voice_id: "sabrina",
205
+ * generate_no_input_poke_text: false,
205
206
  * no_input_poke_sec: 30,
206
207
  * no_input_poke_text: "Are you still there?",
207
208
  * no_input_end_conversation_sec: 180,
@@ -233,5 +234,5 @@ export declare class Conversations {
233
234
  sipOutboundCall(request: Phonic.ConversationsSipOutboundCallRequest, requestOptions?: Conversations.RequestOptions): core.HttpResponsePromise<Phonic.ConversationsSipOutboundCallResponse>;
234
235
  private __sipOutboundCall;
235
236
  connect(args?: Conversations.ConnectArgs): Promise<ConversationsSocket>;
236
- protected _getAuthorizationHeader(): Promise<string | undefined>;
237
+ protected _getAuthorizationHeader(): Promise<string>;
237
238
  }
@@ -674,6 +674,7 @@ export class Conversations {
674
674
  * "subject": "Chess"
675
675
  * },
676
676
  * voice_id: "sabrina",
677
+ * generate_no_input_poke_text: false,
677
678
  * no_input_poke_sec: 30,
678
679
  * no_input_poke_text: "Are you still there?",
679
680
  * no_input_end_conversation_sec: 180,
@@ -850,10 +851,12 @@ export class Conversations {
850
851
  return __awaiter(this, void 0, void 0, function* () {
851
852
  var _a;
852
853
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
853
- if (bearer != null) {
854
- return `Bearer ${bearer}`;
854
+ if (bearer == null) {
855
+ throw new errors.PhonicError({
856
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
857
+ });
855
858
  }
856
- return undefined;
859
+ return `Bearer ${bearer}`;
857
860
  });
858
861
  }
859
862
  }
@@ -15,6 +15,7 @@ import * as Phonic from "../../../../index.mjs";
15
15
  * "subject": "Chess"
16
16
  * },
17
17
  * voice_id: "sabrina",
18
+ * generate_no_input_poke_text: false,
18
19
  * no_input_poke_sec: 30,
19
20
  * no_input_poke_text: "Are you still there?",
20
21
  * no_input_end_conversation_sec: 180,
@@ -138,5 +138,5 @@ export declare class ExtractionSchemas {
138
138
  */
139
139
  update(nameOrId: string, request?: Phonic.UpdateExtractionSchemaRequest, requestOptions?: ExtractionSchemas.RequestOptions): core.HttpResponsePromise<Phonic.ExtractionSchemasUpdateResponse>;
140
140
  private __update;
141
- protected _getAuthorizationHeader(): Promise<string | undefined>;
141
+ protected _getAuthorizationHeader(): Promise<string>;
142
142
  }
@@ -425,10 +425,12 @@ export class ExtractionSchemas {
425
425
  return __awaiter(this, void 0, void 0, function* () {
426
426
  var _a;
427
427
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
428
- if (bearer != null) {
429
- return `Bearer ${bearer}`;
428
+ if (bearer == null) {
429
+ throw new errors.PhonicError({
430
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
431
+ });
430
432
  }
431
- return undefined;
433
+ return `Bearer ${bearer}`;
432
434
  });
433
435
  }
434
436
  }
@@ -113,7 +113,7 @@ export declare class Projects {
113
113
  * default_agent: "another-agent"
114
114
  * })
115
115
  */
116
- update(nameOrId: string, request: Phonic.UpdateProjectRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsUpdateResponse>;
116
+ update(nameOrId: string, request?: Phonic.UpdateProjectRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsUpdateResponse>;
117
117
  private __update;
118
118
  /**
119
119
  * Returns all conversation evaluation prompts for a project.
@@ -153,5 +153,5 @@ export declare class Projects {
153
153
  */
154
154
  createEvalPrompt(id: string, request: Phonic.CreateConversationEvalPromptRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsCreateEvalPromptResponse>;
155
155
  private __createEvalPrompt;
156
- protected _getAuthorizationHeader(): Promise<string | undefined>;
156
+ protected _getAuthorizationHeader(): Promise<string>;
157
157
  }
@@ -313,11 +313,11 @@ export class Projects {
313
313
  * default_agent: "another-agent"
314
314
  * })
315
315
  */
316
- update(nameOrId, request, requestOptions) {
316
+ update(nameOrId, request = {}, requestOptions) {
317
317
  return core.HttpResponsePromise.fromPromise(this.__update(nameOrId, request, requestOptions));
318
318
  }
319
- __update(nameOrId, request, requestOptions) {
320
- return __awaiter(this, void 0, void 0, function* () {
319
+ __update(nameOrId_1) {
320
+ return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
321
321
  var _a, _b, _c, _d;
322
322
  let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
323
323
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
@@ -536,10 +536,12 @@ export class Projects {
536
536
  return __awaiter(this, void 0, void 0, function* () {
537
537
  var _a;
538
538
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
539
- if (bearer != null) {
540
- return `Bearer ${bearer}`;
539
+ if (bearer == null) {
540
+ throw new errors.PhonicError({
541
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
542
+ });
541
543
  }
542
- return undefined;
544
+ return `Bearer ${bearer}`;
543
545
  });
544
546
  }
545
547
  }
@@ -11,5 +11,6 @@
11
11
  export interface UpdateProjectRequest {
12
12
  /** The name of the project. Can only contain lowercase letters, numbers and hyphens. Must be unique within the workspace. */
13
13
  name?: string;
14
- default_agent: string | null;
14
+ /** The name of the new project's default agent. Set to `null` to remove the default agent. */
15
+ default_agent?: string | null;
15
16
  }
@@ -210,5 +210,5 @@ export declare class Tools {
210
210
  */
211
211
  update(nameOrId: string, request?: Phonic.UpdateToolRequest, requestOptions?: Tools.RequestOptions): core.HttpResponsePromise<Phonic.ToolsUpdateResponse>;
212
212
  private __update;
213
- protected _getAuthorizationHeader(): Promise<string | undefined>;
213
+ protected _getAuthorizationHeader(): Promise<string>;
214
214
  }
@@ -490,10 +490,12 @@ export class Tools {
490
490
  return __awaiter(this, void 0, void 0, function* () {
491
491
  var _a;
492
492
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
493
- if (bearer != null) {
494
- return `Bearer ${bearer}`;
493
+ if (bearer == null) {
494
+ throw new errors.PhonicError({
495
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
496
+ });
495
497
  }
496
- return undefined;
498
+ return `Bearer ${bearer}`;
497
499
  });
498
500
  }
499
501
  }
@@ -61,5 +61,5 @@ export declare class Voices {
61
61
  */
62
62
  get(id: string, requestOptions?: Voices.RequestOptions): core.HttpResponsePromise<Phonic.VoicesGetResponse>;
63
63
  private __get;
64
- protected _getAuthorizationHeader(): Promise<string | undefined>;
64
+ protected _getAuthorizationHeader(): Promise<string>;
65
65
  }
@@ -157,10 +157,12 @@ export class Voices {
157
157
  return __awaiter(this, void 0, void 0, function* () {
158
158
  var _a;
159
159
  const bearer = (_a = (yield core.Supplier.get(this._options.apiKey))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["PHONIC_API_KEY"];
160
- if (bearer != null) {
161
- return `Bearer ${bearer}`;
160
+ if (bearer == null) {
161
+ throw new errors.PhonicError({
162
+ message: "Please specify a bearer by either passing it in to the constructor or initializing a PHONIC_API_KEY environment variable",
163
+ });
162
164
  }
163
- return undefined;
165
+ return `Bearer ${bearer}`;
164
166
  });
165
167
  }
166
168
  }
@@ -37,9 +37,11 @@ export interface Agent {
37
37
  tools: Agent.Tools.Item[];
38
38
  /** Tasks for the agent to complete during the conversation. */
39
39
  tasks: Phonic.Task[];
40
+ /** Whether to have the no-input poke text be generated by AI. */
41
+ generate_no_input_poke_text: boolean;
40
42
  /** Number of seconds of silence before sending a poke message. `null` disables the poke message. */
41
43
  no_input_poke_sec: number | null;
42
- /** The message to send after the specified silence. */
44
+ /** The message to send after the specified silence. Ignored when generate_no_input_poke_text is true. */
43
45
  no_input_poke_text: string;
44
46
  /** Seconds of silence before ending the conversation. */
45
47
  no_input_end_conversation_sec: number;
@@ -39,9 +39,11 @@ export interface ConfigPayload {
39
39
  enable_documents_rag?: boolean;
40
40
  /** Enable transcript RAG */
41
41
  enable_transcripts_rag?: boolean;
42
+ /** Whether to have the no-input poke text be generated by AI */
43
+ generate_no_input_poke_text?: boolean;
42
44
  /** Seconds of silence before poke message */
43
45
  no_input_poke_sec?: number | null;
44
- /** Poke message text */
46
+ /** Poke message text. Ignored when generate_no_input_poke_text is true. */
45
47
  no_input_poke_text?: string;
46
48
  /** Seconds of silence before ending conversation */
47
49
  no_input_end_conversation_sec?: number;
@@ -47,9 +47,11 @@ export interface Conversation {
47
47
  boosted_keywords: string[] | null;
48
48
  /** Array of ISO 639-1 language codes recognized by the model. */
49
49
  languages: string[] | null;
50
+ /** Whether the no-input poke text was generated by AI. */
51
+ generate_no_input_poke_text?: boolean | null;
50
52
  /** Number of seconds of silence before a poke message is sent. `null` means the poke message is disabled. */
51
53
  no_input_poke_sec: number | null;
52
- /** The message to send after the specified silence. Relevant only if `no_input_poke_sec` is not `null`. */
54
+ /** The message to send after the specified silence. Relevant only if `no_input_poke_sec` is not `null`. Ignored when generate_no_input_poke_text is true. */
53
55
  no_input_poke_text: string | null;
54
56
  /** Seconds of silence before the conversation is ended. */
55
57
  no_input_end_conversation_sec: number | null;
@@ -5,7 +5,8 @@ import * as Phonic from "../index.mjs";
5
5
  export interface CreateAgentRequest {
6
6
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
7
7
  name: string;
8
- phone_number: CreateAgentRequest.PhoneNumber | null;
8
+ /** When set to `null`, the agent will not be associated with a phone number. When set to `"assign-automatically"`, the agent will be assigned a random phone number. When set to `"custom"`, you must provide `custom_phone_numbers`. */
9
+ phone_number?: CreateAgentRequest.PhoneNumber | null;
9
10
  /** The custom phone number to use for the agent in E.164 format (e.g., +1234567890). This field is deprecated. Use `custom_phone_numbers` instead. */
10
11
  custom_phone_number?: string | null;
11
12
  /** Array of custom phone numbers in E.164 format (e.g., ["+1234567890", "+0987654321"]). The agent will be able to receive phone calls on any of these numbers. Required when `phone_number` is set to `"custom"`. All phone numbers must be unique. */
@@ -34,9 +35,11 @@ export interface CreateAgentRequest {
34
35
  tools?: CreateAgentRequest.Tools.Item[];
35
36
  /** Array of task objects with `name` and `description` fields. */
36
37
  tasks?: Phonic.Task[];
38
+ /** Whether to have the no-input poke text be generated by AI. */
39
+ generate_no_input_poke_text?: boolean;
37
40
  /** Number of seconds of silence before sending a poke message. `null` disables the poke message. */
38
41
  no_input_poke_sec?: number | null;
39
- /** The message to send after the specified silence. */
42
+ /** The message to send after the specified silence. Ignored when generate_no_input_poke_text is true. */
40
43
  no_input_poke_text?: string;
41
44
  /** Seconds of silence before ending the conversation. */
42
45
  no_input_end_conversation_sec?: number;
@@ -18,9 +18,11 @@ export interface OutboundCallConfig {
18
18
  template_variables?: Record<string, string>;
19
19
  /** The voice ID to use for the agent. */
20
20
  voice_id?: string;
21
+ /** Whether to have the no-input poke text be generated by AI. */
22
+ generate_no_input_poke_text?: boolean;
21
23
  /** Number of seconds of silence before sending a poke message. `null` disables the poke message. */
22
24
  no_input_poke_sec?: number | null;
23
- /** The message to send after the specified silence. */
25
+ /** The message to send after the specified silence. Ignored when generate_no_input_poke_text is true. */
24
26
  no_input_poke_text?: string;
25
27
  /** Seconds of silence before ending the conversation. */
26
28
  no_input_end_conversation_sec?: number;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.30.35";
1
+ export declare const SDK_VERSION = "0.30.37";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.30.35";
1
+ export const SDK_VERSION = "0.30.37";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phonic",
3
- "version": "0.30.35",
3
+ "version": "0.30.37",
4
4
  "private": false,
5
5
  "repository": "github:Phonic-Co/phonic-node",
6
6
  "type": "commonjs",
package/reference.md CHANGED
@@ -113,6 +113,7 @@ await client.agents.create({
113
113
  },
114
114
  },
115
115
  tools: ["keypad_input"],
116
+ generate_no_input_poke_text: false,
116
117
  no_input_poke_sec: 30,
117
118
  no_input_poke_text: "Are you still there?",
118
119
  languages: ["en", "es"],
@@ -207,6 +208,7 @@ await client.agents.upsert({
207
208
  },
208
209
  },
209
210
  tools: ["keypad_input"],
211
+ generate_no_input_poke_text: false,
210
212
  no_input_poke_sec: 30,
211
213
  no_input_poke_text: "Are you still there?",
212
214
  languages: ["en", "es"],
@@ -447,6 +449,7 @@ await client.agents.update("nameOrId", {
447
449
  },
448
450
  },
449
451
  tools: ["keypad_input"],
452
+ generate_no_input_poke_text: false,
450
453
  no_input_poke_sec: 30,
451
454
  no_input_poke_text: "Are you still there?",
452
455
  languages: ["en", "es"],
@@ -2187,6 +2190,7 @@ await client.conversations.outboundCall({
2187
2190
  subject: "Chess",
2188
2191
  },
2189
2192
  voice_id: "sabrina",
2193
+ generate_no_input_poke_text: false,
2190
2194
  no_input_poke_sec: 30,
2191
2195
  no_input_poke_text: "Are you still there?",
2192
2196
  no_input_end_conversation_sec: 180,