# @lssm-tech/lib.provider-runtime

Builder provider-runtime helpers for routing, context prep, runtime targets, and receipt normalization.

## Source and release context

- Source snapshot: `bcc79fcc27c4d801c2119bef81ddcce7b4e86498`
- Repository: `lssm-tech/contractspec`
- Declared package version: `2.0.4`
- Package path: `packages/platform/agents/provider-runtime`
- Manifest path: `packages/platform/agents/provider-runtime/package.json`
- Manifest Git blob: `8aead2334c223d0272b40befaa6cf39cffb23f7e`
- Manifest origin: pinned GitHub manifest fetch
- Manual: [@lssm-tech/lib.provider-runtime](https://lssm.co/docs/packages/lib.provider-runtime/)
- 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-runtime)
- [Manifest source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/provider-runtime/package.json)
- [Readme source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/provider-runtime/README.md)
- [Guide source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/lib.provider-runtime.txt)

## Package metadata

```json
{
  "layer": "platform",
  "physicalArea": "agents",
  "primaryArea": "integrations-and-providers",
  "classification": {
    "privateDeclared": null,
    "catalogFamily": "runtime",
    "catalogKind": "library",
    "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-runtime/README.md",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/provider-runtime/README.md",
  "blobSha": "af456ce9e9082c384394c044d80086ba71dbb9d1",
  "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/lib.provider-runtime

Website: https://contractspec.io

Builder provider-runtime helpers for runtime-target normalization, provider registration, routing policy upserts, execution-context preparation, receipt normalization, and comparison records.

## What It Provides

- Runtime-target and external-provider record factories.
- Routing-policy and execution-context normalization helpers.
- Managed-first Builder routing-policy bootstrap helpers.
- Provider-output normalization into receipts, sources, patch proposals, activity records, and mobile review cards.
- Comparison-run record factories shared by Builder runtime and compatibility integrations.

## Public Entry Points

- `.` resolves through `./src/index.ts`
- `./ai-improvement` exposes AI-improvement provider receipt normalization helpers.


## Runtime and credential mode taxonomy

Runtime target modes are limited to `managed`, `local`, and `hybrid`. Credential ownership modes are a separate resolver taxonomy (`managed`, `byok`, `local`, `ephemeral`, and `none`) and must not be accepted as runtime target modes. Provider-runtime helpers filter mixed mode arrays and preserve existing runtime defaults instead of coercing credential ownership tokens such as `byok` into managed runtime execution.

Use `redactCredentialResolverPayload` before logging resolver payloads that may include credential-looking fields. The helper preserves non-secret taxonomy fields such as `runtimeMode` while replacing token, secret, API key, authorization, password, credential, and private-key fields with `[redacted]`.

## Notes

- This package is a compatibility surface. Prefer additive evolution.
- It carries provider/runtime control-plane logic that should remain reusable outside the Builder runtime package.

Provider helpers accept only the supplied workspace fields they read. Normalized output preserves its existing literal shapes and remains structurally assignable to Builder-owned records; the platform never imports Builder workspace/state definitions.


## Declared capabilities

### Lib Provider Runtime

Capability ID: `package.lssm.tech.lib.provider.runtime`

Builder provider-runtime helpers for routing, context prep, runtime targets, and receipt normalization.

Use cases:

- Adopt builder provider-runtime helpers for routing, context prep, runtime targets, and receipt normalization

Constraints:

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

Other capability declarations:

```json
{
  "status": "active",
  "aliases": [
    "contractspec",
    "builder",
    "provider",
    "runtime",
    "typescript",
    "lib"
  ],
  "pythonEquivalents": [],
  "alternatives": [],
  "relationships": [],
  "resolutionPriority": 50
}
```

Capability imports:

```json
[
  {
    "from": "@lssm-tech/lib.provider-runtime",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.provider-runtime/ai-improvement",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.provider-runtime/comparison-run",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.provider-runtime/execution-context",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.provider-runtime/execution-output",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.provider-runtime/managed-builder-bootstrap",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.provider-runtime/managed-builder-bootstrap.resources",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.provider-runtime/managed-builder-runtime-targets",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.provider-runtime/provider-runtime.feature",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.provider-runtime/providers",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.provider-runtime/recommended-builder-setup",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.provider-runtime/routing-policy",
    "symbols": []
  }
]
```

## Catalogue metadata

```json
{
  "family": "runtime",
  "kind": "library",
  "status": "active",
  "adoptionMode": "adoptable",
  "stability": "experimental",
  "platforms": [
    "server"
  ],
  "runtimes": [
    "node"
  ],
  "entrypoints": [
    ".",
    "./ai-improvement",
    "./comparison-run",
    "./execution-context",
    "./execution-output",
    "./managed-builder-bootstrap",
    "./managed-builder-bootstrap.resources",
    "./managed-builder-runtime-targets",
    "./provider-runtime.feature",
    "./providers",
    "./recommended-builder-setup",
    "./routing-policy",
    "./runtime-targets",
    "./sha256",
    "./sha256-constants",
    "./shared"
  ],
  "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.lib.provider.runtime",
    "from": "@lssm-tech/lib.provider-runtime",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.provider.runtime",
    "from": "@lssm-tech/lib.provider-runtime/ai-improvement",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.provider.runtime",
    "from": "@lssm-tech/lib.provider-runtime/comparison-run",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.provider.runtime",
    "from": "@lssm-tech/lib.provider-runtime/execution-context",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.provider.runtime",
    "from": "@lssm-tech/lib.provider-runtime/execution-output",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.provider.runtime",
    "from": "@lssm-tech/lib.provider-runtime/managed-builder-bootstrap",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.provider.runtime",
    "from": "@lssm-tech/lib.provider-runtime/managed-builder-bootstrap.resources",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.provider.runtime",
    "from": "@lssm-tech/lib.provider-runtime/managed-builder-runtime-targets",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.provider.runtime",
    "from": "@lssm-tech/lib.provider-runtime/provider-runtime.feature",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.provider.runtime",
    "from": "@lssm-tech/lib.provider-runtime/providers",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.provider.runtime",
    "from": "@lssm-tech/lib.provider-runtime/recommended-builder-setup",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.provider.runtime",
    "from": "@lssm-tech/lib.provider-runtime/routing-policy",
    "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/lib.provider-runtime` — subpath `.`
  - `unconditional`: `./src/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/provider-runtime/src/index.ts); verified source file.

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

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

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

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

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

- `@lssm-tech/lib.provider-runtime/managed-builder-bootstrap.resources` — subpath `./managed-builder-bootstrap.resources`
  - `unconditional`: `./src/managed-builder-bootstrap.resources.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/provider-runtime/src/managed-builder-bootstrap.resources.ts); verified source file.

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

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

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

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

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

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

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

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

