phonic 0.30.16 → 0.30.17

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 (31) hide show
  1. package/dist/cjs/Client.js +2 -2
  2. package/dist/cjs/api/resources/tools/client/Client.d.ts +17 -3
  3. package/dist/cjs/api/resources/tools/client/Client.js +17 -3
  4. package/dist/cjs/api/resources/tools/client/requests/CreateToolRequest.d.ts +24 -5
  5. package/dist/cjs/api/resources/tools/client/requests/CreateToolRequest.js +1 -0
  6. package/dist/cjs/api/resources/tools/client/requests/ToolsGetRequest.d.ts +5 -0
  7. package/dist/cjs/api/resources/tools/client/requests/UpdateToolRequest.d.ts +7 -2
  8. package/dist/cjs/api/resources/tools/client/requests/UpdateToolRequest.js +1 -0
  9. package/dist/cjs/api/types/ConversationItem.d.ts +6 -2
  10. package/dist/cjs/api/types/Tool.d.ts +6 -1
  11. package/dist/cjs/api/types/Tool.js +1 -0
  12. package/dist/cjs/api/types/ToolParameter.d.ts +2 -2
  13. package/dist/cjs/api/types/overrides.d.ts +1 -0
  14. package/dist/cjs/version.d.ts +1 -1
  15. package/dist/cjs/version.js +1 -1
  16. package/dist/esm/Client.mjs +2 -2
  17. package/dist/esm/api/resources/tools/client/Client.d.mts +17 -3
  18. package/dist/esm/api/resources/tools/client/Client.mjs +17 -3
  19. package/dist/esm/api/resources/tools/client/requests/CreateToolRequest.d.mts +24 -5
  20. package/dist/esm/api/resources/tools/client/requests/CreateToolRequest.mjs +1 -0
  21. package/dist/esm/api/resources/tools/client/requests/ToolsGetRequest.d.mts +5 -0
  22. package/dist/esm/api/resources/tools/client/requests/UpdateToolRequest.d.mts +7 -2
  23. package/dist/esm/api/resources/tools/client/requests/UpdateToolRequest.mjs +1 -0
  24. package/dist/esm/api/types/ConversationItem.d.mts +6 -2
  25. package/dist/esm/api/types/Tool.d.mts +6 -1
  26. package/dist/esm/api/types/Tool.mjs +1 -0
  27. package/dist/esm/api/types/ToolParameter.d.mts +2 -2
  28. package/dist/esm/api/types/overrides.d.mts +1 -0
  29. package/dist/esm/version.d.mts +1 -1
  30. package/dist/esm/version.mjs +1 -1
  31. package/package.json +1 -1
@@ -50,8 +50,8 @@ class PhonicClient {
50
50
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
51
51
  "X-Fern-Language": "JavaScript",
52
52
  "X-Fern-SDK-Name": "phonic",
53
- "X-Fern-SDK-Version": "0.30.15",
54
- "User-Agent": "phonic/0.30.15",
53
+ "X-Fern-SDK-Version": "0.30.16",
54
+ "User-Agent": "phonic/0.30.16",
55
55
  "X-Fern-Runtime": core.RUNTIME.type,
56
56
  "X-Fern-Runtime-Version": core.RUNTIME.version,
57
57
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -81,7 +81,8 @@ export declare class Tools {
81
81
  * "Authorization": "Bearer token123",
82
82
  * "Content-Type": "application/json"
83
83
  * },
84
- * endpoint_timeout_ms: 5000
84
+ * endpoint_timeout_ms: 5000,
85
+ * require_speech_before_tool_call: false
85
86
  * })
86
87
  *
87
88
  * @example
@@ -97,7 +98,8 @@ export declare class Tools {
97
98
  * description: "The product ID to check",
98
99
  * is_required: true
99
100
  * }],
100
- * tool_call_output_timeout_ms: 5000
101
+ * tool_call_output_timeout_ms: 5000,
102
+ * require_speech_before_tool_call: false
101
103
  * })
102
104
  *
103
105
  * @example
@@ -108,7 +110,19 @@ export declare class Tools {
108
110
  * type: "built_in_transfer_to_phone_number",
109
111
  * execution_mode: "sync",
110
112
  * phone_number: "+15551234567",
111
- * dtmf: "1234"
113
+ * dtmf: "1234",
114
+ * require_speech_before_tool_call: false
115
+ * })
116
+ *
117
+ * @example
118
+ * await client.tools.create({
119
+ * project: "main",
120
+ * name: "transfer_to_specialist",
121
+ * description: "Transfers the caller to a specialist agent",
122
+ * type: "built_in_transfer_to_agent",
123
+ * execution_mode: "sync",
124
+ * agents_to_transfer_to: ["sales-agent", "support-agent", "technical-agent"],
125
+ * require_speech_before_tool_call: false
112
126
  * })
