billion-context-pi 0.1.79 → 0.1.80-pr.552.381

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
@@ -241,7 +241,9 @@ billion-context-pi writes a structured, always-on log to `~/.pi/acp.log` (overri
241
241
  - **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
242
  - **Written only when `debug: true`**: verbose `debug`-level diagnostics (full field dumps, per-turn internals).
243
243
 
244
- Each line: `<ISO timestamp> [<level>] [<scope>] key=value key=value`. The file rotates to `~/.pi/acp.log.old` at 10 MB.
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.
245
247
 
246
248
  ```sh
247
249
  tail -f ~/.pi/acp.log # watch the session live
package/README.zh-CN.md CHANGED
@@ -229,8 +229,9 @@ billion-context-pi 会向 `~/.pi/acp.log`(可用 `ACP_LOG_FILE` 覆盖)写入结
229
229
  - `warn` — 值得注意的非致命情况:紧急 nudge 注入、配置加载失败、自动更新网络错误、工具输出被截断、委派结果注入被跳过。
230
230
  - `info` — 生命周期事件:会话启动、每轮上下文变换摘要(消息数/token/压缩比/活跃块数)、压缩/解压、delegate 派发与完成、自动更新检查。
231
231
  - `debug` —— 仅在 `debug: true` 时额外写入(细粒度的字段级事件)。
232
+ - **Nudge 审计轨迹** — 无论何时注入上下文限制 nudge,一条紧凑的单行记录(如 `[ACP nudge] EMERGENCY 95% · T1 · top range m00120–m00168`)会作为*仅供显示*的会话条目写入——它跨进程重启存活,在 TUI 回滚历史和会话文件中可见,且永远不会发给模型。
232
233
 
233
- 每行格式:`<ISO 时间戳> [<级别>] [<范围>] key=value key=value`。文件达到 10 MB 时轮转为 `~/.pi/acp.log.old`。
234
+ 每行格式:`<ISO 时间戳> [<级别>] [<范围>] key=value key=value`。多行字段值(如 `nudge-injected` 中的完整 nudge 正文)会被转义(`\n` → 字面量 `\\n`),保证每条日志恰好占**一行物理行**,便于 `grep`。文件达到 10 MB 时轮转为 `~/.pi/acp.log.old`。
234
235
 
235
236
  ```bash
236
237
  tail -f ~/.pi/acp.log # 实时观察会话
@@ -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.79" : "dev"}`;
10
+ return `billion-context-pi@${true ? "0.1.80" : "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-6YLMDMXH.js.map
18
+ //# sourceMappingURL=chunk-VBRRAGBG.js.map
package/dist/contract.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SIDECAR_SCHEMA_VERSION,
3
3
  sidecarProducer
4
- } from "./chunk-6YLMDMXH.js";
4
+ } from "./chunk-VBRRAGBG.js";
5
5
  export {
6
6
  SIDECAR_SCHEMA_VERSION,
7
7
  sidecarProducer
@@ -1,3 +1,4 @@
1
+ import type { CompressionBlock } from "acp-kernel";
1
2
  type UsageLike = {
2
3
  totalTokens?: number;
3
4
  input?: number;
@@ -22,4 +23,9 @@ type AnchorEntry = {
22
23
  * still reflects the pre-compression request. Failed/no-op compresses don't
23
24
  * count (nothing was reclaimed). */
24
25
  export declare function usageAnchorPredatesCompression(entries: AnchorEntry[]): boolean;
26
+ export interface AnchorStaleness {
27
+ predates: boolean;
28
+ netReclaimed: number;
29
+ }
30
+ export declare function compressionAnchorStaleness(entries: AnchorEntry[], blocks: readonly CompressionBlock[], countTokens: (text: string) => number): AnchorStaleness;
25
31
  export {};
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { ExtensionFactory } from "@earendil-works/pi-coding-agent";
2
+ import type { NudgeDecision } from "acp-kernel";
2
3
  import { type AdapterConfig } from "./config.js";
3
4
  export { createRuntime } from "./runtime.js";
4
5
  export type { AcpRuntime, SessionRef } from "./runtime.js";
@@ -6,3 +7,4 @@ export { deriveChildState } from "./state.js";
6
7
  export declare function createAcpExtension(adapter?: AdapterConfig): ExtensionFactory;
7
8
  declare const _default: ExtensionFactory;
8
9
  export default _default;
10
+ export declare function formatNudgeRecord(nudge: NudgeDecision, emergency: boolean): string;