@henryqw/pi-subagent 4.1.0 → 4.1.2
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/dist/index.d.ts +1 -1
- package/dist/index.js +3 -2
- package/docs/orchestration.md +3 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { type AvailableModel, type ProfileName, type ResolvedTaskRoute, type Thi
|
|
|
4
4
|
export { addUsage, capEphemeralSubagentOutput, createEphemeralSubagentExecutor, EphemeralSubagentError, formatDuration, type EphemeralSubagentErrorCode, type EphemeralSubagentExecutor, type EphemeralSubagentExecutorOptions, type EphemeralSubagentResult, type EphemeralSubagentRunInput, type EphemeralSubagentTimeout, } from "./ephemeral.ts";
|
|
5
5
|
export { createChildWorktree, finalizeChildWorktree, worktreeContextNote, type WorktreeInfo, type WorktreePayload, } from "./worktree.ts";
|
|
6
6
|
export declare const ROLE_TOOL_POLICY_FLAG = "pi-subagent-role-tools";
|
|
7
|
-
export declare const CHILD_EXCLUDED_TOOLS = "delegate_task,ask_question
|
|
7
|
+
export declare const CHILD_EXCLUDED_TOOLS = "delegate_task,ask_question";
|
|
8
8
|
export interface Role {
|
|
9
9
|
name: string;
|
|
10
10
|
description: string;
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,8 @@ const CODEX_ALIAS = /^openai-codex-(?:[2-9]|[1-9]\d+)$/;
|
|
|
11
11
|
const MULTI_CODEX_EXTENSION = fileURLToPath(import.meta.resolve("@henryqw/pi-multi-codex/extensions/multi-codex.ts"));
|
|
12
12
|
const ROLE_TOOLS_EXTENSION = fileURLToPath(new URL("../extensions/role-tools.ts", import.meta.url));
|
|
13
13
|
export const ROLE_TOOL_POLICY_FLAG = "pi-subagent-role-tools";
|
|
14
|
-
export const CHILD_EXCLUDED_TOOLS = "delegate_task,ask_question
|
|
14
|
+
export const CHILD_EXCLUDED_TOOLS = "delegate_task,ask_question";
|
|
15
|
+
const CHILD_IDENTITY_POLICY = "You are a delegated Pi Subagent, not Main. Execute the assigned Role and task directly. Main-only delegation rules do not apply. Recursive delegation is unavailable; do not seek or invoke delegation tools.";
|
|
15
16
|
const cleanText = (value, field, source) => {
|
|
16
17
|
if (typeof value !== "string" || !value.trim() || value.includes("\0")) {
|
|
17
18
|
throw new Error(`${source}: ${field} must be non-empty text.`);
|
|
@@ -184,7 +185,7 @@ export function createRoleLaunch(pi, ctx, input) {
|
|
|
184
185
|
if (input.route.thinkingLevel)
|
|
185
186
|
args.push("--thinking", input.route.thinkingLevel);
|
|
186
187
|
args.push(ctx.isProjectTrusted() ? "--approve" : "--no-approve");
|
|
187
|
-
args.push("--append-system-prompt", cleanText(role.systemPrompt, "system prompt", `Role ${role.name}`));
|
|
188
|
+
args.push("--append-system-prompt", `${CHILD_IDENTITY_POLICY}\n\n${cleanText(role.systemPrompt, "system prompt", `Role ${role.name}`)}`);
|
|
188
189
|
return {
|
|
189
190
|
env,
|
|
190
191
|
args,
|
package/docs/orchestration.md
CHANGED
|
@@ -96,6 +96,8 @@ If steps must share files, make that an explicit caller decision: use an intenti
|
|
|
96
96
|
|
|
97
97
|
## Resource Policy
|
|
98
98
|
|
|
99
|
+
Every Role launch centrally prepends this child identity contract to its system instructions before the Role prompt: the child is a delegated Pi Subagent, not Main; it executes its assigned Role and task directly; Main-only delegation rules do not apply; recursive delegation is unavailable and it must not seek or invoke delegation tools.
|
|
100
|
+
|
|
99
101
|
A Role file owns:
|
|
100
102
|
|
|
101
103
|
- base tools (`tools` omitted does not itself define an allowlist; `tools: []` means extension tools only);
|
|
@@ -106,7 +108,7 @@ A Role file owns:
|
|
|
106
108
|
|
|
107
109
|
At launch, a package caller may add `tools`, `extensions`, and `env`. With an explicit Role tool list, caller tools are unioned into that base list. When Role tools and caller tools are both omitted, no allowlist is installed and Pi defaults remain active. When Role tools are omitted but caller tools are supplied, launch snapshots Main's effective active built-ins, unions the caller tools, and installs that policy. Loaded extension tools activate in every case. Caller `env` adds to or overrides the active Pi process environment for the child.
|
|
108
110
|
|
|
109
|
-
Children start with ambient extension and Skill discovery disabled. Only explicit Role/caller extensions, explicitly resolved Skill paths, resources supplied by those extension packages, and any required internal tool-policy or Codex adapter load. Loaded extension tools activate even when the Role base list is empty. Child-inappropriate parent tools are always excluded: `delegate_task
|
|
111
|
+
Children start with ambient extension and Skill discovery disabled. Only explicit Role/caller extensions, explicitly resolved Skill paths, resources supplied by those extension packages, and any required internal tool-policy or Codex adapter load. Loaded extension tools activate even when the Role base list is empty. Child-inappropriate parent tools are always excluded: `delegate_task` and `ask_question`.
|
|
110
112
|
|
|
111
113
|
Role Skill names resolve through Main's effective Pi Skill registry at launch. Missing names are returned in `ResolvedRoleLaunch.missingSkills`; `delegate_task` warns and skips them. Library callers must surface that warning themselves. Missing Skills do not block launch.
|
|
112
114
|
|