dsh-compaction-weave 0.0.0-stage → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +97 -0
- package/LICENSE +21 -0
- package/README.en.md +136 -0
- package/README.md +139 -2
- package/cordis.patch.yml +19 -0
- package/docs/architecture.md +84 -0
- package/docs/benchmarks/published-0.3.2-rc.1-tests.json +576 -0
- package/docs/benchmarks/rc2-documentation.json +41 -0
- package/docs/benchmarks/rc2-linux-tests.json +590 -0
- package/docs/benchmarks/rc2-live-and-cost.json +746 -0
- package/docs/benchmarks/rc3-host-compatibility.json +2314 -0
- package/docs/benchmarks/rc4-tests.json +617 -0
- package/docs/benchmarks/review35-compression.json +117 -0
- package/docs/benchmarks/v0.3.2-live-four-way.json +3495 -0
- package/docs/benchmarks/v0.3.2-tests.json +590 -0
- package/docs/configuration.md +131 -0
- package/docs/development.md +88 -0
- package/docs/en/architecture.md +75 -0
- package/docs/en/configuration.md +131 -0
- package/docs/en/development.md +86 -0
- package/docs/en/feedback.md +47 -0
- package/docs/en/principles.md +235 -0
- package/docs/en/testing.md +368 -0
- package/docs/en/troubleshooting.md +59 -0
- package/docs/feedback.md +47 -0
- package/docs/images/principles-context.en.svg +77 -0
- package/docs/images/principles-context.zh.svg +77 -0
- package/docs/images/principles-pipeline.en.svg +93 -0
- package/docs/images/principles-pipeline.zh.svg +93 -0
- package/docs/images/principles-recovery.en.svg +46 -0
- package/docs/images/principles-recovery.zh.svg +46 -0
- package/docs/principles.md +235 -0
- package/docs/test-results.json +634 -0
- package/docs/testing.md +358 -0
- package/docs/troubleshooting.md +59 -0
- package/lib/abort.js +13 -0
- package/lib/action-state.js +60 -0
- package/lib/atomic-replace.js +18 -0
- package/lib/attachments.js +76 -0
- package/lib/audit-reject.js +161 -0
- package/lib/audit.js +939 -0
- package/lib/cache-policy.js +71 -0
- package/lib/client.js +696 -0
- package/lib/command-compact.js +38 -0
- package/lib/command-heartbeat.js +61 -0
- package/lib/config.js +596 -0
- package/lib/constraint-scope.js +37 -0
- package/lib/continuation-budget.js +69 -0
- package/lib/continuation-pending.js +57 -0
- package/lib/continuation-progress.js +46 -0
- package/lib/continuation.js +287 -0
- package/lib/engine-entry.js +103 -0
- package/lib/engine.js +2485 -0
- package/lib/failure-diagnostics.js +220 -0
- package/lib/history-source.js +74 -0
- package/lib/history.js +712 -0
- package/lib/idle-compaction.js +64 -0
- package/lib/index.js +611 -0
- package/lib/instruction-source.js +163 -0
- package/lib/journal.js +164 -0
- package/lib/manual-error.js +179 -0
- package/lib/memory-policy.js +383 -0
- package/lib/meter.js +387 -0
- package/lib/observation-mask.js +390 -0
- package/lib/proactive.js +108 -0
- package/lib/progress-facts.js +347 -0
- package/lib/progress-state.js +30 -0
- package/lib/prompt.js +194 -0
- package/lib/reconstruct.js +72 -0
- package/lib/reference-input.js +107 -0
- package/lib/region.js +972 -0
- package/lib/source-provenance.js +58 -0
- package/lib/source-recovery.js +22 -0
- package/lib/source-refs.js +137 -0
- package/lib/state.js +46 -0
- package/lib/storage-path.js +42 -0
- package/lib/summary-budget.js +187 -0
- package/lib/summary-config.js +308 -0
- package/lib/summary-progress.js +56 -0
- package/lib/summary-retry.js +27 -0
- package/lib/summary-timeout.js +68 -0
- package/lib/summary.js +476 -0
- package/lib/tools.js +341 -0
- package/lib/transaction-host.js +252 -0
- package/lib/transaction.js +285 -0
- package/lib/validate.js +503 -0
- package/lib/version.js +3 -0
- package/lib/window.js +120 -0
- package/lib/work-report.js +55 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +71 -4
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1400" height="760" viewBox="0 0 1400 760" font-family="Arial, Noto Sans CJK SC, Microsoft YaHei, sans-serif">
|
|
2
|
+
<title>上下文结构对照:两级整理、前后保留与按需归档回查</title>
|
|
3
|
+
<desc>展示 DSH Compaction Weave 两级上下文整理与压缩前后可见上下文的三段结构(保留前缀、第一级工具输出折叠或第二级平衡跨度检查点、保留近期尾部),以及通道隔离、有效要求审计与磁盘归档按需工具回查机制。</desc>
|
|
4
|
+
<defs>
|
|
5
|
+
<marker id="arrow-dark" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="8" markerHeight="8" orient="auto">
|
|
6
|
+
<path d="M 0 1 L 8 5 L 0 9 z" fill="#334155" />
|
|
7
|
+
</marker>
|
|
8
|
+
<marker id="arrow-blue" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="8" markerHeight="8" orient="auto">
|
|
9
|
+
<path d="M 0 1 L 8 5 L 0 9 z" fill="#0369A1" />
|
|
10
|
+
</marker>
|
|
11
|
+
</defs>
|
|
12
|
+
<rect x="0" y="0" width="1400" height="760" fill="#F8FAFC" />
|
|
13
|
+
<text x="700" y="50" text-anchor="middle" font-size="30" font-weight="bold" fill="#0F172A">上下文结构对照:两级整理、前后保留与按需归档回查</text>
|
|
14
|
+
<text x="60" y="92" font-size="22" font-weight="bold" fill="#334155">压缩前:当前可见消息表面(Visible Context Surface)</text>
|
|
15
|
+
<rect x="60" y="108" width="380" height="155" rx="12" fill="#FFFFFF" stroke="#64748B" stroke-width="2.5" />
|
|
16
|
+
<text x="84" y="145" font-size="21" font-weight="bold" fill="#0F172A">1. 保留前缀(Prefix)</text>
|
|
17
|
+
<text x="84" y="182" font-size="18" fill="#334155">
|
|
18
|
+
<tspan x="84" dy="0">系统提示词与指令框架</tspan>
|
|
19
|
+
<tspan x="84" dy="30">及已接受的旧检查点</tspan>
|
|
20
|
+
<tspan x="84" dy="30">优先在最新检查点后增量选区</tspan>
|
|
21
|
+
</text>
|
|
22
|
+
<rect x="470" y="108" width="460" height="155" rx="12" fill="#FFFBEB" stroke="#D97706" stroke-width="2.5" stroke-dasharray="8 5" />
|
|
23
|
+
<text x="494" y="145" font-size="21" font-weight="bold" fill="#92400E">2. 选定整理区间(两级处理)</text>
|
|
24
|
+
<text x="494" y="182" font-size="18" fill="#78350F">
|
|
25
|
+
<tspan x="494" dy="0">完整配对的 tool/call 与 result</tspan>
|
|
26
|
+
<tspan x="494" dy="30">第一级:超4k非错工具输出先折首尾</tspan>
|
|
27
|
+
<tspan x="494" dy="30">不够再压跨度;闲置/上限/修订合并</tspan>
|
|
28
|
+
</text>
|
|
29
|
+
<rect x="960" y="108" width="380" height="155" rx="12" fill="#FFFFFF" stroke="#64748B" stroke-width="2.5" />
|
|
30
|
+
<text x="984" y="145" font-size="21" font-weight="bold" fill="#0F172A">3. 近期尾部(Recent Tail)</text>
|
|
31
|
+
<text x="984" y="182" font-size="18" fill="#334155">
|
|
32
|
+
<tspan x="984" dy="0">自动路径默认保留预算的 16%</tspan>
|
|
33
|
+
<tspan x="984" dy="30">(例:M=191808 时为 30689t)</tspan>
|
|
34
|
+
<tspan x="984" dy="30">原样保留以维持当前步骤连贯</tspan>
|
|
35
|
+
</text>
|
|
36
|
+
<line x1="250" y1="320" x2="250" y2="332" stroke="#334155" stroke-width="2.5" marker-end="url(#arrow-dark)" />
|
|
37
|
+
<line x1="700" y1="320" x2="700" y2="332" stroke="#0369A1" stroke-width="3" marker-end="url(#arrow-blue)" />
|
|
38
|
+
<line x1="1150" y1="320" x2="1150" y2="332" stroke="#334155" stroke-width="2.5" marker-end="url(#arrow-dark)" />
|
|
39
|
+
<text x="60" y="322" font-size="22" font-weight="bold" fill="#334155">压缩后:主模型实际读取的当前请求消息列表</text>
|
|
40
|
+
<rect x="60" y="338" width="380" height="172" rx="12" fill="#F1F5F9" stroke="#475569" stroke-width="2.5" />
|
|
41
|
+
<text x="84" y="375" font-size="21" font-weight="bold" fill="#0F172A">1. 保留前缀(逐字节不变)</text>
|
|
42
|
+
<text x="84" y="412" font-size="18" fill="#334155">
|
|
43
|
+
<tspan x="84" dy="0">未触发合并时原样保留</tspan>
|
|
44
|
+
<tspan x="84" dy="30">同路由摘要亦尽量复用 KV 前缀</tspan>
|
|
45
|
+
<tspan x="84" dy="30">(缓存命中不等于总费用必降)</tspan>
|
|
46
|
+
</text>
|
|
47
|
+
<rect x="470" y="338" width="460" height="172" rx="12" fill="#E0F2FE" stroke="#0284C7" stroke-width="3" />
|
|
48
|
+
<text x="494" y="375" font-size="21" font-weight="bold" fill="#0C4A6E">2. 检查点或工具输出折叠预览</text>
|
|
49
|
+
<text x="494" y="412" font-size="18" fill="#0369A1">
|
|
50
|
+
<tspan x="494" dy="0">九节摘要 + 近期原话 + k:v进度与报告</tspan>
|
|
51
|
+
<tspan x="494" dy="30">附 History archive 指针与涉及文件</tspan>
|
|
52
|
+
<tspan x="494" dy="30">Tokens与UTF-8字节均严格小于源跨度</tspan>
|
|
53
|
+
</text>
|
|
54
|
+
<rect x="960" y="338" width="380" height="172" rx="12" fill="#F1F5F9" stroke="#475569" stroke-width="2.5" />
|
|
55
|
+
<text x="984" y="375" font-size="21" font-weight="bold" fill="#0F172A">3. 近期尾部 + 后续新消息</text>
|
|
56
|
+
<text x="984" y="412" font-size="18" fill="#334155">
|
|
57
|
+
<tspan x="984" dy="0">模型仅读取当前可见消息列表</tspan>
|
|
58
|
+
<tspan x="984" dy="30">不会每轮自动重读磁盘全部归档</tspan>
|
|
59
|
+
<tspan x="984" dy="30">有损摘要/预览 + 按需工具回查</tspan>
|
|
60
|
+
</text>
|
|
61
|
+
<line x1="1120" y1="568" x2="1120" y2="515" stroke="#0369A1" stroke-width="2.5" stroke-dasharray="7 5" marker-end="url(#arrow-blue)" />
|
|
62
|
+
<rect x="60" y="572" width="460" height="155" rx="12" fill="#FFFFFF" stroke="#475569" stroke-width="2.5" />
|
|
63
|
+
<text x="84" y="609" font-size="21" font-weight="bold" fill="#0F172A">原话预算、通道隔离与要求审计</text>
|
|
64
|
+
<text x="84" y="646" font-size="18" fill="#334155">
|
|
65
|
+
<tspan x="84" dy="0">第6节仅填近期原话(≤32条 / 4096t)</tspan>
|
|
66
|
+
<tspan x="84" dy="30">宿主通道与 XML 标签隔离外部参考</tspan>
|
|
67
|
+
<tspan x="84" dy="30">更早要求、否定极性与授权出处独立审计</tspan>
|
|
68
|
+
</text>
|
|
69
|
+
<path d="M 918 250 L 946 250 L 946 553 L 946 568" fill="none" stroke="#0369A1" stroke-width="2.5" marker-end="url(#arrow-blue)" />
|
|
70
|
+
<rect x="550" y="572" width="790" height="155" rx="12" fill="#F0FDF4" stroke="#15803D" stroke-width="2.5" />
|
|
71
|
+
<text x="574" y="609" font-size="21" font-weight="bold" fill="#14532D">磁盘原文归档(第一级折叠前 / 第二级替换前写入)</text>
|
|
72
|
+
<text x="574" y="646" font-size="18" fill="#166534">
|
|
73
|
+
<tspan x="574" dy="0">完整保存原始事件、代码、工具日志与附件(含 SHA-256 校验)</tspan>
|
|
74
|
+
<tspan x="574" dy="30">通过 history_list / 多词 history_search / history_read 按需精准回查</tspan>
|
|
75
|
+
<tspan x="574" dy="30">外部文件后续可能改变,需区分归档历史快照与当前磁盘文件</tspan>
|
|
76
|
+
</text>
|
|
77
|
+
</svg>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1440" height="780" viewBox="0 0 1440 780" font-family="Arial, Noto Sans CJK SC, Microsoft YaHei, sans-serif">
|
|
2
|
+
<title>Two-Stage Compaction Pipeline: Mask Logs First, Summarize, Validate, Archive, Commit</title>
|
|
3
|
+
<desc>Two-row pipeline diagram showing Stage-1 non-error observation masking and trigger measurement, span and same-route prefix reuse, channel isolation and UTF-8 byte budget, single-target candidate generation, full validation with approval/k:v checks, backend continuation, pre-commit Stage-2 archiving with History archive pointers, and single-pass hashed transaction commit.</desc>
|
|
4
|
+
<defs>
|
|
5
|
+
<marker id="p-arrow-en" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="8" markerHeight="8" orient="auto">
|
|
6
|
+
<path d="M 0 1 L 8 5 L 0 9 z" fill="#334155" />
|
|
7
|
+
</marker>
|
|
8
|
+
<marker id="p-arrow-amber-en" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="8" markerHeight="8" orient="auto">
|
|
9
|
+
<path d="M 0 1 L 8 5 L 0 9 z" fill="#B45309" />
|
|
10
|
+
</marker>
|
|
11
|
+
<marker id="p-arrow-green-en" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="8" markerHeight="8" orient="auto">
|
|
12
|
+
<path d="M 0 1 L 8 5 L 0 9 z" fill="#15803D" />
|
|
13
|
+
</marker>
|
|
14
|
+
</defs>
|
|
15
|
+
<rect x="0" y="0" width="1440" height="780" fill="#F8FAFC" />
|
|
16
|
+
<text x="720" y="52" text-anchor="middle" font-size="28" font-weight="bold" fill="#0F172A">Two-Stage Pipeline: Mask Logs, Summarize, Validate, Archive, Commit</text>
|
|
17
|
+
<rect x="45" y="105" width="305" height="215" rx="12" fill="#FFFFFF" stroke="#475569" stroke-width="2.5" />
|
|
18
|
+
<text x="65" y="142" font-size="20" font-weight="bold" fill="#0F172A">1. Trigger & Stage-1 Mask</text>
|
|
19
|
+
<text x="65" y="178" font-size="16.5" fill="#334155">
|
|
20
|
+
<tspan x="65" dy="0">Auto T / Idle / /compact / Queued</tspan>
|
|
21
|
+
<tspan x="65" dy="30">Archive & mask >4k OK logs</tspan>
|
|
22
|
+
<tspan x="65" dy="30">Re-measure; stop if target met</tspan>
|
|
23
|
+
<tspan x="65" dy="30">Else Stage-2; pre-prune save</tspan>
|
|
24
|
+
</text>
|
|
25
|
+
<line x1="350" y1="212" x2="390" y2="212" stroke="#334155" stroke-width="2.5" marker-end="url(#p-arrow-en)" />
|
|
26
|
+
<rect x="395" y="105" width="305" height="215" rx="12" fill="#FFFFFF" stroke="#475569" stroke-width="2.5" />
|
|
27
|
+
<text x="415" y="142" font-size="20" font-weight="bold" fill="#0F172A">2. Span & Prefix Cache</text>
|
|
28
|
+
<text x="415" y="178" font-size="16.5" fill="#334155">
|
|
29
|
+
<tspan x="415" dy="0">Select tool-balanced span;</tspan>
|
|
30
|
+
<tspan x="415" dy="30">incremental after checkpoint</tspan>
|
|
31
|
+
<tspan x="415" dy="30">Exact KV prefix if same-route</tspan>
|
|
32
|
+
<tspan x="415" dy="30">Merge on idle / 4-cap / revision</tspan>
|
|
33
|
+
</text>
|
|
34
|
+
<line x1="700" y1="212" x2="740" y2="212" stroke="#334155" stroke-width="2.5" marker-end="url(#p-arrow-en)" />
|
|
35
|
+
<rect x="745" y="105" width="305" height="215" rx="12" fill="#FFFFFF" stroke="#475569" stroke-width="2.5" />
|
|
36
|
+
<text x="765" y="142" font-size="20" font-weight="bold" fill="#0F172A">3. Channels & Budget</text>
|
|
37
|
+
<text x="765" y="178" font-size="16.5" fill="#334155">
|
|
38
|
+
<tspan x="765" dy="0">Channels + XML isolate refs</tspan>
|
|
39
|
+
<tspan x="765" dy="30">Extract reqs, k:v & report</tspan>
|
|
40
|
+
<tspan x="765" dy="30">Project reads if off-route</tspan>
|
|
41
|
+
<tspan x="765" dy="30">UTF-8 Limit; fallback overflow</tspan>
|
|
42
|
+
</text>
|
|
43
|
+
<line x1="1050" y1="212" x2="1090" y2="212" stroke="#334155" stroke-width="2.5" marker-end="url(#p-arrow-en)" />
|
|
44
|
+
<rect x="1095" y="105" width="300" height="215" rx="12" fill="#E0F2FE" stroke="#0284C7" stroke-width="2.5" />
|
|
45
|
+
<text x="1115" y="142" font-size="20" font-weight="bold" fill="#0C4A6E">4. Single-Target Call</text>
|
|
46
|
+
<text x="1115" y="178" font-size="16.5" fill="#0369A1">
|
|
47
|
+
<tspan x="1115" dy="0">1st resolved route only</tspan>
|
|
48
|
+
<tspan x="1115" dy="30">No cross-provider failover</tspan>
|
|
49
|
+
<tspan x="1115" dy="30">1st try + 2 retries (180s cap)</tspan>
|
|
50
|
+
<tspan x="1115" dy="30">Up to 32 sequential chunks</tspan>
|
|
51
|
+
</text>
|
|
52
|
+
<line x1="1210" y1="320" x2="1210" y2="430" stroke="#334155" stroke-width="2.5" marker-end="url(#p-arrow-en)" />
|
|
53
|
+
<line x1="1290" y1="435" x2="1290" y2="325" stroke="#B45309" stroke-width="2.5" stroke-dasharray="6 4" marker-end="url(#p-arrow-amber-en)" />
|
|
54
|
+
<text x="1250" y="382" text-anchor="middle" font-size="18" font-weight="bold" fill="#B45309">Finite corrective retries</text>
|
|
55
|
+
<rect x="1095" y="435" width="300" height="225" rx="12" fill="#FEF3C7" stroke="#D97706" stroke-width="2.5" />
|
|
56
|
+
<text x="1115" y="472" font-size="20" font-weight="bold" fill="#92400E">5. Full Validation</text>
|
|
57
|
+
<text x="1115" y="508" font-size="16.5" fill="#78350F">
|
|
58
|
+
<tspan x="1115" dy="0">9 sections + quotes + archive ptr</tspan>
|
|
59
|
+
<tspan x="1115" dy="30">Reqs, polarity & approvals (0.6)</tspan>
|
|
60
|
+
<tspan x="1115" dy="30">Structured k:v progress check</tspan>
|
|
61
|
+
<tspan x="1115" dy="30">Token/byte drop; reuse verified</tspan>
|
|
62
|
+
</text>
|
|
63
|
+
<line x1="895" y1="320" x2="895" y2="430" stroke="#B45309" stroke-width="2.5" stroke-dasharray="6 4" marker-end="url(#p-arrow-amber-en)" />
|
|
64
|
+
<line x1="1095" y1="525" x2="1055" y2="525" stroke="#B45309" stroke-width="2.5" stroke-dasharray="6 4" marker-end="url(#p-arrow-amber-en)" />
|
|
65
|
+
<line x1="1055" y1="575" x2="1090" y2="575" stroke="#334155" stroke-width="2.5" marker-end="url(#p-arrow-en)" />
|
|
66
|
+
<rect x="745" y="435" width="305" height="225" rx="12" fill="#FFFBEB" stroke="#D97706" stroke-width="2.5" />
|
|
67
|
+
<text x="765" y="472" font-size="20" font-weight="bold" fill="#92400E">6. Backend Continuation</text>
|
|
68
|
+
<text x="765" y="508" font-size="16.5" fill="#78350F">
|
|
69
|
+
<tspan x="765" dy="0">Capacity / not-smaller errors;</tspan>
|
|
70
|
+
<tspan x="765" dy="30">4-section notes (12 KiB) +</tspan>
|
|
71
|
+
<tspan x="765" dy="30">Exact active requirements</tspan>
|
|
72
|
+
<tspan x="765" dy="30">Save pages and usage ledger</tspan>
|
|
73
|
+
</text>
|
|
74
|
+
<path d="M 1245 660 L 1245 725 L 547 725 L 547 665" fill="none" stroke="#15803D" stroke-width="3" marker-end="url(#p-arrow-green-en)" />
|
|
75
|
+
<text x="895" y="712" text-anchor="middle" font-size="18" font-weight="bold" fill="#15803D">Stage-2 checks passed -> Archive span BEFORE commit (Stage-1 tool logs archived earlier)</text>
|
|
76
|
+
<rect x="395" y="435" width="305" height="225" rx="12" fill="#F0FDF4" stroke="#15803D" stroke-width="2.5" />
|
|
77
|
+
<text x="415" y="472" font-size="20" font-weight="bold" fill="#14532D">7. Pre-Commit Archive</text>
|
|
78
|
+
<text x="415" y="508" font-size="16.5" fill="#166534">
|
|
79
|
+
<tspan x="415" dy="0">Write original span & files</tspan>
|
|
80
|
+
<tspan x="415" dy="30">Verify counts and sequences</tspan>
|
|
81
|
+
<tspan x="415" dy="30">Abort on archive failure;</tspan>
|
|
82
|
+
<tspan x="415" dy="30">Checkpoint notes archive ID</tspan>
|
|
83
|
+
</text>
|
|
84
|
+
<line x1="395" y1="548" x2="355" y2="548" stroke="#15803D" stroke-width="3" marker-end="url(#p-arrow-green-en)" />
|
|
85
|
+
<rect x="45" y="435" width="305" height="225" rx="12" fill="#F0FDF4" stroke="#15803D" stroke-width="3" />
|
|
86
|
+
<text x="65" y="472" font-size="20" font-weight="bold" fill="#14532D">8. Commit & Lookup</text>
|
|
87
|
+
<text x="65" y="508" font-size="16.5" fill="#166534">
|
|
88
|
+
<tspan x="65" dy="0">Raw & normalized host check</tspan>
|
|
89
|
+
<tspan x="65" dy="30">Single-pass copy+hash backup</tspan>
|
|
90
|
+
<tspan x="65" dy="30">Durable commit then publish</tspan>
|
|
91
|
+
<tspan x="65" dy="30">Multi-term search & read</tspan>
|
|
92
|
+
</text>
|
|
93
|
+
</svg>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1440" height="780" viewBox="0 0 1440 780" font-family="Arial, Noto Sans CJK SC, Microsoft YaHei, sans-serif">
|
|
2
|
+
<title>两级压缩与校验流水线:先折叠工具日志、再摘要校验、归档后事务提交</title>
|
|
3
|
+
<desc>两行展示 DSH Compaction Weave 两级整理与校验流水线:触发测量与第一级工具输出折叠、选区与同路由前缀复用、通道隔离与 UTF-8 字节预算、单目标生成、完整审计校验、后台分页接续、第二级提交前归档与指针、单趟备份哈希与持久事务提交。</desc>
|
|
4
|
+
<defs>
|
|
5
|
+
<marker id="p-arrow" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="8" markerHeight="8" orient="auto">
|
|
6
|
+
<path d="M 0 1 L 8 5 L 0 9 z" fill="#334155" />
|
|
7
|
+
</marker>
|
|
8
|
+
<marker id="p-arrow-amber" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="8" markerHeight="8" orient="auto">
|
|
9
|
+
<path d="M 0 1 L 8 5 L 0 9 z" fill="#B45309" />
|
|
10
|
+
</marker>
|
|
11
|
+
<marker id="p-arrow-green" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="8" markerHeight="8" orient="auto">
|
|
12
|
+
<path d="M 0 1 L 8 5 L 0 9 z" fill="#15803D" />
|
|
13
|
+
</marker>
|
|
14
|
+
</defs>
|
|
15
|
+
<rect x="0" y="0" width="1440" height="780" fill="#F8FAFC" />
|
|
16
|
+
<text x="720" y="52" text-anchor="middle" font-size="28" font-weight="bold" fill="#0F172A">两级压缩与校验流水线:先折叠工具日志、再摘要校验、归档后提交</text>
|
|
17
|
+
<rect x="45" y="105" width="305" height="215" rx="12" fill="#FFFFFF" stroke="#475569" stroke-width="2.5" />
|
|
18
|
+
<text x="65" y="142" font-size="20" font-weight="bold" fill="#0F172A">1. 触发与第一级折叠</text>
|
|
19
|
+
<text x="65" y="178" font-size="16.5" fill="#334155">
|
|
20
|
+
<tspan x="65" dy="0">自动T / 闲置 / 手动 / 阶段申请</tspan>
|
|
21
|
+
<tspan x="65" dy="30">超4k非错工具输出先归档折首尾</tspan>
|
|
22
|
+
<tspan x="65" dy="30">压力下复测达标则免调摘要</tspan>
|
|
23
|
+
<tspan x="65" dy="30">不够再进第2步;溢出先保原件</tspan>
|
|
24
|
+
</text>
|
|
25
|
+
<line x1="350" y1="212" x2="390" y2="212" stroke="#334155" stroke-width="2.5" marker-end="url(#p-arrow)" />
|
|
26
|
+
<rect x="395" y="105" width="305" height="215" rx="12" fill="#FFFFFF" stroke="#475569" stroke-width="2.5" />
|
|
27
|
+
<text x="415" y="142" font-size="20" font-weight="bold" fill="#0F172A">2. 选区与前缀缓存策略</text>
|
|
28
|
+
<text x="415" y="178" font-size="16.5" fill="#334155">
|
|
29
|
+
<tspan x="415" dy="0">选完整配对工具调用区间</tspan>
|
|
30
|
+
<tspan x="415" dy="30">优先在最新检查点后增量选区</tspan>
|
|
31
|
+
<tspan x="415" dy="30">同路由首轮装得下复用原样前缀</tspan>
|
|
32
|
+
<tspan x="415" dy="30">闲置 / 达上限(4) / 修订时合并</tspan>
|
|
33
|
+
</text>
|
|
34
|
+
<line x1="700" y1="212" x2="740" y2="212" stroke="#334155" stroke-width="2.5" marker-end="url(#p-arrow)" />
|
|
35
|
+
<rect x="745" y="105" width="305" height="215" rx="12" fill="#FFFFFF" stroke="#475569" stroke-width="2.5" />
|
|
36
|
+
<text x="765" y="142" font-size="20" font-weight="bold" fill="#0F172A">3. 通道隔离与字节预算</text>
|
|
37
|
+
<text x="765" y="178" font-size="16.5" fill="#334155">
|
|
38
|
+
<tspan x="765" dy="0">宿主通道与XML标签隔离引用</tspan>
|
|
39
|
+
<tspan x="765" dy="30">提取要求、k:v进度与工作报告</tspan>
|
|
40
|
+
<tspan x="765" dy="30">非同路由或超限改走坐标投影</tspan>
|
|
41
|
+
<tspan x="765" dy="30">按UTF-8上限预算,溢出退投影</tspan>
|
|
42
|
+
</text>
|
|
43
|
+
<line x1="1050" y1="212" x2="1090" y2="212" stroke="#334155" stroke-width="2.5" marker-end="url(#p-arrow)" />
|
|
44
|
+
<rect x="1095" y="105" width="300" height="215" rx="12" fill="#E0F2FE" stroke="#0284C7" stroke-width="2.5" />
|
|
45
|
+
<text x="1115" y="142" font-size="20" font-weight="bold" fill="#0C4A6E">4. 单目标生成候选</text>
|
|
46
|
+
<text x="1115" y="178" font-size="16.5" fill="#0369A1">
|
|
47
|
+
<tspan x="1115" dy="0">固定首个目标 singleTarget</tspan>
|
|
48
|
+
<tspan x="1115" dy="30">不自动切其他供应商兜底</tspan>
|
|
49
|
+
<tspan x="1115" dy="30">默认首次 + 2 次重试(180s)</tspan>
|
|
50
|
+
<tspan x="1115" dy="30">常规多块最多顺序 32 块</tspan>
|
|
51
|
+
</text>
|
|
52
|
+
<line x1="1210" y1="320" x2="1210" y2="430" stroke="#334155" stroke-width="2.5" marker-end="url(#p-arrow)" />
|
|
53
|
+
<line x1="1290" y1="435" x2="1290" y2="325" stroke="#B45309" stroke-width="2.5" stroke-dasharray="6 4" marker-end="url(#p-arrow-amber)" />
|
|
54
|
+
<text x="1250" y="382" text-anchor="middle" font-size="18" font-weight="bold" fill="#B45309">检查不通过:有限重试</text>
|
|
55
|
+
<rect x="1095" y="435" width="300" height="225" rx="12" fill="#FEF3C7" stroke="#D97706" stroke-width="2.5" />
|
|
56
|
+
<text x="1115" y="472" font-size="20" font-weight="bold" fill="#92400E">5. 完整候选严格校验</text>
|
|
57
|
+
<text x="1115" y="508" font-size="16.5" fill="#78350F">
|
|
58
|
+
<tspan x="1115" dy="0">九节结构 + 第六节 + 归档指针</tspan>
|
|
59
|
+
<tspan x="1115" dy="30">要求 / 极性 / 授权出处(阈值0.6)</tspan>
|
|
60
|
+
<tspan x="1115" dy="30">显式 k:v 进度核对防冲突</tspan>
|
|
61
|
+
<tspan x="1115" dy="30">Tokens与字节缩小(通过复用)</tspan>
|
|
62
|
+
</text>
|
|
63
|
+
<line x1="895" y1="320" x2="895" y2="430" stroke="#B45309" stroke-width="2.5" stroke-dasharray="6 4" marker-end="url(#p-arrow-amber)" />
|
|
64
|
+
<line x1="1095" y1="525" x2="1055" y2="525" stroke="#B45309" stroke-width="2.5" stroke-dasharray="6 4" marker-end="url(#p-arrow-amber)" />
|
|
65
|
+
<line x1="1055" y1="575" x2="1090" y2="575" stroke="#334155" stroke-width="2.5" marker-end="url(#p-arrow)" />
|
|
66
|
+
<rect x="745" y="435" width="305" height="225" rx="12" fill="#FFFBEB" stroke="#D97706" stroke-width="2.5" />
|
|
67
|
+
<text x="765" y="472" font-size="20" font-weight="bold" fill="#92400E">6. 后台容量分页接续</text>
|
|
68
|
+
<text x="765" y="508" font-size="16.5" fill="#78350F">
|
|
69
|
+
<tspan x="765" dy="0">容量 / 未缩小等特定拒绝触发</tspan>
|
|
70
|
+
<tspan x="765" dy="30">四节笔记(默认 12 KiB)+</tspan>
|
|
71
|
+
<tspan x="765" dy="30">有效要求逐字独立驻留</tspan>
|
|
72
|
+
<tspan x="765" dy="30">保存已接受页与累计账本</tspan>
|
|
73
|
+
</text>
|
|
74
|
+
<path d="M 1245 660 L 1245 725 L 547 725 L 547 665" fill="none" stroke="#15803D" stroke-width="3" marker-end="url(#p-arrow-green)" />
|
|
75
|
+
<text x="895" y="712" text-anchor="middle" font-size="18" font-weight="bold" fill="#15803D">第二级摘要全部校验通过后,才归档该跨度并提交(第一级工具日志此前已归档)</text>
|
|
76
|
+
<rect x="395" y="435" width="305" height="225" rx="12" fill="#F0FDF4" stroke="#15803D" stroke-width="2.5" />
|
|
77
|
+
<text x="415" y="472" font-size="20" font-weight="bold" fill="#14532D">7. 提交前原文归档</text>
|
|
78
|
+
<text x="415" y="508" font-size="16.5" fill="#166534">
|
|
79
|
+
<tspan x="415" dy="0">写入被替换跨度原文与附件</tspan>
|
|
80
|
+
<tspan x="415" dy="30">回读校验条数与事件序号</tspan>
|
|
81
|
+
<tspan x="415" dy="30">归档失败则中止并保留原文</tspan>
|
|
82
|
+
<tspan x="415" dy="30">检查点附 History archive 指针</tspan>
|
|
83
|
+
</text>
|
|
84
|
+
<line x1="395" y1="548" x2="355" y2="548" stroke="#15803D" stroke-width="3" marker-end="url(#p-arrow-green)" />
|
|
85
|
+
<rect x="45" y="435" width="305" height="225" rx="12" fill="#F0FDF4" stroke="#15803D" stroke-width="3" />
|
|
86
|
+
<text x="65" y="472" font-size="20" font-weight="bold" fill="#14532D">8. 持久事务提交与回查</text>
|
|
87
|
+
<text x="65" y="508" font-size="16.5" fill="#166534">
|
|
88
|
+
<tspan x="65" dy="0">原始与归一化指纹校验宿主方法</tspan>
|
|
89
|
+
<tspan x="65" dy="30">单趟拷贝兼哈希备份 .rollback</tspan>
|
|
90
|
+
<tspan x="65" dy="30">写成功决定后发布并继续会话</tspan>
|
|
91
|
+
<tspan x="65" dy="30">支持多词 history_search 回查</tspan>
|
|
92
|
+
</text>
|
|
93
|
+
</svg>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1440" height="780" viewBox="0 0 1440 780" font-family="Arial, Noto Sans CJK SC, Microsoft YaHei, sans-serif">
|
|
2
|
+
<title>Failure recovery: candidates, pages, partial commits, durable success</title>
|
|
3
|
+
<desc>Shows recovery behavior across four failure positions: A. Uncommitted candidate or pre-decision failure restores intact span; B. Paused backend continuation saves accepted pages and ledger while main history stays unchanged; C. Multi-chunk partial commit keeps earlier committed chunks; D. Post-decision live publication failure quarantines writer and requires cold reopen.</desc>
|
|
4
|
+
<rect x="0" y="0" width="1440" height="780" fill="#F8FAFC" />
|
|
5
|
+
<text x="720" y="52" text-anchor="middle" font-size="30" font-weight="bold" fill="#0F172A">Failure recovery: candidates, pages, partial commits, durable success</text>
|
|
6
|
+
<rect x="45" y="100" width="655" height="305" rx="12" fill="#FFFFFF" stroke="#0284C7" stroke-width="2.5" />
|
|
7
|
+
<rect x="45" y="100" width="655" height="52" rx="12" fill="#E0F2FE" stroke="#0284C7" stroke-width="2" />
|
|
8
|
+
<text x="70" y="134" font-size="22" font-weight="bold" fill="#0C4A6E">A. Current span has not reached durable success</text>
|
|
9
|
+
<text x="70" y="186" font-size="20" fill="#1E293B">
|
|
10
|
+
<tspan x="70" dy="0">• Timeout, rejected candidate, archive error,</tspan>
|
|
11
|
+
<tspan x="70" dy="32"> or failure before the durable success decision.</tspan>
|
|
12
|
+
<tspan x="70" dy="32">• Discard candidate, or attempt verified backup restore.</tspan>
|
|
13
|
+
<tspan x="70" dy="32"> If restore fails, quarantine and retain recovery data.</tspan>
|
|
14
|
+
<tspan x="70" dy="32" font-weight="bold" fill="#0369A1">• Report known attempts; missing usage stays unknown.</tspan>
|
|
15
|
+
</text>
|
|
16
|
+
<rect x="740" y="100" width="655" height="305" rx="12" fill="#FFFFFF" stroke="#D97706" stroke-width="2.5" />
|
|
17
|
+
<rect x="740" y="100" width="655" height="52" rx="12" fill="#FEF3C7" stroke="#D97706" stroke-width="2" />
|
|
18
|
+
<text x="765" y="134" font-size="22" font-weight="bold" fill="#92400E">B. Continuation interrupted or budget exhausted</text>
|
|
19
|
+
<text x="765" y="186" font-size="20" fill="#1E293B">
|
|
20
|
+
<tspan x="765" dy="0">• A page fails or the finite call budget is exhausted.</tspan>
|
|
21
|
+
<tspan x="765" dy="32">• Accepted pages saved ≠ main history replaced.</tspan>
|
|
22
|
+
<tspan x="765" dy="32">• Preserve source identity, accepted pages, and usage.</tspan>
|
|
23
|
+
<tspan x="765" dy="32"> New /compact can renew an exhausted finite allowance.</tspan>
|
|
24
|
+
<tspan x="765" dy="32" font-weight="bold" fill="#B45309">• Source edits may require redo; earlier chunks can remain.</tspan>
|
|
25
|
+
</text>
|
|
26
|
+
<rect x="45" y="435" width="655" height="305" rx="12" fill="#FFFFFF" stroke="#4F46E5" stroke-width="2.5" />
|
|
27
|
+
<rect x="45" y="435" width="655" height="52" rx="12" fill="#E0E7FF" stroke="#4F46E5" stroke-width="2" />
|
|
28
|
+
<text x="70" y="469" font-size="22" font-weight="bold" fill="#312E81">C. Later chunk fails after earlier commits</text>
|
|
29
|
+
<text x="70" y="521" font-size="20" fill="#1E293B">
|
|
30
|
+
<tspan x="70" dy="0">• Earlier chunks commit; a later chunk fails.</tspan>
|
|
31
|
+
<tspan x="70" dy="32">• Each accepted chunk is committed independently.</tspan>
|
|
32
|
+
<tspan x="70" dy="32"> Preserve the successfully committed checkpoints.</tspan>
|
|
33
|
+
<tspan x="70" dy="32">• Only uncommitted spans keep original visible messages.</tspan>
|
|
34
|
+
<tspan x="70" dy="32" font-weight="bold" fill="#4338CA">• Missing request usage remains unknown.</tspan>
|
|
35
|
+
</text>
|
|
36
|
+
<rect x="740" y="435" width="655" height="305" rx="12" fill="#FFFFFF" stroke="#DC2626" stroke-width="2.5" />
|
|
37
|
+
<rect x="740" y="435" width="655" height="52" rx="12" fill="#FEE2E2" stroke="#DC2626" stroke-width="2" />
|
|
38
|
+
<text x="765" y="469" font-size="22" font-weight="bold" fill="#991B1B">D. Publication failure after durable success</text>
|
|
39
|
+
<text x="765" y="521" font-size="20" fill="#1E293B">
|
|
40
|
+
<tspan x="765" dy="0">• Replacement and success decision are durable,</tspan>
|
|
41
|
+
<tspan x="765" dy="32"> then publication to the live in-memory session fails.</tspan>
|
|
42
|
+
<tspan x="765" dy="32">• Quarantine the writer; preserve committed disk history.</tspan>
|
|
43
|
+
<tspan x="765" dy="32"> Reopen the session from its durable log.</tspan>
|
|
44
|
+
<tspan x="765" dy="32" font-weight="bold" fill="#B91C1C">• Recovery must verify evidence before allowing work.</tspan>
|
|
45
|
+
</text>
|
|
46
|
+
</svg>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1440" height="780" viewBox="0 0 1440 780" font-family="Arial, Noto Sans CJK SC, Microsoft YaHei, sans-serif">
|
|
2
|
+
<title>故障与恢复:候选、分页、部分提交与持久成功</title>
|
|
3
|
+
<desc>展示四种不同故障阶段的恢复边界:A. 候选未提交或持久成功决定前失败可恢复原状;B. 后台容量分页接续保存已接受页与费用账本但主历史未替换;C. 常规多块压缩前块保留、后块未提交(partial);D. 持久成功决定后发布失败必须隔离写入器并冷重开。</desc>
|
|
4
|
+
<rect x="0" y="0" width="1440" height="780" fill="#F8FAFC" />
|
|
5
|
+
<text x="720" y="52" text-anchor="middle" font-size="30" font-weight="bold" fill="#0F172A">故障与恢复:候选、分页、部分提交与持久成功</text>
|
|
6
|
+
<rect x="45" y="100" width="655" height="305" rx="12" fill="#FFFFFF" stroke="#0284C7" stroke-width="2.5" />
|
|
7
|
+
<rect x="45" y="100" width="655" height="52" rx="12" fill="#E0F2FE" stroke="#0284C7" stroke-width="2" />
|
|
8
|
+
<text x="70" y="134" font-size="22" font-weight="bold" fill="#0C4A6E">A. 当前选区尚未持久成功</text>
|
|
9
|
+
<text x="70" y="186" font-size="20" fill="#1E293B">
|
|
10
|
+
<tspan x="70" dy="0">• 位置:模型超时、结构/要求/进度校验被拒、未严格缩小、</tspan>
|
|
11
|
+
<tspan x="70" dy="32"> 归档写入或回读失败,或事务写入 decided=true 前发生异常</tspan>
|
|
12
|
+
<tspan x="70" dy="32">• 恢复:未进事务则直接丢弃候选;已进事务则校验并从</tspan>
|
|
13
|
+
<tspan x="70" dy="32"> .rollback 原子恢复原文件(若备份恢复本身失败则隔离)</tspan>
|
|
14
|
+
<tspan x="70" dy="32" font-weight="bold" fill="#0369A1">• 状态:替换未成功;恢复失败时隔离,缺失用量仍未知</tspan>
|
|
15
|
+
</text>
|
|
16
|
+
<rect x="740" y="100" width="655" height="305" rx="12" fill="#FFFFFF" stroke="#D97706" stroke-width="2.5" />
|
|
17
|
+
<rect x="740" y="100" width="655" height="52" rx="12" fill="#FEF3C7" stroke="#D97706" stroke-width="2" />
|
|
18
|
+
<text x="765" y="134" font-size="22" font-weight="bold" fill="#92400E">B. 后台分页中断或预算耗尽</text>
|
|
19
|
+
<text x="765" y="186" font-size="20" fill="#1E293B">
|
|
20
|
+
<tspan x="765" dy="0">• 位置:分页处理中途报错,或额外调用额度(默认 4 次)耗尽</tspan>
|
|
21
|
+
<tspan x="765" dy="32">• 关键边界:已接受页保存在磁盘 ≠ 主对话表面(surface)已替换</tspan>
|
|
22
|
+
<tspan x="765" dy="32">• 恢复:磁盘持久化已接受页(含源 SHA-256)与累计调用账本;</tspan>
|
|
23
|
+
<tspan x="765" dy="32"> 用户显式执行 /compact 可续批有限额度并从首个未完成页继续</tspan>
|
|
24
|
+
<tspan x="765" dy="32" font-weight="bold" fill="#B45309">• 选区尚未替换;旧成功块可保留,来源变化可能需重算</tspan>
|
|
25
|
+
</text>
|
|
26
|
+
<rect x="45" y="435" width="655" height="305" rx="12" fill="#FFFFFF" stroke="#4F46E5" stroke-width="2.5" />
|
|
27
|
+
<rect x="45" y="435" width="655" height="52" rx="12" fill="#E0E7FF" stroke="#4F46E5" stroke-width="2" />
|
|
28
|
+
<text x="70" y="469" font-size="22" font-weight="bold" fill="#312E81">C. 多块处理:后续块失败</text>
|
|
29
|
+
<text x="70" y="521" font-size="20" fill="#1E293B">
|
|
30
|
+
<tspan x="70" dy="0">• 位置:长跨度分块推进(上限 32 块),前序分块已完成归档</tspan>
|
|
31
|
+
<tspan x="70" dy="32"> 与事务提交,后续某块在生成、校验或容量检查时失败</tspan>
|
|
32
|
+
<tspan x="70" dy="32">• 恢复:每一成功分块独立持久化提交,绝不回滚已提交的前序分块</tspan>
|
|
33
|
+
<tspan x="70" dy="32">• 诊断记录已采集的尝试;缺失用量仍为未知</tspan>
|
|
34
|
+
<tspan x="70" dy="32" font-weight="bold" fill="#4338CA">• 状态:前序分块保留为检查点,仅剩余未提交跨度保留原始消息</tspan>
|
|
35
|
+
</text>
|
|
36
|
+
<rect x="740" y="435" width="655" height="305" rx="12" fill="#FFFFFF" stroke="#DC2626" stroke-width="2.5" />
|
|
37
|
+
<rect x="740" y="435" width="655" height="52" rx="12" fill="#FEE2E2" stroke="#DC2626" stroke-width="2" />
|
|
38
|
+
<text x="765" y="469" font-size="22" font-weight="bold" fill="#991B1B">D. 持久成功后发布故障</text>
|
|
39
|
+
<text x="765" y="521" font-size="20" fill="#1E293B">
|
|
40
|
+
<tspan x="765" dy="0">• 位置:替换事件已追加写入会话 JSONL 并完成 fsync,且事务</tspan>
|
|
41
|
+
<tspan x="765" dy="32"> 日志已同步记录 phase: committed,随后内存事件路由发布异常</tspan>
|
|
42
|
+
<tspan x="765" dy="32">• 恢复:严禁回滚磁盘上已提交的新历史!立即隔离(quarantine)</tspan>
|
|
43
|
+
<tspan x="765" dy="32"> 当前写入器,阻断陈旧内存继续写入,要求冷重开(cold reopen)</tspan>
|
|
44
|
+
<tspan x="765" dy="32" font-weight="bold" fill="#B91C1C">• 状态:从持久日志重开,核验恢复结果后继续工作</tspan>
|
|
45
|
+
</text>
|
|
46
|
+
</svg>
|