API Reference
MemoryListener
Defined in: memory/memory.types.ts:61
Observe a Memory without changing its behavior.
Remarks
Each callback fires after the underlying operation succeeds, so it sees
exactly what happened. Attach with withMemoryListeners (in ../compose) —
pure composition, no subclassing. Listeners react (log, meter, warm caches);
they cannot alter results — for that, wrap the seam with a transforming
decorator instead.
See
Methods
onAppend()?
optional onAppend(sessionId, messages): void | Promise<void>;Defined in: memory/memory.types.ts:73
Fired after an append, with the messages that were stored.
Parameters
| Parameter | Type | Description |
|---|---|---|
sessionId | string | The session that was appended to. |
messages | Message[] | The messages that were stored. |
Returns
void | Promise<void>
onClear()?
optional onClear(sessionId): void | Promise<void>;Defined in: memory/memory.types.ts:78
Fired after a session is cleared.
Parameters
| Parameter | Type | Description |
|---|---|---|
sessionId | string | The session that was cleared. |
Returns
void | Promise<void>
onLoad()?
optional onLoad(sessionId, messages): void | Promise<void>;Defined in: memory/memory.types.ts:67
Fired after a load, with the messages that were returned.
Parameters
| Parameter | Type | Description |
|---|---|---|
sessionId | string | The session that was loaded. |
messages | Message[] | The messages returned by the load. |
Returns
void | Promise<void>