@kya-os/mcp-i-core 1.7.0 → 1.8.1

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 (121) hide show
  1. package/README.md +1 -1
  2. package/dist/conformance/capability-verifier-adapter.d.ts +66 -0
  3. package/dist/conformance/capability-verifier-adapter.js +61 -0
  4. package/dist/conformance/index.d.ts +10 -0
  5. package/dist/conformance/index.js +19 -0
  6. package/dist/conformance/validate-level2.d.ts +203 -0
  7. package/dist/conformance/validate-level2.js +294 -0
  8. package/dist/conformance/vc-jwt-verifier.d.ts +55 -0
  9. package/dist/conformance/vc-jwt-verifier.js +147 -0
  10. package/dist/delegation/did-web-resolver.d.ts +60 -0
  11. package/dist/delegation/did-web-resolver.js +129 -0
  12. package/dist/delegation/outbound-proof.d.ts +3 -2
  13. package/dist/delegation/outbound-proof.js +3 -2
  14. package/dist/delegation/utils.d.ts +3 -1
  15. package/dist/index.d.ts +9 -63
  16. package/dist/index.js +22 -161
  17. package/dist/utils/base58.d.ts +4 -28
  18. package/dist/utils/base58.js +18 -98
  19. package/dist/utils/base64.d.ts +4 -29
  20. package/dist/utils/base64.js +18 -167
  21. package/dist/utils/did-helpers.d.ts +4 -165
  22. package/dist/utils/did-helpers.js +18 -217
  23. package/package.json +5 -7
  24. package/dist/auth/handshake.d.ts +0 -119
  25. package/dist/auth/handshake.js +0 -250
  26. package/dist/auth/index.d.ts +0 -6
  27. package/dist/auth/index.js +0 -11
  28. package/dist/auth/types.d.ts +0 -46
  29. package/dist/auth/types.js +0 -10
  30. package/dist/cache/oauth-config-cache.d.ts +0 -69
  31. package/dist/cache/oauth-config-cache.js +0 -76
  32. package/dist/cache/tool-protection-cache.d.ts +0 -89
  33. package/dist/cache/tool-protection-cache.js +0 -118
  34. package/dist/compliance/index.d.ts +0 -8
  35. package/dist/compliance/index.js +0 -24
  36. package/dist/compliance/schema-registry.d.ts +0 -50
  37. package/dist/compliance/schema-registry.js +0 -438
  38. package/dist/compliance/schema-verifier.d.ts +0 -110
  39. package/dist/compliance/schema-verifier.js +0 -518
  40. package/dist/config/remote-config.d.ts +0 -173
  41. package/dist/config/remote-config.js +0 -253
  42. package/dist/config.d.ts +0 -182
  43. package/dist/config.js +0 -148
  44. package/dist/identity/idp-token-resolver.d.ts +0 -69
  45. package/dist/identity/idp-token-resolver.js +0 -136
  46. package/dist/identity/idp-token-storage.interface.d.ts +0 -80
  47. package/dist/identity/idp-token-storage.interface.js +0 -14
  48. package/dist/identity/user-did-manager.d.ts +0 -228
  49. package/dist/identity/user-did-manager.js +0 -356
  50. package/dist/logging/index.d.ts +0 -5
  51. package/dist/logging/index.js +0 -10
  52. package/dist/logging/logger.d.ts +0 -33
  53. package/dist/logging/logger.js +0 -104
  54. package/dist/proof/generator.d.ts +0 -109
  55. package/dist/proof/generator.js +0 -236
  56. package/dist/proof/index.d.ts +0 -5
  57. package/dist/proof/index.js +0 -11
  58. package/dist/providers/base.d.ts +0 -95
  59. package/dist/providers/base.js +0 -47
  60. package/dist/providers/memory.d.ts +0 -42
  61. package/dist/providers/memory.js +0 -121
  62. package/dist/runtime/audit-logger.d.ts +0 -37
  63. package/dist/runtime/audit-logger.js +0 -9
  64. package/dist/runtime/base.d.ts +0 -375
  65. package/dist/runtime/base.js +0 -1491
  66. package/dist/runtime/ext-apps-constants.d.ts +0 -14
  67. package/dist/runtime/ext-apps-constants.js +0 -17
  68. package/dist/services/access-control.service.d.ts +0 -138
  69. package/dist/services/access-control.service.js +0 -721
  70. package/dist/services/authorization/authorization-registry.d.ts +0 -29
  71. package/dist/services/authorization/authorization-registry.js +0 -58
  72. package/dist/services/authorization/types.d.ts +0 -53
  73. package/dist/services/authorization/types.js +0 -10
  74. package/dist/services/batch-delegation.service.d.ts +0 -53
  75. package/dist/services/batch-delegation.service.js +0 -95
  76. package/dist/services/crypto.service.d.ts +0 -69
  77. package/dist/services/crypto.service.js +0 -225
  78. package/dist/services/delegation-error-formatter.d.ts +0 -124
  79. package/dist/services/delegation-error-formatter.js +0 -214
  80. package/dist/services/errors.d.ts +0 -49
  81. package/dist/services/errors.js +0 -66
  82. package/dist/services/index.d.ts +0 -9
  83. package/dist/services/index.js +0 -15
  84. package/dist/services/oauth-config.service.d.ts +0 -53
  85. package/dist/services/oauth-config.service.js +0 -141
  86. package/dist/services/oauth-provider-registry.d.ts +0 -88
  87. package/dist/services/oauth-provider-registry.js +0 -128
  88. package/dist/services/oauth-service.d.ts +0 -122
  89. package/dist/services/oauth-service.js +0 -442
  90. package/dist/services/oauth-token-retrieval.service.d.ts +0 -49
  91. package/dist/services/oauth-token-retrieval.service.js +0 -150
  92. package/dist/services/policy.service.d.ts +0 -130
  93. package/dist/services/policy.service.js +0 -399
  94. package/dist/services/proof-verifier.d.ts +0 -98
  95. package/dist/services/proof-verifier.js +0 -319
  96. package/dist/services/provider-resolver.d.ts +0 -89
  97. package/dist/services/provider-resolver.js +0 -196
  98. package/dist/services/provider-validator.d.ts +0 -55
  99. package/dist/services/provider-validator.js +0 -135
  100. package/dist/services/session-registration.service.d.ts +0 -80
  101. package/dist/services/session-registration.service.js +0 -174
  102. package/dist/services/storage.service.d.ts +0 -116
  103. package/dist/services/storage.service.js +0 -411
  104. package/dist/services/tool-context-builder.d.ts +0 -74
  105. package/dist/services/tool-context-builder.js +0 -215
  106. package/dist/services/tool-protection.service.d.ts +0 -193
  107. package/dist/services/tool-protection.service.js +0 -736
  108. package/dist/session/index.d.ts +0 -5
  109. package/dist/session/index.js +0 -11
  110. package/dist/session/manager.d.ts +0 -113
  111. package/dist/session/manager.js +0 -273
  112. package/dist/types/oauth-required-error.d.ts +0 -46
  113. package/dist/types/oauth-required-error.js +0 -42
  114. package/dist/types/tool-protection.d.ts +0 -144
  115. package/dist/types/tool-protection.js +0 -48
  116. package/dist/utils/cors.d.ts +0 -44
  117. package/dist/utils/cors.js +0 -71
  118. package/dist/utils/index.d.ts +0 -8
  119. package/dist/utils/index.js +0 -24
  120. package/dist/utils/storage-keys.d.ts +0 -120
  121. package/dist/utils/storage-keys.js +0 -217
