phonic 0.32.12 → 0.32.14

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 (53) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +1 -1
  3. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +1 -1
  4. package/dist/cjs/api/resources/tools/client/Client.d.ts +65 -0
  5. package/dist/cjs/api/resources/tools/client/Client.js +65 -0
  6. package/dist/cjs/api/resources/tools/client/requests/CreateToolRequest.d.ts +99 -5
  7. package/dist/cjs/api/resources/tools/client/requests/CreateToolRequest.js +7 -0
  8. package/dist/cjs/api/resources/tools/client/requests/UpdateToolRequest.d.ts +26 -6
  9. package/dist/cjs/api/resources/tools/client/requests/UpdateToolRequest.js +8 -1
  10. package/dist/cjs/api/types/Agent.d.ts +1 -1
  11. package/dist/cjs/api/types/ConfigOptions.d.ts +1 -1
  12. package/dist/cjs/api/types/CreateAgentRequest.d.ts +1 -1
  13. package/dist/cjs/api/types/InlineWebSocketTool.d.ts +2 -0
  14. package/dist/cjs/api/types/OutboundCallConfig.d.ts +1 -1
  15. package/dist/cjs/api/types/Tool.d.ts +26 -2
  16. package/dist/cjs/api/types/Tool.js +7 -0
  17. package/dist/cjs/api/types/ToolParameter.d.ts +5 -2
  18. package/dist/cjs/api/types/ToolParameter.js +2 -1
  19. package/dist/cjs/api/types/ToolParametersJsonSchema.d.ts +15 -0
  20. package/dist/cjs/api/types/ToolParametersJsonSchema.js +3 -0
  21. package/dist/cjs/api/types/index.d.ts +1 -0
  22. package/dist/cjs/api/types/index.js +1 -0
  23. package/dist/cjs/custom/ReconnectableConversationsSocket.d.ts +16 -0
  24. package/dist/cjs/custom/ReconnectableConversationsSocket.js +127 -11
  25. package/dist/cjs/version.d.ts +1 -1
  26. package/dist/cjs/version.js +1 -1
  27. package/dist/esm/BaseClient.mjs +2 -2
  28. package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +1 -1
  29. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +1 -1
  30. package/dist/esm/api/resources/tools/client/Client.d.mts +65 -0
  31. package/dist/esm/api/resources/tools/client/Client.mjs +65 -0
  32. package/dist/esm/api/resources/tools/client/requests/CreateToolRequest.d.mts +99 -5
  33. package/dist/esm/api/resources/tools/client/requests/CreateToolRequest.mjs +7 -0
  34. package/dist/esm/api/resources/tools/client/requests/UpdateToolRequest.d.mts +26 -6
  35. package/dist/esm/api/resources/tools/client/requests/UpdateToolRequest.mjs +8 -1
  36. package/dist/esm/api/types/Agent.d.mts +1 -1
  37. package/dist/esm/api/types/ConfigOptions.d.mts +1 -1
  38. package/dist/esm/api/types/CreateAgentRequest.d.mts +1 -1
  39. package/dist/esm/api/types/InlineWebSocketTool.d.mts +2 -0
  40. package/dist/esm/api/types/OutboundCallConfig.d.mts +1 -1
  41. package/dist/esm/api/types/Tool.d.mts +26 -2
  42. package/dist/esm/api/types/Tool.mjs +7 -0
  43. package/dist/esm/api/types/ToolParameter.d.mts +5 -2
  44. package/dist/esm/api/types/ToolParameter.mjs +2 -1
  45. package/dist/esm/api/types/ToolParametersJsonSchema.d.mts +15 -0
  46. package/dist/esm/api/types/ToolParametersJsonSchema.mjs +2 -0
  47. package/dist/esm/api/types/index.d.mts +1 -0
  48. package/dist/esm/api/types/index.mjs +1 -0
  49. package/dist/esm/custom/ReconnectableConversationsSocket.d.mts +16 -0
  50. package/dist/esm/custom/ReconnectableConversationsSocket.mjs +127 -11
  51. package/dist/esm/version.d.mts +1 -1
  52. package/dist/esm/version.mjs +1 -1
  53. 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.12",
