@agen-ai/agent-protocol 0.2.2 → 0.2.3

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 (91) hide show
  1. package/README.md +22 -12
  2. package/dist/capabilities/types.d.ts +64 -18
  3. package/dist/capabilities/types.js +0 -6
  4. package/dist/collaboration/index.d.ts +3 -0
  5. package/dist/collaboration/index.js +2 -0
  6. package/dist/collaboration/parsers.d.ts +9 -0
  7. package/dist/collaboration/parsers.js +32 -0
  8. package/dist/collaboration/types.d.ts +88 -0
  9. package/dist/collaboration/types.js +64 -0
  10. package/dist/configuration/index.d.ts +3 -0
  11. package/dist/configuration/index.js +2 -0
  12. package/dist/configuration/parsers.d.ts +9 -0
  13. package/dist/configuration/parsers.js +98 -0
  14. package/dist/configuration/types.d.ts +72 -0
  15. package/dist/configuration/types.js +27 -0
  16. package/dist/events/types.d.ts +15 -3
  17. package/dist/events/types.js +3 -0
  18. package/dist/foundation/parsers.d.ts +19 -1
  19. package/dist/foundation/parsers.js +70 -0
  20. package/dist/foundation/types.d.ts +10 -1
  21. package/dist/foundation/types.js +1 -1
  22. package/dist/integrations/index.d.ts +3 -0
  23. package/dist/integrations/index.js +2 -0
  24. package/dist/integrations/parsers.d.ts +7 -0
  25. package/dist/integrations/parsers.js +23 -0
  26. package/dist/integrations/types.d.ts +43 -0
  27. package/dist/integrations/types.js +23 -0
  28. package/dist/jsonSchema/generated.d.ts +9686 -3515
  29. package/dist/jsonSchema/generated.js +5341 -1391
  30. package/dist/managedContent/index.d.ts +3 -0
  31. package/dist/managedContent/index.js +2 -0
  32. package/dist/managedContent/parsers.d.ts +7 -0
  33. package/dist/managedContent/parsers.js +23 -0
  34. package/dist/managedContent/types.d.ts +39 -0
  35. package/dist/managedContent/types.js +21 -0
  36. package/dist/operations/index.d.ts +3 -0
  37. package/dist/operations/index.js +2 -0
  38. package/dist/operations/parsers.d.ts +15 -0
  39. package/dist/operations/parsers.js +181 -0
  40. package/dist/operations/types.d.ts +112 -0
  41. package/dist/operations/types.js +67 -0
  42. package/dist/public/collaboration.d.ts +2 -0
  43. package/dist/public/collaboration.js +1 -0
  44. package/dist/public/configuration.d.ts +2 -0
  45. package/dist/public/configuration.js +1 -0
  46. package/dist/public/index.d.ts +6 -0
  47. package/dist/public/index.js +6 -0
  48. package/dist/public/integrations.d.ts +2 -0
  49. package/dist/public/integrations.js +1 -0
  50. package/dist/public/managedContent.d.ts +2 -0
  51. package/dist/public/managedContent.js +1 -0
  52. package/dist/public/operations.d.ts +2 -0
  53. package/dist/public/operations.js +1 -0
  54. package/dist/public/resources.d.ts +2 -0
  55. package/dist/public/resources.js +1 -0
  56. package/dist/requests/parsers.js +40 -11
  57. package/dist/requests/types.d.ts +35 -8
  58. package/dist/requests/types.js +15 -1
  59. package/dist/resources/index.d.ts +3 -0
  60. package/dist/resources/index.js +2 -0
  61. package/dist/resources/parsers.d.ts +5 -0
  62. package/dist/resources/parsers.js +12 -0
  63. package/dist/resources/types.d.ts +39 -0
  64. package/dist/resources/types.js +19 -0
  65. package/dist/sessions/types.d.ts +15 -4
  66. package/dist/zod/capabilities.d.ts +103 -15
  67. package/dist/zod/capabilities.js +196 -31
  68. package/dist/zod/collaboration.d.ts +60 -0
  69. package/dist/zod/collaboration.js +155 -0
  70. package/dist/zod/configuration.d.ts +177 -0
  71. package/dist/zod/configuration.js +157 -0
  72. package/dist/zod/events.d.ts +214 -22
  73. package/dist/zod/events.js +15 -0
  74. package/dist/zod/foundation.d.ts +10 -1
  75. package/dist/zod/foundation.js +18 -0
  76. package/dist/zod/index.d.ts +7 -1
  77. package/dist/zod/index.js +62 -0
  78. package/dist/zod/integrations.d.ts +76 -0
  79. package/dist/zod/integrations.js +92 -0
  80. package/dist/zod/managedContent.d.ts +9 -0
  81. package/dist/zod/managedContent.js +70 -0
  82. package/dist/zod/operations.d.ts +339 -0
  83. package/dist/zod/operations.js +229 -0
  84. package/dist/zod/requests.d.ts +100 -11
  85. package/dist/zod/requests.js +66 -26
  86. package/dist/zod/resources.d.ts +43 -0
  87. package/dist/zod/resources.js +82 -0
  88. package/dist/zod/sessions.d.ts +168 -21
  89. package/dist/zod/sessions.js +54 -42
  90. package/dist/zod/typeEquality.generated.d.ts +40 -0
  91. package/package.json +26 -2
