@agen-ai/agent-protocol 0.2.4 → 0.3.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 (90) hide show
  1. package/README.md +57 -13
  2. package/dist/accountQuota/index.d.ts +3 -0
  3. package/dist/accountQuota/index.js +2 -0
  4. package/dist/accountQuota/parsers.d.ts +7 -0
  5. package/dist/accountQuota/parsers.js +20 -0
  6. package/dist/accountQuota/types.d.ts +89 -0
  7. package/dist/accountQuota/types.js +12 -0
  8. package/dist/capabilities/contentReferenceText.d.ts +13 -0
  9. package/dist/capabilities/contentReferenceText.js +25 -0
  10. package/dist/capabilities/index.d.ts +1 -0
  11. package/dist/capabilities/index.js +1 -0
  12. package/dist/capabilities/types.d.ts +19 -1
  13. package/dist/capabilities/types.js +6 -0
  14. package/dist/commands/index.d.ts +3 -0
  15. package/dist/commands/index.js +2 -0
  16. package/dist/commands/parsers.d.ts +7 -0
  17. package/dist/commands/parsers.js +23 -0
  18. package/dist/commands/types.d.ts +26 -0
  19. package/dist/commands/types.js +10 -0
  20. package/dist/effectiveContent/index.d.ts +3 -0
  21. package/dist/effectiveContent/index.js +2 -0
  22. package/dist/effectiveContent/parsers.d.ts +7 -0
  23. package/dist/effectiveContent/parsers.js +23 -0
  24. package/dist/effectiveContent/types.d.ts +35 -0
  25. package/dist/effectiveContent/types.js +19 -0
  26. package/dist/environment/facts.d.ts +28 -0
  27. package/dist/environment/facts.js +39 -0
  28. package/dist/environment/index.d.ts +4 -0
  29. package/dist/environment/index.js +3 -0
  30. package/dist/environment/parsers.d.ts +17 -0
  31. package/dist/environment/parsers.js +68 -0
  32. package/dist/environment/types.d.ts +61 -0
  33. package/dist/environment/types.js +26 -0
  34. package/dist/events/types.d.ts +1 -1
  35. package/dist/extensions/index.d.ts +3 -0
  36. package/dist/extensions/index.js +2 -0
  37. package/dist/extensions/parsers.d.ts +7 -0
  38. package/dist/extensions/parsers.js +23 -0
  39. package/dist/extensions/types.d.ts +73 -0
  40. package/dist/extensions/types.js +30 -0
  41. package/dist/foundation/parsers.d.ts +9 -1
  42. package/dist/foundation/parsers.js +24 -0
  43. package/dist/foundation/types.d.ts +5 -1
  44. package/dist/foundation/types.js +1 -1
  45. package/dist/integrations/types.d.ts +22 -4
  46. package/dist/integrations/types.js +6 -2
  47. package/dist/jsonSchema/generated.d.ts +9893 -5474
  48. package/dist/jsonSchema/generated.js +3097 -154
  49. package/dist/public/accountQuota.d.ts +2 -0
  50. package/dist/public/accountQuota.js +1 -0
  51. package/dist/public/commands.d.ts +2 -0
  52. package/dist/public/commands.js +1 -0
  53. package/dist/public/effectiveContent.d.ts +2 -0
  54. package/dist/public/effectiveContent.js +1 -0
  55. package/dist/public/environment.d.ts +2 -0
  56. package/dist/public/environment.js +1 -0
  57. package/dist/public/extensions.d.ts +2 -0
  58. package/dist/public/extensions.js +1 -0
  59. package/dist/public/index.d.ts +5 -0
  60. package/dist/public/index.js +5 -0
  61. package/dist/turns/parsers.d.ts +3 -1
  62. package/dist/turns/parsers.js +9 -0
  63. package/dist/turns/types.d.ts +13 -2
  64. package/dist/turns/types.js +4 -0
  65. package/dist/zod/accountQuota.d.ts +265 -0
  66. package/dist/zod/accountQuota.js +155 -0
  67. package/dist/zod/capabilities.d.ts +79 -1
  68. package/dist/zod/capabilities.js +21 -5
  69. package/dist/zod/commands.d.ts +35 -0
  70. package/dist/zod/commands.js +114 -0
  71. package/dist/zod/effectiveContent.d.ts +72 -0
  72. package/dist/zod/effectiveContent.js +157 -0
  73. package/dist/zod/environment.d.ts +531 -0
  74. package/dist/zod/environment.js +336 -0
  75. package/dist/zod/environmentFacts.d.ts +10 -0
  76. package/dist/zod/environmentFacts.js +40 -0
  77. package/dist/zod/events.d.ts +23 -23
  78. package/dist/zod/extensions.d.ts +161 -0
  79. package/dist/zod/extensions.js +194 -0
  80. package/dist/zod/foundation.d.ts +6 -1
  81. package/dist/zod/foundation.js +12 -3
  82. package/dist/zod/index.d.ts +10 -4
  83. package/dist/zod/index.js +22 -2
  84. package/dist/zod/integrations.d.ts +54 -9
  85. package/dist/zod/integrations.js +49 -6
  86. package/dist/zod/resources.d.ts +2 -2
  87. package/dist/zod/turns.d.ts +33 -0
  88. package/dist/zod/turns.js +34 -1
  89. package/dist/zod/typeEquality.generated.d.ts +40 -4
  90. package/package.json +23 -3
