@trim21/personal-pi-extensions 0.0.372 → 0.0.374

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.0.372",
3
+ "version": "0.0.374",
4
4
  "type": "module",
5
5
  "description": "Custom pi coding-agent extensions: bwrap sandbox, workspace guard, opencode edit, and more",
6
6
  "keywords": [
package/src/bwrap/core.ts CHANGED
@@ -5,7 +5,7 @@ import { delimiter, join } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
6
 
7
7
  import { StringEnum } from "@earendil-works/pi-ai";
8
- import { type BashOperations, getAgentDir } from "@earendil-works/pi-coding-agent";
8
+ import { type BashOperations, getAgentDir, getShellConfig } from "@earendil-works/pi-coding-agent";
9
9
  import { type Static, Type } from "typebox";
10
10
  import { Value } from "typebox/value";
11
11
 
@@ -245,6 +245,8 @@ export function createBwrapBashOperations(
245
245
  resolved: ResolvedBwrap,
246
246
  workspace: string,
247
247
  ): BashOperations {
248
+ // 沙箱内不透传 PATH,execvp 的默认路径可能找不到 bash(如 NixOS),故在父进程解析绝对路径
249
+ const shell = getShellConfig().shell;
248
250
  return {
249
251
  async exec(command, cwd, { onData, signal, timeout }) {
250
252
  await fsAccess(cwd, constants.F_OK).catch(() => {
@@ -272,8 +274,8 @@ export function createBwrapBashOperations(
272
274
  const child = spawn(
273
275
  findBwrap(resolved.bwrapPath),
274
276
  seccompFd === undefined
275
- ? [...baseArgs, "--", "bash", "-lc", command]
276
- : [...baseArgs, "--seccomp", "3", "--", "bash", "-lc", command],
277
+ ? [...baseArgs, "--", shell, "-lc", command]
278
+ : [...baseArgs, "--seccomp", "3", "--", shell, "-lc", command],
277
279
  {
278
280
  cwd,
279
281
  detached: true,