@cloudflare/sandbox 0.13.0-next.649.1 → 0.13.0-next.681.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.
Files changed (65) hide show
  1. package/Dockerfile +6 -11
  2. package/README.md +2 -2
  3. package/dist/bridge/index.d.ts.map +1 -1
  4. package/dist/bridge/index.js +68 -49
  5. package/dist/bridge/index.js.map +1 -1
  6. package/dist/codes-y-U76vnQ.d.ts +79 -0
  7. package/dist/codes-y-U76vnQ.d.ts.map +1 -0
  8. package/dist/contexts-DY1LHU1v.d.ts +327 -0
  9. package/dist/contexts-DY1LHU1v.d.ts.map +1 -0
  10. package/dist/{dist-mAH_7Ui7.js → dist-BStBkGIC.js} +50 -93
  11. package/dist/dist-BStBkGIC.js.map +1 -0
  12. package/dist/errors/index.d.ts +4 -0
  13. package/dist/errors/index.js +4 -0
  14. package/dist/errors-ewgSNicb.js +741 -0
  15. package/dist/errors-ewgSNicb.js.map +1 -0
  16. package/dist/{errors-CpoDEfUZ.js → errors-k3B8orjH.js} +41 -4
  17. package/dist/errors-k3B8orjH.js.map +1 -0
  18. package/dist/extensions/index.d.ts +2 -0
  19. package/dist/extensions/index.js +4 -0
  20. package/dist/extensions-CepYdzro.js +191 -0
  21. package/dist/extensions-CepYdzro.js.map +1 -0
  22. package/dist/git/index.d.ts +74 -0
  23. package/dist/git/index.d.ts.map +1 -0
  24. package/dist/git/index.js +345 -0
  25. package/dist/git/index.js.map +1 -0
  26. package/dist/index-B7QgIs0N.d.ts +1841 -0
  27. package/dist/index-B7QgIs0N.d.ts.map +1 -0
  28. package/dist/index-Dy6u9r60.d.ts +390 -0
  29. package/dist/index-Dy6u9r60.d.ts.map +1 -0
  30. package/dist/index.d.ts +27 -189
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +12 -43
  33. package/dist/index.js.map +1 -1
  34. package/dist/interpreter/index.d.ts +309 -0
  35. package/dist/interpreter/index.d.ts.map +1 -0
  36. package/dist/interpreter/index.js +264 -0
  37. package/dist/interpreter/index.js.map +1 -0
  38. package/dist/openai/index.d.ts +3 -2
  39. package/dist/openai/index.d.ts.map +1 -1
  40. package/dist/openai/index.js +2 -2
  41. package/dist/openai/index.js.map +1 -1
  42. package/dist/opencode/index.d.ts +137 -160
  43. package/dist/opencode/index.d.ts.map +1 -1
  44. package/dist/opencode/index.js +269 -159
  45. package/dist/opencode/index.js.map +1 -1
  46. package/dist/sandbox-DHNO89IF.d.ts +828 -0
  47. package/dist/sandbox-DHNO89IF.d.ts.map +1 -0
  48. package/dist/{sandbox-B-FLGbkP.js → sandbox-boKWPIcd.js} +8214 -7267
  49. package/dist/sandbox-boKWPIcd.js.map +1 -0
  50. package/dist/sidecar/index.d.ts +77 -0
  51. package/dist/sidecar/index.d.ts.map +1 -0
  52. package/dist/sidecar/index.js +201 -0
  53. package/dist/sidecar/index.js.map +1 -0
  54. package/dist/xterm/index.d.ts +6 -6
  55. package/dist/xterm/index.d.ts.map +1 -1
  56. package/dist/xterm/index.js +6 -6
  57. package/dist/xterm/index.js.map +1 -1
  58. package/package.json +36 -3
  59. package/dist/contexts-DPFhc2nR.d.ts +0 -238
  60. package/dist/contexts-DPFhc2nR.d.ts.map +0 -1
  61. package/dist/dist-mAH_7Ui7.js.map +0 -1
  62. package/dist/errors-CpoDEfUZ.js.map +0 -1
  63. package/dist/sandbox-44kEJjAc.d.ts +0 -2652
  64. package/dist/sandbox-44kEJjAc.d.ts.map +0 -1
  65. package/dist/sandbox-B-FLGbkP.js.map +0 -1
