pi-think-anchor 1.0.5 → 1.0.6
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.en.md +2 -2
- package/README.md +1 -1
- package/index.ts +4 -4
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -19,12 +19,12 @@ Measures the "focus fingerprint" of thinking and nudges the model back when it d
|
|
|
19
19
|
| Window | 5 turns | sliding |
|
|
20
20
|
| L1 cooldown | 10 min | first drift |
|
|
21
21
|
| L2 cooldown | 15 min | sustained drift, max 2 per session |
|
|
22
|
-
| Word lists | Chinese | 28 focus /
|
|
22
|
+
| Word lists | Chinese | 28 focus / 18 drift terms |
|
|
23
23
|
|
|
24
24
|
## Install
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
pi install npm:pi-think-anchor
|
|
27
|
+
pi install npm:pi-think-anchor
|
|
28
28
|
pi install ./pi-think-anchor
|
|
29
29
|
```
|
|
30
30
|
|
package/README.md
CHANGED
package/index.ts
CHANGED
|
@@ -110,10 +110,10 @@ export function bandOf(ratio: number, bands: { spec: number; react: number } = D
|
|
|
110
110
|
* α=1(伪计数)+ minHits=3 后 react 占 9.7%,且选中样本 negRate 中位 0.86(真发散)。
|
|
111
111
|
* α 的作用:低命中时比率趋向 1(mixed),不再因「命中少」被误判成 react。
|
|
112
112
|
*/
|
|
113
|
-
export function classify(pos: number, neg: number, neu: number, c: { minHits: number; spec: number; react: number; alpha: number }): TABand {
|
|
113
|
+
export function classify(pos: number, neg: number, neu: number, c: { minHits: number; spec: number; react: number; alpha: number; beta?: number; eps?: number }): TABand {
|
|
114
114
|
const hits = pos + neg + neu;
|
|
115
115
|
if (hits < c.minHits) return "none";
|
|
116
|
-
const r = (pos + 0.4 * neu + c.alpha) / (neg + 0.5 + c.alpha);
|
|
116
|
+
const r = (pos + (c.beta ?? 0.4) * neu + c.alpha) / (neg + (c.eps ?? 0.5) + c.alpha);
|
|
117
117
|
if (r < c.react) return "react";
|
|
118
118
|
if (r < c.spec) return "mixed";
|
|
119
119
|
return "spec";
|
|
@@ -294,9 +294,9 @@ export default function thinkAnchor(pi: ExtensionAPI): void {
|
|
|
294
294
|
lastHits = hits;
|
|
295
295
|
lastNegRate = negRate;
|
|
296
296
|
const ratio = ratioOf(agg.pos, agg.neg, agg.neu, st.cfg.weights);
|
|
297
|
-
const band = classify(agg.pos, agg.neg, agg.neu, st.cfg.score);
|
|
297
|
+
const band = classify(agg.pos, agg.neg, agg.neu, { ...st.cfg.score, ...st.cfg.weights });
|
|
298
298
|
const prevPhase = st.phase;
|
|
299
|
-
const r = (agg.pos +
|
|
299
|
+
const r = (agg.pos + st.cfg.weights.beta * agg.neu + st.cfg.score.alpha) / (agg.neg + st.cfg.weights.eps + st.cfg.score.alpha);
|
|
300
300
|
const d0 = decideNext(st.phase, band, st.l2Tried, st.cfg.intervention.maxL2);
|
|
301
301
|
// 升级前先看上次干预有没有用:无效则本次不升 L2(实测 L2 无收益)
|
|
302
302
|
const d = { ...d0, level: downgradeIfIneffective(d0.level, lastEffValue) };
|