Skip to main content

KernelEvent

Enum KernelEvent 

Source
#[non_exhaustive]
pub enum KernelEvent {
Show 25 variants SchemaVersion { version: u32, }, TurnStarted { turn_id: TurnId, mode: TurnLoopMode, input_text: String, max_steps: u32, }, TurnEnded { turn_id: TurnId, outcome: TurnOutcome, total_steps: u32, }, ModelRequestIssued { turn_id: TurnId, step_idx: u32, request_fp: RequestFingerprint, token_budget: u32, }, ModelDelta { turn_id: TurnId, step_idx: u32, kind: DeltaKind, call_id: Option<CallId>, text: String, }, ModelMessage { turn_id: TurnId, step_idx: u32, usage: Usage, block_count: u32, text_preview: String, assistant_text: String, }, ToolCallPlanned { turn_id: TurnId, step_idx: u32, call_id: CallId, tool_name: String, input_json: String, decision: PolicyDecision, }, ToolCallStarted { turn_id: TurnId, call_id: CallId, wave_idx: u32, }, ToolCallFinished { turn_id: TurnId, call_id: CallId, tool_name: String, outcome: ToolOutcome, duration_ms: u32, wrote_state: bool, result_preview: String, session_content: String, }, ApprovalResolved { turn_id: TurnId, call_id: CallId, verdict: ApprovalVerdict, }, CompactionArtifactCreated { turn_id: TurnId, artifact_id: ArtifactId, replaced_range: MessageRange, summary_token_count: u32, }, ContextOverflowRecovered { turn_id: TurnId, step_idx: u32, strategy: OverflowStrategy, source_budget_cap: Option<u32>, }, SteerInjected { turn_id: TurnId, step_idx: u32, text: String, }, ScratchpadReminderInjected { turn_id: TurnId, step_idx: u32, area_path: String, }, ScratchpadSummaryInjected { turn_id: TurnId, at_step: u32, }, CycleBriefingInjected { turn_id: TurnId, cycle: u32, step_idx: u32, }, TopicMemoryInjected { turn_id: TurnId, step_idx: u32, block_token_est: u32, }, MemoryPlaneQueried { turn_id: TurnId, step_idx: u32, layer: String, query_key: String, compiler_source: String, }, LayeredContextSeamInjected { turn_id: TurnId, step_idx: u32, level: u32, messages_covered: u32, text_preview: String, }, LoopGuardTriggered { turn_id: TurnId, call_id: CallId, reason: String, }, CapacityCheckpoint { turn_id: TurnId, step_idx: u32, kind: CapacityCheckpointKind, tokens_used: u32, token_budget: u32, action: CapacityAction, cooldown_blocked: bool, }, CycleAdvanced { turn_id: TurnId, from_cycle: u32, to_cycle: u32, reason: String, }, StepLimitContinuation { turn_id: TurnId, step_idx: u32, lht_objective_injected: bool, }, LoopGuardContinuation { turn_id: TurnId, step_idx: u32, }, DeferredToolActivated { turn_id: TurnId, step_idx: u32, tool_name: String, },
}
Expand description

Append-only, strongly-typed, monotonically-sequenced log of all observable state transitions in a single turn.

Replaces: core::Event free-string table, RuntimeEventRecord, EventFrame, and SSE-compat surface — four representations become one.

§Schema evolution

  • Adding a variant: add #[serde(default)] fields; increment nothing.
  • Adding a field to existing variant: add #[serde(default)]; no bump.
  • Removing or renaming: provide upcast_v{N}_to_v{N+1}() and bump SchemaVersion.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

SchemaVersion

First record in every kernel_events table partition. Currently always version: 1.

Fields

§version: u32
§

TurnStarted

Fields

§turn_id: TurnId
§input_text: String

Serialised user message text. Attachments / large blobs: None with a separate EmitArtifact event carrying the blob reference.

§max_steps: u32
§

TurnEnded

Fields

§turn_id: TurnId
§outcome: TurnOutcome
§total_steps: u32
§

ModelRequestIssued

Fields

§turn_id: TurnId
§step_idx: u32
§token_budget: u32

Resolved token budget for this request.

§

ModelDelta

Fields

§turn_id: TurnId
§step_idx: u32
§call_id: Option<CallId>

For ToolCallArg deltas: the call_id of the in-progress tool block.

§text: String
§

ModelMessage

Fields

§turn_id: TurnId
§step_idx: u32
§usage: Usage
§block_count: u32

Number of content blocks in the final message (avoids embedding full message text which belongs in the session store).

§text_preview: String

Truncated assistant text for log-driven transcript rebuild (Phase 3b 5c).

