MCPcopy Index your code
hub / github.com/simstudioai/sim / appendMemory

Function appendMemory

apps/sim/lib/table/events.ts:192–206  ·  view source on GitHub ↗
(event: TableEvent)

Source from the content-addressed store, hash-verified

190}
191
192function appendMemory(event: TableEvent): TableEventEntry {
193 const stream = getMemoryStream(event.tableId)
194 const entry: TableEventEntry = {
195 eventId: stream.nextEventId++,
196 tableId: event.tableId,
197 event,
198 }
199 stream.events.push(entry)
200 if (stream.events.length > TABLE_EVENT_CAP) {
201 stream.events = stream.events.slice(-TABLE_EVENT_CAP)
202 stream.earliestEventId = stream.events[0]?.eventId
203 }
204 stream.expiresAt = Date.now() + TABLE_EVENT_TTL_SECONDS * 1000
205 return entry
206}
207
208function readMemory(tableId: string, afterEventId: number): TableEventsReadResult {
209 pruneExpiredMemoryStreams()

Callers 1

appendTableEventFunction · 0.85

Calls 2

getMemoryStreamFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected