phonic 0.32.6 → 0.32.7

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 (47) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/errors/ServiceUnavailableError.d.ts +6 -0
  3. package/dist/cjs/api/errors/ServiceUnavailableError.js +54 -0
  4. package/dist/cjs/api/errors/index.d.ts +1 -0
  5. package/dist/cjs/api/errors/index.js +1 -0
  6. package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +2 -2
  7. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +2 -1
  8. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.js +1 -0
  9. package/dist/cjs/api/resources/agents/client/requests/UpsertAgentRequest.d.ts +0 -2
  10. package/dist/cjs/api/resources/conversations/client/Client.d.ts +1 -0
  11. package/dist/cjs/api/resources/conversations/client/Client.js +3 -0
  12. package/dist/cjs/api/types/Agent.d.ts +2 -1
  13. package/dist/cjs/api/types/Agent.js +1 -0
  14. package/dist/cjs/api/types/ConfigOptions.d.ts +1 -1
  15. package/dist/cjs/api/types/Conversation.d.ts +7 -5
  16. package/dist/cjs/api/types/ConversationAnalysis.d.ts +2 -0
  17. package/dist/cjs/api/types/ConversationItem.d.ts +2 -0
  18. package/dist/cjs/api/types/CreateAgentRequest.d.ts +3 -2
  19. package/dist/cjs/api/types/CreateAgentRequest.js +1 -0
  20. package/dist/cjs/api/types/OutboundCallConfig.d.ts +1 -1
  21. package/dist/cjs/api/types/overrides.d.ts +1 -0
  22. package/dist/cjs/version.d.ts +1 -1
  23. package/dist/cjs/version.js +1 -1
  24. package/dist/esm/BaseClient.mjs +2 -2
  25. package/dist/esm/api/errors/ServiceUnavailableError.d.mts +6 -0
  26. package/dist/esm/api/errors/ServiceUnavailableError.mjs +17 -0
  27. package/dist/esm/api/errors/index.d.mts +1 -0
  28. package/dist/esm/api/errors/index.mjs +1 -0
  29. package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +2 -2
  30. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +2 -1
  31. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.mjs +1 -0
  32. package/dist/esm/api/resources/agents/client/requests/UpsertAgentRequest.d.mts +0 -2
  33. package/dist/esm/api/resources/conversations/client/Client.d.mts +1 -0
  34. package/dist/esm/api/resources/conversations/client/Client.mjs +3 -0
  35. package/dist/esm/api/types/Agent.d.mts +2 -1
  36. package/dist/esm/api/types/Agent.mjs +1 -0
  37. package/dist/esm/api/types/ConfigOptions.d.mts +1 -1
  38. package/dist/esm/api/types/Conversation.d.mts +7 -5
  39. package/dist/esm/api/types/ConversationAnalysis.d.mts +2 -0
  40. package/dist/esm/api/types/ConversationItem.d.mts +2 -0
  41. package/dist/esm/api/types/CreateAgentRequest.d.mts +3 -2
  42. package/dist/esm/api/types/CreateAgentRequest.mjs +1 -0
  43. package/dist/esm/api/types/OutboundCallConfig.d.mts +1 -1
  44. package/dist/esm/api/types/overrides.d.mts +1 -0
  45. package/dist/esm/version.d.mts +1 -1
  46. package/dist/esm/version.mjs +1 -1
  47. package/package.json +1 -1
