@machinemetrics/agent-event-protocol 0.1.1 → 0.2.0

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/core.d.cts CHANGED
@@ -1,11 +1,10 @@
1
- export { h as AbortedEvent, a as ActionResult, i as AgentEvent, b as AgentRequest, A as AssistantContentBlock, C as ContinuationEvent, D as DoneEvent, c as ErrorCode, g as ErrorEvent, E as EventStage, F as FinishReason, I as InputMessage, M as MetadataEvent, T as TextEvent, d as ThinkingEvent, e as ToolCallEvent, f as ToolResultEvent, U as UserContentBlock } from './types--3D3jbpT.cjs';
1
+ export { h as AbortedEvent, a as ActionResult, i as AgentEvent, b as AgentRequest, A as AssistantContentBlock, C as ContinuationEvent, D as DoneEvent, c as ErrorCode, g as ErrorEvent, E as EventStage, F as FinishReason, I as InputMessage, M as MetadataEvent, T as TextEvent, d as ThinkingEvent, e as ToolCallEvent, f as ToolResultEvent, U as UserContentBlock } from './types-HORFdRxd.cjs';
2
2
  import { z } from 'zod';
3
3
 
4
4
  /**
5
- * Zod schema for validating user content blocks.
6
- * Currently only supports text; extensible for multimodal.
5
+ * Zod schema for a user text block.
7
6
  */
8
- declare const UserContentBlockSchema: z.ZodObject<{
7
+ declare const UserTextBlockSchema: z.ZodObject<{
9
8
  type: z.ZodLiteral<"text">;
10
9
  text: z.ZodString;
11
10
  }, "strip", z.ZodTypeAny, {
@@ -15,6 +14,56 @@ declare const UserContentBlockSchema: z.ZodObject<{
15
14
  text: string;
16
15
  type: "text";
17
16
  }>;
17
+ declare const MediaTypeSchema: z.ZodString;
18
+ /**
19
+ * Zod schema for a user attachment block: a file the user uploaded ahead of
20
+ * the message and now refers to by id. How the file reaches the model (an
21
+ * image, a document, extracted text, a tool) is the server's decision.
22
+ */
23
+ declare const UserAttachmentBlockSchema: z.ZodObject<{
24
+ type: z.ZodLiteral<"attachment">;
25
+ attachmentId: z.ZodString;
26
+ mimeType: z.ZodString;
27
+ name: z.ZodOptional<z.ZodString>;
28
+ }, "strip", z.ZodTypeAny, {
29
+ type: "attachment";
30
+ attachmentId: string;
31
+ mimeType: string;
32
+ name?: string | undefined;
33
+ }, {
34
+ type: "attachment";
35
+ attachmentId: string;
36
+ mimeType: string;
37
+ name?: string | undefined;
38
+ }>;
39
+ /**
40
+ * Zod schema for validating user content blocks: text or an attachment.
41
+ */
42
+ declare const UserContentBlockSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
43
+ type: z.ZodLiteral<"text">;
44
+ text: z.ZodString;
45
+ }, "strip", z.ZodTypeAny, {
46
+ text: string;
47
+ type: "text";
48
+ }, {
49
+ text: string;
50
+ type: "text";
51
+ }>, z.ZodObject<{
52
+ type: z.ZodLiteral<"attachment">;
53
+ attachmentId: z.ZodString;
54
+ mimeType: z.ZodString;
55
+ name: z.ZodOptional<z.ZodString>;
56
+ }, "strip", z.ZodTypeAny, {
57
+ type: "attachment";
58
+ attachmentId: string;
59
+ mimeType: string;
60
+ name?: string | undefined;
61
+ }, {
62
+ type: "attachment";
63
+ attachmentId: string;
64
+ mimeType: string;
65
+ name?: string | undefined;
66
+ }>]>;
18
67
  /**
19
68
  * Zod schema for validating assistant content blocks.
20
69
  * Discriminated union supporting text, thinking, tool_use, and tool_result.
@@ -78,7 +127,7 @@ declare const AssistantContentBlockSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
78
127
  * Zod schema for validating input messages.
79
128
  */
