dsh-all-usage 1.2.2 → 1.2.4

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 (40) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.de.md +316 -0
  3. package/README.en.md +52 -14
  4. package/README.es.md +316 -0
  5. package/README.fr.md +316 -0
  6. package/README.ja.md +316 -0
  7. package/README.md +55 -17
  8. package/README.pt.md +316 -0
  9. package/README.ru.md +316 -0
  10. package/assets/cover-en.png +0 -0
  11. package/assets/cover-zh.png +0 -0
  12. package/assets/readme-architecture-en.svg +95 -95
  13. package/assets/readme-architecture-zh.svg +95 -95
  14. package/assets/readme-sync-en.svg +81 -81
  15. package/assets/readme-sync-zh.svg +81 -81
  16. package/assets/screenshots/en/01-overview.png +0 -0
  17. package/assets/screenshots/en/02-trend-bars.png +0 -0
  18. package/assets/screenshots/en/02-trend.png +0 -0
  19. package/assets/screenshots/en/03-heatmap.png +0 -0
  20. package/assets/screenshots/en/04-model-stats.png +0 -0
  21. package/assets/screenshots/en/05-request-logs.png +0 -0
  22. package/assets/screenshots/en/06-cost-settings.png +0 -0
  23. package/assets/screenshots/en/07-maintenance.png +0 -0
  24. package/assets/screenshots/zh/01-overview.png +0 -0
  25. package/assets/screenshots/zh/02-trend-bars.png +0 -0
  26. package/assets/screenshots/zh/02-trend.png +0 -0
  27. package/assets/screenshots/zh/03-heatmap.png +0 -0
  28. package/assets/screenshots/zh/04-model-stats.png +0 -0
  29. package/assets/screenshots/zh/05-request-logs.png +0 -0
  30. package/assets/screenshots/zh/06-cost-settings.png +0 -0
  31. package/assets/screenshots/zh/07-maintenance.png +0 -0
  32. package/lib/archive.js +399 -0
  33. package/lib/client.js +1 -1
  34. package/lib/http.js +27 -1
  35. package/lib/ledger.js +362 -54
  36. package/package.json +10 -1
  37. package/screenshots.json +7 -9
  38. package/scripts/archive-ledger.mjs +156 -0
  39. package/assets/screenshots/en/04-model-usage.png +0 -0
  40. package/assets/screenshots/zh/04-model-usage.png +0 -0
