← 返回
AI智能 中文

Desktop Guardian

macOS GUI automation and desktop control for OpenClaw, powered by Hammerspoon. Gives your agent full access to interact with the Mac desktop — query windows,...
基于 Hammerspoon 的 macOS GUI 自动化与桌面控制工具,专为 OpenClaw 设计。赋予 Agent 完全权限以与 Mac 桌面交互——查询窗口等。
s3rous
AI智能 clawhub v2.0.0 1 版本 99825.3 Key: 无需
★ 0
Stars
📥 1,143
下载
💾 54
安装
1
版本
#latest

概述

Desktop Guardian

Full macOS GUI access and desktop automation for OpenClaw, powered by Hammerspoon.

What It Does

🖥️ GUI Access

  • Query all open windows, apps, and dialogs with full detail (titles, buttons, states)
  • Close specific windows or tabs — not just kill entire apps
  • Click buttons in system dialogs and popups (with safety guardrails)
  • Send keypresses to any app
  • Quit or force-quit apps programmatically
  • Chrome DevTools Protocol integration for tab-level browser control

🛡️ Active Desktop Monitoring

  • Watches for system dialogs, permission prompts, error popups, and alerts in real-time
  • Auto-dismisses known-safe dialogs (e.g., "app downloaded from internet")
  • Alerts you via Telegram/chat when human input is needed (e.g., security prompts)
  • Detects and closes unauthorized apps and excess browser windows/tabs
  • Enforces configurable desktop policies via YAML rules
  • Logs every action for full audit trail

Requirements

  • macOS (Tahoe or later)
  • Hammerspoon (installed automatically) + Accessibility permission
  • Python 3 + PyYAML (installed automatically)
  • Optional: Chrome with --remote-debugging-port=9222 for tab-level control

Installation

bash scripts/install.sh

This will:

  1. Install Hammerspoon if needed
  2. Install the DesktopGuardian Spoon
  3. Guide you through Accessibility permission
  4. Compile the Swift fallback for degraded mode
  5. Set up config, logs, and LaunchAgent

Configuration

Config file: ~/.openclaw/skills/desktop-guardian/policy.yaml

See assets/config.example.yaml for all options. Key settings:

  • cleanup.enabled: Master switch for auto-cleanup (default: true)
  • cleanup.apps.whitelist: Apps allowed to run; others get closed
  • browsers.chrome.max_windows/max_tabs: Limits before auto-close
  • dialogs.auto_dismiss: Apps whose dialogs are safe to dismiss
  • dialogs.ignore: Apps whose dialogs should be silently ignored
  • alerts.notify_on_actions: Send notification for every auto-action

Chrome Tab Monitoring

For tab-level granularity, Chrome must run with CDP enabled:

open -a "Google Chrome" --args --remote-debugging-port=9222

Without CDP, only window counts are available.

Kill Switch

Instantly disable all actions:

touch ~/.openclaw/skills/desktop-guardian/KILL_SWITCH

Remove to re-enable:

rm ~/.openclaw/skills/desktop-guardian/KILL_SWITCH

Graceful Degradation

Without Hammerspoon, the skill runs in monitor-only mode using a Swift fallback binary. It can detect violations but cannot auto-close or dismiss anything.

helpers.py Subcommands

parse_config          — Output config as key=value pairs
validate_config       — Validate config (exit 0/1)
check_quiet           — Exit 0 if NOT in quiet hours
evaluate_snapshot     — Apply policy to snapshot JSON → violations + actions
parse_query           — Convert snapshot to key=value pairs
safe_hs_command       — Generate safe hs -c command string
update_state          — Update alert cooldown state
log_violation         — Append to violation log
daily_summary         — Generate daily summary
list_apps             — List apps from last snapshot
check_cooldown        — Check if alert cooldown has expired

Security

  • Never interpolates shell variables into hs -c commands
  • Hardcoded button blacklist: won't click Allow, Delete, Install, etc.
  • Hardcoded app blacklist: won't dismiss SecurityAgent, Keychain Access, etc.
  • All app names validated against ^[a-zA-Z0-9 ._-]+$
  • Config file mode 600, state uses atomic writes
  • Full audit log of every action taken

Uninstall

bash scripts/uninstall.sh

Removes LaunchAgent, Spoon, and init.lua entries. Preserves config/logs unless you choose to remove them. Does NOT uninstall Hammerspoon.

版本历史

共 1 个版本

  • v2.0.0 当前
    2026-03-29 11:05 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-intelligence

Nano Banana Pro

steipete
使用 Nano Banana Pro (Gemini 3 Pro Image) 生成或编辑图像。支持文生图、图生图及 1K/2K/4K 分辨率,适用于图像创建、修改及编辑请求,使用 --input-image 指定输入图像。
★ 417 📥 115,182
ai-intelligence

Proactive Agent

halthelobster
将AI智能体从任务执行者升级为主动预判需求、持续优化的智能伙伴。集成WAL协议、工作缓冲区、自主定时任务及实战验证模式。Hal Stack核心组件 🦞
★ 836 📥 213,076
ai-intelligence

ontology

oswalpalash
类型化知识图谱,用于结构化智能体记忆与可组合技能。支持创建/查询实体(人员、项目、任务、事件、文档)及关联...
★ 712 📥 243,773