§assistant_text: String

Full assistant text written to session JSON (Phase 3b 5c closure).

§

ToolCallPlanned

Fields

§turn_id: TurnId
§step_idx: u32
§call_id: CallId
§tool_name: String
§input_json: String

JSON-serialised tool input. Large inputs (>16 KB) are stored as an artifact reference; this field holds the truncated preview or {} with a large_input_artifact_id field added.

§

ToolCallStarted

Fields

§turn_id: TurnId
§call_id: CallId
§wave_idx: u32

DAG wave index (0 in legacy sequential mode).

§

ToolCallFinished

Fields

§turn_id: TurnId
§call_id: CallId
§tool_name: String
§outcome: ToolOutcome
§duration_ms: u32
§wrote_state: bool

Whether the tool performed any filesystem/state writes. Mirrors tool_writes_state() at call time; used to rebuild deferred-tool activation projection in Phase 3b.

§result_preview: String

Truncated tool result / error text for log-driven transcript rebuild (Phase 3b 5c).

§session_content: String

Exact tool-result body written to session JSON (Phase 3b 5c closure).

§

ApprovalResolved

Fields

§turn_id: TurnId
§call_id: CallId
§

CompactionArtifactCreated

Fields

§turn_id: TurnId
§artifact_id: ArtifactId
§replaced_range: MessageRange

Message indices [from, to] replaced by this compaction artifact.

§summary_token_count: u32
§

ContextOverflowRecovered

Fields

§turn_id: TurnId
§step_idx: u32
§source_budget_cap: Option<u32>

Token budget cap applied during budget-recompile (None for other strategies).

§

SteerInjected

Fields

§turn_id: TurnId
§step_idx: u32
§text: String
§

ScratchpadReminderInjected

Fields

§turn_id: TurnId
§step_idx: u32
§area_path: String
§

ScratchpadSummaryInjected

Fields

§turn_id: TurnId
§at_step: u32

Step at which the summary was first injected. Subsequent steps read the flag from the projection without a new event.

§

CycleBriefingInjected

Fields

§turn_id: TurnId
§cycle: u32
§step_idx: u32
§

TopicMemoryInjected

Episodic topic-memory block injected into the system prompt (B2 double-write).

Fields

§turn_id: TurnId
§step_idx: u32
§block_token_est: u32

Estimated tokens in the injected <topic_memory> block.

§

MemoryPlaneQueried

Read-side memory plane query executed (v3 Effect::QueryMemory double-write).

Fields

§turn_id: TurnId
§step_idx: u32
§layer: String

working | episodic | archival

§query_key: String
§compiler_source: String

ContextCompiler source id resolved for this query (empty when unknown).

§

LayeredContextSeamInjected

Flash layered-context seam appended as assistant message (v3 #159 double-write).

Fields

§turn_id: TurnId
§step_idx: u32
§level: u32
§messages_covered: u32
§text_preview: String

Truncated seam text for observability (full body remains in session store until 5c).

§

LoopGuardTriggered

Fields

§turn_id: TurnId
§call_id: CallId
§reason: String

“identical_call” | “deferred_set_area_batch” | “failure_halt” …

§

CapacityCheckpoint

Fields

§turn_id: TurnId
§step_idx: u32
§tokens_used: u32
§token_budget: u32
§cooldown_blocked: bool

When true, a proposed guardrail was suppressed by cooldown (replay → Effect::Sleep).

§

CycleAdvanced

Fields

§turn_id: TurnId
§from_cycle: u32
§to_cycle: u32
§reason: String

Human-readable reason emitted by the LHT cycle-advance hook.

§

StepLimitContinuation

Fields

§turn_id: TurnId
§step_idx: u32
§lht_objective_injected: bool
§

LoopGuardContinuation

Fields

§turn_id: TurnId
§step_idx: u32
§

DeferredToolActivated

A previously-deferred tool was promoted into the active tool set.

This event is emitted by maybe_activate_deferred_tool whenever the model requests a tool that was not yet active. It is necessary for Phase 3b: active_tool_names (host state) must be rebuildable from the log so that TurnMachine::step can be a pure function.

Fields

§turn_id: TurnId
§step_idx: u32
§tool_name: String

Implementations§

Source§

impl KernelEvent

Source

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

Extract the turn_id field present in every variant except KernelEvent::SchemaVersion.

Source

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

Variant name string for logging and schema drift CI.

Trait Implementations§

Source§

impl Clone for KernelEvent

Source§

fn clone(&self) -> KernelEvent

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 KernelEvent

Source§

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

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

impl<'de> Deserialize<'de> for KernelEvent

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 KernelEvent

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§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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> 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 = 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.
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