pub enum KernelInputEvent {
Show 54 variants
SetTools {
tools: Vec<ToolSchema>,
},
SetAvailableSkills {
skills: Vec<SkillMetadata>,
},
SkillActivated {
name: String,
lease_turns: Option<u32>,
},
SkillDeactivated {
name: String,
},
SetStableCoreTools {
tool_ids: Vec<String>,
},
SetMemoryEnabled {
enabled: bool,
},
SetKnowledgeEnabled {
enabled: bool,
},
SetPlanToolEnabled {
enabled: bool,
},
SetTokenizer {
name: String,
},
AddSystemMessage {
content: String,
tokens: u32,
},
AddKnowledgeMessage {
content: String,
tokens: u32,
key: Option<String>,
pinned: bool,
},
RemoveKnowledge {
key: String,
},
AddHistoryMessage {
message: Message,
tokens: Option<u32>,
},
PreloadHistory {
messages: Vec<Message>,
},
MountCapability {
capability: CapabilityDescriptor,
},
UnmountCapability {
capability_kind: CapabilityKind,
id: String,
},
LoadMilestoneContract {
contract: MilestoneContract,
},
LoadGovernancePolicy {
default_action: Option<PolicyAction>,
rules: Vec<PolicyRule>,
vetoed_tools: Vec<String>,
rate_limits: Vec<RateLimitSpec>,
constraints: Vec<ConstraintSpec>,
},
SetSignalPolicy {
policy: SignalPolicyConfig,
},
ForceCompact,
UpdateTask {
update: TaskUpdate,
},
StartRun {
task: RuntimeTask,
run_spec: Option<AgentRunSpec>,
},
ConfigureRun {
config: RunConfig,
},
CapabilityCommand {
command: CapabilityCommand,
},
Resume,
ApprovalResult {
effect_id: String,
approved_calls: Vec<String>,
denied_calls: Vec<String>,
error: Option<String>,
},
WorkflowSpawnResult {
effect_id: String,
started_agent_ids: Vec<String>,
failures: Vec<WorkflowSpawnFailure>,
error: Option<String>,
},
PreemptResult {
effect_id: String,
error: Option<String>,
},
MemoryPersistResult {
effect_id: String,
error: Option<String>,
},
MemoryQueryResult {
effect_id: String,
hits: Vec<MemoryRecall>,
error: Option<String>,
},
LargeResultSpoolResult {
effect_id: String,
spool_ref: Option<String>,
error: Option<String>,
},
PageOutArchiveResult {
effect_id: String,
archive_ref: Option<String>,
error: Option<String>,
},
SetKnowledgeBudget {
ratio: f64,
},
SetCriteriaGate {
enabled: bool,
},
SetRepeatFuse {
enabled: Option<bool>,
deny_after: Option<u32>,
terminate_after: Option<u32>,
},
SetEntropyWatch {
enabled: Option<bool>,
threshold: Option<f64>,
hysteresis: Option<f64>,
cooldown_turns: Option<u32>,
notify_model: Option<bool>,
},
SetSchedulerBudget {
max_wall_ms: Option<u64>,
},
SetResourceQuota {
quota: ResourceQuota,
},
ProviderResult {
effect_id: String,
message: Message,
observed_input_tokens: Option<u32>,
observed_output_tokens: Option<u32>,
now_ms: Option<u64>,
stop_reason: Option<String>,
},
ToolResults {
effect_id: String,
results: Vec<ToolResult>,
},
ProviderError {
effect_id: String,
message: String,
},
DeliverSignal {
delivery_id: String,
attempt: u32,
signal: RuntimeSignal,
},
MilestoneResult {
effect_id: String,
result: MilestoneCheckResult,
},
SpawnSubAgent {
spec: AgentRunSpec,
parent_session_id: String,
},
LoadWorkflow {
spec: WorkflowSpec,
parent_session_id: String,
resumed_submissions: Vec<Vec<WorkflowNode>>,
resumed_submission_bases: Vec<u32>,
resumed_outcomes: Vec<ResumedNodeOutcome>,
},
SubAgentCompleted {
result: SubAgentResult,
},
SubmitWorkflowNodes {
nodes: Vec<WorkflowNode>,
submitter_agent_id: Option<String>,
},
SubmitWorkflow {
spec: WorkflowSpec,
parent_session_id: String,
submitter_agent_id: Option<String>,
},
PageIn {
entries: Vec<PageInEntry>,
},
SetMemoryPolicy {
memory_path: String,
stale_warning_days: u32,
retrieval_top_k: usize,
validation_enabled: bool,
max_content_bytes: Option<u32>,
max_name_length: Option<usize>,
promotion_recall_threshold: Option<u64>,
},
WriteMemory {
memory: MemoryRecord,
},
QueryMemory {
query: MemoryQuery,
},
CompleteRun,
CancelOperation {
operation_id: String,
reason: CancellationReason,
pending_call_ids: Vec<String>,
},
}Variants§
SetTools
Fields
tools: Vec<ToolSchema>SetAvailableSkills
Fields
skills: Vec<SkillMetadata>SkillActivated
P1-B tool gating: the model loaded a skill (name). The SDK emits this when it resolves a
skill tool call. The kernel records it in the active-skill set and resolves the skill’s
allowed_tools from the catalog to narrow the toolset on subsequent turns.
Fields
SkillDeactivated
K3: host-driven skill deactivation (there is deliberately NO model-facing unload — it
invites thrash). The toolset re-widens at the next provider call (an epoch event, same
cache cost class as activation); the skill:<name> knowledge pin drops at the next
boundary sweep. Errs-open: not-active is a no-op.
SetStableCoreTools
P1-B/D: configure the stable-core tool ids (always exposed under skill gating). Set once by the SDK; empty/absent ⇒ skills narrow to exactly their declared tools + meta-tools.
SetMemoryEnabled
SetKnowledgeEnabled
SetPlanToolEnabled
SetTokenizer
AddSystemMessage
AddKnowledgeMessage
Fields
RemoveKnowledge
K1: mark a keyed knowledge entry for removal at the next compaction/renewal boundary. Errs-open: unknown key is a no-op.
AddHistoryMessage
PreloadHistory
MountCapability
Fields
capability: CapabilityDescriptorUnmountCapability
LoadMilestoneContract
Fields
contract: MilestoneContractLoadGovernancePolicy
Install a governance policy. Once loaded, every model-proposed tool call is evaluated in-kernel before execution. Omitting this event leaves the gate disabled (pre-governance behavior).
Fields
default_action: Option<PolicyAction>rules: Vec<PolicyRule>rate_limits: Vec<RateLimitSpec>constraints: Vec<ConstraintSpec>SetSignalPolicy
Atomically replace the complete signal-routing policy.
Fields
policy: SignalPolicyConfigForceCompact
UpdateTask
Fields
update: TaskUpdateStartRun
ConfigureRun
K2: apply a bundle of run-setup configuration in a single event. Every field is optional; an absent field leaves that aspect untouched. This is a strict single-version contract: unknown and superseded policy fields are rejected rather than silently ignored.
CapabilityCommand
Fields
command: CapabilityCommandResume
Continue a run reconstructed from preloaded history. Approval resolution
uses the correlated ApprovalResult event instead.
ApprovalResult
Fields
WorkflowSpawnResult
Result of a host-owned workflow spawn batch. Every requested agent must
appear in exactly one of started_agent_ids or failures.
Fields
failures: Vec<WorkflowSpawnFailure>PreemptResult
MemoryPersistResult
MemoryQueryResult
LargeResultSpoolResult
PageOutArchiveResult
SetKnowledgeBudget
K2: set the knowledge-budget ratio at runtime (granular sibling of
RunConfig::knowledge_budget_ratio). 0.0 disables the cap.
SetCriteriaGate
O4: enable/disable the turn-end criteria gate (default enabled; no-op for runs without criteria). Additive ABI.
SetRepeatFuse
O6: tune or disable the repeat fuse (defaults: enabled, deny_after=5, terminate_after=8). Each field is optional — an absent field keeps the current value. Additive ABI.
SetEntropyWatch
Entropy watch: tune the opt-in threshold alerting over the per-turn session-entropy score (defaults: disabled, threshold=0.65, hysteresis=0.1, cooldown_turns=4, notify_model=false). Each field is optional — an absent field keeps the current value. Sampling itself is unconditional and unaffected. Additive ABI.
Fields
SetSchedulerBudget
Adjust the wall-clock budget at runtime (e.g. to extend or set a deadline
after a run has already started). Additive: omit to keep the value from
SchedulerBudget passed at construction.
SetResourceQuota
M2 资源配额: install a declarative crate::governance::quota::ResourceQuota at the
single syscall trap. Like governance/attention/scheduler config, quotas flow in through
the versioned JSON event ABI (replayable, session-loggable) rather than a side-channel
setter — sending it is opt-in, and omitting it preserves the pre-M2 unconditional Allow
for spawn / memory-write syscalls.
Fields
quota: ResourceQuotaProviderResult
Fields
ToolResults
ProviderError
Reactive recovery entry point: the SDK’s provider stream failed. The kernel classifies the
error (context-overflow vs other) and runs the bounded compact-and-retry recovery ladder,
returning CallProvider to retry with a freshly compacted context or Done to terminate.
The runners forward the raw provider error text and dispatch the result, instead of each
owning the classify + compact + retry + give-up policy. Additive ABI: a brand-new variant,
byte-identical on the wire for SDKs that never send it.
DeliverSignal
MilestoneResult
SpawnSubAgent
Spawn a sub-agent: registers/updates the kernel process table.
LoadWorkflow
W0-ABI: load a workflow DAG and spawn its first gated batch. The kernel drives the DAG;
each node spawn passes the syscall trap and is reported via workflow_batch_spawned.
Completions feed back through SubAgentCompleted (reused); finish emits
workflow_completed.
Fields
spec: WorkflowSpecresumed_submissions: Vec<Vec<WorkflowNode>>R3-1 resume: the runtime submit_workflow_nodes batches (in order) recovered from the log,
re-applied before completions so dynamically-appended nodes are reconstructed. Additive:
empty for a fresh run or a resume without dynamic submissions.
resumed_submission_bases: Vec<u32>Exact base graph index for every recovered submission batch. Length must equal
resumed_submissions; mismatch rejects the resume atomically.
resumed_outcomes: Vec<ResumedNodeOutcome>Typed recovered terminal outcomes plus control signals. Status, termination and output are mandatory facts for exact dependency-policy replay; bare completed ids are invalid.
SubAgentCompleted
Feed a completed sub-agent result back into the parent loop.
Fields
result: SubAgentResultSubmitWorkflowNodes
R3-1: append nodes to the in-flight workflow DAG at runtime (dynamic fan-out / loop-until-done). Sent by the SDK while the submitting node is still running — the appended nodes spawn on the next gated drive. No-op if no workflow is active. Additive ABI: a brand-new event variant, so existing SDKs that never send it are byte-identical on the wire.
Fields
nodes: Vec<WorkflowNode>SubmitWorkflow
M5/G1: an agent authors a whole WorkflowSpec (the article’s “model writes its own harness”).
The agent-reachable analogue of the host-only LoadWorkflow: bootstraps the DAG when no
workflow is active, else flattens the spec’s nodes onto the running DAG (bootstrap-or-flatten,
one kernel / one quota — never a workflow stack). Gated by Syscall::LoadWorkflow. Additive ABI:
a brand-new variant, byte-identical on the wire for SDKs that never send it.
Fields
spec: WorkflowSpecPageIn
Feed long-term memory entries into the knowledge partition (page-in). SDK performs retrieval I/O; kernel only applies the result.
Fields
entries: Vec<PageInEntry>SetMemoryPolicy
Configure long-term memory management policy (Phase 7). Opt-in: installing the policy makes
validation_enabled, retrieval_top_k, and the optional size/name overrides authoritative.
Fields
max_content_bytes: Option<u32>Override the validation content-size limit (bytes). Omit to keep the kernel default.
WriteMemory
Write a long-term memory entry (SDK background agent calls this).
Fields
memory: MemoryRecordQueryMemory
Query long-term memory for context (kernel calls this; SDK responds asynchronously).
Fields
query: MemoryQueryCompleteRun
Privileged host control: commit a host-driven run (for example a standalone workflow)
after its kernel-owned work has completed. This supersedes any pending provider effect and
produces the ordinary done effect and terminal usage report.
CancelOperation
Host cancellation fact. The host has already stopped external I/O; the kernel commits the deterministic terminal transition and clears every pending effect/wait state.
Trait Implementations§
Source§impl Clone for KernelInputEvent
impl Clone for KernelInputEvent
Source§fn clone(&self) -> KernelInputEvent
fn clone(&self) -> KernelInputEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more