phonic 0.32.23 → 0.32.25

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 (84) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +4 -0
  3. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +4 -0
  4. package/dist/cjs/api/resources/conversations/client/Socket.d.ts +1 -1
  5. package/dist/cjs/api/resources/responses/client/Client.d.ts +35 -5
  6. package/dist/cjs/api/resources/responses/client/Client.js +35 -5
  7. package/dist/cjs/api/resources/responses/client/requests/GenerateResponsesRequest.d.ts +22 -1
  8. package/dist/cjs/api/resources/tools/client/requests/CreateToolRequest.d.ts +2 -0
  9. package/dist/cjs/api/resources/tools/client/requests/UpdateToolRequest.d.ts +2 -0
  10. package/dist/cjs/api/types/Agent.d.ts +4 -0
  11. package/dist/cjs/api/types/Conversation.d.ts +3 -1
  12. package/dist/cjs/api/types/CreateAgentRequest.d.ts +4 -0
  13. package/dist/cjs/api/types/GeneratedResponse.d.ts +3 -1
  14. package/dist/cjs/api/types/InlineWebSocketTool.d.ts +2 -0
  15. package/dist/cjs/api/types/InterruptedResponsePayload.d.ts +5 -0
  16. package/dist/cjs/api/types/InterruptedResponsePayload.js +3 -0
  17. package/dist/cjs/api/types/ResponsesAction.d.ts +22 -0
  18. package/dist/cjs/api/types/ResponsesAction.js +3 -0
  19. package/dist/cjs/api/types/ResponsesAssistantMessage.d.ts +4 -2
  20. package/dist/cjs/api/types/ResponsesBuiltInTool.d.ts +24 -0
  21. package/dist/cjs/api/types/ResponsesBuiltInTool.js +13 -0
  22. package/dist/cjs/api/types/ResponsesChoseNotToRespondAction.d.ts +7 -0
  23. package/dist/cjs/api/types/ResponsesChoseNotToRespondAction.js +3 -0
  24. package/dist/cjs/api/types/ResponsesDtmfAction.d.ts +7 -0
  25. package/dist/cjs/api/types/ResponsesDtmfAction.js +3 -0
  26. package/dist/cjs/api/types/ResponsesEndedConversationAction.d.ts +4 -0
  27. package/dist/cjs/api/types/ResponsesEndedConversationAction.js +3 -0
  28. package/dist/cjs/api/types/ResponsesTool.d.ts +5 -0
  29. package/dist/cjs/api/types/ResponsesTool.js +3 -0
  30. package/dist/cjs/api/types/ResponsesToolDefinition.d.ts +4 -0
  31. package/dist/cjs/api/types/ResponsesToolName.d.ts +4 -0
  32. package/dist/cjs/api/types/ResponsesToolName.js +3 -0
  33. package/dist/cjs/api/types/ResponsesTransferToAgentAction.d.ts +7 -0
  34. package/dist/cjs/api/types/ResponsesTransferToAgentAction.js +3 -0
  35. package/dist/cjs/api/types/ResponsesTransferToPhoneNumberAction.d.ts +15 -0
  36. package/dist/cjs/api/types/ResponsesTransferToPhoneNumberAction.js +3 -0
  37. package/dist/cjs/api/types/ToolParametersJsonSchema.d.ts +1 -1
  38. package/dist/cjs/api/types/index.d.ts +10 -0
  39. package/dist/cjs/api/types/index.js +10 -0
  40. package/dist/cjs/version.d.ts +1 -1
  41. package/dist/cjs/version.js +1 -1
  42. package/dist/esm/BaseClient.mjs +2 -2
  43. package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +4 -0
  44. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +4 -0
  45. package/dist/esm/api/resources/conversations/client/Socket.d.mts +1 -1
  46. package/dist/esm/api/resources/responses/client/Client.d.mts +35 -5
  47. package/dist/esm/api/resources/responses/client/Client.mjs +35 -5
  48. package/dist/esm/api/resources/responses/client/requests/GenerateResponsesRequest.d.mts +22 -1
  49. package/dist/esm/api/resources/tools/client/requests/CreateToolRequest.d.mts +2 -0
  50. package/dist/esm/api/resources/tools/client/requests/UpdateToolRequest.d.mts +2 -0
  51. package/dist/esm/api/types/Agent.d.mts +4 -0
  52. package/dist/esm/api/types/Conversation.d.mts +3 -1
  53. package/dist/esm/api/types/CreateAgentRequest.d.mts +4 -0
  54. package/dist/esm/api/types/GeneratedResponse.d.mts +3 -1
  55. package/dist/esm/api/types/InlineWebSocketTool.d.mts +2 -0
  56. package/dist/esm/api/types/InterruptedResponsePayload.d.mts +5 -0
  57. package/dist/esm/api/types/InterruptedResponsePayload.mjs +2 -0
  58. package/dist/esm/api/types/ResponsesAction.d.mts +22 -0
  59. package/dist/esm/api/types/ResponsesAction.mjs +2 -0
  60. package/dist/esm/api/types/ResponsesAssistantMessage.d.mts +4 -2
  61. package/dist/esm/api/types/ResponsesBuiltInTool.d.mts +24 -0
  62. package/dist/esm/api/types/ResponsesBuiltInTool.mjs +10 -0
  63. package/dist/esm/api/types/ResponsesChoseNotToRespondAction.d.mts +7 -0
  64. package/dist/esm/api/types/ResponsesChoseNotToRespondAction.mjs +2 -0
  65. package/dist/esm/api/types/ResponsesDtmfAction.d.mts +7 -0
  66. package/dist/esm/api/types/ResponsesDtmfAction.mjs +2 -0
  67. package/dist/esm/api/types/ResponsesEndedConversationAction.d.mts +4 -0
  68. package/dist/esm/api/types/ResponsesEndedConversationAction.mjs +2 -0
  69. package/dist/esm/api/types/ResponsesTool.d.mts +5 -0
  70. package/dist/esm/api/types/ResponsesTool.mjs +2 -0
  71. package/dist/esm/api/types/ResponsesToolDefinition.d.mts +4 -0
  72. package/dist/esm/api/types/ResponsesToolName.d.mts +4 -0
  73. package/dist/esm/api/types/ResponsesToolName.mjs +2 -0
  74. package/dist/esm/api/types/ResponsesTransferToAgentAction.d.mts +7 -0
  75. package/dist/esm/api/types/ResponsesTransferToAgentAction.mjs +2 -0
  76. package/dist/esm/api/types/ResponsesTransferToPhoneNumberAction.d.mts +15 -0
  77. package/dist/esm/api/types/ResponsesTransferToPhoneNumberAction.mjs +2 -0
  78. package/dist/esm/api/types/ToolParametersJsonSchema.d.mts +1 -1
  79. package/dist/esm/api/types/index.d.mts +10 -0
  80. package/dist/esm/api/types/index.mjs +10 -0
  81. package/dist/esm/version.d.mts +1 -1
  82. package/dist/esm/version.mjs +1 -1
  83. package/package.json +1 -1
  84. package/reference.md +18 -5
