# @lssm-tech/app.api-library

## Source and release context

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

## Package metadata

```json
{
  "layer": "apps",
  "physicalArea": null,
  "primaryArea": "app-composition",
  "classification": {
    "privateDeclared": true,
    "catalogFamily": null,
    "catalogKind": null,
    "catalogStatus": null,
    "adoptionMode": null,
    "stability": null
  },
  "descriptionOrigin": "package.json",
  "manifestComplete": true,
  "publicationPolicyApplied": false
}
```

Manifest private flag: true — workspace only.

Primary area: [Application composition and product hosts](https://lssm.co/docs/areas/app-composition/)

## Package guide

```json
{
  "status": "available",
  "sourcePath": "packages/apps/api-library/README.md",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/api-library/README.md",
  "blobSha": "4d1f617b36152e10ca49c0bd1abac7053ca2e9ac",
  "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/app.api-library

**Library API server for ContractSpec documentation and templates. Thin HTTP layer over `bundle.library`.**

> Hosted MCP endpoints were previously removed (zero hosted MCP compute; MCP ships locally via `contractspec mcp`). As of the api-monolith-elysia-convergence, the **builder, channel/control-plane, dispatch, schema, and in-process scheduler hosting has been converged into `@lssm-tech/app.api-application-monolith`** (the managed CompanyOS Elysia host). This server now serves ONLY:
>
> - `/mdx/*` markdown (the deliberate survivor, backed by `bundle.marketing`), and
> - the provider webhook ingress (Slack/Telegram/GitHub/WhatsApp), kept LIVE in parallel until the provider webhook URLs are repointed to the monolith host (human-gated). The webhook routes are stripped in a follow-up after repoint is confirmed.
>
> The Vercel project (`contractspec-library-api`) is retained for markdown + the gated webhook survivor.

## What It Does

- Markdown + webhook survivor — a thin HTTP layer; business logic lives in `bundle.library` / `bundle.marketing`.
- `src/handlers/` retains: `markdown-handler`, the 4 webhook handlers, and the channel/builder runtime resources the webhooks ingest through.
- Control-plane / channel dispatch / builder / schema endpoints are no longer served here — see `@lssm-tech/app.api-application-monolith`.
- Related ContractSpec packages include `@lssm-tech/bundle.library`, `@lssm-tech/bundle.marketing`, `@lssm-tech/bundle.workspace`, `@lssm-tech/integration.provider-messaging`, `@lssm-tech/integration.runtime`, `@lssm-tech/lib.contracts-spec`, ...
- `src/handlers/` contains handlers or demo adapters wired to contract surfaces.

## Running Locally

From `packages/apps/api-library`:
- `bun run dev`
- `bun run start`
- `bun run build`

## Usage

```bash
bun run dev
```


## Architecture

- This app is a thin HTTP layer — all business logic lives in `bundle.library`.
- Elysia server exposing GraphQL, webhooks, control-plane, and channel handlers (no MCP endpoints).
- `src/index.ts` is the root public barrel and package entrypoint.

## Public Entry Points

- This package is a deployable application rather than a library with published subpath exports.

## Local Commands

- `bun run dev` — bun run --watch src/index.ts
- `bun run start` — bun run ./dist/index.js
- `bun run build` — bun run build:types && bun run build:bundle
- `bun run lint` — bun run lint:fix
- `bun run lint:check` — biome check .
- `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
- `bun run clean` — rm -rf dist api/dist
- `bun run build:bundle` — bun build --target node --packages bundle --outfile dist/index.js src/index.ts && mkdir -p api/dist && cp dist/index.js api/dist/index.js
- `bun run build:types` — tsc -p ./tsconfig.json --noEmit
- `bun run postinstall` — if [ "$VERCEL" = "1" ]; then bun run build:bundle; fi

## Recent Updates

- Removed the hosted MCP endpoints (docs/cli/internal/contracts); MCP now ships locally via `contractspec mcp`.
- Replace eslint+prettier by biomejs to optimize speed.
- Resolve lint, build, and type errors across nine packages.
- Expose contract management via CLI and MCP.
- Stabilize lint gate and runtime contract typing.
- Add ai-native messaging channel runtime.
- Inline server into index.ts and add Vercel configs.

## Notes

- Keep this app thin — no business logic here; delegate to `bundle.library`.
- MCP is no longer hosted here; agents/editors must use the local `contractspec mcp` stdio servers. The reusable MCP builders still live in `bundle.library` (`createDocsMcpHandler` remains used by `app.web-landing`).
- API route changes require coordinating with `app.web-landing` and any external clients.

## Build compute policy

Automatic Vercel Git builds are disabled for this app. Build compute is assigned
to Railway; this does not change the existing runtime or domain topology.
See the operator policy and evidence [source link unresolved: `../../../deploy/lssm-ecosystem/build-compute-policy.md`]
for configuration scope and the unqualified Vercel prebuilt delivery gap.

### Railway prebuilt lane

The bounded prebuilt helper [source link unresolved: `../../../deploy/vercel-prebuilt/README.md`] builds
this app on an explicitly bound Railway executor, audits its standalone Bun
function and Node-compatible markdown adapter, and permits only digest-bound Vercel prebuilt
delivery. Preview qualification is recorded separately; production promotion
and other apps are outside this first lane.


### Source links needing reconciliation

- `../../../deploy/lssm-ecosystem/build-compute-policy.md` — source path absent from pinned inventory: deploy/lssm-ecosystem/build-compute-policy.md.
- `../../../deploy/vercel-prebuilt/README.md` — source path absent from pinned inventory: deploy/vercel-prebuilt/README.md.

## Declared capabilities

This manifest does not declare a capability catalogue. Assess the package using its guide, import map and source.

## 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
[]
```

## 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/app.api-library` — subpath `.`
  - `unconditional`: `./src/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/api-library/src/index.ts); verified source file.

## Package publication metadata

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

```json
{
  "types": null,
  "files": null,
  "publishExports": null
}
```

## Dependencies

Metadata status: complete pinned manifest.

### Runtime dependencies

- [@lssm-tech/bundle.library](https://lssm.co/docs/packages/bundle.library/): `workspace:*`
- [@lssm-tech/bundle.marketing](https://lssm.co/docs/packages/bundle.marketing/): `workspace:*`
- [@lssm-tech/lib.contracts-spec](https://lssm.co/docs/packages/lib.contracts-spec/): `workspace:*`
- `elysia`: `catalog:server`

### Peer dependencies

No declarations in the inspected manifest.

### Optional dependencies

No declarations in the inspected manifest.

### Development dependencies

- [@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
{
  "clean": "rm -rf dist api/dist",
  "lint": "bun run 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 .",
  "dev": "bun run --watch src/index.ts",
  "build": "bun run build:types && bun run build:bundle",
  "build:bundle": "bun build --target node --packages bundle --external '@mistralai/mistralai' --external '@google-cloud/storage' --external '@linear/sdk' --external '@notionhq/client' --external '@qdrant/js-client-rest' --external '@elevenlabs/elevenlabs-js' --external '@fal-ai/client' --external '@composio/core' --external 'googleapis' --external 'fathom-typescript' --outfile dist/index.js src/index.ts && mkdir -p api/dist && cp dist/index.js api/dist/index.js",
  "build:types": "bun x --bun tsc -p ./tsconfig.json --noEmit",
  "typecheck": "bun run build:types",
  "test": "bun test",
  "start": "bun run ./dist/index.js"
}
```

## Declared documentation links

No additional documentation links are declared in the inspected catalogue.

## Existing agent-guide projection

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