billion-context-pi 0.1.36 → 0.1.37
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 +12 -2
- package/README.zh-CN.md +12 -2
- package/dist/config.d.ts +10 -1
- package/dist/delegate-tool.d.ts +5 -0
- package/dist/index.js +451 -128
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.ts +3 -1
- package/dist/sequence-match.d.ts +6 -0
- package/dist/system-prompt.d.ts +2 -1
- package/dist/user-config.d.ts +3 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -151,7 +151,15 @@ Create `~/.pi/acp.json` (global) and/or `<project>/.pi/acp.json` (project-local,
|
|
|
151
151
|
"toolOutputMaxBytes": 200000,
|
|
152
152
|
"maxContextLimit": "75%",
|
|
153
153
|
"emergencyThresholdPercent": "95%",
|
|
154
|
-
"nudgeGrowthTokens": 50000
|
|
154
|
+
"nudgeGrowthTokens": 50000,
|
|
155
|
+
|
|
156
|
+
"prompts": {
|
|
157
|
+
"compressPhilosophy": "Override the compression philosophy...",
|
|
158
|
+
"howToCompressRules": "Override tier-1 rules...",
|
|
159
|
+
"tier2DistillRules": "Override tier-2 distillation rules...",
|
|
160
|
+
"tier3CondenseRules": "Override tier-3 condensation rules..."
|
|
161
|
+
},
|
|
162
|
+
"acknowledgePromptsRisk": true
|
|
155
163
|
}
|
|
156
164
|
```
|
|
157
165
|
|
|
@@ -166,8 +174,10 @@ Create `~/.pi/acp.json` (global) and/or `<project>/.pi/acp.json` (project-local,
|
|
|
166
174
|
| `maxContextLimit` | `"75%"` | Context usage threshold that triggers **forced compression** nudges (bypasses growth-gate + cadence). Accepts a ratio (`0.75`) or percent string (`"75%"`). Lower = compress earlier / more aggressively. Maps to kernel `nudge.maxContextLimitPct`. |
|
|
167
175
|
| `emergencyThresholdPercent` | `"95%"` | Context usage threshold that triggers **emergency truncation** of large tool outputs to keep the session alive. Accepts a ratio (`0.95`) or percent string (`"95%"`). Must be ≥ `maxContextLimit`. Maps to kernel `nudge.emergencyThresholdPct` + `truncate.threshold`. |
|
|
168
176
|
| `nudgeGrowthTokens` | `50000` | Token growth step for soft compression nudges. A nudge fires roughly every time this many tokens become compressible. Lower = compress more often; higher = compress less often. Maps to kernel `nudge.growthFloor` + `nudge.growthCap`. |
|
|
177
|
+
| `prompts` | *(kernel defaults)* | Override acp-kernel's 4 load-bearing compression prompt rules (`compressPhilosophy`, `howToCompressRules`, `tier2DistillRules`, `tier3CondenseRules`). Each set field replaces the default verbatim; omitted fields are inherited. Non-string values are dropped. Requires `acknowledgePromptsRisk: true` — otherwise overrides are ignored and defaults are used. |
|
|
178
|
+
| `acknowledgePromptsRisk` | `false` | Safety gate for `prompts` overrides. Set `true` to acknowledge that replacing the tuned compression rules may reduce summary quality (lost paths/signatures/decisions → worse retrieval) and to make overrides take effect. |
|
|
169
179
|
|
|
170
|
-
> **Only these
|
|
180
|
+
> **Only these eleven keys are read from `acp.json`.** Other tuning knobs (`preserveRecentMessages`, `protectedTools`) are code-level and not user-overridable. The three nudge thresholds (`maxContextLimit`, `emergencyThresholdPercent`, `nudgeGrowthTokens`) form a three-tier escalation: growth-driven soft nudges → forced nudges at `maxContextLimit` → emergency truncation at `emergencyThresholdPercent`.
|
|
171
181
|
|
|
172
182
|
### Environment variables
|
|
173
183
|
|
package/README.zh-CN.md
CHANGED
|
@@ -150,7 +150,15 @@ billion-context-pi 开箱即用,无需任何配置。可以在 JSON 配置文件
|
|
|
150
150
|
"toolOutputMaxBytes": 200000,
|
|
151
151
|
"maxContextLimit": "75%",
|
|
152
152
|
"emergencyThresholdPercent": "95%",
|
|
153
|
-
"nudgeGrowthTokens": 50000
|
|
153
|
+
"nudgeGrowthTokens": 50000,
|
|
154
|
+
|
|
155
|
+
"prompts": {
|
|
156
|
+
"compressPhilosophy": "覆盖压缩理念……",
|
|
157
|
+
"howToCompressRules": "覆盖 tier-1 规则……",
|
|
158
|
+
"tier2DistillRules": "覆盖 tier-2 蒸馏规则……",
|
|
159
|
+
"tier3CondenseRules": "覆盖 tier-3 浓缩规则……"
|
|
160
|
+
},
|
|
161
|
+
"acknowledgePromptsRisk": true
|
|
154
162
|
}
|
|
155
163
|
```
|
|
156
164
|
|
|
@@ -165,8 +173,10 @@ billion-context-pi 开箱即用,无需任何配置。可以在 JSON 配置文件
|
|
|
165
173
|
| `maxContextLimit` | `"75%"` | 上下文使用率达到此值时触发**强制压缩** nudge(绕过增长门控 + 频率限制)。支持比例(`0.75`)或百分比字符串(`"75%"`)。调小 → 更早/更激进压缩。映射到内核 `nudge.maxContextLimitPct`。 |
|
|
166
174
|
| `emergencyThresholdPercent` | `"95%"` | 上下文使用率达到此值时触发**紧急截断**,硬截断大块工具输出以保住会话。支持比例(`0.95`)或百分比字符串(`"95%"`)。必须 ≥ `maxContextLimit`。映射到内核 `nudge.emergencyThresholdPct` + `truncate.threshold`。 |
|
|
167
175
|
| `nudgeGrowthTokens` | `50000` | 软压缩 nudge 的增长步长(token)。大约每积累这么多可压缩 token 就触发一次 nudge。调小 → 压得更频繁;调大 → 压得更少。映射到内核 `nudge.growthFloor` + `nudge.growthCap`。 |
|
|
176
|
+
| `prompts` | *(内核默认)* | 覆盖 acp-kernel 的 4 条承重压缩提示词规则(`compressPhilosophy`、`howToCompressRules`、`tier2DistillRules`、`tier3CondenseRules`)。每个设置的字段逐字替换默认值;省略的字段继承默认。非字符串值被丢弃。需要 `acknowledgePromptsRisk: true`——否则覆盖被忽略,使用默认值。 |
|
|
177
|
+
| `acknowledgePromptsRisk` | `false` | `prompts` 覆盖的安全门禁。设为 `true` 以确认替换调优过的压缩规则可能降低摘要质量(丢失路径/签名/决策 → 检索变差),并使覆盖生效。 |
|
|
168
178
|
|
|
169
|
-
>
|
|
179
|
+
> **只有这十一个 key 会被 `acp.json` 读取。** 其他调优参数(`preserveRecentMessages`、`protectedTools`)是代码级的,不向用户开放。三个 nudge 阈值(`maxContextLimit`、`emergencyThresholdPercent`、`nudgeGrowthTokens`)构成三级触发:增长驱动的软 nudge → `maxContextLimit` 强制 nudge → `emergencyThresholdPercent` 紧急截断。
|
|
170
180
|
|
|
171
181
|
### 环境变量
|
|
172
182
|
|
package/dist/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Config } from "acp-kernel";
|
|
1
|
+
import { type Config, type Prompts } from "acp-kernel";
|
|
2
2
|
/** Delegate sub-agent configuration. */
|
|
3
3
|
export interface DelegateConfig {
|
|
4
4
|
/** Enable acp_delegate tools (delegate/wait/cancel) and their system-prompt
|
|
@@ -72,6 +72,15 @@ export interface AdapterConfig {
|
|
|
72
72
|
/** Legacy flat alias for `delegate.displayUsage`. Kept for backward
|
|
73
73
|
* compatibility with existing acp.json files. Prefer `delegate.displayUsage`. */
|
|
74
74
|
displayUsage?: "merged" | "separate";
|
|
75
|
+
/** Override acp-kernel's load-bearing compression prompt rules (the 4
|
|
76
|
+
* Prompts fields). Each set field replaces the kernel default verbatim.
|
|
77
|
+
* Requires acknowledgePromptsRisk: true — without it, overrides are dropped
|
|
78
|
+
* (defaults used) and a warning is logged. Set via ~/.pi/acp.json. */
|
|
79
|
+
prompts?: Partial<Prompts>;
|
|
80
|
+
/** Must be true for `prompts` overrides to take effect. Acknowledges that
|
|
81
|
+
* replacing the kernel's tuned compression rules may reduce summary quality
|
|
82
|
+
* (lost paths/signatures/decisions → worse retrieval). */
|
|
83
|
+
acknowledgePromptsRisk?: boolean;
|
|
75
84
|
coreOverrides?: Partial<Config>;
|
|
76
85
|
}
|
|
77
86
|
export declare const DEFAULT_TOOL_BASH_TIMEOUT = 60;
|
package/dist/delegate-tool.d.ts
CHANGED
|
@@ -3,6 +3,11 @@ import { Type, type Static } from "typebox";
|
|
|
3
3
|
import type { AgentToolResult, ExtensionAPI, ExtensionContext, ToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
4
4
|
import { type Usage } from "./delegate-events.js";
|
|
5
5
|
export declare function delegateSpawnOptions(cwd: string, env: NodeJS.ProcessEnv): SpawnOptions;
|
|
6
|
+
/** Resolve the pi CLI entry for delegate child processes.
|
|
7
|
+
* argv[1] is only the pi CLI under a CLI host; embedded hosts (e.g. pi-web)
|
|
8
|
+
* run the SDK inside another node process, so probe instead. Non-pi hosts
|
|
9
|
+
* (omp) keep argv[1] untouched. */
|
|
10
|
+
export declare function resolvePiCliEntry(argv1: string, env?: NodeJS.ProcessEnv, piHost?: boolean): string;
|
|
6
11
|
type RunStatus = "running" | "completed" | "failed" | "cancelled";
|
|
7
12
|
interface DelegateRun {
|
|
8
13
|
runId: string;
|