@blaxel/core 0.2.55-preview.17 → 0.2.56-dev.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/client/sdk.gen.js +2 -36
- package/dist/cjs/common/sentry.js +227 -131
- package/dist/cjs/common/settings.js +3 -3
- package/dist/cjs/common/version.js +6 -0
- package/dist/cjs/types/client/sdk.gen.d.ts +1 -11
- package/dist/cjs/types/client/types.gen.d.ts +0 -48
- package/dist/cjs/types/common/sentry.d.ts +1 -3
- package/dist/cjs/types/common/version.d.ts +2 -0
- package/dist/cjs/types/sandbox/client/sdk.gen.d.ts +3 -3
- package/dist/cjs-browser/.tsbuildinfo +1 -1
- package/dist/cjs-browser/client/sdk.gen.js +2 -36
- package/dist/cjs-browser/common/sentry-browser.js +27 -0
- package/dist/cjs-browser/common/sentry.js +306 -11
- package/dist/cjs-browser/common/settings.js +3 -3
- package/dist/cjs-browser/common/version.js +6 -0
- package/dist/cjs-browser/types/client/sdk.gen.d.ts +1 -11
- package/dist/cjs-browser/types/client/types.gen.d.ts +0 -48
- package/dist/cjs-browser/types/common/sentry.d.ts +1 -3
- package/dist/cjs-browser/types/common/version.d.ts +2 -0
- package/dist/cjs-browser/types/sandbox/client/sdk.gen.d.ts +3 -3
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/client/sdk.gen.js +0 -32
- package/dist/esm/common/sentry.js +227 -98
- package/dist/esm/common/settings.js +3 -3
- package/dist/esm/common/version.js +3 -0
- package/dist/esm-browser/.tsbuildinfo +1 -1
- package/dist/esm-browser/client/sdk.gen.js +0 -32
- package/dist/esm-browser/common/sentry-browser.js +22 -0
- package/dist/esm-browser/common/sentry.js +306 -11
- package/dist/esm-browser/common/settings.js +3 -3
- package/dist/esm-browser/common/version.js +3 -0
- package/package.json +2 -4
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.updateModel = exports.getModel = exports.deleteModel = exports.createModel = exports.listModels = exports.listMcpHubDefinitions = exports.listLocations = exports.listJobRevisions = exports.getJobExecution = exports.deleteJobExecution = exports.createJobExecution = exports.listJobExecutions = exports.updateJob = exports.getJob = exports.deleteJob = exports.createJob = exports.listJobs = exports.getIntegrationConnectionModel = exports.listIntegrationConnectionModels = exports.getIntegrationConnectionModelEndpointConfigurations = exports.updateIntegrationConnection = exports.getIntegrationConnection = exports.deleteIntegrationConnection = exports.createIntegrationConnection = exports.listIntegrationConnections = exports.getIntegration = exports.deleteImageTag = exports.getImage = exports.deleteImage = exports.listImages = exports.cleanupImages = exports.listFunctionRevisions = exports.updateFunction = exports.getFunction = exports.deleteFunction = exports.createFunction = exports.listFunctions = exports.verifyCustomDomain = exports.updateCustomDomain = exports.getCustomDomain = exports.deleteCustomDomain = exports.createCustomDomain = exports.listCustomDomains = exports.getConfiguration = exports.listAgentRevisions = exports.updateAgent = exports.getAgent = exports.deleteAgent = exports.createAgent = exports.listAgents = void 0;
|
|
5
|
-
exports.deleteWorkspace = exports.createWorkspace = exports.listWorkspaces = exports.getVolume = exports.deleteVolume = exports.createVolume = exports.listVolumes = exports.deleteVolumeTemplateVersion = exports.updateVolumeTemplate = exports.getVolumeTemplate = exports.deleteVolumeTemplate = exports.createVolumeTemplate = exports.listVolumeTemplates = exports.updateWorkspaceUserRole = exports.removeWorkspaceUser = exports.inviteWorkspaceUser = exports.listWorkspaceUsers = exports.getTemplate = exports.listTemplates = exports.deleteApiKeyForServiceAccount = exports.createApiKeyForServiceAccount = exports.listApiKeysForServiceAccount = exports.updateWorkspaceServiceAccount = exports.deleteWorkspaceServiceAccount = exports.createWorkspaceServiceAccount = exports.getWorkspaceServiceAccounts = exports.
|
|
6
|
-
exports.checkWorkspaceAvailability = exports.leaveWorkspace = exports.acceptWorkspaceInvitation = exports.declineWorkspaceInvitation =
|
|
5
|
+
exports.updateWorkspace = exports.getWorkspace = exports.deleteWorkspace = exports.createWorkspace = exports.listWorkspaces = exports.getVolume = exports.deleteVolume = exports.createVolume = exports.listVolumes = exports.deleteVolumeTemplateVersion = exports.updateVolumeTemplate = exports.getVolumeTemplate = exports.deleteVolumeTemplate = exports.createVolumeTemplate = exports.listVolumeTemplates = exports.updateWorkspaceUserRole = exports.removeWorkspaceUser = exports.inviteWorkspaceUser = exports.listWorkspaceUsers = exports.getTemplate = exports.listTemplates = exports.deleteApiKeyForServiceAccount = exports.createApiKeyForServiceAccount = exports.listApiKeysForServiceAccount = exports.updateWorkspaceServiceAccount = exports.deleteWorkspaceServiceAccount = exports.createWorkspaceServiceAccount = exports.getWorkspaceServiceAccounts = exports.deleteSandboxPreviewToken = exports.createSandboxPreviewToken = exports.listSandboxPreviewTokens = exports.updateSandboxPreview = exports.getSandboxPreview = exports.deleteSandboxPreview = exports.createSandboxPreview = exports.listSandboxPreviews = exports.updateSandbox = exports.getSandbox = exports.deleteSandbox = exports.createSandbox = exports.listSandboxes = exports.listSandboxHubDefinitions = exports.listPublicIps = exports.listAllPendingInvitations = exports.updatePolicy = exports.getPolicy = exports.deletePolicy = exports.createPolicy = exports.listPolicies = exports.listModelRevisions = void 0;
|
|
6
|
+
exports.checkWorkspaceAvailability = exports.leaveWorkspace = exports.acceptWorkspaceInvitation = exports.declineWorkspaceInvitation = void 0;
|
|
7
7
|
const client_gen_1 = require("./client.gen");
|
|
8
8
|
/**
|
|
9
9
|
* List all agents
|
|
@@ -1283,40 +1283,6 @@ const deleteSandboxPreviewToken = (options) => {
|
|
|
1283
1283
|
});
|
|
1284
1284
|
};
|
|
1285
1285
|
exports.deleteSandboxPreviewToken = deleteSandboxPreviewToken;
|
|
1286
|
-
/**
|
|
1287
|
-
* Start Sandbox
|
|
1288
|
-
* Starts a Sandbox by name.
|
|
1289
|
-
*/
|
|
1290
|
-
const startSandbox = (options) => {
|
|
1291
|
-
return (options.client ?? client_gen_1.client).put({
|
|
1292
|
-
security: [
|
|
1293
|
-
{
|
|
1294
|
-
scheme: 'bearer',
|
|
1295
|
-
type: 'http'
|
|
1296
|
-
}
|
|
1297
|
-
],
|
|
1298
|
-
url: '/sandboxes/{sandboxName}/start',
|
|
1299
|
-
...options
|
|
1300
|
-
});
|
|
1301
|
-
};
|
|
1302
|
-
exports.startSandbox = startSandbox;
|
|
1303
|
-
/**
|
|
1304
|
-
* Stop Sandbox
|
|
1305
|
-
* Stops a Sandbox by name.
|
|
1306
|
-
*/
|
|
1307
|
-
const stopSandbox = (options) => {
|
|
1308
|
-
return (options.client ?? client_gen_1.client).put({
|
|
1309
|
-
security: [
|
|
1310
|
-
{
|
|
1311
|
-
scheme: 'bearer',
|
|
1312
|
-
type: 'http'
|
|
1313
|
-
}
|
|
1314
|
-
],
|
|
1315
|
-
url: '/sandboxes/{sandboxName}/stop',
|
|
1316
|
-
...options
|
|
1317
|
-
});
|
|
1318
|
-
};
|
|
1319
|
-
exports.stopSandbox = stopSandbox;
|
|
1320
1286
|
/**
|
|
1321
1287
|
* Get workspace service accounts
|
|
1322
1288
|
* Returns a list of all service accounts in the workspace.
|
|
@@ -1,48 +1,15 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.initSentry = initSentry;
|
|
37
4
|
exports.flushSentry = flushSentry;
|
|
38
5
|
exports.isSentryInitialized = isSentryInitialized;
|
|
39
6
|
const settings_js_1 = require("./settings.js");
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// Isolated Sentry client for SDK-only error tracking (doesn't interfere with user's Sentry)
|
|
43
|
-
let sentryClient = null;
|
|
7
|
+
// Lightweight Sentry client using fetch - only captures SDK errors
|
|
8
|
+
let sentryInitialized = false;
|
|
44
9
|
const capturedExceptions = new Set();
|
|
45
10
|
let handlersRegistered = false;
|
|
11
|
+
// Parsed DSN components
|
|
12
|
+
let sentryConfig = null;
|
|
46
13
|
// SDK path patterns to identify errors originating from our SDK
|
|
47
14
|
const SDK_PATTERNS = [
|
|
48
15
|
"@blaxel/",
|
|
@@ -60,9 +27,146 @@ function isFromSDK(error) {
|
|
|
60
27
|
return SDK_PATTERNS.some((pattern) => stack.includes(pattern));
|
|
61
28
|
}
|
|
62
29
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
|
|
30
|
+
* Parse a Sentry DSN into its components.
|
|
31
|
+
* DSN format: https://{public_key}@{host}/{project_id}
|
|
32
|
+
*/
|
|
33
|
+
function parseDsn(dsn) {
|
|
34
|
+
try {
|
|
35
|
+
const url = new URL(dsn);
|
|
36
|
+
const publicKey = url.username;
|
|
37
|
+
const host = url.host;
|
|
38
|
+
const projectId = url.pathname.slice(1); // Remove leading slash
|
|
39
|
+
if (!publicKey || !host || !projectId) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
return { publicKey, host, projectId };
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Generate a UUID v4
|
|
50
|
+
*/
|
|
51
|
+
function generateEventId() {
|
|
52
|
+
return "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
53
|
+
const r = (Math.random() * 16) | 0;
|
|
54
|
+
const v = c === "x" ? r : (r & 0x3) | 0x8;
|
|
55
|
+
return v.toString(16);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Convert an Error to a Sentry event payload.
|
|
60
|
+
*/
|
|
61
|
+
function errorToSentryEvent(error) {
|
|
62
|
+
const frames = parseStackTrace(error.stack || "");
|
|
63
|
+
return {
|
|
64
|
+
event_id: generateEventId(),
|
|
65
|
+
timestamp: Date.now() / 1000,
|
|
66
|
+
platform: "javascript",
|
|
67
|
+
level: "error",
|
|
68
|
+
environment: settings_js_1.settings.env,
|
|
69
|
+
release: `sdk-typescript@${settings_js_1.settings.version}`,
|
|
70
|
+
tags: {
|
|
71
|
+
"blaxel.workspace": settings_js_1.settings.workspace,
|
|
72
|
+
"blaxel.version": settings_js_1.settings.version,
|
|
73
|
+
"blaxel.commit": settings_js_1.settings.commit,
|
|
74
|
+
},
|
|
75
|
+
exception: {
|
|
76
|
+
values: [
|
|
77
|
+
{
|
|
78
|
+
type: error.name,
|
|
79
|
+
value: error.message,
|
|
80
|
+
stacktrace: {
|
|
81
|
+
frames,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Parse a stack trace string into Sentry-compatible frames.
|
|
90
|
+
*/
|
|
91
|
+
function parseStackTrace(stack) {
|
|
92
|
+
const lines = stack.split("\n").slice(1); // Skip first line (error message)
|
|
93
|
+
const frames = [];
|
|
94
|
+
for (const line of lines) {
|
|
95
|
+
// Match patterns like "at functionName (filename:line:col)" or "at filename:line:col"
|
|
96
|
+
const match = line.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?/);
|
|
97
|
+
if (match) {
|
|
98
|
+
frames.unshift({
|
|
99
|
+
function: match[1] || "<anonymous>",
|
|
100
|
+
filename: match[2],
|
|
101
|
+
lineno: parseInt(match[3], 10),
|
|
102
|
+
colno: parseInt(match[4], 10),
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return frames;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Send an event to Sentry using fetch.
|
|
110
|
+
*/
|
|
111
|
+
async function sendToSentry(event) {
|
|
112
|
+
if (!sentryConfig)
|
|
113
|
+
return;
|
|
114
|
+
const { publicKey, host, projectId } = sentryConfig;
|
|
115
|
+
const envelopeUrl = `https://${host}/api/${projectId}/envelope/`;
|
|
116
|
+
// Create envelope header
|
|
117
|
+
const envelopeHeader = JSON.stringify({
|
|
118
|
+
event_id: event.event_id,
|
|
119
|
+
sent_at: new Date().toISOString(),
|
|
120
|
+
dsn: `https://${publicKey}@${host}/${projectId}`,
|
|
121
|
+
});
|
|
122
|
+
// Create item header
|
|
123
|
+
const itemHeader = JSON.stringify({
|
|
124
|
+
type: "event",
|
|
125
|
+
content_type: "application/json",
|
|
126
|
+
});
|
|
127
|
+
// Create envelope body
|
|
128
|
+
const envelope = `${envelopeHeader}\n${itemHeader}\n${JSON.stringify(event)}`;
|
|
129
|
+
try {
|
|
130
|
+
await fetch(envelopeUrl, {
|
|
131
|
+
method: "POST",
|
|
132
|
+
headers: {
|
|
133
|
+
"Content-Type": "application/x-sentry-envelope",
|
|
134
|
+
"X-Sentry-Auth": `Sentry sentry_version=7, sentry_client=blaxel-sdk/${settings_js_1.settings.version}, sentry_key=${publicKey}`,
|
|
135
|
+
},
|
|
136
|
+
body: envelope,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
// Silently fail - error reporting should never break the SDK
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// Queue for pending events
|
|
144
|
+
const pendingEvents = [];
|
|
145
|
+
let flushPromise = null;
|
|
146
|
+
/**
|
|
147
|
+
* Register browser/edge environment error handlers.
|
|
148
|
+
* Separated to isolate dynamic globalThis access.
|
|
149
|
+
*/
|
|
150
|
+
function registerBrowserHandlers() {
|
|
151
|
+
const g = globalThis;
|
|
152
|
+
if (g && typeof g.addEventListener === "function") {
|
|
153
|
+
g.addEventListener("error", (event) => {
|
|
154
|
+
const e = event;
|
|
155
|
+
if (e.error instanceof Error && isFromSDK(e.error)) {
|
|
156
|
+
captureException(e.error);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
g.addEventListener("unhandledrejection", (event) => {
|
|
160
|
+
const e = event;
|
|
161
|
+
const error = e.reason instanceof Error ? e.reason : new Error(String(e.reason));
|
|
162
|
+
if (isFromSDK(error)) {
|
|
163
|
+
captureException(error);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Initialize the lightweight Sentry client for SDK error tracking.
|
|
66
170
|
*/
|
|
67
171
|
function initSentry() {
|
|
68
172
|
try {
|
|
@@ -74,87 +178,64 @@ function initSentry() {
|
|
|
74
178
|
if (!dsn) {
|
|
75
179
|
return;
|
|
76
180
|
}
|
|
77
|
-
//
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
// Filter errors before sending - only send SDK errors
|
|
90
|
-
beforeSend(event, hint) {
|
|
91
|
-
if (event.environment !== 'dev' && event.environment !== 'prod') {
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
const error = hint.originalException;
|
|
95
|
-
if (error instanceof Error) {
|
|
96
|
-
if (!isFromSDK(error)) {
|
|
97
|
-
// Drop errors that don't originate from SDK
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return event;
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
sentryClient.init();
|
|
105
|
-
// Set SDK-specific tags
|
|
106
|
-
const scope = new Sentry.Scope();
|
|
107
|
-
scope.setTag("blaxel.workspace", settings_js_1.settings.workspace);
|
|
108
|
-
scope.setTag("blaxel.version", settings_js_1.settings.version);
|
|
109
|
-
scope.setTag("blaxel.commit", settings_js_1.settings.commit);
|
|
110
|
-
scope.setClient(sentryClient);
|
|
111
|
-
// Register process handlers for uncaught errors (Node.js only)
|
|
112
|
-
// Only register once to prevent memory leaks
|
|
113
|
-
if (typeof process !== "undefined" &&
|
|
114
|
-
typeof process.on === "function" &&
|
|
115
|
-
!handlersRegistered) {
|
|
181
|
+
// Parse DSN
|
|
182
|
+
sentryConfig = parseDsn(dsn);
|
|
183
|
+
if (!sentryConfig) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
// Only allow dev/prod environments
|
|
187
|
+
if (settings_js_1.settings.env !== "dev" && settings_js_1.settings.env !== "prod") {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
sentryInitialized = true;
|
|
191
|
+
// Register error handlers only once
|
|
192
|
+
if (!handlersRegistered) {
|
|
116
193
|
handlersRegistered = true;
|
|
117
|
-
//
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
};
|
|
134
|
-
// Unhandled rejection handler - only capture SDK errors
|
|
135
|
-
const unhandledRejectionHandler = (reason) => {
|
|
136
|
-
const error = reason instanceof Error ? reason : new Error(String(reason));
|
|
137
|
-
if (isFromSDK(error)) {
|
|
138
|
-
captureException(error);
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
process.on("SIGTERM", () => signalHandler("SIGTERM"));
|
|
142
|
-
process.on("SIGINT", () => signalHandler("SIGINT"));
|
|
143
|
-
process.on("uncaughtException", uncaughtExceptionHandler);
|
|
144
|
-
process.on("unhandledRejection", unhandledRejectionHandler);
|
|
145
|
-
// Intercept console.error to capture SDK errors that are caught and logged
|
|
146
|
-
const originalConsoleError = console.error;
|
|
147
|
-
console.error = function (...args) {
|
|
148
|
-
// Call the original console.error first
|
|
149
|
-
originalConsoleError.apply(console, args);
|
|
150
|
-
// Check if any argument is an Error from SDK and capture it
|
|
151
|
-
for (const arg of args) {
|
|
152
|
-
if (arg instanceof Error && isFromSDK(arg)) {
|
|
153
|
-
captureException(arg);
|
|
154
|
-
break; // Only capture the first SDK error to avoid duplicates
|
|
194
|
+
// Node.js specific handlers
|
|
195
|
+
if (typeof process !== "undefined" && typeof process.on === "function") {
|
|
196
|
+
// For SIGTERM/SIGINT, flush before exit
|
|
197
|
+
const signalHandler = (signal) => {
|
|
198
|
+
flushSentry(500)
|
|
199
|
+
.catch(() => {
|
|
200
|
+
// Silently fail
|
|
201
|
+
})
|
|
202
|
+
.finally(() => {
|
|
203
|
+
process.exit(signal === "SIGTERM" ? 143 : 130);
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
// Uncaught exception handler - only capture SDK errors
|
|
207
|
+
const uncaughtExceptionHandler = (error) => {
|
|
208
|
+
if (isFromSDK(error)) {
|
|
209
|
+
captureException(error);
|
|
155
210
|
}
|
|
156
|
-
}
|
|
157
|
-
|
|
211
|
+
};
|
|
212
|
+
// Unhandled rejection handler - only capture SDK errors
|
|
213
|
+
const unhandledRejectionHandler = (reason) => {
|
|
214
|
+
const error = reason instanceof Error ? reason : new Error(String(reason));
|
|
215
|
+
if (isFromSDK(error)) {
|
|
216
|
+
captureException(error);
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
process.on("SIGTERM", () => signalHandler("SIGTERM"));
|
|
220
|
+
process.on("SIGINT", () => signalHandler("SIGINT"));
|
|
221
|
+
process.on("uncaughtException", uncaughtExceptionHandler);
|
|
222
|
+
process.on("unhandledRejection", unhandledRejectionHandler);
|
|
223
|
+
// Intercept console.error to capture SDK errors that are caught and logged
|
|
224
|
+
const originalConsoleError = console.error;
|
|
225
|
+
console.error = function (...args) {
|
|
226
|
+
originalConsoleError.apply(console, args);
|
|
227
|
+
for (const arg of args) {
|
|
228
|
+
if (arg instanceof Error && isFromSDK(arg)) {
|
|
229
|
+
captureException(arg);
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
// Browser/Edge environment handlers
|
|
237
|
+
registerBrowserHandlers();
|
|
238
|
+
}
|
|
158
239
|
}
|
|
159
240
|
}
|
|
160
241
|
catch (error) {
|
|
@@ -165,13 +246,13 @@ function initSentry() {
|
|
|
165
246
|
}
|
|
166
247
|
}
|
|
167
248
|
/**
|
|
168
|
-
* Capture an exception to
|
|
249
|
+
* Capture an exception to Sentry.
|
|
169
250
|
* Only errors originating from SDK code will be captured.
|
|
170
251
|
*
|
|
171
252
|
* @param error - The error to capture
|
|
172
253
|
*/
|
|
173
254
|
function captureException(error) {
|
|
174
|
-
if (
|
|
255
|
+
if (!sentryInitialized || !sentryConfig) {
|
|
175
256
|
return;
|
|
176
257
|
}
|
|
177
258
|
// Double-check that error is from SDK (defense in depth)
|
|
@@ -189,13 +270,13 @@ function captureException(error) {
|
|
|
189
270
|
if (capturedExceptions.size > 1000) {
|
|
190
271
|
capturedExceptions.clear();
|
|
191
272
|
}
|
|
192
|
-
//
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
273
|
+
// Convert error to Sentry event and queue it
|
|
274
|
+
const event = errorToSentryEvent(error);
|
|
275
|
+
pendingEvents.push(event);
|
|
276
|
+
// Send immediately (fire and forget)
|
|
277
|
+
sendToSentry(event).catch(() => {
|
|
278
|
+
// Silently fail
|
|
279
|
+
});
|
|
199
280
|
}
|
|
200
281
|
catch {
|
|
201
282
|
// Silently fail - error capturing should never break the SDK
|
|
@@ -208,19 +289,34 @@ function captureException(error) {
|
|
|
208
289
|
* @param timeout - Maximum time in milliseconds to wait for flush (default: 2000)
|
|
209
290
|
*/
|
|
210
291
|
async function flushSentry(timeout = 2000) {
|
|
211
|
-
if (
|
|
292
|
+
if (!sentryInitialized || pendingEvents.length === 0) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
// If already flushing, wait for it
|
|
296
|
+
if (flushPromise) {
|
|
297
|
+
await flushPromise;
|
|
212
298
|
return;
|
|
213
299
|
}
|
|
214
300
|
try {
|
|
215
|
-
|
|
301
|
+
// Send all pending events
|
|
302
|
+
const eventsToSend = [...pendingEvents];
|
|
303
|
+
pendingEvents.length = 0;
|
|
304
|
+
flushPromise = Promise.race([
|
|
305
|
+
Promise.all(eventsToSend.map((event) => sendToSentry(event))).then(() => { }),
|
|
306
|
+
new Promise((resolve) => setTimeout(resolve, timeout)),
|
|
307
|
+
]);
|
|
308
|
+
await flushPromise;
|
|
216
309
|
}
|
|
217
310
|
catch {
|
|
218
311
|
// Silently fail
|
|
219
312
|
}
|
|
313
|
+
finally {
|
|
314
|
+
flushPromise = null;
|
|
315
|
+
}
|
|
220
316
|
}
|
|
221
317
|
/**
|
|
222
318
|
* Check if Sentry is initialized and available.
|
|
223
319
|
*/
|
|
224
320
|
function isSentryInitialized() {
|
|
225
|
-
return
|
|
321
|
+
return sentryInitialized;
|
|
226
322
|
}
|
|
@@ -9,9 +9,9 @@ const index_js_1 = require("../authentication/index.js");
|
|
|
9
9
|
const env_js_1 = require("../common/env.js");
|
|
10
10
|
const node_js_1 = require("../common/node.js");
|
|
11
11
|
// Build info - these placeholders are replaced at build time by build:replace-imports
|
|
12
|
-
const BUILD_VERSION = "0.2.
|
|
13
|
-
const BUILD_COMMIT = "
|
|
14
|
-
const BUILD_SENTRY_DSN = "
|
|
12
|
+
const BUILD_VERSION = "0.2.56-dev.23";
|
|
13
|
+
const BUILD_COMMIT = "d54548dc9e764e57728f9eda7721d5e50f11573a";
|
|
14
|
+
const BUILD_SENTRY_DSN = "";
|
|
15
15
|
// Cache for config.yaml tracking value
|
|
16
16
|
let configTrackingValue = null;
|
|
17
17
|
let configTrackingLoaded = false;
|
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
|
|
2
|
-
import type { ListAgentsData, CreateAgentData, DeleteAgentData, GetAgentData, UpdateAgentData, ListAgentRevisionsData, GetConfigurationData, ListCustomDomainsData, CreateCustomDomainData, DeleteCustomDomainData, GetCustomDomainData, UpdateCustomDomainData, VerifyCustomDomainData, ListFunctionsData, CreateFunctionData, DeleteFunctionData, GetFunctionData, UpdateFunctionData, ListFunctionRevisionsData, CleanupImagesData, ListImagesData, DeleteImageData, GetImageData, DeleteImageTagData, GetIntegrationData, ListIntegrationConnectionsData, CreateIntegrationConnectionData, DeleteIntegrationConnectionData, GetIntegrationConnectionData, UpdateIntegrationConnectionData, GetIntegrationConnectionModelEndpointConfigurationsData, ListIntegrationConnectionModelsData, GetIntegrationConnectionModelData, ListJobsData, CreateJobData, DeleteJobData, GetJobData, UpdateJobData, ListJobExecutionsData, CreateJobExecutionData, DeleteJobExecutionData, GetJobExecutionData, ListJobRevisionsData, ListLocationsData, ListMcpHubDefinitionsData, ListModelsData, CreateModelData, DeleteModelData, GetModelData, UpdateModelData, ListModelRevisionsData, ListPoliciesData, CreatePolicyData, DeletePolicyData, GetPolicyData, UpdatePolicyData, ListAllPendingInvitationsData, ListPublicIpsData, ListSandboxHubDefinitionsData, ListSandboxesData, CreateSandboxData, DeleteSandboxData, GetSandboxData, UpdateSandboxData, ListSandboxPreviewsData, CreateSandboxPreviewData, DeleteSandboxPreviewData, GetSandboxPreviewData, UpdateSandboxPreviewData, ListSandboxPreviewTokensData, CreateSandboxPreviewTokenData, DeleteSandboxPreviewTokenData,
|
|
2
|
+
import type { ListAgentsData, CreateAgentData, DeleteAgentData, GetAgentData, UpdateAgentData, ListAgentRevisionsData, GetConfigurationData, ListCustomDomainsData, CreateCustomDomainData, DeleteCustomDomainData, GetCustomDomainData, UpdateCustomDomainData, VerifyCustomDomainData, ListFunctionsData, CreateFunctionData, DeleteFunctionData, GetFunctionData, UpdateFunctionData, ListFunctionRevisionsData, CleanupImagesData, ListImagesData, DeleteImageData, GetImageData, DeleteImageTagData, GetIntegrationData, ListIntegrationConnectionsData, CreateIntegrationConnectionData, DeleteIntegrationConnectionData, GetIntegrationConnectionData, UpdateIntegrationConnectionData, GetIntegrationConnectionModelEndpointConfigurationsData, ListIntegrationConnectionModelsData, GetIntegrationConnectionModelData, ListJobsData, CreateJobData, DeleteJobData, GetJobData, UpdateJobData, ListJobExecutionsData, CreateJobExecutionData, DeleteJobExecutionData, GetJobExecutionData, ListJobRevisionsData, ListLocationsData, ListMcpHubDefinitionsData, ListModelsData, CreateModelData, DeleteModelData, GetModelData, UpdateModelData, ListModelRevisionsData, ListPoliciesData, CreatePolicyData, DeletePolicyData, GetPolicyData, UpdatePolicyData, ListAllPendingInvitationsData, ListPublicIpsData, ListSandboxHubDefinitionsData, ListSandboxesData, CreateSandboxData, DeleteSandboxData, GetSandboxData, UpdateSandboxData, ListSandboxPreviewsData, CreateSandboxPreviewData, DeleteSandboxPreviewData, GetSandboxPreviewData, UpdateSandboxPreviewData, ListSandboxPreviewTokensData, CreateSandboxPreviewTokenData, DeleteSandboxPreviewTokenData, GetWorkspaceServiceAccountsData, CreateWorkspaceServiceAccountData, DeleteWorkspaceServiceAccountData, UpdateWorkspaceServiceAccountData, ListApiKeysForServiceAccountData, CreateApiKeyForServiceAccountData, DeleteApiKeyForServiceAccountData, ListTemplatesData, GetTemplateData, ListWorkspaceUsersData, InviteWorkspaceUserData, RemoveWorkspaceUserData, UpdateWorkspaceUserRoleData, ListVolumeTemplatesData, CreateVolumeTemplateData, DeleteVolumeTemplateData, GetVolumeTemplateData, UpdateVolumeTemplateData, DeleteVolumeTemplateVersionData, ListVolumesData, CreateVolumeData, DeleteVolumeData, GetVolumeData, ListWorkspacesData, CreateWorkspaceData, DeleteWorkspaceData, GetWorkspaceData, UpdateWorkspaceData, DeclineWorkspaceInvitationData, AcceptWorkspaceInvitationData, LeaveWorkspaceData, CheckWorkspaceAvailabilityData } from './types.gen.js';
|
|
3
3
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
|
|
4
4
|
/**
|
|
5
5
|
* You can provide a client instance returned by `createClient()` instead of
|
|
@@ -352,16 +352,6 @@ export declare const createSandboxPreviewToken: <ThrowOnError extends boolean =
|
|
|
352
352
|
export declare const deleteSandboxPreviewToken: <ThrowOnError extends boolean = false>(options: Options<DeleteSandboxPreviewTokenData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<{
|
|
353
353
|
message?: string;
|
|
354
354
|
}, unknown, ThrowOnError>;
|
|
355
|
-
/**
|
|
356
|
-
* Start Sandbox
|
|
357
|
-
* Starts a Sandbox by name.
|
|
358
|
-
*/
|
|
359
|
-
export declare const startSandbox: <ThrowOnError extends boolean = false>(options: Options<StartSandboxData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").StartSandbox, unknown, ThrowOnError>;
|
|
360
|
-
/**
|
|
361
|
-
* Stop Sandbox
|
|
362
|
-
* Stops a Sandbox by name.
|
|
363
|
-
*/
|
|
364
|
-
export declare const stopSandbox: <ThrowOnError extends boolean = false>(options: Options<StopSandboxData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen.js").StopSandbox, unknown, ThrowOnError>;
|
|
365
355
|
/**
|
|
366
356
|
* Get workspace service accounts
|
|
367
357
|
* Returns a list of all service accounts in the workspace.
|
|
@@ -4432,54 +4432,6 @@ export type DeleteSandboxPreviewTokenResponses = {
|
|
|
4432
4432
|
};
|
|
4433
4433
|
};
|
|
4434
4434
|
export type DeleteSandboxPreviewTokenResponse = DeleteSandboxPreviewTokenResponses[keyof DeleteSandboxPreviewTokenResponses];
|
|
4435
|
-
export type StartSandboxData = {
|
|
4436
|
-
body?: never;
|
|
4437
|
-
path: {
|
|
4438
|
-
/**
|
|
4439
|
-
* Name of the Sandbox
|
|
4440
|
-
*/
|
|
4441
|
-
sandboxName: string;
|
|
4442
|
-
};
|
|
4443
|
-
query?: never;
|
|
4444
|
-
url: '/sandboxes/{sandboxName}/start';
|
|
4445
|
-
};
|
|
4446
|
-
export type StartSandboxErrors = {
|
|
4447
|
-
/**
|
|
4448
|
-
* Sandbox is already running
|
|
4449
|
-
*/
|
|
4450
|
-
409: unknown;
|
|
4451
|
-
};
|
|
4452
|
-
export type StartSandboxResponses = {
|
|
4453
|
-
/**
|
|
4454
|
-
* successful operation
|
|
4455
|
-
*/
|
|
4456
|
-
200: StartSandbox;
|
|
4457
|
-
};
|
|
4458
|
-
export type StartSandboxResponse = StartSandboxResponses[keyof StartSandboxResponses];
|
|
4459
|
-
export type StopSandboxData = {
|
|
4460
|
-
body?: never;
|
|
4461
|
-
path: {
|
|
4462
|
-
/**
|
|
4463
|
-
* Name of the Sandbox
|
|
4464
|
-
*/
|
|
4465
|
-
sandboxName: string;
|
|
4466
|
-
};
|
|
4467
|
-
query?: never;
|
|
4468
|
-
url: '/sandboxes/{sandboxName}/stop';
|
|
4469
|
-
};
|
|
4470
|
-
export type StopSandboxErrors = {
|
|
4471
|
-
/**
|
|
4472
|
-
* Sandbox is not running
|
|
4473
|
-
*/
|
|
4474
|
-
409: unknown;
|
|
4475
|
-
};
|
|
4476
|
-
export type StopSandboxResponses = {
|
|
4477
|
-
/**
|
|
4478
|
-
* successful operation
|
|
4479
|
-
*/
|
|
4480
|
-
200: StopSandbox;
|
|
4481
|
-
};
|
|
4482
|
-
export type StopSandboxResponse = StopSandboxResponses[keyof StopSandboxResponses];
|
|
4483
4435
|
export type GetWorkspaceServiceAccountsData = {
|
|
4484
4436
|
body?: never;
|
|
4485
4437
|
path?: never;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Initialize
|
|
3
|
-
* This creates a separate Sentry instance that won't interfere with any
|
|
4
|
-
* Sentry configuration the user might have in their application.
|
|
2
|
+
* Initialize the lightweight Sentry client for SDK error tracking.
|
|
5
3
|
*/
|
|
6
4
|
export declare function initSentry(): void;
|
|
7
5
|
/**
|
|
@@ -138,7 +138,7 @@ export declare const deleteFilesystemByPath: <ThrowOnError extends boolean = fal
|
|
|
138
138
|
* Get file or directory information
|
|
139
139
|
* Get content of a file or listing of a directory. Use Accept header to control response format for files.
|
|
140
140
|
*/
|
|
141
|
-
export declare const getFilesystemByPath: <ThrowOnError extends boolean = false>(options: Options<GetFilesystemByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").
|
|
141
|
+
export declare const getFilesystemByPath: <ThrowOnError extends boolean = false>(options: Options<GetFilesystemByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").Directory | Blob | import("./types.gen").FileWithContent | import("./types.gen").File, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
142
142
|
/**
|
|
143
143
|
* Create or update a file or directory
|
|
144
144
|
* Create or update a file or directory
|
|
@@ -153,12 +153,12 @@ export declare const deleteFilesystemTreeByPath: <ThrowOnError extends boolean =
|
|
|
153
153
|
* Get directory tree
|
|
154
154
|
* Get a recursive directory tree structure starting from the specified path
|
|
155
155
|
*/
|
|
156
|
-
export declare const getFilesystemTreeByPath: <ThrowOnError extends boolean = false>(options: Options<GetFilesystemTreeByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").
|
|
156
|
+
export declare const getFilesystemTreeByPath: <ThrowOnError extends boolean = false>(options: Options<GetFilesystemTreeByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").Directory | Blob | import("./types.gen").FileWithContent | import("./types.gen").File, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
157
157
|
/**
|
|
158
158
|
* Create or update directory tree
|
|
159
159
|
* Create or update multiple files within a directory tree structure
|
|
160
160
|
*/
|
|
161
|
-
export declare const putFilesystemTreeByPath: <ThrowOnError extends boolean = false>(options: Options<PutFilesystemTreeByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").
|
|
161
|
+
export declare const putFilesystemTreeByPath: <ThrowOnError extends boolean = false>(options: Options<PutFilesystemTreeByPathData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").Directory | Blob | import("./types.gen").FileWithContent | import("./types.gen").File, import("./types.gen").ErrorResponse, ThrowOnError>;
|
|
162
162
|
/**
|
|
163
163
|
* Stop monitoring ports for a process
|
|
164
164
|
* Stop monitoring for new ports opened by a process
|