NPC State And Protocol
NPC state in the UE plugin lives in NPCSlice, not in a standalone immutable FNPC value. The slice mirrors the entity-adapter pattern from @forbocai/core.
Primary Type
The slice keeps an entity map plus ActiveNpcId.
Register An NPC
SetNPCInfo upserts the entity and also makes it active.
Selectors
NPCSlice::SelectNPCById(State, Id)NPCSlice::SelectAllNPCs(State)NPCSlice::SelectActiveNpcId(State)NPCSlice::SelectActiveNPC(State)
Update State
Use slice actions for direct state changes.
SetNPCStatereplaces the full agent stateUpdateNPCStatemerges a JSON delta into the current stateAddToHistory,SetHistory,SetLastAction,BlockAction, andClearBlocksupport the protocol runtime
Run The Protocol
For synchronous tooling, use SDKOps::ProcessNpc(...).
For direct parity with packages/core, dispatch rtk::processNPC(...) yourself from Protocol/ProtocolThunks.h.
Protocol Semantics
- The API can return
IdentifyActor,QueryVector,ExecuteInference, andFinalizeinstructions. QueryVectorrequires local memory support in the runtime.ExecuteInferencerequires local cortex support in the runtime.- On successful finalize, the runtime persists memory instructions, merges state deltas, records the last action, and appends user/assistant history.
- On invalid finalize, the slice records
bIsBlockedandBlockReason.
Convenience Wrappers
SDKOps exposes the same NPC lifecycle in synchronous form:
SDKOps::CreateNpc(Store, Persona)SDKOps::GetActiveNpc(Store)SDKOps::UpdateNpc(Store, NpcId, Delta)SDKOps::ProcessNpc(Store, NpcId, Text)SDKOps::ListNpcs(Store)
