@kya-os/contracts 1.6.1 → 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 -214
- package/dist/config/identity.js +0 -29
- package/dist/config/index.d.ts +1 -2
- package/dist/consent/schemas.d.ts +1 -96
- package/dist/consent/schemas.js +1 -39
- package/dist/dashboard-config/schemas.d.ts +174 -1430
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -2
- package/dist/tool-protection/index.d.ts +2 -478
- 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
|
@@ -165,14 +165,13 @@ export type OAuthIdentity = z.infer<typeof oauthIdentitySchema>;
|
|
|
165
165
|
/**
|
|
166
166
|
* Consent Page Config Schema
|
|
167
167
|
*/
|
|
168
|
-
export declare const consentPageConfigSchema: z.
|
|
168
|
+
export declare const consentPageConfigSchema: z.ZodObject<{
|
|
169
169
|
tool: z.ZodString;
|
|
170
170
|
toolDescription: z.ZodString;
|
|
171
171
|
scopes: z.ZodArray<z.ZodString, "many">;
|
|
172
172
|
agentDid: z.ZodString;
|
|
173
173
|
sessionId: z.ZodString;
|
|
174
174
|
projectId: z.ZodString;
|
|
175
|
-
provider: z.ZodOptional<z.ZodString>;
|
|
176
175
|
branding: z.ZodOptional<z.ZodObject<{
|
|
177
176
|
primaryColor: z.ZodOptional<z.ZodString>;
|
|
178
177
|
logoUrl: z.ZodOptional<z.ZodString>;
|
|
@@ -269,16 +268,6 @@ export declare const consentPageConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
269
268
|
}>, "many">>;
|
|
270
269
|
serverUrl: z.ZodString;
|
|
271
270
|
autoClose: z.ZodOptional<z.ZodBoolean>;
|
|
272
|
-
/**
|
|
273
|
-
* Whether OAuth authorization is required immediately
|
|
274
|
-
* If true, the consent page will act as a landing page before redirecting
|
|
275
|
-
*/
|
|
276
|
-
oauthRequired: z.ZodOptional<z.ZodBoolean>;
|
|
277
|
-
/**
|
|
278
|
-
* The OAuth authorization URL to redirect to
|
|
279
|
-
* Required if oauthRequired is true
|
|
280
|
-
*/
|
|
281
|
-
oauthUrl: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodLiteral<"">]>>;
|
|
282
271
|
}, "strip", z.ZodTypeAny, {
|
|
283
272
|
agentDid: string;
|
|
284
273
|
sessionId: string;
|
|
@@ -287,79 +276,6 @@ export declare const consentPageConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
287
276
|
projectId: string;
|
|
288
277
|
toolDescription: string;
|
|
289
278
|
serverUrl: string;
|
|
290
|
-
provider?: string | undefined;
|
|
291
|
-
branding?: {
|
|
292
|
-
primaryColor?: string | undefined;
|
|
293
|
-
logoUrl?: string | undefined;
|
|
294
|
-
companyName?: string | undefined;
|
|
295
|
-
theme?: "light" | "dark" | "auto" | undefined;
|
|
296
|
-
} | undefined;
|
|
297
|
-
terms?: {
|
|
298
|
-
required: boolean;
|
|
299
|
-
version?: string | undefined;
|
|
300
|
-
url?: string | undefined;
|
|
301
|
-
text?: string | undefined;
|
|
302
|
-
} | undefined;
|
|
303
|
-
customFields?: {
|
|
304
|
-
type: "text" | "textarea" | "checkbox" | "select";
|
|
305
|
-
name: string;
|
|
306
|
-
required: boolean;
|
|
307
|
-
label: string;
|
|
308
|
-
options?: {
|
|
309
|
-
value: string;
|
|
310
|
-
label: string;
|
|
311
|
-
}[] | undefined;
|
|
312
|
-
placeholder?: string | undefined;
|
|
313
|
-
pattern?: string | undefined;
|
|
314
|
-
}[] | undefined;
|
|
315
|
-
autoClose?: boolean | undefined;
|
|
316
|
-
oauthRequired?: boolean | undefined;
|
|
317
|
-
oauthUrl?: string | undefined;
|
|
318
|
-
}, {
|
|
319
|
-
agentDid: string;
|
|
320
|
-
sessionId: string;
|
|
321
|
-
tool: string;
|
|
322
|
-
scopes: string[];
|
|
323
|
-
projectId: string;
|
|
324
|
-
toolDescription: string;
|
|
325
|
-
serverUrl: string;
|
|
326
|
-
provider?: string | undefined;
|
|
327
|
-
branding?: {
|
|
328
|
-
primaryColor?: string | undefined;
|
|
329
|
-
logoUrl?: string | undefined;
|
|
330
|
-
companyName?: string | undefined;
|
|
331
|
-
theme?: "light" | "dark" | "auto" | undefined;
|
|
332
|
-
} | undefined;
|
|
333
|
-
terms?: {
|
|
334
|
-
version?: string | undefined;
|
|
335
|
-
url?: string | undefined;
|
|
336
|
-
required?: boolean | undefined;
|
|
337
|
-
text?: string | undefined;
|
|
338
|
-
} | undefined;
|
|
339
|
-
customFields?: {
|
|
340
|
-
type: "text" | "textarea" | "checkbox" | "select";
|
|
341
|
-
name: string;
|
|
342
|
-
required: boolean;
|
|
343
|
-
label: string;
|
|
344
|
-
options?: {
|
|
345
|
-
value: string;
|
|
346
|
-
label: string;
|
|
347
|
-
}[] | undefined;
|
|
348
|
-
placeholder?: string | undefined;
|
|
349
|
-
pattern?: string | undefined;
|
|
350
|
-
}[] | undefined;
|
|
351
|
-
autoClose?: boolean | undefined;
|
|
352
|
-
oauthRequired?: boolean | undefined;
|
|
353
|
-
oauthUrl?: string | undefined;
|
|
354
|
-
}>, {
|
|
355
|
-
agentDid: string;
|
|
356
|
-
sessionId: string;
|
|
357
|
-
tool: string;
|
|
358
|
-
scopes: string[];
|
|
359
|
-
projectId: string;
|
|
360
|
-
toolDescription: string;
|
|
361
|
-
serverUrl: string;
|
|
362
|
-
provider?: string | undefined;
|
|
363
279
|
branding?: {
|
|
364
280
|
primaryColor?: string | undefined;
|
|
365
281
|
logoUrl?: string | undefined;
|
|
@@ -385,8 +301,6 @@ export declare const consentPageConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
385
301
|
pattern?: string | undefined;
|
|
386
302
|
}[] | undefined;
|
|
387
303
|
autoClose?: boolean | undefined;
|
|
388
|
-
oauthRequired?: boolean | undefined;
|
|
389
|
-
oauthUrl?: string | undefined;
|
|
390
304
|
}, {
|
|
391
305
|
agentDid: string;
|
|
392
306
|
sessionId: string;
|
|
@@ -395,7 +309,6 @@ export declare const consentPageConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
395
309
|
projectId: string;
|
|
396
310
|
toolDescription: string;
|
|
397
311
|
serverUrl: string;
|
|
398
|
-
provider?: string | undefined;
|
|
399
312
|
branding?: {
|
|
400
313
|
primaryColor?: string | undefined;
|
|
401
314
|
logoUrl?: string | undefined;
|
|
@@ -421,8 +334,6 @@ export declare const consentPageConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
421
334
|
pattern?: string | undefined;
|
|
422
335
|
}[] | undefined;
|
|
423
336
|
autoClose?: boolean | undefined;
|
|
424
|
-
oauthRequired?: boolean | undefined;
|
|
425
|
-
oauthUrl?: string | undefined;
|
|
426
337
|
}>;
|
|
427
338
|
export type ConsentPageConfig = z.infer<typeof consentPageConfigSchema>;
|
|
428
339
|
/**
|
|
@@ -749,7 +660,6 @@ export declare function validateConsentPageConfig(config: unknown): z.SafeParseR
|
|
|
749
660
|
projectId: string;
|
|
750
661
|
toolDescription: string;
|
|
751
662
|
serverUrl: string;
|
|
752
|
-
provider?: string | undefined;
|
|
753
663
|
branding?: {
|
|
754
664
|
primaryColor?: string | undefined;
|
|
755
665
|
logoUrl?: string | undefined;
|
|
@@ -775,8 +685,6 @@ export declare function validateConsentPageConfig(config: unknown): z.SafeParseR
|
|
|
775
685
|
pattern?: string | undefined;
|
|
776
686
|
}[] | undefined;
|
|
777
687
|
autoClose?: boolean | undefined;
|
|
778
|
-
oauthRequired?: boolean | undefined;
|
|
779
|
-
oauthUrl?: string | undefined;
|
|
780
688
|
}, {
|
|
781
689
|
agentDid: string;
|
|
782
690
|
sessionId: string;
|
|
@@ -785,7 +693,6 @@ export declare function validateConsentPageConfig(config: unknown): z.SafeParseR
|
|
|
785
693
|
projectId: string;
|
|
786
694
|
toolDescription: string;
|
|
787
695
|
serverUrl: string;
|
|
788
|
-
provider?: string | undefined;
|
|
789
696
|
branding?: {
|
|
790
697
|
primaryColor?: string | undefined;
|
|
791
698
|
logoUrl?: string | undefined;
|
|
@@ -811,8 +718,6 @@ export declare function validateConsentPageConfig(config: unknown): z.SafeParseR
|
|
|
811
718
|
pattern?: string | undefined;
|
|
812
719
|
}[] | undefined;
|
|
813
720
|
autoClose?: boolean | undefined;
|
|
814
|
-
oauthRequired?: boolean | undefined;
|
|
815
|
-
oauthUrl?: string | undefined;
|
|
816
721
|
}>;
|
|
817
722
|
/**
|
|
818
723
|
* Validate a consent approval request
|
package/dist/consent/schemas.js
CHANGED
|
@@ -132,8 +132,7 @@ exports.oauthIdentitySchema = zod_1.z.object({
|
|
|
132
132
|
/**
|
|
133
133
|
* Consent Page Config Schema
|
|
134
134
|
*/
|
|
135
|
-
exports.consentPageConfigSchema = zod_1.z
|
|
136
|
-
.object({
|
|
135
|
+
exports.consentPageConfigSchema = zod_1.z.object({
|
|
137
136
|
tool: zod_1.z.string().min(1, "Tool name is required"),
|
|
138
137
|
toolDescription: zod_1.z
|
|
139
138
|
.string()
|
|
@@ -142,7 +141,6 @@ exports.consentPageConfigSchema = zod_1.z
|
|
|
142
141
|
agentDid: zod_1.z.string().min(1, "Agent DID is required"),
|
|
143
142
|
sessionId: zod_1.z.string().min(1, "Session ID is required"),
|
|
144
143
|
projectId: zod_1.z.string().min(1, "Project ID is required"),
|
|
145
|
-
provider: zod_1.z.string().optional(), // Phase 2: OAuth provider name (e.g., "github", "google")
|
|
146
144
|
branding: exports.consentBrandingSchema.optional(),
|
|
147
145
|
terms: exports.consentTermsSchema.optional(),
|
|
148
146
|
customFields: zod_1.z
|
|
@@ -151,42 +149,6 @@ exports.consentPageConfigSchema = zod_1.z
|
|
|
151
149
|
.optional(),
|
|
152
150
|
serverUrl: zod_1.z.string().url("Server URL must be a valid URL"),
|
|
153
151
|
autoClose: zod_1.z.boolean().optional(),
|
|
154
|
-
/**
|
|
155
|
-
* Whether OAuth authorization is required immediately
|
|
156
|
-
* If true, the consent page will act as a landing page before redirecting
|
|
157
|
-
*/
|
|
158
|
-
oauthRequired: zod_1.z.boolean().optional(),
|
|
159
|
-
/**
|
|
160
|
-
* The OAuth authorization URL to redirect to
|
|
161
|
-
* Required if oauthRequired is true
|
|
162
|
-
*/
|
|
163
|
-
oauthUrl: zod_1.z
|
|
164
|
-
.union([
|
|
165
|
-
zod_1.z.string().url(),
|
|
166
|
-
zod_1.z.literal(""), // Allow empty string to catch it in refine with better error
|
|
167
|
-
])
|
|
168
|
-
.optional(),
|
|
169
|
-
})
|
|
170
|
-
.superRefine((data, ctx) => {
|
|
171
|
-
// If oauthRequired is true, oauthUrl must be provided and non-empty
|
|
172
|
-
if (data.oauthRequired === true) {
|
|
173
|
-
if (data.oauthUrl === undefined || data.oauthUrl === "") {
|
|
174
|
-
ctx.addIssue({
|
|
175
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
176
|
-
message: "oauthUrl is required when oauthRequired is true",
|
|
177
|
-
path: ["oauthUrl"],
|
|
178
|
-
});
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
// If oauthUrl is provided (not undefined), it must be a valid URL (not empty)
|
|
183
|
-
if (data.oauthUrl !== undefined && data.oauthUrl === "") {
|
|
184
|
-
ctx.addIssue({
|
|
185
|
-
code: zod_1.z.ZodIssueCode.custom,
|
|
186
|
-
message: "oauthUrl must be a valid URL",
|
|
187
|
-
path: ["oauthUrl"],
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
152
|
});
|
|
191
153
|
/**
|
|
192
154
|
* Consent Approval Request Schema
|