pi-herdr-subagents-lite 0.6.0 → 0.7.1
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 +19 -0
- package/README.md +10 -10
- package/README.zh-CN.md +27 -27
- package/package.json +3 -2
- package/src/profile/examples.ts +8 -12
- package/src/profile/seed.ts +12 -9
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
|
|
3
|
+
本文件记录已发布版本的用户可见变更。更细的过程见 git log。破坏性变更标 **BREAKING**。0.5.2 及更早的变更见旧仓 `setwhite/pi-herdr-subagents-lite` 的 tag `v0.3.0`–`v0.5.2`。
|
|
4
|
+
|
|
5
|
+
## 0.7.1 — 2026-11-03
|
|
6
|
+
|
|
7
|
+
- 发布:`CHANGELOG.md` 进 `files`。此前 tarball 里没有它,pi 更新扩展后看不到变更。本版起补上。首次更新到本版时,"Extension Updates" 下只有这一条。
|
|
8
|
+
|
|
9
|
+
## 0.7.0 — 2026-11-02
|
|
10
|
+
|
|
11
|
+
- **BREAKING**:`profiles/examples/` 每次加载都镜像到包内示例。自带文件重写,多余文件与子目录删除。这个目录是分发物。自己的 profile 放在 `profiles/`,不放 `examples/`。
|
|
12
|
+
- 自带示例改名为 `worker`:`description` 是 `General purpose.`,body 两条——需要设计决策时停下并报告、简洁报告改了什么/还剩什么/卡在哪。
|
|
13
|
+
- 示例把 `skills` 注释掉,默认继承技能。原来写 `skills: []`,子代理拿不到任何技能。
|
|
14
|
+
- 示例的 `auto-exit` 改为 `true`:收工后子进程 shutdown、父侧关 tab,槽位不再被占。再 `send` 时重启一个 pane,续同一个 session。
|
|
15
|
+
|
|
16
|
+
## 0.6.0 — 2026-11-01
|
|
17
|
+
|
|
18
|
+
- **BREAKING**:源码并入 [setwhite/pi-extensions](https://github.com/setwhite/pi-extensions),只从 npm 安装。pi 的 git 安装只认仓库根,指不到子目录。`git:` 安装留在旧仓,不再更新。
|
|
19
|
+
- 开发:CI、发布、提交前闸、lockfile 与行尾策略收成仓库一份。提交前闸改跑全部三个包。
|
package/README.md
CHANGED
|
@@ -6,11 +6,11 @@ The extension runs subagents as separate pi processes in herdr panes. One tool h
|
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
- Questions stay with the human
|
|
13
|
-
-
|
|
9
|
+
- A subagent is a separate process. A human can take over its pane. If the subagent cwd equals the parent cwd, the subagent opens a tab in the same workspace. Otherwise the subagent opens a new workspace.
|
|
10
|
+
- Profiles have two layers: Markdown with frontmatter. One layer is global. One layer is per project.
|
|
11
|
+
- Results are async and merged. `run` returns at once. Each finished turn reports one `subagent_result`. Results inside `aggregateWindowMs` merge into one result. Oversize results go to an artifact file.
|
|
12
|
+
- Questions stay with the human. A child prompt only emits `herdr:blocked`. Nothing reaches the parent. The human answers in the child pane.
|
|
13
|
+
- Nesting is off by default. The extension is not a sandbox. If the profile does not name this tool, child tool sets drop this tool.
|
|
14
14
|
|
|
15
15
|
## Install
|
|
16
16
|
|
|
@@ -56,7 +56,7 @@ The block below lists every key. Each value is the default.
|
|
|
56
56
|
"herdrBin": "herdr",
|
|
57
57
|
// Default 16, range 1 and up. At the limit run returns max_concurrent. A child with auto-exit: false keeps its slot after it settles.
|
|
58
58
|
"maxConcurrent": 16,
|
|
59
|
-
// Default 16384, range 1024 to 1048576. A longer text goes to an artifact file
|
|
59
|
+
// Default 16384, range 1024 to 1048576. A longer text goes to an artifact file. The message keeps a truncated head and the path.
|
|
60
60
|
"maxResultChars": 16384,
|
|
61
61
|
// Default 500, range 0 to 10000 milliseconds. 0 = deliver each result at once. A larger value merges more results.
|
|
62
62
|
"aggregateWindowMs": 500,
|
|
@@ -124,7 +124,7 @@ description: "Read-only research: read code, answer questions, change nothing"
|
|
|
124
124
|
# model: provider/model
|
|
125
125
|
thinking: low
|
|
126
126
|
|
|
127
|
-
# Plain names = strict allowlist
|
|
127
|
+
# Plain names = strict allowlist. +name / -name adjusts the default set. Never mix both
|
|
128
128
|
# Omitted = pi defaults minus this tool (nesting off); "" = empty allowlist
|
|
129
129
|
tools: read, bash
|
|
130
130
|
|
|
@@ -135,7 +135,7 @@ skills: ""
|
|
|
135
135
|
# task: body is the task text, no identity file
|
|
136
136
|
system-prompt: append
|
|
137
137
|
|
|
138
|
-
# Shut down and close the tab when settled
|
|
138
|
+
# Shut down and close the tab when settled. It waits while a prompt is open or the inbox has messages
|
|
139
139
|
auto-exit: true
|
|
140
140
|
|
|
141
141
|
# true = hidden from the guidelines; an explicit run still works
|
|
@@ -147,10 +147,10 @@ You are a read-only explorer. Answer with file paths and line numbers.
|
|
|
147
147
|
|
|
148
148
|
Error codes: [contract section 2](docs/specs/0001-v1-contract.md#2-profile). Defaults: `src/profile/frontmatter.ts` and `test/profile/`. A file without `name` or with an invalid field stays out of the list. The extension rejects all duplicate names in one layer. `run` returns `profile_invalid` with the file, the field and the reason.
|
|
149
149
|
|
|
150
|
-
The extension ships a bundled example. The file name and the `name` of the example are both `
|
|
150
|
+
The extension ships a bundled example. The file name and the `name` of the example are both `worker`. Loading reads `profiles/*.md` only. On every load the extension makes `profiles/examples/` match the bundled examples: it rewrites the bundled files and deletes extra files. So copy the example one level up:
|
|
151
151
|
|
|
152
152
|
```bash
|
|
153
|
-
cd <agent-dir>/pi-herdr-subagents-lite/profiles && cp examples/
|
|
153
|
+
cd <agent-dir>/pi-herdr-subagents-lite/profiles && cp examples/worker.md worker.md
|
|
154
154
|
```
|
|
155
155
|
|
|
156
156
|
## Credits
|
package/README.zh-CN.md
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
**[简体中文](README.zh-CN.md)** | [English](README.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
本扩展让子代理作为独立 pi 进程,跑在 herdr pane 里。一个工具有两个 action:`run` 起子代理,`send` 续聊。结果异步回投。行为以 [v1 契约](docs/specs/0001-v1-contract.md) 为准。
|
|
6
6
|
|
|
7
7
|
## 功能
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
- 两层 profile:Markdown + frontmatter
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
9
|
+
- 独立进程,可人工接管。每个子代理是 herdr pane 里的独立 pi 进程。子代理的 cwd 与父相同时,它在同一个 workspace 新开 tab。cwd 不同时,它新建 workspace。
|
|
10
|
+
- 两层 profile:Markdown + frontmatter。全局一层,项目一层。
|
|
11
|
+
- 结果异步,可合并。`run` 立即返回。每次收工投一条 `subagent_result`。落在 `aggregateWindowMs` 内的结果合并成一条。超长结果落 artifact 文件。
|
|
12
|
+
- 反问留在人这边。子代理弹对话框只发 `herdr:blocked`。父侧收不到这个消息。人在子 pane 里回答。
|
|
13
|
+
- 默认不嵌套,也不是沙箱。子代理的工具集默认去掉本工具。只有 profile 点名,才授予本工具。
|
|
14
14
|
|
|
15
15
|
## 安装
|
|
16
16
|
|
|
@@ -24,17 +24,17 @@ pi -e /path/to/pi-herdr-subagents-lite/src/index.ts # 只对当前进程生效
|
|
|
24
24
|
|
|
25
25
|
不要加 `-l`。`-l` 只写项目设置,在别的 workspace 里起的子代理就加载不到。`pi -e` 同样是单进程。
|
|
26
26
|
|
|
27
|
-
在 herdr `0.9.5` 与 pi `1.4.0` 上测过,Node `>= 22.19`。父会话必须在 herdr pane
|
|
27
|
+
在 herdr `0.9.5` 与 pi `1.4.0` 上测过,Node `>= 22.19`。父会话必须在 herdr pane 里。不在时返回 `not_in_herdr`。升级用 `pi update --extensions`。卸载用 `pi remove <source>`。
|
|
28
28
|
|
|
29
29
|
## 配置
|
|
30
30
|
|
|
31
31
|
只有一个全局文件:`<agent-dir>/pi-herdr-subagents-lite/config.json`。`<agent-dir>` 默认 `~/.pi/agent`,跟随 `PI_CODING_AGENT_DIR`。扩展不读项目级配置。
|
|
32
32
|
|
|
33
|
-
默认值与 clamp
|
|
33
|
+
默认值与 clamp 边界见 `src/config/index.ts` 与 `test/config/config.test.ts`。键与语义见[契约 §1](docs/specs/0001-v1-contract.md#1-配置)。
|
|
34
34
|
|
|
35
35
|
### 最小配置
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
文件不存在时,全部用默认值。只改一项,就只写这一项:
|
|
38
38
|
|
|
39
39
|
```json
|
|
40
40
|
{
|
|
@@ -52,11 +52,11 @@ pi -e /path/to/pi-herdr-subagents-lite/src/index.ts # 只对当前进程生效
|
|
|
52
52
|
"enabled": true,
|
|
53
53
|
// 默认 "subagent"。须匹配 ^[a-z][a-z0-9_]{0,31}$。它会作为每条 guideline 的前缀。
|
|
54
54
|
"toolName": "subagent",
|
|
55
|
-
// 默认 "herdr"。裸名从 PATH
|
|
55
|
+
// 默认 "herdr"。裸名从 PATH 解析。绝对路径锁定版本。
|
|
56
56
|
"herdrBin": "herdr",
|
|
57
57
|
// 默认 16,下限 1。到上限时 run 返回 max_concurrent。auto-exit: false 的子代理收工后仍占槽。
|
|
58
58
|
"maxConcurrent": 16,
|
|
59
|
-
// 默认 16384,范围 1024 到 1048576。超上限时全文落 artifact
|
|
59
|
+
// 默认 16384,范围 1024 到 1048576。超上限时全文落 artifact 文件。消息里留截断的头和路径。
|
|
60
60
|
"maxResultChars": 16384,
|
|
61
61
|
// 默认 500,范围 0 到 10000,单位毫秒。0 = 逐条立即投递。调大合并更多结果。
|
|
62
62
|
"aggregateWindowMs": 500,
|
|
@@ -64,9 +64,9 @@ pi -e /path/to/pi-herdr-subagents-lite/src/index.ts # 只对当前进程生效
|
|
|
64
64
|
"closeChildrenOn": [],
|
|
65
65
|
// 默认 250,范围 50 到 5000,单位毫秒。调大省唤醒,投递变慢。
|
|
66
66
|
"inboxPollMs": 250,
|
|
67
|
-
// 默认 1000,范围 100 到 60000
|
|
67
|
+
// 默认 1000,范围 100 到 60000,单位毫秒。子代理在 working 或 blocked 时用它,刚 run / send 的 30 秒内也用它。
|
|
68
68
|
"pollIntervalMs": 1000,
|
|
69
|
-
// 默认 8000,范围 100 到 60000
|
|
69
|
+
// 默认 8000,范围 100 到 60000,单位毫秒。所有 live 子代理都只在等 send 时用它。调大后,发现 pane 消失更晚。
|
|
70
70
|
"idlePollIntervalMs": 8000,
|
|
71
71
|
// 工具文案覆盖。每个键默认未设置,用下面这份内置文案。
|
|
72
72
|
"prompts": {
|
|
@@ -92,7 +92,7 @@ pi -e /path/to/pi-herdr-subagents-lite/src/index.ts # 只对当前进程生效
|
|
|
92
92
|
}
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
文件必须是严格 JSON。扩展只读一次,所以保存前删掉注释,改完重启 pi。未知键、类型不对或枚举值非法都会让扩展加载失败:pi 打出 `invalid config <路径>: <字段>: unknown key` 后退出。超范围的数字会被夹到边界,不报错。
|
|
96
96
|
|
|
97
97
|
## 用法
|
|
98
98
|
|
|
@@ -112,11 +112,11 @@ pi -e /path/to/pi-herdr-subagents-lite/src/index.ts # 只对当前进程生效
|
|
|
112
112
|
|
|
113
113
|
### Profile
|
|
114
114
|
|
|
115
|
-
全局 profile 在 `<agent-dir>/pi-herdr-subagents-lite/profiles/*.md
|
|
115
|
+
全局 profile 在 `<agent-dir>/pi-herdr-subagents-lite/profiles/*.md`。项目 profile 在 `.pi/pi-herdr-subagents-lite/profiles/*.md`,项目受信任后才读。`name` 相同时,项目覆盖全局。
|
|
116
116
|
|
|
117
117
|
```markdown
|
|
118
118
|
---
|
|
119
|
-
# run
|
|
119
|
+
# run 的寻址名。文件名不参与查找
|
|
120
120
|
name: explore
|
|
121
121
|
description: 只读调研:读代码、回答问题,不改动任何文件
|
|
122
122
|
|
|
@@ -124,33 +124,33 @@ description: 只读调研:读代码、回答问题,不改动任何文件
|
|
|
124
124
|
# model: provider/model
|
|
125
125
|
thinking: low
|
|
126
126
|
|
|
127
|
-
# 纯名字 =
|
|
128
|
-
# 省略 = pi
|
|
127
|
+
# 纯名字 = 严格白名单。+名字 / -名字 在默认集上增删,两者不能混用
|
|
128
|
+
# 省略 = pi 默认集去掉本工具(不嵌套)。"" = 空白名单
|
|
129
129
|
tools: read, bash
|
|
130
130
|
|
|
131
|
-
# 省略 = 由 pi
|
|
131
|
+
# 省略 = 由 pi 发现。"" = 不加载。列表 = 只加载列出的
|
|
132
132
|
skills: ""
|
|
133
133
|
|
|
134
134
|
# append / replace:正文追加到或替换系统提示
|
|
135
135
|
# task:正文就是任务文本,不写身份文件
|
|
136
136
|
system-prompt: append
|
|
137
137
|
|
|
138
|
-
# 收工后自行退出并关掉 tab
|
|
138
|
+
# 收工后自行退出并关掉 tab。有打开的对话框或 inbox 待投递时会等
|
|
139
139
|
auto-exit: true
|
|
140
140
|
|
|
141
|
-
# true = 不出现在 guidelines 的 profile
|
|
141
|
+
# true = 不出现在 guidelines 的 profile 列表里。显式 run 仍然可用
|
|
142
142
|
disable-model-invocation: false
|
|
143
143
|
---
|
|
144
144
|
|
|
145
|
-
|
|
145
|
+
你是一名只读探索者。回答时给出文件路径与行号。
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
错误码见
|
|
148
|
+
错误码见[契约 §2](docs/specs/0001-v1-contract.md#2-profile)。默认值见 `src/profile/frontmatter.ts` 与 `test/profile/`。没写 `name` 的文件、字段非法的文件与同层同名的文件都不进列表。对它调用 `run`,返回 `profile_invalid`,带文件、字段与原因。
|
|
149
149
|
|
|
150
|
-
扩展自带一个示例 profile
|
|
150
|
+
扩展自带一个示例 profile。文件名和 `name` 都是 `worker`。加载只读 `profiles/*.md`。每次加载都把 `profiles/examples/` 对齐到扩展自带的示例:重写自带文件,删掉多余文件。所以复制一份到上一层即可:
|
|
151
151
|
|
|
152
152
|
```bash
|
|
153
|
-
cd <agent-dir>/pi-herdr-subagents-lite/profiles && cp examples/
|
|
153
|
+
cd <agent-dir>/pi-herdr-subagents-lite/profiles && cp examples/worker.md worker.md
|
|
154
154
|
```
|
|
155
155
|
|
|
156
156
|
## 参考项目
|
|
@@ -158,8 +158,8 @@ cd <agent-dir>/pi-herdr-subagents-lite/profiles && cp examples/domain.md domain.
|
|
|
158
158
|
| 项目 | 借鉴内容 |
|
|
159
159
|
|---|---|
|
|
160
160
|
| [earendil-works/pi](https://github.com/earendil-works/pi) | 扩展 API、包布局、官方示例 |
|
|
161
|
-
| [fyang93/pi-herdr-subagents](https://github.com/fyang93/pi-herdr-subagents) | profile
|
|
162
|
-
| [modem-dev/pi-herdr-subagents](https://github.com/modem-dev/pi-herdr-subagents) | herdr
|
|
161
|
+
| [fyang93/pi-herdr-subagents](https://github.com/fyang93/pi-herdr-subagents) | profile 字段形状。隔离 herdr session 的集成测试 |
|
|
162
|
+
| [modem-dev/pi-herdr-subagents](https://github.com/modem-dev/pi-herdr-subagents) | herdr 启动与生命周期。终态归类 |
|
|
163
163
|
| [purboo/pi-durable-subagents](https://github.com/purboo/pi-durable-subagents) | 异步投递、幂等、只上报一次 |
|
|
164
164
|
|
|
165
165
|
感谢这些项目的代码。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-herdr-subagents-lite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Run pi subagents in herdr panes.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"subagent"
|
|
18
18
|
],
|
|
19
19
|
"files": [
|
|
20
|
-
"src"
|
|
20
|
+
"src",
|
|
21
|
+
"CHANGELOG.md"
|
|
21
22
|
],
|
|
22
23
|
"packageManager": "pnpm@12.3.4",
|
|
23
24
|
"engines": {
|
package/src/profile/examples.ts
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
export const EXAMPLE_PROFILE_FILE = "
|
|
1
|
+
export const EXAMPLE_PROFILE_FILE = "worker.md";
|
|
2
2
|
|
|
3
3
|
export const EXAMPLE_PROFILE = `---
|
|
4
|
-
# Copy this file to profiles/
|
|
5
|
-
name:
|
|
6
|
-
description:
|
|
4
|
+
# Copy this file to profiles/worker.md to use it.
|
|
5
|
+
name: worker
|
|
6
|
+
description: General purpose.
|
|
7
7
|
# model: provider/model
|
|
8
8
|
# thinking: low
|
|
9
9
|
tools: -subagent
|
|
10
|
-
skills: []
|
|
10
|
+
# skills: []
|
|
11
11
|
system-prompt: append
|
|
12
|
-
auto-exit:
|
|
12
|
+
auto-exit: true
|
|
13
13
|
disable-model-invocation: false
|
|
14
14
|
---
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- Change only files in that domain.
|
|
18
|
-
- Read the code yourself. Do not ask the parent for context.
|
|
19
|
-
- Report what changed, what is left, and what blocks you.
|
|
20
|
-
- Stop if only the user can decide. Report the question.
|
|
15
|
+
- Stop when the task needs a design decision. Report what you need; the parent answers. Do not guess.
|
|
16
|
+
- Report concisely what changed, what is left, and what blocks you.
|
|
21
17
|
`;
|
package/src/profile/seed.ts
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import { mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
-
import {
|
|
1
|
+
import { mkdirSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
3
|
import { errorText } from "../error/index.ts";
|
|
4
4
|
import { EXAMPLE_PROFILE, EXAMPLE_PROFILE_FILE } from "./examples.ts";
|
|
5
5
|
|
|
6
6
|
export function seedExampleProfile(profilesDir: string): void {
|
|
7
|
-
const
|
|
7
|
+
const dir = join(profilesDir, "examples");
|
|
8
8
|
try {
|
|
9
|
-
mkdirSync(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
mkdirSync(dir, { recursive: true });
|
|
10
|
+
// 示例目录是分发物,不是用户数据:每次加载都与包内一致,旧示例过期比丢改动更糟(DEC-0057)。
|
|
11
|
+
writeFileSync(join(dir, EXAMPLE_PROFILE_FILE), EXAMPLE_PROFILE);
|
|
12
|
+
for (const entry of readdirSync(dir)) {
|
|
13
|
+
if (entry !== EXAMPLE_PROFILE_FILE) {
|
|
14
|
+
rmSync(join(dir, entry), { recursive: true, force: true });
|
|
15
|
+
}
|
|
14
16
|
}
|
|
17
|
+
} catch (error) {
|
|
15
18
|
// 示例是可选文件;写不成不能阻止扩展加载。
|
|
16
|
-
process.emitWarning(`pi-herdr-subagents-lite: could not write ${
|
|
19
|
+
process.emitWarning(`pi-herdr-subagents-lite: could not write ${dir}: ${errorText(error)}`);
|
|
17
20
|
}
|
|
18
21
|
}
|