@agen-ai/agent-protocol 0.4.0 → 0.4.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 (39) hide show
  1. package/README.md +115 -18
  2. package/dist/capabilities/types.d.ts +6 -1
  3. package/dist/events/types.d.ts +9 -3
  4. package/dist/events/types.js +4 -1
  5. package/dist/foundation/types.d.ts +1 -1
  6. package/dist/foundation/types.js +1 -1
  7. package/dist/jsonSchema/generated.d.ts +11214 -7152
  8. package/dist/jsonSchema/generated.js +2835 -227
  9. package/dist/public/index.d.ts +1 -0
  10. package/dist/public/index.js +1 -0
  11. package/dist/public/sessionInteractions.d.ts +2 -0
  12. package/dist/public/sessionInteractions.js +1 -0
  13. package/dist/requests/elicitation.d.ts +4 -0
  14. package/dist/requests/elicitation.js +107 -0
  15. package/dist/requests/parsers.js +2 -100
  16. package/dist/requests/types.d.ts +17 -4
  17. package/dist/sessionInteractions/index.d.ts +3 -0
  18. package/dist/sessionInteractions/index.js +2 -0
  19. package/dist/sessionInteractions/parsers.d.ts +37 -0
  20. package/dist/sessionInteractions/parsers.js +201 -0
  21. package/dist/sessionInteractions/types.d.ts +162 -0
  22. package/dist/sessionInteractions/types.js +34 -0
  23. package/dist/zod/capabilities.d.ts +72 -6
  24. package/dist/zod/capabilities.js +32 -30
  25. package/dist/zod/collaboration.d.ts +2 -2
  26. package/dist/zod/events.d.ts +75 -42
  27. package/dist/zod/events.js +8 -0
  28. package/dist/zod/foundation.d.ts +1 -0
  29. package/dist/zod/foundation.js +15 -2
  30. package/dist/zod/index.d.ts +2 -1
  31. package/dist/zod/index.js +60 -0
  32. package/dist/zod/operations.d.ts +1 -1
  33. package/dist/zod/requests.d.ts +175 -32
  34. package/dist/zod/requests.js +33 -10
  35. package/dist/zod/sessionInteractions.d.ts +925 -0
  36. package/dist/zod/sessionInteractions.js +284 -0
  37. package/dist/zod/turns.d.ts +1 -1
  38. package/dist/zod/typeEquality.generated.d.ts +38 -4
  39. package/package.json +6 -2
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod/v4';
2
- import type { AgentEvent } from '../events/types.js';
2
+ import { type AgentEvent } from '../events/types.js';
3
3
  import { type AgentContextUsage } from '../turns/types.js';