@@ -1,168 +1,7 @@
1
1
  /**
2
- * DID Validation and Helper Utilities
3
- *
4
- * Centralized utilities for DID validation, normalization, and handling.
5
- * Promotes DRY principle and consistency across the codebase.
6
- *
7
- * @package @kya-os/mcp-i-core/utils
2
+ * Compatibility re-export. The implementation moved to @kya-os/mcp-i-runtime
3
+ * (C4 Step 2). Kept here so the pinned `src/delegation/**` (E3.5 #2904) keeps
4
+ * resolving its `../utils/did-helpers` import without being modified.
8
5
  */
9
- /**
10
- * Check if a string is a valid DID format
11
- *
12
- * @param did - String to validate
13
- * @returns true if string starts with "did:"
14
- *
15
- * @example
16
- * ```typescript
17
- * isValidDid("did:key:z6Mk...") // true
18
- * isValidDid("not-a-did") // false
19
- * ```
20
- */
21
- export declare function isValidDid(did: string): boolean;
22
- /**
23
- * Get the DID method from a DID string
24
- *
25
- * @param did - DID string
26
- * @returns DID method (e.g., "key", "web") or null if invalid
27
- *
28
- * @example
29
- * ```typescript
30
- * getDidMethod("did:key:z6Mk...") // "key"
31
- * getDidMethod("did:web:example.com") // "web"
32
- * getDidMethod("invalid") // null
33
- * ```
34
- */
35
- export declare function getDidMethod(did: string): string | null;
36
- /**
37
- * Normalize a DID string (trim whitespace)
38
- *
39
- * @param did - DID string to normalize
40
- * @returns Normalized DID string
41
- *
42
- * @example
43
- * ```typescript
44
- * normalizeDid(" did:key:z6Mk... ") // "did:key:z6Mk..."
45
- * ```
46
- */
47
- export declare function normalizeDid(did: string): string;
48
- /**
49
- * Compare two DIDs for equality (case-sensitive)
50
- *
51
- * @param did1 - First DID
52
- * @param did2 - Second DID
53
- * @returns true if DIDs are equal (after normalization)
54
- *
55
- * @example
56
- * ```typescript
57
- * compareDids("did:key:z6Mk...", "did:key:z6Mk...") // true
58
- * compareDids("did:key:z6Mk...", "did:web:example.com") // false
59
- * ```
60
- */
61
- export declare function compareDids(did1: string, did2: string): boolean;
62
- /**
63
- * Extract server DID from config (supports both old and new field names)
64
- *
65
- * Supports backward compatibility by reading both `serverDid` and deprecated `agentDid`.
66
- * Prefers `serverDid` if both are present.
67
- *
68
- * @param config - Config object with identity field
69
- * @returns Server DID string
70
- * @throws Error if neither serverDid nor agentDid is configured
71
- *
72
- * @example
73
- * ```typescript
74
- * // New config
75
- * getServerDid({ identity: { serverDid: "did:web:server.com" } }) // "did:web:server.com"
76
- *
77
- * // Old config (backward compatibility)
78
- * getServerDid({ identity: { agentDid: "did:web:server.com" } }) // "did:web:server.com"
79
- *
80
- * // Prefers serverDid over agentDid
81
- * getServerDid({ identity: { serverDid: "new", agentDid: "old" } }) // "new"
82
- * ```
83
- */
84
- export declare function getServerDid(config: {
85
- identity: {
86
- serverDid?: string;
87
- agentDid?: string;
88
- };
89
- }): string;
90
- /**
91
- * Extract agent ID from DID
92
- *
93
- * The agent ID is the last component of the DID.
94
- *
95
- * @param did - DID string
96
- * @returns Agent ID (last component of DID)
97
- *
98
- * @example
99
- * ```typescript
100
- * extractAgentId("did:web:knowthat.ai:agents:my-agent") // "my-agent"
101
- * extractAgentId("did:web:localhost:3000:agents:12912feb") // "12912feb"
102
- * extractAgentId("did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK") // "z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK"
103
- * ```
104
- */
105
- export declare function extractAgentId(did: string): string;
106
- /**
107
- * Extract agent slug from DID
108
- *
109
- * Agent slug is the same as agent ID - the last component of the DID.
110
- * For DID format: did:web:knowthat.ai:agents:my-agent
111
- * Returns: my-agent
112
- *
113
- * @param did - DID string
114
- * @returns Agent slug (last component of DID)
115
- *
116
- * @example
117
- * ```typescript
118
- * extractAgentSlug("did:web:knowthat.ai:agents:my-agent") // "my-agent"
119
- * extractAgentSlug("did:web:localhost:3000:agents:12912feb") // "12912feb"
120
- * ```
121
- */
122
- export declare function extractAgentSlug(did: string): string;
123
- /**
124
- * Generate a did:key from Ed25519 public key bytes
125
- *
126
- * Following spec: https://w3c-ccg.github.io/did-method-key/
127
- * Format: did:key:z<multibase-base58btc(<multicodec-ed25519-pub><publicKey>)>
128
- *
129
- * @param publicKeyBytes - Ed25519 public key as Uint8Array (32 bytes)
130
- * @returns did:key string
131
- *
132
- * @example
133
- * ```typescript
134
- * const publicKey = new Uint8Array(32); // 32-byte Ed25519 public key
135
- * const did = generateDidKeyFromBytes(publicKey);
136
- * // did = "did:key:z6Mk..."
137
- * ```
138
- */
139
- export declare function generateDidKeyFromBytes(publicKeyBytes: Uint8Array): string;
140
- /**
141
- * Generate a did:key from base64-encoded Ed25519 public key
142
- *
143
- * Convenience wrapper around generateDidKeyFromBytes for base64-encoded keys.
144
- *
145
- * @param publicKeyBase64 - Ed25519 public key as base64 string
146
- * @returns did:key string
147
- *
148
- * @example
149
- * ```typescript
150
- * const publicKeyBase64 = "...base64 encoded key...";
151
- * const did = generateDidKeyFromBase64(publicKeyBase64);
152
- * // did = "did:key:z6Mk..."
153
- * ```
154
- */
155
- export declare function generateDidKeyFromBase64(publicKeyBase64: string): string;
156
- /**
157
- * Get the spec-compliant fragment identifier for a did:key DID.
158
- *
159
- * Per the W3C CCG did:key spec, the fragment equals the multibase-encoded
160
- * public key value (the DID-specific-id). For example:
161
- * did:key:z6MkABC... → z6MkABC...
162
- *
163
- * @see https://w3c-ccg.github.io/did-key-spec/#document-creation-algorithm
164
- * @param did - A DID string
165
- * @returns The fragment identifier (multibase value for did:key, or 'keys-1' fallback)
166
- */
167
- export declare function didKeyFragment(did: string): string;
6
+ export * from "@kya-os/mcp-i-runtime/utils/did-helpers";
168
7
  //# sourceMappingURL=did-helpers.d.ts.map