@@ -0,0 +1,82 @@
1
+ import { z } from "zod/v4";
2
+ import { AGENT_ARTIFACT_BYTE_SIZE_MAX } from "../artifacts/types.js";
3
+ import {
4
+ AGENT_GENERATED_RESOURCE_DISPLAY_NAME_MAX_LENGTH,
5
+ AGENT_GENERATED_RESOURCE_KINDS,
6
+ AGENT_GENERATED_RESOURCE_STATUSES,
7
+ AGENT_GENERATED_RESOURCE_SUMMARY_MAX_LENGTH
8
+ } from "../resources/types.js";
9
+ import {
10
+ AgentArtifactIdSchema,
11
+ AgentCollaborationIdSchema,
12
+ AgentErrorSchema,
13
+ AgentGeneratedResourceIdSchema,
14
+ AgentIsoDateTimeSchema,
15
+ AgentOperationInvocationIdSchema,
16
+ AgentSessionIdSchema,
17
+ AgentTurnIdSchema,
18
+ createAgentCanonicalNonBlankStringSchema
19
+ } from "./foundation.js";
20
+ const PositiveSafeIntegerSchema = z.number().int().positive().max(Number.MAX_SAFE_INTEGER);
21
+ const MediaTypeSchema = z.string().min(1).max(200).regex(/^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$/u);
22
+ const ProducerSchema = z.discriminatedUnion("kind", [
23
+ z.object({ kind: z.literal("session"), sessionId: AgentSessionIdSchema }).strict().readonly(),
24
+ z.object({ kind: z.literal("turn"), turnId: AgentTurnIdSchema }).strict().readonly(),
25
+ z.object({ kind: z.literal("operation"), invocationId: AgentOperationInvocationIdSchema }).strict().readonly(),
26
+ z.object({ kind: z.literal("collaboration"), collaborationId: AgentCollaborationIdSchema }).strict().readonly()
27
+ ]);
28
+ const AgentGeneratedResourceDescriptorPortableSchema = z.object({
29
+ resourceId: AgentGeneratedResourceIdSchema,
30
+ kind: z.enum(AGENT_GENERATED_RESOURCE_KINDS),
31
+ status: z.enum(AGENT_GENERATED_RESOURCE_STATUSES),
32
+ displayName: createAgentCanonicalNonBlankStringSchema(AGENT_GENERATED_RESOURCE_DISPLAY_NAME_MAX_LENGTH),
33
+ producer: ProducerSchema,
34
+ summary: createAgentCanonicalNonBlankStringSchema(AGENT_GENERATED_RESOURCE_SUMMARY_MAX_LENGTH).optional(),
35
+ mediaType: MediaTypeSchema.optional(),
36
+ byteSize: z.number().int().nonnegative().max(AGENT_ARTIFACT_BYTE_SIZE_MAX).optional(),
37
+ sha256: z.string().regex(/^[a-f0-9]{64}$/u).optional(),
38
+ widthPixels: PositiveSafeIntegerSchema.optional(),
39
+ heightPixels: PositiveSafeIntegerSchema.optional(),
40
+ pageCount: PositiveSafeIntegerSchema.optional(),
41
+ artifactId: AgentArtifactIdSchema.optional(),
42
+ createdAt: AgentIsoDateTimeSchema,
43
+ expiresAt: AgentIsoDateTimeSchema.optional(),
44
+ error: AgentErrorSchema.optional()
45
+ }).strict().readonly();
46
+ const AgentGeneratedResourceDescriptorSchema = AgentGeneratedResourceDescriptorPortableSchema.superRefine((resource, context) => {
47
+ const available = resource.status === "available";
48
+ if (available !== (resource.artifactId !== void 0)) {
49
+ context.addIssue({ code: "custom", path: ["artifactId"], message: "Exactly available resources must reference a published artifact." });
50
+ }
51
+ if (available !== (resource.sha256 !== void 0)) {
52
+ context.addIssue({ code: "custom", path: ["sha256"], message: "Exactly available resources must include a SHA-256 digest." });
53
+ }
54
+ if (available && (resource.byteSize === void 0 || resource.mediaType === void 0)) {
55
+ context.addIssue({ code: "custom", path: ["byteSize"], message: "Available resources must include byte size and media type." });
56
+ }
57
+ if (resource.status === "unavailable" !== (resource.error !== void 0)) {
58
+ context.addIssue({ code: "custom", path: ["error"], message: "Exactly unavailable resources must include an error." });
59
+ }
60
+ if (resource.status === "expired" && resource.expiresAt === void 0) {
61
+ context.addIssue({ code: "custom", path: ["expiresAt"], message: "Expired resources must include their expiry." });
62
+ }
63
+ if (resource.widthPixels === void 0 !== (resource.heightPixels === void 0)) {
64
+ context.addIssue({ code: "custom", path: ["widthPixels"], message: "Image dimensions must include both width and height." });
65
+ }
66
+ if (available && resource.kind === "image" && resource.widthPixels === void 0) {
67
+ context.addIssue({ code: "custom", path: ["widthPixels"], message: "Available image resources must include decoded dimensions." });
68
+ }
69
+ if (resource.kind !== "image" && resource.widthPixels !== void 0) {
70
+ context.addIssue({ code: "custom", path: ["widthPixels"], message: "Only image resources may include pixel dimensions." });
71
+ }
72
+ if (resource.kind !== "document" && resource.pageCount !== void 0) {
73
+ context.addIssue({ code: "custom", path: ["pageCount"], message: "Only document resources may include a page count." });
74
+ }
75
+ if (resource.expiresAt !== void 0 && Date.parse(resource.expiresAt) <= Date.parse(resource.createdAt)) {
76
+ context.addIssue({ code: "custom", path: ["expiresAt"], message: "Resource expiry must follow creation." });
77
+ }
78
+ });
79
+ export {
80
+ AgentGeneratedResourceDescriptorPortableSchema,
81
+ AgentGeneratedResourceDescriptorSchema
82
+ };
@@ -1,61 +1,208 @@
1
1
  import { z } from 'zod/v4';
