@cloudflare/sandbox 0.13.0-next.681.1 → 0.13.0-next.709.1
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/Dockerfile +6 -6
- package/README.md +49 -3
- package/dist/bridge/index.d.ts.map +1 -1
- package/dist/bridge/index.js +1364 -1072
- package/dist/bridge/index.js.map +1 -1
- package/dist/{contexts-DY1LHU1v.d.ts → contexts-1EsLHByO.d.ts} +156 -20
- package/dist/contexts-1EsLHByO.d.ts.map +1 -0
- package/dist/{dist-BStBkGIC.js → dist-Duor5GbS.js} +7 -56
- package/dist/dist-Duor5GbS.js.map +1 -0
- package/dist/errors/index.d.ts +4 -4
- package/dist/errors/index.js +3 -3
- package/dist/{errors-k3B8orjH.js → errors-CXR0xBpw.js} +42 -10
- package/dist/errors-CXR0xBpw.js.map +1 -0
- package/dist/{errors-ewgSNicb.js → errors-QYlSkVGz.js} +402 -250
- package/dist/errors-QYlSkVGz.js.map +1 -0
- package/dist/extensions/index.d.ts +4 -2
- package/dist/extensions/index.js +5 -3
- package/dist/extensions-CFB2xHqY.js +1023 -0
- package/dist/extensions-CFB2xHqY.js.map +1 -0
- package/dist/filesystem-BWAZCZER.d.ts +732 -0
- package/dist/filesystem-BWAZCZER.d.ts.map +1 -0
- package/dist/git/index.d.ts +8 -19
- package/dist/git/index.d.ts.map +1 -1
- package/dist/git/index.js +16 -23
- package/dist/git/index.js.map +1 -1
- package/dist/index-Bs4bqXDR.d.ts +438 -0
- package/dist/index-Bs4bqXDR.d.ts.map +1 -0
- package/dist/{index-Dy6u9r60.d.ts → index-HNYBk-az.d.ts} +233 -179
- package/dist/index-HNYBk-az.d.ts.map +1 -0
- package/dist/index.d.ts +480 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/interpreter/index.d.ts +3 -1
- package/dist/interpreter/index.d.ts.map +1 -1
- package/dist/interpreter/index.js +46 -18
- package/dist/interpreter/index.js.map +1 -1
- package/dist/openai/index.d.ts +5 -5
- package/dist/openai/index.d.ts.map +1 -1
- package/dist/openai/index.js +11 -6
- package/dist/openai/index.js.map +1 -1
- package/dist/opencode/index.d.ts +7 -11
- package/dist/opencode/index.d.ts.map +1 -1
- package/dist/opencode/index.js +56 -85
- package/dist/opencode/index.js.map +1 -1
- package/dist/process-types-GStiZ8f8.d.ts +73 -0
- package/dist/process-types-GStiZ8f8.d.ts.map +1 -0
- package/dist/{sandbox-boKWPIcd.js → sandbox-Auuwfnur.js} +4152 -3359
- package/dist/sandbox-Auuwfnur.js.map +1 -0
- package/dist/sandbox-BbAabq93.d.ts +42 -0
- package/dist/sandbox-BbAabq93.d.ts.map +1 -0
- package/dist/xterm/index.d.ts +5 -1
- package/dist/xterm/index.d.ts.map +1 -1
- package/dist/xterm/index.js +55 -12
- package/dist/xterm/index.js.map +1 -1
- package/package.json +3 -2
- package/dist/codes-y-U76vnQ.d.ts +0 -79
- package/dist/codes-y-U76vnQ.d.ts.map +0 -1
- package/dist/contexts-DY1LHU1v.d.ts.map +0 -1
- package/dist/dist-BStBkGIC.js.map +0 -1
- package/dist/errors-ewgSNicb.js.map +0 -1
- package/dist/errors-k3B8orjH.js.map +0 -1
- package/dist/extensions-CepYdzro.js +0 -191
- package/dist/extensions-CepYdzro.js.map +0 -1
- package/dist/index-B7QgIs0N.d.ts +0 -1841
- package/dist/index-B7QgIs0N.d.ts.map +0 -1
- package/dist/index-Dy6u9r60.d.ts.map +0 -1
- package/dist/sandbox-DHNO89IF.d.ts +0 -828
- package/dist/sandbox-DHNO89IF.d.ts.map +0 -1
- package/dist/sandbox-boKWPIcd.js.map +0 -1
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { i as ErrorCode } from "./errors-
|
|
1
|
+
import { i as ErrorCode, r as getHttpStatus } from "./errors-CXR0xBpw.js";
|
|
2
2
|
|
|
3
|
-
//#region src/errors/classes.ts
|
|
4
|
-
/**
|
|
5
|
-
* Base SDK error that wraps ErrorResponse
|
|
6
|
-
* Preserves all error information from container
|
|
7
|
-
*/
|
|
3
|
+
//#region src/errors/classes/base.ts
|
|
8
4
|
var SandboxError = class extends Error {
|
|
9
5
|
constructor(errorResponse, options) {
|
|
10
6
|
super(errorResponse.message, options);
|
|
@@ -47,279 +43,249 @@ var SandboxError = class extends Error {
|
|
|
47
43
|
};
|
|
48
44
|
}
|
|
49
45
|
};
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/errors/classes/backup-terminal-lifecycle.ts
|
|
50
49
|
/**
|
|
51
|
-
* Error thrown when a
|
|
50
|
+
* Error thrown when a backup is not found in R2
|
|
52
51
|
*/
|
|
53
|
-
var
|
|
52
|
+
var BackupNotFoundError = class extends SandboxError {
|
|
54
53
|
constructor(errorResponse) {
|
|
55
54
|
super(errorResponse);
|
|
56
|
-
this.name = "
|
|
55
|
+
this.name = "BackupNotFoundError";
|
|
57
56
|
}
|
|
58
|
-
get
|
|
59
|
-
return this.context.
|
|
57
|
+
get backupId() {
|
|
58
|
+
return this.context.backupId;
|
|
60
59
|
}
|
|
61
60
|
};
|
|
62
61
|
/**
|
|
63
|
-
* Error thrown when a
|
|
62
|
+
* Error thrown when a backup has expired (past its TTL)
|
|
64
63
|
*/
|
|
65
|
-
var
|
|
64
|
+
var BackupExpiredError = class extends SandboxError {
|
|
66
65
|
constructor(errorResponse) {
|
|
67
66
|
super(errorResponse);
|
|
68
|
-
this.name = "
|
|
67
|
+
this.name = "BackupExpiredError";
|
|
69
68
|
}
|
|
70
|
-
get
|
|
71
|
-
return this.context.
|
|
69
|
+
get backupId() {
|
|
70
|
+
return this.context.backupId;
|
|
71
|
+
}
|
|
72
|
+
get expiredAt() {
|
|
73
|
+
return this.context.expiredAt;
|
|
72
74
|
}
|
|
73
75
|
};
|
|
74
76
|
/**
|
|
75
|
-
* Error thrown when
|
|
77
|
+
* Error thrown when backup configuration or inputs are invalid
|
|
76
78
|
*/
|
|
77
|
-
var
|
|
79
|
+
var InvalidBackupConfigError = class extends SandboxError {
|
|
78
80
|
constructor(errorResponse) {
|
|
79
81
|
super(errorResponse);
|
|
80
|
-
this.name = "
|
|
82
|
+
this.name = "InvalidBackupConfigError";
|
|
81
83
|
}
|
|
82
|
-
get
|
|
83
|
-
return this.context.
|
|
84
|
+
get reason() {
|
|
85
|
+
return this.context.reason;
|
|
84
86
|
}
|
|
85
87
|
};
|
|
86
88
|
/**
|
|
87
|
-
*
|
|
89
|
+
* Error thrown when backup creation fails
|
|
88
90
|
*/
|
|
89
|
-
var
|
|
91
|
+
var BackupCreateError = class extends SandboxError {
|
|
90
92
|
constructor(errorResponse) {
|
|
91
93
|
super(errorResponse);
|
|
92
|
-
this.name = "
|
|
93
|
-
}
|
|
94
|
-
get path() {
|
|
95
|
-
return this.context.path;
|
|
94
|
+
this.name = "BackupCreateError";
|
|
96
95
|
}
|
|
97
|
-
get
|
|
98
|
-
return this.context.
|
|
96
|
+
get dir() {
|
|
97
|
+
return this.context.dir;
|
|
99
98
|
}
|
|
100
|
-
get
|
|
101
|
-
return this.context.
|
|
99
|
+
get backupId() {
|
|
100
|
+
return this.context.backupId;
|
|
102
101
|
}
|
|
103
102
|
};
|
|
104
103
|
/**
|
|
105
|
-
* Error thrown when
|
|
104
|
+
* Error thrown when backup restoration fails
|
|
106
105
|
*/
|
|
107
|
-
var
|
|
106
|
+
var BackupRestoreError = class extends SandboxError {
|
|
108
107
|
constructor(errorResponse) {
|
|
109
108
|
super(errorResponse);
|
|
110
|
-
this.name = "
|
|
109
|
+
this.name = "BackupRestoreError";
|
|
111
110
|
}
|
|
112
|
-
get
|
|
113
|
-
return this.context.
|
|
111
|
+
get dir() {
|
|
112
|
+
return this.context.dir;
|
|
113
|
+
}
|
|
114
|
+
get backupId() {
|
|
115
|
+
return this.context.backupId;
|
|
114
116
|
}
|
|
115
117
|
};
|
|
116
|
-
|
|
117
|
-
* Error thrown when a command is not found
|
|
118
|
-
*/
|
|
119
|
-
var CommandNotFoundError = class extends SandboxError {
|
|
118
|
+
var TerminalNotFoundError = class extends SandboxError {
|
|
120
119
|
constructor(errorResponse) {
|
|
121
120
|
super(errorResponse);
|
|
122
|
-
this.name = "
|
|
121
|
+
this.name = "TerminalNotFoundError";
|
|
123
122
|
}
|
|
124
|
-
get
|
|
125
|
-
return this.context.
|
|
123
|
+
get terminalId() {
|
|
124
|
+
return this.context.terminalId;
|
|
126
125
|
}
|
|
127
126
|
};
|
|
128
|
-
|
|
129
|
-
* Generic command execution error
|
|
130
|
-
*/
|
|
131
|
-
var CommandError = class extends SandboxError {
|
|
127
|
+
var InvalidTerminalCwdError = class extends SandboxError {
|
|
132
128
|
constructor(errorResponse) {
|
|
133
129
|
super(errorResponse);
|
|
134
|
-
this.name = "
|
|
135
|
-
}
|
|
136
|
-
get command() {
|
|
137
|
-
return this.context.command;
|
|
138
|
-
}
|
|
139
|
-
get exitCode() {
|
|
140
|
-
return this.context.exitCode;
|
|
130
|
+
this.name = "InvalidTerminalCwdError";
|
|
141
131
|
}
|
|
142
|
-
get
|
|
143
|
-
return this.context.
|
|
132
|
+
get terminalId() {
|
|
133
|
+
return this.context.terminalId;
|
|
144
134
|
}
|
|
145
|
-
get
|
|
146
|
-
return this.context.
|
|
135
|
+
get cwd() {
|
|
136
|
+
return this.context.cwd;
|
|
147
137
|
}
|
|
148
138
|
};
|
|
149
|
-
|
|
150
|
-
* Error thrown when a process is not found
|
|
151
|
-
*/
|
|
152
|
-
var ProcessNotFoundError = class extends SandboxError {
|
|
139
|
+
var InvalidTerminalCursorError = class extends SandboxError {
|
|
153
140
|
constructor(errorResponse) {
|
|
154
141
|
super(errorResponse);
|
|
155
|
-
this.name = "
|
|
142
|
+
this.name = "InvalidTerminalCursorError";
|
|
156
143
|
}
|
|
157
|
-
get
|
|
158
|
-
return this.context.
|
|
144
|
+
get terminalId() {
|
|
145
|
+
return this.context.terminalId;
|
|
159
146
|
}
|
|
160
147
|
};
|
|
161
|
-
|
|
162
|
-
* Generic process error
|
|
163
|
-
*/
|
|
164
|
-
var ProcessError = class extends SandboxError {
|
|
148
|
+
var TerminalControlError = class extends SandboxError {
|
|
165
149
|
constructor(errorResponse) {
|
|
166
150
|
super(errorResponse);
|
|
167
|
-
this.name = "
|
|
168
|
-
}
|
|
169
|
-
get processId() {
|
|
170
|
-
return this.context.processId;
|
|
151
|
+
this.name = "TerminalControlError";
|
|
171
152
|
}
|
|
172
|
-
get
|
|
173
|
-
return this.context.
|
|
174
|
-
}
|
|
175
|
-
get exitCode() {
|
|
176
|
-
return this.context.exitCode;
|
|
153
|
+
get terminalId() {
|
|
154
|
+
return this.context.terminalId;
|
|
177
155
|
}
|
|
178
|
-
get
|
|
179
|
-
return this.context.
|
|
156
|
+
get operationName() {
|
|
157
|
+
return this.context.operation;
|
|
180
158
|
}
|
|
181
159
|
};
|
|
182
|
-
|
|
183
|
-
* Error thrown when a session already exists
|
|
184
|
-
*/
|
|
185
|
-
var SessionAlreadyExistsError = class extends SandboxError {
|
|
160
|
+
var StaleTerminalHandleError = class extends SandboxError {
|
|
186
161
|
constructor(errorResponse) {
|
|
187
162
|
super(errorResponse);
|
|
188
|
-
this.name = "
|
|
163
|
+
this.name = "StaleTerminalHandleError";
|
|
189
164
|
}
|
|
190
|
-
get
|
|
191
|
-
return this.context.
|
|
165
|
+
get terminalId() {
|
|
166
|
+
return this.context.terminalId;
|
|
192
167
|
}
|
|
193
|
-
get
|
|
194
|
-
return this.context.
|
|
168
|
+
get operation() {
|
|
169
|
+
return this.context.operation;
|
|
195
170
|
}
|
|
196
171
|
};
|
|
197
|
-
|
|
198
|
-
* Error thrown when a session was destroyed while a command was executing
|
|
199
|
-
*/
|
|
200
|
-
var SessionDestroyedError = class extends SandboxError {
|
|
172
|
+
var ContainerUnavailableError = class extends SandboxError {
|
|
201
173
|
constructor(errorResponse) {
|
|
202
174
|
super(errorResponse);
|
|
203
|
-
this.name = "
|
|
204
|
-
}
|
|
205
|
-
get sessionId() {
|
|
206
|
-
return this.context.sessionId;
|
|
175
|
+
this.name = "ContainerUnavailableError";
|
|
207
176
|
}
|
|
208
177
|
};
|
|
209
|
-
|
|
210
|
-
* Error thrown when a session's underlying shell exited without an explicit
|
|
211
|
-
* `destroy()` call (user ran `exit`, the shell crashed, or a child process
|
|
212
|
-
* took the shell down). The session-local state is gone, but the next call
|
|
213
|
-
* with the same sessionId will transparently start a fresh session.
|
|
214
|
-
*/
|
|
215
|
-
var SessionTerminatedError = class extends SandboxError {
|
|
178
|
+
var OperationInterruptedError = class extends SandboxError {
|
|
216
179
|
constructor(errorResponse) {
|
|
217
180
|
super(errorResponse);
|
|
218
|
-
this.name = "
|
|
219
|
-
}
|
|
220
|
-
get sessionId() {
|
|
221
|
-
return this.context.sessionId;
|
|
222
|
-
}
|
|
223
|
-
get exitCode() {
|
|
224
|
-
return this.context.exitCode;
|
|
181
|
+
this.name = "OperationInterruptedError";
|
|
225
182
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
* Compatibility error for legacy port exposure registry responses.
|
|
229
|
-
*/
|
|
230
|
-
var PortAlreadyExposedError = class extends SandboxError {
|
|
231
|
-
constructor(errorResponse) {
|
|
232
|
-
super(errorResponse);
|
|
233
|
-
this.name = "PortAlreadyExposedError";
|
|
183
|
+
get reason() {
|
|
184
|
+
return this.context.reason;
|
|
234
185
|
}
|
|
235
|
-
get
|
|
236
|
-
return this.context.
|
|
186
|
+
get retryable() {
|
|
187
|
+
return this.context.retryable;
|
|
237
188
|
}
|
|
238
|
-
get
|
|
239
|
-
return this.context.
|
|
189
|
+
get operationName() {
|
|
190
|
+
return this.context.operation;
|
|
240
191
|
}
|
|
241
192
|
};
|
|
242
193
|
/**
|
|
243
|
-
*
|
|
194
|
+
* Raised when the capnweb WebSocket session itself fails on the SDK side.
|
|
195
|
+
* Unlike the rest of the SandboxError tree, the container never produces
|
|
196
|
+
* this error — it is synthesised by `translateRPCError` from the plain
|
|
197
|
+
* Errors capnweb / DeferredTransport raise when the connection dies.
|
|
198
|
+
*
|
|
199
|
+
* `kind` distinguishes the failure mode (peer close, upgrade failed, etc.)
|
|
200
|
+
* so callers can branch on a structured code instead of substring-matching
|
|
201
|
+
* on the message.
|
|
202
|
+
*
|
|
203
|
+
* Always retryable: the SDK opens a fresh connection on the next call.
|
|
244
204
|
*/
|
|
245
|
-
var
|
|
246
|
-
constructor(errorResponse) {
|
|
247
|
-
super(errorResponse);
|
|
248
|
-
this.name = "
|
|
205
|
+
var RPCTransportError = class extends SandboxError {
|
|
206
|
+
constructor(errorResponse, options) {
|
|
207
|
+
super(errorResponse, options);
|
|
208
|
+
this.name = "RPCTransportError";
|
|
249
209
|
}
|
|
250
|
-
get
|
|
251
|
-
return this.context.
|
|
210
|
+
get kind() {
|
|
211
|
+
return this.errorResponse.context.kind;
|
|
212
|
+
}
|
|
213
|
+
get originalMessage() {
|
|
214
|
+
return this.errorResponse.context.originalMessage;
|
|
252
215
|
}
|
|
253
216
|
};
|
|
217
|
+
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region src/errors/classes/filesystem.ts
|
|
254
220
|
/**
|
|
255
|
-
* Error thrown when a
|
|
221
|
+
* Error thrown when a file or directory is not found
|
|
256
222
|
*/
|
|
257
|
-
var
|
|
223
|
+
var FileNotFoundError = class extends SandboxError {
|
|
258
224
|
constructor(errorResponse) {
|
|
259
225
|
super(errorResponse);
|
|
260
|
-
this.name = "
|
|
261
|
-
}
|
|
262
|
-
get port() {
|
|
263
|
-
return this.context.port;
|
|
226
|
+
this.name = "FileNotFoundError";
|
|
264
227
|
}
|
|
265
|
-
get
|
|
266
|
-
return this.context.
|
|
228
|
+
get path() {
|
|
229
|
+
return this.context.path;
|
|
267
230
|
}
|
|
268
231
|
};
|
|
269
232
|
/**
|
|
270
|
-
* Error thrown when a
|
|
233
|
+
* Error thrown when a file already exists
|
|
271
234
|
*/
|
|
272
|
-
var
|
|
235
|
+
var FileExistsError = class extends SandboxError {
|
|
273
236
|
constructor(errorResponse) {
|
|
274
237
|
super(errorResponse);
|
|
275
|
-
this.name = "
|
|
276
|
-
}
|
|
277
|
-
get port() {
|
|
278
|
-
return this.context.port;
|
|
238
|
+
this.name = "FileExistsError";
|
|
279
239
|
}
|
|
280
|
-
get
|
|
281
|
-
return this.context.
|
|
240
|
+
get path() {
|
|
241
|
+
return this.context.path;
|
|
282
242
|
}
|
|
283
243
|
};
|
|
284
244
|
/**
|
|
285
|
-
* Error thrown when a
|
|
245
|
+
* Error thrown when a file is too large
|
|
286
246
|
*/
|
|
287
|
-
var
|
|
247
|
+
var FileTooLargeError = class extends SandboxError {
|
|
288
248
|
constructor(errorResponse) {
|
|
289
249
|
super(errorResponse);
|
|
290
|
-
this.name = "
|
|
250
|
+
this.name = "FileTooLargeError";
|
|
291
251
|
}
|
|
292
|
-
get
|
|
293
|
-
return this.context.
|
|
252
|
+
get path() {
|
|
253
|
+
return this.context.path;
|
|
294
254
|
}
|
|
295
255
|
};
|
|
296
256
|
/**
|
|
297
|
-
* Generic
|
|
257
|
+
* Generic file system error (permissions, disk full, etc.)
|
|
298
258
|
*/
|
|
299
|
-
var
|
|
259
|
+
var FileSystemError = class extends SandboxError {
|
|
300
260
|
constructor(errorResponse) {
|
|
301
261
|
super(errorResponse);
|
|
302
|
-
this.name = "
|
|
303
|
-
}
|
|
304
|
-
get port() {
|
|
305
|
-
return this.context.port;
|
|
262
|
+
this.name = "FileSystemError";
|
|
306
263
|
}
|
|
307
|
-
get
|
|
308
|
-
return this.context.
|
|
264
|
+
get path() {
|
|
265
|
+
return this.context.path;
|
|
309
266
|
}
|
|
310
267
|
get stderr() {
|
|
311
268
|
return this.context.stderr;
|
|
312
269
|
}
|
|
270
|
+
get exitCode() {
|
|
271
|
+
return this.context.exitCode;
|
|
272
|
+
}
|
|
313
273
|
};
|
|
314
274
|
/**
|
|
315
|
-
* Error thrown when
|
|
275
|
+
* Error thrown when permission is denied
|
|
316
276
|
*/
|
|
317
|
-
var
|
|
277
|
+
var PermissionDeniedError = class extends SandboxError {
|
|
318
278
|
constructor(errorResponse) {
|
|
319
279
|
super(errorResponse);
|
|
320
|
-
this.name = "
|
|
280
|
+
this.name = "PermissionDeniedError";
|
|
281
|
+
}
|
|
282
|
+
get path() {
|
|
283
|
+
return this.context.path;
|
|
321
284
|
}
|
|
322
285
|
};
|
|
286
|
+
|
|
287
|
+
//#endregion
|
|
288
|
+
//#region src/errors/classes/git-code.ts
|
|
323
289
|
/**
|
|
324
290
|
* Error thrown when a git repository is not found
|
|
325
291
|
*/
|
|
@@ -512,165 +478,334 @@ var ValidationFailedError = class extends SandboxError {
|
|
|
512
478
|
return this.context.validationErrors;
|
|
513
479
|
}
|
|
514
480
|
};
|
|
481
|
+
|
|
482
|
+
//#endregion
|
|
483
|
+
//#region src/errors/classes/port.ts
|
|
515
484
|
/**
|
|
516
|
-
* Error thrown when a
|
|
485
|
+
* Error thrown when exposing a port that is already exposed.
|
|
517
486
|
*/
|
|
518
|
-
var
|
|
487
|
+
var PortAlreadyExposedError = class extends SandboxError {
|
|
519
488
|
constructor(errorResponse) {
|
|
520
489
|
super(errorResponse);
|
|
521
|
-
this.name = "
|
|
522
|
-
}
|
|
523
|
-
get processId() {
|
|
524
|
-
return this.context.processId;
|
|
490
|
+
this.name = "PortAlreadyExposedError";
|
|
525
491
|
}
|
|
526
|
-
get
|
|
527
|
-
return this.context.
|
|
492
|
+
get port() {
|
|
493
|
+
return this.context.port;
|
|
528
494
|
}
|
|
529
|
-
get
|
|
530
|
-
return this.context.
|
|
495
|
+
get portName() {
|
|
496
|
+
return this.context.portName;
|
|
531
497
|
}
|
|
532
|
-
|
|
533
|
-
|
|
498
|
+
};
|
|
499
|
+
/**
|
|
500
|
+
* Error thrown when operating on a port that has not been exposed.
|
|
501
|
+
*/
|
|
502
|
+
var PortNotExposedError = class extends SandboxError {
|
|
503
|
+
constructor(errorResponse) {
|
|
504
|
+
super(errorResponse);
|
|
505
|
+
this.name = "PortNotExposedError";
|
|
506
|
+
}
|
|
507
|
+
get port() {
|
|
508
|
+
return this.context.port;
|
|
534
509
|
}
|
|
535
510
|
};
|
|
536
511
|
/**
|
|
537
|
-
* Error thrown when a
|
|
512
|
+
* Error thrown when a port number is invalid
|
|
538
513
|
*/
|
|
539
|
-
var
|
|
514
|
+
var InvalidPortError = class extends SandboxError {
|
|
540
515
|
constructor(errorResponse) {
|
|
541
516
|
super(errorResponse);
|
|
542
|
-
this.name = "
|
|
517
|
+
this.name = "InvalidPortError";
|
|
543
518
|
}
|
|
544
|
-
get
|
|
545
|
-
return this.context.
|
|
519
|
+
get port() {
|
|
520
|
+
return this.context.port;
|
|
546
521
|
}
|
|
547
|
-
get
|
|
548
|
-
return this.context.
|
|
522
|
+
get reason() {
|
|
523
|
+
return this.context.reason;
|
|
549
524
|
}
|
|
550
|
-
|
|
551
|
-
|
|
525
|
+
};
|
|
526
|
+
/**
|
|
527
|
+
* Error thrown when a service on a port is not responding
|
|
528
|
+
*/
|
|
529
|
+
var ServiceNotRespondingError = class extends SandboxError {
|
|
530
|
+
constructor(errorResponse) {
|
|
531
|
+
super(errorResponse);
|
|
532
|
+
this.name = "ServiceNotRespondingError";
|
|
552
533
|
}
|
|
553
|
-
get
|
|
554
|
-
return this.context.
|
|
534
|
+
get port() {
|
|
535
|
+
return this.context.port;
|
|
536
|
+
}
|
|
537
|
+
get portName() {
|
|
538
|
+
return this.context.portName;
|
|
555
539
|
}
|
|
556
540
|
};
|
|
557
541
|
/**
|
|
558
|
-
* Error thrown when a
|
|
542
|
+
* Error thrown when a port is already in use
|
|
559
543
|
*/
|
|
560
|
-
var
|
|
544
|
+
var PortInUseError = class extends SandboxError {
|
|
561
545
|
constructor(errorResponse) {
|
|
562
546
|
super(errorResponse);
|
|
563
|
-
this.name = "
|
|
547
|
+
this.name = "PortInUseError";
|
|
564
548
|
}
|
|
565
|
-
get
|
|
566
|
-
return this.context.
|
|
549
|
+
get port() {
|
|
550
|
+
return this.context.port;
|
|
567
551
|
}
|
|
568
552
|
};
|
|
569
553
|
/**
|
|
570
|
-
*
|
|
554
|
+
* Generic port operation error
|
|
571
555
|
*/
|
|
572
|
-
var
|
|
556
|
+
var PortError = class extends SandboxError {
|
|
573
557
|
constructor(errorResponse) {
|
|
574
558
|
super(errorResponse);
|
|
575
|
-
this.name = "
|
|
559
|
+
this.name = "PortError";
|
|
576
560
|
}
|
|
577
|
-
get
|
|
578
|
-
return this.context.
|
|
561
|
+
get port() {
|
|
562
|
+
return this.context.port;
|
|
579
563
|
}
|
|
580
|
-
get
|
|
581
|
-
return this.context.
|
|
564
|
+
get portName() {
|
|
565
|
+
return this.context.portName;
|
|
566
|
+
}
|
|
567
|
+
get stderr() {
|
|
568
|
+
return this.context.stderr;
|
|
582
569
|
}
|
|
583
570
|
};
|
|
584
571
|
/**
|
|
585
|
-
* Error thrown when
|
|
572
|
+
* Error thrown when port exposure requires a custom domain
|
|
586
573
|
*/
|
|
587
|
-
var
|
|
574
|
+
var CustomDomainRequiredError = class extends SandboxError {
|
|
588
575
|
constructor(errorResponse) {
|
|
589
576
|
super(errorResponse);
|
|
590
|
-
this.name = "
|
|
577
|
+
this.name = "CustomDomainRequiredError";
|
|
591
578
|
}
|
|
592
|
-
|
|
593
|
-
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
//#endregion
|
|
582
|
+
//#region src/errors/classes/process.ts
|
|
583
|
+
/**
|
|
584
|
+
* Error thrown when a command is not found
|
|
585
|
+
*/
|
|
586
|
+
var CommandNotFoundError = class extends SandboxError {
|
|
587
|
+
constructor(errorResponse) {
|
|
588
|
+
super(errorResponse);
|
|
589
|
+
this.name = "CommandNotFoundError";
|
|
590
|
+
}
|
|
591
|
+
get command() {
|
|
592
|
+
return this.context.command;
|
|
594
593
|
}
|
|
595
594
|
};
|
|
596
595
|
/**
|
|
597
|
-
*
|
|
596
|
+
* Generic command execution error
|
|
598
597
|
*/
|
|
599
|
-
var
|
|
598
|
+
var CommandError = class extends SandboxError {
|
|
600
599
|
constructor(errorResponse) {
|
|
601
600
|
super(errorResponse);
|
|
602
|
-
this.name = "
|
|
601
|
+
this.name = "CommandError";
|
|
603
602
|
}
|
|
604
|
-
get
|
|
605
|
-
return this.context.
|
|
603
|
+
get command() {
|
|
604
|
+
return this.context.command;
|
|
606
605
|
}
|
|
607
|
-
get
|
|
608
|
-
return this.context.
|
|
606
|
+
get exitCode() {
|
|
607
|
+
return this.context.exitCode;
|
|
608
|
+
}
|
|
609
|
+
get stdout() {
|
|
610
|
+
return this.context.stdout;
|
|
611
|
+
}
|
|
612
|
+
get stderr() {
|
|
613
|
+
return this.context.stderr;
|
|
614
|
+
}
|
|
615
|
+
};
|
|
616
|
+
var InvalidProcessCwdError = class extends SandboxError {
|
|
617
|
+
constructor(errorResponse) {
|
|
618
|
+
super(errorResponse);
|
|
619
|
+
this.name = "InvalidProcessCwdError";
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
var InvalidProcessEnvironmentError = class extends SandboxError {
|
|
623
|
+
constructor(errorResponse) {
|
|
624
|
+
super(errorResponse);
|
|
625
|
+
this.name = "InvalidProcessEnvironmentError";
|
|
626
|
+
}
|
|
627
|
+
};
|
|
628
|
+
var InvalidProcessCursorError = class extends SandboxError {
|
|
629
|
+
constructor(errorResponse) {
|
|
630
|
+
super(errorResponse);
|
|
631
|
+
this.name = "InvalidProcessCursorError";
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
var ProcessSpawnFailedError = class extends SandboxError {
|
|
635
|
+
constructor(errorResponse) {
|
|
636
|
+
super(errorResponse);
|
|
637
|
+
this.name = "ProcessSpawnFailedError";
|
|
609
638
|
}
|
|
610
639
|
};
|
|
611
640
|
/**
|
|
612
|
-
* Error thrown when
|
|
641
|
+
* Error thrown when a process is not found
|
|
613
642
|
*/
|
|
614
|
-
var
|
|
643
|
+
var ProcessNotFoundError = class extends SandboxError {
|
|
615
644
|
constructor(errorResponse) {
|
|
616
645
|
super(errorResponse);
|
|
617
|
-
this.name = "
|
|
646
|
+
this.name = "ProcessNotFoundError";
|
|
618
647
|
}
|
|
619
|
-
get
|
|
620
|
-
return this.context.
|
|
648
|
+
get processId() {
|
|
649
|
+
return this.context.processId;
|
|
621
650
|
}
|
|
622
|
-
|
|
623
|
-
|
|
651
|
+
};
|
|
652
|
+
/**
|
|
653
|
+
* Generic process error
|
|
654
|
+
*/
|
|
655
|
+
var ProcessError = class extends SandboxError {
|
|
656
|
+
constructor(errorResponse) {
|
|
657
|
+
super(errorResponse);
|
|
658
|
+
this.name = "ProcessError";
|
|
659
|
+
}
|
|
660
|
+
get processId() {
|
|
661
|
+
return this.context.processId;
|
|
662
|
+
}
|
|
663
|
+
get pid() {
|
|
664
|
+
return this.context.pid;
|
|
665
|
+
}
|
|
666
|
+
get exitCode() {
|
|
667
|
+
return this.context.exitCode;
|
|
668
|
+
}
|
|
669
|
+
get stderr() {
|
|
670
|
+
return this.context.stderr;
|
|
624
671
|
}
|
|
625
672
|
};
|
|
626
|
-
var
|
|
673
|
+
var StaleProcessHandleError = class extends SandboxError {
|
|
627
674
|
constructor(errorResponse) {
|
|
628
675
|
super(errorResponse);
|
|
629
|
-
this.name = "
|
|
676
|
+
this.name = "StaleProcessHandleError";
|
|
677
|
+
}
|
|
678
|
+
get processId() {
|
|
679
|
+
return this.context.processId;
|
|
680
|
+
}
|
|
681
|
+
get pid() {
|
|
682
|
+
return this.context.pid;
|
|
683
|
+
}
|
|
684
|
+
get operation() {
|
|
685
|
+
return this.context.operation;
|
|
630
686
|
}
|
|
631
687
|
};
|
|
632
|
-
var
|
|
688
|
+
var ProcessWaitTimeoutError = class extends SandboxError {
|
|
633
689
|
constructor(errorResponse) {
|
|
634
690
|
super(errorResponse);
|
|
635
|
-
this.name = "
|
|
691
|
+
this.name = "ProcessWaitTimeoutError";
|
|
636
692
|
}
|
|
637
|
-
get
|
|
638
|
-
return this.context.
|
|
693
|
+
get processId() {
|
|
694
|
+
return this.context.processId;
|
|
639
695
|
}
|
|
640
|
-
get
|
|
641
|
-
return this.context.
|
|
696
|
+
get operation() {
|
|
697
|
+
return this.context.operation;
|
|
642
698
|
}
|
|
643
|
-
get
|
|
699
|
+
get timeout() {
|
|
700
|
+
return this.context.timeout;
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
var ProcessAbortedError = class extends SandboxError {
|
|
704
|
+
constructor(errorResponse) {
|
|
705
|
+
super(errorResponse);
|
|
706
|
+
this.name = "ProcessAbortedError";
|
|
707
|
+
}
|
|
708
|
+
get processId() {
|
|
709
|
+
return this.context.processId;
|
|
710
|
+
}
|
|
711
|
+
get operation() {
|
|
644
712
|
return this.context.operation;
|
|
645
713
|
}
|
|
646
714
|
};
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
* Errors capnweb / DeferredTransport raise when the connection dies.
|
|
652
|
-
*
|
|
653
|
-
* `kind` distinguishes the failure mode (peer close, upgrade failed, etc.)
|
|
654
|
-
* so callers can branch on a structured code instead of substring-matching
|
|
655
|
-
* on the message.
|
|
656
|
-
*
|
|
657
|
-
* Always retryable: the SDK opens a fresh connection on the next call.
|
|
658
|
-
*/
|
|
659
|
-
var RPCTransportError = class extends SandboxError {
|
|
660
|
-
constructor(errorResponse, options) {
|
|
661
|
-
super(errorResponse, options);
|
|
662
|
-
this.name = "RPCTransportError";
|
|
715
|
+
var ProcessReadyTimeoutError = class extends SandboxError {
|
|
716
|
+
constructor(errorResponse) {
|
|
717
|
+
super(errorResponse);
|
|
718
|
+
this.name = "ProcessReadyTimeoutError";
|
|
663
719
|
}
|
|
664
|
-
get
|
|
665
|
-
return this.
|
|
720
|
+
get processId() {
|
|
721
|
+
return this.context.processId;
|
|
666
722
|
}
|
|
667
|
-
get
|
|
668
|
-
return this.
|
|
723
|
+
get command() {
|
|
724
|
+
return this.context.command;
|
|
725
|
+
}
|
|
726
|
+
get condition() {
|
|
727
|
+
return this.context.condition;
|
|
728
|
+
}
|
|
729
|
+
get timeout() {
|
|
730
|
+
return this.context.timeout;
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
var ProcessExitedBeforeLogError = class extends SandboxError {
|
|
734
|
+
constructor(errorResponse) {
|
|
735
|
+
super(errorResponse);
|
|
736
|
+
this.name = "ProcessExitedBeforeLogError";
|
|
737
|
+
}
|
|
738
|
+
get processId() {
|
|
739
|
+
return this.context.processId;
|
|
740
|
+
}
|
|
741
|
+
get pid() {
|
|
742
|
+
return this.context.pid;
|
|
743
|
+
}
|
|
744
|
+
get exit() {
|
|
745
|
+
return this.context.exit;
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
var ProcessExitedBeforeReadyError = class extends SandboxError {
|
|
749
|
+
constructor(errorResponse) {
|
|
750
|
+
super(errorResponse);
|
|
751
|
+
this.name = "ProcessExitedBeforeReadyError";
|
|
752
|
+
}
|
|
753
|
+
get processId() {
|
|
754
|
+
return this.context.processId;
|
|
755
|
+
}
|
|
756
|
+
get command() {
|
|
757
|
+
return this.context.command;
|
|
758
|
+
}
|
|
759
|
+
get condition() {
|
|
760
|
+
return this.context.condition;
|
|
761
|
+
}
|
|
762
|
+
get exitCode() {
|
|
763
|
+
return this.context.exitCode;
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
|
|
767
|
+
//#endregion
|
|
768
|
+
//#region src/errors/classes/runtime-control-protocol.ts
|
|
769
|
+
var RuntimeControlProtocolError = class extends SandboxError {
|
|
770
|
+
constructor(message, context, options) {
|
|
771
|
+
super({
|
|
772
|
+
code: ErrorCode.INTERNAL_ERROR,
|
|
773
|
+
message,
|
|
774
|
+
context,
|
|
775
|
+
httpStatus: getHttpStatus(ErrorCode.INTERNAL_ERROR),
|
|
776
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
777
|
+
}, options);
|
|
778
|
+
this.name = "RuntimeControlProtocolError";
|
|
779
|
+
}
|
|
780
|
+
};
|
|
781
|
+
|
|
782
|
+
//#endregion
|
|
783
|
+
//#region src/errors/classes/runtime-inactive.ts
|
|
784
|
+
var RuntimeIdentityInactiveError = class extends Error {
|
|
785
|
+
constructor() {
|
|
786
|
+
super("Runtime identity is no longer active");
|
|
787
|
+
this.name = "RuntimeIdentityInactiveError";
|
|
669
788
|
}
|
|
670
789
|
};
|
|
671
790
|
|
|
672
791
|
//#endregion
|
|
673
792
|
//#region src/errors/adapter.ts
|
|
793
|
+
function isStaleProcessHandleResponse(errorResponse) {
|
|
794
|
+
const { context } = errorResponse;
|
|
795
|
+
return errorResponse.code === ErrorCode.STALE_PROCESS_HANDLE && "processId" in context && typeof context.processId === "string" && "pid" in context && typeof context.pid === "number" && "operation" in context && typeof context.operation === "string";
|
|
796
|
+
}
|
|
797
|
+
function isStaleTerminalHandleResponse(errorResponse) {
|
|
798
|
+
const { context } = errorResponse;
|
|
799
|
+
return errorResponse.code === ErrorCode.STALE_TERMINAL_HANDLE && "terminalId" in context && typeof context.terminalId === "string" && "operation" in context && typeof context.operation === "string";
|
|
800
|
+
}
|
|
801
|
+
function isProcessWaitTimeoutResponse(errorResponse) {
|
|
802
|
+
const { context } = errorResponse;
|
|
803
|
+
return errorResponse.code === ErrorCode.PROCESS_WAIT_TIMEOUT && "processId" in context && typeof context.processId === "string" && "operation" in context && (context.operation === "output" || context.operation === "waitForExit" || context.operation === "waitForLog") && "timeout" in context && typeof context.timeout === "number";
|
|
804
|
+
}
|
|
805
|
+
function isProcessAbortedResponse(errorResponse) {
|
|
806
|
+
const { context } = errorResponse;
|
|
807
|
+
return errorResponse.code === ErrorCode.PROCESS_ABORTED && "processId" in context && typeof context.processId === "string" && "operation" in context && typeof context.operation === "string";
|
|
808
|
+
}
|
|
674
809
|
/**
|
|
675
810
|
* Convert ErrorResponse to appropriate Error class
|
|
676
811
|
* Simple switch statement - we trust the container sends correct context
|
|
@@ -695,12 +830,29 @@ function createErrorFromResponse(errorResponse, options) {
|
|
|
695
830
|
case ErrorCode.COMMAND_EXECUTION_ERROR:
|
|
696
831
|
case ErrorCode.INVALID_COMMAND:
|
|
697
832
|
case ErrorCode.STREAM_START_ERROR: return new CommandError(errorResponse);
|
|
833
|
+
case ErrorCode.INVALID_PROCESS_CWD: return new InvalidProcessCwdError(errorResponse);
|
|
834
|
+
case ErrorCode.INVALID_PROCESS_ENVIRONMENT: return new InvalidProcessEnvironmentError(errorResponse);
|
|
835
|
+
case ErrorCode.INVALID_PROCESS_CURSOR: return new InvalidProcessCursorError(errorResponse);
|
|
836
|
+
case ErrorCode.PROCESS_SPAWN_FAILED: return new ProcessSpawnFailedError(errorResponse);
|
|
698
837
|
case ErrorCode.PROCESS_NOT_FOUND: return new ProcessNotFoundError(errorResponse);
|
|
838
|
+
case ErrorCode.STALE_PROCESS_HANDLE:
|
|
839
|
+
if (isStaleProcessHandleResponse(errorResponse)) return new StaleProcessHandleError(errorResponse);
|
|
840
|
+
return new SandboxError(errorResponse);
|
|
841
|
+
case ErrorCode.STALE_TERMINAL_HANDLE:
|
|
842
|
+
if (isStaleTerminalHandleResponse(errorResponse)) return new StaleTerminalHandleError(errorResponse);
|
|
843
|
+
return new SandboxError(errorResponse);
|
|
844
|
+
case ErrorCode.PROCESS_WAIT_TIMEOUT:
|
|
845
|
+
if (isProcessWaitTimeoutResponse(errorResponse)) return new ProcessWaitTimeoutError(errorResponse);
|
|
846
|
+
return new SandboxError(errorResponse);
|
|
847
|
+
case ErrorCode.PROCESS_ABORTED:
|
|
848
|
+
if (isProcessAbortedResponse(errorResponse)) return new ProcessAbortedError(errorResponse);
|
|
849
|
+
return new SandboxError(errorResponse);
|
|
850
|
+
case ErrorCode.TERMINAL_NOT_FOUND: return new TerminalNotFoundError(errorResponse);
|
|
851
|
+
case ErrorCode.INVALID_TERMINAL_CWD: return new InvalidTerminalCwdError(errorResponse);
|
|
852
|
+
case ErrorCode.INVALID_TERMINAL_CURSOR: return new InvalidTerminalCursorError(errorResponse);
|
|
853
|
+
case ErrorCode.TERMINAL_CONTROL_ERROR: return new TerminalControlError(errorResponse);
|
|
699
854
|
case ErrorCode.PROCESS_PERMISSION_DENIED:
|
|
700
855
|
case ErrorCode.PROCESS_ERROR: return new ProcessError(errorResponse);
|
|
701
|
-
case ErrorCode.SESSION_ALREADY_EXISTS: return new SessionAlreadyExistsError(errorResponse);
|
|
702
|
-
case ErrorCode.SESSION_DESTROYED: return new SessionDestroyedError(errorResponse);
|
|
703
|
-
case ErrorCode.SESSION_TERMINATED: return new SessionTerminatedError(errorResponse);
|
|
704
856
|
case ErrorCode.PORT_ALREADY_EXPOSED: return new PortAlreadyExposedError(errorResponse);
|
|
705
857
|
case ErrorCode.PORT_NOT_EXPOSED: return new PortNotExposedError(errorResponse);
|
|
706
858
|
case ErrorCode.INVALID_PORT_NUMBER:
|
|
@@ -737,5 +889,5 @@ function createErrorFromResponse(errorResponse, options) {
|
|
|
737
889
|
}
|
|
738
890
|
|
|
739
891
|
//#endregion
|
|
740
|
-
export {
|
|
741
|
-
//# sourceMappingURL=errors-
|
|
892
|
+
export { TerminalControlError as $, GitCloneError as A, FileTooLargeError as B, PortNotExposedError as C, GitAuthenticationError as D, ContextNotFoundError as E, InvalidGitUrlError as F, BackupRestoreError as G, BackupCreateError as H, ValidationFailedError as I, InvalidTerminalCursorError as J, ContainerUnavailableError as K, FileExistsError as L, GitNetworkError as M, GitRepositoryNotFoundError as N, GitBranchNotFoundError as O, InterpreterNotReadyError as P, StaleTerminalHandleError as Q, FileNotFoundError as R, PortInUseError as S, CodeExecutionError as T, BackupExpiredError as U, PermissionDeniedError as V, BackupNotFoundError as W, OperationInterruptedError as X, InvalidTerminalCwdError as Y, RPCTransportError as Z, StaleProcessHandleError as _, CommandNotFoundError as a, PortAlreadyExposedError as b, InvalidProcessEnvironmentError as c, ProcessExitedBeforeLogError as d, TerminalNotFoundError as et, ProcessExitedBeforeReadyError as f, ProcessWaitTimeoutError as g, ProcessSpawnFailedError as h, CommandError as i, GitError as j, GitCheckoutError as k, ProcessAbortedError as l, ProcessReadyTimeoutError as m, RuntimeIdentityInactiveError as n, InvalidProcessCursorError as o, ProcessNotFoundError as p, InvalidBackupConfigError as q, RuntimeControlProtocolError as r, InvalidProcessCwdError as s, createErrorFromResponse as t, SandboxError as tt, ProcessError as u, CustomDomainRequiredError as v, ServiceNotRespondingError as w, PortError as x, InvalidPortError as y, FileSystemError as z };
|
|
893
|
+
//# sourceMappingURL=errors-QYlSkVGz.js.map
|