@serenity-star/sdk 2.4.3 → 2.5.0
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/index.d.mts +113 -219
- package/dist/index.d.ts +113 -219
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/readme.md +145 -1
package/dist/index.d.mts
CHANGED
|
@@ -62,17 +62,37 @@ type ProxyExecutionOptions = {
|
|
|
62
62
|
useVision?: boolean;
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
-
/**
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
/** Context passed to the tokenProvider callback */
|
|
66
|
+
type TokenProviderContext = {
|
|
67
|
+
publicKey: string;
|
|
68
|
+
/** The base URL of the Serenity API */
|
|
69
|
+
baseUrl: string;
|
|
70
|
+
/** The agent code this token is scoped to */
|
|
71
|
+
agentCode: string;
|
|
72
|
+
};
|
|
73
|
+
/** The tokenProvider function signature */
|
|
74
|
+
type TokenProviderFn = (params: {
|
|
75
|
+
context: TokenProviderContext;
|
|
76
|
+
}) => Promise<string>;
|
|
77
|
+
/** Agent Client Credentials — scoped to a single agent */
|
|
78
|
+
type AgentClientCredentials = {
|
|
79
|
+
/** The agent this credential is scoped to */
|
|
80
|
+
agentCode: string;
|
|
81
|
+
/** The public key issued for this agent */
|
|
82
|
+
publicKey: string;
|
|
83
|
+
/** Callback to obtain a client token from your backend */
|
|
84
|
+
tokenProvider: TokenProviderFn;
|
|
85
|
+
};
|
|
86
|
+
/** API Key auth mode — full access */
|
|
87
|
+
type ApiKeyClientOptions = {
|
|
72
88
|
apiKey: string;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
89
|
+
agentClientCredentials?: never;
|
|
90
|
+
baseUrl?: string;
|
|
91
|
+
};
|
|
92
|
+
/** Agent Client Credentials auth mode — scoped to one agent */
|
|
93
|
+
type AgentClientCredentialsOptions = {
|
|
94
|
+
apiKey?: never;
|
|
95
|
+
agentClientCredentials: AgentClientCredentials;
|
|
76
96
|
baseUrl?: string;
|
|
77
97
|
};
|
|
78
98
|
/**
|
|
@@ -510,7 +530,7 @@ type Message = ({
|
|
|
510
530
|
completion_usage?: CompletionUsageRes;
|
|
511
531
|
time_to_first_token?: number;
|
|
512
532
|
executor_task_logs?: ExecutorTaskLogsRes;
|
|
513
|
-
attached_volatile_knowledges?:
|
|
533
|
+
attached_volatile_knowledges?: AttachedVolatileKnowledgeRes[];
|
|
514
534
|
action_results?: {
|
|
515
535
|
[key: string]: PluginExecutionResult;
|
|
516
536
|
};
|
|
@@ -529,6 +549,14 @@ type AttachedVolatileKnowledge = {
|
|
|
529
549
|
fileSize: number;
|
|
530
550
|
downloadUrl: string;
|
|
531
551
|
};
|
|
552
|
+
type AttachedVolatileKnowledgeRes = {
|
|
553
|
+
id: string;
|
|
554
|
+
expiration_date: string;
|
|
555
|
+
file_id: string;
|
|
556
|
+
file_name: string;
|
|
557
|
+
file_size: number;
|
|
558
|
+
download_url: string;
|
|
559
|
+
};
|
|
532
560
|
type CompletionUsageRes = {
|
|
533
561
|
completion_tokens: number;
|
|
534
562
|
prompt_tokens: number;
|
|
@@ -638,15 +666,27 @@ type ConnectorStatusResult = {
|
|
|
638
666
|
isConnected: boolean;
|
|
639
667
|
};
|
|
640
668
|
|
|
669
|
+
interface AuthProvider {
|
|
670
|
+
/** Returns the headers to attach to HTTP requests */
|
|
671
|
+
getHeaders(): Promise<Record<string, string>>;
|
|
672
|
+
/** Returns the WebSocket sub-protocols for authentication */
|
|
673
|
+
getWebSocketProtocols(): Promise<string[]>;
|
|
674
|
+
/**
|
|
675
|
+
* Handles a 401 Unauthorized response.
|
|
676
|
+
* Returns true if the token was refreshed and the request should be retried.
|
|
677
|
+
*/
|
|
678
|
+
handleUnauthorized(response: Response): Promise<boolean>;
|
|
679
|
+
}
|
|
680
|
+
|
|
641
681
|
/**
|
|
642
682
|
* Manages volatile knowledge files for agent instances.
|
|
643
683
|
* Provides methods to upload, remove, and clear files.
|
|
644
684
|
*/
|
|
645
685
|
declare class VolatileKnowledgeManager {
|
|
646
686
|
private readonly baseUrl;
|
|
647
|
-
private readonly
|
|
687
|
+
private readonly authProvider;
|
|
648
688
|
private ids;
|
|
649
|
-
constructor(baseUrl: string,
|
|
689
|
+
constructor(baseUrl: string, authProvider: AuthProvider);
|
|
650
690
|
/**
|
|
651
691
|
* Upload a file to be used as volatile knowledge in the next agent execution.
|
|
652
692
|
* The file will be automatically included in subsequent messages/executions until cleared.
|
|
@@ -713,7 +753,7 @@ declare class VolatileKnowledgeManager {
|
|
|
713
753
|
declare class Conversation extends EventEmitter<SSEStreamEvents> {
|
|
714
754
|
#private;
|
|
715
755
|
private agentCode;
|
|
716
|
-
private
|
|
756
|
+
private authProvider;
|
|
717
757
|
private baseUrl;
|
|
718
758
|
private userIdentifier?;
|
|
719
759
|
private agentVersion?;
|
|
@@ -892,7 +932,7 @@ type RealtimeSessionEvents = {
|
|
|
892
932
|
declare class RealtimeSession extends EventEmitter<RealtimeSessionEvents> {
|
|
893
933
|
#private;
|
|
894
934
|
private agentCode;
|
|
895
|
-
private
|
|
935
|
+
private authProvider;
|
|
896
936
|
private baseUrl;
|
|
897
937
|
private inputParameters?;
|
|
898
938
|
private userIdentifier?;
|
|
@@ -905,7 +945,7 @@ declare class RealtimeSession extends EventEmitter<RealtimeSessionEvents> {
|
|
|
905
945
|
private localStream?;
|
|
906
946
|
private dataChannel?;
|
|
907
947
|
private socket?;
|
|
908
|
-
constructor(agentCode: string,
|
|
948
|
+
constructor(agentCode: string, authProvider: AuthProvider, baseUrl: string, options?: AgentSetupOptions);
|
|
909
949
|
/**
|
|
910
950
|
* Starts the real-time session.
|
|
911
951
|
*/
|
|
@@ -927,7 +967,7 @@ declare class RealtimeSession extends EventEmitter<RealtimeSessionEvents> {
|
|
|
927
967
|
declare abstract class SystemAgent<T extends keyof SystemAgentExecutionOptionsMap> extends EventEmitter<SSEStreamEvents> {
|
|
928
968
|
#private;
|
|
929
969
|
protected readonly agentCode: string;
|
|
930
|
-
protected readonly
|
|
970
|
+
protected readonly authProvider: AuthProvider;
|
|
931
971
|
protected readonly baseUrl: string;
|
|
932
972
|
protected readonly options?: SystemAgentExecutionOptionsMap[T] | undefined;
|
|
933
973
|
/**
|
|
@@ -945,7 +985,7 @@ declare abstract class SystemAgent<T extends keyof SystemAgentExecutionOptionsMa
|
|
|
945
985
|
readonly volatileKnowledge: VolatileKnowledgeManager;
|
|
946
986
|
private readonly fileManager;
|
|
947
987
|
private connection;
|
|
948
|
-
protected constructor(agentCode: string,
|
|
988
|
+
protected constructor(agentCode: string, authProvider: AuthProvider, baseUrl: string, options?: SystemAgentExecutionOptionsMap[T] | undefined);
|
|
949
989
|
/**
|
|
950
990
|
* Stops the current streaming response, aborting the SSE connection.
|
|
951
991
|
* If no stream is active, this method does nothing.
|
|
@@ -976,8 +1016,8 @@ declare abstract class SystemAgent<T extends keyof SystemAgentExecutionOptionsMa
|
|
|
976
1016
|
|
|
977
1017
|
declare class Activity extends SystemAgent<"activity"> {
|
|
978
1018
|
private constructor();
|
|
979
|
-
static create(agentCode: string,
|
|
980
|
-
static createAndExecute(agentCode: string,
|
|
1019
|
+
static create(agentCode: string, authProvider: AuthProvider, baseUrl: string, options?: SystemAgentExecutionOptionsMap["activity"]): Activity;
|
|
1020
|
+
static createAndExecute(agentCode: string, authProvider: AuthProvider, baseUrl: string, options?: SystemAgentExecutionOptionsMap["activity"]): Promise<AgentResult>;
|
|
981
1021
|
protected createExecuteBody(stream: boolean): ExecuteBodyParams | {
|
|
982
1022
|
[key: string]: any;
|
|
983
1023
|
};
|
|
@@ -986,8 +1026,8 @@ declare class Activity extends SystemAgent<"activity"> {
|
|
|
986
1026
|
|
|
987
1027
|
declare class ChatCompletion extends SystemAgent<"chat-completion"> {
|
|
988
1028
|
private constructor();
|
|
989
|
-
static create(agentCode: string,
|
|
990
|
-
static createAndExecute(agentCode: string,
|
|
1029
|
+
static create(agentCode: string, authProvider: AuthProvider, baseUrl: string, options?: SystemAgentExecutionOptionsMap["chat-completion"]): ChatCompletion;
|
|
1030
|
+
static createAndExecute(agentCode: string, authProvider: AuthProvider, baseUrl: string, options?: SystemAgentExecutionOptionsMap["chat-completion"]): Promise<AgentResult>;
|
|
991
1031
|
protected createExecuteBody(stream: boolean): ExecuteBodyParams | {
|
|
992
1032
|
[key: string]: any;
|
|
993
1033
|
};
|
|
@@ -998,8 +1038,8 @@ declare class ChatCompletion extends SystemAgent<"chat-completion"> {
|
|
|
998
1038
|
|
|
999
1039
|
declare class Proxy extends SystemAgent<"proxy"> {
|
|
1000
1040
|
private constructor();
|
|
1001
|
-
static create(agentCode: string,
|
|
1002
|
-
static createAndExecute(agentCode: string,
|
|
1041
|
+
static create(agentCode: string, authProvider: AuthProvider, baseUrl: string, options?: SystemAgentExecutionOptionsMap["proxy"]): Proxy;
|
|
1042
|
+
static createAndExecute(agentCode: string, authProvider: AuthProvider, baseUrl: string, options?: SystemAgentExecutionOptionsMap["proxy"]): Promise<AgentResult>;
|
|
1003
1043
|
protected createExecuteBody(stream: boolean): ExecuteBodyParams | {
|
|
1004
1044
|
[key: string]: any;
|
|
1005
1045
|
};
|
|
@@ -1108,6 +1148,17 @@ type SystemAgentScope<T extends keyof SystemAgentExecutionOptionsMap, TCreateRet
|
|
|
1108
1148
|
*/
|
|
1109
1149
|
create: (agentCode: string, options?: SystemAgentExecutionOptionsMap[T]) => TCreateReturn;
|
|
1110
1150
|
};
|
|
1151
|
+
type ScopedConversationalAgentScope<T extends keyof ConversationalAgentExecutionOptionsMap> = {
|
|
1152
|
+
createConversation: (options?: AgentSetupOptions) => Promise<Conversation>;
|
|
1153
|
+
getInfo: (options?: AgentSetupOptions) => Promise<ConversationInfoResult | null>;
|
|
1154
|
+
getConversationById: (conversationId: string, options?: {
|
|
1155
|
+
showExecutorTaskLogs: boolean;
|
|
1156
|
+
}) => Promise<ConversationRes>;
|
|
1157
|
+
};
|
|
1158
|
+
type ScopedSystemAgentScope<T extends keyof SystemAgentExecutionOptionsMap, TCreateReturn> = {
|
|
1159
|
+
execute: (options?: SystemAgentExecutionOptionsMap[T]) => Promise<AgentResult>;
|
|
1160
|
+
create: (options?: SystemAgentExecutionOptionsMap[T]) => TCreateReturn;
|
|
1161
|
+
};
|
|
1111
1162
|
|
|
1112
1163
|
type AudioServiceScope = {
|
|
1113
1164
|
/**
|
|
@@ -1134,210 +1185,53 @@ type AudioServiceScope = {
|
|
|
1134
1185
|
transcribe: (file: File, options?: TranscribeAudioOptions) => Promise<TranscribeAudioResult>;
|
|
1135
1186
|
};
|
|
1136
1187
|
|
|
1137
|
-
|
|
1138
|
-
|
|
1188
|
+
type FullAgents = {
|
|
1189
|
+
assistants: ConversationalAgentScope<"assistant">;
|
|
1190
|
+
copilots: ConversationalAgentScope<"copilot">;
|
|
1191
|
+
activities: SystemAgentScope<"activity", Activity>;
|
|
1192
|
+
chatCompletions: SystemAgentScope<"chat-completion", ChatCompletion>;
|
|
1193
|
+
proxies: SystemAgentScope<"proxy", Proxy>;
|
|
1194
|
+
};
|
|
1195
|
+
type FullServices = {
|
|
1196
|
+
audio: AudioServiceScope;
|
|
1197
|
+
};
|
|
1198
|
+
type ScopedAgents = {
|
|
1199
|
+
assistants: ScopedConversationalAgentScope<"assistant">;
|
|
1200
|
+
copilots: ScopedConversationalAgentScope<"copilot">;
|
|
1201
|
+
activities: ScopedSystemAgentScope<"activity", Activity>;
|
|
1202
|
+
chatCompletions: ScopedSystemAgentScope<"chat-completion", ChatCompletion>;
|
|
1203
|
+
proxies: ScopedSystemAgentScope<"proxy", Proxy>;
|
|
1204
|
+
};
|
|
1205
|
+
/** Full-access client returned when using API Key authentication */
|
|
1206
|
+
declare class FullSerenityClient {
|
|
1139
1207
|
private baseUrl;
|
|
1140
1208
|
/**
|
|
1141
1209
|
* Interact with the different agents available in Serenity Star.
|
|
1142
1210
|
* You can choose between assistants, copilots, activities, chat completions and proxies.
|
|
1143
1211
|
*/
|
|
1144
|
-
readonly agents:
|
|
1145
|
-
/**
|
|
1146
|
-
* Interact with Assistant agents available in Serenity Star.
|
|
1147
|
-
* This allows you to create conversations and real-time sessions.
|
|
1148
|
-
*
|
|
1149
|
-
* ## Start a new conversation and send a message:
|
|
1150
|
-
* ```typescript
|
|
1151
|
-
* // Regular text conversation
|
|
1152
|
-
* const conversation = await client.agents.assistants.createConversation("translator-assistant");
|
|
1153
|
-
* const response = await conversation.sendMessage("The sun was beginning to set...");
|
|
1154
|
-
* console.log(response.content);
|
|
1155
|
-
*
|
|
1156
|
-
* ```
|
|
1157
|
-
*
|
|
1158
|
-
* ## Stream message with SSE
|
|
1159
|
-
* ```typescript
|
|
1160
|
-
* const conversation = await client.agents.assistants
|
|
1161
|
-
* .createConversation("translator-assistant")
|
|
1162
|
-
* .on("start", () => console.log("Started"))
|
|
1163
|
-
* .on("content", (chunk) => console.log(chunk))
|
|
1164
|
-
* .on("error", (error) => console.error(error));
|
|
1165
|
-
*
|
|
1166
|
-
* await conversation.streamMessage("The sun was beginning to set...");
|
|
1167
|
-
*
|
|
1168
|
-
* ```
|
|
1169
|
-
*
|
|
1170
|
-
* ## Real-time voice conversation example:
|
|
1171
|
-
* ```typescript
|
|
1172
|
-
* const session = client.agents.assistants.createRealtimeSession("marketing-assistant")
|
|
1173
|
-
* .on("session.created", () => console.log("Session started"))
|
|
1174
|
-
* .on("speech.started", () => console.log("User started talking"))
|
|
1175
|
-
* .on("speech.stopped", () => console.log("User stopped talking"))
|
|
1176
|
-
* .on("response.done", (response) => console.log("Response:", response))
|
|
1177
|
-
* .on("session.stopped", () => console.log("Session stopped"));
|
|
1178
|
-
*
|
|
1179
|
-
* await session.start();
|
|
1180
|
-
* // Later: session.stop();
|
|
1181
|
-
* ```
|
|
1182
|
-
*/
|
|
1183
|
-
assistants: ConversationalAgentScope<"assistant">;
|
|
1184
|
-
/**
|
|
1185
|
-
* Interact with Copilot agents available in Serenity Star.
|
|
1186
|
-
* Similar to assistants but allows you to interact with the UI through callbacks.
|
|
1187
|
-
*
|
|
1188
|
-
* Text conversation example:
|
|
1189
|
-
* ```typescript
|
|
1190
|
-
* // Regular conversation
|
|
1191
|
-
* const conversation = await client.agents.copilots.createConversation("app-copilot");
|
|
1192
|
-
* const response = await conversation.sendMessage("How do I create a new support ticket?");
|
|
1193
|
-
* console.log(response.content);
|
|
1194
|
-
*
|
|
1195
|
-
* // Streaming conversation
|
|
1196
|
-
* const conversation = await client.agents.copilots
|
|
1197
|
-
* .createConversation("app-copilot")
|
|
1198
|
-
* .on("start", () => console.log("Started"))
|
|
1199
|
-
* .on("content", (chunk) => console.log(chunk))
|
|
1200
|
-
* .on("error", (error) => console.error(error));
|
|
1201
|
-
*
|
|
1202
|
-
* await conversation.streamMessage("How do I create a new support ticket?");
|
|
1203
|
-
* ```
|
|
1204
|
-
*/
|
|
1205
|
-
copilots: ConversationalAgentScope<"copilot">;
|
|
1206
|
-
/**
|
|
1207
|
-
* Interact with Activity agents available in Serenity Star.
|
|
1208
|
-
* This allows you to execute activities.
|
|
1209
|
-
* It supports streaming.
|
|
1210
|
-
* Execute simple tasks based on the user input.
|
|
1211
|
-
*
|
|
1212
|
-
* ## Regular activity execution:
|
|
1213
|
-
* ```typescript
|
|
1214
|
-
* const response = await client.agents.activities.execute("marketing-campaign")
|
|
1215
|
-
* console.log(response.content);
|
|
1216
|
-
*
|
|
1217
|
-
* // With parameters
|
|
1218
|
-
* const response = await client.agents.activities.execute("cooking-activity", {
|
|
1219
|
-
* inputParameters: {
|
|
1220
|
-
* ingredientOne: "chicken",
|
|
1221
|
-
* ingredientTwo: "onion",
|
|
1222
|
-
* ingredientThree: "cream",
|
|
1223
|
-
* }
|
|
1224
|
-
* });
|
|
1225
|
-
* ```
|
|
1226
|
-
*
|
|
1227
|
-
* ## Stream activity with SSE:
|
|
1228
|
-
* ```typescript
|
|
1229
|
-
* const activity = client.agents.activities
|
|
1230
|
-
* .create("marketing-campaign")
|
|
1231
|
-
* .on("start", () => console.log("Started"))
|
|
1232
|
-
* .on("content", (chunk) => console.log(chunk))
|
|
1233
|
-
* .on("error", (error) => console.error(error));
|
|
1234
|
-
*
|
|
1235
|
-
* await activity.stream();
|
|
1236
|
-
* ```
|
|
1237
|
-
*/
|
|
1238
|
-
activities: SystemAgentScope<"activity", Activity>;
|
|
1239
|
-
/**
|
|
1240
|
-
* Interact with Chat Completion agents available in Serenity Star.
|
|
1241
|
-
* This allows you to execute chat completions.
|
|
1242
|
-
* It supports streaming.
|
|
1243
|
-
* Chat completions allows you to fully control the conversation and generate completions.
|
|
1244
|
-
*
|
|
1245
|
-
* ## Regular chat completion:
|
|
1246
|
-
* ```typescript
|
|
1247
|
-
* const response = await client.agents.chatCompletions.execute("Health-Coach", {
|
|
1248
|
-
* message: "Hello!"
|
|
1249
|
-
* });
|
|
1250
|
-
* console.log(response.content);
|
|
1251
|
-
* ```
|
|
1252
|
-
*
|
|
1253
|
-
* ## Stream chat completion with SSE:
|
|
1254
|
-
* ```typescript
|
|
1255
|
-
* const chatCompletion = client.agents.chatCompletions
|
|
1256
|
-
* .create("Health-Coach", {
|
|
1257
|
-
* message: "Hello!"
|
|
1258
|
-
* })
|
|
1259
|
-
* .on("start", () => console.log("Started"))
|
|
1260
|
-
* .on("content", (chunk) => console.log(chunk))
|
|
1261
|
-
* .on("error", (error) => console.error(error));
|
|
1262
|
-
*
|
|
1263
|
-
* await chatCompletion.stream();
|
|
1264
|
-
* ```
|
|
1265
|
-
*/
|
|
1266
|
-
chatCompletions: SystemAgentScope<"chat-completion", ChatCompletion>;
|
|
1267
|
-
/**
|
|
1268
|
-
* Interact with Proxy agents available in Serenity Star.
|
|
1269
|
-
* This allows you to execute proxies.
|
|
1270
|
-
* It supports streaming.
|
|
1271
|
-
* Proxy agents allows you to define a set of parameters dynamically for each request
|
|
1272
|
-
*
|
|
1273
|
-
* ## Regular proxy execution:
|
|
1274
|
-
* ```typescript
|
|
1275
|
-
* const response = await client.agents.proxies.execute("proxy-agent", {
|
|
1276
|
-
* model: "gpt-4o-mini-2024-07-18",
|
|
1277
|
-
* messages: [
|
|
1278
|
-
* {
|
|
1279
|
-
* role: "system",
|
|
1280
|
-
* content: "You are a helpful assistant. Always use short and concise responses"
|
|
1281
|
-
* },
|
|
1282
|
-
* { role: "user", content: "What is artificial intelligence?" }
|
|
1283
|
-
* ],
|
|
1284
|
-
* temperature: 1,
|
|
1285
|
-
* max_tokens: 250
|
|
1286
|
-
* });
|
|
1287
|
-
* console.log(response.content);
|
|
1288
|
-
* ```
|
|
1289
|
-
*
|
|
1290
|
-
* ## Stream proxy with SSE:
|
|
1291
|
-
* ```typescript
|
|
1292
|
-
* const proxy = client.agents.proxies
|
|
1293
|
-
* .create("proxy-agent", {
|
|
1294
|
-
* model: "gpt-4o-mini-2024-07-18",
|
|
1295
|
-
* messages: [
|
|
1296
|
-
* {
|
|
1297
|
-
* role: "system",
|
|
1298
|
-
* content: "You are a helpful assistant. Always use short and concise responses"
|
|
1299
|
-
* },
|
|
1300
|
-
* { role: "user", content: "What is artificial intelligence?" }
|
|
1301
|
-
* ],
|
|
1302
|
-
* temperature: 1,
|
|
1303
|
-
* max_tokens: 250
|
|
1304
|
-
* })
|
|
1305
|
-
* .on("start", () => console.log("Started"))
|
|
1306
|
-
* .on("content", (chunk) => console.log(chunk))
|
|
1307
|
-
* .on("error", (error) => console.error(error));
|
|
1308
|
-
*
|
|
1309
|
-
* await proxy.stream();
|
|
1310
|
-
* ```
|
|
1311
|
-
*/
|
|
1312
|
-
proxies: SystemAgentScope<"proxy", Proxy>;
|
|
1313
|
-
};
|
|
1212
|
+
readonly agents: FullAgents;
|
|
1314
1213
|
/**
|
|
1315
1214
|
* Access various services provided by Serenity Star.
|
|
1316
1215
|
* Services include audio transcription and other utility features.
|
|
1317
1216
|
*/
|
|
1318
|
-
readonly services:
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
* console.log('Cost:', result.cost?.total, result.cost?.currency);
|
|
1335
|
-
* ```
|
|
1336
|
-
*/
|
|
1337
|
-
audio: AudioServiceScope;
|
|
1338
|
-
};
|
|
1339
|
-
constructor(options: SerenityClientOptions);
|
|
1217
|
+
readonly services: FullServices;
|
|
1218
|
+
constructor(options: ApiKeyClientOptions);
|
|
1219
|
+
}
|
|
1220
|
+
/** Agent-scoped client returned when using Agent Client Credentials authentication */
|
|
1221
|
+
declare class ScopedSerenityClient {
|
|
1222
|
+
private baseUrl;
|
|
1223
|
+
/**
|
|
1224
|
+
* Interact with the agent scoped to this client.
|
|
1225
|
+
* Operations do not require an agentCode parameter — it is baked in.
|
|
1226
|
+
*/
|
|
1227
|
+
readonly agents: ScopedAgents;
|
|
1228
|
+
constructor(options: AgentClientCredentialsOptions);
|
|
1229
|
+
}
|
|
1230
|
+
interface SerenityClientConstructor {
|
|
1231
|
+
new (options: ApiKeyClientOptions): FullSerenityClient;
|
|
1232
|
+
new (options: AgentClientCredentialsOptions): ScopedSerenityClient;
|
|
1340
1233
|
}
|
|
1234
|
+
declare const SerenityClient: SerenityClientConstructor;
|
|
1341
1235
|
|
|
1342
1236
|
declare class ExternalErrorHelper {
|
|
1343
1237
|
static determineErrorType(error: unknown): {
|
|
@@ -1349,4 +1243,4 @@ declare class ExternalErrorHelper {
|
|
|
1349
1243
|
private static isBaseErrorBody;
|
|
1350
1244
|
}
|
|
1351
1245
|
|
|
1352
|
-
export { type AgentResult, type BaseErrorBody, type ChatWidgetRes, type ConnectorStatusResult, Conversation, type ConversationInfoResult, type ConversationRes, ExternalErrorHelper as ErrorHelper, type FileError, type FileUploadRes, type GetConnectorStatusOptions, type Message, type PendingAction, type RateLimitErrorBody, RealtimeSession, type RemoveFeedbackOptions, type RemoveFeedbackResult, SerenityClient, type SubmitFeedbackOptions, type SubmitFeedbackResult, type TranscribeAudioOptions, type TranscribeAudioResult, type ValidationErrorBody, VolatileKnowledgeManager, type VolatileKnowledgeUploadOptions, type VolatileKnowledgeUploadRes };
|
|
1246
|
+
export { type AgentClientCredentials, type AgentResult, type AttachedVolatileKnowledgeRes, type AuthProvider, type BaseErrorBody, type ChatWidgetRes, type ConnectorStatusResult, Conversation, type ConversationInfoResult, type ConversationRes, ExternalErrorHelper as ErrorHelper, type FileError, type FileUploadRes, type FullAgents, FullSerenityClient, type FullServices, type GetConnectorStatusOptions, type Message, type PendingAction, type RateLimitErrorBody, RealtimeSession, type RemoveFeedbackOptions, type RemoveFeedbackResult, type ScopedAgents, ScopedSerenityClient, SerenityClient, type SubmitFeedbackOptions, type SubmitFeedbackResult, type TokenProviderContext, type TokenProviderFn, type TranscribeAudioOptions, type TranscribeAudioResult, type ValidationErrorBody, VolatileKnowledgeManager, type VolatileKnowledgeUploadOptions, type VolatileKnowledgeUploadRes };
|