@@ -1,24 +1,24 @@
1
1
  import { z } from 'zod/v4';
2
- import { type AgentIntegrationCatalog, type AgentIntegrationDescriptor } from '../integrations/types.js';
3
- declare const AgentIntegrationDescriptorPortableSchema: z.ZodReadonly<z.ZodObject<{
2
+ import { type AgentIntegrationCatalog, type AgentIntegrationDescriptor, type AgentMcpIntegrationDescriptor } from '../integrations/types.js';
3
+ declare const AgentIntegrationDescriptorPortableSchema: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
4
4
  integrationId: z.ZodType<import("../index.js").AgentIntegrationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIntegrationId, unknown>>;
5
5
  revision: z.ZodNumber;
6
6
  kind: z.ZodLiteral<"mcp">;
7
7
  name: z.ZodString;
8
8
  status: z.ZodEnum<{
9
+ unavailable: "unavailable";
9
10
  starting: "starting";
10
11
  ready: "ready";
11
12
  degraded: "degraded";
12
- unavailable: "unavailable";
13
13
  }>;
14
14
  servers: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
15
15
  serverId: z.ZodType<import("../index.js").AgentIntegrationServerId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIntegrationServerId, unknown>>;
16
16
  name: z.ZodString;
17
17
  status: z.ZodEnum<{
18
+ unavailable: "unavailable";
18
19
  starting: "starting";
19
20
  ready: "ready";
20
21
  degraded: "degraded";
21
- unavailable: "unavailable";
22
22
  }>;
23
23
  tools: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
24
24
  toolId: z.ZodType<import("../index.js").AgentIntegrationToolId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIntegrationToolId, unknown>>;
@@ -32,30 +32,53 @@ declare const AgentIntegrationDescriptorPortableSchema: z.ZodReadonly<z.ZodObjec
32
32
  mediaType: z.ZodOptional<z.ZodString>;
33
33
  }, z.core.$strict>>>>;
34
34
  }, z.core.$strict>>>>;
35
- }, z.core.$strict>>;
35
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
36
+ integrationId: z.ZodType<import("../index.js").AgentIntegrationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIntegrationId, unknown>>;
37
+ revision: z.ZodNumber;
38
+ kind: z.ZodLiteral<"connector">;
39
+ name: z.ZodString;
40
+ description: z.ZodOptional<z.ZodString>;
41
+ source: z.ZodType<import("../index.js").AgentEnvironmentSource, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentEnvironmentSource, unknown>>;
42
+ installation: z.ZodType<import("../index.js").AgentAvailabilityFact, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentAvailabilityFact, unknown>>;
43
+ enablement: z.ZodType<import("../index.js").AgentAvailabilityFact, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentAvailabilityFact, unknown>>;
44
+ authentication: z.ZodType<import("../index.js").AgentAvailabilityFact, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentAvailabilityFact, unknown>>;
45
+ health: z.ZodEnum<{
46
+ unavailable: "unavailable";
47
+ starting: "starting";
48
+ ready: "ready";
49
+ degraded: "degraded";
50
+ }>;
51
+ callability: z.ZodType<import("../index.js").AgentAvailabilityFact, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentAvailabilityFact, unknown>>;
52
+ tools: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
53
+ toolId: z.ZodType<import("../index.js").AgentIntegrationToolId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIntegrationToolId, unknown>>;
54
+ name: z.ZodString;
55
+ description: z.ZodOptional<z.ZodString>;
56
+ }, z.core.$strict>>>>>;
57
+ }, z.core.$strict>>], "kind">;
36
58
  export declare const AgentIntegrationDescriptorSchema: z.ZodType<AgentIntegrationDescriptor>;
59
+ export declare const AgentMcpIntegrationDescriptorSchema: z.ZodType<AgentMcpIntegrationDescriptor>;
37
60
  export declare const AgentIntegrationCatalogPortableSchema: z.ZodReadonly<z.ZodObject<{
38
61
  revision: z.ZodNumber;
39
62
  observedAt: z.ZodType<import("../index.js").AgentIsoDateTime, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIsoDateTime, unknown>>;
40
- integrations: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
63
+ integrations: z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
41
64
  integrationId: z.ZodType<import("../index.js").AgentIntegrationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIntegrationId, unknown>>;
42
65
  revision: z.ZodNumber;
43
66
  kind: z.ZodLiteral<"mcp">;
44
67
  name: z.ZodString;
45
68
  status: z.ZodEnum<{
69
+ unavailable: "unavailable";
46
70
  starting: "starting";
47
71
  ready: "ready";
48
72
  degraded: "degraded";
49
- unavailable: "unavailable";
50
73
  }>;
51
74
  servers: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
52
75
  serverId: z.ZodType<import("../index.js").AgentIntegrationServerId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIntegrationServerId, unknown>>;
53
76
  name: z.ZodString;
54
77
  status: z.ZodEnum<{
78
+ unavailable: "unavailable";
55
79
  starting: "starting";
56
80
  ready: "ready";
57
81
  degraded: "degraded";
58
- unavailable: "unavailable";
59
82
  }>;
60
83
  tools: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
61
84
  toolId: z.ZodType<import("../index.js").AgentIntegrationToolId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIntegrationToolId, unknown>>;
@@ -69,7 +92,29 @@ export declare const AgentIntegrationCatalogPortableSchema: z.ZodReadonly<z.ZodO
69
92
  mediaType: z.ZodOptional<z.ZodString>;
70
93
  }, z.core.$strict>>>>;
