refactor: extract neutral host contract and decouple plugin ABI (issue #13)
Implements the core M0-M3 boundary work from issue #13 / ADR-0071 without changing language semantics or any public protocol: - add marqdo-host-contract owning Host/HostOp/ExecutionContext/ResourceRead and the runtime observation facts; the engine depends on it only. - marqdo-runtime no longer links marqdo-host; the native host implements the contract and has no reverse edge to runtime/frontend/IR. - reduce marqdo-plugin-abi to the public C ABI/wire/error contract; move manifest/artifact/loader/worker execution into marqdo-host::plugin so the SDK carries no loader/worker/host dependency. - add a real independent consumer (tests/embedding, own workspace+lock) that runs Markdown -> frontend -> IR -> runtime with bounded budgets and explicit effect refusal, plus differential CLI comparison. - add an SDK-only third-party plugin fixture and real CLI invocation gate. - replace the frozen-crate architecture test with a reviewed responsibility graph enforced from Cargo metadata, with negative unit cases. - consolidate current docs/entry: ADR-0071, CURRENT responsibility map, developers/architecture indexes, historical banners, STATUS and evidence. - record keep-in-workspace for Engine/Native Host; no empty candidate repo. Evidence: docs/evidence/2026-11-26-issue-13-engine-host-boundary.md Refs #13
This commit is contained in:
1 parent
4bbefc9244
commit
9b4f0a0822
89 files changed
+3490
-545
No files matched your search
@@ -1,31 +1,23 @@
|
||||
//! Versioned plugin C ABI v1 bindings, manifest validation and artifact
|
||||
//! loading (host side).
|
||||
//! Public contract for the versioned plugin C ABI v1.
|
||||
//!
|
||||
//! This crate is the host-side counterpart of
|
||||
//! `include/marqdo_plugin_abi_v1.h` (the frozen C ABI) and of the
|
||||
//! `marqdo-plugin-sdk` crate (the plugin-developer side). It implements the
|
||||
//! blueprint section 10 contract:
|
||||
//! This crate is the single normative Rust side of
|
||||
//! `include/marqdo_plugin_abi_v1.h`: the stable `#[repr(C)]` types with layout
|
||||
//! assertions and major/minor negotiation ([`abi`]), the `wire_version` 1
|
||||
//! JSON request/response envelope with typed value tags ([`wire`]), and the
|
||||
//! structured protocol [`PluginError`].
|
||||
//!
|
||||
//! - stable `#[repr(C)]` Rust mirrors of the C types, with compile-time layout
|
||||
//! assertions and major/minor negotiation ([`abi`]),
|
||||
//! - `plugin.yaml` parsing and validation ([`manifest`]),
|
||||
//! - target-triple artifact selection and sha256 verification ([`artifact`]),
|
||||
//! - `wire_version` 1 JSON request/response envelopes with typed value tags
|
||||
//! ([`wire`]),
|
||||
//! - a native loader/invocation bridge built on `libloading` ([`loader`]),
|
||||
//! - structured, serializable [`PluginError`]s ([`error`]).
|
||||
//! It is a contract crate, not a loader. Native loading (`dlopen`), artifact
|
||||
//! selection on disk, manifest file validation, worker process management and
|
||||
//! capability dispatch live in the native host (`marqdo-host::plugin`). The
|
||||
//! SDK consumes only this crate. There is no second wire encoding here: the
|
||||
//! wire envelope reuses the single [`marqdo_value`] encoding.
|
||||
//!
|
||||
//! A C ABI is not a sandbox: native plugins run in-process and require an
|
||||
//! explicit trust decision. This crate only validates and loads what the
|
||||
//! caller already decided to trust; it never grants capabilities.
|
||||
//! A C ABI is not a sandbox. A host that loads native code must separately make
|
||||
//! and enforce an explicit trust decision; this crate grants no capability.
|
||||
|
||||
pub mod abi;
|
||||
pub mod artifact;
|
||||
pub mod error;
|
||||
pub mod loader;
|
||||
pub mod manifest;
|
||||
pub mod wire;
|
||||
pub mod worker;
|
||||
|
||||
pub use abi::result as result_code;
|
||||
pub use abi::{
|
||||
@@ -33,16 +25,7 @@ pub use abi::{
|
||||
MqOwnedBytes, MqPluginApi, MqPluginEntryV1, MqPluginInvoke, MqRegisterFunctionFn,
|
||||
MqRequestCapabilityFn, PluginMetadata, ABI_MAJOR, ABI_MINOR, ABI_VERSION_STRING, ENTRY_SYMBOL,
|
||||
};
|
||||
pub use artifact::{
|
||||
current_target_triple, is_valid_sha256_hex, sha256_bytes, sha256_file, verify_sha256_file,
|
||||
HostTarget, TargetTriple,
|
||||
};
|
||||
pub use error::{ErrorKind, PluginError};
|
||||
pub use loader::{CapabilityHandler, LoadOptions, LoadedPlugin, RegisteredExport};
|
||||
pub use manifest::{
|
||||
AbiRequirement, Artifact, Export, PackageVersion, PluginInfo, PluginKind, PluginManifest,
|
||||
KNOWN_CAPABILITIES,
|
||||
};
|
||||
pub use marqdo_value::Value;
|
||||
pub use wire::{
|
||||
bool_from_value, int_from_value, text_from_value, to_wire_json, WireContext, WireErrorBody,
|
||||
|
||||
Reference in new issue
Block a user