script_engine 模块
逻辑编程(脚本/规则引擎)模块:管理逻辑脚本/规则表 script_engine,提供脚本执行与语法校验接口。
功能
script_engine表 CRUD:脚本名称、编码、所属世界/场景/绑定实体、脚本类型、触发事件、脚本内容、状态。api/execute_script.dspy:按script_type选择执行器执行脚本内容,返回{success, result}。api/validate_script.dspy:按script_type做语法/格式校验,返回{valid, message}。
数据表
script_engine(逻辑脚本表),脚本内容content使用text字段。
脚本类型(appcodes script_type)
0= Python 脚本(受限命名空间执行,通过result变量返回结果)1= 规则(JSON)(解析 JSON 作为结果)2= 表达式(eval 求值)
挂载
宿主应用入口 init() 中调用 load_script_engine()。
安装
pip install .
Description