@aigne/core 1.23.1 → 1.24.1
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 +23 -0
- package/lib/cjs/agents/agent.d.ts +2 -0
- package/lib/cjs/agents/ai-agent.d.ts +2 -2
- package/lib/cjs/agents/ai-agent.js +3 -4
- package/lib/cjs/agents/mcp-agent.js +1 -1
- package/lib/cjs/aigne/aigne.d.ts +2 -2
- package/lib/cjs/aigne/aigne.js +5 -7
- package/lib/cjs/aigne/context.d.ts +1 -1
- package/lib/cjs/aigne/context.js +2 -2
- package/lib/cjs/utils/type-utils.d.ts +2 -2
- package/lib/dts/agents/agent.d.ts +2 -0
- package/lib/dts/agents/ai-agent.d.ts +2 -2
- package/lib/dts/aigne/aigne.d.ts +2 -2
- package/lib/dts/aigne/context.d.ts +1 -1
- package/lib/dts/utils/type-utils.d.ts +2 -2
- package/lib/esm/agents/agent.d.ts +2 -0
- package/lib/esm/agents/ai-agent.d.ts +2 -2
- package/lib/esm/agents/ai-agent.js +3 -4
- package/lib/esm/agents/mcp-agent.js +1 -1
- package/lib/esm/aigne/aigne.d.ts +2 -2
- package/lib/esm/aigne/aigne.js +5 -7
- package/lib/esm/aigne/context.d.ts +1 -1
- package/lib/esm/aigne/context.js +3 -3
- package/lib/esm/utils/type-utils.d.ts +2 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,29 @@
|
|
|
12
12
|
* dependencies
|
|
13
13
|
* @aigne/observability bumped to 0.1.0
|
|
14
14
|
|
|
15
|
+
## [1.24.1](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.24.0...core-v1.24.1) (2025-06-26)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Dependencies
|
|
19
|
+
|
|
20
|
+
* The following workspace dependencies were updated
|
|
21
|
+
* dependencies
|
|
22
|
+
* @aigne/observability bumped to 0.1.3
|
|
23
|
+
|
|
24
|
+
## [1.24.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.23.1...core-v1.24.0) (2025-06-26)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* **transport:** support invoke server side chat model ([#182](https://github.com/AIGNE-io/aigne-framework/issues/182)) ([f81a1bf](https://github.com/AIGNE-io/aigne-framework/commit/f81a1bf883abda1845ccee09b270e5f583e287ab))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Dependencies
|
|
33
|
+
|
|
34
|
+
* The following workspace dependencies were updated
|
|
35
|
+
* dependencies
|
|
36
|
+
* @aigne/observability bumped to 0.1.2
|
|
37
|
+
|
|
15
38
|
## [1.23.1](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.23.0...core-v1.23.1) (2025-06-25)
|
|
16
39
|
|
|
17
40
|
|
|
@@ -501,6 +501,8 @@ export declare abstract class Agent<I extends Message = any, O extends Message =
|
|
|
501
501
|
*/
|
|
502
502
|
[Symbol.asyncDispose](): Promise<void>;
|
|
503
503
|
}
|
|
504
|
+
export type AgentInput<T extends Agent> = T extends Agent<infer I, any> ? I : never;
|
|
505
|
+
export type AgentOutput<T extends Agent> = T extends Agent<any, infer O> ? O : never;
|
|
504
506
|
/**
|
|
505
507
|
* Lifecycle hooks for agent execution
|
|
506
508
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ZodObject, type ZodType, z } from "zod";
|
|
2
2
|
import { PromptBuilder } from "../prompt/prompt-builder.js";
|
|
3
3
|
import { Agent, type AgentInvokeOptions, type AgentOptions, type AgentProcessAsyncGenerator, type Message } from "./agent.js";
|
|
4
|
-
import { ChatModel,
|
|
4
|
+
import type { ChatModel, ChatModelInput } from "./chat-model.js";
|
|
5
5
|
import type { GuideRailAgentOutput } from "./guide-rail-agent.js";
|
|
6
6
|
export declare const DEFAULT_OUTPUT_KEY = "message";
|
|
7
7
|
/**
|
|
@@ -100,7 +100,7 @@ export declare enum AIAgentToolChoice {
|
|
|
100
100
|
*
|
|
101
101
|
* @hidden
|
|
102
102
|
*/
|
|
103
|
-
export declare const aiAgentToolChoiceSchema: z.ZodUnion<[z.ZodNativeEnum<typeof AIAgentToolChoice>, ZodType<Agent<
|
|
103
|
+
export declare const aiAgentToolChoiceSchema: z.ZodUnion<[z.ZodNativeEnum<typeof AIAgentToolChoice>, ZodType<Agent<any, any>, z.ZodTypeDef, Agent<any, any>>]>;
|
|
104
104
|
/**
|
|
105
105
|
* Zod schema for validating AIAgentOptions
|
|
106
106
|
*
|
|
@@ -6,7 +6,6 @@ const prompt_builder_js_1 = require("../prompt/prompt-builder.js");
|
|
|
6
6
|
const template_js_1 = require("../prompt/template.js");
|
|
7
7
|
const type_utils_js_1 = require("../utils/type-utils.js");
|
|
8
8
|
const agent_js_1 = require("./agent.js");
|
|
9
|
-
const chat_model_js_1 = require("./chat-model.js");
|
|
10
9
|
const types_js_1 = require("./types.js");
|
|
11
10
|
exports.DEFAULT_OUTPUT_KEY = "message";
|
|
12
11
|
/**
|
|
@@ -40,7 +39,7 @@ var AIAgentToolChoice;
|
|
|
40
39
|
*
|
|
41
40
|
* @hidden
|
|
42
41
|
*/
|
|
43
|
-
exports.aiAgentToolChoiceSchema = zod_1.z.union([zod_1.z.nativeEnum(AIAgentToolChoice), zod_1.z.
|
|
42
|
+
exports.aiAgentToolChoiceSchema = zod_1.z.union([zod_1.z.nativeEnum(AIAgentToolChoice), zod_1.z.custom()], {
|
|
44
43
|
message: `aiAgentToolChoice must be ${Object.values(AIAgentToolChoice).join(", ")}, or an Agent`,
|
|
45
44
|
});
|
|
46
45
|
/**
|
|
@@ -51,8 +50,8 @@ exports.aiAgentToolChoiceSchema = zod_1.z.union([zod_1.z.nativeEnum(AIAgentToolC
|
|
|
51
50
|
* @hidden
|
|
52
51
|
*/
|
|
53
52
|
exports.aiAgentOptionsSchema = agent_js_1.agentOptionsSchema.extend({
|
|
54
|
-
model: zod_1.z.
|
|
55
|
-
instructions: zod_1.z.union([zod_1.z.string(), zod_1.z.
|
|
53
|
+
model: zod_1.z.custom().optional(),
|
|
54
|
+
instructions: zod_1.z.union([zod_1.z.string(), zod_1.z.custom()]).optional(),
|
|
56
55
|
inputKey: zod_1.z.string().optional(),
|
|
57
56
|
outputKey: zod_1.z.string().optional(),
|
|
58
57
|
toolChoice: exports.aiAgentToolChoiceSchema.optional(),
|
|
@@ -308,7 +308,7 @@ const mcpAgentOptionsSchema = zod_1.z.union([
|
|
|
308
308
|
opts: zod_1.z.object({}).optional(),
|
|
309
309
|
timeout: zod_1.z.number().optional(),
|
|
310
310
|
maxReconnects: zod_1.z.number().optional(),
|
|
311
|
-
shouldReconnect: zod_1.z.
|
|
311
|
+
shouldReconnect: zod_1.z.custom().optional(),
|
|
312
312
|
}),
|
|
313
313
|
zod_1.z.object({
|
|
314
314
|
command: zod_1.z.string(),
|
package/lib/cjs/aigne/aigne.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AIGNEObserver } from "@aigne/observability";
|
|
2
|
-
import { Agent,
|
|
3
|
-
import { ChatModel } from "../agents/chat-model.js";
|
|
2
|
+
import type { Agent, AgentResponse, AgentResponseStream, Message } from "../agents/agent.js";
|
|
3
|
+
import type { ChatModel } from "../agents/chat-model.js";
|
|
4
4
|
import type { UserAgent } from "../agents/user-agent.js";
|
|
5
5
|
import { type LoadOptions } from "../loader/index.js";
|
|
6
6
|
import { AIGNEContext, type Context, type InvokeOptions, type UserContext } from "./context.js";
|
package/lib/cjs/aigne/aigne.js
CHANGED
|
@@ -3,8 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AIGNE = void 0;
|
|
4
4
|
const observability_1 = require("@aigne/observability");
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
|
-
const agent_js_1 = require("../agents/agent.js");
|
|
7
|
-
const chat_model_js_1 = require("../agents/chat-model.js");
|
|
8
6
|
const index_js_1 = require("../loader/index.js");
|
|
9
7
|
const type_utils_js_1 = require("../utils/type-utils.js");
|
|
10
8
|
const context_js_1 = require("./context.js");
|
|
@@ -207,9 +205,9 @@ class AIGNE {
|
|
|
207
205
|
}
|
|
208
206
|
exports.AIGNE = AIGNE;
|
|
209
207
|
const aigneOptionsSchema = zod_1.z.object({
|
|
210
|
-
model: zod_1.z.
|
|
211
|
-
skills: zod_1.z.array(zod_1.z.
|
|
212
|
-
agents: zod_1.z.array(zod_1.z.
|
|
213
|
-
observer: zod_1.z.
|
|
208
|
+
model: zod_1.z.custom().optional(),
|
|
209
|
+
skills: zod_1.z.array(zod_1.z.custom()).optional(),
|
|
210
|
+
agents: zod_1.z.array(zod_1.z.custom()).optional(),
|
|
211
|
+
observer: zod_1.z.custom().optional(),
|
|
214
212
|
});
|
|
215
|
-
const aigneAddAgentArgsSchema = zod_1.z.array(zod_1.z.
|
|
213
|
+
const aigneAddAgentArgsSchema = zod_1.z.array(zod_1.z.custom());
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AIGNEObserver } from "@aigne/observability";
|
|
2
2
|
import type { Span } from "@opentelemetry/api";
|
|
3
3
|
import { Emitter } from "strict-event-emitter";
|
|
4
|
-
import { Agent, type AgentInvokeOptions, type AgentProcessAsyncGenerator, type AgentResponse, type AgentResponseStream, type Message } from "../agents/agent.js";
|
|
4
|
+
import { type Agent, type AgentInvokeOptions, type AgentProcessAsyncGenerator, type AgentResponse, type AgentResponseStream, type Message } from "../agents/agent.js";
|
|
5
5
|
import type { ChatModel } from "../agents/chat-model.js";
|
|
6
6
|
import { UserAgent } from "../agents/user-agent.js";
|
|
7
7
|
import type { Memory } from "../memory/memory.js";
|
package/lib/cjs/aigne/context.js
CHANGED
|
@@ -34,7 +34,7 @@ class AIGNEContext {
|
|
|
34
34
|
this.span = tracer?.startSpan("childAIGNEContext", undefined, parentContext);
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
if (!process.env.AIGNE_OBSERVABILITY_DISABLED) {
|
|
37
|
+
if (parent.observer && !process.env.AIGNE_OBSERVABILITY_DISABLED) {
|
|
38
38
|
throw new Error("parent span is not set");
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -369,7 +369,7 @@ async function* withAbortSignal(signal, error, fn) {
|
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
371
|
const aigneContextInvokeArgsSchema = zod_1.z.object({
|
|
372
|
-
agent: zod_1.z.union([zod_1.z.
|
|
372
|
+
agent: zod_1.z.union([zod_1.z.custom(), zod_1.z.custom()]),
|
|
373
373
|
message: zod_1.z.union([zod_1.z.record(zod_1.z.unknown()), zod_1.z.string()]).optional(),
|
|
374
374
|
options: zod_1.z.object({ returnActiveAgent: zod_1.z.boolean().optional() }).optional(),
|
|
375
375
|
});
|
|
@@ -15,8 +15,8 @@ export declare function isNotEmpty<T>(arr: T[]): arr is [T, ...T[]];
|
|
|
15
15
|
export declare function duplicates<T>(arr: T[], key?: (item: T) => unknown): T[];
|
|
16
16
|
export declare function remove<T>(arr: T[], remove: T[] | ((item: T) => boolean)): T[];
|
|
17
17
|
export declare function unique<T>(arr: T[], key?: (item: T) => unknown): T[];
|
|
18
|
-
export declare function pick<T extends
|
|
19
|
-
export declare function omit<T extends
|
|
18
|
+
export declare function pick<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): Pick<T, K>;
|
|
19
|
+
export declare function omit<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): Omit<T, K>;
|
|
20
20
|
export declare function omitDeep<T, K>(obj: T, ...keys: (K | K[])[]): unknown;
|
|
21
21
|
export declare function omitBy<T extends Record<string, unknown>, K extends keyof T>(obj: T, predicate: (value: T[K], key: K) => boolean): Partial<T>;
|
|
22
22
|
export declare function orArrayToArray<T>(value?: T | T[]): T[];
|
|
@@ -501,6 +501,8 @@ export declare abstract class Agent<I extends Message = any, O extends Message =
|
|
|
501
501
|
*/
|
|
502
502
|
[Symbol.asyncDispose](): Promise<void>;
|
|
503
503
|
}
|
|
504
|
+
export type AgentInput<T extends Agent> = T extends Agent<infer I, any> ? I : never;
|
|
505
|
+
export type AgentOutput<T extends Agent> = T extends Agent<any, infer O> ? O : never;
|
|
504
506
|
/**
|
|
505
507
|
* Lifecycle hooks for agent execution
|
|
506
508
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ZodObject, type ZodType, z } from "zod";
|
|
2
2
|
import { PromptBuilder } from "../prompt/prompt-builder.js";
|
|
3
3
|
import { Agent, type AgentInvokeOptions, type AgentOptions, type AgentProcessAsyncGenerator, type Message } from "./agent.js";
|
|
4
|
-
import { ChatModel,
|
|
4
|
+
import type { ChatModel, ChatModelInput } from "./chat-model.js";
|
|
5
5
|
import type { GuideRailAgentOutput } from "./guide-rail-agent.js";
|
|
6
6
|
export declare const DEFAULT_OUTPUT_KEY = "message";
|
|
7
7
|
/**
|
|
@@ -100,7 +100,7 @@ export declare enum AIAgentToolChoice {
|
|
|
100
100
|
*
|
|
101
101
|
* @hidden
|
|
102
102
|
*/
|
|
103
|
-
export declare const aiAgentToolChoiceSchema: z.ZodUnion<[z.ZodNativeEnum<typeof AIAgentToolChoice>, ZodType<Agent<
|
|
103
|
+
export declare const aiAgentToolChoiceSchema: z.ZodUnion<[z.ZodNativeEnum<typeof AIAgentToolChoice>, ZodType<Agent<any, any>, z.ZodTypeDef, Agent<any, any>>]>;
|
|
104
104
|
/**
|
|
105
105
|
* Zod schema for validating AIAgentOptions
|
|
106
106
|
*
|
package/lib/dts/aigne/aigne.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AIGNEObserver } from "@aigne/observability";
|
|
2
|
-
import { Agent,
|
|
3
|
-
import { ChatModel } from "../agents/chat-model.js";
|
|
2
|
+
import type { Agent, AgentResponse, AgentResponseStream, Message } from "../agents/agent.js";
|
|
3
|
+
import type { ChatModel } from "../agents/chat-model.js";
|
|
4
4
|
import type { UserAgent } from "../agents/user-agent.js";
|
|
5
5
|
import { type LoadOptions } from "../loader/index.js";
|
|
6
6
|
import { AIGNEContext, type Context, type InvokeOptions, type UserContext } from "./context.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AIGNEObserver } from "@aigne/observability";
|
|
2
2
|
import type { Span } from "@opentelemetry/api";
|
|
3
3
|
import { Emitter } from "strict-event-emitter";
|
|
4
|
-
import { Agent, type AgentInvokeOptions, type AgentProcessAsyncGenerator, type AgentResponse, type AgentResponseStream, type Message } from "../agents/agent.js";
|
|
4
|
+
import { type Agent, type AgentInvokeOptions, type AgentProcessAsyncGenerator, type AgentResponse, type AgentResponseStream, type Message } from "../agents/agent.js";
|
|
5
5
|
import type { ChatModel } from "../agents/chat-model.js";
|
|
6
6
|
import { UserAgent } from "../agents/user-agent.js";
|
|
7
7
|
import type { Memory } from "../memory/memory.js";
|
|
@@ -15,8 +15,8 @@ export declare function isNotEmpty<T>(arr: T[]): arr is [T, ...T[]];
|
|
|
15
15
|
export declare function duplicates<T>(arr: T[], key?: (item: T) => unknown): T[];
|
|
16
16
|
export declare function remove<T>(arr: T[], remove: T[] | ((item: T) => boolean)): T[];
|
|
17
17
|
export declare function unique<T>(arr: T[], key?: (item: T) => unknown): T[];
|
|
18
|
-
export declare function pick<T extends
|
|
19
|
-
export declare function omit<T extends
|
|
18
|
+
export declare function pick<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): Pick<T, K>;
|
|
19
|
+
export declare function omit<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): Omit<T, K>;
|
|
20
20
|
export declare function omitDeep<T, K>(obj: T, ...keys: (K | K[])[]): unknown;
|
|
21
21
|
export declare function omitBy<T extends Record<string, unknown>, K extends keyof T>(obj: T, predicate: (value: T[K], key: K) => boolean): Partial<T>;
|
|
22
22
|
export declare function orArrayToArray<T>(value?: T | T[]): T[];
|
|
@@ -501,6 +501,8 @@ export declare abstract class Agent<I extends Message = any, O extends Message =
|
|
|
501
501
|
*/
|
|
502
502
|
[Symbol.asyncDispose](): Promise<void>;
|
|
503
503
|
}
|
|
504
|
+
export type AgentInput<T extends Agent> = T extends Agent<infer I, any> ? I : never;
|
|
505
|
+
export type AgentOutput<T extends Agent> = T extends Agent<any, infer O> ? O : never;
|
|
504
506
|
/**
|
|
505
507
|
* Lifecycle hooks for agent execution
|
|
506
508
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ZodObject, type ZodType, z } from "zod";
|
|
2
2
|
import { PromptBuilder } from "../prompt/prompt-builder.js";
|
|
3
3
|
import { Agent, type AgentInvokeOptions, type AgentOptions, type AgentProcessAsyncGenerator, type Message } from "./agent.js";
|
|
4
|
-
import { ChatModel,
|
|
4
|
+
import type { ChatModel, ChatModelInput } from "./chat-model.js";
|
|
5
5
|
import type { GuideRailAgentOutput } from "./guide-rail-agent.js";
|
|
6
6
|
export declare const DEFAULT_OUTPUT_KEY = "message";
|
|
7
7
|
/**
|
|
@@ -100,7 +100,7 @@ export declare enum AIAgentToolChoice {
|
|
|
100
100
|
*
|
|
101
101
|
* @hidden
|
|
102
102
|
*/
|
|
103
|
-
export declare const aiAgentToolChoiceSchema: z.ZodUnion<[z.ZodNativeEnum<typeof AIAgentToolChoice>, ZodType<Agent<
|
|
103
|
+
export declare const aiAgentToolChoiceSchema: z.ZodUnion<[z.ZodNativeEnum<typeof AIAgentToolChoice>, ZodType<Agent<any, any>, z.ZodTypeDef, Agent<any, any>>]>;
|
|
104
104
|
/**
|
|
105
105
|
* Zod schema for validating AIAgentOptions
|
|
106
106
|
*
|
|
@@ -3,7 +3,6 @@ import { PromptBuilder } from "../prompt/prompt-builder.js";
|
|
|
3
3
|
import { AgentMessageTemplate, ToolMessageTemplate } from "../prompt/template.js";
|
|
4
4
|
import { checkArguments, isEmpty } from "../utils/type-utils.js";
|
|
5
5
|
import { Agent, agentOptionsSchema, isAgentResponseDelta, } from "./agent.js";
|
|
6
|
-
import { ChatModel, } from "./chat-model.js";
|
|
7
6
|
import { isTransferAgentOutput } from "./types.js";
|
|
8
7
|
export const DEFAULT_OUTPUT_KEY = "message";
|
|
9
8
|
/**
|
|
@@ -37,7 +36,7 @@ export var AIAgentToolChoice;
|
|
|
37
36
|
*
|
|
38
37
|
* @hidden
|
|
39
38
|
*/
|
|
40
|
-
export const aiAgentToolChoiceSchema = z.union([z.nativeEnum(AIAgentToolChoice), z.
|
|
39
|
+
export const aiAgentToolChoiceSchema = z.union([z.nativeEnum(AIAgentToolChoice), z.custom()], {
|
|
41
40
|
message: `aiAgentToolChoice must be ${Object.values(AIAgentToolChoice).join(", ")}, or an Agent`,
|
|
42
41
|
});
|
|
43
42
|
/**
|
|
@@ -48,8 +47,8 @@ export const aiAgentToolChoiceSchema = z.union([z.nativeEnum(AIAgentToolChoice),
|
|
|
48
47
|
* @hidden
|
|
49
48
|
*/
|
|
50
49
|
export const aiAgentOptionsSchema = agentOptionsSchema.extend({
|
|
51
|
-
model: z.
|
|
52
|
-
instructions: z.union([z.string(), z.
|
|
50
|
+
model: z.custom().optional(),
|
|
51
|
+
instructions: z.union([z.string(), z.custom()]).optional(),
|
|
53
52
|
inputKey: z.string().optional(),
|
|
54
53
|
outputKey: z.string().optional(),
|
|
55
54
|
toolChoice: aiAgentToolChoiceSchema.optional(),
|
|
@@ -297,7 +297,7 @@ const mcpAgentOptionsSchema = z.union([
|
|
|
297
297
|
opts: z.object({}).optional(),
|
|
298
298
|
timeout: z.number().optional(),
|
|
299
299
|
maxReconnects: z.number().optional(),
|
|
300
|
-
shouldReconnect: z.
|
|
300
|
+
shouldReconnect: z.custom().optional(),
|
|
301
301
|
}),
|
|
302
302
|
z.object({
|
|
303
303
|
command: z.string(),
|
package/lib/esm/aigne/aigne.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AIGNEObserver } from "@aigne/observability";
|
|
2
|
-
import { Agent,
|
|
3
|
-
import { ChatModel } from "../agents/chat-model.js";
|
|
2
|
+
import type { Agent, AgentResponse, AgentResponseStream, Message } from "../agents/agent.js";
|
|
3
|
+
import type { ChatModel } from "../agents/chat-model.js";
|
|
4
4
|
import type { UserAgent } from "../agents/user-agent.js";
|
|
5
5
|
import { type LoadOptions } from "../loader/index.js";
|
|
6
6
|
import { AIGNEContext, type Context, type InvokeOptions, type UserContext } from "./context.js";
|
package/lib/esm/aigne/aigne.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { AIGNEObserver } from "@aigne/observability";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { Agent, } from "../agents/agent.js";
|
|
4
|
-
import { ChatModel } from "../agents/chat-model.js";
|
|
5
3
|
import { load } from "../loader/index.js";
|
|
6
4
|
import { checkArguments, createAccessorArray } from "../utils/type-utils.js";
|
|
7
5
|
import { AIGNEContext } from "./context.js";
|
|
@@ -203,9 +201,9 @@ export class AIGNE {
|
|
|
203
201
|
}
|
|
204
202
|
}
|
|
205
203
|
const aigneOptionsSchema = z.object({
|
|
206
|
-
model: z.
|
|
207
|
-
skills: z.array(z.
|
|
208
|
-
agents: z.array(z.
|
|
209
|
-
observer: z.
|
|
204
|
+
model: z.custom().optional(),
|
|
205
|
+
skills: z.array(z.custom()).optional(),
|
|
206
|
+
agents: z.array(z.custom()).optional(),
|
|
207
|
+
observer: z.custom().optional(),
|
|
210
208
|
});
|
|
211
|
-
const aigneAddAgentArgsSchema = z.array(z.
|
|
209
|
+
const aigneAddAgentArgsSchema = z.array(z.custom());
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AIGNEObserver } from "@aigne/observability";
|
|
2
2
|
import type { Span } from "@opentelemetry/api";
|
|
3
3
|
import { Emitter } from "strict-event-emitter";
|
|
4
|
-
import { Agent, type AgentInvokeOptions, type AgentProcessAsyncGenerator, type AgentResponse, type AgentResponseStream, type Message } from "../agents/agent.js";
|
|
4
|
+
import { type Agent, type AgentInvokeOptions, type AgentProcessAsyncGenerator, type AgentResponse, type AgentResponseStream, type Message } from "../agents/agent.js";
|
|
5
5
|
import type { ChatModel } from "../agents/chat-model.js";
|
|
6
6
|
import { UserAgent } from "../agents/user-agent.js";
|
|
7
7
|
import type { Memory } from "../memory/memory.js";
|
package/lib/esm/aigne/context.js
CHANGED
|
@@ -3,7 +3,7 @@ import equal from "fast-deep-equal";
|
|
|
3
3
|
import { Emitter } from "strict-event-emitter";
|
|
4
4
|
import { v7 } from "uuid";
|
|
5
5
|
import { z } from "zod";
|
|
6
|
-
import {
|
|
6
|
+
import { isAgentResponseDelta, isEmptyChunk, } from "../agents/agent.js";
|
|
7
7
|
import { isTransferAgentOutput, transferAgentOutputKey, } from "../agents/types.js";
|
|
8
8
|
import { UserAgent } from "../agents/user-agent.js";
|
|
9
9
|
import { AgentResponseProgressStream } from "../utils/event-stream.js";
|
|
@@ -28,7 +28,7 @@ export class AIGNEContext {
|
|
|
28
28
|
this.span = tracer?.startSpan("childAIGNEContext", undefined, parentContext);
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
|
-
if (!process.env.AIGNE_OBSERVABILITY_DISABLED) {
|
|
31
|
+
if (parent.observer && !process.env.AIGNE_OBSERVABILITY_DISABLED) {
|
|
32
32
|
throw new Error("parent span is not set");
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -362,7 +362,7 @@ async function* withAbortSignal(signal, error, fn) {
|
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
const aigneContextInvokeArgsSchema = z.object({
|
|
365
|
-
agent: z.union([z.
|
|
365
|
+
agent: z.union([z.custom(), z.custom()]),
|
|
366
366
|
message: z.union([z.record(z.unknown()), z.string()]).optional(),
|
|
367
367
|
options: z.object({ returnActiveAgent: z.boolean().optional() }).optional(),
|
|
368
368
|
});
|
|
@@ -15,8 +15,8 @@ export declare function isNotEmpty<T>(arr: T[]): arr is [T, ...T[]];
|
|
|
15
15
|
export declare function duplicates<T>(arr: T[], key?: (item: T) => unknown): T[];
|
|
16
16
|
export declare function remove<T>(arr: T[], remove: T[] | ((item: T) => boolean)): T[];
|
|
17
17
|
export declare function unique<T>(arr: T[], key?: (item: T) => unknown): T[];
|
|
18
|
-
export declare function pick<T extends
|
|
19
|
-
export declare function omit<T extends
|
|
18
|
+
export declare function pick<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): Pick<T, K>;
|
|
19
|
+
export declare function omit<T extends object, K extends keyof T>(obj: T, ...keys: (K | K[])[]): Omit<T, K>;
|
|
20
20
|
export declare function omitDeep<T, K>(obj: T, ...keys: (K | K[])[]): unknown;
|
|
21
21
|
export declare function omitBy<T extends Record<string, unknown>, K extends keyof T>(obj: T, predicate: (value: T[K], key: K) => boolean): Partial<T>;
|
|
22
22
|
export declare function orArrayToArray<T>(value?: T | T[]): T[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.1",
|
|
4
4
|
"description": "AIGNE core library for building AI-powered applications",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"yaml": "^2.7.1",
|
|
82
82
|
"zod": "^3.24.4",
|
|
83
83
|
"zod-to-json-schema": "^3.24.5",
|
|
84
|
-
"@aigne/
|
|
85
|
-
"@aigne/
|
|
84
|
+
"@aigne/platform-helpers": "^0.1.2",
|
|
85
|
+
"@aigne/observability": "^0.1.3"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@types/bun": "^1.2.12",
|