@@ -1,222 +1,23 @@
1
1
  "use strict";
2
- /**
3
- * DID Validation and Helper Utilities
4
- *
5
- * Centralized utilities for DID validation, normalization, and handling.
6
- * Promotes DRY principle and consistency across the codebase.
7
- *
8
- * @package @kya-os/mcp-i-core/utils
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.isValidDid = isValidDid;
12
- exports.getDidMethod = getDidMethod;
13
- exports.normalizeDid = normalizeDid;
14
- exports.compareDids = compareDids;
15
- exports.getServerDid = getServerDid;
16
- exports.extractAgentId = extractAgentId;
17
- exports.extractAgentSlug = extractAgentSlug;
18
- exports.generateDidKeyFromBytes = generateDidKeyFromBytes;
19
- exports.generateDidKeyFromBase64 = generateDidKeyFromBase64;
20
- exports.didKeyFragment = didKeyFragment;
21
- const base58_1 = require("./base58");
22
- /**
23
- * Check if a string is a valid DID format
24
- *
25
- * @param did - String to validate
26
- * @returns true if string starts with "did:"
27
- *
28
- * @example
29
- * ```typescript
30
- * isValidDid("did:key:z6Mk...") // true
31
- * isValidDid("not-a-did") // false
32
- * ```
33
- */
34
- function isValidDid(did) {
35
- return typeof did === "string" && did.startsWith("did:");
36
- }
37
- /**
38
- * Get the DID method from a DID string
39
- *
40
- * @param did - DID string
41
- * @returns DID method (e.g., "key", "web") or null if invalid
42
- *
43
- * @example
44
- * ```typescript
45
- * getDidMethod("did:key:z6Mk...") // "key"
46
- * getDidMethod("did:web:example.com") // "web"
47
- * getDidMethod("invalid") // null
48
- * ```
49
- */
50
- function getDidMethod(did) {
51
- if (!isValidDid(did)) {
52
- return null;
53
- }
54
- const match = did.match(/^did:([^:]+):/);
55
- return match ? match[1] : null;
56
- }
57
- /**
58
- * Normalize a DID string (trim whitespace)
59
- *
60
- * @param did - DID string to normalize
61
- * @returns Normalized DID string
62
- *
63
- * @example
64
- * ```typescript
65
- * normalizeDid(" did:key:z6Mk... ") // "did:key:z6Mk..."
66
- * ```
67
- */
68
- function normalizeDid(did) {
69
- return did.trim();
70
- }
71
- /**
72
- * Compare two DIDs for equality (case-sensitive)
73
- *
74
- * @param did1 - First DID
75
- * @param did2 - Second DID
76
- * @returns true if DIDs are equal (after normalization)
77
- *
78
- * @example
79
- * ```typescript
80
- * compareDids("did:key:z6Mk...", "did:key:z6Mk...") // true
81
- * compareDids("did:key:z6Mk...", "did:web:example.com") // false
82
- * ```
83
- */
84
- function compareDids(did1, did2) {
85
- return normalizeDid(did1) === normalizeDid(did2);
86
- }
87
- /**
88
- * Extract server DID from config (supports both old and new field names)
89
- *
90
- * Supports backward compatibility by reading both `serverDid` and deprecated `agentDid`.
91
- * Prefers `serverDid` if both are present.
92
- *
93
- * @param config - Config object with identity field
94
- * @returns Server DID string
95
- * @throws Error if neither serverDid nor agentDid is configured
96
- *
97
- * @example
98
- * ```typescript
99
- * // New config
100
- * getServerDid({ identity: { serverDid: "did:web:server.com" } }) // "did:web:server.com"
101
- *
102
- * // Old config (backward compatibility)
103
- * getServerDid({ identity: { agentDid: "did:web:server.com" } }) // "did:web:server.com"
104
- *
105
- * // Prefers serverDid over agentDid
106
- * getServerDid({ identity: { serverDid: "new", agentDid: "old" } }) // "new"
107
- * ```
108
- */
109
- function getServerDid(config) {
110
- const serverDid = config.identity.serverDid || config.identity.agentDid;
111
- if (!serverDid) {
112
- throw new Error("Server DID not configured");
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
113
7
  }
114
- return serverDid;
115
- }
116
- /**
117
- * Extract agent ID from DID
118
- *
119
- * The agent ID is the last component of the DID.
120
- *
121
- * @param did - DID string
122
- * @returns Agent ID (last component of DID)
123
- *
124
- * @example
125
- * ```typescript
126
- * extractAgentId("did:web:knowthat.ai:agents:my-agent") // "my-agent"
127
- * extractAgentId("did:web:localhost:3000:agents:12912feb") // "12912feb"
128
- * extractAgentId("did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK") // "z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK"
129
- * ```
130
- */
131
- function extractAgentId(did) {
132
- const parts = did.split(':');
133
- return parts[parts.length - 1];
134
- }
135
- /**
136
- * Extract agent slug from DID
137
- *
138
- * Agent slug is the same as agent ID - the last component of the DID.
139
- * For DID format: did:web:knowthat.ai:agents:my-agent
140
- * Returns: my-agent
141
- *
142
- * @param did - DID string
143
- * @returns Agent slug (last component of DID)
144
- *
145
- * @example
146
- * ```typescript
147
- * extractAgentSlug("did:web:knowthat.ai:agents:my-agent") // "my-agent"
148
- * extractAgentSlug("did:web:localhost:3000:agents:12912feb") // "12912feb"
149
- * ```
150
- */
151
- function extractAgentSlug(did) {
152
- return extractAgentId(did);
153
- }
154
- /**
155
- * Ed25519 multicodec prefix for did:key encoding
156
- * As per https://w3c-ccg.github.io/did-method-key/
157
- */
158
- const ED25519_MULTICODEC_PREFIX = new Uint8Array([0xed, 0x01]);
159
- /**
160
- * Generate a did:key from Ed25519 public key bytes
161
- *
162
- * Following spec: https://w3c-ccg.github.io/did-method-key/
163
- * Format: did:key:z<multibase-base58btc(<multicodec-ed25519-pub><publicKey>)>
164
- *
165
- * @param publicKeyBytes - Ed25519 public key as Uint8Array (32 bytes)
166
- * @returns did:key string
167
- *
168
- * @example
169
- * ```typescript
170
- * const publicKey = new Uint8Array(32); // 32-byte Ed25519 public key
171
- * const did = generateDidKeyFromBytes(publicKey);
172
- * // did = "did:key:z6Mk..."
173
- * ```
174
- */
175
- function generateDidKeyFromBytes(publicKeyBytes) {
176
- // Combine multicodec prefix + public key
177
- const multicodecKey = new Uint8Array(ED25519_MULTICODEC_PREFIX.length + publicKeyBytes.length);
178
- multicodecKey.set(ED25519_MULTICODEC_PREFIX);
179
- multicodecKey.set(publicKeyBytes, ED25519_MULTICODEC_PREFIX.length);
180
- // Base58-btc encode and add multibase prefix 'z'
181
- const base58Encoded = (0, base58_1.base58Encode)(multicodecKey);
182
- return `did:key:z${base58Encoded}`;
183
- }
184
- /**
185
- * Generate a did:key from base64-encoded Ed25519 public key
186
- *
187
- * Convenience wrapper around generateDidKeyFromBytes for base64-encoded keys.
188
- *
189
- * @param publicKeyBase64 - Ed25519 public key as base64 string
190
- * @returns did:key string
191
- *
192
- * @example
193
- * ```typescript
194
- * const publicKeyBase64 = "...base64 encoded key...";
195
- * const did = generateDidKeyFromBase64(publicKeyBase64);
196
- * // did = "did:key:z6Mk..."
197
- * ```
198
- */
199
- function generateDidKeyFromBase64(publicKeyBase64) {
200
- // Decode base64 to bytes
201
- const publicKeyBytes = Uint8Array.from(atob(publicKeyBase64), (c) => c.charCodeAt(0));
202
- return generateDidKeyFromBytes(publicKeyBytes);
203
- }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
204
17
  /**
205
- * Get the spec-compliant fragment identifier for a did:key DID.
206
- *
207
- * Per the W3C CCG did:key spec, the fragment equals the multibase-encoded
208
- * public key value (the DID-specific-id). For example:
209
- * did:key:z6MkABC... → z6MkABC...
210
- *
211
- * @see https://w3c-ccg.github.io/did-key-spec/#document-creation-algorithm
212
- * @param did - A DID string
213
- * @returns The fragment identifier (multibase value for did:key, or 'keys-1' fallback)
18
+ * Compatibility re-export. The implementation moved to @kya-os/mcp-i-runtime
19
+ * (C4 Step 2). Kept here so the pinned `src/delegation/**` (E3.5 #2904) keeps
20
+ * resolving its `../utils/did-helpers` import without being modified.
214
21
  */
