billion-context-pi 0.1.65-pr.360.151 → 0.1.65

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.
@@ -1,7 +1,6 @@
1
1
  import { Type, type Static } from "typebox";
2
2
  import type { ToolDefinition } from "@earendil-works/pi-coding-agent";
3
3
  import type { AcpRuntime } from "./runtime.js";
4
- import { type CoreMessage } from "acp-kernel";
5
4
  declare const RangeSpec: Type.TObject<{
6
5
  startId: Type.TString;
7
6
  endId: Type.TString;
@@ -32,5 +31,4 @@ export declare function isCompressSuccessText(text: string): boolean;
32
31
  * range skipped). Counted as a FAILED attempt by noteCompressOutcomes so
33
32
  * the retry cap applies. Non-panels ("No ranges provided.") stay neutral. */
34
33
  export declare function isCompressNoopText(text: string): boolean;
35
- export declare function firstFoldStartTokens(messages: CoreMessage[], coveredIds: Set<string>, imageTokensById: Map<string, number>, foldedIds: Set<string>): number | null;
36
34
  export {};
package/dist/config.d.ts CHANGED
@@ -106,12 +106,8 @@ export interface CompressSettings {
106
106
  * Default: 0.95. Must be >= maxContextLimit. Maps to kernel
107
107
  * nudge.emergencyThresholdPct + truncate.threshold. */
108
108
  emergencyThresholdPercent?: number | string;
109
- /** Token growth threshold for soft compression nudges. Default: 100000
110
- * (Pi host default — 2× the kernel's 50000, raised per #359 fold-cadence
111
- * economics: each fold pays a one-time non-hit re-pay plus its summary at
112
- * output price, while paying back in only a few turns, so a slower cadence
113
- * is net-positive and halves interruption/output overhead). Maps to kernel
114
- * nudge.growthFloor + nudge.growthCap. */
109
+ /** Token growth threshold for soft compression nudges. Default: 50000.
110
+ * Maps to kernel nudge.growthFloor + nudge.growthCap. */
115
111
  nudgeGrowthTokens?: number;
116
112
  /** Minimum reclaimable tokens for a pressure-band nudge (kernel #198).
117
113
  * Default: max(5000, round(limit×0.01)). Explicit 0 restores the legacy
@@ -281,6 +277,5 @@ export declare function mergeCompress(global?: CompressSettings, provider?: Comp
281
277
  * at any level. The Pi adapter keys providers by name (ctx.model.provider),
282
278
  * not URL — it never sees the upstream URL the way the proxy does. */
283
279
  export declare function resolveCompress(compress: CompressConfig | undefined, provider: string | undefined, modelId: string | undefined): CompressSettings;
284
- export declare const DEFAULT_NUDGE_GROWTH_TOKENS = 100000;
285
280
  export declare function resolveConfig(adapter: AdapterConfig, liveContextLimit: number, provider?: string, modelId?: string): Config;
286
281
  export declare function parsePercent(v: number | string): number;
package/dist/index.js CHANGED
@@ -3939,7 +3939,6 @@ function resolveCompress(compress, provider, modelId) {
3939
3939
  const model = prov && modelId ? prov.models?.[modelId] : void 0;
3940
3940
  return mergeCompress(compress, prov, model);
3941
3941
  }
3942
- var DEFAULT_NUDGE_GROWTH_TOKENS = 1e5;
3943
3942
  function resolveConfig(adapter, liveContextLimit, provider, modelId) {
3944
3943
  const envLimit = process.env.ACP_MODEL_CONTEXT_LIMIT;
3945
3944
  const envLimitNum = envLimit ? Number(envLimit) : NaN;
@@ -3960,9 +3959,6 @@ function resolveConfig(adapter, liveContextLimit, provider, modelId) {
3960
3959
  if (c.nudgeGrowthTokens !== void 0) {
3961
3960
  config.nudge.growthFloor = c.nudgeGrowthTokens;
3962
3961
  config.nudge.growthCap = c.nudgeGrowthTokens;
3963
- } else {
3964
- config.nudge.growthFloor = DEFAULT_NUDGE_GROWTH_TOKENS;
3965
- config.nudge.growthCap = DEFAULT_NUDGE_GROWTH_TOKENS;
3966
3962
  }
3967
3963
  if (c.minPressureBenefitTokens !== void 0) {
3968
3964
  config.nudge.minPressureBenefitTokens = c.minPressureBenefitTokens;
@@ -10003,12 +9999,6 @@ function refIsDead(ref, state, visibleIds) {
10003
9999
  if (visibleIds.has(rawId)) return false;
10004
10000
  return !hasActiveOwner(state, [rawId], visibleIds);
10005
10001
  }
10006
- function firstFoldStartTokens(messages, coveredIds, imageTokensById, foldedIds) {
10007
- const idx = messages.findIndex((m2) => foldedIds.has(m2.id));
10008
- if (idx === -1) return null;
10009
- if (idx === 0) return 0;
10010
- return estimateTokens(messages.slice(0, idx), coveredIds, imageTokensById);
10011
- }
10012
10002
  function compressibleSnapshotText(nudge) {
10013
10003
  const ranges = viableRanges(nudge?.compressibleRanges ?? []);
10014
10004
  if (ranges.length === 0) {
@@ -10162,12 +10152,6 @@ async function handleCompress(args, runtime, ctx, toolCallId) {
10162
10152
  const afterTokens = estimateTokens(afterTurn.messages, collectCoveredMessageIds(applied.state), imageTokens);
10163
10153
  const reclaimed = Math.max(0, beforeTokens - afterTokens);
10164
10154
  const newBlocks = applied.state.blocks.slice(-blocksCreated);
10165
- const foldedIds = /* @__PURE__ */ new Set();
10166
- for (const b2 of newBlocks) {
10167
- for (const id of b2.effectiveMessageIds) foldedIds.add(id);
10168
- for (const childId of b2.directBlockIds) foldedIds.add(`acp_summary_${childId}`);
10169
- }
10170
- const foldStartTokens = blocksCreated > 0 && beforeTokens > 0 ? firstFoldStartTokens(messages, collectCoveredMessageIds(state), imageTokens, foldedIds) : null;
10171
10155
  debug.event("compress-out", {
10172
10156
  sid: ctx.sessionManager.getSessionId(),
10173
10157
  blocksCreated,
@@ -10191,11 +10175,7 @@ async function handleCompress(args, runtime, ctx, toolCallId) {
10191
10175
  afterTokens,
10192
10176
  warnings: warnings.length,
10193
10177
  errors: errors.length,
10194
- newBlockIds: newBlocks.map((b2) => b2.blockId),
10195
- ...blocksCreated > 0 && beforeTokens > 0 ? {
10196
- ...foldStartTokens !== null ? { firstFoldStartPct: Number((foldStartTokens / beforeTokens).toFixed(3)) } : {},
10197
- retainedPctUpperBound: Number((afterTokens / beforeTokens).toFixed(3))
10198
- } : {}
10178
+ newBlockIds: newBlocks.map((b2) => b2.blockId)
10199
10179
  });
10200
10180
  if (errors.length > 0) {
10201
10181
  logError("compress", { sid: ctx.sessionManager.getSessionId(), event: "errors", count: errors.length, errors: errors.slice(0, 5) });