dsh-context 0.52.1 → 0.53.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 +17 -1
- package/lib/client.js +4678 -3106
- package/lib/index.d.ts +67 -1
- package/lib/index.js +746 -475
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -32,6 +32,15 @@ export declare const Config: z.ZodPreprocess<z.ZodObject<{
|
|
|
32
32
|
maxFileOps: z.ZodDefault<z.ZodNumber>;
|
|
33
33
|
}, z.core.$strict>>;
|
|
34
34
|
//#endregion
|
|
35
|
+
//#region src/host/activity.d.ts
|
|
36
|
+
/** The persisted fold state (the registry's `stateSchema` contract). */
|
|
37
|
+
interface ActivityState {
|
|
38
|
+
days: Record<string, {
|
|
39
|
+
tokens: number;
|
|
40
|
+
requests: number;
|
|
41
|
+
}>;
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
35
44
|
//#region src/host/headers.d.ts
|
|
36
45
|
/**
|
|
37
46
|
* One stored tool: the v1 row shape carried the producer description and the
|
|
@@ -143,6 +152,14 @@ interface TimelineState {
|
|
|
143
152
|
* the first human input folds.
|
|
144
153
|
*/
|
|
145
154
|
humanInputs?: number;
|
|
155
|
+
/**
|
|
156
|
+
* The user's newest own message as a bounded one-line preview (the surface
|
|
157
|
+
* node's first-text line). Last-wins — a newer human input replaces it, a
|
|
158
|
+
* text-less one (images only) keeps the previous line. Additive-optional
|
|
159
|
+
* like the 0.47 fields: cached rows folded before the field existed read
|
|
160
|
+
* without it and the card just hides its preview line.
|
|
161
|
+
*/
|
|
162
|
+
lastUser?: string;
|
|
146
163
|
archiveFloor?: number;
|
|
147
164
|
/**
|
|
148
165
|
* The detail collections' revision marker (see ContextTimelineDetail):
|
|
@@ -263,10 +280,21 @@ declare module '@deepseek-ai/dsh-session-projection/types' {
|
|
|
263
280
|
* content of a picked step (key absence = older host: tokens only).
|
|
264
281
|
*/
|
|
265
282
|
contextHeaders: ContextHeaders;
|
|
283
|
+
/**
|
|
284
|
+
* The per-day activity ledger (billed tokens + completed requests keyed
|
|
285
|
+
* by local day) behind the Context Dashboard's heatmap — the timeline's
|
|
286
|
+
* "current snapshot" cannot draw a per-day chart, so the overview reads
|
|
287
|
+
* this off every session-list row's projection column. Tiny (one small
|
|
288
|
+
* record per day, retention-capped), so riding every list row costs
|
|
289
|
+
* nothing next to the timeline head. Key absence = older host: the
|
|
290
|
+
* heatmap degrades to its empty note.
|
|
291
|
+
*/
|
|
292
|
+
contextActivity: ContextActivity;
|
|
266
293
|
}
|
|
267
294
|
interface SessionProjectionStateMap {
|
|
268
295
|
contextTimeline: TimelineState;
|
|
269
296
|
contextHeaders: HeadersState;
|
|
297
|
+
contextActivity: ActivityState;
|
|
270
298
|
}
|
|
271
299
|
}
|
|
272
300
|
/**
|
|
@@ -314,6 +342,26 @@ interface TimelineLast {
|
|
|
314
342
|
total: number;
|
|
315
343
|
prompt?: number;
|
|
316
344
|
}
|
|
345
|
+
/** One day's ledger entry in the `contextActivity` projection. */
|
|
346
|
+
interface ActivityDay {
|
|
347
|
+
/**
|
|
348
|
+
* Billed tokens folded from provider-reported usage that day (prompt-side
|
|
349
|
+
* input + cache read/write + output). Requests without a usage settlement
|
|
350
|
+
* count only toward `requests` — a fabricated 0 never understates the day.
|
|
351
|
+
*/
|
|
352
|
+
tokens: number;
|
|
353
|
+
/** Completed model calls (assistant settlements) that day. */
|
|
354
|
+
requests: number;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* The per-session daily activity ledger (`contextActivity` wire value):
|
|
358
|
+
* day key (`YYYY-MM-DD`, host-local — see shared/days.ts) → that day's
|
|
359
|
+
* billed volume, retention-capped by the fold. The Context Dashboard merges
|
|
360
|
+
* every listed session's ledger into its activity heatmap.
|
|
361
|
+
*/
|
|
362
|
+
interface ContextActivity {
|
|
363
|
+
days: Record<string, ActivityDay>;
|
|
364
|
+
}
|
|
317
365
|
interface Snapshot {
|
|
318
366
|
ok: boolean;
|
|
319
367
|
/**
|
|
@@ -362,6 +410,13 @@ interface Snapshot {
|
|
|
362
410
|
* from older hosts; clients treat absence as zero.
|
|
363
411
|
*/
|
|
364
412
|
humanInputs?: number;
|
|
413
|
+
/**
|
|
414
|
+
* The user's newest own message as a one-line bounded preview (first text
|
|
415
|
+
* block, whitespace collapsed, ~80 chars): the session cards' footer line.
|
|
416
|
+
* Additive-optional — absent from rows folded before the field existed
|
|
417
|
+
* (older hosts, idle sessions' cached rows); clients hide the line then.
|
|
418
|
+
*/
|
|
419
|
+
lastUser?: string;
|
|
365
420
|
/**
|
|
366
421
|
* Split-generation head fields — present exactly when the host serves the
|
|
367
422
|
* SLIM head (the heavy collections moved to the on-demand detail channel,
|
|
@@ -446,6 +501,17 @@ interface Snapshot {
|
|
|
446
501
|
*/
|
|
447
502
|
interface ContextTimelineDetail {
|
|
448
503
|
rev: number;
|
|
504
|
+
/**
|
|
505
|
+
* The slim wire head at the SAME fold cut as the collections: the
|
|
506
|
+
* composition scalars (`current`), the window/model envelope, and the
|
|
507
|
+
* precomputed counts. Sessions listed cold (never attached since the
|
|
508
|
+
* requesting unit last changed) carry no `contextTimeline` projection row
|
|
509
|
+
* for the browser's list reads, so the Agent network card fetches this
|
|
510
|
+
* head per node to render their composition rings. The host always serves
|
|
511
|
+
* it; optional so a payload missing it still serves the collections (the
|
|
512
|
+
* detail cards) and only the ring composition degrades.
|
|
513
|
+
*/
|
|
514
|
+
head?: ContextTimeline;
|
|
449
515
|
requests: RequestRecord[];
|
|
450
516
|
events: ContextEventRecord[];
|
|
451
517
|
nodes: SurfaceNode[];
|
|
@@ -736,4 +802,4 @@ export declare const name = "dsh-context";
|
|
|
736
802
|
export declare const inject: string[];
|
|
737
803
|
export declare function apply(ctx: Context, config: Config): void;
|
|
738
804
|
//#endregion
|
|
739
|
-
export type { Category, ContextEventRecord, ContextHeaders, ContextTimeline, ContextTimelineDetail, HeaderRecord, HeaderTool, HeadersState, RequestRecord, Snapshot, SurfaceNode, TimelineCounts, TimelineLast, TimelineState };
|
|
805
|
+
export type { ActivityDay, ActivityState, Category, ContextActivity, ContextEventRecord, ContextHeaders, ContextTimeline, ContextTimelineDetail, HeaderRecord, HeaderTool, HeadersState, RequestRecord, Snapshot, SurfaceNode, TimelineCounts, TimelineLast, TimelineState };
|