pi-landstrip 0.20.21 → 0.20.22

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.
Files changed (2) hide show
  1. package/dist/index.ts +17 -33
  2. package/package.json +6 -2
package/dist/index.ts CHANGED
@@ -12,9 +12,10 @@ import {
12
12
  } from "node:fs";
13
13
  import { createServer, Socket as NetSocket } from "node:net";
14
14
  import { tmpdir as tmpdir2 } from "node:os";
15
- import { dirname as dirname5, isAbsolute as isAbsolute4, join as join8, parse, resolve as resolve4 } from "node:path";
15
+ import { dirname as dirname5, isAbsolute as isAbsolute4, join as join8, parse as parse2, resolve as resolve4 } from "node:path";
16
16
  import { StringDecoder as StringDecoder3 } from "node:string_decoder";
17
17
  import { fileURLToPath as fileURLToPath2 } from "node:url";
18
+ import { quote as quoteShell } from "shell-quote";
18
19
  import {
19
20
  createBashToolDefinition,
20
21
  createLocalBashOperations,
@@ -247,6 +248,7 @@ import {
247
248
  import { homedir as homedir3, tmpdir } from "node:os";
248
249
  import { basename as basename2, dirname as dirname4, isAbsolute as isAbsolute3, join as join7, relative as relative3, resolve as resolve3, sep as sep4 } from "node:path";
249
250
  import { fileURLToPath } from "node:url";
251
+ import { gte, parse, valid } from "semver";
250
252
  import {
251
253
  getAgentDir as getAgentDir4,
252
254
  keyHint,
@@ -437,22 +439,10 @@ class AsyncQueue {
437
439
  }
438
440
  function combineAbortSignals(...sources) {
439
441
  const signals = sources.filter((source) => source !== undefined);
440
- const only = signals[0];
441
- if (signals.length === 1 && only)
442
- return { signal: only, dispose: () => {
443
- return;
444
- } };
445
- const controller = new AbortController;
446
- const abort = () => controller.abort();
447
- for (const signal of signals)
448
- signal.addEventListener("abort", abort, { once: true });
449
- if (signals.some((signal) => signal.aborted))
450
- controller.abort();
451
442
  return {
452
- signal: controller.signal,
443
+ signal: signals.length === 1 ? signals[0] : AbortSignal.any(signals),
453
444
  dispose: () => {
454
- for (const signal of signals)
455
- signal.removeEventListener("abort", abort);
445
+ return;
456
446
  }
457
447
  };
458
448
  }
@@ -2544,22 +2534,15 @@ var AGENTS_HELP_ROWS = [
2544
2534
  ["Backspace", "Open parent task"]
2545
2535
  ];
2546
2536
  var INHERIT = "inherit";
2547
- var MIN_SUPPORTED_PI_VERSION = [0, 82, 0];
2537
+ var MIN_SUPPORTED_PI_VERSION = "0.82.0";
2548
2538
  var cachedPiPackage;
2549
2539
  var piPackageResolved = false;
2550
2540
  function isSupportedPiVersion(version) {
2551
2541
  if (version.length !== 3 || !version.every((part) => Number.isInteger(part) && part >= 0)) {
2552
2542
  return false;
2553
2543
  }
2554
- for (let i = 0;i < 3; i++) {
2555
- const part = version[i];
2556
- const min = MIN_SUPPORTED_PI_VERSION[i];
2557
- if (part > min)
2558
- return true;
2559
- if (part < min)
2560
- return false;
2561
- }
2562
- return true;
2544
+ const parsed = valid(version.join("."));
2545
+ return parsed !== null && gte(parsed, MIN_SUPPORTED_PI_VERSION);
2563
2546
  }
2564
2547
  function findPiPackage(entry) {
2565
2548
  let dir = dirname4(realpathSync2(entry));
@@ -2600,8 +2583,8 @@ function readPiPackage(pkgPath) {
2600
2583
  if (!isRecord2(value) || value.name !== "@earendil-works/pi-coding-agent" || typeof value.version !== "string") {
2601
2584
  return;
2602
2585
  }
2603
- const parts = value.version.split(".").map(Number);
2604
- if (parts.length < 3 || !parts.slice(0, 3).every((n) => Number.isInteger(n)))
2586
+ const version = parse(value.version);
2587
+ if (!version || version.prerelease.length > 0)
2605
2588
  return;
2606
2589
  const binFile = typeof value.bin === "string" ? value.bin : isRecord2(value.bin) && typeof value.bin.pi === "string" ? value.bin.pi : undefined;
2607
2590
  if (!binFile)
@@ -2609,7 +2592,7 @@ function readPiPackage(pkgPath) {
2609
2592
  const cliEntry = join7(dirname4(pkgPath), binFile);
2610
2593
  if (!existsSync5(cliEntry))
2611
2594
  return;
2612
- cachedPiPackage = { cliEntry, version: parts.slice(0, 3) };
2595
+ cachedPiPackage = { cliEntry, version: [version.major, version.minor, version.patch] };
2613
2596
  return cachedPiPackage;
2614
2597
  } catch {
2615
2598
  return;
@@ -6680,13 +6663,14 @@ function writeEnvFile(env, proxyPort, proxyToken) {
6680
6663
  continue;
6681
6664
  if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key))
6682
6665
  continue;
6683
- const escaped = value.replace(/'/g, "'\\''");
6684
- lines.push(`export ${key}='${escaped}'`);
6666
+ lines.push(`export ${key}=${quoteShell([value])}`);
6685
6667
  }
6686
6668
  if (proxyPort !== null) {
6687
6669
  const proxyVars = createProxyEnvironment(proxyPort, { token: proxyToken });
6688
6670
  for (const [name, value] of Object.entries(proxyVars)) {
6689
- lines.push(`export ${name}='${value}'`);
6671
+ if (value === undefined)
6672
+ continue;
6673
+ lines.push(`export ${name}=${quoteShell([value])}`);
6690
6674
  }
6691
6675
  }
6692
6676
  const dir = mkdtempSync2(join8(tmpdir2(), "pi-landstrip-env-"));
@@ -6707,7 +6691,7 @@ function createPosixShellProvider() {
6707
6691
  let disposed = false;
6708
6692
  return {
6709
6693
  executable: shell,
6710
- args: [...args, `source '${envFile.path}' && ${options.command}`],
6694
+ args: [...args, `source ${quoteShell([envFile.path])} && ${options.command}`],
6711
6695
  launcherEnv: { PATH: process.env.PATH, HOME: process.env.HOME },
6712
6696
  readPaths: [envFile.path],
6713
6697
  dispose() {
@@ -6909,7 +6893,7 @@ function createLandstripIntegrationWithPrompts(options, permissionPrompts) {
6909
6893
  function getEffectiveDenyRead(config, cwd) {
6910
6894
  if (process.platform !== "win32")
6911
6895
  return config.filesystem.denyRead;
6912
- const volumeRoot = parse(resolve4(cwd)).root;
6896
+ const volumeRoot = parse2(resolve4(cwd)).root;
6913
6897
  return createWindowsDenyRead(config.filesystem.denyRead, volumeRoot);
6914
6898
  }
6915
6899
  function hasBaselineWindowsApplicationAccess(filePath) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-landstrip",
3
- "version": "0.20.21",
3
+ "version": "0.20.22",
4
4
  "description": "Sandboxed Bash and process-backed agents for Pi",
5
5
  "keywords": [
6
6
  "landstrip",
@@ -39,9 +39,11 @@
39
39
  "ci:test": "npm run test"
40
40
  },
41
41
  "dependencies": {
42
- "@landstrip/landstrip-api": "^0.20.21",
42
+ "@landstrip/landstrip-api": "^0.20.22",
43
43
  "jsonc-parser": "^3.3.1",
44
44
  "minimatch": "^10.2.5",
45
+ "semver": "^7.8.6",
46
+ "shell-quote": "^1.12.0",
45
47
  "undici": "^8.9.0",
46
48
  "yaml": "^2.9.0"
47
49
  },
@@ -50,6 +52,8 @@
50
52
  "@earendil-works/pi-coding-agent": "^1.0.4",
51
53
  "@earendil-works/pi-tui": "^1.0.4",
52
54
  "@types/node": "^26.4.1",
55
+ "@types/semver": "^7.8.0",
56
+ "@types/shell-quote": "^1.7.5",
53
57
  "oxfmt": "^0.75.0",
54
58
  "oxlint": "^1.68.0",
55
59
  "typebox": "^1.3.6",