113
127
  */
114
128
  create(request: Phonic.CreateToolRequest, requestOptions?: Tools.RequestOptions): core.HttpResponsePromise<Phonic.ToolsCreateResponse>;
@@ -169,7 +169,8 @@ class Tools {
169
169
  * "Authorization": "Bearer token123",
170
170
  * "Content-Type": "application/json"
171
171
  * },
172
- * endpoint_timeout_ms: 5000
172
+ * endpoint_timeout_ms: 5000,
173
+ * require_speech_before_tool_call: false
173
174
  * })
174
175
  *
175
176
  * @example
@@ -185,7 +186,8 @@ class Tools {
185
186
  * description: "The product ID to check",
186
187
  * is_required: true
187
188
  * }],
188
- * tool_call_output_timeout_ms: 5000
189
+ * tool_call_output_timeout_ms: 5000,
190
+ * require_speech_before_tool_call: false
189
191
  * })
190
192
  *
191
193
  * @example
@@ -196,7 +198,19 @@ class Tools {
196
198
  * type: "built_in_transfer_to_phone_number",
197
199
  * execution_mode: "sync",
198
200
  * phone_number: "+15551234567",
199
- * dtmf: "1234"
201
+ * dtmf: "1234",
202
+ * require_speech_before_tool_call: false
203
+ * })
204
+ *
205
+ * @example
206
+ * await client.tools.create({
207
+ * project: "main",
208
+ * name: "transfer_to_specialist",
209
+ * description: "Transfers the caller to a specialist agent",
210
+ * type: "built_in_transfer_to_agent",
211
+ * execution_mode: "sync",
212
+ * agents_to_transfer_to: ["sales-agent", "support-agent", "technical-agent"],
213
+ * require_speech_before_tool_call: false
200
214
  * })
201
215
  */
202
216
  create(request, requestOptions) {
@@ -29,7 +29,8 @@ import * as Phonic from "../../../../index.js";
29
29
  * "Authorization": "Bearer token123",
30
30
  * "Content-Type": "application/json"
31
31
  * },
32
- * endpoint_timeout_ms: 5000
32
+ * endpoint_timeout_ms: 5000,
33
+ * require_speech_before_tool_call: false
33
34
  * }
34
35
  *
35
36
  * @example
@@ -45,7 +46,8 @@ import * as Phonic from "../../../../index.js";
45
46
  * description: "The product ID to check",
46
47
  * is_required: true
47
48
  * }],
48
- * tool_call_output_timeout_ms: 5000
49
+ * tool_call_output_timeout_ms: 5000,
50
+ * require_speech_before_tool_call: false
49
51
  * }
50
52
  *
51
53
  * @example
@@ -56,7 +58,19 @@ import * as Phonic from "../../../../index.js";
56
58
  * type: "built_in_transfer_to_phone_number",
57
59
  * execution_mode: "sync",
58
60
  * phone_number: "+15551234567",
59
- * dtmf: "1234"
61
+ * dtmf: "1234",
62
+ * require_speech_before_tool_call: false
63
+ * }
64
+ *
65
+ * @example
66
+ * {
67
+ * project: "main",
68
+ * name: "transfer_to_specialist",
69
+ * description: "Transfers the caller to a specialist agent",
70
+ * type: "built_in_transfer_to_agent",
71
+ * execution_mode: "sync",
72
+ * agents_to_transfer_to: ["sales-agent", "support-agent", "technical-agent"],
73
+ * require_speech_before_tool_call: false
60
74
  * }
61
75
  */
