Skip to main content

Module hooks

Module hooks 

Source
Expand description

kian-plugin::hooks — the hook-plugin core (PLUGIN-SPEC v2.2, ADR-028): the closed hook vocabulary, the §3.2 payload views, the §5 grant model, the hook-scoped tier-0 registry and the HookBus dispatch core. P3a adds the sidecar tier’s runner/ABI/manifest (sidecar); the config surface, per-worker resolution and the set digest are P3b.

The bus never writes events, never touches projections and never imports a harness (§10.7 / ADR-028 D4): it is called from control flow and returns verdicts. Nothing in this module can append an event.

Module map (K1 — later phases grow sidecar/, resolve.rs, digest.rs without moving these):

  • ids — the closed §3.1 catalog (HookId, HookMode, HookClass), the empty harness registry (§3.6)
  • views — the §3.2 payload structs and the verdict types
  • grants — the closed §5.1 grant set and the reply → required grant map (§3.3)
  • registry — hook-scoped tier-0 registration (§5.3) over the existing Disposer
  • failure — failure classification and the grant-keyed class defaults (§11.1); failure::resolve_outcome is the only place a reply becomes a verdict (K6)
  • bus — the HookBus façade: §8.3 dispatch order, the §4.1 admission grid, admit_post, the §4.6 settle decisioning, the §10.6 audit lines and the K7 veto marker
  • ports — the seven port methods (§4, verbatim) and SettleCtl
  • wire — the §3.2/§7.6 bounds and digest helpers the P2 call sites build their views with (one sha2 edge, K10)
  • sidecar — the P3a sidecar tier: §6 manifest, §7 stdio ABI, the spawn-hardened runner with §6.4/§6.5 counters and quarantine

Re-exports§

pub use bus::DEFAULT_MAX_SETTLE_VETOS;
pub use bus::HookBus;
pub use bus::VETO_MARKER_PREFIX;
pub use bus::is_veto_marker;
pub use bus::veto_marker;
pub use bus::veto_marker_prefix;
pub use digest::process_sha256;
pub use digest::set_digest;
pub use failure::Cause;
pub use failure::ClassDefault;
pub use failure::FailureClass;
pub use failure::Outcome;
pub use failure::SpeechCode;
pub use failure::resolve_outcome;
pub use grants::Grant;
pub use grants::GrantError;
pub use grants::GrantSet;
pub use grants::ReplyShape;
pub use grants::observe_grant_for_class;
pub use grants::reply_required_grant;
pub use grants::veto_grant_for_class;
pub use ids::HARNESS_REGISTRY;
pub use ids::HarnessPoint;
pub use ids::HookClass;
pub use ids::HookId;
pub use ids::HookMode;
pub use ids::PayloadKind;
pub use ids::catalog;
pub use ids::harness_declared;
pub use ports::HookPorts;
pub use ports::SettleCtl;
pub use registry::HandlerId;
pub use registry::HookFn;
pub use registry::HookPayload;
pub use registry::HookReply;
pub use registry::Registry;
pub use registry::ReplyErrCode;
pub use registry::SessionScope;
pub use registry::global_registry;
pub use registry::register;
pub use registry::register_scoped;
pub use resolve::EffectivePlugin;
pub use resolve::InstanceDecl;
pub use resolve::LimitOverrides;
pub use resolve::Resolution;
pub use resolve::ResolveError;
pub use resolve::ResolveErrorCode;
pub use resolve::ScopesConfig;
pub use resolve::SidecarConfig;
pub use resolve::WorkerScope;
pub use resolve::resolve;
pub use resolve::validate;
pub use resolve::validate_shape;
pub use session::SessionSetGuard;
pub use session::SidecarRuntime;
pub use views::AdmissionInfo;
pub use views::AdmitDraft;
pub use views::AdmitInput;
pub use views::AdmitPostInput;
pub use views::AdmitReceiptView;
pub use views::AdmitTarget;
pub use views::AdmitVerdict;
pub use views::ChannelProvenance;
pub use views::EXEC_WORKER_KEY;
pub use views::FrameInfo;
pub use views::Origin;
pub use views::PermissionView;
pub use views::RecoveryView;
pub use views::RedactionReport;
pub use views::RequestMeta;
pub use views::ResponseView;
pub use views::SettleVerdict;
pub use views::SettleView;
pub use views::ToolCallView;
pub use views::ToolPostView;
pub use views::ToolVerdict;
pub use views::TurnErrorAudit;
pub use views::durable_worker_binding;
pub use wire::FRAME_PAYLOAD_MAX_BYTES;
pub use wire::PREVIEW_MAX_BYTES;
pub use wire::bounded_value;
pub use wire::preview;
pub use wire::serialized;
pub use wire::sha256_hex;

Modules§

bus
The HookBus dispatch core (PLUGIN-SPEC §8.3, §4.1, §4.6; ADR-028 D13, D14, D20).
digest
The set digest (PLUGIN-SPEC §8.5): the canonical JSON over the effective set’s closed behaviour-bearing field list, hashed with sha2 0.10.
failure
Failure classification and class defaults (PLUGIN-SPEC §11.1, §5.2).
grants
Capability grants (PLUGIN-SPEC §5).
ids
The closed hook vocabulary (PLUGIN-SPEC §3.1, §3.6).
ports
The seven interception port methods (PLUGIN-SPEC §4, verbatim) and SettleCtl — the one port that needs an effect (§4.6), implemented by the caller (kian-superagent) with the InboxWriter it already holds.
registry
The hook-scoped tier-0 registry (PLUGIN-SPEC §5.3, ADR-028 R13).
resolve
Per-worker resolution (PLUGIN-SPEC §8): the two-scope sidecars: grammar, the boot checks that make it closed, and resolve as a pure function of (boot config, the session’s durable exec_worker binding).
session
Session consistency (PLUGIN-SPEC §9): the same-process guard, the session-lifetime quarantine, and the two audit lines.
sidecar
The sidecar tier (PLUGIN-SPEC §6–§7, §10.3, §11) — P3a: the manifest, the stdio ABI and the runner.
views
The §3.2 payload catalog (closed) — plain serde structs, one per hook id, with field names, order and nesting exactly per the §3.2 field tables. Serialization is byte-checked against the spec examples (K2): a field-order drift is a silent ABI break for the sidecar tier.
wire
View-building helpers for the interception-port call sites (PLUGIN-SPEC §4’s nine rows, P2).