refactor: unify agent session persistence
This commit is contained in:
+6
-6
@@ -42,15 +42,15 @@ export class MemoryStore {
|
||||
|
||||
constructor(
|
||||
private readonly baseDir = config.MEMORY_STORAGE_DIR,
|
||||
private readonly historyDir = join(config.PERSISTENCE_HISTORY_DIR, "memory"),
|
||||
private readonly backupDir = join(config.PERSISTENCE_BACKUP_DIR, "memory"),
|
||||
) {}
|
||||
|
||||
async initialize() {
|
||||
await ensureDirectory(this.baseDir);
|
||||
await ensureDirectory(join(this.baseDir, "users"));
|
||||
await ensureDirectory(join(this.baseDir, "workspaces"));
|
||||
// 历史备份与正式数据分目录存放,便于排查和手工恢复。
|
||||
await ensureDirectory(this.historyDir);
|
||||
// 备份与正式数据分目录存放,便于排查和手工恢复。
|
||||
await ensureDirectory(this.backupDir);
|
||||
}
|
||||
|
||||
async upsert(scope: MemoryScope, key: string, draft: MemoryDraft) {
|
||||
@@ -76,7 +76,7 @@ export class MemoryStore {
|
||||
this.filePath(scope, key),
|
||||
renderMemoryMarkdown(scope, entries),
|
||||
{
|
||||
historyDir: this.historyDir,
|
||||
backupDir: this.backupDir,
|
||||
rootDir: this.baseDir,
|
||||
},
|
||||
);
|
||||
@@ -113,7 +113,7 @@ export class MemoryStore {
|
||||
this.filePath(scope, key),
|
||||
renderMemoryMarkdown(scope, entries),
|
||||
{
|
||||
historyDir: this.historyDir,
|
||||
backupDir: this.backupDir,
|
||||
rootDir: this.baseDir,
|
||||
},
|
||||
);
|
||||
@@ -132,7 +132,7 @@ export class MemoryStore {
|
||||
this.filePath(scope, key),
|
||||
renderMemoryMarkdown(scope, next),
|
||||
{
|
||||
historyDir: this.historyDir,
|
||||
backupDir: this.backupDir,
|
||||
rootDir: this.baseDir,
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user