@kya-os/mcp-i-core 1.2.2-canary.27 → 1.2.2-canary.28

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.
@@ -1,28 +1,2389 @@
1
1
 
2
- > @kya-os/mcp-i-core@1.2.2-canary.26 test:coverage /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core
2
+ > @kya-os/mcp-i-core@1.2.2-canary.27 test:coverage /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core
3
3
  > vitest run --coverage
4
4
 
5
- The CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
6
5
 
7
- RUN v1.6.1 /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core
6
+ RUN v4.0.5 /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core
7
+ Coverage enabled with v8
8
8
 
9
+ stdout | src/__tests__/services/agentshield-integration.test.ts > AgentShield Integration > API Authentication > should use X-API-Key header for new endpoint
10
+ [ToolProtectionService] Config loaded from API {
11
+ source: 'api',
12
+ toolCount: 0,
13
+ protectedTools: [],
14
+ agentDid: 'did:key:z6MkhaXgBZDv...',
15
+ projectId: 'test-project-123',
16
+ cacheTtlMs: 300000,
17
+ cacheExpiresAt: '2025-11-23T23:57:45.206Z'
18
+ }
9
19
 
10
- ⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯
11
- TypeError: The "original" argument must be of type function. Received an instance of Object
12
- promisify node:internal/util:463:3
13
- Object.<anonymous> ../../node_modules/.pnpm/test-exclude@6.0.0/node_modules/test-exclude/index.js:5:14
14
- ❯ Module._compile node:internal/modules/cjs/loader:1760:14
15
- ❯ Object..js node:internal/modules/cjs/loader:1892:10
16
- ❯ Module.load node:internal/modules/cjs/loader:1480:32
17
- ❯ Module._load node:internal/modules/cjs/loader:1299:12
18
- ❯ TracingChannel.traceSync node:diagnostics_channel:328:14
19
- ❯ wrapModuleLoad node:internal/modules/cjs/loader:245:24
20
- ❯ loadCJSModuleWithModuleLoad node:internal/modules/esm/translators:336:3
21
- ❯ ModuleWrap.<anonymous> node:internal/modules/esm/translators:239:7
20
+ stderr | src/__tests__/services/agentshield-integration.test.ts > AgentShield Integration > Error Handling > should handle network timeout
21
+ stdout | src/__tests__/services/agentshield-integration.test.ts > AgentShield Integration > API Authentication > should use Authorization Bearer header for old endpoint
22
+ [ToolProtectionService] API fetch failed, using fallback config { agentDid: 'did:key:z6MkhaXgBZDv...', error: 'Network timeout' }
23
+ [ToolProtectionService] Config loaded from API {
24
+ source: 'api',
22
25
 
23
- ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
24
- Serialized Error: { code: 'ERR_INVALID_ARG_TYPE' }
26
+ stderr | src/__tests__/services/agentshield-integration.test.ts > AgentShield Integration > Fallback Behavior > should cache fallback config
27
+ [ToolProtectionService] API fetch failed, using fallback config { agentDid: 'did:key:z6MkhaXgBZDv...', error: 'Network error' }
28
+ toolCount: 0,
25
29
 
30
+ protectedTools: [],
31
+ agentDid: 'did:key:z6MkhaXgBZDv...',
32
+ stderr | src/config/__tests__/remote-config.spec.ts > fetchRemoteConfig > Error handling > should return null if API request fails
33
+ projectId: 'none',
34
+ [RemoteConfig] API returned 404: Not Found
26
35
 
36
+ stderr | src/config/__tests__/remote-config.spec.ts > fetchRemoteConfig > Error handling > should return null if API throws error
37
+ [RemoteConfig] Failed to fetch config: Error: Network error
38
+ cacheTtlMs: 300000,
39
+ cacheExpiresAt: '2025-11-23T23:57:45.213Z'
40
+ }
27
41
 
