@ag-ui/core 0.0.44 → 0.0.45
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/dist/index.d.mts +6041 -5002
- package/dist/index.d.mts.map +1 -0
- package/dist/index.d.ts +6041 -5002
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +449 -442
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +392 -367
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -9
package/dist/index.js
CHANGED
|
@@ -1,455 +1,462 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
let zod = require("zod");
|
|
19
2
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
TextMessageEndEventSchema: () => TextMessageEndEventSchema,
|
|
57
|
-
TextMessageStartEventSchema: () => TextMessageStartEventSchema,
|
|
58
|
-
ThinkingEndEventSchema: () => ThinkingEndEventSchema,
|
|
59
|
-
ThinkingStartEventSchema: () => ThinkingStartEventSchema,
|
|
60
|
-
ThinkingTextMessageContentEventSchema: () => ThinkingTextMessageContentEventSchema,
|
|
61
|
-
ThinkingTextMessageEndEventSchema: () => ThinkingTextMessageEndEventSchema,
|
|
62
|
-
ThinkingTextMessageStartEventSchema: () => ThinkingTextMessageStartEventSchema,
|
|
63
|
-
ToolCallArgsEventSchema: () => ToolCallArgsEventSchema,
|
|
64
|
-
ToolCallChunkEventSchema: () => ToolCallChunkEventSchema,
|
|
65
|
-
ToolCallEndEventSchema: () => ToolCallEndEventSchema,
|
|
66
|
-
ToolCallResultEventSchema: () => ToolCallResultEventSchema,
|
|
67
|
-
ToolCallSchema: () => ToolCallSchema,
|
|
68
|
-
ToolCallStartEventSchema: () => ToolCallStartEventSchema,
|
|
69
|
-
ToolMessageSchema: () => ToolMessageSchema,
|
|
70
|
-
ToolSchema: () => ToolSchema,
|
|
71
|
-
UserMessageSchema: () => UserMessageSchema
|
|
72
|
-
});
|
|
73
|
-
module.exports = __toCommonJS(index_exports);
|
|
74
|
-
|
|
75
|
-
// src/types.ts
|
|
76
|
-
var import_zod = require("zod");
|
|
77
|
-
var FunctionCallSchema = import_zod.z.object({
|
|
78
|
-
name: import_zod.z.string(),
|
|
79
|
-
arguments: import_zod.z.string()
|
|
80
|
-
});
|
|
81
|
-
var ToolCallSchema = import_zod.z.object({
|
|
82
|
-
id: import_zod.z.string(),
|
|
83
|
-
type: import_zod.z.literal("function"),
|
|
84
|
-
function: FunctionCallSchema
|
|
85
|
-
});
|
|
86
|
-
var BaseMessageSchema = import_zod.z.object({
|
|
87
|
-
id: import_zod.z.string(),
|
|
88
|
-
role: import_zod.z.string(),
|
|
89
|
-
content: import_zod.z.string().optional(),
|
|
90
|
-
name: import_zod.z.string().optional()
|
|
91
|
-
});
|
|
92
|
-
var TextInputContentSchema = import_zod.z.object({
|
|
93
|
-
type: import_zod.z.literal("text"),
|
|
94
|
-
text: import_zod.z.string()
|
|
95
|
-
});
|
|
96
|
-
var BinaryInputContentObjectSchema = import_zod.z.object({
|
|
97
|
-
type: import_zod.z.literal("binary"),
|
|
98
|
-
mimeType: import_zod.z.string(),
|
|
99
|
-
id: import_zod.z.string().optional(),
|
|
100
|
-
url: import_zod.z.string().optional(),
|
|
101
|
-
data: import_zod.z.string().optional(),
|
|
102
|
-
filename: import_zod.z.string().optional()
|
|
103
|
-
});
|
|
104
|
-
var ensureBinaryPayload = (value, ctx) => {
|
|
105
|
-
if (!value.id && !value.url && !value.data) {
|
|
106
|
-
ctx.addIssue({
|
|
107
|
-
code: import_zod.z.ZodIssueCode.custom,
|
|
108
|
-
message: "BinaryInputContent requires at least one of id, url, or data.",
|
|
109
|
-
path: ["id"]
|
|
110
|
-
});
|
|
111
|
-
}
|
|
3
|
+
//#region src/types.ts
|
|
4
|
+
const FunctionCallSchema = zod.z.object({
|
|
5
|
+
name: zod.z.string(),
|
|
6
|
+
arguments: zod.z.string()
|
|
7
|
+
});
|
|
8
|
+
const ToolCallSchema = zod.z.object({
|
|
9
|
+
id: zod.z.string(),
|
|
10
|
+
type: zod.z.literal("function"),
|
|
11
|
+
function: FunctionCallSchema,
|
|
12
|
+
encryptedValue: zod.z.string().optional()
|
|
13
|
+
});
|
|
14
|
+
const BaseMessageSchema = zod.z.object({
|
|
15
|
+
id: zod.z.string(),
|
|
16
|
+
role: zod.z.string(),
|
|
17
|
+
content: zod.z.string().optional(),
|
|
18
|
+
name: zod.z.string().optional(),
|
|
19
|
+
encryptedValue: zod.z.string().optional()
|
|
20
|
+
});
|
|
21
|
+
const TextInputContentSchema = zod.z.object({
|
|
22
|
+
type: zod.z.literal("text"),
|
|
23
|
+
text: zod.z.string()
|
|
24
|
+
});
|
|
25
|
+
const BinaryInputContentObjectSchema = zod.z.object({
|
|
26
|
+
type: zod.z.literal("binary"),
|
|
27
|
+
mimeType: zod.z.string(),
|
|
28
|
+
id: zod.z.string().optional(),
|
|
29
|
+
url: zod.z.string().optional(),
|
|
30
|
+
data: zod.z.string().optional(),
|
|
31
|
+
filename: zod.z.string().optional()
|
|
32
|
+
});
|
|
33
|
+
const ensureBinaryPayload = (value, ctx) => {
|
|
34
|
+
if (!value.id && !value.url && !value.data) ctx.addIssue({
|
|
35
|
+
code: zod.z.ZodIssueCode.custom,
|
|
36
|
+
message: "BinaryInputContent requires at least one of id, url, or data.",
|
|
37
|
+
path: ["id"]
|
|
38
|
+
});
|
|
112
39
|
};
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
40
|
+
const BinaryInputContentSchema = BinaryInputContentObjectSchema.superRefine((value, ctx) => {
|
|
41
|
+
ensureBinaryPayload(value, ctx);
|
|
42
|
+
});
|
|
43
|
+
const InputContentBaseSchema = zod.z.discriminatedUnion("type", [TextInputContentSchema, BinaryInputContentObjectSchema]);
|
|
44
|
+
const InputContentSchema = InputContentBaseSchema.superRefine((value, ctx) => {
|
|
45
|
+
if (value.type === "binary") ensureBinaryPayload(value, ctx);
|
|
46
|
+
});
|
|
47
|
+
const DeveloperMessageSchema = BaseMessageSchema.extend({
|
|
48
|
+
role: zod.z.literal("developer"),
|
|
49
|
+
content: zod.z.string()
|
|
50
|
+
});
|
|
51
|
+
const SystemMessageSchema = BaseMessageSchema.extend({
|
|
52
|
+
role: zod.z.literal("system"),
|
|
53
|
+
content: zod.z.string()
|
|
54
|
+
});
|
|
55
|
+
const AssistantMessageSchema = BaseMessageSchema.extend({
|
|
56
|
+
role: zod.z.literal("assistant"),
|
|
57
|
+
content: zod.z.string().optional(),
|
|
58
|
+
toolCalls: zod.z.array(ToolCallSchema).optional()
|
|
59
|
+
});
|
|
60
|
+
const UserMessageSchema = BaseMessageSchema.extend({
|
|
61
|
+
role: zod.z.literal("user"),
|
|
62
|
+
content: zod.z.union([zod.z.string(), zod.z.array(InputContentSchema)])
|
|
63
|
+
});
|
|
64
|
+
const ToolMessageSchema = zod.z.object({
|
|
65
|
+
id: zod.z.string(),
|
|
66
|
+
content: zod.z.string(),
|
|
67
|
+
role: zod.z.literal("tool"),
|
|
68
|
+
toolCallId: zod.z.string(),
|
|
69
|
+
error: zod.z.string().optional(),
|
|
70
|
+
encryptedValue: zod.z.string().optional()
|
|
71
|
+
});
|
|
72
|
+
const ActivityMessageSchema = zod.z.object({
|
|
73
|
+
id: zod.z.string(),
|
|
74
|
+
role: zod.z.literal("activity"),
|
|
75
|
+
activityType: zod.z.string(),
|
|
76
|
+
content: zod.z.record(zod.z.any())
|
|
77
|
+
});
|
|
78
|
+
const ReasoningMessageSchema = zod.z.object({
|
|
79
|
+
id: zod.z.string(),
|
|
80
|
+
role: zod.z.literal("reasoning"),
|
|
81
|
+
content: zod.z.string(),
|
|
82
|
+
encryptedValue: zod.z.string().optional()
|
|
83
|
+
});
|
|
84
|
+
const MessageSchema = zod.z.discriminatedUnion("role", [
|
|
85
|
+
DeveloperMessageSchema,
|
|
86
|
+
SystemMessageSchema,
|
|
87
|
+
AssistantMessageSchema,
|
|
88
|
+
UserMessageSchema,
|
|
89
|
+
ToolMessageSchema,
|
|
90
|
+
ActivityMessageSchema,
|
|
91
|
+
ReasoningMessageSchema
|
|
119
92
|
]);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
});
|
|
129
|
-
var SystemMessageSchema = BaseMessageSchema.extend({
|
|
130
|
-
role: import_zod.z.literal("system"),
|
|
131
|
-
content: import_zod.z.string()
|
|
132
|
-
});
|
|
133
|
-
var AssistantMessageSchema = BaseMessageSchema.extend({
|
|
134
|
-
role: import_zod.z.literal("assistant"),
|
|
135
|
-
content: import_zod.z.string().optional(),
|
|
136
|
-
toolCalls: import_zod.z.array(ToolCallSchema).optional()
|
|
137
|
-
});
|
|
138
|
-
var UserMessageSchema = BaseMessageSchema.extend({
|
|
139
|
-
role: import_zod.z.literal("user"),
|
|
140
|
-
content: import_zod.z.union([import_zod.z.string(), import_zod.z.array(InputContentSchema)])
|
|
141
|
-
});
|
|
142
|
-
var ToolMessageSchema = import_zod.z.object({
|
|
143
|
-
id: import_zod.z.string(),
|
|
144
|
-
content: import_zod.z.string(),
|
|
145
|
-
role: import_zod.z.literal("tool"),
|
|
146
|
-
toolCallId: import_zod.z.string(),
|
|
147
|
-
error: import_zod.z.string().optional()
|
|
148
|
-
});
|
|
149
|
-
var ActivityMessageSchema = import_zod.z.object({
|
|
150
|
-
id: import_zod.z.string(),
|
|
151
|
-
role: import_zod.z.literal("activity"),
|
|
152
|
-
activityType: import_zod.z.string(),
|
|
153
|
-
content: import_zod.z.record(import_zod.z.any())
|
|
154
|
-
});
|
|
155
|
-
var MessageSchema = import_zod.z.discriminatedUnion("role", [
|
|
156
|
-
DeveloperMessageSchema,
|
|
157
|
-
SystemMessageSchema,
|
|
158
|
-
AssistantMessageSchema,
|
|
159
|
-
UserMessageSchema,
|
|
160
|
-
ToolMessageSchema,
|
|
161
|
-
ActivityMessageSchema
|
|
93
|
+
const RoleSchema = zod.z.union([
|
|
94
|
+
zod.z.literal("developer"),
|
|
95
|
+
zod.z.literal("system"),
|
|
96
|
+
zod.z.literal("assistant"),
|
|
97
|
+
zod.z.literal("user"),
|
|
98
|
+
zod.z.literal("tool"),
|
|
99
|
+
zod.z.literal("activity"),
|
|
100
|
+
zod.z.literal("reasoning")
|
|
162
101
|
]);
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
runId: import_zod.z.string(),
|
|
184
|
-
parentRunId: import_zod.z.string().optional(),
|
|
185
|
-
state: import_zod.z.any(),
|
|
186
|
-
messages: import_zod.z.array(MessageSchema),
|
|
187
|
-
tools: import_zod.z.array(ToolSchema),
|
|
188
|
-
context: import_zod.z.array(ContextSchema),
|
|
189
|
-
forwardedProps: import_zod.z.any()
|
|
190
|
-
});
|
|
191
|
-
var StateSchema = import_zod.z.any();
|
|
102
|
+
const ContextSchema = zod.z.object({
|
|
103
|
+
description: zod.z.string(),
|
|
104
|
+
value: zod.z.string()
|
|
105
|
+
});
|
|
106
|
+
const ToolSchema = zod.z.object({
|
|
107
|
+
name: zod.z.string(),
|
|
108
|
+
description: zod.z.string(),
|
|
109
|
+
parameters: zod.z.any()
|
|
110
|
+
});
|
|
111
|
+
const RunAgentInputSchema = zod.z.object({
|
|
112
|
+
threadId: zod.z.string(),
|
|
113
|
+
runId: zod.z.string(),
|
|
114
|
+
parentRunId: zod.z.string().optional(),
|
|
115
|
+
state: zod.z.any(),
|
|
116
|
+
messages: zod.z.array(MessageSchema),
|
|
117
|
+
tools: zod.z.array(ToolSchema),
|
|
118
|
+
context: zod.z.array(ContextSchema),
|
|
119
|
+
forwardedProps: zod.z.any()
|
|
120
|
+
});
|
|
121
|
+
const StateSchema = zod.z.any();
|
|
192
122
|
var AGUIError = class extends Error {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
123
|
+
constructor(message) {
|
|
124
|
+
super(message);
|
|
125
|
+
}
|
|
196
126
|
};
|
|
197
127
|
var AGUIConnectNotImplementedError = class extends AGUIError {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
128
|
+
constructor() {
|
|
129
|
+
super("Connect not implemented. This method is not supported by the current agent.");
|
|
130
|
+
}
|
|
201
131
|
};
|
|
202
132
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/events.ts
|
|
135
|
+
const TextMessageRoleSchema = zod.z.union([
|
|
136
|
+
zod.z.literal("developer"),
|
|
137
|
+
zod.z.literal("system"),
|
|
138
|
+
zod.z.literal("assistant"),
|
|
139
|
+
zod.z.literal("user")
|
|
210
140
|
]);
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
141
|
+
let EventType = /* @__PURE__ */ function(EventType) {
|
|
142
|
+
EventType["TEXT_MESSAGE_START"] = "TEXT_MESSAGE_START";
|
|
143
|
+
EventType["TEXT_MESSAGE_CONTENT"] = "TEXT_MESSAGE_CONTENT";
|
|
144
|
+
EventType["TEXT_MESSAGE_END"] = "TEXT_MESSAGE_END";
|
|
145
|
+
EventType["TEXT_MESSAGE_CHUNK"] = "TEXT_MESSAGE_CHUNK";
|
|
146
|
+
EventType["TOOL_CALL_START"] = "TOOL_CALL_START";
|
|
147
|
+
EventType["TOOL_CALL_ARGS"] = "TOOL_CALL_ARGS";
|
|
148
|
+
EventType["TOOL_CALL_END"] = "TOOL_CALL_END";
|
|
149
|
+
EventType["TOOL_CALL_CHUNK"] = "TOOL_CALL_CHUNK";
|
|
150
|
+
EventType["TOOL_CALL_RESULT"] = "TOOL_CALL_RESULT";
|
|
151
|
+
/**
|
|
152
|
+
* @deprecated Use REASONING_START instead. Will be removed in 1.0.0.
|
|
153
|
+
*/
|
|
154
|
+
EventType["THINKING_START"] = "THINKING_START";
|
|
155
|
+
/**
|
|
156
|
+
* @deprecated Use REASONING_END instead. Will be removed in 1.0.0.
|
|
157
|
+
*/
|
|
158
|
+
EventType["THINKING_END"] = "THINKING_END";
|
|
159
|
+
/**
|
|
160
|
+
* @deprecated Use REASONING_MESSAGE_START instead. Will be removed in 1.0.0.
|
|
161
|
+
*/
|
|
162
|
+
EventType["THINKING_TEXT_MESSAGE_START"] = "THINKING_TEXT_MESSAGE_START";
|
|
163
|
+
/**
|
|
164
|
+
* @deprecated Use REASONING_MESSAGE_CONTENT instead. Will be removed in 1.0.0.
|
|
165
|
+
*/
|
|
166
|
+
EventType["THINKING_TEXT_MESSAGE_CONTENT"] = "THINKING_TEXT_MESSAGE_CONTENT";
|
|
167
|
+
/**
|
|
168
|
+
* @deprecated Use REASONING_MESSAGE_END instead. Will be removed in 1.0.0.
|
|
169
|
+
*/
|
|
170
|
+
EventType["THINKING_TEXT_MESSAGE_END"] = "THINKING_TEXT_MESSAGE_END";
|
|
171
|
+
EventType["STATE_SNAPSHOT"] = "STATE_SNAPSHOT";
|
|
172
|
+
EventType["STATE_DELTA"] = "STATE_DELTA";
|
|
173
|
+
EventType["MESSAGES_SNAPSHOT"] = "MESSAGES_SNAPSHOT";
|
|
174
|
+
EventType["ACTIVITY_SNAPSHOT"] = "ACTIVITY_SNAPSHOT";
|
|
175
|
+
EventType["ACTIVITY_DELTA"] = "ACTIVITY_DELTA";
|
|
176
|
+
EventType["RAW"] = "RAW";
|
|
177
|
+
EventType["CUSTOM"] = "CUSTOM";
|
|
178
|
+
EventType["RUN_STARTED"] = "RUN_STARTED";
|
|
179
|
+
EventType["RUN_FINISHED"] = "RUN_FINISHED";
|
|
180
|
+
EventType["RUN_ERROR"] = "RUN_ERROR";
|
|
181
|
+
EventType["STEP_STARTED"] = "STEP_STARTED";
|
|
182
|
+
EventType["STEP_FINISHED"] = "STEP_FINISHED";
|
|
183
|
+
EventType["REASONING_START"] = "REASONING_START";
|
|
184
|
+
EventType["REASONING_MESSAGE_START"] = "REASONING_MESSAGE_START";
|
|
185
|
+
EventType["REASONING_MESSAGE_CONTENT"] = "REASONING_MESSAGE_CONTENT";
|
|
186
|
+
EventType["REASONING_MESSAGE_END"] = "REASONING_MESSAGE_END";
|
|
187
|
+
EventType["REASONING_MESSAGE_CHUNK"] = "REASONING_MESSAGE_CHUNK";
|
|
188
|
+
EventType["REASONING_END"] = "REASONING_END";
|
|
189
|
+
EventType["REASONING_ENCRYPTED_VALUE"] = "REASONING_ENCRYPTED_VALUE";
|
|
190
|
+
return EventType;
|
|
191
|
+
}({});
|
|
192
|
+
const BaseEventSchema = zod.z.object({
|
|
193
|
+
type: zod.z.nativeEnum(EventType),
|
|
194
|
+
timestamp: zod.z.number().optional(),
|
|
195
|
+
rawEvent: zod.z.any().optional()
|
|
244
196
|
}).passthrough();
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
});
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
197
|
+
const TextMessageStartEventSchema = BaseEventSchema.extend({
|
|
198
|
+
type: zod.z.literal(EventType.TEXT_MESSAGE_START),
|
|
199
|
+
messageId: zod.z.string(),
|
|
200
|
+
role: TextMessageRoleSchema.default("assistant")
|
|
201
|
+
});
|
|
202
|
+
const TextMessageContentEventSchema = BaseEventSchema.extend({
|
|
203
|
+
type: zod.z.literal(EventType.TEXT_MESSAGE_CONTENT),
|
|
204
|
+
messageId: zod.z.string(),
|
|
205
|
+
delta: zod.z.string().refine((s) => s.length > 0, "Delta must not be an empty string")
|
|
206
|
+
});
|
|
207
|
+
const TextMessageEndEventSchema = BaseEventSchema.extend({
|
|
208
|
+
type: zod.z.literal(EventType.TEXT_MESSAGE_END),
|
|
209
|
+
messageId: zod.z.string()
|
|
210
|
+
});
|
|
211
|
+
const TextMessageChunkEventSchema = BaseEventSchema.extend({
|
|
212
|
+
type: zod.z.literal(EventType.TEXT_MESSAGE_CHUNK),
|
|
213
|
+
messageId: zod.z.string().optional(),
|
|
214
|
+
role: TextMessageRoleSchema.optional(),
|
|
215
|
+
delta: zod.z.string().optional()
|
|
216
|
+
});
|
|
217
|
+
/**
|
|
218
|
+
* @deprecated Use ReasoningMessageStartEventSchema instead. Will be removed in 1.0.0.
|
|
219
|
+
*/
|
|
220
|
+
const ThinkingTextMessageStartEventSchema = BaseEventSchema.extend({ type: zod.z.literal(EventType.THINKING_TEXT_MESSAGE_START) });
|
|
221
|
+
/**
|
|
222
|
+
* @deprecated Use ReasoningMessageContentEventSchema instead. Will be removed in 1.0.0.
|
|
223
|
+
*/
|
|
224
|
+
const ThinkingTextMessageContentEventSchema = TextMessageContentEventSchema.omit({
|
|
225
|
+
messageId: true,
|
|
226
|
+
type: true
|
|
227
|
+
}).extend({ type: zod.z.literal(EventType.THINKING_TEXT_MESSAGE_CONTENT) });
|
|
228
|
+
/**
|
|
229
|
+
* @deprecated Use ReasoningMessageEndEventSchema instead. Will be removed in 1.0.0.
|
|
230
|
+
*/
|
|
231
|
+
const ThinkingTextMessageEndEventSchema = BaseEventSchema.extend({ type: zod.z.literal(EventType.THINKING_TEXT_MESSAGE_END) });
|
|
232
|
+
const ToolCallStartEventSchema = BaseEventSchema.extend({
|
|
233
|
+
type: zod.z.literal(EventType.TOOL_CALL_START),
|
|
234
|
+
toolCallId: zod.z.string(),
|
|
235
|
+
toolCallName: zod.z.string(),
|
|
236
|
+
parentMessageId: zod.z.string().optional()
|
|
237
|
+
});
|
|
238
|
+
const ToolCallArgsEventSchema = BaseEventSchema.extend({
|
|
239
|
+
type: zod.z.literal(EventType.TOOL_CALL_ARGS),
|
|
240
|
+
toolCallId: zod.z.string(),
|
|
241
|
+
delta: zod.z.string()
|
|
242
|
+
});
|
|
243
|
+
const ToolCallEndEventSchema = BaseEventSchema.extend({
|
|
244
|
+
type: zod.z.literal(EventType.TOOL_CALL_END),
|
|
245
|
+
toolCallId: zod.z.string()
|
|
246
|
+
});
|
|
247
|
+
const ToolCallResultEventSchema = BaseEventSchema.extend({
|
|
248
|
+
messageId: zod.z.string(),
|
|
249
|
+
type: zod.z.literal(EventType.TOOL_CALL_RESULT),
|
|
250
|
+
toolCallId: zod.z.string(),
|
|
251
|
+
content: zod.z.string(),
|
|
252
|
+
role: zod.z.literal("tool").optional()
|
|
253
|
+
});
|
|
254
|
+
const ToolCallChunkEventSchema = BaseEventSchema.extend({
|
|
255
|
+
type: zod.z.literal(EventType.TOOL_CALL_CHUNK),
|
|
256
|
+
toolCallId: zod.z.string().optional(),
|
|
257
|
+
toolCallName: zod.z.string().optional(),
|
|
258
|
+
parentMessageId: zod.z.string().optional(),
|
|
259
|
+
delta: zod.z.string().optional()
|
|
260
|
+
});
|
|
261
|
+
/**
|
|
262
|
+
* @deprecated Use ReasoningStartEventSchema instead. Will be removed in 1.0.0.
|
|
263
|
+
*/
|
|
264
|
+
const ThinkingStartEventSchema = BaseEventSchema.extend({
|
|
265
|
+
type: zod.z.literal(EventType.THINKING_START),
|
|
266
|
+
title: zod.z.string().optional()
|
|
267
|
+
});
|
|
268
|
+
/**
|
|
269
|
+
* @deprecated Use ReasoningEndEventSchema instead. Will be removed in 1.0.0.
|
|
270
|
+
*/
|
|
271
|
+
const ThinkingEndEventSchema = BaseEventSchema.extend({ type: zod.z.literal(EventType.THINKING_END) });
|
|
272
|
+
const StateSnapshotEventSchema = BaseEventSchema.extend({
|
|
273
|
+
type: zod.z.literal(EventType.STATE_SNAPSHOT),
|
|
274
|
+
snapshot: StateSchema
|
|
275
|
+
});
|
|
276
|
+
const StateDeltaEventSchema = BaseEventSchema.extend({
|
|
277
|
+
type: zod.z.literal(EventType.STATE_DELTA),
|
|
278
|
+
delta: zod.z.array(zod.z.any())
|
|
279
|
+
});
|
|
280
|
+
const MessagesSnapshotEventSchema = BaseEventSchema.extend({
|
|
281
|
+
type: zod.z.literal(EventType.MESSAGES_SNAPSHOT),
|
|
282
|
+
messages: zod.z.array(MessageSchema)
|
|
283
|
+
});
|
|
284
|
+
const ActivitySnapshotEventSchema = BaseEventSchema.extend({
|
|
285
|
+
type: zod.z.literal(EventType.ACTIVITY_SNAPSHOT),
|
|
286
|
+
messageId: zod.z.string(),
|
|
287
|
+
activityType: zod.z.string(),
|
|
288
|
+
content: zod.z.record(zod.z.any()),
|
|
289
|
+
replace: zod.z.boolean().optional().default(true)
|
|
290
|
+
});
|
|
291
|
+
const ActivityDeltaEventSchema = BaseEventSchema.extend({
|
|
292
|
+
type: zod.z.literal(EventType.ACTIVITY_DELTA),
|
|
293
|
+
messageId: zod.z.string(),
|
|
294
|
+
activityType: zod.z.string(),
|
|
295
|
+
patch: zod.z.array(zod.z.any())
|
|
296
|
+
});
|
|
297
|
+
const RawEventSchema = BaseEventSchema.extend({
|
|
298
|
+
type: zod.z.literal(EventType.RAW),
|
|
299
|
+
event: zod.z.any(),
|
|
300
|
+
source: zod.z.string().optional()
|
|
301
|
+
});
|
|
302
|
+
const CustomEventSchema = BaseEventSchema.extend({
|
|
303
|
+
type: zod.z.literal(EventType.CUSTOM),
|
|
304
|
+
name: zod.z.string(),
|
|
305
|
+
value: zod.z.any()
|
|
306
|
+
});
|
|
307
|
+
const RunStartedEventSchema = BaseEventSchema.extend({
|
|
308
|
+
type: zod.z.literal(EventType.RUN_STARTED),
|
|
309
|
+
threadId: zod.z.string(),
|
|
310
|
+
runId: zod.z.string(),
|
|
311
|
+
parentRunId: zod.z.string().optional(),
|
|
312
|
+
input: RunAgentInputSchema.optional()
|
|
313
|
+
});
|
|
314
|
+
const RunFinishedEventSchema = BaseEventSchema.extend({
|
|
315
|
+
type: zod.z.literal(EventType.RUN_FINISHED),
|
|
316
|
+
threadId: zod.z.string(),
|
|
317
|
+
runId: zod.z.string(),
|
|
318
|
+
result: zod.z.any().optional()
|
|
319
|
+
});
|
|
320
|
+
const RunErrorEventSchema = BaseEventSchema.extend({
|
|
321
|
+
type: zod.z.literal(EventType.RUN_ERROR),
|
|
322
|
+
message: zod.z.string(),
|
|
323
|
+
code: zod.z.string().optional()
|
|
324
|
+
});
|
|
325
|
+
const StepStartedEventSchema = BaseEventSchema.extend({
|
|
326
|
+
type: zod.z.literal(EventType.STEP_STARTED),
|
|
327
|
+
stepName: zod.z.string()
|
|
328
|
+
});
|
|
329
|
+
const StepFinishedEventSchema = BaseEventSchema.extend({
|
|
330
|
+
type: zod.z.literal(EventType.STEP_FINISHED),
|
|
331
|
+
stepName: zod.z.string()
|
|
332
|
+
});
|
|
333
|
+
const ReasoningEncryptedValueSubtypeSchema = zod.z.union([zod.z.literal("tool-call"), zod.z.literal("message")]);
|
|
334
|
+
const ReasoningStartEventSchema = BaseEventSchema.extend({
|
|
335
|
+
type: zod.z.literal(EventType.REASONING_START),
|
|
336
|
+
messageId: zod.z.string()
|
|
337
|
+
});
|
|
338
|
+
const ReasoningMessageStartEventSchema = BaseEventSchema.extend({
|
|
339
|
+
type: zod.z.literal(EventType.REASONING_MESSAGE_START),
|
|
340
|
+
messageId: zod.z.string(),
|
|
341
|
+
role: zod.z.literal("reasoning")
|
|
342
|
+
});
|
|
343
|
+
const ReasoningMessageContentEventSchema = BaseEventSchema.extend({
|
|
344
|
+
type: zod.z.literal(EventType.REASONING_MESSAGE_CONTENT),
|
|
345
|
+
messageId: zod.z.string(),
|
|
346
|
+
delta: zod.z.string().refine((s) => s.length > 0, "Delta must not be an empty string")
|
|
347
|
+
});
|
|
348
|
+
const ReasoningMessageEndEventSchema = BaseEventSchema.extend({
|
|
349
|
+
type: zod.z.literal(EventType.REASONING_MESSAGE_END),
|
|
350
|
+
messageId: zod.z.string()
|
|
351
|
+
});
|
|
352
|
+
const ReasoningMessageChunkEventSchema = BaseEventSchema.extend({
|
|
353
|
+
type: zod.z.literal(EventType.REASONING_MESSAGE_CHUNK),
|
|
354
|
+
messageId: zod.z.string().optional(),
|
|
355
|
+
delta: zod.z.string().optional()
|
|
356
|
+
});
|
|
357
|
+
const ReasoningEndEventSchema = BaseEventSchema.extend({
|
|
358
|
+
type: zod.z.literal(EventType.REASONING_END),
|
|
359
|
+
messageId: zod.z.string()
|
|
360
|
+
});
|
|
361
|
+
const ReasoningEncryptedValueEventSchema = BaseEventSchema.extend({
|
|
362
|
+
type: zod.z.literal(EventType.REASONING_ENCRYPTED_VALUE),
|
|
363
|
+
subtype: ReasoningEncryptedValueSubtypeSchema,
|
|
364
|
+
entityId: zod.z.string(),
|
|
365
|
+
encryptedValue: zod.z.string()
|
|
366
|
+
});
|
|
367
|
+
const EventSchemas = zod.z.discriminatedUnion("type", [
|
|
368
|
+
TextMessageStartEventSchema,
|
|
369
|
+
TextMessageContentEventSchema,
|
|
370
|
+
TextMessageEndEventSchema,
|
|
371
|
+
TextMessageChunkEventSchema,
|
|
372
|
+
ThinkingStartEventSchema,
|
|
373
|
+
ThinkingEndEventSchema,
|
|
374
|
+
ThinkingTextMessageStartEventSchema,
|
|
375
|
+
ThinkingTextMessageContentEventSchema,
|
|
376
|
+
ThinkingTextMessageEndEventSchema,
|
|
377
|
+
ToolCallStartEventSchema,
|
|
378
|
+
ToolCallArgsEventSchema,
|
|
379
|
+
ToolCallEndEventSchema,
|
|
380
|
+
ToolCallChunkEventSchema,
|
|
381
|
+
ToolCallResultEventSchema,
|
|
382
|
+
StateSnapshotEventSchema,
|
|
383
|
+
StateDeltaEventSchema,
|
|
384
|
+
MessagesSnapshotEventSchema,
|
|
385
|
+
ActivitySnapshotEventSchema,
|
|
386
|
+
ActivityDeltaEventSchema,
|
|
387
|
+
RawEventSchema,
|
|
388
|
+
CustomEventSchema,
|
|
389
|
+
RunStartedEventSchema,
|
|
390
|
+
RunFinishedEventSchema,
|
|
391
|
+
RunErrorEventSchema,
|
|
392
|
+
StepStartedEventSchema,
|
|
393
|
+
StepFinishedEventSchema,
|
|
394
|
+
ReasoningStartEventSchema,
|
|
395
|
+
ReasoningMessageStartEventSchema,
|
|
396
|
+
ReasoningMessageContentEventSchema,
|
|
397
|
+
ReasoningMessageEndEventSchema,
|
|
398
|
+
ReasoningMessageChunkEventSchema,
|
|
399
|
+
ReasoningEndEventSchema,
|
|
400
|
+
ReasoningEncryptedValueEventSchema
|
|
402
401
|
]);
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
402
|
+
|
|
403
|
+
//#endregion
|
|
404
|
+
exports.AGUIConnectNotImplementedError = AGUIConnectNotImplementedError;
|
|
405
|
+
exports.AGUIError = AGUIError;
|
|
406
|
+
exports.ActivityDeltaEventSchema = ActivityDeltaEventSchema;
|
|
407
|
+
exports.ActivityMessageSchema = ActivityMessageSchema;
|
|
408
|
+
exports.ActivitySnapshotEventSchema = ActivitySnapshotEventSchema;
|
|
409
|
+
exports.AssistantMessageSchema = AssistantMessageSchema;
|
|
410
|
+
exports.BaseEventSchema = BaseEventSchema;
|
|
411
|
+
exports.BaseMessageSchema = BaseMessageSchema;
|
|
412
|
+
exports.BinaryInputContentSchema = BinaryInputContentSchema;
|
|
413
|
+
exports.ContextSchema = ContextSchema;
|
|
414
|
+
exports.CustomEventSchema = CustomEventSchema;
|
|
415
|
+
exports.DeveloperMessageSchema = DeveloperMessageSchema;
|
|
416
|
+
exports.EventSchemas = EventSchemas;
|
|
417
|
+
exports.EventType = EventType;
|
|
418
|
+
exports.FunctionCallSchema = FunctionCallSchema;
|
|
419
|
+
exports.InputContentSchema = InputContentSchema;
|
|
420
|
+
exports.MessageSchema = MessageSchema;
|
|
421
|
+
exports.MessagesSnapshotEventSchema = MessagesSnapshotEventSchema;
|
|
422
|
+
exports.RawEventSchema = RawEventSchema;
|
|
423
|
+
exports.ReasoningEncryptedValueEventSchema = ReasoningEncryptedValueEventSchema;
|
|
424
|
+
exports.ReasoningEncryptedValueSubtypeSchema = ReasoningEncryptedValueSubtypeSchema;
|
|
425
|
+
exports.ReasoningEndEventSchema = ReasoningEndEventSchema;
|
|
426
|
+
exports.ReasoningMessageChunkEventSchema = ReasoningMessageChunkEventSchema;
|
|
427
|
+
exports.ReasoningMessageContentEventSchema = ReasoningMessageContentEventSchema;
|
|
428
|
+
exports.ReasoningMessageEndEventSchema = ReasoningMessageEndEventSchema;
|
|
429
|
+
exports.ReasoningMessageSchema = ReasoningMessageSchema;
|
|
430
|
+
exports.ReasoningMessageStartEventSchema = ReasoningMessageStartEventSchema;
|
|
431
|
+
exports.ReasoningStartEventSchema = ReasoningStartEventSchema;
|
|
432
|
+
exports.RoleSchema = RoleSchema;
|
|
433
|
+
exports.RunAgentInputSchema = RunAgentInputSchema;
|
|
434
|
+
exports.RunErrorEventSchema = RunErrorEventSchema;
|
|
435
|
+
exports.RunFinishedEventSchema = RunFinishedEventSchema;
|
|
436
|
+
exports.RunStartedEventSchema = RunStartedEventSchema;
|
|
437
|
+
exports.StateDeltaEventSchema = StateDeltaEventSchema;
|
|
438
|
+
exports.StateSchema = StateSchema;
|
|
439
|
+
exports.StateSnapshotEventSchema = StateSnapshotEventSchema;
|
|
440
|
+
exports.StepFinishedEventSchema = StepFinishedEventSchema;
|
|
441
|
+
exports.StepStartedEventSchema = StepStartedEventSchema;
|
|
442
|
+
exports.SystemMessageSchema = SystemMessageSchema;
|
|
443
|
+
exports.TextInputContentSchema = TextInputContentSchema;
|
|
444
|
+
exports.TextMessageChunkEventSchema = TextMessageChunkEventSchema;
|
|
445
|
+
exports.TextMessageContentEventSchema = TextMessageContentEventSchema;
|
|
446
|
+
exports.TextMessageEndEventSchema = TextMessageEndEventSchema;
|
|
447
|
+
exports.TextMessageStartEventSchema = TextMessageStartEventSchema;
|
|
448
|
+
exports.ThinkingEndEventSchema = ThinkingEndEventSchema;
|
|
449
|
+
exports.ThinkingStartEventSchema = ThinkingStartEventSchema;
|
|
450
|
+
exports.ThinkingTextMessageContentEventSchema = ThinkingTextMessageContentEventSchema;
|
|
451
|
+
exports.ThinkingTextMessageEndEventSchema = ThinkingTextMessageEndEventSchema;
|
|
452
|
+
exports.ThinkingTextMessageStartEventSchema = ThinkingTextMessageStartEventSchema;
|
|
453
|
+
exports.ToolCallArgsEventSchema = ToolCallArgsEventSchema;
|
|
454
|
+
exports.ToolCallChunkEventSchema = ToolCallChunkEventSchema;
|
|
455
|
+
exports.ToolCallEndEventSchema = ToolCallEndEventSchema;
|
|
456
|
+
exports.ToolCallResultEventSchema = ToolCallResultEventSchema;
|
|
457
|
+
exports.ToolCallSchema = ToolCallSchema;
|
|
458
|
+
exports.ToolCallStartEventSchema = ToolCallStartEventSchema;
|
|
459
|
+
exports.ToolMessageSchema = ToolMessageSchema;
|
|
460
|
+
exports.ToolSchema = ToolSchema;
|
|
461
|
+
exports.UserMessageSchema = UserMessageSchema;
|
|
455
462
|
//# sourceMappingURL=index.js.map
|