phonic 0.30.8 → 0.30.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/README.md +3 -1
  2. package/dist/cjs/Client.js +2 -2
  3. package/dist/cjs/api/resources/agents/client/Client.d.ts +10 -4
  4. package/dist/cjs/api/resources/agents/client/Client.js +12 -8
  5. package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +6 -4
  6. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +9 -6
  7. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.js +1 -0
  8. package/dist/cjs/api/resources/agents/client/requests/UpsertAgentRequest.d.ts +3 -1
  9. package/dist/cjs/api/resources/conversations/client/Client.d.ts +1 -1
  10. package/dist/cjs/api/resources/conversations/client/Client.js +3 -5
  11. package/dist/cjs/api/resources/extractionSchemas/client/Client.d.ts +1 -1
  12. package/dist/cjs/api/resources/extractionSchemas/client/Client.js +3 -5
  13. package/dist/cjs/api/resources/projects/client/Client.d.ts +1 -1
  14. package/dist/cjs/api/resources/projects/client/Client.js +3 -5
  15. package/dist/cjs/api/resources/projects/client/requests/UpdateProjectRequest.d.ts +1 -1
  16. package/dist/cjs/api/resources/tools/client/Client.d.ts +1 -1
  17. package/dist/cjs/api/resources/tools/client/Client.js +3 -5
  18. package/dist/cjs/api/resources/voices/client/Client.d.ts +1 -1
  19. package/dist/cjs/api/resources/voices/client/Client.js +3 -5
  20. package/dist/cjs/api/types/Agent.d.ts +7 -6
  21. package/dist/cjs/api/types/Agent.js +1 -0
  22. package/dist/cjs/api/types/ConfigPayload.d.ts +6 -4
  23. package/dist/cjs/api/types/ConfigPayload.js +2 -0
  24. package/dist/cjs/api/types/Conversation.d.ts +18 -7
  25. package/dist/cjs/api/types/Conversation.js +11 -0
  26. package/dist/cjs/api/types/ConversationExtraction.d.ts +1 -1
  27. package/dist/cjs/api/types/ConversationItem.d.ts +13 -13
  28. package/dist/cjs/api/types/CreateAgentRequest.d.ts +6 -5
  29. package/dist/cjs/api/types/CreateAgentRequest.js +1 -0
  30. package/dist/cjs/api/types/ExtractionField.d.ts +1 -1
  31. package/dist/cjs/api/types/OutboundCallConfig.d.ts +2 -2
  32. package/dist/cjs/api/types/Project.d.ts +1 -1
  33. package/dist/cjs/api/types/ToolCallOutputProcessedPayload.d.ts +8 -8
  34. package/dist/cjs/api/types/Voice.d.ts +1 -1
  35. package/dist/cjs/version.d.ts +1 -1
  36. package/dist/cjs/version.js +1 -1
  37. package/dist/esm/Client.mjs +2 -2
  38. package/dist/esm/api/resources/agents/client/Client.d.mts +10 -4
  39. package/dist/esm/api/resources/agents/client/Client.mjs +12 -8
  40. package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +6 -4
  41. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +9 -6
  42. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.mjs +1 -0
  43. package/dist/esm/api/resources/agents/client/requests/UpsertAgentRequest.d.mts +3 -1
  44. package/dist/esm/api/resources/conversations/client/Client.d.mts +1 -1
  45. package/dist/esm/api/resources/conversations/client/Client.mjs +3 -5
  46. package/dist/esm/api/resources/extractionSchemas/client/Client.d.mts +1 -1
  47. package/dist/esm/api/resources/extractionSchemas/client/Client.mjs +3 -5
  48. package/dist/esm/api/resources/projects/client/Client.d.mts +1 -1
  49. package/dist/esm/api/resources/projects/client/Client.mjs +3 -5
  50. package/dist/esm/api/resources/projects/client/requests/UpdateProjectRequest.d.mts +1 -1
  51. package/dist/esm/api/resources/tools/client/Client.d.mts +1 -1
  52. package/dist/esm/api/resources/tools/client/Client.mjs +3 -5
  53. package/dist/esm/api/resources/voices/client/Client.d.mts +1 -1
  54. package/dist/esm/api/resources/voices/client/Client.mjs +3 -5
  55. package/dist/esm/api/types/Agent.d.mts +7 -6
  56. package/dist/esm/api/types/Agent.mjs +1 -0
  57. package/dist/esm/api/types/ConfigPayload.d.mts +6 -4
  58. package/dist/esm/api/types/ConfigPayload.mjs +2 -0
  59. package/dist/esm/api/types/Conversation.d.mts +18 -7
  60. package/dist/esm/api/types/Conversation.mjs +10 -1
  61. package/dist/esm/api/types/ConversationExtraction.d.mts +1 -1
  62. package/dist/esm/api/types/ConversationItem.d.mts +13 -13
  63. package/dist/esm/api/types/CreateAgentRequest.d.mts +6 -5
  64. package/dist/esm/api/types/CreateAgentRequest.mjs +1 -0
  65. package/dist/esm/api/types/ExtractionField.d.mts +1 -1
  66. package/dist/esm/api/types/OutboundCallConfig.d.mts +2 -2
  67. package/dist/esm/api/types/Project.d.mts +1 -1
  68. package/dist/esm/api/types/ToolCallOutputProcessedPayload.d.mts +8 -8
  69. package/dist/esm/api/types/Voice.d.mts +1 -1
  70. package/dist/esm/version.d.mts +1 -1
  71. package/dist/esm/version.mjs +1 -1
  72. package/package.json +2 -2
  73. package/reference.md +9 -3
