billion-context-pi 0.1.77 → 0.1.78-pr.232.364
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 +4 -3
- package/README.zh-CN.md +4 -3
- package/dist/{chunk-BKSJVDJY.js → chunk-TNMZCJIL.js} +2 -2
- package/dist/compress-tool.d.ts +1 -0
- package/dist/config-dir.d.ts +11 -0
- package/dist/config.d.ts +31 -1
- package/dist/contract.js +1 -1
- package/dist/index.js +1004 -353
- package/dist/index.js.map +1 -1
- package/dist/messages.d.ts +7 -1
- package/dist/rule-tool.d.ts +8 -0
- package/dist/runtime.d.ts +7 -6
- package/dist/session-log.d.ts +12 -0
- package/dist/user-config.d.ts +29 -5
- package/package.json +2 -2
- /package/dist/{chunk-BKSJVDJY.js.map → chunk-TNMZCJIL.js.map} +0 -0
package/README.md
CHANGED
|
@@ -145,11 +145,12 @@ billion-context-pi is built for the **Pi** coding agent (`@earendil-works/pi-cod
|
|
|
145
145
|
| `search_context` | Search compressed block summaries (and visible messages) by keyword |
|
|
146
146
|
| `acp_status` | Show context usage, compressed blocks, compressible ranges |
|
|
147
147
|
| `acp_cache` | Prompt-cache reconciliation: grand ledger (input/cached/hit rate), per-request miss attribution, per-fold economics |
|
|
148
|
+
| `acp_rule` | Record a short, principle-level reminder that survives compression (opt-in: `"rules": true`) |
|
|
148
149
|
| `acp_delegate` | Spawn a clean-context sub-agent for a task (review / research / implement / plan / advise) |
|
|
149
150
|
| `acp_delegate_wait` | Block until a delegate run finishes (returns its result; times out otherwise) |
|
|
150
151
|
| `acp_delegate_cancel` | Cancel a running delegate by runId |
|
|
151
152
|
|
|
152
|
-
The four `acp_delegate*` tools are optional: if you bring your own sub-agent extension, disable them with one `acp.json` key — see *Using your own sub-agent instead* below.
|
|
153
|
+
The four `acp_delegate*` tools are optional: if you bring your own sub-agent extension, disable them with one `acp.json` key — see *Using your own sub-agent instead* below. `acp_rule` is likewise opt-in — off by default, enable it with `"rules": true`.
|
|
153
154
|
|
|
154
155
|
### acp_delegate — clean-context delegation
|
|
155
156
|
|
|
@@ -167,7 +168,7 @@ Read-only roles (reviewer, researcher, planner, oracle) receive a restricted too
|
|
|
167
168
|
|
|
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.
|
|
169
170
|
|
|
170
|
-
The full delegate result is saved to a file (`/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.
|
|
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.
|
|
171
172
|
|
|
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.
|
|
173
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).
|
|
@@ -231,7 +232,7 @@ It discovers the agents and their tool baselines from the installed pi-subagents
|
|
|
231
232
|
|
|
232
233
|
billion-context-pi works out of the box with no configuration — it reads your model's context window automatically and applies sensible defaults.
|
|
233
234
|
|
|
234
|
-
Behavior is tuned via an optional `acp.json` config file (`~/.pi/acp.json` for global defaults, `<project>/.pi/acp.json` for per-project overrides) plus a few environment variables. For the complete reference — every key, type, default, and the precedence order — see **[CONFIGURATION.md](./CONFIGURATION.md)** ([中文](./CONFIGURATION.zh-CN.md)).
|
|
235
|
+
Behavior is tuned via an optional `acp.json` config file (`~/.pi/agent/acp.json` for global defaults, `<project>/.pi/agent/acp.json` for per-project overrides) plus a few environment variables. The legacy locations (`~/.pi/acp.json`, `<project>/.pi/acp.json`) are still read for backward compatibility when the new one is absent. For the complete reference — every key, type, default, and the precedence order — see **[CONFIGURATION.md](./CONFIGURATION.md)** ([中文](./CONFIGURATION.zh-CN.md)).
|
|
235
236
|
|
|
236
237
|
### Logging
|
|
237
238
|
|
package/README.zh-CN.md
CHANGED
|
@@ -133,11 +133,12 @@ billion-context-pi 面向 **Pi** 编码代理(`@earendil-works/pi-coding-agent`)
|
|
|
133
133
|
| `decompress` | 恢复之前压缩的块内容 |
|
|
134
134
|
| `search_context` | 按关键词搜索已压缩块摘要(及可见消息) |
|
|
135
135
|
| `acp_status` | 显示上下文用量、已压缩块、可压缩范围 |
|
|
136
|
+
| `acp_rule` | 记录一条简短、原则性的提醒,穿越压缩保留(可选:`"rules": true`) |
|
|
136
137
|
| `acp_delegate` | 为某个任务派生一个干净上下文的子代理(审查 / 调研 / 实现 / 规划 / 建议) |
|
|
137
138
|
| `acp_delegate_wait` | 阻塞等待委派任务完成(返回结果,否则超时) |
|
|
138
139
|
| `acp_delegate_cancel` | 按 runId 取消正在运行的委派任务 |
|
|
139
140
|
|
|
140
|
-
`acp_delegate*` 四个工具是可选的:如果你自带子代理扩展,一个 `acp.json` 键即可关闭 ——
|
|
141
|
+
`acp_delegate*` 四个工具是可选的:如果你自带子代理扩展,一个 `acp.json` 键即可关闭 —— 见下文*改用你自己的子代理*。`acp_rule` 同样是可选项 —— 默认关闭,在 `acp.json` 中设置 `"rules": true` 启用。
|
|
141
142
|
|
|
142
143
|
### acp_delegate — 干净上下文委派
|
|
143
144
|
|
|
@@ -155,7 +156,7 @@ billion-context-pi 面向 **Pi** 编码代理(`@earendil-works/pi-coding-agent`)
|
|
|
155
156
|
|
|
156
157
|
Worker 运行在 Pi 的完整默认工具集上 - 不应用 `--tools` 白名单,因此任何已加载的扩展或自定义工具(如 ACP、LSP、MCP)保持可用。这确保主任务委派能力完整。上表中的 `read, edit, write, bash` 仅反映核心工具。
|
|
157
158
|
|
|
158
|
-
委派的完整结果保存到文件(`/tmp/acp-delegate/<runId>.out`);工具结果和注入通知只携带**任务标题 + 文件路径**(无预览)- 需要细节时用 `read` 读取。这让父上下文保持精简。
|
|
159
|
+
委派的完整结果保存到文件(`$TMPDIR/acp-delegate/<runId>.out`,默认 `/tmp/acp-delegate/<runId>.out`);工具结果和注入通知只携带**任务标题 + 文件路径**(无预览)- 需要细节时用 `read` 读取。这让父上下文保持精简。
|
|
159
160
|
|
|
160
161
|
- **交互(TUI)与 RPC 模式**:`async:true`(默认)在后台运行子进程;完成时一条简短通知注入到聊天框。
|
|
161
162
|
- **Print / JSON 模式**(`pi -p`、SDK):`async:true` 自动降级为**同步** — 结果在同一轮作为工具结果返回(父进程一轮后即退出,后台注入会丢失)。
|
|
@@ -218,7 +219,7 @@ billion-context-pi 自带的 `acp_delegate` 工具可独立工作。如果你另
|
|
|
218
219
|
|
|
219
220
|
billion-context-pi 开箱即用,无需任何配置——它会自动读取模型的上下文窗口并应用合理的默认值。
|
|
220
221
|
|
|
221
|
-
行为通过可选的 `acp.json` 配置文件(`~/.pi/acp.json` 为全局默认,`<项目>/.pi/acp.json` 为项目级覆盖)
|
|
222
|
+
行为通过可选的 `acp.json` 配置文件(`~/.pi/agent/acp.json` 为全局默认,`<项目>/.pi/agent/acp.json` 为项目级覆盖)以及若干环境变量来调优。旧位置(`~/.pi/acp.json`、`<项目>/.pi/acp.json`)在新位置不存在时仍会被读取(向后兼容)。完整参考——每个 key、类型、默认值与优先级顺序——请查阅 **[CONFIGURATION.zh-CN.md](./CONFIGURATION.zh-CN.md)** ([English](./CONFIGURATION.md))。
|
|
222
223
|
|
|
223
224
|
### 日志
|
|
224
225
|
|
|
@@ -7,7 +7,7 @@ var __export = (target, all) => {
|
|
|
7
7
|
// src/contract.ts
|
|
8
8
|
var SIDECAR_SCHEMA_VERSION = 1;
|
|
9
9
|
function sidecarProducer() {
|
|
10
|
-
return `billion-context-pi@${true ? "0.1.
|
|
10
|
+
return `billion-context-pi@${true ? "0.1.78" : "dev"}`;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export {
|
|
@@ -15,4 +15,4 @@ export {
|
|
|
15
15
|
SIDECAR_SCHEMA_VERSION,
|
|
16
16
|
sidecarProducer
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
18
|
+
//# sourceMappingURL=chunk-TNMZCJIL.js.map
|
package/dist/compress-tool.d.ts
CHANGED
|
@@ -39,5 +39,6 @@ export declare function isCompressSuccessText(text: string): boolean;
|
|
|
39
39
|
* the retry cap applies. Non-panels ("No ranges provided.") stay neutral. */
|
|
40
40
|
export declare function isCompressNoopText(text: string): boolean;
|
|
41
41
|
export declare function blockSpanLabel(block: CompressionBlock, state: CompressionState): string;
|
|
42
|
+
export declare function summaryFingerprintLine(blockId: string, summary: string): string;
|
|
42
43
|
export declare function tierReadyHint(state: CompressionState, config: ReturnType<AcpRuntime["configFor"]>): string;
|
|
43
44
|
export {};
|
package/dist/config-dir.d.ts
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
1
|
export declare const CONFIG_DIR_NAME: string;
|
|
2
|
+
/**
|
|
3
|
+
* Agent dir (e.g. ~/.pi/agent) with a host feature-detection fallback.
|
|
4
|
+
*
|
|
5
|
+
* Pi's getAgentDir() honors the host's agent-dir env override (<APP>_CODING_AGENT_DIR)
|
|
6
|
+
* and defaults to <home>/<CONFIG_DIR_NAME>/agent. Aliased hosts that do not re-export
|
|
7
|
+
* it would break a static named import exactly like the missing CONFIG_DIR_NAME did in
|
|
8
|
+
* #364, so we feature-detect through the same namespace import and fall back to Pi's
|
|
9
|
+
* default path shape. On such hosts the env override does not apply to this path
|
|
10
|
+
* (documented limitation; all real hosts running pi's code export it).
|
|
11
|
+
*/
|
|
12
|
+
export declare function getAgentDir(): string;
|
package/dist/config.d.ts
CHANGED
|
@@ -228,6 +228,29 @@ export interface AdapterConfig {
|
|
|
228
228
|
* none. Intended for cumulative-snapshot tools where each call supersedes
|
|
229
229
|
* the last. Settable via acp.json since #499. */
|
|
230
230
|
protectedLatestTools?: string[];
|
|
231
|
+
/** Tool-name patterns (glob suffix allowed) EXCLUDED from the soft-protected
|
|
232
|
+
* recent zone: matching tool results inside the recent window fold
|
|
233
|
+
* immediately instead of aging out first (kernel >= 0.0.92). Default:
|
|
234
|
+
* unset → kernel built-in ["decompress", "search_context", "read",
|
|
235
|
+
* "bash"]. The built-in keeps read/bash compressible — the largest
|
|
236
|
+
* reclaimable mass — but that also folds freshly-read files in batch-read
|
|
237
|
+
* workflows (#1198-style fold→re-read loop, bili #1277). Recommended
|
|
238
|
+
* remedy: ["decompress", "search_context", "bash"] (remove only read).
|
|
239
|
+
* ⚠ Unlike the two protection keys, an EMPTY ARRAY IS VALID — it excludes
|
|
240
|
+
* nothing and gives every tool recent-zone protection (escape hatch); do
|
|
241
|
+
* not re-include decompress/search_context or just-restored blocks get
|
|
242
|
+
* pinned in the recent zone and become unreclaimable. */
|
|
243
|
+
neverPreserveRecentTools?: string[];
|
|
244
|
+
/** The positive counterpart of neverPreserveRecentTools: tool-name
|
|
245
|
+
* patterns REMOVED from the effective recent-zone exclusion list (kernel
|
|
246
|
+
* >= 0.0.93) — `(neverPreserveRecentTools ?? built-in) minus
|
|
247
|
+
* preserveRecentTools`. The one-entry #1198/#1277 batch-read fold→re-read
|
|
248
|
+
* remedy: ["read"] protects fresh read results without restating (or
|
|
249
|
+
* freezing a stale copy of) the built-in list. Default: unset → no
|
|
250
|
+
* subtraction. Unlike neverPreserveRecentTools an EMPTY ARRAY IS
|
|
251
|
+
* INVALID here (pure no-op — use neverPreserveRecentTools: [] for
|
|
252
|
+
* protect-everything instead). */
|
|
253
|
+
preserveRecentTools?: string[];
|
|
231
254
|
preserveRecentMessages?: number;
|
|
232
255
|
/** Check npm for a newer billion-context-pi on startup and auto-install it. Default: true.
|
|
233
256
|
* Disable via `autoUpdate: false` or env `ACP_AUTO_UPDATE=0` to avoid all
|
|
@@ -293,13 +316,20 @@ export interface AdapterConfig {
|
|
|
293
316
|
* multi-session hosts (Prime RLM & co.) whose injected agent messages must
|
|
294
317
|
* delimit real turns. See docs/host-adapter.md. */
|
|
295
318
|
hostSession?: boolean | HostSessionConfig;
|
|
319
|
+
/** Persistent-rules feature gate (#526): opt-in `rules: true` in acp.json.
|
|
320
|
+
* Gates the human `/acp-rule` command (list + record + remove + clear — kernel
|
|
321
|
+
* `listRules`/`addRule`/`removeRule`/`clearRules` against the session `.acp.json` sidecar state) and
|
|
322
|
+
* the model-side `acp_rule` tool (#490). Custom limits via
|
|
323
|
+
* coreOverrides.rules ({ maxRules?, maxRuleChars? }). */
|
|
324
|
+
rules?: boolean;
|
|
296
325
|
/** Legacy flat alias for `delegate.displayUsage`. Kept for backward
|
|
297
326
|
* compatibility with existing acp.json files. Prefer `delegate.displayUsage`. */
|
|
298
327
|
displayUsage?: "merged" | "separate";
|
|
299
328
|
/** Override acp-kernel's load-bearing compression prompt rules (the 4
|
|
300
329
|
* Prompts fields). Each set field replaces the kernel default verbatim.
|
|
301
330
|
* Requires acknowledgePromptsRisk: true — without it, overrides are dropped
|
|
302
|
-
* (defaults used) and a warning is logged. Set via
|
|
331
|
+
* (defaults used) and a warning is logged. Set via acp.json (see
|
|
332
|
+
* CONFIGURATION.md for locations). */
|
|
303
333
|
prompts?: Partial<Prompts>;
|
|
304
334
|
/** Must be true for `prompts` overrides to take effect. Acknowledges that
|
|
305
335
|
* replacing the kernel's tuned compression rules may reduce summary quality
|