modal 0.5.6 → 0.6.0
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/index.cjs +33 -5
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +33 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -45741,11 +45741,19 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
|
|
|
45741
45741
|
idleTimeout: "idleTimeoutMs"
|
|
45742
45742
|
});
|
|
45743
45743
|
const gpuConfig = parseGpuConfig(params.gpu);
|
|
45744
|
+
if (params.timeoutMs != void 0 && params.timeoutMs <= 0) {
|
|
45745
|
+
throw new Error(`timeoutMs must be positive, got ${params.timeoutMs}`);
|
|
45746
|
+
}
|
|
45744
45747
|
if (params.timeoutMs && params.timeoutMs % 1e3 !== 0) {
|
|
45745
45748
|
throw new Error(
|
|
45746
45749
|
`timeoutMs must be a multiple of 1000ms, got ${params.timeoutMs}`
|
|
45747
45750
|
);
|
|
45748
45751
|
}
|
|
45752
|
+
if (params.idleTimeoutMs != void 0 && params.idleTimeoutMs <= 0) {
|
|
45753
|
+
throw new Error(
|
|
45754
|
+
`idleTimeoutMs must be positive, got ${params.idleTimeoutMs}`
|
|
45755
|
+
);
|
|
45756
|
+
}
|
|
45749
45757
|
if (params.idleTimeoutMs && params.idleTimeoutMs % 1e3 !== 0) {
|
|
45750
45758
|
throw new Error(
|
|
45751
45759
|
`idleTimeoutMs must be a multiple of 1000ms, got ${params.idleTimeoutMs}`
|
|
@@ -45867,13 +45875,24 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
|
|
|
45867
45875
|
memoryMbMax = params.memoryLimitMiB;
|
|
45868
45876
|
}
|
|
45869
45877
|
}
|
|
45878
|
+
const protoExperimentalOptions = params.experimentalOptions ? Object.entries(params.experimentalOptions).reduce(
|
|
45879
|
+
(acc, [name, value]) => {
|
|
45880
|
+
if (typeof value !== "boolean") {
|
|
45881
|
+
throw new Error(
|
|
45882
|
+
`experimental option '${name}' must be a boolean, got ${value}`
|
|
45883
|
+
);
|
|
45884
|
+
}
|
|
45885
|
+
acc[name] = Boolean(value);
|
|
45886
|
+
return acc;
|
|
45887
|
+
},
|
|
45888
|
+
{}
|
|
45889
|
+
) : {};
|
|
45870
45890
|
return SandboxCreateRequest.create({
|
|
45871
45891
|
appId,
|
|
45872
45892
|
definition: {
|
|
45873
|
-
|
|
45874
|
-
entrypointArgs: params.command ?? ["sleep", "48h"],
|
|
45893
|
+
entrypointArgs: params.command ?? [],
|
|
45875
45894
|
imageId,
|
|
45876
|
-
timeoutSecs: params.timeoutMs != void 0 ? params.timeoutMs / 1e3 :
|
|
45895
|
+
timeoutSecs: params.timeoutMs != void 0 ? params.timeoutMs / 1e3 : 300,
|
|
45877
45896
|
idleTimeoutSecs: params.idleTimeoutMs != void 0 ? params.idleTimeoutMs / 1e3 : void 0,
|
|
45878
45897
|
workdir: params.workdir ?? void 0,
|
|
45879
45898
|
networkAccess,
|
|
@@ -45893,7 +45912,8 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
|
|
|
45893
45912
|
schedulerPlacement,
|
|
45894
45913
|
verbose: params.verbose ?? false,
|
|
45895
45914
|
proxyId: params.proxy?.proxyId,
|
|
45896
|
-
name: params.name
|
|
45915
|
+
name: params.name,
|
|
45916
|
+
experimentalOptions: protoExperimentalOptions
|
|
45897
45917
|
}
|
|
45898
45918
|
});
|
|
45899
45919
|
}
|
|
@@ -46062,6 +46082,14 @@ function defaultSandboxPTYInfo() {
|
|
|
46062
46082
|
}
|
|
46063
46083
|
async function buildContainerExecRequestProto(taskId, command, params) {
|
|
46064
46084
|
checkForRenamedParams(params, { timeout: "timeoutMs" });
|
|
46085
|
+
if (params?.timeoutMs != void 0 && params.timeoutMs <= 0) {
|
|
46086
|
+
throw new Error(`timeoutMs must be positive, got ${params.timeoutMs}`);
|
|
46087
|
+
}
|
|
46088
|
+
if (params?.timeoutMs && params.timeoutMs % 1e3 !== 0) {
|
|
46089
|
+
throw new Error(
|
|
46090
|
+
`timeoutMs must be a multiple of 1000ms, got ${params.timeoutMs}`
|
|
46091
|
+
);
|
|
46092
|
+
}
|
|
46065
46093
|
const secretIds = (params?.secrets || []).map((secret) => secret.secretId);
|
|
46066
46094
|
let ptyInfo;
|
|
46067
46095
|
if (params?.pty) {
|
|
@@ -46832,7 +46860,7 @@ var AuthTokenManager = class {
|
|
|
46832
46860
|
|
|
46833
46861
|
// src/version.ts
|
|
46834
46862
|
function getSDKVersion() {
|
|
46835
|
-
return true ? "0.
|
|
46863
|
+
return true ? "0.6.0" : "0.0.0";
|
|
46836
46864
|
}
|
|
46837
46865
|
|
|
46838
46866
|
// src/logger.ts
|
package/dist/index.d.cts
CHANGED
|
@@ -5712,7 +5712,7 @@ type SandboxCreateParams = {
|
|
|
5712
5712
|
memoryLimitMiB?: number;
|
|
5713
5713
|
/** GPU reservation for the Sandbox (e.g. "A100", "T4:2", "A100-80GB:4"). */
|
|
5714
5714
|
gpu?: string;
|
|
5715
|
-
/**
|
|
5715
|
+
/** Maximum lifetime of the Sandbox in milliseconds. Defaults to 5 minutes. */
|
|
5716
5716
|
timeoutMs?: number;
|
|
5717
5717
|
/** The amount of time in milliseconds that a Sandbox can be idle before being terminated. */
|
|
5718
5718
|
idleTimeoutMs?: number;
|
|
@@ -5753,6 +5753,8 @@ type SandboxCreateParams = {
|
|
|
5753
5753
|
proxy?: Proxy;
|
|
5754
5754
|
/** Optional name for the Sandbox. Unique within an App. */
|
|
5755
5755
|
name?: string;
|
|
5756
|
+
/** Optional experimental options. */
|
|
5757
|
+
experimentalOptions?: Record<string, any>;
|
|
5756
5758
|
};
|
|
5757
5759
|
/**
|
|
5758
5760
|
* Service for managing {@link Sandbox}es.
|
package/dist/index.d.ts
CHANGED
|
@@ -5712,7 +5712,7 @@ type SandboxCreateParams = {
|
|
|
5712
5712
|
memoryLimitMiB?: number;
|
|
5713
5713
|
/** GPU reservation for the Sandbox (e.g. "A100", "T4:2", "A100-80GB:4"). */
|
|
5714
5714
|
gpu?: string;
|
|
5715
|
-
/**
|
|
5715
|
+
/** Maximum lifetime of the Sandbox in milliseconds. Defaults to 5 minutes. */
|
|
5716
5716
|
timeoutMs?: number;
|
|
5717
5717
|
/** The amount of time in milliseconds that a Sandbox can be idle before being terminated. */
|
|
5718
5718
|
idleTimeoutMs?: number;
|
|
@@ -5753,6 +5753,8 @@ type SandboxCreateParams = {
|
|
|
5753
5753
|
proxy?: Proxy;
|
|
5754
5754
|
/** Optional name for the Sandbox. Unique within an App. */
|
|
5755
5755
|
name?: string;
|
|
5756
|
+
/** Optional experimental options. */
|
|
5757
|
+
experimentalOptions?: Record<string, any>;
|
|
5756
5758
|
};
|
|
5757
5759
|
/**
|
|
5758
5760
|
* Service for managing {@link Sandbox}es.
|
package/dist/index.js
CHANGED
|
@@ -45673,11 +45673,19 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
|
|
|
45673
45673
|
idleTimeout: "idleTimeoutMs"
|
|
45674
45674
|
});
|
|
45675
45675
|
const gpuConfig = parseGpuConfig(params.gpu);
|
|
45676
|
+
if (params.timeoutMs != void 0 && params.timeoutMs <= 0) {
|
|
45677
|
+
throw new Error(`timeoutMs must be positive, got ${params.timeoutMs}`);
|
|
45678
|
+
}
|
|
45676
45679
|
if (params.timeoutMs && params.timeoutMs % 1e3 !== 0) {
|
|
45677
45680
|
throw new Error(
|
|
45678
45681
|
`timeoutMs must be a multiple of 1000ms, got ${params.timeoutMs}`
|
|
45679
45682
|
);
|
|
45680
45683
|
}
|
|
45684
|
+
if (params.idleTimeoutMs != void 0 && params.idleTimeoutMs <= 0) {
|
|
45685
|
+
throw new Error(
|
|
45686
|
+
`idleTimeoutMs must be positive, got ${params.idleTimeoutMs}`
|
|
45687
|
+
);
|
|
45688
|
+
}
|
|
45681
45689
|
if (params.idleTimeoutMs && params.idleTimeoutMs % 1e3 !== 0) {
|
|
45682
45690
|
throw new Error(
|
|
45683
45691
|
`idleTimeoutMs must be a multiple of 1000ms, got ${params.idleTimeoutMs}`
|
|
@@ -45799,13 +45807,24 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
|
|
|
45799
45807
|
memoryMbMax = params.memoryLimitMiB;
|
|
45800
45808
|
}
|
|
45801
45809
|
}
|
|
45810
|
+
const protoExperimentalOptions = params.experimentalOptions ? Object.entries(params.experimentalOptions).reduce(
|
|
45811
|
+
(acc, [name, value]) => {
|
|
45812
|
+
if (typeof value !== "boolean") {
|
|
45813
|
+
throw new Error(
|
|
45814
|
+
`experimental option '${name}' must be a boolean, got ${value}`
|
|
45815
|
+
);
|
|
45816
|
+
}
|
|
45817
|
+
acc[name] = Boolean(value);
|
|
45818
|
+
return acc;
|
|
45819
|
+
},
|
|
45820
|
+
{}
|
|
45821
|
+
) : {};
|
|
45802
45822
|
return SandboxCreateRequest.create({
|
|
45803
45823
|
appId,
|
|
45804
45824
|
definition: {
|
|
45805
|
-
|
|
45806
|
-
entrypointArgs: params.command ?? ["sleep", "48h"],
|
|
45825
|
+
entrypointArgs: params.command ?? [],
|
|
45807
45826
|
imageId,
|
|
45808
|
-
timeoutSecs: params.timeoutMs != void 0 ? params.timeoutMs / 1e3 :
|
|
45827
|
+
timeoutSecs: params.timeoutMs != void 0 ? params.timeoutMs / 1e3 : 300,
|
|
45809
45828
|
idleTimeoutSecs: params.idleTimeoutMs != void 0 ? params.idleTimeoutMs / 1e3 : void 0,
|
|
45810
45829
|
workdir: params.workdir ?? void 0,
|
|
45811
45830
|
networkAccess,
|
|
@@ -45825,7 +45844,8 @@ async function buildSandboxCreateRequestProto(appId, imageId, params = {}) {
|
|
|
45825
45844
|
schedulerPlacement,
|
|
45826
45845
|
verbose: params.verbose ?? false,
|
|
45827
45846
|
proxyId: params.proxy?.proxyId,
|
|
45828
|
-
name: params.name
|
|
45847
|
+
name: params.name,
|
|
45848
|
+
experimentalOptions: protoExperimentalOptions
|
|
45829
45849
|
}
|
|
45830
45850
|
});
|
|
45831
45851
|
}
|
|
@@ -45994,6 +46014,14 @@ function defaultSandboxPTYInfo() {
|
|
|
45994
46014
|
}
|
|
45995
46015
|
async function buildContainerExecRequestProto(taskId, command, params) {
|
|
45996
46016
|
checkForRenamedParams(params, { timeout: "timeoutMs" });
|
|
46017
|
+
if (params?.timeoutMs != void 0 && params.timeoutMs <= 0) {
|
|
46018
|
+
throw new Error(`timeoutMs must be positive, got ${params.timeoutMs}`);
|
|
46019
|
+
}
|
|
46020
|
+
if (params?.timeoutMs && params.timeoutMs % 1e3 !== 0) {
|
|
46021
|
+
throw new Error(
|
|
46022
|
+
`timeoutMs must be a multiple of 1000ms, got ${params.timeoutMs}`
|
|
46023
|
+
);
|
|
46024
|
+
}
|
|
45997
46025
|
const secretIds = (params?.secrets || []).map((secret) => secret.secretId);
|
|
45998
46026
|
let ptyInfo;
|
|
45999
46027
|
if (params?.pty) {
|
|
@@ -46764,7 +46792,7 @@ var AuthTokenManager = class {
|
|
|
46764
46792
|
|
|
46765
46793
|
// src/version.ts
|
|
46766
46794
|
function getSDKVersion() {
|
|
46767
|
-
return true ? "0.
|
|
46795
|
+
return true ? "0.6.0" : "0.0.0";
|
|
46768
46796
|
}
|
|
46769
46797
|
|
|
46770
46798
|
// src/logger.ts
|