@@ -4,7 +4,7 @@ export declare namespace ConversationsSocket {
4
4
  interface Args {
5
5
  socket: core.ReconnectingWebSocket;
6
6
  }
7
- type Response = Phonic.ReadyToStartConversationPayload | Phonic.ConversationCreatedPayload | Phonic.InputTextPayload | Phonic.InputCancelledPayload | Phonic.AudioChunkResponsePayload | Phonic.UserStartedSpeakingPayload | Phonic.UserFinishedSpeakingPayload | Phonic.AssistantStartedSpeakingPayload | Phonic.AssistantFinishedSpeakingPayload | Phonic.DtmfPayload | Phonic.ToolCallPayload | Phonic.ToolCallOutputProcessedPayload | Phonic.ToolCallInterruptedPayload | Phonic.AssistantChoseNotToRespondPayload | Phonic.AssistantEndedConversationPayload | Phonic.ErrorPayload | Phonic.WarningPayload;
7
+ type Response = Phonic.ReadyToStartConversationPayload | Phonic.ConversationCreatedPayload | Phonic.InputTextPayload | Phonic.InputCancelledPayload | Phonic.AudioChunkResponsePayload | Phonic.UserStartedSpeakingPayload | Phonic.UserFinishedSpeakingPayload | Phonic.AssistantStartedSpeakingPayload | Phonic.AssistantFinishedSpeakingPayload | Phonic.InterruptedResponsePayload | Phonic.DtmfPayload | Phonic.ToolCallPayload | Phonic.ToolCallOutputProcessedPayload | Phonic.ToolCallInterruptedPayload | Phonic.AssistantChoseNotToRespondPayload | Phonic.AssistantEndedConversationPayload | Phonic.ErrorPayload | Phonic.WarningPayload;
8
8
  type EventHandlers = {
9
9
  open?: () => void;
10
10
  message?: (message: Response) => void;
@@ -16,13 +16,26 @@ export declare class ResponsesClient {
16
16
  *
17
17
  * This endpoint is stateless, so it does not create a new conversation or
18
18
  * store anything. The request carries the system prompt, a conversation so
19
- * far as `input`, and the tools the assistant may call as
20
- * `tool_definitions`.
19
+ * far as `input`, and the tools the assistant may call.
20
+ *
21
+ * There are two different types of tool configurations:
22
+ *
23
+ * - `tool_definitions`: defined inline. Typically if you use LiveKit, this
24
+ * is where you can pass in your tool definitions.
25
+ * - `tools`: predefined tools configured in Phonic, referenced by name, in
26
+ * the same shape as the STS WebSocket `config` message. Today this covers
27
+ * built-in tools such as `choose_not_to_respond` and transfer tools stored
28
+ * in `project`. Your context, webhook, MCP and WebSocket tools cannot be
29
+ * referenced here yet; define those inline as `tool_definitions`.
21
30
  *
22
31
  * Each item in `input` is a user message, an assistant message (with
23
- * optional `tool_calls`), or a `tool_call_output`. Every assistant tool
24
- * call must be followed immediately by the `tool_call_output` item that
25
- * carries its result.
32
+ * optional `tool_calls` or an `action`), or a `tool_call_output`. Every
33
+ * assistant tool call must be followed immediately by the
34
+ * `tool_call_output` item that carries its result.
35
+ *
36
+ * A tool referenced in `tools` resolves to an `action` on the generated
37
+ * response rather than a tool call - the event a live conversation would
38
+ * have emitted, without the effect actually being carried out.
26
39
  *
27
40
  * This is an experimental feature and must be enabled for your workspace;
28
41
  * otherwise, it returns `404`. Please contact our team if you would like
@@ -66,6 +79,23 @@ export declare class ResponsesClient {
66
79
  * }],
67
80
  * num_responses: 2
68
81
  * })
