@blaxel/core 0.2.46 → 0.2.47-preview.105

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 (47) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/common/settings.js +2 -2
  3. package/dist/cjs/sandbox/client/sdk.gen.js +173 -36
  4. package/dist/cjs/sandbox/codegen/codegen.js +31 -0
  5. package/dist/cjs/sandbox/codegen/index.js +17 -0
  6. package/dist/cjs/sandbox/filesystem/filesystem.js +28 -1
  7. package/dist/cjs/sandbox/index.js +4 -1
  8. package/dist/cjs/sandbox/sandbox.js +4 -1
  9. package/dist/cjs/types/sandbox/client/sdk.gen.d.ts +74 -13
  10. package/dist/cjs/types/sandbox/client/types.gen.d.ts +203 -50
  11. package/dist/cjs/types/sandbox/codegen/codegen.d.ts +8 -0
  12. package/dist/cjs/types/sandbox/codegen/index.d.ts +1 -0
  13. package/dist/cjs/types/sandbox/filesystem/filesystem.d.ts +5 -1
  14. package/dist/cjs/types/sandbox/index.d.ts +2 -1
  15. package/dist/cjs/types/sandbox/sandbox.d.ts +2 -0
  16. package/dist/cjs-browser/.tsbuildinfo +1 -1
  17. package/dist/cjs-browser/common/settings.js +2 -2
  18. package/dist/cjs-browser/sandbox/client/sdk.gen.js +173 -36
  19. package/dist/cjs-browser/sandbox/codegen/codegen.js +31 -0
  20. package/dist/cjs-browser/sandbox/codegen/index.js +17 -0
  21. package/dist/cjs-browser/sandbox/filesystem/filesystem.js +28 -1
  22. package/dist/cjs-browser/sandbox/index.js +4 -1
  23. package/dist/cjs-browser/sandbox/sandbox.js +4 -1
  24. package/dist/cjs-browser/types/sandbox/client/sdk.gen.d.ts +74 -13
  25. package/dist/cjs-browser/types/sandbox/client/types.gen.d.ts +203 -50
  26. package/dist/cjs-browser/types/sandbox/codegen/codegen.d.ts +8 -0
  27. package/dist/cjs-browser/types/sandbox/codegen/index.d.ts +1 -0
  28. package/dist/cjs-browser/types/sandbox/filesystem/filesystem.d.ts +5 -1
  29. package/dist/cjs-browser/types/sandbox/index.d.ts +2 -1
  30. package/dist/cjs-browser/types/sandbox/sandbox.d.ts +2 -0
  31. package/dist/esm/.tsbuildinfo +1 -1
  32. package/dist/esm/common/settings.js +2 -2
  33. package/dist/esm/sandbox/client/sdk.gen.js +164 -33
  34. package/dist/esm/sandbox/codegen/codegen.js +27 -0
  35. package/dist/esm/sandbox/codegen/index.js +1 -0
  36. package/dist/esm/sandbox/filesystem/filesystem.js +28 -1
  37. package/dist/esm/sandbox/index.js +2 -1
  38. package/dist/esm/sandbox/sandbox.js +4 -1
  39. package/dist/esm-browser/.tsbuildinfo +1 -1
  40. package/dist/esm-browser/common/settings.js +2 -2
  41. package/dist/esm-browser/sandbox/client/sdk.gen.js +164 -33
  42. package/dist/esm-browser/sandbox/codegen/codegen.js +27 -0
  43. package/dist/esm-browser/sandbox/codegen/index.js +1 -0
  44. package/dist/esm-browser/sandbox/filesystem/filesystem.js +28 -1
  45. package/dist/esm-browser/sandbox/index.js +2 -1
  46. package/dist/esm-browser/sandbox/sandbox.js +4 -1
  47. package/package.json +2 -2
