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

Function readMemoryEvents

apps/sim/lib/execution/event-buffer.ts:404–418  ·  view source on GitHub ↗
(executionId: string, afterEventId: number)

Source from the content-addressed store, hash-verified

402}
403
404function readMemoryEvents(executionId: string, afterEventId: number): ExecutionEventsReadResult {
405 pruneExpiredMemoryStreams()
406 const stream = memoryExecutionStreams.get(executionId)
407 if (!stream) return { status: 'ok', events: [] }
408 const earliestEventId = stream.meta?.earliestEventId
409 if (
410 isReplayBeforeAvailableEvents(afterEventId, earliestEventId, stream.meta?.replayStartEventId)
411 ) {
412 return { status: 'pruned', earliestEventId }
413 }
414 return {
415 status: 'ok',
416 events: stream.events.filter((entry) => entry.eventId > afterEventId),
417 }
418}
419
420function createMemoryExecutionEventWriter(
421 executionId: string,

Callers 1

readExecutionEventsStateFunction · 0.85

Calls 3

getMethod · 0.65

Tested by

no test coverage detected