@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.
Files changed (87) hide show
  1. package/dist/agentshield-api/endpoints.d.ts +50 -0
  2. package/dist/agentshield-api/endpoints.js +46 -0
  3. package/dist/agentshield-api/index.d.ts +13 -0
  4. package/dist/agentshield-api/index.js +38 -0
  5. package/dist/agentshield-api/schemas.d.ts +9914 -0
  6. package/dist/agentshield-api/schemas.js +165 -0
  7. package/dist/agentshield-api/types.d.ts +168 -0
  8. package/dist/agentshield-api/types.js +27 -0
  9. package/dist/cli.d.ts +388 -0
  10. package/dist/cli.js +121 -0
  11. package/dist/config/base.d.ts +96 -0
  12. package/dist/config/base.js +11 -0
  13. package/dist/config/delegation.d.ts +194 -0
  14. package/dist/config/delegation.js +10 -0
  15. package/dist/config/identity.d.ts +117 -0
  16. package/dist/config/identity.js +11 -0
  17. package/dist/config/index.d.ts +33 -0
  18. package/dist/config/index.js +11 -0
  19. package/dist/config/proofing.d.ts +120 -0
  20. package/dist/config/proofing.js +10 -0
  21. package/dist/config/tool-protection.d.ts +139 -0
  22. package/dist/config/tool-protection.js +10 -0
  23. package/dist/dashboard-config/index.d.ts +10 -0
  24. package/dist/dashboard-config/index.js +31 -0
  25. package/dist/dashboard-config/schemas.d.ts +5847 -0
  26. package/dist/dashboard-config/schemas.js +251 -0
  27. package/dist/dashboard-config/types.d.ts +331 -0
  28. package/dist/dashboard-config/types.js +11 -0
  29. package/dist/delegation/constraints.d.ts +991 -0
  30. package/dist/delegation/constraints.js +209 -0
  31. package/dist/delegation/index.d.ts +7 -0
  32. package/dist/delegation/index.js +23 -0
  33. package/dist/delegation/schemas.d.ts +8381 -0
  34. package/dist/delegation/schemas.js +475 -0
  35. package/dist/did/index.d.ts +8 -0
  36. package/dist/did/index.js +24 -0
  37. package/dist/did/resolve-contract.d.ts +219 -0
  38. package/dist/did/resolve-contract.js +31 -0
  39. package/dist/did/schemas.d.ts +112 -0
  40. package/dist/did/schemas.js +172 -0
  41. package/dist/did/types.d.ts +163 -0
  42. package/dist/did/types.js +70 -0
  43. package/dist/env/constants.d.ts +57 -0
  44. package/dist/env/constants.js +59 -0
  45. package/dist/env/index.d.ts +4 -0
  46. package/dist/env/index.js +20 -0
  47. package/dist/handshake.d.ts +158 -0
  48. package/dist/handshake.js +57 -0
  49. package/dist/index.d.ts +25 -0
  50. package/dist/index.js +56 -0
  51. package/dist/proof/index.d.ts +8 -0
  52. package/dist/proof/index.js +24 -0
  53. package/dist/proof/proof-record.d.ts +837 -0
  54. package/dist/proof/proof-record.js +133 -0
  55. package/dist/proof/signing-spec.d.ts +146 -0
  56. package/dist/proof/signing-spec.js +122 -0
  57. package/dist/proof.d.ts +415 -0
  58. package/dist/proof.js +83 -0
  59. package/dist/registry.d.ts +342 -0
  60. package/dist/registry.js +118 -0
  61. package/dist/runtime/errors.d.ts +347 -0
  62. package/dist/runtime/errors.js +119 -0
  63. package/dist/runtime/headers.d.ts +83 -0
  64. package/dist/runtime/headers.js +81 -0
  65. package/dist/runtime/index.d.ts +5 -0
  66. package/dist/runtime/index.js +21 -0
  67. package/dist/test.d.ts +251 -0
  68. package/dist/test.js +119 -0
  69. package/dist/tlkrc/index.d.ts +4 -0
  70. package/dist/tlkrc/index.js +20 -0
  71. package/dist/tlkrc/rotation.d.ts +245 -0
  72. package/dist/tlkrc/rotation.js +126 -0
  73. package/dist/tool-protection/index.d.ts +227 -0
  74. package/dist/tool-protection/index.js +113 -0
  75. package/dist/utils/validation.d.ts +30 -0
  76. package/dist/utils/validation.js +69 -0
  77. package/dist/vc/index.d.ts +7 -0
  78. package/dist/vc/index.js +23 -0
  79. package/dist/vc/schemas.d.ts +2483 -0
  80. package/dist/vc/schemas.js +224 -0
  81. package/dist/vc/statuslist.d.ts +493 -0
  82. package/dist/vc/statuslist.js +132 -0
  83. package/dist/verifier.d.ts +205 -0
  84. package/dist/verifier.js +83 -0
  85. package/dist/well-known/index.d.ts +308 -0
  86. package/dist/well-known/index.js +134 -0
  87. package/package.json +6 -1
