Documentation Index
Fetch the complete documentation index at: https://docs.ixo.world/llms.txt
Use this file to discover all available pages before exploring further.
What it is
Shared state is a typed, read-only channel one plugin uses to expose a derived value to other plugins. A producer plugin declares an accessor; consumer plugins read it throughRuntimeContext.shared.
It is the only sanctioned way for two plugins to share live data. Plugins do not import each other’s classes or call each other’s services.
When to use it
| Good fit | Bad fit |
|---|---|
A derived value other plugins might want (e.g. userProfile, lastWeatherQuery, activePageId) | Mutable state with multiple writers |
| Cheap reads that abstract graph-state field names | Large blobs consumers might read but ignore |
Stable shape worth declaring on SharedAccessors for typed reads | Plugin internals other plugins shouldn’t see |
The contract
- Read-only. Consumers never mutate the value. Producers update their own internal state via tool handlers or middleware; the accessor just exposes a view.
- Flat namespace. Keys live in a single global record. Two plugins registering the same key fail boot — no quiet overrides.
- Lazy. Each accessor is a function
(state, runCtx) => value. It runs every time a consumer reads. Cheap reads only; cache in the producer if derivation is expensive. - Optional. A consumer must assume the producer may not be installed.
rtCtx.shared.someKeycan beundefined. Pair shared state withsoftDependsOnso the soft dependency is explicit inqiforge inspect.
Typed reads
SharedAccessors is an open interface. Producer plugins extend it via TypeScript declaration merging so consumers see the right type on rtCtx.shared.someKey. Without merging, the key types as unknown and consumers cast.
Use declaration merging when the shape is stable; skip it for ad-hoc keys.
Read next
Share state (recipe)
Producer and consumer code, declaration merging, the collision check.
Declare dependencies
Pair shared state with
softDependsOn.SharedAccessors.