@perstack/core 0.0.53 → 0.0.54
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/src/adapters/event-creators.d.ts +26 -0
- package/dist/src/adapters/event-creators.d.ts.map +1 -0
- package/dist/src/adapters/event-creators.js +126 -0
- package/dist/src/adapters/event-creators.js.map +1 -0
- package/dist/src/adapters/index.d.ts +2 -0
- package/dist/src/adapters/index.d.ts.map +1 -0
- package/dist/src/adapters/index.js +2 -0
- package/dist/src/adapters/index.js.map +1 -0
- package/dist/src/constants/constants.d.ts +11 -0
- package/dist/src/constants/constants.d.ts.map +1 -0
- package/dist/src/constants/constants.js +13 -0
- package/dist/src/constants/constants.js.map +1 -0
- package/dist/src/errors.d.ts +4 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.js +7 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/index.d.ts +28 -6357
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +28 -1972
- package/dist/src/index.js.map +1 -1
- package/dist/src/known-models/index.d.ts +9 -0
- package/dist/src/known-models/index.d.ts.map +1 -0
- package/dist/src/known-models/index.js +216 -0
- package/dist/src/known-models/index.js.map +1 -0
- package/dist/src/schemas/activity.d.ts +2159 -0
- package/dist/src/schemas/activity.d.ts.map +1 -0
- package/dist/src/schemas/activity.js +209 -0
- package/dist/src/schemas/activity.js.map +1 -0
- package/dist/src/schemas/checkpoint.d.ts +338 -0
- package/dist/src/schemas/checkpoint.d.ts.map +1 -0
- package/dist/src/schemas/checkpoint.js +69 -0
- package/dist/src/schemas/checkpoint.js.map +1 -0
- package/dist/src/schemas/expert.d.ts +309 -0
- package/dist/src/schemas/expert.d.ts.map +1 -0
- package/dist/src/schemas/expert.js +70 -0
- package/dist/src/schemas/expert.js.map +1 -0
- package/dist/src/schemas/job.d.ts +44 -0
- package/dist/src/schemas/job.d.ts.map +1 -0
- package/dist/src/schemas/job.js +22 -0
- package/dist/src/schemas/job.js.map +1 -0
- package/dist/src/schemas/lockfile.d.ts +143 -0
- package/dist/src/schemas/lockfile.d.ts.map +1 -0
- package/dist/src/schemas/lockfile.js +26 -0
- package/dist/src/schemas/lockfile.js.map +1 -0
- package/dist/src/schemas/message-part.d.ts +239 -0
- package/dist/src/schemas/message-part.d.ts.map +1 -0
- package/dist/src/schemas/message-part.js +80 -0
- package/dist/src/schemas/message-part.js.map +1 -0
- package/dist/src/schemas/message.d.ts +236 -0
- package/dist/src/schemas/message.d.ts.map +1 -0
- package/dist/src/schemas/message.js +44 -0
- package/dist/src/schemas/message.js.map +1 -0
- package/dist/src/schemas/perstack-toml.d.ts +366 -0
- package/dist/src/schemas/perstack-toml.d.ts.map +1 -0
- package/dist/src/schemas/perstack-toml.js +175 -0
- package/dist/src/schemas/perstack-toml.js.map +1 -0
- package/dist/src/schemas/provider-config.d.ts +216 -0
- package/dist/src/schemas/provider-config.d.ts.map +1 -0
- package/dist/src/schemas/provider-config.js +86 -0
- package/dist/src/schemas/provider-config.js.map +1 -0
- package/dist/src/schemas/provider-tools.d.ts +93 -0
- package/dist/src/schemas/provider-tools.d.ts.map +1 -0
- package/dist/src/schemas/provider-tools.js +60 -0
- package/dist/src/schemas/provider-tools.js.map +1 -0
- package/dist/src/schemas/run-command.d.ts +127 -0
- package/dist/src/schemas/run-command.d.ts.map +1 -0
- package/dist/src/schemas/run-command.js +82 -0
- package/dist/src/schemas/run-command.js.map +1 -0
- package/dist/src/schemas/runtime-version.d.ts +4 -0
- package/dist/src/schemas/runtime-version.d.ts.map +1 -0
- package/dist/src/schemas/runtime-version.js +6 -0
- package/dist/src/schemas/runtime-version.js.map +1 -0
- package/dist/src/schemas/runtime.d.ts +1317 -0
- package/dist/src/schemas/runtime.d.ts.map +1 -0
- package/dist/src/schemas/runtime.js +205 -0
- package/dist/src/schemas/runtime.js.map +1 -0
- package/dist/src/schemas/skill-manager.d.ts +64 -0
- package/dist/src/schemas/skill-manager.d.ts.map +1 -0
- package/dist/src/schemas/skill-manager.js +2 -0
- package/dist/src/schemas/skill-manager.js.map +1 -0
- package/dist/src/schemas/skill.d.ts +147 -0
- package/dist/src/schemas/skill.d.ts.map +1 -0
- package/dist/src/schemas/skill.js +99 -0
- package/dist/src/schemas/skill.js.map +1 -0
- package/dist/src/schemas/step.d.ts +370 -0
- package/dist/src/schemas/step.d.ts.map +1 -0
- package/dist/src/schemas/step.js +21 -0
- package/dist/src/schemas/step.js.map +1 -0
- package/dist/src/schemas/tool-call.d.ts +19 -0
- package/dist/src/schemas/tool-call.d.ts.map +1 -0
- package/dist/src/schemas/tool-call.js +10 -0
- package/dist/src/schemas/tool-call.js.map +1 -0
- package/dist/src/schemas/tool-result.d.ts +86 -0
- package/dist/src/schemas/tool-result.d.ts.map +1 -0
- package/dist/src/schemas/tool-result.js +11 -0
- package/dist/src/schemas/tool-result.js.map +1 -0
- package/dist/src/schemas/usage.d.ts +22 -0
- package/dist/src/schemas/usage.d.ts.map +1 -0
- package/dist/src/schemas/usage.js +10 -0
- package/dist/src/schemas/usage.js.map +1 -0
- package/dist/src/utils/activity.d.ts +20 -0
- package/dist/src/utils/activity.d.ts.map +1 -0
- package/dist/src/utils/activity.js +449 -0
- package/dist/src/utils/activity.js.map +1 -0
- package/dist/src/utils/env-filter.d.ts +4 -0
- package/dist/src/utils/env-filter.d.ts.map +1 -0
- package/dist/src/utils/env-filter.js +50 -0
- package/dist/src/utils/env-filter.js.map +1 -0
- package/dist/src/utils/event-filter.d.ts +16 -0
- package/dist/src/utils/event-filter.d.ts.map +1 -0
- package/dist/src/utils/event-filter.js +31 -0
- package/dist/src/utils/event-filter.js.map +1 -0
- package/dist/src/utils/expert-type.d.ts +38 -0
- package/dist/src/utils/expert-type.d.ts.map +1 -0
- package/dist/src/utils/expert-type.js +88 -0
- package/dist/src/utils/expert-type.js.map +1 -0
- package/dist/src/utils/zod-error.d.ts +4 -0
- package/dist/src/utils/zod-error.d.ts.map +1 -0
- package/dist/src/utils/zod-error.js +17 -0
- package/dist/src/utils/zod-error.js.map +1 -0
- package/package.json +18 -16
- package/LICENSE +0 -202
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Base properties shared by all message parts */
|
|
3
|
+
export interface BasePart {
|
|
4
|
+
/** Unique identifier for this part */
|
|
5
|
+
id: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const basePartSchema: z.ZodObject<{
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
/** Plain text content */
|
|
11
|
+
export interface TextPart extends BasePart {
|
|
12
|
+
type: "textPart";
|
|
13
|
+
/** The text content */
|
|
14
|
+
text: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const textPartSchema: z.ZodObject<{
|
|
17
|
+
id: z.ZodString;
|
|
18
|
+
type: z.ZodLiteral<"textPart">;
|
|
19
|
+
text: z.ZodString;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
/** Image referenced by URL */
|
|
22
|
+
export interface ImageUrlPart extends BasePart {
|
|
23
|
+
type: "imageUrlPart";
|
|
24
|
+
/** URL to the image */
|
|
25
|
+
url: string;
|
|
26
|
+
/** MIME type of the image */
|
|
27
|
+
mimeType: string;
|
|
28
|
+
}
|
|
29
|
+
export declare const imageUrlPartSchema: z.ZodObject<{
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
type: z.ZodLiteral<"imageUrlPart">;
|
|
32
|
+
url: z.ZodURL;
|
|
33
|
+
mimeType: z.ZodString;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
/** Image with base64-encoded inline data */
|
|
36
|
+
export interface ImageInlinePart extends BasePart {
|
|
37
|
+
type: "imageInlinePart";
|
|
38
|
+
/** Base64-encoded image data */
|
|
39
|
+
encodedData: string;
|
|
40
|
+
/** MIME type of the image */
|
|
41
|
+
mimeType: string;
|
|
42
|
+
}
|
|
43
|
+
export declare const imageInlinePartSchema: z.ZodObject<{
|
|
44
|
+
id: z.ZodString;
|
|
45
|
+
type: z.ZodLiteral<"imageInlinePart">;
|
|
46
|
+
encodedData: z.ZodString;
|
|
47
|
+
mimeType: z.ZodString;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
/** Image with binary data (internal use) */
|
|
50
|
+
export interface ImageBinaryPart extends BasePart {
|
|
51
|
+
type: "imageBinaryPart";
|
|
52
|
+
/** Binary data as string */
|
|
53
|
+
data: string;
|
|
54
|
+
/** MIME type of the image */
|
|
55
|
+
mimeType: string;
|
|
56
|
+
}
|
|
57
|
+
export declare const imageBinaryPartSchema: z.ZodObject<{
|
|
58
|
+
id: z.ZodString;
|
|
59
|
+
type: z.ZodLiteral<"imageBinaryPart">;
|
|
60
|
+
data: z.ZodString;
|
|
61
|
+
mimeType: z.ZodString;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
/** File referenced by URL */
|
|
64
|
+
export interface FileUrlPart extends BasePart {
|
|
65
|
+
type: "fileUrlPart";
|
|
66
|
+
/** URL to the file */
|
|
67
|
+
url: string;
|
|
68
|
+
/** MIME type of the file */
|
|
69
|
+
mimeType: string;
|
|
70
|
+
}
|
|
71
|
+
export declare const fileUrlPartSchema: z.ZodObject<{
|
|
72
|
+
id: z.ZodString;
|
|
73
|
+
type: z.ZodLiteral<"fileUrlPart">;
|
|
74
|
+
url: z.ZodString;
|
|
75
|
+
mimeType: z.ZodString;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
/** File with base64-encoded inline data */
|
|
78
|
+
export interface FileInlinePart extends BasePart {
|
|
79
|
+
type: "fileInlinePart";
|
|
80
|
+
/** Base64-encoded file data */
|
|
81
|
+
encodedData: string;
|
|
82
|
+
/** MIME type of the file */
|
|
83
|
+
mimeType: string;
|
|
84
|
+
}
|
|
85
|
+
export declare const fileInlinePartSchema: z.ZodObject<{
|
|
86
|
+
id: z.ZodString;
|
|
87
|
+
type: z.ZodLiteral<"fileInlinePart">;
|
|
88
|
+
encodedData: z.ZodString;
|
|
89
|
+
mimeType: z.ZodString;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
/** File with binary data (internal use) */
|
|
92
|
+
export interface FileBinaryPart extends BasePart {
|
|
93
|
+
type: "fileBinaryPart";
|
|
94
|
+
/** Binary data as string */
|
|
95
|
+
data: string;
|
|
96
|
+
/** MIME type of the file */
|
|
97
|
+
mimeType: string;
|
|
98
|
+
}
|
|
99
|
+
export declare const fileBinaryPartSchema: z.ZodObject<{
|
|
100
|
+
id: z.ZodString;
|
|
101
|
+
type: z.ZodLiteral<"fileBinaryPart">;
|
|
102
|
+
data: z.ZodString;
|
|
103
|
+
mimeType: z.ZodString;
|
|
104
|
+
}, z.core.$strip>;
|
|
105
|
+
/** A tool call request from the Expert */
|
|
106
|
+
export interface ToolCallPart extends BasePart {
|
|
107
|
+
type: "toolCallPart";
|
|
108
|
+
/** Unique identifier for this tool call */
|
|
109
|
+
toolCallId: string;
|
|
110
|
+
/** Name of the tool to call */
|
|
111
|
+
toolName: string;
|
|
112
|
+
/** Arguments to pass to the tool */
|
|
113
|
+
args: Record<string, unknown>;
|
|
114
|
+
}
|
|
115
|
+
export declare const toolCallPartSchema: z.ZodObject<{
|
|
116
|
+
id: z.ZodString;
|
|
117
|
+
type: z.ZodLiteral<"toolCallPart">;
|
|
118
|
+
toolCallId: z.ZodString;
|
|
119
|
+
toolName: z.ZodString;
|
|
120
|
+
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
/** Thinking block from extended thinking / reasoning models */
|
|
123
|
+
export interface ThinkingPart extends BasePart {
|
|
124
|
+
type: "thinkingPart";
|
|
125
|
+
/** The thinking content */
|
|
126
|
+
thinking: string;
|
|
127
|
+
/** Signature for redacted thinking blocks (Anthropic) */
|
|
128
|
+
signature?: string;
|
|
129
|
+
}
|
|
130
|
+
export declare const thinkingPartSchema: z.ZodObject<{
|
|
131
|
+
id: z.ZodString;
|
|
132
|
+
type: z.ZodLiteral<"thinkingPart">;
|
|
133
|
+
thinking: z.ZodString;
|
|
134
|
+
signature: z.ZodOptional<z.ZodString>;
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
/** Result of a tool call */
|
|
137
|
+
export interface ToolResultPart extends BasePart {
|
|
138
|
+
type: "toolResultPart";
|
|
139
|
+
/** ID of the tool call this result corresponds to */
|
|
140
|
+
toolCallId: string;
|
|
141
|
+
/** Name of the tool that was called */
|
|
142
|
+
toolName: string;
|
|
143
|
+
/** Content of the tool result */
|
|
144
|
+
contents: (TextPart | ImageInlinePart | FileInlinePart)[];
|
|
145
|
+
/** Whether the tool call resulted in an error */
|
|
146
|
+
isError?: boolean;
|
|
147
|
+
}
|
|
148
|
+
export declare const toolResultPartSchema: z.ZodObject<{
|
|
149
|
+
id: z.ZodString;
|
|
150
|
+
type: z.ZodLiteral<"toolResultPart">;
|
|
151
|
+
toolCallId: z.ZodString;
|
|
152
|
+
toolName: z.ZodString;
|
|
153
|
+
contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
154
|
+
id: z.ZodString;
|
|
155
|
+
type: z.ZodLiteral<"textPart">;
|
|
156
|
+
text: z.ZodString;
|
|
157
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
158
|
+
id: z.ZodString;
|
|
159
|
+
type: z.ZodLiteral<"imageInlinePart">;
|
|
160
|
+
encodedData: z.ZodString;
|
|
161
|
+
mimeType: z.ZodString;
|
|
162
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
163
|
+
id: z.ZodString;
|
|
164
|
+
type: z.ZodLiteral<"fileInlinePart">;
|
|
165
|
+
encodedData: z.ZodString;
|
|
166
|
+
mimeType: z.ZodString;
|
|
167
|
+
}, z.core.$strip>]>>;
|
|
168
|
+
isError: z.ZodOptional<z.ZodBoolean>;
|
|
169
|
+
}, z.core.$strip>;
|
|
170
|
+
/** All possible message part types */
|
|
171
|
+
export type MessagePart = TextPart | ImageUrlPart | ImageInlinePart | ImageBinaryPart | FileUrlPart | FileInlinePart | FileBinaryPart | ToolCallPart | ToolResultPart | ThinkingPart;
|
|
172
|
+
export declare const messagePartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
173
|
+
id: z.ZodString;
|
|
174
|
+
type: z.ZodLiteral<"textPart">;
|
|
175
|
+
text: z.ZodString;
|
|
176
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
177
|
+
id: z.ZodString;
|
|
178
|
+
type: z.ZodLiteral<"imageUrlPart">;
|
|
179
|
+
url: z.ZodURL;
|
|
180
|
+
mimeType: z.ZodString;
|
|
181
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
182
|
+
id: z.ZodString;
|
|
183
|
+
type: z.ZodLiteral<"imageInlinePart">;
|
|
184
|
+
encodedData: z.ZodString;
|
|
185
|
+
mimeType: z.ZodString;
|
|
186
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
187
|
+
id: z.ZodString;
|
|
188
|
+
type: z.ZodLiteral<"imageBinaryPart">;
|
|
189
|
+
data: z.ZodString;
|
|
190
|
+
mimeType: z.ZodString;
|
|
191
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
192
|
+
id: z.ZodString;
|
|
193
|
+
type: z.ZodLiteral<"fileUrlPart">;
|
|
194
|
+
url: z.ZodString;
|
|
195
|
+
mimeType: z.ZodString;
|
|
196
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
197
|
+
id: z.ZodString;
|
|
198
|
+
type: z.ZodLiteral<"fileInlinePart">;
|
|
199
|
+
encodedData: z.ZodString;
|
|
200
|
+
mimeType: z.ZodString;
|
|
201
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
202
|
+
id: z.ZodString;
|
|
203
|
+
type: z.ZodLiteral<"fileBinaryPart">;
|
|
204
|
+
data: z.ZodString;
|
|
205
|
+
mimeType: z.ZodString;
|
|
206
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
207
|
+
id: z.ZodString;
|
|
208
|
+
type: z.ZodLiteral<"toolCallPart">;
|
|
209
|
+
toolCallId: z.ZodString;
|
|
210
|
+
toolName: z.ZodString;
|
|
211
|
+
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
212
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
213
|
+
id: z.ZodString;
|
|
214
|
+
type: z.ZodLiteral<"toolResultPart">;
|
|
215
|
+
toolCallId: z.ZodString;
|
|
216
|
+
toolName: z.ZodString;
|
|
217
|
+
contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
218
|
+
id: z.ZodString;
|
|
219
|
+
type: z.ZodLiteral<"textPart">;
|
|
220
|
+
text: z.ZodString;
|
|
221
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
222
|
+
id: z.ZodString;
|
|
223
|
+
type: z.ZodLiteral<"imageInlinePart">;
|
|
224
|
+
encodedData: z.ZodString;
|
|
225
|
+
mimeType: z.ZodString;
|
|
226
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
227
|
+
id: z.ZodString;
|
|
228
|
+
type: z.ZodLiteral<"fileInlinePart">;
|
|
229
|
+
encodedData: z.ZodString;
|
|
230
|
+
mimeType: z.ZodString;
|
|
231
|
+
}, z.core.$strip>]>>;
|
|
232
|
+
isError: z.ZodOptional<z.ZodBoolean>;
|
|
233
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
234
|
+
id: z.ZodString;
|
|
235
|
+
type: z.ZodLiteral<"thinkingPart">;
|
|
236
|
+
thinking: z.ZodString;
|
|
237
|
+
signature: z.ZodOptional<z.ZodString>;
|
|
238
|
+
}, z.core.$strip>], "type">;
|
|
239
|
+
//# sourceMappingURL=message-part.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-part.d.ts","sourceRoot":"","sources":["../../../src/schemas/message-part.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,kDAAkD;AAClD,MAAM,WAAW,QAAQ;IACvB,sCAAsC;IACtC,EAAE,EAAE,MAAM,CAAA;CAC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,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;iBAM/B,CAAA;AAGF,sCAAsC;AACtC,MAAM,MAAM,WAAW,GACnB,QAAQ,GACR,YAAY,GACZ,eAAe,GACf,eAAe,GACf,WAAW,GACX,cAAc,GACd,cAAc,GACd,YAAY,GACZ,cAAc,GACd,YAAY,CAAA;AAEhB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAW5B,CAAA"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const basePartSchema = z.object({
|
|
3
|
+
id: z.string(),
|
|
4
|
+
});
|
|
5
|
+
basePartSchema;
|
|
6
|
+
export const textPartSchema = basePartSchema.extend({
|
|
7
|
+
type: z.literal("textPart"),
|
|
8
|
+
text: z.string(),
|
|
9
|
+
});
|
|
10
|
+
textPartSchema;
|
|
11
|
+
export const imageUrlPartSchema = basePartSchema.extend({
|
|
12
|
+
type: z.literal("imageUrlPart"),
|
|
13
|
+
url: z.url(),
|
|
14
|
+
mimeType: z.string(),
|
|
15
|
+
});
|
|
16
|
+
imageUrlPartSchema;
|
|
17
|
+
export const imageInlinePartSchema = basePartSchema.extend({
|
|
18
|
+
type: z.literal("imageInlinePart"),
|
|
19
|
+
encodedData: z.string(),
|
|
20
|
+
mimeType: z.string(),
|
|
21
|
+
});
|
|
22
|
+
imageInlinePartSchema;
|
|
23
|
+
export const imageBinaryPartSchema = basePartSchema.extend({
|
|
24
|
+
type: z.literal("imageBinaryPart"),
|
|
25
|
+
data: z.string(),
|
|
26
|
+
mimeType: z.string(),
|
|
27
|
+
});
|
|
28
|
+
imageBinaryPartSchema;
|
|
29
|
+
export const fileUrlPartSchema = basePartSchema.extend({
|
|
30
|
+
type: z.literal("fileUrlPart"),
|
|
31
|
+
url: z.string().url(),
|
|
32
|
+
mimeType: z.string(),
|
|
33
|
+
});
|
|
34
|
+
fileUrlPartSchema;
|
|
35
|
+
export const fileInlinePartSchema = basePartSchema.extend({
|
|
36
|
+
type: z.literal("fileInlinePart"),
|
|
37
|
+
encodedData: z.string(),
|
|
38
|
+
mimeType: z.string(),
|
|
39
|
+
});
|
|
40
|
+
fileInlinePartSchema;
|
|
41
|
+
export const fileBinaryPartSchema = basePartSchema.extend({
|
|
42
|
+
type: z.literal("fileBinaryPart"),
|
|
43
|
+
data: z.string(),
|
|
44
|
+
mimeType: z.string(),
|
|
45
|
+
});
|
|
46
|
+
fileBinaryPartSchema;
|
|
47
|
+
export const toolCallPartSchema = basePartSchema.extend({
|
|
48
|
+
type: z.literal("toolCallPart"),
|
|
49
|
+
toolCallId: z.string(),
|
|
50
|
+
toolName: z.string(),
|
|
51
|
+
args: z.record(z.string(), z.unknown()),
|
|
52
|
+
});
|
|
53
|
+
toolCallPartSchema;
|
|
54
|
+
export const thinkingPartSchema = basePartSchema.extend({
|
|
55
|
+
type: z.literal("thinkingPart"),
|
|
56
|
+
thinking: z.string(),
|
|
57
|
+
signature: z.string().optional(),
|
|
58
|
+
});
|
|
59
|
+
thinkingPartSchema;
|
|
60
|
+
export const toolResultPartSchema = basePartSchema.extend({
|
|
61
|
+
type: z.literal("toolResultPart"),
|
|
62
|
+
toolCallId: z.string(),
|
|
63
|
+
toolName: z.string(),
|
|
64
|
+
contents: z.array(z.union([textPartSchema, imageInlinePartSchema, fileInlinePartSchema])),
|
|
65
|
+
isError: z.boolean().optional(),
|
|
66
|
+
});
|
|
67
|
+
toolResultPartSchema;
|
|
68
|
+
export const messagePartSchema = z.discriminatedUnion("type", [
|
|
69
|
+
textPartSchema,
|
|
70
|
+
imageUrlPartSchema,
|
|
71
|
+
imageInlinePartSchema,
|
|
72
|
+
imageBinaryPartSchema,
|
|
73
|
+
fileUrlPartSchema,
|
|
74
|
+
fileInlinePartSchema,
|
|
75
|
+
fileBinaryPartSchema,
|
|
76
|
+
toolCallPartSchema,
|
|
77
|
+
toolResultPartSchema,
|
|
78
|
+
thinkingPartSchema,
|
|
79
|
+
]);
|
|
80
|
+
//# sourceMappingURL=message-part.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-part.js","sourceRoot":"","sources":["../../../src/schemas/message-part.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAQvB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;CACf,CAAC,CAAA;AACF,cAA4C,CAAA;AAS5C,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC,MAAM,CAAC;IAClD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IAC3B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;CACjB,CAAC,CAAA;AACF,cAA4C,CAAA;AAW5C,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAC,MAAM,CAAC;IACtD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;IAC/B,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE;IACZ,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;CACrB,CAAC,CAAA;AACF,kBAAoD,CAAA;AAWpD,MAAM,CAAC,MAAM,qBAAqB,GAAG,cAAc,CAAC,MAAM,CAAC;IACzD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC;IAClC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;CACrB,CAAC,CAAA;AACF,qBAA0D,CAAA;AAW1D,MAAM,CAAC,MAAM,qBAAqB,GAAG,cAAc,CAAC,MAAM,CAAC;IACzD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC;IAClC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,CAAC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C,CAAC,OAAO,CAAC,cAAc,CAAC;IAC/B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAA;AACF,kBAAoD,CAAA;AAepD,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAAC,MAAM,CAAC;IACxD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC;IACjC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,cAAc,EAAE,qBAAqB,EAAE,oBAAoB,CAAC,CAAC,CAAC;IACzF,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAA;AACF,oBAAwD,CAAA;AAexD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC5D,cAAc;IACd,kBAAkB;IAClB,qBAAqB;IACrB,qBAAqB;IACrB,iBAAiB;IACjB,oBAAoB;IACpB,oBAAoB;IACpB,kBAAkB;IAClB,oBAAoB;IACpB,kBAAkB;CACnB,CAAC,CAAA"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { FileBinaryPart, FileInlinePart, FileUrlPart, ImageBinaryPart, ImageInlinePart, ImageUrlPart, TextPart, ThinkingPart, ToolCallPart, ToolResultPart } from "./message-part.js";
|
|
3
|
+
/** Base properties shared by all messages */
|
|
4
|
+
interface BaseMessage {
|
|
5
|
+
/** Unique identifier for this message */
|
|
6
|
+
id: string;
|
|
7
|
+
}
|
|
8
|
+
/** System instruction message sent at the start of a conversation */
|
|
9
|
+
export interface InstructionMessage extends BaseMessage {
|
|
10
|
+
type: "instructionMessage";
|
|
11
|
+
/** Text content of the instruction */
|
|
12
|
+
contents: TextPart[];
|
|
13
|
+
/** Whether to cache this message for prompt caching */
|
|
14
|
+
cache?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare const instructionMessageSchema: z.ZodObject<{
|
|
17
|
+
id: z.ZodString;
|
|
18
|
+
type: z.ZodLiteral<"instructionMessage">;
|
|
19
|
+
contents: z.ZodArray<z.ZodObject<{
|
|
20
|
+
id: z.ZodString;
|
|
21
|
+
type: z.ZodLiteral<"textPart">;
|
|
22
|
+
text: z.ZodString;
|
|
23
|
+
}, z.core.$strip>>;
|
|
24
|
+
cache: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
/** Message from the user (human or system providing input) */
|
|
27
|
+
export interface UserMessage extends BaseMessage {
|
|
28
|
+
type: "userMessage";
|
|
29
|
+
/** Content of the user message (text, images, or files) */
|
|
30
|
+
contents: (TextPart | ImageUrlPart | ImageInlinePart | ImageBinaryPart | FileUrlPart | FileInlinePart | FileBinaryPart)[];
|
|
31
|
+
/** Whether to cache this message for prompt caching */
|
|
32
|
+
cache?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare const userMessageSchema: z.ZodObject<{
|
|
35
|
+
id: z.ZodString;
|
|
36
|
+
type: z.ZodLiteral<"userMessage">;
|
|
37
|
+
contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
38
|
+
id: z.ZodString;
|
|
39
|
+
type: z.ZodLiteral<"textPart">;
|
|
40
|
+
text: z.ZodString;
|
|
41
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
42
|
+
id: z.ZodString;
|
|
43
|
+
type: z.ZodLiteral<"imageUrlPart">;
|
|
44
|
+
url: z.ZodURL;
|
|
45
|
+
mimeType: z.ZodString;
|
|
46
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
47
|
+
id: z.ZodString;
|
|
48
|
+
type: z.ZodLiteral<"imageInlinePart">;
|
|
49
|
+
encodedData: z.ZodString;
|
|
50
|
+
mimeType: z.ZodString;
|
|
51
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
52
|
+
id: z.ZodString;
|
|
53
|
+
type: z.ZodLiteral<"imageBinaryPart">;
|
|
54
|
+
data: z.ZodString;
|
|
55
|
+
mimeType: z.ZodString;
|
|
56
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
57
|
+
id: z.ZodString;
|
|
58
|
+
type: z.ZodLiteral<"fileUrlPart">;
|
|
59
|
+
url: z.ZodString;
|
|
60
|
+
mimeType: z.ZodString;
|
|
61
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
62
|
+
id: z.ZodString;
|
|
63
|
+
type: z.ZodLiteral<"fileInlinePart">;
|
|
64
|
+
encodedData: z.ZodString;
|
|
65
|
+
mimeType: z.ZodString;
|
|
66
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
67
|
+
id: z.ZodString;
|
|
68
|
+
type: z.ZodLiteral<"fileBinaryPart">;
|
|
69
|
+
data: z.ZodString;
|
|
70
|
+
mimeType: z.ZodString;
|
|
71
|
+
}, z.core.$strip>]>>;
|
|
72
|
+
cache: z.ZodOptional<z.ZodBoolean>;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
/** Message generated by the Expert (LLM response) */
|
|
75
|
+
export interface ExpertMessage extends BaseMessage {
|
|
76
|
+
type: "expertMessage";
|
|
77
|
+
/** Content generated by the Expert (text, tool calls, or thinking) */
|
|
78
|
+
contents: (TextPart | ToolCallPart | ThinkingPart)[];
|
|
79
|
+
/** Whether to cache this message for prompt caching */
|
|
80
|
+
cache?: boolean;
|
|
81
|
+
}
|
|
82
|
+
export declare const expertMessageSchema: z.ZodObject<{
|
|
83
|
+
id: z.ZodString;
|
|
84
|
+
type: z.ZodLiteral<"expertMessage">;
|
|
85
|
+
contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
86
|
+
id: z.ZodString;
|
|
87
|
+
type: z.ZodLiteral<"textPart">;
|
|
88
|
+
text: z.ZodString;
|
|
89
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
90
|
+
id: z.ZodString;
|
|
91
|
+
type: z.ZodLiteral<"toolCallPart">;
|
|
92
|
+
toolCallId: z.ZodString;
|
|
93
|
+
toolName: z.ZodString;
|
|
94
|
+
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
95
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
96
|
+
id: z.ZodString;
|
|
97
|
+
type: z.ZodLiteral<"thinkingPart">;
|
|
98
|
+
thinking: z.ZodString;
|
|
99
|
+
signature: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}, z.core.$strip>]>>;
|
|
101
|
+
cache: z.ZodOptional<z.ZodBoolean>;
|
|
102
|
+
}, z.core.$strip>;
|
|
103
|
+
/** Message containing tool execution results */
|
|
104
|
+
export interface ToolMessage extends BaseMessage {
|
|
105
|
+
type: "toolMessage";
|
|
106
|
+
/** Tool result contents */
|
|
107
|
+
contents: ToolResultPart[];
|
|
108
|
+
/** Whether to cache this message for prompt caching */
|
|
109
|
+
cache?: boolean;
|
|
110
|
+
}
|
|
111
|
+
export declare const toolMessageSchema: z.ZodObject<{
|
|
112
|
+
id: z.ZodString;
|
|
113
|
+
type: z.ZodLiteral<"toolMessage">;
|
|
114
|
+
contents: z.ZodArray<z.ZodObject<{
|
|
115
|
+
id: z.ZodString;
|
|
116
|
+
type: z.ZodLiteral<"toolResultPart">;
|
|
117
|
+
toolCallId: z.ZodString;
|
|
118
|
+
toolName: z.ZodString;
|
|
119
|
+
contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
120
|
+
id: z.ZodString;
|
|
121
|
+
type: z.ZodLiteral<"textPart">;
|
|
122
|
+
text: z.ZodString;
|
|
123
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
124
|
+
id: z.ZodString;
|
|
125
|
+
type: z.ZodLiteral<"imageInlinePart">;
|
|
126
|
+
encodedData: z.ZodString;
|
|
127
|
+
mimeType: z.ZodString;
|
|
128
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
129
|
+
id: z.ZodString;
|
|
130
|
+
type: z.ZodLiteral<"fileInlinePart">;
|
|
131
|
+
encodedData: z.ZodString;
|
|
132
|
+
mimeType: z.ZodString;
|
|
133
|
+
}, z.core.$strip>]>>;
|
|
134
|
+
isError: z.ZodOptional<z.ZodBoolean>;
|
|
135
|
+
}, z.core.$strip>>;
|
|
136
|
+
cache: z.ZodOptional<z.ZodBoolean>;
|
|
137
|
+
}, z.core.$strip>;
|
|
138
|
+
/** All possible message types */
|
|
139
|
+
export type Message = InstructionMessage | UserMessage | ExpertMessage | ToolMessage;
|
|
140
|
+
export declare const messageSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
141
|
+
id: z.ZodString;
|
|
142
|
+
type: z.ZodLiteral<"instructionMessage">;
|
|
143
|
+
contents: z.ZodArray<z.ZodObject<{
|
|
144
|
+
id: z.ZodString;
|
|
145
|
+
type: z.ZodLiteral<"textPart">;
|
|
146
|
+
text: z.ZodString;
|
|
147
|
+
}, z.core.$strip>>;
|
|
148
|
+
cache: z.ZodOptional<z.ZodBoolean>;
|
|
149
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
150
|
+
id: z.ZodString;
|
|
151
|
+
type: z.ZodLiteral<"userMessage">;
|
|
152
|
+
contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
153
|
+
id: z.ZodString;
|
|
154
|
+
type: z.ZodLiteral<"textPart">;
|
|
155
|
+
text: z.ZodString;
|
|
156
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
157
|
+
id: z.ZodString;
|
|
158
|
+
type: z.ZodLiteral<"imageUrlPart">;
|
|
159
|
+
url: z.ZodURL;
|
|
160
|
+
mimeType: z.ZodString;
|
|
161
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
162
|
+
id: z.ZodString;
|
|
163
|
+
type: z.ZodLiteral<"imageInlinePart">;
|
|
164
|
+
encodedData: z.ZodString;
|
|
165
|
+
mimeType: z.ZodString;
|
|
166
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
167
|
+
id: z.ZodString;
|
|
168
|
+
type: z.ZodLiteral<"imageBinaryPart">;
|
|
169
|
+
data: z.ZodString;
|
|
170
|
+
mimeType: z.ZodString;
|
|
171
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
172
|
+
id: z.ZodString;
|
|
173
|
+
type: z.ZodLiteral<"fileUrlPart">;
|
|
174
|
+
url: z.ZodString;
|
|
175
|
+
mimeType: z.ZodString;
|
|
176
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
177
|
+
id: z.ZodString;
|
|
178
|
+
type: z.ZodLiteral<"fileInlinePart">;
|
|
179
|
+
encodedData: z.ZodString;
|
|
180
|
+
mimeType: z.ZodString;
|
|
181
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
182
|
+
id: z.ZodString;
|
|
183
|
+
type: z.ZodLiteral<"fileBinaryPart">;
|
|
184
|
+
data: z.ZodString;
|
|
185
|
+
mimeType: z.ZodString;
|
|
186
|
+
}, z.core.$strip>]>>;
|
|
187
|
+
cache: z.ZodOptional<z.ZodBoolean>;
|
|
188
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
189
|
+
id: z.ZodString;
|
|
190
|
+
type: z.ZodLiteral<"expertMessage">;
|
|
191
|
+
contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
192
|
+
id: z.ZodString;
|
|
193
|
+
type: z.ZodLiteral<"textPart">;
|
|
194
|
+
text: z.ZodString;
|
|
195
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
196
|
+
id: z.ZodString;
|
|
197
|
+
type: z.ZodLiteral<"toolCallPart">;
|
|
198
|
+
toolCallId: z.ZodString;
|
|
199
|
+
toolName: z.ZodString;
|
|
200
|
+
args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
201
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
202
|
+
id: z.ZodString;
|
|
203
|
+
type: z.ZodLiteral<"thinkingPart">;
|
|
204
|
+
thinking: z.ZodString;
|
|
205
|
+
signature: z.ZodOptional<z.ZodString>;
|
|
206
|
+
}, z.core.$strip>]>>;
|
|
207
|
+
cache: z.ZodOptional<z.ZodBoolean>;
|
|
208
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
209
|
+
id: z.ZodString;
|
|
210
|
+
type: z.ZodLiteral<"toolMessage">;
|
|
211
|
+
contents: z.ZodArray<z.ZodObject<{
|
|
212
|
+
id: z.ZodString;
|
|
213
|
+
type: z.ZodLiteral<"toolResultPart">;
|
|
214
|
+
toolCallId: z.ZodString;
|
|
215
|
+
toolName: z.ZodString;
|
|
216
|
+
contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
217
|
+
id: z.ZodString;
|
|
218
|
+
type: z.ZodLiteral<"textPart">;
|
|
219
|
+
text: z.ZodString;
|
|
220
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
221
|
+
id: z.ZodString;
|
|
222
|
+
type: z.ZodLiteral<"imageInlinePart">;
|
|
223
|
+
encodedData: z.ZodString;
|
|
224
|
+
mimeType: z.ZodString;
|
|
225
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
226
|
+
id: z.ZodString;
|
|
227
|
+
type: z.ZodLiteral<"fileInlinePart">;
|
|
228
|
+
encodedData: z.ZodString;
|
|
229
|
+
mimeType: z.ZodString;
|
|
230
|
+
}, z.core.$strip>]>>;
|
|
231
|
+
isError: z.ZodOptional<z.ZodBoolean>;
|
|
232
|
+
}, z.core.$strip>>;
|
|
233
|
+
cache: z.ZodOptional<z.ZodBoolean>;
|
|
234
|
+
}, z.core.$strip>]>;
|
|
235
|
+
export {};
|
|
236
|
+
//# sourceMappingURL=message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/schemas/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,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EAAE,cAAc,EAAE,CAAA;IAC1B,uDAAuD;IACvD,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;iBAI5B,CAAA;AAGF,iCAAiC;AACjC,MAAM,MAAM,OAAO,GAAG,kBAAkB,GAAG,WAAW,GAAG,aAAa,GAAG,WAAW,CAAA;AAEpF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAKxB,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { fileBinaryPartSchema, fileInlinePartSchema, fileUrlPartSchema, imageBinaryPartSchema, imageInlinePartSchema, imageUrlPartSchema, textPartSchema, thinkingPartSchema, toolCallPartSchema, toolResultPartSchema, } from "./message-part.js";
|
|
3
|
+
const baseMessageSchema = z.object({
|
|
4
|
+
id: z.string(),
|
|
5
|
+
});
|
|
6
|
+
export const instructionMessageSchema = baseMessageSchema.extend({
|
|
7
|
+
type: z.literal("instructionMessage"),
|
|
8
|
+
contents: z.array(textPartSchema),
|
|
9
|
+
cache: z.boolean().optional(),
|
|
10
|
+
});
|
|
11
|
+
instructionMessageSchema;
|
|
12
|
+
export const userMessageSchema = baseMessageSchema.extend({
|
|
13
|
+
type: z.literal("userMessage"),
|
|
14
|
+
contents: z.array(z.union([
|
|
15
|
+
textPartSchema,
|
|
16
|
+
imageUrlPartSchema,
|
|
17
|
+
imageInlinePartSchema,
|
|
18
|
+
imageBinaryPartSchema,
|
|
19
|
+
fileUrlPartSchema,
|
|
20
|
+
fileInlinePartSchema,
|
|
21
|
+
fileBinaryPartSchema,
|
|
22
|
+
])),
|
|
23
|
+
cache: z.boolean().optional(),
|
|
24
|
+
});
|
|
25
|
+
userMessageSchema;
|
|
26
|
+
export const expertMessageSchema = baseMessageSchema.extend({
|
|
27
|
+
type: z.literal("expertMessage"),
|
|
28
|
+
contents: z.array(z.union([textPartSchema, toolCallPartSchema, thinkingPartSchema])),
|
|
29
|
+
cache: z.boolean().optional(),
|
|
30
|
+
});
|
|
31
|
+
expertMessageSchema;
|
|
32
|
+
export const toolMessageSchema = baseMessageSchema.extend({
|
|
33
|
+
type: z.literal("toolMessage"),
|
|
34
|
+
contents: z.array(toolResultPartSchema),
|
|
35
|
+
cache: z.boolean().optional(),
|
|
36
|
+
});
|
|
37
|
+
toolMessageSchema;
|
|
38
|
+
export const messageSchema = z.union([
|
|
39
|
+
instructionMessageSchema,
|
|
40
|
+
userMessageSchema,
|
|
41
|
+
expertMessageSchema,
|
|
42
|
+
toolMessageSchema,
|
|
43
|
+
]);
|
|
44
|
+
//# sourceMappingURL=message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/schemas/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAavB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,mBAAmB,CAAA;AAQ1B,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;CACf,CAAC,CAAA;AAWF,MAAM,CAAC,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,MAAM,CAAC;IAC/D,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC;IACrC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC;IACjC,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAA;AACF,wBAAgE,CAAA;AA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