62
76
  export interface CreateToolRequest {
@@ -74,7 +88,7 @@ export interface CreateToolRequest {
74
88
  * Array of parameter definitions.
75
89
  * For `custom_webhook` tools with POST method, each parameter must include a `location` field.
76
90
  * For `custom_webhook` tools with GET method, `location` defaults to `"query_string"` if not specified.
77
- * For `custom_websocket` and `built_in_transfer_to_phone_number` tools, `location` must not be specified.
91
+ * For `custom_websocket`, `built_in_transfer_to_phone_number`, and `built_in_transfer_to_agent` tools, `location` must not be specified.
78
92
  */
79
93
  parameters?: Phonic.ToolParameter[];
80
94
  /** Required for webhook tools. HTTP method for the webhook endpoint. */
@@ -91,16 +105,21 @@ export interface CreateToolRequest {
91
105
  phone_number?: string;
92
106
  /** DTMF digits to send after the transfer connects (e.g., "1234"). Defaults to null. */
93
107
  dtmf?: string | null;
108
+ /** Array of agent names that the LLM can choose from when transferring. Required for built_in_transfer_to_agent tools. All agents must exist in the same project as the tool. */
109
+ agents_to_transfer_to?: string[];
110
+ /** When true, forces the agent to speak before executing the tool. */
111
+ require_speech_before_tool_call?: boolean;
94
112
  }
95
113
  export declare namespace CreateToolRequest {
96
114
  /**
97
115
  * The type of tool.
98
116
  */
99
- type Type = "custom_webhook" | "custom_websocket" | "built_in_transfer_to_phone_number";
117
+ type Type = "custom_webhook" | "custom_websocket" | "built_in_transfer_to_phone_number" | "built_in_transfer_to_agent";
100
118
  const Type: {
101
119
  readonly CustomWebhook: "custom_webhook";
102
120
  readonly CustomWebsocket: "custom_websocket";
103
121
  readonly BuiltInTransferToPhoneNumber: "built_in_transfer_to_phone_number";
122
+ readonly BuiltInTransferToAgent: "built_in_transfer_to_agent";
104
123
  };
105
124
  /**
106
125
  * Mode of operation.
@@ -10,6 +10,7 @@ var CreateToolRequest;
10
10
  CustomWebhook: "custom_webhook",
11
11
  CustomWebsocket: "custom_websocket",
12
12
  BuiltInTransferToPhoneNumber: "built_in_transfer_to_phone_number",
13
+ BuiltInTransferToAgent: "built_in_transfer_to_agent",
13
14
  };
14
15
  CreateToolRequest.ExecutionMode = {
15
16
  Sync: "sync",
@@ -16,6 +16,11 @@
16
16
  * {
17
17
  * project: "main"
18
18
  * }
19
+ *
20
+ * @example
21
+ * {
22
+ * project: "main"
23
+ * }
19
24
  */
20
25
  export interface ToolsGetRequest {
21
26
  /** The name of the project containing the tool. Only used when `nameOrId` is a name. */
@@ -28,7 +28,7 @@ export interface UpdateToolRequest {
28
28
  * Array of parameter definitions.
29
29
  * When updating `type` or `endpoint_method`, all parameters must include explicit `location` values.
30
30
  * For `custom_webhook` tools: `location` is required for POST, defaults to `"query_string"` for GET.
31
- * For `custom_websocket` and `built_in_transfer_to_phone_number` tools: `location` must not be specified.
31
+ * For `custom_websocket`, `built_in_transfer_to_phone_number`, and `built_in_transfer_to_agent` tools: `location` must not be specified.
32
32
  */
33
33
  parameters?: Phonic.ToolParameter[];
34
34
  /** HTTP method for webhook tools. When changing this value, all parameters must include explicit `location` values. */
@@ -41,16 +41,21 @@ export interface UpdateToolRequest {
41
41
  phone_number?: string;
42
42
  /** DTMF digits to send after the transfer connects (e.g., "1234"). Can be set to null to remove DTMF. */
43
43
  dtmf?: string | null;
44
+ /** Array of agent names that the LLM can choose from when transferring. All agents must exist in the same project as the tool. */
45
+ agents_to_transfer_to?: string[];
46
+ /** When true, forces the agent to speak before executing the tool. */
47
+ require_speech_before_tool_call?: boolean;
44
48
  }
45
49
  export declare namespace UpdateToolRequest {
46
50
  /**
47
51
  * The type of tool.
48
52
  */
49
- type Type = "custom_webhook" | "custom_websocket" | "built_in_transfer_to_phone_number";
53
+ type Type = "custom_webhook" | "custom_websocket" | "built_in_transfer_to_phone_number" | "built_in_transfer_to_agent";
50
54
  const Type: {
51
55
  readonly CustomWebhook: "custom_webhook";
52
56
  readonly CustomWebsocket: "custom_websocket";
53
57
  readonly BuiltInTransferToPhoneNumber: "built_in_transfer_to_phone_number";
58
+ readonly BuiltInTransferToAgent: "built_in_transfer_to_agent";
54
59
  };
55
60
  /**
56
61
  * Mode of operation.
@@ -10,6 +10,7 @@ var UpdateToolRequest;
10
10
  CustomWebhook: "custom_webhook",
11
11
  CustomWebsocket: "custom_websocket",
12
12
  BuiltInTransferToPhoneNumber: "built_in_transfer_to_phone_number",
13
+ BuiltInTransferToAgent: "built_in_transfer_to_agent",
13
14
  };
14
15
  UpdateToolRequest.ExecutionMode = {
15
16
  Sync: "sync",
@@ -54,8 +54,8 @@ export declare namespace ConversationItem {
54
54
  response_status_code?: number | null;
55
55
  /** Timeout in milliseconds for websocket tool calls. */
56
56
  tool_call_output_timeout_ms?: number | null;
57
- /** The request body sent to the tool. */
58
- request_body: Record<string, unknown> | null;
57
+ /** The request body sent to the tool. Can be any JSON-serializable value. */
58
+ request_body: Item.RequestBody | null;
59
59
  /** The response body received from the tool. */
60
60
  response_body: Record<string, unknown> | null;
61
61
  /** Whether the tool call timed out. */
@@ -70,6 +70,10 @@ export declare namespace ConversationItem {
70
70
  /** The tool name. */
71
71
  name: string;
72
72
  }
73
+ /**
74
+ * The request body sent to the tool. Can be any JSON-serializable value.
75
+ */
76
+ type RequestBody = Record<string, unknown> | unknown[] | string | number | boolean;
73
77
  }
74
78
  }
75
79
  }
@@ -30,6 +30,10 @@ export interface Tool {
30
30
  phone_number?: string;
31
31
  /** DTMF digits to send after the transfer connects (e.g., "1234"). Defaults to null. */
32
32
  dtmf?: string | null;
33
+ /** Array of agent names that the LLM can choose from when transferring. Required for built_in_transfer_to_agent tools. */
34
+ agents_to_transfer_to?: string[];
35
+ /** When true, forces the agent to speak before executing the tool. */
36
+ require_speech_before_tool_call?: boolean;
33
37
  }
34
38
  export declare namespace Tool {
35
39
  interface Project {
@@ -39,11 +43,12 @@ export declare namespace Tool {
39
43
  /**
40
44
  * The type of tool.
41
45
  */
42
- type Type = "custom_webhook" | "custom_websocket" | "built_in_transfer_to_phone_number";
46
+ type Type = "custom_webhook" | "custom_websocket" | "built_in_transfer_to_phone_number" | "built_in_transfer_to_agent";
43
47
  const Type: {
44
48
  readonly CustomWebhook: "custom_webhook";
45
49
  readonly CustomWebsocket: "custom_websocket";
46
50
  readonly BuiltInTransferToPhoneNumber: "built_in_transfer_to_phone_number";
51
+ readonly BuiltInTransferToAgent: "built_in_transfer_to_agent";
47
52
  };
48
53
  /**
49
54
  * Mode of operation - sync waits for response, async continues without waiting.
@@ -10,6 +10,7 @@ var Tool;
10
10
  CustomWebhook: "custom_webhook",
11
11
  CustomWebsocket: "custom_websocket",
12
12
  BuiltInTransferToPhoneNumber: "built_in_transfer_to_phone_number",
13
+ BuiltInTransferToAgent: "built_in_transfer_to_agent",
13
14
  };
14
15
  Tool.ExecutionMode = {
15
16
  Sync: "sync",
@@ -16,7 +16,7 @@ export interface ToolParameter {
16
16
  * Only applicable for `custom_webhook` tools. Specifies where the parameter should be sent in the webhook request.
17
17
  * - For GET webhooks: defaults to `"query_string"` and `"request_body"` is not allowed.
18
18
  * - For POST webhooks: required, can be either `"request_body"` or `"query_string"`.
19
- * - Not allowed for `custom_websocket` or `built_in_transfer_to_phone_number` tools.
19
+ * - Not allowed for `custom_websocket`, `built_in_transfer_to_phone_number`, or `built_in_transfer_to_agent` tools.
20
20
  * When updating a tool's type or endpoint_method, all parameters must include explicit `location` values.
21
21
  */
22
22
  location?: ToolParameter.Location;
@@ -47,7 +47,7 @@ export declare namespace ToolParameter {
47
47
  * Only applicable for `custom_webhook` tools. Specifies where the parameter should be sent in the webhook request.
48
48
  * - For GET webhooks: defaults to `"query_string"` and `"request_body"` is not allowed.
49
49
  * - For POST webhooks: required, can be either `"request_body"` or `"query_string"`.
50
- * - Not allowed for `custom_websocket` or `built_in_transfer_to_phone_number` tools.
50
+ * - Not allowed for `custom_websocket`, `built_in_transfer_to_phone_number`, or `built_in_transfer_to_agent` tools.
51
51
  * When updating a tool's type or endpoint_method, all parameters must include explicit `location` values.
52
52
  */
53
53
  type Location = "request_body" | "query_string";
@@ -21,6 +21,7 @@ export type PhonicConfigurationEndpointResponsePayload = {
21
21
  template_variables?: Record<string, string>;
22
22
  tools?: Array<PhonicTool>;
23
23
  boosted_keywords?: string[];
24
+ metadata?: unknown;
24
25
  };
25
26
  export type ConversationEndedWebhookPayload = {
26
27
  event_type: "conversation.ended";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.30.15";
1
+ export declare const SDK_VERSION = "0.30.16";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.30.15";
4
+ exports.SDK_VERSION = "0.30.16";
@@ -14,8 +14,8 @@ export class PhonicClient {
14
14
  this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
15
15
  "X-Fern-Language": "JavaScript",
16
16
  "X-Fern-SDK-Name": "phonic",
17
- "X-Fern-SDK-Version": "0.30.15",
18
- "User-Agent": "phonic/0.30.15",
17
+ "X-Fern-SDK-Version": "0.30.16",
18
+ "User-Agent": "phonic/0.30.16",
19
19
  "X-Fern-Runtime": core.RUNTIME.type,
20
20
  "X-Fern-Runtime-Version": core.RUNTIME.version,
21
21
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -81,7 +81,8 @@ export declare class Tools {
81
81
  * "Authorization": "Bearer token123",
82
82
  * "Content-Type": "application/json"
83
83
  * },
84
- * endpoint_timeout_ms: 5000
84
+ * endpoint_timeout_ms: 5000,
85
+ * require_speech_before_tool_call: false
85
86
  * })
86
87
  *
87
88
  * @example
@@ -97,7 +98,8 @@ export declare class Tools {
97
98
  * description: "The product ID to check",
98
99
  * is_required: true
99
100
  * }],
100
- * tool_call_output_timeout_ms: 5000
101
+ * tool_call_output_timeout_ms: 5000,
102
+ * require_speech_before_tool_call: false
101
103
  * })
102
104
  *
103
105
  * @example
@@ -108,7 +110,19 @@ export declare class Tools {
108
110
  * type: "built_in_transfer_to_phone_number",
109
111
  * execution_mode: "sync",
110
112
  * phone_number: "+15551234567",
111
- * dtmf: "1234"
113
+ * dtmf: "1234",
114
+ * require_speech_before_tool_call: false
115
+ * })
116
+ *
117
+ * @example
118
+ * await client.tools.create({
119
+ * project: "main",
120
+ * name: "transfer_to_specialist",
121
+ * description: "Transfers the caller to a specialist agent",
122
+ * type: "built_in_transfer_to_agent",
123
+ * execution_mode: "sync",
124
+ * agents_to_transfer_to: ["sales-agent", "support-agent", "technical-agent"],
125
+ * require_speech_before_tool_call: false
112
126
  * })
113
127
  */
114
128
  create(request: Phonic.CreateToolRequest, requestOptions?: Tools.RequestOptions): core.HttpResponsePromise<Phonic.ToolsCreateResponse>;
@@ -133,7 +133,8 @@ export class Tools {
133
133
  * "Authorization": "Bearer token123",
134
134
  * "Content-Type": "application/json"
135
135
  * },
136
- * endpoint_timeout_ms: 5000
136
+ * endpoint_timeout_ms: 5000,
137
+ * require_speech_before_tool_call: false
137
138
  * })
138
139
  *
139
140
  * @example
@@ -149,7 +150,8 @@ export class Tools {
149
150
  * description: "The product ID to check",
150
151
  * is_required: true
151
152
  * }],
