billion-context-pi 0.1.78-pr.552.374 → 0.1.78

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 CHANGED
@@ -145,12 +145,11 @@ 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`) |
149
148
  | `acp_delegate` | Spawn a clean-context sub-agent for a task (review / research / implement / plan / advise) |
150
149
  | `acp_delegate_wait` | Block until a delegate run finishes (returns its result; times out otherwise) |
151
150
  | `acp_delegate_cancel` | Cancel a running delegate by runId |
152
151
 
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`.
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.
154
153
 
155
154
  ### acp_delegate — clean-context delegation
156
155
 
@@ -168,7 +167,7 @@ Read-only roles (reviewer, researcher, planner, oracle) receive a restricted too
168
167
 
169
168
  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
169
 
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.
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.
172
171
 
173
172
  - **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
173
  - **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).
@@ -241,9 +240,7 @@ billion-context-pi writes a structured, always-on log to `~/.pi/acp.log` (overri
241
240
  - **Always written** (even with `debug: false`): `error`, `warn`, `info` levels — session start, every context turn (token usage / nudge decision), compress/decompress, delegate spawn/done, and **all errors and warnings** (config/state/tool failures, delegate errors, guardrail caps, update failures). Error lines include the message and stack trace.
242
241
  - **Written only when `debug: true`**: verbose `debug`-level diagnostics (full field dumps, per-turn internals).
243
242
 
244
- - **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.
245
-
246
- Each line: `<ISO timestamp> [<level>] [<scope>] key=value key=value`. Multi-line values (e.g. the full nudge text in `nudge-injected`) are escaped (`\n` → literal `\\n`), so every entry occupies exactly **one physical line** and stays self-contained for `grep`. The file rotates to `~/.pi/acp.log.old` at 10 MB.
243
+ Each line: `<ISO timestamp> [<level>] [<scope>] key=value key=value`. The file rotates to `~/.pi/acp.log.old` at 10 MB.
247
244
 
248
245
  ```sh
249
246
  tail -f ~/.pi/acp.log # watch the session live
package/README.zh-CN.md CHANGED
@@ -133,12 +133,11 @@ 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`) |
137
136
  | `acp_delegate` | 为某个任务派生一个干净上下文的子代理(审查 / 调研 / 实现 / 规划 / 建议) |
138
137
  | `acp_delegate_wait` | 阻塞等待委派任务完成(返回结果,否则超时) |
139
138
  | `acp_delegate_cancel` | 按 runId 取消正在运行的委派任务 |
140
139
 
141
- `acp_delegate*` 四个工具是可选的:如果你自带子代理扩展,一个 `acp.json` 键即可关闭 —— 见下文*改用你自己的子代理*。`acp_rule` 同样是可选项 —— 默认关闭,在 `acp.json` 中设置 `"rules": true` 启用。
140
+ `acp_delegate*` 四个工具是可选的:如果你自带子代理扩展,一个 `acp.json` 键即可关闭 —— 见下文*改用你自己的子代理*。
142
141
 
143
142
  ### acp_delegate — 干净上下文委派
144
143
 
@@ -156,7 +155,7 @@ billion-context-pi 面向 **Pi** 编码代理(`@earendil-works/pi-coding-agent`)
156
155
 
157
156
  Worker 运行在 Pi 的完整默认工具集上 - 不应用 `--tools` 白名单,因此任何已加载的扩展或自定义工具(如 ACP、LSP、MCP)保持可用。这确保主任务委派能力完整。上表中的 `read, edit, write, bash` 仅反映核心工具。
158
157
 
159
- 委派的完整结果保存到文件(`$TMPDIR/acp-delegate/<runId>.out`,默认 `/tmp/acp-delegate/<runId>.out`);工具结果和注入通知只携带**任务标题 + 文件路径**(无预览)- 需要细节时用 `read` 读取。这让父上下文保持精简。
158
+ 委派的完整结果保存到文件(`/tmp/acp-delegate/<runId>.out`);工具结果和注入通知只携带**任务标题 + 文件路径**(无预览)- 需要细节时用 `read` 读取。这让父上下文保持精简。
160
159
 
161
160
  - **交互(TUI)与 RPC 模式**:`async:true`(默认)在后台运行子进程;完成时一条简短通知注入到聊天框。
162
161
  - **Print / JSON 模式**(`pi -p`、SDK):`async:true` 自动降级为**同步** — 结果在同一轮作为工具结果返回(父进程一轮后即退出,后台注入会丢失)。
@@ -229,9 +228,8 @@ billion-context-pi 会向 `~/.pi/acp.log`(可用 `ACP_LOG_FILE` 覆盖)写入结
229
228
  - `warn` — 值得注意的非致命情况:紧急 nudge 注入、配置加载失败、自动更新网络错误、工具输出被截断、委派结果注入被跳过。
230
229
  - `info` — 生命周期事件:会话启动、每轮上下文变换摘要(消息数/token/压缩比/活跃块数)、压缩/解压、delegate 派发与完成、自动更新检查。
231
230
  - `debug` —— 仅在 `debug: true` 时额外写入(细粒度的字段级事件)。
232
- - **Nudge 审计轨迹** — 无论何时注入上下文限制 nudge,一条紧凑的单行记录(如 `[ACP nudge] EMERGENCY 95% · T1 · top range m00120–m00168`)会作为*仅供显示*的会话条目写入——它跨进程重启存活,在 TUI 回滚历史和会话文件中可见,且永远不会发给模型。
233
231
 
234
- 每行格式:`<ISO 时间戳> [<级别>] [<范围>] key=value key=value`。多行字段值(如 `nudge-injected` 中的完整 nudge 正文)会被转义(`\n` → 字面量 `\\n`),保证每条日志恰好占**一行物理行**,便于 `grep`。文件达到 10 MB 时轮转为 `~/.pi/acp.log.old`。
232
+ 每行格式:`<ISO 时间戳> [<级别>] [<范围>] key=value key=value`。文件达到 10 MB 时轮转为 `~/.pi/acp.log.old`。
235
233
 
236
234
  ```bash
237
235
  tail -f ~/.pi/acp.log # 实时观察会话
package/dist/config.d.ts CHANGED
@@ -317,8 +317,8 @@ export interface AdapterConfig {
317
317
  * delimit real turns. See docs/host-adapter.md. */
318
318
  hostSession?: boolean | HostSessionConfig;
319
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
320
+ * Gates the human `/acp-rule` command (list + record — kernel
321
+ * `listRules`/`addRule` against the session `.acp.json` sidecar state) and
322
322
  * the model-side `acp_rule` tool (#490). Custom limits via
323
323
  * coreOverrides.rules ({ maxRules?, maxRuleChars? }). */
324
324
  rules?: boolean;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import type { ExtensionFactory } from "@earendil-works/pi-coding-agent";
2
- import type { NudgeDecision } from "acp-kernel";
3
2
  import { type AdapterConfig } from "./config.js";
4
3
  export { createRuntime } from "./runtime.js";
5
4
  export type { AcpRuntime, SessionRef } from "./runtime.js";
@@ -7,4 +6,3 @@ export { deriveChildState } from "./state.js";
7
6
  export declare function createAcpExtension(adapter?: AdapterConfig): ExtensionFactory;
8
7
  declare const _default: ExtensionFactory;
9
8
  export default _default;
10
- export declare function formatNudgeRecord(nudge: NudgeDecision, emergency: boolean): string;