dsh-context 0.54.4 → 0.55.0
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.md +8 -3
- package/icon.svg +12 -0
- package/lib/client.js +324 -188
- package/lib/index.d.ts +83 -36
- package/lib/index.js +246 -88
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +8 -4
package/lib/index.d.ts
CHANGED
|
@@ -1,37 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import "@deepseek-ai/dsh-session";
|
|
3
|
+
import z$1 from "@deepseek-ai/schemastery";
|
|
3
4
|
import { Context } from "@deepseek-ai/cordis";
|
|
4
|
-
//#region src/host/config.d.ts
|
|
5
|
-
export interface Config {
|
|
6
|
-
/** Cap on kept per-step request records (the hard step backstop). */
|
|
7
|
-
maxRequestSteps?: number;
|
|
8
|
-
/** Newest whole-turn window kept; trimming crosses whole turns, never mid-turn. */
|
|
9
|
-
maxKeptTurns?: number;
|
|
10
|
-
maxEvents?: number;
|
|
11
|
-
/**
|
|
12
|
-
* Served surface nodes (newest carry the signal; live inject nodes are pinned — they land first and are few). Deliberately generous:
|
|
13
|
-
* auto-compaction keeps healthy surfaces far below it, so the browser effectively lists every live node; the bound is a
|
|
14
|
-
* pathological-session backstop (each push ships the whole value, ~150B/node).
|
|
15
|
-
*/
|
|
16
|
-
maxNodes?: number;
|
|
17
|
-
/** Removed (shadowed) surface nodes kept for per-step reconstruction. */
|
|
18
|
-
maxArchiveNodes?: number;
|
|
19
|
-
/** Fold-derived file-operation records kept (the File Activity card's raw material). */
|
|
20
|
-
maxFileOps?: number;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* The cordis `Config` validator: strict on keys, defaults on the schema fields; tolerates `undefined` (a patch row without a `config:`
|
|
24
|
-
* block — defaults win).
|
|
25
|
-
*/
|
|
26
|
-
export declare const Config: z.ZodPreprocess<z.ZodObject<{
|
|
27
|
-
maxRequestSteps: z.ZodDefault<z.ZodNumber>;
|
|
28
|
-
maxKeptTurns: z.ZodDefault<z.ZodNumber>;
|
|
29
|
-
maxEvents: z.ZodDefault<z.ZodNumber>;
|
|
30
|
-
maxNodes: z.ZodDefault<z.ZodNumber>;
|
|
31
|
-
maxArchiveNodes: z.ZodDefault<z.ZodNumber>;
|
|
32
|
-
maxFileOps: z.ZodDefault<z.ZodNumber>;
|
|
33
|
-
}, z.core.$strict>>;
|
|
34
|
-
//#endregion
|
|
35
5
|
//#region src/host/activity.d.ts
|
|
36
6
|
/** The persisted fold state (the registry's `stateSchema` contract). */
|
|
37
7
|
interface ActivityState {
|
|
@@ -73,6 +43,8 @@ interface HeadersState {
|
|
|
73
43
|
* poisoning a bucket.
|
|
74
44
|
*/
|
|
75
45
|
type DecodeKind = 'reasoning' | 'text' | 'toolarg';
|
|
46
|
+
/** Per-kind count of opened decode blocks (see {@link decodeTallyOfStream}). */
|
|
47
|
+
type DecodeCounts = Record<DecodeKind, number>;
|
|
76
48
|
//#endregion
|
|
77
49
|
//#region src/host/fold.d.ts
|
|
78
50
|
/**
|
|
@@ -127,6 +99,16 @@ interface TimelineState {
|
|
|
127
99
|
lastModel?: string;
|
|
128
100
|
contextWindow?: number;
|
|
129
101
|
requests: RequestRecord[];
|
|
102
|
+
/**
|
|
103
|
+
* The number of turn runs in `requests` (a run = consecutive records
|
|
104
|
+
* sharing one `turn`). Maintained incrementally at the single append site
|
|
105
|
+
* and recomputed when a trim replaces the array, so the retention trim's
|
|
106
|
+
* cap check stays O(1) per event instead of walking every retained
|
|
107
|
+
* request. Absent on rows folded before the field existed — the first
|
|
108
|
+
* post-restore event recomputes it once (the same additive-optional shape
|
|
109
|
+
* as `detailRev`).
|
|
110
|
+
*/
|
|
111
|
+
turnRuns?: number;
|
|
130
112
|
events: ContextEventRecord[];
|
|
131
113
|
/**
|
|
132
114
|
* Recently removed surface nodes (stamped COPIES carrying `gone`), in
|
|
@@ -188,16 +170,19 @@ interface TimelineState {
|
|
|
188
170
|
* durations, never to unbounded state. Same arm/remove lifecycle as
|
|
189
171
|
* `pendingShadowedSeqs`.
|
|
190
172
|
*
|
|
191
|
-
* `decode` and `block` carry the generation split (reasoning /
|
|
192
|
-
* tool arguments — see TimingTotals): a V0 log's
|
|
193
|
-
* `block-start` markers open `block
|
|
194
|
-
* `decode
|
|
195
|
-
*
|
|
173
|
+
* `decode`, `blocks` and `block` carry the generation split (reasoning /
|
|
174
|
+
* answer text / tool arguments — see TimingTotals): a V0 log's
|
|
175
|
+
* `assistant/chunk` `block-start` markers open `block`, close the previous
|
|
176
|
+
* one into `decode`, and count the opened bucket into `blocks` (the card's
|
|
177
|
+
* per-slice tally); a V2+ log carries no such events, so `decode` stays
|
|
178
|
+
* absent and `assistant/message` reads the spans and counts off its embedded
|
|
179
|
+
* stream instead.
|
|
196
180
|
*/
|
|
197
181
|
stepStart?: {
|
|
198
182
|
time: number;
|
|
199
183
|
firstToken?: number;
|
|
200
184
|
decode?: Record<DecodeKind, number>;
|
|
185
|
+
blocks?: DecodeCounts;
|
|
201
186
|
block?: {
|
|
202
187
|
kind: DecodeKind;
|
|
203
188
|
since: number;
|
|
@@ -362,6 +347,23 @@ interface ActivityDay {
|
|
|
362
347
|
interface ContextActivity {
|
|
363
348
|
days: Record<string, ActivityDay>;
|
|
364
349
|
}
|
|
350
|
+
/**
|
|
351
|
+
* The per-user display-preference vocabulary of the `dsh-context` settings
|
|
352
|
+
* namespace — the ONE declaration both halves share: the Host registers the
|
|
353
|
+
* namespace schema against it (host/settings.ts), the Client binds the scope
|
|
354
|
+
* and edits fields by name (client/settings.ts). Type-only, so both bundles
|
|
355
|
+
* erase it.
|
|
356
|
+
*/
|
|
357
|
+
type DefaultGranularity = 'step' | 'turn';
|
|
358
|
+
type DefaultTrendMode = 'total' | 'delta';
|
|
359
|
+
/** File Activity row order: most operations first, most-recently-touched first, or path ascending. */
|
|
360
|
+
type DefaultFileSort = 'count' | 'latest' | 'path';
|
|
361
|
+
/** Tool-definition row order: largest schema first, most call hits first, or name ascending. */
|
|
362
|
+
type DefaultToolSort = 'size' | 'count' | 'name';
|
|
363
|
+
/** Where the Context view is offered: the conversation tab, the right Sidebar, or both. */
|
|
364
|
+
type DefaultPlacement = 'all' | 'tab' | 'sidebar';
|
|
365
|
+
/** Whether the Context Insights panel's sidebar entry is offered at all. */
|
|
366
|
+
type InsightsEntry = 'show' | 'hide';
|
|
365
367
|
interface Snapshot {
|
|
366
368
|
ok: boolean;
|
|
367
369
|
/**
|
|
@@ -634,10 +636,22 @@ interface TimingTotals {
|
|
|
634
636
|
genMs: number;
|
|
635
637
|
/** Reasoning-decode slice of `genMs` (the model's thinking). */
|
|
636
638
|
reasoningMs?: number;
|
|
639
|
+
/** Counted reasoning-decode blocks (the Thinking slice's tally). */
|
|
640
|
+
reasoningBlocks?: number;
|
|
637
641
|
/** Answer-text decode slice of `genMs`. */
|
|
638
642
|
textMs?: number;
|
|
643
|
+
/** Counted answer-text decode blocks (the Answer slice's tally). */
|
|
644
|
+
textBlocks?: number;
|
|
639
645
|
/** Tool-call-argument decode slice of `genMs`. */
|
|
640
646
|
toolArgMs?: number;
|
|
647
|
+
/**
|
|
648
|
+
* Counted tool-call-argument decode blocks — one per tool call whose
|
|
649
|
+
* arguments the stream decoded (the Tool args slice's tally). The counts are
|
|
650
|
+
* ADDITIVE-OPTIONAL like their spans: a row cached before they existed (or a
|
|
651
|
+
* call whose stream framed no blocks) carries none, and the card qualifies
|
|
652
|
+
* only what was actually counted.
|
|
653
|
+
*/
|
|
654
|
+
toolArgBlocks?: number;
|
|
641
655
|
/**
|
|
642
656
|
* The decode-throughput seat, paired exactly as the harness's own
|
|
643
657
|
* session-stats fold pairs them: `speedTokens` sums provider-reported
|
|
@@ -833,6 +847,39 @@ interface PlatformBalance {
|
|
|
833
847
|
balances: PlatformBalanceEntry[];
|
|
834
848
|
}
|
|
835
849
|
//#endregion
|
|
850
|
+
//#region src/host/config.d.ts
|
|
851
|
+
export interface Config {
|
|
852
|
+
/** Cap on kept per-step request records (the hard step backstop). */
|
|
853
|
+
maxRequestSteps?: number;
|
|
854
|
+
/** Newest whole-turn window kept; trimming crosses whole turns, never mid-turn. */
|
|
855
|
+
maxKeptTurns?: number;
|
|
856
|
+
maxEvents?: number;
|
|
857
|
+
/**
|
|
858
|
+
* Served surface nodes (newest carry the signal; live inject nodes are pinned — they land first and are few). Deliberately generous:
|
|
859
|
+
* auto-compaction keeps healthy surfaces far below it, so the browser effectively lists every live node; the bound is a
|
|
860
|
+
* pathological-session backstop (each push ships the whole value, ~150B/node).
|
|
861
|
+
*/
|
|
862
|
+
maxNodes?: number;
|
|
863
|
+
/** Removed (shadowed) surface nodes kept for per-step reconstruction. */
|
|
864
|
+
maxArchiveNodes?: number;
|
|
865
|
+
/** Fold-derived file-operation records kept (the File Activity card's raw material). */
|
|
866
|
+
maxFileOps?: number;
|
|
867
|
+
/** Where the Context view is offered (the conversation tab, the right Sidebar, or both). */
|
|
868
|
+
defaultPlacement?: DefaultPlacement;
|
|
869
|
+
/** Timeline default granularity (per step or per turn). */
|
|
870
|
+
defaultGranularity?: DefaultGranularity;
|
|
871
|
+
/** Timeline default trend mode (total or delta). */
|
|
872
|
+
defaultTrendMode?: DefaultTrendMode;
|
|
873
|
+
/** Tool-definition row default order. */
|
|
874
|
+
defaultToolSort?: DefaultToolSort;
|
|
875
|
+
/** File Activity row default order. */
|
|
876
|
+
defaultFileSort?: DefaultFileSort;
|
|
877
|
+
/** Whether the Context Insights panel's sidebar entry is offered. */
|
|
878
|
+
insightsEntry?: InsightsEntry;
|
|
879
|
+
}
|
|
880
|
+
/** The cordis `Config` validator and the Config-form generation's served schema. */
|
|
881
|
+
export declare const Config: z$1<Config>;
|
|
882
|
+
//#endregion
|
|
836
883
|
//#region src/host/index.d.ts
|
|
837
884
|
export declare const name = "dsh-context";
|
|
838
885
|
export declare const inject: string[];
|