@trim21/personal-pi-extensions 0.1.591 → 0.1.592
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/README.md +4 -4
- package/package.json +1 -1
- package/src/bwrap/core.ts +2 -2
- package/src/bwrap/runtime.ts +3 -3
- package/src/spawn-agent-agents.ts +2 -2
- package/src/spawn-agent.ts +1 -1
package/README.md
CHANGED
|
@@ -85,8 +85,8 @@ bash 工具(opencode 风格 `bash`、Claude Code 风格 `Bash`)注册了 `da
|
|
|
85
85
|
|
|
86
86
|
配置文件(项目优先于全局):
|
|
87
87
|
|
|
88
|
-
- `~/.pi/agent/
|
|
89
|
-
- `.pi/
|
|
88
|
+
- `~/.pi/agent/sandbox.json`(全局)
|
|
89
|
+
- `.pi/sandbox.json`(项目)
|
|
90
90
|
|
|
91
91
|
```jsonc
|
|
92
92
|
{
|
|
@@ -389,7 +389,7 @@ tools:
|
|
|
389
389
|
provider: openai # 可选,覆盖全局默认
|
|
390
390
|
model: claude-haiku-4-5 # 可选,覆盖全局默认
|
|
391
391
|
thinkingLevel: high # 可选,off/minimal/low/medium/high/xhigh
|
|
392
|
-
sandbox: # 可选,bash
|
|
392
|
+
sandbox: # 可选,bash 工具的固定沙箱配置(sandbox.json 同构)
|
|
393
393
|
fs:
|
|
394
394
|
mode: readonly
|
|
395
395
|
extraWritablePaths:
|
|
@@ -399,7 +399,7 @@ System prompt for the agent goes here.
|
|
|
399
399
|
```
|
|
400
400
|
|
|
401
401
|
- **默认只读**:frontmatter 不声明 `tools` 时只有 `read`/`grep`/`find`/`ls`,没有 bash/write/edit
|
|
402
|
-
- **`sandbox
|
|
402
|
+
- **`sandbox`**:完整沙箱配置直接作为该子代理 bash 的沙箱(不读用户 sandbox.json),非沙盒请求直接拒绝,`/bwrap-*` 命令不注册;不声明则跟随用户沙箱配置
|
|
403
403
|
- **校验跳过**:frontmatter 校验失败(缺 name/description、字段类型错)的文件直接跳过
|
|
404
404
|
- **全局默认**:`~/.pi/agent/spawn-agent.json`(provider / model / thinkingLevel),frontmatter 优先于它,二者都优先于 settings.json 的默认值
|
|
405
405
|
- **可见子代理列表**通过工具的 promptGuidelines 注入 system prompt;改 `agents/*.md` 或 `spawn-agent.json` 后 `/reload` 生效
|
package/package.json
CHANGED
package/src/bwrap/core.ts
CHANGED
|
@@ -205,8 +205,8 @@ export interface BwrapConfigPaths {
|
|
|
205
205
|
|
|
206
206
|
export function getBwrapConfigPaths(cwd: string): BwrapConfigPaths {
|
|
207
207
|
return {
|
|
208
|
-
global: join(getAgentDir(), "
|
|
209
|
-
project: join(cwd, ".pi", "
|
|
208
|
+
global: join(getAgentDir(), "sandbox.json"),
|
|
209
|
+
project: join(cwd, ".pi", "sandbox.json"),
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
212
|
|
package/src/bwrap/runtime.ts
CHANGED
|
@@ -381,7 +381,7 @@ export class BwrapRuntime {
|
|
|
381
381
|
/**
|
|
382
382
|
* 创建时传入的完整配置:加载配置与创建解耦——有它就不再读盘,且沙箱视为固定
|
|
383
383
|
* (不注册 /bwrap-* 命令、非沙盒请求一律拒绝)。undefined 表示从全局/项目
|
|
384
|
-
*
|
|
384
|
+
* sandbox.json 加载(主会话入口的现状行为)。
|
|
385
385
|
*/
|
|
386
386
|
private readonly config: BwrapConfig | undefined;
|
|
387
387
|
|
|
@@ -816,7 +816,7 @@ export class BwrapRuntime {
|
|
|
816
816
|
}
|
|
817
817
|
}
|
|
818
818
|
|
|
819
|
-
/** 把命令的权限模式写入项目
|
|
819
|
+
/** 把命令的权限模式写入项目 sandbox.json 的 approvalRules(allow forever)。 */
|
|
820
820
|
private async persistAllowRule(
|
|
821
821
|
ctx: ExtensionContext,
|
|
822
822
|
command: string,
|
|
@@ -1052,7 +1052,7 @@ export class BwrapRuntime {
|
|
|
1052
1052
|
* 缺省自建一份不跨入口同步的策略;入口通常显式传入 `createRequestPolicy(pi.events)`。
|
|
1053
1053
|
* config 为完整配置(completeBwrapConfig 的产物):加载配置与创建解耦,传入后不再
|
|
1054
1054
|
* 读盘,且沙箱固定(不注册 /bwrap-* 命令、非沙盒请求直接拒绝)。缺省从全局/项目
|
|
1055
|
-
*
|
|
1055
|
+
* sandbox.json 加载。
|
|
1056
1056
|
*/
|
|
1057
1057
|
export function createBwrapRuntime(
|
|
1058
1058
|
policy: RequestPolicy = createRequestPolicy(),
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
* omitted, the subagent runs with the read-only default toolset from the
|
|
30
30
|
* spawn-agent config (read/grep/find/ls) unless overridden there.
|
|
31
31
|
*
|
|
32
|
-
* `sandbox` is a complete bwrap config (same shape as
|
|
32
|
+
* `sandbox` is a complete bwrap config (same shape as sandbox.json) that becomes
|
|
33
33
|
* the bash tool's fixed sandbox: it is parsed here and passed to the subagent's
|
|
34
34
|
* bwrap runtime directly (config loading is decoupled from sandbox creation),
|
|
35
|
-
* so the user's
|
|
35
|
+
* so the user's sandbox.json is not consulted for that agent. Unsandboxed
|
|
36
36
|
* execution requests are refused and /bwrap-* mode commands are not registered.
|
|
37
37
|
* Fields are optional and fall back to the standard bwrap defaults (e.g.
|
|
38
38
|
* `sandbox: { fs: { mode: readonly } }` alone is enough for a read-only shell);
|
package/src/spawn-agent.ts
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* Security default: without an explicit `tools:` in the frontmatter, the
|
|
31
31
|
* subagent only gets read-only tools (read/grep/find/ls) — no bash/write/edit.
|
|
32
32
|
* A frontmatter `sandbox:` gives the bash tool a fixed bwrap sandbox config
|
|
33
|
-
* (
|
|
33
|
+
* (sandbox.json shape, e.g. fs.mode readonly): it is passed to the subagent's
|
|
34
34
|
* bwrap runtime as the complete config, unsandboxed execution requests are
|
|
35
35
|
* refused, and /bwrap-* commands are not registered (see spawn-agent-agents.ts).
|
|
36
36
|
*/
|