@ssamurias/dsh-fish 1.1.5 → 1.1.6

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.
Files changed (54) hide show
  1. package/AGENTS.md +13 -4
  2. package/CHANGELOG.md +70 -0
  3. package/README.md +10 -1
  4. package/RELEASE-NOTES-1.1.6.md +57 -0
  5. package/lib/ask.js +7 -1
  6. package/lib/claim.js +23 -0
  7. package/lib/client.js +243 -71
  8. package/lib/cue.js +99 -23
  9. package/lib/derive.js +49 -5
  10. package/lib/events.js +28 -0
  11. package/lib/handoff.js +9 -1
  12. package/lib/home.js +4 -0
  13. package/lib/index.js +9 -3
  14. package/lib/memorymap-html.js +1 -1
  15. package/lib/move.js +68 -8
  16. package/lib/observe-bili.js +32 -2
  17. package/lib/observe-config.js +14 -2
  18. package/lib/observe-data.js +3 -1
  19. package/lib/observe-home.js +13 -3
  20. package/lib/observe-state.js +3 -2
  21. package/lib/proactive.js +4 -2
  22. package/lib/quality.js +202 -48
  23. package/lib/recall.js +69 -23
  24. package/lib/reset-pending.js +15 -5
  25. package/lib/reset.js +78 -0
  26. package/lib/retire.js +42 -1
  27. package/lib/say.js +4 -0
  28. package/lib/scheduler.js +32 -27
  29. package/lib/selfdoc.js +1 -1
  30. package/lib/settings.js +148 -31
  31. package/lib/status.js +1 -1
  32. package/lib/timeintent.js +178 -0
  33. package/lib/types.d.ts +1 -0
  34. package/lib/wiki.js +63 -8
  35. package/package.json +4 -1
  36. package/tools/README.md +70 -0
  37. package/tools/recall-bench.mjs +240 -0
  38. package/tools/recall-cases.json +64 -0
  39. package/tools/recall-live-cases.json +20 -0
  40. package/lib/client/00-shell.js +0 -630
  41. package/lib/client/01-state-load.js +0 -968
  42. package/lib/client/02-actions.js +0 -692
  43. package/lib/client/03-widgets-header.js +0 -749
  44. package/lib/client/04-pressure-lab.js +0 -906
  45. package/lib/client/05-pressure-charts.js +0 -431
  46. package/lib/client/06-tab-status-grow.js +0 -479
  47. package/lib/client/07-tab-home-bili.js +0 -610
  48. package/lib/client/08-tab-memory-plugins.js +0 -676
  49. package/lib/client/09-tab-outing.js +0 -797
  50. package/lib/client/10-data-handlers.js +0 -519
  51. package/lib/client/11-tab-data-frame.js +0 -812
  52. package/lib/client/12-pressure-chip-mount.js +0 -579
  53. package/scripts/build-client.mjs +0 -97
  54. package/scripts/sync-pressure-formulas.mjs +0 -14
