@aigne/core 1.60.2 → 1.61.0-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/lib/cjs/agents/ai-agent.d.ts +2 -1
- package/lib/cjs/agents/chat-model.d.ts +9 -245
- package/lib/cjs/agents/chat-model.js +9 -99
- package/lib/cjs/agents/image-agent.d.ts +3 -0
- package/lib/cjs/agents/image-agent.js +3 -1
- package/lib/cjs/agents/image-model.d.ts +157 -25
- package/lib/cjs/agents/image-model.js +30 -15
- package/lib/cjs/agents/mcp-agent.js +1 -1
- package/lib/cjs/agents/model.d.ts +238 -0
- package/lib/cjs/agents/model.js +107 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/loader/agent-js.d.ts +1 -2
- package/lib/cjs/loader/agent-js.js +4 -4
- package/lib/cjs/loader/index.d.ts +0 -1
- package/lib/cjs/loader/index.js +1 -2
- package/lib/cjs/prompt/prompt-builder.d.ts +1 -1
- package/lib/cjs/prompt/prompt-builder.js +4 -4
- package/lib/dts/agents/ai-agent.d.ts +2 -1
- package/lib/dts/agents/chat-model.d.ts +9 -245
- package/lib/dts/agents/image-agent.d.ts +3 -0
- package/lib/dts/agents/image-model.d.ts +157 -25
- package/lib/dts/agents/model.d.ts +238 -0
- package/lib/dts/index.d.ts +1 -0
- package/lib/dts/loader/agent-js.d.ts +1 -2
- package/lib/dts/loader/index.d.ts +0 -1
- package/lib/dts/prompt/prompt-builder.d.ts +1 -1
- package/lib/esm/agents/ai-agent.d.ts +2 -1
- package/lib/esm/agents/chat-model.d.ts +9 -245
- package/lib/esm/agents/chat-model.js +5 -92
- package/lib/esm/agents/image-agent.d.ts +3 -0
- package/lib/esm/agents/image-agent.js +3 -1
- package/lib/esm/agents/image-model.d.ts +157 -25
- package/lib/esm/agents/image-model.js +30 -15
- package/lib/esm/agents/mcp-agent.js +1 -1
- package/lib/esm/agents/model.d.ts +238 -0
- package/lib/esm/agents/model.js +100 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/loader/agent-js.d.ts +1 -2
- package/lib/esm/loader/agent-js.js +4 -4
- package/lib/esm/loader/index.d.ts +0 -1
- package/lib/esm/loader/index.js +1 -2
- package/lib/esm/prompt/prompt-builder.d.ts +1 -1
- package/lib/esm/prompt/prompt-builder.js +1 -1
- package/package.json +20 -20
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
1
|
+
import { type ZodType, z } from "zod";
|
|
2
2
|
import type { PromiseOrValue } from "../utils/type-utils.js";
|
|
3
|
-
import {
|
|
3
|
+
import type { AgentInvokeOptions, AgentOptions, AgentProcessResult, AgentResponse, AgentResponseStream, Message } from "./agent.js";
|
|
4
4
|
import { type ChatModelOutputUsage } from "./chat-model.js";
|
|
5
|
+
import { FileOutputType, type FileUnionContent, Model } from "./model.js";
|
|
5
6
|
export interface ImageModelOptions<I extends ImageModelInput = ImageModelInput, O extends ImageModelOutput = ImageModelOutput> extends Omit<AgentOptions<I, O>, "model"> {
|
|
6
7
|
}
|
|
7
|
-
export declare abstract class ImageModel<I extends ImageModelInput = ImageModelInput, O extends ImageModelOutput = ImageModelOutput> extends
|
|
8
|
+
export declare abstract class ImageModel<I extends ImageModelInput = ImageModelInput, O extends ImageModelOutput = ImageModelOutput> extends Model<I, O> {
|
|
8
9
|
tag: string;
|
|
9
10
|
constructor(options?: ImageModelOptions<I, O>);
|
|
10
11
|
get credential(): PromiseOrValue<{
|
|
@@ -15,35 +16,115 @@ export declare abstract class ImageModel<I extends ImageModelInput = ImageModelI
|
|
|
15
16
|
protected preprocess(input: I, options: AgentInvokeOptions): Promise<void>;
|
|
16
17
|
protected postprocess(input: I, output: O, options: AgentInvokeOptions): Promise<void>;
|
|
17
18
|
abstract process(input: I, options: AgentInvokeOptions): PromiseOrValue<AgentProcessResult<O>>;
|
|
19
|
+
protected processAgentOutput(input: I, output: Exclude<AgentResponse<O>, AgentResponseStream<O>>, options: AgentInvokeOptions): Promise<O>;
|
|
18
20
|
}
|
|
21
|
+
export type ImageModelInputImage = FileUnionContent[];
|
|
19
22
|
export interface ImageModelInput extends Message {
|
|
20
23
|
model?: string;
|
|
21
|
-
image?:
|
|
24
|
+
image?: ImageModelInputImage;
|
|
22
25
|
prompt: string;
|
|
23
26
|
n?: number;
|
|
24
|
-
|
|
27
|
+
outputType?: FileOutputType;
|
|
25
28
|
}
|
|
26
29
|
export declare const imageModelInputSchema: z.ZodObject<{
|
|
27
30
|
model: z.ZodOptional<z.ZodString>;
|
|
28
|
-
image: z.ZodOptional<z.
|
|
31
|
+
image: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
32
|
+
filename: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
33
|
+
mimeType: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
34
|
+
} & {
|
|
35
|
+
type: z.ZodLiteral<"local">;
|
|
36
|
+
path: z.ZodString;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
path: string;
|
|
39
|
+
type: "local";
|
|
40
|
+
filename?: string | undefined;
|
|
41
|
+
mimeType?: string | undefined;
|
|
42
|
+
}, {
|
|
43
|
+
path: string;
|
|
44
|
+
type: "local";
|
|
45
|
+
filename?: string | undefined;
|
|
46
|
+
mimeType?: string | undefined;
|
|
47
|
+
}>, z.ZodObject<{
|
|
48
|
+
filename: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
49
|
+
mimeType: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
50
|
+
} & {
|
|
51
|
+
type: z.ZodLiteral<"url">;
|
|
52
|
+
url: z.ZodString;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
type: "url";
|
|
55
|
+
url: string;
|
|
56
|
+
filename?: string | undefined;
|
|
57
|
+
mimeType?: string | undefined;
|
|
58
|
+
}, {
|
|
59
|
+
type: "url";
|
|
60
|
+
url: string;
|
|
61
|
+
filename?: string | undefined;
|
|
62
|
+
mimeType?: string | undefined;
|
|
63
|
+
}>, z.ZodObject<{
|
|
64
|
+
filename: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
65
|
+
mimeType: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
66
|
+
} & {
|
|
67
|
+
type: z.ZodLiteral<"file">;
|
|
68
|
+
data: z.ZodString;
|
|
69
|
+
}, "strip", z.ZodTypeAny, {
|
|
70
|
+
type: "file";
|
|
71
|
+
data: string;
|
|
72
|
+
filename?: string | undefined;
|
|
73
|
+
mimeType?: string | undefined;
|
|
74
|
+
}, {
|
|
75
|
+
type: "file";
|
|
76
|
+
data: string;
|
|
77
|
+
filename?: string | undefined;
|
|
78
|
+
mimeType?: string | undefined;
|
|
79
|
+
}>]>, "many">>;
|
|
29
80
|
prompt: z.ZodString;
|
|
30
81
|
n: z.ZodOptional<z.ZodNumber>;
|
|
31
|
-
|
|
82
|
+
outputType: z.ZodOptional<z.ZodNativeEnum<typeof FileOutputType>>;
|
|
32
83
|
}, "strip", z.ZodTypeAny, {
|
|
33
84
|
prompt: string;
|
|
34
85
|
model?: string | undefined;
|
|
35
|
-
image?:
|
|
36
|
-
|
|
86
|
+
image?: ({
|
|
87
|
+
type: "url";
|
|
88
|
+
url: string;
|
|
89
|
+
filename?: string | undefined;
|
|
90
|
+
mimeType?: string | undefined;
|
|
91
|
+
} | {
|
|
92
|
+
type: "file";
|
|
93
|
+
data: string;
|
|
94
|
+
filename?: string | undefined;
|
|
95
|
+
mimeType?: string | undefined;
|
|
96
|
+
} | {
|
|
97
|
+
path: string;
|
|
98
|
+
type: "local";
|
|
99
|
+
filename?: string | undefined;
|
|
100
|
+
mimeType?: string | undefined;
|
|
101
|
+
})[] | undefined;
|
|
37
102
|
n?: number | undefined;
|
|
103
|
+
outputType?: FileOutputType | undefined;
|
|
38
104
|
}, {
|
|
39
105
|
prompt: string;
|
|
40
106
|
model?: string | undefined;
|
|
41
|
-
image?:
|
|
42
|
-
|
|
107
|
+
image?: ({
|
|
108
|
+
type: "url";
|
|
109
|
+
url: string;
|
|
110
|
+
filename?: string | undefined;
|
|
111
|
+
mimeType?: string | undefined;
|
|
112
|
+
} | {
|
|
113
|
+
type: "file";
|
|
114
|
+
data: string;
|
|
115
|
+
filename?: string | undefined;
|
|
116
|
+
mimeType?: string | undefined;
|
|
117
|
+
} | {
|
|
118
|
+
path: string;
|
|
119
|
+
type: "local";
|
|
120
|
+
filename?: string | undefined;
|
|
121
|
+
mimeType?: string | undefined;
|
|
122
|
+
})[] | undefined;
|
|
43
123
|
n?: number | undefined;
|
|
124
|
+
outputType?: FileOutputType | undefined;
|
|
44
125
|
}>;
|
|
45
126
|
export interface ImageModelOutput extends Message {
|
|
46
|
-
images:
|
|
127
|
+
images: FileUnionContent[];
|
|
47
128
|
/**
|
|
48
129
|
* Token usage statistics
|
|
49
130
|
*/
|
|
@@ -53,26 +134,55 @@ export interface ImageModelOutput extends Message {
|
|
|
53
134
|
*/
|
|
54
135
|
model?: string;
|
|
55
136
|
}
|
|
56
|
-
export type ImageModelOutputImage = ImageModelOutputImageUrl | ImageModelOutputImageBase64;
|
|
57
|
-
export interface ImageModelOutputImageUrl {
|
|
58
|
-
url: string;
|
|
59
|
-
}
|
|
60
|
-
export interface ImageModelOutputImageBase64 {
|
|
61
|
-
base64: string;
|
|
62
|
-
}
|
|
63
137
|
export declare const imageModelOutputSchema: z.ZodObject<{
|
|
64
|
-
images: z.ZodArray<z.
|
|
138
|
+
images: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
139
|
+
filename: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
140
|
+
mimeType: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
141
|
+
} & {
|
|
142
|
+
type: z.ZodLiteral<"local">;
|
|
143
|
+
path: z.ZodString;
|
|
144
|
+
}, "strip", z.ZodTypeAny, {
|
|
145
|
+
path: string;
|
|
146
|
+
type: "local";
|
|
147
|
+
filename?: string | undefined;
|
|
148
|
+
mimeType?: string | undefined;
|
|
149
|
+
}, {
|
|
150
|
+
path: string;
|
|
151
|
+
type: "local";
|
|
152
|
+
filename?: string | undefined;
|
|
153
|
+
mimeType?: string | undefined;
|
|
154
|
+
}>, z.ZodObject<{
|
|
155
|
+
filename: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
156
|
+
mimeType: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
157
|
+
} & {
|
|
158
|
+
type: z.ZodLiteral<"url">;
|
|
65
159
|
url: z.ZodString;
|
|
66
160
|
}, "strip", z.ZodTypeAny, {
|
|
161
|
+
type: "url";
|
|
67
162
|
url: string;
|
|
163
|
+
filename?: string | undefined;
|
|
164
|
+
mimeType?: string | undefined;
|
|
68
165
|
}, {
|
|
166
|
+
type: "url";
|
|
69
167
|
url: string;
|
|
168
|
+
filename?: string | undefined;
|
|
169
|
+
mimeType?: string | undefined;
|
|
70
170
|
}>, z.ZodObject<{
|
|
71
|
-
|
|
171
|
+
filename: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
172
|
+
mimeType: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
173
|
+
} & {
|
|
174
|
+
type: z.ZodLiteral<"file">;
|
|
175
|
+
data: z.ZodString;
|
|
72
176
|
}, "strip", z.ZodTypeAny, {
|
|
73
|
-
|
|
177
|
+
type: "file";
|
|
178
|
+
data: string;
|
|
179
|
+
filename?: string | undefined;
|
|
180
|
+
mimeType?: string | undefined;
|
|
74
181
|
}, {
|
|
75
|
-
|
|
182
|
+
type: "file";
|
|
183
|
+
data: string;
|
|
184
|
+
filename?: string | undefined;
|
|
185
|
+
mimeType?: string | undefined;
|
|
76
186
|
}>]>, "many">;
|
|
77
187
|
usage: z.ZodOptional<z.ZodObject<{
|
|
78
188
|
inputTokens: z.ZodNumber;
|
|
@@ -90,9 +200,20 @@ export declare const imageModelOutputSchema: z.ZodObject<{
|
|
|
90
200
|
model: z.ZodOptional<z.ZodString>;
|
|
91
201
|
}, "strip", z.ZodTypeAny, {
|
|
92
202
|
images: ({
|
|
203
|
+
type: "url";
|
|
93
204
|
url: string;
|
|
205
|
+
filename?: string | undefined;
|
|
206
|
+
mimeType?: string | undefined;
|
|
207
|
+
} | {
|
|
208
|
+
type: "file";
|
|
209
|
+
data: string;
|
|
210
|
+
filename?: string | undefined;
|
|
211
|
+
mimeType?: string | undefined;
|
|
94
212
|
} | {
|
|
95
|
-
|
|
213
|
+
path: string;
|
|
214
|
+
type: "local";
|
|
215
|
+
filename?: string | undefined;
|
|
216
|
+
mimeType?: string | undefined;
|
|
96
217
|
})[];
|
|
97
218
|
model?: string | undefined;
|
|
98
219
|
usage?: {
|
|
@@ -102,9 +223,20 @@ export declare const imageModelOutputSchema: z.ZodObject<{
|
|
|
102
223
|
} | undefined;
|
|
103
224
|
}, {
|
|
104
225
|
images: ({
|
|
226
|
+
type: "url";
|
|
105
227
|
url: string;
|
|
228
|
+
filename?: string | undefined;
|
|
229
|
+
mimeType?: string | undefined;
|
|
230
|
+
} | {
|
|
231
|
+
type: "file";
|
|
232
|
+
data: string;
|
|
233
|
+
filename?: string | undefined;
|
|
234
|
+
mimeType?: string | undefined;
|
|
106
235
|
} | {
|
|
107
|
-
|
|
236
|
+
path: string;
|
|
237
|
+
type: "local";
|
|
238
|
+
filename?: string | undefined;
|
|
239
|
+
mimeType?: string | undefined;
|
|
108
240
|
})[];
|
|
109
241
|
model?: string | undefined;
|
|
110
242
|
usage?: {
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Agent, type AgentInvokeOptions, type Message } from "./agent.js";
|
|
3
|
+
export declare abstract class Model<I extends Message = any, O extends Message = any> extends Agent<I, O> {
|
|
4
|
+
transformFileOutput(fileOutputType: FileOutputType.file, data: FileUnionContent, options: AgentInvokeOptions): Promise<FileContent>;
|
|
5
|
+
transformFileOutput(fileOutputType: FileOutputType.local | undefined, data: FileUnionContent, options: AgentInvokeOptions): Promise<LocalContent>;
|
|
6
|
+
transformFileOutput(fileOutputType: FileOutputType | undefined, data: FileUnionContent, options: AgentInvokeOptions): Promise<FileUnionContent>;
|
|
7
|
+
static getFileExtension(type: string): string | undefined;
|
|
8
|
+
static getMimeType(filename: string): string | undefined;
|
|
9
|
+
downloadFile(url: string): Promise<Response>;
|
|
10
|
+
}
|
|
11
|
+
export declare enum FileOutputType {
|
|
12
|
+
local = "local",
|
|
13
|
+
file = "file"
|
|
14
|
+
}
|
|
15
|
+
export interface FileContentBase {
|
|
16
|
+
filename?: string;
|
|
17
|
+
mimeType?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const fileContentBaseSchema: z.ZodObject<{
|
|
20
|
+
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
21
|
+
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
filename?: string | undefined;
|
|
24
|
+
mimeType?: string | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
filename?: string | undefined;
|
|
27
|
+
mimeType?: string | undefined;
|
|
28
|
+
}>;
|
|
29
|
+
export interface UrlContent extends FileContentBase {
|
|
30
|
+
type: "url";
|
|
31
|
+
url: string;
|
|
32
|
+
}
|
|
33
|
+
export declare const urlContentSchema: z.ZodObject<{
|
|
34
|
+
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
35
|
+
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
36
|
+
} & {
|
|
37
|
+
type: z.ZodLiteral<"url">;
|
|
38
|
+
url: z.ZodString;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
type: "url";
|
|
41
|
+
url: string;
|
|
42
|
+
filename?: string | undefined;
|
|
43
|
+
mimeType?: string | undefined;
|
|
44
|
+
}, {
|
|
45
|
+
type: "url";
|
|
46
|
+
url: string;
|
|
47
|
+
filename?: string | undefined;
|
|
48
|
+
mimeType?: string | undefined;
|
|
49
|
+
}>;
|
|
50
|
+
export interface FileContent extends FileContentBase {
|
|
51
|
+
type: "file";
|
|
52
|
+
data: string;
|
|
53
|
+
}
|
|
54
|
+
export declare const fileContentSchema: z.ZodObject<{
|
|
55
|
+
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
56
|
+
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
57
|
+
} & {
|
|
58
|
+
type: z.ZodLiteral<"file">;
|
|
59
|
+
data: z.ZodString;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
type: "file";
|
|
62
|
+
data: string;
|
|
63
|
+
filename?: string | undefined;
|
|
64
|
+
mimeType?: string | undefined;
|
|
65
|
+
}, {
|
|
66
|
+
type: "file";
|
|
67
|
+
data: string;
|
|
68
|
+
filename?: string | undefined;
|
|
69
|
+
mimeType?: string | undefined;
|
|
70
|
+
}>;
|
|
71
|
+
export interface LocalContent extends FileContentBase {
|
|
72
|
+
type: "local";
|
|
73
|
+
path: string;
|
|
74
|
+
}
|
|
75
|
+
export declare const localContentSchema: z.ZodObject<{
|
|
76
|
+
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
77
|
+
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
78
|
+
} & {
|
|
79
|
+
type: z.ZodLiteral<"local">;
|
|
80
|
+
path: z.ZodString;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
path: string;
|
|
83
|
+
type: "local";
|
|
84
|
+
filename?: string | undefined;
|
|
85
|
+
mimeType?: string | undefined;
|
|
86
|
+
}, {
|
|
87
|
+
path: string;
|
|
88
|
+
type: "local";
|
|
89
|
+
filename?: string | undefined;
|
|
90
|
+
mimeType?: string | undefined;
|
|
91
|
+
}>;
|
|
92
|
+
export type FileUnionContent = LocalContent | UrlContent | FileContent;
|
|
93
|
+
export declare const fileUnionContentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
94
|
+
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
95
|
+
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
96
|
+
} & {
|
|
97
|
+
type: z.ZodLiteral<"local">;
|
|
98
|
+
path: z.ZodString;
|
|
99
|
+
}, "strip", z.ZodTypeAny, {
|
|
100
|
+
path: string;
|
|
101
|
+
type: "local";
|
|
102
|
+
filename?: string | undefined;
|
|
103
|
+
mimeType?: string | undefined;
|
|
104
|
+
}, {
|
|
105
|
+
path: string;
|
|
106
|
+
type: "local";
|
|
107
|
+
filename?: string | undefined;
|
|
108
|
+
mimeType?: string | undefined;
|
|
109
|
+
}>, z.ZodObject<{
|
|
110
|
+
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
111
|
+
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
112
|
+
} & {
|
|
113
|
+
type: z.ZodLiteral<"url">;
|
|
114
|
+
url: z.ZodString;
|
|
115
|
+
}, "strip", z.ZodTypeAny, {
|
|
116
|
+
type: "url";
|
|
117
|
+
url: string;
|
|
118
|
+
filename?: string | undefined;
|
|
119
|
+
mimeType?: string | undefined;
|
|
120
|
+
}, {
|
|
121
|
+
type: "url";
|
|
122
|
+
url: string;
|
|
123
|
+
filename?: string | undefined;
|
|
124
|
+
mimeType?: string | undefined;
|
|
125
|
+
}>, z.ZodObject<{
|
|
126
|
+
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
127
|
+
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
128
|
+
} & {
|
|
129
|
+
type: z.ZodLiteral<"file">;
|
|
130
|
+
data: z.ZodString;
|
|
131
|
+
}, "strip", z.ZodTypeAny, {
|
|
132
|
+
type: "file";
|
|
133
|
+
data: string;
|
|
134
|
+
filename?: string | undefined;
|
|
135
|
+
mimeType?: string | undefined;
|
|
136
|
+
}, {
|
|
137
|
+
type: "file";
|
|
138
|
+
data: string;
|
|
139
|
+
filename?: string | undefined;
|
|
140
|
+
mimeType?: string | undefined;
|
|
141
|
+
}>]>;
|
|
142
|
+
export declare const fileUnionContentsSchema: z.ZodUnion<[z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
143
|
+
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
144
|
+
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
145
|
+
} & {
|
|
146
|
+
type: z.ZodLiteral<"local">;
|
|
147
|
+
path: z.ZodString;
|
|
148
|
+
}, "strip", z.ZodTypeAny, {
|
|
149
|
+
path: string;
|
|
150
|
+
type: "local";
|
|
151
|
+
filename?: string | undefined;
|
|
152
|
+
mimeType?: string | undefined;
|
|
153
|
+
}, {
|
|
154
|
+
path: string;
|
|
155
|
+
type: "local";
|
|
156
|
+
filename?: string | undefined;
|
|
157
|
+
mimeType?: string | undefined;
|
|
158
|
+
}>, z.ZodObject<{
|
|
159
|
+
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
160
|
+
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
161
|
+
} & {
|
|
162
|
+
type: z.ZodLiteral<"url">;
|
|
163
|
+
url: z.ZodString;
|
|
164
|
+
}, "strip", z.ZodTypeAny, {
|
|
165
|
+
type: "url";
|
|
166
|
+
url: string;
|
|
167
|
+
filename?: string | undefined;
|
|
168
|
+
mimeType?: string | undefined;
|
|
169
|
+
}, {
|
|
170
|
+
type: "url";
|
|
171
|
+
url: string;
|
|
172
|
+
filename?: string | undefined;
|
|
173
|
+
mimeType?: string | undefined;
|
|
174
|
+
}>, z.ZodObject<{
|
|
175
|
+
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
176
|
+
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
177
|
+
} & {
|
|
178
|
+
type: z.ZodLiteral<"file">;
|
|
179
|
+
data: z.ZodString;
|
|
180
|
+
}, "strip", z.ZodTypeAny, {
|
|
181
|
+
type: "file";
|
|
182
|
+
data: string;
|
|
183
|
+
filename?: string | undefined;
|
|
184
|
+
mimeType?: string | undefined;
|
|
185
|
+
}, {
|
|
186
|
+
type: "file";
|
|
187
|
+
data: string;
|
|
188
|
+
filename?: string | undefined;
|
|
189
|
+
mimeType?: string | undefined;
|
|
190
|
+
}>]>, z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
191
|
+
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
192
|
+
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
193
|
+
} & {
|
|
194
|
+
type: z.ZodLiteral<"local">;
|
|
195
|
+
path: z.ZodString;
|
|
196
|
+
}, "strip", z.ZodTypeAny, {
|
|
197
|
+
path: string;
|
|
198
|
+
type: "local";
|
|
199
|
+
filename?: string | undefined;
|
|
200
|
+
mimeType?: string | undefined;
|
|
201
|
+
}, {
|
|
202
|
+
path: string;
|
|
203
|
+
type: "local";
|
|
204
|
+
filename?: string | undefined;
|
|
205
|
+
mimeType?: string | undefined;
|
|
206
|
+
}>, z.ZodObject<{
|
|
207
|
+
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
208
|
+
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
209
|
+
} & {
|
|
210
|
+
type: z.ZodLiteral<"url">;
|
|
211
|
+
url: z.ZodString;
|
|
212
|
+
}, "strip", z.ZodTypeAny, {
|
|
213
|
+
type: "url";
|
|
214
|
+
url: string;
|
|
215
|
+
filename?: string | undefined;
|
|
216
|
+
mimeType?: string | undefined;
|
|
217
|
+
}, {
|
|
218
|
+
type: "url";
|
|
219
|
+
url: string;
|
|
220
|
+
filename?: string | undefined;
|
|
221
|
+
mimeType?: string | undefined;
|
|
222
|
+
}>, z.ZodObject<{
|
|
223
|
+
filename: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
224
|
+
mimeType: z.ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
225
|
+
} & {
|
|
226
|
+
type: z.ZodLiteral<"file">;
|
|
227
|
+
data: z.ZodString;
|
|
228
|
+
}, "strip", z.ZodTypeAny, {
|
|
229
|
+
type: "file";
|
|
230
|
+
data: string;
|
|
231
|
+
filename?: string | undefined;
|
|
232
|
+
mimeType?: string | undefined;
|
|
233
|
+
}, {
|
|
234
|
+
type: "file";
|
|
235
|
+
data: string;
|
|
236
|
+
filename?: string | undefined;
|
|
237
|
+
mimeType?: string | undefined;
|
|
238
|
+
}>]>, "many">]>;
|
package/lib/dts/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from "./agents/guide-rail-agent.js";
|
|
|
5
5
|
export * from "./agents/image-agent.js";
|
|
6
6
|
export * from "./agents/image-model.js";
|
|
7
7
|
export * from "./agents/mcp-agent.js";
|
|
8
|
+
export * from "./agents/model.js";
|
|
8
9
|
export * from "./agents/team-agent.js";
|
|
9
10
|
export * from "./agents/transform-agent.js";
|
|
10
11
|
export * from "./agents/types.js";
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { Agent } from "../agents/agent.js";
|
|
2
|
-
|
|
3
|
-
export declare function loadAgentFromJsFile(path: string, options?: LoadOptions): Promise<Agent<any, any> | import("./agent-yaml.js").AgentSchema>;
|
|
2
|
+
export declare function loadAgentFromJsFile(path: string): Promise<Agent<any, any> | import("./agent-yaml.js").AgentSchema>;
|
|
@@ -11,7 +11,6 @@ export interface LoadOptions {
|
|
|
11
11
|
}[];
|
|
12
12
|
model?: ChatModel | ((model?: z.infer<typeof aigneFileSchema>["model"]) => PromiseOrValue<ChatModel | undefined>);
|
|
13
13
|
imageModel?: ImageModel | ((model?: z.infer<typeof aigneFileSchema>["imageModel"]) => PromiseOrValue<ImageModel | undefined>);
|
|
14
|
-
key?: string | number;
|
|
15
14
|
}
|
|
16
15
|
export declare function load(path: string, options?: LoadOptions): Promise<AIGNEOptions>;
|
|
17
16
|
export declare function loadAgent(path: string, options?: LoadOptions, agentOptions?: AgentOptions): Promise<Agent>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { GetPromptResult } from "@modelcontextprotocol/sdk/types.js";
|
|
2
2
|
import { Agent, type AgentInvokeOptions, type Message } from "../agents/agent.js";
|
|
3
3
|
import { type AIAgent } from "../agents/ai-agent.js";
|
|
4
|
-
import {
|
|
4
|
+
import type { ChatModel, ChatModelInput } from "../agents/chat-model.js";
|
|
5
5
|
import { ChatMessagesTemplate } from "./template.js";
|
|
6
6
|
export interface PromptBuilderOptions {
|
|
7
7
|
instructions?: string | ChatMessagesTemplate;
|
|
@@ -1,8 +1,9 @@
|
|
|
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 type { ChatModel, ChatModelInput
|
|
4
|
+
import type { ChatModel, ChatModelInput } from "./chat-model.js";
|
|
5
5
|
import type { GuideRailAgentOutput } from "./guide-rail-agent.js";
|
|
6
|
+
import type { FileOutputType } from "./model.js";
|
|
6
7
|
export declare const DEFAULT_OUTPUT_KEY = "message";
|
|
7
8
|
export declare const DEFAULT_FILE_OUTPUT_KEY = "files";
|
|
8
9
|
/**
|