Skip to main content

Crate kyyn_core

Crate kyyn_core 

Source
Expand description

kyyn-core — the tiny shared vocabulary between the ev engine and KB schema crates. The engine never links a schema crate (schemas are compiled and run as subprocesses at accept time); both sides link this crate instead: the universal link::Link grammar and the violation types that flow back over the validator’s stdio protocol.

Modules§

link
The universal Link type — one grammar to point at anything from anywhere.
plugin
The SourcePlugin contract — what a source is, to the engine.
progress
Host-side progress reporting for long-running plugin work — a FACILITY, not part of the plugin wire contract. Plugins call report at natural milestones (a page fetched, a file downloaded); the host decides where the lines go. Default: stderr, which every surface tolerates (the CLI shows it live; MCP stdout stays pure JSON-RPC). Future stdio plugins map their stderr onto the same sink — the contract itself stays untouched.
protocol
The engine ⇄ schema-crate wire protocol: RON over stdio. The engine spawns the KB’s compiled schema binary, writes one Request to stdin, reads one Response from stdout. Nothing else crosses the boundary — the engine never links a schema crate.
query
Backend-neutral analytical query plans and the typed builder schemas use to produce them. The builder closure runs once against typed field proxies; only the resulting serde AST crosses the schema/engine boundary.
registry
The registry vocabulary — the courtesy artifact a KB’s schema crate emits (RON-native, committed to the KB) describing its kinds so the engine can drive query/web/MCP UX generically. Integrity never depends on it: the validation fn is the only load-bearing export. Where a protocol demands JSON (MCP tool inputs), the engine derives it from this at the boundary.
ronfmt
Canonical on-disk RON: pretty, no struct names, unescaped strings (so prose notes are written as real multiline text — raw strings only when the content contains a "), trailing newline. Every writer (proposal staging, schema-change rewrites) uses this so files are byte-stable and diff cleanly line-by-line.
schemadef
Registry-construction helpers for schema crates — the machinery every KB’s registry.rs used to carry as an identical copy. A schema crate declares its kinds with these; everything that can drift silently is pulled from the compiled types instead of retyped: docs and enum variants come out of the schemars output (i.e. straight from the doc comments and derives on the model), so the same comment documents the type in Rust AND guides the agent through the generated tools.
storage
Storage patterns — the bridge between a kind’s declared storage (facts/todos/{id}.ron) and repo-relative paths. Routing, its inverse, and the placeholder grammar live HERE so the engine and registry-driven validation share one implementation.
tap
The tap manifest — what a plugin repository ADVERTISES (kyyn-tap.ron at its root): which plugins it serves, through which binary, with which declared capabilities. The engine reads this; plugins never do. Unknown fields are refused — the tap version field is the evolution path, and an engine that cannot parse a manifest must say so, not guess (ADR 0005).
validate
Registry-driven generic validation — everything a schema DECLARES, the engine can CHECK without the schema crate hand-writing it:
value
Registry-driven typed decoding — the engine’s Value layer.
violation
Validation outcome types — the wire vocabulary of the validator protocol.