dsh-cot-anchor 0.3.0 → 0.3.1

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/lib/client.js CHANGED
@@ -584,6 +584,11 @@ window.__ModuleLoader__.load({
584
584
  'div',
585
585
  { style: { flex: 1, minWidth: 0 } },
586
586
  h('div', { style: { color: THEME.text, fontSize: 13 } }, entry.label),
587
+ h(
588
+ 'div',
589
+ { style: { color: THEME.textTertiary, fontSize: 10, marginTop: 1, fontFamily: 'monospace' } },
590
+ '源码键:' + entry.key
591
+ ),
587
592
  entry.hint
588
593
  ? h('div', { style: { color: THEME.textTertiary, fontSize: 12, marginTop: 2, lineHeight: 1.5 } }, entry.hint)
589
594
  : null,
@@ -614,6 +619,12 @@ window.__ModuleLoader__.load({
614
619
  : null,
615
620
 
616
621
  groups.map(function (group) {
622
+ var normal = []
623
+ var advanced = []
624
+ group.entries.forEach(function (e) {
625
+ if (e.advanced === true) advanced.push(e)
626
+ else normal.push(e)
627
+ })
617
628
  return h(
618
629
  'div',
619
630
  { key: group.name, style: { marginBottom: 18 } },
@@ -632,7 +643,30 @@ window.__ModuleLoader__.load({
632
643
  padding: '0 12px'
633
644
  }
634
645
  },
635
- group.entries.map(renderRow)
646
+ normal.map(renderRow),
647
+ advanced.length
648
+ ? h(
649
+ 'details',
650
+ { key: group.name + '-adv', style: { padding: '6px 0' } },
651
+ h(
652
+ 'summary',
653
+ {
654
+ style: {
655
+ fontSize: 12,
656
+ color: THEME.textSecondary,
657
+ cursor: 'pointer',
658
+ userSelect: 'none'
659
+ }
660
+ },
661
+ '高级参数(' + advanced.length + ' 项)'
662
+ ),
663
+ h(
664
+ 'div',
665
+ { style: { borderTop: '1px solid ' + THEME.border, marginTop: 4 } },
666
+ advanced.map(renderRow)
667
+ )
668
+ )
669
+ : null
636
670
  )
637
671
  )
638
672
  }),
package/lib/index.js CHANGED
@@ -2764,9 +2764,9 @@ const SETTINGS_SCHEMA = [
2764
2764
  hint: "思考短于此长度时不提取结论、不注入。" },
2765
2765
  { key: "maxPoints", label: "锚点最多结论条数", type: "number", min: 1, max: 8, group: "锚点内容" },
2766
2766
  { key: "maxPointChars", label: "单条结论最大字数", type: "number", min: 40, max: 1000, group: "锚点内容" },
2767
- { key: "enableLengthConservationCheck", label: "长度守恒校验", type: "boolean", group: "锚点内容",
2767
+ { key: "enableLengthConservationCheck", advanced: true, label: "长度守恒校验", type: "boolean", group: "锚点内容",
2768
2768
  hint: "注入前先核对锚点正文和每条结论逐字一致,防止摘要被截断或丢字;对不上就放弃这次注入。" },
2769
- { key: "transitionTextMode", label: "思考与正文如何分开(内核支持后生效)", type: "select", group: "锚点内容",
2769
+ { key: "transitionTextMode", advanced: true, label: "思考与正文如何分开(内核支持后生效)", type: "select", group: "锚点内容",
2770
2770
  options: [
2771
2771
  { value: "separateThreshold", label: "按字数阈值自动分开(默认)" },
2772
2772
  { value: "disable", label: "不分开,整段当作正文处理" }
@@ -2774,77 +2774,77 @@ const SETTINGS_SCHEMA = [
2774
2774
  hint: "决定怎么把模型的「思考」和「正文」区分开来。内核还没支持这一项,选什么都不会改变行为,先按默认放着即可。" },
2775
2775
  { key: "enableExecDisciplineBlock", label: "随锚点注入命令执行纪律块", type: "boolean", group: "锚点内容",
2776
2776
  hint: "默认开启。开启时会把「执行命令要守规矩」这段提醒和结论摘要一起插回上下文;关闭就完全不插这段提醒,结论摘要和其他识别、去重功能都不受影响。" },
2777
- { key: "numberRunMinTextChars", label: "数字流启用最小文本长度", type: "number", min: 100, max: 50000, group: "数字流参数" },
2778
- { key: "numberRunMinChars", label: "数字流最短跨度", type: "number", min: 50, max: 20000, group: "数字流参数" },
2779
- { key: "numberRunMaxGap", label: "数字流最大间隙", type: "number", min: 1, max: 200, group: "数字流参数",
2777
+ { key: "numberRunMinTextChars", advanced: true, label: "数字流启用最小文本长度", type: "number", min: 100, max: 50000, group: "数字流参数" },
2778
+ { key: "numberRunMinChars", advanced: true, label: "数字流最短跨度", type: "number", min: 50, max: 20000, group: "数字流参数" },
2779
+ { key: "numberRunMaxGap", advanced: true, label: "数字流最大间隙", type: "number", min: 1, max: 200, group: "数字流参数",
2780
2780
  hint: "相邻数字 token 之间允许的最大字符间隔。" },
2781
- { key: "numberRunMinDigitRatio", label: "数字流最小数字占比", type: "number", min: 0, max: 1, group: "数字流参数" },
2782
- { key: "numberRunMinIncreaseRatio", label: "数字流最小递增占比", type: "number", min: 0, max: 1, group: "数字流参数" },
2781
+ { key: "numberRunMinDigitRatio", advanced: true, label: "数字流最小数字占比", type: "number", min: 0, max: 1, group: "数字流参数" },
2782
+ { key: "numberRunMinIncreaseRatio", advanced: true, label: "数字流最小递增占比", type: "number", min: 0, max: 1, group: "数字流参数" },
2783
2783
 
2784
- { key: "repeatMinCount", label: "长块重复次数阈值", type: "number", min: 2, max: 10, group: "重复循环参数",
2784
+ { key: "repeatMinCount", advanced: true, label: "长块重复次数阈值", type: "number", min: 2, max: 10, group: "重复循环参数",
2785
2785
  hint: "长内容(超过下方\"短周期分界\")重复达到此次数即判定打转。" },
2786
- { key: "repeatMinCountShort", label: "短周期重复次数阈值", type: "number", min: 2, max: 30, group: "重复循环参数",
2786
+ { key: "repeatMinCountShort", advanced: true, label: "短周期重复次数阈值", type: "number", min: 2, max: 30, group: "重复循环参数",
2787
2787
  hint: "短内容循环需重复更多次才判定打转;调低则更激进。" },
2788
- { key: "repeatUltraShortMinCount", label: "超短周期重复次数阈值", type: "number", min: 5, max: 200, group: "重复循环参数",
2788
+ { key: "repeatUltraShortMinCount", advanced: true, label: "超短周期重复次数阈值", type: "number", min: 5, max: 200, group: "重复循环参数",
2789
2789
  hint: "周期 2~11 字的极小循环(如 `er4er4…` token 卡死)须重复到这么多次才判定;正常强调/分隔线(====、-----)不构成威胁。" },
2790
- { key: "repeatMinPeriod", label: "最小周期字数", type: "number", min: 4, max: 500, group: "重复循环参数" },
2791
- { key: "repeatShortPeriod", label: "短周期分界字数", type: "number", min: 16, max: 2000, group: "重复循环参数" },
2792
- { key: "repeatMaxPeriod", label: "最大周期字数", type: "number", min: 500, max: 50000, group: "重复循环参数" },
2793
- { key: "repeatWindowChars", label: "重复检查窗口", type: "number", min: 1000, max: 60000, group: "重复循环参数",
2790
+ { key: "repeatMinPeriod", advanced: true, label: "最小周期字数", type: "number", min: 4, max: 500, group: "重复循环参数" },
2791
+ { key: "repeatShortPeriod", advanced: true, label: "短周期分界字数", type: "number", min: 16, max: 2000, group: "重复循环参数" },
2792
+ { key: "repeatMaxPeriod", advanced: true, label: "最大周期字数", type: "number", min: 500, max: 50000, group: "重复循环参数" },
2793
+ { key: "repeatWindowChars", advanced: true, label: "重复检查窗口", type: "number", min: 1000, max: 60000, group: "重复循环参数",
2794
2794
  hint: "只在文本尾部这段长度内做周期性预筛(性能保护)。" },
2795
- { key: "repeatProbeChars", label: "周期探针长度", type: "number", min: 16, max: 2000, group: "重复循环参数" },
2796
- { key: "repeatMinTextChars", label: "启用最小文本长度", type: "number", min: 500, max: 50000, group: "重复循环参数" },
2795
+ { key: "repeatProbeChars", advanced: true, label: "周期探针长度", type: "number", min: 16, max: 2000, group: "重复循环参数" },
2796
+ { key: "repeatMinTextChars", advanced: true, label: "启用最小文本长度", type: "number", min: 500, max: 50000, group: "重复循环参数" },
2797
2797
 
2798
- { key: "churnMinHits", label: "空转词命中阈值", type: "number", min: 5, max: 100, group: "语义空转参数",
2798
+ { key: "churnMinHits", advanced: true, label: "空转词命中阈值", type: "number", min: 5, max: 100, group: "语义空转参数",
2799
2799
  hint: "窗口内出现这么多次\"让我想想/重新分析\"类用语即判定空转;调低则更激进。" },
2800
- { key: "churnWindowChars", label: "空转统计窗口", type: "number", min: 500, max: 20000, group: "语义空转参数" },
2801
- { key: "churnMinTextChars", label: "启用最小文本长度", type: "number", min: 500, max: 50000, group: "语义空转参数" },
2800
+ { key: "churnWindowChars", advanced: true, label: "空转统计窗口", type: "number", min: 500, max: 20000, group: "语义空转参数" },
2801
+ { key: "churnMinTextChars", advanced: true, label: "启用最小文本长度", type: "number", min: 500, max: 50000, group: "语义空转参数" },
2802
2802
 
2803
- { key: "softCutScanTail", label: "转折句扫描窗口", type: "number", min: 40, max: 2000, group: "转折句参数" },
2804
- { key: "softCutTransitionWindow", label: "转折词距句末窗口", type: "number", min: 8, max: 500, group: "转折句参数" },
2805
- { key: "softCutMinFollowChars", label: "转折词后最少展开字数", type: "number", min: 2, max: 200, group: "转折句参数",
2803
+ { key: "softCutScanTail", advanced: true, label: "转折句扫描窗口", type: "number", min: 40, max: 2000, group: "转折句参数" },
2804
+ { key: "softCutTransitionWindow", advanced: true, label: "转折词距句末窗口", type: "number", min: 8, max: 500, group: "转折句参数" },
2805
+ { key: "softCutMinFollowChars", advanced: true, label: "转折词后最少展开字数", type: "number", min: 2, max: 200, group: "转折句参数",
2806
2806
  hint: "转折词(如\"我先\")之后至少输出这么多字才允许切断,防止在句子刚开头就切断思考、截出半句结论。" },
2807
- { key: "softCutGapThreshold", label: "结论-转折最大间距", type: "number", min: 0, max: 400, group: "转折句参数",
2807
+ { key: "softCutGapThreshold", advanced: true, label: "结论-转折最大间距", type: "number", min: 0, max: 400, group: "转折句参数",
2808
2808
  hint: "Tier-1 结论标记(如\"所以\")与后续转折宣告(如\"接下来\")之间允许的最大字符距离。超过则认为是子阶段小结论而非阶段边界,拒绝软切。默认 80。" },
2809
- { key: "pseudoToolScanTail", label: "伪调用扫描窗口", type: "number", min: 200, max: 20000, group: "转折句参数" },
2809
+ { key: "pseudoToolScanTail", advanced: true, label: "伪调用扫描窗口", type: "number", min: 200, max: 20000, group: "转折句参数" },
2810
2810
 
2811
- { key: "enableLlmRefine", label: "启用 LLM 提炼结论", type: "boolean", group: "LLM 提炼",
2811
+ { key: "enableLlmRefine", advanced: true, label: "启用 LLM 提炼结论", type: "boolean", group: "LLM 提炼",
2812
2812
  hint: "用一次小模型调用把整段思考压成摘要式结论(比摘句更准)。开启后每个助手回合多一次小调用;失败会自动退回打分提取。provider/model 留空则沿用会话当前模型。" },
2813
- { key: "llmRefineProvider", label: "提炼用 provider(留空=跟随会话)", type: "text", group: "LLM 提炼" },
2814
- { key: "llmRefineModel", label: "提炼用 model(留空=跟随会话)", type: "text", group: "LLM 提炼" },
2815
- { key: "llmRefineMaxTokens", label: "提炼输出上限", type: "number", min: 64, max: 2000, group: "LLM 提炼" },
2816
- { key: "llmRefineTimeoutMs", label: "提炼超时(毫秒)", type: "number", min: 3000, max: 120000, group: "LLM 提炼" },
2817
- { key: "llmRefineMaxInputChars", label: "提炼输入截断字数", type: "number", min: 1000, max: 60000, group: "LLM 提炼" },
2813
+ { key: "llmRefineProvider", advanced: true, label: "提炼用 provider(留空=跟随会话)", type: "text", group: "LLM 提炼" },
2814
+ { key: "llmRefineModel", advanced: true, label: "提炼用 model(留空=跟随会话)", type: "text", group: "LLM 提炼" },
2815
+ { key: "llmRefineMaxTokens", advanced: true, label: "提炼输出上限", type: "number", min: 64, max: 2000, group: "LLM 提炼" },
2816
+ { key: "llmRefineTimeoutMs", advanced: true, label: "提炼超时(毫秒)", type: "number", min: 3000, max: 120000, group: "LLM 提炼" },
2817
+ { key: "llmRefineMaxInputChars", advanced: true, label: "提炼输入截断字数", type: "number", min: 1000, max: 60000, group: "LLM 提炼" },
2818
2818
 
2819
- { key: "enableHarvest", label: "启用 CoT 静默采集", type: "boolean", group: "CoT 采集",
2819
+ { key: "enableHarvest", advanced: true, label: "启用 CoT 静默采集", type: "boolean", group: "CoT 采集",
2820
2820
  hint: "关闭时零采集、零额外调用、零磁盘写入。开启后每个助手回合都会留一条样本,用于事后归纳「现有检测器看不见」的打转形态。" },
2821
- { key: "harvestIncludeToolTrace", label: "记录工具调用轨迹", type: "boolean", group: "CoT 采集",
2821
+ { key: "harvestIncludeToolTrace", advanced: true, label: "记录工具调用轨迹", type: "boolean", group: "CoT 采集",
2822
2822
  hint: "记录该步调用了哪些工具、是否报错,用于分析「反复重试同一工具」。" },
2823
- { key: "harvestMaxRecords", label: "样本条数上限", type: "number", min: 20, max: 2000, group: "CoT 采集" },
2824
- { key: "harvestRetentionDays", label: "样本保留天数", type: "number", min: 1, max: 90, group: "CoT 采集" },
2825
- { key: "harvestMinTextChars", label: "存全文的最小思考字数", type: "number", min: 500, max: 50000, group: "CoT 采集" },
2826
- { key: "harvestMaxTextChars", label: "单条全文上限", type: "number", min: 500, max: 40000, group: "CoT 采集" },
2827
- { key: "harvestFlushDebounceMs", label: "落盘去抖(毫秒)", type: "number", min: 500, max: 60000, group: "CoT 采集",
2823
+ { key: "harvestMaxRecords", advanced: true, label: "样本条数上限", type: "number", min: 20, max: 2000, group: "CoT 采集" },
2824
+ { key: "harvestRetentionDays", advanced: true, label: "样本保留天数", type: "number", min: 1, max: 90, group: "CoT 采集" },
2825
+ { key: "harvestMinTextChars", advanced: true, label: "存全文的最小思考字数", type: "number", min: 500, max: 50000, group: "CoT 采集" },
2826
+ { key: "harvestMaxTextChars", advanced: true, label: "单条全文上限", type: "number", min: 500, max: 40000, group: "CoT 采集" },
2827
+ { key: "harvestFlushDebounceMs", advanced: true, label: "落盘去抖(毫秒)", type: "number", min: 500, max: 60000, group: "CoT 采集",
2828
2828
  hint: "这段时间内的多次事件合并成一次追加写,避免每个 token 步都落盘。" },
2829
2829
 
2830
- { key: "enableAutoAnalyze", label: "自动分析", type: "boolean", group: "CoT 分析",
2830
+ { key: "enableAutoAnalyze", advanced: true, label: "自动分析", type: "boolean", group: "CoT 分析",
2831
2831
  hint: "未分析样本达到下方阈值时自动跑一次归纳;关闭则只能手动点「立即分析」。依赖「启用 CoT 静默采集」——开自动分析时会自动把采集也打开。",
2832
2832
  dependsOn: "enableHarvest" },
2833
- { key: "analyzeTriggerSamples", label: "自动分析触发条数", type: "number", min: 5, max: 500, group: "CoT 分析" },
2834
- { key: "analyzeProvider", label: "分析用 provider(留空=跟随样本)", type: "text", group: "CoT 分析" },
2835
- { key: "analyzeModel", label: "分析用 model(留空=跟随样本)", type: "text", group: "CoT 分析" },
2836
- { key: "analyzeMaxTokens", label: "分析输出上限", type: "number", min: 256, max: 4000, group: "CoT 分析" },
2837
- { key: "analyzeTimeoutMs", label: "分析超时(毫秒)", type: "number", min: 5000, max: 180000, group: "CoT 分析" },
2838
- { key: "analyzeMaxInputChars", label: "分析输入截断字数", type: "number", min: 2000, max: 120000, group: "CoT 分析" },
2839
- { key: "analyzeMaxSamples", label: "单批样本数", type: "number", min: 3, max: 60, group: "CoT 分析" },
2840
- { key: "analyzeRunBudgetMs", label: "单次分析总时长上限(毫秒)", type: "number", min: 0, max: 1800000, group: "CoT 分析" },
2841
-
2842
- { key: "enableLearnedPatterns", label: "加载已采纳的学习模式", type: "boolean", group: "CoT 增补",
2833
+ { key: "analyzeTriggerSamples", advanced: true, label: "自动分析触发条数", type: "number", min: 5, max: 500, group: "CoT 分析" },
2834
+ { key: "analyzeProvider", advanced: true, label: "分析用 provider(留空=跟随样本)", type: "text", group: "CoT 分析" },
2835
+ { key: "analyzeModel", advanced: true, label: "分析用 model(留空=跟随样本)", type: "text", group: "CoT 分析" },
2836
+ { key: "analyzeMaxTokens", advanced: true, label: "分析输出上限", type: "number", min: 256, max: 4000, group: "CoT 分析" },
2837
+ { key: "analyzeTimeoutMs", advanced: true, label: "分析超时(毫秒)", type: "number", min: 5000, max: 180000, group: "CoT 分析" },
2838
+ { key: "analyzeMaxInputChars", advanced: true, label: "分析输入截断字数", type: "number", min: 2000, max: 120000, group: "CoT 分析" },
2839
+ { key: "analyzeMaxSamples", advanced: true, label: "单批样本数", type: "number", min: 3, max: 60, group: "CoT 分析" },
2840
+ { key: "analyzeRunBudgetMs", advanced: true, label: "单次分析总时长上限(毫秒)", type: "number", min: 0, max: 1800000, group: "CoT 分析" },
2841
+
2842
+ { key: "enableLearnedPatterns", advanced: true, label: "加载已采纳的学习模式", type: "boolean", group: "CoT 增补",
2843
2843
  hint: "关闭后运行时只用出厂模式;patterns.json 保留不删,随时可再打开。" },
2844
- { key: "learnedMaxPhrases", label: "学习模式条数上限", type: "number", min: 4, max: 200, group: "CoT 增补" },
2845
- { key: "learnedMaxShift", label: "阈值允许最大偏移", type: "number", min: 0, max: 50, group: "CoT 增补",
2844
+ { key: "learnedMaxPhrases", advanced: true, label: "学习模式条数上限", type: "number", min: 4, max: 200, group: "CoT 增补" },
2845
+ { key: "learnedMaxShift", advanced: true, label: "阈值允许最大偏移", type: "number", min: 0, max: 50, group: "CoT 增补",
2846
2846
  hint: "学习层对出厂阈值的调整幅度上限,防止判定漂移。" },
2847
- { key: "learnedShadowRounds", label: "影子期命中次数(0=直接生效)", type: "number", min: 0, max: 200, group: "CoT 增补",
2847
+ { key: "learnedShadowRounds", advanced: true, label: "影子期命中次数(0=直接生效)", type: "number", min: 0, max: 200, group: "CoT 增补",
2848
2848
  hint: "学习模式首次生效时只统计「本会打断」的次数、不真的打断;累计够次数后再由你决定转正。" }
2849
2849
  ];
2850
2850
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-cot-anchor",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "思考锚点:从模型上一段思考中提取已确立结论,在工具结果后注入,减少重复推导;并可识别打转与伪工具调用",
5
5
  "keywords": [
6
6
  "dsh",