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