@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.
Files changed (82) hide show
  1. package/package.json +3 -2
  2. package/README.md +0 -130
  3. package/dist/agentshield-api/endpoints.d.ts +0 -21
  4. package/dist/agentshield-api/endpoints.js +0 -20
  5. package/dist/agentshield-api/index.d.ts +0 -5
  6. package/dist/agentshield-api/index.js +0 -27
  7. package/dist/agentshield-api/schemas.d.ts +0 -9846
  8. package/dist/agentshield-api/schemas.js +0 -92
  9. package/dist/agentshield-api/types.d.ts +0 -92
  10. package/dist/agentshield-api/types.js +0 -12
  11. package/dist/cli.d.ts +0 -375
  12. package/dist/cli.js +0 -109
  13. package/dist/config/base.d.ts +0 -19
  14. package/dist/config/base.js +0 -2
  15. package/dist/config/delegation.d.ts +0 -46
  16. package/dist/config/delegation.js +0 -2
  17. package/dist/config/identity.d.ts +0 -22
  18. package/dist/config/identity.js +0 -2
  19. package/dist/config/index.d.ts +0 -17
  20. package/dist/config/index.js +0 -2
  21. package/dist/config/proofing.d.ts +0 -26
  22. package/dist/config/proofing.js +0 -2
  23. package/dist/config/tool-protection.d.ts +0 -36
  24. package/dist/config/tool-protection.js +0 -2
  25. package/dist/delegation/constraints.d.ts +0 -726
  26. package/dist/delegation/constraints.js +0 -103
  27. package/dist/delegation/index.d.ts +0 -2
  28. package/dist/delegation/index.js +0 -18
  29. package/dist/delegation/schemas.d.ts +0 -8042
  30. package/dist/delegation/schemas.js +0 -232
  31. package/dist/did/index.d.ts +0 -3
  32. package/dist/did/index.js +0 -19
  33. package/dist/did/resolve-contract.d.ts +0 -53
  34. package/dist/did/resolve-contract.js +0 -12
  35. package/dist/did/schemas.d.ts +0 -33
  36. package/dist/did/schemas.js +0 -80
  37. package/dist/did/types.d.ts +0 -38
  38. package/dist/did/types.js +0 -37
  39. package/dist/env/constants.d.ts +0 -13
  40. package/dist/env/constants.js +0 -15
  41. package/dist/env/index.d.ts +0 -1
  42. package/dist/env/index.js +0 -17
  43. package/dist/handshake.d.ts +0 -138
  44. package/dist/handshake.js +0 -50
  45. package/dist/index.d.ts +0 -11
  46. package/dist/index.js +0 -28
  47. package/dist/proof/index.d.ts +0 -2
  48. package/dist/proof/index.js +0 -18
  49. package/dist/proof/proof-record.d.ts +0 -728
  50. package/dist/proof/proof-record.js +0 -60
  51. package/dist/proof/signing-spec.d.ts +0 -73
  52. package/dist/proof/signing-spec.js +0 -52
  53. package/dist/proof.d.ts +0 -378
  54. package/dist/proof.js +0 -59
  55. package/dist/registry.d.ts +0 -326
  56. package/dist/registry.js +0 -98
  57. package/dist/runtime/errors.d.ts +0 -179
  58. package/dist/runtime/errors.js +0 -51
  59. package/dist/runtime/headers.d.ts +0 -34
  60. package/dist/runtime/headers.js +0 -52
  61. package/dist/runtime/index.d.ts +0 -2
  62. package/dist/runtime/index.js +0 -18
  63. package/dist/test.d.ts +0 -215
  64. package/dist/test.js +0 -83
  65. package/dist/tlkrc/index.d.ts +0 -1
  66. package/dist/tlkrc/index.js +0 -17
  67. package/dist/tlkrc/rotation.d.ts +0 -168
  68. package/dist/tlkrc/rotation.js +0 -55
  69. package/dist/tool-protection/index.d.ts +0 -129
  70. package/dist/tool-protection/index.js +0 -80
  71. package/dist/utils/validation.d.ts +0 -14
  72. package/dist/utils/validation.js +0 -56
  73. package/dist/vc/index.d.ts +0 -2
  74. package/dist/vc/index.js +0 -18
  75. package/dist/vc/schemas.d.ts +0 -1888
  76. package/dist/vc/schemas.js +0 -116
  77. package/dist/vc/statuslist.d.ts +0 -292
  78. package/dist/vc/statuslist.js +0 -61
  79. package/dist/verifier.d.ts +0 -202
  80. package/dist/verifier.js +0 -76
  81. package/dist/well-known/index.d.ts +0 -248
  82. package/dist/well-known/index.js +0 -104
