llm-output-guard 0.5.0 → 1.0.0

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.md CHANGED
@@ -526,7 +526,9 @@ output starts to reach.
526
526
 
527
527
  ## Stability
528
528
 
529
- What semver means for this package specifically.
529
+ What semver means for this package specifically. These rules bind from **1.0.0**
530
+ onward; under `0.x` they described an intent, and the surface was frozen — export
531
+ by export — in the 1.0.0 release.
530
532
 
531
533
  **The public API is:** everything exported from `llm-output-guard`, plus
532
534
  `outputGuard` / `OutputGuardOptions` / `DegenerateAction` from `./ai-sdk` and
@@ -534,7 +536,8 @@ What semver means for this package specifically.
534
536
  Each subpath is its own contract; the two adapters share an internal base type
535
537
  today and are free to diverge, so an option added to one is not a promise about
536
538
  the other. Anything not exported from those three entry points is internal, has
537
- no stability guarantee, and may move in any release.
539
+ no stability guarantee, and may move in any release. The list is asserted in
540
+ `test/surface.test.ts`, so an export cannot join it by accident.
538
541
 
539
542
  **Threshold and preset values are behaviour, not implementation.** This is the
540
543
  interesting case, so it gets a rule of its own:
package/dist/index.cjs CHANGED
@@ -579,12 +579,10 @@ exports.compressibilityScore = compressibilityScore;
579
579
  exports.compressionRatio = compressionRatio;
580
580
  exports.createStreamGuard = createStreamGuard;
581
581
  exports.emptinessScore = emptinessScore;
582
- exports.findGap = findGap;
583
582
  exports.guardStream = guardStream;
584
583
  exports.jsonScore = jsonScore;
585
584
  exports.languageMismatchScore = languageMismatchScore;
586
585
  exports.languageProfile = languageProfile;
587
- exports.percentile = percentile;
588
586
  exports.presets = presets;
589
587
  exports.repetitionScore = repetitionScore;
590
588
  exports.shortnessScore = shortnessScore;
package/dist/index.d.cts CHANGED
@@ -102,19 +102,6 @@ interface Summary {
102
102
  /** Everything that would make the number above untrustworthy. */
103
103
  caveats: string[];
104
104
  }
105
- /** Linear-interpolated percentile. `sorted` must be ascending. */
106
- declare function percentile(sorted: number[], p: number): number;
107
- /**
108
- * The widest empty stretch in the upper tail, if there is one.
109
- *
110
- * A genuinely bimodal detector -- healthy output clustered near zero, a
111
- * handful of failures far above it -- leaves a visible hole between the two.
112
- * That hole is worth far more than a percentile, because it is evidence about
113
- * *this* detector on *your* traffic rather than an assumption about rarity.
114
- * Searching only above the median keeps the ordinary spread of healthy scores
115
- * from being mistaken for a separation.
116
- */
117
- declare function findGap(sorted: number[], minWidth?: number): Gap | null;
118
105
  /**
119
106
  * Summarise one detector's scores.
120
107
  *
@@ -412,4 +399,4 @@ declare function languageProfile(text: string): Record<string, number>;
412
399
  declare function languageMismatchScore(text: string, expected: string, options?: LanguageOptions): number;
413
400
  declare const supportedLanguages: string[];
414
401
 
415
- export { type Calibration, type CalibrationOptions, CheckOptions, type CompressibilityOptions, DegenerateOutputError, type Distribution, type Gap, type JsonOptions, type JsonResult, type LanguageOptions, ReasonCode, type RepetitionOptions, type ScoreSample, type Summary, type TailLoopOptions, type TailLoopResult, TokenMode, type TruncationOptions, Verdict, assertOutput, calibrate, checkOutput, compressibilityScore, compressionRatio, emptinessScore, findGap, jsonScore, languageMismatchScore, languageProfile, percentile, presets, repetitionScore, shortnessScore, stripFence, summarise, supportedLanguages, tailLoopDetail, tailLoopScore, truncationScore };
402
+ export { type Calibration, type CalibrationOptions, CheckOptions, type CompressibilityOptions, DegenerateOutputError, type Distribution, type Gap, type JsonOptions, type JsonResult, type LanguageOptions, ReasonCode, type RepetitionOptions, type ScoreSample, type Summary, type TailLoopOptions, type TailLoopResult, TokenMode, type TruncationOptions, Verdict, assertOutput, calibrate, checkOutput, compressibilityScore, compressionRatio, emptinessScore, jsonScore, languageMismatchScore, languageProfile, presets, repetitionScore, shortnessScore, stripFence, summarise, supportedLanguages, tailLoopDetail, tailLoopScore, truncationScore };
package/dist/index.d.ts CHANGED
@@ -102,19 +102,6 @@ interface Summary {
102
102
  /** Everything that would make the number above untrustworthy. */
