feat(hive-claude): add InfiniteSession (name+store+compaction policy)

This commit is contained in:
müde 2026-07-05 19:38:16 +02:00
commit 80d819e444
8 changed files with 501 additions and 283 deletions

View file

@ -2,14 +2,15 @@
use std::path::PathBuf;
/// Which claude session a run should attach to. Kept separate from [`Config`]
/// so a single config can drive resume + create + `/compact` of the same
/// logical session across turns.
/// How a run attaches to a claude session — the low-level session flag. Kept
/// separate from [`Config`] so one config can drive resume + create +
/// `/compact` of the same logical session. For a self-managing durable
/// session, prefer [`crate::InfiniteSession`] over hand-picking an `Attach`.
#[derive(Debug, Clone)]
pub enum Session {
pub enum Attach {
/// `--resume <id-or-title>` — resume an existing session by UUID or by the
/// display title set via [`Session::Create`]. Yields
/// [`crate::Outcome::SessionNotFound`] if nothing matches.
/// display title set via [`Attach::Create`]. Yields
/// [`crate::Error::SessionNotFound`] if nothing matches.
Resume(String),
/// `--name <title>` — start a new session carrying the given display title
/// (persisted as a `custom-title` event, which `--resume <title>` later
@ -23,7 +24,7 @@ pub enum Session {
}
/// Everything needed to build one headless `claude --print` invocation, minus
/// the [`Session`] attachment (passed separately to [`crate::run`]).
/// the [`Attach`] target (passed separately to [`crate::Claude::run`]).
///
/// Fields map one-to-one to CLI flags; `None`/empty means "don't pass the
/// flag". `--print --verbose --output-format stream-json` are always set by