//! The claude backend: a pass-through to `hive_claude`. use std::path::PathBuf; use hive_claude::{CompactionPolicy, Config, InfiniteSession, Progress, SessionStore, Sink}; use crate::{Canceller, Choices, ReportedCost, Result, Runtime}; /// `claude --print` turns on a titled [`InfiniteSession`], which owns /// resume-or-create and compaction. pub struct ClaudeRuntime { session: InfiniteSession

, store: SessionStore, title: String, } impl ClaudeRuntime

{ /// A runtime for the session titled `title`, found through `store` and /// compacted per `policy`. pub fn new(title: impl Into, store: SessionStore, policy: P) -> Self { let title = title.into(); Self { session: InfiniteSession::new(title.clone(), store.clone(), policy), store, title, } } } impl Runtime for ClaudeRuntime

{ async fn run(&self, config: &Config, prompt: &str, sink: &impl Sink) -> Result { Ok(self.session.run(config, prompt, sink).await?) } async fn compact(&self, config: &Config, sink: &impl Sink) -> Result<()> { Ok(self.session.compact(config, sink).await?) } fn archive(&self) -> Result> { Ok(self.store.archive_by_title(&self.title)?) } fn canceller(&self) -> Option { None } fn choices(&self) -> Option { None } fn take_reported_cost(&self) -> Vec { Vec::new() } }