pub struct LuaEngine { /* private fields */ }Implementations§
Source§impl LuaEngine
impl LuaEngine
Sourcepub fn new(options: LuaEngineOptions) -> Result<Self, Box<dyn Error>>
pub fn new(options: LuaEngineOptions) -> Result<Self, Box<dyn Error>>
Create a new LuaEngine with LuaJIT VM and registered globals.
Sourcepub fn load_from_dirs(
&mut self,
base_dir: &Path,
override_dir: Option<&Path>,
) -> Result<(), Box<dyn Error>>
pub fn load_from_dirs( &mut self, base_dir: &Path, override_dir: Option<&Path>, ) -> Result<(), Box<dyn Error>>
Load skills from directories. base_dir is the system skill directory,
override_dir is the user override directory (if any).
Sourcepub fn load_from_roots(
&mut self,
skill_roots: &[RuntimeSkillRoot],
) -> Result<(), Box<dyn Error>>
pub fn load_from_roots( &mut self, skill_roots: &[RuntimeSkillRoot], ) -> Result<(), Box<dyn Error>>
Load skills from an ordered root chain where earlier roots override later roots. 从有序根目录覆盖链加载技能,前面的根目录会覆盖后面的同名技能。
Sourcepub fn reload_from_dirs(
&mut self,
base_dir: &Path,
override_dir: Option<&Path>,
) -> Result<(), Box<dyn Error>>
pub fn reload_from_dirs( &mut self, base_dir: &Path, override_dir: Option<&Path>, ) -> Result<(), Box<dyn Error>>
Reload all skills from the given directories and rebuild runtime state from scratch. 从给定目录重新加载全部技能,并从零重建运行时状态。
Sourcepub fn reload_from_roots(
&mut self,
skill_roots: &[RuntimeSkillRoot],
) -> Result<(), Box<dyn Error>>
pub fn reload_from_roots( &mut self, skill_roots: &[RuntimeSkillRoot], ) -> Result<(), Box<dyn Error>>
Reload all skills from one ordered root chain and rebuild runtime state from scratch. 从一条有序根目录覆盖链中重载全部技能,并从零重建运行时状态。
Sourcepub fn disable_skill(
&mut self,
base_dir: &Path,
override_dir: Option<&Path>,
skill_id: &str,
reason: Option<&str>,
) -> Result<(), Box<dyn Error>>
pub fn disable_skill( &mut self, base_dir: &Path, override_dir: Option<&Path>, skill_id: &str, reason: Option<&str>, ) -> Result<(), Box<dyn Error>>
Mark one skill disabled through the ordinary skills plane and immediately reload the runtime view. 通过普通 skills 平面将单个技能标记为停用,并立即重载运行时视图。
Sourcepub fn disable_skill_in_roots(
&mut self,
skill_roots: &[RuntimeSkillRoot],
skill_id: &str,
reason: Option<&str>,
) -> Result<(), Box<dyn Error>>
pub fn disable_skill_in_roots( &mut self, skill_roots: &[RuntimeSkillRoot], skill_id: &str, reason: Option<&str>, ) -> Result<(), Box<dyn Error>>
Mark one skill disabled through the ordinary skills plane using an ordered root chain and immediately reload the runtime view. 通过普通 skills 平面使用有序根目录链将单个技能标记为停用,并立即重载运行时视图。
Sourcepub fn system_disable_skill(
&mut self,
base_dir: &Path,
override_dir: Option<&Path>,
skill_id: &str,
reason: Option<&str>,
) -> Result<(), Box<dyn Error>>
pub fn system_disable_skill( &mut self, base_dir: &Path, override_dir: Option<&Path>, skill_id: &str, reason: Option<&str>, ) -> Result<(), Box<dyn Error>>
Mark one skill disabled through the host-controlled system plane and immediately reload the runtime view. 通过宿主控制的 system 平面将单个技能标记为停用,并立即重载运行时视图。
Sourcepub fn system_disable_skill_in_roots(
&mut self,
skill_roots: &[RuntimeSkillRoot],
skill_id: &str,
reason: Option<&str>,
) -> Result<(), Box<dyn Error>>
pub fn system_disable_skill_in_roots( &mut self, skill_roots: &[RuntimeSkillRoot], skill_id: &str, reason: Option<&str>, ) -> Result<(), Box<dyn Error>>
Mark one skill disabled through the host-controlled system plane using an ordered root chain and immediately reload the runtime view. 通过宿主控制的 system 平面使用有序根目录链将单个技能标记为停用,并立即重载运行时视图。
Sourcepub fn enable_skill(
&mut self,
skill_roots: &[RuntimeSkillRoot],
skill_id: &str,
) -> Result<(), Box<dyn Error>>
pub fn enable_skill( &mut self, skill_roots: &[RuntimeSkillRoot], skill_id: &str, ) -> Result<(), Box<dyn Error>>
Remove the disabled marker of one skill through the ordinary skills plane and immediately reload the runtime view. 通过普通 skills 平面移除单个技能的停用标记,并立即重载运行时视图。
Sourcepub fn system_enable_skill(
&mut self,
skill_roots: &[RuntimeSkillRoot],
skill_id: &str,
) -> Result<(), Box<dyn Error>>
pub fn system_enable_skill( &mut self, skill_roots: &[RuntimeSkillRoot], skill_id: &str, ) -> Result<(), Box<dyn Error>>
Remove the disabled marker of one skill through the host-controlled system plane and immediately reload the runtime view. 通过宿主控制的 system 平面移除单个技能的停用标记,并立即重载运行时视图。
Sourcepub fn uninstall_skill(
&mut self,
skill_roots: &[RuntimeSkillRoot],
skill_id: &str,
options: &SkillUninstallOptions,
) -> Result<SkillUninstallResult, Box<dyn Error>>
pub fn uninstall_skill( &mut self, skill_roots: &[RuntimeSkillRoot], skill_id: &str, options: &SkillUninstallOptions, ) -> Result<SkillUninstallResult, Box<dyn Error>>
Uninstall one skill directory through the ordinary skills plane and immediately reload the runtime view. 通过普通 skills 平面卸载单个技能目录,并立即重载运行时视图。
Sourcepub fn system_uninstall_skill(
&mut self,
skill_roots: &[RuntimeSkillRoot],
skill_id: &str,
options: &SkillUninstallOptions,
) -> Result<SkillUninstallResult, Box<dyn Error>>
pub fn system_uninstall_skill( &mut self, skill_roots: &[RuntimeSkillRoot], skill_id: &str, options: &SkillUninstallOptions, ) -> Result<SkillUninstallResult, Box<dyn Error>>
Uninstall one skill directory through the host-controlled system plane and immediately reload the runtime view. 通过宿主控制的 system 平面卸载单个技能目录,并立即重载运行时视图。
Sourcepub fn install_skill(
&mut self,
skill_roots: &[RuntimeSkillRoot],
request: &SkillInstallRequest,
) -> Result<SkillApplyResult, Box<dyn Error>>
pub fn install_skill( &mut self, skill_roots: &[RuntimeSkillRoot], request: &SkillInstallRequest, ) -> Result<SkillApplyResult, Box<dyn Error>>
Preflight one install request through the ordinary skills plane and return a structured result. 通过普通 skills 平面对一次安装请求执行预检查,并返回结构化结果。
Sourcepub fn system_install_skill(
&mut self,
skill_roots: &[RuntimeSkillRoot],
request: &SkillInstallRequest,
) -> Result<SkillApplyResult, Box<dyn Error>>
pub fn system_install_skill( &mut self, skill_roots: &[RuntimeSkillRoot], request: &SkillInstallRequest, ) -> Result<SkillApplyResult, Box<dyn Error>>
Preflight one install request through the host-controlled system plane and return a structured result. 通过宿主控制的 system 平面对一次安装请求执行预检查,并返回结构化结果。
Sourcepub fn update_skill(
&mut self,
skill_roots: &[RuntimeSkillRoot],
request: &SkillInstallRequest,
) -> Result<SkillApplyResult, Box<dyn Error>>
pub fn update_skill( &mut self, skill_roots: &[RuntimeSkillRoot], request: &SkillInstallRequest, ) -> Result<SkillApplyResult, Box<dyn Error>>
Preflight one update request through the ordinary skills plane and return a structured result. 通过普通 skills 平面对一次更新请求执行预检查,并返回结构化结果。
Sourcepub fn system_update_skill(
&mut self,
skill_roots: &[RuntimeSkillRoot],
request: &SkillInstallRequest,
) -> Result<SkillApplyResult, Box<dyn Error>>
pub fn system_update_skill( &mut self, skill_roots: &[RuntimeSkillRoot], request: &SkillInstallRequest, ) -> Result<SkillApplyResult, Box<dyn Error>>
Preflight one update request through the host-controlled system plane and return a structured result. 通过宿主控制的 system 平面对一次更新请求执行预检查,并返回结构化结果。
Sourcepub fn list_entries(&self) -> Vec<RuntimeEntryDescriptor>
pub fn list_entries(&self) -> Vec<RuntimeEntryDescriptor>
Return generic runtime entry descriptors for all loaded skills. 返回当前已加载全部 skill 的通用运行时入口描述。
Sourcepub fn list_skill_help(&self) -> Vec<RuntimeSkillHelpDescriptor>
pub fn list_skill_help(&self) -> Vec<RuntimeSkillHelpDescriptor>
List all structured help trees currently registered in the runtime. 列出当前运行时中已注册的全部结构化帮助树。
Sourcepub fn render_skill_help_detail(
&self,
skill_id: &str,
flow_name: &str,
request_context: Option<&RuntimeRequestContext>,
) -> Result<Option<RuntimeHelpDetail>, String>
pub fn render_skill_help_detail( &self, skill_id: &str, flow_name: &str, request_context: Option<&RuntimeRequestContext>, ) -> Result<Option<RuntimeHelpDetail>, String>
Render one structured help detail payload for one skill flow node. 为单个 skill 流程节点渲染一份结构化帮助详情载荷。
Sourcepub fn prompt_argument_completions(
&self,
prompt_name: &str,
argument_name: &str,
) -> Option<Vec<String>>
pub fn prompt_argument_completions( &self, prompt_name: &str, argument_name: &str, ) -> Option<Vec<String>>
Return configured completion candidates for a prompt argument, if declared by a skill. 返回某个提示词参数在 skill 元数据中声明的候选补全项。
Sourcepub fn skill_name_for_tool(&self, tool_name: &str) -> Option<String>
pub fn skill_name_for_tool(&self, tool_name: &str) -> Option<String>
Return the owning skill name for an MCP tool name; return None when the tool is not provided by a Lua skill.
根据 MCP 工具名返回所属 skill 名称;未命中时返回 None。
Sourcepub fn list_skill_config_entries(
&self,
skill_id: Option<&str>,
) -> Result<Vec<SkillConfigEntry>, String>
pub fn list_skill_config_entries( &self, skill_id: Option<&str>, ) -> Result<Vec<SkillConfigEntry>, String>
List flattened skill config records for one optional skill namespace. 列出某个可选技能命名空间下的扁平化技能配置记录。
Sourcepub fn get_skill_config_value(
&self,
skill_id: &str,
key: &str,
) -> Result<Option<String>, String>
pub fn get_skill_config_value( &self, skill_id: &str, key: &str, ) -> Result<Option<String>, String>
Read one optional string config value for one (skill_id, key) pair.
读取某个 (skill_id, key) 对下的可选字符串配置值。
Sourcepub fn set_skill_config_value(
&mut self,
skill_id: &str,
key: &str,
value: &str,
) -> Result<(), String>
pub fn set_skill_config_value( &mut self, skill_id: &str, key: &str, value: &str, ) -> Result<(), String>
Insert or replace one string config value for one (skill_id, key) pair.
为某个 (skill_id, key) 对插入或替换一个字符串配置值。
Sourcepub fn delete_skill_config_value(
&mut self,
skill_id: &str,
key: &str,
) -> Result<bool, String>
pub fn delete_skill_config_value( &mut self, skill_id: &str, key: &str, ) -> Result<bool, String>
Delete one config key from one skill namespace and report whether one value was removed. 从某个技能命名空间删除单个配置键,并返回是否移除了一个值。
Sourcepub fn call_skill(
&self,
tool_name: &str,
args: &Value,
invocation_context: Option<&LuaInvocationContext>,
) -> Result<RuntimeInvocationResult, String>
pub fn call_skill( &self, tool_name: &str, args: &Value, invocation_context: Option<&LuaInvocationContext>, ) -> Result<RuntimeInvocationResult, String>
Call a loaded Lua skill with the given JSON arguments. This is synchronous — wrap in spawn_blocking for async contexts.
Auto Trait Implementations§
impl Freeze for LuaEngine
impl !RefUnwindSafe for LuaEngine
impl Send for LuaEngine
impl Sync for LuaEngine
impl Unpin for LuaEngine
impl UnsafeUnpin for LuaEngine
impl !UnwindSafe for LuaEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request