@blaxel/core 0.2.49-dev.214 → 0.2.49-dev1

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 (247) hide show
  1. package/dist/agents/index.d.ts +15 -0
  2. package/dist/agents/index.js +109 -0
  3. package/dist/authentication/apikey.d.ts +10 -0
  4. package/dist/authentication/apikey.js +24 -0
  5. package/dist/authentication/clientcredentials.d.ts +17 -0
  6. package/dist/authentication/clientcredentials.js +85 -0
  7. package/dist/authentication/credentials.d.ts +6 -0
  8. package/dist/authentication/credentials.js +17 -0
  9. package/dist/authentication/deviceMode.d.ts +15 -0
  10. package/dist/authentication/deviceMode.js +70 -0
  11. package/dist/authentication/index.d.ts +3 -0
  12. package/dist/authentication/index.js +62 -0
  13. package/dist/authentication/types.d.ts +9 -0
  14. package/dist/authentication/types.js +2 -0
  15. package/dist/cache/index.d.ts +1 -0
  16. package/dist/cache/index.js +26 -0
  17. package/dist/cjs/.tsbuildinfo +1 -1
  18. package/dist/cjs/agents/index.js +2 -2
  19. package/dist/cjs/authentication/clientcredentials.js +1 -4
  20. package/dist/cjs/client/responseInterceptor.js +53 -0
  21. package/dist/cjs/client/sdk.gen.js +143 -3
  22. package/dist/cjs/common/autoload.js +7 -0
  23. package/dist/cjs/common/env.js +3 -0
  24. package/dist/cjs/common/internal.js +0 -40
  25. package/dist/cjs/common/settings.js +2 -5
  26. package/dist/cjs/common/version.js +6 -0
  27. package/dist/cjs/common/webhook.js +101 -0
  28. package/dist/cjs/jobs/executions.js +119 -0
  29. package/dist/cjs/jobs/jobs.js +2 -2
  30. package/dist/cjs/jobs/start.js +1 -32
  31. package/dist/cjs/sandbox/action.js +2 -1
  32. package/dist/cjs/sandbox/index.js +1 -0
  33. package/dist/cjs/sandbox/interpreter.js +400 -0
  34. package/dist/cjs/sandbox/sandbox.js +10 -67
  35. package/dist/cjs/tools/mcpTool.js +2 -6
  36. package/dist/cjs/types/client/responseInterceptor.d.ts +12 -0
  37. package/dist/cjs/types/client/sdk.gen.d.ts +41 -1
  38. package/dist/cjs/types/client/types.gen.d.ts +599 -16
  39. package/dist/cjs/types/common/internal.d.ts +0 -2
  40. package/dist/cjs/types/common/settings.d.ts +0 -1
  41. package/dist/cjs/types/common/version.d.ts +2 -0
  42. package/dist/cjs/types/common/webhook.d.ts +89 -0
  43. package/dist/cjs/types/jobs/executions.d.ts +42 -0
  44. package/dist/cjs/types/sandbox/client/sdk.gen.d.ts +1 -1
  45. package/dist/cjs/types/sandbox/index.d.ts +1 -0
  46. package/dist/cjs/types/sandbox/interpreter.d.ts +71 -0
  47. package/dist/cjs/types/sandbox/sandbox.d.ts +6 -12
  48. package/dist/cjs/types/sandbox/types.d.ts +0 -3
  49. package/dist/cjs-browser/.tsbuildinfo +1 -1
  50. package/dist/cjs-browser/agents/index.js +2 -2
  51. package/dist/cjs-browser/authentication/clientcredentials.js +1 -4
  52. package/dist/cjs-browser/client/responseInterceptor.js +53 -0
  53. package/dist/cjs-browser/client/sdk.gen.js +143 -3
  54. package/dist/cjs-browser/common/autoload.js +7 -0
  55. package/dist/cjs-browser/common/env.js +3 -0
  56. package/dist/cjs-browser/common/internal.js +0 -40
  57. package/dist/cjs-browser/common/settings.js +2 -5
  58. package/dist/cjs-browser/common/version.js +6 -0
  59. package/dist/cjs-browser/common/webhook.js +101 -0
  60. package/dist/cjs-browser/jobs/executions.js +119 -0
  61. package/dist/cjs-browser/jobs/jobs.js +2 -2
  62. package/dist/cjs-browser/jobs/start.js +1 -32
  63. package/dist/cjs-browser/sandbox/action.js +2 -1
  64. package/dist/cjs-browser/sandbox/index.js +1 -0
  65. package/dist/cjs-browser/sandbox/interpreter.js +400 -0
  66. package/dist/cjs-browser/sandbox/sandbox.js +10 -67
  67. package/dist/cjs-browser/tools/mcpTool.js +2 -6
  68. package/dist/cjs-browser/types/client/responseInterceptor.d.ts +12 -0
  69. package/dist/cjs-browser/types/client/sdk.gen.d.ts +41 -1
  70. package/dist/cjs-browser/types/client/types.gen.d.ts +599 -16
  71. package/dist/cjs-browser/types/common/internal.d.ts +0 -2
  72. package/dist/cjs-browser/types/common/settings.d.ts +0 -1
  73. package/dist/cjs-browser/types/common/version.d.ts +2 -0
  74. package/dist/cjs-browser/types/common/webhook.d.ts +89 -0
  75. package/dist/cjs-browser/types/jobs/executions.d.ts +42 -0
  76. package/dist/cjs-browser/types/sandbox/client/sdk.gen.d.ts +1 -1
  77. package/dist/cjs-browser/types/sandbox/index.d.ts +1 -0
  78. package/dist/cjs-browser/types/sandbox/interpreter.d.ts +71 -0
  79. package/dist/cjs-browser/types/sandbox/sandbox.d.ts +6 -12
  80. package/dist/cjs-browser/types/sandbox/types.d.ts +0 -3
  81. package/dist/client/authentication.d.ts +25 -0
  82. package/dist/client/authentication.js +15 -0
  83. package/dist/client/client.d.ts +2 -0
  84. package/dist/client/client.gen.d.ts +12 -0
  85. package/dist/client/client.gen.js +8 -0
  86. package/dist/{cjs/sandbox/websocket/index.js → client/client.js} +1 -1
  87. package/dist/client/index.d.ts +2 -0
  88. package/dist/client/index.js +19 -0
  89. package/dist/client/interceptors.d.ts +3 -0
  90. package/dist/client/interceptors.js +17 -0
  91. package/dist/client/sdk.gen.d.ts +499 -0
  92. package/dist/client/sdk.gen.js +1751 -0
  93. package/dist/client/types.gen.d.ts +4546 -0
  94. package/dist/client/types.gen.js +4 -0
  95. package/dist/common/autoload.d.ts +3 -0
  96. package/dist/common/autoload.js +27 -0
  97. package/dist/common/env.d.ts +5 -0
  98. package/dist/common/env.js +42 -0
  99. package/dist/common/errors.d.ts +1 -0
  100. package/dist/common/errors.js +17 -0
  101. package/dist/common/internal.d.ts +4 -0
  102. package/dist/common/internal.js +188 -0
  103. package/dist/common/internal.test.d.ts +1 -0
  104. package/dist/common/internal.test.js +39 -0
  105. package/dist/common/logger.d.ts +25 -0
  106. package/dist/common/logger.js +69 -0
  107. package/dist/common/node.d.ts +5 -0
  108. package/dist/common/node.js +26 -0
  109. package/dist/common/settings.d.ts +31 -0
  110. package/dist/common/settings.js +170 -0
  111. package/dist/esm/.tsbuildinfo +1 -1
  112. package/dist/esm/agents/index.js +3 -3
  113. package/dist/esm/authentication/clientcredentials.js +1 -4
  114. package/dist/esm/client/responseInterceptor.js +49 -0
  115. package/dist/esm/client/sdk.gen.js +132 -0
  116. package/dist/esm/common/autoload.js +7 -0
  117. package/dist/esm/common/env.js +3 -0
  118. package/dist/esm/common/internal.js +0 -38
  119. package/dist/esm/common/settings.js +2 -5
  120. package/dist/esm/common/version.js +3 -0
  121. package/dist/esm/common/webhook.js +97 -0
  122. package/dist/esm/jobs/executions.js +114 -0
  123. package/dist/esm/jobs/jobs.js +3 -3
  124. package/dist/esm/jobs/start.js +1 -32
  125. package/dist/esm/sandbox/action.js +3 -2
  126. package/dist/esm/sandbox/index.js +1 -0
  127. package/dist/esm/sandbox/interpreter.js +396 -0
  128. package/dist/esm/sandbox/sandbox.js +10 -67
  129. package/dist/esm/tools/mcpTool.js +3 -7
  130. package/dist/esm-browser/.tsbuildinfo +1 -1
  131. package/dist/esm-browser/agents/index.js +3 -3
  132. package/dist/esm-browser/authentication/clientcredentials.js +1 -4
  133. package/dist/esm-browser/client/responseInterceptor.js +49 -0
  134. package/dist/esm-browser/client/sdk.gen.js +132 -0
  135. package/dist/esm-browser/common/autoload.js +7 -0
  136. package/dist/esm-browser/common/env.js +3 -0
  137. package/dist/esm-browser/common/internal.js +0 -38
  138. package/dist/esm-browser/common/settings.js +2 -5
  139. package/dist/esm-browser/common/version.js +3 -0
  140. package/dist/esm-browser/common/webhook.js +97 -0
  141. package/dist/esm-browser/jobs/executions.js +114 -0
  142. package/dist/esm-browser/jobs/jobs.js +3 -3
  143. package/dist/esm-browser/jobs/start.js +1 -32
  144. package/dist/esm-browser/sandbox/action.js +3 -2
  145. package/dist/esm-browser/sandbox/index.js +1 -0
  146. package/dist/esm-browser/sandbox/interpreter.js +396 -0
  147. package/dist/esm-browser/sandbox/sandbox.js +10 -67
  148. package/dist/esm-browser/tools/mcpTool.js +3 -7
  149. package/dist/index.browser.test.d.ts +1 -0
  150. package/dist/index.browser.test.js +45 -0
  151. package/dist/index.d.ts +17 -0
  152. package/dist/index.js +33 -0
  153. package/dist/jobs/index.d.ts +3 -0
  154. package/dist/jobs/index.js +19 -0
  155. package/dist/jobs/jobs.d.ts +13 -0
  156. package/dist/jobs/jobs.js +90 -0
  157. package/dist/jobs/start.d.ts +1 -0
  158. package/dist/jobs/start.js +66 -0
  159. package/dist/jobs/types.d.ts +3 -0
  160. package/dist/jobs/types.js +2 -0
  161. package/dist/mcp/client.d.ts +28 -0
  162. package/dist/mcp/client.js +247 -0
  163. package/dist/{cjs-browser/types/sandbox/websocket → mcp}/index.d.ts +1 -0
  164. package/dist/{cjs-browser/sandbox/websocket → mcp}/index.js +1 -0
  165. package/dist/mcp/server.d.ts +24 -0
  166. package/dist/mcp/server.js +213 -0
  167. package/dist/models/index.d.ts +8 -0
  168. package/dist/models/index.js +31 -0
  169. package/dist/sandbox/action.d.ts +19 -0
  170. package/dist/sandbox/action.js +84 -0
  171. package/dist/sandbox/client/client.gen.d.ts +12 -0
  172. package/dist/sandbox/client/client.gen.js +6 -0
  173. package/dist/sandbox/client/index.d.ts +2 -0
  174. package/dist/sandbox/client/index.js +19 -0
  175. package/dist/sandbox/client/sdk.gen.d.ts +101 -0
  176. package/dist/sandbox/client/sdk.gen.js +289 -0
  177. package/dist/sandbox/client/types.gen.d.ts +578 -0
  178. package/dist/sandbox/client/types.gen.js +3 -0
  179. package/dist/{cjs/types/sandbox/filesystem/filesystem-ws.d.ts → sandbox/filesystem/filesystem.d.ts} +6 -18
  180. package/dist/sandbox/filesystem/filesystem.js +276 -0
  181. package/dist/sandbox/filesystem/index.d.ts +2 -0
  182. package/dist/sandbox/filesystem/index.js +18 -0
  183. package/dist/sandbox/filesystem/types.d.ts +15 -0
  184. package/dist/sandbox/filesystem/types.js +2 -0
  185. package/dist/sandbox/index.d.ts +4 -0
  186. package/dist/sandbox/index.js +36 -0
  187. package/dist/sandbox/network/index.d.ts +1 -0
  188. package/dist/sandbox/network/index.js +17 -0
  189. package/dist/sandbox/network/network.d.ts +5 -0
  190. package/dist/sandbox/network/network.js +10 -0
  191. package/dist/sandbox/preview.d.ts +37 -0
  192. package/dist/sandbox/preview.js +148 -0
  193. package/dist/sandbox/process/index.d.ts +1 -0
  194. package/dist/sandbox/process/index.js +17 -0
  195. package/dist/sandbox/process/process.d.ts +24 -0
  196. package/dist/sandbox/process/process.js +189 -0
  197. package/dist/sandbox/sandbox.d.ts +33 -0
  198. package/dist/sandbox/sandbox.js +178 -0
  199. package/dist/sandbox/session.d.ts +27 -0
  200. package/dist/sandbox/session.js +123 -0
  201. package/dist/sandbox/types.d.ts +51 -0
  202. package/dist/sandbox/types.js +81 -0
  203. package/dist/telemetry/telemetry.d.ts +62 -0
  204. package/dist/telemetry/telemetry.js +80 -0
  205. package/dist/tools/index.d.ts +11 -0
  206. package/dist/tools/index.js +52 -0
  207. package/dist/tools/mcpTool.d.ts +28 -0
  208. package/dist/tools/mcpTool.js +218 -0
  209. package/dist/tools/types.d.ts +8 -0
  210. package/dist/tools/types.js +2 -0
  211. package/dist/tools/zodSchema.d.ts +9 -0
  212. package/dist/tools/zodSchema.js +50 -0
  213. package/dist/volume/index.d.ts +23 -0
  214. package/dist/volume/index.js +113 -0
  215. package/package.json +2 -2
  216. package/dist/cjs/sandbox/codegen/codegen-ws.js +0 -30
  217. package/dist/cjs/sandbox/filesystem/filesystem-ws.js +0 -106
  218. package/dist/cjs/sandbox/network/network-ws.js +0 -12
  219. package/dist/cjs/sandbox/process/process-ws.js +0 -139
  220. package/dist/cjs/sandbox/websocket/client.js +0 -269
  221. package/dist/cjs/types/sandbox/codegen/codegen-ws.d.ts +0 -10
  222. package/dist/cjs/types/sandbox/network/network-ws.d.ts +0 -7
  223. package/dist/cjs/types/sandbox/process/process-ws.d.ts +0 -27
  224. package/dist/cjs/types/sandbox/websocket/client.d.ts +0 -48
  225. package/dist/cjs/types/sandbox/websocket/index.d.ts +0 -1
  226. package/dist/cjs-browser/sandbox/codegen/codegen-ws.js +0 -30
  227. package/dist/cjs-browser/sandbox/filesystem/filesystem-ws.js +0 -106
  228. package/dist/cjs-browser/sandbox/network/network-ws.js +0 -12
  229. package/dist/cjs-browser/sandbox/process/process-ws.js +0 -139
  230. package/dist/cjs-browser/sandbox/websocket/client.js +0 -269
  231. package/dist/cjs-browser/types/sandbox/codegen/codegen-ws.d.ts +0 -10
  232. package/dist/cjs-browser/types/sandbox/filesystem/filesystem-ws.d.ts +0 -35
  233. package/dist/cjs-browser/types/sandbox/network/network-ws.d.ts +0 -7
  234. package/dist/cjs-browser/types/sandbox/process/process-ws.d.ts +0 -27
  235. package/dist/cjs-browser/types/sandbox/websocket/client.d.ts +0 -48
  236. package/dist/esm/sandbox/codegen/codegen-ws.js +0 -26
  237. package/dist/esm/sandbox/filesystem/filesystem-ws.js +0 -102
  238. package/dist/esm/sandbox/network/network-ws.js +0 -8
  239. package/dist/esm/sandbox/process/process-ws.js +0 -135
  240. package/dist/esm/sandbox/websocket/client.js +0 -265
  241. package/dist/esm/sandbox/websocket/index.js +0 -1
  242. package/dist/esm-browser/sandbox/codegen/codegen-ws.js +0 -26
  243. package/dist/esm-browser/sandbox/filesystem/filesystem-ws.js +0 -102
  244. package/dist/esm-browser/sandbox/network/network-ws.js +0 -8
  245. package/dist/esm-browser/sandbox/process/process-ws.js +0 -135
  246. package/dist/esm-browser/sandbox/websocket/client.js +0 -265
  247. package/dist/esm-browser/sandbox/websocket/index.js +0 -1
