billion-context-dsh 0.2.20 → 0.2.21
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 +3 -3
- package/README.md +3 -3
- package/dist/host-tokens.d.ts +24 -5
- package/dist/index.js +74 -8
- package/dist/index.js.map +1 -1
- package/dist/tool-pairing.d.ts +36 -0
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local tool-pairing balance checks over the session surface.
|
|
3
|
+
*
|
|
4
|
+
* UPSTREAM: `@deepseek-ai/dsh-compaction@0.1.2-rc.1` reads the REMOVED
|
|
5
|
+
* `session.events` API in its balance cache — `extendCache` does
|
|
6
|
+
* `const events = session.events` and `eventForSeq` does `events[seq]`, so on
|
|
7
|
+
* every dsh 0.1.2 host the official `toolPairingBalancedBefore/After` helpers
|
|
8
|
+
* throw `TypeError: Cannot read properties of undefined (reading '<seq>')`.
|
|
9
|
+
* The host's API docs require compaction backends to use these helpers for
|
|
10
|
+
* edge checks, and the host's own `dsh-compaction-basic` calls them too, so
|
|
11
|
+
* ALL compaction on a 0.1.2-rc.1 host crashes (reproduced offline and pinned
|
|
12
|
+
* in issue #124; tracked in docs/dsh-porting-verification.md).
|
|
13
|
+
*
|
|
14
|
+
* This module mirrors the host's algorithm line for line (per-session cache
|
|
15
|
+
* keyed by `surface.replaceGeneration`, the `cutBalanced` fold, identical
|
|
16
|
+
* error messages) with ONE deliberate difference: events are read through the
|
|
17
|
+
* cross-version accessor `eventAtOf` (src/session-events.ts), which works on
|
|
18
|
+
* both the 0.1.0/0.1.1 lines (`events[seq]`) and 0.1.2+ (`eventAt(seq)`).
|
|
19
|
+
* DELETE this module and switch `src/region.ts` back to
|
|
20
|
+
* `@deepseek-ai/dsh-compaction`'s helpers the moment the host fix ships.
|
|
21
|
+
*/
|
|
22
|
+
import type { Session } from '@deepseek-ai/dsh-session';
|
|
23
|
+
/**
|
|
24
|
+
* Whether the cut immediately before a current surface sequence is tool-pairing balanced.
|
|
25
|
+
* @param session - session whose surface is checked.
|
|
26
|
+
* @param seq - event sequence whose leading cut is checked.
|
|
27
|
+
* @returns true when no unanswered tool call crosses the cut.
|
|
28
|
+
*/
|
|
29
|
+
export declare function toolPairingBalancedBefore(session: Session, seq: number): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the cut immediately after a current surface sequence is tool-pairing balanced.
|
|
32
|
+
* @param session - session whose surface is checked.
|
|
33
|
+
* @param seq - event sequence whose trailing cut is checked.
|
|
34
|
+
* @returns true when no unanswered tool call crosses the cut.
|
|
35
|
+
*/
|
|
36
|
+
export declare function toolPairingBalancedAfter(session: Session, seq: number): boolean;
|
package/package.json
CHANGED