2
2
  import type { AgentSessionBinding, AgentSessionBranchSource, AgentSessionBranchInput, AgentSessionConfiguration, AgentSessionCreateInput, AgentSessionOpenInput, AgentSessionResumeInput } from '../sessions/types.js';
3
3
  export declare const AgentSessionBindingSchema: z.ZodType<AgentSessionBinding>;
4
- export declare const AgentSessionConfigurationPortableSchema: z.ZodReadonly<z.ZodObject<{
4
+ export declare const AgentSessionConfigurationPortableSchema: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
5
+ kind: z.ZodLiteral<"managed">;
5
6
  revision: z.ZodType<import("../index.js").AgentConfigurationRevisionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentConfigurationRevisionId, unknown>>;
6
- values: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodType<import("../index.js").AgentJsonValue, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentJsonValue, unknown>>>>;
7
- }, z.core.$strict>>;
7
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
8
+ kind: z.ZodLiteral<"selected">;
9
+ revision: z.ZodType<import("../index.js").AgentConfigurationRevisionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentConfigurationRevisionId, unknown>>;
10
+ catalogRevision: z.ZodNumber;
11
+ selections: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
12
+ key: z.ZodString;
13
+ fieldRevision: z.ZodNumber;
14
+ value: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
15
+ fieldKind: z.ZodLiteral<"boolean">;
16
+ value: z.ZodBoolean;
17
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
18
+ fieldKind: z.ZodLiteral<"single_select">;
19
+ optionId: z.ZodString;
20
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
21
+ fieldKind: z.ZodLiteral<"bounded_integer">;
22
+ value: z.ZodNumber;
23
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
24
+ fieldKind: z.ZodLiteral<"bounded_text">;
25
+ value: z.ZodString;
26
+ }, z.core.$strict>>], "fieldKind">;
27
+ }, z.core.$strict>>>>;
28
+ }, z.core.$strict>>], "kind">;
8
29
  export declare const AgentSessionConfigurationSchema: z.ZodType<AgentSessionConfiguration>;
9
30
  export declare const AgentSessionCreateInputPortableSchema: z.ZodReadonly<z.ZodObject<{
10
31
  operation: z.ZodLiteral<"create">;
11
32
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
12
- configuration: z.ZodReadonly<z.ZodObject<{
33
+ configuration: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
34
+ kind: z.ZodLiteral<"managed">;
13
35
  revision: z.ZodType<import("../index.js").AgentConfigurationRevisionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentConfigurationRevisionId, unknown>>;
14
- values: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodType<import("../index.js").AgentJsonValue, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentJsonValue, unknown>>>>;
15
- }, z.core.$strict>>;
36
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
37
+ kind: z.ZodLiteral<"selected">;
38
+ revision: z.ZodType<import("../index.js").AgentConfigurationRevisionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentConfigurationRevisionId, unknown>>;
39
+ catalogRevision: z.ZodNumber;
40
+ selections: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
41
+ key: z.ZodString;
42
+ fieldRevision: z.ZodNumber;
43
+ value: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
44
+ fieldKind: z.ZodLiteral<"boolean">;
45
+ value: z.ZodBoolean;
46
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
47
+ fieldKind: z.ZodLiteral<"single_select">;
48
+ optionId: z.ZodString;
49
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
50
+ fieldKind: z.ZodLiteral<"bounded_integer">;
51
+ value: z.ZodNumber;
52
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
53
+ fieldKind: z.ZodLiteral<"bounded_text">;
54
+ value: z.ZodString;
55
+ }, z.core.$strict>>], "fieldKind">;
56
+ }, z.core.$strict>>>>;
57
+ }, z.core.$strict>>], "kind">;
16
58
  }, z.core.$strict>>;