71
94
  }, z.core.$strict>>>>;
72
- }, z.core.$strict>>>>;
95
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
96
+ integrationId: z.ZodType<import("../index.js").AgentIntegrationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIntegrationId, unknown>>;
97
+ revision: z.ZodNumber;
98
+ kind: z.ZodLiteral<"connector">;
99
+ name: z.ZodString;
100
+ description: z.ZodOptional<z.ZodString>;
101
+ source: z.ZodType<import("../index.js").AgentEnvironmentSource, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentEnvironmentSource, unknown>>;
102
+ installation: z.ZodType<import("../index.js").AgentAvailabilityFact, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentAvailabilityFact, unknown>>;
103
+ enablement: z.ZodType<import("../index.js").AgentAvailabilityFact, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentAvailabilityFact, unknown>>;
104
+ authentication: z.ZodType<import("../index.js").AgentAvailabilityFact, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentAvailabilityFact, unknown>>;
105
+ health: z.ZodEnum<{
106
+ unavailable: "unavailable";
107
+ starting: "starting";
108
+ ready: "ready";
109
+ degraded: "degraded";
110
+ }>;
111
+ callability: z.ZodType<import("../index.js").AgentAvailabilityFact, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentAvailabilityFact, unknown>>;
112
+ tools: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
113
+ toolId: z.ZodType<import("../index.js").AgentIntegrationToolId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIntegrationToolId, unknown>>;
114
+ name: z.ZodString;
115
+ description: z.ZodOptional<z.ZodString>;
116
+ }, z.core.$strict>>>>>;
117
+ }, z.core.$strict>>], "kind">>>;
73
118
  }, z.core.$strict>>;
74
119
  export declare const AgentIntegrationCatalogSchema: z.ZodType<AgentIntegrationCatalog>;
75
120
  export { AgentIntegrationDescriptorPortableSchema };
@@ -1,7 +1,11 @@
1
1
  import { z } from "zod/v4";
2
+ import { AgentAvailabilityFactSchema, AgentEnvironmentSourceSchema } from "./environmentFacts.js";
3
+ import { agentProtocolSerializedJsonBytes } from "../foundation/types.js";
2
4
  import { compareStringsByUnicodeCodePoint } from "../foundation/ordering.js";
3
5
  import {
4
6
  AGENT_INTEGRATION_DESCRIPTION_MAX_LENGTH,
7
+ AGENT_INTEGRATION_CONTRIBUTIONS_MAX_LENGTH,
8
+ AGENT_INTEGRATION_CATALOG_BYTES_LIMIT,
5
9
  AGENT_INTEGRATION_CATALOG_MAX_LENGTH,
6
10
  AGENT_INTEGRATION_NAME_MAX_LENGTH,
7
11
  AGENT_INTEGRATION_RESOURCES_MAX_LENGTH,
@@ -15,7 +19,8 @@ import {
15
19
  AgentIntegrationServerIdSchema,
16
20
  AgentIntegrationToolIdSchema,
17
21
  AgentIsoDateTimeSchema,
18
- createAgentCanonicalNonBlankStringSchema
22
+ createAgentCanonicalNonBlankStringSchema,
23
+ withAcyclicProtocolInput
19
24
  } from "./foundation.js";
20
25
  const PositiveSafeIntegerSchema = z.number().int().positive().max(Number.MAX_SAFE_INTEGER);
21
26
  const NameSchema = createAgentCanonicalNonBlankStringSchema(AGENT_INTEGRATION_NAME_MAX_LENGTH);
@@ -53,7 +58,7 @@ function addOrderedUniqueIssues(values, path, label, context) {
53
58
  seen.add(value);
54
59
  });
55
60
  }
