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

Function writeMemoryEvent

apps/sim/lib/execution/event-buffer.ts:424–446  ·  view source on GitHub ↗
(event: ExecutionEvent)

Source from the content-addressed store, hash-verified

422 context: ExecutionEventWriterContext = {}
423): ExecutionEventWriter {
424 const writeMemoryEvent = async (event: ExecutionEvent) => {
425 const stream = getMemoryStream(executionId)
426 const compactEvent = await compactEventForBuffer(event, context)
427 const entry = {
428 eventId: stream.nextEventId++,
429 executionId,
430 event: compactEvent,
431 }
432 stream.events.push(entry)
433 if (stream.events.length > EVENT_LIMIT) {
434 stream.events = stream.events.slice(-EVENT_LIMIT)
435 const earliestEventId = stream.events[0]?.eventId
436 if (earliestEventId !== undefined && stream.meta) {
437 stream.meta = {
438 ...stream.meta,
439 earliestEventId,
440 updatedAt: new Date().toISOString(),
441 }
442 }
443 }
444 touchMemoryStream(stream)
445 return entry
446 }
447
448 return {
449 write: writeMemoryEvent,

Callers 1

Calls 4

compactEventForBufferFunction · 0.85
touchMemoryStreamFunction · 0.85
getMemoryStreamFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected