@agen-ai/agent-protocol 0.1.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.
Files changed (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +101 -0
  3. package/dist/artifacts/index.d.ts +3 -0
  4. package/dist/artifacts/index.js +2 -0
  5. package/dist/artifacts/parsers.d.ts +5 -0
  6. package/dist/artifacts/parsers.js +12 -0
  7. package/dist/artifacts/types.d.ts +19 -0
  8. package/dist/artifacts/types.js +16 -0
  9. package/dist/capabilities/index.d.ts +3 -0
  10. package/dist/capabilities/index.js +2 -0
  11. package/dist/capabilities/parsers.d.ts +6 -0
  12. package/dist/capabilities/parsers.js +18 -0
  13. package/dist/capabilities/types.d.ts +96 -0
  14. package/dist/capabilities/types.js +20 -0
  15. package/dist/events/index.d.ts +3 -0
  16. package/dist/events/index.js +2 -0
  17. package/dist/events/parsers.d.ts +6 -0
  18. package/dist/events/parsers.js +16 -0
  19. package/dist/events/types.d.ts +78 -0
  20. package/dist/events/types.js +21 -0
  21. package/dist/foundation/index.d.ts +4 -0
  22. package/dist/foundation/index.js +3 -0
  23. package/dist/foundation/ordering.d.ts +2 -0
  24. package/dist/foundation/ordering.js +15 -0
  25. package/dist/foundation/parsers.d.ts +39 -0
  26. package/dist/foundation/parsers.js +148 -0
  27. package/dist/foundation/types.d.ts +62 -0
  28. package/dist/foundation/types.js +39 -0
  29. package/dist/foundation/validation.d.ts +16 -0
  30. package/dist/foundation/validation.js +11 -0
  31. package/dist/index.d.ts +2 -0
  32. package/dist/index.js +1 -0
  33. package/dist/internal/parsers.d.ts +5 -0
  34. package/dist/internal/parsers.js +21 -0
  35. package/dist/jsonSchema/generated.d.ts +6667 -0
  36. package/dist/jsonSchema/generated.js +4150 -0
  37. package/dist/jsonSchema/index.d.ts +2 -0
  38. package/dist/jsonSchema/index.js +1 -0
  39. package/dist/public/artifacts.d.ts +2 -0
  40. package/dist/public/artifacts.js +1 -0
  41. package/dist/public/capabilities.d.ts +2 -0
  42. package/dist/public/capabilities.js +1 -0
  43. package/dist/public/events.d.ts +2 -0
  44. package/dist/public/events.js +1 -0
  45. package/dist/public/index.d.ts +8 -0
  46. package/dist/public/index.js +7 -0
  47. package/dist/public/requests.d.ts +2 -0
  48. package/dist/public/requests.js +1 -0
  49. package/dist/public/sessions.d.ts +2 -0
  50. package/dist/public/sessions.js +1 -0
  51. package/dist/public/turns.d.ts +2 -0
  52. package/dist/public/turns.js +1 -0
  53. package/dist/requests/index.d.ts +3 -0
  54. package/dist/requests/index.js +2 -0
  55. package/dist/requests/parsers.d.ts +9 -0
  56. package/dist/requests/parsers.js +134 -0
  57. package/dist/requests/types.d.ts +89 -0
  58. package/dist/requests/types.js +0 -0
  59. package/dist/sessions/index.d.ts +3 -0
  60. package/dist/sessions/index.js +2 -0
  61. package/dist/sessions/parsers.d.ts +10 -0
  62. package/dist/sessions/parsers.js +38 -0
  63. package/dist/sessions/types.d.ts +37 -0
  64. package/dist/sessions/types.js +0 -0
  65. package/dist/turns/index.d.ts +3 -0
  66. package/dist/turns/index.js +2 -0
  67. package/dist/turns/parsers.d.ts +11 -0
  68. package/dist/turns/parsers.js +41 -0
  69. package/dist/turns/types.d.ts +207 -0
  70. package/dist/turns/types.js +62 -0
  71. package/dist/zod/artifacts.d.ts +4 -0
  72. package/dist/zod/artifacts.js +28 -0
  73. package/dist/zod/capabilities.d.ts +180 -0
  74. package/dist/zod/capabilities.js +222 -0
  75. package/dist/zod/events.d.ts +357 -0
  76. package/dist/zod/events.js +190 -0
  77. package/dist/zod/foundation.d.ts +45 -0
  78. package/dist/zod/foundation.js +205 -0
  79. package/dist/zod/index.d.ts +9 -0
  80. package/dist/zod/index.js +118 -0
  81. package/dist/zod/requests.d.ts +123 -0
  82. package/dist/zod/requests.js +174 -0
  83. package/dist/zod/sessions.d.ts +65 -0
  84. package/dist/zod/sessions.js +124 -0
  85. package/dist/zod/turns.d.ts +219 -0
  86. package/dist/zod/turns.js +400 -0
  87. package/dist/zod/typeEquality.generated.d.ts +51 -0
  88. package/dist/zod/typeEquality.generated.js +0 -0
  89. package/package.json +95 -0
@@ -0,0 +1,219 @@
1
+ import { z } from 'zod/v4';
2
+ import { type AgentBrowserActionDetails, type AgentCollaborationToolCallDetails, type AgentCommandExecutionDetails, type AgentComputerActionDetails, type AgentDiffSummary, type AgentDynamicToolCallDetails, type AgentFileChange, type AgentFileChangeDetails, type AgentImageViewDetails, type AgentItemSnapshot, type AgentMcpToolCallDetails, type AgentPlanStep, type AgentReviewDetails, type AgentTurnCompletedPayload, type AgentTurnInputContent, type AgentTurnInterruptionInput, type AgentTurnRunInput, type AgentWebSearchDetails } from '../turns/types.js';
3
+ export declare const AGENT_PROTOCOL_INLINE_IMAGE_BASE64_MAX_LENGTH = 500000;
4
+ export declare const AgentImageInputSourceSchema: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
5
+ mediaType: z.ZodEnum<{
6
+ "image/png": "image/png";
7
+ "image/jpeg": "image/jpeg";
8
+ "image/webp": "image/webp";
9
+ }>;
10
+ byteSize: z.ZodNumber;
11
+ widthPixels: z.ZodNumber;
12
+ heightPixels: z.ZodNumber;
13
+ type: z.ZodLiteral<"url">;
14
+ url: z.ZodString;
15
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
16
+ data: z.ZodBase64;
17
+ mediaType: z.ZodEnum<{
18
+ "image/png": "image/png";
19
+ "image/jpeg": "image/jpeg";
20
+ "image/webp": "image/webp";
21
+ }>;
22
+ byteSize: z.ZodNumber;
23
+ widthPixels: z.ZodNumber;
24
+ heightPixels: z.ZodNumber;
25
+ type: z.ZodLiteral<"base64">;
26
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
27
+ mediaType: z.ZodEnum<{
28
+ "image/png": "image/png";
29
+ "image/jpeg": "image/jpeg";
30
+ "image/webp": "image/webp";
31
+ }>;
32
+ byteSize: z.ZodNumber;
33
+ widthPixels: z.ZodNumber;
34
+ heightPixels: z.ZodNumber;
35
+ type: z.ZodLiteral<"local_file">;
36
+ path: z.ZodString;
37
+ sha256: z.ZodString;
38
+ }, z.core.$strict>>], "type">;
39
+ export declare const AgentTurnInputPartSchema: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
40
+ type: z.ZodLiteral<"text">;
41
+ text: z.ZodString;
42
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
43
+ type: z.ZodLiteral<"image">;
44
+ source: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
45
+ mediaType: z.ZodEnum<{
46
+ "image/png": "image/png";
47
+ "image/jpeg": "image/jpeg";
48
+ "image/webp": "image/webp";
49
+ }>;
50
+ byteSize: z.ZodNumber;
51
+ widthPixels: z.ZodNumber;
52
+ heightPixels: z.ZodNumber;
53
+ type: z.ZodLiteral<"url">;
54
+ url: z.ZodString;
55
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
56
+ data: z.ZodBase64;
57
+ mediaType: z.ZodEnum<{
58
+ "image/png": "image/png";
59
+ "image/jpeg": "image/jpeg";
60
+ "image/webp": "image/webp";
61
+ }>;
62
+ byteSize: z.ZodNumber;
63
+ widthPixels: z.ZodNumber;
64
+ heightPixels: z.ZodNumber;
65
+ type: z.ZodLiteral<"base64">;
66
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
67
+ mediaType: z.ZodEnum<{
68
+ "image/png": "image/png";
69
+ "image/jpeg": "image/jpeg";
70
+ "image/webp": "image/webp";
71
+ }>;
72
+ byteSize: z.ZodNumber;
73
+ widthPixels: z.ZodNumber;
74
+ heightPixels: z.ZodNumber;
75
+ type: z.ZodLiteral<"local_file">;
76
+ path: z.ZodString;
77
+ sha256: z.ZodString;
78
+ }, z.core.$strict>>], "type">;
79
+ }, z.core.$strict>>], "type">;
80
+ export declare const AgentTurnInteractionModeSchema: z.ZodEnum<{
81
+ default: "default";
82
+ plan: "plan";
83
+ }>;
84
+ /**
85
+ * Explicit Zod composition surface for private protocols that must add
86
+ * transport-owned fields while retaining the canonical input refinements.
87
+ */
88
+ export declare const AgentTurnInputContentCompositionSchema: z.ZodObject<{
89
+ parts: z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
90
+ type: z.ZodLiteral<"text">;
91
+ text: z.ZodString;
92
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
93
+ type: z.ZodLiteral<"image">;
94
+ source: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
95
+ mediaType: z.ZodEnum<{
96
+ "image/png": "image/png";
97
+ "image/jpeg": "image/jpeg";
98
+ "image/webp": "image/webp";
99
+ }>;
100
+ byteSize: z.ZodNumber;
101
+ widthPixels: z.ZodNumber;
102
+ heightPixels: z.ZodNumber;
103
+ type: z.ZodLiteral<"url">;
104
+ url: z.ZodString;
105
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
106
+ data: z.ZodBase64;
107
+ mediaType: z.ZodEnum<{
108
+ "image/png": "image/png";
109
+ "image/jpeg": "image/jpeg";
110
+ "image/webp": "image/webp";
111
+ }>;
112
+ byteSize: z.ZodNumber;
113
+ widthPixels: z.ZodNumber;
114
+ heightPixels: z.ZodNumber;
115
+ type: z.ZodLiteral<"base64">;
116
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
117
+ mediaType: z.ZodEnum<{
118
+ "image/png": "image/png";
119
+ "image/jpeg": "image/jpeg";
120
+ "image/webp": "image/webp";
121
+ }>;
122
+ byteSize: z.ZodNumber;
123
+ widthPixels: z.ZodNumber;
124
+ heightPixels: z.ZodNumber;
125
+ type: z.ZodLiteral<"local_file">;
126
+ path: z.ZodString;
127
+ sha256: z.ZodString;
128
+ }, z.core.$strict>>], "type">;
129
+ }, z.core.$strict>>], "type">>>;
130
+ summary: z.ZodOptional<z.ZodString>;
131
+ }, z.core.$strict>;
132
+ export declare const AgentTurnInputContentSchema: z.ZodType<AgentTurnInputContent>;
133
+ export declare const AgentTurnRunInputPortableSchema: z.ZodReadonly<z.ZodObject<{
134
+ deadlineAt: z.ZodOptional<z.ZodType<import("../index.js").AgentIsoDateTime, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIsoDateTime, unknown>>>;
135
+ parts: z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
136
+ type: z.ZodLiteral<"text">;
137
+ text: z.ZodString;
138
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
139
+ type: z.ZodLiteral<"image">;
140
+ source: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
141
+ mediaType: z.ZodEnum<{
142
+ "image/png": "image/png";
143
+ "image/jpeg": "image/jpeg";
144
+ "image/webp": "image/webp";
145
+ }>;
146
+ byteSize: z.ZodNumber;
147
+ widthPixels: z.ZodNumber;
148
+ heightPixels: z.ZodNumber;
149
+ type: z.ZodLiteral<"url">;
150
+ url: z.ZodString;
151
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
152
+ data: z.ZodBase64;
153
+ mediaType: z.ZodEnum<{
154
+ "image/png": "image/png";
155
+ "image/jpeg": "image/jpeg";
156
+ "image/webp": "image/webp";
157
+ }>;
158
+ byteSize: z.ZodNumber;
159
+ widthPixels: z.ZodNumber;
160
+ heightPixels: z.ZodNumber;
161
+ type: z.ZodLiteral<"base64">;
162
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
163
+ mediaType: z.ZodEnum<{
164
+ "image/png": "image/png";
165
+ "image/jpeg": "image/jpeg";
166
+ "image/webp": "image/webp";
167
+ }>;
168
+ byteSize: z.ZodNumber;
169
+ widthPixels: z.ZodNumber;
170
+ heightPixels: z.ZodNumber;
171
+ type: z.ZodLiteral<"local_file">;
172
+ path: z.ZodString;
173
+ sha256: z.ZodString;
174
+ }, z.core.$strict>>], "type">;
175
+ }, z.core.$strict>>], "type">>>;
176
+ summary: z.ZodOptional<z.ZodString>;
177
+ turnId: z.ZodType<import("../index.js").AgentTurnId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentTurnId, unknown>>;
178
+ interactionMode: z.ZodEnum<{
179
+ default: "default";
180
+ plan: "plan";
181
+ }>;
182
+ }, z.core.$strict>>;
183
+ export declare const AgentTurnRunInputSchema: z.ZodType<AgentTurnRunInput>;
184
+ export declare const AgentTurnInterruptionInputSchema: z.ZodType<AgentTurnInterruptionInput>;
185
+ export declare const AgentCommandExecutionDetailsSchema: z.ZodType<AgentCommandExecutionDetails>;
186
+ export declare const AgentFileChangeSchema: z.ZodType<AgentFileChange>;
187
+ export declare const AgentFileChangeDetailsSchema: z.ZodType<AgentFileChangeDetails>;
188
+ export declare const AgentMcpToolCallDetailsSchema: z.ZodType<AgentMcpToolCallDetails>;
189
+ export declare const AgentDynamicToolCallDetailsSchema: z.ZodType<AgentDynamicToolCallDetails>;
190
+ export declare const AgentCollaborationToolCallDetailsSchema: z.ZodType<AgentCollaborationToolCallDetails>;
191
+ export declare const AgentWebSearchDetailsSchema: z.ZodType<AgentWebSearchDetails>;
192
+ export declare const AgentBrowserActionDetailsSchema: z.ZodType<AgentBrowserActionDetails>;
193
+ export declare const AgentComputerActionDetailsSchema: z.ZodType<AgentComputerActionDetails>;
194
+ export declare const AgentImageViewDetailsSchema: z.ZodType<AgentImageViewDetails>;
195
+ export declare const AgentReviewDetailsSchema: z.ZodType<AgentReviewDetails>;
196
+ export declare const AgentItemSnapshotSchema: z.ZodType<AgentItemSnapshot>;
197
+ export declare const AgentContentStreamKindSchema: z.ZodEnum<{
198
+ unknown: "unknown";
199
+ assistant_text: "assistant_text";
200
+ reasoning_text: "reasoning_text";
201
+ reasoning_summary: "reasoning_summary";
202
+ plan_text: "plan_text";
203
+ command_output: "command_output";
204
+ file_change_output: "file_change_output";
205
+ }>;
206
+ export declare const AgentPlanStepSchema: z.ZodType<AgentPlanStep>;
207
+ export declare const AgentDiffSummarySchema: z.ZodType<AgentDiffSummary>;
208
+ export declare const AgentTurnCompletedPayloadPortableSchema: z.ZodReadonly<z.ZodObject<{
209
+ outcome: z.ZodEnum<{
210
+ completed: "completed";
211
+ failed: "failed";
212
+ canceled: "canceled";
213
+ expired: "expired";
214
+ }>;
215
+ reason: z.ZodOptional<z.ZodString>;
216
+ error: z.ZodOptional<z.ZodType<import("../index.js").AgentError, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentError, unknown>>>;
217
+ }, z.core.$strict>>;
218
+ export declare const AgentTurnCompletedPayloadSchema: z.ZodType<AgentTurnCompletedPayload>;
219
+ //# sourceMappingURL=turns.d.ts.map
@@ -0,0 +1,400 @@
1
+ import { z } from "zod/v4";
2
+ import {
3
+ AGENT_PROTOCOL_COLLECTION_MAX_LENGTH,
4
+ AGENT_PROTOCOL_SUMMARY_MAX_LENGTH,
5
+ AGENT_PROTOCOL_TEXT_MAX_LENGTH,
6
+ AGENT_PROTOCOL_TURN_INPUT_CONTENT_BYTES_LIMIT,
7
+ agentProtocolSerializedJsonBytes
8
+ } from "../foundation/types.js";
9
+ import { compareStringsByUnicodeCodePoint } from "../foundation/ordering.js";
10
+ import {
11
+ AGENT_CONTENT_STREAM_KINDS,
12
+ AGENT_FILE_CHANGE_KINDS,
13
+ AGENT_IMAGE_INPUT_MEDIA_TYPES,
14
+ AGENT_ITEM_STATUSES,
15
+ AGENT_TURN_INTERACTION_MODES
16
+ } from "../turns/types.js";
17
+ import {
18
+ AgentCanonicalIdValueSchema,
19
+ AgentErrorSchema,
20
+ AgentIsoDateTimeSchema,
21
+ AgentItemIdSchema,
22
+ AgentTurnIdSchema,
23
+ createAgentCanonicalNonBlankStringSchema
24
+ } from "./foundation.js";
25
+ const AGENT_PROTOCOL_INLINE_IMAGE_BASE64_MAX_LENGTH = 5e5;
26
+ const AGENT_PROTOCOL_IMAGE_BYTE_SIZE_MAX = 100 * 1024 * 1024;
27
+ const AGENT_PROTOCOL_IMAGE_DIMENSION_MAX = 1e5;
28
+ const AgentImageMediaTypeSchema = z.enum(AGENT_IMAGE_INPUT_MEDIA_TYPES);
29
+ const AgentImageByteSizeSchema = z.number().int().positive().max(AGENT_PROTOCOL_IMAGE_BYTE_SIZE_MAX);
30
+ const AgentImageDimensionSchema = z.number().int().positive().max(AGENT_PROTOCOL_IMAGE_DIMENSION_MAX);
31
+ const AgentImageSourceMetadataShape = {
32
+ mediaType: AgentImageMediaTypeSchema,
33
+ byteSize: AgentImageByteSizeSchema,
34
+ widthPixels: AgentImageDimensionSchema,
35
+ heightPixels: AgentImageDimensionSchema
36
+ };
37
+ const AgentTextInputPartSchema = z.object({
38
+ type: z.literal("text"),
39
+ text: z.string().min(1).max(AGENT_PROTOCOL_TEXT_MAX_LENGTH * 16)
40
+ }).strict().readonly();
41
+ const AgentImageInputSourceSchema = z.discriminatedUnion("type", [
42
+ z.object({
43
+ type: z.literal("url"),
44
+ url: z.string().url().max(2048),
45
+ ...AgentImageSourceMetadataShape
46
+ }).strict().readonly(),
47
+ z.object({
48
+ type: z.literal("base64"),
49
+ ...AgentImageSourceMetadataShape,
50
+ data: z.base64().min(1).max(AGENT_PROTOCOL_INLINE_IMAGE_BASE64_MAX_LENGTH)
51
+ }).strict().superRefine((source, context) => {
52
+ const padding = source.data.endsWith("==") ? 2 : source.data.endsWith("=") ? 1 : 0;
53
+ const decodedByteSize = source.data.length / 4 * 3 - padding;
54
+ if (decodedByteSize !== source.byteSize) {
55
+ context.addIssue({
56
+ code: "custom",
57
+ path: ["byteSize"],
58
+ message: "Inline image byteSize must match the decoded base64 data."
59
+ });
60
+ }
61
+ }).readonly(),
62
+ z.object({
63
+ type: z.literal("local_file"),
64
+ path: z.string().min(2).max(4096).regex(
65
+ /^(?!.*\/\.\.(?:\/|$))\/(?![\s\S]*[\u0000-\u001F\u007F-\u009F])\S(?:[\s\S]*\S)?$/u,
66
+ "Local image paths must be absolute, traversal-free POSIX paths without control characters."
67
+ ),
68
+ sha256: z.string().regex(/^[a-f0-9]{64}$/u),
69
+ ...AgentImageSourceMetadataShape
70
+ }).strict().readonly()
71
+ ]);
72
+ const AgentImageInputPartSchema = z.object({
73
+ type: z.literal("image"),
74
+ source: AgentImageInputSourceSchema
75
+ }).strict().readonly();
76
+ const AgentTurnInputPartSchema = z.discriminatedUnion("type", [
77
+ AgentTextInputPartSchema,
78
+ AgentImageInputPartSchema
79
+ ]);
80
+ const AgentTurnInteractionModeSchema = z.enum(
81
+ AGENT_TURN_INTERACTION_MODES
82
+ );
83
+ const AgentTurnInputContentShape = {
84
+ parts: z.array(AgentTurnInputPartSchema).min(1).max(AGENT_PROTOCOL_COLLECTION_MAX_LENGTH).readonly(),
85
+ summary: z.string().max(AGENT_PROTOCOL_SUMMARY_MAX_LENGTH).optional()
86
+ };
87
+ const AgentTurnInputContentObjectSchema = z.object(AgentTurnInputContentShape).strict();
88
+ const AgentTurnInputContentRefinedSchema = AgentTurnInputContentObjectSchema.superRefine((input, context) => {
89
+ const content = {
90
+ parts: input.parts,
91
+ ...input.summary === void 0 ? {} : { summary: input.summary }
92
+ };
93
+ if (agentProtocolSerializedJsonBytes(content) <= AGENT_PROTOCOL_TURN_INPUT_CONTENT_BYTES_LIMIT) {
94
+ return;
95
+ }
96
+ context.addIssue({
97
+ code: "custom",
98
+ message: `Turn input content cannot exceed ${AGENT_PROTOCOL_TURN_INPUT_CONTENT_BYTES_LIMIT} serialized bytes.`
99
+ });
100
+ });
101
+ const AgentTurnInputContentCompositionSchema = AgentTurnInputContentRefinedSchema;
102
+ const AgentTurnInputContentSchema = AgentTurnInputContentRefinedSchema;
103
+ const AgentTurnRunInputPortableSchema = z.object({
104
+ turnId: AgentTurnIdSchema,
105
+ interactionMode: AgentTurnInteractionModeSchema,
106
+ ...AgentTurnInputContentShape,
107
+ deadlineAt: AgentIsoDateTimeSchema.optional()
108
+ }).strict().readonly();
109
+ const AgentTurnRunInputSchema = AgentTurnInputContentRefinedSchema.safeExtend({
110
+ turnId: AgentTurnIdSchema,
111
+ interactionMode: AgentTurnInteractionModeSchema,
112
+ deadlineAt: AgentIsoDateTimeSchema.optional()
113
+ }).strict().readonly();
114
+ const AgentTurnInterruptionInputSchema = z.object({
115
+ turnId: AgentTurnIdSchema,
116
+ reason: z.enum([
117
+ "user_requested",
118
+ "timeout",
119
+ "shutdown",
120
+ "superseded",
121
+ "other"
122
+ ]),
123
+ requestedAt: AgentIsoDateTimeSchema.optional()
124
+ }).strict().readonly();
125
+ const DisplayPathSchema = z.string().min(1).max(500).regex(
126
+ /^(?![\\/]|[A-Za-z]:[\\/])(?!.*(?:^|[\\/])\.\.(?:[\\/]|$))(?![\s\S]*[\u0000-\u001F\u007F-\u009F])\S(?:[\s\S]*\S)?$/u,
127
+ "Display paths must be canonical, relative, traversal-free, and contain no control characters."
128
+ );
129
+ const SafeIntegerSchema = z.number().int().min(Number.MIN_SAFE_INTEGER).max(Number.MAX_SAFE_INTEGER);
130
+ const NonNegativeSafeIntegerSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
131
+ const DetailSummarySchema = createAgentCanonicalNonBlankStringSchema(
132
+ AGENT_PROTOCOL_SUMMARY_MAX_LENGTH
133
+ );
134
+ const DetailNameSchema = createAgentCanonicalNonBlankStringSchema(160);
135
+ const ReviewTextSchema = createAgentCanonicalNonBlankStringSchema(
136
+ AGENT_PROTOCOL_TEXT_MAX_LENGTH
137
+ );
138
+ const TruncatedShape = { truncated: z.literal(true).optional() };
139
+ const AgentCommandExecutionDetailsSchema = z.object({
140
+ commandSummary: DetailSummarySchema.optional(),
141
+ workingPath: DisplayPathSchema.optional(),
142
+ exitCode: SafeIntegerSchema.optional(),
143
+ durationMs: NonNegativeSafeIntegerSchema.optional(),
144
+ ...TruncatedShape
145
+ }).strict().superRefine((details, context) => {
146
+ if (details.commandSummary === void 0 && details.workingPath === void 0 && details.exitCode === void 0 && details.durationMs === void 0) {
147
+ context.addIssue({
148
+ code: "custom",
149
+ message: "Command details require a command summary, working path, exit code, or duration."
150
+ });
151
+ }
152
+ }).readonly();
153
+ const AgentFileChangeSchema = z.object({
154
+ path: DisplayPathSchema,
155
+ changeKind: z.enum(AGENT_FILE_CHANGE_KINDS)
156
+ }).strict().readonly();
157
+ const AgentFileChangeDetailsSchema = z.object({
158
+ changes: z.array(AgentFileChangeSchema).min(1).max(AGENT_PROTOCOL_COLLECTION_MAX_LENGTH).readonly(),
159
+ ...TruncatedShape
160
+ }).strict().superRefine((details, context) => {
161
+ const seenPaths = /* @__PURE__ */ new Set();
162
+ for (const [index, change] of details.changes.entries()) {
163
+ if (seenPaths.has(change.path)) {
164
+ context.addIssue({
165
+ code: "custom",
166
+ path: ["changes", index, "path"],
167
+ message: "File change paths must be unique."
168
+ });
169
+ }
170
+ seenPaths.add(change.path);
171
+ const previous = details.changes[index - 1];
172
+ if (previous && compareStringsByUnicodeCodePoint(previous.path, change.path) >= 0) {
173
+ context.addIssue({
174
+ code: "custom",
175
+ path: ["changes", index, "path"],
176
+ message: "File changes must be sorted in ascending code-point order by path."
177
+ });
178
+ }
179
+ }
180
+ }).readonly();
181
+ const AgentMcpToolCallDetailsSchema = z.object({
182
+ serverName: DetailNameSchema.optional(),
183
+ toolName: DetailNameSchema.optional(),
184
+ actionSummary: DetailSummarySchema.optional(),
185
+ durationMs: NonNegativeSafeIntegerSchema.optional(),
186
+ ...TruncatedShape
187
+ }).strict().superRefine((details, context) => {
188
+ if (details.serverName === void 0 && details.toolName === void 0 && details.actionSummary === void 0) {
189
+ context.addIssue({
190
+ code: "custom",
191
+ message: "MCP tool details require a server name, tool name, or action summary."
192
+ });
193
+ }
194
+ }).readonly();
195
+ const AgentDynamicToolCallDetailsSchema = z.object({
196
+ toolName: DetailNameSchema.optional(),
197
+ actionSummary: DetailSummarySchema.optional(),
198
+ durationMs: NonNegativeSafeIntegerSchema.optional(),
199
+ success: z.boolean().optional(),
200
+ ...TruncatedShape
201
+ }).strict().superRefine((details, context) => {
202
+ if (details.toolName === void 0 && details.actionSummary === void 0) {
203
+ context.addIssue({
204
+ code: "custom",
205
+ message: "Dynamic tool details require a tool name or action summary."
206
+ });
207
+ }
208
+ }).readonly();
209
+ const AgentCollaborationToolCallDetailsSchema = z.object({
210
+ toolName: DetailNameSchema.optional(),
211
+ actionSummary: DetailSummarySchema.optional(),
212
+ ...TruncatedShape
213
+ }).strict().superRefine((details, context) => {
214
+ if (details.toolName === void 0 && details.actionSummary === void 0) {
215
+ context.addIssue({
216
+ code: "custom",
217
+ message: "Collaboration tool details require a tool name or action summary."
218
+ });
219
+ }
220
+ }).readonly();
221
+ const AgentWebSearchDetailsSchema = z.object({
222
+ querySummary: DetailSummarySchema.optional(),
223
+ actionSummary: DetailSummarySchema.optional(),
224
+ ...TruncatedShape
225
+ }).strict().superRefine((details, context) => {
226
+ if (details.querySummary === void 0 && details.actionSummary === void 0) {
227
+ context.addIssue({
228
+ code: "custom",
229
+ message: "Web search details require a query or action summary."
230
+ });
231
+ }
232
+ }).readonly();
233
+ const AgentBrowserActionDetailsSchema = z.object({
234
+ actionSummary: DetailSummarySchema,
235
+ ...TruncatedShape
236
+ }).strict().readonly();
237
+ const AgentComputerActionDetailsSchema = z.object({
238
+ actionSummary: DetailSummarySchema,
239
+ ...TruncatedShape
240
+ }).strict().readonly();
241
+ const AgentImageViewDetailsSchema = z.object({
242
+ filePath: DisplayPathSchema.optional(),
243
+ actionSummary: DetailSummarySchema.optional(),
244
+ ...TruncatedShape
245
+ }).strict().superRefine((details, context) => {
246
+ if (details.filePath === void 0 && details.actionSummary === void 0) {
247
+ context.addIssue({
248
+ code: "custom",
249
+ message: "Image view details require a file path or action summary."
250
+ });
251
+ }
252
+ }).readonly();
253
+ const AgentReviewDetailsSchema = z.discriminatedUnion("phase", [
254
+ z.object({
255
+ phase: z.literal("entered"),
256
+ target: ReviewTextSchema,
257
+ ...TruncatedShape
258
+ }).strict().readonly(),
259
+ z.object({
260
+ phase: z.literal("exited"),
261
+ report: ReviewTextSchema,
262
+ ...TruncatedShape
263
+ }).strict().readonly()
264
+ ]);
265
+ const AgentItemSnapshotCommonShape = {
266
+ itemId: AgentItemIdSchema,
267
+ status: z.enum(AGENT_ITEM_STATUSES),
268
+ title: z.string().max(200).optional(),
269
+ summary: z.string().max(AGENT_PROTOCOL_SUMMARY_MAX_LENGTH).optional()
270
+ };
271
+ function itemWithoutDetails(itemKind) {
272
+ return z.object({
273
+ ...AgentItemSnapshotCommonShape,
274
+ itemKind: z.literal(itemKind)
275
+ }).strict().readonly();
276
+ }
277
+ const AgentItemSnapshotSchema = z.discriminatedUnion("itemKind", [
278
+ itemWithoutDetails("user_message"),
279
+ itemWithoutDetails("assistant_message"),
280
+ itemWithoutDetails("reasoning"),
281
+ itemWithoutDetails("plan"),
282
+ z.object({
283
+ ...AgentItemSnapshotCommonShape,
284
+ itemKind: z.literal("command_execution"),
285
+ details: AgentCommandExecutionDetailsSchema.optional()
286
+ }).strict().readonly(),
287
+ z.object({
288
+ ...AgentItemSnapshotCommonShape,
289
+ itemKind: z.literal("file_change"),
290
+ details: AgentFileChangeDetailsSchema.optional()
291
+ }).strict().readonly(),
292
+ z.object({
293
+ ...AgentItemSnapshotCommonShape,
294
+ itemKind: z.literal("mcp_tool_call"),
295
+ details: AgentMcpToolCallDetailsSchema.optional()
296
+ }).strict().readonly(),
297
+ z.object({
298
+ ...AgentItemSnapshotCommonShape,
299
+ itemKind: z.literal("dynamic_tool_call"),
300
+ details: AgentDynamicToolCallDetailsSchema.optional()
301
+ }).strict().readonly(),
302
+ z.object({
303
+ ...AgentItemSnapshotCommonShape,
304
+ itemKind: z.literal("collaboration_tool_call"),
305
+ details: AgentCollaborationToolCallDetailsSchema.optional()
306
+ }).strict().readonly(),
307
+ z.object({
308
+ ...AgentItemSnapshotCommonShape,
309
+ itemKind: z.literal("web_search"),
310
+ details: AgentWebSearchDetailsSchema.optional()
311
+ }).strict().readonly(),
312
+ z.object({
313
+ ...AgentItemSnapshotCommonShape,
314
+ itemKind: z.literal("browser_action"),
315
+ details: AgentBrowserActionDetailsSchema.optional()
316
+ }).strict().readonly(),
317
+ z.object({
318
+ ...AgentItemSnapshotCommonShape,
319
+ itemKind: z.literal("computer_action"),
320
+ details: AgentComputerActionDetailsSchema.optional()
321
+ }).strict().readonly(),
322
+ z.object({
323
+ ...AgentItemSnapshotCommonShape,
324
+ itemKind: z.literal("image_view"),
325
+ details: AgentImageViewDetailsSchema.optional()
326
+ }).strict().readonly(),
327
+ z.object({
328
+ ...AgentItemSnapshotCommonShape,
329
+ itemKind: z.literal("review"),
330
+ details: AgentReviewDetailsSchema
331
+ }).strict().readonly(),
332
+ itemWithoutDetails("context_compaction"),
333
+ itemWithoutDetails("unknown")
334
+ ]);
335
+ const AgentContentStreamKindSchema = z.enum(AGENT_CONTENT_STREAM_KINDS);
336
+ const AgentPlanStepSchema = z.object({
337
+ stepId: AgentCanonicalIdValueSchema,
338
+ text: z.string().max(AGENT_PROTOCOL_TEXT_MAX_LENGTH),
339
+ status: z.enum(["pending", "in_progress", "completed", "canceled"]),
340
+ priority: z.enum(["low", "medium", "high"]).optional()
341
+ }).strict().readonly();
342
+ const AgentDiffSummarySchema = z.object({
343
+ summary: z.string().max(AGENT_PROTOCOL_SUMMARY_MAX_LENGTH),
344
+ fileCount: z.number().int().min(0),
345
+ byteSize: z.number().int().min(0),
346
+ additions: z.number().int().min(0).optional(),
347
+ deletions: z.number().int().min(0).optional(),
348
+ binary: z.boolean().optional(),
349
+ malformed: z.boolean().optional(),
350
+ truncated: z.boolean().optional()
351
+ }).strict().readonly();
352
+ const AgentTurnCompletedPayloadPortableSchema = z.object({
353
+ outcome: z.enum(["completed", "failed", "canceled", "expired"]),
354
+ reason: z.string().max(AGENT_PROTOCOL_SUMMARY_MAX_LENGTH).optional(),
355
+ error: AgentErrorSchema.optional()
356
+ }).strict().readonly();
357
+ const AgentTurnCompletedPayloadSchema = AgentTurnCompletedPayloadPortableSchema.superRefine((payload, context) => {
358
+ if (payload.outcome === "failed" && payload.error === void 0) {
359
+ context.addIssue({
360
+ code: "custom",
361
+ path: ["error"],
362
+ message: "Failed turns require an error."
363
+ });
364
+ }
365
+ if (payload.outcome !== "failed" && payload.error !== void 0) {
366
+ context.addIssue({
367
+ code: "custom",
368
+ path: ["error"],
369
+ message: "Only failed turns may contain an error."
370
+ });
371
+ }
372
+ });
373
+ export {
374
+ AGENT_PROTOCOL_INLINE_IMAGE_BASE64_MAX_LENGTH,
375
+ AgentBrowserActionDetailsSchema,
376
+ AgentCollaborationToolCallDetailsSchema,
377
+ AgentCommandExecutionDetailsSchema,
378
+ AgentComputerActionDetailsSchema,
379
+ AgentContentStreamKindSchema,
380
+ AgentDiffSummarySchema,
381
+ AgentDynamicToolCallDetailsSchema,
382
+ AgentFileChangeDetailsSchema,
383
+ AgentFileChangeSchema,
384
+ AgentImageInputSourceSchema,
385
+ AgentImageViewDetailsSchema,
386
+ AgentItemSnapshotSchema,
387
+ AgentMcpToolCallDetailsSchema,
388
+ AgentPlanStepSchema,
389
+ AgentReviewDetailsSchema,
390
+ AgentTurnCompletedPayloadPortableSchema,
391
+ AgentTurnCompletedPayloadSchema,
392
+ AgentTurnInputContentCompositionSchema,
393
+ AgentTurnInputContentSchema,
394
+ AgentTurnInputPartSchema,
395
+ AgentTurnInteractionModeSchema,
396
+ AgentTurnInterruptionInputSchema,
397
+ AgentTurnRunInputPortableSchema,
398
+ AgentTurnRunInputSchema,
399
+ AgentWebSearchDetailsSchema
400
+ };
@@ -0,0 +1,51 @@
1
+ import type { z } from 'zod/v4';
2
+ import type { AgentArtifactDescriptor } from '../artifacts/types.js';
3
+ import type { AgentCapabilities } from '../capabilities/types.js';
4
+ import type { AgentEvent } from '../events/types.js';
5
+ import type { AgentError, AgentJsonValue, AgentProviderRefs } from '../foundation/types.js';
6
+ import type { AgentRequest, AgentRequestResolution } from '../requests/types.js';
7
+ import type { AgentSessionBinding, AgentSessionConfiguration, AgentSessionOpenInput } from '../sessions/types.js';
8
+ import type { AgentItemSnapshot, AgentTurnInputContent, AgentTurnInterruptionInput, AgentTurnRunInput } from '../turns/types.js';
9
+ import { AgentArtifactDescriptorSchema } from './artifacts.js';
10
+ import { AgentCapabilitiesSchema } from './capabilities.js';
11
+ import { AgentEventSchema } from './events.js';
12
+ import { AgentErrorSchema, AgentJsonValueSchema, AgentProviderRefsSchema } from './foundation.js';
13
+ import { AgentRequestResolutionSchema, AgentRequestSchema } from './requests.js';
14
+ import { AgentSessionBindingSchema, AgentSessionConfigurationSchema, AgentSessionOpenInputSchema } from './sessions.js';
15
+ import { AgentItemSnapshotSchema, AgentTurnInputContentSchema, AgentTurnInterruptionInputSchema, AgentTurnRunInputSchema } from './turns.js';
16
+ type Extends<Left, Right> = [Left] extends [Right] ? true : false;
17
+ type Assert<Value extends true> = Value;
18
+ export type AgentProtocolSchemaTypeAssertions = readonly [
19
+ Assert<Extends<z.output<typeof AgentJsonValueSchema>, AgentJsonValue>>,
20
+ Assert<Extends<AgentJsonValue, z.output<typeof AgentJsonValueSchema>>>,
21
+ Assert<Extends<z.output<typeof AgentProviderRefsSchema>, AgentProviderRefs>>,
22
+ Assert<Extends<AgentProviderRefs, z.output<typeof AgentProviderRefsSchema>>>,
23
+ Assert<Extends<z.output<typeof AgentErrorSchema>, AgentError>>,
24
+ Assert<Extends<AgentError, z.output<typeof AgentErrorSchema>>>,
25
+ Assert<Extends<z.output<typeof AgentSessionBindingSchema>, AgentSessionBinding>>,
26
+ Assert<Extends<AgentSessionBinding, z.output<typeof AgentSessionBindingSchema>>>,
27
+ Assert<Extends<z.output<typeof AgentSessionConfigurationSchema>, AgentSessionConfiguration>>,
28
+ Assert<Extends<AgentSessionConfiguration, z.output<typeof AgentSessionConfigurationSchema>>>,
29
+ Assert<Extends<z.output<typeof AgentSessionOpenInputSchema>, AgentSessionOpenInput>>,
30
+ Assert<Extends<AgentSessionOpenInput, z.output<typeof AgentSessionOpenInputSchema>>>,
31
+ Assert<Extends<z.output<typeof AgentTurnInputContentSchema>, AgentTurnInputContent>>,
32
+ Assert<Extends<AgentTurnInputContent, z.output<typeof AgentTurnInputContentSchema>>>,
33
+ Assert<Extends<z.output<typeof AgentTurnRunInputSchema>, AgentTurnRunInput>>,
34
+ Assert<Extends<AgentTurnRunInput, z.output<typeof AgentTurnRunInputSchema>>>,
35
+ Assert<Extends<z.output<typeof AgentTurnInterruptionInputSchema>, AgentTurnInterruptionInput>>,
36
+ Assert<Extends<AgentTurnInterruptionInput, z.output<typeof AgentTurnInterruptionInputSchema>>>,
37
+ Assert<Extends<z.output<typeof AgentItemSnapshotSchema>, AgentItemSnapshot>>,
38
+ Assert<Extends<AgentItemSnapshot, z.output<typeof AgentItemSnapshotSchema>>>,
39
+ Assert<Extends<z.output<typeof AgentRequestSchema>, AgentRequest>>,
40
+ Assert<Extends<AgentRequest, z.output<typeof AgentRequestSchema>>>,
41
+ Assert<Extends<z.output<typeof AgentRequestResolutionSchema>, AgentRequestResolution>>,
42
+ Assert<Extends<AgentRequestResolution, z.output<typeof AgentRequestResolutionSchema>>>,
43
+ Assert<Extends<z.output<typeof AgentCapabilitiesSchema>, AgentCapabilities>>,
44
+ Assert<Extends<AgentCapabilities, z.output<typeof AgentCapabilitiesSchema>>>,
45
+ Assert<Extends<z.output<typeof AgentArtifactDescriptorSchema>, AgentArtifactDescriptor>>,
46
+ Assert<Extends<AgentArtifactDescriptor, z.output<typeof AgentArtifactDescriptorSchema>>>,
47
+ Assert<Extends<z.output<typeof AgentEventSchema>, AgentEvent>>,
48
+ Assert<Extends<AgentEvent, z.output<typeof AgentEventSchema>>>
49
+ ];
50
+ export {};
51
+ //# sourceMappingURL=typeEquality.generated.d.ts.map
File without changes