# @lssm-tech/lib.overlay-engine

Runtime overlay engine for ContractSpec personalization and adaptive UI rendering.

## Source and release context

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

## Package metadata

```json
{
  "layer": "platform",
  "physicalArea": "ui",
  "primaryArea": "ui-and-presentations",
  "classification": {
    "privateDeclared": null,
    "catalogFamily": "sharedLibs",
    "catalogKind": "library",
    "catalogStatus": "active",
    "adoptionMode": "adoptable",
    "stability": "stable"
  },
  "descriptionOrigin": "package.json",
  "manifestComplete": true,
  "publicationPolicyApplied": false
}
```

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

Primary area: [Interfaces, presentations and design](https://lssm.co/docs/areas/ui-and-presentations/)

## Package guide

```json
{
  "status": "available",
  "sourcePath": "packages/platform/ui/overlay-engine/README.md",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/ui/overlay-engine/README.md",
  "blobSha": "3dfe8016619165655e83be67967e05b805364816",
  "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.overlay-engine

Website: https://contractspec.io

**Runtime overlay engine for ContractSpec personalization and adaptive UI rendering.**

## What It Provides

- **Layer**: lib.
- **Consumers**: personalization, example-shared-ui, bundles.
- Related ContractSpec packages include `@lssm-tech/lib.contracts-spec`, `@lssm-tech/tool.bun`, `@lssm-tech/tool.typescript`.
- Related ContractSpec packages include `@lssm-tech/lib.contracts-spec`, `@lssm-tech/tool.bun`, `@lssm-tech/tool.typescript`.

## Installation

`npm install @lssm-tech/lib.overlay-engine`

or

`bun add @lssm-tech/lib.overlay-engine`

## Usage

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

## Architecture

- `src/index.ts` is the root public barrel and package entrypoint.
- `src/merger.ts` is part of the package's public or composition surface.
- `src/react.ts` is part of the package's public or composition surface.
- `src/registry.ts` is part of the package's public or composition surface.
- `src/runtime.ts` is part of the package's public or composition surface.
- `src/signer.ts` is part of the package's public or composition surface.
- `src/spec.ts` is part of the package's public or composition surface.
- `src/types.ts` is shared public type definitions.

## Public Entry Points

- Export `.` resolves through `./src/index.ts`.
- Export `./merger` resolves through `./src/merger.ts`.
- Export `./react` resolves through `./src/react.ts`.
- Export `./registry` resolves through `./src/registry.ts`.
- Export `./runtime` resolves through `./src/runtime.ts`.
- Export `./signer` resolves through `./src/signer.ts`.
- Export `./spec` resolves through `./src/spec.ts`.
- Export `./types` resolves through `./src/types.ts`.
- Export `./validator` resolves through `./src/validator.ts`.

## Local Commands

- `bun run dev` — contractspec-bun-build dev
- `bun run build` — contractspec-bun-build build
- `bun run test` — bun test --pass-with-no-tests
- `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.

## Notes

- Overlay spec schema is a contract — changes are breaking for all consumers.
- Signer must preserve cryptographic integrity; do not alter signing algorithm without migration.
- Merger logic must be idempotent — applying the same overlay twice must produce identical results.

## Canonical portable contract ownership

The complete Overlay engine keeps its existing spec, registry, merger, signer,
runtime and React interfaces. Its operation model, feature constructor and
DocBlock type use the existing portable Core owner. This compatible ownership
cut changes only the three contract imports and their declared dependency;
signature verification, canonicalization, scope order, merge order, errors,
defaults and audit callbacks retain their original implementations. All ten
Source roots and their publication conditions remain unchanged. Task-bound
adoption, fresh producer/declaration and affected consumer qualification are
required before campaign acceptance; this Source candidate does not qualify
cryptographic or runtime behavior.

## Declared capabilities

### Lib Overlay Engine

Capability ID: `package.lssm.tech.lib.overlay.engine`

Runtime overlay engine for ContractSpec personalization and adaptive UI rendering.

Use cases:

- Adopt runtime overlay engine for contractspec personalization and adaptive ui rendering

Constraints:

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

Other capability declarations:

```json
{
  "status": "active",
  "aliases": [
    "contractspec",
    "overlay",
    "personalization",
    "ui",
    "rendering",
    "typescript",
    "lib",
    "engine"
  ],
  "pythonEquivalents": [],
  "alternatives": [],
  "relationships": [],
  "resolutionPriority": 50
}
```

Capability imports:

```json
[
  {
    "from": "@lssm-tech/lib.overlay-engine",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.overlay-engine/merger",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.overlay-engine/overlay-engine.feature",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.overlay-engine/react",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.overlay-engine/registry",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.overlay-engine/runtime",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.overlay-engine/signer",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.overlay-engine/spec",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.overlay-engine/types",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.overlay-engine/validator",
    "symbols": []
  }
]
```

## Catalogue metadata

```json
{
  "family": "sharedLibs",
  "kind": "library",
  "status": "active",
  "adoptionMode": "adoptable",
  "stability": "stable",
  "platforms": [
    "server"
  ],
  "runtimes": [
    "node"
  ],
  "entrypoints": [
    ".",
    "./merger",
    "./overlay-engine.feature",
    "./react",
    "./registry",
    "./runtime",
    "./signer",
    "./spec",
    "./types",
    "./validator"
  ],
  "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.overlay.engine",
    "from": "@lssm-tech/lib.overlay-engine",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.overlay.engine",
    "from": "@lssm-tech/lib.overlay-engine/merger",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.overlay.engine",
    "from": "@lssm-tech/lib.overlay-engine/overlay-engine.feature",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.overlay.engine",
    "from": "@lssm-tech/lib.overlay-engine/react",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.overlay.engine",
    "from": "@lssm-tech/lib.overlay-engine/registry",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.overlay.engine",
    "from": "@lssm-tech/lib.overlay-engine/runtime",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.overlay.engine",
    "from": "@lssm-tech/lib.overlay-engine/signer",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.overlay.engine",
    "from": "@lssm-tech/lib.overlay-engine/spec",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.overlay.engine",
    "from": "@lssm-tech/lib.overlay-engine/types",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.overlay.engine",
    "from": "@lssm-tech/lib.overlay-engine/validator",
    "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.overlay-engine` — subpath `.`
  - `unconditional`: `./src/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/ui/overlay-engine/src/index.ts); verified source file.

- `@lssm-tech/lib.overlay-engine/merger` — subpath `./merger`
  - `unconditional`: `./src/merger.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/ui/overlay-engine/src/merger.ts); verified source file.

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

