ppio-sandbox 2.1.1-a3 → 2.1.1

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.
@@ -60,7 +60,7 @@ import createClient from "openapi-fetch";
60
60
  import platform2 from "platform";
61
61
 
62
62
  // package.json
63
- var version = "2.1.1-a3";
63
+ var version = "2.1.1";
64
64
 
65
65
  // src/core/utils.ts
66
66
  import platform from "platform";
@@ -1458,7 +1458,7 @@ var Filesystem2 = class {
1458
1458
  this.defaultWatchRecursive = false;
1459
1459
  this.rpc = createClient5(Filesystem, transport);
1460
1460
  }
1461
- async read(path3, opts) {
1461
+ async read(path2, opts) {
1462
1462
  var _a3;
1463
1463
  const format = (_a3 = opts == null ? void 0 : opts.format) != null ? _a3 : "text";
1464
1464
  let user = opts == null ? void 0 : opts.user;
@@ -1472,7 +1472,7 @@ var Filesystem2 = class {
1472
1472
  const res = await this.envdApi.api.GET("/files", {
1473
1473
  params: {
1474
1474
  query: {
1475
- path: path3,
1475
+ path: path2,
1476
1476
  username: user
1477
1477
  }
1478
1478
  },
@@ -1505,7 +1505,7 @@ var Filesystem2 = class {
1505
1505
  "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."
1506
1506
  );
1507
1507
  }
1508
- const { path: path3, writeOpts, writeFiles } = typeof pathOrFiles === "string" ? {
1508
+ const { path: path2, writeOpts, writeFiles } = typeof pathOrFiles === "string" ? {
1509
1509
  path: pathOrFiles,
1510
1510
  writeOpts: opts,
1511
1511
  writeFiles: [
@@ -1535,7 +1535,7 @@ var Filesystem2 = class {
1535
1535
  }
1536
1536
  const uploadResults = await Promise.all(
1537
1537
  writeFiles.map(async (file) => {
1538
- const filePath = path3 != null ? path3 : file.path;
1538
+ const filePath = path2 != null ? path2 : file.path;
1539
1539
  const body = await toUploadBody(file.data, useGzip);
1540
1540
  const res = await this.envdApi.api.POST("/files", {
1541
1541
  params: {
@@ -1573,13 +1573,13 @@ var Filesystem2 = class {
1573
1573
  formData.append(
1574
1574
  "file",
1575
1575
  await toBlob(file.data),
1576
- (_a3 = file.path) != null ? _a3 : path3
1576
+ (_a3 = file.path) != null ? _a3 : path2
1577
1577
  );
1578
1578
  }
1579
1579
  const res = await this.envdApi.api.POST("/files", {
1580
1580
  params: {
1581
1581
  query: {
1582
- path: path3,
1582
+ path: path2,
1583
1583
  username: user
1584
1584
  }
1585
1585
  },
@@ -1597,7 +1597,7 @@ var Filesystem2 = class {
1597
1597
  }
1598
1598
  results.push(...files);
1599
1599
  }
1600
- return results.length === 1 && path3 ? results[0] : results;
1600
+ return results.length === 1 && path2 ? results[0] : results;
1601
1601
  }
1602
1602
  /**
1603
1603
  * Write multiple files.
@@ -1625,7 +1625,7 @@ var Filesystem2 = class {
1625
1625
  *
1626
1626
  * @returns list of entries in the sandbox filesystem directory.
1627
1627
  */
1628
- async list(path3, opts) {
1628
+ async list(path2, opts) {
1629
1629
  var _a3;
1630
1630
  if (typeof (opts == null ? void 0 : opts.depth) === "number" && opts.depth < 1) {
1631
1631
  throw new InvalidArgumentError("depth should be at least one");
@@ -1633,7 +1633,7 @@ var Filesystem2 = class {
1633
1633
  try {
1634
1634
  const res = await this.rpc.listDir(
1635
1635
  {
1636
- path: path3,
1636
+ path: path2,
1637
1637
  depth: (_a3 = opts == null ? void 0 : opts.depth) != null ? _a3 : 1
1638
1638
  },
1639
1639
  {
@@ -1672,10 +1672,10 @@ var Filesystem2 = class {
1672
1672
  *
1673
1673
  * @returns `true` if the directory was created, `false` if it already exists.
1674
1674
  */
1675
- async makeDir(path3, opts) {
1675
+ async makeDir(path2, opts) {
1676
1676
  try {
1677
1677
  await this.rpc.makeDir(
1678
- { path: path3 },
1678
+ { path: path2 },
1679
1679
  {
1680
1680
  headers: authenticationHeader(this.envdApi.version, opts == null ? void 0 : opts.user),
1681
1681
  signal: this.connectionConfig.getSignal(opts == null ? void 0 : opts.requestTimeoutMs)
@@ -1738,10 +1738,10 @@ var Filesystem2 = class {
1738
1738
  * @param path path to a file or directory.
1739
1739
  * @param opts connection options.
1740
1740
  */
1741
- async remove(path3, opts) {
1741
+ async remove(path2, opts) {
1742
1742
  try {
1743
1743
  await this.rpc.remove(
1744
- { path: path3 },
1744
+ { path: path2 },
1745
1745
  {
1746
1746
  headers: authenticationHeader(this.envdApi.version, opts == null ? void 0 : opts.user),
1747
1747
  signal: this.connectionConfig.getSignal(opts == null ? void 0 : opts.requestTimeoutMs)
@@ -1759,10 +1759,10 @@ var Filesystem2 = class {
1759
1759
  *
1760
1760
  * @returns `true` if the file or directory exists, `false` otherwise
1761
1761
  */
1762
- async exists(path3, opts) {
1762
+ async exists(path2, opts) {
1763
1763
  try {
1764
1764
  await this.rpc.stat(
1765
- { path: path3 },
1765
+ { path: path2 },
1766
1766
  {
1767
1767
  headers: authenticationHeader(this.envdApi.version, opts == null ? void 0 : opts.user),
1768
1768
  signal: this.connectionConfig.getSignal(opts == null ? void 0 : opts.requestTimeoutMs)
@@ -1786,10 +1786,10 @@ var Filesystem2 = class {
1786
1786
  *
1787
1787
  * @returns information about the file or directory like name, type, and path.
1788
1788
  */
1789
- async getInfo(path3, opts) {
1789
+ async getInfo(path2, opts) {
1790
1790
  try {
1791
1791
  const res = await this.rpc.stat(
1792
- { path: path3 },
1792
+ { path: path2 },
1793
1793
  {
1794
1794
  headers: authenticationHeader(this.envdApi.version, opts == null ? void 0 : opts.user),
1795
1795
  signal: this.connectionConfig.getSignal(opts == null ? void 0 : opts.requestTimeoutMs)
@@ -1825,7 +1825,7 @@ var Filesystem2 = class {
1825
1825
  *
1826
1826
  * @returns `WatchHandle` object for stopping watching directory.
1827
1827
  */
1828
- async watchDir(path3, onEvent, opts) {
1828
+ async watchDir(path2, onEvent, opts) {
1829
1829
  var _a3, _b, _c;
1830
1830
  if ((opts == null ? void 0 : opts.recursive) && this.envdApi.version && compareVersions3(this.envdApi.version, ENVD_VERSION_RECURSIVE_WATCH) < 0) {
1831
1831
  throw new TemplateError(
@@ -1839,7 +1839,7 @@ var Filesystem2 = class {
1839
1839
  }, requestTimeoutMs) : void 0;
1840
1840
  const events = this.rpc.watchDir(
1841
1841
  {
1842
- path: path3,
1842
+ path: path2,
1843
1843
  recursive: (_b = opts == null ? void 0 : opts.recursive) != null ? _b : this.defaultWatchRecursive
1844
1844
  },
1845
1845
  {
@@ -2060,11 +2060,11 @@ function parseGitStatus(output) {
2060
2060
  }
2061
2061
  const indexStatus = line[0];
2062
2062
  const workingTreeStatus = line[1];
2063
- const path3 = line.slice(3);
2063
+ const path2 = line.slice(3);
2064
2064
  let renamedFrom;
2065
- let name = path3;
2066
- if (path3.includes(" -> ")) {
2067
- const parts = path3.split(" -> ");
2065
+ let name = path2;
2066
+ if (path2.includes(" -> ")) {
2067
+ const parts = path2.split(" -> ");
2068
2068
  renamedFrom = parts[0];
2069
2069
  name = parts.slice(1).join(" -> ");
2070
2070
  }
@@ -2173,16 +2173,16 @@ function buildUpstreamErrorMessage(action) {
2173
2173
  }
2174
2174
  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>).";
2175
2175
  }
2176
- function getRepoPathForScope(scope, path3) {
2176
+ function getRepoPathForScope(scope, path2) {
2177
2177
  if (scope !== "local") {
2178
2178
  return void 0;
2179
2179
  }
2180
- if (!path3) {
2180
+ if (!path2) {
2181
2181
  throw new InvalidArgumentError(
2182
2182
  'A repository path is required when using scope "local".'
2183
2183
  );
2184
2184
  }
2185
- return path3;
2185
+ return path2;
2186
2186
  }
2187
2187
 
2188
2188
  // src/core/sandbox/git/index.ts
@@ -2206,7 +2206,7 @@ var Git = class {
2206
2206
  password,
2207
2207
  branch,
2208
2208
  depth,
2209
- path: path3,
2209
+ path: path2,
2210
2210
  dangerouslyStoreCredentials
2211
2211
  } = _a3, rest = __objRest(_a3, [
2212
2212
  "username",
@@ -2225,7 +2225,7 @@ var Git = class {
2225
2225
  const urlWithCreds = authUsername && authPassword ? withCredentials(url, authUsername, authPassword) : url;
2226
2226
  const sanitizedUrl = stripCredentials(urlWithCreds);
2227
2227
  const stripInlineCreds = !dangerouslyStoreCredentials && sanitizedUrl !== urlWithCreds;
2228
- const repoPath = stripInlineCreds ? path3 != null ? path3 : deriveRepoDirFromUrl(url) : path3;
2228
+ const repoPath = stripInlineCreds ? path2 != null ? path2 : deriveRepoDirFromUrl(url) : path2;
2229
2229
  if (stripInlineCreds && !repoPath) {
2230
2230
  throw new InvalidArgumentError(
2231
2231
  "A destination path is required when using credentials without storing them."
@@ -2263,7 +2263,7 @@ var Git = class {
2263
2263
  * @param opts Init options.
2264
2264
  * @returns Command result from the command runner.
2265
2265
  */
2266
- async init(path3, opts) {
2266
+ async init(path2, opts) {
2267
2267
  const _a3 = opts != null ? opts : {}, { bare, initialBranch } = _a3, rest = __objRest(_a3, ["bare", "initialBranch"]);
2268
2268
  const args = ["init"];
2269
2269
  if (initialBranch) {
@@ -2272,7 +2272,7 @@ var Git = class {
2272
2272
  if (bare) {
2273
2273
  args.push("--bare");
2274
2274
  }
2275
- args.push(path3);
2275
+ args.push(path2);
2276
2276
  return this.runGit(args, void 0, rest);
2277
2277
  }
2278
2278
  /**
@@ -2284,7 +2284,7 @@ var Git = class {
2284
2284
  * @param opts Remote add options.
2285
2285
  * @returns Command result from the command runner.
2286
2286
  */
2287
- async remoteAdd(path3, name, url, opts) {
2287
+ async remoteAdd(path2, name, url, opts) {
2288
2288
  if (!name || !url) {
2289
2289
  throw new InvalidArgumentError(
2290
2290
  "Both remote name and URL are required to add a git remote."
@@ -2297,13 +2297,13 @@ var Git = class {
2297
2297
  }
2298
2298
  addArgs.push(name, url);
2299
2299
  if (!overwrite) {
2300
- return this.runGit(addArgs, path3, rest);
2300
+ return this.runGit(addArgs, path2, rest);
2301
2301
  }
2302
- const addCmd = buildGitCommand(addArgs, path3);
2303
- const setUrlCmd = buildGitCommand(["remote", "set-url", name, url], path3);
2302
+ const addCmd = buildGitCommand(addArgs, path2);
2303
+ const setUrlCmd = buildGitCommand(["remote", "set-url", name, url], path2);
2304
2304
  let cmd = `${addCmd} || ${setUrlCmd}`;
2305
2305
  if (fetch2) {
2306
- const fetchCmd = buildGitCommand(["fetch", name], path3);
2306
+ const fetchCmd = buildGitCommand(["fetch", name], path2);
2307
2307
  cmd = `(${cmd}) && ${fetchCmd}`;
2308
2308
  }
2309
2309
  return this.runShell(cmd, rest);
@@ -2318,11 +2318,11 @@ var Git = class {
2318
2318
  * @param opts Command execution options.
2319
2319
  * @returns Remote URL if present.
2320
2320
  */
2321
- async remoteGet(path3, name, opts) {
2321
+ async remoteGet(path2, name, opts) {
2322
2322
  if (!name) {
2323
2323
  throw new InvalidArgumentError("Remote name is required.");
2324
2324
  }
2325
- const cmd = `${buildGitCommand(["remote", "get-url", name], path3)} || true`;
2325
+ const cmd = `${buildGitCommand(["remote", "get-url", name], path2)} || true`;
2326
2326
  const result = await this.runShell(cmd, opts);
2327
2327
  const trimmed = result.stdout.trim();
2328
2328
  return trimmed.length > 0 ? trimmed : void 0;
@@ -2334,10 +2334,10 @@ var Git = class {
2334
2334
  * @param opts Command execution options.
2335
2335
  * @returns Parsed git status.
2336
2336
  */
2337
- async status(path3, opts) {
2337
+ async status(path2, opts) {
2338
2338
  const result = await this.runGit(
2339
2339
  ["status", "--porcelain=1", "-b"],
2340
- path3,
2340
+ path2,
2341
2341
  opts
2342
2342
  );
2343
2343
  return parseGitStatus(result.stdout);
@@ -2349,10 +2349,10 @@ var Git = class {
2349
2349
  * @param opts Command execution options.
2350
2350
  * @returns Parsed branch list.
2351
2351
  */
2352
- async branches(path3, opts) {
2352
+ async branches(path2, opts) {
2353
2353
  const result = await this.runGit(
2354
2354
  ["branch", "--format=%(refname:short) %(HEAD)"],
2355
- path3,
2355
+ path2,
2356
2356
  opts
2357
2357
  );
2358
2358
  return parseGitBranches(result.stdout);
@@ -2365,8 +2365,8 @@ var Git = class {
2365
2365
  * @param opts Command execution options.
2366
2366
  * @returns Command result from the command runner.
2367
2367
  */
2368
- async createBranch(path3, branch, opts) {
2369
- return this.runGit(["checkout", "-b", branch], path3, opts);
2368
+ async createBranch(path2, branch, opts) {
2369
+ return this.runGit(["checkout", "-b", branch], path2, opts);
2370
2370
  }
2371
2371
  /**
2372
2372
  * Check out an existing branch.
@@ -2376,8 +2376,8 @@ var Git = class {
2376
2376
  * @param opts Command execution options.
2377
2377
  * @returns Command result from the command runner.
2378
2378
  */
2379
- async checkoutBranch(path3, branch, opts) {
2380
- return this.runGit(["checkout", branch], path3, opts);
2379
+ async checkoutBranch(path2, branch, opts) {
2380
+ return this.runGit(["checkout", branch], path2, opts);
2381
2381
  }
2382
2382
  /**
2383
2383
  * Delete a branch.
@@ -2387,10 +2387,10 @@ var Git = class {
2387
2387
  * @param opts Delete options.
2388
2388
  * @returns Command result from the command runner.
2389
2389
  */
2390
- async deleteBranch(path3, branch, opts) {
2390
+ async deleteBranch(path2, branch, opts) {
2391
2391
  const _a3 = opts != null ? opts : {}, { force } = _a3, rest = __objRest(_a3, ["force"]);
2392
2392
  const args = ["branch", force ? "-D" : "-d", branch];
2393
- return this.runGit(args, path3, rest);
2393
+ return this.runGit(args, path2, rest);
2394
2394
  }
2395
2395
  /**
2396
2396
  * Stage files for commit.
@@ -2399,7 +2399,7 @@ var Git = class {
2399
2399
  * @param opts Add options.
2400
2400
  * @returns Command result from the command runner.
2401
2401
  */
2402
- async add(path3, opts) {
2402
+ async add(path2, opts) {
2403
2403
  const _a3 = opts != null ? opts : {}, { files, all = true } = _a3, rest = __objRest(_a3, ["files", "all"]);
2404
2404
  const args = ["add"];
2405
2405
  if (!files || files.length === 0) {
@@ -2407,7 +2407,7 @@ var Git = class {
2407
2407
  } else {
2408
2408
  args.push("--", ...files);
2409
2409
  }
2410
- return this.runGit(args, path3, rest);
2410
+ return this.runGit(args, path2, rest);
2411
2411
  }
2412
2412
  /**
2413
2413
  * Create a commit in the repository.
@@ -2417,7 +2417,7 @@ var Git = class {
2417
2417
  * @param opts Commit options.
2418
2418
  * @returns Command result from the command runner.
2419
2419
  */
2420
- async commit(path3, message, opts) {
2420
+ async commit(path2, message, opts) {
2421
2421
  const _a3 = opts != null ? opts : {}, { authorName, authorEmail, allowEmpty } = _a3, rest = __objRest(_a3, ["authorName", "authorEmail", "allowEmpty"]);
2422
2422
  const args = ["commit", "-m", message];
2423
2423
  if (allowEmpty) {
@@ -2430,7 +2430,7 @@ var Git = class {
2430
2430
  if (authorEmail) {
2431
2431
  authorArgs.push("-c", `user.email=${authorEmail}`);
2432
2432
  }
2433
- return this.runGit([...authorArgs, ...args], path3, rest);
2433
+ return this.runGit([...authorArgs, ...args], path2, rest);
2434
2434
  }
2435
2435
  /**
2436
2436
  * Reset the current HEAD to a specified state.
@@ -2439,7 +2439,7 @@ var Git = class {
2439
2439
  * @param opts Reset options.
2440
2440
  * @returns Command result from the command runner.
2441
2441
  */
2442
- async reset(path3, opts) {
2442
+ async reset(path2, opts) {
2443
2443
  const _a3 = opts != null ? opts : {}, { mode, target, paths: paths2 } = _a3, rest = __objRest(_a3, ["mode", "target", "paths"]);
2444
2444
  const allowedModes = [
2445
2445
  "soft",
@@ -2463,7 +2463,7 @@ var Git = class {
2463
2463
  if (paths2 && paths2.length > 0) {
2464
2464
  args.push("--", ...paths2);
2465
2465
  }
2466
- return this.runGit(args, path3, rest);
2466
+ return this.runGit(args, path2, rest);
2467
2467
  }
2468
2468
  /**
2469
2469
  * Restore working tree files or unstage changes.
@@ -2472,7 +2472,7 @@ var Git = class {
2472
2472
  * @param opts Restore options.
2473
2473
  * @returns Command result from the command runner.
2474
2474
  */
2475
- async restore(path3, opts) {
2475
+ async restore(path2, opts) {
2476
2476
  const _a3 = opts, { paths: paths2, staged, worktree, source } = _a3, rest = __objRest(_a3, ["paths", "staged", "worktree", "source"]);
2477
2477
  if (!paths2 || paths2.length === 0) {
2478
2478
  throw new InvalidArgumentError("At least one path is required.");
@@ -2502,7 +2502,7 @@ var Git = class {
2502
2502
  args.push("--source", source);
2503
2503
  }
2504
2504
  args.push("--", ...paths2);
2505
- return this.runGit(args, path3, rest);
2505
+ return this.runGit(args, path2, rest);
2506
2506
  }
2507
2507
  /**
2508
2508
  * Push commits to a remote.
@@ -2511,7 +2511,7 @@ var Git = class {
2511
2511
  * @param opts Push options.
2512
2512
  * @returns Command result from the command runner.
2513
2513
  */
2514
- async push(path3, opts) {
2514
+ async push(path2, opts) {
2515
2515
  const _a3 = opts != null ? opts : {}, {
2516
2516
  remote,
2517
2517
  branch,
@@ -2531,16 +2531,16 @@ var Git = class {
2531
2531
  );
2532
2532
  }
2533
2533
  if (username && password) {
2534
- const remoteName = await this.resolveRemoteName(path3, remote, rest);
2534
+ const remoteName = await this.resolveRemoteName(path2, remote, rest);
2535
2535
  return this.withRemoteCredentials(
2536
- path3,
2536
+ path2,
2537
2537
  remoteName,
2538
2538
  username,
2539
2539
  password,
2540
2540
  rest,
2541
2541
  () => this.runGit(
2542
2542
  buildPushArgs(remoteName, { remote, branch, setUpstream }),
2543
- path3,
2543
+ path2,
2544
2544
  rest
2545
2545
  )
2546
2546
  );
@@ -2548,7 +2548,7 @@ var Git = class {
2548
2548
  try {
2549
2549
  return await this.runGit(
2550
2550
  buildPushArgs(void 0, { remote, branch, setUpstream }),
2551
- path3,
2551
+ path2,
2552
2552
  rest
2553
2553
  );
2554
2554
  } catch (err) {
@@ -2570,7 +2570,7 @@ var Git = class {
2570
2570
  * @param opts Pull options.
2571
2571
  * @returns Command result from the command runner.
2572
2572
  */
2573
- async pull(path3, opts) {
2573
+ async pull(path2, opts) {
2574
2574
  const _a3 = opts != null ? opts : {}, { remote, branch, username, password } = _a3, rest = __objRest(_a3, ["remote", "branch", "username", "password"]);
2575
2575
  if (password && !username) {
2576
2576
  throw new InvalidArgumentError(
@@ -2578,7 +2578,7 @@ var Git = class {
2578
2578
  );
2579
2579
  }
2580
2580
  if (!remote && !branch) {
2581
- const hasUpstream = await this.hasUpstream(path3, rest);
2581
+ const hasUpstream = await this.hasUpstream(path2, rest);
2582
2582
  if (!hasUpstream) {
2583
2583
  throw new GitUpstreamError(buildUpstreamErrorMessage("pull"));
2584
2584
  }
@@ -2595,18 +2595,18 @@ var Git = class {
2595
2595
  return args;
2596
2596
  };
2597
2597
  if (username && password) {
2598
- const remoteName = await this.resolveRemoteName(path3, remote, rest);
2598
+ const remoteName = await this.resolveRemoteName(path2, remote, rest);
2599
2599
  return this.withRemoteCredentials(
2600
- path3,
2600
+ path2,
2601
2601
  remoteName,
2602
2602
  username,
2603
2603
  password,
2604
2604
  rest,
2605
- () => this.runGit(buildArgs(remoteName), path3, rest)
2605
+ () => this.runGit(buildArgs(remoteName), path2, rest)
2606
2606
  );
2607
2607
  }
2608
2608
  try {
2609
- return await this.runGit(buildArgs(), path3, rest);
2609
+ return await this.runGit(buildArgs(), path2, rest);
2610
2610
  } catch (err) {
2611
2611
  if (isAuthFailure(err)) {
2612
2612
  throw new GitAuthError(
@@ -2743,8 +2743,8 @@ var Git = class {
2743
2743
  envs: mergedEnvs
2744
2744
  }));
2745
2745
  }
2746
- async getRemoteUrl(path3, remote, opts) {
2747
- const result = await this.runGit(["remote", "get-url", remote], path3, opts);
2746
+ async getRemoteUrl(path2, remote, opts) {
2747
+ const result = await this.runGit(["remote", "get-url", remote], path2, opts);
2748
2748
  const url = result.stdout.trim();
2749
2749
  if (!url) {
2750
2750
  throw new InvalidArgumentError(
@@ -2753,11 +2753,11 @@ var Git = class {
2753
2753
  }
2754
2754
  return url;
2755
2755
  }
2756
- async resolveRemoteName(path3, remote, opts) {
2756
+ async resolveRemoteName(path2, remote, opts) {
2757
2757
  if (remote) {
2758
2758
  return remote;
2759
2759
  }
2760
- const result = await this.runGit(["remote"], path3, opts);
2760
+ const result = await this.runGit(["remote"], path2, opts);
2761
2761
  const remotes = result.stdout.split("\n").map((line) => line.trim()).filter(Boolean);
2762
2762
  if (remotes.length === 1) {
2763
2763
  return remotes[0];
@@ -2766,10 +2766,10 @@ var Git = class {
2766
2766
  "Remote is required when using username/password and the repository has multiple remotes."
2767
2767
  );
2768
2768
  }
2769
- async withRemoteCredentials(path3, remote, username, password, opts, operation) {
2770
- const originalUrl = await this.getRemoteUrl(path3, remote, opts);
2769
+ async withRemoteCredentials(path2, remote, username, password, opts, operation) {
2770
+ const originalUrl = await this.getRemoteUrl(path2, remote, opts);
2771
2771
  const credentialUrl = withCredentials(originalUrl, username, password);
2772
- await this.runGit(["remote", "set-url", remote, credentialUrl], path3, opts);
2772
+ await this.runGit(["remote", "set-url", remote, credentialUrl], path2, opts);
2773
2773
  let result;
2774
2774
  let operationError;
2775
2775
  try {
@@ -2779,7 +2779,7 @@ var Git = class {
2779
2779
  }
2780
2780
  let restoreError;
2781
2781
  try {
2782
- await this.runGit(["remote", "set-url", remote, originalUrl], path3, opts);
2782
+ await this.runGit(["remote", "set-url", remote, originalUrl], path2, opts);
2783
2783
  } catch (err) {
2784
2784
  restoreError = err;
2785
2785
  }
@@ -2791,11 +2791,11 @@ var Git = class {
2791
2791
  }
2792
2792
  return result;
2793
2793
  }
2794
- async hasUpstream(path3, opts) {
2794
+ async hasUpstream(path2, opts) {
2795
2795
  try {
2796
2796
  const result = await this.runGit(
2797
2797
  ["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
2798
- path3,
2798
+ path2,
2799
2799
  opts
2800
2800
  );
2801
2801
  return result.stdout.trim().length > 0;
@@ -2963,11 +2963,11 @@ function normalizeSecretHosts(hosts) {
2963
2963
  }
2964
2964
  return normalizedHosts;
2965
2965
  }
2966
- async function request(method, path3, feature, opts, body) {
2966
+ async function request(method, path2, feature, opts, body) {
2967
2967
  const config = new ConnectionConfig(opts);
2968
2968
  raiseIfLegacy(config, feature, SecretError);
2969
2969
  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}` } : {});
2970
- const response = await fetch(`${config.apiUrl}${path3}`, {
2970
+ const response = await fetch(`${config.apiUrl}${path2}`, {
2971
2971
  method,
2972
2972
  headers,
2973
2973
  body: body ? JSON.stringify(body) : void 0,
@@ -3282,7 +3282,7 @@ var SandboxApi = class {
3282
3282
  }
3283
3283
  return true;
3284
3284
  }
3285
- static async mountVolume(sandboxId, name, path3, opts) {
3285
+ static async mountVolume(sandboxId, name, path2, opts) {
3286
3286
  var _a3, _b;
3287
3287
  const config = new ConnectionConfig(opts);
3288
3288
  raiseIfLegacy(config, "Sandbox.mountVolume", SandboxError);
@@ -3293,7 +3293,7 @@ var SandboxApi = class {
3293
3293
  headers: getRawApiHeaders(config, {
3294
3294
  "Content-Type": "application/json"
3295
3295
  }),
3296
- body: JSON.stringify({ name, path: path3 }),
3296
+ body: JSON.stringify({ name, path: path2 }),
3297
3297
  signal: config.getSignal(opts == null ? void 0 : opts.requestTimeoutMs)
3298
3298
  }
3299
3299
  );
@@ -3318,14 +3318,14 @@ var SandboxApi = class {
3318
3318
  volumeMounts: (_b = data.volumeMounts) != null ? _b : []
3319
3319
  };
3320
3320
  }
3321
- static async unmountVolume(sandboxId, path3, opts) {
3321
+ static async unmountVolume(sandboxId, path2, opts) {
3322
3322
  var _a3, _b;
3323
3323
  const config = new ConnectionConfig(opts);
3324
3324
  raiseIfLegacy(config, "Sandbox.unmountVolume", SandboxError);
3325
3325
  const url = new URL(
3326
3326
  `${config.apiUrl}/sandboxes/${encodeURIComponent(sandboxId)}/volume-mounts`
3327
3327
  );
3328
- url.searchParams.set("path", path3);
3328
+ url.searchParams.set("path", path2);
3329
3329
  if (opts == null ? void 0 : opts.force) {
3330
3330
  url.searchParams.set("force", "true");
3331
3331
  }
@@ -4005,7 +4005,7 @@ var SnapshotPaginator = class extends BasePaginator {
4005
4005
 
4006
4006
  // src/core/sandbox/signature.ts
4007
4007
  async function getSignature({
4008
- path: path3,
4008
+ path: path2,
4009
4009
  operation,
4010
4010
  user,
4011
4011
  expirationInSeconds,
@@ -4022,9 +4022,9 @@ async function getSignature({
4022
4022
  user = "";
4023
4023
  }
4024
4024
  if (signatureExpiration === null) {
4025
- signatureRaw = `${path3}:${operation}:${user}:${envdAccessToken}`;
4025
+ signatureRaw = `${path2}:${operation}:${user}:${envdAccessToken}`;
4026
4026
  } else {
4027
- signatureRaw = `${path3}:${operation}:${user}:${envdAccessToken}:${signatureExpiration.toString()}`;
4027
+ signatureRaw = `${path2}:${operation}:${user}:${envdAccessToken}:${signatureExpiration.toString()}`;
4028
4028
  }
4029
4029
  const hashBase64 = await sha256(signatureRaw);
4030
4030
  const signature = "v1_" + hashBase64.replace(/=+$/, "");
@@ -4208,8 +4208,8 @@ var Sandbox = class extends SandboxApi {
4208
4208
  *
4209
4209
  * @returns updated sandbox information.
4210
4210
  */
4211
- static async mountVolume(sandboxId, name, path3, opts) {
4212
- return await SandboxApi.mountVolume(sandboxId, name, path3, opts);
4211
+ static async mountVolume(sandboxId, name, path2, opts) {
4212
+ return await SandboxApi.mountVolume(sandboxId, name, path2, opts);
4213
4213
  }
4214
4214
  /**
4215
4215
  * Unmount a volume from a sandbox.
@@ -4221,8 +4221,8 @@ var Sandbox = class extends SandboxApi {
4221
4221
  *
4222
4222
  * @returns updated sandbox information.
4223
4223
  */
4224
- static async unmountVolume(sandboxId, path3, opts) {
4225
- return await SandboxApi.unmountVolume(sandboxId, path3, opts);
4224
+ static async unmountVolume(sandboxId, path2, opts) {
4225
+ return await SandboxApi.unmountVolume(sandboxId, path2, opts);
4226
4226
  }
4227
4227
  /**
4228
4228
  * Commit a sandbox to create a snapshot template.
@@ -4457,11 +4457,11 @@ var Sandbox = class extends SandboxApi {
4457
4457
  *
4458
4458
  * @returns updated sandbox information.
4459
4459
  */
4460
- async mountVolume(name, path3, opts) {
4460
+ async mountVolume(name, path2, opts) {
4461
4461
  return await SandboxApi.mountVolume(
4462
4462
  this.sandboxId,
4463
4463
  name,
4464
- path3,
4464
+ path2,
4465
4465
  this.resolveApiOpts(opts)
4466
4466
  );
4467
4467
  }
@@ -4474,10 +4474,10 @@ var Sandbox = class extends SandboxApi {
4474
4474
  *
4475
4475
  * @returns updated sandbox information.
4476
4476
  */
4477
- async unmountVolume(path3, opts) {
4477
+ async unmountVolume(path2, opts) {
4478
4478
  return await SandboxApi.unmountVolume(
4479
4479
  this.sandboxId,
4480
- path3,
4480
+ path2,
4481
4481
  this.resolveApiOpts(opts)
4482
4482
  );
4483
4483
  }
@@ -4611,7 +4611,7 @@ var Sandbox = class extends SandboxApi {
4611
4611
  *
4612
4612
  * @returns URL for uploading file.
4613
4613
  */
4614
- async uploadUrl(path3, opts) {
4614
+ async uploadUrl(path2, opts) {
4615
4615
  opts = opts != null ? opts : {};
4616
4616
  const useSignature = !!this.envdAccessToken;
4617
4617
  if (!useSignature && opts.useSignatureExpiration != void 0) {
@@ -4623,7 +4623,7 @@ var Sandbox = class extends SandboxApi {
4623
4623
  if (username == void 0 && compareVersions5(this.envdApi.version, ENVD_DEFAULT_USER) < 0) {
4624
4624
  username = defaultUsername;
4625
4625
  }
4626
- const filePath = path3 != null ? path3 : "";
4626
+ const filePath = path2 != null ? path2 : "";
4627
4627
  const fileUrl = this.fileUrl(filePath, username);
4628
4628
  if (useSignature) {
4629
4629
  const url = new URL(fileUrl);
@@ -4651,7 +4651,7 @@ var Sandbox = class extends SandboxApi {
4651
4651
  *
4652
4652
  * @returns URL for downloading file.
4653
4653
  */
4654
- async downloadUrl(path3, opts) {
4654
+ async downloadUrl(path2, opts) {
4655
4655
  opts = opts != null ? opts : {};
4656
4656
  const useSignature = !!this.envdAccessToken;
4657
4657
  if (!useSignature && opts.useSignatureExpiration != void 0) {
@@ -4663,11 +4663,11 @@ var Sandbox = class extends SandboxApi {
4663
4663
  if (username == void 0 && compareVersions5(this.envdApi.version, ENVD_DEFAULT_USER) < 0) {
4664
4664
  username = defaultUsername;
4665
4665
  }
4666
- const fileUrl = this.fileUrl(path3, username);
4666
+ const fileUrl = this.fileUrl(path2, username);
4667
4667
  if (useSignature) {
4668
4668
  const url = new URL(fileUrl);
4669
4669
  const sig = await getSignature({
4670
- path: path3,
4670
+ path: path2,
4671
4671
  operation: "read",
4672
4672
  user: username,
4673
4673
  expirationInSeconds: opts.useSignatureExpiration,
@@ -4721,13 +4721,13 @@ var Sandbox = class extends SandboxApi {
4721
4721
  resolveApiOpts(opts) {
4722
4722
  return __spreadValues(__spreadValues({}, this.connectionConfig), opts != null ? opts : {});
4723
4723
  }
4724
- fileUrl(path3, username) {
4724
+ fileUrl(path2, username) {
4725
4725
  const url = new URL("/files", this.envdApiUrl);
4726
4726
  if (username) {
4727
4727
  url.searchParams.set("username", username);
4728
4728
  }
4729
- if (path3) {
4730
- url.searchParams.set("path", path3);
4729
+ if (path2) {
4730
+ url.searchParams.set("path", path2);
4731
4731
  }
4732
4732
  return url.toString();
4733
4733
  }
@@ -4908,8 +4908,8 @@ function readDockerignore(contextPath) {
4908
4908
  const content = fs.readFileSync(dockerignorePath, "utf-8");
4909
4909
  return content.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
4910
4910
  }
4911
- function normalizePath(path3) {
4912
- return path3.replace(/\\/g, "/");
4911
+ function normalizePath(path2) {
4912
+ return path2.replace(/\\/g, "/");
4913
4913
  }
4914
4914
  async function getAllFilesInPath(src, contextPath, ignorePatterns, includeDirectories = true) {
4915
4915
  const { glob } = await dynamicImport("glob");
@@ -5021,8 +5021,8 @@ function getCallerDirectory(depth) {
5021
5021
  return void 0;
5022
5022
  }
5023
5023
  if (fileName.startsWith("file:")) {
5024
- const { fileURLToPath: fileURLToPath2 } = dynamicRequire("node:url");
5025
- fileName = fileURLToPath2(fileName);
5024
+ const { fileURLToPath } = dynamicRequire("node:url");
5025
+ fileName = fileURLToPath(fileName);
5026
5026
  }
5027
5027
  return path.dirname(fileName);
5028
5028
  }
@@ -6477,8 +6477,8 @@ var TemplateBase = class _TemplateBase {
6477
6477
  });
6478
6478
  return this;
6479
6479
  }
6480
- remove(path3, options) {
6481
- const paths2 = Array.isArray(path3) ? path3 : [path3];
6480
+ remove(path2, options) {
6481
+ const paths2 = Array.isArray(path2) ? path2 : [path2];
6482
6482
  const args = ["rm"];
6483
6483
  if (options == null ? void 0 : options.recursive) {
6484
6484
  args.push("-r");
@@ -6500,8 +6500,8 @@ var TemplateBase = class _TemplateBase {
6500
6500
  () => this.runCmd(args.join(" "), { user: options == null ? void 0 : options.user })
6501
6501
  );
6502
6502
  }
6503
- makeDir(path3, options) {
6504
- const paths2 = Array.isArray(path3) ? path3 : [path3];
6503
+ makeDir(path2, options) {
6504
+ const paths2 = Array.isArray(path2) ? path2 : [path2];
6505
6505
  const args = ["mkdir", "-p"];
6506
6506
  if (options == null ? void 0 : options.mode) {
6507
6507
  args.push(`-m ${padOctal(options.mode)}`);
@@ -6636,7 +6636,7 @@ var TemplateBase = class _TemplateBase {
6636
6636
  })
6637
6637
  );
6638
6638
  }
6639
- gitClone(url, path3, options) {
6639
+ gitClone(url, path2, options) {
6640
6640
  const args = ["git", "clone", url];
6641
6641
  if (options == null ? void 0 : options.branch) {
6642
6642
  args.push(`--branch ${options.branch}`);
@@ -6645,8 +6645,8 @@ var TemplateBase = class _TemplateBase {
6645
6645
  if (options == null ? void 0 : options.depth) {
6646
6646
  args.push(`--depth ${options.depth}`);
6647
6647
  }
6648
- if (path3) {
6649
- args.push(path3.toString());
6648
+ if (path2) {
6649
+ args.push(path2.toString());
6650
6650
  }
6651
6651
  return this.runInNewStackTraceContext(
6652
6652
  () => this.runCmd(args.join(" "), { user: options == null ? void 0 : options.user })
@@ -7361,8 +7361,6 @@ var Volume = class _Volume {
7361
7361
  };
7362
7362
 
7363
7363
  // src/core/client.ts
7364
- import path2 from "path";
7365
- import { fileURLToPath } from "url";
7366
7364
  function mergeConnectionOpts(base, next) {
7367
7365
  var _a3, _b;
7368
7366
  const baseHeaders = (_a3 = base.headers) != null ? _a3 : {};
@@ -7567,18 +7565,7 @@ var TemplateNamespace = class {
7567
7565
  this.toDockerfile = Template.toDockerfile;
7568
7566
  }
7569
7567
  new(options) {
7570
- var _a3;
7571
- let callerContext = ".";
7572
- for (const site of callsites(2)) {
7573
- const fileName = site.getFileName();
7574
- if (fileName && (!fileName.includes("/src/core/") || fileName.includes("/src/core/tests/")) && !fileName.includes("/node_modules/ppio-sandbox/")) {
7575
- callerContext = path2.dirname(fileName.startsWith("file:") ? fileURLToPath(fileName) : fileName);
7576
- break;
7577
- }
7578
- }
7579
- return Template(__spreadProps(__spreadValues({}, options), {
7580
- fileContextPath: (_a3 = options == null ? void 0 : options.fileContextPath) != null ? _a3 : callerContext
7581
- }));
7568
+ return Template(options);
7582
7569
  }
7583
7570
  list(opts) {
7584
7571
  return Template.list(mergeConnectionOpts(this.opts, opts));
@@ -7707,12 +7694,12 @@ var PPIO = class {
7707
7694
  this.secret = new SecretNamespace(opts);
7708
7695
  this.codeInterpreter = new RuntimeSandboxNamespace(
7709
7696
  opts,
7710
- () => import("./sandbox-SMDAOO7A.mjs")
7697
+ () => import("./sandbox-VBQLLX3L.mjs")
7711
7698
  );
7712
7699
  this.code_interpreter = this.codeInterpreter;
7713
7700
  this.desktop = new RuntimeSandboxNamespace(
7714
7701
  opts,
7715
- () => import("./sandbox-TZ5BE2RX.mjs")
7702
+ () => import("./sandbox-5PUSVOHB.mjs")
7716
7703
  );
7717
7704
  }
7718
7705
  async create(templateOrOpts, opts) {
@@ -7790,4 +7777,4 @@ export {
7790
7777
  ALL_TRAFFIC,
7791
7778
  core_default
7792
7779
  };
7793
- //# sourceMappingURL=chunk-ALX77S7W.mjs.map
7780
+ //# sourceMappingURL=chunk-M7G3KDGF.mjs.map