Skip to content
ContractSpec
Start here

Package manual · platform

·Integrations and provider selection

lib.provider-spec

Provider routing and runtime-target contracts for ContractSpec Builder.

platformlibraryv2.0.4experimentalservernode
@lssm-tech/lib.provider-spec
bun add @lssm-tech/lib.provider-spec
Package source ↗Manifest ↗

Manifest declarations describe the current workspace; they do not verify registry publication or runtime execution.

Package guide

The published build realizes every advertised Bun, Node, browser and declaration target, including the streaming-transcription catalog. After bun run build, run bun scripts/check-built-exports.mjs from this package to verify actual production tarballs and byte parity with built outputs. It never publishes or changes the provider model allowlist. In a source checkout, scripts/check-packed-consumer.mjs takes a JSON report destination and runs the existing locked, isolated Node/Bun/browser and strict NodeNext/Bundler declaration battery, including declaration byte parity.

Website: https://contractspec.io

Typed provider-routing, runtime-target, execution-receipt, comparison, and patch-proposal contracts for the Builder control plane.

What It Provides

  • Runtime-mode, provider-kind, task-type, risk, and comparison enums.
  • Runtime target, handshake, trust-profile, and lease contracts.
  • External execution provider, routing policy, context bundle, receipt, and patch proposal types.
  • Validation helpers for routing policies, receipts, and runtime target records.
  • Provider-neutral capability observations for usage, cost, latency, freshness, coverage, health, rate limits, trusted receipts, budgets, evidence, and replay.

Public Entry Points

  • . resolves through ./src/index.ts
  • ./types resolves through ./src/types.ts
  • ./validation resolves through ./src/validation.ts
  • ./provider-observation resolves the additive observation contract and pinned schema identity
  • ./provider-observation-aggregation resolves deterministic aggregation and fail-closed budget evaluation
  • ./provider-metering and ./provider-metering-runtime resolve additive reconciliation, health freshness, budget-reference, and tenant-query surfaces
  • ./provider-shadow-selection and ./provider-shadow-selector resolve deterministic, explainable, no-dispatch provider shadow selection
  • ./fixtures/provider-observation resolves neutral, no-network observation and budget fixtures
  • ./gateway-model-catalog resolves the shared Vercel AI Gateway EU model allowlist (EU inference zone, zero retention, no training; Mistral excluded) used by CommunicationOS and OPA briefings, and ./gateway-model-resolution the deterministic request → user → workspace → environment → catalog precedence over it

Notes

  • This package is a qualified pure platform spec (contractspec.architecture.role: platform-spec). Its runtime sources and their workspace suppliers perform no I/O, ambient clock or random reads, async effects or provider dispatch, so domain specs such as @lssm-tech/lib.builder-spec may depend on it directly.
  • fingerprintProviderCapabilityDeclaration and validateProviderCapabilityDeclaration compute the SHA-256 digest synchronously with @lssm-tech/lib.crypto-utils/sha256. They keep their Promise return types, digests and rejection-on-malformed-input behavior.
  • This package is a compatibility surface. Prefer additive evolution.
  • Provider routing stays explicit policy, not hidden heuristics.
  • Provider declarations use narrow Core serialization/features and the canonical @lssm-tech/lib.orchestration-spec/ai-improvement evidence declaration.

Provider type declarations are grouped internally by runtime target, routing, and execution receipt responsibility. The root and /types exports retain their existing names, literal unions, mutability, and structural contracts. Runtime leases and evidence references retain their existing authority boundaries.

Observation aggregation, input validation/grouping/cost summation and budget projection have separate cohesive private modules, per-observation accumulator updates separated from grouping and normalized output; each computational utility within 100 lines after canonical formatting, with the existing public facade. Aggregation remains deterministic and budget projection never grants external effect authority.

The additive ProviderWorkspaceInput, MobileParityInput, MobileReviewCard, and MobileParitySummary root exports are provider-neutral supplied-data contracts. They carry no workspace or approval authority. Builder retains its existing review-card and parity type names as aliases to the same canonical models.

Relationships

THIS PACKAGElib.provider-spec16 import paths

Arrows point from a package to its direct dependency. Counts are derived from captured workspace manifests.

3 declarations

Declared capabilities

Lib Provider Spec

Provider routing and runtime-target contracts for ContractSpec Builder.

Scripts

  • publish:pkgbun publish --tolerate-republish --ignore-scripts --verbose
  • publish:pkg:canarybun publish:pkg --tag canary
  • buildcontractspec-bun-build build
  • build:bundlecontractspec-bun-build transpile
  • build:typescontractspec-bun-build types
  • devcontractspec-bun-build dev
  • cleanrimraf dist .turbo
  • lintbun lint:fix
  • lint:fixnode ../../../../scripts/biome.cjs check --write --unsafe --only=nursery/useSortedClasses . && node ../../../../scripts/biome.cjs check --write .
  • lint:checknode ../../../../scripts/biome.cjs check .
  • testbun test
  • prebuildcontractspec-bun-build prebuild
  • typechecktsgo --noEmit