56
- const AgentIntegrationDescriptorPortableSchema = z.object({
61
+ const McpIntegrationSchema = z.object({
57
62
  integrationId: AgentIntegrationIdSchema,
58
63
  revision: PositiveSafeIntegerSchema,
59
64
  kind: z.literal("mcp"),
@@ -61,19 +66,56 @@ const AgentIntegrationDescriptorPortableSchema = z.object({
61
66
  status: z.enum(AGENT_INTEGRATION_STATUSES),
62
67
  servers: z.array(ServerSchema).max(AGENT_INTEGRATION_SERVERS_MAX_LENGTH).readonly()
63
68
  }).strict().readonly();
64
- const AgentIntegrationDescriptorSchema = AgentIntegrationDescriptorPortableSchema.superRefine((integration, context) => {
69
+ const ConnectorIntegrationSchema = z.object({
70
+ integrationId: AgentIntegrationIdSchema,
71
+ revision: PositiveSafeIntegerSchema,
72
+ kind: z.literal("connector"),
73
+ name: NameSchema,
74
+ description: DescriptionSchema.optional(),
75
+ source: AgentEnvironmentSourceSchema,
76
+ installation: AgentAvailabilityFactSchema,
77
+ enablement: AgentAvailabilityFactSchema,
78
+ authentication: AgentAvailabilityFactSchema,
79
+ health: z.enum(AGENT_INTEGRATION_STATUSES),
80
+ callability: AgentAvailabilityFactSchema,
81
+ tools: z.array(ToolSchema).max(AGENT_INTEGRATION_TOOLS_MAX_LENGTH).readonly().optional()
82
+ }).strict().readonly();
83
+ const AgentIntegrationDescriptorPortableSchema = z.discriminatedUnion("kind", [
84
+ McpIntegrationSchema,
85
+ ConnectorIntegrationSchema
86
+ ]);
87
+ function validateIntegrationDescriptor(integration, context) {
88
+ if (integration.kind === "connector") {
89
+ addOrderedUniqueIssues((integration.tools ?? []).map((tool) => tool.toolId), ["tools"], "Connector tool IDs", context);
90
+ if (integration.callability.kind === "known" && integration.callability.value && [integration.installation, integration.enablement, integration.authentication].some((fact) => fact.kind === "known" && !fact.value)) {
91
+ context.addIssue({ code: "custom", path: ["callability"], message: "A connector cannot be callable when installation, enablement or authentication is denied." });
92
+ }
93
+ return;
94
+ }
65
95
  addOrderedUniqueIssues(integration.servers.map((server) => server.serverId), ["servers"], "Integration server IDs", context);
66
96
  integration.servers.forEach((server, serverIndex) => {
67
97
  addOrderedUniqueIssues(server.tools.map((tool) => tool.toolId), ["servers", serverIndex, "tools"], "Integration tool IDs", context);
68
98
  addOrderedUniqueIssues(server.resources.map((resource) => resource.resourceId), ["servers", serverIndex, "resources"], "Integration resource IDs", context);
69
99
  });
70
- });
100
+ }
101
+ const AgentIntegrationDescriptorSchema = AgentIntegrationDescriptorPortableSchema.superRefine(validateIntegrationDescriptor);
102
+ const AgentMcpIntegrationDescriptorSchema = McpIntegrationSchema.superRefine(validateIntegrationDescriptor);
71
103
  const AgentIntegrationCatalogPortableSchema = z.object({
72
104
  revision: PositiveSafeIntegerSchema,
73
105
  observedAt: AgentIsoDateTimeSchema,
74
106
  integrations: z.array(AgentIntegrationDescriptorPortableSchema).max(AGENT_INTEGRATION_CATALOG_MAX_LENGTH).readonly()
75
107
  }).strict().readonly();
76
- const AgentIntegrationCatalogSchema = AgentIntegrationCatalogPortableSchema.superRefine((catalog, context) => {
108
+ const AgentIntegrationCatalogSchema = withAcyclicProtocolInput(AgentIntegrationCatalogPortableSchema, {
109
+ maxDepth: 16,
110
+ maxCollectionLength: AGENT_INTEGRATION_CONTRIBUTIONS_MAX_LENGTH
111
+ }).superRefine((catalog, context) => {
112
+ const contributions = catalog.integrations.reduce((count, integration) => count + (integration.kind === "mcp" ? integration.servers.reduce((total, server) => total + server.tools.length + server.resources.length, 0) : integration.tools?.length ?? 0), 0);
113
+ if (contributions > AGENT_INTEGRATION_CONTRIBUTIONS_MAX_LENGTH) {
114
+ context.addIssue({ code: "custom", path: ["integrations"], message: "Integration contributions exceed the aggregate limit." });
115
+ }
116
+ if (agentProtocolSerializedJsonBytes(catalog) > AGENT_INTEGRATION_CATALOG_BYTES_LIMIT) {
117
+ context.addIssue({ code: "custom", message: "Integration catalog exceeds its serialized UTF-8 byte limit." });
118
+ }
77
119
  addOrderedUniqueIssues(catalog.integrations.map((integration) => integration.integrationId), ["integrations"], "Integration IDs", context);
78
120
  catalog.integrations.forEach((integration, integrationIndex) => {
79
121
  const parsed = AgentIntegrationDescriptorSchema.safeParse(integration);
@@ -88,5 +130,6 @@ export {
88
130
  AgentIntegrationCatalogPortableSchema,
89
131
  AgentIntegrationCatalogSchema,
90
132
  AgentIntegrationDescriptorPortableSchema,
91
- AgentIntegrationDescriptorSchema
133
+ AgentIntegrationDescriptorSchema,
134
+ AgentMcpIntegrationDescriptorSchema
92
135
  };
@@ -8,10 +8,10 @@ export declare const AgentGeneratedResourceDescriptorPortableSchema: z.ZodReadon
8
8
  archive: "archive";
9
9
  }>;
10
10
  status: z.ZodEnum<{
11
+ unavailable: "unavailable";
12
+ available: "available";
11
13
  pending: "pending";
12
14
  expired: "expired";
13
- available: "available";
14
- unavailable: "unavailable";
15
15
  }>;
16
16
  displayName: z.ZodString;
17
17
  producer: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
@@ -36,6 +36,15 @@ export declare const AgentImageInputSourceSchema: z.ZodDiscriminatedUnion<[z.Zod
36
36
  path: z.ZodString;
37
37
  sha256: z.ZodString;
38
38
  }, z.core.$strict>>], "type">;
39
+ export declare const AgentContentReferenceInputPartSchema: z.ZodReadonly<z.ZodObject<{
40
+ type: z.ZodLiteral<"content_reference">;
41
+ environmentId: z.ZodType<import("../index.js").AgentEnvironmentId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentEnvironmentId, unknown>>;
42
+ environmentRevision: z.ZodNumber;
43
+ contentCatalogRevision: z.ZodNumber;
44
+ contentId: z.ZodType<import("../index.js").AgentEffectiveContentId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentEffectiveContentId, unknown>>;
45
+ contentRevision: z.ZodNumber;
46
+ arguments: z.ZodOptional<z.ZodString>;
47
+ }, z.core.$strict>>;
39
48
  export declare const AgentTurnInputPartSchema: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
40
49
  type: z.ZodLiteral<"text">;
41
50
  text: z.ZodString;
@@ -76,6 +85,14 @@ export declare const AgentTurnInputPartSchema: z.ZodDiscriminatedUnion<[z.ZodRea
76
85
  path: z.ZodString;
77
86
  sha256: z.ZodString;
78
87
  }, z.core.$strict>>], "type">;
88
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
89
+ type: z.ZodLiteral<"content_reference">;
90
+ environmentId: z.ZodType<import("../index.js").AgentEnvironmentId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentEnvironmentId, unknown>>;
91
+ environmentRevision: z.ZodNumber;
92
+ contentCatalogRevision: z.ZodNumber;
93
+ contentId: z.ZodType<import("../index.js").AgentEffectiveContentId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentEffectiveContentId, unknown>>;
94
+ contentRevision: z.ZodNumber;
95
+ arguments: z.ZodOptional<z.ZodString>;
79
96
  }, z.core.$strict>>], "type">;
80
97
  export declare const AgentTurnInteractionModeSchema: z.ZodEnum<{
81
98
  default: "default";
@@ -126,6 +143,14 @@ export declare const AgentTurnInputContentCompositionSchema: z.ZodObject<{
126
143
  path: z.ZodString;
127
144
  sha256: z.ZodString;
128
145
  }, z.core.$strict>>], "type">;
146
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
147
+ type: z.ZodLiteral<"content_reference">;
148
+ environmentId: z.ZodType<import("../index.js").AgentEnvironmentId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentEnvironmentId, unknown>>;
149
+ environmentRevision: z.ZodNumber;
150
+ contentCatalogRevision: z.ZodNumber;
151
+ contentId: z.ZodType<import("../index.js").AgentEffectiveContentId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentEffectiveContentId, unknown>>;
152
+ contentRevision: z.ZodNumber;
153
+ arguments: z.ZodOptional<z.ZodString>;
129
154
  }, z.core.$strict>>], "type">>>;
130
155
  summary: z.ZodOptional<z.ZodString>;
131
156
  }, z.core.$strict>;
@@ -172,6 +197,14 @@ export declare const AgentTurnRunInputPortableSchema: z.ZodReadonly<z.ZodObject<
172
197
  path: z.ZodString;
173
198
  sha256: z.ZodString;
174
199
  }, z.core.$strict>>], "type">;
