# toStackEnrichment

FUNCTION in `@skmtc/core 0.63.4`

Read the **stack-scoped** enrichment - the run-constant leaf at
`skmtc.config.json#settings.enrichments._stack`, validated through the
caller's schema.

The stack leaf is a single bag shared by every generator in the
composition; it has no single owner. Each consuming generator passes a
**partial** schema describing only the fields it reads - Valibot's
`v.object` ignores unknown keys, so fields other generators consume
don't interfere. The return type is inferred from `schema`.

## Signature

```ts
import { toStackEnrichment } from '@skmtc/core'

toStackEnrichment<EnrichmentType>(
  context: EnrichmentReadContext,
  schema: v.GenericSchema<EnrichmentType>
): EnrichmentType
```

## Parameters

- `context` (EnrichmentReadContext, required)
  - `settings` (ClientSettings | undefined, required)
- `schema` (v.GenericSchema<EnrichmentType>, required)

## Returns

`EnrichmentType`

## Throws

- `Error`: on a malformed block, as above.
