@kya-os/mcp-i 1.12.3 → 1.13.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.
- package/README.md +11 -11
- package/dist/125.js +1 -0
- package/dist/227.js +1 -1
- package/dist/283.js +1 -1
- package/dist/295.js +1 -1
- package/dist/317.js +1 -1
- package/dist/65.js +1 -1
- package/dist/843.js +1 -1
- package/dist/runtime/248.js +1 -0
- package/dist/runtime/adapter-express.js +3 -3
- package/dist/runtime/adapter-nextjs.js +5 -5
- package/dist/runtime/{delegation-verifier-agentshield.d.ts → delegation-verifier-checkpoint.d.ts} +13 -18
- package/dist/runtime/{delegation-verifier-agentshield.js → delegation-verifier-checkpoint.js} +41 -121
- package/dist/runtime/delegation-verifier.d.ts +17 -9
- package/dist/runtime/delegation-verifier.js +7 -6
- package/dist/runtime/former-names.d.ts +20 -0
- package/dist/runtime/former-names.js +17 -0
- package/dist/runtime/http.js +3 -3
- package/dist/runtime/identity.d.ts +26 -0
- package/dist/runtime/identity.js +37 -4
- package/dist/runtime/index.d.ts +4 -3
- package/dist/runtime/index.js +21 -5
- package/dist/runtime/mcpi-runtime-wrapper.js +4 -2
- package/dist/runtime/mcpi-runtime.d.ts +9 -3
- package/dist/runtime/mcpi-runtime.js +7 -6
- package/dist/runtime/proof-batch-queue.d.ts +4 -4
- package/dist/runtime/proof-batch-queue.js +12 -12
- package/dist/runtime/stdio.js +3 -3
- package/dist/runtime/tool-protection.d.ts +11 -5
- package/dist/runtime/tool-protection.js +12 -11
- package/dist/runtime/utils/tools.js +7 -7
- package/package.json +4 -4
- package/dist/958.js +0 -1
- package/dist/runtime/215.js +0 -1
package/dist/runtime/{delegation-verifier-agentshield.d.ts → delegation-verifier-checkpoint.d.ts}
RENAMED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Checkpoint API Delegation Verifier
|
|
3
3
|
*
|
|
4
|
-
* Queries delegations from
|
|
5
|
-
*
|
|
4
|
+
* Queries delegations from Checkpoint managed service API.
|
|
5
|
+
* No verdict is cached: every verification asks Checkpoint, so a revocation
|
|
6
|
+
* refuses the very next call and a delegation granted (or replaced) after a
|
|
7
|
+
* refusal is accepted on the next call. `cacheTtl`, `skipCache` and
|
|
8
|
+
* `maxCacheAge` therefore have no effect on this verifier.
|
|
6
9
|
*
|
|
7
10
|
* Performance:
|
|
8
|
-
* -
|
|
9
|
-
* - Slow path (API call): < 100ms
|
|
10
|
-
* - Cache TTL: 1 minute (configurable)
|
|
11
|
+
* - API call: < 100ms
|
|
11
12
|
*
|
|
12
13
|
* API Endpoints:
|
|
13
14
|
* - POST /api/v1/delegations/verify - Verify delegation by agent DID + scopes
|
|
@@ -18,20 +19,18 @@
|
|
|
18
19
|
* Authentication: Bearer token via X-API-Key header
|
|
19
20
|
*
|
|
20
21
|
* Related: PHASE_1_XMCP_I_SERVER.md Ticket 1.3
|
|
21
|
-
* Related:
|
|
22
|
+
* Related: CHECKPOINT_DASHBOARD_PLAN.md Epic 2 (Public API)
|
|
22
23
|
*/
|
|
23
24
|
import { DelegationRecord } from "@kya-os/contracts/delegation";
|
|
24
25
|
import { DelegationVerifier, DelegationVerifierConfig, VerifyDelegationResult, VerifyDelegationOptions } from "./delegation-verifier";
|
|
25
26
|
/**
|
|
26
|
-
*
|
|
27
|
+
* Checkpoint API Delegation Verifier
|
|
27
28
|
*
|
|
28
|
-
* Managed mode: Queries delegations from
|
|
29
|
+
* Managed mode: Queries delegations from Checkpoint dashboard API
|
|
29
30
|
*/
|
|
30
|
-
export declare class
|
|
31
|
+
export declare class CheckpointAPIDelegationVerifier implements DelegationVerifier {
|
|
31
32
|
private apiUrl;
|
|
32
33
|
private apiKey;
|
|
33
|
-
private cache;
|
|
34
|
-
private cacheTtl;
|
|
35
34
|
private debug;
|
|
36
35
|
private accessControlService;
|
|
37
36
|
constructor(config: DelegationVerifierConfig);
|
|
@@ -46,7 +45,7 @@ export declare class AgentShieldAPIDelegationVerifier implements DelegationVerif
|
|
|
46
45
|
/**
|
|
47
46
|
* Store delegation (admin operation via API)
|
|
48
47
|
*
|
|
49
|
-
* Note: This is typically done via
|
|
48
|
+
* Note: This is typically done via Checkpoint dashboard UI,
|
|
50
49
|
* not by the bouncer directly. Included for completeness.
|
|
51
50
|
*/
|
|
52
51
|
put(delegation: DelegationRecord): Promise<void>;
|
|
@@ -55,11 +54,7 @@ export declare class AgentShieldAPIDelegationVerifier implements DelegationVerif
|
|
|
55
54
|
*/
|
|
56
55
|
revoke(delegationId: string, reason?: string): Promise<void>;
|
|
57
56
|
/**
|
|
58
|
-
* Close connections (cleanup)
|
|
57
|
+
* Close connections (cleanup). The verifier holds no cache or connection.
|
|
59
58
|
*/
|
|
60
59
|
close(): Promise<void>;
|
|
61
|
-
/**
|
|
62
|
-
* Build deterministic scopes key for caching
|
|
63
|
-
*/
|
|
64
|
-
private buildScopesKey;
|
|
65
60
|
}
|
package/dist/runtime/{delegation-verifier-agentshield.js → delegation-verifier-checkpoint.js}
RENAMED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Checkpoint API Delegation Verifier
|
|
4
4
|
*
|
|
5
|
-
* Queries delegations from
|
|
6
|
-
*
|
|
5
|
+
* Queries delegations from Checkpoint managed service API.
|
|
6
|
+
* No verdict is cached: every verification asks Checkpoint, so a revocation
|
|
7
|
+
* refuses the very next call and a delegation granted (or replaced) after a
|
|
8
|
+
* refusal is accepted on the next call. `cacheTtl`, `skipCache` and
|
|
9
|
+
* `maxCacheAge` therefore have no effect on this verifier.
|
|
7
10
|
*
|
|
8
11
|
* Performance:
|
|
9
|
-
* -
|
|
10
|
-
* - Slow path (API call): < 100ms
|
|
11
|
-
* - Cache TTL: 1 minute (configurable)
|
|
12
|
+
* - API call: < 100ms
|
|
12
13
|
*
|
|
13
14
|
* API Endpoints:
|
|
14
15
|
* - POST /api/v1/delegations/verify - Verify delegation by agent DID + scopes
|
|
@@ -19,74 +20,38 @@
|
|
|
19
20
|
* Authentication: Bearer token via X-API-Key header
|
|
20
21
|
*
|
|
21
22
|
* Related: PHASE_1_XMCP_I_SERVER.md Ticket 1.3
|
|
22
|
-
* Related:
|
|
23
|
+
* Related: CHECKPOINT_DASHBOARD_PLAN.md Epic 2 (Public API)
|
|
23
24
|
*/
|
|
24
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.
|
|
26
|
+
exports.CheckpointAPIDelegationVerifier = void 0;
|
|
26
27
|
const delegation_1 = require("@kya-os/contracts/delegation");
|
|
28
|
+
// The former subpath on purpose: it is in every contracts release mcp-i's range
|
|
29
|
+
// allows (^1.12.4), while "@kya-os/contracts/checkpoint-api" is only in releases
|
|
30
|
+
// from this rename on. Its AgentShieldAPIError is CheckpointAPIError there. Move
|
|
31
|
+
// to "@kya-os/contracts/checkpoint-api" once mcp-i requires such a release.
|
|
27
32
|
const agentshield_api_1 = require("@kya-os/contracts/agentshield-api");
|
|
28
33
|
const delegation_verifier_1 = require("./delegation-verifier");
|
|
29
34
|
// C4 drain: stays on @kya-os/mcp-i-core - the test vi.mocks that specifier; source import + mock must drain together in L-Node-tests.
|
|
30
35
|
const mcp_i_core_1 = require("@kya-os/mcp-i-core");
|
|
31
36
|
const node_providers_1 = require("../providers/node-providers");
|
|
37
|
+
// Use standard Checkpoint API response types from contracts
|
|
32
38
|
/**
|
|
33
|
-
*
|
|
34
|
-
*/
|
|
35
|
-
class DelegationCache {
|
|
36
|
-
cache = new Map();
|
|
37
|
-
maxSize;
|
|
38
|
-
constructor(maxSize = 1000) {
|
|
39
|
-
this.maxSize = maxSize;
|
|
40
|
-
}
|
|
41
|
-
get(key) {
|
|
42
|
-
const entry = this.cache.get(key);
|
|
43
|
-
if (!entry)
|
|
44
|
-
return null;
|
|
45
|
-
if (Date.now() > entry.expiresAt) {
|
|
46
|
-
this.cache.delete(key);
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
return entry.data;
|
|
50
|
-
}
|
|
51
|
-
set(key, data, ttlMs) {
|
|
52
|
-
if (this.cache.size >= this.maxSize) {
|
|
53
|
-
const firstKey = this.cache.keys().next().value;
|
|
54
|
-
if (firstKey)
|
|
55
|
-
this.cache.delete(firstKey);
|
|
56
|
-
}
|
|
57
|
-
this.cache.set(key, {
|
|
58
|
-
data,
|
|
59
|
-
expiresAt: Date.now() + ttlMs,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
delete(key) {
|
|
63
|
-
this.cache.delete(key);
|
|
64
|
-
}
|
|
65
|
-
clear() {
|
|
66
|
-
this.cache.clear();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
// Use standard AgentShield API response types from contracts
|
|
70
|
-
/**
|
|
71
|
-
* AgentShield API Delegation Verifier
|
|
39
|
+
* Checkpoint API Delegation Verifier
|
|
72
40
|
*
|
|
73
|
-
* Managed mode: Queries delegations from
|
|
41
|
+
* Managed mode: Queries delegations from Checkpoint dashboard API
|
|
74
42
|
*/
|
|
75
|
-
class
|
|
43
|
+
class CheckpointAPIDelegationVerifier {
|
|
76
44
|
apiUrl;
|
|
77
45
|
apiKey;
|
|
78
|
-
cache;
|
|
79
|
-
cacheTtl;
|
|
80
46
|
debug;
|
|
81
47
|
accessControlService;
|
|
82
48
|
constructor(config) {
|
|
83
|
-
|
|
84
|
-
|
|
49
|
+
const checkpoint = config.checkpoint ?? config.agentshield;
|
|
50
|
+
if (!checkpoint?.apiUrl || !checkpoint?.apiKey) {
|
|
51
|
+
throw new Error("CheckpointAPIDelegationVerifier requires checkpoint.apiUrl and checkpoint.apiKey in config");
|
|
85
52
|
}
|
|
86
|
-
this.apiUrl =
|
|
87
|
-
this.apiKey =
|
|
88
|
-
this.cache = new DelegationCache();
|
|
89
|
-
this.cacheTtl = config.cacheTtl || 60_000; // Default 1 minute
|
|
53
|
+
this.apiUrl = checkpoint.apiUrl.replace(/\/$/, ""); // Remove trailing slash
|
|
54
|
+
this.apiKey = checkpoint.apiKey;
|
|
90
55
|
this.debug = config.debug || false;
|
|
91
56
|
// Create AccessControlApiService instance
|
|
92
57
|
const fetchProvider = new node_providers_1.NodeFetchProvider();
|
|
@@ -95,7 +60,7 @@ class AgentShieldAPIDelegationVerifier {
|
|
|
95
60
|
apiKey: this.apiKey,
|
|
96
61
|
fetchProvider,
|
|
97
62
|
logger: this.debug
|
|
98
|
-
? (msg, data) => console.error(`[
|
|
63
|
+
? (msg, data) => console.error(`[Checkpoint] ${msg}`, data)
|
|
99
64
|
: undefined,
|
|
100
65
|
});
|
|
101
66
|
}
|
|
@@ -116,26 +81,10 @@ class AgentShieldAPIDelegationVerifier {
|
|
|
116
81
|
};
|
|
117
82
|
}
|
|
118
83
|
const startTime = Date.now();
|
|
119
|
-
//
|
|
120
|
-
|
|
121
|
-
const cacheKey = `verify:${agentDid}:${scopesKey}`;
|
|
122
|
-
// Fast path: Check cache
|
|
123
|
-
if (!options?.skipCache) {
|
|
124
|
-
const cached = this.cache.get(cacheKey);
|
|
125
|
-
if (cached) {
|
|
126
|
-
if (this.debug) {
|
|
127
|
-
console.error(`[AgentShield] Cache HIT for ${agentDid} (${Date.now() - startTime}ms)`);
|
|
128
|
-
}
|
|
129
|
-
// Return cached result with cached flag set to true
|
|
130
|
-
return {
|
|
131
|
-
...cached,
|
|
132
|
-
cached: true,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
// Slow path: API call
|
|
84
|
+
// Every verification asks Checkpoint: a cached acceptance would outlive a
|
|
85
|
+
// revocation, and a cached refusal would hide a delegation granted since.
|
|
137
86
|
if (this.debug) {
|
|
138
|
-
console.error(`[
|
|
87
|
+
console.error(`[Checkpoint] Verifying ${agentDid}, calling API...`);
|
|
139
88
|
}
|
|
140
89
|
try {
|
|
141
90
|
// Validate request input using contracts schema
|
|
@@ -148,8 +97,6 @@ class AgentShieldAPIDelegationVerifier {
|
|
|
148
97
|
// Extract data from wrapped response
|
|
149
98
|
const data = response.data;
|
|
150
99
|
// Build result from validated response
|
|
151
|
-
// Note: Don't include 'cached' property in the result that gets cached
|
|
152
|
-
// We'll add it when returning (false for API calls, true for cache hits)
|
|
153
100
|
const result = {
|
|
154
101
|
valid: data.valid,
|
|
155
102
|
delegation: data.delegation,
|
|
@@ -157,17 +104,13 @@ class AgentShieldAPIDelegationVerifier {
|
|
|
157
104
|
credential: data.credential,
|
|
158
105
|
reason: data.error ? data.error.message : data.reason,
|
|
159
106
|
};
|
|
160
|
-
// Cache result (without cached property)
|
|
161
|
-
const ttl = data.valid ? this.cacheTtl : this.cacheTtl / 2;
|
|
162
|
-
this.cache.set(cacheKey, result, ttl);
|
|
163
107
|
if (this.debug) {
|
|
164
|
-
console.error(`[
|
|
108
|
+
console.error(`[Checkpoint] Delegation ${data.valid ? "verified" : "rejected"} (${Date.now() - startTime}ms)`);
|
|
165
109
|
}
|
|
166
|
-
// Return result with cached: false for API calls
|
|
167
110
|
return { ...result, cached: false };
|
|
168
111
|
}
|
|
169
112
|
catch (error) {
|
|
170
|
-
console.error("[
|
|
113
|
+
console.error("[Checkpoint] API call failed:", error);
|
|
171
114
|
// Return negative result on error (don't cache failures)
|
|
172
115
|
// Use standard error format
|
|
173
116
|
if (error instanceof agentshield_api_1.AgentShieldAPIError) {
|
|
@@ -204,25 +147,25 @@ class AgentShieldAPIDelegationVerifier {
|
|
|
204
147
|
if (!response.ok) {
|
|
205
148
|
if (response.status === 404)
|
|
206
149
|
return null;
|
|
207
|
-
throw new Error(`
|
|
150
|
+
throw new Error(`Checkpoint API error: ${response.status}`);
|
|
208
151
|
}
|
|
209
152
|
const data = await response.json();
|
|
210
153
|
const parsed = delegation_1.DelegationRecordSchema.safeParse(data);
|
|
211
154
|
if (!parsed.success) {
|
|
212
|
-
console.error("[
|
|
155
|
+
console.error("[Checkpoint] Invalid delegation in API response:", parsed.error);
|
|
213
156
|
return null;
|
|
214
157
|
}
|
|
215
158
|
return parsed.data;
|
|
216
159
|
}
|
|
217
160
|
catch (error) {
|
|
218
|
-
console.error("[
|
|
161
|
+
console.error("[Checkpoint] Failed to get delegation:", error);
|
|
219
162
|
return null;
|
|
220
163
|
}
|
|
221
164
|
}
|
|
222
165
|
/**
|
|
223
166
|
* Store delegation (admin operation via API)
|
|
224
167
|
*
|
|
225
|
-
* Note: This is typically done via
|
|
168
|
+
* Note: This is typically done via Checkpoint dashboard UI,
|
|
226
169
|
* not by the bouncer directly. Included for completeness.
|
|
227
170
|
*/
|
|
228
171
|
async put(delegation) {
|
|
@@ -241,19 +184,14 @@ class AgentShieldAPIDelegationVerifier {
|
|
|
241
184
|
body: JSON.stringify(delegation),
|
|
242
185
|
});
|
|
243
186
|
if (!response.ok) {
|
|
244
|
-
throw new Error(`
|
|
187
|
+
throw new Error(`Checkpoint API error: ${response.status} ${response.statusText}`);
|
|
245
188
|
}
|
|
246
|
-
// Invalidate cache
|
|
247
|
-
const delegationScopes = (0, delegation_verifier_1.extractScopes)(delegation);
|
|
248
|
-
const scopesKey = this.buildScopesKey(delegationScopes);
|
|
249
|
-
this.cache.delete(`delegation:${delegation.id}`);
|
|
250
|
-
this.cache.delete(`verify:${delegation.subjectDid}:${scopesKey}`);
|
|
251
189
|
if (this.debug) {
|
|
252
|
-
console.error(`[
|
|
190
|
+
console.error(`[Checkpoint] Stored delegation ${delegation.id}`);
|
|
253
191
|
}
|
|
254
192
|
}
|
|
255
193
|
catch (error) {
|
|
256
|
-
console.error("[
|
|
194
|
+
console.error("[Checkpoint] Failed to store delegation:", error);
|
|
257
195
|
throw error;
|
|
258
196
|
}
|
|
259
197
|
}
|
|
@@ -271,38 +209,20 @@ class AgentShieldAPIDelegationVerifier {
|
|
|
271
209
|
body: JSON.stringify({ reason }),
|
|
272
210
|
});
|
|
273
211
|
if (!response.ok) {
|
|
274
|
-
throw new Error(`
|
|
212
|
+
throw new Error(`Checkpoint API error: ${response.status} ${response.statusText}`);
|
|
275
213
|
}
|
|
276
|
-
// Invalidate cache
|
|
277
|
-
this.cache.delete(`delegation:${delegationId}`);
|
|
278
214
|
if (this.debug) {
|
|
279
|
-
console.error(`[
|
|
215
|
+
console.error(`[Checkpoint] Revoked delegation ${delegationId}`);
|
|
280
216
|
}
|
|
281
217
|
}
|
|
282
218
|
catch (error) {
|
|
283
|
-
console.error("[
|
|
219
|
+
console.error("[Checkpoint] Failed to revoke delegation:", error);
|
|
284
220
|
throw error;
|
|
285
221
|
}
|
|
286
222
|
}
|
|
287
223
|
/**
|
|
288
|
-
* Close connections (cleanup)
|
|
224
|
+
* Close connections (cleanup). The verifier holds no cache or connection.
|
|
289
225
|
*/
|
|
290
|
-
async close() {
|
|
291
|
-
this.cache.clear();
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Build deterministic scopes key for caching
|
|
295
|
-
*/
|
|
296
|
-
buildScopesKey(scopes) {
|
|
297
|
-
const sorted = [...scopes].sort();
|
|
298
|
-
const str = sorted.join(",");
|
|
299
|
-
let hash = 0;
|
|
300
|
-
for (let i = 0; i < str.length; i++) {
|
|
301
|
-
const char = str.charCodeAt(i);
|
|
302
|
-
hash = (hash << 5) - hash + char;
|
|
303
|
-
hash = hash & hash;
|
|
304
|
-
}
|
|
305
|
-
return Math.abs(hash).toString(36);
|
|
306
|
-
}
|
|
226
|
+
async close() { }
|
|
307
227
|
}
|
|
308
|
-
exports.
|
|
228
|
+
exports.CheckpointAPIDelegationVerifier = CheckpointAPIDelegationVerifier;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Architecture:
|
|
8
8
|
* - DelegationVerifier: Abstract interface (Dependency Inversion Principle)
|
|
9
|
-
* - Concrete adapters: CloudflareKVVerifier,
|
|
9
|
+
* - Concrete adapters: CloudflareKVVerifier, CheckpointAPIVerifier
|
|
10
10
|
* - Factory: createDelegationVerifier() selects adapter based on config
|
|
11
11
|
*
|
|
12
12
|
* Related: PHASE_1_XMCP_I_SERVER.md Epic 1 (Delegation Storage Layer)
|
|
@@ -21,7 +21,7 @@ export interface VerifyDelegationResult {
|
|
|
21
21
|
valid: boolean;
|
|
22
22
|
/** The delegation record (if found) */
|
|
23
23
|
delegation?: DelegationRecord;
|
|
24
|
-
/** Credential from
|
|
24
|
+
/** Credential from Checkpoint API (includes authorization method) */
|
|
25
25
|
credential?: {
|
|
26
26
|
agent_did: string;
|
|
27
27
|
user_did: string;
|
|
@@ -56,7 +56,7 @@ export interface VerifyDelegationOptions {
|
|
|
56
56
|
*
|
|
57
57
|
* Implementations:
|
|
58
58
|
* - CloudflareKVDelegationVerifier (local storage)
|
|
59
|
-
* -
|
|
59
|
+
* - CheckpointAPIDelegationVerifier (remote managed service)
|
|
60
60
|
*
|
|
61
61
|
* Follows Interface Segregation Principle (SOLID) - minimal required methods
|
|
62
62
|
*/
|
|
@@ -155,8 +155,11 @@ export declare const VerifyDelegationInputSchema: z.ZodObject<{
|
|
|
155
155
|
* Configuration for delegation verifiers
|
|
156
156
|
*/
|
|
157
157
|
export interface DelegationVerifierConfig {
|
|
158
|
-
/**
|
|
159
|
-
|
|
158
|
+
/**
|
|
159
|
+
* Verifier type. `'agentshield-api'` is the former name of `'checkpoint-api'`
|
|
160
|
+
* and selects the same verifier.
|
|
161
|
+
*/
|
|
162
|
+
type: 'cloudflare-kv' | 'checkpoint-api' | 'agentshield-api' | 'memory';
|
|
160
163
|
/** Cloudflare KV namespace (for cloudflare-kv type) */
|
|
161
164
|
kvNamespace?: {
|
|
162
165
|
get(key: string): Promise<string | null>;
|
|
@@ -170,7 +173,12 @@ export interface DelegationVerifierConfig {
|
|
|
170
173
|
}>;
|
|
171
174
|
}>;
|
|
172
175
|
};
|
|
173
|
-
/**
|
|
176
|
+
/** Checkpoint API configuration (for checkpoint-api type) */
|
|
177
|
+
checkpoint?: {
|
|
178
|
+
apiUrl: string;
|
|
179
|
+
apiKey: string;
|
|
180
|
+
};
|
|
181
|
+
/** @deprecated Use `checkpoint`; read only when `checkpoint` is absent. */
|
|
174
182
|
agentshield?: {
|
|
175
183
|
apiUrl: string;
|
|
176
184
|
apiKey: string;
|
|
@@ -186,10 +194,10 @@ export interface DelegationVerifierConfig {
|
|
|
186
194
|
* Note: We import all adapters statically for better compatibility.
|
|
187
195
|
* Tree-shaking will remove unused adapters in production builds.
|
|
188
196
|
*
|
|
189
|
-
* Note:
|
|
197
|
+
* Note: Checkpoint API responses use standard wrapper format
|
|
190
198
|
* { success: boolean, data: {...}, metadata?: {...} } as defined in
|
|
191
|
-
* @kya-os/contracts/
|
|
192
|
-
*
|
|
199
|
+
* @kya-os/contracts/checkpoint-api. This is handled in the
|
|
200
|
+
* CheckpointAPIDelegationVerifier implementation.
|
|
193
201
|
*
|
|
194
202
|
* @param config - Verifier configuration
|
|
195
203
|
* @returns DelegationVerifier instance
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Architecture:
|
|
9
9
|
* - DelegationVerifier: Abstract interface (Dependency Inversion Principle)
|
|
10
|
-
* - Concrete adapters: CloudflareKVVerifier,
|
|
10
|
+
* - Concrete adapters: CloudflareKVVerifier, CheckpointAPIVerifier
|
|
11
11
|
* - Factory: createDelegationVerifier() selects adapter based on config
|
|
12
12
|
*
|
|
13
13
|
* Related: PHASE_1_XMCP_I_SERVER.md Epic 1 (Delegation Storage Layer)
|
|
@@ -95,10 +95,10 @@ exports.VerifyDelegationInputSchema = zod_1.z.object({
|
|
|
95
95
|
* Note: We import all adapters statically for better compatibility.
|
|
96
96
|
* Tree-shaking will remove unused adapters in production builds.
|
|
97
97
|
*
|
|
98
|
-
* Note:
|
|
98
|
+
* Note: Checkpoint API responses use standard wrapper format
|
|
99
99
|
* { success: boolean, data: {...}, metadata?: {...} } as defined in
|
|
100
|
-
* @kya-os/contracts/
|
|
101
|
-
*
|
|
100
|
+
* @kya-os/contracts/checkpoint-api. This is handled in the
|
|
101
|
+
* CheckpointAPIDelegationVerifier implementation.
|
|
102
102
|
*
|
|
103
103
|
* @param config - Verifier configuration
|
|
104
104
|
* @returns DelegationVerifier instance
|
|
@@ -109,9 +109,10 @@ function createDelegationVerifier(config) {
|
|
|
109
109
|
const CloudflareKVDelegationVerifier = require('./delegation-verifier-kv').CloudflareKVDelegationVerifier;
|
|
110
110
|
return new CloudflareKVDelegationVerifier(config);
|
|
111
111
|
}
|
|
112
|
+
case 'checkpoint-api':
|
|
112
113
|
case 'agentshield-api': {
|
|
113
|
-
const
|
|
114
|
-
return new
|
|
114
|
+
const CheckpointAPIDelegationVerifier = require('./delegation-verifier-checkpoint').CheckpointAPIDelegationVerifier;
|
|
115
|
+
return new CheckpointAPIDelegationVerifier(config);
|
|
115
116
|
}
|
|
116
117
|
case 'memory': {
|
|
117
118
|
const MemoryDelegationVerifier = require('./delegation-verifier-memory').MemoryDelegationVerifier;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The AgentShield-named exports from before these classes took the Checkpoint
|
|
3
|
+
* name. Each is the Checkpoint class itself, so existing imports, `instanceof`
|
|
4
|
+
* checks and type annotations keep working unchanged.
|
|
5
|
+
*/
|
|
6
|
+
import { CheckpointAPIDelegationVerifier } from "./delegation-verifier-checkpoint";
|
|
7
|
+
import { CheckpointProofDestination } from "./proof-batch-queue";
|
|
8
|
+
import { CheckpointToolProtectionSource } from "./tool-protection";
|
|
9
|
+
/** @deprecated Use `CheckpointAPIDelegationVerifier`. */
|
|
10
|
+
export declare const AgentShieldAPIDelegationVerifier: typeof CheckpointAPIDelegationVerifier;
|
|
11
|
+
/** @deprecated Use `CheckpointAPIDelegationVerifier`. */
|
|
12
|
+
export type AgentShieldAPIDelegationVerifier = CheckpointAPIDelegationVerifier;
|
|
13
|
+
/** @deprecated Use `CheckpointProofDestination`. */
|
|
14
|
+
export declare const AgentShieldProofDestination: typeof CheckpointProofDestination;
|
|
15
|
+
/** @deprecated Use `CheckpointProofDestination`. */
|
|
16
|
+
export type AgentShieldProofDestination = CheckpointProofDestination;
|
|
17
|
+
/** @deprecated Use `CheckpointToolProtectionSource`. */
|
|
18
|
+
export declare const AgentShieldToolProtectionSource: typeof CheckpointToolProtectionSource;
|
|
19
|
+
/** @deprecated Use `CheckpointToolProtectionSource`. */
|
|
20
|
+
export type AgentShieldToolProtectionSource = CheckpointToolProtectionSource;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The AgentShield-named exports from before these classes took the Checkpoint
|
|
4
|
+
* name. Each is the Checkpoint class itself, so existing imports, `instanceof`
|
|
5
|
+
* checks and type annotations keep working unchanged.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.AgentShieldToolProtectionSource = exports.AgentShieldProofDestination = exports.AgentShieldAPIDelegationVerifier = void 0;
|
|
9
|
+
const delegation_verifier_checkpoint_1 = require("./delegation-verifier-checkpoint");
|
|
10
|
+
const proof_batch_queue_1 = require("./proof-batch-queue");
|
|
11
|
+
const tool_protection_1 = require("./tool-protection");
|
|
12
|
+
/** @deprecated Use `CheckpointAPIDelegationVerifier`. */
|
|
13
|
+
exports.AgentShieldAPIDelegationVerifier = delegation_verifier_checkpoint_1.CheckpointAPIDelegationVerifier;
|
|
14
|
+
/** @deprecated Use `CheckpointProofDestination`. */
|
|
15
|
+
exports.AgentShieldProofDestination = proof_batch_queue_1.CheckpointProofDestination;
|
|
16
|
+
/** @deprecated Use `CheckpointToolProtectionSource`. */
|
|
17
|
+
exports.AgentShieldToolProtectionSource = tool_protection_1.CheckpointToolProtectionSource;
|