Add timestamp to messages

This commit is contained in:
Mario Zechner 2025-10-26 00:43:43 +02:00
parent ef09efaac9
commit 55dc0b6e08
24 changed files with 388 additions and 220 deletions

View file

@ -1,3 +1,4 @@
import type { AgentState } from "../../agent/agent.js";
import { Store } from "../store.js";
import type { SessionData, SessionMetadata, StoreConfig } from "../types.js";
@ -82,7 +83,12 @@ export class SessionsStore extends Store {
}
// Alias methods for backward compatibility
async saveSession(id: string, state: any, metadata: SessionMetadata | undefined, title?: string): Promise<void> {
async saveSession(
id: string,
state: AgentState,
metadata: SessionMetadata | undefined,
title?: string,
): Promise<void> {
// If metadata is provided, use it; otherwise create it from state
const meta: SessionMetadata = metadata || {
id,
@ -90,7 +96,7 @@ export class SessionsStore extends Store {
createdAt: new Date().toISOString(),
lastModified: new Date().toISOString(),
messageCount: state.messages?.length || 0,
usage: state.usage || {
usage: {
input: 0,
output: 0,
cacheRead: 0,