@aigne/core 1.53.0 → 1.55.0
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 +26 -0
- package/lib/cjs/aigne/aigne.d.ts +2 -0
- package/lib/cjs/aigne/aigne.js +3 -0
- package/lib/cjs/loader/agent-js.d.ts +2 -1
- package/lib/cjs/loader/agent-js.js +6 -35
- package/lib/cjs/loader/index.d.ts +5 -0
- package/lib/cjs/loader/index.js +5 -2
- package/lib/dts/aigne/aigne.d.ts +2 -0
- package/lib/dts/loader/agent-js.d.ts +2 -1
- package/lib/dts/loader/index.d.ts +5 -0
- package/lib/esm/aigne/aigne.d.ts +2 -0
- package/lib/esm/aigne/aigne.js +3 -0
- package/lib/esm/loader/agent-js.d.ts +2 -1
- package/lib/esm/loader/agent-js.js +6 -2
- package/lib/esm/loader/index.d.ts +5 -0
- package/lib/esm/loader/index.js +5 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.55.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.54.0...core-v1.55.0) (2025-08-21)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **blocklet:** support agent runtime blocklet ([#396](https://github.com/AIGNE-io/aigne-framework/issues/396)) ([baaae69](https://github.com/AIGNE-io/aigne-framework/commit/baaae691d552b7c7d313c4964a135a1b245943f9))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @aigne/observability-api bumped to 0.10.0
|
|
16
|
+
|
|
17
|
+
## [1.54.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.53.0...core-v1.54.0) (2025-08-21)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **cli:** add chat mode support for cli ([#389](https://github.com/AIGNE-io/aigne-framework/issues/389)) ([d7dc138](https://github.com/AIGNE-io/aigne-framework/commit/d7dc138719dd638ddb12c4625abdf42746baf35d))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **cli:** force reimport of agent modules with cache busting ([#392](https://github.com/AIGNE-io/aigne-framework/issues/392)) ([c372cb9](https://github.com/AIGNE-io/aigne-framework/commit/c372cb9600a9d78ad1808a045bcddfc285e9c6f0))
|
|
28
|
+
|
|
3
29
|
## [1.53.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.52.0...core-v1.53.0) (2025-08-20)
|
|
4
30
|
|
|
5
31
|
|
package/lib/cjs/aigne/aigne.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export interface AIGNEOptions {
|
|
|
44
44
|
agents?: Agent[];
|
|
45
45
|
};
|
|
46
46
|
cli?: {
|
|
47
|
+
chat?: Agent;
|
|
47
48
|
agents?: Agent[];
|
|
48
49
|
};
|
|
49
50
|
/**
|
|
@@ -133,6 +134,7 @@ export declare class AIGNE<U extends UserContext = UserContext> {
|
|
|
133
134
|
};
|
|
134
135
|
};
|
|
135
136
|
readonly cli: {
|
|
137
|
+
chat: Agent | undefined;
|
|
136
138
|
agents: Agent<any, any>[] & {
|
|
137
139
|
[key: string]: Agent<any, any>;
|
|
138
140
|
};
|
package/lib/cjs/aigne/aigne.js
CHANGED
|
@@ -65,6 +65,8 @@ class AIGNE {
|
|
|
65
65
|
this.mcpServer.agents.push(...options.mcpServer.agents);
|
|
66
66
|
if (options?.cli?.agents?.length)
|
|
67
67
|
this.cli.agents.push(...options.cli.agents);
|
|
68
|
+
if (options?.cli?.chat)
|
|
69
|
+
this.cli.chat = options.cli.chat;
|
|
68
70
|
this.observer?.serve();
|
|
69
71
|
this.initProcessExitHandler();
|
|
70
72
|
}
|
|
@@ -112,6 +114,7 @@ class AIGNE {
|
|
|
112
114
|
agents: (0, type_utils_js_1.createAccessorArray)([], (arr, name) => arr.find((i) => i.name === name)),
|
|
113
115
|
};
|
|
114
116
|
cli = {
|
|
117
|
+
chat: undefined,
|
|
115
118
|
agents: (0, type_utils_js_1.createAccessorArray)([], (arr, name) => arr.find((i) => i.name === name)),
|
|
116
119
|
};
|
|
117
120
|
/**
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { Agent } from "../agents/agent.js";
|
|
2
|
-
|
|
2
|
+
import type { LoadOptions } from "./index.js";
|
|
3
|
+
export declare function loadAgentFromJsFile(path: string, options?: LoadOptions): Promise<Agent<any, any> | import("./agent-yaml.js").AgentSchema>;
|
|
@@ -1,44 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.loadAgentFromJsFile = loadAgentFromJsFile;
|
|
4
|
+
const ufo_1 = require("ufo");
|
|
37
5
|
const agent_js_1 = require("../agents/agent.js");
|
|
38
6
|
const type_utils_js_1 = require("../utils/type-utils.js");
|
|
39
7
|
const agent_yaml_js_1 = require("./agent-yaml.js");
|
|
40
|
-
|
|
41
|
-
|
|
8
|
+
const importFn = new Function("path", "return import(path)");
|
|
9
|
+
async function loadAgentFromJsFile(path, options) {
|
|
10
|
+
if (options?.key)
|
|
11
|
+
path = (0, ufo_1.withQuery)(path, { key: options?.key });
|
|
12
|
+
const { default: agent } = await (0, type_utils_js_1.tryOrThrow)(() => importFn(path), (error) => new Error(`Failed to load agent definition from ${path}: ${error.message}`));
|
|
42
13
|
if (agent instanceof agent_js_1.Agent)
|
|
43
14
|
return agent;
|
|
44
15
|
if (typeof agent !== "function") {
|
|
@@ -11,6 +11,7 @@ export interface LoadOptions {
|
|
|
11
11
|
}[];
|
|
12
12
|
model?: ChatModel | ((model?: z.infer<typeof aigneFileSchema>["chatModel"]) => PromiseOrValue<ChatModel | undefined>);
|
|
13
13
|
imageModel?: ImageModel | ((model?: z.infer<typeof aigneFileSchema>["imageModel"]) => PromiseOrValue<ImageModel | undefined>);
|
|
14
|
+
key?: string | number;
|
|
14
15
|
}
|
|
15
16
|
export declare function load(path: string, options?: LoadOptions): Promise<AIGNEOptions>;
|
|
16
17
|
export declare function loadAgent(path: string, options?: LoadOptions, agentOptions?: AgentOptions): Promise<Agent>;
|
|
@@ -60,8 +61,10 @@ declare const aigneFileSchema: z.ZodObject<{
|
|
|
60
61
|
} | undefined>;
|
|
61
62
|
cli: z.ZodType<{
|
|
62
63
|
agents?: string[] | undefined;
|
|
64
|
+
chat?: string | undefined;
|
|
63
65
|
} | undefined, z.ZodTypeDef, {
|
|
64
66
|
agents?: string[] | undefined;
|
|
67
|
+
chat?: string | undefined;
|
|
65
68
|
} | undefined>;
|
|
66
69
|
}, "strip", z.ZodTypeAny, {
|
|
67
70
|
name?: string | undefined;
|
|
@@ -83,6 +86,7 @@ declare const aigneFileSchema: z.ZodObject<{
|
|
|
83
86
|
} | undefined;
|
|
84
87
|
cli?: {
|
|
85
88
|
agents?: string[] | undefined;
|
|
89
|
+
chat?: string | undefined;
|
|
86
90
|
} | undefined;
|
|
87
91
|
}, {
|
|
88
92
|
name?: string | undefined;
|
|
@@ -98,6 +102,7 @@ declare const aigneFileSchema: z.ZodObject<{
|
|
|
98
102
|
} | undefined;
|
|
99
103
|
cli?: {
|
|
100
104
|
agents?: string[] | undefined;
|
|
105
|
+
chat?: string | undefined;
|
|
101
106
|
} | undefined;
|
|
102
107
|
}>;
|
|
103
108
|
export declare function loadAIGNEFile(path: string): Promise<{
|
package/lib/cjs/loader/index.js
CHANGED
|
@@ -19,8 +19,9 @@ const agent_yaml_js_1 = require("./agent-yaml.js");
|
|
|
19
19
|
const schema_js_1 = require("./schema.js");
|
|
20
20
|
const AIGNE_FILE_NAME = ["aigne.yaml", "aigne.yml"];
|
|
21
21
|
async function load(path, options = {}) {
|
|
22
|
+
options.key ??= Date.now();
|
|
22
23
|
const { aigne, rootDir } = await loadAIGNEFile(path);
|
|
23
|
-
const allAgentPaths = new Set((0, type_utils_js_1.flat)(aigne.agents, aigne.skills, aigne.mcpServer?.agents, aigne.cli?.agents).map((i) => index_js_1.nodejs.path.join(rootDir, i)));
|
|
24
|
+
const allAgentPaths = new Set((0, type_utils_js_1.flat)(aigne.agents, aigne.skills, aigne.mcpServer?.agents, aigne.cli?.agents, aigne.cli?.chat).map((i) => index_js_1.nodejs.path.join(rootDir, i)));
|
|
24
25
|
const allAgents = Object.fromEntries(await Promise.all(Array.from(allAgentPaths).map(async (path) => [path, await loadAgent(path, options)])));
|
|
25
26
|
const pickAgents = (paths) => paths.map((filename) => allAgents[index_js_1.nodejs.path.join(rootDir, filename)]).filter(type_utils_js_1.isNonNullable);
|
|
26
27
|
return {
|
|
@@ -36,13 +37,14 @@ async function load(path, options = {}) {
|
|
|
36
37
|
agents: pickAgents(aigne.mcpServer?.agents ?? []),
|
|
37
38
|
},
|
|
38
39
|
cli: {
|
|
40
|
+
chat: aigne.cli?.chat ? pickAgents([aigne.cli.chat])[0] : undefined,
|
|
39
41
|
agents: pickAgents(aigne.cli?.agents ?? []),
|
|
40
42
|
},
|
|
41
43
|
};
|
|
42
44
|
}
|
|
43
45
|
async function loadAgent(path, options, agentOptions) {
|
|
44
46
|
if ([".js", ".mjs", ".ts", ".mts"].includes(index_js_1.nodejs.path.extname(path))) {
|
|
45
|
-
const agent = await (0, agent_js_js_1.loadAgentFromJsFile)(path);
|
|
47
|
+
const agent = await (0, agent_js_js_1.loadAgentFromJsFile)(path, options);
|
|
46
48
|
if (agent instanceof agent_js_1.Agent)
|
|
47
49
|
return agent;
|
|
48
50
|
return parseAgent(path, agent, options, agentOptions);
|
|
@@ -196,6 +198,7 @@ const aigneFileSchema = (0, schema_js_1.camelizeSchema)(zod_1.z.object({
|
|
|
196
198
|
agents: (0, schema_js_1.optionalize)(zod_1.z.array(zod_1.z.string())),
|
|
197
199
|
})),
|
|
198
200
|
cli: (0, schema_js_1.optionalize)(zod_1.z.object({
|
|
201
|
+
chat: (0, schema_js_1.optionalize)(zod_1.z.string()),
|
|
199
202
|
agents: (0, schema_js_1.optionalize)(zod_1.z.array(zod_1.z.string())),
|
|
200
203
|
})),
|
|
201
204
|
}));
|
package/lib/dts/aigne/aigne.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export interface AIGNEOptions {
|
|
|
44
44
|
agents?: Agent[];
|
|
45
45
|
};
|
|
46
46
|
cli?: {
|
|
47
|
+
chat?: Agent;
|
|
47
48
|
agents?: Agent[];
|
|
48
49
|
};
|
|
49
50
|
/**
|
|
@@ -133,6 +134,7 @@ export declare class AIGNE<U extends UserContext = UserContext> {
|
|
|
133
134
|
};
|
|
134
135
|
};
|
|
135
136
|
readonly cli: {
|
|
137
|
+
chat: Agent | undefined;
|
|
136
138
|
agents: Agent<any, any>[] & {
|
|
137
139
|
[key: string]: Agent<any, any>;
|
|
138
140
|
};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { Agent } from "../agents/agent.js";
|
|
2
|
-
|
|
2
|
+
import type { LoadOptions } from "./index.js";
|
|
3
|
+
export declare function loadAgentFromJsFile(path: string, options?: LoadOptions): Promise<Agent<any, any> | import("./agent-yaml.js").AgentSchema>;
|
|
@@ -11,6 +11,7 @@ export interface LoadOptions {
|
|
|
11
11
|
}[];
|
|
12
12
|
model?: ChatModel | ((model?: z.infer<typeof aigneFileSchema>["chatModel"]) => PromiseOrValue<ChatModel | undefined>);
|
|
13
13
|
imageModel?: ImageModel | ((model?: z.infer<typeof aigneFileSchema>["imageModel"]) => PromiseOrValue<ImageModel | undefined>);
|
|
14
|
+
key?: string | number;
|
|
14
15
|
}
|
|
15
16
|
export declare function load(path: string, options?: LoadOptions): Promise<AIGNEOptions>;
|
|
16
17
|
export declare function loadAgent(path: string, options?: LoadOptions, agentOptions?: AgentOptions): Promise<Agent>;
|
|
@@ -60,8 +61,10 @@ declare const aigneFileSchema: z.ZodObject<{
|
|
|
60
61
|
} | undefined>;
|
|
61
62
|
cli: z.ZodType<{
|
|
62
63
|
agents?: string[] | undefined;
|
|
64
|
+
chat?: string | undefined;
|
|
63
65
|
} | undefined, z.ZodTypeDef, {
|
|
64
66
|
agents?: string[] | undefined;
|
|
67
|
+
chat?: string | undefined;
|
|
65
68
|
} | undefined>;
|
|
66
69
|
}, "strip", z.ZodTypeAny, {
|
|
67
70
|
name?: string | undefined;
|
|
@@ -83,6 +86,7 @@ declare const aigneFileSchema: z.ZodObject<{
|
|
|
83
86
|
} | undefined;
|
|
84
87
|
cli?: {
|
|
85
88
|
agents?: string[] | undefined;
|
|
89
|
+
chat?: string | undefined;
|
|
86
90
|
} | undefined;
|
|
87
91
|
}, {
|
|
88
92
|
name?: string | undefined;
|
|
@@ -98,6 +102,7 @@ declare const aigneFileSchema: z.ZodObject<{
|
|
|
98
102
|
} | undefined;
|
|
99
103
|
cli?: {
|
|
100
104
|
agents?: string[] | undefined;
|
|
105
|
+
chat?: string | undefined;
|
|
101
106
|
} | undefined;
|
|
102
107
|
}>;
|
|
103
108
|
export declare function loadAIGNEFile(path: string): Promise<{
|
package/lib/esm/aigne/aigne.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export interface AIGNEOptions {
|
|
|
44
44
|
agents?: Agent[];
|
|
45
45
|
};
|
|
46
46
|
cli?: {
|
|
47
|
+
chat?: Agent;
|
|
47
48
|
agents?: Agent[];
|
|
48
49
|
};
|
|
49
50
|
/**
|
|
@@ -133,6 +134,7 @@ export declare class AIGNE<U extends UserContext = UserContext> {
|
|
|
133
134
|
};
|
|
134
135
|
};
|
|
135
136
|
readonly cli: {
|
|
137
|
+
chat: Agent | undefined;
|
|
136
138
|
agents: Agent<any, any>[] & {
|
|
137
139
|
[key: string]: Agent<any, any>;
|
|
138
140
|
};
|
package/lib/esm/aigne/aigne.js
CHANGED
|
@@ -62,6 +62,8 @@ export class AIGNE {
|
|
|
62
62
|
this.mcpServer.agents.push(...options.mcpServer.agents);
|
|
63
63
|
if (options?.cli?.agents?.length)
|
|
64
64
|
this.cli.agents.push(...options.cli.agents);
|
|
65
|
+
if (options?.cli?.chat)
|
|
66
|
+
this.cli.chat = options.cli.chat;
|
|
65
67
|
this.observer?.serve();
|
|
66
68
|
this.initProcessExitHandler();
|
|
67
69
|
}
|
|
@@ -109,6 +111,7 @@ export class AIGNE {
|
|
|
109
111
|
agents: createAccessorArray([], (arr, name) => arr.find((i) => i.name === name)),
|
|
110
112
|
};
|
|
111
113
|
cli = {
|
|
114
|
+
chat: undefined,
|
|
112
115
|
agents: createAccessorArray([], (arr, name) => arr.find((i) => i.name === name)),
|
|
113
116
|
};
|
|
114
117
|
/**
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { Agent } from "../agents/agent.js";
|
|
2
|
-
|
|
2
|
+
import type { LoadOptions } from "./index.js";
|
|
3
|
+
export declare function loadAgentFromJsFile(path: string, options?: LoadOptions): Promise<Agent<any, any> | import("./agent-yaml.js").AgentSchema>;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { withQuery } from "ufo";
|
|
1
2
|
import { Agent } from "../agents/agent.js";
|
|
2
3
|
import { tryOrThrow } from "../utils/type-utils.js";
|
|
3
4
|
import { parseAgentFile } from "./agent-yaml.js";
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
const importFn = new Function("path", "return import(path)");
|
|
6
|
+
export async function loadAgentFromJsFile(path, options) {
|
|
7
|
+
if (options?.key)
|
|
8
|
+
path = withQuery(path, { key: options?.key });
|
|
9
|
+
const { default: agent } = await tryOrThrow(() => importFn(path), (error) => new Error(`Failed to load agent definition from ${path}: ${error.message}`));
|
|
6
10
|
if (agent instanceof Agent)
|
|
7
11
|
return agent;
|
|
8
12
|
if (typeof agent !== "function") {
|
|
@@ -11,6 +11,7 @@ export interface LoadOptions {
|
|
|
11
11
|
}[];
|
|
12
12
|
model?: ChatModel | ((model?: z.infer<typeof aigneFileSchema>["chatModel"]) => PromiseOrValue<ChatModel | undefined>);
|
|
13
13
|
imageModel?: ImageModel | ((model?: z.infer<typeof aigneFileSchema>["imageModel"]) => PromiseOrValue<ImageModel | undefined>);
|
|
14
|
+
key?: string | number;
|
|
14
15
|
}
|
|
15
16
|
export declare function load(path: string, options?: LoadOptions): Promise<AIGNEOptions>;
|
|
16
17
|
export declare function loadAgent(path: string, options?: LoadOptions, agentOptions?: AgentOptions): Promise<Agent>;
|
|
@@ -60,8 +61,10 @@ declare const aigneFileSchema: z.ZodObject<{
|
|
|
60
61
|
} | undefined>;
|
|
61
62
|
cli: z.ZodType<{
|
|
62
63
|
agents?: string[] | undefined;
|
|
64
|
+
chat?: string | undefined;
|
|
63
65
|
} | undefined, z.ZodTypeDef, {
|
|
64
66
|
agents?: string[] | undefined;
|
|
67
|
+
chat?: string | undefined;
|
|
65
68
|
} | undefined>;
|
|
66
69
|
}, "strip", z.ZodTypeAny, {
|
|
67
70
|
name?: string | undefined;
|
|
@@ -83,6 +86,7 @@ declare const aigneFileSchema: z.ZodObject<{
|
|
|
83
86
|
} | undefined;
|
|
84
87
|
cli?: {
|
|
85
88
|
agents?: string[] | undefined;
|
|
89
|
+
chat?: string | undefined;
|
|
86
90
|
} | undefined;
|
|
87
91
|
}, {
|
|
88
92
|
name?: string | undefined;
|
|
@@ -98,6 +102,7 @@ declare const aigneFileSchema: z.ZodObject<{
|
|
|
98
102
|
} | undefined;
|
|
99
103
|
cli?: {
|
|
100
104
|
agents?: string[] | undefined;
|
|
105
|
+
chat?: string | undefined;
|
|
101
106
|
} | undefined;
|
|
102
107
|
}>;
|
|
103
108
|
export declare function loadAIGNEFile(path: string): Promise<{
|
package/lib/esm/loader/index.js
CHANGED
|
@@ -14,8 +14,9 @@ import { loadAgentFromYamlFile } from "./agent-yaml.js";
|
|
|
14
14
|
import { camelizeSchema, optionalize } from "./schema.js";
|
|
15
15
|
const AIGNE_FILE_NAME = ["aigne.yaml", "aigne.yml"];
|
|
16
16
|
export async function load(path, options = {}) {
|
|
17
|
+
options.key ??= Date.now();
|
|
17
18
|
const { aigne, rootDir } = await loadAIGNEFile(path);
|
|
18
|
-
const allAgentPaths = new Set(flat(aigne.agents, aigne.skills, aigne.mcpServer?.agents, aigne.cli?.agents).map((i) => nodejs.path.join(rootDir, i)));
|
|
19
|
+
const allAgentPaths = new Set(flat(aigne.agents, aigne.skills, aigne.mcpServer?.agents, aigne.cli?.agents, aigne.cli?.chat).map((i) => nodejs.path.join(rootDir, i)));
|
|
19
20
|
const allAgents = Object.fromEntries(await Promise.all(Array.from(allAgentPaths).map(async (path) => [path, await loadAgent(path, options)])));
|
|
20
21
|
const pickAgents = (paths) => paths.map((filename) => allAgents[nodejs.path.join(rootDir, filename)]).filter(isNonNullable);
|
|
21
22
|
return {
|
|
@@ -31,13 +32,14 @@ export async function load(path, options = {}) {
|
|
|
31
32
|
agents: pickAgents(aigne.mcpServer?.agents ?? []),
|
|
32
33
|
},
|
|
33
34
|
cli: {
|
|
35
|
+
chat: aigne.cli?.chat ? pickAgents([aigne.cli.chat])[0] : undefined,
|
|
34
36
|
agents: pickAgents(aigne.cli?.agents ?? []),
|
|
35
37
|
},
|
|
36
38
|
};
|
|
37
39
|
}
|
|
38
40
|
export async function loadAgent(path, options, agentOptions) {
|
|
39
41
|
if ([".js", ".mjs", ".ts", ".mts"].includes(nodejs.path.extname(path))) {
|
|
40
|
-
const agent = await loadAgentFromJsFile(path);
|
|
42
|
+
const agent = await loadAgentFromJsFile(path, options);
|
|
41
43
|
if (agent instanceof Agent)
|
|
42
44
|
return agent;
|
|
43
45
|
return parseAgent(path, agent, options, agentOptions);
|
|
@@ -191,6 +193,7 @@ const aigneFileSchema = camelizeSchema(z.object({
|
|
|
191
193
|
agents: optionalize(z.array(z.string())),
|
|
192
194
|
})),
|
|
193
195
|
cli: optionalize(z.object({
|
|
196
|
+
chat: optionalize(z.string()),
|
|
194
197
|
agents: optionalize(z.array(z.string())),
|
|
195
198
|
})),
|
|
196
199
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.55.0",
|
|
4
4
|
"description": "The functional core of agentic AI",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"yaml": "^2.8.0",
|
|
90
90
|
"zod": "^3.25.67",
|
|
91
91
|
"zod-to-json-schema": "^3.24.6",
|
|
92
|
-
"@aigne/observability-api": "^0.
|
|
92
|
+
"@aigne/observability-api": "^0.10.0",
|
|
93
93
|
"@aigne/platform-helpers": "^0.6.2"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|