phonic 0.30.13 → 0.30.15

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 (37) hide show
  1. package/dist/cjs/Client.js +2 -2
  2. package/dist/cjs/api/resources/agents/client/Client.d.ts +1 -1
  3. package/dist/cjs/api/resources/agents/client/Client.js +3 -3
  4. package/dist/cjs/api/resources/agents/client/requests/AgentsCreateRequest.d.ts +1 -1
  5. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentRequest.d.ts +1 -1
  6. package/dist/cjs/api/resources/projects/client/Client.d.ts +1 -1
  7. package/dist/cjs/api/resources/projects/client/Client.js +3 -3
  8. package/dist/cjs/api/resources/projects/client/requests/UpdateProjectRequest.d.ts +1 -1
  9. package/dist/cjs/api/resources/tools/client/Client.d.ts +2 -1
  10. package/dist/cjs/api/resources/tools/client/Client.js +2 -1
  11. package/dist/cjs/api/resources/tools/client/requests/CreateToolRequest.d.ts +4 -1
  12. package/dist/cjs/api/resources/tools/client/requests/UpdateToolRequest.d.ts +2 -0
  13. package/dist/cjs/api/types/CreateAgentRequest.d.ts +1 -1
  14. package/dist/cjs/api/types/Tool.d.ts +2 -0
  15. package/dist/cjs/api/types/ToolCallOutputProcessedPayload.d.ts +4 -2
  16. package/dist/cjs/core/websocket/ws.js +2 -1
  17. package/dist/cjs/version.d.ts +1 -1
  18. package/dist/cjs/version.js +1 -1
  19. package/dist/esm/Client.mjs +2 -2
  20. package/dist/esm/api/resources/agents/client/Client.d.mts +1 -1
  21. package/dist/esm/api/resources/agents/client/Client.mjs +3 -3
  22. package/dist/esm/api/resources/agents/client/requests/AgentsCreateRequest.d.mts +1 -1
  23. package/dist/esm/api/resources/agents/client/requests/UpdateAgentRequest.d.mts +1 -1
  24. package/dist/esm/api/resources/projects/client/Client.d.mts +1 -1
  25. package/dist/esm/api/resources/projects/client/Client.mjs +3 -3
  26. package/dist/esm/api/resources/projects/client/requests/UpdateProjectRequest.d.mts +1 -1
  27. package/dist/esm/api/resources/tools/client/Client.d.mts +2 -1
  28. package/dist/esm/api/resources/tools/client/Client.mjs +2 -1
  29. package/dist/esm/api/resources/tools/client/requests/CreateToolRequest.d.mts +4 -1
  30. package/dist/esm/api/resources/tools/client/requests/UpdateToolRequest.d.mts +2 -0
  31. package/dist/esm/api/types/CreateAgentRequest.d.mts +1 -1
  32. package/dist/esm/api/types/Tool.d.mts +2 -0
  33. package/dist/esm/api/types/ToolCallOutputProcessedPayload.d.mts +4 -2
  34. package/dist/esm/core/websocket/ws.mjs +2 -1
  35. package/dist/esm/version.d.mts +1 -1
  36. package/dist/esm/version.mjs +1 -1
  37. 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.13",
54
- "User-Agent": "phonic/0.30.13",
53
+ "X-Fern-SDK-Version": "0.30.15",
54
+ "User-Agent": "phonic/0.30.15",
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) });
@@ -212,7 +212,7 @@ export declare class Agents {
212
212
  * }
213
213
  * })
214
214
  */
215
- update(nameOrId: string, request?: Phonic.UpdateAgentRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdateResponse>;
215
+ update(nameOrId: string, request: Phonic.UpdateAgentRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdateResponse>;
216
216
  private __update;
217
217
  protected _getAuthorizationHeader(): Promise<string | undefined>;
218
218
  }
@@ -528,11 +528,11 @@ class Agents {
528
528
  * }
529
529
  * })
530
530
  */
