@aigne/core 1.58.0 → 1.58.1
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/CHANGELOG.md +7 -0
- package/lib/cjs/agents/agent.d.ts +1 -1
- package/lib/cjs/agents/chat-model.d.ts +2 -1
- package/lib/cjs/agents/chat-model.js +10 -0
- package/lib/dts/agents/agent.d.ts +1 -1
- package/lib/dts/agents/chat-model.d.ts +2 -1
- package/lib/esm/agents/agent.d.ts +1 -1
- package/lib/esm/agents/chat-model.d.ts +2 -1
- package/lib/esm/agents/chat-model.js +10 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.58.1](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.58.0...core-v1.58.1) (2025-09-05)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* should not return local path from aigne hub service ([#460](https://github.com/AIGNE-io/aigne-framework/issues/460)) ([c959717](https://github.com/AIGNE-io/aigne-framework/commit/c95971774f7e84dbeb3313f60b3e6464e2bb22e4))
|
|
9
|
+
|
|
3
10
|
## [1.58.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.57.5...core-v1.58.0) (2025-09-05)
|
|
4
11
|
|
|
5
12
|
|
|
@@ -432,7 +432,7 @@ export declare abstract class Agent<I extends Message = any, O extends Message =
|
|
|
432
432
|
* @param options Invocation options
|
|
433
433
|
* @returns Final processed output
|
|
434
434
|
*/
|
|
435
|
-
|
|
435
|
+
protected processAgentOutput(input: I, output: Exclude<AgentResponse<O>, AgentResponseStream<O>>, options: AgentInvokeOptions): Promise<O>;
|
|
436
436
|
/**
|
|
437
437
|
* Process errors that occur during agent execution
|
|
438
438
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { type PromiseOrValue } from "../utils/type-utils.js";
|
|
3
|
-
import { Agent, type AgentInvokeOptions, type AgentOptions, type AgentProcessResult, type Message } from "./agent.js";
|
|
3
|
+
import { Agent, type AgentInvokeOptions, type AgentOptions, type AgentProcessResult, type AgentResponse, type AgentResponseStream, type Message } from "./agent.js";
|
|
4
4
|
export declare class StructuredOutputError extends Error {
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
@@ -104,6 +104,7 @@ export declare abstract class ChatModel extends Agent<ChatModelInput, ChatModelO
|
|
|
104
104
|
* @returns A promise or direct value containing the model's response
|
|
105
105
|
*/
|
|
106
106
|
abstract process(input: ChatModelInput, options: AgentInvokeOptions): PromiseOrValue<AgentProcessResult<ChatModelOutput>>;
|
|
107
|
+
protected processAgentOutput(input: ChatModelInput, output: Exclude<AgentResponse<ChatModelOutput>, AgentResponseStream<ChatModelOutput>>, options: AgentInvokeOptions): Promise<ChatModelOutput>;
|
|
107
108
|
transformFileOutput(input: ChatModelInput, data: FileUnionContent, options: AgentInvokeOptions): Promise<FileUnionContent>;
|
|
108
109
|
static getFileExtension(type: string): string | undefined;
|
|
109
110
|
static getMimeType(filename: string): string | undefined;
|
|
@@ -214,6 +214,16 @@ class ChatModel extends agent_js_1.Agent {
|
|
|
214
214
|
options.context.usage.aigneHubCredits += usage.aigneHubCredits;
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
+
async processAgentOutput(input, output, options) {
|
|
218
|
+
if (output.files) {
|
|
219
|
+
const files = zod_1.z.array(exports.fileUnionContentSchema).parse(output.files);
|
|
220
|
+
output = {
|
|
221
|
+
...output,
|
|
222
|
+
files: await Promise.all(files.map((file) => this.transformFileOutput(input, file, options))),
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
return super.processAgentOutput(input, output, options);
|
|
226
|
+
}
|
|
217
227
|
async transformFileOutput(input, data, options) {
|
|
218
228
|
const fileOutputType = input.fileOutputType || FileOutputType.local;
|
|
219
229
|
if (fileOutputType === data.type)
|
|
@@ -432,7 +432,7 @@ export declare abstract class Agent<I extends Message = any, O extends Message =
|
|
|
432
432
|
* @param options Invocation options
|
|
433
433
|
* @returns Final processed output
|
|
434
434
|
*/
|
|
435
|
-
|
|
435
|
+
protected processAgentOutput(input: I, output: Exclude<AgentResponse<O>, AgentResponseStream<O>>, options: AgentInvokeOptions): Promise<O>;
|
|
436
436
|
/**
|
|
437
437
|
* Process errors that occur during agent execution
|
|
438
438
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { type PromiseOrValue } from "../utils/type-utils.js";
|
|
3
|
-
import { Agent, type AgentInvokeOptions, type AgentOptions, type AgentProcessResult, type Message } from "./agent.js";
|
|
3
|
+
import { Agent, type AgentInvokeOptions, type AgentOptions, type AgentProcessResult, type AgentResponse, type AgentResponseStream, type Message } from "./agent.js";
|
|
4
4
|
export declare class StructuredOutputError extends Error {
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
@@ -104,6 +104,7 @@ export declare abstract class ChatModel extends Agent<ChatModelInput, ChatModelO
|
|
|
104
104
|
* @returns A promise or direct value containing the model's response
|
|
105
105
|
*/
|
|
106
106
|
abstract process(input: ChatModelInput, options: AgentInvokeOptions): PromiseOrValue<AgentProcessResult<ChatModelOutput>>;
|
|
107
|
+
protected processAgentOutput(input: ChatModelInput, output: Exclude<AgentResponse<ChatModelOutput>, AgentResponseStream<ChatModelOutput>>, options: AgentInvokeOptions): Promise<ChatModelOutput>;
|
|
107
108
|
transformFileOutput(input: ChatModelInput, data: FileUnionContent, options: AgentInvokeOptions): Promise<FileUnionContent>;
|
|
108
109
|
static getFileExtension(type: string): string | undefined;
|
|
109
110
|
static getMimeType(filename: string): string | undefined;
|
|
@@ -432,7 +432,7 @@ export declare abstract class Agent<I extends Message = any, O extends Message =
|
|
|
432
432
|
* @param options Invocation options
|
|
433
433
|
* @returns Final processed output
|
|
434
434
|
*/
|
|
435
|
-
|
|
435
|
+
protected processAgentOutput(input: I, output: Exclude<AgentResponse<O>, AgentResponseStream<O>>, options: AgentInvokeOptions): Promise<O>;
|
|
436
436
|
/**
|
|
437
437
|
* Process errors that occur during agent execution
|
|
438
438
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { type PromiseOrValue } from "../utils/type-utils.js";
|
|
3
|
-
import { Agent, type AgentInvokeOptions, type AgentOptions, type AgentProcessResult, type Message } from "./agent.js";
|
|
3
|
+
import { Agent, type AgentInvokeOptions, type AgentOptions, type AgentProcessResult, type AgentResponse, type AgentResponseStream, type Message } from "./agent.js";
|
|
4
4
|
export declare class StructuredOutputError extends Error {
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
@@ -104,6 +104,7 @@ export declare abstract class ChatModel extends Agent<ChatModelInput, ChatModelO
|
|
|
104
104
|
* @returns A promise or direct value containing the model's response
|
|
105
105
|
*/
|
|
106
106
|
abstract process(input: ChatModelInput, options: AgentInvokeOptions): PromiseOrValue<AgentProcessResult<ChatModelOutput>>;
|
|
107
|
+
protected processAgentOutput(input: ChatModelInput, output: Exclude<AgentResponse<ChatModelOutput>, AgentResponseStream<ChatModelOutput>>, options: AgentInvokeOptions): Promise<ChatModelOutput>;
|
|
107
108
|
transformFileOutput(input: ChatModelInput, data: FileUnionContent, options: AgentInvokeOptions): Promise<FileUnionContent>;
|
|
108
109
|
static getFileExtension(type: string): string | undefined;
|
|
109
110
|
static getMimeType(filename: string): string | undefined;
|
|
@@ -174,6 +174,16 @@ export class ChatModel extends Agent {
|
|
|
174
174
|
options.context.usage.aigneHubCredits += usage.aigneHubCredits;
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
+
async processAgentOutput(input, output, options) {
|
|
178
|
+
if (output.files) {
|
|
179
|
+
const files = z.array(fileUnionContentSchema).parse(output.files);
|
|
180
|
+
output = {
|
|
181
|
+
...output,
|
|
182
|
+
files: await Promise.all(files.map((file) => this.transformFileOutput(input, file, options))),
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
return super.processAgentOutput(input, output, options);
|
|
186
|
+
}
|
|
177
187
|
async transformFileOutput(input, data, options) {
|
|
178
188
|
const fileOutputType = input.fileOutputType || FileOutputType.local;
|
|
179
189
|
if (fileOutputType === data.type)
|