82
+ *
83
+ * @example
84
+ * await client.responses.create({
85
+ * system_prompt: "You route callers to the right team. Be friendly and concise.",
86
+ * project: "main",
87
+ * input: [{
88
+ * role: "user",
89
+ * text: "I have a problem with my bill."
90
+ * }],
91
+ * tools: ["transfer_to_support", {
92
+ * type: "built_in",
93
+ * name: "natural_conversation_ending",
94
+ * tool_config: {
95
+ * speech_before_tool_call: "required"
96
+ * }
97
+ * }]
98
+ * })
69
99
  */
70
100
  create(request: Phonic.GenerateResponsesRequest, requestOptions?: ResponsesClient.RequestOptions): core.HttpResponsePromise<Phonic.GenerateResponsesResponse>;
71
101
  private __create;
@@ -25,13 +25,26 @@ export class ResponsesClient {
25
25
  *
26
26
  * This endpoint is stateless, so it does not create a new conversation or
27
27
  * store anything. The request carries the system prompt, a conversation so
28
- * far as `input`, and the tools the assistant may call as
29
- * `tool_definitions`.
28
+ * far as `input`, and the tools the assistant may call.
29
+ *
30
+ * There are two different types of tool configurations:
31
+ *
32
+ * - `tool_definitions`: defined inline. Typically if you use LiveKit, this
33
+ * is where you can pass in your tool definitions.
34
+ * - `tools`: predefined tools configured in Phonic, referenced by name, in
35
+ * the same shape as the STS WebSocket `config` message. Today this covers
36
+ * built-in tools such as `choose_not_to_respond` and transfer tools stored
37
+ * in `project`. Your context, webhook, MCP and WebSocket tools cannot be
38
+ * referenced here yet; define those inline as `tool_definitions`.
30
39
  *
31
40
  * Each item in `input` is a user message, an assistant message (with
32
- * optional `tool_calls`), or a `tool_call_output`. Every assistant tool
33
- * call must be followed immediately by the `tool_call_output` item that
34
- * carries its result.
41
+ * optional `tool_calls` or an `action`), or a `tool_call_output`. Every
42
+ * assistant tool call must be followed immediately by the
43
+ * `tool_call_output` item that carries its result.
44
+ *
45
+ * A tool referenced in `tools` resolves to an `action` on the generated
46
+ * response rather than a tool call - the event a live conversation would
47
+ * have emitted, without the effect actually being carried out.
35
48
  *
36
49
  * This is an experimental feature and must be enabled for your workspace;
37
50
  * otherwise, it returns `404`. Please contact our team if you would like
@@ -75,6 +88,23 @@ export class ResponsesClient {
75
88
  * }],
76
89
  * num_responses: 2
77
90
  * })
