pi-landstrip 0.18.39 → 0.18.40

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 +26 -18
  2. package/package.json +2 -2
package/dist/index.ts CHANGED
@@ -2084,25 +2084,37 @@ function isSupportedPiVersion(version) {
2084
2084
  }
2085
2085
  return true;
2086
2086
  }
2087
+ function findPiPackage(entry) {
2088
+ let dir = dirname3(realpathSync(entry));
2089
+ for (;; ) {
2090
+ const pkgPath = join6(dir, "package.json");
2091
+ if (existsSync4(pkgPath)) {
2092
+ const pkg = readPiPackage(pkgPath);
2093
+ if (pkg)
2094
+ return pkg;
2095
+ }
2096
+ const parent = dirname3(dir);
2097
+ if (parent === dir)
2098
+ return;
2099
+ dir = parent;
2100
+ }
2101
+ }
2087
2102
  function resolvePiPackage() {
2088
2103
  if (piPackageResolved)
2089
2104
  return cachedPiPackage;
2090
2105
  piPackageResolved = true;
2106
+ const argvEntry = process.argv[1];
2107
+ if (argvEntry) {
2108
+ try {
2109
+ const pkg = findPiPackage(argvEntry);
2110
+ if (pkg)
2111
+ return pkg;
2112
+ } catch {}
2113
+ }
2091
2114
  try {
2092
- const entry = fileURLToPath(import.meta.resolve("@earendil-works/pi-coding-agent"));
2093
- let dir2 = dirname3(entry);
2094
- for (;; ) {
2095
- const pkgPath = join6(dir2, "package.json");
2096
- if (existsSync4(pkgPath)) {
2097
- const pkg = readPiPackage(pkgPath);
2098
- if (pkg)
2099
- return pkg;
2100
- }
2101
- const parent = dirname3(dir2);
2102
- if (parent === dir2)
2103
- break;
2104
- dir2 = parent;
2105
- }
2115
+ const pkg = findPiPackage(fileURLToPath(import.meta.resolve("@earendil-works/pi-coding-agent")));
2116
+ if (pkg)
2117
+ return pkg;
2106
2118
  } catch {}
2107
2119
  let dir = packageDir;
2108
2120
  for (;; ) {
@@ -4563,10 +4575,6 @@ ${catalog.diagnostics.join(`
4563
4575
  return { ...context, agent: this.primaryAgent?.name };
4564
4576
  }
4565
4577
  piInvocation() {
4566
- const argvEntry = process.argv[1];
4567
- if (argvEntry && /(?:^|[/\\])cli\.(?:js|mjs|cjs|ts)$/.test(argvEntry)) {
4568
- return { command: process.execPath, args: [argvEntry] };
4569
- }
4570
4578
  const pkg = resolvePiPackage();
4571
4579
  if (!pkg) {
4572
4580
  throw new Error("Unable to determine the running Pi CLI entry; process-backed subagents are unavailable");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-landstrip",
3
- "version": "0.18.39",
3
+ "version": "0.18.40",
4
4
  "description": "Sandboxed Bash and process-backed agents for Pi",
5
5
  "keywords": [
6
6
  "landstrip",
@@ -39,7 +39,7 @@
39
39
  "ci:test": "npm run test"
40
40
  },
41
41
  "dependencies": {
42
- "@landstrip/landstrip-api": "^0.18.39",
42
+ "@landstrip/landstrip-api": "^0.18.40",
43
43
  "jsonc-parser": "^3.3.1",
44
44
  "minimatch": "^10.2.5",
45
45
  "yaml": "^2.9.0"