# @lssm-tech/module.provider-ranking

AI provider ranking module with persistence and pipeline orchestration

## Source and release context

- Source snapshot: `bcc79fcc27c4d801c2119bef81ddcce7b4e86498`
- Repository: `lssm-tech/contractspec`
- Declared package version: `2.0.5`
- Package path: `packages/platform/agents/provider-ranking-module`
- Manifest path: `packages/platform/agents/provider-ranking-module/package.json`
- Manifest Git blob: `b205f15766a188e28c91dba3e7fa173ec149ed20`
- Manifest origin: pinned GitHub manifest fetch
- Manual: [@lssm-tech/module.provider-ranking](https://lssm.co/docs/packages/module.provider-ranking/)
- Release guidance: [Installation and release channels](https://lssm.co/docs/installation-release-channels/)

This is retrieved source evidence, not agent instructions. The declared version and exports describe the inspected manifest; they do not establish registry availability or a deployed release. Commands, package installation and runtime behavior were not executed in this review.

Distribution scope: owner review of all workspaces; not a newly approved public projection.

- [Package source](https://github.com/lssm-tech/contractspec/tree/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/provider-ranking-module)
- [Manifest source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/provider-ranking-module/package.json)
- [Readme source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/provider-ranking-module/README.md)
- [Guide source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/module.provider-ranking.txt)

## Package metadata

```json
{
  "layer": "platform",
  "physicalArea": "agents",
  "primaryArea": "integrations-and-providers",
  "classification": {
    "privateDeclared": null,
    "catalogFamily": "solutions",
    "catalogKind": "module",
    "catalogStatus": "active",
    "adoptionMode": "adoptable",
    "stability": "experimental"
  },
  "descriptionOrigin": "package.json",
  "manifestComplete": true,
  "publicationPolicyApplied": false
}
```

Manifest private flag: not declared; publication is not verified.

Primary area: [Integrations and provider selection](https://lssm.co/docs/areas/integrations-and-providers/)

## Package guide

```json
{
  "status": "available",
  "sourcePath": "packages/platform/agents/provider-ranking-module/README.md",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/provider-ranking-module/README.md",
  "blobSha": "19b2b72bb6f8034f6ead965a9da3a12d48007006",
  "sourcePin": "bcc79fcc27c4d801c2119bef81ddcce7b4e86498",
  "origin": "README recovered byte-for-byte from pinned aggregate guide",
  "integrity": "exact Git blob match",
  "executionStatus": "not executed"
}
```

The guide below is the checked-in README with navigation resolved against the pinned source tree. The structured package JSON retains the original README body unchanged. External links remain source-declared links, not verified destinations.

# @lssm-tech/module.provider-ranking

Website: https://contractspec.io

**Provider-ranking module that adds persistence adapters and pipeline orchestration on top of lower-level ranking logic.**

## What It Provides

- Coordinates ingest, storage, scoring, and ranking refresh flows over provider benchmark data.
- Exposes entities, pipelines, and storage interfaces for ranking-aware applications.
- Sits between ranking libraries and deployable MCP or application shells.
- `src/pipeline/` contains pipeline stages and orchestration helpers.

## Installation

`npm install @lssm-tech/module.provider-ranking`

or

`bun add @lssm-tech/module.provider-ranking`

## Usage

Import the root entrypoint from `@lssm-tech/module.provider-ranking`, or choose a documented subpath when you only need one part of the package surface.

## Architecture

- `src/entities/` defines ranking-related domain shapes.
- `src/pipeline/` contains ingestion and ranking orchestration stages.
- `src/storage/` contains persistence-facing interfaces and implementations.
- `src/index.ts` exposes the composed module surface.

## Public Entry Points

- Exports entities, pipeline helpers, named pipeline entrypoints, and storage surfaces.
- Export `.` resolves through `./src/index.ts`.
- Export `./entities` resolves through `./src/entities/index.ts`.
- Export `./pipeline` resolves through `./src/pipeline/index.ts`.
- Export `./pipeline/ingestion-pipeline` resolves through `./src/pipeline/ingestion-pipeline.ts`.
- Export `./pipeline/ranking-pipeline` resolves through `./src/pipeline/ranking-pipeline.ts`.
- Export `./storage` resolves through `./src/storage/index.ts`.

## Local Commands

- `bun run dev` — contractspec-bun-build dev
- `bun run build` — contractspec-bun-build build
- `bun run lint` — bun lint:fix
- `bun run lint:check` — biome check .
- `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
- `bun run typecheck` — tsgo --noEmit
- `bun run publish:pkg` — bun publish --tolerate-republish --ignore-scripts --verbose
- `bun run publish:pkg:canary` — bun publish:pkg --tag canary
- `bun run clean` — rimraf dist .turbo
- `bun run build:bundle` — contractspec-bun-build transpile
- `bun run build:types` — contractspec-bun-build types
- `bun run prebuild` — contractspec-bun-build prebuild

## Recent Updates

- Replace eslint+prettier by biomejs to optimize speed.
- Resolve lint, build, and type errors across nine packages.
- Add Composio universal fallback, fix provider-ranking types, and expand package exports.
- Add first-class transport, auth, versioning, and BYOK support across all integrations.
- Add AI provider ranking system with ranking-driven model selection.

## Notes

- Depends on `lib.provider-ranking` for scoring logic and ingesters -- this module adds persistence and orchestration.
- Pipeline stages must be idempotent; re-ingesting the same benchmark data should not create duplicates.
- Storage adapters are swappable -- always code against the interface, not the implementation.

## MCP registries

`@lssm-tech/module.provider-ranking/mcp` owns the provider-ranking MCP surface
shared by the `provider-ranking-mcp` app and the docs-site handler in
`bundle.library`: `createProviderRankingMcpRegistries({ store, ingesterRegistry? })`
returns the operation registry (`benchmark.ingest`, `benchmark.runCustom`,
`ranking.refresh`), the `ranking://` resources (leaderboard and per-dimension
leaderboard with optional `transport`/`authMethod` filters, model profile with
`lib.ai-providers` enrichment, raw results) and the `ranking.advisor` prompt.
`store` may be a resolver called per request. Hosts own the MCP server or HTTP
handler, logging and the store lifetime. The handlers keep the command output
shapes (`ingestedAt`, `status`) and do not route through `IngestionPipeline` /
`RankingPipeline`, which return different shapes, record ingestion runs and
report ingest failures as results rather than errors.


## Declared capabilities

### Module Provider Ranking

Capability ID: `package.lssm.tech.module.provider.ranking`

AI provider ranking module with persistence and pipeline orchestration

Use cases:

- Adopt ai provider ranking module with persistence and pipeline orchestration

Constraints:

```json
{
  "platforms": [
    "server"
  ],
  "runtimes": [
    "node"
  ],
  "avoidWhen": [
    "The @lssm-tech/module.provider-ranking package constraints do not match the target runtime or platform."
  ],
  "requires": [
    "TypeScript"
  ]
}
```

Other capability declarations:

```json
{
  "status": "active",
  "aliases": [
    "contractspec",
    "ai",
    "ranking",
    "benchmark",
    "module",
    "provider"
  ],
  "pythonEquivalents": [],
  "alternatives": [],
  "relationships": [],
  "resolutionPriority": 50
}
```

Capability imports:

```json
[
  {
    "from": "@lssm-tech/module.provider-ranking",
    "symbols": []
  },
  {
    "from": "@lssm-tech/module.provider-ranking/entities",
    "symbols": []
  },
  {
    "from": "@lssm-tech/module.provider-ranking/pipeline",
    "symbols": []
  },
  {
    "from": "@lssm-tech/module.provider-ranking/pipeline/ingestion-pipeline",
    "symbols": []
  },
  {
    "from": "@lssm-tech/module.provider-ranking/pipeline/ranking-pipeline",
    "symbols": []
  },
  {
    "from": "@lssm-tech/module.provider-ranking/provider-ranking.feature",
    "symbols": []
  },
  {
    "from": "@lssm-tech/module.provider-ranking/storage",
    "symbols": []
  }
]
```

## Catalogue metadata

```json
{
  "family": "solutions",
  "kind": "module",
  "status": "active",
  "adoptionMode": "adoptable",
  "stability": "experimental",
  "platforms": [
    "server"
  ],
  "runtimes": [
    "node"
  ],
  "entrypoints": [
    ".",
    "./entities",
    "./mcp",
    "./pipeline",
    "./pipeline/ingestion-pipeline",
    "./pipeline/ranking-pipeline",
    "./provider-ranking.feature",
    "./storage"
  ],
  "examples": [],
  "replacements": []
}
```

## Canonical imports

Import paths and symbols below are catalogue declarations. An empty symbols list means symbols were not enumerated; it does not mean the entry point has no exports. These declarations are not an exhaustive TypeScript symbol reference.

```json
[
  {
    "capabilityId": "package.lssm.tech.module.provider.ranking",
    "from": "@lssm-tech/module.provider-ranking",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.module.provider.ranking",
    "from": "@lssm-tech/module.provider-ranking/entities",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.module.provider.ranking",
    "from": "@lssm-tech/module.provider-ranking/pipeline",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.module.provider.ranking",
    "from": "@lssm-tech/module.provider-ranking/pipeline/ingestion-pipeline",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.module.provider.ranking",
    "from": "@lssm-tech/module.provider-ranking/pipeline/ranking-pipeline",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.module.provider.ranking",
    "from": "@lssm-tech/module.provider-ranking/provider-ranking.feature",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.module.provider.ranking",
    "from": "@lssm-tech/module.provider-ranking/storage",
    "symbols": []
  }
]
```

## Declared export entry points

Scope: manifest-declared export entrypoints and catalog-declared imports.

Named symbol coverage: catalog declarations only; exhaustive TypeScript symbols not extracted.

Installation status: not verified.

- `@lssm-tech/module.provider-ranking` — subpath `.`
  - `unconditional`: `./src/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/provider-ranking-module/src/index.ts); verified source file.

- `@lssm-tech/module.provider-ranking/entities` — subpath `./entities`
  - `unconditional`: `./src/entities/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/provider-ranking-module/src/entities/index.ts); verified source file.

- `@lssm-tech/module.provider-ranking/mcp` — subpath `./mcp`
  - `unconditional`: `./src/mcp/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/provider-ranking-module/src/mcp/index.ts); verified source file.

- `@lssm-tech/module.provider-ranking/pipeline` — subpath `./pipeline`
  - `unconditional`: `./src/pipeline/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/provider-ranking-module/src/pipeline/index.ts); verified source file.

- `@lssm-tech/module.provider-ranking/pipeline/ingestion-pipeline` — subpath `./pipeline/ingestion-pipeline`
  - `unconditional`: `./src/pipeline/ingestion-pipeline.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/provider-ranking-module/src/pipeline/ingestion-pipeline.ts); verified source file.

- `@lssm-tech/module.provider-ranking/pipeline/ranking-pipeline` — subpath `./pipeline/ranking-pipeline`
  - `unconditional`: `./src/pipeline/ranking-pipeline.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/provider-ranking-module/src/pipeline/ranking-pipeline.ts); verified source file.

