@kya-os/contracts 1.5.3-canary.2 → 1.5.3-canary.20
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/.turbo/turbo-build.log +17 -0
- package/.turbo/turbo-test$colon$coverage.log +85 -0
- package/.turbo/turbo-test.log +32 -0
- package/coverage/coverage-final.json +38 -0
- package/dist/agentshield-api/admin-schemas.d.ts +2 -2
- 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 +119 -93
- package/dist/consent/schemas.js +111 -64
- package/dist/dashboard-config/schemas.d.ts +1949 -693
- 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 +430 -2
- package/dist/tool-protection/index.js +62 -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 +43 -122
- package/schemas/cli/register-output/v1.0.0.json +69 -0
- package/schemas/identity/v1.0.0.json +46 -0
- package/schemas/proof/v1.0.0.json +80 -0
- package/schemas/registry/receipt-v1.0.0.json +60 -0
- package/schemas/verifier/verify-page/v1.0.0.json +94 -0
- package/schemas/well-known/agent/v1.0.0.json +67 -0
- package/schemas/well-known/did/v1.0.0.json +174 -0
- package/scripts/emit-schemas.js +11 -0
- package/src/agentshield-api/admin-schemas.ts +31 -0
- package/src/agentshield-api/admin-types.ts +47 -0
- package/src/agentshield-api/endpoints.ts +60 -0
- package/src/agentshield-api/index.ts +70 -0
- package/src/agentshield-api/schemas.ts +304 -0
- package/src/agentshield-api/types.ts +317 -0
- package/src/audit/index.ts +128 -0
- package/src/cli.ts +156 -0
- package/src/config/base.ts +107 -0
- package/src/config/builder.ts +97 -0
- package/src/config/delegation.ts +232 -0
- package/src/config/identity.ts +252 -0
- package/src/config/index.ts +78 -0
- package/src/config/proofing.ts +138 -0
- package/src/config/tool-context.ts +41 -0
- package/src/config/tool-protection.ts +174 -0
- package/src/consent/index.ts +32 -0
- package/src/consent/schemas.ts +334 -0
- package/src/consent/types.ts +199 -0
- package/src/dashboard-config/default-config.json +86 -0
- package/src/dashboard-config/default-config.ts +266 -0
- package/src/dashboard-config/index.ts +48 -0
- package/src/dashboard-config/schemas.ts +286 -0
- package/src/dashboard-config/types.ts +404 -0
- package/src/delegation/constraints.ts +267 -0
- package/src/delegation/index.ts +8 -0
- package/src/delegation/schemas.ts +595 -0
- package/src/did/index.ts +9 -0
- package/src/did/resolve-contract.ts +255 -0
- package/src/did/schemas.ts +190 -0
- package/src/did/types.ts +224 -0
- package/src/env/constants.ts +70 -0
- package/src/env/index.ts +5 -0
- package/src/handshake.ts +125 -0
- package/src/index.ts +45 -0
- package/src/proof/index.ts +31 -0
- package/src/proof/proof-record.ts +163 -0
- package/src/proof/signing-spec.ts +146 -0
- package/src/proof.ts +99 -0
- package/src/registry.ts +146 -0
- package/src/runtime/errors.ts +153 -0
- package/src/runtime/headers.ts +136 -0
- package/src/runtime/index.ts +6 -0
- package/src/test.ts +143 -0
- package/src/tlkrc/index.ts +5 -0
- package/src/tlkrc/rotation.ts +153 -0
- package/src/tool-protection/index.ts +343 -0
- package/src/utils/validation.ts +93 -0
- package/src/vc/index.ts +8 -0
- package/src/vc/schemas.ts +277 -0
- package/src/vc/statuslist.ts +279 -0
- package/src/verifier/index.ts +2 -0
- package/src/verifier.ts +92 -0
- package/src/well-known/index.ts +237 -0
package/dist/handshake.d.ts
CHANGED
|
@@ -12,15 +12,15 @@ export declare const MCPClientInfoSchema: z.ZodObject<{
|
|
|
12
12
|
persistentId: z.ZodOptional<z.ZodString>;
|
|
13
13
|
}, "strip", z.ZodTypeAny, {
|
|
14
14
|
name: string;
|
|
15
|
-
title?: string | undefined;
|
|
16
15
|
version?: string | undefined;
|
|
16
|
+
title?: string | undefined;
|
|
17
17
|
platform?: string | undefined;
|
|
18
18
|
vendor?: string | undefined;
|
|
19
19
|
persistentId?: string | undefined;
|
|
20
20
|
}, {
|
|
21
21
|
name: string;
|
|
22
|
-
title?: string | undefined;
|
|
23
22
|
version?: string | undefined;
|
|
23
|
+
title?: string | undefined;
|
|
24
24
|
platform?: string | undefined;
|
|
25
25
|
vendor?: string | undefined;
|
|
26
26
|
persistentId?: string | undefined;
|
|
@@ -39,8 +39,8 @@ export declare const MCPClientSessionInfoSchema: z.ZodObject<{
|
|
|
39
39
|
}, "strip", z.ZodTypeAny, {
|
|
40
40
|
name: string;
|
|
41
41
|
clientId: string;
|
|
42
|
-
title?: string | undefined;
|
|
43
42
|
version?: string | undefined;
|
|
43
|
+
title?: string | undefined;
|
|
44
44
|
platform?: string | undefined;
|
|
45
45
|
vendor?: string | undefined;
|
|
46
46
|
persistentId?: string | undefined;
|
|
@@ -49,8 +49,8 @@ export declare const MCPClientSessionInfoSchema: z.ZodObject<{
|
|
|
49
49
|
}, {
|
|
50
50
|
name: string;
|
|
51
51
|
clientId: string;
|
|
52
|
-
title?: string | undefined;
|
|
53
52
|
version?: string | undefined;
|
|
53
|
+
title?: string | undefined;
|
|
54
54
|
platform?: string | undefined;
|
|
55
55
|
vendor?: string | undefined;
|
|
56
56
|
persistentId?: string | undefined;
|
|
@@ -73,16 +73,16 @@ export declare const HandshakeRequestSchema: z.ZodObject<{
|
|
|
73
73
|
clientId: z.ZodOptional<z.ZodString>;
|
|
74
74
|
}, "strip", z.ZodTypeAny, {
|
|
75
75
|
name: string;
|
|
76
|
-
title?: string | undefined;
|
|
77
76
|
version?: string | undefined;
|
|
77
|
+
title?: string | undefined;
|
|
78
78
|
platform?: string | undefined;
|
|
79
79
|
vendor?: string | undefined;
|
|
80
80
|
persistentId?: string | undefined;
|
|
81
81
|
clientId?: string | undefined;
|
|
82
82
|
}, {
|
|
83
83
|
name: string;
|
|
84
|
-
title?: string | undefined;
|
|
85
84
|
version?: string | undefined;
|
|
85
|
+
title?: string | undefined;
|
|
86
86
|
platform?: string | undefined;
|
|
87
87
|
vendor?: string | undefined;
|
|
88
88
|
persistentId?: string | undefined;
|
|
@@ -97,8 +97,8 @@ export declare const HandshakeRequestSchema: z.ZodObject<{
|
|
|
97
97
|
agentDid?: string | undefined;
|
|
98
98
|
clientInfo?: {
|
|
99
99
|
name: string;
|
|
100
|
-
title?: string | undefined;
|
|
101
100
|
version?: string | undefined;
|
|
101
|
+
title?: string | undefined;
|
|
102
102
|
platform?: string | undefined;
|
|
103
103
|
vendor?: string | undefined;
|
|
104
104
|
persistentId?: string | undefined;
|
|
@@ -113,8 +113,8 @@ export declare const HandshakeRequestSchema: z.ZodObject<{
|
|
|
113
113
|
agentDid?: string | undefined;
|
|
114
114
|
clientInfo?: {
|
|
115
115
|
name: string;
|
|
116
|
-
title?: string | undefined;
|
|
117
116
|
version?: string | undefined;
|
|
117
|
+
title?: string | undefined;
|
|
118
118
|
platform?: string | undefined;
|
|
119
119
|
vendor?: string | undefined;
|
|
120
120
|
persistentId?: string | undefined;
|
|
@@ -149,8 +149,8 @@ export declare const SessionContextSchema: z.ZodObject<{
|
|
|
149
149
|
}, "strip", z.ZodTypeAny, {
|
|
150
150
|
name: string;
|
|
151
151
|
clientId: string;
|
|
152
|
-
title?: string | undefined;
|
|
153
152
|
version?: string | undefined;
|
|
153
|
+
title?: string | undefined;
|
|
154
154
|
platform?: string | undefined;
|
|
155
155
|
vendor?: string | undefined;
|
|
156
156
|
persistentId?: string | undefined;
|
|
@@ -159,8 +159,8 @@ export declare const SessionContextSchema: z.ZodObject<{
|
|
|
159
159
|
}, {
|
|
160
160
|
name: string;
|
|
161
161
|
clientId: string;
|
|
162
|
-
title?: string | undefined;
|
|
163
162
|
version?: string | undefined;
|
|
163
|
+
title?: string | undefined;
|
|
164
164
|
platform?: string | undefined;
|
|
165
165
|
vendor?: string | undefined;
|
|
166
166
|
persistentId?: string | undefined;
|
|
@@ -168,19 +168,19 @@ export declare const SessionContextSchema: z.ZodObject<{
|
|
|
168
168
|
capabilities?: Record<string, unknown> | undefined;
|
|
169
169
|
}>>;
|
|
170
170
|
}, "strip", z.ZodTypeAny, {
|
|
171
|
+
createdAt: number;
|
|
171
172
|
nonce: string;
|
|
172
173
|
audience: string;
|
|
173
174
|
timestamp: number;
|
|
174
175
|
sessionId: string;
|
|
175
|
-
createdAt: number;
|
|
176
176
|
lastActivity: number;
|
|
177
177
|
ttlMinutes: number;
|
|
178
178
|
agentDid?: string | undefined;
|
|
179
179
|
clientInfo?: {
|
|
180
180
|
name: string;
|
|
181
181
|
clientId: string;
|
|
182
|
-
title?: string | undefined;
|
|
183
182
|
version?: string | undefined;
|
|
183
|
+
title?: string | undefined;
|
|
184
184
|
platform?: string | undefined;
|
|
185
185
|
vendor?: string | undefined;
|
|
186
186
|
persistentId?: string | undefined;
|
|
@@ -191,18 +191,18 @@ export declare const SessionContextSchema: z.ZodObject<{
|
|
|
191
191
|
clientDid?: string | undefined;
|
|
192
192
|
userDid?: string | undefined;
|
|
193
193
|
}, {
|
|
194
|
+
createdAt: number;
|
|
194
195
|
nonce: string;
|
|
195
196
|
audience: string;
|
|
196
197
|
timestamp: number;
|
|
197
198
|
sessionId: string;
|
|
198
|
-
createdAt: number;
|
|
199
199
|
lastActivity: number;
|
|
200
200
|
agentDid?: string | undefined;
|
|
201
201
|
clientInfo?: {
|
|
202
202
|
name: string;
|
|
203
203
|
clientId: string;
|
|
204
|
-
title?: string | undefined;
|
|
205
204
|
version?: string | undefined;
|
|
205
|
+
title?: string | undefined;
|
|
206
206
|
platform?: string | undefined;
|
|
207
207
|
vendor?: string | undefined;
|
|
208
208
|
persistentId?: string | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -21,5 +21,6 @@ export * from "./test.js";
|
|
|
21
21
|
export * from "./utils/validation.js";
|
|
22
22
|
export * from "./vc/index.js";
|
|
23
23
|
export * from "./delegation/index.js";
|
|
24
|
+
export * from "./audit/index.js";
|
|
24
25
|
export declare const CONTRACTS_VERSION = "1.2.1";
|
|
25
26
|
export declare const SUPPORTED_XMCP_I_VERSION = "^1.0.0";
|
package/dist/index.js
CHANGED
|
@@ -40,6 +40,8 @@ __exportStar(require("./utils/validation.js"), exports);
|
|
|
40
40
|
// W3C VC and Delegation exports (for mcp-i-core compatibility)
|
|
41
41
|
__exportStar(require("./vc/index.js"), exports);
|
|
42
42
|
__exportStar(require("./delegation/index.js"), exports);
|
|
43
|
+
// Audit types (platform-agnostic)
|
|
44
|
+
__exportStar(require("./audit/index.js"), exports);
|
|
43
45
|
// Version information
|
|
44
46
|
exports.CONTRACTS_VERSION = "1.2.1";
|
|
45
47
|
exports.SUPPORTED_XMCP_I_VERSION = "^1.0.0";
|
|
@@ -8,6 +8,31 @@
|
|
|
8
8
|
* @module @kya-os/contracts/tool-protection
|
|
9
9
|
*/
|
|
10
10
|
import { z } from 'zod';
|
|
11
|
+
/**
|
|
12
|
+
* Authorization Requirement (Discriminated Union)
|
|
13
|
+
*
|
|
14
|
+
* Defines the type of authorization required for a tool.
|
|
15
|
+
* Extensible design to support OAuth, MDL, IDV, credentials, etc.
|
|
16
|
+
*/
|
|
17
|
+
export type AuthorizationRequirement = {
|
|
18
|
+
type: 'oauth';
|
|
19
|
+
provider: string;
|
|
20
|
+
requiredScopes?: string[];
|
|
21
|
+
} | {
|
|
22
|
+
type: 'mdl';
|
|
23
|
+
issuer: string;
|
|
24
|
+
credentialType?: string;
|
|
25
|
+
} | {
|
|
26
|
+
type: 'idv';
|
|
27
|
+
provider: string;
|
|
28
|
+
verificationLevel?: 'basic' | 'enhanced' | 'loa3';
|
|
29
|
+
} | {
|
|
30
|
+
type: 'credential';
|
|
31
|
+
credentialType: string;
|
|
32
|
+
issuer?: string;
|
|
33
|
+
} | {
|
|
34
|
+
type: 'none';
|
|
35
|
+
};
|
|
11
36
|
/**
|
|
12
37
|
* Tool Protection Definition
|
|
13
38
|
*
|
|
@@ -29,6 +54,19 @@ export interface ToolProtection {
|
|
|
29
54
|
* Used to determine appropriate authorization flows
|
|
30
55
|
*/
|
|
31
56
|
riskLevel?: 'low' | 'medium' | 'high' | 'critical';
|
|
57
|
+
/**
|
|
58
|
+
* OAuth provider name for this tool (Phase 2+)
|
|
59
|
+
* If specified, this tool will use the specified OAuth provider.
|
|
60
|
+
* If not specified, provider will be resolved via fallback strategies.
|
|
61
|
+
* @example "github", "google", "microsoft"
|
|
62
|
+
* @deprecated Use `authorization` field instead. Will be removed in Phase 3.
|
|
63
|
+
*/
|
|
64
|
+
oauthProvider?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Authorization requirement for this tool
|
|
67
|
+
* If requiresDelegation=true, authorization must be specified (or inferred from legacy fields)
|
|
68
|
+
*/
|
|
69
|
+
authorization?: AuthorizationRequirement;
|
|
32
70
|
}
|
|
33
71
|
/**
|
|
34
72
|
* Tool Protection Map
|
|
@@ -97,45 +135,388 @@ export interface DelegationRequiredErrorData {
|
|
|
97
135
|
/**
|
|
98
136
|
* Zod Schemas for Validation
|
|
99
137
|
*/
|
|
138
|
+
export declare const AuthorizationRequirementSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
139
|
+
type: z.ZodLiteral<"oauth">;
|
|
140
|
+
provider: z.ZodString;
|
|
141
|
+
requiredScopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
142
|
+
}, "strip", z.ZodTypeAny, {
|
|
143
|
+
type: "oauth";
|
|
144
|
+
provider: string;
|
|
145
|
+
requiredScopes?: string[] | undefined;
|
|
146
|
+
}, {
|
|
147
|
+
type: "oauth";
|
|
148
|
+
provider: string;
|
|
149
|
+
requiredScopes?: string[] | undefined;
|
|
150
|
+
}>, z.ZodObject<{
|
|
151
|
+
type: z.ZodLiteral<"mdl">;
|
|
152
|
+
issuer: z.ZodString;
|
|
153
|
+
credentialType: z.ZodOptional<z.ZodString>;
|
|
154
|
+
}, "strip", z.ZodTypeAny, {
|
|
155
|
+
type: "mdl";
|
|
156
|
+
issuer: string;
|
|
157
|
+
credentialType?: string | undefined;
|
|
158
|
+
}, {
|
|
159
|
+
type: "mdl";
|
|
160
|
+
issuer: string;
|
|
161
|
+
credentialType?: string | undefined;
|
|
162
|
+
}>, z.ZodObject<{
|
|
163
|
+
type: z.ZodLiteral<"idv">;
|
|
164
|
+
provider: z.ZodString;
|
|
165
|
+
verificationLevel: z.ZodOptional<z.ZodEnum<["basic", "enhanced", "loa3"]>>;
|
|
166
|
+
}, "strip", z.ZodTypeAny, {
|
|
167
|
+
type: "idv";
|
|
168
|
+
provider: string;
|
|
169
|
+
verificationLevel?: "basic" | "enhanced" | "loa3" | undefined;
|
|
170
|
+
}, {
|
|
171
|
+
type: "idv";
|
|
172
|
+
provider: string;
|
|
173
|
+
verificationLevel?: "basic" | "enhanced" | "loa3" | undefined;
|
|
174
|
+
}>, z.ZodObject<{
|
|
175
|
+
type: z.ZodLiteral<"credential">;
|
|
176
|
+
credentialType: z.ZodString;
|
|
177
|
+
issuer: z.ZodOptional<z.ZodString>;
|
|
178
|
+
}, "strip", z.ZodTypeAny, {
|
|
179
|
+
type: "credential";
|
|
180
|
+
credentialType: string;
|
|
181
|
+
issuer?: string | undefined;
|
|
182
|
+
}, {
|
|
183
|
+
type: "credential";
|
|
184
|
+
credentialType: string;
|
|
185
|
+
issuer?: string | undefined;
|
|
186
|
+
}>, z.ZodObject<{
|
|
187
|
+
type: z.ZodLiteral<"none">;
|
|
188
|
+
}, "strip", z.ZodTypeAny, {
|
|
189
|
+
type: "none";
|
|
190
|
+
}, {
|
|
191
|
+
type: "none";
|
|
192
|
+
}>]>;
|
|
100
193
|
export declare const ToolProtectionSchema: z.ZodObject<{
|
|
101
194
|
requiresDelegation: z.ZodBoolean;
|
|
102
195
|
requiredScopes: z.ZodArray<z.ZodString, "many">;
|
|
103
196
|
riskLevel: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
|
|
197
|
+
oauthProvider: z.ZodOptional<z.ZodString>;
|
|
198
|
+
authorization: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
199
|
+
type: z.ZodLiteral<"oauth">;
|
|
200
|
+
provider: z.ZodString;
|
|
201
|
+
requiredScopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
202
|
+
}, "strip", z.ZodTypeAny, {
|
|
203
|
+
type: "oauth";
|
|
204
|
+
provider: string;
|
|
205
|
+
requiredScopes?: string[] | undefined;
|
|
206
|
+
}, {
|
|
207
|
+
type: "oauth";
|
|
208
|
+
provider: string;
|
|
209
|
+
requiredScopes?: string[] | undefined;
|
|
210
|
+
}>, z.ZodObject<{
|
|
211
|
+
type: z.ZodLiteral<"mdl">;
|
|
212
|
+
issuer: z.ZodString;
|
|
213
|
+
credentialType: z.ZodOptional<z.ZodString>;
|
|
214
|
+
}, "strip", z.ZodTypeAny, {
|
|
215
|
+
type: "mdl";
|
|
216
|
+
issuer: string;
|
|
217
|
+
credentialType?: string | undefined;
|
|
218
|
+
}, {
|
|
219
|
+
type: "mdl";
|
|
220
|
+
issuer: string;
|
|
221
|
+
credentialType?: string | undefined;
|
|
222
|
+
}>, z.ZodObject<{
|
|
223
|
+
type: z.ZodLiteral<"idv">;
|
|
224
|
+
provider: z.ZodString;
|
|
225
|
+
verificationLevel: z.ZodOptional<z.ZodEnum<["basic", "enhanced", "loa3"]>>;
|
|
226
|
+
}, "strip", z.ZodTypeAny, {
|
|
227
|
+
type: "idv";
|
|
228
|
+
provider: string;
|
|
229
|
+
verificationLevel?: "basic" | "enhanced" | "loa3" | undefined;
|
|
230
|
+
}, {
|
|
231
|
+
type: "idv";
|
|
232
|
+
provider: string;
|
|
233
|
+
verificationLevel?: "basic" | "enhanced" | "loa3" | undefined;
|
|
234
|
+
}>, z.ZodObject<{
|
|
235
|
+
type: z.ZodLiteral<"credential">;
|
|
236
|
+
credentialType: z.ZodString;
|
|
237
|
+
issuer: z.ZodOptional<z.ZodString>;
|
|
238
|
+
}, "strip", z.ZodTypeAny, {
|
|
239
|
+
type: "credential";
|
|
240
|
+
credentialType: string;
|
|
241
|
+
issuer?: string | undefined;
|
|
242
|
+
}, {
|
|
243
|
+
type: "credential";
|
|
244
|
+
credentialType: string;
|
|
245
|
+
issuer?: string | undefined;
|
|
246
|
+
}>, z.ZodObject<{
|
|
247
|
+
type: z.ZodLiteral<"none">;
|
|
248
|
+
}, "strip", z.ZodTypeAny, {
|
|
249
|
+
type: "none";
|
|
250
|
+
}, {
|
|
251
|
+
type: "none";
|
|
252
|
+
}>]>>;
|
|
104
253
|
}, "strip", z.ZodTypeAny, {
|
|
105
254
|
requiresDelegation: boolean;
|
|
106
255
|
requiredScopes: string[];
|
|
107
256
|
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
257
|
+
oauthProvider?: string | undefined;
|
|
258
|
+
authorization?: {
|
|
259
|
+
type: "oauth";
|
|
260
|
+
provider: string;
|
|
261
|
+
requiredScopes?: string[] | undefined;
|
|
262
|
+
} | {
|
|
263
|
+
type: "mdl";
|
|
264
|
+
issuer: string;
|
|
265
|
+
credentialType?: string | undefined;
|
|
266
|
+
} | {
|
|
267
|
+
type: "idv";
|
|
268
|
+
provider: string;
|
|
269
|
+
verificationLevel?: "basic" | "enhanced" | "loa3" | undefined;
|
|
270
|
+
} | {
|
|
271
|
+
type: "credential";
|
|
272
|
+
credentialType: string;
|
|
273
|
+
issuer?: string | undefined;
|
|
274
|
+
} | {
|
|
275
|
+
type: "none";
|
|
276
|
+
} | undefined;
|
|
108
277
|
}, {
|
|
109
278
|
requiresDelegation: boolean;
|
|
110
279
|
requiredScopes: string[];
|
|
111
280
|
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
281
|
+
oauthProvider?: string | undefined;
|
|
282
|
+
authorization?: {
|
|
283
|
+
type: "oauth";
|
|
284
|
+
provider: string;
|
|
285
|
+
requiredScopes?: string[] | undefined;
|
|
286
|
+
} | {
|
|
287
|
+
type: "mdl";
|
|
288
|
+
issuer: string;
|
|
289
|
+
credentialType?: string | undefined;
|
|
290
|
+
} | {
|
|
291
|
+
type: "idv";
|
|
292
|
+
provider: string;
|
|
293
|
+
verificationLevel?: "basic" | "enhanced" | "loa3" | undefined;
|
|
294
|
+
} | {
|
|
295
|
+
type: "credential";
|
|
296
|
+
credentialType: string;
|
|
297
|
+
issuer?: string | undefined;
|
|
298
|
+
} | {
|
|
299
|
+
type: "none";
|
|
300
|
+
} | undefined;
|
|
112
301
|
}>;
|
|
113
302
|
export declare const ToolProtectionMapSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
114
303
|
requiresDelegation: z.ZodBoolean;
|
|
115
304
|
requiredScopes: z.ZodArray<z.ZodString, "many">;
|
|
116
305
|
riskLevel: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
|
|
306
|
+
oauthProvider: z.ZodOptional<z.ZodString>;
|
|
307
|
+
authorization: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
308
|
+
type: z.ZodLiteral<"oauth">;
|
|
309
|
+
provider: z.ZodString;
|
|
310
|
+
requiredScopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
311
|
+
}, "strip", z.ZodTypeAny, {
|
|
312
|
+
type: "oauth";
|
|
313
|
+
provider: string;
|
|
314
|
+
requiredScopes?: string[] | undefined;
|
|
315
|
+
}, {
|
|
316
|
+
type: "oauth";
|
|
317
|
+
provider: string;
|
|
318
|
+
requiredScopes?: string[] | undefined;
|
|
319
|
+
}>, z.ZodObject<{
|
|
320
|
+
type: z.ZodLiteral<"mdl">;
|
|
321
|
+
issuer: z.ZodString;
|
|
322
|
+
credentialType: z.ZodOptional<z.ZodString>;
|
|
323
|
+
}, "strip", z.ZodTypeAny, {
|
|
324
|
+
type: "mdl";
|
|
325
|
+
issuer: string;
|
|
326
|
+
credentialType?: string | undefined;
|
|
327
|
+
}, {
|
|
328
|
+
type: "mdl";
|
|
329
|
+
issuer: string;
|
|
330
|
+
credentialType?: string | undefined;
|
|
331
|
+
}>, z.ZodObject<{
|
|
332
|
+
type: z.ZodLiteral<"idv">;
|
|
333
|
+
provider: z.ZodString;
|
|
334
|
+
verificationLevel: z.ZodOptional<z.ZodEnum<["basic", "enhanced", "loa3"]>>;
|
|
335
|
+
}, "strip", z.ZodTypeAny, {
|
|
336
|
+
type: "idv";
|
|
337
|
+
provider: string;
|
|
338
|
+
verificationLevel?: "basic" | "enhanced" | "loa3" | undefined;
|
|
339
|
+
}, {
|
|
340
|
+
type: "idv";
|
|
341
|
+
provider: string;
|
|
342
|
+
verificationLevel?: "basic" | "enhanced" | "loa3" | undefined;
|
|
343
|
+
}>, z.ZodObject<{
|
|
344
|
+
type: z.ZodLiteral<"credential">;
|
|
345
|
+
credentialType: z.ZodString;
|
|
346
|
+
issuer: z.ZodOptional<z.ZodString>;
|
|
347
|
+
}, "strip", z.ZodTypeAny, {
|
|
348
|
+
type: "credential";
|
|
349
|
+
credentialType: string;
|
|
350
|
+
issuer?: string | undefined;
|
|
351
|
+
}, {
|
|
352
|
+
type: "credential";
|
|
353
|
+
credentialType: string;
|
|
354
|
+
issuer?: string | undefined;
|
|
355
|
+
}>, z.ZodObject<{
|
|
356
|
+
type: z.ZodLiteral<"none">;
|
|
357
|
+
}, "strip", z.ZodTypeAny, {
|
|
358
|
+
type: "none";
|
|
359
|
+
}, {
|
|
360
|
+
type: "none";
|
|
361
|
+
}>]>>;
|
|
117
362
|
}, "strip", z.ZodTypeAny, {
|
|
118
363
|
requiresDelegation: boolean;
|
|
119
364
|
requiredScopes: string[];
|
|
120
365
|
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
366
|
+
oauthProvider?: string | undefined;
|
|
367
|
+
authorization?: {
|
|
368
|
+
type: "oauth";
|
|
369
|
+
provider: string;
|
|
370
|
+
requiredScopes?: string[] | undefined;
|
|
371
|
+
} | {
|
|
372
|
+
type: "mdl";
|
|
373
|
+
issuer: string;
|
|
374
|
+
credentialType?: string | undefined;
|
|
375
|
+
} | {
|
|
376
|
+
type: "idv";
|
|
377
|
+
provider: string;
|
|
378
|
+
verificationLevel?: "basic" | "enhanced" | "loa3" | undefined;
|
|
379
|
+
} | {
|
|
380
|
+
type: "credential";
|
|
381
|
+
credentialType: string;
|
|
382
|
+
issuer?: string | undefined;
|
|
383
|
+
} | {
|
|
384
|
+
type: "none";
|
|
385
|
+
} | undefined;
|
|
121
386
|
}, {
|
|
122
387
|
requiresDelegation: boolean;
|
|
123
388
|
requiredScopes: string[];
|
|
124
389
|
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
390
|
+
oauthProvider?: string | undefined;
|
|
391
|
+
authorization?: {
|
|
392
|
+
type: "oauth";
|
|
393
|
+
provider: string;
|
|
394
|
+
requiredScopes?: string[] | undefined;
|
|
395
|
+
} | {
|
|
396
|
+
type: "mdl";
|
|
397
|
+
issuer: string;
|
|
398
|
+
credentialType?: string | undefined;
|
|
399
|
+
} | {
|
|
400
|
+
type: "idv";
|
|
401
|
+
provider: string;
|
|
402
|
+
verificationLevel?: "basic" | "enhanced" | "loa3" | undefined;
|
|
403
|
+
} | {
|
|
404
|
+
type: "credential";
|
|
405
|
+
credentialType: string;
|
|
406
|
+
issuer?: string | undefined;
|
|
407
|
+
} | {
|
|
408
|
+
type: "none";
|
|
409
|
+
} | undefined;
|
|
125
410
|
}>>;
|
|
126
411
|
export declare const ToolProtectionResponseSchema: z.ZodObject<{
|
|
127
412
|
toolProtections: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
128
413
|
requiresDelegation: z.ZodBoolean;
|
|
129
414
|
requiredScopes: z.ZodArray<z.ZodString, "many">;
|
|
130
415
|
riskLevel: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
|
|
416
|
+
oauthProvider: z.ZodOptional<z.ZodString>;
|
|
417
|
+
authorization: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
418
|
+
type: z.ZodLiteral<"oauth">;
|
|
419
|
+
provider: z.ZodString;
|
|
420
|
+
requiredScopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
421
|
+
}, "strip", z.ZodTypeAny, {
|
|
422
|
+
type: "oauth";
|
|
423
|
+
provider: string;
|
|
424
|
+
requiredScopes?: string[] | undefined;
|
|
425
|
+
}, {
|
|
426
|
+
type: "oauth";
|
|
427
|
+
provider: string;
|
|
428
|
+
requiredScopes?: string[] | undefined;
|
|
429
|
+
}>, z.ZodObject<{
|
|
430
|
+
type: z.ZodLiteral<"mdl">;
|
|
431
|
+
issuer: z.ZodString;
|
|
432
|
+
credentialType: z.ZodOptional<z.ZodString>;
|
|
433
|
+
}, "strip", z.ZodTypeAny, {
|
|
434
|
+
type: "mdl";
|
|
435
|
+
issuer: string;
|
|
436
|
+
credentialType?: string | undefined;
|
|
437
|
+
}, {
|
|
438
|
+
type: "mdl";
|
|
439
|
+
issuer: string;
|
|
440
|
+
credentialType?: string | undefined;
|
|
441
|
+
}>, z.ZodObject<{
|
|
442
|
+
type: z.ZodLiteral<"idv">;
|
|
443
|
+
provider: z.ZodString;
|
|
444
|
+
verificationLevel: z.ZodOptional<z.ZodEnum<["basic", "enhanced", "loa3"]>>;
|
|
445
|
+
}, "strip", z.ZodTypeAny, {
|
|
446
|
+
type: "idv";
|
|
447
|
+
provider: string;
|
|
448
|
+
verificationLevel?: "basic" | "enhanced" | "loa3" | undefined;
|
|
449
|
+
}, {
|
|
450
|
+
type: "idv";
|
|
451
|
+
provider: string;
|
|
452
|
+
verificationLevel?: "basic" | "enhanced" | "loa3" | undefined;
|
|
453
|
+
}>, z.ZodObject<{
|
|
454
|
+
type: z.ZodLiteral<"credential">;
|
|
455
|
+
credentialType: z.ZodString;
|
|
456
|
+
issuer: z.ZodOptional<z.ZodString>;
|
|
457
|
+
}, "strip", z.ZodTypeAny, {
|
|
458
|
+
type: "credential";
|
|
459
|
+
credentialType: string;
|
|
460
|
+
issuer?: string | undefined;
|
|
461
|
+
}, {
|
|
462
|
+
type: "credential";
|
|
463
|
+
credentialType: string;
|
|
464
|
+
issuer?: string | undefined;
|
|
465
|
+
}>, z.ZodObject<{
|
|
466
|
+
type: z.ZodLiteral<"none">;
|
|
467
|
+
}, "strip", z.ZodTypeAny, {
|
|
468
|
+
type: "none";
|
|
469
|
+
}, {
|
|
470
|
+
type: "none";
|
|
471
|
+
}>]>>;
|
|
131
472
|
}, "strip", z.ZodTypeAny, {
|
|
132
473
|
requiresDelegation: boolean;
|
|
133
474
|
requiredScopes: string[];
|
|
134
475
|
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
476
|
+
oauthProvider?: string | undefined;
|
|
477
|
+
authorization?: {
|
|
478
|
+
type: "oauth";
|
|
479
|
+
provider: string;
|
|
480
|
+
requiredScopes?: string[] | undefined;
|
|
481
|
+
} | {
|
|
482
|
+
type: "mdl";
|
|
483
|
+
issuer: string;
|
|
484
|
+
credentialType?: string | undefined;
|
|
485
|
+
} | {
|
|
486
|
+
type: "idv";
|
|
487
|
+
provider: string;
|
|
488
|
+
verificationLevel?: "basic" | "enhanced" | "loa3" | undefined;
|
|
489
|
+
} | {
|
|
490
|
+
type: "credential";
|
|
491
|
+
credentialType: string;
|
|
492
|
+
issuer?: string | undefined;
|
|
493
|
+
} | {
|
|
494
|
+
type: "none";
|
|
495
|
+
} | undefined;
|
|
135
496
|
}, {
|
|
136
497
|
requiresDelegation: boolean;
|
|
137
498
|
requiredScopes: string[];
|
|
138
499
|
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
500
|
+
oauthProvider?: string | undefined;
|
|
501
|
+
authorization?: {
|
|
502
|
+
type: "oauth";
|
|
503
|
+
provider: string;
|
|
504
|
+
requiredScopes?: string[] | undefined;
|
|
505
|
+
} | {
|
|
506
|
+
type: "mdl";
|
|
507
|
+
issuer: string;
|
|
508
|
+
credentialType?: string | undefined;
|
|
509
|
+
} | {
|
|
510
|
+
type: "idv";
|
|
511
|
+
provider: string;
|
|
512
|
+
verificationLevel?: "basic" | "enhanced" | "loa3" | undefined;
|
|
513
|
+
} | {
|
|
514
|
+
type: "credential";
|
|
515
|
+
credentialType: string;
|
|
516
|
+
issuer?: string | undefined;
|
|
517
|
+
} | {
|
|
518
|
+
type: "none";
|
|
519
|
+
} | undefined;
|
|
139
520
|
}>>;
|
|
140
521
|
metadata: z.ZodOptional<z.ZodObject<{
|
|
141
522
|
lastUpdated: z.ZodOptional<z.ZodString>;
|
|
@@ -155,6 +536,26 @@ export declare const ToolProtectionResponseSchema: z.ZodObject<{
|
|
|
155
536
|
requiresDelegation: boolean;
|
|
156
537
|
requiredScopes: string[];
|
|
157
538
|
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
539
|
+
oauthProvider?: string | undefined;
|
|
540
|
+
authorization?: {
|
|
541
|
+
type: "oauth";
|
|
542
|
+
provider: string;
|
|
543
|
+
requiredScopes?: string[] | undefined;
|
|
544
|
+
} | {
|
|
545
|
+
type: "mdl";
|
|
546
|
+
issuer: string;
|
|
547
|
+
credentialType?: string | undefined;
|
|
548
|
+
} | {
|
|
549
|
+
type: "idv";
|
|
550
|
+
provider: string;
|
|
551
|
+
verificationLevel?: "basic" | "enhanced" | "loa3" | undefined;
|
|
552
|
+
} | {
|
|
553
|
+
type: "credential";
|
|
554
|
+
credentialType: string;
|
|
555
|
+
issuer?: string | undefined;
|
|
556
|
+
} | {
|
|
557
|
+
type: "none";
|
|
558
|
+
} | undefined;
|
|
158
559
|
}>;
|
|
159
560
|
metadata?: {
|
|
160
561
|
version?: string | undefined;
|
|
@@ -166,6 +567,26 @@ export declare const ToolProtectionResponseSchema: z.ZodObject<{
|
|
|
166
567
|
requiresDelegation: boolean;
|
|
167
568
|
requiredScopes: string[];
|
|
168
569
|
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
570
|
+
oauthProvider?: string | undefined;
|
|
571
|
+
authorization?: {
|
|
572
|
+
type: "oauth";
|
|
573
|
+
provider: string;
|
|
574
|
+
requiredScopes?: string[] | undefined;
|
|
575
|
+
} | {
|
|
576
|
+
type: "mdl";
|
|
577
|
+
issuer: string;
|
|
578
|
+
credentialType?: string | undefined;
|
|
579
|
+
} | {
|
|
580
|
+
type: "idv";
|
|
581
|
+
provider: string;
|
|
582
|
+
verificationLevel?: "basic" | "enhanced" | "loa3" | undefined;
|
|
583
|
+
} | {
|
|
584
|
+
type: "credential";
|
|
585
|
+
credentialType: string;
|
|
586
|
+
issuer?: string | undefined;
|
|
587
|
+
} | {
|
|
588
|
+
type: "none";
|
|
589
|
+
} | undefined;
|
|
169
590
|
}>;
|
|
170
591
|
metadata?: {
|
|
171
592
|
version?: string | undefined;
|
|
@@ -183,14 +604,14 @@ export declare const DelegationRequiredErrorDataSchema: z.ZodObject<{
|
|
|
183
604
|
requiredScopes: string[];
|
|
184
605
|
toolName: string;
|
|
185
606
|
reason?: string | undefined;
|
|
186
|
-
consentUrl?: string | undefined;
|
|
187
607
|
authorizationUrl?: string | undefined;
|
|
608
|
+
consentUrl?: string | undefined;
|
|
188
609
|
}, {
|
|
189
610
|
requiredScopes: string[];
|
|
190
611
|
toolName: string;
|
|
191
612
|
reason?: string | undefined;
|
|
192
|
-
consentUrl?: string | undefined;
|
|
193
613
|
authorizationUrl?: string | undefined;
|
|
614
|
+
consentUrl?: string | undefined;
|
|
194
615
|
}>;
|
|
195
616
|
/**
|
|
196
617
|
* Type Guards
|
|
@@ -225,3 +646,10 @@ export declare function getToolRiskLevel(toolName: string, protections: ToolProt
|
|
|
225
646
|
* Create a delegation required error
|
|
226
647
|
*/
|
|
227
648
|
export declare function createDelegationRequiredError(toolName: string, requiredScopes: string[], consentUrl?: string): DelegationRequiredErrorData;
|
|
649
|
+
/**
|
|
650
|
+
* Normalize tool protection configuration
|
|
651
|
+
* Migrates legacy oauthProvider field to authorization object
|
|
652
|
+
*
|
|
653
|
+
* // TODO: Remove normalizeToolProtection() when all tools migrated (target: Phase 3)
|
|
654
|
+
*/
|
|
655
|
+
export declare function normalizeToolProtection(raw: ToolProtection): ToolProtection;
|