80
129
  declare const InputMessageSchema: z.ZodObject<{
81
- content: z.ZodArray<z.ZodObject<{
130
+ content: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
82
131
  type: z.ZodLiteral<"text">;
83
132
  text: z.ZodString;
84
133
  }, "strip", z.ZodTypeAny, {
@@ -87,17 +136,42 @@ declare const InputMessageSchema: z.ZodObject<{
87
136
  }, {
88
137
  text: string;
89
138
  type: "text";
90
- }>, "many">;
139
+ }>, z.ZodObject<{
140
+ type: z.ZodLiteral<"attachment">;
141
+ attachmentId: z.ZodString;
142
+ mimeType: z.ZodString;
143
+ name: z.ZodOptional<z.ZodString>;
144
+ }, "strip", z.ZodTypeAny, {
145
+ type: "attachment";
146
+ attachmentId: string;
147
+ mimeType: string;
148
+ name?: string | undefined;
149
+ }, {
150
+ type: "attachment";
151
+ attachmentId: string;
152
+ mimeType: string;
153
+ name?: string | undefined;
154
+ }>]>, "many">;
91
155
  }, "strip", z.ZodTypeAny, {
92
- content: {
156
+ content: ({
93
157
  text: string;
94
158
  type: "text";
95
- }[];
159
+ } | {
160
+ type: "attachment";
161
+ attachmentId: string;
162
+ mimeType: string;
163
+ name?: string | undefined;
164
+ })[];
96
165
  }, {
97
- content: {
166
+ content: ({
98
167
  text: string;
99
168
  type: "text";
100
- }[];
169
+ } | {
170
+ type: "attachment";
171
+ attachmentId: string;
172
+ mimeType: string;
173
+ name?: string | undefined;
174
+ })[];
101
175
  }>;
102
176
  /**
103
177
  * Zod schema for validating action results from continuation events.
@@ -127,7 +201,7 @@ declare const ActionResultSchema: z.ZodObject<{
127
201
  */
128
202
  declare const AgentRequestSchema: z.ZodObject<{
129
203
  messages: z.ZodArray<z.ZodObject<{
130
- content: z.ZodArray<z.ZodObject<{
204
+ content: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
131
205
  type: z.ZodLiteral<"text">;
132
206
  text: z.ZodString;
133
207
  }, "strip", z.ZodTypeAny, {
@@ -136,17 +210,42 @@ declare const AgentRequestSchema: z.ZodObject<{
136
210
  }, {
137
211
  text: string;
138
212
  type: "text";
139
- }>, "many">;
213
+ }>, z.ZodObject<{
214
+ type: z.ZodLiteral<"attachment">;
215
+ attachmentId: z.ZodString;
216
+ mimeType: z.ZodString;
217
+ name: z.ZodOptional<z.ZodString>;
218
+ }, "strip", z.ZodTypeAny, {
219
+ type: "attachment";
220
+ attachmentId: string;
221
+ mimeType: string;
222
+ name?: string | undefined;
223
+ }, {
224
+ type: "attachment";
225
+ attachmentId: string;
226
+ mimeType: string;
227
+ name?: string | undefined;
228
+ }>]>, "many">;
140
229
  }, "strip", z.ZodTypeAny, {
141
- content: {
230
+ content: ({
142
231
  text: string;
143
232
  type: "text";
144
- }[];
233
+ } | {
234
+ type: "attachment";
235
+ attachmentId: string;
236
+ mimeType: string;
237
+ name?: string | undefined;
238
+ })[];
145
239
  }, {
146
- content: {
240
+ content: ({
147
241
  text: string;
148
242
  type: "text";
149
- }[];
243
+ } | {
244
+ type: "attachment";
245
+ attachmentId: string;
246
+ mimeType: string;
247
+ name?: string | undefined;
248
+ })[];
150
249
  }>, "many">;
151
250
  threadId: z.ZodOptional<z.ZodString>;
