@ssamurias/dsh-fish 1.0.9 → 1.1.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.
Files changed (51) hide show
  1. package/AGENTS.md +9 -5
  2. package/CHANGELOG.md +4453 -4366
  3. package/README.md +29 -4
  4. package/RELEASE-NOTES-1.1.0.md +55 -0
  5. package/RELEASE-NOTES-1.1.1.md +61 -0
  6. package/docs/troubleshooting.md +4 -4
  7. package/docs//350/256/244/344/272/272/345/210/244/346/215/256.md +19 -5
  8. package/lib/autobackup.js +4 -0
  9. package/lib/bridgeclaim.js +138 -0
  10. package/lib/claim.js +118 -11
  11. package/lib/client/00-shell.js +130 -0
  12. package/lib/client/01-state-load.js +48 -7
  13. package/lib/client/05-pressure-charts.js +1 -1
  14. package/lib/client/06-tab-status-grow.js +12 -1
  15. package/lib/client/07-tab-home-bili.js +82 -14
  16. package/lib/client/08-tab-memory-plugins.js +24 -1
  17. package/lib/client/09-tab-outing.js +1 -1
  18. package/lib/client/11-tab-data-frame.js +111 -21
  19. package/lib/client.js +409 -46
  20. package/lib/derive.js +92 -30
  21. package/lib/events.js +5 -2
  22. package/lib/guess.js +29 -0
  23. package/lib/health.js +20 -1
  24. package/lib/herpeople.js +159 -0
  25. package/lib/history.js +27 -5
  26. package/lib/identity.js +38 -20
  27. package/lib/index.js +16 -5
  28. package/lib/look.js +1 -1
  29. package/lib/observe-bili.js +5 -2
  30. package/lib/observe-home.js +59 -3
  31. package/lib/observe-state.js +1 -1
  32. package/lib/observe.js +8 -2
  33. package/lib/people.js +514 -0
  34. package/lib/peopledoc.js +112 -0
  35. package/lib/persona.js +211 -55
  36. package/lib/proactive.js +11 -0
  37. package/lib/restrict.js +109 -18
  38. package/lib/say.js +24 -2
  39. package/lib/schedules.js +97 -0
  40. package/lib/selfdoc.js +19 -2
  41. package/lib/settings.js +28 -4
  42. package/lib/stance.js +7 -1
  43. package/lib/sub.js +1 -1
  44. package/lib/tenant.js +54 -9
  45. package/lib/types.d.ts +4 -0
  46. package/lib/use.js +3 -3
  47. package/lib/watch.js +1 -1
  48. package/lib/wiki.js +96 -17
  49. package/package.json +1 -1
  50. package/scripts/build-client.mjs +15 -1
  51. package/tools/check-install.mjs +64 -23
