Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(threads): add blocking transcript store helpers

Steven Enamakel4804486e60dd
diff --git a/crates/openhuman-core/src/threads/store/blocking.rs b/crates/openhuman-core/src/threads/store/blocking.rs
index 6143a00ec3..b9ddf290b7 100644
--- a/crates/openhuman-core/src/threads/store/blocking.rs
+++ b/crates/openhuman-core/src/threads/store/blocking.rs
@@ -215,6 +215,33 @@ pub async fn delete_thread(
.await
}
+/// [`ConversationStore::transcript_key`] on the blocking pool: the session
+/// store key `thread_id`'s transcripts were first written under, if recorded.
+pub async fn transcript_key(
+ ctx: DispatchCtx,
+ workspace_dir: PathBuf,
+ thread_id: String,
+) -> Result<Option<String>, String> {
+ run("transcript_key", move || {
+ ConversationStore::new(ctx, workspace_dir).transcript_key(&thread_id)
+ })
+ .await
+}
+
+/// [`ConversationStore::record_transcript_key`] on the blocking pool: records
+/// `key` unless the thread already has one, and returns the key in effect.
+pub async fn record_transcript_key(
+ ctx: DispatchCtx,
+ workspace_dir: PathBuf,
+ thread_id: String,
+ key: String,
+) -> Result<String, String> {
+ run("record_transcript_key", move || {
+ ConversationStore::new(ctx, workspace_dir).record_transcript_key(&thread_id, &key)
+ })
+ .await
+}
+
/// [`store::purge_threads`] on the blocking pool.
pub async fn purge_threads(
ctx: DispatchCtx,
diff --git a/crates/openhuman-core/src/threads/store/transcript_key.rs b/crates/openhuman-core/src/threads/store/transcript_key.rs
index 535ce632c1..1717a09ee1 100644
--- a/crates/openhuman-core/src/threads/store/transcript_key.rs
+++ b/crates/openhuman-core/src/threads/store/transcript_key.rs
@@ -85,7 +85,7 @@ impl ConversationStore {
let outcome = self.key_repo().and_then(|repo| {
let id = thread_id.to_string();
repo.run(|docs| async move {
- docs.delete(COLLECTION, &id, Precondition::Any).await
+ docs.delete(COLLECTION, &id, Precondition::None).await
})
.map(|_| ())
.map_err(|e| format!("{e:#}"))