17
59
  export declare const AgentSessionResumeInputPortableSchema: z.ZodReadonly<z.ZodObject<{
18
60
  operation: z.ZodLiteral<"resume">;
19
61
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
20
62
  binding: z.ZodType<AgentSessionBinding, unknown, z.core.$ZodTypeInternals<AgentSessionBinding, unknown>>;
21
- configuration: z.ZodReadonly<z.ZodObject<{
63
+ configuration: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
64
+ kind: z.ZodLiteral<"managed">;
65
+ revision: z.ZodType<import("../index.js").AgentConfigurationRevisionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentConfigurationRevisionId, unknown>>;
66
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
67
+ kind: z.ZodLiteral<"selected">;
22
68
  revision: z.ZodType<import("../index.js").AgentConfigurationRevisionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentConfigurationRevisionId, unknown>>;
23
- values: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodType<import("../index.js").AgentJsonValue, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentJsonValue, unknown>>>>;
24
- }, z.core.$strict>>;
69
+ catalogRevision: z.ZodNumber;
70
+ selections: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
71
+ key: z.ZodString;
72
+ fieldRevision: z.ZodNumber;
73
+ value: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
74
+ fieldKind: z.ZodLiteral<"boolean">;
75
+ value: z.ZodBoolean;
76
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
77
+ fieldKind: z.ZodLiteral<"single_select">;
78
+ optionId: z.ZodString;
79
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
80
+ fieldKind: z.ZodLiteral<"bounded_integer">;
81
+ value: z.ZodNumber;
82
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
83
+ fieldKind: z.ZodLiteral<"bounded_text">;
84
+ value: z.ZodString;
85
+ }, z.core.$strict>>], "fieldKind">;
86
+ }, z.core.$strict>>>>;
87
+ }, z.core.$strict>>], "kind">;
25
88
  }, z.core.$strict>>;
26
89
  export declare const AgentSessionBranchSourceSchema: z.ZodType<AgentSessionBranchSource>;
27
90
  export declare const AgentSessionBranchInputPortableSchema: z.ZodReadonly<z.ZodObject<{
28
91
  operation: z.ZodLiteral<"branch">;
29
92
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
30
93
  source: z.ZodType<AgentSessionBranchSource, unknown, z.core.$ZodTypeInternals<AgentSessionBranchSource, unknown>>;
31
- configuration: z.ZodReadonly<z.ZodObject<{
94
+ configuration: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
95
+ kind: z.ZodLiteral<"managed">;
32
96
  revision: z.ZodType<import("../index.js").AgentConfigurationRevisionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentConfigurationRevisionId, unknown>>;
33
- values: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodType<import("../index.js").AgentJsonValue, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentJsonValue, unknown>>>>;
34
- }, z.core.$strict>>;
97
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
98
+ kind: z.ZodLiteral<"selected">;
99
+ revision: z.ZodType<import("../index.js").AgentConfigurationRevisionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentConfigurationRevisionId, unknown>>;
100
+ catalogRevision: z.ZodNumber;
101
+ selections: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
102
+ key: z.ZodString;
103
+ fieldRevision: z.ZodNumber;
104
+ value: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
105
+ fieldKind: z.ZodLiteral<"boolean">;
106
+ value: z.ZodBoolean;
107
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
108
+ fieldKind: z.ZodLiteral<"single_select">;
109
+ optionId: z.ZodString;
110
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
111
+ fieldKind: z.ZodLiteral<"bounded_integer">;
112
+ value: z.ZodNumber;
113
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
114
+ fieldKind: z.ZodLiteral<"bounded_text">;
115
+ value: z.ZodString;
116
+ }, z.core.$strict>>], "fieldKind">;
117
+ }, z.core.$strict>>>>;
118
+ }, z.core.$strict>>], "kind">;
35
119
  }, z.core.$strict>>;
36
120
  declare const AgentSessionOpenInputPortableSchema: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
37
121
  operation: z.ZodLiteral<"create">;
38
122
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
39
- configuration: z.ZodReadonly<z.ZodObject<{
123
+ configuration: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
124
+ kind: z.ZodLiteral<"managed">;
125
+ revision: z.ZodType<import("../index.js").AgentConfigurationRevisionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentConfigurationRevisionId, unknown>>;
126
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
127
+ kind: z.ZodLiteral<"selected">;
40
128
  revision: z.ZodType<import("../index.js").AgentConfigurationRevisionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentConfigurationRevisionId, unknown>>;
41
- values: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodType<import("../index.js").AgentJsonValue, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentJsonValue, unknown>>>>;
42
- }, z.core.$strict>>;
129
+ catalogRevision: z.ZodNumber;
130
+ selections: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
131
+ key: z.ZodString;
132
+ fieldRevision: z.ZodNumber;
133
+ value: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
134
+ fieldKind: z.ZodLiteral<"boolean">;
135
+ value: z.ZodBoolean;
136
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
137
+ fieldKind: z.ZodLiteral<"single_select">;
138
+ optionId: z.ZodString;
139
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
140
+ fieldKind: z.ZodLiteral<"bounded_integer">;
141
+ value: z.ZodNumber;
142
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
143
+ fieldKind: z.ZodLiteral<"bounded_text">;
144
+ value: z.ZodString;
145
+ }, z.core.$strict>>], "fieldKind">;
146
+ }, z.core.$strict>>>>;
147
+ }, z.core.$strict>>], "kind">;
43
148
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
44
149
  operation: z.ZodLiteral<"resume">;
45
150
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
46
151
  binding: z.ZodType<AgentSessionBinding, unknown, z.core.$ZodTypeInternals<AgentSessionBinding, unknown>>;
