@mossbear/eval-core 0.1.0-alpha.65 → 0.1.0-alpha.67

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/dist/index.d.ts CHANGED
@@ -7,5 +7,6 @@
7
7
  export { type EvalAdapter, type EvalUsage } from './adapter.js';
8
8
  export { sanitizeCommand } from './sanitize-command.js';
9
9
  export { stripCodeBlocks, type CodeBlockStripResult } from './strip-code-blocks.js';
10
+ export { STEERING_LABELS, STEERING_CLASSIFIER_VERSION, classifySteeringTurn, classifySteeringTurnV1, scoreSteeringBaseline, type SteeringBaselineScore, type SteeringLabel, } from './steering-classification.js';
10
11
  export { MAX_PROSE_CHARS, PROSE_REDACTION_CLASSES, redactProse, type ProseRedactionClass, type ProseRedactionReport, } from './redact-prose.js';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAEnF,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,WAAW,EACX,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,GAC1B,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAEnF,OAAO,EACL,eAAe,EACf,2BAA2B,EAC3B,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,GACnB,MAAM,8BAA8B,CAAA;AAErC,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,WAAW,EACX,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,GAC1B,MAAM,mBAAmB,CAAA"}
package/dist/index.js CHANGED
@@ -6,5 +6,6 @@
6
6
  */
7
7
  export { sanitizeCommand } from './sanitize-command.js';
8
8
  export { stripCodeBlocks } from './strip-code-blocks.js';
9
+ export { STEERING_LABELS, STEERING_CLASSIFIER_VERSION, classifySteeringTurn, classifySteeringTurnV1, scoreSteeringBaseline, } from './steering-classification.js';
9
10
  export { MAX_PROSE_CHARS, PROSE_REDACTION_CLASSES, redactProse, } from './redact-prose.js';
