@kya-os/mcp-i-core 1.1.4 → 1.1.8
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.
|
@@ -22,7 +22,7 @@ export declare class ToolProtectionService {
|
|
|
22
22
|
* Get tool protection configuration for the agent
|
|
23
23
|
*
|
|
24
24
|
* Flow:
|
|
25
|
-
* 1. Check cache
|
|
25
|
+
* 1. Check cache (project-scoped if projectId available)
|
|
26
26
|
* 2. If cache miss, fetch from API
|
|
27
27
|
* 3. If API fails, use fallback config
|
|
28
28
|
* 4. Cache successful API responses
|
|
@@ -46,9 +46,12 @@ export declare class ToolProtectionService {
|
|
|
46
46
|
*/
|
|
47
47
|
private fetchFromApi;
|
|
48
48
|
/**
|
|
49
|
-
* Clear the cache for a
|
|
49
|
+
* Clear the cache for a project or agent (useful for testing or manual refresh)
|
|
50
50
|
*
|
|
51
|
-
*
|
|
51
|
+
* If projectId is configured, clears project-scoped cache.
|
|
52
|
+
* Otherwise, clears agent-scoped cache.
|
|
53
|
+
*
|
|
54
|
+
* @param agentDid DID of the agent (used for fallback if projectId not available)
|
|
52
55
|
*/
|
|
53
56
|
clearCache(agentDid: string): Promise<void>;
|
|
54
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-protection.service.d.ts","sourceRoot":"","sources":["../../src/services/tool-protection.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,2BAA2B,EAE5B,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-protection.service.d.ts","sourceRoot":"","sources":["../../src/services/tool-protection.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,2BAA2B,EAE5B,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AA+C7E;;GAEG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,MAAM,CAA8B;IAC5C,OAAO,CAAC,KAAK,CAAsB;gBAGjC,MAAM,EAAE,2BAA2B,EACnC,KAAK,EAAE,mBAAmB;IAM5B;;;;;;;;;;OAUG;IACG,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAmJ9E;;;;;;OAMG;IACG,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAsB7F;;;;;OAKG;YACW,YAAY;IAgF1B;;;;;;;OAOG;IACG,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAgBlD"}
|
|
@@ -26,7 +26,7 @@ class ToolProtectionService {
|
|
|
26
26
|
* Get tool protection configuration for the agent
|
|
27
27
|
*
|
|
28
28
|
* Flow:
|
|
29
|
-
* 1. Check cache
|
|
29
|
+
* 1. Check cache (project-scoped if projectId available)
|
|
30
30
|
* 2. If cache miss, fetch from API
|
|
31
31
|
* 3. If API fails, use fallback config
|
|
32
32
|
* 4. Cache successful API responses
|
|
@@ -34,33 +34,57 @@ class ToolProtectionService {
|
|
|
34
34
|
* @param agentDid DID of the agent to fetch config for
|
|
35
35
|
*/
|
|
36
36
|
async getToolProtectionConfig(agentDid) {
|
|
37
|
-
// Use
|
|
37
|
+
// Use project-scoped cache key if projectId is available (preferred)
|
|
38
|
+
// Falls back to agent-scoped key for backward compatibility
|
|
38
39
|
// The cache implementation (KVToolProtectionCache) will add any necessary prefix
|
|
39
|
-
const cacheKey =
|
|
40
|
+
const cacheKey = this.config.projectId
|
|
41
|
+
? `config:tool-protections:${this.config.projectId}`
|
|
42
|
+
: `agent:${agentDid}`;
|
|
40
43
|
// 1. Check cache
|
|
41
44
|
const cached = await this.cache.get(cacheKey);
|
|
42
45
|
if (cached) {
|
|
43
46
|
if (this.config.debug) {
|
|
44
|
-
console.log('[ToolProtectionService] Cache hit', {
|
|
47
|
+
console.log('[ToolProtectionService] Cache hit', {
|
|
48
|
+
cacheKey,
|
|
49
|
+
agentDid: agentDid.slice(0, 20) + '...',
|
|
50
|
+
projectId: this.config.projectId || 'none',
|
|
51
|
+
toolCount: Object.keys(cached.toolProtections).length,
|
|
52
|
+
});
|
|
45
53
|
}
|
|
46
54
|
return cached;
|
|
47
55
|
}
|
|
48
56
|
if (this.config.debug) {
|
|
49
57
|
console.log('[ToolProtectionService] Cache miss, fetching from API', {
|
|
58
|
+
cacheKey,
|
|
50
59
|
agentDid: agentDid.slice(0, 20) + '...',
|
|
60
|
+
projectId: this.config.projectId || 'none',
|
|
51
61
|
});
|
|
52
62
|
}
|
|
53
63
|
// 2. Fetch from API
|
|
54
64
|
try {
|
|
55
65
|
const response = await this.fetchFromApi(agentDid);
|
|
56
66
|
// Transform API response format to internal format
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
67
|
+
// Supports multiple response formats:
|
|
68
|
+
// 1. New endpoint: { data: { toolProtections: { greet: { requiresDelegation: true, ... } } } }
|
|
69
|
+
// 2. Old endpoint (array): { data: { tools: [{ name: "greet", requiresDelegation: true, ... }] } }
|
|
70
|
+
// 3. Old endpoint (object): { data: { tools: { greet: { requiresDelegation: true, ... } } } }
|
|
60
71
|
const toolProtections = {};
|
|
61
|
-
|
|
62
|
-
|
|
72
|
+
// Check for new endpoint format first (toolProtections)
|
|
73
|
+
if (response.data.toolProtections) {
|
|
74
|
+
// New endpoint format: object with tool names as keys
|
|
75
|
+
for (const [toolName, toolConfig] of Object.entries(response.data.toolProtections)) {
|
|
76
|
+
const requiresDelegation = toolConfig.requires_delegation ?? toolConfig.requiresDelegation ?? false;
|
|
77
|
+
const requiredScopes = toolConfig.required_scopes ?? toolConfig.requiredScopes ?? toolConfig.scopes ?? [];
|
|
78
|
+
toolProtections[toolName] = {
|
|
79
|
+
requiresDelegation,
|
|
80
|
+
requiredScopes,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else if (response.data.tools) {
|
|
85
|
+
// Old endpoint format: array or object
|
|
63
86
|
if (Array.isArray(response.data.tools)) {
|
|
87
|
+
// Array format: [{ name: "greet", requiresDelegation: true, ... }]
|
|
64
88
|
for (const tool of response.data.tools) {
|
|
65
89
|
const toolName = tool.name;
|
|
66
90
|
if (!toolName) {
|
|
@@ -78,7 +102,7 @@ class ToolProtectionService {
|
|
|
78
102
|
}
|
|
79
103
|
}
|
|
80
104
|
else {
|
|
81
|
-
//
|
|
105
|
+
// Object format: { greet: { requiresDelegation: true, ... } }
|
|
82
106
|
for (const [toolName, toolConfig] of Object.entries(response.data.tools)) {
|
|
83
107
|
const requiresDelegation = toolConfig.requires_delegation ?? toolConfig.requiresDelegation ?? false;
|
|
84
108
|
const requiredScopes = toolConfig.required_scopes ?? toolConfig.scopes ?? [];
|
|
@@ -172,26 +196,62 @@ class ToolProtectionService {
|
|
|
172
196
|
* @param agentDid DID of the agent to fetch config for
|
|
173
197
|
*/
|
|
174
198
|
async fetchFromApi(agentDid) {
|
|
175
|
-
// Prefer
|
|
176
|
-
//
|
|
199
|
+
// Prefer new project-scoped endpoint: /api/v1/bouncer/projects/{projectId}/tool-protections
|
|
200
|
+
// Falls back to old endpoint: /api/v1/bouncer/config?agent_did={did} for backward compatibility
|
|
177
201
|
let url;
|
|
202
|
+
let useNewEndpoint = false;
|
|
178
203
|
if (this.config.projectId) {
|
|
179
|
-
|
|
204
|
+
// ✅ NEW ENDPOINT: Project-scoped, returns toolProtections object
|
|
205
|
+
url = `${this.config.apiUrl}/api/v1/bouncer/projects/${encodeURIComponent(this.config.projectId)}/tool-protections`;
|
|
206
|
+
useNewEndpoint = true;
|
|
180
207
|
}
|
|
181
208
|
else {
|
|
209
|
+
// ⚠️ OLD ENDPOINT: Agent-scoped, returns tools array (backward compatibility)
|
|
182
210
|
url = `${this.config.apiUrl}/api/v1/bouncer/config?agent_did=${encodeURIComponent(agentDid)}`;
|
|
183
211
|
}
|
|
212
|
+
// Debug: Log API key status (masked for security)
|
|
213
|
+
const apiKeyMasked = this.config.apiKey
|
|
214
|
+
? `${this.config.apiKey.substring(0, 8)}...${this.config.apiKey.substring(this.config.apiKey.length - 4)}`
|
|
215
|
+
: '(empty)';
|
|
216
|
+
const apiKeyLength = this.config.apiKey?.length || 0;
|
|
184
217
|
if (this.config.debug) {
|
|
185
218
|
console.log('[ToolProtectionService] Fetching from API:', url, {
|
|
186
|
-
method:
|
|
219
|
+
method: useNewEndpoint ? 'projects/{projectId}/tool-protections (new)' : 'config?agent_did (old)',
|
|
220
|
+
projectId: this.config.projectId || 'none',
|
|
221
|
+
apiKeyPresent: !!this.config.apiKey,
|
|
222
|
+
apiKeyLength,
|
|
223
|
+
apiKeyMasked,
|
|
187
224
|
});
|
|
188
225
|
}
|
|
226
|
+
// Validate API key is present
|
|
227
|
+
if (!this.config.apiKey || this.config.apiKey.trim() === '') {
|
|
228
|
+
const error = 'API key is missing or empty';
|
|
229
|
+
if (this.config.debug) {
|
|
230
|
+
console.error('[ToolProtectionService]', error, {
|
|
231
|
+
apiKeyPresent: !!this.config.apiKey,
|
|
232
|
+
apiKeyLength,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
throw new Error(`ToolProtectionService: ${error}. Check AGENTSHIELD_API_KEY in .dev.vars or wrangler.toml [vars]`);
|
|
236
|
+
}
|
|
237
|
+
// Build headers - new endpoint uses X-API-Key, old endpoint uses Authorization Bearer
|
|
238
|
+
const headers = {
|
|
239
|
+
'Content-Type': 'application/json',
|
|
240
|
+
};
|
|
241
|
+
if (useNewEndpoint) {
|
|
242
|
+
// ✅ New endpoint headers
|
|
243
|
+
headers['X-API-Key'] = this.config.apiKey;
|
|
244
|
+
if (this.config.projectId) {
|
|
245
|
+
headers['X-Project-Id'] = this.config.projectId;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
// ⚠️ Old endpoint headers (backward compatibility)
|
|
250
|
+
headers['Authorization'] = `Bearer ${this.config.apiKey}`;
|
|
251
|
+
}
|
|
189
252
|
const response = await fetch(url, {
|
|
190
253
|
method: 'GET',
|
|
191
|
-
headers
|
|
192
|
-
'Content-Type': 'application/json',
|
|
193
|
-
'Authorization': `Bearer ${this.config.apiKey}`,
|
|
194
|
-
},
|
|
254
|
+
headers,
|
|
195
255
|
});
|
|
196
256
|
if (!response.ok) {
|
|
197
257
|
const errorText = await response.text().catch(() => 'Unknown error');
|
|
@@ -204,13 +264,25 @@ class ToolProtectionService {
|
|
|
204
264
|
return data;
|
|
205
265
|
}
|
|
206
266
|
/**
|
|
207
|
-
* Clear the cache for a
|
|
267
|
+
* Clear the cache for a project or agent (useful for testing or manual refresh)
|
|
268
|
+
*
|
|
269
|
+
* If projectId is configured, clears project-scoped cache.
|
|
270
|
+
* Otherwise, clears agent-scoped cache.
|
|
208
271
|
*
|
|
209
|
-
* @param agentDid DID of the agent
|
|
272
|
+
* @param agentDid DID of the agent (used for fallback if projectId not available)
|
|
210
273
|
*/
|
|
211
274
|
async clearCache(agentDid) {
|
|
212
|
-
// Use
|
|
213
|
-
const cacheKey =
|
|
275
|
+
// Use same cache key strategy as getToolProtectionConfig
|
|
276
|
+
const cacheKey = this.config.projectId
|
|
277
|
+
? `config:tool-protections:${this.config.projectId}`
|
|
278
|
+
: `agent:${agentDid}`;
|
|
279
|
+
if (this.config.debug) {
|
|
280
|
+
console.log('[ToolProtectionService] Clearing cache', {
|
|
281
|
+
cacheKey,
|
|
282
|
+
projectId: this.config.projectId || 'none',
|
|
283
|
+
agentDid: agentDid.slice(0, 20) + '...',
|
|
284
|
+
});
|
|
285
|
+
}
|
|
214
286
|
await this.cache.delete(cacheKey);
|
|
215
287
|
}
|
|
216
288
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-protection.service.js","sourceRoot":"","sources":["../../src/services/tool-protection.service.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;
|
|
1
|
+
{"version":3,"file":"tool-protection.service.js","sourceRoot":"","sources":["../../src/services/tool-protection.service.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAuDH;;GAEG;AACH,MAAa,qBAAqB;IACxB,MAAM,CAA8B;IACpC,KAAK,CAAsB;IAEnC,YACE,MAAmC,EACnC,KAA0B;QAE1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,uBAAuB,CAAC,QAAgB;QAC5C,qEAAqE;QACrE,4DAA4D;QAC5D,iFAAiF;QACjF,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS;YACpC,CAAC,CAAC,2BAA2B,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;YACpD,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC;QAExB,iBAAiB;QACjB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC9C,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;gBACtB,OAAO,CAAC,GAAG,CAAC,mCAAmC,EAAE;oBAC/C,QAAQ;oBACR,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK;oBACvC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,MAAM;oBAC1C,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,MAAM;iBACtD,CAAC,CAAC;YACL,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,IAAI,IAAI,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