28
-  ELIFECYCLE  Command failed with exit code 1.
42
+ stdout | src/__tests__/services/agentshield-integration.test.ts > AgentShield Integration > Endpoint Selection > should use project-scoped endpoint when projectId is available
43
+ [ToolProtectionService] Config loaded from API {
44
+ at /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/config/__tests__/remote-config.spec.ts:170:35
45
+ source: 'api',
46
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:157:11
47
+ toolCount: 0,
48
+ protectedTools: [],
49
+ agentDid: 'did:key:z6MkhaXgBZDv...',
50
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:753:26
51
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1636:20
52
+ projectId: 'test-project-123',
53
+ at new Promise (<anonymous>)
54
+ at runWithTimeout (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1602:10)
55
+ at runTest (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1309:12)
56
+ cacheTtlMs: 300000,
57
+ at processTicksAndRejections (node:internal/process/task_queues:103:5)
58
+ at runSuite (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1468:8)
59
+ cacheExpiresAt: '2025-11-23T23:57:45.215Z'
60
+ at runSuite (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1468:8)
61
+ }
62
+
63
+ stderr | src/config/__tests__/remote-config.spec.ts > fetchRemoteConfig > Error handling > should return null if neither projectId nor agentDid provided
64
+
65
+ stdout | src/__tests__/services/agentshield-integration.test.ts > AgentShield Integration > Endpoint Selection > should use agent-scoped endpoint when projectId is not available
66
+ [ToolProtectionService] Config loaded from API {
67
+ source: 'api',
68
+ [RemoteConfig] Neither projectId nor agentDid provided
69
+ toolCount: 0,
70
+ protectedTools: [],
71
+
72
+ stderr | src/config/__tests__/remote-config.spec.ts > fetchRemoteConfig > Error handling > should handle cache read errors gracefully
73
+ agentDid: 'did:key:z6MkhaXgBZDv...',
74
+ [RemoteConfig] Cache read failed: Error: Cache error
75
+ projectId: 'none',
76
+ cacheTtlMs: 300000,
77
+ cacheExpiresAt: '2025-11-23T23:57:45.216Z'
78
+ }
79
+
80
+ at /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/config/__tests__/remote-config.spec.ts:198:50
81
+ stdout | src/__tests__/services/agentshield-integration.test.ts > AgentShield Integration > Endpoint Selection > should encode projectId in URL
82
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:157:11
83
+ [ToolProtectionService] Config loaded from API {
84
+ source: 'api',
85
+ toolCount: 0,
86
+ protectedTools: [],
87
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:753:26
88
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1636:20
89
+ at new Promise (<anonymous>)
90
+ agentDid: 'did:key:z6MkhaXgBZDv...',
91
+ projectId: 'project/with/special-chars',
92
+ at runWithTimeout (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1602:10)
93
+ at runTest (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1309:12)
94
+ at processTicksAndRejections (node:internal/process/task_queues:103:5)
95
+ at runSuite (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1468:8)
96
+ cacheTtlMs: 300000,
97
+ cacheExpiresAt: '2025-11-23T23:57:45.216Z'
98
+ }
99
+
100
+ stdout | src/__tests__/services/agentshield-integration.test.ts > AgentShield Integration > Endpoint Selection > should encode agent DID in URL
101
+ [ToolProtectionService] Config loaded from API {
102
+ source: 'api',
103
+ toolCount: 0,
104
+ protectedTools: [],
105
+ agentDid: 'did:key:z6MkhaXgBZDv...',
106
+ projectId: 'none',
107
+ cacheTtlMs: 300000,
108
+ cacheExpiresAt: '2025-11-23T23:57:45.216Z'
109
+ at runSuite (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1468:8)
110
+ }
111
+
112
+
113
+ stdout | src/__tests__/services/agentshield-integration.test.ts > AgentShield Integration > Response Format Compatibility > should handle new endpoint format (toolProtections object)
114
+ stderr | src/__tests__/identity/user-did-manager.test.ts > UserDidManager > error handling > should handle storage.get errors gracefully
115
+ [UserDidManager] Storage.get failed, generating new DID: Error: Storage error
116
+ [ToolProtectionService] Config loaded from API {
117
+ source: 'api',
118
+ toolCount: 2,
119
+ protectedTools: [ 'checkout' ],
120
+ agentDid: 'did:key:z6MkhaXgBZDv...',
121
+ projectId: 'test-project-123',
122
+ at /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/__tests__/identity/user-did-manager.test.ts:187:67
123
+ cacheTtlMs: 300000,
124
+ cacheExpiresAt: '2025-11-23T23:57:45.216Z'
125
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:157:11
126
+ }
127
+
128
+ stdout | src/__tests__/services/agentshield-integration.test.ts > AgentShield Integration > Response Format Compatibility > should handle old endpoint format (tools array)
129
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:753:26
130
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1636:20
131
+ [ToolProtectionService] Config loaded from API {
132
+ source: 'api',
133
+ toolCount: 2,
134
+ protectedTools: [ 'checkout' ],
135
+ at new Promise (<anonymous>)
136
+ agentDid: 'did:key:z6MkhaXgBZDv...',
137
+ projectId: 'none',
138
+ cacheTtlMs: 300000,
139
+ cacheExpiresAt: '2025-11-23T23:57:45.216Z'
140
+ }
141
+
142
+ stdout | src/__tests__/services/agentshield-integration.test.ts > AgentShield Integration > Response Format Compatibility > should handle old endpoint format (tools object)
143
+ at runWithTimeout (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1602:10)
144
+ [ToolProtectionService] Config loaded from API {
145
+ source: 'api',
146
+ at runTest (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1309:12)
147
+ at processTicksAndRejections (node:internal/process/task_queues:103:5)
148
+ toolCount: 2,
149
+ at runSuite (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1468:8)
150
+ at runSuite (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1468:8)
151
+
152
+ protectedTools: [ 'checkout' ],
153
+ agentDid: 'did:key:z6MkhaXgBZDv...',
154
+ projectId: 'none',
155
+ cacheTtlMs: 300000,
156
+ stderr | src/__tests__/identity/user-did-manager.test.ts > UserDidManager > error handling > should handle storage.set errors gracefully
157
+ cacheExpiresAt: '2025-11-23T23:57:45.217Z'
158
+ [UserDidManager] Storage.set failed, continuing with cached DID: Error: Storage error
159
+ }
160
+ at /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/__tests__/identity/user-did-manager.test.ts:196:67
161
+
162
+ stdout | src/__tests__/services/agentshield-integration.test.ts > AgentShield Integration > Response Format Compatibility > should handle snake_case field names
163
+ [ToolProtectionService] Config loaded from API {
164
+ source: 'api',
165
+ toolCount: 1,
166
+ protectedTools: [ 'tool1' ],
167
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:157:11
168
+ agentDid: 'did:key:z6MkhaXgBZDv...',
169
+ projectId: 'test-project-123',
170
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:753:26
171
+ cacheTtlMs: 300000,
172
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1636:20
173
+ cacheExpiresAt: '2025-11-23T23:57:45.217Z'
174
+ }
175
+ at new Promise (<anonymous>)
176
+
177
+ stdout | src/__tests__/services/agentshield-integration.test.ts > AgentShield Integration > Response Format Compatibility > should handle camelCase field names
178
+ [ToolProtectionService] Config loaded from API {
179
+ source: 'api',
180
+ toolCount: 1,
181
+ protectedTools: [ 'tool1' ],
182
+ agentDid: 'did:key:z6MkhaXgBZDv...',
183
+ projectId: 'test-project-123',
184
+ at runWithTimeout (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1602:10)
185
+ cacheTtlMs: 300000,
186
+ cacheExpiresAt: '2025-11-23T23:57:45.217Z'
187
+ }
188
+
189
+ stdout | src/__tests__/services/agentshield-integration.test.ts > AgentShield Integration > Response Format Compatibility > should prefer camelCase over snake_case when both present
190
+ at runTest (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1309:12)
191
+ at processTicksAndRejections (node:internal/process/task_queues:103:5)
192
+ [ToolProtectionService] Config loaded from API {
193
+ source: 'api',
194
+ toolCount: 1,
195
+ protectedTools: [ 'tool1' ],
196
+ agentDid: 'did:key:z6MkhaXgBZDv...',
197
+ projectId: 'test-project-123',
198
+ cacheTtlMs: 300000,
199
+ at runSuite (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1468:8)
200
+ cacheExpiresAt: '2025-11-23T23:57:45.217Z'
201
+ }
202
+
203
+ at runSuite (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1468:8)
204
+
205
+ stderr | src/__tests__/identity/user-did-manager.test.ts > UserDidManager > error handling > should handle storage.delete errors gracefully
206
+ [UserDidManager] Storage.delete failed, continuing: Error: Storage error
207
+ at /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/__tests__/identity/user-did-manager.test.ts:206:70
208
+ at processTicksAndRejections (node:internal/process/task_queues:103:5)
209
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:753:20
210
+
211
+ stdout | src/__tests__/services/agentshield-integration.test.ts > AgentShield Integration > Caching Integration > should cache successful API responses
212
+ [ToolProtectionService] Config loaded from API {
213
+ source: 'api',
214
+ toolCount: 1,
215
+ protectedTools: [ 'tool1' ],
216
+ agentDid: 'did:key:z6MkhaXgBZDv...',
217
+ projectId: 'test-project-123',
218
+ cacheTtlMs: 300000,
219
+ cacheExpiresAt: '2025-11-23T23:57:45.219Z'
220
+ }
221
+
222
+ stdout | src/__tests__/services/agentshield-integration.test.ts > AgentShield Integration > Caching Integration > should respect cache TTL
223
+ [ToolProtectionService] Config loaded from API {
224
+ source: 'api',
225
+ toolCount: 0,
226
+ protectedTools: [],
227
+ agentDid: 'did:key:z6MkhaXgBZDv...',
228
+ projectId: 'test-project-123',
229
+ cacheTtlMs: 1000,
230
+ cacheExpiresAt: '2025-11-23T23:52:46.222Z'
231
+ }
232
+
233
+ ✓ src/__tests__/identity/user-did-manager.test.ts (17 tests) 11ms
234
+ ✓ src/config/__tests__/remote-config.spec.ts (9 tests) 17ms
235
+ stderr | src/services/__tests__/storage.service.test.ts > StorageService > createStorageProviders > should prefer Redis over KV when both are configured
236
+ [StorageService] Failed to connect to Redis, falling back to memory: Redis package not available
237
+
238
+ stdout | src/__tests__/regression/phase2-regression.test.ts > Phase 2 Regression Tests > Backward Compatibility > Phase 1 tools (no oauthProvider) > should work with Phase 1 tools that don't specify oauthProvider
239
+ [ToolProtectionService] Config loaded from API {
240
+ source: 'api',
241
+ toolCount: 1,
242
+ protectedTools: [ 'phase1_tool' ],
243
+ agentDid: 'did:key:z6MkhaXgBZDv...',
244
+ projectId: 'none',
245
+ cacheTtlMs: 300000,
246
+ cacheExpiresAt: '2025-11-23T23:57:45.245Z'
247
+ }
248
+
249
+ stdout | src/__tests__/regression/phase2-regression.test.ts > Phase 2 Regression Tests > Backward Compatibility > Old API endpoint format > should still support old endpoint format (tools array)
250
+ [ToolProtectionService] Config loaded from API {
251
+ source: 'api',
252
+ toolCount: 1,
253
+ protectedTools: [ 'old_tool' ],
254
+ agentDid: 'did:key:z6MkhaXgBZDv...',
255
+ projectId: 'none',
256
+ cacheTtlMs: 300000,
257
+ cacheExpiresAt: '2025-11-23T23:57:45.252Z'
258
+ }
259
+
260
+ stdout | src/__tests__/regression/phase2-regression.test.ts > Phase 2 Regression Tests > Backward Compatibility > Old API endpoint format > should still support old endpoint format (tools object)
261
+ [ToolProtectionService] Config loaded from API {
262
+ source: 'api',
263
+ toolCount: 1,
264
+ stderr | src/__tests__/regression/phase2-regression.test.ts > Phase 2 Regression Tests > No Regressions > Phase 1 OAuth flow > should still work with Phase 1 OAuth flow (no oauthProvider)
265
+ protectedTools: [ 'old_tool' ],
266
+ agentDid: 'did:key:z6MkhaXgBZDv...',
267
+ [ProviderResolver] Tool does not specify oauthProvider. Using first configured provider "github" as fallback. This is deprecated - configure oauthProvider in AgentShield dashboard for Phase 2+.
268
+ projectId: 'none',
269
+
270
+ cacheTtlMs: 300000,
271
+ cacheExpiresAt: '2025-11-23T23:57:45.252Z'
272
+ }
273
+
274
+ stdout | src/__tests__/regression/phase2-regression.test.ts > Phase 2 Regression Tests > Backward Compatibility > snake_case field names > should still support snake_case field names
275
+ [ToolProtectionService] Config loaded from API {
276
+ source: 'api',
277
+ toolCount: 1,
278
+ protectedTools: [ 'tool_with_snake_case' ],
279
+ agentDid: 'did:key:z6MkhaXgBZDv...',
280
+ projectId: 'test-project-123',
281
+ cacheTtlMs: 300000,
282
+ cacheExpiresAt: '2025-11-23T23:57:45.252Z'
283
+ }
284
+
285
+ stdout | src/__tests__/regression/phase2-regression.test.ts > Phase 2 Regression Tests > Mixed Phase 1 and Phase 2 tools > should handle mix of Phase 1 and Phase 2 tools in same project
286
+ [ToolProtectionService] Config loaded from API {
287
+ source: 'api',
288
+ toolCount: 2,
289
+ protectedTools: [ 'phase1_tool', 'phase2_tool' ],
290
+ agentDid: 'did:key:z6MkhaXgBZDv...',
291
+ projectId: 'test-project-123',
292
+ cacheTtlMs: 300000,
293
+ cacheExpiresAt: '2025-11-23T23:57:45.253Z'
294
+ }
295
+
296
+ stderr | src/services/__tests__/access-control.service.test.ts > AccessControlApiService > submitProofs > should submit proofs successfully
297
+ [AccessControl] 🔍 RAW API RESPONSE (before parsing): {
298
+ correlationId: '2c1788f8-8a60-49d8-b1dc-ac8ccbc9057f',
299
+ status: 200,
300
+ statusText: '',
301
+ headers: { 'content-type': 'application/json' },
302
+ responseTextLength: 100,
303
+ responseTextPreview: '{"success":true,"accepted":1,"rejected":0,"outcomes":{"success":1,"failed":0,"blocked":0,"error":0}}',
304
+ fullResponseText: '{"success":true,"accepted":1,"rejected":0,"outcomes":{"success":1,"failed":0,"blocked":0,"error":0}}'
305
+ }
306
+ [AccessControl] 🔍 PARSED RESPONSE DATA: {
307
+ correlationId: '2c1788f8-8a60-49d8-b1dc-ac8ccbc9057f',
308
+ status: 200,
309
+ responseDataType: 'object',
310
+ responseDataKeys: [ 'success', 'accepted', 'rejected', 'outcomes' ],
311
+ responseData: '{\n' +
312
+ ' "success": true,\n' +
313
+ ' "accepted": 1,\n' +
314
+ ' "rejected": 0,\n' +
315
+ ' "outcomes": {\n' +
316
+ ' "success": 1,\n' +
317
+ ' "failed": 0,\n' +
318
+ ' "blocked": 0,\n' +
319
+ ' "error": 0\n' +
320
+ ' }\n' +
321
+ '}'
322
+ }
323
+ [AccessControl] Raw response received: {
324
+ "success": true,
325
+ "accepted": 1,
326
+ "rejected": 0,
327
+ "outcomes": {
328
+ "success": 1,
329
+ "failed": 0,
330
+ "blocked": 0,
331
+ "error": 0
332
+ }
333
+ }
334
+
335
+ stderr | src/services/__tests__/access-control.service.test.ts > AccessControlApiService > submitProofs > should handle all_proofs_rejected error gracefully
336
+ [AccessControl] 🔍 RAW API RESPONSE (before parsing): {
337
+ correlationId: '232cb36c-9e64-4ea6-b67e-79f931288d33',
338
+ status: 400,
339
+ statusText: '',
340
+ headers: { 'content-type': 'application/json' },
341
+ responseTextLength: 209,
342
+ responseTextPreview: '{"success":false,"error":{"code":"all_proofs_rejected","message":"All proofs rejected","details":{"rejected":1,"errors":[{"proof_index":0,"error":{"code":"invalid_signature","message":"Invalid signature"}}]}}}',
343
+ fullResponseText: '{"success":false,"error":{"code":"all_proofs_rejected","message":"All proofs rejected","details":{"rejected":1,"errors":[{"proof_index":0,"error":{"code":"invalid_signature","message":"Invalid signature"}}]}}}'
344
+ }
345
+ [AccessControl] 🔍 PARSED RESPONSE DATA: {
346
+ correlationId: '232cb36c-9e64-4ea6-b67e-79f931288d33',
347
+ status: 400,
348
+ responseDataType: 'object',
349
+ responseDataKeys: [ 'success', 'error' ],
350
+ responseData: '{\n' +
351
+ ' "success": false,\n' +
352
+ ' "error": {\n' +
353
+ ' "code": "all_proofs_rejected",\n' +
354
+ ' "message": "All proofs rejected",\n' +
355
+ ' "details": {\n' +
356
+ ' "rejected": 1,\n' +
357
+ ' "errors": [\n' +
358
+ ' {\n' +
359
+ ' "proof_index": 0,\n' +
360
+ ' "error": {\n' +
361
+ ' "code": "invalid_signature",\n' +
362
+ ' "message": "Invalid signature"\n' +
363
+ ' }\n' +
364
+ ' }\n' +
365
+ ' ]\n' +
366
+ ' }\n' +
367
+ ' }\n' +
368
+ '}'
369
+ }
370
+
371
+ stderr | src/services/__tests__/access-control.service.test.ts > AccessControlApiService > submitProofs > should handle wrapped response format
372
+ [AccessControl] 🔍 RAW API RESPONSE (before parsing): {
373
+ correlationId: '2f0753a4-8896-4876-9ecb-84edd0389744',
374
+ status: 200,
375
+ statusText: '',
376
+ headers: { 'content-type': 'application/json' },
377
+ responseTextLength: 206,
378
+ responseTextPreview: '{"success":true,"data":{"success":true,"accepted":1,"rejected":0,"outcomes":{"success":1,"failed":0,"blocked":0,"error":0}},"metadata":{"requestId":"test-request-id","timestamp":"2025-11-23T23:52:45.255Z"}}',
379
+ fullResponseText: '{"success":true,"data":{"success":true,"accepted":1,"rejected":0,"outcomes":{"success":1,"failed":0,"blocked":0,"error":0}},"metadata":{"requestId":"test-request-id","timestamp":"2025-11-23T23:52:45.255Z"}}'
380
+ }
381
+ [AccessControl] 🔍 PARSED RESPONSE DATA: {
382
+ correlationId: '2f0753a4-8896-4876-9ecb-84edd0389744',
383
+ status: 200,
384
+ responseDataType: 'object',
385
+ responseDataKeys: [ 'success', 'data', 'metadata' ],
386
+ responseData: '{\n' +
387
+ ' "success": true,\n' +
388
+ ' "data": {\n' +
389
+ ' "success": true,\n' +
390
+ ' "accepted": 1,\n' +
391
+ ' "rejected": 0,\n' +
392
+ ' "outcomes": {\n' +
393
+ ' "success": 1,\n' +
394
+ ' "failed": 0,\n' +
395
+ ' "blocked": 0,\n' +
396
+ ' "error": 0\n' +
397
+ ' }\n' +
398
+ ' },\n' +
399
+ ' "metadata": {\n' +
400
+ ' "requestId": "test-request-id",\n' +
401
+ ' "timestamp": "2025-11-23T23:52:45.255Z"\n' +
402
+ ' }\n' +
403
+ '}'
404
+ }
405
+ [AccessControl] Raw response received: {
406
+ "success": true,
407
+ "data": {
408
+ "success": true,
409
+ "accepted": 1,
410
+ "rejected": 0,
411
+ "outcomes": {
412
+ "success": 1,
413
+ "failed": 0,
414
+ "blocked": 0,
415
+ "error": 0
416
+ }
417
+ },
418
+ "metadata": {
419
+ "requestId": "test-request-id",
420
+ "timestamp": "2025-11-23T23:52:45.255Z"
421
+ }
422
+ }
423
+ [AccessControl] 🔍 DATA OBJECT STRUCTURE: {
424
+ correlationId: '2f0753a4-8896-4876-9ecb-84edd0389744',
425
+ dataKeys: [ 'success', 'accepted', 'rejected', 'outcomes' ],
426
+ hasAccepted: true,
427
+ hasRejected: true,
428
+ hasOutcomes: true,
429
+ hasErrors: false,
430
+ acceptedType: 'number',
431
+ rejectedType: 'number',
432
+ outcomesType: 'object',
433
+ errorsType: 'undefined',
434
+ errorsIsArray: false,
435
+ fullData: '{\n' +
436
+ ' "success": true,\n' +
437
+ ' "accepted": 1,\n' +
438
+ ' "rejected": 0,\n' +
439
+ ' "outcomes": {\n' +
440
+ ' "success": 1,\n' +
441
+ ' "failed": 0,\n' +
442
+ ' "blocked": 0,\n' +
443
+ ' "error": 0\n' +
444
+ ' }\n' +
445
+ '}'
446
+ }
447
+
448
+ stderr | src/services/__tests__/access-control.service.test.ts > AccessControlApiService > submitProofs > should handle response with missing outcomes field (outcomes is optional)
449
+ [AccessControl] 🔍 RAW API RESPONSE (before parsing): {
450
+ correlationId: '822bde9b-ffd7-4d57-a745-ec1bfd1140d0',
451
+ status: 200,
452
+ statusText: '',
453
+ headers: { 'content-type': 'application/json' },
454
+ responseTextLength: 42,
455
+ responseTextPreview: '{"success":true,"accepted":1,"rejected":0}',
456
+ fullResponseText: '{"success":true,"accepted":1,"rejected":0}'
457
+ }
458
+ [AccessControl] 🔍 PARSED RESPONSE DATA: {
459
+ correlationId: '822bde9b-ffd7-4d57-a745-ec1bfd1140d0',
460
+ status: 200,
461
+ responseDataType: 'object',
462
+ responseDataKeys: [ 'success', 'accepted', 'rejected' ],
463
+ responseData: '{\n "success": true,\n "accepted": 1,\n "rejected": 0\n}'
464
+ }
465
+ [AccessControl] Raw response received: {
466
+ "success": true,
467
+ "accepted": 1,
468
+ "rejected": 0
469
+ }
470
+
471
+ stderr | src/services/__tests__/access-control.service.test.ts > AccessControlApiService > submitProofs > should handle response with missing outcomes field (outcomes is optional)
472
+ [AccessControl] 🔍 RAW API RESPONSE (before parsing): {
473
+ correlationId: 'e8efadc2-0d1e-41e3-8726-2c07d105a0cd',
474
+ status: 200,
475
+ statusText: '',
476
+ headers: { 'content-type': 'application/json' },
477
+ responseTextLength: 100,
478
+ responseTextPreview: '{"success":true,"accepted":1,"rejected":0,"outcomes":{"success":1,"failed":0,"blocked":0,"error":0}}',
479
+ fullResponseText: '{"success":true,"accepted":1,"rejected":0,"outcomes":{"success":1,"failed":0,"blocked":0,"error":0}}'
480
+ }
481
+ [AccessControl] 🔍 PARSED RESPONSE DATA: {
482
+ correlationId: 'e8efadc2-0d1e-41e3-8726-2c07d105a0cd',
483
+ status: 200,
484
+ responseDataType: 'object',
485
+ responseDataKeys: [ 'success', 'accepted', 'rejected', 'outcomes' ],
486
+ responseData: '{\n' +
487
+ ' "success": true,\n' +
488
+ ' "accepted": 1,\n' +
489
+ ' "rejected": 0,\n' +
490
+ ' "outcomes": {\n' +
491
+ ' "success": 1,\n' +
492
+ ' "failed": 0,\n' +
493
+ ' "blocked": 0,\n' +
494
+ ' "error": 0\n' +
495
+ ' }\n' +
496
+ '}'
497
+ }
498
+ [AccessControl] Raw response received: {
499
+ "success": true,
500
+ "accepted": 1,
501
+ "rejected": 0,
502
+ "outcomes": {
503
+ "success": 1,
504
+ "failed": 0,
505
+ "blocked": 0,
506
+ "error": 0
507
+ }
508
+ }
509
+
510
+ stderr | src/services/__tests__/access-control.service.test.ts > AccessControlApiService > submitProofs > should handle response with missing outcomes field (outcomes is optional)
511
+ [AccessControl] 🔍 RAW API RESPONSE (before parsing): {
512
+ correlationId: '09aa8dd2-372f-4728-b978-ef3495057853',
513
+ status: 200,
514
+ statusText: '',
515
+ headers: { 'content-type': 'application/json' },
516
+ responseTextLength: 56,
517
+ responseTextPreview: '{"success":true,"accepted":1,"rejected":0,"outcomes":{}}',
518
+ fullResponseText: '{"success":true,"accepted":1,"rejected":0,"outcomes":{}}'
519
+ }
520
+ [AccessControl] 🔍 PARSED RESPONSE DATA: {
521
+ correlationId: '09aa8dd2-372f-4728-b978-ef3495057853',
522
+ status: 200,
523
+ responseDataType: 'object',
524
+ responseDataKeys: [ 'success', 'accepted', 'rejected', 'outcomes' ],
525
+ responseData: '{\n "success": true,\n "accepted": 1,\n "rejected": 0,\n "outcomes": {}\n}'
526
+ }
527
+ [AccessControl] Raw response received: {
528
+ "success": true,
529
+ "accepted": 1,
530
+ "rejected": 0,
531
+ "outcomes": {}
532
+ }
533
+
534
+ stderr | src/services/__tests__/storage.service.test.ts > StorageService > createStorageProviders > should prefer Redis over KV when both are configured
535
+ [StorageService] Failed to initialize KV, falling back to memory: Failed to import Cloudflare storage providers: Cannot find package '@kya-os/mcp-i-cloudflare/providers/storage' imported from '/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/storage.service.ts'
536
+
537
+ stderr | src/services/__tests__/storage.service.test.ts > StorageService > createStorageProviders > should fall back to memory when Redis connection fails
538
+ [StorageService] Failed to connect to Redis, falling back to memory: Redis package not available
539
+
540
+ stderr | src/services/__tests__/storage.service.test.ts > StorageService > createStorageProviders > should use KV namespace when provided
541
+ [StorageService] Failed to initialize KV, falling back to memory: Failed to import Cloudflare storage providers: Cannot find package '@kya-os/mcp-i-cloudflare/providers/storage' imported from '/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/storage.service.ts'
542
+
543
+ ✓ src/__tests__/regression/phase2-regression.test.ts (12 tests) 9ms
544
+ stderr | src/services/__tests__/access-control.service.test.ts > AccessControlApiService > submitProofs > should handle wrapped response with invalid data structure
545
+ [AccessControl] 🔍 RAW API RESPONSE (before parsing): {
546
+ correlationId: '2b474af7-92db-47c7-801a-c6c699abe0e6',
547
+ status: 200,
548
+ statusText: '',
549
+ headers: { 'content-type': 'application/json' },
550
+ responseTextLength: 52,
551
+ responseTextPreview: '{"success":true,"data":{"message":"Invalid format"}}',
552
+ fullResponseText: '{"success":true,"data":{"message":"Invalid format"}}'
553
+ }
554
+ [AccessControl] 🔍 PARSED RESPONSE DATA: {
555
+ correlationId: '2b474af7-92db-47c7-801a-c6c699abe0e6',
556
+ status: 200,
557
+ responseDataType: 'object',
558
+ responseDataKeys: [ 'success', 'data' ],
559
+ responseData: '{\n "success": true,\n "data": {\n "message": "Invalid format"\n }\n}'
560
+ }
561
+ [AccessControl] Raw response received: {
562
+ "success": true,
563
+ "data": {
564
+ "message": "Invalid format"
565
+ }
566
+ }
567
+ [AccessControl] 🔍 DATA OBJECT STRUCTURE: {
568
+ correlationId: '2b474af7-92db-47c7-801a-c6c699abe0e6',
569
+ dataKeys: [ 'message' ],
570
+ hasAccepted: false,
571
+ hasRejected: false,
572
+ hasOutcomes: false,
573
+ hasErrors: false,
574
+ acceptedType: 'undefined',
575
+ rejectedType: 'undefined',
576
+ outcomesType: 'undefined',
577
+ errorsType: 'undefined',
578
+ errorsIsArray: false,
579
+ fullData: '{\n "message": "Invalid format"\n}'
580
+ }
581
+ [AccessControl] Wrapped response validation failed {
582
+ correlationId: '2b474af7-92db-47c7-801a-c6c699abe0e6',
583
+ zodErrors: [
584
+ {
585
+ code: 'invalid_type',
586
+ expected: 'number',
587
+ received: 'undefined',
588
+ path: [Array],
589
+ message: 'Required'
590
+ },
591
+ {
592
+ code: 'invalid_type',
593
+ expected: 'number',
594
+ received: 'undefined',
595
+ path: [Array],
596
+ message: 'Required'
597
+ }
598
+ ],
599
+ zodErrorDetails: '[\n' +
600
+ ' {\n' +
601
+ ' "code": "invalid_type",\n' +
602
+ ' "expected": "number",\n' +
603
+ ' "received": "undefined",\n' +
604
+ ' "path": [\n' +
605
+ ' "accepted"\n' +
606
+ ' ],\n' +
607
+ ' "message": "Required"\n' +
608
+ ' },\n' +
609
+ ' {\n' +
610
+ ' "code": "invalid_type",\n' +
611
+ ' "expected": "number",\n' +
612
+ ' "received": "undefined",\n' +
613
+ ' "path": [\n' +
614
+ ' "rejected"\n' +
615
+ ' ],\n' +
616
+ ' "message": "Required"\n' +
617
+ ' }\n' +
618
+ ']',
619
+ dataToValidate: '{\n "message": "Invalid format"\n}',
620
+ dataWithSuccess: '{\n "message": "Invalid format",\n "success": true\n}',
621
+ dataKeys: [ 'message' ],
622
+ originalResponse: '{\n "success": true,\n "data": {\n "message": "Invalid format"\n }\n}'
623
+ }
624
+ [AccessControl] Original wrapped response: {
625
+ "success": true,
626
+ "data": {
627
+ "message": "Invalid format"
628
+ }
629
+ }
630
+ [AccessControl] ❌ ZOD VALIDATION FAILED - 2 error(s):
631
+ [AccessControl] Error 1: {
632
+ path: 'accepted',
633
+ message: 'Required',
634
+ code: 'invalid_type',
635
+ received: 'undefined',
636
+ expected: 'number'
637
+ }
638
+ [AccessControl] Error 2: {
639
+ path: 'rejected',
640
+ message: 'Required',
641
+ code: 'invalid_type',
642
+ received: 'undefined',
643
+ expected: 'number'
644
+ }
645
+ [AccessControl] ❌ Full ZOD errors JSON: [
646
+ {
647
+ "code": "invalid_type",
648
+ "expected": "number",
649
+ "received": "undefined",
650
+ "path": [
651
+ "accepted"
652
+ ],
653
+ "message": "Required"
654
+ },
655
+ {
656
+ "code": "invalid_type",
657
+ "expected": "number",
658
+ "received": "undefined",
659
+ "path": [
660
+ "rejected"
661
+ ],
662
+ "message": "Required"
663
+ }
664
+ ]
665
+ [AccessControl] Response validation failed {
666
+ zodErrors: [
667
+ {
668
+ code: 'invalid_type',
669
+ expected: 'number',
670
+ received: 'undefined',
671
+ path: [Array],
672
+ message: 'Required'
673
+ },
674
+ {
675
+ code: 'invalid_type',
676
+ expected: 'number',
677
+ received: 'undefined',
678
+ path: [Array],
679
+ message: 'Required'
680
+ }
681
+ ],
682
+ responseData: { success: true, data: { message: 'Invalid format' } }
683
+ }
684
+ [AccessControl] Response validation failed {
685
+ correlationId: '2b474af7-92db-47c7-801a-c6c699abe0e6',
686
+ zodErrors: [
687
+ {
688
+ code: 'invalid_type',
689
+ expected: 'number',
690
+ received: 'undefined',
691
+ path: [Array],
692
+ message: 'Required'
693
+ },
694
+ {
695
+ code: 'invalid_type',
696
+ expected: 'number',
697
+ received: 'undefined',
698
+ path: [Array],
699
+ message: 'Required'
700
+ }
701
+ ],
702
+ zodErrorDetails: '[\n' +
703
+ ' {\n' +
704
+ ' "code": "invalid_type",\n' +
705
+ ' "expected": "number",\n' +
706
+ ' "received": "undefined",\n' +
707
+ ' "path": [\n' +
708
+ ' "accepted"\n' +
709
+ ' ],\n' +
710
+ ' "message": "Required"\n' +
711
+ ' },\n' +
712
+ ' {\n' +
713
+ ' "code": "invalid_type",\n' +
714
+ ' "expected": "number",\n' +
715
+ ' "received": "undefined",\n' +
716
+ ' "path": [\n' +
717
+ ' "rejected"\n' +
718
+ ' ],\n' +
719
+ ' "message": "Required"\n' +
720
+ ' }\n' +
721
+ ']',
722
+ responseData: '{\n "success": true,\n "data": {\n "message": "Invalid format"\n }\n}',
723
+ responseDataType: 'object',
724
+ responseKeys: [ 'success', 'data' ],
725
+ httpStatus: 200,
726
+ httpStatusText: ''
727
+ }
728
+ [AccessControl] ❌ ZOD VALIDATION FAILED (direct) - 2 error(s):
729
+ [AccessControl] Error 1: {
730
+ path: 'accepted',
731
+ message: 'Required',
732
+ code: 'invalid_type',
733
+ received: 'undefined',
734
+ expected: 'number'
735
+ }
736
+ [AccessControl] Error 2: {
737
+ path: 'rejected',
738
+ message: 'Required',
739
+ code: 'invalid_type',
740
+ received: 'undefined',
741
+ expected: 'number'
742
+ }
743
+ [AccessControl] ❌ Full ZOD errors JSON: [
744
+ {
745
+ "code": "invalid_type",
746
+ "expected": "number",
747
+ "received": "undefined",
748
+ "path": [
749
+ "accepted"
750
+ ],
751
+ "message": "Required"
752
+ },
753
+ {
754
+ "code": "invalid_type",
755
+ "expected": "number",
756
+ "received": "undefined",
757
+ "path": [
758
+ "rejected"
759
+ ],
760
+ "message": "Required"
761
+ }
762
+ ]
763
+ [AccessControl] ❌ ACTUAL RESPONSE DATA: {
764
+ "success": true,
765
+ "data": {
766
+ "message": "Invalid format"
767
+ }
768
+ }
769
+
770
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should allow tool execution when no protection required
771
+ [MCP-I] Checking tool protection: {
772
+ tool: 'unprotectedTool',
773
+ agentDid: 'did:key:zmock123...',
774
+ hasDelegation: false
775
+ }
776
+
777
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should allow tool execution when no protection required
778
+ [MCP-I] Tool protection check passed (no delegation required) {
779
+ tool: 'unprotectedTool',
780
+ agentDid: 'did:key:zmock123...',
781
+ reason: 'Tool not configured to require delegation'
782
+ }
783
+
784
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should block tool execution when protection required and no delegation
785
+ [MCP-I] Checking tool protection: {
786
+ tool: 'protectedTool',
787
+ agentDid: 'did:key:zmock123...',
788
+ hasDelegation: false
789
+ }
790
+
791
+ stderr | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should block tool execution when protection required and no delegation
792
+ [MCP-I] BLOCKED: Tool requires delegation but none provided {
793
+ tool: 'protectedTool',
794
+ requiredScopes: [ 'files:write' ],
795
+ agentDid: 'did:key:zmock123...',
796
+ resumeToken: 'resume_r397g3_micdi38b',
797
+ consentUrl: 'https://kya.vouched.id/bouncer/consent?tool=protectedTool&scopes=files%3Awrite&session_id=session123&agent_did=&resume_token=resume_r397g3_micdi38b'
798
+ }
799
+
800
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should allow tool execution when protection required and delegation provided
801
+ [MCP-I] Checking tool protection: {
802
+ tool: 'protectedTool',
803
+ agentDid: 'did:key:zmock123...',
804
+ hasDelegation: true
805
+ }
806
+
807
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should allow tool execution when protection required and delegation provided
808
+ [MCP-I] 🔐 Verifying delegation token with AccessControlApiService {
809
+ tool: 'protectedTool',
810
+ agentDid: 'did:key:zmock123...',
811
+ hasDelegationToken: true,
812
+ hasConsentProof: false,
813
+ requiredScopes: [ 'files:write' ]
814
+ }
815
+
816
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should allow tool execution when protection required and delegation provided
817
+ [MCP-I] ✅ Delegation verification SUCCEEDED {
818
+ tool: 'protectedTool',
819
+ agentDid: 'did:key:zmock123...',
820
+ delegationId: 'test-delegation-id',
821
+ credentialScopes: [ 'files:write' ],
822
+ requiredScopes: [ 'files:write' ]
823
+ }
824
+
825
+ ✓ src/services/__tests__/storage.service.test.ts (17 tests) 25ms
826
+ stderr | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should block tool execution when delegation verification fails
827
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should allow tool execution when protection required and consentProof provided
828
+ [MCP-I] ❌ Delegation verification FAILED {
829
+ tool: 'protectedTool',
830
+ agentDid: 'did:key:zmock123...',
831
+ [MCP-I] Checking tool protection: {
832
+ reason: 'Delegation token expired',
833
+ errorCode: undefined,
834
+ tool: 'protectedTool',
835
+ errorMessage: undefined,
836
+ requiredScopes: [ 'files:write' ]
837
+ }
838
+ agentDid: 'did:key:zmock123...',
839
+ hasDelegation: true
840
+ }
841
+
842
+ stderr | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should block tool execution when delegation has wrong scopes
843
+
844
+ [MCP-I] ❌ Delegation verification FAILED {
845
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should allow tool execution when protection required and consentProof provided
846
+ [MCP-I] 🔐 Verifying delegation token with AccessControlApiService {
847
+ tool: 'protectedTool',
848
+ agentDid: 'did:key:zmock123...',
849
+ hasDelegationToken: false,
850
+ hasConsentProof: true,
851
+ requiredScopes: [ 'files:write' ]
852
+ }
853
+
854
+ tool: 'protectedTool',
855
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should allow tool execution when protection required and consentProof provided
856
+ [MCP-I] ✅ Delegation verification SUCCEEDED {
857
+ tool: 'protectedTool',
858
+ agentDid: 'did:key:zmock123...',
859
+ agentDid: 'did:key:zmock123...',
860
+ reason: 'Insufficient scopes',
861
+ delegationId: 'test-delegation-id',
862
+ errorCode: undefined,
863
+ credentialScopes: [ 'files:write' ],
864
+ requiredScopes: [ 'files:write' ]
865
+ }
866
+
867
+ errorMessage: undefined,
868
+ requiredScopes: [ 'files:write' ]
869
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should block tool execution when delegation verification fails
870
+ }
871
+ [MCP-I] Checking tool protection: {
872
+
873
+ tool: 'protectedTool',
874
+ agentDid: 'did:key:zmock123...',
875
+ hasDelegation: true
876
+ }
877
+
878
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should block tool execution when delegation verification fails
879
+ [MCP-I] 🔐 Verifying delegation token with AccessControlApiService {
880
+ tool: 'protectedTool',
881
+ agentDid: 'did:key:zmock123...',
882
+ hasDelegationToken: true,
883
+ hasConsentProof: false,
884
+ requiredScopes: [ 'files:write' ]
885
+ }
886
+
887
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should block tool execution when delegation has wrong scopes
888
+ [MCP-I] Checking tool protection: {
889
+ tool: 'protectedTool',
890
+ agentDid: 'did:key:zmock123...',
891
+ hasDelegation: true
892
+ }
893
+
894
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should block tool execution when delegation has wrong scopes
895
+ [MCP-I] 🔐 Verifying delegation token with AccessControlApiService {
896
+ tool: 'protectedTool',
897
+ agentDid: 'did:key:zmock123...',
898
+ hasDelegationToken: true,
899
+ hasConsentProof: false,
900
+ requiredScopes: [ 'files:write' ]
901
+ }
902
+
903
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should handle API errors during verification gracefully
904
+ [MCP-I] Checking tool protection: {
905
+ tool: 'protectedTool',
906
+ agentDid: 'did:key:zmock123...',
907
+ hasDelegation: true
908
+ }
909
+
910
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should handle API errors during verification gracefully
911
+ [MCP-I] 🔐 Verifying delegation token with AccessControlApiService {
912
+ tool: 'protectedTool',
913
+ agentDid: 'did:key:zmock123...',
914
+ hasDelegationToken: true,
915
+ hasConsentProof: false,
916
+ requiredScopes: [ 'files:write' ]
917
+ }
918
+
919
+ stderr | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should handle API errors during verification gracefully
920
+ [MCP-I] ❌ Delegation verification error (API failure) {
921
+ tool: 'protectedTool',
922
+ agentDid: 'did:key:zmock123...',
923
+ errorCode: 'network_error',
924
+ errorMessage: 'API unavailable',
925
+ errorDetails: {}
926
+ }
927
+
928
+ stderr | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should allow tool execution when access control service not configured (graceful degradation)
929
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should allow tool execution when access control service not configured (graceful degradation)
930
+ [MCP-I] Checking tool protection: {
931
+ tool: 'protectedTool',
932
+ agentDid: 'did:key:zmock123...',
933
+ hasDelegation: true
934
+ }
935
+
936
+ [MCP-I] ⚠️ Delegation token provided but AccessControlApiService not configured - skipping verification {
937
+ tool: 'protectedTool',
938
+ agentDid: 'did:key:zmock123...',
939
+ hasDelegationToken: true,
940
+ hasConsentProof: false
941
+ }
942
+
943
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > user_identifier validation > should reject delegation when user_identifier does not match session userDid
944
+ [MCP-I] Checking tool protection: {
945
+ tool: 'protectedTool',
946
+ agentDid: 'did:key:zmock123...',
947
+ stderr | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > user_identifier validation > should reject delegation when user_identifier does not match session userDid
948
+ hasDelegation: true
949
+ }
950
+
951
+ [MCP-I] 🔒 SECURITY: User identifier validation FAILED {
952
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > user_identifier validation > should reject delegation when user_identifier does not match session userDid
953
+ [MCP-I] 🔐 Verifying delegation token with AccessControlApiService {
954
+ tool: 'protectedTool',
955
+ agentDid: 'did:key:zmock123...',
956
+ hasDelegationToken: true,
957
+ tool: 'protectedTool',
958
+ agentDid: 'did:key:zmock123...',
959
+ delegationUserIdentifier: 'did:key:zUserB987654...',
960
+ sessionUserDid: 'did:key:zUserA123456...',
961
+ hasConsentProof: false,
962
+ sessionId: 'session123...',
963
+ reason: 'user_identifier_mismatch',
964
+ requiredScopes: [ 'files:write' ]
965
+ }
966
+
967
+ severity: 'high'
968
+ }
969
+
970
+ ✓ src/delegation/__tests__/vc-verifier.test.ts (35 tests) 101ms
971
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > user_identifier validation > should accept delegation when user_identifier matches session userDid
972
+ [MCP-I] Checking tool protection: {
973
+ tool: 'protectedTool',
974
+ agentDid: 'did:key:zmock123...',
975
+ hasDelegation: true
976
+ }
977
+
978
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > user_identifier validation > should accept delegation when user_identifier matches session userDid
979
+ [MCP-I] 🔐 Verifying delegation token with AccessControlApiService {
980
+ tool: 'protectedTool',
981
+ agentDid: 'did:key:zmock123...',
982
+ hasDelegationToken: true,
983
+ hasConsentProof: false,
984
+ requiredScopes: [ 'files:write' ]
985
+ }
986
+
987
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > user_identifier validation > should accept delegation when user_identifier matches session userDid
988
+ [MCP-I] ✅ User identifier validation PASSED {
989
+ tool: 'protectedTool',
990
+ agentDid: 'did:key:zmock123...',
991
+ userDid: 'did:key:zUserA123456...',
992
+ sessionId: 'session123...'
993
+ }
994
+ [MCP-I] ✅ Delegation verification SUCCEEDED {
995
+ tool: 'protectedTool',
996
+ agentDid: 'did:key:zmock123...',
997
+ delegationId: 'test-delegation-id',
998
+ credentialScopes: [ 'files:write' ],
999
+ requiredScopes: [ 'files:write' ]
1000
+ }
1001
+
1002
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > user_identifier validation > should handle missing user_identifier gracefully (backward compatibility)
1003
+ [MCP-I] Checking tool protection: {
1004
+ tool: 'protectedTool',
1005
+ agentDid: 'did:key:zmock123...',
1006
+ hasDelegation: true
1007
+ }
1008
+
1009
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > user_identifier validation > should handle missing user_identifier gracefully (backward compatibility)
1010
+ [MCP-I] 🔐 Verifying delegation token with AccessControlApiService {
1011
+ tool: 'protectedTool',
1012
+ agentDid: 'did:key:zmock123...',
1013
+ hasDelegationToken: true,
1014
+ hasConsentProof: false,
1015
+ requiredScopes: [ 'files:write' ]
1016
+ }
1017
+
1018
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > user_identifier validation > should handle missing user_identifier gracefully (backward compatibility)
1019
+ [MCP-I] ✅ Delegation verification SUCCEEDED {
1020
+ tool: 'protectedTool',
1021
+ agentDid: 'did:key:zmock123...',
1022
+ delegationId: 'test-delegation-id',
1023
+ credentialScopes: [ 'files:write' ],
1024
+ requiredScopes: [ 'files:write' ]
1025
+ }
1026
+
1027
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > user_identifier validation > should handle missing session userDid gracefully
1028
+ [MCP-I] Checking tool protection: {
1029
+ tool: 'protectedTool',
1030
+ stderr | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > user_identifier validation > should handle missing session userDid gracefully
1031
+ [MCP-I] ⚠️ Delegation has user_identifier but session missing userDid {
1032
+ tool: 'protectedTool',
1033
+ agentDid: 'did:key:zmock123...',
1034
+ hasDelegation: true
1035
+ }
1036
+
1037
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > user_identifier validation > should handle missing session userDid gracefully
1038
+ agentDid: 'did:key:zmock123...',
1039
+ delegationUserIdentifier: 'did:key:zUserA123456...',
1040
+ [MCP-I] 🔐 Verifying delegation token with AccessControlApiService {
1041
+ sessionId: 'session123...'
1042
+ tool: 'protectedTool',
1043
+ agentDid: 'did:key:zmock123...',
1044
+ hasDelegationToken: true,
1045
+ hasConsentProof: false,
1046
+ requiredScopes: [ 'files:write' ]
1047
+ }
1048
+ }
1049
+
1050
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > user_identifier validation > should handle missing session userDid gracefully
1051
+ [MCP-I] ✅ Delegation verification SUCCEEDED {
1052
+ tool: 'protectedTool',
1053
+ agentDid: 'did:key:zmock123...',
1054
+ delegationId: 'test-delegation-id',
1055
+ credentialScopes: [ 'files:write' ],
1056
+ requiredScopes: [ 'files:write' ]
1057
+ }
1058
+
1059
+
1060
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should create proof after successful tool execution
1061
+ [MCP-I] Checking tool protection: {
1062
+ tool: 'unprotectedTool',
1063
+ agentDid: 'did:key:zmock123...',
1064
+ hasDelegation: false
1065
+ }
1066
+
1067
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should create proof after successful tool execution
1068
+ [MCP-I] Tool protection check passed (no delegation required) {
1069
+ tool: 'unprotectedTool',
1070
+ agentDid: 'did:key:zmock123...',
1071
+ reason: 'Tool not configured to require delegation'
1072
+ }
1073
+
1074
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should not create proof when tool execution is blocked
1075
+ [MCP-I] Checking tool protection: {
1076
+ tool: 'protectedTool',
1077
+ agentDid: 'did:key:zmock123...',
1078
+ hasDelegation: false
1079
+ }
1080
+
1081
+ stderr | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > processToolCall with tool protection > should not create proof when tool execution is blocked
1082
+ [MCP-I] BLOCKED: Tool requires delegation but none provided {
1083
+ tool: 'protectedTool',
1084
+ requiredScopes: [ 'files:write' ],
1085
+ agentDid: 'did:key:zmock123...',
1086
+ resumeToken: 'resume_r39847_micdi38i',
1087
+ consentUrl: 'https://kya.vouched.id/bouncer/consent?tool=protectedTool&scopes=files%3Awrite&session_id=session123&agent_did=&resume_token=resume_r39847_micdi38i'
1088
+ }
1089
+
1090
+ stderr | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > DelegationRequiredError details > should include tool name in error
1091
+ [MCP-I] BLOCKED: Tool requires delegation but none provided {
1092
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > DelegationRequiredError details > should include tool name in error
1093
+ [MCP-I] Checking tool protection: {
1094
+ tool: 'protectedTool',
1095
+ agentDid: 'did:key:zmock123...',
1096
+ hasDelegation: false
1097
+ }
1098
+ tool: 'protectedTool',
1099
+
1100
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > DelegationRequiredError details > should include required scopes in error
1101
+ [MCP-I] Checking tool protection: {
1102
+ requiredScopes: [ 'files:write' ],
1103
+ agentDid: 'did:key:zmock123...',
1104
+ tool: 'protectedTool',
1105
+ agentDid: 'did:key:zmock123...',
1106
+ hasDelegation: false
1107
+ resumeToken: 'resume_r39852_micdi38i',
1108
+ consentUrl: 'https://kya.vouched.id/bouncer/consent?tool=protectedTool&scopes=files%3Awrite&session_id=session123&agent_did=&resume_token=resume_r39852_micdi38i'
1109
+ }
1110
+ }
1111
+
1112
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > DelegationRequiredError details > should include consent URL in error
1113
+ [MCP-I] Checking tool protection: {
1114
+ tool: 'protectedTool',
1115
+
1116
+ agentDid: 'did:key:zmock123...',
1117
+ stderr | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > DelegationRequiredError details > should include required scopes in error
1118
+ hasDelegation: false
1119
+ }
1120
+
1121
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > DelegationRequiredError details > should include resume token in error
1122
+ [MCP-I] BLOCKED: Tool requires delegation but none provided {
1123
+ tool: 'protectedTool',
1124
+ [MCP-I] Checking tool protection: {
1125
+ tool: 'protectedTool',
1126
+ agentDid: 'did:key:zmock123...',
1127
+ requiredScopes: [ 'files:write', 'files:read' ],
1128
+ hasDelegation: false
1129
+ }
1130
+
1131
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > DelegationRequiredError details > should include intercepted call context in error
1132
+ agentDid: 'did:key:zmock123...',
1133
+ [MCP-I] Checking tool protection: {
1134
+ tool: 'protectedTool',
1135
+ resumeToken: 'resume_r39852_micdi38i',
1136
+ agentDid: 'did:key:zmock123...',
1137
+ hasDelegation: false
1138
+ consentUrl: 'https://kya.vouched.id/bouncer/consent?tool=protectedTool&scopes=files%3Awrite%2Cfiles%3Aread&session_id=session123&agent_did=&resume_token=resume_r39852_micdi38i'
1139
+ }
1140
+ }
1141
+
1142
+
1143
+ stderr | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > DelegationRequiredError details > should include consent URL in error
1144
+ [MCP-I] BLOCKED: Tool requires delegation but none provided {
1145
+ tool: 'protectedTool',
1146
+ requiredScopes: [ 'files:write' ],
1147
+ agentDid: 'did:key:zmock123...',
1148
+ resumeToken: 'resume_r3985x_micdi38j',
1149
+ consentUrl: 'https://kya.vouched.id/bouncer/consent?tool=protectedTool&scopes=files%3Awrite&session_id=session123&agent_did=&resume_token=resume_r3985x_micdi38j'
1150
+ }
1151
+
1152
+ stderr | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > DelegationRequiredError details > should include resume token in error
1153
+ [MCP-I] BLOCKED: Tool requires delegation but none provided {
1154
+ tool: 'protectedTool',
1155
+ requiredScopes: [ 'files:write' ],
1156
+ agentDid: 'did:key:zmock123...',
1157
+ resumeToken: 'resume_r3985x_micdi38j',
1158
+ consentUrl: 'https://kya.vouched.id/bouncer/consent?tool=protectedTool&scopes=files%3Awrite&session_id=session123&agent_did=&resume_token=resume_r3985x_micdi38j'
1159
+ }
1160
+
1161
+ stderr | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > DelegationRequiredError details > should include intercepted call context in error
1162
+ [MCP-I] BLOCKED: Tool requires delegation but none provided {
1163
+ tool: 'protectedTool',
1164
+ requiredScopes: [ 'files:write' ],
1165
+ agentDid: 'did:key:zmock123...',
1166
+ resumeToken: 'resume_rr4mkw_micdi38j',
1167
+ consentUrl: 'https://kya.vouched.id/bouncer/consent?tool=protectedTool&scopes=files%3Awrite&session_id=session123&agent_did=&resume_token=resume_rr4mkw_micdi38j'
1168
+ }
1169
+
1170
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > audit logging > should log tool protection check when audit enabled
1171
+ [MCP-I] Checking tool protection: {
1172
+ tool: 'testTool',
1173
+ agentDid: 'did:key:zmock123...',
1174
+ hasDelegation: false
1175
+ }
1176
+
1177
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > audit logging > should log tool protection check when audit enabled
1178
+ [MCP-I] Tool protection check passed (no delegation required) {
1179
+ tool: 'testTool',
1180
+ agentDid: 'did:key:zmock123...',
1181
+ reason: 'Tool not configured to require delegation'
1182
+ }
1183
+
1184
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > audit logging > should log blocked tool call when audit enabled
1185
+ [MCP-I] Checking tool protection: {
1186
+ tool: 'protectedTool',
1187
+ agentDid: 'did:key:zmock123...',
1188
+ hasDelegation: false
1189
+ }
1190
+
1191
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > tool protection service integration > should use agent DID from identity for protection check
1192
+ [MCP-I] Checking tool protection: {
1193
+ tool: 'testTool',
1194
+ agentDid: 'did:key:zmock123...',
1195
+ hasDelegation: false
1196
+ }
1197
+
1198
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > tool protection service integration > should use agent DID from identity for protection check
1199
+ [MCP-I] Tool protection check passed (no delegation required) {
1200
+ tool: 'testTool',
1201
+ agentDid: 'did:key:zmock123...',
1202
+ reason: 'Tool not configured to require delegation'
1203
+ }
1204
+
1205
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > tool protection service integration > should handle tool protection service errors gracefully
1206
+ [MCP-I] Checking tool protection: {
1207
+ tool: 'testTool',
1208
+ agentDid: 'did:key:zmock123...',
1209
+ hasDelegation: false
1210
+ }
1211
+
1212
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > edge cases > should handle empty required scopes array
1213
+ [MCP-I] Checking tool protection: {
1214
+ tool: 'protectedTool',
1215
+ agentDid: 'did:key:zmock123...',
1216
+ hasDelegation: false
1217
+ }
1218
+
1219
+ stderr | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > edge cases > should handle empty required scopes array
1220
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > edge cases > should handle multiple required scopes
1221
+ [MCP-I] Checking tool protection: {
1222
+ tool: 'protectedTool',
1223
+ agentDid: 'did:key:zmock123...',
1224
+ hasDelegation: false
1225
+ }
1226
+
1227
+ [MCP-I] BLOCKED: Tool requires delegation but none provided {
1228
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > edge cases > should handle session without id
1229
+ [MCP-I] Checking tool protection: {
1230
+ tool: 'protectedTool',
1231
+ agentDid: 'did:key:zmock123...',
1232
+ tool: 'protectedTool',
1233
+ hasDelegation: false
1234
+ }
1235
+ requiredScopes: [],
1236
+
1237
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > edge cases > should handle handler errors independently of protection
1238
+ [MCP-I] Checking tool protection: {
1239
+ tool: 'errorTool',
1240
+ agentDid: 'did:key:zmock123...',
1241
+ resumeToken: 'resume_r3987n_micdi38l',
1242
+ agentDid: 'did:key:zmock123...',
1243
+ hasDelegation: false
1244
+ }
1245
+
1246
+ consentUrl: 'https://kya.vouched.id/bouncer/consent?tool=protectedTool&scopes=&session_id=session123&agent_did=&resume_token=resume_r3987n_micdi38l'
1247
+ stdout | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > edge cases > should handle handler errors independently of protection
1248
+ }
1249
+ [MCP-I] Tool protection check passed (no delegation required) {
1250
+
1251
+ stderr | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > edge cases > should handle multiple required scopes
1252
+ tool: 'errorTool',
1253
+ agentDid: 'did:key:zmock123...',
1254
+ reason: 'Tool not configured to require delegation'
1255
+ }
1256
+
1257
+ [MCP-I] BLOCKED: Tool requires delegation but none provided {
1258
+ tool: 'protectedTool',
1259
+ requiredScopes: [ 'scope1', 'scope2', 'scope3' ],
1260
+ agentDid: 'did:key:zmock123...',
1261
+ resumeToken: 'resume_r3987n_micdi38l',
1262
+ consentUrl: 'https://kya.vouched.id/bouncer/consent?tool=protectedTool&scopes=scope1%2Cscope2%2Cscope3&session_id=session123&agent_did=&resume_token=resume_r3987n_micdi38l'
1263
+ }
1264
+
1265
+ stderr | src/__tests__/runtime/tool-protection-enforcement.test.ts > MCPIRuntimeBase - Tool Protection Enforcement > edge cases > should handle session without id
1266
+ [MCP-I] BLOCKED: Tool requires delegation but none provided {
1267
+ tool: 'protectedTool',
1268
+ requiredScopes: [ 'files:write' ],
1269
+ agentDid: 'did:key:zmock123...',
1270
+ resumeToken: 'resume_uvstbw_micdi38m',
1271
+ consentUrl: 'https://kya.vouched.id/bouncer/consent?tool=protectedTool&scopes=files%3Awrite&session_id=&agent_did=&resume_token=resume_uvstbw_micdi38m'
1272
+ }
1273
+
1274
+ ✓ src/services/__tests__/access-control.service.test.ts (23 tests) 38ms
1275
+ ✓ src/__tests__/runtime/tool-protection-enforcement.test.ts (29 tests) 18ms
1276
+ stderr | src/services/__tests__/access-control.integration.test.ts > AccessControlApiService Integration > Proof Submission Flow > should submit proof end-to-end
1277
+ [AccessControl] 🔍 RAW API RESPONSE (before parsing): {
1278
+ correlationId: '85227e71-ef3c-4d9a-869c-5a66149db4fe',
1279
+ status: 200,
1280
+ statusText: '',
1281
+ headers: { 'content-type': 'application/json' },
1282
+ responseTextLength: 100,
1283
+ responseTextPreview: '{"success":true,"accepted":1,"rejected":0,"outcomes":{"success":1,"failed":0,"blocked":0,"error":0}}',
1284
+ fullResponseText: '{"success":true,"accepted":1,"rejected":0,"outcomes":{"success":1,"failed":0,"blocked":0,"error":0}}'
1285
+ }
1286
+ [AccessControl] 🔍 PARSED RESPONSE DATA: {
1287
+ correlationId: '85227e71-ef3c-4d9a-869c-5a66149db4fe',
1288
+ status: 200,
1289
+ responseDataType: 'object',
1290
+ responseDataKeys: [ 'success', 'accepted', 'rejected', 'outcomes' ],
1291
+ responseData: '{\n' +
1292
+ ' "success": true,\n' +
1293
+ ' "accepted": 1,\n' +
1294
+ ' "rejected": 0,\n' +
1295
+ ' "outcomes": {\n' +
1296
+ ' "success": 1,\n' +
1297
+ ' "failed": 0,\n' +
1298
+ ' "blocked": 0,\n' +
1299
+ ' "error": 0\n' +
1300
+ ' }\n' +
1301
+ '}'
1302
+ }
1303
+ [AccessControl] Raw response received: {
1304
+ "success": true,
1305
+ "accepted": 1,
1306
+ "rejected": 0,
1307
+ "outcomes": {
1308
+ "success": 1,
1309
+ "failed": 0,
1310
+ "blocked": 0,
1311
+ "error": 0
1312
+ }
1313
+ }
1314
+
1315
+ stderr | src/services/__tests__/access-control.integration.test.ts > AccessControlApiService Integration > Proof Submission Flow > should handle proof submission with errors
1316
+ [AccessControl] 🔍 RAW API RESPONSE (before parsing): {
1317
+ correlationId: '2d427ecb-2a15-49ef-bf3d-23a948a45f74',
1318
+ status: 200,
1319
+ statusText: '',
1320
+ headers: { 'content-type': 'application/json' },
1321
+ responseTextLength: 200,
1322
+ responseTextPreview: '{"success":true,"accepted":0,"rejected":1,"outcomes":{"success":0,"failed":1,"blocked":0,"error":0},"errors":[{"proof_index":0,"error":{"code":"invalid_signature","message":"Invalid JWS signature"}}]}',
1323
+ fullResponseText: '{"success":true,"accepted":0,"rejected":1,"outcomes":{"success":0,"failed":1,"blocked":0,"error":0},"errors":[{"proof_index":0,"error":{"code":"invalid_signature","message":"Invalid JWS signature"}}]}'
1324
+ }
1325
+ [AccessControl] 🔍 PARSED RESPONSE DATA: {
1326
+ correlationId: '2d427ecb-2a15-49ef-bf3d-23a948a45f74',
1327
+ status: 200,
1328
+ responseDataType: 'object',
1329
+ responseDataKeys: [ 'success', 'accepted', 'rejected', 'outcomes', 'errors' ],
1330
+ responseData: '{\n' +
1331
+ ' "success": true,\n' +
1332
+ ' "accepted": 0,\n' +
1333
+ ' "rejected": 1,\n' +
1334
+ ' "outcomes": {\n' +
1335
+ ' "success": 0,\n' +
1336
+ ' "failed": 1,\n' +
1337
+ ' "blocked": 0,\n' +
1338
+ ' "error": 0\n' +
1339
+ ' },\n' +
1340
+ ' "errors": [\n' +
1341
+ ' {\n' +
1342
+ ' "proof_index": 0,\n' +
1343
+ ' "error": {\n' +
1344
+ ' "code": "invalid_signature",\n' +
1345
+ ' "message": "Invalid JWS signature"\n' +
1346
+ ' }\n' +
1347
+ ' }\n' +
1348
+ ' ]\n' +
1349
+ '}'
1350
+ }
1351
+ [AccessControl] Raw response received: {
1352
+ "success": true,
1353
+ "accepted": 0,
1354
+ "rejected": 1,
1355
+ "outcomes": {
1356
+ "success": 0,
1357
+ "failed": 1,
1358
+ "blocked": 0,
1359
+ "error": 0
1360
+ },
1361
+ "errors": [
1362
+ {
1363
+ "proof_index": 0,
1364
+ "error": {
1365
+ "code": "invalid_signature",
1366
+ "message": "Invalid JWS signature"
1367
+ }
1368
+ }
1369
+ ]
1370
+ }
1371
+
1372
+ stderr | src/services/__tests__/access-control.integration.test.ts > AccessControlApiService Integration > Proof Verification Flow > should verify proof using ProofVerifier
1373
+ [CryptoService] Key ID mismatch
1374
+
1375
+ ✓ src/__tests__/runtime/route-interception.test.ts (21 tests) 29ms
1376
+ stderr | src/services/__tests__/proof-verifier.integration.test.ts > ProofVerifier Integration - Real DID Resolution > did:web Resolution (HTTP) > should handle HTTP errors gracefully
1377
+ [ProofVerifier] Failed to fetch public key from DID: Error: Failed to resolve did:web:nonexistent-domain-that-does-not-exist-12345.com: fetch failed
1378
+ at Object.resolveDID (/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/__tests__/proof-verifier.integration.test.ts:143:19)
1379
+ at processTicksAndRejections (node:internal/process/task_queues:103:5)
1380
+ at ProofVerifier.fetchPublicKeyFromDID (/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/proof-verifier.ts:348:22)
1381
+ at /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/__tests__/proof-verifier.integration.test.ts:252:7
1382
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:753:20
1383
+
1384
+ stderr | src/services/__tests__/proof-verifier.integration.test.ts > ProofVerifier Integration - Real DID Resolution > did:web Resolution (HTTP) > should handle HTTP errors gracefully
1385
+ [ProofVerifier] Failed to fetch public key from DID: Error: Failed to resolve did:web:nonexistent-domain-that-does-not-exist-12345.com: fetch failed
1386
+ at Object.resolveDID (/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/__tests__/proof-verifier.integration.test.ts:143:19)
1387
+ at processTicksAndRejections (node:internal/process/task_queues:103:5)
1388
+ at ProofVerifier.fetchPublicKeyFromDID (/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/proof-verifier.ts:348:22)
1389
+ at /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/__tests__/proof-verifier.integration.test.ts:257:9
1390
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:753:20
1391
+
1392
+ ✓ src/delegation/__tests__/vc-issuer.test.ts (21 tests) 138ms
1393
+ ✓ src/__tests__/cache/tool-protection-cache.test.ts (49 tests) 169ms
1394
+ ✓ src/services/__tests__/proof-verifier.integration.test.ts (13 tests | 1 skipped) 51ms
1395
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > getToolProtectionConfig > API fetch - new endpoint format > should fetch from project-scoped endpoint when projectId is available
1396
+ [ToolProtectionService] Config loaded from API {
1397
+ source: 'api',
1398
+ toolCount: 2,
1399
+ protectedTools: [ 'checkout' ],
1400
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1401
+ projectId: 'test-project-123',
1402
+ cacheTtlMs: 300000,
1403
+ cacheExpiresAt: '2025-11-23T23:57:45.408Z'
1404
+ }
1405
+
1406
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > getToolProtectionConfig > API fetch - new endpoint format > should handle new endpoint format with toolProtections object
1407
+ [ToolProtectionService] Config loaded from API {
1408
+ source: 'api',
1409
+ toolCount: 2,
1410
+ protectedTools: [ 'protected_tool' ],
1411
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1412
+ projectId: 'test-project-123',
1413
+ cacheTtlMs: 300000,
1414
+ cacheExpiresAt: '2025-11-23T23:57:45.410Z'
1415
+ }
1416
+
1417
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > getToolProtectionConfig > API fetch - new endpoint format > should parse oauthProvider from new endpoint format (Phase 2)
1418
+ [ToolProtectionService] Config loaded from API {
1419
+ source: 'api',
1420
+ toolCount: 2,
1421
+ protectedTools: [ 'read_repos', 'send_email' ],
1422
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1423
+ projectId: 'test-project-123',
1424
+ cacheTtlMs: 300000,
1425
+ cacheExpiresAt: '2025-11-23T23:57:45.410Z'
1426
+ }
1427
+
1428
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > getToolProtectionConfig > API fetch - new endpoint format > should preserve oauthProvider through cache operations
1429
+ [ToolProtectionService] Config loaded from API {
1430
+ source: 'api',
1431
+ toolCount: 1,
1432
+ protectedTools: [ 'read_repos' ],
1433
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1434
+ projectId: 'test-project-123',
1435
+ cacheTtlMs: 300000,
1436
+ cacheExpiresAt: '2025-11-23T23:57:45.411Z'
1437
+ }
1438
+
1439
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > getToolProtectionConfig > API fetch - old endpoint format > should fetch from agent-scoped endpoint when projectId is not available
1440
+ [ToolProtectionService] Config loaded from API {
1441
+ source: 'api',
1442
+ toolCount: 2,
1443
+ protectedTools: [ 'checkout' ],
1444
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1445
+ projectId: 'none',
1446
+ cacheTtlMs: 300000,
1447
+ cacheExpiresAt: '2025-11-23T23:57:45.411Z'
1448
+ }
1449
+
1450
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > getToolProtectionConfig > API fetch - old endpoint format > should handle old endpoint format with tools array
1451
+ [ToolProtectionService] Config loaded from API {
1452
+ source: 'api',
1453
+ toolCount: 2,
1454
+ protectedTools: [ 'tool1' ],
1455
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1456
+ projectId: 'none',
1457
+ cacheTtlMs: 300000,
1458
+ cacheExpiresAt: '2025-11-23T23:57:45.411Z'
1459
+ }
1460
+
1461
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > getToolProtectionConfig > API fetch - old endpoint format > should parse oauthProvider from old endpoint format (tools array)
1462
+ [ToolProtectionService] Config loaded from API {
1463
+ source: 'api',
1464
+ toolCount: 2,
1465
+ protectedTools: [ 'read_repos', 'send_email' ],
1466
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1467
+ projectId: 'none',
1468
+ cacheTtlMs: 300000,
1469
+ cacheExpiresAt: '2025-11-23T23:57:45.411Z'
1470
+ }
1471
+
1472
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > getToolProtectionConfig > API fetch - old endpoint format > should handle old endpoint format with tools object
1473
+ [ToolProtectionService] Config loaded from API {
1474
+ source: 'api',
1475
+ toolCount: 2,
1476
+ protectedTools: [ 'tool1' ],
1477
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1478
+ projectId: 'none',
1479
+ cacheTtlMs: 300000,
1480
+ cacheExpiresAt: '2025-11-23T23:57:45.411Z'
1481
+ }
1482
+
1483
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > getToolProtectionConfig > API fetch - old endpoint format > should parse oauthProvider from old endpoint format (tools object)
1484
+ [ToolProtectionService] Config loaded from API {
1485
+ source: 'api',
1486
+ toolCount: 2,
1487
+ protectedTools: [ 'read_repos', 'send_email' ],
1488
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1489
+ projectId: 'none',
1490
+ cacheTtlMs: 300000,
1491
+ cacheExpiresAt: '2025-11-23T23:57:45.411Z'
1492
+ }
1493
+
1494
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > getToolProtectionConfig > API fetch - old endpoint format > should skip tools without name in array format
1495
+ [ToolProtectionService] Cache miss, fetching from API {
1496
+ source: 'api-fetch-start',
1497
+ cacheKey: 'agent:did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK',
1498
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1499
+ projectId: 'none',
1500
+ apiUrl: 'https://kya.vouched.id',
1501
+ endpoint: '/api/v1/bouncer/config?agent_did=did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK'
1502
+ }
1503
+ [ToolProtectionService] Fetching from API: https://kya.vouched.id/api/v1/bouncer/config?agent_did=did%3Akey%3Az6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK {
1504
+ method: 'config?agent_did (old)',
1505
+ projectId: 'none',
1506
+ apiKeyPresent: true,
1507
+ apiKeyLength: 18,
1508
+ apiKeyMasked: 'test-api...'
1509
+ }
1510
+
1511
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > getToolProtectionConfig > API fetch - old endpoint format > should skip tools without name in array format
1512
+ [ToolProtectionService] API response received {
1513
+ source: 'api-fetch-complete',
1514
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1515
+ projectId: 'none',
1516
+ responseKeys: [ 'success', 'data', 'metadata' ],
1517
+ dataKeys: [ 'tools' ],
1518
+ rawToolProtections: null,
1519
+ rawTools: [
1520
+ { name: 'valid_tool', requiresDelegation: true },
1521
+ { requiresDelegation: false }
1522
+ ],
1523
+ responseMetadata: {}
1524
+ }
1525
+
1526
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > getToolProtectionConfig > API fetch - old endpoint format > should skip tools without name in array format
1527
+ [ToolProtectionService] Config loaded from API {
1528
+ source: 'api',
1529
+ toolCount: 1,
1530
+ protectedTools: [ 'valid_tool' ],
1531
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1532
+ projectId: 'none',
1533
+ cacheTtlMs: 300000,
1534
+ cacheExpiresAt: '2025-11-23T23:57:45.412Z'
1535
+ }
1536
+ [ToolProtectionService] API fetch successful, config cached {
1537
+ source: 'cache-write',
1538
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1539
+ cacheKey: 'agent:did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK',
1540
+ toolCount: 1,
1541
+ tools: [ { name: 'valid_tool', requiresDelegation: true, scopeCount: 0 } ],
1542
+ ttlMs: 300000,
1543
+ ttlMinutes: 5,
1544
+ expiresAt: '2025-11-23T23:57:45.412Z',
1545
+ expiresIn: '300s'
1546
+ }
1547
+
1548
+ stderr | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > getToolProtectionConfig > API fetch error handling > should handle network errors gracefully
1549
+ [ToolProtectionService] API fetch failed, no fallback, failing closed (deny-all) {
1550
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1551
+ error: 'ECONNREFUSED',
1552
+ cacheKey: 'agent:did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK'
1553
+ }
1554
+
1555
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > getToolProtectionConfig > caching behavior > should cache successful API responses
1556
+ [ToolProtectionService] Config loaded from API {
1557
+ source: 'api',
1558
+ toolCount: 1,
1559
+ protectedTools: [ 'tool1' ],
1560
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1561
+ projectId: 'none',
1562
+ cacheTtlMs: 300000,
1563
+ cacheExpiresAt: '2025-11-23T23:57:45.415Z'
1564
+ }
1565
+
1566
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > getToolProtectionConfig > caching behavior > should use default cache TTL when not specified
1567
+ [ToolProtectionService] Config loaded from API {
1568
+ source: 'api',
1569
+ toolCount: 0,
1570
+ protectedTools: [],
1571
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1572
+ projectId: 'none',
1573
+ cacheTtlMs: 300000,
1574
+ cacheExpiresAt: '2025-11-23T23:57:45.415Z'
1575
+ }
1576
+
1577
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > getToolProtectionConfig > caching behavior > should use custom cache TTL when specified
1578
+ [ToolProtectionService] Config loaded from API {
1579
+ source: 'api',
1580
+ toolCount: 0,
1581
+ protectedTools: [],
1582
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1583
+ projectId: 'none',
1584
+ cacheTtlMs: 600000,
1585
+ cacheExpiresAt: '2025-11-24T00:02:45.415Z'
1586
+ }
1587
+
1588
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > getToolProtectionConfig > edge cases > should handle empty toolProtections object
1589
+ [ToolProtectionService] Config loaded from API {
1590
+ source: 'api',
1591
+ toolCount: 0,
1592
+ protectedTools: [],
1593
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1594
+ projectId: 'none',
1595
+ cacheTtlMs: 300000,
1596
+ cacheExpiresAt: '2025-11-23T23:57:45.415Z'
1597
+ }
1598
+
1599
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > getToolProtectionConfig > edge cases > should handle null requiredScopes
1600
+ [ToolProtectionService] Config loaded from API {
1601
+ source: 'api',
1602
+ toolCount: 1,
1603
+ protectedTools: [ 'tool1' ],
1604
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1605
+ projectId: 'none',
1606
+ cacheTtlMs: 300000,
1607
+ cacheExpiresAt: '2025-11-23T23:57:45.415Z'
1608
+ }
1609
+
1610
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > getToolProtectionConfig > edge cases > should handle mixed camelCase and snake_case in response
1611
+ [ToolProtectionService] Config loaded from API {
1612
+ source: 'api',
1613
+ toolCount: 2,
1614
+ protectedTools: [ 'tool1' ],
1615
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1616
+ projectId: 'none',
1617
+ cacheTtlMs: 300000,
1618
+ cacheExpiresAt: '2025-11-23T23:57:45.416Z'
1619
+ }
1620
+
1621
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > checkToolProtection > should return null when tool has no protection
1622
+ [ToolProtectionService] Config loaded from API {
1623
+ source: 'api',
1624
+ toolCount: 1,
1625
+ protectedTools: [],
1626
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1627
+ projectId: 'none',
1628
+ cacheTtlMs: 300000,
1629
+ cacheExpiresAt: '2025-11-23T23:57:45.416Z'
1630
+ }
1631
+
1632
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > checkToolProtection > should return null when tool is not in config
1633
+ [ToolProtectionService] Config loaded from API {
1634
+ source: 'api',
1635
+ toolCount: 1,
1636
+ protectedTools: [ 'other_tool' ],
1637
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1638
+ projectId: 'none',
1639
+ cacheTtlMs: 300000,
1640
+ cacheExpiresAt: '2025-11-23T23:57:45.416Z'
1641
+ }
1642
+
1643
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > checkToolProtection > should return null when tool is not in config
1644
+ [ToolProtectionService] Protection check {
1645
+ tool: 'unknown_tool',
1646
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1647
+ found: false,
1648
+ isWildcard: true,
1649
+ requiresDelegation: false,
1650
+ availableTools: [ 'other_tool' ]
1651
+ }
1652
+
1653
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > checkToolProtection > should return wildcard protection when tool not found and wildcard exists
1654
+ [ToolProtectionService] Config loaded from API {
1655
+ source: 'api',
1656
+ toolCount: 2,
1657
+ protectedTools: [ '*' ],
1658
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1659
+ projectId: 'none',
1660
+ cacheTtlMs: 300000,
1661
+ cacheExpiresAt: '2025-11-23T23:57:45.417Z'
1662
+ }
1663
+
1664
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > checkToolProtection > should return wildcard protection when tool not found and wildcard exists
1665
+ [ToolProtectionService] Protection check {
1666
+ tool: 'unknown_tool',
1667
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1668
+ found: true,
1669
+ stderr | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > checkToolProtection > should use wildcard protection in fail-safe deny-all mode
1670
+ isWildcard: true,
1671
+ requiresDelegation: true,
1672
+ [ToolProtectionService] API fetch failed, no fallback, failing closed (deny-all) {
1673
+ availableTools: [ '*', 'specific_tool' ]
1674
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1675
+ }
1676
+
1677
+ error: 'Network error',
1678
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > checkToolProtection > should prioritize specific tool protection over wildcard
1679
+ [ToolProtectionService] Config loaded from API {
1680
+ source: 'api',
1681
+ cacheKey: 'agent:did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK'
1682
+ toolCount: 2,
1683
+ }
1684
+ protectedTools: [ '*' ],
1685
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1686
+ projectId: 'none',
1687
+
1688
+ cacheTtlMs: 300000,
1689
+ cacheExpiresAt: '2025-11-23T23:57:45.417Z'
1690
+ }
1691
+
1692
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > checkToolProtection > should use wildcard protection in fail-safe deny-all mode
1693
+ [ToolProtectionService] Protection check {
1694
+ tool: 'any_tool',
1695
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1696
+ found: true,
1697
+ isWildcard: true,
1698
+ requiresDelegation: true,
1699
+ availableTools: [ '*' ]
1700
+ }
1701
+
1702
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > checkToolProtection > should return protection config when tool requires delegation
1703
+ [ToolProtectionService] Config loaded from API {
1704
+ source: 'api',
1705
+ toolCount: 1,
1706
+ protectedTools: [ 'protected_tool' ],
1707
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1708
+ projectId: 'none',
1709
+ cacheTtlMs: 300000,
1710
+ cacheExpiresAt: '2025-11-23T23:57:45.423Z'
1711
+ }
1712
+
1713
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > checkToolProtection > should return protection config when tool requires delegation
1714
+ [ToolProtectionService] Protection check {
1715
+ tool: 'protected_tool',
1716
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1717
+ found: true,
1718
+ isWildcard: false,
1719
+ requiresDelegation: true,
1720
+ availableTools: [ 'protected_tool' ]
1721
+ }
1722
+
1723
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > integration with NoOpToolProtectionCache > should work with NoOpToolProtectionCache
1724
+ [ToolProtectionService] Config loaded from API {
1725
+ source: 'api',
1726
+ toolCount: 1,
1727
+ protectedTools: [ 'tool1' ],
1728
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1729
+ projectId: 'none',
1730
+ cacheTtlMs: 300000,
1731
+ cacheExpiresAt: '2025-11-23T23:57:45.424Z'
1732
+ }
1733
+
1734
+ stdout | src/__tests__/services/tool-protection.service.test.ts > ToolProtectionService > integration with NoOpToolProtectionCache > should work with NoOpToolProtectionCache
1735
+ [ToolProtectionService] Config loaded from API {
1736
+ source: 'api',
1737
+ toolCount: 1,
1738
+ protectedTools: [ 'tool1' ],
1739
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1740
+ projectId: 'none',
1741
+ cacheTtlMs: 300000,
1742
+ cacheExpiresAt: '2025-11-23T23:57:45.424Z'
1743
+ }
1744
+
1745
+ ✓ src/services/__tests__/access-control.integration.test.ts (9 tests) 127ms
1746
+ stdout | src/__tests__/services/tool-protection-oauth-provider.test.ts > ToolProtectionService - oauthProvider Parsing > New endpoint format (toolProtections object) > should parse oauthProvider from camelCase field
1747
+ [ToolProtectionService] Config loaded from API {
1748
+ source: 'api',
1749
+ toolCount: 2,
1750
+ protectedTools: [ 'read_repos', 'send_email' ],
1751
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1752
+ projectId: 'test-project-123',
1753
+ cacheTtlMs: 300000,
1754
+ cacheExpiresAt: '2025-11-23T23:57:45.450Z'
1755
+ }
1756
+
1757
+ stdout | src/__tests__/services/tool-protection-oauth-provider.test.ts > ToolProtectionService - oauthProvider Parsing > New endpoint format (toolProtections object) > should parse oauthProvider from snake_case field
1758
+ [ToolProtectionService] Config loaded from API {
1759
+ source: 'api',
1760
+ toolCount: 1,
1761
+ protectedTools: [ 'read_repos' ],
1762
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1763
+ projectId: 'test-project-123',
1764
+ cacheTtlMs: 300000,
1765
+ cacheExpiresAt: '2025-11-23T23:57:45.452Z'
1766
+ }
1767
+
1768
+ stdout | src/__tests__/services/tool-protection-oauth-provider.test.ts > ToolProtectionService - oauthProvider Parsing > New endpoint format (toolProtections object) > should prefer camelCase over snake_case when both present
1769
+ [ToolProtectionService] Config loaded from API {
1770
+ source: 'api',
1771
+ toolCount: 1,
1772
+ protectedTools: [ 'read_repos' ],
1773
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1774
+ projectId: 'test-project-123',
1775
+ cacheTtlMs: 300000,
1776
+ cacheExpiresAt: '2025-11-23T23:57:45.452Z'
1777
+ }
1778
+
1779
+ stdout | src/__tests__/services/tool-protection-oauth-provider.test.ts > ToolProtectionService - oauthProvider Parsing > New endpoint format (toolProtections object) > should handle missing oauthProvider field (backward compatible)
1780
+ [ToolProtectionService] Config loaded from API {
1781
+ source: 'api',
1782
+ toolCount: 1,
1783
+ protectedTools: [ 'read_repos' ],
1784
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1785
+ projectId: 'test-project-123',
1786
+ cacheTtlMs: 300000,
1787
+ cacheExpiresAt: '2025-11-23T23:57:45.453Z'
1788
+ }
1789
+
1790
+ stdout | src/__tests__/services/tool-protection-oauth-provider.test.ts > ToolProtectionService - oauthProvider Parsing > Old endpoint format (tools array) > should parse oauthProvider from array format with camelCase
1791
+ [ToolProtectionService] Config loaded from API {
1792
+ source: 'api',
1793
+ toolCount: 2,
1794
+ protectedTools: [ 'read_repos', 'send_email' ],
1795
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1796
+ projectId: 'none',
1797
+ cacheTtlMs: 300000,
1798
+ cacheExpiresAt: '2025-11-23T23:57:45.453Z'
1799
+ }
1800
+
1801
+ stdout | src/__tests__/services/tool-protection-oauth-provider.test.ts > ToolProtectionService - oauthProvider Parsing > Old endpoint format (tools array) > should parse oauthProvider from array format with snake_case
1802
+ [ToolProtectionService] Config loaded from API {
1803
+ source: 'api',
1804
+ toolCount: 1,
1805
+ protectedTools: [ 'read_repos' ],
1806
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1807
+ projectId: 'none',
1808
+ cacheTtlMs: 300000,
1809
+ cacheExpiresAt: '2025-11-23T23:57:45.453Z'
1810
+ }
1811
+
1812
+ stdout | src/__tests__/services/tool-protection-oauth-provider.test.ts > ToolProtectionService - oauthProvider Parsing > Old endpoint format (tools array) > should prefer camelCase over snake_case in array format
1813
+ [ToolProtectionService] Config loaded from API {
1814
+ source: 'api',
1815
+ toolCount: 1,
1816
+ protectedTools: [ 'read_repos' ],
1817
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1818
+ projectId: 'none',
1819
+ cacheTtlMs: 300000,
1820
+ cacheExpiresAt: '2025-11-23T23:57:45.453Z'
1821
+ }
1822
+
1823
+ stdout | src/__tests__/services/tool-protection-oauth-provider.test.ts > ToolProtectionService - oauthProvider Parsing > Old endpoint format (tools object) > should parse oauthProvider from object format with camelCase
1824
+ [ToolProtectionService] Config loaded from API {
1825
+ source: 'api',
1826
+ toolCount: 2,
1827
+ protectedTools: [ 'read_repos', 'send_email' ],
1828
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1829
+ projectId: 'none',
1830
+ cacheTtlMs: 300000,
1831
+ cacheExpiresAt: '2025-11-23T23:57:45.454Z'
1832
+ }
1833
+
1834
+ stdout | src/__tests__/services/tool-protection-oauth-provider.test.ts > ToolProtectionService - oauthProvider Parsing > Old endpoint format (tools object) > should parse oauthProvider from object format with snake_case
1835
+ [ToolProtectionService] Config loaded from API {
1836
+ source: 'api',
1837
+ toolCount: 1,
1838
+ protectedTools: [ 'read_repos' ],
1839
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1840
+ projectId: 'none',
1841
+ cacheTtlMs: 300000,
1842
+ cacheExpiresAt: '2025-11-23T23:57:45.454Z'
1843
+ }
1844
+
1845
+ stdout | src/__tests__/services/tool-protection-oauth-provider.test.ts > ToolProtectionService - oauthProvider Parsing > Old endpoint format (tools object) > should prefer camelCase over snake_case in object format
1846
+ [ToolProtectionService] Config loaded from API {
1847
+ source: 'api',
1848
+ toolCount: 1,
1849
+ protectedTools: [ 'read_repos' ],
1850
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1851
+ projectId: 'none',
1852
+ cacheTtlMs: 300000,
1853
+ cacheExpiresAt: '2025-11-23T23:57:45.454Z'
1854
+ }
1855
+
1856
+ stdout | src/__tests__/services/tool-protection-oauth-provider.test.ts > ToolProtectionService - oauthProvider Parsing > Caching > should cache oauthProvider field correctly
1857
+ [ToolProtectionService] Config loaded from API {
1858
+ source: 'api',
1859
+ toolCount: 1,
1860
+ protectedTools: [ 'read_repos' ],
1861
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1862
+ projectId: 'test-project-123',
1863
+ cacheTtlMs: 300000,
1864
+ cacheExpiresAt: '2025-11-23T23:57:45.454Z'
1865
+ }
1866
+
1867
+ stdout | src/__tests__/services/tool-protection-oauth-provider.test.ts > ToolProtectionService - oauthProvider Parsing > oauthProvider field inclusion > should include oauthProvider in returned ToolProtection objects when present
1868
+ [ToolProtectionService] Config loaded from API {
1869
+ source: 'api',
1870
+ toolCount: 2,
1871
+ protectedTools: [ 'tool_with_provider', 'tool_without_provider' ],
1872
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1873
+ projectId: 'test-project-123',
1874
+ cacheTtlMs: 300000,
1875
+ cacheExpiresAt: '2025-11-23T23:57:45.454Z'
1876
+ }
1877
+
1878
+ stdout | src/__tests__/services/tool-protection-oauth-provider.test.ts > ToolProtectionService - oauthProvider Parsing > oauthProvider field inclusion > should handle empty string oauthProvider gracefully
1879
+ [ToolProtectionService] Config loaded from API {
1880
+ source: 'api',
1881
+ toolCount: 1,
1882
+ protectedTools: [ 'tool_with_empty_provider' ],
1883
+ agentDid: 'did:key:z6MkhaXgBZDv...',
1884
+ projectId: 'test-project-123',
1885
+ cacheTtlMs: 300000,
1886
+ cacheExpiresAt: '2025-11-23T23:57:45.454Z'
1887
+ }
1888
+
1889
+ ✓ src/__tests__/services/tool-protection.service.test.ts (49 tests) 26ms
1890
+ ✓ src/__tests__/services/tool-protection-oauth-provider.test.ts (14 tests) 6ms
1891
+ stderr | src/services/__tests__/crypto.service.test.ts > CryptoService > verifyEd25519 > should return false on verification error
1892
+ [CryptoService] Ed25519 verification error: Error: Verification failed
1893
+ at /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/__tests__/crypto.service.test.ts:62:9
1894
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:157:11
1895
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:753:26
1896
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1636:20
1897
+ at new Promise (<anonymous>)
1898
+ at runWithTimeout (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1602:10)
1899
+ at runTest (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1309:12)
1900
+ at processTicksAndRejections (node:internal/process/task_queues:103:5)
1901
+ at runSuite (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1468:8)
1902
+ at runSuite (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1468:8)
1903
+
1904
+ stderr | src/services/__tests__/crypto.service.test.ts > CryptoService > verifyJWS > should reject invalid JWK format
1905
+ [CryptoService] Invalid Ed25519 JWK format
1906
+
1907
+ stderr | src/services/__tests__/crypto.service.test.ts > CryptoService > verifyJWS > should reject JWK with wrong kty
1908
+ [CryptoService] Invalid Ed25519 JWK format
1909
+
1910
+ stderr | src/services/__tests__/crypto.service.test.ts > CryptoService > verifyJWS > should reject JWK with wrong crv
1911
+ [CryptoService] Invalid Ed25519 JWK format
1912
+
1913
+ stderr | src/services/__tests__/crypto.service.test.ts > CryptoService > verifyJWS > should reject JWK with missing x field
1914
+ [CryptoService] Invalid Ed25519 JWK format
1915
+
1916
+ stderr | src/services/__tests__/crypto.service.test.ts > CryptoService > verifyJWS > should reject JWK with empty x field
1917
+ [CryptoService] Invalid Ed25519 JWK format
1918
+
1919
+ stderr | src/services/__tests__/crypto.service.test.ts > CryptoService > verifyJWS > should reject malformed JWS
1920
+ [CryptoService] Invalid JWS format: Error: Invalid header base64: Unexpected token 'ž', "ž‹" is not valid JSON
1921
+ at CryptoService.parseJWS (/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/crypto.service.ts:91:13)
1922
+ at CryptoService.verifyJWS (/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/crypto.service.ts:169:23)
1923
+ at /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/__tests__/crypto.service.test.ts:230:42
1924
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:157:11
1925
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:753:26
1926
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1636:20
1927
+ at new Promise (<anonymous>)
1928
+ at runWithTimeout (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1602:10)
1929
+ at runTest (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1309:12)
1930
+ at processTicksAndRejections (node:internal/process/task_queues:103:5)
1931
+
1932
+ stderr | src/services/__tests__/crypto.service.test.ts > CryptoService > verifyJWS > should reject non-EdDSA algorithms
1933
+ [CryptoService] Unsupported algorithm: RS256, expected EdDSA
1934
+
1935
+ stderr | src/services/__tests__/crypto.service.test.ts > CryptoService > verifyJWS > should reject HS256 algorithm
1936
+ [CryptoService] Unsupported algorithm: HS256, expected EdDSA
1937
+
1938
+ stderr | src/services/__tests__/crypto.service.test.ts > CryptoService > verifyJWS > should handle empty JWS components
1939
+ [CryptoService] Invalid JWS format: Error: Invalid header base64: Unexpected end of JSON input
1940
+ at CryptoService.parseJWS (/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/crypto.service.ts:91:13)
1941
+ at CryptoService.verifyJWS (/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/crypto.service.ts:169:23)
1942
+ at /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/__tests__/crypto.service.test.ts:271:42
1943
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:157:11
1944
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:753:26
1945
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1636:20
1946
+ at new Promise (<anonymous>)
1947
+ at runWithTimeout (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1602:10)
1948
+ at runTest (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1309:12)
1949
+ at processTicksAndRejections (node:internal/process/task_queues:103:5)
1950
+
1951
+ stderr | src/services/__tests__/crypto.service.test.ts > CryptoService > verifyJWS > should handle malformed JWS - single part
1952
+ [CryptoService] Invalid JWS format: Error: Invalid JWS format: expected header.payload.signature
1953
+ at CryptoService.parseJWS (/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/crypto.service.ts:78:13)
1954
+ at CryptoService.verifyJWS (/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/crypto.service.ts:169:23)
1955
+ at /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/__tests__/crypto.service.test.ts:279:42
1956
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:157:11
1957
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:753:26
1958
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1636:20
1959
+ at new Promise (<anonymous>)
1960
+ at runWithTimeout (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1602:10)
1961
+ at runTest (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1309:12)
1962
+ at processTicksAndRejections (node:internal/process/task_queues:103:5)
1963
+
1964
+ stderr | src/services/__tests__/crypto.service.test.ts > CryptoService > verifyJWS > should handle malformed JWS - two parts
1965
+ [CryptoService] Invalid JWS format: Error: Invalid JWS format: expected header.payload.signature
1966
+ at CryptoService.parseJWS (/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/crypto.service.ts:78:13)
1967
+ at CryptoService.verifyJWS (/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/crypto.service.ts:169:23)
1968
+ at /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/__tests__/crypto.service.test.ts:287:42
1969
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:157:11
1970
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:753:26
1971
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1636:20
1972
+ at new Promise (<anonymous>)
1973
+ at runWithTimeout (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1602:10)
1974
+ at runTest (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1309:12)
1975
+ at processTicksAndRejections (node:internal/process/task_queues:103:5)
1976
+
1977
+ stderr | src/services/__tests__/crypto.service.test.ts > CryptoService > verifyJWS > should handle malformed JWS - four parts
1978
+ [CryptoService] Invalid JWS format: Error: Invalid JWS format: expected header.payload.signature
1979
+ at CryptoService.parseJWS (/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/crypto.service.ts:78:13)
1980
+ at CryptoService.verifyJWS (/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/crypto.service.ts:169:23)
1981
+ at /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/__tests__/crypto.service.test.ts:302:42
1982
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:157:11
1983
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:753:26
1984
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1636:20
1985
+ at new Promise (<anonymous>)
1986
+ at runWithTimeout (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1602:10)
1987
+ at runTest (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1309:12)
1988
+ at processTicksAndRejections (node:internal/process/task_queues:103:5)
1989
+
1990
+ stderr | src/services/__tests__/crypto.service.test.ts > CryptoService > verifyJWS > should handle malformed JWS - invalid JSON header
1991
+ [CryptoService] Invalid JWS format: Error: Invalid header base64: Unexpected token 'o', "notjson" is not valid JSON
1992
+ at CryptoService.parseJWS (/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/crypto.service.ts:91:13)
1993
+ at CryptoService.verifyJWS (/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/crypto.service.ts:169:23)
1994
+ at /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/__tests__/crypto.service.test.ts:316:42
1995
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:157:11
1996
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:753:26
1997
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1636:20
1998
+ at new Promise (<anonymous>)
1999
+ at runWithTimeout (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1602:10)
2000
+ at runTest (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1309:12)
2001
+ at processTicksAndRejections (node:internal/process/task_queues:103:5)
2002
+
2003
+ stderr | src/services/__tests__/crypto.service.test.ts > CryptoService > verifyJWS > should handle malformed JWS - invalid base64
2004
+ [CryptoService] Invalid JWS format: Error: Invalid payload base64: Invalid base64url string: Invalid character
2005
+ at CryptoService.parseJWS (/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/crypto.service.ts:107:15)
2006
+ at CryptoService.verifyJWS (/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/crypto.service.ts:169:23)
2007
+ at /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/__tests__/crypto.service.test.ts:334:42
2008
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:157:11
2009
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:753:26
2010
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1636:20
2011
+ at new Promise (<anonymous>)
2012
+ at runWithTimeout (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1602:10)
2013
+ at runTest (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1309:12)
2014
+ at processTicksAndRejections (node:internal/process/task_queues:103:5)
2015
+
2016
+ stderr | src/services/__tests__/crypto.service.test.ts > CryptoService > verifyJWS > should validate expectedKid option
2017
+ [CryptoService] Key ID mismatch
2018
+
2019
+ stderr | src/services/__tests__/crypto.service.test.ts > CryptoService > verifyJWS > should validate alg option
2020
+ [CryptoService] Unsupported algorithm: EdDSA, expected RS256
2021
+
2022
+ stderr | src/services/__tests__/crypto.service.test.ts > CryptoService > verifyJWS > should validate Ed25519 key length
2023
+ [CryptoService] Failed to extract public key: Error: Invalid Ed25519 public key length: 5
2024
+ at CryptoService.jwkToBase64PublicKey (/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/crypto.service.ts:295:13)
2025
+ at CryptoService.verifyJWS (/Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/crypto.service.ts:249:32)
2026
+ at /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/__tests__/crypto.service.test.ts:398:42
2027
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:157:11
2028
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:753:26
2029
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1636:20
2030
+ at new Promise (<anonymous>)
2031
+ at runWithTimeout (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1602:10)
2032
+ at runTest (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1309:12)
2033
+ at processTicksAndRejections (node:internal/process/task_queues:103:5)
2034
+
2035
+ stderr | src/services/__tests__/proof-verifier.test.ts > ProofVerifier Security > Signature Verification > should handle signature verification errors gracefully
2036
+ [CryptoService] Ed25519 verification error: Error: Crypto error
2037
+ at /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/__tests__/proof-verifier.test.ts:328:9
2038
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:157:11
2039
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:753:26
2040
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1636:20
2041
+ at new Promise (<anonymous>)
2042
+ at runWithTimeout (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1602:10)
2043
+ at runTest (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1309:12)
2044
+ at processTicksAndRejections (node:internal/process/task_queues:103:5)
2045
+ at runSuite (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1468:8)
2046
+ at runSuite (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1468:8)
2047
+
2048
+ stderr | src/services/__tests__/crypto.service.test.ts > CryptoService > verifyJWS > should handle signature verification error
2049
+ [CryptoService] Ed25519 verification error: Error: Crypto error
2050
+ at /Users/dylanhobbs/Documents/@kya-os/xmcp-i/packages/mcp-i-core/src/services/__tests__/crypto.service.test.ts:449:61
2051
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:157:11
2052
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:753:26
2053
+ at file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1636:20
2054
+ at new Promise (<anonymous>)
2055
+ at runWithTimeout (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1602:10)
2056
+ at runTest (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1309:12)
2057
+ at processTicksAndRejections (node:internal/process/task_queues:103:5)
2058
+ at runSuite (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1468:8)
2059
+ at runSuite (file:///Users/dylanhobbs/Documents/@kya-os/xmcp-i/node_modules/.pnpm/@vitest+runner@4.0.5/node_modules/@vitest/runner/dist/index.js:1468:8)
2060
+
2061
+ stdout | src/__tests__/integration/full-flow.test.ts > Full Flow Integration > Tool protection enforcement flow > should allow unprotected tool calls
2062
+ [ToolProtectionService] Config loaded from API {
2063
+ source: 'api',
2064
+ toolCount: 1,
2065
+ protectedTools: [],
2066
+ agentDid: 'did:key:z6MkhaXgBZDv...',
2067
+ projectId: 'test-project',
2068
+ cacheTtlMs: 300000,
2069
+ cacheExpiresAt: '2025-11-23T23:57:45.492Z'
2070
+ }
2071
+
2072
+ stdout | src/__tests__/integration/full-flow.test.ts > Full Flow Integration > Tool protection enforcement flow > should intercept protected tool calls without delegation
2073
+ [ToolProtectionService] Config loaded from API {
2074
+ source: 'api',
2075
+ toolCount: 1,
2076
+ protectedTools: [ 'checkout' ],
2077
+ agentDid: 'did:key:z6MkhaXgBZDv...',
2078
+ projectId: 'test-project',
2079
+ cacheTtlMs: 300000,
2080
+ cacheExpiresAt: '2025-11-23T23:57:45.493Z'
2081
+ }
2082
+
2083
+ stdout | src/__tests__/integration/full-flow.test.ts > Full Flow Integration > Tool protection enforcement flow > should intercept protected tool calls without delegation
2084
+ [ToolProtectionService] Protection check {
2085
+ tool: 'checkout',
2086
+ agentDid: 'did:key:z6MkhaXgBZDv...',
2087
+ found: true,
2088
+ isWildcard: false,
2089
+ requiresDelegation: true,
2090
+ availableTools: [ 'checkout' ]
2091
+ }
2092
+
2093
+ stdout | src/__tests__/integration/full-flow.test.ts > Full Flow Integration > AgentShield integration flow > should fetch tool protection config from AgentShield
2094
+ [ToolProtectionService] Config loaded from API {
2095
+ source: 'api',
2096
+ toolCount: 1,
2097
+ protectedTools: [ 'protected_tool' ],
2098
+ agentDid: 'did:key:z6MkhaXgBZDv...',
2099
+ projectId: 'test-project',
2100
+ cacheTtlMs: 300000,
2101
+ cacheExpiresAt: '2025-11-23T23:57:45.493Z'
2102
+ }
2103
+
2104
+ stdout | src/__tests__/integration/full-flow.test.ts > Full Flow Integration > AgentShield integration flow > should cache tool protection config
2105
+ [ToolProtectionService] Config loaded from API {
2106
+ source: 'api',
2107
+ toolCount: 1,
2108
+ protectedTools: [ 'tool1' ],
2109
+ agentDid: 'did:key:z6MkhaXgBZDv...',
2110
+ projectId: 'test-project',
2111
+ cacheTtlMs: 300000,
2112
+ cacheExpiresAt: '2025-11-23T23:57:45.495Z'
2113
+ }
2114
+
2115
+ stderr | src/__tests__/integration/full-flow.test.ts > Full Flow Integration > AgentShield integration flow > should use fallback config when API fails
2116
+ [ToolProtectionService] API fetch failed, using fallback config { agentDid: 'did:key:z6MkhaXgBZDv...', error: 'Network error' }
2117
+
2118
+ stderr | src/__tests__/integration/full-flow.test.ts > Full Flow Integration > Error handling in full flow > should handle tool protection service errors gracefully
2119
+ [ToolProtectionService] API fetch failed, no fallback, failing closed (deny-all) {
2120
+ agentDid: 'did:key:z6MkhaXgBZDv...',
2121
+ error: 'Network error',
2122
+ cacheKey: 'config:tool-protections:test-project'
2123
+ }
2124
+
2125
+ stderr | src/__tests__/integration/full-flow.test.ts > Full Flow Integration > Error handling in full flow > should handle network timeouts
2126
+ [ToolProtectionService] API fetch failed, using fallback config { agentDid: 'did:key:z6MkhaXgBZDv...', error: 'Network timeout' }
2127
+ stdout | src/__tests__/integration/full-flow.test.ts > Full Flow Integration > Cache integration in full flow > should share cache across multiple service instances
2128
+ [ToolProtectionService] Config loaded from API {
2129
+ source: 'api',
2130
+ toolCount: 1,
2131
+ protectedTools: [ 'tool1' ],
2132
+
2133
+ agentDid: 'did:key:z6MkhaXgBZDv...',
2134
+ projectId: 'test-project',
2135
+ cacheTtlMs: 300000,
2136
+ cacheExpiresAt: '2025-11-23T23:57:45.496Z'
2137
+ }
2138
+
2139
+ stdout | src/__tests__/integration/full-flow.test.ts > Full Flow Integration > Cache integration in full flow > should clear cache when needed
2140
+ [ToolProtectionService] Config loaded from API {
2141
+ source: 'api',
2142
+ toolCount: 1,
2143
+ protectedTools: [ 'tool1' ],
2144
+ agentDid: 'did:key:z6MkhaXgBZDv...',
2145
+ projectId: 'test-project',
2146
+ cacheTtlMs: 300000,
2147
+ cacheExpiresAt: '2025-11-23T23:57:45.496Z'
2148
+ }
2149
+
2150
+ stdout | src/__tests__/integration/full-flow.test.ts > Full Flow Integration > Cache integration in full flow > should clear cache when needed
2151
+ [ToolProtectionService] Config loaded from API {
2152
+ source: 'api',
2153
+ toolCount: 1,
2154
+ protectedTools: [ 'tool1' ],
2155
+ agentDid: 'did:key:z6MkhaXgBZDv...',
2156
+ projectId: 'test-project',
2157
+ cacheTtlMs: 300000,
2158
+ cacheExpiresAt: '2025-11-23T23:57:45.496Z'
2159
+ }
2160
+
2161
+ stdout | src/__tests__/integration/full-flow.test.ts > Full Flow Integration > Real-world e-commerce scenario > should handle complete e-commerce flow with tool protection
2162
+ [ToolProtectionService] Config loaded from API {
2163
+ source: 'api',
2164
+ toolCount: 3,
2165
+ protectedTools: [ 'add_to_cart', 'checkout' ],
2166
+ agentDid: 'did:key:z6MkhaXgBZDv...',
2167
+ projectId: 'test-project',
2168
+ cacheTtlMs: 300000,
2169
+ cacheExpiresAt: '2025-11-23T23:57:45.497Z'
2170
+ }
2171
+
2172
+ stdout | src/__tests__/integration/full-flow.test.ts > Full Flow Integration > Real-world e-commerce scenario > should handle complete e-commerce flow with tool protection
2173
+ [ToolProtectionService] Protection check {
2174
+ tool: 'add_to_cart',
2175
+ agentDid: 'did:key:z6MkhaXgBZDv...',
2176
+ found: true,
2177
+ isWildcard: false,
2178
+ requiresDelegation: true,
2179
+ availableTools: [ 'search_products', 'add_to_cart', 'checkout' ]
2180
+ }
2181
+
2182
+ stdout | src/__tests__/integration/full-flow.test.ts > Full Flow Integration > Concurrent operations > should handle concurrent cache operations
2183
+ [ToolProtectionService] Config loaded from API {
2184
+ source: 'api',
2185
+ toolCount: 1,
2186
+ protectedTools: [ 'tool1' ],
2187
+ agentDid: 'did:key:z6MkhaXgBZDv...',
2188
+ projectId: 'test-project',
2189
+ cacheTtlMs: 300000,
2190
+ cacheExpiresAt: '2025-11-23T23:57:45.497Z'
2191
+ }
2192
+ [ToolProtectionService] Config loaded from API {
2193
+ source: 'api',
2194
+ toolCount: 1,
2195
+ protectedTools: [ 'tool1' ],
2196
+ agentDid: 'did:key:z6MkhaXgBZDv...',
2197
+ projectId: 'test-project',
2198
+ cacheTtlMs: 300000,
2199
+ cacheExpiresAt: '2025-11-23T23:57:45.497Z'
2200
+ }
2201
+ [ToolProtectionService] Config loaded from API {
2202
+ source: 'api',
2203
+ toolCount: 1,
2204
+ protectedTools: [ 'tool1' ],
2205
+ agentDid: 'did:key:z6MkhaXgBZDv...',
2206
+ projectId: 'test-project',
2207
+ cacheTtlMs: 300000,
2208
+ cacheExpiresAt: '2025-11-23T23:57:45.497Z'
2209
+ }
2210
+
2211
+ ✓ src/services/__tests__/crypto.service.test.ts (34 tests) 13ms
2212
+ ✓ src/services/__tests__/proof-verifier.test.ts (21 tests) 25ms
2213
+ ✓ src/__tests__/runtime/delegation-flow.test.ts (4 tests) 8ms
2214
+ ✓ src/__tests__/integration/full-flow.test.ts (21 tests) 11ms
2215
+ ✓ src/__tests__/runtime/base-extensions.test.ts (38 tests) 17ms
2216
+ ✓ src/__tests__/runtime/base.test.ts (55 tests) 25ms
2217
+ ✓ src/__tests__/providers/memory.test.ts (34 tests) 11ms
2218
+ stdout | src/__tests__/integration.test.ts > Integration Tests > Full handshake and tool execution flow > should complete full authentication and tool execution cycle
2219
+ [AUDIT] {"event":"runtime_initialized","data":{"did":"did:key:zeYc38Y0KUNkQu0m5u_3Wl85YBE1CM_D5","environment":"development","userDidGeneration":"disabled"},"timestamp":1763941965583,"timestampFormatted":"2025-11-23T23:52:45.583Z"}
2220
+
2221
+ stdout | src/__tests__/integration.test.ts > Integration Tests > Full handshake and tool execution flow > should complete full authentication and tool execution cycle
2222
+ [AUDIT] {"event":"tool_executed","data":{"tool":"greetingTool","sessionId":"575203a09ded15f5cc1d5811180f18bd","timestamp":1763941965583},"timestamp":1763941965583,"timestampFormatted":"2025-11-23T23:52:45.583Z"}
2223
+
2224
+ stdout | src/__tests__/integration.test.ts > Integration Tests > Session expiry handling > should handle expired sessions correctly
2225
+ [AUDIT] {"event":"runtime_initialized","data":{"did":"did:key:z-EV9NoL1ehxwgqGV7xuXaVWACsFi1b1X","environment":"development","userDidGeneration":"disabled"},"timestamp":1763941965594,"timestampFormatted":"2025-11-23T23:52:45.594Z"}
2226
+
2227
+ ✓ src/delegation/__tests__/cascading-revocation.test.ts (23 tests) 8ms
2228
+ stdout | src/__tests__/integration.test.ts > Integration Tests > Key rotation flow > should handle key rotation and maintain functionality
2229
+ [AUDIT] {"event":"runtime_initialized","data":{"did":"did:key:zWMQpR13XHTo8_f_R_gteha6bBsW1vaXd","environment":"development","userDidGeneration":"disabled"},"timestamp":1763941965594,"timestampFormatted":"2025-11-23T23:52:45.594Z"}
2230
+
2231
+ stdout | src/__tests__/integration.test.ts > Integration Tests > Key rotation flow > should handle key rotation and maintain functionality
2232
+ [AUDIT] {"event":"keys_rotated","data":{"oldDid":"did:key:zWMQpR13XHTo8_f_R_gteha6bBsW1vaXd","newDid":"did:key:zdLbRx2dQ-eqq9Y3D_4zIiIHXUa9Yy5Gr","timestamp":1763941965594},"timestamp":1763941965594,"timestampFormatted":"2025-11-23T23:52:45.594Z"}
2233
+
2234
+ stdout | src/__tests__/integration.test.ts > Integration Tests > Well-known endpoints > should provide identity discovery endpoints
2235
+ [AUDIT] {"event":"runtime_initialized","data":{"did":"did:key:zTLJg5PlDG5YnFcuA2Maq17yav9GpPABL","environment":"development","userDidGeneration":"disabled"},"timestamp":1763941965596,"timestampFormatted":"2025-11-23T23:52:45.596Z"}
2236
+
2237
+ stdout | src/__tests__/integration.test.ts > Integration Tests > Nonce replay protection > should prevent nonce reuse
2238
+ [AUDIT] {"event":"runtime_initialized","data":{"did":"did:key:z52hr6xSRztKKRsLFqP1ZAclbrK-NpRgE","environment":"development","userDidGeneration":"disabled"},"timestamp":1763941965597,"timestampFormatted":"2025-11-23T23:52:45.597Z"}
2239
+
2240
+ stdout | src/__tests__/integration.test.ts > Integration Tests > Error handling > should handle network errors gracefully
2241
+ [AUDIT] {"event":"runtime_initialized","data":{"did":"did:key:z2DvYuXCaJZBXXFV9gmU5wSCOXg5LBbKR","environment":"development","userDidGeneration":"disabled"},"timestamp":1763941965597,"timestampFormatted":"2025-11-23T23:52:45.597Z"}
2242
+
2243
+ stdout | src/__tests__/integration.test.ts > Integration Tests > Error handling > should handle malformed DID documents
2244
+ [AUDIT] {"event":"runtime_initialized","data":{"did":"did:key:zOLk1qYykmUSI2GiLOCxJWfv6D6JVfmqF","environment":"development","userDidGeneration":"disabled"},"timestamp":1763941965597,"timestampFormatted":"2025-11-23T23:52:45.597Z"}
2245
+
2246
+ stdout | src/__tests__/integration.test.ts > Integration Tests > Debug endpoint > should provide debug information in development
2247
+ [AUDIT] {"event":"runtime_initialized","data":{"did":"did:key:zjYKV8Hf86p3zv38IoUcKoigbwB4nN3Bu","environment":"development","userDidGeneration":"disabled"},"timestamp":1763941965597,"timestampFormatted":"2025-11-23T23:52:45.597Z"}
2248
+
2249
+ stdout | src/__tests__/integration.test.ts > Integration Tests > Debug endpoint > should be disabled in production
2250
+ [AUDIT] {"event":"runtime_initialized","data":{"did":"did:key:zcJRo5-lMGF7ArPrHeYmqOhPHON4iEaHn","environment":"development","userDidGeneration":"disabled"},"timestamp":1763941965597,"timestampFormatted":"2025-11-23T23:52:45.597Z"}
2251
+
2252
+ stdout | src/services/__tests__/provider-resolver.test.ts > ProviderResolver > resolveProvider - Priority 2: Scope inference > should infer provider from github scope prefix
2253
+ [ProviderResolver] Inferred provider "github" from scopes
2254
+
2255
+ stdout | src/services/__tests__/provider-resolver.test.ts > ProviderResolver > resolveProvider - Priority 2: Scope inference > should infer provider from gmail scope prefix (maps to google)
2256
+ [ProviderResolver] Inferred provider "google" from scopes
2257
+
2258
+ stderr | src/services/__tests__/provider-resolver.test.ts > ProviderResolver > resolveProvider - Priority 2: Scope inference > should return null for ambiguous scopes
2259
+ [ProviderResolver] Tool does not specify oauthProvider. Using first configured provider "github" as fallback. This is deprecated - configure oauthProvider in AgentShield dashboard for Phase 2+.
2260
+
2261
+ ✓ src/delegation/storage/__tests__/memory-graph-storage.test.ts (27 tests) 4ms
2262
+ ✓ src/__tests__/integration.test.ts (9 tests) 19ms
2263
+ ✓ src/services/__tests__/provider-resolver.test.ts (8 tests) 8ms
2264
+ stderr | src/services/__tests__/provider-resolution.integration.test.ts > Provider Resolution Integration > Backward compatibility > should work with Phase 1 tools (no oauthProvider field)
2265
+ [ProviderResolver] Tool does not specify oauthProvider. Using first configured provider "github" as fallback. This is deprecated - configure oauthProvider in AgentShield dashboard for Phase 2+.
2266
+
2267
+ ✓ src/services/__tests__/provider-resolution.integration.test.ts (6 tests) 4ms
2268
+ ✓ src/delegation/__tests__/bitstring.test.ts (30 tests) 6ms
2269
+ stdout | src/__tests__/services/provider-resolver-edge-cases.test.ts > ProviderResolver - Edge Cases > Scope inference edge cases (Priority 2) > should verify gmail → google mapping works
2270
+ [ProviderResolver] Inferred provider "google" from scopes
2271
+
2272
+ stdout | src/__tests__/services/provider-resolver-edge-cases.test.ts > ProviderResolver - Edge Cases > Scope inference edge cases (Priority 2) > should verify calendar → google mapping works
2273
+ [ProviderResolver] Inferred provider "google" from scopes
2274
+ stderr | src/__tests__/services/provider-resolver-edge-cases.test.ts > ProviderResolver - Edge Cases > Scope inference edge cases (Priority 2) > should handle empty scopes array
2275
+
2276
+ stdout | src/__tests__/services/provider-resolver-edge-cases.test.ts > ProviderResolver - Edge Cases > Scope inference edge cases (Priority 2) > should verify outlook → microsoft mapping works
2277
+ [ProviderResolver] Inferred provider "microsoft" from scopes
2278
+
2279
+ [ProviderResolver] Tool does not specify oauthProvider. Using first configured provider "github" as fallback. This is deprecated - configure oauthProvider in AgentShield dashboard for Phase 2+.
2280
+
2281
+ stderr | src/__tests__/services/provider-resolver-edge-cases.test.ts > ProviderResolver - Edge Cases > Scope inference edge cases (Priority 2) > should handle ambiguous scopes (multiple providers inferred)
2282
+ [ProviderResolver] Tool does not specify oauthProvider. Using first configured provider "github" as fallback. This is deprecated - configure oauthProvider in AgentShield dashboard for Phase 2+.
2283
+
2284
+ stderr | src/__tests__/services/provider-resolver-edge-cases.test.ts > ProviderResolver - Edge Cases > Scope inference edge cases (Priority 2) > should handle unknown scope prefixes
2285
+ [ProviderResolver] Tool does not specify oauthProvider. Using first configured provider "github" as fallback. This is deprecated - configure oauthProvider in AgentShield dashboard for Phase 2+.
2286
+
2287
+ stderr | src/__tests__/services/provider-resolver-edge-cases.test.ts > ProviderResolver - Edge Cases > Scope inference edge cases (Priority 2) > should handle scopes without colons
2288
+ [ProviderResolver] Tool does not specify oauthProvider. Using first configured provider "github" as fallback. This is deprecated - configure oauthProvider in AgentShield dashboard for Phase 2+.
2289
+
2290
+ stderr | src/__tests__/services/provider-resolver-edge-cases.test.ts > ProviderResolver - Edge Cases > Scope inference edge cases (Priority 2) > should handle inferred provider not in registry
2291
+ [ProviderResolver] Tool does not specify oauthProvider. Using first configured provider "google" as fallback. This is deprecated - configure oauthProvider in AgentShield dashboard for Phase 2+.
2292
+
2293
+ stderr | src/__tests__/services/provider-resolver-edge-cases.test.ts > ProviderResolver - Edge Cases > Fallback behavior (Priority 3) > should use first configured provider when oauthProvider not specified
2294
+ [ProviderResolver] Tool does not specify oauthProvider. Using first configured provider "github" as fallback. This is deprecated - configure oauthProvider in AgentShield dashboard for Phase 2+.
2295
+
2296
+ stdout | src/__tests__/services/provider-resolver-edge-cases.test.ts > ProviderResolver - Edge Cases > Provider name case sensitivity > should handle provider names case-insensitively in inference
2297
+ [ProviderResolver] Inferred provider "github" from scopes
2298
+
2299
+ stdout | src/__tests__/services/provider-resolver-edge-cases.test.ts > ProviderResolver - Edge Cases > Multiple scopes with same provider > should handle multiple scopes from same provider
2300
+ [ProviderResolver] Inferred provider "github" from scopes
2301
+
2302
+ ✓ src/delegation/__tests__/delegation-graph.test.ts (28 tests) 6ms
2303
+ ✓ src/__tests__/services/provider-resolver-edge-cases.test.ts (19 tests | 1 skipped) 10ms
2304
+ ✓ src/__tests__/providers/base.test.ts (14 tests) 4ms
2305
+ ✓ src/services/__tests__/batch-delegation.service.test.ts (11 tests) 4ms
2306
+ ✓ src/compliance/__tests__/schema-verifier.test.ts (30 tests) 5ms
2307
+ ✓ src/services/__tests__/oauth-provider-registry.test.ts (9 tests) 4ms
2308
+ ✓ src/__tests__/runtime/proof-client-did.test.ts (17 tests) 15ms
2309
+ ✓ src/delegation/__tests__/utils.test.ts (28 tests) 3ms
2310
+ ✓ src/delegation/storage/__tests__/memory-statuslist-storage.test.ts (14 tests) 3ms
2311
+ ✓ src/__tests__/runtime/audit-logger.test.ts (9 tests) 3ms
2312
+ ✓ src/__tests__/config/provider-runtime-config.test.ts (9 tests) 2ms
2313
+ ✓ src/utils/__tests__/did-helpers.test.ts (11 tests) 2ms
2314
+ ✓ src/delegation/__tests__/audience-validator.test.ts (5 tests) 1ms
2315
+ ✓ src/__tests__/index.test.ts (4 tests) 2ms
2316
+ ↓ src/__tests__/delegation-e2e.test.ts (14 tests | 14 skipped)
2317
+ stdout | src/__tests__/services/agentshield-integration.test.ts > AgentShield Integration > Caching Integration > should respect cache TTL
2318
+ [ToolProtectionService] Config loaded from API {
2319
+ source: 'api',
2320
+ toolCount: 0,
2321
+ protectedTools: [],
2322
+ agentDid: 'did:key:z6MkhaXgBZDv...',
2323
+ projectId: 'test-project-123',
2324
+ cacheTtlMs: 1000,
2325
+ cacheExpiresAt: '2025-11-23T23:52:47.323Z'
2326
+ }
2327
+
2328
+ stdout | src/__tests__/services/agentshield-integration.test.ts > AgentShield Integration > Real-world Scenarios > should handle typical e-commerce tool protection config
2329
+ [ToolProtectionService] Config loaded from API {
2330
+ source: 'api',
2331
+ toolCount: 4,
2332
+ protectedTools: [ 'add_to_cart', 'checkout' ],
2333
+ agentDid: 'did:key:z6MkhaXgBZDv...',
2334
+ projectId: 'test-project-123',
2335
+ cacheTtlMs: 300000,
2336
+ cacheExpiresAt: '2025-11-23T23:57:46.323Z'
2337
+ }
2338
+
2339
+ stderr | src/__tests__/services/agentshield-integration.test.ts > AgentShield Integration > Real-world Scenarios > should handle API rate limiting gracefully
2340
+ [ToolProtectionService] API fetch failed, using fallback config {
2341
+ agentDid: 'did:key:z6MkhaXgBZDv...',
2342
+ error: 'Failed to fetch bouncer config: 429 Too Many Requests - Rate limit exceeded'
2343
+ }
2344
+
2345
+ stdout | src/__tests__/services/agentshield-integration.test.ts > AgentShield Integration > Real-world Scenarios > should handle concurrent requests
2346
+ [ToolProtectionService] Config loaded from API {
2347
+ source: 'api',
2348
+ toolCount: 1,
2349
+ protectedTools: [ 'tool1' ],
2350
+ agentDid: 'did:key:z6MkhaXgBZDv...',
2351
+ projectId: 'test-project-123',
2352
+ cacheTtlMs: 300000,
2353
+ cacheExpiresAt: '2025-11-23T23:57:46.324Z'
2354
+ }
2355
+ [ToolProtectionService] Config loaded from API {
2356
+ source: 'api',
2357
+ toolCount: 1,
2358
+ protectedTools: [ 'tool1' ],
2359
+ agentDid: 'did:key:z6MkhaXgBZDv...',
2360
+ projectId: 'test-project-123',
2361
+ cacheTtlMs: 300000,
2362
+ cacheExpiresAt: '2025-11-23T23:57:46.324Z'
2363
+ }
2364
+ [ToolProtectionService] Config loaded from API {
2365
+ source: 'api',
2366
+ toolCount: 1,
2367
+ protectedTools: [ 'tool1' ],
2368
+ agentDid: 'did:key:z6MkhaXgBZDv...',
2369
+ projectId: 'test-project-123',
2370
+ cacheTtlMs: 300000,
2371
+ cacheExpiresAt: '2025-11-23T23:57:46.324Z'
2372
+ }
2373
+
2374
+ ✓ src/__tests__/services/agentshield-integration.test.ts (30 tests) 1121ms
2375
+ ✓ should respect cache TTL 1101ms
2376
+
2377
+ Test Files 42 passed | 1 skipped (43)
2378
+ Tests 864 passed | 16 skipped (880)
2379
+ Start at 17:52:44
2380
+ Duration 1.72s (transform 2.39s, setup 0ms, collect 4.10s, tests 2.11s, environment 4ms, prepare 1.02s)
2381
+
2382
+ % Coverage report from v8
2383
+
2384
+ =============================== Coverage summary ===============================
2385
+ Statements : 65.44% ( 1553/2373 )
2386
+ Branches : 59.97% ( 959/1599 )
2387
+ Functions : 64.03% ( 251/392 )
2388
+ Lines : 65.35% ( 1513/2315 )
2389
+ ================================================================================