@agen-ai/agent-protocol 0.2.1 → 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.
- package/README.md +22 -12
- package/dist/capabilities/types.d.ts +64 -18
- package/dist/capabilities/types.js +0 -6
- package/dist/collaboration/index.d.ts +3 -0
- package/dist/collaboration/index.js +2 -0
- package/dist/collaboration/parsers.d.ts +9 -0
- package/dist/collaboration/parsers.js +32 -0
- package/dist/collaboration/types.d.ts +88 -0
- package/dist/collaboration/types.js +64 -0
- package/dist/configuration/index.d.ts +3 -0
- package/dist/configuration/index.js +2 -0
- package/dist/configuration/parsers.d.ts +9 -0
- package/dist/configuration/parsers.js +98 -0
- package/dist/configuration/types.d.ts +72 -0
- package/dist/configuration/types.js +27 -0
- package/dist/events/types.d.ts +15 -3
- package/dist/events/types.js +3 -0
- package/dist/foundation/parsers.d.ts +19 -1
- package/dist/foundation/parsers.js +70 -0
- package/dist/foundation/types.d.ts +10 -1
- package/dist/foundation/types.js +1 -1
- package/dist/integrations/index.d.ts +3 -0
- package/dist/integrations/index.js +2 -0
- package/dist/integrations/parsers.d.ts +7 -0
- package/dist/integrations/parsers.js +23 -0
- package/dist/integrations/types.d.ts +43 -0
- package/dist/integrations/types.js +23 -0
- package/dist/jsonSchema/generated.d.ts +9573 -3378
- package/dist/jsonSchema/generated.js +4935 -973
- package/dist/managedContent/index.d.ts +3 -0
- package/dist/managedContent/index.js +2 -0
- package/dist/managedContent/parsers.d.ts +7 -0
- package/dist/managedContent/parsers.js +23 -0
- package/dist/managedContent/types.d.ts +39 -0
- package/dist/managedContent/types.js +21 -0
- package/dist/operations/index.d.ts +3 -0
- package/dist/operations/index.js +2 -0
- package/dist/operations/parsers.d.ts +15 -0
- package/dist/operations/parsers.js +181 -0
- package/dist/operations/types.d.ts +112 -0
- package/dist/operations/types.js +67 -0
- package/dist/public/collaboration.d.ts +2 -0
- package/dist/public/collaboration.js +1 -0
- package/dist/public/configuration.d.ts +2 -0
- package/dist/public/configuration.js +1 -0
- package/dist/public/index.d.ts +6 -0
- package/dist/public/index.js +6 -0
- package/dist/public/integrations.d.ts +2 -0
- package/dist/public/integrations.js +1 -0
- package/dist/public/managedContent.d.ts +2 -0
- package/dist/public/managedContent.js +1 -0
- package/dist/public/operations.d.ts +2 -0
- package/dist/public/operations.js +1 -0
- package/dist/public/resources.d.ts +2 -0
- package/dist/public/resources.js +1 -0
- package/dist/requests/parsers.js +40 -11
- package/dist/requests/types.d.ts +35 -8
- package/dist/requests/types.js +15 -1
- package/dist/resources/index.d.ts +3 -0
- package/dist/resources/index.js +2 -0
- package/dist/resources/parsers.d.ts +5 -0
- package/dist/resources/parsers.js +12 -0
- package/dist/resources/types.d.ts +39 -0
- package/dist/resources/types.js +19 -0
- package/dist/sessions/types.d.ts +15 -4
- package/dist/zod/capabilities.d.ts +103 -15
- package/dist/zod/capabilities.js +218 -56
- package/dist/zod/collaboration.d.ts +60 -0
- package/dist/zod/collaboration.js +155 -0
- package/dist/zod/configuration.d.ts +177 -0
- package/dist/zod/configuration.js +157 -0
- package/dist/zod/events.d.ts +214 -22
- package/dist/zod/events.js +15 -0
- package/dist/zod/foundation.d.ts +10 -1
- package/dist/zod/foundation.js +18 -0
- package/dist/zod/index.d.ts +7 -1
- package/dist/zod/index.js +62 -0
- package/dist/zod/integrations.d.ts +76 -0
- package/dist/zod/integrations.js +92 -0
- package/dist/zod/managedContent.d.ts +9 -0
- package/dist/zod/managedContent.js +70 -0
- package/dist/zod/operations.d.ts +339 -0
- package/dist/zod/operations.js +229 -0
- package/dist/zod/requests.d.ts +100 -11
- package/dist/zod/requests.js +68 -27
- package/dist/zod/resources.d.ts +43 -0
- package/dist/zod/resources.js +82 -0
- package/dist/zod/sessions.d.ts +168 -21
- package/dist/zod/sessions.js +54 -42
- package/dist/zod/typeEquality.generated.d.ts +40 -0
- package/package.json +26 -2
package/dist/zod/capabilities.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
import {
|
|
3
|
-
AGENT_PROTOCOL_COLLECTION_MAX_LENGTH,
|
|
4
3
|
AGENT_PROTOCOL_VERSION
|
|
5
4
|
} from "../foundation/types.js";
|
|
6
5
|
import { AGENT_ARTIFACT_KINDS } from "../artifacts/types.js";
|
|
@@ -8,10 +7,40 @@ import {
|
|
|
8
7
|
AGENT_AUTHENTICATION_FLOWS,
|
|
9
8
|
AGENT_FILE_CHANGE_MODES
|
|
10
9
|
} from "../capabilities/types.js";
|
|
10
|
+
import {
|
|
11
|
+
AGENT_COLLABORATION_CONTROL_ACTIONS,
|
|
12
|
+
AGENT_COLLABORATION_GRAPH_LIMITS,
|
|
13
|
+
AGENT_COLLABORATION_ROLES
|
|
14
|
+
} from "../collaboration/types.js";
|
|
15
|
+
import {
|
|
16
|
+
AGENT_CONFIGURATION_FIELD_KINDS,
|
|
17
|
+
AGENT_CONFIGURATION_FIELDS_MAX_LENGTH
|
|
18
|
+
} from "../configuration/types.js";
|
|
19
|
+
import {
|
|
20
|
+
AGENT_INTEGRATION_KINDS,
|
|
21
|
+
AGENT_INTEGRATION_RESOURCES_MAX_LENGTH,
|
|
22
|
+
AGENT_INTEGRATION_CATALOG_MAX_LENGTH,
|
|
23
|
+
AGENT_INTEGRATION_SERVERS_MAX_LENGTH,
|
|
24
|
+
AGENT_INTEGRATION_TOOLS_MAX_LENGTH
|
|
25
|
+
} from "../integrations/types.js";
|
|
26
|
+
import {
|
|
27
|
+
AGENT_MANAGED_CONTENT_CATALOG_MAX_LENGTH,
|
|
28
|
+
AGENT_MANAGED_CONTENT_KINDS
|
|
29
|
+
} from "../managedContent/types.js";
|
|
30
|
+
import {
|
|
31
|
+
AGENT_OPERATION_CATALOG_MAX_LENGTH,
|
|
32
|
+
AGENT_OPERATION_EXECUTION_MODES,
|
|
33
|
+
AGENT_OPERATION_FIELDS_MAX_LENGTH,
|
|
34
|
+
AGENT_OPERATION_FIELD_KINDS,
|
|
35
|
+
AGENT_OPERATION_KINDS
|
|
36
|
+
} from "../operations/types.js";
|
|
11
37
|
import {
|
|
12
38
|
AGENT_APPROVAL_PERSISTENCES,
|
|
13
|
-
AGENT_APPROVAL_SCOPE_KINDS
|
|
39
|
+
AGENT_APPROVAL_SCOPE_KINDS,
|
|
40
|
+
AGENT_ELICITATION_FIELD_KINDS,
|
|
41
|
+
AGENT_ELICITATION_FIELDS_MAX_LENGTH
|
|
14
42
|
} from "../requests/types.js";
|
|
43
|
+
import { AGENT_GENERATED_RESOURCE_KINDS } from "../resources/types.js";
|
|
15
44
|
import {
|
|
16
45
|
AGENT_CONTEXT_COMPACTION_TRIGGERS,
|
|
17
46
|
AGENT_CONTEXT_CUMULATIVE_USAGE_FIELDS,
|
|
@@ -21,7 +50,6 @@ import {
|
|
|
21
50
|
AGENT_TURN_INTERACTION_MODES
|
|
22
51
|
} from "../turns/types.js";
|
|
23
52
|
import { AgentProviderKeySchema } from "./foundation.js";
|
|
24
|
-
const AgentCapabilityIdentifierSchema = z.string().min(1).max(100).regex(/^[a-z][a-z0-9._:-]*$/u);
|
|
25
53
|
function addCanonicalListIssues(input, context) {
|
|
26
54
|
const seen = /* @__PURE__ */ new Set();
|
|
27
55
|
let previousOrder = -1;
|
|
@@ -46,6 +74,9 @@ function addCanonicalListIssues(input, context) {
|
|
|
46
74
|
});
|
|
47
75
|
}
|
|
48
76
|
const PositiveSafeIntegerSchema = z.number().int().positive().max(Number.MAX_SAFE_INTEGER);
|
|
77
|
+
function boundedPositiveSafeInteger(maximum) {
|
|
78
|
+
return z.number().int().positive().max(maximum);
|
|
79
|
+
}
|
|
49
80
|
const AgentApprovalCapabilitySchema = z.discriminatedUnion("kind", [
|
|
50
81
|
z.object({ kind: z.literal("unsupported") }).strict().readonly(),
|
|
51
82
|
z.object({
|
|
@@ -56,7 +87,28 @@ const AgentApprovalCapabilitySchema = z.discriminatedUnion("kind", [
|
|
|
56
87
|
scopeKinds: z.array(z.enum(AGENT_APPROVAL_SCOPE_KINDS)).min(1).max(AGENT_APPROVAL_SCOPE_KINDS.length).meta({ uniqueItems: true }).readonly()
|
|
57
88
|
}).strict().readonly()
|
|
58
89
|
).min(1).max(AGENT_APPROVAL_PERSISTENCES.length).readonly()
|
|
59
|
-
}).strict().
|
|
90
|
+
}).strict().superRefine((capability, context) => {
|
|
91
|
+
addCanonicalListIssues(
|
|
92
|
+
{
|
|
93
|
+
values: capability.modes.map((mode) => mode.persistence),
|
|
94
|
+
canonicalOrder: AGENT_APPROVAL_PERSISTENCES,
|
|
95
|
+
path: ["modes"],
|
|
96
|
+
label: "Approval persistence modes"
|
|
97
|
+
},
|
|
98
|
+
context
|
|
99
|
+
);
|
|
100
|
+
capability.modes.forEach((mode, index) => {
|
|
101
|
+
addCanonicalListIssues(
|
|
102
|
+
{
|
|
103
|
+
values: mode.scopeKinds,
|
|
104
|
+
canonicalOrder: AGENT_APPROVAL_SCOPE_KINDS,
|
|
105
|
+
path: ["modes", index, "scopeKinds"],
|
|
106
|
+
label: "Approval scope kinds"
|
|
107
|
+
},
|
|
108
|
+
context
|
|
109
|
+
);
|
|
110
|
+
});
|
|
111
|
+
}).readonly()
|
|
60
112
|
]);
|
|
61
113
|
const AgentContextUsageCapabilitySchema = z.discriminatedUnion("kind", [
|
|
62
114
|
z.object({ kind: z.literal("unsupported") }).strict().readonly(),
|
|
@@ -133,6 +185,74 @@ const AgentOperationInputCapabilitySchema = z.object({
|
|
|
133
185
|
text: z.literal(true),
|
|
134
186
|
images: AgentImageInputCapabilitySchema
|
|
135
187
|
}).strict().readonly();
|
|
188
|
+
const AgentOperationsCapabilitySchema = z.discriminatedUnion("kind", [
|
|
189
|
+
z.object({ kind: z.literal("unsupported") }).strict().readonly(),
|
|
190
|
+
z.object({
|
|
191
|
+
kind: z.literal("supported"),
|
|
192
|
+
operationKinds: z.array(z.enum(AGENT_OPERATION_KINDS)).min(1).max(AGENT_OPERATION_KINDS.length).meta({ uniqueItems: true }).readonly(),
|
|
193
|
+
fieldKinds: z.array(z.enum(AGENT_OPERATION_FIELD_KINDS)).min(1).max(AGENT_OPERATION_FIELD_KINDS.length).meta({ uniqueItems: true }).readonly(),
|
|
194
|
+
executionModes: z.array(z.enum(AGENT_OPERATION_EXECUTION_MODES)).min(1).max(AGENT_OPERATION_EXECUTION_MODES.length).meta({ uniqueItems: true }).readonly(),
|
|
195
|
+
maxOperations: boundedPositiveSafeInteger(
|
|
196
|
+
AGENT_OPERATION_CATALOG_MAX_LENGTH
|
|
197
|
+
),
|
|
198
|
+
maxFieldsPerOperation: boundedPositiveSafeInteger(
|
|
199
|
+
AGENT_OPERATION_FIELDS_MAX_LENGTH
|
|
200
|
+
)
|
|
201
|
+
}).strict().readonly()
|
|
202
|
+
]);
|
|
203
|
+
const AgentManagedContentCapabilitySchema = z.discriminatedUnion("kind", [
|
|
204
|
+
z.object({ kind: z.literal("unsupported") }).strict().readonly(),
|
|
205
|
+
z.object({
|
|
206
|
+
kind: z.literal("supported"),
|
|
207
|
+
contentKinds: z.array(z.enum(AGENT_MANAGED_CONTENT_KINDS)).min(1).max(AGENT_MANAGED_CONTENT_KINDS.length).meta({ uniqueItems: true }).readonly(),
|
|
208
|
+
maxEntries: boundedPositiveSafeInteger(
|
|
209
|
+
AGENT_MANAGED_CONTENT_CATALOG_MAX_LENGTH
|
|
210
|
+
)
|
|
211
|
+
}).strict().readonly()
|
|
212
|
+
]);
|
|
213
|
+
const AgentIntegrationsCapabilitySchema = z.discriminatedUnion("kind", [
|
|
214
|
+
z.object({ kind: z.literal("unsupported") }).strict().readonly(),
|
|
215
|
+
z.object({
|
|
216
|
+
kind: z.literal("supported"),
|
|
217
|
+
integrationKinds: z.array(z.enum(AGENT_INTEGRATION_KINDS)).min(1).max(AGENT_INTEGRATION_KINDS.length).meta({ uniqueItems: true }).readonly(),
|
|
218
|
+
maxIntegrations: boundedPositiveSafeInteger(
|
|
219
|
+
AGENT_INTEGRATION_CATALOG_MAX_LENGTH
|
|
220
|
+
),
|
|
221
|
+
maxServersPerIntegration: boundedPositiveSafeInteger(
|
|
222
|
+
AGENT_INTEGRATION_SERVERS_MAX_LENGTH
|
|
223
|
+
),
|
|
224
|
+
maxToolsPerServer: boundedPositiveSafeInteger(
|
|
225
|
+
AGENT_INTEGRATION_TOOLS_MAX_LENGTH
|
|
226
|
+
),
|
|
227
|
+
maxResourcesPerServer: boundedPositiveSafeInteger(
|
|
228
|
+
AGENT_INTEGRATION_RESOURCES_MAX_LENGTH
|
|
229
|
+
)
|
|
230
|
+
}).strict().readonly()
|
|
231
|
+
]);
|
|
232
|
+
const AgentCollaborationCapabilitySchema = z.discriminatedUnion("kind", [
|
|
233
|
+
z.object({ kind: z.literal("unsupported") }).strict().readonly(),
|
|
234
|
+
z.object({
|
|
235
|
+
kind: z.literal("supported"),
|
|
236
|
+
roles: z.array(z.enum(AGENT_COLLABORATION_ROLES)).min(1).max(AGENT_COLLABORATION_ROLES.length).meta({ uniqueItems: true }).readonly(),
|
|
237
|
+
controlActions: z.array(z.enum(AGENT_COLLABORATION_CONTROL_ACTIONS)).min(1).max(AGENT_COLLABORATION_CONTROL_ACTIONS.length).meta({ uniqueItems: true }).readonly(),
|
|
238
|
+
maxDepth: boundedPositiveSafeInteger(AGENT_COLLABORATION_GRAPH_LIMITS.maxDepth),
|
|
239
|
+
maxChildrenPerNode: boundedPositiveSafeInteger(
|
|
240
|
+
AGENT_COLLABORATION_GRAPH_LIMITS.maxChildrenPerNode
|
|
241
|
+
),
|
|
242
|
+
maxActiveNodes: boundedPositiveSafeInteger(
|
|
243
|
+
AGENT_COLLABORATION_GRAPH_LIMITS.maxActiveNodes
|
|
244
|
+
)
|
|
245
|
+
}).strict().readonly()
|
|
246
|
+
]);
|
|
247
|
+
const AgentGeneratedResourcesCapabilitySchema = z.discriminatedUnion("kind", [
|
|
248
|
+
z.object({ kind: z.literal("unsupported") }).strict().readonly(),
|
|
249
|
+
z.object({
|
|
250
|
+
kind: z.literal("supported"),
|
|
251
|
+
resourceKinds: z.array(z.enum(AGENT_GENERATED_RESOURCE_KINDS)).min(1).max(AGENT_GENERATED_RESOURCE_KINDS.length).meta({ uniqueItems: true }).readonly(),
|
|
252
|
+
maxResourcesPerTurn: boundedPositiveSafeInteger(100),
|
|
253
|
+
maxBytesPerResource: boundedPositiveSafeInteger(1073741824)
|
|
254
|
+
}).strict().readonly()
|
|
255
|
+
]);
|
|
136
256
|
const AgentCapabilitiesPortableSchema = z.object({
|
|
137
257
|
protocolVersion: z.literal(AGENT_PROTOCOL_VERSION),
|
|
138
258
|
providerKey: AgentProviderKeySchema,
|
|
@@ -159,8 +279,14 @@ const AgentCapabilitiesPortableSchema = z.object({
|
|
|
159
279
|
approval: AgentApprovalCapabilitySchema,
|
|
160
280
|
elicitation: z.discriminatedUnion("kind", [
|
|
161
281
|
z.object({ kind: z.literal("unsupported") }).strict().readonly(),
|
|
162
|
-
z.object({
|
|
163
|
-
|
|
282
|
+
z.object({
|
|
283
|
+
kind: z.literal("supported"),
|
|
284
|
+
fieldKinds: z.array(z.enum(AGENT_ELICITATION_FIELD_KINDS)).min(1).max(AGENT_ELICITATION_FIELD_KINDS.length).meta({ uniqueItems: true }).readonly(),
|
|
285
|
+
maxFields: boundedPositiveSafeInteger(
|
|
286
|
+
AGENT_ELICITATION_FIELDS_MAX_LENGTH
|
|
287
|
+
),
|
|
288
|
+
sensitiveFields: z.boolean()
|
|
289
|
+
}).strict().readonly()
|
|
164
290
|
])
|
|
165
291
|
}).strict().readonly(),
|
|
166
292
|
context: z.object({
|
|
@@ -178,20 +304,17 @@ const AgentCapabilitiesPortableSchema = z.object({
|
|
|
178
304
|
z.object({ kind: z.literal("managed") }).strict().readonly(),
|
|
179
305
|
z.object({
|
|
180
306
|
kind: z.literal("selectable"),
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}).strict().readonly()
|
|
186
|
-
).min(1).max(AGENT_PROTOCOL_COLLECTION_MAX_LENGTH).readonly()
|
|
307
|
+
fieldKinds: z.array(z.enum(AGENT_CONFIGURATION_FIELD_KINDS)).min(1).max(AGENT_CONFIGURATION_FIELD_KINDS.length).meta({ uniqueItems: true }).readonly(),
|
|
308
|
+
maxFields: boundedPositiveSafeInteger(
|
|
309
|
+
AGENT_CONFIGURATION_FIELDS_MAX_LENGTH
|
|
310
|
+
)
|
|
187
311
|
}).strict().readonly()
|
|
188
312
|
]),
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}).strict().readonly(),
|
|
313
|
+
operations: AgentOperationsCapabilitySchema,
|
|
314
|
+
managedContent: AgentManagedContentCapabilitySchema,
|
|
315
|
+
integrations: AgentIntegrationsCapabilitySchema,
|
|
316
|
+
collaboration: AgentCollaborationCapabilitySchema,
|
|
317
|
+
generatedResources: AgentGeneratedResourcesCapabilitySchema,
|
|
195
318
|
authentication: z.discriminatedUnion("kind", [
|
|
196
319
|
z.object({ kind: z.literal("unsupported") }).strict().readonly(),
|
|
197
320
|
z.object({
|
|
@@ -211,30 +334,6 @@ const AgentCapabilitiesSchema = AgentCapabilitiesPortableSchema.superRefine((cap
|
|
|
211
334
|
},
|
|
212
335
|
context
|
|
213
336
|
);
|
|
214
|
-
if (capabilities.requests.approval.kind === "supported") {
|
|
215
|
-
addCanonicalListIssues(
|
|
216
|
-
{
|
|
217
|
-
values: capabilities.requests.approval.modes.map(
|
|
218
|
-
(mode) => mode.persistence
|
|
219
|
-
),
|
|
220
|
-
canonicalOrder: AGENT_APPROVAL_PERSISTENCES,
|
|
221
|
-
path: ["requests", "approval", "modes"],
|
|
222
|
-
label: "Approval persistence modes"
|
|
223
|
-
},
|
|
224
|
-
context
|
|
225
|
-
);
|
|
226
|
-
capabilities.requests.approval.modes.forEach((mode, index) => {
|
|
227
|
-
addCanonicalListIssues(
|
|
228
|
-
{
|
|
229
|
-
values: mode.scopeKinds,
|
|
230
|
-
canonicalOrder: AGENT_APPROVAL_SCOPE_KINDS,
|
|
231
|
-
path: ["requests", "approval", "modes", index, "scopeKinds"],
|
|
232
|
-
label: "Approval scope kinds"
|
|
233
|
-
},
|
|
234
|
-
context
|
|
235
|
-
);
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
337
|
if (capabilities.context.usage.kind === "supported") {
|
|
239
338
|
addCanonicalListIssues(
|
|
240
339
|
{
|
|
@@ -276,25 +375,88 @@ const AgentCapabilitiesSchema = AgentCapabilitiesPortableSchema.superRefine((cap
|
|
|
276
375
|
context
|
|
277
376
|
);
|
|
278
377
|
if (capabilities.configuration.kind === "selectable") {
|
|
279
|
-
const keys = capabilities.configuration.fields.map((field) => field.key);
|
|
280
378
|
addCanonicalListIssues(
|
|
281
379
|
{
|
|
282
|
-
values:
|
|
283
|
-
|
|
284
|
-
|
|
380
|
+
values: capabilities.configuration.fieldKinds,
|
|
381
|
+
canonicalOrder: AGENT_CONFIGURATION_FIELD_KINDS,
|
|
382
|
+
path: ["configuration", "fieldKinds"],
|
|
383
|
+
label: "Selectable configuration field kinds"
|
|
384
|
+
},
|
|
385
|
+
context
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
if (capabilities.requests.elicitation.kind === "supported") {
|
|
389
|
+
addCanonicalListIssues(
|
|
390
|
+
{
|
|
391
|
+
values: capabilities.requests.elicitation.fieldKinds,
|
|
392
|
+
canonicalOrder: AGENT_ELICITATION_FIELD_KINDS,
|
|
393
|
+
path: ["requests", "elicitation", "fieldKinds"],
|
|
394
|
+
label: "Elicitation field kinds"
|
|
395
|
+
},
|
|
396
|
+
context
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
if (capabilities.operations.kind === "supported") {
|
|
400
|
+
for (const [values, canonicalOrder, path, label] of [
|
|
401
|
+
[capabilities.operations.operationKinds, AGENT_OPERATION_KINDS, ["operations", "operationKinds"], "Operation kinds"],
|
|
402
|
+
[capabilities.operations.fieldKinds, AGENT_OPERATION_FIELD_KINDS, ["operations", "fieldKinds"], "Operation field kinds"],
|
|
403
|
+
[capabilities.operations.executionModes, AGENT_OPERATION_EXECUTION_MODES, ["operations", "executionModes"], "Operation execution modes"]
|
|
404
|
+
]) {
|
|
405
|
+
addCanonicalListIssues({ values, canonicalOrder, path, label }, context);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
if (capabilities.managedContent.kind === "supported") {
|
|
409
|
+
addCanonicalListIssues(
|
|
410
|
+
{
|
|
411
|
+
values: capabilities.managedContent.contentKinds,
|
|
412
|
+
canonicalOrder: AGENT_MANAGED_CONTENT_KINDS,
|
|
413
|
+
path: ["managedContent", "contentKinds"],
|
|
414
|
+
label: "Managed content kinds"
|
|
415
|
+
},
|
|
416
|
+
context
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
if (capabilities.integrations.kind === "supported") {
|
|
420
|
+
addCanonicalListIssues(
|
|
421
|
+
{
|
|
422
|
+
values: capabilities.integrations.integrationKinds,
|
|
423
|
+
canonicalOrder: AGENT_INTEGRATION_KINDS,
|
|
424
|
+
path: ["integrations", "integrationKinds"],
|
|
425
|
+
label: "Integration kinds"
|
|
426
|
+
},
|
|
427
|
+
context
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
if (capabilities.collaboration.kind === "supported") {
|
|
431
|
+
addCanonicalListIssues(
|
|
432
|
+
{
|
|
433
|
+
values: capabilities.collaboration.roles,
|
|
434
|
+
canonicalOrder: AGENT_COLLABORATION_ROLES,
|
|
435
|
+
path: ["collaboration", "roles"],
|
|
436
|
+
label: "Collaboration roles"
|
|
437
|
+
},
|
|
438
|
+
context
|
|
439
|
+
);
|
|
440
|
+
addCanonicalListIssues(
|
|
441
|
+
{
|
|
442
|
+
values: capabilities.collaboration.controlActions,
|
|
443
|
+
canonicalOrder: AGENT_COLLABORATION_CONTROL_ACTIONS,
|
|
444
|
+
path: ["collaboration", "controlActions"],
|
|
445
|
+
label: "Collaboration control actions"
|
|
446
|
+
},
|
|
447
|
+
context
|
|
448
|
+
);
|
|
449
|
+
}
|
|
450
|
+
if (capabilities.generatedResources.kind === "supported") {
|
|
451
|
+
addCanonicalListIssues(
|
|
452
|
+
{
|
|
453
|
+
values: capabilities.generatedResources.resourceKinds,
|
|
454
|
+
canonicalOrder: AGENT_GENERATED_RESOURCE_KINDS,
|
|
455
|
+
path: ["generatedResources", "resourceKinds"],
|
|
456
|
+
label: "Generated resource kinds"
|
|
285
457
|
},
|
|
286
458
|
context
|
|
287
459
|
);
|
|
288
|
-
capabilities.configuration.fields.forEach((field, index) => {
|
|
289
|
-
addCanonicalListIssues(
|
|
290
|
-
{
|
|
291
|
-
values: field.optionIds,
|
|
292
|
-
path: ["configuration", "fields", index, "optionIds"],
|
|
293
|
-
label: "Selectable configuration option IDs"
|
|
294
|
-
},
|
|
295
|
-
context
|
|
296
|
-
);
|
|
297
|
-
});
|
|
298
460
|
}
|
|
299
461
|
if (capabilities.authentication.kind === "supported") {
|
|
300
462
|
addCanonicalListIssues(
|
|
@@ -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
|
+
};
|