@kya-os/contracts 1.5.3-canary.22 → 1.5.3-canary.24

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.
Files changed (69) hide show
  1. package/dist/consent/schemas.d.ts +149 -77
  2. package/dist/consent/schemas.js +29 -2
  3. package/package.json +23 -1
  4. package/.turbo/turbo-build.log +0 -19
  5. package/.turbo/turbo-test$colon$coverage.log +0 -117
  6. package/.turbo/turbo-test.log +0 -32
  7. package/coverage/coverage-final.json +0 -38
  8. package/schemas/cli/register-output/v1.0.0.json +0 -69
  9. package/schemas/identity/v1.0.0.json +0 -46
  10. package/schemas/proof/v1.0.0.json +0 -80
  11. package/schemas/registry/receipt-v1.0.0.json +0 -60
  12. package/schemas/verifier/verify-page/v1.0.0.json +0 -94
  13. package/schemas/well-known/agent/v1.0.0.json +0 -67
  14. package/schemas/well-known/did/v1.0.0.json +0 -174
  15. package/scripts/emit-schemas.js +0 -11
  16. package/src/agentshield-api/admin-schemas.ts +0 -31
  17. package/src/agentshield-api/admin-types.ts +0 -47
  18. package/src/agentshield-api/endpoints.ts +0 -60
  19. package/src/agentshield-api/index.ts +0 -70
  20. package/src/agentshield-api/schemas.ts +0 -304
  21. package/src/agentshield-api/types.ts +0 -317
  22. package/src/audit/index.ts +0 -128
  23. package/src/cli.ts +0 -156
  24. package/src/config/base.ts +0 -107
  25. package/src/config/builder.ts +0 -97
  26. package/src/config/delegation.ts +0 -232
  27. package/src/config/identity.ts +0 -252
  28. package/src/config/index.ts +0 -78
  29. package/src/config/proofing.ts +0 -138
  30. package/src/config/tool-context.ts +0 -41
  31. package/src/config/tool-protection.ts +0 -174
  32. package/src/consent/index.ts +0 -32
  33. package/src/consent/schemas.ts +0 -334
  34. package/src/consent/types.ts +0 -199
  35. package/src/dashboard-config/default-config.json +0 -86
  36. package/src/dashboard-config/default-config.ts +0 -266
  37. package/src/dashboard-config/index.ts +0 -48
  38. package/src/dashboard-config/schemas.ts +0 -286
  39. package/src/dashboard-config/types.ts +0 -404
  40. package/src/delegation/constraints.ts +0 -267
  41. package/src/delegation/index.ts +0 -8
  42. package/src/delegation/schemas.ts +0 -595
  43. package/src/did/index.ts +0 -9
  44. package/src/did/resolve-contract.ts +0 -255
  45. package/src/did/schemas.ts +0 -190
  46. package/src/did/types.ts +0 -224
  47. package/src/env/constants.ts +0 -70
  48. package/src/env/index.ts +0 -5
  49. package/src/handshake.ts +0 -125
  50. package/src/index.ts +0 -45
  51. package/src/proof/index.ts +0 -31
  52. package/src/proof/proof-record.ts +0 -163
  53. package/src/proof/signing-spec.ts +0 -146
  54. package/src/proof.ts +0 -99
  55. package/src/registry.ts +0 -146
  56. package/src/runtime/errors.ts +0 -153
  57. package/src/runtime/headers.ts +0 -136
  58. package/src/runtime/index.ts +0 -6
  59. package/src/test.ts +0 -143
  60. package/src/tlkrc/index.ts +0 -5
  61. package/src/tlkrc/rotation.ts +0 -153
  62. package/src/tool-protection/index.ts +0 -406
  63. package/src/utils/validation.ts +0 -93
  64. package/src/vc/index.ts +0 -8
  65. package/src/vc/schemas.ts +0 -277
  66. package/src/vc/statuslist.ts +0 -279
  67. package/src/verifier/index.ts +0 -2
  68. package/src/verifier.ts +0 -92
  69. package/src/well-known/index.ts +0 -237