package/dist/cli.d.ts ADDED
@@ -0,0 +1,388 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * CLI command schemas and results
4
+ */
5
+ /**
6
+ * CLI Identity File Format Schema
7
+ *
8
+ * Format for identity.json files stored on disk.
9
+ * Used by CLI tools for identity management.
10
+ */
11
+ export declare const CLIIdentityFileSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
12
+ version: z.ZodLiteral<"1.0">;
13
+ did: z.ZodString;
14
+ kid: z.ZodOptional<z.ZodString>;
15
+ keyId: z.ZodOptional<z.ZodString>;
16
+ privateKey: z.ZodString;
17
+ publicKey: z.ZodString;
18
+ createdAt: z.ZodString;
19
+ lastRotated: z.ZodOptional<z.ZodString>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ version: "1.0";
22
+ did: string;
23
+ privateKey: string;
24
+ publicKey: string;
25
+ createdAt: string;
26
+ kid?: string | undefined;
27
+ keyId?: string | undefined;
28
+ lastRotated?: string | undefined;
29
+ }, {
30
+ version: "1.0";
31
+ did: string;
32
+ privateKey: string;
33
+ publicKey: string;
34
+ createdAt: string;
35
+ kid?: string | undefined;
36
+ keyId?: string | undefined;
37
+ lastRotated?: string | undefined;
38
+ }>, {
39
+ version: "1.0";
40
+ did: string;
41
+ privateKey: string;
42
+ publicKey: string;
43
+ createdAt: string;
44
+ kid?: string | undefined;
45
+ keyId?: string | undefined;
46
+ lastRotated?: string | undefined;
47
+ }, {
48
+ version: "1.0";
49
+ did: string;
50
+ privateKey: string;
51
+ publicKey: string;
52
+ createdAt: string;
53
+ kid?: string | undefined;
54
+ keyId?: string | undefined;
55
+ lastRotated?: string | undefined;
56
+ }>, {
57
+ version: "1.0";
58
+ did: string;
59
+ kid: string;
60
+ privateKey: string;
61
+ publicKey: string;
62
+ createdAt: string;
63
+ lastRotated: string | undefined;
64
+ }, {
65
+ version: "1.0";
66
+ did: string;
67
+ privateKey: string;
68
+ publicKey: string;
69
+ createdAt: string;
70
+ kid?: string | undefined;
71
+ keyId?: string | undefined;
72
+ lastRotated?: string | undefined;
73
+ }>;
74
+ export declare const KeyRotationResultSchema: z.ZodObject<{
75
+ success: z.ZodBoolean;
76
+ oldKeyId: z.ZodString;
77
+ newKeyId: z.ZodString;
78
+ did: z.ZodString;
79
+ mode: z.ZodEnum<["dev", "prod"]>;
80
+ delegated: z.ZodBoolean;
81
+ forced: z.ZodBoolean;
82
+ auditLine: z.ZodString;
83
+ }, "strip", z.ZodTypeAny, {
84
+ did: string;
85
+ success: boolean;
86
+ oldKeyId: string;
87
+ newKeyId: string;
88
+ mode: "dev" | "prod";
89
+ delegated: boolean;
90
+ forced: boolean;
91
+ auditLine: string;
92
+ }, {
93
+ did: string;
94
+ success: boolean;
95
+ oldKeyId: string;
96
+ newKeyId: string;
97
+ mode: "dev" | "prod";
98
+ delegated: boolean;
99
+ forced: boolean;
100
+ auditLine: string;
101
+ }>;
102
+ export declare const StatusReportSchema: z.ZodObject<{
103
+ did: z.ZodString;
104
+ kid: z.ZodString;
105
+ ktaURL: z.ZodString;
106
+ mirrorStatus: z.ZodEnum<["pending", "success", "error"]>;
107
+ lastHandshake: z.ZodOptional<z.ZodNumber>;
108
+ environment: z.ZodEnum<["dev", "prod"]>;
109
+ }, "strip", z.ZodTypeAny, {
110
+ did: string;
111
+ kid: string;
112
+ ktaURL: string;
113
+ mirrorStatus: "success" | "pending" | "error";
114
+ environment: "dev" | "prod";
115
+ lastHandshake?: number | undefined;
116
+ }, {
117
+ did: string;
118
+ kid: string;
119
+ ktaURL: string;
120
+ mirrorStatus: "success" | "pending" | "error";
121
+ environment: "dev" | "prod";
122
+ lastHandshake?: number | undefined;
123
+ }>;
124
+ export declare const PackageInfoSchema: z.ZodObject<{
125
+ name: z.ZodString;
126
+ version: z.ZodString;
127
+ compatible: z.ZodBoolean;
128
+ issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
129
+ }, "strip", z.ZodTypeAny, {
130
+ version: string;
131
+ name: string;
132
+ compatible: boolean;
133
+ issues?: string[] | undefined;
134
+ }, {
135
+ version: string;
136
+ name: string;
137
+ compatible: boolean;
138
+ issues?: string[] | undefined;
139
+ }>;
140
+ export declare const XMCPUpstreamInfoSchema: z.ZodObject<{
141
+ version: z.ZodString;
142
+ compatible: z.ZodBoolean;
143
+ issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
144
+ }, "strip", z.ZodTypeAny, {
145
+ version: string;
146
+ compatible: boolean;
147
+ issues?: string[] | undefined;
148
+ }, {
149
+ version: string;
150
+ compatible: boolean;
151
+ issues?: string[] | undefined;
152
+ }>;
153
+ export declare const EnvironmentInfoSchema: z.ZodObject<{
154
+ valid: z.ZodBoolean;
155
+ missing: z.ZodArray<z.ZodString, "many">;
156
+ issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
157
+ }, "strip", z.ZodTypeAny, {
158
+ valid: boolean;
159
+ missing: string[];
160
+ issues?: string[] | undefined;
161
+ }, {
162
+ valid: boolean;
163
+ missing: string[];
164
+ issues?: string[] | undefined;
165
+ }>;
166
+ export declare const KTAInfoSchema: z.ZodObject<{
167
+ reachable: z.ZodBoolean;
168
+ authenticated: z.ZodBoolean;
169
+ issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
170
+ }, "strip", z.ZodTypeAny, {
171
+ reachable: boolean;
172
+ authenticated: boolean;
173
+ issues?: string[] | undefined;
174
+ }, {
175
+ reachable: boolean;
176
+ authenticated: boolean;
177
+ issues?: string[] | undefined;
178
+ }>;
179
+ export declare const CacheInfoSchema: z.ZodObject<{
180
+ type: z.ZodString;
181
+ functional: z.ZodBoolean;
182
+ issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
183
+ }, "strip", z.ZodTypeAny, {
184
+ type: string;
185
+ functional: boolean;
186
+ issues?: string[] | undefined;
187
+ }, {
188
+ type: string;
189
+ functional: boolean;
190
+ issues?: string[] | undefined;
191
+ }>;
192
+ export declare const DoctorResultSchema: z.ZodObject<{
193
+ packages: z.ZodArray<z.ZodObject<{
194
+ name: z.ZodString;
195
+ version: z.ZodString;
196
+ compatible: z.ZodBoolean;
197
+ issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
198
+ }, "strip", z.ZodTypeAny, {
199
+ version: string;
200
+ name: string;
201
+ compatible: boolean;
202
+ issues?: string[] | undefined;
203
+ }, {
204
+ version: string;
205
+ name: string;
206
+ compatible: boolean;
207
+ issues?: string[] | undefined;
208
+ }>, "many">;
209
+ xmcpUpstream: z.ZodObject<{
210
+ version: z.ZodString;
211
+ compatible: z.ZodBoolean;
212
+ issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
213
+ }, "strip", z.ZodTypeAny, {
214
+ version: string;
215
+ compatible: boolean;
216
+ issues?: string[] | undefined;
217
+ }, {
218
+ version: string;
219
+ compatible: boolean;
220
+ issues?: string[] | undefined;
221
+ }>;
222
+ environment: z.ZodObject<{
223
+ valid: z.ZodBoolean;
224
+ missing: z.ZodArray<z.ZodString, "many">;
225
+ issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
226
+ }, "strip", z.ZodTypeAny, {
227
+ valid: boolean;
228
+ missing: string[];
229
+ issues?: string[] | undefined;
230
+ }, {
231
+ valid: boolean;
232
+ missing: string[];
233
+ issues?: string[] | undefined;
234
+ }>;
235
+ kta: z.ZodObject<{
236
+ reachable: z.ZodBoolean;
237
+ authenticated: z.ZodBoolean;
238
+ issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
239
+ }, "strip", z.ZodTypeAny, {
240
+ reachable: boolean;
241
+ authenticated: boolean;
242
+ issues?: string[] | undefined;
243
+ }, {
244
+ reachable: boolean;
245
+ authenticated: boolean;
246
+ issues?: string[] | undefined;
247
+ }>;
248
+ cache: z.ZodObject<{
249
+ type: z.ZodString;
250
+ functional: z.ZodBoolean;
251
+ issues: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
252
+ }, "strip", z.ZodTypeAny, {
253
+ type: string;
254
+ functional: boolean;
255
+ issues?: string[] | undefined;
256
+ }, {
257
+ type: string;
258
+ functional: boolean;
259
+ issues?: string[] | undefined;
260
+ }>;
261
+ }, "strip", z.ZodTypeAny, {
262
+ environment: {
263
+ valid: boolean;
264
+ missing: string[];
265
+ issues?: string[] | undefined;
266
+ };
267
+ packages: {
268
+ version: string;
269
+ name: string;
270
+ compatible: boolean;
271
+ issues?: string[] | undefined;
272
+ }[];
273
+ xmcpUpstream: {
274
+ version: string;
275
+ compatible: boolean;
276
+ issues?: string[] | undefined;
277
+ };
278
+ kta: {
279
+ reachable: boolean;
280
+ authenticated: boolean;
281
+ issues?: string[] | undefined;
282
+ };
283
+ cache: {
284
+ type: string;
285
+ functional: boolean;
286
+ issues?: string[] | undefined;
287
+ };
288
+ }, {
289
+ environment: {
290
+ valid: boolean;
291
+ missing: string[];
292
+ issues?: string[] | undefined;
293
+ };
294
+ packages: {
295
+ version: string;
296
+ name: string;
297
+ compatible: boolean;
298
+ issues?: string[] | undefined;
299
+ }[];
300
+ xmcpUpstream: {
301
+ version: string;
302
+ compatible: boolean;
303
+ issues?: string[] | undefined;
304
+ };
305
+ kta: {
306
+ reachable: boolean;
307
+ authenticated: boolean;
308
+ issues?: string[] | undefined;
309
+ };
310
+ cache: {
311
+ type: string;
312
+ functional: boolean;
313
+ issues?: string[] | undefined;
314
+ };
315
+ }>;
316
+ export declare const ScaffolderOptionsSchema: z.ZodObject<{
317
+ projectName: z.ZodString;
318
+ xmcpVersion: z.ZodOptional<z.ZodString>;
319
+ xmcpChannel: z.ZodOptional<z.ZodEnum<["latest", "next"]>>;
320
+ noIdentity: z.ZodDefault<z.ZodBoolean>;
321
+ }, "strip", z.ZodTypeAny, {
322
+ projectName: string;
323
+ noIdentity: boolean;
324
+ xmcpVersion?: string | undefined;
325
+ xmcpChannel?: "latest" | "next" | undefined;
326
+ }, {
327
+ projectName: string;
328
+ xmcpVersion?: string | undefined;
329
+ xmcpChannel?: "latest" | "next" | undefined;
330
+ noIdentity?: boolean | undefined;
331
+ }>;
332
+ export declare const ScaffolderResultSchema: z.ZodObject<{
333
+ success: z.ZodBoolean;
334
+ projectPath: z.ZodString;
335
+ xmcpVersion: z.ZodString;
336
+ identityEnabled: z.ZodBoolean;
337
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
338
+ }, "strip", z.ZodTypeAny, {
339
+ success: boolean;
340
+ xmcpVersion: string;
341
+ projectPath: string;
342
+ identityEnabled: boolean;
343
+ warnings?: string[] | undefined;
344
+ }, {
345
+ success: boolean;
346
+ xmcpVersion: string;
347
+ projectPath: string;
348
+ identityEnabled: boolean;
349
+ warnings?: string[] | undefined;
350
+ }>;
351
+ export type CLIIdentityFile = z.infer<typeof CLIIdentityFileSchema>;
352
+ export type KeyRotationResult = z.infer<typeof KeyRotationResultSchema>;
353
+ export type StatusReport = z.infer<typeof StatusReportSchema>;
354
+ export type PackageInfo = z.infer<typeof PackageInfoSchema>;
355
+ export type XMCPUpstreamInfo = z.infer<typeof XMCPUpstreamInfoSchema>;
356
+ export type EnvironmentInfo = z.infer<typeof EnvironmentInfoSchema>;
357
+ export type KTAInfo = z.infer<typeof KTAInfoSchema>;
358
+ export type CacheInfo = z.infer<typeof CacheInfoSchema>;
359
+ export type DoctorResult = z.infer<typeof DoctorResultSchema>;
360
+ export type ScaffolderOptions = z.infer<typeof ScaffolderOptionsSchema>;
361
+ export type ScaffolderResult = z.infer<typeof ScaffolderResultSchema>;
362
+ /**
363
+ * @deprecated Use CLIIdentityFile instead
364
+ * This export is maintained for backward compatibility
365
+ */
366
+ export type IdentityConfig = CLIIdentityFile;
367
+ export declare const ERROR_CODES: {
368
+ readonly XMCP_I_EBADPROOF: "XMCP_I_EBADPROOF";
369
+ readonly XMCP_I_ENOIDENTITY: "XMCP_I_ENOIDENTITY";
370
+ readonly XMCP_I_EMIRRORPENDING: "XMCP_I_EMIRRORPENDING";
371
+ readonly XMCP_I_EHANDSHAKE: "XMCP_I_EHANDSHAKE";
372
+ readonly XMCP_I_ESESSION: "XMCP_I_ESESSION";
373
+ readonly XMCP_I_ECLAIM: "XMCP_I_ECLAIM";
374
+ readonly XMCP_I_ECONFIG: "XMCP_I_ECONFIG";
375
+ readonly XMCP_I_ERUNTIME: "XMCP_I_ERUNTIME";
376
+ };
377
+ export type ErrorCode = keyof typeof ERROR_CODES;
378
+ export declare const CLI_EXIT_CODES: {
379
+ readonly SUCCESS: 0;
380
+ readonly GENERAL_ERROR: 1;
381
+ readonly BADPROOF: 20;
382
+ readonly NOIDENTITY: 21;
383
+ readonly HANDSHAKE: 22;
384
+ readonly SESSION: 23;
385
+ readonly CLAIM: 24;
386
+ readonly CONFIG: 25;
387
+ readonly RUNTIME: 26;
388
+ };
package/dist/cli.js ADDED
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CLI_EXIT_CODES = exports.ERROR_CODES = exports.ScaffolderResultSchema = exports.ScaffolderOptionsSchema = exports.DoctorResultSchema = exports.CacheInfoSchema = exports.KTAInfoSchema = exports.EnvironmentInfoSchema = exports.XMCPUpstreamInfoSchema = exports.PackageInfoSchema = exports.StatusReportSchema = exports.KeyRotationResultSchema = exports.CLIIdentityFileSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ /**
6
+ * CLI command schemas and results
7
+ */
8
+ /**
9
+ * CLI Identity File Format Schema
10
+ *
11
+ * Format for identity.json files stored on disk.
12
+ * Used by CLI tools for identity management.
13
+ */
14
+ exports.CLIIdentityFileSchema = zod_1.z.object({
15
+ version: zod_1.z.literal("1.0"),
16
+ did: zod_1.z.string().min(1),
17
+ // Accept both kid and keyId for backward compatibility with pre-1.3 identity files
18
+ kid: zod_1.z.string().min(1).optional(),
19
+ keyId: zod_1.z.string().min(1).optional(),
20
+ privateKey: zod_1.z.string().regex(/^[A-Za-z0-9+/]{43}=$/, "Must be a valid base64-encoded Ed25519 private key (44 characters)"),
21
+ publicKey: zod_1.z.string().regex(/^[A-Za-z0-9+/]{43}=$/, "Must be a valid base64-encoded Ed25519 public key (44 characters)"),
22
+ createdAt: zod_1.z.string().datetime(),
23
+ lastRotated: zod_1.z.string().datetime().optional(),
24
+ }).refine((data) => data.kid || data.keyId, {
25
+ message: "Either kid or keyId must be provided",
26
+ }).transform((data) => ({
27
+ version: data.version,
28
+ did: data.did,
29
+ kid: data.kid || data.keyId,
30
+ privateKey: data.privateKey,
31
+ publicKey: data.publicKey,
32
+ createdAt: data.createdAt,
33
+ lastRotated: data.lastRotated,
34
+ }));
35
+ exports.KeyRotationResultSchema = zod_1.z.object({
36
+ success: zod_1.z.boolean(),
37
+ oldKeyId: zod_1.z.string().min(1),
38
+ newKeyId: zod_1.z.string().min(1),
39
+ did: zod_1.z.string().min(1),
40
+ mode: zod_1.z.enum(["dev", "prod"]),
41
+ delegated: zod_1.z.boolean(),
42
+ forced: zod_1.z.boolean(),
43
+ auditLine: zod_1.z.string().min(1),
44
+ });
45
+ exports.StatusReportSchema = zod_1.z.object({
46
+ did: zod_1.z.string().min(1),
47
+ kid: zod_1.z.string().min(1), // Changed from keyId to kid for spec compliance
48
+ ktaURL: zod_1.z.string().url(),
49
+ mirrorStatus: zod_1.z.enum(["pending", "success", "error"]),
50
+ lastHandshake: zod_1.z.number().int().positive().optional(),
51
+ environment: zod_1.z.enum(["dev", "prod"]),
52
+ });
53
+ exports.PackageInfoSchema = zod_1.z.object({
54
+ name: zod_1.z.string(),
55
+ version: zod_1.z.string(),
56
+ compatible: zod_1.z.boolean(),
57
+ issues: zod_1.z.array(zod_1.z.string()).optional(),
58
+ });
59
+ exports.XMCPUpstreamInfoSchema = zod_1.z.object({
60
+ version: zod_1.z.string(),
61
+ compatible: zod_1.z.boolean(),
62
+ issues: zod_1.z.array(zod_1.z.string()).optional(),
63
+ });
64
+ exports.EnvironmentInfoSchema = zod_1.z.object({
65
+ valid: zod_1.z.boolean(),
66
+ missing: zod_1.z.array(zod_1.z.string()),
67
+ issues: zod_1.z.array(zod_1.z.string()).optional(),
68
+ });
69
+ exports.KTAInfoSchema = zod_1.z.object({
70
+ reachable: zod_1.z.boolean(),
71
+ authenticated: zod_1.z.boolean(),
72
+ issues: zod_1.z.array(zod_1.z.string()).optional(),
73
+ });
74
+ exports.CacheInfoSchema = zod_1.z.object({
75
+ type: zod_1.z.string(),
76
+ functional: zod_1.z.boolean(),
77
+ issues: zod_1.z.array(zod_1.z.string()).optional(),
78
+ });
79
+ exports.DoctorResultSchema = zod_1.z.object({
80
+ packages: zod_1.z.array(exports.PackageInfoSchema),
81
+ xmcpUpstream: exports.XMCPUpstreamInfoSchema,
82
+ environment: exports.EnvironmentInfoSchema,
83
+ kta: exports.KTAInfoSchema,
84
+ cache: exports.CacheInfoSchema,
85
+ });
86
+ exports.ScaffolderOptionsSchema = zod_1.z.object({
87
+ projectName: zod_1.z.string().min(1),
88
+ xmcpVersion: zod_1.z.string().optional(),
89
+ xmcpChannel: zod_1.z.enum(["latest", "next"]).optional(),
90
+ noIdentity: zod_1.z.boolean().default(false),
91
+ });
92
+ exports.ScaffolderResultSchema = zod_1.z.object({
93
+ success: zod_1.z.boolean(),
94
+ projectPath: zod_1.z.string().min(1),
95
+ xmcpVersion: zod_1.z.string().min(1),
96
+ identityEnabled: zod_1.z.boolean(),
97
+ warnings: zod_1.z.array(zod_1.z.string()).optional(),
98
+ });
99
+ // Error codes as string literal union
100
+ exports.ERROR_CODES = {
101
+ XMCP_I_EBADPROOF: "XMCP_I_EBADPROOF",
102
+ XMCP_I_ENOIDENTITY: "XMCP_I_ENOIDENTITY",
103
+ XMCP_I_EMIRRORPENDING: "XMCP_I_EMIRRORPENDING",
104
+ XMCP_I_EHANDSHAKE: "XMCP_I_EHANDSHAKE",
105
+ XMCP_I_ESESSION: "XMCP_I_ESESSION",
106
+ XMCP_I_ECLAIM: "XMCP_I_ECLAIM",
107
+ XMCP_I_ECONFIG: "XMCP_I_ECONFIG",
108
+ XMCP_I_ERUNTIME: "XMCP_I_ERUNTIME",
109
+ };
110
+ // CLI exit codes
111
+ exports.CLI_EXIT_CODES = {
112
+ SUCCESS: 0,
113
+ GENERAL_ERROR: 1,
114
+ BADPROOF: 20,
115
+ NOIDENTITY: 21,
116
+ HANDSHAKE: 22,
117
+ SESSION: 23,
118
+ CLAIM: 24,
119
+ CONFIG: 25,
120
+ RUNTIME: 26,
121
+ };
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Base Configuration Types
3
+ *
4
+ * Shared configuration interfaces that are platform-agnostic and used
5
+ * across all XMCP-I implementations. These form the foundation of the
6
+ * configuration hierarchy.
7
+ *
8
+ * @module @kya-os/contracts/config
9
+ */
10
+ /**
11
+ * Base configuration shared across ALL platforms
12
+ *
13
+ * This interface defines the core configuration options that are
14
+ * universally applicable regardless of the runtime platform (Node.js,
15
+ * Cloudflare Workers, etc.).
16
+ */
17
+ export interface MCPIBaseConfig {
18
+ /**
19
+ * Runtime environment setting
20
+ * - 'development': Enables debug logging, dev identity, relaxed security
21
+ * - 'production': Production security, identity from env vars, minimal logging
22
+ */
23
+ environment: 'development' | 'production';
24
+ /**
25
+ * Session configuration
26
+ * Controls how sessions are managed and validated
27
+ */
28
+ session?: {
29
+ /**
30
+ * Maximum time skew allowed for timestamp validation (in seconds)
31
+ * Helps handle clock drift between client and server
32
+ * @default 120
33
+ */
34
+ timestampSkewSeconds?: number;
35
+ /**
36
+ * Session time-to-live in minutes
37
+ * How long a session remains valid after creation
38
+ * @default 30
39
+ */
40
+ ttlMinutes?: number;
41
+ /**
42
+ * Absolute session lifetime in minutes (optional)
43
+ * Maximum lifetime regardless of activity
44
+ */
45
+ absoluteLifetime?: number;
46
+ };
47
+ /**
48
+ * Audit logging configuration
49
+ * Controls what gets logged for security and compliance
50
+ */
51
+ audit?: {
52
+ /**
53
+ * Enable audit logging
54
+ * @default true in production, false in development
55
+ */
56
+ enabled: boolean;
57
+ /**
58
+ * Include proof hashes in audit logs
59
+ * Useful for cryptographic verification but increases log size
60
+ * @default false
61
+ */
62
+ includeProofHashes?: boolean;
63
+ /**
64
+ * Include full payloads in audit logs
65
+ * WARNING: May include sensitive data
66
+ * @default false
67
+ */
68
+ includePayloads?: boolean;
69
+ /**
70
+ * Custom log function for audit records
71
+ * If not provided, uses console.log
72
+ */
73
+ logFunction?: (record: string) => void;
74
+ };
75
+ /**
76
+ * Well-known endpoints configuration
77
+ * Controls the /.well-known/* endpoints for identity discovery
78
+ */
79
+ wellKnown?: {
80
+ /**
81
+ * Enable well-known endpoints
82
+ * @default true
83
+ */
84
+ enabled: boolean;
85
+ /**
86
+ * Service name advertised in well-known endpoints
87
+ * @default 'MCP-I Service'
88
+ */
89
+ serviceName?: string;
90
+ /**
91
+ * Service endpoint URL
92
+ * @default 'https://example.com'
93
+ */
94
+ serviceEndpoint?: string;
95
+ };
96
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * Base Configuration Types
4
+ *
5
+ * Shared configuration interfaces that are platform-agnostic and used
6
+ * across all XMCP-I implementations. These form the foundation of the
7
+ * configuration hierarchy.
8
+ *
9
+ * @module @kya-os/contracts/config
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });