@kya-os/contracts 1.3.2 → 1.3.3

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/README.md +1 -1
  2. package/dist/agentshield-api/endpoints.d.ts +21 -0
  3. package/dist/agentshield-api/endpoints.js +20 -0
  4. package/dist/agentshield-api/index.d.ts +5 -0
  5. package/dist/agentshield-api/index.js +27 -0
  6. package/dist/agentshield-api/schemas.d.ts +9846 -0
  7. package/dist/agentshield-api/schemas.js +92 -0
  8. package/dist/agentshield-api/types.d.ts +92 -0
  9. package/dist/agentshield-api/types.js +12 -0
  10. package/dist/cli.d.ts +3 -6
  11. package/dist/cli.js +3 -10
  12. package/dist/config/base.d.ts +19 -0
  13. package/dist/config/base.js +2 -0
  14. package/dist/config/delegation.d.ts +46 -0
  15. package/dist/config/delegation.js +2 -0
  16. package/dist/config/identity.d.ts +22 -0
  17. package/dist/config/identity.js +2 -0
  18. package/dist/config/index.d.ts +17 -0
  19. package/dist/config/index.js +2 -0
  20. package/dist/config/proofing.d.ts +26 -0
  21. package/dist/config/proofing.js +2 -0
  22. package/dist/config/tool-protection.d.ts +36 -0
  23. package/dist/config/tool-protection.js +2 -0
  24. package/dist/delegation/constraints.d.ts +0 -266
  25. package/dist/delegation/constraints.js +3 -110
  26. package/dist/delegation/index.d.ts +0 -6
  27. package/dist/delegation/index.js +0 -6
  28. package/dist/delegation/schemas.d.ts +174 -514
  29. package/dist/delegation/schemas.js +3 -247
  30. package/dist/did/index.d.ts +0 -6
  31. package/dist/did/index.js +0 -6
  32. package/dist/did/resolve-contract.d.ts +0 -167
  33. package/dist/did/resolve-contract.js +0 -20
  34. package/dist/did/schemas.d.ts +0 -80
  35. package/dist/did/schemas.js +4 -97
  36. package/dist/did/types.d.ts +0 -126
  37. package/dist/did/types.js +0 -34
  38. package/dist/env/constants.d.ts +0 -45
  39. package/dist/env/constants.js +0 -45
  40. package/dist/env/index.d.ts +0 -4
  41. package/dist/env/index.js +0 -4
  42. package/dist/handshake.d.ts +0 -21
  43. package/dist/handshake.js +3 -11
  44. package/dist/index.d.ts +0 -15
  45. package/dist/index.js +0 -25
  46. package/dist/proof/index.d.ts +0 -7
  47. package/dist/proof/index.js +0 -7
  48. package/dist/proof/proof-record.d.ts +62 -172
  49. package/dist/proof/proof-record.js +0 -74
  50. package/dist/proof/signing-spec.d.ts +12 -86
  51. package/dist/proof/signing-spec.js +0 -71
  52. package/dist/proof.d.ts +16 -38
  53. package/dist/proof.js +3 -26
  54. package/dist/registry.d.ts +10 -27
  55. package/dist/registry.js +9 -30
  56. package/dist/runtime/errors.d.ts +0 -169
  57. package/dist/runtime/errors.js +0 -69
  58. package/dist/runtime/headers.d.ts +0 -50
  59. package/dist/runtime/headers.js +0 -30
  60. package/dist/runtime/index.d.ts +0 -4
  61. package/dist/runtime/index.js +0 -4
  62. package/dist/test.d.ts +0 -37
  63. package/dist/test.js +0 -37
  64. package/dist/tlkrc/index.d.ts +0 -4
  65. package/dist/tlkrc/index.js +0 -4
  66. package/dist/tlkrc/rotation.d.ts +12 -90
  67. package/dist/tlkrc/rotation.js +0 -72
  68. package/dist/tool-protection/index.d.ts +129 -0
  69. package/dist/tool-protection/index.js +80 -0
  70. package/dist/utils/validation.d.ts +0 -17
  71. package/dist/utils/validation.js +0 -14
  72. package/dist/vc/index.d.ts +0 -6
  73. package/dist/vc/index.js +0 -6
  74. package/dist/vc/schemas.d.ts +0 -596
  75. package/dist/vc/schemas.js +2 -111
  76. package/dist/vc/statuslist.d.ts +0 -202
  77. package/dist/vc/statuslist.js +1 -73
  78. package/dist/verifier.d.ts +9 -13
  79. package/dist/verifier.js +0 -8
  80. package/dist/well-known/index.d.ts +248 -0
  81. package/dist/well-known/index.js +104 -0
  82. package/package.json +27 -5
