feat(mcp): 用 MCP 服务替换内置 AI Agent (#319)

在现有 HTTP 服务挂载 /mcp,让外部 AI 经共享 API Key 调用原分辨率截图、批量键鼠、ATX/WOL 和虚拟介质八个工具。所有调用共用有界 FIFO 和全局限流,复用现有采集管线与硬件控制器。

移除内置模型调用、网页 Agent 面板及旧配置,设置页提供可持续查看的 Key、统一的地址/密钥复制样式。补齐 DEB 的 libudev1 运行依赖。

验证:583 项 Rust 库测试、前端生产构建、ARMv7 设备视觉操作与介质/WOL 实测,以及默认 Release 构建和 DEB 包校验通过。

Refs #319
This commit is contained in:
mofeng-git
2026-10-19 12:12:03 +08:00
parent 3f970ee834
commit 7ea2936436
50 changed files with 2910 additions and 3713 deletions

View File

@@ -39,10 +39,7 @@ use super::mjpeg_admission::{MjpegAdmissionPolicy, MjpegAdmissionStage, MjpegDro
#[path = "dmabuf.rs"]
mod dmabuf;
#[cfg(any(
test,
all(target_os = "linux", feature = "rkmpp")
))]
#[cfg(any(test, all(target_os = "linux", feature = "rkmpp")))]
fn rkmpp_dma_eligible(
backend: Option<EncoderBackend>,
codec: VideoEncoderType,
@@ -524,6 +521,7 @@ struct CachedH26xParameterSets {
/// Universal shared video pipeline
pub struct SharedVideoPipeline {
pub(crate) snapshot_slot: crate::video::snapshot::SnapshotSlot,
config: RwLock<SharedVideoPipelineConfig>,
subscribers: ParkingRwLock<Vec<Arc<VideoSubscriber>>>,
stats: ParkingMutex<SharedVideoPipelineStats>,
@@ -588,6 +586,7 @@ impl SharedVideoPipeline {
let (h264_profile_tx, h264_profile_rx) = watch::channel(None);
let pipeline = Arc::new(Self {
snapshot_slot: Default::default(),
config: RwLock::new(config),
subscribers: ParkingRwLock::new(Vec::new()),
stats: ParkingMutex::new(SharedVideoPipelineStats::default()),
@@ -1698,6 +1697,15 @@ impl SharedVideoPipeline {
owned.truncate(frame_size);
capture_sequence = capture_sequence.wrapping_add(1);
if pipeline.snapshot_slot.pending() {
pipeline.snapshot_slot.publish(&VideoFrame::from_vec(
owned.clone(),
resolution,
pixel_format,
stride,
capture_sequence,
));
}
if parallel_mjpeg_decode
&& pixel_format == PixelFormat::Mjpeg
@@ -2079,7 +2087,10 @@ impl SharedVideoPipeline {
}
}
fn compact_strided_frame_for_encoder(frame: &VideoFrame, data: &[u8]) -> Result<Option<Vec<u8>>> {
pub(crate) fn compact_strided_frame_for_encoder(
frame: &VideoFrame,
data: &[u8],
) -> Result<Option<Vec<u8>>> {
let width = frame.resolution.width as usize;
let height = frame.resolution.height as usize;
let stride = frame.stride as usize;