@luxorai/sandbox
Version:
TypeScript SDK for Luxor Sandbox: cloud sandboxes (microVMs) for AI agents on Luxor Agent Cloud
79 lines • 4.89 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TiB = exports.GiB = exports.MiB = exports.KiB = exports.TB = exports.GB = exports.MB = exports.KB = exports.Byte = exports.POLL_INTERVAL_MS = exports.DEFAULT_DISK_SIZE_GB = exports.DEFAULT_MEMORY_MB = exports.DEFAULT_CPU_CORES = exports.DEFAULT_VOLUME_DETACH_TIMEOUT_MS = exports.DEFAULT_EXEC_TIMEOUT_MS = exports.DEFAULT_RESTORE_TIMEOUT_MS = exports.SNAPSHOT_NOT_FOUND_GRACE_MS = exports.DEFAULT_SNAPSHOT_CREATE_TIMEOUT_MS = exports.DEFAULT_TEMPLATE_SPEC_CREATE_TIMEOUT_MS = exports.DEFAULT_SESSION_CREATE_TIMEOUT_MS = exports.DEFAULT_DATA_PLANE_READY_TIMEOUT_MS = exports.DEFAULT_TIMEOUT_MS = exports.SDK_USER_AGENT = exports.DEFAULT_BASE_URL = exports.API_KEY_PREFIXES = exports.RUN_TRACE_TIMING_ENVS = exports.CLOUD_API_URL_ENVS = exports.GATEWAY_URL_ENVS = exports.BASE_URL_ENVS = exports.AUTH_TOKEN_ENVS = exports.ENV_RUN_TRACE_TIMING = exports.ENV_CLOUD_API_URL = exports.ENV_GATEWAY_URL = exports.ENV_API_URL = exports.ENV_API_ENDPOINT = exports.ENV_API_KEY = exports.ENV_AUTH_TOKEN = exports.ENV_LUXOR_RUN_TRACE_TIMING = exports.ENV_LUXOR_CLOUD_API_URL = exports.ENV_LUXOR_GATEWAY_URL = exports.ENV_LUXOR_API_URL = exports.ENV_LUXOR_API_ENDPOINT = exports.ENV_LUXOR_API_KEY = exports.ENV_LUXOR_AUTH_TOKEN = exports.SDK_VERSION = void 0;
exports.pollBackoffMs = pollBackoffMs;
exports.snapshotReadyPollDelayMs = snapshotReadyPollDelayMs;
const version_js_1 = require("./version.js");
Object.defineProperty(exports, "SDK_VERSION", { enumerable: true, get: function () { return version_js_1.SDK_VERSION; } });
exports.ENV_LUXOR_AUTH_TOKEN = "LUXOR_AUTH_TOKEN";
exports.ENV_LUXOR_API_KEY = "LUXOR_API_KEY";
exports.ENV_LUXOR_API_ENDPOINT = "LUXOR_API_ENDPOINT";
exports.ENV_LUXOR_API_URL = "LUXOR_API_URL";
exports.ENV_LUXOR_GATEWAY_URL = "LUXOR_SANDBOX_GATEWAY_URL";
exports.ENV_LUXOR_CLOUD_API_URL = "LUXOR_CLOUD_API_URL";
exports.ENV_LUXOR_RUN_TRACE_TIMING = "LUXOR_SDK_RUN_TRACE_TIMING";
exports.ENV_AUTH_TOKEN = "TENKI_AUTH_TOKEN";
exports.ENV_API_KEY = "TENKI_API_KEY";
exports.ENV_API_ENDPOINT = "TENKI_API_ENDPOINT";
exports.ENV_API_URL = "TENKI_API_URL";
exports.ENV_GATEWAY_URL = "TENKI_SANDBOX_GATEWAY_URL";
exports.ENV_CLOUD_API_URL = "TENKI_CLOUD_API_URL";
exports.ENV_RUN_TRACE_TIMING = "TENKI_SDK_RUN_TRACE_TIMING";
// Precedence order: every LUXOR_* name before its TENKI_* fallback.
exports.AUTH_TOKEN_ENVS = [exports.ENV_LUXOR_AUTH_TOKEN, exports.ENV_LUXOR_API_KEY, exports.ENV_AUTH_TOKEN, exports.ENV_API_KEY];
exports.BASE_URL_ENVS = [exports.ENV_LUXOR_API_ENDPOINT, exports.ENV_LUXOR_API_URL, exports.ENV_API_ENDPOINT, exports.ENV_API_URL];
exports.GATEWAY_URL_ENVS = [exports.ENV_LUXOR_GATEWAY_URL, exports.ENV_GATEWAY_URL];
exports.CLOUD_API_URL_ENVS = [exports.ENV_LUXOR_CLOUD_API_URL, exports.ENV_CLOUD_API_URL];
exports.RUN_TRACE_TIMING_ENVS = [exports.ENV_LUXOR_RUN_TRACE_TIMING, exports.ENV_RUN_TRACE_TIMING];
exports.API_KEY_PREFIXES = ["lx_", "tk_"];
exports.DEFAULT_BASE_URL = "https://api.luxor.ai";
exports.SDK_USER_AGENT = `luxor-sandbox-typescript/${version_js_1.SDK_VERSION}`;
exports.DEFAULT_TIMEOUT_MS = 30_000;
exports.DEFAULT_DATA_PLANE_READY_TIMEOUT_MS = 60_000;
exports.DEFAULT_SESSION_CREATE_TIMEOUT_MS = 3 * 60_000;
exports.DEFAULT_TEMPLATE_SPEC_CREATE_TIMEOUT_MS = 2 * 60 * 60_000;
exports.DEFAULT_SNAPSHOT_CREATE_TIMEOUT_MS = 5 * 60_000;
/** Snapshot waits retry "not found" this long: a lagging read replica may not have a just-created snapshot yet. */
exports.SNAPSHOT_NOT_FOUND_GRACE_MS = 10_000;
exports.DEFAULT_RESTORE_TIMEOUT_MS = 5 * 60_000;
exports.DEFAULT_EXEC_TIMEOUT_MS = 30_000;
exports.DEFAULT_VOLUME_DETACH_TIMEOUT_MS = 2 * 60_000;
exports.DEFAULT_CPU_CORES = 2;
exports.DEFAULT_MEMORY_MB = 4096;
exports.DEFAULT_DISK_SIZE_GB = 5;
exports.POLL_INTERVAL_MS = 2_000;
// pollBackoffMs returns the delay before the next poll attempt.
// Starts at 100ms and ramps to a 2s steady state so fast operations
// (snapshot restore ~1.5s) are observed promptly without hammering
// the server on long-running ones.
function pollBackoffMs(attempt) {
if (attempt <= 0)
return 100;
if (attempt === 1)
return 250;
if (attempt === 2)
return 500;
if (attempt === 3)
return 1_000;
return 2_000;
}
// snapshotReadyPollDelayMs is the delay before the next snapshot readiness poll.
// Most snapshots are ready within a few seconds, so poll tightly then back off.
function snapshotReadyPollDelayMs(elapsedMs) {
if (elapsedMs < 3_000)
return 100;
if (elapsedMs < 15_000)
return 250;
return 1_000;
}
// Size helpers
exports.Byte = 1;
exports.KB = 1_000;
exports.MB = 1_000_000;
exports.GB = 1_000_000_000;
exports.TB = 1_000_000_000_000;
exports.KiB = 1_024;
exports.MiB = 1_048_576;
exports.GiB = 1_073_741_824;
exports.TiB = 1_099_511_627_776;
//# sourceMappingURL=constants.js.map