用途:管理机器级别的 macOS caffeinate 防休眠任务,让依赖 Mac 保持唤醒的本地终端、浏览器或智能体进程不被空闲休眠打断。该技能并非 Codex 专用。
主要能力:首选机制是名为 agentdesk-caffeinate 的 launchd 托管任务,运行 /usr/bin/caffeinate -dimsu。提供 on、off、status、restart 四个命令:on 创建或刷新 launchd 任务,并移除旧的 codex-caffeinate 标签;off 移除任务并清理匹配的受管 /usr/bin/caffeinate -dimsu 进程;status 显示 launchd 状态与 pmset -g assertions 中的 caffeinate 行;restart 删除并重建任务。
使用方式:从已安装技能运行 bash "$HOME/.codex/skills/manage-caffeinate/scripts/manage-caffeinate.sh" status(on、off 同理)。若从克隆的 AgentDesk 检出运行,则用 bash "skills/manage-caffeinate/scripts/manage-caffeinate.sh" status。
验证:开启后,确认 pmset -g assertions 列出 /usr/bin/caffeinate 或带 PreventUserIdleSystemSleep、PreventUserIdleDisplaySleep、PreventSystemSleep 的 caffeinate 断言;关闭后,确认 launchctl list agentdesk-caffeinate 失败且断言消失。需要解释 launchd 机制或初始配置时,可阅读 references/setup.md。
限制:caffeinate 仅在 macOS 允许断言期间防止空闲休眠;合上 MacBook 盖子仍可能强制休眠,除非处于受支持的合盖模式(通常需连接电源与外部显示器/输入设备)。