sandbox 3.0.0-beta.4 → 3.0.0-beta.6
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.
|
@@ -7427,7 +7427,7 @@ const scope = {
|
|
|
7427
7427
|
|
|
7428
7428
|
//#endregion
|
|
7429
7429
|
//#region package.json
|
|
7430
|
-
var version = "3.0.0-beta.
|
|
7430
|
+
var version = "3.0.0-beta.6";
|
|
7431
7431
|
|
|
7432
7432
|
//#endregion
|
|
7433
7433
|
//#region src/error.ts
|
|
@@ -11251,16 +11251,23 @@ var import_ms$3 = /* @__PURE__ */ __toESM(require_ms());
|
|
|
11251
11251
|
const debug$2 = createDebugger("sandbox:timeout");
|
|
11252
11252
|
const BUFFER = (0, import_ms$3.default)("10 seconds");
|
|
11253
11253
|
async function extendSandboxTimeoutPeriodically(sandbox, signal) {
|
|
11254
|
-
const
|
|
11254
|
+
const session = sandbox.currentSession();
|
|
11255
|
+
const timeout$1 = session.timeout;
|
|
11256
|
+
if (timeout$1 == null) return;
|
|
11257
|
+
const nextTick = session.createdAt.getTime() + timeout$1;
|
|
11255
11258
|
debug$2(`next tick: ${new Date(nextTick).toISOString()}`);
|
|
11256
11259
|
while (!signal.aborted) {
|
|
11257
|
-
const
|
|
11258
|
-
if (
|
|
11259
|
-
|
|
11260
|
-
|
|
11260
|
+
const currentTimeout = session.timeout;
|
|
11261
|
+
if (currentTimeout == null) return;
|
|
11262
|
+
const sleepMs = session.createdAt.getTime() + currentTimeout - Date.now() - BUFFER;
|
|
11263
|
+
if (sleepMs > 2e3) {
|
|
11264
|
+
debug$2(`sleeping for ${sleepMs}ms until next timeout extension`);
|
|
11265
|
+
await setTimeout$1(sleepMs, null, { signal });
|
|
11261
11266
|
}
|
|
11262
11267
|
await sandbox.extendTimeout((0, import_ms$3.default)("5 minutes"));
|
|
11263
|
-
const
|
|
11268
|
+
const updatedTimeout = session.timeout;
|
|
11269
|
+
if (updatedTimeout == null) return;
|
|
11270
|
+
const nextTick$1 = session.createdAt.getTime() + updatedTimeout;
|
|
11264
11271
|
debug$2(`extended sandbox timeout by 5 minutes. next tick: ${new Date(nextTick$1).toISOString()}`);
|
|
11265
11272
|
}
|
|
11266
11273
|
}
|
|
@@ -11980,10 +11987,10 @@ const list = import_cjs$12.command({
|
|
|
11980
11987
|
color: (s$1) => SandboxStatusColor[s$1.status] ?? source_default.reset
|
|
11981
11988
|
},
|
|
11982
11989
|
CREATED: { value: (s$1) => timeAgo(s$1.createdAt) },
|
|
11983
|
-
MEMORY: { value: (s$1) => memoryFormatter.format(s$1.memory) },
|
|
11984
|
-
VCPUS: { value: (s$1) => s$1.vcpus },
|
|
11985
|
-
RUNTIME: { value: (s$1) => s$1.runtime },
|
|
11986
|
-
TIMEOUT: { value: (s$1) => timeAgo(s$1.createdAt + s$1.timeout) },
|
|
11990
|
+
MEMORY: { value: (s$1) => s$1.memory != null ? memoryFormatter.format(s$1.memory) : "-" },
|
|
11991
|
+
VCPUS: { value: (s$1) => s$1.vcpus ?? "-" },
|
|
11992
|
+
RUNTIME: { value: (s$1) => s$1.runtime ?? "-" },
|
|
11993
|
+
TIMEOUT: { value: (s$1) => s$1.timeout != null ? timeAgo(s$1.createdAt + s$1.timeout) : "-" },
|
|
11987
11994
|
SNAPSHOT: { value: (s$1) => s$1.currentSnapshotId ?? "-" }
|
|
11988
11995
|
};
|
|
11989
11996
|
if (all) {
|
|
@@ -14358,13 +14365,9 @@ const remove = import_cjs$9.command({
|
|
|
14358
14365
|
type: sandboxName,
|
|
14359
14366
|
description: "more sandboxes to remove"
|
|
14360
14367
|
}),
|
|
14361
|
-
preserveSnapshots: import_cjs$9.flag({
|
|
14362
|
-
long: "preserve-snapshots",
|
|
14363
|
-
description: "Keep snapshots when removing the sandbox"
|
|
14364
|
-
}),
|
|
14365
14368
|
scope
|
|
14366
14369
|
},
|
|
14367
|
-
async handler({ scope: { token: token$1, team: team$1, project: project$1 }, sandboxName: sandboxName$1, sandboxNames
|
|
14370
|
+
async handler({ scope: { token: token$1, team: team$1, project: project$1 }, sandboxName: sandboxName$1, sandboxNames }) {
|
|
14368
14371
|
await new Listr(Array.from(new Set([sandboxName$1, ...sandboxNames]), (name) => ({
|
|
14369
14372
|
title: `Removing sandbox ${name}`,
|
|
14370
14373
|
async task() {
|
|
@@ -14373,7 +14376,7 @@ const remove = import_cjs$9.command({
|
|
|
14373
14376
|
teamId: team$1,
|
|
14374
14377
|
projectId: project$1,
|
|
14375
14378
|
name
|
|
14376
|
-
})).delete(
|
|
14379
|
+
})).delete();
|
|
14377
14380
|
}
|
|
14378
14381
|
})), { concurrent: true }).run();
|
|
14379
14382
|
}
|
|
@@ -14582,7 +14585,7 @@ const list$2 = import_cjs$4.command({
|
|
|
14582
14585
|
CREATED: { value: (s$1) => timeAgo(s$1.createdAt) },
|
|
14583
14586
|
EXPIRATION: { value: (s$1) => s$1.status === "deleted" ? source_default.gray.dim("deleted") : timeAgo(s$1.expiresAt) },
|
|
14584
14587
|
SIZE: { value: (s$1) => formatBytes(s$1.sizeBytes) },
|
|
14585
|
-
["SOURCE SESSION"]: { value: (s$1) => s$1.
|
|
14588
|
+
["SOURCE SESSION"]: { value: (s$1) => s$1.sourceSessionId }
|
|
14586
14589
|
}
|
|
14587
14590
|
}));
|
|
14588
14591
|
}
|
|
@@ -14625,7 +14628,7 @@ const get = import_cjs$4.command({
|
|
|
14625
14628
|
CREATED: { value: (s$1) => timeAgo(s$1.createdAt) },
|
|
14626
14629
|
EXPIRATION: { value: (s$1) => s$1.status === "deleted" ? source_default.gray.dim("deleted") : timeAgo(s$1.expiresAt) },
|
|
14627
14630
|
SIZE: { value: (s$1) => formatBytes(s$1.sizeBytes) },
|
|
14628
|
-
["SOURCE SESSION"]: { value: (s$1) => s$1.
|
|
14631
|
+
["SOURCE SESSION"]: { value: (s$1) => s$1.sourceSessionId }
|
|
14629
14632
|
}
|
|
14630
14633
|
}));
|
|
14631
14634
|
}
|
|
@@ -14711,7 +14714,7 @@ const list$1 = import_cjs$2.command({
|
|
|
14711
14714
|
} finally {
|
|
14712
14715
|
_usingCtx$1.d();
|
|
14713
14716
|
}
|
|
14714
|
-
})()).json.
|
|
14717
|
+
})()).json.sessions;
|
|
14715
14718
|
console.log(table({
|
|
14716
14719
|
rows: sessions$1,
|
|
14717
14720
|
columns: {
|
|
@@ -14883,11 +14886,11 @@ const listCommand = import_cjs$1.command({
|
|
|
14883
14886
|
const rows = [
|
|
14884
14887
|
{
|
|
14885
14888
|
field: "vCPUs",
|
|
14886
|
-
value: String(sandbox.vcpus)
|
|
14889
|
+
value: String(sandbox.vcpus ?? "-")
|
|
14887
14890
|
},
|
|
14888
14891
|
{
|
|
14889
14892
|
field: "Timeout",
|
|
14890
|
-
value: (0, import_ms.default)(sandbox.timeout, { long: true })
|
|
14893
|
+
value: sandbox.timeout != null ? (0, import_ms.default)(sandbox.timeout, { long: true }) : "-"
|
|
14891
14894
|
},
|
|
14892
14895
|
{
|
|
14893
14896
|
field: "Persistent",
|
|
@@ -15006,4 +15009,4 @@ const app = (opts) => (0, import_cjs.subcommands)({
|
|
|
15006
15009
|
|
|
15007
15010
|
//#endregion
|
|
15008
15011
|
export { source_exports as a, init_source as i, StyledError as n, require_cjs as r, app as t };
|
|
15009
|
-
//# sourceMappingURL=app-
|
|
15012
|
+
//# sourceMappingURL=app-DsLg3lBk.mjs.map
|