Files
marqdo/src/host/plugin_stub.rs
T
cflmy 9331af78e2 release(2.8.0): 合入 CHANGELOG/README/发版说明/skills prove 任务;CI 链接指向 doc/releases
- CHANGELOG.md:v2.8.0 条目(中英双语);
- README.md:版本行 2.7.1→2.8.0 + 愿景第 6 条(知识可证明);
- doc/releases/v2.8.0.md:双语发版说明(亮点/用法/已知限制);
- skills/marqdo-dev/index.mq.md:新增 prove 任务(路径/目录模式/
  require_lean/json;参数用 + 行声明升参,check 与 narrative-ratio 通过);
- 设计文档 §12.5 标记已合入;发版链接统一指向 doc/releases/v2.8.0.md。
2026-11-18 10:29:26 +08:00

59 lines
1.4 KiB
Rust
Executable File

//! Stub plugin surface when `plugin-host` is disabled (browser wasm).
use std::collections::HashMap;
use crate::host::HostContext;
use crate::value::Value;
pub const ABI_VERSION: u32 = 2;
pub const ABI_VERSION_MIN: u32 = 1;
/// Hook: resolve bare `lib.member` (unused without native plugins).
#[derive(Clone, Copy)]
pub struct LibPathCall {
pub call: fn(*mut (), &str, Option<&Value>) -> Result<Value, String>,
pub data: *mut (),
}
pub fn with_lib_path_call<R>(_hook: LibPathCall, body: impl FnOnce() -> R) -> R {
body()
}
#[derive(Clone)]
pub struct RegisteredFn {
pub params: Vec<String>,
}
#[derive(Debug, Default, Clone)]
pub struct PluginState;
impl PluginState {
pub fn get(&self, _name: &str) -> Option<&RegisteredFn> {
None
}
pub fn list_names(&self) -> Vec<String> {
Vec::new()
}
}
pub fn load(_ctx: &mut HostContext, _path: &Value) -> Result<Value, String> {
Err("plugin.load unavailable in browser wasm".into())
}
pub fn unload(_ctx: &mut HostContext) -> Result<Value, String> {
Err("plugin.unload unavailable in browser wasm".into())
}
pub fn list(_ctx: &HostContext) -> Result<Value, String> {
Ok(Value::List(Vec::new()))
}
pub fn call_registered(
_ctx: &mut HostContext,
name: &str,
_bound: &HashMap<String, Value>,
) -> Result<Value, String> {
Err(format!("plugin `{name}` unavailable in browser wasm"))
}