@@ -0,0 +1,79 @@
1
+ //#region ../shared/dist/errors/codes.d.ts
2
+ /**
3
+ * Centralized error code registry
4
+ * Each code maps to a specific error type with consistent semantics
5
+ */
6
+ declare const ErrorCode: {
7
+ readonly FILE_NOT_FOUND: "FILE_NOT_FOUND";
8
+ readonly PERMISSION_DENIED: "PERMISSION_DENIED";
9
+ readonly FILE_EXISTS: "FILE_EXISTS";
10
+ readonly IS_DIRECTORY: "IS_DIRECTORY";
11
+ readonly NOT_DIRECTORY: "NOT_DIRECTORY";
12
+ readonly FILE_TOO_LARGE: "FILE_TOO_LARGE";
13
+ readonly NO_SPACE: "NO_SPACE";
14
+ readonly TOO_MANY_FILES: "TOO_MANY_FILES";
15
+ readonly RESOURCE_BUSY: "RESOURCE_BUSY";
16
+ readonly READ_ONLY: "READ_ONLY";
17
+ readonly NAME_TOO_LONG: "NAME_TOO_LONG";
18
+ readonly TOO_MANY_LINKS: "TOO_MANY_LINKS";
19
+ readonly FILESYSTEM_ERROR: "FILESYSTEM_ERROR";
20
+ readonly COMMAND_NOT_FOUND: "COMMAND_NOT_FOUND";
21
+ readonly COMMAND_PERMISSION_DENIED: "COMMAND_PERMISSION_DENIED";
22
+ readonly INVALID_COMMAND: "INVALID_COMMAND";
23
+ readonly COMMAND_EXECUTION_ERROR: "COMMAND_EXECUTION_ERROR";
24
+ readonly STREAM_START_ERROR: "STREAM_START_ERROR";
25
+ readonly PROCESS_NOT_FOUND: "PROCESS_NOT_FOUND";
26
+ readonly PROCESS_PERMISSION_DENIED: "PROCESS_PERMISSION_DENIED";
27
+ readonly PROCESS_ERROR: "PROCESS_ERROR";
28
+ readonly SESSION_ALREADY_EXISTS: "SESSION_ALREADY_EXISTS";
29
+ readonly SESSION_DESTROYED: "SESSION_DESTROYED";
30
+ readonly SESSION_TERMINATED: "SESSION_TERMINATED";
31
+ readonly PORT_ALREADY_EXPOSED: "PORT_ALREADY_EXPOSED";
32
+ readonly PORT_IN_USE: "PORT_IN_USE";
33
+ readonly PORT_NOT_EXPOSED: "PORT_NOT_EXPOSED";
34
+ readonly INVALID_PORT_NUMBER: "INVALID_PORT_NUMBER";
35
+ readonly INVALID_PORT: "INVALID_PORT";
36
+ readonly SERVICE_NOT_RESPONDING: "SERVICE_NOT_RESPONDING";
37
+ readonly PORT_OPERATION_ERROR: "PORT_OPERATION_ERROR";
38
+ readonly CUSTOM_DOMAIN_REQUIRED: "CUSTOM_DOMAIN_REQUIRED";
39
+ readonly GIT_REPOSITORY_NOT_FOUND: "GIT_REPOSITORY_NOT_FOUND";
40
+ readonly GIT_BRANCH_NOT_FOUND: "GIT_BRANCH_NOT_FOUND";
41
+ readonly GIT_AUTH_FAILED: "GIT_AUTH_FAILED";
42
+ readonly GIT_NETWORK_ERROR: "GIT_NETWORK_ERROR";
43
+ readonly INVALID_GIT_URL: "INVALID_GIT_URL";
44
+ readonly GIT_CLONE_FAILED: "GIT_CLONE_FAILED";
45
+ readonly GIT_CHECKOUT_FAILED: "GIT_CHECKOUT_FAILED";
46
+ readonly GIT_OPERATION_FAILED: "GIT_OPERATION_FAILED";
47
+ readonly BUCKET_MOUNT_ERROR: "BUCKET_MOUNT_ERROR";
48
+ readonly BUCKET_UNMOUNT_ERROR: "BUCKET_UNMOUNT_ERROR";
49
+ readonly S3FS_MOUNT_ERROR: "S3FS_MOUNT_ERROR";
50
+ readonly MISSING_CREDENTIALS: "MISSING_CREDENTIALS";
51
+ readonly INVALID_MOUNT_CONFIG: "INVALID_MOUNT_CONFIG";
52
+ readonly BACKUP_CREATE_FAILED: "BACKUP_CREATE_FAILED";
53
+ readonly BACKUP_RESTORE_FAILED: "BACKUP_RESTORE_FAILED";
54
+ readonly BACKUP_NOT_FOUND: "BACKUP_NOT_FOUND";
55
+ readonly BACKUP_EXPIRED: "BACKUP_EXPIRED";
56
+ readonly INVALID_BACKUP_CONFIG: "INVALID_BACKUP_CONFIG";
57
+ readonly INTERPRETER_NOT_READY: "INTERPRETER_NOT_READY";
58
+ readonly CONTEXT_NOT_FOUND: "CONTEXT_NOT_FOUND";
59
+ readonly CODE_EXECUTION_ERROR: "CODE_EXECUTION_ERROR";
60
+ readonly PYTHON_NOT_AVAILABLE: "PYTHON_NOT_AVAILABLE";
61
+ readonly JAVASCRIPT_NOT_AVAILABLE: "JAVASCRIPT_NOT_AVAILABLE";
62
+ readonly OPENCODE_STARTUP_FAILED: "OPENCODE_STARTUP_FAILED";
63
+ readonly PROCESS_READY_TIMEOUT: "PROCESS_READY_TIMEOUT";
64
+ readonly PROCESS_EXITED_BEFORE_READY: "PROCESS_EXITED_BEFORE_READY";
65
+ readonly WATCH_NOT_FOUND: "WATCH_NOT_FOUND";
66
+ readonly WATCH_START_ERROR: "WATCH_START_ERROR";
67
+ readonly WATCH_STOP_ERROR: "WATCH_STOP_ERROR";
68
+ readonly VALIDATION_FAILED: "VALIDATION_FAILED";
69
+ readonly INVALID_JSON_RESPONSE: "INVALID_JSON_RESPONSE";
70
+ readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
71
+ readonly INTERNAL_ERROR: "INTERNAL_ERROR";
72
+ readonly CONTAINER_UNAVAILABLE: "CONTAINER_UNAVAILABLE";
73
+ readonly OPERATION_INTERRUPTED: "OPERATION_INTERRUPTED";
74
+ readonly RPC_TRANSPORT_ERROR: "RPC_TRANSPORT_ERROR";
75
+ };
76
+ type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];
77
+ //#endregion
78
+ export { ErrorCode as t };
79
+ //# sourceMappingURL=codes-y-U76vnQ.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codes-y-U76vnQ.d.ts","names":["ErrorCode"],"sources":["../../shared/dist/errors/codes.d.ts"],"sourcesContent":["/**\n * Centralized error code registry\n * Each code maps to a specific error type with consistent semantics\n */\nexport declare const ErrorCode: {\n readonly FILE_NOT_FOUND: \"FILE_NOT_FOUND\";\n readonly PERMISSION_DENIED: \"PERMISSION_DENIED\";\n readonly FILE_EXISTS: \"FILE_EXISTS\";\n readonly IS_DIRECTORY: \"IS_DIRECTORY\";\n readonly NOT_DIRECTORY: \"NOT_DIRECTORY\";\n readonly FILE_TOO_LARGE: \"FILE_TOO_LARGE\";\n readonly NO_SPACE: \"NO_SPACE\";\n readonly TOO_MANY_FILES: \"TOO_MANY_FILES\";\n readonly RESOURCE_BUSY: \"RESOURCE_BUSY\";\n readonly READ_ONLY: \"READ_ONLY\";\n readonly NAME_TOO_LONG: \"NAME_TOO_LONG\";\n readonly TOO_MANY_LINKS: \"TOO_MANY_LINKS\";\n readonly FILESYSTEM_ERROR: \"FILESYSTEM_ERROR\";\n readonly COMMAND_NOT_FOUND: \"COMMAND_NOT_FOUND\";\n readonly COMMAND_PERMISSION_DENIED: \"COMMAND_PERMISSION_DENIED\";\n readonly INVALID_COMMAND: \"INVALID_COMMAND\";\n readonly COMMAND_EXECUTION_ERROR: \"COMMAND_EXECUTION_ERROR\";\n readonly STREAM_START_ERROR: \"STREAM_START_ERROR\";\n readonly PROCESS_NOT_FOUND: \"PROCESS_NOT_FOUND\";\n readonly PROCESS_PERMISSION_DENIED: \"PROCESS_PERMISSION_DENIED\";\n readonly PROCESS_ERROR: \"PROCESS_ERROR\";\n readonly SESSION_ALREADY_EXISTS: \"SESSION_ALREADY_EXISTS\";\n readonly SESSION_DESTROYED: \"SESSION_DESTROYED\";\n readonly SESSION_TERMINATED: \"SESSION_TERMINATED\";\n readonly PORT_ALREADY_EXPOSED: \"PORT_ALREADY_EXPOSED\";\n readonly PORT_IN_USE: \"PORT_IN_USE\";\n readonly PORT_NOT_EXPOSED: \"PORT_NOT_EXPOSED\";\n readonly INVALID_PORT_NUMBER: \"INVALID_PORT_NUMBER\";\n readonly INVALID_PORT: \"INVALID_PORT\";\n readonly SERVICE_NOT_RESPONDING: \"SERVICE_NOT_RESPONDING\";\n readonly PORT_OPERATION_ERROR: \"PORT_OPERATION_ERROR\";\n readonly CUSTOM_DOMAIN_REQUIRED: \"CUSTOM_DOMAIN_REQUIRED\";\n readonly GIT_REPOSITORY_NOT_FOUND: \"GIT_REPOSITORY_NOT_FOUND\";\n readonly GIT_BRANCH_NOT_FOUND: \"GIT_BRANCH_NOT_FOUND\";\n readonly GIT_AUTH_FAILED: \"GIT_AUTH_FAILED\";\n readonly GIT_NETWORK_ERROR: \"GIT_NETWORK_ERROR\";\n readonly INVALID_GIT_URL: \"INVALID_GIT_URL\";\n readonly GIT_CLONE_FAILED: \"GIT_CLONE_FAILED\";\n readonly GIT_CHECKOUT_FAILED: \"GIT_CHECKOUT_FAILED\";\n readonly GIT_OPERATION_FAILED: \"GIT_OPERATION_FAILED\";\n readonly BUCKET_MOUNT_ERROR: \"BUCKET_MOUNT_ERROR\";\n readonly BUCKET_UNMOUNT_ERROR: \"BUCKET_UNMOUNT_ERROR\";\n readonly S3FS_MOUNT_ERROR: \"S3FS_MOUNT_ERROR\";\n readonly MISSING_CREDENTIALS: \"MISSING_CREDENTIALS\";\n readonly INVALID_MOUNT_CONFIG: \"INVALID_MOUNT_CONFIG\";\n readonly BACKUP_CREATE_FAILED: \"BACKUP_CREATE_FAILED\";\n readonly BACKUP_RESTORE_FAILED: \"BACKUP_RESTORE_FAILED\";\n readonly BACKUP_NOT_FOUND: \"BACKUP_NOT_FOUND\";\n readonly BACKUP_EXPIRED: \"BACKUP_EXPIRED\";\n readonly INVALID_BACKUP_CONFIG: \"INVALID_BACKUP_CONFIG\";\n readonly INTERPRETER_NOT_READY: \"INTERPRETER_NOT_READY\";\n readonly CONTEXT_NOT_FOUND: \"CONTEXT_NOT_FOUND\";\n readonly CODE_EXECUTION_ERROR: \"CODE_EXECUTION_ERROR\";\n readonly PYTHON_NOT_AVAILABLE: \"PYTHON_NOT_AVAILABLE\";\n readonly JAVASCRIPT_NOT_AVAILABLE: \"JAVASCRIPT_NOT_AVAILABLE\";\n readonly OPENCODE_STARTUP_FAILED: \"OPENCODE_STARTUP_FAILED\";\n readonly PROCESS_READY_TIMEOUT: \"PROCESS_READY_TIMEOUT\";\n readonly PROCESS_EXITED_BEFORE_READY: \"PROCESS_EXITED_BEFORE_READY\";\n readonly WATCH_NOT_FOUND: \"WATCH_NOT_FOUND\";\n readonly WATCH_START_ERROR: \"WATCH_START_ERROR\";\n readonly WATCH_STOP_ERROR: \"WATCH_STOP_ERROR\";\n readonly VALIDATION_FAILED: \"VALIDATION_FAILED\";\n readonly INVALID_JSON_RESPONSE: \"INVALID_JSON_RESPONSE\";\n readonly UNKNOWN_ERROR: \"UNKNOWN_ERROR\";\n readonly INTERNAL_ERROR: \"INTERNAL_ERROR\";\n readonly CONTAINER_UNAVAILABLE: \"CONTAINER_UNAVAILABLE\";\n readonly OPERATION_INTERRUPTED: \"OPERATION_INTERRUPTED\";\n readonly RPC_TRANSPORT_ERROR: \"RPC_TRANSPORT_ERROR\";\n};\nexport type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];\n//# sourceMappingURL=codes.d.ts.map"],"mappings":";;AAIA;AAsEA;;cAtEqBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsETA,SAAAA,WAAoBA,wBAAwBA"}
@@ -0,0 +1,327 @@
1
+ import { t as ErrorCode } from "./codes-y-U76vnQ.js";
2
+
3
+ //#region ../shared/dist/errors/types.d.ts
4
+
5
+ /**
6
+ * Standard operation types
7
+ */
8
+ declare const Operation: {
9
+ readonly FILE_READ: "file.read";
10
+ readonly FILE_WRITE: "file.write";
11
+ readonly FILE_DELETE: "file.delete";
12
+ readonly FILE_MOVE: "file.move";
13
+ readonly FILE_RENAME: "file.rename";
14
+ readonly FILE_STAT: "file.stat";
15
+ readonly DIRECTORY_CREATE: "directory.create";
16
+ readonly DIRECTORY_LIST: "directory.list";
17
+ readonly COMMAND_EXECUTE: "command.execute";
18
+ readonly COMMAND_STREAM: "command.stream";
19
+ readonly PROCESS_START: "process.start";
20
+ readonly PROCESS_KILL: "process.kill";
21
+ readonly PROCESS_LIST: "process.list";
22
+ readonly PROCESS_GET: "process.get";
23
+ readonly PROCESS_LOGS: "process.logs";
24
+ readonly GIT_CLONE: "git.clone";
25
+ readonly GIT_CHECKOUT: "git.checkout";
26
+ readonly GIT_OPERATION: "git.operation";
27
+ readonly BACKUP_CREATE: "backup.create";
28
+ readonly BACKUP_RESTORE: "backup.restore";
29
+ readonly BACKUP_UNMOUNT: "backup.unmount";
30
+ readonly CODE_EXECUTE: "code.execute";
31
+ readonly CODE_CONTEXT_CREATE: "code.context.create";
32
+ readonly CODE_CONTEXT_DELETE: "code.context.delete";
33
+ };
34
+ type OperationType = (typeof Operation)[keyof typeof Operation];
35
+ /**
36
+ * Standard error response format with generic context type
37
+ * TContext allows type-safe access to error-specific context
38
+ */
39
+ interface ErrorResponse<TContext = Record<string, unknown>> {
40
+ /**
41
+ * Error type code (machine-readable)
42
+ */
43
+ code: ErrorCode;
44
+ /**
45
+ * Human-readable error message
46
+ */
47
+ message: string;
48
+ /**
49
+ * Operation that was attempted (useful for debugging and logging)
50
+ */
51
+ operation?: OperationType;
52
+ /**
53
+ * Structured error context with relevant details
54
+ * Type varies based on error code
55
+ */
56
+ context: TContext;
57
+ /**
58
+ * HTTP status code (for client SDK)
59
+ */
60
+ httpStatus: number;
61
+ /**
62
+ * Timestamp when error occurred
63
+ */
64
+ timestamp: string;
65
+ /**
66
+ * Actionable suggestion for fixing the error
67
+ */
68
+ suggestion?: string;
69
+ /**
70
+ * Link to documentation
71
+ */
72
+ documentation?: string;
73
+ }
74
+ //#endregion
75
+ //#region ../shared/dist/errors/contexts.d.ts
76
+ /**
77
+ * File system error contexts
78
+ */
79
+ interface FileNotFoundContext {
80
+ path: string;
81
+ operation: OperationType;
82
+ }
83
+ interface FileExistsContext {
84
+ path: string;
85
+ operation: OperationType;
86
+ }
87
+ interface FileTooLargeContext {
88
+ path: string;
89
+ operation: OperationType;
90
+ maxSize: number;
91
+ actualSize: number;
92
+ }
93
+ interface FileSystemContext {
94
+ path: string;
95
+ operation: OperationType;
96
+ stderr?: string;
97
+ exitCode?: number;
98
+ }
99
+ /**
100
+ * Command error contexts
101
+ */
102
+ interface CommandNotFoundContext {
103
+ command: string;
104
+ }
105
+ interface CommandErrorContext {
106
+ command: string;
107
+ exitCode?: number;
108
+ stdout?: string;
109
+ stderr?: string;
110
+ }
111
+ /**
112
+ * Process error contexts
113
+ */
114
+ interface ProcessNotFoundContext {
115
+ processId: string;
116
+ }
117
+ interface ProcessErrorContext {
118
+ processId: string;
119
+ pid?: number;
120
+ exitCode?: number;
121
+ stderr?: string;
122
+ }
123
+ interface SessionAlreadyExistsContext {
124
+ sessionId: string;
125
+ /**
126
+ * `CLOUDFLARE_PLACEMENT_ID` captured from the container at the moment the
127
+ * duplicate create was detected. Included so a restarted DO can learn the
128
+ * container's placement ID from an idempotent session-create. `null` when
129
+ * the env var is not set (for example, in local development).
130
+ */
131
+ containerPlacementId?: string | null;
132
+ }
133
+ interface SessionDestroyedContext {
134
+ sessionId: string;
135
+ }
136
+ interface SessionTerminatedContext {
137
+ sessionId: string;
138
+ exitCode: number | null;
139
+ }
140
+ /**
141
+ * Process readiness error contexts
142
+ */
143
+ interface ProcessReadyTimeoutContext {
144
+ processId: string;
145
+ command: string;
146
+ condition: string;
147
+ timeout: number;
148
+ }
149
+ interface ProcessExitedBeforeReadyContext {
150
+ processId: string;
151
+ command: string;
152
+ condition: string;
153
+ exitCode: number;
154
+ }
155
+ /**
156
+ * Port error contexts
157
+ */
158
+ interface PortAlreadyExposedContext {
159
+ port: number;
160
+ portName?: string;
161
+ }
162
+ interface PortNotExposedContext {
163
+ port: number;
164
+ }
165
+ interface InvalidPortContext {
166
+ port: number;
167
+ reason: string;
168
+ }
169
+ interface PortErrorContext {
170
+ port: number;
171
+ portName?: string;
172
+ stderr?: string;
173
+ }
174
+ /**
175
+ * Git error contexts
176
+ */
177
+ interface GitRepositoryNotFoundContext {
178
+ repository: string;
179
+ }
180
+ interface GitAuthFailedContext {
181
+ repository: string;
182
+ }
183
+ interface GitBranchNotFoundContext {
184
+ branch: string;
185
+ repository?: string;
186
+ }
187
+ interface GitErrorContext {
188
+ repository?: string;
189
+ branch?: string;
190
+ targetDir?: string;
191
+ stderr?: string;
192
+ exitCode?: number;
193
+ }
194
+ /**
195
+ * Code interpreter error contexts
196
+ */
197
+ interface InterpreterNotReadyContext {
198
+ retryAfter?: number;
199
+ progress?: number;
200
+ }
201
+ interface ContextNotFoundContext {
202
+ contextId: string;
203
+ }
204
+ interface CodeExecutionContext {
205
+ contextId?: string;
206
+ ename?: string;
207
+ evalue?: string;
208
+ traceback?: string[];
209
+ }
210
+ /**
211
+ * Validation error contexts
212
+ */
213
+ interface ValidationFailedContext {
214
+ validationErrors: Array<{
215
+ field: string;
216
+ message: string;
217
+ code?: string;
218
+ }>;
219
+ }
220
+ /**
221
+ * Backup error contexts
222
+ */
223
+ interface BackupCreateContext {
224
+ dir: string;
225
+ backupId?: string;
226
+ stderr?: string;
227
+ exitCode?: number;
228
+ }
229
+ interface BackupRestoreContext {
230
+ dir: string;
231
+ backupId: string;
232
+ stderr?: string;
233
+ exitCode?: number;
234
+ }
235
+ interface BackupNotFoundContext {
236
+ backupId: string;
237
+ }
238
+ interface BackupExpiredContext {
239
+ backupId: string;
240
+ expiredAt?: string;
241
+ }
242
+ interface InvalidBackupConfigContext {
243
+ reason: string;
244
+ }
245
+ /**
246
+ * OpenCode error contexts
247
+ */
248
+ interface OpenCodeStartupContext {
249
+ port: number;
250
+ stderr?: string;
251
+ command?: string;
252
+ }
253
+ /**
254
+ * Generic error contexts
255
+ */
256
+ interface InternalErrorContext {
257
+ originalError?: string;
258
+ stack?: string;
259
+ [key: string]: unknown;
260
+ }
261
+ /**
262
+ * Container availability error context. Surfaced when the sandbox container
263
+ * cannot accept the incoming RPC connection. The container may be starting
264
+ * up, undergoing a runtime replacement, or temporarily unhealthy. The
265
+ * caller should retry the same operation.
266
+ */
267
+ interface ContainerUnavailableContext {
268
+ /**
269
+ * Categorical reason distinguishing startup unavailability from runtime
270
+ * replacement and exhausted upgrade retries.
271
+ */
272
+ reason: 'container_starting' | 'container_unhealthy' | 'container_replaced' | 'rpc_upgrade_failed';
273
+ /**
274
+ * Always true — this error represents a transient unavailability, not a
275
+ * permanent failure. Callers should retry the same operation.
276
+ */
277
+ retryable: true;
278
+ /** Suggested delay in milliseconds before the next retry attempt. */
279
+ retryAfterMs?: number;
280
+ }
281
+ type OperationInterruptedReason = 'runtime_replaced' | 'container_stopped' | 'transport_disposed' | 'sandbox_destroyed' | 'sandbox_lifetime_changed' | 'recovery_exhausted' | 'unknown';
282
+ interface OperationInterruptedContext {
283
+ reason: OperationInterruptedReason;
284
+ operation: string;
285
+ phase?: string;
286
+ admitted: true | 'unknown';
287
+ retryable: boolean;
288
+ operationId?: string;
289
+ operationKey?: string;
290
+ idempotencyKey?: string;
291
+ recoveryAttempts?: number;
292
+ maxRecoveryAttempts?: number;
293
+ backupId?: string;
294
+ dir?: string;
295
+ }
296
+ /**
297
+ * RPC transport error contexts. Surfaced when the capnweb WebSocket session
298
+ * fails on the SDK side rather than the container reporting a structured
299
+ * error. Always retryable — the next call will open a fresh connection.
300
+ */
301
+ type RPCTransportErrorKind = /** Server closed the WebSocket (container crash, DO eviction, network blip). */
302
+ 'peer_closed'
303
+ /** Underlying socket fired the `error` event. */ | 'connection_failed'
304
+ /** WebSocket upgrade failed before the session was established. */ | 'upgrade_failed'
305
+ /** Peer sent a non-string frame; capnweb's wire format is JSON text only. */ | 'invalid_frame'
306
+ /** Peer sent a frame the wire-format parser rejected (capnweb readLoop SyntaxError). */ | 'protocol_error'
307
+ /** Session was disposed (locally or remotely) while a call was pending. */ | 'session_disposed'
308
+ /** Anything else that bubbled up from the transport with no recognisable shape. */ | 'unknown';
309
+ interface RPCTransportContext {
310
+ /** Categorical bucket so callers can branch on `peer_closed` vs `upgrade_failed` etc. */
311
+ kind: RPCTransportErrorKind;
312
+ /** Original error message, verbatim from capnweb / our DeferredTransport. */
313
+ originalMessage: string;
314
+ /**
315
+ * The underlying Error's `name` property. capnweb preserves this across
316
+ * the wire for the standard built-ins (TypeError, SyntaxError, etc.), so
317
+ * it's a more reliable hint than the message string for those cases.
318
+ */
319
+ errorName: string;
320
+ /** WebSocket close code, when available (kind === 'peer_closed'). */
321
+ closeCode?: number;
322
+ /** WebSocket close reason, when available (kind === 'peer_closed'). */
323
+ closeReason?: string;
324
+ }
325
+ //#endregion
326
+ export { ProcessNotFoundContext as A, OperationType as B, OperationInterruptedContext as C, PortNotExposedContext as D, PortErrorContext as E, SessionDestroyedContext as F, SessionTerminatedContext as I, ValidationFailedContext as L, RPCTransportContext as M, RPCTransportErrorKind as N, ProcessErrorContext as O, SessionAlreadyExistsContext as P, ErrorResponse as R, OpenCodeStartupContext as S, PortAlreadyExposedContext as T, GitRepositoryNotFoundContext as _, CodeExecutionContext as a, InvalidBackupConfigContext as b, ContainerUnavailableContext as c, FileNotFoundContext as d, FileSystemContext as f, GitErrorContext as g, GitBranchNotFoundContext as h, BackupRestoreContext as i, ProcessReadyTimeoutContext as j, ProcessExitedBeforeReadyContext as k, ContextNotFoundContext as l, GitAuthFailedContext as m, BackupExpiredContext as n, CommandErrorContext as o, FileTooLargeContext as p, BackupNotFoundContext as r, CommandNotFoundContext as s, BackupCreateContext as t, FileExistsContext as u, InternalErrorContext as v, OperationInterruptedReason as w, InvalidPortContext as x, InterpreterNotReadyContext as y, Operation as z };
327
+ //# sourceMappingURL=contexts-DY1LHU1v.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contexts-DY1LHU1v.d.ts","names":["ErrorCode","Operation","OperationType","ErrorResponse","TContext","Record","ServiceError","ServiceResult","T","OperationType","FileNotFoundContext","FileExistsContext","FileTooLargeContext","FileSystemContext","CommandNotFoundContext","CommandErrorContext","ProcessNotFoundContext","ProcessErrorContext","SessionAlreadyExistsContext","SessionDestroyedContext","SessionTerminatedContext","ProcessReadyTimeoutContext","ProcessExitedBeforeReadyContext","PortAlreadyExposedContext","PortNotExposedContext","InvalidPortContext","PortErrorContext","GitRepositoryNotFoundContext","GitAuthFailedContext","GitBranchNotFoundContext","GitErrorContext","InterpreterNotReadyContext","ContextNotFoundContext","CodeExecutionContext","ValidationFailedContext","Array","BucketMountContext","MissingCredentialsContext","InvalidMountConfigContext","BackupCreateContext","BackupRestoreContext","BackupNotFoundContext","BackupExpiredContext","InvalidBackupConfigContext","OpenCodeStartupContext","InternalErrorContext","ContainerUnavailableContext","OperationInterruptedReason","OperationInterruptedContext","RPCTransportErrorKind","RPCTransportContext"],"sources":["../../shared/dist/errors/types.d.ts","../../shared/dist/errors/contexts.d.ts"],"sourcesContent":["import type { ErrorCode } from './codes';\n/**\n * Standard operation types\n */\nexport declare const Operation: {\n readonly FILE_READ: \"file.read\";\n readonly FILE_WRITE: \"file.write\";\n readonly FILE_DELETE: \"file.delete\";\n readonly FILE_MOVE: \"file.move\";\n readonly FILE_RENAME: \"file.rename\";\n readonly FILE_STAT: \"file.stat\";\n readonly DIRECTORY_CREATE: \"directory.create\";\n readonly DIRECTORY_LIST: \"directory.list\";\n readonly COMMAND_EXECUTE: \"command.execute\";\n readonly COMMAND_STREAM: \"command.stream\";\n readonly PROCESS_START: \"process.start\";\n readonly PROCESS_KILL: \"process.kill\";\n readonly PROCESS_LIST: \"process.list\";\n readonly PROCESS_GET: \"process.get\";\n readonly PROCESS_LOGS: \"process.logs\";\n readonly GIT_CLONE: \"git.clone\";\n readonly GIT_CHECKOUT: \"git.checkout\";\n readonly GIT_OPERATION: \"git.operation\";\n readonly BACKUP_CREATE: \"backup.create\";\n readonly BACKUP_RESTORE: \"backup.restore\";\n readonly BACKUP_UNMOUNT: \"backup.unmount\";\n readonly CODE_EXECUTE: \"code.execute\";\n readonly CODE_CONTEXT_CREATE: \"code.context.create\";\n readonly CODE_CONTEXT_DELETE: \"code.context.delete\";\n};\nexport type OperationType = (typeof Operation)[keyof typeof Operation];\n/**\n * Standard error response format with generic context type\n * TContext allows type-safe access to error-specific context\n */\nexport interface ErrorResponse<TContext = Record<string, unknown>> {\n /**\n * Error type code (machine-readable)\n */\n code: ErrorCode;\n /**\n * Human-readable error message\n */\n message: string;\n /**\n * Operation that was attempted (useful for debugging and logging)\n */\n operation?: OperationType;\n /**\n * Structured error context with relevant details\n * Type varies based on error code\n */\n context: TContext;\n /**\n * HTTP status code (for client SDK)\n */\n httpStatus: number;\n /**\n * Timestamp when error occurred\n */\n timestamp: string;\n /**\n * Actionable suggestion for fixing the error\n */\n suggestion?: string;\n /**\n * Link to documentation\n */\n documentation?: string;\n}\n/**\n * Container ServiceError (lightweight, enriched by handlers)\n */\nexport interface ServiceError {\n message: string;\n code: ErrorCode;\n details?: Record<string, unknown>;\n}\n/**\n * ServiceResult type for container services\n */\nexport type ServiceResult<T> = {\n success: true;\n data: T;\n} | {\n success: false;\n error: ServiceError;\n};\n//# sourceMappingURL=types.d.ts.map","import type { OperationType } from './types';\n/**\n * File system error contexts\n */\nexport interface FileNotFoundContext {\n path: string;\n operation: OperationType;\n}\nexport interface FileExistsContext {\n path: string;\n operation: OperationType;\n}\nexport interface FileTooLargeContext {\n path: string;\n operation: OperationType;\n maxSize: number;\n actualSize: number;\n}\nexport interface FileSystemContext {\n path: string;\n operation: OperationType;\n stderr?: string;\n exitCode?: number;\n}\n/**\n * Command error contexts\n */\nexport interface CommandNotFoundContext {\n command: string;\n}\nexport interface CommandErrorContext {\n command: string;\n exitCode?: number;\n stdout?: string;\n stderr?: string;\n}\n/**\n * Process error contexts\n */\nexport interface ProcessNotFoundContext {\n processId: string;\n}\nexport interface ProcessErrorContext {\n processId: string;\n pid?: number;\n exitCode?: number;\n stderr?: string;\n}\nexport interface SessionAlreadyExistsContext {\n sessionId: string;\n /**\n * `CLOUDFLARE_PLACEMENT_ID` captured from the container at the moment the\n * duplicate create was detected. Included so a restarted DO can learn the\n * container's placement ID from an idempotent session-create. `null` when\n * the env var is not set (for example, in local development).\n */\n containerPlacementId?: string | null;\n}\nexport interface SessionDestroyedContext {\n sessionId: string;\n}\nexport interface SessionTerminatedContext {\n sessionId: string;\n exitCode: number | null;\n}\n/**\n * Process readiness error contexts\n */\nexport interface ProcessReadyTimeoutContext {\n processId: string;\n command: string;\n condition: string;\n timeout: number;\n}\nexport interface ProcessExitedBeforeReadyContext {\n processId: string;\n command: string;\n condition: string;\n exitCode: number;\n}\n/**\n * Port error contexts\n */\nexport interface PortAlreadyExposedContext {\n port: number;\n portName?: string;\n}\nexport interface PortNotExposedContext {\n port: number;\n}\nexport interface InvalidPortContext {\n port: number;\n reason: string;\n}\nexport interface PortErrorContext {\n port: number;\n portName?: string;\n stderr?: string;\n}\n/**\n * Git error contexts\n */\nexport interface GitRepositoryNotFoundContext {\n repository: string;\n}\nexport interface GitAuthFailedContext {\n repository: string;\n}\nexport interface GitBranchNotFoundContext {\n branch: string;\n repository?: string;\n}\nexport interface GitErrorContext {\n repository?: string;\n branch?: string;\n targetDir?: string;\n stderr?: string;\n exitCode?: number;\n}\n/**\n * Code interpreter error contexts\n */\nexport interface InterpreterNotReadyContext {\n retryAfter?: number;\n progress?: number;\n}\nexport interface ContextNotFoundContext {\n contextId: string;\n}\nexport interface CodeExecutionContext {\n contextId?: string;\n ename?: string;\n evalue?: string;\n traceback?: string[];\n}\n/**\n * Validation error contexts\n */\nexport interface ValidationFailedContext {\n validationErrors: Array<{\n field: string;\n message: string;\n code?: string;\n }>;\n}\n/**\n * Bucket mounting error contexts\n */\nexport interface BucketMountContext {\n bucket: string;\n mountPath: string;\n endpoint: string;\n stderr?: string;\n exitCode?: number;\n}\nexport interface MissingCredentialsContext {\n bucket: string;\n endpoint: string;\n}\nexport interface InvalidMountConfigContext {\n bucket?: string;\n mountPath?: string;\n endpoint?: string;\n reason?: string;\n}\n/**\n * Backup error contexts\n */\nexport interface BackupCreateContext {\n dir: string;\n backupId?: string;\n stderr?: string;\n exitCode?: number;\n}\nexport interface BackupRestoreContext {\n dir: string;\n backupId: string;\n stderr?: string;\n exitCode?: number;\n}\nexport interface BackupNotFoundContext {\n backupId: string;\n}\nexport interface BackupExpiredContext {\n backupId: string;\n expiredAt?: string;\n}\nexport interface InvalidBackupConfigContext {\n reason: string;\n}\n/**\n * OpenCode error contexts\n */\nexport interface OpenCodeStartupContext {\n port: number;\n stderr?: string;\n command?: string;\n}\n/**\n * Generic error contexts\n */\nexport interface InternalErrorContext {\n originalError?: string;\n stack?: string;\n [key: string]: unknown;\n}\n/**\n * Container availability error context. Surfaced when the sandbox container\n * cannot accept the incoming RPC connection. The container may be starting\n * up, undergoing a runtime replacement, or temporarily unhealthy. The\n * caller should retry the same operation.\n */\nexport interface ContainerUnavailableContext {\n /**\n * Categorical reason distinguishing startup unavailability from runtime\n * replacement and exhausted upgrade retries.\n */\n reason: 'container_starting' | 'container_unhealthy' | 'container_replaced' | 'rpc_upgrade_failed';\n /**\n * Always true — this error represents a transient unavailability, not a\n * permanent failure. Callers should retry the same operation.\n */\n retryable: true;\n /** Suggested delay in milliseconds before the next retry attempt. */\n retryAfterMs?: number;\n}\nexport type OperationInterruptedReason = 'runtime_replaced' | 'container_stopped' | 'transport_disposed' | 'sandbox_destroyed' | 'sandbox_lifetime_changed' | 'recovery_exhausted' | 'unknown';\nexport interface OperationInterruptedContext {\n reason: OperationInterruptedReason;\n operation: string;\n phase?: string;\n admitted: true | 'unknown';\n retryable: boolean;\n operationId?: string;\n operationKey?: string;\n idempotencyKey?: string;\n recoveryAttempts?: number;\n maxRecoveryAttempts?: number;\n backupId?: string;\n dir?: string;\n}\n/**\n * RPC transport error contexts. Surfaced when the capnweb WebSocket session\n * fails on the SDK side rather than the container reporting a structured\n * error. Always retryable — the next call will open a fresh connection.\n */\nexport type RPCTransportErrorKind = \n/** Server closed the WebSocket (container crash, DO eviction, network blip). */\n'peer_closed'\n/** Underlying socket fired the `error` event. */\n | 'connection_failed'\n/** WebSocket upgrade failed before the session was established. */\n | 'upgrade_failed'\n/** Peer sent a non-string frame; capnweb's wire format is JSON text only. */\n | 'invalid_frame'\n/** Peer sent a frame the wire-format parser rejected (capnweb readLoop SyntaxError). */\n | 'protocol_error'\n/** Session was disposed (locally or remotely) while a call was pending. */\n | 'session_disposed'\n/** Anything else that bubbled up from the transport with no recognisable shape. */\n | 'unknown';\nexport interface RPCTransportContext {\n /** Categorical bucket so callers can branch on `peer_closed` vs `upgrade_failed` etc. */\n kind: RPCTransportErrorKind;\n /** Original error message, verbatim from capnweb / our DeferredTransport. */\n originalMessage: string;\n /**\n * The underlying Error's `name` property. capnweb preserves this across\n * the wire for the standard built-ins (TypeError, SyntaxError, etc.), so\n * it's a more reliable hint than the message string for those cases.\n */\n errorName: string;\n /** WebSocket close code, when available (kind === 'peer_closed'). */\n closeCode?: number;\n /** WebSocket close reason, when available (kind === 'peer_closed'). */\n closeReason?: string;\n}\n//# sourceMappingURL=contexts.d.ts.map"],"mappings":";;;;;;AAIA;AA0BYE,cA1BSD,SA0BI,EAAA;EAKRE,SAAAA,SAAa,EAAA,WAAAC;EAAYC,SAAAA,UAAAA,EAAAA,YAAAA;EAIhCL,SAAAA,WAAAA,EAAAA,aAAAA;EAQME,SAAAA,SAAAA,EAAAA,WAAAA;EAKHE,SAAAA,WAAAA,EAAAA,aAAAA;EAAQ,SAAA,SAAA,EAAA,WAAA;;;;EChDJM,SAAAA,cAAmB,EAAA,gBAErBD;EAEEE,SAAAA,aAAiB,EAAA,eAEnBF;EAEEG,SAAAA,YAAAA,EAAmB,cAErBH;EAIEI,SAAAA,YAAiB,EAAA,cAEnBJ;EAOEK,SAAAA,WAAAA,EAAAA,aAAsB;EAGtBC,SAAAA,YAAAA,EAAmB,cAAA;EASnBC,SAAAA,SAAAA,EAAAA,WAAsB;EAGtBC,SAAAA,YAAAA,EAAmB,cAAA;EAMnBC,SAAAA,aAAAA,EAAAA,eAA2B;EAU3BC,SAAAA,aAAAA,EAAAA,eAAuB;EAGvBC,SAAAA,cAAAA,EAAAA,gBAAwB;EAOxBC,SAAAA,cAAAA,EAAAA,gBAA0B;EAM1BC,SAAAA,YAAAA,EAAAA,cAA+B;EAS/BC,SAAAA,mBAAyB,EAAA,qBAAA;EAIzBC,SAAAA,mBAAqB,EAAA,qBAAA;AAGtC,CAAA;AAIiBE,KDhELxB,aAAAA,GCgEqB,CAAA,ODhEGD,SCgEH,CAAA,CAAA,MAAA,ODhE2BA,SCgE3B,CAAA;AAQjC;AAGA;AAGA;AAIA;AAUiB8B,UDvFA5B,aCuFA4B,CAAAA,WDvFyB1B,MCuFC,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,CAAA;EAI1B2B;AAGjB;AASA;EA8BiBO,IAAAA,EDjIPvC,SCiIOuC;EAMAC;AAMjB;AAGA;EAIiBG,OAAAA,EAAAA,MAAAA;EAMAC;AAQjB;AAWA;EAcYG,SAAAA,CAAAA,EDnLI7C,aCmLJ6C;EACKC;AAmBjB;AAeA;;WDjNa5C;;;;;;;;;;;;;;;;;;;;;;AAhDb;AA0BYF,UC1BKQ,mBAAAA,CD0BmBT;EAKnBE,IAAAA,EAAAA,MAAAA;EAAyBE,SAAAA,EC7B3BI,aD6B2BJ;;AAY1BH,UCvCCS,iBAAAA,CDuCDT;EAKHE,IAAAA,EAAAA,MAAAA;EAAQ,SAAA,EC1CNK,aD0CM;;UCxCJG,mBAAAA;;EARAF,SAAAA,EAUFD,aAVqB;EAInBE,OAAAA,EAAAA,MAAAA;EAIAC,UAAAA,EAAAA,MAAAA;AAMjB;AASiBE,UATAD,iBAAAA,CASsB;EAGtBE,IAAAA,EAAAA,MAAAA;EASAC,SAAAA,EAnBFP,aAmBEO;EAGAC,MAAAA,CAAAA,EAAAA,MAAAA;EAMAC,QAAAA,CAAAA,EAAAA,MAAAA;AAUjB;AAGA;AAOA;AAMA;AASiBK,UAxDAT,sBAAAA,CAwDyB;EAIzBU,OAAAA,EAAAA,MAAAA;AAGjB;AAIiBE,UAhEAX,mBAAAA,CAgEgB;EAQhBY,OAAAA,EAAAA,MAAAA;EAGAC,QAAAA,CAAAA,EAAAA,MAAAA;EAGAC,MAAAA,CAAAA,EAAAA,MAAAA;EAIAC,MAAAA,CAAAA,EAAAA,MAAAA;AAUjB;AAIA;AAGA;AASA;AA8BiBS,UAjIAvB,sBAAAA,CAiImB;EAMnBwB,SAAAA,EAAAA,MAAAA;AAMjB;AAGiBE,UA7IAzB,mBAAAA,CA6IoB;EAIpB0B,SAAAA,EAAAA,MAAAA;EAMAC,GAAAA,CAAAA,EAAAA,MAAAA;EAQAC,QAAAA,CAAAA,EAAAA,MAAAA;EAWAC,MAAAA,CAAAA,EAAAA,MAAAA;AAcjB;AACiBE,UAnLA9B,2BAAAA,CAmL2B;EAmBhC+B,SAAAA,EAAAA,MAAAA;EAeKC;;;;;;;;UA3MA/B,uBAAAA;;;UAGAC,wBAAAA;;;;;;;UAOAC,0BAAAA;;;;;;UAMAC,+BAAAA;;;;;;;;;UASAC,yBAAAA;;;;UAIAC,qBAAAA;;;UAGAC,kBAAAA;;;;UAIAC,gBAAAA;;;;;;;;UAQAC,4BAAAA;;;UAGAC,oBAAAA;;;UAGAC,wBAAAA;;;;UAIAC,eAAAA;;;;;;;;;;UAUAC,0BAAAA;;;;UAIAC,sBAAAA;;;UAGAC,oBAAAA;;;;;;;;;UASAC,uBAAAA;oBACKC;;;;;;;;;UA6BLI,mBAAAA;;;;;;UAMAC,oBAAAA;;;;;;UAMAC,qBAAAA;;;UAGAC,oBAAAA;;;;UAIAC,0BAAAA;;;;;;UAMAC,sBAAAA;;;;;;;;UAQAC,oBAAAA;;;;;;;;;;;UAWAC,2BAAAA;;;;;;;;;;;;;;KAcLC,0BAAAA;UACKC,2BAAAA;UACLD;;;;;;;;;;;;;;;;;;KAkBAE,qBAAAA;;;;;;;;UAeKC,mBAAAA;;QAEPD"}
@@ -152,98 +152,38 @@ function truncateForLog(value, maxLen = 120) {
152
152
  }
