@aigne/core 1.72.0 → 1.73.0-beta
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 +19 -0
- package/lib/cjs/aigne/type.d.ts +1 -0
- package/lib/cjs/loader/index.d.ts +4 -0
- package/lib/cjs/loader/index.js +3 -1
- package/lib/cjs/prompt/skills/afs/delete.d.ts +1 -1
- package/lib/cjs/prompt/skills/afs/delete.js +2 -1
- package/lib/cjs/prompt/skills/afs/edit.d.ts +1 -1
- package/lib/cjs/prompt/skills/afs/edit.js +3 -5
- package/lib/cjs/prompt/skills/afs/exec.js +1 -1
- package/lib/cjs/prompt/skills/afs/list.d.ts +1 -1
- package/lib/cjs/prompt/skills/afs/list.js +2 -1
- package/lib/cjs/prompt/skills/afs/read.d.ts +1 -1
- package/lib/cjs/prompt/skills/afs/read.js +2 -2
- package/lib/cjs/prompt/skills/afs/rename.d.ts +1 -1
- package/lib/cjs/prompt/skills/afs/rename.js +2 -1
- package/lib/cjs/prompt/skills/afs/search.d.ts +1 -1
- package/lib/cjs/prompt/skills/afs/search.js +5 -2
- package/lib/cjs/prompt/skills/afs/write.d.ts +1 -1
- package/lib/cjs/prompt/skills/afs/write.js +2 -1
- package/lib/dts/aigne/type.d.ts +1 -0
- package/lib/dts/loader/index.d.ts +4 -0
- package/lib/dts/prompt/skills/afs/delete.d.ts +1 -1
- package/lib/dts/prompt/skills/afs/edit.d.ts +1 -1
- package/lib/dts/prompt/skills/afs/list.d.ts +1 -1
- package/lib/dts/prompt/skills/afs/read.d.ts +1 -1
- package/lib/dts/prompt/skills/afs/rename.d.ts +1 -1
- package/lib/dts/prompt/skills/afs/search.d.ts +1 -1
- package/lib/dts/prompt/skills/afs/write.d.ts +1 -1
- package/lib/esm/aigne/type.d.ts +1 -0
- package/lib/esm/loader/index.d.ts +4 -0
- package/lib/esm/loader/index.js +3 -1
- package/lib/esm/prompt/skills/afs/delete.d.ts +1 -1
- package/lib/esm/prompt/skills/afs/delete.js +2 -1
- package/lib/esm/prompt/skills/afs/edit.d.ts +1 -1
- package/lib/esm/prompt/skills/afs/edit.js +3 -5
- package/lib/esm/prompt/skills/afs/exec.js +1 -1
- package/lib/esm/prompt/skills/afs/list.d.ts +1 -1
- package/lib/esm/prompt/skills/afs/list.js +2 -1
- package/lib/esm/prompt/skills/afs/read.d.ts +1 -1
- package/lib/esm/prompt/skills/afs/read.js +2 -2
- package/lib/esm/prompt/skills/afs/rename.d.ts +1 -1
- package/lib/esm/prompt/skills/afs/rename.js +2 -1
- package/lib/esm/prompt/skills/afs/search.d.ts +1 -1
- package/lib/esm/prompt/skills/afs/search.js +5 -2
- package/lib/esm/prompt/skills/afs/write.d.ts +1 -1
- package/lib/esm/prompt/skills/afs/write.js +2 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.73.0-beta](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.72.0...core-v1.73.0-beta) (2026-01-20)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **cli:** add init agent support for aigne.yaml#cli ([#929](https://github.com/AIGNE-io/aigne-framework/issues/929)) ([32249b3](https://github.com/AIGNE-io/aigne-framework/commit/32249b3f59b4c9b0cbece8c169c3c34529034ebc))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **core:** invoke afs methods with aigne context ([#930](https://github.com/AIGNE-io/aigne-framework/issues/930)) ([9cd7107](https://github.com/AIGNE-io/aigne-framework/commit/9cd7107e773112a625e6ca340ef862c7589c784e))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Dependencies
|
|
17
|
+
|
|
18
|
+
* The following workspace dependencies were updated
|
|
19
|
+
* dependencies
|
|
20
|
+
* @aigne/afs-history bumped to 1.3.0-beta
|
|
21
|
+
|
|
3
22
|
## [1.72.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.72.0-beta.25...core-v1.72.0) (2026-01-16)
|
|
4
23
|
|
|
5
24
|
|
package/lib/cjs/aigne/type.d.ts
CHANGED
|
@@ -131,9 +131,11 @@ declare const aigneFileSchema: z.ZodObject<{
|
|
|
131
131
|
} | undefined>;
|
|
132
132
|
cli: ZodType<{
|
|
133
133
|
agents?: CliAgent[] | undefined;
|
|
134
|
+
init?: string | undefined;
|
|
134
135
|
chat?: string | undefined;
|
|
135
136
|
} | undefined, z.ZodTypeDef, {
|
|
136
137
|
agents?: CliAgent[] | undefined;
|
|
138
|
+
init?: string | undefined;
|
|
137
139
|
chat?: string | undefined;
|
|
138
140
|
} | undefined>;
|
|
139
141
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -185,6 +187,7 @@ declare const aigneFileSchema: z.ZodObject<{
|
|
|
185
187
|
} | undefined;
|
|
186
188
|
cli?: {
|
|
187
189
|
agents?: CliAgent[] | undefined;
|
|
190
|
+
init?: string | undefined;
|
|
188
191
|
chat?: string | undefined;
|
|
189
192
|
} | undefined;
|
|
190
193
|
}, {
|
|
@@ -236,6 +239,7 @@ declare const aigneFileSchema: z.ZodObject<{
|
|
|
236
239
|
} | undefined;
|
|
237
240
|
cli?: {
|
|
238
241
|
agents?: CliAgent[] | undefined;
|
|
242
|
+
init?: string | undefined;
|
|
239
243
|
chat?: string | undefined;
|
|
240
244
|
} | undefined;
|
|
241
245
|
}>;
|
package/lib/cjs/loader/index.js
CHANGED
|
@@ -25,7 +25,7 @@ async function load(path, options = {}) {
|
|
|
25
25
|
return [cliAgent];
|
|
26
26
|
return (0, type_utils_js_1.flat)(cliAgent.url, cliAgent.agents?.flatMap(flatCliAgents));
|
|
27
27
|
};
|
|
28
|
-
const allAgentPaths = new Set((0, type_utils_js_1.flat)(aigne.agents, aigne.skills, aigne.mcpServer?.agents, aigne.cli?.chat, aigne.cli?.agents?.flatMap((i) => (typeof i === "string" ? i : flatCliAgents(i)))).map((i) => index_js_1.nodejs.path.join(rootDir, i)));
|
|
28
|
+
const allAgentPaths = new Set((0, type_utils_js_1.flat)(aigne.agents, aigne.skills, aigne.mcpServer?.agents, aigne.cli?.init, aigne.cli?.chat, aigne.cli?.agents?.flatMap((i) => (typeof i === "string" ? i : flatCliAgents(i)))).map((i) => index_js_1.nodejs.path.join(rootDir, i)));
|
|
29
29
|
const allAgents = {};
|
|
30
30
|
for (const path of allAgentPaths) {
|
|
31
31
|
allAgents[path] = await loadAgent(path, { ...options, aigne });
|
|
@@ -56,6 +56,7 @@ async function load(path, options = {}) {
|
|
|
56
56
|
agents: pickAgents(aigne.mcpServer?.agents ?? []),
|
|
57
57
|
},
|
|
58
58
|
cli: {
|
|
59
|
+
init: aigne.cli?.init ? pickAgents([aigne.cli.init])[0] : undefined,
|
|
59
60
|
chat: aigne.cli?.chat ? pickAgents([aigne.cli.chat])[0] : undefined,
|
|
60
61
|
agents: aigne.cli?.agents?.map(mapCliAgents),
|
|
61
62
|
},
|
|
@@ -239,6 +240,7 @@ const aigneFileSchema = (0, schema_js_1.camelizeSchema)(zod_1.z.object({
|
|
|
239
240
|
agents: (0, schema_js_1.optionalize)(zod_1.z.array(zod_1.z.string())),
|
|
240
241
|
})),
|
|
241
242
|
cli: (0, schema_js_1.optionalize)(zod_1.z.object({
|
|
243
|
+
init: (0, schema_js_1.optionalize)(zod_1.z.string()),
|
|
242
244
|
chat: (0, schema_js_1.optionalize)(zod_1.z.string()),
|
|
243
245
|
agents: (0, schema_js_1.optionalize)(zod_1.z.array(cliAgentSchema)),
|
|
244
246
|
})),
|
|
@@ -15,5 +15,5 @@ export interface AFSDeleteAgentOptions extends AgentOptions<AFSDeleteInput, AFSD
|
|
|
15
15
|
}
|
|
16
16
|
export declare class AFSDeleteAgent extends AFSSkillBase<AFSDeleteInput, AFSDeleteOutput> {
|
|
17
17
|
constructor(options: AFSDeleteAgentOptions);
|
|
18
|
-
process(input: AFSDeleteInput,
|
|
18
|
+
process(input: AFSDeleteInput, options: AgentInvokeOptions): Promise<AFSDeleteOutput>;
|
|
19
19
|
}
|
|
@@ -37,11 +37,12 @@ Usage:
|
|
|
37
37
|
}),
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
async process(input,
|
|
40
|
+
async process(input, options) {
|
|
41
41
|
if (!this.afs)
|
|
42
42
|
throw new Error("AFS is not configured for this agent.");
|
|
43
43
|
const result = await this.afs.delete(input.path, {
|
|
44
44
|
recursive: input.recursive ?? false,
|
|
45
|
+
context: options.context,
|
|
45
46
|
});
|
|
46
47
|
return {
|
|
47
48
|
status: "success",
|
|
@@ -18,7 +18,7 @@ export interface AFSEditAgentOptions extends AgentOptions<AFSEditInput, AFSEditO
|
|
|
18
18
|
}
|
|
19
19
|
export declare class AFSEditAgent extends AFSSkillBase<AFSEditInput, AFSEditOutput> {
|
|
20
20
|
constructor(options: AFSEditAgentOptions);
|
|
21
|
-
process(input: AFSEditInput,
|
|
21
|
+
process(input: AFSEditInput, options: AgentInvokeOptions): Promise<AFSEditOutput>;
|
|
22
22
|
private countOccurrences;
|
|
23
23
|
private extractSnippet;
|
|
24
24
|
}
|
|
@@ -43,14 +43,14 @@ Usage:
|
|
|
43
43
|
}),
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
async process(input,
|
|
46
|
+
async process(input, options) {
|
|
47
47
|
if (!this.afs)
|
|
48
48
|
throw new Error("AFS is not configured for this agent.");
|
|
49
49
|
const { path, oldString, newString, replaceAll = false } = input;
|
|
50
50
|
if (oldString === newString) {
|
|
51
51
|
throw new Error("oldString and newString must be different");
|
|
52
52
|
}
|
|
53
|
-
const readResult = await this.afs.read(path);
|
|
53
|
+
const readResult = await this.afs.read(path, { context: options.context });
|
|
54
54
|
if (!readResult.data?.content || typeof readResult.data.content !== "string") {
|
|
55
55
|
throw new Error(`Cannot read file content from: ${path}`);
|
|
56
56
|
}
|
|
@@ -69,9 +69,7 @@ Usage:
|
|
|
69
69
|
const updatedContent = replaceAll
|
|
70
70
|
? originalContent.split(oldString).join(newString)
|
|
71
71
|
: originalContent.replace(oldString, newString);
|
|
72
|
-
await this.afs.write(path, {
|
|
73
|
-
content: updatedContent,
|
|
74
|
-
});
|
|
72
|
+
await this.afs.write(path, { content: updatedContent }, { context: options.context });
|
|
75
73
|
// Generate snippet around the edit location
|
|
76
74
|
const snippet = this.extractSnippet(updatedContent, firstOccurrenceIndex, newString.length);
|
|
77
75
|
const replacementCount = replaceAll ? occurrences : 1;
|
|
@@ -36,7 +36,7 @@ Usage:
|
|
|
36
36
|
if (!this.afs)
|
|
37
37
|
throw new Error("AFS is not configured for this agent.");
|
|
38
38
|
return {
|
|
39
|
-
...(await this.afs.exec(input.path, JSON.parse(input.args), options)),
|
|
39
|
+
...(await this.afs.exec(input.path, JSON.parse(input.args), { context: options.context })),
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -20,5 +20,5 @@ export interface AFSListAgentOptions extends AgentOptions<AFSListInput, AFSListO
|
|
|
20
20
|
export declare class AFSListAgent extends AFSSkillBase<AFSListInput, AFSListOutput> {
|
|
21
21
|
constructor(options: AFSListAgentOptions);
|
|
22
22
|
formatOutput(output: AFSListOutput): PromiseOrValue<string>;
|
|
23
|
-
process(input: AFSListInput,
|
|
23
|
+
process(input: AFSListInput, options: AgentInvokeOptions): Promise<AFSListOutput>;
|
|
24
24
|
}
|
|
@@ -61,12 +61,13 @@ Usage:
|
|
|
61
61
|
return output.data;
|
|
62
62
|
return super.formatOutput(output);
|
|
63
63
|
}
|
|
64
|
-
async process(input,
|
|
64
|
+
async process(input, options) {
|
|
65
65
|
if (!this.afs)
|
|
66
66
|
throw new Error("AFS is not configured for this agent.");
|
|
67
67
|
const { data, message } = await this.afs.list(input.path, {
|
|
68
68
|
...input.options,
|
|
69
69
|
format: "simple-list",
|
|
70
|
+
context: options.context,
|
|
70
71
|
});
|
|
71
72
|
return {
|
|
72
73
|
status: "success",
|
|
@@ -24,5 +24,5 @@ export interface AFSReadAgentOptions extends AgentOptions<AFSReadInput, AFSReadO
|
|
|
24
24
|
export declare class AFSReadAgent extends AFSSkillBase<AFSReadInput, AFSReadOutput> {
|
|
25
25
|
constructor(options: AFSReadAgentOptions);
|
|
26
26
|
formatOutput(output: AFSReadOutput): PromiseOrValue<string>;
|
|
27
|
-
process(input: AFSReadInput,
|
|
27
|
+
process(input: AFSReadInput, options: AgentInvokeOptions): Promise<AFSReadOutput>;
|
|
28
28
|
}
|
|
@@ -56,10 +56,10 @@ Usage:
|
|
|
56
56
|
return output.data.content;
|
|
57
57
|
return super.formatOutput({ ...output, data: output.data || null });
|
|
58
58
|
}
|
|
59
|
-
async process(input,
|
|
59
|
+
async process(input, options) {
|
|
60
60
|
if (!this.afs)
|
|
61
61
|
throw new Error("AFS is not configured for this agent.");
|
|
62
|
-
const result = await this.afs.read(input.path);
|
|
62
|
+
const result = await this.afs.read(input.path, { context: options.context });
|
|
63
63
|
if (!result.data?.content || typeof result.data.content !== "string") {
|
|
64
64
|
return {
|
|
65
65
|
status: "success",
|
|
@@ -17,5 +17,5 @@ export interface AFSRenameAgentOptions extends AgentOptions<AFSRenameInput, AFSR
|
|
|
17
17
|
}
|
|
18
18
|
export declare class AFSRenameAgent extends AFSSkillBase<AFSRenameInput, AFSRenameOutput> {
|
|
19
19
|
constructor(options: AFSRenameAgentOptions);
|
|
20
|
-
process(input: AFSRenameInput,
|
|
20
|
+
process(input: AFSRenameInput, options: AgentInvokeOptions): Promise<AFSRenameOutput>;
|
|
21
21
|
}
|
|
@@ -41,11 +41,12 @@ Usage:
|
|
|
41
41
|
}),
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
async process(input,
|
|
44
|
+
async process(input, options) {
|
|
45
45
|
if (!this.afs)
|
|
46
46
|
throw new Error("AFS is not configured for this agent.");
|
|
47
47
|
const result = await this.afs.rename(input.oldPath, input.newPath, {
|
|
48
48
|
overwrite: input.overwrite ?? false,
|
|
49
|
+
context: options.context,
|
|
49
50
|
});
|
|
50
51
|
return {
|
|
51
52
|
status: "success",
|
|
@@ -20,5 +20,5 @@ export interface AFSSearchAgentOptions extends AgentOptions<AFSSearchInput, AFSS
|
|
|
20
20
|
}
|
|
21
21
|
export declare class AFSSearchAgent extends AFSSkillBase<AFSSearchInput, AFSSearchOutput> {
|
|
22
22
|
constructor(options: AFSSearchAgentOptions);
|
|
23
|
-
process(input: AFSSearchInput,
|
|
23
|
+
process(input: AFSSearchInput, options: AgentInvokeOptions): Promise<AFSSearchOutput>;
|
|
24
24
|
}
|
|
@@ -54,10 +54,13 @@ Usage:
|
|
|
54
54
|
}),
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
async process(input,
|
|
57
|
+
async process(input, options) {
|
|
58
58
|
if (!this.afs)
|
|
59
59
|
throw new Error("AFS is not configured for this agent.");
|
|
60
|
-
const result = await this.afs.search(input.path, input.query,
|
|
60
|
+
const result = await this.afs.search(input.path, input.query, {
|
|
61
|
+
...input.options,
|
|
62
|
+
context: options.context,
|
|
63
|
+
});
|
|
61
64
|
return {
|
|
62
65
|
status: "success",
|
|
63
66
|
tool: "afs_search",
|
|
@@ -16,5 +16,5 @@ export interface AFSWriteAgentOptions extends AgentOptions<AFSWriteInput, AFSWri
|
|
|
16
16
|
}
|
|
17
17
|
export declare class AFSWriteAgent extends AFSSkillBase<AFSWriteInput, AFSWriteOutput> {
|
|
18
18
|
constructor(options: AFSWriteAgentOptions);
|
|
19
|
-
process(input: AFSWriteInput,
|
|
19
|
+
process(input: AFSWriteInput, options: AgentInvokeOptions): Promise<AFSWriteOutput>;
|
|
20
20
|
}
|
|
@@ -40,13 +40,14 @@ Usage:
|
|
|
40
40
|
}),
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
async process(input,
|
|
43
|
+
async process(input, options) {
|
|
44
44
|
if (!this.afs)
|
|
45
45
|
throw new Error("AFS is not configured for this agent.");
|
|
46
46
|
const _result = await this.afs.write(input.path, {
|
|
47
47
|
content: input.content,
|
|
48
48
|
}, {
|
|
49
49
|
append: input.append ?? false,
|
|
50
|
+
context: options.context,
|
|
50
51
|
});
|
|
51
52
|
return {
|
|
52
53
|
status: "success",
|
package/lib/dts/aigne/type.d.ts
CHANGED
|
@@ -131,9 +131,11 @@ declare const aigneFileSchema: z.ZodObject<{
|
|
|
131
131
|
} | undefined>;
|
|
132
132
|
cli: ZodType<{
|
|
133
133
|
agents?: CliAgent[] | undefined;
|
|
134
|
+
init?: string | undefined;
|
|
134
135
|
chat?: string | undefined;
|
|
135
136
|
} | undefined, z.ZodTypeDef, {
|
|
136
137
|
agents?: CliAgent[] | undefined;
|
|
138
|
+
init?: string | undefined;
|
|
137
139
|
chat?: string | undefined;
|
|
138
140
|
} | undefined>;
|
|
139
141
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -185,6 +187,7 @@ declare const aigneFileSchema: z.ZodObject<{
|
|
|
185
187
|
} | undefined;
|
|
186
188
|
cli?: {
|
|
187
189
|
agents?: CliAgent[] | undefined;
|
|
190
|
+
init?: string | undefined;
|
|
188
191
|
chat?: string | undefined;
|
|
189
192
|
} | undefined;
|
|
190
193
|
}, {
|
|
@@ -236,6 +239,7 @@ declare const aigneFileSchema: z.ZodObject<{
|
|
|
236
239
|
} | undefined;
|
|
237
240
|
cli?: {
|
|
238
241
|
agents?: CliAgent[] | undefined;
|
|
242
|
+
init?: string | undefined;
|
|
239
243
|
chat?: string | undefined;
|
|
240
244
|
} | undefined;
|
|
241
245
|
}>;
|
|
@@ -15,5 +15,5 @@ export interface AFSDeleteAgentOptions extends AgentOptions<AFSDeleteInput, AFSD
|
|
|
15
15
|
}
|
|
16
16
|
export declare class AFSDeleteAgent extends AFSSkillBase<AFSDeleteInput, AFSDeleteOutput> {
|
|
17
17
|
constructor(options: AFSDeleteAgentOptions);
|
|
18
|
-
process(input: AFSDeleteInput,
|
|
18
|
+
process(input: AFSDeleteInput, options: AgentInvokeOptions): Promise<AFSDeleteOutput>;
|
|
19
19
|
}
|
|
@@ -18,7 +18,7 @@ export interface AFSEditAgentOptions extends AgentOptions<AFSEditInput, AFSEditO
|
|
|
18
18
|
}
|
|
19
19
|
export declare class AFSEditAgent extends AFSSkillBase<AFSEditInput, AFSEditOutput> {
|
|
20
20
|
constructor(options: AFSEditAgentOptions);
|
|
21
|
-
process(input: AFSEditInput,
|
|
21
|
+
process(input: AFSEditInput, options: AgentInvokeOptions): Promise<AFSEditOutput>;
|
|
22
22
|
private countOccurrences;
|
|
23
23
|
private extractSnippet;
|
|
24
24
|
}
|
|
@@ -20,5 +20,5 @@ export interface AFSListAgentOptions extends AgentOptions<AFSListInput, AFSListO
|
|
|
20
20
|
export declare class AFSListAgent extends AFSSkillBase<AFSListInput, AFSListOutput> {
|
|
21
21
|
constructor(options: AFSListAgentOptions);
|
|
22
22
|
formatOutput(output: AFSListOutput): PromiseOrValue<string>;
|
|
23
|
-
process(input: AFSListInput,
|
|
23
|
+
process(input: AFSListInput, options: AgentInvokeOptions): Promise<AFSListOutput>;
|
|
24
24
|
}
|
|
@@ -24,5 +24,5 @@ export interface AFSReadAgentOptions extends AgentOptions<AFSReadInput, AFSReadO
|
|
|
24
24
|
export declare class AFSReadAgent extends AFSSkillBase<AFSReadInput, AFSReadOutput> {
|
|
25
25
|
constructor(options: AFSReadAgentOptions);
|
|
26
26
|
formatOutput(output: AFSReadOutput): PromiseOrValue<string>;
|
|
27
|
-
process(input: AFSReadInput,
|
|
27
|
+
process(input: AFSReadInput, options: AgentInvokeOptions): Promise<AFSReadOutput>;
|
|
28
28
|
}
|
|
@@ -17,5 +17,5 @@ export interface AFSRenameAgentOptions extends AgentOptions<AFSRenameInput, AFSR
|
|
|
17
17
|
}
|
|
18
18
|
export declare class AFSRenameAgent extends AFSSkillBase<AFSRenameInput, AFSRenameOutput> {
|
|
19
19
|
constructor(options: AFSRenameAgentOptions);
|
|
20
|
-
process(input: AFSRenameInput,
|
|
20
|
+
process(input: AFSRenameInput, options: AgentInvokeOptions): Promise<AFSRenameOutput>;
|
|
21
21
|
}
|
|
@@ -20,5 +20,5 @@ export interface AFSSearchAgentOptions extends AgentOptions<AFSSearchInput, AFSS
|
|
|
20
20
|
}
|
|
21
21
|
export declare class AFSSearchAgent extends AFSSkillBase<AFSSearchInput, AFSSearchOutput> {
|
|
22
22
|
constructor(options: AFSSearchAgentOptions);
|
|
23
|
-
process(input: AFSSearchInput,
|
|
23
|
+
process(input: AFSSearchInput, options: AgentInvokeOptions): Promise<AFSSearchOutput>;
|
|
24
24
|
}
|
|
@@ -16,5 +16,5 @@ export interface AFSWriteAgentOptions extends AgentOptions<AFSWriteInput, AFSWri
|
|
|
16
16
|
}
|
|
17
17
|
export declare class AFSWriteAgent extends AFSSkillBase<AFSWriteInput, AFSWriteOutput> {
|
|
18
18
|
constructor(options: AFSWriteAgentOptions);
|
|
19
|
-
process(input: AFSWriteInput,
|
|
19
|
+
process(input: AFSWriteInput, options: AgentInvokeOptions): Promise<AFSWriteOutput>;
|
|
20
20
|
}
|
package/lib/esm/aigne/type.d.ts
CHANGED
|
@@ -131,9 +131,11 @@ declare const aigneFileSchema: z.ZodObject<{
|
|
|
131
131
|
} | undefined>;
|
|
132
132
|
cli: ZodType<{
|
|
133
133
|
agents?: CliAgent[] | undefined;
|
|
134
|
+
init?: string | undefined;
|
|
134
135
|
chat?: string | undefined;
|
|
135
136
|
} | undefined, z.ZodTypeDef, {
|
|
136
137
|
agents?: CliAgent[] | undefined;
|
|
138
|
+
init?: string | undefined;
|
|
137
139
|
chat?: string | undefined;
|
|
138
140
|
} | undefined>;
|
|
139
141
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -185,6 +187,7 @@ declare const aigneFileSchema: z.ZodObject<{
|
|
|
185
187
|
} | undefined;
|
|
186
188
|
cli?: {
|
|
187
189
|
agents?: CliAgent[] | undefined;
|
|
190
|
+
init?: string | undefined;
|
|
188
191
|
chat?: string | undefined;
|
|
189
192
|
} | undefined;
|
|
190
193
|
}, {
|
|
@@ -236,6 +239,7 @@ declare const aigneFileSchema: z.ZodObject<{
|
|
|
236
239
|
} | undefined;
|
|
237
240
|
cli?: {
|
|
238
241
|
agents?: CliAgent[] | undefined;
|
|
242
|
+
init?: string | undefined;
|
|
239
243
|
chat?: string | undefined;
|
|
240
244
|
} | undefined;
|
|
241
245
|
}>;
|
package/lib/esm/loader/index.js
CHANGED
|
@@ -17,7 +17,7 @@ export async function load(path, options = {}) {
|
|
|
17
17
|
return [cliAgent];
|
|
18
18
|
return flat(cliAgent.url, cliAgent.agents?.flatMap(flatCliAgents));
|
|
19
19
|
};
|
|
20
|
-
const allAgentPaths = new Set(flat(aigne.agents, aigne.skills, aigne.mcpServer?.agents, aigne.cli?.chat, aigne.cli?.agents?.flatMap((i) => (typeof i === "string" ? i : flatCliAgents(i)))).map((i) => nodejs.path.join(rootDir, i)));
|
|
20
|
+
const allAgentPaths = new Set(flat(aigne.agents, aigne.skills, aigne.mcpServer?.agents, aigne.cli?.init, aigne.cli?.chat, aigne.cli?.agents?.flatMap((i) => (typeof i === "string" ? i : flatCliAgents(i)))).map((i) => nodejs.path.join(rootDir, i)));
|
|
21
21
|
const allAgents = {};
|
|
22
22
|
for (const path of allAgentPaths) {
|
|
23
23
|
allAgents[path] = await loadAgent(path, { ...options, aigne });
|
|
@@ -48,6 +48,7 @@ export async function load(path, options = {}) {
|
|
|
48
48
|
agents: pickAgents(aigne.mcpServer?.agents ?? []),
|
|
49
49
|
},
|
|
50
50
|
cli: {
|
|
51
|
+
init: aigne.cli?.init ? pickAgents([aigne.cli.init])[0] : undefined,
|
|
51
52
|
chat: aigne.cli?.chat ? pickAgents([aigne.cli.chat])[0] : undefined,
|
|
52
53
|
agents: aigne.cli?.agents?.map(mapCliAgents),
|
|
53
54
|
},
|
|
@@ -231,6 +232,7 @@ const aigneFileSchema = camelizeSchema(z.object({
|
|
|
231
232
|
agents: optionalize(z.array(z.string())),
|
|
232
233
|
})),
|
|
233
234
|
cli: optionalize(z.object({
|
|
235
|
+
init: optionalize(z.string()),
|
|
234
236
|
chat: optionalize(z.string()),
|
|
235
237
|
agents: optionalize(z.array(cliAgentSchema)),
|
|
236
238
|
})),
|
|
@@ -15,5 +15,5 @@ export interface AFSDeleteAgentOptions extends AgentOptions<AFSDeleteInput, AFSD
|
|
|
15
15
|
}
|
|
16
16
|
export declare class AFSDeleteAgent extends AFSSkillBase<AFSDeleteInput, AFSDeleteOutput> {
|
|
17
17
|
constructor(options: AFSDeleteAgentOptions);
|
|
18
|
-
process(input: AFSDeleteInput,
|
|
18
|
+
process(input: AFSDeleteInput, options: AgentInvokeOptions): Promise<AFSDeleteOutput>;
|
|
19
19
|
}
|
|
@@ -34,11 +34,12 @@ Usage:
|
|
|
34
34
|
}),
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
async process(input,
|
|
37
|
+
async process(input, options) {
|
|
38
38
|
if (!this.afs)
|
|
39
39
|
throw new Error("AFS is not configured for this agent.");
|
|
40
40
|
const result = await this.afs.delete(input.path, {
|
|
41
41
|
recursive: input.recursive ?? false,
|
|
42
|
+
context: options.context,
|
|
42
43
|
});
|
|
43
44
|
return {
|
|
44
45
|
status: "success",
|
|
@@ -18,7 +18,7 @@ export interface AFSEditAgentOptions extends AgentOptions<AFSEditInput, AFSEditO
|
|
|
18
18
|
}
|
|
19
19
|
export declare class AFSEditAgent extends AFSSkillBase<AFSEditInput, AFSEditOutput> {
|
|
20
20
|
constructor(options: AFSEditAgentOptions);
|
|
21
|
-
process(input: AFSEditInput,
|
|
21
|
+
process(input: AFSEditInput, options: AgentInvokeOptions): Promise<AFSEditOutput>;
|
|
22
22
|
private countOccurrences;
|
|
23
23
|
private extractSnippet;
|
|
24
24
|
}
|
|
@@ -40,14 +40,14 @@ Usage:
|
|
|
40
40
|
}),
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
async process(input,
|
|
43
|
+
async process(input, options) {
|
|
44
44
|
if (!this.afs)
|
|
45
45
|
throw new Error("AFS is not configured for this agent.");
|
|
46
46
|
const { path, oldString, newString, replaceAll = false } = input;
|
|
47
47
|
if (oldString === newString) {
|
|
48
48
|
throw new Error("oldString and newString must be different");
|
|
49
49
|
}
|
|
50
|
-
const readResult = await this.afs.read(path);
|
|
50
|
+
const readResult = await this.afs.read(path, { context: options.context });
|
|
51
51
|
if (!readResult.data?.content || typeof readResult.data.content !== "string") {
|
|
52
52
|
throw new Error(`Cannot read file content from: ${path}`);
|
|
53
53
|
}
|
|
@@ -66,9 +66,7 @@ Usage:
|
|
|
66
66
|
const updatedContent = replaceAll
|
|
67
67
|
? originalContent.split(oldString).join(newString)
|
|
68
68
|
: originalContent.replace(oldString, newString);
|
|
69
|
-
await this.afs.write(path, {
|
|
70
|
-
content: updatedContent,
|
|
71
|
-
});
|
|
69
|
+
await this.afs.write(path, { content: updatedContent }, { context: options.context });
|
|
72
70
|
// Generate snippet around the edit location
|
|
73
71
|
const snippet = this.extractSnippet(updatedContent, firstOccurrenceIndex, newString.length);
|
|
74
72
|
const replacementCount = replaceAll ? occurrences : 1;
|
|
@@ -33,7 +33,7 @@ Usage:
|
|
|
33
33
|
if (!this.afs)
|
|
34
34
|
throw new Error("AFS is not configured for this agent.");
|
|
35
35
|
return {
|
|
36
|
-
...(await this.afs.exec(input.path, JSON.parse(input.args), options)),
|
|
36
|
+
...(await this.afs.exec(input.path, JSON.parse(input.args), { context: options.context })),
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -20,5 +20,5 @@ export interface AFSListAgentOptions extends AgentOptions<AFSListInput, AFSListO
|
|
|
20
20
|
export declare class AFSListAgent extends AFSSkillBase<AFSListInput, AFSListOutput> {
|
|
21
21
|
constructor(options: AFSListAgentOptions);
|
|
22
22
|
formatOutput(output: AFSListOutput): PromiseOrValue<string>;
|
|
23
|
-
process(input: AFSListInput,
|
|
23
|
+
process(input: AFSListInput, options: AgentInvokeOptions): Promise<AFSListOutput>;
|
|
24
24
|
}
|
|
@@ -58,12 +58,13 @@ Usage:
|
|
|
58
58
|
return output.data;
|
|
59
59
|
return super.formatOutput(output);
|
|
60
60
|
}
|
|
61
|
-
async process(input,
|
|
61
|
+
async process(input, options) {
|
|
62
62
|
if (!this.afs)
|
|
63
63
|
throw new Error("AFS is not configured for this agent.");
|
|
64
64
|
const { data, message } = await this.afs.list(input.path, {
|
|
65
65
|
...input.options,
|
|
66
66
|
format: "simple-list",
|
|
67
|
+
context: options.context,
|
|
67
68
|
});
|
|
68
69
|
return {
|
|
69
70
|
status: "success",
|
|
@@ -24,5 +24,5 @@ export interface AFSReadAgentOptions extends AgentOptions<AFSReadInput, AFSReadO
|
|
|
24
24
|
export declare class AFSReadAgent extends AFSSkillBase<AFSReadInput, AFSReadOutput> {
|
|
25
25
|
constructor(options: AFSReadAgentOptions);
|
|
26
26
|
formatOutput(output: AFSReadOutput): PromiseOrValue<string>;
|
|
27
|
-
process(input: AFSReadInput,
|
|
27
|
+
process(input: AFSReadInput, options: AgentInvokeOptions): Promise<AFSReadOutput>;
|
|
28
28
|
}
|
|
@@ -53,10 +53,10 @@ Usage:
|
|
|
53
53
|
return output.data.content;
|
|
54
54
|
return super.formatOutput({ ...output, data: output.data || null });
|
|
55
55
|
}
|
|
56
|
-
async process(input,
|
|
56
|
+
async process(input, options) {
|
|
57
57
|
if (!this.afs)
|
|
58
58
|
throw new Error("AFS is not configured for this agent.");
|
|
59
|
-
const result = await this.afs.read(input.path);
|
|
59
|
+
const result = await this.afs.read(input.path, { context: options.context });
|
|
60
60
|
if (!result.data?.content || typeof result.data.content !== "string") {
|
|
61
61
|
return {
|
|
62
62
|
status: "success",
|
|
@@ -17,5 +17,5 @@ export interface AFSRenameAgentOptions extends AgentOptions<AFSRenameInput, AFSR
|
|
|
17
17
|
}
|
|
18
18
|
export declare class AFSRenameAgent extends AFSSkillBase<AFSRenameInput, AFSRenameOutput> {
|
|
19
19
|
constructor(options: AFSRenameAgentOptions);
|
|
20
|
-
process(input: AFSRenameInput,
|
|
20
|
+
process(input: AFSRenameInput, options: AgentInvokeOptions): Promise<AFSRenameOutput>;
|
|
21
21
|
}
|
|
@@ -38,11 +38,12 @@ Usage:
|
|
|
38
38
|
}),
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
async process(input,
|
|
41
|
+
async process(input, options) {
|
|
42
42
|
if (!this.afs)
|
|
43
43
|
throw new Error("AFS is not configured for this agent.");
|
|
44
44
|
const result = await this.afs.rename(input.oldPath, input.newPath, {
|
|
45
45
|
overwrite: input.overwrite ?? false,
|
|
46
|
+
context: options.context,
|
|
46
47
|
});
|
|
47
48
|
return {
|
|
48
49
|
status: "success",
|
|
@@ -20,5 +20,5 @@ export interface AFSSearchAgentOptions extends AgentOptions<AFSSearchInput, AFSS
|
|
|
20
20
|
}
|
|
21
21
|
export declare class AFSSearchAgent extends AFSSkillBase<AFSSearchInput, AFSSearchOutput> {
|
|
22
22
|
constructor(options: AFSSearchAgentOptions);
|
|
23
|
-
process(input: AFSSearchInput,
|
|
23
|
+
process(input: AFSSearchInput, options: AgentInvokeOptions): Promise<AFSSearchOutput>;
|
|
24
24
|
}
|
|
@@ -51,10 +51,13 @@ Usage:
|
|
|
51
51
|
}),
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
async process(input,
|
|
54
|
+
async process(input, options) {
|
|
55
55
|
if (!this.afs)
|
|
56
56
|
throw new Error("AFS is not configured for this agent.");
|
|
57
|
-
const result = await this.afs.search(input.path, input.query,
|
|
57
|
+
const result = await this.afs.search(input.path, input.query, {
|
|
58
|
+
...input.options,
|
|
59
|
+
context: options.context,
|
|
60
|
+
});
|
|
58
61
|
return {
|
|
59
62
|
status: "success",
|
|
60
63
|
tool: "afs_search",
|
|
@@ -16,5 +16,5 @@ export interface AFSWriteAgentOptions extends AgentOptions<AFSWriteInput, AFSWri
|
|
|
16
16
|
}
|
|
17
17
|
export declare class AFSWriteAgent extends AFSSkillBase<AFSWriteInput, AFSWriteOutput> {
|
|
18
18
|
constructor(options: AFSWriteAgentOptions);
|
|
19
|
-
process(input: AFSWriteInput,
|
|
19
|
+
process(input: AFSWriteInput, options: AgentInvokeOptions): Promise<AFSWriteOutput>;
|
|
20
20
|
}
|
|
@@ -37,13 +37,14 @@ Usage:
|
|
|
37
37
|
}),
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
async process(input,
|
|
40
|
+
async process(input, options) {
|
|
41
41
|
if (!this.afs)
|
|
42
42
|
throw new Error("AFS is not configured for this agent.");
|
|
43
43
|
const _result = await this.afs.write(input.path, {
|
|
44
44
|
content: input.content,
|
|
45
45
|
}, {
|
|
46
46
|
append: input.append ?? false,
|
|
47
|
+
context: options.context,
|
|
47
48
|
});
|
|
48
49
|
return {
|
|
49
50
|
status: "success",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.73.0-beta",
|
|
4
4
|
"description": "The functional core of agentic AI",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -94,9 +94,9 @@
|
|
|
94
94
|
"zod-from-json-schema": "^0.0.5",
|
|
95
95
|
"zod-to-json-schema": "^3.24.6",
|
|
96
96
|
"@aigne/afs": "^1.4.0",
|
|
97
|
-
"@aigne/
|
|
97
|
+
"@aigne/afs-history": "^1.3.0-beta",
|
|
98
98
|
"@aigne/observability-api": "^0.11.14",
|
|
99
|
-
"@aigne/
|
|
99
|
+
"@aigne/platform-helpers": "^0.6.7"
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
102
102
|
"@types/bun": "^1.2.22",
|