4
4
  export declare const AgentContextUsagePortableSchema: z.ZodReadonly<z.ZodObject<{
5
5
  measurementScope: z.ZodEnum<{
@@ -33,7 +33,7 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
33
33
  payload: z.ZodReadonly<z.ZodObject<{
34
34
  message: z.ZodOptional<z.ZodString>;
35
35
  }, z.core.$strict>>;
36
- protocolVersion: z.ZodLiteral<10>;
36
+ protocolVersion: z.ZodLiteral<12>;
37
37
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
38
38
  providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
39
39
  conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
@@ -54,7 +54,7 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
54
54
  requestId: z.ZodOptional<z.ZodType<import("../index.js").AgentRequestId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentRequestId, unknown>>>;
55
55
  message: z.ZodOptional<z.ZodString>;
56
56
  }, z.core.$strict>>;
57
- protocolVersion: z.ZodLiteral<10>;
57
+ protocolVersion: z.ZodLiteral<12>;
58
58
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
59
59
  providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
60
60
  conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
@@ -69,15 +69,15 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
69
69
  turnId: z.ZodType<import("../index.js").AgentTurnId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentTurnId, unknown>>;
70
70
  payload: z.ZodReadonly<z.ZodObject<{
71
71
  outcome: z.ZodEnum<{
72
+ canceled: "canceled";
72
73
  completed: "completed";
73
74
  failed: "failed";
74
- canceled: "canceled";
75
75
  expired: "expired";
76
76
  }>;
77
77
  reason: z.ZodOptional<z.ZodString>;
78
78
  error: z.ZodOptional<z.ZodType<import("../index.js").AgentError, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentError, unknown>>>;
79
79
  }, z.core.$strict>>;
80
- protocolVersion: z.ZodLiteral<10>;
80
+ protocolVersion: z.ZodLiteral<12>;
81
81
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
82
82
  providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
83
83
  conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
@@ -91,7 +91,7 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
91
91
  type: z.ZodLiteral<"item.started">;
92
92
  turnId: z.ZodType<import("../index.js").AgentTurnId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentTurnId, unknown>>;
93
93
  payload: z.ZodType<import("../index.js").AgentItemSnapshot, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentItemSnapshot, unknown>>;
94
- protocolVersion: z.ZodLiteral<10>;
94
+ protocolVersion: z.ZodLiteral<12>;
95
95
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
96
96
  providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
97
97
  conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
@@ -105,7 +105,7 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
105
105
  type: z.ZodLiteral<"item.updated">;
106
106
  turnId: z.ZodType<import("../index.js").AgentTurnId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentTurnId, unknown>>;
107
107
  payload: z.ZodType<import("../index.js").AgentItemSnapshot, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentItemSnapshot, unknown>>;
108
- protocolVersion: z.ZodLiteral<10>;
108
+ protocolVersion: z.ZodLiteral<12>;
109
109
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
110
110
  providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
111
111
  conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
@@ -119,7 +119,7 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
119
119
  type: z.ZodLiteral<"item.completed">;
120
120
  turnId: z.ZodType<import("../index.js").AgentTurnId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentTurnId, unknown>>;
121
121
  payload: z.ZodType<import("../index.js").AgentItemSnapshot, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentItemSnapshot, unknown>>;
122
- protocolVersion: z.ZodLiteral<10>;
122
+ protocolVersion: z.ZodLiteral<12>;
123
123
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
124
124
  providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
125
125
  conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
@@ -145,7 +145,7 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
145
145
  }>;
146
146
  delta: z.ZodString;
147
147
  }, z.core.$strict>>;
148
- protocolVersion: z.ZodLiteral<10>;
148
+ protocolVersion: z.ZodLiteral<12>;
149
149
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
150
150
  providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
151
151
  conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
@@ -162,7 +162,7 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
162
162
  explanation: z.ZodOptional<z.ZodString>;
163
163
  steps: z.ZodReadonly<z.ZodArray<z.ZodType<import("../index.js").AgentPlanStep, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentPlanStep, unknown>>>>;
164
164
  }, z.core.$strict>>;
165
- protocolVersion: z.ZodLiteral<10>;
165
+ protocolVersion: z.ZodLiteral<12>;
166
166
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
167
167
  providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
168
168
  conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
@@ -179,7 +179,7 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
179
179
  artifactId: z.ZodType<import("../index.js").AgentArtifactId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentArtifactId, unknown>>;
180
180
  requestId: z.ZodType<import("../index.js").AgentRequestId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentRequestId, unknown>>;
181
181
  }, z.core.$strict>>;
182
- protocolVersion: z.ZodLiteral<10>;
182
+ protocolVersion: z.ZodLiteral<12>;
183
183
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
184
184
  providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
185
185
  conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
@@ -193,7 +193,7 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
193
193
  type: z.ZodLiteral<"turn.diff.updated">;
194
194
  turnId: z.ZodType<import("../index.js").AgentTurnId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentTurnId, unknown>>;
195
195
  payload: z.ZodType<import("../index.js").AgentDiffSummary, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentDiffSummary, unknown>>;
196
- protocolVersion: z.ZodLiteral<10>;
196
+ protocolVersion: z.ZodLiteral<12>;
197
197
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
198
198
  providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
199
199
  conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
@@ -218,10 +218,10 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
218
218
  artifactId: z.ZodType<import("../index.js").AgentArtifactId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentArtifactId, unknown>>;
219
219
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
220
220
  kind: z.ZodEnum<{
221
- other: "other";
222
- file_change: "file_change";
223
221
  tool: "tool";
224
222
  command: "command";
223
+ file_change: "file_change";
224
+ other: "other";
225
225
  }>;
