V1 Web PWA · Surface walkthrough

Studio Hathor · NPC Safety Guardrails

A per-surface walkthrough of the V1 Web PWA studio surface: layout, states, interactions, data, and cross-references.

walked
8sections2 minread

On this page

Context. surface studio · domain hathor · route /studio/hathor/npc-safety-guardrails · auth signed-in + studio entitlement · source apps/oshun/web/src/app/studio/hathor/npc-safety-guardrails/page.tsx

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)

Purpose#

Admin lane console for the real @hathor/llm-npc SafetyFilter. Screen a candidate NPC line against the content-filter categories at a chosen strictness, with optional custom blocked phrases and allowed exceptions, and read back whether the line is safe, which categories flagged, the confidence, and a sanitized rewrite. Admin-scoped and fail-closed.

Entry points#

  • Quick-action link from /studio/hathor/npc-dialogue-generation (this page links out to npc-dialogue-generation)
  • Aggregator embed: StudioHathorLlmNpcWorkspace mounts this workspace inline as its "NPC Safety Guardrails Lane"
  • Direct URL / bookmark — yes; alternates.canonical set
  • Studio overview — see ../../studio-overview.md

Layout regions#

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

  • Workspace <section data-hathor-npc-safety-guardrails-workspace>:
    • <h1> (WorkspaceHeading) "Hathor NPC Safety Guardrails Workspace"
    • Summary <p data-hathor-npc-safety-guardrails-summary>
    • The check form lane: data-hathor-nsg-check-form
  • Route Map panel (data-hathor-npc-safety-guardrails-route-map): <h2> "Route Map" + 5 entries from STUDIO_HATHOR_NPC_SAFETY_GUARDRAILS_ROUTE_MAP
  • Quick-action lane: two Link.quickAction anchors — NPC Dialogue Generation, Back to Studio workspace index

States#

  • Loading<p data-hathor-nsg-loading>
  • Unauthorizeddata-hathor-nsg-unauthorized on 401/403 (admin Hathor scope required); fail-closed
  • Errordata-hathor-nsg-error on non-OK GET / malformed catalog
  • Ready (form)data-hathor-nsg-check-form once the catalog loads
  • Resultdata-hathor-nsg-result after a 200 check; data-hathor-nsg-check-error for invalid inputs / non-200

Interactions#

Workspace body (check form lane)#

  • NPC line<textarea data-hathor-nsg-content> (aria-label "npc line")
  • Strictness<select data-hathor-nsg-strictness> (how many pattern hits flag a category)
  • Blocked phrases (comma-sep)<input data-hathor-nsg-blocked> (aria-label "blocked phrases")
  • Allowed exceptions (comma-sep)<input data-hathor-nsg-exceptions> (aria-label "allowed exceptions")
  • Screen line<button data-hathor-nsg-check-submit type="submit"> → POST /v1/admin/hathor/npc-safety-guardrails/check
  • Resultdata-hathor-nsg-verdict, data-hathor-nsg-flagged, data-hathor-nsg-filtered (sanitized rewrite)

Route Map panel#

  • 5 route entries — verify match with STUDIO_HATHOR_NPC_SAFETY_GUARDRAILS_ROUTE_MAP

Quick-action lane#

  • "Open Hathor NPC Dialogue Generation workspace" (→ /studio/hathor/npc-dialogue-generation)
  • "Back to Studio workspace index" (→ /studio)

Data & contracts#

  • Reads: GET /v1/admin/hathor/npc-safety-guardrails on mount
  • Writes: POST /v1/admin/hathor/npc-safety-guardrails/check
  • Realtime: none
  • Caching: client fetch on mount, cache: 'no-store'; buildBffAuthHeaders
  • Auth/role check: admin-scoped fail-closed (401/403); behind the signed-in
    • studio proxy gate

Cross-references#

Open questions / known gaps#

  • Hathor is unconfirmed-v1 per WALKTHROUGH/matrix/routes.csv. Confirm whether the dedicated /studio/hathor/* admin lane consoles ship in V1.
  • The filter is pattern/keyword based at a fixed set of categories; confirm whether an ML-classifier path is planned behind the same lane.
  • Route Map advertises profiles/, rules/, contexts/, and governance/ sub-routes with no page.tsx yet.