@agen-ai/agent-protocol 0.4.1 → 0.4.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 +89 -49
- package/dist/capabilities/types.d.ts +1 -1
- package/dist/events/types.d.ts +9 -3
- package/dist/events/types.js +4 -1
- package/dist/foundation/types.d.ts +1 -1
- package/dist/foundation/types.js +1 -1
- package/dist/jsonSchema/generated.d.ts +11294 -7902
- package/dist/jsonSchema/generated.js +2271 -96
- package/dist/requests/elicitation.d.ts +4 -0
- package/dist/requests/elicitation.js +107 -0
- package/dist/requests/parsers.js +2 -100
- package/dist/sessionInteractions/parsers.d.ts +28 -1
- package/dist/sessionInteractions/parsers.js +165 -12
- package/dist/sessionInteractions/types.d.ts +113 -1
- package/dist/sessionInteractions/types.js +18 -2
- package/dist/zod/capabilities.d.ts +8 -8
- package/dist/zod/collaboration.d.ts +2 -2
- package/dist/zod/events.d.ts +50 -29
- package/dist/zod/events.js +8 -0
- package/dist/zod/index.d.ts +1 -1
- package/dist/zod/index.js +43 -1
- package/dist/zod/operations.d.ts +1 -1
- package/dist/zod/requests.d.ts +99 -7
- package/dist/zod/requests.js +18 -8
- package/dist/zod/sessionInteractions.d.ts +875 -5
- package/dist/zod/sessionInteractions.js +203 -33
- package/dist/zod/turns.d.ts +1 -1
- package/dist/zod/typeEquality.generated.d.ts +20 -2
- package/package.json +2 -2
package/dist/zod/requests.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ export declare const AgentApprovalConsequenceSchema: z.ZodDiscriminatedUnion<[z.
|
|
|
4
4
|
kind: z.ZodLiteral<"scoped">;
|
|
5
5
|
persistence: z.ZodEnum<{
|
|
6
6
|
session: "session";
|
|
7
|
-
workspace: "workspace";
|
|
8
7
|
once: "once";
|
|
8
|
+
workspace: "workspace";
|
|
9
9
|
}>;
|
|
10
10
|
scope: z.ZodReadonly<z.ZodObject<{
|
|
11
11
|
kind: z.ZodEnum<{
|
|
@@ -38,10 +38,10 @@ export declare const AgentApprovalRequestPortableSchema: z.ZodReadonly<z.ZodObje
|
|
|
38
38
|
artifactId: z.ZodType<import("../index.js").AgentArtifactId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentArtifactId, unknown>>;
|
|
39
39
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
40
40
|
kind: z.ZodEnum<{
|
|
41
|
-
other: "other";
|
|
42
|
-
file_change: "file_change";
|
|
43
41
|
tool: "tool";
|
|
44
42
|
command: "command";
|
|
43
|
+
file_change: "file_change";
|
|
44
|
+
other: "other";
|
|
45
45
|
}>;
|
|
46
46
|
title: z.ZodString;
|
|
47
47
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -59,8 +59,8 @@ export declare const AgentApprovalRequestPortableSchema: z.ZodReadonly<z.ZodObje
|
|
|
59
59
|
kind: z.ZodLiteral<"scoped">;
|
|
60
60
|
persistence: z.ZodEnum<{
|
|
61
61
|
session: "session";
|
|
62
|
-
workspace: "workspace";
|
|
63
62
|
once: "once";
|
|
63
|
+
workspace: "workspace";
|
|
64
64
|
}>;
|
|
65
65
|
scope: z.ZodReadonly<z.ZodObject<{
|
|
66
66
|
kind: z.ZodEnum<{
|
|
@@ -86,6 +86,73 @@ export declare const AgentApprovalRequestPortableSchema: z.ZodReadonly<z.ZodObje
|
|
|
86
86
|
expiresAt: z.ZodOptional<z.ZodType<import("../index.js").AgentIsoDateTime, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIsoDateTime, unknown>>>;
|
|
87
87
|
}, z.core.$strict>>;
|
|
88
88
|
export declare const AgentApprovalRequestSchema: z.ZodType<AgentApprovalRequest>;
|
|
89
|
+
export declare const AgentElicitationFieldSchema: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
|
|
90
|
+
kind: z.ZodLiteral<"text">;
|
|
91
|
+
multiline: z.ZodBoolean;
|
|
92
|
+
maxLength: z.ZodNumber;
|
|
93
|
+
fieldId: z.ZodType<import("../index.js").AgentRequestFieldId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentRequestFieldId, unknown>>;
|
|
94
|
+
label: z.ZodString;
|
|
95
|
+
description: z.ZodOptional<z.ZodString>;
|
|
96
|
+
required: z.ZodBoolean;
|
|
97
|
+
sensitivity: z.ZodEnum<{
|
|
98
|
+
ordinary: "ordinary";
|
|
99
|
+
sensitive: "sensitive";
|
|
100
|
+
}>;
|
|
101
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
102
|
+
kind: z.ZodLiteral<"single_select">;
|
|
103
|
+
options: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
104
|
+
value: z.ZodIntersection<z.ZodString, z.ZodString>;
|
|
105
|
+
label: z.ZodString;
|
|
106
|
+
description: z.ZodOptional<z.ZodString>;
|
|
107
|
+
}, z.core.$strict>>>>;
|
|
108
|
+
allowOther: z.ZodBoolean;
|
|
109
|
+
fieldId: z.ZodType<import("../index.js").AgentRequestFieldId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentRequestFieldId, unknown>>;
|
|
110
|
+
label: z.ZodString;
|
|
111
|
+
description: z.ZodOptional<z.ZodString>;
|
|
112
|
+
required: z.ZodBoolean;
|
|
113
|
+
sensitivity: z.ZodEnum<{
|
|
114
|
+
ordinary: "ordinary";
|
|
115
|
+
sensitive: "sensitive";
|
|
116
|
+
}>;
|
|
117
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
118
|
+
kind: z.ZodLiteral<"multi_select">;
|
|
119
|
+
options: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
120
|
+
value: z.ZodIntersection<z.ZodString, z.ZodString>;
|
|
121
|
+
label: z.ZodString;
|
|
122
|
+
description: z.ZodOptional<z.ZodString>;
|
|
123
|
+
}, z.core.$strict>>>>;
|
|
124
|
+
allowOther: z.ZodBoolean;
|
|
125
|
+
maxSelections: z.ZodNumber;
|
|
126
|
+
fieldId: z.ZodType<import("../index.js").AgentRequestFieldId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentRequestFieldId, unknown>>;
|
|
127
|
+
label: z.ZodString;
|
|
128
|
+
description: z.ZodOptional<z.ZodString>;
|
|
129
|
+
required: z.ZodBoolean;
|
|
130
|
+
sensitivity: z.ZodEnum<{
|
|
131
|
+
ordinary: "ordinary";
|
|
132
|
+
sensitive: "sensitive";
|
|
133
|
+
}>;
|
|
134
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
135
|
+
kind: z.ZodLiteral<"boolean">;
|
|
136
|
+
fieldId: z.ZodType<import("../index.js").AgentRequestFieldId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentRequestFieldId, unknown>>;
|
|
137
|
+
label: z.ZodString;
|
|
138
|
+
description: z.ZodOptional<z.ZodString>;
|
|
139
|
+
required: z.ZodBoolean;
|
|
140
|
+
sensitivity: z.ZodEnum<{
|
|
141
|
+
ordinary: "ordinary";
|
|
142
|
+
sensitive: "sensitive";
|
|
143
|
+
}>;
|
|
144
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
145
|
+
kind: z.ZodLiteral<"confirmation">;
|
|
146
|
+
confirmLabel: z.ZodString;
|
|
147
|
+
fieldId: z.ZodType<import("../index.js").AgentRequestFieldId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentRequestFieldId, unknown>>;
|
|
148
|
+
label: z.ZodString;
|
|
149
|
+
description: z.ZodOptional<z.ZodString>;
|
|
150
|
+
required: z.ZodBoolean;
|
|
151
|
+
sensitivity: z.ZodEnum<{
|
|
152
|
+
ordinary: "ordinary";
|
|
153
|
+
sensitive: "sensitive";
|
|
154
|
+
}>;
|
|
155
|
+
}, z.core.$strict>>], "kind">;
|
|
89
156
|
export declare const AgentElicitationRequestPortableSchema: z.ZodReadonly<z.ZodObject<{
|
|
90
157
|
requestKind: z.ZodLiteral<"elicitation">;
|
|
91
158
|
requestId: z.ZodType<import("../index.js").AgentRequestId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentRequestId, unknown>>;
|
|
@@ -159,6 +226,7 @@ export declare const AgentElicitationRequestPortableSchema: z.ZodReadonly<z.ZodO
|
|
|
159
226
|
}, z.core.$strict>>], "kind">>>;
|
|
160
227
|
expiresAt: z.ZodOptional<z.ZodType<import("../index.js").AgentIsoDateTime, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIsoDateTime, unknown>>>;
|
|
161
228
|
}, z.core.$strict>>;
|
|
229
|
+
export declare function refineAgentElicitationFields(fields: readonly z.output<typeof AgentElicitationFieldSchema>[], context: z.RefinementCtx): void;
|
|
162
230
|
export declare const AgentElicitationRequestSchema: z.ZodType<AgentElicitationRequest>;
|
|
163
231
|
export declare const AgentRequestPortableSchema: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
|
|
164
232
|
requestKind: z.ZodLiteral<"approval">;
|
|
@@ -171,10 +239,10 @@ export declare const AgentRequestPortableSchema: z.ZodDiscriminatedUnion<[z.ZodR
|
|
|
171
239
|
artifactId: z.ZodType<import("../index.js").AgentArtifactId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentArtifactId, unknown>>;
|
|
172
240
|
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
173
241
|
kind: z.ZodEnum<{
|
|
174
|
-
other: "other";
|
|
175
|
-
file_change: "file_change";
|
|
176
242
|
tool: "tool";
|
|
177
243
|
command: "command";
|
|
244
|
+
file_change: "file_change";
|
|
245
|
+
other: "other";
|
|
178
246
|
}>;
|
|
179
247
|
title: z.ZodString;
|
|
180
248
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -192,8 +260,8 @@ export declare const AgentRequestPortableSchema: z.ZodDiscriminatedUnion<[z.ZodR
|
|
|
192
260
|
kind: z.ZodLiteral<"scoped">;
|
|
193
261
|
persistence: z.ZodEnum<{
|
|
194
262
|
session: "session";
|
|
195
|
-
workspace: "workspace";
|
|
196
263
|
once: "once";
|
|
264
|
+
workspace: "workspace";
|
|
197
265
|
}>;
|
|
198
266
|
scope: z.ZodReadonly<z.ZodObject<{
|
|
199
267
|
kind: z.ZodEnum<{
|
|
@@ -291,6 +359,29 @@ export declare const AgentRequestPortableSchema: z.ZodDiscriminatedUnion<[z.ZodR
|
|
|
291
359
|
expiresAt: z.ZodOptional<z.ZodType<import("../index.js").AgentIsoDateTime, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentIsoDateTime, unknown>>>;
|
|
292
360
|
}, z.core.$strict>>], "requestKind">;
|
|
293
361
|
export declare const AgentRequestSchema: z.ZodType<AgentRequest>;
|
|
362
|
+
export declare const AgentElicitationAnswerSchema: z.ZodDiscriminatedUnion<[z.ZodReadonly<z.ZodObject<{
|
|
363
|
+
fieldId: z.ZodType<import("../index.js").AgentRequestFieldId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentRequestFieldId, unknown>>;
|
|
364
|
+
kind: z.ZodLiteral<"text">;
|
|
365
|
+
value: z.ZodString;
|
|
366
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
367
|
+
fieldId: z.ZodType<import("../index.js").AgentRequestFieldId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentRequestFieldId, unknown>>;
|
|
368
|
+
kind: z.ZodLiteral<"single_select">;
|
|
369
|
+
value: z.ZodOptional<z.ZodIntersection<z.ZodString, z.ZodString>>;
|
|
370
|
+
other: z.ZodOptional<z.ZodString>;
|
|
371
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
372
|
+
fieldId: z.ZodType<import("../index.js").AgentRequestFieldId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentRequestFieldId, unknown>>;
|
|
373
|
+
kind: z.ZodLiteral<"multi_select">;
|
|
374
|
+
values: z.ZodReadonly<z.ZodArray<z.ZodIntersection<z.ZodString, z.ZodString>>>;
|
|
375
|
+
other: z.ZodOptional<z.ZodString>;
|
|
376
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
377
|
+
fieldId: z.ZodType<import("../index.js").AgentRequestFieldId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentRequestFieldId, unknown>>;
|
|
378
|
+
kind: z.ZodLiteral<"boolean">;
|
|
379
|
+
value: z.ZodBoolean;
|
|
380
|
+
}, z.core.$strict>>, z.ZodReadonly<z.ZodObject<{
|
|
381
|
+
fieldId: z.ZodType<import("../index.js").AgentRequestFieldId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentRequestFieldId, unknown>>;
|
|
382
|
+
kind: z.ZodLiteral<"confirmation">;
|
|
383
|
+
confirmed: z.ZodBoolean;
|
|
384
|
+
}, z.core.$strict>>], "kind">;
|
|
294
385
|
export declare const AgentApprovalResolutionSchema: z.ZodType<AgentApprovalResolution>;
|
|
295
386
|
export declare const AgentRequestResolutionPortableSchema: z.ZodUnion<readonly [z.ZodType<AgentApprovalResolution, unknown, z.core.$ZodTypeInternals<AgentApprovalResolution, unknown>>, z.ZodReadonly<z.ZodObject<{
|
|
296
387
|
requestKind: z.ZodLiteral<"elicitation">;
|
|
@@ -324,5 +415,6 @@ export declare const AgentRequestResolutionPortableSchema: z.ZodUnion<readonly [
|
|
|
324
415
|
requestId: z.ZodType<import("../index.js").AgentRequestId, unknown, z.core.$ZodTypeInternals<import("../index.js").AgentRequestId, unknown>>;
|
|
325
416
|
disposition: z.ZodLiteral<"canceled">;
|
|
326
417
|
}, z.core.$strict>>]>;
|
|
418
|
+
export declare function refineAgentElicitationAnswers(answers: readonly z.output<typeof AgentElicitationAnswerSchema>[], context: z.RefinementCtx): void;
|
|
327
419
|
export declare const AgentRequestResolutionSchema: z.ZodType<AgentRequestResolution>;
|
|
328
420
|
//# sourceMappingURL=requests.d.ts.map
|
package/dist/zod/requests.js
CHANGED
|
@@ -132,9 +132,9 @@ const AgentElicitationRequestPortableSchema = z.object({
|
|
|
132
132
|
fields: z.array(AgentElicitationFieldSchema).min(1).max(AGENT_ELICITATION_FIELDS_MAX_LENGTH).readonly(),
|
|
133
133
|
expiresAt: AgentIsoDateTimeSchema.optional()
|
|
134
134
|
}).strict().readonly();
|
|
135
|
-
|
|
135
|
+
function refineAgentElicitationFields(fields, context) {
|
|
136
136
|
const fieldIds = /* @__PURE__ */ new Set();
|
|
137
|
-
|
|
137
|
+
fields.forEach((field, fieldIndex) => {
|
|
138
138
|
if (fieldIds.has(field.fieldId)) {
|
|
139
139
|
context.addIssue({
|
|
140
140
|
code: "custom",
|
|
@@ -165,6 +165,9 @@ const AgentElicitationRequestSchema = AgentElicitationRequestPortableSchema.supe
|
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
});
|
|
168
|
+
}
|
|
169
|
+
const AgentElicitationRequestSchema = AgentElicitationRequestPortableSchema.superRefine((request, context) => {
|
|
170
|
+
refineAgentElicitationFields(request.fields, context);
|
|
168
171
|
});
|
|
169
172
|
const AgentRequestPortableSchema = z.discriminatedUnion("requestKind", [
|
|
170
173
|
AgentApprovalRequestPortableSchema,
|
|
@@ -238,11 +241,8 @@ const AgentRequestResolutionPortableSchema = z.union([
|
|
|
238
241
|
disposition: z.literal("canceled")
|
|
239
242
|
}).strict().readonly()
|
|
240
243
|
]);
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
resolution.answers.forEach((answer, answerIndex) => {
|
|
244
|
+
function refineAgentElicitationAnswers(answers, context) {
|
|
245
|
+
answers.forEach((answer, answerIndex) => {
|
|
246
246
|
if (answer.kind === "multi_select" && new Set(answer.values).size !== answer.values.length) {
|
|
247
247
|
context.addIssue({
|
|
248
248
|
code: "custom",
|
|
@@ -258,16 +258,26 @@ const AgentRequestResolutionSchema = AgentRequestResolutionPortableSchema.superR
|
|
|
258
258
|
});
|
|
259
259
|
}
|
|
260
260
|
});
|
|
261
|
+
}
|
|
262
|
+
const AgentRequestResolutionSchema = AgentRequestResolutionPortableSchema.superRefine((resolution, context) => {
|
|
263
|
+
if (resolution.requestKind !== "elicitation" || resolution.disposition !== "answered") {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
refineAgentElicitationAnswers(resolution.answers, context);
|
|
261
267
|
});
|
|
262
268
|
export {
|
|
263
269
|
AgentApprovalConsequenceSchema,
|
|
264
270
|
AgentApprovalRequestPortableSchema,
|
|
265
271
|
AgentApprovalRequestSchema,
|
|
266
272
|
AgentApprovalResolutionSchema,
|
|
273
|
+
AgentElicitationAnswerSchema,
|
|
274
|
+
AgentElicitationFieldSchema,
|
|
267
275
|
AgentElicitationRequestPortableSchema,
|
|
268
276
|
AgentElicitationRequestSchema,
|
|
269
277
|
AgentRequestPortableSchema,
|
|
270
278
|
AgentRequestResolutionPortableSchema,
|
|
271
279
|
AgentRequestResolutionSchema,
|
|
272
|
-
AgentRequestSchema
|
|
280
|
+
AgentRequestSchema,
|
|
281
|
+
refineAgentElicitationAnswers,
|
|
282
|
+
refineAgentElicitationFields
|
|
273
283
|
};
|