@codeworksh/harness 0.0.1-dev.20260907170816 → 0.0.1-dev.20260922135939
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/README.md +144 -3
- package/{daytona-C6wWlJ4z.mjs → daytona-BAurx6Gp.mjs} +43 -21
- package/daytona-BAurx6Gp.mjs.map +1 -0
- package/effect.d.mts +15332 -4054
- package/effect.mjs +5025 -2498
- package/effect.mjs.map +1 -1
- package/{index-D5gDWEaM.d.mts → index-DIP2u0Pr.d.mts} +4 -4
- package/{index-CTm6Qzer.d.mts → index-DjPzwUHF.d.mts} +4 -4
- package/package.json +24 -18
- package/resource-DFZh0e-s.mjs +35 -0
- package/resource-DFZh0e-s.mjs.map +1 -0
- package/rolldown-runtime-B4FMCO8f.mjs +28 -0
- package/sandbox-BL7BdHZc.d.mts +2 -0
- package/sandbox.d.mts +2 -2
- package/sandbox.mjs +2 -2
- package/sandboxes/daytona/index.d.mts +1 -1
- package/sandboxes/daytona/index.mjs +1 -1
- package/sandboxes/vercel/index.d.mts +1 -1
- package/sandboxes/vercel/index.mjs +1 -1
- package/{vercel-DW62mvsC.mjs → vercel-C0v5nh20.mjs} +41 -26
- package/vercel-C0v5nh20.mjs.map +1 -0
- package/daytona-C6wWlJ4z.mjs.map +0 -1
- package/rolldown-runtime-D7D4PA-g.mjs +0 -13
- package/sandbox-DnL9UPzZ.d.mts +0 -668
- package/sandbox-QCmZ3UhD.mjs +0 -713
- package/sandbox-QCmZ3UhD.mjs.map +0 -1
- package/vercel-DW62mvsC.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as SandboxDriver } from "./sandbox-BL7BdHZc.mjs";
|
|
2
2
|
import { Schema } from "effect";
|
|
3
3
|
//#region src/sandboxes/vercel/index.d.ts
|
|
4
4
|
declare const Options: Schema.Struct<{
|
|
@@ -47,8 +47,8 @@ declare const RuntimeConfig: Schema.Struct<{
|
|
|
47
47
|
readonly execTimeout: Schema.optional<Schema.Finite>;
|
|
48
48
|
}>;
|
|
49
49
|
type RuntimeConfig = typeof RuntimeConfig.Type;
|
|
50
|
-
declare const make: (client?: ClientOptions) => Driver<CreateConfig, RuntimeConfig> & Registration;
|
|
51
|
-
declare const sandbox: Module<{
|
|
50
|
+
declare const make: (client?: ClientOptions) => SandboxDriver.Driver<CreateConfig, RuntimeConfig> & SandboxDriver.Registration;
|
|
51
|
+
declare const sandbox: SandboxDriver.Module<{
|
|
52
52
|
readonly token?: string | undefined;
|
|
53
53
|
readonly teamId?: string | undefined;
|
|
54
54
|
readonly projectId?: string | undefined;
|
|
@@ -78,4 +78,4 @@ declare const config: (value: CreateConfig) => {
|
|
|
78
78
|
};
|
|
79
79
|
//#endregion
|
|
80
80
|
export { Source as a, sandbox as c, RuntimeConfig as i, CreateConfig as n, config as o, Options as r, make as s, ClientOptions as t };
|
|
81
|
-
//# sourceMappingURL=index-
|
|
81
|
+
//# sourceMappingURL=index-DIP2u0Pr.d.mts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as SandboxDriver } from "./sandbox-BL7BdHZc.mjs";
|
|
2
2
|
import { Schema } from "effect";
|
|
3
3
|
//#region src/sandboxes/daytona/index.d.ts
|
|
4
4
|
declare const Options: Schema.Struct<{
|
|
@@ -43,8 +43,8 @@ declare const RuntimeConfig: Schema.Struct<{
|
|
|
43
43
|
readonly execTimeout: Schema.optional<Schema.Finite>;
|
|
44
44
|
}>;
|
|
45
45
|
type RuntimeConfig = typeof RuntimeConfig.Type;
|
|
46
|
-
declare const make: (client?: ClientOptions) => Driver<CreateConfig, RuntimeConfig> & Registration;
|
|
47
|
-
declare const sandbox: Module<{
|
|
46
|
+
declare const make: (client?: ClientOptions) => SandboxDriver.Driver<CreateConfig, RuntimeConfig> & SandboxDriver.Registration;
|
|
47
|
+
declare const sandbox: SandboxDriver.Module<{
|
|
48
48
|
readonly apiKey?: string | undefined;
|
|
49
49
|
readonly apiUrl?: string | undefined;
|
|
50
50
|
readonly target?: string | undefined;
|
|
@@ -72,4 +72,4 @@ declare const config: (value: CreateConfig) => {
|
|
|
72
72
|
};
|
|
73
73
|
//#endregion
|
|
74
74
|
export { RuntimeConfig as a, sandbox as c, ResourcesConfig as i, CreateConfig as n, config as o, Options as r, make as s, ClientOptions as t };
|
|
75
|
-
//# sourceMappingURL=index-
|
|
75
|
+
//# sourceMappingURL=index-DjPzwUHF.d.mts.map
|
package/package.json
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeworksh/harness",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
4
|
-
"description": "AI agent harness — agent loop, tools,
|
|
3
|
+
"version": "0.0.1-dev.20260922135939",
|
|
4
|
+
"description": "AI agent harness — agent loop, tools, plugins, sandbox, and more.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
7
7
|
"ai",
|
|
8
|
-
"
|
|
8
|
+
"ai-sdk",
|
|
9
|
+
"anthropic",
|
|
10
|
+
"grok",
|
|
9
11
|
"harness",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
+
"llm",
|
|
13
|
+
"node",
|
|
14
|
+
"openai",
|
|
15
|
+
"sandbox"
|
|
12
16
|
],
|
|
13
|
-
"homepage": "https://
|
|
17
|
+
"homepage": "https://www.codework.sh",
|
|
14
18
|
"bugs": {
|
|
15
19
|
"url": "https://github.com/codeworksh/codework/issues"
|
|
16
20
|
},
|
|
@@ -24,31 +28,26 @@
|
|
|
24
28
|
"types": "./index.d.mts",
|
|
25
29
|
"exports": {
|
|
26
30
|
".": {
|
|
27
|
-
"development": "./src/index.ts",
|
|
28
31
|
"types": "./index.d.mts",
|
|
29
32
|
"import": "./index.mjs",
|
|
30
33
|
"default": "./index.mjs"
|
|
31
34
|
},
|
|
32
35
|
"./effect": {
|
|
33
|
-
"development": "./src/effect.ts",
|
|
34
36
|
"types": "./effect.d.mts",
|
|
35
37
|
"import": "./effect.mjs",
|
|
36
38
|
"default": "./effect.mjs"
|
|
37
39
|
},
|
|
38
40
|
"./sandbox": {
|
|
39
|
-
"development": "./src/sandbox.ts",
|
|
40
41
|
"types": "./sandbox.d.mts",
|
|
41
42
|
"import": "./sandbox.mjs",
|
|
42
43
|
"default": "./sandbox.mjs"
|
|
43
44
|
},
|
|
44
45
|
"./sandboxes/daytona": {
|
|
45
|
-
"development": "./src/sandboxes/daytona/index.ts",
|
|
46
46
|
"types": "./sandboxes/daytona/index.d.mts",
|
|
47
47
|
"import": "./sandboxes/daytona/index.mjs",
|
|
48
48
|
"default": "./sandboxes/daytona/index.mjs"
|
|
49
49
|
},
|
|
50
50
|
"./sandboxes/vercel": {
|
|
51
|
-
"development": "./src/sandboxes/vercel/index.ts",
|
|
52
51
|
"types": "./sandboxes/vercel/index.d.mts",
|
|
53
52
|
"import": "./sandboxes/vercel/index.mjs",
|
|
54
53
|
"default": "./sandboxes/vercel/index.mjs"
|
|
@@ -68,19 +67,26 @@
|
|
|
68
67
|
},
|
|
69
68
|
"dependencies": {
|
|
70
69
|
"@codeworksh/aikit": "0.8.0",
|
|
71
|
-
"@
|
|
72
|
-
"@effect/
|
|
70
|
+
"@codeworksh/plugin": "0.0.1-dev.20260922105750",
|
|
71
|
+
"@effect/platform-node": "4.0.0-rc.115",
|
|
72
|
+
"@effect/platform-node-shared": "4.0.0-rc.115",
|
|
73
|
+
"@effect/sql-sqlite-node": "4.0.0-rc.115",
|
|
74
|
+
"@npmcli/arborist": "^10.0.2",
|
|
75
|
+
"@npmcli/config": "^11.0.1",
|
|
73
76
|
"@platformatic/vfs": "^0.4.0",
|
|
74
|
-
"
|
|
75
|
-
"just-bash": "^
|
|
77
|
+
"jsonc-parser": "3.3.1",
|
|
78
|
+
"just-bash": "^3.4.2",
|
|
79
|
+
"npm-package-arg": "^14.0.0",
|
|
80
|
+
"pacote": "^22.0.0",
|
|
76
81
|
"tslib": "^2.8.1",
|
|
77
|
-
"typebox": "^1.3.
|
|
78
|
-
"uuid": "^14.0.
|
|
82
|
+
"typebox": "^1.3.30",
|
|
83
|
+
"uuid": "^14.0.2",
|
|
79
84
|
"uuidv7": "^1.2.1"
|
|
80
85
|
},
|
|
81
86
|
"peerDependencies": {
|
|
82
87
|
"@daytona/sdk": "*",
|
|
83
|
-
"@vercel/sandbox": "*"
|
|
88
|
+
"@vercel/sandbox": "*",
|
|
89
|
+
"effect": "4.0.0-rc.115"
|
|
84
90
|
},
|
|
85
91
|
"peerDependenciesMeta": {
|
|
86
92
|
"@daytona/sdk": {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { n as __reExport, t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
|
|
2
|
+
import { posix } from "@codeworksh/plugin/posix";
|
|
3
|
+
//#region src/sandbox/instance.ts
|
|
4
|
+
var instance_exports = /* @__PURE__ */ __exportAll({});
|
|
5
|
+
import * as import__codeworksh_plugin_sandbox_instance from "@codeworksh/plugin/sandbox/instance";
|
|
6
|
+
__reExport(instance_exports, import__codeworksh_plugin_sandbox_instance);
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/sandbox/io.ts
|
|
9
|
+
var io_exports = /* @__PURE__ */ __exportAll({});
|
|
10
|
+
import * as import__codeworksh_plugin_sandbox_io from "@codeworksh/plugin/sandbox/io";
|
|
11
|
+
__reExport(io_exports, import__codeworksh_plugin_sandbox_io);
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/sandbox/errors.ts
|
|
14
|
+
var errors_exports = /* @__PURE__ */ __exportAll({});
|
|
15
|
+
import * as import__codeworksh_plugin_sandbox_errors from "@codeworksh/plugin/sandbox/errors";
|
|
16
|
+
__reExport(errors_exports, import__codeworksh_plugin_sandbox_errors);
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/sandbox/fs/filesystem.ts
|
|
19
|
+
var filesystem_exports = /* @__PURE__ */ __exportAll({});
|
|
20
|
+
import * as import__codeworksh_plugin_sandbox_filesystem from "@codeworksh/plugin/sandbox/filesystem";
|
|
21
|
+
__reExport(filesystem_exports, import__codeworksh_plugin_sandbox_filesystem);
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/sandbox/shell/shell.ts
|
|
24
|
+
var shell_exports = /* @__PURE__ */ __exportAll({});
|
|
25
|
+
import * as import__codeworksh_plugin_sandbox_shell from "@codeworksh/plugin/sandbox/shell";
|
|
26
|
+
__reExport(shell_exports, import__codeworksh_plugin_sandbox_shell);
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/sandbox/resource.ts
|
|
29
|
+
var resource_exports = /* @__PURE__ */ __exportAll({});
|
|
30
|
+
import * as import__codeworksh_plugin_sandbox_resource from "@codeworksh/plugin/sandbox/resource";
|
|
31
|
+
__reExport(resource_exports, import__codeworksh_plugin_sandbox_resource);
|
|
32
|
+
//#endregion
|
|
33
|
+
export { io_exports as a, errors_exports as i, shell_exports as n, instance_exports as o, filesystem_exports as r, posix as s, resource_exports as t };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=resource-DFZh0e-s.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-DFZh0e-s.mjs","names":[],"sources":["../../src/sandbox/instance.ts","../../src/sandbox/io.ts","../../src/sandbox/errors.ts","../../src/sandbox/fs/filesystem.ts","../../src/sandbox/shell/shell.ts","../../src/sandbox/resource.ts"],"sourcesContent":["export * from \"@codeworksh/plugin/sandbox/instance\";\n","export * from \"@codeworksh/plugin/sandbox/io\";\n","export * from \"@codeworksh/plugin/sandbox/errors\";\n","export * from \"@codeworksh/plugin/sandbox/filesystem\";\n","export * from \"@codeworksh/plugin/sandbox/shell\";\n","export * from \"@codeworksh/plugin/sandbox/resource\";\n"],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __exportAll = (all, no_symbols) => {
|
|
8
|
+
let target = {};
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
14
|
+
return target;
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
18
|
+
key = keys[i];
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
20
|
+
get: ((k) => from[k]).bind(null, key),
|
|
21
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
27
|
+
//#endregion
|
|
28
|
+
export { __reExport as n, __exportAll as t };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { SandboxDriver, SandboxFileSystem, SandboxIO, SandboxInstance, SandboxProvider, SandboxResource, SandboxShell } from "@codeworksh/plugin/sandbox";
|
|
2
|
+
export { SandboxProvider as a, SandboxInstance as i, SandboxFileSystem as n, SandboxResource as o, SandboxIO as r, SandboxShell as s, SandboxDriver as t };
|
package/sandbox.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { a as SandboxProvider, i as SandboxInstance, n as SandboxFileSystem, o as SandboxResource, r as SandboxIO, s as SandboxShell, t as SandboxDriver } from "./sandbox-BL7BdHZc.mjs";
|
|
2
|
+
export { SandboxDriver, SandboxFileSystem, SandboxIO, SandboxInstance, SandboxProvider, SandboxResource, SandboxShell };
|
package/sandbox.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { SandboxDriver, SandboxFileSystem, SandboxIO, SandboxInstance, SandboxProvider, SandboxResource, SandboxShell } from "@codeworksh/plugin/sandbox";
|
|
2
|
+
export { SandboxDriver, SandboxFileSystem, SandboxIO, SandboxInstance, SandboxProvider, SandboxResource, SandboxShell };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as RuntimeConfig, c as sandbox, i as ResourcesConfig, n as CreateConfig, o as config, r as Options, s as make, t as ClientOptions } from "../../index-
|
|
1
|
+
import { a as RuntimeConfig, c as sandbox, i as ResourcesConfig, n as CreateConfig, o as config, r as Options, s as make, t as ClientOptions } from "../../index-DjPzwUHF.mjs";
|
|
2
2
|
export { ClientOptions, CreateConfig, Options, ResourcesConfig, RuntimeConfig, config, sandbox as default, make };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as RuntimeConfig, c as sandbox, i as ResourcesConfig, n as CreateConfig, o as config, r as Options, s as make, t as ClientOptions } from "../../daytona-
|
|
1
|
+
import { a as RuntimeConfig, c as sandbox, i as ResourcesConfig, n as CreateConfig, o as config, r as Options, s as make, t as ClientOptions } from "../../daytona-BAurx6Gp.mjs";
|
|
2
2
|
export { ClientOptions, CreateConfig, Options, ResourcesConfig, RuntimeConfig, config, sandbox as default, make };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as Source, c as sandbox, i as RuntimeConfig, n as CreateConfig, o as config, r as Options, s as make, t as ClientOptions } from "../../index-
|
|
1
|
+
import { a as Source, c as sandbox, i as RuntimeConfig, n as CreateConfig, o as config, r as Options, s as make, t as ClientOptions } from "../../index-DIP2u0Pr.mjs";
|
|
2
2
|
export { ClientOptions, CreateConfig, Options, RuntimeConfig, Source, config, sandbox as default, make };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as Source, c as sandbox, i as RuntimeConfig, n as CreateConfig, o as config, r as Options, s as make, t as ClientOptions } from "../../vercel-
|
|
1
|
+
import { a as Source, c as sandbox, i as RuntimeConfig, n as CreateConfig, o as config, r as Options, s as make, t as ClientOptions } from "../../vercel-C0v5nh20.mjs";
|
|
2
2
|
export { ClientOptions, CreateConfig, Options, RuntimeConfig, Source, config, sandbox as default, make };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as errors_exports, n as shell_exports, o as instance_exports, r as filesystem_exports, s as posix, t as resource_exports } from "./resource-DFZh0e-s.mjs";
|
|
2
|
+
import { SandboxDriver, SandboxProvider } from "./sandbox.mjs";
|
|
2
3
|
import { Context, Effect, Layer, Option, Schema, Stream } from "effect";
|
|
3
4
|
import { Buffer } from "node:buffer";
|
|
4
5
|
//#region src/sandboxes/vercel/fs.ts
|
|
@@ -25,21 +26,22 @@ const make$1 = (provider, options) => {
|
|
|
25
26
|
readdir: (path) => provider.readdir(resolve(path)),
|
|
26
27
|
exists: (path) => provider.exists(resolve(path)),
|
|
27
28
|
mkdir: (path, mkdirOptions) => provider.mkdir(resolve(path), mkdirOptions),
|
|
28
|
-
rm: (path, rmOptions) => provider.rm(resolve(path), rmOptions)
|
|
29
|
+
rm: (path, rmOptions) => provider.rm(resolve(path), rmOptions),
|
|
30
|
+
realpath: (path) => provider.realpath(resolve(path))
|
|
29
31
|
};
|
|
30
32
|
};
|
|
31
33
|
//#endregion
|
|
32
34
|
//#region src/sandboxes/vercel/provider.ts
|
|
33
35
|
const utf8 = new TextEncoder();
|
|
34
|
-
Schema.TaggedError()("VercelError", { sanitized: PersistedError });
|
|
36
|
+
Schema.TaggedError()("VercelError", { sanitized: instance_exports.SandboxInstance.PersistedError });
|
|
35
37
|
const ApiFailure = Schema.Struct({ json: Schema.Struct({ error: Schema.Struct({
|
|
36
38
|
message: Schema.optional(Schema.String),
|
|
37
39
|
code: Schema.optional(Schema.String)
|
|
38
40
|
}) }) });
|
|
39
41
|
const isApiFailure = Schema.is(ApiFailure);
|
|
40
42
|
/** Prefer Vercel's structured API failure while retaining the shared redaction boundary. */
|
|
41
|
-
const sanitizeProviderError = (cause, redact = makeRedactor()) => {
|
|
42
|
-
const fallback = sanitizeError(cause, redact);
|
|
43
|
+
const sanitizeProviderError = (cause, redact = (0, errors_exports.makeRedactor)()) => {
|
|
44
|
+
const fallback = (0, errors_exports.sanitizeError)(cause, redact);
|
|
43
45
|
if (!isApiFailure(cause)) return fallback;
|
|
44
46
|
const message = cause.json.error.message?.trim();
|
|
45
47
|
const code = cause.json.error.code?.trim();
|
|
@@ -97,7 +99,7 @@ const statsFrom = (stats) => {
|
|
|
97
99
|
...mtime instanceof Date && !Number.isNaN(mtime.getTime()) ? { mtime } : {}
|
|
98
100
|
};
|
|
99
101
|
};
|
|
100
|
-
const providerFrom = (sandbox) => {
|
|
102
|
+
const providerFrom = (sandbox, options) => {
|
|
101
103
|
return {
|
|
102
104
|
readFile: (path) => sandbox.fs.readFile(path, "utf8"),
|
|
103
105
|
readFileBuffer: async (path) => new Uint8Array(await sandbox.fs.readFile(path)),
|
|
@@ -110,7 +112,7 @@ const providerFrom = (sandbox) => {
|
|
|
110
112
|
await sandbox.fs.stat(path);
|
|
111
113
|
return true;
|
|
112
114
|
} catch (cause) {
|
|
113
|
-
if (isNotFoundError(cause)) return false;
|
|
115
|
+
if (filesystem_exports.SandboxFileSystem.isNotFoundError(cause)) return false;
|
|
114
116
|
throw cause;
|
|
115
117
|
}
|
|
116
118
|
},
|
|
@@ -120,7 +122,20 @@ const providerFrom = (sandbox) => {
|
|
|
120
122
|
rm: (path, rmOptions) => sandbox.fs.rm(path, {
|
|
121
123
|
...rmOptions?.recursive === void 0 ? {} : { recursive: rmOptions.recursive },
|
|
122
124
|
...rmOptions?.force === void 0 ? {} : { force: rmOptions.force }
|
|
123
|
-
})
|
|
125
|
+
}),
|
|
126
|
+
realpath: async (path) => {
|
|
127
|
+
for (const script of filesystem_exports.SandboxFileSystem.realpathScripts) {
|
|
128
|
+
const result = await (await spawnArgv(sandbox, options, [
|
|
129
|
+
"sh",
|
|
130
|
+
"-c",
|
|
131
|
+
script,
|
|
132
|
+
"_",
|
|
133
|
+
path
|
|
134
|
+
])).wait();
|
|
135
|
+
if (result.exitCode === 0) return (await result.stdout()).trimEnd();
|
|
136
|
+
}
|
|
137
|
+
throw Object.assign(/* @__PURE__ */ new Error(`ENOENT: no such file or directory, realpath '${path}'`), { code: "ENOENT" });
|
|
138
|
+
}
|
|
124
139
|
};
|
|
125
140
|
};
|
|
126
141
|
const spawn = (sandbox, options, command, env, cwd) => spawnArgv(sandbox, options, [
|
|
@@ -129,7 +144,7 @@ const spawn = (sandbox, options, command, env, cwd) => spawnArgv(sandbox, option
|
|
|
129
144
|
command
|
|
130
145
|
], env, cwd);
|
|
131
146
|
const spawnArgv = (sandbox, options, argv, env, cwd) => {
|
|
132
|
-
const resolvedCwd = resolveCwd(options.cwd, cwd);
|
|
147
|
+
const resolvedCwd = (0, shell_exports.resolveCwd)(options.cwd, cwd);
|
|
133
148
|
return sandbox.runCommand({
|
|
134
149
|
cmd: argv[0],
|
|
135
150
|
args: argv.slice(1),
|
|
@@ -141,7 +156,7 @@ const spawnArgv = (sandbox, options, argv, env, cwd) => {
|
|
|
141
156
|
};
|
|
142
157
|
const acquireWith = (command, run) => Effect.acquireRelease(Effect.tryPromise({
|
|
143
158
|
try: run,
|
|
144
|
-
catch: (cause) => new ShellError({
|
|
159
|
+
catch: (cause) => new shell_exports.ShellError({
|
|
145
160
|
command,
|
|
146
161
|
cause
|
|
147
162
|
})
|
|
@@ -156,7 +171,7 @@ const collect = (command) => (cmd) => Effect.tryPromise({
|
|
|
156
171
|
exitCode: result.exitCode
|
|
157
172
|
};
|
|
158
173
|
},
|
|
159
|
-
catch: (cause) => new ShellError({
|
|
174
|
+
catch: (cause) => new shell_exports.ShellError({
|
|
160
175
|
command,
|
|
161
176
|
cause
|
|
162
177
|
})
|
|
@@ -164,11 +179,11 @@ const collect = (command) => (cmd) => Effect.tryPromise({
|
|
|
164
179
|
const acquireCommand = (sandbox, options, command, env, cwd) => acquireWith(command, () => spawn(sandbox, options, command, env, cwd));
|
|
165
180
|
const exec = (sandbox, options) => (command, opts) => acquireCommand(sandbox, options, command, opts?.env, opts?.cwd).pipe(Effect.flatMap(collect(command)), Effect.scoped);
|
|
166
181
|
const execArgv = (sandbox, options) => (argv, opts) => {
|
|
167
|
-
const command = quoteArgv(argv);
|
|
182
|
+
const command = (0, shell_exports.quoteArgv)(argv);
|
|
168
183
|
return acquireWith(command, () => spawnArgv(sandbox, options, argv, opts?.env, opts?.cwd)).pipe(Effect.flatMap(collect(command)), Effect.scoped);
|
|
169
184
|
};
|
|
170
185
|
const stream = (sandbox, options) => (command, opts) => Stream.unwrap(acquireCommand(sandbox, options, command, opts?.env, opts?.cwd).pipe(Effect.map((cmd) => {
|
|
171
|
-
const logs = Stream.fromAsyncIterable(cmd.logs(), (cause) => new ShellError({
|
|
186
|
+
const logs = Stream.fromAsyncIterable(cmd.logs(), (cause) => new shell_exports.ShellError({
|
|
172
187
|
command,
|
|
173
188
|
cause
|
|
174
189
|
})).pipe(Stream.map((log) => ({
|
|
@@ -177,7 +192,7 @@ const stream = (sandbox, options) => (command, opts) => Stream.unwrap(acquireCom
|
|
|
177
192
|
})));
|
|
178
193
|
const exit = Stream.fromEffect(Effect.tryPromise({
|
|
179
194
|
try: () => cmd.wait(),
|
|
180
|
-
catch: (cause) => new ShellError({
|
|
195
|
+
catch: (cause) => new shell_exports.ShellError({
|
|
181
196
|
command,
|
|
182
197
|
cause
|
|
183
198
|
})
|
|
@@ -194,12 +209,12 @@ const stream = (sandbox, options) => (command, opts) => Stream.unwrap(acquireCom
|
|
|
194
209
|
* one here. The returned layer owns no provider resource and has no deletion
|
|
195
210
|
* finalizer.
|
|
196
211
|
*/
|
|
197
|
-
const transport = (sandbox, options = {}) => Layer.merge(Layer.succeed(Service, fromProvider(make$1(providerFrom(sandbox)))), Layer.succeed(Shell, Shell.of({
|
|
212
|
+
const transport = (sandbox, options = {}) => Layer.merge(Layer.succeed(filesystem_exports.SandboxFileSystem.Service, filesystem_exports.SandboxFileSystem.fromProvider(make$1(providerFrom(sandbox, options)))), Layer.succeed(shell_exports.Shell, shell_exports.Shell.of({
|
|
198
213
|
exec: exec(sandbox, options),
|
|
199
214
|
execArgv: execArgv(sandbox, options),
|
|
200
215
|
stream: stream(sandbox, options)
|
|
201
216
|
})));
|
|
202
|
-
Layer.effect(Service
|
|
217
|
+
Layer.effect(resource_exports.SandboxResource.Service, Effect.map(Remote, ({ sandbox }) => ({ providerResourceId: sandbox.name })));
|
|
203
218
|
//#endregion
|
|
204
219
|
//#region src/sandboxes/vercel/index.ts
|
|
205
220
|
const Options = Schema.Struct({
|
|
@@ -228,10 +243,10 @@ const CreateConfig = Schema.Struct({
|
|
|
228
243
|
execTimeout: Schema.optional(Schema.Finite)
|
|
229
244
|
});
|
|
230
245
|
const RuntimeConfig = Schema.Struct({
|
|
231
|
-
defaultCwd: AbsolutePath,
|
|
246
|
+
defaultCwd: SandboxDriver.AbsolutePath,
|
|
232
247
|
execTimeout: Schema.optional(Schema.Finite)
|
|
233
248
|
});
|
|
234
|
-
const name = Name.make("vercel");
|
|
249
|
+
const name = SandboxDriver.Name.make("vercel");
|
|
235
250
|
const statusFrom = (status) => ({
|
|
236
251
|
status: status === "stopped" ? "offline" : status === "stopping" || status === "snapshotting" ? "suspending" : status === "failed" || status === "aborted" ? "faulted" : "online",
|
|
237
252
|
providerStatus: status
|
|
@@ -244,10 +259,10 @@ const isNotFound = (cause) => {
|
|
|
244
259
|
};
|
|
245
260
|
const make = (client = {}) => {
|
|
246
261
|
const credentials = credentialsFrom(client);
|
|
247
|
-
const redact = makeRedactor([client.token ?? ""]);
|
|
262
|
+
const redact = SandboxProvider.makeRedactor([client.token ?? ""]);
|
|
248
263
|
const attempt = (operation, run) => Effect.tryPromise({
|
|
249
264
|
try: run,
|
|
250
|
-
catch: (cause) => providerError({
|
|
265
|
+
catch: (cause) => SandboxProvider.providerError({
|
|
251
266
|
driver: name,
|
|
252
267
|
operation,
|
|
253
268
|
cause,
|
|
@@ -268,7 +283,7 @@ const make = (client = {}) => {
|
|
|
268
283
|
...statusFrom(sandbox.status),
|
|
269
284
|
metadata: { cwd: sandbox.cwd }
|
|
270
285
|
});
|
|
271
|
-
return driver({
|
|
286
|
+
return SandboxDriver.driver({
|
|
272
287
|
name,
|
|
273
288
|
kind: "remote",
|
|
274
289
|
capabilities: {
|
|
@@ -308,14 +323,14 @@ const make = (client = {}) => {
|
|
|
308
323
|
providerResourceId: sandbox.name,
|
|
309
324
|
providerStatus: state.providerStatus,
|
|
310
325
|
runtimeConfig: {
|
|
311
|
-
defaultCwd: AbsolutePath.make(sandbox.cwd || "/vercel/sandbox"),
|
|
326
|
+
defaultCwd: SandboxDriver.AbsolutePath.make(sandbox.cwd || "/vercel/sandbox"),
|
|
312
327
|
...config.execTimeout === void 0 ? {} : { execTimeout: config.execTimeout }
|
|
313
328
|
},
|
|
314
329
|
metadata: { cwd: sandbox.cwd }
|
|
315
330
|
};
|
|
316
331
|
}),
|
|
317
332
|
runtimeConfigFor: ({ providerResourceId, overrides }) => Effect.map(get(providerResourceId, false, "runtimeConfigFor"), (sandbox) => ({
|
|
318
|
-
defaultCwd: overrides?.defaultCwd ?? AbsolutePath.make(sandbox.cwd || "/vercel/sandbox"),
|
|
333
|
+
defaultCwd: overrides?.defaultCwd ?? SandboxDriver.AbsolutePath.make(sandbox.cwd || "/vercel/sandbox"),
|
|
319
334
|
...overrides?.execTimeout === void 0 ? {} : { execTimeout: overrides.execTimeout }
|
|
320
335
|
})),
|
|
321
336
|
attach: (input) => Layer.unwrap(Effect.map(get(Option.getOrElse(input.providerResourceId, () => input.id), true, "attach"), (sandbox) => transport(sandbox, input.runtimeConfig.execTimeout === void 0 ? void 0 : { execTimeout: input.runtimeConfig.execTimeout }))),
|
|
@@ -325,8 +340,8 @@ const make = (client = {}) => {
|
|
|
325
340
|
destroy: (input) => Effect.flatMap(get(Option.getOrElse(input.providerResourceId, () => input.id), false, "destroy"), (sandbox) => attempt("destroy", () => sandbox.delete()))
|
|
326
341
|
});
|
|
327
342
|
};
|
|
328
|
-
const sandbox =
|
|
329
|
-
apiVersion:
|
|
343
|
+
const sandbox = SandboxDriver.module({
|
|
344
|
+
apiVersion: SandboxDriver.apiVersion,
|
|
330
345
|
name,
|
|
331
346
|
options: Options,
|
|
332
347
|
make
|
|
@@ -338,4 +353,4 @@ const config = (value) => ({
|
|
|
338
353
|
//#endregion
|
|
339
354
|
export { Source as a, sandbox as c, RuntimeConfig as i, CreateConfig as n, config as o, Options as r, make as s, ClientOptions as t };
|
|
340
355
|
|
|
341
|
-
//# sourceMappingURL=vercel-
|
|
356
|
+
//# sourceMappingURL=vercel-C0v5nh20.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel-C0v5nh20.mjs","names":["make","SandboxInstance","makeRedactor","sanitizeSandboxError","SandboxFileSystem","resolveCwd","ShellError","quoteArgv","RemoteFileSystem.make","Shell","SandboxResource","EnvVercel.credentialsFrom","EnvVercel.sanitizeProviderError","EnvVercel.createSandbox","EnvVercel.transport"],"sources":["../../src/sandboxes/vercel/fs.ts","../../src/sandboxes/vercel/provider.ts","../../src/sandboxes/vercel/index.ts"],"sourcesContent":["import { posix } from \"../../util/posix.ts\";\nimport { SandboxFileSystem } from \"../../sandbox/fs/filesystem.ts\";\n\n// The provider contract and FileStat live in `filesystem.ts` (the single source of truth, VFS-free).\n// A remote provider implements this Interface; `make` wraps\n// it into the same runtime surface the local vfs backend exposes.\nexport type FileStat = SandboxFileSystem.FileStat;\n\n// Remote-aware callers can opt into metadata that is not part of the generic\n// SandboxFileSystem surface. In particular, `stat` keeps the familiar\n// provider-level meaning, while `lstat` explicitly asks for the directory entry\n// itself so symlink identity is not inferred from a method with mixed provider\n// semantics.\nexport interface Interface extends SandboxFileSystem.Provider {\n\treadonly lstat?: (path: string) => Promise<FileStat>;\n}\n\nexport interface Options {\n\t/**\n\t * Optional remote working directory for relative paths. When omitted, relative\n\t * paths are passed through so the remote provider can use its own default cwd.\n\t */\n\treadonly cwd?: string;\n}\n\nconst resolvePath = (path: string, options?: Options) => {\n\tconst normalized = posix.normalize(path);\n\tif (options?.cwd === undefined || posix.isAbsolute(normalized)) return normalized;\n\treturn posix.normalize(posix.join(options.cwd, normalized));\n};\n\n/**\n * Wrap a remote provider into the runtime filesystem surface: resolve relative\n * paths against `cwd`, and nothing else. Parent creation and `rm` option\n * validation are the runtime's job and live in `SandboxFileSystem.fromProvider`,\n * which every backend passes through — putting them here would cover only the\n * backends that happen to use this wrapper.\n */\nexport const make = (provider: Interface, options?: Options): SandboxFileSystem.Provider => {\n\tconst resolve = (path: string) => resolvePath(path, options);\n\n\treturn {\n\t\treadFile: (path) => provider.readFile(resolve(path)),\n\t\treadFileBuffer: (path) => provider.readFileBuffer(resolve(path)),\n\t\twriteFile: (path, content) => provider.writeFile(resolve(path), content),\n\t\tstat: (path) => provider.stat(resolve(path)),\n\t\t...(provider.lstat === undefined ? {} : { lstat: (path: string) => provider.lstat!(resolve(path)) }),\n\t\treaddir: (path) => provider.readdir(resolve(path)),\n\t\texists: (path) => provider.exists(resolve(path)),\n\t\tmkdir: (path, mkdirOptions) => provider.mkdir(resolve(path), mkdirOptions),\n\t\t// option validation happens in `fromProvider`, before any mutation\n\t\trm: (path, rmOptions) => provider.rm(resolve(path), rmOptions),\n\t\trealpath: (path) => provider.realpath(resolve(path)),\n\t};\n};\n\nexport const withProvider = make;\n","/* oxlint-disable effecttsgo/async-function -- Vercel's sandbox SDK boundary is Promise-based. */\nimport { Context, Effect, Layer, Schema, Stream } from \"effect\";\nimport { Buffer } from \"node:buffer\";\nimport { makeRedactor, type Redactor, sanitizeError as sanitizeSandboxError } from \"../../sandbox/errors.ts\";\nimport { SandboxFileSystem } from \"../../sandbox/fs/filesystem.ts\";\nimport { SandboxInstance } from \"../../sandbox/instance.ts\";\nimport { SandboxIO } from \"../../sandbox/io.ts\";\nimport { SandboxResource } from \"../../sandbox/resource.ts\";\nimport {\n\ttype ExecChunk,\n\ttype ExecResult,\n\ttype ISandboxExe,\n\tquoteArgv,\n\tresolveCwd,\n\tShell,\n\tShellError,\n} from \"../../sandbox/shell/shell.ts\";\nimport * as RemoteFileSystem from \"./fs.ts\";\n\nconst utf8 = new TextEncoder();\ntype Command = import(\"@vercel/sandbox\").Command;\ntype RemoteSandbox = import(\"@vercel/sandbox\").Sandbox;\n\n/** Vercel's namespace-intrinsic working directory. */\nexport const DEFAULT_CWD = \"/vercel/sandbox\";\n\nexport class VercelError extends Schema.TaggedError<VercelError>()(\"VercelError\", {\n\tsanitized: SandboxInstance.PersistedError,\n}) {}\n\nconst ApiFailure = Schema.Struct({\n\tjson: Schema.Struct({\n\t\terror: Schema.Struct({\n\t\t\tmessage: Schema.optional(Schema.String),\n\t\t\tcode: Schema.optional(Schema.String),\n\t\t}),\n\t}),\n});\nconst isApiFailure = Schema.is(ApiFailure);\n\n/** Prefer Vercel's structured API failure while retaining the shared redaction boundary. */\nexport const sanitizeProviderError = (\n\tcause: unknown,\n\tredact: Redactor = makeRedactor(),\n): SandboxInstance.PersistedError => {\n\tconst fallback = sanitizeSandboxError(cause, redact);\n\tif (!isApiFailure(cause)) return fallback;\n\tconst message = cause.json.error.message?.trim();\n\tconst code = cause.json.error.code?.trim();\n\treturn {\n\t\t...fallback,\n\t\t...(message === undefined || message.length === 0 ? {} : { message: redact(message) }),\n\t\t...(code === undefined || code.length === 0 ? {} : { code: redact(code) }),\n\t};\n};\n\n/**\n * Vercel API credentials. Either all three are provided together or none are:\n * when omitted, the SDK resolves them from the `VERCEL_OIDC_TOKEN` env var\n * (the token's payload carries the project and team ids).\n */\nexport interface Credentials {\n\treadonly token: string;\n\treadonly teamId: string;\n\treadonly projectId: string;\n}\n\nexport interface Options {\n\t/** Auth token (OIDC or access token). Falls back to `VERCEL_OIDC_TOKEN`. */\n\treadonly token?: string | undefined;\n\t/** Team id. Derived from the OIDC token when omitted. */\n\treadonly teamId?: string | undefined;\n\t/** Project id. Derived from the OIDC token when omitted. */\n\treadonly projectId?: string | undefined;\n\t/** Reuse an existing sandbox by name instead of creating one. */\n\treadonly sandboxName?: string | undefined;\n\t/** Explicit name for a newly created sandbox. */\n\treadonly name?: string | undefined;\n\t/** Provider-side diagnostic labels (maximum five). */\n\treadonly tags?: Record<string, string> | undefined;\n\t/** Durable instance identity for this namespace. Supplied by the Controller. */\n\treadonly instanceId?: SandboxInstance.ID | undefined;\n\t/** Snapshot id to create the sandbox from. */\n\treadonly snapshot?: string | undefined;\n\t/** Source to seed the sandbox filesystem from (git or tarball). */\n\treadonly source?:\n\t\t| {\n\t\t\t\treadonly type: \"git\";\n\t\t\t\treadonly url: string;\n\t\t\t\treadonly revision?: string | undefined;\n\t\t\t\treadonly depth?: number | undefined;\n\t\t }\n\t\t| { readonly type: \"tarball\"; readonly url: string };\n\t/** Runtime used by the sandbox. Defaults to the SDK default (`node24`). */\n\treadonly runtime?: string | undefined;\n\t/** Ports to expose from the sandbox (max 4). */\n\treadonly ports?: number[] | undefined;\n\t/** Environment variables baked into the sandbox. */\n\treadonly envVars?: Record<string, string> | undefined;\n\t/** vCPU allocation (memory scales at 2048 MB per vCPU). */\n\treadonly vcpus?: number | undefined;\n\t/**\n\t * Mount working directory. Relative values resolve against `/vercel/sandbox`;\n\t * omitted values use that namespace default.\n\t */\n\treadonly cwd?: string | undefined;\n\t/** Milliseconds before the sandbox auto-terminates. */\n\treadonly timeout?: number | undefined;\n\t/** Per-command timeout in milliseconds. Omit for no timeout. */\n\treadonly execTimeout?: number | undefined;\n}\n\ninterface RemoteState {\n\treadonly sandbox: RemoteSandbox;\n}\n\nclass Remote extends Context.Service<Remote, RemoteState>()(\"@codeworksh/harness/sandboxes/vercel/provider/Remote\") {}\n\n// Vercel requires all three credential fields together or none — partial\n// credentials are rejected by the SDK — so only forward them when complete.\nexport const credentialsFrom = (options: Options): Credentials | undefined =>\n\toptions.token !== undefined && options.teamId !== undefined && options.projectId !== undefined\n\t\t? { token: options.token, teamId: options.teamId, projectId: options.projectId }\n\t\t: undefined;\n\nexport const createSandbox = async (options: Options, creds: Credentials | undefined = credentialsFrom(options)) => {\n\tconst { Sandbox } = await import(\"@vercel/sandbox\");\n\tconst withCreds = <T extends object>(params: T) => (creds ? { ...params, ...creds } : params);\n\tconst source =\n\t\toptions.source?.type === \"git\"\n\t\t\t? {\n\t\t\t\t\ttype: \"git\" as const,\n\t\t\t\t\turl: options.source.url,\n\t\t\t\t\t...(options.source.revision === undefined ? {} : { revision: options.source.revision }),\n\t\t\t\t\t...(options.source.depth === undefined ? {} : { depth: options.source.depth }),\n\t\t\t\t}\n\t\t\t: options.source;\n\tconst base = {\n\t\t...(options.name === undefined ? {} : { name: options.name }),\n\t\t...(options.tags === undefined ? {} : { tags: options.tags }),\n\t\t...(options.envVars === undefined ? {} : { env: options.envVars }),\n\t\t...(options.ports === undefined ? {} : { ports: options.ports }),\n\t\t...(options.timeout === undefined ? {} : { timeout: options.timeout }),\n\t\t...(options.vcpus === undefined ? {} : { resources: { vcpus: options.vcpus } }),\n\t};\n\treturn options.snapshot !== undefined\n\t\t? Sandbox.create(withCreds({ ...base, source: { type: \"snapshot\" as const, snapshotId: options.snapshot } }))\n\t\t: Sandbox.create(\n\t\t\t\twithCreds({\n\t\t\t\t\t...base,\n\t\t\t\t\t...(options.runtime === undefined ? {} : { runtime: options.runtime }),\n\t\t\t\t\t...(source === undefined ? {} : { source }),\n\t\t\t\t}),\n\t\t\t);\n};\n\nconst remote = (options: Options) =>\n\tLayer.effect(\n\t\tRemote,\n\t\tEffect.tryPromise({\n\t\t\ttry: async (): Promise<RemoteState> => {\n\t\t\t\tconst { Sandbox } = await import(\"@vercel/sandbox\");\n\t\t\t\tconst creds = credentialsFrom(options);\n\t\t\t\tconst sandbox = options.sandboxName\n\t\t\t\t\t? await Sandbox.get(creds ? { ...creds, name: options.sandboxName } : { name: options.sandboxName })\n\t\t\t\t\t: await createSandbox(options, creds);\n\t\t\t\treturn { sandbox };\n\t\t\t},\n\t\t\tcatch: (cause) => new VercelError({ sanitized: sanitizeProviderError(cause) }),\n\t\t}),\n\t);\n\ninterface Stats {\n\treadonly size: number;\n\treadonly mtime: Date;\n\treadonly isFile: () => boolean;\n\treadonly isDirectory: () => boolean;\n\treadonly isSymbolicLink: () => boolean;\n}\n\nexport const statsFrom = (stats: Stats): RemoteFileSystem.FileStat => {\n\tconst mtime = stats.mtime;\n\n\t// omit size/mtime the stat could not report — never fabricate\n\treturn {\n\t\tisFile: stats.isFile(),\n\t\tisDirectory: stats.isDirectory(),\n\t\tisSymbolicLink: stats.isSymbolicLink(),\n\t\t...(Number.isFinite(stats.size) ? { size: stats.size } : {}),\n\t\t...(mtime instanceof Date && !Number.isNaN(mtime.getTime()) ? { mtime } : {}),\n\t};\n};\n\ntype RemoteFilesystemProvider = Pick<\n\tRemoteFileSystem.Interface,\n\t\"readFile\" | \"readFileBuffer\" | \"writeFile\" | \"stat\" | \"lstat\" | \"readdir\" | \"exists\" | \"mkdir\" | \"rm\" | \"realpath\"\n>;\n\n// The Vercel `fs` surface is `node:fs/promises`-compatible, so the provider\n// maps almost directly. The `RemoteFileSystem.make` wrapper resolves relative\n// paths against `cwd` and guarantees parent creation on `writeFile`. Only\n// `realpath` has no fs counterpart and shells out.\nconst providerFrom = (sandbox: RemoteSandbox, options: Options): RemoteFilesystemProvider => {\n\tconst filesystem: RemoteFilesystemProvider = {\n\t\treadFile: (path: string) => sandbox.fs.readFile(path, \"utf8\"),\n\t\treadFileBuffer: async (path: string) => new Uint8Array(await sandbox.fs.readFile(path)),\n\t\twriteFile: (path: string, content: string | Uint8Array) =>\n\t\t\tsandbox.fs.writeFile(path, typeof content === \"string\" ? Buffer.from(content, \"utf8\") : Buffer.from(content)),\n\t\tstat: async (path: string) => statsFrom(await sandbox.fs.stat(path)),\n\t\t// Keep symlink identity explicit: Vercel's `stat` follows symlinks\n\t\t// (`stat -L`), so remote-aware callers must ask for `lstat` when they\n\t\t// need the entry itself instead of the target's metadata.\n\t\tlstat: async (path: string) => statsFrom(await sandbox.fs.lstat(path)),\n\t\t// `withFileTypes` lists via `find`, which includes dotfiles (`.git` …);\n\t\t// the bare `readdir` shells out to `ls -1` and would drop them.\n\t\treaddir: async (path: string) => (await sandbox.fs.readdir(path, { withFileTypes: true })).map((e) => e.name),\n\t\texists: async (path: string) => {\n\t\t\ttry {\n\t\t\t\tawait sandbox.fs.stat(path);\n\t\t\t\treturn true;\n\t\t\t} catch (cause) {\n\t\t\t\tif (SandboxFileSystem.isNotFoundError(cause)) return false;\n\t\t\t\tthrow cause;\n\t\t\t}\n\t\t},\n\t\tmkdir: async (path: string, mkdirOptions?: { recursive?: boolean }) => {\n\t\t\tawait sandbox.fs.mkdir(\n\t\t\t\tpath,\n\t\t\t\tmkdirOptions?.recursive === undefined ? {} : { recursive: mkdirOptions.recursive },\n\t\t\t);\n\t\t},\n\t\t// `rm -f` is native, so force/recursive delegate straight through; the\n\t\t// wrapper has already rejected any unsupported option before we get here.\n\t\trm: (path: string, rmOptions?: { recursive?: boolean; force?: boolean }) =>\n\t\t\tsandbox.fs.rm(path, {\n\t\t\t\t...(rmOptions?.recursive === undefined ? {} : { recursive: rmOptions.recursive }),\n\t\t\t\t...(rmOptions?.force === undefined ? {} : { force: rmOptions.force }),\n\t\t\t}),\n\t\trealpath: async (path: string) => {\n\t\t\tfor (const script of SandboxFileSystem.realpathScripts) {\n\t\t\t\tconst result = await (await spawnArgv(sandbox, options, [\"sh\", \"-c\", script, \"_\", path])).wait();\n\t\t\t\tif (result.exitCode === 0) return (await result.stdout()).trimEnd();\n\t\t\t}\n\t\t\t// same shape `fs.stat` rejects with, so `isNotFoundError` recognises it\n\t\t\tthrow Object.assign(new Error(`ENOENT: no such file or directory, realpath '${path}'`), { code: \"ENOENT\" });\n\t\t},\n\t};\n\n\treturn filesystem;\n};\n\n// Arbitrary command strings run through `sh -c` to match the single-string\n// contract the rest of the harness expects. Commands run **detached** so the\n// returned `Command` exposes `kill`/`logs`/`wait`: a `cwd`/`env` is threaded in,\n// and the per-command `execTimeout` is a server-side SIGKILL deadline.\nconst spawn = (\n\tsandbox: RemoteSandbox,\n\toptions: Options,\n\tcommand: string,\n\tenv?: Record<string, string>,\n\tcwd?: string,\n): Promise<Command> => spawnArgv(sandbox, options, [\"sh\", \"-c\", command], env, cwd);\n\n// Vercel spawns a program with a real argument vector, so `execArgv` needs no\n// quoting at all — the args never pass through a shell.\nconst spawnArgv = (\n\tsandbox: RemoteSandbox,\n\toptions: Options,\n\targv: ReadonlyArray<string>,\n\tenv?: Record<string, string>,\n\tcwd?: string,\n): Promise<Command> => {\n\tconst resolvedCwd = resolveCwd(options.cwd, cwd);\n\treturn sandbox.runCommand({\n\t\tcmd: argv[0]!,\n\t\targs: argv.slice(1),\n\t\t...(resolvedCwd === undefined ? {} : { cwd: resolvedCwd }),\n\t\t...(env === undefined ? {} : { env }),\n\t\tdetached: true,\n\t\t...(options.execTimeout === undefined ? {} : { timeoutMs: options.execTimeout }),\n\t});\n};\n\n// Acquire a detached command and register its kill as a scope finalizer, so an\n// interrupt / timeout from the consumer actually terminates the remote process\n// (best-effort SIGKILL) instead of leaving it running server-side.\n// `command` labels failures only; the spawn itself is supplied by the caller so\n// string and argv execution share one kill finalizer.\nconst acquireWith = (command: string, run: () => Promise<Command>) =>\n\tEffect.acquireRelease(Effect.tryPromise({ try: run, catch: (cause) => new ShellError({ command, cause }) }), (cmd) =>\n\t\tEffect.promise(() => cmd.kill(\"SIGKILL\").catch(() => {})),\n\t);\n\n// Vercel reports stdout and stderr separately with a distinct exit code, so the\n// shell surfaces both streams faithfully.\nconst collect = (command: string) => (cmd: Command) =>\n\tEffect.tryPromise({\n\t\ttry: async (): Promise<ExecResult> => {\n\t\t\tconst result = await cmd.wait();\n\t\t\tconst [stdout, stderr] = await Promise.all([result.stdout(), result.stderr()]);\n\t\t\treturn { stdout, stderr, exitCode: result.exitCode };\n\t\t},\n\t\tcatch: (cause) => new ShellError({ command, cause }),\n\t});\n\nconst acquireCommand = (\n\tsandbox: RemoteSandbox,\n\toptions: Options,\n\tcommand: string,\n\tenv?: Record<string, string>,\n\tcwd?: string,\n) => acquireWith(command, () => spawn(sandbox, options, command, env, cwd));\n\nconst exec =\n\t(sandbox: RemoteSandbox, options: Options): ISandboxExe[\"exec\"] =>\n\t(command, opts) =>\n\t\tacquireCommand(sandbox, options, command, opts?.env, opts?.cwd).pipe(\n\t\t\tEffect.flatMap(collect(command)),\n\t\t\tEffect.scoped,\n\t\t);\n\nconst execArgv =\n\t(sandbox: RemoteSandbox, options: Options): ISandboxExe[\"execArgv\"] =>\n\t(argv, opts) => {\n\t\t// quoted for the error label only — the spawn passes argv through untouched\n\t\tconst command = quoteArgv(argv);\n\t\treturn acquireWith(command, () => spawnArgv(sandbox, options, argv, opts?.env, opts?.cwd)).pipe(\n\t\t\tEffect.flatMap(collect(command)),\n\t\t\tEffect.scoped,\n\t\t);\n\t};\n\n// Streaming output via `Command.logs` (an async generator of stdout/stderr\n// entries), followed by the exit code from `wait`. The kill finalizer fires when\n// the consuming scope closes (interrupt / timeout).\nconst stream =\n\t(sandbox: RemoteSandbox, options: Options): NonNullable<ISandboxExe[\"stream\"]> =>\n\t(command, opts) =>\n\t\tStream.unwrap(\n\t\t\tacquireCommand(sandbox, options, command, opts?.env, opts?.cwd).pipe(\n\t\t\t\tEffect.map((cmd) => {\n\t\t\t\t\tconst logs = Stream.fromAsyncIterable(cmd.logs(), (cause) => new ShellError({ command, cause })).pipe(\n\t\t\t\t\t\tStream.map((log): ExecChunk => ({ _tag: log.stream, bytes: utf8.encode(log.data) })),\n\t\t\t\t\t);\n\t\t\t\t\tconst exit = Stream.fromEffect(\n\t\t\t\t\t\tEffect.tryPromise({ try: () => cmd.wait(), catch: (cause) => new ShellError({ command, cause }) }),\n\t\t\t\t\t).pipe(Stream.map((finished): ExecChunk => ({ _tag: \"exit\", exitCode: finished.exitCode })));\n\t\t\t\t\treturn Stream.concat(logs, exit);\n\t\t\t\t}),\n\t\t\t),\n\t\t);\n\nconst filesystemLayer = (options: Options) =>\n\tLayer.effect(\n\t\tSandboxFileSystem.Service,\n\t\tEffect.map(Remote, ({ sandbox }) =>\n\t\t\tSandboxFileSystem.fromProvider(\n\t\t\t\tRemoteFileSystem.make(\n\t\t\t\t\tproviderFrom(sandbox, options),\n\t\t\t\t\toptions.cwd === undefined ? undefined : { cwd: options.cwd },\n\t\t\t\t),\n\t\t\t),\n\t\t),\n\t);\n\nconst shellLayer = (options: Options) =>\n\tLayer.effect(\n\t\tShell,\n\t\tEffect.map(Remote, ({ sandbox }) =>\n\t\t\tShell.of({\n\t\t\t\texec: exec(sandbox, options),\n\t\t\t\texecArgv: execArgv(sandbox, options),\n\t\t\t\tstream: stream(sandbox, options),\n\t\t\t}),\n\t\t),\n\t);\n\n/**\n * Cwd-neutral IO attachment for a lifecycle driver.\n *\n * The controller binds a cwd per mount, so neither filesystem nor shell stores\n * one here. The returned layer owns no provider resource and has no deletion\n * finalizer.\n */\nexport const transport = (\n\tsandbox: RemoteSandbox,\n\toptions: Pick<Options, \"execTimeout\"> = {},\n): Layer.Layer<SandboxFileSystem.Service | Shell> =>\n\tLayer.merge(\n\t\tLayer.succeed(\n\t\t\tSandboxFileSystem.Service,\n\t\t\tSandboxFileSystem.fromProvider(RemoteFileSystem.make(providerFrom(sandbox, options))),\n\t\t),\n\t\tLayer.succeed(\n\t\t\tShell,\n\t\t\tShell.of({\n\t\t\t\texec: exec(sandbox, options),\n\t\t\t\texecArgv: execArgv(sandbox, options),\n\t\t\t\tstream: stream(sandbox, options),\n\t\t\t}),\n\t\t),\n\t);\n\n// Vercel's locator is the sandbox name. See `SandboxResource` for why this is a\n// shared tag rather than a Vercel-specific one.\nconst resourceLayer = Layer.effect(\n\tSandboxResource.Service,\n\tEffect.map(Remote, ({ sandbox }) => ({ providerResourceId: sandbox.name })),\n);\n\n// Identity is per remote sandbox, not per provider: two sandboxes both rooted at\n// the same directory must not share persisted directory records.\n//\n// The id is minted here only when the caller names none. A durable id is the\n// control plane's to mint and record — deriving one from the provider's own\n// locator is what §6.1 forbids — so a caller that needs the namespace to survive\n// a restart passes `instanceId` rather than relying on this.\nconst identityLayer = (options: Options) =>\n\tLayer.effect(\n\t\tSandboxIO.Current,\n\t\tEffect.map(Remote, () =>\n\t\t\tSandboxIO.remote({\n\t\t\t\tdriver: \"vercel\",\n\t\t\t\tid: options.instanceId ?? SandboxInstance.ID.create(),\n\t\t\t\tdefaultCwd: DEFAULT_CWD,\n\t\t\t\t...(options.cwd === undefined ? {} : { cwd: options.cwd }),\n\t\t\t}),\n\t\t),\n\t);\n\n/**\n * A Vercel sandbox provides the runtime filesystem service directly plus the\n * sandbox's native remote shell. It intentionally does not provide VFS: remote\n * filesystems have no synchronous filesystem surface.\n */\nexport const layer = (\n\toptions: Options = {},\n): Layer.Layer<SandboxIO.Provides | SandboxResource.Service, VercelError> => {\n\tconst mounted = { ...options, cwd: SandboxIO.resolveMountCwd(DEFAULT_CWD, options.cwd) };\n\treturn Layer.mergeAll(filesystemLayer(mounted), shellLayer(mounted), identityLayer(mounted), resourceLayer).pipe(\n\t\tLayer.provide(remote(mounted)),\n\t);\n};\n\nexport const services = layer;\n","import { Effect, Layer, Option, Schema } from \"effect\";\nimport { SandboxDriver, SandboxInstance, SandboxProvider } from \"../../sandbox.ts\";\nimport * as EnvVercel from \"./provider.ts\";\n\nexport const Options = Schema.Struct({\n\ttoken: Schema.optional(Schema.String),\n\tteamId: Schema.optional(Schema.String),\n\tprojectId: Schema.optional(Schema.String),\n});\nexport type Options = typeof Options.Type;\nexport const ClientOptions = Options;\nexport type ClientOptions = Options;\n\nexport const Source = Schema.Union([\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"git\"),\n\t\turl: Schema.String,\n\t\trevision: Schema.optional(Schema.String),\n\t\tdepth: Schema.optional(Schema.Finite),\n\t}),\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"tarball\"),\n\t\turl: Schema.String,\n\t}),\n]);\nexport type Source = typeof Source.Type;\n\nexport const CreateConfig = Schema.Struct({\n\tsnapshot: Schema.optional(Schema.String),\n\tsource: Schema.optional(Source),\n\truntime: Schema.optional(Schema.String),\n\tports: Schema.optional(Schema.Array(Schema.Finite)),\n\tenvVars: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n\tvcpus: Schema.optional(Schema.Finite),\n\ttimeout: Schema.optional(Schema.Finite),\n\texecTimeout: Schema.optional(Schema.Finite),\n});\nexport type CreateConfig = typeof CreateConfig.Type;\n\nexport const RuntimeConfig = Schema.Struct({\n\tdefaultCwd: SandboxDriver.AbsolutePath,\n\texecTimeout: Schema.optional(Schema.Finite),\n});\nexport type RuntimeConfig = typeof RuntimeConfig.Type;\n\nconst name = SandboxDriver.Name.make(\"vercel\");\ntype RemoteSandbox = import(\"@vercel/sandbox\").Sandbox;\n\nconst statusFrom = (\n\tstatus: RemoteSandbox[\"status\"],\n): {\n\treadonly status: SandboxInstance.Status;\n\treadonly providerStatus: string;\n} => ({\n\tstatus:\n\t\tstatus === \"stopped\"\n\t\t\t? \"offline\"\n\t\t\t: status === \"stopping\" || status === \"snapshotting\"\n\t\t\t\t? \"suspending\"\n\t\t\t\t: status === \"failed\" || status === \"aborted\"\n\t\t\t\t\t? \"faulted\"\n\t\t\t\t\t: \"online\",\n\tproviderStatus: status,\n});\n\nconst isNotFound = (cause: unknown): boolean => {\n\tif (typeof cause !== \"object\" || cause === null) return false;\n\tconst response = \"response\" in cause && cause.response instanceof Response ? cause.response : undefined;\n\tconst code =\n\t\t\"code\" in cause && typeof cause.code === \"string\"\n\t\t\t? cause.code\n\t\t\t: \"json\" in cause &&\n\t\t\t\t typeof cause.json === \"object\" &&\n\t\t\t\t cause.json !== null &&\n\t\t\t\t \"error\" in cause.json &&\n\t\t\t\t typeof cause.json.error === \"object\" &&\n\t\t\t\t cause.json.error !== null &&\n\t\t\t\t \"code\" in cause.json.error &&\n\t\t\t\t typeof cause.json.error.code === \"string\"\n\t\t\t\t? cause.json.error.code\n\t\t\t\t: undefined;\n\treturn response?.status === 404 || code === \"not_found\" || code === \"sandbox_not_found\";\n};\n\nexport const make = (\n\tclient: ClientOptions = {},\n): SandboxDriver.Driver<CreateConfig, RuntimeConfig> & SandboxDriver.Registration => {\n\tconst credentials = EnvVercel.credentialsFrom(client);\n\tconst redact = SandboxProvider.makeRedactor([client.token ?? \"\"]);\n\n\tconst attempt = <A>(\n\t\toperation: string,\n\t\trun: () => Promise<A>,\n\t): Effect.Effect<A, SandboxProvider.SandboxProviderError> =>\n\t\tEffect.tryPromise({\n\t\t\ttry: run,\n\t\t\tcatch: (cause) =>\n\t\t\t\tSandboxProvider.providerError({\n\t\t\t\t\tdriver: name,\n\t\t\t\t\toperation,\n\t\t\t\t\tcause,\n\t\t\t\t\tredact,\n\t\t\t\t\tsanitize: EnvVercel.sanitizeProviderError,\n\t\t\t\t\tnotFound: isNotFound(cause),\n\t\t\t\t}),\n\t\t});\n\n\tconst get = (providerResourceId: string, resume: boolean, operation: string) =>\n\t\tattempt(operation, () =>\n\t\t\timport(\"@vercel/sandbox\").then(({ Sandbox }) =>\n\t\t\t\tSandbox.get(\n\t\t\t\t\tcredentials === undefined\n\t\t\t\t\t\t? { name: providerResourceId, resume }\n\t\t\t\t\t\t: { ...credentials, name: providerResourceId, resume },\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\n\tconst observed = (sandbox: RemoteSandbox): SandboxDriver.Observed => ({\n\t\t...statusFrom(sandbox.status),\n\t\tmetadata: {\n\t\t\tcwd: sandbox.cwd,\n\t\t},\n\t});\n\n\treturn SandboxDriver.driver({\n\t\tname,\n\t\tkind: \"remote\",\n\t\tcapabilities: {\n\t\t\tinspect: true,\n\t\t\treattach: true,\n\t\t\twake: true,\n\t\t\tstop: true,\n\t\t\tdestroy: true,\n\t\t\tcancels: true,\n\t\t},\n\t\tcreateConfigCodec: CreateConfig,\n\t\truntimeConfigCodec: RuntimeConfig,\n\t\tcreate: ({ instanceId, config }) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst source =\n\t\t\t\t\tconfig.source?.type === \"git\"\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\ttype: \"git\" as const,\n\t\t\t\t\t\t\t\turl: config.source.url,\n\t\t\t\t\t\t\t\t...(config.source.revision === undefined ? {} : { revision: config.source.revision }),\n\t\t\t\t\t\t\t\t...(config.source.depth === undefined ? {} : { depth: config.source.depth }),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: config.source;\n\t\t\t\tconst sandbox = yield* attempt(\"create\", () =>\n\t\t\t\t\tEnvVercel.createSandbox(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...client,\n\t\t\t\t\t\t\t...(config.snapshot === undefined ? {} : { snapshot: config.snapshot }),\n\t\t\t\t\t\t\t...(source === undefined ? {} : { source }),\n\t\t\t\t\t\t\t...(config.runtime === undefined ? {} : { runtime: config.runtime }),\n\t\t\t\t\t\t\t...(config.ports === undefined ? {} : { ports: [...config.ports] }),\n\t\t\t\t\t\t\t...(config.envVars === undefined ? {} : { envVars: config.envVars }),\n\t\t\t\t\t\t\t...(config.vcpus === undefined ? {} : { vcpus: config.vcpus }),\n\t\t\t\t\t\t\t...(config.timeout === undefined ? {} : { timeout: config.timeout }),\n\t\t\t\t\t\t\t...(config.execTimeout === undefined ? {} : { execTimeout: config.execTimeout }),\n\t\t\t\t\t\t\ttags: {\n\t\t\t\t\t\t\t\t\"codework-instance\": instanceId,\n\t\t\t\t\t\t\t\t\"codework-managed\": \"true\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcredentials,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tconst state = statusFrom(sandbox.status);\n\t\t\t\treturn {\n\t\t\t\t\tproviderResourceId: sandbox.name,\n\t\t\t\t\tproviderStatus: state.providerStatus,\n\t\t\t\t\truntimeConfig: {\n\t\t\t\t\t\tdefaultCwd: SandboxDriver.AbsolutePath.make(sandbox.cwd || EnvVercel.DEFAULT_CWD),\n\t\t\t\t\t\t...(config.execTimeout === undefined ? {} : { execTimeout: config.execTimeout }),\n\t\t\t\t\t},\n\t\t\t\t\tmetadata: {\n\t\t\t\t\t\tcwd: sandbox.cwd,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}),\n\t\truntimeConfigFor: ({ providerResourceId, overrides }) =>\n\t\t\tEffect.map(get(providerResourceId, false, \"runtimeConfigFor\"), (sandbox) => ({\n\t\t\t\tdefaultCwd: overrides?.defaultCwd ?? SandboxDriver.AbsolutePath.make(sandbox.cwd || EnvVercel.DEFAULT_CWD),\n\t\t\t\t...(overrides?.execTimeout === undefined ? {} : { execTimeout: overrides.execTimeout }),\n\t\t\t})),\n\t\tattach: (input) =>\n\t\t\tLayer.unwrap(\n\t\t\t\tEffect.map(\n\t\t\t\t\tget(\n\t\t\t\t\t\tOption.getOrElse(input.providerResourceId, () => input.id),\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\"attach\",\n\t\t\t\t\t),\n\t\t\t\t\t(sandbox) =>\n\t\t\t\t\t\tEnvVercel.transport(\n\t\t\t\t\t\t\tsandbox,\n\t\t\t\t\t\t\tinput.runtimeConfig.execTimeout === undefined\n\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t: { execTimeout: input.runtimeConfig.execTimeout },\n\t\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\tinspect: (input) =>\n\t\t\tEffect.map(\n\t\t\t\tget(\n\t\t\t\t\tOption.getOrElse(input.providerResourceId, () => input.id),\n\t\t\t\t\tfalse,\n\t\t\t\t\t\"inspect\",\n\t\t\t\t),\n\t\t\t\tobserved,\n\t\t\t),\n\t\twake: (input) =>\n\t\t\tEffect.map(\n\t\t\t\tget(\n\t\t\t\t\tOption.getOrElse(input.providerResourceId, () => input.id),\n\t\t\t\t\ttrue,\n\t\t\t\t\t\"wake\",\n\t\t\t\t),\n\t\t\t\tobserved,\n\t\t\t),\n\t\tstop: (input) =>\n\t\t\tEffect.flatMap(\n\t\t\t\tget(\n\t\t\t\t\tOption.getOrElse(input.providerResourceId, () => input.id),\n\t\t\t\t\tfalse,\n\t\t\t\t\t\"stop\",\n\t\t\t\t),\n\t\t\t\t(sandbox) => attempt(\"stop\", () => sandbox.stop()).pipe(Effect.map(() => observed(sandbox))),\n\t\t\t),\n\t\tdestroy: (input) =>\n\t\t\tEffect.flatMap(\n\t\t\t\tget(\n\t\t\t\t\tOption.getOrElse(input.providerResourceId, () => input.id),\n\t\t\t\t\tfalse,\n\t\t\t\t\t\"destroy\",\n\t\t\t\t),\n\t\t\t\t(sandbox) => attempt(\"destroy\", () => sandbox.delete()),\n\t\t\t),\n\t});\n};\n\nconst sandbox = SandboxDriver.module({\n\tapiVersion: SandboxDriver.apiVersion,\n\tname,\n\toptions: Options,\n\tmake,\n});\n\nexport const config = (value: CreateConfig) => ({ driver: \"vercel\" as const, config: value });\n\nexport default sandbox;\n"],"mappings":";;;;;AAyBA,MAAM,eAAe,MAAc,YAAsB;CACxD,MAAM,aAAa,MAAM,UAAU,IAAI;CACvC,IAAI,SAAS,QAAQ,KAAA,KAAa,MAAM,WAAW,UAAU,GAAG,OAAO;CACvE,OAAO,MAAM,UAAU,MAAM,KAAK,QAAQ,KAAK,UAAU,CAAC;AAC3D;;;;;;;;AASA,MAAaA,UAAQ,UAAqB,YAAkD;CAC3F,MAAM,WAAW,SAAiB,YAAY,MAAM,OAAO;CAE3D,OAAO;EACN,WAAW,SAAS,SAAS,SAAS,QAAQ,IAAI,CAAC;EACnD,iBAAiB,SAAS,SAAS,eAAe,QAAQ,IAAI,CAAC;EAC/D,YAAY,MAAM,YAAY,SAAS,UAAU,QAAQ,IAAI,GAAG,OAAO;EACvE,OAAO,SAAS,SAAS,KAAK,QA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