@kya-os/contracts 1.6.0 → 1.6.2-canary.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/schemas.d.ts +48 -27
- package/dist/agentshield-api/schemas.js +4 -5
- package/dist/agentshield-api/types.d.ts +4 -6
- package/dist/config/identity.d.ts +2 -205
- package/dist/config/identity.js +0 -28
- package/dist/config/index.d.ts +1 -2
- package/dist/consent/schemas.d.ts +76 -171
- package/dist/consent/schemas.js +1 -39
- package/dist/dashboard-config/schemas.d.ts +1351 -2607
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -2
- package/dist/tool-protection/index.d.ts +14 -490
- package/dist/tool-protection/index.js +2 -89
- package/package.json +120 -63
- package/dist/audit/index.d.ts +0 -193
- package/dist/audit/index.js +0 -100
- package/dist/config/tool-context.d.ts +0 -34
- package/dist/config/tool-context.js +0 -13
- package/dist/verifier/index.d.ts +0 -1
- package/dist/verifier/index.js +0 -18
|
@@ -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]:
|
|
55
|
+
}>, any> extends infer T_1 ? { [k in keyof T_1]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
|
|
56
56
|
success: z.ZodBoolean;
|
|
57
57
|
data: T;
|
|
58
58
|
metadata: z.ZodOptional<z.ZodObject<{
|
|
@@ -65,7 +65,33 @@ export declare const agentShieldAPIResponseSchema: <T extends z.ZodTypeAny>(data
|
|
|
65
65
|
timestamp: string;
|
|
66
66
|
requestId: string;
|
|
67
67
|
}>>;
|
|
68
|
-
}>
|
|
68
|
+
}>, any>[k]; } : never, z.baseObjectInputType<{
|
|
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>;
|
|
69
95
|
/**
|
|
70
96
|
* Proof submission request schema
|
|
71
97
|
*/
|
|
@@ -371,7 +397,7 @@ export declare const proofSubmissionResponseSchema: z.ZodObject<{
|
|
|
371
397
|
success: z.ZodBoolean;
|
|
372
398
|
accepted: z.ZodNumber;
|
|
373
399
|
rejected: z.ZodNumber;
|
|
374
|
-
outcomes: z.
|
|
400
|
+
outcomes: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
375
401
|
errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
376
402
|
proof_index: z.ZodNumber;
|
|
377
403
|
error: z.ZodObject<{
|
|
@@ -406,6 +432,7 @@ export declare const proofSubmissionResponseSchema: z.ZodObject<{
|
|
|
406
432
|
success: boolean;
|
|
407
433
|
accepted: number;
|
|
408
434
|
rejected: number;
|
|
435
|
+
outcomes: Record<string, number>;
|
|
409
436
|
errors?: {
|
|
410
437
|
error: {
|
|
411
438
|
code: string;
|
|
@@ -414,11 +441,11 @@ export declare const proofSubmissionResponseSchema: z.ZodObject<{
|
|
|
414
441
|
};
|
|
415
442
|
proof_index: number;
|
|
416
443
|
}[] | undefined;
|
|
417
|
-
outcomes?: Record<string, number> | undefined;
|
|
418
444
|
}, {
|
|
419
445
|
success: boolean;
|
|
420
446
|
accepted: number;
|
|
421
447
|
rejected: number;
|
|
448
|
+
outcomes: Record<string, number>;
|
|
422
449
|
errors?: {
|
|
423
450
|
error: {
|
|
424
451
|
code: string;
|
|
@@ -427,7 +454,6 @@ export declare const proofSubmissionResponseSchema: z.ZodObject<{
|
|
|
427
454
|
};
|
|
428
455
|
proof_index: number;
|
|
429
456
|
}[] | undefined;
|
|
430
|
-
outcomes?: Record<string, number> | undefined;
|
|
431
457
|
}>;
|
|
432
458
|
/**
|
|
433
459
|
* Delegation credential schema
|
|
@@ -5884,7 +5910,7 @@ export declare const toolProtectionConfigAPIResponseSchema: z.ZodObject<{
|
|
|
5884
5910
|
* Create delegation request schema
|
|
5885
5911
|
*
|
|
5886
5912
|
* Note: AgentShield API accepts a simplified format, not the full DelegationRecord.
|
|
5887
|
-
* The API accepts: agent_did, scopes, expires_in_days, expires_at, session_id, project_id,
|
|
5913
|
+
* The API accepts: agent_did, scopes, expires_in_days, expires_at, session_id, project_id, custom_fields
|
|
5888
5914
|
*
|
|
5889
5915
|
* IMPORTANT: expires_in_days and expires_at are mutually exclusive - use one or the other, not both.
|
|
5890
5916
|
*/
|
|
@@ -5895,7 +5921,6 @@ export declare const createDelegationRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
5895
5921
|
expires_at: z.ZodOptional<z.ZodString>;
|
|
5896
5922
|
session_id: z.ZodOptional<z.ZodString>;
|
|
5897
5923
|
project_id: z.ZodOptional<z.ZodString>;
|
|
5898
|
-
user_identifier: z.ZodOptional<z.ZodString>;
|
|
5899
5924
|
custom_fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
5900
5925
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
5901
5926
|
agent_did: z.ZodString;
|
|
@@ -5904,7 +5929,6 @@ export declare const createDelegationRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
5904
5929
|
expires_at: z.ZodOptional<z.ZodString>;
|
|
5905
5930
|
session_id: z.ZodOptional<z.ZodString>;
|
|
5906
5931
|
project_id: z.ZodOptional<z.ZodString>;
|
|
5907
|
-
user_identifier: z.ZodOptional<z.ZodString>;
|
|
5908
5932
|
custom_fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
5909
5933
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
5910
5934
|
agent_did: z.ZodString;
|
|
@@ -5913,7 +5937,6 @@ export declare const createDelegationRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
5913
5937
|
expires_at: z.ZodOptional<z.ZodString>;
|
|
5914
5938
|
session_id: z.ZodOptional<z.ZodString>;
|
|
5915
5939
|
project_id: z.ZodOptional<z.ZodString>;
|
|
5916
|
-
user_identifier: z.ZodOptional<z.ZodString>;
|
|
5917
5940
|
custom_fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
5918
5941
|
}, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
|
|
5919
5942
|
agent_did: z.ZodString;
|
|
@@ -5922,7 +5945,6 @@ export declare const createDelegationRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
5922
5945
|
expires_at: z.ZodOptional<z.ZodString>;
|
|
5923
5946
|
session_id: z.ZodOptional<z.ZodString>;
|
|
5924
5947
|
project_id: z.ZodOptional<z.ZodString>;
|
|
5925
|
-
user_identifier: z.ZodOptional<z.ZodString>;
|
|
5926
5948
|
custom_fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
5927
5949
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
5928
5950
|
agent_did: z.ZodString;
|
|
@@ -5931,7 +5953,6 @@ export declare const createDelegationRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
5931
5953
|
expires_at: z.ZodOptional<z.ZodString>;
|
|
5932
5954
|
session_id: z.ZodOptional<z.ZodString>;
|
|
5933
5955
|
project_id: z.ZodOptional<z.ZodString>;
|
|
5934
|
-
user_identifier: z.ZodOptional<z.ZodString>;
|
|
5935
5956
|
custom_fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
5936
5957
|
}, z.ZodTypeAny, "passthrough">>;
|
|
5937
5958
|
/**
|
|
@@ -5949,12 +5970,12 @@ export declare const createDelegationResponseSchema: z.ZodObject<{
|
|
|
5949
5970
|
user_id: z.ZodOptional<z.ZodString>;
|
|
5950
5971
|
user_identifier: z.ZodOptional<z.ZodString>;
|
|
5951
5972
|
scopes: z.ZodArray<z.ZodString, "many">;
|
|
5952
|
-
status: z.
|
|
5973
|
+
status: z.ZodLiteral<"active">;
|
|
5953
5974
|
issued_at: z.ZodString;
|
|
5954
|
-
expires_at: z.ZodOptional<z.
|
|
5975
|
+
expires_at: z.ZodOptional<z.ZodString>;
|
|
5955
5976
|
created_at: z.ZodString;
|
|
5956
5977
|
}, "strip", z.ZodTypeAny, {
|
|
5957
|
-
status: "active"
|
|
5978
|
+
status: "active";
|
|
5958
5979
|
delegation_id: string;
|
|
5959
5980
|
scopes: string[];
|
|
5960
5981
|
agent_did: string;
|
|
@@ -5962,9 +5983,9 @@ export declare const createDelegationResponseSchema: z.ZodObject<{
|
|
|
5962
5983
|
created_at: string;
|
|
5963
5984
|
user_id?: string | undefined;
|
|
5964
5985
|
user_identifier?: string | undefined;
|
|
5965
|
-
expires_at?: string |
|
|
5986
|
+
expires_at?: string | undefined;
|
|
5966
5987
|
}, {
|
|
5967
|
-
status: "active"
|
|
5988
|
+
status: "active";
|
|
5968
5989
|
delegation_id: string;
|
|
5969
5990
|
scopes: string[];
|
|
5970
5991
|
agent_did: string;
|
|
@@ -5972,7 +5993,7 @@ export declare const createDelegationResponseSchema: z.ZodObject<{
|
|
|
5972
5993
|
created_at: string;
|
|
5973
5994
|
user_id?: string | undefined;
|
|
5974
5995
|
user_identifier?: string | undefined;
|
|
5975
|
-
expires_at?: string |
|
|
5996
|
+
expires_at?: string | undefined;
|
|
5976
5997
|
}>;
|
|
5977
5998
|
/**
|
|
5978
5999
|
* Wrapped creation response schema
|
|
@@ -5985,12 +6006,12 @@ export declare const createDelegationAPIResponseSchema: z.ZodObject<{
|
|
|
5985
6006
|
user_id: z.ZodOptional<z.ZodString>;
|
|
5986
6007
|
user_identifier: z.ZodOptional<z.ZodString>;
|
|
5987
6008
|
scopes: z.ZodArray<z.ZodString, "many">;
|
|
5988
|
-
status: z.
|
|
6009
|
+
status: z.ZodLiteral<"active">;
|
|
5989
6010
|
issued_at: z.ZodString;
|
|
5990
|
-
expires_at: z.ZodOptional<z.
|
|
6011
|
+
expires_at: z.ZodOptional<z.ZodString>;
|
|
5991
6012
|
created_at: z.ZodString;
|
|
5992
6013
|
}, "strip", z.ZodTypeAny, {
|
|
5993
|
-
status: "active"
|
|
6014
|
+
status: "active";
|
|
5994
6015
|
delegation_id: string;
|
|
5995
6016
|
scopes: string[];
|
|
5996
6017
|
agent_did: string;
|
|
@@ -5998,9 +6019,9 @@ export declare const createDelegationAPIResponseSchema: z.ZodObject<{
|
|
|
5998
6019
|
created_at: string;
|
|
5999
6020
|
user_id?: string | undefined;
|
|
6000
6021
|
user_identifier?: string | undefined;
|
|
6001
|
-
expires_at?: string |
|
|
6022
|
+
expires_at?: string | undefined;
|
|
6002
6023
|
}, {
|
|
6003
|
-
status: "active"
|
|
6024
|
+
status: "active";
|
|
6004
6025
|
delegation_id: string;
|
|
6005
6026
|
scopes: string[];
|
|
6006
6027
|
agent_did: string;
|
|
@@ -6008,7 +6029,7 @@ export declare const createDelegationAPIResponseSchema: z.ZodObject<{
|
|
|
6008
6029
|
created_at: string;
|
|
6009
6030
|
user_id?: string | undefined;
|
|
6010
6031
|
user_identifier?: string | undefined;
|
|
6011
|
-
expires_at?: string |
|
|
6032
|
+
expires_at?: string | undefined;
|
|
6012
6033
|
}>;
|
|
6013
6034
|
metadata: z.ZodOptional<z.ZodObject<{
|
|
6014
6035
|
requestId: z.ZodString;
|
|
@@ -6023,7 +6044,7 @@ export declare const createDelegationAPIResponseSchema: z.ZodObject<{
|
|
|
6023
6044
|
}, "strip", z.ZodTypeAny, {
|
|
6024
6045
|
success: boolean;
|
|
6025
6046
|
data: {
|
|
6026
|
-
status: "active"
|
|
6047
|
+
status: "active";
|
|
6027
6048
|
delegation_id: string;
|
|
6028
6049
|
scopes: string[];
|
|
6029
6050
|
agent_did: string;
|
|
@@ -6031,7 +6052,7 @@ export declare const createDelegationAPIResponseSchema: z.ZodObject<{
|
|
|
6031
6052
|
created_at: string;
|
|
6032
6053
|
user_id?: string | undefined;
|
|
6033
6054
|
user_identifier?: string | undefined;
|
|
6034
|
-
expires_at?: string |
|
|
6055
|
+
expires_at?: string | undefined;
|
|
6035
6056
|
};
|
|
6036
6057
|
metadata?: {
|
|
6037
6058
|
timestamp: string;
|
|
@@ -6040,7 +6061,7 @@ export declare const createDelegationAPIResponseSchema: z.ZodObject<{
|
|
|
6040
6061
|
}, {
|
|
6041
6062
|
success: boolean;
|
|
6042
6063
|
data: {
|
|
6043
|
-
status: "active"
|
|
6064
|
+
status: "active";
|
|
6044
6065
|
delegation_id: string;
|
|
6045
6066
|
scopes: string[];
|
|
6046
6067
|
agent_did: string;
|
|
@@ -6048,7 +6069,7 @@ export declare const createDelegationAPIResponseSchema: z.ZodObject<{
|
|
|
6048
6069
|
created_at: string;
|
|
6049
6070
|
user_id?: string | undefined;
|
|
6050
6071
|
user_identifier?: string | undefined;
|
|
6051
|
-
expires_at?: string |
|
|
6072
|
+
expires_at?: string | undefined;
|
|
6052
6073
|
};
|
|
6053
6074
|
metadata?: {
|
|
6054
6075
|
timestamp: string;
|
|
@@ -97,7 +97,7 @@ exports.proofSubmissionResponseSchema = zod_1.z.object({
|
|
|
97
97
|
success: zod_1.z.boolean(),
|
|
98
98
|
accepted: zod_1.z.number().int().min(0),
|
|
99
99
|
rejected: zod_1.z.number().int().min(0),
|
|
100
|
-
outcomes: zod_1.z.record(zod_1.z.string(), zod_1.z.number().int().min(0))
|
|
100
|
+
outcomes: zod_1.z.record(zod_1.z.string(), zod_1.z.number().int().min(0)), // Record<BouncerOutcome, number>
|
|
101
101
|
errors: zod_1.z
|
|
102
102
|
.array(zod_1.z.object({
|
|
103
103
|
proof_index: zod_1.z.number().int().min(0),
|
|
@@ -199,7 +199,7 @@ exports.toolProtectionConfigAPIResponseSchema = (0, exports.agentShieldAPIRespon
|
|
|
199
199
|
* Create delegation request schema
|
|
200
200
|
*
|
|
201
201
|
* Note: AgentShield API accepts a simplified format, not the full DelegationRecord.
|
|
202
|
-
* The API accepts: agent_did, scopes, expires_in_days, expires_at, session_id, project_id,
|
|
202
|
+
* The API accepts: agent_did, scopes, expires_in_days, expires_at, session_id, project_id, custom_fields
|
|
203
203
|
*
|
|
204
204
|
* IMPORTANT: expires_in_days and expires_at are mutually exclusive - use one or the other, not both.
|
|
205
205
|
*/
|
|
@@ -211,7 +211,6 @@ exports.createDelegationRequestSchema = zod_1.z
|
|
|
211
211
|
expires_at: zod_1.z.string().datetime().optional(),
|
|
212
212
|
session_id: zod_1.z.string().optional(),
|
|
213
213
|
project_id: zod_1.z.string().uuid().optional(),
|
|
214
|
-
user_identifier: zod_1.z.string().max(200).optional(), // Matches AgentShield's max(200)
|
|
215
214
|
custom_fields: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
216
215
|
})
|
|
217
216
|
.passthrough()
|
|
@@ -239,9 +238,9 @@ exports.createDelegationResponseSchema = zod_1.z.object({
|
|
|
239
238
|
user_id: zod_1.z.string().optional(),
|
|
240
239
|
user_identifier: zod_1.z.string().optional(),
|
|
241
240
|
scopes: zod_1.z.array(zod_1.z.string()),
|
|
242
|
-
status: zod_1.z.
|
|
241
|
+
status: zod_1.z.literal("active"),
|
|
243
242
|
issued_at: zod_1.z.string().datetime(),
|
|
244
|
-
expires_at: zod_1.z.string().datetime().
|
|
243
|
+
expires_at: zod_1.z.string().datetime().optional(),
|
|
245
244
|
created_at: zod_1.z.string().datetime(),
|
|
246
245
|
});
|
|
247
246
|
/**
|
|
@@ -94,7 +94,7 @@ export interface ProofSubmissionResponse {
|
|
|
94
94
|
success: boolean;
|
|
95
95
|
accepted: number;
|
|
96
96
|
rejected: number;
|
|
97
|
-
outcomes
|
|
97
|
+
outcomes: Record<BouncerOutcome, number>;
|
|
98
98
|
errors?: Array<{
|
|
99
99
|
proof_index: number;
|
|
100
100
|
error: {
|
|
@@ -188,7 +188,7 @@ export type ToolProtectionConfigAPIResponse = AgentShieldAPIResponse<ToolProtect
|
|
|
188
188
|
* POST /api/v1/bouncer/delegations
|
|
189
189
|
*
|
|
190
190
|
* Note: AgentShield API accepts a simplified format, not the full DelegationRecord.
|
|
191
|
-
* The API accepts: agent_did, scopes, expires_in_days, expires_at, session_id, project_id,
|
|
191
|
+
* The API accepts: agent_did, scopes, expires_in_days, expires_at, session_id, project_id, custom_fields
|
|
192
192
|
*
|
|
193
193
|
* IMPORTANT: expires_in_days and expires_at are mutually exclusive - use one or the other, not both.
|
|
194
194
|
*/
|
|
@@ -201,8 +201,6 @@ export interface CreateDelegationRequest {
|
|
|
201
201
|
expires_at?: string;
|
|
202
202
|
session_id?: string;
|
|
203
203
|
project_id?: string;
|
|
204
|
-
/** User identifier string, max 200 chars, optional */
|
|
205
|
-
user_identifier?: string;
|
|
206
204
|
custom_fields?: Record<string, unknown>;
|
|
207
205
|
}
|
|
208
206
|
/**
|
|
@@ -220,9 +218,9 @@ export interface CreateDelegationResponse {
|
|
|
220
218
|
user_id?: string;
|
|
221
219
|
user_identifier?: string;
|
|
222
220
|
scopes: string[];
|
|
223
|
-
status: "active"
|
|
221
|
+
status: "active";
|
|
224
222
|
issued_at: string;
|
|
225
|
-
expires_at?: string
|
|
223
|
+
expires_at?: string;
|
|
226
224
|
created_at: string;
|
|
227
225
|
}
|
|
228
226
|
/**
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module @kya-os/contracts/config
|
|
8
8
|
*/
|
|
9
|
-
import { z } from "zod";
|
|
10
9
|
/**
|
|
11
10
|
* Runtime Identity Configuration
|
|
12
11
|
*
|
|
@@ -26,7 +25,7 @@ export interface RuntimeIdentityConfig {
|
|
|
26
25
|
* Runtime environment for identity
|
|
27
26
|
* Determines where keys come from and how they're managed
|
|
28
27
|
*/
|
|
29
|
-
environment:
|
|
28
|
+
environment: 'development' | 'production';
|
|
30
29
|
/**
|
|
31
30
|
* Production identity configuration
|
|
32
31
|
* Used when environment is 'production'
|
|
@@ -72,209 +71,7 @@ export interface RuntimeIdentityConfig {
|
|
|
72
71
|
* - 'persistent': User DIDs are persisted in storage (requires did:web setup)
|
|
73
72
|
* @default 'ephemeral'
|
|
74
73
|
*/
|
|
75
|
-
userDidStorage?:
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* OAuth Provider Configuration
|
|
79
|
-
*
|
|
80
|
-
* Configuration for a single OAuth provider (GitHub, Google, etc.)
|
|
81
|
-
*/
|
|
82
|
-
export interface OAuthProvider {
|
|
83
|
-
/** OAuth client ID (public, safe to expose) */
|
|
84
|
-
clientId: string;
|
|
85
|
-
/** OAuth client secret (NOT returned in API response for security) */
|
|
86
|
-
clientSecret?: string | null;
|
|
87
|
-
/** OAuth authorization URL */
|
|
88
|
-
authorizationUrl: string;
|
|
89
|
-
/** OAuth token exchange URL */
|
|
90
|
-
tokenUrl: string;
|
|
91
|
-
/** OAuth user info endpoint URL */
|
|
92
|
-
userInfoUrl?: string;
|
|
93
|
-
/** Whether provider supports PKCE (Proof Key for Code Exchange) */
|
|
94
|
-
supportsPKCE: boolean;
|
|
95
|
-
/** Whether provider requires client secret (false for PKCE-only providers) */
|
|
96
|
-
requiresClientSecret: boolean;
|
|
97
|
-
/** Available scopes for this provider */
|
|
98
|
-
scopes?: string[];
|
|
99
|
-
/** Default scopes to request */
|
|
100
|
-
defaultScopes?: string[];
|
|
101
|
-
/** Whether provider uses proxy mode (via AgentShield) */
|
|
102
|
-
proxyMode?: boolean;
|
|
103
|
-
/** Custom OAuth parameters to include in authorization URL (e.g., audience, acr_values) */
|
|
104
|
-
customParams?: Record<string, string>;
|
|
105
|
-
/** Token endpoint authentication method */
|
|
106
|
-
tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic";
|
|
107
|
-
/** OAuth response type (default: "code") */
|
|
108
|
-
responseType?: string;
|
|
109
|
-
/** OAuth grant type (default: "authorization_code") */
|
|
110
|
-
grantType?: string;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* OAuth Configuration
|
|
114
|
-
*
|
|
115
|
-
* Configuration for OAuth providers fetched from AgentShield API.
|
|
116
|
-
* Contains all available providers for a project.
|
|
117
|
-
*
|
|
118
|
-
* Note: API does NOT return a defaultProvider field (Phase 1 architecture).
|
|
119
|
-
* Phase 1 uses configured provider as temporary fallback.
|
|
120
|
-
* Phase 2+ requires tools to explicitly specify oauthProvider.
|
|
121
|
-
*/
|
|
122
|
-
export interface OAuthConfig {
|
|
123
|
-
/** Map of provider names to provider configurations */
|
|
124
|
-
providers: Record<string, OAuthProvider>;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Zod schema for OAuthProvider validation
|
|
128
|
-
*/
|
|
129
|
-
export declare const OAuthProviderSchema: z.ZodObject<{
|
|
130
|
-
clientId: z.ZodString;
|
|
131
|
-
clientSecret: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
132
|
-
authorizationUrl: z.ZodString;
|
|
133
|
-
tokenUrl: z.ZodString;
|
|
134
|
-
userInfoUrl: z.ZodOptional<z.ZodString>;
|
|
135
|
-
supportsPKCE: z.ZodBoolean;
|
|
136
|
-
requiresClientSecret: z.ZodBoolean;
|
|
137
|
-
scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
138
|
-
defaultScopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
139
|
-
proxyMode: z.ZodOptional<z.ZodBoolean>;
|
|
140
|
-
customParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
141
|
-
tokenEndpointAuthMethod: z.ZodOptional<z.ZodEnum<["client_secret_post", "client_secret_basic"]>>;
|
|
142
|
-
responseType: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
143
|
-
grantType: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
144
|
-
}, "strip", z.ZodTypeAny, {
|
|
145
|
-
clientId: string;
|
|
146
|
-
authorizationUrl: string;
|
|
147
|
-
tokenUrl: string;
|
|
148
|
-
supportsPKCE: boolean;
|
|
149
|
-
requiresClientSecret: boolean;
|
|
150
|
-
responseType: string;
|
|
151
|
-
grantType: string;
|
|
152
|
-
scopes?: string[] | undefined;
|
|
153
|
-
clientSecret?: string | null | undefined;
|
|
154
|
-
userInfoUrl?: string | undefined;
|
|
155
|
-
defaultScopes?: string[] | undefined;
|
|
156
|
-
proxyMode?: boolean | undefined;
|
|
157
|
-
customParams?: Record<string, string> | undefined;
|
|
158
|
-
tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
|
|
159
|
-
}, {
|
|
160
|
-
clientId: string;
|
|
161
|
-
authorizationUrl: string;
|
|
162
|
-
tokenUrl: string;
|
|
163
|
-
supportsPKCE: boolean;
|
|
164
|
-
requiresClientSecret: boolean;
|
|
165
|
-
scopes?: string[] | undefined;
|
|
166
|
-
clientSecret?: string | null | undefined;
|
|
167
|
-
userInfoUrl?: string | undefined;
|
|
168
|
-
defaultScopes?: string[] | undefined;
|
|
169
|
-
proxyMode?: boolean | undefined;
|
|
170
|
-
customParams?: Record<string, string> | undefined;
|
|
171
|
-
tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
|
|
172
|
-
responseType?: string | undefined;
|
|
173
|
-
grantType?: string | undefined;
|
|
174
|
-
}>;
|
|
175
|
-
/**
|
|
176
|
-
* Zod schema for OAuthConfig validation
|
|
177
|
-
*/
|
|
178
|
-
export declare const OAuthConfigSchema: z.ZodObject<{
|
|
179
|
-
providers: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
180
|
-
clientId: z.ZodString;
|
|
181
|
-
clientSecret: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
182
|
-
authorizationUrl: z.ZodString;
|
|
183
|
-
tokenUrl: z.ZodString;
|
|
184
|
-
userInfoUrl: z.ZodOptional<z.ZodString>;
|
|
185
|
-
supportsPKCE: z.ZodBoolean;
|
|
186
|
-
requiresClientSecret: z.ZodBoolean;
|
|
187
|
-
scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
188
|
-
defaultScopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
189
|
-
proxyMode: z.ZodOptional<z.ZodBoolean>;
|
|
190
|
-
customParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
191
|
-
tokenEndpointAuthMethod: z.ZodOptional<z.ZodEnum<["client_secret_post", "client_secret_basic"]>>;
|
|
192
|
-
responseType: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
193
|
-
grantType: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
194
|
-
}, "strip", z.ZodTypeAny, {
|
|
195
|
-
clientId: string;
|
|
196
|
-
authorizationUrl: string;
|
|
197
|
-
tokenUrl: string;
|
|
198
|
-
supportsPKCE: boolean;
|
|
199
|
-
requiresClientSecret: boolean;
|
|
200
|
-
responseType: string;
|
|
201
|
-
grantType: string;
|
|
202
|
-
scopes?: string[] | undefined;
|
|
203
|
-
clientSecret?: string | null | undefined;
|
|
204
|
-
userInfoUrl?: string | undefined;
|
|
205
|
-
defaultScopes?: string[] | undefined;
|
|
206
|
-
proxyMode?: boolean | undefined;
|
|
207
|
-
customParams?: Record<string, string> | undefined;
|
|
208
|
-
tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
|
|
209
|
-
}, {
|
|
210
|
-
clientId: string;
|
|
211
|
-
authorizationUrl: string;
|
|
212
|
-
tokenUrl: string;
|
|
213
|
-
supportsPKCE: boolean;
|
|
214
|
-
requiresClientSecret: boolean;
|
|
215
|
-
scopes?: string[] | undefined;
|
|
216
|
-
clientSecret?: string | null | undefined;
|
|
217
|
-
userInfoUrl?: string | undefined;
|
|
218
|
-
defaultScopes?: string[] | undefined;
|
|
219
|
-
proxyMode?: boolean | undefined;
|
|
220
|
-
customParams?: Record<string, string> | undefined;
|
|
221
|
-
tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
|
|
222
|
-
responseType?: string | undefined;
|
|
223
|
-
grantType?: string | undefined;
|
|
224
|
-
}>>;
|
|
225
|
-
}, "strip", z.ZodTypeAny, {
|
|
226
|
-
providers: Record<string, {
|
|
227
|
-
clientId: string;
|
|
228
|
-
authorizationUrl: string;
|
|
229
|
-
tokenUrl: string;
|
|
230
|
-
supportsPKCE: boolean;
|
|
231
|
-
requiresClientSecret: boolean;
|
|
232
|
-
responseType: string;
|
|
233
|
-
grantType: string;
|
|
234
|
-
scopes?: string[] | undefined;
|
|
235
|
-
clientSecret?: string | null | undefined;
|
|
236
|
-
userInfoUrl?: string | undefined;
|
|
237
|
-
defaultScopes?: string[] | undefined;
|
|
238
|
-
proxyMode?: boolean | undefined;
|
|
239
|
-
customParams?: Record<string, string> | undefined;
|
|
240
|
-
tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
|
|
241
|
-
}>;
|
|
242
|
-
}, {
|
|
243
|
-
providers: Record<string, {
|
|
244
|
-
clientId: string;
|
|
245
|
-
authorizationUrl: string;
|
|
246
|
-
tokenUrl: string;
|
|
247
|
-
supportsPKCE: boolean;
|
|
248
|
-
requiresClientSecret: boolean;
|
|
249
|
-
scopes?: string[] | undefined;
|
|
250
|
-
clientSecret?: string | null | undefined;
|
|
251
|
-
userInfoUrl?: string | undefined;
|
|
252
|
-
defaultScopes?: string[] | undefined;
|
|
253
|
-
proxyMode?: boolean | undefined;
|
|
254
|
-
customParams?: Record<string, string> | undefined;
|
|
255
|
-
tokenEndpointAuthMethod?: "client_secret_post" | "client_secret_basic" | undefined;
|
|
256
|
-
responseType?: string | undefined;
|
|
257
|
-
grantType?: string | undefined;
|
|
258
|
-
}>;
|
|
259
|
-
}>;
|
|
260
|
-
/**
|
|
261
|
-
* IDP Tokens
|
|
262
|
-
*
|
|
263
|
-
* Tokens received from OAuth provider (IDP = Identity Provider)
|
|
264
|
-
*/
|
|
265
|
-
export interface IdpTokens {
|
|
266
|
-
/** OAuth access token for API calls */
|
|
267
|
-
access_token: string;
|
|
268
|
-
/** OAuth refresh token (optional) */
|
|
269
|
-
refresh_token?: string;
|
|
270
|
-
/** Token expiration time in seconds */
|
|
271
|
-
expires_in?: number;
|
|
272
|
-
/** Token expiration timestamp (milliseconds since epoch) */
|
|
273
|
-
expires_at: number;
|
|
274
|
-
/** Token type (usually "Bearer") */
|
|
275
|
-
token_type: string;
|
|
276
|
-
/** Granted scopes */
|
|
277
|
-
scope?: string;
|
|
74
|
+
userDidStorage?: 'ephemeral' | 'persistent';
|
|
278
75
|
}
|
|
279
76
|
/**
|
|
280
77
|
* Agent identity representation
|
package/dist/config/identity.js
CHANGED
|
@@ -8,31 +8,3 @@
|
|
|
8
8
|
* @module @kya-os/contracts/config
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.OAuthConfigSchema = exports.OAuthProviderSchema = void 0;
|
|
12
|
-
const zod_1 = require("zod");
|
|
13
|
-
/**
|
|
14
|
-
* Zod schema for OAuthProvider validation
|
|
15
|
-
*/
|
|
16
|
-
exports.OAuthProviderSchema = zod_1.z.object({
|
|
17
|
-
clientId: zod_1.z.string().min(1),
|
|
18
|
-
clientSecret: zod_1.z.string().nullable().optional(),
|
|
19
|
-
authorizationUrl: zod_1.z.string().url(),
|
|
20
|
-
tokenUrl: zod_1.z.string().url(),
|
|
21
|
-
userInfoUrl: zod_1.z.string().url().optional(),
|
|
22
|
-
supportsPKCE: zod_1.z.boolean(),
|
|
23
|
-
requiresClientSecret: zod_1.z.boolean(),
|
|
24
|
-
scopes: zod_1.z.array(zod_1.z.string()).optional(),
|
|
25
|
-
defaultScopes: zod_1.z.array(zod_1.z.string()).optional(),
|
|
26
|
-
proxyMode: zod_1.z.boolean().optional(),
|
|
27
|
-
// Phase 3: Custom IDP Support
|
|
28
|
-
customParams: zod_1.z.record(zod_1.z.string()).optional(),
|
|
29
|
-
tokenEndpointAuthMethod: zod_1.z.enum(["client_secret_post", "client_secret_basic"]).optional(),
|
|
30
|
-
responseType: zod_1.z.string().optional().default("code"),
|
|
31
|
-
grantType: zod_1.z.string().optional().default("authorization_code"),
|
|
32
|
-
});
|
|
33
|
-
/**
|
|
34
|
-
* Zod schema for OAuthConfig validation
|
|
35
|
-
*/
|
|
36
|
-
exports.OAuthConfigSchema = zod_1.z.object({
|
|
37
|
-
providers: zod_1.z.record(zod_1.z.string(), exports.OAuthProviderSchema),
|
|
38
|
-
});
|
package/dist/config/index.d.ts
CHANGED
|
@@ -12,8 +12,7 @@ import type { ProofingConfig } from "./proofing.js";
|
|
|
12
12
|
import type { DelegationConfig } from "./delegation.js";
|
|
13
13
|
import type { ToolProtectionSourceConfig } from "./tool-protection.js";
|
|
14
14
|
export { MCPIBaseConfig } from "./base.js";
|
|
15
|
-
export { RuntimeIdentityConfig, AgentIdentity
|
|
16
|
-
export type { ToolExecutionContext } from "./tool-context.js";
|
|
15
|
+
export { RuntimeIdentityConfig, AgentIdentity } from "./identity.js";
|
|
17
16
|
/**
|
|
18
17
|
* @deprecated Use RuntimeIdentityConfig instead
|
|
19
18
|
* This export is maintained for backward compatibility
|