47
- configuration: z.ZodReadonly<z.ZodObject<{
152
+ configuration: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
153
+ kind: z.ZodLiteral<"managed">;
48
154
  revision: z.ZodType<import("../index.js").AgentConfigurationRevisionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentConfigurationRevisionId, unknown>>;
49
- values: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodType<import("../index.js").AgentJsonValue, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentJsonValue, unknown>>>>;
50
- }, z.core.$strict>>;
155
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
156
+ kind: z.ZodLiteral<"selected">;
157
+ revision: z.ZodType<import("../index.js").AgentConfigurationRevisionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentConfigurationRevisionId, unknown>>;
158
+ catalogRevision: z.ZodNumber;
159
+ selections: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
160
+ key: z.ZodString;
161
+ fieldRevision: z.ZodNumber;
162
+ value: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
163
+ fieldKind: z.ZodLiteral<"boolean">;
164
+ value: z.ZodBoolean;
165
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
166
+ fieldKind: z.ZodLiteral<"single_select">;
167
+ optionId: z.ZodString;
168
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
169
+ fieldKind: z.ZodLiteral<"bounded_integer">;
170
+ value: z.ZodNumber;
171
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
172
+ fieldKind: z.ZodLiteral<"bounded_text">;
173
+ value: z.ZodString;
174
+ }, z.core.$strict>>], "fieldKind">;
175
+ }, z.core.$strict>>>>;
176
+ }, z.core.$strict>>], "kind">;
51
177
  }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
52
178
  operation: z.ZodLiteral<"branch">;
53
179
  sessionId: z.ZodType<import("../index.js").AgentSessionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentSessionId, unknown>>;
54
180
  source: z.ZodType<AgentSessionBranchSource, unknown, z.core.$ZodTypeInternals<AgentSessionBranchSource, unknown>>;
55
- configuration: z.ZodReadonly<z.ZodObject<{
181
+ configuration: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
182
+ kind: z.ZodLiteral<"managed">;
183
+ revision: z.ZodType<import("../index.js").AgentConfigurationRevisionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentConfigurationRevisionId, unknown>>;
184
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
185
+ kind: z.ZodLiteral<"selected">;
56
186
  revision: z.ZodType<import("../index.js").AgentConfigurationRevisionId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentConfigurationRevisionId, unknown>>;
57
- values: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodType<import("../index.js").AgentJsonValue, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentJsonValue, unknown>>>>;
58
- }, z.core.$strict>>;
187
+ catalogRevision: z.ZodNumber;
188
+ selections: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
189
+ key: z.ZodString;
190
+ fieldRevision: z.ZodNumber;
191
+ value: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
192
+ fieldKind: z.ZodLiteral<"boolean">;
193
+ value: z.ZodBoolean;
194
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
195
+ fieldKind: z.ZodLiteral<"single_select">;
196
+ optionId: z.ZodString;
197
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
198
+ fieldKind: z.ZodLiteral<"bounded_integer">;
199
+ value: z.ZodNumber;
200
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
201
+ fieldKind: z.ZodLiteral<"bounded_text">;
202
+ value: z.ZodString;
203
+ }, z.core.$strict>>], "fieldKind">;
204
+ }, z.core.$strict>>>>;
205
+ }, z.core.$strict>>], "kind">;
59
206
  }, z.core.$strict>>], "operation">;
60
207
  export declare const AgentSessionCreateInputSchema: z.ZodType<AgentSessionCreateInput>;
61
208
  export declare const AgentSessionResumeInputSchema: z.ZodType<AgentSessionResumeInput>;
@@ -1,48 +1,72 @@
1
1
  import { z } from "zod/v4";
2
+ import { compareStringsByUnicodeCodePoint } from "../foundation/ordering.js";
2
3
  import {
3
- AGENT_PROTOCOL_COLLECTION_MAX_LENGTH,
4
4
  AGENT_PROTOCOL_JSON_BYTES_LIMIT,
5
- AGENT_PROTOCOL_JSON_DEPTH_LIMIT,
6
5
  agentProtocolSerializedJsonBytes
7
6
  } from "../foundation/types.js";
7
+ import { AGENT_CONFIGURATION_FIELDS_MAX_LENGTH } from "../configuration/types.js";
8
8
  import {
9
9
  AgentConfigurationRevisionIdSchema,
10
- AgentJsonObjectKeySchema,
11
- AgentJsonValuePortableSchema,
10
+ AgentCanonicalIdValueSchema,
12
11
  AgentProviderConversationIdSchema,
13
12
  AgentProviderHistoryAnchorSchema,
14
13
  AgentSessionIdSchema,
15
- AgentTurnIdSchema,
16
- withAcyclicProtocolInput
14
+ AgentTurnIdSchema
17
15
  } from "./foundation.js";
18
- const SESSION_CONFIGURATION_JSON_DEPTH_OFFSET = 2;
19
- const SESSION_OPEN_JSON_DEPTH_OFFSET = 3;
16
+ import { AgentConfigurationValueSchema } from "./configuration.js";
17
+ const PositiveSafeIntegerSchema = z.number().int().positive().max(Number.MAX_SAFE_INTEGER);
20
18
  const AgentSessionBindingSchema = z.object({
21
19
  conversationId: AgentProviderConversationIdSchema,
22
20
  historyAnchor: AgentProviderHistoryAnchorSchema.optional()
23
21
  }).strict().readonly();
