dsh-reasoning-distill 0.1.7 → 0.1.9
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 +10 -0
- package/README.md +11 -3
- package/lib/client/index.js +77 -65
- package/lib/client/index.js.map +1 -1
- package/lib/index.js +6 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
本插件的版本变更记录。
|
|
4
4
|
|
|
5
|
+
## 0.1.9
|
|
6
|
+
|
|
7
|
+
- README 开头补充「适用场景」说明:本插件只在单轮次、多步工具调用的超长单轮对话里划算;多轮问答中每轮步骤少、压缩收益有限,且 DeepSeek 的 API 默认不会参考之前轮次的 `reasoning_content`(仅请求携带 tools 时拼接进上下文),改写还会让缓存前缀失效、后续请求按未命中计费,整体往往难以抵消。插件面向「说完任务就不管」的许愿式编程,在根据用户反馈反复精修的阶段建议关闭。
|
|
8
|
+
- 本次没有代码改动。
|
|
9
|
+
|
|
10
|
+
## 0.1.8
|
|
11
|
+
|
|
12
|
+
- **调整初始配置**:刚安装时默认规则里的「对可续接子代理启用」「附带工具调用结果」「压缩最终回答轮」现在默认关闭。新建的逐模型规则同样以一个全关的初始层开始(三种会话类型全关,上述三项也显式关闭),不会因为现有默认规则把它们开着而自动继承为开。
|
|
13
|
+
- 面板提示与 README 的默认值说明同步更新;已有存储配置不迁移。
|
|
14
|
+
|
|
5
15
|
## 0.1.7
|
|
6
16
|
|
|
7
17
|
- **调整内置蒸馏提示词**:明确要求保留原思考中正确且有效的推理过程,而不是直接跳到结论。可以压缩措辞、合并重复、删除噪音,但不能省略有效的推导步骤;只保留结论的短版本视为错误。自我纠正时保留纠正后的整条推理线(结论、证据与有效步骤),只丢弃被放弃的尝试。
|
package/README.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
把过长的模型思考压缩成核心内容,之后每次请求都重放压缩版,省下重复发送的 token;同时给出每个会话的开销与节省报告。
|
|
4
4
|
|
|
5
|
+
> **⚠️ 适用场景**
|
|
6
|
+
>
|
|
7
|
+
> 本插件只在 **「单轮次、多步工具调用的超长单轮对话」** 里划算。模型连续调用很多步工具时,同一段历史在每一步都要重新发送,压缩后的思考会在同一轮里被反复重放,省下的输入 token 才能累积到超过蒸馏开销。
|
|
8
|
+
>
|
|
9
|
+
> **「多轮问答」** 中每轮通常只有少量步骤,压缩省下的 token 有限。更关键的是,**DeepSeek 的 API 在多轮对话中不会参考之前轮次的 `reasoning_content`**(只有请求携带 tools 时才会拼接进上下文),压缩后的思考通常不会被模型读到;改写却会改变历史内容,而上下文缓存按前缀精确匹配,改写点之后的内容会变成未命中输入,再加上每次蒸馏的费用,整体往往难以抵消。
|
|
10
|
+
>
|
|
11
|
+
> 可以说这个插件的设计目标就是 **「说完任务就什么都不管了」的「许愿式编程」** ,也就是一次说清任务、让 agent 自行跑完很长的工具调用链。在 **「根据用户反馈反复精修」** 的阶段,对话形态是多轮问答,**建议关闭插件**(关掉设置里的总开关即可)。
|
|
12
|
+
|
|
5
13
|
> 插件**默认关闭**,装好后需要在「设置 → 思考压缩」里选中一个改写后端并手动打开总开关。
|
|
6
14
|
|
|
7
15
|
> **版本与安装方式(先看这里)**
|
|
@@ -154,14 +162,14 @@ node scripts/dsh-inplace-patch.mjs --check # 打全了输出 PATCHED
|
|
|
154
162
|
| 选项 | 含义 |
|
|
155
163
|
| --- | --- |
|
|
156
164
|
| 对主对话启用(`enabled`) | 该模型在主对话里是否压缩。 |
|
|
157
|
-
| 对可续接子代理启用(`continuableSubagents`) |
|
|
165
|
+
| 对可续接子代理启用(`continuableSubagents`) | 是否也压缩可续聊子代理(如队友)。默认关;需要时再打开。 |
|
|
158
166
|
| 对一次性子代理启用(`oneShotSubagents`) | 是否压缩跑完即结束的一次性委派。默认关,因为它的最终回答之后没有任何请求会重放这次压缩。 |
|
|
159
167
|
| 最大生效深度(`continuableMaxDepth` / `oneShotMaxDepth`) | 两个子代理开关各自带一个深度上限:比该深度更深的子孙代理不再压缩,0 表示不限制。 |
|
|
160
168
|
| 触发阈值(`thresholdTokens`) | 一步思考估算超过多少 token 才触发,默认 4000。 |
|
|
161
169
|
| 按上下文占用限制触发(`contextCap` / `maxContextPercent`) | 默认开、60%。该模型的上下文占用超过这个比例时,即使单步思考达到阈值也不再压缩——否则压缩刚生效、没几轮就被宿主内置的上下文整体压缩收走,白花一次蒸馏的钱。占用比例用宿主自己的 token 计量与上下文窗口计算,和内置上下文压缩触发读的是同一个值,整段压缩后会自动变短。关闭时不看占用比例(与旧行为一致),比例输入框会变灰。 |
|
|
162
170
|
| 最低节省(`minSavedTokens`) | 压缩结果至少要比原文省这么多 token 才采用,默认 600;未达到时原文保持不变,但这次蒸馏的开销照样计入。 |
|
|
163
|
-
| 附带工具调用结果(`includeToolResults`) |
|
|
164
|
-
| 压缩最终回答轮(`includeFinalTurns`) |
|
|
171
|
+
| 附带工具调用结果(`includeToolResults`) | 交给蒸馏模型的上下文里是否附上该步工具调用的结果;工具调用本身始终附带。默认关(刚安装的默认规则与新建的逐模型规则都是关的)。 |
|
|
172
|
+
| 压缩最终回答轮(`includeFinalTurns`) | 是否压缩没有工具调用的收尾步(最终回答)。默认关(同上)。 |
|
|
165
173
|
| 超时(`timeoutMs`) | 蒸馏必须在这个时间内完成;到点就放弃这次压缩(原文不动、不记账),下一步只等这么久。0 = 不设限,一直等到出结果。 |
|
|
166
174
|
| 背景块长度上限(`maxInputChars`) | 交给蒸馏模型的单个上下文块(例如一条工具结果)的字符上限,0 = 不限。 |
|
|
167
175
|
| 蒸馏结果长度上限(`maxOutputChars`) | 实际采用并重放的压缩结果字符上限,0 = 不限。 |
|
package/lib/client/index.js
CHANGED
|
@@ -341,7 +341,7 @@ window.__ModuleLoader__.load({
|
|
|
341
341
|
"settings.maxDepth": "最大生效深度",
|
|
342
342
|
"settings.maxDepthHint": "两个子代理开关各自带一个深度上限:超过该深度的子孙代理不再压缩(填 0 = 不限制)。深度由宿主持久化在会话 header 上,重启后续接仍按同一深度判定。",
|
|
343
343
|
"settings.subagentsLocked": "当前后端(另开分支会话)无法承接委派:交接会打断子代理的委派关系,因此这两条子代理开关已被关闭并锁定。换成不做分支的后端即可重新开启。",
|
|
344
|
-
"settings.kindsHint": "三种会话各自独立开关;宿主用 header.origin 与 subagent/descriptor 的 mode
|
|
344
|
+
"settings.kindsHint": "三种会话各自独立开关;宿主用 header.origin 与 subagent/descriptor 的 mode 区分它们。可续接子代理(如队友)会持续重发思考,需要时再打开,默认关;一次性委派跑完即返回,最终回答的压缩没有任何请求会重放它,默认也关。",
|
|
345
345
|
"settings.ruleIdle": "三种会话都未启用时,该规则的其他设置不会生效(届时会锁定)。",
|
|
346
346
|
"settings.master": "启用思考压缩",
|
|
347
347
|
"settings.default": "默认规则",
|
|
@@ -560,7 +560,7 @@ window.__ModuleLoader__.load({
|
|
|
560
560
|
"settings.maxDepth": "Max depth",
|
|
561
561
|
"settings.maxDepthHint": "Each subagent switch carries its own depth cap: children nested deeper than this are left alone (0 = no limit). The depth is persisted on the session header, so a resumed child is judged at the same depth.",
|
|
562
562
|
"settings.subagentsLocked": "The selected backend forks the conversation to apply a rewrite, which a delegation cannot follow: a hand-off inside a subagent would end its turn without an answer, so both subagent switches are pinned off. Select a backend that does not branch to enable them again.",
|
|
563
|
-
"settings.kindsHint": "The three session kinds have independent switches; the host separates them by header.origin and the subagent/descriptor mode. Continuable children (teammates) keep replaying their reasoning, so
|
|
563
|
+
"settings.kindsHint": "The three session kinds have independent switches; the host separates them by header.origin and the subagent/descriptor mode. Continuable children (teammates) keep replaying their reasoning, so turn them on when needed (off by default); a terminal one-shot delegation is never resumed, so its final answer pays for a distillation nothing replays, and it is off by default.",
|
|
564
564
|
"settings.ruleIdle": "With all three session kinds off, the rest of this rule cannot take effect and is locked.",
|
|
565
565
|
"settings.default": "Default rule",
|
|
566
566
|
"settings.models": "Per-model rules",
|
|
@@ -759,7 +759,7 @@ window.__ModuleLoader__.load({
|
|
|
759
759
|
*/
|
|
760
760
|
const FALLBACK_RULE = {
|
|
761
761
|
enabled: true,
|
|
762
|
-
continuableSubagents:
|
|
762
|
+
continuableSubagents: false,
|
|
763
763
|
continuableMaxDepth: 0,
|
|
764
764
|
oneShotSubagents: false,
|
|
765
765
|
oneShotMaxDepth: 0,
|
|
@@ -767,8 +767,8 @@ window.__ModuleLoader__.load({
|
|
|
767
767
|
contextCap: true,
|
|
768
768
|
maxContextPercent: 60,
|
|
769
769
|
minSavedTokens: 600,
|
|
770
|
-
includeToolResults:
|
|
771
|
-
includeFinalTurns:
|
|
770
|
+
includeToolResults: false,
|
|
771
|
+
includeFinalTurns: false,
|
|
772
772
|
timeoutMs: 0,
|
|
773
773
|
maxInputChars: 0,
|
|
774
774
|
maxOutputChars: 0,
|
|
@@ -806,6 +806,22 @@ window.__ModuleLoader__.load({
|
|
|
806
806
|
//#endregion
|
|
807
807
|
//#region src/client/ops.ts
|
|
808
808
|
/**
|
|
809
|
+
* Initial stored layer for a model the user just added.
|
|
810
|
+
*
|
|
811
|
+
* The entry starts inert: no session kind is enabled, and the optional extras —
|
|
812
|
+
* subagent distillation, attaching tool-call results, and compressing final
|
|
813
|
+
* answers — are stated off rather than inherited, so adding a model can never
|
|
814
|
+
* start paying for work the user did not ask for. Every field stays editable and
|
|
815
|
+
* the remaining fields still inherit from the default rule.
|
|
816
|
+
*/
|
|
817
|
+
const NEW_MODEL_RULE = {
|
|
818
|
+
enabled: false,
|
|
819
|
+
continuableSubagents: false,
|
|
820
|
+
oneShotSubagents: false,
|
|
821
|
+
includeToolResults: false,
|
|
822
|
+
includeFinalTurns: false
|
|
823
|
+
};
|
|
824
|
+
/**
|
|
809
825
|
* Whether a rule decides nothing because all three session kinds are off, in
|
|
810
826
|
* which case the rest of its fields are locked in the panel.
|
|
811
827
|
* @param rule - the rule being edited.
|
|
@@ -1343,49 +1359,49 @@ window.__ModuleLoader__.load({
|
|
|
1343
1359
|
document.head.appendChild(tag);
|
|
1344
1360
|
}
|
|
1345
1361
|
var Settings_module_css_default = {
|
|
1346
|
-
"secondary": "jP3NOa_secondary",
|
|
1347
|
-
"backendOptions": "jP3NOa_backendOptions",
|
|
1348
|
-
"installProgress": "jP3NOa_installProgress",
|
|
1349
|
-
"itemBody": "jP3NOa_itemBody",
|
|
1350
|
-
"preview": "jP3NOa_preview",
|
|
1351
|
-
"modalHead": "jP3NOa_modalHead",
|
|
1352
|
-
"installBlock": "jP3NOa_installBlock",
|
|
1353
|
-
"priceGrid": "jP3NOa_priceGrid",
|
|
1354
|
-
"muted": "jP3NOa_muted",
|
|
1355
|
-
"error": "jP3NOa_error",
|
|
1356
|
-
"modal": "jP3NOa_modal",
|
|
1357
|
-
"modalBody": "jP3NOa_modalBody",
|
|
1358
|
-
"steps": "jP3NOa_steps",
|
|
1359
1362
|
"logBox": "jP3NOa_logBox",
|
|
1360
|
-
"
|
|
1363
|
+
"modalHead": "jP3NOa_modalHead",
|
|
1364
|
+
"holidayBox": "jP3NOa_holidayBox",
|
|
1361
1365
|
"pickerItem": "jP3NOa_pickerItem",
|
|
1362
|
-
"
|
|
1363
|
-
"pickerPanel": "jP3NOa_pickerPanel",
|
|
1366
|
+
"section": "jP3NOa_section",
|
|
1364
1367
|
"iconButton": "jP3NOa_iconButton",
|
|
1365
|
-
"
|
|
1366
|
-
"
|
|
1368
|
+
"peakBox": "jP3NOa_peakBox",
|
|
1369
|
+
"picker": "jP3NOa_picker",
|
|
1370
|
+
"muted": "jP3NOa_muted",
|
|
1371
|
+
"modalBackdrop": "jP3NOa_modalBackdrop",
|
|
1367
1372
|
"checks": "jP3NOa_checks",
|
|
1373
|
+
"installProgress": "jP3NOa_installProgress",
|
|
1374
|
+
"itemBody": "jP3NOa_itemBody",
|
|
1375
|
+
"search": "jP3NOa_search",
|
|
1376
|
+
"error": "jP3NOa_error",
|
|
1368
1377
|
"capBox": "jP3NOa_capBox",
|
|
1369
|
-
"field": "jP3NOa_field",
|
|
1370
1378
|
"item": "jP3NOa_item",
|
|
1371
1379
|
"primary": "jP3NOa_primary",
|
|
1372
|
-
"
|
|
1373
|
-
"
|
|
1380
|
+
"secondary": "jP3NOa_secondary",
|
|
1381
|
+
"header": "jP3NOa_header",
|
|
1382
|
+
"installBlock": "jP3NOa_installBlock",
|
|
1374
1383
|
"toggle": "jP3NOa_toggle",
|
|
1375
|
-
"sectionHeading": "jP3NOa_sectionHeading",
|
|
1376
|
-
"modalBackdrop": "jP3NOa_modalBackdrop",
|
|
1377
1384
|
"modeCard": "jP3NOa_modeCard",
|
|
1378
|
-
"
|
|
1385
|
+
"log": "jP3NOa_log",
|
|
1386
|
+
"installEntry": "jP3NOa_installEntry",
|
|
1387
|
+
"actions": "jP3NOa_actions",
|
|
1388
|
+
"pickerPanel": "jP3NOa_pickerPanel",
|
|
1379
1389
|
"badge": "jP3NOa_badge",
|
|
1380
|
-
"
|
|
1390
|
+
"sectionHeading": "jP3NOa_sectionHeading",
|
|
1391
|
+
"priceGrid": "jP3NOa_priceGrid",
|
|
1392
|
+
"field": "jP3NOa_field",
|
|
1393
|
+
"preview": "jP3NOa_preview",
|
|
1394
|
+
"backendOptions": "jP3NOa_backendOptions",
|
|
1395
|
+
"rule": "jP3NOa_rule",
|
|
1396
|
+
"modal": "jP3NOa_modal",
|
|
1381
1397
|
"pickerList": "jP3NOa_pickerList",
|
|
1382
|
-
"
|
|
1383
|
-
"
|
|
1384
|
-
"
|
|
1398
|
+
"modalBody": "jP3NOa_modalBody",
|
|
1399
|
+
"steps": "jP3NOa_steps",
|
|
1400
|
+
"note": "jP3NOa_note",
|
|
1385
1401
|
"modeCards": "jP3NOa_modeCards",
|
|
1402
|
+
"prompt": "jP3NOa_prompt",
|
|
1386
1403
|
"route": "jP3NOa_route",
|
|
1387
|
-
"
|
|
1388
|
-
"note": "jP3NOa_note"
|
|
1404
|
+
"page": "jP3NOa_page"
|
|
1389
1405
|
};
|
|
1390
1406
|
//#endregion
|
|
1391
1407
|
//#region src/client/InstallBackend.tsx
|
|
@@ -2559,11 +2575,7 @@ window.__ModuleLoader__.load({
|
|
|
2559
2575
|
...current,
|
|
2560
2576
|
models: {
|
|
2561
2577
|
...current.models,
|
|
2562
|
-
[model.id]: {
|
|
2563
|
-
enabled: false,
|
|
2564
|
-
continuableSubagents: false,
|
|
2565
|
-
oneShotSubagents: false
|
|
2566
|
-
}
|
|
2578
|
+
[model.id]: { ...NEW_MODEL_RULE }
|
|
2567
2579
|
}
|
|
2568
2580
|
}))
|
|
2569
2581
|
}),
|
|
@@ -2822,41 +2834,41 @@ window.__ModuleLoader__.load({
|
|
|
2822
2834
|
document.head.appendChild(tag);
|
|
2823
2835
|
}
|
|
2824
2836
|
var View_module_css_default = {
|
|
2837
|
+
"facts": "_7CZWHG_facts",
|
|
2838
|
+
"popupHead": "_7CZWHG_popupHead",
|
|
2839
|
+
"header": "_7CZWHG_header",
|
|
2825
2840
|
"entry": "_7CZWHG_entry",
|
|
2841
|
+
"actions": "_7CZWHG_actions",
|
|
2842
|
+
"blockedBanner": "_7CZWHG_blockedBanner",
|
|
2843
|
+
"popupFacts": "_7CZWHG_popupFacts",
|
|
2826
2844
|
"metric": "_7CZWHG_metric",
|
|
2845
|
+
"iconButton": "_7CZWHG_iconButton",
|
|
2846
|
+
"activityDotBlocked": "_7CZWHG_activityDotBlocked",
|
|
2847
|
+
"secondary": "_7CZWHG_secondary",
|
|
2848
|
+
"note": "_7CZWHG_note",
|
|
2849
|
+
"popupList": "_7CZWHG_popupList",
|
|
2850
|
+
"summary": "_7CZWHG_summary",
|
|
2827
2851
|
"activityDot": "_7CZWHG_activityDot",
|
|
2828
|
-
"
|
|
2829
|
-
"activeRow": "_7CZWHG_activeRow",
|
|
2852
|
+
"sessionInfo": "_7CZWHG_sessionInfo",
|
|
2830
2853
|
"activityLabel": "_7CZWHG_activityLabel",
|
|
2831
|
-
"
|
|
2854
|
+
"activityWhy": "_7CZWHG_activityWhy",
|
|
2832
2855
|
"error": "_7CZWHG_error",
|
|
2833
|
-
"
|
|
2856
|
+
"positive": "_7CZWHG_positive",
|
|
2834
2857
|
"section": "_7CZWHG_section",
|
|
2835
|
-
"negative": "_7CZWHG_negative",
|
|
2836
|
-
"popupList": "_7CZWHG_popupList",
|
|
2837
|
-
"sessionInfo": "_7CZWHG_sessionInfo",
|
|
2838
2858
|
"rdPulse": "_7CZWHG_rdPulse",
|
|
2839
|
-
"
|
|
2840
|
-
"
|
|
2841
|
-
"
|
|
2859
|
+
"entryBody": "_7CZWHG_entryBody",
|
|
2860
|
+
"muted": "_7CZWHG_muted",
|
|
2861
|
+
"page": "_7CZWHG_page",
|
|
2842
2862
|
"sessionRow": "_7CZWHG_sessionRow",
|
|
2843
|
-
"
|
|
2863
|
+
"negative": "_7CZWHG_negative",
|
|
2844
2864
|
"headerTrigger": "_7CZWHG_headerTrigger",
|
|
2845
|
-
"popupFacts": "_7CZWHG_popupFacts",
|
|
2846
|
-
"iconButton": "_7CZWHG_iconButton",
|
|
2847
|
-
"muted": "_7CZWHG_muted",
|
|
2848
|
-
"activity": "_7CZWHG_activity",
|
|
2849
|
-
"secondary": "_7CZWHG_secondary",
|
|
2850
|
-
"popupHead": "_7CZWHG_popupHead",
|
|
2851
|
-
"note": "_7CZWHG_note",
|
|
2852
|
-
"actions": "_7CZWHG_actions",
|
|
2853
|
-
"blockedBanner": "_7CZWHG_blockedBanner",
|
|
2854
|
-
"entryTitle": "_7CZWHG_entryTitle",
|
|
2855
|
-
"header": "_7CZWHG_header",
|
|
2856
|
-
"textBlock": "_7CZWHG_textBlock",
|
|
2857
2865
|
"popup": "_7CZWHG_popup",
|
|
2858
|
-
"
|
|
2859
|
-
"
|
|
2866
|
+
"popupRow": "_7CZWHG_popupRow",
|
|
2867
|
+
"popupActions": "_7CZWHG_popupActions",
|
|
2868
|
+
"textBlock": "_7CZWHG_textBlock",
|
|
2869
|
+
"entryTitle": "_7CZWHG_entryTitle",
|
|
2870
|
+
"activity": "_7CZWHG_activity",
|
|
2871
|
+
"activeRow": "_7CZWHG_activeRow"
|
|
2860
2872
|
};
|
|
2861
2873
|
//#endregion
|
|
2862
2874
|
//#region src/client/ActivityChip.tsx
|