- `@lssm-tech/lib.provider-runtime/shared` — subpath `./shared`
  - `unconditional`: `./src/shared.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/provider-runtime/src/shared.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"
    },
    "./ai-improvement": {
      "types": "./dist/ai-improvement.d.ts",
      "browser": "./dist/browser/ai-improvement.js",
      "bun": "./dist/ai-improvement.js",
      "node": "./dist/node/ai-improvement.js",
      "default": "./dist/ai-improvement.js"
    },
    "./comparison-run": {
      "types": "./dist/comparison-run.d.ts",
      "browser": "./dist/browser/comparison-run.js",
      "bun": "./dist/comparison-run.js",
      "node": "./dist/node/comparison-run.js",
      "default": "./dist/comparison-run.js"
    },
    "./execution-context": {
      "types": "./dist/execution-context.d.ts",
      "browser": "./dist/browser/execution-context.js",
      "bun": "./dist/execution-context.js",
      "node": "./dist/node/execution-context.js",
      "default": "./dist/execution-context.js"
    },
    "./execution-output": {
      "types": "./dist/execution-output.d.ts",
      "browser": "./dist/browser/execution-output.js",
      "bun": "./dist/execution-output.js",
      "node": "./dist/node/execution-output.js",
      "default": "./dist/execution-output.js"
    },
    "./managed-builder-bootstrap": {
      "types": "./dist/managed-builder-bootstrap.d.ts",
      "browser": "./dist/browser/managed-builder-bootstrap.js",
      "bun": "./dist/managed-builder-bootstrap.js",
      "node": "./dist/node/managed-builder-bootstrap.js",
      "default": "./dist/managed-builder-bootstrap.js"
    },
    "./managed-builder-bootstrap.resources": {
      "types": "./dist/managed-builder-bootstrap.resources.d.ts",
      "browser": "./dist/browser/managed-builder-bootstrap.resources.js",
      "bun": "./dist/managed-builder-bootstrap.resources.js",
      "node": "./dist/node/managed-builder-bootstrap.resources.js",
      "default": "./dist/managed-builder-bootstrap.resources.js"
    },
    "./managed-builder-runtime-targets": {
      "types": "./dist/managed-builder-runtime-targets.d.ts",
      "browser": "./dist/browser/managed-builder-runtime-targets.js",
      "bun": "./dist/managed-builder-runtime-targets.js",
      "node": "./dist/node/managed-builder-runtime-targets.js",
      "default": "./dist/managed-builder-runtime-targets.js"
    },
    "./provider-runtime.feature": {
      "types": "./dist/provider-runtime.feature.d.ts",
      "browser": "./dist/browser/provider-runtime.feature.js",
      "bun": "./dist/provider-runtime.feature.js",
      "node": "./dist/node/provider-runtime.feature.js",
      "default": "./dist/provider-runtime.feature.js"
    },
    "./providers": {
      "types": "./dist/providers.d.ts",
      "browser": "./dist/browser/providers.js",
      "bun": "./dist/providers.js",
      "node": "./dist/node/providers.js",
      "default": "./dist/providers.js"
    },
    "./recommended-builder-setup": {
      "types": "./dist/recommended-builder-setup.d.ts",
      "browser": "./dist/browser/recommended-builder-setup.js",
      "bun": "./dist/recommended-builder-setup.js",
      "node": "./dist/node/recommended-builder-setup.js",
      "default": "./dist/recommended-builder-setup.js"
    },
    "./routing-policy": {
      "types": "./dist/routing-policy.d.ts",
      "browser": "./dist/browser/routing-policy.js",
      "bun": "./dist/routing-policy.js",
      "node": "./dist/node/routing-policy.js",
      "default": "./dist/routing-policy.js"
    },
    "./runtime-targets": {
      "types": "./dist/runtime-targets.d.ts",
      "browser": "./dist/browser/runtime-targets.js",
      "bun": "./dist/runtime-targets.js",
      "node": "./dist/node/runtime-targets.js",
      "default": "./dist/runtime-targets.js"
    },
    "./sha256": {
      "types": "./dist/sha256.d.ts",
      "browser": "./dist/browser/sha256.js",
      "bun": "./dist/sha256.js",
      "node": "./dist/node/sha256.js",
      "default": "./dist/sha256.js"
    },
    "./sha256-constants": {
      "types": "./dist/sha256-constants.d.ts",
      "browser": "./dist/browser/sha256-constants.js",
      "bun": "./dist/sha256-constants.js",
      "node": "./dist/node/sha256-constants.js",
      "default": "./dist/sha256-constants.js"
    },
    "./shared": {
      "types": "./dist/shared.d.ts",
      "browser": "./dist/browser/shared.js",
      "bun": "./dist/shared.js",
      "node": "./dist/node/shared.js",
      "default": "./dist/shared.js"
    }
  }
}
```

## Dependencies

Metadata status: complete pinned manifest.

### Runtime dependencies

- [@lssm-tech/lib.contracts-spec-core](https://lssm.co/docs/packages/lib.contracts-spec-core/): `workspace:^`
- [@lssm-tech/lib.mobile-control](https://lssm.co/docs/packages/lib.mobile-control/): `workspace:^`
- [@lssm-tech/lib.orchestration-spec](https://lssm.co/docs/packages/lib.orchestration-spec/): `workspace:^`
- [@lssm-tech/lib.provider-spec](https://lssm.co/docs/packages/lib.provider-spec/): `workspace:^`

### 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 .",
  "test": "bun test",
  "prebuild": "contractspec-bun-build prebuild",
  "typecheck": "tsgo --noEmit"
}
```

## Declared documentation links

- [Lib Provider Runtime documentation](https://www.npmjs.com/package/%40lssm-tech%2Flib.provider-runtime) — declared link; destination not verified.

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

## Existing agent-guide projection

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