@kya-os/contracts 1.5.4-canary.2 → 1.6.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.
- package/dist/agentshield-api/admin-schemas.d.ts +2 -8
- package/dist/agentshield-api/admin-schemas.js +0 -2
- package/dist/agentshield-api/admin-types.d.ts +0 -4
- package/dist/agentshield-api/index.d.ts +1 -1
- package/dist/agentshield-api/schemas.d.ts +150 -48
- package/dist/agentshield-api/schemas.js +32 -4
- package/dist/agentshield-api/types.d.ts +31 -4
- package/dist/audit/index.d.ts +193 -0
- package/dist/audit/index.js +100 -0
- package/dist/config/identity.d.ts +205 -2
- package/dist/config/identity.js +28 -0
- package/dist/config/index.d.ts +2 -1
- package/dist/config/tool-context.d.ts +34 -0
- package/dist/config/tool-context.js +13 -0
- package/dist/consent/schemas.d.ts +101 -4
- package/dist/consent/schemas.js +139 -66
- package/dist/dashboard-config/schemas.d.ts +2248 -992
- package/dist/handshake.d.ts +14 -14
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/tool-protection/index.d.ts +490 -14
- package/dist/tool-protection/index.js +89 -2
- package/dist/verifier/index.d.ts +1 -0
- package/dist/verifier/index.js +18 -0
- package/dist/well-known/index.d.ts +2 -2
- package/package.json +63 -120
|
@@ -28,28 +28,22 @@ export declare const clearCacheResponseSchema: z.ZodObject<{
|
|
|
28
28
|
had_value: z.ZodBoolean;
|
|
29
29
|
had_old_value: z.ZodBoolean;
|
|
30
30
|
cleared: z.ZodBoolean;
|
|
31
|
-
refreshed_immediately: z.ZodOptional<z.ZodBoolean>;
|
|
32
|
-
refresh_error: z.ZodOptional<z.ZodString>;
|
|
33
31
|
}, "strip", z.ZodTypeAny, {
|
|
34
|
-
agent_did: string;
|
|
35
32
|
message: string;
|
|
33
|
+
agent_did: string;
|
|
36
34
|
project_id: string | null;
|
|
37
35
|
cache_key: string;
|
|
38
36
|
old_cache_key: string | null;
|
|
39
37
|
had_value: boolean;
|
|
40
38
|
had_old_value: boolean;
|
|
41
39
|
cleared: boolean;
|
|
42
|
-
refreshed_immediately?: boolean | undefined;
|
|
43
|
-
refresh_error?: string | undefined;
|
|
44
40
|
}, {
|
|
45
|
-
agent_did: string;
|
|
46
41
|
message: string;
|
|
42
|
+
agent_did: string;
|
|
47
43
|
project_id: string | null;
|
|
48
44
|
cache_key: string;
|
|
49
45
|
old_cache_key: string | null;
|
|
50
46
|
had_value: boolean;
|
|
51
47
|
had_old_value: boolean;
|
|
52
48
|
cleared: boolean;
|
|
53
|
-
refreshed_immediately?: boolean | undefined;
|
|
54
|
-
refresh_error?: string | undefined;
|
|
55
49
|
}>;
|
|
@@ -27,6 +27,4 @@ exports.clearCacheResponseSchema = zod_1.z.object({
|
|
|
27
27
|
had_value: zod_1.z.boolean().describe('Whether the cache entry existed before clearing'),
|
|
28
28
|
had_old_value: zod_1.z.boolean().describe('Whether the old cache entry existed before clearing'),
|
|
29
29
|
cleared: zod_1.z.boolean().describe('Whether the cache was successfully cleared'),
|
|
30
|
-
refreshed_immediately: zod_1.z.boolean().optional().describe('Whether cache was immediately refreshed from API after clearing'),
|
|
31
|
-
refresh_error: zod_1.z.string().optional().describe('Error message if immediate refresh failed (non-fatal)'),
|
|
32
30
|
});
|
|
@@ -34,8 +34,4 @@ export interface ClearCacheResponse {
|
|
|
34
34
|
had_old_value: boolean;
|
|
35
35
|
/** Whether the cache was successfully cleared */
|
|
36
36
|
cleared: boolean;
|
|
37
|
-
/** Whether cache was immediately refreshed from API after clearing */
|
|
38
|
-
refreshed_immediately?: boolean;
|
|
39
|
-
/** Error message if immediate refresh failed (non-fatal) */
|
|
40
|
-
refresh_error?: string;
|
|
41
37
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @package @kya-os/contracts/agentshield-api
|
|
8
8
|
*/
|
|
9
|
-
export type { AgentShieldAPIResponse, AgentShieldAPIErrorResponse, ProofSubmissionRequest, ProofSubmissionResponse, ToolCallContext, BouncerOutcome, VerifyDelegationRequest, VerifyDelegationResponse, VerifyDelegationAPIResponse, DelegationCredential, AgentShieldToolProtection, ToolProtectionConfigResponse, ToolProtectionConfigAPIResponse, CreateDelegationRequest, CreateDelegationResponse, CreateDelegationAPIResponse, RevokeDelegationRequest, RevokeDelegationResponse, RevokeDelegationAPIResponse, } from "./types.js";
|
|
9
|
+
export type { AgentShieldAPIResponse, AgentShieldAPIErrorResponse, ProofSubmissionRequest, ProofSubmissionResponse, ToolCallContext, ConsentEventContext, BouncerOutcome, VerifyDelegationRequest, VerifyDelegationResponse, VerifyDelegationAPIResponse, DelegationCredential, AgentShieldToolProtection, ToolProtectionConfigResponse, ToolProtectionConfigAPIResponse, CreateDelegationRequest, CreateDelegationResponse, CreateDelegationAPIResponse, RevokeDelegationRequest, RevokeDelegationResponse, RevokeDelegationAPIResponse, } from "./types.js";
|
|
10
10
|
export { AgentShieldAPIError } from "./types.js";
|
|
11
11
|
export type { AgentShieldAPIHeaders } from "./endpoints.js";
|
|
12
12
|
export type { ClearCacheRequest, ClearCacheResponse } from "./admin-types.js";
|
|
@@ -52,7 +52,7 @@ export declare const agentShieldAPIResponseSchema: <T extends z.ZodTypeAny>(data
|
|
|
52
52
|
timestamp: string;
|
|
53
53
|
requestId: string;
|
|
54
54
|
}>>;
|
|
55
|
-
}>, any> extends infer T_1 ? { [k in keyof T_1]: z.
|
|
55
|
+
}>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
|
|
56
56
|
success: z.ZodBoolean;
|
|
57
57
|
data: T;
|
|
58
58
|
metadata: z.ZodOptional<z.ZodObject<{
|
|
@@ -65,33 +65,7 @@ export declare const agentShieldAPIResponseSchema: <T extends z.ZodTypeAny>(data
|
|
|
65
65
|
timestamp: string;
|
|
66
66
|
requestId: string;
|
|
67
67
|
}>>;
|
|
68
|
-
}
|
|
69
|
-
success: z.ZodBoolean;
|
|
70
|
-
data: T;
|
|
71
|
-
metadata: z.ZodOptional<z.ZodObject<{
|
|
72
|
-
requestId: z.ZodString;
|
|
73
|
-
timestamp: z.ZodString;
|
|
74
|
-
}, "strip", z.ZodTypeAny, {
|
|
75
|
-
timestamp: string;
|
|
76
|
-
requestId: string;
|
|
77
|
-
}, {
|
|
78
|
-
timestamp: string;
|
|
79
|
-
requestId: string;
|
|
80
|
-
}>>;
|
|
81
|
-
}> extends infer T_2 ? { [k_1 in keyof T_2]: z.baseObjectInputType<{
|
|
82
|
-
success: z.ZodBoolean;
|
|
83
|
-
data: T;
|
|
84
|
-
metadata: z.ZodOptional<z.ZodObject<{
|
|
85
|
-
requestId: z.ZodString;
|
|
86
|
-
timestamp: z.ZodString;
|
|
87
|
-
}, "strip", z.ZodTypeAny, {
|
|
88
|
-
timestamp: string;
|
|
89
|
-
requestId: string;
|
|
90
|
-
}, {
|
|
91
|
-
timestamp: string;
|
|
92
|
-
requestId: string;
|
|
93
|
-
}>>;
|
|
94
|
-
}>[k_1]; } : never>;
|
|
68
|
+
}> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
|
|
95
69
|
/**
|
|
96
70
|
* Proof submission request schema
|
|
97
71
|
*/
|
|
@@ -188,6 +162,61 @@ export declare const proofSubmissionRequestSchema: z.ZodObject<{
|
|
|
188
162
|
result?: unknown;
|
|
189
163
|
userIdentifier?: string | undefined;
|
|
190
164
|
}>, "many">>;
|
|
165
|
+
consentEvents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
166
|
+
eventType: z.ZodEnum<["consent:page_viewed", "consent:approved", "consent:delegation_created", "consent:credential_required"]>;
|
|
167
|
+
timestamp: z.ZodNumber;
|
|
168
|
+
sessionId: z.ZodString;
|
|
169
|
+
userDid: z.ZodOptional<z.ZodString>;
|
|
170
|
+
agentDid: z.ZodString;
|
|
171
|
+
targetTools: z.ZodArray<z.ZodString, "many">;
|
|
172
|
+
scopes: z.ZodArray<z.ZodString, "many">;
|
|
173
|
+
delegationId: z.ZodOptional<z.ZodString>;
|
|
174
|
+
projectId: z.ZodString;
|
|
175
|
+
termsAccepted: z.ZodOptional<z.ZodBoolean>;
|
|
176
|
+
credentialStatus: z.ZodOptional<z.ZodEnum<["present", "required", "obtained"]>>;
|
|
177
|
+
oauthIdentity: z.ZodOptional<z.ZodObject<{
|
|
178
|
+
provider: z.ZodString;
|
|
179
|
+
identifier: z.ZodString;
|
|
180
|
+
}, "strip", z.ZodTypeAny, {
|
|
181
|
+
provider: string;
|
|
182
|
+
identifier: string;
|
|
183
|
+
}, {
|
|
184
|
+
provider: string;
|
|
185
|
+
identifier: string;
|
|
186
|
+
}>>;
|
|
187
|
+
}, "strip", z.ZodTypeAny, {
|
|
188
|
+
timestamp: number;
|
|
189
|
+
agentDid: string;
|
|
190
|
+
sessionId: string;
|
|
191
|
+
scopes: string[];
|
|
192
|
+
eventType: "consent:page_viewed" | "consent:approved" | "consent:delegation_created" | "consent:credential_required";
|
|
193
|
+
targetTools: string[];
|
|
194
|
+
projectId: string;
|
|
195
|
+
userDid?: string | undefined;
|
|
196
|
+
credentialStatus?: "required" | "present" | "obtained" | undefined;
|
|
197
|
+
delegationId?: string | undefined;
|
|
198
|
+
termsAccepted?: boolean | undefined;
|
|
199
|
+
oauthIdentity?: {
|
|
200
|
+
provider: string;
|
|
201
|
+
identifier: string;
|
|
202
|
+
} | undefined;
|
|
203
|
+
}, {
|
|
204
|
+
timestamp: number;
|
|
205
|
+
agentDid: string;
|
|
206
|
+
sessionId: string;
|
|
207
|
+
scopes: string[];
|
|
208
|
+
eventType: "consent:page_viewed" | "consent:approved" | "consent:delegation_created" | "consent:credential_required";
|
|
209
|
+
targetTools: string[];
|
|
210
|
+
projectId: string;
|
|
211
|
+
userDid?: string | undefined;
|
|
212
|
+
credentialStatus?: "required" | "present" | "obtained" | undefined;
|
|
213
|
+
delegationId?: string | undefined;
|
|
214
|
+
termsAccepted?: boolean | undefined;
|
|
215
|
+
oauthIdentity?: {
|
|
216
|
+
provider: string;
|
|
217
|
+
identifier: string;
|
|
218
|
+
} | undefined;
|
|
219
|
+
}>, "many">>;
|
|
191
220
|
mcpServerUrl: z.ZodOptional<z.ZodString>;
|
|
192
221
|
}, "strip", z.ZodTypeAny, {
|
|
193
222
|
toolCalls?: {
|
|
@@ -198,6 +227,23 @@ export declare const proofSubmissionRequestSchema: z.ZodObject<{
|
|
|
198
227
|
userIdentifier?: string | undefined;
|
|
199
228
|
}[] | undefined;
|
|
200
229
|
mcpServerUrl?: string | undefined;
|
|
230
|
+
consentEvents?: {
|
|
231
|
+
timestamp: number;
|
|
232
|
+
agentDid: string;
|
|
233
|
+
sessionId: string;
|
|
234
|
+
scopes: string[];
|
|
235
|
+
eventType: "consent:page_viewed" | "consent:approved" | "consent:delegation_created" | "consent:credential_required";
|
|
236
|
+
targetTools: string[];
|
|
237
|
+
projectId: string;
|
|
238
|
+
userDid?: string | undefined;
|
|
239
|
+
credentialStatus?: "required" | "present" | "obtained" | undefined;
|
|
240
|
+
delegationId?: string | undefined;
|
|
241
|
+
termsAccepted?: boolean | undefined;
|
|
242
|
+
oauthIdentity?: {
|
|
243
|
+
provider: string;
|
|
244
|
+
identifier: string;
|
|
245
|
+
} | undefined;
|
|
246
|
+
}[] | undefined;
|
|
201
247
|
}, {
|
|
202
248
|
toolCalls?: {
|
|
203
249
|
scopeId: string;
|
|
@@ -207,6 +253,23 @@ export declare const proofSubmissionRequestSchema: z.ZodObject<{
|
|
|
207
253
|
userIdentifier?: string | undefined;
|
|
208
254
|
}[] | undefined;
|
|
209
255
|
mcpServerUrl?: string | undefined;
|
|
256
|
+
consentEvents?: {
|
|
257
|
+
timestamp: number;
|
|
258
|
+
agentDid: string;
|
|
259
|
+
sessionId: string;
|
|
260
|
+
scopes: string[];
|
|
261
|
+
eventType: "consent:page_viewed" | "consent:approved" | "consent:delegation_created" | "consent:credential_required";
|
|
262
|
+
targetTools: string[];
|
|
263
|
+
projectId: string;
|
|
264
|
+
userDid?: string | undefined;
|
|
265
|
+
credentialStatus?: "required" | "present" | "obtained" | undefined;
|
|
266
|
+
delegationId?: string | undefined;
|
|
267
|
+
termsAccepted?: boolean | undefined;
|
|
268
|
+
oauthIdentity?: {
|
|
269
|
+
provider: string;
|
|
270
|
+
identifier: string;
|
|
271
|
+
} | undefined;
|
|
272
|
+
}[] | undefined;
|
|
210
273
|
}>>;
|
|
211
274
|
}, "strip", z.ZodTypeAny, {
|
|
212
275
|
session_id: string;
|
|
@@ -236,6 +299,23 @@ export declare const proofSubmissionRequestSchema: z.ZodObject<{
|
|
|
236
299
|
userIdentifier?: string | undefined;
|
|
237
300
|
}[] | undefined;
|
|
238
301
|
mcpServerUrl?: string | undefined;
|
|
302
|
+
consentEvents?: {
|
|
303
|
+
timestamp: number;
|
|
304
|
+
agentDid: string;
|
|
305
|
+
sessionId: string;
|
|
306
|
+
scopes: string[];
|
|
307
|
+
eventType: "consent:page_viewed" | "consent:approved" | "consent:delegation_created" | "consent:credential_required";
|
|
308
|
+
targetTools: string[];
|
|
309
|
+
projectId: string;
|
|
310
|
+
userDid?: string | undefined;
|
|
311
|
+
credentialStatus?: "required" | "present" | "obtained" | undefined;
|
|
312
|
+
delegationId?: string | undefined;
|
|
313
|
+
termsAccepted?: boolean | undefined;
|
|
314
|
+
oauthIdentity?: {
|
|
315
|
+
provider: string;
|
|
316
|
+
identifier: string;
|
|
317
|
+
} | undefined;
|
|
318
|
+
}[] | undefined;
|
|
239
319
|
} | undefined;
|
|
240
320
|
}, {
|
|
241
321
|
session_id: string;
|
|
@@ -265,6 +345,23 @@ export declare const proofSubmissionRequestSchema: z.ZodObject<{
|
|
|
265
345
|
userIdentifier?: string | undefined;
|
|
266
346
|
}[] | undefined;
|
|
267
347
|
mcpServerUrl?: string | undefined;
|
|
348
|
+
consentEvents?: {
|
|
349
|
+
timestamp: number;
|
|
350
|
+
agentDid: string;
|
|
351
|
+
sessionId: string;
|
|
352
|
+
scopes: string[];
|
|
353
|
+
eventType: "consent:page_viewed" | "consent:approved" | "consent:delegation_created" | "consent:credential_required";
|
|
354
|
+
targetTools: string[];
|
|
355
|
+
projectId: string;
|
|
356
|
+
userDid?: string | undefined;
|
|
357
|
+
credentialStatus?: "required" | "present" | "obtained" | undefined;
|
|
358
|
+
delegationId?: string | undefined;
|
|
359
|
+
termsAccepted?: boolean | undefined;
|
|
360
|
+
oauthIdentity?: {
|
|
361
|
+
provider: string;
|
|
362
|
+
identifier: string;
|
|
363
|
+
} | undefined;
|
|
364
|
+
}[] | undefined;
|
|
268
365
|
} | undefined;
|
|
269
366
|
}>;
|
|
270
367
|
/**
|
|
@@ -274,7 +371,7 @@ export declare const proofSubmissionResponseSchema: z.ZodObject<{
|
|
|
274
371
|
success: z.ZodBoolean;
|
|
275
372
|
accepted: z.ZodNumber;
|
|
276
373
|
rejected: z.ZodNumber;
|
|
277
|
-
outcomes: z.ZodRecord<z.ZodString, z.ZodNumber
|
|
374
|
+
outcomes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
278
375
|
errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
279
376
|
proof_index: z.ZodNumber;
|
|
280
377
|
error: z.ZodObject<{
|
|
@@ -309,7 +406,6 @@ export declare const proofSubmissionResponseSchema: z.ZodObject<{
|
|
|
309
406
|
success: boolean;
|
|
310
407
|
accepted: number;
|
|
311
408
|
rejected: number;
|
|
312
|
-
outcomes: Record<string, number>;
|
|
313
409
|
errors?: {
|
|
314
410
|
error: {
|
|
315
411
|
code: string;
|
|
@@ -318,11 +414,11 @@ export declare const proofSubmissionResponseSchema: z.ZodObject<{
|
|
|
318
414
|
};
|
|
319
415
|
proof_index: number;
|
|
320
416
|
}[] | undefined;
|
|
417
|
+
outcomes?: Record<string, number> | undefined;
|
|
321
418
|
}, {
|
|
322
419
|
success: boolean;
|
|
323
420
|
accepted: number;
|
|
324
421
|
rejected: number;
|
|
325
|
-
outcomes: Record<string, number>;
|
|
326
422
|
errors?: {
|
|
327
423
|
error: {
|
|
328
424
|
code: string;
|
|
@@ -331,6 +427,7 @@ export declare const proofSubmissionResponseSchema: z.ZodObject<{
|
|
|
331
427
|
};
|
|
332
428
|
proof_index: number;
|
|
333
429
|
}[] | undefined;
|
|
430
|
+
outcomes?: Record<string, number> | undefined;
|
|
334
431
|
}>;
|
|
335
432
|
/**
|
|
336
433
|
* Delegation credential schema
|
|
@@ -5787,7 +5884,7 @@ export declare const toolProtectionConfigAPIResponseSchema: z.ZodObject<{
|
|
|
5787
5884
|
* Create delegation request schema
|
|
5788
5885
|
*
|
|
5789
5886
|
* Note: AgentShield API accepts a simplified format, not the full DelegationRecord.
|
|
5790
|
-
* The API accepts: agent_did, scopes, expires_in_days, expires_at, session_id, project_id, custom_fields
|
|
5887
|
+
* The API accepts: agent_did, scopes, expires_in_days, expires_at, session_id, project_id, user_identifier, custom_fields
|
|
5791
5888
|
*
|
|
5792
5889
|
* IMPORTANT: expires_in_days and expires_at are mutually exclusive - use one or the other, not both.
|
|
5793
5890
|
*/
|
|
@@ -5798,6 +5895,7 @@ export declare const createDelegationRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
5798
5895
|
expires_at: z.ZodOptional<z.ZodString>;
|
|
5799
5896
|
session_id: z.ZodOptional<z.ZodString>;
|
|
5800
5897
|
project_id: z.ZodOptional<z.ZodString>;
|
|
5898
|
+
user_identifier: z.ZodOptional<z.ZodString>;
|
|
5801
5899
|
custom_fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
5802
5900
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
5803
5901
|
agent_did: z.ZodString;
|
|
@@ -5806,6 +5904,7 @@ export declare const createDelegationRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
5806
5904
|
expires_at: z.ZodOptional<z.ZodString>;
|
|
5807
5905
|
session_id: z.ZodOptional<z.ZodString>;
|
|
5808
5906
|
project_id: z.ZodOptional<z.ZodString>;
|
|
5907
|
+
user_identifier: z.ZodOptional<z.ZodString>;
|
|
5809
5908
|
custom_fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
5810
5909
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
5811
5910
|
agent_did: z.ZodString;
|
|
@@ -5814,6 +5913,7 @@ export declare const createDelegationRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
5814
5913
|
expires_at: z.ZodOptional<z.ZodString>;
|
|
5815
5914
|
session_id: z.ZodOptional<z.ZodString>;
|
|
5816
5915
|
project_id: z.ZodOptional<z.ZodString>;
|
|
5916
|
+
user_identifier: z.ZodOptional<z.ZodString>;
|
|
5817
5917
|
custom_fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
5818
5918
|
}, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
|
|
5819
5919
|
agent_did: z.ZodString;
|
|
@@ -5822,6 +5922,7 @@ export declare const createDelegationRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
5822
5922
|
expires_at: z.ZodOptional<z.ZodString>;
|
|
5823
5923
|
session_id: z.ZodOptional<z.ZodString>;
|
|
5824
5924
|
project_id: z.ZodOptional<z.ZodString>;
|
|
5925
|
+
user_identifier: z.ZodOptional<z.ZodString>;
|
|
5825
5926
|
custom_fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
5826
5927
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
5827
5928
|
agent_did: z.ZodString;
|
|
@@ -5830,6 +5931,7 @@ export declare const createDelegationRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
5830
5931
|
expires_at: z.ZodOptional<z.ZodString>;
|
|
5831
5932
|
session_id: z.ZodOptional<z.ZodString>;
|
|
5832
5933
|
project_id: z.ZodOptional<z.ZodString>;
|
|
5934
|
+
user_identifier: z.ZodOptional<z.ZodString>;
|
|
5833
5935
|
custom_fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
5834
5936
|
}, z.ZodTypeAny, "passthrough">>;
|
|
5835
5937
|
/**
|
|
@@ -5847,12 +5949,12 @@ export declare const createDelegationResponseSchema: z.ZodObject<{
|
|
|
5847
5949
|
user_id: z.ZodOptional<z.ZodString>;
|
|
5848
5950
|
user_identifier: z.ZodOptional<z.ZodString>;
|
|
5849
5951
|
scopes: z.ZodArray<z.ZodString, "many">;
|
|
5850
|
-
status: z.
|
|
5952
|
+
status: z.ZodEnum<["active", "expired", "revoked"]>;
|
|
5851
5953
|
issued_at: z.ZodString;
|
|
5852
|
-
expires_at: z.ZodOptional<z.ZodString
|
|
5954
|
+
expires_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
5853
5955
|
created_at: z.ZodString;
|
|
5854
5956
|
}, "strip", z.ZodTypeAny, {
|
|
5855
|
-
status: "active";
|
|
5957
|
+
status: "active" | "revoked" | "expired";
|
|
5856
5958
|
delegation_id: string;
|
|
5857
5959
|
scopes: string[];
|
|
5858
5960
|
agent_did: string;
|
|
@@ -5860,9 +5962,9 @@ export declare const createDelegationResponseSchema: z.ZodObject<{
|
|
|
5860
5962
|
created_at: string;
|
|
5861
5963
|
user_id?: string | undefined;
|
|
5862
5964
|
user_identifier?: string | undefined;
|
|
5863
|
-
expires_at?: string | undefined;
|
|
5965
|
+
expires_at?: string | null | undefined;
|
|
5864
5966
|
}, {
|
|
5865
|
-
status: "active";
|
|
5967
|
+
status: "active" | "revoked" | "expired";
|
|
5866
5968
|
delegation_id: string;
|
|
5867
5969
|
scopes: string[];
|
|
5868
5970
|
agent_did: string;
|
|
@@ -5870,7 +5972,7 @@ export declare const createDelegationResponseSchema: z.ZodObject<{
|
|
|
5870
5972
|
created_at: string;
|
|
5871
5973
|
user_id?: string | undefined;
|
|
5872
5974
|
user_identifier?: string | undefined;
|
|
5873
|
-
expires_at?: string | undefined;
|
|
5975
|
+
expires_at?: string | null | undefined;
|
|
5874
5976
|
}>;
|
|
5875
5977
|
/**
|
|
5876
5978
|
* Wrapped creation response schema
|
|
@@ -5883,12 +5985,12 @@ export declare const createDelegationAPIResponseSchema: z.ZodObject<{
|
|
|
5883
5985
|
user_id: z.ZodOptional<z.ZodString>;
|
|
5884
5986
|
user_identifier: z.ZodOptional<z.ZodString>;
|
|
5885
5987
|
scopes: z.ZodArray<z.ZodString, "many">;
|
|
5886
|
-
status: z.
|
|
5988
|
+
status: z.ZodEnum<["active", "expired", "revoked"]>;
|
|
5887
5989
|
issued_at: z.ZodString;
|
|
5888
|
-
expires_at: z.ZodOptional<z.ZodString
|
|
5990
|
+
expires_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
5889
5991
|
created_at: z.ZodString;
|
|
5890
5992
|
}, "strip", z.ZodTypeAny, {
|
|
5891
|
-
status: "active";
|
|
5993
|
+
status: "active" | "revoked" | "expired";
|
|
5892
5994
|
delegation_id: string;
|
|
5893
5995
|
scopes: string[];
|
|
5894
5996
|
agent_did: string;
|
|
@@ -5896,9 +5998,9 @@ export declare const createDelegationAPIResponseSchema: z.ZodObject<{
|
|
|
5896
5998
|
created_at: string;
|
|
5897
5999
|
user_id?: string | undefined;
|
|
5898
6000
|
user_identifier?: string | undefined;
|
|
5899
|
-
expires_at?: string | undefined;
|
|
6001
|
+
expires_at?: string | null | undefined;
|
|
5900
6002
|
}, {
|
|
5901
|
-
status: "active";
|
|
6003
|
+
status: "active" | "revoked" | "expired";
|
|
5902
6004
|
delegation_id: string;
|
|
5903
6005
|
scopes: string[];
|
|
5904
6006
|
agent_did: string;
|
|
@@ -5906,7 +6008,7 @@ export declare const createDelegationAPIResponseSchema: z.ZodObject<{
|
|
|
5906
6008
|
created_at: string;
|
|
5907
6009
|
user_id?: string | undefined;
|
|
5908
6010
|
user_identifier?: string | undefined;
|
|
5909
|
-
expires_at?: string | undefined;
|
|
6011
|
+
expires_at?: string | null | undefined;
|
|
5910
6012
|
}>;
|
|
5911
6013
|
metadata: z.ZodOptional<z.ZodObject<{
|
|
5912
6014
|
requestId: z.ZodString;
|
|
@@ -5921,7 +6023,7 @@ export declare const createDelegationAPIResponseSchema: z.ZodObject<{
|
|
|
5921
6023
|
}, "strip", z.ZodTypeAny, {
|
|
5922
6024
|
success: boolean;
|
|
5923
6025
|
data: {
|
|
5924
|
-
status: "active";
|
|
6026
|
+
status: "active" | "revoked" | "expired";
|
|
5925
6027
|
delegation_id: string;
|
|
5926
6028
|
scopes: string[];
|
|
5927
6029
|
agent_did: string;
|
|
@@ -5929,7 +6031,7 @@ export declare const createDelegationAPIResponseSchema: z.ZodObject<{
|
|
|
5929
6031
|
created_at: string;
|
|
5930
6032
|
user_id?: string | undefined;
|
|
5931
6033
|
user_identifier?: string | undefined;
|
|
5932
|
-
expires_at?: string | undefined;
|
|
6034
|
+
expires_at?: string | null | undefined;
|
|
5933
6035
|
};
|
|
5934
6036
|
metadata?: {
|
|
5935
6037
|
timestamp: string;
|
|
@@ -5938,7 +6040,7 @@ export declare const createDelegationAPIResponseSchema: z.ZodObject<{
|
|
|
5938
6040
|
}, {
|
|
5939
6041
|
success: boolean;
|
|
5940
6042
|
data: {
|
|
5941
|
-
status: "active";
|
|
6043
|
+
status: "active" | "revoked" | "expired";
|
|
5942
6044
|
delegation_id: string;
|
|
5943
6045
|
scopes: string[];
|
|
5944
6046
|
agent_did: string;
|
|
@@ -5946,7 +6048,7 @@ export declare const createDelegationAPIResponseSchema: z.ZodObject<{
|
|
|
5946
6048
|
created_at: string;
|
|
5947
6049
|
user_id?: string | undefined;
|
|
5948
6050
|
user_identifier?: string | undefined;
|
|
5949
|
-
expires_at?: string | undefined;
|
|
6051
|
+
expires_at?: string | null | undefined;
|
|
5950
6052
|
};
|
|
5951
6053
|
metadata?: {
|
|
5952
6054
|
timestamp: string;
|
|
@@ -48,6 +48,32 @@ const toolCallContextSchema = zod_1.z.object({
|
|
|
48
48
|
scopeId: zod_1.z.string().min(1, "scopeId is required to link context to proof"),
|
|
49
49
|
userIdentifier: zod_1.z.string().optional(),
|
|
50
50
|
});
|
|
51
|
+
/**
|
|
52
|
+
* Consent Event Context Schema
|
|
53
|
+
* Represents consent-related events for audit tracking
|
|
54
|
+
*/
|
|
55
|
+
const consentEventContextSchema = zod_1.z.object({
|
|
56
|
+
eventType: zod_1.z.enum([
|
|
57
|
+
"consent:page_viewed",
|
|
58
|
+
"consent:approved",
|
|
59
|
+
"consent:delegation_created",
|
|
60
|
+
"consent:credential_required"
|
|
61
|
+
]),
|
|
62
|
+
timestamp: zod_1.z.number().int().positive(),
|
|
63
|
+
sessionId: zod_1.z.string().min(1),
|
|
64
|
+
userDid: zod_1.z.string().optional(),
|
|
65
|
+
agentDid: zod_1.z.string().min(1),
|
|
66
|
+
targetTools: zod_1.z.array(zod_1.z.string()).min(1), // ALWAYS array
|
|
67
|
+
scopes: zod_1.z.array(zod_1.z.string()).min(0),
|
|
68
|
+
delegationId: zod_1.z.string().uuid().optional(),
|
|
69
|
+
projectId: zod_1.z.string().uuid(),
|
|
70
|
+
termsAccepted: zod_1.z.boolean().optional(),
|
|
71
|
+
credentialStatus: zod_1.z.enum(["present", "required", "obtained"]).optional(),
|
|
72
|
+
oauthIdentity: zod_1.z.object({
|
|
73
|
+
provider: zod_1.z.string(),
|
|
74
|
+
identifier: zod_1.z.string(),
|
|
75
|
+
}).optional(),
|
|
76
|
+
});
|
|
51
77
|
/**
|
|
52
78
|
* Proof submission request schema
|
|
53
79
|
*/
|
|
@@ -59,6 +85,7 @@ exports.proofSubmissionRequestSchema = zod_1.z.object({
|
|
|
59
85
|
context: zod_1.z
|
|
60
86
|
.object({
|
|
61
87
|
toolCalls: zod_1.z.array(toolCallContextSchema).optional(),
|
|
88
|
+
consentEvents: zod_1.z.array(consentEventContextSchema).optional(), // NEW: Consent events for audit tracking
|
|
62
89
|
mcpServerUrl: zod_1.z.string().url().optional(), // MCP server URL for tool discovery
|
|
63
90
|
})
|
|
64
91
|
.optional(),
|
|
@@ -70,7 +97,7 @@ exports.proofSubmissionResponseSchema = zod_1.z.object({
|
|
|
70
97
|
success: zod_1.z.boolean(),
|
|
71
98
|
accepted: zod_1.z.number().int().min(0),
|
|
72
99
|
rejected: zod_1.z.number().int().min(0),
|
|
73
|
-
outcomes: zod_1.z.record(zod_1.z.string(), zod_1.z.number().int().min(0)), // Record<BouncerOutcome, number>
|
|
100
|
+
outcomes: zod_1.z.record(zod_1.z.string(), zod_1.z.number().int().min(0)).optional(), // Record<BouncerOutcome, number> - Optional because API may return empty object or omit it
|
|
74
101
|
errors: zod_1.z
|
|
75
102
|
.array(zod_1.z.object({
|
|
76
103
|
proof_index: zod_1.z.number().int().min(0),
|
|
@@ -172,7 +199,7 @@ exports.toolProtectionConfigAPIResponseSchema = (0, exports.agentShieldAPIRespon
|
|
|
172
199
|
* Create delegation request schema
|
|
173
200
|
*
|
|
174
201
|
* Note: AgentShield API accepts a simplified format, not the full DelegationRecord.
|
|
175
|
-
* The API accepts: agent_did, scopes, expires_in_days, expires_at, session_id, project_id, custom_fields
|
|
202
|
+
* The API accepts: agent_did, scopes, expires_in_days, expires_at, session_id, project_id, user_identifier, custom_fields
|
|
176
203
|
*
|
|
177
204
|
* IMPORTANT: expires_in_days and expires_at are mutually exclusive - use one or the other, not both.
|
|
178
205
|
*/
|
|
@@ -184,6 +211,7 @@ exports.createDelegationRequestSchema = zod_1.z
|
|
|
184
211
|
expires_at: zod_1.z.string().datetime().optional(),
|
|
185
212
|
session_id: zod_1.z.string().optional(),
|
|
186
213
|
project_id: zod_1.z.string().uuid().optional(),
|
|
214
|
+
user_identifier: zod_1.z.string().max(200).optional(), // Matches AgentShield's max(200)
|
|
187
215
|
custom_fields: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
188
216
|
})
|
|
189
217
|
.passthrough()
|
|
@@ -211,9 +239,9 @@ exports.createDelegationResponseSchema = zod_1.z.object({
|
|
|
211
239
|
user_id: zod_1.z.string().optional(),
|
|
212
240
|
user_identifier: zod_1.z.string().optional(),
|
|
213
241
|
scopes: zod_1.z.array(zod_1.z.string()),
|
|
214
|
-
status: zod_1.z.
|
|
242
|
+
status: zod_1.z.enum(['active', 'expired', 'revoked']), // Matches AgentShield's actual API behavior
|
|
215
243
|
issued_at: zod_1.z.string().datetime(),
|
|
216
|
-
expires_at: zod_1.z.string().datetime().optional(),
|
|
244
|
+
expires_at: zod_1.z.string().datetime().nullable().optional(), // AgentShield allows null values
|
|
217
245
|
created_at: zod_1.z.string().datetime(),
|
|
218
246
|
});
|
|
219
247
|
/**
|
|
@@ -41,6 +41,30 @@ export interface ToolCallContext {
|
|
|
41
41
|
scopeId: string;
|
|
42
42
|
userIdentifier?: string;
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Consent Event Context
|
|
46
|
+
*
|
|
47
|
+
* Represents consent-related events that occur during the consent flow.
|
|
48
|
+
* These events are logged separately from tool executions and allow
|
|
49
|
+
* multiple events per session (unlike regular audit logs).
|
|
50
|
+
*/
|
|
51
|
+
export interface ConsentEventContext {
|
|
52
|
+
eventType: "consent:page_viewed" | "consent:approved" | "consent:delegation_created" | "consent:credential_required";
|
|
53
|
+
timestamp: number;
|
|
54
|
+
sessionId: string;
|
|
55
|
+
userDid?: string;
|
|
56
|
+
agentDid: string;
|
|
57
|
+
targetTools: string[];
|
|
58
|
+
scopes: string[];
|
|
59
|
+
delegationId?: string;
|
|
60
|
+
projectId: string;
|
|
61
|
+
termsAccepted?: boolean;
|
|
62
|
+
credentialStatus?: "present" | "required" | "obtained";
|
|
63
|
+
oauthIdentity?: {
|
|
64
|
+
provider: string;
|
|
65
|
+
identifier: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
44
68
|
/**
|
|
45
69
|
* Request body for proof submission endpoint
|
|
46
70
|
* POST /api/v1/bouncer/proofs
|
|
@@ -55,6 +79,7 @@ export interface ProofSubmissionRequest {
|
|
|
55
79
|
/** AgentShield extension: Optional context for dashboard enrichment */
|
|
56
80
|
context?: {
|
|
57
81
|
toolCalls?: ToolCallContext[];
|
|
82
|
+
consentEvents?: ConsentEventContext[];
|
|
58
83
|
mcpServerUrl?: string;
|
|
59
84
|
};
|
|
60
85
|
}
|
|
@@ -69,7 +94,7 @@ export interface ProofSubmissionResponse {
|
|
|
69
94
|
success: boolean;
|
|
70
95
|
accepted: number;
|
|
71
96
|
rejected: number;
|
|
72
|
-
outcomes
|
|
97
|
+
outcomes?: Record<BouncerOutcome, number>;
|
|
73
98
|
errors?: Array<{
|
|
74
99
|
proof_index: number;
|
|
75
100
|
error: {
|
|
@@ -163,7 +188,7 @@ export type ToolProtectionConfigAPIResponse = AgentShieldAPIResponse<ToolProtect
|
|
|
163
188
|
* POST /api/v1/bouncer/delegations
|
|
164
189
|
*
|
|
165
190
|
* Note: AgentShield API accepts a simplified format, not the full DelegationRecord.
|
|
166
|
-
* The API accepts: agent_did, scopes, expires_in_days, expires_at, session_id, project_id, custom_fields
|
|
191
|
+
* The API accepts: agent_did, scopes, expires_in_days, expires_at, session_id, project_id, user_identifier, custom_fields
|
|
167
192
|
*
|
|
168
193
|
* IMPORTANT: expires_in_days and expires_at are mutually exclusive - use one or the other, not both.
|
|
169
194
|
*/
|
|
@@ -176,6 +201,8 @@ export interface CreateDelegationRequest {
|
|
|
176
201
|
expires_at?: string;
|
|
177
202
|
session_id?: string;
|
|
178
203
|
project_id?: string;
|
|
204
|
+
/** User identifier string, max 200 chars, optional */
|
|
205
|
+
user_identifier?: string;
|
|
179
206
|
custom_fields?: Record<string, unknown>;
|
|
180
207
|
}
|
|
181
208
|
/**
|
|
@@ -193,9 +220,9 @@ export interface CreateDelegationResponse {
|
|
|
193
220
|
user_id?: string;
|
|
194
221
|
user_identifier?: string;
|
|
195
222
|
scopes: string[];
|
|
196
|
-
status: "active";
|
|
223
|
+
status: "active" | "expired" | "revoked";
|
|
197
224
|
issued_at: string;
|
|
198
|
-
expires_at?: string;
|
|
225
|
+
expires_at?: string | null;
|
|
199
226
|
created_at: string;
|
|
200
227
|
}
|
|
201
228
|
/**
|