tensorlake 0.5.127 → 0.5.129
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/applications/index.cjs +54 -3
- package/dist/applications/index.cjs.map +1 -1
- package/dist/applications/index.js +54 -3
- package/dist/applications/index.js.map +1 -1
- package/dist/function-agent/main.cjs +1 -1
- package/dist/function-agent/main.js +1 -1
- package/dist/function-executor/main.cjs +2 -2
- package/dist/function-executor/main.js +2 -2
- package/dist/index.cjs +61 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +61 -30
- package/dist/index.js.map +1 -1
- package/dist/sandbox-image.cjs +53 -2
- package/dist/sandbox-image.cjs.map +1 -1
- package/dist/sandbox-image.js +53 -2
- package/dist/sandbox-image.js.map +1 -1
- package/package.json +7 -7
- package/runtime/function-executor/manifest.json +5 -5
- package/runtime/function-executor/package/dist/function-executor/main.js +2 -2
- package/runtime/function-executor/package/npm-shrinkwrap.json +2 -2
- package/runtime/function-executor/package/package.json +1 -1
- package/runtime/typescript-function-runner/manifest.json +5 -5
- package/runtime/typescript-function-runner/package/dist/function-agent/main.js +1 -1
- package/runtime/typescript-function-runner/package/npm-shrinkwrap.json +20 -20
- package/runtime/typescript-function-runner/package/package.json +7 -7
package/dist/sandbox-image.js
CHANGED
|
@@ -46,7 +46,7 @@ var init_defaults = __esm({
|
|
|
46
46
|
"src/defaults.ts"() {
|
|
47
47
|
"use strict";
|
|
48
48
|
init_esm_shims();
|
|
49
|
-
SDK_VERSION = "0.5.
|
|
49
|
+
SDK_VERSION = "0.5.129";
|
|
50
50
|
API_URL = process.env.TENSORLAKE_API_URL ?? "https://api.tensorlake.ai";
|
|
51
51
|
API_KEY = process.env.TENSORLAKE_API_KEY ?? void 0;
|
|
52
52
|
NAMESPACE = process.env.INDEXIFY_NAMESPACE ?? "default";
|
|
@@ -81,6 +81,27 @@ function describeError(err) {
|
|
|
81
81
|
if (parts.length > 0) return parts.join(": ");
|
|
82
82
|
return err instanceof Error ? err.message : String(err);
|
|
83
83
|
}
|
|
84
|
+
function formatErrorDetails(errorDetails) {
|
|
85
|
+
if (errorDetails == null) return void 0;
|
|
86
|
+
if (typeof errorDetails === "string") {
|
|
87
|
+
const detail = errorDetails.trim();
|
|
88
|
+
return detail || void 0;
|
|
89
|
+
}
|
|
90
|
+
if (Array.isArray(errorDetails)) {
|
|
91
|
+
const parts = errorDetails.map((item) => formatErrorDetails(item)).filter((item) => Boolean(item));
|
|
92
|
+
return parts.length > 0 ? parts.join("; ") : JSON.stringify(errorDetails);
|
|
93
|
+
}
|
|
94
|
+
if (typeof errorDetails === "object") {
|
|
95
|
+
for (const key of ["message", "detail", "error", "reason"]) {
|
|
96
|
+
const value = errorDetails[key];
|
|
97
|
+
if (typeof value === "string" && value.trim()) {
|
|
98
|
+
return value.trim();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return JSON.stringify(errorDetails);
|
|
102
|
+
}
|
|
103
|
+
return String(errorDetails);
|
|
104
|
+
}
|
|
84
105
|
var SandboxException, SandboxError, SandboxConnectionError, SandboxNotFoundError, PoolNotFoundError, PoolInUseError, RemoteAPIError;
|
|
85
106
|
var init_errors = __esm({
|
|
86
107
|
"src/errors.ts"() {
|
|
@@ -132,9 +153,39 @@ var init_errors = __esm({
|
|
|
132
153
|
};
|
|
133
154
|
RemoteAPIError = class extends SandboxError {
|
|
134
155
|
statusCode;
|
|
156
|
+
/** Original response body, retained for compatibility and diagnostics. */
|
|
135
157
|
responseMessage;
|
|
158
|
+
sandboxId;
|
|
159
|
+
/** Server reason, including unknown future reasons. */
|
|
160
|
+
reason;
|
|
161
|
+
errorDetails;
|
|
136
162
|
constructor(statusCode, message) {
|
|
137
|
-
|
|
163
|
+
let failure;
|
|
164
|
+
try {
|
|
165
|
+
const payload = JSON.parse(message);
|
|
166
|
+
if (payload && typeof payload === "object" && !Array.isArray(payload)) {
|
|
167
|
+
const record = payload;
|
|
168
|
+
if (typeof record.sandbox_id === "string" && record.sandbox_id.trim() && (record.status === "failed" || record.status === "terminated"))
|
|
169
|
+
failure = record;
|
|
170
|
+
}
|
|
171
|
+
} catch {
|
|
172
|
+
}
|
|
173
|
+
const sandboxId = failure?.sandbox_id;
|
|
174
|
+
const rawReason = failure?.reason ?? failure?.termination_reason;
|
|
175
|
+
const reason = typeof rawReason === "string" ? rawReason : void 0;
|
|
176
|
+
const errorDetails = failure?.error_details;
|
|
177
|
+
let displayMessage = message;
|
|
178
|
+
if (failure) {
|
|
179
|
+
displayMessage = `Sandbox ${sandboxId} ${failure.status}`;
|
|
180
|
+
if (reason) displayMessage += ` (${reason})`;
|
|
181
|
+
const detail = formatErrorDetails(errorDetails);
|
|
182
|
+
if (detail) displayMessage += `: ${detail}`;
|
|
183
|
+
if (!reason && !detail) displayMessage = message;
|
|
184
|
+
}
|
|
185
|
+
super(`API error (status ${statusCode}): ${displayMessage}`);
|
|
186
|
+
this.sandboxId = sandboxId;
|
|
187
|
+
this.reason = reason;
|
|
188
|
+
this.errorDetails = errorDetails;
|
|
138
189
|
this.name = "RemoteAPIError";
|
|
139
190
|
this.statusCode = statusCode;
|
|
140
191
|
this.responseMessage = message;
|