Skip to main content

Event

Enum Event 

Source
pub enum Event {
Show 39 variants SessionStarted { session_id: String, project: String, }, SessionDone { session_id: String, status: String, }, SessionCancelled { session_id: String, }, SessionStatusChanged { session_id: String, status: String, }, SessionInput { session_id: String, input: String, }, ToolStarted { session_id: String, agent: String, agent_id: String, tool: String, call_id: String, args_preview: String, }, ToolFinished { session_id: String, agent: String, agent_id: String, tool: String, call_id: String, success: bool, result_preview: String, }, ToolError { session_id: String, agent: String, agent_id: String, tool: String, call_id: String, error: String, }, SearchPerformed { session_id: String, agent: String, agent_id: String, lane: String, query: String, hit_count: Option<usize>, hits: Vec<SearchHit>, latency_ms: u64, }, MemoryRecalled { session_id: String, agent: String, agent_id: String, query: String, results: Vec<RecalledMemory>, }, Log { session_id: String, level: String, message: String, }, Progress { session_id: String, message: String, percent: Option<f32>, }, Message { session_id: String, text: String, }, PmThinking { session_id: String, text: String, }, PmDelegating { session_id: String, agent: String, task_preview: String, }, AgentSpawned { session_id: String, agent: String, agent_id: String, }, AgentMessage { session_id: String, agent: String, text: String, }, AgentMessageDelta { session_id: String, agent: String, agent_id: String, turn_id: String, delta: String, done: bool, }, AgentDone { session_id: String, agent: String, agent_id: String, status: String, }, AgentFailed { session_id: String, agent: String, agent_id: String, error: String, }, ToolCalled { session_id: String, tool: String, preview: String, }, ToolResult { session_id: String, tool: String, preview: String, }, AstOperation { session_id: String, op: String, detail: String, }, PhaseStarted { session_id: String, phase: String, }, PhaseDone { session_id: String, phase: String, status: String, }, PhaseSkipped { session_id: String, phase: String, persona: String, }, PersonaDetected { session_id: String, persona: String, }, LlmRequested { session_id: String, agent_name: String, model: String, prompt_tokens: Option<u32>, }, LlmResponded { session_id: String, agent_name: String, model: String, completion_tokens: Option<u32>, latency_ms: u64, }, AgentStarted { session_id: String, agent_name: String, agent_id: String, runner_type: String, }, ReportGenerated { session_id: String, agent_name: String, word_count: usize, status: String, }, RecapGenerated { session_id: String, summary: String, table_rows: Vec<(String, String)>, }, IndexReadiness { session_id: String, state: String, index_id: Option<String>, lifecycle_status: Option<String>, chunk_count: Option<u64>, lexical_ready: bool, semantic_ready: bool, graph_ready: bool, summary: String, }, ContextBudget { session_id: String, context_window_tokens: usize, overhead_tokens: usize, overhead_cap_tokens: usize, working_context_pct: u8, overhead_pct: u8, within_budget: bool, compaction_fired: bool, compaction_rounds: usize, }, SessionAdded { session_id: String, workstream_id: String, binding_time: DateTime<Utc>, }, SessionActivityUpdate { session_id: String, last_turn_at: DateTime<Utc>, has_running_task: bool, }, WorkstreamActivationChanged { new_active_id: Option<String>, prior_id: Option<String>, }, WorkstreamStateInferred { workstream_id: String, state: String, reason: String, }, Ping,
}
Expand description

Real-time event types streamed to UI clients (browser, future Tauri).

Why: A single tagged enum keeps wire-format evolution tractable — serde(tag = "type") produces {"type":"agent_message", ...} so the UI can pattern-match on type and the back-end can grow new variants without breaking older clients (unknown variants degrade to “ignored event”). What: Variants cover the full PM lifecycle plus a Ping keepalive so SSE connections don’t time out behind reverse proxies. session_id correlates events to a specific task; the UI filters by session when scoped to a task view. Test: event_serializes_with_type_tag asserts the wire shape for one variant; Event::Ping round-trips for the keepalive path.

