New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

@evalguard/wrapper-core

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@evalguard/wrapper-core

Shared core for EvalGuard provider SDK wrappers — GuardrailClient, cost table, BYOK, retry + circuit-breaker, idempotency, eval-on-response.

Source
npmnpm
Version
1.2.0
Version published
Weekly downloads
95
331.82%
Maintainers
1
Weekly downloads
 
Created
Source

@evalguard/wrapper-core

Shared core for EvalGuard provider SDK wrappers. Not typically used directly — install one of the provider wrappers instead:

All of the above — and this package — are ESM-only ("type": "module"). Your consuming project needs "type": "module" in package.json and "module"/"moduleResolution" set to "node16" (or "nodenext"/"bundler") in tsconfig.json. In a default CommonJS TypeScript project the quickstarts do not type-check (TS1479, plus a TS2345 #private mismatch on the peer SDK); load them with a dynamic import() instead.

What's here

ModuleExports
guardrail-clientGuardrailClient — HTTP client for firewall-check / trace-log / score-output. checkInput fails CLOSED (throws once retries/circuit give up) so the calling wrapper can honour blockOnViolation; logTrace / scoreOutput fail open. Corrected 2026-07-29 — this row previously said "all fail-open", which stopped being true on 2026-05-28.
message-textcollapseMessageText(), collapsePromptText() — canonical message→scannable-text collapse for the framework wrappers. Scans every role (tool results and retrieved documents included) and never truncates.
costestimateCostDetailed() / isModelPriced() / estimateCost(). A hand-curated OpenAI / Anthropic / Gemini table plus pricing-catalog.generated.ts — 2,200+ model ids generated from packages/core/src/cost/model-pricing.ts + the LiteLLM overlay by scripts/gen-wrapper-pricing.mjs. An unpriced model reports costUsd: null / priced: false, never an invented number. Corrected 2026-07-30 — estimateCost("gpt-5", …) and estimateCost("totally-unknown-model", …) both silently returned the same blended 0.0105.
trace-idnewTraceId(), injectTraceHeader(), isValidTraceId() — per-request UUID for log correlation
byokresolveApiKey() — supports string | () => string | Promise<string>
idempotencyresolveIdempotencyKey() — auto-generated, literal, or function-supplied
retrywithRetry() — exponential backoff + per-base-URL circuit breaker
eval-on-responserunPostResponseEval() — post-completion output scoring
typesEvalGuardConfig, EvalGuardViolationError, EvalGuardOutputViolationError, etc.

Why a separate package

The v1.0 wrappers (@evalguard/openai, @evalguard/anthropic) each shipped inline copies of GuardrailClient and cost.ts. That worked for two providers but didn't scale — adding Gemini meant a third copy, and adding features (BYOK, idempotency, retry+circuit-breaker, eval-on-response) meant 3× the surface area to keep in sync.

This package consolidates the shared foundation. Wrappers import from it via workspace dep during development and npm dep once published.

License

Apache-2.0. The full text ships in this package as LICENSE.

Keywords

evalguard

FAQs

Package last updated on 03 Aug 2026

Related posts