@oldflag2333333/pi-subagent 0.1.5 → 0.1.6
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 +1 -1
- package/README.zh-CN.md +1 -1
- package/docs/messaging.md +9 -0
- package/package.json +1 -1
- package/src/profiles/system-prompt.ts +3 -1
- package/src/tools/main.ts +2 -1
- package/src/tools/sub.ts +8 -4
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ Ask the reviewer profile to review src/auth for bugs and missing tests.
|
|
|
77
77
|
| Finish with a specialist | Ask Pi to close the Sub, or close its Herdr tab |
|
|
78
78
|
| Remove Sub sessions and communication files left by deleted Mains | `/clean-sub` |
|
|
79
79
|
|
|
80
|
-
Within the same Main session, repeated `/sub:reviewer` commands reuse that profile's open Sub. If it is busy, your next task is queued. Finishing a task does not automatically close the tab.
|
|
80
|
+
Within the same Main session, repeated `/sub:reviewer` commands reuse that profile's open Sub. If it is busy, your next task is queued. Finishing a task does not automatically close the tab. Subs can report progress through `talk` without stopping; `endTurn: true` explicitly ends their current turn when finished or waiting for Main.
|
|
81
81
|
|
|
82
82
|
The **Sub-agents** list shows only assistants created by the current Main: all **Open** Subs (including idle or unknown status) and **Resumable** persistent sessions confirmed closed with saved files still available. Other Main sessions and forks do not inherit them or gain access to resume them. Reloading or resuming the same Main preserves ownership.
|
|
83
83
|
|
package/README.zh-CN.md
CHANGED
|
@@ -77,7 +77,7 @@ mkdir -p ~/.pi/agent/subagent/profiles/reviewer
|
|
|
77
77
|
| 结束使用 | 让 Pi 关闭子助手,或手动关闭其 Herdr 标签页 |
|
|
78
78
|
| 清理已删除 Main 遗留的 Sub 会话和通信文件 | `/clean-sub` |
|
|
79
79
|
|
|
80
|
-
在同一个主会话(Main)中,多次调用 `/sub:reviewer` 会复用该角色已打开的子助手(Sub)。如果它正在工作,新任务会排队。任务完成后,标签页不会自动关闭。
|
|
80
|
+
在同一个主会话(Main)中,多次调用 `/sub:reviewer` 会复用该角色已打开的子助手(Sub)。如果它正在工作,新任务会排队。任务完成后,标签页不会自动关闭。Sub 通过 `talk` 汇报进度后默认继续工作;只有完成任务或需要等待 Main 回复时,才用 `endTurn: true` 显式结束本轮。
|
|
81
81
|
|
|
82
82
|
**Sub-agents(子助手)** 列表只显示当前 Main 创建的助手:**Open** 包含所有已打开的子助手,包括空闲或状态未知的;**Resumable** 包含已确认关闭、且保存文件仍存在的持久化会话。其他 Main 或分叉会话不会继承这些助手,也不能恢复它们。重载或恢复同一个 Main 则会保留关联。
|
|
83
83
|
|
package/docs/messaging.md
CHANGED
|
@@ -7,6 +7,15 @@ Pi Subagent requires **Pi 1.2.0 or newer**. Main ↔ Sub messages use `pi.sendMe
|
|
|
7
7
|
|
|
8
8
|
There are no synthetic user-role wake messages, version fallbacks, or patches to Pi internals. Custom messages do not pass through user-input processing or execute peer text as slash commands or templates.
|
|
9
9
|
|
|
10
|
+
## Sub talk and turn control
|
|
11
|
+
|
|
12
|
+
Sub's `talk` accepts an optional `endTurn` boolean, defaulting to `false`:
|
|
13
|
+
|
|
14
|
+
- Omitted or `false`: send the message and continue working. Use this for progress updates; no acknowledgement or "continue" reply from Main is required.
|
|
15
|
+
- `true`: send the message and end the current turn. Use this for completed work or a blocking question that requires Main's reply. Send a terminating `talk` on its own: Pi only ends the tool batch early when every tool result in it is terminating.
|
|
16
|
+
|
|
17
|
+
Ending a turn does not close the Sub or discard queued follow-ups. Main can still send further work through `talk`. Message text should make clear whether it reports progress, asks a blocking question, or delivers completed work; Main must not treat every message as task completion. Main's own `talk` does not end its turn.
|
|
18
|
+
|
|
10
19
|
## Delivery guarantees
|
|
11
20
|
|
|
12
21
|
- `content` carries the peer message and routing instructions; `details` carries rendering and receipt metadata and is not sent to the model.
|
package/package.json
CHANGED
|
@@ -13,7 +13,9 @@ export function bindPromptSections(pi: ExtensionAPI, keys: readonly string[], ge
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export const SUB_PROTOCOL = `## Pi Subagent Sub protocol
|
|
16
|
-
You are an isolated Sub Pi working with a Main Pi. You have not received the Main's conversation and must not read Pi session files.
|
|
16
|
+
You are an isolated Sub Pi working with a Main Pi. You have not received the Main's conversation and must not read Pi session files.
|
|
17
|
+
Use talk to report progress, ask for information, or deliver completed work. Make clear in the message whether it is a progress update, a blocking question, or completed work. By default, talk only sends the message. After a progress update, continue the assigned task without waiting for Main to acknowledge or say 'continue'.
|
|
18
|
+
Set endTurn=true only when the task is complete or you must wait for Main's reply before proceeding. Call terminating talk on its own, without other tools in the same batch. Ending a turn does not close the session; remain available for follow-ups. The Main alone decides whether to respond, request more work, or close this Sub session. Never close the session yourself.`;
|
|
17
19
|
|
|
18
20
|
export function applySubPromptSections(sections: Record<string, string>, profile: ResolvedProfile): void {
|
|
19
21
|
sections.subagent_sub_protocol = SUB_PROTOCOL;
|
package/src/tools/main.ts
CHANGED
|
@@ -58,7 +58,7 @@ export function registerMainTools(pi: ExtensionAPI, manager: MainRunManager): vo
|
|
|
58
58
|
"Use delegate for work assigned by MAIN.md or a separable task that benefits from an independent context; select an explicitly configured profile and provide a short informative title.",
|
|
59
59
|
"After delegate launches, do not wait or repeatedly poll. Pi Subagent will wake the Main when the Sub uses talk.",
|
|
60
60
|
"For Subs labeled user-invoked specialists, follow up only on the user's task and results. Do not assign unrelated work or substitute them for general consulting profiles. New tasks are initiated by the user through a profile command.",
|
|
61
|
-
"Use talk to respond to an existing Sub, interrupt_sub to stop its current turn without closing it, and close_sub only after its
|
|
61
|
+
"Use talk to respond to an existing Sub, interrupt_sub to stop its current turn without closing it, and close_sub only after its completed work is accepted or the user asks to close it.",
|
|
62
62
|
],
|
|
63
63
|
parameters: Type.Object({
|
|
64
64
|
title: Type.String({ description: "Short Herdr tab title, up to 48 displayed characters." }),
|
|
@@ -131,6 +131,7 @@ export function registerMainTools(pi: ExtensionAPI, manager: MainRunManager): vo
|
|
|
131
131
|
label: "talk",
|
|
132
132
|
description: "Send one message to an existing Sub Pi. Messages enter the Sub's native follow-up queue and are processed after its current work. Format non-trivial messages as readable Markdown with paragraph breaks and lists.",
|
|
133
133
|
promptSnippet: "Send a message to an existing Sub Pi",
|
|
134
|
+
promptGuidelines: ["Sub talk messages may be progress updates while the Sub keeps working. Do not send routine 'continue' replies or close a Sub merely for reporting progress; respond with talk when input is needed, and use close_sub only after completed work is accepted or the user asks to close it."],
|
|
134
135
|
executionMode: "sequential",
|
|
135
136
|
parameters: Type.Object({
|
|
136
137
|
runId: Type.String({ description: "Full Sub run ID or a unique prefix." }),
|
package/src/tools/sub.ts
CHANGED
|
@@ -183,12 +183,16 @@ export function registerSub(pi: ExtensionAPI): void {
|
|
|
183
183
|
name: "talk",
|
|
184
184
|
label: "talk",
|
|
185
185
|
exposure: "model-only",
|
|
186
|
-
description: "Send one message to the Main Pi
|
|
187
|
-
promptSnippet: "Send a message to the Main Pi",
|
|
188
|
-
promptGuidelines: [
|
|
186
|
+
description: "Send one message to the Main Pi. Continue working by default; set endTurn=true only when the task is complete or you must wait for Main's reply. Format non-trivial messages as readable Markdown with paragraph breaks and lists.",
|
|
187
|
+
promptSnippet: "Send a message to the Main Pi, optionally ending the current turn",
|
|
188
|
+
promptGuidelines: [
|
|
189
|
+
"Use talk for progress updates, questions, and completed work. After progress updates, continue the task without waiting for an acknowledgement.",
|
|
190
|
+
"Set talk endTurn=true only when the task is complete or you must wait for Main's reply. Call terminating talk on its own, without other tools in the same batch. The Main decides when to close the Sub session.",
|
|
191
|
+
],
|
|
189
192
|
executionMode: "sequential",
|
|
190
193
|
parameters: Type.Object({
|
|
191
194
|
message: Type.String({ description: "Message to the other Agent. For non-trivial content, use readable Markdown with paragraph breaks and lists." }),
|
|
195
|
+
endTurn: Type.Optional(Type.Boolean({ description: "End the current turn after sending. Defaults to false: continue working. Set true only when the task is complete or you must wait for Main's reply." })),
|
|
192
196
|
}),
|
|
193
197
|
renderCall(args, theme, context) {
|
|
194
198
|
const message = typeof args.message === "string" ? args.message : "";
|
|
@@ -205,7 +209,7 @@ export function registerSub(pi: ExtensionAPI): void {
|
|
|
205
209
|
return {
|
|
206
210
|
content: [{ type: "text", text: "Message queued for the Main Pi." }],
|
|
207
211
|
details: { messageId: message.id },
|
|
208
|
-
terminate: true,
|
|
212
|
+
terminate: params.endTurn === true,
|
|
209
213
|
};
|
|
210
214
|
},
|
|
211
215
|
renderResult(result, _options, theme, context) {
|