531
- update(nameOrId, request = {}, requestOptions) {
531
+ update(nameOrId, request, requestOptions) {
532
532
  return core.HttpResponsePromise.fromPromise(this.__update(nameOrId, request, requestOptions));
533
533
  }
534
- __update(nameOrId_1) {
535
- return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
534
+ __update(nameOrId, request, requestOptions) {
535
+ return __awaiter(this, void 0, void 0, function* () {
536
536
  var _a, _b, _c, _d;
537
537
  const { project } = request, _body = __rest(request, ["project"]);
538
538
  const _queryParams = {};
@@ -41,7 +41,7 @@ export interface AgentsCreateRequest {
41
41
  project?: string;
42
42
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
43
43
  name: string;
44
- phone_number?: "assign-automatically" | null;
44
+ phone_number: "assign-automatically" | null;
45
45
  /** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
46
46
  timezone?: string;
47
47
  /** The voice ID to use. */
@@ -41,7 +41,7 @@ export interface UpdateAgentRequest {
41
41
  project?: string;
42
42
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
43
43
  name?: string;
44
- phone_number?: "assign-automatically" | null;
44
+ phone_number: "assign-automatically" | null;
45
45
  /** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
46
46
  timezone?: string;
47
47
  /** The voice ID to use. */
@@ -113,7 +113,7 @@ export declare class Projects {
113
113
  * default_agent: "another-agent"
114
114
  * })
115
115
  */
116
- update(nameOrId: string, request?: Phonic.UpdateProjectRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsUpdateResponse>;
116
+ update(nameOrId: string, request: Phonic.UpdateProjectRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsUpdateResponse>;
117
117
  private __update;
118
118
  /**
119
119
  * Returns all conversation evaluation prompts for a project.
@@ -349,11 +349,11 @@ class Projects {
349
349
  * default_agent: "another-agent"
350
350
  * })
351
351
  */
352
- update(nameOrId, request = {}, requestOptions) {
352
+ update(nameOrId, request, requestOptions) {
353
353
  return core.HttpResponsePromise.fromPromise(this.__update(nameOrId, request, requestOptions));
354
354
  }
355
- __update(nameOrId_1) {
356
- return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
355
+ __update(nameOrId, request, requestOptions) {
356
+ return __awaiter(this, void 0, void 0, function* () {
357
357
  var _a, _b, _c, _d;
358
358
  let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
359
359
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
@@ -11,5 +11,5 @@
11
11
  export interface UpdateProjectRequest {
12
12
  /** The name of the project. Can only contain lowercase letters, numbers and hyphens. Must be unique within the workspace. */
13
13
  name?: string;
14
- default_agent?: string | null;
14
+ default_agent: string | null;
15
15
  }
@@ -107,7 +107,8 @@ export declare class Tools {
107
107
  * description: "Transfers the caller to the support team",
108
108
  * type: "built_in_transfer_to_phone_number",
109
109
  * execution_mode: "sync",
110
- * phone_number: "+15551234567"
110
+ * phone_number: "+15551234567",
111
+ * dtmf: "1234"
111
112
  * })
112
113
  */
113
114
  create(request: Phonic.CreateToolRequest, requestOptions?: Tools.RequestOptions): core.HttpResponsePromise<Phonic.ToolsCreateResponse>;
@@ -195,7 +195,8 @@ class Tools {
195
195
  * description: "Transfers the caller to the support team",
196
196
  * type: "built_in_transfer_to_phone_number",
197
197
  * execution_mode: "sync",
198
- * phone_number: "+15551234567"
198
+ * phone_number: "+15551234567",
199
+ * dtmf: "1234"
199
200
  * })
200
201
  */
201
202
  create(request, requestOptions) {
@@ -55,7 +55,8 @@ import * as Phonic from "../../../../index.js";
55
55
  * description: "Transfers the caller to the support team",
56
56
  * type: "built_in_transfer_to_phone_number",
57
57
  * execution_mode: "sync",
58
- * phone_number: "+15551234567"
58
+ * phone_number: "+15551234567",
59
+ * dtmf: "1234"
59
60
  * }
60
61
  */
61
62
  export interface CreateToolRequest {
@@ -88,6 +89,8 @@ export interface CreateToolRequest {
88
89
  tool_call_output_timeout_ms?: number;
89
90
  /** The E.164 formatted phone number to transfer calls to. Required for built_in_transfer_to_phone_number tools. */
90
91
  phone_number?: string;
92
+ /** DTMF digits to send after the transfer connects (e.g., "1234"). Defaults to null. */
93
+ dtmf?: string | null;
91
94
  }
92
95
  export declare namespace CreateToolRequest {
93
96
  /**
@@ -39,6 +39,8 @@ export interface UpdateToolRequest {
39
39
  tool_call_output_timeout_ms?: number;
40
40
  /** The E.164 formatted phone number to transfer calls to. Required for built_in_transfer_to_phone_number tools. */
41
41
  phone_number?: string;
42
+ /** DTMF digits to send after the transfer connects (e.g., "1234"). Can be set to null to remove DTMF. */
43
+ dtmf?: string | null;
42
44
  }
43
45
  export declare namespace UpdateToolRequest {
44
46
  /**
@@ -5,7 +5,7 @@ import * as Phonic from "../index.js";
5
5
  export interface CreateAgentRequest {
6
6
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
7
7
  name: string;
8
- phone_number?: "assign-automatically" | null;
8
+ phone_number: "assign-automatically" | null;
9
9
  /** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
10
10
  timezone?: string;
11
11
  /** The voice ID to use. */
@@ -28,6 +28,8 @@ export interface Tool {
28
28
  tool_call_output_timeout_ms?: number;
29
29
  /** The E.164 formatted phone number to transfer calls to. Required for built_in_transfer_to_phone_number tools. */
30
30
  phone_number?: string;
31
+ /** DTMF digits to send after the transfer connects (e.g., "1234"). Defaults to null. */
32
+ dtmf?: string | null;
31
33
  }
32
34
  export declare namespace Tool {
33
35
  interface Project {
@@ -14,10 +14,12 @@ export interface ToolCallOutputProcessedPayload {
14
14
  endpoint_called_at?: string | null;
15
15
  /** Webhook request body (null for WebSocket tools) */
16
16
  request_body?: Record<string, unknown> | null;
17
- response_body?: unknown;
17
+ /** Webhook response body (null for WebSocket tools) */
18
+ response_body?: unknown | null;
18
19
  /** WebSocket tool parameters (null for webhook tools) */
19
20
  parameters?: Record<string, unknown> | null;
20
- output?: unknown;
21
+ /** WebSocket tool output (null for webhook tools) */
22
+ output?: unknown | null;
21
23
  /** Webhook HTTP status code (null for WebSocket tools) */
22
24
  response_status_code?: number | null;
23
25
  /** Whether the tool call timed out */
@@ -39,7 +39,8 @@ const index_js_1 = require("../runtime/index.js");
39
39
  const qs_js_1 = require("../url/qs.js");
40
40
  const Events = __importStar(require("./events.js"));
41
41
  const getGlobalWebSocket = () => {
42
- if (index_js_1.RUNTIME.type === "node") {
42
+ // Use Node.js 'ws' library for server-side runtimes since native WebSocket doesn't support headers
43
+ if (index_js_1.RUNTIME.type === "node" || index_js_1.RUNTIME.type === "bun" || index_js_1.RUNTIME.type === "deno") {
43
44
  return ws_1.WebSocket;
44
45
  }
45
46
  else if (typeof WebSocket !== "undefined") {
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.30.13";
1
+ export declare const SDK_VERSION = "0.30.15";
@@ -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.13";
4
+ exports.SDK_VERSION = "0.30.15";
@@ -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.13",
18
- "User-Agent": "phonic/0.30.13",
17
+ "X-Fern-SDK-Version": "0.30.15",
18
+ "User-Agent": "phonic/0.30.15",
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) });
@@ -212,7 +212,7 @@ export declare class Agents {
212
212
  * }
213
213
  * })
214
214
  */
215
- update(nameOrId: string, request?: Phonic.UpdateAgentRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdateResponse>;
215
+ update(nameOrId: string, request: Phonic.UpdateAgentRequest, requestOptions?: Agents.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdateResponse>;
216
216
  private __update;
217
217
  protected _getAuthorizationHeader(): Promise<string | undefined>;
218
218
  }
@@ -492,11 +492,11 @@ export class Agents {
492
492
  * }
493
493
  * })
494
494
  */
495
- update(nameOrId, request = {}, requestOptions) {
495
+ update(nameOrId, request, requestOptions) {
496
496
  return core.HttpResponsePromise.fromPromise(this.__update(nameOrId, request, requestOptions));
497
497
  }
498
- __update(nameOrId_1) {
499
- return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
498
+ __update(nameOrId, request, requestOptions) {
499
+ return __awaiter(this, void 0, void 0, function* () {
500
500
  var _a, _b, _c, _d;
501
501
  const { project } = request, _body = __rest(request, ["project"]);
502
502
  const _queryParams = {};
@@ -41,7 +41,7 @@ export interface AgentsCreateRequest {
41
41
  project?: string;
42
42
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
43
43
  name: string;
44
- phone_number?: "assign-automatically" | null;
44
+ phone_number: "assign-automatically" | null;
45
45
  /** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
46
46
  timezone?: string;
47
47
  /** The voice ID to use. */
@@ -41,7 +41,7 @@ export interface UpdateAgentRequest {
41
41
  project?: string;
42
42
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
43
43
  name?: string;
44
- phone_number?: "assign-automatically" | null;
44
+ phone_number: "assign-automatically" | null;
45
45
  /** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
46
46
  timezone?: string;
47
47
  /** The voice ID to use. */
@@ -113,7 +113,7 @@ export declare class Projects {
113
113
  * default_agent: "another-agent"
114
114
  * })
115
115
  */
116
- update(nameOrId: string, request?: Phonic.UpdateProjectRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsUpdateResponse>;
116
+ update(nameOrId: string, request: Phonic.UpdateProjectRequest, requestOptions?: Projects.RequestOptions): core.HttpResponsePromise<Phonic.ProjectsUpdateResponse>;
117
117
  private __update;
118
118
  /**
119
119
  * Returns all conversation evaluation prompts for a project.
@@ -313,11 +313,11 @@ export class Projects {
313
313
  * default_agent: "another-agent"
314
314
  * })
315
315
  */
316
- update(nameOrId, request = {}, requestOptions) {
316
+ update(nameOrId, request, requestOptions) {
317
317
  return core.HttpResponsePromise.fromPromise(this.__update(nameOrId, request, requestOptions));
318
318
  }
319
- __update(nameOrId_1) {
320
- return __awaiter(this, arguments, void 0, function* (nameOrId, request = {}, requestOptions) {
319
+ __update(nameOrId, request, requestOptions) {
320
+ return __awaiter(this, void 0, void 0, function* () {
321
321
  var _a, _b, _c, _d;
322
322
  let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
323
323
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
@@ -11,5 +11,5 @@
11
11
  export interface UpdateProjectRequest {
12
12
  /** The name of the project. Can only contain lowercase letters, numbers and hyphens. Must be unique within the workspace. */
13
13
  name?: string;
14
- default_agent?: string | null;
14
+ default_agent: string | null;
15
15
  }
@@ -107,7 +107,8 @@ export declare class Tools {
107
107
  * description: "Transfers the caller to the support team",
108
108
  * type: "built_in_transfer_to_phone_number",
109
109
  * execution_mode: "sync",
110
- * phone_number: "+15551234567"
110
+ * phone_number: "+15551234567",
111
+ * dtmf: "1234"
111
112
  * })
112
113
  */
113
114
  create(request: Phonic.CreateToolRequest, requestOptions?: Tools.RequestOptions): core.HttpResponsePromise<Phonic.ToolsCreateResponse>;
@@ -159,7 +159,8 @@ export class Tools {
159
159
  * description: "Transfers the caller to the support team",
160
160
  * type: "built_in_transfer_to_phone_number",
161
161
  * execution_mode: "sync",
162
- * phone_number: "+15551234567"
162
+ * phone_number: "+15551234567",
163
+ * dtmf: "1234"
163
164
  * })
164
165
  */
165
166
  create(request, requestOptions) {
@@ -55,7 +55,8 @@ import * as Phonic from "../../../../index.mjs";
55
55
  * description: "Transfers the caller to the support team",
56
56
  * type: "built_in_transfer_to_phone_number",
57
57
  * execution_mode: "sync",
58
- * phone_number: "+15551234567"
58
+ * phone_number: "+15551234567",
59
+ * dtmf: "1234"
59
60
  * }
60
61
  */
61
62
  export interface CreateToolRequest {
@@ -88,6 +89,8 @@ export interface CreateToolRequest {
88
89
  tool_call_output_timeout_ms?: number;
89
90
  /** The E.164 formatted phone number to transfer calls to. Required for built_in_transfer_to_phone_number tools. */
90
91
  phone_number?: string;
92
+ /** DTMF digits to send after the transfer connects (e.g., "1234"). Defaults to null. */
93
+ dtmf?: string | null;
91
94
  }
92
95
  export declare namespace CreateToolRequest {
93
96
  /**
@@ -39,6 +39,8 @@ export interface UpdateToolRequest {
39
39
  tool_call_output_timeout_ms?: number;
40
40
  /** The E.164 formatted phone number to transfer calls to. Required for built_in_transfer_to_phone_number tools. */
41
41
  phone_number?: string;
42
+ /** DTMF digits to send after the transfer connects (e.g., "1234"). Can be set to null to remove DTMF. */
43
+ dtmf?: string | null;
42
44
  }
43
45
  export declare namespace UpdateToolRequest {
44
46
  /**
@@ -5,7 +5,7 @@ import * as Phonic from "../index.mjs";
5
5
  export interface CreateAgentRequest {
6
6
  /** The name of the agent. Can only contain lowercase letters, numbers and hyphens. Must be unique within the project. */
7
7
  name: string;
8
- phone_number?: "assign-automatically" | null;
8
+ phone_number: "assign-automatically" | null;
9
9
  /** The timezone of the agent. Used to format system variables like `{{system_time}}`. */
10
10
  timezone?: string;
11
11
  /** The voice ID to use. */
@@ -28,6 +28,8 @@ export interface Tool {
28
28
  tool_call_output_timeout_ms?: number;
29
29
  /** The E.164 formatted phone number to transfer calls to. Required for built_in_transfer_to_phone_number tools. */
30
30
  phone_number?: string;
31
+ /** DTMF digits to send after the transfer connects (e.g., "1234"). Defaults to null. */
32
+ dtmf?: string | null;
31
33
  }
32
34
  export declare namespace Tool {
33
35
  interface Project {
@@ -14,10 +14,12 @@ export interface ToolCallOutputProcessedPayload {
14
14
  endpoint_called_at?: string | null;
15
15
  /** Webhook request body (null for WebSocket tools) */
16
16
  request_body?: Record<string, unknown> | null;
17
- response_body?: unknown;
17
+ /** Webhook response body (null for WebSocket tools) */
18
+ response_body?: unknown | null;
18
19
  /** WebSocket tool parameters (null for webhook tools) */
19
20
  parameters?: Record<string, unknown> | null;
20
- output?: unknown;
21
+ /** WebSocket tool output (null for webhook tools) */
22
+ output?: unknown | null;
21
23
  /** Webhook HTTP status code (null for WebSocket tools) */
22
24
  response_status_code?: number | null;
23
25
  /** Whether the tool call timed out */
@@ -3,7 +3,8 @@ import { RUNTIME } from "../runtime/index.mjs";
3
3
  import { toQueryString } from "../url/qs.mjs";
4
4
  import * as Events from "./events.mjs";
5
5
  const getGlobalWebSocket = () => {
6
- if (RUNTIME.type === "node") {
6
+ // Use Node.js 'ws' library for server-side runtimes since native WebSocket doesn't support headers
7
+ if (RUNTIME.type === "node" || RUNTIME.type === "bun" || RUNTIME.type === "deno") {
7
8
  return NodeWebSocket;
8
9
  }
9
10
  else if (typeof WebSocket !== "undefined") {
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.30.13";
1
+ export declare const SDK_VERSION = "0.30.15";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.30.13";
1
+ export const SDK_VERSION = "0.30.15";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phonic",
3
- "version": "0.30.13",
3
+ "version": "0.30.15",
4
4
  "private": false,
5
5
  "repository": "github:Phonic-Co/phonic-node",
6
6
  "type": "commonjs",