feat: add episodic history recall
Memind CI / Test, build, and release guards (pull_request) Successful in 4m37s

This commit is contained in:
john
2026-07-22 12:36:13 +08:00
parent 092ed16d82
commit 93d7bc0cd5
17 changed files with 1297 additions and 20 deletions
+18
View File
@@ -779,6 +779,24 @@ export async function migrateSchema(pool) {
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
`);
// Bounded user-visible session text for explicit historical recall.
// Rollback: DROP TABLE h5_episodic_memory_items — source snapshots remain intact.
await pool.query(`
CREATE TABLE IF NOT EXISTS h5_episodic_memory_items (
agent_session_id VARCHAR(128) NOT NULL PRIMARY KEY,
user_id CHAR(36) NOT NULL,
display_title VARCHAR(512) NOT NULL DEFAULT '',
summary_text TEXT NOT NULL,
search_text MEDIUMTEXT NOT NULL,
message_count INT NOT NULL DEFAULT 0,
source_updated_at VARCHAR(64) NOT NULL DEFAULT '',
session_updated_at BIGINT NOT NULL,
indexed_at BIGINT NOT NULL,
KEY idx_h5_episodic_user_updated (user_id, session_updated_at),
CONSTRAINT fk_h5_episodic_user FOREIGN KEY (user_id) REFERENCES h5_users(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
`);
// Session stream replay events (Patch 4c). Rollback: DROP TABLE h5_session_stream_events.
await pool.query(`
CREATE TABLE IF NOT EXISTS h5_session_stream_events (