@@ -1,7 +1,4 @@
1
1
  import { z } from "zod";
2
- /**
3
- * Registry integration schemas (Know-That-AI and MCP Registry)
4
- */
5
2
  export declare const RegistrationInputSchema: z.ZodObject<{
6
3
  agentDID: z.ZodString;
7
4
  agentURL: z.ZodString;
@@ -57,12 +54,12 @@ export declare const ClaimTokenSchema: z.ZodObject<{
57
54
  expiresAt: z.ZodNumber;
58
55
  ttlHours: z.ZodDefault<z.ZodNumber>;
59
56
  }, "strip", z.ZodTypeAny, {
60
- token: string;
61
57
  expiresAt: number;
58
+ token: string;
62
59
  ttlHours: number;
63
60
  }, {
64
- token: string;
65
61
  expiresAt: number;
62
+ token: string;
66
63
  ttlHours?: number | undefined;
67
64
  }>;
68
65
  export declare const MirrorStatusSchema: z.ZodObject<{
@@ -125,9 +122,6 @@ export declare const AgentStatusSchema: z.ZodObject<{
125
122
  };
126
123
  lastHandshake?: number | undefined;
127
124
  }>;
128
- /**
129
- * Delegation schemas for verifiable credentials
130
- */
131
125
  export declare const DelegationSchema: z.ZodObject<{
132
126
  issuer: z.ZodString;
133
127
  subject: z.ZodString;
@@ -161,22 +155,15 @@ export declare const DelegationRequestSchema: z.ZodObject<{
161
155
  }, "strip", z.ZodTypeAny, {
162
156
  subject: string;
163
157
  scopes: string[];
164
- duration?: number | undefined;
165
158
  audience?: string | undefined;
159
+ duration?: number | undefined;
166
160
  }, {
167
161
  subject: string;
168
162
  scopes: string[];
169
- duration?: number | undefined;
170
163
  audience?: string | undefined;
164
+ duration?: number | undefined;
171
165
  }>;
172
- /**
173
- * Storage mode configuration for verifiable credentials and delegations
174
- */
175
166
  export declare const StorageModeSchema: z.ZodEnum<["ktaEncrypted", "hybridReceiptsOnly", "selfHostedAuthoritative"]>;
176
- /**
177
- * Receipt object returned by KTA for verifiable operations
178
- * Schema ID: https://schemas.kya-os.ai/mcpi/receipt/v1.0.0.json
179
- */
180
167
  export declare const ReceiptSchema: z.ZodObject<{
181
168
  $schema: z.ZodOptional<z.ZodLiteral<"https://schemas.kya-os.ai/mcpi/receipt/v1.0.0.json">>;
182
169
  ref: z.ZodString;
@@ -187,19 +174,19 @@ export declare const ReceiptSchema: z.ZodObject<{
187
174
  logRoot: z.ZodString;
188
175
  inclusionProof: z.ZodArray<z.ZodString, "many">;
189
176
  }, "strip", z.ZodTypeAny, {
177
+ ts: string | number;
190
178
  ref: string;
191
179
  contentHash: string;
192
180
  action: "issue" | "revoke";
193
- ts: string | number;
194
181
  logIndex: number;
195
182
  logRoot: string;
196
183
  inclusionProof: string[];
197
184
  $schema?: "https://schemas.kya-os.ai/mcpi/receipt/v1.0.0.json" | undefined;
198
185
  }, {
186
+ ts: string | number;
199
187
  ref: string;
200
188
  contentHash: string;
201
189
  action: "issue" | "revoke";
202
- ts: string | number;
203
190
  logIndex: number;
204
191
  logRoot: string;
205
192
  inclusionProof: string[];
@@ -241,19 +228,19 @@ export declare const DelegationResponseSchema: z.ZodObject<{
241
228
  logRoot: z.ZodString;
242
229
  inclusionProof: z.ZodArray<z.ZodString, "many">;
243
230
  }, "strip", z.ZodTypeAny, {
231
+ ts: string | number;
244
232
  ref: string;
245
233
  contentHash: string;
246
234
  action: "issue" | "revoke";
247
- ts: string | number;
248
235
  logIndex: number;
249
236
  logRoot: string;
250
237
  inclusionProof: string[];
251
238
  $schema?: "https://schemas.kya-os.ai/mcpi/receipt/v1.0.0.json" | undefined;
252
239
  }, {
240
+ ts: string | number;
253
241
  ref: string;
254
242
  contentHash: string;
255
243
  action: "issue" | "revoke";
256
- ts: string | number;
257
244
  logIndex: number;
258
245
  logRoot: string;
259
246
  inclusionProof: string[];
@@ -271,10 +258,10 @@ export declare const DelegationResponseSchema: z.ZodObject<{
271
258
  aud?: string | undefined;
272
259
  };
273
260
  receipt: {
261
+ ts: string | number;
274
262
  ref: string;
275
263
  contentHash: string;
276
264
  action: "issue" | "revoke";
277
- ts: string | number;
278
265
  logIndex: number;
279
266
  logRoot: string;
280
267
  inclusionProof: string[];
@@ -292,10 +279,10 @@ export declare const DelegationResponseSchema: z.ZodObject<{
292
279
  aud?: string | undefined;
293
280
  };
294
281
  receipt: {
282
+ ts: string | number;
295
283
  ref: string;
296
284
  contentHash: string;
297
285
  action: "issue" | "revoke";
298
- ts: string | number;
299
286
  logIndex: number;
300
287
  logRoot: string;
301
288
  inclusionProof: string[];
@@ -303,9 +290,6 @@ export declare const DelegationResponseSchema: z.ZodObject<{
303
290
  };
304
291
  encryptedPayload?: string | undefined;
305
292
  }>;
306
- /**
307
- * Storage configuration for different deployment modes
308
- */
309
293
  export declare const StorageConfigSchema: z.ZodObject<{
310
294
  mode: z.ZodEnum<["ktaEncrypted", "hybridReceiptsOnly", "selfHostedAuthoritative"]>;
311
295
  encryptionEnabled: z.ZodDefault<z.ZodBoolean>;
@@ -340,4 +324,3 @@ export declare const DEFAULT_STORAGE_MODE: StorageMode;
340
324
  export declare const STORAGE_MODE_ENV_VAR = "MCPI_STORAGE_MODE";
341
325
  export declare const RECEIPT_SCHEMA_ID = "https://schemas.kya-os.ai/mcpi/receipt/v1.0.0.json";
342
326
  export declare const CONTENT_HASH_REGEX: RegExp;
343
- //# sourceMappingURL=registry.d.ts.map
package/dist/registry.js CHANGED
@@ -2,9 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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
4
  const zod_1 = require("zod");
5
- /**
6
- * Registry integration schemas (Know-That-AI and MCP Registry)
7
- */
8
5
  exports.RegistrationInputSchema = zod_1.z.object({
9
6
  agentDID: zod_1.z.string().min(1),
10
7
  agentURL: zod_1.z.string().url(),
@@ -45,36 +42,26 @@ exports.AgentStatusSchema = zod_1.z.object({
45
42
  mirrorStatus: exports.MirrorStatusSchema,
46
43
  lastHandshake: zod_1.z.number().int().positive().optional(),
47
44
  });
48
- /**
49
- * Delegation schemas for verifiable credentials
50
- */
51
45
  exports.DelegationSchema = zod_1.z.object({
52
- issuer: zod_1.z.string().min(1), // DID of the issuer
53
- subject: zod_1.z.string().min(1), // DID of the subject
46
+ issuer: zod_1.z.string().min(1),
47
+ subject: zod_1.z.string().min(1),
54
48
  scopes: zod_1.z.array(zod_1.z.string()),
55
- nbf: zod_1.z.number().int().positive(), // Not before (unix timestamp)
56
- exp: zod_1.z.number().int().positive(), // Expires (unix timestamp)
57
- aud: zod_1.z.string().optional(), // Audience (optional)
58
- delegationRef: zod_1.z.string().optional(), // Reference to parent delegation
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(),
59
53
  });
60
54
  exports.DelegationRequestSchema = zod_1.z.object({
61
55
  subject: zod_1.z.string().min(1),
62
56
  scopes: zod_1.z.array(zod_1.z.string()),
63
- duration: zod_1.z.number().int().positive().optional(), // Duration in seconds
57
+ duration: zod_1.z.number().int().positive().optional(),
64
58
  audience: zod_1.z.string().optional(),
65
59
  });
66
- /**
67
- * Storage mode configuration for verifiable credentials and delegations
68
- */
69
60
  exports.StorageModeSchema = zod_1.z.enum([
70
61
  "ktaEncrypted",
71
62
  "hybridReceiptsOnly",
72
63
  "selfHostedAuthoritative",
73
64
  ]);
74
- /**
75
- * Receipt object returned by KTA for verifiable operations
76
- * Schema ID: https://schemas.kya-os.ai/mcpi/receipt/v1.0.0.json
77
- */
78
65
  exports.ReceiptSchema = zod_1.z.object({
79
66
  $schema: zod_1.z
80
67
  .literal("https://schemas.kya-os.ai/mcpi/receipt/v1.0.0.json")
@@ -82,7 +69,6 @@ exports.ReceiptSchema = zod_1.z.object({
82
69
  ref: zod_1.z.string().min(1),
83
70
  contentHash: zod_1.z.string().regex(/^sha256:[a-f0-9]{64}$/),
84
71
  action: zod_1.z.enum(["issue", "revoke"]),
85
- // Back-compat: accept ISO string (preferred) or legacy epoch number
86
72
  ts: zod_1.z.union([zod_1.z.string().datetime(), zod_1.z.number().int().positive()]),
87
73
  logIndex: zod_1.z.number().int().nonnegative(),
88
74
  logRoot: zod_1.z.string().min(1),
@@ -91,29 +77,22 @@ exports.ReceiptSchema = zod_1.z.object({
91
77
  exports.DelegationResponseSchema = zod_1.z.object({
92
78
  delegation: exports.DelegationSchema,
93
79
  receipt: exports.ReceiptSchema,
94
- encryptedPayload: zod_1.z.string().optional(), // For ktaEncrypted mode
80
+ encryptedPayload: zod_1.z.string().optional(),
95
81
  });
96
- /**
97
- * Storage configuration for different deployment modes
98
- */
99
82
  exports.StorageConfigSchema = zod_1.z.object({
100
83
  mode: exports.StorageModeSchema,
101
84
  encryptionEnabled: zod_1.z.boolean().default(false),
102
85
  receiptVerificationEnabled: zod_1.z.boolean().default(true),
103
86
  ktaBaseURL: zod_1.z.string().url().default("https://knowthat.ai"),
104
87
  });
105
- // Constants
106
88
  exports.MCP_I_CAPABILITIES = [
107
89
  "handshake",
108
90
  "signing",
109
91
  "verification",
110
92
  ];
111
93
  exports.CLAIM_TOKEN_TTL_HOURS = 24;
112
- exports.KTA_BASE_URL = "https://knowthat.ai"; // Placeholder for docs/tests
113
- // Storage mode constants
94
+ exports.KTA_BASE_URL = "https://knowthat.ai";
114
95
  exports.DEFAULT_STORAGE_MODE = "ktaEncrypted";
115
96
  exports.STORAGE_MODE_ENV_VAR = "MCPI_STORAGE_MODE";
116
- // Receipt schema constants
117
97
  exports.RECEIPT_SCHEMA_ID = "https://schemas.kya-os.ai/mcpi/receipt/v1.0.0.json";
118
98
  exports.CONTENT_HASH_REGEX = /^sha256:[a-f0-9]{64}$/;
119
- //# sourceMappingURL=registry.js.map
@@ -1,202 +1,101 @@
1
- /**
2
- * Runtime Error Contracts
3
- *
4
- * Error types and schemas for runtime errors, especially authorization errors
5
- *
6
- * Related Spec: MCP-I §6
7
- * Python Reference: Core-Documentation.md
8
- */
9
1
  import { z } from 'zod';
10
- /**
11
- * Display hint types for authorization UI
12
- */
13
2
  export declare const DisplayHintSchema: z.ZodEnum<["link", "qr", "code"]>;
14
3
  export type DisplayHint = z.infer<typeof DisplayHintSchema>;
15
- /**
16
- * Display options for authorization flow
17
- */
18
4
  export declare const AuthorizationDisplaySchema: z.ZodObject<{
19
- /** Optional title for the authorization screen */
20
5
  title: z.ZodOptional<z.ZodString>;
21
- /** Hints for how to display authorization (link, QR code, or code) */
22
6
  hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
23
- /** Optional short authorization code */
24
7
  authorizationCode: z.ZodOptional<z.ZodString>;
25
- /** Optional QR code URL */
26
8
  qrUrl: z.ZodOptional<z.ZodString>;
27
9
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
28
- /** Optional title for the authorization screen */
29
10
  title: z.ZodOptional<z.ZodString>;
30
- /** Hints for how to display authorization (link, QR code, or code) */
31
11
  hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
32
- /** Optional short authorization code */
33
12
  authorizationCode: z.ZodOptional<z.ZodString>;
34
- /** Optional QR code URL */
35
13
  qrUrl: z.ZodOptional<z.ZodString>;
36
14
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
37
- /** Optional title for the authorization screen */
38
15
  title: z.ZodOptional<z.ZodString>;
39
- /** Hints for how to display authorization (link, QR code, or code) */
40
16
  hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
41
- /** Optional short authorization code */
42
17
  authorizationCode: z.ZodOptional<z.ZodString>;
43
- /** Optional QR code URL */
44
18
  qrUrl: z.ZodOptional<z.ZodString>;
45
19
  }, z.ZodTypeAny, "passthrough">>;
46
20
  export type AuthorizationDisplay = z.infer<typeof AuthorizationDisplaySchema>;
47
- /**
48
- * NeedsAuthorizationError Schema
49
- *
50
- * Error returned when a request requires authorization.
51
- * Includes a resumeToken and authorizationUrl for the authorization flow.
52
- */
53
21
  export declare const NeedsAuthorizationErrorSchema: z.ZodObject<{
54
- /** Error code */
55
22
  error: z.ZodLiteral<"needs_authorization">;
56
- /** Human-readable error message */
57
23
  message: z.ZodString;
58
- /** URL for the user to authorize (includes resume token) */
59
24
  authorizationUrl: z.ZodString;
60
- /** Short-lived resume token for continuing after authorization */
61
25
  resumeToken: z.ZodString;
62
- /** Expiration timestamp for the resume token (milliseconds since epoch) */
63
26
  expiresAt: z.ZodNumber;
64
- /** Required scopes for authorization */
65
27
  scopes: z.ZodArray<z.ZodString, "many">;
66
- /** Optional display configuration for authorization UI */
67
28
  display: z.ZodOptional<z.ZodObject<{
68
- /** Optional title for the authorization screen */
69
29
  title: z.ZodOptional<z.ZodString>;
70
- /** Hints for how to display authorization (link, QR code, or code) */
71
30
  hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
72
- /** Optional short authorization code */
73
31
  authorizationCode: z.ZodOptional<z.ZodString>;
74
- /** Optional QR code URL */
75
32
  qrUrl: z.ZodOptional<z.ZodString>;
76
33
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
77
- /** Optional title for the authorization screen */
78
34
  title: z.ZodOptional<z.ZodString>;
79
- /** Hints for how to display authorization (link, QR code, or code) */
80
35
  hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
81
- /** Optional short authorization code */
82
36
  authorizationCode: z.ZodOptional<z.ZodString>;
83
- /** Optional QR code URL */
84
37
  qrUrl: z.ZodOptional<z.ZodString>;
85
38
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
86
- /** Optional title for the authorization screen */
87
39
  title: z.ZodOptional<z.ZodString>;
88
- /** Hints for how to display authorization (link, QR code, or code) */
89
40
  hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
90
- /** Optional short authorization code */
91
41
  authorizationCode: z.ZodOptional<z.ZodString>;
92
- /** Optional QR code URL */
93
42
  qrUrl: z.ZodOptional<z.ZodString>;
94
43
  }, z.ZodTypeAny, "passthrough">>>;
95
- /** Optional additional context */
96
44
  context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
97
45
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
98
- /** Error code */
99
46
  error: z.ZodLiteral<"needs_authorization">;
100
- /** Human-readable error message */
101
47
  message: z.ZodString;
102
- /** URL for the user to authorize (includes resume token) */
103
48
  authorizationUrl: z.ZodString;
104
- /** Short-lived resume token for continuing after authorization */
105
49
  resumeToken: z.ZodString;
106
- /** Expiration timestamp for the resume token (milliseconds since epoch) */
107
50
  expiresAt: z.ZodNumber;
108
- /** Required scopes for authorization */
109
51
  scopes: z.ZodArray<z.ZodString, "many">;
110
- /** Optional display configuration for authorization UI */
111
52
  display: z.ZodOptional<z.ZodObject<{
112
- /** Optional title for the authorization screen */
113
53
  title: z.ZodOptional<z.ZodString>;
114
- /** Hints for how to display authorization (link, QR code, or code) */
115
54
  hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
116
- /** Optional short authorization code */
117
55
  authorizationCode: z.ZodOptional<z.ZodString>;
118
- /** Optional QR code URL */
119
56
  qrUrl: z.ZodOptional<z.ZodString>;
120
57
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
121
- /** Optional title for the authorization screen */
122
58
  title: z.ZodOptional<z.ZodString>;
123
- /** Hints for how to display authorization (link, QR code, or code) */
124
59
  hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
125
- /** Optional short authorization code */
126
60
  authorizationCode: z.ZodOptional<z.ZodString>;
127
- /** Optional QR code URL */
128
61
  qrUrl: z.ZodOptional<z.ZodString>;
129
62
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
130
- /** Optional title for the authorization screen */
131
63
  title: z.ZodOptional<z.ZodString>;
132
- /** Hints for how to display authorization (link, QR code, or code) */
133
64
  hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
134
- /** Optional short authorization code */
135
65
  authorizationCode: z.ZodOptional<z.ZodString>;
136
- /** Optional QR code URL */
137
66
  qrUrl: z.ZodOptional<z.ZodString>;
138
67
  }, z.ZodTypeAny, "passthrough">>>;
139
- /** Optional additional context */
140
68
  context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
141
69
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
142
- /** Error code */
143
70
  error: z.ZodLiteral<"needs_authorization">;
144
- /** Human-readable error message */
145
71
  message: z.ZodString;
146
- /** URL for the user to authorize (includes resume token) */
147
72
  authorizationUrl: z.ZodString;
148
- /** Short-lived resume token for continuing after authorization */
149
73
  resumeToken: z.ZodString;
150
- /** Expiration timestamp for the resume token (milliseconds since epoch) */
151
74
  expiresAt: z.ZodNumber;
152
- /** Required scopes for authorization */
153
75
  scopes: z.ZodArray<z.ZodString, "many">;
154
- /** Optional display configuration for authorization UI */
155
76
  display: z.ZodOptional<z.ZodObject<{
156
- /** Optional title for the authorization screen */
157
77
  title: z.ZodOptional<z.ZodString>;
158
- /** Hints for how to display authorization (link, QR code, or code) */
159
78
  hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
160
- /** Optional short authorization code */
161
79
  authorizationCode: z.ZodOptional<z.ZodString>;
162
- /** Optional QR code URL */
163
80
  qrUrl: z.ZodOptional<z.ZodString>;
164
81
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
165
- /** Optional title for the authorization screen */
166
82
  title: z.ZodOptional<z.ZodString>;
167
- /** Hints for how to display authorization (link, QR code, or code) */
168
83
  hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
169
- /** Optional short authorization code */
170
84
  authorizationCode: z.ZodOptional<z.ZodString>;
171
- /** Optional QR code URL */
172
85
  qrUrl: z.ZodOptional<z.ZodString>;
173
86
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
174
- /** Optional title for the authorization screen */
175
87
  title: z.ZodOptional<z.ZodString>;
176
- /** Hints for how to display authorization (link, QR code, or code) */
177
88
  hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
178
- /** Optional short authorization code */
179
89
  authorizationCode: z.ZodOptional<z.ZodString>;
180
- /** Optional QR code URL */
181
90
  qrUrl: z.ZodOptional<z.ZodString>;
182
91
  }, z.ZodTypeAny, "passthrough">>>;
183
- /** Optional additional context */
184
92
  context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
185
93
  }, z.ZodTypeAny, "passthrough">>;
186
94
  export type NeedsAuthorizationError = z.infer<typeof NeedsAuthorizationErrorSchema>;
187
- /**
188
- * Generic Error Schema
189
- *
190
- * Standard error format for all runtime errors
191
- */
192
95
  export declare const RuntimeErrorSchema: z.ZodObject<{
193
- /** Error code */
194
96
  error: z.ZodString;
195
- /** Human-readable error message */
196
97
  message: z.ZodString;
197
- /** Optional error details */
198
98
  details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
199
- /** HTTP status code (if applicable) */
200
99
  httpStatus: z.ZodOptional<z.ZodNumber>;
201
100
  }, "strip", z.ZodTypeAny, {
202
101
  message: string;
@@ -210,117 +109,56 @@ export declare const RuntimeErrorSchema: z.ZodObject<{
210
109
  httpStatus?: number | undefined;
211
110
  }>;
212
111
  export type RuntimeError = z.infer<typeof RuntimeErrorSchema>;
213
- /**
214
- * Validation Helpers
215
- */
216
- /**
217
- * Validate a needs authorization error
218
- *
219
- * @param error - The error to validate
220
- * @returns Validation result
221
- */
222
112
  export declare function validateNeedsAuthorizationError(error: unknown): z.SafeParseReturnType<z.objectInputType<{
223
- /** Error code */
224
113
  error: z.ZodLiteral<"needs_authorization">;
225
- /** Human-readable error message */
226
114
  message: z.ZodString;
227
- /** URL for the user to authorize (includes resume token) */
228
115
  authorizationUrl: z.ZodString;
229
- /** Short-lived resume token for continuing after authorization */
230
116
  resumeToken: z.ZodString;
231
- /** Expiration timestamp for the resume token (milliseconds since epoch) */
232
117
  expiresAt: z.ZodNumber;
233
- /** Required scopes for authorization */
234
118
  scopes: z.ZodArray<z.ZodString, "many">;
235
- /** Optional display configuration for authorization UI */
236
119
  display: z.ZodOptional<z.ZodObject<{
237
- /** Optional title for the authorization screen */
238
120
  title: z.ZodOptional<z.ZodString>;
239
- /** Hints for how to display authorization (link, QR code, or code) */
240
121
  hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
241
- /** Optional short authorization code */
242
122
  authorizationCode: z.ZodOptional<z.ZodString>;
243
- /** Optional QR code URL */
244
123
  qrUrl: z.ZodOptional<z.ZodString>;
245
124
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
246
- /** Optional title for the authorization screen */
247
125
  title: z.ZodOptional<z.ZodString>;
248
- /** Hints for how to display authorization (link, QR code, or code) */
249
126
  hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
250
- /** Optional short authorization code */
251
127
  authorizationCode: z.ZodOptional<z.ZodString>;
252
- /** Optional QR code URL */
253
128
  qrUrl: z.ZodOptional<z.ZodString>;
254
129
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
255
- /** Optional title for the authorization screen */
256
130
  title: z.ZodOptional<z.ZodString>;
257
- /** Hints for how to display authorization (link, QR code, or code) */
258
131
  hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
259
- /** Optional short authorization code */
260
132
  authorizationCode: z.ZodOptional<z.ZodString>;
261
- /** Optional QR code URL */
262
133
  qrUrl: z.ZodOptional<z.ZodString>;
263
134
  }, z.ZodTypeAny, "passthrough">>>;
264
- /** Optional additional context */
265
135
  context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
266
136
  }, z.ZodTypeAny, "passthrough">, z.objectOutputType<{
267
- /** Error code */
268
137
  error: z.ZodLiteral<"needs_authorization">;
269
- /** Human-readable error message */
270
138
  message: z.ZodString;
271
- /** URL for the user to authorize (includes resume token) */
272
139
  authorizationUrl: z.ZodString;
273
- /** Short-lived resume token for continuing after authorization */
274
140
  resumeToken: z.ZodString;
275
- /** Expiration timestamp for the resume token (milliseconds since epoch) */
276
141
  expiresAt: z.ZodNumber;
277
- /** Required scopes for authorization */
278
142
  scopes: z.ZodArray<z.ZodString, "many">;
279
- /** Optional display configuration for authorization UI */
280
143
  display: z.ZodOptional<z.ZodObject<{
281
- /** Optional title for the authorization screen */
282
144
  title: z.ZodOptional<z.ZodString>;
283
- /** Hints for how to display authorization (link, QR code, or code) */
284
145
  hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
285
- /** Optional short authorization code */
286
146
  authorizationCode: z.ZodOptional<z.ZodString>;
287
- /** Optional QR code URL */
288
147
  qrUrl: z.ZodOptional<z.ZodString>;
289
148
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
290
- /** Optional title for the authorization screen */
291
149
  title: z.ZodOptional<z.ZodString>;
292
- /** Hints for how to display authorization (link, QR code, or code) */
293
150
  hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
294
- /** Optional short authorization code */
295
151
  authorizationCode: z.ZodOptional<z.ZodString>;
296
- /** Optional QR code URL */
297
152
  qrUrl: z.ZodOptional<z.ZodString>;
298
153
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
299
- /** Optional title for the authorization screen */
300
154
  title: z.ZodOptional<z.ZodString>;
301
- /** Hints for how to display authorization (link, QR code, or code) */
302
155
  hint: z.ZodOptional<z.ZodArray<z.ZodEnum<["link", "qr", "code"]>, "many">>;
303
- /** Optional short authorization code */
304
156
  authorizationCode: z.ZodOptional<z.ZodString>;
305
- /** Optional QR code URL */
306
157
  qrUrl: z.ZodOptional<z.ZodString>;
307
158
  }, z.ZodTypeAny, "passthrough">>>;
308
- /** Optional additional context */
309
159
  context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
310
160
  }, z.ZodTypeAny, "passthrough">>;
311
- /**
312
- * Check if error is a needs authorization error
313
- *
314
- * @param error - The error to check
315
- * @returns true if it's a needs authorization error
316
- */
317
161
  export declare function isNeedsAuthorizationError(error: any): error is NeedsAuthorizationError;
318
- /**
319
- * Create a needs authorization error
320
- *
321
- * @param config - Configuration for the error
322
- * @returns NeedsAuthorizationError instance
323
- */
324
162
  export declare function createNeedsAuthorizationError(config: {
325
163
  message: string;
326
164
  authorizationUrl: string;
@@ -329,12 +167,6 @@ export declare function createNeedsAuthorizationError(config: {
329
167
  scopes: string[];
330
168
  display?: AuthorizationDisplay;
331
169
  }): NeedsAuthorizationError;
332
- /**
333
- * Constants
334
- */
335
- /**
336
- * Error codes
337
- */
338
170
  export declare const ERROR_CODES: Readonly<{
339
171
  readonly NEEDS_AUTHORIZATION: "needs_authorization";
340
172
  readonly INVALID_TOKEN: "invalid_token";
@@ -345,4 +177,3 @@ export declare const ERROR_CODES: Readonly<{
345
177
  readonly CREDENTIAL_REVOKED: "credential_revoked";
346
178
  }>;
347
179
  export type ErrorCode = typeof ERROR_CODES[keyof typeof ERROR_CODES];
348
- //# sourceMappingURL=errors.d.ts.map