pub enum SessionKind {
User,
Subagent,
}Expand description
Who started a session — the session-level counterpart of MessageKind, selected the same
way through a set rather than a flag per class.
The two spellings are the providers’ own. Codex stores this exact enum on its session
metadata as thread_source, with the values user and subagent (167 and 247 of the 414
rollouts this was checked against). subagent is what every provider that marks the concept
calls it: codex’s thread_source value and source.subagent key, the subagents
directory claude and cursor both write, claude’s subagent_type Task parameter, and
gemini-cli’s subagent_N author labels. user is the counterpart because it is the one
reading no provider contradicts — and because a subagent IS an agent, so naming the other
class agent would make [agent] unpredictable, while nothing about a subagent is a user.
Derived from SessionRecord::parent_session_id rather than stored, so the classes are
exhaustive by construction and no row can fall outside them. That is why selection needs no
AllExcept shape the way KindPredicate does: there are no rows of an unknown class.
PATTERN: adding a variant here is the whole cost of adding a session class. It reaches the
CLI through clap’s ValueEnum, the MCP schema through mcp_server::session_kind_values,
and the default result set through SessionKind::default_search_set, all derived from
these variants. Do not pair a new variant with an include_<variant> boolean — one was
tried for MessageKind::HarnessNotice and reverted; see MessageFilters::kinds.
Variants§
User
A session a person started. Codex’s thread_source: "user"; claude’s
isSidechain: false, which held on 143,220 of 143,224 records in top-level transcripts.
Subagent
A run some other session spawned, with SessionRecord::parent_session_id naming the
spawner and SessionRecord::agent_label naming the kind of agent. Codex’s
thread_source: "subagent"; claude’s isSidechain: true. On this machine they
outnumber user-started claude sessions roughly five to one, which is why selecting by
class is worth a parameter.
Implementations§
Source§impl SessionKind
impl SessionKind
pub fn as_str(self) -> &'static str
Sourcepub fn all() -> Vec<Self>
pub fn all() -> Vec<Self>
Every class, in declaration order. Derived from the enum so a new variant is included without editing a second list.
Sourcepub fn default_search_set() -> Vec<Self>
pub fn default_search_set() -> Vec<Self>
The classes a request returns when it names none: all of them.
Unlike MessageKind::default_search_set, which drops harness notices because they are
harness bookkeeping rather than prose, a spawned run holds real work — it is the record
of what a subagent was asked and what it found. Hiding that by default would answer
“what did I do about X” with only half the evidence. A class that IS noise by default
belongs here as an exclusion, the same way HarnessNotice is one.
Sourcepub fn sql_predicate(self, alias: &str) -> String
pub fn sql_predicate(self, alias: &str) -> String
SQL that is true for exactly this class, over a sessions row bound to alias.
Colocated with the variant so adding a class cannot leave its predicate unwritten.
Trait Implementations§
Source§impl Clone for SessionKind
impl Clone for SessionKind
impl Copy for SessionKind
Source§impl Debug for SessionKind
impl Debug for SessionKind
Source§impl<'de> Deserialize<'de> for SessionKind
impl<'de> Deserialize<'de> for SessionKind
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for SessionKind
impl Display for SessionKind
impl Eq for SessionKind
Source§impl FromStr for SessionKind
impl FromStr for SessionKind
Source§impl Hash for SessionKind
impl Hash for SessionKind
Source§impl PartialEq for SessionKind
impl PartialEq for SessionKind
Source§impl Serialize for SessionKind
impl Serialize for SessionKind
impl StructuralPartialEq for SessionKind
Source§impl ValueEnum for SessionKind
impl ValueEnum for SessionKind
Auto Trait Implementations§
impl Freeze for SessionKind
impl RefUnwindSafe for SessionKind
impl Send for SessionKind
impl Sync for SessionKind
impl Unpin for SessionKind
impl UnsafeUnpin for SessionKind
impl UnwindSafe for SessionKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more