91
+ *
92
+ * @example
93
+ * await client.responses.create({
94
+ * system_prompt: "You route callers to the right team. Be friendly and concise.",
95
+ * project: "main",
96
+ * input: [{
97
+ * role: "user",
98
+ * text: "I have a problem with my bill."
99
+ * }],
100
+ * tools: ["transfer_to_support", {
101
+ * type: "built_in",
102
+ * name: "natural_conversation_ending",
103
+ * tool_config: {
104
+ * speech_before_tool_call: "required"
105
+ * }
106
+ * }]
107
+ * })
78
108
  */
79
109
  create(request, requestOptions) {
80
110
  return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
@@ -27,6 +27,23 @@ import type * as Phonic from "../../../../index.mjs";
27
27
  * }],
28
28
  * num_responses: 2
29
29
  * }
30
+ *
31
+ * @example
32
+ * {
33
+ * system_prompt: "You route callers to the right team. Be friendly and concise.",
34
+ * project: "main",
35
+ * input: [{
36
+ * role: "user",
37
+ * text: "I have a problem with my bill."
38
+ * }],
39
+ * tools: ["transfer_to_support", {
40
+ * type: "built_in",
41
+ * name: "natural_conversation_ending",
42
+ * tool_config: {
43
+ * speech_before_tool_call: "required"
44
+ * }
45
+ * }]
46
+ * }
30
47
  */
