docs: 为全部 38 个源文件补充详细模块级注释

为 iAs 项目的所有 Rust 源文件添加了系统化的模块级文档注释(//!),
覆盖全部 src/ 下的文件。每个文件包含模块职责、架构设计、数据流
和关键设计决策的说明。

主要变更:
- 入口/CLI: main.rs, cli.rs — 系统架构概览、子命令说明
- Daemon/Worker: daemon.rs, worker.rs — 三消费者架构、旧架构说明
- 微信通道: mod.rs, client.rs, types.rs — API 端点、登录流程
- LLM 系统: mod.rs, types.rs, provider.rs, deepseek.rs, conversation.rs
  — 架构分层、流式处理、工具循环、摘要机制
- 上下文管理: mod.rs, types.rs, builder.rs, tools.rs
  — Checkpoint 机制、Token Budget、双重摘要
- 工具系统: mod.rs, types.rs, builtin.rs, approval.rs
  — 两层元工具架构、审批流程
- 内置工具: mod.rs + 6 个工具 — API 端点、认证方式、参数说明
- 消息队列: mod.rs, message_queue.rs, runner.rs
  — 公平轮转算法、三消费者路由
- 数据库/状态/调度/日志: db/mod.rs, state.rs, scheduler.rs, logger.rs
  — 表结构、回退策略、定时任务、日志初始化
This commit is contained in:
2026-06-10 09:46:42 +08:00
parent 74bb35bd26
commit a04447c7bc
28 changed files with 493 additions and 29 deletions
+16
View File
@@ -1,3 +1,19 @@
//! ## 微信 iLink Bot API 客户端
//!
//! 封装了与微信 iLink Bot API 的所有通信:
//!
//! ### 核心功能
//! - **扫码登录** — `get_qrcode()` → `poll_qr_status()` → `login()`
//! - **消息接收** — `receive_messages()`(长轮询)
//! - **消息发送** — `send_text()`
//! - **生命周期** — `notify_start()` / `notify_stop()`
//!
//! ### 线程安全
//! `#[derive(Clone)]` + 内部 `Arc<Mutex<>>` 保证所有方法可以在 tokio task 间共享。
//!
//! ### 环境变量
//! - `WEIXIN_BASE_URL` — API 地址(默认 `https://ilinkai.weixin.qq.com`
use crate::wechat::types::*;
use base64::Engine;
use reqwest::Client as HttpClient;
+14
View File
@@ -1,2 +1,16 @@
//! ## 微信 iLink Bot 通道
//!
//! 封装与微信 iLink Bot API 的所有通信:
//!
//! - `client` — HTTP 客户端(登录、长轮询收消息、发消息、生命周期管理)
//! - `types` — API 协议类型定义(消息结构、请求/响应体)
//!
//! ### 核心流程
//! 1. `login()` — 扫码登录,获取 token + account_id
//! 2. `notify_start()` — 注册监听器
//! 3. `receive_messages()` — 长轮询接收消息
//! 4. `send_text()` — 发送文本回复
//! 5. `notify_stop()` — 注销监听器
pub mod client;
pub mod types;
+12
View File
@@ -1,3 +1,15 @@
//! ## 微信 iLink Bot API 协议类型
//!
//! 定义了与微信 iLink Bot API 通信的全部数据结构:
//!
//! - `BaseInfo` — 公共请求元数据
//! - `WeixinMessage` — 微信消息结构(支持 text/image/voice/file/video
//! - `MessageItem` — 消息条目(5 种类型)
//! - `GetUpdatesReq/Resp` — 长轮询收消息的请求/响应
//! - `SendMessageReq` — 发送消息请求
//! - `QRCodeResponse` / `StatusResponse` — 扫码登录相关
//! - `LoginResult` / `MessageEvent` — 业务层结果类型
use serde::{Deserialize, Serialize};
// ─── 基础类型 ───