dsh-context 0.65.0 → 0.66.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 +6 -7
- package/lib/client.js +30 -14311
- package/lib/index.d.ts +102 -39
- package/lib/index.js +641 -1606
- package/package.json +16 -15
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
import "@deepseek-ai/dsh-session";
|
|
3
4
|
import z$1 from "@deepseek-ai/schemastery";
|
|
@@ -5,16 +6,22 @@ import { Context } from "@deepseek-ai/cordis";
|
|
|
5
6
|
//#region src/host/activity.d.ts
|
|
6
7
|
/** The persisted fold state (the registry's `stateSchema` contract). */
|
|
7
8
|
interface ActivityState {
|
|
8
|
-
days: Record<string,
|
|
9
|
-
tokens: number;
|
|
10
|
-
requests: number;
|
|
11
|
-
cost?: SessionCostUsage;
|
|
12
|
-
}>;
|
|
9
|
+
days: Record<string, ActivityDay>;
|
|
13
10
|
/** The route in force (last `request/header`'s config wins) — prices each settlement. */
|
|
14
11
|
model?: string;
|
|
15
12
|
provider?: string;
|
|
16
13
|
/** The open step's start instant (armed by `step/start`, cleared by `step/end`). */
|
|
17
14
|
stepStart?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Pending `skill`-tool call ids (armed by `tool/call`, consumed by the
|
|
17
|
+
* pairing `tool/result`). The wrapper match alone is not trusted: a `read`
|
|
18
|
+
* of source text quoting `<skill_content name="…">` (this very file's
|
|
19
|
+
* comments, say) must not book a load — the timeline fold's pairing
|
|
20
|
+
* authority (fold.ts) applies here too. Bounded at
|
|
21
|
+
* {@link MAX_PENDING_SKILL_CALLS}; a never-answered call's id drops oldest
|
|
22
|
+
* first.
|
|
23
|
+
*/
|
|
24
|
+
skillCalls?: string[];
|
|
18
25
|
}
|
|
19
26
|
//#endregion
|
|
20
27
|
//#region src/host/headers.d.ts
|
|
@@ -118,6 +125,14 @@ interface TimelineState {
|
|
|
118
125
|
* the first human input folds.
|
|
119
126
|
*/
|
|
120
127
|
humanInputs?: number;
|
|
128
|
+
/**
|
|
129
|
+
* Whole-session answers tally (see Snapshot.answers): one per assistant
|
|
130
|
+
* message carrying a non-blank text block — a step that only dispatched
|
|
131
|
+
* tool calls (or projected to no message at all) is work, not a reply.
|
|
132
|
+
* Running total — never trimmed, like `humanInputs`. Absent until the first
|
|
133
|
+
* textual reply folds.
|
|
134
|
+
*/
|
|
135
|
+
answers?: number;
|
|
121
136
|
/**
|
|
122
137
|
* The user's newest own message as a bounded one-line preview (the surface
|
|
123
138
|
* node's first-text line). Last-wins — a newer human input replaces it, a
|
|
@@ -338,6 +353,15 @@ interface TimelineCounts {
|
|
|
338
353
|
injects: number;
|
|
339
354
|
compactions: number;
|
|
340
355
|
prunes: number;
|
|
356
|
+
/**
|
|
357
|
+
* Distinct skills loaded this session — the unique names among the retained
|
|
358
|
+
* inject events the fold tagged `sub: 'skill'` (a user-explicit `/name`
|
|
359
|
+
* invocation's instructions or a `skill`-tool load's content). The
|
|
360
|
+
* `<available_skills>` catalog digest is injected context without a name
|
|
361
|
+
* and never counts. Additive-optional: a head served without it (a partial
|
|
362
|
+
* record re-proved at the client's boundary) reads as zero.
|
|
363
|
+
*/
|
|
364
|
+
skills?: number;
|
|
341
365
|
}
|
|
342
366
|
/**
|
|
343
367
|
* The newest retained request record's billing summary — the headline's
|
|
@@ -370,6 +394,18 @@ interface ActivityDay {
|
|
|
370
394
|
* provider left unmetered — the usage chart degrades to tokens-only bars.
|
|
371
395
|
*/
|
|
372
396
|
cost?: SessionCostUsage;
|
|
397
|
+
/**
|
|
398
|
+
* The day's skill loads, skill name → its tally (`n` loads, `last` load
|
|
399
|
+
* instant in epoch ms): both durable load gestures — a user-explicit
|
|
400
|
+
* `/name` invocation's `skill-invocation` injection and a `skill`-tool
|
|
401
|
+
* load's `<skill_content>` result. ADDITIVE-OPTIONAL: absent on rows folded
|
|
402
|
+
* before the field existed and on days without a load — the Insights page's
|
|
403
|
+
* skill card treats a missing record as an empty day.
|
|
404
|
+
*/
|
|
405
|
+
skills?: Record<string, {
|
|
406
|
+
n: number;
|
|
407
|
+
last: number;
|
|
408
|
+
}>;
|
|
373
409
|
}
|
|
374
410
|
/**
|
|
375
411
|
* The per-session daily activity ledger (`contextActivity` wire value):
|
|
@@ -381,11 +417,30 @@ interface ContextActivity {
|
|
|
381
417
|
days: Record<string, ActivityDay>;
|
|
382
418
|
}
|
|
383
419
|
/**
|
|
384
|
-
*
|
|
385
|
-
*
|
|
386
|
-
*
|
|
387
|
-
*
|
|
388
|
-
*
|
|
420
|
+
* One available skill's catalog metadata, served by the plugin's
|
|
421
|
+
* `/api/dsh-context/skills` route (host/skills.ts) off the harness's skill
|
|
422
|
+
* registry: the Insights page's skill card joins it by name onto the load
|
|
423
|
+
* tallies to show what a skill IS (description, origin, on-disk path). Every
|
|
424
|
+
* field but `name` is best-effort — a registry that omits one still serves
|
|
425
|
+
* the rest, and the card renders the tally alone when the route is absent.
|
|
426
|
+
*/
|
|
427
|
+
interface SkillInfo {
|
|
428
|
+
/** Kebab-case identifier — the join key onto `ActivityDay.skills`. */
|
|
429
|
+
name: string;
|
|
430
|
+
/** The registry's routing description (may be empty). */
|
|
431
|
+
description: string;
|
|
432
|
+
/** Absolute instruction file path, when the provider is filesystem-backed. */
|
|
433
|
+
path?: string;
|
|
434
|
+
/** Discovery source bucket (e.g. 'project-agents', 'user-dsh', 'bundled'). */
|
|
435
|
+
source?: string;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* The per-user display-preference vocabulary of the `dsh-context` entry —
|
|
439
|
+
* the ONE declaration both halves share: the Host's entry Config schema
|
|
440
|
+
* carries the fields as `.volatile()` preferences (host/config.ts — the
|
|
441
|
+
* Config-form generation serves them live on the Plugins page), the Client
|
|
442
|
+
* binds the form and edits fields by name (client/settings.ts). Type-only,
|
|
443
|
+
* so both bundles erase it.
|
|
389
444
|
*/
|
|
390
445
|
type DefaultGranularity = 'step' | 'turn';
|
|
391
446
|
type DefaultTrendMode = 'total' | 'delta';
|
|
@@ -447,6 +502,14 @@ interface Snapshot {
|
|
|
447
502
|
* from older hosts; clients treat absence as zero.
|
|
448
503
|
*/
|
|
449
504
|
humanInputs?: number;
|
|
505
|
+
/**
|
|
506
|
+
* Whole-session answers tally: one per assistant message carrying a
|
|
507
|
+
* non-blank text block — steps that only dispatched tool calls are not
|
|
508
|
+
* replies. Running total over the complete log, like `humanInputs`.
|
|
509
|
+
* Additive-optional — absent from rows folded before the field existed;
|
|
510
|
+
* clients treat absence as zero.
|
|
511
|
+
*/
|
|
512
|
+
answers?: number;
|
|
450
513
|
/**
|
|
451
514
|
* The user's newest own message as a one-line bounded preview (first text
|
|
452
515
|
* block, whitespace collapsed, ~80 chars): the session cards' footer line.
|
|
@@ -962,35 +1025,35 @@ export interface Config {
|
|
|
962
1025
|
}
|
|
963
1026
|
/** The cordis `Config` validator and the Config-form generation's served schema. */
|
|
964
1027
|
export declare const Config: z$1<Schemastery.ObjectS<NoInfer<{
|
|
965
|
-
maxRequestSteps: z$1<number, number,
|
|
966
|
-
maxKeptTurns: z$1<number, number,
|
|
967
|
-
maxEvents: z$1<number, number,
|
|
968
|
-
maxNodes: z$1<number, number,
|
|
969
|
-
maxArchiveNodes: z$1<number, number,
|
|
970
|
-
maxFileOps: z$1<number, number,
|
|
971
|
-
defaultPlacement: z$1<"all" | "sidebar" | "tab", "all" | "sidebar" | "tab",
|
|
972
|
-
defaultGranularity: z$1<"step" | "turn", "step" | "turn",
|
|
973
|
-
defaultTrendMode: z$1<"delta" | "total", "delta" | "total",
|
|
974
|
-
defaultDeltaBase: z$1<"step" | "turn", "step" | "turn",
|
|
975
|
-
defaultToolSort: z$1<"count" | "name" | "size", "count" | "name" | "size",
|
|
976
|
-
defaultFileSort: z$1<"count" | "latest" | "path", "count" | "latest" | "path",
|
|
977
|
-
insightsEntry: z$1<"hide" | "show", "hide" | "show",
|
|
978
|
-
defaultDurationCurve: z$1<"hide" | "show", "hide" | "show",
|
|
1028
|
+
maxRequestSteps: z$1<number, number, "defined">;
|
|
1029
|
+
maxKeptTurns: z$1<number, number, "defined">;
|
|
1030
|
+
maxEvents: z$1<number, number, "defined">;
|
|
1031
|
+
maxNodes: z$1<number, number, "defined">;
|
|
1032
|
+
maxArchiveNodes: z$1<number, number, "defined">;
|
|
1033
|
+
maxFileOps: z$1<number, number, "defined">;
|
|
1034
|
+
defaultPlacement: z$1<"all" | "sidebar" | "tab", "all" | "sidebar" | "tab", "defined">;
|
|
1035
|
+
defaultGranularity: z$1<"step" | "turn", "step" | "turn", "defined">;
|
|
1036
|
+
defaultTrendMode: z$1<"delta" | "total", "delta" | "total", "defined">;
|
|
1037
|
+
defaultDeltaBase: z$1<"step" | "turn", "step" | "turn", "defined">;
|
|
1038
|
+
defaultToolSort: z$1<"count" | "name" | "size", "count" | "name" | "size", "defined">;
|
|
1039
|
+
defaultFileSort: z$1<"count" | "latest" | "path", "count" | "latest" | "path", "defined">;
|
|
1040
|
+
insightsEntry: z$1<"hide" | "show", "hide" | "show", "defined">;
|
|
1041
|
+
defaultDurationCurve: z$1<"hide" | "show", "hide" | "show", "defined">;
|
|
979
1042
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
980
|
-
maxRequestSteps: z$1<number, number,
|
|
981
|
-
maxKeptTurns: z$1<number, number,
|
|
982
|
-
maxEvents: z$1<number, number,
|
|
983
|
-
maxNodes: z$1<number, number,
|
|
984
|
-
maxArchiveNodes: z$1<number, number,
|
|
985
|
-
maxFileOps: z$1<number, number,
|
|
986
|
-
defaultPlacement: z$1<"all" | "sidebar" | "tab", "all" | "sidebar" | "tab",
|
|
987
|
-
defaultGranularity: z$1<"step" | "turn", "step" | "turn",
|
|
988
|
-
defaultTrendMode: z$1<"delta" | "total", "delta" | "total",
|
|
989
|
-
defaultDeltaBase: z$1<"step" | "turn", "step" | "turn",
|
|
990
|
-
defaultToolSort: z$1<"count" | "name" | "size", "count" | "name" | "size",
|
|
991
|
-
defaultFileSort: z$1<"count" | "latest" | "path", "count" | "latest" | "path",
|
|
992
|
-
insightsEntry: z$1<"hide" | "show", "hide" | "show",
|
|
993
|
-
defaultDurationCurve: z$1<"hide" | "show", "hide" | "show",
|
|
1043
|
+
maxRequestSteps: z$1<number, number, "defined">;
|
|
1044
|
+
maxKeptTurns: z$1<number, number, "defined">;
|
|
1045
|
+
maxEvents: z$1<number, number, "defined">;
|
|
1046
|
+
maxNodes: z$1<number, number, "defined">;
|
|
1047
|
+
maxArchiveNodes: z$1<number, number, "defined">;
|
|
1048
|
+
maxFileOps: z$1<number, number, "defined">;
|
|
1049
|
+
defaultPlacement: z$1<"all" | "sidebar" | "tab", "all" | "sidebar" | "tab", "defined">;
|
|
1050
|
+
defaultGranularity: z$1<"step" | "turn", "step" | "turn", "defined">;
|
|
1051
|
+
defaultTrendMode: z$1<"delta" | "total", "delta" | "total", "defined">;
|
|
1052
|
+
defaultDeltaBase: z$1<"step" | "turn", "step" | "turn", "defined">;
|
|
1053
|
+
defaultToolSort: z$1<"count" | "name" | "size", "count" | "name" | "size", "defined">;
|
|
1054
|
+
defaultFileSort: z$1<"count" | "latest" | "path", "count" | "latest" | "path", "defined">;
|
|
1055
|
+
insightsEntry: z$1<"hide" | "show", "hide" | "show", "defined">;
|
|
1056
|
+
defaultDurationCurve: z$1<"hide" | "show", "hide" | "show", "defined">;
|
|
994
1057
|
}>>, "plain">;
|
|
995
1058
|
//#endregion
|
|
996
1059
|
//#region src/host/index.d.ts
|
|
@@ -998,4 +1061,4 @@ export declare const name = "dsh-context";
|
|
|
998
1061
|
export declare const inject: string[];
|
|
999
1062
|
export declare function apply(ctx: Context, config: Config): void;
|
|
1000
1063
|
//#endregion
|
|
1001
|
-
export type { ActivityDay, ActivityState, Category, ContextActivity, ContextEventRecord, ContextHeaders, ContextTimeline, ContextTimelineDetail, HeaderRecord, HeaderTool, HeadersState, PlatformBalance, PlatformBalanceEntry, RequestRecord, Snapshot, SurfaceNode, TimelineCounts, TimelineLast, TimelineState };
|
|
1064
|
+
export type { ActivityDay, ActivityState, Category, ContextActivity, ContextEventRecord, ContextHeaders, ContextTimeline, ContextTimelineDetail, HeaderRecord, HeaderTool, HeadersState, PlatformBalance, PlatformBalanceEntry, RequestRecord, SkillInfo, Snapshot, SurfaceNode, TimelineCounts, TimelineLast, TimelineState };
|