@kya-os/mcp-i 1.7.3 → 1.7.5
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.
|
@@ -125,7 +125,11 @@ class AgentShieldAPIDelegationVerifier {
|
|
|
125
125
|
if (this.debug) {
|
|
126
126
|
console.error(`[AgentShield] Cache HIT for ${agentDid} (${Date.now() - startTime}ms)`);
|
|
127
127
|
}
|
|
128
|
-
|
|
128
|
+
// Return cached result with cached flag set to true
|
|
129
|
+
return {
|
|
130
|
+
...cached,
|
|
131
|
+
cached: true,
|
|
132
|
+
};
|
|
129
133
|
}
|
|
130
134
|
}
|
|
131
135
|
// Slow path: API call
|
|
@@ -143,21 +147,23 @@ class AgentShieldAPIDelegationVerifier {
|
|
|
143
147
|
// Extract data from wrapped response
|
|
144
148
|
const data = response.data;
|
|
145
149
|
// Build result from validated response
|
|
150
|
+
// Note: Don't include 'cached' property in the result that gets cached
|
|
151
|
+
// We'll add it when returning (false for API calls, true for cache hits)
|
|
146
152
|
const result = {
|
|
147
153
|
valid: data.valid,
|
|
148
154
|
delegation: data.delegation,
|
|
149
155
|
// Include credential for authorization method validation
|
|
150
156
|
credential: data.credential,
|
|
151
157
|
reason: data.error ? data.error.message : data.reason,
|
|
152
|
-
cached: false,
|
|
153
158
|
};
|
|
154
|
-
// Cache result
|
|
159
|
+
// Cache result (without cached property)
|
|
155
160
|
const ttl = data.valid ? this.cacheTtl : this.cacheTtl / 2;
|
|
156
161
|
this.cache.set(cacheKey, result, ttl);
|
|
157
162
|
if (this.debug) {
|
|
158
163
|
console.error(`[AgentShield] Delegation ${data.valid ? "verified" : "rejected"} (${Date.now() - startTime}ms)`);
|
|
159
164
|
}
|
|
160
|
-
|
|
165
|
+
// Return result with cached: false for API calls
|
|
166
|
+
return { ...result, cached: false };
|
|
161
167
|
}
|
|
162
168
|
catch (error) {
|
|
163
169
|
console.error("[AgentShield] API call failed:", error);
|