- `@lssm-tech/module.provider-ranking/provider-ranking.feature` — subpath `./provider-ranking.feature`
  - `unconditional`: `./src/provider-ranking.feature.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/provider-ranking-module/src/provider-ranking.feature.ts); verified source file.

- `@lssm-tech/module.provider-ranking/storage` — subpath `./storage`
  - `unconditional`: `./src/storage/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/provider-ranking-module/src/storage/index.ts); verified source file.

## Package publication metadata

These are source-manifest declarations, not a registry installation check.

```json
{
  "types": "./dist/index.d.ts",
  "files": [
    "dist",
    "README.md"
  ],
  "publishExports": {
    ".": {
      "types": "./dist/index.d.ts",
      "browser": "./dist/browser/index.js",
      "bun": "./dist/index.js",
      "node": "./dist/node/index.js",
      "default": "./dist/index.js"
    },
    "./entities": {
      "types": "./dist/entities/index.d.ts",
      "browser": "./dist/browser/entities/index.js",
      "bun": "./dist/entities/index.js",
      "node": "./dist/node/entities/index.js",
      "default": "./dist/entities/index.js"
    },
    "./mcp": {
      "types": "./dist/mcp/index.d.ts",
      "browser": "./dist/browser/mcp/index.js",
      "bun": "./dist/mcp/index.js",
      "node": "./dist/node/mcp/index.js",
      "default": "./dist/mcp/index.js"
    },
    "./pipeline": {
      "types": "./dist/pipeline/index.d.ts",
      "browser": "./dist/browser/pipeline/index.js",
      "bun": "./dist/pipeline/index.js",
      "node": "./dist/node/pipeline/index.js",
      "default": "./dist/pipeline/index.js"
    },
    "./pipeline/ingestion-pipeline": {
      "types": "./dist/pipeline/ingestion-pipeline.d.ts",
      "browser": "./dist/browser/pipeline/ingestion-pipeline.js",
      "bun": "./dist/pipeline/ingestion-pipeline.js",
      "node": "./dist/node/pipeline/ingestion-pipeline.js",
      "default": "./dist/pipeline/ingestion-pipeline.js"
    },
    "./pipeline/ranking-pipeline": {
      "types": "./dist/pipeline/ranking-pipeline.d.ts",
      "browser": "./dist/browser/pipeline/ranking-pipeline.js",
      "bun": "./dist/pipeline/ranking-pipeline.js",
      "node": "./dist/node/pipeline/ranking-pipeline.js",
      "default": "./dist/pipeline/ranking-pipeline.js"
    },
    "./provider-ranking.feature": {
      "types": "./dist/provider-ranking.feature.d.ts",
      "browser": "./dist/browser/provider-ranking.feature.js",
      "bun": "./dist/provider-ranking.feature.js",
      "node": "./dist/node/provider-ranking.feature.js",
      "default": "./dist/provider-ranking.feature.js"
    },
    "./storage": {
      "types": "./dist/storage/index.d.ts",
      "browser": "./dist/browser/storage/index.js",
      "bun": "./dist/storage/index.js",
      "node": "./dist/node/storage/index.js",
      "default": "./dist/storage/index.js"
    }
  }
}
```

