dsh-reasoning-distill 0.1.6 → 0.1.7

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 CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  本插件的版本变更记录。
4
4
 
5
+ ## 0.1.7
6
+
7
+ - **调整内置蒸馏提示词**:明确要求保留原思考中正确且有效的推理过程,而不是直接跳到结论。可以压缩措辞、合并重复、删除噪音,但不能省略有效的推导步骤;只保留结论的短版本视为错误。自我纠正时保留纠正后的整条推理线(结论、证据与有效步骤),只丢弃被放弃的尝试。
8
+
5
9
  ## 0.1.6
6
10
 
7
11
  - **新增:按上下文占用限制触发**。默认规则和逐模型规则各多一个开关 + 「最高生效时上下文占用(%)」(默认开、60%)。上下文占用超过该比例时,即使单步思考达到阈值也不再压缩——否则压缩刚生效、没几轮就被宿主内置的整体压缩收走,白花一次蒸馏的钱。占用值直接读宿主 token-meter 的度量与模型上下文窗口,与内置上下文压缩触发读的是同一个值,整体压缩后会同步变短;宿主读不到该值时功能不生效(不拦)。关闭开关时与旧行为一致,输入框变灰。
package/README.md CHANGED
@@ -15,7 +15,7 @@
15
15
  ## 一、它做什么
16
16
 
17
17
  - 监视每次模型输出里的思考内容(reasoning),并估算其 token 数。
18
- - 某一步的思考超过该模型的**触发阈值**(默认 4000 token)时,把这一步的思考(可选附上工具调用与结果)交给**蒸馏模型**(默认 `deepseek-official/deepseek-flash`,思考强度 off)改写成更短的版本。
18
+ - 某一步的思考超过该模型的**触发阈值**(默认 4000 token)时,把这一步的思考(可选附上工具调用与结果)交给**蒸馏模型**(默认 `deepseek-official/deepseek-flash`,思考强度 off)改写成更短的版本。压缩的是措辞和冗余,**不是推导过程**:有效、正确的思考步骤必须保留,不能直接跳到结论。
19
19
  - 压缩发生在下一步请求之前,下一步会等它。等待上限由该模型的**超时**决定:到点就放弃这一次压缩(原始思考不动、不记账);填 0 表示不设限、一直等到出结果。
20
20
  - 只有压缩结果至少能省下**最低节省**(默认 600 token)时才真正采用,否则只花钱、不替换。
21
21
  - 被采用的压缩版会替换"模型看到的思考内容",因此之后每个请求都少带这些 token;会话日志里的思考原文保持不动,本插件的账本存放在会话日志旁边的 sidecar 文件里。
@@ -186,7 +186,7 @@ node scripts/dsh-inplace-patch.mjs --check # 打全了输出 PATCHED
186
186
 
187
187
  | 选项 | 含义 |
188
188
  | --- | --- |
189
- | 蒸馏提示词(`prompt`) | 替换内置的压缩指令;留空 = 使用内置提示词(可点"预览内置提示词"查看)。 |
189
+ | 蒸馏提示词(`prompt`) | 替换内置的压缩指令;留空 = 使用内置提示词(可点"预览内置提示词"查看)。内置提示词明确要求保留原思考中正确且有效的推理过程:可以压缩措辞、合并重复,但不能省掉推导步骤直接给结论,重放后的思考要能沿着同一条路径推出同样的结论。 |
190
190
 
191
191
  ### 模型价格与峰谷时段
192
192
 