215
- function didKeyFragment(did) {
216
- if (did.startsWith('did:key:')) {
217
- return did.slice('did:key:'.length);
218
- }
219
- // Fallback for non-did:key methods
220
- return 'keys-1';
221
- }
22
+ __exportStar(require("@kya-os/mcp-i-runtime/utils/did-helpers"), exports);
222
23
  //# sourceMappingURL=did-helpers.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kya-os/mcp-i-core",
3
- "version": "1.7.0",
4
- "description": "Core runtime and types for MCP-I framework",
3
+ "version": "1.8.1",
4
+ "description": "Compatibility shim — re-exports @kya-os/mcp-i-runtime (product layer) plus the pinned W3C-VC delegation modules. Prefer @kya-os/mcp-i-runtime directly.",
5
5
  "license": "MIT",
6
6
  "author": "Dylan Hobbs",
7
7
  "repository": {
@@ -16,10 +16,6 @@
16
16
  "types": "./dist/index.d.ts",
17
17
  "default": "./dist/index.js"
18
18
  },
19
- "./runtime/audit-logger": {
20
- "types": "./dist/runtime/audit-logger.d.ts",
21
- "default": "./dist/runtime/audit-logger.js"
22
- },
23
19
  "./*": {
24
20
  "types": "./dist/*.d.ts",
25
21
  "default": "./dist/*.js"
@@ -35,7 +31,9 @@
35
31
  "prepublishOnly": "npm run build && node ../create-mcpi-app/scripts/validate-no-workspace.js"
36
32
  },