package/lib/client.js CHANGED
@@ -589,6 +589,136 @@ window.__ModuleLoader__.load({
589
589
  // ---------------------------------------------------------------- 工具
590
590
  const esc = (s) => String(s == null ? '' : s)
591
591
 
592
+ // ---------------------------------------------------------------- 月历
593
+ // 「挑一个日子」的公共实现(2026-11-24,用户 m01923):数据页的「每日报告」和
594
+ // 上网页的「看过的视频」都要这一件东西。各写一份的话,灰格子、日期框、跨年翻月
595
+ // 这些细节迟早会走样成两套;而且用户在两处看到的应该是同一个操作。
596
+ //
597
+ // 判据沿用日报那一次的结论(NN/g 的日期输入建议):可选项过十个就不该再铺成一条
598
+ // 长列表,日历负责「看得见哪天有」,输入框负责「知道是哪天直接写」。
599
+ const CAL_WEEK = ['一', '二', '三', '四', '五', '六', '日']
600
+ const calMonthOf = (d) => String(d || '').slice(0, 7)
601
+ const calCell = {
602
+ width: '30px', height: '28px', padding: 0, lineHeight: '28px',
603
+ textAlign: 'center', fontVariantNumeric: 'tabular-nums',
604
+ }
605
+ function calShiftMonth(key, delta) {
606
+ const m = /^(\d{4})-(\d{2})$/.exec(String(key || ''))
607
+ if (!m) return ''
608
+ const t = new Date(Date.UTC(Number(m[1]), Number(m[2]) - 1 + delta, 1))
609
+ return `${t.getUTCFullYear()}-${String(t.getUTCMonth() + 1).padStart(2, '0')}`
610
+ }
611
+ function calMonthTitle(key) {
612
+ const m = /^(\d{4})-(\d{2})$/.exec(String(key || ''))
613
+ return m ? `${Number(m[1])} 年 ${Number(m[2])} 月` : ''
614
+ }
615
+ // 手打的日期先洗一遍:2026/9/3、2026.9.3、2026-9-3 都认;2 月 31 号不认。
616
+ function calReadDay(raw) {
617
+ const m = /^(\d{4})[-/.](\d{1,2})[-/.](\d{1,2})$/.exec(String(raw || '').trim())
618
+ if (!m) return ''
619
+ const y = Number(m[1]); const mo = Number(m[2]); const d = Number(m[3])
620
+ const t = new Date(Date.UTC(y, mo - 1, d))
621
+ if (t.getUTCFullYear() !== y || t.getUTCMonth() !== mo - 1 || t.getUTCDate() !== d) return ''
622
+ return `${m[1]}-${String(mo).padStart(2, '0')}-${String(d).padStart(2, '0')}`
623
+ }
624
+
625
+ /**
626
+ * 一块月历面板:日期框 + 翻月 + 「最近」 + 七列格子(周一起)。
627
+ *
628
+ * @param {object} o
629
+ * days 能点的那几天('YYYY-MM-DD',从新到旧)——不在里面的日子一律灰着
630
+ * month 现在摊开哪个月('YYYY-MM');空或非法时按 picked / days[0] 推
631
+ * picked 当前选中的那天(只用来标出来,没有就空着)
632
+ * setMonth 翻月用(受控:翻到哪个月由调用方记)
633
+ * onPick 点了有东西的那天
634
+ * busy / emptyTitle / haveTitle / inputTitle / prevTitle / nextTitle / recentTitle 文案
635
+ *
636
+ * 灰格子不是错,是「那天没有东西可看」——所以标题里要把原因说清,
637
+ * 别让人以为是加载失败(2026-11-24,用户 m01579 的原话就是「点了没提示」)。
638
+ */
639
+ function calPicker(o) {
640
+ const days = Array.isArray(o.days) ? o.days : []
641
+ const have = new Set(days)
642
+ const month = /^\d{4}-\d{2}$/.test(String(o.month || ''))
643
+ ? String(o.month)
644
+ : (calMonthOf(o.picked) || calMonthOf(days[0]))
645
+ const first = /^\d{4}-\d{2}$/.test(month)
646
+ ? new Date(Date.UTC(Number(month.slice(0, 4)), Number(month.slice(5, 7)) - 1, 1))
647
+ : null
648
+ const lead = first ? (first.getUTCDay() + 6) % 7 : 0
649
+ const total = first
650
+ ? new Date(Date.UTC(first.getUTCFullYear(), first.getUTCMonth() + 1, 0)).getUTCDate()
651
+ : 0
652
+ const cells = []
653
+ for (let i = 0; i < lead; i += 1) cells.push(h('span', { key: `pad${i}`, style: calCell }))
654
+ for (let d = 1; d <= total; d += 1) {
655
+ const key = `${month}-${String(d).padStart(2, '0')}`
656
+ if (!have.has(key)) {
657
+ cells.push(h('span', {
658
+ key,
659
+ className: 'dim',
660
+ title: o.emptyTitle,
661
+ style: { ...calCell, opacity: '.35', cursor: 'default' },
662
+ }, String(d)))
663
+ continue
664
+ }
665
+ cells.push(h('button', {
666
+ key,
667
+ disabled: o.busy,
668
+ title: o.haveTitle,
669
+ onClick: () => o.onPick(key),
670
+ style: key === o.picked
671
+ ? { ...calCell, borderColor: 'var(--dsw-alias-state-business-primary)' }
672
+ : calCell,
673
+ }, String(d)))
674
+ }
675
+ return h('div', {
676
+ style: {
677
+ display: 'inline-block', marginTop: '6px', padding: '8px 10px',
678
+ border: '1px solid rgba(128,128,128,.28)', borderRadius: '8px',
679
+ },
680
+ },
681
+ h('div', { className: 'row', style: { alignItems: 'center', flexWrap: 'wrap', gap: '6px' } },
682
+ h('input', {
683
+ // type=date 自带选择器和键盘:敲 20260903 或按年月日分段都能填。
684
+ // 用 defaultValue + key:一边打一边重渲染时别把输入抹掉。
685
+ // 2026-11-24(用户 m02329):key 里带上「现在摊开哪个月」,框里只显示属于这个月的选中日。
686
+ // 以前 key 只跟 picked 走,翻月之后框里还留着上个月的日期——
687
+ // 「框里写着 11-20、月历已经是 2027 年 1 月」,两套真源,看着像坏了。
688
+ key: `day-${month}-${o.picked}`,
689
+ type: 'date',
690
+ disabled: o.busy,
691
+ defaultValue: calMonthOf(o.picked) === month ? String(o.picked) : '',
692
+ min: days.length ? days[days.length - 1] : undefined,
693
+ max: days.length ? days[0] : undefined,
694
+ title: o.inputTitle,
695
+ onChange: (e) => {
696
+ const d = calReadDay(e.target.value)
697
+ if (!d) return
698
+ if (have.has(d)) o.onPick(d)
699
+ else {
700
+ // 写了一个没有东西的日子:跳到那个月,并让调用方说一句「那天没有」——
701
+ // 只跳月不说话,人会以为点了没反应(2026-11-24,用户 m02329)。
702
+ o.onMiss?.(d)
703
+ o.setMonth(calMonthOf(d))
704
+ }
705
+ },
706
+ style: { maxWidth: '170px' },
707
+ }),
708
+ h('button', { disabled: o.busy || !month, title: o.prevTitle, onClick: () => o.setMonth(calShiftMonth(month, -1)) }, '‹'),
709
+ h('span', { style: { minWidth: '86px', textAlign: 'center' } }, calMonthTitle(month)),
710
+ h('button', { disabled: o.busy || !month, title: o.nextTitle, onClick: () => o.setMonth(calShiftMonth(month, 1)) }, '›'),
711
+ h('button', { disabled: o.busy || !days.length, title: o.recentTitle, onClick: () => o.setMonth(calMonthOf(days[0])) }, '最近')),
712
+ h('div', {
713
+ style: {
714
+ display: 'grid', gridTemplateColumns: 'repeat(7, 30px)',
715
+ gap: '2px', marginTop: '6px', alignItems: 'center',
716
+ },
717
+ },
718
+ ...CAL_WEEK.map((w) => h('span', { key: w, className: 'dim', style: { ...calCell, height: '20px', lineHeight: '20px' } }, w)),
719
+ ...cells))
720
+ }
721
+
592
722
  /**
593
723
  * 把质量指标渲染成两位小数。
594
724
  *
@@ -805,7 +935,7 @@ window.__ModuleLoader__.load({
805
935
  const [rotateAfter, setRotateAfter] = useState(120)
806
936
  // 换新会话时带几轮原话过去(0 = 不带)。默认 3(2026-11-17 用户 m04639)。
807
937
  const [carryTurns, setCarryTurns] = useState(3)
808
- const [docBudget, setDocBudget] = useState(2800)
938
+ const [docBudget, setDocBudget] = useState(3600)
809
939
  // 0.9.7 T1:身份段里摆不摆「你最近说过的几句话」(默认开)
810
940
  const [echoOn, setEchoOn] = useState(true)
811
941
  const [beliefsShown, setBeliefsShown] = useState(3)
@@ -1063,6 +1193,15 @@ window.__ModuleLoader__.load({
1063
1193
  // 设置界面 2.0(2026-10-24):观看历史分页 + 报告默认收起
1064
1194
  const [histPage, setHistPage] = useState(0)
1065
1195
  const [showReport, setShowReport] = useState(false)
1196
+ // 每日报告的日子入口(2026-11-24,用户 m01711):月历摊开没有、摊在哪一个月。
1197
+ const [reportOpen, setReportOpen] = useState(false)
1198
+ const [reportMonth, setReportMonth] = useState('')
1199
+ // 看过的视频:搜索词 / 挑中的那一天 / 月历摊开没有 / 摊在哪个月
1200
+ // (2026-11-24,用户 m01923:记录攒到几百条之后,「查多久」那一颗已经不够用了)
1201
+ const [histQ, setHistQ] = useState('')
1202
+ const [histPick, setHistPick] = useState('')
1203
+ const [histOpen, setHistOpen] = useState(false)
1204
+ const [histMonth, setHistMonth] = useState('')
1066
1205
  // 常见问题解答(2026-10-28 用户 m00416):改成就地展开,不再开新窗口(见 feedbackPage 前的注释)
1067
1206
  const [faq, setFaq] = useState(null)
1068
1207
  const [faqOpen, setFaqOpen] = useState(false)
@@ -1331,21 +1470,47 @@ window.__ModuleLoader__.load({
1331
1470
  // 字幕一次读多少(2026-11-21,用户 m01746 / issue #155):'page' | 'whole'。
1332
1471
  // 只能加在 hook 列表末尾:test/client.test.mjs 按下标找 hook,往前挪会把别人错位。
1333
1472
  const [subRead, setSubRead] = useState('page')
1473
+ // 日期 UI 的三处收尾(2026-11-24,用户 m02329):请求序号、筛选提示、取数中的忙态。
1474
+ // 同样只加在末尾,hook 下标不能往前挪。
1475
+ const reportSeq = useRef(0)
1476
+ const [reportHint, setReportHint] = useState('')
1477
+ const histSeq = useRef(0)
1478
+ const histQRef = useRef('')
1479
+ const histQTimer = useRef(null)
1480
+ const [histBusy, setHistBusy] = useState(false)
1481
+ const [histHint, setHistHint] = useState('')
1334
1482
 
1335
1483
  // 读一次「看过的视频」(issue #69)。回来时天数已经换了(在路上时用户又选了别的)就丢掉,
1336
1484
  // 别盖住新选的列表;当前这个天数没读到、列表里也不是这个天数的,就记下原因。
1337
- const readHist = async (days) => {
1485
+ // 2026-11-24(用户 m02329):搜索走后端,词也一起存;两件事都可能变,所以按序号判先后。
1486
+ const readHist = async (days, q = '') => {
1487
+ const seq = (histSeq.current += 1)
1488
+ const word = String(q || '').trim()
1489
+ setHistBusy(true)
1338
1490
  try {
1339
- const r = await jget(`/history?days=${days}`)
1340
- if (histDaysRef.current !== days) return
1491
+ const r = await jget(`/history?days=${days}${word ? `&q=${encodeURIComponent(word)}` : ''}`)
1492
+ if (seq !== histSeq.current) return
1341
1493
  histShown.current = days
1494
+ histQRef.current = word
1342
1495
  setHist(r)
1343
1496
  setHistErr('')
1344
1497
  } catch (e) {
1345
- if (histDaysRef.current === days && histShown.current !== days) setHistErr(e.message)
1498
+ if (seq === histSeq.current && histShown.current !== days) setHistErr(e.message)
1499
+ } finally {
1500
+ if (seq === histSeq.current) setHistBusy(false)
1346
1501
  }
1347
1502
  }
1348
1503
 
1504
+ // 打字不用每一下都发请求:停手 300ms 再搜(用户 m02329)。
1505
+ const searchHist = (word) => {
1506
+ histQRef.current = String(word || '')
1507
+ if (histQTimer.current) clearTimeout(histQTimer.current)
1508
+ histQTimer.current = setTimeout(() => {
1509
+ histQTimer.current = null
1510
+ void readHist(histDaysRef.current, histQRef.current)
1511
+ }, 300)
1512
+ }
1513
+
1349
1514
  const load = useCallback(async () => {
1350
1515
  setErr('')
1351
1516
  // 重新读盘之后要重新记基线(撤销 / 刷新都走这里)。
@@ -1531,7 +1696,7 @@ window.__ModuleLoader__.load({
1531
1696
  setToolsAllowText((cfg.tools?.allow ?? []).join(', '))
1532
1697
  setToolsAllowSaved(Array.isArray(cfg.tools?.allow) ? cfg.tools.allow.map(String) : [])
1533
1698
  setToolsRestrict(cfg.tools?.restrict !== false)
1534
- setDocBudget(Number(cfg.memory?.docBudget ?? 2800))
1699
+ setDocBudget(Number(cfg.memory?.docBudget ?? 3600))
1535
1700
  setBeliefsShown(Number(cfg.memory?.beliefsShown ?? 3))
1536
1701
  setHearEvery(Number(cfg.memory?.hearEvery ?? 3))
1537
1702
  setGrowthDaysUi(Number(cfg.growthDays ?? 30))
@@ -1617,10 +1782,16 @@ window.__ModuleLoader__.load({
1617
1782
  setHistDays(days)
1618
1783
  setHistPage(0)
1619
1784
  setHistErr('')
1785
+ // 换了查询范围,原来挑的那一天多半已经不在这段记录里了:一起清掉,
1786
+ // 不然会停在「对上的 0 条」上,还以为是搜坏了(2026-11-24,用户 m02329 的第 1 条)。
1787
+ setHistPick('')
1788
+ setHistOpen(false)
1789
+ setHistHint('')
1790
+ if (histQTimer.current) { clearTimeout(histQTimer.current); histQTimer.current = null }
1620
1791
  storeHistDays(days)
1621
1792
  // 先选 90 再选 7,90 那次晚到时下拉框是 7、列表却是 90 天的:readHist 对不上就丢掉(issue #69)。
1622
1793
  // 只读卡片,失败不打断别处,只在这张卡里说没读到。
1623
- await readHist(days)
1794
+ await readHist(days, histQRef.current)
1624
1795
  }, [])
1625
1796
 
1626
1797
  // 在线状态每 30 秒刷一次;页面在后台就不轮询(省电,也不制造无谓请求)。
@@ -4316,7 +4487,7 @@ window.__ModuleLoader__.load({
4316
4487
  // 导出报告:纯前端拼一个 markdown 文件下载,不新开任何服务端路由。
4317
4488
  const downloadReport = () => {
4318
4489
  const md = reports?.md || ''
4319
- if (!md) { setNote('这一天的报告正文还没取到,没有可导出的。点一下上面那天的日期再取一次。'); return }
4490
+ if (!md) { setNote('这一天的报告正文还没取到,没有可导出的。点一下那天的日期,取来之后再导。'); return }
4320
4491
  if (typeof document === 'undefined' || typeof Blob === 'undefined') { setNote('这个环境不支持下载。'); return }
4321
4492
  try {
4322
4493
  const blob = new Blob([md], { type: 'text/markdown;charset=utf-8' })
@@ -4462,7 +4633,18 @@ window.__ModuleLoader__.load({
4462
4633
  ownerHintCard,
4463
4634
  s ? group('状态',
4464
4635
  S('从她的事件流算出来;阶段、瓶颈和计数她看不见,天数和冷落她知道。'),
4465
- rowTip('已成长天数', `${s.day} / ${s.growthDays} 天`, '从开局那一刻起,每满 24 小时加一天。'),
4636
+ // 2026-11-25(用户 m00361 选 A):天数当主数字,成长周期降成后面的小字。
4637
+ // 原来拼 `${s.day} / ${s.growthDays} 天`,分母又是 7–180 可调的成长周期,不是上限:
4638
+ // 走过周期后读成「31 / 30」,看着像进度溢出或出了 bug。天数本身不封顶(growthDay 只增不减)。
4639
+ // 周期跟着配置走(改成 20 / 60 / 90 天这里立刻跟着变),因为读的就是 s.growthDays。
4640
+ rowTip('已成长天数',
4641
+ h('span', null,
4642
+ `${s.day} 天`,
4643
+ h('span', { style: { opacity: 0.6, marginLeft: '8px', fontSize: '12px' } },
4644
+ Number(s.day) > Number(s.growthDays)
4645
+ ? `成长周期 ${s.growthDays} 天 · 成长期已满`
4646
+ : `成长周期 ${s.growthDays} 天`)),
4647
+ '从开局那一刻起,每满 24 小时加一天;这是总天数,不封顶。成长周期只决定四个阶段怎么分段、期满后哪些瓶颈按时间放行,改它不会让天数变。'),
4466
4648
  rowTip('当前阶段',
4467
4649
  `${s.stage} · ${s.stageName}${s.stageForced ? '(时间兜底)' : ''}${Number(s.stagePeak) > Number(s.stage) ? `(曾到第 ${s.stagePeak} 阶段)` : ''}`,
4468
4650
  // 阶段按当前成长周期现算、天数不重置:改长周期(比如 7 天改成 30 天)阶段会退回去。
@@ -5070,9 +5252,19 @@ window.__ModuleLoader__.load({
5070
5252
  const histFlat = (hist?.groups || []).flatMap((g) =>
5071
5253
  (g.items || []).map((it) => ({ ...it, date: g.date })))
5072
5254
  const histDayCount = (hist?.groups || []).length
5255
+ // 搜索 + 挑一天(2026-11-24,用户 m01923;当晚按 m02329 收到服务端):
5256
+ // 记录攒到几百条之后,只有「查多久」一颗不够用——想找「那个讲 XX 的视频」、想找「上周三看的」
5257
+ // 都得自己一页页翻。词交回服务端筛(/history?q=,见 lib/history.js),这样 365 天全量也不用
5258
+ // 先把七万条发到浏览器再丢掉;日子仍然在客户端挑,它只是「列表里有的那几天」。
5259
+ const histDates = (hist?.groups || []).map((g) => g.date)
5260
+ const histFound = histPick ? histFlat.filter((it) => it.date === histPick) : histFlat
5261
+ const histFiltered = Boolean(histPick) || Boolean(String(histQ || '').trim())
5262
+ // 「这段一共几条」用服务端报的 total(它数的是真账本,筛完之后也是它数);
5263
+ // 手上这份是逐条摊平的,没筛时两者应当一致,不一致就取大的那个,别少报。
5264
+ const histAll = histErr ? 0 : Math.max(histFlat.length, Number(hist?.total) || 0)
5073
5265
  // 当前选的天数没读到(histErr):手上那份不是这个天数的,翻页条也不出(列表本身见下面的 histErr)
5074
- const histTotal = histErr ? 0 : histFlat.length
5075
- const histPerDay = histDayCount ? histTotal / histDayCount : 0
5266
+ const histTotal = histErr ? 0 : histFound.length
5267
+ const histPerDay = histDayCount ? histFlat.length / histDayCount : 0
5076
5268
  const histPageSize = histTotal === 0 ? HIST_PAGE_MAX
5077
5269
  : histTotal <= 8 ? histTotal
5078
5270
  : histPerDay > 20 ? 6
@@ -5081,13 +5273,14 @@ window.__ModuleLoader__.load({
5081
5273
  : HIST_PAGE_MAX
5082
5274
  const histPages = Math.max(1, Math.ceil(histTotal / histPageSize))
5083
5275
  const histAt = Math.min(histPage, histPages - 1)
5084
- const histSlice = histFlat.slice(histAt * histPageSize, histAt * histPageSize + histPageSize)
5276
+ const histSlice = histFound.slice(histAt * histPageSize, histAt * histPageSize + histPageSize)
5085
5277
  const histPager = histPages > 1
5086
5278
  ? h('div', { className: 'row' },
5087
5279
  h('button', { disabled: histAt <= 0, onClick: () => setHistPage(histAt - 1) }, '较新'),
5088
5280
  h('span', { className: 'dim' }, `第 ${histAt + 1} / ${histPages} 页 · 一页 ${histPageSize} 条`),
5089
5281
  h('button', { disabled: histAt >= histPages - 1, onClick: () => setHistPage(histAt + 1) }, '更早'))
5090
5282
  : null
5283
+ const histHow = (how) => (how === 'watch' ? '看过画面' : how === 'look' ? '点开读过' : '只是翻到过')
5091
5284
 
5092
5285
  const biliPage = h('div', { className: 'page' },
5093
5286
  // 第二个参数是这一组的说明(note),控件从第三个起。0.9.5 把装控件的 grid2 填进了 note 位,
@@ -5294,22 +5487,80 @@ window.__ModuleLoader__.load({
5294
5487
 
5295
5488
  // ---- 以前看了什么(视频观看历史,分页) ----
5296
5489
  groupFull('看过的视频',
5297
- // 其余那部分有 look:(她自己点开的)和 browse:(自动逛和以前刷站记的),不只是旧版(issue #69)
5298
- S('按天从近到远,点标题打开原视频;标「看过画面」的是抽帧看过的,其余是她自己点开的,或者自动逛时翻到的。'),
5299
- h('div', { className: 'grid2', style: { marginBottom: '10px' } },
5490
+ // 三种关系分开说(2026-11-24,用户 m01923):以前只剩「看过画面」一种标,
5491
+ // 另外两类(她自己点开读过、自动逛时只是翻到过)在列表里长得一样,只能猜。
5492
+ S('按天从近到远,点标题打开原视频。「看过画面」是抽帧看过的,「点开读过」是她自己点开的,「只是翻到过」是自动逛时翻到的。'),
5493
+ h('div', { className: 'grid2', style: { marginBottom: '6px' } },
5494
+ Text({ label: '找一条', value: histQ,
5495
+ onChange: (v) => { setHistQ(v); setHistPage(0); searchHist(v) },
5496
+ placeholder: '标题 / UP 名 / BV 号',
5497
+ hint: '在整段记录里找;空格分开的每个词都要对上。' }),
5300
5498
  Sel({ label: '查多久的记录', value: histDays,
5301
5499
  onChange: pickHistDays,
5302
5500
  options: HIST_DAYS_OPTIONS,
5303
5501
  fmt: (v) => `${v} 个有记录的日子`,
5304
5502
  hint: '按有记录的日子数,不按日历:没上网的日子不占数。只是查询范围,不会删记录;改完立刻重列,下次打开还记得。' })),
5305
- h('div', { className: 'row', style: { marginBottom: '8px' } },
5306
- h('span', { className: 'dim' }, histErr ? '没读到' : `共 ${histDayCount} 天 · ${hist?.total ?? 0} 条`),
5307
- histPager),
5503
+ // 一份记录都没有的时候不摆「挑一天」:点开是一屏全灰的月历(第 4 条)。
5504
+ histDates.length ? h('div', { className: 'row', style: { alignItems: 'center', flexWrap: 'wrap', marginBottom: '8px' } },
5505
+ h('button', {
5506
+ disabled: histBusy,
5507
+ onClick: () => {
5508
+ setHistOpen(!histOpen)
5509
+ if (!histOpen) setHistMonth(calMonthOf(histPick || histDates[0]))
5510
+ setHistPage(0)
5511
+ },
5512
+ }, histOpen ? '收起日子' : '挑一天'),
5513
+ histPick ? h('span', { className: 'tag' }, `只看 ${histPick}`) : null,
5514
+ histFiltered
5515
+ ? h('button', {
5516
+ onClick: () => {
5517
+ // 清筛选也要把服务端那份重读回来:词是在后端筛的,光清本地状态列表还是空的。
5518
+ if (histQTimer.current) { clearTimeout(histQTimer.current); histQTimer.current = null }
5519
+ histQRef.current = ''
5520
+ setHistQ('')
5521
+ setHistPick('')
5522
+ setHistOpen(false)
5523
+ setHistHint('')
5524
+ setHistPage(0)
5525
+ void readHist(histDaysRef.current, '')
5526
+ },
5527
+ }, '清掉筛选')
5528
+ : null,
5529
+ h('span', { className: 'dim' }, histErr ? '没读到'
5530
+ : histBusy ? '正在读…'
5531
+ : histFiltered
5532
+ ? `共 ${histDayCount} 天 · 对上的 ${histTotal} 条 / 这段一共 ${histAll} 条`
5533
+ : `共 ${histDayCount} 天 · ${histAll} 条`)) : null,
5534
+ // 取数期间、手写的日子没有记录时,都要有一句人话(第 5 条)。
5535
+ histHint ? h('p', { className: 'hint' }, histHint) : null,
5536
+ // 挑日子用和数据页同一块月历(calPicker,见 00-shell.js):
5537
+ // 有记录的那天能点,没有的灰着——灰格子不是加载失败,是那天没上网。
5538
+ histOpen && histDates.length
5539
+ ? calPicker({
5540
+ days: histDates,
5541
+ month: histMonth,
5542
+ picked: histPick,
5543
+ busy: histBusy,
5544
+ setMonth: setHistMonth,
5545
+ onPick: (d) => { setHistPick(d); setHistOpen(false); setHistPage(0) },
5546
+ onMiss: (d) => setHistHint(`${d} 这一天没有记录(那天没上网)。`),
5547
+ emptyTitle: S('这一天没有记录——没上网就没有这一条。'),
5548
+ haveTitle: S('这一天有记录,点开只看这天的。'),
5549
+ inputTitle: S('知道哪天就写上,比如 2026-11-20。'),
5550
+ prevTitle: S('往前一个月。'),
5551
+ nextTitle: S('往后一个月。'),
5552
+ recentTitle: S('回到最近有记录的那个月。'),
5553
+ })
5554
+ : null,
5308
5555
  // 当前选的天数没读到(histErr):手上那份不是这个天数的,一条都不摆
5309
- histErr || !histFlat.length
5556
+ histErr || !histFlat.length || !histFound.length
5310
5557
  ? h('p', { className: 'empty' }, histErr
5311
5558
  ? `这段时间的记录没读到,不是没有记录。换个天数,或者过一会儿再选一次。(${histErr})`
5312
- : '还没有记录。')
5559
+ : String(histQ || '').trim() && !histFound.length
5560
+ ? '这段记录里没有对得上的——换个词,或者把日子放宽一点。'
5561
+ : histPick
5562
+ ? `这一天没有记录(${histPick})。把日子放宽,或者清掉筛选。`
5563
+ : (histBusy ? '正在读…' : '还没有记录。'))
5313
5564
  : h('div', null, histSlice.map((it, i) => h('div', {
5314
5565
  // 列表按时间从新到旧摊平;换天时插一条日期标签(一页 12 条,不是一天一页)
5315
5566
  key: `${it.date}|${it.bvid}|${i}`,
@@ -5334,9 +5585,8 @@ window.__ModuleLoader__.load({
5334
5585
  }),
5335
5586
  // 2026-10-30:真的抽帧看过画面的那几条要能一眼认出来,
5336
5587
  // 否则它跟"只扫了眼标题"在列表里长得一样(客户反馈的原点)。
5337
- it.how === 'watch'
5338
- ? h('span', { className: 'tag', style: { flex: '0 0 auto' } }, '看过画面')
5339
- : h('span', { style: { flex: '0 0 auto', width: '0' } }),
5588
+ // 2026-11-24(用户 m01923):三类分开标,「看过画面」不再吃掉另两类的区别。
5589
+ h('span', { className: 'tag', style: { flex: '0 0 auto' } }, histHow(it.how)),
5340
5590
  h('a', {
5341
5591
  href: it.url,
5342
5592
  target: '_blank',
@@ -5416,7 +5666,7 @@ window.__ModuleLoader__.load({
5416
5666
  },
5417
5667
  hint: S('只影响换窗口后的第一轮:最后 1 轮不裁剪,再往前每轮 40 字;页面上限随轮数放大(400–1200 字)。带得越多,第一轮越贵,也越容易接着旧话题说。0 = 不带原话,只带还挂着的事;更早的事用 her_recall 翻。') }),
5418
5668
  Num({ label: '身份段字数', value: docBudget, onChange: setDocBudget, min: 1800, max: 8000, step: 100, unit: '字',
5419
- hint: S('她每轮读到的身份段最多多少字;超了先省次要段。范围 1800–8000:1800 以下装不下现在已经有的段,8000 以上每轮都在为这段文字付钱。') }))),
5669
+ hint: S('她每轮读到的身份段最多多少字;超了先省次要段。现在默认 3600:加进「你认识的{T}」之后,把认识的人摆满再叠上日常长的判断,实测要 3437 字才一段不丢(2800 会先丢「你对自己的说法」和「更早以前」——那两段正是"她是什么样的人"的材料)。3600 = 3437 + 一点余量给之后还会长的一两句。范围 1800–8000:1800 以下装不下现在已经有的段,8000 以上每轮都在为这段文字付钱。') }))),
5420
5670
 
5421
5671
  // 会话压力不再放在设置页(2026-11-17,用户 m02888):挪到对话页的「压力」页签 + 头部小胶囊。
5422
5672
 
@@ -5455,6 +5705,18 @@ window.__ModuleLoader__.load({
5455
5705
  })),
5456
5706
  h('span', { className: 'dim' },
5457
5707
  `${mem.selfDoc?.chars ?? 0} / ${mem.selfDoc?.budget ?? 0} 字`)),
5708
+ // 2026-11-24(用户 m06175):光有上面那条用量,看不出「为什么这段不见了、
5709
+ // 下次会先丢什么」。这里把放不下时的次序直接写出来——真身是
5710
+ // lib/persona.js 的 OPTIONAL_ORDER(只排可选段,核心段位置不动),
5711
+ // 改那边的时候记得回来对一遍。
5712
+ h('div', { style: { fontSize: '12px', lineHeight: '1.8', marginTop: '8px', opacity: 0.85 } },
5713
+ h('div', null, '放不下时按这个次序一段一段往里放,先放前面的;轮到哪一段放不下,先换短版,短版也放不下才整段撤掉(字数额够了它会自己回来):'),
5714
+ h('div', { className: 'dim', style: { marginTop: '2px' } },
5715
+ S('1 最近说过的几句话 → 2 你自己说过的话 → 3 两句话对不上 → 4 说法变过 → 5 没定的事 → 6 你拒绝过 → 7 你被打脸过 → 8 你对自己的说法 → 9 你读到的一句话 → 10 你反复想起过的事 → 11 她曾想让你改掉她 → 12 有些事你想不起来了 → 13 更早以前')),
5716
+ h('div', { className: 'dim', style: { marginTop: '2px' } },
5717
+ S('排在这份名单前面的几段永远都在(她是谁、现在、不能做的、认识的人那一节、你说的事和她的判断),字数再紧也不挤掉。')),
5718
+ h('div', { className: 'dim', style: { marginTop: '2px' } },
5719
+ S('其中「你自己说过的话」每轮只逐条摆最显著的几条,再往前的折成一行,更早的只剩一句「还有 N 条」——原文一直都在,她能按关键词捞回来。'))),
5458
5720
  h('div', { style: { fontSize: '12px', lineHeight: '1.9', marginTop: '8px', opacity: 0.85 } },
5459
5721
  // 2026-11-23(外部报告):这一段是可选段,字数不够时会被整段挤掉。
5460
5722
  // 以前不管有没有挤掉都按设置报「最显著的 N 条在眼前」,面板和她真读到的对不上;
@@ -5552,6 +5814,17 @@ window.__ModuleLoader__.load({
5552
5814
  ? [h('div', null,
5553
5815
  `· 同一个人的说法变过 ${health.people.drifts ?? 0} 处,一直没定 ${health.people.unsettled ?? 0} 处`)]
5554
5816
  : []),
5817
+ // 1.1.0 收尾(用户 m04951):人判断会不会把世界判断挤没。
5818
+ // 「你自己说过的话」只摆关于世界的判断,关于人的摆在身份段那一节——两边都摆数,
5819
+ // 谁被挤了才看得见。上限由后端一起给,界面不写死。
5820
+ ...(health.beliefView
5821
+ ? [h('div', { title: S('「你自己说过的话」那一段只摆关于世界的判断;写到某个人名下的,摆在身份段「你认识的人」那一节。那一段最多摆几条是固定的。') },
5822
+ `· 判断分给谁:写到人身上 ${health.beliefView.person} 条,关于世界 ${health.beliefView.world} 条(这一段摆出来 ${health.beliefView.shown} 条,最多 ${health.beliefView.max} 条)`)]
5823
+ : []),
5824
+ ...(health.beliefView && health.beliefView.world === 0 && health.beliefView.person > 0
5825
+ ? [h('div', { className: 'dim' },
5826
+ S(` 「你自己说过的话」这一段现在是空的:${SELF_SHE}的判断全都写在人身上了。不是被挤掉,是还没有关于世界的。`))]
5827
+ : []),
5555
5828
  health.empty
5556
5829
  ? h('p', { className: 'dim', style: { margin: '4px 0 0' } }, S('还太早:等她说出第一条判断,这里才有东西可看。'))
5557
5830
  : null,
@@ -6787,7 +7060,7 @@ window.__ModuleLoader__.load({
6787
7060
  : '0 = 不开。填一个没人用的端口(比如 17888)就开;只有本机连得进来。',
6788
7061
  }), bridgePort > 0
6789
7062
  ? h('p', { className: 'hint', style: { margin: 0 } },
6790
- '投递的写法:POST JSON 到 /say,正文 {"text":"要说的话"};可选 scene、channel、room、speaker、guest、owner、image。'
7063
+ '投递的写法:POST JSON 到 /say,正文 {"text":"要说的话"};可选 scene、channel、room、speaker、speakerId、guest、owner、image。'
6791
7064
  + '不传 scene 就是私聊、进家里那条会话。')
6792
7065
  : null)
6793
7066
 
@@ -7606,6 +7879,112 @@ window.__ModuleLoader__.load({
7606
7879
  h('button', { disabled: cloudBusy, className: 'ghost', onClick: () => refreshCloud(true) }, '刷新状态')),
7607
7880
  cloudMsg ? h('p', { className: 'hint' }, cloudMsg) : null))
7608
7881
 
7882
+ // ---- 每日报告的日期条(2026-11-24,用户 m01411 / m01579 / m01711)----
7883
+ // 原来 dates 全量铺成按钮,一行五颗:本机 25 份就 5 行,一年 365 份约 73 行,
7884
+ // 要滑到下面那几张卡得滑好久。这块要的是「选一个日子」,不是浏览全部日子。
7885
+ // 现在三层入口:
7886
+ // ① 最近十天常驻按钮——最常点的就是这几天,一次点击;
7887
+ // ② 「选一个日子」展开一块月历——一屏一个月,没报告的日子灰着。
7888
+ // 选项一多就不适合再铺成一条长列表(NN/g 的日期输入建议:可选项过十个
7889
+ // 就该换成日历/输入),日历负责「看得见哪天有」,也顺手把空月看明白;
7890
+ // ③ 一个日期框——知道是哪天就直接写 2026-09-03,不用在月历上翻。
7891
+ // 选一个日子就把那天的报告直接打开——只换个按钮颜色、正文仍收着,
7892
+ // 人会以为「点了没反应」(2026-11-24,用户 m01579)。
7893
+ // 日期属于数据,一份都不删;收的只是入口。
7894
+ const REPORT_RECENT = 10
7895
+ const pickReport = async (d) => {
7896
+ if (!d) return
7897
+ // 请求序号(2026-11-24,用户 m02329):日期框在取数期间也能写,两次请求可能回来颠倒了。
7898
+ // 后发先到的那个才算数,前一次的回包直接丢掉。
7899
+ const seq = (reportSeq.current += 1)
7900
+ setBusy('rep')
7901
+ setReportHint('')
7902
+ try {
7903
+ const r = await jget(`/reports?date=${d}`)
7904
+ if (seq !== reportSeq.current) return
7905
+ setReports(r)
7906
+ setShowReport(true)
7907
+ } catch (e) {
7908
+ if (seq === reportSeq.current) setErr(e.message)
7909
+ } finally {
7910
+ if (seq === reportSeq.current) setBusy('')
7911
+ }
7912
+ }
7913
+ // 月历:一屏一个月。有报告的日子是按钮,没有的只灰着——
7914
+ // 灰格子不是错,是「那天没醒,自然没有这份报告」。
7915
+ // 2026-11-24(用户 m02329):这一块原来是一整份内联月历,和 00-shell.js 的 calPicker
7916
+ // 是两份复制品(改一处漏一处)。现在只留这层薄壳,日期数学、灰格子、翻月全走共享那份。
7917
+ const reportCalendar = (dates, picked, busyOne) => {
7918
+ // 别拿「这个月有没有报告」当门槛:翻到空月份正是要看的——她那个月没醒,
7919
+ // 一屏全灰比「翻不过去」更说明问题(2026-11-24,用户 m02329)。
7920
+ const month = /^\d{4}-\d{2}$/.test(reportMonth) ? reportMonth : (calMonthOf(picked) || calMonthOf(dates[0]))
7921
+ return calPicker({
7922
+ days: dates,
7923
+ month,
7924
+ picked,
7925
+ busy: busyOne,
7926
+ setMonth: setReportMonth,
7927
+ onPick: (d) => { void pickReport(d); setReportOpen(false) },
7928
+ onMiss: (d) => setReportHint(`${d} 那天没有报告(那天没醒)。`),
7929
+ emptyTitle: S('这一天没有报告——没醒就没有这一份。'),
7930
+ haveTitle: S('这一天醒过,有一份报告。'),
7931
+ inputTitle: S('知道是哪天就写上,比如 2026-09-03;写完就打开那天的报告。'),
7932
+ prevTitle: S('往前一个月。'),
7933
+ nextTitle: S('往后一个月。'),
7934
+ recentTitle: S('回到最近有报告的那个月。'),
7935
+ })
7936
+ }
7937
+ const reportDateBar = () => {
7938
+ const dates = reports.dates
7939
+ const busyOne = busy === 'rep'
7940
+ const picked = reports.date || ''
7941
+ return h('div', null,
7942
+ h('div', { className: 'row', style: { alignItems: 'center', flexWrap: 'wrap', marginBottom: '6px' } },
7943
+ ...dates.slice(0, REPORT_RECENT).map((d) => h('button', {
7944
+ key: d,
7945
+ disabled: busyOne,
7946
+ title: S('这一天她醒过,有一份报告。'),
7947
+ onClick: () => { void pickReport(d) },
7948
+ style: d === reports.date ? { borderColor: 'var(--dsw-alias-state-business-primary)' } : undefined,
7949
+ }, d)),
7950
+ h('span', { className: 'dim' }, `共 ${dates.length} 份`)),
7951
+ // 更早的那一截另起一行,收在一个「选一个日子」里:
7952
+ // 混在同一行会把最近十天挤得换行,而且月历和按钮抢位置。
7953
+ // 报告一多(一年 365 份)就不该再铺成一长条——摊开是一屏一个月,
7954
+ // 只有有报告的日子能点,没有的灰着,一屏就把那个月看明白了。
7955
+ // 一份报告都没有的时候不摆这个入口:点开是一屏全灰的月历,什么也挑不出来
7956
+ // (2026-11-24,用户 m02329 的第 4 条)。
7957
+ dates.length ? h('div', { className: 'row', style: { alignItems: 'center', flexWrap: 'wrap', marginBottom: '8px' } },
7958
+ h('button', {
7959
+ disabled: busyOne,
7960
+ title: S('更早的日子从这里挑:摊开是一个月一格,有报告的日子能点。'),
7961
+ onClick: () => {
7962
+ // 展开时先落在「正在看的那个月」,没选过就落在最近有报告的那个月。
7963
+ if (!reportOpen) setReportMonth(calMonthOf(picked) || calMonthOf(dates[0]))
7964
+ setReportOpen(!reportOpen)
7965
+ },
7966
+ }, reportOpen ? '收起日子' : '选一个日子'),
7967
+ h('span', { className: 'dim' }, reportOpen
7968
+ ? '有报告的日子能点,没有的灰着;也可以直接写是哪天。'
7969
+ : '近十天在上一行;更早的从这里挑。')) : null,
7970
+ reportOpen && dates.length ? reportCalendar(dates, picked, busyOne) : null,
7971
+ // 取数期间不再只有按钮变灰:说一句在等什么(第 5 条)。
7972
+ reportHint ? h('p', { className: 'hint' }, reportHint) : null,
7973
+ h('div', { className: 'row', style: { alignItems: 'center', flexWrap: 'wrap' } },
7974
+ busyOne
7975
+ ? h('span', { className: 'dim' }, '正在读那天的报告…')
7976
+ : showReport && reports.date
7977
+ ? h('span', { className: 'dim' }, `正在看 ${reports.date}`)
7978
+ : h('span', { className: 'dim' }, '点一个日期,那天的报告就在下面打开。'),
7979
+ h('button', { disabled: busyOne || !reports.date, onClick: () => setShowReport(!showReport) }, showReport ? '收起报告' : '展开报告'),
7980
+ h('button', { disabled: busyOne || !reports.date, onClick: downloadReport }, '导出报告'),
7981
+ h('button', {
7982
+ title: '点了只是把这个文件夹的路径复制到剪贴板(不会弹窗口)——粘到资源管理器地址栏回车就能打开。',
7983
+ onClick: () => copyPath(dataPaths?.out || ''),
7984
+ }, '查看文件夹')),
7985
+ showReport && reports.md ? h('pre', { style: { marginTop: '8px', maxHeight: '320px', overflow: 'auto' } }, reports.md) : null)
7986
+ }
7987
+
7609
7988
  const dataPage = h('div', { className: 'page' },
7610
7989
  group('数据在哪',
7611
7990
  '一个文件夹装全部。想备份、想搬走、想看原始记录,都在这一格里。',
@@ -7807,28 +8186,10 @@ window.__ModuleLoader__.load({
7807
8186
  : '默认关着。点「展开」加一个地方(一个网盘同步目录最快,零注册),配好再打开。'))),
7808
8187
 
7809
8188
  groupFull('每日报告',
7810
- S('她醒过的日子各有一份;点日期看那天的。'),
8189
+ S('她醒过的日子各有一份;点一个日期就打开那天的报告,更早的从下面那行挑。'),
7811
8190
  !reports.dates.length
7812
8191
  ? h('p', { className: 'empty' }, S('还没有报告,她醒过一次之后才有。'))
7813
- : h('div', null,
7814
- h('div', { className: 'row', style: { marginBottom: '8px', flexWrap: 'wrap' } },
7815
- ...reports.dates.map((d) => h('button', {
7816
- key: d,
7817
- disabled: busy === 'rep',
7818
- onClick: async () => {
7819
- setBusy('rep')
7820
- try { setReports(await jget(`/reports?date=${d}`)) } catch (e) { setErr(e.message) } finally { setBusy('') }
7821
- },
7822
- style: d === reports.date ? { borderColor: 'var(--dsw-alias-state-business-primary)' } : undefined,
7823
- }, d))),
7824
- h('div', { className: 'row', style: { flexWrap: 'wrap' } },
7825
- h('button', { onClick: () => setShowReport(!showReport) }, showReport ? '收起报告' : '展开报告'),
7826
- h('button', { onClick: downloadReport }, '导出报告'),
7827
- h('button', {
7828
- title: '点了只是把这个文件夹的路径复制到剪贴板(不会弹窗口)——粘到资源管理器地址栏回车就能打开。',
7829
- onClick: () => copyPath(dataPaths?.out || ''),
7830
- }, '查看文件夹')),
7831
- showReport && reports.md ? h('pre', { style: { marginTop: '8px', maxHeight: '320px', overflow: 'auto' } }, reports.md) : null)),
8192
+ : reportDateBar()),
7832
8193
 
7833
8194
  // ---- 运行日志导出 ----
7834
8195
  // 为什么单独一张卡:她某晚没说话、没刷站、没写日记,只看状态页是猜不出来的。
@@ -7909,7 +8270,9 @@ window.__ModuleLoader__.load({
7909
8270
  // 口径不改(改 real 的定义会动事件流语义与一堆派生数字),把话说清楚。
7910
8271
  title: S('事件流里除系统记账以外的条数:她自己写下的(判断、留话、改口、拒绝、梦这些)、对话里回你的话、她读到的别人说法、记下的你的原话、开局那份起点,还有冷落、申请、请求这类替她记下的事。日记写在文件里,每篇只在系统记录里留一行标记,不算在这里。'),
7911
8272
  },
7912
- s ? `第 ${s.day} / ${s.growthDays} 天 · ${s.stageName} · 记录 ${s.counts.total} 条${s.counts.meta ? `,另有 ${s.counts.meta} 条系统记录` : ''}` : '读取中…'),
8273
+ // 2026-11-25(用户 m00361):页头也不写「x / y 天」——分母是成长周期,不是上限;
8274
+ // 走过周期后「31 / 30」会被读成进度溢出。周期在「现在」页那行小字里,这里只给总天数。
8275
+ s ? `已成长 ${s.day} 天 · ${s.stageName} · 记录 ${s.counts.total} 条${s.counts.meta ? `,另有 ${s.counts.meta} 条系统记录` : ''}` : '读取中…'),
7913
8276
  err ? h('pre', { className: 'err' }, err) : null,
7914
8277
  note ? h('pre', { className: 'ok' }, note) : null,
7915
8278
  // 保存回执只是确认「存到了」,不占页签里的说明位(2026-10-29 用户)。