pub enum ActivitySource {
Http,
Mcp,
Hook,
}Expand description
Originating subsystem for an activity entry.
Why: the UI badges each row with its source so operators can tell
whether a write came from the HTTP API, the MCP tool surface, or a
hook-driven path. Threading this through DaemonEvent and the persisted
row keeps the SSE live-stream and the paginated history consistent.
What: enum serialised lowercase ("http", "mcp", "hook") so it
matches the existing convention for serde tag values in this crate.
Test: activity_source_round_trips_via_serde.
Variants§
Http
Mutation came from the REST API (e.g. POST /api/v1/palaces).
Mcp
Mutation came from the MCP tool surface (e.g. memory_remember).
Hook
Mutation came from a hook-driven path. Reserved for future use:
the only current hook (prompt-context) is read-only, so no live
emitter exists yet. Kept in the enum so the persisted layout and
SSE clients accept future hook events without a schema change.
Implementations§
Source§impl ActivitySource
impl ActivitySource
Sourcepub fn as_str(&self) -> &'static str
pub fn as_str(&self) -> &'static str
Stable lower-case label used for filter query params and the
source JSON field.
Why: keeps the wire format aligned with serde’s snake_case rename
without forcing every call site to round-trip through serde when it
just needs the string.
What: returns one of "http", "mcp", "hook".
Test: activity_source_parse_and_back.
Sourcepub fn parse(s: &str) -> Option<Self>
pub fn parse(s: &str) -> Option<Self>
Parse a case-insensitive label. Used by the source= query filter.
Why: GET /api/v1/activity?source=mcp should be friendly about
case and surrounding whitespace; the parser stays narrow so an
unknown label produces None rather than silently matching Http.
What: returns Some(_) for http, mcp, hook (case-insensitive);
None otherwise.
Test: activity_source_parse_and_back.
Trait Implementations§
Source§impl Clone for ActivitySource
impl Clone for ActivitySource
Source§fn clone(&self) -> ActivitySource
fn clone(&self) -> ActivitySource
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ActivitySource
impl Debug for ActivitySource
Source§impl<'de> Deserialize<'de> for ActivitySource
impl<'de> Deserialize<'de> for ActivitySource
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 From<ActivitySource> for CreatorSource
impl From<ActivitySource> for CreatorSource
Source§fn from(s: ActivitySource) -> Self
fn from(s: ActivitySource) -> Self
Source§impl PartialEq for ActivitySource
impl PartialEq for ActivitySource
Source§fn eq(&self, other: &ActivitySource) -> bool
fn eq(&self, other: &ActivitySource) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ActivitySource
impl Serialize for ActivitySource
impl Copy for ActivitySource
impl Eq for ActivitySource
impl StructuralPartialEq for ActivitySource
Auto Trait Implementations§
impl Freeze for ActivitySource
impl RefUnwindSafe for ActivitySource
impl Send for ActivitySource
impl Sync for ActivitySource
impl Unpin for ActivitySource
impl UnsafeUnpin for ActivitySource
impl UnwindSafe for ActivitySource
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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 more