103
103
  caveats: string[];
104
104
  }
105
- /** Linear-interpolated percentile. `sorted` must be ascending. */
106
- declare function percentile(sorted: number[], p: number): number;
107
- /**
108
- * The widest empty stretch in the upper tail, if there is one.
109
- *
110
- * A genuinely bimodal detector -- healthy output clustered near zero, a
111
- * handful of failures far above it -- leaves a visible hole between the two.
112
- * That hole is worth far more than a percentile, because it is evidence about
113
- * *this* detector on *your* traffic rather than an assumption about rarity.
114
- * Searching only above the median keeps the ordinary spread of healthy scores
115
- * from being mistaken for a separation.
116
- */
117
- declare function findGap(sorted: number[], minWidth?: number): Gap | null;
118
105
  /**
119
106
  * Summarise one detector's scores.
120
107
  *
@@ -412,4 +399,4 @@ declare function languageProfile(text: string): Record<string, number>;
412
399
  declare function languageMismatchScore(text: string, expected: string, options?: LanguageOptions): number;
413
400
  declare const supportedLanguages: string[];
414
401
 
415
- export { type Calibration, type CalibrationOptions, CheckOptions, type CompressibilityOptions, DegenerateOutputError, type Distribution, type Gap, type JsonOptions, type JsonResult, type LanguageOptions, ReasonCode, type RepetitionOptions, type ScoreSample, type Summary, type TailLoopOptions, type TailLoopResult, TokenMode, type TruncationOptions, Verdict, assertOutput, calibrate, checkOutput, compressibilityScore, compressionRatio, emptinessScore, findGap, jsonScore, languageMismatchScore, languageProfile, percentile, presets, repetitionScore, shortnessScore, stripFence, summarise, supportedLanguages, tailLoopDetail, tailLoopScore, truncationScore };
402
+ export { type Calibration, type CalibrationOptions, CheckOptions, type CompressibilityOptions, DegenerateOutputError, type Distribution, type Gap, type JsonOptions, type JsonResult, type LanguageOptions, ReasonCode, type RepetitionOptions, type ScoreSample, type Summary, type TailLoopOptions, type TailLoopResult, TokenMode, type TruncationOptions, Verdict, assertOutput, calibrate, checkOutput, compressibilityScore, compressionRatio, emptinessScore, jsonScore, languageMismatchScore, languageProfile, presets, repetitionScore, shortnessScore, stripFence, summarise, supportedLanguages, tailLoopDetail, tailLoopScore, truncationScore };
package/dist/index.js CHANGED
@@ -143,6 +143,6 @@ var presets = {
143
143
  }
144
144
  };
145
145
 
146
- export { calibrate, findGap, percentile, presets, summarise };
146
+ export { calibrate, presets, summarise };
147
147
  //# sourceMappingURL=index.js.map
148
148
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "llm-output-guard",
3
- "version": "0.5.0",
3
+ "version": "1.0.0",
4
4
  "description": "Detect degenerate LLM output that arrives with a 200 OK. Zero dependencies, deterministic, composes with any retry or fallback layer.",
5
5
  "keywords": [
6
6
  "llm",