152
- * tool_call_output_timeout_ms: 5000
153
+ * tool_call_output_timeout_ms: 5000,
154
+ * require_speech_before_tool_call: false
153
155
  * })
154
156
  *
155
157
  * @example
@@ -160,7 +162,19 @@ export class Tools {
160
162
  * type: "built_in_transfer_to_phone_number",
161
163
  * execution_mode: "sync",
162
164
  * phone_number: "+15551234567",
163
- * dtmf: "1234"
165
+ * dtmf: "1234",
166
+ * require_speech_before_tool_call: false
167
+ * })
168
+ *
169
+ * @example
170
+ * await client.tools.create({
171
+ * project: "main",
172
+ * name: "transfer_to_specialist",
173
+ * description: "Transfers the caller to a specialist agent",
174
+ * type: "built_in_transfer_to_agent",
175
+ * execution_mode: "sync",
176
+ * agents_to_transfer_to: ["sales-agent", "support-agent", "technical-agent"],
177
+ * require_speech_before_tool_call: false
164
178
  * })
165
179
  */
166
180
  create(request, requestOptions) {
@@ -29,7 +29,8 @@ import * as Phonic from "../../../../index.mjs";
29
29
  * "Authorization": "Bearer token123",
30
30
  * "Content-Type": "application/json"
31
31
  * },