24
- const AgentSessionConfigurationPortableSchema = z.object({
25
- revision: AgentConfigurationRevisionIdSchema,
26
- values: z.record(
27
- AgentJsonObjectKeySchema,
28
- AgentJsonValuePortableSchema
29
- ).readonly()
30
- }).strict().readonly();
31
- const AgentSessionConfigurationSchema = withAcyclicProtocolInput(AgentSessionConfigurationPortableSchema, {
32
- maxDepth: AGENT_PROTOCOL_JSON_DEPTH_LIMIT + SESSION_CONFIGURATION_JSON_DEPTH_OFFSET,
33
- maxCollectionLength: AGENT_PROTOCOL_COLLECTION_MAX_LENGTH
34
- }).superRefine((configuration, context) => {
35
- if (Object.keys(configuration.values).length > AGENT_PROTOCOL_COLLECTION_MAX_LENGTH) {
36
- context.addIssue({
37
- code: "custom",
38
- path: ["values"],
39
- message: `Session configuration cannot exceed ${AGENT_PROTOCOL_COLLECTION_MAX_LENGTH} entries.`
22
+ const AgentSessionConfigurationPortableSchema = z.discriminatedUnion(
23
+ "kind",
24
+ [
25
+ z.object({
26
+ kind: z.literal("managed"),
27
+ revision: AgentConfigurationRevisionIdSchema
28
+ }).strict().readonly(),
29
+ z.object({
30
+ kind: z.literal("selected"),
31
+ revision: AgentConfigurationRevisionIdSchema,
32
+ catalogRevision: PositiveSafeIntegerSchema,
33
+ selections: z.array(
34
+ z.object({
35
+ key: AgentCanonicalIdValueSchema,
36
+ fieldRevision: PositiveSafeIntegerSchema,
37
+ value: AgentConfigurationValueSchema
38
+ }).strict().readonly()
39
+ ).max(AGENT_CONFIGURATION_FIELDS_MAX_LENGTH).readonly()
40
+ }).strict().readonly()
41
+ ]
42
+ );
43
+ const AgentSessionConfigurationSchema = AgentSessionConfigurationPortableSchema.superRefine((configuration, context) => {
44
+ if (configuration.kind === "selected") {
45
+ const keys = /* @__PURE__ */ new Set();
46
+ let previousKey = "";
47
+ configuration.selections.forEach((selection, selectionIndex) => {
48
+ if (keys.has(selection.key)) {
49
+ context.addIssue({
50
+ code: "custom",
51
+ path: ["selections", selectionIndex, "key"],
52
+ message: "Session configuration keys must be unique."
53
+ });
54
+ }
55
+ if (selectionIndex > 0 && compareStringsByUnicodeCodePoint(previousKey, selection.key) >= 0) {
56
+ context.addIssue({
57
+ code: "custom",
58
+ path: ["selections", selectionIndex, "key"],
59
+ message: "Session configuration selections must be ordered by key."
60
+ });
61
+ }
62
+ keys.add(selection.key);
63
+ previousKey = selection.key;
40
64
  });
41
65
  }
42
- if (agentProtocolSerializedJsonBytes(configuration.values) > AGENT_PROTOCOL_JSON_BYTES_LIMIT) {
66
+ if (agentProtocolSerializedJsonBytes(configuration) > AGENT_PROTOCOL_JSON_BYTES_LIMIT) {
43
67
  context.addIssue({
44
68
  code: "custom",
45
- path: ["values"],
69
+ path: [],
46
70
  message: `Session configuration cannot exceed ${AGENT_PROTOCOL_JSON_BYTES_LIMIT} serialized bytes.`
47
71
  });
48
72
  }
@@ -92,22 +116,10 @@ function validateSessionOpenInput(input, context) {
92
116
  });
93
117
  }
94
118
  }
95
- const AgentSessionCreateInputSchema = withAcyclicProtocolInput(AgentSessionCreateInputPortableSchema, {
96
- maxDepth: AGENT_PROTOCOL_JSON_DEPTH_LIMIT + SESSION_OPEN_JSON_DEPTH_OFFSET,
97
- maxCollectionLength: AGENT_PROTOCOL_COLLECTION_MAX_LENGTH
98
- }).superRefine(validateSessionOpenInput);
99
- const AgentSessionResumeInputSchema = withAcyclicProtocolInput(AgentSessionResumeInputPortableSchema, {
100
- maxDepth: AGENT_PROTOCOL_JSON_DEPTH_LIMIT + SESSION_OPEN_JSON_DEPTH_OFFSET,
101
- maxCollectionLength: AGENT_PROTOCOL_COLLECTION_MAX_LENGTH
102
- }).superRefine(validateSessionOpenInput);
103
- const AgentSessionBranchInputSchema = withAcyclicProtocolInput(AgentSessionBranchInputPortableSchema, {
104
- maxDepth: AGENT_PROTOCOL_JSON_DEPTH_LIMIT + SESSION_OPEN_JSON_DEPTH_OFFSET,
105
- maxCollectionLength: AGENT_PROTOCOL_COLLECTION_MAX_LENGTH
106
- }).superRefine(validateSessionOpenInput);
107
- const AgentSessionOpenInputSchema = withAcyclicProtocolInput(AgentSessionOpenInputPortableSchema, {
108
- maxDepth: AGENT_PROTOCOL_JSON_DEPTH_LIMIT + SESSION_OPEN_JSON_DEPTH_OFFSET,
109
- maxCollectionLength: AGENT_PROTOCOL_COLLECTION_MAX_LENGTH
110
- }).superRefine(validateSessionOpenInput);
119
+ const AgentSessionCreateInputSchema = AgentSessionCreateInputPortableSchema.superRefine(validateSessionOpenInput);
120
+ const AgentSessionResumeInputSchema = AgentSessionResumeInputPortableSchema.superRefine(validateSessionOpenInput);
121
+ const AgentSessionBranchInputSchema = AgentSessionBranchInputPortableSchema.superRefine(validateSessionOpenInput);
122
+ const AgentSessionOpenInputSchema = AgentSessionOpenInputPortableSchema.superRefine(validateSessionOpenInput);
111
123
  export {
112
124
  AgentSessionBindingSchema,
113
125
  AgentSessionBranchInputPortableSchema,
@@ -1,16 +1,28 @@
1
1
  import type { z } from 'zod/v4';
2
2
  import type { AgentArtifactDescriptor } from '../artifacts/types.js';
3
3
  import type { AgentCapabilities } from '../capabilities/types.js';
4
+ import type { AgentCollaborationControlInput, AgentCollaborationNode, AgentCollaborationSpawnInput } from '../collaboration/types.js';
5
+ import type { AgentConfigurationCatalog, AgentConfigurationSelectionInput } from '../configuration/types.js';
4
6
  import type { AgentEvent } from '../events/types.js';
5
7
  import type { AgentError, AgentJsonValue, AgentProviderRefs } from '../foundation/types.js';
8
+ import type { AgentIntegrationCatalog, AgentIntegrationDescriptor } from '../integrations/types.js';
9
+ import type { AgentManagedContentCatalog, AgentManagedContentDescriptor } from '../managedContent/types.js';
10
+ import type { AgentOperationCatalog, AgentOperationDescriptor, AgentOperationInvocation, AgentOperationResult } from '../operations/types.js';
6
11
  import type { AgentRequest, AgentRequestResolution } from '../requests/types.js';
12
+ import type { AgentGeneratedResourceDescriptor } from '../resources/types.js';
7
13
  import type { AgentSessionBinding, AgentSessionConfiguration, AgentSessionOpenInput } from '../sessions/types.js';
8
14
  import type { AgentItemSnapshot, AgentTurnInputContent, AgentTurnInterruptionInput, AgentTurnRunInput } from '../turns/types.js';
9
15
  import { AgentArtifactDescriptorSchema } from './artifacts.js';
10
16
  import { AgentCapabilitiesSchema } from './capabilities.js';
17
+ import { AgentCollaborationControlInputSchema, AgentCollaborationNodeSchema, AgentCollaborationSpawnInputSchema } from './collaboration.js';
18
+ import { AgentConfigurationCatalogSchema, AgentConfigurationSelectionInputSchema } from './configuration.js';
11
19
  import { AgentEventSchema } from './events.js';
12
20
  import { AgentErrorSchema, AgentJsonValueSchema, AgentProviderRefsSchema } from './foundation.js';
21
+ import { AgentIntegrationCatalogSchema, AgentIntegrationDescriptorSchema } from './integrations.js';
22
+ import { AgentManagedContentCatalogSchema, AgentManagedContentDescriptorSchema } from './managedContent.js';
23
+ import { AgentOperationCatalogSchema, AgentOperationDescriptorSchema, AgentOperationInvocationSchema, AgentOperationResultSchema } from './operations.js';
13
24
  import { AgentRequestResolutionSchema, AgentRequestSchema } from './requests.js';
25
+ import { AgentGeneratedResourceDescriptorSchema } from './resources.js';
14
26
  import { AgentSessionBindingSchema, AgentSessionConfigurationSchema, AgentSessionOpenInputSchema } from './sessions.js';
15
27
  import { AgentItemSnapshotSchema, AgentTurnInputContentSchema, AgentTurnInterruptionInputSchema, AgentTurnRunInputSchema } from './turns.js';
16
28
  type Extends<Left, Right> = [Left] extends [Right] ? true : false;
@@ -40,6 +52,34 @@ export type AgentProtocolSchemaTypeAssertions = readonly [
40
52
  Assert<Extends<AgentRequest, z.output<typeof AgentRequestSchema>>>,
41
53
  Assert<Extends<z.output<typeof AgentRequestResolutionSchema>, AgentRequestResolution>>,
42
54
  Assert<Extends<AgentRequestResolution, z.output<typeof AgentRequestResolutionSchema>>>,
55
+ Assert<Extends<z.output<typeof AgentOperationCatalogSchema>, AgentOperationCatalog>>,
56
+ Assert<Extends<AgentOperationCatalog, z.output<typeof AgentOperationCatalogSchema>>>,
57
+ Assert<Extends<z.output<typeof AgentOperationDescriptorSchema>, AgentOperationDescriptor>>,
58
+ Assert<Extends<AgentOperationDescriptor, z.output<typeof AgentOperationDescriptorSchema>>>,
59
+ Assert<Extends<z.output<typeof AgentOperationInvocationSchema>, AgentOperationInvocation>>,
60
+ Assert<Extends<AgentOperationInvocation, z.output<typeof AgentOperationInvocationSchema>>>,
61
+ Assert<Extends<z.output<typeof AgentOperationResultSchema>, AgentOperationResult>>,
62
+ Assert<Extends<AgentOperationResult, z.output<typeof AgentOperationResultSchema>>>,
63
+ Assert<Extends<z.output<typeof AgentManagedContentCatalogSchema>, AgentManagedContentCatalog>>,
64
+ Assert<Extends<AgentManagedContentCatalog, z.output<typeof AgentManagedContentCatalogSchema>>>,
65
+ Assert<Extends<z.output<typeof AgentManagedContentDescriptorSchema>, AgentManagedContentDescriptor>>,
66
+ Assert<Extends<AgentManagedContentDescriptor, z.output<typeof AgentManagedContentDescriptorSchema>>>,
67
+ Assert<Extends<z.output<typeof AgentConfigurationCatalogSchema>, AgentConfigurationCatalog>>,
68
+ Assert<Extends<AgentConfigurationCatalog, z.output<typeof AgentConfigurationCatalogSchema>>>,
69
+ Assert<Extends<z.output<typeof AgentConfigurationSelectionInputSchema>, AgentConfigurationSelectionInput>>,
70
+ Assert<Extends<AgentConfigurationSelectionInput, z.output<typeof AgentConfigurationSelectionInputSchema>>>,
71
+ Assert<Extends<z.output<typeof AgentIntegrationCatalogSchema>, AgentIntegrationCatalog>>,
72
+ Assert<Extends<AgentIntegrationCatalog, z.output<typeof AgentIntegrationCatalogSchema>>>,
73
+ Assert<Extends<z.output<typeof AgentIntegrationDescriptorSchema>, AgentIntegrationDescriptor>>,
74
+ Assert<Extends<AgentIntegrationDescriptor, z.output<typeof AgentIntegrationDescriptorSchema>>>,
75
+ Assert<Extends<z.output<typeof AgentCollaborationNodeSchema>, AgentCollaborationNode>>,
76
+ Assert<Extends<AgentCollaborationNode, z.output<typeof AgentCollaborationNodeSchema>>>,
77
+ Assert<Extends<z.output<typeof AgentCollaborationSpawnInputSchema>, AgentCollaborationSpawnInput>>,
78
+ Assert<Extends<AgentCollaborationSpawnInput, z.output<typeof AgentCollaborationSpawnInputSchema>>>,
79
+ Assert<Extends<z.output<typeof AgentCollaborationControlInputSchema>, AgentCollaborationControlInput>>,
80
+ Assert<Extends<AgentCollaborationControlInput, z.output<typeof AgentCollaborationControlInputSchema>>>,
81
+ Assert<Extends<z.output<typeof AgentGeneratedResourceDescriptorSchema>, AgentGeneratedResourceDescriptor>>,
82
+ Assert<Extends<AgentGeneratedResourceDescriptor, z.output<typeof AgentGeneratedResourceDescriptorSchema>>>,
43
83
  Assert<Extends<z.output<typeof AgentCapabilitiesSchema>, AgentCapabilities>>,
44
84
  Assert<Extends<AgentCapabilities, z.output<typeof AgentCapabilitiesSchema>>>,
45
85
  Assert<Extends<z.output<typeof AgentArtifactDescriptorSchema>, AgentArtifactDescriptor>>,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agen-ai/agent-protocol",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "private": false,
5
5
  "description": "Provider-neutral sessions, turns, requests, capabilities, artifacts, and events for coding-agent runtimes.",
6
6
  "type": "module",
@@ -32,6 +32,30 @@
32
32
  "types": "./dist/public/requests.d.ts",
33
33
  "import": "./dist/public/requests.js"
34
34
  },
35
+ "./operations": {
36
+ "types": "./dist/public/operations.d.ts",
37
+ "import": "./dist/public/operations.js"
38
+ },
39
+ "./managed-content": {
40
+ "types": "./dist/public/managedContent.d.ts",
41
+ "import": "./dist/public/managedContent.js"
42
+ },
43
+ "./configuration": {
44
+ "types": "./dist/public/configuration.d.ts",
45
+ "import": "./dist/public/configuration.js"
46
+ },
47
+ "./integrations": {
48
+ "types": "./dist/public/integrations.d.ts",
49
+ "import": "./dist/public/integrations.js"
50
+ },
51
+ "./collaboration": {
52
+ "types": "./dist/public/collaboration.d.ts",
53
+ "import": "./dist/public/collaboration.js"
54
+ },
55
+ "./resources": {
56
+ "types": "./dist/public/resources.d.ts",
57
+ "import": "./dist/public/resources.js"
58
+ },
35
59
  "./events": {
36
60
  "types": "./dist/public/events.d.ts",
37
61
  "import": "./dist/public/events.js"
@@ -56,7 +80,7 @@
56
80
  },
57
81
  "dependencies": {
58
82
  "zod": "4.4.3",
59
- "@agen-ai/validation": "^0.2.2"
83
+ "@agen-ai/validation": "^0.2.3"
60
84
  },
61
85
  "devDependencies": {
62
86
  "ajv": "8.17.1",