Skip to main content

Module discovery

Module discovery 

Source
Expand description

On-disk plugin discovery (PL8.B).

A plugin lives in its own directory under ~/.config/lattice/plugins/, holding a plugin.toml manifest and a .wasm component. Discovery scans that tree, parses each manifest, and reads the component bytes — every failure is a logged skip, never fatal: one malformed plugin dir must not stop the others or fail boot (the four-artefact graceful-degradation clause).

Structs§

DiscoveredPlugin
A plugin found on disk, ready to load: its parsed manifest, the component bytes, and the directory it came from (for diagnostics).

Functions§

default_core_plugins_dir
The core-plugins root — prebuilt plugins that ship WITH lattice (plugin-manager.md §7 / PM.1). Distinct from default_plugins_dir (the user’s require+build cache): core plugins are the batteries-included set, discovered at boot at the Bundled tier. Resolved via a SEARCH PATH — the first existing candidate wins, except an explicit $LATTICE_RUNTIME override always wins (whether or not it exists yet):
default_init_dir
The user’s init.rs config plugin directory: ~/.config/lattice/init/ on Linux AND macOS (honoring $XDG_CONFIG_HOME), %APPDATA%\lattice\init on Windows. Holds the user’s init.rs-compiled component + its plugin.toml (id = "init", provides = [...] for the seams it uses). Loaded at boot with a boot-capability (Bundled) tier — it’s the user’s own trusted config, not an external install. None if the platform has no config dir.
default_plugins_dir
The default plugins directory: ~/.config/lattice/plugins/ on Linux AND macOS (honoring $XDG_CONFIG_HOME), %APPDATA%\lattice\plugins on Windows. None if the platform has no config dir (the editor then loads no on-disk plugins).
default_source_cache_dir
PM.6/PM.7b: the git source cache — ~/.config/lattice/cache/sources/.
discover
Scan dir for plugin subdirectories, returning every one that parses. A missing dir yields an empty list (no plugins installed — normal). Each subdirectory needs a plugin.toml + exactly one .wasm; anything else is logged at warn/debug and skipped.
discover_one
Parse a single explicitly-named plugin directory — the :plugin-load <path> entry point (PL8.C). Unlike discover (which scans a tree and silently skips non-plugin subdirs), this is a direct request for one dir, so a missing manifest is an error the user sees, not a silent skip.