Skip to content

Graphorin API reference v0.1.0


Graphorin API reference / @graphorin/memory / / SharedMemory

Class: SharedMemory

Defined in: packages/memory/src/tiers/shared-memory.ts:13

SharedMemory — many-to-many attach mode for blocks / facts / rules across multiple agents. Storage adapters represent attachments as a join table (shared_attachments in @graphorin/store-sqlite).

Stable

Constructors

Constructor

ts
new SharedMemory(args): SharedMemory;

Defined in: packages/memory/src/tiers/shared-memory.ts:17

Parameters

ParameterType
args{ store: MemoryStoreAdapter; tracer: Tracer; }
args.storeMemoryStoreAdapter
args.tracerTracer

Returns

SharedMemory

Methods

attach()

ts
attach(
   recordId, 
   agentId, 
userId): Promise<void>;

Defined in: packages/memory/src/tiers/shared-memory.ts:23

Attach recordId to agentId. Idempotent.

Parameters

ParameterType
recordIdstring
agentIdstring
userIdstring

Returns

Promise&lt;void&gt;


detach()

ts
detach(
   recordId, 
   agentId, 
userId): Promise<void>;

Defined in: packages/memory/src/tiers/shared-memory.ts:36

Detach recordId from agentId. Idempotent.

Parameters

ParameterType
recordIdstring
agentIdstring
userIdstring

Returns

Promise&lt;void&gt;


listFor()

ts
listFor(agentId, userId): Promise<readonly MemoryRecord[]>;

Defined in: packages/memory/src/tiers/shared-memory.ts:49

List every attachment for agentId.

Parameters

ParameterType
agentIdstring
userIdstring

Returns

Promise&lt;readonly MemoryRecord[]&gt;