Graphorin API reference v0.7.0
Graphorin API reference / @graphorin/memory / / GraphMemoryStoreExt
Interface: GraphMemoryStoreExt
Defined in: packages/memory/src/internal/storage-adapter.ts:820
Optional storage extension for the lightweight in-SQLite relation graph (P2-1). Owns the canonical entities table, the fact_entities mapping, and the append-only entity_merges ledger. The entity resolution policy (lexical + embedding dedup, optional LLM adjudication) lives in @graphorin/memory; this surface is the pure persistence + the recursive-CTE traversal.
Adapters that opt out leave the property undefined; entity resolution on write degrades to a no-op and search({ expandHops }) skips expansion. The default @graphorin/store-sqlite adapter implements it.
Stable
Methods
expandActivation()?
optional expandActivation(
scope,
seedFactIds,
opts?): Promise<readonly {
depth: number;
fact: Fact;
}[]>;Defined in: packages/memory/src/internal/storage-adapter.ts:871
PPR-lite graded expansion (D5): like expandOneHop but returns each neighbour with its minimum hop depth from the seeds, so the tier can weight it by damped spreading activation. Optional - stores without it fall back to flat one-hop expansion.
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
seedFactIds | readonly string[] |
opts? | ExpandHopsStoreOptions |
Returns
Promise<readonly { depth: number; fact: Fact; }[]>
expandOneHop()
expandOneHop(
scope,
seedFactIds,
opts?): Promise<readonly Fact[]>;Defined in: packages/memory/src/internal/storage-adapter.ts:860
Expand seed facts to neighbours sharing a canonical entity (one-hop CTE).
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
seedFactIds | readonly string[] |
opts? | ExpandHopsStoreOptions |
Returns
Promise<readonly Fact[]>
factsForEntityName()?
optional factsForEntityName(
scope,
normalizedName,
opts?): Promise<readonly Fact[]>;Defined in: packages/memory/src/internal/storage-adapter.ts:881
Exact entity-match retriever (D5): facts linked to the canonical entity for normalizedName. Optional. Powers a precise "facts about <entity>" candidate leg.
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
normalizedName | string |
opts? | ExpandHopsStoreOptions |
Returns
Promise<readonly Fact[]>
findEntityByNormalizedName()?
optional findEntityByNormalizedName(scope, normalizedName): Promise<EntityWithEmbedding | null>;Defined in: packages/memory/src/internal/storage-adapter.ts:837
Uncapped indexed lookup of the canonical root for an exact normalized name. Lets the resolver dedup an exact alias of an arbitrarily-old entity without scanning (and deserializing) the bounded listEntities candidate window (CS-11). Optional: stores without it fall back to the capped lexical scan inside resolveEntityDecision.
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
normalizedName | string |
Returns
Promise<EntityWithEmbedding | null>
getEntity()
getEntity(scope, id): Promise<GraphEntity | null>;Defined in: packages/memory/src/internal/storage-adapter.ts:842
Lookup one entity by id (any merge state).
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
id | string |
Returns
Promise<GraphEntity | null>
linkFactEntity()
linkFactEntity(
factId,
entityId,
role): Promise<void>;Defined in: packages/memory/src/internal/storage-adapter.ts:824
Link a fact's subject / object to a canonical entity (idempotent).
Parameters
| Parameter | Type |
|---|---|
factId | string |
entityId | string |
role | EntityRole |
Returns
Promise<void>
listEntities()
listEntities(scope, opts?): Promise<readonly EntityWithEmbedding[]>;Defined in: packages/memory/src/internal/storage-adapter.ts:826
Candidate entities for the resolver (roots only unless includeMerged).
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
opts? | { includeMerged?: boolean; limit?: number; } |
opts.includeMerged? | boolean |
opts.limit? | number |
Returns
Promise<readonly EntityWithEmbedding[]>
listMerges()
listMerges(scope, opts?): Promise<readonly EntityMergeRecord[]>;Defined in: packages/memory/src/internal/storage-adapter.ts:855
The append-only merge / unmerge ledger, newest first.
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
opts? | { limit?: number; } |
opts.limit? | number |
Returns
Promise<readonly EntityMergeRecord[]>
mergeEntities()
mergeEntities(
scope,
fromId,
intoId,
reason?): Promise<void>;Defined in: packages/memory/src/internal/storage-adapter.ts:846
Merge fromId into intoId's root; auditable + reversible.
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
fromId | string |
intoId | string |
reason? | string |
Returns
Promise<void>
resolveCanonical()
resolveCanonical(scope, id): Promise<string>;Defined in: packages/memory/src/internal/storage-adapter.ts:844
Follow mergedInto to the canonical root id.
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
id | string |
Returns
Promise<string>
unmergeEntity()
unmergeEntity(
scope,
id,
reason?): Promise<void>;Defined in: packages/memory/src/internal/storage-adapter.ts:853
Reverse a merge: make id a root again + record an audit row.
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
id | string |
reason? | string |
Returns
Promise<void>
upsertEntity()
upsertEntity(scope, input): Promise<string>;Defined in: packages/memory/src/internal/storage-adapter.ts:822
Find-or-create the canonical (root) entity for the normalized name.
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
input | EntityUpsertInput |
Returns
Promise<string>