@@ -2,5 +2,3 @@ export declare function getAlphanumericLimitedHash(input: string, maxSize?: numb
2
2
  export declare function getGlobalUniqueHash(workspace: string, type: string, name: string): string;
3
3
  export declare function pluralize(type: string): string;
4
4
  export declare function getForcedUrl(type: string, name: string): import("url").URL | null;
5
- export declare function getWorkloadTypeShort(type: string): string;
6
- export declare function generateInternalUrl(workspace: string, type: string, name: string, env: string, protocol: string, hostname: string, blCloud: boolean, workspaceId: string): string;
@@ -23,7 +23,6 @@ declare class Settings {
23
23
  get runInternalHostname(): string;
24
24
  get runInternalProtocol(): string;
25
25
  get blCloud(): boolean;
26
- get workspaceId(): string;
27
26
  get generation(): string;
28
27
  get loggerType(): string;
29
28
  authenticate(): Promise<void>;
@@ -0,0 +1,2 @@
1
+ export declare const PACKAGE_VERSION = "0.2.49";
2
+ export declare const PACKAGE_COMMIT = "4548518514109c742457451a6eb36fa8d054eb9b";
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Webhook signature verification for async-sidecar callbacks
3
+ */
4
+ export interface WebhookVerificationOptions {
5
+ /**
6
+ * The raw request body as a string
7
+ */
8
+ body: string;
9
+ /**
10
+ * The X-Blaxel-Signature header value (format: "sha256=<hex_digest>")
11
+ */
12
+ signature: string;
13
+ /**
14
+ * The secret key used to sign the webhook (same as CALLBACK_SECRET in async-sidecar)
15
+ */
16
+ secret: string;
17
+ /**
18
+ * Optional: The X-Blaxel-Timestamp header value for replay attack prevention
19
+ */
20
+ timestamp?: string;
21
+ /**
22
+ * Optional: Maximum age of the webhook in seconds (default: 300 = 5 minutes)
23
+ */
24
+ maxAge?: number;
25
+ }
26
+ export interface AsyncSidecarCallback {
27
+ status_code: number;
28
+ response_body: string;
29
+ response_length: number;
30
+ timestamp: number;
31
+ }
32
+ /**
33
+ * Verify the HMAC-SHA256 signature of a webhook callback from async-sidecar
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * import { verifyWebhookSignature } from '@blaxel/core';
38
+ *
39
+ * // In your Express endpoint
40
+ * app.post('/webhook', express.text({ type: 'application/json' }), (req, res) => {
41
+ * const isValid = verifyWebhookSignature({
42
+ * body: req.body,
43
+ * signature: req.headers['x-blaxel-signature'] as string,
44
+ * secret: process.env.CALLBACK_SECRET!
45
+ * });
46
+ *
47
+ * if (!isValid) {
48
+ * return res.status(401).json({ error: 'Invalid signature' });
49
+ * }
50
+ *
51
+ * const data = JSON.parse(req.body);
52
+ * // Process callback...
53
+ * });
54
+ * ```
55
+ *
56
+ * @param options - Verification options
57
+ * @returns true if the signature is valid, false otherwise
58
+ */
59
+ export declare function verifyWebhookSignature(options: WebhookVerificationOptions): boolean;
60
+ /**
61
+ * Helper to verify webhook from Express request object
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * import { verifyWebhookFromRequest } from '@blaxel/core';
66
+ * import express from 'express';
67
+ *
68
+ * app.use(express.text({ type: 'application/json' }));
69
+ *
70
+ * app.post('/webhook', (req, res) => {
71
+ * if (!verifyWebhookFromRequest(req, process.env.CALLBACK_SECRET!)) {
72
+ * return res.status(401).json({ error: 'Invalid signature' });
73
+ * }
74
+ *
75
+ * const data = JSON.parse(req.body);
76
+ * console.log('Received callback:', data);
77
+ * res.json({ received: true });
78
+ * });
79
+ * ```
80
+ *
81
+ * @param request - Express request object (must use express.text() middleware)
82
+ * @param secret - The callback secret
83
+ * @param maxAge - Optional maximum age in seconds (default: 300)
84
+ * @returns true if the signature is valid, false otherwise
85
+ */
86
+ export declare function verifyWebhookFromRequest(request: {
87
+ body: string;
88
+ headers: Record<string, string | string[] | undefined>;
89
+ }, secret: string, maxAge?: number): boolean;
@@ -0,0 +1,42 @@
1
+ import type { CreateJobExecutionRequest, JobExecution } from "../client/types.gen.js";
2
+ /**
3
+ * JobExecutionHelper provides convenient methods for working with job executions
4
+ */
5
+ export declare class JobExecutionHelper {
6
+ private jobName;
7
+ constructor(jobName: string);
8
+ /**
9
+ * Create a new job execution and return the execution ID
10
+ */
11
+ create(request: CreateJobExecutionRequest): Promise<string>;
12
+ /**
13
+ * Get a specific job execution by ID
14
+ */
15
+ get(executionId: string): Promise<JobExecution>;
16
+ /**
17
+ * List all executions for the job
18
+ */
19
+ list(): Promise<JobExecution[]>;
20
+ /**
21
+ * Get the status of a specific execution
22
+ */
23
+ getStatus(executionId: string): Promise<string>;
24
+ /**
25
+ * Delete a specific job execution
26
+ */
27
+ delete(executionId: string): Promise<void>;
28
+ /**
29
+ * Wait for an execution to complete
30
+ * @param executionId The execution ID to wait for
31
+ * @param options.maxWait Maximum time to wait in milliseconds (default: 5 minutes)
32
+ * @param options.interval Polling interval in milliseconds (default: 2 seconds)
33
+ */
34
+ waitForCompletion(executionId: string, options?: {
35
+ maxWait?: number;
36
+ interval?: number;
37
+ }): Promise<JobExecution>;
38
+ }
39
+ /**
40
+ * Factory function to create a JobExecutionHelper
41
+ */
42
+ export declare const jobExecutions: (jobName: string) => JobExecutionHelper;
@@ -123,7 +123,7 @@ export declare const deleteFilesystemByPath: <ThrowOnError extends boolean = fal
123
123
  * Get file or directory information
124
124
  * Get content of a file or listing of a directory. Use Accept header to control response format for files.
125
125
  */
126
- export declare const getFilesystemByPath: <ThrowOnError extends boolean = false>(options: Options<GetFilesystemByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").File | import("./types.gen").Directory | import("./types.gen").FileWithContent | Blob, import("./types.gen").ErrorResponse, ThrowOnError>;
126
+ export declare const getFilesystemByPath: <ThrowOnError extends boolean = false>(options: Options<GetFilesystemByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").Directory | import("./types.gen").FileWithContent | Blob | import("./types.gen").File, import("./types.gen").ErrorResponse, ThrowOnError>;
127
127
  /**
128
128
  * Create or update a file or directory
129
129
  * Create or update a file or directory
@@ -3,3 +3,4 @@ export * from "./filesystem/index.js";
3
3
  export * from "./codegen/index.js";
4
4
  export * from "./sandbox.js";
5
5
  export * from "./types.js";
6
+ export * from "./interpreter.js";
@@ -0,0 +1,71 @@
1
+ import { Sandbox, SandboxLifecycle, Port } from "../client/types.gen.js";
2
+ import { SandboxInstance } from "./sandbox.js";
3
+ import { SandboxConfiguration, SandboxCreateConfiguration } from "./types.js";
4
+ export declare class CodeInterpreter extends SandboxInstance {
5
+ static readonly DEFAULT_IMAGE = "blaxel/jupyter-server";
6
+ static readonly DEFAULT_PORTS: Port[];
7
+ static readonly DEFAULT_LIFECYCLE: SandboxLifecycle;
8
+ private _sandboxConfig;
9
+ constructor(sandbox: SandboxConfiguration);
10
+ static get(sandboxName: string): Promise<CodeInterpreter>;
11
+ static create(sandbox?: Sandbox | SandboxCreateConfiguration | Record<string, any> | null, { safe }?: {
12
+ safe?: boolean;
13
+ }): Promise<CodeInterpreter>;
14
+ get _jupyterUrl(): string;
15
+ static OutputMessage: {
16
+ new (text: string, timestamp: number | null, isStderr: boolean): {
17
+ text: string;
18
+ timestamp: number | null;
19
+ isStderr: boolean;
20
+ };
21
+ };
22
+ static Result: {
23
+ new (kwargs?: Record<string, unknown>): {
24
+ [key: string]: unknown;
25
+ };
26
+ };
27
+ static ExecutionError: {
28
+ new (name: string, value: any, traceback: any): {
29
+ name: string;
30
+ value: any;
31
+ traceback: any;
32
+ };
33
+ };
34
+ static Logs: {
35
+ new (): {
36
+ stdout: string[];
37
+ stderr: string[];
38
+ };
39
+ };
40
+ static Execution: {
41
+ new (): {
42
+ results: InstanceType<typeof CodeInterpreter.Result>[];
43
+ logs: InstanceType<typeof CodeInterpreter.Logs>;
44
+ error: InstanceType<typeof CodeInterpreter.ExecutionError> | null;
45
+ executionCount: number | null;
46
+ };
47
+ };
48
+ static Context: {
49
+ new (id: string): {
50
+ id: string;
51
+ };
52
+ fromJson(data: Record<string, any>): InstanceType<typeof CodeInterpreter.Context>;
53
+ };
54
+ private _parseOutput;
55
+ runCode(code: string, options?: {
56
+ language?: string | null;
57
+ context?: InstanceType<typeof CodeInterpreter.Context> | null;
58
+ onStdout?: (msg: InstanceType<typeof CodeInterpreter.OutputMessage>) => void;
59
+ onStderr?: (msg: InstanceType<typeof CodeInterpreter.OutputMessage>) => void;
60
+ onResult?: (result: InstanceType<typeof CodeInterpreter.Result>) => void;
61
+ onError?: (error: InstanceType<typeof CodeInterpreter.ExecutionError>) => void;
62
+ envs?: Record<string, string> | null;
63
+ timeout?: number | null;
64
+ requestTimeout?: number | null;
65
+ }): Promise<InstanceType<typeof CodeInterpreter.Execution>>;
66
+ createCodeContext(options?: {
67
+ cwd?: string | null;
68
+ language?: string | null;
69
+ requestTimeout?: number | null;
70
+ }): Promise<InstanceType<typeof CodeInterpreter.Context>>;
71
+ }
@@ -1,24 +1,19 @@
1
1
  import { Sandbox as SandboxModel } from "../client/index.js";
2
2
  import { SandboxFileSystem } from "./filesystem/index.js";
3
- import { SandboxFileSystemWebSocket } from "./filesystem/filesystem-ws.js";
4
3
  import { SandboxNetwork } from "./network/index.js";
5
- import { SandboxNetworkWebSocket } from "./network/network-ws.js";
6
4
  import { SandboxPreviews } from "./preview.js";
7
5
  import { SandboxProcess } from "./process/index.js";
8
- import { SandboxProcessWebSocket } from "./process/process-ws.js";
9
6
  import { SandboxCodegen } from "./codegen/index.js";
10
- import { SandboxCodegenWebSocket } from "./codegen/codegen-ws.js";
11
7
  import { SandboxSessions } from "./session.js";
12
8
  import { SandboxConfiguration, SandboxCreateConfiguration, SandboxUpdateMetadata, SessionWithToken } from "./types.js";
13
9
  export declare class SandboxInstance {
14
10
  private sandbox;
15
- fs: SandboxFileSystem | SandboxFileSystemWebSocket;
16
- network: SandboxNetwork | SandboxNetworkWebSocket;
17
- process: SandboxProcess | SandboxProcessWebSocket;
11
+ fs: SandboxFileSystem;
12
+ network: SandboxNetwork;
13
+ process: SandboxProcess;
18
14
  previews: SandboxPreviews;
19
15
  sessions: SandboxSessions;
20
- codegen: SandboxCodegen | SandboxCodegenWebSocket;
21
- private wsClient?;
16
+ codegen: SandboxCodegen;
22
17
  constructor(sandbox: SandboxConfiguration);
23
18
  get metadata(): import("../client/types.gen.js").Metadata | undefined;
24
19
  get status(): string | undefined;
@@ -28,13 +23,12 @@ export declare class SandboxInstance {
28
23
  maxWait?: number;
29
24
  interval?: number;
30
25
  }): Promise<this>;
31
- closeConnection(): void;
32
26
  static create(sandbox?: SandboxModel | SandboxCreateConfiguration, { safe }?: {
33
27
  safe?: boolean;
34
28
  }): Promise<SandboxInstance>;
35
- static get(sandboxName: string, connectionType?: "http" | "websocket"): Promise<SandboxInstance>;
29
+ static get(sandboxName: string): Promise<SandboxInstance>;
36
30
  static list(): Promise<SandboxInstance[]>;
37
- static delete(sandboxName: string, instance?: SandboxInstance): Promise<SandboxModel>;
31
+ static delete(sandboxName: string): Promise<SandboxModel>;
38
32
  static updateMetadata(sandboxName: string, metadata: SandboxUpdateMetadata): Promise<SandboxInstance>;
39
33
  static createIfNotExists(sandbox: SandboxModel | SandboxCreateConfiguration): Promise<SandboxInstance>;
40
34
  static fromSession(session: SessionWithToken): Promise<SandboxInstance>;
@@ -20,12 +20,10 @@ export interface VolumeBinding {
20
20
  mountPath: string;
21
21
  readOnly?: boolean;
22
22
  }
23
- export type ConnectionType = "http" | "websocket";
24
23
  export type SandboxConfiguration = {
25
24
  forceUrl?: string;
26
25
  headers?: Record<string, string>;
27
26
  params?: Record<string, string>;
28
- connectionType?: ConnectionType;
29
27
  } & Sandbox;
30
28
  export type SandboxUpdateMetadata = {
31
29
  labels?: Record<string, string>;
@@ -43,7 +41,6 @@ export type SandboxCreateConfiguration = {
43
41
  region?: string;
44
42
  lifecycle?: SandboxLifecycle;
45
43
  snapshotEnabled?: boolean;
46
- connectionType?: ConnectionType;
47
44
  };
48
45
  export declare function normalizePorts(ports?: (Port | Record<string, any>)[]): Port[] | undefined;
49
46
  export declare function normalizeEnvs(envs?: EnvVar[]): EnvVar[] | undefined;