ppio-sandbox 2.1.0 → 2.1.1-a4
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-GFQFOIS4.mjs → chunk-6PRE7JOS.mjs} +149 -135
- package/dist/chunk-6PRE7JOS.mjs.map +1 -0
- package/dist/{chunk-NRVME35H.mjs → chunk-PYNTCKMS.mjs} +2 -2
- package/dist/{chunk-GOSA2RSG.mjs → chunk-Q6PBUYGG.mjs} +2 -2
- package/dist/code-interpreter.d.mts +2 -2
- package/dist/code-interpreter.d.ts +2 -2
- package/dist/code-interpreter.js +154 -139
- package/dist/code-interpreter.js.map +1 -1
- package/dist/code-interpreter.mjs +2 -2
- package/dist/desktop.d.mts +1 -1
- package/dist/desktop.d.ts +1 -1
- package/dist/desktop.js +154 -139
- package/dist/desktop.js.map +1 -1
- package/dist/desktop.mjs +2 -2
- package/dist/{index-CRwaZUdl.d.mts → index-BmB5olHi.d.mts} +7 -16
- package/dist/{index-CRwaZUdl.d.ts → index-BmB5olHi.d.ts} +7 -16
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +154 -139
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/sandbox-IFBOTC7A.mjs +8 -0
- package/dist/sandbox-OAPKYDCZ.mjs +8 -0
- package/package.json +1 -1
- package/dist/chunk-GFQFOIS4.mjs.map +0 -1
- package/dist/sandbox-7DONHEV2.mjs +0 -8
- package/dist/sandbox-FGY2BWMG.mjs +0 -8
- /package/dist/{chunk-NRVME35H.mjs.map → chunk-PYNTCKMS.mjs.map} +0 -0
- /package/dist/{chunk-GOSA2RSG.mjs.map → chunk-Q6PBUYGG.mjs.map} +0 -0
- /package/dist/{sandbox-7DONHEV2.mjs.map → sandbox-IFBOTC7A.mjs.map} +0 -0
- /package/dist/{sandbox-FGY2BWMG.mjs.map → sandbox-OAPKYDCZ.mjs.map} +0 -0
package/dist/desktop.js
CHANGED
|
@@ -80,7 +80,7 @@ var __forAwait = (obj, it, method) => (it = obj[__knownSymbol("asyncIterator")])
|
|
|
80
80
|
var version;
|
|
81
81
|
var init_package = __esm({
|
|
82
82
|
"package.json"() {
|
|
83
|
-
version = "2.1.
|
|
83
|
+
version = "2.1.1-a4";
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
86
|
|
|
@@ -122,12 +122,6 @@ async function sha256(data) {
|
|
|
122
122
|
function timeoutToSeconds(timeout) {
|
|
123
123
|
return Math.ceil(timeout / 1e3);
|
|
124
124
|
}
|
|
125
|
-
function dynamicRequire(module2) {
|
|
126
|
-
if (runtime === "browser") {
|
|
127
|
-
throw new Error("Browser runtime is not supported for require");
|
|
128
|
-
}
|
|
129
|
-
return require(module2);
|
|
130
|
-
}
|
|
131
125
|
async function dynamicImport(module2) {
|
|
132
126
|
if (runtime === "browser") {
|
|
133
127
|
throw new Error("Browser runtime is not supported for dynamic import");
|
|
@@ -1580,7 +1574,7 @@ var init_filesystem = __esm({
|
|
|
1580
1574
|
this.defaultWatchRecursive = false;
|
|
1581
1575
|
this.rpc = (0, import_connect5.createClient)(Filesystem, transport);
|
|
1582
1576
|
}
|
|
1583
|
-
async read(
|
|
1577
|
+
async read(path3, opts) {
|
|
1584
1578
|
var _a3;
|
|
1585
1579
|
const format = (_a3 = opts == null ? void 0 : opts.format) != null ? _a3 : "text";
|
|
1586
1580
|
let user = opts == null ? void 0 : opts.user;
|
|
@@ -1594,7 +1588,7 @@ var init_filesystem = __esm({
|
|
|
1594
1588
|
const res = await this.envdApi.api.GET("/files", {
|
|
1595
1589
|
params: {
|
|
1596
1590
|
query: {
|
|
1597
|
-
path:
|
|
1591
|
+
path: path3,
|
|
1598
1592
|
username: user
|
|
1599
1593
|
}
|
|
1600
1594
|
},
|
|
@@ -1627,7 +1621,7 @@ var init_filesystem = __esm({
|
|
|
1627
1621
|
"Cannot specify both path and array of files. You have to specify either path and data for a single file or an array for multiple files."
|
|
1628
1622
|
);
|
|
1629
1623
|
}
|
|
1630
|
-
const { path:
|
|
1624
|
+
const { path: path3, writeOpts, writeFiles } = typeof pathOrFiles === "string" ? {
|
|
1631
1625
|
path: pathOrFiles,
|
|
1632
1626
|
writeOpts: opts,
|
|
1633
1627
|
writeFiles: [
|
|
@@ -1657,7 +1651,7 @@ var init_filesystem = __esm({
|
|
|
1657
1651
|
}
|
|
1658
1652
|
const uploadResults = await Promise.all(
|
|
1659
1653
|
writeFiles.map(async (file) => {
|
|
1660
|
-
const filePath =
|
|
1654
|
+
const filePath = path3 != null ? path3 : file.path;
|
|
1661
1655
|
const body = await toUploadBody(file.data, useGzip);
|
|
1662
1656
|
const res = await this.envdApi.api.POST("/files", {
|
|
1663
1657
|
params: {
|
|
@@ -1695,13 +1689,13 @@ var init_filesystem = __esm({
|
|
|
1695
1689
|
formData.append(
|
|
1696
1690
|
"file",
|
|
1697
1691
|
await toBlob(file.data),
|
|
1698
|
-
(_a3 = file.path) != null ? _a3 :
|
|
1692
|
+
(_a3 = file.path) != null ? _a3 : path3
|
|
1699
1693
|
);
|
|
1700
1694
|
}
|
|
1701
1695
|
const res = await this.envdApi.api.POST("/files", {
|
|
1702
1696
|
params: {
|
|
1703
1697
|
query: {
|
|
1704
|
-
path:
|
|
1698
|
+
path: path3,
|
|
1705
1699
|
username: user
|
|
1706
1700
|
}
|
|
1707
1701
|
},
|
|
@@ -1719,7 +1713,7 @@ var init_filesystem = __esm({
|
|
|
1719
1713
|
}
|
|
1720
1714
|
results.push(...files);
|
|
1721
1715
|
}
|
|
1722
|
-
return results.length === 1 &&
|
|
1716
|
+
return results.length === 1 && path3 ? results[0] : results;
|
|
1723
1717
|
}
|
|
1724
1718
|
/**
|
|
1725
1719
|
* Write multiple files.
|
|
@@ -1747,7 +1741,7 @@ var init_filesystem = __esm({
|
|
|
1747
1741
|
*
|
|
1748
1742
|
* @returns list of entries in the sandbox filesystem directory.
|
|
1749
1743
|
*/
|
|
1750
|
-
async list(
|
|
1744
|
+
async list(path3, opts) {
|
|
1751
1745
|
var _a3;
|
|
1752
1746
|
if (typeof (opts == null ? void 0 : opts.depth) === "number" && opts.depth < 1) {
|
|
1753
1747
|
throw new InvalidArgumentError("depth should be at least one");
|
|
@@ -1755,7 +1749,7 @@ var init_filesystem = __esm({
|
|
|
1755
1749
|
try {
|
|
1756
1750
|
const res = await this.rpc.listDir(
|
|
1757
1751
|
{
|
|
1758
|
-
path:
|
|
1752
|
+
path: path3,
|
|
1759
1753
|
depth: (_a3 = opts == null ? void 0 : opts.depth) != null ? _a3 : 1
|
|
1760
1754
|
},
|
|
1761
1755
|
{
|
|
@@ -1794,10 +1788,10 @@ var init_filesystem = __esm({
|
|
|
1794
1788
|
*
|
|
1795
1789
|
* @returns `true` if the directory was created, `false` if it already exists.
|
|
1796
1790
|
*/
|
|
1797
|
-
async makeDir(
|
|
1791
|
+
async makeDir(path3, opts) {
|
|
1798
1792
|
try {
|
|
1799
1793
|
await this.rpc.makeDir(
|
|
1800
|
-
{ path:
|
|
1794
|
+
{ path: path3 },
|
|
1801
1795
|
{
|
|
1802
1796
|
headers: authenticationHeader(this.envdApi.version, opts == null ? void 0 : opts.user),
|
|
1803
1797
|
signal: this.connectionConfig.getSignal(opts == null ? void 0 : opts.requestTimeoutMs)
|
|
@@ -1860,10 +1854,10 @@ var init_filesystem = __esm({
|
|
|
1860
1854
|
* @param path path to a file or directory.
|
|
1861
1855
|
* @param opts connection options.
|
|
1862
1856
|
*/
|
|
1863
|
-
async remove(
|
|
1857
|
+
async remove(path3, opts) {
|
|
1864
1858
|
try {
|
|
1865
1859
|
await this.rpc.remove(
|
|
1866
|
-
{ path:
|
|
1860
|
+
{ path: path3 },
|
|
1867
1861
|
{
|
|
1868
1862
|
headers: authenticationHeader(this.envdApi.version, opts == null ? void 0 : opts.user),
|
|
1869
1863
|
signal: this.connectionConfig.getSignal(opts == null ? void 0 : opts.requestTimeoutMs)
|
|
@@ -1881,10 +1875,10 @@ var init_filesystem = __esm({
|
|
|
1881
1875
|
*
|
|
1882
1876
|
* @returns `true` if the file or directory exists, `false` otherwise
|
|
1883
1877
|
*/
|
|
1884
|
-
async exists(
|
|
1878
|
+
async exists(path3, opts) {
|
|
1885
1879
|
try {
|
|
1886
1880
|
await this.rpc.stat(
|
|
1887
|
-
{ path:
|
|
1881
|
+
{ path: path3 },
|
|
1888
1882
|
{
|
|
1889
1883
|
headers: authenticationHeader(this.envdApi.version, opts == null ? void 0 : opts.user),
|
|
1890
1884
|
signal: this.connectionConfig.getSignal(opts == null ? void 0 : opts.requestTimeoutMs)
|
|
@@ -1908,10 +1902,10 @@ var init_filesystem = __esm({
|
|
|
1908
1902
|
*
|
|
1909
1903
|
* @returns information about the file or directory like name, type, and path.
|
|
1910
1904
|
*/
|
|
1911
|
-
async getInfo(
|
|
1905
|
+
async getInfo(path3, opts) {
|
|
1912
1906
|
try {
|
|
1913
1907
|
const res = await this.rpc.stat(
|
|
1914
|
-
{ path:
|
|
1908
|
+
{ path: path3 },
|
|
1915
1909
|
{
|
|
1916
1910
|
headers: authenticationHeader(this.envdApi.version, opts == null ? void 0 : opts.user),
|
|
1917
1911
|
signal: this.connectionConfig.getSignal(opts == null ? void 0 : opts.requestTimeoutMs)
|
|
@@ -1947,7 +1941,7 @@ var init_filesystem = __esm({
|
|
|
1947
1941
|
*
|
|
1948
1942
|
* @returns `WatchHandle` object for stopping watching directory.
|
|
1949
1943
|
*/
|
|
1950
|
-
async watchDir(
|
|
1944
|
+
async watchDir(path3, onEvent, opts) {
|
|
1951
1945
|
var _a3, _b, _c;
|
|
1952
1946
|
if ((opts == null ? void 0 : opts.recursive) && this.envdApi.version && (0, import_compare_versions3.compareVersions)(this.envdApi.version, ENVD_VERSION_RECURSIVE_WATCH) < 0) {
|
|
1953
1947
|
throw new TemplateError(
|
|
@@ -1961,7 +1955,7 @@ var init_filesystem = __esm({
|
|
|
1961
1955
|
}, requestTimeoutMs) : void 0;
|
|
1962
1956
|
const events = this.rpc.watchDir(
|
|
1963
1957
|
{
|
|
1964
|
-
path:
|
|
1958
|
+
path: path3,
|
|
1965
1959
|
recursive: (_b = opts == null ? void 0 : opts.recursive) != null ? _b : this.defaultWatchRecursive
|
|
1966
1960
|
},
|
|
1967
1961
|
{
|
|
@@ -2184,11 +2178,11 @@ function parseGitStatus(output) {
|
|
|
2184
2178
|
}
|
|
2185
2179
|
const indexStatus = line[0];
|
|
2186
2180
|
const workingTreeStatus = line[1];
|
|
2187
|
-
const
|
|
2181
|
+
const path3 = line.slice(3);
|
|
2188
2182
|
let renamedFrom;
|
|
2189
|
-
let name =
|
|
2190
|
-
if (
|
|
2191
|
-
const parts =
|
|
2183
|
+
let name = path3;
|
|
2184
|
+
if (path3.includes(" -> ")) {
|
|
2185
|
+
const parts = path3.split(" -> ");
|
|
2192
2186
|
renamedFrom = parts[0];
|
|
2193
2187
|
name = parts.slice(1).join(" -> ");
|
|
2194
2188
|
}
|
|
@@ -2297,16 +2291,16 @@ function buildUpstreamErrorMessage(action) {
|
|
|
2297
2291
|
}
|
|
2298
2292
|
return "Git pull failed because no upstream branch is configured. Pass remote and branch explicitly, or set upstream once (push with { setUpstream: true } or run: git branch --set-upstream-to=origin/<branch> <branch>).";
|
|
2299
2293
|
}
|
|
2300
|
-
function getRepoPathForScope(scope,
|
|
2294
|
+
function getRepoPathForScope(scope, path3) {
|
|
2301
2295
|
if (scope !== "local") {
|
|
2302
2296
|
return void 0;
|
|
2303
2297
|
}
|
|
2304
|
-
if (!
|
|
2298
|
+
if (!path3) {
|
|
2305
2299
|
throw new InvalidArgumentError(
|
|
2306
2300
|
'A repository path is required when using scope "local".'
|
|
2307
2301
|
);
|
|
2308
2302
|
}
|
|
2309
|
-
return
|
|
2303
|
+
return path3;
|
|
2310
2304
|
}
|
|
2311
2305
|
var init_utils2 = __esm({
|
|
2312
2306
|
"src/core/sandbox/git/utils.ts"() {
|
|
@@ -2343,7 +2337,7 @@ var init_git = __esm({
|
|
|
2343
2337
|
password,
|
|
2344
2338
|
branch,
|
|
2345
2339
|
depth,
|
|
2346
|
-
path:
|
|
2340
|
+
path: path3,
|
|
2347
2341
|
dangerouslyStoreCredentials
|
|
2348
2342
|
} = _a3, rest = __objRest(_a3, [
|
|
2349
2343
|
"username",
|
|
@@ -2362,7 +2356,7 @@ var init_git = __esm({
|
|
|
2362
2356
|
const urlWithCreds = authUsername && authPassword ? withCredentials(url, authUsername, authPassword) : url;
|
|
2363
2357
|
const sanitizedUrl = stripCredentials(urlWithCreds);
|
|
2364
2358
|
const stripInlineCreds = !dangerouslyStoreCredentials && sanitizedUrl !== urlWithCreds;
|
|
2365
|
-
const repoPath = stripInlineCreds ?
|
|
2359
|
+
const repoPath = stripInlineCreds ? path3 != null ? path3 : deriveRepoDirFromUrl(url) : path3;
|
|
2366
2360
|
if (stripInlineCreds && !repoPath) {
|
|
2367
2361
|
throw new InvalidArgumentError(
|
|
2368
2362
|
"A destination path is required when using credentials without storing them."
|
|
@@ -2400,7 +2394,7 @@ var init_git = __esm({
|
|
|
2400
2394
|
* @param opts Init options.
|
|
2401
2395
|
* @returns Command result from the command runner.
|
|
2402
2396
|
*/
|
|
2403
|
-
async init(
|
|
2397
|
+
async init(path3, opts) {
|
|
2404
2398
|
const _a3 = opts != null ? opts : {}, { bare, initialBranch } = _a3, rest = __objRest(_a3, ["bare", "initialBranch"]);
|
|
2405
2399
|
const args = ["init"];
|
|
2406
2400
|
if (initialBranch) {
|
|
@@ -2409,7 +2403,7 @@ var init_git = __esm({
|
|
|
2409
2403
|
if (bare) {
|
|
2410
2404
|
args.push("--bare");
|
|
2411
2405
|
}
|
|
2412
|
-
args.push(
|
|
2406
|
+
args.push(path3);
|
|
2413
2407
|
return this.runGit(args, void 0, rest);
|
|
2414
2408
|
}
|
|
2415
2409
|
/**
|
|
@@ -2421,7 +2415,7 @@ var init_git = __esm({
|
|
|
2421
2415
|
* @param opts Remote add options.
|
|
2422
2416
|
* @returns Command result from the command runner.
|
|
2423
2417
|
*/
|
|
2424
|
-
async remoteAdd(
|
|
2418
|
+
async remoteAdd(path3, name, url, opts) {
|
|
2425
2419
|
if (!name || !url) {
|
|
2426
2420
|
throw new InvalidArgumentError(
|
|
2427
2421
|
"Both remote name and URL are required to add a git remote."
|
|
@@ -2434,13 +2428,13 @@ var init_git = __esm({
|
|
|
2434
2428
|
}
|
|
2435
2429
|
addArgs.push(name, url);
|
|
2436
2430
|
if (!overwrite) {
|
|
2437
|
-
return this.runGit(addArgs,
|
|
2431
|
+
return this.runGit(addArgs, path3, rest);
|
|
2438
2432
|
}
|
|
2439
|
-
const addCmd = buildGitCommand(addArgs,
|
|
2440
|
-
const setUrlCmd = buildGitCommand(["remote", "set-url", name, url],
|
|
2433
|
+
const addCmd = buildGitCommand(addArgs, path3);
|
|
2434
|
+
const setUrlCmd = buildGitCommand(["remote", "set-url", name, url], path3);
|
|
2441
2435
|
let cmd = `${addCmd} || ${setUrlCmd}`;
|
|
2442
2436
|
if (fetch2) {
|
|
2443
|
-
const fetchCmd = buildGitCommand(["fetch", name],
|
|
2437
|
+
const fetchCmd = buildGitCommand(["fetch", name], path3);
|
|
2444
2438
|
cmd = `(${cmd}) && ${fetchCmd}`;
|
|
2445
2439
|
}
|
|
2446
2440
|
return this.runShell(cmd, rest);
|
|
@@ -2455,11 +2449,11 @@ var init_git = __esm({
|
|
|
2455
2449
|
* @param opts Command execution options.
|
|
2456
2450
|
* @returns Remote URL if present.
|
|
2457
2451
|
*/
|
|
2458
|
-
async remoteGet(
|
|
2452
|
+
async remoteGet(path3, name, opts) {
|
|
2459
2453
|
if (!name) {
|
|
2460
2454
|
throw new InvalidArgumentError("Remote name is required.");
|
|
2461
2455
|
}
|
|
2462
|
-
const cmd = `${buildGitCommand(["remote", "get-url", name],
|
|
2456
|
+
const cmd = `${buildGitCommand(["remote", "get-url", name], path3)} || true`;
|
|
2463
2457
|
const result = await this.runShell(cmd, opts);
|
|
2464
2458
|
const trimmed = result.stdout.trim();
|
|
2465
2459
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
@@ -2471,10 +2465,10 @@ var init_git = __esm({
|
|
|
2471
2465
|
* @param opts Command execution options.
|
|
2472
2466
|
* @returns Parsed git status.
|
|
2473
2467
|
*/
|
|
2474
|
-
async status(
|
|
2468
|
+
async status(path3, opts) {
|
|
2475
2469
|
const result = await this.runGit(
|
|
2476
2470
|
["status", "--porcelain=1", "-b"],
|
|
2477
|
-
|
|
2471
|
+
path3,
|
|
2478
2472
|
opts
|
|
2479
2473
|
);
|
|
2480
2474
|
return parseGitStatus(result.stdout);
|
|
@@ -2486,10 +2480,10 @@ var init_git = __esm({
|
|
|
2486
2480
|
* @param opts Command execution options.
|
|
2487
2481
|
* @returns Parsed branch list.
|
|
2488
2482
|
*/
|
|
2489
|
-
async branches(
|
|
2483
|
+
async branches(path3, opts) {
|
|
2490
2484
|
const result = await this.runGit(
|
|
2491
2485
|
["branch", "--format=%(refname:short) %(HEAD)"],
|
|
2492
|
-
|
|
2486
|
+
path3,
|
|
2493
2487
|
opts
|
|
2494
2488
|
);
|
|
2495
2489
|
return parseGitBranches(result.stdout);
|
|
@@ -2502,8 +2496,8 @@ var init_git = __esm({
|
|
|
2502
2496
|
* @param opts Command execution options.
|
|
2503
2497
|
* @returns Command result from the command runner.
|
|
2504
2498
|
*/
|
|
2505
|
-
async createBranch(
|
|
2506
|
-
return this.runGit(["checkout", "-b", branch],
|
|
2499
|
+
async createBranch(path3, branch, opts) {
|
|
2500
|
+
return this.runGit(["checkout", "-b", branch], path3, opts);
|
|
2507
2501
|
}
|
|
2508
2502
|
/**
|
|
2509
2503
|
* Check out an existing branch.
|
|
@@ -2513,8 +2507,8 @@ var init_git = __esm({
|
|
|
2513
2507
|
* @param opts Command execution options.
|
|
2514
2508
|
* @returns Command result from the command runner.
|
|
2515
2509
|
*/
|
|
2516
|
-
async checkoutBranch(
|
|
2517
|
-
return this.runGit(["checkout", branch],
|
|
2510
|
+
async checkoutBranch(path3, branch, opts) {
|
|
2511
|
+
return this.runGit(["checkout", branch], path3, opts);
|
|
2518
2512
|
}
|
|
2519
2513
|
/**
|
|
2520
2514
|
* Delete a branch.
|
|
@@ -2524,10 +2518,10 @@ var init_git = __esm({
|
|
|
2524
2518
|
* @param opts Delete options.
|
|
2525
2519
|
* @returns Command result from the command runner.
|
|
2526
2520
|
*/
|
|
2527
|
-
async deleteBranch(
|
|
2521
|
+
async deleteBranch(path3, branch, opts) {
|
|
2528
2522
|
const _a3 = opts != null ? opts : {}, { force } = _a3, rest = __objRest(_a3, ["force"]);
|
|
2529
2523
|
const args = ["branch", force ? "-D" : "-d", branch];
|
|
2530
|
-
return this.runGit(args,
|
|
2524
|
+
return this.runGit(args, path3, rest);
|
|
2531
2525
|
}
|
|
2532
2526
|
/**
|
|
2533
2527
|
* Stage files for commit.
|
|
@@ -2536,7 +2530,7 @@ var init_git = __esm({
|
|
|
2536
2530
|
* @param opts Add options.
|
|
2537
2531
|
* @returns Command result from the command runner.
|
|
2538
2532
|
*/
|
|
2539
|
-
async add(
|
|
2533
|
+
async add(path3, opts) {
|
|
2540
2534
|
const _a3 = opts != null ? opts : {}, { files, all = true } = _a3, rest = __objRest(_a3, ["files", "all"]);
|
|
2541
2535
|
const args = ["add"];
|
|
2542
2536
|
if (!files || files.length === 0) {
|
|
@@ -2544,7 +2538,7 @@ var init_git = __esm({
|
|
|
2544
2538
|
} else {
|
|
2545
2539
|
args.push("--", ...files);
|
|
2546
2540
|
}
|
|
2547
|
-
return this.runGit(args,
|
|
2541
|
+
return this.runGit(args, path3, rest);
|
|
2548
2542
|
}
|
|
2549
2543
|
/**
|
|
2550
2544
|
* Create a commit in the repository.
|
|
@@ -2554,7 +2548,7 @@ var init_git = __esm({
|
|
|
2554
2548
|
* @param opts Commit options.
|
|
2555
2549
|
* @returns Command result from the command runner.
|
|
2556
2550
|
*/
|
|
2557
|
-
async commit(
|
|
2551
|
+
async commit(path3, message, opts) {
|
|
2558
2552
|
const _a3 = opts != null ? opts : {}, { authorName, authorEmail, allowEmpty } = _a3, rest = __objRest(_a3, ["authorName", "authorEmail", "allowEmpty"]);
|
|
2559
2553
|
const args = ["commit", "-m", message];
|
|
2560
2554
|
if (allowEmpty) {
|
|
@@ -2567,7 +2561,7 @@ var init_git = __esm({
|
|
|
2567
2561
|
if (authorEmail) {
|
|
2568
2562
|
authorArgs.push("-c", `user.email=${authorEmail}`);
|
|
2569
2563
|
}
|
|
2570
|
-
return this.runGit([...authorArgs, ...args],
|
|
2564
|
+
return this.runGit([...authorArgs, ...args], path3, rest);
|
|
2571
2565
|
}
|
|
2572
2566
|
/**
|
|
2573
2567
|
* Reset the current HEAD to a specified state.
|
|
@@ -2576,7 +2570,7 @@ var init_git = __esm({
|
|
|
2576
2570
|
* @param opts Reset options.
|
|
2577
2571
|
* @returns Command result from the command runner.
|
|
2578
2572
|
*/
|
|
2579
|
-
async reset(
|
|
2573
|
+
async reset(path3, opts) {
|
|
2580
2574
|
const _a3 = opts != null ? opts : {}, { mode, target, paths: paths2 } = _a3, rest = __objRest(_a3, ["mode", "target", "paths"]);
|
|
2581
2575
|
const allowedModes = [
|
|
2582
2576
|
"soft",
|
|
@@ -2600,7 +2594,7 @@ var init_git = __esm({
|
|
|
2600
2594
|
if (paths2 && paths2.length > 0) {
|
|
2601
2595
|
args.push("--", ...paths2);
|
|
2602
2596
|
}
|
|
2603
|
-
return this.runGit(args,
|
|
2597
|
+
return this.runGit(args, path3, rest);
|
|
2604
2598
|
}
|
|
2605
2599
|
/**
|
|
2606
2600
|
* Restore working tree files or unstage changes.
|
|
@@ -2609,7 +2603,7 @@ var init_git = __esm({
|
|
|
2609
2603
|
* @param opts Restore options.
|
|
2610
2604
|
* @returns Command result from the command runner.
|
|
2611
2605
|
*/
|
|
2612
|
-
async restore(
|
|
2606
|
+
async restore(path3, opts) {
|
|
2613
2607
|
const _a3 = opts, { paths: paths2, staged, worktree, source } = _a3, rest = __objRest(_a3, ["paths", "staged", "worktree", "source"]);
|
|
2614
2608
|
if (!paths2 || paths2.length === 0) {
|
|
2615
2609
|
throw new InvalidArgumentError("At least one path is required.");
|
|
@@ -2639,7 +2633,7 @@ var init_git = __esm({
|
|
|
2639
2633
|
args.push("--source", source);
|
|
2640
2634
|
}
|
|
2641
2635
|
args.push("--", ...paths2);
|
|
2642
|
-
return this.runGit(args,
|
|
2636
|
+
return this.runGit(args, path3, rest);
|
|
2643
2637
|
}
|
|
2644
2638
|
/**
|
|
2645
2639
|
* Push commits to a remote.
|
|
@@ -2648,7 +2642,7 @@ var init_git = __esm({
|
|
|
2648
2642
|
* @param opts Push options.
|
|
2649
2643
|
* @returns Command result from the command runner.
|
|
2650
2644
|
*/
|
|
2651
|
-
async push(
|
|
2645
|
+
async push(path3, opts) {
|
|
2652
2646
|
const _a3 = opts != null ? opts : {}, {
|
|
2653
2647
|
remote,
|
|
2654
2648
|
branch,
|
|
@@ -2668,16 +2662,16 @@ var init_git = __esm({
|
|
|
2668
2662
|
);
|
|
2669
2663
|
}
|
|
2670
2664
|
if (username && password) {
|
|
2671
|
-
const remoteName = await this.resolveRemoteName(
|
|
2665
|
+
const remoteName = await this.resolveRemoteName(path3, remote, rest);
|
|
2672
2666
|
return this.withRemoteCredentials(
|
|
2673
|
-
|
|
2667
|
+
path3,
|
|
2674
2668
|
remoteName,
|
|
2675
2669
|
username,
|
|
2676
2670
|
password,
|
|
2677
2671
|
rest,
|
|
2678
2672
|
() => this.runGit(
|
|
2679
2673
|
buildPushArgs(remoteName, { remote, branch, setUpstream }),
|
|
2680
|
-
|
|
2674
|
+
path3,
|
|
2681
2675
|
rest
|
|
2682
2676
|
)
|
|
2683
2677
|
);
|
|
@@ -2685,7 +2679,7 @@ var init_git = __esm({
|
|
|
2685
2679
|
try {
|
|
2686
2680
|
return await this.runGit(
|
|
2687
2681
|
buildPushArgs(void 0, { remote, branch, setUpstream }),
|
|
2688
|
-
|
|
2682
|
+
path3,
|
|
2689
2683
|
rest
|
|
2690
2684
|
);
|
|
2691
2685
|
} catch (err) {
|
|
@@ -2707,7 +2701,7 @@ var init_git = __esm({
|
|
|
2707
2701
|
* @param opts Pull options.
|
|
2708
2702
|
* @returns Command result from the command runner.
|
|
2709
2703
|
*/
|
|
2710
|
-
async pull(
|
|
2704
|
+
async pull(path3, opts) {
|
|
2711
2705
|
const _a3 = opts != null ? opts : {}, { remote, branch, username, password } = _a3, rest = __objRest(_a3, ["remote", "branch", "username", "password"]);
|
|
2712
2706
|
if (password && !username) {
|
|
2713
2707
|
throw new InvalidArgumentError(
|
|
@@ -2715,7 +2709,7 @@ var init_git = __esm({
|
|
|
2715
2709
|
);
|
|
2716
2710
|
}
|
|
2717
2711
|
if (!remote && !branch) {
|
|
2718
|
-
const hasUpstream = await this.hasUpstream(
|
|
2712
|
+
const hasUpstream = await this.hasUpstream(path3, rest);
|
|
2719
2713
|
if (!hasUpstream) {
|
|
2720
2714
|
throw new GitUpstreamError(buildUpstreamErrorMessage("pull"));
|
|
2721
2715
|
}
|
|
@@ -2732,18 +2726,18 @@ var init_git = __esm({
|
|
|
2732
2726
|
return args;
|
|
2733
2727
|
};
|
|
2734
2728
|
if (username && password) {
|
|
2735
|
-
const remoteName = await this.resolveRemoteName(
|
|
2729
|
+
const remoteName = await this.resolveRemoteName(path3, remote, rest);
|
|
2736
2730
|
return this.withRemoteCredentials(
|
|
2737
|
-
|
|
2731
|
+
path3,
|
|
2738
2732
|
remoteName,
|
|
2739
2733
|
username,
|
|
2740
2734
|
password,
|
|
2741
2735
|
rest,
|
|
2742
|
-
() => this.runGit(buildArgs(remoteName),
|
|
2736
|
+
() => this.runGit(buildArgs(remoteName), path3, rest)
|
|
2743
2737
|
);
|
|
2744
2738
|
}
|
|
2745
2739
|
try {
|
|
2746
|
-
return await this.runGit(buildArgs(),
|
|
2740
|
+
return await this.runGit(buildArgs(), path3, rest);
|
|
2747
2741
|
} catch (err) {
|
|
2748
2742
|
if (isAuthFailure(err)) {
|
|
2749
2743
|
throw new GitAuthError(
|
|
@@ -2880,8 +2874,8 @@ var init_git = __esm({
|
|
|
2880
2874
|
envs: mergedEnvs
|
|
2881
2875
|
}));
|
|
2882
2876
|
}
|
|
2883
|
-
async getRemoteUrl(
|
|
2884
|
-
const result = await this.runGit(["remote", "get-url", remote],
|
|
2877
|
+
async getRemoteUrl(path3, remote, opts) {
|
|
2878
|
+
const result = await this.runGit(["remote", "get-url", remote], path3, opts);
|
|
2885
2879
|
const url = result.stdout.trim();
|
|
2886
2880
|
if (!url) {
|
|
2887
2881
|
throw new InvalidArgumentError(
|
|
@@ -2890,11 +2884,11 @@ var init_git = __esm({
|
|
|
2890
2884
|
}
|
|
2891
2885
|
return url;
|
|
2892
2886
|
}
|
|
2893
|
-
async resolveRemoteName(
|
|
2887
|
+
async resolveRemoteName(path3, remote, opts) {
|
|
2894
2888
|
if (remote) {
|
|
2895
2889
|
return remote;
|
|
2896
2890
|
}
|
|
2897
|
-
const result = await this.runGit(["remote"],
|
|
2891
|
+
const result = await this.runGit(["remote"], path3, opts);
|
|
2898
2892
|
const remotes = result.stdout.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
2899
2893
|
if (remotes.length === 1) {
|
|
2900
2894
|
return remotes[0];
|
|
@@ -2903,10 +2897,10 @@ var init_git = __esm({
|
|
|
2903
2897
|
"Remote is required when using username/password and the repository has multiple remotes."
|
|
2904
2898
|
);
|
|
2905
2899
|
}
|
|
2906
|
-
async withRemoteCredentials(
|
|
2907
|
-
const originalUrl = await this.getRemoteUrl(
|
|
2900
|
+
async withRemoteCredentials(path3, remote, username, password, opts, operation) {
|
|
2901
|
+
const originalUrl = await this.getRemoteUrl(path3, remote, opts);
|
|
2908
2902
|
const credentialUrl = withCredentials(originalUrl, username, password);
|
|
2909
|
-
await this.runGit(["remote", "set-url", remote, credentialUrl],
|
|
2903
|
+
await this.runGit(["remote", "set-url", remote, credentialUrl], path3, opts);
|
|
2910
2904
|
let result;
|
|
2911
2905
|
let operationError;
|
|
2912
2906
|
try {
|
|
@@ -2916,7 +2910,7 @@ var init_git = __esm({
|
|
|
2916
2910
|
}
|
|
2917
2911
|
let restoreError;
|
|
2918
2912
|
try {
|
|
2919
|
-
await this.runGit(["remote", "set-url", remote, originalUrl],
|
|
2913
|
+
await this.runGit(["remote", "set-url", remote, originalUrl], path3, opts);
|
|
2920
2914
|
} catch (err) {
|
|
2921
2915
|
restoreError = err;
|
|
2922
2916
|
}
|
|
@@ -2928,11 +2922,11 @@ var init_git = __esm({
|
|
|
2928
2922
|
}
|
|
2929
2923
|
return result;
|
|
2930
2924
|
}
|
|
2931
|
-
async hasUpstream(
|
|
2925
|
+
async hasUpstream(path3, opts) {
|
|
2932
2926
|
try {
|
|
2933
2927
|
const result = await this.runGit(
|
|
2934
2928
|
["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
|
|
2935
|
-
|
|
2929
|
+
path3,
|
|
2936
2930
|
opts
|
|
2937
2931
|
);
|
|
2938
2932
|
return result.stdout.trim().length > 0;
|
|
@@ -3015,11 +3009,11 @@ function normalizeSecretHosts(hosts) {
|
|
|
3015
3009
|
}
|
|
3016
3010
|
return normalizedHosts;
|
|
3017
3011
|
}
|
|
3018
|
-
async function request(method,
|
|
3012
|
+
async function request(method, path3, feature, opts, body) {
|
|
3019
3013
|
const config = new ConnectionConfig(opts);
|
|
3020
3014
|
raiseIfLegacy(config, feature, SecretError);
|
|
3021
3015
|
const headers = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, config.headers), body ? { "Content-Type": "application/json" } : {}), config.apiKey ? { "X-API-KEY": config.apiKey } : {}), config.accessToken ? { Authorization: `Bearer ${config.accessToken}` } : {});
|
|
3022
|
-
const response = await fetch(`${config.apiUrl}${
|
|
3016
|
+
const response = await fetch(`${config.apiUrl}${path3}`, {
|
|
3023
3017
|
method,
|
|
3024
3018
|
headers,
|
|
3025
3019
|
body: body ? JSON.stringify(body) : void 0,
|
|
@@ -3437,7 +3431,7 @@ var init_sandboxApi = __esm({
|
|
|
3437
3431
|
}
|
|
3438
3432
|
return true;
|
|
3439
3433
|
}
|
|
3440
|
-
static async mountVolume(sandboxId, name,
|
|
3434
|
+
static async mountVolume(sandboxId, name, path3, opts) {
|
|
3441
3435
|
var _a3, _b;
|
|
3442
3436
|
const config = new ConnectionConfig(opts);
|
|
3443
3437
|
raiseIfLegacy(config, "Sandbox.mountVolume", SandboxError);
|
|
@@ -3448,7 +3442,7 @@ var init_sandboxApi = __esm({
|
|
|
3448
3442
|
headers: getRawApiHeaders(config, {
|
|
3449
3443
|
"Content-Type": "application/json"
|
|
3450
3444
|
}),
|
|
3451
|
-
body: JSON.stringify({ name, path:
|
|
3445
|
+
body: JSON.stringify({ name, path: path3 }),
|
|
3452
3446
|
signal: config.getSignal(opts == null ? void 0 : opts.requestTimeoutMs)
|
|
3453
3447
|
}
|
|
3454
3448
|
);
|
|
@@ -3473,14 +3467,14 @@ var init_sandboxApi = __esm({
|
|
|
3473
3467
|
volumeMounts: (_b = data.volumeMounts) != null ? _b : []
|
|
3474
3468
|
};
|
|
3475
3469
|
}
|
|
3476
|
-
static async unmountVolume(sandboxId,
|
|
3470
|
+
static async unmountVolume(sandboxId, path3, opts) {
|
|
3477
3471
|
var _a3, _b;
|
|
3478
3472
|
const config = new ConnectionConfig(opts);
|
|
3479
3473
|
raiseIfLegacy(config, "Sandbox.unmountVolume", SandboxError);
|
|
3480
3474
|
const url = new URL(
|
|
3481
3475
|
`${config.apiUrl}/sandboxes/${encodeURIComponent(sandboxId)}/volume-mounts`
|
|
3482
3476
|
);
|
|
3483
|
-
url.searchParams.set("path",
|
|
3477
|
+
url.searchParams.set("path", path3);
|
|
3484
3478
|
if (opts == null ? void 0 : opts.force) {
|
|
3485
3479
|
url.searchParams.set("force", "true");
|
|
3486
3480
|
}
|
|
@@ -3774,7 +3768,7 @@ var init_sandboxApi = __esm({
|
|
|
3774
3768
|
return true;
|
|
3775
3769
|
}
|
|
3776
3770
|
static async createSandbox(template, timeoutMs, opts) {
|
|
3777
|
-
var _a3, _b, _c, _d, _e, _f;
|
|
3771
|
+
var _a3, _b, _c, _d, _e, _f, _g;
|
|
3778
3772
|
const config = new ConnectionConfig(opts);
|
|
3779
3773
|
const lifecycle = getLifecycle(opts);
|
|
3780
3774
|
const autoPause = lifecycle.onTimeout === "pause";
|
|
@@ -3783,8 +3777,13 @@ var init_sandboxApi = __esm({
|
|
|
3783
3777
|
if (opts == null ? void 0 : opts.mcp) {
|
|
3784
3778
|
raiseIfLegacy(config, "Sandbox.create mcp", SandboxError);
|
|
3785
3779
|
}
|
|
3786
|
-
|
|
3787
|
-
|
|
3780
|
+
const unsupportedNetworkOptions = Object.keys((_b = opts == null ? void 0 : opts.network) != null ? _b : {}).filter(
|
|
3781
|
+
(key) => key !== "allowPublicTraffic"
|
|
3782
|
+
);
|
|
3783
|
+
if (unsupportedNetworkOptions.length > 0) {
|
|
3784
|
+
throw new SandboxError(
|
|
3785
|
+
`Sandbox.create network only supports allowPublicTraffic on legacy domains; unsupported options: ${unsupportedNetworkOptions.join(", ")}`
|
|
3786
|
+
);
|
|
3788
3787
|
}
|
|
3789
3788
|
if (opts == null ? void 0 : opts.volumeMounts) {
|
|
3790
3789
|
raiseIfLegacy(config, "Sandbox.create volumeMounts", SandboxError);
|
|
@@ -3792,14 +3791,14 @@ var init_sandboxApi = __esm({
|
|
|
3792
3791
|
if (opts == null ? void 0 : opts.secretEnvs) {
|
|
3793
3792
|
raiseIfLegacy(config, "Sandbox.create secretEnvs", SandboxError);
|
|
3794
3793
|
}
|
|
3795
|
-
const body2 = __spreadValues({
|
|
3794
|
+
const body2 = __spreadValues(__spreadValues({
|
|
3796
3795
|
templateID: template,
|
|
3797
3796
|
timeout: timeoutToSeconds(timeoutMs),
|
|
3798
|
-
metadata: (
|
|
3799
|
-
envVars: (
|
|
3800
|
-
secure: (
|
|
3797
|
+
metadata: (_c = opts == null ? void 0 : opts.metadata) != null ? _c : {},
|
|
3798
|
+
envVars: (_d = opts == null ? void 0 : opts.envs) != null ? _d : {},
|
|
3799
|
+
secure: (_e = opts == null ? void 0 : opts.secure) != null ? _e : false,
|
|
3801
3800
|
autoPause: autoPause != null ? autoPause : false
|
|
3802
|
-
}, (opts == null ? void 0 : opts.nodeId) ? { nodeID: opts.nodeId } : {});
|
|
3801
|
+
}, (opts == null ? void 0 : opts.network) ? { network: opts.network } : {}), (opts == null ? void 0 : opts.nodeId) ? { nodeID: opts.nodeId } : {});
|
|
3803
3802
|
const response = await fetch(`${config.apiUrl}/sandboxes`, {
|
|
3804
3803
|
method: "POST",
|
|
3805
3804
|
headers: getRawApiHeaders(config, {
|
|
@@ -3823,7 +3822,7 @@ var init_sandboxApi = __esm({
|
|
|
3823
3822
|
sandboxDomain: data.domain || void 0,
|
|
3824
3823
|
envdVersion: data.envdVersion,
|
|
3825
3824
|
envdAccessToken: data.envdAccessToken,
|
|
3826
|
-
trafficAccessToken: void 0
|
|
3825
|
+
trafficAccessToken: data.trafficAccessToken || void 0
|
|
3827
3826
|
};
|
|
3828
3827
|
}
|
|
3829
3828
|
const client = new ApiClient(config);
|
|
@@ -3833,8 +3832,8 @@ var init_sandboxApi = __esm({
|
|
|
3833
3832
|
mcp: opts == null ? void 0 : opts.mcp,
|
|
3834
3833
|
envVars: opts == null ? void 0 : opts.envs,
|
|
3835
3834
|
timeout: timeoutToSeconds(timeoutMs),
|
|
3836
|
-
secure: (
|
|
3837
|
-
allow_internet_access: (
|
|
3835
|
+
secure: (_f = opts == null ? void 0 : opts.secure) != null ? _f : true,
|
|
3836
|
+
allow_internet_access: (_g = opts == null ? void 0 : opts.allowInternetAccess) != null ? _g : true,
|
|
3838
3837
|
network: opts == null ? void 0 : opts.network
|
|
3839
3838
|
}, (opts == null ? void 0 : opts.nodeId) ? { nodeID: opts.nodeId } : {}), autoPause !== void 0 ? { autoPause } : {}), autoResumeEnabled !== void 0 ? { autoResume: { enabled: autoResumeEnabled } } : {});
|
|
3840
3839
|
if (opts == null ? void 0 : opts.volumeMounts) {
|
|
@@ -3887,7 +3886,9 @@ var init_sandboxApi = __esm({
|
|
|
3887
3886
|
headers: getRawApiHeaders(config, {
|
|
3888
3887
|
"Content-Type": "application/json"
|
|
3889
3888
|
}),
|
|
3890
|
-
body: JSON.stringify({
|
|
3889
|
+
body: JSON.stringify(__spreadValues(__spreadValues(__spreadValues({
|
|
3890
|
+
timeout: timeoutToSeconds(timeoutMs)
|
|
3891
|
+
}, (opts == null ? void 0 : opts.secure) !== void 0 ? { secure: opts.secure } : {}), (opts == null ? void 0 : opts.allowPublicTraffic) !== void 0 ? { allowPublicTraffic: opts.allowPublicTraffic } : {}), (opts == null ? void 0 : opts.network) ? { network: opts.network } : {})),
|
|
3891
3892
|
signal: config.getSignal(opts == null ? void 0 : opts.requestTimeoutMs)
|
|
3892
3893
|
}
|
|
3893
3894
|
);
|
|
@@ -3903,7 +3904,7 @@ var init_sandboxApi = __esm({
|
|
|
3903
3904
|
sandboxDomain: data.domain || void 0,
|
|
3904
3905
|
envdVersion: data.envdVersion || "0.0.0",
|
|
3905
3906
|
envdAccessToken: data.envdAccessToken,
|
|
3906
|
-
trafficAccessToken: void 0
|
|
3907
|
+
trafficAccessToken: data.trafficAccessToken || void 0
|
|
3907
3908
|
};
|
|
3908
3909
|
}
|
|
3909
3910
|
const client = new ApiClient(config);
|
|
@@ -4162,7 +4163,7 @@ var init_sandboxApi = __esm({
|
|
|
4162
4163
|
|
|
4163
4164
|
// src/core/sandbox/signature.ts
|
|
4164
4165
|
async function getSignature({
|
|
4165
|
-
path:
|
|
4166
|
+
path: path3,
|
|
4166
4167
|
operation,
|
|
4167
4168
|
user,
|
|
4168
4169
|
expirationInSeconds,
|
|
@@ -4179,9 +4180,9 @@ async function getSignature({
|
|
|
4179
4180
|
user = "";
|
|
4180
4181
|
}
|
|
4181
4182
|
if (signatureExpiration === null) {
|
|
4182
|
-
signatureRaw = `${
|
|
4183
|
+
signatureRaw = `${path3}:${operation}:${user}:${envdAccessToken}`;
|
|
4183
4184
|
} else {
|
|
4184
|
-
signatureRaw = `${
|
|
4185
|
+
signatureRaw = `${path3}:${operation}:${user}:${envdAccessToken}:${signatureExpiration.toString()}`;
|
|
4185
4186
|
}
|
|
4186
4187
|
const hashBase64 = await sha256(signatureRaw);
|
|
4187
4188
|
const signature = "v1_" + hashBase64.replace(/=+$/, "");
|
|
@@ -4387,8 +4388,8 @@ var init_sandbox = __esm({
|
|
|
4387
4388
|
*
|
|
4388
4389
|
* @returns updated sandbox information.
|
|
4389
4390
|
*/
|
|
4390
|
-
static async mountVolume(sandboxId, name,
|
|
4391
|
-
return await SandboxApi.mountVolume(sandboxId, name,
|
|
4391
|
+
static async mountVolume(sandboxId, name, path3, opts) {
|
|
4392
|
+
return await SandboxApi.mountVolume(sandboxId, name, path3, opts);
|
|
4392
4393
|
}
|
|
4393
4394
|
/**
|
|
4394
4395
|
* Unmount a volume from a sandbox.
|
|
@@ -4400,8 +4401,8 @@ var init_sandbox = __esm({
|
|
|
4400
4401
|
*
|
|
4401
4402
|
* @returns updated sandbox information.
|
|
4402
4403
|
*/
|
|
4403
|
-
static async unmountVolume(sandboxId,
|
|
4404
|
-
return await SandboxApi.unmountVolume(sandboxId,
|
|
4404
|
+
static async unmountVolume(sandboxId, path3, opts) {
|
|
4405
|
+
return await SandboxApi.unmountVolume(sandboxId, path3, opts);
|
|
4405
4406
|
}
|
|
4406
4407
|
/**
|
|
4407
4408
|
* Commit a sandbox to create a snapshot template.
|
|
@@ -4636,11 +4637,11 @@ var init_sandbox = __esm({
|
|
|
4636
4637
|
*
|
|
4637
4638
|
* @returns updated sandbox information.
|
|
4638
4639
|
*/
|
|
4639
|
-
async mountVolume(name,
|
|
4640
|
+
async mountVolume(name, path3, opts) {
|
|
4640
4641
|
return await SandboxApi.mountVolume(
|
|
4641
4642
|
this.sandboxId,
|
|
4642
4643
|
name,
|
|
4643
|
-
|
|
4644
|
+
path3,
|
|
4644
4645
|
this.resolveApiOpts(opts)
|
|
4645
4646
|
);
|
|
4646
4647
|
}
|
|
@@ -4653,10 +4654,10 @@ var init_sandbox = __esm({
|
|
|
4653
4654
|
*
|
|
4654
4655
|
* @returns updated sandbox information.
|
|
4655
4656
|
*/
|
|
4656
|
-
async unmountVolume(
|
|
4657
|
+
async unmountVolume(path3, opts) {
|
|
4657
4658
|
return await SandboxApi.unmountVolume(
|
|
4658
4659
|
this.sandboxId,
|
|
4659
|
-
|
|
4660
|
+
path3,
|
|
4660
4661
|
this.resolveApiOpts(opts)
|
|
4661
4662
|
);
|
|
4662
4663
|
}
|
|
@@ -4790,7 +4791,7 @@ var init_sandbox = __esm({
|
|
|
4790
4791
|
*
|
|
4791
4792
|
* @returns URL for uploading file.
|
|
4792
4793
|
*/
|
|
4793
|
-
async uploadUrl(
|
|
4794
|
+
async uploadUrl(path3, opts) {
|
|
4794
4795
|
opts = opts != null ? opts : {};
|
|
4795
4796
|
const useSignature = !!this.envdAccessToken;
|
|
4796
4797
|
if (!useSignature && opts.useSignatureExpiration != void 0) {
|
|
@@ -4802,7 +4803,7 @@ var init_sandbox = __esm({
|
|
|
4802
4803
|
if (username == void 0 && (0, import_compare_versions5.compareVersions)(this.envdApi.version, ENVD_DEFAULT_USER) < 0) {
|
|
4803
4804
|
username = defaultUsername;
|
|
4804
4805
|
}
|
|
4805
|
-
const filePath =
|
|
4806
|
+
const filePath = path3 != null ? path3 : "";
|
|
4806
4807
|
const fileUrl = this.fileUrl(filePath, username);
|
|
4807
4808
|
if (useSignature) {
|
|
4808
4809
|
const url = new URL(fileUrl);
|
|
@@ -4830,7 +4831,7 @@ var init_sandbox = __esm({
|
|
|
4830
4831
|
*
|
|
4831
4832
|
* @returns URL for downloading file.
|
|
4832
4833
|
*/
|
|
4833
|
-
async downloadUrl(
|
|
4834
|
+
async downloadUrl(path3, opts) {
|
|
4834
4835
|
opts = opts != null ? opts : {};
|
|
4835
4836
|
const useSignature = !!this.envdAccessToken;
|
|
4836
4837
|
if (!useSignature && opts.useSignatureExpiration != void 0) {
|
|
@@ -4842,11 +4843,11 @@ var init_sandbox = __esm({
|
|
|
4842
4843
|
if (username == void 0 && (0, import_compare_versions5.compareVersions)(this.envdApi.version, ENVD_DEFAULT_USER) < 0) {
|
|
4843
4844
|
username = defaultUsername;
|
|
4844
4845
|
}
|
|
4845
|
-
const fileUrl = this.fileUrl(
|
|
4846
|
+
const fileUrl = this.fileUrl(path3, username);
|
|
4846
4847
|
if (useSignature) {
|
|
4847
4848
|
const url = new URL(fileUrl);
|
|
4848
4849
|
const sig = await getSignature({
|
|
4849
|
-
path:
|
|
4850
|
+
path: path3,
|
|
4850
4851
|
operation: "read",
|
|
4851
4852
|
user: username,
|
|
4852
4853
|
expirationInSeconds: opts.useSignatureExpiration,
|
|
@@ -4900,13 +4901,13 @@ var init_sandbox = __esm({
|
|
|
4900
4901
|
resolveApiOpts(opts) {
|
|
4901
4902
|
return __spreadValues(__spreadValues({}, this.connectionConfig), opts != null ? opts : {});
|
|
4902
4903
|
}
|
|
4903
|
-
fileUrl(
|
|
4904
|
+
fileUrl(path3, username) {
|
|
4904
4905
|
const url = new URL("/files", this.envdApiUrl);
|
|
4905
4906
|
if (username) {
|
|
4906
4907
|
url.searchParams.set("username", username);
|
|
4907
4908
|
}
|
|
4908
|
-
if (
|
|
4909
|
-
url.searchParams.set("path",
|
|
4909
|
+
if (path3) {
|
|
4910
|
+
url.searchParams.set("path", path3);
|
|
4910
4911
|
}
|
|
4911
4912
|
return url.toString();
|
|
4912
4913
|
}
|
|
@@ -5097,8 +5098,8 @@ function readDockerignore(contextPath) {
|
|
|
5097
5098
|
const content = import_node_fs.default.readFileSync(dockerignorePath, "utf-8");
|
|
5098
5099
|
return content.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
5099
5100
|
}
|
|
5100
|
-
function normalizePath(
|
|
5101
|
-
return
|
|
5101
|
+
function normalizePath(path3) {
|
|
5102
|
+
return path3.replace(/\\/g, "/");
|
|
5102
5103
|
}
|
|
5103
5104
|
async function getAllFilesInPath(src, contextPath, ignorePatterns, includeDirectories = true) {
|
|
5104
5105
|
const { glob } = await dynamicImport("glob");
|
|
@@ -5210,8 +5211,7 @@ function getCallerDirectory(depth) {
|
|
|
5210
5211
|
return void 0;
|
|
5211
5212
|
}
|
|
5212
5213
|
if (fileName.startsWith("file:")) {
|
|
5213
|
-
|
|
5214
|
-
fileName = fileURLToPath(fileName);
|
|
5214
|
+
fileName = (0, import_node_url.fileURLToPath)(fileName);
|
|
5215
5215
|
}
|
|
5216
5216
|
return import_node_path.default.dirname(fileName);
|
|
5217
5217
|
}
|
|
@@ -5260,13 +5260,14 @@ function readGCPServiceAccountJSON(contextPath, pathOrContent) {
|
|
|
5260
5260
|
}
|
|
5261
5261
|
return JSON.stringify(pathOrContent);
|
|
5262
5262
|
}
|
|
5263
|
-
var import_node_crypto, import_node_fs, import_node_path;
|
|
5263
|
+
var import_node_crypto, import_node_fs, import_node_path, import_node_url;
|
|
5264
5264
|
var init_utils3 = __esm({
|
|
5265
5265
|
"src/core/template/utils.ts"() {
|
|
5266
5266
|
"use strict";
|
|
5267
5267
|
import_node_crypto = __toESM(require("crypto"));
|
|
5268
5268
|
import_node_fs = __toESM(require("fs"));
|
|
5269
5269
|
import_node_path = __toESM(require("path"));
|
|
5270
|
+
import_node_url = require("url");
|
|
5270
5271
|
init_utils();
|
|
5271
5272
|
init_errors();
|
|
5272
5273
|
init_consts();
|
|
@@ -6735,8 +6736,8 @@ var init_template = __esm({
|
|
|
6735
6736
|
});
|
|
6736
6737
|
return this;
|
|
6737
6738
|
}
|
|
6738
|
-
remove(
|
|
6739
|
-
const paths2 = Array.isArray(
|
|
6739
|
+
remove(path3, options) {
|
|
6740
|
+
const paths2 = Array.isArray(path3) ? path3 : [path3];
|
|
6740
6741
|
const args = ["rm"];
|
|
6741
6742
|
if (options == null ? void 0 : options.recursive) {
|
|
6742
6743
|
args.push("-r");
|
|
@@ -6758,8 +6759,8 @@ var init_template = __esm({
|
|
|
6758
6759
|
() => this.runCmd(args.join(" "), { user: options == null ? void 0 : options.user })
|
|
6759
6760
|
);
|
|
6760
6761
|
}
|
|
6761
|
-
makeDir(
|
|
6762
|
-
const paths2 = Array.isArray(
|
|
6762
|
+
makeDir(path3, options) {
|
|
6763
|
+
const paths2 = Array.isArray(path3) ? path3 : [path3];
|
|
6763
6764
|
const args = ["mkdir", "-p"];
|
|
6764
6765
|
if (options == null ? void 0 : options.mode) {
|
|
6765
6766
|
args.push(`-m ${padOctal(options.mode)}`);
|
|
@@ -6894,7 +6895,7 @@ var init_template = __esm({
|
|
|
6894
6895
|
})
|
|
6895
6896
|
);
|
|
6896
6897
|
}
|
|
6897
|
-
gitClone(url,
|
|
6898
|
+
gitClone(url, path3, options) {
|
|
6898
6899
|
const args = ["git", "clone", url];
|
|
6899
6900
|
if (options == null ? void 0 : options.branch) {
|
|
6900
6901
|
args.push(`--branch ${options.branch}`);
|
|
@@ -6903,8 +6904,8 @@ var init_template = __esm({
|
|
|
6903
6904
|
if (options == null ? void 0 : options.depth) {
|
|
6904
6905
|
args.push(`--depth ${options.depth}`);
|
|
6905
6906
|
}
|
|
6906
|
-
if (
|
|
6907
|
-
args.push(
|
|
6907
|
+
if (path3) {
|
|
6908
|
+
args.push(path3.toString());
|
|
6908
6909
|
}
|
|
6909
6910
|
return this.runInNewStackTraceContext(
|
|
6910
6911
|
() => this.runCmd(args.join(" "), { user: options == null ? void 0 : options.user })
|
|
@@ -8305,10 +8306,10 @@ var init_sandbox3 = __esm({
|
|
|
8305
8306
|
}
|
|
8306
8307
|
}
|
|
8307
8308
|
async screenshot(format = "bytes") {
|
|
8308
|
-
const
|
|
8309
|
-
await this.commands.run(`scrot --pointer ${
|
|
8310
|
-
const file = await this.files.read(
|
|
8311
|
-
this.files.remove(
|
|
8309
|
+
const path3 = `/tmp/screenshot-${generateRandomString()}.png`;
|
|
8310
|
+
await this.commands.run(`scrot --pointer ${path3}`);
|
|
8311
|
+
const file = await this.files.read(path3, { format });
|
|
8312
|
+
this.files.remove(path3);
|
|
8312
8313
|
return file;
|
|
8313
8314
|
}
|
|
8314
8315
|
/**
|
|
@@ -8657,7 +8658,7 @@ function mergeConnectionOpts(base, next) {
|
|
|
8657
8658
|
headers: __spreadValues(__spreadValues({}, baseHeaders), nextHeaders)
|
|
8658
8659
|
});
|
|
8659
8660
|
}
|
|
8660
|
-
var RuntimeSandboxNamespace, SandboxNamespace, TemplateNamespace, VolumeNamespace, SecretNamespace, PPIO;
|
|
8661
|
+
var import_node_path2, import_node_url2, RuntimeSandboxNamespace, SandboxNamespace, TemplateNamespace, VolumeNamespace, SecretNamespace, PPIO;
|
|
8661
8662
|
var init_client = __esm({
|
|
8662
8663
|
"src/core/client.ts"() {
|
|
8663
8664
|
"use strict";
|
|
@@ -8665,6 +8666,9 @@ var init_client = __esm({
|
|
|
8665
8666
|
init_template();
|
|
8666
8667
|
init_volume();
|
|
8667
8668
|
init_secret();
|
|
8669
|
+
init_utils3();
|
|
8670
|
+
import_node_path2 = __toESM(require("path"));
|
|
8671
|
+
import_node_url2 = require("url");
|
|
8668
8672
|
RuntimeSandboxNamespace = class {
|
|
8669
8673
|
constructor(opts, loadSandbox) {
|
|
8670
8674
|
this.opts = opts;
|
|
@@ -8861,7 +8865,18 @@ var init_client = __esm({
|
|
|
8861
8865
|
this.toDockerfile = Template.toDockerfile;
|
|
8862
8866
|
}
|
|
8863
8867
|
new(options) {
|
|
8864
|
-
|
|
8868
|
+
var _a3;
|
|
8869
|
+
let callerContext = ".";
|
|
8870
|
+
for (const site of callsites(2)) {
|
|
8871
|
+
const fileName = site.getFileName();
|
|
8872
|
+
if (fileName && (!fileName.includes("/src/core/") || fileName.includes("/src/core/tests/")) && !fileName.includes("/node_modules/ppio-sandbox/")) {
|
|
8873
|
+
callerContext = import_node_path2.default.dirname(fileName.startsWith("file:") ? (0, import_node_url2.fileURLToPath)(fileName) : fileName);
|
|
8874
|
+
break;
|
|
8875
|
+
}
|
|
8876
|
+
}
|
|
8877
|
+
return Template(__spreadProps(__spreadValues({}, options), {
|
|
8878
|
+
fileContextPath: (_a3 = options == null ? void 0 : options.fileContextPath) != null ? _a3 : callerContext
|
|
8879
|
+
}));
|
|
8865
8880
|
}
|
|
8866
8881
|
list(opts) {
|
|
8867
8882
|
return Template.list(mergeConnectionOpts(this.opts, opts));
|