pi-herdr-subagents-lite 0.10.0 → 0.11.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 +5 -0
- package/README.md +2 -9
- package/README.zh-CN.md +2 -9
- package/package.json +1 -1
- package/src/config/index.ts +0 -9
- package/src/config/schema.ts +0 -3
- package/src/extension/index.ts +1 -6
- package/src/bridge/index.ts +0 -24
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
本文件记录已发布版本的用户可见变更。更细的过程见 git log。破坏性变更标 **BREAKING**。0.5.2 及更早的变更见旧仓 `setwhite/pi-herdr-subagents-lite` 的 tag `v0.3.0`–`v0.5.2`。
|
|
4
4
|
|
|
5
|
+
## 0.11.0 — 2026-11-24
|
|
6
|
+
|
|
7
|
+
- **BREAKING**:删掉 bridge。本包不再监听 `ui_prompt_*`,不再 emit `herdr:blocked`,`bridge` 配置键变成未知键(老配置加载失败)。要上报 blocked,装会开模态对话框并自己 emit `herdr:blocked` 的扩展(DEC-0070)。
|
|
8
|
+
- 修:`pi-todo-lite` 的装饰 overlay 走 `ctx.ui.custom`,pi 对非捕获 overlay 也发 `ui_prompt_start`,bridge 把它翻成 `herdr:blocked`,pane 从 pi 启动起一直红,`herdr agent start` 还以 `agent_not_ready` 拒绝它。
|
|
9
|
+
|
|
5
10
|
## 0.10.0 — 2026-11-21
|
|
6
11
|
|
|
7
12
|
- **BREAKING**:profile 里出现不认识的字段不再忽略。该 profile 不加载,`run` 返回 `profile_invalid` 并指出字段(DEC-0069)。拼错 `auto_exit` 这类键以前是静默失效。
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ The extension runs each subagent as a separate pi process in its own herdr pane.
|
|
|
9
9
|
- A subagent is a separate process, and a human can take over its pane. When the child cwd matches the parent cwd, it opens a tab in the same workspace. Otherwise it opens a new workspace.
|
|
10
10
|
- Profiles have two layers, global and per project, each a Markdown file with frontmatter.
|
|
11
11
|
- `run` returns at once. Each finished turn reports one `subagent_result`. Results inside `aggregateWindowMs` merge into one message, and an oversize result goes to an artifact file.
|
|
12
|
-
- Questions stay with the human.
|
|
12
|
+
- Questions stay with the human. A dialog in the child pane never reaches the parent, and the human answers there. Reporting `blocked` to herdr belongs to the extension that opens the dialog (DEC-0070).
|
|
13
13
|
- Nesting is off by default, and the extension is no sandbox. Unless the profile names this tool, a child tool set drops it.
|
|
14
14
|
|
|
15
15
|
## Install
|
|
@@ -50,7 +50,7 @@ Every key follows, and each value is the default.
|
|
|
50
50
|
|
|
51
51
|
```jsonc
|
|
52
52
|
{
|
|
53
|
-
// Default true. false = no subagent tool for the model.
|
|
53
|
+
// Default true. false = no subagent tool for the model.
|
|
54
54
|
"enabled": true,
|
|
55
55
|
// Default "subagent". Must match ^[a-z][a-z0-9_]{0,31}$. The name prefixes each guideline line.
|
|
56
56
|
"toolName": "subagent",
|
|
@@ -84,13 +84,6 @@ Every key follows, and each value is the default.
|
|
|
84
84
|
"send only delivers; no state tracking.",
|
|
85
85
|
"Available profiles:\n{{profiles}}"
|
|
86
86
|
]
|
|
87
|
-
},
|
|
88
|
-
// Turn pi prompt events into herdr:blocked events.
|
|
89
|
-
"bridge": {
|
|
90
|
-
// Default true. false = no herdr:blocked events.
|
|
91
|
-
"enabled": true,
|
|
92
|
-
// Default all five. Prompt kinds that count as blocked: custom, select, confirm, input, editor.
|
|
93
|
-
"blockedOn": ["custom", "select", "confirm", "input", "editor"]
|
|
94
87
|
}
|
|
95
88
|
}
|
|
96
89
|
```
|
package/README.zh-CN.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
- 子代理是独立进程,人可以接管它的 pane。cwd 与父会话相同时,它在同一 workspace 新开 tab;不同则新建 workspace。
|
|
10
10
|
- profile 两层:全局一层,项目一层,都是 Markdown 加 frontmatter。
|
|
11
11
|
- `run` 立即返回。每个回合结束投一条 `subagent_result`,落在 `aggregateWindowMs` 内的合并成一条,超长的落 artifact 文件。
|
|
12
|
-
- 反问留在子 pane
|
|
12
|
+
- 反问留在子 pane。子代理弹对话框,父会话收不到,人在子 pane 里回答。向 herdr 上报 `blocked` 归开对话框的扩展(DEC-0070)。
|
|
13
13
|
- 默认不嵌套,也不是沙箱。profile 不点名,子代理的工具集就没有本工具。
|
|
14
14
|
|
|
15
15
|
## 安装
|
|
@@ -50,7 +50,7 @@ pi -e /path/to/pi-herdr-subagents-lite/src/index.ts # 只对当前进程生效
|
|
|
50
50
|
|
|
51
51
|
```jsonc
|
|
52
52
|
{
|
|
53
|
-
// 默认 true。false = 模型看不到本工具。
|
|
53
|
+
// 默认 true。false = 模型看不到本工具。
|
|
54
54
|
"enabled": true,
|
|
55
55
|
// 默认 "subagent"。须匹配 ^[a-z][a-z0-9_]{0,31}$。它会作为每条 guideline 的前缀。
|
|
56
56
|
"toolName": "subagent",
|
|
@@ -84,13 +84,6 @@ pi -e /path/to/pi-herdr-subagents-lite/src/index.ts # 只对当前进程生效
|
|
|
84
84
|
"send only delivers; no state tracking.",
|
|
85
85
|
"Available profiles:\n{{profiles}}"
|
|
86
86
|
]
|
|
87
|
-
},
|
|
88
|
-
// 把 pi 对话框事件转成 herdr:blocked 事件。
|
|
89
|
-
"bridge": {
|
|
90
|
-
// 默认 true。false = 不发 herdr:blocked。
|
|
91
|
-
"enabled": true,
|
|
92
|
-
// 默认全五种。算作 blocked 的对话框类型:custom、select、confirm、input、editor。
|
|
93
|
-
"blockedOn": ["custom", "select", "confirm", "input", "editor"]
|
|
94
87
|
}
|
|
95
88
|
}
|
|
96
89
|
```
|
package/package.json
CHANGED
package/src/config/index.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import {
|
|
4
|
-
BLOCKED_KINDS,
|
|
5
|
-
BRIDGE_KEYS,
|
|
6
4
|
boolean,
|
|
7
5
|
CONFIG_KEYS,
|
|
8
6
|
enumList,
|
|
@@ -22,7 +20,6 @@ import {
|
|
|
22
20
|
|
|
23
21
|
export { isRaw, type Raw } from "./schema.ts";
|
|
24
22
|
|
|
25
|
-
export type BlockedKind = (typeof BLOCKED_KINDS)[number];
|
|
26
23
|
export type ShutdownReason = (typeof SHUTDOWN_REASONS)[number];
|
|
27
24
|
|
|
28
25
|
interface PromptOverrides {
|
|
@@ -44,7 +41,6 @@ export interface Config {
|
|
|
44
41
|
runRetentionMs: number;
|
|
45
42
|
closeOnFailure: boolean;
|
|
46
43
|
prompts: PromptOverrides;
|
|
47
|
-
bridge: { enabled: boolean; blockedOn: BlockedKind[] };
|
|
48
44
|
}
|
|
49
45
|
|
|
50
46
|
function promptOverrides(scope: Scope): PromptOverrides {
|
|
@@ -67,7 +63,6 @@ function parse(raw: Raw, file: string): Config {
|
|
|
67
63
|
const problems: string[] = [];
|
|
68
64
|
const top: Scope = { raw, prefix: "", problems };
|
|
69
65
|
unknownKeys(top, CONFIG_KEYS);
|
|
70
|
-
const bridge = object(top, "bridge", BRIDGE_KEYS);
|
|
71
66
|
|
|
72
67
|
const config: Config = {
|
|
73
68
|
enabled: boolean(top, "enabled", true),
|
|
@@ -83,10 +78,6 @@ function parse(raw: Raw, file: string): Config {
|
|
|
83
78
|
// 0 = 永不清理。默认 30 天。
|
|
84
79
|
runRetentionMs: integer(top, "runRetentionMs", 2592000000, 0, 31536000000),
|
|
85
80
|
prompts: promptOverrides(top),
|
|
86
|
-
bridge: {
|
|
87
|
-
enabled: boolean(bridge, "enabled", true),
|
|
88
|
-
blockedOn: enumList(bridge, "blockedOn", BLOCKED_KINDS, BLOCKED_KINDS),
|
|
89
|
-
},
|
|
90
81
|
};
|
|
91
82
|
|
|
92
83
|
if (problems.length > 0) {
|
package/src/config/schema.ts
CHANGED
|
@@ -11,11 +11,8 @@ export const CONFIG_KEYS = [
|
|
|
11
11
|
"livenessPollMs",
|
|
12
12
|
"runRetentionMs",
|
|
13
13
|
"prompts",
|
|
14
|
-
"bridge",
|
|
15
14
|
];
|
|
16
|
-
export const BRIDGE_KEYS = ["enabled", "blockedOn"];
|
|
17
15
|
export const PROMPT_KEYS = ["description", "snippet", "guidelines"];
|
|
18
|
-
export const BLOCKED_KINDS = ["custom", "select", "confirm", "input", "editor"] as const;
|
|
19
16
|
export const SHUTDOWN_REASONS = ["new", "resume", "fork", "quit", "reload"] as const;
|
|
20
17
|
const TOOL_NAME = /^[a-z][a-z0-9_]{0,31}$/;
|
|
21
18
|
|
package/src/extension/index.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { SessionStartEvent } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import {
|
|
3
|
-
import type { BlockedKind, Config } from "../config/index.ts";
|
|
2
|
+
import type { Config } from "../config/index.ts";
|
|
4
3
|
import { errorText } from "../error/index.ts";
|
|
5
4
|
import type { HerdrHost } from "../herdr/index.ts";
|
|
6
5
|
import { drain, hasInbox, pumpInbox } from "../inbox/index.ts";
|
|
@@ -35,14 +34,11 @@ export type { SubagentTool };
|
|
|
35
34
|
|
|
36
35
|
type SessionStartHandler = (event: SessionStartEvent, ctx: SessionContext) => void;
|
|
37
36
|
type SettledHandler = (event: { type: "agent_settled"; aborted: boolean }, ctx: SessionContext) => void;
|
|
38
|
-
type PromptHandler = (event: { kind: BlockedKind; title?: string }) => void;
|
|
39
37
|
|
|
40
38
|
export interface ExtensionRegistrar {
|
|
41
|
-
events: { emit(channel: string, data: unknown): void };
|
|
42
39
|
on(event: "session_start", handler: SessionStartHandler): void;
|
|
43
40
|
on(event: "session_shutdown", handler: ShutdownHandler): void;
|
|
44
41
|
on(event: "agent_settled", handler: SettledHandler): void;
|
|
45
|
-
on(event: "ui_prompt_start" | "ui_prompt_end", handler: PromptHandler): void;
|
|
46
42
|
registerTool(tool: SubagentTool): void;
|
|
47
43
|
sendMessage(message: ResultMessage, options?: { triggerTurn?: boolean }): void;
|
|
48
44
|
sendUserMessage(content: string, options?: { deliverAs?: "steer" | "followUp" }): void;
|
|
@@ -57,7 +53,6 @@ export function createExtension(deps: ExtensionDeps): (pi: ExtensionRegistrar) =
|
|
|
57
53
|
let service: RunService | undefined;
|
|
58
54
|
let stopPump: (() => void) | undefined;
|
|
59
55
|
let inboxFailures = 0;
|
|
60
|
-
createBridge(pi, config.bridge);
|
|
61
56
|
watchReport(pi, { activeChildren: () => service?.active().length ?? 0 });
|
|
62
57
|
|
|
63
58
|
const stopInbox = () => {
|
package/src/bridge/index.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { BlockedKind, Config } from "../config/index.ts";
|
|
2
|
-
|
|
3
|
-
interface BridgePi {
|
|
4
|
-
on(event: "ui_prompt_start" | "ui_prompt_end", handler: (event: { kind: BlockedKind; title?: string }) => void): void;
|
|
5
|
-
events: { emit(channel: "herdr:blocked", data: { active: boolean; label?: string }): void };
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function createBridge(pi: BridgePi, config: Config["bridge"]): void {
|
|
9
|
-
if (!config.enabled) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
pi.on("ui_prompt_start", (event) => {
|
|
13
|
-
if (!config.blockedOn.includes(event.kind)) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
pi.events.emit("herdr:blocked", { active: true, label: event.title ?? event.kind });
|
|
17
|
-
});
|
|
18
|
-
pi.on("ui_prompt_end", (event) => {
|
|
19
|
-
if (!config.blockedOn.includes(event.kind)) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
pi.events.emit("herdr:blocked", { active: false });
|
|
23
|
-
});
|
|
24
|
-
}
|