feat(m0.6-r2): isolated plugin worker transport

- add a hidden __plugin-worker mode that loads one native library in a child
  process and serves length-prefixed JSON invoke frames
- add host WorkerPlugin with ready handshake, export cross-check, per-call
  timeout and crash/EOF propagation
- route kind: worker without in-process trust; native still requires explicit
  trust; wasm is rejected explicitly
- report worker_processes=true while keeping strict OS isolation unavailable
- test successful worker calls and worker crash isolation
- update plugin ABI spec and R2 status
This commit is contained in:
cflmy committed 2026-11-20 11:52:26 +08:00
1 parent 4ce37afb39
commit 44c2df2361
12 files changed
+661 -47

No files matched your search

+2 -2
View File
@@ -883,9 +883,9 @@ fn load_plugin_into_host(
manifest
.validate()
.map_err(|error| format!("{}: {}", error.code, error.message))?;
if !trusted {
if manifest.plugin.kind == marqdo_plugin_abi::PluginKind::Native && !trusted {
return Err(format!(
"loading `{}` in-process requires --trust-native-plugin: no isolated worker transport is implemented in this build",
"loading `{}` in-process requires --trust-native-plugin; use `kind: worker` for crash isolation",
manifest.plugin.name
));
}
+14
View File
@@ -58,6 +58,17 @@ enum Command {
/// Unknown top-level command: dispatch to a registered external tool.
#[command(external_subcommand)]
External(Vec<OsString>),
/// Internal isolated plugin worker (not a user-facing command).
#[command(name = "__plugin-worker", hide = true)]
PluginWorker(PluginWorkerArgs),
}
#[derive(Args)]
struct PluginWorkerArgs {
/// plugin.yaml path.
manifest: PathBuf,
/// Plugin package directory.
base_dir: PathBuf,
}
#[derive(Args)]
@@ -386,6 +397,9 @@ fn main() {
ToolCommand::Remove(args) => tool::remove(&args.command, args.json),
},
Command::External(args) => tool::dispatch(&args),
Command::PluginWorker(args) => {
marqdo_plugin_abi::worker::serve(&args.manifest, &args.base_dir)
}
};
std::process::exit(code);
}