dsh-ws-recency 0.30.0 → 0.30.1
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/client.js +125 -54
- package/index.js +23 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -102,9 +102,14 @@ DSH 原生的置顶只把会话顶到**它所属工作区分组的第一行**,
|
|
|
102
102
|
- **「参数计入主 agent」开关**(设置 → 通用):工具参数严格说是模型写的,不属于工具消耗。打开后每个工具只算返回结果,参数量并入主 agent——实测一个 pwsh 偏重的会话,pwsh 从 37.6% 掉到约 20%,主 agent 从 40.4% 升到约 58%;
|
|
103
103
|
- **调用次数**:每条横条右侧带「N 次」;图表有一行列头(token / 占比 / 调用)对齐五列;
|
|
104
104
|
- **摘要卡片**:合计(高亮)+ 步数 + 输入(未缓存)+ 缓存命中 + 输出,合计排第一;
|
|
105
|
-
-
|
|
105
|
+
- **三个 tab(0.30.1)**:摘要卡片常驻顶部,下面按「分布统计 / 放大归因 / 放大排行」分页,打开时记住上次停留的 tab:分布统计看「钱花在哪些来源」,放大归因看「上下文什么时候涨起来」,放大排行看「是谁把它撑大的」;
|
|
106
106
|
- **放大成本 / 账单归因(0.25.0)**:账单 = 每步上下文之和,所以一块内容的真实成本不是它出现时的 token 数,而是「token × 之后还会被重读多少步」。放大归因页给出:每步上下文曲线(面积≈账单)、账单构成(工具结果 / 工具参数 / 主 agent / 用户 / 系统)、以及按内容块排序的放大排行——进入第几步、原始 token、重读次数、放大后 token、占整场账单的百分比。单次 9k 的 read 在 350 步的会话里会放大成 300 万 token(约 3% 账单),这样小数字才能读出结论。压缩之后旧内容不再重读,放大窗口会从压缩点截断。
|
|
107
|
-
- **上下文拐点(0.30.0)**:曲线上的圆点标出上下文涨得最陡的步,颜色表示段内排名(第 1 红、第 2 黄、第 3
|
|
107
|
+
- **上下文拐点(0.30.0)**:曲线上的圆点标出上下文涨得最陡的步,颜色表示段内排名(第 1 红、第 2 黄、第 3 蓝),悬停圆点或下方的数字,两边一起高亮。**按压缩分段**:压缩会重置上下文,跨压缩点比较涨幅没有意义,所以每段各自取涨幅最大的三步;压缩点用一条淡竖线标在曲线上。下面每行一个拐点,四列对齐(段 / 步号 / 涨幅 / 谁进来的),段号只在每组第一行出现。
|
|
108
|
+
|
|
109
|
+
- **一步 = 一次模型调用(0.30.1)**:所以「第 58 步」指这场会话第 58 次调用模型,不是第 58 行对话;
|
|
110
|
+
- **谁进来的(0.30.1)**:每根柱覆盖十几步,靠「进入步正好等于涨幅步」几乎永远对不上,所以由宿主算好——每根柱标出这一桶步数里**第一个出现、token 最多**的内容块(工具名 + 文件名),完整路径在悬停里;
|
|
111
|
+
- **放大排行(0.30.1)**:账单构成和按内容块排序的清单单独一个 tab。开头写明「内容大小 × 之后重读次数」这个乘法:分布统计的数字只算内容本身多大,两个 tab 的数不能直接比,能横向比的是占比。每行的说明也改成乘法在前(`8.9K token × 1019 次重读 · 第 3 步进入`);
|
|
112
|
+
- **精确值(0.30.1)**:所有金额(卡片、横条、排行)悬停显示完整 token 数,不用自己换算 K/M。
|
|
108
113
|
|
|
109
114
|
面板底部只有一条口径说明(原来两个 tab 各有一条相同的话)。
|
|
110
115
|
|
|
@@ -205,7 +210,7 @@ dsh plugin --profile <profile> add github:chyxhtc/dsh-ws-recency
|
|
|
205
210
|
或固定版本的预构建包:
|
|
206
211
|
|
|
207
212
|
```powershell
|
|
208
|
-
dsh plugin --profile <profile> add https://github.com/chyxhtc/dsh-ws-recency/releases/download/v0.30.
|
|
213
|
+
dsh plugin --profile <profile> add https://github.com/chyxhtc/dsh-ws-recency/releases/download/v0.30.1/dsh-ws-recency-0.30.1.tgz
|
|
209
214
|
```
|
|
210
215
|
|
|
211
216
|
装完把 `dsh-ws-recency` 加进 `~/.hypers-work/profiles/<profile>/package.json` 的 `dsh.profile.bundles`,重启应用。
|
package/client.js
CHANGED
|
@@ -316,21 +316,19 @@
|
|
|
316
316
|
".wsr-context-jump-hit[data-wsr-rank=\"3\"] .wsr-context-jump-dot{background:#4f9df7}",
|
|
317
317
|
".wsr-context-jump-hit-hot .wsr-context-jump-dot{transform:scale(1.8);box-shadow:0 0 0 4px rgba(217,154,43,.25)}",
|
|
318
318
|
".wsr-context-jump:hover .wsr-context-bar-inner{filter:brightness(1.15)}",
|
|
319
|
-
".wsr-context-jumps{display:
|
|
320
|
-
".wsr-context-
|
|
321
|
-
/*
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
".wsr-context-jump-
|
|
325
|
-
".wsr-context-jump-
|
|
326
|
-
".wsr-context-jump-row{display:grid;grid-template-columns:8px auto 1fr;align-items:center;gap:5px;padding:1px 5px;border-radius:4px;transition:background .12s,color .12s}",
|
|
327
|
-
".wsr-context-jump-rank{display:inline-flex;align-items:center}",
|
|
328
|
-
".wsr-context-jump-rank-dot{width:6px;height:6px;border-radius:50%;background:#d99a2b}",
|
|
319
|
+
".wsr-context-jumps{display:flex;flex-direction:column;gap:2px;margin-top:2px}",
|
|
320
|
+
".wsr-context-jump-group{display:flex;flex-direction:column;gap:2px}",
|
|
321
|
+
/* Fixed columns on every row is what aligns them: each row is its own
|
|
322
|
+
grid, so `auto` widths would drift with the numbers they hold. */
|
|
323
|
+
".wsr-context-jump-row{display:grid;grid-template-columns:40px 84px 62px minmax(0,1fr);align-items:center;gap:10px;font-size:11px;color:var(--dsw-alias-label-secondary);padding:1px 5px;border-radius:4px;transition:background .12s,color .12s}",
|
|
324
|
+
".wsr-context-jump-segment{color:var(--dsw-alias-label-tertiary);white-space:nowrap}",
|
|
325
|
+
".wsr-context-jump-rank-dot{flex:none;width:6px;height:6px;border-radius:50%;background:#d99a2b}",
|
|
329
326
|
".wsr-context-jump-row[data-wsr-rank=\"1\"] .wsr-context-jump-rank-dot{background:#f0553d}",
|
|
330
327
|
".wsr-context-jump-row[data-wsr-rank=\"2\"] .wsr-context-jump-rank-dot{background:#f5c542}",
|
|
331
328
|
".wsr-context-jump-row[data-wsr-rank=\"3\"] .wsr-context-jump-rank-dot{background:#4f9df7}",
|
|
332
|
-
".wsr-context-jump-step{white-space:nowrap}",
|
|
329
|
+
".wsr-context-jump-step{display:flex;align-items:center;gap:6px;white-space:nowrap}",
|
|
333
330
|
".wsr-context-jump-rise{text-align:right;font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary)}",
|
|
331
|
+
".wsr-context-jump-what{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary)}",
|
|
334
332
|
".wsr-context-jump-row-hot{background:rgba(217,154,43,.16);color:var(--dsw-alias-label-primary)}",
|
|
335
333
|
".wsr-kind-legend{display:flex;flex-wrap:wrap;gap:10px}",
|
|
336
334
|
".wsr-kind{display:flex;align-items:center;gap:5px;font-size:11px;color:var(--dsw-alias-label-tertiary)}",
|
|
@@ -344,6 +342,8 @@
|
|
|
344
342
|
".wsr-amplified-value{text-align:right;font-weight:600;font-variant-numeric:tabular-nums;font-size:12px}",
|
|
345
343
|
".wsr-amplified-share{text-align:right;color:var(--dsw-alias-label-tertiary);font-size:11px;font-variant-numeric:tabular-nums}",
|
|
346
344
|
".wsr-amplified-empty{font-size:11px;color:var(--dsw-alias-label-tertiary)}",
|
|
345
|
+
".wsr-amplified-subtitle{font-size:11px;font-weight:600;color:var(--dsw-alias-label-secondary);margin-top:4px}",
|
|
346
|
+
".wsr-amplified-lead{font-size:11px;line-height:1.6;color:var(--dsw-alias-label-tertiary)}",
|
|
347
347
|
".wsr-stats-footnote{padding-top:6px;border-top:.5px solid rgba(255,255,255,.06)}",
|
|
348
348
|
".wsr-toggle{width:100%;height:28px;padding:0 12px 0 calc(28px + var(--dsh-workspace-indent,0px));cursor:pointer;text-align:left;color:var(--dsw-alias-label-tertiary);background:0 0;border:none;font-size:12px}",
|
|
349
349
|
".wsr-toggle:hover{color:var(--dsw-alias-label-secondary)}",
|
|
@@ -414,7 +414,7 @@
|
|
|
414
414
|
"stats.col.source": "\u6765\u6e90",
|
|
415
415
|
"stats.col.calls": "\u8c03\u7528",
|
|
416
416
|
"stats.callsShort": "{n} 次",
|
|
417
|
-
"stats.col.tokensShort": "
|
|
417
|
+
"stats.col.tokensShort": "内容估算",
|
|
418
418
|
"stats.col.shareShort": "占比",
|
|
419
419
|
"stats.col.args": "\u53c2\u6570",
|
|
420
420
|
"stats.col.results": "\u7ed3\u679c",
|
|
@@ -535,14 +535,16 @@
|
|
|
535
535
|
"stats.barTooltip": "{name} 共 {total}:参数 {args}({argsShare}),结果 {results}({resultsShare})",
|
|
536
536
|
"stats.argModeNote": "当前把工具参数计入主 agent:每个工具只算返回结果,表格里「参数」列显示为淡色(那些 token 记在主 agent 那一行)。",
|
|
537
537
|
"stats.amplified.title": "放大成本(账单归因)",
|
|
538
|
+
"stats.amplified.kindTitle": "账单构成",
|
|
539
|
+
"stats.amplified.lead": "按「内容大小 × 之后重读次数」排序:一块内容读进来一次,之后每一步都会再发一遍,乘上重读次数才是它真正的开销。上面的分布统计只算内容本身多大,两个数不能直接比。",
|
|
538
540
|
"stats.amplified.summary": "账单 {bill} token;可归因内容经重读放大后占 {share}({attributed})",
|
|
539
|
-
"stats.amplified.contextCaption": "
|
|
541
|
+
"stats.amplified.contextCaption": "每步上下文(面积≈账单):一步=一次模型调用,越早进入的内容被重读越多",
|
|
540
542
|
"stats.amplified.point": "第 {step} 步 · {context}",
|
|
541
543
|
"stats.amplified.jump": "第 {step} 步上下文涨了 {rise}",
|
|
542
544
|
"stats.amplified.jumpStep": "第 {step} 步",
|
|
543
545
|
"stats.amplified.segment": "第 {segment} 段",
|
|
544
546
|
"stats.amplified.jumpFrom": "({name} 进来 {tokens})",
|
|
545
|
-
"stats.amplified.meta": "
|
|
547
|
+
"stats.amplified.meta": "{tokens} token × {remaining} 次重读 · 第 {entry} 步进入",
|
|
546
548
|
"stats.amplified.whatIf": "若压到 20%,可省 {save}({share})",
|
|
547
549
|
"stats.amplified.empty": "没有可归因的放大内容(压缩后或旧日志可能缺失)",
|
|
548
550
|
"stats.amplified.note": "放大成本按内容长度估算;账单总量来自真实 usage。思维链通常不回传,故未计入。",
|
|
@@ -553,6 +555,7 @@
|
|
|
553
555
|
"stats.amplified.system": "系统消息",
|
|
554
556
|
"stats.tab.distribution": "分布统计",
|
|
555
557
|
"stats.tab.amplified": "放大归因",
|
|
558
|
+
"stats.tab.ranking": "放大排行",
|
|
556
559
|
"stats.tab.details": "明细",
|
|
557
560
|
"trash.confirm": "\u5220\u9664\u8fd9\u4e2a\u4f1a\u8bdd\uff1f\n\n\u4f1a\u5148\u505c\u6b62\u5b83\u6b63\u5728\u8fdb\u884c\u7684\u5de5\u4f5c\uff0c\u518d\u628a\u65e5\u5fd7\u76ee\u5f55\u79fb\u5165\u56de\u6536\u7ad9\uff08\u4e0d\u662f\u7269\u7406\u5220\u9664\uff0c\u53ef\u4ee5\u624b\u52a8\u6062\u590d\uff09\u3002",
|
|
558
561
|
"trash.failed": "\u5220\u9664\u5931\u8d25\uff1a",
|
|
@@ -596,7 +599,7 @@
|
|
|
596
599
|
"stats.col.source": "source",
|
|
597
600
|
"stats.col.calls": "calls",
|
|
598
601
|
"stats.callsShort": "{n}x",
|
|
599
|
-
"stats.col.tokensShort": "
|
|
602
|
+
"stats.col.tokensShort": "content est.",
|
|
600
603
|
"stats.col.shareShort": "share",
|
|
601
604
|
"stats.col.args": "args",
|
|
602
605
|
"stats.col.results": "results",
|
|
@@ -716,14 +719,16 @@
|
|
|
716
719
|
"stats.barTooltip": "{name}: {total} total - arguments {args} ({argsShare}), results {results} ({resultsShare})",
|
|
717
720
|
"stats.argModeNote": "Tool arguments currently count towards the agent: each tool shows only its results, and the table's \"args\" column is faded because those tokens sit on the agent's row.",
|
|
718
721
|
"stats.amplified.title": "Amplified cost (what the bill pays for)",
|
|
722
|
+
"stats.amplified.kindTitle": "What the bill is made of",
|
|
723
|
+
"stats.amplified.lead": "Ranked by content size × the later steps that re-read it: content is re-sent on every step after it enters, so the multiplier is what the bill actually pays. The distribution tab measures only the content itself, so the two numbers do not compare directly.",
|
|
719
724
|
"stats.amplified.summary": "Bill {bill} tokens; attributable content amplifies to {share} ({attributed})",
|
|
720
|
-
"stats.amplified.contextCaption": "Context per step (area ≈ bill): earlier content is re-read more",
|
|
725
|
+
"stats.amplified.contextCaption": "Context per step (area ≈ bill): one step is one model call; earlier content is re-read more",
|
|
721
726
|
"stats.amplified.point": "step {step} · {context}",
|
|
722
727
|
"stats.amplified.jump": "step {step} grew by {rise}",
|
|
723
728
|
"stats.amplified.jumpStep": "step {step}",
|
|
724
729
|
"stats.amplified.segment": "seg {segment}",
|
|
725
730
|
"stats.amplified.jumpFrom": "({name} brought {tokens})",
|
|
726
|
-
"stats.amplified.meta": "
|
|
731
|
+
"stats.amplified.meta": "{tokens} tokens × {remaining} re-reads · entered at step {entry}",
|
|
727
732
|
"stats.amplified.whatIf": "at 20%, saves {save} ({share})",
|
|
728
733
|
"stats.amplified.empty": "No amplifiable content (compacted or older logs may lack it)",
|
|
729
734
|
"stats.amplified.note": "Amplified cost is estimated from content length; the bill total comes from real usage. Reasoning is usually not resent, so it is excluded.",
|
|
@@ -734,6 +739,7 @@
|
|
|
734
739
|
"stats.amplified.system": "system messages",
|
|
735
740
|
"stats.tab.distribution": "Distribution",
|
|
736
741
|
"stats.tab.amplified": "Amplified",
|
|
742
|
+
"stats.tab.ranking": "Ranking",
|
|
737
743
|
"stats.tab.details": "Details",
|
|
738
744
|
"trash.confirm": "Delete this session?\n\nIt stops whatever the session is running, then moves the log directory into the trash folder (a move, not an erase: you can restore it by hand).",
|
|
739
745
|
"trash.failed": "Delete failed: ",
|
|
@@ -2071,9 +2077,10 @@
|
|
|
2071
2077
|
}
|
|
2072
2078
|
track.appendChild(group);
|
|
2073
2079
|
line.appendChild(track);
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2080
|
+
var valueCell = statsDiv("wsr-chart-value", formatTokens(entry.value));
|
|
2081
|
+
valueCell.setAttribute("title", String(Math.round(entry.value)) + " tokens");
|
|
2082
|
+
line.appendChild(valueCell);
|
|
2083
|
+
line.appendChild(statsDiv("wsr-chart-share", formatShare(entry.share))); /* The count the chart cannot draw: a bar says how heavy a source is,
|
|
2077
2084
|
the call count says how often it got there. The details table used to
|
|
2078
2085
|
be the only place for it. It always renders (empty for rows without
|
|
2079
2086
|
a count) so the five-column grid stays aligned. */
|
|
@@ -2202,6 +2209,23 @@
|
|
|
2202
2209
|
}
|
|
2203
2210
|
}
|
|
2204
2211
|
|
|
2212
|
+
/**
|
|
2213
|
+
* A short "what entered" label for a jump row.
|
|
2214
|
+
*
|
|
2215
|
+
* The detail is often a full path or a whole command; the row has one
|
|
2216
|
+
* narrow cell. Keep the tool name and the last path segment, and let the
|
|
2217
|
+
* tooltip carry the rest.
|
|
2218
|
+
*/
|
|
2219
|
+
function jumpWhatOf(name, detail) {
|
|
2220
|
+
if (typeof name !== "string" || name === "") return "";
|
|
2221
|
+
if (typeof detail !== "string" || detail === "") return name;
|
|
2222
|
+
var text = detail.trim();
|
|
2223
|
+
var cut = Math.max(text.lastIndexOf("/"), text.lastIndexOf("\\"));
|
|
2224
|
+
if (cut !== -1 && cut < text.length - 1) text = text.slice(cut + 1);
|
|
2225
|
+
if (text.length > 22) text = text.slice(0, 21) + "…";
|
|
2226
|
+
return name + " " + text;
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2205
2229
|
/**
|
|
2206
2230
|
* The steepest rise in each compaction segment.
|
|
2207
2231
|
*
|
|
@@ -2232,7 +2256,10 @@
|
|
|
2232
2256
|
if (rise <= 0) continue;
|
|
2233
2257
|
var segment = segmentOf(to);
|
|
2234
2258
|
if (bySegment[segment] === undefined) bySegment[segment] = [];
|
|
2235
|
-
|
|
2259
|
+
/* `from` is the previous bar's step: on a downsampled curve one bar
|
|
2260
|
+
stands for several steps, and the content that entered during that
|
|
2261
|
+
span is what made it rise. The host labels each point with it. */
|
|
2262
|
+
bySegment[segment].push({ step: to, from: from, rise: rise, entered: series[i].entered || null });
|
|
2236
2263
|
}
|
|
2237
2264
|
var total = compactions.length + 1;
|
|
2238
2265
|
var picked = [];
|
|
@@ -2257,24 +2284,42 @@
|
|
|
2257
2284
|
}
|
|
2258
2285
|
for (var k = 0; k < chosen.length; k += 1) {
|
|
2259
2286
|
var best = chosen[k];
|
|
2260
|
-
/* The
|
|
2261
|
-
|
|
2287
|
+
/* The host labels each curve point with the biggest content block
|
|
2288
|
+
that first appeared inside it. That is the honest attribution: a
|
|
2289
|
+
bar spans several steps, so `entry === step` almost never holds,
|
|
2290
|
+
and guessing "the most recent entrant" pointed at the system
|
|
2291
|
+
prompt instead of the file that actually landed. */
|
|
2262
2292
|
var block = null;
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2293
|
+
var blockName = "";
|
|
2294
|
+
var blockDetail = "";
|
|
2295
|
+
var blockTokens = 0;
|
|
2296
|
+
if (best.entered !== null && best.entered !== undefined) {
|
|
2297
|
+
blockName = best.entered.kind === "tool" ? String(best.entered.name) : t("stats.agent");
|
|
2298
|
+
blockDetail = typeof best.entered.detail === "string" ? best.entered.detail : "";
|
|
2299
|
+
blockTokens = Number(best.entered.tokens) || 0;
|
|
2300
|
+
} else {
|
|
2301
|
+
/* An older host half sends no labels: fall back to the block that
|
|
2302
|
+
entered inside this span, and never to an unrelated older one. */
|
|
2303
|
+
for (var b = 0; b < blocks.length; b += 1) {
|
|
2304
|
+
var candidate = blocks[b];
|
|
2305
|
+
var entry = Number(candidate.entry);
|
|
2306
|
+
if (entry > best.step || entry <= best.from) continue;
|
|
2307
|
+
if (block === null || Number(candidate.tokens) > Number(block.tokens)) block = candidate;
|
|
2308
|
+
}
|
|
2309
|
+
if (block !== null) {
|
|
2310
|
+
blockName = block.kind === "tool" ? String(block.name) : t("stats.agent");
|
|
2311
|
+
if (typeof block.detail === "string" && block.detail !== "") blockDetail = block.detail;
|
|
2312
|
+
blockTokens = Number(block.tokens) || 0;
|
|
2313
|
+
}
|
|
2267
2314
|
}
|
|
2268
2315
|
var label = t("stats.amplified.jump", {
|
|
2269
2316
|
step: String(best.step),
|
|
2270
2317
|
rise: formatTokens(best.rise),
|
|
2271
2318
|
});
|
|
2272
|
-
|
|
2273
|
-
if (block !== null && Number(block.entry) === best.step) {
|
|
2274
|
-
blockName = block.kind === "tool" ? String(block.name) : t("stats.agent");
|
|
2319
|
+
if (blockName !== "") {
|
|
2275
2320
|
label += " " + t("stats.amplified.jumpFrom", {
|
|
2276
|
-
name: blockName,
|
|
2277
|
-
tokens: formatTokens(
|
|
2321
|
+
name: blockDetail === "" ? blockName : blockName + " " + blockDetail,
|
|
2322
|
+
tokens: formatTokens(blockTokens),
|
|
2278
2323
|
});
|
|
2279
2324
|
}
|
|
2280
2325
|
picked.push({
|
|
@@ -2285,6 +2330,7 @@
|
|
|
2285
2330
|
"first" markers apart when a session compacted more than once. */
|
|
2286
2331
|
rank: k + 1,
|
|
2287
2332
|
blockName: blockName,
|
|
2333
|
+
blockDetail: blockDetail,
|
|
2288
2334
|
label: label,
|
|
2289
2335
|
});
|
|
2290
2336
|
}
|
|
@@ -2362,31 +2408,40 @@
|
|
|
2362
2408
|
section.appendChild(chart);
|
|
2363
2409
|
section.appendChild(statsDiv("wsr-context-caption", t("stats.amplified.contextCaption")));
|
|
2364
2410
|
if (jumps.length > 0) {
|
|
2365
|
-
/* One
|
|
2366
|
-
|
|
2367
|
-
|
|
2411
|
+
/* One row per rise, in fixed columns (segment / step / rise / what).
|
|
2412
|
+
Packing three rises onto one line truncated every label, and a row
|
|
2413
|
+
per rise with prose labels was too tall; four fixed columns give
|
|
2414
|
+
both: aligned numbers and room for the file name. */
|
|
2368
2415
|
var segments = [];
|
|
2369
2416
|
for (var js = 0; js < jumps.length; js += 1) {
|
|
2370
2417
|
if (segments.indexOf(jumps[js].segment) === -1) segments.push(jumps[js].segment);
|
|
2371
2418
|
}
|
|
2372
2419
|
var multiSegment = segments.length > 1;
|
|
2373
|
-
var jumpList = statsDiv("wsr-context-jumps"
|
|
2420
|
+
var jumpList = statsDiv("wsr-context-jumps");
|
|
2374
2421
|
for (var sg = 0; sg < segments.length; sg += 1) {
|
|
2375
2422
|
var group = statsDiv("wsr-context-jump-group");
|
|
2376
|
-
|
|
2377
|
-
group.appendChild(statsDiv("wsr-context-jump-segment", t("stats.amplified.segment", { segment: String(segments[sg]) })));
|
|
2378
|
-
}
|
|
2423
|
+
var firstOfSegment = true;
|
|
2379
2424
|
for (var jl = 0; jl < jumps.length; jl += 1) {
|
|
2380
2425
|
if (jumps[jl].segment !== segments[sg]) continue;
|
|
2381
2426
|
var jumpRow = statsDiv("wsr-context-jump-row");
|
|
2382
2427
|
jumpRow.setAttribute("data-wsr-jump-row", String(jumps[jl].step));
|
|
2383
2428
|
jumpRow.setAttribute("data-wsr-rank", String(jumps[jl].rank));
|
|
2384
2429
|
jumpRow.setAttribute("title", jumps[jl].label);
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2430
|
+
/* The segment is named once per group, not on every row. */
|
|
2431
|
+
jumpRow.appendChild(statsDiv(
|
|
2432
|
+
"wsr-context-jump-segment",
|
|
2433
|
+
multiSegment && firstOfSegment ? t("stats.amplified.segment", { segment: String(segments[sg]) }) : "",
|
|
2434
|
+
));
|
|
2435
|
+
firstOfSegment = false;
|
|
2436
|
+
var stepCell = statsDiv("wsr-context-jump-step");
|
|
2437
|
+
stepCell.appendChild(statsDiv("wsr-context-jump-rank-dot"));
|
|
2438
|
+
stepCell.appendChild(statsDiv("wsr-context-jump-step-text", t("stats.amplified.jumpStep", { step: String(jumps[jl].step) })));
|
|
2439
|
+
jumpRow.appendChild(stepCell);
|
|
2389
2440
|
jumpRow.appendChild(statsDiv("wsr-context-jump-rise", "+" + formatTokens(jumps[jl].rise)));
|
|
2441
|
+
/* What entered: the tool and a short form of what it touched, so
|
|
2442
|
+
the row answers "which file" instead of only "read". The full
|
|
2443
|
+
detail stays in the tooltip. */
|
|
2444
|
+
jumpRow.appendChild(statsDiv("wsr-context-jump-what", jumpWhatOf(jumps[jl].blockName, jumps[jl].blockDetail)));
|
|
2390
2445
|
group.appendChild(jumpRow);
|
|
2391
2446
|
}
|
|
2392
2447
|
jumpList.appendChild(group);
|
|
@@ -2397,8 +2452,13 @@
|
|
|
2397
2452
|
bar or its row lifts both, which is what "挪上去更明显" means here. */
|
|
2398
2453
|
jumpHoverHosts.push({ chart: chart, list: section });
|
|
2399
2454
|
|
|
2455
|
+
/* The ranking is a separate tab: the curve answers "when", the ranking
|
|
2456
|
+
answers "what", and stacking both in one scroll hid half of each. */
|
|
2457
|
+
var ranking = statsDiv("wsr-amplified wsr-amplified-ranking");
|
|
2458
|
+
ranking.appendChild(statsDiv("wsr-amplified-lead", t("stats.amplified.lead")));
|
|
2400
2459
|
var kinds = amplified.byKind || [];
|
|
2401
2460
|
if (kinds.length > 0) {
|
|
2461
|
+
ranking.appendChild(statsDiv("wsr-amplified-subtitle", t("stats.amplified.kindTitle")));
|
|
2402
2462
|
var legend = statsDiv("wsr-kind-legend");
|
|
2403
2463
|
for (var k = 0; k < kinds.length; k += 1) {
|
|
2404
2464
|
var kind = kinds[k];
|
|
@@ -2410,7 +2470,7 @@
|
|
|
2410
2470
|
item.appendChild(statsDiv("", t(known === undefined ? kind.kind : known[0]) + " " + formatShare(kind.share || 0)));
|
|
2411
2471
|
legend.appendChild(item);
|
|
2412
2472
|
}
|
|
2413
|
-
|
|
2473
|
+
ranking.appendChild(legend);
|
|
2414
2474
|
}
|
|
2415
2475
|
|
|
2416
2476
|
var list = statsDiv("wsr-amplified-list");
|
|
@@ -2429,12 +2489,16 @@
|
|
|
2429
2489
|
remaining: String(block.remaining),
|
|
2430
2490
|
})));
|
|
2431
2491
|
row.appendChild(main);
|
|
2432
|
-
|
|
2492
|
+
var valueCell = statsDiv("wsr-amplified-value", formatTokens(block.amplified));
|
|
2493
|
+
/* The exact count, so a number here can be matched against the same
|
|
2494
|
+
figure on the distribution tab without converting K/M by hand. */
|
|
2495
|
+
valueCell.setAttribute("title", String(Math.round(Number(block.amplified) || 0)) + " tokens");
|
|
2496
|
+
row.appendChild(valueCell);
|
|
2433
2497
|
row.appendChild(statsDiv("wsr-amplified-share", formatShare(block.share || 0)));
|
|
2434
2498
|
list.appendChild(row);
|
|
2435
2499
|
}
|
|
2436
|
-
|
|
2437
|
-
return section;
|
|
2500
|
+
ranking.appendChild(list);
|
|
2501
|
+
return { top: section, ranking: ranking };
|
|
2438
2502
|
}
|
|
2439
2503
|
|
|
2440
2504
|
function renderStats(body, stats) {
|
|
@@ -2451,15 +2515,19 @@
|
|
|
2451
2515
|
var grid = document.createElement("div");
|
|
2452
2516
|
grid.className = "wsr-stats-grid";
|
|
2453
2517
|
var cards = [
|
|
2454
|
-
[t("stats.total"), formatTokens(totals.totalTokens), true],
|
|
2455
|
-
[t("stats.steps"), formatTokens(stats.steps), false],
|
|
2456
|
-
[t("stats.input"), formatTokens(totals.inputTokens), false],
|
|
2457
|
-
[t("stats.cache"), formatTokens(totals.cacheReadTokens), false],
|
|
2458
|
-
[t("stats.output"), formatTokens(totals.outputTokens), false],
|
|
2518
|
+
[t("stats.total"), formatTokens(totals.totalTokens), true, Number(totals.totalTokens) || 0],
|
|
2519
|
+
[t("stats.steps"), formatTokens(stats.steps), false, Number(stats.steps) || 0],
|
|
2520
|
+
[t("stats.input"), formatTokens(totals.inputTokens), false, Number(totals.inputTokens) || 0],
|
|
2521
|
+
[t("stats.cache"), formatTokens(totals.cacheReadTokens), false, Number(totals.cacheReadTokens) || 0],
|
|
2522
|
+
[t("stats.output"), formatTokens(totals.outputTokens), false, Number(totals.outputTokens) || 0],
|
|
2459
2523
|
];
|
|
2460
2524
|
for (var i = 0; i < cards.length; i += 1) {
|
|
2461
2525
|
var card = statsDiv("wsr-stats-card" + (cards[i][2] === true ? " wsr-stats-card-primary" : ""));
|
|
2462
|
-
|
|
2526
|
+
var valueCell = statsDiv("wsr-stats-value", cards[i][1]);
|
|
2527
|
+
/* Numbers auto-scale to K/M/B; the exact count on hover is what makes
|
|
2528
|
+
two tabs comparable without converting units in your head. */
|
|
2529
|
+
valueCell.setAttribute("title", String(cards[i][3]));
|
|
2530
|
+
card.appendChild(valueCell);
|
|
2463
2531
|
card.appendChild(statsDiv("wsr-stats-label", cards[i][0]));
|
|
2464
2532
|
grid.appendChild(card);
|
|
2465
2533
|
}
|
|
@@ -2572,8 +2640,11 @@
|
|
|
2572
2640
|
var defs = [["distribution", "stats.tab.distribution", distributionPanel]];
|
|
2573
2641
|
if (amplifiedSection !== null) {
|
|
2574
2642
|
var amplifiedPanel = statsDiv("wsr-stats-panel");
|
|
2575
|
-
amplifiedPanel.appendChild(amplifiedSection);
|
|
2643
|
+
amplifiedPanel.appendChild(amplifiedSection.top);
|
|
2576
2644
|
defs.push(["amplified", "stats.tab.amplified", amplifiedPanel]);
|
|
2645
|
+
var rankingPanel = statsDiv("wsr-stats-panel");
|
|
2646
|
+
rankingPanel.appendChild(amplifiedSection.ranking);
|
|
2647
|
+
defs.push(["ranking", "stats.tab.ranking", rankingPanel]);
|
|
2577
2648
|
}
|
|
2578
2649
|
if (mode === "agent") defs[0][2].appendChild(statsDiv("wsr-stats-note", t("stats.argModeNote")));
|
|
2579
2650
|
var tabButtons = {};
|
package/index.js
CHANGED
|
@@ -32,7 +32,7 @@ import { dirname, join } from "node:path";
|
|
|
32
32
|
export const name = "ws-recency";
|
|
33
33
|
|
|
34
34
|
/** Version marker reported by the health route. */
|
|
35
|
-
export const HOST_VERSION = "0.30.
|
|
35
|
+
export const HOST_VERSION = "0.30.1";
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Exact routes the client half calls. Registered on the bare web server, so they
|
|
@@ -578,7 +578,28 @@ export function aggregateSession(events) {
|
|
|
578
578
|
const end = Math.min(totalSteps, start + size);
|
|
579
579
|
let sum = 0;
|
|
580
580
|
for (let index = start; index < end; index += 1) sum += steps[index].input + steps[index].cacheRead;
|
|
581
|
-
|
|
581
|
+
/* What entered during this bucket: the biggest block that first appears
|
|
582
|
+
between these steps. The panel says "step 58 grew 33K" - this is the
|
|
583
|
+
content behind that number. The host is the only side that sees every
|
|
584
|
+
block (the payload carries the top 15), so the attribution is done here
|
|
585
|
+
and each curve point only carries one small label. */
|
|
586
|
+
let entered = null;
|
|
587
|
+
for (const block of blocks) {
|
|
588
|
+
if (block.entry < start || block.entry >= end) continue;
|
|
589
|
+
if (entered === null || block.tokens > entered.tokens) entered = block;
|
|
590
|
+
}
|
|
591
|
+
series.push({
|
|
592
|
+
step: start + 1,
|
|
593
|
+
context: Math.round(sum / (end - start)),
|
|
594
|
+
entered: entered === null
|
|
595
|
+
? null
|
|
596
|
+
: {
|
|
597
|
+
kind: entered.kind,
|
|
598
|
+
name: entered.name,
|
|
599
|
+
detail: typeof entered.detail === "string" ? entered.detail.slice(0, 80) : "",
|
|
600
|
+
tokens: entered.tokens,
|
|
601
|
+
},
|
|
602
|
+
});
|
|
582
603
|
}
|
|
583
604
|
}
|
|
584
605
|
summary.amplified = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-ws-recency",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.1",
|
|
4
4
|
"description": "Sidebar session management for DeepSeek Harness: workspace groups sorted by latest activity, stale history folded, a global pinned section, follow-up marks, session delete into a recoverable trash, archived sessions managed from that same trash panel, per-session token statistics with an argument/result split and an option to count tool arguments as the agent's writing, moving a session to another workspace, and a literal content search that jumps to the turn a word was said in.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "chyxhtc",
|