diff --git a/server/src/llm/eventMemoryService.ts b/server/src/llm/eventMemoryService.ts index ca68a35..076be50 100644 --- a/server/src/llm/eventMemoryService.ts +++ b/server/src/llm/eventMemoryService.ts @@ -6,7 +6,7 @@ export interface EventMemoryService { getRecentEvents(entityId: EntityId, count: number): MemoryEvent[]; selectForPrompt(entityId: EntityId, opts: { maxCount: number; - preferTypes?: MemoryEventType[]; + preferTypes?: readonly MemoryEventType[]; preferEntityId?: EntityId; }): MemoryEvent[]; onEventRecorded: ((entityId: EntityId, event: MemoryEvent) => void) | null; @@ -29,9 +29,12 @@ export function createEventMemoryService(maxEvents = 50): EventMemoryService { onEventRecorded: null, record(entityId: EntityId, eventData: Omit): MemoryEvent { + const id = nextId++; const event: MemoryEvent = { - id: nextId++, + id, ...eventData, + // Use auto-incrementing id as tick proxy when caller passes 0 + tick: eventData.tick || id, }; const buf = getBuffer(entityId); diff --git a/server/src/systems/thoughtSystem.ts b/server/src/systems/thoughtSystem.ts index fcd4879..5a01791 100644 --- a/server/src/systems/thoughtSystem.ts +++ b/server/src/systems/thoughtSystem.ts @@ -166,7 +166,7 @@ function describeRecentEvents( const events = eventMemoryService.selectForPrompt(entityId, { maxCount: 5, - preferTypes: preferTypes as any, + preferTypes, }); if (events.length > 0) { return events.map(e => `- ${e.detail}`).join('\n');