@kya-os/contracts 1.3.5 → 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 +13 -0
- package/dist/cli.js +13 -1
- 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 +20 -0
- package/dist/handshake.js +10 -3
- package/dist/index.d.ts +14 -0
- package/dist/index.js +28 -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 +53 -16
- package/dist/proof.js +27 -3
- package/dist/registry.d.ts +16 -0
- package/dist/registry.js +29 -9
- 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 +36 -0
- package/dist/test.js +36 -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 +16 -0
- package/dist/utils/validation.js +13 -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 +3 -0
- package/dist/verifier.js +7 -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,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP-I Well-Known Endpoints Specification
|
|
3
|
+
*
|
|
4
|
+
* This module defines the types for well-known endpoints as specified in the
|
|
5
|
+
* MCP-I protocol. These endpoints provide identity discovery and verification
|
|
6
|
+
* capabilities for MCP-I agents.
|
|
7
|
+
*
|
|
8
|
+
* @module @kya-os/contracts/well-known
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
/**
|
|
12
|
+
* DID Document as per W3C DID specification
|
|
13
|
+
* Returned from /.well-known/did.json
|
|
14
|
+
*/
|
|
15
|
+
export interface DIDDocument {
|
|
16
|
+
'@context': string[];
|
|
17
|
+
id: string;
|
|
18
|
+
verificationMethod: Array<{
|
|
19
|
+
id: string;
|
|
20
|
+
type: string;
|
|
21
|
+
controller: string;
|
|
22
|
+
publicKeyBase64?: string;
|
|
23
|
+
publicKeyMultibase?: string;
|
|
24
|
+
}>;
|
|
25
|
+
authentication?: string[];
|
|
26
|
+
assertionMethod?: string[];
|
|
27
|
+
capabilityInvocation?: string[];
|
|
28
|
+
capabilityDelegation?: string[];
|
|
29
|
+
keyAgreement?: string[];
|
|
30
|
+
service?: Array<{
|
|
31
|
+
id: string;
|
|
32
|
+
type: string;
|
|
33
|
+
serviceEndpoint: string;
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Agent Document for MCP-I capability discovery
|
|
38
|
+
* Returned from /.well-known/agent.json
|
|
39
|
+
*/
|
|
40
|
+
export interface AgentDocument {
|
|
41
|
+
/** The agent's DID */
|
|
42
|
+
id: string;
|
|
43
|
+
/** Capabilities supported by this agent */
|
|
44
|
+
capabilities: {
|
|
45
|
+
'mcp-i': Array<'handshake' | 'signing' | 'verification' | 'delegation' | 'proof-generation'>;
|
|
46
|
+
[key: string]: string[];
|
|
47
|
+
};
|
|
48
|
+
/** Optional metadata about the agent */
|
|
49
|
+
metadata?: {
|
|
50
|
+
name?: string;
|
|
51
|
+
serviceEndpoint?: string;
|
|
52
|
+
version?: string;
|
|
53
|
+
description?: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* MCP Identity information
|
|
58
|
+
* Returned from /.well-known/mcp-identity
|
|
59
|
+
*/
|
|
60
|
+
export interface MCPIdentity {
|
|
61
|
+
/** The agent's DID */
|
|
62
|
+
did: string;
|
|
63
|
+
/** The agent's public key */
|
|
64
|
+
publicKey: string;
|
|
65
|
+
/** Service name */
|
|
66
|
+
serviceName: string;
|
|
67
|
+
/** Service endpoint URL */
|
|
68
|
+
serviceEndpoint: string;
|
|
69
|
+
/** Timestamp of when this was generated */
|
|
70
|
+
timestamp: number;
|
|
71
|
+
/** Optional additional metadata */
|
|
72
|
+
metadata?: Record<string, unknown>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Well-known endpoint handler configuration
|
|
76
|
+
*/
|
|
77
|
+
export interface WellKnownConfig {
|
|
78
|
+
/** Service name to advertise */
|
|
79
|
+
serviceName?: string;
|
|
80
|
+
/** Service endpoint URL */
|
|
81
|
+
serviceEndpoint?: string;
|
|
82
|
+
/** Additional metadata to include */
|
|
83
|
+
metadata?: Record<string, unknown>;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Well-known endpoint response
|
|
87
|
+
*/
|
|
88
|
+
export interface WellKnownResponse {
|
|
89
|
+
status: number;
|
|
90
|
+
headers: Record<string, string>;
|
|
91
|
+
body: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Well-known endpoint paths
|
|
95
|
+
*/
|
|
96
|
+
export declare enum WellKnownPath {
|
|
97
|
+
DID_DOCUMENT = "/.well-known/did.json",
|
|
98
|
+
AGENT_DOCUMENT = "/.well-known/agent.json",
|
|
99
|
+
MCP_IDENTITY = "/.well-known/mcp-identity",
|
|
100
|
+
TOOL_PROTECTIONS = "/.well-known/tool-protections.json"
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Zod Schemas for Validation
|
|
104
|
+
*/
|
|
105
|
+
export declare const DIDDocumentSchema: z.ZodObject<{
|
|
106
|
+
'@context': z.ZodArray<z.ZodString, "many">;
|
|
107
|
+
id: z.ZodString;
|
|
108
|
+
verificationMethod: z.ZodArray<z.ZodObject<{
|
|
109
|
+
id: z.ZodString;
|
|
110
|
+
type: z.ZodString;
|
|
111
|
+
controller: z.ZodString;
|
|
112
|
+
publicKeyBase64: z.ZodOptional<z.ZodString>;
|
|
113
|
+
publicKeyMultibase: z.ZodOptional<z.ZodString>;
|
|
114
|
+
}, "strip", z.ZodTypeAny, {
|
|
115
|
+
type: string;
|
|
116
|
+
id: string;
|
|
117
|
+
controller: string;
|
|
118
|
+
publicKeyMultibase?: string | undefined;
|
|
119
|
+
publicKeyBase64?: string | undefined;
|
|
120
|
+
}, {
|
|
121
|
+
type: string;
|
|
122
|
+
id: string;
|
|
123
|
+
controller: string;
|
|
124
|
+
publicKeyMultibase?: string | undefined;
|
|
125
|
+
publicKeyBase64?: string | undefined;
|
|
126
|
+
}>, "many">;
|
|
127
|
+
authentication: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
128
|
+
assertionMethod: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
129
|
+
capabilityInvocation: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
130
|
+
capabilityDelegation: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
131
|
+
keyAgreement: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
132
|
+
service: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
133
|
+
id: z.ZodString;
|
|
134
|
+
type: z.ZodString;
|
|
135
|
+
serviceEndpoint: z.ZodString;
|
|
136
|
+
}, "strip", z.ZodTypeAny, {
|
|
137
|
+
type: string;
|
|
138
|
+
id: string;
|
|
139
|
+
serviceEndpoint: string;
|
|
140
|
+
}, {
|
|
141
|
+
type: string;
|
|
142
|
+
id: string;
|
|
143
|
+
serviceEndpoint: string;
|
|
144
|
+
}>, "many">>;
|
|
145
|
+
}, "strip", z.ZodTypeAny, {
|
|
146
|
+
id: string;
|
|
147
|
+
verificationMethod: {
|
|
148
|
+
type: string;
|
|
149
|
+
id: string;
|
|
150
|
+
controller: string;
|
|
151
|
+
publicKeyMultibase?: string | undefined;
|
|
152
|
+
publicKeyBase64?: string | undefined;
|
|
153
|
+
}[];
|
|
154
|
+
'@context': string[];
|
|
155
|
+
authentication?: string[] | undefined;
|
|
156
|
+
assertionMethod?: string[] | undefined;
|
|
157
|
+
keyAgreement?: string[] | undefined;
|
|
158
|
+
capabilityInvocation?: string[] | undefined;
|
|
159
|
+
capabilityDelegation?: string[] | undefined;
|
|
160
|
+
service?: {
|
|
161
|
+
type: string;
|
|
162
|
+
id: string;
|
|
163
|
+
serviceEndpoint: string;
|
|
164
|
+
}[] | undefined;
|
|
165
|
+
}, {
|
|
166
|
+
id: string;
|
|
167
|
+
verificationMethod: {
|
|
168
|
+
type: string;
|
|
169
|
+
id: string;
|
|
170
|
+
controller: string;
|
|
171
|
+
publicKeyMultibase?: string | undefined;
|
|
172
|
+
publicKeyBase64?: string | undefined;
|
|
173
|
+
}[];
|
|
174
|
+
'@context': string[];
|
|
175
|
+
authentication?: string[] | undefined;
|
|
176
|
+
assertionMethod?: string[] | undefined;
|
|
177
|
+
keyAgreement?: string[] | undefined;
|
|
178
|
+
capabilityInvocation?: string[] | undefined;
|
|
179
|
+
capabilityDelegation?: string[] | undefined;
|
|
180
|
+
service?: {
|
|
181
|
+
type: string;
|
|
182
|
+
id: string;
|
|
183
|
+
serviceEndpoint: string;
|
|
184
|
+
}[] | undefined;
|
|
185
|
+
}>;
|
|
186
|
+
export declare const AgentDocumentSchema: z.ZodObject<{
|
|
187
|
+
id: z.ZodString;
|
|
188
|
+
capabilities: z.ZodObject<{
|
|
189
|
+
'mcp-i': z.ZodArray<z.ZodEnum<["handshake", "signing", "verification", "delegation", "proof-generation"]>, "many">;
|
|
190
|
+
}, "strip", z.ZodArray<z.ZodString, "many">, z.objectOutputType<{
|
|
191
|
+
'mcp-i': z.ZodArray<z.ZodEnum<["handshake", "signing", "verification", "delegation", "proof-generation"]>, "many">;
|
|
192
|
+
}, z.ZodArray<z.ZodString, "many">, "strip">, z.objectInputType<{
|
|
193
|
+
'mcp-i': z.ZodArray<z.ZodEnum<["handshake", "signing", "verification", "delegation", "proof-generation"]>, "many">;
|
|
194
|
+
}, z.ZodArray<z.ZodString, "many">, "strip">>;
|
|
195
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
196
|
+
name: z.ZodOptional<z.ZodString>;
|
|
197
|
+
serviceEndpoint: z.ZodOptional<z.ZodString>;
|
|
198
|
+
version: z.ZodOptional<z.ZodString>;
|
|
199
|
+
description: z.ZodOptional<z.ZodString>;
|
|
200
|
+
}, "strip", z.ZodTypeAny, {
|
|
201
|
+
version?: string | undefined;
|
|
202
|
+
name?: string | undefined;
|
|
203
|
+
serviceEndpoint?: string | undefined;
|
|
204
|
+
description?: string | undefined;
|
|
205
|
+
}, {
|
|
206
|
+
version?: string | undefined;
|
|
207
|
+
name?: string | undefined;
|
|
208
|
+
serviceEndpoint?: string | undefined;
|
|
209
|
+
description?: string | undefined;
|
|
210
|
+
}>>;
|
|
211
|
+
}, "strip", z.ZodTypeAny, {
|
|
212
|
+
id: string;
|
|
213
|
+
capabilities: {
|
|
214
|
+
'mcp-i': ("handshake" | "signing" | "verification" | "delegation" | "proof-generation")[];
|
|
215
|
+
} & {
|
|
216
|
+
[k: string]: string[];
|
|
217
|
+
};
|
|
218
|
+
metadata?: {
|
|
219
|
+
version?: string | undefined;
|
|
220
|
+
name?: string | undefined;
|
|
221
|
+
serviceEndpoint?: string | undefined;
|
|
222
|
+
description?: string | undefined;
|
|
223
|
+
} | undefined;
|
|
224
|
+
}, {
|
|
225
|
+
id: string;
|
|
226
|
+
capabilities: {
|
|
227
|
+
'mcp-i': ("handshake" | "signing" | "verification" | "delegation" | "proof-generation")[];
|
|
228
|
+
} & {
|
|
229
|
+
[k: string]: string[];
|
|
230
|
+
};
|
|
231
|
+
metadata?: {
|
|
232
|
+
version?: string | undefined;
|
|
233
|
+
name?: string | undefined;
|
|
234
|
+
serviceEndpoint?: string | undefined;
|
|
235
|
+
description?: string | undefined;
|
|
236
|
+
} | undefined;
|
|
237
|
+
}>;
|
|
238
|
+
export declare const MCPIdentitySchema: z.ZodObject<{
|
|
239
|
+
did: z.ZodString;
|
|
240
|
+
publicKey: z.ZodString;
|
|
241
|
+
serviceName: z.ZodString;
|
|
242
|
+
serviceEndpoint: z.ZodString;
|
|
243
|
+
timestamp: z.ZodNumber;
|
|
244
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
245
|
+
}, "strip", z.ZodTypeAny, {
|
|
246
|
+
did: string;
|
|
247
|
+
publicKey: string;
|
|
248
|
+
timestamp: number;
|
|
249
|
+
serviceEndpoint: string;
|
|
250
|
+
serviceName: string;
|
|
251
|
+
metadata?: Record<string, unknown> | undefined;
|
|
252
|
+
}, {
|
|
253
|
+
did: string;
|
|
254
|
+
publicKey: string;
|
|
255
|
+
timestamp: number;
|
|
256
|
+
serviceEndpoint: string;
|
|
257
|
+
serviceName: string;
|
|
258
|
+
metadata?: Record<string, unknown> | undefined;
|
|
259
|
+
}>;
|
|
260
|
+
export declare const WellKnownConfigSchema: z.ZodObject<{
|
|
261
|
+
serviceName: z.ZodOptional<z.ZodString>;
|
|
262
|
+
serviceEndpoint: z.ZodOptional<z.ZodString>;
|
|
263
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
264
|
+
}, "strip", z.ZodTypeAny, {
|
|
265
|
+
metadata?: Record<string, unknown> | undefined;
|
|
266
|
+
serviceEndpoint?: string | undefined;
|
|
267
|
+
serviceName?: string | undefined;
|
|
268
|
+
}, {
|
|
269
|
+
metadata?: Record<string, unknown> | undefined;
|
|
270
|
+
serviceEndpoint?: string | undefined;
|
|
271
|
+
serviceName?: string | undefined;
|
|
272
|
+
}>;
|
|
273
|
+
export declare const WellKnownResponseSchema: z.ZodObject<{
|
|
274
|
+
status: z.ZodNumber;
|
|
275
|
+
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
276
|
+
body: z.ZodString;
|
|
277
|
+
}, "strip", z.ZodTypeAny, {
|
|
278
|
+
status: number;
|
|
279
|
+
headers: Record<string, string>;
|
|
280
|
+
body: string;
|
|
281
|
+
}, {
|
|
282
|
+
status: number;
|
|
283
|
+
headers: Record<string, string>;
|
|
284
|
+
body: string;
|
|
285
|
+
}>;
|
|
286
|
+
/**
|
|
287
|
+
* Type Guards
|
|
288
|
+
*/
|
|
289
|
+
export declare function isDIDDocument(obj: any): obj is DIDDocument;
|
|
290
|
+
export declare function isAgentDocument(obj: any): obj is AgentDocument;
|
|
291
|
+
export declare function isMCPIdentity(obj: any): obj is MCPIdentity;
|
|
292
|
+
/**
|
|
293
|
+
* Validation Functions
|
|
294
|
+
*/
|
|
295
|
+
export declare function validateDIDDocument(obj: any): DIDDocument;
|
|
296
|
+
export declare function validateAgentDocument(obj: any): AgentDocument;
|
|
297
|
+
export declare function validateMCPIdentity(obj: any): MCPIdentity;
|
|
298
|
+
/**
|
|
299
|
+
* Utility Functions
|
|
300
|
+
*/
|
|
301
|
+
/**
|
|
302
|
+
* Check if a path is a well-known endpoint
|
|
303
|
+
*/
|
|
304
|
+
export declare function isWellKnownPath(path: string): boolean;
|
|
305
|
+
/**
|
|
306
|
+
* Get the content type for a well-known endpoint
|
|
307
|
+
*/
|
|
308
|
+
export declare function getWellKnownContentType(path: WellKnownPath | string): string;
|
|
@@ -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": [
|