Skip to content

v1.4.0 — 本地 LLM / 代码 review / 任务队列 / P2P / Agent 学习

Choose a tag to compare

@opc007 opc007 released this 17 Jun 07:53
· 19 commits to main since this release

v1.4.0

五大新功能:

🏠 1. 本地 LLM 集成(Ollama / llama.cpp)

  • provider/src/local.rs 模块,两个 Model trait 实现:
    • OllamaProvider — 走 http://127.0.0.1:11434/api/chat(NDJSON 流式)
    • LlamaCppProvider — 走 llama.cpp server 的 OpenAI 兼容接口
  • discover_all(ollama_url, llamacpp_url) 自动探测本机可用模型
  • Top bar 🏠 打开 LocalModelDialog:列表 / 测速 / 复制 ID
  • /local [ollama_url] slash 命令快速探测
  • 模型 ID 格式:ollama:<name> / llamacpp:<name>

🔍 2. 代码 review / 静态分析集成

  • crates/lint crate,三个 Checker
    • rust-clippycargo clippy --message-format=json(correctness 警告)
    • tsctsc --noEmit
    • todo-scanner — 扫描 .rs/.ts/.tsx/.js/.jsx/.py/.go 等源文件里的 TODO/FIXME/XXX/HACK
  • Top bar 🔍 打开 CodeReviewDialog:按严重度筛选 / 按 file 展示
  • /lint [path] slash 命令快速扫描

📋 3. Agent 任务队列 + 后台执行

  • crates/queue crate:
    • 并发可控(默认 2)
    • 状态机:pending → running → completed | failed | cancelled
    • 每个任务有 tokio::sync::watch 取消信号
    • broadcast 进度事件
  • 内置 executor:Command(sh -c / cmd /C)/ Lint(委派 step 2)
  • Top bar 📋 打开 QueuePanel:实时状态 / 进度条 / 日志 / 结果 / cancel
  • /queue [cmd] 后台跑命令不阻塞当前 chat

📡 4. P2P 设备协同(同局域网)

  • crates/p2p crate:
    • mDNS 广播(macOS dns-sd / Linux avahi-publish
    • TCP 长连接 + 行分隔 JSON 协议
    • 6 位 pairing code 手动授权
    • 协议:Hello / Pair / PairOk / PairDenied / SessionList / SessionPull / SessionData / Ping / Pong / Bye
  • 设备 ID 持久化到 ~/.agentshell/device_id
  • Top bar 📡 打开 DevicesPanel:host / client / 配对请求 / peer 列表

🧠 5. Agent 学习 / 个性化

  • crates/learning crate:
    • 跟踪模型使用、工具使用、slash 命令、提示长度、语言、活跃时段
    • 简单 token 提取 + stopword 过滤
    • 推断偏好(默认模型 / 常用工具 / 偏好语言 / 典型提示长度)
    • 置信度(基于总信号数)
  • 持久化到 ~/.agentshell/learning.json
  • inject_text() 输出 system prompt 注入片段
  • Top bar 🧠 打开 LearningPanel:偏好 / 统计 / top 10 工具 / 词云 / 👍👎
  • /learn / /learn feedback [bad] / /learn reset slash 命令

📊 总体

  • 180 个 Rust 单元测试通过
  • 全部 TypeScript 类型检查 + Vite build 通过
  • Cargo workspace 14 个 crate:core / provider / patch / context / mcp / sandbox / computer-use / license / memory / voice / marketplace / vault / lint / queue / p2p / learning

🆕 新依赖

  • regex-lite — 用于 tsc 输出解析
  • rand — 用于 pairing code 生成

完整更新见 git log。