@@ -1343,49 +1343,49 @@ window.__ModuleLoader__.load({
1343
1343
  document.head.appendChild(tag);
1344
1344
  }
1345
1345
  var Settings_module_css_default = {
1346
- "capBox": "jP3NOa_capBox",
1347
1346
  "secondary": "jP3NOa_secondary",
1348
- "checks": "jP3NOa_checks",
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",
1349
1354
  "muted": "jP3NOa_muted",
1350
1355
  "error": "jP3NOa_error",
1351
- "rule": "jP3NOa_rule",
1352
- "search": "jP3NOa_search",
1353
1356
  "modal": "jP3NOa_modal",
1354
- "priceGrid": "jP3NOa_priceGrid",
1355
- "holidayBox": "jP3NOa_holidayBox",
1356
- "route": "jP3NOa_route",
1357
- "picker": "jP3NOa_picker",
1357
+ "modalBody": "jP3NOa_modalBody",
1358
1358
  "steps": "jP3NOa_steps",
1359
- "section": "jP3NOa_section",
1359
+ "logBox": "jP3NOa_logBox",
1360
+ "search": "jP3NOa_search",
1361
+ "pickerItem": "jP3NOa_pickerItem",
1360
1362
  "log": "jP3NOa_log",
1361
- "note": "jP3NOa_note",
1362
- "toggle": "jP3NOa_toggle",
1363
- "installEntry": "jP3NOa_installEntry",
1364
- "modeCard": "jP3NOa_modeCard",
1365
- "field": "jP3NOa_field",
1366
1363
  "pickerPanel": "jP3NOa_pickerPanel",
1367
- "backendOptions": "jP3NOa_backendOptions",
1368
- "modeCards": "jP3NOa_modeCards",
1369
- "modalHead": "jP3NOa_modalHead",
1370
- "pickerItem": "jP3NOa_pickerItem",
1371
- "installProgress": "jP3NOa_installProgress",
1372
- "itemBody": "jP3NOa_itemBody",
1364
+ "iconButton": "jP3NOa_iconButton",
1365
+ "rule": "jP3NOa_rule",
1366
+ "holidayBox": "jP3NOa_holidayBox",
1367
+ "checks": "jP3NOa_checks",
1368
+ "capBox": "jP3NOa_capBox",
1369
+ "field": "jP3NOa_field",
1370
+ "item": "jP3NOa_item",
1373
1371
  "primary": "jP3NOa_primary",
1372
+ "installEntry": "jP3NOa_installEntry",
1374
1373
  "prompt": "jP3NOa_prompt",
1375
- "header": "jP3NOa_header",
1376
- "iconButton": "jP3NOa_iconButton",
1377
- "peakBox": "jP3NOa_peakBox",
1374
+ "toggle": "jP3NOa_toggle",
1378
1375
  "sectionHeading": "jP3NOa_sectionHeading",
1379
- "modalBody": "jP3NOa_modalBody",
1380
- "logBox": "jP3NOa_logBox",
1376
+ "modalBackdrop": "jP3NOa_modalBackdrop",
1377
+ "modeCard": "jP3NOa_modeCard",
1378
+ "picker": "jP3NOa_picker",
1381
1379
  "badge": "jP3NOa_badge",
1382
- "pickerList": "jP3NOa_pickerList",
1383
1380
  "page": "jP3NOa_page",
1384
- "item": "jP3NOa_item",
1381
+ "pickerList": "jP3NOa_pickerList",
1382
+ "header": "jP3NOa_header",
1385
1383
  "actions": "jP3NOa_actions",
1386
- "modalBackdrop": "jP3NOa_modalBackdrop",
1387
- "installBlock": "jP3NOa_installBlock",
1388
- "preview": "jP3NOa_preview"
1384
+ "peakBox": "jP3NOa_peakBox",
1385
+ "modeCards": "jP3NOa_modeCards",
1386
+ "route": "jP3NOa_route",
1387
+ "section": "jP3NOa_section",
1388
+ "note": "jP3NOa_note"
1389
1389
  };
1390
1390
  //#endregion
1391
1391
  //#region src/client/InstallBackend.tsx
@@ -2822,41 +2822,41 @@ window.__ModuleLoader__.load({
2822
2822
  document.head.appendChild(tag);
2823
2823
  }
2824
2824
  var View_module_css_default = {
2825
- "popupHead": "_7CZWHG_popupHead",
2826
- "secondary": "_7CZWHG_secondary",
2827
- "headerTrigger": "_7CZWHG_headerTrigger",
2828
- "popupFacts": "_7CZWHG_popupFacts",
2829
- "actions": "_7CZWHG_actions",
2830
- "negative": "_7CZWHG_negative",
2831
- "rdPulse": "_7CZWHG_rdPulse",
2832
- "facts": "_7CZWHG_facts",
2833
- "header": "_7CZWHG_header",
2834
- "activityDotBlocked": "_7CZWHG_activityDotBlocked",
2835
- "page": "_7CZWHG_page",
2836
- "muted": "_7CZWHG_muted",
2837
2825
  "entry": "_7CZWHG_entry",
2838
2826
  "metric": "_7CZWHG_metric",
2839
- "popup": "_7CZWHG_popup",
2840
- "activityLabel": "_7CZWHG_activityLabel",
2841
- "sessionInfo": "_7CZWHG_sessionInfo",
2842
- "activeRow": "_7CZWHG_activeRow",
2843
2827
  "activityDot": "_7CZWHG_activityDot",
2844
- "summary": "_7CZWHG_summary",
2845
- "popupRow": "_7CZWHG_popupRow",
2846
2828
  "popupActions": "_7CZWHG_popupActions",
2847
- "activityWhy": "_7CZWHG_activityWhy",
2848
- "entryTitle": "_7CZWHG_entryTitle",
2849
- "textBlock": "_7CZWHG_textBlock",
2850
- "note": "_7CZWHG_note",
2851
- "section": "_7CZWHG_section",
2852
- "popupList": "_7CZWHG_popupList",
2829
+ "activeRow": "_7CZWHG_activeRow",
2830
+ "activityLabel": "_7CZWHG_activityLabel",
2831
+ "facts": "_7CZWHG_facts",
2853
2832
  "error": "_7CZWHG_error",
2854
- "activity": "_7CZWHG_activity",
2855
- "blockedBanner": "_7CZWHG_blockedBanner",
2856
2833
  "entryBody": "_7CZWHG_entryBody",
2834
+ "section": "_7CZWHG_section",
2835
+ "negative": "_7CZWHG_negative",
2836
+ "popupList": "_7CZWHG_popupList",
2837
+ "sessionInfo": "_7CZWHG_sessionInfo",
2838
+ "rdPulse": "_7CZWHG_rdPulse",
2839
+ "activityWhy": "_7CZWHG_activityWhy",
2840
+ "popupRow": "_7CZWHG_popupRow",
2857
2841
  "positive": "_7CZWHG_positive",
2842
+ "sessionRow": "_7CZWHG_sessionRow",
2843
+ "summary": "_7CZWHG_summary",
2844
+ "headerTrigger": "_7CZWHG_headerTrigger",
2845
+ "popupFacts": "_7CZWHG_popupFacts",
2858
2846
  "iconButton": "_7CZWHG_iconButton",
2859
- "sessionRow": "_7CZWHG_sessionRow"
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
+ "popup": "_7CZWHG_popup",
2858
+ "activityDotBlocked": "_7CZWHG_activityDotBlocked",
2859
+ "page": "_7CZWHG_page"
2860
2860
  };
2861
2861
  //#endregion
2862
2862
  //#region src/client/ActivityChip.tsx
package/lib/index.js CHANGED
@@ -1160,9 +1160,11 @@ Context is reference material, never content. Do not copy, quote, paraphrase, su
1160
1160
 
1161
1161
  Rewrite it so that:
1162
1162
 
1163
- 1. PRESERVE everything load-bearing that the original does not itself supersede: observed facts, concrete values, file paths and identifiers, constraints discovered, decisions, plans, and stated reasons for choosing an action. Preserve their original status: considered, chosen, pending, attempted, or completed. Do not turn intentions into actions or actions into successful outcomes.
1164
- 2. DELETE noise: filler and verbal tics ("hmm", "let me", "wait", "actually", "okay so", repeated "I should...") when they carry no meaning, restatements of the same point, and abandoned exploratory steps. Preserve uncertainty, conditions, negation, and the distinctions between observation, inference and intention. Keep load-bearing constraints and rejection reasons, including those established by failed approaches.
1165
- 3. Determine corrections, contradictions and abandonment from the original alone, not from context or outside knowledge. When the original corrected itself, keep only the corrected conclusion and its stated supporting evidence, plus any load-bearing constraints or rejection reasons. Drop the discarded attempt and do not narrate that it was dropped. Do not resolve uncertainty or contradictions the original left unresolved.
1163
+ KEEP THE REASONING, NOT JUST THE RESULT. The compressed thought must still read as the same reasoning being worked through: what was observed, what was considered and ruled out, what was checked or verified, and why the chosen step follows. A reader must be able to follow the compressed path and reach the same conclusion the original reached. You may compress wording, merge repetition, and delete noise, but you must not omit valid reasoning steps: never replace a chain of reasoning with its bare conclusion, never jump straight from the situation to the outcome, and never substitute a summary verdict for the intermediate work. Compress, but do not omit.
1164
+
1165
+ 1. PRESERVE everything load-bearing that the original does not itself supersede: observed facts, concrete values, file paths and identifiers, constraints discovered, decisions, plans, the reasoning that connects them in order, and stated reasons for choosing an action. Preserve their original status: considered, chosen, pending, attempted, or completed. Do not turn intentions into actions or actions into successful outcomes.
1166
+ 2. DELETE noise, not reasoning: filler and verbal tics ("hmm", "let me", "wait", "actually", "okay so", repeated "I should...") when they carry no meaning, restatements of the same point, and abandoned exploratory steps. Preserve the valid reasoning steps themselves, along with uncertainty, conditions, negation, and the distinctions between observation, inference and intention. Keep load-bearing constraints and rejection reasons, including those established by failed approaches.
1167
+ 3. Determine corrections, contradictions and abandonment from the original alone, not from context or outside knowledge. When the original corrected itself, keep the corrected line of reasoning: the corrected conclusion, the evidence supporting it, and the valid steps that led to it, plus any load-bearing constraints or rejection reasons. Drop only the discarded attempt and do not narrate that it was dropped. Do not resolve uncertainty or contradictions the original left unresolved.
1166
1168
  4. NEVER add facts, tool outputs, paths, numbers, or plans that are not present in the original. You are an editor, not a participant: do not solve the problem, do not add your own analysis, do not answer the user.
1167
1169
  5. The result is private reasoning and nothing else. Keep the original assistant's perspective; do not describe the assistant or the editing process from outside. Exclude reproduced tool calls, tool-result or command-output blocks, file-content excerpts, and visible-reply text, even if embedded in the original. Keep facts and conclusions already expressed as reasoning in the original, and never import them from context.
1168
1170
  6. Keep each retained passage in its original language. Keep retained identifiers, paths, command strings and error strings verbatim; this does not require keeping discarded or excluded material.
@@ -1170,7 +1172,7 @@ Rewrite it so that:
1170
1172
 
1171
1173
  Treat prose, bullets, fragments and structured notes as eligible reasoning, and apply the same exclusions to all of them. If nothing eligible remains, return no text.
1172
1174
 
1173
- Shorten without losing load-bearing meaning; do not expand the original. If it is already dense, leave eligible reasoning nearly unchanged, subject to every rule above.
1175
+ Shorten without losing load-bearing meaning or the reasoning path that carries it; do not expand the original. If it is already dense, leave eligible reasoning nearly unchanged, subject to every rule above. A rewrite that is shorter but only states the conclusions is wrong: the same reasoning must still be followable.
1174
1176
 
1175
1177
  Do not answer the original user, restate their task, or produce a final-answer/assistant-reply format (including headings such as "Final answer", "回复用户", or "最终答案"). Output ONLY the distilled private reasoning body. Nothing else.`;
1176
1178
  /** The untrusted source is enclosed and followed by the operative task, even when extremely long. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-reasoning-distill",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "description": "Distill over-long model reasoning into its useful core and replay the distilled version on every later request, with a per-session cost report.",
6
6
  "license": "MIT",