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