37
33
  "dependencies": {
38
- "@kya-os/contracts": "^1.8.0",
34
+ "@kya-os/contracts": "^1.9.0",
35
+ "@kya-os/mcp": "^1.10.1",
36
+ "@kya-os/mcp-i-runtime": "^1.0.0",
39
37
  "jose": "^5.6.3",
40
38
  "json-canonicalize": "^2.0.0",
41
39
  "zod": "^3.25.67"
@@ -1,119 +0,0 @@
1
- /**
2
- * Authorization Handshake — Platform-agnostic Protocol Reference
3
- *
4
- * Orchestrates the authorization flow for MCP-I bouncer:
5
- * 1. Check agent reputation (optional)
6
- * 2. Verify delegation exists
7
- * 3. Return needs_authorization error if missing
8
- *
9
- * This module uses only the global fetch API — no Node-specific imports.
10
- * It is safe to run on Node.js, Cloudflare Workers, and any fetch-capable runtime.
11
- *
12
- * Flow:
13
- * - If delegation exists + valid → allow (fast path)
14
- * - If delegation missing → return needs_authorization with hints
15
- * - If reputation too low (optional) → require authorization
16
- */
17
- import { NeedsAuthorizationError } from "@kya-os/contracts/runtime";
18
- import { DelegationRecord } from "@kya-os/contracts/delegation";
19
- import { DelegationVerifier, VerifyDelegationResult } from "./types";
20
- export type { DelegationVerifier, VerifyDelegationResult };
21
- /**
22
- * Agent reputation data from KTA
23
- */
24
- export interface AgentReputation {
25
- agentDid: string;
26
- score: number;
27
- totalInteractions: number;
28
- successRate: number;
29
- riskLevel: "low" | "medium" | "high" | "unknown";
30
- updatedAt: number;
31
- }
32
- /**
33
- * Configuration for auth handshake
34
- */
35
- export interface AuthHandshakeConfig {
36
- delegationVerifier: DelegationVerifier;
37
- resumeTokenStore: ResumeTokenStore;
38
- kta?: {
39
- apiUrl: string;
40
- apiKey?: string;
41
- apiFormat?: "kta" | "argus";
42
- };
43
- bouncer: {
44
- authorizationUrl: string;
45
- resumeTokenTtl?: number;
46
- requireAuthForUnknown?: boolean;
47
- minReputationScore?: number;
48
- };
49
- debug?: boolean;
50
- }
51
- /**
52
- * Result of auth handshake verification
53
- */
54
- export interface VerifyOrHintsResult {
55
- authorized: boolean;
56
- delegation?: DelegationRecord;
57
- credential?: {
58
- agent_did: string;
59
- user_did: string;
60
- scopes: string[];
61
- authorization: {
62
- type: "oauth" | "oauth2" | "password" | "credential" | "webauthn" | "siwe" | "none";
63
- provider?: string;
64
- credentialType?: string;
65
- rpId?: string;
66
- userVerification?: "required" | "preferred" | "discouraged";
67
- chainId?: number;
68
- domain?: string;
69
- };
70
- [key: string]: unknown;
71
- };
72
- authError?: NeedsAuthorizationError;
73
- reputation?: AgentReputation;
74
- reason?: string;
75
- }
76
- /**
77
- * Resume token store interface
78
- */
79
- export interface ResumeTokenStore {
80
- create(agentDid: string, scopes: string[], metadata?: Record<string, unknown>): Promise<string>;
81
- get(token: string): Promise<{
82
- agentDid: string;
83
- scopes: string[];
84
- createdAt: number;
85
- expiresAt: number;
86
- metadata?: Record<string, unknown>;
87
- } | null>;
88
- fulfill(token: string): Promise<void>;
89
- }
90
- /**
91
- * Simple in-memory resume token store (for testing/development).
92
- * Not suitable for multi-instance deployments.
93
- */
94
- export declare class MemoryResumeTokenStore implements ResumeTokenStore {
95
- private tokens;
96
- private ttl;
97
- constructor(ttlMs?: number);
98
- create(agentDid: string, scopes: string[], metadata?: Record<string, unknown>): Promise<string>;
99
- get(token: string): Promise<{
100
- agentDid: string;
101
- scopes: string[];
102
- createdAt: number;
103
- expiresAt: number;
104
- metadata?: Record<string, unknown>;
105
- } | null>;
106
- fulfill(token: string): Promise<void>;
107
- clear(): void;
108
- }
109
- /**
110
- * Main auth handshake function.
111
- *
112
- * Verifies agent authorization or returns authorization hints.
113
- */
114
- export declare function verifyOrHints(agentDid: string, scopes: string[], config: AuthHandshakeConfig, _resumeToken?: string): Promise<VerifyOrHintsResult>;
115
- /**
116
- * Helper: Check if scopes are sensitive and require authorization.
117
- */
118
- export declare function hasSensitiveScopes(scopes: string[]): boolean;
119
- //# sourceMappingURL=handshake.d.ts.map