@hai.ai/jacs 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/mcp.js ADDED
@@ -0,0 +1,514 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.JACSTransportProxy = void 0;
7
+ exports.createJACSTransportProxy = createJACSTransportProxy;
8
+ exports.createJACSTransportProxyAsync = createJACSTransportProxyAsync;
9
+ const index_js_1 = __importDefault(require("./index.js"));
10
+ // Add near the top, after imports:
11
+ const isStdioTransport = (transport) => {
12
+ return transport.constructor.name === 'StdioServerTransport' ||
13
+ transport.constructor.name === 'StdioClientTransport';
14
+ };
15
+ let enableDiagnosticLogging = false;
16
+ function jacslog(...args) {
17
+ console.error(...args);
18
+ }
19
+ // Load JACS config only once
20
+ let jacsLoaded = false;
21
+ let jacsLoadError = null;
22
+ async function ensureJacsLoaded(configPath) {
23
+ if (jacsLoaded)
24
+ return;
25
+ if (jacsLoadError)
26
+ throw jacsLoadError;
27
+ try {
28
+ jacslog(`ensureJacsLoaded: Attempting to load JACS config from: ${configPath}`);
29
+ jacsLoadError = null;
30
+ await index_js_1.default.load(configPath);
31
+ jacsLoaded = true;
32
+ jacslog(`ensureJacsLoaded: JACS agent loaded successfully from ${configPath}.`);
33
+ }
34
+ catch (error) {
35
+ jacsLoadError = error;
36
+ console.error(`ensureJacsLoaded: CRITICAL: Failed to load JACS config from '${configPath}'. Error:`, jacsLoadError.message);
37
+ throw jacsLoadError;
38
+ }
39
+ }
40
+ /**
41
+ * JACS Transport Proxy - Wraps any transport with JACS encryption
42
+ *
43
+ * This proxy sits between the MCP SDK and the actual transport,
44
+ * intercepting serialized JSON strings (not JSON-RPC objects)
45
+ */
46
+ class JACSTransportProxy {
47
+ constructor(transport, role, jacsConfigPath) {
48
+ this.transport = transport;
49
+ this.jacsConfigPath = jacsConfigPath;
50
+ this.jacsOperational = true;
51
+ this.proxyId = `JACS_${role.toUpperCase()}_PROXY`;
52
+ // Disable JACS debugging for STDIO transports to prevent stdout contamination
53
+ const suppressDebugForStdio = isStdioTransport(transport);
54
+ const enableDiagnosticLogging = process.env.JACS_MCP_DEBUG === 'true' && !suppressDebugForStdio;
55
+ if (suppressDebugForStdio) {
56
+ console.error(`[${this.proxyId}] STDIO transport detected, suppressing debug output`);
57
+ }
58
+ jacslog(`[${this.proxyId}] CONSTRUCTOR: Wrapping transport with JACS. Config: ${jacsConfigPath}`);
59
+ if (jacsConfigPath) {
60
+ ensureJacsLoaded(jacsConfigPath)
61
+ .then(() => {
62
+ this.jacsOperational = true;
63
+ jacslog(`[${this.proxyId}] JACS Loaded and operational.`);
64
+ })
65
+ .catch(err => {
66
+ this.jacsOperational = false;
67
+ console.error(`[${this.proxyId}] JACS Load FAILED:`, err.message);
68
+ });
69
+ }
70
+ else {
71
+ this.jacsOperational = false;
72
+ console.warn(`[${this.proxyId}] No JACS config provided. Operating in passthrough mode.`);
73
+ }
74
+ // Intercept incoming messages from the transport
75
+ this.transport.onmessage = async (incomingData) => {
76
+ const logPrefix = `[${this.proxyId}] INCOMING`;
77
+ try {
78
+ let messageForSDK;
79
+ if (typeof incomingData === 'string') {
80
+ if (enableDiagnosticLogging)
81
+ jacslog(`${logPrefix}: Received string from transport (len ${incomingData.length}): ${incomingData.substring(0, 100)}...`);
82
+ if (this.jacsOperational) {
83
+ // Try to decrypt/verify the string as a JACS artifact
84
+ try {
85
+ if (enableDiagnosticLogging)
86
+ jacslog(`${logPrefix}: Attempting JACS verification of string...`);
87
+ const verificationResult = await index_js_1.default.verifyResponse(incomingData);
88
+ let decryptedMessage;
89
+ if (verificationResult && typeof verificationResult === 'object' && 'payload' in verificationResult) {
90
+ decryptedMessage = verificationResult.payload;
91
+ }
92
+ else {
93
+ decryptedMessage = verificationResult;
94
+ }
95
+ if (enableDiagnosticLogging)
96
+ jacslog(`${logPrefix}: JACS verification successful. Decrypted message: ${JSON.stringify(decryptedMessage).substring(0, 100)}...`);
97
+ messageForSDK = decryptedMessage;
98
+ }
99
+ catch (jacsError) {
100
+ // Not a JACS artifact, treat as plain JSON
101
+ const errorMessage = jacsError instanceof Error ? jacsError.message : "Unknown JACS error";
102
+ if (enableDiagnosticLogging)
103
+ jacslog(`${logPrefix}: Not a JACS artifact, parsing as plain JSON. JACS error was: ${errorMessage}`);
104
+ messageForSDK = JSON.parse(incomingData);
105
+ }
106
+ }
107
+ else {
108
+ // JACS not operational, parse as plain JSON
109
+ if (enableDiagnosticLogging)
110
+ jacslog(`${logPrefix}: JACS not operational, parsing as plain JSON.`);
111
+ messageForSDK = JSON.parse(incomingData);
112
+ }
113
+ }
114
+ else if (typeof incomingData === 'object' && incomingData !== null && 'jsonrpc' in incomingData) {
115
+ if (enableDiagnosticLogging)
116
+ jacslog(`${logPrefix}: Received object from transport, using as-is.`);
117
+ messageForSDK = incomingData;
118
+ }
119
+ else {
120
+ console.error(`${logPrefix}: Unexpected data type from transport:`, typeof incomingData);
121
+ throw new Error("Invalid data type from transport");
122
+ }
123
+ if (enableDiagnosticLogging)
124
+ jacslog(`${logPrefix}: Passing to MCP SDK: ${JSON.stringify(messageForSDK).substring(0, 100)}...`);
125
+ // Pass the clean JSON-RPC message to the MCP SDK
126
+ if (this.onmessage) {
127
+ this.onmessage(messageForSDK);
128
+ }
129
+ }
130
+ catch (error) {
131
+ console.error(`${logPrefix}: Error processing incoming message:`, error);
132
+ if (this.onerror)
133
+ this.onerror(error);
134
+ }
135
+ };
136
+ // Forward transport events
137
+ this.transport.onclose = () => {
138
+ jacslog(`[${this.proxyId}] Transport closed.`);
139
+ if (this.onclose)
140
+ this.onclose();
141
+ };
142
+ this.transport.onerror = (error) => {
143
+ console.error(`[${this.proxyId}] Transport error:`, error);
144
+ if (this.onerror)
145
+ this.onerror(error);
146
+ };
147
+ jacslog(`[${this.proxyId}] CONSTRUCTOR: Transport proxy initialized.`);
148
+ if ('send' in this.transport && typeof this.transport.send === 'function') {
149
+ const originalSend = this.transport.send.bind(this.transport);
150
+ this.transport.send = async (data) => {
151
+ if (typeof data === 'string') {
152
+ // Check if this is a server-side SSE transport
153
+ const sseTransport = this.transport;
154
+ if (sseTransport._sseResponse) {
155
+ // Server-side: write directly to SSE stream
156
+ sseTransport._sseResponse.write(`event: message\ndata: ${data}\n\n`);
157
+ return;
158
+ }
159
+ else if (sseTransport._endpoint) {
160
+ // Client-side: use fetch (existing code)
161
+ const headers = await (sseTransport._commonHeaders?.() || Promise.resolve({}));
162
+ const response = await fetch(sseTransport._endpoint, {
163
+ method: "POST",
164
+ headers: {
165
+ ...headers,
166
+ "content-type": "application/json",
167
+ },
168
+ body: data, // Send raw string without JSON.stringify()
169
+ });
170
+ if (!response.ok) {
171
+ const text = await response.text().catch(() => null);
172
+ throw new Error(`Error POSTing to endpoint (HTTP ${response.status}): ${text}`);
173
+ }
174
+ return;
175
+ }
176
+ }
177
+ return originalSend(data);
178
+ };
179
+ }
180
+ // Replace the client monkey patch section in the constructor with this:
181
+ if (role === "client") {
182
+ jacslog(`[${this.proxyId}] Setting up EventSource interception for client...`);
183
+ // Wait for the transport to be initialized, then intercept its EventSource
184
+ setTimeout(() => {
185
+ const sseTransport = this.transport;
186
+ if (sseTransport._eventSource) {
187
+ jacslog(`[${this.proxyId}] Found EventSource, intercepting onmessage...`);
188
+ const originalOnMessage = sseTransport._eventSource.onmessage;
189
+ sseTransport._eventSource.onmessage = async (event) => {
190
+ jacslog(`[${this.proxyId}] EventSource received message:`, event.data?.substring(0, 100));
191
+ try {
192
+ // Try JACS verification first
193
+ if (this.jacsOperational) {
194
+ const verificationResult = await index_js_1.default.verifyResponse(event.data);
195
+ let decryptedMessage;
196
+ if (verificationResult && typeof verificationResult === 'object' && 'payload' in verificationResult) {
197
+ decryptedMessage = verificationResult.payload;
198
+ }
199
+ else {
200
+ decryptedMessage = verificationResult;
201
+ }
202
+ // Clean up JACS-added null values before passing to MCP SDK
203
+ const cleanedMessage = this.removeNullValues(decryptedMessage);
204
+ jacslog(`[${this.proxyId}] JACS verification successful, passing decrypted message to MCP SDK`);
205
+ const newEvent = new MessageEvent('message', {
206
+ data: JSON.stringify(cleanedMessage)
207
+ });
208
+ originalOnMessage.call(sseTransport._eventSource, newEvent);
209
+ return;
210
+ }
211
+ }
212
+ catch (jacsError) {
213
+ jacslog(`[${this.proxyId}] Not a JACS artifact, passing original message to MCP SDK`);
214
+ }
215
+ // Not JACS or JACS failed, use original handler
216
+ originalOnMessage.call(sseTransport._eventSource, event);
217
+ };
218
+ }
219
+ else {
220
+ jacslog(`[${this.proxyId}] EventSource not found, will retry...`);
221
+ // Retry after transport is fully initialized
222
+ setTimeout(() => {
223
+ if (this.transport._eventSource) {
224
+ jacslog(`[${this.proxyId}] Found EventSource on retry, intercepting...`);
225
+ // Same logic as above
226
+ }
227
+ }, 100);
228
+ }
229
+ }, 50);
230
+ }
231
+ }
232
+ async start() {
233
+ jacslog(`[${this.proxyId}] Starting underlying transport...`);
234
+ return this.transport.start();
235
+ }
236
+ async close() {
237
+ jacslog(`[${this.proxyId}] Closing underlying transport...`);
238
+ return this.transport.close();
239
+ }
240
+ // Intercept outgoing messages to the transport
241
+ async send(message) {
242
+ const logPrefix = `[${this.proxyId}] OUTGOING`;
243
+ try {
244
+ if (enableDiagnosticLogging)
245
+ jacslog(`${logPrefix}: MCP SDK sending message: ${JSON.stringify(message).substring(0, 100)}...`);
246
+ if (this.jacsOperational) {
247
+ // Skip JACS for error responses
248
+ if ('error' in message) {
249
+ if (enableDiagnosticLogging)
250
+ jacslog(`${logPrefix}: Error response, skipping JACS encryption.`);
251
+ await this.transport.send(message);
252
+ }
253
+ else {
254
+ try {
255
+ if (enableDiagnosticLogging)
256
+ jacslog(`${logPrefix}: Applying JACS encryption to message...`);
257
+ // Clean up the message before JACS signing - remove null params
258
+ const cleanMessage = { ...message };
259
+ if ('params' in cleanMessage && cleanMessage.params === null) {
260
+ delete cleanMessage.params;
261
+ }
262
+ const jacsArtifact = await index_js_1.default.signRequest(cleanMessage);
263
+ await this.transport.send(jacsArtifact);
264
+ }
265
+ catch (jacsError) {
266
+ console.error(`${logPrefix}: JACS encryption failed, sending plain message. Error:`, jacsError);
267
+ await this.transport.send(message);
268
+ }
269
+ }
270
+ }
271
+ else {
272
+ if (enableDiagnosticLogging)
273
+ jacslog(`${logPrefix}: JACS not operational, sending plain message.`);
274
+ await this.transport.send(message);
275
+ }
276
+ if (enableDiagnosticLogging)
277
+ jacslog(`${logPrefix}: Successfully sent to transport.`);
278
+ }
279
+ catch (error) {
280
+ console.error(`${logPrefix}: Error sending message:`, error);
281
+ throw error;
282
+ }
283
+ }
284
+ // Forward transport properties
285
+ get sessionId() {
286
+ return this.transport.sessionId;
287
+ }
288
+ // Handle HTTP POST for SSE transports (if applicable)
289
+ /**
290
+ * REQUIRED for SSE (Server-Sent Events) transport pattern in MCP.
291
+ *
292
+ * WHY THIS EXISTS:
293
+ * SSE is inherently unidirectional (server→client), but MCP requires bidirectional communication.
294
+ * The MCP SSE implementation solves this with a hybrid approach:
295
+ * - Server→Client: Uses SSE stream for real-time messages
296
+ * - Client→Server: Uses HTTP POST to a specific endpoint
297
+ *
298
+ * This function intercepts those client POST requests, decrypts JACS payloads,
299
+ * and forwards the decrypted messages to the underlying SSE transport handler.
300
+ *
301
+ * Without this, JACS-encrypted client messages would never reach the MCP server.
302
+ */
303
+ async handlePostMessage(req, res, rawBodyString) {
304
+ const logPrefix = `[${this.proxyId}] HTTP_POST`;
305
+ // Verify the underlying transport actually supports POST handling
306
+ // (not all MCP transports do - only SSE transports need this)
307
+ if (!('handlePostMessage' in this.transport) || typeof this.transport.handlePostMessage !== 'function') {
308
+ console.error(`${logPrefix}: Underlying transport does not support handlePostMessage`);
309
+ if (!res.writableEnded)
310
+ res.writeHead(500).end("Transport does not support POST handling");
311
+ return;
312
+ }
313
+ // Extract the request body (which contains the JACS-encrypted payload)
314
+ let bodyToProcess;
315
+ if (rawBodyString !== undefined) {
316
+ // Body already provided (likely from Express middleware)
317
+ bodyToProcess = rawBodyString;
318
+ }
319
+ else {
320
+ // Manually read the request body from the HTTP stream
321
+ const bodyBuffer = [];
322
+ for await (const chunk of req) {
323
+ bodyBuffer.push(chunk);
324
+ }
325
+ bodyToProcess = Buffer.concat(bodyBuffer).toString();
326
+ if (!bodyToProcess) {
327
+ if (!res.writableEnded)
328
+ res.writeHead(400).end("Empty body");
329
+ return;
330
+ }
331
+ }
332
+ if (enableDiagnosticLogging)
333
+ jacslog(`${logPrefix}: Raw body (len ${bodyToProcess.length}): ${bodyToProcess.substring(0, 100)}...`);
334
+ // Add this debug line before calling jacs.verifyResponse:
335
+ jacslog(`${logPrefix}: JACS Debug - Body type: ${typeof bodyToProcess}`);
336
+ jacslog(`${logPrefix}: JACS Debug - First 200 chars:`, JSON.stringify(bodyToProcess.substring(0, 200)));
337
+ jacslog(`${logPrefix}: JACS Debug - Is valid JSON?`, (() => {
338
+ try {
339
+ JSON.parse(bodyToProcess);
340
+ return true;
341
+ }
342
+ catch {
343
+ return false;
344
+ }
345
+ })());
346
+ try {
347
+ let processedBody = bodyToProcess;
348
+ if (this.jacsOperational) {
349
+ // Try normalizing the JSON string before JACS verification:
350
+ try {
351
+ // First, try to parse and re-stringify to normalize
352
+ const parsedJson = JSON.parse(bodyToProcess);
353
+ const normalizedJsonString = JSON.stringify(parsedJson);
354
+ if (enableDiagnosticLogging)
355
+ jacslog(`${logPrefix}: Attempting JACS verification with normalized JSON...`);
356
+ const verificationResult = await index_js_1.default.verifyResponse(normalizedJsonString);
357
+ let decryptedMessage;
358
+ if (verificationResult && typeof verificationResult === 'object' && 'payload' in verificationResult) {
359
+ decryptedMessage = verificationResult.payload;
360
+ }
361
+ else {
362
+ decryptedMessage = verificationResult;
363
+ }
364
+ // Clean up JACS-added null params before passing to MCP SDK
365
+ if ('params' in decryptedMessage && decryptedMessage.params === null) {
366
+ const cleanMessage = { ...decryptedMessage };
367
+ delete cleanMessage.params;
368
+ processedBody = JSON.stringify(cleanMessage);
369
+ }
370
+ else {
371
+ processedBody = JSON.stringify(decryptedMessage);
372
+ }
373
+ if (enableDiagnosticLogging)
374
+ jacslog(`${logPrefix}: JACS verification successful. Decrypted to: ${processedBody.substring(0, 100)}...`);
375
+ }
376
+ catch (parseError) {
377
+ // If it's not valid JSON, try with original string
378
+ if (enableDiagnosticLogging)
379
+ jacslog(`${logPrefix}: JSON normalization failed, trying original string...`);
380
+ const verificationResult = await index_js_1.default.verifyResponse(bodyToProcess);
381
+ let decryptedMessage;
382
+ if (verificationResult && typeof verificationResult === 'object' && 'payload' in verificationResult) {
383
+ decryptedMessage = verificationResult.payload;
384
+ }
385
+ else {
386
+ decryptedMessage = verificationResult;
387
+ }
388
+ // Clean up JACS-added null params before passing to MCP SDK
389
+ if ('params' in decryptedMessage && decryptedMessage.params === null) {
390
+ const cleanMessage = { ...decryptedMessage };
391
+ delete cleanMessage.params;
392
+ processedBody = JSON.stringify(cleanMessage);
393
+ }
394
+ else {
395
+ processedBody = JSON.stringify(decryptedMessage);
396
+ }
397
+ if (enableDiagnosticLogging)
398
+ jacslog(`${logPrefix}: JACS verification successful. Decrypted to: ${processedBody.substring(0, 100)}...`);
399
+ }
400
+ }
401
+ // Forward to underlying transport's POST handler
402
+ await this.transport.handlePostMessage(req, res, processedBody);
403
+ }
404
+ catch (error) {
405
+ console.error(`${logPrefix}: Error processing POST:`, error);
406
+ if (!res.writableEnded) {
407
+ const errorMessage = error instanceof Error ? error.message : "Unknown error";
408
+ res.writeHead(500).end(`Error: ${errorMessage}`);
409
+ }
410
+ }
411
+ }
412
+ async handleIncomingMessage(incomingData) {
413
+ const logPrefix = `[${this.proxyId}] INCOMING`;
414
+ try {
415
+ let messageForSDK;
416
+ if (typeof incomingData === 'string') {
417
+ if (enableDiagnosticLogging)
418
+ jacslog(`${logPrefix}: Received string from transport (len ${incomingData.length}): ${incomingData.substring(0, 100)}...`);
419
+ if (this.jacsOperational) {
420
+ try {
421
+ if (enableDiagnosticLogging)
422
+ jacslog(`${logPrefix}: Attempting JACS verification of string...`);
423
+ const verificationResult = await index_js_1.default.verifyResponse(incomingData);
424
+ let decryptedMessage;
425
+ if (verificationResult && typeof verificationResult === 'object' && 'payload' in verificationResult) {
426
+ decryptedMessage = verificationResult.payload;
427
+ }
428
+ else {
429
+ decryptedMessage = verificationResult;
430
+ }
431
+ if (enableDiagnosticLogging)
432
+ jacslog(`${logPrefix}: JACS verification successful. Decrypted message: ${JSON.stringify(decryptedMessage).substring(0, 100)}...`);
433
+ messageForSDK = decryptedMessage;
434
+ }
435
+ catch (jacsError) {
436
+ const errorMessage = jacsError instanceof Error ? jacsError.message : "Unknown JACS error";
437
+ if (enableDiagnosticLogging)
438
+ jacslog(`${logPrefix}: Not a JACS artifact, parsing as plain JSON. JACS error was: ${errorMessage}`);
439
+ messageForSDK = JSON.parse(incomingData);
440
+ }
441
+ }
442
+ else {
443
+ if (enableDiagnosticLogging)
444
+ jacslog(`${logPrefix}: JACS not operational, parsing as plain JSON.`);
445
+ messageForSDK = JSON.parse(incomingData);
446
+ }
447
+ }
448
+ else if (typeof incomingData === 'object' && incomingData !== null && 'jsonrpc' in incomingData) {
449
+ if (enableDiagnosticLogging)
450
+ jacslog(`${logPrefix}: Received object from transport, using as-is.`);
451
+ messageForSDK = incomingData;
452
+ }
453
+ else {
454
+ console.error(`${logPrefix}: Unexpected data type from transport:`, typeof incomingData);
455
+ throw new Error("Invalid data type from transport");
456
+ }
457
+ if (enableDiagnosticLogging)
458
+ jacslog(`${logPrefix}: Passing to MCP SDK: ${JSON.stringify(messageForSDK).substring(0, 100)}...`);
459
+ if (this.onmessage) {
460
+ this.onmessage(messageForSDK);
461
+ }
462
+ }
463
+ catch (error) {
464
+ console.error(`${logPrefix}: Error processing incoming message:`, error);
465
+ if (this.onerror)
466
+ this.onerror(error);
467
+ }
468
+ }
469
+ /**
470
+ * Removes null and undefined values from JSON objects to prevent MCP schema validation failures.
471
+ *
472
+ * WORKAROUND for MCP JSON Schema validation issues:
473
+ * - Addresses strict validators (like Anthropic's API) that reject schemas with null values
474
+ * - Handles edge cases where tools have null inputSchema causing client validation errors
475
+ * - Prevents "invalid_type: expected object, received undefined" errors in TypeScript SDK v1.9.0
476
+ * - Cleans up malformed schemas before transmission to avoid -32602 JSON-RPC errors
477
+ *
478
+ * Related issues:
479
+ * - https://github.com/modelcontextprotocol/typescript-sdk/issues/400 (null schema tools)
480
+ * - https://github.com/anthropics/claude-code/issues/586 (Anthropic strict Draft 2020-12)
481
+ * - https://github.com/agno-agi/agno/issues/2791 (missing type field)
482
+ *
483
+ * @param obj - The object to clean (typically MCP tool/resource schemas)
484
+ * @returns A new object with all null/undefined values recursively removed
485
+ */
486
+ removeNullValues(obj) {
487
+ if (obj === null || obj === undefined)
488
+ return undefined;
489
+ if (typeof obj !== 'object')
490
+ return obj;
491
+ if (Array.isArray(obj))
492
+ return obj.map(item => this.removeNullValues(item));
493
+ const cleaned = {};
494
+ for (const [key, value] of Object.entries(obj)) {
495
+ const cleanedValue = this.removeNullValues(value);
496
+ if (cleanedValue !== null && cleanedValue !== undefined) {
497
+ cleaned[key] = cleanedValue;
498
+ }
499
+ }
500
+ return cleaned;
501
+ }
502
+ }
503
+ exports.JACSTransportProxy = JACSTransportProxy;
504
+ // Factory functions
505
+ function createJACSTransportProxy(transport, configPath, role) {
506
+ jacslog(`Creating JACS Transport Proxy for role: ${role}`);
507
+ return new JACSTransportProxy(transport, role, configPath);
508
+ }
509
+ async function createJACSTransportProxyAsync(transport, configPath, role) {
510
+ jacslog(`Creating JACS Transport Proxy (async) for role: ${role}`);
511
+ await ensureJacsLoaded(configPath);
512
+ return new JACSTransportProxy(transport, role, configPath);
513
+ }
514
+ //# sourceMappingURL=mcp.js.map
package/mcp.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.js","sourceRoot":"","sources":["mcp.ts"],"names":[],"mappings":";;;;;;AAufA,4DAOC;A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