@xzzpig/pi-subagents 0.15.1 → 0.16.0
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/CHANGELOG.md +14 -0
- package/docs/agents.md +2 -2
- package/docs/fork-extensions.md +23 -15
- package/package.json +1 -1
- package/src/runs/shared/profile-launch-env.ts +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.16.0] - 2026-09-22
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **A child in a subdirectory of a trusted project inherits the sandbox trust
|
|
8
|
+
stamp** (OpenSpec change `add-project-scoped-profiles`). The launcher's
|
|
9
|
+
`PI_SUBAGENT_SANDBOX_PROJECT_TRUSTED` emission (`hasTrustedProfileProjectCwd`)
|
|
10
|
+
now treats a child cwd equal to or a descendant of the parent session's
|
|
11
|
+
trusted project cwd as trusted, matching the platform's
|
|
12
|
+
`findNearestTrustEntry` ancestor semantics, so a project's sandbox-profile
|
|
13
|
+
definitions apply from any subdirectory of a trusted project root instead of
|
|
14
|
+
only from the exact root cwd. The selection-side `projectScopedProfileTrustError`
|
|
15
|
+
guard keeps its exact-cwd matching unchanged.
|
|
16
|
+
|
|
3
17
|
## [0.15.1] - 2026-09-19
|
|
4
18
|
|
|
5
19
|
### Changed
|
package/docs/agents.md
CHANGED
|
@@ -345,8 +345,8 @@ Field notes:
|
|
|
345
345
|
| `allowNestedSubagents` | Set `true` to authorize the child-safe nested `subagent` runtime without making omitted `tools` an allowlist. Inherited depth and capability ceilings remain authoritative. |
|
|
346
346
|
| `extensions` | Omitted means a background child loads the parent's ambient extensions; empty means no ambient extensions; list values load exactly those extensions. Foreground children never load ambient extensions, so for them only listed values apply. |
|
|
347
347
|
| `subagentOnlyExtensions` | Extension paths loaded only in this agent's child sessions. Tools registered there are unavailable to the main agent unless also installed through normal Pi extension configuration. |
|
|
348
|
-
| `sandbox` | Optional named `pi-sandbox` profile for a native Pi child. It must be a non-empty safe name defined in the
|
|
349
|
-
| `permission-profile` | Optional named permission profile for a native Pi child. The name must be a non-empty safe identifier defined in the global `pi-permission-system` config's `profiles` registry; only the validated name is passed to the child. See [Permission profiles](fork-extensions.md#permission-profiles). |
|
|
348
|
+
| `sandbox` | Optional named `pi-sandbox` profile for a native Pi child. It must be a non-empty safe name defined in the global `<agentDir>/sandbox.json` or, when the project is trusted, in `<cwd>/.pi/sandbox.json`; it is a selector only, never an inline network or filesystem policy. |
|
|
349
|
+
| `permission-profile` | Optional named permission profile for a native Pi child. The name must be a non-empty safe identifier defined in the global `pi-permission-system` config's `profiles` registry or, when the project is trusted, in the project config's registry; only the validated name is passed to the child. See [Permission profiles](fork-extensions.md#permission-profiles). |
|
|
350
350
|
| `model` | Default model. Bare ids prefer the current provider when possible, then unique registry matches. |
|
|
351
351
|
| `thinking` | Appended as a `:level` suffix at runtime unless a suffix is already present. |
|
|
352
352
|
| `systemPromptMode` | `replace` by default; `append` keeps Pi's base prompt. |
|
package/docs/fork-extensions.md
CHANGED
|
@@ -8,8 +8,8 @@ files stay byte-identical to upstream.
|
|
|
8
8
|
## Sandbox profiles
|
|
9
9
|
|
|
10
10
|
Use `sandbox: <profile-name>` only for a native Pi child. The profile is resolved
|
|
11
|
-
from the global `pi-sandbox` configuration,
|
|
12
|
-
|
|
11
|
+
from the global `pi-sandbox` configuration and, when the project is trusted,
|
|
12
|
+
from the project `.pi/sandbox.json` registry — never from an agent file:
|
|
13
13
|
|
|
14
14
|
```yaml
|
|
15
15
|
---
|
|
@@ -37,24 +37,28 @@ failure and never excludes the model from later runs.
|
|
|
37
37
|
The field is rejected for `external-cli` and `external-job` runners because they
|
|
38
38
|
do not host a Pi child extension. It also cannot be an object, `false`, an empty
|
|
39
39
|
value, or an inline allow/deny policy. Define the actual network and filesystem
|
|
40
|
-
rules in
|
|
40
|
+
rules in `pi-sandbox` `profiles` (global, or trusted project) instead.
|
|
41
41
|
|
|
42
42
|
A profile chosen by a project-scoped agent or project override is used only when
|
|
43
43
|
the host marks that project trusted. Otherwise the launch reports an actionable
|
|
44
|
-
trust error.
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
trust error. A project's own profile definitions likewise participate only for a
|
|
45
|
+
trusted project; an untrusted project's `profiles` registry is ignored with a
|
|
46
|
+
warning and never fails the launch. In a headless child, accesses outside the
|
|
47
|
+
profile's preconfigured network/read/write rules are blocked; pi-sandbox does not
|
|
48
|
+
use Permission System or supervisor forwarding to ask the parent for an approval.
|
|
49
|
+
See
|
|
47
50
|
[`pi-sandbox`'s README](https://github.com/xzzpig/pi-extensions/tree/main/packages/pi-sandbox#named-profiles-for-subagents)
|
|
48
51
|
for profile inheritance and merge rules.
|
|
49
52
|
|
|
50
53
|
## Permission profiles
|
|
51
54
|
|
|
52
55
|
Use `permission-profile: <name>` to select a named policy profile from the
|
|
53
|
-
|
|
54
|
-
(`<agentDir>/extensions/pi-permission-system/config.json`)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
`profiles` registry in `pi-permission-system`'s config — the global file
|
|
57
|
+
(`<agentDir>/extensions/pi-permission-system/config.json`) and, when the project
|
|
58
|
+
is trusted, the project file (`<cwd>/.pi/extensions/pi-permission-system/config.json`).
|
|
59
|
+
It is a selector only — the actual rules (tool scalars, `bash`/`mcp`/`skill`/`external_directory`
|
|
60
|
+
pattern maps, `'*'` fallback) live in those registries and always resolve from the
|
|
61
|
+
child's own configuration:
|
|
58
62
|
|
|
59
63
|
```yaml
|
|
60
64
|
---
|
|
@@ -72,8 +76,8 @@ installed `pi-permission-system` extension into the child launch even when
|
|
|
72
76
|
`extensions` is an explicit allowlist, so the child's permission system applies
|
|
73
77
|
the selected profile. The env channel carries a bare validated name — raw
|
|
74
78
|
policy is never transmitted — and the rules are always read from the child's
|
|
75
|
-
own
|
|
76
|
-
|
|
79
|
+
own config, so the profile means the same policy regardless of which host
|
|
80
|
+
launches the agent. Selection precedence inside the permission system is
|
|
77
81
|
env > project agent file > global agent file.
|
|
78
82
|
|
|
79
83
|
The launch fails closed when a profile is declared but `pi-permission-system`
|
|
@@ -88,8 +92,12 @@ its pre-change behavior exactly.
|
|
|
88
92
|
The profile merges between the project config and the agent's own `permission:`
|
|
89
93
|
block: patterns the profile does not mention keep the lower scopes' rules
|
|
90
94
|
(global denies survive), and `permission:` overrides the profile per pattern.
|
|
91
|
-
A
|
|
92
|
-
|
|
95
|
+
A same-named global and trusted-project profile merge per pattern (origins
|
|
96
|
+
`profile-global` / `profile-project`), so a global denial the project profile
|
|
97
|
+
does not mention survives. A profile selected by a **project** agent file
|
|
98
|
+
participates only when the host marks that project trusted; a project's
|
|
99
|
+
profile definitions are likewise applied only for a trusted project, and an
|
|
100
|
+
untrusted project's registry is ignored with a warning.
|
|
93
101
|
|
|
94
102
|
## Context injection
|
|
95
103
|
|
package/package.json
CHANGED
|
@@ -30,7 +30,8 @@ export interface ProfileLaunchEnvInput {
|
|
|
30
30
|
permissionProfile?: string;
|
|
31
31
|
/** Parent-authoritative trust state for profile-aware project config merging. */
|
|
32
32
|
projectTrusted?: boolean;
|
|
33
|
-
/**
|
|
33
|
+
/** Trusted project cwd; profile project config applies when the child cwd is within it
|
|
34
|
+
* (equal or a subdirectory), mirroring the platform's ancestor-inheriting trust decisions. */
|
|
34
35
|
trustedProjectCwd?: string;
|
|
35
36
|
host: "parent" | "runner";
|
|
36
37
|
}
|
|
@@ -48,7 +49,14 @@ export interface ProfileLaunchEnv {
|
|
|
48
49
|
|
|
49
50
|
function hasTrustedProfileProjectCwd(input: Pick<ProfileLaunchEnvInput, "cwd" | "projectTrusted" | "trustedProjectCwd">): boolean {
|
|
50
51
|
if (input.projectTrusted !== true || !input.cwd || !input.trustedProjectCwd) return false;
|
|
51
|
-
|
|
52
|
+
// Platform trust is ancestor-inheriting (findNearestTrustEntry walks up from
|
|
53
|
+
// the child cwd): a child launched anywhere inside the trusted project tree —
|
|
54
|
+
// the project root or any subdirectory — inherits the trust decision observed
|
|
55
|
+
// at the trusted project cwd, so its project config participates without a
|
|
56
|
+
// separate trust decision (spec: 子目录启动继承信任).
|
|
57
|
+
const trusted = path.resolve(input.trustedProjectCwd);
|
|
58
|
+
const child = path.resolve(input.cwd);
|
|
59
|
+
return child === trusted || child.startsWith(`${trusted}${path.sep}`);
|
|
52
60
|
}
|
|
53
61
|
|
|
54
62
|
export function buildProfileLaunchEnv(input: ProfileLaunchEnvInput, toolPlan: Pick<PiLaunchToolPlan, "sandboxExtension">): ProfileLaunchEnv {
|