152
251
  context: z.ZodOptional<z.ZodObject<{
@@ -212,10 +311,15 @@ declare const AgentRequestSchema: z.ZodObject<{
212
311
  }, z.ZodTypeAny, "passthrough">>>;
213
312
  }, "strip", z.ZodTypeAny, {
214
313
  messages: {
215
- content: {
314
+ content: ({
216
315
  text: string;
217
316
  type: "text";
218
- }[];
317
+ } | {
318
+ type: "attachment";
319
+ attachmentId: string;
320
+ mimeType: string;
321
+ name?: string | undefined;
322
+ })[];
219
323
  }[];
220
324
  threadId?: string | undefined;
221
325
  context?: z.objectOutputType<{
@@ -241,10 +345,15 @@ declare const AgentRequestSchema: z.ZodObject<{
241
345
  }, z.ZodTypeAny, "passthrough"> | undefined;
242
346
  }, {
243
347
  messages: {
244
- content: {
348
+ content: ({
245
349
  text: string;
246
350
  type: "text";
247
- }[];
351
+ } | {
352
+ type: "attachment";
353
+ attachmentId: string;
354
+ mimeType: string;
355
+ name?: string | undefined;
356
+ })[];
248
357
  }[];
249
358
  threadId?: string | undefined;
250
359
  context?: z.objectInputType<{
@@ -276,7 +385,7 @@ declare const EventStageSchema: z.ZodEnum<["start", "delta", "stop"]>;
276
385
  /**
277
386
  * Zod schema for protocol error codes.
278
387
  */
279
- declare const ErrorCodeSchema: z.ZodEnum<["auth_failed", "thread_not_found", "thread_access_denied", "invalid_message_format", "message_too_large", "rate_limit_exceeded", "stream_timeout", "agent_error", "tool_error", "internal_error", "invalid_action_id"]>;
388
+ declare const ErrorCodeSchema: z.ZodEnum<["auth_failed", "thread_not_found", "thread_access_denied", "invalid_message_format", "message_too_large", "rate_limit_exceeded", "stream_timeout", "stream_stalled", "agent_error", "tool_error", "internal_error", "invalid_action_id"]>;
280
389
  /**
281
390
  * Zod schema for stream finish reasons.
282
391
  */
@@ -610,7 +719,7 @@ declare const ErrorEventSchema: z.ZodObject<{
610
719
  event: z.ZodLiteral<"error">;
611
720
  requestId: z.ZodString;
612
721
  message: z.ZodString;
613
- code: z.ZodOptional<z.ZodEnum<["auth_failed", "thread_not_found", "thread_access_denied", "invalid_message_format", "message_too_large", "rate_limit_exceeded", "stream_timeout", "agent_error", "tool_error", "internal_error", "invalid_action_id"]>>;
722
+ code: z.ZodOptional<z.ZodEnum<["auth_failed", "thread_not_found", "thread_access_denied", "invalid_message_format", "message_too_large", "rate_limit_exceeded", "stream_timeout", "stream_stalled", "agent_error", "tool_error", "internal_error", "invalid_action_id"]>>;
614
723
  retryable: z.ZodOptional<z.ZodBoolean>;
615
724
  timestamp: z.ZodString;
616
725
  }, "strip", z.ZodTypeAny, {
@@ -618,14 +727,14 @@ declare const ErrorEventSchema: z.ZodObject<{
618
727
  event: "error";
619
728
  requestId: string;
620
729
  timestamp: string;
621
- code?: "auth_failed" | "thread_not_found" | "thread_access_denied" | "invalid_message_format" | "message_too_large" | "rate_limit_exceeded" | "stream_timeout" | "agent_error" | "tool_error" | "internal_error" | "invalid_action_id" | undefined;
730
+ code?: "auth_failed" | "thread_not_found" | "thread_access_denied" | "invalid_message_format" | "message_too_large" | "rate_limit_exceeded" | "stream_timeout" | "stream_stalled" | "agent_error" | "tool_error" | "internal_error" | "invalid_action_id" | undefined;
622
731
  retryable?: boolean | undefined;
623
732
  }, {
624
733
  message: string;
625
734
  event: "error";
626
735
  requestId: string;
627
736
  timestamp: string;
628
- code?: "auth_failed" | "thread_not_found" | "thread_access_denied" | "invalid_message_format" | "message_too_large" | "rate_limit_exceeded" | "stream_timeout" | "agent_error" | "tool_error" | "internal_error" | "invalid_action_id" | undefined;
737
+ code?: "auth_failed" | "thread_not_found" | "thread_access_denied" | "invalid_message_format" | "message_too_large" | "rate_limit_exceeded" | "stream_timeout" | "stream_stalled" | "agent_error" | "tool_error" | "internal_error" | "invalid_action_id" | undefined;
629
738
  retryable?: boolean | undefined;
630
739
  }>;
631
740
  /**
@@ -973,7 +1082,7 @@ declare const AgentEventSchema: z.ZodDiscriminatedUnion<"event", [z.ZodObject<{
973
1082
  event: z.ZodLiteral<"error">;
974
1083
  requestId: z.ZodString;
975
1084
  message: z.ZodString;
976
- code: z.ZodOptional<z.ZodEnum<["auth_failed", "thread_not_found", "thread_access_denied", "invalid_message_format", "message_too_large", "rate_limit_exceeded", "stream_timeout", "agent_error", "tool_error", "internal_error", "invalid_action_id"]>>;
1085
+ code: z.ZodOptional<z.ZodEnum<["auth_failed", "thread_not_found", "thread_access_denied", "invalid_message_format", "message_too_large", "rate_limit_exceeded", "stream_timeout", "stream_stalled", "agent_error", "tool_error", "internal_error", "invalid_action_id"]>>;
977
1086
  retryable: z.ZodOptional<z.ZodBoolean>;
978
1087
  timestamp: z.ZodString;
979
1088
  }, "strip", z.ZodTypeAny, {
@@ -981,14 +1090,14 @@ declare const AgentEventSchema: z.ZodDiscriminatedUnion<"event", [z.ZodObject<{
981
1090
  event: "error";
982
1091
  requestId: string;
983
1092
  timestamp: string;
984
- code?: "auth_failed" | "thread_not_found" | "thread_access_denied" | "invalid_message_format" | "message_too_large" | "rate_limit_exceeded" | "stream_timeout" | "agent_error" | "tool_error" | "internal_error" | "invalid_action_id" | undefined;
1093
+ code?: "auth_failed" | "thread_not_found" | "thread_access_denied" | "invalid_message_format" | "message_too_large" | "rate_limit_exceeded" | "stream_timeout" | "stream_stalled" | "agent_error" | "tool_error" | "internal_error" | "invalid_action_id" | undefined;
985
1094
  retryable?: boolean | undefined;
986
1095
  }, {
987
1096
  message: string;
988
1097
  event: "error";
989
1098
  requestId: string;
990
1099
  timestamp: string;
991
- code?: "auth_failed" | "thread_not_found" | "thread_access_denied" | "invalid_message_format" | "message_too_large" | "rate_limit_exceeded" | "stream_timeout" | "agent_error" | "tool_error" | "internal_error" | "invalid_action_id" | undefined;
1100
+ code?: "auth_failed" | "thread_not_found" | "thread_access_denied" | "invalid_message_format" | "message_too_large" | "rate_limit_exceeded" | "stream_timeout" | "stream_stalled" | "agent_error" | "tool_error" | "internal_error" | "invalid_action_id" | undefined;
992
1101
  retryable?: boolean | undefined;
993
1102
  }>, z.ZodObject<{
994
1103
  event: z.ZodLiteral<"aborted">;
@@ -1045,4 +1154,4 @@ declare const EVENT_TYPES: readonly ["metadata", "text", "thinking", "tool_call"
1045
1154
  */
1046
1155
  type EventType = (typeof EVENT_TYPES)[number];
1047
1156
 
1048
- export { AbortedEventSchema, ActionResultSchema, AgentEventSchema, AgentRequestSchema, AssistantContentBlockSchema, ContinuationEventSchema, DoneEventSchema, EVENT_TYPES, ErrorCodeSchema, ErrorEventSchema, EventStageSchema, type EventType, FinishReasonSchema, InputMessageSchema, MetadataEventSchema, PROTOCOL_VERSION, TextEventSchema, ThinkingEventSchema, ToolCallEventSchema, ToolResultEventSchema, UserContentBlockSchema };
1157
+ export { AbortedEventSchema, ActionResultSchema, AgentEventSchema, AgentRequestSchema, AssistantContentBlockSchema, ContinuationEventSchema, DoneEventSchema, EVENT_TYPES, ErrorCodeSchema, ErrorEventSchema, EventStageSchema, type EventType, FinishReasonSchema, InputMessageSchema, MediaTypeSchema, MetadataEventSchema, PROTOCOL_VERSION, TextEventSchema, ThinkingEventSchema, ToolCallEventSchema, ToolResultEventSchema, UserAttachmentBlockSchema, UserContentBlockSchema, UserTextBlockSchema };
package/dist/core.d.ts CHANGED
@@ -1,11 +1,10 @@
1
- export { h as AbortedEvent, a as ActionResult, i as AgentEvent, b as AgentRequest, A as AssistantContentBlock, C as ContinuationEvent, D as DoneEvent, c as ErrorCode, g as ErrorEvent, E as EventStage, F as FinishReason, I as InputMessage, M as MetadataEvent, T as TextEvent, d as ThinkingEvent, e as ToolCallEvent, f as ToolResultEvent, U as UserContentBlock } from './types--3D3jbpT.js';
1
+ export { h as AbortedEvent, a as ActionResult, i as AgentEvent, b as AgentRequest, A as AssistantContentBlock, C as ContinuationEvent, D as DoneEvent, c as ErrorCode, g as ErrorEvent, E as EventStage, F as FinishReason, I as InputMessage, M as MetadataEvent, T as TextEvent, d as ThinkingEvent, e as ToolCallEvent, f as ToolResultEvent, U as UserContentBlock } from './types-HORFdRxd.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  /**
5
- * Zod schema for validating user content blocks.
6
- * Currently only supports text; extensible for multimodal.
5
+ * Zod schema for a user text block.
7
6
  */
8
- declare const UserContentBlockSchema: z.ZodObject<{
7
+ declare const UserTextBlockSchema: z.ZodObject<{
9
8
  type: z.ZodLiteral<"text">;
10
9
  text: z.ZodString;
11
10
  }, "strip", z.ZodTypeAny, {
@@ -15,6 +14,56 @@ declare const UserContentBlockSchema: z.ZodObject<{
15
14
  text: string;
16
15
  type: "text";
17
16
  }>;
17
+ declare const MediaTypeSchema: z.ZodString;
18
+ /**
19
+ * Zod schema for a user attachment block: a file the user uploaded ahead of
20
+ * the message and now refers to by id. How the file reaches the model (an
21
+ * image, a document, extracted text, a tool) is the server's decision.
22
+ */
23
+ declare const UserAttachmentBlockSchema: z.ZodObject<{
24
+ type: z.ZodLiteral<"attachment">;
25
+ attachmentId: z.ZodString;
26
+ mimeType: z.ZodString;
27
+ name: z.ZodOptional<z.ZodString>;
28
+ }, "strip", z.ZodTypeAny, {
29
+ type: "attachment";
30
+ attachmentId: string;
31
+ mimeType: string;
32
+ name?: string | undefined;
33
+ }, {
34
+ type: "attachment";
35
+ attachmentId: string;
36
+ mimeType: string;
37
+ name?: string | undefined;
38
+ }>;
39
+ /**
40
+ * Zod schema for validating user content blocks: text or an attachment.
41
+ */
42
+ declare const UserContentBlockSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
43
+ type: z.ZodLiteral<"text">;
44
+ text: z.ZodString;
45
+ }, "strip", z.ZodTypeAny, {
46
+ text: string;
47
+ type: "text";
48
+ }, {
49
+ text: string;
50
+ type: "text";
51
+ }>, z.ZodObject<{
52
+ type: z.ZodLiteral<"attachment">;
53
+ attachmentId: z.ZodString;
54
+ mimeType: z.ZodString;
55
+ name: z.ZodOptional<z.ZodString>;
56
+ }, "strip", z.ZodTypeAny, {
57
+ type: "attachment";
58
+ attachmentId: string;
59
+ mimeType: string;
60
+ name?: string | undefined;
61
+ }, {
62
+ type: "attachment";
63
+ attachmentId: string;
64
+ mimeType: string;
65
+ name?: string | undefined;
66
+ }>]>;
18
67
  /**
19
68
  * Zod schema for validating assistant content blocks.
20
69
  * Discriminated union supporting text, thinking, tool_use, and tool_result.
@@ -78,7 +127,7 @@ declare const AssistantContentBlockSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
78
127
  * Zod schema for validating input messages.
79
128
  */
80
129
  declare const InputMessageSchema: z.ZodObject<{
81
- content: z.ZodArray<z.ZodObject<{
130
+ content: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
82
131
  type: z.ZodLiteral<"text">;
83
132
  text: z.ZodString;
84
133
  }, "strip", z.ZodTypeAny, {
@@ -87,17 +136,42 @@ declare const InputMessageSchema: z.ZodObject<{
87
136
  }, {
88
137
  text: string;
89
138
  type: "text";
90
- }>, "many">;
139
+ }>, z.ZodObject<{
140
+ type: z.ZodLiteral<"attachment">;
141
+ attachmentId: z.ZodString;
142
+ mimeType: z.ZodString;
143
+ name: z.ZodOptional<z.ZodString>;
144
+ }, "strip", z.ZodTypeAny, {
145
+ type: "attachment";
146
+ attachmentId: string;
147
+ mimeType: string;
148
+ name?: string | undefined;
149
+ }, {
150
+ type: "attachment";
151
+ attachmentId: string;
152
+ mimeType: string;
153
+ name?: string | undefined;
154
+ }>]>, "many">;
91
155
  }, "strip", z.ZodTypeAny, {
92
- content: {
156
+ content: ({
93
157
  text: string;
94
158
  type: "text";
95
- }[];
159
+ } | {
160
+ type: "attachment";
161
+ attachmentId: string;
162
+ mimeType: string;
163
+ name?: string | undefined;
164
+ })[];
96
165
  }, {
97
- content: {
166
+ content: ({
98
167
  text: string;
99
168
  type: "text";
100
- }[];
169
+ } | {
170
+ type: "attachment";
171
+ attachmentId: string;
172
+ mimeType: string;
173
+ name?: string | undefined;
174
+ })[];
101
175
  }>;
102
176
  /**
103
177
  * Zod schema for validating action results from continuation events.
@@ -127,7 +201,7 @@ declare const ActionResultSchema: z.ZodObject<{
127
201
  */
128
202
  declare const AgentRequestSchema: z.ZodObject<{
129
203
  messages: z.ZodArray<z.ZodObject<{
130
- content: z.ZodArray<z.ZodObject<{
204
+ content: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
131
205
  type: z.ZodLiteral<"text">;
132
206
  text: z.ZodString;
133
207
  }, "strip", z.ZodTypeAny, {
@@ -136,17 +210,42 @@ declare const AgentRequestSchema: z.ZodObject<{
136
210
  }, {
137
211
  text: string;
138
212
  type: "text";
139
- }>, "many">;
213
+ }>, z.ZodObject<{
214
+ type: z.ZodLiteral<"attachment">;
215
+ attachmentId: z.ZodString;
216
+ mimeType: z.ZodString;
217
+ name: z.ZodOptional<z.ZodString>;
218
+ }, "strip", z.ZodTypeAny, {
219
+ type: "attachment";
220
+ attachmentId: string;
221
+ mimeType: string;
222
+ name?: string | undefined;
223
+ }, {
224
+ type: "attachment";
225
+ attachmentId: string;
226
+ mimeType: string;
227
+ name?: string | undefined;
228
+ }>]>, "many">;
140
229
  }, "strip", z.ZodTypeAny, {
141
- content: {
230
+ content: ({
142
231
  text: string;
143
232
  type: "text";
144
- }[];
233
+ } | {
234
+ type: "attachment";
235
+ attachmentId: string;
236
+ mimeType: string;
237
+ name?: string | undefined;
238
+ })[];
145
239
  }, {
146
- content: {
240
+ content: ({
147
241
  text: string;
148
242
  type: "text";
149
- }[];
243
+ } | {
244
+ type: "attachment";
245
+ attachmentId: string;
246
+ mimeType: string;
247
+ name?: string | undefined;
248
+ })[];
150
249
  }>, "many">;
151
250
  threadId: z.ZodOptional<z.ZodString>;
152
251
  context: z.ZodOptional<z.ZodObject<{
@@ -212,10 +311,15 @@ declare const AgentRequestSchema: z.ZodObject<{
212
311
  }, z.ZodTypeAny, "passthrough">>>;
213
312
  }, "strip", z.ZodTypeAny, {
214
313
  messages: {
215
- content: {
314
+ content: ({
216
315
  text: string;
217
316
  type: "text";
218
- }[];
317
+ } | {
318
+ type: "attachment";
319
+ attachmentId: string;
320
+ mimeType: string;
321
+ name?: string | undefined;
322
+ })[];
219
323
  }[];
220
324
  threadId?: string | undefined;
221
325
  context?: z.objectOutputType<{
@@ -241,10 +345,15 @@ declare const AgentRequestSchema: z.ZodObject<{
241
345
  }, z.ZodTypeAny, "passthrough"> | undefined;
242
346
  }, {
243
347
  messages: {
244
- content: {
348
+ content: ({
245
349
  text: string;
246
350
  type: "text";
247
- }[];
351
+ } | {
352
+ type: "attachment";
353
+ attachmentId: string;
354
+ mimeType: string;
355
+ name?: string | undefined;
356
+ })[];
248
357
  }[];
249
358
  threadId?: string | undefined;
250
359
  context?: z.objectInputType<{
@@ -276,7 +385,7 @@ declare const EventStageSchema: z.ZodEnum<["start", "delta", "stop"]>;
276
385
  /**
277
386
  * Zod schema for protocol error codes.
278
387
  */
279
- declare const ErrorCodeSchema: z.ZodEnum<["auth_failed", "thread_not_found", "thread_access_denied", "invalid_message_format", "message_too_large", "rate_limit_exceeded", "stream_timeout", "agent_error", "tool_error", "internal_error", "invalid_action_id"]>;
388
+ declare const ErrorCodeSchema: z.ZodEnum<["auth_failed", "thread_not_found", "thread_access_denied", "invalid_message_format", "message_too_large", "rate_limit_exceeded", "stream_timeout", "stream_stalled", "agent_error", "tool_error", "internal_error", "invalid_action_id"]>;
280
389
  /**
281
390
  * Zod schema for stream finish reasons.
282
391
  */
@@ -610,7 +719,7 @@ declare const ErrorEventSchema: z.ZodObject<{
610
719
  event: z.ZodLiteral<"error">;
611
720
  requestId: z.ZodString;
612
721
  message: z.ZodString;
613
- code: z.ZodOptional<z.ZodEnum<["auth_failed", "thread_not_found", "thread_access_denied", "invalid_message_format", "message_too_large", "rate_limit_exceeded", "stream_timeout", "agent_error", "tool_error", "internal_error", "invalid_action_id"]>>;
722
+ code: z.ZodOptional<z.ZodEnum<["auth_failed", "thread_not_found", "thread_access_denied", "invalid_message_format", "message_too_large", "rate_limit_exceeded", "stream_timeout", "stream_stalled", "agent_error", "tool_error", "internal_error", "invalid_action_id"]>>;
614
723
  retryable: z.ZodOptional<z.ZodBoolean>;
615
724
  timestamp: z.ZodString;
616
725
  }, "strip", z.ZodTypeAny, {
@@ -618,14 +727,14 @@ declare const ErrorEventSchema: z.ZodObject<{
618
727
  event: "error";
619
728
  requestId: string;
620
729
  timestamp: string;
621
- code?: "auth_failed" | "thread_not_found" | "thread_access_denied" | "invalid_message_format" | "message_too_large" | "rate_limit_exceeded" | "stream_timeout" | "agent_error" | "tool_error" | "internal_error" | "invalid_action_id" | undefined;
730
+ code?: "auth_failed" | "thread_not_found" | "thread_access_denied" | "invalid_message_format" | "message_too_large" | "rate_limit_exceeded" | "stream_timeout" | "stream_stalled" | "agent_error" | "tool_error" | "internal_error" | "invalid_action_id" | undefined;
622
731
  retryable?: boolean | undefined;
623
732
  }, {
624
733
  message: string;
625
734
  event: "error";
626
735
  requestId: string;
627
736
  timestamp: string;
628
- code?: "auth_failed" | "thread_not_found" | "thread_access_denied" | "invalid_message_format" | "message_too_large" | "rate_limit_exceeded" | "stream_timeout" | "agent_error" | "tool_error" | "internal_error" | "invalid_action_id" | undefined;
737
+ code?: "auth_failed" | "thread_not_found" | "thread_access_denied" | "invalid_message_format" | "message_too_large" | "rate_limit_exceeded" | "stream_timeout" | "stream_stalled" | "agent_error" | "tool_error" | "internal_error" | "invalid_action_id" | undefined;
629
738
  retryable?: boolean | undefined;
630
739
  }>;
631
740
  /**
@@ -973,7 +1082,7 @@ declare const AgentEventSchema: z.ZodDiscriminatedUnion<"event", [z.ZodObject<{
973
1082
  event: z.ZodLiteral<"error">;
974
1083
  requestId: z.ZodString;
975
1084
  message: z.ZodString;
976
- code: z.ZodOptional<z.ZodEnum<["auth_failed", "thread_not_found", "thread_access_denied", "invalid_message_format", "message_too_large", "rate_limit_exceeded", "stream_timeout", "agent_error", "tool_error", "internal_error", "invalid_action_id"]>>;
1085
+ code: z.ZodOptional<z.ZodEnum<["auth_failed", "thread_not_found", "thread_access_denied", "invalid_message_format", "message_too_large", "rate_limit_exceeded", "stream_timeout", "stream_stalled", "agent_error", "tool_error", "internal_error", "invalid_action_id"]>>;
977
1086
  retryable: z.ZodOptional<z.ZodBoolean>;
978
1087
  timestamp: z.ZodString;
979
1088
  }, "strip", z.ZodTypeAny, {
@@ -981,14 +1090,14 @@ declare const AgentEventSchema: z.ZodDiscriminatedUnion<"event", [z.ZodObject<{
981
1090
  event: "error";
982
1091
  requestId: string;
983
1092
  timestamp: string;
984
- code?: "auth_failed" | "thread_not_found" | "thread_access_denied" | "invalid_message_format" | "message_too_large" | "rate_limit_exceeded" | "stream_timeout" | "agent_error" | "tool_error" | "internal_error" | "invalid_action_id" | undefined;
1093
+ code?: "auth_failed" | "thread_not_found" | "thread_access_denied" | "invalid_message_format" | "message_too_large" | "rate_limit_exceeded" | "stream_timeout" | "stream_stalled" | "agent_error" | "tool_error" | "internal_error" | "invalid_action_id" | undefined;
985
1094
  retryable?: boolean | undefined;
986
1095
  }, {
987
1096
  message: string;
988
1097
  event: "error";
989
1098
  requestId: string;
990
1099
  timestamp: string;
991
- code?: "auth_failed" | "thread_not_found" | "thread_access_denied" | "invalid_message_format" | "message_too_large" | "rate_limit_exceeded" | "stream_timeout" | "agent_error" | "tool_error" | "internal_error" | "invalid_action_id" | undefined;
1100
+ code?: "auth_failed" | "thread_not_found" | "thread_access_denied" | "invalid_message_format" | "message_too_large" | "rate_limit_exceeded" | "stream_timeout" | "stream_stalled" | "agent_error" | "tool_error" | "internal_error" | "invalid_action_id" | undefined;
992
1101
  retryable?: boolean | undefined;
993
1102
  }>, z.ZodObject<{
994
1103
  event: z.ZodLiteral<"aborted">;
@@ -1045,4 +1154,4 @@ declare const EVENT_TYPES: readonly ["metadata", "text", "thinking", "tool_call"
1045
1154
  */
1046
1155
  type EventType = (typeof EVENT_TYPES)[number];
1047
1156
 
1048
- export { AbortedEventSchema, ActionResultSchema, AgentEventSchema, AgentRequestSchema, AssistantContentBlockSchema, ContinuationEventSchema, DoneEventSchema, EVENT_TYPES, ErrorCodeSchema, ErrorEventSchema, EventStageSchema, type EventType, FinishReasonSchema, InputMessageSchema, MetadataEventSchema, PROTOCOL_VERSION, TextEventSchema, ThinkingEventSchema, ToolCallEventSchema, ToolResultEventSchema, UserContentBlockSchema };
1157
+ export { AbortedEventSchema, ActionResultSchema, AgentEventSchema, AgentRequestSchema, AssistantContentBlockSchema, ContinuationEventSchema, DoneEventSchema, EVENT_TYPES, ErrorCodeSchema, ErrorEventSchema, EventStageSchema, type EventType, FinishReasonSchema, InputMessageSchema, MediaTypeSchema, MetadataEventSchema, PROTOCOL_VERSION, TextEventSchema, ThinkingEventSchema, ToolCallEventSchema, ToolResultEventSchema, UserAttachmentBlockSchema, UserContentBlockSchema, UserTextBlockSchema };
package/dist/core.js CHANGED
@@ -15,13 +15,16 @@ import {
15
15
  EventStageSchema,
16
16
  FinishReasonSchema,
17
17
  InputMessageSchema,
18
+ MediaTypeSchema,
18
19
  MetadataEventSchema,
19
20
  TextEventSchema,
20
21
  ThinkingEventSchema,
21
22
  ToolCallEventSchema,
22
23
  ToolResultEventSchema,
23
- UserContentBlockSchema
24
- } from "./chunk-H5AXHRSE.js";
24
+ UserAttachmentBlockSchema,
25
+ UserContentBlockSchema,
26
+ UserTextBlockSchema
27
+ } from "./chunk-434TVYA5.js";
25
28
  export {
26
29
  AbortedEventSchema,
27
30
  ActionResultSchema,
@@ -36,12 +39,15 @@ export {
36
39
  EventStageSchema,
37
40
  FinishReasonSchema,
38
41
  InputMessageSchema,
42
+ MediaTypeSchema,
39
43
  MetadataEventSchema,
40
44
  PROTOCOL_VERSION,
41
45
  TextEventSchema,
42
46
  ThinkingEventSchema,
43
47
  ToolCallEventSchema,
44
48
  ToolResultEventSchema,
45
- UserContentBlockSchema
49
+ UserAttachmentBlockSchema,
50
+ UserContentBlockSchema,
51
+ UserTextBlockSchema
46
52
  };
47
53
  //# sourceMappingURL=core.js.map