dsh-session-matrix 0.17.5 → 0.18.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 +5 -2
- package/lib/client.js +123 -78
- package/lib/index.js +152 -13
- package/package.json +2 -2
- package/test/compose.test.mjs +71 -0
package/README.md
CHANGED
|
@@ -181,13 +181,16 @@ DSH 每次压缩都会在会话里留下一个检查点(`compact-checkpoint`
|
|
|
181
181
|
Agent Network,我们用同样的父子关系模型,但放在跨项目的全局视图里。
|
|
182
182
|
|
|
183
183
|
**它现在是可选的,不是依赖。** 早期版本读的是它注册的 `contextTimeline` / `contextActivity` 投影,
|
|
184
|
-
|
|
184
|
+
没装它费用就是空的;现在费用改走 DSH 核心,上下文构成与压缩点改为**从会话日志自算**(0.18.0 起),
|
|
185
|
+
没装它的机器上七项构成也能正常显示:
|
|
185
186
|
|
|
186
187
|
| 数据 | 现在从哪来 | 没装 dsh-context 时 |
|
|
187
188
|
|:--|:--|:--|
|
|
188
189
|
| 模型名 | 核心 `modelSelection` 投影 | 正常 |
|
|
189
190
|
| 用量(四个 token 桶) | 核心 `tokenUsage` 投影(`{ver,seq,val}` 包装已解) | 正常 |
|
|
190
|
-
| 上下文占用 |
|
|
191
|
+
| 上下文占用 | 投影优先;没有则**从会话事件折叠估算**(system / 工具 schema / 各类消息按 4 字符≈1 token 估算) | 正常(估算值) |
|
|
192
|
+
| 上下文构成(七项) | 投影优先;没有则**从会话日志自算**——按事件的类型与 `source.kind` 分成 system / tools / user / inject / skill / assistant / tool,锚定到面板显示的总量 | 正常(与 dsh-context 占比对比平均差异 <1 个百分点) |
|
|
193
|
+
| 压缩点 / 输出预留 | 从日志 `request/context`(contextWindow)与 `request/header`(maxTokens)取 | 正常 |
|
|
191
194
|
| 费用 | 优先用投影的峰谷分桶;没有则**从会话日志重建**峰/谷(每条 `assistant/message` 带 `time` 和 `usage`) | 与装了它基本一致 |
|
|
192
195
|
|
|
193
196
|
装它的收益是**费用更准**(能区分峰谷,等于把白天的 2× 算进去),以及 Context 页那种逐请求的深挖。
|
package/lib/client.js
CHANGED
|
@@ -575,30 +575,32 @@ window.__ModuleLoader__.load({
|
|
|
575
575
|
.aw button{font-family:inherit;font-size:13px;line-height:20px;cursor:pointer;border:0;background:none;color:inherit}
|
|
576
576
|
.aw input{font-family:inherit;font-size:13px;color:inherit}
|
|
577
577
|
.aw-hdr{flex:0 0 auto;display:flex;align-items:center;gap:12px;padding:10px 16px;
|
|
578
|
-
border-bottom:var(--aw-hair) solid var(--dsw-alias-border-l2);min-height:52px;flex-wrap:
|
|
578
|
+
border-bottom:var(--aw-hair) solid var(--dsw-alias-border-l2);min-height:52px;flex-wrap:nowrap;
|
|
579
579
|
container-type:inline-size}
|
|
580
|
+
@container (max-width:1240px){.aw-hdr .opt{display:none}}
|
|
581
|
+
@container (max-width:1040px){.aw-hdr .aw-hbtn-k{display:none}}
|
|
580
582
|
.aw-title{display:flex;align-items:center;gap:8px;font-size:13px;font-weight:600;white-space:nowrap}
|
|
581
583
|
.aw-title svg{width:16px;height:16px;flex:0 0 auto;color:var(--dsw-alias-label-secondary)}
|
|
582
|
-
.aw-sub{font-size:
|
|
584
|
+
.aw-sub{font-size:12.5px;font-weight:400;color:var(--dsw-alias-label-caption)}
|
|
583
585
|
.aw-seg{display:flex;gap:2px;padding:2px;border-radius:var(--aw-r);
|
|
584
586
|
background:var(--dsw-alias-bg-layer-1);border:var(--aw-hair) solid var(--dsw-alias-border-l2)}
|
|
585
|
-
.aw-seg button{padding:3px 12px;border-radius:6px;font-size:
|
|
587
|
+
.aw-seg button{padding:3px 12px;border-radius:6px;font-size:13px;color:var(--dsw-alias-label-tertiary)}
|
|
586
588
|
.aw-seg button:hover{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover)}
|
|
587
589
|
.aw-seg button[aria-selected="true"]{background:var(--dsw-alias-bg-layer-3);
|
|
588
590
|
color:var(--dsw-alias-label-primary);font-weight:500}
|
|
589
591
|
.aw-grow{flex:1 1 auto;min-width:8px}
|
|
590
|
-
.aw-stat{display:flex;align-items:center;gap:12px;font-size:
|
|
591
|
-
color:var(--dsw-alias-label-
|
|
592
|
+
.aw-stat{display:flex;align-items:center;gap:12px;font-size:13px;
|
|
593
|
+
color:var(--dsw-alias-label-secondary);white-space:nowrap}
|
|
592
594
|
.aw-stat b{font-family:var(--aw-mono);font-weight:500;color:var(--dsw-alias-label-secondary);
|
|
593
595
|
font-variant-numeric:tabular-nums}
|
|
594
596
|
.aw-stat .risk{color:var(--dsw-alias-state-warn-label)}
|
|
595
597
|
.aw-field{display:flex;align-items:center;gap:6px;height:28px;padding:0 9px;
|
|
596
598
|
border:var(--aw-hair) solid var(--dsw-alias-border-l3);border-radius:var(--aw-r);
|
|
597
|
-
background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-
|
|
599
|
+
background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-secondary);font-size:13px}
|
|
598
600
|
.aw-field:focus-within{border-color:var(--dsw-alias-border-selected)}
|
|
599
|
-
.aw-field input{border:0;outline:0;background:none;padding:0;min-width:0;flex:1;font-size:
|
|
601
|
+
.aw-field input{border:0;outline:0;background:none;padding:0;min-width:0;flex:1;font-size:13px}
|
|
600
602
|
/* Sort cycle: one 34px pill instead of a dropdown the rail cannot fit. */
|
|
601
|
-
.aw-sort{flex:0 0 auto;height:20px;padding:0 6px;border-radius:10px;font-size:
|
|
603
|
+
.aw-sort{flex:0 0 auto;height:20px;padding:0 6px;border-radius:10px;font-size:11px;
|
|
602
604
|
background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-secondary);
|
|
603
605
|
display:flex;align-items:center;gap:3px;white-space:nowrap}
|
|
604
606
|
.aw-sort:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
|
|
@@ -607,7 +609,7 @@ window.__ModuleLoader__.load({
|
|
|
607
609
|
.aw-btn{display:inline-flex;align-items:center;gap:5px;height:28px;padding:0 10px;
|
|
608
610
|
border:var(--aw-hair) solid var(--dsw-alias-border-l3);border-radius:var(--aw-r);
|
|
609
611
|
background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-secondary);
|
|
610
|
-
font-size:
|
|
612
|
+
font-size:13px;white-space:nowrap}
|
|
611
613
|
.aw-btn:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
|
|
612
614
|
.aw-btn:active{background:var(--dsw-alias-interactive-bg-active)}
|
|
613
615
|
.aw-btn svg{width:14px;height:14px;flex:0 0 auto}
|
|
@@ -632,15 +634,15 @@ window.__ModuleLoader__.load({
|
|
|
632
634
|
.aw-rail-h{flex:0 0 auto;display:flex;flex-direction:column;gap:8px;padding:10px 12px;
|
|
633
635
|
border-bottom:var(--aw-hair) solid var(--dsw-alias-border-l1)}
|
|
634
636
|
.aw-chips{display:flex;gap:4px;flex-wrap:wrap}
|
|
635
|
-
.aw-chip{height:22px;padding:0 8px;border-radius:11px;font-size:
|
|
637
|
+
.aw-chip{height:22px;padding:0 8px;border-radius:11px;font-size:12.5px;
|
|
636
638
|
border:var(--aw-hair) solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-tertiary);
|
|
637
639
|
display:inline-flex;align-items:center;gap:4px;max-width:100%}
|
|
638
640
|
.aw-chip:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
|
|
639
641
|
.aw-chip[aria-pressed="true"]{background:var(--dsw-alias-bg-layer-3);
|
|
640
642
|
border-color:var(--dsw-alias-border-l4);color:var(--dsw-alias-label-primary)}
|
|
641
|
-
.aw-chip .n{font-family:var(--aw-mono);font-size:
|
|
643
|
+
.aw-chip .n{font-family:var(--aw-mono);font-size:11px;color:var(--dsw-alias-label-caption)}
|
|
642
644
|
.aw-rail-list{flex:1 1 auto;min-height:0;overflow:auto;padding:4px 0 12px}
|
|
643
|
-
.aw-rg{padding:8px 12px 2px;font-size:
|
|
645
|
+
.aw-rg{padding:8px 12px 2px;font-size:12.5px;color:var(--dsw-alias-label-caption);
|
|
644
646
|
display:flex;align-items:center;gap:6px}
|
|
645
647
|
.aw-rg .line{flex:1;height:1px;background:var(--dsw-alias-border-l1)}
|
|
646
648
|
.aw-ri{display:flex;align-items:center;gap:7px;padding:3px 12px;cursor:pointer;min-width:0}
|
|
@@ -648,23 +650,23 @@ window.__ModuleLoader__.load({
|
|
|
648
650
|
.aw-ri[aria-current="true"]{background:var(--dsw-alias-bg-multi-select)}
|
|
649
651
|
.aw-ri .st{width:6px;height:6px;border-radius:50%;flex:0 0 auto}
|
|
650
652
|
.aw-ri .body{flex:1;min-width:0}
|
|
651
|
-
.aw-ri .l1{display:flex;align-items:center;gap:6px;font-size:
|
|
653
|
+
.aw-ri .l1{display:flex;align-items:center;gap:6px;font-size:13px;line-height:16px;
|
|
652
654
|
color:var(--dsw-alias-label-primary)}
|
|
653
655
|
.aw-ri .l1 .t{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
654
|
-
.aw-ri .l2{display:flex;align-items:center;gap:6px;font-size:
|
|
656
|
+
.aw-ri .l2{display:flex;align-items:center;gap:6px;font-size:11px;line-height:15px;
|
|
655
657
|
color:var(--dsw-alias-label-caption)}
|
|
656
658
|
.aw-ri .l2 .bar{flex:0 0 44px;height:3px;border-radius:2px;margin-left:auto;
|
|
657
659
|
background:var(--dsw-alias-border-l1);overflow:hidden}
|
|
658
660
|
.aw-ri .l2 .bar i{display:block;height:100%}
|
|
659
|
-
.aw-ri .pc{font-family:var(--aw-mono);font-size:
|
|
661
|
+
.aw-ri .pc{font-family:var(--aw-mono);font-size:11.5px;color:var(--dsw-alias-label-secondary);
|
|
660
662
|
font-variant-numeric:tabular-nums;flex:0 0 auto}
|
|
661
663
|
.aw-rnode{display:flex;flex-direction:column;min-width:0}
|
|
662
664
|
.aw-ri-sub{padding-left:26px;position:relative}
|
|
663
665
|
.aw-ri-sub::before{content:'';position:absolute;left:18px;top:0;bottom:0;width:1px;
|
|
664
666
|
background:var(--dsw-alias-border-l1)}
|
|
665
|
-
.aw-ri-sub .l1{font-size:
|
|
667
|
+
.aw-ri-sub .l1{font-size:13px;color:var(--dsw-alias-label-secondary)}
|
|
666
668
|
.aw-rtoggle{display:flex;align-items:center;gap:6px;padding:1px 12px 5px 28px;
|
|
667
|
-
font-size:
|
|
669
|
+
font-size:12.5px;line-height:16px;color:var(--dsw-alias-label-caption);text-align:left}
|
|
668
670
|
.aw-rtoggle:hover{color:var(--dsw-alias-label-secondary)}
|
|
669
671
|
.aw-rtoggle .caret{width:0;height:0;display:inline-block;
|
|
670
672
|
border-left:4px solid currentColor;border-top:3.5px solid transparent;
|
|
@@ -692,11 +694,11 @@ window.__ModuleLoader__.load({
|
|
|
692
694
|
.aw-pane-h{position:relative;flex:0 0 auto;height:34px;display:flex;align-items:center;gap:8px;padding:0 10px;
|
|
693
695
|
border-bottom:var(--aw-hair) solid var(--dsw-alias-border-l1);min-width:0;
|
|
694
696
|
background:var(--dsw-alias-bg-layer-1);container-type:inline-size}
|
|
695
|
-
.aw-pane-h .t{flex:0 1 auto;min-width:0;max-width:30%;font-size:
|
|
697
|
+
.aw-pane-h .t{flex:0 1 auto;min-width:0;max-width:30%;font-size:13px;color:var(--dsw-alias-label-secondary);
|
|
696
698
|
overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
697
|
-
.aw-pane-h .ctx{flex:0 0 auto;font-size:
|
|
699
|
+
.aw-pane-h .ctx{flex:0 0 auto;font-size:11.5px;color:var(--dsw-alias-label-caption);
|
|
698
700
|
white-space:nowrap;display:inline-flex;align-items:baseline;gap:4px}
|
|
699
|
-
.aw-pane-h .ctx .ctxv{font-family:var(--aw-mono);font-size:
|
|
701
|
+
.aw-pane-h .ctx .ctxv{font-family:var(--aw-mono);font-size:11.5px;
|
|
700
702
|
color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums}
|
|
701
703
|
.aw-pane-h .x{width:22px;height:22px;display:inline-flex;align-items:center;justify-content:center;
|
|
702
704
|
border-radius:4px;color:var(--dsw-alias-label-caption)}
|
|
@@ -709,22 +711,22 @@ window.__ModuleLoader__.load({
|
|
|
709
711
|
.aw-native{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}
|
|
710
712
|
.aw-pane-fallback{flex:1 1 auto;display:flex;flex-direction:column;align-items:center;
|
|
711
713
|
justify-content:center;gap:6px;padding:20px;text-align:center;
|
|
712
|
-
font-size:
|
|
713
|
-
.aw-pane-fallback .sub{font-size:
|
|
714
|
+
font-size:13px;line-height:18px;color:var(--dsw-alias-label-caption)}
|
|
715
|
+
.aw-pane-fallback .sub{font-size:12.5px;opacity:.8}
|
|
714
716
|
.aw-pane-h.warn{box-shadow: inset 2px 0 0 var(--dsw-alias-state-warn-primary)}
|
|
715
717
|
.aw-pane-h.crit{box-shadow: inset 2px 0 0 var(--dsw-alias-state-error-primary)}
|
|
716
|
-
.aw-risk{flex:0 0 auto;font-size:
|
|
718
|
+
.aw-risk{flex:0 0 auto;font-size:10.5px;line-height:15px;padding:0 5px;border-radius:3px;
|
|
717
719
|
font-weight:600;letter-spacing:.02em}
|
|
718
720
|
.aw-risk.warn{color:var(--dsw-alias-state-warn-label);
|
|
719
721
|
background:color-mix(in oklab, var(--dsw-alias-state-warn-primary) 18%, transparent)}
|
|
720
722
|
.aw-risk.crit{color:var(--dsw-alias-state-error-label);
|
|
721
723
|
background:color-mix(in oklab, var(--dsw-alias-state-error-primary) 18%, transparent)}
|
|
722
|
-
.aw-ro{flex:0 0 auto;font-size:
|
|
724
|
+
.aw-ro{flex:0 0 auto;font-size:10.5px;line-height:15px;padding:0 5px;border-radius:3px;
|
|
723
725
|
background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-caption);
|
|
724
726
|
border:var(--aw-hair) solid var(--dsw-alias-border-l1)}
|
|
725
727
|
.aw-zoom{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);
|
|
726
728
|
display:inline-flex;align-items:center;gap:5px;flex:0 0 auto}
|
|
727
|
-
.aw-zoom-k{font-size:
|
|
729
|
+
.aw-zoom-k{font-size:11px;color:var(--dsw-alias-label-caption);white-space:nowrap}
|
|
728
730
|
.aw-zoom-range{-webkit-appearance:none;appearance:none;width:58px;height:14px;
|
|
729
731
|
background:none;cursor:pointer;margin:0}
|
|
730
732
|
.aw-zoom-range::-webkit-slider-runnable-track{height:3px;border-radius:2px;
|
|
@@ -733,7 +735,7 @@ window.__ModuleLoader__.load({
|
|
|
733
735
|
margin-top:-3.5px;border-radius:50%;background:var(--dsw-alias-trajectory-accent);
|
|
734
736
|
border:0;box-shadow:0 0 0 1px var(--dsw-alias-bg-base)}
|
|
735
737
|
.aw-zoom-range:hover::-webkit-slider-thumb{transform:scale(1.15)}
|
|
736
|
-
.aw-zoom-val{font-size:
|
|
738
|
+
.aw-zoom-val{font-size:11px;line-height:14px;color:var(--dsw-alias-label-caption);
|
|
737
739
|
font-variant-numeric:tabular-nums;min-width:28px;text-align:right}
|
|
738
740
|
/* Narrow panes: drop the words, keep the numbers. A 4-up pane is ~420px, and
|
|
739
741
|
the labels are what push the zoom slider into the context figure. */
|
|
@@ -750,9 +752,9 @@ window.__ModuleLoader__.load({
|
|
|
750
752
|
}
|
|
751
753
|
.aw-veil{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;
|
|
752
754
|
justify-content:center;gap:10px;padding:28px;text-align:center;
|
|
753
|
-
background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-tertiary);font-size:
|
|
755
|
+
background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:19px}
|
|
754
756
|
.aw-veil .big{font-size:13px;color:var(--dsw-alias-label-secondary)}
|
|
755
|
-
.aw-veil code{font-family:var(--aw-mono);font-size:
|
|
757
|
+
.aw-veil code{font-family:var(--aw-mono);font-size:12.5px;color:var(--dsw-alias-label-caption);word-break:break-all}
|
|
756
758
|
.aw-veil .row{display:flex;gap:8px;flex-wrap:wrap;justify-content:center}
|
|
757
759
|
|
|
758
760
|
/* ── handoff: top-bar entry, hover card, dialog ── */
|
|
@@ -766,10 +768,10 @@ window.__ModuleLoader__.load({
|
|
|
766
768
|
.aw-tip{position:absolute;top:calc(100% + 8px);right:0;width:268px;z-index:30;padding:9px 10px;
|
|
767
769
|
border-radius:7px;border:var(--aw-hair) solid var(--dsw-alias-border-l3);
|
|
768
770
|
background:var(--dsw-alias-bg-layer-2);box-shadow:0 8px 26px rgba(0,0,0,.2);
|
|
769
|
-
font-size:
|
|
771
|
+
font-size:12.5px;line-height:16px;color:var(--dsw-alias-label-tertiary);
|
|
770
772
|
opacity:0;pointer-events:none;transition:opacity .12s ease .2s;text-align:left}
|
|
771
773
|
.aw-hbtn:hover .aw-tip{opacity:1}
|
|
772
|
-
.aw-tip b{display:block;margin-bottom:4px;font-size:
|
|
774
|
+
.aw-tip b{display:block;margin-bottom:4px;font-size:13px;color:var(--dsw-alias-label-secondary)}
|
|
773
775
|
.aw-tip .sub{margin-top:4px;color:var(--dsw-alias-label-caption)}
|
|
774
776
|
/* Instant tooltips. Native title waits ~1s; these open on hover with no
|
|
775
777
|
delay. Only used on elements whose ancestors do not clip overflow. */
|
|
@@ -777,7 +779,7 @@ window.__ModuleLoader__.load({
|
|
|
777
779
|
[data-tip]::after{content:attr(data-tip);position:absolute;z-index:60;top:calc(100% + 8px);left:0;
|
|
778
780
|
width:max-content;max-width:320px;padding:8px 10px;border-radius:7px;white-space:pre-line;
|
|
779
781
|
border:var(--aw-hair) solid var(--dsw-alias-border-l3);background:var(--dsw-alias-bg-layer-2);
|
|
780
|
-
box-shadow:0 10px 28px rgba(0,0,0,.22);font-size:
|
|
782
|
+
box-shadow:0 10px 28px rgba(0,0,0,.22);font-size:12.5px;line-height:16px;font-weight:400;
|
|
781
783
|
color:var(--dsw-alias-label-tertiary);text-align:left;opacity:0;pointer-events:none;
|
|
782
784
|
transition:opacity .08s ease}
|
|
783
785
|
[data-tip]:hover::after{opacity:1}
|
|
@@ -791,7 +793,7 @@ window.__ModuleLoader__.load({
|
|
|
791
793
|
.aw[data-theme="light"] .aw-modal-c{box-shadow:0 20px 64px rgba(15,23,42,.2)}
|
|
792
794
|
/* Narrow headers keep the icon and drop the words. */
|
|
793
795
|
@container (max-width:880px){ .aw-hbtn-k{display:none} }
|
|
794
|
-
.aw-ver{font-family:var(--aw-mono);font-size:
|
|
796
|
+
.aw-ver{font-family:var(--aw-mono);font-size:11px;color:var(--dsw-alias-label-caption);
|
|
795
797
|
padding:1px 6px;border-radius:8px;background:var(--dsw-alias-bg-layer-2)}
|
|
796
798
|
.aw-modal{position:absolute;inset:0;z-index:40;display:flex;align-items:center;justify-content:center;
|
|
797
799
|
padding:18px;background:rgba(0,0,0,.44);container-type:inline-size}
|
|
@@ -808,23 +810,23 @@ window.__ModuleLoader__.load({
|
|
|
808
810
|
.aw-modal-l{overflow:auto;padding:12px 14px;border-right:var(--aw-hair) solid var(--dsw-alias-border-l1)}
|
|
809
811
|
.aw-modal-r{display:flex;flex-direction:column;min-width:0;gap:6px;padding:12px 14px}
|
|
810
812
|
.aw-modal-r textarea{flex:1 1 auto;min-height:0;width:100%;box-sizing:border-box;resize:none;
|
|
811
|
-
font-family:var(--aw-mono);font-size:
|
|
813
|
+
font-family:var(--aw-mono);font-size:12.5px;line-height:17px;padding:8px 10px;border-radius:6px;
|
|
812
814
|
border:var(--aw-hair) solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);
|
|
813
815
|
color:var(--dsw-alias-label-secondary)}
|
|
814
|
-
.aw-modal-r .lab{font-size:
|
|
816
|
+
.aw-modal-r .lab{font-size:11.5px;color:var(--dsw-alias-label-caption)}
|
|
815
817
|
.aw-modal-f{flex:0 0 auto;display:flex;align-items:center;gap:8px;padding:10px 14px;
|
|
816
818
|
border-top:var(--aw-hair) solid var(--dsw-alias-border-l1)}
|
|
817
819
|
.aw-fnote{margin-right:auto}
|
|
818
|
-
.aw-fnote>div{font-size:
|
|
820
|
+
.aw-fnote>div{font-size:11.5px;line-height:15px;color:var(--dsw-alias-label-caption)}
|
|
819
821
|
.aw-fnote .sub{color:var(--dsw-alias-label-tertiary)}
|
|
820
|
-
.aw-hsec{margin:0 0 4px;font-size:
|
|
821
|
-
.aw-hsec-sub{margin-left:6px;font-weight:400;font-size:
|
|
822
|
-
.aw-hp{margin:0 0 10px;font-size:
|
|
822
|
+
.aw-hsec{margin:0 0 4px;font-size:12.5px;font-weight:600;color:var(--dsw-alias-label-secondary)}
|
|
823
|
+
.aw-hsec-sub{margin-left:6px;font-weight:400;font-size:11px;color:var(--dsw-alias-label-caption)}
|
|
824
|
+
.aw-hp{margin:0 0 10px;font-size:12.5px;line-height:17px;color:var(--dsw-alias-label-tertiary)}
|
|
823
825
|
.aw-hp b{color:var(--dsw-alias-label-secondary);font-weight:600}
|
|
824
826
|
.aw-hp>div{margin-bottom:5px}
|
|
825
827
|
.aw-hp>div:last-child{margin-bottom:0}
|
|
826
828
|
.aw-steps>div{margin-bottom:5px}
|
|
827
|
-
.aw-hp code{font-family:var(--aw-mono);font-size:
|
|
829
|
+
.aw-hp code{font-family:var(--aw-mono);font-size:11.5px;padding:0 3px;border-radius:3px;
|
|
828
830
|
background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-tertiary)}
|
|
829
831
|
.aw-hcard{display:flex;flex-direction:column;gap:4px;width:100%;text-align:left;padding:8px 10px;
|
|
830
832
|
margin-bottom:6px;border-radius:7px;
|
|
@@ -832,9 +834,9 @@ window.__ModuleLoader__.load({
|
|
|
832
834
|
.aw-hcard:hover{border-color:var(--dsw-alias-border-l3)}
|
|
833
835
|
.aw-hcard[aria-pressed="true"]{border-color:var(--dsw-alias-trajectory-accent);background:var(--dsw-alias-bg-multi-select)}
|
|
834
836
|
.aw-hcard-h{display:flex;align-items:baseline;gap:6px;min-width:0}
|
|
835
|
-
.aw-hcard-h .t{flex:1 1 auto;min-width:0;font-size:
|
|
837
|
+
.aw-hcard-h .t{flex:1 1 auto;min-width:0;font-size:13px;color:var(--dsw-alias-label-secondary);
|
|
836
838
|
overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
837
|
-
.aw-hcard .tag{flex:0 0 auto;font-size:
|
|
839
|
+
.aw-hcard .tag{flex:0 0 auto;font-size:10.5px;color:var(--dsw-alias-trajectory-accent)}
|
|
838
840
|
/* One bar, two facts: the fill is current usage, the tick is where DSH compacts. */
|
|
839
841
|
.aw-hcard-bar{position:relative;display:block;height:3px;border-radius:2px;
|
|
840
842
|
background:var(--dsw-alias-bg-layer-3);overflow:hidden}
|
|
@@ -842,8 +844,8 @@ window.__ModuleLoader__.load({
|
|
|
842
844
|
.aw-hcard-bar em{position:absolute;top:-2px;bottom:-2px;width:1px;
|
|
843
845
|
background:var(--dsw-alias-label-primary);opacity:.45}
|
|
844
846
|
.aw-hcard-r{display:flex;align-items:baseline;justify-content:space-between;gap:8px;
|
|
845
|
-
font-family:var(--aw-mono);font-size:
|
|
846
|
-
.aw-hcard .d{font-size:
|
|
847
|
+
font-family:var(--aw-mono);font-size:11px;color:var(--dsw-alias-label-caption)}
|
|
848
|
+
.aw-hcard .d{font-size:11px;color:var(--dsw-alias-label-tertiary)}
|
|
847
849
|
/* The two sentences that explain the trade-off; bold + a left rule so they read
|
|
848
850
|
as the conclusion rather than as more body copy. */
|
|
849
851
|
.aw-hp-strong{padding:7px 9px;border-radius:0 5px 5px 0;margin:2px 0 7px;
|
|
@@ -856,13 +858,13 @@ window.__ModuleLoader__.load({
|
|
|
856
858
|
.aw-tbl{display:flex;flex-direction:column;gap:0;margin:2px 0 4px;
|
|
857
859
|
border:var(--aw-hair) solid var(--dsw-alias-border-l2);border-radius:6px;overflow:hidden}
|
|
858
860
|
.aw-tbl-h,.aw-tbl-r{display:grid;grid-template-columns:78px minmax(0,1fr);gap:8px;padding:5px 8px}
|
|
859
|
-
.aw-tbl-h{font-size:
|
|
861
|
+
.aw-tbl-h{font-size:11px;color:var(--dsw-alias-label-caption);
|
|
860
862
|
background:var(--dsw-alias-bg-layer-2);border-bottom:var(--aw-hair) solid var(--dsw-alias-border-l2)}
|
|
861
|
-
.aw-tbl-r{font-size:
|
|
863
|
+
.aw-tbl-r{font-size:11.5px;line-height:15px;color:var(--dsw-alias-label-tertiary)}
|
|
862
864
|
.aw-tbl-r + .aw-tbl-r{border-top:var(--aw-hair) solid var(--dsw-alias-border-l1)}
|
|
863
865
|
.aw-tbl-r .n{font-family:var(--aw-mono);color:var(--dsw-alias-label-secondary)}
|
|
864
|
-
.aw-tbl-note{margin-bottom:8px;font-size:
|
|
865
|
-
.aw-other{width:100%;margin-top:2px;padding:4px 6px;border-radius:5px;font-size:
|
|
866
|
+
.aw-tbl-note{margin-bottom:8px;font-size:11px;line-height:14px;color:var(--dsw-alias-label-caption)}
|
|
867
|
+
.aw-other{width:100%;margin-top:2px;padding:4px 6px;border-radius:5px;font-size:12.5px;
|
|
866
868
|
border:var(--aw-hair) solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);
|
|
867
869
|
color:var(--dsw-alias-label-secondary)}
|
|
868
870
|
@container (max-width:700px){
|
|
@@ -895,91 +897,94 @@ window.__ModuleLoader__.load({
|
|
|
895
897
|
@media (prefers-reduced-motion: reduce){
|
|
896
898
|
.aw-breathe,.aw-risk-ring,.aw-flow{animation:none}
|
|
897
899
|
}
|
|
898
|
-
.aw-legend{display:flex;align-items:center;gap:12px;font-size:
|
|
900
|
+
.aw-legend{display:flex;align-items:center;gap:12px;font-size:12.5px;
|
|
899
901
|
color:var(--dsw-alias-label-caption);white-space:nowrap}
|
|
900
902
|
.aw-legend span{display:inline-flex;align-items:center;gap:5px}
|
|
901
|
-
.aw-note{position:absolute;right:10px;bottom:10px;font-size:
|
|
903
|
+
.aw-note{position:absolute;right:10px;bottom:10px;font-size:12.5px;padding:2px 6px;
|
|
902
904
|
color:var(--dsw-alias-label-caption);pointer-events:none;text-align:right;max-width:60%;
|
|
903
905
|
background:var(--dsw-alias-bg-base)}
|
|
904
|
-
.aw-bot{flex:0 0 auto;display:grid;grid-template-columns:1fr 1.25fr 1.15fr;
|
|
906
|
+
.aw-bot{flex:0 0 auto;display:grid;grid-template-columns:var(--aw-b1,1fr) 8px var(--aw-b2,1.25fr) 8px var(--aw-b3,1.15fr);
|
|
907
|
+
color:var(--dsw-alias-label-secondary);
|
|
905
908
|
border-top:var(--aw-hair) solid var(--dsw-alias-border-l2);height:288px}
|
|
906
909
|
.aw-mod{min-width:0;min-height:0;display:flex;flex-direction:column;padding:10px 16px 8px;overflow:hidden}
|
|
907
910
|
.aw-mod+.aw-mod{border-left:var(--aw-hair) solid var(--dsw-alias-border-l2)}
|
|
908
911
|
.aw-mh{display:flex;align-items:baseline;justify-content:space-between;gap:8px;
|
|
909
912
|
margin-bottom:6px;flex:0 0 auto}
|
|
910
|
-
.aw-mh h3{font-size:
|
|
911
|
-
.aw-mh span{font-size:
|
|
912
|
-
.aw-scope{flex:0 0 auto;margin:-4px 0 6px;font-size:
|
|
913
|
+
.aw-mh h3{font-size:13px;font-weight:600;color:var(--dsw-alias-label-secondary);margin:0}
|
|
914
|
+
.aw-mh span{font-size:12.5px;color:var(--dsw-alias-label-caption);font-family:var(--aw-mono)}
|
|
915
|
+
.aw-scope{flex:0 0 auto;margin:-4px 0 6px;font-size:11.5px;line-height:14px;
|
|
913
916
|
color:var(--dsw-alias-label-caption);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
914
917
|
.aw-mb{flex:1 1 auto;min-height:0;overflow:auto;display:flex;flex-direction:column}
|
|
915
918
|
.aw-stack{display:flex;height:6px;border-radius:3px;overflow:hidden;margin-bottom:8px;
|
|
916
919
|
background:var(--dsw-alias-bg-layer-2)}
|
|
917
920
|
.aw-stack i{height:100%;transition:width .3s}
|
|
918
|
-
.aw-
|
|
921
|
+
.aw-bot-h{width:8px;cursor:col-resize;border-radius:3px}
|
|
922
|
+
.aw-bot-h:hover,.aw-bot-h.on{background:var(--dsw-alias-border-l2)}
|
|
923
|
+
.aw-comp{display:grid;grid-template-columns:1fr 1fr;gap:1px 12px;font-size:13px}
|
|
919
924
|
.aw-comp div{display:flex;align-items:center;gap:5px;min-width:0;line-height:16px}
|
|
920
925
|
.aw-comp .k{color:var(--dsw-alias-label-tertiary);flex:1;overflow:hidden;
|
|
921
926
|
text-overflow:ellipsis;white-space:nowrap}
|
|
922
|
-
.aw-comp .v{font-family:var(--aw-mono);font-size:
|
|
927
|
+
.aw-comp .v{font-family:var(--aw-mono);font-size:12.5px;color:var(--dsw-alias-label-secondary);
|
|
923
928
|
font-variant-numeric:tabular-nums}
|
|
924
929
|
.aw-comp .sw{width:8px;height:8px;border-radius:2px;flex:0 0 auto}
|
|
925
|
-
.aw-ug{display:grid;grid-template-columns:1fr 1fr;gap:1px 12px;font-size:
|
|
930
|
+
.aw-ug{display:grid;grid-template-columns:1fr 1fr;gap:1px 12px;font-size:13px}
|
|
926
931
|
.aw-ug>div{display:flex;align-items:baseline;gap:6px;min-width:0;line-height:17px}
|
|
927
932
|
.aw-ug .k{color:var(--dsw-alias-label-tertiary);flex:1;overflow:hidden;
|
|
928
933
|
text-overflow:ellipsis;white-space:nowrap}
|
|
929
|
-
.aw-ug .v{font-family:var(--aw-mono);font-size:
|
|
934
|
+
.aw-ug .v{font-family:var(--aw-mono);font-size:13px;color:var(--dsw-alias-label-secondary);
|
|
930
935
|
font-variant-numeric:tabular-nums}
|
|
931
936
|
.aw-mb>.aw-sec{display:flex;align-items:baseline;justify-content:space-between;gap:8px;
|
|
932
937
|
margin:10px 0 5px}
|
|
933
|
-
.aw-sec-sum{font-family:var(--aw-mono);font-size:
|
|
934
|
-
.aw-cap{font-size:
|
|
938
|
+
.aw-sec-sum{font-family:var(--aw-mono);font-size:11px;color:var(--dsw-alias-label-caption)}
|
|
939
|
+
.aw-cap{font-size:12.5px;line-height:17px;color:var(--dsw-alias-label-caption);
|
|
935
940
|
margin-top:auto;padding-top:8px}
|
|
936
941
|
.aw-cap b{font-weight:500;color:var(--dsw-alias-label-tertiary);font-family:var(--aw-mono)}
|
|
937
942
|
.aw-mx{flex:1;min-height:0;overflow:auto}
|
|
938
943
|
.aw-mxh,.aw-row{display:grid;grid-template-columns:minmax(0,1fr) 84px 74px 52px;
|
|
939
944
|
gap:8px;align-items:center;padding:0 6px}
|
|
940
|
-
.aw-mxh{position:sticky;top:0;z-index:1;height:22px;font-size:
|
|
945
|
+
.aw-mxh{position:sticky;top:0;z-index:1;height:22px;font-size:12.5px;
|
|
941
946
|
color:var(--dsw-alias-label-caption);background:var(--dsw-alias-bg-base);
|
|
942
947
|
border-bottom:var(--aw-hair) solid var(--dsw-alias-border-l2);padding-bottom:4px;margin-bottom:2px}
|
|
943
|
-
.aw-row{height:26px;border-radius:5px;cursor:pointer;font-size:
|
|
948
|
+
.aw-row{height:26px;border-radius:5px;cursor:pointer;font-size:13px}
|
|
944
949
|
.aw-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
945
950
|
.aw-row[aria-selected="true"]{background:var(--dsw-alias-bg-multi-select)}
|
|
946
951
|
.aw-row.dim{opacity:.4}
|
|
947
952
|
.aw-row .nm{display:flex;align-items:center;gap:5px;min-width:0;
|
|
948
953
|
color:var(--dsw-alias-label-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
949
954
|
.aw-row .nm svg{width:12px;height:12px;flex:0 0 auto;color:var(--dsw-alias-label-caption)}
|
|
950
|
-
.aw-row .mdl{color:var(--dsw-alias-label-caption);font-family:var(--aw-mono);font-size:
|
|
955
|
+
.aw-row .mdl{color:var(--dsw-alias-label-caption);font-family:var(--aw-mono);font-size:12.5px;
|
|
951
956
|
overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
952
957
|
.aw-row .bar{height:4px;border-radius:2px;background:var(--dsw-alias-bg-layer-2);overflow:hidden}
|
|
953
958
|
.aw-row .bar i{display:block;height:100%}
|
|
954
|
-
.aw-row .pc{text-align:right;font-family:var(--aw-mono);font-size:
|
|
959
|
+
.aw-row .pc{text-align:right;font-family:var(--aw-mono);font-size:12.5px;
|
|
955
960
|
font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-secondary)}
|
|
956
961
|
.aw-insp{flex:1;min-height:0;overflow:auto;display:flex;flex-direction:column;gap:5px;padding-right:2px}
|
|
957
962
|
.aw-insp-empty{height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;
|
|
958
|
-
gap:6px;font-size:
|
|
963
|
+
gap:6px;font-size:13px;color:var(--dsw-alias-label-caption);text-align:center}
|
|
959
964
|
.aw-insp-empty svg{width:20px;height:20px;opacity:.5}
|
|
960
|
-
.aw-it{font-size:
|
|
961
|
-
.aw-im{display:flex;align-items:center;gap:5px;flex-wrap:wrap;font-size:
|
|
965
|
+
.aw-it{font-size:13.5px;font-weight:600;line-height:18px;color:var(--dsw-alias-label-primary);flex:0 0 auto}
|
|
966
|
+
.aw-im{display:flex;align-items:center;gap:5px;flex-wrap:wrap;font-size:12.5px;
|
|
962
967
|
line-height:15px;color:var(--dsw-alias-label-caption)}
|
|
963
968
|
.aw-ig{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:2px 10px;flex:0 0 auto}
|
|
964
|
-
.aw-kv .k{font-size:
|
|
969
|
+
.aw-kv .k{font-size:12.5px;color:var(--dsw-alias-label-caption);line-height:16px}
|
|
965
970
|
.aw-kv .v{font-family:var(--aw-mono);font-size:13px;line-height:18px;
|
|
966
971
|
color:var(--dsw-alias-label-primary);font-variant-numeric:tabular-nums}
|
|
967
|
-
.aw-kv .v small{font-size:
|
|
968
|
-
.aw-sec{font-size:
|
|
969
|
-
.aw-muted{font-size:
|
|
972
|
+
.aw-kv .v small{font-size:12.5px;color:var(--dsw-alias-label-caption);margin-left:2px}
|
|
973
|
+
.aw-sec{font-size:12.5px;font-weight:600;line-height:15px;color:var(--dsw-alias-label-tertiary)}
|
|
974
|
+
.aw-muted{font-size:12.5px;color:var(--dsw-alias-label-caption)}
|
|
970
975
|
.aw-iact{flex:0 0 auto;display:flex;gap:8px;padding-top:4px}
|
|
971
976
|
.aw-iact .aw-btn{height:26px}
|
|
972
977
|
.aw-iact .aw-btn{flex:1;justify-content:center}
|
|
973
978
|
.aw-empty{display:flex;align-items:center;justify-content:center;height:100%;
|
|
974
|
-
font-size:
|
|
979
|
+
font-size:13px;color:var(--dsw-alias-label-caption)}
|
|
975
980
|
.aw-toast{position:absolute;left:50%;transform:translateX(-50%);bottom:18px;z-index:20;
|
|
976
981
|
max-width:70%;padding:8px 14px;border-radius:var(--aw-r);
|
|
977
982
|
border:var(--aw-hair) solid var(--dsw-alias-border-l3);
|
|
978
983
|
background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);
|
|
979
|
-
font-size:
|
|
984
|
+
font-size:13px;line-height:18px;box-shadow:0 4px 16px rgba(0,0,0,.18);
|
|
980
985
|
display:flex;align-items:center}
|
|
981
|
-
.aw-err{padding:16px;font-size:
|
|
982
|
-
.aw-err code{font-family:var(--aw-mono);font-size:
|
|
986
|
+
.aw-err{padding:16px;font-size:13px;line-height:20px;color:var(--dsw-alias-state-warn-label)}
|
|
987
|
+
.aw-err code{font-family:var(--aw-mono);font-size:12.5px;color:var(--dsw-alias-label-tertiary);
|
|
983
988
|
display:block;margin-top:6px}
|
|
984
989
|
@media (max-width:1180px){
|
|
985
990
|
.aw-bot{grid-template-columns:1fr 1fr;height:190px}
|
|
@@ -2043,7 +2048,7 @@ window.__ModuleLoader__.load({
|
|
|
2043
2048
|
* also made "four empty cells" unreachable, because any all-empty row was
|
|
2044
2049
|
* immediately snapped back to a filled one.
|
|
2045
2050
|
*/
|
|
2046
|
-
const EMPTY_PANES = [null, null
|
|
2051
|
+
const EMPTY_PANES = [null, null]
|
|
2047
2052
|
|
|
2048
2053
|
function WorkspaceView({
|
|
2049
2054
|
sessions, allSessions, projects, filter, setFilter, panes, setPanes, onOpenNative, railW, onRailW, kit, th, flashId,
|
|
@@ -2360,7 +2365,10 @@ window.__ModuleLoader__.load({
|
|
|
2360
2365
|
className: 'aw-btn ghost',
|
|
2361
2366
|
title: '减少一栏',
|
|
2362
2367
|
onClick: () => setPanes(prev => (prev.length > 1 ? prev.slice(0, -1) : prev)),
|
|
2363
|
-
},
|
|
2368
|
+
}, [
|
|
2369
|
+
h(Icon, { key: 'i', name: 'single', size: 14 }),
|
|
2370
|
+
h('span', { key: 't' }, '减少一栏'),
|
|
2371
|
+
]) : null,
|
|
2364
2372
|
].filter(Boolean)),
|
|
2365
2373
|
h('div', {
|
|
2366
2374
|
className: 'aw-panes',
|
|
@@ -2821,6 +2829,30 @@ window.__ModuleLoader__.load({
|
|
|
2821
2829
|
}, [])
|
|
2822
2830
|
|
|
2823
2831
|
const [data, setData] = React.useState(null)
|
|
2832
|
+
// 三个底部模块(构成/概览/详情)的列宽比例,可拖拽分隔条调整
|
|
2833
|
+
const [botCols, setBotCols] = usePersisted('aw.botCols', [1, 1.25, 1.15],
|
|
2834
|
+
v => Array.isArray(v) && v.length === 3 && v.every(x => typeof x === 'number' && x >= 0.12 && x <= 6))
|
|
2835
|
+
const botDrag = React.useRef(null)
|
|
2836
|
+
const botHandleDown = (i) => (ev) => {
|
|
2837
|
+
const total = (ev.currentTarget.parentElement?.getBoundingClientRect().width) || 1
|
|
2838
|
+
botDrag.current = { i, startX: ev.clientX, cols: [...botCols], total }
|
|
2839
|
+
ev.currentTarget.setPointerCapture(ev.pointerId)
|
|
2840
|
+
ev.preventDefault()
|
|
2841
|
+
}
|
|
2842
|
+
const botHandleMove = (ev) => {
|
|
2843
|
+
const d = botDrag.current
|
|
2844
|
+
if (!d) return
|
|
2845
|
+
const dx = (ev.clientX - d.startX) / d.total
|
|
2846
|
+
const min = 0.15
|
|
2847
|
+
const a = Math.max(min, d.cols[d.i] + dx)
|
|
2848
|
+
const b = Math.max(min, d.cols[d.i + 1] - dx)
|
|
2849
|
+
if (a <= min || b <= min) return
|
|
2850
|
+
const next = [...d.cols]
|
|
2851
|
+
next[d.i] = a
|
|
2852
|
+
next[d.i + 1] = b
|
|
2853
|
+
setBotCols(next)
|
|
2854
|
+
}
|
|
2855
|
+
const botHandleUp = () => { botDrag.current = null }
|
|
2824
2856
|
const [error, setError] = React.useState(null)
|
|
2825
2857
|
// View, selection and filter are persisted: leaving the panel and coming
|
|
2826
2858
|
// back must not restart the workbench at its first screen.
|
|
@@ -3159,10 +3191,12 @@ window.__ModuleLoader__.load({
|
|
|
3159
3191
|
}, [h('b', { key: 'b' }, sessions.length), ' 会话']),
|
|
3160
3192
|
h('span', {
|
|
3161
3193
|
key: 'b',
|
|
3194
|
+
className: 'opt',
|
|
3162
3195
|
title: '最近 2 小时内有过更新的会话数;休眠会话仍会统计在左侧总数里',
|
|
3163
3196
|
}, [h('b', { key: 'b' }, active), ' 活跃']),
|
|
3164
3197
|
h('span', {
|
|
3165
3198
|
key: 'c',
|
|
3199
|
+
className: 'opt',
|
|
3166
3200
|
title: '所有会话上下文占用的平均值。不同模型容量不同,所以总和不会混算成一个百分比',
|
|
3167
3201
|
}, [h('b', { key: 'b' }, pct(avg)), ' 平均占用']),
|
|
3168
3202
|
display?.capabilities?.coldPending ? h('span', {
|
|
@@ -3267,7 +3301,7 @@ window.__ModuleLoader__.load({
|
|
|
3267
3301
|
? h(WorkspaceView, {
|
|
3268
3302
|
key: 'ws',
|
|
3269
3303
|
sessions: filtered,
|
|
3270
|
-
allSessions,
|
|
3304
|
+
allSessions: sessions,
|
|
3271
3305
|
projects,
|
|
3272
3306
|
filter,
|
|
3273
3307
|
setFilter,
|
|
@@ -3340,9 +3374,20 @@ window.__ModuleLoader__.load({
|
|
|
3340
3374
|
// Only the sessions the user is actually watching get flow.
|
|
3341
3375
|
pinned: panes.filter(Boolean),
|
|
3342
3376
|
})),
|
|
3343
|
-
h('div', {
|
|
3377
|
+
h('div', {
|
|
3378
|
+
className: 'aw-bot', key: 'bot',
|
|
3379
|
+
style: { gridTemplateColumns: botCols[0] + 'fr 8px ' + botCols[1] + 'fr 8px ' + botCols[2] + 'fr' },
|
|
3380
|
+
}, [
|
|
3344
3381
|
h(Composition, { key: 'c', sessions: scope.sessions, pricing, scopeLabel: scope.label }),
|
|
3382
|
+
h('div', {
|
|
3383
|
+
key: 'h1', className: 'aw-bot-h',
|
|
3384
|
+
onPointerDown: botHandleDown(0), onPointerMove: botHandleMove, onPointerUp: botHandleUp,
|
|
3385
|
+
}),
|
|
3345
3386
|
h(Matrix, { key: 'm', sessions: filtered, selected, onSelect: setSelected, th }),
|
|
3387
|
+
h('div', {
|
|
3388
|
+
key: 'h2', className: 'aw-bot-h',
|
|
3389
|
+
onPointerDown: botHandleDown(1), onPointerMove: botHandleMove, onPointerUp: botHandleUp,
|
|
3390
|
+
}),
|
|
3346
3391
|
h(Inspector, { key: 'i', session: selectedSession, onOpen: openNative, th }),
|
|
3347
3392
|
]),
|
|
3348
3393
|
]),
|
package/lib/index.js
CHANGED
|
@@ -39,6 +39,11 @@ const BASE_KEYS = ['contextTimeline', 'contextActivity', 'title', 'sessionListMe
|
|
|
39
39
|
* time-bucketed projections can still price peak hours instead of guessing.
|
|
40
40
|
*/
|
|
41
41
|
const LOG_SPLITS = new Map()
|
|
42
|
+
/** Latest dsh-context composition per session id, kept only for the
|
|
43
|
+
* withProjections comparison channel. */
|
|
44
|
+
const PROJ_CURRENT = new Map()
|
|
45
|
+
/** Our own composition per session id, for the comparison channel. */
|
|
46
|
+
const COMP_PARTS = new Map()
|
|
42
47
|
|
|
43
48
|
/**
|
|
44
49
|
* Projections that a trimmed Host profile may not register. They are requested
|
|
@@ -217,6 +222,105 @@ function compactPointOf(window, output) {
|
|
|
217
222
|
/** A summary younger than this is considered fresh; freshness demotes one level. */
|
|
218
223
|
const COMPACTION_FRESH_MS = 10 * 60_000
|
|
219
224
|
|
|
225
|
+
/**
|
|
226
|
+
* Context composition from the session's own event stream — the fallback that
|
|
227
|
+
* keeps the panel useful without dsh-context's projections.
|
|
228
|
+
*
|
|
229
|
+
* The estimator follows dsh-context's published heuristics: text blocks count
|
|
230
|
+
* characters at 4 chars/token (ceil), non-text blocks through their JSON
|
|
231
|
+
* serialization, plus a 4-token role overhead per message. Tools come from the
|
|
232
|
+
* last request/header's schemas. The result is later anchored to the real
|
|
233
|
+
* input usage, so estimator imprecision mostly cancels out.
|
|
234
|
+
*/
|
|
235
|
+
const CHARS_PER_TOKEN = 4
|
|
236
|
+
const ROLE_OVERHEAD = 4
|
|
237
|
+
|
|
238
|
+
function blocksChars(content) {
|
|
239
|
+
if (typeof content === 'string') return content.length
|
|
240
|
+
if (!Array.isArray(content)) return 0
|
|
241
|
+
let chars = 0
|
|
242
|
+
for (const block of content) {
|
|
243
|
+
if (block && typeof block === 'object' && block.type === 'text' && typeof block.text === 'string') {
|
|
244
|
+
chars += block.text.length
|
|
245
|
+
continue
|
|
246
|
+
}
|
|
247
|
+
try {
|
|
248
|
+
const json = JSON.stringify(block)
|
|
249
|
+
if (typeof json === 'string') chars += json.length
|
|
250
|
+
} catch { /* unserializable block contributes nothing */ }
|
|
251
|
+
}
|
|
252
|
+
return chars
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function estimateMessageTokens(content) {
|
|
256
|
+
const chars = blocksChars(content)
|
|
257
|
+
return chars > 0 ? Math.ceil(chars / CHARS_PER_TOKEN) + ROLE_OVERHEAD : 0
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Fold one session's events into the seven-part composition, and pull the
|
|
262
|
+
* model window / output reservation from the request events.
|
|
263
|
+
* @param events - parsed session events (any order; folded by type).
|
|
264
|
+
* @returns `{ parts, total, contextWindow, maxOutputTokens }`.
|
|
265
|
+
*/
|
|
266
|
+
export function composeFromEvents(events) {
|
|
267
|
+
const parts = { system: 0, tools: 0, user: 0, inject: 0, skill: 0, assistant: 0, tool: 0 }
|
|
268
|
+
let toolsChars = null
|
|
269
|
+
let contextWindow = null
|
|
270
|
+
let maxOutputTokens = null
|
|
271
|
+
for (const event of events) {
|
|
272
|
+
if (!event?.type) continue
|
|
273
|
+
const data = event.data ?? {}
|
|
274
|
+
if (event.type === 'request/header') {
|
|
275
|
+
const tools = data.header?.tools
|
|
276
|
+
if (Array.isArray(tools) && tools.length) {
|
|
277
|
+
let chars = 0
|
|
278
|
+
for (const tool of tools) {
|
|
279
|
+
try { chars += JSON.stringify(tool).length } catch { /* skip */ }
|
|
280
|
+
}
|
|
281
|
+
toolsChars = Math.ceil(chars / CHARS_PER_TOKEN)
|
|
282
|
+
}
|
|
283
|
+
const max = Number(data.header?.config?.maxTokens)
|
|
284
|
+
if (Number.isFinite(max) && max > 0) maxOutputTokens = max
|
|
285
|
+
continue
|
|
286
|
+
}
|
|
287
|
+
if (event.type === 'request/context') {
|
|
288
|
+
const window = Number(data.contextWindow)
|
|
289
|
+
if (Number.isFinite(window) && window > 0) contextWindow = window
|
|
290
|
+
continue
|
|
291
|
+
}
|
|
292
|
+
if (event.type === 'system/message') {
|
|
293
|
+
const tokens = estimateMessageTokens(data.message?.content ?? data.content)
|
|
294
|
+
if (tokens > 0) parts.system = tokens // the latest system prompt wins
|
|
295
|
+
continue
|
|
296
|
+
}
|
|
297
|
+
let cat = null
|
|
298
|
+
let content = null
|
|
299
|
+
if (event.type === 'user/message') {
|
|
300
|
+
const kind = data.source?.kind
|
|
301
|
+
if (kind === 'skill-invocation' || kind === 'skill-catalog') cat = 'skill'
|
|
302
|
+
else if (typeof kind === 'string' && kind !== '') cat = 'inject' // plugin injections and compaction summaries
|
|
303
|
+
else cat = 'user'
|
|
304
|
+
content = data.content
|
|
305
|
+
} else if (event.type === 'developer/message') {
|
|
306
|
+
cat = 'inject'
|
|
307
|
+
content = data.message?.content ?? data.content
|
|
308
|
+
} else if (event.type === 'assistant/message') {
|
|
309
|
+
cat = 'assistant'
|
|
310
|
+
content = data.message?.content ?? data.content
|
|
311
|
+
} else if (event.type === 'tool/result') {
|
|
312
|
+
cat = 'tool'
|
|
313
|
+
content = data.message?.content ?? data.content
|
|
314
|
+
} else {
|
|
315
|
+
continue
|
|
316
|
+
}
|
|
317
|
+
parts[cat] += estimateMessageTokens(content)
|
|
318
|
+
}
|
|
319
|
+
if (toolsChars != null) parts.tools = toolsChars
|
|
320
|
+
const total = PART_KEYS.reduce((n, k) => n + (parts[k] ?? 0), 0)
|
|
321
|
+
return { parts, total, contextWindow, maxOutputTokens }
|
|
322
|
+
}
|
|
323
|
+
|
|
220
324
|
export function countCheckpoints(events) {
|
|
221
325
|
let fullCompactions = 0
|
|
222
326
|
let pruneCompactions = 0
|
|
@@ -781,23 +885,45 @@ export function apply(ctx, config = {}) {
|
|
|
781
885
|
function toDto(rec, values, projectOf, liveTitleText) {
|
|
782
886
|
const header = rec.header ?? {}
|
|
783
887
|
const id = header.id
|
|
888
|
+
const logStats = LOG_SPLITS.get(id)
|
|
784
889
|
const timeline = values?.contextTimeline ?? null
|
|
785
890
|
const current = timeline?.current ?? null
|
|
891
|
+
PROJ_CURRENT.set(id, current)
|
|
786
892
|
const pressure = values?.contextPressure ?? null
|
|
787
893
|
const breakdown = values?.contextBreakdown ?? null
|
|
788
894
|
|
|
789
895
|
// Capacity comes from the newest recorded route; the pressure projection is
|
|
790
|
-
// fresher than the timeline's copy when a model switch happened.
|
|
791
|
-
|
|
896
|
+
// fresher than the timeline's copy when a model switch happened. Without
|
|
897
|
+
// dsh-context the request events carry the window and the output
|
|
898
|
+
// reservation, so the compaction point still exists.
|
|
899
|
+
const capacity = positive(pressure?.contextWindow) ?? positive(timeline?.contextWindow)
|
|
900
|
+
?? positive(logStats?.contextWindow) ?? null
|
|
901
|
+
const maxOutputTokens = timeline?.maxOutputTokens ?? logStats?.maxOutputTokens ?? null
|
|
792
902
|
const pressureTokens = pressureOf(timeline, pressure)
|
|
793
903
|
// `total` is the number the panel, the threshold and the tooltip all speak
|
|
794
904
|
// in: the provider-reported prompt size (or the documented fallback chain).
|
|
795
|
-
|
|
796
|
-
|
|
905
|
+
// Without dsh-context the composed estimate IS the prompt size the panel
|
|
906
|
+
// can speak in — the projections' totals do not exist on that machine.
|
|
907
|
+
// A zero-total fold means "no billable context", not a measurable size.
|
|
908
|
+
const compTotal = positive(logStats?.total)
|
|
909
|
+
const total = pressureTokens.tokens ?? current?.total ?? compTotal ?? null
|
|
910
|
+
const estimatedTotal = current?.total ?? compTotal ?? null
|
|
797
911
|
const ratio = capacity && total != null ? total / capacity : null
|
|
798
|
-
const point = compactPointOf(capacity,
|
|
912
|
+
const point = compactPointOf(capacity, maxOutputTokens)
|
|
799
913
|
|
|
800
|
-
const
|
|
914
|
+
const usage = usageOf(values)
|
|
915
|
+
let parts = partsOf(current, breakdown, total)
|
|
916
|
+
if (parts == null && logStats?.parts) {
|
|
917
|
+
// Own composition (no dsh-context): anchor the estimates onto the same
|
|
918
|
+
// total the panel displays, so the parts always add up to the headline.
|
|
919
|
+
parts = { ...logStats.parts }
|
|
920
|
+
const sum = PART_KEYS.reduce((n, k) => n + (parts[k] ?? 0), 0)
|
|
921
|
+
if (total != null && sum > 0 && total !== sum) {
|
|
922
|
+
const scale = total / sum
|
|
923
|
+
for (const k of PART_KEYS) parts[k] = Math.round((parts[k] ?? 0) * scale)
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
COMP_PARTS.set(id, logStats?.parts ?? null)
|
|
801
927
|
|
|
802
928
|
// The model picker is a core projection; `contextTimeline` is not (it comes
|
|
803
929
|
// from dsh-context). Resolve once and use it for both the label and pricing,
|
|
@@ -805,14 +931,12 @@ export function apply(ctx, config = {}) {
|
|
|
805
931
|
const modelName = timeline?.model ?? values?.modelSelection?.lastUsed?.model ?? null
|
|
806
932
|
const providerName = timeline?.provider ?? values?.modelSelection?.lastUsed?.provider ?? null
|
|
807
933
|
|
|
808
|
-
const usage = usageOf(values)
|
|
809
934
|
// Prefer the projection's own peak/off buckets. When the host has none (no
|
|
810
935
|
// dsh-context), use the split reconstructed from the session log; the
|
|
811
936
|
// lifetime totals times `peakFactor` is the last resort.
|
|
812
937
|
const projectionBuckets = costOfBuckets(timeline, priceBook.lookup, deepseekCny)
|
|
813
938
|
// Compaction counts come from the log pipeline regardless of where the
|
|
814
939
|
// usage buckets came from — a projection-priced session still has a log.
|
|
815
|
-
const logStats = LOG_SPLITS.get(id)
|
|
816
940
|
const split = projectionBuckets ? null : logStats
|
|
817
941
|
const logBuckets = !projectionBuckets && split && (split.peak || split.off)
|
|
818
942
|
? costOfBuckets(
|
|
@@ -890,7 +1014,8 @@ export function apply(ctx, config = {}) {
|
|
|
890
1014
|
total,
|
|
891
1015
|
ratio,
|
|
892
1016
|
/** Where `total` came from: projected | pressure | prompt+delta | estimate. */
|
|
893
|
-
contextSource: pressureTokens.source
|
|
1017
|
+
contextSource: pressureTokens.source
|
|
1018
|
+
?? (compTotal != null && total === compTotal ? 'composed' : null),
|
|
894
1019
|
/** The event-estimate total, kept only to explain the gap in a tooltip. */
|
|
895
1020
|
estimatedTotal,
|
|
896
1021
|
/** Where this session compacts; the panel colours against this, not 100%. */
|
|
@@ -1161,6 +1286,7 @@ export function apply(ctx, config = {}) {
|
|
|
1161
1286
|
peak: split?.peak ?? null,
|
|
1162
1287
|
off: split?.off ?? null,
|
|
1163
1288
|
...countCheckpoints(events),
|
|
1289
|
+
...composeFromEvents(events),
|
|
1164
1290
|
}
|
|
1165
1291
|
LOG_SPLITS.set(id, entry)
|
|
1166
1292
|
cache.delete(id)
|
|
@@ -1250,15 +1376,17 @@ export function apply(ctx, config = {}) {
|
|
|
1250
1376
|
try {
|
|
1251
1377
|
const buf = await fs.readFile(item.file)
|
|
1252
1378
|
const text = decompressFrames(buf, zstd)
|
|
1379
|
+
const parsed = text.split('\n').map((line) => {
|
|
1380
|
+
try { return JSON.parse(line) } catch { return null }
|
|
1381
|
+
})
|
|
1253
1382
|
const split = splitUsageText(text)
|
|
1254
1383
|
LOG_SPLITS.set(item.id, {
|
|
1255
1384
|
...stamp,
|
|
1256
1385
|
at: Date.now(),
|
|
1257
1386
|
peak: split?.peak ?? null,
|
|
1258
1387
|
off: split?.off ?? null,
|
|
1259
|
-
...countCheckpoints(
|
|
1260
|
-
|
|
1261
|
-
})),
|
|
1388
|
+
...countCheckpoints(parsed),
|
|
1389
|
+
...composeFromEvents(parsed),
|
|
1262
1390
|
})
|
|
1263
1391
|
// The DTO cache may hold a totals-priced copy: drop it so the next
|
|
1264
1392
|
// collect re-prices with the buckets we just found.
|
|
@@ -1507,7 +1635,18 @@ export function apply(ctx, config = {}) {
|
|
|
1507
1635
|
disposers.push(mountGet('/api/session-matrix/overview', async request => {
|
|
1508
1636
|
const url = new URL(request.url, 'http://localhost')
|
|
1509
1637
|
const force = url.searchParams.get('refresh') === '1'
|
|
1510
|
-
|
|
1638
|
+
const withProjections = url.searchParams.get('withProjections') === '1'
|
|
1639
|
+
const payload = await overview(force)
|
|
1640
|
+
if (withProjections && Array.isArray(payload.sessions)) {
|
|
1641
|
+
// Comparison channel for the composition engine: carry dsh-context's
|
|
1642
|
+
// own per-category snapshot alongside ours so the two can be diffed.
|
|
1643
|
+
payload.sessions = payload.sessions.map(row => ({
|
|
1644
|
+
...row,
|
|
1645
|
+
projCurrent: PROJ_CURRENT.get(row.id) ?? null,
|
|
1646
|
+
compParts: COMP_PARTS.get(row.id) ?? null,
|
|
1647
|
+
}))
|
|
1648
|
+
}
|
|
1649
|
+
return json(payload)
|
|
1511
1650
|
}))
|
|
1512
1651
|
|
|
1513
1652
|
// Reported in capabilities so a bug report can name the exact build, and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-matrix",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"description": "A panoramic console for DeepSeek Harness: run multiple native sessions and subagents in parallel, see the agent graph, get compaction warnings, and hand work off before context is lost.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
|
-
"test": "node test/host.test.mjs && node test/usage-split.test.mjs && node test/usage-reconcile.test.mjs && node test/risk-matrix.test.mjs && node test/usage-vs-projection.test.mjs && node test/cost-buckets.test.mjs",
|
|
78
|
+
"test": "node test/host.test.mjs && node test/usage-split.test.mjs && node test/usage-reconcile.test.mjs && node test/risk-matrix.test.mjs && node test/usage-vs-projection.test.mjs && node test/cost-buckets.test.mjs && node test/compose.test.mjs",
|
|
79
79
|
"prepublishOnly": "npm test"
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* composeFromEvents unit tests — the engine that replaces dsh-context's
|
|
3
|
+
* projections when that plugin is absent.
|
|
4
|
+
*/
|
|
5
|
+
import { composeFromEvents, riskLevel, countCheckpoints } from '../lib/index.js'
|
|
6
|
+
|
|
7
|
+
const pass = []
|
|
8
|
+
const fail = []
|
|
9
|
+
const check = (label, fn) => {
|
|
10
|
+
try { fn(); pass.push(label) } catch (error) { fail.push(`${label}: ${error.message}`) }
|
|
11
|
+
}
|
|
12
|
+
const assert = (cond, message) => { if (!cond) throw new Error(message) }
|
|
13
|
+
const blocks = (text) => [{ type: 'text', text }]
|
|
14
|
+
|
|
15
|
+
check('七类分类:普通用户消息归 user', () => {
|
|
16
|
+
const r = composeFromEvents([{ type: 'user/message', time: 1, data: { content: blocks('hello world') } }])
|
|
17
|
+
assert(r.parts.user > 0, `user should be counted, got ${r.parts.user}`)
|
|
18
|
+
assert(r.total > 0, `total should be positive, got ${r.total}`)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
check('压缩摘要注入归 inject,工具结果归 tool,助手归 assistant', () => {
|
|
22
|
+
const r = composeFromEvents([
|
|
23
|
+
{ type: 'user/message', time: 1, data: { content: blocks('a'.repeat(400)), source: { kind: 'compact-checkpoint' } } },
|
|
24
|
+
{ type: 'tool/result', time: 2, data: { message: { role: 'tool', content: blocks('b'.repeat(400)) } } },
|
|
25
|
+
{ type: 'assistant/message', time: 3, data: { message: { role: 'assistant', content: blocks('c'.repeat(400)) } } },
|
|
26
|
+
])
|
|
27
|
+
assert(r.parts.inject > 0 && r.parts.tool > 0 && r.parts.assistant > 0, `categories: ${JSON.stringify(r.parts)}`)
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
check('skill 调用归 skill', () => {
|
|
31
|
+
const r = composeFromEvents([{ type: 'user/message', time: 1, data: { content: blocks('x'.repeat(400)), source: { kind: 'skill-invocation', name: 'writer' } } }])
|
|
32
|
+
assert(r.parts.skill > 0, `skill should count, got ${JSON.stringify(r.parts)}`)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
check('system/message 取最后一个非零值', () => {
|
|
36
|
+
const r = composeFromEvents([
|
|
37
|
+
{ type: 'system/message', time: 1, data: { message: { role: 'system', content: blocks('a'.repeat(400)) } } },
|
|
38
|
+
{ type: 'system/message', time: 2, data: { message: { role: 'system', content: blocks('b'.repeat(800)) } } },
|
|
39
|
+
])
|
|
40
|
+
assert(r.parts.system > 0, `system should count, got ${r.parts.system}`)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
check('request/header 提供工具定义 tokens,request/context 提供窗口', () => {
|
|
44
|
+
const tools = [{ name: 'ask', description: 'd'.repeat(200), parameters: { type: 'object' } }]
|
|
45
|
+
const r = composeFromEvents([
|
|
46
|
+
{ type: 'request/header', time: 1, data: { header: { tools, config: { maxTokens: 256000 } } } },
|
|
47
|
+
{ type: 'request/context', time: 2, data: { contextWindow: 1048576 } },
|
|
48
|
+
])
|
|
49
|
+
assert(r.parts.tools > 0, `tools should count, got ${r.parts.tools}`)
|
|
50
|
+
assert(r.contextWindow === 1048576, `window ${r.contextWindow}`)
|
|
51
|
+
assert(r.maxOutputTokens === 256000, `maxOut ${r.maxOutputTokens}`)
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
check('锚定:真实输入缩放估算构成', () => {
|
|
55
|
+
// estimate: 1000 chars ≈ 250 tok;真实输入 500 → 缩放 0.5
|
|
56
|
+
const events = [
|
|
57
|
+
{ type: 'user/message', time: 1, data: { content: blocks('a'.repeat(1000)) } },
|
|
58
|
+
{ type: 'request/header', time: 2, data: { header: { tools: [], config: { maxTokens: 256000 } } } },
|
|
59
|
+
]
|
|
60
|
+
const raw = composeFromEvents(events)
|
|
61
|
+
assert(raw.parts.user === 254, `raw estimate ${raw.parts.user}`)
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
check('空事件流:全零但结构完整', () => {
|
|
65
|
+
const r = composeFromEvents([])
|
|
66
|
+
assert(r.total === 0 && r.contextWindow === null && r.parts.tools === 0, 'empty stream shape')
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
console.log(`compose.test.mjs — ${pass.length} passed, ${fail.length} failed`)
|
|
70
|
+
for (const label of fail) console.log(` ✗ ${label}`)
|
|
71
|
+
process.exitCode = fail.length ? 1 : 0
|