@logictan/dsh-verbatim-compaction 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/lib/index.js +0 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,7 +61,9 @@
|
|
|
61
61
|
|
|
62
62
|
`## Asked` 记的是「**助手**向**用户**提了什么、给了哪些选项」。这一节最容易错成「把用户请求改写一遍」——真实一次压缩里,模型把用户那段中文请求翻成英文塞进了 `Asked`,而用户原话就在它上面逐字抄着,同一件事写了两遍。
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
原因之一在材料标签:原来写 `USER REQUEST:`,模型有理由读成「这一轮问了什么」,现在改成 `USER INSTRUCTION (already in the digest verbatim; never copy it into Asked)`。另一部分靠指令本身——`## Asked` 的定义写明「助手问、用户答」,并注明照抄用户请求是这一节最常见的出错方式。
|
|
65
|
+
|
|
66
|
+
正文为空的轮次(那个真实案例有 96 条助手消息、150 次工具调用却只有 156 字符正文)本来就没有提问可记,`## Asked` 和 `## Did` 一样走 `pruneEmptySections` 整节省略,不需要单独规则。实测 123 条真人消息里 43 条(35%)不超过 12 个字符——`3`、`1`、`同意`、`做`、`继续`——而 46% 是在回答上一轮助手的提问。只逐字保留「3」而不保留它在回答什么问题,等于记下一个决定却没记下决定的是什么。
|
|
65
67
|
|
|
66
68
|
模型用的是会话自己的路由(`session.requestHeader()?.config`),和宿主原生压缩同一个取法,不需要单独配置凭据。
|
|
67
69
|
|
package/lib/index.js
CHANGED
|
@@ -712,16 +712,9 @@ export function buildExtractionMaterial(turn, prose) {
|
|
|
712
712
|
const hints = collectHints(turn);
|
|
713
713
|
if (userRequest.length === 0 && prose.length === 0 && hints.length === 0)
|
|
714
714
|
return '';
|
|
715
|
-
// Say it explicitly when there is no prose. A turn with 150 tool calls and 156
|
|
716
|
-
// characters of prose gives the model nothing to quote, and a real run filled
|
|
717
|
-
// Asked with a translation of the user request instead of omitting it.
|
|
718
|
-
const asked = prose.length === 0
|
|
719
|
-
? 'ASKED: omit — this turn produced no assistant prose, so it asked the user nothing'
|
|
720
|
-
: 'ASKED: record only what the assistant asked the user';
|
|
721
715
|
return [
|
|
722
716
|
`USER INSTRUCTION (already in the digest verbatim; never copy it into Asked):\n${userRequest.slice(0, 4000) || '(none)'}`,
|
|
723
717
|
`ASSISTANT PROSE:\n${prose.slice(0, 6000) || '(none)'}`,
|
|
724
|
-
asked,
|
|
725
718
|
`TOOL TRACE:\n${hints || '(none)'}`,
|
|
726
719
|
].join('\n\n');
|
|
727
720
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logictan/dsh-verbatim-compaction",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Deterministic compaction backend that keeps conversation prose verbatim in the checkpoint instead of re-summarizing it: user and assistant text survive word for word, tool results collapse to one-line pointers, reasoning is never read, and no model call is made.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|