@cloudflare/sandbox 0.0.0-0b4cc05 → 0.0.0-104f455

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/dist/index.js CHANGED
@@ -13,36 +13,46 @@ import {
13
13
  UtilityClient,
14
14
  getSandbox,
15
15
  proxyToSandbox
16
- } from "./chunk-U2M5GSMU.js";
16
+ } from "./chunk-2P3MDMNJ.js";
17
17
  import {
18
- CodeInterpreter
19
- } from "./chunk-BCJ7SF3Q.js";
18
+ CodeInterpreter,
19
+ Execution,
20
+ LogLevel,
21
+ ResultImpl,
22
+ TraceContext,
23
+ createLogger,
24
+ createNoOpLogger,
25
+ getLogger,
26
+ isExecResult,
27
+ isProcess,
28
+ isProcessStatus,
29
+ runWithLogger
30
+ } from "./chunk-JXZMAU2C.js";
20
31
  import "./chunk-Z532A7QC.js";
21
32
  import {
22
33
  asyncIterableToSSEStream,
23
34
  parseSSEStream,
24
35
  responseToAsyncIterable
25
36
  } from "./chunk-EKSWCBCA.js";
26
-
27
- // src/index.ts
28
- export * from "@repo/shared";
29
- import {
30
- isExecResult,
31
- isProcess,
32
- isProcessStatus
33
- } from "@repo/shared";
34
37
  export {
35
38
  CodeInterpreter,
36
39
  CommandClient,
40
+ Execution,
37
41
  FileClient,
38
42
  GitClient,
43
+ LogLevel as LogLevelEnum,
39
44
  PortClient,
40
45
  ProcessClient,
46
+ ResultImpl,
41
47
  Sandbox,
42
48
  SandboxClient,
49
+ TraceContext,
43
50
  UtilityClient,
44
51
  asyncIterableToSSEStream,
45
52
  collectFile,
53
+ createLogger,
54
+ createNoOpLogger,
55
+ getLogger,
46
56
  getSandbox,
47
57
  isExecResult,
48
58
  isProcess,
@@ -50,6 +60,7 @@ export {
50
60
  parseSSEStream,
51
61
  proxyToSandbox,
52
62
  responseToAsyncIterable,
63
+ runWithLogger,
53
64
  streamFile
54
65
  };
55
66
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Export the main Sandbox class and utilities\n\n\n// Export the new client architecture\nexport {\n CommandClient,\n FileClient,\n GitClient,\n PortClient,\n ProcessClient,\n SandboxClient,\n UtilityClient\n} from \"./clients\";\nexport { getSandbox, Sandbox } from \"./sandbox\";\n\n// Legacy types are now imported from the new client architecture\n\n// Export core SDK types for consumers\nexport type {\n BaseExecOptions,\n ExecEvent,\n ExecOptions,\n ExecResult,FileChunk, FileMetadata, FileStreamEvent, \n ISandbox,\n LogEvent,\n Process,\n ProcessOptions,\n ProcessStatus,\n StreamOptions \n} from \"@repo/shared\";\nexport * from '@repo/shared';\n// Export type guards for runtime validation\nexport {\n isExecResult,\n isProcess,\n isProcessStatus\n} from \"@repo/shared\";\n// Export all client types from new architecture\nexport type {\n BaseApiResponse,\n CommandsResponse,\n ContainerStub,\n ErrorResponse,\n\n // Command client types\n ExecuteRequest,\n ExecuteResponse as CommandExecuteResponse,\n\n // Port client types\n ExposePortRequest,\n FileOperationRequest,\n\n // Git client types\n GitCheckoutRequest,\n GitCheckoutResult,\n // Base client types\n HttpClientOptions as SandboxClientOptions,\n\n // File client types\n MkdirRequest,\n\n // Utility client types\n PingResponse,\n PortCloseResult,\n PortExposeResult,\n PortListResult,\n ProcessCleanupResult,\n ProcessInfoResult,\n ProcessKillResult,\n ProcessListResult,\n ProcessLogsResult,\n ProcessStartResult,\n ReadFileRequest,\n RequestConfig,\n ResponseHandler,\n SessionRequest,\n\n // Process client types\n StartProcessRequest,\n UnexposePortRequest,\n WriteFileRequest\n} from \"./clients\";\nexport type { ExecutionCallbacks, InterpreterClient } from './clients/interpreter-client.js';\n// Export file streaming utilities for binary file support\nexport { collectFile, streamFile } from './file-stream';\n// Export interpreter functionality\nexport { CodeInterpreter } from './interpreter.js';\n// Re-export request handler utilities\nexport {\n proxyToSandbox, type RouteInfo, type SandboxEnv\n} from './request-handler';\n// Export SSE parser for converting ReadableStream to AsyncIterable\nexport { asyncIterableToSSEStream, parseSSEStream, responseToAsyncIterable } from \"./sse-parser\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,cAAc;AAEd;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,5 +1,5 @@
1
1
  import { CreateContextOptions, CodeContext, RunCodeOptions, Execution } from '@repo/shared';
2
- import { b as Sandbox } from './sandbox-Cyuj5F-M.js';
2
+ import { b as Sandbox } from './sandbox-CZTMzV2R.js';
3
3
  import 'cloudflare:workers';
4
4
  import '@cloudflare/containers';
5
5
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CodeInterpreter
3
- } from "./chunk-BCJ7SF3Q.js";
3
+ } from "./chunk-JXZMAU2C.js";
4
4
  import "./chunk-Z532A7QC.js";
