dsh-context 0.62.1 → 0.62.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/lib/client.js +3 -3
- package/lib/index.d.ts +18 -10
- package/lib/index.js +30 -13
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -11404,7 +11404,7 @@ window.__ModuleLoader__.load({
|
|
|
11404
11404
|
return function PluginInfo() {
|
|
11405
11405
|
const [latest, setLatest] = (0, react.useState)(null);
|
|
11406
11406
|
(0, react.useEffect)(() => {
|
|
11407
|
-
if ("0.62.
|
|
11407
|
+
if ("0.62.3".includes("-dev")) return;
|
|
11408
11408
|
let on = true;
|
|
11409
11409
|
fetchLatestVersion().then((v) => {
|
|
11410
11410
|
if (on && v) setLatest(v);
|
|
@@ -11413,8 +11413,8 @@ window.__ModuleLoader__.load({
|
|
|
11413
11413
|
on = false;
|
|
11414
11414
|
};
|
|
11415
11415
|
}, []);
|
|
11416
|
-
const update = latest !== null && isNewerVersion(latest, "0.62.
|
|
11417
|
-
const nameText = "dsh-context (v0.62.
|
|
11416
|
+
const update = latest !== null && isNewerVersion(latest, "0.62.3") ? latest : null;
|
|
11417
|
+
const nameText = "dsh-context (v0.62.3)";
|
|
11418
11418
|
const nameValue = [nameText];
|
|
11419
11419
|
if (update) nameValue.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
11420
11420
|
className: "lc-pi-update",
|
package/lib/index.d.ts
CHANGED
|
@@ -638,20 +638,26 @@ interface ToolTimingTotals {
|
|
|
638
638
|
* own embedded stream (`assistant/message.data.stream` /
|
|
639
639
|
* `assistant/attempt.data.stream`), matching the harness's own
|
|
640
640
|
* session-stats fold. Durations are wall-clock milliseconds: `wallMs` sums
|
|
641
|
-
* whole steps, `ttftMs` the step-start →
|
|
642
|
-
* and `genMs` the
|
|
641
|
+
* whole steps, `ttftMs` the step-start → decode-start slice (the model wait)
|
|
642
|
+
* and `genMs` the decode-start → assistant-message slice (the generation) —
|
|
643
643
|
* both only over calls whose stream carried a token delta, `toolsMs` the sum
|
|
644
644
|
* of per-call tool durations (parallel calls each count, so it can overlap).
|
|
645
|
-
*
|
|
645
|
+
* The decode window opens at the first OBSERVABLE instant — the first token,
|
|
646
|
+
* or an earlier `block-start` marker the token packing could not stamp (a
|
|
647
|
+
* redacted reasoning block leaves no chunk behind): anchoring at the token
|
|
648
|
+
* would charge the marker-tiled window to the wait as well, double-counting
|
|
649
|
+
* it past 100% in the legend. Absent until the first step lifecycle
|
|
650
|
+
* completes in the log.
|
|
646
651
|
*
|
|
647
652
|
* The generation window itself splits by WHAT was being decoded, off the
|
|
648
653
|
* stream's `block-start` framing (`blockType`): `reasoningMs` (the model's
|
|
649
654
|
* thinking), `textMs` (the answer text), and `toolArgMs` (the tool-call
|
|
650
655
|
* arguments). Each marker owns the interval up to the next one (the last one
|
|
651
|
-
* up to the assistant message), so the three tile the marker span
|
|
652
|
-
*
|
|
653
|
-
*
|
|
654
|
-
*
|
|
656
|
+
* up to the assistant message), so the three tile the marker span — exactly
|
|
657
|
+
* `genMs` when the first marker leads the first token (the window opens
|
|
658
|
+
* there); when the first marker sits marginally PAST the token the lead-in
|
|
659
|
+
* gap stays inside `genMs` unattributed, so the buckets never exceed it.
|
|
660
|
+
* They are ADDITIVE-OPTIONAL: cached projection rows written before
|
|
655
661
|
* the split carry `genMs` without them, so the card falls back to the
|
|
656
662
|
* un-split shape instead of the cache row being discarded (the
|
|
657
663
|
* stateVersion-15 rationale in host/timeline.ts).
|
|
@@ -659,9 +665,9 @@ interface ToolTimingTotals {
|
|
|
659
665
|
interface TimingTotals {
|
|
660
666
|
/** Summed wall time of completed steps (the session's active time). */
|
|
661
667
|
wallMs: number;
|
|
662
|
-
/** Summed step-start →
|
|
668
|
+
/** Summed step-start → decode-start time (the model wait, TTFT). */
|
|
663
669
|
ttftMs: number;
|
|
664
|
-
/** Summed
|
|
670
|
+
/** Summed decode-start → assistant-message time (the generation). */
|
|
665
671
|
genMs: number;
|
|
666
672
|
/** Reasoning-decode slice of `genMs` (the model's thinking). */
|
|
667
673
|
reasoningMs?: number;
|
|
@@ -687,7 +693,9 @@ interface TimingTotals {
|
|
|
687
693
|
* output tokens and `speedMs` the first-token → assistant-message
|
|
688
694
|
* windows, over the calls that carried BOTH a first-token stamp and a
|
|
689
695
|
* usage report — a subset of `genMs`, which counts every token-stamped
|
|
690
|
-
* call regardless of usage.
|
|
696
|
+
* call regardless of usage. `speedMs` KEEPS the first-token anchor (not
|
|
697
|
+
* the marker-aware decode start): it is the harness-parity figure.
|
|
698
|
+
* Additive-optional: cached rows written before
|
|
691
699
|
* the seat existed lack them, and the card falls back to no chip.
|
|
692
700
|
*/
|
|
693
701
|
speedTokens?: number;
|
package/lib/index.js
CHANGED
|
@@ -1592,11 +1592,11 @@ function applyTimeline(state, event, bounds) {
|
|
|
1592
1592
|
if (stepStart !== void 0) {
|
|
1593
1593
|
const firstToken = stepStart.firstToken ?? firstTokenTimeOfStream(data?.stream);
|
|
1594
1594
|
if (firstToken !== void 0) {
|
|
1595
|
-
timing.ttftMs += durOf(stepStart.time, firstToken);
|
|
1596
|
-
timing.genMs += durOf(firstToken, event.time);
|
|
1597
1595
|
const decodeBlocks = decodeSpansOfStream(data?.stream, event.time);
|
|
1598
1596
|
let decodeStart = firstToken;
|
|
1599
1597
|
for (const block of decodeBlocks) decodeStart = Math.min(decodeStart, block.start);
|
|
1598
|
+
timing.ttftMs += durOf(stepStart.time, decodeStart);
|
|
1599
|
+
timing.genMs += durOf(decodeStart, event.time);
|
|
1600
1600
|
const modelSpans = [{
|
|
1601
1601
|
kind: "ttft",
|
|
1602
1602
|
start: stepStart.time,
|
|
@@ -2155,12 +2155,15 @@ const FIRST_PARTY_SOURCES = Object.freeze({
|
|
|
2155
2155
|
* first argument, so `reader.fiber.name` identifies the plugin that is about
|
|
2156
2156
|
* to call `register()`.
|
|
2157
2157
|
*
|
|
2158
|
-
* - The `internal/get` handler records
|
|
2159
|
-
*
|
|
2160
|
-
*
|
|
2161
|
-
*
|
|
2162
|
-
*
|
|
2163
|
-
*
|
|
2158
|
+
* - The `internal/get` handler records the reading fiber's NAME — a scalar,
|
|
2159
|
+
* never the reader context, which would pin the caller's whole agent — and
|
|
2160
|
+
* wraps the tools service's `register` (once per underlying instance —
|
|
2161
|
+
* cordis hands out a fresh traced proxy per read of a tracked service, so
|
|
2162
|
+
* the proxy is peeled to the stable instance first; an earlier wrapper of a
|
|
2163
|
+
* previous hook incarnation is peeled back to the original, so a plugin
|
|
2164
|
+
* reload re-wraps without stacking) to capture the reader at registration
|
|
2165
|
+
* time into a live map. Every wrapper is undone when the plugin unloads:
|
|
2166
|
+
* the original `register` goes back on the instance, unless a newer hook
|
|
2164
2167
|
* incarnation re-wrapped it first (that incarnation's own cleanup then
|
|
2165
2168
|
* owns the restore).
|
|
2166
2169
|
* - When the reader slot is missing, root-named, or this plugin's own (e.g.
|
|
@@ -2221,6 +2224,20 @@ function packageNameFrom(file) {
|
|
|
2221
2224
|
}
|
|
2222
2225
|
}
|
|
2223
2226
|
const FRAME_POSITION = /:\d+:\d+$/;
|
|
2227
|
+
/** Symbol cordis registers (`Symbol.for`) on its traced proxies: reading it
|
|
2228
|
+
* yields the wrapped target — the stable underlying service instance. */
|
|
2229
|
+
const CORDIS_ORIGINAL = Symbol.for("cordis.original");
|
|
2230
|
+
/**
|
|
2231
|
+
* Peel cordis's per-read traced proxy of a tracked service (dsh's ToolRuntime
|
|
2232
|
+
* is one — every `ctx.tools` read returns a fresh proxy closing over the
|
|
2233
|
+
* reader's context) down to the instance it wraps, so identity-keyed
|
|
2234
|
+
* bookkeeping sees one stable object. Plain service objects pass through
|
|
2235
|
+
* unchanged.
|
|
2236
|
+
* @param tools - the value as handed out by a context read.
|
|
2237
|
+
*/
|
|
2238
|
+
function rawInstanceOf(tools) {
|
|
2239
|
+
return tools?.[CORDIS_ORIGINAL] ?? tools;
|
|
2240
|
+
}
|
|
2224
2241
|
/** Package name of this module's own package (self-fallbacks are filtered). */
|
|
2225
2242
|
const selfPackage = packageNameFrom(selfUrl);
|
|
2226
2243
|
/**
|
|
@@ -2279,7 +2296,7 @@ function createToolAttribution(ctx) {
|
|
|
2279
2296
|
const instance = tools;
|
|
2280
2297
|
const wrappedRegister = function(definition) {
|
|
2281
2298
|
const toolName = definition?.name;
|
|
2282
|
-
let owner = lastReader
|
|
2299
|
+
let owner = lastReader;
|
|
2283
2300
|
if (!owner || owner === "root" || owner === self) owner = callerPackageFrom((/* @__PURE__ */ new Error()).stack);
|
|
2284
2301
|
const dispose = original.call(this, definition);
|
|
2285
2302
|
if (typeof toolName === "string" && owner && owner !== "root" && owner !== self && owner !== selfPackage) {
|
|
@@ -2303,14 +2320,14 @@ function createToolAttribution(ctx) {
|
|
|
2303
2320
|
ctx.on("internal/get", (reader, name, _error, next) => {
|
|
2304
2321
|
if (name !== "tools") return next();
|
|
2305
2322
|
const tools = next();
|
|
2306
|
-
lastReader = reader;
|
|
2307
|
-
wrapInstance(tools);
|
|
2323
|
+
lastReader = reader.fiber.name;
|
|
2324
|
+
wrapInstance(rawInstanceOf(tools));
|
|
2308
2325
|
return tools;
|
|
2309
2326
|
});
|
|
2310
2327
|
ctx.effect(() => () => {
|
|
2311
2328
|
for (const restore of patched.splice(0)) restore();
|
|
2312
2329
|
}, "tools.register attribution");
|
|
2313
|
-
const toolsService = ctx.get("tools", false);
|
|
2330
|
+
const toolsService = rawInstanceOf(ctx.get("tools", false));
|
|
2314
2331
|
wrapInstance(toolsService);
|
|
2315
2332
|
const boot = /* @__PURE__ */ new Set();
|
|
2316
2333
|
try {
|
|
@@ -3415,7 +3432,7 @@ function createContextTimelineDefinition(config, slim) {
|
|
|
3415
3432
|
},
|
|
3416
3433
|
init: () => createTimelineState(),
|
|
3417
3434
|
apply: (state, event) => applyTimeline(state, event, bounds),
|
|
3418
|
-
stateVersion:
|
|
3435
|
+
stateVersion: 24
|
|
3419
3436
|
};
|
|
3420
3437
|
}
|
|
3421
3438
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-context",
|
|
3
|
-
"version": "0.62.
|
|
3
|
+
"version": "0.62.3",
|
|
4
4
|
"description": "A DeepSeek Harness plugin for context insight and management, with context dashboard and context command, for understanding how the context is made of, and how it evolves.",
|
|
5
5
|
"icon": "icon.svg",
|
|
6
6
|
"author": "bowenliang123",
|