@kya-os/mcp-i-core 1.2.2-canary.30 → 1.2.2-canary.31

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