Skip to main content

zerolaunch_plugin_protocol/
methods.rs

1/// Host-to-plugin method names (plugin/* namespace).
2pub mod plugin {
3    /// 进程级握手:插件初始化(版本协商、目录、locale 下发)。
4    pub const INITIALIZE: &str = "plugin/initialize";
5    /// 拉取插件实现的全部组件清单(ComponentDescriptor 列表)。
6    pub const GET_COMPONENTS: &str = "plugin/get_components";
7    /// 拉取指定组件的设置 schema。
8    pub const GET_SETTINGS_SCHEMA: &str = "plugin/get_settings_schema";
9    /// 拉取指定组件当前的设置值。
10    pub const GET_SETTINGS: &str = "plugin/get_settings";
11    /// 指定组件应用新的设置值。
12    pub const APPLY_SETTINGS: &str = "plugin/apply_settings";
13    /// 校验一组设置值是否合法(不实际应用)。
14    pub const VALIDATE_SETTINGS: &str = "plugin/validate_settings";
15    /// 拉取指定组件的配置动作列表。
16    pub const CONFIG_ACTIONS: &str = "plugin/config_actions";
17    /// 执行指定组件的配置动作。
18    pub const EXECUTE_CONFIG_ACTION: &str = "plugin/execute_config_action";
19    /// 插件查询(Plugin 组件)。
20    pub const QUERY: &str = "plugin/query";
21    /// 执行插件动作(Plugin 组件)。
22    pub const EXECUTE_ACTION: &str = "plugin/execute_action";
23    /// 插件初始化钩子(注册完成后通知,携带真实查询上下文)。
24    pub const INIT: &str = "plugin/init";
25    /// 拉取面板交互策略(PanelInteraction,插件级语义)。
26    /// 插件级语义:宿主仅对 Plugin 种类组件调用;SDK 恒返回主插件策略。
27    pub const INTERACTION_POLICY: &str = "plugin/interaction_policy";
28    /// 拉取指定组件的默认启用状态。
29    pub const GET_DEFAULT_ENABLED: &str = "plugin/get_default_enabled";
30    /// DataSource 组件:采集候选项。
31    pub const FETCH_CANDIDATES: &str = "plugin/fetch_candidates";
32    /// ActionExecutor 组件:支持的目标类型列表。
33    pub const SUPPORTED_TARGET_TYPES: &str = "plugin/supported_target_types";
34    /// ActionExecutor 组件:支持的动作列表。
35    pub const SUPPORTED_ACTIONS: &str = "plugin/supported_actions";
36    /// ActionExecutor 组件:执行动作。
37    pub const EXECUTOR_EXECUTE: &str = "plugin/executor_execute";
38    /// SearchEngine 组件:对缓存候选计算分数。
39    pub const CALCULATE_SCORES: &str = "plugin/calculate_scores";
40    /// ScoreBooster 组件:对已计算分数做增强。
41    pub const BOOSTER_BOOST: &str = "plugin/booster_boost";
42    /// ScoreBooster 组件:记录用户确认(学习用户习惯)。
43    pub const BOOSTER_RECORD: &str = "plugin/booster_record";
44    /// KeywordOptimizer 组件:拉取声明属性(input_source / priority)。
45    pub const KEYWORD_OPTIMIZER_INFO: &str = "plugin/keyword_optimizer_info";
46    /// KeywordOptimizer 组件:优化单个关键词。
47    pub const KEYWORD_OPTIMIZE: &str = "plugin/keyword_optimize";
48    /// KeywordInjector 组件:对单个候选注入关键词。
49    pub const KEYWORD_INJECT: &str = "plugin/keyword_inject";
50}
51
52/// Plugin-to-host method names (host/* namespace).
53pub mod host {
54    /// 插件侧日志写入(转发到宿主日志系统)。
55    pub const LOG: &str = "host/log";
56    /// 插件侧通知弹窗(宿主桌面通知)。
57    pub const NOTIFY: &str = "host/notify";
58    /// 打开指定路径/URL(系统关联)。
59    pub const SHELL_OPEN: &str = "host/shell.open";
60    /// 打开资源管理器文件夹。
61    pub const SHELL_OPEN_FOLDER: &str = "host/shell.open_folder";
62    /// 以提权方式执行命令。
63    pub const SHELL_EXECUTE_ELEVATION: &str = "host/shell.execute_elevation";
64    /// 执行命令(普通权限)。
65    pub const SHELL_EXECUTE_COMMAND: &str = "host/shell.execute_command";
66    /// 激活指定进程对应的窗口。
67    pub const WINDOW_ACTIVATE_BY_PROCESS: &str = "host/window.activate_by_process";
68    /// 获取图标(返回 WebP/PNG base64 字节)。
69    pub const ICON_GET: &str = "host/icon.get";
70    /// 枚举已安装应用。
71    pub const APP_ENUMERATE: &str = "host/app.enumerate";
72    /// 解析路径(环境变量展开等)。
73    pub const PATH_RESOLVE: &str = "host/path.resolve";
74    /// 上传资源文件到插件目录。
75    pub const RESOURCE_UPLOAD: &str = "host/resource.upload";
76    /// 写入资源文件。
77    pub const RESOURCE_PUT: &str = "host/resource.put";
78    /// 读取资源文件。
79    pub const RESOURCE_GET: &str = "host/resource.get";
80    /// 删除资源文件。
81    pub const RESOURCE_DELETE: &str = "host/resource.delete";
82    /// 列出插件目录资源。
83    pub const RESOURCE_LIST: &str = "host/resource.list";
84    /// 解析参数模板。
85    pub const PARAMETER_RESOLVE: &str = "host/parameter.resolve";
86    /// 拉取宿主当前 locale。
87    pub const GET_LOCALE: &str = "host/i18n.get_locale";
88    /// 拉取宿主当前主题。
89    pub const GET_THEME: &str = "host/theme.get";
90    /// 拉取全网模型清单(聚合所有提供方)。
91    pub const MODEL_LIST: &str = "host/model.list";
92    /// 按 model_id 调用文本生成。
93    pub const MODEL_CHAT: &str = "host/model.chat";
94    /// 按 model_id 调用文本向量化。
95    pub const MODEL_EMBEDDING: &str = "host/model.embedding";
96    /// 按 model_id 计算查询向量与多个目标向量的相似度。
97    pub const MODEL_SIMILARITY: &str = "host/model.similarity";
98}
99
100/// Notification-only method names (fire-and-forget, no response expected).
101pub mod notify {
102    /// 插件进程就绪通知。
103    pub const PLUGIN_READY: &str = "plugin/ready";
104    /// 插件进程崩溃通知。
105    pub const PLUGIN_CRASHED: &str = "plugin/crashed";
106}