@fastgpt-sdk/sandbox-adapter 0.0.13 → 0.0.14
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.js +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -845,14 +845,14 @@ class SealosDevboxAdapter extends BaseSandboxAdapter {
|
|
|
845
845
|
}
|
|
846
846
|
}
|
|
847
847
|
async execute(command, options) {
|
|
848
|
-
const cmd = options?.workingDirectory ? [`cd ${options.workingDirectory} && ${command}`] : [command];
|
|
848
|
+
const cmd = options?.workingDirectory ? ["sh", "-lc", `cd ${options.workingDirectory} && ${command}`] : ["sh", "-lc", command];
|
|
849
849
|
try {
|
|
850
850
|
const res = await this.api.exec(this._id, {
|
|
851
851
|
command: cmd,
|
|
852
852
|
timeoutSeconds: options?.timeoutMs ? Math.ceil(options.timeoutMs / 1000) : undefined
|
|
853
853
|
});
|
|
854
854
|
if (!res.data) {
|
|
855
|
-
throw new CommandExecutionError(`Command execution failed: ${
|
|
855
|
+
throw new CommandExecutionError(`Command execution failed: ${res.message}`, command);
|
|
856
856
|
}
|
|
857
857
|
return {
|
|
858
858
|
stdout: res.data.stdout,
|
|
@@ -860,7 +860,7 @@ class SealosDevboxAdapter extends BaseSandboxAdapter {
|
|
|
860
860
|
exitCode: res.data.exitCode
|
|
861
861
|
};
|
|
862
862
|
} catch (error) {
|
|
863
|
-
throw new CommandExecutionError(`Command execution failed: ${
|
|
863
|
+
throw new CommandExecutionError(`Command execution failed: ${error?.message || error?.code}`, command, error instanceof Error ? error : undefined);
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
866
|
async ping() {
|
|
@@ -1080,7 +1080,7 @@ class OpenSandboxAdapter extends BaseSandboxAdapter {
|
|
|
1080
1080
|
resourceLimits: this.parseResourceLimits(info.resourceLimits)
|
|
1081
1081
|
};
|
|
1082
1082
|
} catch (error) {
|
|
1083
|
-
throw new CommandExecutionError(
|
|
1083
|
+
throw new CommandExecutionError(`Failed to get sandbox info: ${error?.message || error?.code}`, "getInfo", error instanceof Error ? error : undefined);
|
|
1084
1084
|
}
|
|
1085
1085
|
}
|
|
1086
1086
|
async renewExpiration(additionalSeconds) {
|
package/package.json
CHANGED