ppio-sandbox 1.0.1 → 1.0.2
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/{chunk-7OUSMPTE.mjs → chunk-DTP6KHRO.mjs} +38 -26
- package/dist/chunk-DTP6KHRO.mjs.map +1 -0
- package/dist/code-interpreter.d.mts +2 -2
- package/dist/code-interpreter.d.ts +2 -2
- package/dist/code-interpreter.js +37 -25
- package/dist/code-interpreter.js.map +1 -1
- package/dist/code-interpreter.mjs +1 -1
- package/dist/desktop.d.mts +2 -2
- package/dist/desktop.d.ts +2 -2
- package/dist/desktop.js +37 -25
- package/dist/desktop.js.map +1 -1
- package/dist/desktop.mjs +1 -1
- package/dist/{index-D9GCzBVP.d.mts → index-DVtYWWe-.d.mts} +60 -0
- package/dist/{index-D9GCzBVP.d.ts → index-DVtYWWe-.d.ts} +60 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +37 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +4 -4
- package/dist/chunk-7OUSMPTE.mjs.map +0 -1
package/dist/code-interpreter.js
CHANGED
|
@@ -90,7 +90,7 @@ var import_openapi_fetch = __toESM(require("openapi-fetch"));
|
|
|
90
90
|
var import_platform = __toESM(require("platform"));
|
|
91
91
|
|
|
92
92
|
// package.json
|
|
93
|
-
var version = "1.0.
|
|
93
|
+
var version = "1.0.2";
|
|
94
94
|
|
|
95
95
|
// src/core/api/metadata.ts
|
|
96
96
|
function getRuntime() {
|
|
@@ -1782,6 +1782,39 @@ var SandboxApi = class {
|
|
|
1782
1782
|
}
|
|
1783
1783
|
return true;
|
|
1784
1784
|
}
|
|
1785
|
+
static async connectSandbox(sandboxId, opts) {
|
|
1786
|
+
var _a2, _b;
|
|
1787
|
+
const timeoutMs = (_a2 = opts == null ? void 0 : opts.timeoutMs) != null ? _a2 : DEFAULT_SANDBOX_TIMEOUT_MS;
|
|
1788
|
+
const config = new ConnectionConfig(opts);
|
|
1789
|
+
const client = new ApiClient(config);
|
|
1790
|
+
const res = await client.api.POST("/sandboxes/{sandboxID}/connect", {
|
|
1791
|
+
params: {
|
|
1792
|
+
path: {
|
|
1793
|
+
sandboxID: sandboxId
|
|
1794
|
+
}
|
|
1795
|
+
},
|
|
1796
|
+
body: {
|
|
1797
|
+
timeout: timeoutToSeconds(timeoutMs)
|
|
1798
|
+
},
|
|
1799
|
+
signal: config.getSignal(opts == null ? void 0 : opts.requestTimeoutMs)
|
|
1800
|
+
});
|
|
1801
|
+
if (((_b = res.error) == null ? void 0 : _b.code) === 404) {
|
|
1802
|
+
throw new NotFoundError(`Sandbox ${sandboxId} not found`);
|
|
1803
|
+
}
|
|
1804
|
+
const err = handleApiError(res);
|
|
1805
|
+
if (err) {
|
|
1806
|
+
throw err;
|
|
1807
|
+
}
|
|
1808
|
+
if (!res.data) {
|
|
1809
|
+
throw new Error("Sandbox not found");
|
|
1810
|
+
}
|
|
1811
|
+
return {
|
|
1812
|
+
sandboxId: `${res.data.sandboxID}-${res.data.clientID}`,
|
|
1813
|
+
envdVersion: res.data.envdVersion,
|
|
1814
|
+
envdAccessToken: res.data.envdAccessToken,
|
|
1815
|
+
sandboxDomain: void 0
|
|
1816
|
+
};
|
|
1817
|
+
}
|
|
1785
1818
|
};
|
|
1786
1819
|
var SandboxPaginator = class {
|
|
1787
1820
|
constructor(opts) {
|
|
@@ -1986,23 +2019,10 @@ var Sandbox = class extends SandboxApi {
|
|
|
1986
2019
|
* ```
|
|
1987
2020
|
*/
|
|
1988
2021
|
static async connect(sandboxId, opts) {
|
|
1989
|
-
|
|
1990
|
-
await SandboxApi.setTimeout(
|
|
1991
|
-
sandboxId,
|
|
1992
|
-
(opts == null ? void 0 : opts.timeoutMs) || DEFAULT_SANDBOX_TIMEOUT_MS,
|
|
1993
|
-
opts
|
|
1994
|
-
);
|
|
1995
|
-
} catch (e) {
|
|
1996
|
-
if (e instanceof SandboxError) {
|
|
1997
|
-
await SandboxApi.resumeSandbox(sandboxId, opts);
|
|
1998
|
-
} else {
|
|
1999
|
-
throw e;
|
|
2000
|
-
}
|
|
2001
|
-
}
|
|
2002
|
-
const info = await SandboxApi.getFullInfo(sandboxId, opts);
|
|
2022
|
+
const info = await SandboxApi.connectSandbox(sandboxId, opts);
|
|
2003
2023
|
const config = new ConnectionConfig(opts);
|
|
2004
2024
|
return new this(__spreadValues({
|
|
2005
|
-
sandboxId,
|
|
2025
|
+
sandboxId: info.sandboxId,
|
|
2006
2026
|
sandboxDomain: info.sandboxDomain,
|
|
2007
2027
|
envdAccessToken: info.envdAccessToken,
|
|
2008
2028
|
envdVersion: info.envdVersion
|
|
@@ -2028,15 +2048,7 @@ var Sandbox = class extends SandboxApi {
|
|
|
2028
2048
|
* ```
|
|
2029
2049
|
*/
|
|
2030
2050
|
async connect(opts) {
|
|
2031
|
-
|
|
2032
|
-
await SandboxApi.setTimeout(
|
|
2033
|
-
this.sandboxId,
|
|
2034
|
-
(opts == null ? void 0 : opts.timeoutMs) || DEFAULT_SANDBOX_TIMEOUT_MS,
|
|
2035
|
-
opts
|
|
2036
|
-
);
|
|
2037
|
-
} catch (e) {
|
|
2038
|
-
await SandboxApi.resumeSandbox(this.sandboxId, opts);
|
|
2039
|
-
}
|
|
2051
|
+
await SandboxApi.connectSandbox(this.sandboxId, opts);
|
|
2040
2052
|
return this;
|
|
2041
2053
|
}
|
|
2042
2054
|
/**
|