31
48
  export interface GenerateResponsesRequest {
32
49
  /** The system prompt the assistant should follow. */
@@ -39,8 +56,12 @@ export interface GenerateResponsesRequest {
39
56
  additional_languages?: Phonic.LanguageCode[];
40
57
  /** The conversation so far, in order. Must contain at least one item. */
41
58
  input: Phonic.ResponsesInputItem[];
42
- /** The tools the assistant may call, defined inline. Names must be unique and cannot be one of the names Phonic reserves for its built-in tools. */
59
+ /** Tools defined inline for this request only. Typically if you use LiveKit, this is where you can pass in your tool definitions. Names must be unique, must not repeat a name in `tools`, and cannot be one of the names Phonic reserves for its built-in tools. */
43
60
  tool_definitions?: Phonic.ResponsesToolDefinition[];
61
+ /** Name of the project the tools referenced by name in `tools` belong to. Required whenever `tools` names a tool stored in your workspace; built-in tools can be referenced without it. */
62
+ project?: string;
63
+ /** Tools the assistant may call that already exist - a built-in tool, or a transfer tool stored in `project`, referenced by name. Names must be unique and must not repeat a name in `tool_definitions`. Stored tools that are not transfer tools cannot be referenced here yet; define them inline as `tool_definitions` instead. */
64
+ tools?: Phonic.ResponsesTool[];
44
65
  /** Number of alternative responses to generate. */
45
66
  num_responses?: number;
46
67
  }
@@ -233,6 +233,8 @@ export interface CreateToolRequest {
233
233
  allow_tool_chaining?: boolean;
234
234
  /** The agent doesn't typically wait for the response of async 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_webhook and custom_websocket tools, and cannot be combined with allow_tool_chaining set to true. */
235
235
  wait_for_response?: boolean;
236
+ /** When true, the user cannot interrupt the agent while the tool call is in flight; the agent's turn is held open until the tool returns. Only available for sync custom_webhook and custom_websocket tools. */
237
+ uninterruptible?: boolean;
236
238
  /** The static context returned to the agent. Required for custom_context tools. */
237
239
  context?: string;
238
240
  }
@@ -73,6 +73,8 @@ export interface UpdateToolRequest {
73
73
  allow_tool_chaining?: boolean;
74
74
  /** The agent doesn't typically wait for the response of async 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_webhook and custom_websocket tools, and cannot be combined with allow_tool_chaining set to true. */
75
75
  wait_for_response?: boolean;
76
+ /** When true, the user cannot interrupt the agent while the tool call is in flight; the agent's turn is held open until the tool returns. Only available for sync custom_webhook and custom_websocket tools, so the resulting execution_mode must be sync. */
77
+ uninterruptible?: boolean;
76
78
  }
77
79
  export declare namespace UpdateToolRequest {
78
80
  /** Mode of operation. */
@@ -28,6 +28,10 @@ export interface Agent {
28
28
  is_welcome_message_interruptible: boolean;
29
29
  /** Number of seconds of inactivity before the conversation WebSocket is closed. */
30
30
  websocket_timeout_sec?: number | undefined;
31
+ /** Play an uninterruptible welcome message on incoming calls, then transcribe the caller without responding. Silence timeout and call duration limits still apply. */
32
+ listen_only_inbound_enabled: boolean;
33
+ /** Welcome message for listen-only incoming calls. Can contain template variables like `{{customer_name}}`. Must be nonempty when `listen_only_inbound_enabled` is `true`. Replaces `welcome_message` for these calls, regardless of `generate_welcome_message`. */
34
+ listen_only_inbound_message: string | null;
31
35
  /** Message to play when the conversation starts. Ignored when `generate_welcome_message` is `true`. */
32
36
  welcome_message: string | null;
33
37
  /** Instructions for the conversation. */
@@ -18,6 +18,8 @@ export interface Conversation {
18
18
  generate_welcome_message: boolean;
19
19
  /** When `false`, the welcome message will not be interruptible by the user. */
20
20
  is_welcome_message_interruptible: boolean;
21
+ /** Whether this conversation used listen-only mode. The resolved greeting is stored in `welcome_message`. */
22
+ listen_only: boolean;
21
23
  /** Welcome message played at start. Will be `null` when `generate_welcome_message` is `true`. */
22
24
  welcome_message: string | null;
23
25
  /** Template variables used in the conversation. */
@@ -181,7 +183,7 @@ export declare namespace Conversation {
181
183
  * Phone call metadata. `null` for non-phone call conversations.
182
184
  */
183
185
  interface CallInfo {
184
- /** Caller phone number in E.164 format. */
186
+ /** Caller phone number in E.164 format. `"anonymous"` for inbound calls whose caller withheld their number. */
185
187
  from_phone_number: string;
186
188
  /** Callee phone number in E.164 format. */
187
189
  to_phone_number: string;
@@ -28,6 +28,10 @@ export interface CreateAgentRequest {
28
28
  is_welcome_message_interruptible?: boolean | undefined;
29
29
  /** Number of seconds of inactivity before the conversation WebSocket is closed. */
30
30
  websocket_timeout_sec?: number | undefined;
31
+ /** Play an uninterruptible welcome message on incoming calls, then transcribe the caller without responding. Silence timeout and call duration limits still apply. */
32
+ listen_only_inbound_enabled?: boolean | undefined;
33
+ /** Welcome message for listen-only incoming calls. Can contain template variables like `{{customer_name}}`. Must be nonempty when `listen_only_inbound_enabled` is `true`. Replaces `welcome_message` for these calls, regardless of `generate_welcome_message`. */
34
+ listen_only_inbound_message?: (string | null) | undefined;
31
35
  /** Message to play when the conversation starts. Can contain template variables like `{{customer_name}}`. Ignored when `generate_welcome_message` is `true`. */
32
36
  welcome_message?: (string | null) | undefined;
33
37
  /** Instructions for the conversation. Can contain template variables like `{{subject}}`. */
@@ -1,7 +1,9 @@
1
1
  import type * as Phonic from "../index.mjs";
2
2
  export interface GeneratedResponse {
3
- /** The text the assistant would say. Empty when the response only makes tool calls. */
3
+ /** The text the assistant would say. Empty when the response only makes tool calls or only takes an action. */
4
4
  text: string;
5
5
  /** Tool calls the assistant would make - note that the tools are not actually called. */
6
6
  tool_calls: Phonic.GeneratedToolCall[];
7
+ /** The action the assistant would take, when the response calls one of the tools referenced in `tools`. Note that the action is not actually carried out. */
8
+ action?: Phonic.ResponsesAction | undefined;
7
9
  }
@@ -21,6 +21,8 @@ export interface InlineWebSocketTool {
21
21
  allow_tool_chaining?: boolean | undefined;
22
22
  /** For async tools, when true, the assistant waits for the response and speaks when it arrives. */
23
23
  wait_for_response?: boolean | undefined;
24
+ /** For sync tools, when true, the user cannot interrupt the assistant while the tool call is in flight; the assistant's turn is held open until the tool returns. */
25
+ uninterruptible?: boolean | undefined;
24
26
  }
25
27
  export declare namespace InlineWebSocketTool {
26
28
  /** Whether the assistant waits for the tool output before continuing. */
@@ -0,0 +1,5 @@
1
+ export interface InterruptedResponsePayload {
2
+ type: "interrupted_response";
3
+ /** The part of the assistant's turn that was spoken before the user interrupted. */
4
+ text: string;
5
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,22 @@
1
+ import type * as Phonic from "../index.mjs";
2
+ /**
3
+ * The action the assistant takes on a turn - the event a live Phonic conversation would have emitted over the STS WebSocket, without the effect actually being carried out.
4
+ */
5
+ export type ResponsesAction = Phonic.ResponsesAction.AssistantChoseNotToRespond | Phonic.ResponsesAction.AssistantEndedConversation | Phonic.ResponsesAction.Dtmf | Phonic.ResponsesAction.TransferToPhoneNumber | Phonic.ResponsesAction.TransferToAgent;
6
+ export declare namespace ResponsesAction {
7
+ interface AssistantChoseNotToRespond extends Phonic.ResponsesChoseNotToRespondAction {
8
+ type: "assistant_chose_not_to_respond";
9
+ }
10
+ interface AssistantEndedConversation extends Phonic.ResponsesEndedConversationAction {
11
+ type: "assistant_ended_conversation";
12
+ }
13
+ interface Dtmf extends Phonic.ResponsesDtmfAction {
14
+ type: "dtmf";
15
+ }
16
+ interface TransferToPhoneNumber extends Phonic.ResponsesTransferToPhoneNumberAction {
17
+ type: "transfer_to_phone_number";
18
+ }
19
+ interface TransferToAgent extends Phonic.ResponsesTransferToAgentAction {
20
+ type: "transfer_to_agent";
21
+ }
22
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,11 +1,13 @@
1
1
  import type * as Phonic from "../index.mjs";
2
2
  /**
3
- * An assistant turn. Must carry `text`, `tool_calls`, or both.
3
+ * An assistant turn. Must carry at least one of `text`, `tool_calls`, or `action`. `tool_calls` and `action` cannot both be present.
4
4
  */
5
5
  export interface ResponsesAssistantMessage {
6
6
  role: "assistant";
7
- /** What the assistant said. Empty when the turn only made tool calls. */
7
+ /** What the assistant said. Empty when the turn only made tool calls or only took an action. */
8
8
  text: string;
9
9
  /** Tool calls the assistant made on this turn. Each one must be followed immediately by its matching `tool_call_output` item. */
10
10
  tool_calls?: Phonic.ResponsesToolCall[] | undefined;
11
+ /** The action the assistant took on this turn. Cannot be combined with `tool_calls`. */
12
+ action?: Phonic.ResponsesAction | undefined;
11
13
  }
@@ -0,0 +1,24 @@
1
+ import type * as Phonic from "../index.mjs";
2
+ /**
3
+ * A built-in tool with an explicit configuration, as an alternative to referencing it by bare name (which uses the tool's default configuration). `keypad_input` and `natural_conversation_ending` take a `speech_before_tool_call` config; `choose_not_to_respond` takes a `respond_after_sec` config.
4
+ */
5
+ export interface ResponsesBuiltInTool {
6
+ type: "built_in";
7
+ /** The name of the built-in tool. */
8
+ name: ResponsesBuiltInTool.Name;
9
+ /** The tool's configuration. Use `BuiltInToolConfig` for `keypad_input` and `natural_conversation_ending`, or `ChooseNotToRespondToolConfig` for `choose_not_to_respond`. */
10
+ tool_config: ResponsesBuiltInTool.ToolConfig;
11
+ }
12
+ export declare namespace ResponsesBuiltInTool {
13
+ /** The name of the built-in tool. */
14
+ const Name: {
15
+ readonly KeypadInput: "keypad_input";
16
+ readonly NaturalConversationEnding: "natural_conversation_ending";
17
+ readonly ChooseNotToRespond: "choose_not_to_respond";
18
+ };
19
+ type Name = (typeof Name)[keyof typeof Name];
20
+ /**
21
+ * The tool's configuration. Use `BuiltInToolConfig` for `keypad_input` and `natural_conversation_ending`, or `ChooseNotToRespondToolConfig` for `choose_not_to_respond`.
22
+ */
23
+ type ToolConfig = Phonic.BuiltInToolConfig | Phonic.ChooseNotToRespondToolConfig;
24
+ }
@@ -0,0 +1,10 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export var ResponsesBuiltInTool;
3
+ (function (ResponsesBuiltInTool) {
4
+ /** The name of the built-in tool. */
5
+ ResponsesBuiltInTool.Name = {
6
+ KeypadInput: "keypad_input",
7
+ NaturalConversationEnding: "natural_conversation_ending",
8
+ ChooseNotToRespond: "choose_not_to_respond",
9
+ };
10
+ })(ResponsesBuiltInTool || (ResponsesBuiltInTool = {}));
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The assistant stayed silent instead of responding (the `choose_not_to_respond` built-in tool).
3
+ */
4
+ export interface ResponsesChoseNotToRespondAction {
5
+ /** Number of seconds the assistant would wait before speaking a follow-up if the user stays silent, echoed from the tool's configuration. When null, the assistant stays silent. */
6
+ respond_after_sec?: (number | null) | undefined;
7
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The assistant pressed keypad digits (the `keypad_input` built-in tool).
3
+ */
4
+ export interface ResponsesDtmfAction {
5
+ /** The digits the assistant pressed. */
6
+ digits: string;
7
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * The assistant ended the conversation (the `natural_conversation_ending` built-in tool).
3
+ */
4
+ export type ResponsesEndedConversationAction = {};
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,5 @@
1
+ import type * as Phonic from "../index.mjs";
2
+ /**
3
+ * A tool that already exists, referenced by name - either a built-in tool or a transfer tool stored in `project`. Use the object form to configure a built-in tool explicitly; a bare name uses the tool's default configuration.
4
+ */
5
+ export type ResponsesTool = Phonic.ResponsesToolName | Phonic.ResponsesBuiltInTool;
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -8,4 +8,8 @@ export interface ResponsesToolDefinition {
8
8
  /** What the tool does. The model uses this to decide when to call it. */
9
9
  description: string;
10
10
  parameters: Phonic.ToolParametersJsonSchema;
11
+ /** When true, forces the agent to speak before executing the tool. Note this defaults to true here, unlike on the tools API, so a simulated turn matches the default a custom tool runs with in a live call. */
12
+ require_speech_before_tool_call?: boolean | undefined;
13
+ /** When true, forbids the agent from calling the tool right after it has spoken. The call is dropped and the speech is kept. */
14
+ forbid_tool_call_after_speech?: boolean | undefined;
11
15
  }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Name of a built-in tool, or of a transfer tool stored in `project`. Must be snake_case.
3
+ */
4
+ export type ResponsesToolName = string;
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The assistant transferred the conversation to another agent (a `built_in_transfer_to_agent` tool).
3
+ */
4
+ export interface ResponsesTransferToAgentAction {
5
+ /** Name of the agent the conversation would be transferred to. */
6
+ agent: string;
7
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The assistant transferred the call to a phone number (a `built_in_transfer_to_phone_number` tool).
3
+ */
4
+ export interface ResponsesTransferToPhoneNumberAction {
5
+ /** The phone number the call would be transferred to, in E.164 format. */
6
+ phone_number: string;
7
+ /** Whether Phonic would detect whether the transfer reached a voicemail. */
8
+ detect_voicemail: boolean;
9
+ /** Whether the transfer would be placed from the agent's phone number. */
10
+ use_agent_phone_number: boolean;
11
+ /** Whether Phonic would keep transcribing the call after the transfer. */
12
+ keep_listening: boolean;
13
+ /** Digits to dial after the transfer connects, for navigating a phone menu. Null when there are none. */
14
+ dtmf?: (string | null) | undefined;
15
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,7 +1,7 @@
1
1
  /**
2
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
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`.
4
+ * Parameter names cannot be any of the reserved names that Phonic injects into every tool call: `call_info`, `conversation_id`, `from_phone_number`, `pre_tool_text`, `to_phone_number`, `twilio_call_sid`.
5
5
  * For `custom_webhook` tools, parameter placement is supplied separately in `parameter_locations` rather than inline on the schema.
6
6
  */
7
7
  export interface ToolParametersJsonSchema {
@@ -46,6 +46,7 @@ export * from "./GenerateResponsesResponse.mjs";
46
46
  export * from "./InlineWebSocketTool.mjs";
47
47
  export * from "./InputCancelledPayload.mjs";
48
48
  export * from "./InputTextPayload.mjs";
49
+ export * from "./InterruptedResponsePayload.mjs";
49
50
  export * from "./LanguageCode.mjs";
50
51
  export * from "./MutePayload.mjs";
51
52
  export * from "./OpenAiFunction.mjs";
@@ -60,12 +61,21 @@ export * from "./ReadyToStartConversationPayload.mjs";
60
61
  export * from "./ReplayConversationItemResponse.mjs";
61
62
  export * from "./ReplayToolCall.mjs";
62
63
  export * from "./ResetPayload.mjs";
64
+ export * from "./ResponsesAction.mjs";
63
65
  export * from "./ResponsesAssistantMessage.mjs";
66
+ export * from "./ResponsesBuiltInTool.mjs";
67
+ export * from "./ResponsesChoseNotToRespondAction.mjs";
68
+ export * from "./ResponsesDtmfAction.mjs";
69
+ export * from "./ResponsesEndedConversationAction.mjs";
64
70
  export * from "./ResponsesInputItem.mjs";
71
+ export * from "./ResponsesTool.mjs";
65
72
  export * from "./ResponsesToolCall.mjs";
66
73
  export * from "./ResponsesToolCallOutput.mjs";
67
74
  export * from "./ResponsesToolDefinition.mjs";
75
+ export * from "./ResponsesToolName.mjs";
68
76
  export * from "./ResponsesToolReference.mjs";
77
+ export * from "./ResponsesTransferToAgentAction.mjs";
78
+ export * from "./ResponsesTransferToPhoneNumberAction.mjs";
69
79
  export * from "./ResponsesUserMessage.mjs";
70
80
  export * from "./SayPayload.mjs";
71
81
  export * from "./SetExternalIdPayload.mjs";
@@ -46,6 +46,7 @@ export * from "./GenerateResponsesResponse.mjs";
46
46
  export * from "./InlineWebSocketTool.mjs";
47
47
  export * from "./InputCancelledPayload.mjs";
48
48
  export * from "./InputTextPayload.mjs";
49
+ export * from "./InterruptedResponsePayload.mjs";
49
50
  export * from "./LanguageCode.mjs";
50
51
  export * from "./MutePayload.mjs";
51
52
  export * from "./OpenAiFunction.mjs";
@@ -60,12 +61,21 @@ export * from "./ReadyToStartConversationPayload.mjs";
60
61
  export * from "./ReplayConversationItemResponse.mjs";
61
62
  export * from "./ReplayToolCall.mjs";
62
63
  export * from "./ResetPayload.mjs";
64
+ export * from "./ResponsesAction.mjs";
63
65
  export * from "./ResponsesAssistantMessage.mjs";
66
+ export * from "./ResponsesBuiltInTool.mjs";
67
+ export * from "./ResponsesChoseNotToRespondAction.mjs";
68
+ export * from "./ResponsesDtmfAction.mjs";
69
+ export * from "./ResponsesEndedConversationAction.mjs";
64
70
  export * from "./ResponsesInputItem.mjs";
71
+ export * from "./ResponsesTool.mjs";
65
72
  export * from "./ResponsesToolCall.mjs";
66
73
  export * from "./ResponsesToolCallOutput.mjs";
67
74
  export * from "./ResponsesToolDefinition.mjs";
75
+ export * from "./ResponsesToolName.mjs";
68
76
  export * from "./ResponsesToolReference.mjs";
77
+ export * from "./ResponsesTransferToAgentAction.mjs";
78
+ export * from "./ResponsesTransferToPhoneNumberAction.mjs";
69
79
  export * from "./ResponsesUserMessage.mjs";
70
80
  export * from "./SayPayload.mjs";
71
81
  export * from "./SetExternalIdPayload.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.32.23";
1
+ export declare const SDK_VERSION = "0.32.25";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.32.23";
1
+ export const SDK_VERSION = "0.32.25";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phonic",
3
- "version": "0.32.23",
3
+ "version": "0.32.25",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/reference.md CHANGED
@@ -4038,13 +4038,26 @@ you supply inline to simulate Phonic agent behavior.
4038
4038
 
4039
4039
  This endpoint is stateless, so it does not create a new conversation or
4040
4040
  store anything. The request carries the system prompt, a conversation so
4041
- far as `input`, and the tools the assistant may call as
4042
- `tool_definitions`.
4041
+ far as `input`, and the tools the assistant may call.
4042
+
4043
+ There are two different types of tool configurations:
4044
+
4045
+ - `tool_definitions`: defined inline. Typically if you use LiveKit, this
4046
+ is where you can pass in your tool definitions.
4047
+ - `tools`: predefined tools configured in Phonic, referenced by name, in
4048
+ the same shape as the STS WebSocket `config` message. Today this covers
4049
+ built-in tools such as `choose_not_to_respond` and transfer tools stored
4050
+ in `project`. Your context, webhook, MCP and WebSocket tools cannot be
4051
+ referenced here yet; define those inline as `tool_definitions`.
4043
4052
 
4044
4053
  Each item in `input` is a user message, an assistant message (with
4045
- optional `tool_calls`), or a `tool_call_output`. Every assistant tool
4046
- call must be followed immediately by the `tool_call_output` item that
4047
- carries its result.
4054
+ optional `tool_calls` or an `action`), or a `tool_call_output`. Every
4055
+ assistant tool call must be followed immediately by the
4056
+ `tool_call_output` item that carries its result.
4057
+
4058
+ A tool referenced in `tools` resolves to an `action` on the generated
4059
+ response rather than a tool call - the event a live conversation would
4060
+ have emitted, without the effect actually being carried out.
4048
4061
 
4049
4062
  This is an experimental feature and must be enabled for your workspace;
4050
4063
  otherwise, it returns `404`. Please contact our team if you would like