sync: Auto-sync from DESKTOP-0O8A1RL at 2026-04-02 19:20:43

Synced files:
- Session logs updated
- Latest context and credentials
- Command/directive updates

Machine: DESKTOP-0O8A1RL
Timestamp: 2026-04-02 19:20:43

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-04-02 19:20:43 -07:00
parent 6e4ebc2db9
commit bff7d9dbbf
8 changed files with 981 additions and 27 deletions

View File

@@ -161,3 +161,25 @@ pub async fn delete_command(pool: &PgPool, id: Uuid) -> Result<bool, sqlx::Error
.await?;
Ok(result.rows_affected() > 0)
}
/// Cancel a command - set status to 'cancelled' and set completed_at
pub async fn cancel_command(pool: &PgPool, id: Uuid) -> Result<(), sqlx::Error> {
sqlx::query(
"UPDATE commands SET status = 'cancelled', completed_at = NOW() WHERE id = $1",
)
.bind(id)
.execute(pool)
.await?;
Ok(())
}
/// Delete all completed, failed, and cancelled commands (bulk clear)
/// Returns the count of deleted rows.
pub async fn delete_finished_commands(pool: &PgPool) -> Result<u64, sqlx::Error> {
let result = sqlx::query(
"DELETE FROM commands WHERE status IN ('completed', 'failed', 'cancelled')",
)
.execute(pool)
.await?;
Ok(result.rows_affected())
}