billion-context-pi 0.1.83-pr.611.430 → 0.1.83-pr.613.431
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 +9 -44
- package/README.zh-CN.md +11 -46
- package/dist/config.d.ts +1 -129
- package/dist/index.js +151 -4164
- package/dist/index.js.map +1 -1
- package/dist/prompt-pack.d.ts +0 -3
- package/dist/runtime.d.ts +0 -5
- package/dist/setup-subagent-tools.d.ts +0 -11
- package/dist/system-prompt.d.ts +0 -1
- package/dist/user-config.d.ts +1 -4
- package/package.json +1 -1
- package/dist/delegate-events.d.ts +0 -95
- package/dist/delegate-tool.d.ts +0 -327
- package/dist/delegate-watchdog.d.ts +0 -44
- package/dist/fleet-inspector.d.ts +0 -42
- package/dist/fleet-widget.d.ts +0 -15
- package/dist/footer-status.d.ts +0 -8
package/README.md
CHANGED
|
@@ -78,11 +78,7 @@ pi install npm:billion-context-pi
|
|
|
78
78
|
|
|
79
79
|
That's it. The extension auto-loads on next Pi startup. No configuration needed — it reads your model's context window automatically.
|
|
80
80
|
|
|
81
|
-
> **
|
|
82
|
-
> - **Use ACP's delegate** — remove the other extension: `pi remove npm:pi-subagents`
|
|
83
|
-
> - **Keep your own sub-agent** — turn ACP's delegate off in `acp.json`: `{ "delegate": false }` (see *Using your own sub-agent instead* below)
|
|
84
|
-
>
|
|
85
|
-
> If you keep `pi-subagents` installed, billion-context-pi detects it at session start: a **project-level** install (`<cwd>/.pi/npm` or the project extensions dir) automatically stands `acp_delegate` down for that project — a reminder then tells you how to give pi-subagents' agents ACP compression via `/acp-subagents`. A **user-level-only** install (`~/.pi/npm`, user extensions dir) leaves `acp_delegate` active and logs a warning instead. Set `"delegate": { "forceEnable": true }` in `acp.json` to keep `acp_delegate` active regardless of detection.
|
|
81
|
+
> **Want sub-agents?** The `acp_delegate` tools were split out into **[billion-context-pi-subagents](https://github.com/ranxianglei/billion-context-pi-subagents)** ([#612](https://github.com/ranxianglei/billion-context-pi/issues/612)) — install it alongside when you want delegation: `pi install npm:billion-context-pi-subagents`. It reads the same `acp.json` files (all `delegate.*` keys moved there). If you also keep `pi-subagents` installed, that package detects it at session start and stands its delegate down for **project-scope** installs; give pi-subagents' agents ACP compression via this package's `/acp-subagents` command below.
|
|
86
82
|
|
|
87
83
|
## How it works
|
|
88
84
|
|
|
@@ -146,49 +142,18 @@ billion-context-pi is built for the **Pi** coding agent (`@earendil-works/pi-cod
|
|
|
146
142
|
| `acp_status` | Show context usage, compressed blocks, compressible ranges |
|
|
147
143
|
| `acp_cache` | Prompt-cache reconciliation: grand ledger (input/cached/hit rate), per-request miss attribution, per-fold economics |
|
|
148
144
|
| `acp_rule` | Record a short, principle-level reminder that survives compression (opt-in: `"rules": true`) |
|
|
149
|
-
| `acp_delegate` | Spawn a clean-context sub-agent for a task (review / research / implement / plan / advise) |
|
|
150
|
-
| `acp_delegate_wait` | Block until a delegate run finishes (returns its result; times out otherwise) |
|
|
151
|
-
| `acp_delegate_cancel` | Cancel a running delegate by runId |
|
|
152
145
|
|
|
153
|
-
|
|
146
|
+
`acp_rule` is opt-in — off by default, enable it with `"rules": true`.
|
|
154
147
|
|
|
155
|
-
###
|
|
148
|
+
### Sub-agents (separate package)
|
|
156
149
|
|
|
157
|
-
|
|
150
|
+
Clean-context delegation (`acp_delegate` / `acp_delegate_wait` / `acp_delegate_cancel`, the fleet inspector, and the TUI status widget) was split out of this package into **[billion-context-pi-subagents](https://github.com/ranxianglei/billion-context-pi-subagents)** ([#612](https://github.com/ranxianglei/billion-context-pi/issues/612)). Install it alongside when you want delegation:
|
|
158
151
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
| `reviewer` | read, bash, grep, find, ls + ACP | Read-only code review (bugs, risks, file:line) |
|
|
162
|
-
| `researcher` | read, bash, grep, find, ls + ACP | Read-only codebase investigation |
|
|
163
|
-
| `worker` | read, edit, write, bash | Make code changes |
|
|
164
|
-
| `planner` | read, bash, grep, find, ls + ACP | Analyze + propose a step-by-step plan |
|
|
165
|
-
| `oracle` | read, bash, grep, find, ls + ACP | Answer questions / advise |
|
|
166
|
-
|
|
167
|
-
Read-only roles (reviewer, researcher, planner, oracle) receive a restricted tool allowlist (`read, bash, grep, find, ls`) plus ACP context tools (`compress, decompress, search_context, acp_status`) so they can manage their own context. This prevents accidental file modifications, but `bash` can bypass it - **it is a guardrail, not a security boundary**.
|
|
168
|
-
|
|
169
|
-
Worker runs on Pi's full default toolset - no `--tools` allowlist is applied, so any loaded extension or custom tools (e.g. ACP, LSP, MCP) remain available. This keeps primary-task delegation fully capable. The `read, edit, write, bash` listing above reflects core tools only.
|
|
170
|
-
|
|
171
|
-
The full delegate result is saved to a file (`$TMPDIR/acp-delegate/<runId>.out`, defaulting to `/tmp/acp-delegate/<runId>.out`); the tool result and injected notification carry only the **task title + file path** (no preview) - use `read` for the details. This keeps the parent context lean.
|
|
172
|
-
|
|
173
|
-
- **Interactive (TUI) & RPC modes**: `async:true` (default) runs the child in the background; a short completion notification is injected into the chat when it finishes — **unless the model already read the result file after the run finished** (detected via the `read` tool or a bash command referencing the file), in which case the notification is skipped: the model already has the result, so re-injecting it would only waste context. Set `delegate: { notifyIfRead: "always" }` in `acp.json` to restore the always-inject behavior.
|
|
174
|
-
- **Print / JSON modes** (`pi -p`, SDK): `async:true` auto-downgrades to **synchronous** — the result returns as the tool result in the same turn (the parent exits after one turn, so background injection would be lost).
|
|
175
|
-
- **Failures are loud, never silent.** A run that fails (nonzero exit, spawn error, watchdog timeout) injects a `FAILED ⚠️` notification carrying a short error excerpt, so a failed delegate cannot hide among sibling completions. If a notification cannot be delivered at all, a recovery notice is attached to the next delegate notification or the next `acp_delegate` / `acp_delegate_wait` / `acp_delegate_cancel` tool result — a dispatched run's failure always reaches the model before it wraps up.
|
|
176
|
-
|
|
177
|
-
In the **interactive TUI**, async runs also show a live status widget below the editor (agent, elapsed seconds, task preview), so you always know what's running and for how long. Disabled automatically in RPC/print/JSON.
|
|
178
|
-
|
|
179
|
-
#### Using your own sub-agent instead
|
|
180
|
-
|
|
181
|
-
If you already run another sub-agent extension (pi-subagents, pi-lens, …), turn ACP's delegate off so the model is offered only one way to delegate. In `~/.pi/acp.json` (global) or `<project>/.pi/acp.json` (per project):
|
|
182
|
-
|
|
183
|
-
```json
|
|
184
|
-
{ "delegate": false }
|
|
152
|
+
```bash
|
|
153
|
+
pi install npm:billion-context-pi-subagents
|
|
185
154
|
```
|
|
186
155
|
|
|
187
|
-
|
|
188
|
-
- **What it removes:** the `acp_delegate`, `acp_delegate_wait` and `acp_delegate_cancel` tools, the `ACP_DELEGATE NOTIFICATIONS` system-prompt section, and the `ctrl+alt+f` fleet shortcut (`/acp-fleet` then reports that delegate is off). Compression is unaffected — `compress`, `decompress`, `search_context`, `acp_status` and `acp_cache` stay.
|
|
189
|
-
- **When it applies:** the three tools are registered at session start, so a change needs a **new session** (or a Pi restart). The system-prompt section is resolved live on every turn, so it can disappear mid-session before the tools do.
|
|
190
|
-
- Want to drop only the prompt section and keep the tools? Set `{ "delegatePrompt": null }`.
|
|
191
|
-
- Pi's `--exclude-tools acp_delegate,acp_delegate_wait,acp_delegate_cancel` is **not** a substitute: it hides the tools but the model still receives the `ACP_DELEGATE NOTIFICATIONS` section describing tools it cannot call. Use `delegate: false`.
|
|
156
|
+
It reads the same `acp.json` files — all `delegate.*`, `displayUsage` and `delegatePrompt` keys moved there, so existing keys are picked up unchanged by the new package and ignored by this one. Roles, execution model (async/sync, notifications, watchdogs), configuration keys, and the env overrides are documented in its README.
|
|
192
157
|
|
|
193
158
|
## `/acp` command
|
|
194
159
|
|
|
@@ -220,7 +185,7 @@ Blocks: 3 active (3.7K summary, 15.2K original compressed)
|
|
|
220
185
|
|
|
221
186
|
**Optional, one-time setup — only if you also use [pi-subagents](https://github.com/nicobailon/pi-subagents).**
|
|
222
187
|
|
|
223
|
-
|
|
188
|
+
If you keep pi-subagents installed (with or without [billion-context-pi-subagents](https://github.com/ranxianglei/billion-context-pi-subagents)) and want its builtin sub-agents to have ACP context tools (`compress`/`decompress`/`search_context`/`acp_status`) for long-running tasks, run:
|
|
224
189
|
|
|
225
190
|
```
|
|
226
191
|
/acp-subagents
|
|
@@ -238,7 +203,7 @@ Behavior is tuned via an optional `acp.json` config file (`~/.pi/acp.json` for g
|
|
|
238
203
|
|
|
239
204
|
billion-context-pi writes a structured, always-on log to `~/.pi/acp.log` (override with `ACP_LOG_FILE`). It covers the model's whole working session and is useful for diagnosing problems:
|
|
240
205
|
|
|
241
|
-
- **Always written** (even with `debug: false`): `error`, `warn`, `info` levels — session start, every context turn (token usage / nudge decision), compress/decompress,
|
|
206
|
+
- **Always written** (even with `debug: false`): `error`, `warn`, `info` levels — session start, every context turn (token usage / nudge decision), compress/decompress, and **all errors and warnings** (config/state/tool failures, guardrail caps, update failures). Error lines include the message and stack trace. ([billion-context-pi-subagents](https://github.com/ranxianglei/billion-context-pi-subagents) writes to the same file when installed.)
|
|
242
207
|
- **Written only when `debug: true`**: verbose `debug`-level diagnostics (full field dumps, per-turn internals).
|
|
243
208
|
|
|
244
209
|
- **Nudge audit trail**: whenever a context-limit nudge is injected, a compact one-line record (e.g. `[ACP nudge] EMERGENCY 95% · T1 · top range m00120–m00168`) is appended as a *display-only* session entry — it survives process restarts, shows up in TUI scrollback and the session file, and is never sent to the model.
|
package/README.zh-CN.md
CHANGED
|
@@ -77,11 +77,7 @@ pi install npm:billion-context-pi
|
|
|
77
77
|
|
|
78
78
|
完成。扩展在下次 Pi 启动时自动加载。无需配置 —— 它会自动读取模型的上下文窗口。
|
|
79
79
|
|
|
80
|
-
>
|
|
81
|
-
> - **用 ACP 的 delegate** —— 卸载另一个扩展:`pi remove npm:pi-subagents`
|
|
82
|
-
> - **保留你自己的子代理** —— 在 `acp.json` 里关掉 ACP 的 delegate:`{ "delegate": false }`(见下文*改用你自己的子代理*)
|
|
83
|
-
>
|
|
84
|
-
> 若保留已安装的 `pi-subagents`,billion-context-pi 会在会话启动时检测:**项目级**安装(`<cwd>/.pi/npm` 或项目内 extensions 目录)会自动停用该项目的 `acp_delegate`,并提醒你运行 `/acp-subagents` 让 pi-subagents 的子代理获得 ACP 压缩;仅**用户级**(全局)安装时只记一条警告日志,`acp_delegate` 保持启用。在 `acp.json` 中设置 `"delegate": { "forceEnable": true }` 可在检测到第三方子代理时仍强制保留 `acp_delegate`。
|
|
80
|
+
> **想使用子代理?** `acp_delegate` 工具已拆分至独立的 [**billion-context-pi-subagents**](https://github.com/ranxianglei/billion-context-pi-subagents)([#612](https://github.com/ranxianglei/billion-context-pi/issues/612))——需要委派时一并安装:`pi install npm:billion-context-pi-subagents`。它读取同样的 `acp.json` 文件(所有 `delegate.*` 键已迁往该包)。若你同时保留 `pi-subagents`,该包会在会话启动时检测,并对**项目级**安装自动停用其 delegate;pi-subagents 的子代理可通过本包下方的 `/acp-subagents` 命令获得 ACP 压缩。
|
|
85
81
|
|
|
86
82
|
## 工作原理
|
|
87
83
|
|
|
@@ -134,48 +130,18 @@ billion-context-pi 面向 **Pi** 编码代理(`@earendil-works/pi-coding-agent`)
|
|
|
134
130
|
| `search_context` | 按关键词搜索已压缩块摘要(及可见消息) |
|
|
135
131
|
| `acp_status` | 显示上下文用量、已压缩块、可压缩范围 |
|
|
136
132
|
| `acp_rule` | 记录一条简短、原则性的提醒,穿越压缩保留(可选:`"rules": true`) |
|
|
137
|
-
| `acp_delegate` | 为某个任务派生一个干净上下文的子代理(审查 / 调研 / 实现 / 规划 / 建议) |
|
|
138
|
-
| `acp_delegate_wait` | 阻塞等待委派任务完成(返回结果,否则超时) |
|
|
139
|
-
| `acp_delegate_cancel` | 按 runId 取消正在运行的委派任务 |
|
|
140
133
|
|
|
141
|
-
`
|
|
134
|
+
`acp_rule` 是可选的——默认关闭,在 `acp.json` 中设置 `"rules": true` 启用。
|
|
142
135
|
|
|
143
|
-
###
|
|
136
|
+
### 子代理(独立包)
|
|
144
137
|
|
|
145
|
-
|
|
138
|
+
干净上下文委派(`acp_delegate` / `acp_delegate_wait` / `acp_delegate_cancel`、fleet inspector、TUI 状态 widget)已从本包拆分至 [**billion-context-pi-subagents**](https://github.com/ranxianglei/billion-context-pi-subagents)([#612](https://github.com/ranxianglei/billion-context-pi/issues/612))。需要委派时一并安装:
|
|
146
139
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
| `reviewer` | read, bash, grep, find, ls + ACP | 只读代码审查(bug、风险、file:line) |
|
|
150
|
-
| `researcher` | read, bash, grep, find, ls + ACP | 只读代码库调研 |
|
|
151
|
-
| `worker` | read, edit, write, bash | 修改代码 |
|
|
152
|
-
| `planner` | read, bash, grep, find, ls + ACP | 分析 + 提出分步计划 |
|
|
153
|
-
| `oracle` | read, bash, grep, find, ls + ACP | 回答问题 / 建议 |
|
|
154
|
-
|
|
155
|
-
只读角色(reviewer、researcher、planner、oracle)获得受限工具白名单(`read, bash, grep, find, ls`)+ ACP 上下文工具(`compress, decompress, search_context, acp_status`),以便管理自己的上下文。这能防止意外修改文件,但 `bash` 可绕过 - **这是护栏,不是安全边界**。
|
|
156
|
-
|
|
157
|
-
Worker 运行在 Pi 的完整默认工具集上 - 不应用 `--tools` 白名单,因此任何已加载的扩展或自定义工具(如 ACP、LSP、MCP)保持可用。这确保主任务委派能力完整。上表中的 `read, edit, write, bash` 仅反映核心工具。
|
|
158
|
-
|
|
159
|
-
委派的完整结果保存到文件(`$TMPDIR/acp-delegate/<runId>.out`,默认 `/tmp/acp-delegate/<runId>.out`);工具结果和注入通知只携带**任务标题 + 文件路径**(无预览)- 需要细节时用 `read` 读取。这让父上下文保持精简。
|
|
160
|
-
|
|
161
|
-
- **交互(TUI)与 RPC 模式**:`async:true`(默认)在后台运行子进程;完成时一条简短通知注入到聊天框。
|
|
162
|
-
- **Print / JSON 模式**(`pi -p`、SDK):`async:true` 自动降级为**同步** — 结果在同一轮作为工具结果返回(父进程一轮后即退出,后台注入会丢失)。
|
|
163
|
-
|
|
164
|
-
在**交互 TUI** 中,异步运行还会在编辑器下方显示一个实时状态 widget(角色、已运行秒数、任务预览),让你随时知道什么在跑、跑了多久。RPC/print/JSON 模式自动禁用。
|
|
165
|
-
|
|
166
|
-
#### 改用你自己的子代理
|
|
167
|
-
|
|
168
|
-
如果你已经在用别的子代理扩展(pi-subagents、pi-lens 等),关掉 ACP 的 delegate,让模型只有一条委派路径。在 `~/.pi/acp.json`(全局)或 `<项目>/.pi/acp.json`(项目级):
|
|
169
|
-
|
|
170
|
-
```json
|
|
171
|
-
{ "delegate": false }
|
|
140
|
+
```bash
|
|
141
|
+
pi install npm:billion-context-pi-subagents
|
|
172
142
|
```
|
|
173
143
|
|
|
174
|
-
|
|
175
|
-
- **关掉的是什么:**`acp_delegate`、`acp_delegate_wait`、`acp_delegate_cancel` 三个工具,`ACP_DELEGATE NOTIFICATIONS` 系统提示段,以及 `ctrl+alt+f` 快捷键(此时 `/acp-fleet` 会提示 delegate 未启用)。压缩本身不受影响 —— `compress`、`decompress`、`search_context`、`acp_status` 全部保留。
|
|
176
|
-
- **生效时机:**三个工具在会话启动时注册,因此需要**新会话**(或重启 Pi)。系统提示段每回合实时解析,可能在工具之前先消失。
|
|
177
|
-
- 只想去掉提示段、保留工具?设 `{ "delegatePrompt": null }`。
|
|
178
|
-
- Pi 原生的 `--exclude-tools acp_delegate,acp_delegate_wait,acp_delegate_cancel` **不能**替代:它藏起工具,但模型仍会收到描述这些工具的 `ACP_DELEGATE NOTIFICATIONS` 段。请用 `delegate: false`。
|
|
144
|
+
它读取同样的 `acp.json` 文件——所有 `delegate.*`、`displayUsage`、`delegatePrompt` 键已迁往该包,因此现有键会被新包原样读取、被本包忽略。角色、执行模型(async/sync、通知、看门狗)、配置键与环境变量覆盖均在其 README 中记录。
|
|
179
145
|
|
|
180
146
|
## `/acp` 命令
|
|
181
147
|
|
|
@@ -207,7 +173,7 @@ Blocks: 3 active (3.7K summary, 15.2K original compressed)
|
|
|
207
173
|
|
|
208
174
|
**可选、一次性设置——仅当你同时使用 [pi-subagents](https://github.com/nicobailon/pi-subagents) 时需要。**
|
|
209
175
|
|
|
210
|
-
billion-context-pi
|
|
176
|
+
如果你保留了 pi-subagents(无论是否同时安装 [billion-context-pi-subagents](https://github.com/ranxianglei/billion-context-pi-subagents)),并希望它的内置子代理在长任务中也能使用 ACP 上下文工具(`compress`/`decompress`/`search_context`/`acp_status`),运行:
|
|
211
177
|
|
|
212
178
|
```
|
|
213
179
|
/acp-subagents
|
|
@@ -225,10 +191,9 @@ billion-context-pi 开箱即用,无需任何配置——它会自动读取模型
|
|
|
225
191
|
|
|
226
192
|
billion-context-pi 会向 `~/.pi/acp.log`(可用 `ACP_LOG_FILE` 覆盖)写入结构化的**始终开启**日志,覆盖模型工作的整个会话,便于排查问题:
|
|
227
193
|
|
|
228
|
-
- `error`
|
|
229
|
-
- `
|
|
230
|
-
|
|
231
|
-
- `debug` —— 仅在 `debug: true` 时额外写入(细粒度的字段级事件)。
|
|
194
|
+
- **始终写入**(即使 `debug: false`):`error`、`warn`、`info` 级别——会话启动、每个上下文轮次(token 用量/nudge 决策)、压缩/解压,以及**所有错误与警告**(配置/状态/工具失败、护栏上限、更新失败)。错误行包含 message 与 stack trace。(安装 [billion-context-pi-subagents](https://github.com/ranxianglei/billion-context-pi-subagents) 后它也写入同一文件。)
|
|
195
|
+
- **仅当 `debug: true` 时写入**:详细的 `debug` 级别诊断(完整字段转储、逐轮内部数据)。
|
|
196
|
+
|
|
232
197
|
- **Nudge 审计轨迹** — 无论何时注入上下文限制 nudge,一条紧凑的单行记录(如 `[ACP nudge] EMERGENCY 95% · T1 · top range m00120–m00168`)会作为*仅供显示*的会话条目写入——它跨进程重启存活,在 TUI 回滚历史和会话文件中可见,且永远不会发给模型。
|
|
233
198
|
|
|
234
199
|
每行格式:`<ISO 时间戳> [<级别>] [<范围>] key=value key=value`。多行字段值(如 `nudge-injected` 中的完整 nudge 正文)会被转义(`\n` → 字面量 `\\n`),保证每条日志恰好占**一行物理行**,便于 `grep`。文件达到 10 MB 时轮转为 `~/.pi/acp.log.old`。
|
package/dist/config.d.ts
CHANGED
|
@@ -4,119 +4,6 @@ import type { DegenerationGuardConfig } from "./degeneration.js";
|
|
|
4
4
|
import type { ThrottleRetryConfig } from "./throttle-retry.js";
|
|
5
5
|
import type { PiPromptSections } from "./system-prompt.js";
|
|
6
6
|
import type { NudgeSectionsConfig, ToolPromptsConfig } from "./surface.js";
|
|
7
|
-
/** Default TUI shortcut for the acp_delegate fleet inspector. Moved off
|
|
8
|
-
* "ctrl+alt+f" (also claimed by pi-subagents) to avoid a cross-extension
|
|
9
|
-
* conflict Pi's loader only warns about — last-loaded silently wins (#412). */
|
|
10
|
-
export declare const DEFAULT_FLEET_SHORTCUT = "ctrl+alt+d";
|
|
11
|
-
/** Per-role delegate defaults. Lets long-lived automation pin a cheaper or
|
|
12
|
-
* more capable model and a thinking level per delegate role, so the main
|
|
13
|
-
* agent doesn't have to fill them in on every `acp_delegate()` call. */
|
|
14
|
-
export interface DelegateRoleConfig {
|
|
15
|
-
/** Default model for this role, as `"provider/id"`. Resolution priority:
|
|
16
|
-
* per-call `model` > this role default > parent agent's current model. A
|
|
17
|
-
* value that isn't a valid `"provider/id"` is ignored (treated as unset).
|
|
18
|
-
* If the configured model doesn't exist in the live registry, the child
|
|
19
|
-
* falls back to the parent model and a warning is logged — it never fails. */
|
|
20
|
-
model?: string;
|
|
21
|
-
/** Default thinking level for this role: one of off|minimal|low|medium|
|
|
22
|
-
* high|xhigh|max. Resolution priority: per-call `thinkingLevel` > this role
|
|
23
|
-
* default > global `delegate.thinkingLevel` > Pi's own default. An invalid
|
|
24
|
-
* value is ignored with a warning (never fails). */
|
|
25
|
-
thinkingLevel?: string;
|
|
26
|
-
}
|
|
27
|
-
/** Delegate sub-agent configuration. */
|
|
28
|
-
export interface DelegateConfig {
|
|
29
|
-
/** Enable acp_delegate tools (delegate/wait/cancel) and their system-prompt
|
|
30
|
-
* section. Default: true. Set `enabled: false` to skip registering them. */
|
|
31
|
-
enabled?: boolean;
|
|
32
|
-
/** Keep acp_delegate active even when a third-party subagent extension
|
|
33
|
-
* (pi-subagents) is installed. Default: false — when pi-subagents is
|
|
34
|
-
* detected at session start, acp_delegate stands down (tools, fleet
|
|
35
|
-
* shortcut and system-prompt section skipped) to avoid two overlapping
|
|
36
|
-
* sub-agent systems, and a reminder points at /acp-subagents so the
|
|
37
|
-
* third-party agents can still get ACP compression tools (#415). */
|
|
38
|
-
forceEnable?: boolean;
|
|
39
|
-
/** How delegate usage is reported back to the main session.
|
|
40
|
-
* "separate" (default) — delegate tokens tracked in a separate accumulator;
|
|
41
|
-
* main session totals stay clean, delegate usage shows as its own block in
|
|
42
|
-
* acp_status (excluded from main totals).
|
|
43
|
-
* "merged" — delegate token usage folded into the tool-result usage field,
|
|
44
|
-
* counted as part of the main session totals. */
|
|
45
|
-
displayUsage?: "merged" | "separate";
|
|
46
|
-
/** Maximum acp_delegate nesting depth. Default: 2 (main → child → grandchild;
|
|
47
|
-
* the grandchild cannot delegate further). Set 1 to forbid nested delegation
|
|
48
|
-
* (orchestrator → leaf workers only). The resolved value is propagated to
|
|
49
|
-
* child processes via PI_ACP_DELEGATE_MAX_DEPTH so the cap follows the whole
|
|
50
|
-
* delegation tree, even when a child loads a different project acp.json. */
|
|
51
|
-
maxDepth?: number;
|
|
52
|
-
/** Hard timeout for synchronous delegates (async=false, or async auto-downgraded
|
|
53
|
-
* on one-shot hosts), in minutes. Default: 5. 0 or null disables the timeout
|
|
54
|
-
* (the run blocks until the child exits or the tool call is cancelled). */
|
|
55
|
-
syncTimeoutMinutes?: number | null;
|
|
56
|
-
/** Idle watchdog for async delegates: kill when no output arrives for this many
|
|
57
|
-
* minutes. Default: 5. This is the main defense against a stuck child holding
|
|
58
|
-
* its stdout fd open, so disabling it (0/null) logs a warning — use
|
|
59
|
-
* acp_delegate_cancel as the manual escape hatch. */
|
|
60
|
-
idleTimeoutMinutes?: number | null;
|
|
61
|
-
/** Hard time limit for async delegates, in minutes. Default: 30. 0 or null
|
|
62
|
-
* disables the limit. */
|
|
63
|
-
asyncTimeoutMinutes?: number | null;
|
|
64
|
-
/** Cap on how many background (async) delegate processes run at once.
|
|
65
|
-
* `1` forces strict serial execution; `N` allows up to N in parallel;
|
|
66
|
-
* omitted means unlimited (existing behavior). Extra launches are queued and
|
|
67
|
-
* start automatically as slots free. Invalid values (non-integer, <1) fall
|
|
68
|
-
* back to unlimited with a warning. Env `PI_ACP_DELEGATE_MAX_CONCURRENT`
|
|
69
|
-
* overrides this. See #294. */
|
|
70
|
-
maxConcurrent?: number;
|
|
71
|
-
/** Global default thinking level applied to every delegate when neither the
|
|
72
|
-
* per-call `thinkingLevel` nor the role's own `thinkingLevel` is set. One of
|
|
73
|
-
* off|minimal|low|medium|high|xhigh|max. When unset at all levels, no
|
|
74
|
-
* `--thinking` flag is passed and each child uses Pi's own default. */
|
|
75
|
-
thinkingLevel?: string;
|
|
76
|
-
/** Per-role defaults keyed by role name (reviewer/researcher/worker/planner/
|
|
77
|
-
* oracle, or any custom role). See DelegateRoleConfig. Only affects roles
|
|
78
|
-
* that are named here; other roles inherit the parent model + Pi defaults. */
|
|
79
|
-
agents?: Record<string, DelegateRoleConfig>;
|
|
80
|
-
/** What happens to the completion notification when the model has already
|
|
81
|
-
* read the delegate's result file after the run finished.
|
|
82
|
-
* "skip" (default) — the notification is not injected; the model already
|
|
83
|
-
* saw the result, so re-injecting it would only waste context.
|
|
84
|
-
* "always" — always inject the notification (previous behavior). */
|
|
85
|
-
notifyIfRead?: "skip" | "always";
|
|
86
|
-
/** Keybinding for the interactive TUI shortcut that opens the acp_delegate
|
|
87
|
-
* fleet inspector (live list + transcript). Default: "ctrl+alt+d". Set to
|
|
88
|
-
* "" (empty string) to disable keyboard registration entirely — the
|
|
89
|
-
* inspector stays reachable via /acp-fleet. Moved off the previous hardcoded
|
|
90
|
-
* "ctrl+alt+f" because pi-subagents also claims ctrl+alt+f, and Pi's loader
|
|
91
|
-
* only warns + last-loaded-wins on cross-extension conflicts (#412). */
|
|
92
|
-
fleetShortcut?: string;
|
|
93
|
-
}
|
|
94
|
-
/** Resolved delegate policy: what actually takes effect after merging acp.json,
|
|
95
|
-
* env overrides and defaults. Timeout fields are milliseconds; null means the
|
|
96
|
-
* corresponding timeout/watchdog is disabled. */
|
|
97
|
-
export interface DelegatePolicy {
|
|
98
|
-
enabled: boolean;
|
|
99
|
-
/** Resolved delegate.forceEnable (default false): keep acp_delegate even
|
|
100
|
-
* when a third-party subagent extension (pi-subagents) is installed (#415). */
|
|
101
|
-
forceEnable: boolean;
|
|
102
|
-
displayUsage: "merged" | "separate";
|
|
103
|
-
maxDepth: number;
|
|
104
|
-
syncTimeoutMs: number | null;
|
|
105
|
-
idleMs: number | null;
|
|
106
|
-
asyncTimeoutMs: number | null;
|
|
107
|
-
/** Resolved cap on concurrent background delegates; Infinity = unlimited. */
|
|
108
|
-
maxConcurrent: number;
|
|
109
|
-
/** Global default thinking level (undefined when unset). */
|
|
110
|
-
thinkingLevel?: string;
|
|
111
|
-
/** Per-role defaults keyed by role name (undefined when unset). */
|
|
112
|
-
agents?: Record<string, DelegateRoleConfig>;
|
|
113
|
-
/** Whether to suppress the completion notification when the model already
|
|
114
|
-
* read the result file after the run finished. Always resolved ("skip" default). */
|
|
115
|
-
notifyIfRead: "skip" | "always";
|
|
116
|
-
/** Resolved TUI shortcut for the fleet inspector ("" = registration disabled). */
|
|
117
|
-
fleetShortcut: string;
|
|
118
|
-
}
|
|
119
|
-
export declare const DEFAULT_DELEGATE_POLICY: DelegatePolicy;
|
|
120
7
|
/** Compression tuning fields, shared by all three levels (global, provider,
|
|
121
8
|
* model). Percentage fields accept a ratio (0.75) or percent string ("75%").
|
|
122
9
|
* Resolution is per-field, deepest-wins (model > provider > global); an
|
|
@@ -257,7 +144,7 @@ export interface AdapterConfig {
|
|
|
257
144
|
* network calls on startup. */
|
|
258
145
|
autoUpdate?: boolean;
|
|
259
146
|
/** Enable debug-level events in the ACP log file (default ~/.pi/acp.log).
|
|
260
|
-
* Always-on events (session/turn/compress
|
|
147
|
+
* Always-on events (session/turn/compress lifecycle, all errors and
|
|
261
148
|
* warnings) are written regardless; `debug` only adds verbose diagnostics.
|
|
262
149
|
* Default: false (or env ACP_DEBUG=1/true). */
|
|
263
150
|
debug?: boolean;
|
|
@@ -277,10 +164,6 @@ export interface AdapterConfig {
|
|
|
277
164
|
* telling the model how to see the full output (bash: read
|
|
278
165
|
* BashToolDetails.fullOutputPath). */
|
|
279
166
|
toolOutputMaxBytes?: number;
|
|
280
|
-
/** Delegate sub-agent config. Accepts a boolean shorthand (`true` →
|
|
281
|
-
* `{ enabled: true }`, `false` → `{ enabled: false }`) or a DelegateConfig
|
|
282
|
-
* object. Default: enabled. */
|
|
283
|
-
delegate?: boolean | DelegateConfig;
|
|
284
167
|
/** Compression tuning. */
|
|
285
168
|
compress?: CompressConfig;
|
|
286
169
|
/** Provider token-throttle (Bedrock "Too many tokens, please wait before
|
|
@@ -322,9 +205,6 @@ export interface AdapterConfig {
|
|
|
322
205
|
* the model-side `acp_rule` tool (#490). Custom limits via
|
|
323
206
|
* coreOverrides.rules ({ maxRules?, maxRuleChars? }). */
|
|
324
207
|
rules?: boolean;
|
|
325
|
-
/** Legacy flat alias for `delegate.displayUsage`. Kept for backward
|
|
326
|
-
* compatibility with existing acp.json files. Prefer `delegate.displayUsage`. */
|
|
327
|
-
displayUsage?: "merged" | "separate";
|
|
328
208
|
/** Override acp-kernel's load-bearing compression prompt rules (the 4
|
|
329
209
|
* Prompts fields). Each set field replaces the kernel default verbatim.
|
|
330
210
|
* Requires acknowledgePromptsRisk: true — without it, overrides are dropped
|
|
@@ -346,18 +226,10 @@ export interface AdapterConfig {
|
|
|
346
226
|
* paramDescriptions, promptSnippet, promptGuidelines). Read synchronously
|
|
347
227
|
* at extension load — tool defs are frozen at registration time. */
|
|
348
228
|
toolPrompts?: ToolPromptsConfig;
|
|
349
|
-
/** Replace (string) or remove (null) the ACP_DELEGATE_NOTIFICATIONS appendix
|
|
350
|
-
* injected when the delegate tool is enabled. */
|
|
351
|
-
delegatePrompt?: string | null;
|
|
352
229
|
coreOverrides?: Partial<Config>;
|
|
353
230
|
}
|
|
354
231
|
export declare const DEFAULT_TOOL_BASH_TIMEOUT = 60;
|
|
355
232
|
export declare const DEFAULT_TOOL_OUTPUT_MAX_BYTES = 50000;
|
|
356
|
-
/** Resolve delegate config from the adapter, handling the boolean shorthand
|
|
357
|
-
* and the legacy flat `displayUsage` alias. Precedence: env > acp.json >
|
|
358
|
-
* default (same convention as ACP_MODEL_CONTEXT_LIMIT). Invalid values fall
|
|
359
|
-
* back to the default with a logged warning — they never fail the session. */
|
|
360
|
-
export declare function resolveDelegate(adapter: AdapterConfig): DelegatePolicy;
|
|
361
233
|
/** Defaults for the generic tool-call repetition guard (issue #308). */
|
|
362
234
|
export declare const REPETITION_GUARD_DEFAULTS: {
|
|
363
235
|
readonly warn: 3;
|