feat: 日志持久化(6h归档) + purge增强(source_type/source_has_status过滤)

- ActivityRecorder 新增 LogPersister 后台线程,每10s增量写入logs/operations.*.log

- 日志每6小时自动gzip压缩归档

- memory_purge 新增 source_type / target_type / source_has_status 过滤条件

- 支持精准清理已归档任务的残留 HAS_STATE 关系
This commit is contained in:
root
2026-04-30 08:36:02 +08:00
parent 6749811e49
commit c046e6ff6a
7 changed files with 404 additions and 53 deletions

View File

@ -146,6 +146,12 @@ MEMORY_TOOLS = [
4. 删除旧记忆:
{"criteria": {"time_before": "2024-01-01"}, "mode": "soft"}
5. 删除残留在已归档任务上的状态关系:
{"criteria": {"relation_type": "HAS_STATE", "source_type": "TaskNode", "source_has_status": "archived"}, "mode": "soft"}
6. 删除特定类型的节点关系:
{"criteria": {"relation_type": "某种关系", "target_type": "某种类型"}, "mode": "soft"}
【重要】删除原则:
- 优先使用 supersede 模式修正错误
- 软删除不会物理删除数据
@ -159,6 +165,9 @@ MEMORY_TOOLS = [
"subject_contains": {"type": "string"},
"relation_type": {"type": "string"},
"target_contains": {"type": "string"},
"source_type": {"type": "string", "description": "源实体类型过滤(如 TaskNode"},
"target_type": {"type": "string", "description": "目标实体类型过滤"},
"source_has_status": {"type": "string", "description": "源实体状态过滤(如 archived"},
"time_before": {"type": "string"},
"session_id": {"type": "string"}
},