feat(plugin): bridge worker capability requests to the host broker (H3-A)

- add request-scoped capability_request/capability_reply/capability_error
  frames to the worker transport (ADR-0018); no C ABI change
- worker routes its capability handler through stdin/stdout, the host serves
  requests inside the existing invoke deadline and binds identity from the
  spawned worker, never from frame text
- both native and worker plugins now execute a granted fs.read through
  ProjectFs with audit; unsupported capabilities return capability.unavailable
- add a real C capability plugin and CLI test for granted read and denial
- document the bridge and that strict OS isolation (H3-B) is still refused
This commit is contained in:
cflmy committed 2026-11-20 13:08:56 +08:00
1 parent 47a2e1883f
commit 0f01a69048
11 files changed
+720 -64

No files matched your search

+19 -3
View File
@@ -284,9 +284,25 @@ impl StdHost {
.map_err(map_plugin_error)?,
)
}
PluginKind::Worker => PluginTransport::Worker(
WorkerPlugin::spawn(manifest, base_dir).map_err(map_plugin_error)?,
),
PluginKind::Worker => {
let mut broker = CapabilityBroker::with_audit(
self.capabilities.clone(),
Arc::clone(&self.broker_audit),
)
.with_fs(self.fs.clone());
for capability in &self.vendor_capabilities {
broker.allow_vendor(capability.clone());
}
let package = manifest.plugin.name.clone();
let handler: marqdo_plugin_abi::CapabilityHandler =
Box::new(move |capability, request| {
broker.execute(&package, capability, request)
});
PluginTransport::Worker(
WorkerPlugin::spawn(manifest, base_dir, Some(handler))
.map_err(map_plugin_error)?,
)
}
PluginKind::Wasm => {
return Err(RuntimeError::new(
ErrorCategory::KernelUnavailable,