pi-think-anchor 1.0.27 → 1.0.28

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.
Files changed (2) hide show
  1. package/index.ts +4 -8
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -29,7 +29,6 @@ interface TAConfig {
29
29
  enabled: boolean;
30
30
  lexicon: { positive: string[]; negative: string[]; neutral: string[] };
31
31
  windowSize: number;
32
- bands: { spec: number; react: number };
33
32
  /** v2 主判据:证据门槛 + 发散词占比(与长度无关) */
34
33
  score: { minHits: number; spec: number; react: number; alpha: number };
35
34
  weights: { beta: number; eps: number };
@@ -40,7 +39,6 @@ const DEF_CFG: TAConfig = {
40
39
  enabled: true,
41
40
  lexicon: { positive: DEF_POS, negative: DEF_NEG, neutral: DEF_NEU },
42
41
  windowSize: 5,
43
- bands: { spec: 1.2, react: 0.5 },
44
42
  score: { minHits: 3, spec: 1.2, react: 0.5, alpha: 1 },
45
43
  weights: { beta: 0.4, eps: 0.5 },
46
44
  intervention: { l1CooldownMin: 10, l2CooldownMin: 15, maxL2: 2 },
@@ -58,9 +56,7 @@ function loadCfg(): TAConfig {
58
56
  ...DEF_CFG,
59
57
  ...raw,
60
58
  lexicon: { ...DEF_CFG.lexicon, ...(raw.lexicon ?? {}) },
61
- // score 是 v2 判据;未配置 score 时兼容旧 bands(否则改 bands 静默无效)
62
- score: { ...DEF_CFG.score, ...(raw.score ?? {}), ...(raw.score ? {} : (raw.bands ?? {})) },
63
- bands: { ...DEF_CFG.bands, ...(raw.bands ?? {}) },
59
+ score: { ...DEF_CFG.score, ...(raw.score ?? {}) },
64
60
  weights: { ...DEF_CFG.weights, ...(raw.weights ?? {}) },
65
61
  intervention: { ...DEF_CFG.intervention, ...(raw.intervention ?? {}) },
66
62
  };
@@ -98,9 +94,9 @@ export function ratioOf(pos: number, neg: number, neu: number, w: { beta: number
98
94
  return (pos + w.beta * neu) / (neg + w.eps);
99
95
  }
100
96
 
101
- export function bandOf(ratio: number, bands: { spec: number; react: number } = DEF_CFG.bands): "spec" | "mixed" | "react" {
102
- if (ratio >= bands.spec) return "spec";
103
- if (ratio >= bands.react) return "mixed";
97
+ export function bandOf(ratio: number, t: { spec: number; react: number } = DEF_CFG.score): "spec" | "mixed" | "react" {
98
+ if (ratio >= t.spec) return "spec";
99
+ if (ratio >= t.react) return "mixed";
104
100
  return "react";
105
101
  }
106
102
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-think-anchor",
3
- "version": "1.0.27",
3
+ "version": "1.0.28",
4
4
  "description": "Monitors thinking focus drift and nudges the model back on track.",
5
5
  "type": "module",
6
6
  "license": "MIT",