@voltagent/core 0.1.67 → 0.1.69
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 +59 -0
- package/dist/index.js +22 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -884,6 +884,11 @@ type MessageFilterOptions = {
|
|
|
884
884
|
* Only retrieve messages with this role
|
|
885
885
|
*/
|
|
886
886
|
role?: BaseMessage["role"];
|
|
887
|
+
/**
|
|
888
|
+
* Only retrieve messages with these types
|
|
889
|
+
* If not specified, all message types are returned
|
|
890
|
+
*/
|
|
891
|
+
types?: Array<"text" | "tool-call" | "tool-result">;
|
|
887
892
|
};
|
|
888
893
|
/**
|
|
889
894
|
* Conversation type
|
|
@@ -2427,6 +2432,14 @@ type ProviderTextResponse<TOriginalResponse> = {
|
|
|
2427
2432
|
* Finish reason (if applicable)
|
|
2428
2433
|
*/
|
|
2429
2434
|
finishReason?: string;
|
|
2435
|
+
/**
|
|
2436
|
+
* Reasoning text from the model (if applicable)
|
|
2437
|
+
*/
|
|
2438
|
+
reasoning?: string;
|
|
2439
|
+
/**
|
|
2440
|
+
* Warnings from the model provider (if applicable)
|
|
2441
|
+
*/
|
|
2442
|
+
warnings?: any[];
|
|
2430
2443
|
};
|
|
2431
2444
|
type TextDeltaStreamPart = {
|
|
2432
2445
|
type: "text-delta";
|
|
@@ -2494,6 +2507,30 @@ type ProviderTextStreamResponse<TOriginalResponse> = {
|
|
|
2494
2507
|
* Optional - only available in providers that support it
|
|
2495
2508
|
*/
|
|
2496
2509
|
fullStream?: AsyncIterable<StreamPart>;
|
|
2510
|
+
/**
|
|
2511
|
+
* The full generated text.
|
|
2512
|
+
* Resolved when the response is finished.
|
|
2513
|
+
* Optional - only available in providers that support it.
|
|
2514
|
+
*/
|
|
2515
|
+
text?: Promise<string>;
|
|
2516
|
+
/**
|
|
2517
|
+
* The reason why generation stopped.
|
|
2518
|
+
* Resolved when the response is finished.
|
|
2519
|
+
* Optional - only available in providers that support it.
|
|
2520
|
+
*/
|
|
2521
|
+
finishReason?: Promise<string>;
|
|
2522
|
+
/**
|
|
2523
|
+
* Token usage information.
|
|
2524
|
+
* Resolved when the response is finished.
|
|
2525
|
+
* Optional - only available in providers that support it.
|
|
2526
|
+
*/
|
|
2527
|
+
usage?: Promise<UsageInfo>;
|
|
2528
|
+
/**
|
|
2529
|
+
* Model's reasoning text (if available).
|
|
2530
|
+
* Resolved when the response is finished.
|
|
2531
|
+
* Optional - only available in providers that support it.
|
|
2532
|
+
*/
|
|
2533
|
+
reasoning?: Promise<string | undefined>;
|
|
2497
2534
|
};
|
|
2498
2535
|
/**
|
|
2499
2536
|
* Response type for object generation operations
|
|
@@ -2515,6 +2552,10 @@ type ProviderObjectResponse<TOriginalResponse, TObject> = {
|
|
|
2515
2552
|
* Finish reason (if applicable)
|
|
2516
2553
|
*/
|
|
2517
2554
|
finishReason?: string;
|
|
2555
|
+
/**
|
|
2556
|
+
* Warnings from the model provider (if applicable)
|
|
2557
|
+
*/
|
|
2558
|
+
warnings?: any[];
|
|
2518
2559
|
};
|
|
2519
2560
|
/**
|
|
2520
2561
|
* Response type for object streaming operations
|
|
@@ -2528,6 +2569,24 @@ type ProviderObjectStreamResponse<TOriginalResponse, TObject> = {
|
|
|
2528
2569
|
* Object stream for consuming partial objects
|
|
2529
2570
|
*/
|
|
2530
2571
|
objectStream: AsyncIterableStream<Partial<TObject>>;
|
|
2572
|
+
/**
|
|
2573
|
+
* The generated object (typed according to the schema).
|
|
2574
|
+
* Resolved when the response is finished.
|
|
2575
|
+
* Optional - only available in providers that support it.
|
|
2576
|
+
*/
|
|
2577
|
+
object?: Promise<TObject>;
|
|
2578
|
+
/**
|
|
2579
|
+
* Token usage information.
|
|
2580
|
+
* Resolved when the response is finished.
|
|
2581
|
+
* Optional - only available in providers that support it.
|
|
2582
|
+
*/
|
|
2583
|
+
usage?: Promise<UsageInfo>;
|
|
2584
|
+
/**
|
|
2585
|
+
* Warnings from the model provider.
|
|
2586
|
+
* Resolved when the response is finished.
|
|
2587
|
+
* Optional - only available in providers that support it.
|
|
2588
|
+
*/
|
|
2589
|
+
warnings?: Promise<any[] | undefined>;
|
|
2531
2590
|
};
|
|
2532
2591
|
/**
|
|
2533
2592
|
* Data content type for binary data
|
package/dist/index.js
CHANGED
|
@@ -5026,7 +5026,15 @@ var LibSQLStorage = class {
|
|
|
5026
5026
|
async getMessages(options = {}) {
|
|
5027
5027
|
await this.initialized;
|
|
5028
5028
|
await debugDelay();
|
|
5029
|
-
const {
|
|
5029
|
+
const {
|
|
5030
|
+
userId = "default",
|
|
5031
|
+
conversationId = "default",
|
|
5032
|
+
limit,
|
|
5033
|
+
before,
|
|
5034
|
+
after,
|
|
5035
|
+
role,
|
|
5036
|
+
types
|
|
5037
|
+
} = options;
|
|
5030
5038
|
const messagesTableName = `${this.options.tablePrefix}_messages`;
|
|
5031
5039
|
const conversationsTableName = `${this.options.tablePrefix}_conversations`;
|
|
5032
5040
|
try {
|
|
@@ -5057,6 +5065,11 @@ var LibSQLStorage = class {
|
|
|
5057
5065
|
conditions.push("m.role = ?");
|
|
5058
5066
|
args.push(role);
|
|
5059
5067
|
}
|
|
5068
|
+
if (types) {
|
|
5069
|
+
const placeholders = types.map(() => "?").join(", ");
|
|
5070
|
+
conditions.push(`m.type IN (${placeholders})`);
|
|
5071
|
+
args.push(...types);
|
|
5072
|
+
}
|
|
5060
5073
|
if (conditions.length > 0) {
|
|
5061
5074
|
sql += ` WHERE ${conditions.join(" AND ")}`;
|
|
5062
5075
|
}
|
|
@@ -7960,7 +7973,8 @@ var InMemoryStorage = class {
|
|
|
7960
7973
|
limit = this.options.storageLimit,
|
|
7961
7974
|
before,
|
|
7962
7975
|
after,
|
|
7963
|
-
role
|
|
7976
|
+
role,
|
|
7977
|
+
types
|
|
7964
7978
|
} = options;
|
|
7965
7979
|
this.debug(
|
|
7966
7980
|
`Getting messages for user ${userId} and conversation ${conversationId} with options`,
|
|
@@ -7972,6 +7986,9 @@ var InMemoryStorage = class {
|
|
|
7972
7986
|
if (role) {
|
|
7973
7987
|
filteredMessages = filteredMessages.filter((m) => m.role === role);
|
|
7974
7988
|
}
|
|
7989
|
+
if (types) {
|
|
7990
|
+
filteredMessages = filteredMessages.filter((m) => types.includes(m.type));
|
|
7991
|
+
}
|
|
7975
7992
|
if (before) {
|
|
7976
7993
|
filteredMessages = filteredMessages.filter(
|
|
7977
7994
|
(m) => new Date(m.createdAt).getTime() < new Date(before).getTime()
|
|
@@ -8894,7 +8911,9 @@ var MemoryManager = class {
|
|
|
8894
8911
|
const memoryMessages = await this.conversationMemory.getMessages({
|
|
8895
8912
|
userId,
|
|
8896
8913
|
conversationId,
|
|
8897
|
-
limit: contextLimit
|
|
8914
|
+
limit: contextLimit,
|
|
8915
|
+
types: ["text"]
|
|
8916
|
+
// Only retrieve text messages for conversation context
|
|
8898
8917
|
});
|
|
8899
8918
|
messages = memoryMessages.map((m) => ({
|
|
8900
8919
|
role: m.role,
|