billion-context-dsh 0.2.23 → 0.2.25
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 +25 -25
- package/README.md +25 -25
- package/cordis.patch.yml +1 -1
- package/dist/commands.d.ts +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +71 -34
- package/dist/index.js.map +1 -1
- package/dist/messages.d.ts +17 -2
- package/dist/nudge.d.ts +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/region.d.ts +10 -9
- package/dist/settings.d.ts +5 -5
- package/dist/tools.d.ts +25 -3
- package/dist/window.d.ts +2 -2
- package/package.json +1 -1
package/dist/messages.d.ts
CHANGED
|
@@ -25,8 +25,8 @@ import type { Session, SessionEvent } from '@deepseek-ai/dsh-session';
|
|
|
25
25
|
* one-line placeholder instead of vanishing (issue #117). An `image`/`file`
|
|
26
26
|
* block used to contribute nothing, which silently made a picture-only user
|
|
27
27
|
* message — or a tool result carrying a screenshot — invisible to the engine:
|
|
28
|
-
* no ref (so no compress boundary), `
|
|
29
|
-
* shrank past it and swallowed neighbours), invisible to the kernel's
|
|
28
|
+
* no ref (so no compress boundary), `anchorsRangeEdge` false (so the range
|
|
29
|
+
* solver shrank past it and swallowed neighbours), invisible to the kernel's
|
|
30
30
|
* recent/last-user protection (so the last real user turn could be compressed
|
|
31
31
|
* away), priced at zero tokens, and absent from search/decompress output. The
|
|
32
32
|
* host itself projects non-text references to deterministic handle text for
|
|
@@ -36,6 +36,20 @@ import type { Session, SessionEvent } from '@deepseek-ai/dsh-session';
|
|
|
36
36
|
* across turns (cache prefix, summary text, search hits).
|
|
37
37
|
*/
|
|
38
38
|
export declare function extractText(content: unknown): string;
|
|
39
|
+
interface ToolCallBlock {
|
|
40
|
+
type: 'tool-call';
|
|
41
|
+
id?: string;
|
|
42
|
+
name?: string;
|
|
43
|
+
arguments?: unknown;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The tool-call blocks of one assistant content array, in CONTENT order.
|
|
47
|
+
* Shared with the range-edge layer (src/region.ts `anchorsRangeEdge`,
|
|
48
|
+
* src/tools.ts `edgeRefForSeq`): projection order IS this order (projectEvent
|
|
49
|
+
* maps the calls in sequence), so "the node's first/last sub-message id" is
|
|
50
|
+
* derivable from it without re-implementing the filter anywhere else.
|
|
51
|
+
*/
|
|
52
|
+
export declare function toolCallsOf(content: unknown): ToolCallBlock[];
|
|
39
53
|
/**
|
|
40
54
|
* The tool-call id of one tool/result surface message, or null.
|
|
41
55
|
*
|
|
@@ -165,3 +179,4 @@ export declare function classifySurfaceEvent(event: SessionEvent): SurfaceEventC
|
|
|
165
179
|
* message was left compressible while synthetic output sat safe.
|
|
166
180
|
*/
|
|
167
181
|
export declare function isRealUserTurn(event: SessionEvent): boolean;
|
|
182
|
+
export {};
|
package/dist/nudge.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ export declare function rangeTable(session: import('@deepseek-ai/dsh-session').S
|
|
|
70
70
|
* source marker). We instead count active-block summaries directly from kernel
|
|
71
71
|
* state (same source `buildStatusReport` uses), and the caller must exclude
|
|
72
72
|
* checkpoint summary nodes from `messages` (they are not in any block's
|
|
73
|
-
* `effectiveMessageIds` and would double-count — mirror of `/acp` status's
|
|
73
|
+
* `effectiveMessageIds` and would double-count — mirror of `/acp-prune` status's
|
|
74
74
|
* `isCheckpointNode` exclusion).
|
|
75
75
|
*/
|
|
76
76
|
export declare function computeSurfaceBreakdown(state: CompressionState, messages: readonly CoreMessage[], total: number, growth: number): ContextBreakdown;
|
package/dist/presets.d.ts
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*
|
|
19
19
|
* Presets are set at composition time (`config: { preset: 'efficient' }`).
|
|
20
20
|
* Runtime hot-reload of the underlying keys rides on issue #75 Phase 1
|
|
21
|
-
* (`settings.yaml` + `/acp config`); surfacing the `preset` alias through that
|
|
21
|
+
* (`settings.yaml` + `/acp-prune config`); surfacing the `preset` alias through that
|
|
22
22
|
* same channel is the small follow-up once Phase 1 lands. The two knobs named in
|
|
23
23
|
* the original request that are NOT first-class engine knobs today — `growthRatio`
|
|
24
24
|
* (exists in acp-kernel as `nudge.growthRatio`, reachable via `coreOverrides`) and
|
package/dist/region.d.ts
CHANGED
|
@@ -82,14 +82,15 @@ export interface ResolvedSurfaceRange {
|
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
84
|
* Validate one inclusive surface span and adjust its edges to a
|
|
85
|
-
* tool-pairing-balanced range whose boundaries
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* inward to the nearest clean cut; if
|
|
89
|
-
* asked for a SINGLE tool result,
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
85
|
+
* tool-pairing-balanced range whose boundaries anchor (bare-`${seq}` ref,
|
|
86
|
+
* multi-call sub-id, or empty-result fallback — see anchorsRangeEdge,
|
|
87
|
+
* issue #155). Reversed ranges throw. An edge that sits inside a
|
|
88
|
+
* tool-call/result pair is first nudged inward to the nearest clean cut; if
|
|
89
|
+
* that collapses the range (e.g. the model asked for a SINGLE tool result,
|
|
90
|
+
* which can never be balanced alone), the range EXPANDS outward to the
|
|
91
|
+
* enclosing clean pair instead — a lone tool message is almost always a
|
|
92
|
+
* "consumed output" the model genuinely wants to compress. The returned range
|
|
93
|
+
* is what a caller should actually shadow.
|
|
93
94
|
*
|
|
94
95
|
* Missing edges are NOT an immediate error: the seqs were probably shadowed by
|
|
95
96
|
* an earlier compression (stale nudge table / old compress result). The span
|
|
@@ -256,7 +257,7 @@ export declare function newestInstructionSeqsOf(session: Session): Set<number>;
|
|
|
256
257
|
* agent-instructions row of every scope, restricted to rows still visible on
|
|
257
258
|
* the surface (one definition of "current" — `newestInstructionSeqsOf`).
|
|
258
259
|
* `buildCompressibleSeqRanges` never OFFERS them, and both compress entry
|
|
259
|
-
* points (`handleCompress` in src/tools.ts, `/acp compress` in
|
|
260
|
+
* points (`handleCompress` in src/tools.ts, `/acp-prune compress` in
|
|
260
261
|
* src/commands.ts) probe the RESOLVED span against this set and HARD-REJECT a
|
|
261
262
|
* covering range before the kernel applies it, so nothing durable lands and no
|
|
262
263
|
* phantom block can exist. This supersedes the earlier F7 draft (warn only):
|
package/dist/settings.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Layering (per key): schemastery schema default → composition-row subset
|
|
9
9
|
* (the `base` layer, filtered by `filterSettingsEntry`) → user section.
|
|
10
|
-
* The `/acp config` slash command reads and writes the same namespace
|
|
10
|
+
* The `/acp-prune config` slash command reads and writes the same namespace
|
|
11
11
|
* through the `SettingsCommandSurface` built here.
|
|
12
12
|
*
|
|
13
13
|
* Deliberately NOT exposed through settings: `coreOverrides`, `countTokens`,
|
|
@@ -27,7 +27,7 @@ import type { SettingsDescriptor, SettingsProvider } from '@deepseek-ai/dsh-sett
|
|
|
27
27
|
* (`installSection`'s `Namespace & SettingsNamespaceInput<Namespace>`).
|
|
28
28
|
*/
|
|
29
29
|
export declare const ACP_SETTINGS_NAMESPACE = "compaction-acp";
|
|
30
|
-
/** The six knobs exposed to the runtime settings layer. Order defines /acp config listing order. */
|
|
30
|
+
/** The six knobs exposed to the runtime settings layer. Order defines /acp-prune config listing order. */
|
|
31
31
|
export declare const SETTINGS_KEYS: readonly ['modelContextLimit', 'autoModelContextLimit', 'nudgeMinContextLimitPct', 'nudgeMaxContextLimitPct', 'nudgeEmergencyThresholdPct', 'autoNudge'];
|
|
32
32
|
export type SettingsKey = (typeof SETTINGS_KEYS)[number];
|
|
33
33
|
/** Resolved shape of one settings snapshot — what every consumer read returns. */
|
|
@@ -116,7 +116,7 @@ export interface SettingsChangeEffect {
|
|
|
116
116
|
}
|
|
117
117
|
/** Pure diff used by the engine's change handler (unit-testable without a context). */
|
|
118
118
|
export declare function describeSettingsChange(prev: AcpSettings, next: AcpSettings): SettingsChangeEffect;
|
|
119
|
-
/** Result of parsing a `/acp config set` value. `null` means "reset this key". */
|
|
119
|
+
/** Result of parsing a `/acp-prune config set` value. `null` means "reset this key". */
|
|
120
120
|
export type ParsedSettingValue = {
|
|
121
121
|
ok: true;
|
|
122
122
|
value: number | boolean | null;
|
|
@@ -125,7 +125,7 @@ export type ParsedSettingValue = {
|
|
|
125
125
|
reason: string;
|
|
126
126
|
};
|
|
127
127
|
/**
|
|
128
|
-
* Four-step value parser for `/acp config set` — deliberately NOT bare
|
|
128
|
+
* Four-step value parser for `/acp-prune config set` — deliberately NOT bare
|
|
129
129
|
* JSON.parse, which rejects the most common human inputs (`.7` throws a
|
|
130
130
|
* SyntaxError and the raw string would then fail schema validation; `null`
|
|
131
131
|
* would silently mean "unset" only by convention). Order:
|
|
@@ -135,7 +135,7 @@ export type ParsedSettingValue = {
|
|
|
135
135
|
* 4. otherwise rejected with guidance.
|
|
136
136
|
*/
|
|
137
137
|
export declare function parseSettingValue(raw: string): ParsedSettingValue;
|
|
138
|
-
/** Everything `/acp config` needs from the engine. Fakes in tests implement this directly. */
|
|
138
|
+
/** Everything `/acp-prune config` needs from the engine. Fakes in tests implement this directly. */
|
|
139
139
|
export interface SettingsCommandSurface {
|
|
140
140
|
/** False in processes without a settings provider (plain npm-install compositions): the command degrades to advice instead of failing. */
|
|
141
141
|
readonly available: boolean;
|
package/dist/tools.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ import type { PresetName } from './presets.ts';
|
|
|
22
22
|
export interface ToolEnvironment extends KernelConfigInput {
|
|
23
23
|
readonly kernel: CompressionCore;
|
|
24
24
|
readonly store: AcpStateStore;
|
|
25
|
-
/** Display-only: the named preset that produced the nudge thresholds above, if any (`/acp status` names it). Never read by the kernel path. */
|
|
25
|
+
/** Display-only: the named preset that produced the nudge thresholds above, if any (`/acp-prune status` names it). Never read by the kernel path. */
|
|
26
26
|
readonly preset?: PresetName;
|
|
27
27
|
/** Resolve the effective context window for an agent (optional: status falls back to modelContextLimit). */
|
|
28
28
|
readonly windowFor?: (agent: Agent) => Promise<AcpWindow>;
|
|
@@ -36,7 +36,7 @@ export interface ToolEnvironment extends KernelConfigInput {
|
|
|
36
36
|
*/
|
|
37
37
|
readonly compressCallIdsToHide?: Set<string>;
|
|
38
38
|
/**
|
|
39
|
-
* Read/write access to the runtime settings layer for `/acp config`.
|
|
39
|
+
* Read/write access to the runtime settings layer for `/acp-prune config`.
|
|
40
40
|
* Absent surfaces (never expected — the engine always builds one) would
|
|
41
41
|
* degrade the command to advice text.
|
|
42
42
|
*/
|
|
@@ -46,7 +46,7 @@ export interface ToolEnvironment extends KernelConfigInput {
|
|
|
46
46
|
* Resolve the effective context window for a tool or command run: probe the
|
|
47
47
|
* agent's real window via `windowFor` when provided, otherwise fall back to
|
|
48
48
|
* the environment's `modelContextLimit`. Shared by the compress and
|
|
49
|
-
* acp_status tool handlers and the `/acp` command so the resolution logic
|
|
49
|
+
* acp_status tool handlers and the `/acp-prune` command so the resolution logic
|
|
50
50
|
* lives in exactly one place (issue #63 — the tools used the 128K fallback
|
|
51
51
|
* for pressure decisions even when auto-detection had found a larger window).
|
|
52
52
|
*/
|
|
@@ -141,6 +141,28 @@ export declare const compressParameters: {
|
|
|
141
141
|
*/
|
|
142
142
|
export declare function guardedRowsInSpan(guarded: ReadonlySet<number>, shadowed: readonly number[]): number[];
|
|
143
143
|
export declare function protectedRowRejectionNote(start: number, end: number, hits: readonly number[], shadowed: readonly number[]): string;
|
|
144
|
+
/**
|
|
145
|
+
* Kernel ref for one RESOLVED range edge's surface node (issue #155).
|
|
146
|
+
* Resolved edges are tool-pairing-balanced and anchorable, but NO LONGER
|
|
147
|
+
* guaranteed to carry a bare-`${seq}` ref: a multi-tool-call assistant
|
|
148
|
+
* projects to `${seq}#${callId}` sub-ids, and an empty tool result projects
|
|
149
|
+
* to nothing. Three tiers, in order:
|
|
150
|
+
*
|
|
151
|
+
* 1. the bare-seq id (user turns, single-call assistants, text-bearing results);
|
|
152
|
+
* 2. the node's sub-ids in projection (= content) order — FIRST for a start
|
|
153
|
+
* edge (the kernel must consume the whole node from its first sub-message),
|
|
154
|
+
* LAST for an end edge (unreachable in practice: a node with open calls
|
|
155
|
+
* makes every cut after it unbalanced, so it can never be a resolved end
|
|
156
|
+
* edge);
|
|
157
|
+
* 3. the nearest message-bearing LIVE node between this edge and the opposite
|
|
158
|
+
* edge (inclusive), walked along the SURFACE — never raw-id space, where
|
|
159
|
+
* shadowed nodes keep their refs and would anchor onto already-compressed
|
|
160
|
+
* messages. Walking inward only also guarantees the returned ref names a
|
|
161
|
+
* message the transaction actually shadows; a span whose interior carries
|
|
162
|
+
* no message at all (two adjacent empty results) yields undefined and the
|
|
163
|
+
* caller raises the existing "no assigned ref" error.
|
|
164
|
+
*/
|
|
165
|
+
export declare function edgeRefForSeq(session: Session, byRaw: Readonly<Record<string, string>>, seq: number, role: 'start' | 'end', oppositeSeq: number): string | undefined;
|
|
144
166
|
/**
|
|
145
167
|
* Build the unified SearchDoc[] from the log: one block doc per ledger entry
|
|
146
168
|
* (ref = compactionId, so `decompress({ blockId })` closes the loop) plus one
|
package/dist/window.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ export interface AcpWindow {
|
|
|
55
55
|
*/
|
|
56
56
|
readonly outputReserved?: number;
|
|
57
57
|
}
|
|
58
|
-
/** Human label for an AcpWindow's source (used by /acp status). */
|
|
58
|
+
/** Human label for an AcpWindow's source (used by /acp-prune status). */
|
|
59
59
|
export declare function windowSourceLabel(window: AcpWindow): string;
|
|
60
60
|
/**
|
|
61
61
|
* Read the live context window from the host session projection
|
|
@@ -87,7 +87,7 @@ export declare function liveRoute(agent: Agent): {
|
|
|
87
87
|
* resolved against, in ONE place: the session's live `request/context` route,
|
|
88
88
|
* falling back to `agent.options` only before the session has recorded any
|
|
89
89
|
* route. `windowFor` (src/index.ts), the `compress` tool (src/tools.ts) and
|
|
90
|
-
* `/acp compress` (src/commands.ts) all need this exact pair; three hand-copied
|
|
90
|
+
* `/acp-prune compress` (src/commands.ts) all need this exact pair; three hand-copied
|
|
91
91
|
* copies is precisely how a stale-route bug gets fixed in one call site and
|
|
92
92
|
* left behind in the others.
|
|
93
93
|
*/
|
package/package.json
CHANGED