@@ -6,17 +6,17 @@ export interface Conversation {
6
6
  /** The conversation ID. */
7
7
  id: string;
8
8
  /** The agent associated with the conversation. */
9
- agent?: Conversation.Agent;
9
+ agent: Conversation.Agent | null;
10
10
  /** The organization/workspace name. */
11
11
  workspace: string;
12
12
  /** The project associated with the conversation. */
13
13
  project: Conversation.Project;
14
14
  /** External ID for conversation tracking. */
15
- external_id?: string;
15
+ external_id: string | null;
16
16
  /** The STS model used. */
17
17
  model: string;
18
18
  /** Welcome message played at start. */
19
- welcome_message?: string;
19
+ welcome_message: string | null;
20
20
  /** Template variables used in the conversation. */
21
21
  template_variables: Record<string, string>;
22
22
  /** Audio input format. */
@@ -28,17 +28,17 @@ export interface Conversation {
28
28
  /** Live transcript of the conversation. */
29
29
  live_transcript: string;
30
30
  /** Post-call processed transcript. */
31
- post_call_transcript?: string;
31
+ post_call_transcript: string | null;
32
32
  /** Duration of the conversation in milliseconds. */
33
33
  duration_ms: number;
34
34
  /** Presigned URL to the conversation audio file. */
35
- audio_url?: string;
35
+ audio_url: string | null;
36
36
  /** When the conversation started. */
37
37
  started_at: string;
38
38
  /** When the conversation ended. */
39
- ended_at?: string;
39
+ ended_at: string | null;
40
40
  /** Who or what ended the conversation. */
41
- ended_by?: string;
41
+ ended_by: Conversation.EndedBy | null;
42
42
  /** Array of conversation items (turns). */
43
43
  items: Phonic.ConversationItem[];
44
44
  /** Results from conversation evaluations and extractions. */
@@ -65,4 +65,15 @@ export declare namespace Conversation {
65
65
  /** The name of the project. */
66
66
  name: string;
67
67
  }
68
+ /**
69
+ * Who or what ended the conversation.
70
+ */
71
+ type EndedBy = "user" | "user_canceled" | "user_validation_failed" | "assistant" | "error";
72
+ const EndedBy: {
73
+ readonly User: "user";
74
+ readonly UserCanceled: "user_canceled";
75
+ readonly UserValidationFailed: "user_validation_failed";
76
+ readonly Assistant: "assistant";
77
+ readonly Error: "error";
78
+ };
68
79
  }
@@ -1,4 +1,13 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- export {};
4
+ export var Conversation;
5
+ (function (Conversation) {
6
+ Conversation.EndedBy = {
7
+ User: "user",
8
+ UserCanceled: "user_canceled",
9
+ UserValidationFailed: "user_validation_failed",
10
+ Assistant: "assistant",
11
+ Error: "error",
12
+ };
13
+ })(Conversation || (Conversation = {}));
@@ -10,7 +10,7 @@ export interface ConversationExtraction {
10
10
  /** The extracted data. */
11
11
  result: Record<string, unknown>;
12
12
  /** Error message if extraction failed. */
13
- error?: string;
13
+ error: string | null;
14
14
  /** When the extraction was created. */
15
15
  created_at: string;
16
16
  }
@@ -9,7 +9,7 @@ export interface ConversationItem {
9
9
  /** Live transcript of this turn. */
10
10
  live_transcript: string;
11
11
  /** Post-call processed transcript. */
12
- post_call_transcript?: string;
12
+ post_call_transcript: string | null;
13
13
  /** Duration of this turn in milliseconds. */
14
14
  duration_ms: number;
15
15
  /** When this turn started. */
@@ -39,29 +39,29 @@ export declare namespace ConversationItem {
39
39
  id: string;
40
40
  tool: Item.Tool;
41
41
  /** HTTP method for webhook tool calls. */
42
- endpoint_method?: string;
42
+ endpoint_method?: string | null;
43
43
  /** URL for webhook tool calls. */
44
- endpoint_url?: string;
44
+ endpoint_url?: string | null;
45
45
  /** Headers for webhook tool calls. */
46
- endpoint_headers?: Record<string, string | undefined>;
46
+ endpoint_headers?: Record<string, string | null> | null;
47
47
  /** Timeout in milliseconds for webhook tool calls. */
48
- endpoint_timeout_ms?: number;
48
+ endpoint_timeout_ms?: number | null;
49
49
  /** When the webhook endpoint was called (null on error). */
50
- endpoint_called_at?: string;
50
+ endpoint_called_at?: string | null;
51
51
  /** Query parameters for webhook tool calls (null on error or when no params). */
52
- query_params?: Record<string, unknown>;
52
+ query_params?: Record<string, unknown> | null;
53
53
  /** HTTP response status code for webhook tool calls (null on error). */
54
- response_status_code?: number;
54
+ response_status_code?: number | null;
55
55
  /** Timeout in milliseconds for websocket tool calls. */
56
- tool_call_output_timeout_ms?: number;
56
+ tool_call_output_timeout_ms?: number | null;
57
57
  /** The request body sent to the tool. */
58
- request_body?: Record<string, unknown>;
58
+ request_body: Record<string, unknown> | null;
59
59
  /** The response body received from the tool. */
60
- response_body?: Record<string, unknown>;
60
+ response_body: Record<string, unknown> | null;
61
61
  /** Whether the tool call timed out. */
62
- timed_out?: boolean;
62
+ timed_out: boolean | null;
63
63
  /** Error message if the tool call failed. */
64
- error_message?: string;
64
+ error_message: string | null;
65
65
  }
66
66
  namespace Item {
67
67
  interface Tool {
@@ -5,7 +5,7 @@ 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?: "assign-automatically";
8
+ phone_number?: "assign-automatically" | null;
9
9
  /** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
10
10
  timezone?: string;
11
11
  /** The voice ID to use. */
@@ -27,7 +27,7 @@ export interface CreateAgentRequest {
27
27
  /** Array of task objects with `name` and `description` fields. */
28
28
  tasks?: Phonic.Task[];
29
29
  /** Number of seconds of silence before sending a poke message. `null` disables the poke message. */
30
- no_input_poke_sec?: number;
30
+ no_input_poke_sec?: number | null;
31
31
  /** The message to send after the specified silence. */
32
32
  no_input_poke_text?: string;
33
33
  /** Seconds of silence before ending the conversation. */
@@ -37,21 +37,22 @@ export interface CreateAgentRequest {
37
37
  /** These words, or short phrases, will be more accurately recognized by the agent. */
38
38
  boosted_keywords?: string[];
39
39
  /** When not `null`, at the beginning of the conversation the agent will make a POST request to this endpoint when to get configuration options. */
40
- configuration_endpoint?: CreateAgentRequest.ConfigurationEndpoint;
40
+ configuration_endpoint?: CreateAgentRequest.ConfigurationEndpoint | null;
41
41
  }
42
42
  export declare namespace CreateAgentRequest {
43
43
  /**
44
44
  * The audio format of the agent.
45
45
  */
46
- type AudioFormat = "pcm_44100" | "pcm_16000" | "mulaw_8000";
46
+ type AudioFormat = "pcm_44100" | "pcm_16000" | "pcm_8000" | "mulaw_8000";
47
47
  const AudioFormat: {
48
48
  readonly Pcm44100: "pcm_44100";
49
49
  readonly Pcm16000: "pcm_16000";
50
+ readonly Pcm8000: "pcm_8000";
50
51
  readonly Mulaw8000: "mulaw_8000";
51
52
  };
52
53
  namespace TemplateVariables {
53
54
  interface Value {
54
- default_value?: string;
55
+ default_value: string | null;
55
56
  is_boosted_keyword?: boolean;
56
57
  }
57
58
  }
@@ -6,6 +6,7 @@ export var CreateAgentRequest;
6
6
  CreateAgentRequest.AudioFormat = {
7
7
  Pcm44100: "pcm_44100",
8
8
  Pcm16000: "pcm_16000",
9
+ Pcm8000: "pcm_8000",
9
10
  Mulaw8000: "mulaw_8000",
10
11
  };
11
12
  })(CreateAgentRequest || (CreateAgentRequest = {}));
@@ -7,7 +7,7 @@ export interface ExtractionField {
7
7
  /** The field type. */
8
8
  type: ExtractionField.Type;
9
9
  /** Description of the field. */
10
- description?: string;
10
+ description?: string | null;
11
11
  }
12
12
  export declare namespace ExtractionField {
13
13
  /**
@@ -10,7 +10,7 @@ export interface OutboundCallConfig {
10
10
  /** The name of the project to use for the call. */
11
11
  project?: string;
12
12
  /** Message to play when the conversation starts. Can contain template variables like `{{customer_name}}`. */
13
- welcome_message?: string;
13
+ welcome_message?: string | null;
14
14
  /** Instructions for the conversation. Can contain template variables like `{{subject}}`. */
15
15
  system_prompt?: string;
16
16
  /** Variables that can be used in the welcome message and the system prompt. */
@@ -18,7 +18,7 @@ export interface OutboundCallConfig {
18
18
  /** The voice ID to use for the agent. */
19
19
  voice_id?: string;
20
20
  /** Number of seconds of silence before sending a poke message. `null` disables the poke message. */
21
- no_input_poke_sec?: number;
21
+ no_input_poke_sec?: number | null;
22
22
  /** The message to send after the specified silence. */
23
23
  no_input_poke_text?: string;
24
24
  /** Seconds of silence before ending the conversation. */
@@ -7,7 +7,7 @@ export interface Project {
7
7
  /** The name of the project. */
8
8
  name: string;
9
9
  /** The project's default agent. */
10
- default_agent?: Project.DefaultAgent;
10
+ default_agent: Project.DefaultAgent | null;
11
11
  }
12
12
  export declare namespace Project {
13
13
  /**
@@ -7,23 +7,23 @@ export interface ToolCallOutputProcessedPayload {
7
7
  tool_call_id: string;
8
8
  tool: ToolCallOutputProcessedPayload.Tool;
9
9
  /** Webhook endpoint URL (null for WebSocket tools) */
10
- endpoint_url?: string;
10
+ endpoint_url?: string | null;
11
11
  /** Webhook timeout in milliseconds (null for WebSocket tools) */
12
- endpoint_timeout_ms?: number;
12
+ endpoint_timeout_ms?: number | null;
13
13
  /** When webhook was called (null for WebSocket tools) */
14
- endpoint_called_at?: string;
14
+ endpoint_called_at?: string | null;
15
15
  /** Webhook request body (null for WebSocket tools) */
16
- request_body?: Record<string, unknown>;
16
+ request_body?: Record<string, unknown> | null;
17
17
  response_body?: unknown;
18
18
  /** WebSocket tool parameters (null for webhook tools) */
19
- parameters?: Record<string, unknown>;
19
+ parameters?: Record<string, unknown> | null;
20
20
  output?: unknown;
21
21
  /** Webhook HTTP status code (null for WebSocket tools) */
22
- response_status_code?: number;
22
+ response_status_code?: number | null;
23
23
  /** Whether the tool call timed out */
24
- timed_out?: boolean;
24
+ timed_out?: boolean | null;
25
25
  /** Error message if tool call failed */
26
- error_message?: string;
26
+ error_message?: string | null;
27
27
  }
28
28
  export declare namespace ToolCallOutputProcessedPayload {
29
29
  interface Tool {
@@ -7,5 +7,5 @@ export interface Voice {
7
7
  /** The voice name. */
8
8
  name: string;
9
9
  /** The voice description. */
10
- description?: string;
10
+ description: string | null;
11
11
  }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.30.8";
1
+ export declare const SDK_VERSION = "0.30.9";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.30.8";
1
+ export const SDK_VERSION = "0.30.9";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phonic",
3
- "version": "0.30.8",
3
+ "version": "0.30.9",
4
4
  "private": false,
5
5
  "repository": "github:Phonic-Co/phonic-node",
6
6
  "type": "commonjs",
@@ -50,7 +50,7 @@
50
50
  "@types/jest": "^29.5.14",
51
51
  "ts-jest": "^29.3.4",
52
52
  "jest-environment-jsdom": "^29.7.0",
53
- "msw": "^2.8.4",
53
+ "msw": "2.11.2",
54
54
  "@types/node": "^18.19.70",
55
55
  "prettier": "^3.4.2",
56
56
  "typescript": "~5.7.2"
package/reference.md CHANGED
@@ -104,7 +104,9 @@ await client.agents.create({
104
104
  welcome_message: "Hi {{customer_name}}. How can I help you today?",
105
105
  system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
106
106
  template_variables: {
107
- customer_name: {},
107
+ customer_name: {
108
+ default_value: null,
109
+ },
108
110
  subject: {
109
111
  default_value: "Chess",
110
112
  },
@@ -195,7 +197,9 @@ await client.agents.upsert({
195
197
  welcome_message: "Hi {{customer_name}}. How can I help you today?",
196
198
  system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
197
199
  template_variables: {
198
- customer_name: {},
200
+ customer_name: {
201
+ default_value: null,
202
+ },
199
203
  subject: {
200
204
  default_value: "Chess",
201
205
  },
@@ -432,7 +436,9 @@ await client.agents.update("nameOrId", {
432
436
  welcome_message: "Hi {{customer_name}}. How can I help you today?",
433
437
  system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
434
438
  template_variables: {
435
- customer_name: {},
439
+ customer_name: {
440
+ default_value: null,
441
+ },
436
442
  subject: {
437
443
  default_value: "Chess",
438
444
  },