Skip to content

AtomCode 桌面通知系统与平台集成分析

持续深度分析 — 桌面通知、终端检测、平台兼容性 2026-06-23


1. 桌面通知系统架构

1.1 支持的通知方式

方式平台命令/API事件
notify-sendLinux (libnotify)notify-send桌面通知弹窗
terminal-notifiermacOSterminal-notifiermacOS 通知中心
Swift 原生macOSosascriptAppleScript 弹窗
Kitty 协议跨平台终端\x1b]777;notify;Kitty 终端内通知
TUI 内通知跨平台NotificationConfig终端 UI 内提示

1.2 通知事件类型

事件消息模板场景
AtomCode approval neededAtomCode approval needed等待用户审批工具调用
AtomCode doneAtomCode done任务完成
AtomCode cancelledAtomCode cancelled用户中止
AtomCode failedAtomCode failed任务失败
FailedFailed通用失败通知

1.3 通知流

任务状态变更

    ├──▶ TUI 内通知(实时)

    ├──▶ 桌面通知(如支持)
    │      ├── Linux:  notify-send "AtomCode" "Done"
    │      ├── macOS:   terminal-notifier -title "AtomCode" -message "Done"
    │      └── 终端:    \x1b]777;notify;AtomCode Done\x1b\\

    ├──▶ WebUI 通知(通过 SSE)

    └──▶ Telemetry 事件

2. 终端检测系统

2.1 识别的终端

终端名称环境变量特性支持
KittyKITTY_WINDOW_IDKitty 键盘协议、通知
WezTermWEZTERM_PANE图像、超链接
Ghosttyghostty新终端
Apple TerminalTERM_PROGRAM=Apple_Terminal基础功能
iTerm2TERM_PROGRAM=iTerm.app图像、标记
tmuxTMUX面板管理

2.2 Kitty 键盘协议

Kitty 键盘协议(渐进式键盘事件):
  - KITTY_WINDOW_ID 存在时启用
  - 增强按键事件(修饰键组合等)
  - 支持: 大部分现代终端
  - 回退: 终端不支持时还原为标准模式
  
  ATOMCODE_KBD_NOT_ENHANCED:
    禁用 Kitty 键盘协议
  ─────────────────────────────────
  修复:
  - JediTerm 鼠标移动乱码(不再启用 Kitty 键盘协议)
  - panic 时 Kitty 协议残留

3. MacOS 集成

3.1 特殊路径

/Applications/PgyVisitor_download.app/Library/LaunchDaemons/com.oray.pgy.plist
Library/Logs/PgyVisitor

这些路径来自蒲公英(Pgyer)访客模式,表明 AtomCode 在 macOS 上可能通过 Pgyer 分发。

3.2 Swift/AppleScript

osascript(AppleScript)用于:
  - 显示原生 macOS 对话框
  - 申请文件权限
  - 通知中心消息

3.3 macOS 敏感路径

/Applications
/var/folders
Library/Logs

4. 系统托盘与后台

4.1 通知后台配置

toml
[notifications]
# 默认启用桌面通知
# enabled = true

4.2 NotificationConfig

rust
struct NotificationConfig {
    // 通知启用状态
    // 无已发现的具体字段结构
}

5. 终端 UI 内通知字符串

从嵌入式 JS 提取的本地化通知文本:

javascript
"chat.stop": "Stop",
"chat.send": "Send",
"chat.queue": "Queue message (sent after the current turn finishes)",
"chat.queued": "Queued",
"chat.removeQueued": "Remove",
"chat.error": "[Error: {msg}]",
"chat.connError": "[Connection error: {msg}]",

CSS 类名:

.ghost-btn
.header-remote-btn
.session-body
.app-sidebar
.chat-body
.chat-landing
.code-block-wrapper
.cwd-breadcrumb
.cwd-prefix
.dir-breadcrumb
.dir-browser
.effort-prefix
.provider-edit-btn
.sidebar-search

6. NotificationConfig 配置

toml
[notification]
# enabled = true   # 默认启用

NotificationConfig 结构体在二进制中的位置:

rust
struct NotificationConfig

通知系统受 ATOMCODE_PLAIN(纯文本模式)和 ATOMCODE_RETAIN(保留模式)影响。


7. 终端特性支持汇总

特性KittyWezTermiTerm2Terminal.appGhostty
图像渲染
增强键盘
通知
超链接
标记/跳转

8. 新覆盖的盲区

#之前未覆盖的领域状态发现
1桌面通知系统4 种通知方式 + 5 种事件
2终端检测机制6 种终端 + Kitty 协议
3macOS 集成细节osascript, Pgyer
4TUI 通知字符串本地化消息 + CSS 类名
5Kitty 键盘协议回退KBD_NOT_ENHANCED 控制

本报告由持续分析循环生成

逆向命令索引

bash
# 提取通知相关
strings atomcode.bin.bak | grep -iE "notify-send|unfocused|KITTY_WINDOW|WEZTERM" | sort -u
# 输出: notify-send unfocused KITTY_WINDOW_ID WEZTERM_PANE

# 提取通知配置
strings atomcode.bin.bak | grep -iE "NotificationConfig" | sort -u

基于 VitePress 构建 · AtomCode v4.25.3 逆向工程分析文档