---
path: /studio/hathor/npc-dialogue-generation
surface: studio
domain: hathor
auth: signed-in + studio entitlement
source: apps/oshun/web/src/app/studio/hathor/npc-dialogue-generation/page.tsx
status: walked
last_walked:
  '2026-05-29 automated runtime walk (Playwright headless) — render, /v1 data
  (2xx), console/page-errors, expected content, screenshot verified; live
  screen-reader, touch, offline, and telemetry-delivery checks pending a manual
  AT pass. Evidence: WALKTHROUGH/results/runtime-sweep-2026-05-29.md; body
  re-derived 2026-06-03 from current source (lane-console architecture)'
---

# Studio Hathor · NPC Dialogue Generation

## Purpose

Admin lane console that packs a dialogue context window — running the real
context-budget packer that decides which candidate context items fit a token
budget, which are included, and which overflow (with reasons). The operator
submits a JSON payload of candidate items and the lane returns the packed window.

## Entry points

- **Quick-action link from `/studio/hathor/npc-world-awareness`** (verify against
  that page's source)
- **Direct URL / bookmark** — yes; `alternates.canonical` set to
  `/studio/hathor/npc-dialogue-generation`
- **Studio overview** — see
  [`../../studio-overview.md`](../../studio-overview.md)

## Layout regions

`page.tsx` renders inside `<ShellLayout active="studio">`:

- **Workspace** `<StudioHathorNpcDialogueGenerationWorkspace />`
  (`data-hathor-npc-dialogue-generation-workspace`):
  - `WorkspaceHeading` `<h1>` — "Hathor NPC Dialogue Generation Workspace"
  - Summary `<p data-hathor-npc-dialogue-generation-summary>`
  - **Live Context-Window Packer** lane — `<h2 data-ctx-heading>` (lane
    `data-ctx-lane`); holds the loading / unauthorized / error / form / result
    states
- **Route Map panel** `data-hathor-npc-dialogue-generation-route-map` — `<h2>`
  "Route Map" listing the 5
  `STUDIO_HATHOR_NPC_DIALOGUE_GENERATION_ROUTE_MAP` entries (profiles / dialogues
  / contexts / governance child paths)
- **Quick-action lane** — two `Link.quickAction` anchors: NPC World Awareness,
  Back to Studio workspace index

## States

- [ ] **Loading** — `data-ctx-loading` while the GET catalog request is in flight
- [ ] **Unauthorized (admin-scope 401/403)** — `data-ctx-unauthorized`
- [ ] **Error** — `data-ctx-error`
- [ ] **Ready (form)** — candidate-items textarea + submit
- [ ] **Result** — `data-ctx-result` with `data-ctx-used` (budget used),
      `data-ctx-items` (per-item `data-ctx-item-row` carrying `data-item` /
      `data-included`), `data-ctx-overflow` (with `data-ctx-reason`)
- [ ] **Validation error** — `data-ctx-pack-error`

## Interactions

### Live Context-Window Packer lane

- [ ] **Candidate items** — `<textarea data-ctx-payload>`
- [ ] **Submit** — `<button data-ctx-submit>` "Pack context window" → POST
      `CTX_PACK_ENDPOINT`

### Route Map panel

- [ ] **Route entries** — verify match with
      `STUDIO_HATHOR_NPC_DIALOGUE_GENERATION_ROUTE_MAP` (5 entries)

### Quick-action lane

- [ ] **"Open Hathor NPC World Awareness workspace"** → `/studio/hathor/npc-world-awareness`
- [ ] **"Back to Studio workspace index"** → `/studio`

## Data & contracts

- **Reads**: `GET /v1/admin/hathor/npc-dialogue-generation` (`CTX_ENDPOINT`) —
  the packer catalog (budget defaults)
- **Writes**: `POST /v1/admin/hathor/npc-dialogue-generation/pack`
  (`CTX_PACK_ENDPOINT`) with the candidate items
- **Realtime**: none
- **Caching**: client `fetch` on mount, `cache: 'no-store'`, `buildBffAuthHeaders()`
- **Auth/role check**: admin-scoped, fail-closed on 401/403; route additionally
  gated signed-in + studio by the BFF proxy

## Cross-references

- Parent: [`../../studio-overview.md`](../../studio-overview.md)
- Shell:
  [`../../../shell/04-auth-session.md`](../../../shell/04-auth-session.md)
- Sibling routes:
  [`./studio-hathor-npc-world-awareness.md`](./studio-hathor-npc-world-awareness.md),
  [`./studio-hathor-npc-personality-system.md`](./studio-hathor-npc-personality-system.md)
- Component sources:
  - `apps/oshun/web/src/components/studio/StudioHathorNpcDialogueGenerationWorkspace.tsx`
  - `apps/oshun/web/src/components/studio/StudioHathorNpcDialogueGenerationRouteMap.ts`

## Open questions / known gaps

- [ ] Hathor is `unconfirmed-v1` per `WALKTHROUGH/matrix/routes.csv`. Confirm
      whether the dedicated `/studio/hathor/` lane consoles ship at V1 or are
      internal-only.
- [ ] The lane packs context but does not itself generate dialogue text; confirm
      where the downstream generation step lives.
