dsh-context-compression-improved 0.5.2 → 0.5.3
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/.gitattributes +1 -0
- package/CHANGELOG.ja.md +144 -119
- package/CHANGELOG.ko.md +143 -118
- package/CHANGELOG.md +278 -250
- package/CHANGELOG.zh.md +131 -109
- package/docs/installation.md +103 -103
- package/docs/installation.zh.md +100 -100
- package/package.json +1 -1
- package/packages/selector/cordis.patch.yml +5 -6
- package/packages/selector/src/client/EstimatorControls.tsx +277 -277
- package/packages/selector/src/client/locales.ts +196 -196
- package/packages/selector/src/index.ts +463 -463
- package/packages/selector/src/pruner/state.ts +50 -50
- package/packages/selector/src/pruner.ts +2402 -2402
- package/packages/selector/src/runtime/tokenpilot/advisor-prompt.ts +188 -188
- package/packages/selector/src/runtime/tokenpilot/advisor-state.ts +149 -149
- package/packages/selector/src/runtime/tokenpilot/advisor.ts +419 -419
- package/packages/selector/src/runtime/tokenpilot/benefit.ts +200 -200
- package/packages/selector/tests/advisor-report.host.spec.ts +223 -223
- package/packages/selector/tests/public/package-contract.client.spec.ts +20 -0
- package/packages/selector/tests/runtime/advice-never-withholds.host.spec.ts +232 -232
- package/packages/selector/tests/runtime/advisor-invariant.spec.ts +272 -272
- package/packages/selector/tests/runtime/advisor.spec.ts +226 -226
- package/packages/selector/tests/runtime/char-basis.spec.ts +30 -30
- package/packages/selector/tests/runtime/deprecated-preset-options.spec.ts +96 -96
- package/packages/selector/tests/runtime/tokenpilot/benefit.spec.ts +217 -217
- package/packages/selector/tests/settings-seat.client.spec.ts +29 -4
- package/scripts/toolclass-corpus-replay.mjs +281 -281
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Consolidated per-session mutable state for {@link ToolResultPruner}.
|
|
3
|
-
*
|
|
4
|
-
* Every field is a WeakMap keyed by Session, keeping the service
|
|
5
|
-
* stateless across sessions and safe under GC.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { Session } from '@deepseek-ai/dsh-session'
|
|
9
|
-
import type { DedupeTable } from '../runtime/tokenpilot/dedup.ts'
|
|
10
|
-
import type { EstimatorFailures } from '../runtime/tokenpilot/estimator.ts'
|
|
11
|
-
import type { SideChannel } from '../runtime/tokenpilot/sidechannel.ts'
|
|
12
|
-
import type {
|
|
13
|
-
ContextCompressionSettings,
|
|
14
|
-
ResolvedConfig,
|
|
15
|
-
} from '../runtime/types.ts'
|
|
16
|
-
|
|
17
|
-
/** Mutable per-session state bag used inside {@link ToolResultPruner}. */
|
|
18
|
-
export interface PrunerState {
|
|
19
|
-
/** Resolved immutable deployment configuration. */
|
|
20
|
-
readonly config: ResolvedConfig
|
|
21
|
-
|
|
22
|
-
/** Complete canonical setting document frozen when each Session first reaches this root service. */
|
|
23
|
-
readonly sessionSettings: WeakMap<Session, ContextCompressionSettings>
|
|
24
|
-
/** Original result seqs whose first-exposure KEEP/REDUCE decision has committed. */
|
|
25
|
-
readonly firstExposure: WeakMap<Session, Set<number>>
|
|
26
|
-
/** Result seqs permanently exempt from further reduction (recovery outputs and registered equivalents). */
|
|
27
|
-
readonly recoveryExemptions: WeakMap<Session, Set<number>>
|
|
28
|
-
/** Per-session canonical-content hash index backing tokenpilot-inspired dedupe. */
|
|
29
|
-
readonly dedupeTables: WeakMap<Session, DedupeTable>
|
|
30
|
-
/** Advisory estimator verdicts consumed by the read-state classification. */
|
|
31
|
-
readonly estimatorVerdicts: WeakMap<Session, Map<number, boolean>>
|
|
32
|
-
/** Per-session estimator failure backoff state. */
|
|
33
|
-
readonly estimatorFailures: WeakMap<Session, EstimatorFailures>
|
|
34
|
-
/** Runtime prerequisite warnings deduplicated per Session and failure key. */
|
|
35
|
-
readonly warnedFailures: WeakMap<Session, Set<string>>
|
|
36
|
-
/** Last Adaptive postflight attempt emitted per Session; keeps diagnostics bounded and independent. */
|
|
37
|
-
readonly postflightDiagnostics: WeakMap<Session, string>
|
|
38
|
-
/** Current pre-step chain identity, shared by this producer and downstream compaction-basic. */
|
|
39
|
-
readonly activeRequestBoundaries: WeakMap<Session, object>
|
|
40
|
-
/** Boundary identity that already attempted one fully preflighted TailTrim publication. */
|
|
41
|
-
readonly tailTrimBoundaryAttempts: WeakMap<Session, object>
|
|
42
|
-
/** Last effective policy audit key emitted for each Session. */
|
|
43
|
-
readonly policyResolutionAudits: WeakMap<Session, string>
|
|
44
|
-
/** Last observed turn index per Session: the monotonic clock for advisory records. */
|
|
45
|
-
readonly turnClocks: WeakMap<Session, number>
|
|
46
|
-
/** Estimator-reported remaining turns Ŝ per Session; advisory only. */
|
|
47
|
-
readonly estimatorRemainingTurns: WeakMap<Session, number>
|
|
48
|
-
/** Per-session advisor side channel, constructed once with the advisor overrides. */
|
|
49
|
-
readonly advisorChannels: WeakMap<Session, SideChannel>
|
|
50
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Consolidated per-session mutable state for {@link ToolResultPruner}.
|
|
3
|
+
*
|
|
4
|
+
* Every field is a WeakMap keyed by Session, keeping the service
|
|
5
|
+
* stateless across sessions and safe under GC.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { Session } from '@deepseek-ai/dsh-session'
|
|
9
|
+
import type { DedupeTable } from '../runtime/tokenpilot/dedup.ts'
|
|
10
|
+
import type { EstimatorFailures } from '../runtime/tokenpilot/estimator.ts'
|
|
11
|
+
import type { SideChannel } from '../runtime/tokenpilot/sidechannel.ts'
|
|
12
|
+
import type {
|
|
13
|
+
ContextCompressionSettings,
|
|
14
|
+
ResolvedConfig,
|
|
15
|
+
} from '../runtime/types.ts'
|
|
16
|
+
|
|
17
|
+
/** Mutable per-session state bag used inside {@link ToolResultPruner}. */
|
|
18
|
+
export interface PrunerState {
|
|
19
|
+
/** Resolved immutable deployment configuration. */
|
|
20
|
+
readonly config: ResolvedConfig
|
|
21
|
+
|
|
22
|
+
/** Complete canonical setting document frozen when each Session first reaches this root service. */
|
|
23
|
+
readonly sessionSettings: WeakMap<Session, ContextCompressionSettings>
|
|
24
|
+
/** Original result seqs whose first-exposure KEEP/REDUCE decision has committed. */
|
|
25
|
+
readonly firstExposure: WeakMap<Session, Set<number>>
|
|
26
|
+
/** Result seqs permanently exempt from further reduction (recovery outputs and registered equivalents). */
|
|
27
|
+
readonly recoveryExemptions: WeakMap<Session, Set<number>>
|
|
28
|
+
/** Per-session canonical-content hash index backing tokenpilot-inspired dedupe. */
|
|
29
|
+
readonly dedupeTables: WeakMap<Session, DedupeTable>
|
|
30
|
+
/** Advisory estimator verdicts consumed by the read-state classification. */
|
|
31
|
+
readonly estimatorVerdicts: WeakMap<Session, Map<number, boolean>>
|
|
32
|
+
/** Per-session estimator failure backoff state. */
|
|
33
|
+
readonly estimatorFailures: WeakMap<Session, EstimatorFailures>
|
|
34
|
+
/** Runtime prerequisite warnings deduplicated per Session and failure key. */
|
|
35
|
+
readonly warnedFailures: WeakMap<Session, Set<string>>
|
|
36
|
+
/** Last Adaptive postflight attempt emitted per Session; keeps diagnostics bounded and independent. */
|
|
37
|
+
readonly postflightDiagnostics: WeakMap<Session, string>
|
|
38
|
+
/** Current pre-step chain identity, shared by this producer and downstream compaction-basic. */
|
|
39
|
+
readonly activeRequestBoundaries: WeakMap<Session, object>
|
|
40
|
+
/** Boundary identity that already attempted one fully preflighted TailTrim publication. */
|
|
41
|
+
readonly tailTrimBoundaryAttempts: WeakMap<Session, object>
|
|
42
|
+
/** Last effective policy audit key emitted for each Session. */
|
|
43
|
+
readonly policyResolutionAudits: WeakMap<Session, string>
|
|
44
|
+
/** Last observed turn index per Session: the monotonic clock for advisory records. */
|
|
45
|
+
readonly turnClocks: WeakMap<Session, number>
|
|
46
|
+
/** Estimator-reported remaining turns Ŝ per Session; advisory only. */
|
|
47
|
+
readonly estimatorRemainingTurns: WeakMap<Session, number>
|
|
48
|
+
/** Per-session advisor side channel, constructed once with the advisor overrides. */
|
|
49
|
+
readonly advisorChannels: WeakMap<Session, SideChannel>
|
|
50
|
+
}
|