10
11
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAAE,eAAe,EAA6B,MAAM,wBAAwB,CAAA;AAEnF,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,WAAW,GAGZ,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAAE,eAAe,EAA6B,MAAM,wBAAwB,CAAA;AAEnF,OAAO,EACL,eAAe,EACf,2BAA2B,EAC3B,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,GAGtB,MAAM,8BAA8B,CAAA;AAErC,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,WAAW,GAGZ,MAAM,mBAAmB,CAAA"}
@@ -0,0 +1,19 @@
1
+ export declare const STEERING_LABELS: readonly ["correction", "steering", "new request", "acknowledgement", "insufficient evidence"];
2
+ export type SteeringLabel = (typeof STEERING_LABELS)[number];
3
+ /** Stored with each prediction so a baseline change is explicit in history. */
4
+ export declare const STEERING_CLASSIFIER_VERSION = "v1";
5
+ /** Conservative, deterministic prediction for one already-redacted user turn. */
6
+ export declare function classifySteeringTurnV1(text: string): SteeringLabel;
7
+ /** The active baseline classifier. Persisted v1 predictions remain immutable. */
8
+ export declare const classifySteeringTurn: typeof classifySteeringTurnV1;
9
+ export type SteeringBaselineScore = {
10
+ total: number;
11
+ classified: number;
12
+ coverage: number;
13
+ counts: Record<SteeringLabel, number>;
14
+ };
15
+ /** Score label distribution and coverage without writing per-turn predictions. */
16
+ export declare function scoreSteeringBaseline(turns: readonly {
17
+ text: string;
18
+ }[]): SteeringBaselineScore;
19
+ //# sourceMappingURL=steering-classification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steering-classification.d.ts","sourceRoot":"","sources":["../src/steering-classification.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,gGAMlB,CAAA;AAEV,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAA;AAE5D,+EAA+E;AAC/E,eAAO,MAAM,2BAA2B,OAAO,CAAA;AAW/C,iFAAiF;AACjF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAYlE;AAED,iFAAiF;AACjF,eAAO,MAAM,oBAAoB,+BAAyB,CAAA;AAE1D,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;CACtC,CAAA;AAED,kFAAkF;AAClF,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,GACjC,qBAAqB,CAkBvB"}
@@ -0,0 +1,55 @@
1
+ export const STEERING_LABELS = [
2
+ 'correction',
3
+ 'steering',
4
+ 'new request',
5
+ 'acknowledgement',
6
+ 'insufficient evidence',
7
+ ];
8
+ /** Stored with each prediction so a baseline change is explicit in history. */
9
+ export const STEERING_CLASSIFIER_VERSION = 'v1';
10
+ const ACKNOWLEDGEMENT = /^(?:ok(?:ay)?|yes|yep|got it|thanks|thank you|great|perfect|looks good|lgtm|sounds good)[.! \t\r\n]*$/i;
11
+ const CORRECTION = /\b(?:that's wrong|that is wrong|not what i (?:asked|meant)|you misunderstood|you missed|you forgot|i meant|i said|i asked for|you did(?:n't| not)|undo that|revert that|wrong file|wrong branch)\b/i;
12
+ const STEERING = /\b(?:instead|also|make sure|don't|do not|remember to|keep it|keep the|focus on|before you|after that|one more thing|please preserve)\b/i;
13
+ const REQUEST = /\b(?:can you|could you|please|implement|add|create|write|fix|update|change|remove|build|explain|show me|summarize|compare|find)\b/i;
14
+ /** Conservative, deterministic prediction for one already-redacted user turn. */
15
+ export function classifySteeringTurnV1(text) {
16
+ const normalized = text
17
+ .normalize('NFKC')
18
+ .replace(/[’‘]/g, "'")
19
+ .trim()
20
+ .replace(/\s+/g, ' ');
21
+ if (normalized.length < 3)
22
+ return 'insufficient evidence';
23
+ if (ACKNOWLEDGEMENT.test(normalized))
24
+ return 'acknowledgement';
25
+ if (CORRECTION.test(normalized))
26
+ return 'correction';
27
+ if (STEERING.test(normalized))
28
+ return 'steering';
29
+ if (REQUEST.test(normalized))
30
+ return 'new request';
31
+ return 'insufficient evidence';
32
+ }
33
+ /** The active baseline classifier. Persisted v1 predictions remain immutable. */
34
+ export const classifySteeringTurn = classifySteeringTurnV1;
35
+ /** Score label distribution and coverage without writing per-turn predictions. */
36
+ export function scoreSteeringBaseline(turns) {
37
+ const counts = {
38
+ correction: 0,
39
+ steering: 0,
40
+ 'new request': 0,
41
+ acknowledgement: 0,
42
+ 'insufficient evidence': 0,
43
+ };
44
+ for (const turn of turns)
45
+ counts[classifySteeringTurn(turn.text)] += 1;
46
+ const total = turns.length;
47
+ const classified = total - counts['insufficient evidence'];
48
+ return {
49
+ total,
50
+ classified,
51
+ coverage: total === 0 ? 0 : classified / total,
52
+ counts,
53
+ };
54
+ }
55
+ //# sourceMappingURL=steering-classification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steering-classification.js","sourceRoot":"","sources":["../src/steering-classification.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,YAAY;IACZ,UAAU;IACV,aAAa;IACb,iBAAiB;IACjB,uBAAuB;CACf,CAAA;AAIV,+EAA+E;AAC/E,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAA;AAE/C,MAAM,eAAe,GACnB,wGAAwG,CAAA;AAC1G,MAAM,UAAU,GACd,qMAAqM,CAAA;AACvM,MAAM,QAAQ,GACZ,yIAAyI,CAAA;AAC3I,MAAM,OAAO,GACX,oIAAoI,CAAA;AAEtI,iFAAiF;AACjF,MAAM,UAAU,sBAAsB,CAAC,IAAY;IACjD,MAAM,UAAU,GAAG,IAAI;SACpB,SAAS,CAAC,MAAM,CAAC;SACjB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;SACrB,IAAI,EAAE;SACN,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACvB,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,uBAAuB,CAAA;IACzD,IAAI,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC;QAAE,OAAO,iBAAiB,CAAA;IAC9D,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC;QAAE,OAAO,YAAY,CAAA;IACpD,IAAI,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC;QAAE,OAAO,UAAU,CAAA;IAChD,IAAI,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC;QAAE,OAAO,aAAa,CAAA;IAClD,OAAO,uBAAuB,CAAA;AAChC,CAAC;AAED,iFAAiF;AACjF,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAA;AAS1D,kFAAkF;AAClF,MAAM,UAAU,qBAAqB,CACnC,KAAkC;IAElC,MAAM,MAAM,GAAkC;QAC5C,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC;QACX,aAAa,EAAE,CAAC;QAChB,eAAe,EAAE,CAAC;QAClB,uBAAuB,EAAE,CAAC;KAC3B,CAAA;IACD,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAA;IAEtE,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAA;IAC1B,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAA;IAC1D,OAAO;QACL,KAAK;QACL,UAAU;QACV,QAAQ,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,GAAG,KAAK;QAC9C,MAAM;KACP,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mossbear/eval-core",
3
- "version": "0.1.0-alpha.65",
3
+ "version": "0.1.0-alpha.67",
4
4
  "private": false,
5
5
  "description": "Portable pieces of Mossbear's evaluation path — command redaction, the LLM adapter seam, and guide normalization.",
6
6
  "license": "MIT",
@@ -38,7 +38,7 @@
38
38
  "test": "vitest run"
39
39
  },
40
40
  "dependencies": {
41
- "@mossbear/protocol": "0.1.0-alpha.65"
41
+ "@mossbear/protocol": "0.1.0-alpha.67"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/node": "20.19.43",