# Handlers, runtimes and transports

Connect declared operations to supplied handlers, client state and the transport your application actually runs.

Source snapshot: bcc79fcc27c4d801c2119bef81ddcce7b4e86498

## Separate reusable runtime from host composition

The runtime kernel owns the shared engine and registry identities while accepting storage, transport, approval, policy and audit responsibilities through supplied ports. Host/environment wiring and concrete providers live above that foundation. Select the server adapter by the application framework and transport, then inspect the client adapter that consumes it. REST, GraphQL and MCP are related projections of selected contracts; registering a contract does not by itself establish an authenticated endpoint or a configured handler.

Source: https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/foundation/contracts-runtime-kernel/README.md
Source: https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/delivery/contracts-runtime-server-rest/README.md

## Follow the request context

The REST README documents createFetchHandler with an asynchronous-capable context factory and an approvalReceipt adapter. Approval evidence is kept outside operation input and is passed to the common handler context. Required approvals are checked before handler invocation by the shared registry. Parameterized REST routes decode path values and make them authoritative over conflicting query/body fields. These details matter when replacing a handwritten endpoint: preserving the public input shape also requires preserving trusted context and precedence rules.

Source: https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/foundation/contracts-runtime-kernel/README.md
Source: https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/delivery/contracts-runtime-server-rest/README.md

## Keep query behavior consistent

REST requests rebuild the canonical QueryEnvelope, including supported search, filter, sort, pagination and consistency metadata. That metadata is separate from flat business input. The documented client deliberately avoids sending client cache policy by default because cache key material may contain tenant or user identifiers that would enter URL logs. Inspect caching, invalidation and offline behavior at the kernel/client boundary instead of hiding those concerns inside each handler. A transport success must still produce the expected canonical result.

Source: https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/foundation/contracts-runtime-kernel/README.md
Source: https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/delivery/contracts-runtime-server-rest/README.md

## Choose one vertical slice

Select a query and a command already declared in source. Identify their registry bindings, handler context, adapter entry and consumer call. Start with the smallest actual host composition that exercises these pieces together.

Source: https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/foundation/contracts-runtime-kernel/README.md
Source: https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/delivery/contracts-runtime-server-rest/README.md

## Inspect the negative path

Trace invalid input, missing trusted identity, required-but-missing approval and an unavailable handler/provider. The relevant question is whether execution stops at the correct boundary and returns a result the caller can handle.

Source: https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/foundation/contracts-runtime-kernel/README.md
Source: https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/delivery/contracts-runtime-server-rest/README.md

## Qualify the selected environment

Use the host’s existing test and build setup for the exact runtime and package versions. Record separately whether you checked source, local handler execution, the transport boundary or a deployed endpoint; those observations answer different questions.

Source: https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/foundation/contracts-runtime-kernel/README.md
Source: https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/delivery/contracts-runtime-server-rest/README.md

## Packages

- [@lssm-tech/lib.contracts-runtime-kernel](https://lssm.co/docs/packages/lib.contracts-runtime-kernel/): Canonical framework-neutral ContractSpec engine, ports and storage; no Forms or backend authority
- [@lssm-tech/lib.contracts-runtime-client-react](https://lssm.co/docs/packages/lib.contracts-runtime-client-react/): React runtime adapters for ContractSpec contracts
- [@lssm-tech/lib.contracts-runtime-core](https://lssm.co/docs/packages/lib.contracts-runtime-core/): Framework-neutral in-house query/cache/offline engine and Transport port for ContractSpec data fetching
- [@lssm-tech/lib.contracts-runtime-server-graphql](https://lssm.co/docs/packages/lib.contracts-runtime-server-graphql/): GraphQL server runtime adapters for ContractSpec contracts
- [@lssm-tech/lib.contracts-runtime-server-mcp](https://lssm.co/docs/packages/lib.contracts-runtime-server-mcp/): MCP server runtime adapters for ContractSpec contracts
- [@lssm-tech/lib.contracts-runtime-server-rest](https://lssm.co/docs/packages/lib.contracts-runtime-server-rest/): REST server runtime adapters for ContractSpec contracts
- [@lssm-tech/lib.graphql-core](https://lssm.co/docs/packages/lib.graphql-core/): Shared GraphQL core: Pothos builder factory, scalars, tracing & complexity
- [@lssm-tech/lib.graphql-federation](https://lssm.co/docs/packages/lib.graphql-federation/): Pothos federation helpers and subgraph schema export utilities
- [@lssm-tech/lib.graphql-prisma](https://lssm.co/docs/packages/lib.graphql-prisma/): Pothos + Prisma builder factory with injectable client/DMMF