@@ -1,326 +0,0 @@
1
- import { z } from "zod";
2
- export declare const RegistrationInputSchema: z.ZodObject<{
3
- agentDID: z.ZodString;
4
- agentURL: z.ZodString;
5
- verificationEndpoint: z.ZodString;
6
- conformanceCapabilities: z.ZodArray<z.ZodEnum<["handshake", "signing", "verification"]>, "many">;
7
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
8
- }, "strip", z.ZodTypeAny, {
9
- agentDID: string;
10
- agentURL: string;
11
- verificationEndpoint: string;
12
- conformanceCapabilities: ("handshake" | "signing" | "verification")[];
13
- metadata?: Record<string, any> | undefined;
14
- }, {
15
- agentDID: string;
16
- agentURL: string;
17
- verificationEndpoint: string;
18
- conformanceCapabilities: ("handshake" | "signing" | "verification")[];
19
- metadata?: Record<string, any> | undefined;
20
- }>;
21
- export declare const RegistrationResultSchema: z.ZodObject<{
22
- agentDID: z.ZodString;
23
- agentURL: z.ZodString;
24
- agentId: z.ZodString;
25
- agentSlug: z.ZodString;
26
- claimURL: z.ZodOptional<z.ZodString>;
27
- verificationEndpoint: z.ZodString;
28
- conformanceCapabilities: z.ZodTuple<[z.ZodLiteral<"handshake">, z.ZodLiteral<"signing">, z.ZodLiteral<"verification">], null>;
29
- mirrorStatus: z.ZodEnum<["pending", "success", "error"]>;
30
- mirrorLink: z.ZodOptional<z.ZodString>;
31
- }, "strip", z.ZodTypeAny, {
32
- mirrorStatus: "success" | "pending" | "error";
33
- agentDID: string;
34
- agentURL: string;
35
- verificationEndpoint: string;
36
- conformanceCapabilities: ["handshake", "signing", "verification"];
37
- agentId: string;
38
- agentSlug: string;
39
- claimURL?: string | undefined;
40
- mirrorLink?: string | undefined;
41
- }, {
42
- mirrorStatus: "success" | "pending" | "error";
43
- agentDID: string;
44
- agentURL: string;
45
- verificationEndpoint: string;
46
- conformanceCapabilities: ["handshake", "signing", "verification"];
47
- agentId: string;
48
- agentSlug: string;
49
- claimURL?: string | undefined;
50
- mirrorLink?: string | undefined;
51
- }>;
52
- export declare const ClaimTokenSchema: z.ZodObject<{
53
- token: z.ZodString;
54
- expiresAt: z.ZodNumber;
55
- ttlHours: z.ZodDefault<z.ZodNumber>;
56
- }, "strip", z.ZodTypeAny, {
57
- expiresAt: number;
58
- token: string;
59
- ttlHours: number;
60
- }, {
61
- expiresAt: number;
62
- token: string;
63
- ttlHours?: number | undefined;
64
- }>;
65
- export declare const MirrorStatusSchema: z.ZodObject<{
66
- status: z.ZodEnum<["pending", "success", "error"]>;
67
- lastUpdated: z.ZodNumber;
68
- errorMessage: z.ZodOptional<z.ZodString>;
69
- registryURL: z.ZodOptional<z.ZodString>;
70
- }, "strip", z.ZodTypeAny, {
71
- status: "success" | "pending" | "error";
72
- lastUpdated: number;
73
- errorMessage?: string | undefined;
74
- registryURL?: string | undefined;
75
- }, {
76
- status: "success" | "pending" | "error";
77
- lastUpdated: number;
78
- errorMessage?: string | undefined;
79
- registryURL?: string | undefined;
80
- }>;
81
- export declare const AgentStatusSchema: z.ZodObject<{
82
- did: z.ZodString;
83
- kid: z.ZodString;
84
- ktaURL: z.ZodString;
85
- mirrorStatus: z.ZodObject<{
86
- status: z.ZodEnum<["pending", "success", "error"]>;
87
- lastUpdated: z.ZodNumber;
88
- errorMessage: z.ZodOptional<z.ZodString>;
89
- registryURL: z.ZodOptional<z.ZodString>;
90
- }, "strip", z.ZodTypeAny, {
91
- status: "success" | "pending" | "error";
92
- lastUpdated: number;
93
- errorMessage?: string | undefined;
94
- registryURL?: string | undefined;
95
- }, {
96
- status: "success" | "pending" | "error";
97
- lastUpdated: number;
98
- errorMessage?: string | undefined;
99
- registryURL?: string | undefined;
100
- }>;
101
- lastHandshake: z.ZodOptional<z.ZodNumber>;
102
- }, "strip", z.ZodTypeAny, {
103
- did: string;
104
- kid: string;
105
- ktaURL: string;
106
- mirrorStatus: {
107
- status: "success" | "pending" | "error";
108
- lastUpdated: number;
109
- errorMessage?: string | undefined;
110
- registryURL?: string | undefined;
111
- };
112
- lastHandshake?: number | undefined;
113
- }, {
114
- did: string;
115
- kid: string;
116
- ktaURL: string;
117
- mirrorStatus: {
118
- status: "success" | "pending" | "error";
119
- lastUpdated: number;
120
- errorMessage?: string | undefined;
121
- registryURL?: string | undefined;
122
- };
123
- lastHandshake?: number | undefined;
124
- }>;
125
- export declare const DelegationSchema: z.ZodObject<{
126
- issuer: z.ZodString;
127
- subject: z.ZodString;
128
- scopes: z.ZodArray<z.ZodString, "many">;
129
- nbf: z.ZodNumber;
130
- exp: z.ZodNumber;
131
- aud: z.ZodOptional<z.ZodString>;
132
- delegationRef: z.ZodOptional<z.ZodString>;
133
- }, "strip", z.ZodTypeAny, {
134
- subject: string;
135
- scopes: string[];
136
- issuer: string;
137
- nbf: number;
138
- exp: number;
139
- delegationRef?: string | undefined;
140
- aud?: string | undefined;
141
- }, {
142
- subject: string;
143
- scopes: string[];
144
- issuer: string;
145
- nbf: number;
146
- exp: number;
147
- delegationRef?: string | undefined;
148
- aud?: string | undefined;
149
- }>;
150
- export declare const DelegationRequestSchema: z.ZodObject<{
151
- subject: z.ZodString;
152
- scopes: z.ZodArray<z.ZodString, "many">;
153
- duration: z.ZodOptional<z.ZodNumber>;
154
- audience: z.ZodOptional<z.ZodString>;
155
- }, "strip", z.ZodTypeAny, {
156
- subject: string;
157
- scopes: string[];
158
- audience?: string | undefined;
159
- duration?: number | undefined;
160
- }, {
161
- subject: string;
162
- scopes: string[];
163
- audience?: string | undefined;
164
- duration?: number | undefined;
165
- }>;
166
- export declare const StorageModeSchema: z.ZodEnum<["ktaEncrypted", "hybridReceiptsOnly", "selfHostedAuthoritative"]>;
167
- export declare const ReceiptSchema: z.ZodObject<{
168
- $schema: z.ZodOptional<z.ZodLiteral<"https://schemas.kya-os.ai/mcpi/receipt/v1.0.0.json">>;
169
- ref: z.ZodString;
170
- contentHash: z.ZodString;
171
- action: z.ZodEnum<["issue", "revoke"]>;
172
- ts: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
173
- logIndex: z.ZodNumber;
174
- logRoot: z.ZodString;
175
- inclusionProof: z.ZodArray<z.ZodString, "many">;
176
- }, "strip", z.ZodTypeAny, {
177
- ts: string | number;
178
- ref: string;
179
- contentHash: string;
180
- action: "issue" | "revoke";
181
- logIndex: number;
182
- logRoot: string;
183
- inclusionProof: string[];
184
- $schema?: "https://schemas.kya-os.ai/mcpi/receipt/v1.0.0.json" | undefined;
185
- }, {
186
- ts: string | number;
187
- ref: string;
188
- contentHash: string;
189
- action: "issue" | "revoke";
190
- logIndex: number;
191
- logRoot: string;
192
- inclusionProof: string[];
193
- $schema?: "https://schemas.kya-os.ai/mcpi/receipt/v1.0.0.json" | undefined;
194
- }>;
195
- export declare const DelegationResponseSchema: z.ZodObject<{
196
- delegation: z.ZodObject<{
197
- issuer: z.ZodString;
198
- subject: z.ZodString;
199
- scopes: z.ZodArray<z.ZodString, "many">;
200
- nbf: z.ZodNumber;
201
- exp: z.ZodNumber;
202
- aud: z.ZodOptional<z.ZodString>;
203
- delegationRef: z.ZodOptional<z.ZodString>;
204
- }, "strip", z.ZodTypeAny, {
205
- subject: string;
206
- scopes: string[];
207
- issuer: string;
208
- nbf: number;
209
- exp: number;
210
- delegationRef?: string | undefined;
211
- aud?: string | undefined;
212
- }, {
213
- subject: string;
214
- scopes: string[];
215
- issuer: string;
216
- nbf: number;
217
- exp: number;
218
- delegationRef?: string | undefined;
219
- aud?: string | undefined;
220
- }>;
221
- receipt: z.ZodObject<{
222
- $schema: z.ZodOptional<z.ZodLiteral<"https://schemas.kya-os.ai/mcpi/receipt/v1.0.0.json">>;
223
- ref: z.ZodString;
224
- contentHash: z.ZodString;
225
- action: z.ZodEnum<["issue", "revoke"]>;
226
- ts: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
227
- logIndex: z.ZodNumber;
228
- logRoot: z.ZodString;
229
- inclusionProof: z.ZodArray<z.ZodString, "many">;
230
- }, "strip", z.ZodTypeAny, {
231
- ts: string | number;
232
- ref: string;
233
- contentHash: string;
234
- action: "issue" | "revoke";
235
- logIndex: number;
236
- logRoot: string;
237
- inclusionProof: string[];
238
- $schema?: "https://schemas.kya-os.ai/mcpi/receipt/v1.0.0.json" | undefined;
239
- }, {
240
- ts: string | number;
241
- ref: string;
242
- contentHash: string;
243
- action: "issue" | "revoke";
244
- logIndex: number;
245
- logRoot: string;
246
- inclusionProof: string[];
247
- $schema?: "https://schemas.kya-os.ai/mcpi/receipt/v1.0.0.json" | undefined;
248
- }>;
249
- encryptedPayload: z.ZodOptional<z.ZodString>;
250
- }, "strip", z.ZodTypeAny, {
251
- delegation: {
252
- subject: string;
253
- scopes: string[];
254
- issuer: string;
255
- nbf: number;
256
- exp: number;
257
- delegationRef?: string | undefined;
258
- aud?: string | undefined;
259
- };
260
- receipt: {
261
- ts: string | number;
262
- ref: string;
263
- contentHash: string;
264
- action: "issue" | "revoke";
265
- logIndex: number;
266
- logRoot: string;
267
- inclusionProof: string[];
268
- $schema?: "https://schemas.kya-os.ai/mcpi/receipt/v1.0.0.json" | undefined;
269
- };
270
- encryptedPayload?: string | undefined;
271
- }, {
272
- delegation: {
273
- subject: string;
274
- scopes: string[];
275
- issuer: string;
276
- nbf: number;
277
- exp: number;
278
- delegationRef?: string | undefined;
279
- aud?: string | undefined;
280
- };
281
- receipt: {
282
- ts: string | number;
283
- ref: string;
284
- contentHash: string;
285
- action: "issue" | "revoke";
286
- logIndex: number;
287
- logRoot: string;
288
- inclusionProof: string[];
289
- $schema?: "https://schemas.kya-os.ai/mcpi/receipt/v1.0.0.json" | undefined;
290
- };
291
- encryptedPayload?: string | undefined;
292
- }>;
293
- export declare const StorageConfigSchema: z.ZodObject<{
294
- mode: z.ZodEnum<["ktaEncrypted", "hybridReceiptsOnly", "selfHostedAuthoritative"]>;
295
- encryptionEnabled: z.ZodDefault<z.ZodBoolean>;
296
- receiptVerificationEnabled: z.ZodDefault<z.ZodBoolean>;
297
- ktaBaseURL: z.ZodDefault<z.ZodString>;
298
- }, "strip", z.ZodTypeAny, {
299
- mode: "ktaEncrypted" | "hybridReceiptsOnly" | "selfHostedAuthoritative";
300
- encryptionEnabled: boolean;
301
- receiptVerificationEnabled: boolean;
302
- ktaBaseURL: string;
303
- }, {
304
- mode: "ktaEncrypted" | "hybridReceiptsOnly" | "selfHostedAuthoritative";
305
- encryptionEnabled?: boolean | undefined;
306
- receiptVerificationEnabled?: boolean | undefined;
307
- ktaBaseURL?: string | undefined;
308
- }>;
309
- export type RegistrationInput = z.infer<typeof RegistrationInputSchema>;
310
- export type RegistrationResult = z.infer<typeof RegistrationResultSchema>;
311
- export type ClaimToken = z.infer<typeof ClaimTokenSchema>;
312
- export type MirrorStatus = z.infer<typeof MirrorStatusSchema>;
313
- export type AgentStatus = z.infer<typeof AgentStatusSchema>;
314
- export type StorageMode = z.infer<typeof StorageModeSchema>;
315
- export type Receipt = z.infer<typeof ReceiptSchema>;
316
- export type StorageConfig = z.infer<typeof StorageConfigSchema>;
317
- export type Delegation = z.infer<typeof DelegationSchema>;
318
- export type DelegationRequest = z.infer<typeof DelegationRequestSchema>;
319
- export type DelegationResponse = z.infer<typeof DelegationResponseSchema>;
320
- export declare const MCP_I_CAPABILITIES: readonly ["handshake", "signing", "verification"];
321
- export declare const CLAIM_TOKEN_TTL_HOURS = 24;
322
- export declare const KTA_BASE_URL = "https://knowthat.ai";
323
- export declare const DEFAULT_STORAGE_MODE: StorageMode;
324
- export declare const STORAGE_MODE_ENV_VAR = "MCPI_STORAGE_MODE";
325
- export declare const RECEIPT_SCHEMA_ID = "https://schemas.kya-os.ai/mcpi/receipt/v1.0.0.json";
326
- export declare const CONTENT_HASH_REGEX: RegExp;
package/dist/registry.js DELETED
@@ -1,98 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CONTENT_HASH_REGEX = exports.RECEIPT_SCHEMA_ID = exports.STORAGE_MODE_ENV_VAR = exports.DEFAULT_STORAGE_MODE = exports.KTA_BASE_URL = exports.CLAIM_TOKEN_TTL_HOURS = exports.MCP_I_CAPABILITIES = exports.StorageConfigSchema = exports.DelegationResponseSchema = exports.ReceiptSchema = exports.StorageModeSchema = exports.DelegationRequestSchema = exports.DelegationSchema = exports.AgentStatusSchema = exports.MirrorStatusSchema = exports.ClaimTokenSchema = exports.RegistrationResultSchema = exports.RegistrationInputSchema = void 0;
4
- const zod_1 = require("zod");
5
- exports.RegistrationInputSchema = zod_1.z.object({
6
- agentDID: zod_1.z.string().min(1),
7
- agentURL: zod_1.z.string().url(),
8
- verificationEndpoint: zod_1.z.string().url(),
9
- conformanceCapabilities: zod_1.z.array(zod_1.z.enum(["handshake", "signing", "verification"])),
10
- metadata: zod_1.z.record(zod_1.z.any()).optional(),
11
- });
12
- exports.RegistrationResultSchema = zod_1.z.object({
13
- agentDID: zod_1.z.string().min(1),
14
- agentURL: zod_1.z.string().url(),
15
- agentId: zod_1.z.string().min(1),
16
- agentSlug: zod_1.z.string().min(1),
17
- claimURL: zod_1.z.string().url().optional(),
18
- verificationEndpoint: zod_1.z.string().url(),
19
- conformanceCapabilities: zod_1.z.tuple([
20
- zod_1.z.literal("handshake"),
21
- zod_1.z.literal("signing"),
22
- zod_1.z.literal("verification"),
23
- ]),
24
- mirrorStatus: zod_1.z.enum(["pending", "success", "error"]),
25
- mirrorLink: zod_1.z.string().url().optional(),
26
- });
27
- exports.ClaimTokenSchema = zod_1.z.object({
28
- token: zod_1.z.string().min(1),
29
- expiresAt: zod_1.z.number().int().positive(),
30
- ttlHours: zod_1.z.number().int().positive().default(24),
31
- });
32
- exports.MirrorStatusSchema = zod_1.z.object({
33
- status: zod_1.z.enum(["pending", "success", "error"]),
34
- lastUpdated: zod_1.z.number().int().positive(),
35
- errorMessage: zod_1.z.string().optional(),
36
- registryURL: zod_1.z.string().url().optional(),
37
- });
38
- exports.AgentStatusSchema = zod_1.z.object({
39
- did: zod_1.z.string().min(1),
40
- kid: zod_1.z.string().min(1),
41
- ktaURL: zod_1.z.string().url(),
42
- mirrorStatus: exports.MirrorStatusSchema,
43
- lastHandshake: zod_1.z.number().int().positive().optional(),
44
- });
45
- exports.DelegationSchema = zod_1.z.object({
46
- issuer: zod_1.z.string().min(1),
47
- subject: zod_1.z.string().min(1),
48
- scopes: zod_1.z.array(zod_1.z.string()),
49
- nbf: zod_1.z.number().int().positive(),
50
- exp: zod_1.z.number().int().positive(),
51
- aud: zod_1.z.string().optional(),
52
- delegationRef: zod_1.z.string().optional(),
53
- });
54
- exports.DelegationRequestSchema = zod_1.z.object({
55
- subject: zod_1.z.string().min(1),
56
- scopes: zod_1.z.array(zod_1.z.string()),
57
- duration: zod_1.z.number().int().positive().optional(),
58
- audience: zod_1.z.string().optional(),
59
- });
60
- exports.StorageModeSchema = zod_1.z.enum([
61
- "ktaEncrypted",
62
- "hybridReceiptsOnly",
63
- "selfHostedAuthoritative",
64
- ]);
65
- exports.ReceiptSchema = zod_1.z.object({
66
- $schema: zod_1.z
67
- .literal("https://schemas.kya-os.ai/mcpi/receipt/v1.0.0.json")
68
- .optional(),
69
- ref: zod_1.z.string().min(1),
70
- contentHash: zod_1.z.string().regex(/^sha256:[a-f0-9]{64}$/),
71
- action: zod_1.z.enum(["issue", "revoke"]),
72
- ts: zod_1.z.union([zod_1.z.string().datetime(), zod_1.z.number().int().positive()]),
73
- logIndex: zod_1.z.number().int().nonnegative(),
74
- logRoot: zod_1.z.string().min(1),
75
- inclusionProof: zod_1.z.array(zod_1.z.string()),
76
- });
77
- exports.DelegationResponseSchema = zod_1.z.object({
78
- delegation: exports.DelegationSchema,
79
- receipt: exports.ReceiptSchema,
80
- encryptedPayload: zod_1.z.string().optional(),
81
- });
82
- exports.StorageConfigSchema = zod_1.z.object({
83
- mode: exports.StorageModeSchema,
84
- encryptionEnabled: zod_1.z.boolean().default(false),
85
- receiptVerificationEnabled: zod_1.z.boolean().default(true),
86
- ktaBaseURL: zod_1.z.string().url().default("https://knowthat.ai"),
87
- });
88
- exports.MCP_I_CAPABILITIES = [
89
- "handshake",
90
- "signing",
91
- "verification",
92
- ];
93
- exports.CLAIM_TOKEN_TTL_HOURS = 24;
94
- exports.KTA_BASE_URL = "https://knowthat.ai";
95
- exports.DEFAULT_STORAGE_MODE = "ktaEncrypted";
96
- exports.STORAGE_MODE_ENV_VAR = "MCPI_STORAGE_MODE";
97
- exports.RECEIPT_SCHEMA_ID = "https://schemas.kya-os.ai/mcpi/receipt/v1.0.0.json";
98
- exports.CONTENT_HASH_REGEX = /^sha256:[a-f0-9]{64}$/;
@@ -1,179 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const DisplayHintSchema: z.ZodEnum<["link", "qr", "code"]>;
3
- export type DisplayHint = z.infer<typeof DisplayHintSchema>;
4
- export declare const AuthorizationDisplaySchema: z.ZodObject<{
5
- title: z.ZodOptional<z.ZodString>;
6
- hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
7
- authorizationCode: z.ZodOptional<z.ZodString>;
8
- qrUrl: z.ZodOptional<z.ZodString>;
9
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
10
- title: z.ZodOptional<z.ZodString>;
11
- hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
12
- authorizationCode: z.ZodOptional<z.ZodString>;
13
- qrUrl: z.ZodOptional<z.ZodString>;
14
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
15
- title: z.ZodOptional<z.ZodString>;
16
- hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
17
- authorizationCode: z.ZodOptional<z.ZodString>;
18
- qrUrl: z.ZodOptional<z.ZodString>;
19
- }, z.ZodTypeAny, "passthrough">>;
20
- export type AuthorizationDisplay = z.infer<typeof AuthorizationDisplaySchema>;
21
- export declare const NeedsAuthorizationErrorSchema: z.ZodObject<{
22
- error: z.ZodLiteral<"needs_authorization">;
23
- message: z.ZodString;
24
- authorizationUrl: z.ZodString;
25
- resumeToken: z.ZodString;
26
- expiresAt: z.ZodNumber;
27
- scopes: z.ZodArray<z.ZodString, "many">;
28
- display: z.ZodOptional<z.ZodObject<{
29
- title: z.ZodOptional<z.ZodString>;
30
- hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
31
- authorizationCode: z.ZodOptional<z.ZodString>;
32
- qrUrl: z.ZodOptional<z.ZodString>;
33
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
34
- title: z.ZodOptional<z.ZodString>;
35
- hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
36
- authorizationCode: z.ZodOptional<z.ZodString>;
37
- qrUrl: z.ZodOptional<z.ZodString>;
38
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
39
- title: z.ZodOptional<z.ZodString>;
40
- hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
41
- authorizationCode: z.ZodOptional<z.ZodString>;
42
- qrUrl: z.ZodOptional<z.ZodString>;
43
- }, z.ZodTypeAny, "passthrough">>>;
44
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
45
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
46
- error: z.ZodLiteral<"needs_authorization">;
47
- message: z.ZodString;
48
- authorizationUrl: z.ZodString;
49
- resumeToken: z.ZodString;
50
- expiresAt: z.ZodNumber;
51
- scopes: z.ZodArray<z.ZodString, "many">;
52
- display: z.ZodOptional<z.ZodObject<{
53
- title: z.ZodOptional<z.ZodString>;
54
- hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
55
- authorizationCode: z.ZodOptional<z.ZodString>;
56
- qrUrl: z.ZodOptional<z.ZodString>;
57
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
58
- title: z.ZodOptional<z.ZodString>;
59
- hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
60
- authorizationCode: z.ZodOptional<z.ZodString>;
61
- qrUrl: z.ZodOptional<z.ZodString>;
62
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
63
- title: z.ZodOptional<z.ZodString>;
64
- hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
65
- authorizationCode: z.ZodOptional<z.ZodString>;
66
- qrUrl: z.ZodOptional<z.ZodString>;
67
- }, z.ZodTypeAny, "passthrough">>>;
68
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
69
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
70
- error: z.ZodLiteral<"needs_authorization">;
71
- message: z.ZodString;
72
- authorizationUrl: z.ZodString;
73
- resumeToken: z.ZodString;
74
- expiresAt: z.ZodNumber;
75
- scopes: z.ZodArray<z.ZodString, "many">;
76
- display: z.ZodOptional<z.ZodObject<{
77
- title: z.ZodOptional<z.ZodString>;
78
- hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
79
- authorizationCode: z.ZodOptional<z.ZodString>;
80
- qrUrl: z.ZodOptional<z.ZodString>;
81
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
82
- title: z.ZodOptional<z.ZodString>;
83
- hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
84
- authorizationCode: z.ZodOptional<z.ZodString>;
85
- qrUrl: z.ZodOptional<z.ZodString>;
86
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
87
- title: z.ZodOptional<z.ZodString>;
88
- hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
89
- authorizationCode: z.ZodOptional<z.ZodString>;
90
- qrUrl: z.ZodOptional<z.ZodString>;
91
- }, z.ZodTypeAny, "passthrough">>>;
92
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
93
- }, z.ZodTypeAny, "passthrough">>;
94
- export type NeedsAuthorizationError = z.infer<typeof NeedsAuthorizationErrorSchema>;
95
- export declare const RuntimeErrorSchema: z.ZodObject<{
96
- error: z.ZodString;
97
- message: z.ZodString;
98
- details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
99
- httpStatus: z.ZodOptional<z.ZodNumber>;
100
- }, "strip", z.ZodTypeAny, {
101
- message: string;
102
- error: string;
103
- details?: Record<string, any> | undefined;
104
- httpStatus?: number | undefined;
105
- }, {
106
- message: string;
107
- error: string;
108
- details?: Record<string, any> | undefined;
109
- httpStatus?: number | undefined;
110
- }>;
111
- export type RuntimeError = z.infer<typeof RuntimeErrorSchema>;
112
- export declare function validateNeedsAuthorizationError(error: unknown): z.SafeParseReturnType<z.objectInputType<{
113
- error: z.ZodLiteral<"needs_authorization">;
114
- message: z.ZodString;
115
- authorizationUrl: z.ZodString;
116
- resumeToken: z.ZodString;
117
- expiresAt: z.ZodNumber;
118
- scopes: z.ZodArray<z.ZodString, "many">;
119
- display: z.ZodOptional<z.ZodObject<{
120
- title: z.ZodOptional<z.ZodString>;
121
- hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
122
- authorizationCode: z.ZodOptional<z.ZodString>;
123
- qrUrl: z.ZodOptional<z.ZodString>;
124
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
125
- title: z.ZodOptional<z.ZodString>;
126
- hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
127
- authorizationCode: z.ZodOptional<z.ZodString>;
128
- qrUrl: z.ZodOptional<z.ZodString>;
129
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
130
- title: z.ZodOptional<z.ZodString>;
131
- hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
132
- authorizationCode: z.ZodOptional<z.ZodString>;
133
- qrUrl: z.ZodOptional<z.ZodString>;
134
- }, z.ZodTypeAny, "passthrough">>>;
135
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
136
- }, z.ZodTypeAny, "passthrough">, z.objectOutputType<{
137
- error: z.ZodLiteral<"needs_authorization">;
138
- message: z.ZodString;
139
- authorizationUrl: z.ZodString;
140
- resumeToken: z.ZodString;
141
- expiresAt: z.ZodNumber;
142
- scopes: z.ZodArray<z.ZodString, "many">;
143
- display: z.ZodOptional<z.ZodObject<{
144
- title: z.ZodOptional<z.ZodString>;
145
- hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
146
- authorizationCode: z.ZodOptional<z.ZodString>;
147
- qrUrl: z.ZodOptional<z.ZodString>;
148
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
149
- title: z.ZodOptional<z.ZodString>;
150
- hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
151
- authorizationCode: z.ZodOptional<z.ZodString>;
152
- qrUrl: z.ZodOptional<z.ZodString>;
153
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
154
- title: z.ZodOptional<z.ZodString>;
155
- hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
156
- authorizationCode: z.ZodOptional<z.ZodString>;
157
- qrUrl: z.ZodOptional<z.ZodString>;
158
- }, z.ZodTypeAny, "passthrough">>>;
159
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
160
- }, z.ZodTypeAny, "passthrough">>;
161
- export declare function isNeedsAuthorizationError(error: any): error is NeedsAuthorizationError;
162
- export declare function createNeedsAuthorizationError(config: {
163
- message: string;
164
- authorizationUrl: string;
165
- resumeToken: string;
166
- expiresAt: number;
167
- scopes: string[];
168
- display?: AuthorizationDisplay;
169
- }): NeedsAuthorizationError;
170
- export declare const ERROR_CODES: Readonly<{
171
- readonly NEEDS_AUTHORIZATION: "needs_authorization";
172
- readonly INVALID_TOKEN: "invalid_token";
173
- readonly TOKEN_EXPIRED: "token_expired";
174
- readonly INSUFFICIENT_SCOPE: "insufficient_scope";
175
- readonly INVALID_SIGNATURE: "invalid_signature";
176
- readonly DELEGATION_REVOKED: "delegation_revoked";
177
- readonly CREDENTIAL_REVOKED: "credential_revoked";
178
- }>;
179
- export type ErrorCode = typeof ERROR_CODES[keyof typeof ERROR_CODES];
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ERROR_CODES = exports.RuntimeErrorSchema = exports.NeedsAuthorizationErrorSchema = exports.AuthorizationDisplaySchema = exports.DisplayHintSchema = void 0;
4
- exports.validateNeedsAuthorizationError = validateNeedsAuthorizationError;
5
- exports.isNeedsAuthorizationError = isNeedsAuthorizationError;
6
- exports.createNeedsAuthorizationError = createNeedsAuthorizationError;
7
- const zod_1 = require("zod");
8
- exports.DisplayHintSchema = zod_1.z.enum(['link', 'qr', 'code']);
9
- exports.AuthorizationDisplaySchema = zod_1.z.object({
10
- title: zod_1.z.string().optional(),
11
- hint: zod_1.z.array(exports.DisplayHintSchema).optional(),
12
- authorizationCode: zod_1.z.string().optional(),
13
- qrUrl: zod_1.z.string().url().optional(),
14
- }).passthrough();
15
- exports.NeedsAuthorizationErrorSchema = zod_1.z.object({
16
- error: zod_1.z.literal('needs_authorization'),
17
- message: zod_1.z.string().min(1),
18
- authorizationUrl: zod_1.z.string().url(),
19
- resumeToken: zod_1.z.string().min(1),
20
- expiresAt: zod_1.z.number().int().positive(),
21
- scopes: zod_1.z.array(zod_1.z.string()),
22
- display: exports.AuthorizationDisplaySchema.optional(),
23
- context: zod_1.z.record(zod_1.z.any()).optional(),
24
- }).passthrough();
25
- exports.RuntimeErrorSchema = zod_1.z.object({
26
- error: zod_1.z.string().min(1),
27
- message: zod_1.z.string().min(1),
28
- details: zod_1.z.record(zod_1.z.any()).optional(),
29
- httpStatus: zod_1.z.number().int().min(400).max(599).optional(),
30
- });
31
- function validateNeedsAuthorizationError(error) {
32
- return exports.NeedsAuthorizationErrorSchema.safeParse(error);
33
- }
34
- function isNeedsAuthorizationError(error) {
35
- return error && error.error === 'needs_authorization';
36
- }
37
- function createNeedsAuthorizationError(config) {
38
- return {
39
- error: 'needs_authorization',
40
- ...config,
41
- };
42
- }
43
- exports.ERROR_CODES = Object.freeze({
44
- NEEDS_AUTHORIZATION: 'needs_authorization',
45
- INVALID_TOKEN: 'invalid_token',
46
- TOKEN_EXPIRED: 'token_expired',
47
- INSUFFICIENT_SCOPE: 'insufficient_scope',
48
- INVALID_SIGNATURE: 'invalid_signature',
49
- DELEGATION_REVOKED: 'delegation_revoked',
50
- CREDENTIAL_REVOKED: 'credential_revoked',
51
- });