nebula-notebook-mcp 0.1.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.
Files changed (72) hide show
  1. package/README.md +314 -0
  2. package/bin/nebula-mcp.js +10 -0
  3. package/dist/circuit-breaker.d.ts +157 -0
  4. package/dist/circuit-breaker.d.ts.map +1 -0
  5. package/dist/circuit-breaker.js +237 -0
  6. package/dist/circuit-breaker.js.map +1 -0
  7. package/dist/errors.d.ts +72 -0
  8. package/dist/errors.d.ts.map +1 -0
  9. package/dist/errors.js +314 -0
  10. package/dist/errors.js.map +1 -0
  11. package/dist/index.d.ts +13 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +41 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/mcp/index.d.ts +8 -0
  16. package/dist/mcp/index.d.ts.map +1 -0
  17. package/dist/mcp/index.js +13 -0
  18. package/dist/mcp/index.js.map +1 -0
  19. package/dist/mcp/server.d.ts +31 -0
  20. package/dist/mcp/server.d.ts.map +1 -0
  21. package/dist/mcp/server.js +237 -0
  22. package/dist/mcp/server.js.map +1 -0
  23. package/dist/notebook/client.d.ts +643 -0
  24. package/dist/notebook/client.d.ts.map +1 -0
  25. package/dist/notebook/client.js +1720 -0
  26. package/dist/notebook/client.js.map +1 -0
  27. package/dist/notebook/index.d.ts +6 -0
  28. package/dist/notebook/index.d.ts.map +1 -0
  29. package/dist/notebook/index.js +6 -0
  30. package/dist/notebook/index.js.map +1 -0
  31. package/dist/notebook/tools.d.ts +244 -0
  32. package/dist/notebook/tools.d.ts.map +1 -0
  33. package/dist/notebook/tools.js +279 -0
  34. package/dist/notebook/tools.js.map +1 -0
  35. package/dist/tools/execution.d.ts +38 -0
  36. package/dist/tools/execution.d.ts.map +1 -0
  37. package/dist/tools/execution.js +116 -0
  38. package/dist/tools/execution.js.map +1 -0
  39. package/dist/tools/files.d.ts +70 -0
  40. package/dist/tools/files.d.ts.map +1 -0
  41. package/dist/tools/files.js +286 -0
  42. package/dist/tools/files.js.map +1 -0
  43. package/dist/tools/index.d.ts +74 -0
  44. package/dist/tools/index.d.ts.map +1 -0
  45. package/dist/tools/index.js +217 -0
  46. package/dist/tools/index.js.map +1 -0
  47. package/dist/tools/kernel.d.ts +36 -0
  48. package/dist/tools/kernel.d.ts.map +1 -0
  49. package/dist/tools/kernel.js +182 -0
  50. package/dist/tools/kernel.js.map +1 -0
  51. package/dist/tools/notebook.d.ts +252 -0
  52. package/dist/tools/notebook.d.ts.map +1 -0
  53. package/dist/tools/notebook.js +1089 -0
  54. package/dist/tools/notebook.js.map +1 -0
  55. package/dist/tools/types.d.ts +78 -0
  56. package/dist/tools/types.d.ts.map +1 -0
  57. package/dist/tools/types.js +8 -0
  58. package/dist/tools/types.js.map +1 -0
  59. package/dist/types.d.ts +473 -0
  60. package/dist/types.d.ts.map +1 -0
  61. package/dist/types.js +5 -0
  62. package/dist/types.js.map +1 -0
  63. package/dist/utils/imageResize.d.ts +24 -0
  64. package/dist/utils/imageResize.d.ts.map +1 -0
  65. package/dist/utils/imageResize.js +67 -0
  66. package/dist/utils/imageResize.js.map +1 -0
  67. package/dist/utils/polling.d.ts +40 -0
  68. package/dist/utils/polling.d.ts.map +1 -0
  69. package/dist/utils/polling.js +49 -0
  70. package/dist/utils/polling.js.map +1 -0
  71. package/package.json +61 -0
  72. package/setup-mcp.js +468 -0
