billion-context-dsh 0.2.21 → 0.2.23
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.en.md +81 -28
- package/README.md +77 -24
- package/dist/block-ledger.d.ts +66 -0
- package/dist/commands.d.ts +2 -1
- package/dist/config.d.ts +1 -1
- package/dist/host-tokens.d.ts +49 -0
- package/dist/index.d.ts +48 -5
- package/dist/index.js +2451 -834
- package/dist/index.js.map +1 -1
- package/dist/lru.d.ts +15 -0
- package/dist/messages.d.ts +100 -0
- package/dist/nudge.d.ts +59 -13
- package/dist/presets.d.ts +61 -0
- package/dist/prompts.d.ts +2 -2
- package/dist/region.d.ts +185 -34
- package/dist/session-events.d.ts +18 -11
- package/dist/settings.d.ts +157 -0
- package/dist/state.d.ts +11 -0
- package/dist/tools.d.ts +113 -2
- package/dist/window.d.ts +32 -3
- package/package.json +25 -17
- package/dist/tool-pairing.d.ts +0 -36
package/dist/index.d.ts
CHANGED
|
@@ -33,16 +33,20 @@ import { AcpStateStore } from './state.ts';
|
|
|
33
33
|
import { type ToolEnvironment } from './tools.ts';
|
|
34
34
|
import { type AcpPrompts, type ResolvedPrompts } from './prompts.ts';
|
|
35
35
|
import { type AcpWindow } from './window.ts';
|
|
36
|
+
import { type SettingsCommandSurface } from './settings.ts';
|
|
37
|
+
import { type PresetName } from './presets.ts';
|
|
36
38
|
export { AcpStateStore } from './state.ts';
|
|
37
39
|
export { kernelConfigFor, type KernelConfigInput } from './config.ts';
|
|
40
|
+
export { PRESETS, PRESET_NAMES, isPresetName, resolvePreset, type NudgePreset, type PresetName, } from './presets.ts';
|
|
38
41
|
export { ACP_SYSTEM_PROMPT, ACP_SYSTEM_PROMPT_ORDER } from './system-prompt.ts';
|
|
39
42
|
export { DEFAULT_PROMPTS, DEFAULT_RESOLVED, renderSystemPrompt, renderTemplate, resolvePrompts, type AcpPrompts, type NudgePrompts, type PromptInput, type PromptOverride, type RangeTablePrompts, type ResolvedPrompts, type ToolPrompts, } from './prompts.ts';
|
|
40
43
|
export { makeTools, type ToolEnvironment } from './tools.ts';
|
|
41
44
|
export { acpCommand } from './commands.ts';
|
|
42
|
-
export { buildNudge, resolveTokenCount, type NudgeEnvironment, type NudgeOutcome } from './nudge.ts';
|
|
45
|
+
export { buildNudge, resolveTokenCount, EMERGENCY_NUDGE_MAX_PER_TURN, type NudgeEnvironment, type NudgeOutcome } from './nudge.ts';
|
|
43
46
|
export { DEFAULT_CONTEXT_WINDOW, detectContextWindow, projectedContextWindow, windowSourceLabel, type AcpWindow, } from './window.ts';
|
|
44
47
|
export { AlreadyCompressedRangeError, rebuildBlockLedger, resolveSurfaceRange, runCompactionTransaction, shadowedSeqsOf, findOpenTurn, assertNoActiveCompaction, blockRegistry, blockRefForSummarySeq, compactionIdsOfKernelBlocks, summarySeqOfKernelBlock, expandShadowedSeqs, hideCompressToolPair, stripOrphanedSurfaceToolMessages, type AcpBlockLedgerEntry, type CompactionTransactionInput, type ResolvedSurfaceRange, } from './region.ts';
|
|
45
48
|
export { eventsToCoreMessages, projectEvent, surfaceEventsOf, extractEventText } from './messages.ts';
|
|
49
|
+
export { ACP_SETTINGS_NAMESPACE, AcpSettingsSchema, describeSettingsChange, filterSettingsEntry, makeSettingsCommandSurface, parseSettingValue, resolveAcpSettings, SETTINGS_KEYS, SETTING_DEFAULTS, type AcpSettings, type AcpSettingsInput, type SettingsChangeEffect, type SettingsCommandSurface, type SettingsKey, } from './settings.ts';
|
|
46
50
|
export interface AcpConfig {
|
|
47
51
|
/**
|
|
48
52
|
* The context window used for pressure decisions, in tokens. When omitted,
|
|
@@ -67,12 +71,26 @@ export interface AcpConfig {
|
|
|
67
71
|
*/
|
|
68
72
|
readonly nudgeMaxContextLimitPct?: number;
|
|
69
73
|
/**
|
|
70
|
-
* Emergency nudge threshold (bypasses the per-turn dedup
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
+
* Emergency nudge threshold (bypasses the per-turn dedup, but is capped at
|
|
75
|
+
* EMERGENCY_NUDGE_MAX_PER_TURN = 3 injections per user turn — issue #108).
|
|
76
|
+
* Engine default 0.85 (down from the kernel/billion-context-pi default 0.95:
|
|
77
|
+
* 95% leaves the model no room to act before the API rejects, and the host's
|
|
78
|
+
* 80% compaction-basic line shadows it in standard/code/cordis modes).
|
|
74
79
|
*/
|
|
75
80
|
readonly nudgeEmergencyThresholdPct?: number;
|
|
81
|
+
/**
|
|
82
|
+
* Named bundle for the three nudge thresholds — how eagerly the model is
|
|
83
|
+
* asked to compress, in one word. One of 'preserve' | 'relaxed' | 'balanced'
|
|
84
|
+
* | 'efficient' | 'aggressive' (see src/presets.ts). It fills ONLY the nudge
|
|
85
|
+
* thresholds you did not set explicitly, so precedence is explicit value >
|
|
86
|
+
* preset > engine default and a partial override on top of a preset still
|
|
87
|
+
* wins. An unknown name fails engine construction (fail-fast). No effect on
|
|
88
|
+
* any other knob (`modelContextLimit`, `autoNudge`, prompts, coreOverrides).
|
|
89
|
+
* An unknown name fails construction, and so does a merged window that ends up
|
|
90
|
+
* inverted (min > max, max > emergency or min > emergency — the kernel itself
|
|
91
|
+
* only warns about that, see `assertNudgeThresholdOrder`).
|
|
92
|
+
*/
|
|
93
|
+
readonly preset?: PresetName;
|
|
76
94
|
/**
|
|
77
95
|
* Any other acp-kernel Config override (billion-context-pi's `coreOverrides`
|
|
78
96
|
* escape hatch). Merge order per section: kernel defaults → the engine pct
|
|
@@ -97,6 +115,13 @@ export interface AcpConfig {
|
|
|
97
115
|
readonly autoCommand: boolean;
|
|
98
116
|
/** Inject the nudge into `agent/pre-step` when the kernel recommends it. Default true. */
|
|
99
117
|
readonly autoNudge: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Escape hatch: disable the runtime-settings integration entirely
|
|
120
|
+
* (composition-layer ONLY — deliberately not exposed through the settings
|
|
121
|
+
* layer itself: a switch that turns off its own plumbing could not be
|
|
122
|
+
* reached if the plumbing broke). Default: enabled.
|
|
123
|
+
*/
|
|
124
|
+
readonly settingsEnabled?: boolean;
|
|
100
125
|
/** Per-stage prompt template overrides (nudge / range table / system prompt / tool descriptions). See docs/configurable-prompts-design.md. */
|
|
101
126
|
readonly prompts?: AcpPrompts;
|
|
102
127
|
}
|
|
@@ -124,10 +149,18 @@ export declare class AcpCompactionEngine extends CompactionEngine {
|
|
|
124
149
|
*/
|
|
125
150
|
readonly env: ToolEnvironment;
|
|
126
151
|
private readonly lastNudgeTurn;
|
|
152
|
+
/** Per-session emergency-nudge injection budget for the current user turn (issue #108). */
|
|
153
|
+
private readonly emergencyNudges;
|
|
127
154
|
/** Successful compress call ids awaiting their tool/result so the pair can be hidden. */
|
|
128
155
|
private readonly compressCallIdsToHide;
|
|
129
156
|
/** Per provider/model route the resolved window (probe failures cached too). */
|
|
130
157
|
private readonly windowCache;
|
|
158
|
+
/** Live settings snapshot thunk (composition → user settings layer); swapped when the settings provider attaches (SettingsProvider.installSection). */
|
|
159
|
+
private readSettingsSource;
|
|
160
|
+
/** The settings service, captured lazily for /acp config (undefined in provider-less processes). */
|
|
161
|
+
private settingsService;
|
|
162
|
+
/** /acp config read/write surface. */
|
|
163
|
+
readonly settingsCommand: SettingsCommandSurface;
|
|
131
164
|
/** Per route the adapter's per-request output cap (the output reservation); null = undisclosed. */
|
|
132
165
|
private readonly outputReservationCache;
|
|
133
166
|
constructor(ctx: Context, config?: Partial<AcpConfig>);
|
|
@@ -151,6 +184,16 @@ export declare class AcpCompactionEngine extends CompactionEngine {
|
|
|
151
184
|
* fallback.
|
|
152
185
|
*/
|
|
153
186
|
windowFor(agent: Agent): Promise<AcpWindow>;
|
|
187
|
+
/**
|
|
188
|
+
* Diff handler for runtime settings changes: drop the window cache when a
|
|
189
|
+
* window-related key changed (probe FAILURES are cached too — clearing is
|
|
190
|
+
* what lets the next pre-step re-probe after a fix), clear the per-turn
|
|
191
|
+
* nudge dedup when nudges come back on, and warn on order anomalies
|
|
192
|
+
* (accepted, never rejected — rejecting a write cannot fix an externally
|
|
193
|
+
* edited settings.yaml, and an invalid stored section would fail the next
|
|
194
|
+
* boot loud anyway).
|
|
195
|
+
*/
|
|
196
|
+
private onSettingsChanged;
|
|
154
197
|
/**
|
|
155
198
|
* The adapter's per-request output cap for a route, from one
|
|
156
199
|
* probeModelWindow call (a local catalog lookup — no request is sent),
|