@cloudbase/agent-shared 0.0.2
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 +406 -0
- package/dist/index.d.mts +127 -0
- package/dist/index.d.ts +127 -0
- package/dist/index.js +138 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +95 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +32 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
# @cloudbase/agent-shared
|
|
2
|
+
|
|
3
|
+
## 0.0.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- stable release 0.0.10
|
|
8
|
+
- Update all public packages to version 0.0.10
|
|
9
|
+
- Trigger automated stable release workflow
|
|
10
|
+
- Includes latest features and improvements
|
|
11
|
+
|
|
12
|
+
## 0.0.10-alpha.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- alpha release 0.0.9-alpha.3
|
|
17
|
+
- Update all public packages to version 0.0.9-alpha.3
|
|
18
|
+
- Trigger automated alpha release workflow
|
|
19
|
+
- Includes latest features and improvements
|
|
20
|
+
|
|
21
|
+
## 0.0.10-alpha.0
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- alpha release 0.0.9-alpha.3
|
|
26
|
+
- Update all public packages to version 0.0.9-alpha.3
|
|
27
|
+
- Trigger automated alpha release workflow
|
|
28
|
+
- Includes latest features and improvements
|
|
29
|
+
|
|
30
|
+
## 0.0.9
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- stable release 0.0.9
|
|
35
|
+
- Update all public packages to version 0.0.9
|
|
36
|
+
- Trigger automated stable release workflow
|
|
37
|
+
- Includes latest features and improvements
|
|
38
|
+
|
|
39
|
+
## 0.0.9-alpha.2
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- alpha release 0.0.8-alpha.1
|
|
44
|
+
- Update all public packages to version 0.0.8-alpha.1
|
|
45
|
+
- Trigger automated alpha release workflow
|
|
46
|
+
- Includes latest features and improvements
|
|
47
|
+
|
|
48
|
+
## 0.0.9-alpha.1
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- alpha release 0.0.8-alpha.1
|
|
53
|
+
- Update all public packages to version 0.0.8-alpha.1
|
|
54
|
+
- Trigger automated alpha release workflow
|
|
55
|
+
- Includes latest features and improvements
|
|
56
|
+
|
|
57
|
+
## 0.0.9-alpha.0
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- alpha release 0.0.8-alpha.1
|
|
62
|
+
- Update all public packages to version 0.0.8-alpha.1
|
|
63
|
+
- Trigger automated alpha release workflow
|
|
64
|
+
- Includes latest features and improvements
|
|
65
|
+
|
|
66
|
+
## 0.0.8
|
|
67
|
+
|
|
68
|
+
### Patch Changes
|
|
69
|
+
|
|
70
|
+
- stable release 0.0.8
|
|
71
|
+
- Update all public packages to version 0.0.8
|
|
72
|
+
- Trigger automated stable release workflow
|
|
73
|
+
- Includes latest features and improvements
|
|
74
|
+
|
|
75
|
+
## 0.0.4-alpha.0
|
|
76
|
+
|
|
77
|
+
### Patch Changes
|
|
78
|
+
|
|
79
|
+
- alpha release 0.0.7-alpha.1
|
|
80
|
+
- Update all public packages to version 0.0.7-alpha.1
|
|
81
|
+
- Trigger automated alpha release workflow
|
|
82
|
+
- Includes latest features and improvements
|
|
83
|
+
|
|
84
|
+
## 0.0.0-alpha-20251103123845
|
|
85
|
+
|
|
86
|
+
### Patch Changes
|
|
87
|
+
|
|
88
|
+
- alpha release 0.0.7-alpha.1
|
|
89
|
+
- Update all public packages to version 0.0.7-alpha.1
|
|
90
|
+
- Trigger automated alpha release workflow
|
|
91
|
+
- Includes latest features and improvements
|
|
92
|
+
|
|
93
|
+
## 0.0.5
|
|
94
|
+
|
|
95
|
+
### Patch Changes
|
|
96
|
+
|
|
97
|
+
- stable release 0.0.7
|
|
98
|
+
- Update all public packages to version 0.0.7
|
|
99
|
+
- Trigger automated stable release workflow
|
|
100
|
+
- Includes latest features and improvements
|
|
101
|
+
|
|
102
|
+
## 0.0.4
|
|
103
|
+
|
|
104
|
+
### Patch Changes
|
|
105
|
+
|
|
106
|
+
- stable release 0.0.6
|
|
107
|
+
- Update all public packages to version 0.0.6
|
|
108
|
+
- Trigger automated stable release workflow
|
|
109
|
+
- Includes latest features and improvements
|
|
110
|
+
|
|
111
|
+
## 0.0.0-alpha-20251030080320
|
|
112
|
+
|
|
113
|
+
### Patch Changes
|
|
114
|
+
|
|
115
|
+
- alpha release 0.0.5-alpha.7
|
|
116
|
+
- Update all public packages to version 0.0.5-alpha.7
|
|
117
|
+
- Trigger automated alpha release workflow
|
|
118
|
+
- Includes latest features and improvements
|
|
119
|
+
|
|
120
|
+
## 0.0.0-alpha-20251028115618
|
|
121
|
+
|
|
122
|
+
### Patch Changes
|
|
123
|
+
|
|
124
|
+
- alpha release 0.0.5-alpha.6
|
|
125
|
+
- Update all public packages to version 0.0.5-alpha.6
|
|
126
|
+
- Trigger automated alpha release workflow
|
|
127
|
+
- Includes latest features and improvements
|
|
128
|
+
|
|
129
|
+
## 0.0.0-alpha-20251028114708
|
|
130
|
+
|
|
131
|
+
### Patch Changes
|
|
132
|
+
|
|
133
|
+
- alpha release 0.0.5-alpha.5
|
|
134
|
+
- Update all public packages to version 0.0.5-alpha.5
|
|
135
|
+
- Trigger automated alpha release workflow
|
|
136
|
+
- Includes latest features and improvements
|
|
137
|
+
|
|
138
|
+
## 0.0.0-alpha-20251027092338
|
|
139
|
+
|
|
140
|
+
### Patch Changes
|
|
141
|
+
|
|
142
|
+
- alpha release 0.0.5-alpha.4
|
|
143
|
+
- Update all public packages to version 0.0.5-alpha.4
|
|
144
|
+
- Trigger automated alpha release workflow
|
|
145
|
+
- Includes latest features and improvements
|
|
146
|
+
|
|
147
|
+
## 0.0.0-alpha-20251027092045
|
|
148
|
+
|
|
149
|
+
### Patch Changes
|
|
150
|
+
|
|
151
|
+
- alpha release 0.0.5-alpha.3
|
|
152
|
+
- Update all public packages to version 0.0.5-alpha.3
|
|
153
|
+
- Trigger automated alpha release workflow
|
|
154
|
+
- Includes latest features and improvements
|
|
155
|
+
|
|
156
|
+
## 0.0.0-alpha-20251024113345
|
|
157
|
+
|
|
158
|
+
### Patch Changes
|
|
159
|
+
|
|
160
|
+
- alpha release 0.0.5-alpha.2
|
|
161
|
+
- Update all public packages to version 0.0.5-alpha.2
|
|
162
|
+
- Trigger automated alpha release workflow
|
|
163
|
+
- Includes latest features and improvements
|
|
164
|
+
|
|
165
|
+
## 0.0.0-alpha-20251024090137
|
|
166
|
+
|
|
167
|
+
### Patch Changes
|
|
168
|
+
|
|
169
|
+
- alpha release 0.0.5-alpha.1
|
|
170
|
+
- Update all public packages to version 0.0.5-alpha.1
|
|
171
|
+
- Trigger automated alpha release workflow
|
|
172
|
+
- Includes latest features and improvements
|
|
173
|
+
|
|
174
|
+
## 0.0.0-alpha-20251024085927
|
|
175
|
+
|
|
176
|
+
### Patch Changes
|
|
177
|
+
|
|
178
|
+
- alpha release 0.0.1-alpha.18
|
|
179
|
+
- Update all public packages to version 0.0.1-alpha.18
|
|
180
|
+
- Trigger automated alpha release workflow
|
|
181
|
+
- Includes latest features and improvements
|
|
182
|
+
|
|
183
|
+
## 0.0.0-alpha-20251023135253
|
|
184
|
+
|
|
185
|
+
### Patch Changes
|
|
186
|
+
|
|
187
|
+
- Alpha release with latest features and improvements
|
|
188
|
+
- Update all public packages to alpha version
|
|
189
|
+
- Include playground preview enhancements
|
|
190
|
+
- Add Python Server deployment support
|
|
191
|
+
- Include Mastra framework examples
|
|
192
|
+
- Trigger automated alpha release workflow
|
|
193
|
+
|
|
194
|
+
## 0.0.0-alpha-20251023135056
|
|
195
|
+
|
|
196
|
+
### Patch Changes
|
|
197
|
+
|
|
198
|
+
- Alpha release with latest features and improvements
|
|
199
|
+
- Update all public packages to alpha version
|
|
200
|
+
- Include playground preview enhancements
|
|
201
|
+
- Add Python Server deployment support
|
|
202
|
+
- Trigger automated alpha release workflow
|
|
203
|
+
|
|
204
|
+
- 579f801: Stable release with latest features and improvements
|
|
205
|
+
- Update all public packages to stable version
|
|
206
|
+
- Include playground preview enhancements
|
|
207
|
+
- Add new playground examples
|
|
208
|
+
- Trigger automated stable release workflow
|
|
209
|
+
|
|
210
|
+
## 0.0.4
|
|
211
|
+
|
|
212
|
+
### Patch Changes
|
|
213
|
+
|
|
214
|
+
- Stable release with latest features and improvements
|
|
215
|
+
- Update all public packages to stable version
|
|
216
|
+
- Include playground preview enhancements
|
|
217
|
+
- Add new playground examples
|
|
218
|
+
- Trigger automated stable release workflow
|
|
219
|
+
|
|
220
|
+
## 0.0.0-alpha-20251023125455
|
|
221
|
+
|
|
222
|
+
### Patch Changes
|
|
223
|
+
|
|
224
|
+
- Alpha release with latest features and improvements
|
|
225
|
+
- Update all public packages to alpha version
|
|
226
|
+
- Include playground preview enhancements
|
|
227
|
+
- Add new playground examples
|
|
228
|
+
- Trigger automated alpha release workflow
|
|
229
|
+
|
|
230
|
+
## 0.0.0-alpha-20251023125311
|
|
231
|
+
|
|
232
|
+
### Patch Changes
|
|
233
|
+
|
|
234
|
+
- Alpha release with latest features and improvements
|
|
235
|
+
- Update all public packages to alpha version
|
|
236
|
+
- Include playground preview enhancements
|
|
237
|
+
- Add new playground examples (LlamaIndex, Mastra)
|
|
238
|
+
- Fix workspace configuration for new packages
|
|
239
|
+
- Trigger automated alpha release workflow
|
|
240
|
+
|
|
241
|
+
## 0.0.2
|
|
242
|
+
|
|
243
|
+
### Patch Changes
|
|
244
|
+
|
|
245
|
+
- stable release 0.0.3
|
|
246
|
+
- Update all public packages to version 0.0.3
|
|
247
|
+
- Trigger automated stable release workflow
|
|
248
|
+
- Includes latest features and improvements
|
|
249
|
+
|
|
250
|
+
## 0.0.0-alpha-20251023094104
|
|
251
|
+
|
|
252
|
+
### Patch Changes
|
|
253
|
+
|
|
254
|
+
- alpha release 0.0.1-alpha.14
|
|
255
|
+
- Update all public packages to version 0.0.1-alpha.14
|
|
256
|
+
- Trigger automated alpha release workflow
|
|
257
|
+
- Includes latest features and improvements
|
|
258
|
+
|
|
259
|
+
## 0.0.0-alpha-20251023093942
|
|
260
|
+
|
|
261
|
+
### Patch Changes
|
|
262
|
+
|
|
263
|
+
- alpha release 0.0.1-alpha.13
|
|
264
|
+
- Update all public packages to version 0.0.1-alpha.13
|
|
265
|
+
- Trigger automated alpha release workflow
|
|
266
|
+
- Includes latest features and improvements
|
|
267
|
+
|
|
268
|
+
## 0.0.2
|
|
269
|
+
|
|
270
|
+
### Patch Changes
|
|
271
|
+
|
|
272
|
+
- stable release 0.0.2
|
|
273
|
+
- Update all public packages to version 0.0.2
|
|
274
|
+
- Trigger automated stable release workflow
|
|
275
|
+
- Includes latest features and improvements
|
|
276
|
+
|
|
277
|
+
## 0.0.0-alpha-20251023054807
|
|
278
|
+
|
|
279
|
+
### Patch Changes
|
|
280
|
+
|
|
281
|
+
- alpha release 0.0.1-alpha.12
|
|
282
|
+
- Update all public packages to version 0.0.1-alpha.12
|
|
283
|
+
- Trigger automated alpha release workflow
|
|
284
|
+
- Includes latest features and improvements
|
|
285
|
+
|
|
286
|
+
## 0.0.0-alpha-20251023054737
|
|
287
|
+
|
|
288
|
+
### Patch Changes
|
|
289
|
+
|
|
290
|
+
- Alpha release with latest features and improvements including MCP knowledge retrieval examples and configuration validation fixes.
|
|
291
|
+
|
|
292
|
+
## 0.0.2
|
|
293
|
+
|
|
294
|
+
### Patch Changes
|
|
295
|
+
|
|
296
|
+
- stable release 0.0.1
|
|
297
|
+
- Update all public packages to version 0.0.1
|
|
298
|
+
- Trigger automated stable release workflow
|
|
299
|
+
- Includes latest features and improvements
|
|
300
|
+
|
|
301
|
+
## 0.0.0-alpha-20251022083933
|
|
302
|
+
|
|
303
|
+
### Patch Changes
|
|
304
|
+
|
|
305
|
+
- alpha release 0.0.1-alpha.11
|
|
306
|
+
- Update all public packages to version 0.0.1-alpha.11
|
|
307
|
+
- Trigger automated alpha release workflow
|
|
308
|
+
- Includes latest features and improvements
|
|
309
|
+
|
|
310
|
+
## 0.0.0-alpha-20251022080712
|
|
311
|
+
|
|
312
|
+
### Patch Changes
|
|
313
|
+
|
|
314
|
+
- Alpha release 0.0.1-alpha.10
|
|
315
|
+
- Update all public packages to version 0.0.1-alpha.10
|
|
316
|
+
- Trigger automated alpha release workflow
|
|
317
|
+
- Includes latest features and improvements
|
|
318
|
+
|
|
319
|
+
## 0.0.0-alpha-20251022072016
|
|
320
|
+
|
|
321
|
+
### Patch Changes
|
|
322
|
+
|
|
323
|
+
- Alpha release with latest features and improvements
|
|
324
|
+
- Make @cloudbase/agent-example-ui-web-shared package public
|
|
325
|
+
- Update all public packages to alpha version
|
|
326
|
+
- Include shared UI components in public release
|
|
327
|
+
|
|
328
|
+
## 0.0.0-alpha-20251022071917
|
|
329
|
+
|
|
330
|
+
### Patch Changes
|
|
331
|
+
|
|
332
|
+
- Alpha release with latest features and improvements
|
|
333
|
+
- Make @cloudbase/agent-example-ui-web-shared package public
|
|
334
|
+
- Update all public packages to alpha version
|
|
335
|
+
- Include shared UI components in public release
|
|
336
|
+
|
|
337
|
+
## 0.0.0-alpha-20251022064104
|
|
338
|
+
|
|
339
|
+
### Patch Changes
|
|
340
|
+
|
|
341
|
+
- Fix alpha release versioning format
|
|
342
|
+
- Fix Changesets configuration for proper alpha versioning
|
|
343
|
+
- Reset to correct v0.0.1-alpha.X format
|
|
344
|
+
- Include recent improvements and bug fixes
|
|
345
|
+
|
|
346
|
+
## 0.0.0-alpha-20251022043017
|
|
347
|
+
|
|
348
|
+
### Patch Changes
|
|
349
|
+
|
|
350
|
+
- Alpha release with CI improvements and quickstart enhancements
|
|
351
|
+
- Remove CloudBase docs deployment from CI workflow
|
|
352
|
+
- Update quickstart guide with modern ES modules setup
|
|
353
|
+
- Add support for multiple LLM providers (OpenAI, Zhipu, Qwen, DeepSeek, Ollama)
|
|
354
|
+
- Simplify configuration and improve code examples
|
|
355
|
+
- Remove UUID validation from conversationId for flexibility
|
|
356
|
+
- Update dependencies and build scripts for better DX
|
|
357
|
+
|
|
358
|
+
## 0.0.0-alpha-20251022031106
|
|
359
|
+
|
|
360
|
+
### Patch Changes
|
|
361
|
+
|
|
362
|
+
- Alpha release with dependency updates and improvements
|
|
363
|
+
- Updated dependencies and package configurations
|
|
364
|
+
- Enhanced example configurations
|
|
365
|
+
- Bug fixes and performance improvements
|
|
366
|
+
- Improved stability and reliability
|
|
367
|
+
|
|
368
|
+
## 0.0.0-alpha-20251022025955
|
|
369
|
+
|
|
370
|
+
### Patch Changes
|
|
371
|
+
|
|
372
|
+
- Alpha release with latest features and improvements
|
|
373
|
+
- Enhanced documentation and hero section
|
|
374
|
+
- Improved framework logo integration
|
|
375
|
+
- Updated documentation standards
|
|
376
|
+
- Bug fixes and performance improvements
|
|
377
|
+
|
|
378
|
+
## 0.0.0-alpha-20251017101436
|
|
379
|
+
|
|
380
|
+
### Patch Changes
|
|
381
|
+
|
|
382
|
+
- Fix GitHub permissions and test deployment pipeline
|
|
383
|
+
|
|
384
|
+
## 0.0.0-alpha-20251017100216
|
|
385
|
+
|
|
386
|
+
### Patch Changes
|
|
387
|
+
|
|
388
|
+
- Fix GitHub Actions workflow issues and test deployment
|
|
389
|
+
|
|
390
|
+
## 0.0.0-alpha-20251017094344
|
|
391
|
+
|
|
392
|
+
### Patch Changes
|
|
393
|
+
|
|
394
|
+
- Alpha release with latest features and improvements
|
|
395
|
+
|
|
396
|
+
## 0.0.0-alpha-20251017093946
|
|
397
|
+
|
|
398
|
+
### Patch Changes
|
|
399
|
+
|
|
400
|
+
- 54e476e: Initial alpha release for testing purposes. This release includes all core AG-Kit packages and example implementations for community testing and feedback.
|
|
401
|
+
|
|
402
|
+
## 0.0.0-alpha-20251017081242
|
|
403
|
+
|
|
404
|
+
### Patch Changes
|
|
405
|
+
|
|
406
|
+
- Initial alpha release for testing purposes. This release includes all core AG-Kit packages and example implementations for community testing and feedback.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
import * as z3 from 'zod/v3';
|
|
3
|
+
import * as z4 from 'zod/v4/core';
|
|
4
|
+
|
|
5
|
+
type Schema = z3.ZodTypeAny | z4.$ZodType;
|
|
6
|
+
type ZodInfer<T> = T extends z3.ZodTypeAny ? z3.infer<T> : z4.infer<T>;
|
|
7
|
+
declare function isV4Schema(schema: Schema): schema is z4.$ZodType;
|
|
8
|
+
declare const systemMessageSchema: z.ZodObject<{
|
|
9
|
+
role: z.ZodLiteral<"system">;
|
|
10
|
+
content: z.ZodString;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
declare const userMessageSchema: z.ZodObject<{
|
|
13
|
+
role: z.ZodLiteral<"user">;
|
|
14
|
+
content: z.ZodString;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
declare const toolMessageSchema: z.ZodObject<{
|
|
17
|
+
role: z.ZodLiteral<"tool">;
|
|
18
|
+
content: z.ZodString;
|
|
19
|
+
toolCallId: z.ZodString;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
declare const assistantMessageSchema: z.ZodObject<{
|
|
22
|
+
role: z.ZodLiteral<"assistant">;
|
|
23
|
+
content: z.ZodOptional<z.ZodString>;
|
|
24
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
type: z.ZodLiteral<"function">;
|
|
27
|
+
function: z.ZodObject<{
|
|
28
|
+
name: z.ZodString;
|
|
29
|
+
arguments: z.ZodString;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
}, z.core.$strip>>>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
declare const clientMessageSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
34
|
+
role: z.ZodLiteral<"system">;
|
|
35
|
+
content: z.ZodString;
|
|
36
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
37
|
+
role: z.ZodLiteral<"user">;
|
|
38
|
+
content: z.ZodString;
|
|
39
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
40
|
+
role: z.ZodLiteral<"tool">;
|
|
41
|
+
content: z.ZodString;
|
|
42
|
+
toolCallId: z.ZodString;
|
|
43
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
44
|
+
role: z.ZodLiteral<"assistant">;
|
|
45
|
+
content: z.ZodOptional<z.ZodString>;
|
|
46
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
47
|
+
id: z.ZodString;
|
|
48
|
+
type: z.ZodLiteral<"function">;
|
|
49
|
+
function: z.ZodObject<{
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
arguments: z.ZodString;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
}, z.core.$strip>>>;
|
|
54
|
+
}, z.core.$strip>]>;
|
|
55
|
+
declare const toolSchema: z.ZodObject<{
|
|
56
|
+
name: z.ZodString;
|
|
57
|
+
description: z.ZodString;
|
|
58
|
+
parameters: z.ZodAny;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
declare const sendMessageInputSchema: z.ZodObject<{
|
|
61
|
+
conversationId: z.ZodString;
|
|
62
|
+
messages: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
63
|
+
role: z.ZodLiteral<"system">;
|
|
64
|
+
content: z.ZodString;
|
|
65
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
66
|
+
role: z.ZodLiteral<"user">;
|
|
67
|
+
content: z.ZodString;
|
|
68
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
69
|
+
role: z.ZodLiteral<"tool">;
|
|
70
|
+
content: z.ZodString;
|
|
71
|
+
toolCallId: z.ZodString;
|
|
72
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
73
|
+
role: z.ZodLiteral<"assistant">;
|
|
74
|
+
content: z.ZodOptional<z.ZodString>;
|
|
75
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
76
|
+
id: z.ZodString;
|
|
77
|
+
type: z.ZodLiteral<"function">;
|
|
78
|
+
function: z.ZodObject<{
|
|
79
|
+
name: z.ZodString;
|
|
80
|
+
arguments: z.ZodString;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
}, z.core.$strip>>>;
|
|
83
|
+
}, z.core.$strip>]>>>;
|
|
84
|
+
resume: z.ZodOptional<z.ZodObject<{
|
|
85
|
+
interruptId: z.ZodString;
|
|
86
|
+
payload: z.ZodAny;
|
|
87
|
+
}, z.core.$strip>>;
|
|
88
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
89
|
+
name: z.ZodString;
|
|
90
|
+
description: z.ZodString;
|
|
91
|
+
parameters: z.ZodAny;
|
|
92
|
+
}, z.core.$strip>>>;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
declare const sendMessageEventSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
95
|
+
type: z.ZodLiteral<"text">;
|
|
96
|
+
content: z.ZodString;
|
|
97
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
98
|
+
type: z.ZodLiteral<"tool-call-start">;
|
|
99
|
+
toolCallId: z.ZodString;
|
|
100
|
+
toolCallName: z.ZodString;
|
|
101
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
102
|
+
type: z.ZodLiteral<"tool-call-args">;
|
|
103
|
+
toolCallId: z.ZodString;
|
|
104
|
+
delta: z.ZodString;
|
|
105
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
106
|
+
type: z.ZodLiteral<"tool-call-end">;
|
|
107
|
+
toolCallId: z.ZodString;
|
|
108
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
109
|
+
type: z.ZodLiteral<"tool-result">;
|
|
110
|
+
toolCallId: z.ZodString;
|
|
111
|
+
result: z.ZodString;
|
|
112
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
113
|
+
type: z.ZodLiteral<"interrupt">;
|
|
114
|
+
id: z.ZodString;
|
|
115
|
+
reason: z.ZodString;
|
|
116
|
+
payload: z.ZodAny;
|
|
117
|
+
}, z.core.$strip>]>;
|
|
118
|
+
type SendMessageInput = z.infer<typeof sendMessageInputSchema>;
|
|
119
|
+
type ClientMessage = z.infer<typeof clientMessageSchema>;
|
|
120
|
+
type SystemMessage = z.infer<typeof systemMessageSchema>;
|
|
121
|
+
type UserMessage = z.infer<typeof userMessageSchema>;
|
|
122
|
+
type ToolMessage = z.infer<typeof toolMessageSchema>;
|
|
123
|
+
type AssistantMessage = z.infer<typeof assistantMessageSchema>;
|
|
124
|
+
type Tool = z.infer<typeof toolSchema>;
|
|
125
|
+
type SendMessageEvent = z.infer<typeof sendMessageEventSchema>;
|
|
126
|
+
|
|
127
|
+
export { type AssistantMessage, type ClientMessage, type Schema, type SendMessageEvent, type SendMessageInput, type SystemMessage, type Tool, type ToolMessage, type UserMessage, type ZodInfer, assistantMessageSchema, clientMessageSchema, isV4Schema, sendMessageEventSchema, sendMessageInputSchema, systemMessageSchema, toolMessageSchema, toolSchema, userMessageSchema };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
import * as z3 from 'zod/v3';
|
|
3
|
+
import * as z4 from 'zod/v4/core';
|
|
4
|
+
|
|
5
|
+
type Schema = z3.ZodTypeAny | z4.$ZodType;
|
|
6
|
+
type ZodInfer<T> = T extends z3.ZodTypeAny ? z3.infer<T> : z4.infer<T>;
|
|
7
|
+
declare function isV4Schema(schema: Schema): schema is z4.$ZodType;
|
|
8
|
+
declare const systemMessageSchema: z.ZodObject<{
|
|
9
|
+
role: z.ZodLiteral<"system">;
|
|
10
|
+
content: z.ZodString;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
declare const userMessageSchema: z.ZodObject<{
|
|
13
|
+
role: z.ZodLiteral<"user">;
|
|
14
|
+
content: z.ZodString;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
declare const toolMessageSchema: z.ZodObject<{
|
|
17
|
+
role: z.ZodLiteral<"tool">;
|
|
18
|
+
content: z.ZodString;
|
|
19
|
+
toolCallId: z.ZodString;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
declare const assistantMessageSchema: z.ZodObject<{
|
|
22
|
+
role: z.ZodLiteral<"assistant">;
|
|
23
|
+
content: z.ZodOptional<z.ZodString>;
|
|
24
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
type: z.ZodLiteral<"function">;
|
|
27
|
+
function: z.ZodObject<{
|
|
28
|
+
name: z.ZodString;
|
|
29
|
+
arguments: z.ZodString;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
}, z.core.$strip>>>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
declare const clientMessageSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
34
|
+
role: z.ZodLiteral<"system">;
|
|
35
|
+
content: z.ZodString;
|
|
36
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
37
|
+
role: z.ZodLiteral<"user">;
|
|
38
|
+
content: z.ZodString;
|
|
39
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
40
|
+
role: z.ZodLiteral<"tool">;
|
|
41
|
+
content: z.ZodString;
|
|
42
|
+
toolCallId: z.ZodString;
|
|
43
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
44
|
+
role: z.ZodLiteral<"assistant">;
|
|
45
|
+
content: z.ZodOptional<z.ZodString>;
|
|
46
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
47
|
+
id: z.ZodString;
|
|
48
|
+
type: z.ZodLiteral<"function">;
|
|
49
|
+
function: z.ZodObject<{
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
arguments: z.ZodString;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
}, z.core.$strip>>>;
|
|
54
|
+
}, z.core.$strip>]>;
|
|
55
|
+
declare const toolSchema: z.ZodObject<{
|
|
56
|
+
name: z.ZodString;
|
|
57
|
+
description: z.ZodString;
|
|
58
|
+
parameters: z.ZodAny;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
declare const sendMessageInputSchema: z.ZodObject<{
|
|
61
|
+
conversationId: z.ZodString;
|
|
62
|
+
messages: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
63
|
+
role: z.ZodLiteral<"system">;
|
|
64
|
+
content: z.ZodString;
|
|
65
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
66
|
+
role: z.ZodLiteral<"user">;
|
|
67
|
+
content: z.ZodString;
|
|
68
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
69
|
+
role: z.ZodLiteral<"tool">;
|
|
70
|
+
content: z.ZodString;
|
|
71
|
+
toolCallId: z.ZodString;
|
|
72
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
73
|
+
role: z.ZodLiteral<"assistant">;
|
|
74
|
+
content: z.ZodOptional<z.ZodString>;
|
|
75
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
76
|
+
id: z.ZodString;
|
|
77
|
+
type: z.ZodLiteral<"function">;
|
|
78
|
+
function: z.ZodObject<{
|
|
79
|
+
name: z.ZodString;
|
|
80
|
+
arguments: z.ZodString;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
}, z.core.$strip>>>;
|
|
83
|
+
}, z.core.$strip>]>>>;
|
|
84
|
+
resume: z.ZodOptional<z.ZodObject<{
|
|
85
|
+
interruptId: z.ZodString;
|
|
86
|
+
payload: z.ZodAny;
|
|
87
|
+
}, z.core.$strip>>;
|
|
88
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
89
|
+
name: z.ZodString;
|
|
90
|
+
description: z.ZodString;
|
|
91
|
+
parameters: z.ZodAny;
|
|
92
|
+
}, z.core.$strip>>>;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
declare const sendMessageEventSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
95
|
+
type: z.ZodLiteral<"text">;
|
|
96
|
+
content: z.ZodString;
|
|
97
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
98
|
+
type: z.ZodLiteral<"tool-call-start">;
|
|
99
|
+
toolCallId: z.ZodString;
|
|
100
|
+
toolCallName: z.ZodString;
|
|
101
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
102
|
+
type: z.ZodLiteral<"tool-call-args">;
|
|
103
|
+
toolCallId: z.ZodString;
|
|
104
|
+
delta: z.ZodString;
|
|
105
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
106
|
+
type: z.ZodLiteral<"tool-call-end">;
|
|
107
|
+
toolCallId: z.ZodString;
|
|
108
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
109
|
+
type: z.ZodLiteral<"tool-result">;
|
|
110
|
+
toolCallId: z.ZodString;
|
|
111
|
+
result: z.ZodString;
|
|
112
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
113
|
+
type: z.ZodLiteral<"interrupt">;
|
|
114
|
+
id: z.ZodString;
|
|
115
|
+
reason: z.ZodString;
|
|
116
|
+
payload: z.ZodAny;
|
|
117
|
+
}, z.core.$strip>]>;
|
|
118
|
+
type SendMessageInput = z.infer<typeof sendMessageInputSchema>;
|
|
119
|
+
type ClientMessage = z.infer<typeof clientMessageSchema>;
|
|
120
|
+
type SystemMessage = z.infer<typeof systemMessageSchema>;
|
|
121
|
+
type UserMessage = z.infer<typeof userMessageSchema>;
|
|
122
|
+
type ToolMessage = z.infer<typeof toolMessageSchema>;
|
|
123
|
+
type AssistantMessage = z.infer<typeof assistantMessageSchema>;
|
|
124
|
+
type Tool = z.infer<typeof toolSchema>;
|
|
125
|
+
type SendMessageEvent = z.infer<typeof sendMessageEventSchema>;
|
|
126
|
+
|
|
127
|
+
export { type AssistantMessage, type ClientMessage, type Schema, type SendMessageEvent, type SendMessageInput, type SystemMessage, type Tool, type ToolMessage, type UserMessage, type ZodInfer, assistantMessageSchema, clientMessageSchema, isV4Schema, sendMessageEventSchema, sendMessageInputSchema, systemMessageSchema, toolMessageSchema, toolSchema, userMessageSchema };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
assistantMessageSchema: () => assistantMessageSchema,
|
|
34
|
+
clientMessageSchema: () => clientMessageSchema,
|
|
35
|
+
isV4Schema: () => isV4Schema,
|
|
36
|
+
sendMessageEventSchema: () => sendMessageEventSchema,
|
|
37
|
+
sendMessageInputSchema: () => sendMessageInputSchema,
|
|
38
|
+
systemMessageSchema: () => systemMessageSchema,
|
|
39
|
+
toolMessageSchema: () => toolMessageSchema,
|
|
40
|
+
toolSchema: () => toolSchema,
|
|
41
|
+
userMessageSchema: () => userMessageSchema
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(index_exports);
|
|
44
|
+
var z = __toESM(require("zod/v4"));
|
|
45
|
+
function isV4Schema(schema) {
|
|
46
|
+
return "_zod" in schema;
|
|
47
|
+
}
|
|
48
|
+
var systemMessageSchema = z.object({
|
|
49
|
+
role: z.literal("system"),
|
|
50
|
+
content: z.string()
|
|
51
|
+
});
|
|
52
|
+
var userMessageSchema = z.object({
|
|
53
|
+
role: z.literal("user"),
|
|
54
|
+
content: z.string()
|
|
55
|
+
});
|
|
56
|
+
var toolMessageSchema = z.object({
|
|
57
|
+
role: z.literal("tool"),
|
|
58
|
+
content: z.string(),
|
|
59
|
+
toolCallId: z.string()
|
|
60
|
+
});
|
|
61
|
+
var assistantMessageSchema = z.object({
|
|
62
|
+
role: z.literal("assistant"),
|
|
63
|
+
content: z.string().optional(),
|
|
64
|
+
toolCalls: z.array(
|
|
65
|
+
z.object({
|
|
66
|
+
id: z.string(),
|
|
67
|
+
type: z.literal("function"),
|
|
68
|
+
function: z.object({
|
|
69
|
+
name: z.string(),
|
|
70
|
+
arguments: z.string()
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
).optional()
|
|
74
|
+
});
|
|
75
|
+
var clientMessageSchema = z.union([
|
|
76
|
+
systemMessageSchema,
|
|
77
|
+
userMessageSchema,
|
|
78
|
+
toolMessageSchema,
|
|
79
|
+
assistantMessageSchema
|
|
80
|
+
]);
|
|
81
|
+
var toolSchema = z.object({
|
|
82
|
+
name: z.string(),
|
|
83
|
+
description: z.string(),
|
|
84
|
+
parameters: z.any()
|
|
85
|
+
});
|
|
86
|
+
var sendMessageInputSchema = z.object({
|
|
87
|
+
conversationId: z.string(),
|
|
88
|
+
messages: z.array(clientMessageSchema).optional(),
|
|
89
|
+
resume: z.object({
|
|
90
|
+
interruptId: z.string(),
|
|
91
|
+
payload: z.any()
|
|
92
|
+
}).optional(),
|
|
93
|
+
tools: z.array(toolSchema).optional()
|
|
94
|
+
});
|
|
95
|
+
var sendMessageEventSchema = z.union([
|
|
96
|
+
z.object({
|
|
97
|
+
type: z.literal("text"),
|
|
98
|
+
content: z.string()
|
|
99
|
+
}),
|
|
100
|
+
z.object({
|
|
101
|
+
type: z.literal("tool-call-start"),
|
|
102
|
+
toolCallId: z.string(),
|
|
103
|
+
toolCallName: z.string()
|
|
104
|
+
}),
|
|
105
|
+
z.object({
|
|
106
|
+
type: z.literal("tool-call-args"),
|
|
107
|
+
toolCallId: z.string(),
|
|
108
|
+
delta: z.string()
|
|
109
|
+
}),
|
|
110
|
+
z.object({
|
|
111
|
+
type: z.literal("tool-call-end"),
|
|
112
|
+
toolCallId: z.string()
|
|
113
|
+
}),
|
|
114
|
+
z.object({
|
|
115
|
+
type: z.literal("tool-result"),
|
|
116
|
+
toolCallId: z.string(),
|
|
117
|
+
result: z.string()
|
|
118
|
+
}),
|
|
119
|
+
z.object({
|
|
120
|
+
type: z.literal("interrupt"),
|
|
121
|
+
id: z.string(),
|
|
122
|
+
reason: z.string(),
|
|
123
|
+
payload: z.any()
|
|
124
|
+
})
|
|
125
|
+
]);
|
|
126
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
127
|
+
0 && (module.exports = {
|
|
128
|
+
assistantMessageSchema,
|
|
129
|
+
clientMessageSchema,
|
|
130
|
+
isV4Schema,
|
|
131
|
+
sendMessageEventSchema,
|
|
132
|
+
sendMessageInputSchema,
|
|
133
|
+
systemMessageSchema,
|
|
134
|
+
toolMessageSchema,
|
|
135
|
+
toolSchema,
|
|
136
|
+
userMessageSchema
|
|
137
|
+
});
|
|
138
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import * as z from \"zod/v4\";\nimport * as z3 from \"zod/v3\";\nimport * as z4 from \"zod/v4/core\";\n\n// https://zod.dev/library-authors#how-to-support-zod-3-and-zod-4-simultaneously\nexport type Schema = z3.ZodTypeAny | z4.$ZodType;\nexport type ZodInfer<T> = T extends z3.ZodTypeAny ? z3.infer<T> : z4.infer<T>;\nexport function isV4Schema(schema: Schema): schema is z4.$ZodType {\n return \"_zod\" in schema;\n}\n\nexport const systemMessageSchema = z.object({\n role: z.literal(\"system\"),\n content: z.string(),\n});\n\nexport const userMessageSchema = z.object({\n role: z.literal(\"user\"),\n content: z.string(),\n});\n\nexport const toolMessageSchema = z.object({\n role: z.literal(\"tool\"),\n content: z.string(),\n toolCallId: z.string(),\n});\n\nexport const assistantMessageSchema = z.object({\n role: z.literal(\"assistant\"),\n content: z.string().optional(),\n toolCalls: z\n .array(\n z.object({\n id: z.string(),\n type: z.literal(\"function\"),\n function: z.object({\n name: z.string(),\n arguments: z.string(),\n }),\n })\n )\n .optional(),\n});\n\nexport const clientMessageSchema = z.union([\n systemMessageSchema,\n userMessageSchema,\n toolMessageSchema,\n assistantMessageSchema,\n]);\n\nexport const toolSchema = z.object({\n name: z.string(),\n description: z.string(),\n parameters: z.any(),\n});\n\nexport const sendMessageInputSchema = z.object({\n conversationId: z.string(),\n messages: z.array(clientMessageSchema).optional(),\n resume: z\n .object({\n interruptId: z.string(),\n payload: z.any(),\n })\n .optional(),\n tools: z.array(toolSchema).optional(),\n});\n\nexport const sendMessageEventSchema = z.union([\n z.object({\n type: z.literal(\"text\"),\n content: z.string(),\n }),\n z.object({\n type: z.literal(\"tool-call-start\"),\n toolCallId: z.string(),\n toolCallName: z.string(),\n }),\n z.object({\n type: z.literal(\"tool-call-args\"),\n toolCallId: z.string(),\n delta: z.string(),\n }),\n z.object({\n type: z.literal(\"tool-call-end\"),\n toolCallId: z.string(),\n }),\n z.object({\n type: z.literal(\"tool-result\"),\n toolCallId: z.string(),\n result: z.string(),\n }),\n z.object({\n type: z.literal(\"interrupt\"),\n id: z.string(),\n reason: z.string(),\n payload: z.any(),\n }),\n]);\n\nexport type SendMessageInput = z.infer<typeof sendMessageInputSchema>;\nexport type ClientMessage = z.infer<typeof clientMessageSchema>;\nexport type SystemMessage = z.infer<typeof systemMessageSchema>;\nexport type UserMessage = z.infer<typeof userMessageSchema>;\nexport type ToolMessage = z.infer<typeof toolMessageSchema>;\nexport type AssistantMessage = z.infer<typeof assistantMessageSchema>;\nexport type Tool = z.infer<typeof toolSchema>;\nexport type SendMessageEvent = z.infer<typeof sendMessageEventSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAAmB;AAOZ,SAAS,WAAW,QAAuC;AAChE,SAAO,UAAU;AACnB;AAEO,IAAM,sBAAwB,SAAO;AAAA,EAC1C,MAAQ,UAAQ,QAAQ;AAAA,EACxB,SAAW,SAAO;AACpB,CAAC;AAEM,IAAM,oBAAsB,SAAO;AAAA,EACxC,MAAQ,UAAQ,MAAM;AAAA,EACtB,SAAW,SAAO;AACpB,CAAC;AAEM,IAAM,oBAAsB,SAAO;AAAA,EACxC,MAAQ,UAAQ,MAAM;AAAA,EACtB,SAAW,SAAO;AAAA,EAClB,YAAc,SAAO;AACvB,CAAC;AAEM,IAAM,yBAA2B,SAAO;AAAA,EAC7C,MAAQ,UAAQ,WAAW;AAAA,EAC3B,SAAW,SAAO,EAAE,SAAS;AAAA,EAC7B,WACG;AAAA,IACG,SAAO;AAAA,MACP,IAAM,SAAO;AAAA,MACb,MAAQ,UAAQ,UAAU;AAAA,MAC1B,UAAY,SAAO;AAAA,QACjB,MAAQ,SAAO;AAAA,QACf,WAAa,SAAO;AAAA,MACtB,CAAC;AAAA,IACH,CAAC;AAAA,EACH,EACC,SAAS;AACd,CAAC;AAEM,IAAM,sBAAwB,QAAM;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,aAAe,SAAO;AAAA,EACjC,MAAQ,SAAO;AAAA,EACf,aAAe,SAAO;AAAA,EACtB,YAAc,MAAI;AACpB,CAAC;AAEM,IAAM,yBAA2B,SAAO;AAAA,EAC7C,gBAAkB,SAAO;AAAA,EACzB,UAAY,QAAM,mBAAmB,EAAE,SAAS;AAAA,EAChD,QACG,SAAO;AAAA,IACN,aAAe,SAAO;AAAA,IACtB,SAAW,MAAI;AAAA,EACjB,CAAC,EACA,SAAS;AAAA,EACZ,OAAS,QAAM,UAAU,EAAE,SAAS;AACtC,CAAC;AAEM,IAAM,yBAA2B,QAAM;AAAA,EAC1C,SAAO;AAAA,IACP,MAAQ,UAAQ,MAAM;AAAA,IACtB,SAAW,SAAO;AAAA,EACpB,CAAC;AAAA,EACC,SAAO;AAAA,IACP,MAAQ,UAAQ,iBAAiB;AAAA,IACjC,YAAc,SAAO;AAAA,IACrB,cAAgB,SAAO;AAAA,EACzB,CAAC;AAAA,EACC,SAAO;AAAA,IACP,MAAQ,UAAQ,gBAAgB;AAAA,IAChC,YAAc,SAAO;AAAA,IACrB,OAAS,SAAO;AAAA,EAClB,CAAC;AAAA,EACC,SAAO;AAAA,IACP,MAAQ,UAAQ,eAAe;AAAA,IAC/B,YAAc,SAAO;AAAA,EACvB,CAAC;AAAA,EACC,SAAO;AAAA,IACP,MAAQ,UAAQ,aAAa;AAAA,IAC7B,YAAc,SAAO;AAAA,IACrB,QAAU,SAAO;AAAA,EACnB,CAAC;AAAA,EACC,SAAO;AAAA,IACP,MAAQ,UAAQ,WAAW;AAAA,IAC3B,IAAM,SAAO;AAAA,IACb,QAAU,SAAO;AAAA,IACjB,SAAW,MAAI;AAAA,EACjB,CAAC;AACH,CAAC;","names":[]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import * as z from "zod/v4";
|
|
3
|
+
function isV4Schema(schema) {
|
|
4
|
+
return "_zod" in schema;
|
|
5
|
+
}
|
|
6
|
+
var systemMessageSchema = z.object({
|
|
7
|
+
role: z.literal("system"),
|
|
8
|
+
content: z.string()
|
|
9
|
+
});
|
|
10
|
+
var userMessageSchema = z.object({
|
|
11
|
+
role: z.literal("user"),
|
|
12
|
+
content: z.string()
|
|
13
|
+
});
|
|
14
|
+
var toolMessageSchema = z.object({
|
|
15
|
+
role: z.literal("tool"),
|
|
16
|
+
content: z.string(),
|
|
17
|
+
toolCallId: z.string()
|
|
18
|
+
});
|
|
19
|
+
var assistantMessageSchema = z.object({
|
|
20
|
+
role: z.literal("assistant"),
|
|
21
|
+
content: z.string().optional(),
|
|
22
|
+
toolCalls: z.array(
|
|
23
|
+
z.object({
|
|
24
|
+
id: z.string(),
|
|
25
|
+
type: z.literal("function"),
|
|
26
|
+
function: z.object({
|
|
27
|
+
name: z.string(),
|
|
28
|
+
arguments: z.string()
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
).optional()
|
|
32
|
+
});
|
|
33
|
+
var clientMessageSchema = z.union([
|
|
34
|
+
systemMessageSchema,
|
|
35
|
+
userMessageSchema,
|
|
36
|
+
toolMessageSchema,
|
|
37
|
+
assistantMessageSchema
|
|
38
|
+
]);
|
|
39
|
+
var toolSchema = z.object({
|
|
40
|
+
name: z.string(),
|
|
41
|
+
description: z.string(),
|
|
42
|
+
parameters: z.any()
|
|
43
|
+
});
|
|
44
|
+
var sendMessageInputSchema = z.object({
|
|
45
|
+
conversationId: z.string(),
|
|
46
|
+
messages: z.array(clientMessageSchema).optional(),
|
|
47
|
+
resume: z.object({
|
|
48
|
+
interruptId: z.string(),
|
|
49
|
+
payload: z.any()
|
|
50
|
+
}).optional(),
|
|
51
|
+
tools: z.array(toolSchema).optional()
|
|
52
|
+
});
|
|
53
|
+
var sendMessageEventSchema = z.union([
|
|
54
|
+
z.object({
|
|
55
|
+
type: z.literal("text"),
|
|
56
|
+
content: z.string()
|
|
57
|
+
}),
|
|
58
|
+
z.object({
|
|
59
|
+
type: z.literal("tool-call-start"),
|
|
60
|
+
toolCallId: z.string(),
|
|
61
|
+
toolCallName: z.string()
|
|
62
|
+
}),
|
|
63
|
+
z.object({
|
|
64
|
+
type: z.literal("tool-call-args"),
|
|
65
|
+
toolCallId: z.string(),
|
|
66
|
+
delta: z.string()
|
|
67
|
+
}),
|
|
68
|
+
z.object({
|
|
69
|
+
type: z.literal("tool-call-end"),
|
|
70
|
+
toolCallId: z.string()
|
|
71
|
+
}),
|
|
72
|
+
z.object({
|
|
73
|
+
type: z.literal("tool-result"),
|
|
74
|
+
toolCallId: z.string(),
|
|
75
|
+
result: z.string()
|
|
76
|
+
}),
|
|
77
|
+
z.object({
|
|
78
|
+
type: z.literal("interrupt"),
|
|
79
|
+
id: z.string(),
|
|
80
|
+
reason: z.string(),
|
|
81
|
+
payload: z.any()
|
|
82
|
+
})
|
|
83
|
+
]);
|
|
84
|
+
export {
|
|
85
|
+
assistantMessageSchema,
|
|
86
|
+
clientMessageSchema,
|
|
87
|
+
isV4Schema,
|
|
88
|
+
sendMessageEventSchema,
|
|
89
|
+
sendMessageInputSchema,
|
|
90
|
+
systemMessageSchema,
|
|
91
|
+
toolMessageSchema,
|
|
92
|
+
toolSchema,
|
|
93
|
+
userMessageSchema
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import * as z from \"zod/v4\";\nimport * as z3 from \"zod/v3\";\nimport * as z4 from \"zod/v4/core\";\n\n// https://zod.dev/library-authors#how-to-support-zod-3-and-zod-4-simultaneously\nexport type Schema = z3.ZodTypeAny | z4.$ZodType;\nexport type ZodInfer<T> = T extends z3.ZodTypeAny ? z3.infer<T> : z4.infer<T>;\nexport function isV4Schema(schema: Schema): schema is z4.$ZodType {\n return \"_zod\" in schema;\n}\n\nexport const systemMessageSchema = z.object({\n role: z.literal(\"system\"),\n content: z.string(),\n});\n\nexport const userMessageSchema = z.object({\n role: z.literal(\"user\"),\n content: z.string(),\n});\n\nexport const toolMessageSchema = z.object({\n role: z.literal(\"tool\"),\n content: z.string(),\n toolCallId: z.string(),\n});\n\nexport const assistantMessageSchema = z.object({\n role: z.literal(\"assistant\"),\n content: z.string().optional(),\n toolCalls: z\n .array(\n z.object({\n id: z.string(),\n type: z.literal(\"function\"),\n function: z.object({\n name: z.string(),\n arguments: z.string(),\n }),\n })\n )\n .optional(),\n});\n\nexport const clientMessageSchema = z.union([\n systemMessageSchema,\n userMessageSchema,\n toolMessageSchema,\n assistantMessageSchema,\n]);\n\nexport const toolSchema = z.object({\n name: z.string(),\n description: z.string(),\n parameters: z.any(),\n});\n\nexport const sendMessageInputSchema = z.object({\n conversationId: z.string(),\n messages: z.array(clientMessageSchema).optional(),\n resume: z\n .object({\n interruptId: z.string(),\n payload: z.any(),\n })\n .optional(),\n tools: z.array(toolSchema).optional(),\n});\n\nexport const sendMessageEventSchema = z.union([\n z.object({\n type: z.literal(\"text\"),\n content: z.string(),\n }),\n z.object({\n type: z.literal(\"tool-call-start\"),\n toolCallId: z.string(),\n toolCallName: z.string(),\n }),\n z.object({\n type: z.literal(\"tool-call-args\"),\n toolCallId: z.string(),\n delta: z.string(),\n }),\n z.object({\n type: z.literal(\"tool-call-end\"),\n toolCallId: z.string(),\n }),\n z.object({\n type: z.literal(\"tool-result\"),\n toolCallId: z.string(),\n result: z.string(),\n }),\n z.object({\n type: z.literal(\"interrupt\"),\n id: z.string(),\n reason: z.string(),\n payload: z.any(),\n }),\n]);\n\nexport type SendMessageInput = z.infer<typeof sendMessageInputSchema>;\nexport type ClientMessage = z.infer<typeof clientMessageSchema>;\nexport type SystemMessage = z.infer<typeof systemMessageSchema>;\nexport type UserMessage = z.infer<typeof userMessageSchema>;\nexport type ToolMessage = z.infer<typeof toolMessageSchema>;\nexport type AssistantMessage = z.infer<typeof assistantMessageSchema>;\nexport type Tool = z.infer<typeof toolSchema>;\nexport type SendMessageEvent = z.infer<typeof sendMessageEventSchema>;\n"],"mappings":";AAAA,YAAY,OAAO;AAOZ,SAAS,WAAW,QAAuC;AAChE,SAAO,UAAU;AACnB;AAEO,IAAM,sBAAwB,SAAO;AAAA,EAC1C,MAAQ,UAAQ,QAAQ;AAAA,EACxB,SAAW,SAAO;AACpB,CAAC;AAEM,IAAM,oBAAsB,SAAO;AAAA,EACxC,MAAQ,UAAQ,MAAM;AAAA,EACtB,SAAW,SAAO;AACpB,CAAC;AAEM,IAAM,oBAAsB,SAAO;AAAA,EACxC,MAAQ,UAAQ,MAAM;AAAA,EACtB,SAAW,SAAO;AAAA,EAClB,YAAc,SAAO;AACvB,CAAC;AAEM,IAAM,yBAA2B,SAAO;AAAA,EAC7C,MAAQ,UAAQ,WAAW;AAAA,EAC3B,SAAW,SAAO,EAAE,SAAS;AAAA,EAC7B,WACG;AAAA,IACG,SAAO;AAAA,MACP,IAAM,SAAO;AAAA,MACb,MAAQ,UAAQ,UAAU;AAAA,MAC1B,UAAY,SAAO;AAAA,QACjB,MAAQ,SAAO;AAAA,QACf,WAAa,SAAO;AAAA,MACtB,CAAC;AAAA,IACH,CAAC;AAAA,EACH,EACC,SAAS;AACd,CAAC;AAEM,IAAM,sBAAwB,QAAM;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,aAAe,SAAO;AAAA,EACjC,MAAQ,SAAO;AAAA,EACf,aAAe,SAAO;AAAA,EACtB,YAAc,MAAI;AACpB,CAAC;AAEM,IAAM,yBAA2B,SAAO;AAAA,EAC7C,gBAAkB,SAAO;AAAA,EACzB,UAAY,QAAM,mBAAmB,EAAE,SAAS;AAAA,EAChD,QACG,SAAO;AAAA,IACN,aAAe,SAAO;AAAA,IACtB,SAAW,MAAI;AAAA,EACjB,CAAC,EACA,SAAS;AAAA,EACZ,OAAS,QAAM,UAAU,EAAE,SAAS;AACtC,CAAC;AAEM,IAAM,yBAA2B,QAAM;AAAA,EAC1C,SAAO;AAAA,IACP,MAAQ,UAAQ,MAAM;AAAA,IACtB,SAAW,SAAO;AAAA,EACpB,CAAC;AAAA,EACC,SAAO;AAAA,IACP,MAAQ,UAAQ,iBAAiB;AAAA,IACjC,YAAc,SAAO;AAAA,IACrB,cAAgB,SAAO;AAAA,EACzB,CAAC;AAAA,EACC,SAAO;AAAA,IACP,MAAQ,UAAQ,gBAAgB;AAAA,IAChC,YAAc,SAAO;AAAA,IACrB,OAAS,SAAO;AAAA,EAClB,CAAC;AAAA,EACC,SAAO;AAAA,IACP,MAAQ,UAAQ,eAAe;AAAA,IAC/B,YAAc,SAAO;AAAA,EACvB,CAAC;AAAA,EACC,SAAO;AAAA,IACP,MAAQ,UAAQ,aAAa;AAAA,IAC7B,YAAc,SAAO;AAAA,IACrB,QAAU,SAAO;AAAA,EACnB,CAAC;AAAA,EACC,SAAO;AAAA,IACP,MAAQ,UAAQ,WAAW;AAAA,IAC3B,IAAM,SAAO;AAAA,IACb,QAAU,SAAO;AAAA,IACjB,SAAW,MAAI;AAAA,EACjB,CAAC;AACH,CAAC;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cloudbase/agent-shared",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist/",
|
|
7
|
+
"README.md",
|
|
8
|
+
"CHANGELOG.md"
|
|
9
|
+
],
|
|
10
|
+
"main": "dist/index.js",
|
|
11
|
+
"module": "dist/index.mjs",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/index.mjs",
|
|
15
|
+
"require": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"keywords": [],
|
|
19
|
+
"author": "",
|
|
20
|
+
"license": "ISC",
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"tsup": "^8.5.0",
|
|
23
|
+
"zod": "^3.25.0 || ^4.0.0"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"zod": "^3.25.0 || ^4.0.0"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
30
|
+
"build": "tsup --config tsup.config.ts"
|
|
31
|
+
}
|
|
32
|
+
}
|