package/dist/index.js ADDED
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Nebula MCP tools and client library.
3
+ *
4
+ * This package is installable on the agent/client machine and talks to a
5
+ * running Nebula Notebook server over HTTP/WebSocket.
6
+ */
7
+ // =============================================================================
8
+ // Core Types
9
+ // =============================================================================
10
+ export * from './types.js';
11
+ // =============================================================================
12
+ // Error Handling
13
+ // =============================================================================
14
+ export { classifyError, getErrorMessage, formatErrorMessage, shouldRetry, calculateRetryDelay, ErrorCategory, } from './errors.js';
15
+ // =============================================================================
16
+ // Circuit Breaker
17
+ // =============================================================================
18
+ export { CircuitBreaker, createCircuitBreaker, CircuitState, } from './circuit-breaker.js';
19
+ // =============================================================================
20
+ // Nebula Client
21
+ // =============================================================================
22
+ export { NebulaClient, createNebulaClient, } from './notebook/client.js';
23
+ // =============================================================================
24
+ // Unified Tools (single source of truth)
25
+ // =============================================================================
26
+ export {
27
+ // Tool collections
28
+ allTools, toolsByName, toolCategories, notebookTools, kernelTools, executionTools,
29
+ // Tool utilities
30
+ getToolDefinitions, executeToolByName, executeToolForMCP, getTool, hasTool, getToolNamesByCategory,
31
+ // Individual notebook tools
32
+ readNotebookTool, readCellTool, readOutputTool, insertCellTool, updateCellTool, deleteCellTool, createNotebookTool, moveCellTool, duplicateCellTool, searchCellsTool, updateMetadataTool,
33
+ // Individual kernel tools
34
+ listKernelsTool, kernelStartTool, kernelStopTool, kernelRestartTool, kernelInterruptTool,
35
+ // Individual execution tools
36
+ executeCellTool, } from './tools/index.js';
37
+ // =============================================================================
38
+ // Legacy exports (for backwards compatibility)
39
+ // =============================================================================
40
+ export { readNotebookCells, writeNotebookCell, executeCell, searchNotebookCells, readCellsToolDefinition, writeCellToolDefinition, executeCellToolDefinition, searchCellsToolDefinition, } from './notebook/tools.js';
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,gFAAgF;AAChF,aAAa;AACb,gFAAgF;AAChF,cAAc,YAAY,CAAC;AAE3B,gFAAgF;AAChF,iBAAiB;AACjB,gFAAgF;AAChF,OAAO,EACL,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,aAAa,GAGd,MAAM,aAAa,CAAC;AAErB,gFAAgF;AAChF,kBAAkB;AAClB,gFAAgF;AAChF,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,YAAY,GAKb,MAAM,sBAAsB,CAAC;AAE9B,gFAAgF;AAChF,gBAAgB;AAChB,gFAAgF;AAChF,OAAO,EACL,YAAY,EACZ,kBAAkB,GAKnB,MAAM,sBAAsB,CAAC;AAE9B,gFAAgF;AAChF,yCAAyC;AACzC,gFAAgF;AAChF,OAAO;AAOL,mBAAmB;AACnB,QAAQ,EACR,WAAW,EACX,cAAc,EACd,aAAa,EACb,WAAW,EACX,cAAc;AAEd,iBAAiB;AACjB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,OAAO,EACP,OAAO,EACP,sBAAsB;AAEtB,4BAA4B;AAC5B,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,kBAAkB;AAElB,0BAA0B;AAC1B,eAAe,EACf,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,mBAAmB;AAEnB,6BAA6B;AAC7B,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAE1B,gFAAgF;AAChF,+CAA+C;AAC/C,gFAAgF;AAChF,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,GAQ1B,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Nebula MCP Server - Entry Point
3
+ *
4
+ * Exposes Nebula Notebook functionality via Model Context Protocol
5
+ * for use with Claude Desktop, Cursor, and other MCP clients.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Nebula MCP Server - Entry Point
3
+ *
4
+ * Exposes Nebula Notebook functionality via Model Context Protocol
5
+ * for use with Claude Desktop, Cursor, and other MCP clients.
6
+ */
7
+ import { NebulaMCPServer } from './server.js';
8
+ const server = new NebulaMCPServer();
9
+ server.start().catch((error) => {
10
+ console.error('Failed to start Nebula MCP server:', error);
11
+ process.exit(1);
12
+ });
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;AACrC,MAAM,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IAC7B,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;IAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Nebula MCP Server
3
+ *
4
+ * Thin wrapper around the unified tools module.
5
+ * Implements the Model Context Protocol over stdio (JSON-RPC 2.0).
6
+ */
7
+ import { NebulaClient } from '../notebook/client.js';
8
+ export declare class NebulaMCPServer {
9
+ private client;
10
+ private currentUrl;
11
+ private agentId;
12
+ private clientName;
13
+ private clientVersion;
14
+ private hasConnected;
15
+ private readonly supportedProtocols;
16
+ private readonly defaultProtocol;
17
+ constructor();
18
+ /**
19
+ * Connect to a Nebula server
20
+ * All subsequent operations will use this connection
21
+ */
22
+ connectToServer(baseUrl: string): void;
23
+ /**
24
+ * Get the current active client
25
+ */
26
+ getClient(): NebulaClient;
27
+ private handleRequest;
28
+ private handleToolCall;
29
+ start(): Promise<void>;
30
+ }
31
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAiBrD,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAyC;IAC5E,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgB;;IA6BhD;;;OAGG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAqBtC;;OAEG;IACH,SAAS,IAAI,YAAY;YAIX,aAAa;YA+Fb,cAAc;IAgDtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CA2C7B"}
@@ -0,0 +1,237 @@
1
+ /**
2
+ * Nebula MCP Server
3
+ *
4
+ * Thin wrapper around the unified tools module.
5
+ * Implements the Model Context Protocol over stdio (JSON-RPC 2.0).
6
+ */
7
+ import * as readline from 'readline';
8
+ import { randomUUID } from 'crypto';
9
+ import { NebulaClient } from '../notebook/client.js';
10
+ import { getToolDefinitions, executeToolForMCP } from '../tools/index.js';
11
+ export class NebulaMCPServer {
12
+ client;
13
+ currentUrl;
14
+ agentId;
15
+ clientName;
16
+ clientVersion;
17
+ hasConnected;
18
+ supportedProtocols = ['2025-06-18', '2024-11-05'];
19
+ defaultProtocol = '2024-11-05';
20
+ constructor() {
21
+ // Intentionally start "disconnected": callers must explicitly choose a server
22
+ // via connect_server(base_url=...). This avoids accidental writes to the wrong
23
+ // instance when multiple Nebula servers are in use.
24
+ this.currentUrl = '';
25
+ this.agentId = randomUUID();
26
+ // clientName will be set from MCP initialize handshake
27
+ this.clientName = 'MCP Agent';
28
+ this.clientVersion = '0.1.0';
29
+ this.hasConnected = false;
30
+ this.client = new NebulaClient({
31
+ // Placeholder until connect_server is called. We never execute tools without
32
+ // an explicit connect_server, so this is safe.
33
+ baseUrl: this.currentUrl || 'http://127.0.0.1:0',
34
+ agentId: this.agentId,
35
+ clientName: this.clientName,
36
+ clientVersion: this.clientVersion,
37
+ autoStartAgentSession: true,
38
+ });
39
+ // Log configuration on startup (to stderr, not stdout which is for JSON-RPC)
40
+ console.error(`[Nebula MCP] Agent ID: ${this.agentId.slice(0, 8)}`);
41
+ if (process.env.NEBULA_URL) {
42
+ console.error(`[Nebula MCP] Note: NEBULA_URL is ignored. Use connect_server(base_url=...) instead.`);
43
+ }
44
+ }
45
+ /**
46
+ * Connect to a Nebula server
47
+ * All subsequent operations will use this connection
48
+ */
49
+ connectToServer(baseUrl) {
50
+ const url = baseUrl;
51
+ if (!url || typeof url !== 'string') {
52
+ throw new Error('connect_server requires base_url');
53
+ }
54
+ if (url !== this.currentUrl) {
55
+ this.currentUrl = url;
56
+ this.client = new NebulaClient({
57
+ baseUrl: url,
58
+ agentId: this.agentId,
59
+ clientName: this.clientName,
60
+ clientVersion: this.clientVersion,
61
+ autoStartAgentSession: true,
62
+ });
63
+ console.error(`[Nebula MCP] Connected to: ${url}`);
64
+ }
65
+ else {
66
+ console.error(`[Nebula MCP] Already connected to: ${url}`);
67
+ }
68
+ this.hasConnected = true;
69
+ }
70
+ /**
71
+ * Get the current active client
72
+ */
73
+ getClient() {
74
+ return this.client;
75
+ }
76
+ async handleRequest(request) {
77
+ const { id, method, params } = request;
78
+ const responseId = id ?? 0;
79
+ try {
80
+ let result;
81
+ switch (method) {
82
+ case 'initialize':
83
+ {
84
+ const requestedProtocol = params && typeof params.protocolVersion === 'string'
85
+ ? params.protocolVersion
86
+ : undefined;
87
+ const protocolVersion = requestedProtocol && this.supportedProtocols.includes(requestedProtocol)
88
+ ? requestedProtocol
89
+ : this.defaultProtocol;
90
+ if (requestedProtocol && requestedProtocol !== protocolVersion) {
91
+ console.error(`[Nebula MCP] Unsupported protocolVersion "${requestedProtocol}", falling back to ${protocolVersion}`);
92
+ }
93
+ // Capture client info from MCP handshake
94
+ // Debug: log entire params to see what client sends
95
+ console.error(`[Nebula MCP] Initialize params:`, JSON.stringify(params, null, 2));
96
+ const clientInfo = params?.clientInfo;
97
+ if (clientInfo?.name) {
98
+ this.clientName = clientInfo.name;
99
+ this.clientVersion = clientInfo.version || '0.0.0';
100
+ // Recreate client with actual client name
101
+ this.client = new NebulaClient({
102
+ baseUrl: this.currentUrl,
103
+ agentId: this.agentId,
104
+ clientName: this.clientName,
105
+ clientVersion: this.clientVersion,
106
+ autoStartAgentSession: true,
107
+ });
108
+ console.error(`[Nebula MCP] Client identified: ${this.clientName} v${this.clientVersion}`);
109
+ }
110
+ result = {
111
+ protocolVersion,
112
+ serverInfo: { name: 'nebula-notebook-mcp', version: '0.1.0' },
113
+ capabilities: { tools: {} },
114
+ };
115
+ }
116
+ break;
117
+ case 'tools/list':
118
+ // Get tool definitions from the unified tools module
119
+ {
120
+ const connectNote = ' MCP: call connect_server first (see connect_server for workflow).';
121
+ const tools = getToolDefinitions().map(def => {
122
+ if (def.name === 'connect_server') {
123
+ return def;
124
+ }
125
+ return {
126
+ ...def,
127
+ description: `${def.description ?? ''}${connectNote}`,
128
+ };
129
+ });
130
+ result = { tools };
131
+ }
132
+ break;
133
+ case 'tools/call':
134
+ // Execute tool using the unified executor
135
+ result = await this.handleToolCall(params);
136
+ break;
137
+ case 'notifications/initialized':
138
+ // Client notification, no response needed
139
+ return null;
140
+ default:
141
+ return {
142
+ jsonrpc: '2.0',
143
+ id: responseId,
144
+ error: { code: -32601, message: `Method not found: ${method}` },
145
+ };
146
+ }
147
+ return { jsonrpc: '2.0', id: responseId, result };
148
+ }
149
+ catch (error) {
150
+ const message = error instanceof Error ? error.message : String(error);
151
+ return {
152
+ jsonrpc: '2.0',
153
+ id: responseId,
154
+ error: { code: -32603, message: `Internal error: ${message}` },
155
+ };
156
+ }
157
+ }
158
+ async handleToolCall(params) {
159
+ const { name, arguments: args = {} } = params;
160
+ // Log tool execution (helps with debugging)
161
+ console.error(`[Nebula MCP] Executing tool: ${name}`);
162
+ try {
163
+ // Special handling for connect_server
164
+ if (name === 'connect_server') {
165
+ const { base_url } = args;
166
+ if (!base_url || typeof base_url !== 'string' || base_url.trim() === '') {
167
+ return {
168
+ content: [{ type: 'text', text: 'Error: connect_server requires base_url (e.g., http://localhost:3000).' }],
169
+ isError: true,
170
+ };
171
+ }
172
+ this.connectToServer(base_url);
173
+ return { content: [{ type: 'text', text: `Connected to ${this.currentUrl}` }] };
174
+ }
175
+ if (!this.hasConnected) {
176
+ return {
177
+ content: [
178
+ {
179
+ type: 'text',
180
+ text: 'Error: connect_server(base_url=...) must be called once at the start of every MCP session before any other tool call.',
181
+ },
182
+ ],
183
+ isError: true,
184
+ };
185
+ }
186
+ // Delegate to the unified tool executor with current client
187
+ const result = await executeToolForMCP(name, args, this.client);
188
+ if (result.isError) {
189
+ console.error(`[Nebula MCP] Tool ${name} failed: ${JSON.stringify(result.content)}`);
190
+ }
191
+ return result;
192
+ }
193
+ catch (error) {
194
+ const message = error instanceof Error ? error.message : String(error);
195
+ console.error(`[Nebula MCP] Tool ${name} error: ${message}`);
196
+ throw error;
197
+ }
198
+ }
199
+ async start() {
200
+ const rl = readline.createInterface({
201
+ input: process.stdin,
202
+ output: process.stdout,
203
+ terminal: false,
204
+ });
205
+ console.error('='.repeat(60));
206
+ console.error('Nebula MCP Server Started');
207
+ console.error('No server connected yet.');
208
+ console.error('Call connect_server(base_url=...) before using any other tool.');
209
+ console.error(`Protocol: Model Context Protocol (MCP) ${this.defaultProtocol} (supports ${this.supportedProtocols.join(', ')})`);
210
+ console.error('='.repeat(60));
211
+ // Read JSON-RPC messages from stdin
212
+ rl.on('line', async (line) => {
213
+ try {
214
+ const request = JSON.parse(line);
215
+ const response = await this.handleRequest(request);
216
+ if (response) {
217
+ // Write response to stdout
218
+ process.stdout.write(JSON.stringify(response) + '\n');
219
+ }
220
+ }
221
+ catch (error) {
222
+ // Invalid JSON, send parse error
223
+ const response = {
224
+ jsonrpc: '2.0',
225
+ id: 0,
226
+ error: { code: -32700, message: 'Parse error' },
227
+ };
228
+ process.stdout.write(JSON.stringify(response) + '\n');
229
+ }
230
+ });
231
+ rl.on('close', () => {
232
+ console.error('Nebula MCP server stopped');
233
+ process.exit(0);
234
+ });
235
+ }
236
+ }
237
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAgB1E,MAAM,OAAO,eAAe;IAClB,MAAM,CAAe;IACrB,UAAU,CAAS;IACnB,OAAO,CAAS;IAChB,UAAU,CAAS;IACnB,aAAa,CAAS;IACtB,YAAY,CAAU;IACb,kBAAkB,GAAG,CAAC,YAAY,EAAE,YAAY,CAAU,CAAC;IAC3D,eAAe,GAAG,YAAY,CAAC;IAEhD;QACE,8EAA8E;QAC9E,+EAA+E;QAC/E,oDAAoD;QACpD,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,UAAU,EAAE,CAAC;QAC5B,uDAAuD;QACvD,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC;QAC9B,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,YAAY,CAAC;YAC7B,6EAA6E;YAC7E,+CAA+C;YAC/C,OAAO,EAAE,IAAI,CAAC,UAAU,IAAI,oBAAoB;YAChD,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,qBAAqB,EAAE,IAAI;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