Runtime Architecture
The current UE plugin mirrors the architecture of @forbocai/core and @forbocai/node: a central store, pure slice reducers/selectors, and thunk-based side effects.
Root State
Create a store with:
Use ConfigureSDKStore() only when you explicitly want the plugin’s shared helper-layer store.
Pure And Impure Boundaries
Pure pieces
- slice reducers
- slice action creators
- selectors
- entity adapter updates
- JSON state-delta merge logic in
NPCSlice
Impure pieces
- API calls in
APISlice - local llama.cpp model load/inference
- local SQLite memory access
- Arweave upload/download helpers
- commandlet and Blueprint wrapper layers
The impure work is isolated in thunks, just as it is in the TypeScript SDKs.
Middleware
createNpcRemovalListener() is the main cross-slice listener in RuntimeStore.h.
When an NPC is removed, it clears:
- directives for that NPC
- bridge validation state
- ghost session state
- soul slice state
- NPC block state
- memory state if the removed NPC was the active NPC
This is the UE equivalent of the coordinated cleanup behavior in the core SDK.
Thunks First, Wrappers Second
Direct thunk usage is the canonical runtime model:
SDKOps::* in CLI/CliOperations.h does not implement a separate system. It dispatches those same thunks and blocks on the resulting func::AsyncResult<T>.
Functional Core Utilities
The plugin still uses functional_core.hpp, but now as support infrastructure for the store/thunk runtime rather than as a separate end-user API surface.
Key types used throughout the runtime:
func::Maybe<T>func::Either<L, R>func::AsyncResult<T>func::TestResult<T>func::ValidationPipeline<I, O>
See Functional Core for the helper-layer details.