@@ -1,237 +0,0 @@
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
-
11
- import { z } from 'zod';
12
-
13
- /**
14
- * DID Document as per W3C DID specification
15
- * Returned from /.well-known/did.json
16
- */
17
- export interface DIDDocument {
18
- '@context': string[];
19
- id: string;
20
- verificationMethod: Array<{
21
- id: string;
22
- type: string;
23
- controller: string;
24
- publicKeyBase64?: string;
25
- publicKeyMultibase?: string;
26
- }>;
27
- authentication?: string[];
28
- assertionMethod?: string[];
29
- capabilityInvocation?: string[];
30
- capabilityDelegation?: string[];
31
- keyAgreement?: string[];
32
- service?: Array<{
33
- id: string;
34
- type: string;
35
- serviceEndpoint: string;
36
- }>;
37
- }
38
-
39
- /**
40
- * Agent Document for MCP-I capability discovery
41
- * Returned from /.well-known/agent.json
42
- */
43
- export interface AgentDocument {
44
- /** The agent's DID */
45
- id: string;
46
-
47
- /** Capabilities supported by this agent */
48
- capabilities: {
49
- 'mcp-i': Array<'handshake' | 'signing' | 'verification' | 'delegation' | 'proof-generation'>;
50
- [key: string]: string[];
51
- };
52
-
53
- /** Optional metadata about the agent */
54
- metadata?: {
55
- name?: string;
56
- serviceEndpoint?: string;
57
- version?: string;
58
- description?: string;
59
- };
60
- }
61
-
62
- /**
63
- * MCP Identity information
64
- * Returned from /.well-known/mcp-identity
65
- */
66
- export interface MCPIdentity {
67
- /** The agent's DID */
68
- did: string;
69
-
70
- /** The agent's public key */
71
- publicKey: string;
72
-
73
- /** Service name */
74
- serviceName: string;
75
-
76
- /** Service endpoint URL */
77
- serviceEndpoint: string;
78
-
79
- /** Timestamp of when this was generated */
80
- timestamp: number;
81
-
82
- /** Optional additional metadata */
83
- metadata?: Record<string, unknown>;
84
- }
85
-
86
- /**
87
- * Well-known endpoint handler configuration
88
- */
89
- export interface WellKnownConfig {
90
- /** Service name to advertise */
91
- serviceName?: string;
92
-
93
- /** Service endpoint URL */
94
- serviceEndpoint?: string;
95
-
96
- /** Additional metadata to include */
97
- metadata?: Record<string, unknown>;
98
- }
99
-
100
- /**
101
- * Well-known endpoint response
102
- */
103
- export interface WellKnownResponse {
104
- status: number;
105
- headers: Record<string, string>;
106
- body: string;
107
- }
108
-
109
- /**
110
- * Well-known endpoint paths
111
- */
112
- export enum WellKnownPath {
113
- DID_DOCUMENT = '/.well-known/did.json',
114
- AGENT_DOCUMENT = '/.well-known/agent.json',
115
- MCP_IDENTITY = '/.well-known/mcp-identity',
116
- TOOL_PROTECTIONS = '/.well-known/tool-protections.json',
117
- }
118
-
119
- /**
120
- * Zod Schemas for Validation
121
- */
122
-
123
- export const DIDDocumentSchema = z.object({
124
- '@context': z.array(z.string()),
125
- id: z.string(),
126
- verificationMethod: z.array(z.object({
127
- id: z.string(),
128
- type: z.string(),
129
- controller: z.string(),
130
- publicKeyBase64: z.string().optional(),
131
- publicKeyMultibase: z.string().optional()
132
- })),
133
- authentication: z.array(z.string()).optional(),
134
- assertionMethod: z.array(z.string()).optional(),
135
- capabilityInvocation: z.array(z.string()).optional(),
136
- capabilityDelegation: z.array(z.string()).optional(),
137
- keyAgreement: z.array(z.string()).optional(),
138
- service: z.array(z.object({
139
- id: z.string(),
140
- type: z.string(),
141
- serviceEndpoint: z.string()
142
- })).optional()
143
- });
144
-
145
- export const AgentDocumentSchema = z.object({
146
- id: z.string(),
147
- capabilities: z.object({
148
- 'mcp-i': z.array(z.enum(['handshake', 'signing', 'verification', 'delegation', 'proof-generation']))
149
- }).catchall(z.array(z.string())),
150
- metadata: z.object({
151
- name: z.string().optional(),
152
- serviceEndpoint: z.string().optional(),
153
- version: z.string().optional(),
154
- description: z.string().optional()
155
- }).optional()
156
- });
157
-
158
- export const MCPIdentitySchema = z.object({
159
- did: z.string(),
160
- publicKey: z.string(),
161
- serviceName: z.string(),
162
- serviceEndpoint: z.string(),
163
- timestamp: z.number(),
164
- metadata: z.record(z.unknown()).optional()
165
- });
166
-
167
- export const WellKnownConfigSchema = z.object({
168
- serviceName: z.string().optional(),
169
- serviceEndpoint: z.string().optional(),
170
- metadata: z.record(z.unknown()).optional()
171
- });
172
-
173
- export const WellKnownResponseSchema = z.object({
174
- status: z.number(),
175
- headers: z.record(z.string()),
176
- body: z.string()
177
- });
178
-
179
- /**
180
- * Type Guards
181
- */
182
-
183
- export function isDIDDocument(obj: any): obj is DIDDocument {
184
- return DIDDocumentSchema.safeParse(obj).success;
185
- }
186
-
187
- export function isAgentDocument(obj: any): obj is AgentDocument {
188
- return AgentDocumentSchema.safeParse(obj).success;
189
- }
190
-
191
- export function isMCPIdentity(obj: any): obj is MCPIdentity {
192
- return MCPIdentitySchema.safeParse(obj).success;
193
- }
194
-
195
- /**
196
- * Validation Functions
197
- */
198
-
199
- export function validateDIDDocument(obj: any): DIDDocument {
200
- return DIDDocumentSchema.parse(obj);
201
- }
202
-
203
- export function validateAgentDocument(obj: any): AgentDocument {
204
- return AgentDocumentSchema.parse(obj);
205
- }
206
-
207
- export function validateMCPIdentity(obj: any): MCPIdentity {
208
- return MCPIdentitySchema.parse(obj);
209
- }
210
-
211
- /**
212
- * Utility Functions
213
- */
214
-
215
- /**
216
- * Check if a path is a well-known endpoint
217
- */
218
- export function isWellKnownPath(path: string): boolean {
219
- return Object.values(WellKnownPath).includes(path as WellKnownPath);
220
- }
221
-
222
- /**
223
- * Get the content type for a well-known endpoint
224
- */
225
- export function getWellKnownContentType(path: WellKnownPath | string): string {
226
- switch (path) {
227
- case WellKnownPath.DID_DOCUMENT:
228
- return 'application/did+json';
229
- case WellKnownPath.AGENT_DOCUMENT:
230
- case WellKnownPath.TOOL_PROTECTIONS:
231
- return 'application/json';
232
- case WellKnownPath.MCP_IDENTITY:
233
- return 'application/json';
234
- default:
235
- return 'application/json';
236
- }
237
- }