billion-context-pi 0.1.82 → 0.1.83

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.82" : "dev"}`;
10
+ return `billion-context-pi@${true ? "0.1.83" : "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-AKZJYVLH.js.map
18
+ //# sourceMappingURL=chunk-LLFL3CNI.js.map
@@ -1 +1,32 @@
1
+ export type HostConfigSurface = {
2
+ CONFIG_DIR_NAME?: unknown;
3
+ getAgentDir?: unknown;
4
+ };
5
+ /** Pi's name — the fallback, and what releases before fork-host resolution used on every host. */
6
+ export declare const PI_CONFIG_DIR_NAME = ".pi";
7
+ /**
8
+ * Config directory name, resolved from the host package the extension runs under.
9
+ *
10
+ * Every path in this adapter is `<home|cwd>/<name>/…`, with the agent dir at
11
+ * `~/<name>/agent` — Pi's layout, where CONFIG_DIR_NAME is ".pi". Resolution order:
12
+ * 1. the host's CONFIG_DIR_NAME, if it is a single directory name (Pi);
13
+ * 2. the parent of the host's getAgentDir(), if that is `~/<name>/agent` — Pi forks
14
+ * that do not re-export CONFIG_DIR_NAME, or export it with other semantics (Prime:
15
+ * CONFIG_DIR_NAME ".prime/agent", getAgentDir() ~/.prime/agent → ".prime");
16
+ * 3. ".pi".
17
+ * The namespace import is deliberate: a missing named export fails at link time
18
+ * under plain Node ESM→CJS interop and as `undefined` under loader aliasing (#364).
19
+ * It is the ONLY value import from the pi package. See docs/host-adapter.md §4.
20
+ */
21
+ export declare function resolveConfigDirName(host: HostConfigSurface, home: string): string;
1
22
  export declare const CONFIG_DIR_NAME: string;
23
+ /**
24
+ * `<root>/<name>/<segments>` for a user-authored file (acp.json, prompt packs). When
25
+ * `name` is not ".pi", an existing `<root>/.pi/<segments>` is still used while the
26
+ * host's own path does not exist: earlier releases read ".pi" on every host, and Prime
27
+ * users were told to put acp.json there (#467).
28
+ */
29
+ export declare function userConfigPathIn(name: string, root: string, ...segments: string[]): string;
30
+ export declare function userConfigPath(root: string, ...segments: string[]): string;
31
+ /** Global then project acp.json; later entries override earlier ones. */
32
+ export declare function acpJsonFiles(cwd: string): string[];
package/dist/config.d.ts CHANGED
@@ -378,9 +378,19 @@ export interface HostSessionConfig {
378
378
  /** Count host-injected custom_message entries (agent_message) as turn
379
379
  * boundaries. Default: false (pi-native behavior). */
380
380
  countCustomMessages?: boolean;
381
+ /** #578: optional customType allowlist refining countCustomMessages — when
382
+ * set (with countCustomMessages:true), only injected entries whose
383
+ * customType is listed start a turn, keeping metadata injections
384
+ * (harness_digest, ipython_state) out of nudge/retry accounting. Ignored
385
+ * unless countCustomMessages:true; malformed values warn and fall back to
386
+ * "all injected types count". */
387
+ customMessageTypes?: string[];
381
388
  }
382
389
  export interface ResolvedHostSession {
383
390
  countCustomMessages: boolean;
391
+ /** Present only when countCustomMessages is on and a valid allowlist was
392
+ * configured (#578). */
393
+ customMessageTypes?: readonly string[];
384
394
  }
385
395
  /** Resolve the host-session turn-boundary policy from the adapter, handling
386
396
  * the boolean shorthand (`true` enables countCustomMessages). Invalid values
package/dist/contract.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SIDECAR_SCHEMA_VERSION,
3
3
  sidecarProducer
4
- } from "./chunk-AKZJYVLH.js";
4
+ } from "./chunk-LLFL3CNI.js";
5
5
  export {
6
6
  SIDECAR_SCHEMA_VERSION,
7
7
  sidecarProducer
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;