@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,60 @@
1
+ import { z } from 'zod/v4';
2
+ import { type AgentCollaborationControlInput, type AgentCollaborationNode, type AgentCollaborationSpawnInput } from '../collaboration/types.js';
3
+ export declare const AgentCollaborationNodePortableSchema: z.ZodReadonly<z.ZodObject<{
4
+ collaborationId: z.ZodType<import("../index.js").AgentCollaborationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentCollaborationId, unknown>>;
5
+ rootCollaborationId: z.ZodType<import("../index.js").AgentCollaborationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentCollaborationId, unknown>>;
6
+ parentCollaborationId: z.ZodOptional<z.ZodType<import("../index.js").AgentCollaborationId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentCollaborationId, unknown>>>;
7
+ role: z.ZodEnum<{
8
+ delegate: "delegate";
9
+ reviewer: "reviewer";
10
+ researcher: "researcher";
11
+ specialist: "specialist";
12
+ }>;
13
+ title: z.ZodString;
14
+ status: z.ZodEnum<{
15
+ completed: "completed";
16
+ failed: "failed";
17
+ canceled: "canceled";
18
+ running: "running";
19
+ starting: "starting";
20
+ queued: "queued";
21
+ waiting: "waiting";
22
+ }>;
23
+ objective: z.ZodString;
24
+ progress: z.ZodOptional<z.ZodString>;
25
+ usage: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
26
+ kind: z.ZodLiteral<"unavailable">;
27
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
28
+ kind: z.ZodLiteral<"reported">;
29
+ inputTokens: z.ZodOptional<z.ZodNumber>;
30
+ outputTokens: z.ZodOptional<z.ZodNumber>;
31
+ reasoningTokens: z.ZodOptional<z.ZodNumber>;
32
+ totalTokens: z.ZodOptional<z.ZodNumber>;
33
+ modelCalls: z.ZodOptional<z.ZodNumber>;
34
+ }, z.core.$strict>>], "kind">;
35
+ outcome: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
36
+ kind: z.ZodLiteral<"completed">;
37
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
38
+ kind: z.ZodLiteral<"failed">;
39
+ error: z.ZodType<import("../index.js").AgentError, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentError, unknown>>;
40
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
41
+ kind: z.ZodLiteral<"canceled">;
42
+ reason: z.ZodEnum<{
43
+ user_requested: "user_requested";
44
+ timeout: "timeout";
45
+ shutdown: "shutdown";
46
+ superseded: "superseded";
47
+ other: "other";
48
+ }>;
49
+ }, z.core.$strict>>], "kind">>;
50
+ createdAt: z.ZodType<import("../index.js").AgentIsoDateTime, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIsoDateTime, unknown>>;
51
+ updatedAt: z.ZodType<import("../index.js").AgentIsoDateTime, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIsoDateTime, unknown>>;
52
+ terminalAt: z.ZodOptional<z.ZodType<import("../index.js").AgentIsoDateTime, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIsoDateTime, unknown>>>;
53
+ closedAt: z.ZodOptional<z.ZodType<import("../index.js").AgentIsoDateTime, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIsoDateTime, unknown>>>;
54
+ artifactIds: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodType<import("../index.js").AgentArtifactId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentArtifactId, unknown>>>>>;
55
+ resourceIds: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodType<import("../index.js").AgentGeneratedResourceId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentGeneratedResourceId, unknown>>>>>;
56
+ }, z.core.$strict>>;
57
+ export declare const AgentCollaborationNodeSchema: z.ZodType<AgentCollaborationNode>;
58
+ export declare const AgentCollaborationSpawnInputSchema: z.ZodType<AgentCollaborationSpawnInput>;
59
+ export declare const AgentCollaborationControlInputSchema: z.ZodType<AgentCollaborationControlInput>;
60
+ //# sourceMappingURL=collaboration.d.ts.map
@@ -0,0 +1,155 @@
1
+ import { z } from "zod/v4";
2
+ import { compareStringsByUnicodeCodePoint } from "../foundation/ordering.js";
3
+ import {
4
+ AGENT_COLLABORATION_OBJECTIVE_MAX_LENGTH,
5
+ AGENT_COLLABORATION_PROGRESS_MAX_LENGTH,
6
+ AGENT_COLLABORATION_RESULT_REFERENCES_MAX_LENGTH,
7
+ AGENT_COLLABORATION_ROLES,
8
+ AGENT_COLLABORATION_STATUSES,
9
+ AGENT_COLLABORATION_STOP_REASONS,
10
+ AGENT_COLLABORATION_TITLE_MAX_LENGTH,
11
+ AGENT_COLLABORATION_USAGE_FIELDS
12
+ } from "../collaboration/types.js";
13
+ import {
14
+ AgentArtifactIdSchema,
15
+ AgentCollaborationIdSchema,
16
+ AgentErrorSchema,
17
+ AgentGeneratedResourceIdSchema,
18
+ AgentIsoDateTimeSchema,
19
+ createAgentCanonicalNonBlankStringSchema
20
+ } from "./foundation.js";
21
+ import { AgentTurnInputContentSchema } from "./turns.js";
22
+ const ObjectiveSchema = createAgentCanonicalNonBlankStringSchema(
23
+ AGENT_COLLABORATION_OBJECTIVE_MAX_LENGTH
24
+ );
25
+ const TitleSchema = createAgentCanonicalNonBlankStringSchema(
26
+ AGENT_COLLABORATION_TITLE_MAX_LENGTH
27
+ );
28
+ const ProgressSchema = createAgentCanonicalNonBlankStringSchema(
29
+ AGENT_COLLABORATION_PROGRESS_MAX_LENGTH
30
+ );
31
+ const NonNegativeSafeIntegerSchema = z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
32
+ const CollaborationStopReasonSchema = z.enum(AGENT_COLLABORATION_STOP_REASONS);
33
+ const AgentCollaborationOutcomeSchema = z.discriminatedUnion("kind", [
34
+ z.object({ kind: z.literal("completed") }).strict().readonly(),
35
+ z.object({ kind: z.literal("failed"), error: AgentErrorSchema }).strict().readonly(),
36
+ z.object({ kind: z.literal("canceled"), reason: CollaborationStopReasonSchema }).strict().readonly()
37
+ ]);
38
+ const AgentCollaborationUsageSchema = z.discriminatedUnion("kind", [
39
+ z.object({ kind: z.literal("unavailable") }).strict().readonly(),
40
+ z.object({
41
+ kind: z.literal("reported"),
42
+ inputTokens: NonNegativeSafeIntegerSchema.optional(),
43
+ outputTokens: NonNegativeSafeIntegerSchema.optional(),
44
+ reasoningTokens: NonNegativeSafeIntegerSchema.optional(),
45
+ totalTokens: NonNegativeSafeIntegerSchema.optional(),
46
+ modelCalls: NonNegativeSafeIntegerSchema.optional()
47
+ }).strict().refine(
48
+ (usage) => AGENT_COLLABORATION_USAGE_FIELDS.some(
49
+ (field) => usage[field] !== void 0
50
+ ),
51
+ { message: "Reported collaboration usage must include at least one counter." }
52
+ ).readonly()
53
+ ]);
54
+ const artifactIds = z.array(AgentArtifactIdSchema).min(1).max(AGENT_COLLABORATION_RESULT_REFERENCES_MAX_LENGTH).readonly().optional();
55
+ const resourceIds = z.array(AgentGeneratedResourceIdSchema).min(1).max(AGENT_COLLABORATION_RESULT_REFERENCES_MAX_LENGTH).readonly().optional();
56
+ const AgentCollaborationNodePortableSchema = z.object({
57
+ collaborationId: AgentCollaborationIdSchema,
58
+ rootCollaborationId: AgentCollaborationIdSchema,
59
+ parentCollaborationId: AgentCollaborationIdSchema.optional(),
60
+ role: z.enum(AGENT_COLLABORATION_ROLES),
61
+ title: TitleSchema,
62
+ status: z.enum(AGENT_COLLABORATION_STATUSES),
63
+ objective: ObjectiveSchema,
64
+ progress: ProgressSchema.optional(),
65
+ usage: AgentCollaborationUsageSchema,
66
+ outcome: AgentCollaborationOutcomeSchema.optional(),
67
+ createdAt: AgentIsoDateTimeSchema,
68
+ updatedAt: AgentIsoDateTimeSchema,
69
+ terminalAt: AgentIsoDateTimeSchema.optional(),
70
+ closedAt: AgentIsoDateTimeSchema.optional(),
71
+ artifactIds,
72
+ resourceIds
73
+ }).strict().readonly();
74
+ const AgentCollaborationNodeSchema = AgentCollaborationNodePortableSchema.superRefine((node, context) => {
75
+ const terminal = ["completed", "failed", "canceled"].includes(node.status);
76
+ if (terminal !== (node.terminalAt !== void 0)) {
77
+ context.addIssue({ code: "custom", path: ["terminalAt"], message: "Exactly terminal collaboration nodes must include terminalAt." });
78
+ }
79
+ if (terminal !== (node.outcome !== void 0)) {
80
+ context.addIssue({ code: "custom", path: ["outcome"], message: "Exactly terminal collaboration nodes must include an outcome." });
81
+ }
82
+ if (node.outcome !== void 0 && node.outcome.kind !== node.status) {
83
+ context.addIssue({ code: "custom", path: ["outcome"], message: "Collaboration outcome must match its terminal lifecycle status." });
84
+ }
85
+ if (!terminal && (node.artifactIds !== void 0 || node.resourceIds !== void 0)) {
86
+ context.addIssue({ code: "custom", path: ["artifactIds"], message: "Only terminal collaboration nodes may expose result references." });
87
+ }
88
+ if (node.parentCollaborationId === void 0 && node.rootCollaborationId !== node.collaborationId) {
89
+ context.addIssue({ code: "custom", path: ["rootCollaborationId"], message: "A root collaboration node must identify itself as root." });
90
+ }
91
+ if (node.parentCollaborationId === node.collaborationId) {
92
+ context.addIssue({ code: "custom", path: ["parentCollaborationId"], message: "A collaboration node cannot parent itself." });
93
+ }
94
+ if (Date.parse(node.updatedAt) < Date.parse(node.createdAt)) {
95
+ context.addIssue({ code: "custom", path: ["updatedAt"], message: "Collaboration updatedAt cannot precede createdAt." });
96
+ }
97
+ if (node.terminalAt !== void 0 && (Date.parse(node.terminalAt) < Date.parse(node.createdAt) || Date.parse(node.terminalAt) > Date.parse(node.updatedAt))) {
98
+ context.addIssue({ code: "custom", path: ["terminalAt"], message: "Collaboration terminalAt must fall within its observed lifetime." });
99
+ }
100
+ if (node.closedAt !== void 0 && (node.terminalAt === void 0 || Date.parse(node.closedAt) < Date.parse(node.terminalAt) || Date.parse(node.closedAt) > Date.parse(node.updatedAt))) {
101
+ context.addIssue({ code: "custom", path: ["closedAt"], message: "A collaboration may close only after its terminal outcome." });
102
+ }
103
+ if (node.artifactIds !== void 0 && new Set(node.artifactIds).size !== node.artifactIds.length) {
104
+ context.addIssue({ code: "custom", path: ["artifactIds"], message: "Collaboration artifact IDs must be unique." });
105
+ }
106
+ if (node.artifactIds?.some(
107
+ (artifactId, artifactIndex) => artifactIndex > 0 && compareStringsByUnicodeCodePoint(
108
+ node.artifactIds[artifactIndex - 1],
109
+ artifactId
110
+ ) >= 0
111
+ )) {
112
+ context.addIssue({ code: "custom", path: ["artifactIds"], message: "Collaboration artifact IDs must use canonical order." });
113
+ }
114
+ if (node.resourceIds !== void 0 && new Set(node.resourceIds).size !== node.resourceIds.length) {
115
+ context.addIssue({ code: "custom", path: ["resourceIds"], message: "Collaboration resource IDs must be unique." });
116
+ }
117
+ if (node.resourceIds?.some(
118
+ (resourceId, resourceIndex) => resourceIndex > 0 && compareStringsByUnicodeCodePoint(
119
+ node.resourceIds[resourceIndex - 1],
120
+ resourceId
121
+ ) >= 0
122
+ )) {
123
+ context.addIssue({ code: "custom", path: ["resourceIds"], message: "Collaboration resource IDs must use canonical order." });
124
+ }
125
+ });
126
+ const AgentCollaborationSpawnInputSchema = z.object({
127
+ collaborationId: AgentCollaborationIdSchema,
128
+ parentCollaborationId: AgentCollaborationIdSchema.optional(),
129
+ role: z.enum(AGENT_COLLABORATION_ROLES),
130
+ title: TitleSchema,
131
+ objective: ObjectiveSchema,
132
+ createdAt: AgentIsoDateTimeSchema
133
+ }).strict().refine((input) => input.parentCollaborationId !== input.collaborationId, {
134
+ path: ["parentCollaborationId"],
135
+ message: "A collaboration node cannot parent itself."
136
+ }).readonly();
137
+ const SteerPortableSchema = AgentTurnInputContentSchema.and(
138
+ z.object({ action: z.literal("steer"), collaborationId: AgentCollaborationIdSchema }).strict()
139
+ ).readonly();
140
+ const AgentCollaborationControlInputSchema = z.union([
141
+ SteerPortableSchema,
142
+ z.object({
143
+ action: z.literal("stop"),
144
+ collaborationId: AgentCollaborationIdSchema,
145
+ reason: CollaborationStopReasonSchema
146
+ }).strict().readonly(),
147
+ z.object({ action: z.literal("close"), collaborationId: AgentCollaborationIdSchema }).strict().readonly(),
148
+ z.object({ action: z.literal("inspect"), collaborationId: AgentCollaborationIdSchema }).strict().readonly()
149
+ ]);
150
+ export {
151
+ AgentCollaborationControlInputSchema,
152
+ AgentCollaborationNodePortableSchema,
153
+ AgentCollaborationNodeSchema,
154
+ AgentCollaborationSpawnInputSchema
155
+ };
@@ -0,0 +1,177 @@
1
+ import { z } from 'zod/v4';
2
+ import { type AgentConfigurationCatalog, type AgentConfigurationSelectionInput } from '../configuration/types.js';
3
+ export declare const AgentConfigurationFieldPortableSchema: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
4
+ fieldKind: z.ZodLiteral<"boolean">;
5
+ currentValue: z.ZodBoolean;
6
+ key: z.ZodString;
7
+ revision: z.ZodNumber;
8
+ label: z.ZodString;
9
+ description: z.ZodOptional<z.ZodString>;
10
+ scope: z.ZodEnum<{
11
+ session: "session";
12
+ provider_instance: "provider_instance";
13
+ }>;
14
+ applicationTiming: z.ZodEnum<{
15
+ immediate: "immediate";
16
+ next_session: "next_session";
17
+ provider_restart: "provider_restart";
18
+ }>;
19
+ mutable: z.ZodBoolean;
20
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
21
+ fieldKind: z.ZodLiteral<"single_select">;
22
+ currentValue: z.ZodString;
23
+ options: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
24
+ optionId: z.ZodString;
25
+ label: z.ZodString;
26
+ description: z.ZodOptional<z.ZodString>;
27
+ }, z.core.$strict>>>>;
28
+ key: z.ZodString;
29
+ revision: z.ZodNumber;
30
+ label: z.ZodString;
31
+ description: z.ZodOptional<z.ZodString>;
32
+ scope: z.ZodEnum<{
33
+ session: "session";
34
+ provider_instance: "provider_instance";
35
+ }>;
36
+ applicationTiming: z.ZodEnum<{
37
+ immediate: "immediate";
38
+ next_session: "next_session";
39
+ provider_restart: "provider_restart";
40
+ }>;
41
+ mutable: z.ZodBoolean;
42
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
43
+ fieldKind: z.ZodLiteral<"bounded_integer">;
44
+ currentValue: z.ZodNumber;
45
+ minimum: z.ZodNumber;
46
+ maximum: z.ZodNumber;
47
+ key: z.ZodString;
48
+ revision: z.ZodNumber;
49
+ label: z.ZodString;
50
+ description: z.ZodOptional<z.ZodString>;
51
+ scope: z.ZodEnum<{
52
+ session: "session";
53
+ provider_instance: "provider_instance";
54
+ }>;
55
+ applicationTiming: z.ZodEnum<{
56
+ immediate: "immediate";
57
+ next_session: "next_session";
58
+ provider_restart: "provider_restart";
59
+ }>;
60
+ mutable: z.ZodBoolean;
61
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
62
+ fieldKind: z.ZodLiteral<"bounded_text">;
63
+ currentValue: z.ZodString;
64
+ maxLength: z.ZodNumber;
65
+ multiline: z.ZodBoolean;
66
+ key: z.ZodString;
67
+ revision: z.ZodNumber;
68
+ label: z.ZodString;
69
+ description: z.ZodOptional<z.ZodString>;
70
+ scope: z.ZodEnum<{
71
+ session: "session";
72
+ provider_instance: "provider_instance";
73
+ }>;
74
+ applicationTiming: z.ZodEnum<{
75
+ immediate: "immediate";
76
+ next_session: "next_session";
77
+ provider_restart: "provider_restart";
78
+ }>;
79
+ mutable: z.ZodBoolean;
80
+ }, z.core.$strict>>], "fieldKind">;
81
+ export declare const AgentConfigurationCatalogPortableSchema: z.ZodReadonly<z.ZodObject<{
82
+ revision: z.ZodNumber;
83
+ fields: z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
84
+ fieldKind: z.ZodLiteral<"boolean">;
85
+ currentValue: z.ZodBoolean;
86
+ key: z.ZodString;
87
+ revision: z.ZodNumber;
88
+ label: z.ZodString;
89
+ description: z.ZodOptional<z.ZodString>;
90
+ scope: z.ZodEnum<{
91
+ session: "session";
92
+ provider_instance: "provider_instance";
93
+ }>;
94
+ applicationTiming: z.ZodEnum<{
95
+ immediate: "immediate";
96
+ next_session: "next_session";
97
+ provider_restart: "provider_restart";
98
+ }>;
99
+ mutable: z.ZodBoolean;
100
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
101
+ fieldKind: z.ZodLiteral<"single_select">;
102
+ currentValue: z.ZodString;
103
+ options: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
104
+ optionId: z.ZodString;
105
+ label: z.ZodString;
106
+ description: z.ZodOptional<z.ZodString>;
107
+ }, z.core.$strict>>>>;
108
+ key: z.ZodString;
109
+ revision: z.ZodNumber;
110
+ label: z.ZodString;
111
+ description: z.ZodOptional<z.ZodString>;
112
+ scope: z.ZodEnum<{
113
+ session: "session";
114
+ provider_instance: "provider_instance";
115
+ }>;
116
+ applicationTiming: z.ZodEnum<{
117
+ immediate: "immediate";
118
+ next_session: "next_session";
119
+ provider_restart: "provider_restart";
120
+ }>;
121
+ mutable: z.ZodBoolean;
122
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
123
+ fieldKind: z.ZodLiteral<"bounded_integer">;
124
+ currentValue: z.ZodNumber;
125
+ minimum: z.ZodNumber;
126
+ maximum: z.ZodNumber;
127
+ key: z.ZodString;
128
+ revision: z.ZodNumber;
129
+ label: z.ZodString;
130
+ description: z.ZodOptional<z.ZodString>;
131
+ scope: z.ZodEnum<{
132
+ session: "session";
133
+ provider_instance: "provider_instance";
134
+ }>;
135
+ applicationTiming: z.ZodEnum<{
136
+ immediate: "immediate";
137
+ next_session: "next_session";
138
+ provider_restart: "provider_restart";
139
+ }>;
140
+ mutable: z.ZodBoolean;
141
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
142
+ fieldKind: z.ZodLiteral<"bounded_text">;
143
+ currentValue: z.ZodString;
144
+ maxLength: z.ZodNumber;
145
+ multiline: z.ZodBoolean;
146
+ key: z.ZodString;
147
+ revision: z.ZodNumber;
148
+ label: z.ZodString;
149
+ description: z.ZodOptional<z.ZodString>;
150
+ scope: z.ZodEnum<{
151
+ session: "session";
152
+ provider_instance: "provider_instance";
153
+ }>;
154
+ applicationTiming: z.ZodEnum<{
155
+ immediate: "immediate";
156
+ next_session: "next_session";
157
+ provider_restart: "provider_restart";
158
+ }>;
159
+ mutable: z.ZodBoolean;
160
+ }, z.core.$strict>>], "fieldKind">>>;
161
+ }, z.core.$strict>>;
162
+ export declare const AgentConfigurationCatalogSchema: z.ZodType<AgentConfigurationCatalog>;
163
+ export declare const AgentConfigurationValueSchema: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
164
+ fieldKind: z.ZodLiteral<"boolean">;
165
+ value: z.ZodBoolean;
166
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
167
+ fieldKind: z.ZodLiteral<"single_select">;
168
+ optionId: z.ZodString;
169
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
170
+ fieldKind: z.ZodLiteral<"bounded_integer">;
171
+ value: z.ZodNumber;
172
+ }, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
173
+ fieldKind: z.ZodLiteral<"bounded_text">;
174
+ value: z.ZodString;
175
+ }, z.core.$strict>>], "fieldKind">;
176
+ export declare const AgentConfigurationSelectionInputSchema: z.ZodType<AgentConfigurationSelectionInput>;
177
+ //# sourceMappingURL=configuration.d.ts.map
@@ -0,0 +1,157 @@
1
+ import { z } from "zod/v4";
2
+ import { compareStringsByUnicodeCodePoint } from "../foundation/ordering.js";
3
+ import {
4
+ AGENT_CONFIGURATION_APPLICATION_TIMINGS,
5
+ AGENT_CONFIGURATION_DESCRIPTION_MAX_LENGTH,
6
+ AGENT_CONFIGURATION_FIELDS_MAX_LENGTH,
7
+ AGENT_CONFIGURATION_LABEL_MAX_LENGTH,
8
+ AGENT_CONFIGURATION_OPTIONS_MAX_LENGTH,
9
+ AGENT_CONFIGURATION_SCOPES,
10
+ AGENT_CONFIGURATION_TEXT_VALUE_MAX_LENGTH
11
+ } from "../configuration/types.js";
12
+ import {
13
+ AgentCanonicalIdValueSchema,
14
+ createAgentCanonicalNonBlankStringSchema
15
+ } from "./foundation.js";
16
+ const PositiveSafeIntegerSchema = z.number().int().positive().max(Number.MAX_SAFE_INTEGER);
17
+ const SafeIntegerSchema = z.number().int().min(Number.MIN_SAFE_INTEGER).max(Number.MAX_SAFE_INTEGER);
18
+ const LabelSchema = createAgentCanonicalNonBlankStringSchema(
19
+ AGENT_CONFIGURATION_LABEL_MAX_LENGTH
20
+ );
21
+ const DescriptionSchema = createAgentCanonicalNonBlankStringSchema(
22
+ AGENT_CONFIGURATION_DESCRIPTION_MAX_LENGTH
23
+ );
24
+ const CanonicalTextValueSchema = z.string().max(AGENT_CONFIGURATION_TEXT_VALUE_MAX_LENGTH).regex(/^(?:$|\S|\S[\s\S]*\S)$/u);
25
+ const AgentConfigurationSelectOptionSchema = z.object({
26
+ optionId: AgentCanonicalIdValueSchema,
27
+ label: LabelSchema,
28
+ description: DescriptionSchema.optional()
29
+ }).strict().readonly();
30
+ const fieldBase = {
31
+ key: AgentCanonicalIdValueSchema,
32
+ revision: PositiveSafeIntegerSchema,
33
+ label: LabelSchema,
34
+ description: DescriptionSchema.optional(),
35
+ scope: z.enum(AGENT_CONFIGURATION_SCOPES),
36
+ applicationTiming: z.enum(AGENT_CONFIGURATION_APPLICATION_TIMINGS),
37
+ mutable: z.boolean()
38
+ };
39
+ const AgentConfigurationFieldPortableSchema = z.discriminatedUnion(
40
+ "fieldKind",
41
+ [
42
+ z.object({
43
+ ...fieldBase,
44
+ fieldKind: z.literal("boolean"),
45
+ currentValue: z.boolean()
46
+ }).strict().readonly(),
47
+ z.object({
48
+ ...fieldBase,
49
+ fieldKind: z.literal("single_select"),
50
+ currentValue: AgentCanonicalIdValueSchema,
51
+ options: z.array(AgentConfigurationSelectOptionSchema).min(1).max(AGENT_CONFIGURATION_OPTIONS_MAX_LENGTH).readonly()
52
+ }).strict().readonly(),
53
+ z.object({
54
+ ...fieldBase,
55
+ fieldKind: z.literal("bounded_integer"),
56
+ currentValue: SafeIntegerSchema,
57
+ minimum: SafeIntegerSchema,
58
+ maximum: SafeIntegerSchema
59
+ }).strict().readonly(),
60
+ z.object({
61
+ ...fieldBase,
62
+ fieldKind: z.literal("bounded_text"),
63
+ currentValue: CanonicalTextValueSchema,
64
+ maxLength: z.number().int().positive().max(AGENT_CONFIGURATION_TEXT_VALUE_MAX_LENGTH),
65
+ multiline: z.boolean()
66
+ }).strict().readonly()
67
+ ]
68
+ );
69
+ const AgentConfigurationCatalogPortableSchema = z.object({
70
+ revision: PositiveSafeIntegerSchema,
71
+ fields: z.array(AgentConfigurationFieldPortableSchema).max(AGENT_CONFIGURATION_FIELDS_MAX_LENGTH).readonly()
72
+ }).strict().readonly();
73
+ const AgentConfigurationCatalogSchema = AgentConfigurationCatalogPortableSchema.superRefine((catalog, context) => {
74
+ const keys = /* @__PURE__ */ new Set();
75
+ let previousKey = "";
76
+ catalog.fields.forEach((field, fieldIndex) => {
77
+ if (keys.has(field.key)) {
78
+ context.addIssue({
79
+ code: "custom",
80
+ path: ["fields", fieldIndex, "key"],
81
+ message: "Configuration field keys must be unique."
82
+ });
83
+ }
84
+ if (fieldIndex > 0 && compareStringsByUnicodeCodePoint(previousKey, field.key) >= 0) {
85
+ context.addIssue({
86
+ code: "custom",
87
+ path: ["fields", fieldIndex, "key"],
88
+ message: "Configuration fields must be ordered by key."
89
+ });
90
+ }
91
+ keys.add(field.key);
92
+ previousKey = field.key;
93
+ if (field.fieldKind === "single_select") {
94
+ const optionIds = /* @__PURE__ */ new Set();
95
+ field.options.forEach((option, optionIndex) => {
96
+ if (optionIds.has(option.optionId)) {
97
+ context.addIssue({
98
+ code: "custom",
99
+ path: ["fields", fieldIndex, "options", optionIndex, "optionId"],
100
+ message: "Configuration option IDs must be unique within a field."
101
+ });
102
+ }
103
+ if (optionIndex > 0 && compareStringsByUnicodeCodePoint(
104
+ field.options[optionIndex - 1].optionId,
105
+ option.optionId
106
+ ) >= 0) {
107
+ context.addIssue({
108
+ code: "custom",
109
+ path: ["fields", fieldIndex, "options", optionIndex, "optionId"],
110
+ message: "Configuration options must use canonical optionId order."
111
+ });
112
+ }
113
+ optionIds.add(option.optionId);
114
+ });
115
+ if (!optionIds.has(field.currentValue)) {
116
+ context.addIssue({
117
+ code: "custom",
118
+ path: ["fields", fieldIndex, "currentValue"],
119
+ message: "Current configuration value must be an offered option."
120
+ });
121
+ }
122
+ }
123
+ if (field.fieldKind === "bounded_integer" && (field.minimum > field.maximum || field.currentValue < field.minimum || field.currentValue > field.maximum)) {
124
+ context.addIssue({
125
+ code: "custom",
126
+ path: ["fields", fieldIndex, "currentValue"],
127
+ message: "Integer configuration bounds and current value are inconsistent."
128
+ });
129
+ }
130
+ if (field.fieldKind === "bounded_text" && field.currentValue.length > field.maxLength) {
131
+ context.addIssue({
132
+ code: "custom",
133
+ path: ["fields", fieldIndex, "currentValue"],
134
+ message: "Current text configuration value exceeds the field maximum."
135
+ });
136
+ }
137
+ });
138
+ });
139
+ const AgentConfigurationValueSchema = z.discriminatedUnion("fieldKind", [
140
+ z.object({ fieldKind: z.literal("boolean"), value: z.boolean() }).strict().readonly(),
141
+ z.object({ fieldKind: z.literal("single_select"), optionId: AgentCanonicalIdValueSchema }).strict().readonly(),
142
+ z.object({ fieldKind: z.literal("bounded_integer"), value: SafeIntegerSchema }).strict().readonly(),
143
+ z.object({ fieldKind: z.literal("bounded_text"), value: CanonicalTextValueSchema }).strict().readonly()
144
+ ]);
145
+ const AgentConfigurationSelectionInputSchema = z.object({
146
+ key: AgentCanonicalIdValueSchema,
147
+ expectedCatalogRevision: PositiveSafeIntegerSchema,
148
+ expectedFieldRevision: PositiveSafeIntegerSchema,
149
+ value: AgentConfigurationValueSchema
150
+ }).strict().readonly();
151
+ export {
152
+ AgentConfigurationCatalogPortableSchema,
153
+ AgentConfigurationCatalogSchema,
154
+ AgentConfigurationFieldPortableSchema,
155
+ AgentConfigurationSelectionInputSchema,
156
+ AgentConfigurationValueSchema
157
+ };