153
153
 
154
154
  //#endregion
155
- //#region ../shared/dist/interpreter-types.js
156
- var Execution = class {
157
- code;
158
- context;
159
- /**
160
- * All results from the execution
161
- */
162
- results = [];
163
- /**
164
- * Accumulated stdout and stderr
165
- */
166
- logs = {
167
- stdout: [],
168
- stderr: []
169
- };
170
- /**
171
- * Execution error if any
172
- */
173
- error;
174
- /**
175
- * Execution count (for interpreter)
176
- */
177
- executionCount;
178
- constructor(code, context) {
179
- this.code = code;
180
- this.context = context;
181
- }
182
- /**
183
- * Convert to a plain object for serialization
184
- */
185
- toJSON() {
186
- return {
187
- code: this.code,
188
- logs: this.logs,
189
- error: this.error,
190
- executionCount: this.executionCount,
191
- results: this.results.map((result) => ({
192
- text: result.text,
193
- html: result.html,
194
- png: result.png,
195
- jpeg: result.jpeg,
196
- svg: result.svg,
197
- latex: result.latex,
198
- markdown: result.markdown,
199
- javascript: result.javascript,
200
- json: result.json,
201
- chart: result.chart,
202
- data: result.data
203
- }))
204
- };
205
- }
206
- };
207
- var ResultImpl = class {
208
- text;
209
- html;
210
- png;
211
- jpeg;
212
- svg;
213
- latex;
214
- markdown;
215
- javascript;
216
- json;
217
- chart;
218
- data;
219
- constructor(raw) {
220
- this.text = raw.text || raw.data?.["text/plain"];
221
- this.html = raw.html || raw.data?.["text/html"];
222
- this.png = raw.png || raw.data?.["image/png"];
223
- this.jpeg = raw.jpeg || raw.data?.["image/jpeg"];
224
- this.svg = raw.svg || raw.data?.["image/svg+xml"];
225
- this.latex = raw.latex || raw.data?.["text/latex"];
226
- this.markdown = raw.markdown || raw.data?.["text/markdown"];
227
- this.javascript = raw.javascript || raw.data?.["application/javascript"];
228
- this.json = raw.json || raw.data?.["application/json"];
229
- this.chart = raw.chart;
230
- this.data = raw.data;
231
- }
232
- formats() {
233
- const fmts = [];
234
- if (this.text) fmts.push("text");
235
- if (this.html) fmts.push("html");
236
- if (this.png) fmts.push("png");
237
- if (this.jpeg) fmts.push("jpeg");
238
- if (this.svg) fmts.push("svg");
239
- if (this.latex) fmts.push("latex");
240
- if (this.markdown) fmts.push("markdown");
241
- if (this.javascript) fmts.push("javascript");
242
- if (this.json) fmts.push("json");
243
- if (this.chart) fmts.push("chart");
244
- return fmts;
155
+ //#region ../shared/dist/git.js
156
+ /**
157
+ * Fallback repository name used when URL parsing fails
158
+ */
159
+ const FALLBACK_REPO_NAME = "repository";
160
+ /** Default wall-clock timeout in milliseconds for git clone operations. */
161
+ const DEFAULT_GIT_CLONE_TIMEOUT_MS = 6e5;
162
+ /**
163
+ * Extract repository name from a Git URL
164
+ *
165
+ * Supports multiple URL formats:
166
+ * - HTTPS: https://github.com/user/repo.git → repo
167
+ * - HTTPS without .git: https://github.com/user/repo → repo
168
+ * - SSH: git@github.com:user/repo.git → repo
169
+ * - GitLab/others: https://gitlab.com/org/project.git → project
170
+ *
171
+ * @param repoUrl - Git repository URL (HTTPS or SSH format)
172
+ * @returns Repository name extracted from URL, or 'repository' as fallback
173
+ */
174
+ function extractRepoName(repoUrl) {
175
+ try {
176
+ const pathParts = new URL(repoUrl).pathname.split("/");
177
+ const lastPart = pathParts[pathParts.length - 1];
178
+ if (lastPart) return lastPart.replace(/\.git$/, "");
179
+ } catch {}
180
+ if (repoUrl.includes(":") || repoUrl.includes("/")) {
181
+ const segments = repoUrl.split(/[:/]/).filter(Boolean);
182
+ const lastSegment = segments[segments.length - 1];
183
+ if (lastSegment) return lastSegment.replace(/\.git$/, "");
245
184
  }
246
- };
185
+ return FALLBACK_REPO_NAME;
186
+ }
247
187
 
248
188
  //#endregion
249
189
  //#region ../shared/dist/logger/canonical.js
@@ -762,6 +702,23 @@ function getEnvVar(name) {
762
702
  }
763
703
  }