5
5
  export {
6
6
  CodeInterpreter
@@ -1,4 +1,4 @@
1
- import { b as Sandbox } from './sandbox-Cyuj5F-M.js';
1
+ import { b as Sandbox } from './sandbox-CZTMzV2R.js';
2
2
  import '@repo/shared';
3
3
  import 'cloudflare:workers';
4
4
  import '@cloudflare/containers';
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  isLocalhostPattern,
3
3
  proxyToSandbox
4
- } from "./chunk-U2M5GSMU.js";
5
- import "./chunk-BCJ7SF3Q.js";
4
+ } from "./chunk-2P3MDMNJ.js";
5
+ import "./chunk-JXZMAU2C.js";
6
6
  import "./chunk-Z532A7QC.js";
7
7
  import "./chunk-EKSWCBCA.js";
8
8
  export {
@@ -435,19 +435,23 @@ declare class SandboxClient {
435
435
  constructor(options: HttpClientOptions);
436
436
  }
437
437
 
438
- declare function getSandbox(ns: DurableObjectNamespace<Sandbox>, id: string): DurableObjectStub<Sandbox<unknown>>;
438
+ declare function getSandbox(ns: DurableObjectNamespace<Sandbox>, id: string, options?: {
439
+ baseUrl: string;
440
+ }): DurableObjectStub<Sandbox<unknown>>;
439
441
  declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox {
440
442
  defaultPort: number;
441
443
  sleepAfter: string;
442
444
  client: SandboxClient;
443
445
  private codeInterpreter;
444
446
  private sandboxName;
447
+ private baseUrl;
445
448
  private portTokens;
446
449
  private defaultSession;
447
450
  envVars: Record<string, string>;
448
451
  private logger;
449
452
  constructor(ctx: DurableObject['ctx'], env: Env);
450
453
  setSandboxName(name: string): Promise<void>;
454
+ setBaseUrl(baseUrl: string): Promise<void>;
451
455
  setEnvVars(envVars: Record<string, string>): Promise<void>;
452
456
  /**
453
457
  * Cleanup and destroy the sandbox container
@@ -461,6 +465,10 @@ declare class Sandbox<Env = unknown> extends Container<Env> implements ISandbox
461
465
  /**
462
466
  * Ensure default session exists - lazy initialization
463
467
  * This is called automatically by all public methods that need a session
468
+ *
469
+ * The session is persisted to Durable Object storage to survive hot reloads
470
+ * during development. If a session already exists in the container after reload,
471
+ * we reuse it instead of trying to create a new one.
464
472
  */
465
473
  private ensureDefaultSession;
466
474
  exec(command: string, options?: ExecOptions): Promise<ExecResult>;
package/dist/sandbox.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import '@repo/shared';
2
2
  import 'cloudflare:workers';
3
3
  import '@cloudflare/containers';
4
- export { b as Sandbox, g as getSandbox } from './sandbox-Cyuj5F-M.js';
4
+ export { b as Sandbox, g as getSandbox } from './sandbox-CZTMzV2R.js';
package/dist/sandbox.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  Sandbox,
3
3
  getSandbox
4
- } from "./chunk-U2M5GSMU.js";
5
- import "./chunk-BCJ7SF3Q.js";
4
+ } from "./chunk-2P3MDMNJ.js";
5
+ import "./chunk-JXZMAU2C.js";
6
6
  import "./chunk-Z532A7QC.js";
