# @hathor/quests

**Facade (shim) — scene-dependency packet contract only.** Quest logic lives
elsewhere; see the pointer table below.

## At a glance

- **Path:** `libs/hathor/quests`
- **Domain:** hathor (active)
- **Owner:** @GreyChimp
- **Docs:** [deep-dive](/docs/domains/hathor/deep-dive) ·
  [systems one-pager](/docs/systems/lib-hathor.md)
- **Nx project:** `@hathor/quests`

## Facade role

This library owns exactly one thing: the **scene-dependency packet** contract
that production- and engine-facing consumers import, validate, and serialize
(quest objectives and story arcs projected as scene dependencies). It holds no
quest logic of its own and must not grow any.

## The contract it owns

- `HathorQuestSceneDependencyPacket` — the scene dependency graph consumers
  exchange, derived from quest objectives and story arcs.
- `createHathorQuestSceneDependencyPacket` /
  `validateHathorQuestSceneDependencyPacket` /
  `serializeHathorQuestSceneDependencyPacket` — build, check, wire-encode.

Golden-file round-trip contract tests (`src/cgi-packet-contract.spec.ts`) cover
the shape, so consumers get explicit breakage instead of silent drift.

## Logic lives in

| Concern                                              | Where it actually lives                        |
| ---------------------------------------------------- | ---------------------------------------------- |
| Quests, objectives, rewards, prerequisites           | `@hathor/narrative` (`quest`)                  |
| Quest runtime state & completion semantics           | `@hathor/narrative` (`quest`)                  |
| Story arcs, beats, arc progression                   | `@hathor/narrative` (`story-graph`)            |
| Quest validation (orphan objectives, unreachability) | `apps/hathor/narrative-api` validation service |
| Quest seeds & promotion from ideas                   | `@hathor/ideation` (`promotion`)               |

## Adding logic here is a bug

New quest behavior belongs in the owning library above — this facade should only
grow when the **scene-dependency contract** changes. A guard test
(`src/facade-guard.spec.ts`) enforces that the source stays under a line budget
and that imports resolve only to public entry points (`@hathor/narrative`),
never deep implementation paths. If the guard fails, move the logic to its
owning library rather than raising the budget.

## Commands

```bash
pnpm nx test @hathor/quests
pnpm nx lint @hathor/quests
```
