mirror of
https://github.com/aiclientproxy/proxycast.git
synced 2026-09-24 23:10:56 +08:00
- proxycast-core: models, data, logger, errors, backends, connect, session_files, orchestrator, session(rate_limit/sticky), config, middleware, plugin - proxycast-providers: providers, converter, streaming, translator, stream, session(SessionManager/signature_store) - 主 crate 保留 Tauri 业务逻辑,通过 re-export 保持 API 兼容 - 版本号升级到 0.60.0 - 移除已删除的 useFlowEvents hook 导出 - 移除已废弃的 flow_monitor 端到端测试
plugin
架构说明
插件系统模块,提供插件扩展功能:
- 插件加载和初始化
- 请求前/响应后钩子
- 插件隔离和错误处理
- 插件配置管理
- 二进制组件下载和管理
- 声明式插件 UI 系统(基于 A2UI 设计理念)
文件索引
mod.rs- 模块入口和导出types.rs- 核心类型定义(Plugin trait、PluginContext 等)loader.rs- 插件加载器manager.rs- 插件管理器(生命周期、钩子执行)binary_downloader.rs- 二进制组件下载管理ui_types.rs- 插件 UI 类型定义(组件、消息、数据绑定)ui_trait.rs- 插件 UI Trait 定义ui_builder.rs- UI 构建器辅助 APIui_events.rs- UI 事件推送(Tauri 事件)examples/- 示例插件credential_monitor.rs- 凭证监控示例
tests.rs- 单元测试
插件 UI 系统
基于 A2UI 设计理念的声明式 UI 系统:
- 安全如数据:插件只能声明 UI 结构,不能执行任意代码
- 组件白名单:预定义可用组件集(Row, Column, Card, Text, Button 等)
- 数据绑定分离:UI 结构与数据模型分离,支持增量更新
使用示例
use crate::plugin::{
SurfaceDefinition, ComponentDef, ChildrenDef,
BoundValue, Action, ComponentType, ColumnProps,
};
use serde_json::json;
// 创建 Surface 定义
let surface = SurfaceDefinition {
surface_id: "my-plugin-ui".into(),
root_id: "root".into(),
initial_components: vec![
ComponentDef::column("root", ChildrenDef::explicit(vec!["title", "content"])),
ComponentDef::text_literal("title", "插件标题"),
ComponentDef::text_bound("content", "/data/message"),
],
initial_data: json!({
"data": {
"message": "Hello from plugin!"
}
}),
styles: None,
};
更新提醒
任何文件变更后,请更新此文档和相关的上级文档。