Skip to main content

Pack

Trait Pack 

Source
pub trait Pack {
    const NAME: &'static str;
    const NOTE_KINDS: &'static [&'static str];
    const ENTITY_KINDS: &'static [&'static str];
    const HANDLERS: &'static [HandlerDef];
    const EDGE_RULES: &'static [EdgeEndpointRule] = _;
    const REQUIRES: &'static [&'static str] = _;
    const NOTE_KIND_SPECS: &'static [NoteKindSpec] = _;
    const SCHEMA_PLAN: Option<PackSchemaPlan> = None;
    const VALIDATION_RULES: &'static [&'static str] = _;
}
Expand description

A composable module that contributes vocabulary, verbs, and edge endpoint rules to the khive runtime.

Packs declare what entity kinds, note kinds, and verbs they introduce, and optionally extend the per-relation endpoint contract via EDGE_RULES. The runtime merges vocabularies from all loaded packs and rejects unregistered kinds at the service boundary.

The closed EdgeRelation enum is not extensible — only its per-relation endpoint contract is extensible by packs.

Required Associated Constants§

Source

const NAME: &'static str

Short identifier for this pack (e.g. “kg”, “tasks”).

Source

const NOTE_KINDS: &'static [&'static str]

Note kinds this pack contributes to the runtime vocabulary.

Source

const ENTITY_KINDS: &'static [&'static str]

Entity kinds this pack contributes to the runtime vocabulary.

Source

const HANDLERS: &'static [HandlerDef]

Handlers this pack registers.

The runtime routes verb calls to the pack that declares them. Only entries with visibility: Visibility::Verb are surfaced on the MCP wire; Visibility::Subhandler entries are internal.

Provided Associated Constants§

Source

const EDGE_RULES: &'static [EdgeEndpointRule] = _

Additional edge endpoint rules this pack contributes.

Defaults to empty — packs that introduce no new endpoint pairs (or only rely on the base endpoint contract) can ignore this.

Source

const REQUIRES: &'static [&'static str] = _

Other pack names whose vocabulary this pack references.

The runtime checks that every name in REQUIRES appears in the loaded pack set before any pack is registered. Defaults to empty so existing packs compile without changes.

Source

const NOTE_KIND_SPECS: &'static [NoteKindSpec] = _

Lifecycle and schema specs for note kinds this pack owns.

Packs that introduce note kinds with explicit lifecycle semantics (e.g. GTD’s task kind) declare the spec here. The runtime collects these at boot time for introspection and future enforcement. Defaults to empty so existing packs compile without changes.

Source

const SCHEMA_PLAN: Option<PackSchemaPlan> = None

Pack-auxiliary schema plan.

Packs that need their own auxiliary tables (e.g. GTD’s gtd_lifecycle_audit) declare idempotent DDL statements here. The runtime applies them once at registration time. Defaults to None so packs with no auxiliary schema cost nothing.

Source

const VALIDATION_RULES: &'static [&'static str] = _

Validation rule IDs contributed by this pack.

Rule IDs are namespaced by pack name: <pack-name>/<rule-id>. The runtime merges rule IDs from all packs; the actual rule implementations live in khive-runtime::validation::ValidationRule (not in khive-types, which stays no_std). This const serves as the declarative catalog of rule identifiers so the validation infrastructure can enumerate what rules a pack claims without loading the runtime.

Defaults to empty — packs with no domain-specific validation rules can leave this unset.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§