Skip to main content

Crate kernel

Crate kernel 

Source
Expand description

The Hedos kernel: the headless core that discovers, identifies, installs, and manages local models. Pure logic and the filesystem — no async runtime, no UI. Higher layers (gateway, cli) are thin shells over this crate.

Re-exports§

pub use registry::Registry;
pub use registry::RegistryError;

Modules§

artifacts
Generated outputs: the content-addressed artifact store, its records, gallery arrangement, and provenance rendering. Pure logic and the filesystem — the ProvenanceArtifactWriter that bridges the store to the registry is DI glue that lands with the kernel facade.
bench
What a model does on this machine: one run’s measurement, the summary over several, and the order and bar widths a table of them draws with.
capabilities
Streaming text processors for model output: separating thinking spans from visible text, and detecting stop sequences. Both hold back a partial-tag suffix so a delimiter split across chunk boundaries is still recognized.
discovery
Finding models already on disk. This module holds the format-agnostic pieces — multi-part GGUF shard grouping and duplicate-weight detection. The directory scanners and reconciliation into the registry build on these.
fs
Small filesystem-path helpers shared across the workspace.
install
Installing models: resolving a user-typed reference to a provider, and the provider-facing error/identity types. The Hugging Face / Ollama fetch providers and the install service build on this foundation.
jobs
Jobs: discrete non-conversational units of work (image generation and other generators) with progress and a persisted terminal result. This module holds the pure data model, the seed injection, and the terminal-job history store; the async scheduler that drives runners lives in the runtime crate.
manifests
Community runtime manifests: the manifest.toml that describes a user-installed runtime — what it can serve, how it launches (a [serve] sidecar or a one-shot [invoke] command, optionally inside a [vm]), and its permissions. Parsing uses the toml crate; the validation is the meat.
persistence
On-disk JSON store substrate: atomic writes and corruption quarantine.
profiles
Per-model configuration: the parameter schema a model exposes, merging saved values and the system prompt into requests, and context-window budgeting.
records
The kernel’s data model: model records and the value types they compose.
registry
The store of owned models: a models.json file holding every ModelRecord the kernel knows about, with change-detecting writes and corruption recovery.
removal
Deleting an installed model: what a deletion would touch (a preview) and the pure path/size logic behind it. The actual removal — trashing files or asking the Ollama daemon to delete a tag — is driven by the runtime crate.
resolution
Identifying a model’s format and capabilities from its files. The full runtime-bid auction lives with the runtime adapters; this module holds the file-format detection those decisions build on.
time
Shared time helpers: the epoch-millisecond clock and the hand-rolled Gregorian calendar conversions used for ISO 8601 wire timestamps. Kept in the kernel (the dependency floor) so every crate shares one implementation instead of a date-library dependency or a per-crate copy.