@@ -1,81 +1,81 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" lang="en" width="1600" height="1100" viewBox="0 0 1600 1100" role="img" aria-labelledby="sync-en-title sync-en-desc">
2
- <title id="sync-en-title">History and Live Data Flow</title>
3
- <desc id="sync-en-desc">Reuse unchanged sessions; refold changed logs only, and coalesce live writes per session</desc>
4
- <defs>
5
- <pattern id="sync-en-dots" width="32" height="32" patternUnits="userSpaceOnUse">
6
- <circle cx="2" cy="2" r="1.5" fill="#dce2e9"/></pattern>
7
- <marker id="sync-en-arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse">
8
- <path d="M 0 0 L 10 5 L 0 10 z" fill="#6c7a8d"/></marker></defs>
9
- <rect width="100%" height="100%" fill="#fbfcfe"/>
10
- <rect width="100%" height="100%" fill="url(#sync-en-dots)"/>
11
- <circle cx="72" cy="74" r="15" fill="#2c99ad" opacity=".18"/>
12
- <circle cx="72" cy="74" r="7" fill="#2c99ad"/>
13
- <text x="102" y="81" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="34" font-weight="700" fill="#1b2638">History and Live Data Flow</text>
14
- <text x="102" y="119" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="17" fill="#637083">Reuse unchanged sessions; refold changed logs only, and coalesce live writes per session</text>
15
- <g>
16
- <rect x="55" y="175" width="1490" height="430" rx="22" fill="#f8fafc" stroke="#738195" stroke-width="2"/>
17
- <text x="77" y="211" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="17" font-weight="650" fill="#586578">History scan · revision check</text></g>
18
- <g>
19
- <rect x="55" y="640" width="1490" height="320" rx="22" fill="#f4fbf7" stroke="#299572" stroke-width="2"/>
20
- <text x="77" y="676" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="17" font-weight="650" fill="#586578">Live events · coalesced async persistence</text></g>
21
- <path d="M330 365 H420" fill="none" stroke="#6c7a8d" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-en-arrow)"/>
22
- <path d="M670 365 H760" fill="none" stroke="#6c7a8d" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-en-arrow)"/>
23
- <path d="M980 350 H1030 V285 H1090" fill="none" stroke="#6c7a8d" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-en-arrow)"/>
24
- <g>
25
- <rect x="996" y="241" width="64" height="30" rx="15" fill="#fff" stroke="#d7dde5" stroke-width="1.4"/>
26
- <text x="1028" y="261" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="13" fill="#5e6b7d">No</text></g>
27
- <path d="M980 405 H1030 V470 H1090" fill="none" stroke="#6c7a8d" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-en-arrow)"/>
28
- <g>
29
- <rect x="996" y="426" width="64" height="30" rx="15" fill="#fff" stroke="#d7dde5" stroke-width="1.4"/>
30
- <text x="1028" y="446" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="13" fill="#5e6b7d">Yes</text></g>
31
- <path d="M1340 470 H1360" fill="none" stroke="#6c7a8d" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-en-arrow)"/>
32
- <path d="M350 800 H435" fill="none" stroke="#6c7a8d" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-en-arrow)"/>
33
- <path d="M725 800 H800" fill="none" stroke="#6c7a8d" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-en-arrow)"/>
34
- <path d="M1090 800 H1170" fill="none" stroke="#6c7a8d" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-en-arrow)"/>
35
- <g>
36
- <rect x="100" y="300" width="230" height="130" rx="18" fill="#e9edf2" stroke="#738195" stroke-width="2.5"/>
37
- <rect x="114" y="314" width="5" height="102" rx="2.5" fill="#738195" opacity=".42"/>
38
- <text x="215" y="348.5" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#1e293b"><tspan x="215">Plugin activation</tspan><tspan x="215" dy="25" font-size="14" font-weight="450" fill="#596579">Load ledger index</tspan><tspan x="215" dy="22" font-size="14" font-weight="450" fill="#596579">List registered workspaces</tspan></text></g>
39
- <g>
40
- <rect x="420" y="300" width="250" height="130" rx="18" fill="#dcf4e8" stroke="#299572" stroke-width="2.5"/>
41
- <rect x="434" y="314" width="5" height="102" rx="2.5" fill="#299572" opacity=".42"/>
42
- <text x="545" y="360" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#1e293b"><tspan x="545">Read session revision</tspan><tspan x="545" dy="25" font-size="14" font-weight="450" fill="#596579">Compare with ledger revision</tspan></text></g>
43
- <g>
44
- <rect x="760" y="300" width="220" height="130" rx="18" fill="#dcf4e8" stroke="#299572" stroke-width="2.5"/>
45
- <rect x="774" y="314" width="5" height="102" rx="2.5" fill="#299572" opacity=".42"/>
46
- <text x="870" y="360" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#1e293b"><tspan x="870">Check for changes</tspan><tspan x="870" dy="25" font-size="14" font-weight="450" fill="#596579">Reread this log?</tspan></text></g>
47
- <g>
48
- <rect x="1090" y="220" width="270" height="130" rx="18" fill="#eee5fc" stroke="#885bd0" stroke-width="2.5"/>
49
- <rect x="1104" y="234" width="5" height="102" rx="2.5" fill="#885bd0" opacity=".42"/>
50
- <text x="1225" y="268.5" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#1e293b"><tspan x="1225">Reuse existing record</tspan><tspan x="1225" dy="25" font-size="14" font-weight="450" fill="#596579">Revision unchanged</tspan><tspan x="1225" dy="22" font-size="14" font-weight="450" fill="#596579">Skip the session log read</tspan></text></g>
51
- <g>
52
- <rect x="1090" y="405" width="250" height="130" rx="18" fill="#dcf4e8" stroke="#299572" stroke-width="2.5"/>
53
- <rect x="1104" y="419" width="5" height="102" rx="2.5" fill="#299572" opacity=".42"/>
54
- <text x="1215" y="453.5" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#1e293b"><tspan x="1215">Read and fold changes</tspan><tspan x="1215" dy="25" font-size="14" font-weight="450" fill="#596579">Normalize usage</tspan><tspan x="1215" dy="22" font-size="14" font-weight="450" fill="#596579">Replace by turn/step</tspan></text></g>
55
- <g>
56
- <rect x="1360" y="405" width="172" height="130" rx="18" fill="#eee5fc" stroke="#885bd0" stroke-width="2.5"/>
57
- <rect x="1374" y="419" width="5" height="102" rx="2.5" fill="#885bd0" opacity=".42"/>
58
- <text x="1446" y="465" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#1e293b"><tspan x="1446">Session record</tspan><tspan x="1446" dy="25" font-size="14" font-weight="450" fill="#596579">This session only</tspan></text></g>
59
- <g>
60
- <rect x="100" y="735" width="250" height="130" rx="18" fill="#e9edf2" stroke="#738195" stroke-width="2.5"/>
61
- <rect x="114" y="749" width="5" height="102" rx="2.5" fill="#738195" opacity=".42"/>
62
- <text x="225" y="783.5" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#1e293b"><tspan x="225">DSH usage events</tspan><tspan x="225" dy="25" font-size="14" font-weight="450" fill="#596579">assistant/chunk · turn/end</tspan><tspan x="225" dy="22" font-size="14" font-weight="450" fill="#596579">Final message.usage</tspan></text></g>
63
- <g>
64
- <rect x="435" y="735" width="290" height="130" rx="18" fill="#dcf4e8" stroke="#299572" stroke-width="2.5"/>
65
- <rect x="449" y="749" width="5" height="102" rx="2.5" fill="#299572" opacity=".42"/>
66
- <text x="580" y="783.5" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#1e293b"><tspan x="580">Fold by session · turn/step</tspan><tspan x="580" dy="25" font-size="14" font-weight="450" fill="#596579">Keep latest valid usage</tspan><tspan x="580" dy="22" font-size="14" font-weight="450" fill="#596579">Update session aggregate</tspan></text></g>
67
- <g>
68
- <rect x="800" y="735" width="290" height="130" rx="18" fill="#dcf4e8" stroke="#299572" stroke-width="2.5"/>
69
- <rect x="814" y="749" width="5" height="102" rx="2.5" fill="#299572" opacity=".42"/>
70
- <text x="945" y="795" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#1e293b"><tspan x="945">Coalesce pending writes</tspan><tspan x="945" dy="25" font-size="14" font-weight="450" fill="#596579">Keep latest record per session</tspan></text></g>
71
- <g>
72
- <rect x="1170" y="735" width="300" height="130" rx="18" fill="#eee5fc" stroke="#885bd0" stroke-width="2.5"/>
73
- <rect x="1184" y="749" width="5" height="102" rx="2.5" fill="#885bd0" opacity=".42"/>
74
- <text x="1320" y="795" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#1e293b"><tspan x="1320">Flush ledger asynchronously</tspan><tspan x="1320" dy="25" font-size="14" font-weight="450" fill="#596579">Failed writes can retry later</tspan></text></g>
75
- <text x="80" y="1005" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="15" fill="#465468">History scans and live events converge on the same per-session ledger; request details are loaded by page when viewed.</text>
76
- <rect x="80" y="1053" width="22" height="18" rx="5" fill="#e9edf2" stroke="#738195" stroke-width="2"/>
77
- <text x="112" y="1068" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="14" fill="#536174">Input / decision</text>
78
- <rect x="330" y="1053" width="22" height="18" rx="5" fill="#dcf4e8" stroke="#299572" stroke-width="2"/>
79
- <text x="362" y="1068" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="14" fill="#536174">Processing</text>
80
- <rect x="560" y="1053" width="22" height="18" rx="5" fill="#eee5fc" stroke="#885bd0" stroke-width="2"/>
81
- <text x="592" y="1068" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="14" fill="#536174">Persistence</text></svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" lang="en" width="1600" height="1100" viewBox="0 0 1600 1100" role="img" aria-labelledby="sync-en-title sync-en-desc">
2
+ <title id="sync-en-title">History and Live Data Flow</title>
3
+ <desc id="sync-en-desc">Reuse unchanged sessions; refold changed logs only, and coalesce live writes per session</desc>
4
+ <defs>
5
+ <pattern id="sync-en-dots" width="32" height="32" patternUnits="userSpaceOnUse">
6
+ <circle cx="2" cy="2" r="1.5" fill="#242b35"/></pattern>
7
+ <marker id="sync-en-arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse">
8
+ <path d="M 0 0 L 10 5 L 0 10 z" fill="#7f8a9a"/></marker></defs>
9
+ <rect width="100%" height="100%" fill="#0f1216"/>
10
+ <rect width="100%" height="100%" fill="url(#sync-en-dots)"/>
11
+ <circle cx="72" cy="74" r="15" fill="#4fb3c6" opacity=".18"/>
12
+ <circle cx="72" cy="74" r="7" fill="#4fb3c6"/>
13
+ <text x="102" y="81" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="34" font-weight="700" fill="#f5f7fa">History and Live Data Flow</text>
14
+ <text x="102" y="119" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="17" fill="#9aa6b6">Reuse unchanged sessions; refold changed logs only, and coalesce live writes per session</text>
15
+ <g>
16
+ <rect x="55" y="175" width="1490" height="430" rx="22" fill="#151a21" stroke="#8b95a5" stroke-width="2"/>
17
+ <text x="77" y="211" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="17" font-weight="650" fill="#9aa6b6">History scan · revision check</text></g>
18
+ <g>
19
+ <rect x="55" y="640" width="1490" height="320" rx="22" fill="#101c19" stroke="#3fae86" stroke-width="2"/>
20
+ <text x="77" y="676" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="17" font-weight="650" fill="#9aa6b6">Live events · coalesced async persistence</text></g>
21
+ <path d="M330 365 H420" fill="none" stroke="#7f8a9a" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-en-arrow)"/>
22
+ <path d="M670 365 H760" fill="none" stroke="#7f8a9a" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-en-arrow)"/>
23
+ <path d="M980 350 H1030 V285 H1090" fill="none" stroke="#7f8a9a" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-en-arrow)"/>
24
+ <g>
25
+ <rect x="996" y="241" width="64" height="30" rx="15" fill="#1c2129" stroke="#333a45" stroke-width="1.4"/>
26
+ <text x="1028" y="261" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="13" fill="#a3adbb">No</text></g>
27
+ <path d="M980 405 H1030 V470 H1090" fill="none" stroke="#7f8a9a" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-en-arrow)"/>
28
+ <g>
29
+ <rect x="996" y="426" width="64" height="30" rx="15" fill="#1c2129" stroke="#333a45" stroke-width="1.4"/>
30
+ <text x="1028" y="446" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="13" fill="#a3adbb">Yes</text></g>
31
+ <path d="M1340 470 H1360" fill="none" stroke="#7f8a9a" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-en-arrow)"/>
32
+ <path d="M350 800 H435" fill="none" stroke="#7f8a9a" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-en-arrow)"/>
33
+ <path d="M725 800 H800" fill="none" stroke="#7f8a9a" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-en-arrow)"/>
34
+ <path d="M1090 800 H1170" fill="none" stroke="#7f8a9a" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-en-arrow)"/>
35
+ <g>
36
+ <rect x="100" y="300" width="230" height="130" rx="18" fill="#232a34" stroke="#8b95a5" stroke-width="2.5"/>
37
+ <rect x="114" y="314" width="5" height="102" rx="2.5" fill="#8b95a5" opacity=".42"/>
38
+ <text x="215" y="348.5" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#eef2f7"><tspan x="215">Plugin activation</tspan><tspan x="215" dy="25" font-size="14" font-weight="450" fill="#b9c3d1">Load ledger index</tspan><tspan x="215" dy="22" font-size="14" font-weight="450" fill="#b9c3d1">List registered workspaces</tspan></text></g>
39
+ <g>
40
+ <rect x="420" y="300" width="250" height="130" rx="18" fill="#12302a" stroke="#3fae86" stroke-width="2.5"/>
41
+ <rect x="434" y="314" width="5" height="102" rx="2.5" fill="#3fae86" opacity=".42"/>
42
+ <text x="545" y="360" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#eef2f7"><tspan x="545">Read session revision</tspan><tspan x="545" dy="25" font-size="14" font-weight="450" fill="#b9c3d1">Compare with ledger revision</tspan></text></g>
43
+ <g>
44
+ <rect x="760" y="300" width="220" height="130" rx="18" fill="#12302a" stroke="#3fae86" stroke-width="2.5"/>
45
+ <rect x="774" y="314" width="5" height="102" rx="2.5" fill="#3fae86" opacity=".42"/>
46
+ <text x="870" y="360" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#eef2f7"><tspan x="870">Check for changes</tspan><tspan x="870" dy="25" font-size="14" font-weight="450" fill="#b9c3d1">Reread this log?</tspan></text></g>
47
+ <g>
48
+ <rect x="1090" y="220" width="270" height="130" rx="18" fill="#241d3a" stroke="#9b74dd" stroke-width="2.5"/>
49
+ <rect x="1104" y="234" width="5" height="102" rx="2.5" fill="#9b74dd" opacity=".42"/>
50
+ <text x="1225" y="268.5" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#eef2f7"><tspan x="1225">Reuse existing record</tspan><tspan x="1225" dy="25" font-size="14" font-weight="450" fill="#b9c3d1">Revision unchanged</tspan><tspan x="1225" dy="22" font-size="14" font-weight="450" fill="#b9c3d1">Skip the session log read</tspan></text></g>
51
+ <g>
52
+ <rect x="1090" y="405" width="250" height="130" rx="18" fill="#12302a" stroke="#3fae86" stroke-width="2.5"/>
53
+ <rect x="1104" y="419" width="5" height="102" rx="2.5" fill="#3fae86" opacity=".42"/>
54
+ <text x="1215" y="453.5" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#eef2f7"><tspan x="1215">Read and fold changes</tspan><tspan x="1215" dy="25" font-size="14" font-weight="450" fill="#b9c3d1">Normalize usage</tspan><tspan x="1215" dy="22" font-size="14" font-weight="450" fill="#b9c3d1">Replace by turn/step</tspan></text></g>
55
+ <g>
56
+ <rect x="1360" y="405" width="172" height="130" rx="18" fill="#241d3a" stroke="#9b74dd" stroke-width="2.5"/>
57
+ <rect x="1374" y="419" width="5" height="102" rx="2.5" fill="#9b74dd" opacity=".42"/>
58
+ <text x="1446" y="465" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#eef2f7"><tspan x="1446">Session record</tspan><tspan x="1446" dy="25" font-size="14" font-weight="450" fill="#b9c3d1">This session only</tspan></text></g>
59
+ <g>
60
+ <rect x="100" y="735" width="250" height="130" rx="18" fill="#232a34" stroke="#8b95a5" stroke-width="2.5"/>
61
+ <rect x="114" y="749" width="5" height="102" rx="2.5" fill="#8b95a5" opacity=".42"/>
62
+ <text x="225" y="783.5" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#eef2f7"><tspan x="225">DSH usage events</tspan><tspan x="225" dy="25" font-size="14" font-weight="450" fill="#b9c3d1">assistant/chunk · turn/end</tspan><tspan x="225" dy="22" font-size="14" font-weight="450" fill="#b9c3d1">Final message.usage</tspan></text></g>
63
+ <g>
64
+ <rect x="435" y="735" width="290" height="130" rx="18" fill="#12302a" stroke="#3fae86" stroke-width="2.5"/>
65
+ <rect x="449" y="749" width="5" height="102" rx="2.5" fill="#3fae86" opacity=".42"/>
66
+ <text x="580" y="783.5" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#eef2f7"><tspan x="580">Fold by session · turn/step</tspan><tspan x="580" dy="25" font-size="14" font-weight="450" fill="#b9c3d1">Keep latest valid usage</tspan><tspan x="580" dy="22" font-size="14" font-weight="450" fill="#b9c3d1">Update session aggregate</tspan></text></g>
67
+ <g>
68
+ <rect x="800" y="735" width="290" height="130" rx="18" fill="#12302a" stroke="#3fae86" stroke-width="2.5"/>
69
+ <rect x="814" y="749" width="5" height="102" rx="2.5" fill="#3fae86" opacity=".42"/>
70
+ <text x="945" y="795" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#eef2f7"><tspan x="945">Coalesce pending writes</tspan><tspan x="945" dy="25" font-size="14" font-weight="450" fill="#b9c3d1">Keep latest record per session</tspan></text></g>
71
+ <g>
72
+ <rect x="1170" y="735" width="300" height="130" rx="18" fill="#241d3a" stroke="#9b74dd" stroke-width="2.5"/>
73
+ <rect x="1184" y="749" width="5" height="102" rx="2.5" fill="#9b74dd" opacity=".42"/>
74
+ <text x="1320" y="795" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#eef2f7"><tspan x="1320">Flush ledger asynchronously</tspan><tspan x="1320" dy="25" font-size="14" font-weight="450" fill="#b9c3d1">Failed writes can retry later</tspan></text></g>
75
+ <text x="80" y="1005" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="15" fill="#7f8a9a">History scans and live events converge on the same per-session ledger; request details are loaded by page when viewed.</text>
76
+ <rect x="80" y="1053" width="22" height="18" rx="5" fill="#232a34" stroke="#8b95a5" stroke-width="2"/>
77
+ <text x="112" y="1068" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="14" fill="#a3adbb">Input / decision</text>
78
+ <rect x="330" y="1053" width="22" height="18" rx="5" fill="#12302a" stroke="#3fae86" stroke-width="2"/>
79
+ <text x="362" y="1068" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="14" fill="#a3adbb">Processing</text>
80
+ <rect x="560" y="1053" width="22" height="18" rx="5" fill="#241d3a" stroke="#9b74dd" stroke-width="2"/>
81
+ <text x="592" y="1068" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="14" fill="#a3adbb">Persistence</text></svg>
@@ -1,81 +1,81 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" lang="zh-CN" width="1600" height="1100" viewBox="0 0 1600 1100" role="img" aria-labelledby="sync-zh-title sync-zh-desc">
2
- <title id="sync-zh-title">历史与实时数据流</title>
3
- <desc id="sync-zh-desc">未变化的会话复用账本;变化日志才重新折叠,实时更新按会话合并写入</desc>
4
- <defs>
5
- <pattern id="sync-zh-dots" width="32" height="32" patternUnits="userSpaceOnUse">
6
- <circle cx="2" cy="2" r="1.5" fill="#dce2e9"/></pattern>
7
- <marker id="sync-zh-arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse">
8
- <path d="M 0 0 L 10 5 L 0 10 z" fill="#6c7a8d"/></marker></defs>
9
- <rect width="100%" height="100%" fill="#fbfcfe"/>
10
- <rect width="100%" height="100%" fill="url(#sync-zh-dots)"/>
11
- <circle cx="72" cy="74" r="15" fill="#2c99ad" opacity=".18"/>
12
- <circle cx="72" cy="74" r="7" fill="#2c99ad"/>
13
- <text x="102" y="81" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="34" font-weight="700" fill="#1b2638">历史与实时数据流</text>
14
- <text x="102" y="119" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="17" fill="#637083">未变化的会话复用账本;变化日志才重新折叠,实时更新按会话合并写入</text>
15
- <g>
16
- <rect x="55" y="175" width="1490" height="430" rx="22" fill="#f8fafc" stroke="#738195" stroke-width="2"/>
17
- <text x="77" y="211" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="17" font-weight="650" fill="#586578">历史扫描 · revision 对照</text></g>
18
- <g>
19
- <rect x="55" y="640" width="1490" height="320" rx="22" fill="#f4fbf7" stroke="#299572" stroke-width="2"/>
20
- <text x="77" y="676" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="17" font-weight="650" fill="#586578">实时事件 · 合并后异步落盘</text></g>
21
- <path d="M330 365 H420" fill="none" stroke="#6c7a8d" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-zh-arrow)"/>
22
- <path d="M670 365 H760" fill="none" stroke="#6c7a8d" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-zh-arrow)"/>
23
- <path d="M980 350 H1030 V285 H1090" fill="none" stroke="#6c7a8d" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-zh-arrow)"/>
24
- <g>
25
- <rect x="996" y="241" width="64" height="30" rx="15" fill="#fff" stroke="#d7dde5" stroke-width="1.4"/>
26
- <text x="1028" y="261" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="13" fill="#5e6b7d">否</text></g>
27
- <path d="M980 405 H1030 V470 H1090" fill="none" stroke="#6c7a8d" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-zh-arrow)"/>
28
- <g>
29
- <rect x="996" y="426" width="64" height="30" rx="15" fill="#fff" stroke="#d7dde5" stroke-width="1.4"/>
30
- <text x="1028" y="446" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="13" fill="#5e6b7d">是</text></g>
31
- <path d="M1360 470 H1380" fill="none" stroke="#6c7a8d" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-zh-arrow)"/>
32
- <path d="M350 800 H435" fill="none" stroke="#6c7a8d" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-zh-arrow)"/>
33
- <path d="M725 800 H800" fill="none" stroke="#6c7a8d" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-zh-arrow)"/>
34
- <path d="M1090 800 H1170" fill="none" stroke="#6c7a8d" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-zh-arrow)"/>
35
- <g>
36
- <rect x="100" y="300" width="230" height="130" rx="18" fill="#e9edf2" stroke="#738195" stroke-width="2.5"/>
37
- <rect x="114" y="314" width="5" height="102" rx="2.5" fill="#738195" opacity=".42"/>
38
- <text x="215" y="348.5" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#1e293b"><tspan x="215">插件激活</tspan><tspan x="215" dy="25" font-size="14" font-weight="450" fill="#596579">读取账本索引</tspan><tspan x="215" dy="22" font-size="14" font-weight="450" fill="#596579">枚举已注册工作区</tspan></text></g>
39
- <g>
40
- <rect x="420" y="300" width="250" height="130" rx="18" fill="#dcf4e8" stroke="#299572" stroke-width="2.5"/>
41
- <rect x="434" y="314" width="5" height="102" rx="2.5" fill="#299572" opacity=".42"/>
42
- <text x="545" y="360" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#1e293b"><tspan x="545">读取会话 revision</tspan><tspan x="545" dy="25" font-size="14" font-weight="450" fill="#596579">与账本版本对照</tspan></text></g>
43
- <g>
44
- <rect x="760" y="300" width="220" height="130" rx="18" fill="#dcf4e8" stroke="#299572" stroke-width="2.5"/>
45
- <rect x="774" y="314" width="5" height="102" rx="2.5" fill="#299572" opacity=".42"/>
46
- <text x="870" y="360" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#1e293b"><tspan x="870">判断会话变化</tspan><tspan x="870" dy="25" font-size="14" font-weight="450" fill="#596579">是否需要重读日志?</tspan></text></g>
47
- <g>
48
- <rect x="1090" y="220" width="270" height="130" rx="18" fill="#eee5fc" stroke="#885bd0" stroke-width="2.5"/>
49
- <rect x="1104" y="234" width="5" height="102" rx="2.5" fill="#885bd0" opacity=".42"/>
50
- <text x="1225" y="268.5" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#1e293b"><tspan x="1225">复用已有记录</tspan><tspan x="1225" dy="25" font-size="14" font-weight="450" fill="#596579">revision 未变</tspan><tspan x="1225" dy="22" font-size="14" font-weight="450" fill="#596579">不重读会话日志</tspan></text></g>
51
- <g>
52
- <rect x="1090" y="405" width="270" height="130" rx="18" fill="#dcf4e8" stroke="#299572" stroke-width="2.5"/>
53
- <rect x="1104" y="419" width="5" height="102" rx="2.5" fill="#299572" opacity=".42"/>
54
- <text x="1225" y="453.5" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#1e293b"><tspan x="1225">读取并折叠变化日志</tspan><tspan x="1225" dy="25" font-size="14" font-weight="450" fill="#596579">规范化 usage</tspan><tspan x="1225" dy="22" font-size="14" font-weight="450" fill="#596579">按 turn/step 替换</tspan></text></g>
55
- <g>
56
- <rect x="1380" y="405" width="150" height="130" rx="18" fill="#eee5fc" stroke="#885bd0" stroke-width="2.5"/>
57
- <rect x="1394" y="419" width="5" height="102" rx="2.5" fill="#885bd0" opacity=".42"/>
58
- <text x="1455" y="465" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#1e293b"><tspan x="1455">会话记录</tspan><tspan x="1455" dy="25" font-size="14" font-weight="450" fill="#596579">仅写本 session</tspan></text></g>
59
- <g>
60
- <rect x="100" y="735" width="250" height="130" rx="18" fill="#e9edf2" stroke="#738195" stroke-width="2.5"/>
61
- <rect x="114" y="749" width="5" height="102" rx="2.5" fill="#738195" opacity=".42"/>
62
- <text x="225" y="783.5" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#1e293b"><tspan x="225">DSH usage 事件</tspan><tspan x="225" dy="25" font-size="14" font-weight="450" fill="#596579">assistant/chunk · turn/end</tspan><tspan x="225" dy="22" font-size="14" font-weight="450" fill="#596579">最终 message.usage</tspan></text></g>
63
- <g>
64
- <rect x="435" y="735" width="290" height="130" rx="18" fill="#dcf4e8" stroke="#299572" stroke-width="2.5"/>
65
- <rect x="449" y="749" width="5" height="102" rx="2.5" fill="#299572" opacity=".42"/>
66
- <text x="580" y="783.5" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#1e293b"><tspan x="580">按 session · turn/step 折叠</tspan><tspan x="580" dy="25" font-size="14" font-weight="450" fill="#596579">保留最新有效 usage</tspan><tspan x="580" dy="22" font-size="14" font-weight="450" fill="#596579">更新会话聚合</tspan></text></g>
67
- <g>
68
- <rect x="800" y="735" width="290" height="130" rx="18" fill="#dcf4e8" stroke="#299572" stroke-width="2.5"/>
69
- <rect x="814" y="749" width="5" height="102" rx="2.5" fill="#299572" opacity=".42"/>
70
- <text x="945" y="795" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#1e293b"><tspan x="945">合并 pending 写入</tspan><tspan x="945" dy="25" font-size="14" font-weight="450" fill="#596579">每会话仅保留最新记录</tspan></text></g>
71
- <g>
72
- <rect x="1170" y="735" width="300" height="130" rx="18" fill="#eee5fc" stroke="#885bd0" stroke-width="2.5"/>
73
- <rect x="1184" y="749" width="5" height="102" rx="2.5" fill="#885bd0" opacity=".42"/>
74
- <text x="1320" y="795" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#1e293b"><tspan x="1320">异步 flush 账本</tspan><tspan x="1320" dy="25" font-size="14" font-weight="450" fill="#596579">失败时后续可重试</tspan></text></g>
75
- <text x="80" y="1005" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="15" fill="#465468">历史扫描与实时事件最终归入同一份逐会话账本;请求明细在查看时按页读取。</text>
76
- <rect x="80" y="1053" width="22" height="18" rx="5" fill="#e9edf2" stroke="#738195" stroke-width="2"/>
77
- <text x="112" y="1068" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="14" fill="#536174">输入 / 判断</text>
78
- <rect x="330" y="1053" width="22" height="18" rx="5" fill="#dcf4e8" stroke="#299572" stroke-width="2"/>
79
- <text x="362" y="1068" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="14" fill="#536174">处理</text>
80
- <rect x="560" y="1053" width="22" height="18" rx="5" fill="#eee5fc" stroke="#885bd0" stroke-width="2"/>
81
- <text x="592" y="1068" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="14" fill="#536174">持久化</text></svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" lang="zh-CN" width="1600" height="1100" viewBox="0 0 1600 1100" role="img" aria-labelledby="sync-zh-title sync-zh-desc">
2
+ <title id="sync-zh-title">历史与实时数据流</title>
3
+ <desc id="sync-zh-desc">未变化的会话复用账本;变化日志才重新折叠,实时更新按会话合并写入</desc>
4
+ <defs>
5
+ <pattern id="sync-zh-dots" width="32" height="32" patternUnits="userSpaceOnUse">
6
+ <circle cx="2" cy="2" r="1.5" fill="#242b35"/></pattern>
7
+ <marker id="sync-zh-arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse">
8
+ <path d="M 0 0 L 10 5 L 0 10 z" fill="#7f8a9a"/></marker></defs>
9
+ <rect width="100%" height="100%" fill="#0f1216"/>
10
+ <rect width="100%" height="100%" fill="url(#sync-zh-dots)"/>
11
+ <circle cx="72" cy="74" r="15" fill="#4fb3c6" opacity=".18"/>
12
+ <circle cx="72" cy="74" r="7" fill="#4fb3c6"/>
13
+ <text x="102" y="81" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="34" font-weight="700" fill="#f5f7fa">历史与实时数据流</text>
14
+ <text x="102" y="119" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="17" fill="#9aa6b6">未变化的会话复用账本;变化日志才重新折叠,实时更新按会话合并写入</text>
15
+ <g>
16
+ <rect x="55" y="175" width="1490" height="430" rx="22" fill="#151a21" stroke="#8b95a5" stroke-width="2"/>
17
+ <text x="77" y="211" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="17" font-weight="650" fill="#9aa6b6">历史扫描 · revision 对照</text></g>
18
+ <g>
19
+ <rect x="55" y="640" width="1490" height="320" rx="22" fill="#101c19" stroke="#3fae86" stroke-width="2"/>
20
+ <text x="77" y="676" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="17" font-weight="650" fill="#9aa6b6">实时事件 · 合并后异步落盘</text></g>
21
+ <path d="M330 365 H420" fill="none" stroke="#7f8a9a" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-zh-arrow)"/>
22
+ <path d="M670 365 H760" fill="none" stroke="#7f8a9a" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-zh-arrow)"/>
23
+ <path d="M980 350 H1030 V285 H1090" fill="none" stroke="#7f8a9a" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-zh-arrow)"/>
24
+ <g>
25
+ <rect x="996" y="241" width="64" height="30" rx="15" fill="#1c2129" stroke="#333a45" stroke-width="1.4"/>
26
+ <text x="1028" y="261" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="13" fill="#a3adbb">否</text></g>
27
+ <path d="M980 405 H1030 V470 H1090" fill="none" stroke="#7f8a9a" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-zh-arrow)"/>
28
+ <g>
29
+ <rect x="996" y="426" width="64" height="30" rx="15" fill="#1c2129" stroke="#333a45" stroke-width="1.4"/>
30
+ <text x="1028" y="446" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="13" fill="#a3adbb">是</text></g>
31
+ <path d="M1360 470 H1380" fill="none" stroke="#7f8a9a" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-zh-arrow)"/>
32
+ <path d="M350 800 H435" fill="none" stroke="#7f8a9a" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-zh-arrow)"/>
33
+ <path d="M725 800 H800" fill="none" stroke="#7f8a9a" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-zh-arrow)"/>
34
+ <path d="M1090 800 H1170" fill="none" stroke="#7f8a9a" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" marker-end="url(#sync-zh-arrow)"/>
35
+ <g>
36
+ <rect x="100" y="300" width="230" height="130" rx="18" fill="#232a34" stroke="#8b95a5" stroke-width="2.5"/>
37
+ <rect x="114" y="314" width="5" height="102" rx="2.5" fill="#8b95a5" opacity=".42"/>
38
+ <text x="215" y="348.5" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#eef2f7"><tspan x="215">插件激活</tspan><tspan x="215" dy="25" font-size="14" font-weight="450" fill="#b9c3d1">读取账本索引</tspan><tspan x="215" dy="22" font-size="14" font-weight="450" fill="#b9c3d1">枚举已注册工作区</tspan></text></g>
39
+ <g>
40
+ <rect x="420" y="300" width="250" height="130" rx="18" fill="#12302a" stroke="#3fae86" stroke-width="2.5"/>
41
+ <rect x="434" y="314" width="5" height="102" rx="2.5" fill="#3fae86" opacity=".42"/>
42
+ <text x="545" y="360" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#eef2f7"><tspan x="545">读取会话 revision</tspan><tspan x="545" dy="25" font-size="14" font-weight="450" fill="#b9c3d1">与账本版本对照</tspan></text></g>
43
+ <g>
44
+ <rect x="760" y="300" width="220" height="130" rx="18" fill="#12302a" stroke="#3fae86" stroke-width="2.5"/>
45
+ <rect x="774" y="314" width="5" height="102" rx="2.5" fill="#3fae86" opacity=".42"/>
46
+ <text x="870" y="360" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#eef2f7"><tspan x="870">判断会话变化</tspan><tspan x="870" dy="25" font-size="14" font-weight="450" fill="#b9c3d1">是否需要重读日志?</tspan></text></g>
47
+ <g>
48
+ <rect x="1090" y="220" width="270" height="130" rx="18" fill="#241d3a" stroke="#9b74dd" stroke-width="2.5"/>
49
+ <rect x="1104" y="234" width="5" height="102" rx="2.5" fill="#9b74dd" opacity=".42"/>
50
+ <text x="1225" y="268.5" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#eef2f7"><tspan x="1225">复用已有记录</tspan><tspan x="1225" dy="25" font-size="14" font-weight="450" fill="#b9c3d1">revision 未变</tspan><tspan x="1225" dy="22" font-size="14" font-weight="450" fill="#b9c3d1">不重读会话日志</tspan></text></g>
51
+ <g>
52
+ <rect x="1090" y="405" width="270" height="130" rx="18" fill="#12302a" stroke="#3fae86" stroke-width="2.5"/>
53
+ <rect x="1104" y="419" width="5" height="102" rx="2.5" fill="#3fae86" opacity=".42"/>
54
+ <text x="1225" y="453.5" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#eef2f7"><tspan x="1225">读取并折叠变化日志</tspan><tspan x="1225" dy="25" font-size="14" font-weight="450" fill="#b9c3d1">规范化 usage</tspan><tspan x="1225" dy="22" font-size="14" font-weight="450" fill="#b9c3d1">按 turn/step 替换</tspan></text></g>
55
+ <g>
56
+ <rect x="1380" y="405" width="150" height="130" rx="18" fill="#241d3a" stroke="#9b74dd" stroke-width="2.5"/>
57
+ <rect x="1394" y="419" width="5" height="102" rx="2.5" fill="#9b74dd" opacity=".42"/>
58
+ <text x="1455" y="465" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#eef2f7"><tspan x="1455">会话记录</tspan><tspan x="1455" dy="25" font-size="14" font-weight="450" fill="#b9c3d1">仅写本 session</tspan></text></g>
59
+ <g>
60
+ <rect x="100" y="735" width="250" height="130" rx="18" fill="#232a34" stroke="#8b95a5" stroke-width="2.5"/>
61
+ <rect x="114" y="749" width="5" height="102" rx="2.5" fill="#8b95a5" opacity=".42"/>
62
+ <text x="225" y="783.5" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#eef2f7"><tspan x="225">DSH usage 事件</tspan><tspan x="225" dy="25" font-size="14" font-weight="450" fill="#b9c3d1">assistant/chunk · turn/end</tspan><tspan x="225" dy="22" font-size="14" font-weight="450" fill="#b9c3d1">最终 message.usage</tspan></text></g>
63
+ <g>
64
+ <rect x="435" y="735" width="290" height="130" rx="18" fill="#12302a" stroke="#3fae86" stroke-width="2.5"/>
65
+ <rect x="449" y="749" width="5" height="102" rx="2.5" fill="#3fae86" opacity=".42"/>
66
+ <text x="580" y="783.5" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#eef2f7"><tspan x="580">按 session · turn/step 折叠</tspan><tspan x="580" dy="25" font-size="14" font-weight="450" fill="#b9c3d1">保留最新有效 usage</tspan><tspan x="580" dy="22" font-size="14" font-weight="450" fill="#b9c3d1">更新会话聚合</tspan></text></g>
67
+ <g>
68
+ <rect x="800" y="735" width="290" height="130" rx="18" fill="#12302a" stroke="#3fae86" stroke-width="2.5"/>
69
+ <rect x="814" y="749" width="5" height="102" rx="2.5" fill="#3fae86" opacity=".42"/>
70
+ <text x="945" y="795" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#eef2f7"><tspan x="945">合并 pending 写入</tspan><tspan x="945" dy="25" font-size="14" font-weight="450" fill="#b9c3d1">每会话仅保留最新记录</tspan></text></g>
71
+ <g>
72
+ <rect x="1170" y="735" width="300" height="130" rx="18" fill="#241d3a" stroke="#9b74dd" stroke-width="2.5"/>
73
+ <rect x="1184" y="749" width="5" height="102" rx="2.5" fill="#9b74dd" opacity=".42"/>
74
+ <text x="1320" y="795" text-anchor="middle" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="18" font-weight="700" fill="#eef2f7"><tspan x="1320">异步 flush 账本</tspan><tspan x="1320" dy="25" font-size="14" font-weight="450" fill="#b9c3d1">失败时后续可重试</tspan></text></g>
75
+ <text x="80" y="1005" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="15" fill="#7f8a9a">历史扫描与实时事件最终归入同一份逐会话账本;请求明细在查看时按页读取。</text>
76
+ <rect x="80" y="1053" width="22" height="18" rx="5" fill="#232a34" stroke="#8b95a5" stroke-width="2"/>
77
+ <text x="112" y="1068" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="14" fill="#a3adbb">输入 / 判断</text>
78
+ <rect x="330" y="1053" width="22" height="18" rx="5" fill="#12302a" stroke="#3fae86" stroke-width="2"/>
79
+ <text x="362" y="1068" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="14" fill="#a3adbb">处理</text>
80
+ <rect x="560" y="1053" width="22" height="18" rx="5" fill="#241d3a" stroke="#9b74dd" stroke-width="2"/>
81
+ <text x="592" y="1068" font-family="Inter,system-ui,'Microsoft YaHei',sans-serif" font-size="14" fill="#a3adbb">持久化</text></svg>