226
226
  title: z.ZodString;
227
227
  description: z.ZodOptional<z.ZodString>;
@@ -235,21 +235,33 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
235
235
  approved: "approved";
236
236
  denied: "denied";
237
237
  }>;
238
- persistence: z.ZodEnum<{
239
- session: "session";
240
- once: "once";
241
- workspace: "workspace";
242
- }>;
243
- scope: z.ZodReadonly<z.ZodObject<{
244
- kind: z.ZodEnum<{
245
- exact_action: "exact_action";
246
- command_pattern: "command_pattern";
247
- domain: "domain";
248
- tool: "tool";
249
- server: "server";
250
- all_edits: "all_edits";
238
+ consequence: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
239
+ kind: z.ZodLiteral<"scoped">;
240
+ persistence: z.ZodEnum<{
241
+ session: "session";
242
+ once: "once";
243
+ workspace: "workspace";
251
244
  }>;
252
- }, z.core.$strict>>;
245
+ scope: z.ZodReadonly<z.ZodObject<{
246
+ kind: z.ZodEnum<{
247
+ exact_action: "exact_action";
248
+ command_pattern: "command_pattern";
249
+ domain: "domain";
250
+ tool: "tool";
251
+ server: "server";
252
+ all_edits: "all_edits";
253
+ }>;
254
+ }, z.core.$strict>>;
255
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
256
+ kind: z.ZodLiteral<"provider_managed_remembrance">;
257
+ duration: z.ZodReadonly<z.ZodObject<{
258
+ kind: z.ZodLiteral<"unknown">;
259
+ }, z.core.$strict>>;
260
+ applicability: z.ZodReadonly<z.ZodObject<{
261
+ kind: z.ZodLiteral<"unknown">;
262
+ }, z.core.$strict>>;
263
+ explanation: z.ZodString;
264
+ }, z.core.$strict>>], "kind">;
253
265
  }, z.core.$strict>>>>;
254
266
  expiresAt: z.ZodOptional<z.ZodType<import("../index.js").AgentIsoDateTime, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIsoDateTime, unknown>>>;
255
267
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
@@ -326,7 +338,28 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
326
338
  expiresAt: z.ZodOptional<z.ZodType<import("../index.js").AgentIsoDateTime, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIsoDateTime, unknown>>>;
327
339
  }, z.core.$strict>>], "requestKind">;
328
340
  }, z.core.$strict>>;
329
- protocolVersion: z.ZodLiteral<10>;
341
+ protocolVersion: z.ZodLiteral<12>;
342
+ sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
343
+ providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
344
+ conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
345
+ historyAnchor: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderHistoryAnchor, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderHistoryAnchor, unknown>>>;
346
+ turnId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderTurnRef, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderTurnRef, unknown>>>;
347
+ itemId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderItemRef, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderItemRef, unknown>>>;
348
+ requestId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderRequestRef, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderRequestRef, unknown>>>;
349
+ }, z.core.$strict>>>;
350
+ occurredAt: z.ZodType<import("../index.js").AgentIsoDateTime, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIsoDateTime, unknown>>;
351
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
352
+ type: z.ZodLiteral<"request.unavailable">;
353
+ turnId: z.ZodType<import("../index.js").AgentTurnId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentTurnId, unknown>>;
354
+ payload: z.ZodReadonly<z.ZodObject<{
355
+ requestId: z.ZodType<import("../index.js").AgentRequestId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentRequestId, unknown>>;
356
+ reason: z.ZodEnum<{
357
+ unknown: "unknown";
358
+ expired: "expired";
359
+ withdrawn: "withdrawn";
360
+ }>;
361
+ }, z.core.$strict>>;
362
+ protocolVersion: z.ZodLiteral<12>;
330
363
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
331
364
  providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
332
365
  conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
@@ -357,7 +390,7 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
357
390
  current: z.ZodOptional<z.ZodNumber>;
358
391
  total: z.ZodOptional<z.ZodNumber>;
359
392
  }, z.core.$strict>>;
360
- protocolVersion: z.ZodLiteral<10>;
393
+ protocolVersion: z.ZodLiteral<12>;
361
394
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
362
395
  providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
