hankweave 0.5.7 → 0.6.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.
Files changed (79) hide show
  1. package/README.md +12 -11
  2. package/dist/base-process-manager.d.ts +30 -0
  3. package/dist/budget.d.ts +315 -0
  4. package/dist/checkpoint-git.d.ts +98 -0
  5. package/dist/claude-agent-sdk-manager.d.ts +144 -0
  6. package/dist/claude-log-parser.d.ts +63 -0
  7. package/dist/claude-runtime-extractor.d.ts +73 -0
  8. package/dist/codex-runtime-extractor.d.ts +107 -0
  9. package/dist/codon-runner.d.ts +278 -0
  10. package/dist/config-validation/model-validator.d.ts +16 -0
  11. package/dist/config-validation/sentinel.schema.d.ts +6967 -0
  12. package/dist/config.d.ts +40815 -0
  13. package/dist/cost-tracker.d.ts +72 -0
  14. package/dist/execution-planner.d.ts +62 -0
  15. package/dist/execution-thread.d.ts +71 -0
  16. package/dist/exports/schemas.d.ts +9 -0
  17. package/dist/exports/schemas.js +1019 -0
  18. package/dist/exports/types.d.ts +15 -0
  19. package/dist/exports/types.js +60 -0
  20. package/dist/file-resolver.d.ts +33 -0
  21. package/dist/index.js +380 -293
  22. package/dist/index.js.map +33 -29
  23. package/dist/llm/llm-provider-registry.d.ts +207 -0
  24. package/dist/llm/models-dev-schema.d.ts +679 -0
  25. package/dist/llm/provider-config.d.ts +30 -0
  26. package/dist/prompt-builder.d.ts +75 -0
  27. package/dist/prompt-frontmatter.d.ts +61 -0
  28. package/dist/replay-process-manager.d.ts +82 -0
  29. package/dist/runtime-extractor-base.d.ts +120 -0
  30. package/dist/schemas/event-schemas.d.ts +8389 -0
  31. package/dist/schemas/websocket-log-schemas.d.ts +4502 -0
  32. package/dist/shim-process-manager.d.ts +98 -0
  33. package/dist/shim-runtime-extractor.d.ts +51 -0
  34. package/dist/shims/codex/README.md +129 -0
  35. package/dist/shims/codex/THIRDPARTY.md +18 -0
  36. package/dist/shims/codex/VERSION +1 -0
  37. package/dist/shims/codex/common/package.json +24 -0
  38. package/dist/shims/codex/index.js +1154 -970
  39. package/dist/shims/codex/package.json +46 -0
  40. package/dist/shims/codex/tsup.config.ts +16 -0
  41. package/dist/shims/gemini/README.md +59 -0
  42. package/dist/shims/gemini/THIRDPARTY.md +32 -0
  43. package/dist/shims/gemini/VERSION +1 -0
  44. package/dist/shims/gemini/common/package.json +24 -0
  45. package/dist/shims/gemini/index.js +1359 -30
  46. package/dist/shims/gemini/package.json +37 -0
  47. package/dist/shims/opencode/README.md +82 -0
  48. package/dist/shims/opencode/THIRDPARTY.md +32 -0
  49. package/dist/shims/opencode/VERSION +1 -0
  50. package/dist/shims/opencode/common/package.json +24 -0
  51. package/dist/shims/opencode/index.js +1476 -0
  52. package/dist/shims/opencode/package.json +38 -0
  53. package/dist/shims/pi/README.md +87 -0
  54. package/dist/shims/pi/THIRDPARTY.md +24 -0
  55. package/dist/shims/pi/VERSION +1 -0
  56. package/dist/shims/pi/common/package.json +24 -0
  57. package/dist/shims/pi/index.js +249832 -0
  58. package/dist/shims/pi/package.json +53 -0
  59. package/dist/state-manager.d.ts +161 -0
  60. package/dist/state-transition-guards.d.ts +37 -0
  61. package/dist/telemetry/telemetry-types.d.ts +206 -0
  62. package/dist/typed-event-emitter.d.ts +57 -0
  63. package/dist/types/branded-types.d.ts +15 -0
  64. package/dist/types/budget-types.d.ts +82 -0
  65. package/dist/types/claude-session-schema.d.ts +2430 -0
  66. package/dist/types/error-types.d.ts +44 -0
  67. package/dist/types/input-ai-types.d.ts +1070 -0
  68. package/dist/types/llm-call-types.d.ts +3829 -0
  69. package/dist/types/sentinel-types.d.ts +66 -0
  70. package/dist/types/state-types.d.ts +1099 -0
  71. package/dist/types/tool-types.d.ts +86 -0
  72. package/dist/types/types.d.ts +367 -0
  73. package/dist/types/websocket-log-types.d.ts +7 -0
  74. package/dist/utils.d.ts +452 -0
  75. package/package.json +15 -2
  76. package/schemas/hank.schema.json +158 -3
  77. package/schemas/hankweave.schema.json +17 -1
  78. package/shims/codex/index.js +0 -1583
  79. package/shims/gemini/index.js +0 -31
