@aigne/core 1.72.0-beta.3 → 1.72.0-beta.5
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 +27 -0
- package/lib/cjs/agents/agent.d.ts +31 -1
- package/lib/cjs/agents/agent.js +13 -0
- package/lib/cjs/agents/ai-agent.d.ts +7 -0
- package/lib/cjs/agents/ai-agent.js +85 -3
- 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 +4 -4
- package/lib/cjs/agents/mcp-agent.d.ts +17 -0
- package/lib/cjs/agents/mcp-agent.js +18 -0
- 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 +4 -4
- package/lib/cjs/loader/agent-yaml.d.ts +5 -67
- package/lib/cjs/loader/agent-yaml.js +4 -139
- package/lib/cjs/loader/agents.d.ts +4 -0
- package/lib/cjs/loader/agents.js +17 -0
- package/lib/cjs/loader/index.d.ts +18 -14
- 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/prompt/prompt-builder.js +0 -1
- package/lib/cjs/prompt/skills/afs/agent-skill/agent-skill.d.ts +17 -0
- package/lib/cjs/prompt/skills/afs/agent-skill/agent-skill.js +63 -0
- package/lib/cjs/prompt/skills/afs/agent-skill/skill-loader.d.ts +13 -0
- package/lib/cjs/prompt/skills/afs/agent-skill/skill-loader.js +61 -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.js +26 -10
- package/lib/cjs/prompt/skills/afs/read.d.ts +6 -2
- package/lib/cjs/prompt/skills/afs/read.js +62 -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 +23 -23
- package/lib/dts/agents/agent.d.ts +31 -1
- package/lib/dts/agents/ai-agent.d.ts +7 -0
- package/lib/dts/agents/image-agent.d.ts +17 -1
- package/lib/dts/agents/image-model.d.ts +4 -4
- package/lib/dts/agents/mcp-agent.d.ts +17 -0
- 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 +4 -4
- package/lib/dts/aigne/context.d.ts +2 -2
- package/lib/dts/loader/agent-yaml.d.ts +5 -67
- package/lib/dts/loader/agents.d.ts +4 -0
- package/lib/dts/loader/index.d.ts +18 -14
- package/lib/dts/loader/schema.d.ts +21 -6
- package/lib/dts/prompt/skills/afs/agent-skill/agent-skill.d.ts +17 -0
- package/lib/dts/prompt/skills/afs/agent-skill/skill-loader.d.ts +13 -0
- package/lib/dts/prompt/skills/afs/edit.d.ts +6 -9
- package/lib/dts/prompt/skills/afs/read.d.ts +6 -2
- package/lib/dts/prompt/template.d.ts +25 -25
- package/lib/esm/agents/agent.d.ts +31 -1
- package/lib/esm/agents/agent.js +13 -0
- package/lib/esm/agents/ai-agent.d.ts +7 -0
- package/lib/esm/agents/ai-agent.js +85 -3
- 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 +4 -4
- package/lib/esm/agents/mcp-agent.d.ts +17 -0
- package/lib/esm/agents/mcp-agent.js +18 -0
- 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 +4 -4
- package/lib/esm/aigne/context.d.ts +2 -2
- package/lib/esm/loader/agent-yaml.d.ts +5 -67
- package/lib/esm/loader/agent-yaml.js +4 -138
- package/lib/esm/loader/agents.d.ts +4 -0
- package/lib/esm/loader/agents.js +14 -0
- package/lib/esm/loader/index.d.ts +18 -14
- 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/prompt/prompt-builder.js +1 -2
- package/lib/esm/prompt/skills/afs/agent-skill/agent-skill.d.ts +17 -0
- package/lib/esm/prompt/skills/afs/agent-skill/agent-skill.js +59 -0
- package/lib/esm/prompt/skills/afs/agent-skill/skill-loader.d.ts +13 -0
- package/lib/esm/prompt/skills/afs/agent-skill/skill-loader.js +53 -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.js +26 -10
- package/lib/esm/prompt/skills/afs/read.d.ts +6 -2
- package/lib/esm/prompt/skills/afs/read.js +62 -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 +25 -25
- package/package.json +5 -4
|
@@ -4,16 +4,30 @@ export class AFSWriteAgent extends AFSSkillBase {
|
|
|
4
4
|
constructor(options) {
|
|
5
5
|
super({
|
|
6
6
|
name: "afs_write",
|
|
7
|
-
description:
|
|
7
|
+
description: `Write or create files in the Agentic File System (AFS)
|
|
8
|
+
- Creates a new file or overwrites an existing file with the provided content
|
|
9
|
+
- Supports append mode to add content to the end of existing files
|
|
10
|
+
- Use this tool when creating new files or completely replacing file contents
|
|
11
|
+
|
|
12
|
+
Usage:
|
|
13
|
+
- The path must be an absolute AFS path starting with "/" (e.g., "/docs/new-file.md", "/memory/user/notes")
|
|
14
|
+
- This is NOT a local system file path - it operates within the AFS virtual file system
|
|
15
|
+
- By default, this tool overwrites the entire file content
|
|
16
|
+
- Use append mode to add content to the end of an existing file without replacing it
|
|
17
|
+
- For partial edits to existing files, prefer using afs_edit instead`,
|
|
8
18
|
...options,
|
|
9
19
|
inputSchema: z.object({
|
|
10
|
-
path: z
|
|
11
|
-
|
|
20
|
+
path: z
|
|
21
|
+
.string()
|
|
22
|
+
.describe("Absolute AFS path for the file to write (e.g., '/docs/new-file.md'). Must start with '/'"),
|
|
23
|
+
content: z
|
|
24
|
+
.string()
|
|
25
|
+
.describe("The content to write to the file. In overwrite mode, this replaces the entire file"),
|
|
12
26
|
append: z
|
|
13
27
|
.boolean()
|
|
14
28
|
.optional()
|
|
15
29
|
.default(false)
|
|
16
|
-
.describe("
|
|
30
|
+
.describe("Set to true to append content to the end of an existing file. Default: false (overwrites entire file)"),
|
|
17
31
|
}),
|
|
18
32
|
outputSchema: z.object({
|
|
19
33
|
status: z.string(),
|
|
@@ -26,7 +40,7 @@ export class AFSWriteAgent extends AFSSkillBase {
|
|
|
26
40
|
async process(input, _options) {
|
|
27
41
|
if (!this.afs)
|
|
28
42
|
throw new Error("AFS is not configured for this agent.");
|
|
29
|
-
const
|
|
43
|
+
const _result = await this.afs.write(input.path, {
|
|
30
44
|
content: input.content,
|
|
31
45
|
}, {
|
|
32
46
|
append: input.append ?? false,
|
|
@@ -35,7 +49,7 @@ export class AFSWriteAgent extends AFSSkillBase {
|
|
|
35
49
|
status: "success",
|
|
36
50
|
tool: "afs_write",
|
|
37
51
|
path: input.path,
|
|
38
|
-
|
|
52
|
+
message: "File written successfully",
|
|
39
53
|
};
|
|
40
54
|
}
|
|
41
55
|
}
|
|
@@ -42,11 +42,11 @@ export declare class AgentMessageTemplate extends ChatMessageTemplate {
|
|
|
42
42
|
static from(template?: ChatModelInputMessage["content"], toolCalls?: ChatModelOutputToolCall[], name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]): AgentMessageTemplate;
|
|
43
43
|
constructor(content?: ChatModelInputMessage["content"], toolCalls?: ChatModelOutputToolCall[] | undefined, name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]);
|
|
44
44
|
format(_variables?: Record<string, unknown>, _options?: FormatOptions): Promise<{
|
|
45
|
-
role: "
|
|
45
|
+
role: "system" | "user" | "agent" | "tool";
|
|
46
46
|
name: string | undefined;
|
|
47
47
|
content: ChatModelInputMessageContent | undefined;
|
|
48
48
|
toolCalls: ChatModelOutputToolCall[] | undefined;
|
|
49
|
-
cacheControl: import("../
|
|
49
|
+
cacheControl: import("../index.js").CacheControl | undefined;
|
|
50
50
|
}>;
|
|
51
51
|
}
|
|
52
52
|
export declare class ToolMessageTemplate extends ChatMessageTemplate {
|
|
@@ -54,11 +54,11 @@ export declare class ToolMessageTemplate extends ChatMessageTemplate {
|
|
|
54
54
|
static from(content: object | string, toolCallId: string, name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]): ToolMessageTemplate;
|
|
55
55
|
constructor(content: object | string, toolCallId: string, name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]);
|
|
56
56
|
format(_variables?: Record<string, unknown>, _options?: FormatOptions): Promise<{
|
|
57
|
-
role: "
|
|
57
|
+
role: "system" | "user" | "agent" | "tool";
|
|
58
58
|
name: string | undefined;
|
|
59
59
|
content: ChatModelInputMessageContent | undefined;
|
|
60
60
|
toolCallId: string;
|
|
61
|
-
cacheControl: import("../
|
|
61
|
+
cacheControl: import("../index.js").CacheControl | undefined;
|
|
62
62
|
}>;
|
|
63
63
|
}
|
|
64
64
|
export declare class ChatMessagesTemplate {
|
|
@@ -83,21 +83,21 @@ declare const chatMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
83
83
|
ttl?: "5m" | "1h" | undefined;
|
|
84
84
|
}>>;
|
|
85
85
|
}, "strip", z.ZodTypeAny, {
|
|
86
|
-
role: "system";
|
|
87
86
|
content: string;
|
|
88
|
-
|
|
87
|
+
role: "system";
|
|
89
88
|
cacheControl?: {
|
|
90
89
|
type: "ephemeral";
|
|
91
90
|
ttl?: "5m" | "1h" | undefined;
|
|
92
91
|
} | undefined;
|
|
92
|
+
name?: string | undefined;
|
|
93
93
|
}, {
|
|
94
|
-
role: "system";
|
|
95
94
|
content: string;
|
|
96
|
-
|
|
95
|
+
role: "system";
|
|
97
96
|
cacheControl?: {
|
|
98
97
|
type: "ephemeral";
|
|
99
98
|
ttl?: "5m" | "1h" | undefined;
|
|
100
99
|
} | undefined;
|
|
100
|
+
name?: string | undefined;
|
|
101
101
|
}>, z.ZodObject<{
|
|
102
102
|
role: z.ZodLiteral<"user">;
|
|
103
103
|
content: z.ZodString;
|
|
@@ -113,21 +113,21 @@ declare const chatMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
113
113
|
ttl?: "5m" | "1h" | undefined;
|
|
114
114
|
}>>;
|
|
115
115
|
}, "strip", z.ZodTypeAny, {
|
|
116
|
-
role: "user";
|
|
117
116
|
content: string;
|
|
118
|
-
|
|
117
|
+
role: "user";
|
|
119
118
|
cacheControl?: {
|
|
120
119
|
type: "ephemeral";
|
|
121
120
|
ttl?: "5m" | "1h" | undefined;
|
|
122
121
|
} | undefined;
|
|
122
|
+
name?: string | undefined;
|
|
123
123
|
}, {
|
|
124
|
-
role: "user";
|
|
125
124
|
content: string;
|
|
126
|
-
|
|
125
|
+
role: "user";
|
|
127
126
|
cacheControl?: {
|
|
128
127
|
type: "ephemeral";
|
|
129
128
|
ttl?: "5m" | "1h" | undefined;
|
|
130
129
|
} | undefined;
|
|
130
|
+
name?: string | undefined;
|
|
131
131
|
}>, z.ZodObject<{
|
|
132
132
|
role: z.ZodLiteral<"agent">;
|
|
133
133
|
content: z.ZodOptional<z.ZodString>;
|
|
@@ -172,8 +172,11 @@ declare const chatMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
172
172
|
}>>;
|
|
173
173
|
}, "strip", z.ZodTypeAny, {
|
|
174
174
|
role: "agent";
|
|
175
|
-
name?: string | undefined;
|
|
176
175
|
content?: string | undefined;
|
|
176
|
+
cacheControl?: {
|
|
177
|
+
type: "ephemeral";
|
|
178
|
+
ttl?: "5m" | "1h" | undefined;
|
|
179
|
+
} | undefined;
|
|
177
180
|
toolCalls?: {
|
|
178
181
|
function: {
|
|
179
182
|
name: string;
|
|
@@ -182,14 +185,14 @@ declare const chatMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
182
185
|
type: "function";
|
|
183
186
|
id: string;
|
|
184
187
|
}[] | undefined;
|
|
188
|
+
name?: string | undefined;
|
|
189
|
+
}, {
|
|
190
|
+
role: "agent";
|
|
191
|
+
content?: string | undefined;
|
|
185
192
|
cacheControl?: {
|
|
186
193
|
type: "ephemeral";
|
|
187
194
|
ttl?: "5m" | "1h" | undefined;
|
|
188
195
|
} | undefined;
|
|
189
|
-
}, {
|
|
190
|
-
role: "agent";
|
|
191
|
-
name?: string | undefined;
|
|
192
|
-
content?: string | undefined;
|
|
193
196
|
toolCalls?: {
|
|
194
197
|
function: {
|
|
195
198
|
name: string;
|
|
@@ -198,10 +201,7 @@ declare const chatMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
198
201
|
type: "function";
|
|
199
202
|
id: string;
|
|
200
203
|
}[] | undefined;
|
|
201
|
-
|
|
202
|
-
type: "ephemeral";
|
|
203
|
-
ttl?: "5m" | "1h" | undefined;
|
|
204
|
-
} | undefined;
|
|
204
|
+
name?: string | undefined;
|
|
205
205
|
}>, z.ZodObject<{
|
|
206
206
|
role: z.ZodLiteral<"tool">;
|
|
207
207
|
content: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>, string, string | Record<string, unknown>>;
|
|
@@ -218,23 +218,23 @@ declare const chatMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
218
218
|
ttl?: "5m" | "1h" | undefined;
|
|
219
219
|
}>>;
|
|
220
220
|
}, "strip", z.ZodTypeAny, {
|
|
221
|
-
role: "tool";
|
|
222
221
|
content: string;
|
|
222
|
+
role: "tool";
|
|
223
223
|
toolCallId: string;
|
|
224
|
-
name?: string | undefined;
|
|
225
224
|
cacheControl?: {
|
|
226
225
|
type: "ephemeral";
|
|
227
226
|
ttl?: "5m" | "1h" | undefined;
|
|
228
227
|
} | undefined;
|
|
228
|
+
name?: string | undefined;
|
|
229
229
|
}, {
|
|
230
|
-
role: "tool";
|
|
231
230
|
content: string | Record<string, unknown>;
|
|
231
|
+
role: "tool";
|
|
232
232
|
toolCallId: string;
|
|
233
|
-
name?: string | undefined;
|
|
234
233
|
cacheControl?: {
|
|
235
234
|
type: "ephemeral";
|
|
236
235
|
ttl?: "5m" | "1h" | undefined;
|
|
237
236
|
} | undefined;
|
|
237
|
+
name?: string | undefined;
|
|
238
238
|
}>]>;
|
|
239
239
|
export declare function safeParseChatMessages(messages: unknown): ChatMessageTemplate[] | undefined;
|
|
240
240
|
export declare function parseChatMessages(messages: (z.infer<typeof chatMessageSchema> & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/core",
|
|
3
|
-
"version": "1.72.0-beta.
|
|
3
|
+
"version": "1.72.0-beta.5",
|
|
4
4
|
"description": "The functional core of agentic AI",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"debug": "^4.4.3",
|
|
79
79
|
"eventsource-parser": "^3.0.6",
|
|
80
80
|
"fast-deep-equal": "^3.1.3",
|
|
81
|
+
"front-matter": "^4.0.2",
|
|
81
82
|
"immer": "^10.1.3",
|
|
82
83
|
"is-network-error": "^1.2.0",
|
|
83
84
|
"jaison": "^2.0.2",
|
|
@@ -92,10 +93,10 @@
|
|
|
92
93
|
"zod": "^3.25.67",
|
|
93
94
|
"zod-from-json-schema": "^0.0.5",
|
|
94
95
|
"zod-to-json-schema": "^3.24.6",
|
|
95
|
-
"@aigne/afs": "^1.4.0-beta.
|
|
96
|
-
"@aigne/platform-helpers": "^0.6.7-beta",
|
|
96
|
+
"@aigne/afs": "^1.4.0-beta.3",
|
|
97
97
|
"@aigne/observability-api": "^0.11.14-beta.1",
|
|
98
|
-
"@aigne/afs-history": "^1.2.0-beta.
|
|
98
|
+
"@aigne/afs-history": "^1.2.0-beta.3",
|
|
99
|
+
"@aigne/platform-helpers": "^0.6.7-beta"
|
|
99
100
|
},
|
|
100
101
|
"devDependencies": {
|
|
101
102
|
"@types/bun": "^1.2.22",
|