764
704
 
705
+ //#endregion
706
+ //#region ../shared/dist/rpc-types.js
707
+ /**
708
+ * Shared interface types for the container-control path.
709
+ *
710
+ * Defines the contract between the SDK control client and the container
711
+ * control-plane API. The current wire implementation uses capnweb RPC.
712
+ */
713
+ /**
714
+ * Error name thrown by the host's `connect` when it has not yet provisioned
715
+ * the requested hash and the request did not carry tarball bytes. The SDK
716
+ * recognises this name via `Error.name` and retries the connect with the
717
+ * bytes attached. Kept as a string constant so it survives capnweb
718
+ * cross-realm error reconstruction.
719
+ */
720
+ const EXTENSION_TARBALL_REQUIRED = "ExtensionTarballRequired";
721
+
765
722
  //#endregion
766
723
  //#region ../shared/dist/shell-escape.js
767
724
  /**
@@ -840,5 +797,5 @@ function isProcessStatus(value) {
840
797
  }
841
798
 
842
799
  //#endregion
843
- export { shellEscape as a, TraceContext as c, ResultImpl as d, filterEnvVars as f, parseSSEFrames as i, logCanonicalEvent as l, partitionEnvVars as m, isProcess as n, createLogger as o, getEnvString as p, isProcessStatus as r, createNoOpLogger as s, isExecResult as t, Execution as u };
844
- //# sourceMappingURL=dist-mAH_7Ui7.js.map
800
+ export { shellEscape as a, createNoOpLogger as c, DEFAULT_GIT_CLONE_TIMEOUT_MS as d, extractRepoName as f, partitionEnvVars as g, getEnvString as h, parseSSEFrames as i, TraceContext as l, filterEnvVars as m, isProcess as n, EXTENSION_TARBALL_REQUIRED as o, redactCommand as p, isProcessStatus as r, createLogger as s, isExecResult as t, logCanonicalEvent as u };
801
+ //# sourceMappingURL=dist-BStBkGIC.js.map