phonic 0.31.12 → 0.31.13
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.
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +6 -0
- package/dist/cjs/Client.js +20 -10
- package/dist/cjs/api/errors/UnprocessableEntityError.d.ts +6 -0
- package/dist/cjs/api/errors/UnprocessableEntityError.js +54 -0
- package/dist/cjs/api/errors/index.d.ts +1 -0
- package/dist/cjs/api/errors/index.js +1 -0
- package/dist/cjs/api/resources/conversationItems/client/Client.d.ts +39 -0
- package/dist/cjs/api/resources/conversationItems/client/Client.js +139 -0
- package/dist/cjs/api/resources/conversationItems/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/conversationItems/client/index.js +17 -0
- package/dist/cjs/api/resources/conversationItems/client/requests/ReplayConversationItemRequest.d.ts +12 -0
- package/dist/cjs/api/resources/conversationItems/client/requests/ReplayConversationItemRequest.js +3 -0
- package/dist/cjs/api/resources/conversationItems/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/conversationItems/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/conversationItems/exports.d.ts +2 -0
- package/dist/cjs/api/resources/conversationItems/exports.js +21 -0
- package/dist/cjs/api/resources/conversationItems/index.d.ts +1 -0
- package/dist/cjs/api/resources/conversationItems/index.js +17 -0
- package/dist/cjs/api/resources/conversations/client/Client.d.ts +1 -0
- package/dist/cjs/api/resources/conversations/client/Client.js +3 -0
- package/dist/cjs/api/resources/conversations/types/ConversationsListResponse.d.ts +1 -9
- package/dist/cjs/api/resources/index.d.ts +4 -0
- package/dist/cjs/api/resources/index.js +5 -1
- package/dist/cjs/api/resources/projects/client/requests/UpdateProjectRequest.d.ts +2 -0
- package/dist/cjs/api/resources/workspace/client/Client.d.ts +26 -0
- package/dist/cjs/api/resources/workspace/client/Client.js +110 -0
- package/dist/cjs/api/resources/workspace/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/workspace/client/index.js +2 -0
- package/dist/cjs/api/resources/workspace/exports.d.ts +2 -0
- package/dist/cjs/api/resources/workspace/exports.js +21 -0
- package/dist/cjs/api/resources/workspace/index.d.ts +2 -0
- package/dist/cjs/api/resources/workspace/index.js +18 -0
- package/dist/cjs/api/resources/workspace/types/WorkspaceGetResponse.d.ts +6 -0
- package/dist/cjs/api/resources/workspace/types/WorkspaceGetResponse.js +3 -0
- package/dist/cjs/api/resources/workspace/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/workspace/types/index.js +17 -0
- package/dist/cjs/api/types/BadRequestErrorBody.d.ts +1 -1
- package/dist/cjs/api/types/Conversation.d.ts +8 -0
- package/dist/cjs/api/types/ConversationItem.d.ts +2 -0
- package/dist/cjs/api/types/ConversationsListResponseConversation.d.ts +4 -0
- package/dist/cjs/api/types/ConversationsListResponseConversation.js +3 -0
- package/dist/cjs/api/types/ConversationsListResponseConversations.d.ts +5 -0
- package/dist/cjs/api/types/ConversationsListResponseConversations.js +3 -0
- package/dist/cjs/api/types/ConversationsListResponseConversationsPagination.d.ts +6 -0
- package/dist/cjs/api/types/ConversationsListResponseConversationsPagination.js +3 -0
- package/dist/cjs/api/types/Project.d.ts +4 -0
- package/dist/cjs/api/types/ReplayConversationItemResponse.d.ts +16 -0
- package/dist/cjs/api/types/ReplayConversationItemResponse.js +3 -0
- package/dist/cjs/api/types/ReplayToolCall.d.ts +29 -0
- package/dist/cjs/api/types/ReplayToolCall.js +12 -0
- package/dist/cjs/api/types/SipCallError.d.ts +24 -0
- package/dist/cjs/api/types/SipCallError.js +16 -0
- package/dist/cjs/api/types/index.d.ts +6 -0
- package/dist/cjs/api/types/index.js +6 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/Client.d.mts +6 -0
- package/dist/esm/Client.mjs +10 -0
- package/dist/esm/api/errors/UnprocessableEntityError.d.mts +6 -0
- package/dist/esm/api/errors/UnprocessableEntityError.mjs +17 -0
- package/dist/esm/api/errors/index.d.mts +1 -0
- package/dist/esm/api/errors/index.mjs +1 -0
- package/dist/esm/api/resources/conversationItems/client/Client.d.mts +39 -0
- package/dist/esm/api/resources/conversationItems/client/Client.mjs +102 -0
- package/dist/esm/api/resources/conversationItems/client/index.d.mts +1 -0
- package/dist/esm/api/resources/conversationItems/client/index.mjs +1 -0
- package/dist/esm/api/resources/conversationItems/client/requests/ReplayConversationItemRequest.d.mts +12 -0
- package/dist/esm/api/resources/conversationItems/client/requests/ReplayConversationItemRequest.mjs +2 -0
- package/dist/esm/api/resources/conversationItems/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/conversationItems/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/conversationItems/exports.d.mts +2 -0
- package/dist/esm/api/resources/conversationItems/exports.mjs +3 -0
- package/dist/esm/api/resources/conversationItems/index.d.mts +1 -0
- package/dist/esm/api/resources/conversationItems/index.mjs +1 -0
- package/dist/esm/api/resources/conversations/client/Client.d.mts +1 -0
- package/dist/esm/api/resources/conversations/client/Client.mjs +3 -0
- package/dist/esm/api/resources/conversations/types/ConversationsListResponse.d.mts +1 -9
- package/dist/esm/api/resources/index.d.mts +4 -0
- package/dist/esm/api/resources/index.mjs +4 -0
- package/dist/esm/api/resources/projects/client/requests/UpdateProjectRequest.d.mts +2 -0
- package/dist/esm/api/resources/workspace/client/Client.d.mts +26 -0
- package/dist/esm/api/resources/workspace/client/Client.mjs +73 -0
- package/dist/esm/api/resources/workspace/client/index.d.mts +1 -0
- package/dist/esm/api/resources/workspace/client/index.mjs +1 -0
- package/dist/esm/api/resources/workspace/exports.d.mts +2 -0
- package/dist/esm/api/resources/workspace/exports.mjs +3 -0
- package/dist/esm/api/resources/workspace/index.d.mts +2 -0
- package/dist/esm/api/resources/workspace/index.mjs +2 -0
- package/dist/esm/api/resources/workspace/types/WorkspaceGetResponse.d.mts +6 -0
- package/dist/esm/api/resources/workspace/types/WorkspaceGetResponse.mjs +2 -0
- package/dist/esm/api/resources/workspace/types/index.d.mts +1 -0
- package/dist/esm/api/resources/workspace/types/index.mjs +1 -0
- package/dist/esm/api/types/BadRequestErrorBody.d.mts +1 -1
- package/dist/esm/api/types/Conversation.d.mts +8 -0
- package/dist/esm/api/types/ConversationItem.d.mts +2 -0
- package/dist/esm/api/types/ConversationsListResponseConversation.d.mts +4 -0
- package/dist/esm/api/types/ConversationsListResponseConversation.mjs +2 -0
- package/dist/esm/api/types/ConversationsListResponseConversations.d.mts +5 -0
- package/dist/esm/api/types/ConversationsListResponseConversations.mjs +2 -0
- package/dist/esm/api/types/ConversationsListResponseConversationsPagination.d.mts +6 -0
- package/dist/esm/api/types/ConversationsListResponseConversationsPagination.mjs +2 -0
- package/dist/esm/api/types/Project.d.mts +4 -0
- package/dist/esm/api/types/ReplayConversationItemResponse.d.mts +16 -0
- package/dist/esm/api/types/ReplayConversationItemResponse.mjs +2 -0
- package/dist/esm/api/types/ReplayToolCall.d.mts +29 -0
- package/dist/esm/api/types/ReplayToolCall.mjs +9 -0
- package/dist/esm/api/types/SipCallError.d.mts +24 -0
- package/dist/esm/api/types/SipCallError.mjs +13 -0
- package/dist/esm/api/types/index.d.mts +6 -0
- package/dist/esm/api/types/index.mjs +6 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +23 -1
- package/reference.md +134 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
12
|
+
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
13
|
+
import * as core from "../../../../core/index.mjs";
|
|
14
|
+
import * as environments from "../../../../environments.mjs";
|
|
15
|
+
import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
|
|
16
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
17
|
+
import * as Phonic from "../../../index.mjs";
|
|
18
|
+
export class ConversationItemsClient {
|
|
19
|
+
constructor(options = {}) {
|
|
20
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Returns the alternative response(s) the assistant would have
|
|
24
|
+
* produced for this conversation turn given changes to the agent system prompt.
|
|
25
|
+
*
|
|
26
|
+
* Only assistant items from ended conversations can be replayed. The
|
|
27
|
+
* conversation must have an associated agent.
|
|
28
|
+
*
|
|
29
|
+
* @param {string} id - The ID of the conversation item to replay.
|
|
30
|
+
* @param {Phonic.ReplayConversationItemRequest} request
|
|
31
|
+
* @param {ConversationItemsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
32
|
+
*
|
|
33
|
+
* @throws {@link Phonic.BadRequestError}
|
|
34
|
+
* @throws {@link Phonic.UnauthorizedError}
|
|
35
|
+
* @throws {@link Phonic.ForbiddenError}
|
|
36
|
+
* @throws {@link Phonic.NotFoundError}
|
|
37
|
+
* @throws {@link Phonic.ConflictError}
|
|
38
|
+
* @throws {@link Phonic.UnprocessableEntityError}
|
|
39
|
+
* @throws {@link Phonic.InternalServerError}
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* await client.conversationItems.replay("id", {
|
|
43
|
+
* system_prompt: "system_prompt"
|
|
44
|
+
* })
|
|
45
|
+
*/
|
|
46
|
+
replay(id, request, requestOptions) {
|
|
47
|
+
return core.HttpResponsePromise.fromPromise(this.__replay(id, request, requestOptions));
|
|
48
|
+
}
|
|
49
|
+
__replay(id, request, requestOptions) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
52
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
53
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
54
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
55
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
|
|
56
|
+
.base, `conversation_items/${core.url.encodePathParam(id)}/replay`),
|
|
57
|
+
method: "POST",
|
|
58
|
+
headers: _headers,
|
|
59
|
+
contentType: "application/json",
|
|
60
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
61
|
+
requestType: "json",
|
|
62
|
+
body: request,
|
|
63
|
+
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
64
|
+
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
65
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
66
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
67
|
+
logging: this._options.logging,
|
|
68
|
+
});
|
|
69
|
+
if (_response.ok) {
|
|
70
|
+
return {
|
|
71
|
+
data: _response.body,
|
|
72
|
+
rawResponse: _response.rawResponse,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
if (_response.error.reason === "status-code") {
|
|
76
|
+
switch (_response.error.statusCode) {
|
|
77
|
+
case 400:
|
|
78
|
+
throw new Phonic.BadRequestError(_response.error.body, _response.rawResponse);
|
|
79
|
+
case 401:
|
|
80
|
+
throw new Phonic.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
81
|
+
case 403:
|
|
82
|
+
throw new Phonic.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
83
|
+
case 404:
|
|
84
|
+
throw new Phonic.NotFoundError(_response.error.body, _response.rawResponse);
|
|
85
|
+
case 409:
|
|
86
|
+
throw new Phonic.ConflictError(_response.error.body, _response.rawResponse);
|
|
87
|
+
case 422:
|
|
88
|
+
throw new Phonic.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
89
|
+
case 500:
|
|
90
|
+
throw new Phonic.InternalServerError(_response.error.body, _response.rawResponse);
|
|
91
|
+
default:
|
|
92
|
+
throw new errors.PhonicError({
|
|
93
|
+
statusCode: _response.error.statusCode,
|
|
94
|
+
body: _response.error.body,
|
|
95
|
+
rawResponse: _response.rawResponse,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/conversation_items/{id}/replay");
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
package/dist/esm/api/resources/conversationItems/client/requests/ReplayConversationItemRequest.d.mts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* system_prompt: "system_prompt"
|
|
5
|
+
* }
|
|
6
|
+
*/
|
|
7
|
+
export interface ReplayConversationItemRequest {
|
|
8
|
+
/** The system prompt to use when generating replay responses. Use this to test prompt changes against this conversation turn. */
|
|
9
|
+
system_prompt: string;
|
|
10
|
+
/** Number of alternative responses to generate. */
|
|
11
|
+
num_responses?: number;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ReplayConversationItemRequest } from "./ReplayConversationItemRequest.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client/index.mjs";
|
|
@@ -646,6 +646,7 @@ export class ConversationsClient {
|
|
|
646
646
|
*
|
|
647
647
|
* @throws {@link Phonic.BadRequestError}
|
|
648
648
|
* @throws {@link Phonic.UnauthorizedError}
|
|
649
|
+
* @throws {@link Phonic.ConflictError}
|
|
649
650
|
* @throws {@link Phonic.InternalServerError}
|
|
650
651
|
*
|
|
651
652
|
* @example
|
|
@@ -695,6 +696,8 @@ export class ConversationsClient {
|
|
|
695
696
|
throw new Phonic.BadRequestError(_response.error.body, _response.rawResponse);
|
|
696
697
|
case 401:
|
|
697
698
|
throw new Phonic.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
699
|
+
case 409:
|
|
700
|
+
throw new Phonic.ConflictError(_response.error.body, _response.rawResponse);
|
|
698
701
|
case 500:
|
|
699
702
|
throw new Phonic.InternalServerError(_response.error.body, _response.rawResponse);
|
|
700
703
|
default:
|
|
@@ -1,10 +1,2 @@
|
|
|
1
1
|
import type * as Phonic from "../../../index.mjs";
|
|
2
|
-
export type ConversationsListResponse =
|
|
3
|
-
conversations: Phonic.Conversation[];
|
|
4
|
-
pagination: {
|
|
5
|
-
prev_cursor: string | null;
|
|
6
|
-
next_cursor: string | null;
|
|
7
|
-
};
|
|
8
|
-
} | {
|
|
9
|
-
conversation: Phonic.Conversation;
|
|
10
|
-
};
|
|
2
|
+
export type ConversationsListResponse = Phonic.ConversationsListResponseConversations | Phonic.ConversationsListResponseConversation;
|
|
@@ -4,6 +4,8 @@ export * from "./agents/types/index.mjs";
|
|
|
4
4
|
export * from "./auth/client/requests/index.mjs";
|
|
5
5
|
export * as auth from "./auth/index.mjs";
|
|
6
6
|
export * from "./auth/types/index.mjs";
|
|
7
|
+
export * from "./conversationItems/client/requests/index.mjs";
|
|
8
|
+
export * as conversationItems from "./conversationItems/index.mjs";
|
|
7
9
|
export * from "./conversations/client/requests/index.mjs";
|
|
8
10
|
export * as conversations from "./conversations/index.mjs";
|
|
9
11
|
export * from "./conversations/types/index.mjs";
|
|
@@ -19,3 +21,5 @@ export * from "./tools/types/index.mjs";
|
|
|
19
21
|
export * from "./voices/client/requests/index.mjs";
|
|
20
22
|
export * as voices from "./voices/index.mjs";
|
|
21
23
|
export * from "./voices/types/index.mjs";
|
|
24
|
+
export * as workspace from "./workspace/index.mjs";
|
|
25
|
+
export * from "./workspace/types/index.mjs";
|
|
@@ -4,6 +4,8 @@ export * from "./agents/types/index.mjs";
|
|
|
4
4
|
export * from "./auth/client/requests/index.mjs";
|
|
5
5
|
export * as auth from "./auth/index.mjs";
|
|
6
6
|
export * from "./auth/types/index.mjs";
|
|
7
|
+
export * from "./conversationItems/client/requests/index.mjs";
|
|
8
|
+
export * as conversationItems from "./conversationItems/index.mjs";
|
|
7
9
|
export * from "./conversations/client/requests/index.mjs";
|
|
8
10
|
export * as conversations from "./conversations/index.mjs";
|
|
9
11
|
export * from "./conversations/types/index.mjs";
|
|
@@ -19,3 +21,5 @@ export * from "./tools/types/index.mjs";
|
|
|
19
21
|
export * from "./voices/client/requests/index.mjs";
|
|
20
22
|
export * as voices from "./voices/index.mjs";
|
|
21
23
|
export * from "./voices/types/index.mjs";
|
|
24
|
+
export * as workspace from "./workspace/index.mjs";
|
|
25
|
+
export * from "./workspace/types/index.mjs";
|
|
@@ -10,4 +10,6 @@ export interface UpdateProjectRequest {
|
|
|
10
10
|
name?: string;
|
|
11
11
|
/** The name of the new project's default agent. Set to `null` to remove the default agent. */
|
|
12
12
|
default_agent?: string | null;
|
|
13
|
+
/** Maximum number of concurrent conversations allowed for this project. When `null`, the workspace `max_active_conversations` limit is used. */
|
|
14
|
+
max_active_conversations?: number | null;
|
|
13
15
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
3
|
+
import * as core from "../../../../core/index.mjs";
|
|
4
|
+
import * as Phonic from "../../../index.mjs";
|
|
5
|
+
export declare namespace WorkspaceClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class WorkspaceClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<WorkspaceClient.Options>;
|
|
12
|
+
constructor(options?: WorkspaceClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* Returns information about the workspace.
|
|
15
|
+
*
|
|
16
|
+
* @param {WorkspaceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
17
|
+
*
|
|
18
|
+
* @throws {@link Phonic.UnauthorizedError}
|
|
19
|
+
* @throws {@link Phonic.InternalServerError}
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* await client.workspace.get()
|
|
23
|
+
*/
|
|
24
|
+
get(requestOptions?: WorkspaceClient.RequestOptions): core.HttpResponsePromise<Phonic.WorkspaceGetResponse>;
|
|
25
|
+
private __get;
|
|
26
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
12
|
+
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
13
|
+
import * as core from "../../../../core/index.mjs";
|
|
14
|
+
import * as environments from "../../../../environments.mjs";
|
|
15
|
+
import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
|
|
16
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
17
|
+
import * as Phonic from "../../../index.mjs";
|
|
18
|
+
export class WorkspaceClient {
|
|
19
|
+
constructor(options = {}) {
|
|
20
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Returns information about the workspace.
|
|
24
|
+
*
|
|
25
|
+
* @param {WorkspaceClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
26
|
+
*
|
|
27
|
+
* @throws {@link Phonic.UnauthorizedError}
|
|
28
|
+
* @throws {@link Phonic.InternalServerError}
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* await client.workspace.get()
|
|
32
|
+
*/
|
|
33
|
+
get(requestOptions) {
|
|
34
|
+
return core.HttpResponsePromise.fromPromise(this.__get(requestOptions));
|
|
35
|
+
}
|
|
36
|
+
__get(requestOptions) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
39
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
40
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
41
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
42
|
+
url: core.url.join((_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : ((_d = (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.PhonicEnvironment.Default)
|
|
43
|
+
.base, "workspace"),
|
|
44
|
+
method: "GET",
|
|
45
|
+
headers: _headers,
|
|
46
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
47
|
+
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
48
|
+
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
49
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
50
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
51
|
+
logging: this._options.logging,
|
|
52
|
+
});
|
|
53
|
+
if (_response.ok) {
|
|
54
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
55
|
+
}
|
|
56
|
+
if (_response.error.reason === "status-code") {
|
|
57
|
+
switch (_response.error.statusCode) {
|
|
58
|
+
case 401:
|
|
59
|
+
throw new Phonic.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
60
|
+
case 500:
|
|
61
|
+
throw new Phonic.InternalServerError(_response.error.body, _response.rawResponse);
|
|
62
|
+
default:
|
|
63
|
+
throw new errors.PhonicError({
|
|
64
|
+
statusCode: _response.error.statusCode,
|
|
65
|
+
body: _response.error.body,
|
|
66
|
+
rawResponse: _response.rawResponse,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/workspace");
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./WorkspaceGetResponse.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./WorkspaceGetResponse.mjs";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type * as Phonic from "../index.mjs";
|
|
2
|
-
export type BadRequestErrorBody = Phonic.ValidationError | Phonic.BasicError;
|
|
2
|
+
export type BadRequestErrorBody = Phonic.ValidationError | Phonic.BasicError | Phonic.SipCallError;
|
|
@@ -66,6 +66,14 @@ export interface Conversation {
|
|
|
66
66
|
no_input_poke_text: string | null;
|
|
67
67
|
/** Seconds of silence before the conversation is ended. */
|
|
68
68
|
no_input_end_conversation_sec: number | null;
|
|
69
|
+
/** Voice activity detection prebuffer duration in milliseconds. `null` when not applicable or unknown (e.g. push-to-talk, or legacy stored conversations). */
|
|
70
|
+
vad_prebuffer_duration_ms?: (number | null) | undefined;
|
|
71
|
+
/** Minimum speech duration for voice activity detection in milliseconds. `null` when not applicable or unknown. */
|
|
72
|
+
vad_min_speech_duration_ms?: (number | null) | undefined;
|
|
73
|
+
/** Minimum silence duration for voice activity detection in milliseconds. `null` when not applicable or unknown. */
|
|
74
|
+
vad_min_silence_duration_ms?: (number | null) | undefined;
|
|
75
|
+
/** Voice activity detection threshold. `null` when not applicable or unknown. */
|
|
76
|
+
vad_threshold?: (number | null) | undefined;
|
|
69
77
|
/** Results from conversation evaluations and extractions. */
|
|
70
78
|
task_results: Record<string, unknown>;
|
|
71
79
|
/** Array of conversation items (turns). */
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface ConversationsListResponseConversationsPagination {
|
|
2
|
+
/** Cursor to fetch the previous page of conversations (newer). Use this value in the `before` query parameter. `null` if there is no previous page. */
|
|
3
|
+
prev_cursor: string | null;
|
|
4
|
+
/** Cursor to fetch the next page of conversations (older). Use this value in the `after` query parameter. `null` if there is no next page. */
|
|
5
|
+
next_cursor: string | null;
|
|
6
|
+
}
|
|
@@ -5,6 +5,10 @@ export interface Project {
|
|
|
5
5
|
name: string;
|
|
6
6
|
/** The project's default agent. */
|
|
7
7
|
default_agent: Project.DefaultAgent | null;
|
|
8
|
+
/** Number of conversations currently in progress for this project. */
|
|
9
|
+
active_conversations: number;
|
|
10
|
+
/** Maximum number of concurrent conversations allowed for this project. When `null`, the workspace `max_active_conversations` limit is used. */
|
|
11
|
+
max_active_conversations: number | null;
|
|
8
12
|
}
|
|
9
13
|
export declare namespace Project {
|
|
10
14
|
/**
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type * as Phonic from "../index.mjs";
|
|
2
|
+
export interface ReplayConversationItemResponse {
|
|
3
|
+
/** Alternative responses generated for the conversation item. */
|
|
4
|
+
responses: ReplayConversationItemResponse.Responses.Item[];
|
|
5
|
+
}
|
|
6
|
+
export declare namespace ReplayConversationItemResponse {
|
|
7
|
+
type Responses = Responses.Item[];
|
|
8
|
+
namespace Responses {
|
|
9
|
+
interface Item {
|
|
10
|
+
/** The text the LLM produced for this replay response. */
|
|
11
|
+
text: string;
|
|
12
|
+
/** Tool calls the LLM would invoke for this replay response - note that the tools will not actually be called during replay. */
|
|
13
|
+
tool_calls: Phonic.ReplayToolCall[];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface ReplayToolCall {
|
|
2
|
+
tool: ReplayToolCall.Tool;
|
|
3
|
+
/** HTTP method for webhook tool calls. */
|
|
4
|
+
endpoint_method?: ReplayToolCall.EndpointMethod | undefined;
|
|
5
|
+
/** URL for webhook tool calls. */
|
|
6
|
+
endpoint_url?: string | undefined;
|
|
7
|
+
/** Headers for webhook tool calls. */
|
|
8
|
+
endpoint_headers?: (Record<string, string | null> | null) | undefined;
|
|
9
|
+
/** Query parameters the LLM produced for webhook tool calls. */
|
|
10
|
+
query_params?: (Record<string, string | null> | null) | undefined;
|
|
11
|
+
/** Context returned from custom-context tool calls. */
|
|
12
|
+
context?: string | undefined;
|
|
13
|
+
/** Request body the LLM produced for the tool call. */
|
|
14
|
+
request_body: Record<string, unknown> | null;
|
|
15
|
+
}
|
|
16
|
+
export declare namespace ReplayToolCall {
|
|
17
|
+
interface Tool {
|
|
18
|
+
/** The tool ID. */
|
|
19
|
+
id: string;
|
|
20
|
+
/** The tool name. */
|
|
21
|
+
name: string;
|
|
22
|
+
}
|
|
23
|
+
/** HTTP method for webhook tool calls. */
|
|
24
|
+
const EndpointMethod: {
|
|
25
|
+
readonly Get: "GET";
|
|
26
|
+
readonly Post: "POST";
|
|
27
|
+
};
|
|
28
|
+
type EndpointMethod = (typeof EndpointMethod)[keyof typeof EndpointMethod];
|
|
29
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
export var ReplayToolCall;
|
|
3
|
+
(function (ReplayToolCall) {
|
|
4
|
+
/** HTTP method for webhook tool calls. */
|
|
5
|
+
ReplayToolCall.EndpointMethod = {
|
|
6
|
+
Get: "GET",
|
|
7
|
+
Post: "POST",
|
|
8
|
+
};
|
|
9
|
+
})(ReplayToolCall || (ReplayToolCall = {}));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface SipCallError {
|
|
2
|
+
error: SipCallError.Error_;
|
|
3
|
+
}
|
|
4
|
+
export declare namespace SipCallError {
|
|
5
|
+
interface Error_ {
|
|
6
|
+
/** Human-readable error message. */
|
|
7
|
+
message: string;
|
|
8
|
+
/** Machine-readable error code. */
|
|
9
|
+
code: Error_.Code;
|
|
10
|
+
/** The SIP response status code from the carrier (e.g. 403, 486, 603). */
|
|
11
|
+
sip_status_code: number;
|
|
12
|
+
/** The SIP response reason phrase from the carrier (e.g. "Network Blocked", "Trunk CPS limit exceeded"). */
|
|
13
|
+
sip_status: string;
|
|
14
|
+
}
|
|
15
|
+
namespace Error_ {
|
|
16
|
+
/** Machine-readable error code. */
|
|
17
|
+
const Code: {
|
|
18
|
+
readonly SipCallFailed: "sip_call_failed";
|
|
19
|
+
readonly SipAuthFailed: "sip_auth_failed";
|
|
20
|
+
readonly InvalidPhoneNumber: "invalid_phone_number";
|
|
21
|
+
};
|
|
22
|
+
type Code = (typeof Code)[keyof typeof Code];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
export var SipCallError;
|
|
3
|
+
(function (SipCallError) {
|
|
4
|
+
let Error_;
|
|
5
|
+
(function (Error_) {
|
|
6
|
+
/** Machine-readable error code. */
|
|
7
|
+
Error_.Code = {
|
|
8
|
+
SipCallFailed: "sip_call_failed",
|
|
9
|
+
SipAuthFailed: "sip_auth_failed",
|
|
10
|
+
InvalidPhoneNumber: "invalid_phone_number",
|
|
11
|
+
};
|
|
12
|
+
})(Error_ = SipCallError.Error_ || (SipCallError.Error_ = {}));
|
|
13
|
+
})(SipCallError || (SipCallError = {}));
|
|
@@ -19,6 +19,9 @@ export * from "./ConversationEvaluation.mjs";
|
|
|
19
19
|
export * from "./ConversationEvaluationResult.mjs";
|
|
20
20
|
export * from "./ConversationExtraction.mjs";
|
|
21
21
|
export * from "./ConversationItem.mjs";
|
|
22
|
+
export * from "./ConversationsListResponseConversation.mjs";
|
|
23
|
+
export * from "./ConversationsListResponseConversations.mjs";
|
|
24
|
+
export * from "./ConversationsListResponseConversationsPagination.mjs";
|
|
22
25
|
export * from "./CreateAgentRequest.mjs";
|
|
23
26
|
export * from "./DtmfPayload.mjs";
|
|
24
27
|
export * from "./Error_.mjs";
|
|
@@ -35,9 +38,12 @@ export * from "./OutboundCallInitiatedResponse.mjs";
|
|
|
35
38
|
export * from "./OutboundDryRunResponse.mjs";
|
|
36
39
|
export * from "./Project.mjs";
|
|
37
40
|
export * from "./ReadyToStartConversationPayload.mjs";
|
|
41
|
+
export * from "./ReplayConversationItemResponse.mjs";
|
|
42
|
+
export * from "./ReplayToolCall.mjs";
|
|
38
43
|
export * from "./ResetPayload.mjs";
|
|
39
44
|
export * from "./SayPayload.mjs";
|
|
40
45
|
export * from "./SetExternalIdPayload.mjs";
|
|
46
|
+
export * from "./SipCallError.mjs";
|
|
41
47
|
export * from "./SipOutboundCallInitiatedResponse.mjs";
|
|
42
48
|
export * from "./SipOutboundDryRunResponse.mjs";
|
|
43
49
|
export * from "./Task.mjs";
|
|
@@ -19,6 +19,9 @@ export * from "./ConversationEvaluation.mjs";
|
|
|
19
19
|
export * from "./ConversationEvaluationResult.mjs";
|
|
20
20
|
export * from "./ConversationExtraction.mjs";
|
|
21
21
|
export * from "./ConversationItem.mjs";
|
|
22
|
+
export * from "./ConversationsListResponseConversation.mjs";
|
|
23
|
+
export * from "./ConversationsListResponseConversations.mjs";
|
|
24
|
+
export * from "./ConversationsListResponseConversationsPagination.mjs";
|
|
22
25
|
export * from "./CreateAgentRequest.mjs";
|
|
23
26
|
export * from "./DtmfPayload.mjs";
|
|
24
27
|
export * from "./Error_.mjs";
|
|
@@ -35,9 +38,12 @@ export * from "./OutboundCallInitiatedResponse.mjs";
|
|
|
35
38
|
export * from "./OutboundDryRunResponse.mjs";
|
|
36
39
|
export * from "./Project.mjs";
|
|
37
40
|
export * from "./ReadyToStartConversationPayload.mjs";
|
|
41
|
+
export * from "./ReplayConversationItemResponse.mjs";
|
|
42
|
+
export * from "./ReplayToolCall.mjs";
|
|
38
43
|
export * from "./ResetPayload.mjs";
|
|
39
44
|
export * from "./SayPayload.mjs";
|
|
40
45
|
export * from "./SetExternalIdPayload.mjs";
|
|
46
|
+
export * from "./SipCallError.mjs";
|
|
41
47
|
export * from "./SipOutboundCallInitiatedResponse.mjs";
|
|
42
48
|
export * from "./SipOutboundDryRunResponse.mjs";
|
|
43
49
|
export * from "./Task.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.31.
|
|
1
|
+
export declare const SDK_VERSION = "0.31.13";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.31.
|
|
1
|
+
export const SDK_VERSION = "0.31.13";
|