@serenity-star/sdk 1.0.2 → 2.0.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 +313 -85
- package/dist/index.d.ts +313 -85
- 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 +75 -75
package/dist/index.d.mts
CHANGED
|
@@ -76,9 +76,9 @@ type SerenityClientOptions = {
|
|
|
76
76
|
baseUrl?: string;
|
|
77
77
|
};
|
|
78
78
|
/**
|
|
79
|
-
* Base options for
|
|
80
|
-
|
|
81
|
-
type
|
|
79
|
+
* Base options for setting up an agent.
|
|
80
|
+
*/
|
|
81
|
+
type AgentSetupOptions = {
|
|
82
82
|
/**
|
|
83
83
|
* Optional identifier for the user initiating the execution.
|
|
84
84
|
*/
|
|
@@ -92,20 +92,20 @@ type AgentExecutionOptions = {
|
|
|
92
92
|
*/
|
|
93
93
|
channel?: string;
|
|
94
94
|
/**
|
|
95
|
-
* Optional
|
|
95
|
+
* Optional key-value pairs of input parameters specific to the agent.
|
|
96
96
|
*/
|
|
97
|
-
|
|
97
|
+
inputParameters?: {
|
|
98
|
+
[key: string]: any;
|
|
99
|
+
};
|
|
98
100
|
};
|
|
99
101
|
/**
|
|
100
|
-
*
|
|
102
|
+
* Base options for executing any type of agent.
|
|
101
103
|
*/
|
|
102
|
-
type
|
|
104
|
+
type AgentExecutionOptions = AgentSetupOptions & {
|
|
103
105
|
/**
|
|
104
|
-
* Optional
|
|
106
|
+
* Optional array of volatile knowledge IDs to include in the execution context.
|
|
105
107
|
*/
|
|
106
|
-
|
|
107
|
-
[key: string]: any;
|
|
108
|
-
};
|
|
108
|
+
volatileKnowledgeIds?: string[];
|
|
109
109
|
};
|
|
110
110
|
/**
|
|
111
111
|
* Maps agent types to their specific execution options for conversational agents.
|
|
@@ -114,8 +114,8 @@ type AgentExecutionOptionsWithParameters = AgentExecutionOptions & {
|
|
|
114
114
|
* Both assistant and copilot agents support input parameters in addition to base execution options.
|
|
115
115
|
*/
|
|
116
116
|
type ConversationalAgentExecutionOptionsMap = {
|
|
117
|
-
"assistant":
|
|
118
|
-
"copilot":
|
|
117
|
+
"assistant": AgentSetupOptions;
|
|
118
|
+
"copilot": AgentSetupOptions;
|
|
119
119
|
};
|
|
120
120
|
/**
|
|
121
121
|
* Maps agent types to their specific execution options for system agents.
|
|
@@ -125,9 +125,8 @@ type ConversationalAgentExecutionOptionsMap = {
|
|
|
125
125
|
* - Proxy agents have specific proxy execution options
|
|
126
126
|
*/
|
|
127
127
|
type SystemAgentExecutionOptionsMap = {
|
|
128
|
-
"activity":
|
|
129
|
-
"
|
|
130
|
-
"chat-completion": AgentExecutionOptionsWithParameters & {
|
|
128
|
+
"activity": AgentExecutionOptions;
|
|
129
|
+
"chat-completion": AgentExecutionOptions & {
|
|
131
130
|
/** The single message content for the chat completion */
|
|
132
131
|
message: string;
|
|
133
132
|
/** Optional array of message objects representing the conversation history */
|
|
@@ -142,12 +141,12 @@ type AgentResult = {
|
|
|
142
141
|
content: string;
|
|
143
142
|
instance_id: string;
|
|
144
143
|
json_content?: any;
|
|
145
|
-
meta_analysis?: MetaAnalysisRes;
|
|
146
|
-
completion_usage?: CompletionUsageRes;
|
|
144
|
+
meta_analysis?: MetaAnalysisRes$1;
|
|
145
|
+
completion_usage?: CompletionUsageRes$1;
|
|
147
146
|
time_to_first_token?: number;
|
|
148
|
-
executor_task_logs?: ExecutorTaskLogsRes;
|
|
147
|
+
executor_task_logs?: ExecutorTaskLogsRes$1;
|
|
149
148
|
action_results?: {
|
|
150
|
-
[key: string]: PluginExecutionResult;
|
|
149
|
+
[key: string]: PluginExecutionResult$1;
|
|
151
150
|
};
|
|
152
151
|
};
|
|
153
152
|
/**
|
|
@@ -210,7 +209,7 @@ type ExecuteBodyParams = Array<{
|
|
|
210
209
|
Key: string;
|
|
211
210
|
Value: any;
|
|
212
211
|
}>;
|
|
213
|
-
type MetaAnalysisRes = {
|
|
212
|
+
type MetaAnalysisRes$1 = {
|
|
214
213
|
[key: string]: any;
|
|
215
214
|
} & {
|
|
216
215
|
policy_compliance?: {
|
|
@@ -258,23 +257,295 @@ type MetaAnalysisRes = {
|
|
|
258
257
|
topic_area?: string;
|
|
259
258
|
};
|
|
260
259
|
};
|
|
261
|
-
type CompletionUsageRes = {
|
|
260
|
+
type CompletionUsageRes$1 = {
|
|
262
261
|
completion_tokens: number;
|
|
263
262
|
prompt_tokens: number;
|
|
264
263
|
total_tokens: number;
|
|
265
264
|
};
|
|
266
|
-
type ExecutorTaskLogsRes = {
|
|
265
|
+
type ExecutorTaskLogsRes$1 = {
|
|
267
266
|
description: string;
|
|
268
267
|
duration: number;
|
|
269
268
|
}[];
|
|
270
|
-
type SpeechGenerationResult = {
|
|
269
|
+
type SpeechGenerationResult$1 = {
|
|
271
270
|
content: string;
|
|
272
271
|
finish_reason?: string;
|
|
273
272
|
usage?: {
|
|
274
273
|
[key: string]: any;
|
|
275
274
|
};
|
|
276
275
|
};
|
|
276
|
+
type PluginExecutionResult$1 = SpeechGenerationResult$1;
|
|
277
|
+
type BaseErrorBody = {
|
|
278
|
+
message: string;
|
|
279
|
+
statusCode: number;
|
|
280
|
+
};
|
|
281
|
+
type ValidationErrorBody = BaseErrorBody & {
|
|
282
|
+
errors: {
|
|
283
|
+
[key: string]: string;
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
type RateLimitErrorBody = BaseErrorBody & {
|
|
287
|
+
retryAfter: number;
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
type MessageAdditionalInfo = {
|
|
291
|
+
inputParameters?: {
|
|
292
|
+
[key: string]: any;
|
|
293
|
+
};
|
|
294
|
+
volatileKnowledgeIds?: string[];
|
|
295
|
+
};
|
|
296
|
+
type ConversationInfoResult = {
|
|
297
|
+
agent: {
|
|
298
|
+
isRealtime: boolean;
|
|
299
|
+
version: number;
|
|
300
|
+
visionEnabled: boolean;
|
|
301
|
+
imageId: string;
|
|
302
|
+
};
|
|
303
|
+
conversation: {
|
|
304
|
+
initialMessage: string;
|
|
305
|
+
starters: string[];
|
|
306
|
+
};
|
|
307
|
+
channel?: ChatWidgetRes;
|
|
308
|
+
};
|
|
309
|
+
type ChatWidgetRes = {
|
|
310
|
+
expanded: boolean;
|
|
311
|
+
opened: boolean;
|
|
312
|
+
showExpandButton: boolean;
|
|
313
|
+
allowUpload: boolean;
|
|
314
|
+
allowAudioRecording: boolean;
|
|
315
|
+
storeConversation: boolean;
|
|
316
|
+
stream: boolean;
|
|
317
|
+
extractPageContent: boolean;
|
|
318
|
+
showSystemLogo: boolean;
|
|
319
|
+
userIdentifier: string;
|
|
320
|
+
logoURL: string;
|
|
321
|
+
mode: string;
|
|
322
|
+
engagementMessage: EngagementMessageRes;
|
|
323
|
+
locale: LocaleRes;
|
|
324
|
+
theme: ThemeRes;
|
|
325
|
+
};
|
|
326
|
+
type EngagementMessageRes = {
|
|
327
|
+
enabled: boolean;
|
|
328
|
+
message: string;
|
|
329
|
+
showAfter: number;
|
|
330
|
+
};
|
|
331
|
+
type LocaleRes = {
|
|
332
|
+
uploadFileErrorMessage: string;
|
|
333
|
+
uploadFilesErrorMessage: string;
|
|
334
|
+
chatErrorMessage: string;
|
|
335
|
+
chatInitConversationErrorMessage: string;
|
|
336
|
+
headerTitle: string;
|
|
337
|
+
finalizedMessage: string;
|
|
338
|
+
limitExceededMessage: string;
|
|
339
|
+
waitUntilMessage: string;
|
|
340
|
+
remainingMessage: string;
|
|
341
|
+
inputPlaceholder: string;
|
|
342
|
+
internalLinkMessage: string;
|
|
343
|
+
newChatBtnMessage: string;
|
|
344
|
+
exceededMaxNumberOfFilesMessage: string;
|
|
345
|
+
exceededMaxFileStatusChecksMessage: string;
|
|
346
|
+
closedConversationMessage: string;
|
|
347
|
+
};
|
|
348
|
+
type ThemeRes = {
|
|
349
|
+
header: HeaderThemeRes;
|
|
350
|
+
fabButton: FabButtonThemeRes;
|
|
351
|
+
sendButton: SendButtonThemeRes;
|
|
352
|
+
engagementMessage: EngagementMessageThemeRes;
|
|
353
|
+
conversationStarters: ConversationStartersThemeRes;
|
|
354
|
+
scrollToBottomIndicator: ScrollToBottomIndicatorThemeRes;
|
|
355
|
+
uploadFileBtn: UploadFileBtnThemeRes;
|
|
356
|
+
messageBubble: MessageBubbleThemeRes;
|
|
357
|
+
};
|
|
358
|
+
type HeaderThemeRes = {
|
|
359
|
+
bgColor: string;
|
|
360
|
+
textColor: string;
|
|
361
|
+
resetChatBtn: ResetChatBtnThemeRes;
|
|
362
|
+
minimizeBtn: MinimizeBtnThemeRes;
|
|
363
|
+
};
|
|
364
|
+
type FabButtonThemeRes = {
|
|
365
|
+
bgColor: string;
|
|
366
|
+
iconStrokeColor: string;
|
|
367
|
+
buttonSize: number;
|
|
368
|
+
iconSize: number;
|
|
369
|
+
};
|
|
370
|
+
type SendButtonThemeRes = {
|
|
371
|
+
bgColor: string;
|
|
372
|
+
iconStrokeColor: string;
|
|
373
|
+
};
|
|
374
|
+
type EngagementMessageThemeRes = {
|
|
375
|
+
bgColor: string;
|
|
376
|
+
textColor: string;
|
|
377
|
+
};
|
|
378
|
+
type ConversationStartersThemeRes = {
|
|
379
|
+
bgColor: string;
|
|
380
|
+
textColor: string;
|
|
381
|
+
containerBgColor: string;
|
|
382
|
+
initialMessageBgColor: string;
|
|
383
|
+
initialMessageTextColor: string;
|
|
384
|
+
};
|
|
385
|
+
type ScrollToBottomIndicatorThemeRes = {
|
|
386
|
+
bgColor: string;
|
|
387
|
+
iconStrokeColor: string;
|
|
388
|
+
};
|
|
389
|
+
type UploadFileBtnThemeRes = {
|
|
390
|
+
iconStrokeColor: string;
|
|
391
|
+
};
|
|
392
|
+
type MessageBubbleThemeRes = {
|
|
393
|
+
user: UserThemeRes;
|
|
394
|
+
assistant: AssistantThemeRes;
|
|
395
|
+
};
|
|
396
|
+
type ResetChatBtnThemeRes = {
|
|
397
|
+
bgColor: string;
|
|
398
|
+
hoverBgColor: string;
|
|
399
|
+
textColor: string;
|
|
400
|
+
};
|
|
401
|
+
type MinimizeBtnThemeRes = {
|
|
402
|
+
iconStrokeColor: string;
|
|
403
|
+
};
|
|
404
|
+
type UserThemeRes = {
|
|
405
|
+
bgColor: string;
|
|
406
|
+
textColor: string;
|
|
407
|
+
};
|
|
408
|
+
type AssistantThemeRes = {
|
|
409
|
+
bgColor: string;
|
|
410
|
+
textColor: string;
|
|
411
|
+
};
|
|
412
|
+
type ConversationRes = {
|
|
413
|
+
startDate: string;
|
|
414
|
+
endDate: string;
|
|
415
|
+
id: string;
|
|
416
|
+
messages: Message[];
|
|
417
|
+
name: string;
|
|
418
|
+
userIdentifier?: string;
|
|
419
|
+
useVision?: boolean;
|
|
420
|
+
conversationStarters?: string[];
|
|
421
|
+
open?: boolean;
|
|
422
|
+
};
|
|
423
|
+
type Message = ({
|
|
424
|
+
sender: "user";
|
|
425
|
+
} | {
|
|
426
|
+
sender: "bot";
|
|
427
|
+
conversationStarters?: string[];
|
|
428
|
+
}) & {
|
|
429
|
+
created_at: Date;
|
|
430
|
+
type: "text" | "image" | "error" | "info";
|
|
431
|
+
value: string;
|
|
432
|
+
attachments?: VolatileKnowledgeUploadRes[] | AttachedVolatileKnowledge[];
|
|
433
|
+
meta_analysis?: MetaAnalysisRes;
|
|
434
|
+
completion_usage?: CompletionUsageRes;
|
|
435
|
+
time_to_first_token?: number;
|
|
436
|
+
executor_task_logs?: ExecutorTaskLogsRes;
|
|
437
|
+
attached_volatile_knowledges?: AttachedVolatileKnowledge[];
|
|
438
|
+
action_results?: {
|
|
439
|
+
[key: string]: PluginExecutionResult;
|
|
440
|
+
};
|
|
441
|
+
};
|
|
277
442
|
type PluginExecutionResult = SpeechGenerationResult;
|
|
443
|
+
type SpeechGenerationResult = {
|
|
444
|
+
content: string;
|
|
445
|
+
finish_reason?: string;
|
|
446
|
+
usage?: object;
|
|
447
|
+
};
|
|
448
|
+
type VolatileKnowledgeUploadRes = {
|
|
449
|
+
id: string;
|
|
450
|
+
expirationDate: string;
|
|
451
|
+
status: string;
|
|
452
|
+
fileName: string;
|
|
453
|
+
fileSize: number;
|
|
454
|
+
};
|
|
455
|
+
type AttachedVolatileKnowledge = {
|
|
456
|
+
id: string;
|
|
457
|
+
expirationDate: string;
|
|
458
|
+
fileId: string;
|
|
459
|
+
fileName: string;
|
|
460
|
+
fileSize: number;
|
|
461
|
+
downloadUrl: string;
|
|
462
|
+
};
|
|
463
|
+
type CompletionUsageRes = {
|
|
464
|
+
completion_tokens: number;
|
|
465
|
+
prompt_tokens: number;
|
|
466
|
+
total_tokens: number;
|
|
467
|
+
};
|
|
468
|
+
type ExecutorTaskLogsRes = {
|
|
469
|
+
description: string;
|
|
470
|
+
duration: number;
|
|
471
|
+
}[];
|
|
472
|
+
type MetaAnalysisRes = {
|
|
473
|
+
[key: string]: any;
|
|
474
|
+
} & {
|
|
475
|
+
policy_compliance?: {
|
|
476
|
+
compliance_score?: number;
|
|
477
|
+
explanation?: string;
|
|
478
|
+
policy_violations?: {
|
|
479
|
+
source_id?: string;
|
|
480
|
+
source_document_name: string;
|
|
481
|
+
chunk_id?: string;
|
|
482
|
+
section_number?: string;
|
|
483
|
+
section?: string;
|
|
484
|
+
policy?: string;
|
|
485
|
+
policy_name: string;
|
|
486
|
+
policy_id?: string;
|
|
487
|
+
}[];
|
|
488
|
+
};
|
|
489
|
+
pii_release_risk?: {
|
|
490
|
+
risk_score?: number;
|
|
491
|
+
explanation?: string;
|
|
492
|
+
};
|
|
493
|
+
ethics?: {
|
|
494
|
+
score?: number;
|
|
495
|
+
explanation?: string;
|
|
496
|
+
avoid_topics?: {
|
|
497
|
+
topic: string;
|
|
498
|
+
reason: string;
|
|
499
|
+
}[];
|
|
500
|
+
};
|
|
501
|
+
deception_estimation?: {
|
|
502
|
+
deception_score?: number;
|
|
503
|
+
explanation?: string;
|
|
504
|
+
};
|
|
505
|
+
cybersecurity_threat?: {
|
|
506
|
+
threat_assessment?: number;
|
|
507
|
+
explanation?: string;
|
|
508
|
+
};
|
|
509
|
+
social_content_risk?: {
|
|
510
|
+
risk_score?: number;
|
|
511
|
+
explanation?: string;
|
|
512
|
+
};
|
|
513
|
+
conversation_analysis?: {
|
|
514
|
+
emotion_value_estimate?: number;
|
|
515
|
+
predicted_next_goal?: string;
|
|
516
|
+
attended_to_features?: string[];
|
|
517
|
+
topic_area?: string;
|
|
518
|
+
};
|
|
519
|
+
guardrails_compliance?: {
|
|
520
|
+
explanation?: string;
|
|
521
|
+
investment_score?: number;
|
|
522
|
+
legal_score?: number;
|
|
523
|
+
medical_score?: number;
|
|
524
|
+
tax_score?: number;
|
|
525
|
+
};
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
declare class Conversation extends EventEmitter<SSEStreamEvents> {
|
|
529
|
+
#private;
|
|
530
|
+
private agentCode;
|
|
531
|
+
private apiKey;
|
|
532
|
+
private baseUrl;
|
|
533
|
+
private userIdentifier?;
|
|
534
|
+
private agentVersion?;
|
|
535
|
+
private channel?;
|
|
536
|
+
private inputParameters?;
|
|
537
|
+
conversationId?: string;
|
|
538
|
+
info: ConversationInfoResult | null;
|
|
539
|
+
private constructor();
|
|
540
|
+
private static create;
|
|
541
|
+
private static createWithoutInfo;
|
|
542
|
+
streamMessage(message: string, options?: MessageAdditionalInfo): Promise<AgentResult>;
|
|
543
|
+
sendMessage(message: string, options?: MessageAdditionalInfo): Promise<AgentResult>;
|
|
544
|
+
getConversationById(id: string, options?: {
|
|
545
|
+
showExecutorTaskLogs: boolean;
|
|
546
|
+
}): Promise<ConversationRes>;
|
|
547
|
+
getInfo(): Promise<ConversationInfoResult>;
|
|
548
|
+
}
|
|
278
549
|
|
|
279
550
|
/**
|
|
280
551
|
* Events that can be emitted by a realtime session.
|
|
@@ -351,7 +622,7 @@ declare class RealtimeSession extends EventEmitter<RealtimeSessionEvents> {
|
|
|
351
622
|
private localStream?;
|
|
352
623
|
private dataChannel?;
|
|
353
624
|
private socket?;
|
|
354
|
-
constructor(agentCode: string, apiKey: string, baseUrl: string, options?:
|
|
625
|
+
constructor(agentCode: string, apiKey: string, baseUrl: string, options?: AgentSetupOptions);
|
|
355
626
|
/**
|
|
356
627
|
* Starts the real-time session.
|
|
357
628
|
*/
|
|
@@ -370,29 +641,6 @@ declare class RealtimeSession extends EventEmitter<RealtimeSessionEvents> {
|
|
|
370
641
|
unmuteMicrophone(): void;
|
|
371
642
|
}
|
|
372
643
|
|
|
373
|
-
type MessageOptions = {
|
|
374
|
-
inputParameters?: {
|
|
375
|
-
[key: string]: any;
|
|
376
|
-
};
|
|
377
|
-
volatileKnowledgeIds?: string[];
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
declare class Conversation extends EventEmitter<SSEStreamEvents> {
|
|
381
|
-
#private;
|
|
382
|
-
private agentCode;
|
|
383
|
-
private apiKey;
|
|
384
|
-
private baseUrl;
|
|
385
|
-
private inputParameters?;
|
|
386
|
-
private userIdentifier?;
|
|
387
|
-
private agentVersion?;
|
|
388
|
-
private channel?;
|
|
389
|
-
conversationId?: string;
|
|
390
|
-
private constructor();
|
|
391
|
-
private static create;
|
|
392
|
-
streamMessage(message: string, options?: MessageOptions): Promise<AgentResult>;
|
|
393
|
-
sendMessage(message: string, options?: MessageOptions): Promise<AgentResult>;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
644
|
declare abstract class SystemAgent<T extends keyof SystemAgentExecutionOptionsMap> extends EventEmitter<SSEStreamEvents> {
|
|
397
645
|
protected readonly agentCode: string;
|
|
398
646
|
protected readonly apiKey: string;
|
|
@@ -431,16 +679,6 @@ declare class ChatCompletion extends SystemAgent<"chat-completion"> {
|
|
|
431
679
|
private appendInputParametersIfNeeded;
|
|
432
680
|
}
|
|
433
681
|
|
|
434
|
-
declare class Plan extends SystemAgent<"plan"> {
|
|
435
|
-
private constructor();
|
|
436
|
-
static create(agentCode: string, apiKey: string, baseUrl: string, options?: SystemAgentExecutionOptionsMap["plan"]): Plan;
|
|
437
|
-
static createAndExecute(agentCode: string, apiKey: string, baseUrl: string, options?: SystemAgentExecutionOptionsMap["plan"]): Promise<AgentResult>;
|
|
438
|
-
protected createExecuteBody(stream: boolean): ExecuteBodyParams | {
|
|
439
|
-
[key: string]: any;
|
|
440
|
-
};
|
|
441
|
-
private appendInputParametersIfNeeded;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
682
|
declare class Proxy extends SystemAgent<"proxy"> {
|
|
445
683
|
private constructor();
|
|
446
684
|
static create(agentCode: string, apiKey: string, baseUrl: string, options?: SystemAgentExecutionOptionsMap["proxy"]): Proxy;
|
|
@@ -477,7 +715,7 @@ type ConversationalAgentScope<T extends keyof ConversationalAgentExecutionOption
|
|
|
477
715
|
* @param options - Additional options for the conversation
|
|
478
716
|
* @returns A Promise that resolves to a Conversation instance
|
|
479
717
|
*/
|
|
480
|
-
createConversation: (agentCode: string, options?:
|
|
718
|
+
createConversation: (agentCode: string, options?: AgentSetupOptions) => Promise<Conversation>;
|
|
481
719
|
/**
|
|
482
720
|
* Create a real-time session with an agent.
|
|
483
721
|
* This allows for voice interactions and real-time responses.
|
|
@@ -501,6 +739,10 @@ type ConversationalAgentScope<T extends keyof ConversationalAgentExecutionOption
|
|
|
501
739
|
* @returns A RealtimeSession instance
|
|
502
740
|
*/
|
|
503
741
|
createRealtimeSession: (agentCode: string, options?: ConversationalAgentExecutionOptionsMap[T]) => RealtimeSession;
|
|
742
|
+
getInfoByCode: (agentCode: string, options?: AgentSetupOptions) => Promise<ConversationInfoResult> | null;
|
|
743
|
+
getConversationById: (agentCode: string, conversationId: string, options?: {
|
|
744
|
+
showExecutorTaskLogs: boolean;
|
|
745
|
+
}) => Promise<ConversationRes>;
|
|
504
746
|
};
|
|
505
747
|
type SystemAgentScope<T extends keyof SystemAgentExecutionOptionsMap, TCreateReturn> = {
|
|
506
748
|
/**
|
|
@@ -555,7 +797,7 @@ declare class SerenityClient {
|
|
|
555
797
|
private baseUrl;
|
|
556
798
|
/**
|
|
557
799
|
* Interact with the different agents available in Serenity Star.
|
|
558
|
-
* You can choose between assistants, copilots, activities, chat completions
|
|
800
|
+
* You can choose between assistants, copilots, activities, chat completions and proxies.
|
|
559
801
|
*/
|
|
560
802
|
readonly agents: {
|
|
561
803
|
/**
|
|
@@ -726,32 +968,18 @@ declare class SerenityClient {
|
|
|
726
968
|
* ```
|
|
727
969
|
*/
|
|
728
970
|
proxies: SystemAgentScope<"proxy", Proxy>;
|
|
729
|
-
/**
|
|
730
|
-
* Interact with Plan agents available in Serenity Star.
|
|
731
|
-
* This allows you to execute plans.
|
|
732
|
-
* It supports streaming.
|
|
733
|
-
* Plan agents are capable of building an execution plan based on the user input and execute it.
|
|
734
|
-
*
|
|
735
|
-
* ## Regular plan execution:
|
|
736
|
-
* ```typescript
|
|
737
|
-
* const response = await client.agents.plans.execute("event-planner");
|
|
738
|
-
* console.log(response.content);
|
|
739
|
-
* ```
|
|
740
|
-
*
|
|
741
|
-
* ## Stream plan with SSE:
|
|
742
|
-
* ```typescript
|
|
743
|
-
* const plan = client.agents.plans
|
|
744
|
-
* .create("event-planner")
|
|
745
|
-
* .on("start", () => console.log("Started"))
|
|
746
|
-
* .on("content", (chunk) => console.log(chunk))
|
|
747
|
-
* .on("error", (error) => console.error(error));
|
|
748
|
-
*
|
|
749
|
-
* await plan.stream();
|
|
750
|
-
* ```
|
|
751
|
-
*/
|
|
752
|
-
plans: SystemAgentScope<"plan", Plan>;
|
|
753
971
|
};
|
|
754
972
|
constructor(options: SerenityClientOptions);
|
|
755
973
|
}
|
|
756
974
|
|
|
757
|
-
|
|
975
|
+
declare class ExternalErrorHelper {
|
|
976
|
+
static determineErrorType(error: unknown): {
|
|
977
|
+
type: "RateLimitError" | "ValidationError" | "BaseError" | "UnknownError";
|
|
978
|
+
error: RateLimitErrorBody | ValidationErrorBody | BaseErrorBody | unknown;
|
|
979
|
+
};
|
|
980
|
+
private static isRateLimitErrorBody;
|
|
981
|
+
private static isValidationErrorBody;
|
|
982
|
+
private static isBaseErrorBody;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
export { type AgentResult, type BaseErrorBody, type ChatWidgetRes, Conversation, type ConversationInfoResult, type ConversationRes, ExternalErrorHelper as ErrorHelper, type Message, type RateLimitErrorBody, RealtimeSession, SerenityClient, type ValidationErrorBody };
|