@trim21/personal-pi-extensions 0.1.596 → 0.1.597

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trim21/personal-pi-extensions",
3
- "version": "0.1.596",
3
+ "version": "0.1.597",
4
4
  "type": "module",
5
5
  "description": "Custom pi coding-agent extensions: bwrap sandbox, workspace guard, opencode edit, and more",
6
6
  "keywords": [
@@ -13,7 +13,6 @@
13
13
  },
14
14
  "files": [
15
15
  "src",
16
- "vendor",
17
16
  "README.md"
18
17
  ],
19
18
  "publishConfig": {
package/src/bwrap/core.ts CHANGED
@@ -3,7 +3,6 @@ import { constants, type Dirent, existsSync, readFileSync } from "node:fs";
3
3
  import { access as fsAccess, readdir, realpath, stat } from "node:fs/promises";
4
4
  import { delimiter, join } from "node:path";
5
5
  import process from "node:process";
6
- import { fileURLToPath } from "node:url";
7
6
 
8
7
  import { StringEnum } from "@earendil-works/pi-ai";
9
8
  import { type BashOperations, getAgentDir, getShellConfig } from "@earendil-works/pi-coding-agent";
@@ -266,28 +265,16 @@ function findCommandInPath(name: string, hint: string): string {
266
265
  throw new Error(hint);
267
266
  }
268
267
 
269
- // npm 包内自带的静态编译 mihomo(linux-x64),发布时由 CI 下载到 vendor/;
270
- // 源码方式运行(vendor 不存在)时自然跳过,走 PATH 查找。
271
- const VENDORED_MIHOMO_PATH = fileURLToPath(
272
- new URL("../../vendor/mihomo-linux-x64", import.meta.url),
273
- );
274
-
275
- export function findMihomo(override?: string, bundledPath = VENDORED_MIHOMO_PATH): string {
268
+ export function findMihomo(override?: string): string {
276
269
  if (override) {
277
270
  if (!existsSync(override)) {
278
271
  throw new Error(`mihomo not found at configured path: ${override}`);
279
272
  }
280
273
  return override;
281
274
  }
282
- // 优先全局 PATH(用户自装的 mihomo),没有时回退到包内自带二进制
283
- for (const directory of (process.env.PATH ?? "").split(delimiter)) {
284
- const candidate = join(directory, "mihomo");
285
- if (existsSync(candidate)) return candidate;
286
- }
287
- if (existsSync(bundledPath)) return bundledPath;
288
- throw new Error(
289
- "mihomo not found in PATH and the package ships no bundled binary. " +
290
- "Install it from https://github.com/MetaCubeX/mihomo",
275
+ return findCommandInPath(
276
+ "mihomo",
277
+ "mihomo not found in PATH. Install it from https://github.com/MetaCubeX/mihomo",
291
278
  );
292
279
  }
293
280
 
@@ -1,4 +0,0 @@
1
- [diffend] Oversized file quarantined before diffing.
2
- name: package/vendor/mihomo-linux-x64
3
- size: 61825150 bytes
4
- sha256: 08787faafea19c1ab0f83fa5a1b22363b7d03ea78da18091a4c883aecaaa5979