@aigne/core 1.72.0-beta.2 → 1.72.0-beta.23
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 +261 -0
- package/lib/cjs/agents/agent.d.ts +42 -11
- package/lib/cjs/agents/agent.js +34 -8
- package/lib/cjs/agents/ai-agent.d.ts +63 -4
- package/lib/cjs/agents/ai-agent.js +154 -20
- package/lib/cjs/agents/chat-model.d.ts +157 -0
- package/lib/cjs/agents/chat-model.js +71 -6
- package/lib/cjs/agents/image-agent.d.ts +17 -1
- package/lib/cjs/agents/image-agent.js +16 -0
- package/lib/cjs/agents/image-model.d.ts +12 -2
- package/lib/cjs/agents/image-model.js +1 -1
- package/lib/cjs/agents/mcp-agent.d.ts +17 -0
- package/lib/cjs/agents/mcp-agent.js +18 -0
- package/lib/cjs/agents/model.d.ts +3 -3
- package/lib/cjs/agents/model.js +2 -2
- package/lib/cjs/agents/team-agent.d.ts +55 -0
- package/lib/cjs/agents/team-agent.js +31 -0
- package/lib/cjs/agents/transform-agent.d.ts +12 -0
- package/lib/cjs/agents/transform-agent.js +13 -0
- package/lib/cjs/agents/video-model.d.ts +10 -0
- package/lib/cjs/agents/video-model.js +1 -1
- package/lib/cjs/aigne/context.js +1 -3
- package/lib/cjs/aigne/usage.d.ts +4 -0
- package/lib/cjs/aigne/usage.js +6 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/loader/agent-yaml.d.ts +5 -63
- package/lib/cjs/loader/agent-yaml.js +4 -129
- package/lib/cjs/loader/agents.d.ts +4 -0
- package/lib/cjs/loader/agents.js +17 -0
- package/lib/cjs/loader/index.d.ts +16 -12
- package/lib/cjs/loader/index.js +20 -81
- package/lib/cjs/loader/schema.d.ts +21 -6
- package/lib/cjs/loader/schema.js +60 -1
- package/lib/cjs/memory/recorder.d.ts +4 -4
- package/lib/cjs/memory/retriever.d.ts +4 -4
- package/lib/cjs/prompt/agent-session.d.ts +163 -0
- package/lib/cjs/prompt/agent-session.js +1008 -0
- package/lib/cjs/prompt/compact/compactor.d.ts +7 -0
- package/lib/cjs/prompt/compact/compactor.js +52 -0
- package/lib/cjs/prompt/compact/session-memory-extractor.d.ts +7 -0
- package/lib/cjs/prompt/compact/session-memory-extractor.js +143 -0
- package/lib/cjs/prompt/compact/types.d.ts +336 -0
- package/lib/cjs/prompt/compact/types.js +53 -0
- package/lib/cjs/prompt/compact/user-memory-extractor.d.ts +7 -0
- package/lib/cjs/prompt/compact/user-memory-extractor.js +124 -0
- package/lib/cjs/prompt/context/afs/history.d.ts +5 -1
- package/lib/cjs/prompt/context/afs/history.js +3 -2
- package/lib/cjs/prompt/context/afs/index.js +8 -1
- package/lib/cjs/prompt/prompt-builder.d.ts +11 -9
- package/lib/cjs/prompt/prompt-builder.js +79 -120
- package/lib/cjs/prompt/skills/afs/agent-skill/agent-skill.d.ts +19 -0
- package/lib/cjs/prompt/skills/afs/agent-skill/agent-skill.js +69 -0
- package/lib/cjs/prompt/skills/afs/agent-skill/skill-loader.d.ts +12 -0
- package/lib/cjs/prompt/skills/afs/agent-skill/skill-loader.js +50 -0
- package/lib/cjs/prompt/skills/afs/delete.js +15 -3
- package/lib/cjs/prompt/skills/afs/edit.d.ts +6 -9
- package/lib/cjs/prompt/skills/afs/edit.js +85 -59
- package/lib/cjs/prompt/skills/afs/exec.js +17 -6
- package/lib/cjs/prompt/skills/afs/index.js +4 -1
- package/lib/cjs/prompt/skills/afs/list.d.ts +2 -0
- package/lib/cjs/prompt/skills/afs/list.js +35 -11
- package/lib/cjs/prompt/skills/afs/read.d.ts +9 -3
- package/lib/cjs/prompt/skills/afs/read.js +67 -15
- package/lib/cjs/prompt/skills/afs/rename.js +18 -4
- package/lib/cjs/prompt/skills/afs/search.js +21 -5
- package/lib/cjs/prompt/skills/afs/write.js +20 -6
- package/lib/cjs/prompt/template.d.ts +84 -9
- package/lib/cjs/prompt/template.js +46 -17
- package/lib/cjs/utils/mcp-utils.js +1 -1
- package/lib/cjs/utils/token-estimator.js +1 -1
- package/lib/dts/agents/agent.d.ts +42 -11
- package/lib/dts/agents/ai-agent.d.ts +63 -4
- package/lib/dts/agents/chat-model.d.ts +157 -0
- package/lib/dts/agents/image-agent.d.ts +17 -1
- package/lib/dts/agents/image-model.d.ts +12 -2
- package/lib/dts/agents/mcp-agent.d.ts +17 -0
- package/lib/dts/agents/model.d.ts +3 -3
- package/lib/dts/agents/team-agent.d.ts +55 -0
- package/lib/dts/agents/transform-agent.d.ts +12 -0
- package/lib/dts/agents/video-model.d.ts +10 -0
- package/lib/dts/aigne/context.d.ts +2 -2
- package/lib/dts/aigne/usage.d.ts +4 -0
- package/lib/dts/index.d.ts +1 -0
- package/lib/dts/loader/agent-yaml.d.ts +5 -63
- package/lib/dts/loader/agents.d.ts +4 -0
- package/lib/dts/loader/index.d.ts +16 -12
- package/lib/dts/loader/schema.d.ts +21 -6
- package/lib/dts/memory/recorder.d.ts +4 -4
- package/lib/dts/memory/retriever.d.ts +4 -4
- package/lib/dts/prompt/agent-session.d.ts +163 -0
- package/lib/dts/prompt/compact/compactor.d.ts +7 -0
- package/lib/dts/prompt/compact/session-memory-extractor.d.ts +7 -0
- package/lib/dts/prompt/compact/types.d.ts +336 -0
- package/lib/dts/prompt/compact/user-memory-extractor.d.ts +7 -0
- package/lib/dts/prompt/context/afs/history.d.ts +5 -1
- package/lib/dts/prompt/prompt-builder.d.ts +11 -9
- package/lib/dts/prompt/skills/afs/agent-skill/agent-skill.d.ts +19 -0
- package/lib/dts/prompt/skills/afs/agent-skill/skill-loader.d.ts +12 -0
- package/lib/dts/prompt/skills/afs/edit.d.ts +6 -9
- package/lib/dts/prompt/skills/afs/list.d.ts +2 -0
- package/lib/dts/prompt/skills/afs/read.d.ts +9 -3
- package/lib/dts/prompt/template.d.ts +84 -9
- package/lib/esm/agents/agent.d.ts +42 -11
- package/lib/esm/agents/agent.js +34 -8
- package/lib/esm/agents/ai-agent.d.ts +63 -4
- package/lib/esm/agents/ai-agent.js +154 -20
- package/lib/esm/agents/chat-model.d.ts +157 -0
- package/lib/esm/agents/chat-model.js +70 -5
- package/lib/esm/agents/image-agent.d.ts +17 -1
- package/lib/esm/agents/image-agent.js +16 -0
- package/lib/esm/agents/image-model.d.ts +12 -2
- package/lib/esm/agents/image-model.js +1 -1
- package/lib/esm/agents/mcp-agent.d.ts +17 -0
- package/lib/esm/agents/mcp-agent.js +18 -0
- package/lib/esm/agents/model.d.ts +3 -3
- package/lib/esm/agents/model.js +2 -2
- package/lib/esm/agents/team-agent.d.ts +55 -0
- package/lib/esm/agents/team-agent.js +31 -0
- package/lib/esm/agents/transform-agent.d.ts +12 -0
- package/lib/esm/agents/transform-agent.js +13 -0
- package/lib/esm/agents/video-model.d.ts +10 -0
- package/lib/esm/agents/video-model.js +1 -1
- package/lib/esm/aigne/context.d.ts +2 -2
- package/lib/esm/aigne/context.js +2 -4
- package/lib/esm/aigne/usage.d.ts +4 -0
- package/lib/esm/aigne/usage.js +6 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/loader/agent-yaml.d.ts +5 -63
- package/lib/esm/loader/agent-yaml.js +4 -128
- package/lib/esm/loader/agents.d.ts +4 -0
- package/lib/esm/loader/agents.js +14 -0
- package/lib/esm/loader/index.d.ts +16 -12
- package/lib/esm/loader/index.js +21 -81
- package/lib/esm/loader/schema.d.ts +21 -6
- package/lib/esm/loader/schema.js +57 -0
- package/lib/esm/memory/recorder.d.ts +4 -4
- package/lib/esm/memory/retriever.d.ts +4 -4
- package/lib/esm/prompt/agent-session.d.ts +163 -0
- package/lib/esm/prompt/agent-session.js +968 -0
- package/lib/esm/prompt/compact/compactor.d.ts +7 -0
- package/lib/esm/prompt/compact/compactor.js +48 -0
- package/lib/esm/prompt/compact/session-memory-extractor.d.ts +7 -0
- package/lib/esm/prompt/compact/session-memory-extractor.js +139 -0
- package/lib/esm/prompt/compact/types.d.ts +336 -0
- package/lib/esm/prompt/compact/types.js +50 -0
- package/lib/esm/prompt/compact/user-memory-extractor.d.ts +7 -0
- package/lib/esm/prompt/compact/user-memory-extractor.js +120 -0
- package/lib/esm/prompt/context/afs/history.d.ts +5 -1
- package/lib/esm/prompt/context/afs/history.js +3 -2
- package/lib/esm/prompt/context/afs/index.js +8 -1
- package/lib/esm/prompt/prompt-builder.d.ts +11 -9
- package/lib/esm/prompt/prompt-builder.js +80 -121
- package/lib/esm/prompt/skills/afs/agent-skill/agent-skill.d.ts +19 -0
- package/lib/esm/prompt/skills/afs/agent-skill/agent-skill.js +65 -0
- package/lib/esm/prompt/skills/afs/agent-skill/skill-loader.d.ts +12 -0
- package/lib/esm/prompt/skills/afs/agent-skill/skill-loader.js +43 -0
- package/lib/esm/prompt/skills/afs/delete.js +15 -3
- package/lib/esm/prompt/skills/afs/edit.d.ts +6 -9
- package/lib/esm/prompt/skills/afs/edit.js +85 -59
- package/lib/esm/prompt/skills/afs/exec.js +17 -6
- package/lib/esm/prompt/skills/afs/index.js +4 -1
- package/lib/esm/prompt/skills/afs/list.d.ts +2 -0
- package/lib/esm/prompt/skills/afs/list.js +35 -11
- package/lib/esm/prompt/skills/afs/read.d.ts +9 -3
- package/lib/esm/prompt/skills/afs/read.js +67 -15
- package/lib/esm/prompt/skills/afs/rename.js +18 -4
- package/lib/esm/prompt/skills/afs/search.js +21 -5
- package/lib/esm/prompt/skills/afs/write.js +20 -6
- package/lib/esm/prompt/template.d.ts +84 -9
- package/lib/esm/prompt/template.js +46 -17
- package/lib/esm/utils/mcp-utils.js +1 -1
- package/lib/esm/utils/token-estimator.js +1 -1
- package/package.json +7 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ZodObject, type ZodType } from "zod";
|
|
1
|
+
import z, { type ZodObject, type ZodType } from "zod";
|
|
2
2
|
import { PromptBuilder } from "../prompt/prompt-builder.js";
|
|
3
3
|
import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "./agent.js";
|
|
4
4
|
import { type ImageModelOutput } from "./image-model.js";
|
|
@@ -13,6 +13,22 @@ export declare const imageAgentOptionsSchema: ZodObject<{
|
|
|
13
13
|
}>;
|
|
14
14
|
export declare class ImageAgent<I extends Message = any, O extends ImageModelOutput = any> extends Agent<I, O> {
|
|
15
15
|
tag: string;
|
|
16
|
+
static schema({ filepath }: {
|
|
17
|
+
filepath: string;
|
|
18
|
+
}): z.ZodObject<{
|
|
19
|
+
instructions: z.ZodType<import("../loader/schema.js").Instructions, z.ZodTypeDef, import("../loader/schema.js").Instructions>;
|
|
20
|
+
inputFileKey: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
instructions: import("../loader/schema.js").Instructions;
|
|
23
|
+
inputFileKey?: string | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
instructions: import("../loader/schema.js").Instructions;
|
|
26
|
+
inputFileKey?: string | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
static load<I extends Message = any, O extends Message = any>(options: {
|
|
29
|
+
filepath: string;
|
|
30
|
+
parsed: object;
|
|
31
|
+
}): Promise<Agent<I, O>>;
|
|
16
32
|
static from<I extends Message = any, O extends ImageModelOutput = any>(options: ImageAgentOptions<I, O>): ImageAgent<I, O>;
|
|
17
33
|
constructor(options: ImageAgentOptions<I, O>);
|
|
18
34
|
instructions: PromptBuilder;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
|
+
import { camelizeSchema, getInstructionsSchema, instructionsToPromptBuilder, optionalize, } from "../loader/schema.js";
|
|
2
3
|
import { PromptBuilder } from "../prompt/prompt-builder.js";
|
|
3
4
|
import { checkArguments } from "../utils/type-utils.js";
|
|
4
5
|
import { Agent, agentOptionsSchema, } from "./agent.js";
|
|
@@ -10,6 +11,21 @@ export const imageAgentOptionsSchema = agentOptionsSchema.extend({
|
|
|
10
11
|
});
|
|
11
12
|
export class ImageAgent extends Agent {
|
|
12
13
|
tag = "ImageAgent";
|
|
14
|
+
static schema({ filepath }) {
|
|
15
|
+
const instructionsSchema = getInstructionsSchema({ filepath });
|
|
16
|
+
return camelizeSchema(z.object({
|
|
17
|
+
instructions: instructionsSchema,
|
|
18
|
+
inputFileKey: optionalize(z.string()),
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
static async load(options) {
|
|
22
|
+
const valid = await ImageAgent.schema({ filepath: options.filepath }).parseAsync(options.parsed);
|
|
23
|
+
return new ImageAgent({
|
|
24
|
+
...options.parsed,
|
|
25
|
+
...valid,
|
|
26
|
+
instructions: instructionsToPromptBuilder(valid.instructions),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
13
29
|
static from(options) {
|
|
14
30
|
return new ImageAgent(options);
|
|
15
31
|
}
|
|
@@ -107,8 +107,8 @@ export declare const imageModelInputSchema: z.ZodObject<{
|
|
|
107
107
|
filename?: string | undefined;
|
|
108
108
|
mimeType?: string | undefined;
|
|
109
109
|
})[] | undefined;
|
|
110
|
-
outputFileType?: "local" | "file" | "url" | undefined;
|
|
111
110
|
n?: number | undefined;
|
|
111
|
+
outputFileType?: "local" | "file" | "url" | undefined;
|
|
112
112
|
}, {
|
|
113
113
|
prompt: string;
|
|
114
114
|
modelOptions?: Record<string, unknown> | undefined;
|
|
@@ -128,8 +128,8 @@ export declare const imageModelInputSchema: z.ZodObject<{
|
|
|
128
128
|
filename?: string | undefined;
|
|
129
129
|
mimeType?: string | undefined;
|
|
130
130
|
})[] | undefined;
|
|
131
|
-
outputFileType?: "local" | "file" | "url" | undefined;
|
|
132
131
|
n?: number | undefined;
|
|
132
|
+
outputFileType?: "local" | "file" | "url" | undefined;
|
|
133
133
|
}>;
|
|
134
134
|
export interface ImageModelOutput extends Message {
|
|
135
135
|
images: FileUnionContent[];
|
|
@@ -196,16 +196,22 @@ export declare const imageModelOutputSchema: z.ZodObject<{
|
|
|
196
196
|
inputTokens: z.ZodNumber;
|
|
197
197
|
outputTokens: z.ZodNumber;
|
|
198
198
|
aigneHubCredits: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
199
|
+
cacheCreationInputTokens: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
200
|
+
cacheReadInputTokens: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
199
201
|
creditPrefix: ZodType<"$" | "€" | "¥" | undefined, z.ZodTypeDef, "$" | "€" | "¥" | undefined>;
|
|
200
202
|
}, "strip", z.ZodTypeAny, {
|
|
201
203
|
inputTokens: number;
|
|
202
204
|
outputTokens: number;
|
|
203
205
|
aigneHubCredits?: number | undefined;
|
|
206
|
+
cacheCreationInputTokens?: number | undefined;
|
|
207
|
+
cacheReadInputTokens?: number | undefined;
|
|
204
208
|
creditPrefix?: "$" | "€" | "¥" | undefined;
|
|
205
209
|
}, {
|
|
206
210
|
inputTokens: number;
|
|
207
211
|
outputTokens: number;
|
|
208
212
|
aigneHubCredits?: number | undefined;
|
|
213
|
+
cacheCreationInputTokens?: number | undefined;
|
|
214
|
+
cacheReadInputTokens?: number | undefined;
|
|
209
215
|
creditPrefix?: "$" | "€" | "¥" | undefined;
|
|
210
216
|
}>>;
|
|
211
217
|
model: z.ZodOptional<z.ZodString>;
|
|
@@ -231,6 +237,8 @@ export declare const imageModelOutputSchema: z.ZodObject<{
|
|
|
231
237
|
inputTokens: number;
|
|
232
238
|
outputTokens: number;
|
|
233
239
|
aigneHubCredits?: number | undefined;
|
|
240
|
+
cacheCreationInputTokens?: number | undefined;
|
|
241
|
+
cacheReadInputTokens?: number | undefined;
|
|
234
242
|
creditPrefix?: "$" | "€" | "¥" | undefined;
|
|
235
243
|
} | undefined;
|
|
236
244
|
}, {
|
|
@@ -255,6 +263,8 @@ export declare const imageModelOutputSchema: z.ZodObject<{
|
|
|
255
263
|
inputTokens: number;
|
|
256
264
|
outputTokens: number;
|
|
257
265
|
aigneHubCredits?: number | undefined;
|
|
266
|
+
cacheCreationInputTokens?: number | undefined;
|
|
267
|
+
cacheReadInputTokens?: number | undefined;
|
|
258
268
|
creditPrefix?: "$" | "€" | "¥" | undefined;
|
|
259
269
|
} | undefined;
|
|
260
270
|
}>;
|
|
@@ -67,7 +67,7 @@ export class ImageModel extends Model {
|
|
|
67
67
|
const images = z.array(fileUnionContentSchema).parse(output.images);
|
|
68
68
|
output = {
|
|
69
69
|
...output,
|
|
70
|
-
images: await Promise.all(images.map((image) => this.transformFileType(input.outputFileType, image
|
|
70
|
+
images: await Promise.all(images.map((image) => this.transformFileType(input.outputFileType, image))),
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
return super.processAgentOutput(input, output, options);
|
|
@@ -58,6 +58,23 @@ export type SSEServerParameters = {
|
|
|
58
58
|
*/
|
|
59
59
|
export declare class MCPAgent extends Agent {
|
|
60
60
|
tag: string;
|
|
61
|
+
static schema(): z.ZodObject<{
|
|
62
|
+
url: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
63
|
+
command: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
64
|
+
args: ZodType<string[] | undefined, z.ZodTypeDef, string[] | undefined>;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
url?: string | undefined;
|
|
67
|
+
command?: string | undefined;
|
|
68
|
+
args?: string[] | undefined;
|
|
69
|
+
}, {
|
|
70
|
+
url?: string | undefined;
|
|
71
|
+
command?: string | undefined;
|
|
72
|
+
args?: string[] | undefined;
|
|
73
|
+
}>;
|
|
74
|
+
static load<I extends Message = any, O extends Message = any>(options: {
|
|
75
|
+
filepath: string;
|
|
76
|
+
parsed: object;
|
|
77
|
+
}): Promise<Agent<I, O>>;
|
|
61
78
|
/**
|
|
62
79
|
* Create an MCPAgent from a connection to an SSE server.
|
|
63
80
|
*
|
|
@@ -5,6 +5,7 @@ import { SSEClientTransport, } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
|
5
5
|
import { StreamableHTTPClientTransport, } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
6
6
|
import { UriTemplate } from "@modelcontextprotocol/sdk/shared/uriTemplate.js";
|
|
7
7
|
import { z } from "zod";
|
|
8
|
+
import { optionalize } from "../loader/schema.js";
|
|
8
9
|
import { logger } from "../utils/logger.js";
|
|
9
10
|
import { promptFromMCPPrompt, resourceFromMCPResource, toolFromMCPTool, } from "../utils/mcp-utils.js";
|
|
10
11
|
import { checkArguments, createAccessorArray } from "../utils/type-utils.js";
|
|
@@ -49,6 +50,23 @@ function getMCPServerString(options) {
|
|
|
49
50
|
*/
|
|
50
51
|
export class MCPAgent extends Agent {
|
|
51
52
|
tag = "MCPAgent";
|
|
53
|
+
static schema() {
|
|
54
|
+
return z.object({
|
|
55
|
+
url: optionalize(z.string()),
|
|
56
|
+
command: optionalize(z.string()),
|
|
57
|
+
args: optionalize(z.array(z.string())),
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
static async load(options) {
|
|
61
|
+
const valid = await MCPAgent.schema().parseAsync(options.parsed);
|
|
62
|
+
if (!valid.url && !valid.command) {
|
|
63
|
+
throw new Error(`Missing url or command in mcp agent: ${options.filepath}`);
|
|
64
|
+
}
|
|
65
|
+
return MCPAgent.from({
|
|
66
|
+
...options.parsed,
|
|
67
|
+
...valid,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
52
70
|
static from(options) {
|
|
53
71
|
checkArguments("MCPAgent.from", mcpAgentOptionsSchema, options);
|
|
54
72
|
if (isSSEServerParameters(options)) {
|
|
@@ -17,9 +17,9 @@ export declare abstract class Model<I extends Message = any, O extends Message =
|
|
|
17
17
|
*/
|
|
18
18
|
getModelOptions(input: Message, options: AgentInvokeOptions): Promise<Record<string, unknown>>;
|
|
19
19
|
protected preprocess(input: I, options: AgentInvokeOptions): Promise<void>;
|
|
20
|
-
transformFileType(fileType: "file", data: FileUnionContent
|
|
21
|
-
transformFileType(fileType: "local" | undefined, data: FileUnionContent
|
|
22
|
-
transformFileType(fileType: FileType | undefined, data: FileUnionContent
|
|
20
|
+
transformFileType(fileType: "file", data: FileUnionContent): Promise<FileContent>;
|
|
21
|
+
transformFileType(fileType: "local" | undefined, data: FileUnionContent): Promise<LocalContent>;
|
|
22
|
+
transformFileType(fileType: FileType | undefined, data: FileUnionContent): Promise<FileUnionContent>;
|
|
23
23
|
static getFileExtension(type: string): Promise<string | undefined>;
|
|
24
24
|
static getMimeType(filename: string): Promise<string | undefined>;
|
|
25
25
|
downloadFile(url: string): Promise<Response>;
|
package/lib/esm/agents/model.js
CHANGED
|
@@ -53,13 +53,13 @@ export class Model extends Agent {
|
|
|
53
53
|
Object.assign(input, { modelOptions: await this.getModelOptions(input, options) });
|
|
54
54
|
return super.preprocess(input, options);
|
|
55
55
|
}
|
|
56
|
-
async transformFileType(fileType = "local", data
|
|
56
|
+
async transformFileType(fileType = "local", data) {
|
|
57
57
|
if (fileType === data.type)
|
|
58
58
|
return data;
|
|
59
59
|
const common = pick(data, "filename", "mimeType");
|
|
60
60
|
switch (fileType) {
|
|
61
61
|
case "local": {
|
|
62
|
-
const dir = nodejs.path.join(nodejs.os.tmpdir(),
|
|
62
|
+
const dir = nodejs.path.join(nodejs.os.tmpdir(), v7());
|
|
63
63
|
await nodejs.fs.mkdir(dir, { recursive: true });
|
|
64
64
|
const ext = await Model.getFileExtension(data.mimeType || data.filename || "");
|
|
65
65
|
const id = v7();
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AgentLoadOptions } from "../loader/index.js";
|
|
1
3
|
import { type PromiseOrValue } from "../utils/type-utils.js";
|
|
2
4
|
import { Agent, type AgentInvokeOptions, type AgentOptions, type AgentProcessResult, type Message } from "./agent.js";
|
|
3
5
|
/**
|
|
@@ -200,6 +202,59 @@ export interface TeamAgentOptions<I extends Message, O extends Message> extends
|
|
|
200
202
|
*/
|
|
201
203
|
export declare class TeamAgent<I extends Message, O extends Message> extends Agent<I, O> {
|
|
202
204
|
tag: string;
|
|
205
|
+
static schema({ filepath }: {
|
|
206
|
+
filepath: string;
|
|
207
|
+
}): z.ZodObject<{
|
|
208
|
+
mode: z.ZodType<ProcessMode | undefined, z.ZodTypeDef, ProcessMode | undefined>;
|
|
209
|
+
iterateOn: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
210
|
+
concurrency: z.ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
211
|
+
iterateWithPreviousOutput: z.ZodType<boolean | undefined, z.ZodTypeDef, boolean | undefined>;
|
|
212
|
+
includeAllStepsOutput: z.ZodType<boolean | undefined, z.ZodTypeDef, boolean | undefined>;
|
|
213
|
+
reflection: z.ZodType<{
|
|
214
|
+
reviewer: import("../loader/agent-yaml.js").NestAgentSchema;
|
|
215
|
+
isApproved: string;
|
|
216
|
+
maxIterations?: number | undefined;
|
|
217
|
+
returnLastOnMaxIterations?: boolean | undefined;
|
|
218
|
+
customErrorMessage?: string | undefined;
|
|
219
|
+
} | undefined, z.ZodTypeDef, {
|
|
220
|
+
reviewer: import("../loader/agent-yaml.js").NestAgentSchema;
|
|
221
|
+
isApproved: string;
|
|
222
|
+
maxIterations?: number | undefined;
|
|
223
|
+
returnLastOnMaxIterations?: boolean | undefined;
|
|
224
|
+
customErrorMessage?: string | undefined;
|
|
225
|
+
} | undefined>;
|
|
226
|
+
}, "strip", z.ZodTypeAny, {
|
|
227
|
+
mode?: ProcessMode | undefined;
|
|
228
|
+
reflection?: {
|
|
229
|
+
reviewer: import("../loader/agent-yaml.js").NestAgentSchema;
|
|
230
|
+
isApproved: string;
|
|
231
|
+
maxIterations?: number | undefined;
|
|
232
|
+
returnLastOnMaxIterations?: boolean | undefined;
|
|
233
|
+
customErrorMessage?: string | undefined;
|
|
234
|
+
} | undefined;
|
|
235
|
+
iterateOn?: string | undefined;
|
|
236
|
+
concurrency?: number | undefined;
|
|
237
|
+
iterateWithPreviousOutput?: boolean | undefined;
|
|
238
|
+
includeAllStepsOutput?: boolean | undefined;
|
|
239
|
+
}, {
|
|
240
|
+
mode?: ProcessMode | undefined;
|
|
241
|
+
reflection?: {
|
|
242
|
+
reviewer: import("../loader/agent-yaml.js").NestAgentSchema;
|
|
243
|
+
isApproved: string;
|
|
244
|
+
maxIterations?: number | undefined;
|
|
245
|
+
returnLastOnMaxIterations?: boolean | undefined;
|
|
246
|
+
customErrorMessage?: string | undefined;
|
|
247
|
+
} | undefined;
|
|
248
|
+
iterateOn?: string | undefined;
|
|
249
|
+
concurrency?: number | undefined;
|
|
250
|
+
iterateWithPreviousOutput?: boolean | undefined;
|
|
251
|
+
includeAllStepsOutput?: boolean | undefined;
|
|
252
|
+
}>;
|
|
253
|
+
static load<I extends Message = any, O extends Message = any>(options: {
|
|
254
|
+
filepath: string;
|
|
255
|
+
parsed: object;
|
|
256
|
+
options: AgentLoadOptions;
|
|
257
|
+
}): Promise<Agent<I, O>>;
|
|
203
258
|
/**
|
|
204
259
|
* Create a TeamAgent from the provided options.
|
|
205
260
|
*
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import assert from "node:assert";
|
|
2
2
|
import { produce } from "immer";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { getNestAgentSchema } from "../loader/agent-yaml.js";
|
|
5
|
+
import { camelizeSchema, optionalize } from "../loader/schema.js";
|
|
3
6
|
import * as fastq from "../utils/queue.js";
|
|
4
7
|
import { mergeAgentResponseChunk } from "../utils/stream-utils.js";
|
|
5
8
|
import { isEmpty, isNil, isRecord, omit } from "../utils/type-utils.js";
|
|
@@ -47,6 +50,34 @@ export const DEFAULT_REFLECTION_MAX_ITERATIONS = 3;
|
|
|
47
50
|
*/
|
|
48
51
|
export class TeamAgent extends Agent {
|
|
49
52
|
tag = "TeamAgent";
|
|
53
|
+
static schema({ filepath }) {
|
|
54
|
+
const nestAgentSchema = getNestAgentSchema({ filepath });
|
|
55
|
+
return z.object({
|
|
56
|
+
mode: optionalize(z.nativeEnum(ProcessMode)),
|
|
57
|
+
iterateOn: optionalize(z.string()),
|
|
58
|
+
concurrency: optionalize(z.number().int().min(1)),
|
|
59
|
+
iterateWithPreviousOutput: optionalize(z.boolean()),
|
|
60
|
+
includeAllStepsOutput: optionalize(z.boolean()),
|
|
61
|
+
reflection: camelizeSchema(optionalize(z.object({
|
|
62
|
+
reviewer: nestAgentSchema,
|
|
63
|
+
isApproved: z.string(),
|
|
64
|
+
maxIterations: optionalize(z.number().int().min(1)),
|
|
65
|
+
returnLastOnMaxIterations: optionalize(z.boolean()),
|
|
66
|
+
customErrorMessage: optionalize(z.string()),
|
|
67
|
+
}))),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
static async load(options) {
|
|
71
|
+
const valid = await TeamAgent.schema({ filepath: options.filepath }).parseAsync(options.parsed);
|
|
72
|
+
return TeamAgent.from({
|
|
73
|
+
...options.parsed,
|
|
74
|
+
...valid,
|
|
75
|
+
reflection: valid.reflection && {
|
|
76
|
+
...valid.reflection,
|
|
77
|
+
reviewer: await options.options.loadNestAgent(options.filepath, valid.reflection.reviewer, options.options),
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
}
|
|
50
81
|
/**
|
|
51
82
|
* Create a TeamAgent from the provided options.
|
|
52
83
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
import { Agent, type AgentOptions, type Message } from "./agent.js";
|
|
2
3
|
/**
|
|
3
4
|
* Configuration options for TransformAgent
|
|
@@ -47,6 +48,17 @@ export interface TransformAgentOptions<I extends Message, O extends Message> ext
|
|
|
47
48
|
*/
|
|
48
49
|
export declare class TransformAgent<I extends Message = Message, O extends Message = Message> extends Agent<I, O> {
|
|
49
50
|
static type: string;
|
|
51
|
+
static schema(): z.ZodObject<{
|
|
52
|
+
jsonata: z.ZodString;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
jsonata: string;
|
|
55
|
+
}, {
|
|
56
|
+
jsonata: string;
|
|
57
|
+
}>;
|
|
58
|
+
static load<I extends Message = any, O extends Message = any>(options: {
|
|
59
|
+
filepath: string;
|
|
60
|
+
parsed: object;
|
|
61
|
+
}): Promise<Agent<I, O>>;
|
|
50
62
|
/**
|
|
51
63
|
* Factory method to create a new TransformAgent instance
|
|
52
64
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import jsonata from "jsonata";
|
|
2
|
+
import { z } from "zod";
|
|
2
3
|
import { Agent } from "./agent.js";
|
|
3
4
|
/**
|
|
4
5
|
* TransformAgent - A specialized agent for data transformation using JSONata expressions
|
|
@@ -17,6 +18,18 @@ import { Agent } from "./agent.js";
|
|
|
17
18
|
*/
|
|
18
19
|
export class TransformAgent extends Agent {
|
|
19
20
|
static type = "TransformAgent";
|
|
21
|
+
static schema() {
|
|
22
|
+
return z.object({
|
|
23
|
+
jsonata: z.string(),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
static async load(options) {
|
|
27
|
+
const parsed = await TransformAgent.schema().parseAsync(options.parsed);
|
|
28
|
+
return TransformAgent.from({
|
|
29
|
+
...options.parsed,
|
|
30
|
+
...parsed,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
20
33
|
/**
|
|
21
34
|
* Factory method to create a new TransformAgent instance
|
|
22
35
|
*
|
|
@@ -203,16 +203,22 @@ export declare const videoModelOutputSchema: z.ZodObject<{
|
|
|
203
203
|
inputTokens: z.ZodNumber;
|
|
204
204
|
outputTokens: z.ZodNumber;
|
|
205
205
|
aigneHubCredits: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
206
|
+
cacheCreationInputTokens: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
207
|
+
cacheReadInputTokens: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
206
208
|
creditPrefix: ZodType<"$" | "€" | "¥" | undefined, z.ZodTypeDef, "$" | "€" | "¥" | undefined>;
|
|
207
209
|
}, "strip", z.ZodTypeAny, {
|
|
208
210
|
inputTokens: number;
|
|
209
211
|
outputTokens: number;
|
|
210
212
|
aigneHubCredits?: number | undefined;
|
|
213
|
+
cacheCreationInputTokens?: number | undefined;
|
|
214
|
+
cacheReadInputTokens?: number | undefined;
|
|
211
215
|
creditPrefix?: "$" | "€" | "¥" | undefined;
|
|
212
216
|
}, {
|
|
213
217
|
inputTokens: number;
|
|
214
218
|
outputTokens: number;
|
|
215
219
|
aigneHubCredits?: number | undefined;
|
|
220
|
+
cacheCreationInputTokens?: number | undefined;
|
|
221
|
+
cacheReadInputTokens?: number | undefined;
|
|
216
222
|
creditPrefix?: "$" | "€" | "¥" | undefined;
|
|
217
223
|
}>>;
|
|
218
224
|
model: z.ZodOptional<z.ZodString>;
|
|
@@ -239,6 +245,8 @@ export declare const videoModelOutputSchema: z.ZodObject<{
|
|
|
239
245
|
inputTokens: number;
|
|
240
246
|
outputTokens: number;
|
|
241
247
|
aigneHubCredits?: number | undefined;
|
|
248
|
+
cacheCreationInputTokens?: number | undefined;
|
|
249
|
+
cacheReadInputTokens?: number | undefined;
|
|
242
250
|
creditPrefix?: "$" | "€" | "¥" | undefined;
|
|
243
251
|
} | undefined;
|
|
244
252
|
seconds?: number | undefined;
|
|
@@ -264,6 +272,8 @@ export declare const videoModelOutputSchema: z.ZodObject<{
|
|
|
264
272
|
inputTokens: number;
|
|
265
273
|
outputTokens: number;
|
|
266
274
|
aigneHubCredits?: number | undefined;
|
|
275
|
+
cacheCreationInputTokens?: number | undefined;
|
|
276
|
+
cacheReadInputTokens?: number | undefined;
|
|
267
277
|
creditPrefix?: "$" | "€" | "¥" | undefined;
|
|
268
278
|
} | undefined;
|
|
269
279
|
seconds?: number | undefined;
|
|
@@ -40,7 +40,7 @@ export class VideoModel extends Model {
|
|
|
40
40
|
const videos = z.array(fileUnionContentSchema).parse(output.videos);
|
|
41
41
|
output = {
|
|
42
42
|
...output,
|
|
43
|
-
videos: await Promise.all(videos.map((video) => this.transformFileType(input.outputFileType, video
|
|
43
|
+
videos: await Promise.all(videos.map((video) => this.transformFileType(input.outputFileType, video))),
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
return super.processAgentOutput(input, output, options);
|
|
@@ -159,7 +159,7 @@ export declare class AIGNEContext implements Context {
|
|
|
159
159
|
readonly internal: AIGNEContextShared;
|
|
160
160
|
get messageQueue(): MessageQueue;
|
|
161
161
|
get model(): ChatModel | undefined;
|
|
162
|
-
get imageModel(): ImageModel<import("../
|
|
162
|
+
get imageModel(): ImageModel<import("../index.js").ImageModelInput, import("../index.js").ImageModelOutput> | undefined;
|
|
163
163
|
get skills(): Agent<any, any>[] | undefined;
|
|
164
164
|
get agents(): Agent<any, any>[];
|
|
165
165
|
get observer(): AIGNEObserver | undefined;
|
|
@@ -197,7 +197,7 @@ declare class AIGNEContextShared {
|
|
|
197
197
|
readonly messageQueue: MessageQueue;
|
|
198
198
|
readonly events: Emitter<any>;
|
|
199
199
|
get model(): ChatModel | undefined;
|
|
200
|
-
get imageModel(): ImageModel<import("../
|
|
200
|
+
get imageModel(): ImageModel<import("../index.js").ImageModelInput, import("../index.js").ImageModelOutput> | undefined;
|
|
201
201
|
get skills(): Agent<any, any>[] | undefined;
|
|
202
202
|
get agents(): Agent<any, any>[];
|
|
203
203
|
get observer(): AIGNEObserver | undefined;
|
package/lib/esm/aigne/context.js
CHANGED
|
@@ -10,7 +10,7 @@ import { AgentResponseProgressStream } from "../utils/event-stream.js";
|
|
|
10
10
|
import { logger } from "../utils/logger.js";
|
|
11
11
|
import { promiseWithResolvers } from "../utils/promise.js";
|
|
12
12
|
import { agentResponseStreamToObject, asyncGeneratorToReadableStream, mergeReadableStreams, onAgentResponseStreamEnd, } from "../utils/stream-utils.js";
|
|
13
|
-
import { checkArguments, flat, isEmpty, isNil, omit, } from "../utils/type-utils.js";
|
|
13
|
+
import { checkArguments, flat, isEmpty, isNil, omit, pick, } from "../utils/type-utils.js";
|
|
14
14
|
import { MessageQueue, toMessagePayload, } from "./message-queue.js";
|
|
15
15
|
import { newEmptyContextUsage } from "./usage.js";
|
|
16
16
|
/**
|
|
@@ -340,11 +340,9 @@ class AIGNEContextShared {
|
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
const stream = await activeAgent.invoke(input, {
|
|
343
|
-
|
|
343
|
+
...pick(options, "hooks", "model", "imageModel", "caller"),
|
|
344
344
|
context,
|
|
345
345
|
streaming: true,
|
|
346
|
-
model: options.model,
|
|
347
|
-
imageModel: options.imageModel,
|
|
348
346
|
});
|
|
349
347
|
for await (const value of stream) {
|
|
350
348
|
if (isAgentResponseDelta(value)) {
|
package/lib/esm/aigne/usage.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ export interface ContextUsage {
|
|
|
8
8
|
creditPrefix?: "$" | "€" | "¥";
|
|
9
9
|
agentCalls: number;
|
|
10
10
|
duration: number;
|
|
11
|
+
/** Number of tokens written to cache (first time caching) */
|
|
12
|
+
cacheCreationInputTokens: number;
|
|
13
|
+
/** Number of tokens read from cache (cache hit) */
|
|
14
|
+
cacheReadInputTokens: number;
|
|
11
15
|
}
|
|
12
16
|
/**
|
|
13
17
|
* @hidden
|
package/lib/esm/aigne/usage.js
CHANGED
|
@@ -8,6 +8,8 @@ export function newEmptyContextUsage() {
|
|
|
8
8
|
aigneHubCredits: 0,
|
|
9
9
|
agentCalls: 0,
|
|
10
10
|
duration: 0,
|
|
11
|
+
cacheCreationInputTokens: 0,
|
|
12
|
+
cacheReadInputTokens: 0,
|
|
11
13
|
};
|
|
12
14
|
}
|
|
13
15
|
export function mergeContextUsage(usage, additional) {
|
|
@@ -21,4 +23,8 @@ export function mergeContextUsage(usage, additional) {
|
|
|
21
23
|
usage.agentCalls += additional.agentCalls;
|
|
22
24
|
if (additional.duration)
|
|
23
25
|
usage.duration += additional.duration;
|
|
26
|
+
if (additional.cacheCreationInputTokens)
|
|
27
|
+
usage.cacheCreationInputTokens += additional.cacheCreationInputTokens;
|
|
28
|
+
if (additional.cacheReadInputTokens)
|
|
29
|
+
usage.cacheReadInputTokens += additional.cacheReadInputTokens;
|
|
24
30
|
}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./agents/user-agent.js";
|
|
|
13
13
|
export * from "./agents/video-model.js";
|
|
14
14
|
export * from "./aigne/index.js";
|
|
15
15
|
export * from "./memory/index.js";
|
|
16
|
+
export * from "./prompt/agent-session.js";
|
|
16
17
|
export * from "./prompt/prompt-builder.js";
|
|
17
18
|
export * from "./prompt/template.js";
|
|
18
19
|
export * from "./utils/json-utils.js";
|
package/lib/esm/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./agents/user-agent.js";
|
|
|
13
13
|
export * from "./agents/video-model.js";
|
|
14
14
|
export * from "./aigne/index.js";
|
|
15
15
|
export * from "./memory/index.js";
|
|
16
|
+
export * from "./prompt/agent-session.js";
|
|
16
17
|
export * from "./prompt/prompt-builder.js";
|
|
17
18
|
export * from "./prompt/template.js";
|
|
18
19
|
export * from "./utils/json-utils.js";
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { AFSOptions } from "@aigne/afs";
|
|
2
2
|
import { type ZodType, z } from "zod";
|
|
3
|
-
import type {
|
|
4
|
-
import { AIAgentToolChoice } from "../agents/ai-agent.js";
|
|
5
|
-
import { type Role } from "../agents/chat-model.js";
|
|
6
|
-
import { ProcessMode, type ReflectionMode } from "../agents/team-agent.js";
|
|
3
|
+
import type { AgentHooks, TaskRenderMode } from "../agents/agent.js";
|
|
7
4
|
import type { LoadOptions } from "./index.js";
|
|
8
5
|
import { chatModelSchema, imageModelSchema } from "./schema.js";
|
|
9
6
|
export interface HooksSchema {
|
|
@@ -45,7 +42,8 @@ export interface AFSContextSchema {
|
|
|
45
42
|
presets?: Record<string, AFSContextPresetSchema>;
|
|
46
43
|
};
|
|
47
44
|
}
|
|
48
|
-
export interface
|
|
45
|
+
export interface AgentSchema {
|
|
46
|
+
type: string;
|
|
49
47
|
name?: string;
|
|
50
48
|
description?: string;
|
|
51
49
|
model?: z.infer<typeof chatModelSchema>;
|
|
@@ -67,67 +65,11 @@ export interface BaseAgentSchema {
|
|
|
67
65
|
context?: AFSContextSchema;
|
|
68
66
|
});
|
|
69
67
|
shareAFS?: boolean;
|
|
68
|
+
[key: string]: unknown;
|
|
70
69
|
}
|
|
71
|
-
export type Instructions = {
|
|
72
|
-
role: Exclude<Role, "tool">;
|
|
73
|
-
content: string;
|
|
74
|
-
path: string;
|
|
75
|
-
}[];
|
|
76
|
-
export interface AIAgentSchema extends BaseAgentSchema {
|
|
77
|
-
type: "ai";
|
|
78
|
-
instructions?: Instructions;
|
|
79
|
-
autoReorderSystemMessages?: boolean;
|
|
80
|
-
autoMergeSystemMessages?: boolean;
|
|
81
|
-
inputKey?: string;
|
|
82
|
-
inputFileKey?: string;
|
|
83
|
-
outputKey?: string;
|
|
84
|
-
outputFileKey?: string;
|
|
85
|
-
toolChoice?: AIAgentToolChoice;
|
|
86
|
-
toolCallsConcurrency?: number;
|
|
87
|
-
keepTextInToolUses?: boolean;
|
|
88
|
-
}
|
|
89
|
-
export interface ImageAgentSchema extends BaseAgentSchema {
|
|
90
|
-
type: "image";
|
|
91
|
-
instructions: Instructions;
|
|
92
|
-
inputFileKey?: string;
|
|
93
|
-
}
|
|
94
|
-
export interface MCPAgentSchema extends BaseAgentSchema {
|
|
95
|
-
type: "mcp";
|
|
96
|
-
url?: string;
|
|
97
|
-
command?: string;
|
|
98
|
-
args?: string[];
|
|
99
|
-
}
|
|
100
|
-
export interface TeamAgentSchema extends BaseAgentSchema {
|
|
101
|
-
type: "team";
|
|
102
|
-
mode?: ProcessMode;
|
|
103
|
-
iterateOn?: string;
|
|
104
|
-
concurrency?: number;
|
|
105
|
-
iterateWithPreviousOutput?: boolean;
|
|
106
|
-
includeAllStepsOutput?: boolean;
|
|
107
|
-
reflection?: Omit<ReflectionMode, "reviewer"> & {
|
|
108
|
-
reviewer: NestAgentSchema;
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
export interface TransformAgentSchema extends BaseAgentSchema {
|
|
112
|
-
type: "transform";
|
|
113
|
-
jsonata: string;
|
|
114
|
-
}
|
|
115
|
-
export interface FunctionAgentSchema extends BaseAgentSchema {
|
|
116
|
-
type: "function";
|
|
117
|
-
process: FunctionAgentFn;
|
|
118
|
-
}
|
|
119
|
-
export interface ThirdAgentSchema extends BaseAgentSchema {
|
|
120
|
-
agentClass?: AgentClass;
|
|
121
|
-
type: "";
|
|
122
|
-
[key: string]: any;
|
|
123
|
-
}
|
|
124
|
-
export type AgentSchema = AIAgentSchema | ImageAgentSchema | MCPAgentSchema | TeamAgentSchema | TransformAgentSchema | FunctionAgentSchema | ThirdAgentSchema;
|
|
125
70
|
export declare function parseAgentFile(path: string, data: any, options: LoadOptions): Promise<AgentSchema>;
|
|
126
71
|
export declare function loadAgentFromYamlFile(path: string, options: LoadOptions): Promise<AgentSchema>;
|
|
127
|
-
export declare const
|
|
128
|
-
filepath: string;
|
|
129
|
-
}) => ZodType<Instructions>;
|
|
130
|
-
export declare const getAgentSchema: ({ filepath, options, }: {
|
|
72
|
+
export declare const getAgentSchema: ({ filepath }: {
|
|
131
73
|
filepath: string;
|
|
132
74
|
options?: LoadOptions;
|
|
133
75
|
}) => ZodType<AgentSchema, z.ZodTypeDef, AgentSchema>;
|