Skip to main content

Module kernel

Module kernel 

Source
Expand description

The Kernel (核) — the heart of kaish.

The Kernel owns and coordinates all core components:

  • Interpreter state (scope, $?)
  • Tool registry (builtins, user tools)
  • VFS router (mount points)
  • Job manager (background jobs)

§Architecture

┌────────────────────────────────────────────────────────────┐
│                         Kernel (核)                         │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────────┐  │
│  │   Scope      │  │ ToolRegistry │  │  VfsRouter       │  │
│  │  (variables) │  │  (builtins,  │  │  (mount points)  │  │
│  │              │  │   user tools)│  │                  │  │
│  └──────────────┘  └──────────────┘  └──────────────────┘  │
│  ┌──────────────────────────────┐  ┌──────────────────┐    │
│  │  JobManager (background)     │  │  ExecResult ($?) │    │
│  └──────────────────────────────┘  └──────────────────┘    │
└────────────────────────────────────────────────────────────┘

Structs§

ExecuteOptions
Per-call options for Kernel::execute_with_options.
Kernel
The Kernel (核) — executes kaish code.
KernelConfig
Configuration for kernel initialization.
OverlayHandle
Handle to an active overlay session, kept on the kernel and shared to ExecContext so the kaish-vfs builtin can reach the OverlayFs.

Enums§

CommandKind
The category the kernel resolves a command name into.
VfsMountMode
VFS mount mode determines how the local filesystem is exposed.

Constants§

MAX_RECURSION_DEPTH
Maximum depth of dynamic statement-engine re-entry — command substitution ($(…)), shell-function calls, and .kai script sourcing — before a loud error is returned instead of letting the native call stack overflow (a SIGSEGV/abort with no diagnostic). Mirrors the intent of the alias re-entry cap (10) and the lexer’s MAX_PAREN_DEPTH (256): a runaway or mutually recursive script hits a catchable ceiling, not a signal.
RECOMMENDED_STACK_SIZE
Recommended native stack size (12 MiB) for any thread that drives kaish execution — the REPL sizes its block_on thread and tokio worker threads to this, and embedders that call Kernel::execute (directly or via a tokio runtime) should do the same (runtime::Builder::thread_stack_size, and a std::thread stack for a non-worker driver).