@kya-os/contracts 1.3.4 → 1.4.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/endpoints.d.ts +50 -0
- package/dist/agentshield-api/endpoints.js +46 -0
- package/dist/agentshield-api/index.d.ts +13 -0
- package/dist/agentshield-api/index.js +38 -0
- package/dist/agentshield-api/schemas.d.ts +9914 -0
- package/dist/agentshield-api/schemas.js +165 -0
- package/dist/agentshield-api/types.d.ts +168 -0
- package/dist/agentshield-api/types.js +27 -0
- package/dist/cli.d.ts +388 -0
- package/dist/cli.js +121 -0
- package/dist/config/base.d.ts +96 -0
- package/dist/config/base.js +11 -0
- package/dist/config/delegation.d.ts +194 -0
- package/dist/config/delegation.js +10 -0
- package/dist/config/identity.d.ts +117 -0
- package/dist/config/identity.js +11 -0
- package/dist/config/index.d.ts +33 -0
- package/dist/config/index.js +11 -0
- package/dist/config/proofing.d.ts +120 -0
- package/dist/config/proofing.js +10 -0
- package/dist/config/tool-protection.d.ts +139 -0
- package/dist/config/tool-protection.js +10 -0
- package/dist/dashboard-config/index.d.ts +10 -0
- package/dist/dashboard-config/index.js +31 -0
- package/dist/dashboard-config/schemas.d.ts +5847 -0
- package/dist/dashboard-config/schemas.js +251 -0
- package/dist/dashboard-config/types.d.ts +331 -0
- package/dist/dashboard-config/types.js +11 -0
- package/dist/delegation/constraints.d.ts +991 -0
- package/dist/delegation/constraints.js +209 -0
- package/dist/delegation/index.d.ts +7 -0
- package/dist/delegation/index.js +23 -0
- package/dist/delegation/schemas.d.ts +8381 -0
- package/dist/delegation/schemas.js +475 -0
- package/dist/did/index.d.ts +8 -0
- package/dist/did/index.js +24 -0
- package/dist/did/resolve-contract.d.ts +219 -0
- package/dist/did/resolve-contract.js +31 -0
- package/dist/did/schemas.d.ts +112 -0
- package/dist/did/schemas.js +172 -0
- package/dist/did/types.d.ts +163 -0
- package/dist/did/types.js +70 -0
- package/dist/env/constants.d.ts +57 -0
- package/dist/env/constants.js +59 -0
- package/dist/env/index.d.ts +4 -0
- package/dist/env/index.js +20 -0
- package/dist/handshake.d.ts +158 -0
- package/dist/handshake.js +57 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +56 -0
- package/dist/proof/index.d.ts +8 -0
- package/dist/proof/index.js +24 -0
- package/dist/proof/proof-record.d.ts +837 -0
- package/dist/proof/proof-record.js +133 -0
- package/dist/proof/signing-spec.d.ts +146 -0
- package/dist/proof/signing-spec.js +122 -0
- package/dist/proof.d.ts +415 -0
- package/dist/proof.js +83 -0
- package/dist/registry.d.ts +342 -0
- package/dist/registry.js +118 -0
- package/dist/runtime/errors.d.ts +347 -0
- package/dist/runtime/errors.js +119 -0
- package/dist/runtime/headers.d.ts +83 -0
- package/dist/runtime/headers.js +81 -0
- package/dist/runtime/index.d.ts +5 -0
- package/dist/runtime/index.js +21 -0
- package/dist/test.d.ts +251 -0
- package/dist/test.js +119 -0
- package/dist/tlkrc/index.d.ts +4 -0
- package/dist/tlkrc/index.js +20 -0
- package/dist/tlkrc/rotation.d.ts +245 -0
- package/dist/tlkrc/rotation.js +126 -0
- package/dist/tool-protection/index.d.ts +227 -0
- package/dist/tool-protection/index.js +113 -0
- package/dist/utils/validation.d.ts +30 -0
- package/dist/utils/validation.js +69 -0
- package/dist/vc/index.d.ts +7 -0
- package/dist/vc/index.js +23 -0
- package/dist/vc/schemas.d.ts +2483 -0
- package/dist/vc/schemas.js +224 -0
- package/dist/vc/statuslist.d.ts +493 -0
- package/dist/vc/statuslist.js +132 -0
- package/dist/verifier.d.ts +205 -0
- package/dist/verifier.js +83 -0
- package/dist/well-known/index.d.ts +308 -0
- package/dist/well-known/index.js +134 -0
- package/package.json +6 -1
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MCP-I Well-Known Endpoints Specification
|
|
4
|
+
*
|
|
5
|
+
* This module defines the types for well-known endpoints as specified in the
|
|
6
|
+
* MCP-I protocol. These endpoints provide identity discovery and verification
|
|
7
|
+
* capabilities for MCP-I agents.
|
|
8
|
+
*
|
|
9
|
+
* @module @kya-os/contracts/well-known
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.WellKnownResponseSchema = exports.WellKnownConfigSchema = exports.MCPIdentitySchema = exports.AgentDocumentSchema = exports.DIDDocumentSchema = exports.WellKnownPath = void 0;
|
|
13
|
+
exports.isDIDDocument = isDIDDocument;
|
|
14
|
+
exports.isAgentDocument = isAgentDocument;
|
|
15
|
+
exports.isMCPIdentity = isMCPIdentity;
|
|
16
|
+
exports.validateDIDDocument = validateDIDDocument;
|
|
17
|
+
exports.validateAgentDocument = validateAgentDocument;
|
|
18
|
+
exports.validateMCPIdentity = validateMCPIdentity;
|
|
19
|
+
exports.isWellKnownPath = isWellKnownPath;
|
|
20
|
+
exports.getWellKnownContentType = getWellKnownContentType;
|
|
21
|
+
const zod_1 = require("zod");
|
|
22
|
+
/**
|
|
23
|
+
* Well-known endpoint paths
|
|
24
|
+
*/
|
|
25
|
+
var WellKnownPath;
|
|
26
|
+
(function (WellKnownPath) {
|
|
27
|
+
WellKnownPath["DID_DOCUMENT"] = "/.well-known/did.json";
|
|
28
|
+
WellKnownPath["AGENT_DOCUMENT"] = "/.well-known/agent.json";
|
|
29
|
+
WellKnownPath["MCP_IDENTITY"] = "/.well-known/mcp-identity";
|
|
30
|
+
WellKnownPath["TOOL_PROTECTIONS"] = "/.well-known/tool-protections.json";
|
|
31
|
+
})(WellKnownPath || (exports.WellKnownPath = WellKnownPath = {}));
|
|
32
|
+
/**
|
|
33
|
+
* Zod Schemas for Validation
|
|
34
|
+
*/
|
|
35
|
+
exports.DIDDocumentSchema = zod_1.z.object({
|
|
36
|
+
'@context': zod_1.z.array(zod_1.z.string()),
|
|
37
|
+
id: zod_1.z.string(),
|
|
38
|
+
verificationMethod: zod_1.z.array(zod_1.z.object({
|
|
39
|
+
id: zod_1.z.string(),
|
|
40
|
+
type: zod_1.z.string(),
|
|
41
|
+
controller: zod_1.z.string(),
|
|
42
|
+
publicKeyBase64: zod_1.z.string().optional(),
|
|
43
|
+
publicKeyMultibase: zod_1.z.string().optional()
|
|
44
|
+
})),
|
|
45
|
+
authentication: zod_1.z.array(zod_1.z.string()).optional(),
|
|
46
|
+
assertionMethod: zod_1.z.array(zod_1.z.string()).optional(),
|
|
47
|
+
capabilityInvocation: zod_1.z.array(zod_1.z.string()).optional(),
|
|
48
|
+
capabilityDelegation: zod_1.z.array(zod_1.z.string()).optional(),
|
|
49
|
+
keyAgreement: zod_1.z.array(zod_1.z.string()).optional(),
|
|
50
|
+
service: zod_1.z.array(zod_1.z.object({
|
|
51
|
+
id: zod_1.z.string(),
|
|
52
|
+
type: zod_1.z.string(),
|
|
53
|
+
serviceEndpoint: zod_1.z.string()
|
|
54
|
+
})).optional()
|
|
55
|
+
});
|
|
56
|
+
exports.AgentDocumentSchema = zod_1.z.object({
|
|
57
|
+
id: zod_1.z.string(),
|
|
58
|
+
capabilities: zod_1.z.object({
|
|
59
|
+
'mcp-i': zod_1.z.array(zod_1.z.enum(['handshake', 'signing', 'verification', 'delegation', 'proof-generation']))
|
|
60
|
+
}).catchall(zod_1.z.array(zod_1.z.string())),
|
|
61
|
+
metadata: zod_1.z.object({
|
|
62
|
+
name: zod_1.z.string().optional(),
|
|
63
|
+
serviceEndpoint: zod_1.z.string().optional(),
|
|
64
|
+
version: zod_1.z.string().optional(),
|
|
65
|
+
description: zod_1.z.string().optional()
|
|
66
|
+
}).optional()
|
|
67
|
+
});
|
|
68
|
+
exports.MCPIdentitySchema = zod_1.z.object({
|
|
69
|
+
did: zod_1.z.string(),
|
|
70
|
+
publicKey: zod_1.z.string(),
|
|
71
|
+
serviceName: zod_1.z.string(),
|
|
72
|
+
serviceEndpoint: zod_1.z.string(),
|
|
73
|
+
timestamp: zod_1.z.number(),
|
|
74
|
+
metadata: zod_1.z.record(zod_1.z.unknown()).optional()
|
|
75
|
+
});
|
|
76
|
+
exports.WellKnownConfigSchema = zod_1.z.object({
|
|
77
|
+
serviceName: zod_1.z.string().optional(),
|
|
78
|
+
serviceEndpoint: zod_1.z.string().optional(),
|
|
79
|
+
metadata: zod_1.z.record(zod_1.z.unknown()).optional()
|
|
80
|
+
});
|
|
81
|
+
exports.WellKnownResponseSchema = zod_1.z.object({
|
|
82
|
+
status: zod_1.z.number(),
|
|
83
|
+
headers: zod_1.z.record(zod_1.z.string()),
|
|
84
|
+
body: zod_1.z.string()
|
|
85
|
+
});
|
|
86
|
+
/**
|
|
87
|
+
* Type Guards
|
|
88
|
+
*/
|
|
89
|
+
function isDIDDocument(obj) {
|
|
90
|
+
return exports.DIDDocumentSchema.safeParse(obj).success;
|
|
91
|
+
}
|
|
92
|
+
function isAgentDocument(obj) {
|
|
93
|
+
return exports.AgentDocumentSchema.safeParse(obj).success;
|
|
94
|
+
}
|
|
95
|
+
function isMCPIdentity(obj) {
|
|
96
|
+
return exports.MCPIdentitySchema.safeParse(obj).success;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Validation Functions
|
|
100
|
+
*/
|
|
101
|
+
function validateDIDDocument(obj) {
|
|
102
|
+
return exports.DIDDocumentSchema.parse(obj);
|
|
103
|
+
}
|
|
104
|
+
function validateAgentDocument(obj) {
|
|
105
|
+
return exports.AgentDocumentSchema.parse(obj);
|
|
106
|
+
}
|
|
107
|
+
function validateMCPIdentity(obj) {
|
|
108
|
+
return exports.MCPIdentitySchema.parse(obj);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Utility Functions
|
|
112
|
+
*/
|
|
113
|
+
/**
|
|
114
|
+
* Check if a path is a well-known endpoint
|
|
115
|
+
*/
|
|
116
|
+
function isWellKnownPath(path) {
|
|
117
|
+
return Object.values(WellKnownPath).includes(path);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Get the content type for a well-known endpoint
|
|
121
|
+
*/
|
|
122
|
+
function getWellKnownContentType(path) {
|
|
123
|
+
switch (path) {
|
|
124
|
+
case WellKnownPath.DID_DOCUMENT:
|
|
125
|
+
return 'application/did+json';
|
|
126
|
+
case WellKnownPath.AGENT_DOCUMENT:
|
|
127
|
+
case WellKnownPath.TOOL_PROTECTIONS:
|
|
128
|
+
return 'application/json';
|
|
129
|
+
case WellKnownPath.MCP_IDENTITY:
|
|
130
|
+
return 'application/json';
|
|
131
|
+
default:
|
|
132
|
+
return 'application/json';
|
|
133
|
+
}
|
|
134
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kya-os/contracts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Shared types and schemas for XMCP-I ecosystem",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -91,6 +91,11 @@
|
|
|
91
91
|
"types": "./dist/config/index.d.ts",
|
|
92
92
|
"import": "./dist/config/index.js",
|
|
93
93
|
"require": "./dist/config/index.js"
|
|
94
|
+
},
|
|
95
|
+
"./dashboard-config": {
|
|
96
|
+
"types": "./dist/dashboard-config/index.d.ts",
|
|
97
|
+
"import": "./dist/dashboard-config/index.js",
|
|
98
|
+
"require": "./dist/dashboard-config/index.js"
|
|
94
99
|
}
|
|
95
100
|
},
|
|
96
101
|
"files": [
|