feat: mem slash commands (#11569)

Add 2 slash commands for memories:
* `/m_drop` delete all the memories
* `/m_update` update the memories with phase 1 and 2
This commit is contained in:
jif-oai
2026-02-12 10:39:43 +00:00
committed by GitHub
parent 4027f1f1a4
commit a0dab25c68
6 changed files with 134 additions and 1 deletions

View File

@@ -18,6 +18,32 @@ const MEMORY_CONSOLIDATION_JOB_KEY: &str = "global";
const DEFAULT_RETRY_REMAINING: i64 = 3;
impl StateRuntime {
pub async fn clear_memory_data(&self) -> anyhow::Result<()> {
let mut tx = self.pool.begin().await?;
sqlx::query(
r#"
DELETE FROM stage1_outputs
"#,
)
.execute(&mut *tx)
.await?;
sqlx::query(
r#"
DELETE FROM jobs
WHERE kind = ? OR kind = ?
"#,
)
.bind(JOB_KIND_MEMORY_STAGE1)
.bind(JOB_KIND_MEMORY_CONSOLIDATE_GLOBAL)
.execute(&mut *tx)
.await?;
tx.commit().await?;
Ok(())
}
pub async fn claim_stage1_jobs_for_startup(
&self,
current_thread_id: ThreadId,