Skip to main content

ClaudeHistoryAdapter

Struct ClaudeHistoryAdapter 

Source
pub struct ClaudeHistoryAdapter {
    user_home: Option<PathBuf>,
    shared_dir: Option<PathBuf>,
    agentmux_home: Option<PathBuf>,
}
Expand description

Where Claude homes live. The homes under them — one per account, and channels — are listed again on every discovery (ClaudeHistoryAdapter::base_dirs), because they are created while srv runs: an account added or switched after srv started used to stay invisible until the next restart.

Fields§

§user_home: Option<PathBuf>

The user’s home: ~/.claude and ~/.config/claude-*.

§shared_dir: Option<PathBuf>

<shared>: providers/claude and identities/*.

§agentmux_home: Option<PathBuf>

AgentMux’s home: channels/*/identities/* and dev/…/identities/*.

Implementations§

Source§

impl ClaudeHistoryAdapter

Source

fn push_deduped_dir( dirs: &mut Vec<PathBuf>, seen: &mut HashSet<PathBuf>, path: PathBuf, )

Push path onto dirs iff it’s a real directory AND its canonical (symlink/junction-resolved) form hasn’t already been pushed — the dedup key, not path itself, since two different base_dirs entries can be different paths to the same physical directory (a per-channel isolated projects/ junction and the global location it points at). Falls back to the literal path when canonicalization fails (e.g. a dangling/broken link) rather than silently dropping it.

Source

pub fn new() -> Self

Source

pub(crate) fn with_roots( user_home: Option<PathBuf>, shared_dir: Option<PathBuf>, agentmux_home: Option<PathBuf>, ) -> Self

Source

fn base_dirs(&self, problems: &mut Vec<String>) -> Vec<PathBuf>

Every Claude projects/ directory under the roots, as the filesystem stands now. Deduplicated by canonical (symlink/junction-resolved) path: after Step 3 above, a per-channel isolated projects/ dir may be a junction pointing at the exact same physical location as one of the global <shared>/... entries, and scanning both would surface every session twice.

Source

fn scan_isolated_identities_under( root: &Path, base_dirs: &mut Vec<PathBuf>, seen: &mut HashSet<PathBuf>, max_depth: u8, problems: &mut Vec<String>, )

Find every identities/ directory up to max_depth levels under root, and for each, every <account_id>/claude/projects that exists. Bounded, not an unbounded recursive walk — channel/dev directory layouts are shallow by construction (channels/<slug>/identities/, dev/<branch>/identities/ or dev/<branch>/<clone_id>/identities/), so depth 2 covers every known layout without risking an expensive filesystem walk if something unexpected is nested underneath.

Source

fn count_subagents(session_dir: &Path) -> u32

Count subagent JSONL files in a session’s subagents/ directory.

Source

fn decode_project_path(encoded: &str) -> String

Decode a project directory name back to a path. e.g., “C–Users-user–claw-agentx-workspace” → “C:/Users/user/.claw/agentx-workspace” This is lossy — real hyphens are indistinguishable from path separators.

Source

fn identity_id_from_path(path: &Path) -> String

Parse the account id a session’s absolute file path was discovered under, if any: .../identities/<account_id>/claude/... (both the always-global <shared>/identities/... location and the per-channel isolated <home>/channels/*/identities/... / <home>/dev/*/(*/)?identities/... locations share this same identities/<account_id>/claude/ shape — see new()’s scan roots). Empty string for any other base_dir (personal ~/.claude, the default <shared>/providers/claude/projects, legacy ~/.config/claude-*) — those have no account to attribute to.

Trait Implementations§

Source§

impl HistoryAdapter for ClaudeHistoryAdapter

Source§

fn provider(&self) -> &str

Provider identifier (e.g., “claude”, “codex”, “gemini”, “kimi”, “openclaw”, “pi”).
Source§

fn discover_files(&self) -> Result<Vec<DiscoveredFile>, HistoryError>

Discover all session file paths on disk. Returns (file_path, mtime_ms) pairs, sorted by mtime descending.
Source§

fn discover(&self) -> Result<Discovery, HistoryError>

Self::discover_files, plus what the walk couldn’t read. An adapter whose discovery can’t fail part-way keeps this default.
Source§

fn extract_meta( &self, file_path: &str, ) -> Result<Option<SessionMeta>, HistoryError>

Extract lightweight metadata without full parsing.
Source§

fn parse_file( &self, file_path: &str, ) -> Result<Option<HistorySession>, HistoryError>

Parse a single session file into a full HistorySession.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more