7
7
  import "./chunk-EKSWCBCA.js";
8
8
  export {
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "@cloudflare/sandbox",
3
- "version": "0.0.0-0b4cc05",
3
+ "version": "0.0.0-104f455",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/cloudflare/sandbox-sdk"
7
7
  },
8
8
  "description": "A sandboxed environment for running commands",
9
9
  "dependencies": {
10
- "@cloudflare/containers": "^0.0.28",
10
+ "@cloudflare/containers": "^0.0.28"
11
+ },
12
+ "devDependencies": {
11
13
  "@repo/shared": "^0.0.0"
12
14
  },
13
15
  "tags": [
package/src/sandbox.ts CHANGED
@@ -29,12 +29,18 @@ import {
29
29
  } from "./security";
30
30
  import { parseSSEStream } from "./sse-parser";
31
31
 
32
- export function getSandbox(ns: DurableObjectNamespace<Sandbox>, id: string) {
32
+ export function getSandbox(ns: DurableObjectNamespace<Sandbox>, id: string, options?: {
33
+ baseUrl: string
34
+ }) {
33
35
  const stub = getContainer(ns, id);
34
36
 
35
37
  // Store the name on first access
36
38
  stub.setSandboxName?.(id);
37
39
 
40
+ if(options?.baseUrl) {
41
+ stub.setBaseUrl(options.baseUrl);
42
+ }
43
+
38
44
  return stub;
39
45
  }
40
46
 
@@ -45,6 +51,7 @@ export class Sandbox<Env = unknown> extends Container<Env> implements ISandbox {
45
51
  client: SandboxClient;
46
52
  private codeInterpreter: CodeInterpreter;
47
53
  private sandboxName: string | null = null;
54
+ private baseUrl: string | null = null;
48
55
  private portTokens: Map<number, string> = new Map();
49
56
  private defaultSession: string | null = null;
50
57
  envVars: Record<string, string> = {};
@@ -77,9 +84,10 @@ export class Sandbox<Env = unknown> extends Container<Env> implements ISandbox {
77
84
  // The CodeInterpreter extracts client.interpreter from the sandbox
78
85
  this.codeInterpreter = new CodeInterpreter(this);
79
86
 
80
- // Load the sandbox name and port tokens from storage on initialization
87
+ // Load the sandbox name, port tokens, and default session from storage on initialization
81
88
  this.ctx.blockConcurrencyWhile(async () => {
82
89
  this.sandboxName = await this.ctx.storage.get<string>('sandboxName') || null;
90
+ this.defaultSession = await this.ctx.storage.get<string>('defaultSession') || null;
83
91
  const storedTokens = await this.ctx.storage.get<Record<string, string>>('portTokens') || {};
84
92
 
85
93
  // Convert stored tokens back to Map
@@ -98,6 +106,18 @@ export class Sandbox<Env = unknown> extends Container<Env> implements ISandbox {
98
106
  }
99
107
  }
100
108
 
109
+ // RPC method to set the base URL
110
+ async setBaseUrl(baseUrl: string): Promise<void> {
111
+ if (!this.baseUrl) {
112
+ this.baseUrl = baseUrl;
113
+ await this.ctx.storage.put('baseUrl', baseUrl);
114
+ } else {
115
+ if(this.baseUrl !== baseUrl) {
116
+ throw new Error('Base URL already set and different from one previously provided');
117
+ }
118
+ }
119
+ }
120
+
101
121
  // RPC method to set environment variables
102
122
  async setEnvVars(envVars: Record<string, string>): Promise<void> {
103
123
  // Update local state for new sessions
@@ -180,20 +200,39 @@ export class Sandbox<Env = unknown> extends Container<Env> implements ISandbox {
180
200
  /**
181
201
  * Ensure default session exists - lazy initialization
182
202
  * This is called automatically by all public methods that need a session
203
+ *
204
+ * The session is persisted to Durable Object storage to survive hot reloads
205
+ * during development. If a session already exists in the container after reload,
206
+ * we reuse it instead of trying to create a new one.
183
207
  */
184
208
  private async ensureDefaultSession(): Promise<string> {
185
209
  if (!this.defaultSession) {
186
210
  const sessionId = `sandbox-${this.sandboxName || 'default'}`;
187
211
 
188
- // Create session in container
189
- await this.client.utils.createSession({
190
- id: sessionId,
191
- env: this.envVars || {},
192
- cwd: '/workspace',
193
- });
194
-
195
- this.defaultSession = sessionId;
196
- this.logger.debug('Default session initialized', { sessionId });
212
+ try {
213
+ // Try to create session in container
214
+ await this.client.utils.createSession({
215
+ id: sessionId,
216
+ env: this.envVars || {},
217
+ cwd: '/workspace',
218
+ });
219
+
220
+ this.defaultSession = sessionId;
221
+ // Persist to storage so it survives hot reloads
222
+ await this.ctx.storage.put('defaultSession', sessionId);
223
+ this.logger.debug('Default session initialized', { sessionId });
224
+ } catch (error: any) {
225
+ // If session already exists (e.g., after hot reload), reuse it
226
+ if (error?.message?.includes('already exists') || error?.message?.includes('Session')) {
227
+ this.logger.debug('Reusing existing session after reload', { sessionId });
228
+ this.defaultSession = sessionId;
229
+ // Persist to storage in case it wasn't saved before
230
+ await this.ctx.storage.put('defaultSession', sessionId);
231
+ } else {
232
+ // Re-throw other errors
233
+ throw error;
234
+ }
235
+ }
197
236
  }
198
237
  return this.defaultSession;
199
238
  }
@@ -1,117 +0,0 @@
1
- import {
2
- validateLanguage
3
- } from "./chunk-Z532A7QC.js";
4
-
5
- // src/interpreter.ts
6
- import {
7
- Execution,
8
- ResultImpl
9
- } from "@repo/shared";
10
- var CodeInterpreter = class {
11
- interpreterClient;
12
- contexts = /* @__PURE__ */ new Map();
13
- constructor(sandbox) {
14
- this.interpreterClient = sandbox.client.interpreter;
15
- }
16
- /**
17
- * Create a new code execution context
18
- */
19
- async createCodeContext(options = {}) {
20
- validateLanguage(options.language);
21
- const context = await this.interpreterClient.createCodeContext(options);
22
- this.contexts.set(context.id, context);
23
- return context;
24
- }
25
- /**
26
- * Run code with optional context
27
- */
28
- async runCode(code, options = {}) {
29
- let context = options.context;
30
- if (!context) {
31
- const language = options.language || "python";
32
- context = await this.getOrCreateDefaultContext(language);
33
- }
34
- const execution = new Execution(code, context);
35
- await this.interpreterClient.runCodeStream(context.id, code, options.language, {
36
- onStdout: (output) => {
37
- execution.logs.stdout.push(output.text);
38
- if (options.onStdout) return options.onStdout(output);
39
- },
40
- onStderr: (output) => {
41
- execution.logs.stderr.push(output.text);
42
- if (options.onStderr) return options.onStderr(output);
43
- },
44
- onResult: async (result) => {
45
- execution.results.push(new ResultImpl(result));
46
- if (options.onResult) return options.onResult(result);
47
- },
48
- onError: (error) => {
49
- execution.error = error;
50
- if (options.onError) return options.onError(error);
51
- }
52
- });
53
- return execution;
54
- }
55
- /**
56
- * Run code and return a streaming response
57
- */
58
- async runCodeStream(code, options = {}) {
59
- let context = options.context;
60
- if (!context) {
61
- const language = options.language || "python";
62
- context = await this.getOrCreateDefaultContext(language);
63
- }
64
- const response = await this.interpreterClient.doFetch("/api/execute/code", {
65
- method: "POST",
66
- headers: {
67
- "Content-Type": "application/json",
68
- Accept: "text/event-stream"
69
- },
70
- body: JSON.stringify({
71
- context_id: context.id,
72
- code,
73
- language: options.language
74
- })
75
- });
76
- if (!response.ok) {
77
- const errorData = await response.json().catch(() => ({ error: "Unknown error" }));
78
- throw new Error(
79
- errorData.error || `Failed to execute code: ${response.status}`
80
- );
81
- }
82
- if (!response.body) {
83
- throw new Error("No response body for streaming execution");
84
- }
85
- return response.body;
86
- }
87
- /**
88
- * List all code contexts
89
- */
90
- async listCodeContexts() {
91
- const contexts = await this.interpreterClient.listCodeContexts();
92
- for (const context of contexts) {
93
- this.contexts.set(context.id, context);
94
- }
95
- return contexts;
96
- }
97
- /**
98
- * Delete a code context
99
- */
100
- async deleteCodeContext(contextId) {
101
- await this.interpreterClient.deleteCodeContext(contextId);
102
- this.contexts.delete(contextId);
103
- }
104
- async getOrCreateDefaultContext(language) {
105
- for (const context of this.contexts.values()) {
106
- if (context.language === language) {
107
- return context;
108
- }
109
- }
110
- return this.createCodeContext({ language });
111
- }
112
- };
113
-
114
- export {
115
- CodeInterpreter
116
- };
117
- //# sourceMappingURL=chunk-BCJ7SF3Q.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/interpreter.ts"],"sourcesContent":["import {\n type CodeContext,\n type CreateContextOptions,\n Execution,\n type ExecutionError,\n type OutputMessage,\n type Result,\n ResultImpl,\n type RunCodeOptions,\n} from \"@repo/shared\";\nimport type { InterpreterClient } from \"./clients/interpreter-client.js\";\nimport type { Sandbox } from \"./sandbox.js\";\nimport { validateLanguage } from \"./security.js\";\n\nexport class CodeInterpreter {\n private interpreterClient: InterpreterClient;\n private contexts = new Map<string, CodeContext>();\n\n constructor(sandbox: Sandbox) {\n // In init-testing architecture, client is a SandboxClient with an interpreter property\n this.interpreterClient = (sandbox.client as any).interpreter as InterpreterClient;\n }\n\n /**\n * Create a new code execution context\n */\n async createCodeContext(\n options: CreateContextOptions = {}\n ): Promise<CodeContext> {\n // Validate language before sending to container\n validateLanguage(options.language);\n\n const context = await this.interpreterClient.createCodeContext(options);\n this.contexts.set(context.id, context);\n return context;\n }\n\n /**\n * Run code with optional context\n */\n async runCode(\n code: string,\n options: RunCodeOptions = {}\n ): Promise<Execution> {\n // Get or create context\n let context = options.context;\n if (!context) {\n // Try to find or create a default context for the language\n const language = options.language || \"python\";\n context = await this.getOrCreateDefaultContext(language);\n }\n\n // Create execution object to collect results\n const execution = new Execution(code, context);\n\n // Stream execution\n await this.interpreterClient.runCodeStream(context.id, code, options.language, {\n onStdout: (output: OutputMessage) => {\n execution.logs.stdout.push(output.text);\n if (options.onStdout) return options.onStdout(output);\n },\n onStderr: (output: OutputMessage) => {\n execution.logs.stderr.push(output.text);\n if (options.onStderr) return options.onStderr(output);\n },\n onResult: async (result: Result) => {\n execution.results.push(new ResultImpl(result) as any);\n if (options.onResult) return options.onResult(result);\n },\n onError: (error: ExecutionError) => {\n execution.error = error;\n if (options.onError) return options.onError(error);\n },\n });\n\n return execution;\n }\n\n /**\n * Run code and return a streaming response\n */\n async runCodeStream(\n code: string,\n options: RunCodeOptions = {}\n ): Promise<ReadableStream> {\n // Get or create context\n let context = options.context;\n if (!context) {\n const language = options.language || \"python\";\n context = await this.getOrCreateDefaultContext(language);\n }\n\n // Create streaming response\n // Note: doFetch is protected but we need direct access for raw stream response\n const response = await (this.interpreterClient as any).doFetch(\"/api/execute/code\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"text/event-stream\",\n },\n body: JSON.stringify({\n context_id: context.id,\n code,\n language: options.language,\n }),\n });\n\n if (!response.ok) {\n const errorData = (await response\n .json()\n .catch(() => ({ error: \"Unknown error\" }))) as { error?: string };\n throw new Error(\n errorData.error || `Failed to execute code: ${response.status}`\n );\n }\n\n if (!response.body) {\n throw new Error(\"No response body for streaming execution\");\n }\n\n return response.body;\n }\n\n /**\n * List all code contexts\n */\n async listCodeContexts(): Promise<CodeContext[]> {\n const contexts = await this.interpreterClient.listCodeContexts();\n\n // Update local cache\n for (const context of contexts) {\n this.contexts.set(context.id, context);\n }\n\n return contexts;\n }\n\n /**\n * Delete a code context\n */\n async deleteCodeContext(contextId: string): Promise<void> {\n await this.interpreterClient.deleteCodeContext(contextId);\n this.contexts.delete(contextId);\n }\n\n private async getOrCreateDefaultContext(\n language: \"python\" | \"javascript\" | \"typescript\"\n ): Promise<CodeContext> {\n // Check if we have a cached context for this language\n for (const context of this.contexts.values()) {\n if (context.language === language) {\n return context;\n }\n }\n\n // Create new default context\n return this.createCodeContext({ language });\n }\n}\n"],"mappings":";;;;;AAAA;AAAA,EAGE;AAAA,EAIA;AAAA,OAEK;AAKA,IAAM,kBAAN,MAAsB;AAAA,EACnB;AAAA,EACA,WAAW,oBAAI,IAAyB;AAAA,EAEhD,YAAY,SAAkB;AAE5B,SAAK,oBAAqB,QAAQ,OAAe;AAAA,EACnD;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,kBACJ,UAAgC,CAAC,GACX;AAEtB,qBAAiB,QAAQ,QAAQ;AAEjC,UAAM,UAAU,MAAM,KAAK,kBAAkB,kBAAkB,OAAO;AACtE,SAAK,SAAS,IAAI,QAAQ,IAAI,OAAO;AACrC,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,QACJ,MACA,UAA0B,CAAC,GACP;AAEpB,QAAI,UAAU,QAAQ;AACtB,QAAI,CAAC,SAAS;AAEZ,YAAM,WAAW,QAAQ,YAAY;AACrC,gBAAU,MAAM,KAAK,0BAA0B,QAAQ;AAAA,IACzD;AAGA,UAAM,YAAY,IAAI,UAAU,MAAM,OAAO;AAG7C,UAAM,KAAK,kBAAkB,cAAc,QAAQ,IAAI,MAAM,QAAQ,UAAU;AAAA,MAC7E,UAAU,CAAC,WAA0B;AACnC,kBAAU,KAAK,OAAO,KAAK,OAAO,IAAI;AACtC,YAAI,QAAQ,SAAU,QAAO,QAAQ,SAAS,MAAM;AAAA,MACtD;AAAA,MACA,UAAU,CAAC,WAA0B;AACnC,kBAAU,KAAK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