@blaxel/core 0.2.51 → 0.2.52-dev.9

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 (43) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/common/autoload.js +3 -0
  3. package/dist/cjs/common/sentry.js +219 -0
  4. package/dist/cjs/common/settings.js +13 -47
  5. package/dist/cjs/common/version.js +6 -0
  6. package/dist/cjs/sandbox/client/sdk.gen.js +124 -1
  7. package/dist/cjs/sandbox/filesystem/filesystem.js +81 -1
  8. package/dist/cjs/types/common/sentry.d.ts +17 -0
  9. package/dist/cjs/types/common/settings.d.ts +2 -1
  10. package/dist/cjs/types/common/version.d.ts +2 -0
  11. package/dist/cjs/types/sandbox/client/sdk.gen.d.ts +36 -1
  12. package/dist/cjs/types/sandbox/client/types.gen.d.ts +315 -0
  13. package/dist/cjs/types/sandbox/filesystem/filesystem.d.ts +5 -2
  14. package/dist/cjs/types/sandbox/filesystem/types.d.ts +20 -0
  15. package/dist/cjs-browser/.tsbuildinfo +1 -1
  16. package/dist/cjs-browser/common/autoload.js +3 -0
  17. package/dist/cjs-browser/common/sentry.js +219 -0
  18. package/dist/cjs-browser/common/settings.js +13 -47
  19. package/dist/cjs-browser/common/version.js +6 -0
  20. package/dist/cjs-browser/sandbox/client/sdk.gen.js +124 -1
  21. package/dist/cjs-browser/sandbox/filesystem/filesystem.js +81 -1
  22. package/dist/cjs-browser/types/common/sentry.d.ts +17 -0
  23. package/dist/cjs-browser/types/common/settings.d.ts +2 -1
  24. package/dist/cjs-browser/types/common/version.d.ts +2 -0
  25. package/dist/cjs-browser/types/sandbox/client/sdk.gen.d.ts +36 -1
  26. package/dist/cjs-browser/types/sandbox/client/types.gen.d.ts +315 -0
  27. package/dist/cjs-browser/types/sandbox/filesystem/filesystem.d.ts +5 -2
  28. package/dist/cjs-browser/types/sandbox/filesystem/types.d.ts +20 -0
  29. package/dist/esm/.tsbuildinfo +1 -1
  30. package/dist/esm/common/autoload.js +3 -0
  31. package/dist/esm/common/sentry.js +181 -0
  32. package/dist/esm/common/settings.js +13 -47
  33. package/dist/esm/common/version.js +3 -0
  34. package/dist/esm/sandbox/client/sdk.gen.js +116 -0
  35. package/dist/esm/sandbox/filesystem/filesystem.js +82 -2
  36. package/dist/esm-browser/.tsbuildinfo +1 -1
  37. package/dist/esm-browser/common/autoload.js +3 -0
  38. package/dist/esm-browser/common/sentry.js +181 -0
  39. package/dist/esm-browser/common/settings.js +13 -47
  40. package/dist/esm-browser/common/version.js +3 -0
  41. package/dist/esm-browser/sandbox/client/sdk.gen.js +116 -0
  42. package/dist/esm-browser/sandbox/filesystem/filesystem.js +82 -2
  43. package/package.json +4 -5
@@ -6,6 +6,7 @@ const client_gen_js_1 = require("../client/client.gen.js");
6
6
  const interceptors_js_1 = require("../client/interceptors.js");
7
7
  const responseInterceptor_js_1 = require("../client/responseInterceptor.js");
8
8
  const client_gen_js_2 = require("../sandbox/client/client.gen.js");
9
+ const sentry_js_1 = require("./sentry.js");
9
10
  const settings_js_1 = require("./settings.js");
