@aigne/core 1.71.0 → 1.72.0-beta.10
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 +158 -0
- package/lib/cjs/agents/agent.d.ts +42 -29
- package/lib/cjs/agents/agent.js +32 -11
- package/lib/cjs/agents/ai-agent.d.ts +63 -4
- package/lib/cjs/agents/ai-agent.js +148 -20
- package/lib/cjs/agents/chat-model.d.ts +162 -0
- package/lib/cjs/agents/chat-model.js +56 -5
- 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 +17 -2
- package/lib/cjs/agents/image-model.js +2 -0
- 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 +15 -0
- package/lib/cjs/agents/video-model.js +2 -0
- package/lib/cjs/aigne/usage.d.ts +5 -0
- package/lib/cjs/aigne/usage.js +6 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/loader/agent-yaml.d.ts +27 -64
- package/lib/cjs/loader/agent-yaml.js +22 -129
- package/lib/cjs/loader/agents.d.ts +4 -0
- package/lib/cjs/loader/agents.js +17 -0
- package/lib/cjs/loader/index.d.ts +16 -12
- package/lib/cjs/loader/index.js +46 -82
- package/lib/cjs/loader/schema.d.ts +21 -6
- package/lib/cjs/loader/schema.js +60 -1
- package/lib/cjs/memory/recorder.d.ts +4 -4
- package/lib/cjs/memory/retriever.d.ts +4 -4
- package/lib/cjs/prompt/agent-session.d.ts +135 -0
- package/lib/cjs/prompt/agent-session.js +889 -0
- package/lib/cjs/prompt/compact/compactor.d.ts +7 -0
- package/lib/cjs/prompt/compact/compactor.js +48 -0
- package/lib/cjs/prompt/compact/session-memory-extractor.d.ts +7 -0
- package/lib/cjs/prompt/compact/session-memory-extractor.js +139 -0
- package/lib/cjs/prompt/compact/types.d.ts +329 -0
- package/lib/cjs/prompt/compact/types.js +53 -0
- package/lib/cjs/prompt/compact/user-memory-extractor.d.ts +7 -0
- package/lib/cjs/prompt/compact/user-memory-extractor.js +120 -0
- package/lib/cjs/prompt/context/afs/history.d.ts +9 -0
- package/lib/cjs/prompt/context/afs/history.js +33 -0
- package/lib/cjs/prompt/context/afs/index.d.ts +20 -0
- package/lib/cjs/prompt/context/afs/index.js +54 -0
- package/lib/cjs/prompt/context/index.d.ts +31 -0
- package/lib/cjs/prompt/context/index.js +18 -0
- package/lib/cjs/prompt/prompt-builder.d.ts +11 -9
- package/lib/cjs/prompt/prompt-builder.js +81 -151
- package/lib/cjs/prompt/skills/afs/agent-skill/agent-skill.d.ts +18 -0
- package/lib/cjs/prompt/skills/afs/agent-skill/agent-skill.js +69 -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 +62 -0
- package/lib/cjs/prompt/skills/afs/base.d.ts +4 -0
- package/lib/cjs/prompt/skills/afs/base.js +8 -0
- package/lib/cjs/prompt/skills/afs/delete.d.ts +3 -2
- package/lib/cjs/prompt/skills/afs/delete.js +17 -5
- package/lib/cjs/prompt/skills/afs/edit.d.ts +9 -11
- package/lib/cjs/prompt/skills/afs/edit.js +89 -63
- package/lib/cjs/prompt/skills/afs/exec.d.ts +4 -3
- package/lib/cjs/prompt/skills/afs/exec.js +23 -7
- package/lib/cjs/prompt/skills/afs/index.js +4 -1
- package/lib/cjs/prompt/skills/afs/list.d.ts +4 -4
- package/lib/cjs/prompt/skills/afs/list.js +38 -55
- package/lib/cjs/prompt/skills/afs/read.d.ts +10 -5
- package/lib/cjs/prompt/skills/afs/read.js +66 -19
- package/lib/cjs/prompt/skills/afs/rename.d.ts +3 -2
- package/lib/cjs/prompt/skills/afs/rename.js +20 -6
- package/lib/cjs/prompt/skills/afs/search.d.ts +4 -3
- package/lib/cjs/prompt/skills/afs/search.js +24 -8
- package/lib/cjs/prompt/skills/afs/write.d.ts +3 -2
- package/lib/cjs/prompt/skills/afs/write.js +22 -8
- package/lib/cjs/prompt/template.d.ts +84 -9
- package/lib/cjs/prompt/template.js +46 -17
- package/lib/dts/agents/agent.d.ts +42 -29
- package/lib/dts/agents/ai-agent.d.ts +63 -4
- package/lib/dts/agents/chat-model.d.ts +162 -0
- package/lib/dts/agents/image-agent.d.ts +17 -1
- package/lib/dts/agents/image-model.d.ts +17 -2
- 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 +15 -0
- package/lib/dts/aigne/context.d.ts +2 -2
- package/lib/dts/aigne/usage.d.ts +5 -0
- package/lib/dts/index.d.ts +1 -0
- package/lib/dts/loader/agent-yaml.d.ts +27 -64
- package/lib/dts/loader/agents.d.ts +4 -0
- package/lib/dts/loader/index.d.ts +16 -12
- package/lib/dts/loader/schema.d.ts +21 -6
- package/lib/dts/memory/recorder.d.ts +4 -4
- package/lib/dts/memory/retriever.d.ts +4 -4
- package/lib/dts/prompt/agent-session.d.ts +135 -0
- package/lib/dts/prompt/compact/compactor.d.ts +7 -0
- package/lib/dts/prompt/compact/session-memory-extractor.d.ts +7 -0
- package/lib/dts/prompt/compact/types.d.ts +329 -0
- package/lib/dts/prompt/compact/user-memory-extractor.d.ts +7 -0
- package/lib/dts/prompt/context/afs/history.d.ts +9 -0
- package/lib/dts/prompt/context/afs/index.d.ts +20 -0
- package/lib/dts/prompt/context/index.d.ts +31 -0
- package/lib/dts/prompt/prompt-builder.d.ts +11 -9
- package/lib/dts/prompt/skills/afs/agent-skill/agent-skill.d.ts +18 -0
- package/lib/dts/prompt/skills/afs/agent-skill/skill-loader.d.ts +13 -0
- package/lib/dts/prompt/skills/afs/base.d.ts +4 -0
- package/lib/dts/prompt/skills/afs/delete.d.ts +3 -2
- package/lib/dts/prompt/skills/afs/edit.d.ts +9 -11
- package/lib/dts/prompt/skills/afs/exec.d.ts +4 -3
- package/lib/dts/prompt/skills/afs/list.d.ts +4 -4
- package/lib/dts/prompt/skills/afs/read.d.ts +10 -5
- package/lib/dts/prompt/skills/afs/rename.d.ts +3 -2
- package/lib/dts/prompt/skills/afs/search.d.ts +4 -3
- package/lib/dts/prompt/skills/afs/write.d.ts +3 -2
- package/lib/dts/prompt/template.d.ts +84 -9
- package/lib/esm/agents/agent.d.ts +42 -29
- package/lib/esm/agents/agent.js +32 -11
- package/lib/esm/agents/ai-agent.d.ts +63 -4
- package/lib/esm/agents/ai-agent.js +148 -20
- package/lib/esm/agents/chat-model.d.ts +162 -0
- package/lib/esm/agents/chat-model.js +55 -4
- 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 +17 -2
- package/lib/esm/agents/image-model.js +2 -0
- 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 +15 -0
- package/lib/esm/agents/video-model.js +2 -0
- package/lib/esm/aigne/context.d.ts +2 -2
- package/lib/esm/aigne/usage.d.ts +5 -0
- package/lib/esm/aigne/usage.js +6 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/loader/agent-yaml.d.ts +27 -64
- package/lib/esm/loader/agent-yaml.js +22 -128
- package/lib/esm/loader/agents.d.ts +4 -0
- package/lib/esm/loader/agents.js +14 -0
- package/lib/esm/loader/index.d.ts +16 -12
- package/lib/esm/loader/index.js +47 -82
- package/lib/esm/loader/schema.d.ts +21 -6
- package/lib/esm/loader/schema.js +57 -0
- package/lib/esm/memory/recorder.d.ts +4 -4
- package/lib/esm/memory/retriever.d.ts +4 -4
- package/lib/esm/prompt/agent-session.d.ts +135 -0
- package/lib/esm/prompt/agent-session.js +849 -0
- package/lib/esm/prompt/compact/compactor.d.ts +7 -0
- package/lib/esm/prompt/compact/compactor.js +44 -0
- package/lib/esm/prompt/compact/session-memory-extractor.d.ts +7 -0
- package/lib/esm/prompt/compact/session-memory-extractor.js +135 -0
- package/lib/esm/prompt/compact/types.d.ts +329 -0
- package/lib/esm/prompt/compact/types.js +50 -0
- package/lib/esm/prompt/compact/user-memory-extractor.d.ts +7 -0
- package/lib/esm/prompt/compact/user-memory-extractor.js +116 -0
- package/lib/esm/prompt/context/afs/history.d.ts +9 -0
- package/lib/esm/prompt/context/afs/history.js +30 -0
- package/lib/esm/prompt/context/afs/index.d.ts +20 -0
- package/lib/esm/prompt/context/afs/index.js +51 -0
- package/lib/esm/prompt/context/index.d.ts +31 -0
- package/lib/esm/prompt/context/index.js +15 -0
- package/lib/esm/prompt/prompt-builder.d.ts +11 -9
- package/lib/esm/prompt/prompt-builder.js +80 -150
- package/lib/esm/prompt/skills/afs/agent-skill/agent-skill.d.ts +18 -0
- package/lib/esm/prompt/skills/afs/agent-skill/agent-skill.js +65 -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 +54 -0
- package/lib/esm/prompt/skills/afs/base.d.ts +4 -0
- package/lib/esm/prompt/skills/afs/base.js +4 -0
- package/lib/esm/prompt/skills/afs/delete.d.ts +3 -2
- package/lib/esm/prompt/skills/afs/delete.js +17 -5
- package/lib/esm/prompt/skills/afs/edit.d.ts +9 -11
- package/lib/esm/prompt/skills/afs/edit.js +89 -63
- package/lib/esm/prompt/skills/afs/exec.d.ts +4 -3
- package/lib/esm/prompt/skills/afs/exec.js +23 -7
- package/lib/esm/prompt/skills/afs/index.js +4 -1
- package/lib/esm/prompt/skills/afs/list.d.ts +4 -4
- package/lib/esm/prompt/skills/afs/list.js +38 -55
- package/lib/esm/prompt/skills/afs/read.d.ts +10 -5
- package/lib/esm/prompt/skills/afs/read.js +66 -19
- package/lib/esm/prompt/skills/afs/rename.d.ts +3 -2
- package/lib/esm/prompt/skills/afs/rename.js +20 -6
- package/lib/esm/prompt/skills/afs/search.d.ts +4 -3
- package/lib/esm/prompt/skills/afs/search.js +24 -8
- package/lib/esm/prompt/skills/afs/write.d.ts +3 -2
- package/lib/esm/prompt/skills/afs/write.js +22 -8
- package/lib/esm/prompt/template.d.ts +84 -9
- package/lib/esm/prompt/template.js +46 -17
- package/package.json +6 -5
|
@@ -27,35 +27,38 @@ export declare class ChatMessageTemplate {
|
|
|
27
27
|
content?: ChatModelInputMessage["content"];
|
|
28
28
|
name?: string | undefined;
|
|
29
29
|
options?: FormatOptions | undefined;
|
|
30
|
-
|
|
30
|
+
cacheControl?: ChatModelInputMessage["cacheControl"];
|
|
31
|
+
constructor(role: "system" | "user" | "agent" | "tool", content?: ChatModelInputMessage["content"], name?: string | undefined, options?: FormatOptions | undefined, cacheControl?: ChatModelInputMessage["cacheControl"]);
|
|
31
32
|
format(variables?: Record<string, unknown>, options?: FormatOptions): Promise<ChatModelInputMessage>;
|
|
32
33
|
}
|
|
33
34
|
export declare class SystemMessageTemplate extends ChatMessageTemplate {
|
|
34
|
-
static from(content: string, name?: string, options?: FormatOptions): SystemMessageTemplate;
|
|
35
|
+
static from(content: string, name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]): SystemMessageTemplate;
|
|
35
36
|
}
|
|
36
37
|
export declare class UserMessageTemplate extends ChatMessageTemplate {
|
|
37
|
-
static from(template: ChatModelInputMessageContent, name?: string, options?: FormatOptions): UserMessageTemplate;
|
|
38
|
+
static from(template: ChatModelInputMessageContent, name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]): UserMessageTemplate;
|
|
38
39
|
}
|
|
39
40
|
export declare class AgentMessageTemplate extends ChatMessageTemplate {
|
|
40
41
|
toolCalls?: ChatModelOutputToolCall[] | undefined;
|
|
41
|
-
static from(template?: ChatModelInputMessage["content"], toolCalls?: ChatModelOutputToolCall[], name?: string, options?: FormatOptions): AgentMessageTemplate;
|
|
42
|
-
constructor(content?: ChatModelInputMessage["content"], toolCalls?: ChatModelOutputToolCall[] | undefined, name?: string, options?: FormatOptions);
|
|
42
|
+
static from(template?: ChatModelInputMessage["content"], toolCalls?: ChatModelOutputToolCall[], name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]): AgentMessageTemplate;
|
|
43
|
+
constructor(content?: ChatModelInputMessage["content"], toolCalls?: ChatModelOutputToolCall[] | undefined, name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]);
|
|
43
44
|
format(_variables?: Record<string, unknown>, _options?: FormatOptions): Promise<{
|
|
44
|
-
role: "agent" | "
|
|
45
|
+
role: "agent" | "user" | "system" | "tool";
|
|
45
46
|
name: string | undefined;
|
|
46
47
|
content: ChatModelInputMessageContent | undefined;
|
|
47
48
|
toolCalls: ChatModelOutputToolCall[] | undefined;
|
|
49
|
+
cacheControl: import("../agents/chat-model.js").CacheControl | undefined;
|
|
48
50
|
}>;
|
|
49
51
|
}
|
|
50
52
|
export declare class ToolMessageTemplate extends ChatMessageTemplate {
|
|
51
53
|
toolCallId: string;
|
|
52
|
-
static from(content: object | string, toolCallId: string, name?: string, options?: FormatOptions): ToolMessageTemplate;
|
|
53
|
-
constructor(content: object | string, toolCallId: string, name?: string, options?: FormatOptions);
|
|
54
|
+
static from(content: object | string, toolCallId: string, name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]): ToolMessageTemplate;
|
|
55
|
+
constructor(content: object | string, toolCallId: string, name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]);
|
|
54
56
|
format(_variables?: Record<string, unknown>, _options?: FormatOptions): Promise<{
|
|
55
|
-
role: "agent" | "
|
|
57
|
+
role: "agent" | "user" | "system" | "tool";
|
|
56
58
|
name: string | undefined;
|
|
57
59
|
content: ChatModelInputMessageContent | undefined;
|
|
58
60
|
toolCallId: string;
|
|
61
|
+
cacheControl: import("../agents/chat-model.js").CacheControl | undefined;
|
|
59
62
|
}>;
|
|
60
63
|
}
|
|
61
64
|
export declare class ChatMessagesTemplate {
|
|
@@ -69,26 +72,62 @@ declare const chatMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
69
72
|
role: z.ZodLiteral<"system">;
|
|
70
73
|
content: z.ZodString;
|
|
71
74
|
name: z.ZodOptional<z.ZodString>;
|
|
75
|
+
cacheControl: z.ZodOptional<z.ZodObject<{
|
|
76
|
+
type: z.ZodLiteral<"ephemeral">;
|
|
77
|
+
ttl: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"5m">, z.ZodLiteral<"1h">]>>;
|
|
78
|
+
}, "strip", z.ZodTypeAny, {
|
|
79
|
+
type: "ephemeral";
|
|
80
|
+
ttl?: "5m" | "1h" | undefined;
|
|
81
|
+
}, {
|
|
82
|
+
type: "ephemeral";
|
|
83
|
+
ttl?: "5m" | "1h" | undefined;
|
|
84
|
+
}>>;
|
|
72
85
|
}, "strip", z.ZodTypeAny, {
|
|
73
86
|
role: "system";
|
|
74
87
|
content: string;
|
|
75
88
|
name?: string | undefined;
|
|
89
|
+
cacheControl?: {
|
|
90
|
+
type: "ephemeral";
|
|
91
|
+
ttl?: "5m" | "1h" | undefined;
|
|
92
|
+
} | undefined;
|
|
76
93
|
}, {
|
|
77
94
|
role: "system";
|
|
78
95
|
content: string;
|
|
79
96
|
name?: string | undefined;
|
|
97
|
+
cacheControl?: {
|
|
98
|
+
type: "ephemeral";
|
|
99
|
+
ttl?: "5m" | "1h" | undefined;
|
|
100
|
+
} | undefined;
|
|
80
101
|
}>, z.ZodObject<{
|
|
81
102
|
role: z.ZodLiteral<"user">;
|
|
82
103
|
content: z.ZodString;
|
|
83
104
|
name: z.ZodOptional<z.ZodString>;
|
|
105
|
+
cacheControl: z.ZodOptional<z.ZodObject<{
|
|
106
|
+
type: z.ZodLiteral<"ephemeral">;
|
|
107
|
+
ttl: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"5m">, z.ZodLiteral<"1h">]>>;
|
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
|
109
|
+
type: "ephemeral";
|
|
110
|
+
ttl?: "5m" | "1h" | undefined;
|
|
111
|
+
}, {
|
|
112
|
+
type: "ephemeral";
|
|
113
|
+
ttl?: "5m" | "1h" | undefined;
|
|
114
|
+
}>>;
|
|
84
115
|
}, "strip", z.ZodTypeAny, {
|
|
85
116
|
role: "user";
|
|
86
117
|
content: string;
|
|
87
118
|
name?: string | undefined;
|
|
119
|
+
cacheControl?: {
|
|
120
|
+
type: "ephemeral";
|
|
121
|
+
ttl?: "5m" | "1h" | undefined;
|
|
122
|
+
} | undefined;
|
|
88
123
|
}, {
|
|
89
124
|
role: "user";
|
|
90
125
|
content: string;
|
|
91
126
|
name?: string | undefined;
|
|
127
|
+
cacheControl?: {
|
|
128
|
+
type: "ephemeral";
|
|
129
|
+
ttl?: "5m" | "1h" | undefined;
|
|
130
|
+
} | undefined;
|
|
92
131
|
}>, z.ZodObject<{
|
|
93
132
|
role: z.ZodLiteral<"agent">;
|
|
94
133
|
content: z.ZodOptional<z.ZodString>;
|
|
@@ -121,10 +160,24 @@ declare const chatMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
121
160
|
id: string;
|
|
122
161
|
}>, "many">>;
|
|
123
162
|
name: z.ZodOptional<z.ZodString>;
|
|
163
|
+
cacheControl: z.ZodOptional<z.ZodObject<{
|
|
164
|
+
type: z.ZodLiteral<"ephemeral">;
|
|
165
|
+
ttl: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"5m">, z.ZodLiteral<"1h">]>>;
|
|
166
|
+
}, "strip", z.ZodTypeAny, {
|
|
167
|
+
type: "ephemeral";
|
|
168
|
+
ttl?: "5m" | "1h" | undefined;
|
|
169
|
+
}, {
|
|
170
|
+
type: "ephemeral";
|
|
171
|
+
ttl?: "5m" | "1h" | undefined;
|
|
172
|
+
}>>;
|
|
124
173
|
}, "strip", z.ZodTypeAny, {
|
|
125
174
|
role: "agent";
|
|
126
175
|
name?: string | undefined;
|
|
127
176
|
content?: string | undefined;
|
|
177
|
+
cacheControl?: {
|
|
178
|
+
type: "ephemeral";
|
|
179
|
+
ttl?: "5m" | "1h" | undefined;
|
|
180
|
+
} | undefined;
|
|
128
181
|
toolCalls?: {
|
|
129
182
|
function: {
|
|
130
183
|
name: string;
|
|
@@ -137,6 +190,10 @@ declare const chatMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
137
190
|
role: "agent";
|
|
138
191
|
name?: string | undefined;
|
|
139
192
|
content?: string | undefined;
|
|
193
|
+
cacheControl?: {
|
|
194
|
+
type: "ephemeral";
|
|
195
|
+
ttl?: "5m" | "1h" | undefined;
|
|
196
|
+
} | undefined;
|
|
140
197
|
toolCalls?: {
|
|
141
198
|
function: {
|
|
142
199
|
name: string;
|
|
@@ -150,16 +207,34 @@ declare const chatMessageSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
150
207
|
content: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>, string, string | Record<string, unknown>>;
|
|
151
208
|
toolCallId: z.ZodString;
|
|
152
209
|
name: z.ZodOptional<z.ZodString>;
|
|
210
|
+
cacheControl: z.ZodOptional<z.ZodObject<{
|
|
211
|
+
type: z.ZodLiteral<"ephemeral">;
|
|
212
|
+
ttl: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"5m">, z.ZodLiteral<"1h">]>>;
|
|
213
|
+
}, "strip", z.ZodTypeAny, {
|
|
214
|
+
type: "ephemeral";
|
|
215
|
+
ttl?: "5m" | "1h" | undefined;
|
|
216
|
+
}, {
|
|
217
|
+
type: "ephemeral";
|
|
218
|
+
ttl?: "5m" | "1h" | undefined;
|
|
219
|
+
}>>;
|
|
153
220
|
}, "strip", z.ZodTypeAny, {
|
|
154
221
|
role: "tool";
|
|
155
222
|
content: string;
|
|
156
223
|
toolCallId: string;
|
|
157
224
|
name?: string | undefined;
|
|
225
|
+
cacheControl?: {
|
|
226
|
+
type: "ephemeral";
|
|
227
|
+
ttl?: "5m" | "1h" | undefined;
|
|
228
|
+
} | undefined;
|
|
158
229
|
}, {
|
|
159
230
|
role: "tool";
|
|
160
231
|
content: string | Record<string, unknown>;
|
|
161
232
|
toolCallId: string;
|
|
162
233
|
name?: string | undefined;
|
|
234
|
+
cacheControl?: {
|
|
235
|
+
type: "ephemeral";
|
|
236
|
+
ttl?: "5m" | "1h" | undefined;
|
|
237
|
+
} | undefined;
|
|
163
238
|
}>]>;
|
|
164
239
|
export declare function safeParseChatMessages(messages: unknown): ChatMessageTemplate[] | undefined;
|
|
165
240
|
export declare function parseChatMessages(messages: (z.infer<typeof chatMessageSchema> & {
|
|
@@ -80,11 +80,13 @@ class ChatMessageTemplate {
|
|
|
80
80
|
content;
|
|
81
81
|
name;
|
|
82
82
|
options;
|
|
83
|
-
|
|
83
|
+
cacheControl;
|
|
84
|
+
constructor(role, content, name, options, cacheControl) {
|
|
84
85
|
this.role = role;
|
|
85
86
|
this.content = content;
|
|
86
87
|
this.name = name;
|
|
87
88
|
this.options = options;
|
|
89
|
+
this.cacheControl = cacheControl;
|
|
88
90
|
}
|
|
89
91
|
async format(variables, options) {
|
|
90
92
|
options = { ...this.options, ...(0, type_utils_js_1.omitBy)(options ?? {}, (v) => (0, type_utils_js_1.isNil)(v)) };
|
|
@@ -103,29 +105,30 @@ class ChatMessageTemplate {
|
|
|
103
105
|
role: this.role,
|
|
104
106
|
content,
|
|
105
107
|
name: this.name,
|
|
108
|
+
cacheControl: this.cacheControl,
|
|
106
109
|
};
|
|
107
110
|
}
|
|
108
111
|
}
|
|
109
112
|
exports.ChatMessageTemplate = ChatMessageTemplate;
|
|
110
113
|
class SystemMessageTemplate extends ChatMessageTemplate {
|
|
111
|
-
static from(content, name, options) {
|
|
112
|
-
return new SystemMessageTemplate("system", content, name, options);
|
|
114
|
+
static from(content, name, options, cacheControl) {
|
|
115
|
+
return new SystemMessageTemplate("system", content, name, options, cacheControl);
|
|
113
116
|
}
|
|
114
117
|
}
|
|
115
118
|
exports.SystemMessageTemplate = SystemMessageTemplate;
|
|
116
119
|
class UserMessageTemplate extends ChatMessageTemplate {
|
|
117
|
-
static from(template, name, options) {
|
|
118
|
-
return new UserMessageTemplate("user", template, name, options);
|
|
120
|
+
static from(template, name, options, cacheControl) {
|
|
121
|
+
return new UserMessageTemplate("user", template, name, options, cacheControl);
|
|
119
122
|
}
|
|
120
123
|
}
|
|
121
124
|
exports.UserMessageTemplate = UserMessageTemplate;
|
|
122
125
|
class AgentMessageTemplate extends ChatMessageTemplate {
|
|
123
126
|
toolCalls;
|
|
124
|
-
static from(template, toolCalls, name, options) {
|
|
125
|
-
return new AgentMessageTemplate(template, toolCalls, name, options);
|
|
127
|
+
static from(template, toolCalls, name, options, cacheControl) {
|
|
128
|
+
return new AgentMessageTemplate(template, toolCalls, name, options, cacheControl);
|
|
126
129
|
}
|
|
127
|
-
constructor(content, toolCalls, name, options) {
|
|
128
|
-
super("agent", content, name, options);
|
|
130
|
+
constructor(content, toolCalls, name, options, cacheControl) {
|
|
131
|
+
super("agent", content, name, options, cacheControl);
|
|
129
132
|
this.toolCalls = toolCalls;
|
|
130
133
|
}
|
|
131
134
|
async format(_variables, _options) {
|
|
@@ -135,17 +138,18 @@ class AgentMessageTemplate extends ChatMessageTemplate {
|
|
|
135
138
|
// NOTE: agent message should not rendered by template
|
|
136
139
|
content: this.content,
|
|
137
140
|
toolCalls: this.toolCalls,
|
|
141
|
+
cacheControl: this.cacheControl,
|
|
138
142
|
};
|
|
139
143
|
}
|
|
140
144
|
}
|
|
141
145
|
exports.AgentMessageTemplate = AgentMessageTemplate;
|
|
142
146
|
class ToolMessageTemplate extends ChatMessageTemplate {
|
|
143
147
|
toolCallId;
|
|
144
|
-
static from(content, toolCallId, name, options) {
|
|
145
|
-
return new ToolMessageTemplate(content, toolCallId, name, options);
|
|
148
|
+
static from(content, toolCallId, name, options, cacheControl) {
|
|
149
|
+
return new ToolMessageTemplate(content, toolCallId, name, options, cacheControl);
|
|
146
150
|
}
|
|
147
|
-
constructor(content, toolCallId, name, options) {
|
|
148
|
-
super("tool", typeof content === "string" ? content : (0, yaml_1.stringify)(content), name, options);
|
|
151
|
+
constructor(content, toolCallId, name, options, cacheControl) {
|
|
152
|
+
super("tool", typeof content === "string" ? content : (0, yaml_1.stringify)(content), name, options, cacheControl);
|
|
149
153
|
this.toolCallId = toolCallId;
|
|
150
154
|
}
|
|
151
155
|
async format(_variables, _options) {
|
|
@@ -155,6 +159,7 @@ class ToolMessageTemplate extends ChatMessageTemplate {
|
|
|
155
159
|
// NOTE: tool result should not rendered by template
|
|
156
160
|
content: this.content,
|
|
157
161
|
toolCallId: this.toolCallId,
|
|
162
|
+
cacheControl: this.cacheControl,
|
|
158
163
|
};
|
|
159
164
|
}
|
|
160
165
|
}
|
|
@@ -179,11 +184,23 @@ const systemChatMessageSchema = zod_1.z.object({
|
|
|
179
184
|
role: zod_1.z.literal("system"),
|
|
180
185
|
content: zod_1.z.string(),
|
|
181
186
|
name: zod_1.z.string().optional(),
|
|
187
|
+
cacheControl: zod_1.z
|
|
188
|
+
.object({
|
|
189
|
+
type: zod_1.z.literal("ephemeral"),
|
|
190
|
+
ttl: zod_1.z.union([zod_1.z.literal("5m"), zod_1.z.literal("1h")]).optional(),
|
|
191
|
+
})
|
|
192
|
+
.optional(),
|
|
182
193
|
});
|
|
183
194
|
const userChatMessageSchema = zod_1.z.object({
|
|
184
195
|
role: zod_1.z.literal("user"),
|
|
185
196
|
content: zod_1.z.string(),
|
|
186
197
|
name: zod_1.z.string().optional(),
|
|
198
|
+
cacheControl: zod_1.z
|
|
199
|
+
.object({
|
|
200
|
+
type: zod_1.z.literal("ephemeral"),
|
|
201
|
+
ttl: zod_1.z.union([zod_1.z.literal("5m"), zod_1.z.literal("1h")]).optional(),
|
|
202
|
+
})
|
|
203
|
+
.optional(),
|
|
187
204
|
});
|
|
188
205
|
const chatModelOutputToolCallSchema = zod_1.z.object({
|
|
189
206
|
id: zod_1.z.string(),
|
|
@@ -198,6 +215,12 @@ const agentChatMessageSchema = zod_1.z.object({
|
|
|
198
215
|
content: zod_1.z.string().optional(),
|
|
199
216
|
toolCalls: zod_1.z.array(chatModelOutputToolCallSchema).optional(),
|
|
200
217
|
name: zod_1.z.string().optional(),
|
|
218
|
+
cacheControl: zod_1.z
|
|
219
|
+
.object({
|
|
220
|
+
type: zod_1.z.literal("ephemeral"),
|
|
221
|
+
ttl: zod_1.z.union([zod_1.z.literal("5m"), zod_1.z.literal("1h")]).optional(),
|
|
222
|
+
})
|
|
223
|
+
.optional(),
|
|
201
224
|
});
|
|
202
225
|
const toolChatMessageSchema = zod_1.z.object({
|
|
203
226
|
role: zod_1.z.literal("tool"),
|
|
@@ -206,6 +229,12 @@ const toolChatMessageSchema = zod_1.z.object({
|
|
|
206
229
|
.transform((val) => (typeof val !== "string" ? JSON.stringify(val) : val)),
|
|
207
230
|
toolCallId: zod_1.z.string(),
|
|
208
231
|
name: zod_1.z.string().optional(),
|
|
232
|
+
cacheControl: zod_1.z
|
|
233
|
+
.object({
|
|
234
|
+
type: zod_1.z.literal("ephemeral"),
|
|
235
|
+
ttl: zod_1.z.union([zod_1.z.literal("5m"), zod_1.z.literal("1h")]).optional(),
|
|
236
|
+
})
|
|
237
|
+
.optional(),
|
|
209
238
|
});
|
|
210
239
|
const chatMessageSchema = zod_1.z.union([
|
|
211
240
|
systemChatMessageSchema,
|
|
@@ -224,13 +253,13 @@ function parseChatMessages(messages) {
|
|
|
224
253
|
return messages.map((message) => {
|
|
225
254
|
switch (message.role) {
|
|
226
255
|
case "system":
|
|
227
|
-
return SystemMessageTemplate.from(message.content, message.name, message.options);
|
|
256
|
+
return SystemMessageTemplate.from(message.content, message.name, message.options, message.cacheControl);
|
|
228
257
|
case "user":
|
|
229
|
-
return UserMessageTemplate.from(message.content, message.name, message.options);
|
|
258
|
+
return UserMessageTemplate.from(message.content, message.name, message.options, message.cacheControl);
|
|
230
259
|
case "agent":
|
|
231
|
-
return AgentMessageTemplate.from(message.content, message.toolCalls, message.name, message.options);
|
|
260
|
+
return AgentMessageTemplate.from(message.content, message.toolCalls, message.name, message.options, message.cacheControl);
|
|
232
261
|
case "tool":
|
|
233
|
-
return ToolMessageTemplate.from(message.content, message.toolCallId, message.name, message.options);
|
|
262
|
+
return ToolMessageTemplate.from(message.content, message.toolCallId, message.name, message.options, message.cacheControl);
|
|
234
263
|
}
|
|
235
264
|
});
|
|
236
265
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AFS, type
|
|
1
|
+
import { AFS, type AFSExecOptions, type AFSExecResult, type AFSListOptions, type AFSListResult, type AFSModule, type AFSOptions, type AFSReadResult, type AFSSearchOptions } from "@aigne/afs";
|
|
2
2
|
import { nodejs } from "@aigne/platform-helpers/nodejs/index.js";
|
|
3
3
|
import type * as prompts from "@inquirer/prompts";
|
|
4
|
-
import { type ZodObject, type ZodType } from "zod";
|
|
4
|
+
import { type ZodObject, type ZodType, z } from "zod";
|
|
5
5
|
import type { AgentEvent, Context, UserContext } from "../aigne/context.js";
|
|
6
6
|
import type { MessagePayload } from "../aigne/message-queue.js";
|
|
7
7
|
import type { ContextUsage } from "../aigne/usage.js";
|
|
@@ -9,7 +9,7 @@ import type { Memory, MemoryAgent } from "../memory/memory.js";
|
|
|
9
9
|
import type { MemoryRecorderInput } from "../memory/recorder.js";
|
|
10
10
|
import type { MemoryRetrieverInput } from "../memory/retriever.js";
|
|
11
11
|
import { type Nullish, type PromiseOrValue, type XOr } from "../utils/type-utils.js";
|
|
12
|
-
import type { ChatModel } from "./chat-model.js";
|
|
12
|
+
import type { ChatModel, ChatModelInputMessage } from "./chat-model.js";
|
|
13
13
|
import type { GuideRailAgent, GuideRailAgentOutput } from "./guide-rail-agent.js";
|
|
14
14
|
import type { ImageModel } from "./image-model.js";
|
|
15
15
|
import { type GetterSchema, type TransferAgentOutput } from "./types.js";
|
|
@@ -118,7 +118,6 @@ export interface AgentOptions<I extends Message = Message, O extends Message = M
|
|
|
118
118
|
* agentSucceed, or agentFailed
|
|
119
119
|
*/
|
|
120
120
|
disableEvents?: boolean;
|
|
121
|
-
historyConfig?: Agent["historyConfig"];
|
|
122
121
|
/**
|
|
123
122
|
* One or more memory agents this agent can use
|
|
124
123
|
*/
|
|
@@ -211,15 +210,15 @@ export declare abstract class Agent<I extends Message = any, O extends Message =
|
|
|
211
210
|
parsed: object;
|
|
212
211
|
}): Promise<Agent<I, O>>;
|
|
213
212
|
constructor(options?: AgentOptions<I, O>);
|
|
213
|
+
afs?: AFS;
|
|
214
|
+
tag?: string;
|
|
214
215
|
/**
|
|
215
216
|
* List of memories this agent can use
|
|
216
217
|
*
|
|
217
218
|
* @deprecated use afs instead
|
|
218
219
|
*/
|
|
219
220
|
readonly memories: MemoryAgent[];
|
|
220
|
-
afs?: AFS;
|
|
221
221
|
asyncMemoryRecord?: boolean;
|
|
222
|
-
tag?: string;
|
|
223
222
|
/**
|
|
224
223
|
* Maximum number of memory items to retrieve
|
|
225
224
|
*/
|
|
@@ -349,11 +348,6 @@ export declare abstract class Agent<I extends Message = any, O extends Message =
|
|
|
349
348
|
* agentSucceed, or agentFailed
|
|
350
349
|
*/
|
|
351
350
|
private disableEvents?;
|
|
352
|
-
historyConfig?: {
|
|
353
|
-
disabled?: boolean;
|
|
354
|
-
maxTokens?: number;
|
|
355
|
-
maxItems?: number;
|
|
356
|
-
};
|
|
357
351
|
private subscriptions;
|
|
358
352
|
/**
|
|
359
353
|
* Attach agent to context:
|
|
@@ -455,7 +449,9 @@ export declare abstract class Agent<I extends Message = any, O extends Message =
|
|
|
455
449
|
* @param options Invocation options
|
|
456
450
|
* @returns Final processed output
|
|
457
451
|
*/
|
|
458
|
-
protected processAgentOutput(input: I, output: Exclude<AgentResponse<O>, AgentResponseStream<O>>, options: AgentInvokeOptions
|
|
452
|
+
protected processAgentOutput(input: I, output: Exclude<AgentResponse<O>, AgentResponseStream<O>>, { messages, ...options }: AgentInvokeOptions & {
|
|
453
|
+
messages?: ChatModelInputMessage[];
|
|
454
|
+
}): Promise<O>;
|
|
459
455
|
/**
|
|
460
456
|
* Process errors that occur during agent execution
|
|
461
457
|
*
|
|
@@ -573,23 +569,10 @@ export declare abstract class Agent<I extends Message = any, O extends Message =
|
|
|
573
569
|
/** For AFSModule interface **/
|
|
574
570
|
private agentToAFSEntry;
|
|
575
571
|
private findAgentByAFSPath;
|
|
576
|
-
list(_path: string, _options?: AFSListOptions): Promise<
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
read(path: string): Promise<{
|
|
581
|
-
result?: AFSEntry;
|
|
582
|
-
message?: string;
|
|
583
|
-
}>;
|
|
584
|
-
search(path: string, _query: string, options?: AFSSearchOptions): Promise<{
|
|
585
|
-
list: AFSEntry[];
|
|
586
|
-
message?: string;
|
|
587
|
-
}>;
|
|
588
|
-
exec(path: string, args: Record<string, any>, options: {
|
|
589
|
-
context: Context;
|
|
590
|
-
}): Promise<{
|
|
591
|
-
result: Record<string, any>;
|
|
592
|
-
}>;
|
|
572
|
+
list(_path: string, _options?: AFSListOptions): Promise<AFSListResult>;
|
|
573
|
+
read(path: string): Promise<AFSReadResult>;
|
|
574
|
+
search(path: string, _query: string, options?: AFSSearchOptions): Promise<AFSListResult>;
|
|
575
|
+
exec(path: string, args: Record<string, any>, options: AFSExecOptions): Promise<AFSExecResult>;
|
|
593
576
|
}
|
|
594
577
|
export type AgentInput<T extends Agent> = T extends Agent<infer I, any> ? I : never;
|
|
595
578
|
export type AgentOutput<T extends Agent> = T extends Agent<any, infer O> ? O : never;
|
|
@@ -796,12 +779,31 @@ export interface AgentResponseProgress {
|
|
|
796
779
|
} | {
|
|
797
780
|
event: "agentFailed";
|
|
798
781
|
error: Error;
|
|
782
|
+
} | {
|
|
783
|
+
event: "message";
|
|
784
|
+
message: ChatModelInputMessage;
|
|
799
785
|
}) & Omit<AgentEvent, "agent"> & {
|
|
800
786
|
agent: {
|
|
801
787
|
name: string;
|
|
802
788
|
};
|
|
803
789
|
};
|
|
804
790
|
}
|
|
791
|
+
export type AgentResponseProgressMessageItem = {
|
|
792
|
+
type: "text";
|
|
793
|
+
content: string;
|
|
794
|
+
} | {
|
|
795
|
+
type: "thinking";
|
|
796
|
+
thoughts: string;
|
|
797
|
+
} | {
|
|
798
|
+
type: "tool_use";
|
|
799
|
+
toolUseId: string;
|
|
800
|
+
name: string;
|
|
801
|
+
input: unknown;
|
|
802
|
+
} | {
|
|
803
|
+
type: "tool_result";
|
|
804
|
+
toolUseId: string;
|
|
805
|
+
content: unknown;
|
|
806
|
+
};
|
|
805
807
|
export declare function isAgentResponseProgress<T>(chunk: AgentResponseChunk<T>): chunk is AgentResponseProgress;
|
|
806
808
|
/**
|
|
807
809
|
* Creates a text delta for streaming responses
|
|
@@ -883,6 +885,17 @@ export interface FunctionAgentOptions<I extends Message = Message, O extends Mes
|
|
|
883
885
|
*/
|
|
884
886
|
export declare class FunctionAgent<I extends Message = Message, O extends Message = Message> extends Agent<I, O> {
|
|
885
887
|
tag: string;
|
|
888
|
+
static schema(): ZodObject<{
|
|
889
|
+
process: ZodType<FunctionAgentFn>;
|
|
890
|
+
}, "strip", z.ZodTypeAny, {
|
|
891
|
+
process: FunctionAgentFn<any, any, FunctionAgent<any, any>>;
|
|
892
|
+
}, {
|
|
893
|
+
process: FunctionAgentFn<any, any, FunctionAgent<any, any>>;
|
|
894
|
+
}>;
|
|
895
|
+
static load<I extends Message = any, O extends Message = any>(options: {
|
|
896
|
+
filepath: string;
|
|
897
|
+
parsed: object;
|
|
898
|
+
}): Promise<Agent<I, O>>;
|
|
886
899
|
/**
|
|
887
900
|
* Create a function agent from a function or options
|
|
888
901
|
*
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { type ZodObject, type ZodType, z } from "zod";
|
|
2
|
+
import { type NestAgentSchema } from "../loader/agent-yaml.js";
|
|
3
|
+
import type { AgentLoadOptions } from "../loader/index.js";
|
|
4
|
+
import { type Instructions } from "../loader/schema.js";
|
|
5
|
+
import type { CompactConfig, SessionMemoryConfig, UserMemoryConfig } from "../prompt/agent-session.js";
|
|
2
6
|
import { PromptBuilder } from "../prompt/prompt-builder.js";
|
|
3
7
|
import { Agent, type AgentInvokeOptions, type AgentOptions, type AgentProcessAsyncGenerator, type AgentProcessResult, type Message } from "./agent.js";
|
|
4
8
|
import type { ChatModel, ChatModelInput } from "./chat-model.js";
|
|
@@ -23,8 +27,6 @@ export interface AIAgentOptions<I extends Message = Message, O extends Message =
|
|
|
23
27
|
* more complex prompt templates
|
|
24
28
|
*/
|
|
25
29
|
instructions?: string | PromptBuilder;
|
|
26
|
-
autoReorderSystemMessages?: boolean;
|
|
27
|
-
autoMergeSystemMessages?: boolean;
|
|
28
30
|
/**
|
|
29
31
|
* Pick a message from input to use as the user's message
|
|
30
32
|
*/
|
|
@@ -124,6 +126,53 @@ export interface AIAgentOptions<I extends Message = Message, O extends Message =
|
|
|
124
126
|
*/
|
|
125
127
|
memoryPromptTemplate?: string;
|
|
126
128
|
useMemoriesFromContext?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Agent session configuration
|
|
131
|
+
*
|
|
132
|
+
* Controls history recording, memory extraction, and conversation compaction.
|
|
133
|
+
* By default, mode is "auto" (enabled). Set `{ mode: "disabled" }` to disable
|
|
134
|
+
* for internal utility agents (extractors, compactors, etc.).
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* // Default behavior - session features enabled
|
|
139
|
+
* new AIAgent({
|
|
140
|
+
* session: {
|
|
141
|
+
* compact: { mode: "auto" },
|
|
142
|
+
* sessionMemory: { mode: "auto" },
|
|
143
|
+
* userMemory: { mode: "auto" }
|
|
144
|
+
* }
|
|
145
|
+
* })
|
|
146
|
+
*
|
|
147
|
+
* // Disable for internal utility agents
|
|
148
|
+
* new AIAgent({
|
|
149
|
+
* session: { mode: "disabled" }
|
|
150
|
+
* })
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
session?: Partial<Omit<import("../prompt/agent-session.js").AgentSessionOptions, "sessionId" | "userId" | "agentId" | "afs">>;
|
|
154
|
+
}
|
|
155
|
+
export interface AIAgentLoadSchema {
|
|
156
|
+
instructions?: Instructions;
|
|
157
|
+
inputKey?: string;
|
|
158
|
+
inputFileKey?: string;
|
|
159
|
+
outputKey?: string;
|
|
160
|
+
outputFileKey?: string;
|
|
161
|
+
toolChoice?: AIAgentToolChoice;
|
|
162
|
+
toolCallsConcurrency?: number;
|
|
163
|
+
keepTextInToolUses?: boolean;
|
|
164
|
+
session?: {
|
|
165
|
+
mode?: "auto" | "disabled";
|
|
166
|
+
compact?: Omit<CompactConfig, "compactor"> & {
|
|
167
|
+
compactor?: NestAgentSchema;
|
|
168
|
+
};
|
|
169
|
+
sessionMemory?: Omit<SessionMemoryConfig, "extractor"> & {
|
|
170
|
+
extractor?: NestAgentSchema;
|
|
171
|
+
};
|
|
172
|
+
userMemory?: Omit<UserMemoryConfig, "extractor"> & {
|
|
173
|
+
extractor?: NestAgentSchema;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
127
176
|
}
|
|
128
177
|
/**
|
|
129
178
|
* Tool choice options for AI agents
|
|
@@ -188,6 +237,14 @@ export declare const aiAgentOptionsSchema: ZodObject<{
|
|
|
188
237
|
*/
|
|
189
238
|
export declare class AIAgent<I extends Message = any, O extends Message = any> extends Agent<I, O> {
|
|
190
239
|
tag: string;
|
|
240
|
+
static schema<T>({ filepath }: {
|
|
241
|
+
filepath: string;
|
|
242
|
+
}): ZodType<T>;
|
|
243
|
+
static load<I extends Message = any, O extends Message = any>(options: {
|
|
244
|
+
filepath: string;
|
|
245
|
+
parsed: object;
|
|
246
|
+
options?: AgentLoadOptions;
|
|
247
|
+
}): Promise<Agent<I, O>>;
|
|
191
248
|
/**
|
|
192
249
|
* Create an AIAgent with the specified options
|
|
193
250
|
*
|
|
@@ -218,8 +275,6 @@ export declare class AIAgent<I extends Message = any, O extends Message = any> e
|
|
|
218
275
|
* {@includeCode ../../test/agents/ai-agent.test.ts#example-ai-agent-prompt-builder}
|
|
219
276
|
*/
|
|
220
277
|
instructions: PromptBuilder;
|
|
221
|
-
autoReorderSystemMessages?: boolean;
|
|
222
|
-
autoMergeSystemMessages?: boolean;
|
|
223
278
|
/**
|
|
224
279
|
* Pick a message from input to use as the user's message
|
|
225
280
|
*/
|
|
@@ -315,6 +370,10 @@ export declare class AIAgent<I extends Message = any, O extends Message = any> e
|
|
|
315
370
|
metadataEnd: string;
|
|
316
371
|
parse: (raw: string) => object;
|
|
317
372
|
};
|
|
373
|
+
/**
|
|
374
|
+
* Agent session configuration
|
|
375
|
+
*/
|
|
376
|
+
session?: Partial<Omit<import("../prompt/agent-session.js").AgentSessionOptions, "sessionId" | "userId" | "agentId" | "afs">>;
|
|
318
377
|
get inputSchema(): ZodType<I>;
|
|
319
378
|
/**
|
|
320
379
|
* Process an input message and generate a response
|