363
396
  conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
@@ -395,7 +428,7 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
395
428
  thresholdTokens: z.ZodOptional<z.ZodNumber>;
396
429
  }, z.core.$strict>>>;
397
430
  }, z.core.$strict>>;
398
- protocolVersion: z.ZodLiteral<10>;
431
+ protocolVersion: z.ZodLiteral<12>;
399
432
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
400
433
  providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
401
434
  conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
@@ -411,7 +444,7 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
411
444
  payload: z.ZodReadonly<z.ZodObject<{
412
445
  artifact: z.ZodType<import("../index.js").AgentArtifactDescriptor, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentArtifactDescriptor, unknown>>;
413
446
  }, z.core.$strict>>;
414
- protocolVersion: z.ZodLiteral<10>;
447
+ protocolVersion: z.ZodLiteral<12>;
415
448
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
416
449
  providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
417
450
  conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
@@ -428,9 +461,9 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
428
461
  result: z.ZodReadonly<z.ZodObject<{
429
462
  invocationId: z.ZodType<import("../index.js").AgentOperationInvocationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentOperationInvocationId, unknown>>;
430
463
  status: z.ZodEnum<{
464
+ canceled: "canceled";
431
465
  completed: "completed";
432
466
  failed: "failed";
433
- canceled: "canceled";
434
467
  waiting_for_request: "waiting_for_request";
435
468
  accepted: "accepted";
436
469
  }>;
@@ -440,7 +473,7 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
440
473
  error: z.ZodOptional<z.ZodType<import("../index.js").AgentError, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentError, unknown>>>;
441
474
  }, z.core.$strict>>;
442
475
  }, z.core.$strict>>;
443
- protocolVersion: z.ZodLiteral<10>;
476
+ protocolVersion: z.ZodLiteral<12>;
444
477
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
445
478
  providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
446
479
  conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
@@ -466,9 +499,9 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
466
499
  }>;
467
500
  title: z.ZodString;
468
501
  status: z.ZodEnum<{
502
+ canceled: "canceled";
469
503
  completed: "completed";
470
504
  failed: "failed";
471
- canceled: "canceled";
472
505
  running: "running";
473
506
  starting: "starting";
474
507
  queued: "queued";
@@ -494,11 +527,11 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
494
527
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
495
528
  kind: z.ZodLiteral<"canceled">;
496
529
  reason: z.ZodEnum<{
530
+ other: "other";
497
531
  user_requested: "user_requested";
498
532
  timeout: "timeout";
499
533
  shutdown: "shutdown";
500
534
  superseded: "superseded";
501
- other: "other";
502
535
  }>;
503
536
  }, z.core.$strict>>], "kind">>;
504
537
  createdAt: z.ZodType<import("../index.js").AgentIsoDateTime, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIsoDateTime, unknown>>;
@@ -509,7 +542,7 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
509
542
  resourceIds: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodType<import("../index.js").AgentGeneratedResourceId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentGeneratedResourceId, unknown>>>>>;
510
543
  }, z.core.$strict>>;
511
544
  }, z.core.$strict>>;
512
- protocolVersion: z.ZodLiteral<10>;
545
+ protocolVersion: z.ZodLiteral<12>;
513
546
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
514
547
  providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
515
548
  conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
@@ -563,7 +596,7 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
563
596
  error: z.ZodOptional<z.ZodType<import("../index.js").AgentError, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentError, unknown>>>;
564
597
  }, z.core.$strict>>;
565
598
  }, z.core.$strict>>;
566
- protocolVersion: z.ZodLiteral<10>;
599
+ protocolVersion: z.ZodLiteral<12>;
567
600
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
568
601
  providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
569
602
  conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
@@ -583,7 +616,7 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
583
616
  maxAttempts: z.ZodOptional<z.ZodNumber>;
584
617
  delayMs: z.ZodOptional<z.ZodNumber>;
585
618
  }, z.core.$strict>>;
586
- protocolVersion: z.ZodLiteral<10>;
619
+ protocolVersion: z.ZodLiteral<12>;
587
620
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
588
621
  providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
589
622
  conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
@@ -601,7 +634,7 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
601
634
  message: z.ZodString;