32
- * endpoint_timeout_ms: 5000
32
+ * endpoint_timeout_ms: 5000,
33
+ * require_speech_before_tool_call: false
33
34
  * }
34
35
  *
35
36
  * @example
@@ -45,7 +46,8 @@ import * as Phonic from "../../../../index.mjs";
45
46
  * description: "The product ID to check",
46
47
  * is_required: true
47
48
  * }],
48
- * tool_call_output_timeout_ms: 5000
49
+ * tool_call_output_timeout_ms: 5000,
50
+ * require_speech_before_tool_call: false
49
51
  * }
50
52
  *
51
53
  * @example
@@ -56,7 +58,19 @@ import * as Phonic from "../../../../index.mjs";
56
58
  * type: "built_in_transfer_to_phone_number",
57
59
  * execution_mode: "sync",
58
60
  * phone_number: "+15551234567",
59
- * dtmf: "1234"
61
+ * dtmf: "1234",
62
+ * require_speech_before_tool_call: false
63
+ * }
64
+ *
65
+ * @example
66
+ * {
67
+ * project: "main",
68
+ * name: "transfer_to_specialist",
69
+ * description: "Transfers the caller to a specialist agent",
70
+ * type: "built_in_transfer_to_agent",
71
+ * execution_mode: "sync",
72
+ * agents_to_transfer_to: ["sales-agent", "support-agent", "technical-agent"],
73
+ * require_speech_before_tool_call: false
60
74
  * }