47
- "User-Agent": "phonic/0.32.12",
46
+ "X-Fern-SDK-Version": "0.32.13",
47
+ "User-Agent": "phonic/0.32.13",
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);
@@ -133,7 +133,7 @@ export interface AgentsCreateRequest {
133
133
  vad_min_silence_duration_ms?: number;
134
134
  /** Voice activity detection threshold. */
135
135
  vad_threshold?: number;
136
- /** When `true`, PII and PHI are redacted from text transcripts (e.g. replaced with tags like `[PHONE NUMBER]`) and bleeped from audio recordings after the conversation ends. */
136
+ /** When `true`, PII and PHI are redacted from text transcripts (e.g. replaced with tags like `[PHONE]`) and bleeped from audio recordings after the conversation ends. */
137
137
  enable_redaction?: boolean;
138
138
  /** Array of MCP server IDs to make available to the agent. */
139
139
  mcp_server_ids?: string[];
@@ -139,7 +139,7 @@ export interface UpdateAgentRequest {
139
139
  vad_min_silence_duration_ms?: number;
140
140
  /** Voice activity detection threshold. */
141
141
  vad_threshold?: number;
142
- /** When `true`, PII and PHI are redacted from text transcripts (e.g. replaced with tags like `[PHONE NUMBER]`) and bleeped from audio recordings after the conversation ends. */
142
+ /** When `true`, PII and PHI are redacted from text transcripts (e.g. replaced with tags like `[PHONE]`) and bleeped from audio recordings after the conversation ends. */
143
143
  enable_redaction?: boolean;
144
144
  /** Array of MCP server IDs to make available to the agent. */
145
145
  mcp_server_ids?: string[];
@@ -90,6 +90,71 @@ export declare class ToolsClient {
90
90
  * @example
91
91
  * await client.tools.create({
92
92
  * project: "main",
93
+ * name: "create_order",
94
+ * description: "Creates an order in the fulfillment system",
95
+ * type: "custom_webhook",
96
+ * execution_mode: "sync",
97
+ * parameters: {
98
+ * type: "object",
99
+ * properties: {
100
+ * "customer": {
101
+ * "type": "object",
102
+ * "description": "The customer placing the order",
103
+ * "properties": {
104
+ * "name": {
105
+ * "type": "string",
106
+ * "description": "The customer's full name"
107
+ * },
108
+ * "tier": {
109
+ * "type": "string",
110
+ * "enum": [
111
+ * "free",
112
+ * "pro"
113
+ * ],
114
+ * "description": "The customer's subscription tier"
115
+ * }
116
+ * },
117
+ * "required": [
118
+ * "name"
119
+ * ]
120
+ * },
121
+ * "items": {
122
+ * "type": "array",
123
+ * "description": "The items being ordered",
124
+ * "items": {
125
+ * "type": "object",
126
+ * "properties": {
127
+ * "sku": {
128
+ * "type": "string",
129
+ * "description": "The item's SKU"
130
+ * },
131
+ * "quantity": {
132
+ * "type": "integer",
133
+ * "description": "How many of the item to order"
134
+ * }
135
+ * },
136
+ * "required": [
137
+ * "sku",
138
+ * "quantity"
139
+ * ]
140
+ * }
141
+ * }
142
+ * },
143
+ * required: ["customer", "items"],
144
+ * additionalProperties: false
145
+ * },
146
+ * parameter_locations: {
147
+ * "customer": "request_body",
148
+ * "items": "request_body"
149
+ * },
150
+ * endpoint_method: "POST",
151
+ * endpoint_url: "https://api.example.com/orders",
152
+ * endpoint_timeout_ms: 5000
153
+ * })
154
+ *
155
+ * @example
156
+ * await client.tools.create({
157
+ * project: "main",
93
158
  * name: "check_inventory",
94
159
  * description: "Checks product inventory levels",
95
160
  * type: "custom_websocket",
@@ -186,6 +186,71 @@ class ToolsClient {
186
186
  * @example
187
187
  * await client.tools.create({
188
188
  * project: "main",
189
+ * name: "create_order",
190
+ * description: "Creates an order in the fulfillment system",
191
+ * type: "custom_webhook",
192
+ * execution_mode: "sync",
193
+ * parameters: {
194
+ * type: "object",
195
+ * properties: {
196
+ * "customer": {
197
+ * "type": "object",
198
+ * "description": "The customer placing the order",
199
+ * "properties": {
200
+ * "name": {
201
+ * "type": "string",
202
+ * "description": "The customer's full name"
203
+ * },
204
+ * "tier": {
205
+ * "type": "string",
206
+ * "enum": [
207
+ * "free",
208
+ * "pro"
209
+ * ],
210
+ * "description": "The customer's subscription tier"
211
+ * }
212
+ * },
213
+ * "required": [
214
+ * "name"
215
+ * ]
216
+ * },
217
+ * "items": {
218
+ * "type": "array",
219
+ * "description": "The items being ordered",
220
+ * "items": {
221
+ * "type": "object",
222
+ * "properties": {
223
+ * "sku": {
224
+ * "type": "string",
225
+ * "description": "The item's SKU"
226
+ * },
227
+ * "quantity": {
228
+ * "type": "integer",
229
+ * "description": "How many of the item to order"
230
+ * }
231
+ * },
232
+ * "required": [
233
+ * "sku",
234
+ * "quantity"
235
+ * ]
236
+ * }
237
+ * }
238
+ * },
239
+ * required: ["customer", "items"],
240
+ * additionalProperties: false
241
+ * },
242
+ * parameter_locations: {
243
+ * "customer": "request_body",
244
+ * "items": "request_body"
245
+ * },
246
+ * endpoint_method: "POST",
247
+ * endpoint_url: "https://api.example.com/orders",
248
+ * endpoint_timeout_ms: 5000
249
+ * })
250
+ *
251
+ * @example
252
+ * await client.tools.create({
253
+ * project: "main",
189
254
  * name: "check_inventory",
190
255
  * description: "Checks product inventory levels",
191
256
  * type: "custom_websocket",
@@ -55,6 +55,71 @@ import type * as Phonic from "../../../../index.js";
55
55
  * @example
56
56
  * {
57
57
  * project: "main",
58
+ * name: "create_order",
59
+ * description: "Creates an order in the fulfillment system",
60
+ * type: "custom_webhook",
61
+ * execution_mode: "sync",
62
+ * parameters: {
63
+ * type: "object",
64
+ * properties: {
65
+ * "customer": {
66
+ * "type": "object",
67
+ * "description": "The customer placing the order",
68
+ * "properties": {
69
+ * "name": {
70
+ * "type": "string",
71
+ * "description": "The customer's full name"
72
+ * },
73
+ * "tier": {
74
+ * "type": "string",
75
+ * "enum": [
76
+ * "free",
77
+ * "pro"
78
+ * ],
79
+ * "description": "The customer's subscription tier"
80
+ * }
81
+ * },
82
+ * "required": [
83
+ * "name"
84
+ * ]
85
+ * },
86
+ * "items": {
87
+ * "type": "array",
88
+ * "description": "The items being ordered",
89
+ * "items": {
90
+ * "type": "object",
91
+ * "properties": {
92
+ * "sku": {
93
+ * "type": "string",
94
+ * "description": "The item's SKU"
95
+ * },
96
+ * "quantity": {
97
+ * "type": "integer",
98
+ * "description": "How many of the item to order"
99
+ * }
100
+ * },
101
+ * "required": [
102
+ * "sku",
103
+ * "quantity"
104
+ * ]
105
+ * }
106
+ * }
107
+ * },
108
+ * required: ["customer", "items"],
109
+ * additionalProperties: false
110
+ * },
111
+ * parameter_locations: {
112
+ * "customer": "request_body",
113
+ * "items": "request_body"
114
+ * },
115
+ * endpoint_method: "POST",
116
+ * endpoint_url: "https://api.example.com/orders",
117
+ * endpoint_timeout_ms: 5000
118
+ * }
119
+ *
120
+ * @example
121
+ * {
122
+ * project: "main",
58
123
  * name: "check_inventory",
59
124
  * description: "Checks product inventory levels",
60
125
  * type: "custom_websocket",
@@ -111,12 +176,21 @@ export interface CreateToolRequest {
111
176
  /** Mode of operation. */
112
177
  execution_mode: CreateToolRequest.ExecutionMode;
113
178
  /**
114
- * Array of parameter definitions.
115
- * For `custom_webhook` tools with POST method, each parameter must include a `location` field.
116
- * For `custom_webhook` tools with GET method, `location` defaults to `"query_string"` if not specified.
117
- * For `custom_websocket`, `built_in_transfer_to_phone_number`, and `built_in_transfer_to_agent` tools, `location` must not be specified.
179
+ * The tool's parameters, either as a flat array of parameter definitions or as a raw JSON Schema object (use the object form for nested parameters).
180
+ * When sending an array:
181
+ * - For `custom_webhook` tools with POST method, each parameter must include a `location` field.
182
+ * - For `custom_webhook` tools with GET method, `location` defaults to `"query_string"` if not specified.
183
+ * - For `custom_websocket`, `built_in_transfer_to_phone_number`, and `built_in_transfer_to_agent` tools, `location` must not be specified.
184
+ * - `parameter_locations` must not be sent, since placement is carried inline on each parameter.
185
+ * When sending a JSON Schema object, `custom_webhook` tools supply parameter placement in `parameter_locations` instead.
186
+ * Tools that cannot have parameters (`custom_context` and the `built_in_*` types) must send an empty array or omit the field.
118
187
  */
119
- parameters?: Phonic.ToolParameter[];
188
+ parameters?: CreateToolRequest.Parameters;
189
+ /**
190
+ * Where each top-level parameter is sent in the webhook request, as a map from parameter name to location. Only for `custom_webhook` tools whose `parameters` are a raw JSON Schema object.
191
+ * Every key must name a top-level parameter. For POST webhooks, every parameter needs an entry. For GET webhooks, entries default to `"query_string"` and `"request_body"` is not allowed.
192
+ */
193
+ parameter_locations?: Record<string, CreateToolRequest.ParameterLocations.Value>;
120
194
  /** Required for webhook tools. HTTP method for the webhook endpoint. */
121
195
  endpoint_method?: CreateToolRequest.EndpointMethod;
122
196
  /** Required for webhook tools. Must be a publicly routable HTTPS URL without embedded credentials. */
@@ -147,6 +221,8 @@ export interface CreateToolRequest {
147
221
  wait_for_speech_before_tool_call?: boolean;
148
222
  /** When true, forbids the agent from speaking after executing the tool. Available for custom_context, custom_webhook and custom_websocket tools. */
149
223
  forbid_speech_after_tool_call?: boolean;
224
+ /** When true, forbids the agent from calling the tool right after it has spoken. Available for custom_webhook and custom_websocket tools. */
225
+ forbid_tool_call_after_speech?: boolean;
150
226
  /** When true, allows the agent to chain and execute other tools after executing the tool. Available for custom_context, custom_webhook and custom_websocket tools. */
151
227
  allow_tool_chaining?: boolean;
152
228
  /** The agent doesn't typically wait for the response of async custom_websocket tools. When true, makes the agent wait for a response, not call other tools and inform the user of the result. Only available for async custom_websocket tools. */
@@ -173,6 +249,24 @@ export declare namespace CreateToolRequest {
173
249
  readonly Async: "async";
174
250
  };
175
251
  type ExecutionMode = (typeof ExecutionMode)[keyof typeof ExecutionMode];
252
+ /**
253
+ * The tool's parameters, either as a flat array of parameter definitions or as a raw JSON Schema object (use the object form for nested parameters).
254
+ * When sending an array:
255
+ * - For `custom_webhook` tools with POST method, each parameter must include a `location` field.
256
+ * - For `custom_webhook` tools with GET method, `location` defaults to `"query_string"` if not specified.
257
+ * - For `custom_websocket`, `built_in_transfer_to_phone_number`, and `built_in_transfer_to_agent` tools, `location` must not be specified.
258
+ * - `parameter_locations` must not be sent, since placement is carried inline on each parameter.
259
+ * When sending a JSON Schema object, `custom_webhook` tools supply parameter placement in `parameter_locations` instead.
260
+ * Tools that cannot have parameters (`custom_context` and the `built_in_*` types) must send an empty array or omit the field.
261
+ */
262
+ type Parameters = Phonic.ToolParameter[] | Phonic.ToolParametersJsonSchema;
263
+ namespace ParameterLocations {
264
+ const Value: {
265
+ readonly RequestBody: "request_body";
266
+ readonly QueryString: "query_string";
267
+ };
268
+ type Value = (typeof Value)[keyof typeof Value];
269
+ }
176
270
  /** Required for webhook tools. HTTP method for the webhook endpoint. */
177
271
  const EndpointMethod: {
178
272
  readonly Get: "GET";
@@ -20,6 +20,13 @@ var CreateToolRequest;
20
20
  Sync: "sync",
21
21
  Async: "async",
22
22
  };
23
+ let ParameterLocations;
24
+ (function (ParameterLocations) {
25
+ ParameterLocations.Value = {
26
+ RequestBody: "request_body",
27
+ QueryString: "query_string",
28
+ };
29
+ })(ParameterLocations = CreateToolRequest.ParameterLocations || (CreateToolRequest.ParameterLocations = {}));
23
30
  /** Required for webhook tools. HTTP method for the webhook endpoint. */
24
31
  CreateToolRequest.EndpointMethod = {
25
32
  Get: "GET",
@@ -22,13 +22,18 @@ export interface UpdateToolRequest {
22
22
  /** The static context returned to the agent. Only applicable to custom_context tools. */
23
23
  context?: string;
24
24
  /**
25
- * Array of parameter definitions.
26
- * When updating `endpoint_method`, all parameters must include explicit `location` values.
27
- * For `custom_webhook` tools: `location` is required for POST, defaults to `"query_string"` for GET.
25
+ * The tool's parameters, either as a flat array of parameter definitions or as a raw JSON Schema object (use the object form for nested parameters). Replaces the tool's existing parameters, including the form they are stored in.
26
+ * For `custom_webhook` tools: when sending an array, `location` is required for POST and defaults to `"query_string"` for GET, and `parameter_locations` must not be sent; when sending a JSON Schema object, placement is supplied in `parameter_locations`.
28
27
  * For `custom_websocket`, `built_in_transfer_to_phone_number`, and `built_in_transfer_to_agent` tools: `location` must not be specified.
29
28
  */
30
- parameters?: Phonic.ToolParameter[];
31
- /** HTTP method for webhook tools. When changing this value, all parameters must include explicit `location` values. */
29
+ parameters?: UpdateToolRequest.Parameters;
30
+ /**
31
+ * Where each top-level parameter is sent in the webhook request, as a map from parameter name to location. Only for `custom_webhook` tools whose `parameters` are a raw JSON Schema object.
32
+ * Can be sent on its own to move existing parameters without resending `parameters`; entries are merged over the tool's current placement, so parameters left out keep where they were.
33
+ * Every key must name a top-level parameter. For POST webhooks, every parameter needs a placement. For GET webhooks, unplaced parameters default to `"query_string"` and `"request_body"` is not allowed.
34
+ */
35
+ parameter_locations?: Record<string, UpdateToolRequest.ParameterLocations.Value>;
36
+ /** HTTP method for webhook tools. When switching from POST to GET, a tool with request body parameters must also send new `parameters` (or `parameter_locations`) placing them in the query string. */
32
37
  endpoint_method?: UpdateToolRequest.EndpointMethod;
33
38
  /** URL for webhook tools. Must be a publicly routable HTTPS URL without embedded credentials. */
34
39
  endpoint_url?: string;
@@ -56,6 +61,8 @@ export interface UpdateToolRequest {
56
61
  wait_for_speech_before_tool_call?: boolean;
57
62
  /** When true, forbids the agent from speaking after executing the tool. Available for custom_context, custom_webhook and custom_websocket tools. */
58
63
  forbid_speech_after_tool_call?: boolean;
64
+ /** When true, forbids the agent from calling the tool right after it has spoken. Available for custom_webhook and custom_websocket tools. */
65
+ forbid_tool_call_after_speech?: boolean;
59
66
  /** When true, allows the agent to chain and execute other tools after executing the tool. Available for custom_context, custom_webhook and custom_websocket tools. */
60
67
  allow_tool_chaining?: boolean;
61
68
  /** The agent doesn't typically wait for the response of async custom_websocket tools. When true, makes the agent wait for a response, not call other tools and inform the user of the result. Only available for async custom_websocket tools. */
@@ -68,7 +75,20 @@ export declare namespace UpdateToolRequest {
68
75
  readonly Async: "async";
69
76
  };
70
77
  type ExecutionMode = (typeof ExecutionMode)[keyof typeof ExecutionMode];
71
- /** HTTP method for webhook tools. When changing this value, all parameters must include explicit `location` values. */
78
+ /**
79
+ * The tool's parameters, either as a flat array of parameter definitions or as a raw JSON Schema object (use the object form for nested parameters). Replaces the tool's existing parameters, including the form they are stored in.
80
+ * For `custom_webhook` tools: when sending an array, `location` is required for POST and defaults to `"query_string"` for GET, and `parameter_locations` must not be sent; when sending a JSON Schema object, placement is supplied in `parameter_locations`.
81
+ * For `custom_websocket`, `built_in_transfer_to_phone_number`, and `built_in_transfer_to_agent` tools: `location` must not be specified.
82
+ */
83
+ type Parameters = Phonic.ToolParameter[] | Phonic.ToolParametersJsonSchema;
84
+ namespace ParameterLocations {
85
+ const Value: {
86
+ readonly RequestBody: "request_body";
87
+ readonly QueryString: "query_string";
88
+ };
89
+ type Value = (typeof Value)[keyof typeof Value];
90
+ }
91
+ /** HTTP method for webhook tools. When switching from POST to GET, a tool with request body parameters must also send new `parameters` (or `parameter_locations`) placing them in the query string. */
72
92
  const EndpointMethod: {
73
93
  readonly Get: "GET";
74
94
  readonly Post: "POST";
@@ -9,7 +9,14 @@ var UpdateToolRequest;
9
9
  Sync: "sync",
10
10
  Async: "async",
11
11
  };
12
- /** HTTP method for webhook tools. When changing this value, all parameters must include explicit `location` values. */
12
+ let ParameterLocations;
13
+ (function (ParameterLocations) {
14
+ ParameterLocations.Value = {
15
+ RequestBody: "request_body",
16
+ QueryString: "query_string",
17
+ };
18
+ })(ParameterLocations = UpdateToolRequest.ParameterLocations || (UpdateToolRequest.ParameterLocations = {}));
19
+ /** HTTP method for webhook tools. When switching from POST to GET, a tool with request body parameters must also send new `parameters` (or `parameter_locations`) placing them in the query string. */
13
20
  UpdateToolRequest.EndpointMethod = {
14
21
  Get: "GET",
15
22
  Post: "POST",
@@ -84,7 +84,7 @@ export interface Agent {
84
84
  vad_min_silence_duration_ms?: number | undefined;
85
85
  /** Voice activity detection threshold. */
86
86
  vad_threshold?: number | undefined;
87
- /** When `true`, PII and PHI are redacted from text transcripts (e.g. replaced with tags like `[PHONE NUMBER]`) and bleeped from audio recordings after the conversation ends. */
87
+ /** When `true`, PII and PHI are redacted from text transcripts (e.g. replaced with tags like `[PHONE]`) and bleeped from audio recordings after the conversation ends. */
88
88
  enable_redaction?: boolean | undefined;
89
89
  /** The URL-friendly slug of the agent. */
90
90
  slug?: string | undefined;
@@ -69,7 +69,7 @@ export interface ConfigOptions {
69
69
  tools?: Phonic.ToolDefinition[] | undefined;
70
70
  /** Template variables for system prompt and welcome message */
71
71
  template_variables?: Record<string, string> | undefined;
72
- /** When `true`, PII and PHI are redacted from text transcripts (e.g. replaced with tags like `[PHONE NUMBER]`) and bleeped from audio recordings after the conversation ends. */
72
+ /** When `true`, PII and PHI are redacted from text transcripts (e.g. replaced with tags like `[PHONE]`) and bleeped from audio recordings after the conversation ends. */
73
73
  enable_redaction?: boolean | undefined;
74
74
  /** Names of pre-configured MCP servers to make available to the assistant. Names must be unique. */
75
75
  mcp_servers?: string[] | undefined;
@@ -86,7 +86,7 @@ export interface CreateAgentRequest {
86
86
  vad_min_silence_duration_ms?: number | undefined;
87
87
  /** Voice activity detection threshold. */
88
88
  vad_threshold?: number | undefined;
89
- /** When `true`, PII and PHI are redacted from text transcripts (e.g. replaced with tags like `[PHONE NUMBER]`) and bleeped from audio recordings after the conversation ends. */
89
+ /** When `true`, PII and PHI are redacted from text transcripts (e.g. replaced with tags like `[PHONE]`) and bleeped from audio recordings after the conversation ends. */
90
90
  enable_redaction?: boolean | undefined;
91
91
  /** Array of MCP server IDs to make available to the agent. */
92
92
  mcp_server_ids?: string[] | undefined;
@@ -15,6 +15,8 @@ export interface InlineWebSocketTool {
15
15
  wait_for_speech_before_tool_call?: boolean | undefined;
16
16
  /** When true, prevents the assistant from speaking after executing the tool. */
17
17
  forbid_speech_after_tool_call?: boolean | undefined;
18
+ /** When true, prevents the assistant from calling the tool right after it has spoken. */
19
+ forbid_tool_call_after_speech?: boolean | undefined;
18
20
  /** When true, allows the assistant to call another tool after this tool. */
19
21
  allow_tool_chaining?: boolean | undefined;
20
22
  /** For async tools, when true, the assistant waits for the response and speaks when it arrives. */
@@ -47,7 +47,7 @@ export interface OutboundCallConfig {
47
47
  min_words_to_interrupt?: number | undefined;
48
48
  /** Array of built-in or custom tool names to use. */
49
49
  tools?: OutboundCallConfig.Tools.Item[] | undefined;
50
- /** When `true`, PII and PHI are redacted from text transcripts (e.g. replaced with tags like `[PHONE NUMBER]`) and bleeped from audio recordings after the conversation ends. */
50
+ /** When `true`, PII and PHI are redacted from text transcripts (e.g. replaced with tags like `[PHONE]`) and bleeped from audio recordings after the conversation ends. */
51
51
  enable_redaction?: boolean | undefined;
52
52
  /** The speech-to-speech model to use. */
53
53
  model?: "merritt" | undefined;
@@ -11,8 +11,17 @@ export interface Tool {
11
11
  type: Tool.Type;
12
12
  /** Mode of operation - sync waits for response, async continues without waiting. */
13
13
  execution_mode?: Tool.ExecutionMode | undefined;
14
- /** Array of parameter definitions for the tool. */
15
- parameters: Phonic.ToolParameter[];
14
+ /**
15
+ * The tool's parameters, returned in the same form they were defined in.
16
+ * Tools defined with a flat list of parameters return an array of parameter definitions (with `location` included inline for `custom_webhook` tools).
17
+ * Tools defined with a raw JSON Schema object return that object; for `custom_webhook` tools the parameter placement is then returned separately in `parameter_locations`.
18
+ */
19
+ parameters: Tool.Parameters;
20
+ /**
21
+ * Where each top-level parameter is sent in the webhook request, as a map from parameter name to location.
22
+ * Only returned for `custom_webhook` tools whose `parameters` are a raw JSON Schema object. Tools defined with a flat list of parameters carry `location` inline on each parameter instead.
23
+ */
24
+ parameter_locations?: Record<string, Tool.ParameterLocations.Value> | undefined;
16
25
  /** HTTP method for webhook tools. */
17
26
  endpoint_method?: Tool.EndpointMethod | undefined;
18
27
  /** URL for webhook tools. */
@@ -43,6 +52,8 @@ export interface Tool {
43
52
  wait_for_speech_before_tool_call?: boolean | undefined;
44
53
  /** When true, forbids the agent from speaking after executing the tool. Available for custom_context, custom_webhook and custom_websocket tools. */
45
54
  forbid_speech_after_tool_call?: boolean | undefined;
55
+ /** When true, forbids the agent from calling the tool right after it has spoken. Available for custom_webhook and custom_websocket tools. */
56
+ forbid_tool_call_after_speech?: boolean | undefined;
46
57
  /** When true, allows the agent to chain and execute other tools after executing the tool. Available for custom_context, custom_webhook and custom_websocket tools. */
47
58
  allow_tool_chaining?: boolean | undefined;
48
59
  /** The agent doesn't typically wait for the response of async custom_websocket tools. When true, makes the agent wait for a response, not call other tools and inform the user of the result. Only available for async custom_websocket tools. */
@@ -73,6 +84,19 @@ export declare namespace Tool {
73
84
  readonly Async: "async";
74
85
  };
75
86
  type ExecutionMode = (typeof ExecutionMode)[keyof typeof ExecutionMode];
87
+ /**
88
+ * The tool's parameters, returned in the same form they were defined in.
89
+ * Tools defined with a flat list of parameters return an array of parameter definitions (with `location` included inline for `custom_webhook` tools).
90
+ * Tools defined with a raw JSON Schema object return that object; for `custom_webhook` tools the parameter placement is then returned separately in `parameter_locations`.
91
+ */
92
+ type Parameters = Phonic.ToolParameter[] | Phonic.ToolParametersJsonSchema;
93
+ namespace ParameterLocations {
94
+ const Value: {
95
+ readonly RequestBody: "request_body";
96
+ readonly QueryString: "query_string";
97
+ };
98
+ type Value = (typeof Value)[keyof typeof Value];
99
+ }
76
100
  /** HTTP method for webhook tools. */
77
101
  const EndpointMethod: {
78
102
  readonly Get: "GET";
@@ -20,6 +20,13 @@ var Tool;
20
20
  Sync: "sync",
21
21
  Async: "async",
22
22
  };
23
+ let ParameterLocations;
24
+ (function (ParameterLocations) {
25
+ ParameterLocations.Value = {
26
+ RequestBody: "request_body",
27
+ QueryString: "query_string",
28
+ };
29
+ })(ParameterLocations = Tool.ParameterLocations || (Tool.ParameterLocations = {}));
23
30
  /** HTTP method for webhook tools. */
24
31
  Tool.EndpointMethod = {
25
32
  Get: "GET",
@@ -3,6 +3,8 @@ export interface ToolParameter {
3
3
  type: ToolParameter.Type;
4
4
  /** Required only when type is "array". The type of items in the array. */
5
5
  item_type?: ToolParameter.ItemType | undefined;
6
+ /** Required only when type is "enum". The fixed set of allowed string values for the parameter. Values must be unique and non-empty. */
7
+ enum_values?: string[] | undefined;
6
8
  /** The parameter name. */
7
9
  name: string;
8
10
  /** Description of the parameter. */
@@ -14,7 +16,7 @@ export interface ToolParameter {
14
16
  * - For GET webhooks: defaults to `"query_string"` and `"request_body"` is not allowed.
15
17
  * - For POST webhooks: required, can be either `"request_body"` or `"query_string"`.
16
18
  * - Not allowed for `custom_websocket`, `built_in_transfer_to_phone_number`, or `built_in_transfer_to_agent` tools.
17
- * When updating a tool's type or endpoint_method, all parameters must include explicit `location` values.
19
+ * When switching a webhook tool's `endpoint_method` from POST to GET, its request body parameters must be re-sent with `"query_string"` locations.
18
20
  */
19
21
  location?: ToolParameter.Location | undefined;
20
22
  }
@@ -26,6 +28,7 @@ export declare namespace ToolParameter {
26
28
  readonly Number: "number";
27
29
  readonly Boolean: "boolean";
28
30
  readonly Array: "array";
31
+ readonly Enum: "enum";
29
32
  };
30
33
  type Type = (typeof Type)[keyof typeof Type];
31
34
  /** Required only when type is "array". The type of items in the array. */
@@ -41,7 +44,7 @@ export declare namespace ToolParameter {
41
44
  * - For GET webhooks: defaults to `"query_string"` and `"request_body"` is not allowed.
42
45
  * - For POST webhooks: required, can be either `"request_body"` or `"query_string"`.
43
46
  * - Not allowed for `custom_websocket`, `built_in_transfer_to_phone_number`, or `built_in_transfer_to_agent` tools.
44
- * When updating a tool's type or endpoint_method, all parameters must include explicit `location` values.
47
+ * When switching a webhook tool's `endpoint_method` from POST to GET, its request body parameters must be re-sent with `"query_string"` locations.
45
48
  */
46
49
  const Location: {
47
50
  readonly RequestBody: "request_body";
@@ -11,6 +11,7 @@ var ToolParameter;
11
11
  Number: "number",
12
12
  Boolean: "boolean",
13
13
  Array: "array",
14
+ Enum: "enum",
14
15
  };
15
16
  /** Required only when type is "array". The type of items in the array. */
16
17
  ToolParameter.ItemType = {
@@ -24,7 +25,7 @@ var ToolParameter;
24
25
  * - For GET webhooks: defaults to `"query_string"` and `"request_body"` is not allowed.
25
26
  * - For POST webhooks: required, can be either `"request_body"` or `"query_string"`.
26
27
  * - Not allowed for `custom_websocket`, `built_in_transfer_to_phone_number`, or `built_in_transfer_to_agent` tools.
27
- * When updating a tool's type or endpoint_method, all parameters must include explicit `location` values.
28
+ * When switching a webhook tool's `endpoint_method` from POST to GET, its request body parameters must be re-sent with `"query_string"` locations.
28
29
  */
29
30
  ToolParameter.Location = {
30
31
  RequestBody: "request_body",
@@ -0,0 +1,15 @@
1
+ /**
2
+ * A tool's parameters expressed as a raw JSON Schema object, for parameters that the flat `ToolParameter` list cannot express: nested objects, arrays of objects, `anyOf` variants, `null`, and non-string enums.
3
+ * Each entry in `properties` is a JSON Schema value supporting `type` (`"string"`, `"integer"`, `"number"`, `"boolean"`, `"null"`, `"array"`, `"object"`), `description`, `enum` (string parameters only), `items` (for arrays), `properties`/`required`/`additionalProperties` (for objects) and `anyOf`. Values may be nested up to 5 levels deep.
4
+ * Parameter names cannot be any of the reserved names that Phonic injects into every tool call: `call_info`, `conversation_id`, `from_phone_number`, `to_phone_number`, `twilio_call_sid`.
5
+ * For `custom_webhook` tools, parameter placement is supplied separately in `parameter_locations` rather than inline on the schema.
6
+ */
7
+ export interface ToolParametersJsonSchema {
8
+ type: "object";
9
+ /** The tool's top-level parameters, as a map from parameter name to its JSON Schema. */
10
+ properties: Record<string, unknown>;
11
+ /** The names of the required top-level parameters. Every name must be defined in `properties`. */
12
+ required?: string[] | undefined;
13
+ /** Must be `false`. Tool parameter schemas do not allow properties beyond the ones declared. */
14
+ additionalProperties?: false | undefined;
15
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -68,6 +68,7 @@ export * from "./ToolCallPayload.js";
68
68
  export * from "./ToolDefinition.js";
69
69
  export * from "./ToolName.js";
70
70
  export * from "./ToolParameter.js";
71
+ export * from "./ToolParametersJsonSchema.js";
71
72
  export * from "./UnmutePayload.js";
72
73
  export * from "./UpdateSystemPromptPayload.js";
73
74
  export * from "./UpdateToolsSubsetPayload.js";
@@ -84,6 +84,7 @@ __exportStar(require("./ToolCallPayload.js"), exports);
84
84
  __exportStar(require("./ToolDefinition.js"), exports);
85
85
  __exportStar(require("./ToolName.js"), exports);
86
86
  __exportStar(require("./ToolParameter.js"), exports);
87
+ __exportStar(require("./ToolParametersJsonSchema.js"), exports);
87
88
  __exportStar(require("./UnmutePayload.js"), exports);
88
89
  __exportStar(require("./UpdateSystemPromptPayload.js"), exports);
89
90
  __exportStar(require("./UpdateToolsSubsetPayload.js"), exports);