Skip to main content

LuaEngine

Struct LuaEngine 

Source
pub struct LuaEngine { /* private fields */ }

Implementations§

Source§

impl LuaEngine

Source

pub fn new(options: LuaEngineOptions) -> Result<Self, Box<dyn Error>>

Create a new LuaEngine with LuaJIT VM and registered globals.

Source

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).

Source

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. 从有序根目录覆盖链加载技能,前面的根目录会覆盖后面的同名技能。

Source

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. 从给定目录重新加载全部技能,并从零重建运行时状态。

Source

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. 从一条有序根目录覆盖链中重载全部技能,并从零重建运行时状态。

Source

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 平面将单个技能标记为停用,并立即重载运行时视图。

Source

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 平面使用有序根目录链将单个技能标记为停用,并立即重载运行时视图。

Source

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 平面将单个技能标记为停用,并立即重载运行时视图。

Source

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 平面使用有序根目录链将单个技能标记为停用,并立即重载运行时视图。

Source

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 平面移除单个技能的停用标记,并立即重载运行时视图。

Source

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 平面移除单个技能的停用标记,并立即重载运行时视图。

Source

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 平面卸载单个技能目录,并立即重载运行时视图。

Source

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 平面卸载单个技能目录,并立即重载运行时视图。

Source

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 平面对一次安装请求执行预检查,并返回结构化结果。

Source

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 平面对一次安装请求执行预检查,并返回结构化结果。

Source

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 平面对一次更新请求执行预检查,并返回结构化结果。

Source

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 平面对一次更新请求执行预检查,并返回结构化结果。

Source

pub fn list_entries(&self) -> Vec<RuntimeEntryDescriptor>

Return generic runtime entry descriptors for all loaded skills. 返回当前已加载全部 skill 的通用运行时入口描述。

Source

pub fn list_skill_help(&self) -> Vec<RuntimeSkillHelpDescriptor>

List all structured help trees currently registered in the runtime. 列出当前运行时中已注册的全部结构化帮助树。

Source

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 流程节点渲染一份结构化帮助详情载荷。

Source

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 元数据中声明的候选补全项。

Source

pub fn is_skill(&self, name: &str) -> bool

Check if a tool_name is a Lua skill.

Source

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

Source

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. 列出某个可选技能命名空间下的扁平化技能配置记录。

Source

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) 对下的可选字符串配置值。

Source

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) 对插入或替换一个字符串配置值。

Source

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. 从某个技能命名空间删除单个配置键,并返回是否移除了一个值。

Source

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.

Source

pub fn run_lua( &self, code: &str, args: &Value, invocation_context: Option<&LuaInvocationContext>, ) -> Result<Value, String>

Execute arbitrary Lua code and return the result.

Source

pub fn execute_runlua_request_json_inline( &self, request_json: &str, ) -> Result<String, String>

Execute one inline runlua request from raw JSON text. 从原始 JSON 文本执行一次进程内 runlua 请求。

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSync for T
where T: Sync,