IDE Device Agent

wescode 的 IDE 能力定位为 Device Agent:零额外 tool schema footprint。


定位

wescode 的 IDE 能力从 v1.0 起明确定位为 wescode 自己的 Device Agent。

所有 IDE 能力通过 CellSpec.HostEnvironment 透明注入——LLM 只看到 wesgine 标准 read / exec / edit 工具。


能力清单

能力Capability实现机制LLM 感知
Buffer Overlaywescode_bufferHost.Files() 拦截 read → 编辑器内存内容❌ 透明
Exec 三分类wescode_terminalHost.Shell() 拦截 exec → 静默/验证/交互❌ 透明
Editor 状态wescode_editorHost.Editor() → 焦点文件/光标❌ 透明
Diff 预览wescode_diff私有 RPC wescode/showDiff❌ 应用层
通知wescode_notify私有 RPC + diagnostics/set❌ 应用层
文件定位wescode_reveal私有 RPC wescode/revealInExplorer❌ 应用层

Buffer Overlay

AI 的 read 工具优先读编辑器内存中的最新内容:

  1. WescodeBufferSync 监听 onDidChangeContent,debounce 400ms
  2. 后端 BufferStore 维护 (cellID, path) → content
  3. OverlayFileProvider 先查 BufferStore,未命中才落到磁盘
  4. 保存时自动清除 overlay
  5. 大文件(>1MB)不同步

路径归一化

normalizePath 使用 filepath.EvalSymlinks 解析 symlink:


INV-EDIT-01

AI 编辑后 buffer === disk(无 dirty 状态)

InlineDiffController.confirmDiff() 在画 diff 前调用 textFileService.revert(uri)。


协议现状

wescode 使用自建 JSON-RPC(不是 MCP 标准),但语义完全等价。

v2 可能统一到 MCP 协议,让 device agent 与其他 device agent 共享注册路径。


可选标准 Adapter

与 IDE Device Agent 正交:

Adapter用途
CellSpec.Playwright用户浏览器自动化
CellSpec.DesktopOS 级桌面自动化

约束


相关文档