@aigne/core 1.11.0 → 1.12.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 +15 -0
- package/README.md +11 -10
- package/README.zh.md +7 -6
- package/lib/cjs/agents/agent.d.ts +20 -20
- package/lib/cjs/agents/agent.js +25 -26
- package/lib/cjs/agents/ai-agent.d.ts +17 -18
- package/lib/cjs/agents/ai-agent.js +6 -6
- package/lib/cjs/agents/mcp-agent.d.ts +10 -4
- package/lib/cjs/agents/mcp-agent.js +12 -6
- package/lib/cjs/agents/memory.d.ts +1 -1
- package/lib/cjs/agents/team-agent.d.ts +28 -0
- package/lib/cjs/agents/team-agent.js +93 -0
- package/lib/cjs/agents/user-agent.d.ts +9 -10
- package/lib/cjs/agents/user-agent.js +10 -13
- package/lib/{esm/execution-engine/execution-engine.d.ts → cjs/aigne/aigne.d.ts} +9 -12
- package/lib/cjs/{execution-engine/execution-engine.js → aigne/aigne.js} +19 -19
- package/lib/cjs/{execution-engine → aigne}/context.d.ts +31 -32
- package/lib/cjs/{execution-engine → aigne}/context.js +30 -40
- package/lib/cjs/aigne/index.d.ts +4 -0
- package/lib/cjs/{execution-engine → aigne}/index.js +2 -2
- package/lib/cjs/{execution-engine → aigne}/usage.d.ts +1 -1
- package/lib/cjs/client/client.d.ts +19 -0
- package/lib/cjs/client/client.js +49 -0
- package/lib/cjs/index.d.ts +2 -1
- package/lib/cjs/index.js +2 -1
- package/lib/cjs/loader/agent-yaml.d.ts +3 -3
- package/lib/cjs/loader/agent-yaml.js +10 -3
- package/lib/cjs/loader/index.d.ts +9 -9
- package/lib/cjs/loader/index.js +6 -6
- package/lib/cjs/models/chat-model.d.ts +1 -1
- package/lib/cjs/models/claude-chat-model.d.ts +3 -3
- package/lib/cjs/models/openai-chat-model.d.ts +3 -3
- package/lib/cjs/prompt/prompt-builder.d.ts +1 -1
- package/lib/cjs/prompt/prompt-builder.js +3 -3
- package/lib/cjs/server/error.d.ts +4 -0
- package/lib/cjs/server/error.js +11 -0
- package/lib/cjs/server/server.d.ts +54 -0
- package/lib/cjs/server/server.js +130 -0
- package/lib/cjs/utils/event-stream.d.ts +11 -0
- package/lib/cjs/utils/event-stream.js +91 -0
- package/lib/cjs/utils/mcp-utils.js +4 -1
- package/lib/cjs/utils/stream-utils.d.ts +7 -2
- package/lib/cjs/utils/stream-utils.js +43 -34
- package/lib/cjs/utils/type-utils.d.ts +4 -2
- package/lib/cjs/utils/type-utils.js +10 -2
- package/lib/dts/agents/agent.d.ts +20 -20
- package/lib/dts/agents/ai-agent.d.ts +17 -18
- package/lib/dts/agents/mcp-agent.d.ts +10 -4
- package/lib/dts/agents/memory.d.ts +1 -1
- package/lib/dts/agents/team-agent.d.ts +28 -0
- package/lib/dts/agents/user-agent.d.ts +9 -10
- package/lib/dts/{execution-engine/execution-engine.d.ts → aigne/aigne.d.ts} +9 -12
- package/lib/dts/{execution-engine → aigne}/context.d.ts +31 -32
- package/lib/dts/aigne/index.d.ts +4 -0
- package/lib/dts/{execution-engine → aigne}/usage.d.ts +1 -1
- package/lib/dts/client/client.d.ts +19 -0
- package/lib/dts/index.d.ts +2 -1
- package/lib/dts/loader/agent-yaml.d.ts +3 -3
- package/lib/dts/loader/index.d.ts +9 -9
- package/lib/dts/models/chat-model.d.ts +1 -1
- package/lib/dts/models/claude-chat-model.d.ts +3 -3
- package/lib/dts/models/openai-chat-model.d.ts +3 -3
- package/lib/dts/prompt/prompt-builder.d.ts +1 -1
- package/lib/dts/server/error.d.ts +4 -0
- package/lib/dts/server/server.d.ts +54 -0
- package/lib/dts/utils/event-stream.d.ts +11 -0
- package/lib/dts/utils/stream-utils.d.ts +7 -2
- package/lib/dts/utils/type-utils.d.ts +4 -2
- package/lib/esm/agents/agent.d.ts +20 -20
- package/lib/esm/agents/agent.js +25 -26
- package/lib/esm/agents/ai-agent.d.ts +17 -18
- package/lib/esm/agents/ai-agent.js +6 -6
- package/lib/esm/agents/mcp-agent.d.ts +10 -4
- package/lib/esm/agents/mcp-agent.js +12 -6
- package/lib/esm/agents/memory.d.ts +1 -1
- package/lib/esm/agents/team-agent.d.ts +28 -0
- package/lib/esm/agents/team-agent.js +89 -0
- package/lib/esm/agents/user-agent.d.ts +9 -10
- package/lib/esm/agents/user-agent.js +11 -14
- package/lib/{cjs/execution-engine/execution-engine.d.ts → esm/aigne/aigne.d.ts} +9 -12
- package/lib/esm/{execution-engine/execution-engine.js → aigne/aigne.js} +18 -18
- package/lib/esm/{execution-engine → aigne}/context.d.ts +31 -32
- package/lib/esm/{execution-engine → aigne}/context.js +28 -38
- package/lib/esm/aigne/index.d.ts +4 -0
- package/lib/esm/aigne/index.js +4 -0
- package/lib/esm/{execution-engine → aigne}/usage.d.ts +1 -1
- package/lib/esm/client/client.d.ts +19 -0
- package/lib/esm/client/client.js +45 -0
- package/lib/esm/index.d.ts +2 -1
- package/lib/esm/index.js +2 -1
- package/lib/esm/loader/agent-yaml.d.ts +3 -3
- package/lib/esm/loader/agent-yaml.js +10 -3
- package/lib/esm/loader/index.d.ts +9 -9
- package/lib/esm/loader/index.js +6 -6
- package/lib/esm/models/chat-model.d.ts +1 -1
- package/lib/esm/models/claude-chat-model.d.ts +3 -3
- package/lib/esm/models/openai-chat-model.d.ts +3 -3
- package/lib/esm/prompt/prompt-builder.d.ts +1 -1
- package/lib/esm/prompt/prompt-builder.js +3 -3
- package/lib/esm/server/error.d.ts +4 -0
- package/lib/esm/server/error.js +7 -0
- package/lib/esm/server/server.d.ts +54 -0
- package/lib/esm/server/server.js +123 -0
- package/lib/esm/utils/event-stream.d.ts +11 -0
- package/lib/esm/utils/event-stream.js +85 -0
- package/lib/esm/utils/mcp-utils.js +4 -1
- package/lib/esm/utils/stream-utils.d.ts +7 -2
- package/lib/esm/utils/stream-utils.js +42 -33
- package/lib/esm/utils/type-utils.d.ts +4 -2
- package/lib/esm/utils/type-utils.js +9 -2
- package/package.json +13 -4
- package/lib/cjs/execution-engine/index.d.ts +0 -4
- package/lib/cjs/execution-engine/utils.d.ts +0 -4
- package/lib/cjs/execution-engine/utils.js +0 -34
- package/lib/dts/execution-engine/index.d.ts +0 -4
- package/lib/dts/execution-engine/utils.d.ts +0 -4
- package/lib/esm/execution-engine/index.d.ts +0 -4
- package/lib/esm/execution-engine/index.js +0 -4
- package/lib/esm/execution-engine/utils.d.ts +0 -4
- package/lib/esm/execution-engine/utils.js +0 -30
- /package/lib/cjs/{execution-engine → aigne}/message-queue.d.ts +0 -0
- /package/lib/cjs/{execution-engine → aigne}/message-queue.js +0 -0
- /package/lib/cjs/{execution-engine → aigne}/usage.js +0 -0
- /package/lib/dts/{execution-engine → aigne}/message-queue.d.ts +0 -0
- /package/lib/esm/{execution-engine → aigne}/message-queue.d.ts +0 -0
- /package/lib/esm/{execution-engine → aigne}/message-queue.js +0 -0
- /package/lib/esm/{execution-engine → aigne}/usage.js +0 -0
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sequential = sequential;
|
|
4
|
-
exports.parallel = parallel;
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
const agent_js_1 = require("../agents/agent.js");
|
|
7
|
-
const type_utils_js_1 = require("../utils/type-utils.js");
|
|
8
|
-
function sequential(...agents) {
|
|
9
|
-
(0, type_utils_js_1.checkArguments)("sequential", agentArraySchema, agents);
|
|
10
|
-
let _agents = [...agents];
|
|
11
|
-
return async (input, context) => {
|
|
12
|
-
const output = {};
|
|
13
|
-
// Clone the agents to run, so that we can update the agents list during the loop
|
|
14
|
-
const agentsToRun = [..._agents];
|
|
15
|
-
_agents = [];
|
|
16
|
-
for (const agent of agentsToRun) {
|
|
17
|
-
const [o, transferToAgent] = await context.call(agent, { ...input, ...output }, { returnActiveAgent: true });
|
|
18
|
-
Object.assign(output, o);
|
|
19
|
-
_agents.push(transferToAgent);
|
|
20
|
-
}
|
|
21
|
-
return output;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
function parallel(...agents) {
|
|
25
|
-
(0, type_utils_js_1.checkArguments)("parallel", agentArraySchema, agents);
|
|
26
|
-
let _agents = [...agents];
|
|
27
|
-
return async (input, context) => {
|
|
28
|
-
const result = await Promise.all(_agents.map((agent) => context.call(agent, input, { returnActiveAgent: true })));
|
|
29
|
-
_agents = result.map((i) => i[1]);
|
|
30
|
-
const outputs = result.map((i) => i[0]);
|
|
31
|
-
return Object.assign({}, ...outputs);
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
const agentArraySchema = zod_1.z.array(zod_1.z.union([zod_1.z.function(), zod_1.z.instanceof(agent_js_1.Agent)]));
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type FunctionAgentFn } from "../agents/agent.js";
|
|
2
|
-
import type { Runnable } from "./context.js";
|
|
3
|
-
export declare function sequential(...agents: [Runnable, ...Runnable[]]): FunctionAgentFn;
|
|
4
|
-
export declare function parallel(...agents: [Runnable, ...Runnable[]]): FunctionAgentFn;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { type FunctionAgentFn } from "../agents/agent.js";
|
|
2
|
-
import type { Runnable } from "./context.js";
|
|
3
|
-
export declare function sequential(...agents: [Runnable, ...Runnable[]]): FunctionAgentFn;
|
|
4
|
-
export declare function parallel(...agents: [Runnable, ...Runnable[]]): FunctionAgentFn;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { Agent } from "../agents/agent.js";
|
|
3
|
-
import { checkArguments } from "../utils/type-utils.js";
|
|
4
|
-
export function sequential(...agents) {
|
|
5
|
-
checkArguments("sequential", agentArraySchema, agents);
|
|
6
|
-
let _agents = [...agents];
|
|
7
|
-
return async (input, context) => {
|
|
8
|
-
const output = {};
|
|
9
|
-
// Clone the agents to run, so that we can update the agents list during the loop
|
|
10
|
-
const agentsToRun = [..._agents];
|
|
11
|
-
_agents = [];
|
|
12
|
-
for (const agent of agentsToRun) {
|
|
13
|
-
const [o, transferToAgent] = await context.call(agent, { ...input, ...output }, { returnActiveAgent: true });
|
|
14
|
-
Object.assign(output, o);
|
|
15
|
-
_agents.push(transferToAgent);
|
|
16
|
-
}
|
|
17
|
-
return output;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export function parallel(...agents) {
|
|
21
|
-
checkArguments("parallel", agentArraySchema, agents);
|
|
22
|
-
let _agents = [...agents];
|
|
23
|
-
return async (input, context) => {
|
|
24
|
-
const result = await Promise.all(_agents.map((agent) => context.call(agent, input, { returnActiveAgent: true })));
|
|
25
|
-
_agents = result.map((i) => i[1]);
|
|
26
|
-
const outputs = result.map((i) => i[0]);
|
|
27
|
-
return Object.assign({}, ...outputs);
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
const agentArraySchema = z.array(z.union([z.function(), z.instanceof(Agent)]));
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|