602
635
  context: z.ZodOptional<z.ZodType<import("../index.js").AgentErrorContext, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentErrorContext, unknown>>>;
603
636
  }, z.core.$strict>>;
604
- protocolVersion: z.ZodLiteral<10>;
637
+ protocolVersion: z.ZodLiteral<12>;
605
638
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
606
639
  providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
607
640
  conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
@@ -617,7 +650,7 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
617
650
  payload: z.ZodReadonly<z.ZodObject<{
618
651
  error: z.ZodType<import("../index.js").AgentError, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentError, unknown>>;
619
652
  }, z.core.$strict>>;
620
- protocolVersion: z.ZodLiteral<10>;
653
+ protocolVersion: z.ZodLiteral<12>;
621
654
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
622
655
  providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
623
656
  conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
@@ -635,7 +668,7 @@ export declare const AgentEventPortableSchema: z.ZodDiscriminatedUnion<[z.ZodRea
635
668
  message: z.ZodString;
636
669
  context: z.ZodOptional<z.ZodType<import("../index.js").AgentErrorContext, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentErrorContext, unknown>>>;
637
670
  }, z.core.$strict>>;
638
- protocolVersion: z.ZodLiteral<10>;
671
+ protocolVersion: z.ZodLiteral<12>;
639
672
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
640
673
  providerRefs: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
641
674
  conversationId: z.ZodOptional<z.ZodType<import("../index.js").AgentProviderConversationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentProviderConversationId, unknown>>>;
@@ -10,6 +10,7 @@ import {
10
10
  AGENT_PROTOCOL_VERSION,
11
11
  agentProtocolSerializedJsonBytes
12
12
  } from "../foundation/types.js";
13
+ import { AGENT_REQUEST_UNAVAILABLE_REASONS } from "../events/types.js";
13
14
  import { AgentRequestPortableSchema, AgentRequestSchema } from "./requests.js";
14
15
  import { AgentOperationResultPortableSchema } from "./operations.js";
15
16
  import { AgentGeneratedResourceDescriptorPortableSchema } from "./resources.js";