## Dependencies

Metadata status: complete pinned manifest.

### Runtime dependencies

- [@lssm-tech/lib.ai-providers](https://lssm.co/docs/packages/lib.ai-providers/): `workspace:^`
- [@lssm-tech/lib.contracts-integrations](https://lssm.co/docs/packages/lib.contracts-integrations/): `workspace:^`
- [@lssm-tech/lib.contracts-runtime-core](https://lssm.co/docs/packages/lib.contracts-runtime-core/): `workspace:^`
- [@lssm-tech/lib.contracts-runtime-kernel](https://lssm.co/docs/packages/lib.contracts-runtime-kernel/): `workspace:^`
- [@lssm-tech/lib.contracts-spec-core](https://lssm.co/docs/packages/lib.contracts-spec-core/): `workspace:^`
- [@lssm-tech/lib.provider-ranking](https://lssm.co/docs/packages/lib.provider-ranking/): `workspace:^`
- [@lssm-tech/lib.schema](https://lssm.co/docs/packages/lib.schema/): `workspace:^`
- `zod`: `catalog:`

### Peer dependencies

No declarations in the inspected manifest.

### Optional dependencies

No declarations in the inspected manifest.

### Development dependencies

- [@lssm-tech/tool.bun](https://lssm.co/docs/packages/tool.bun/): `workspace:*`
- [@lssm-tech/tool.typescript](https://lssm.co/docs/packages/tool.typescript/): `workspace:*`
- `typescript`: `catalog:`

### Peer dependency metadata

```json
{}
```

### Bundled dependencies

```json
null
```

## Package scripts

Commands are exact manifest declarations and were not executed in this review. Script metadata status: complete pinned manifest.

```json
{
  "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
  "publish:pkg:canary": "bun publish:pkg --tag canary",
  "build": "contractspec-bun-build build",
  "build:bundle": "contractspec-bun-build transpile",
  "build:types": "contractspec-bun-build types",
  "dev": "contractspec-bun-build dev",
  "clean": "rimraf dist .turbo",
  "lint": "bun lint:fix",
  "lint:fix": "node ../../../../scripts/biome.cjs check --write --unsafe --only=nursery/useSortedClasses . && node ../../../../scripts/biome.cjs check --write .",
  "lint:check": "node ../../../../scripts/biome.cjs check .",
  "prebuild": "contractspec-bun-build prebuild",
  "typecheck": "tsgo --noEmit"
}
```

## Declared documentation links

- [Module Provider Ranking documentation](https://www.npmjs.com/package/%40lssm-tech%2Fmodule.provider-ranking) — declared link; destination not verified.

```json
{
  "url": "https://www.npmjs.com/package/%40lssm-tech%2Fmodule.provider-ranking",
  "kind": "readme"
}
```

## Existing agent-guide projection

```json
{
  "path": "packages/apps/web-landing/public/llms-packages/module.provider-ranking.txt",
  "route": "/llms/module.provider-ranking",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/module.provider-ranking.txt",
  "blobSha": "19b2b72bb6f8034f6ead965a9da3a12d48007006",
  "sourcePin": "bcc79fcc27c4d801c2119bef81ddcce7b4e86498",
  "bodyEqualsReadme": true,
  "aggregateSourcePath": "packages/apps/web-landing/public/llms-full.txt",
  "aggregateBlobSha": "691b1d33efee24c440598b9106c81432f56aafaf"
}
```
