@voltagent/core 0.1.20 → 0.1.22
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.ts +419 -328
- package/dist/index.js +2079 -1309
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2076 -1306
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,171 @@ import { SpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
|
4
4
|
import { ClientCapabilities } from '@modelcontextprotocol/sdk/types.js';
|
|
5
5
|
import { EventEmitter } from 'node:events';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Memory options
|
|
9
|
+
*/
|
|
10
|
+
type MemoryOptions = {
|
|
11
|
+
/**
|
|
12
|
+
* Maximum number of messages to store in the database
|
|
13
|
+
* @default 100
|
|
14
|
+
*/
|
|
15
|
+
storageLimit?: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Options for filtering messages when retrieving from memory
|
|
19
|
+
*/
|
|
20
|
+
type MessageFilterOptions = {
|
|
21
|
+
/**
|
|
22
|
+
* User identifier
|
|
23
|
+
*/
|
|
24
|
+
userId?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Conversation identifier
|
|
27
|
+
*/
|
|
28
|
+
conversationId?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Maximum number of messages to retrieve
|
|
31
|
+
*/
|
|
32
|
+
limit?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Only retrieve messages before this timestamp
|
|
35
|
+
*/
|
|
36
|
+
before?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Only retrieve messages after this timestamp
|
|
39
|
+
*/
|
|
40
|
+
after?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Only retrieve messages with this role
|
|
43
|
+
*/
|
|
44
|
+
role?: BaseMessage["role"];
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Conversation type
|
|
48
|
+
*/
|
|
49
|
+
type Conversation = {
|
|
50
|
+
id: string;
|
|
51
|
+
resourceId: string;
|
|
52
|
+
title: string;
|
|
53
|
+
metadata: Record<string, unknown>;
|
|
54
|
+
createdAt: string;
|
|
55
|
+
updatedAt: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Input type for creating a conversation
|
|
59
|
+
*/
|
|
60
|
+
type CreateConversationInput = {
|
|
61
|
+
id: string;
|
|
62
|
+
resourceId: string;
|
|
63
|
+
title: string;
|
|
64
|
+
metadata: Record<string, unknown>;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Memory interface for storing and retrieving messages
|
|
68
|
+
*/
|
|
69
|
+
type Memory = {
|
|
70
|
+
/**
|
|
71
|
+
* Add a message to memory
|
|
72
|
+
*/
|
|
73
|
+
addMessage(message: BaseMessage, userId: string, conversationId?: string): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Get messages from memory
|
|
76
|
+
*/
|
|
77
|
+
getMessages(options: MessageFilterOptions): Promise<BaseMessage[]>;
|
|
78
|
+
/**
|
|
79
|
+
* Clear messages from memory
|
|
80
|
+
*/
|
|
81
|
+
clearMessages(options: {
|
|
82
|
+
userId: string;
|
|
83
|
+
conversationId?: string;
|
|
84
|
+
}): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Create a new conversation
|
|
87
|
+
*/
|
|
88
|
+
createConversation(conversation: CreateConversationInput): Promise<Conversation>;
|
|
89
|
+
/**
|
|
90
|
+
* Get a conversation by ID
|
|
91
|
+
*/
|
|
92
|
+
getConversation(id: string): Promise<Conversation | null>;
|
|
93
|
+
/**
|
|
94
|
+
* Get conversations for a resource
|
|
95
|
+
*/
|
|
96
|
+
getConversations(resourceId: string): Promise<Conversation[]>;
|
|
97
|
+
/**
|
|
98
|
+
* Update a conversation
|
|
99
|
+
*/
|
|
100
|
+
updateConversation(id: string, updates: Partial<Omit<Conversation, "id" | "createdAt" | "updatedAt">>): Promise<Conversation>;
|
|
101
|
+
/**
|
|
102
|
+
* Delete a conversation
|
|
103
|
+
*/
|
|
104
|
+
deleteConversation(id: string): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* Add or update a history entry
|
|
107
|
+
* @param key Entry ID
|
|
108
|
+
* @param value Entry data
|
|
109
|
+
* @param agentId Agent ID for filtering
|
|
110
|
+
*/
|
|
111
|
+
addHistoryEntry(key: string, value: any, agentId: string): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Update an existing history entry
|
|
114
|
+
* @param key Entry ID
|
|
115
|
+
* @param value Updated entry data
|
|
116
|
+
* @param agentId Agent ID for filtering
|
|
117
|
+
*/
|
|
118
|
+
updateHistoryEntry(key: string, value: any, agentId: string): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Add a history step
|
|
121
|
+
* @param key Step ID
|
|
122
|
+
* @param value Step data
|
|
123
|
+
* @param historyId Related history entry ID
|
|
124
|
+
* @param agentId Agent ID for filtering
|
|
125
|
+
*/
|
|
126
|
+
addHistoryStep(key: string, value: any, historyId: string, agentId: string): Promise<void>;
|
|
127
|
+
/**
|
|
128
|
+
* Update a history step
|
|
129
|
+
* @param key Step ID
|
|
130
|
+
* @param value Updated step data
|
|
131
|
+
* @param historyId Related history entry ID
|
|
132
|
+
* @param agentId Agent ID for filtering
|
|
133
|
+
*/
|
|
134
|
+
updateHistoryStep(key: string, value: any, historyId: string, agentId: string): Promise<void>;
|
|
135
|
+
/**
|
|
136
|
+
* Get a history entry by ID
|
|
137
|
+
* @param key Entry ID
|
|
138
|
+
* @returns The history entry or undefined if not found
|
|
139
|
+
*/
|
|
140
|
+
getHistoryEntry(key: string): Promise<any | undefined>;
|
|
141
|
+
/**
|
|
142
|
+
* Get a history step by ID
|
|
143
|
+
* @param key Step ID
|
|
144
|
+
* @returns The history step or undefined if not found
|
|
145
|
+
*/
|
|
146
|
+
getHistoryStep(key: string): Promise<any | undefined>;
|
|
147
|
+
/**
|
|
148
|
+
* Get all history entries for an agent
|
|
149
|
+
* @param agentId Agent ID
|
|
150
|
+
* @returns Array of all history entries for the agent
|
|
151
|
+
*/
|
|
152
|
+
getAllHistoryEntriesByAgent(agentId: string): Promise<any[]>;
|
|
153
|
+
/**
|
|
154
|
+
* Add a timeline event
|
|
155
|
+
* This is part of the new immutable event system.
|
|
156
|
+
* @param key Event ID (UUID)
|
|
157
|
+
* @param value Timeline event data with immutable structure
|
|
158
|
+
* @param historyId Related history entry ID
|
|
159
|
+
* @param agentId Agent ID for filtering
|
|
160
|
+
*/
|
|
161
|
+
addTimelineEvent(key: string, value: NewTimelineEvent, historyId: string, agentId: string): Promise<void>;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Memory-specific message type
|
|
165
|
+
*/
|
|
166
|
+
type MemoryMessage = BaseMessage & {
|
|
167
|
+
id: string;
|
|
168
|
+
type: "text" | "tool-call" | "tool-result";
|
|
169
|
+
createdAt: string;
|
|
170
|
+
};
|
|
171
|
+
|
|
7
172
|
/**
|
|
8
173
|
* Represents a collection of related tools with optional shared instructions.
|
|
9
174
|
*/
|
|
@@ -214,52 +379,36 @@ declare const createTool: <T extends ToolSchema>(options: ToolOptions<T>) => Too
|
|
|
214
379
|
*/
|
|
215
380
|
declare const tool: <T extends ToolSchema>(options: ToolOptions<T>) => Tool<T>;
|
|
216
381
|
|
|
217
|
-
type EventStatus = AgentStatus;
|
|
218
|
-
type TimelineEventType = "memory" | "tool" | "agent" | "retriever";
|
|
219
|
-
/**
|
|
220
|
-
* Types for tracked event functionality
|
|
221
|
-
*/
|
|
222
|
-
type EventUpdater = (updateOptions: {
|
|
223
|
-
status?: AgentStatus;
|
|
224
|
-
data?: Record<string, any>;
|
|
225
|
-
}) => Promise<AgentHistoryEntry | undefined>;
|
|
226
|
-
|
|
227
382
|
interface ExportAgentHistoryPayload {
|
|
228
383
|
agent_id: string;
|
|
229
384
|
project_id: string;
|
|
230
385
|
history_id: string;
|
|
231
|
-
|
|
232
|
-
|
|
386
|
+
startTime: string;
|
|
387
|
+
endTime?: string;
|
|
233
388
|
status: string;
|
|
234
389
|
input: Record<string, unknown>;
|
|
235
390
|
output?: Record<string, unknown>;
|
|
236
391
|
error?: Record<string, unknown>;
|
|
237
392
|
usage?: Record<string, unknown>;
|
|
238
|
-
|
|
393
|
+
metadata?: Record<string, unknown>;
|
|
239
394
|
steps?: HistoryStep[];
|
|
240
395
|
userId?: string;
|
|
241
396
|
conversationId?: string;
|
|
397
|
+
model?: string;
|
|
242
398
|
}
|
|
243
399
|
interface ExportTimelineEventPayload {
|
|
244
400
|
history_id: string;
|
|
245
401
|
event_id: string;
|
|
246
|
-
|
|
402
|
+
agent_id: string;
|
|
403
|
+
event: NewTimelineEvent;
|
|
247
404
|
}
|
|
248
405
|
interface AgentHistoryUpdatableFields {
|
|
249
406
|
input?: AgentHistoryEntry["input"];
|
|
250
407
|
output?: string;
|
|
251
408
|
status?: AgentStatus;
|
|
252
409
|
usage?: UsageInfo;
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
interface TimelineEventUpdatableFields {
|
|
256
|
-
timestamp?: string;
|
|
257
|
-
type?: TimelineEventType;
|
|
258
|
-
name?: string;
|
|
259
|
-
status?: EventStatus;
|
|
260
|
-
error?: Record<string, unknown>;
|
|
261
|
-
input?: Record<string, unknown>;
|
|
262
|
-
output?: Record<string, unknown>;
|
|
410
|
+
metadata?: Record<string, unknown>;
|
|
411
|
+
endTime?: string;
|
|
263
412
|
}
|
|
264
413
|
|
|
265
414
|
/**
|
|
@@ -319,7 +468,7 @@ declare class VoltAgentExporter {
|
|
|
319
468
|
* @param steps - The steps data to export.
|
|
320
469
|
* @returns A promise that resolves with the response from the telemetry service.
|
|
321
470
|
*/
|
|
322
|
-
exportHistorySteps(
|
|
471
|
+
exportHistorySteps(history_id: string, steps: HistoryStep[]): Promise<void>;
|
|
323
472
|
/**
|
|
324
473
|
* Updates specific fields of an agent history entry.
|
|
325
474
|
* @param project_id - The project ID associated with the history entry.
|
|
@@ -328,15 +477,7 @@ declare class VoltAgentExporter {
|
|
|
328
477
|
* Should conform to Partial<AgentHistoryUpdatableFields>.
|
|
329
478
|
* @returns A promise that resolves with the response from the telemetry service.
|
|
330
479
|
*/
|
|
331
|
-
updateHistoryEntry(
|
|
332
|
-
/**
|
|
333
|
-
* Updates specific fields of a timeline event.
|
|
334
|
-
* @param history_id - The ID of the parent history entry.
|
|
335
|
-
* @param event_id - The ID of the timeline event to update.
|
|
336
|
-
* @param updates - An object containing the fields to update.
|
|
337
|
-
* @returns A promise that resolves when the operation is complete.
|
|
338
|
-
*/
|
|
339
|
-
updateTimelineEvent(history_id: string, event_id: string, updates: TimelineEventUpdatableFields): Promise<void>;
|
|
480
|
+
updateHistoryEntry(history_id: string, updates: Partial<AgentHistoryUpdatableFields>): Promise<void>;
|
|
340
481
|
}
|
|
341
482
|
|
|
342
483
|
/**
|
|
@@ -349,40 +490,41 @@ interface HistoryStep {
|
|
|
349
490
|
arguments?: Record<string, unknown>;
|
|
350
491
|
}
|
|
351
492
|
/**
|
|
352
|
-
*
|
|
493
|
+
* Parameters for adding a history entry
|
|
353
494
|
*/
|
|
354
|
-
interface
|
|
495
|
+
interface AddEntryParams {
|
|
355
496
|
/**
|
|
356
|
-
*
|
|
497
|
+
* Input to the agent
|
|
357
498
|
*/
|
|
358
|
-
|
|
499
|
+
input: string | Record<string, unknown> | BaseMessage[];
|
|
359
500
|
/**
|
|
360
|
-
*
|
|
501
|
+
* Output from the agent
|
|
361
502
|
*/
|
|
362
|
-
|
|
503
|
+
output: string;
|
|
363
504
|
/**
|
|
364
|
-
*
|
|
365
|
-
* In the new format, "componentName:operationName" style (e.g.: "memory:getMessages")
|
|
505
|
+
* Status of the entry
|
|
366
506
|
*/
|
|
367
|
-
|
|
507
|
+
status: AgentStatus;
|
|
368
508
|
/**
|
|
369
|
-
*
|
|
370
|
-
* Added with the new format
|
|
509
|
+
* Steps taken during generation
|
|
371
510
|
*/
|
|
372
|
-
|
|
511
|
+
steps?: HistoryStep[];
|
|
373
512
|
/**
|
|
374
|
-
*
|
|
375
|
-
* In the new format: { status, input, output, updatedAt etc. }
|
|
513
|
+
* Additional options for the entry
|
|
376
514
|
*/
|
|
377
|
-
|
|
515
|
+
options?: Partial<Omit<AgentHistoryEntry, "id" | "timestamp" | "input" | "output" | "status" | "steps">>;
|
|
378
516
|
/**
|
|
379
|
-
* Optional
|
|
517
|
+
* Optional userId for telemetry
|
|
380
518
|
*/
|
|
381
|
-
|
|
519
|
+
userId?: string;
|
|
520
|
+
/**
|
|
521
|
+
* Optional conversationId for telemetry
|
|
522
|
+
*/
|
|
523
|
+
conversationId?: string;
|
|
382
524
|
/**
|
|
383
|
-
*
|
|
525
|
+
* Optional model name for telemetry
|
|
384
526
|
*/
|
|
385
|
-
|
|
527
|
+
model?: string;
|
|
386
528
|
}
|
|
387
529
|
/**
|
|
388
530
|
* Agent history entry
|
|
@@ -395,7 +537,8 @@ interface AgentHistoryEntry {
|
|
|
395
537
|
/**
|
|
396
538
|
* Timestamp of the entry
|
|
397
539
|
*/
|
|
398
|
-
|
|
540
|
+
startTime: Date;
|
|
541
|
+
endTime?: Date;
|
|
399
542
|
/**
|
|
400
543
|
* Original input to the agent
|
|
401
544
|
*/
|
|
@@ -416,10 +559,7 @@ interface AgentHistoryEntry {
|
|
|
416
559
|
* Usage information returned by the LLM
|
|
417
560
|
*/
|
|
418
561
|
usage?: UsageInfo;
|
|
419
|
-
|
|
420
|
-
* Timeline events for detailed agent state history
|
|
421
|
-
*/
|
|
422
|
-
events?: TimelineEvent[];
|
|
562
|
+
metadata?: Record<string, unknown>;
|
|
423
563
|
/**
|
|
424
564
|
* Sequence number for the history entry
|
|
425
565
|
*/
|
|
@@ -472,25 +612,10 @@ declare class HistoryManager {
|
|
|
472
612
|
/**
|
|
473
613
|
* Add a new history entry
|
|
474
614
|
*
|
|
475
|
-
* @param
|
|
476
|
-
* @param output - Output from the agent
|
|
477
|
-
* @param status - Status of the entry
|
|
478
|
-
* @param steps - Steps taken during generation
|
|
479
|
-
* @param options - Additional options for the entry
|
|
480
|
-
* @param agentSnapshot - Optional agent snapshot for telemetry
|
|
481
|
-
* @param userId - Optional userId for telemetry
|
|
482
|
-
* @param conversationId - Optional conversationId for telemetry
|
|
615
|
+
* @param params - Parameters for adding a history entry
|
|
483
616
|
* @returns The new history entry
|
|
484
617
|
*/
|
|
485
|
-
addEntry(
|
|
486
|
-
/**
|
|
487
|
-
* Add a timeline event to an existing history entry
|
|
488
|
-
*
|
|
489
|
-
* @param entryId - ID of the entry to update
|
|
490
|
-
* @param event - Timeline event to add
|
|
491
|
-
* @returns The updated entry or undefined if not found
|
|
492
|
-
*/
|
|
493
|
-
addEventToEntry(entryId: string, event: TimelineEvent): Promise<AgentHistoryEntry | undefined>;
|
|
618
|
+
addEntry(params: AddEntryParams): Promise<AgentHistoryEntry>;
|
|
494
619
|
/**
|
|
495
620
|
* Add steps to an existing history entry
|
|
496
621
|
*
|
|
@@ -512,12 +637,6 @@ declare class HistoryManager {
|
|
|
512
637
|
* @returns Array of history entries
|
|
513
638
|
*/
|
|
514
639
|
getEntries(): Promise<AgentHistoryEntry[]>;
|
|
515
|
-
/**
|
|
516
|
-
* Get the latest history entry
|
|
517
|
-
*
|
|
518
|
-
* @returns The latest history entry or undefined if no entries
|
|
519
|
-
*/
|
|
520
|
-
getLatestEntry(): Promise<AgentHistoryEntry | undefined>;
|
|
521
640
|
/**
|
|
522
641
|
* Clear all history entries
|
|
523
642
|
*/
|
|
@@ -530,28 +649,17 @@ declare class HistoryManager {
|
|
|
530
649
|
* @returns The updated entry or undefined if not found
|
|
531
650
|
*/
|
|
532
651
|
updateEntry(id: string, updates: Partial<Omit<AgentHistoryEntry, "id" | "timestamp"> & {
|
|
533
|
-
|
|
652
|
+
metadata?: Record<string, unknown>;
|
|
534
653
|
}>): Promise<AgentHistoryEntry | undefined>;
|
|
535
654
|
/**
|
|
536
|
-
*
|
|
655
|
+
* Persists a timeline event for a history entry.
|
|
656
|
+
* This is used by the new immutable event system.
|
|
537
657
|
*
|
|
538
658
|
* @param historyId - ID of the history entry
|
|
539
|
-
* @param
|
|
540
|
-
* @returns
|
|
659
|
+
* @param event - The NewTimelineEvent object to persist
|
|
660
|
+
* @returns A promise that resolves to the updated entry or undefined if an error occurs
|
|
541
661
|
*/
|
|
542
|
-
|
|
543
|
-
/**
|
|
544
|
-
* Update a tracked event by ID
|
|
545
|
-
*
|
|
546
|
-
* @param historyId - ID of the history entry
|
|
547
|
-
* @param eventId - ID of the event or _trackedEventId
|
|
548
|
-
* @param updates - Updates to apply to the event
|
|
549
|
-
* @returns The updated history entry or undefined if not found
|
|
550
|
-
*/
|
|
551
|
-
updateTrackedEvent(historyId: string, eventId: string, updates: {
|
|
552
|
-
status?: AgentStatus;
|
|
553
|
-
data?: Record<string, unknown>;
|
|
554
|
-
}): Promise<AgentHistoryEntry | undefined>;
|
|
662
|
+
persistTimelineEvent(historyId: string, event: NewTimelineEvent): Promise<AgentHistoryEntry | undefined>;
|
|
555
663
|
}
|
|
556
664
|
|
|
557
665
|
/**
|
|
@@ -818,8 +926,6 @@ type OperationContext = {
|
|
|
818
926
|
readonly userContext: Map<string | symbol, any>;
|
|
819
927
|
/** The history entry associated with this operation */
|
|
820
928
|
historyEntry: AgentHistoryEntry;
|
|
821
|
-
/** Map to store tool event updaters using tool call ID as key */
|
|
822
|
-
eventUpdaters: Map<string, EventUpdater>;
|
|
823
929
|
/** Whether this operation is still active */
|
|
824
930
|
isActive: boolean;
|
|
825
931
|
/** Parent agent ID if part of a delegation chain */
|
|
@@ -1258,182 +1364,180 @@ type LLMProvider<TProvider> = {
|
|
|
1258
1364
|
};
|
|
1259
1365
|
|
|
1260
1366
|
/**
|
|
1261
|
-
*
|
|
1367
|
+
* Event statuses
|
|
1262
1368
|
*/
|
|
1263
|
-
type
|
|
1264
|
-
/**
|
|
1265
|
-
* Maximum number of messages to store in the database
|
|
1266
|
-
* @default 100
|
|
1267
|
-
*/
|
|
1268
|
-
storageLimit?: number;
|
|
1269
|
-
};
|
|
1369
|
+
type EventStatus = "idle" | "working" | "completed" | "error";
|
|
1270
1370
|
/**
|
|
1271
|
-
*
|
|
1371
|
+
* Standard event data interface
|
|
1272
1372
|
*/
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
*/
|
|
1285
|
-
limit?: number;
|
|
1286
|
-
/**
|
|
1287
|
-
* Only retrieve messages before this timestamp
|
|
1288
|
-
*/
|
|
1289
|
-
before?: number;
|
|
1290
|
-
/**
|
|
1291
|
-
* Only retrieve messages after this timestamp
|
|
1292
|
-
*/
|
|
1293
|
-
after?: number;
|
|
1294
|
-
/**
|
|
1295
|
-
* Only retrieve messages with this role
|
|
1296
|
-
*/
|
|
1297
|
-
role?: BaseMessage["role"];
|
|
1298
|
-
};
|
|
1373
|
+
interface StandardEventData {
|
|
1374
|
+
status: EventStatus;
|
|
1375
|
+
timestamp: string;
|
|
1376
|
+
input?: unknown;
|
|
1377
|
+
output?: unknown;
|
|
1378
|
+
error?: unknown;
|
|
1379
|
+
errorMessage?: string;
|
|
1380
|
+
metadata?: Record<string, unknown>;
|
|
1381
|
+
sourceAgentId?: string;
|
|
1382
|
+
userContext?: Record<string, unknown>;
|
|
1383
|
+
}
|
|
1299
1384
|
/**
|
|
1300
|
-
*
|
|
1385
|
+
* Standard timeline event
|
|
1301
1386
|
*/
|
|
1302
|
-
|
|
1387
|
+
interface StandardTimelineEvent {
|
|
1303
1388
|
id: string;
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
}
|
|
1389
|
+
timestamp: Date;
|
|
1390
|
+
name: string;
|
|
1391
|
+
data: StandardEventData;
|
|
1392
|
+
agentId: string;
|
|
1393
|
+
historyId: string;
|
|
1394
|
+
}
|
|
1310
1395
|
/**
|
|
1311
|
-
*
|
|
1396
|
+
* Defines the main category of a TimelineEvent.
|
|
1312
1397
|
*/
|
|
1313
|
-
type
|
|
1314
|
-
id: string;
|
|
1315
|
-
resourceId: string;
|
|
1316
|
-
title: string;
|
|
1317
|
-
metadata: Record<string, unknown>;
|
|
1318
|
-
};
|
|
1398
|
+
type TimelineEventCoreType = "agent" | "tool" | "memory" | "retriever";
|
|
1319
1399
|
/**
|
|
1320
|
-
*
|
|
1400
|
+
* Defines the operational status of a TimelineEvent.
|
|
1401
|
+
* 'idle' is added for consistency with frontend initial states.
|
|
1321
1402
|
*/
|
|
1322
|
-
type
|
|
1323
|
-
/**
|
|
1324
|
-
* Add a message to memory
|
|
1325
|
-
*/
|
|
1326
|
-
addMessage(message: BaseMessage, userId: string, conversationId?: string): Promise<void>;
|
|
1327
|
-
/**
|
|
1328
|
-
* Get messages from memory
|
|
1329
|
-
*/
|
|
1330
|
-
getMessages(options: MessageFilterOptions): Promise<BaseMessage[]>;
|
|
1331
|
-
/**
|
|
1332
|
-
* Clear messages from memory
|
|
1333
|
-
*/
|
|
1334
|
-
clearMessages(options: {
|
|
1335
|
-
userId: string;
|
|
1336
|
-
conversationId?: string;
|
|
1337
|
-
}): Promise<void>;
|
|
1338
|
-
/**
|
|
1339
|
-
* Create a new conversation
|
|
1340
|
-
*/
|
|
1341
|
-
createConversation(conversation: CreateConversationInput): Promise<Conversation>;
|
|
1342
|
-
/**
|
|
1343
|
-
* Get a conversation by ID
|
|
1344
|
-
*/
|
|
1345
|
-
getConversation(id: string): Promise<Conversation | null>;
|
|
1346
|
-
/**
|
|
1347
|
-
* Get conversations for a resource
|
|
1348
|
-
*/
|
|
1349
|
-
getConversations(resourceId: string): Promise<Conversation[]>;
|
|
1350
|
-
/**
|
|
1351
|
-
* Update a conversation
|
|
1352
|
-
*/
|
|
1353
|
-
updateConversation(id: string, updates: Partial<Omit<Conversation, "id" | "createdAt" | "updatedAt">>): Promise<Conversation>;
|
|
1354
|
-
/**
|
|
1355
|
-
* Delete a conversation
|
|
1356
|
-
*/
|
|
1357
|
-
deleteConversation(id: string): Promise<void>;
|
|
1358
|
-
/**
|
|
1359
|
-
* Add or update a history entry
|
|
1360
|
-
* @param key Entry ID
|
|
1361
|
-
* @param value Entry data
|
|
1362
|
-
* @param agentId Agent ID for filtering
|
|
1363
|
-
*/
|
|
1364
|
-
addHistoryEntry(key: string, value: any, agentId: string): Promise<void>;
|
|
1365
|
-
/**
|
|
1366
|
-
* Update an existing history entry
|
|
1367
|
-
* @param key Entry ID
|
|
1368
|
-
* @param value Updated entry data
|
|
1369
|
-
* @param agentId Agent ID for filtering
|
|
1370
|
-
*/
|
|
1371
|
-
updateHistoryEntry(key: string, value: any, agentId: string): Promise<void>;
|
|
1372
|
-
/**
|
|
1373
|
-
* Add a history event
|
|
1374
|
-
* @param key Event ID
|
|
1375
|
-
* @param value Event data
|
|
1376
|
-
* @param historyId Related history entry ID
|
|
1377
|
-
* @param agentId Agent ID for filtering
|
|
1378
|
-
*/
|
|
1379
|
-
addHistoryEvent(key: string, value: any, historyId: string, agentId: string): Promise<void>;
|
|
1380
|
-
/**
|
|
1381
|
-
* Update a history event
|
|
1382
|
-
* @param key Event ID
|
|
1383
|
-
* @param value Updated event data
|
|
1384
|
-
* @param historyId Related history entry ID
|
|
1385
|
-
* @param agentId Agent ID for filtering
|
|
1386
|
-
*/
|
|
1387
|
-
updateHistoryEvent(key: string, value: any, historyId: string, agentId: string): Promise<void>;
|
|
1388
|
-
/**
|
|
1389
|
-
* Add a history step
|
|
1390
|
-
* @param key Step ID
|
|
1391
|
-
* @param value Step data
|
|
1392
|
-
* @param historyId Related history entry ID
|
|
1393
|
-
* @param agentId Agent ID for filtering
|
|
1394
|
-
*/
|
|
1395
|
-
addHistoryStep(key: string, value: any, historyId: string, agentId: string): Promise<void>;
|
|
1396
|
-
/**
|
|
1397
|
-
* Update a history step
|
|
1398
|
-
* @param key Step ID
|
|
1399
|
-
* @param value Updated step data
|
|
1400
|
-
* @param historyId Related history entry ID
|
|
1401
|
-
* @param agentId Agent ID for filtering
|
|
1402
|
-
*/
|
|
1403
|
-
updateHistoryStep(key: string, value: any, historyId: string, agentId: string): Promise<void>;
|
|
1404
|
-
/**
|
|
1405
|
-
* Get a history entry by ID
|
|
1406
|
-
* @param key Entry ID
|
|
1407
|
-
* @returns The history entry or undefined if not found
|
|
1408
|
-
*/
|
|
1409
|
-
getHistoryEntry(key: string): Promise<any | undefined>;
|
|
1410
|
-
/**
|
|
1411
|
-
* Get a history event by ID
|
|
1412
|
-
* @param key Event ID
|
|
1413
|
-
* @returns The history event or undefined if not found
|
|
1414
|
-
*/
|
|
1415
|
-
getHistoryEvent(key: string): Promise<any | undefined>;
|
|
1416
|
-
/**
|
|
1417
|
-
* Get a history step by ID
|
|
1418
|
-
* @param key Step ID
|
|
1419
|
-
* @returns The history step or undefined if not found
|
|
1420
|
-
*/
|
|
1421
|
-
getHistoryStep(key: string): Promise<any | undefined>;
|
|
1422
|
-
/**
|
|
1423
|
-
* Get all history entries for an agent
|
|
1424
|
-
* @param agentId Agent ID
|
|
1425
|
-
* @returns Array of all history entries for the agent
|
|
1426
|
-
*/
|
|
1427
|
-
getAllHistoryEntriesByAgent(agentId: string): Promise<any[]>;
|
|
1428
|
-
};
|
|
1403
|
+
type TimelineEventCoreStatus = "idle" | "running" | "completed" | "error";
|
|
1429
1404
|
/**
|
|
1430
|
-
*
|
|
1405
|
+
* Defines the severity level of a TimelineEvent.
|
|
1431
1406
|
*/
|
|
1432
|
-
type
|
|
1407
|
+
type TimelineEventCoreLevel = "DEBUG" | "INFO" | "WARNING" | "ERROR" | "CRITICAL";
|
|
1408
|
+
/**
|
|
1409
|
+
* Usage information for tracking resource consumption
|
|
1410
|
+
*/
|
|
1411
|
+
interface Usage {
|
|
1412
|
+
promptTokens?: number;
|
|
1413
|
+
completionTokens?: number;
|
|
1414
|
+
totalTokens?: number;
|
|
1415
|
+
input?: number;
|
|
1416
|
+
output?: number;
|
|
1417
|
+
total?: number;
|
|
1418
|
+
unit?: "TOKENS" | "CHARACTERS" | "MILLISECONDS" | "SECONDS" | "IMAGES";
|
|
1419
|
+
inputCost?: number;
|
|
1420
|
+
outputCost?: number;
|
|
1421
|
+
totalCost?: number;
|
|
1422
|
+
[key: string]: unknown;
|
|
1423
|
+
}
|
|
1424
|
+
/**
|
|
1425
|
+
* Base metadata interface with common fields for all timeline events
|
|
1426
|
+
*/
|
|
1427
|
+
interface BaseEventMetadata {
|
|
1428
|
+
displayName?: string;
|
|
1433
1429
|
id: string;
|
|
1434
|
-
|
|
1435
|
-
|
|
1430
|
+
agentId?: string;
|
|
1431
|
+
usage?: Usage;
|
|
1432
|
+
}
|
|
1433
|
+
interface AgentStartEventMetadata extends BaseEventMetadata {
|
|
1434
|
+
instructions?: string;
|
|
1435
|
+
}
|
|
1436
|
+
/**
|
|
1437
|
+
* Base interface for all Timeline Events.
|
|
1438
|
+
* The `metadata` field will be typed more specifically using a discriminated union based on `type` and `name`.
|
|
1439
|
+
*/
|
|
1440
|
+
interface BaseTimelineEvent<M = BaseEventMetadata | null> {
|
|
1441
|
+
id: string;
|
|
1442
|
+
name: string;
|
|
1443
|
+
type: TimelineEventCoreType;
|
|
1444
|
+
startTime: string;
|
|
1445
|
+
endTime?: string | null;
|
|
1446
|
+
status?: TimelineEventCoreStatus;
|
|
1447
|
+
statusMessage?: string | null;
|
|
1448
|
+
level?: TimelineEventCoreLevel;
|
|
1449
|
+
input?: Record<string, unknown> | null;
|
|
1450
|
+
output?: Record<string, unknown> | null;
|
|
1451
|
+
metadata: M;
|
|
1452
|
+
error?: {
|
|
1453
|
+
message: string;
|
|
1454
|
+
stack?: string;
|
|
1455
|
+
code?: string | number;
|
|
1456
|
+
[key: string]: unknown;
|
|
1457
|
+
} | null;
|
|
1458
|
+
version?: string | null;
|
|
1459
|
+
parentEventId?: string | null;
|
|
1460
|
+
traceId: string;
|
|
1461
|
+
tags?: string[] | null;
|
|
1462
|
+
}
|
|
1463
|
+
type ToolStartEvent = BaseTimelineEvent<BaseEventMetadata> & {
|
|
1464
|
+
name: "tool:start";
|
|
1465
|
+
type: "tool";
|
|
1466
|
+
};
|
|
1467
|
+
type ToolSuccessEvent = BaseTimelineEvent<BaseEventMetadata> & {
|
|
1468
|
+
name: "tool:success";
|
|
1469
|
+
type: "tool";
|
|
1470
|
+
};
|
|
1471
|
+
type ToolErrorEvent = BaseTimelineEvent<BaseEventMetadata> & {
|
|
1472
|
+
name: "tool:error";
|
|
1473
|
+
type: "tool";
|
|
1474
|
+
status: "error";
|
|
1475
|
+
level: "ERROR" | "CRITICAL";
|
|
1476
|
+
};
|
|
1477
|
+
type AgentStartEvent = BaseTimelineEvent<AgentStartEventMetadata> & {
|
|
1478
|
+
name: "agent:start";
|
|
1479
|
+
type: "agent";
|
|
1480
|
+
input: {
|
|
1481
|
+
input: string | BaseMessage[];
|
|
1482
|
+
};
|
|
1483
|
+
};
|
|
1484
|
+
type AgentSuccessEvent = BaseTimelineEvent<BaseEventMetadata> & {
|
|
1485
|
+
name: "agent:success";
|
|
1486
|
+
type: "agent";
|
|
1487
|
+
status: "completed";
|
|
1488
|
+
};
|
|
1489
|
+
type AgentErrorEvent = BaseTimelineEvent<BaseEventMetadata> & {
|
|
1490
|
+
name: "agent:error";
|
|
1491
|
+
type: "agent";
|
|
1492
|
+
status: "error";
|
|
1493
|
+
level: "ERROR" | "CRITICAL";
|
|
1494
|
+
};
|
|
1495
|
+
type MemoryReadStartEvent = BaseTimelineEvent<BaseEventMetadata> & {
|
|
1496
|
+
name: "memory:read_start";
|
|
1497
|
+
type: "memory";
|
|
1498
|
+
};
|
|
1499
|
+
type MemoryReadSuccessEvent = BaseTimelineEvent<BaseEventMetadata> & {
|
|
1500
|
+
name: "memory:read_success";
|
|
1501
|
+
type: "memory";
|
|
1502
|
+
status: "completed";
|
|
1503
|
+
};
|
|
1504
|
+
type MemoryReadErrorEvent = BaseTimelineEvent<BaseEventMetadata> & {
|
|
1505
|
+
name: "memory:read_error";
|
|
1506
|
+
type: "memory";
|
|
1507
|
+
status: "error";
|
|
1508
|
+
level: "ERROR" | "CRITICAL";
|
|
1509
|
+
};
|
|
1510
|
+
type MemoryWriteStartEvent = BaseTimelineEvent<BaseEventMetadata> & {
|
|
1511
|
+
name: "memory:write_start";
|
|
1512
|
+
type: "memory";
|
|
1436
1513
|
};
|
|
1514
|
+
type MemoryWriteSuccessEvent = BaseTimelineEvent<BaseEventMetadata> & {
|
|
1515
|
+
name: "memory:write_success";
|
|
1516
|
+
type: "memory";
|
|
1517
|
+
status: "completed";
|
|
1518
|
+
};
|
|
1519
|
+
type MemoryWriteErrorEvent = BaseTimelineEvent<BaseEventMetadata> & {
|
|
1520
|
+
name: "memory:write_error";
|
|
1521
|
+
type: "memory";
|
|
1522
|
+
status: "error";
|
|
1523
|
+
level: "ERROR" | "CRITICAL";
|
|
1524
|
+
};
|
|
1525
|
+
type RetrieverStartEvent = BaseTimelineEvent<BaseEventMetadata> & {
|
|
1526
|
+
name: "retriever:start";
|
|
1527
|
+
type: "retriever";
|
|
1528
|
+
};
|
|
1529
|
+
type RetrieverSuccessEvent = BaseTimelineEvent<BaseEventMetadata> & {
|
|
1530
|
+
name: "retriever:success";
|
|
1531
|
+
type: "retriever";
|
|
1532
|
+
status: "completed";
|
|
1533
|
+
};
|
|
1534
|
+
type RetrieverErrorEvent = BaseTimelineEvent<BaseEventMetadata> & {
|
|
1535
|
+
name: "retriever:error";
|
|
1536
|
+
type: "retriever";
|
|
1537
|
+
status: "error";
|
|
1538
|
+
level: "ERROR" | "CRITICAL";
|
|
1539
|
+
};
|
|
1540
|
+
type NewTimelineEvent = ToolStartEvent | ToolSuccessEvent | ToolErrorEvent | AgentStartEvent | AgentSuccessEvent | AgentErrorEvent | MemoryReadStartEvent | MemoryReadSuccessEvent | MemoryReadErrorEvent | MemoryWriteStartEvent | MemoryWriteSuccessEvent | MemoryWriteErrorEvent | RetrieverStartEvent | RetrieverSuccessEvent | RetrieverErrorEvent;
|
|
1437
1541
|
|
|
1438
1542
|
/**
|
|
1439
1543
|
* Options for configuring the InMemoryStorage
|
|
@@ -1453,6 +1557,8 @@ declare class InMemoryStorage implements Memory {
|
|
|
1453
1557
|
private storage;
|
|
1454
1558
|
private conversations;
|
|
1455
1559
|
private historyEntries;
|
|
1560
|
+
private historySteps;
|
|
1561
|
+
private timelineEvents;
|
|
1456
1562
|
private agentHistory;
|
|
1457
1563
|
private options;
|
|
1458
1564
|
/**
|
|
@@ -1461,15 +1567,19 @@ declare class InMemoryStorage implements Memory {
|
|
|
1461
1567
|
*/
|
|
1462
1568
|
constructor(options?: InMemoryStorageOptions);
|
|
1463
1569
|
/**
|
|
1464
|
-
*
|
|
1570
|
+
* Add a timeline event
|
|
1571
|
+
* @param key Event ID (UUID)
|
|
1572
|
+
* @param value Timeline event data
|
|
1573
|
+
* @param historyId Related history entry ID
|
|
1574
|
+
* @param agentId Agent ID for filtering
|
|
1465
1575
|
*/
|
|
1466
|
-
|
|
1576
|
+
addTimelineEvent(key: string, value: NewTimelineEvent, historyId: string, agentId: string): Promise<void>;
|
|
1467
1577
|
/**
|
|
1468
|
-
* Get a history
|
|
1578
|
+
* Get a history entry by ID
|
|
1469
1579
|
*/
|
|
1470
|
-
|
|
1580
|
+
getHistoryEntry(key: string): Promise<any | undefined>;
|
|
1471
1581
|
/**
|
|
1472
|
-
* Get a history step
|
|
1582
|
+
* Get a history step by ID
|
|
1473
1583
|
*/
|
|
1474
1584
|
getHistoryStep(key: string): Promise<any | undefined>;
|
|
1475
1585
|
/**
|
|
@@ -1480,14 +1590,6 @@ declare class InMemoryStorage implements Memory {
|
|
|
1480
1590
|
* Update a history entry
|
|
1481
1591
|
*/
|
|
1482
1592
|
updateHistoryEntry(key: string, value: any, agentId?: string): Promise<void>;
|
|
1483
|
-
/**
|
|
1484
|
-
* Add a history event
|
|
1485
|
-
*/
|
|
1486
|
-
addHistoryEvent(key: string, value: any, historyId: string, agentId: string): Promise<void>;
|
|
1487
|
-
/**
|
|
1488
|
-
* Update a history event
|
|
1489
|
-
*/
|
|
1490
|
-
updateHistoryEvent(key: string, value: any, historyId: string, agentId: string): Promise<void>;
|
|
1491
1593
|
/**
|
|
1492
1594
|
* Add a history step
|
|
1493
1595
|
*/
|
|
@@ -1669,22 +1771,6 @@ declare class LibSQLStorage implements Memory {
|
|
|
1669
1771
|
* @param agentId Agent ID for filtering
|
|
1670
1772
|
*/
|
|
1671
1773
|
updateHistoryEntry(key: string, value: any, agentId: string): Promise<void>;
|
|
1672
|
-
/**
|
|
1673
|
-
* Add a history event
|
|
1674
|
-
* @param key Event ID
|
|
1675
|
-
* @param value Event data
|
|
1676
|
-
* @param historyId Related history entry ID
|
|
1677
|
-
* @param agentId Agent ID for filtering
|
|
1678
|
-
*/
|
|
1679
|
-
addHistoryEvent(key: string, value: any, historyId: string, agentId: string): Promise<void>;
|
|
1680
|
-
/**
|
|
1681
|
-
* Update a history event
|
|
1682
|
-
* @param key Event ID
|
|
1683
|
-
* @param value Updated event data
|
|
1684
|
-
* @param historyId Related history entry ID
|
|
1685
|
-
* @param agentId Agent ID for filtering
|
|
1686
|
-
*/
|
|
1687
|
-
updateHistoryEvent(key: string, value: any, historyId: string, agentId: string): Promise<void>;
|
|
1688
1774
|
/**
|
|
1689
1775
|
* Add a history step
|
|
1690
1776
|
* @param key Step ID
|
|
@@ -1701,18 +1787,20 @@ declare class LibSQLStorage implements Memory {
|
|
|
1701
1787
|
* @param agentId Agent ID for filtering
|
|
1702
1788
|
*/
|
|
1703
1789
|
updateHistoryStep(key: string, value: any, historyId: string, agentId: string): Promise<void>;
|
|
1790
|
+
/**
|
|
1791
|
+
* Add a timeline event
|
|
1792
|
+
* @param key Event ID (UUID)
|
|
1793
|
+
* @param value Timeline event data
|
|
1794
|
+
* @param historyId Related history entry ID
|
|
1795
|
+
* @param agentId Agent ID for filtering
|
|
1796
|
+
*/
|
|
1797
|
+
addTimelineEvent(key: string, value: NewTimelineEvent, historyId: string, agentId: string): Promise<void>;
|
|
1704
1798
|
/**
|
|
1705
1799
|
* Get a history entry by ID
|
|
1706
1800
|
* @param key Entry ID
|
|
1707
1801
|
* @returns The history entry or undefined if not found
|
|
1708
1802
|
*/
|
|
1709
1803
|
getHistoryEntry(key: string): Promise<any | undefined>;
|
|
1710
|
-
/**
|
|
1711
|
-
* Get a history event by ID
|
|
1712
|
-
* @param key Event ID
|
|
1713
|
-
* @returns The history event or undefined if not found
|
|
1714
|
-
*/
|
|
1715
|
-
getHistoryEvent(key: string): Promise<any | undefined>;
|
|
1716
1804
|
/**
|
|
1717
1805
|
* Get a history step by ID
|
|
1718
1806
|
* @param key Step ID
|
|
@@ -1730,6 +1818,27 @@ declare class LibSQLStorage implements Memory {
|
|
|
1730
1818
|
* @returns Array of all history entries for the agent
|
|
1731
1819
|
*/
|
|
1732
1820
|
getAllHistoryEntriesByAgent(agentId: string): Promise<any[]>;
|
|
1821
|
+
/**
|
|
1822
|
+
* Migrates agent history data from old structure to new structure.
|
|
1823
|
+
* If migration fails, it can be rolled back using the backup mechanism.
|
|
1824
|
+
*
|
|
1825
|
+
* Old database structure:
|
|
1826
|
+
* CREATE TABLE voltagent_memory_agent_history (
|
|
1827
|
+
* key TEXT PRIMARY KEY,
|
|
1828
|
+
* value TEXT NOT NULL,
|
|
1829
|
+
* agent_id TEXT
|
|
1830
|
+
* );
|
|
1831
|
+
*/
|
|
1832
|
+
migrateAgentHistoryData(options?: {
|
|
1833
|
+
createBackup?: boolean;
|
|
1834
|
+
restoreFromBackup?: boolean;
|
|
1835
|
+
deleteBackupAfterSuccess?: boolean;
|
|
1836
|
+
}): Promise<{
|
|
1837
|
+
success: boolean;
|
|
1838
|
+
migratedCount?: number;
|
|
1839
|
+
error?: Error;
|
|
1840
|
+
backupCreated?: boolean;
|
|
1841
|
+
}>;
|
|
1733
1842
|
}
|
|
1734
1843
|
|
|
1735
1844
|
/**
|
|
@@ -1753,23 +1862,17 @@ declare class MemoryManager {
|
|
|
1753
1862
|
*/
|
|
1754
1863
|
constructor(resourceId: string, memory?: Memory | false, options?: MemoryOptions);
|
|
1755
1864
|
/**
|
|
1756
|
-
* Create a
|
|
1865
|
+
* Create and publish a timeline event for memory operations
|
|
1757
1866
|
*
|
|
1758
1867
|
* @param context - Operation context with history entry info
|
|
1759
|
-
* @param
|
|
1760
|
-
* @
|
|
1761
|
-
* @param initialData - Initial data for the event
|
|
1762
|
-
* @returns An event updater function
|
|
1868
|
+
* @param event - Timeline event to publish
|
|
1869
|
+
* @returns A promise that resolves when the event is published
|
|
1763
1870
|
*/
|
|
1764
|
-
private
|
|
1871
|
+
private publishTimelineEvent;
|
|
1765
1872
|
/**
|
|
1766
1873
|
* Save a message to memory
|
|
1767
1874
|
*/
|
|
1768
1875
|
saveMessage(context: OperationContext, message: BaseMessage, userId?: string, conversationId?: string, type?: "text" | "tool-call" | "tool-result"): Promise<void>;
|
|
1769
|
-
/**
|
|
1770
|
-
* Get messages from memory
|
|
1771
|
-
*/
|
|
1772
|
-
getMessages(context: OperationContext, userId?: string, conversationId?: string, limit?: number): Promise<BaseMessage[]>;
|
|
1773
1876
|
/**
|
|
1774
1877
|
* Create a step finish handler to save messages during generation
|
|
1775
1878
|
*/
|
|
@@ -1825,16 +1928,6 @@ declare class MemoryManager {
|
|
|
1825
1928
|
* @returns A promise that resolves to the updated entry or undefined
|
|
1826
1929
|
*/
|
|
1827
1930
|
updateHistoryEntry(agentId: string, entryId: string, updates: any): Promise<any | undefined>;
|
|
1828
|
-
/**
|
|
1829
|
-
* Update an existing event in a history entry
|
|
1830
|
-
*
|
|
1831
|
-
* @param agentId - The ID of the agent
|
|
1832
|
-
* @param entryId - The ID of the history entry
|
|
1833
|
-
* @param eventId - The ID of the event to update
|
|
1834
|
-
* @param event - Updated event data
|
|
1835
|
-
* @returns A promise that resolves when the update is complete
|
|
1836
|
-
*/
|
|
1837
|
-
updateEventInHistoryEntry(agentId: string, entryId: string, eventId: string, event: any): Promise<any | undefined>;
|
|
1838
1931
|
/**
|
|
1839
1932
|
* Add steps to a history entry
|
|
1840
1933
|
*
|
|
@@ -1845,14 +1938,16 @@ declare class MemoryManager {
|
|
|
1845
1938
|
*/
|
|
1846
1939
|
addStepsToHistoryEntry(agentId: string, entryId: string, steps: any[]): Promise<any | undefined>;
|
|
1847
1940
|
/**
|
|
1848
|
-
* Add
|
|
1941
|
+
* Add a timeline event to a history entry
|
|
1942
|
+
* This method is part of the new immutable event system
|
|
1849
1943
|
*
|
|
1850
1944
|
* @param agentId - The ID of the agent
|
|
1851
|
-
* @param
|
|
1852
|
-
* @param
|
|
1945
|
+
* @param historyId - The ID of the history entry
|
|
1946
|
+
* @param eventId - The ID of the timeline event
|
|
1947
|
+
* @param event - The NewTimelineEvent object
|
|
1853
1948
|
* @returns A promise that resolves to the updated entry or undefined
|
|
1854
1949
|
*/
|
|
1855
|
-
|
|
1950
|
+
addTimelineEvent(agentId: string, historyId: string, eventId: string, event: NewTimelineEvent): Promise<any | undefined>;
|
|
1856
1951
|
}
|
|
1857
1952
|
|
|
1858
1953
|
interface OnStartHookArgs {
|
|
@@ -2322,10 +2417,6 @@ declare class Agent<TProvider extends {
|
|
|
2322
2417
|
* Update history entry
|
|
2323
2418
|
*/
|
|
2324
2419
|
private updateHistoryEntry;
|
|
2325
|
-
/**
|
|
2326
|
-
* Standard timeline event creator
|
|
2327
|
-
*/
|
|
2328
|
-
private createStandardTimelineEvent;
|
|
2329
2420
|
/**
|
|
2330
2421
|
* Fix delete operator usage for better performance
|
|
2331
2422
|
*/
|
|
@@ -2440,9 +2531,9 @@ declare const ReasoningStepSchema: z.ZodObject<{
|
|
|
2440
2531
|
id: string;
|
|
2441
2532
|
title: string;
|
|
2442
2533
|
type: "thought" | "analysis";
|
|
2443
|
-
timestamp: string;
|
|
2444
2534
|
historyEntryId: string;
|
|
2445
2535
|
agentId: string;
|
|
2536
|
+
timestamp: string;
|
|
2446
2537
|
reasoning: string;
|
|
2447
2538
|
confidence: number;
|
|
2448
2539
|
action?: string | undefined;
|
|
@@ -2452,9 +2543,9 @@ declare const ReasoningStepSchema: z.ZodObject<{
|
|
|
2452
2543
|
id: string;
|
|
2453
2544
|
title: string;
|
|
2454
2545
|
type: "thought" | "analysis";
|
|
2455
|
-
timestamp: string;
|
|
2456
2546
|
historyEntryId: string;
|
|
2457
2547
|
agentId: string;
|
|
2548
|
+
timestamp: string;
|
|
2458
2549
|
reasoning: string;
|
|
2459
2550
|
action?: string | undefined;
|
|
2460
2551
|
result?: string | undefined;
|
|
@@ -3158,4 +3249,4 @@ declare class VoltAgent {
|
|
|
3158
3249
|
shutdownTelemetry(): Promise<void>;
|
|
3159
3250
|
}
|
|
3160
3251
|
|
|
3161
|
-
export { Agent, AgentHistoryEntry, AgentHookOnEnd, AgentHookOnHandoff, AgentHookOnStart, AgentHookOnToolEnd, AgentHookOnToolStart, AgentHooks, AgentOptions, AgentRegistry, AgentResponse, AgentTool, AllowedVariableValue, AnyToolConfig, BaseLLMOptions, BaseMessage, BaseRetriever, BaseTool, BaseToolCall, ClientInfo, Conversation, CreateConversationInput, CreateReasoningToolsOptions, DEFAULT_INSTRUCTIONS, DataContent, ExtractVariableNames, FEW_SHOT_EXAMPLES, FilePart, GenerateObjectOptions, GenerateTextOptions, HTTPServerConfig, ImagePart, InMemoryStorage, InferGenerateObjectResponse, InferGenerateTextResponse, InferMessage, InferModel, InferProviderParams, InferStreamResponse, InferTool, LLMProvider, LibSQLStorage, MCPClient, MCPClientConfig, MCPClientEvents, MCPConfiguration, MCPOptions, MCPServerConfig, MCPToolCall, MCPToolResult, Memory, MemoryManager, MemoryMessage, MemoryOptions, MessageContent, MessageFilterOptions, MessageRole, ModelToolCall, NextAction, NodeType, OnEndHookArgs, OnHandoffHookArgs, OnStartHookArgs, OnToolEndHookArgs, OnToolStartHookArgs, OperationContext, PackageUpdateInfo, PromptCreator, PromptTemplate, ProviderObjectResponse, ProviderObjectStreamResponse, ProviderParams, ProviderResponse, ProviderTextResponse, ProviderTextStreamResponse, ReadableStreamType, ReasoningStep, ReasoningStepSchema, ReasoningToolExecuteOptions, Retriever, RetrieverOptions, RetryConfig, StdioServerConfig, StepChunkCallback, StepFinishCallback, StepWithContent, StreamObjectFinishResult, StreamObjectOnFinishCallback, StreamObjectOptions, StreamTextFinishResult, StreamTextOnFinishCallback, StreamTextOptions, TemplateVariables, TextPart, Tool, ToolCall, ToolErrorInfo, ToolExecuteOptions, ToolExecutionContext, ToolManager, ToolOptions, ToolSchema, ToolStatus, ToolStatusInfo, Toolkit, ToolsetMap, ToolsetWithTools, TransportError, UsageInfo, Voice, VoiceEventData, VoiceEventType, VoiceMetadata, VoiceOptions, VoltAgent, VoltAgentError, VoltAgentExporter, VoltAgentExporterOptions, checkForUpdates, createHooks, createNodeId, createPrompt, createReasoningTools, createRetrieverTool, createTool, createToolkit, VoltAgent as default, getNodeTypeFromNodeId, serializeValueForDebug, tool, updateAllPackages, updateSinglePackage, zodSchemaToJsonUI };
|
|
3252
|
+
export { Agent, AgentErrorEvent, AgentHistoryEntry, AgentHookOnEnd, AgentHookOnHandoff, AgentHookOnStart, AgentHookOnToolEnd, AgentHookOnToolStart, AgentHooks, AgentOptions, AgentRegistry, AgentResponse, AgentStartEvent, AgentStartEventMetadata, AgentSuccessEvent, AgentTool, AllowedVariableValue, AnyToolConfig, BaseEventMetadata, BaseLLMOptions, BaseMessage, BaseRetriever, BaseTimelineEvent, BaseTool, BaseToolCall, ClientInfo, Conversation, CreateConversationInput, CreateReasoningToolsOptions, DEFAULT_INSTRUCTIONS, DataContent, EventStatus, ExtractVariableNames, FEW_SHOT_EXAMPLES, FilePart, GenerateObjectOptions, GenerateTextOptions, HTTPServerConfig, ImagePart, InMemoryStorage, InferGenerateObjectResponse, InferGenerateTextResponse, InferMessage, InferModel, InferProviderParams, InferStreamResponse, InferTool, LLMProvider, LibSQLStorage, MCPClient, MCPClientConfig, MCPClientEvents, MCPConfiguration, MCPOptions, MCPServerConfig, MCPToolCall, MCPToolResult, Memory, MemoryManager, MemoryMessage, MemoryOptions, MemoryReadErrorEvent, MemoryReadStartEvent, MemoryReadSuccessEvent, MemoryWriteErrorEvent, MemoryWriteStartEvent, MemoryWriteSuccessEvent, MessageContent, MessageFilterOptions, MessageRole, ModelToolCall, NewTimelineEvent, NextAction, NodeType, OnEndHookArgs, OnHandoffHookArgs, OnStartHookArgs, OnToolEndHookArgs, OnToolStartHookArgs, OperationContext, PackageUpdateInfo, PromptCreator, PromptTemplate, ProviderObjectResponse, ProviderObjectStreamResponse, ProviderParams, ProviderResponse, ProviderTextResponse, ProviderTextStreamResponse, ReadableStreamType, ReasoningStep, ReasoningStepSchema, ReasoningToolExecuteOptions, Retriever, RetrieverErrorEvent, RetrieverOptions, RetrieverStartEvent, RetrieverSuccessEvent, RetryConfig, StandardEventData, StandardTimelineEvent, StdioServerConfig, StepChunkCallback, StepFinishCallback, StepWithContent, StreamObjectFinishResult, StreamObjectOnFinishCallback, StreamObjectOptions, StreamTextFinishResult, StreamTextOnFinishCallback, StreamTextOptions, TemplateVariables, TextPart, TimelineEventCoreLevel, TimelineEventCoreStatus, TimelineEventCoreType, Tool, ToolCall, ToolErrorEvent, ToolErrorInfo, ToolExecuteOptions, ToolExecutionContext, ToolManager, ToolOptions, ToolSchema, ToolStartEvent, ToolStatus, ToolStatusInfo, ToolSuccessEvent, Toolkit, ToolsetMap, ToolsetWithTools, TransportError, Usage, UsageInfo, Voice, VoiceEventData, VoiceEventType, VoiceMetadata, VoiceOptions, VoltAgent, VoltAgentError, VoltAgentExporter, VoltAgentExporterOptions, checkForUpdates, createHooks, createNodeId, createPrompt, createReasoningTools, createRetrieverTool, createTool, createToolkit, VoltAgent as default, getNodeTypeFromNodeId, serializeValueForDebug, tool, updateAllPackages, updateSinglePackage, zodSchemaToJsonUI };
|