@tencent-ai/cloud-agent-sdk 0.2.15 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1257 -20082
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +635 -6085
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +635 -6085
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1225 -9368
- package/dist/index.mjs.map +1 -1
- package/dist/tencent-ai-cloud-agent-sdk-0.3.0.tgz +0 -0
- package/package.json +32 -66
- package/dist/e2b-filesystem-4-LU6-jg.cjs +0 -168
- package/dist/e2b-filesystem-4-LU6-jg.cjs.map +0 -1
- package/dist/e2b-filesystem-BNmEfpoW.mjs +0 -162
- package/dist/e2b-filesystem-BNmEfpoW.mjs.map +0 -1
- package/dist/e2b-filesystem-B_WoA22S.cjs +0 -252
- package/dist/e2b-filesystem-B_WoA22S.cjs.map +0 -1
- package/dist/e2b-filesystem-Cac-bpRR.cjs +0 -3
- package/dist/e2b-filesystem-DM_jsT05.mjs +0 -234
- package/dist/e2b-filesystem-DM_jsT05.mjs.map +0 -1
- package/dist/e2b-filesystem-DWj9UkV8.mjs +0 -3
- package/dist/e2b-filesystem-DcVVT_tP.cjs +0 -4
- package/dist/e2b-filesystem-UheQECjB.mjs +0 -3
- package/dist/legacy/index.cjs +0 -24205
- package/dist/legacy/index.cjs.map +0 -1
- package/dist/legacy/index.d.cts +0 -6605
- package/dist/legacy/index.d.cts.map +0 -1
- package/dist/legacy/index.d.mts +0 -6605
- package/dist/legacy/index.d.mts.map +0 -1
- package/dist/legacy/index.mjs +0 -13481
- package/dist/legacy/index.mjs.map +0 -1
- package/dist/tencent-ai-cloud-agent-sdk-0.2.15.tgz +0 -0
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,44 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tencent-ai/cloud-agent-sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Cloud Agent SDK",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Cloud Agent SDK - isomorphic (Node.js 18+ and modern browsers)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
8
|
+
"types": {
|
|
9
|
+
"import": "./dist/index.d.mts",
|
|
10
|
+
"require": "./dist/index.d.cts"
|
|
11
11
|
},
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"./legacy": {
|
|
18
|
-
"import": {
|
|
19
|
-
"types": "./dist/legacy/index.d.mts",
|
|
20
|
-
"default": "./dist/legacy/index.mjs"
|
|
12
|
+
"browser": {
|
|
13
|
+
"import": "./dist/index.mjs",
|
|
14
|
+
"require": "./dist/index.cjs"
|
|
21
15
|
},
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
"default": "./dist/legacy/index.cjs"
|
|
25
|
-
}
|
|
16
|
+
"import": "./dist/index.mjs",
|
|
17
|
+
"require": "./dist/index.cjs"
|
|
26
18
|
}
|
|
27
19
|
},
|
|
28
20
|
"main": "./dist/index.cjs",
|
|
29
21
|
"module": "./dist/index.mjs",
|
|
22
|
+
"browser": "./dist/index.mjs",
|
|
30
23
|
"types": "./dist/index.d.mts",
|
|
31
|
-
"typesVersions": {
|
|
32
|
-
"*": {
|
|
33
|
-
"legacy": [
|
|
34
|
-
"dist/legacy/index.d.mts"
|
|
35
|
-
]
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
24
|
"sideEffects": false,
|
|
39
25
|
"files": [
|
|
40
|
-
"dist"
|
|
41
|
-
"dist/legacy"
|
|
26
|
+
"dist"
|
|
42
27
|
],
|
|
43
28
|
"scripts": {},
|
|
44
29
|
"dependencies": {},
|
|
@@ -51,53 +36,36 @@
|
|
|
51
36
|
"customPackage": {
|
|
52
37
|
"name": "@tencent-ai/cloud-agent-sdk",
|
|
53
38
|
"private": false,
|
|
54
|
-
"version": "0.
|
|
55
|
-
"description": "Cloud Agent SDK",
|
|
39
|
+
"version": "0.3.0",
|
|
40
|
+
"description": "Cloud Agent SDK - isomorphic (Node.js 18+ and modern browsers)",
|
|
56
41
|
"type": "module",
|
|
57
42
|
"exports": {
|
|
58
43
|
".": {
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
44
|
+
"types": {
|
|
45
|
+
"import": "./dist/index.d.mts",
|
|
46
|
+
"require": "./dist/index.d.cts"
|
|
62
47
|
},
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
"./legacy": {
|
|
69
|
-
"import": {
|
|
70
|
-
"types": "./dist/legacy/index.d.mts",
|
|
71
|
-
"default": "./dist/legacy/index.mjs"
|
|
48
|
+
"browser": {
|
|
49
|
+
"import": "./dist/index.mjs",
|
|
50
|
+
"require": "./dist/index.cjs"
|
|
72
51
|
},
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
"default": "./dist/legacy/index.cjs"
|
|
76
|
-
}
|
|
52
|
+
"import": "./dist/index.mjs",
|
|
53
|
+
"require": "./dist/index.cjs"
|
|
77
54
|
}
|
|
78
55
|
},
|
|
79
56
|
"main": "./dist/index.cjs",
|
|
80
57
|
"module": "./dist/index.mjs",
|
|
58
|
+
"browser": "./dist/index.mjs",
|
|
81
59
|
"types": "./dist/index.d.mts",
|
|
82
|
-
"typesVersions": {
|
|
83
|
-
"*": {
|
|
84
|
-
"legacy": [
|
|
85
|
-
"dist/legacy/index.d.mts"
|
|
86
|
-
]
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
60
|
"sideEffects": false,
|
|
90
61
|
"files": [
|
|
91
|
-
"dist"
|
|
92
|
-
"dist/legacy"
|
|
62
|
+
"dist"
|
|
93
63
|
],
|
|
94
64
|
"peerDependencies": {
|
|
95
|
-
"@agentclientprotocol/sdk": "^0.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
"
|
|
99
|
-
"e2b": "^2.10.2",
|
|
100
|
-
"zod": "^3.25.0 || ^4.0.0"
|
|
65
|
+
"@agentclientprotocol/sdk": "^0.4.8"
|
|
66
|
+
},
|
|
67
|
+
"engines": {
|
|
68
|
+
"node": ">=18.0.0"
|
|
101
69
|
},
|
|
102
70
|
"dependencies": {},
|
|
103
71
|
"scripts": {}
|
|
@@ -105,11 +73,9 @@
|
|
|
105
73
|
},
|
|
106
74
|
"private": false,
|
|
107
75
|
"peerDependencies": {
|
|
108
|
-
"@agentclientprotocol/sdk": "^0.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
"
|
|
112
|
-
"e2b": "^2.10.2",
|
|
113
|
-
"zod": "^3.25.0 || ^4.0.0"
|
|
76
|
+
"@agentclientprotocol/sdk": "^0.4.8"
|
|
77
|
+
},
|
|
78
|
+
"engines": {
|
|
79
|
+
"node": ">=18.0.0"
|
|
114
80
|
}
|
|
115
81
|
}
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
const require_index = require('./index.cjs');
|
|
2
|
-
let e2b = require("e2b");
|
|
3
|
-
|
|
4
|
-
//#region ../agent-provider/src/common/providers/cloud-agent-provider/e2b-filesystem.ts
|
|
5
|
-
/**
|
|
6
|
-
* E2B Filesystem Implementation
|
|
7
|
-
*
|
|
8
|
-
* Provides FilesResource implementation using E2B Sandbox SDK.
|
|
9
|
-
* Supports optional auto-reconnect on auth failure (401/403).
|
|
10
|
-
*
|
|
11
|
-
* @see https://e2b.dev/docs/filesystem/read-write
|
|
12
|
-
* @see https://e2b.dev/docs/filesystem/watch
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* E2B Filesystem
|
|
16
|
-
*
|
|
17
|
-
* Wraps E2B Sandbox SDK's filesystem operations to implement FilesResource.
|
|
18
|
-
* When `reconnectFn` is provided, automatically reconnects on auth errors.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```typescript
|
|
22
|
-
* // Basic usage (no auto-reconnect)
|
|
23
|
-
* const fs = await E2BFilesystem.connect({ sandboxId: '...' });
|
|
24
|
-
*
|
|
25
|
-
* // With auto-reconnect on token expiry
|
|
26
|
-
* const fs = await E2BFilesystem.connect({ sandboxId: '...' });
|
|
27
|
-
* fs.setReconnectFn(async () => fetchFreshConnectionInfo());
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
var E2BFilesystem = class E2BFilesystem {
|
|
31
|
-
static {
|
|
32
|
-
this.MIN_RECONNECT_INTERVAL_MS = 10 * 1e3;
|
|
33
|
-
}
|
|
34
|
-
constructor(sandbox) {
|
|
35
|
-
this.isReconnecting = false;
|
|
36
|
-
this.reconnectSubscribers = [];
|
|
37
|
-
this.lastReconnectAt = 0;
|
|
38
|
-
this.sandbox = sandbox;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Connect to an E2B Sandbox and create filesystem instance
|
|
42
|
-
*/
|
|
43
|
-
static async connect(info) {
|
|
44
|
-
return new E2BFilesystem(await e2b.Sandbox.connect(info.sandboxId, {
|
|
45
|
-
domain: info.domain,
|
|
46
|
-
apiUrl: info.apiUrl,
|
|
47
|
-
requestTimeoutMs: info.requestTimeoutMs,
|
|
48
|
-
debug: info.debug,
|
|
49
|
-
headers: info.headers
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Set reconnect callback. When set, auth errors trigger automatic reconnect + retry.
|
|
54
|
-
*/
|
|
55
|
-
setReconnectFn(fn) {
|
|
56
|
-
this.reconnectFn = fn;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Get the underlying E2B Sandbox instance
|
|
60
|
-
*/
|
|
61
|
-
getSandbox() {
|
|
62
|
-
return this.sandbox;
|
|
63
|
-
}
|
|
64
|
-
isAuthError(error) {
|
|
65
|
-
if (!error || typeof error !== "object") return false;
|
|
66
|
-
const err = error;
|
|
67
|
-
if (err.status === 401 || err.status === 403) return true;
|
|
68
|
-
if (err.statusCode === 401 || err.statusCode === 403) return true;
|
|
69
|
-
if (err.response && typeof err.response === "object") {
|
|
70
|
-
const resp = err.response;
|
|
71
|
-
if (resp.status === 401 || resp.status === 403) return true;
|
|
72
|
-
}
|
|
73
|
-
if (typeof err.message === "string") {
|
|
74
|
-
const msg = err.message.toLowerCase();
|
|
75
|
-
if (msg.includes("unauthorized") || msg.includes("token expired") || msg.includes("authentication")) return true;
|
|
76
|
-
}
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
canAttemptReconnect() {
|
|
80
|
-
return Date.now() - this.lastReconnectAt >= E2BFilesystem.MIN_RECONNECT_INTERVAL_MS;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Reconnect with fresh credentials.
|
|
84
|
-
* Only one reconnect in-flight at a time; concurrent callers share the result.
|
|
85
|
-
*/
|
|
86
|
-
async reconnect() {
|
|
87
|
-
if (this.isReconnecting) return new Promise((resolve, reject) => {
|
|
88
|
-
this.reconnectSubscribers.push((success) => {
|
|
89
|
-
if (success) resolve();
|
|
90
|
-
else reject(/* @__PURE__ */ new Error("E2B sandbox reconnect failed"));
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
this.isReconnecting = true;
|
|
94
|
-
this.lastReconnectAt = Date.now();
|
|
95
|
-
try {
|
|
96
|
-
const info = await this.reconnectFn();
|
|
97
|
-
this.sandbox = await e2b.Sandbox.connect(info.sandboxId, {
|
|
98
|
-
domain: info.domain,
|
|
99
|
-
apiUrl: info.apiUrl,
|
|
100
|
-
requestTimeoutMs: info.requestTimeoutMs,
|
|
101
|
-
debug: info.debug,
|
|
102
|
-
headers: info.headers
|
|
103
|
-
});
|
|
104
|
-
this.reconnectSubscribers.forEach((cb) => cb(true));
|
|
105
|
-
this.reconnectSubscribers = [];
|
|
106
|
-
} catch (error) {
|
|
107
|
-
this.reconnectSubscribers.forEach((cb) => cb(false));
|
|
108
|
-
this.reconnectSubscribers = [];
|
|
109
|
-
throw error;
|
|
110
|
-
} finally {
|
|
111
|
-
this.isReconnecting = false;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Execute an operation. If reconnectFn is set and an auth error occurs,
|
|
116
|
-
* reconnect and retry once.
|
|
117
|
-
*/
|
|
118
|
-
async exec(operation) {
|
|
119
|
-
try {
|
|
120
|
-
return await operation(this.sandbox.files);
|
|
121
|
-
} catch (error) {
|
|
122
|
-
if (this.reconnectFn && this.isAuthError(error) && this.canAttemptReconnect()) {
|
|
123
|
-
await this.reconnect();
|
|
124
|
-
return operation(this.sandbox.files);
|
|
125
|
-
}
|
|
126
|
-
throw error;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
read(path, opts) {
|
|
130
|
-
return this.exec((f) => f.read(path, opts));
|
|
131
|
-
}
|
|
132
|
-
write(pathOrFiles, dataOrOpts, opts) {
|
|
133
|
-
return this.exec((f) => {
|
|
134
|
-
if (Array.isArray(pathOrFiles)) return f.write(pathOrFiles, dataOrOpts);
|
|
135
|
-
return f.write(pathOrFiles, dataOrOpts, opts);
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
async list(path, opts) {
|
|
139
|
-
return this.exec((f) => f.list(path, opts));
|
|
140
|
-
}
|
|
141
|
-
async exists(path, opts) {
|
|
142
|
-
return this.exec((f) => f.exists(path, opts));
|
|
143
|
-
}
|
|
144
|
-
async makeDir(path, opts) {
|
|
145
|
-
return this.exec((f) => f.makeDir(path, opts));
|
|
146
|
-
}
|
|
147
|
-
async remove(path, opts) {
|
|
148
|
-
return this.exec((f) => f.remove(path, opts));
|
|
149
|
-
}
|
|
150
|
-
async rename(oldPath, newPath, opts) {
|
|
151
|
-
return this.exec((f) => f.rename(oldPath, newPath, opts));
|
|
152
|
-
}
|
|
153
|
-
async getInfo(path, opts) {
|
|
154
|
-
return this.exec((f) => f.getInfo(path, opts));
|
|
155
|
-
}
|
|
156
|
-
async watchDir(path, onEvent, opts) {
|
|
157
|
-
return this.exec((f) => f.watchDir(path, onEvent, opts));
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
//#endregion
|
|
162
|
-
Object.defineProperty(exports, 'E2BFilesystem', {
|
|
163
|
-
enumerable: true,
|
|
164
|
-
get: function () {
|
|
165
|
-
return E2BFilesystem;
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
//# sourceMappingURL=e2b-filesystem-4-LU6-jg.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"e2b-filesystem-4-LU6-jg.cjs","names":["Sandbox"],"sources":["../../agent-provider/src/common/providers/cloud-agent-provider/e2b-filesystem.ts"],"sourcesContent":["/**\n * E2B Filesystem Implementation\n *\n * Provides FilesResource implementation using E2B Sandbox SDK.\n * Supports optional auto-reconnect on auth failure (401/403).\n *\n * @see https://e2b.dev/docs/filesystem/read-write\n * @see https://e2b.dev/docs/filesystem/watch\n */\n\nimport { Sandbox } from 'e2b';\n\nimport type {\n E2BSandboxConnectionInfo,\n EntryInfo,\n FilesResource,\n FilesystemEvent,\n FilesystemListOpts,\n FilesystemRequestOpts,\n WatchHandle,\n WatchOpts,\n WriteEntry,\n WriteInfo\n} from '../../types.js';\n\n/**\n * Callback to fetch fresh sandbox connection info from backend.\n * Called when an operation fails with 401/403.\n */\nexport type ReconnectFn = () => Promise<E2BSandboxConnectionInfo>;\n\n/**\n * E2B Filesystem\n *\n * Wraps E2B Sandbox SDK's filesystem operations to implement FilesResource.\n * When `reconnectFn` is provided, automatically reconnects on auth errors.\n *\n * @example\n * ```typescript\n * // Basic usage (no auto-reconnect)\n * const fs = await E2BFilesystem.connect({ sandboxId: '...' });\n *\n * // With auto-reconnect on token expiry\n * const fs = await E2BFilesystem.connect({ sandboxId: '...' });\n * fs.setReconnectFn(async () => fetchFreshConnectionInfo());\n * ```\n */\nexport class E2BFilesystem implements FilesResource {\n private sandbox: Sandbox;\n private reconnectFn?: ReconnectFn;\n\n /** Whether a reconnect is currently in-flight */\n private isReconnecting = false;\n /** Callers waiting for the in-flight reconnect to complete */\n private reconnectSubscribers: Array<(success: boolean) => void> = [];\n /** Timestamp of last reconnect attempt (anti-loop: min 10s between attempts) */\n private lastReconnectAt = 0;\n\n private static readonly MIN_RECONNECT_INTERVAL_MS = 10 * 1000;\n\n constructor(sandbox: Sandbox) {\n this.sandbox = sandbox;\n }\n\n /**\n * Connect to an E2B Sandbox and create filesystem instance\n */\n static async connect(info: E2BSandboxConnectionInfo): Promise<E2BFilesystem> {\n const sandbox = await Sandbox.connect(info.sandboxId, {\n domain: info.domain,\n apiUrl: info.apiUrl,\n requestTimeoutMs: info.requestTimeoutMs,\n debug: info.debug,\n headers: info.headers\n });\n return new E2BFilesystem(sandbox);\n }\n\n /**\n * Set reconnect callback. When set, auth errors trigger automatic reconnect + retry.\n */\n setReconnectFn(fn: ReconnectFn): void {\n this.reconnectFn = fn;\n }\n\n /**\n * Get the underlying E2B Sandbox instance\n */\n getSandbox(): Sandbox {\n return this.sandbox;\n }\n\n // ============================================\n // Auto-Reconnect\n // ============================================\n\n private isAuthError(error: unknown): boolean {\n if (!error || typeof error !== 'object') {\n return false;\n }\n\n const err = error as Record<string, unknown>;\n\n if (err.status === 401 || err.status === 403) {\n return true;\n }\n if (err.statusCode === 401 || err.statusCode === 403) {\n return true;\n }\n\n if (err.response && typeof err.response === 'object') {\n const resp = err.response as Record<string, unknown>;\n if (resp.status === 401 || resp.status === 403) {\n return true;\n }\n }\n\n // e2b SDK throws AuthenticationError with \"Unauthorized\" message\n if (typeof err.message === 'string') {\n const msg = err.message.toLowerCase();\n if (msg.includes('unauthorized') || msg.includes('token expired') || msg.includes('authentication')) {\n return true;\n }\n }\n\n return false;\n }\n\n private canAttemptReconnect(): boolean {\n return (Date.now() - this.lastReconnectAt) >= E2BFilesystem.MIN_RECONNECT_INTERVAL_MS;\n }\n\n /**\n * Reconnect with fresh credentials.\n * Only one reconnect in-flight at a time; concurrent callers share the result.\n */\n private async reconnect(): Promise<void> {\n if (this.isReconnecting) {\n return new Promise<void>((resolve, reject) => {\n this.reconnectSubscribers.push((success: boolean) => {\n if (success) {\n resolve();\n } else {\n reject(new Error('E2B sandbox reconnect failed'));\n }\n });\n });\n }\n\n this.isReconnecting = true;\n this.lastReconnectAt = Date.now();\n\n try {\n const info = await this.reconnectFn!();\n const newSandbox = await Sandbox.connect(info.sandboxId, {\n domain: info.domain,\n apiUrl: info.apiUrl,\n requestTimeoutMs: info.requestTimeoutMs,\n debug: info.debug,\n headers: info.headers\n });\n this.sandbox = newSandbox;\n\n this.reconnectSubscribers.forEach(cb => cb(true));\n this.reconnectSubscribers = [];\n } catch (error) {\n this.reconnectSubscribers.forEach(cb => cb(false));\n this.reconnectSubscribers = [];\n throw error;\n } finally {\n this.isReconnecting = false;\n }\n }\n\n /**\n * Execute an operation. If reconnectFn is set and an auth error occurs,\n * reconnect and retry once.\n */\n private async exec<T>(operation: (files: Sandbox['files']) => Promise<T>): Promise<T> {\n try {\n return await operation(this.sandbox.files);\n } catch (error) {\n if (this.reconnectFn && this.isAuthError(error) && this.canAttemptReconnect()) {\n await this.reconnect();\n return operation(this.sandbox.files);\n }\n throw error;\n }\n }\n\n // ============================================\n // FilesResource Implementation\n // ============================================\n\n read(path: string, opts?: FilesystemRequestOpts & { format?: 'text' }): Promise<string>;\n read(path: string, opts: FilesystemRequestOpts & { format: 'bytes' }): Promise<Uint8Array>;\n read(path: string, opts: FilesystemRequestOpts & { format: 'blob' }): Promise<Blob>;\n read(path: string, opts: FilesystemRequestOpts & { format: 'stream' }): Promise<ReadableStream<Uint8Array>>;\n read(path: string, opts?: FilesystemRequestOpts & { format?: string }): Promise<string | Uint8Array | Blob | ReadableStream<Uint8Array>> {\n return this.exec(f => f.read(path, opts as any));\n }\n\n write(path: string, data: string | ArrayBuffer | Blob | ReadableStream, opts?: FilesystemRequestOpts): Promise<WriteInfo>;\n write(files: WriteEntry[], opts?: FilesystemRequestOpts): Promise<WriteInfo[]>;\n write(\n pathOrFiles: string | WriteEntry[],\n dataOrOpts?: string | ArrayBuffer | Blob | ReadableStream | FilesystemRequestOpts,\n opts?: FilesystemRequestOpts,\n ): Promise<WriteInfo | WriteInfo[]> {\n // Cast needed: e2b SDK's WriteInfo.type is optional (`FileType | undefined`)\n // but our re-exported WriteInfo from types.ts may resolve to a different .d.ts copy.\n return this.exec<WriteInfo | WriteInfo[]>(f => {\n if (Array.isArray(pathOrFiles)) {\n return f.write(pathOrFiles, dataOrOpts as FilesystemRequestOpts) as Promise<WriteInfo[]>;\n }\n return f.write(pathOrFiles, dataOrOpts as string | ArrayBuffer | Blob | ReadableStream, opts) as Promise<WriteInfo>;\n });\n }\n\n async list(path: string, opts?: FilesystemListOpts): Promise<EntryInfo[]> {\n return this.exec(f => f.list(path, opts) as Promise<EntryInfo[]>);\n }\n\n async exists(path: string, opts?: FilesystemRequestOpts): Promise<boolean> {\n return this.exec(f => f.exists(path, opts));\n }\n\n async makeDir(path: string, opts?: FilesystemRequestOpts): Promise<boolean> {\n return this.exec(f => f.makeDir(path, opts));\n }\n\n async remove(path: string, opts?: FilesystemRequestOpts): Promise<void> {\n return this.exec(f => f.remove(path, opts));\n }\n\n async rename(oldPath: string, newPath: string, opts?: FilesystemRequestOpts): Promise<EntryInfo> {\n return this.exec(f => f.rename(oldPath, newPath, opts) as Promise<EntryInfo>);\n }\n\n async getInfo(path: string, opts?: FilesystemRequestOpts): Promise<EntryInfo> {\n return this.exec(f => f.getInfo(path, opts) as Promise<EntryInfo>);\n }\n\n async watchDir(\n path: string,\n onEvent: (event: FilesystemEvent) => void | Promise<void>,\n opts?: WatchOpts & { onExit?: (err?: Error) => void | Promise<void> }\n ): Promise<WatchHandle> {\n return this.exec(f => f.watchDir(path, onEvent as any, opts) as Promise<WatchHandle>);\n }\n}\n\nexport default E2BFilesystem;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,IAAa,gBAA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;AACpE,SAAO,KAAK,MAAK,MAAK,EAAE,OAAO,MAAM,KAAK,CAAC;;CAG/C,MAAM,OAAO,SAAiB,SAAiB,MAAkD;AAC7F,SAAO,KAAK,MAAK,MAAK,EAAE,OAAO,SAAS,SAAS,KAAK,CAAuB;;CAGjF,MAAM,QAAQ,MAAc,MAAkD;AAC1E,SAAO,KAAK,MAAK,MAAK,EAAE,QAAQ,MAAM,KAAK,CAAuB;;CAGtE,MAAM,SACF,MACA,SACA,MACoB;AACpB,SAAO,KAAK,MAAK,MAAK,EAAE,SAAS,MAAM,SAAgB,KAAK,CAAyB"}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { Sandbox } from "e2b";
|
|
2
|
-
|
|
3
|
-
//#region ../agent-provider/src/common/providers/cloud-agent-provider/e2b-filesystem.ts
|
|
4
|
-
/**
|
|
5
|
-
* E2B Filesystem Implementation
|
|
6
|
-
*
|
|
7
|
-
* Provides FilesResource implementation using E2B Sandbox SDK.
|
|
8
|
-
* Supports optional auto-reconnect on auth failure (401/403).
|
|
9
|
-
*
|
|
10
|
-
* @see https://e2b.dev/docs/filesystem/read-write
|
|
11
|
-
* @see https://e2b.dev/docs/filesystem/watch
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* E2B Filesystem
|
|
15
|
-
*
|
|
16
|
-
* Wraps E2B Sandbox SDK's filesystem operations to implement FilesResource.
|
|
17
|
-
* When `reconnectFn` is provided, automatically reconnects on auth errors.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* // Basic usage (no auto-reconnect)
|
|
22
|
-
* const fs = await E2BFilesystem.connect({ sandboxId: '...' });
|
|
23
|
-
*
|
|
24
|
-
* // With auto-reconnect on token expiry
|
|
25
|
-
* const fs = await E2BFilesystem.connect({ sandboxId: '...' });
|
|
26
|
-
* fs.setReconnectFn(async () => fetchFreshConnectionInfo());
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
var E2BFilesystem = class E2BFilesystem {
|
|
30
|
-
static {
|
|
31
|
-
this.MIN_RECONNECT_INTERVAL_MS = 10 * 1e3;
|
|
32
|
-
}
|
|
33
|
-
constructor(sandbox) {
|
|
34
|
-
this.isReconnecting = false;
|
|
35
|
-
this.reconnectSubscribers = [];
|
|
36
|
-
this.lastReconnectAt = 0;
|
|
37
|
-
this.sandbox = sandbox;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Connect to an E2B Sandbox and create filesystem instance
|
|
41
|
-
*/
|
|
42
|
-
static async connect(info) {
|
|
43
|
-
return new E2BFilesystem(await Sandbox.connect(info.sandboxId, {
|
|
44
|
-
domain: info.domain,
|
|
45
|
-
apiUrl: info.apiUrl,
|
|
46
|
-
requestTimeoutMs: info.requestTimeoutMs,
|
|
47
|
-
debug: info.debug,
|
|
48
|
-
headers: info.headers
|
|
49
|
-
}));
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Set reconnect callback. When set, auth errors trigger automatic reconnect + retry.
|
|
53
|
-
*/
|
|
54
|
-
setReconnectFn(fn) {
|
|
55
|
-
this.reconnectFn = fn;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Get the underlying E2B Sandbox instance
|
|
59
|
-
*/
|
|
60
|
-
getSandbox() {
|
|
61
|
-
return this.sandbox;
|
|
62
|
-
}
|
|
63
|
-
isAuthError(error) {
|
|
64
|
-
if (!error || typeof error !== "object") return false;
|
|
65
|
-
const err = error;
|
|
66
|
-
if (err.status === 401 || err.status === 403) return true;
|
|
67
|
-
if (err.statusCode === 401 || err.statusCode === 403) return true;
|
|
68
|
-
if (err.response && typeof err.response === "object") {
|
|
69
|
-
const resp = err.response;
|
|
70
|
-
if (resp.status === 401 || resp.status === 403) return true;
|
|
71
|
-
}
|
|
72
|
-
if (typeof err.message === "string") {
|
|
73
|
-
const msg = err.message.toLowerCase();
|
|
74
|
-
if (msg.includes("unauthorized") || msg.includes("token expired") || msg.includes("authentication")) return true;
|
|
75
|
-
}
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
canAttemptReconnect() {
|
|
79
|
-
return Date.now() - this.lastReconnectAt >= E2BFilesystem.MIN_RECONNECT_INTERVAL_MS;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Reconnect with fresh credentials.
|
|
83
|
-
* Only one reconnect in-flight at a time; concurrent callers share the result.
|
|
84
|
-
*/
|
|
85
|
-
async reconnect() {
|
|
86
|
-
if (this.isReconnecting) return new Promise((resolve, reject) => {
|
|
87
|
-
this.reconnectSubscribers.push((success) => {
|
|
88
|
-
if (success) resolve();
|
|
89
|
-
else reject(/* @__PURE__ */ new Error("E2B sandbox reconnect failed"));
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
this.isReconnecting = true;
|
|
93
|
-
this.lastReconnectAt = Date.now();
|
|
94
|
-
try {
|
|
95
|
-
const info = await this.reconnectFn();
|
|
96
|
-
this.sandbox = await Sandbox.connect(info.sandboxId, {
|
|
97
|
-
domain: info.domain,
|
|
98
|
-
apiUrl: info.apiUrl,
|
|
99
|
-
requestTimeoutMs: info.requestTimeoutMs,
|
|
100
|
-
debug: info.debug,
|
|
101
|
-
headers: info.headers
|
|
102
|
-
});
|
|
103
|
-
this.reconnectSubscribers.forEach((cb) => cb(true));
|
|
104
|
-
this.reconnectSubscribers = [];
|
|
105
|
-
} catch (error) {
|
|
106
|
-
this.reconnectSubscribers.forEach((cb) => cb(false));
|
|
107
|
-
this.reconnectSubscribers = [];
|
|
108
|
-
throw error;
|
|
109
|
-
} finally {
|
|
110
|
-
this.isReconnecting = false;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Execute an operation. If reconnectFn is set and an auth error occurs,
|
|
115
|
-
* reconnect and retry once.
|
|
116
|
-
*/
|
|
117
|
-
async exec(operation) {
|
|
118
|
-
try {
|
|
119
|
-
return await operation(this.sandbox.files);
|
|
120
|
-
} catch (error) {
|
|
121
|
-
if (this.reconnectFn && this.isAuthError(error) && this.canAttemptReconnect()) {
|
|
122
|
-
await this.reconnect();
|
|
123
|
-
return operation(this.sandbox.files);
|
|
124
|
-
}
|
|
125
|
-
throw error;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
read(path, opts) {
|
|
129
|
-
return this.exec((f) => f.read(path, opts));
|
|
130
|
-
}
|
|
131
|
-
write(pathOrFiles, dataOrOpts, opts) {
|
|
132
|
-
return this.exec((f) => {
|
|
133
|
-
if (Array.isArray(pathOrFiles)) return f.write(pathOrFiles, dataOrOpts);
|
|
134
|
-
return f.write(pathOrFiles, dataOrOpts, opts);
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
async list(path, opts) {
|
|
138
|
-
return this.exec((f) => f.list(path, opts));
|
|
139
|
-
}
|
|
140
|
-
async exists(path, opts) {
|
|
141
|
-
return this.exec((f) => f.exists(path, opts));
|
|
142
|
-
}
|
|
143
|
-
async makeDir(path, opts) {
|
|
144
|
-
return this.exec((f) => f.makeDir(path, opts));
|
|
145
|
-
}
|
|
146
|
-
async remove(path, opts) {
|
|
147
|
-
return this.exec((f) => f.remove(path, opts));
|
|
148
|
-
}
|
|
149
|
-
async rename(oldPath, newPath, opts) {
|
|
150
|
-
return this.exec((f) => f.rename(oldPath, newPath, opts));
|
|
151
|
-
}
|
|
152
|
-
async getInfo(path, opts) {
|
|
153
|
-
return this.exec((f) => f.getInfo(path, opts));
|
|
154
|
-
}
|
|
155
|
-
async watchDir(path, onEvent, opts) {
|
|
156
|
-
return this.exec((f) => f.watchDir(path, onEvent, opts));
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
//#endregion
|
|
161
|
-
export { E2BFilesystem as t };
|
|
162
|
-
//# sourceMappingURL=e2b-filesystem-BNmEfpoW.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"e2b-filesystem-BNmEfpoW.mjs","names":[],"sources":["../../agent-provider/src/common/providers/cloud-agent-provider/e2b-filesystem.ts"],"sourcesContent":["/**\n * E2B Filesystem Implementation\n *\n * Provides FilesResource implementation using E2B Sandbox SDK.\n * Supports optional auto-reconnect on auth failure (401/403).\n *\n * @see https://e2b.dev/docs/filesystem/read-write\n * @see https://e2b.dev/docs/filesystem/watch\n */\n\nimport { Sandbox } from 'e2b';\n\nimport type {\n E2BSandboxConnectionInfo,\n EntryInfo,\n FilesResource,\n FilesystemEvent,\n FilesystemListOpts,\n FilesystemRequestOpts,\n WatchHandle,\n WatchOpts,\n WriteEntry,\n WriteInfo\n} from '../../types.js';\n\n/**\n * Callback to fetch fresh sandbox connection info from backend.\n * Called when an operation fails with 401/403.\n */\nexport type ReconnectFn = () => Promise<E2BSandboxConnectionInfo>;\n\n/**\n * E2B Filesystem\n *\n * Wraps E2B Sandbox SDK's filesystem operations to implement FilesResource.\n * When `reconnectFn` is provided, automatically reconnects on auth errors.\n *\n * @example\n * ```typescript\n * // Basic usage (no auto-reconnect)\n * const fs = await E2BFilesystem.connect({ sandboxId: '...' });\n *\n * // With auto-reconnect on token expiry\n * const fs = await E2BFilesystem.connect({ sandboxId: '...' });\n * fs.setReconnectFn(async () => fetchFreshConnectionInfo());\n * ```\n */\nexport class E2BFilesystem implements FilesResource {\n private sandbox: Sandbox;\n private reconnectFn?: ReconnectFn;\n\n /** Whether a reconnect is currently in-flight */\n private isReconnecting = false;\n /** Callers waiting for the in-flight reconnect to complete */\n private reconnectSubscribers: Array<(success: boolean) => void> = [];\n /** Timestamp of last reconnect attempt (anti-loop: min 10s between attempts) */\n private lastReconnectAt = 0;\n\n private static readonly MIN_RECONNECT_INTERVAL_MS = 10 * 1000;\n\n constructor(sandbox: Sandbox) {\n this.sandbox = sandbox;\n }\n\n /**\n * Connect to an E2B Sandbox and create filesystem instance\n */\n static async connect(info: E2BSandboxConnectionInfo): Promise<E2BFilesystem> {\n const sandbox = await Sandbox.connect(info.sandboxId, {\n domain: info.domain,\n apiUrl: info.apiUrl,\n requestTimeoutMs: info.requestTimeoutMs,\n debug: info.debug,\n headers: info.headers\n });\n return new E2BFilesystem(sandbox);\n }\n\n /**\n * Set reconnect callback. When set, auth errors trigger automatic reconnect + retry.\n */\n setReconnectFn(fn: ReconnectFn): void {\n this.reconnectFn = fn;\n }\n\n /**\n * Get the underlying E2B Sandbox instance\n */\n getSandbox(): Sandbox {\n return this.sandbox;\n }\n\n // ============================================\n // Auto-Reconnect\n // ============================================\n\n private isAuthError(error: unknown): boolean {\n if (!error || typeof error !== 'object') {\n return false;\n }\n\n const err = error as Record<string, unknown>;\n\n if (err.status === 401 || err.status === 403) {\n return true;\n }\n if (err.statusCode === 401 || err.statusCode === 403) {\n return true;\n }\n\n if (err.response && typeof err.response === 'object') {\n const resp = err.response as Record<string, unknown>;\n if (resp.status === 401 || resp.status === 403) {\n return true;\n }\n }\n\n // e2b SDK throws AuthenticationError with \"Unauthorized\" message\n if (typeof err.message === 'string') {\n const msg = err.message.toLowerCase();\n if (msg.includes('unauthorized') || msg.includes('token expired') || msg.includes('authentication')) {\n return true;\n }\n }\n\n return false;\n }\n\n private canAttemptReconnect(): boolean {\n return (Date.now() - this.lastReconnectAt) >= E2BFilesystem.MIN_RECONNECT_INTERVAL_MS;\n }\n\n /**\n * Reconnect with fresh credentials.\n * Only one reconnect in-flight at a time; concurrent callers share the result.\n */\n private async reconnect(): Promise<void> {\n if (this.isReconnecting) {\n return new Promise<void>((resolve, reject) => {\n this.reconnectSubscribers.push((success: boolean) => {\n if (success) {\n resolve();\n } else {\n reject(new Error('E2B sandbox reconnect failed'));\n }\n });\n });\n }\n\n this.isReconnecting = true;\n this.lastReconnectAt = Date.now();\n\n try {\n const info = await this.reconnectFn!();\n const newSandbox = await Sandbox.connect(info.sandboxId, {\n domain: info.domain,\n apiUrl: info.apiUrl,\n requestTimeoutMs: info.requestTimeoutMs,\n debug: info.debug,\n headers: info.headers\n });\n this.sandbox = newSandbox;\n\n this.reconnectSubscribers.forEach(cb => cb(true));\n this.reconnectSubscribers = [];\n } catch (error) {\n this.reconnectSubscribers.forEach(cb => cb(false));\n this.reconnectSubscribers = [];\n throw error;\n } finally {\n this.isReconnecting = false;\n }\n }\n\n /**\n * Execute an operation. If reconnectFn is set and an auth error occurs,\n * reconnect and retry once.\n */\n private async exec<T>(operation: (files: Sandbox['files']) => Promise<T>): Promise<T> {\n try {\n return await operation(this.sandbox.files);\n } catch (error) {\n if (this.reconnectFn && this.isAuthError(error) && this.canAttemptReconnect()) {\n await this.reconnect();\n return operation(this.sandbox.files);\n }\n throw error;\n }\n }\n\n // ============================================\n // FilesResource Implementation\n // ============================================\n\n read(path: string, opts?: FilesystemRequestOpts & { format?: 'text' }): Promise<string>;\n read(path: string, opts: FilesystemRequestOpts & { format: 'bytes' }): Promise<Uint8Array>;\n read(path: string, opts: FilesystemRequestOpts & { format: 'blob' }): Promise<Blob>;\n read(path: string, opts: FilesystemRequestOpts & { format: 'stream' }): Promise<ReadableStream<Uint8Array>>;\n read(path: string, opts?: FilesystemRequestOpts & { format?: string }): Promise<string | Uint8Array | Blob | ReadableStream<Uint8Array>> {\n return this.exec(f => f.read(path, opts as any));\n }\n\n write(path: string, data: string | ArrayBuffer | Blob | ReadableStream, opts?: FilesystemRequestOpts): Promise<WriteInfo>;\n write(files: WriteEntry[], opts?: FilesystemRequestOpts): Promise<WriteInfo[]>;\n write(\n pathOrFiles: string | WriteEntry[],\n dataOrOpts?: string | ArrayBuffer | Blob | ReadableStream | FilesystemRequestOpts,\n opts?: FilesystemRequestOpts,\n ): Promise<WriteInfo | WriteInfo[]> {\n // Cast needed: e2b SDK's WriteInfo.type is optional (`FileType | undefined`)\n // but our re-exported WriteInfo from types.ts may resolve to a different .d.ts copy.\n return this.exec<WriteInfo | WriteInfo[]>(f => {\n if (Array.isArray(pathOrFiles)) {\n return f.write(pathOrFiles, dataOrOpts as FilesystemRequestOpts) as Promise<WriteInfo[]>;\n }\n return f.write(pathOrFiles, dataOrOpts as string | ArrayBuffer | Blob | ReadableStream, opts) as Promise<WriteInfo>;\n });\n }\n\n async list(path: string, opts?: FilesystemListOpts): Promise<EntryInfo[]> {\n return this.exec(f => f.list(path, opts) as Promise<EntryInfo[]>);\n }\n\n async exists(path: string, opts?: FilesystemRequestOpts): Promise<boolean> {\n return this.exec(f => f.exists(path, opts));\n }\n\n async makeDir(path: string, opts?: FilesystemRequestOpts): Promise<boolean> {\n return this.exec(f => f.makeDir(path, opts));\n }\n\n async remove(path: string, opts?: FilesystemRequestOpts): Promise<void> {\n return this.exec(f => f.remove(path, opts));\n }\n\n async rename(oldPath: string, newPath: string, opts?: FilesystemRequestOpts): Promise<EntryInfo> {\n return this.exec(f => f.rename(oldPath, newPath, opts) as Promise<EntryInfo>);\n }\n\n async getInfo(path: string, opts?: FilesystemRequestOpts): Promise<EntryInfo> {\n return this.exec(f => f.getInfo(path, opts) as Promise<EntryInfo>);\n }\n\n async watchDir(\n path: string,\n onEvent: (event: FilesystemEvent) => void | Promise<void>,\n opts?: WatchOpts & { onExit?: (err?: Error) => void | Promise<void> }\n ): Promise<WatchHandle> {\n return this.exec(f => f.watchDir(path, onEvent as any, opts) as Promise<WatchHandle>);\n }\n}\n\nexport default E2BFilesystem;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,IAAa,gBAAb,MAAa,cAAuC;;mCAWI,KAAK;;CAEzD,YAAY,SAAkB;wBARL;8BAEyC,EAAE;yBAE1C;AAKtB,OAAK,UAAU;;;;;CAMnB,aAAa,QAAQ,MAAwD;AAQzE,SAAO,IAAI,cAPK,MAAM,QAAQ,QAAQ,KAAK,WAAW;GAClD,QAAQ,KAAK;GACb,QAAQ,KAAK;GACb,kBAAkB,KAAK;GACvB,OAAO,KAAK;GACZ,SAAS,KAAK;GACjB,CAAC,CAC+B;;;;;CAMrC,eAAe,IAAuB;AAClC,OAAK,cAAc;;;;;CAMvB,aAAsB;AAClB,SAAO,KAAK;;CAOhB,AAAQ,YAAY,OAAyB;AACzC,MAAI,CAAC,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