- `@lssm-tech/lib.overlay-engine/react` — subpath `./react`
  - `unconditional`: `./src/react.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/ui/overlay-engine/src/react.ts); verified source file.

- `@lssm-tech/lib.overlay-engine/registry` — subpath `./registry`
  - `unconditional`: `./src/registry.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/ui/overlay-engine/src/registry.ts); verified source file.

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

- `@lssm-tech/lib.overlay-engine/signer` — subpath `./signer`
  - `unconditional`: `./src/signer.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/ui/overlay-engine/src/signer.ts); verified source file.

- `@lssm-tech/lib.overlay-engine/spec` — subpath `./spec`
  - `unconditional`: `./src/spec.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/ui/overlay-engine/src/spec.ts); verified source file.

- `@lssm-tech/lib.overlay-engine/types` — subpath `./types`
  - `unconditional`: `./src/types.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/ui/overlay-engine/src/types.ts); verified source file.

- `@lssm-tech/lib.overlay-engine/validator` — subpath `./validator`
  - `unconditional`: `./src/validator.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/ui/overlay-engine/src/validator.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"
    },
    "./merger": {
      "types": "./dist/merger.d.ts",
      "browser": "./dist/browser/merger.js",
      "bun": "./dist/merger.js",
      "node": "./dist/node/merger.js",
      "default": "./dist/merger.js"
    },
    "./overlay-engine.feature": {
      "types": "./dist/overlay-engine.feature.d.ts",
      "browser": "./dist/browser/overlay-engine.feature.js",
      "bun": "./dist/overlay-engine.feature.js",
      "node": "./dist/node/overlay-engine.feature.js",
      "default": "./dist/overlay-engine.feature.js"
    },
    "./react": {
      "types": "./dist/react.d.ts",
      "browser": "./dist/browser/react.js",
      "bun": "./dist/react.js",
      "node": "./dist/node/react.js",
      "default": "./dist/react.js"
    },
    "./registry": {
      "types": "./dist/registry.d.ts",
      "browser": "./dist/browser/registry.js",
      "bun": "./dist/registry.js",
      "node": "./dist/node/registry.js",
      "default": "./dist/registry.js"
    },
    "./runtime": {
      "types": "./dist/runtime.d.ts",
      "browser": "./dist/browser/runtime.js",
      "bun": "./dist/runtime.js",
      "node": "./dist/node/runtime.js",
      "default": "./dist/runtime.js"
    },
    "./signer": {
      "types": "./dist/signer.d.ts",
      "browser": "./dist/browser/signer.js",
      "bun": "./dist/signer.js",
      "node": "./dist/node/signer.js",
      "default": "./dist/signer.js"
    },
    "./spec": {
      "types": "./dist/spec.d.ts",
      "browser": "./dist/browser/spec.js",
      "bun": "./dist/spec.js",
      "node": "./dist/node/spec.js",
      "default": "./dist/spec.js"
    },
    "./types": {
      "types": "./dist/types.d.ts",
      "browser": "./dist/browser/types.js",
      "bun": "./dist/types.js",
      "node": "./dist/node/types.js",
      "default": "./dist/types.js"
    },
    "./validator": {
      "types": "./dist/validator.d.ts",
      "browser": "./dist/browser/validator.js",
      "bun": "./dist/validator.js",
      "node": "./dist/node/validator.js",
      "default": "./dist/validator.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:^`
- `fast-json-stable-stringify`: `^2.1.0`

### Peer dependencies

- `react`: `catalog:`

### 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
{
  "react": {
    "optional": true
  }
}
```

### 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 --pass-with-no-tests",
  "prebuild": "contractspec-bun-build prebuild",
  "typecheck": "tsgo --noEmit"
}
```

## Declared documentation links

- [Lib Overlay Engine documentation](https://www.npmjs.com/package/%40lssm-tech%2Flib.overlay-engine) — declared link; destination not verified.

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

## Existing agent-guide projection

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