Variants§

§

SessionStarted

Fields

§session_id: String
§project: String
§

SessionDone

Fields

§session_id: String
§status: String
§

SessionCancelled

Fields

§session_id: String
§

SessionStatusChanged

A session’s lifecycle status changed (#2054 session-attach protocol).

Why: SessionStarted/SessionDone/SessionCancelled cover the two endpoints of a session’s life, but the daemon-owned Session model (vision spec Axiom 4) also transitions through intermediate states (e.g. created -> running) that a freshly-session.attached client should see. This variant is the generic “status is now X” signal crate::session::registry::SessionRegistry emits on every transition, including the two endpoints (so a client that attaches mid-stream sees a uniform status trail rather than mixing this variant with the older ones). What: status is a lowercase string matching session::model::SessionStatus’s serde representation ("created", "running", "cancelled", "finished", "failed"). Test: session::registry::tests::create_publishes_started_and_status_events.

Fields

§session_id: String
§status: String
§

SessionInput

Input was received for a session via session.send (#2054).

Why: distinct from AgentMessage (sub-agent -> PM activity) — this is the client -> daemon direction. Emitting it is what makes session.send observably reach a freshly-session.attached client in M1, ahead of any real agent-loop wiring (task.*, #2056). What: input is the raw string the caller passed to session.send. Test: session::registry::tests::send_publishes_input_event.

Fields

§session_id: String
§input: String
§

ToolStarted

A tool invocation began. Distinct from the older ToolCalled (which has no started/finished/error distinction or call-correlation id, and predates the session-attach protocol) — this is the tcode session.attach taxonomy’s tool-lifecycle kind.

Why: call_id correlates this with the matching ToolFinished/ ToolError when a session runs multiple tool calls in sequence or concurrently. agent (UI Phase 1) is the attribution key: without it a client can only guess WHICH agent made a call by interleaving this stream with AgentSpawned/AgentDone ordering, which breaks the moment the PM and a delegated engineer have overlapping calls. It is the agent NAME (not a synthetic id) so it joins directly against the pre-existing LlmRequested/LlmResponded.agent_name and AgentSpawned/AgentDone/PmDelegating.agent keys — see UNATTRIBUTED_AGENT for the fallback when a loop runs unattributed. (DOC-39 AC-13.1/13.2) agent alone cannot distinguish two concurrently-delegated sub-agents sharing one name (e.g. two python-engineer delegations) — agent_id is the STABLE per-spawn id minted once per delegation (runner::in_process::InProcessAgentRunner::run_pipeline) that a client must key correlation off instead; agent remains the human-readable label. What: args_preview is truncated via preview() before emission. Test: session::registry::registry_tests::record_tool_started_publishes_event.

Fields

§session_id: String
§agent: String
§agent_id: String

(DOC-39 AC-13) stable per-spawn id — see the variant’s own docs above. #[serde(default)] so a transcript recorded before this field existed still deserializes (decoding to "", not UNATTRIBUTED_AGENT_ID’s sentinel text).

§tool: String
§call_id: String
§args_preview: String
§

ToolFinished

A tool invocation completed (success or failure signalled by success, not a separate error variant — use ToolError for exceptional failures the caller wants to narrate distinctly, e.g. a timeout). agent attributes the call — see Event::ToolStarted. agent_id (DOC-39 AC-13) is the same per-spawn stable id.

Fields

§session_id: String
§agent: String
§agent_id: String
§tool: String
§call_id: String
§success: bool
§result_preview: String
§

ToolError

A tool invocation raised an exceptional error (as opposed to completing with success: false) — e.g. the tool process crashed or timed out rather than returning a normal failure result. agent attributes the call — see Event::ToolStarted. agent_id (DOC-39 AC-13) is the same per-spawn stable id.

Fields

§session_id: String
§agent: String
§agent_id: String
§tool: String
§call_id: String
§error: String
§

SearchPerformed

A search_code call resolved to a concrete trusty-search lane and returned hit_count hits (each with its path/score in hits) in latency_ms (UI Phase 1; hits added DOC-39 Slice B).

Why: ToolStarted/ToolFinished carry only TRUNCATED STRING PREVIEWS of a search’s arguments and rendered result text. The UI’s core bet is that a change is explained by the searches and memories that drove it — which needs the search’s real routed lane, its hit count, and its cost as DATA, not as a prefix of prose the UI would have to re-parse. Emitted ALONGSIDE (never instead of) the generic tool events, so every existing consumer is unaffected. hits extends this the same way: the search-audit UI needs to know WHICH files a search touched, not just how many. What: lane is the lane trusty-search ACTUALLY served, which is not always the mode the model asked for: a semantic/symbol query that hits a still-building index transparently retries on the lexical lane (issue #2783), and that degraded reality is reported as lane: "lexical" — see tools::trusty_search’s SearchLane. hit_count is None when the lane served results whose shape this crate could not count (never a silent zero, which would read as “no hits”); hits is [] in that same uncountable case. Both come from the SAME parse of the tool’s response — see tools::trusty_search::parse_search_hits. latency_ms measures the whole tool call, retry included. Test: session::registry::registry_tests::record_search_performed_publishes_event, tools::trusty_search_tests::resolved_lane_reports_lexical_when_the_retry_served_it, search_hit_round_trips_through_json.

Fields

§session_id: String
§agent: String
§agent_id: String

(DOC-39 AC-13) the dispatching agent’s stable per-spawn id — see Event::ToolStarted’s docs. #[serde(default)] for the same old-transcript-compatibility reason.

§lane: String
§query: String
§hit_count: Option<usize>
§hits: Vec<SearchHit>

Per-hit path + score, in the order the lane returned them (DOC-39 Slice B). #[serde(default)] — absent on any transcript recorded before this field existed, mirroring agent_id’s old-transcript-compatibility contract.

§latency_ms: u64
§

MemoryRecalled

A recall_session call recalled results from durable memory, each flagged with whether it actually ENTERED the model’s context (UI Phase 1).

Why: the differentiating UI surface distinguishes memories that were injected into context from ones that were recalled but HELD BACK — rendered as e.g. “PKCE required… 41% · held” next to the injected ones. recall_session has always known both the scores and which results its token budget dropped, but that knowledge died inside the tool’s rendered text. This is the event that lets it out. What: results is ordered highest-score-first (the order the daemon returned and the tool preserved). injected: false means EXACTLY “recalled but not entered into context” — the tool drops WHOLE lowest-scored results to fit its token budget, so a held-back result is one the model never saw. Test: session::registry::registry_tests::record_memory_recalled_publishes_event, tools::recall_session::tests::telemetry_marks_budget_dropped_results_held_back.

Fields

§session_id: String
§agent: String
§agent_id: String

(DOC-39 AC-13) the dispatching agent’s stable per-spawn id — see Event::ToolStarted’s docs. #[serde(default)] for the same old-transcript-compatibility reason.

§query: String
§

Log

A structured log line scoped to a session, for operators/UIs that want daemon-side diagnostics without parsing stderr.

Fields

§session_id: String
§level: String

"debug" | "info" | "warn" | "error".

§message: String
§

Progress

A coarse progress update for a long-running session operation. percent is None when progress isn’t quantifiable (e.g. “still searching”) — the UI falls back to an indeterminate spinner.

Fields

§session_id: String
§message: String
§percent: Option<f32>
§

Message

A generic, freeform session-scoped message that doesn’t fit any more specific kind — the taxonomy’s catch-all, used sparingly.

Fields

§session_id: String
§text: String
§

PmThinking

Fields

§session_id: String
§text: String
§

PmDelegating

Fields

§session_id: String
§agent: String
§task_preview: String
§

AgentSpawned

(DOC-39 AC-13) not yet emitted by any production call site — reserved for a future agent-lifecycle producer. agent_id is defined now so that producer never has to retrofit it onto an already-shipped wire shape.

Fields

§session_id: String
§agent: String
§agent_id: String
§

AgentMessage

Fields

§session_id: String
§agent: String
§text: String
§

AgentMessageDelta

A streamed chunk of one assistant turn’s text (tcode streaming epic #3696 Slice 0 — contract only, no producer/consumer wired yet).

Why: Event::AgentMessage carries a turn’s full text as a single atomic event, which is fine for a batch-completed turn but cannot represent a turn arriving incrementally — the UI has nothing to render until the whole turn lands. This variant lets a producer emit the SAME turn as a sequence of deltas correlated by turn_id, with two intentionally-supported shapes: Gap A (a harness that only exposes a turn’s full text once it is done) emits ONE delta carrying the whole turn text with done: true; Gap B (a harness with real token-level streaming) emits many small deltas with done: false followed by one final done: true marker. Consumers must handle both without special- casing which shape a given session uses. agent_id mirrors Event::AgentSpawned’s rationale — agent alone cannot disambiguate two concurrently-delegated sub-agents sharing one name — and this codebase runs sub-agents concurrently (AgentLoop/InProcessAgentRunner delegation), so turn_id scoping is a correctness requirement, not a nicety: see turn_id’s own note below. What: turn_id is opaque and MUST be unique within a session across ALL agents, INCLUDING two agents streaming concurrently — a UUID or a session-global monotonic counter satisfies this; a per-agent-local counter (e.g. each AgentLoop restarting its own turn counter from 0) does NOT, and would let two concurrently-streaming agents collide on the same turn_id and interleave into one bubble. Consumers SHOULD therefore group/concatenate deltas by the tuple (agent_id, turn_id), not turn_id alone, as defensive practice against a producer that gets this id-scoping requirement wrong — reconstructing one turn’s text is “concatenate delta in arrival order for one (agent_id, turn_id) key”. done: false means more deltas for this key are coming; done: true means this turn’s bubble is complete and no further deltas for this key will arrive. agent_id is #[serde(default)] so a transcript recorded before this field existed still deserializes (decoding to ""). Test: agent_message_delta_round_trips_through_json, agent_message_delta_full_text_in_one_delta_round_trips (Gap A shape).

Fields

§session_id: String
§agent: String
§agent_id: String
§turn_id: String
§delta: String
§done: bool
§

AgentDone

(DOC-39 AC-13) see Event::AgentSpawned’s note — not yet emitted.

Fields

§session_id: String
§agent: String
§agent_id: String
§status: String
§

AgentFailed

(DOC-39 AC-13) see Event::AgentSpawned’s note — not yet emitted.

Fields

§session_id: String
§agent: String
§agent_id: String
§error: String
§

ToolCalled

Fields

§session_id: String
§tool: String
§preview: String
§

ToolResult

Fields

§session_id: String
§tool: String
§preview: String
§

AstOperation

Emitted when an AST-native tool performs a structural code operation (symbol lookup, edit, insert, import, validation, patch apply, or project pre-indexing). Surfaces in the REPL’s thinking-step display so users can see structural analysis happening in real time.

Why: AST-native tools replace whole-file rewrites with surgical edits. Without dedicated telemetry the user only sees opaque ToolCalled events and loses the narrative of “indexed project → looked up symbol → staged edit → applied patch”. This event makes the AST narrative visible. What: op is a short label (index, lookup, edit, insert, import, validate, patch); detail is a human-readable substring (e.g. “42 symbols from src/” or “fn parse_args in main.rs”). Test: ast_operation_round_trips_through_subscribe round-trips one variant through the bus.

Fields

§session_id: String
§detail: String
§

PhaseStarted

Fields

§session_id: String
§phase: String
§

PhaseDone

Fields

§session_id: String
§phase: String
§status: String
§

PhaseSkipped

#196: a phase was skipped because the active persona opts out of it.

Why: Operators and the UI need visibility when persona-aware skipping changes the executed workflow shape (e.g. [hacker] skipping QA). Without this event the run looks like phases silently disappeared. What: Carries the phase name and the persona that triggered the skip.

Fields

§session_id: String
§phase: String
§persona: String
§

PersonaDetected

#196: emitted once per workflow run when a persona is detected from the task text. Lets the UI surface “running in [hacker] mode” before any phases execute, so users immediately see why the pipeline shape may differ from the default.

Fields

§session_id: String
§persona: String
§

LlmRequested

Emitted just before any LLM chat-completion HTTP call leaves the process. Pairs with LlmResponded so consumers can compute latency independently and surface in-flight calls in the UI.

Why: Operators debugging slow runs need to see WHICH model is in flight at any moment, not just retroactively in totals. prompt_tokens is optional because we don’t always know the prompt size up front. What: agent_name may be empty for top-level PM calls; model is the resolved provider/model string sent on the wire.

Fields

§session_id: String
§agent_name: String
§model: String
§prompt_tokens: Option<u32>
§

LlmResponded

Emitted after every LLM chat-completion HTTP call returns successfully. Carries the wall-clock latency so the UI can render “model X took Yms” badges without waiting for end-of-run perf aggregation.

Fields

§session_id: String
§agent_name: String
§model: String
§completion_tokens: Option<u32>
§latency_ms: u64
§

AgentStarted

Emitted when an agent’s actual work loop begins — distinct from AgentSpawned, which fires when the subprocess is kicked off. AgentStarted fires AFTER the spawn handshake (or at the start of an in-process runner loop) so the UI can show “spawning…” vs. “running” states. runner_type is one of “subprocess”, “claude-code”, “inline”. (DOC-39 AC-13) agent_id — see Event::AgentSpawned’s note; not yet emitted by any production call site.

Fields

§session_id: String
§agent_name: String
§agent_id: String
§runner_type: String
§

ReportGenerated

Emitted when an agent produces its final result before returning to the PM. Lets the UI render “agent X returned a Y-word report” badges without parsing the result body.

Why: A coarse signal of agent productivity that complements AgentDone. word_count is a cheap whitespace-split count; status mirrors the agent’s IPC status field (“success” or “error”).

Fields

§session_id: String
§agent_name: String
§word_count: usize
§status: String
§

RecapGenerated

Emitted when a session recap is generated after N completed tasks (#371). Carries the session ID, a one-line prose summary, and structured table rows. Consumed by TUI (renders ※ recap: banner) and SSE → GUI (RecapPanel).

Fields

§session_id: String
§summary: String

One-line prose summary, e.g. “Fixed a bug where X. Y is now deployed.”

§table_rows: Vec<(String, String)>

Structured rows for the recap table: [(step_label, result_text)]

§

IndexReadiness

The project’s trusty-search index readiness, probed once at task start.

Why: cold-indexing a large repo has a real semantic warm-up window — lexical (BM25) is queryable in seconds while semantic embedding can stay InProgress for minutes. During that window a search returns EMPTY, and an empty result is indistinguishable from “this index is fully ready and the code genuinely isn’t here” — two states that mean OPPOSITE things. trusty_common::search_readiness already computes this per-lane, but only ever logged it to stderr, so no UI (and no consumer of the daemon API at all) could see it. This variant is that value escaping. state is the field that resolves the ambiguity: a UI must NOT render “no results found” while state == "warming", and a "unavailable" index means an empty search is likewise not evidence of absence. What: state is the single coarse discriminant — "ready" (the semantic lane is queryable; an empty search IS evidence of absence), "warming" (at least the semantic lane is still building; an empty search is NOT evidence of absence), or "unavailable" (the probe found no reachable daemon / no derivable index id — likewise not evidence of absence). It keys off IndexReadiness::semantic_search_ready, the module’s canonical “is a search trustworthy yet” predicate, rather than requiring all three lanes — the graph/KG lane is legitimately absent on many indexes (TRUSTY_NO_KG), and gating "ready" on it would report "warming" forever. The per-lane lexical_ready/semantic_ready/ graph_ready flags ship alongside so a UI can still render each lane individually. index_id/lifecycle_status/chunk_count are None exactly when state == "unavailable" (nothing was probed). summary is the same human-readable line the stderr log carries. (DOC-39 §5.6 Slice D) This event is EMITTED ONCE, at task start — a client that attaches after it fired sees nothing. session.get_readiness is the query counterpart: it returns the last-recorded IndexReadinessSnapshot (this variant’s fields, minus session_id) for late attachers, so “what is readiness right now” doesn’t depend on having been subscribed at the right moment. Test: session::registry::registry_tests::record_index_readiness_*, session::registry::registry_tests::warming_index_is_distinguishable_from_ready_with_zero_hits.

Fields

§session_id: String
§state: String

"ready" | "warming" | "unavailable" — see the variant docs.

§index_id: Option<String>
§lifecycle_status: Option<String>
§chunk_count: Option<u64>
§lexical_ready: bool
§semantic_ready: bool
§graph_ready: bool
§summary: String
§

ContextBudget

The working-context budget after one cadence/enforcement turn boundary.

Why: the Infinite Sessions guarantee — working context >= 60% of the model’s window, session overhead <= 40%, at ALL times — is what makes “the workstream never ends” true. agent_loop::cadence recomputed that budget every single turn and then DISCARDED the result: CadenceOutcome was documented “for observability/tests” and observability never consumed it. Nothing could render the guarantee it enforces. This variant is that already-computed value escaping, so a UI can show a live context-budget indicator instead of the user flying blind into a compaction. What: overhead_tokens is the REAL measured estimate_total_tokens of the model-facing transcript after enforcement settled (not a projection); overhead_cap_tokens is the hard cap (context_window * max_overhead_fraction_pct / 100); working_context_pct and overhead_pct are the two derived percentages a budget meter renders (they sum to 100). within_budget is false only on cadence’s one documented floor — pinned/system/user content alone exceeds the cap. compaction_fired marks the turns where history was actually compressed: that content was removed from the model-facing CONTEXT, never from the durable record (the summary left in its place points at recall_session), which is the distinction a UI should make legible rather than rendering compaction as data loss. compaction_rounds counts the cadence round plus every continuous-enforcement round. Emitted ONLY by the PM’s persistent-session loop — cadence is PM-only by construction (AgentLoopConfig.cadence defaults None), so a delegated engineer loop never emits this. Test: agent_loop::tests::cadence_emits_context_budget_snapshot, agent_loop::tests::no_context_budget_event_when_cadence_disabled.

Fields

§session_id: String
§context_window_tokens: usize
§overhead_tokens: usize
§overhead_cap_tokens: usize
§working_context_pct: u8

Percentage of the window left for real work. The Infinite Sessions guarantee is that this stays >= 60.

§overhead_pct: u8

Percentage of the window consumed by session overhead (<= 40).

§within_budget: bool
§compaction_fired: bool
§compaction_rounds: usize
§

SessionAdded

A session was just bound to a workstream — either the ambient default target (§4.2: session.create/task.run called with no explicit workstream_id while a workstream is active) or an explicit workstream_id param (§4.1). session::protocol::create and task::protocol::task_run are the sole emitters, each exactly once per newly-minted session that resolves a binding — a session’s binding is immutable thereafter (§4.1), so this can never fire twice for the same session_id.

Why: DOC-48 §5.3’s event table lists SessionAdded as part of the minimal Phase 1A/1B set so a client observing GET /workstreams/{id}/events learns a new session joined the workstream. Session-scoped (unlike WorkstreamActivationChanged/ WorkstreamStateInferred above) — published via SessionRegistry::record, so it flows through the SAME per-session ring buffer and live bus every other session event does. This is exactly why crate::workstreams::sse::aggregate_live’s dynamic per-event membership re-check (module docs) needs no change to pick it up: by the time this event is recorded, the binding write into crate::workstreams::store::WorkstreamStore has already completed, so the session is already a member of workstream_id’s session_ids when the aggregation route re-checks membership for this event. What: workstream_id and session_id are both carried (unlike §5.3’s literal {session_id, binding_time} table, widened per this ticket’s scope note so a client subscribed to one workstream’s aggregate stream — which tags every forwarded event with its source session_id already — can also learn WHICH workstream without a second round trip); binding_time is the UTC instant the binding was persisted. Test: session::protocol::workstream_binding_tests::create_binds_ambient_active_workstream, session::protocol::workstream_binding_tests::create_binds_explicit_workstream_overriding_ambient, task::protocol::tests::task_run_binds_ambient_active_workstream_and_publishes_session_added.

Fields

§session_id: String
§workstream_id: String
§binding_time: DateTime<Utc>
§

SessionActivityUpdate

A bound session’s activity signal changed — currently fired whenever SessionRegistry::set_run_outcome records a completed run’s turns (the natural “a turn just happened” hook; #2056’s task::executor calls it once per finished execution).

Why: DOC-48 §5.3’s event table lists this alongside SessionAdded so a workstream observer can track which of its bound sessions are live/recently-active without polling session.status per id. Emitted ONLY for workstream-BOUND sessions (Session.workstream_id set): this is a workstream-taxonomy event (§5.3 defines it in that set), an unbound session has no workstream observer to serve — and the M1 cutline e2e contract (tests/m1_cutline_e2e.rs) freezes the exact event-kind sequence a plain, workstream-less session emits, so firing this unconditionally would (and, in PR #3354’s first cut, did) break that frozen baseline for every existing client on both transports. See SessionRegistry::set_run_outcome’s docs for the gate. What: last_turn_at is the UTC instant this update was recorded; has_running_task mirrors SessionRegistry::is_executing at that same instant (true while set_run_outcome’s caller — run_task’s executor — still holds the execution slot when this fires; #2056’s call order means this is realistically always false in practice today, since the executor clears its execution slot only AFTER set_run_outcome returns — carried anyway so a future caller with a genuinely mid-run activity signal has a field to set it on without a schema change). Test: session::registry_tests::set_run_outcome_publishes_activity_update_when_workstream_bound, session::registry_tests::set_run_outcome_stays_silent_for_unbound_session.

Fields

§session_id: String
§last_turn_at: DateTime<Utc>
§has_running_task: bool
§

WorkstreamActivationChanged

The daemon-wide active workstream changed: workstream.activate switched to a different workstream (or activated one from no prior active workstream), or workstream.deactivate cleared the pointer with no successor (crate::workstreams::activation::{activate, deactivate} are the sole emitters — see their docs).

Why: DOC-48 AC-3.3 requires every client observing a workstream to learn when the active workstream changes, including a workstream that was active learning it just got DEACTIVATED (so it can stop treating itself as the ambient default target, §4.2) — not just clients of the newly-active one. crate::events::Event was, until now, exhaustively session-scoped (every variant but Ping carries a session_id); this is a genuinely DAEMON-scoped signal with no owning session, so it reuses the SAME global broadcast bus (the one mechanism already wired to every live SSE subscriber) rather than standing up a second, parallel channel purely to carry one event type — the aggregation route (crate::workstreams::sse::aggregate_live) already subscribes to this bus for its per-session fan-out, so no extra subscription is needed to also observe this variant. What: new_active_id is Some(id) for both a fresh activation (no prior active workstream) and a force-switch; None exactly when workstream.deactivate cleared the pointer with no successor — this widens DOC-48 §5.3’s literal {new_active_id: UUID, prior_id?} table (which only anticipates a switch always landing on a new active workstream) to also cover deactivation, a case the table’s shape otherwise cannot express. prior_id is the workstream that was active immediately before this change, None when there wasn’t one. Emitted only when the persisted active pointer ACTUALLY changed — not on an idempotent re-activation of the already-active workstream, nor on a deactivate of a non-active workstream (both are true no-ops). Not session-scoped: Event::session_id() returns None for this variant, same as Event::Ping. Test: workstreams::activation_tests::activate_with_no_prior_active_publishes_activation_changed, workstreams::activation_tests::activate_with_force_publishes_activation_changed_with_prior, workstreams::activation_tests::activate_already_active_does_not_publish, workstreams::activation_tests::deactivate_active_publishes_activation_changed, workstreams::activation_tests::deactivate_non_active_does_not_publish.

Fields

§new_active_id: Option<String>
§prior_id: Option<String>
§

WorkstreamStateInferred

A workstream’s computed state (DOC-48 §2.2: active | idle | closed) actually transitioned — fired by workstream.activate/deactivate (crate::workstreams::activation) and workstream.close (crate::workstreams::protocol::close) whenever they change it.

Why: DOC-48 §5.3’s event table lists this alongside WorkstreamActivationChanged as part of the minimal Phase 1A set — a client observing one workstream via GET /workstreams/{id}/events needs to learn its OWN state changed (e.g. it was closed) even when no bound session emitted anything, the same gap WorkstreamActivationChanged fills for the daemon-wide active pointer. What: workstream_id names which workstream transitioned; state is its NEW state as a lowercase string ("active" | "idle" | "closed") — deliberately a plain string rather than crate::workstreams::WorkstreamState so this module stays domain-decoupled, matching Event::IndexReadiness/ SessionStatusChanged’s existing “state as a plain string” convention. reason is a short human-readable cause (e.g. "activated", "activated (force-switch)", "deactivated", "closed"). Not session-scoped — grouped with WorkstreamActivationChanged and Ping in session_id(). Test: workstreams::activation_tests::activate_with_no_prior_active_publishes_state_inferred, workstreams::activation_tests::activate_with_force_publishes_state_inferred_for_both, workstreams::activation_tests::deactivate_active_publishes_state_inferred_idle, workstreams::protocol_tests::close_publishes_state_inferred.

Fields

§workstream_id: String
§state: String
§reason: String
§

Ping

Implementations§

Source§

impl Event

Source

pub fn session_id(&self) -> Option<&str>

Return the event’s session_id if it has one. Used by the SSE handler to filter the broadcast stream to a single task subscription.

Why: Variants without a session (currently just Ping) must always pass the filter — losing keepalives would defeat their purpose. What: Returns Some(&str) for variants that carry a session, None for keepalives. The SSE filter treats None as “always include”.

Source

pub fn kind(&self) -> &'static str

The stable kind string for this event — identical to the serde "type" tag #[serde(tag = "type", rename_all = "snake_case")] produces on the wire.

Why (#2055): SessionEventEnvelope carries kind as a top-level field (vision spec’s envelope requirement) so a client can filter/ route on it without parsing into the nested event payload. Hand- written rather than derived from serde reflection (no such API exists without an extra dependency) — kind_matches_serde_tag_for_every_variant guards the two from drifting apart. What: Returns the exact snake_case tag string for every variant. Test: kind_matches_serde_tag_for_every_variant.

Trait Implementations§

Source§

impl Clone for Event

Source§

fn clone(&self) -> Event

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Event

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Event

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Event

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Event

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnsafeUnpin for Event

§

impl UnwindSafe for Event

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
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

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

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

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
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

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
Source§

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

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

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