200
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
201
+ type: z.ZodLiteral<"content_reference">;
202
+ environmentId: z.ZodType<import("../index.js").AgentEnvironmentId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentEnvironmentId, unknown>>;
203
+ environmentRevision: z.ZodNumber;
204
+ contentCatalogRevision: z.ZodNumber;
205
+ contentId: z.ZodType<import("../index.js").AgentEffectiveContentId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentEffectiveContentId, unknown>>;
206
+ contentRevision: z.ZodNumber;
207
+ arguments: z.ZodOptional<z.ZodString>;
175
208
  }, z.core.$strict>>], "type">>>;
176
209
  summary: z.ZodOptional<z.ZodString>;
177
210
  turnId: z.ZodType<import("../index.js").AgentTurnId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentTurnId, unknown>>;
package/dist/zod/turns.js CHANGED
@@ -9,6 +9,8 @@ import {
9
9
  import { compareStringsByUnicodeCodePoint } from "../foundation/ordering.js";
10
10
  import {
11
11
  AGENT_CONTENT_STREAM_KINDS,
12
+ AGENT_CONTENT_REFERENCES_MAX_LENGTH,
13
+ AGENT_CONTENT_REFERENCE_ARGUMENT_BYTES_LIMIT,
12
14
  AGENT_CONTEXT_COMPACTION_DURATION_MAX_MILLISECONDS,
13
15
  AGENT_CONTEXT_COMPACTION_SUMMARY_PREVIEW_MAX_LENGTH,
14
16
  AGENT_CONTEXT_COMPACTION_TRIGGERS,
@@ -20,6 +22,8 @@ import {
20
22
  import {
21
23
  AgentCanonicalIdValueSchema,
22
24
  AgentErrorSchema,
25
+ AgentEnvironmentIdSchema,
26
+ AgentEffectiveContentIdSchema,
23
27
  AgentIsoDateTimeSchema,
24
28
  AgentItemIdSchema,
25
29
  AgentTurnIdSchema,
@@ -76,9 +80,24 @@ const AgentImageInputPartSchema = z.object({
76
80
  type: z.literal("image"),
77
81
  source: AgentImageInputSourceSchema
78
82
  }).strict().readonly();
83
+ const ContentReferenceRevisionSchema = z.number().int().positive().max(Number.MAX_SAFE_INTEGER);
84
+ const AgentContentReferenceInputPartSchema = z.object({
85
+ type: z.literal("content_reference"),
86
+ environmentId: AgentEnvironmentIdSchema,
87
+ environmentRevision: ContentReferenceRevisionSchema,
88
+ contentCatalogRevision: ContentReferenceRevisionSchema,
89
+ contentId: AgentEffectiveContentIdSchema,
90
+ contentRevision: ContentReferenceRevisionSchema,
91
+ arguments: z.string().max(AGENT_CONTENT_REFERENCE_ARGUMENT_BYTES_LIMIT).optional()
92
+ }).strict().superRefine((part, context) => {
93
+ if (part.arguments !== void 0 && new TextEncoder().encode(part.arguments).byteLength > AGENT_CONTENT_REFERENCE_ARGUMENT_BYTES_LIMIT) {
94
+ context.addIssue({ code: "custom", path: ["arguments"], message: "Content reference arguments exceed their UTF-8 byte limit." });
95
+ }
96
+ }).readonly();
79
97
  const AgentTurnInputPartSchema = z.discriminatedUnion("type", [
80
98
  AgentTextInputPartSchema,
81
- AgentImageInputPartSchema
99
+ AgentImageInputPartSchema,
100
+ AgentContentReferenceInputPartSchema
82
101
  ]);
83
102
  const AgentTurnInteractionModeSchema = z.enum(
84
103
  AGENT_TURN_INTERACTION_MODES
@@ -89,6 +108,19 @@ const AgentTurnInputContentShape = {
89
108
  };
90
109
  const AgentTurnInputContentObjectSchema = z.object(AgentTurnInputContentShape).strict();
91
110
  const AgentTurnInputContentRefinedSchema = AgentTurnInputContentObjectSchema.superRefine((input, context) => {
111
+ const references = input.parts.filter((part) => part.type === "content_reference");
112
+ if (references.length > AGENT_CONTENT_REFERENCES_MAX_LENGTH) {
113
+ context.addIssue({ code: "custom", path: ["parts"], message: "Too many content references." });
114
+ }
115
+ const identities = /* @__PURE__ */ new Set();
116
+ input.parts.forEach((part, index) => {
117
+ if (part.type !== "content_reference") return;
118
+ const identity = JSON.stringify([part.environmentId, part.contentId]);
119
+ if (identities.has(identity)) {
120
+ context.addIssue({ code: "custom", path: ["parts", index], message: "Content references must be unique." });
121
+ }
122
+ identities.add(identity);
123
+ });
92
124
  const content = {
93
125
  parts: input.parts,
94
126
  ...input.summary === void 0 ? {} : { summary: input.summary }
@@ -408,6 +440,7 @@ export {
408
440
  AgentCollaborationToolCallDetailsSchema,
409
441
  AgentCommandExecutionDetailsSchema,
410
442
  AgentComputerActionDetailsSchema,
443
+ AgentContentReferenceInputPartSchema,
411
444
  AgentContentStreamKindSchema,
412
445
  AgentContextCompactionDetailsSchema,
413
446
  AgentDiffSummarySchema,
@@ -1,33 +1,67 @@
1
1
  import type { z } from 'zod/v4';
2
+ import type { AgentAccountQuotaSnapshot, AgentAccountQuotaWindow } from '../accountQuota/types.js';
2
3
  import type { AgentArtifactDescriptor } from '../artifacts/types.js';
3
4
  import type { AgentCapabilities } from '../capabilities/types.js';
4
5
  import type { AgentCollaborationControlInput, AgentCollaborationNode, AgentCollaborationSpawnInput } from '../collaboration/types.js';
6
+ import type { AgentCommandCatalog, AgentCommandDescriptor } from '../commands/types.js';
5
7
  import type { AgentConfigurationCatalog, AgentConfigurationSelectionInput } from '../configuration/types.js';
8
+ import type { AgentEffectiveContentCatalog, AgentEffectiveContentDescriptor } from '../effectiveContent/types.js';
9
+ import type { AgentEnvironmentCapability, AgentEnvironmentInvalidation, AgentEnvironmentSnapshot } from '../environment/types.js';
6
10
  import type { AgentEvent } from '../events/types.js';
11
+ import type { AgentExtensionCatalog, AgentExtensionDescriptor } from '../extensions/types.js';
7
12
  import type { AgentError, AgentJsonValue, AgentProviderRefs } from '../foundation/types.js';
8
- import type { AgentIntegrationCatalog, AgentIntegrationDescriptor } from '../integrations/types.js';
13
+ import type { AgentIntegrationCatalog, AgentIntegrationDescriptor, AgentMcpIntegrationDescriptor } from '../integrations/types.js';
9
14
  import type { AgentManagedContentCatalog, AgentManagedContentDescriptor } from '../managedContent/types.js';
10
15
  import type { AgentOperationCatalog, AgentOperationDescriptor, AgentOperationInvocation, AgentOperationResult } from '../operations/types.js';
11
16
  import type { AgentRequest, AgentRequestResolution } from '../requests/types.js';
12
17
  import type { AgentGeneratedResourceDescriptor } from '../resources/types.js';
13
18
  import type { AgentSessionBinding, AgentSessionConfiguration, AgentSessionOpenInput } from '../sessions/types.js';
14
- import type { AgentItemSnapshot, AgentTurnInputContent, AgentTurnInterruptionInput, AgentTurnRunInput } from '../turns/types.js';
19
+ import type { AgentContentReferenceInputPart, AgentItemSnapshot, AgentTurnInputContent, AgentTurnInterruptionInput, AgentTurnRunInput } from '../turns/types.js';
20
+ import { AgentAccountQuotaSnapshotSchema, AgentAccountQuotaWindowSchema } from './accountQuota.js';
15
21
  import { AgentArtifactDescriptorSchema } from './artifacts.js';
16
22
  import { AgentCapabilitiesSchema } from './capabilities.js';
17
23
  import { AgentCollaborationControlInputSchema, AgentCollaborationNodeSchema, AgentCollaborationSpawnInputSchema } from './collaboration.js';
24
+ import { AgentCommandCatalogSchema, AgentCommandDescriptorSchema } from './commands.js';
18
25
  import { AgentConfigurationCatalogSchema, AgentConfigurationSelectionInputSchema } from './configuration.js';
26
+ import { AgentEffectiveContentCatalogSchema, AgentEffectiveContentDescriptorSchema } from './effectiveContent.js';
27
+ import { AgentEnvironmentCapabilitySchema, AgentEnvironmentInvalidationSchema, AgentEnvironmentSnapshotSchema } from './environment.js';
19
28
  import { AgentEventSchema } from './events.js';
29
+ import { AgentExtensionCatalogSchema, AgentExtensionDescriptorSchema } from './extensions.js';
20
30
  import { AgentErrorSchema, AgentJsonValueSchema, AgentProviderRefsSchema } from './foundation.js';
21
- import { AgentIntegrationCatalogSchema, AgentIntegrationDescriptorSchema } from './integrations.js';
31
+ import { AgentIntegrationCatalogSchema, AgentIntegrationDescriptorSchema, AgentMcpIntegrationDescriptorSchema } from './integrations.js';
22
32
  import { AgentManagedContentCatalogSchema, AgentManagedContentDescriptorSchema } from './managedContent.js';
23
33
  import { AgentOperationCatalogSchema, AgentOperationDescriptorSchema, AgentOperationInvocationSchema, AgentOperationResultSchema } from './operations.js';
24
34
  import { AgentRequestResolutionSchema, AgentRequestSchema } from './requests.js';
25
35
  import { AgentGeneratedResourceDescriptorSchema } from './resources.js';
26
36
  import { AgentSessionBindingSchema, AgentSessionConfigurationSchema, AgentSessionOpenInputSchema } from './sessions.js';
27
- import { AgentItemSnapshotSchema, AgentTurnInputContentSchema, AgentTurnInterruptionInputSchema, AgentTurnRunInputSchema } from './turns.js';
37
+ import { AgentContentReferenceInputPartSchema, AgentItemSnapshotSchema, AgentTurnInputContentSchema, AgentTurnInterruptionInputSchema, AgentTurnRunInputSchema } from './turns.js';
28
38
  type Extends<Left, Right> = [Left] extends [Right] ? true : false;
29
39
  type Assert<Value extends true> = Value;
30
40
  export type AgentProtocolSchemaTypeAssertions = readonly [
41
+ Assert<Extends<z.output<typeof AgentEffectiveContentCatalogSchema>, AgentEffectiveContentCatalog>>,
42
+ Assert<Extends<AgentEffectiveContentCatalog, z.output<typeof AgentEffectiveContentCatalogSchema>>>,
43
+ Assert<Extends<z.output<typeof AgentEffectiveContentDescriptorSchema>, AgentEffectiveContentDescriptor>>,
44
+ Assert<Extends<AgentEffectiveContentDescriptor, z.output<typeof AgentEffectiveContentDescriptorSchema>>>,
45
+ Assert<Extends<z.output<typeof AgentCommandCatalogSchema>, AgentCommandCatalog>>,
46
+ Assert<Extends<AgentCommandCatalog, z.output<typeof AgentCommandCatalogSchema>>>,
47
+ Assert<Extends<z.output<typeof AgentCommandDescriptorSchema>, AgentCommandDescriptor>>,
48
+ Assert<Extends<AgentCommandDescriptor, z.output<typeof AgentCommandDescriptorSchema>>>,
49
+ Assert<Extends<z.output<typeof AgentExtensionCatalogSchema>, AgentExtensionCatalog>>,
50
+ Assert<Extends<AgentExtensionCatalog, z.output<typeof AgentExtensionCatalogSchema>>>,
51
+ Assert<Extends<z.output<typeof AgentExtensionDescriptorSchema>, AgentExtensionDescriptor>>,
52
+ Assert<Extends<AgentExtensionDescriptor, z.output<typeof AgentExtensionDescriptorSchema>>>,
53
+ Assert<Extends<z.output<typeof AgentEnvironmentSnapshotSchema>, AgentEnvironmentSnapshot>>,
54
+ Assert<Extends<AgentEnvironmentSnapshot, z.output<typeof AgentEnvironmentSnapshotSchema>>>,
55
+ Assert<Extends<z.output<typeof AgentEnvironmentInvalidationSchema>, AgentEnvironmentInvalidation>>,
56
+ Assert<Extends<AgentEnvironmentInvalidation, z.output<typeof AgentEnvironmentInvalidationSchema>>>,
57
+ Assert<Extends<z.output<typeof AgentEnvironmentCapabilitySchema>, AgentEnvironmentCapability>>,
58
+ Assert<Extends<AgentEnvironmentCapability, z.output<typeof AgentEnvironmentCapabilitySchema>>>,
59
+ Assert<Extends<z.output<typeof AgentContentReferenceInputPartSchema>, AgentContentReferenceInputPart>>,
60
+ Assert<Extends<AgentContentReferenceInputPart, z.output<typeof AgentContentReferenceInputPartSchema>>>,
61
+ Assert<Extends<z.output<typeof AgentAccountQuotaSnapshotSchema>, AgentAccountQuotaSnapshot>>,
62
+ Assert<Extends<AgentAccountQuotaSnapshot, z.output<typeof AgentAccountQuotaSnapshotSchema>>>,
63
+ Assert<Extends<z.output<typeof AgentAccountQuotaWindowSchema>, AgentAccountQuotaWindow>>,
64
+ Assert<Extends<AgentAccountQuotaWindow, z.output<typeof AgentAccountQuotaWindowSchema>>>,
31
65
  Assert<Extends<z.output<typeof AgentJsonValueSchema>, AgentJsonValue>>,
32
66
  Assert<Extends<AgentJsonValue, z.output<typeof AgentJsonValueSchema>>>,
33
67
  Assert<Extends<z.output<typeof AgentProviderRefsSchema>, AgentProviderRefs>>,
@@ -72,6 +106,8 @@ export type AgentProtocolSchemaTypeAssertions = readonly [
72
106
  Assert<Extends<AgentIntegrationCatalog, z.output<typeof AgentIntegrationCatalogSchema>>>,
73
107
  Assert<Extends<z.output<typeof AgentIntegrationDescriptorSchema>, AgentIntegrationDescriptor>>,
74
108
  Assert<Extends<AgentIntegrationDescriptor, z.output<typeof AgentIntegrationDescriptorSchema>>>,
109
+ Assert<Extends<z.output<typeof AgentMcpIntegrationDescriptorSchema>, AgentMcpIntegrationDescriptor>>,
110
+ Assert<Extends<AgentMcpIntegrationDescriptor, z.output<typeof AgentMcpIntegrationDescriptorSchema>>>,
75
111
  Assert<Extends<z.output<typeof AgentCollaborationNodeSchema>, AgentCollaborationNode>>,
76
112
  Assert<Extends<AgentCollaborationNode, z.output<typeof AgentCollaborationNodeSchema>>>,
77
113
  Assert<Extends<z.output<typeof AgentCollaborationSpawnInputSchema>, AgentCollaborationSpawnInput>>,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agen-ai/agent-protocol",
3
- "version": "0.2.4",
3
+ "version": "0.3.0",
4
4
  "private": false,
5
5
  "description": "Provider-neutral sessions, turns, requests, capabilities, artifacts, and events for coding-agent runtimes.",
6
6
  "type": "module",
@@ -76,11 +76,31 @@
76
76
  "types": "./dist/jsonSchema/index.d.ts",
77
77
  "import": "./dist/jsonSchema/index.js"
78
78
  },
79
- "./package.json": "./package.json"
79
+ "./package.json": "./package.json",
80
+ "./account-quota": {
81
+ "types": "./dist/public/accountQuota.d.ts",
82
+ "import": "./dist/public/accountQuota.js"
83
+ },
84
+ "./effective-content": {
85
+ "types": "./dist/public/effectiveContent.d.ts",
86
+ "import": "./dist/public/effectiveContent.js"
87
+ },
88
+ "./commands": {
89
+ "types": "./dist/public/commands.d.ts",
90
+ "import": "./dist/public/commands.js"
91
+ },
92
+ "./extensions": {
93
+ "types": "./dist/public/extensions.d.ts",
94
+ "import": "./dist/public/extensions.js"
95
+ },
96
+ "./environment": {
97
+ "types": "./dist/public/environment.d.ts",
98
+ "import": "./dist/public/environment.js"
99
+ }
80
100
  },
81
101
  "dependencies": {
82
102
  "zod": "4.4.3",
83
- "@agen-ai/validation": "^0.2.4"
103
+ "@agen-ai/validation": "^0.3.0"
84
104
  },
85
105
  "devDependencies": {
86
106
  "ajv": "8.17.1",