10
11
  client_gen_js_1.client.setConfig({
11
12
  baseUrl: settings_js_1.settings.baseUrl,
@@ -22,6 +23,8 @@ for (const interceptor of responseInterceptor_js_1.responseInterceptors) {
22
23
  client_gen_js_1.client.interceptors.response.use(interceptor);
23
24
  client_gen_js_2.client.interceptors.response.use(interceptor);
24
25
  }
26
+ // Initialize Sentry for SDK error tracking immediately when module loads
27
+ (0, sentry_js_1.initSentry)();
25
28
  // Allow to set custom configuration for browser environment
26
29
  function initialize(config) {
27
30
  settings_js_1.settings.setConfig(config);
@@ -0,0 +1,219 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.initSentry = initSentry;
37
+ exports.flushSentry = flushSentry;
38
+ exports.isSentryInitialized = isSentryInitialized;
39
+ const settings_js_1 = require("./settings.js");
40
+ const Sentry = __importStar(require("@sentry/node"));
41
+ const node_1 = require("@sentry/node");
42
+ // Isolated Sentry client for SDK-only error tracking (doesn't interfere with user's Sentry)
43
+ let sentryClient = null;
44
+ const capturedExceptions = new Set();
45
+ let handlersRegistered = false;
46
+ // SDK path patterns to identify errors originating from our SDK
47
+ const SDK_PATTERNS = [
48
+ "@blaxel/",
49
+ "blaxel-sdk",
50
+ "/node_modules/@blaxel/",
51
+ "/@blaxel/core/",
52
+ "/@blaxel/telemetry/",
53
+ ];
54
+ /**
55
+ * Check if an error originated from the SDK based on its stack trace.
56
+ * Returns true if the stack trace contains any SDK-related paths.
57
+ */
58
+ function isFromSDK(error) {
59
+ const stack = error.stack || "";
60
+ return SDK_PATTERNS.some((pattern) => stack.includes(pattern));
61
+ }
62
+ /**
63
+ * Initialize an isolated Sentry client for SDK error tracking.
64
+ * This creates a separate Sentry instance that won't interfere with any
65
+ * Sentry configuration the user might have in their application.
66
+ */
67
+ function initSentry() {
68
+ try {
69
+ const dsn = settings_js_1.settings.sentryDsn;
70
+ if (!dsn) {
71
+ return;
72
+ }
73
+ // Create an isolated Sentry client that doesn't touch the global scope
74
+ // This allows users to have their own Sentry.init() without conflicts
75
+ sentryClient = new Sentry.NodeClient({
76
+ dsn,
77
+ environment: settings_js_1.settings.env,
78
+ release: `sdk-typescript@${settings_js_1.settings.version}`,
79
+ transport: node_1.makeNodeTransport,
80
+ stackParser: Sentry.defaultStackParser,
81
+ // No integrations - we handle error capturing manually
82
+ integrations: [],
83
+ // Disable traces for the SDK client
84
+ tracesSampleRate: 0,
85
+ // Filter errors before sending - only send SDK errors
86
+ beforeSend(event, hint) {
87
+ const error = hint.originalException;
88
+ if (error instanceof Error) {
89
+ if (!isFromSDK(error)) {
90
+ // Drop errors that don't originate from SDK
91
+ return null;
92
+ }
93
+ }
94
+ return event;
95
+ },
96
+ });
97
+ sentryClient.init();
98
+ // Set SDK-specific tags
99
+ const scope = new Sentry.Scope();
100
+ scope.setTag("blaxel.workspace", settings_js_1.settings.workspace);
101
+ scope.setTag("blaxel.version", settings_js_1.settings.version);
102
+ scope.setTag("blaxel.commit", settings_js_1.settings.commit);
103
+ scope.setClient(sentryClient);
104
+ // Register process handlers for uncaught errors (Node.js only)
105
+ // Only register once to prevent memory leaks
106
+ if (typeof process !== "undefined" &&
107
+ typeof process.on === "function" &&
108
+ !handlersRegistered) {
109
+ handlersRegistered = true;
110
+ // For SIGTERM/SIGINT, flush before exit
111
+ const signalHandler = (signal) => {
112
+ flushSentry(500)
113
+ .catch(() => {
114
+ // Silently fail
115
+ })
116
+ .finally(() => {
117
+ process.exit(signal === "SIGTERM" ? 143 : 130);
118
+ });
119
+ };
120
+ // Uncaught exception handler - only capture SDK errors
121
+ const uncaughtExceptionHandler = (error) => {
122
+ if (isFromSDK(error)) {
123
+ captureException(error);
124
+ }
125
+ // Let the default Node.js behavior handle the process exit
126
+ };
127
+ // Unhandled rejection handler - only capture SDK errors
128
+ const unhandledRejectionHandler = (reason) => {
129
+ const error = reason instanceof Error ? reason : new Error(String(reason));
130
+ if (isFromSDK(error)) {
131
+ captureException(error);
132
+ }
133
+ };
134
+ process.on("SIGTERM", () => signalHandler("SIGTERM"));
135
+ process.on("SIGINT", () => signalHandler("SIGINT"));
136
+ process.on("uncaughtException", uncaughtExceptionHandler);
137
+ process.on("unhandledRejection", unhandledRejectionHandler);
138
+ // Intercept console.error to capture SDK errors that are caught and logged
139
+ const originalConsoleError = console.error;
140
+ console.error = function (...args) {
141
+ // Call the original console.error first
142
+ originalConsoleError.apply(console, args);
143
+ // Check if any argument is an Error from SDK and capture it
144
+ for (const arg of args) {
145
+ if (arg instanceof Error && isFromSDK(arg)) {
146
+ captureException(arg);
147
+ break; // Only capture the first SDK error to avoid duplicates
148
+ }
149
+ }
150
+ };
151
+ }
152
+ }
153
+ catch (error) {
154
+ // Silently fail - Sentry initialization should never break the SDK
155
+ if (settings_js_1.settings.env !== "production") {
156
+ console.error("[Blaxel SDK] Error initializing Sentry:", error);
157
+ }
158
+ }
159
+ }
160
+ /**
161
+ * Capture an exception to the SDK's isolated Sentry client.
162
+ * Only errors originating from SDK code will be captured.
163
+ *
164
+ * @param error - The error to capture
165
+ */
166
+ function captureException(error) {
167
+ if (sentryClient === null) {
168
+ return;
169
+ }
170
+ // Double-check that error is from SDK (defense in depth)
171
+ if (!isFromSDK(error)) {
172
+ return;
173
+ }
174
+ try {
175
+ // Create a unique identifier for this exception to avoid duplicates
176
+ const errorKey = `${error.name}:${error.message}:${error.stack?.slice(0, 200)}`;
177
+ if (capturedExceptions.has(errorKey)) {
178
+ return;
179
+ }
180
+ capturedExceptions.add(errorKey);
181
+ // Clean up old exception keys to prevent memory leak
182
+ if (capturedExceptions.size > 1000) {
183
+ capturedExceptions.clear();
184
+ }
185
+ // Create a scope with SDK tags and capture the exception
186
+ const scope = new Sentry.Scope();
187
+ scope.setTag("blaxel.workspace", settings_js_1.settings.workspace);
188
+ scope.setTag("blaxel.version", settings_js_1.settings.version);
189
+ scope.setTag("blaxel.commit", settings_js_1.settings.commit);
190
+ scope.setClient(sentryClient);
191
+ scope.captureException(error);
192
+ }
193
+ catch {
194
+ // Silently fail - error capturing should never break the SDK
195
+ }
196
+ }
197
+ /**
198
+ * Flush pending Sentry events.
199
+ * This should be called before the process exits to ensure all events are sent.
200
+ *
201
+ * @param timeout - Maximum time in milliseconds to wait for flush (default: 2000)
202
+ */
203
+ async function flushSentry(timeout = 2000) {
204
+ if (sentryClient === null) {
205
+ return;
206
+ }
207
+ try {
208
+ await sentryClient.flush(timeout);
209
+ }
210
+ catch {
211
+ // Silently fail
212
+ }
213
+ }
214
+ /**
215
+ * Check if Sentry is initialized and available.
216
+ */
217
+ function isSentryInitialized() {
218
+ return sentryClient !== null;
219
+ }
@@ -3,26 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.settings = void 0;
4
4
  const index_js_1 = require("../authentication/index.js");
5
5
  const env_js_1 = require("../common/env.js");
6
- // Function to get package version
7
- function getPackageVersion() {
8
- try {
9
- // Check if require is available (CommonJS environment)
10
- if (typeof require !== "undefined") {
11
- // Try to require package.json (Node.js only, gracefully fails in browser)
12
- // eslint-disable-next-line @typescript-eslint/no-require-imports
13
- const packageJson = {"version":"0.2.51","commit":"3853140a51897f5f5d076412f419c105d7f968ab"};
14
- return packageJson.version || "unknown";
15
- }
16
- else {
17
- // ESM environment - return unknown
18
- return "unknown";
19
- }
20
- }
21
- catch {
22
- // Fallback for browser environments or if require fails
23
- return "unknown";
24
- }
25
- }
6
+ // Build info - these placeholders are replaced at build time by build:replace-imports
7
+ const BUILD_VERSION = "0.2.52-dev.9";
8
+ const BUILD_COMMIT = "106270f8890bd85e35e0f6b3f9701c0c6ad9b3cf";
9
+ const BUILD_SENTRY_DSN = "https://fd5e60e1c9820e1eef5ccebb84a07127@o4508714045276160.ingest.us.sentry.io/4510465864564736";
26
10
  // Function to get OS and architecture
27
11
  function getOsArch() {
28
12
  try {
@@ -55,30 +39,9 @@ function getOsArch() {
55
39
  }
56
40
  return "browser/unknown";
57
41
  }
58
- // Function to get commit hash
59
- function getCommitHash() {
60
- try {
61
- // Check if require is available (CommonJS environment)
62
- if (typeof require !== "undefined") {
63
- // Try to require package.json and look for commit field (set during build)
64
- // eslint-disable-next-line @typescript-eslint/no-require-imports
65
- const packageJson = {"version":"0.2.51","commit":"3853140a51897f5f5d076412f419c105d7f968ab"};
66
- // Check for commit in various possible locations
67
- const commit = packageJson.commit || packageJson.buildInfo?.commit;
68
- if (commit) {
69
- return commit.length > 7 ? commit.substring(0, 7) : commit;
70
- }
71
- }
72
- }
73
- catch {
74
- // Fallback for browser environments or if require fails
75
- }
76
- return "unknown";
77
- }
78
42
  class Settings {
79
43
  credentials;
80
44
  config;
81
- _version = null;
82
45
  constructor() {
83
46
  this.credentials = (0, index_js_1.authentication)();
84
47
  this.config = {
@@ -133,18 +96,21 @@ class Settings {
133
96
  return this.credentials.token;
134
97
  }
135
98
  get version() {
136
- if (this._version === null) {
137
- this._version = getPackageVersion();
138
- }
139
- return this._version;
99
+ return BUILD_VERSION || "unknown";
100
+ }
101
+ get commit() {
102
+ const commit = BUILD_COMMIT || "unknown";
103
+ return commit.length > 7 ? commit.substring(0, 7) : commit;
104
+ }
105
+ get sentryDsn() {
106
+ return BUILD_SENTRY_DSN || "";
140
107
  }
141
108
  get headers() {
142
109
  const osArch = getOsArch();
143
- const commitHash = getCommitHash();
144
110
  return {
145
111
  "x-blaxel-authorization": this.authorization,
146
112
  "x-blaxel-workspace": this.workspace || "",
147
- "User-Agent": `blaxel/sdk/typescript/${this.version} (${osArch}) blaxel/${commitHash}`,
113
+ "User-Agent": `blaxel/sdk/typescript/${this.version} (${osArch}) blaxel/${this.commit}`,
148
114
  };
149
115
  }
150
116
  get name() {
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PACKAGE_COMMIT = exports.PACKAGE_VERSION = void 0;
4
+ // This file is auto-generated during build. Do not edit manually.
5
+ exports.PACKAGE_VERSION = "0.2.50";
6
+ exports.PACKAGE_COMMIT = "4a74989dcb65a6ff8d826aed7976436c64554f6a";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // This file is auto-generated by @hey-api/openapi-ts
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getWatchFilesystemByPath = exports.getProcessByIdentifierLogsStream = exports.getProcessByIdentifierLogs = exports.deleteProcessByIdentifierKill = exports.getProcessByIdentifier = exports.deleteProcessByIdentifier = exports.postProcess = exports.getProcess = exports.getNetworkProcessByPidPorts = exports.postNetworkProcessByPidMonitor = exports.deleteNetworkProcessByPidMonitor = exports.putFilesystemByPath = exports.getFilesystemByPath = exports.deleteFilesystemByPath = exports.postFilesystemMultipartInitiateByPath = exports.getFilesystemMultipartByUploadIdParts = exports.putFilesystemMultipartByUploadIdPart = exports.postFilesystemMultipartByUploadIdComplete = exports.deleteFilesystemMultipartByUploadIdAbort = exports.getFilesystemMultipart = exports.getCodegenRerankingByPath = exports.putCodegenFastapplyByPath = exports.put = exports.post = exports.patch = exports.options = exports.get = exports.delete_ = void 0;
4
+ exports.getWs = exports.getWatchFilesystemByPath = exports.getProcessByIdentifierLogsStream = exports.getProcessByIdentifierLogs = exports.deleteProcessByIdentifierKill = exports.getProcessByIdentifier = exports.deleteProcessByIdentifier = exports.postProcess = exports.getProcess = exports.getNetworkProcessByPidPorts = exports.postNetworkProcessByPidMonitor = exports.deleteNetworkProcessByPidMonitor = exports.putFilesystemTreeByPath = exports.getFilesystemTreeByPath = exports.deleteFilesystemTreeByPath = exports.putFilesystemByPath = exports.getFilesystemByPath = exports.deleteFilesystemByPath = exports.getFilesystemSearchByPath = exports.postFilesystemMultipartInitiateByPath = exports.getFilesystemMultipartByUploadIdParts = exports.putFilesystemMultipartByUploadIdPart = exports.postFilesystemMultipartByUploadIdComplete = exports.deleteFilesystemMultipartByUploadIdAbort = exports.getFilesystemMultipart = exports.getFilesystemFindByPath = exports.getFilesystemContentSearchByPath = exports.getCodegenRerankingByPath = exports.putCodegenFastapplyByPath = exports.put = exports.post = exports.patch = exports.options = exports.get = exports.delete_ = void 0;
5
5
  const client_fetch_1 = require("@hey-api/client-fetch");
6
6
  const client_gen_1 = require("./client.gen");
7
7
  /**
@@ -175,6 +175,40 @@ const getCodegenRerankingByPath = (options) => {
175
175
  });
176
176
  };
177
177
  exports.getCodegenRerankingByPath = getCodegenRerankingByPath;
178
+ /**
179
+ * Search for text content in files
180
+ * Searches for text content inside files using ripgrep. Returns matching lines with context.
181
+ */
182
+ const getFilesystemContentSearchByPath = (options) => {
183
+ return (options.client ?? client_gen_1.client).get({
184
+ security: [
185
+ {
186
+ scheme: 'bearer',
187
+ type: 'http'
188
+ }
189
+ ],
190
+ url: '/filesystem-content-search/{path}',
191
+ ...options
192
+ });
193
+ };
194
+ exports.getFilesystemContentSearchByPath = getFilesystemContentSearchByPath;
195
+ /**
196
+ * Find files and directories
197
+ * Finds files and directories using the find command.
198
+ */
199
+ const getFilesystemFindByPath = (options) => {
200
+ return (options.client ?? client_gen_1.client).get({
201
+ security: [
202
+ {
203
+ scheme: 'bearer',
204
+ type: 'http'
205
+ }
206
+ ],
207
+ url: '/filesystem-find/{path}',
208
+ ...options
209
+ });
210
+ };
211
+ exports.getFilesystemFindByPath = getFilesystemFindByPath;
178
212
  /**
179
213
  * List multipart uploads
180
214
  * List all active multipart uploads
@@ -290,6 +324,23 @@ const postFilesystemMultipartInitiateByPath = (options) => {
290
324
  });
291
325
  };
292
326
  exports.postFilesystemMultipartInitiateByPath = postFilesystemMultipartInitiateByPath;
327
+ /**
328
+ * Fuzzy search for files and directories
329
+ * Performs fuzzy search on filesystem paths using fuzzy matching algorithm. Optimized alternative to find and grep commands.
330
+ */
331
+ const getFilesystemSearchByPath = (options) => {
332
+ return (options.client ?? client_gen_1.client).get({
333
+ security: [
334
+ {
335
+ scheme: 'bearer',
336
+ type: 'http'
337
+ }
338
+ ],
339
+ url: '/filesystem-search/{path}',
340
+ ...options
341
+ });
342
+ };
343
+ exports.getFilesystemSearchByPath = getFilesystemSearchByPath;
293
344
  /**
294
345
  * Delete file or directory
295
346
  * Delete a file or directory
@@ -345,6 +396,61 @@ const putFilesystemByPath = (options) => {
345
396
  });
346
397
  };
347
398
  exports.putFilesystemByPath = putFilesystemByPath;
399
+ /**
400
+ * Delete directory tree
401
+ * Delete a directory tree recursively
402
+ */
403
+ const deleteFilesystemTreeByPath = (options) => {
404
+ return (options.client ?? client_gen_1.client).delete({
405
+ security: [
406
+ {
407
+ scheme: 'bearer',
408
+ type: 'http'
409
+ }
410
+ ],
411
+ url: '/filesystem/tree/{path}',
412
+ ...options
413
+ });
414
+ };
415
+ exports.deleteFilesystemTreeByPath = deleteFilesystemTreeByPath;
416
+ /**
417
+ * Get directory tree
418
+ * Get a recursive directory tree structure starting from the specified path
419
+ */
420
+ const getFilesystemTreeByPath = (options) => {
421
+ return (options.client ?? client_gen_1.client).get({
422
+ security: [
423
+ {
424
+ scheme: 'bearer',
425
+ type: 'http'
426
+ }
427
+ ],
428
+ url: '/filesystem/tree/{path}',
429
+ ...options
430
+ });
431
+ };
432
+ exports.getFilesystemTreeByPath = getFilesystemTreeByPath;
433
+ /**
434
+ * Create or update directory tree
435
+ * Create or update multiple files within a directory tree structure
436
+ */
437
+ const putFilesystemTreeByPath = (options) => {
438
+ return (options.client ?? client_gen_1.client).put({
439
+ security: [
440
+ {
441
+ scheme: 'bearer',
442
+ type: 'http'
443
+ }
444
+ ],
445
+ url: '/filesystem/tree/{path}',
446
+ ...options,
447
+ headers: {
448
+ 'Content-Type': 'application/json',
449
+ ...options?.headers
450
+ }
451
+ });
452
+ };
453
+ exports.putFilesystemTreeByPath = putFilesystemTreeByPath;
348
454
  /**
349
455
  * Stop monitoring ports for a process
350
456
  * Stop monitoring for new ports opened by a process
@@ -540,3 +646,20 @@ const getWatchFilesystemByPath = (options) => {
540
646
  });
541
647
  };
542
648
  exports.getWatchFilesystemByPath = getWatchFilesystemByPath;
649
+ /**
650
+ * WebSocket endpoint
651
+ * WebSocket endpoint for all sandbox operations
652
+ */
653
+ const getWs = (options) => {
654
+ return (options?.client ?? client_gen_1.client).get({
655
+ security: [
656
+ {
657
+ scheme: 'bearer',
658
+ type: 'http'
659
+ }
660
+ ],
661
+ url: '/ws',
662
+ ...options
663
+ });
664
+ };
665
+ exports.getWs = getWs;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SandboxFileSystem = void 0;
4
- const settings_js_1 = require("../../common/settings.js");
5
4
  const node_js_1 = require("../../common/node.js");
5
+ const settings_js_1 = require("../../common/settings.js");
6
6
  const action_js_1 = require("../action.js");
7
7
  const index_js_1 = require("../client/index.js");
8
8
  // Multipart upload constants
@@ -199,6 +199,86 @@ class SandboxFileSystem extends action_js_1.SandboxAction {
199
199
  }
200
200
  return data;
201
201
  }
202
+ async search(query, path = "/", options) {
203
+ const formattedPath = this.formatPath(path);
204
+ const queryParams = {};
205
+ if (options?.maxResults !== undefined) {
206
+ queryParams.maxResults = options.maxResults;
207
+ }
208
+ if (options?.patterns && options.patterns.length > 0) {
209
+ queryParams.patterns = options.patterns.join(',');
210
+ }
211
+ if (options?.excludeDirs && options.excludeDirs.length > 0) {
212
+ queryParams.excludeDirs = options.excludeDirs.join(',');
213
+ }
214
+ if (options?.excludeHidden !== undefined) {
215
+ queryParams.excludeHidden = options.excludeHidden;
216
+ }
217
+ const result = await (0, index_js_1.getFilesystemSearchByPath)({
218
+ path: { path: formattedPath },
219
+ query: queryParams,
220
+ baseUrl: this.url,
221
+ client: this.client,
222
+ });
223
+ this.handleResponseError(result.response, result.data, result.error);
224
+ return result.data;
225
+ }
226
+ async find(path, options) {
227
+ const formattedPath = this.formatPath(path);
228
+ const queryParams = {};
229
+ if (options?.type) {
230
+ queryParams.type = options.type;
231
+ }
232
+ if (options?.patterns && options.patterns.length > 0) {
233
+ queryParams.patterns = options.patterns.join(',');
234
+ }
235
+ if (options?.maxResults !== undefined) {
236
+ queryParams.maxResults = options.maxResults;
237
+ }
238
+ if (options?.excludeDirs && options.excludeDirs.length > 0) {
239
+ queryParams.excludeDirs = options.excludeDirs.join(',');
240
+ }
241
+ if (options?.excludeHidden !== undefined) {
242
+ queryParams.excludeHidden = options.excludeHidden;
243
+ }
244
+ const result = await (0, index_js_1.getFilesystemFindByPath)({
245
+ path: { path: formattedPath },
246
+ query: queryParams,
247
+ baseUrl: this.url,
248
+ client: this.client,
249
+ });
250
+ this.handleResponseError(result.response, result.data, result.error);
251
+ return result.data;
252
+ }
253
+ async grep(query, path = "/", options) {
254
+ const formattedPath = this.formatPath(path);
255
+ const queryParams = {
256
+ query,
257
+ };
258
+ if (options?.caseSensitive !== undefined) {
259
+ queryParams.caseSensitive = options.caseSensitive;
260
+ }
261
+ if (options?.contextLines !== undefined) {
262
+ queryParams.contextLines = options.contextLines;
263
+ }
264
+ if (options?.maxResults !== undefined) {
265
+ queryParams.maxResults = options.maxResults;
266
+ }
267
+ if (options?.filePattern) {
268
+ queryParams.filePattern = options.filePattern;
269
+ }
270
+ if (options?.excludeDirs && options.excludeDirs.length > 0) {
271
+ queryParams.excludeDirs = options.excludeDirs.join(',');
272
+ }
273
+ const result = await (0, index_js_1.getFilesystemContentSearchByPath)({
274
+ path: { path: formattedPath },
275
+ query: queryParams,
276
+ baseUrl: this.url,
277
+ client: this.client,
278
+ });
279
+ this.handleResponseError(result.response, result.data, result.error);
280
+ return result.data;
281
+ }
202
282
  async cp(source, destination, { maxWait = 180000 } = {}) {
203
283
  let process = await this.process.exec({
204
284
  command: `cp -r ${source} ${destination}`,
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Initialize an isolated Sentry client for SDK error tracking.
3
+ * This creates a separate Sentry instance that won't interfere with any
4
+ * Sentry configuration the user might have in their application.
5
+ */
6
+ export declare function initSentry(): void;
7
+ /**
8
+ * Flush pending Sentry events.
9
+ * This should be called before the process exits to ensure all events are sent.
10
+ *
11
+ * @param timeout - Maximum time in milliseconds to wait for flush (default: 2000)
12
+ */
13
+ export declare function flushSentry(timeout?: number): Promise<void>;
14
+ /**
15
+ * Check if Sentry is initialized and available.
16
+ */
17
+ export declare function isSentryInitialized(): boolean;
@@ -7,7 +7,6 @@ export type Config = {
7
7
  declare class Settings {
8
8
  credentials: Credentials;
9
9
  config: Config;
10
- private _version;
11
10
  constructor();
12
11
  setConfig(config: Config): void;
13
12
  get env(): string;
@@ -17,6 +16,8 @@ declare class Settings {
17
16
  get authorization(): string;
18
17
  get token(): string;
19
18
  get version(): string;
19
+ get commit(): string;
20
+ get sentryDsn(): string;
20
21
  get headers(): Record<string, string>;
21
22
  get name(): string;
22
23
  get type(): string;
@@ -0,0 +1,2 @@
1
+ export declare const PACKAGE_VERSION = "0.2.50";
2
+ export declare const PACKAGE_COMMIT = "4a74989dcb65a6ff8d826aed7976436c64554f6a";