@@ -0,0 +1,1070 @@
1
+ /**
2
+ * The schemas in this directory are designed to be simpler versions (hence why some are commented out)
3
+ * Of the AI SDK ModelMessage (https://ai-sdk.dev/docs/reference/ai-sdk-core/model-message) Types,
4
+ * and to be compatible with the streamText and generateText functions.
5
+ *
6
+ * Use these inferred types to format messages going TO models.
7
+ */
8
+ import { z } from "zod";
9
+ /**
10
+ * JSON value schema compatible with the AI SDK JSONValue type.
11
+ * Allows null, primitive types, arrays and objects with string keys.
12
+ */
13
+ type JsonValue = null | string | number | boolean | {
14
+ [k: string]: JsonValue;
15
+ } | JsonValue[];
16
+ /**
17
+ * Represents a text part of a message.
18
+ */
19
+ export declare const hankweaveTextPartSchema: z.ZodObject<{
20
+ type: z.ZodLiteral<"text">;
21
+ text: z.ZodString;
22
+ }, "strict", z.ZodTypeAny, {
23
+ type: "text";
24
+ text: string;
25
+ }, {
26
+ type: "text";
27
+ text: string;
28
+ }>;
29
+ /**
30
+ * Represents an image part in a user message.
31
+ */
32
+ export declare const hankweaveImagePartSchema: z.ZodObject<{
33
+ type: z.ZodLiteral<"image">;
34
+ image: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>, z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>]>, z.ZodType<URL, z.ZodTypeDef, URL>]>;
35
+ mediaType: z.ZodOptional<z.ZodString>;
36
+ }, "strict", z.ZodTypeAny, {
37
+ type: "image";
38
+ image: string | ArrayBuffer | Uint8Array<ArrayBuffer> | Buffer<ArrayBufferLike> | URL;
39
+ mediaType?: string | undefined;
40
+ }, {
41
+ type: "image";
42
+ image: string | ArrayBuffer | Uint8Array<ArrayBuffer> | Buffer<ArrayBufferLike> | URL;
43
+ mediaType?: string | undefined;
44
+ }>;
45
+ /**
46
+ * Represents a file part in a user or assistant message.
47
+ */
48
+ export declare const hankweaveFilePartSchema: z.ZodObject<{
49
+ type: z.ZodLiteral<"file">;
50
+ data: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>, z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>]>, z.ZodType<URL, z.ZodTypeDef, URL>]>;
51
+ mediaType: z.ZodString;
52
+ filename: z.ZodOptional<z.ZodString>;
53
+ }, "strict", z.ZodTypeAny, {
54
+ type: "file";
55
+ data: string | ArrayBuffer | Uint8Array<ArrayBuffer> | Buffer<ArrayBufferLike> | URL;
56
+ mediaType: string;
57
+ filename?: string | undefined;
58
+ }, {
59
+ type: "file";
60
+ data: string | ArrayBuffer | Uint8Array<ArrayBuffer> | Buffer<ArrayBufferLike> | URL;
61
+ mediaType: string;
62
+ filename?: string | undefined;
63
+ }>;
64
+ /**
65
+ * Represents a tool call generated by the model.
66
+ */
67
+ export declare const hankweaveToolCallPartSchema: z.ZodObject<{
68
+ type: z.ZodLiteral<"tool-call">;
69
+ toolCallId: z.ZodString;
70
+ toolName: z.ZodString;
71
+ input: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>;
72
+ }, "strict", z.ZodTypeAny, {
73
+ type: "tool-call";
74
+ input: Record<string, JsonValue>;
75
+ toolCallId: string;
76
+ toolName: string;
77
+ }, {
78
+ type: "tool-call";
79
+ input: Record<string, JsonValue>;
80
+ toolCallId: string;
81
+ toolName: string;
82
+ }>;
83
+ /**
84
+ * Represents the result of a tool's execution.
85
+ */
86
+ export declare const hankweaveToolResultPartSchema: z.ZodObject<{
87
+ type: z.ZodLiteral<"tool-result">;
88
+ toolCallId: z.ZodString;
89
+ toolName: z.ZodString;
90
+ output: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
91
+ type: z.ZodLiteral<"text">;
92
+ value: z.ZodString;
93
+ }, "strict", z.ZodTypeAny, {
94
+ type: "text";
95
+ value: string;
96
+ }, {
97
+ type: "text";
98
+ value: string;
99
+ }>, z.ZodObject<{
100
+ type: z.ZodLiteral<"json">;
101
+ value: z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>;
102
+ }, "strict", z.ZodTypeAny, {
103
+ type: "json";
104
+ value: JsonValue;
105
+ }, {
106
+ type: "json";
107
+ value: JsonValue;
108
+ }>, z.ZodObject<{
109
+ type: z.ZodLiteral<"error-text">;
110
+ value: z.ZodString;
111
+ }, "strict", z.ZodTypeAny, {
112
+ type: "error-text";
113
+ value: string;
114
+ }, {
115
+ type: "error-text";
116
+ value: string;
117
+ }>, z.ZodObject<{
118
+ type: z.ZodLiteral<"error-json">;
119
+ value: z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>;
120
+ }, "strict", z.ZodTypeAny, {
121
+ type: "error-json";
122
+ value: JsonValue;
123
+ }, {
124
+ type: "error-json";
125
+ value: JsonValue;
126
+ }>, z.ZodObject<{
127
+ type: z.ZodLiteral<"content">;
128
+ value: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
129
+ type: z.ZodLiteral<"text">;
130
+ text: z.ZodString;
131
+ }, "strict", z.ZodTypeAny, {
132
+ type: "text";
133
+ text: string;
134
+ }, {
135
+ type: "text";
136
+ text: string;
137
+ }>, z.ZodObject<{
138
+ type: z.ZodLiteral<"media">;
139
+ data: z.ZodString;
140
+ mediaType: z.ZodString;
141
+ }, "strict", z.ZodTypeAny, {
142
+ type: "media";
143
+ data: string;
144
+ mediaType: string;
145
+ }, {
146
+ type: "media";
147
+ data: string;
148
+ mediaType: string;
149
+ }>]>, "many">;
150
+ }, "strict", z.ZodTypeAny, {
151
+ type: "content";
152
+ value: ({
153
+ type: "text";
154
+ text: string;
155
+ } | {
156
+ type: "media";
157
+ data: string;
158
+ mediaType: string;
159
+ })[];
160
+ }, {
161
+ type: "content";
162
+ value: ({
163
+ type: "text";
164
+ text: string;
165
+ } | {
166
+ type: "media";
167
+ data: string;
168
+ mediaType: string;
169
+ })[];
170
+ }>]>;
171
+ experimental_content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
172
+ type: z.ZodLiteral<"text">;
173
+ text: z.ZodString;
174
+ }, "strict", z.ZodTypeAny, {
175
+ type: "text";
176
+ text: string;
177
+ }, {
178
+ type: "text";
179
+ text: string;
180
+ }>, z.ZodObject<{
181
+ type: z.ZodLiteral<"media">;
182
+ data: z.ZodString;
183
+ mediaType: z.ZodString;
184
+ }, "strict", z.ZodTypeAny, {
185
+ type: "media";
186
+ data: string;
187
+ mediaType: string;
188
+ }, {
189
+ type: "media";
190
+ data: string;
191
+ mediaType: string;
192
+ }>]>, "many">>;
193
+ isError: z.ZodOptional<z.ZodBoolean>;
194
+ }, "strict", z.ZodTypeAny, {
195
+ type: "tool-result";
196
+ toolCallId: string;
197
+ toolName: string;
198
+ output: {
199
+ type: "text";
200
+ value: string;
201
+ } | {
202
+ type: "json";
203
+ value: JsonValue;
204
+ } | {
205
+ type: "error-text";
206
+ value: string;
207
+ } | {
208
+ type: "error-json";
209
+ value: JsonValue;
210
+ } | {
211
+ type: "content";
212
+ value: ({
213
+ type: "text";
214
+ text: string;
215
+ } | {
216
+ type: "media";
217
+ data: string;
218
+ mediaType: string;
219
+ })[];
220
+ };
221
+ experimental_content?: ({
222
+ type: "text";
223
+ text: string;
224
+ } | {
225
+ type: "media";
226
+ data: string;
227
+ mediaType: string;
228
+ })[] | undefined;
229
+ isError?: boolean | undefined;
230
+ }, {
231
+ type: "tool-result";
232
+ toolCallId: string;
233
+ toolName: string;
234
+ output: {
235
+ type: "text";
236
+ value: string;
237
+ } | {
238
+ type: "json";
239
+ value: JsonValue;
240
+ } | {
241
+ type: "error-text";
242
+ value: string;
243
+ } | {
244
+ type: "error-json";
245
+ value: JsonValue;
246
+ } | {
247
+ type: "content";
248
+ value: ({
249
+ type: "text";
250
+ text: string;
251
+ } | {
252
+ type: "media";
253
+ data: string;
254
+ mediaType: string;
255
+ })[];
256
+ };
257
+ experimental_content?: ({
258
+ type: "text";
259
+ text: string;
260
+ } | {
261
+ type: "media";
262
+ data: string;
263
+ mediaType: string;
264
+ })[] | undefined;
265
+ isError?: boolean | undefined;
266
+ }>;
267
+ /**
268
+ * A system message for setting the model's behavior.
269
+ */
270
+ export declare const hankweaveSystemModelMessageSchema: z.ZodObject<{
271
+ role: z.ZodLiteral<"system">;
272
+ content: z.ZodString;
273
+ }, "strict", z.ZodTypeAny, {
274
+ content: string;
275
+ role: "system";
276
+ }, {
277
+ content: string;
278
+ role: "system";
279
+ }>;
280
+ /**
281
+ * A user message, representing input from the end-user.
282
+ */
283
+ export declare const hankweaveUserModelMessageSchema: z.ZodObject<{
284
+ role: z.ZodLiteral<"user">;
285
+ content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{
286
+ type: z.ZodLiteral<"text">;
287
+ text: z.ZodString;
288
+ }, "strict", z.ZodTypeAny, {
289
+ type: "text";
290
+ text: string;
291
+ }, {
292
+ type: "text";
293
+ text: string;
294
+ }>, z.ZodObject<{
295
+ type: z.ZodLiteral<"image">;
296
+ image: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>, z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>]>, z.ZodType<URL, z.ZodTypeDef, URL>]>;
297
+ mediaType: z.ZodOptional<z.ZodString>;
298
+ }, "strict", z.ZodTypeAny, {
299
+ type: "image";
300
+ image: string | ArrayBuffer | Uint8Array<ArrayBuffer> | Buffer<ArrayBufferLike> | URL;
301
+ mediaType?: string | undefined;
302
+ }, {
303
+ type: "image";
304
+ image: string | ArrayBuffer | Uint8Array<ArrayBuffer> | Buffer<ArrayBufferLike> | URL;
305
+ mediaType?: string | undefined;
306
+ }>, z.ZodObject<{
307
+ type: z.ZodLiteral<"file">;
308
+ data: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>, z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>]>, z.ZodType<URL, z.ZodTypeDef, URL>]>;
309
+ mediaType: z.ZodString;
310
+ filename: z.ZodOptional<z.ZodString>;
311
+ }, "strict", z.ZodTypeAny, {
312
+ type: "file";
313
+ data: string | ArrayBuffer | Uint8Array<ArrayBuffer> | Buffer<ArrayBufferLike> | URL;
314
+ mediaType: string;
315
+ filename?: string | undefined;
316
+ }, {
317
+ type: "file";
318
+ data: string | ArrayBuffer | Uint8Array<ArrayBuffer> | Buffer<ArrayBufferLike> | URL;
319
+ mediaType: string;
320
+ filename?: string | undefined;
321
+ }>]>, "many">]>;
322
+ }, "strict", z.ZodTypeAny, {
323
+ content: string | ({
324
+ type: "text";
325
+ text: string;
326
+ } | {
327
+ type: "image";
328
+ image: string | ArrayBuffer | Uint8Array<ArrayBuffer> | Buffer<ArrayBufferLike> | URL;
329
+ mediaType?: string | undefined;
330
+ } | {
331
+ type: "file";
332
+ data: string | ArrayBuffer | Uint8Array<ArrayBuffer> | Buffer<ArrayBufferLike> | URL;
333
+ mediaType: string;
334
+ filename?: string | undefined;
335
+ })[];
336
+ role: "user";
337
+ }, {
338
+ content: string | ({
339
+ type: "text";
340
+ text: string;
341
+ } | {
342
+ type: "image";
343
+ image: string | ArrayBuffer | Uint8Array<ArrayBuffer> | Buffer<ArrayBufferLike> | URL;
344
+ mediaType?: string | undefined;
345
+ } | {
346
+ type: "file";
347
+ data: string | ArrayBuffer | Uint8Array<ArrayBuffer> | Buffer<ArrayBufferLike> | URL;
348
+ mediaType: string;
349
+ filename?: string | undefined;
350
+ })[];
351
+ role: "user";
352
+ }>;
353
+ /**
354
+ * An assistant message, representing the response from the model.
355
+ */
356
+ export declare const hankweaveAssistantModelMessageSchema: z.ZodObject<{
357
+ role: z.ZodLiteral<"assistant">;
358
+ content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{
359
+ type: z.ZodLiteral<"text">;
360
+ text: z.ZodString;
361
+ }, "strict", z.ZodTypeAny, {
362
+ type: "text";
363
+ text: string;
364
+ }, {
365
+ type: "text";
366
+ text: string;
367
+ }>, z.ZodObject<{
368
+ type: z.ZodLiteral<"tool-call">;
369
+ toolCallId: z.ZodString;
370
+ toolName: z.ZodString;
371
+ input: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>;
372
+ }, "strict", z.ZodTypeAny, {
373
+ type: "tool-call";
374
+ input: Record<string, JsonValue>;
375
+ toolCallId: string;
376
+ toolName: string;
377
+ }, {
378
+ type: "tool-call";
379
+ input: Record<string, JsonValue>;
380
+ toolCallId: string;
381
+ toolName: string;
382
+ }>]>, "many">]>;
383
+ }, "strict", z.ZodTypeAny, {
384
+ content: string | ({
385
+ type: "text";
386
+ text: string;
387
+ } | {
388
+ type: "tool-call";
389
+ input: Record<string, JsonValue>;
390
+ toolCallId: string;
391
+ toolName: string;
392
+ })[];
393
+ role: "assistant";
394
+ }, {
395
+ content: string | ({
396
+ type: "text";
397
+ text: string;
398
+ } | {
399
+ type: "tool-call";
400
+ input: Record<string, JsonValue>;
401
+ toolCallId: string;
402
+ toolName: string;
403
+ })[];
404
+ role: "assistant";
405
+ }>;
406
+ /**
407
+ * A tool message, providing the results of tool calls back to the model.
408
+ */
409
+ export declare const hankweaveToolModelMessageSchema: z.ZodObject<{
410
+ role: z.ZodLiteral<"tool">;
411
+ content: z.ZodArray<z.ZodObject<{
412
+ type: z.ZodLiteral<"tool-result">;
413
+ toolCallId: z.ZodString;
414
+ toolName: z.ZodString;
415
+ output: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
416
+ type: z.ZodLiteral<"text">;
417
+ value: z.ZodString;
418
+ }, "strict", z.ZodTypeAny, {
419
+ type: "text";
420
+ value: string;
421
+ }, {
422
+ type: "text";
423
+ value: string;
424
+ }>, z.ZodObject<{
425
+ type: z.ZodLiteral<"json">;
426
+ value: z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>;
427
+ }, "strict", z.ZodTypeAny, {
428
+ type: "json";
429
+ value: JsonValue;
430
+ }, {
431
+ type: "json";
432
+ value: JsonValue;
433
+ }>, z.ZodObject<{
434
+ type: z.ZodLiteral<"error-text">;
435
+ value: z.ZodString;
436
+ }, "strict", z.ZodTypeAny, {
437
+ type: "error-text";
438
+ value: string;
439
+ }, {
440
+ type: "error-text";
441
+ value: string;
442
+ }>, z.ZodObject<{
443
+ type: z.ZodLiteral<"error-json">;
444
+ value: z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>;
445
+ }, "strict", z.ZodTypeAny, {
446
+ type: "error-json";
447
+ value: JsonValue;
448
+ }, {
449
+ type: "error-json";
450
+ value: JsonValue;
451
+ }>, z.ZodObject<{
452
+ type: z.ZodLiteral<"content">;
453
+ value: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
454
+ type: z.ZodLiteral<"text">;
455
+ text: z.ZodString;
456
+ }, "strict", z.ZodTypeAny, {
457
+ type: "text";
458
+ text: string;
459
+ }, {
460
+ type: "text";
461
+ text: string;
462
+ }>, z.ZodObject<{
463
+ type: z.ZodLiteral<"media">;
464
+ data: z.ZodString;
465
+ mediaType: z.ZodString;
466
+ }, "strict", z.ZodTypeAny, {
467
+ type: "media";
468
+ data: string;
469
+ mediaType: string;
470
+ }, {
471
+ type: "media";
472
+ data: string;
473
+ mediaType: string;
474
+ }>]>, "many">;
475
+ }, "strict", z.ZodTypeAny, {
476
+ type: "content";
477
+ value: ({
478
+ type: "text";
479
+ text: string;
480
+ } | {
481
+ type: "media";
482
+ data: string;
483
+ mediaType: string;
484
+ })[];
485
+ }, {
486
+ type: "content";
487
+ value: ({
488
+ type: "text";
489
+ text: string;
490
+ } | {
491
+ type: "media";
492
+ data: string;
493
+ mediaType: string;
494
+ })[];
495
+ }>]>;
496
+ experimental_content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
497
+ type: z.ZodLiteral<"text">;
498
+ text: z.ZodString;
499
+ }, "strict", z.ZodTypeAny, {
500
+ type: "text";
501
+ text: string;
502
+ }, {
503
+ type: "text";
504
+ text: string;
505
+ }>, z.ZodObject<{
506
+ type: z.ZodLiteral<"media">;
507
+ data: z.ZodString;
508
+ mediaType: z.ZodString;
509
+ }, "strict", z.ZodTypeAny, {
510
+ type: "media";
511
+ data: string;
512
+ mediaType: string;
513
+ }, {
514
+ type: "media";
515
+ data: string;
516
+ mediaType: string;
517
+ }>]>, "many">>;
518
+ isError: z.ZodOptional<z.ZodBoolean>;
519
+ }, "strict", z.ZodTypeAny, {
520
+ type: "tool-result";
521
+ toolCallId: string;
522
+ toolName: string;
523
+ output: {
524
+ type: "text";
525
+ value: string;
526
+ } | {
527
+ type: "json";
528
+ value: JsonValue;
529
+ } | {
530
+ type: "error-text";
531
+ value: string;
532
+ } | {
533
+ type: "error-json";
534
+ value: JsonValue;
535
+ } | {
536
+ type: "content";
537
+ value: ({
538
+ type: "text";
539
+ text: string;
540
+ } | {
541
+ type: "media";
542
+ data: string;
543
+ mediaType: string;
544
+ })[];
545
+ };
546
+ experimental_content?: ({
547
+ type: "text";
548
+ text: string;
549
+ } | {
550
+ type: "media";
551
+ data: string;
552
+ mediaType: string;
553
+ })[] | undefined;
554
+ isError?: boolean | undefined;
555
+ }, {
556
+ type: "tool-result";
557
+ toolCallId: string;
558
+ toolName: string;
559
+ output: {
560
+ type: "text";
561
+ value: string;
562
+ } | {
563
+ type: "json";
564
+ value: JsonValue;
565
+ } | {
566
+ type: "error-text";
567
+ value: string;
568
+ } | {
569
+ type: "error-json";
570
+ value: JsonValue;
571
+ } | {
572
+ type: "content";
573
+ value: ({
574
+ type: "text";
575
+ text: string;
576
+ } | {
577
+ type: "media";
578
+ data: string;
579
+ mediaType: string;
580
+ })[];
581
+ };
582
+ experimental_content?: ({
583
+ type: "text";
584
+ text: string;
585
+ } | {
586
+ type: "media";
587
+ data: string;
588
+ mediaType: string;
589
+ })[] | undefined;
590
+ isError?: boolean | undefined;
591
+ }>, "many">;
592
+ }, "strict", z.ZodTypeAny, {
593
+ content: {
594
+ type: "tool-result";
595
+ toolCallId: string;
596
+ toolName: string;
597
+ output: {
598
+ type: "text";
599
+ value: string;
600
+ } | {
601
+ type: "json";
602
+ value: JsonValue;
603
+ } | {
604
+ type: "error-text";
605
+ value: string;
606
+ } | {
607
+ type: "error-json";
608
+ value: JsonValue;
609
+ } | {
610
+ type: "content";
611
+ value: ({
612
+ type: "text";
613
+ text: string;
614
+ } | {
615
+ type: "media";
616
+ data: string;
617
+ mediaType: string;
618
+ })[];
619
+ };
620
+ experimental_content?: ({
621
+ type: "text";
622
+ text: string;
623
+ } | {
624
+ type: "media";
625
+ data: string;
626
+ mediaType: string;
627
+ })[] | undefined;
628
+ isError?: boolean | undefined;
629
+ }[];
630
+ role: "tool";
631
+ }, {
632
+ content: {
633
+ type: "tool-result";
634
+ toolCallId: string;
635
+ toolName: string;
636
+ output: {
637
+ type: "text";
638
+ value: string;
639
+ } | {
640
+ type: "json";
641
+ value: JsonValue;
642
+ } | {
643
+ type: "error-text";
644
+ value: string;
645
+ } | {
646
+ type: "error-json";
647
+ value: JsonValue;
648
+ } | {
649
+ type: "content";
650
+ value: ({
651
+ type: "text";
652
+ text: string;
653
+ } | {
654
+ type: "media";
655
+ data: string;
656
+ mediaType: string;
657
+ })[];
658
+ };
659
+ experimental_content?: ({
660
+ type: "text";
661
+ text: string;
662
+ } | {
663
+ type: "media";
664
+ data: string;
665
+ mediaType: string;
666
+ })[] | undefined;
667
+ isError?: boolean | undefined;
668
+ }[];
669
+ role: "tool";
670
+ }>;
671
+ /**
672
+ * The primary `HankweaveModelMessage` schema.
673
+ * It's a discriminated union of all possible message types, which is the most
674
+ * efficient and type-safe way to validate objects with a shared `role` key.
675
+ */
676
+ export declare const hankweaveModelMessageSchema: z.ZodDiscriminatedUnion<"role", [z.ZodObject<{
677
+ role: z.ZodLiteral<"system">;
678
+ content: z.ZodString;
679
+ }, "strict", z.ZodTypeAny, {
680
+ content: string;
681
+ role: "system";
682
+ }, {
683
+ content: string;
684
+ role: "system";
685
+ }>, z.ZodObject<{
686
+ role: z.ZodLiteral<"user">;
687
+ content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{
688
+ type: z.ZodLiteral<"text">;
689
+ text: z.ZodString;
690
+ }, "strict", z.ZodTypeAny, {
691
+ type: "text";
692
+ text: string;
693
+ }, {
694
+ type: "text";
695
+ text: string;
696
+ }>, z.ZodObject<{
697
+ type: z.ZodLiteral<"image">;
698
+ image: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>, z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>]>, z.ZodType<URL, z.ZodTypeDef, URL>]>;
699
+ mediaType: z.ZodOptional<z.ZodString>;
700
+ }, "strict", z.ZodTypeAny, {
701
+ type: "image";
702
+ image: string | ArrayBuffer | Uint8Array<ArrayBuffer> | Buffer<ArrayBufferLike> | URL;
703
+ mediaType?: string | undefined;
704
+ }, {
705
+ type: "image";
706
+ image: string | ArrayBuffer | Uint8Array<ArrayBuffer> | Buffer<ArrayBufferLike> | URL;
707
+ mediaType?: string | undefined;
708
+ }>, z.ZodObject<{
709
+ type: z.ZodLiteral<"file">;
710
+ data: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>, z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>, z.ZodType<Buffer<ArrayBufferLike>, z.ZodTypeDef, Buffer<ArrayBufferLike>>]>, z.ZodType<URL, z.ZodTypeDef, URL>]>;
711
+ mediaType: z.ZodString;
712
+ filename: z.ZodOptional<z.ZodString>;
713
+ }, "strict", z.ZodTypeAny, {
714
+ type: "file";
715
+ data: string | ArrayBuffer | Uint8Array<ArrayBuffer> | Buffer<ArrayBufferLike> | URL;
716
+ mediaType: string;
717
+ filename?: string | undefined;
718
+ }, {
719
+ type: "file";
720
+ data: string | ArrayBuffer | Uint8Array<ArrayBuffer> | Buffer<ArrayBufferLike> | URL;
721
+ mediaType: string;
722
+ filename?: string | undefined;
723
+ }>]>, "many">]>;
724
+ }, "strict", z.ZodTypeAny, {
725
+ content: string | ({
726
+ type: "text";
727
+ text: string;
728
+ } | {
729
+ type: "image";
730
+ image: string | ArrayBuffer | Uint8Array<ArrayBuffer> | Buffer<ArrayBufferLike> | URL;
731
+ mediaType?: string | undefined;
732
+ } | {
733
+ type: "file";
734
+ data: string | ArrayBuffer | Uint8Array<ArrayBuffer> | Buffer<ArrayBufferLike> | URL;
735
+ mediaType: string;
736
+ filename?: string | undefined;
737
+ })[];
738
+ role: "user";
739
+ }, {
740
+ content: string | ({
741
+ type: "text";
742
+ text: string;
743
+ } | {
744
+ type: "image";
745
+ image: string | ArrayBuffer | Uint8Array<ArrayBuffer> | Buffer<ArrayBufferLike> | URL;
746
+ mediaType?: string | undefined;
747
+ } | {
748
+ type: "file";
749
+ data: string | ArrayBuffer | Uint8Array<ArrayBuffer> | Buffer<ArrayBufferLike> | URL;
750
+ mediaType: string;
751
+ filename?: string | undefined;
752
+ })[];
753
+ role: "user";
754
+ }>, z.ZodObject<{
755
+ role: z.ZodLiteral<"assistant">;
756
+ content: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{
757
+ type: z.ZodLiteral<"text">;
758
+ text: z.ZodString;
759
+ }, "strict", z.ZodTypeAny, {
760
+ type: "text";
761
+ text: string;
762
+ }, {
763
+ type: "text";
764
+ text: string;
765
+ }>, z.ZodObject<{
766
+ type: z.ZodLiteral<"tool-call">;
767
+ toolCallId: z.ZodString;
768
+ toolName: z.ZodString;
769
+ input: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>>;
770
+ }, "strict", z.ZodTypeAny, {
771
+ type: "tool-call";
772
+ input: Record<string, JsonValue>;
773
+ toolCallId: string;
774
+ toolName: string;
775
+ }, {
776
+ type: "tool-call";
777
+ input: Record<string, JsonValue>;
778
+ toolCallId: string;
779
+ toolName: string;
780
+ }>]>, "many">]>;
781
+ }, "strict", z.ZodTypeAny, {
782
+ content: string | ({
783
+ type: "text";
784
+ text: string;
785
+ } | {
786
+ type: "tool-call";
787
+ input: Record<string, JsonValue>;
788
+ toolCallId: string;
789
+ toolName: string;
790
+ })[];
791
+ role: "assistant";
792
+ }, {
793
+ content: string | ({
794
+ type: "text";
795
+ text: string;
796
+ } | {
797
+ type: "tool-call";
798
+ input: Record<string, JsonValue>;
799
+ toolCallId: string;
800
+ toolName: string;
801
+ })[];
802
+ role: "assistant";
803
+ }>, z.ZodObject<{
804
+ role: z.ZodLiteral<"tool">;
805
+ content: z.ZodArray<z.ZodObject<{
806
+ type: z.ZodLiteral<"tool-result">;
807
+ toolCallId: z.ZodString;
808
+ toolName: z.ZodString;
809
+ output: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
810
+ type: z.ZodLiteral<"text">;
811
+ value: z.ZodString;
812
+ }, "strict", z.ZodTypeAny, {
813
+ type: "text";
814
+ value: string;
815
+ }, {
816
+ type: "text";
817
+ value: string;
818
+ }>, z.ZodObject<{
819
+ type: z.ZodLiteral<"json">;
820
+ value: z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>;
821
+ }, "strict", z.ZodTypeAny, {
822
+ type: "json";
823
+ value: JsonValue;
824
+ }, {
825
+ type: "json";
826
+ value: JsonValue;
827
+ }>, z.ZodObject<{
828
+ type: z.ZodLiteral<"error-text">;
829
+ value: z.ZodString;
830
+ }, "strict", z.ZodTypeAny, {
831
+ type: "error-text";
832
+ value: string;
833
+ }, {
834
+ type: "error-text";
835
+ value: string;
836
+ }>, z.ZodObject<{
837
+ type: z.ZodLiteral<"error-json">;
838
+ value: z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>;
839
+ }, "strict", z.ZodTypeAny, {
840
+ type: "error-json";
841
+ value: JsonValue;
842
+ }, {
843
+ type: "error-json";
844
+ value: JsonValue;
845
+ }>, z.ZodObject<{
846
+ type: z.ZodLiteral<"content">;
847
+ value: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
848
+ type: z.ZodLiteral<"text">;
849
+ text: z.ZodString;
850
+ }, "strict", z.ZodTypeAny, {
851
+ type: "text";
852
+ text: string;
853
+ }, {
854
+ type: "text";
855
+ text: string;
856
+ }>, z.ZodObject<{
857
+ type: z.ZodLiteral<"media">;
858
+ data: z.ZodString;
859
+ mediaType: z.ZodString;
860
+ }, "strict", z.ZodTypeAny, {
861
+ type: "media";
862
+ data: string;
863
+ mediaType: string;
864
+ }, {
865
+ type: "media";
866
+ data: string;
867
+ mediaType: string;
868
+ }>]>, "many">;
869
+ }, "strict", z.ZodTypeAny, {
870
+ type: "content";
871
+ value: ({
872
+ type: "text";
873
+ text: string;
874
+ } | {
875
+ type: "media";
876
+ data: string;
877
+ mediaType: string;
878
+ })[];
879
+ }, {
880
+ type: "content";
881
+ value: ({
882
+ type: "text";
883
+ text: string;
884
+ } | {
885
+ type: "media";
886
+ data: string;
887
+ mediaType: string;
888
+ })[];
889
+ }>]>;
890
+ experimental_content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
891
+ type: z.ZodLiteral<"text">;
892
+ text: z.ZodString;
893
+ }, "strict", z.ZodTypeAny, {
894
+ type: "text";
895
+ text: string;
896
+ }, {
897
+ type: "text";
898
+ text: string;
899
+ }>, z.ZodObject<{
900
+ type: z.ZodLiteral<"media">;
901
+ data: z.ZodString;
902
+ mediaType: z.ZodString;
903
+ }, "strict", z.ZodTypeAny, {
904
+ type: "media";
905
+ data: string;
906
+ mediaType: string;
907
+ }, {
908
+ type: "media";
909
+ data: string;
910
+ mediaType: string;
911
+ }>]>, "many">>;
912
+ isError: z.ZodOptional<z.ZodBoolean>;
913
+ }, "strict", z.ZodTypeAny, {
914
+ type: "tool-result";
915
+ toolCallId: string;
916
+ toolName: string;
917
+ output: {
918
+ type: "text";
919
+ value: string;
920
+ } | {
921
+ type: "json";
922
+ value: JsonValue;
923
+ } | {
924
+ type: "error-text";
925
+ value: string;
926
+ } | {
927
+ type: "error-json";
928
+ value: JsonValue;
929
+ } | {
930
+ type: "content";
931
+ value: ({
932
+ type: "text";
933
+ text: string;
934
+ } | {
935
+ type: "media";
936
+ data: string;
937
+ mediaType: string;
938
+ })[];
939
+ };
940
+ experimental_content?: ({
941
+ type: "text";
942
+ text: string;
943
+ } | {
944
+ type: "media";
945
+ data: string;
946
+ mediaType: string;
947
+ })[] | undefined;
948
+ isError?: boolean | undefined;
949
+ }, {
950
+ type: "tool-result";
951
+ toolCallId: string;
952
+ toolName: string;
953
+ output: {
954
+ type: "text";
955
+ value: string;
956
+ } | {
957
+ type: "json";
958
+ value: JsonValue;
959
+ } | {
960
+ type: "error-text";
961
+ value: string;
962
+ } | {
963
+ type: "error-json";
964
+ value: JsonValue;
965
+ } | {
966
+ type: "content";
967
+ value: ({
968
+ type: "text";
969
+ text: string;
970
+ } | {
971
+ type: "media";
972
+ data: string;
973
+ mediaType: string;
974
+ })[];
975
+ };
976
+ experimental_content?: ({
977
+ type: "text";
978
+ text: string;
979
+ } | {
980
+ type: "media";
981
+ data: string;
982
+ mediaType: string;
983
+ })[] | undefined;
984
+ isError?: boolean | undefined;
985
+ }>, "many">;
986
+ }, "strict", z.ZodTypeAny, {
987
+ content: {
988
+ type: "tool-result";
989
+ toolCallId: string;
990
+ toolName: string;
991
+ output: {
992
+ type: "text";
993
+ value: string;
994
+ } | {
995
+ type: "json";
996
+ value: JsonValue;
997
+ } | {
998
+ type: "error-text";
999
+ value: string;
1000
+ } | {
1001
+ type: "error-json";
1002
+ value: JsonValue;
1003
+ } | {
1004
+ type: "content";
1005
+ value: ({
1006
+ type: "text";
1007
+ text: string;
1008
+ } | {
1009
+ type: "media";
1010
+ data: string;
1011
+ mediaType: string;
1012
+ })[];
1013
+ };
1014
+ experimental_content?: ({
1015
+ type: "text";
1016
+ text: string;
1017
+ } | {
1018
+ type: "media";
1019
+ data: string;
1020
+ mediaType: string;
1021
+ })[] | undefined;
1022
+ isError?: boolean | undefined;
1023
+ }[];
1024
+ role: "tool";
1025
+ }, {
1026
+ content: {
1027
+ type: "tool-result";
1028
+ toolCallId: string;
1029
+ toolName: string;
1030
+ output: {
1031
+ type: "text";
1032
+ value: string;
1033
+ } | {
1034
+ type: "json";
1035
+ value: JsonValue;
1036
+ } | {
1037
+ type: "error-text";
1038
+ value: string;
1039
+ } | {
1040
+ type: "error-json";
1041
+ value: JsonValue;
1042
+ } | {
1043
+ type: "content";
1044
+ value: ({
1045
+ type: "text";
1046
+ text: string;
1047
+ } | {
1048
+ type: "media";
1049
+ data: string;
1050
+ mediaType: string;
1051
+ })[];
1052
+ };
1053
+ experimental_content?: ({
1054
+ type: "text";
1055
+ text: string;
1056
+ } | {
1057
+ type: "media";
1058
+ data: string;
1059
+ mediaType: string;
1060
+ })[] | undefined;
1061
+ isError?: boolean | undefined;
1062
+ }[];
1063
+ role: "tool";
1064
+ }>]>;
1065
+ export type HankweaveModelMessage = z.infer<typeof hankweaveModelMessageSchema>;
1066
+ export type HankweaveSystemModelMessage = z.infer<typeof hankweaveSystemModelMessageSchema>;
1067
+ export type HankweaveUserModelMessage = z.infer<typeof hankweaveUserModelMessageSchema>;
1068
+ export type HankweaveAssistantModelMessage = z.infer<typeof hankweaveAssistantModelMessageSchema>;
1069
+ export type HankweaveToolModelMessage = z.infer<typeof hankweaveToolModelMessageSchema>;
1070
+ export {};