@@ -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.32.6",
47
- "User-Agent": "phonic/0.32.6",
46
+ "X-Fern-SDK-Version": "0.32.7",
47
+ "User-Agent": "phonic/0.32.7",
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);
@@ -0,0 +1,6 @@
1
+ import type * as core from "../../core/index.js";
2
+ import * as errors from "../../errors/index.js";
3
+ import type * as Phonic from "../index.js";
4
+ export declare class ServiceUnavailableError extends errors.PhonicError {
5
+ constructor(body: Phonic.BasicError, rawResponse?: core.RawResponse);
6
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.ServiceUnavailableError = void 0;
38
+ const errors = __importStar(require("../../errors/index.js"));
39
+ class ServiceUnavailableError extends errors.PhonicError {
40
+ constructor(body, rawResponse) {
41
+ super({
42
+ message: "ServiceUnavailableError",
43
+ statusCode: 503,
44
+ body: body,
45
+ rawResponse: rawResponse,
46
+ });
47
+ Object.setPrototypeOf(this, new.target.prototype);
48
+ if (Error.captureStackTrace) {
49
+ Error.captureStackTrace(this, this.constructor);
50
+ }
51
+ this.name = this.constructor.name;
52
+ }
53
+ }
54
+ exports.ServiceUnavailableError = ServiceUnavailableError;
@@ -4,6 +4,7 @@ export * from "./ForbiddenError.js";
4
4
  export * from "./GatewayTimeoutError.js";
5
5
  export * from "./InternalServerError.js";
6
6
  export * from "./NotFoundError.js";
7
+ export * from "./ServiceUnavailableError.js";
7
8
  export * from "./TooManyRequestsError.js";
8
9
  export * from "./UnauthorizedError.js";
9
10
  export * from "./UnprocessableEntityError.js";
@@ -20,6 +20,7 @@ __exportStar(require("./ForbiddenError.js"), exports);
20
20
  __exportStar(require("./GatewayTimeoutError.js"), exports);
21
21
  __exportStar(require("./InternalServerError.js"), exports);
22
22
  __exportStar(require("./NotFoundError.js"), exports);
23
+ __exportStar(require("./ServiceUnavailableError.js"), exports);
23
24
  __exportStar(require("./TooManyRequestsError.js"), exports);
24
25
  __exportStar(require("./UnauthorizedError.js"), exports);
25
26
  __exportStar(require("./UnprocessableEntityError.js"), exports);
@@ -76,7 +76,7 @@ export interface AgentsCreateRequest {
76
76
  /** Number of seconds of inactivity before the conversation WebSocket is closed. */
77
77
  websocket_timeout_sec?: number;
78
78
  /** Message to play when the conversation starts. Can contain template variables like `{{customer_name}}`. Ignored when `generate_welcome_message` is `true`. */
79
- welcome_message?: string;
79
+ welcome_message?: string | null;
80
80
  /** Instructions for the conversation. Can contain template variables like `{{subject}}`. */
81
81
  system_prompt?: string;
82
82
  /** Variables that can be used in the welcome message and the system prompt. */
@@ -101,7 +101,7 @@ export interface AgentsCreateRequest {
101
101
  data_retention_policy?: Phonic.DataRetentionPolicy;
102
102
  /** 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. */
103
103
  default_language?: Phonic.LanguageCode;
104
- /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
104
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. When `multilingual_mode` is `"auto"`, a maximum of 2 additional languages is allowed. */
105
105
  additional_languages?: Phonic.LanguageCode[];
106
106
  /** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */
107
107
  languages?: Phonic.LanguageCode[];
@@ -107,7 +107,7 @@ export interface UpdateAgentRequest {
107
107
  integrations?: Phonic.AgentIntegration[];
108
108
  /** 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. */
109
109
  default_language?: Phonic.LanguageCode;
110
- /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
110
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. When `multilingual_mode` is `"auto"`, a maximum of 2 additional languages is allowed. */
111
111
  additional_languages?: Phonic.LanguageCode[];
112
112
  /** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */
113
113
  languages?: Phonic.LanguageCode[];
@@ -151,6 +151,7 @@ export declare namespace UpdateAgentRequest {
151
151
  /** The audio format of the agent. */
152
152
  const AudioFormat: {
153
153
  readonly Pcm44100: "pcm_44100";
154
+ readonly Pcm24000: "pcm_24000";
154
155
  readonly Pcm16000: "pcm_16000";
155
156
  readonly Pcm8000: "pcm_8000";
156
157
  readonly Mulaw8000: "mulaw_8000";
@@ -11,6 +11,7 @@ var UpdateAgentRequest;
11
11
  /** The audio format of the agent. */
12
12
  UpdateAgentRequest.AudioFormat = {
13
13
  Pcm44100: "pcm_44100",
14
+ Pcm24000: "pcm_24000",
14
15
  Pcm16000: "pcm_16000",
15
16
  Pcm8000: "pcm_8000",
16
17
  Mulaw8000: "mulaw_8000",
@@ -51,6 +51,4 @@ export interface UpsertAgentRequest extends Phonic.CreateAgentRequest {
51
51
  outbound_number_pool?: Phonic.OutboundNumberPool | null;
52
52
  /** Array of procedure IDs associated with the agent. */
53
53
  procedure_ids?: string[];
54
- /** Array of third-party integrations enabled for the agent. */
55
- integrations?: Phonic.AgentIntegration[];
56
54
  }
@@ -209,6 +209,7 @@ export declare class ConversationsClient {
209
209
  * @throws {@link Phonic.UnprocessableEntityError}
210
210
  * @throws {@link Phonic.TooManyRequestsError}
211
211
  * @throws {@link Phonic.InternalServerError}
212
+ * @throws {@link Phonic.ServiceUnavailableError}
212
213
  *
213
214
  * @example
214
215
  * await client.conversations.replay("id", {
@@ -667,6 +667,7 @@ class ConversationsClient {
667
667
  * @throws {@link Phonic.UnprocessableEntityError}
668
668
  * @throws {@link Phonic.TooManyRequestsError}
669
669
  * @throws {@link Phonic.InternalServerError}
670
+ * @throws {@link Phonic.ServiceUnavailableError}
670
671
  *
671
672
  * @example
672
673
  * await client.conversations.replay("id", {
@@ -717,6 +718,8 @@ class ConversationsClient {
717
718
  throw new Phonic.TooManyRequestsError(_response.error.body, _response.rawResponse);
718
719
  case 500:
719
720
  throw new Phonic.InternalServerError(_response.error.body, _response.rawResponse);
721
+ case 503:
722
+ throw new Phonic.ServiceUnavailableError(_response.error.body, _response.rawResponse);
720
723
  default:
721
724
  throw new errors.PhonicError({
722
725
  statusCode: _response.error.statusCode,
@@ -48,7 +48,7 @@ export interface Agent {
48
48
  no_input_end_conversation_sec: number;
49
49
  /** 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
50
  default_language: Phonic.LanguageCode;
51
- /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
51
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. When `multilingual_mode` is `"auto"`, a maximum of 2 additional languages is allowed. */
52
52
  additional_languages: Phonic.LanguageCode[];
53
53
  /** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */
54
54
  languages?: Phonic.LanguageCode[] | undefined;
@@ -101,6 +101,7 @@ export declare namespace Agent {
101
101
  /** The audio format of the agent. If the agent has a phone number, the audio format will be `mulaw_8000`. */
102
102
  const AudioFormat: {
103
103
  readonly Pcm44100: "pcm_44100";
104
+ readonly Pcm24000: "pcm_24000";
104
105
  readonly Pcm16000: "pcm_16000";
105
106
  readonly Pcm8000: "pcm_8000";
106
107
  readonly Mulaw8000: "mulaw_8000";
@@ -7,6 +7,7 @@ var Agent;
7
7
  /** The audio format of the agent. If the agent has a phone number, the audio format will be `mulaw_8000`. */
8
8
  Agent.AudioFormat = {
9
9
  Pcm44100: "pcm_44100",
10
+ Pcm24000: "pcm_24000",
10
11
  Pcm16000: "pcm_16000",
11
12
  Pcm8000: "pcm_8000",
12
13
  Mulaw8000: "mulaw_8000",
@@ -51,7 +51,7 @@ export interface ConfigOptions {
51
51
  no_input_end_conversation_sec?: number | undefined;
52
52
  /** 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. */
53
53
  default_language?: string | undefined;
54
- /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
54
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. When `multilingual_mode` is `"auto"`, a maximum of 2 additional languages is allowed. */
55
55
  additional_languages?: string[] | undefined;
56
56
  /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). If `"initial"` the first turn user audio determines the language for the rest of the conversation. */
57
57
  multilingual_mode?: ConfigOptions.MultilingualMode | undefined;
@@ -23,7 +23,7 @@ export interface Conversation {
23
23
  /** Template variables used in the conversation. */
24
24
  template_variables: Record<string, string>;
25
25
  /** System prompt used in the conversation. */
26
- system_prompt?: string | undefined;
26
+ system_prompt?: (string | null) | undefined;
27
27
  /** Audio input format. */
28
28
  input_format: string;
29
29
  /** Audio output format. */
@@ -33,7 +33,7 @@ export interface Conversation {
33
33
  /** The background noise type used in the conversation. */
34
34
  background_noise: Conversation.BackgroundNoise | null;
35
35
  /** Live transcript of the conversation. */
36
- live_transcript: string;
36
+ live_transcript: string | null;
37
37
  /** Post-call processed transcript. */
38
38
  post_call_transcript: string | null;
39
39
  /** Duration of the conversation in milliseconds. */
@@ -54,14 +54,14 @@ export interface Conversation {
54
54
  min_words_to_interrupt: number;
55
55
  /** 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. */
56
56
  default_language: Phonic.LanguageCode;
57
- /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
57
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. When `multilingual_mode` is `"auto"`, a maximum of 2 additional languages is allowed. */
58
58
  additional_languages: Phonic.LanguageCode[] | null;
59
59
  /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). If `"initial"` the first turn user audio determines the language for the rest of the conversation. */
60
60
  multilingual_mode: Conversation.MultilingualMode;
61
61
  /** Push to talk mode. User must send mute/unmute messages to turn on/off listening to audio. Defaults to false. */
62
62
  push_to_talk: boolean;
63
63
  /** Array of ISO 639-1 language codes recognized by the model. This field is deprecated. Use `default_language` and `additional_languages` instead. */
64
- languages?: (string[] | null) | undefined;
64
+ languages?: string[] | undefined;
65
65
  /** Whether the no-input poke text was generated by AI. */
66
66
  generate_no_input_poke_text?: (boolean | null) | undefined;
67
67
  /** Number of seconds of silence before a poke message is sent. `null` means the poke message is disabled. */
@@ -70,6 +70,8 @@ export interface Conversation {
70
70
  no_input_poke_text: string | null;
71
71
  /** Seconds of silence before the conversation is ended. */
72
72
  no_input_end_conversation_sec: number | null;
73
+ /** The WebSocket idle timeout in seconds. */
74
+ websocket_timeout_sec?: number | undefined;
73
75
  /** Voice activity detection prebuffer duration in milliseconds. `null` when not applicable or unknown (e.g. push-to-talk, or legacy stored conversations). */
74
76
  vad_prebuffer_duration_ms?: (number | null) | undefined;
75
77
  /** Minimum speech duration for voice activity detection in milliseconds. `null` when not applicable or unknown. */
@@ -99,7 +101,7 @@ export interface Conversation {
99
101
  /** Whether the assistant produced backchannel responses during the conversation. */
100
102
  enable_assistant_backchannel?: boolean | undefined;
101
103
  /** How aggressively the assistant produced backchannel responses during the conversation. */
102
- assistant_backchannel_aggressiveness?: number | undefined;
104
+ assistant_backchannel_aggressiveness?: (number | null) | undefined;
103
105
  }
104
106
  export declare namespace Conversation {
105
107
  /**
@@ -1,4 +1,6 @@
1
1
  export interface ConversationAnalysis {
2
+ /** The ID of the conversation analysis. */
3
+ id: string;
2
4
  /** Latencies between turns in milliseconds. */
3
5
  latencies_ms: number[];
4
6
  /** Number of interruptions in the conversation. */
@@ -37,6 +37,8 @@ export declare namespace ConversationItem {
37
37
  /** The tool call ID. */
38
38
  id: string;
39
39
  tool: Item.Tool;
40
+ /** The integration associated with the tool, if any. */
41
+ integration?: (string | null) | undefined;
40
42
  /** HTTP method for webhook tool calls. */
41
43
  endpoint_method?: (string | null) | undefined;
42
44
  /** URL for webhook tool calls. */
@@ -29,7 +29,7 @@ export interface CreateAgentRequest {
29
29
  /** Number of seconds of inactivity before the conversation WebSocket is closed. */
30
30
  websocket_timeout_sec?: number | undefined;
31
31
  /** Message to play when the conversation starts. Can contain template variables like `{{customer_name}}`. Ignored when `generate_welcome_message` is `true`. */
32
- welcome_message?: string | undefined;
32
+ welcome_message?: (string | null) | undefined;
33
33
  /** Instructions for the conversation. Can contain template variables like `{{subject}}`. */
34
34
  system_prompt?: string | undefined;
35
35
  /** Variables that can be used in the welcome message and the system prompt. */
@@ -54,7 +54,7 @@ export interface CreateAgentRequest {
54
54
  data_retention_policy?: Phonic.DataRetentionPolicy | undefined;
55
55
  /** 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. */
56
56
  default_language?: Phonic.LanguageCode | undefined;
57
- /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
57
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. When `multilingual_mode` is `"auto"`, a maximum of 2 additional languages is allowed. */
58
58
  additional_languages?: Phonic.LanguageCode[] | undefined;
59
59
  /** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */
60
60
  languages?: Phonic.LanguageCode[] | undefined;
@@ -98,6 +98,7 @@ export declare namespace CreateAgentRequest {
98
98
  /** The audio format of the agent. */
99
99
  const AudioFormat: {
100
100
  readonly Pcm44100: "pcm_44100";
101
+ readonly Pcm24000: "pcm_24000";
101
102
  readonly Pcm16000: "pcm_16000";
102
103
  readonly Pcm8000: "pcm_8000";
103
104
  readonly Mulaw8000: "mulaw_8000";
@@ -11,6 +11,7 @@ var CreateAgentRequest;
11
11
  /** The audio format of the agent. */
12
12
  CreateAgentRequest.AudioFormat = {
13
13
  Pcm44100: "pcm_44100",
14
+ Pcm24000: "pcm_24000",
14
15
  Pcm16000: "pcm_16000",
15
16
  Pcm8000: "pcm_8000",
16
17
  Mulaw8000: "mulaw_8000",
@@ -29,7 +29,7 @@ export interface OutboundCallConfig {
29
29
  no_input_end_conversation_sec?: number | undefined;
30
30
  /** 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. */
31
31
  default_language?: Phonic.LanguageCode | undefined;
32
- /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
32
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. When `multilingual_mode` is `"auto"`, a maximum of 2 additional languages is allowed. */
33
33
  additional_languages?: Phonic.LanguageCode[] | undefined;
34
34
  /** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */
35
35
  languages?: Phonic.LanguageCode[] | undefined;
@@ -45,6 +45,7 @@ export type ConversationAnalysisWebhookPayload = {
45
45
  created_at: ISODateTime;
46
46
  data: {
47
47
  conversation: {
48
+ id: string;
48
49
  latencies_ms: number[];
49
50
  interruptions_count: number;
50
51
  };
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.32.6";
1
+ export declare const SDK_VERSION = "0.32.7";
@@ -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.32.6";
4
+ exports.SDK_VERSION = "0.32.7";
@@ -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.32.6",
10
- "User-Agent": "phonic/0.32.6",
9
+ "X-Fern-SDK-Version": "0.32.7",
10
+ "User-Agent": "phonic/0.32.7",
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);
@@ -0,0 +1,6 @@
1
+ import type * as core from "../../core/index.mjs";
2
+ import * as errors from "../../errors/index.mjs";
3
+ import type * as Phonic from "../index.mjs";
4
+ export declare class ServiceUnavailableError extends errors.PhonicError {
5
+ constructor(body: Phonic.BasicError, rawResponse?: core.RawResponse);
6
+ }
@@ -0,0 +1,17 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as errors from "../../errors/index.mjs";
3
+ export class ServiceUnavailableError extends errors.PhonicError {
4
+ constructor(body, rawResponse) {
5
+ super({
6
+ message: "ServiceUnavailableError",
7
+ statusCode: 503,
8
+ body: body,
9
+ rawResponse: rawResponse,
10
+ });
11
+ Object.setPrototypeOf(this, new.target.prototype);
12
+ if (Error.captureStackTrace) {
13
+ Error.captureStackTrace(this, this.constructor);
14
+ }
15
+ this.name = this.constructor.name;
16
+ }
17
+ }
@@ -4,6 +4,7 @@ export * from "./ForbiddenError.mjs";
4
4
  export * from "./GatewayTimeoutError.mjs";
5
5
  export * from "./InternalServerError.mjs";
6
6
  export * from "./NotFoundError.mjs";
7
+ export * from "./ServiceUnavailableError.mjs";
7
8
  export * from "./TooManyRequestsError.mjs";
8
9
  export * from "./UnauthorizedError.mjs";
9
10
  export * from "./UnprocessableEntityError.mjs";
@@ -4,6 +4,7 @@ export * from "./ForbiddenError.mjs";
4
4
  export * from "./GatewayTimeoutError.mjs";
5
5
  export * from "./InternalServerError.mjs";
6
6
  export * from "./NotFoundError.mjs";
7
+ export * from "./ServiceUnavailableError.mjs";
7
8
  export * from "./TooManyRequestsError.mjs";
8
9
  export * from "./UnauthorizedError.mjs";
9
10
  export * from "./UnprocessableEntityError.mjs";
@@ -76,7 +76,7 @@ export interface AgentsCreateRequest {
76
76
  /** Number of seconds of inactivity before the conversation WebSocket is closed. */
77
77
  websocket_timeout_sec?: number;
78
78
  /** Message to play when the conversation starts. Can contain template variables like `{{customer_name}}`. Ignored when `generate_welcome_message` is `true`. */
79
- welcome_message?: string;
79
+ welcome_message?: string | null;
80
80
  /** Instructions for the conversation. Can contain template variables like `{{subject}}`. */
81
81
  system_prompt?: string;
82
82
  /** Variables that can be used in the welcome message and the system prompt. */
@@ -101,7 +101,7 @@ export interface AgentsCreateRequest {
101
101
  data_retention_policy?: Phonic.DataRetentionPolicy;
102
102
  /** 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. */
103
103
  default_language?: Phonic.LanguageCode;
104
- /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
104
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. When `multilingual_mode` is `"auto"`, a maximum of 2 additional languages is allowed. */
105
105
  additional_languages?: Phonic.LanguageCode[];
106
106
  /** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */
107
107
  languages?: Phonic.LanguageCode[];
@@ -107,7 +107,7 @@ export interface UpdateAgentRequest {
107
107
  integrations?: Phonic.AgentIntegration[];
108
108
  /** 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. */
109
109
  default_language?: Phonic.LanguageCode;
110
- /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
110
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. When `multilingual_mode` is `"auto"`, a maximum of 2 additional languages is allowed. */
111
111
  additional_languages?: Phonic.LanguageCode[];
112
112
  /** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */
113
113
  languages?: Phonic.LanguageCode[];
@@ -151,6 +151,7 @@ export declare namespace UpdateAgentRequest {
151
151
  /** The audio format of the agent. */
152
152
  const AudioFormat: {
153
153
  readonly Pcm44100: "pcm_44100";
154
+ readonly Pcm24000: "pcm_24000";
154
155
  readonly Pcm16000: "pcm_16000";
155
156
  readonly Pcm8000: "pcm_8000";
156
157
  readonly Mulaw8000: "mulaw_8000";
@@ -8,6 +8,7 @@ export var UpdateAgentRequest;
8
8
  /** The audio format of the agent. */
9
9
  UpdateAgentRequest.AudioFormat = {
10
10
  Pcm44100: "pcm_44100",
11
+ Pcm24000: "pcm_24000",
11
12
  Pcm16000: "pcm_16000",
12
13
  Pcm8000: "pcm_8000",
13
14
  Mulaw8000: "mulaw_8000",
@@ -51,6 +51,4 @@ export interface UpsertAgentRequest extends Phonic.CreateAgentRequest {
51
51
  outbound_number_pool?: Phonic.OutboundNumberPool | null;
52
52
  /** Array of procedure IDs associated with the agent. */
53
53
  procedure_ids?: string[];
54
- /** Array of third-party integrations enabled for the agent. */
55
- integrations?: Phonic.AgentIntegration[];
56
54
  }
@@ -209,6 +209,7 @@ export declare class ConversationsClient {
209
209
  * @throws {@link Phonic.UnprocessableEntityError}
210
210
  * @throws {@link Phonic.TooManyRequestsError}
211
211
  * @throws {@link Phonic.InternalServerError}
212
+ * @throws {@link Phonic.ServiceUnavailableError}
212
213
  *
213
214
  * @example
214
215
  * await client.conversations.replay("id", {
@@ -631,6 +631,7 @@ export class ConversationsClient {
631
631
  * @throws {@link Phonic.UnprocessableEntityError}
632
632
  * @throws {@link Phonic.TooManyRequestsError}
633
633
  * @throws {@link Phonic.InternalServerError}
634
+ * @throws {@link Phonic.ServiceUnavailableError}
634
635
  *
635
636
  * @example
636
637
  * await client.conversations.replay("id", {
@@ -681,6 +682,8 @@ export class ConversationsClient {
681
682
  throw new Phonic.TooManyRequestsError(_response.error.body, _response.rawResponse);
682
683
  case 500:
683
684
  throw new Phonic.InternalServerError(_response.error.body, _response.rawResponse);
685
+ case 503:
686
+ throw new Phonic.ServiceUnavailableError(_response.error.body, _response.rawResponse);
684
687
  default:
685
688
  throw new errors.PhonicError({
686
689
  statusCode: _response.error.statusCode,
@@ -48,7 +48,7 @@ export interface Agent {
48
48
  no_input_end_conversation_sec: number;
49
49
  /** 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
50
  default_language: Phonic.LanguageCode;
51
- /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
51
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. When `multilingual_mode` is `"auto"`, a maximum of 2 additional languages is allowed. */
52
52
  additional_languages: Phonic.LanguageCode[];
53
53
  /** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */
54
54
  languages?: Phonic.LanguageCode[] | undefined;
@@ -101,6 +101,7 @@ export declare namespace Agent {
101
101
  /** The audio format of the agent. If the agent has a phone number, the audio format will be `mulaw_8000`. */
102
102
  const AudioFormat: {
103
103
  readonly Pcm44100: "pcm_44100";
104
+ readonly Pcm24000: "pcm_24000";
104
105
  readonly Pcm16000: "pcm_16000";
105
106
  readonly Pcm8000: "pcm_8000";
106
107
  readonly Mulaw8000: "mulaw_8000";
@@ -4,6 +4,7 @@ export var Agent;
4
4
  /** The audio format of the agent. If the agent has a phone number, the audio format will be `mulaw_8000`. */
5
5
  Agent.AudioFormat = {
6
6
  Pcm44100: "pcm_44100",
7
+ Pcm24000: "pcm_24000",
7
8
  Pcm16000: "pcm_16000",
8
9
  Pcm8000: "pcm_8000",
9
10
  Mulaw8000: "mulaw_8000",
@@ -51,7 +51,7 @@ export interface ConfigOptions {
51
51
  no_input_end_conversation_sec?: number | undefined;
52
52
  /** 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. */
53
53
  default_language?: string | undefined;
54
- /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
54
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. When `multilingual_mode` is `"auto"`, a maximum of 2 additional languages is allowed. */
55
55
  additional_languages?: string[] | undefined;
56
56
  /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). If `"initial"` the first turn user audio determines the language for the rest of the conversation. */
57
57
  multilingual_mode?: ConfigOptions.MultilingualMode | undefined;
@@ -23,7 +23,7 @@ export interface Conversation {
23
23
  /** Template variables used in the conversation. */
24
24
  template_variables: Record<string, string>;
25
25
  /** System prompt used in the conversation. */
26
- system_prompt?: string | undefined;
26
+ system_prompt?: (string | null) | undefined;
27
27
  /** Audio input format. */
28
28
  input_format: string;
29
29
  /** Audio output format. */
@@ -33,7 +33,7 @@ export interface Conversation {
33
33
  /** The background noise type used in the conversation. */
34
34
  background_noise: Conversation.BackgroundNoise | null;
35
35
  /** Live transcript of the conversation. */
36
- live_transcript: string;
36
+ live_transcript: string | null;
37
37
  /** Post-call processed transcript. */
38
38
  post_call_transcript: string | null;
39
39
  /** Duration of the conversation in milliseconds. */
@@ -54,14 +54,14 @@ export interface Conversation {
54
54
  min_words_to_interrupt: number;
55
55
  /** 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. */
56
56
  default_language: Phonic.LanguageCode;
57
- /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
57
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. When `multilingual_mode` is `"auto"`, a maximum of 2 additional languages is allowed. */
58
58
  additional_languages: Phonic.LanguageCode[] | null;
59
59
  /** If `"auto"`, each user audio is automatically identified for the language to respond in. If `"request"`, user must request to change language (recommended). If `"initial"` the first turn user audio determines the language for the rest of the conversation. */
60
60
  multilingual_mode: Conversation.MultilingualMode;
61
61
  /** Push to talk mode. User must send mute/unmute messages to turn on/off listening to audio. Defaults to false. */
62
62
  push_to_talk: boolean;
63
63
  /** Array of ISO 639-1 language codes recognized by the model. This field is deprecated. Use `default_language` and `additional_languages` instead. */
64
- languages?: (string[] | null) | undefined;
64
+ languages?: string[] | undefined;
65
65
  /** Whether the no-input poke text was generated by AI. */
66
66
  generate_no_input_poke_text?: (boolean | null) | undefined;
67
67
  /** Number of seconds of silence before a poke message is sent. `null` means the poke message is disabled. */
@@ -70,6 +70,8 @@ export interface Conversation {
70
70
  no_input_poke_text: string | null;
71
71
  /** Seconds of silence before the conversation is ended. */
72
72
  no_input_end_conversation_sec: number | null;
73
+ /** The WebSocket idle timeout in seconds. */
74
+ websocket_timeout_sec?: number | undefined;
73
75
  /** Voice activity detection prebuffer duration in milliseconds. `null` when not applicable or unknown (e.g. push-to-talk, or legacy stored conversations). */
74
76
  vad_prebuffer_duration_ms?: (number | null) | undefined;
75
77
  /** Minimum speech duration for voice activity detection in milliseconds. `null` when not applicable or unknown. */
@@ -99,7 +101,7 @@ export interface Conversation {
99
101
  /** Whether the assistant produced backchannel responses during the conversation. */
100
102
  enable_assistant_backchannel?: boolean | undefined;
101
103
  /** How aggressively the assistant produced backchannel responses during the conversation. */
102
- assistant_backchannel_aggressiveness?: number | undefined;
104
+ assistant_backchannel_aggressiveness?: (number | null) | undefined;
103
105
  }
104
106
  export declare namespace Conversation {
105
107
  /**
@@ -1,4 +1,6 @@
1
1
  export interface ConversationAnalysis {
2
+ /** The ID of the conversation analysis. */
3
+ id: string;
2
4
  /** Latencies between turns in milliseconds. */
3
5
  latencies_ms: number[];
4
6
  /** Number of interruptions in the conversation. */
@@ -37,6 +37,8 @@ export declare namespace ConversationItem {
37
37
  /** The tool call ID. */
38
38
  id: string;
39
39
  tool: Item.Tool;
40
+ /** The integration associated with the tool, if any. */
41
+ integration?: (string | null) | undefined;
40
42
  /** HTTP method for webhook tool calls. */
41
43
  endpoint_method?: (string | null) | undefined;
42
44
  /** URL for webhook tool calls. */
@@ -29,7 +29,7 @@ export interface CreateAgentRequest {
29
29
  /** Number of seconds of inactivity before the conversation WebSocket is closed. */
30
30
  websocket_timeout_sec?: number | undefined;
31
31
  /** Message to play when the conversation starts. Can contain template variables like `{{customer_name}}`. Ignored when `generate_welcome_message` is `true`. */
32
- welcome_message?: string | undefined;
32
+ welcome_message?: (string | null) | undefined;
33
33
  /** Instructions for the conversation. Can contain template variables like `{{subject}}`. */
34
34
  system_prompt?: string | undefined;
35
35
  /** Variables that can be used in the welcome message and the system prompt. */
@@ -54,7 +54,7 @@ export interface CreateAgentRequest {
54
54
  data_retention_policy?: Phonic.DataRetentionPolicy | undefined;
55
55
  /** 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. */
56
56
  default_language?: Phonic.LanguageCode | undefined;
57
- /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
57
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. When `multilingual_mode` is `"auto"`, a maximum of 2 additional languages is allowed. */
58
58
  additional_languages?: Phonic.LanguageCode[] | undefined;
59
59
  /** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */
60
60
  languages?: Phonic.LanguageCode[] | undefined;
@@ -98,6 +98,7 @@ export declare namespace CreateAgentRequest {
98
98
  /** The audio format of the agent. */
99
99
  const AudioFormat: {
100
100
  readonly Pcm44100: "pcm_44100";
101
+ readonly Pcm24000: "pcm_24000";
101
102
  readonly Pcm16000: "pcm_16000";
102
103
  readonly Pcm8000: "pcm_8000";
103
104
  readonly Mulaw8000: "mulaw_8000";
@@ -8,6 +8,7 @@ export var CreateAgentRequest;
8
8
  /** The audio format of the agent. */
9
9
  CreateAgentRequest.AudioFormat = {
10
10
  Pcm44100: "pcm_44100",
11
+ Pcm24000: "pcm_24000",
11
12
  Pcm16000: "pcm_16000",
12
13
  Pcm8000: "pcm_8000",
13
14
  Mulaw8000: "mulaw_8000",
@@ -29,7 +29,7 @@ export interface OutboundCallConfig {
29
29
  no_input_end_conversation_sec?: number | undefined;
30
30
  /** 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. */
31
31
  default_language?: Phonic.LanguageCode | undefined;
32
- /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. */
32
+ /** Array of additional ISO 639-1 language codes that the agent should be able to recognize and speak. Should not include `default_language`. When `multilingual_mode` is `"auto"`, a maximum of 2 additional languages is allowed. */
33
33
  additional_languages?: Phonic.LanguageCode[] | undefined;
34
34
  /** Array of ISO 639-1 language codes that the agent should be able to recognize. This field is deprecated. Use `default_language` and `additional_languages` instead. */
35
35
  languages?: Phonic.LanguageCode[] | undefined;
@@ -45,6 +45,7 @@ export type ConversationAnalysisWebhookPayload = {
45
45
  created_at: ISODateTime;
46
46
  data: {
47
47
  conversation: {
48
+ id: string;
48
49
  latencies_ms: number[];
49
50
  interruptions_count: number;
50
51
  };
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.32.6";
1
+ export declare const SDK_VERSION = "0.32.7";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.32.6";
1
+ export const SDK_VERSION = "0.32.7";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phonic",
3
- "version": "0.32.6",
3
+ "version": "0.32.7",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",