@n24q02m/mcp-core 1.13.0-beta.3 → 1.13.0-beta.4

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,584 +0,0 @@
1
- import { spawn } from 'node:child_process';
2
- import { existsSync, readdirSync, readFileSync, statSync, unlinkSync } from 'node:fs';
3
- import * as os from 'node:os';
4
- import { join } from 'node:path';
5
- import * as readline from 'node:readline';
6
- import { isAlive, lockDir, parseLock } from '../lifecycle/lock.js';
7
- import { JWTIssuer } from '../oauth/jwt-issuer.js';
8
- /**
9
- * Return the relay form URL for the alive daemon of `serverName`.
10
- *
11
- * Walks the per-user lock directory, parses the first `<server>-*.lock`
12
- * that contains valid 4/5/6-line metadata, and returns the daemon's root
13
- * URL `http://127.0.0.1:<port>/`. The daemon's `local_oauth_app` serves a
14
- * 302 from `/` to `/authorize?...` with a fresh PKCE challenge.
15
- *
16
- * Throws when no parseable lock file exists for the server. Callers that
17
- * prefer a soft signal should call `daemonIsAlive` first.
18
- */
19
- export function daemonRelayUrl(serverName) {
20
- const dir = lockDir();
21
- if (!existsSync(dir))
22
- throw new Error(`no alive daemon for ${serverName}`);
23
- for (const filename of readdirSync(dir)) {
24
- if (!filename.startsWith(`${serverName}-`) || !filename.endsWith('.lock'))
25
- continue;
26
- try {
27
- const meta = parseLock(readFileSync(join(dir, filename), 'utf-8'));
28
- // Daemon's local_oauth_app serves a 302 from `/` to `/authorize?...` with a
29
- // fresh PKCE challenge — the canonical entry point for the relay form.
30
- // The earlier `/setup?token=` shape pointed to a transient-relay-only route
31
- // that the daemon does NOT register, returning 404 (2026-04-30 Test B).
32
- return `http://127.0.0.1:${meta.port}/`;
33
- }
34
- catch {
35
- // Skip unparseable lock files; try the next match.
36
- }
37
- }
38
- throw new Error(`no alive daemon for ${serverName}`);
39
- }
40
- /**
41
- * Return `true` when at least one parseable lock file for `serverName`
42
- * references a process the OS reports as alive. Used by the Bridge when
43
- * deciding whether `need_setup` envelopes should bridge to a live daemon
44
- * or trigger an auto-respawn.
45
- */
46
- export function daemonIsAlive(serverName) {
47
- const dir = lockDir();
48
- if (!existsSync(dir))
49
- return false;
50
- for (const filename of readdirSync(dir)) {
51
- if (!filename.startsWith(`${serverName}-`) || !filename.endsWith('.lock'))
52
- continue;
53
- try {
54
- const meta = parseLock(readFileSync(join(dir, filename), 'utf-8'));
55
- if (isAlive(meta))
56
- return true;
57
- }
58
- catch {
59
- // Skip unparseable lock files; try the next match.
60
- }
61
- }
62
- return false;
63
- }
64
- /**
65
- * Return the latest known `credState` for `serverName`. Reads the first
66
- * parseable lock file and returns its 5th line. Returns `"unconfigured"`
67
- * if no lock exists, so callers can branch safely on a single string
68
- * without nullable handling.
69
- */
70
- export function daemonCredState(serverName) {
71
- const dir = lockDir();
72
- if (!existsSync(dir))
73
- return 'unconfigured';
74
- // Sort newest-first (by mtime) to match `getActiveDaemon`'s selection order,
75
- // so both functions agree on which lock file is canonical when two coexist
76
- // (I2 fix — previously readdirSync order caused a stale credState read that
77
- // could trigger a redundant eager spawn).
78
- const files = readdirSync(dir)
79
- .filter((f) => f.startsWith(`${serverName}-`) && f.endsWith('.lock'))
80
- .sort((a, b) => {
81
- try {
82
- return statSync(join(dir, b)).mtimeMs - statSync(join(dir, a)).mtimeMs;
83
- }
84
- catch {
85
- return 0;
86
- }
87
- });
88
- for (const filename of files) {
89
- try {
90
- const meta = parseLock(readFileSync(join(dir, filename), 'utf-8'));
91
- return meta.credState;
92
- }
93
- catch {
94
- // Skip unparseable lock files; try the next match.
95
- }
96
- }
97
- return 'unconfigured';
98
- }
99
- /**
100
- * Bridge auto-respawn (D8, Task 1.12).
101
- *
102
- * When a tool call fails because the daemon backing a transparent bridge
103
- * has died, the Bridge spawns a fresh daemon and retries -- but only once
104
- * per `tool_call_id`, so a pathological caller can't infinite-loop the
105
- * spawn path. ``BridgeAutoRespawn`` tracks the per-call cap; the helper
106
- * functions below perform the actual spawn + wait-ready dance.
107
- */
108
- export const MAX_RESPAWN_PER_CALL_ID = 1;
109
- const RESPAWN_TRACK_TTL_MS = 5 * 60_000;
110
- /**
111
- * Per-bridge tracker capping respawn attempts per `tool_call_id`.
112
- *
113
- * A bridge instance keeps one of these for the lifetime of an MCP session.
114
- * Each unique id is allowed exactly `MAX_RESPAWN_PER_CALL_ID` respawn
115
- * attempt; subsequent attempts within `RESPAWN_TRACK_TTL_MS` are rejected
116
- * so a buggy caller can't spawn-storm the daemon. Entries older than the
117
- * TTL are dropped on read so the table doesn't grow without bound.
118
- */
119
- export class BridgeAutoRespawn {
120
- constructor() {
121
- this.respawned = new Map();
122
- }
123
- canRespawn(callId) {
124
- const ts = this.respawned.get(callId);
125
- if (ts === undefined)
126
- return true;
127
- if (Date.now() - ts > RESPAWN_TRACK_TTL_MS) {
128
- this.respawned.delete(callId);
129
- return true;
130
- }
131
- return false;
132
- }
133
- markRespawned(callId) {
134
- this.respawned.set(callId, Date.now());
135
- }
136
- }
137
- /**
138
- * Spawn `uvx <serverName>` detached from the parent process group.
139
- *
140
- * Production wiring intentionally minimal: the daemon publishes its lock
141
- * file as part of normal startup, so callers poll `daemonIsAlive` /
142
- * `daemonRelayUrl` to discover it. Tests stub this via `vi.spyOn` so the
143
- * suite never spawns real subprocesses.
144
- */
145
- function spawnDaemonDetached(serverName) {
146
- const child = spawn('uvx', [serverName], {
147
- detached: true,
148
- stdio: 'ignore',
149
- windowsHide: true
150
- });
151
- child.unref();
152
- }
153
- /**
154
- * Poll `daemonIsAlive` until alive or `timeoutMs` elapses. Mirrors
155
- * the core-py `_wait_daemon_ready` helper.
156
- */
157
- async function waitDaemonReady(serverName, timeoutMs = 60_000) {
158
- const deadline = Date.now() + timeoutMs;
159
- while (Date.now() < deadline) {
160
- if (daemonIsAlive(serverName))
161
- return true;
162
- await new Promise((r) => setTimeout(r, 500));
163
- }
164
- return false;
165
- }
166
- /**
167
- * Async respawn entry point. Production code should prefer this -- it
168
- * waits for the daemon to come back up before resolving with the relay URL.
169
- */
170
- export async function daemonRespawnAsync(serverName) {
171
- if (daemonIsAlive(serverName))
172
- return daemonRelayUrl(serverName);
173
- spawnDaemonDetached(serverName);
174
- if (!(await waitDaemonReady(serverName))) {
175
- throw new Error(`daemon respawn timeout for ${serverName}`);
176
- }
177
- return daemonRelayUrl(serverName);
178
- }
179
- /**
180
- * Synchronous respawn for callers that match the core-py signature.
181
- *
182
- * If a daemon is already alive we return its URL immediately. Otherwise we
183
- * fire-and-forget the spawn and return an empty string -- the caller is
184
- * expected to poll via `daemonIsAlive` / `daemonRelayUrl` (or use
185
- * `daemonRespawnAsync` for the awaitable flow).
186
- */
187
- export function daemonRespawn(serverName) {
188
- if (daemonIsAlive(serverName))
189
- return daemonRelayUrl(serverName);
190
- spawnDaemonDetached(serverName);
191
- return '';
192
- }
193
- function getLocksDir() {
194
- return join(os.homedir(), '.config', 'mcp', 'locks');
195
- }
196
- async function checkHealth(port) {
197
- try {
198
- const res = await fetch(`http://127.0.0.1:${port}/health`, {
199
- signal: AbortSignal.timeout(1000)
200
- });
201
- return res.ok;
202
- }
203
- catch {
204
- return false;
205
- }
206
- }
207
- export async function getActiveDaemon(serverName) {
208
- const locksDir = getLocksDir();
209
- if (!existsSync(locksDir))
210
- return null;
211
- const files = readdirSync(locksDir)
212
- .filter((f) => f.startsWith(`${serverName}-`) && f.endsWith('.lock'))
213
- .map((f) => join(locksDir, f));
214
- files.sort((a, b) => {
215
- try {
216
- return statSync(b).mtimeMs - statSync(a).mtimeMs;
217
- }
218
- catch {
219
- return 0;
220
- }
221
- });
222
- for (const lockPath of files) {
223
- try {
224
- const content = readFileSync(lockPath, 'utf-8').trim();
225
- const lines = content.split('\n');
226
- if (lines.length < 2)
227
- continue;
228
- const port = parseInt(lines[1].trim(), 10);
229
- const token = lines.length > 2 ? lines[2].trim() : '';
230
- const isAlive = await checkHealth(port);
231
- if (isAlive) {
232
- return { port, token };
233
- }
234
- else {
235
- try {
236
- unlinkSync(lockPath);
237
- }
238
- catch { }
239
- }
240
- }
241
- catch { }
242
- }
243
- return null;
244
- }
245
- function parseSseMessages(text) {
246
- const messages = [];
247
- const lines = text.split('\n');
248
- let currentEvent = 'message';
249
- let dataLines = [];
250
- for (const rawLine of lines) {
251
- const line = rawLine.replace(/\r$/, '');
252
- if (line.startsWith('event:')) {
253
- if (dataLines.length > 0 && currentEvent === 'message') {
254
- messages.push(dataLines.join('\n'));
255
- }
256
- currentEvent = line.slice(6).trim();
257
- dataLines = [];
258
- }
259
- else if (line.startsWith('data:')) {
260
- dataLines.push(line.slice(5).trim());
261
- }
262
- else if (line === '') {
263
- if (dataLines.length > 0 && currentEvent === 'message') {
264
- messages.push(dataLines.join('\n'));
265
- }
266
- currentEvent = 'message';
267
- dataLines = [];
268
- }
269
- }
270
- if (dataLines.length > 0 && currentEvent === 'message') {
271
- messages.push(dataLines.join('\n'));
272
- }
273
- return messages;
274
- }
275
- class SseParser {
276
- constructor() {
277
- this.buffer = '';
278
- this.currentEvent = { dataLines: [] };
279
- this.messageHandlers = [];
280
- this.messageQueue = [];
281
- this.firstEventReceived = false;
282
- this.firstEventPromise = new Promise((resolve) => {
283
- this.firstEventResolve = resolve;
284
- });
285
- }
286
- feed(chunk) {
287
- this.buffer += chunk;
288
- const lines = this.buffer.split('\n');
289
- this.buffer = lines.pop() || '';
290
- for (const rawLine of lines) {
291
- const line = rawLine.replace(/\r$/, '');
292
- if (line.startsWith('event:')) {
293
- this.currentEvent.event = line.slice(6).trim();
294
- }
295
- else if (line.startsWith('data:')) {
296
- this.currentEvent.dataLines.push(line.slice(5).trim());
297
- }
298
- else if (line === '') {
299
- this.dispatchEvent();
300
- this.currentEvent = { dataLines: [] };
301
- }
302
- }
303
- }
304
- dispatchEvent() {
305
- const data = this.currentEvent.dataLines.join('\n');
306
- const eventName = this.currentEvent.event || 'message';
307
- if (!this.firstEventReceived && data) {
308
- this.firstEventReceived = true;
309
- this.firstEventResolve({ type: eventName, data });
310
- }
311
- if (eventName === 'message' && data) {
312
- this.messageQueue.push(data);
313
- this.flushMessages();
314
- }
315
- }
316
- flushMessages() {
317
- while (this.messageQueue.length > 0 && this.messageHandlers.length > 0) {
318
- const data = this.messageQueue.shift();
319
- for (const handler of this.messageHandlers) {
320
- handler(data);
321
- }
322
- }
323
- }
324
- waitForFirstEvent() {
325
- return this.firstEventPromise;
326
- }
327
- onMessage(handler) {
328
- this.messageHandlers.push(handler);
329
- this.flushMessages();
330
- }
331
- }
332
- /**
333
- * Forward a single JSON-RPC message from daemon stdout to bridge stdout.
334
- *
335
- * Extracted from the inline write calls in `runSmartStdioProxy` so the
336
- * forwarding behaviour can be unit-tested independently (D19). The helper
337
- * is a dumb pipe — it passes every frame through unchanged, including
338
- * `notifications/tools/list_changed` server-initiated notifications.
339
- *
340
- * Synchronous by design: the `writer` call is synchronous and making this
341
- * function `async` only converts EPIPE throws into unhandled promise
342
- * rejections (I1 fix). EPIPE is caught here and causes a clean exit, because
343
- * EPIPE on `process.stdout` means the MCP client closed its stdin and the
344
- * proxy should terminate gracefully.
345
- */
346
- export function forwardDaemonMessageToBridge(message, writer) {
347
- try {
348
- writer(message.endsWith('\n') ? message : `${message}\n`);
349
- }
350
- catch (err) {
351
- if (err?.code === 'EPIPE') {
352
- process.exit(0);
353
- }
354
- throw err;
355
- }
356
- }
357
- export async function runSmartStdioProxy(serverName, daemonCmd, options = {}) {
358
- const startupTimeout = options.startupTimeout ?? 15000;
359
- let daemon = await getActiveDaemon(serverName);
360
- if (!daemon) {
361
- process.stderr.write(`[stdio-proxy] No active daemon for '${serverName}'. Spawning...\n`);
362
- const [cmd, ...args] = daemonCmd;
363
- // Strip stdio-mode env vars from inherited environment before passing to
364
- // the detached daemon. Without this, the daemon inherits MCP_TRANSPORT=stdio
365
- // (or TRANSPORT_MODE=stdio) from the bridge process, re-enters runSmartStdioProxy
366
- // in its own main(), and fork-bombs spawning daemons recursively until the OS
367
- // exhausts handles. Daemons must run in HTTP mode — they are the backend the
368
- // bridge connects to. Mirrors core-py smart_stdio.py `_spawn_daemon` env strip.
369
- const cleanEnv = Object.fromEntries(Object.entries(process.env).filter(([k]) => k !== 'MCP_TRANSPORT' && k !== 'TRANSPORT_MODE'));
370
- const child = spawn(cmd, args, {
371
- detached: true,
372
- stdio: 'ignore',
373
- windowsHide: true,
374
- env: options.env ? { ...cleanEnv, ...options.env } : cleanEnv
375
- });
376
- child.unref();
377
- const deadline = Date.now() + startupTimeout;
378
- while (Date.now() < deadline) {
379
- daemon = await getActiveDaemon(serverName);
380
- if (daemon)
381
- break;
382
- await new Promise((r) => setTimeout(r, 150));
383
- }
384
- if (!daemon) {
385
- process.stderr.write(`[stdio-proxy] Daemon for '${serverName}' did not start within ${Math.round(startupTimeout / 1000)}s. Aborting.\n`);
386
- return 1;
387
- }
388
- }
389
- const url = `http://127.0.0.1:${daemon.port}/mcp`;
390
- process.stderr.write(`[stdio-proxy] Connected to daemon at ${url}\n`);
391
- let authToken = daemon.token;
392
- if (!authToken) {
393
- const issuer = new JWTIssuer(serverName);
394
- await issuer.init();
395
- authToken = await issuer.issueAccessToken('stdio-proxy', 365 * 24 * 3600);
396
- process.stderr.write(`[stdio-proxy] Lock token missing; generated proxy token for '${serverName}'.\n`);
397
- }
398
- const rl = readline.createInterface({
399
- input: process.stdin,
400
- terminal: false
401
- });
402
- const postHeaders = {
403
- 'Content-Type': 'application/json',
404
- Accept: 'application/json, text/event-stream'
405
- };
406
- if (authToken) {
407
- postHeaders['Authorization'] = `Bearer ${authToken}`;
408
- }
409
- let endpointUrl = null;
410
- let isStateless = false;
411
- let modeDetermined = false;
412
- let activeSseBody = null;
413
- try {
414
- for await (const line of rl) {
415
- if (!line.trim())
416
- continue;
417
- if (!modeDetermined) {
418
- const res = await fetch(url, {
419
- method: 'POST',
420
- headers: postHeaders,
421
- body: line + '\n'
422
- });
423
- if (!res.ok) {
424
- process.stderr.write(`[stdio-proxy] HTTP error: ${res.status} ${res.statusText}\n`);
425
- return 2;
426
- }
427
- const contentType = res.headers.get('content-type') || '';
428
- const isSse = contentType.includes('text/event-stream');
429
- if (!isSse) {
430
- const bodyText = await res.text();
431
- forwardDaemonMessageToBridge(bodyText, (s) => process.stdout.write(s));
432
- isStateless = true;
433
- modeDetermined = true;
434
- process.stderr.write(`[stdio-proxy] Stateless mode detected (plain JSON response)\n`);
435
- continue;
436
- }
437
- if (!res.body) {
438
- process.stderr.write(`[stdio-proxy] No response body from SSE connection\n`);
439
- return 2;
440
- }
441
- // Streamable HTTP (newer MCP transport spec) sends the session id as
442
- // an HTTP response header on the initialize response. Older HTTP+SSE
443
- // transport instead encodes the session id inside an "endpoint" SSE
444
- // event. Detect Streamable HTTP first; the daemon returns 400 on
445
- // subsequent POSTs without `Mcp-Session-Id`, so silently treating
446
- // sessionful Streamable HTTP as stateless leaves the proxy stuck.
447
- const sessionIdHeader = res.headers.get('mcp-session-id');
448
- if (sessionIdHeader) {
449
- postHeaders['Mcp-Session-Id'] = sessionIdHeader;
450
- endpointUrl = url;
451
- modeDetermined = true;
452
- process.stderr.write(`[stdio-proxy] Streamable HTTP session: ${sessionIdHeader}\n`);
453
- activeSseBody = res.body;
454
- const parser = new SseParser();
455
- const reader = res.body.getReader();
456
- const decoder = new TextDecoder();
457
- parser.onMessage((data) => {
458
- void forwardDaemonMessageToBridge(data, (s) => process.stdout.write(s));
459
- });
460
- const readSsePromise = (async () => {
461
- try {
462
- while (true) {
463
- const { done, value } = await reader.read();
464
- if (done)
465
- break;
466
- parser.feed(decoder.decode(value, { stream: true }));
467
- }
468
- }
469
- catch (e) {
470
- process.stderr.write(`[stdio-proxy] SSE error: ${e}\n`);
471
- }
472
- })();
473
- // Drain the initialize-response SSE body before reading the next
474
- // stdin line, so we don't lose the response or starve the client.
475
- try {
476
- await readSsePromise;
477
- }
478
- catch { }
479
- activeSseBody = null;
480
- continue;
481
- }
482
- activeSseBody = res.body;
483
- const parser = new SseParser();
484
- const reader = res.body.getReader();
485
- const decoder = new TextDecoder();
486
- const readSsePromise = (async () => {
487
- try {
488
- while (true) {
489
- const { done, value } = await reader.read();
490
- if (done)
491
- break;
492
- parser.feed(decoder.decode(value, { stream: true }));
493
- }
494
- }
495
- catch (e) {
496
- process.stderr.write(`[stdio-proxy] SSE error: ${e}\n`);
497
- }
498
- })();
499
- const firstEvent = await parser.waitForFirstEvent();
500
- if (firstEvent.type === 'endpoint') {
501
- endpointUrl = new URL(firstEvent.data, url).href;
502
- const sessionId = new URL(endpointUrl).searchParams.get('sessionId');
503
- if (sessionId) {
504
- postHeaders['MCP-Session-ID'] = sessionId;
505
- }
506
- process.stderr.write(`[stdio-proxy] Session endpoint: ${endpointUrl}\n`);
507
- parser.onMessage((data) => {
508
- void forwardDaemonMessageToBridge(data, (s) => process.stdout.write(s));
509
- });
510
- void readSsePromise;
511
- modeDetermined = true;
512
- continue;
513
- }
514
- else {
515
- forwardDaemonMessageToBridge(firstEvent.data, (s) => process.stdout.write(s));
516
- isStateless = true;
517
- modeDetermined = true;
518
- process.stderr.write(`[stdio-proxy] Stateless mode detected (SSE message event)\n`);
519
- // Cancel the SSE body BEFORE awaiting the reader promise. Otherwise,
520
- // a daemon that keeps the SSE connection open (typical for stateless
521
- // streamable HTTP) will cause `readSsePromise` to never resolve,
522
- // hanging the readline loop and starving the stdio client. Cancelling
523
- // first signals `done=true` to the reader so the promise resolves.
524
- if (activeSseBody) {
525
- await activeSseBody.cancel().catch(() => { });
526
- activeSseBody = null;
527
- }
528
- try {
529
- await readSsePromise;
530
- }
531
- catch { }
532
- continue;
533
- }
534
- }
535
- const targetUrl = isStateless ? url : endpointUrl;
536
- if (!isStateless && !endpointUrl) {
537
- process.stderr.write(`[stdio-proxy] Session endpoint not established.\n`);
538
- return 2;
539
- }
540
- if (daemon?.token) {
541
- postHeaders['Authorization'] = `Bearer ${daemon.token}`;
542
- }
543
- try {
544
- const res = await fetch(targetUrl, {
545
- method: 'POST',
546
- headers: postHeaders,
547
- body: line + '\n'
548
- });
549
- if (!res.ok) {
550
- process.stderr.write(`[stdio-proxy] HTTP error: ${res.status} ${res.statusText}\n`);
551
- return 2;
552
- }
553
- const contentType = res.headers.get('content-type') || '';
554
- if (contentType.includes('text/event-stream')) {
555
- const bodyText = await res.text();
556
- const messages = parseSseMessages(bodyText);
557
- for (const msg of messages) {
558
- forwardDaemonMessageToBridge(msg, (s) => process.stdout.write(s));
559
- }
560
- }
561
- else {
562
- const bodyText = await res.text();
563
- forwardDaemonMessageToBridge(bodyText, (s) => process.stdout.write(s));
564
- }
565
- }
566
- catch (e) {
567
- process.stderr.write(`[stdio-proxy] Daemon '${serverName}' died unexpectedly.\n`);
568
- return 2;
569
- }
570
- }
571
- return 0;
572
- }
573
- catch (e) {
574
- process.stderr.write(`[stdio-proxy] Connection failed: ${e}\n`);
575
- return 2;
576
- }
577
- finally {
578
- if (activeSseBody) {
579
- await activeSseBody.cancel().catch(() => { });
580
- }
581
- rl.close();
582
- }
583
- }
584
- //# sourceMappingURL=smart-stdio.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"smart-stdio.js","sourceRoot":"","sources":["../../src/transport/smart-stdio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACrF,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AAEzC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAElD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc,CAAC,UAAkB;IAC/C,MAAM,GAAG,GAAG,OAAO,EAAE,CAAA;IACrB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,MAAM,IAAI,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