@kya-os/contracts 1.3.3 → 1.3.4
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/package.json +3 -2
- package/README.md +0 -130
- package/dist/agentshield-api/endpoints.d.ts +0 -21
- package/dist/agentshield-api/endpoints.js +0 -20
- package/dist/agentshield-api/index.d.ts +0 -5
- package/dist/agentshield-api/index.js +0 -27
- package/dist/agentshield-api/schemas.d.ts +0 -9846
- package/dist/agentshield-api/schemas.js +0 -92
- package/dist/agentshield-api/types.d.ts +0 -92
- package/dist/agentshield-api/types.js +0 -12
- package/dist/cli.d.ts +0 -375
- package/dist/cli.js +0 -109
- package/dist/config/base.d.ts +0 -19
- package/dist/config/base.js +0 -2
- package/dist/config/delegation.d.ts +0 -46
- package/dist/config/delegation.js +0 -2
- package/dist/config/identity.d.ts +0 -22
- package/dist/config/identity.js +0 -2
- package/dist/config/index.d.ts +0 -17
- package/dist/config/index.js +0 -2
- package/dist/config/proofing.d.ts +0 -26
- package/dist/config/proofing.js +0 -2
- package/dist/config/tool-protection.d.ts +0 -36
- package/dist/config/tool-protection.js +0 -2
- package/dist/delegation/constraints.d.ts +0 -726
- package/dist/delegation/constraints.js +0 -103
- package/dist/delegation/index.d.ts +0 -2
- package/dist/delegation/index.js +0 -18
- package/dist/delegation/schemas.d.ts +0 -8042
- package/dist/delegation/schemas.js +0 -232
- package/dist/did/index.d.ts +0 -3
- package/dist/did/index.js +0 -19
- package/dist/did/resolve-contract.d.ts +0 -53
- package/dist/did/resolve-contract.js +0 -12
- package/dist/did/schemas.d.ts +0 -33
- package/dist/did/schemas.js +0 -80
- package/dist/did/types.d.ts +0 -38
- package/dist/did/types.js +0 -37
- package/dist/env/constants.d.ts +0 -13
- package/dist/env/constants.js +0 -15
- package/dist/env/index.d.ts +0 -1
- package/dist/env/index.js +0 -17
- package/dist/handshake.d.ts +0 -138
- package/dist/handshake.js +0 -50
- package/dist/index.d.ts +0 -11
- package/dist/index.js +0 -28
- package/dist/proof/index.d.ts +0 -2
- package/dist/proof/index.js +0 -18
- package/dist/proof/proof-record.d.ts +0 -728
- package/dist/proof/proof-record.js +0 -60
- package/dist/proof/signing-spec.d.ts +0 -73
- package/dist/proof/signing-spec.js +0 -52
- package/dist/proof.d.ts +0 -378
- package/dist/proof.js +0 -59
- package/dist/registry.d.ts +0 -326
- package/dist/registry.js +0 -98
- package/dist/runtime/errors.d.ts +0 -179
- package/dist/runtime/errors.js +0 -51
- package/dist/runtime/headers.d.ts +0 -34
- package/dist/runtime/headers.js +0 -52
- package/dist/runtime/index.d.ts +0 -2
- package/dist/runtime/index.js +0 -18
- package/dist/test.d.ts +0 -215
- package/dist/test.js +0 -83
- package/dist/tlkrc/index.d.ts +0 -1
- package/dist/tlkrc/index.js +0 -17
- package/dist/tlkrc/rotation.d.ts +0 -168
- package/dist/tlkrc/rotation.js +0 -55
- package/dist/tool-protection/index.d.ts +0 -129
- package/dist/tool-protection/index.js +0 -80
- package/dist/utils/validation.d.ts +0 -14
- package/dist/utils/validation.js +0 -56
- package/dist/vc/index.d.ts +0 -2
- package/dist/vc/index.js +0 -18
- package/dist/vc/schemas.d.ts +0 -1888
- package/dist/vc/schemas.js +0 -116
- package/dist/vc/statuslist.d.ts +0 -292
- package/dist/vc/statuslist.js +0 -61
- package/dist/verifier.d.ts +0 -202
- package/dist/verifier.js +0 -76
- package/dist/well-known/index.d.ts +0 -248
- package/dist/well-known/index.js +0 -104
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export interface ToolProtection {
|
|
3
|
-
requiresDelegation: boolean;
|
|
4
|
-
requiredScopes: string[];
|
|
5
|
-
riskLevel?: 'low' | 'medium' | 'high' | 'critical';
|
|
6
|
-
}
|
|
7
|
-
export type ToolProtectionMap = Record<string, ToolProtection>;
|
|
8
|
-
export interface ToolProtectionResponse {
|
|
9
|
-
toolProtections: ToolProtectionMap;
|
|
10
|
-
metadata?: {
|
|
11
|
-
lastUpdated?: string;
|
|
12
|
-
version?: string;
|
|
13
|
-
source?: string;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export interface DelegationRequiredErrorData {
|
|
17
|
-
toolName: string;
|
|
18
|
-
requiredScopes: string[];
|
|
19
|
-
consentUrl?: string;
|
|
20
|
-
authorizationUrl?: string;
|
|
21
|
-
reason?: string;
|
|
22
|
-
}
|
|
23
|
-
export declare const ToolProtectionSchema: z.ZodObject<{
|
|
24
|
-
requiresDelegation: z.ZodBoolean;
|
|
25
|
-
requiredScopes: z.ZodArray<z.ZodString, "many">;
|
|
26
|
-
riskLevel: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
|
|
27
|
-
}, "strip", z.ZodTypeAny, {
|
|
28
|
-
requiresDelegation: boolean;
|
|
29
|
-
requiredScopes: string[];
|
|
30
|
-
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
31
|
-
}, {
|
|
32
|
-
requiresDelegation: boolean;
|
|
33
|
-
requiredScopes: string[];
|
|
34
|
-
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
35
|
-
}>;
|
|
36
|
-
export declare const ToolProtectionMapSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
37
|
-
requiresDelegation: z.ZodBoolean;
|
|
38
|
-
requiredScopes: z.ZodArray<z.ZodString, "many">;
|
|
39
|
-
riskLevel: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
|
|
40
|
-
}, "strip", z.ZodTypeAny, {
|
|
41
|
-
requiresDelegation: boolean;
|
|
42
|
-
requiredScopes: string[];
|
|
43
|
-
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
44
|
-
}, {
|
|
45
|
-
requiresDelegation: boolean;
|
|
46
|
-
requiredScopes: string[];
|
|
47
|
-
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
48
|
-
}>>;
|
|
49
|
-
export declare const ToolProtectionResponseSchema: z.ZodObject<{
|
|
50
|
-
toolProtections: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
51
|
-
requiresDelegation: z.ZodBoolean;
|
|
52
|
-
requiredScopes: z.ZodArray<z.ZodString, "many">;
|
|
53
|
-
riskLevel: z.ZodOptional<z.ZodEnum<["low", "medium", "high", "critical"]>>;
|
|
54
|
-
}, "strip", z.ZodTypeAny, {
|
|
55
|
-
requiresDelegation: boolean;
|
|
56
|
-
requiredScopes: string[];
|
|
57
|
-
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
58
|
-
}, {
|
|
59
|
-
requiresDelegation: boolean;
|
|
60
|
-
requiredScopes: string[];
|
|
61
|
-
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
62
|
-
}>>;
|
|
63
|
-
metadata: z.ZodOptional<z.ZodObject<{
|
|
64
|
-
lastUpdated: z.ZodOptional<z.ZodString>;
|
|
65
|
-
version: z.ZodOptional<z.ZodString>;
|
|
66
|
-
source: z.ZodOptional<z.ZodString>;
|
|
67
|
-
}, "strip", z.ZodTypeAny, {
|
|
68
|
-
version?: string | undefined;
|
|
69
|
-
lastUpdated?: string | undefined;
|
|
70
|
-
source?: string | undefined;
|
|
71
|
-
}, {
|
|
72
|
-
version?: string | undefined;
|
|
73
|
-
lastUpdated?: string | undefined;
|
|
74
|
-
source?: string | undefined;
|
|
75
|
-
}>>;
|
|
76
|
-
}, "strip", z.ZodTypeAny, {
|
|
77
|
-
toolProtections: Record<string, {
|
|
78
|
-
requiresDelegation: boolean;
|
|
79
|
-
requiredScopes: string[];
|
|
80
|
-
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
81
|
-
}>;
|
|
82
|
-
metadata?: {
|
|
83
|
-
version?: string | undefined;
|
|
84
|
-
lastUpdated?: string | undefined;
|
|
85
|
-
source?: string | undefined;
|
|
86
|
-
} | undefined;
|
|
87
|
-
}, {
|
|
88
|
-
toolProtections: Record<string, {
|
|
89
|
-
requiresDelegation: boolean;
|
|
90
|
-
requiredScopes: string[];
|
|
91
|
-
riskLevel?: "low" | "medium" | "high" | "critical" | undefined;
|
|
92
|
-
}>;
|
|
93
|
-
metadata?: {
|
|
94
|
-
version?: string | undefined;
|
|
95
|
-
lastUpdated?: string | undefined;
|
|
96
|
-
source?: string | undefined;
|
|
97
|
-
} | undefined;
|
|
98
|
-
}>;
|
|
99
|
-
export declare const DelegationRequiredErrorDataSchema: z.ZodObject<{
|
|
100
|
-
toolName: z.ZodString;
|
|
101
|
-
requiredScopes: z.ZodArray<z.ZodString, "many">;
|
|
102
|
-
consentUrl: z.ZodOptional<z.ZodString>;
|
|
103
|
-
authorizationUrl: z.ZodOptional<z.ZodString>;
|
|
104
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
105
|
-
}, "strip", z.ZodTypeAny, {
|
|
106
|
-
requiredScopes: string[];
|
|
107
|
-
toolName: string;
|
|
108
|
-
reason?: string | undefined;
|
|
109
|
-
consentUrl?: string | undefined;
|
|
110
|
-
authorizationUrl?: string | undefined;
|
|
111
|
-
}, {
|
|
112
|
-
requiredScopes: string[];
|
|
113
|
-
toolName: string;
|
|
114
|
-
reason?: string | undefined;
|
|
115
|
-
consentUrl?: string | undefined;
|
|
116
|
-
authorizationUrl?: string | undefined;
|
|
117
|
-
}>;
|
|
118
|
-
export declare function isToolProtection(obj: any): obj is ToolProtection;
|
|
119
|
-
export declare function isToolProtectionMap(obj: any): obj is ToolProtectionMap;
|
|
120
|
-
export declare function isToolProtectionResponse(obj: any): obj is ToolProtectionResponse;
|
|
121
|
-
export declare function isDelegationRequiredErrorData(obj: any): obj is DelegationRequiredErrorData;
|
|
122
|
-
export declare function validateToolProtection(obj: any): ToolProtection;
|
|
123
|
-
export declare function validateToolProtectionMap(obj: any): ToolProtectionMap;
|
|
124
|
-
export declare function validateToolProtectionResponse(obj: any): ToolProtectionResponse;
|
|
125
|
-
export declare function validateDelegationRequiredErrorData(obj: any): DelegationRequiredErrorData;
|
|
126
|
-
export declare function toolRequiresDelegation(toolName: string, protections: ToolProtectionMap): boolean;
|
|
127
|
-
export declare function getToolRequiredScopes(toolName: string, protections: ToolProtectionMap): string[];
|
|
128
|
-
export declare function getToolRiskLevel(toolName: string, protections: ToolProtectionMap): ToolProtection['riskLevel'] | undefined;
|
|
129
|
-
export declare function createDelegationRequiredError(toolName: string, requiredScopes: string[], consentUrl?: string): DelegationRequiredErrorData;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DelegationRequiredErrorDataSchema = exports.ToolProtectionResponseSchema = exports.ToolProtectionMapSchema = exports.ToolProtectionSchema = void 0;
|
|
4
|
-
exports.isToolProtection = isToolProtection;
|
|
5
|
-
exports.isToolProtectionMap = isToolProtectionMap;
|
|
6
|
-
exports.isToolProtectionResponse = isToolProtectionResponse;
|
|
7
|
-
exports.isDelegationRequiredErrorData = isDelegationRequiredErrorData;
|
|
8
|
-
exports.validateToolProtection = validateToolProtection;
|
|
9
|
-
exports.validateToolProtectionMap = validateToolProtectionMap;
|
|
10
|
-
exports.validateToolProtectionResponse = validateToolProtectionResponse;
|
|
11
|
-
exports.validateDelegationRequiredErrorData = validateDelegationRequiredErrorData;
|
|
12
|
-
exports.toolRequiresDelegation = toolRequiresDelegation;
|
|
13
|
-
exports.getToolRequiredScopes = getToolRequiredScopes;
|
|
14
|
-
exports.getToolRiskLevel = getToolRiskLevel;
|
|
15
|
-
exports.createDelegationRequiredError = createDelegationRequiredError;
|
|
16
|
-
const zod_1 = require("zod");
|
|
17
|
-
exports.ToolProtectionSchema = zod_1.z.object({
|
|
18
|
-
requiresDelegation: zod_1.z.boolean(),
|
|
19
|
-
requiredScopes: zod_1.z.array(zod_1.z.string()),
|
|
20
|
-
riskLevel: zod_1.z.enum(['low', 'medium', 'high', 'critical']).optional()
|
|
21
|
-
});
|
|
22
|
-
exports.ToolProtectionMapSchema = zod_1.z.record(zod_1.z.string(), exports.ToolProtectionSchema);
|
|
23
|
-
exports.ToolProtectionResponseSchema = zod_1.z.object({
|
|
24
|
-
toolProtections: exports.ToolProtectionMapSchema,
|
|
25
|
-
metadata: zod_1.z.object({
|
|
26
|
-
lastUpdated: zod_1.z.string().optional(),
|
|
27
|
-
version: zod_1.z.string().optional(),
|
|
28
|
-
source: zod_1.z.string().optional()
|
|
29
|
-
}).optional()
|
|
30
|
-
});
|
|
31
|
-
exports.DelegationRequiredErrorDataSchema = zod_1.z.object({
|
|
32
|
-
toolName: zod_1.z.string(),
|
|
33
|
-
requiredScopes: zod_1.z.array(zod_1.z.string()),
|
|
34
|
-
consentUrl: zod_1.z.string().optional(),
|
|
35
|
-
authorizationUrl: zod_1.z.string().optional(),
|
|
36
|
-
reason: zod_1.z.string().optional()
|
|
37
|
-
});
|
|
38
|
-
function isToolProtection(obj) {
|
|
39
|
-
return exports.ToolProtectionSchema.safeParse(obj).success;
|
|
40
|
-
}
|
|
41
|
-
function isToolProtectionMap(obj) {
|
|
42
|
-
return exports.ToolProtectionMapSchema.safeParse(obj).success;
|
|
43
|
-
}
|
|
44
|
-
function isToolProtectionResponse(obj) {
|
|
45
|
-
return exports.ToolProtectionResponseSchema.safeParse(obj).success;
|
|
46
|
-
}
|
|
47
|
-
function isDelegationRequiredErrorData(obj) {
|
|
48
|
-
return exports.DelegationRequiredErrorDataSchema.safeParse(obj).success;
|
|
49
|
-
}
|
|
50
|
-
function validateToolProtection(obj) {
|
|
51
|
-
return exports.ToolProtectionSchema.parse(obj);
|
|
52
|
-
}
|
|
53
|
-
function validateToolProtectionMap(obj) {
|
|
54
|
-
return exports.ToolProtectionMapSchema.parse(obj);
|
|
55
|
-
}
|
|
56
|
-
function validateToolProtectionResponse(obj) {
|
|
57
|
-
return exports.ToolProtectionResponseSchema.parse(obj);
|
|
58
|
-
}
|
|
59
|
-
function validateDelegationRequiredErrorData(obj) {
|
|
60
|
-
return exports.DelegationRequiredErrorDataSchema.parse(obj);
|
|
61
|
-
}
|
|
62
|
-
function toolRequiresDelegation(toolName, protections) {
|
|
63
|
-
const protection = protections[toolName];
|
|
64
|
-
return protection?.requiresDelegation ?? false;
|
|
65
|
-
}
|
|
66
|
-
function getToolRequiredScopes(toolName, protections) {
|
|
67
|
-
const protection = protections[toolName];
|
|
68
|
-
return protection?.requiredScopes ?? [];
|
|
69
|
-
}
|
|
70
|
-
function getToolRiskLevel(toolName, protections) {
|
|
71
|
-
return protections[toolName]?.riskLevel;
|
|
72
|
-
}
|
|
73
|
-
function createDelegationRequiredError(toolName, requiredScopes, consentUrl) {
|
|
74
|
-
return {
|
|
75
|
-
toolName,
|
|
76
|
-
requiredScopes,
|
|
77
|
-
consentUrl,
|
|
78
|
-
authorizationUrl: consentUrl
|
|
79
|
-
};
|
|
80
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export interface ValidationResult<T = any> {
|
|
3
|
-
valid: boolean;
|
|
4
|
-
data?: T;
|
|
5
|
-
errors: string[];
|
|
6
|
-
}
|
|
7
|
-
export declare function validateInput<T>(schema: z.ZodSchema<T>, data: unknown, context?: string): ValidationResult<T>;
|
|
8
|
-
export declare function hasRequiredProperties(obj: any, properties: string[], context?: string): ValidationResult;
|
|
9
|
-
export declare const StringValidators: {
|
|
10
|
-
did: (value: string) => boolean;
|
|
11
|
-
kid: (value: string) => boolean;
|
|
12
|
-
url: (value: string) => boolean;
|
|
13
|
-
projectName: (value: string) => boolean;
|
|
14
|
-
};
|
package/dist/utils/validation.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StringValidators = void 0;
|
|
4
|
-
exports.validateInput = validateInput;
|
|
5
|
-
exports.hasRequiredProperties = hasRequiredProperties;
|
|
6
|
-
function validateInput(schema, data, context) {
|
|
7
|
-
const result = schema.safeParse(data);
|
|
8
|
-
if (result.success) {
|
|
9
|
-
return {
|
|
10
|
-
valid: true,
|
|
11
|
-
data: result.data,
|
|
12
|
-
errors: [],
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
const errors = result.error.errors.map((err) => {
|
|
16
|
-
const path = err.path.length > 0 ? ` at ${err.path.join(".")}` : "";
|
|
17
|
-
const contextStr = context ? ` (${context})` : "";
|
|
18
|
-
return `${err.message}${path}${contextStr}`;
|
|
19
|
-
});
|
|
20
|
-
return {
|
|
21
|
-
valid: false,
|
|
22
|
-
errors,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function hasRequiredProperties(obj, properties, context) {
|
|
26
|
-
if (typeof obj !== "object" || obj === null) {
|
|
27
|
-
return {
|
|
28
|
-
valid: false,
|
|
29
|
-
errors: [`Expected object${context ? ` for ${context}` : ""}`],
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
const missing = properties.filter((prop) => !(prop in obj));
|
|
33
|
-
if (missing.length > 0) {
|
|
34
|
-
return {
|
|
35
|
-
valid: false,
|
|
36
|
-
errors: [
|
|
37
|
-
`Missing required properties: ${missing.join(", ")}${context ? ` in ${context}` : ""}`,
|
|
38
|
-
],
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
return { valid: true, errors: [] };
|
|
42
|
-
}
|
|
43
|
-
exports.StringValidators = {
|
|
44
|
-
did: (value) => /^did:[a-z0-9]+:[a-zA-Z0-9._-]+$/.test(value),
|
|
45
|
-
kid: (value) => /^[a-zA-Z0-9._-]+$/.test(value),
|
|
46
|
-
url: (value) => {
|
|
47
|
-
try {
|
|
48
|
-
new URL(value);
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
catch {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
projectName: (value) => /^[a-z0-9-]+$/.test(value) && value.length >= 1 && value.length <= 214,
|
|
56
|
-
};
|
package/dist/vc/index.d.ts
DELETED
package/dist/vc/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./schemas.js"), exports);
|
|
18
|
-
__exportStar(require("./statuslist.js"), exports);
|