@@ -1,3 +1,15 @@
1
+ export type ApplyEditRequest = {
2
+ codeEdit: string;
3
+ model?: string;
4
+ };
5
+ export type ApplyEditResponse = {
6
+ message?: string;
7
+ originalContent?: string;
8
+ path?: string;
9
+ provider?: string;
10
+ success?: boolean;
11
+ updatedContent?: string;
12
+ };
1
13
  export type Directory = {
2
14
  files: Array<File>;
3
15
  name: string;
@@ -50,7 +62,9 @@ export type ProcessRequest = {
50
62
  env?: {
51
63
  [key: string]: string;
52
64
  };
65
+ maxRestarts?: number;
53
66
  name?: string;
67
+ restartOnFailure?: boolean;
54
68
  timeout?: number;
55
69
  waitForCompletion?: boolean;
56
70
  waitForPorts?: Array<number>;
@@ -61,12 +75,25 @@ export type ProcessResponse = {
61
75
  completedAt: string;
62
76
  exitCode: number;
63
77
  logs: string;
78
+ maxRestarts: number;
64
79
  name: string;
65
80
  pid: string;
81
+ restartCount: number;
82
+ restartOnFailure: boolean;
66
83
  startedAt: string;
67
84
  status: 'failed' | 'killed' | 'stopped' | 'running' | 'completed';
68
85
  workingDir: string;
69
86
  };
87
+ export type RankedFile = {
88
+ content?: string;
89
+ path?: string;
90
+ score?: number;
91
+ };
92
+ export type RerankingResponse = {
93
+ files?: Array<RankedFile>;
94
+ message?: string;
95
+ success?: boolean;
96
+ };
70
97
  export type Subdirectory = {
71
98
  name: string;
72
99
  path: string;
@@ -75,6 +102,175 @@ export type SuccessResponse = {
75
102
  message: string;
76
103
  path?: string;
77
104
  };
105
+ export type WelcomeResponse = {
106
+ description?: string;
107
+ documentation?: string;
108
+ message?: string;
109
+ };
110
+ export type DeleteData = {
111
+ body?: never;
112
+ path?: never;
113
+ query?: never;
114
+ url: '/';
115
+ };
116
+ export type DeleteResponses = {
117
+ /**
118
+ * OK
119
+ */
120
+ 200: WelcomeResponse;
121
+ };
122
+ export type DeleteResponse = DeleteResponses[keyof DeleteResponses];
123
+ export type GetData = {
124
+ body?: never;
125
+ path?: never;
126
+ query?: never;
127
+ url: '/';
128
+ };
129
+ export type GetResponses = {
130
+ /**
131
+ * OK
132
+ */
133
+ 200: WelcomeResponse;
134
+ };
135
+ export type GetResponse = GetResponses[keyof GetResponses];
136
+ export type OptionsData = {
137
+ body?: never;
138
+ path?: never;
139
+ query?: never;
140
+ url: '/';
141
+ };
142
+ export type OptionsResponses = {
143
+ /**
144
+ * OK
145
+ */
146
+ 200: WelcomeResponse;
147
+ };
148
+ export type OptionsResponse = OptionsResponses[keyof OptionsResponses];
149
+ export type PatchData = {
150
+ body?: never;
151
+ path?: never;
152
+ query?: never;
153
+ url: '/';
154
+ };
155
+ export type PatchResponses = {
156
+ /**
157
+ * OK
158
+ */
159
+ 200: WelcomeResponse;
160
+ };
161
+ export type PatchResponse = PatchResponses[keyof PatchResponses];
162
+ export type PostData = {
163
+ body?: never;
164
+ path?: never;
165
+ query?: never;
166
+ url: '/';
167
+ };
168
+ export type PostResponses = {
169
+ /**
170
+ * OK
171
+ */
172
+ 200: WelcomeResponse;
173
+ };
174
+ export type PostResponse = PostResponses[keyof PostResponses];
175
+ export type PutData = {
176
+ body?: never;
177
+ path?: never;
178
+ query?: never;
179
+ url: '/';
180
+ };
181
+ export type PutResponses = {
182
+ /**
183
+ * OK
184
+ */
185
+ 200: WelcomeResponse;
186
+ };
187
+ export type PutResponse = PutResponses[keyof PutResponses];
188
+ export type PutCodegenFastapplyByPathData = {
189
+ /**
190
+ * Code edit request
191
+ */
192
+ body: ApplyEditRequest;
193
+ path: {
194
+ /**
195
+ * Path to the file to edit (relative to workspace)
196
+ */
197
+ path: string;
198
+ };
199
+ query?: never;
200
+ url: '/codegen/fastapply/{path}';
201
+ };
202
+ export type PutCodegenFastapplyByPathErrors = {
203
+ /**
204
+ * Invalid request
205
+ */
206
+ 400: ErrorResponse;
207
+ /**
208
+ * Unprocessable entity - failed to process the request
209
+ */
210
+ 422: ErrorResponse;
211
+ /**
212
+ * Service unavailable - no provider configured
213
+ */
214
+ 503: ErrorResponse;
215
+ };
216
+ export type PutCodegenFastapplyByPathError = PutCodegenFastapplyByPathErrors[keyof PutCodegenFastapplyByPathErrors];
217
+ export type PutCodegenFastapplyByPathResponses = {
218
+ /**
219
+ * Code edit applied successfully
220
+ */
221
+ 200: ApplyEditResponse;
222
+ };
223
+ export type PutCodegenFastapplyByPathResponse = PutCodegenFastapplyByPathResponses[keyof PutCodegenFastapplyByPathResponses];
224
+ export type GetCodegenRerankingByPathData = {
225
+ body?: never;
226
+ path: {
227
+ /**
228
+ * Path to search in (relative to workspace)
229
+ */
230
+ path: string;
231
+ };
232
+ query: {
233
+ /**
234
+ * Natural language query to search for
235
+ */
236
+ query: string;
237
+ /**
238
+ * Minimum relevance score (default: 0.5)
239
+ */
240
+ scoreThreshold?: number;
241
+ /**
242
+ * Maximum tokens to return (default: 30000)
243
+ */
244
+ tokenLimit?: number;
245
+ /**
246
+ * Regex pattern to filter files (e.g., .*\\.ts$ for TypeScript files)
247
+ */
248
+ filePattern?: string;
249
+ };
250
+ url: '/codegen/reranking/{path}';
251
+ };
252
+ export type GetCodegenRerankingByPathErrors = {
253
+ /**
254
+ * Invalid request
255
+ */
256
+ 400: ErrorResponse;
257
+ /**
258
+ * Unprocessable entity - failed to process the request
259
+ */
260
+ 422: ErrorResponse;
261
+ /**
262
+ * Service unavailable - Relace not configured
263
+ */
264
+ 503: ErrorResponse;
265
+ };
266
+ export type GetCodegenRerankingByPathError = GetCodegenRerankingByPathErrors[keyof GetCodegenRerankingByPathErrors];
267
+ export type GetCodegenRerankingByPathResponses = {
268
+ /**
269
+ * Relevant files found
270
+ */
271
+ 200: RerankingResponse;
272
+ };
273
+ export type GetCodegenRerankingByPathResponse = GetCodegenRerankingByPathResponses[keyof GetCodegenRerankingByPathResponses];
78
274
  export type DeleteFilesystemByPathData = {
79
275
  body?: never;
80
276
  path: {
@@ -121,7 +317,12 @@ export type GetFilesystemByPathData = {
121
317
  */
122
318
  path: string;
123
319
  };
124
- query?: never;
320
+ query?: {
321
+ /**
322
+ * Force download mode for files
323
+ */
324
+ download?: boolean;
325
+ };
125
326
  url: '/filesystem/{path}';
126
327
  };
127
328
  export type GetFilesystemByPathErrors = {
@@ -143,7 +344,7 @@ export type GetFilesystemByPathResponses = {
143
344
  /**
144
345
  * Directory listing
145
346
  */
146
- 200: Directory | FileWithContent;
347
+ 200: Directory | FileWithContent | (Blob | File);
147
348
  };
148
349
  export type GetFilesystemByPathResponse = GetFilesystemByPathResponses[keyof GetFilesystemByPathResponses];
149
350
  export type PutFilesystemByPathData = {
@@ -525,54 +726,6 @@ export type GetWatchFilesystemByPathResponses = {
525
726
  200: string;
526
727
  };
527
728
  export type GetWatchFilesystemByPathResponse = GetWatchFilesystemByPathResponses[keyof GetWatchFilesystemByPathResponses];
528
- export type GetWsProcessByIdentifierLogsStreamData = {
529
- body?: never;
530
- path: {
531
- /**
532
- * Process identifier (PID or name)
533
- */
534
- identifier: string;
535
- };
536
- query?: never;
537
- url: '/ws/process/{identifier}/logs/stream';
538
- };
539
- export type GetWsProcessByIdentifierLogsStreamErrors = {
540
- /**
541
- * Process not found
542
- */
543
- 404: ErrorResponse;
544
- /**
545
- * Unprocessable entity
546
- */
547
- 422: ErrorResponse;
548
- /**
549
- * Internal server error
550
- */
551
- 500: ErrorResponse;
552
- };
553
- export type GetWsProcessByIdentifierLogsStreamError = GetWsProcessByIdentifierLogsStreamErrors[keyof GetWsProcessByIdentifierLogsStreamErrors];
554
- export type GetWsWatchFilesystemByPathData = {
555
- body?: never;
556
- path: {
557
- /**
558
- * Directory path to watch
559
- */
560
- path: string;
561
- };
562
- query?: never;
563
- url: '/ws/watch/filesystem/{path}';
564
- };
565
- export type GetWsWatchFilesystemByPathErrors = {
566
- /**
567
- * Invalid path
568
- */
569
- 400: ErrorResponse;
570
- /**
571
- * Internal server error
572
- */
573
- 500: ErrorResponse;
574
- };
575
- export type GetWsWatchFilesystemByPathError = GetWsWatchFilesystemByPathErrors[keyof GetWsWatchFilesystemByPathErrors];
576
729
  export type ClientOptions = {
577
730
  baseUrl: 'https://run.blaxel.ai/{workspace_id}/sandboxes/{sandbox_id}' | (string & {});
578
731
  };
@@ -0,0 +1,8 @@
1
+ import { Sandbox } from "../../client/types.gen.js";
2
+ import { SandboxAction } from "../action.js";
3
+ import { ApplyEditResponse, RerankingResponse } from "../client/types.gen.js";
4
+ export declare class SandboxCodegen extends SandboxAction {
5
+ constructor(sandbox: Sandbox);
6
+ fastapply(path: string, codeEdit: string, model?: string): Promise<ApplyEditResponse>;
7
+ reranking(path: string, query: string, scoreThreshold?: number, tokenLimit?: number, filePattern?: string): Promise<RerankingResponse>;
8
+ }
@@ -0,0 +1 @@
1
+ export * from "./codegen.js";
@@ -8,9 +8,13 @@ export declare class SandboxFileSystem extends SandboxAction {
8
8
  constructor(sandbox: Sandbox, process: SandboxProcess);
9
9
  mkdir(path: string, permissions?: string): Promise<SuccessResponse>;
10
10
  write(path: string, content: string): Promise<SuccessResponse>;
11
- writeBinary(path: string, content: Buffer | Blob | File | Uint8Array): Promise<unknown>;
11
+ writeBinary(path: string, content: Buffer | Blob | File | Uint8Array | string): Promise<unknown>;
12
12
  writeTree(files: SandboxFilesystemFile[], destinationPath?: string | null): Promise<Directory | undefined>;
13
13
  read(path: string): Promise<string>;
14
+ readBinary(path: string): Promise<Blob>;
15
+ download(src: string, destinationPath: string, { mode }?: {
16
+ mode?: number;
17
+ }): Promise<void>;
14
18
  rm(path: string, recursive?: boolean): Promise<SuccessResponse>;
15
19
  ls(path: string): Promise<Directory>;
16
20
  cp(source: string, destination: string, { maxWait }?: {
@@ -1,4 +1,5 @@
1
- export { deleteFilesystemByPath, deleteNetworkProcessByPidMonitor, deleteProcessByIdentifier, deleteProcessByIdentifierKill, Directory, ErrorResponse, File, FileRequest, FileWithContent, getFilesystemByPath, getNetworkProcessByPidPorts, getProcess, getProcessByIdentifier, getProcessByIdentifierLogs, getProcessByIdentifierLogsStream, PortMonitorRequest, postNetworkProcessByPidMonitor, postProcess, ProcessRequest, ProcessResponse, putFilesystemByPath, SuccessResponse } from "./client/index.js";
1
+ export { deleteFilesystemByPath, deleteNetworkProcessByPidMonitor, deleteProcessByIdentifier, deleteProcessByIdentifierKill, Directory, ErrorResponse, File, FileRequest, FileWithContent, getFilesystemByPath, getNetworkProcessByPidPorts, putCodegenFastapplyByPath, ApplyEditResponse, ApplyEditRequest, getCodegenRerankingByPath, RerankingResponse, getProcess, getProcessByIdentifier, getProcessByIdentifierLogs, getProcessByIdentifierLogsStream, PortMonitorRequest, postNetworkProcessByPidMonitor, postProcess, ProcessRequest, ProcessResponse, putFilesystemByPath, SuccessResponse } from "./client/index.js";
2
2
  export * from "./filesystem/index.js";
3
+ export * from "./codegen/index.js";
3
4
  export * from "./sandbox.js";
4
5
  export * from "./types.js";
@@ -3,6 +3,7 @@ import { SandboxFileSystem } from "./filesystem/index.js";
3
3
  import { SandboxNetwork } from "./network/index.js";
4
4
  import { SandboxPreviews } from "./preview.js";
5
5
  import { SandboxProcess } from "./process/index.js";
6
+ import { SandboxCodegen } from "./codegen/index.js";
6
7
  import { SandboxSessions } from "./session.js";
7
8
  import { SandboxConfiguration, SandboxCreateConfiguration, SandboxUpdateMetadata, SessionWithToken } from "./types.js";
8
9
  export declare class SandboxInstance {
@@ -12,6 +13,7 @@ export declare class SandboxInstance {
12
13
  process: SandboxProcess;
13
14
  previews: SandboxPreviews;
14
15
  sessions: SandboxSessions;
16
+ codegen: SandboxCodegen;
15
17
  constructor(sandbox: SandboxConfiguration);
16
18
  get metadata(): import("../client/types.gen.js").Metadata | undefined;
17
19
  get status(): string | undefined;