@@ -165,6 +166,13 @@ const AgentEventPortableSchema = z.discriminatedUnion("type", [
165
166
  "request.opened",
166
167
  z.object({ request: AgentRequestPortableSchema }).strict().readonly()
167
168
  ),
169
+ turnEvent(
170
+ "request.unavailable",
171
+ z.object({
172
+ requestId: AgentRequestIdSchema,
173
+ reason: z.enum(AGENT_REQUEST_UNAVAILABLE_REASONS)
174
+ }).strict().readonly()
175
+ ),
168
176
  turnEvent("progress.updated", ProgressUpdatedPayloadSchema),
169
177
  turnEvent("context.usage.updated", AgentContextUsagePortableSchema),
170
178
  optionallyTurnScopedEvent(
@@ -38,6 +38,7 @@ export declare const AgentJsonObjectKeySchema: z.ZodString;
38
38
  interface ProtocolInputPreflightOptions {
39
39
  readonly maxDepth?: number;
40
40
  readonly maxCollectionLength?: number;
41
+ readonly requireJsonData?: boolean;
41
42
  }
42
43
  export declare function withAcyclicProtocolInput<Output>(schema: z.ZodType<Output>, options?: ProtocolInputPreflightOptions): z.ZodType<Output>;
43
44
  export declare const AgentJsonValuePortableSchema: z.ZodType<AgentJsonValue>;
@@ -86,7 +86,10 @@ function passesProtocolInputPreflight(input, options) {
86
86
  if (options.maxDepth !== void 0 && current.depth > options.maxDepth) {
87
87
  return false;
88
88
  }
89
- if (current.value === null || typeof current.value !== "object") continue;
89
+ if (current.value === null || typeof current.value !== "object") {
90
+ if (options.requireJsonData && current.value !== null && typeof current.value !== "string" && typeof current.value !== "boolean" && !(typeof current.value === "number" && Number.isFinite(current.value))) return false;
91
+ continue;
92
+ }
90
93
  if (activeObjects.has(current.value)) return false;
91
94
  activeObjects.add(current.value);
92
95
  pending.push({ operation: "leave", value: current.value });
@@ -103,12 +106,17 @@ function passesProtocolInputPreflight(input, options) {
103
106
  }
104
107
  let propertyKeys;
105
108
  try {
109
+ if (options.requireJsonData) {
110
+ const prototype = Object.getPrototypeOf(current.value);
111
+ if (prototype !== (Array.isArray(current.value) ? Array.prototype : Object.prototype) && prototype !== null) return false;
112
+ }
106
113
  propertyKeys = Reflect.ownKeys(current.value);
107
114
  } catch {
108
115
  return false;
109
116
  }
110
117
  let collectionLength = 0;
111
118
  for (const propertyKey of propertyKeys) {
119
+ if (options.requireJsonData && typeof propertyKey !== "string") return false;
112
120
  if (typeof propertyKey === "string" && !AGENT_JSON_OBJECT_KEY_PATTERN.test(propertyKey)) {
113
121
  return false;
114
122
  }
@@ -118,7 +126,12 @@ function passesProtocolInputPreflight(input, options) {
118
126
  } catch {
119
127
  return false;
120
128
  }
121
- if (!descriptor?.enumerable) continue;
129
+ if (options.requireJsonData && (!descriptor || !("value" in descriptor))) return false;
130
+ if (!descriptor?.enumerable) {
131
+ if (options.requireJsonData && !(Array.isArray(current.value) && propertyKey === "length")) return false;
132
+ continue;
133
+ }
134
+ if (options.requireJsonData && Array.isArray(current.value) && (typeof propertyKey !== "string" || !/^(?:0|[1-9][0-9]*)$/u.test(propertyKey))) return false;
122
135
  if (!("value" in descriptor)) return false;
123
136
  collectionLength += 1;
124
137
  if (options.maxCollectionLength !== void 0 && collectionLength > options.maxCollectionLength) {
@@ -1,8 +1,9 @@
1
1
  export { AgentApprovalOptionIdSchema, AgentArtifactIdSchema, AgentCollaborationIdSchema, AgentConfigurationRevisionIdSchema, AgentInstanceIdSchema, AgentIntegrationIdSchema, AgentIntegrationResourceIdSchema, AgentIntegrationServerIdSchema, AgentIntegrationToolIdSchema, AgentIsoDateTimeSchema, AgentItemIdSchema, AgentJsonValueSchema, AgentManagedContentIdSchema, AgentEnvironmentIdSchema, AgentEffectiveContentIdSchema, AgentCommandIdSchema, AgentExtensionIdSchema, AgentOperationIdSchema, AgentOperationInvocationIdSchema, AgentProviderConversationIdSchema, AgentProviderHistoryAnchorSchema, AgentProviderItemRefSchema, AgentProviderKeySchema, AgentProviderRefsSchema, AgentProviderRequestRefSchema, AgentProviderTurnRefSchema, AgentRequestFieldIdSchema, AgentRequestIdSchema, AgentSessionIdSchema, AgentGeneratedResourceIdSchema, AgentTurnIdSchema, } from './foundation.js';
2
2
  export { AgentErrorContextSchema, AgentErrorSchema, AgentFailureCategorySchema, AgentFailureQuotaReferenceSchema, AgentRecoveryHintSchema, } from './failures.js';
3
3
  export { AgentSessionBindingSchema, AgentSessionBranchSourceSchema, AgentSessionBranchInputSchema, AgentSessionConfigurationSchema, AgentSessionCreateInputSchema, AgentSessionOpenInputSchema, AgentSessionResumeInputSchema, } from './sessions.js';
4
+ export { AgentSessionDecisionChoiceIdSchema, AgentSessionFormChoiceIdSchema, AgentSessionPlanReviewChoiceIdSchema, AgentSessionPlanIdSchema, AgentSessionPlanRevisionSchema, AgentSessionWorkspaceTargetSchema, AgentSessionDecisionConsequenceSchema, AgentSessionDecisionChoiceSchema, AgentSessionFormChoiceSchema, AgentSessionPlanSnapshotPortableSchema, AgentSessionPlanSnapshotSchema, AgentSessionPlanReviewChoiceSchema, AgentSessionDecisionRequestPortableSchema, AgentSessionDecisionRequestSchema, AgentSessionFormRequestPortableSchema, AgentSessionFormRequestSchema, AgentSessionPlanReviewRequestPortableSchema, AgentSessionPlanReviewRequestSchema, AgentSessionRequestPortableSchema, AgentSessionRequestSchema, AgentSessionDecisionResponsePortableSchema, AgentSessionDecisionResponseSchema, AgentSessionFormResponsePortableSchema, AgentSessionFormResponseSchema, AgentSessionPlanReviewResponsePortableSchema, AgentSessionPlanReviewResponseSchema, AgentSessionResponsePortableSchema, AgentSessionResponseSchema, } from './sessionInteractions.js';
4
5
  export { AgentBrowserActionDetailsSchema, AgentCollaborationToolCallDetailsSchema, AgentCommandExecutionDetailsSchema, AgentComputerActionDetailsSchema, AgentContentStreamKindSchema, AgentContextCompactionDetailsSchema, AgentDiffSummarySchema, AgentDynamicToolCallDetailsSchema, AgentFileChangeDetailsSchema, AgentFileChangeSchema, AgentImageViewDetailsSchema, AgentItemSnapshotSchema, AgentMcpToolCallDetailsSchema, AgentPlanStepSchema, AgentReviewDetailsSchema, AgentTurnCompletedPayloadSchema, AgentTurnInputContentCompositionSchema, AgentTurnInputContentSchema, AgentTurnInteractionModeSchema, AgentTurnInputPartSchema, AgentContentReferenceInputPartSchema, AgentTurnInterruptionInputSchema, AgentTurnRunInputSchema, AgentWebSearchDetailsSchema, } from './turns.js';
5
- export { AgentApprovalRequestSchema, AgentApprovalResolutionSchema, AgentElicitationRequestSchema, AgentRequestResolutionSchema, AgentRequestSchema, } from './requests.js';
6
+ export { AgentApprovalConsequenceSchema, AgentApprovalRequestSchema, AgentApprovalResolutionSchema, AgentElicitationRequestSchema, AgentRequestResolutionSchema, AgentRequestSchema, } from './requests.js';
6
7
  export { AgentOperationCatalogSchema, AgentOperationDescriptorSchema, AgentOperationFieldSchema, AgentOperationInvocationSchema, AgentOperationResultSchema, } from './operations.js';
7
8
  export { AgentManagedContentCatalogSchema, AgentManagedContentDescriptorSchema, } from './managedContent.js';
8
9
  export { AgentConfigurationCatalogSchema, AgentConfigurationFieldPortableSchema, AgentConfigurationSelectionInputSchema, AgentConfigurationValueSchema, } from './configuration.js';
package/dist/zod/index.js CHANGED
@@ -47,6 +47,36 @@ import {
47
47
  AgentSessionOpenInputSchema,
48
48
  AgentSessionResumeInputSchema
49
49
  } from "./sessions.js";
50
+ import {
51
+ AgentSessionDecisionChoiceIdSchema,
52
+ AgentSessionFormChoiceIdSchema,
53
+ AgentSessionPlanReviewChoiceIdSchema,
54
+ AgentSessionPlanIdSchema,
55
+ AgentSessionPlanRevisionSchema,
56
+ AgentSessionWorkspaceTargetSchema,
57
+ AgentSessionDecisionConsequenceSchema,
58
+ AgentSessionDecisionChoiceSchema,
59
+ AgentSessionFormChoiceSchema,
60
+ AgentSessionPlanSnapshotPortableSchema,
61
+ AgentSessionPlanSnapshotSchema,
62
+ AgentSessionPlanReviewChoiceSchema,
63
+ AgentSessionDecisionRequestPortableSchema,
64
+ AgentSessionDecisionRequestSchema,
65
+ AgentSessionFormRequestPortableSchema,
66
+ AgentSessionFormRequestSchema,
67
+ AgentSessionPlanReviewRequestPortableSchema,
68
+ AgentSessionPlanReviewRequestSchema,
69
+ AgentSessionRequestPortableSchema,
70
+ AgentSessionRequestSchema,
71
+ AgentSessionDecisionResponsePortableSchema,
72
+ AgentSessionDecisionResponseSchema,
73
+ AgentSessionFormResponsePortableSchema,
74
+ AgentSessionFormResponseSchema,
75
+ AgentSessionPlanReviewResponsePortableSchema,
76
+ AgentSessionPlanReviewResponseSchema,
77
+ AgentSessionResponsePortableSchema,
78
+ AgentSessionResponseSchema
79
+ } from "./sessionInteractions.js";
50
80
  import {
51
81
  AgentBrowserActionDetailsSchema,
52
82
  AgentCollaborationToolCallDetailsSchema,
@@ -74,6 +104,7 @@ import {
74
104
  AgentWebSearchDetailsSchema
75
105
  } from "./turns.js";
76
106
  import {
107
+ AgentApprovalConsequenceSchema,
77
108
  AgentApprovalRequestSchema,
78
109
  AgentApprovalResolutionSchema,
79
110
  AgentElicitationRequestSchema,
@@ -123,6 +154,7 @@ export * from "./extensions.js";
123
154
  export * from "./environment.js";
124
155
  export {
125
156
  AgentApprovalCapabilitySchema,
157
+ AgentApprovalConsequenceSchema,
126
158
  AgentApprovalOptionIdSchema,
127
159
  AgentApprovalRequestSchema,
128
160
  AgentApprovalResolutionSchema,
@@ -206,9 +238,37 @@ export {
206
238
  AgentSessionBranchSourceSchema,
207
239
  AgentSessionConfigurationSchema,
208
240
  AgentSessionCreateInputSchema,
241
+ AgentSessionDecisionChoiceIdSchema,
242
+ AgentSessionDecisionChoiceSchema,
243
+ AgentSessionDecisionConsequenceSchema,
244
+ AgentSessionDecisionRequestPortableSchema,
245
+ AgentSessionDecisionRequestSchema,
246
+ AgentSessionDecisionResponsePortableSchema,
247
+ AgentSessionDecisionResponseSchema,
248
+ AgentSessionFormChoiceIdSchema,
249
+ AgentSessionFormChoiceSchema,
250
+ AgentSessionFormRequestPortableSchema,
251
+ AgentSessionFormRequestSchema,
252
+ AgentSessionFormResponsePortableSchema,
253
+ AgentSessionFormResponseSchema,
209
254
  AgentSessionIdSchema,
210
255
  AgentSessionOpenInputSchema,
256
+ AgentSessionPlanIdSchema,
257
+ AgentSessionPlanReviewChoiceIdSchema,
258
+ AgentSessionPlanReviewChoiceSchema,
259
+ AgentSessionPlanReviewRequestPortableSchema,
260
+ AgentSessionPlanReviewRequestSchema,
261
+ AgentSessionPlanReviewResponsePortableSchema,
262
+ AgentSessionPlanReviewResponseSchema,
263
+ AgentSessionPlanRevisionSchema,
264
+ AgentSessionPlanSnapshotPortableSchema,
265
+ AgentSessionPlanSnapshotSchema,
266
+ AgentSessionRequestPortableSchema,
267
+ AgentSessionRequestSchema,
268
+ AgentSessionResponsePortableSchema,
269
+ AgentSessionResponseSchema,
211
270
  AgentSessionResumeInputSchema,
271
+ AgentSessionWorkspaceTargetSchema,
212
272
  AgentTurnCompletedPayloadSchema,
213
273
  AgentTurnIdSchema,
214
274
  AgentTurnInputContentCompositionSchema,
@@ -323,9 +323,9 @@ export declare const AgentOperationInvocationSchema: z.ZodType<AgentOperationInv
323
323
  export declare const AgentOperationResultPortableSchema: z.ZodReadonly<z.ZodObject<{
324
324
  invocationId: z.ZodType<import("../index.js").AgentOperationInvocationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentOperationInvocationId, unknown>>;
325
325
  status: z.ZodEnum<{
326
+ canceled: "canceled";
326
327
  completed: "completed";
327
328
  failed: "failed";
328
- canceled: "canceled";
329
329
  waiting_for_request: "waiting_for_request";
330
330
  accepted: "accepted";
331
331
  }>;