61
75
  */
62
76
  export interface CreateToolRequest {
@@ -74,7 +88,7 @@ export interface CreateToolRequest {
74
88
  * Array of parameter definitions.
75
89
  * For `custom_webhook` tools with POST method, each parameter must include a `location` field.
76
90
  * For `custom_webhook` tools with GET method, `location` defaults to `"query_string"` if not specified.
77
- * For `custom_websocket` and `built_in_transfer_to_phone_number` tools, `location` must not be specified.
91
+ * For `custom_websocket`, `built_in_transfer_to_phone_number`, and `built_in_transfer_to_agent` tools, `location` must not be specified.
78
92
  */
79
93
  parameters?: Phonic.ToolParameter[];
80
94
  /** Required for webhook tools. HTTP method for the webhook endpoint. */
@@ -91,16 +105,21 @@ export interface CreateToolRequest {
91
105
  phone_number?: string;
92
106
  /** DTMF digits to send after the transfer connects (e.g., "1234"). Defaults to null. */
93
107
  dtmf?: string | null;
108
+ /** Array of agent names that the LLM can choose from when transferring. Required for built_in_transfer_to_agent tools. All agents must exist in the same project as the tool. */
109
+ agents_to_transfer_to?: string[];
110
+ /** When true, forces the agent to speak before executing the tool. */
111
+ require_speech_before_tool_call?: boolean;
94
112
  }
95
113
  export declare namespace CreateToolRequest {
96
114
  /**
97
115
  * The type of tool.
98
116
  */
99
- type Type = "custom_webhook" | "custom_websocket" | "built_in_transfer_to_phone_number";
117
+ type Type = "custom_webhook" | "custom_websocket" | "built_in_transfer_to_phone_number" | "built_in_transfer_to_agent";
100
118
  const Type: {
101
119
  readonly CustomWebhook: "custom_webhook";
102
120
  readonly CustomWebsocket: "custom_websocket";
103
121
  readonly BuiltInTransferToPhoneNumber: "built_in_transfer_to_phone_number";
122
+ readonly BuiltInTransferToAgent: "built_in_transfer_to_agent";
104
123
  };
105
124
  /**
106
125
  * Mode of operation.
@@ -7,6 +7,7 @@ export var CreateToolRequest;
7
7
  CustomWebhook: "custom_webhook",
8
8
  CustomWebsocket: "custom_websocket",
9
9
  BuiltInTransferToPhoneNumber: "built_in_transfer_to_phone_number",
10
+ BuiltInTransferToAgent: "built_in_transfer_to_agent",
10
11
  };
11
12
  CreateToolRequest.ExecutionMode = {
12
13
  Sync: "sync",
@@ -16,6 +16,11 @@
16
16
  * {
17
17
  * project: "main"
18
18
  * }
19
+ *
20
+ * @example
21
+ * {
22
+ * project: "main"
23
+ * }
19
24
  */
20
25
  export interface ToolsGetRequest {
21
26
  /** The name of the project containing the tool. Only used when `nameOrId` is a name. */
@@ -28,7 +28,7 @@ export interface UpdateToolRequest {
28
28
  * Array of parameter definitions.
29
29
  * When updating `type` or `endpoint_method`, all parameters must include explicit `location` values.
30
30
  * For `custom_webhook` tools: `location` is required for POST, defaults to `"query_string"` for GET.
31
- * For `custom_websocket` and `built_in_transfer_to_phone_number` tools: `location` must not be specified.
31
+ * For `custom_websocket`, `built_in_transfer_to_phone_number`, and `built_in_transfer_to_agent` tools: `location` must not be specified.
32
32
  */
33
33
  parameters?: Phonic.ToolParameter[];
34
34
  /** HTTP method for webhook tools. When changing this value, all parameters must include explicit `location` values. */
@@ -41,16 +41,21 @@ export interface UpdateToolRequest {
41
41
  phone_number?: string;
42
42
  /** DTMF digits to send after the transfer connects (e.g., "1234"). Can be set to null to remove DTMF. */
43
43
  dtmf?: string | null;
44
+ /** Array of agent names that the LLM can choose from when transferring. All agents must exist in the same project as the tool. */
45
+ agents_to_transfer_to?: string[];
46
+ /** When true, forces the agent to speak before executing the tool. */
47
+ require_speech_before_tool_call?: boolean;
44
48
  }
45
49
  export declare namespace UpdateToolRequest {
46
50
  /**
47
51
  * The type of tool.
48
52
  */
49
- type Type = "custom_webhook" | "custom_websocket" | "built_in_transfer_to_phone_number";
53
+ type Type = "custom_webhook" | "custom_websocket" | "built_in_transfer_to_phone_number" | "built_in_transfer_to_agent";
50
54
  const Type: {
51
55
  readonly CustomWebhook: "custom_webhook";
52
56
  readonly CustomWebsocket: "custom_websocket";
53
57
  readonly BuiltInTransferToPhoneNumber: "built_in_transfer_to_phone_number";
58
+ readonly BuiltInTransferToAgent: "built_in_transfer_to_agent";
54
59
  };
55
60
  /**
56
61
  * Mode of operation.
@@ -7,6 +7,7 @@ export var UpdateToolRequest;
7
7
  CustomWebhook: "custom_webhook",
8
8
  CustomWebsocket: "custom_websocket",
9
9
  BuiltInTransferToPhoneNumber: "built_in_transfer_to_phone_number",
10
+ BuiltInTransferToAgent: "built_in_transfer_to_agent",
10
11
  };
11
12
  UpdateToolRequest.ExecutionMode = {
12
13
  Sync: "sync",
@@ -54,8 +54,8 @@ export declare namespace ConversationItem {
54
54
  response_status_code?: number | null;
55
55
  /** Timeout in milliseconds for websocket tool calls. */
56
56
  tool_call_output_timeout_ms?: number | null;
57
- /** The request body sent to the tool. */
58
- request_body: Record<string, unknown> | null;
57
+ /** The request body sent to the tool. Can be any JSON-serializable value. */
58
+ request_body: Item.RequestBody | null;
59
59
  /** The response body received from the tool. */
60
60
  response_body: Record<string, unknown> | null;
61
61
  /** Whether the tool call timed out. */
@@ -70,6 +70,10 @@ export declare namespace ConversationItem {
70
70
  /** The tool name. */
71
71
  name: string;
72
72
  }
73
+ /**
74
+ * The request body sent to the tool. Can be any JSON-serializable value.
75
+ */
76
+ type RequestBody = Record<string, unknown> | unknown[] | string | number | boolean;
73
77
  }
74
78
  }
75
79
  }
@@ -30,6 +30,10 @@ export interface Tool {
30
30
  phone_number?: string;
31
31
  /** DTMF digits to send after the transfer connects (e.g., "1234"). Defaults to null. */
32
32
  dtmf?: string | null;
33
+ /** Array of agent names that the LLM can choose from when transferring. Required for built_in_transfer_to_agent tools. */
34
+ agents_to_transfer_to?: string[];
35
+ /** When true, forces the agent to speak before executing the tool. */
36
+ require_speech_before_tool_call?: boolean;
33
37
  }
34
38
  export declare namespace Tool {
35
39
  interface Project {
@@ -39,11 +43,12 @@ export declare namespace Tool {
39
43
  /**
40
44
  * The type of tool.
41
45
  */
42
- type Type = "custom_webhook" | "custom_websocket" | "built_in_transfer_to_phone_number";
46
+ type Type = "custom_webhook" | "custom_websocket" | "built_in_transfer_to_phone_number" | "built_in_transfer_to_agent";
43
47
  const Type: {
44
48
  readonly CustomWebhook: "custom_webhook";
45
49
  readonly CustomWebsocket: "custom_websocket";
46
50
  readonly BuiltInTransferToPhoneNumber: "built_in_transfer_to_phone_number";
51
+ readonly BuiltInTransferToAgent: "built_in_transfer_to_agent";
47
52
  };
48
53
  /**
49
54
  * Mode of operation - sync waits for response, async continues without waiting.
@@ -7,6 +7,7 @@ export var Tool;
7
7
  CustomWebhook: "custom_webhook",
8
8
  CustomWebsocket: "custom_websocket",
9
9
  BuiltInTransferToPhoneNumber: "built_in_transfer_to_phone_number",
10
+ BuiltInTransferToAgent: "built_in_transfer_to_agent",
10
11
  };
11
12
  Tool.ExecutionMode = {
12
13
  Sync: "sync",
@@ -16,7 +16,7 @@ export interface ToolParameter {
16
16
  * Only applicable for `custom_webhook` tools. Specifies where the parameter should be sent in the webhook request.
17
17
  * - For GET webhooks: defaults to `"query_string"` and `"request_body"` is not allowed.
18
18
  * - For POST webhooks: required, can be either `"request_body"` or `"query_string"`.
19
- * - Not allowed for `custom_websocket` or `built_in_transfer_to_phone_number` tools.
19
+ * - Not allowed for `custom_websocket`, `built_in_transfer_to_phone_number`, or `built_in_transfer_to_agent` tools.
20
20
  * When updating a tool's type or endpoint_method, all parameters must include explicit `location` values.
21
21
  */
22
22
  location?: ToolParameter.Location;
@@ -47,7 +47,7 @@ export declare namespace ToolParameter {
47
47
  * Only applicable for `custom_webhook` tools. Specifies where the parameter should be sent in the webhook request.
48
48
  * - For GET webhooks: defaults to `"query_string"` and `"request_body"` is not allowed.
49
49
  * - For POST webhooks: required, can be either `"request_body"` or `"query_string"`.
50
- * - Not allowed for `custom_websocket` or `built_in_transfer_to_phone_number` tools.
50
+ * - Not allowed for `custom_websocket`, `built_in_transfer_to_phone_number`, or `built_in_transfer_to_agent` tools.
51
51
  * When updating a tool's type or endpoint_method, all parameters must include explicit `location` values.
52
52
  */
53
53
  type Location = "request_body" | "query_string";
@@ -21,6 +21,7 @@ export type PhonicConfigurationEndpointResponsePayload = {
21
21
  template_variables?: Record<string, string>;
22
22
  tools?: Array<PhonicTool>;
23
23
  boosted_keywords?: string[];
24
+ metadata?: unknown;
24
25
  };
25
26
  export type ConversationEndedWebhookPayload = {
26
27
  event_type: "conversation.ended";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.30.15";
1
+ export declare const SDK_VERSION = "0.30.16";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.30.15";
1
+ export const SDK_VERSION = "0.30.16";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phonic",
3
- "version": "0.30.16",
3
+ "version": "0.30.17",
4
4
  "private": false,
5
5
  "repository": "github:Phonic-Co/phonic-node",
6
6
  "type": "commonjs",