sptos-shell
In-kernel debug shell for the SPTOS Cognition Kernel
Overview
sptos-shell provides a line-based debug shell for runtime inspection of SPTOS kernel state. It supports serial console use via a trait-based backend (ShellBackend) that kernel integrators implement. This crate is no_std compatible and requires only alloc.
Key Features
- 13 built-in commands — help, info, mem, tasks, caps, queues, vectors, proofs, cpu, witness, perf, trace, reboot
- Trait-based backend —
ShellBackendtrait decouples the shell from kernel internals - Line-based parsing — Simple command parser suitable for serial consoles and embedded environments
- Command history — Configurable history buffer (default 32 entries)
no_stdwith alloc — Uses onlyallocfor dynamic strings and vectors
Dependencies
No internal SPTOS dependencies. Types are defined internally to keep this crate self-contained.
Usage
rust
use sptos_shell::{Shell, ShellConfig, Command, Parser};
let config = ShellConfig::default(); // prompt: "sptos> "
let mut shell = Shell::new(config);
let output = shell.execute_line("mem", &kernel_backend);API Reference
Core Types
| Type | Description |
|---|---|
Shell | Main shell instance with history and command dispatch |
ShellConfig | Configuration (max history, echo, prompt string) |
ShellBackend | Trait that kernel integrators implement for state access |
Command | Parsed command enum (Help, Info, Mem, Tasks, etc.) |
Parser | Line-based command parser |
MemoryStats | Memory statistics returned by the backend |
TaskInfo | Task information returned by the backend |
ParseError | Error type for command parsing failures |