package/lib/client.js CHANGED
@@ -570,8 +570,88 @@ window.__ModuleLoader__.load({
570
570
  '.dfish .qrbtns button{height:30px;padding:0 14px;font-size:13px;border-radius:8px}',
571
571
  '.dfish .qrbtns button.go{background:var(--dsw-alias-state-business-primary);border-color:var(--dsw-alias-state-business-primary);color:var(--dsw-alias-label-primary-inverted,#fff)}',
572
572
  '.dfish .qrbtns button.go:hover:not(:disabled){opacity:.9;color:var(--dsw-alias-label-primary-inverted,#fff);border-color:var(--dsw-alias-state-business-primary)}',
573
+ // 看过的视频:两列大图卡片(2026-12-01,用户要求参考 dsh-bili-scroll)。
574
+ // 按天分块,每块内部是 16:9 封面 + 两行标题 + 来路/UP 的网格。
575
+ // 封面用 aspect-ratio 撑住高度,取不到图时那一格留灰底——不会把整行拽塌。
576
+ '.dfish .histdays{display:flex;flex-direction:column;gap:16px;margin:2px 0}',
577
+ '.dfish .histday{min-width:0}',
578
+ '.dfish .histdayhd{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:0 0 7px;padding:0 0 5px;border-bottom:.5px solid var(--dsw-alias-border-l2);font-size:12px;line-height:17px;color:var(--dsw-alias-label-tertiary)}',
579
+ '.dfish .histdayhd b{font-weight:600;font-size:12.5px;letter-spacing:.02em;font-variant-numeric:tabular-nums}',
580
+ '.dfish .histgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}',
581
+ '.dfish .histcard{display:flex;flex-direction:column;min-width:0;overflow:hidden;border:.5px solid var(--dsw-alias-border-l2);border-radius:10px;background:rgba(128,128,128,.04);color:inherit;text-decoration:none;transition:border-color .15s,background .15s}',
582
+ '.dfish .histcard:hover{border-color:var(--dsw-alias-state-business-primary);background:rgba(128,128,128,.08);color:inherit;text-decoration:none}',
583
+ '.dfish .histcard:hover .histtitle{text-decoration:underline}',
584
+ '.dfish .histcoverwrap{display:block;position:relative;aspect-ratio:16/9;background:rgba(128,128,128,.14);overflow:hidden}',
585
+ '.dfish .histcover{display:block;width:100%;height:100%;object-fit:cover}',
586
+ '.dfish .histbody{display:flex;flex-direction:column;gap:6px;padding:8px 10px 10px;min-width:0}',
587
+ '.dfish .histtitle{font-size:13px;line-height:19px;font-weight:500;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-break:break-word}',
588
+ '.dfish .histsub{display:flex;align-items:center;gap:6px;min-width:0;font-size:11px;line-height:16px;color:var(--dsw-alias-label-tertiary)}',
589
+ '.dfish .histsub .tag{margin-left:0;flex:0 0 auto}',
590
+ '.dfish .histup{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
591
+ // 「看过画面」是三种来路里最实的一种,卡片上给它一点颜色;另两种保持灰。
592
+ '.dfish .histhow.watch{color:var(--dsw-alias-state-business-primary);border-color:var(--dsw-alias-state-business-primary)}',
593
+ // 手机窄屏(2026-12-01,用户要求:只在手机尺寸下变,电脑端一模一样)。
594
+ // 走 @media 而不是 container:dsh-Go 的网页版就是把官方 UI 铺在整个 WebView 里,
595
+ // 视口宽就是内容宽;桌面端超过 600 一行都不命中,样式与原来逐字相同。
596
+ // 触控尺寸:宿主在「手机布局 + 粗指针」下会给 button/select/input 兜 44×44,
597
+ // 这里自己先抬到 38–40,普通手机浏览器里也不至于太小;开关单独退出那条规则
598
+ // (data-dsh-adapt="off",见 03-widgets-header.js),否则 40×22 的胶囊会被撑成方块。
599
+ '@media (max-width: 600px){' + [
600
+ '.dfish{gap:12px}',
601
+ '.dfish .page{grid-template-columns:minmax(0,1fr);gap:12px}',
602
+ '.dfish .card{padding:11px 12px}',
603
+ '.dfish .tabs{flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;-webkit-overflow-scrolling:touch}',
604
+ '.dfish .tabs::-webkit-scrollbar{display:none}',
605
+ '.dfish .tabs .grow{display:none}',
606
+ '.dfish .tab{flex:0 0 auto;height:36px;padding:0 13px;font-size:13px}',
607
+ '.dfish .grid2{grid-template-columns:minmax(0,1fr)}',
608
+ '.dfish .kv{grid-template-columns:auto minmax(0,1fr);gap:4px 10px}',
609
+ '.dfish .form label{flex-direction:column;align-items:flex-start;gap:5px}',
610
+ // 输入框的 width:100% 要配 border-box,否则 padding 和描边会把它顶出卡片右边。
611
+ '.dfish input[type=text],.dfish input[type=number],.dfish input[type=time],.dfish input[type=date],.dfish select{box-sizing:border-box}',
612
+ '.dfish input[type=text]{min-width:0;width:100%;height:38px;font-size:16px}',
613
+ '.dfish input[type=number]{width:76px;height:38px;font-size:16px}',
614
+ '.dfish input[type=time]{height:38px;font-size:16px}',
615
+ '.dfish input[type=date]{height:38px;font-size:16px;max-width:100%}',
616
+ '.dfish select{height:38px;font-size:16px;max-width:100%}',
617
+ '.dfish textarea{min-height:88px;font-size:16px;line-height:22px}',
618
+ '.dfish button{height:38px;padding:0 12px}',
619
+ '.dfish .sw{width:46px;height:28px}',
620
+ '.dfish .sw .knob{width:22px;height:22px}',
621
+ '.dfish .sw.on .knob{left:20px}',
622
+ '.dfish .step{width:38px;height:38px;font-size:16px}',
623
+ '.dfish .chip{height:32px;padding:0 11px;font-size:12.5px}',
624
+ '.dfish .pager button{height:32px}',
625
+ '.dfish .seg>button{height:32px}',
626
+ '.dfish .go{height:38px}',
627
+ '.dfish .faq-btn{height:40px}',
628
+ '.dfish details.adv>summary{min-height:36px;line-height:36px}',
629
+ // 看过的视频:两列在 390 宽时每张只剩 ~170px,标题和来路标签挤成一团,回落单列。
630
+ '.dfish .histgrid{grid-template-columns:minmax(0,1fr);gap:10px}',
631
+ '.dfish .histtitle{font-size:13.5px;line-height:20px}',
632
+ // 日期头那颗「只看这天」写的是行内 style(22px),要 !important 才抬得动。
633
+ '.dfish .histdayhd button{height:32px!important;padding:0 10px!important;font-size:12px!important}',
634
+ // 六列固定表:不缩字,改成整表横向滑动(外层就是 overflowX:auto 的盒子)。
635
+ '.dfish .pressure-table{min-width:520px;table-layout:auto}',
636
+ // 图表的 viewBox 是 680–750 宽,硬缩到 390 时轴字只剩 6–7px;给一条横向滑动的地板。
637
+ '.dfish .chartscroll{overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}',
638
+ '.dfish .chartscroll>svg{min-width:620px}',
639
+ // 月历:30px 格子排成 222px 宽在手机上够用但难点;窄屏撑满一行、格子抬到 34。
640
+ '.dfish .calwrap{display:block!important;width:100%;box-sizing:border-box}',
641
+ '.dfish .cal{grid-template-columns:repeat(7,minmax(0,1fr))!important;width:100%}',
642
+ '.dfish .cal>button{height:34px!important;line-height:34px!important}',
643
+ '.dfish .qrovl{padding:12px}',
644
+ '.dfish .qrcard{padding:16px 14px 12px}',
645
+ '.dfish .qrbtns button{height:40px}',
646
+ ].join('') + '}',
573
647
  ].join('\n')
574
648
 
649
+ // 图表在窄屏下不缩字,改成一条可横向滑动的画布(2026-12-01,手机适配)。
650
+ // 包一层 div 而不是给 svg 加 overflow:svg 自己的 overflow 不产生滚动条。
651
+ function chartBox(svg) {
652
+ return h('div', { className: 'chartscroll' }, svg)
653
+ }
654
+
575
655
  function useStyleOnce() {
576
656
  useEffect(() => {
577
657
  const current = document.querySelector(`style[data-tag="${CSS_TAG}"]`)
@@ -673,6 +753,7 @@ window.__ModuleLoader__.load({
673
753
  }, String(d)))
674
754
  }
675
755
  return h('div', {
756
+ className: 'calwrap',
676
757
  style: {
677
758
  display: 'inline-block', marginTop: '6px', padding: '8px 10px',
678
759
  border: '1px solid rgba(128,128,128,.28)', borderRadius: '8px',
@@ -710,6 +791,7 @@ window.__ModuleLoader__.load({
710
791
  h('button', { disabled: o.busy || !month, title: o.nextTitle, onClick: () => o.setMonth(calShiftMonth(month, 1)) }, '›'),
711
792
  h('button', { disabled: o.busy || !days.length, title: o.recentTitle, onClick: () => o.setMonth(calMonthOf(days[0])) }, '最近')),
712
793
  h('div', {
794
+ className: 'cal',
713
795
  style: {
714
796
  display: 'grid', gridTemplateColumns: 'repeat(7, 30px)',
715
797
  gap: '2px', marginTop: '6px', alignItems: 'center',
@@ -748,6 +830,10 @@ window.__ModuleLoader__.load({
748
830
  }
749
831
  function qStability(v) {
750
832
  if (!v) return '—'
833
+ // 2026-11-30(外部反馈「设置页还是 18 秒」):稳定要跑 24 次全量派生,
834
+ // 现在不在请求里现算了——先给上一份,或者让后台算完再回来。
835
+ // 那两种情况都不是「样本不够」,不能印成「还没攒到判断」。
836
+ if (v.pending) return '正在量(后台算,不挡页面;过一会儿再打开就有数)'
751
837
  const band = bandOf(v && v.band)
752
838
  // 2026-10-27(用户 m06350):能测出来的时候,数字和判读一起给——只印那句
753
839
  // 「长在这些事上,抽掉一条少一块」,用户看不出到底是多少,以为没测。
@@ -1194,8 +1280,11 @@ window.__ModuleLoader__.load({
1194
1280
  // 1.1.4:一次性提示(升级后第一次打开插件页看一次)。
1195
1281
  const [notices, setNotices] = useState([])
1196
1282
  // 时段(2026-10-23 加):醒来 / 上网 / 说话,三段各自可调
1197
- const [wakeFrom, setWakeFrom] = useState('20:00')
1198
- const [wakeTo, setWakeTo] = useState('23:00')
1283
+ // 醒来时段可以是多段(2026-11-30,用户 m01985):中午一段、晚上一段,
1284
+ // 各段按长度分配定时醒来。第一段同时写回老字段 `window`,老读取点照旧。
1285
+ const [wakeSegs, setWakeSegs] = useState([['20:00', '23:00']])
1286
+ // 改一段里的开始(k=0)或结束(k=1)
1287
+ const setWakeSegAt = (i, k, v) => setWakeSegs((list) => list.map((s, j) => (j === i ? (k === 0 ? [v, s[1]] : [s[0], v]) : s)))
1199
1288
  // 上网时段没单独配 = 跟着醒来时段(issue #86 第 2 条),所以初值就是醒来那两个数
1200
1289
  const [browseFrom, setBrowseFrom] = useState('20:00')
1201
1290
  const [browseTo, setBrowseTo] = useState('23:00')
@@ -1579,6 +1668,19 @@ window.__ModuleLoader__.load({
1579
1668
  try {
1580
1669
  // 2026-11-28(外部反馈:设置页七项全显示默认值):/state 读不到不该把后面
1581
1670
  // 整段拖下水——设置页的值是从 /config 回的整份配置灌的,那条能走通就照常显示。
1671
+ // 2026-12-01(issue #184):这几条互不依赖,先一起发出去,
1672
+ // 别让 /state 一条一条排队——串起来只会让首屏等最长的那一条。
1673
+ const batchP = Promise.all([
1674
+ jget('/beliefs'),
1675
+ jget('/diary'),
1676
+ jget('/config'),
1677
+ jget('/browse'),
1678
+ jget('/inbox?limit=60').catch(() => null),
1679
+ jget('/home').catch(() => null),
1680
+ jget('/paths').catch(() => null),
1681
+ ])
1682
+ // 就算 /state 失败、没人来 await,也别留一个没人管的拒绝
1683
+ batchP.catch(() => {})
1582
1684
  let s = null
1583
1685
  const stateFail = await jget('/state').then((r) => { s = r; return '' }).catch((e) => String(e?.message || e))
1584
1686
  if (stateFail) setErr(stateFail)
@@ -1632,15 +1734,7 @@ window.__ModuleLoader__.load({
1632
1734
  // 不再拉 /events(2026-11-02,用户 m00335):这里取回来的 e.rows 只进了
1633
1735
  // setEvents,全文件没有一处渲染它——每 30 秒白拉 25 条事件(九成是后台记账)。
1634
1736
  // 想看账本原文去「数据」页,那里给的是路径,不靠这条轮询。
1635
- const [b, d, c, br, ib, hm, pth] = await Promise.all([
1636
- jget('/beliefs'),
1637
- jget('/diary'),
1638
- jget('/config'),
1639
- jget('/browse'),
1640
- jget('/inbox?limit=60').catch(() => null),
1641
- jget('/home').catch(() => null),
1642
- jget('/paths').catch(() => null),
1643
- ])
1737
+ const [b, d, c, br, ib, hm, pth] = await batchP
1644
1738
  setBeliefs(b)
1645
1739
  setDiary(d)
1646
1740
  // 首天正文随 /diary 一起回来了,先灌进翻页缓存(省一次往返)。
@@ -1655,7 +1749,13 @@ window.__ModuleLoader__.load({
1655
1749
  setHome(hm)
1656
1750
  setDataPaths(pth)
1657
1751
  // 迁移工作区:只读她现在住哪、有多少东西(失败就只显示按钮,不影响别处)
1658
- jget('/move').then(setMoveInfo).catch(() => {})
1752
+ // 大小是后台量的(issue #184):这一趟先给「正在量」,过几秒再取一次就有数了。
1753
+ jget('/move').then((mv) => {
1754
+ setMoveInfo(mv)
1755
+ if (mv && mv.sizing) {
1756
+ window.setTimeout(() => { jget('/move').then(setMoveInfo).catch(() => {}) }, 4000)
1757
+ }
1758
+ }).catch(() => {})
1659
1759
  // 自动备份现在攒了几份(失败就当还没攒过)
1660
1760
  jget('/backup/auto').then(setAutoState).catch(() => {})
1661
1761
  // 出门:现在在哪、有哪些工作区可去、说明卡确认过没有(失败就只显示空页)
@@ -1795,7 +1895,11 @@ window.__ModuleLoader__.load({
1795
1895
  setCloudLatestUp(cfg.cloud?.latestUp === true)
1796
1896
  // 时段:醒来 / 上网 / 说话。坏值由服务端兜底,这里只做展示。
1797
1897
  const w0 = Array.isArray(cfg.window) ? cfg.window : ['20:00', '23:00']
1798
- setWakeFrom(w0[0]); setWakeTo(w0[1])
1898
+ // 多段(2026-11-30):`windows` 是全量,老配置只有 `window` 时按一段处理。
1899
+ const ws = Array.isArray(cfg.windows) && cfg.windows.length
1900
+ ? cfg.windows.filter((x) => Array.isArray(x) && x.length === 2).map((x) => [String(x[0]), String(x[1])])
1901
+ : []
1902
+ setWakeSegs(ws.length ? ws : [[String(w0[0]), String(w0[1])]])
1799
1903
  // 上网时段:没单独配(null)就是跟着醒来时段,界面上直接显示醒来那两个数。
1800
1904
  const b0 = Array.isArray(cfg.browse?.window) ? cfg.browse.window : w0
1801
1905
  setBrowseFrom(b0[0]); setBrowseTo(b0[1])
@@ -1937,7 +2041,9 @@ window.__ModuleLoader__.load({
1937
2041
  minDuration: Number(avoidMinDur),
1938
2042
  upMids: avoidMids.split(/[,,\s]+/).map((x) => x.trim()).filter(Boolean),
1939
2043
  },
1940
- window: [wakeFrom, wakeTo],
2044
+ // 醒来时段:`window` 是第一段(老字段),`windows` 是全量(2026-11-30)。
2045
+ window: wakeSegs[0] ? wakeSegs[0].slice() : ['20:00', '23:00'],
2046
+ windows: wakeSegs.map((s) => s.slice()),
1941
2047
  // 2026-11-07(用户反馈):能上网这颗开关要写到两个地方——
1942
2048
  // bili.enabled 是 0.9.x 下 bili_look / bili_watch 真正认的闸门;
1943
2049
  // browse.enabled 留着给老参数(以及以后要不要恢复自动刷的那个决定)。
@@ -2019,8 +2125,13 @@ window.__ModuleLoader__.load({
2019
2125
  if (from === to) return `${label}:开始和结束不能是同一时刻。要全天,请设 00:00–23:59。`
2020
2126
  return ''
2021
2127
  }
2022
- return one(S('她醒着的时间段'), wakeFrom, wakeTo)
2023
- || one('上网时段', browseFrom, browseTo)
2128
+ const segs = Array.isArray(wakeSegs) && wakeSegs.length ? wakeSegs : [['20:00', '23:00']]
2129
+ for (let i = 0; i < segs.length; i += 1) {
2130
+ const label = segs.length > 1 ? `${S('她醒着的时间段')}(第 ${i + 1} 段)` : S('她醒着的时间段')
2131
+ const why = one(label, segs[i][0], segs[i][1])
2132
+ if (why) return why
2133
+ }
2134
+ return one('上网时段', browseFrom, browseTo)
2024
2135
  || one('评论时段', commentFrom, commentTo)
2025
2136
  }
2026
2137
 
@@ -2579,6 +2690,10 @@ window.__ModuleLoader__.load({
2579
2690
  type: 'button',
2580
2691
  className: 'sw' + (o.on ? ' on' : ''),
2581
2692
  role: 'switch',
2693
+ // 2026-12-01:dsh-Go 的网页版会给 [data-slot="main"] 里的 button 兜 44×44
2694
+ // 的触控最小尺寸;开关是固定 40×22 的胶囊,被撑高会变成一块竖着的圆角砖。
2695
+ // 这一颗自己退出那条规则,窄屏样式里再把胶囊抬到 46×28。
2696
+ 'data-dsh-adapt': 'off',
2582
2697
  'aria-checked': o.on ? 'true' : 'false',
2583
2698
  onClick: () => o.onChange(!o.on),
2584
2699
  }, h('span', { className: 'knob' })))
@@ -3910,7 +4025,7 @@ window.__ModuleLoader__.load({
3910
4025
  const ticks = signed ? [-limit, -limit / 2, 0, limit / 2, limit] : [0, limit / 2, limit]
3911
4026
  return h('section', { className: 'pressure-section' },
3912
4027
  h('h4', null, label + '(压力分)'),
3913
- h('svg', { viewBox: '0 0 680 250', role: 'group', 'aria-label': label, style: { width: '100%' } },
4028
+ chartBox(h('svg', { viewBox: '0 0 680 250', role: 'group', 'aria-label': label, style: { width: '100%' } },
3914
4029
  ...ticks.map(tick => h('g', { key: tick },
3915
4030
  h('line', { x1: 58, x2: 660, y1: y(tick), y2: y(tick), stroke: 'currentColor',
3916
4031
  opacity: tick === 0 ? .85 : .2, strokeWidth: tick === 0 ? 2 : 1 }),
@@ -3934,7 +4049,7 @@ window.__ModuleLoader__.load({
3934
4049
  width: 30, height: barHeight, fill: barColors[row.horizon] }),
3935
4050
  h('text', { x, y: value < 0 ? Math.min(220, y(value) + 12) : y(value) - 5, textAnchor: 'middle',
3936
4051
  fill: 'currentColor', fontSize: 11 }, result.count + ' 次'))
3937
- })),
4052
+ }))),
3938
4053
  h('p', null, ...backtestHorizons.map(horizon => h('span', { key: horizon, style: { marginInlineEnd: 14 } },
3939
4054
  h('span', { style: { color: barColors[horizon] }, 'aria-hidden': true }, '■ '), '提前 ' + horizon + ' 轮'))))
3940
4055
  }
@@ -3966,7 +4081,7 @@ window.__ModuleLoader__.load({
3966
4081
  h('label', null, '预测起点 ', h('select', { value: detailOrigin,
3967
4082
  onChange: event => changeTrend({ backtestOrigin: Number(event.currentTarget.value) }) },
3968
4083
  ...detailOrigins.map(round => h('option', { key: round, value: round }, '第 ' + round + ' 轮'))))),
3969
- h('svg', { viewBox: '0 0 680 255', role: 'group', 'aria-label': '真实压力与预测压力', style: { width: '100%' } },
4084
+ chartBox(h('svg', { viewBox: '0 0 680 255', role: 'group', 'aria-label': '真实压力与预测压力', style: { width: '100%' } },
3970
4085
  ...[0, 25, 50, 75, 100].map(value => h('g', { key: value },
3971
4086
  h('line', { x1: 48, x2: 660, y1: detailY(value), y2: detailY(value), stroke: 'currentColor', opacity: .2 }),
3972
4087
  h('text', { x: 40, y: detailY(value) + 4, textAnchor: 'end', fill: 'currentColor', fontSize: 12 }, value))),
@@ -3989,7 +4104,7 @@ window.__ModuleLoader__.load({
3989
4104
  row ? h('circle', { cx: detailX(point.round), cy: detailY(row.estimate), r: 5, fill: '#c96a11' }) : null)
3990
4105
  }),
3991
4106
  ...[...new Set([1, detailOrigin, ...detailRecords.map(row => row.target)])].map(round =>
3992
- h('text', { key: round, x: detailX(round), y: 239, fill: 'currentColor', fontSize: 12, textAnchor: 'middle' }, round))),
4107
+ h('text', { key: round, x: detailX(round), y: 239, fill: 'currentColor', fontSize: 12, textAnchor: 'middle' }, round)))),
3993
4108
  h('p', null, '蓝实线为真实压力,橙虚线通向各有效预测目标。竖线标出预测起点及已记录事件。'),
3994
4109
  pressureTable(['目标轮', '实际', '预测', '误差', '归因'], detailRecords.map(row =>
3995
4110
  [row.target, row.target, scoreOf(row.actual), scoreOf(row.estimate), signedScore(row.estimate - row.actual),
@@ -4111,7 +4226,7 @@ window.__ModuleLoader__.load({
4111
4226
  !trendLoading && (loadedIds.some(id => trendData[id]?.status !== 'analyzed'))
4112
4227
  ? h('p', { className: 'hint' }, '部分会话的日志不可用或超出本地分析范围。') : null,
4113
4228
  !shownSeries.some(line => line.points.some(point => Number.isFinite(point.score))) ? h('p', null, '该范围暂无可绘制的完整轮末读数。') : null,
4114
- shownSeries.length ? h('svg', { viewBox: '0 0 750 282', role: 'group', 'aria-label': '用户已完成轮次与压力分',
4229
+ shownSeries.length ? chartBox(h('svg', { viewBox: '0 0 750 282', role: 'group', 'aria-label': '用户已完成轮次与压力分',
4115
4230
  style: { width: '100%', height: 'auto', minHeight: '160px' } },
4116
4231
  ...[0, 25, 50, 75, 100].map(score => h('g', { key: score },
4117
4232
  h('line', { x1: 46, x2: 726, y1: trendY(score), y2: trendY(score), stroke: 'currentColor', opacity: .14 }),
@@ -4142,7 +4257,7 @@ window.__ModuleLoader__.load({
4142
4257
  h('rect', { x: 46, y: 32, width: 680, height: 204, fill: 'transparent',
4143
4258
  onPointerMove: event => setTrendFocus(pointerRound(event)),
4144
4259
  onPointerLeave: () => setTrendFocus(null),
4145
- onClick: event => chooseRound(pointerRound(event)) })) : null,
4260
+ onClick: event => chooseRound(pointerRound(event)) }))) : null,
4146
4261
  shownSeries.length ? h('div', null,
4147
4262
  h('label', null, '查看第 ' + focusRound + ' 轮 ', h('input', { type: 'range', min: firstRound, max: maxRound,
4148
4263
  value: focusRound, onChange: event => chooseRound(event.currentTarget.valueAsNumber) })),
@@ -4231,7 +4346,7 @@ window.__ModuleLoader__.load({
4231
4346
  if (!points.some(point => lines.some(line => Number.isFinite(line.read(point))))) {
4232
4347
  return h('p', { className: 'hint' }, '暂无可绘制的轮末分数。')
4233
4348
  }
4234
- return h('svg', { viewBox: '0 0 680 220', role: 'group', 'aria-label': '轮末压力走势(0–100)', style: { width: '100%' } },
4349
+ return chartBox(h('svg', { viewBox: '0 0 680 220', role: 'group', 'aria-label': '轮末压力走势(0–100)', style: { width: '100%' } },
4235
4350
  ...[0, 25, 50, 75, 100].map(value => h('g', { key: value },
4236
4351
  h('line', { x1: 43, x2: 660, y1: y(value), y2: y(value), stroke: 'currentColor', opacity: .16 }),
4237
4352
  h('text', { x: 35, y: y(value) + 4, fill: 'currentColor', fontSize: 12, textAnchor: 'end' }, value))),
@@ -4251,7 +4366,7 @@ window.__ModuleLoader__.load({
4251
4366
  h('title', null, label),
4252
4367
  ...values.map(([line, score]) => h('circle', { key: line.label, cx: x(point.round), cy: y(score), r: 3, fill: line.color })),
4253
4368
  point.markers.length ? h('path', { d: 'M ' + x(point.round) + ' 13 l 4 4 -4 4 -4 -4 z', fill: 'currentColor' }) : null)] : []
4254
- }))
4369
+ })))
4255
4370
  }
4256
4371
  function lineToggles(key, options) {
4257
4372
  const hidden = trendConfig[key] ?? []
@@ -4467,7 +4582,7 @@ window.__ModuleLoader__.load({
4467
4582
  function contributionBars(values, name) {
4468
4583
  if (!values) return h('p', { className: 'hint' }, '该公式或端点缺少可分解的分数。')
4469
4584
  const scale = 208 / Math.max(1, ...values.map(Math.abs))
4470
- return h('svg', { viewBox: '0 0 650 132', role: 'group', 'aria-label': name, style: { width: '100%' } },
4585
+ return chartBox(h('svg', { viewBox: '0 0 650 132', role: 'group', 'aria-label': name, style: { width: '100%' } },
4471
4586
  h('line', { x1: 320, x2: 320, y1: 6, y2: 116, stroke: 'currentColor', opacity: .6 }),
4472
4587
  ...values.map((value, index) => {
4473
4588
  const y = 15 + 35 * index
@@ -4476,7 +4591,7 @@ window.__ModuleLoader__.load({
4476
4591
  h('title', null, label), h('text', { x: 10, y: y + 13, fill: 'currentColor', fontSize: 14 }, scoreNames[index]),
4477
4592
  h('rect', { x: 320 + Math.min(0, value * scale), y, width: Math.abs(value * scale), height: 17, fill: childColors[index] }),
4478
4593
  h('text', { x: 555, y: y + 13, fill: 'currentColor', fontSize: 14 }, signedScore(value)))
4479
- }))
4594
+ })))
4480
4595
  }
4481
4596
  const attributionPanel = !wantAttribution ? null : h('section', { className: 'load-panel' },
4482
4597
  h('h4', null, '压力变化归因 · v0.1'),
@@ -4908,7 +5023,7 @@ window.__ModuleLoader__.load({
4908
5023
  '醒来通常带一张事件卡。定时醒来取「每天定时醒几次」和「每天几张事件卡」里小的;主动搭话另算,不占这个数。这是上限,不是保证:没有可出的事、或落点太靠后,可能少醒一次。',
4909
5024
  h('div', { className: 'grid2' },
4910
5025
  Num({ label: '每天定时醒几次', value: wakes, onChange: setWakes, min: 0, max: 12, unit: '次',
4911
- hint: S('只限定时醒来(含空醒)。你手动叫醒会记一次、挤掉后面的定时醒来,但手动本身随时能按(每天醒 0 次时除外)。0 为关掉定时醒来,右上角「现在叫醒大肥鱼」也叫不醒;直接跟她说话不受影响。范围 0–12:每醒一次都是一次模型调用,开得越密越慢、越费钱;醒来时段只有 3 小时,12 次已经接近每 15 分钟一次。') }),
5026
+ hint: S('只限定时醒来(含空醒)。你手动叫醒会记一次、挤掉后面的定时醒来,但手动本身随时能按(每天醒 0 次时除外)。0 为关掉定时醒来,右上角「现在叫醒大肥鱼」也叫不醒;直接跟她说话不受影响。范围 0–12:每醒一次都是一次模型调用,开得越密越慢、越费钱。醒来时段有几段时,这几下会按段长分到各段里——两段都开、次数却只有 1,就只会醒在其中一段。') }),
4912
5027
  Num({ label: '每天几张事件卡', value: eventsPerDay, onChange: setEventsPerDay, min: 0, max: 12, unit: '张',
4913
5028
  hint: S('只限定时醒来;和「每天定时醒几次」取小的(两个都调大才有效)。0 为关掉定时醒来,手动按钮也叫不醒;直接跟她说话不受影响。范围 0–12。') }),
4914
5029
  Num({ label: '对话停下来多久才叫醒', value: quietMin, onChange: setQuietMin, min: 0, max: 60, unit: '分钟',
@@ -4916,8 +5031,36 @@ window.__ModuleLoader__.load({
4916
5031
  Sel({ label: '每天问题卡数', value: questionsPerDay, onChange: setQuestionsPerDay, options: [0, 1, 2, 3, 4, 5, 6],
4917
5032
  fmt: (v) => (Number(v) === 0 ? '0 张 · 不出问题卡' : `${v} 张`),
4918
5033
  hint: S('每天最多几张问答类事件卡;她向你提请求的卡不归它管。') }),
4919
- TimeRange({ label: S('她醒着的时间段'), from: wakeFrom, to: wakeTo, onFrom: setWakeFrom, onTo: setWakeTo,
4920
- hint: S('只在这段里自己醒:定时醒来、空醒、主动搭话都算。过了结束时间,她不会再自己醒;你发消息、有人 @ 她、你按「叫醒」,任何时间都能把她叫醒。开始和结束不能相同。') }))),
5034
+ // 醒来时段可以有多段(2026-11-30,用户 m01985):有人的作息是
5035
+ // 「中午醒一段、晚上醒一段」。段与段之间她不会自己醒,定时醒来按段长
5036
+ // 分配,所以两段都要至少留够醒一次的时长。
5037
+ h('div', { className: 'fld' },
5038
+ h('div', { className: 'fl' },
5039
+ h('span', { className: 'flabel' }, S('她醒着的时间段')),
5040
+ h('span', { className: 'fhint' }, S('只在这些段里自己醒:定时醒来、空醒、主动搭话都算。可以加几段——中午一段、晚上一段;段与段之间她不会自己醒。过了结束时间,她不会再自己醒;你发消息、有人 @ 她、你按「叫醒」,任何时间都能把她叫醒。每段的开始和结束不能相同,最多 4 段。'))),
5041
+ (Array.isArray(wakeSegs) ? wakeSegs : []).map((seg, i) => h('div', { key: `wake-${i}`, style: { display: 'flex', gap: '8px', alignItems: 'flex-start' } },
5042
+ h('div', { style: { flex: '1' } },
5043
+ TimeRange({
5044
+ label: (Array.isArray(wakeSegs) && wakeSegs.length > 1) ? `第 ${i + 1} 段` : '',
5045
+ from: seg[0],
5046
+ to: seg[1],
5047
+ onFrom: (v) => setWakeSegAt(i, 0, v),
5048
+ onTo: (v) => setWakeSegAt(i, 1, v),
5049
+ })),
5050
+ (Array.isArray(wakeSegs) && wakeSegs.length > 1)
5051
+ ? h('button', {
5052
+ className: 'ghost',
5053
+ style: { marginTop: '22px' },
5054
+ onClick: () => setWakeSegs((list) => list.filter((_, j) => j !== i)),
5055
+ }, '删掉这段')
5056
+ : null)),
5057
+ (Array.isArray(wakeSegs) && wakeSegs.length < 4)
5058
+ ? h('button', {
5059
+ className: 'ghost',
5060
+ style: { marginTop: '6px' },
5061
+ onClick: () => setWakeSegs((list) => [...list, ['12:00', '14:00']]),
5062
+ }, '再加一段')
5063
+ : null))),
4921
5064
  // 说话(1.0,用户 m04784):把两件跟「她怎么说话」有关的事放到一处。
4922
5065
  // 「纠正鱼八股」是强行约束说话方式,和「不硬性规定她怎么说」的规矩相冲突,
4923
5066
  // 所以默认关、标实验性,文案必须直说。
@@ -5374,13 +5517,15 @@ window.__ModuleLoader__.load({
5374
5517
  )
5375
5518
 
5376
5519
  // ---------------------------- 上网 ----------------------------
5377
- // 视频观看历史分页(2026-10-28 用户 m00416;当晚按用户反馈改成「随量自适应」):
5520
+ // 视频观看历史分页(2026-10-28 用户 m00416;当晚按用户反馈改成「随量自适应」;
5521
+ // 2026-12-01 改成两列大图卡片之后重排档位):
5378
5522
  // 0.6.6 之前是「按天分组、每页三天」——一天刷 10 条、查 3 天就是 30 条挤在一屏。
5379
5523
  // 现在**按条翻页**,并且每页条数不是一个死数字,而是按「一天实际刷几条」分档:
5380
5524
  // 一共 ≤ 8 条 → 一页全放下,连翻页条都不出(别让人看到「第 1 / 1 页」这种噪音);
5381
- // 日均 > 20 条 → 6 条/页;> 10 → 8 条;> 5 → 10 条;其余 12 条。
5382
- // 也就是刷得越密、每页越短:重度用户一屏不会顶到十几条,轻度用户又不用为翻页而翻页。
5383
- const HIST_PAGE_MAX = 12
5525
+ // 日均 > 20 条 → 6 条/页(3 行);> 10 → 8 条/页(4 行);其余 8 条。
5526
+ // 两列之后一页要凑成偶数,否则最后一行只挂一张、看着像缺了东西。
5527
+ // 也就是刷得越密、每页越短:重度用户一屏不会顶到十几张封面,轻度用户又不用为翻页而翻页。
5528
+ const HIST_PAGE_MAX = 8
5384
5529
  const histFlat = (hist?.groups || []).flatMap((g) =>
5385
5530
  (g.items || []).map((it) => ({ ...it, date: g.date })))
5386
5531
  const histDayCount = (hist?.groups || []).length
@@ -5398,21 +5543,39 @@ window.__ModuleLoader__.load({
5398
5543
  const histTotal = histErr ? 0 : histFound.length
5399
5544
  const histPerDay = histDayCount ? histFlat.length / histDayCount : 0
5400
5545
  const histPageSize = histTotal === 0 ? HIST_PAGE_MAX
5401
- : histTotal <= 8 ? histTotal
5546
+ : histTotal <= 8 ? histTotal + (histTotal % 2)
5402
5547
  : histPerDay > 20 ? 6
5403
- : histPerDay > 10 ? 8
5404
- : histPerDay > 5 ? 10
5405
- : HIST_PAGE_MAX
5548
+ : HIST_PAGE_MAX
5406
5549
  const histPages = Math.max(1, Math.ceil(histTotal / histPageSize))
5407
5550
  const histAt = Math.min(histPage, histPages - 1)
5408
5551
  const histSlice = histFound.slice(histAt * histPageSize, histAt * histPageSize + histPageSize)
5552
+ // 大图卡片一页就能顶出屏幕,翻完页得把列表顶端带回视野,否则看到的还是页面底部,
5553
+ // 会以为没翻过去。只在点翻页时滚,敲搜索词时不动(否则每按一个字页面就往下跳)。
5554
+ const histListRef = useRef(null)
5555
+ const histGo = (p) => {
5556
+ setHistPage(p)
5557
+ const node = histListRef.current
5558
+ if (node && typeof node.scrollIntoView === 'function') {
5559
+ setTimeout(() => node.scrollIntoView({ block: 'start', behavior: 'smooth' }), 0)
5560
+ }
5561
+ }
5409
5562
  const histPager = histPages > 1
5410
5563
  ? h('div', { className: 'row' },
5411
- h('button', { disabled: histAt <= 0, onClick: () => setHistPage(histAt - 1) }, '较新'),
5564
+ h('button', { disabled: histAt <= 0, onClick: () => histGo(histAt - 1) }, '较新'),
5412
5565
  h('span', { className: 'dim' }, `第 ${histAt + 1} / ${histPages} 页 · 一页 ${histPageSize} 条`),
5413
- h('button', { disabled: histAt >= histPages - 1, onClick: () => setHistPage(histAt + 1) }, '更早'))
5566
+ h('button', { disabled: histAt >= histPages - 1, onClick: () => histGo(histAt + 1) }, '更早'))
5414
5567
  : null
5415
5568
  const histHow = (how) => (how === 'watch' ? '看过画面' : how === 'look' ? '点开读过' : '只是翻到过')
5569
+ // 一天有几十条时,一页装不下:按日期把这一页重新切成几块,每块自己带日期头。
5570
+ // 头里报「本页 n / 共 N 条」,这样翻到第二页也知道后面还有这一天。
5571
+ const histDayTotal = new Map()
5572
+ for (const it of histFound) histDayTotal.set(it.date, (histDayTotal.get(it.date) || 0) + 1)
5573
+ const histPageGroups = []
5574
+ for (const it of histSlice) {
5575
+ const g = histPageGroups[histPageGroups.length - 1]
5576
+ if (g && g.date === it.date) g.items.push(it)
5577
+ else histPageGroups.push({ date: it.date, items: [it] })
5578
+ }
5416
5579
 
5417
5580
  const biliPage = h('div', { className: 'page' },
5418
5581
  // 第二个参数是这一组的说明(note),控件从第三个起。0.9.5 把装控件的 grid2 填进了 note 位,
@@ -5621,7 +5784,7 @@ window.__ModuleLoader__.load({
5621
5784
  groupFull('看过的视频',
5622
5785
  // 三种关系分开说(2026-11-24,用户 m01923):以前只剩「看过画面」一种标,
5623
5786
  // 另外两类(她自己点开读过、自动逛时只是翻到过)在列表里长得一样,只能猜。
5624
- S('按天从近到远,点标题打开原视频。「看过画面」是抽帧看过的,「点开读过」是她自己点开的,「只是翻到过」是自动逛时翻到的。'),
5787
+ S('按天从近到远,点卡片打开原视频。「看过画面」是抽帧看过的,「点开读过」是她自己点开的,「只是翻到过」是自动逛时翻到的。'),
5625
5788
  h('div', { className: 'grid2', style: { marginBottom: '6px' } },
5626
5789
  Text({ label: '找一条', value: histQ,
5627
5790
  onChange: (v) => { setHistQ(v); setHistPage(0); searchHist(v) },
@@ -5693,39 +5856,48 @@ window.__ModuleLoader__.load({
5693
5856
  : histPick
5694
5857
  ? `这一天没有记录(${histPick})。把日子放宽,或者清掉筛选。`
5695
5858
  : (histBusy ? '正在读…' : '还没有记录。'))
5696
- : h('div', null, histSlice.map((it, i) => h('div', {
5697
- // 列表按时间从新到旧摊平;换天时插一条日期标签(一页 12 条,不是一天一页)
5698
- key: `${it.date}|${it.bvid}|${i}`,
5699
- style: { display: 'flex', alignItems: 'center', gap: '8px', marginBottom: '6px' },
5700
- },
5701
- i === 0 || histSlice[i - 1].date !== it.date
5702
- ? h('div', { className: 'tag', style: { flex: '0 0 auto', minWidth: '86px' } }, it.date.slice(5))
5703
- : h('span', { style: { flex: '0 0 auto', width: '86px' } }),
5704
- h('img', {
5705
- src: `${API}/cover/${it.bvid}`,
5706
- alt: '',
5707
- loading: 'lazy',
5708
- onError: (e) => { e.currentTarget.style.display = 'none' },
5709
- style: {
5710
- width: '80px',
5711
- height: '50px',
5712
- objectFit: 'cover',
5713
- borderRadius: '4px',
5714
- flex: '0 0 auto',
5715
- background: 'rgba(128,128,128,.15)',
5716
- },
5717
- }),
5718
- // 2026-10-30:真的抽帧看过画面的那几条要能一眼认出来,
5719
- // 否则它跟"只扫了眼标题"在列表里长得一样(客户反馈的原点)。
5720
- // 2026-11-24(用户 m01923):三类分开标,「看过画面」不再吃掉另两类的区别。
5721
- h('span', { className: 'tag', style: { flex: '0 0 auto' } }, histHow(it.how)),
5722
- h('a', {
5859
+ : h('div', { className: 'histdays', ref: histListRef }, histPageGroups.map((g) => {
5860
+ const dayAll = histDayTotal.get(g.date) || g.items.length
5861
+ return h('section', { key: `day|${g.date}`, className: 'histday' },
5862
+ h('div', { className: 'histdayhd' },
5863
+ h('b', null, g.date.slice(5)),
5864
+ h('span', null, g.items.length < dayAll
5865
+ ? `本页 ${g.items.length} / 共 ${dayAll} 条`
5866
+ : `${g.items.length} 条`),
5867
+ // 一天刷满几十条时会连着翻好几页;从这一页直接收窄到这一天,不用再开月历。
5868
+ h('button', {
5869
+ style: {
5870
+ marginLeft: 'auto', height: '22px', padding: '0 8px',
5871
+ fontSize: '11.5px', borderRadius: '6px',
5872
+ },
5873
+ onClick: () => { setHistPick(g.date); setHistOpen(false); setHistPage(0) },
5874
+ }, '只看这天')),
5875
+ h('div', { className: 'histgrid' }, g.items.map((it) => h('a', {
5876
+ key: `${g.date}|${it.bvid}`,
5877
+ className: 'histcard',
5723
5878
  href: it.url,
5724
5879
  target: '_blank',
5725
5880
  rel: 'noreferrer',
5726
- style: { color: 'inherit' },
5727
- }, esc(it.title) || it.bvid),
5728
- h('span', { className: 'tag' }, it.up ? esc(it.up) : '')))),
5881
+ title: esc(it.title) || it.bvid,
5882
+ },
5883
+ // 封面缺了就把 img 藏掉,外面那格按 16:9 留着灰底,卡片高度不会跟着抖。
5884
+ h('span', { className: 'histcoverwrap' },
5885
+ h('img', {
5886
+ className: 'histcover',
5887
+ src: `${API}/cover/${it.bvid}`,
5888
+ alt: '',
5889
+ loading: 'lazy',
5890
+ onError: (e) => { e.currentTarget.style.display = 'none' },
5891
+ })),
5892
+ h('span', { className: 'histbody' },
5893
+ h('span', { className: 'histtitle' }, esc(it.title) || it.bvid),
5894
+ h('span', { className: 'histsub' },
5895
+ // 2026-10-30:真的抽帧看过画面的那几条要能一眼认出来,
5896
+ // 否则它跟"只扫了眼标题"在列表里长得一样(客户反馈的原点)。
5897
+ // 2026-11-24(用户 m01923):三类分开标,「看过画面」不再吃掉另两类的区别。
5898
+ h('span', { className: `tag histhow ${it.how}` }, histHow(it.how)),
5899
+ it.up ? h('span', { className: 'tag histup' }, esc(it.up)) : null))))))
5900
+ })),
5729
5901
  histPages > 1
5730
5902
  ? h('div', { className: 'row', style: { marginTop: '10px' } }, histPager)
5731
5903
  : null,
@@ -7711,7 +7883,7 @@ window.__ModuleLoader__.load({
7711
7883
  }
7712
7884
 
7713
7885
  const moveHint = moveInfo
7714
- ? `现在住在 ${moveInfo.root}(${moveInfo.files} 个文件,约 ${Math.max(1, Math.round((moveInfo.bytes || 0) / 1024))}KB)${moveInfo.moved ? '——已经搬过一次了' : ''}。`
7886
+ ? `现在住在 ${moveInfo.root}(${moveInfo.files} 个文件${moveInfo.sizing ? ',正在量大小…' : `,约 ${Math.max(1, Math.round((moveInfo.bytes || 0) / 1024))}KB`})${moveInfo.moved ? '——已经搬过一次了' : ''}。`
7715
7887
  : ''
7716
7888
 
7717
7889
  const moveCard = h('div', { style: { marginTop: '14px' } },