Agent助手
- 作者仓库星标 39,477
- 作者更新于 实时读取
- 作者仓库 airi
- 领域
- AI 智能
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 88 / 100 · 社区维护
- 作者 / 版本 / 许可
- @moeru-ai · 未声明 license
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部 API Key
- 不需要
- 兼容的系统
- Windows
- 底层运行要求
- 无特殊要求
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 读取环境变量
- 网络行为
- 允许外网请求
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: agent-browser-electron
description: Use when Codex needs to inspect, debug, or automate an Electron app through `agent-browser` and…
category: AI 智能
runtime: 无特殊运行时
---
# agent-browser-electron 输出预览
## PART A: 任务判断
- 适用问题:提示词、Agent 工作流、模型评估或自动化推理。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“Overview / Why Raw CDP Discovery / Workflow”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于提示词、Agent 工作流、模型评估或自动化推理,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“Overview / Why Raw CDP Discovery / Workflow”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、执行终端命令、读取环境变量、会按任务需要访问外部网络、通常不需要额外 API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、执行终端命令、读取环境变量;会按任务需要访问外部网络;通常不需要额外 API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文出现了 `/json`、`/tmp`、`/beat-sync` 这类斜杠命令;如果你的 Agent 支持命令触发,优先用命令开场,再补充目标和边界。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、执行终端命令、读取环境变量。
先用一个小任务确认它会围绕“Overview / Why Raw CDP Discovery / Workflow”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: agent-browser-electron
description: Use when Codex needs to inspect, debug, or automate an Electron app through `agent-browser` and…
category: AI 智能
source: moeru-ai/airi
---
# agent-browser-electron
## 什么时候使用
- 用于让 Agent 打开、操作和验证浏览器页面 适合处理AI Agent、提示词、模型评估与自动化推理,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆成可执行、可检查、可继续迭代的步骤;通常…
- 面向提示词、Agent 工作流、模型评估或自动化推理,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「Overview / Why Raw CDP Discovery / Workflow」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、执行终端命令、读取环境变量;会按任务需要访问外部网络;通常不需要额外 API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "agent-browser-electron" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> Overview / Why Raw CDP Discovery / Workflow
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> 无特殊运行时 | 读取文件、写入/修改文件、执行终端命令、读取环境变量 | 会按任务需要访问外部网络
安全层 -> 通常不需要额外 API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} Agent Browser Electron
Overview
Inspect Electron renderer windows reliably when agent-browser alone is not enough to tell which CDP target maps to which visible app window.
Prefer raw CDP target discovery over guessing from tab list, then use agent-browser --cdp <port> tab stable tab IDs to interact with the renderer target you want.
Why Raw CDP Discovery
Use raw CDP target discovery because agent-browser is operating as a convenience layer on top of Chrome DevTools Protocol, and that layer can hide or flatten details that matter in Electron.
Raw /json/list is the source of truth for CDP target discovery because it exposes Chromium's target inventory without extra interpretation. It is not the same thing as Electron's BrowserWindow.getAllWindows().
In Electron, that distinction matters because:
- multiple
BrowserWindowinstances can share the same URL - some windows are created lazily and appear only after an app action
- a visible Electron window is inspectable only after its renderer/webContents exists and is exposed as a CDP target
- detached DevTools pages and workers add noise
agent-browser tab listmay show only a subset of targets or present them with reduced metadata- session state inside
agent-browsercan keep you attached to a previous renderer unless you reset and verify
In practice, the higher-level tab list view is useful for quick browsing, but not reliable enough for window-to-target mapping when:
- two Electron windows both look like
http://localhost:5173/#/ - the title is empty or collapsed
- a chat or settings window exists in CDP but is not obvious in the simplified tab output
Use curl http://127.0.0.1:<port>/json/list first whenever correct target selection matters. Treat agent-browser as the interaction client after target discovery, not as the only discovery source.
If /json/list does not contain a window that the user says exists, do not assume agent-browser hid it. First consider that the window may not have been created yet, may not have loaded a renderer route yet, or may not currently be exposed as a CDP target. Trigger the window from the app UI or Electron main-process action, then enumerate /json/list again.
Workflow
- Confirm the app exposes a CDP port.
The CDP port is project- and run-command-specific. Do not assume 9222, 9250, or any other value is universal. If an Electron process is running but no CDP port responds, tell the user to relaunch the app with the project's remote-debug environment variables or launch flags.
For AIRI stage-tamagotchi on POSIX shells:
APP_REMOTE_DEBUG=true APP_REMOTE_DEBUG_PORT=9250 pnpm dev:tamagotchi
For Windows PowerShell:
$env:APP_REMOTE_DEBUG = "true"
$env:APP_REMOTE_DEBUG_PORT = "9250"
pnpm dev:tamagotchi
For Windows Git Bash:
APP_REMOTE_DEBUG=true APP_REMOTE_DEBUG_PORT=9250 pnpm dev:tamagotchi
Adjust the port to match what the user actually started. If the project uses a different mechanism, inspect its Electron launch code before giving command advice.
- Ensure the Electron window exists.
If the app uses lazy window creation, agent-browser cannot inspect a window that has not been created yet. Open it from the app UI or trigger its Electron-side open handler first.
- Inspect raw CDP targets instead of trusting
agent-browser --cdp <port> tab.
curl -sS http://127.0.0.1:<port>/json/list
Read these fields:
titleurltypewebSocketDebuggerUrl
Use /json/version if you need to confirm the port is a Chromium/Electron CDP endpoint or need the browser-level debugger URL:
curl -sS http://127.0.0.1:<port>/json/version
- Match the target to the Electron window.
Common patterns:
- Distinct route: chat may be
http://localhost:5173/#/chatwhile the main window ishttp://localhost:5173/#/. - Distinct title: Electron window titles may surface in the target list.
- Duplicate URLs: two windows may both report
http://localhost:5173/#/; in that case use screenshots, snapshots, and Electron app knowledge to disambiguate. - Hidden noise: worker targets and detached DevTools targets are not your app window.
- List the targets through
agent-browserand switch with stable tab IDs.
agent-browser --cdp <port> tab
agent-browser --cdp <port> tab t2
Do not use positional integers. If agent-browser tab prints [t2], switch with tab t2.
- Verify the target immediately.
agent-browser --cdp <port> get url
agent-browser --cdp <port> get title
agent-browser --cdp <port> snapshot -i
- If stable tab switching is not enough, reset session state and reconnect.
agent-browser close --all
agent-browser connect <webSocketDebuggerUrl>
agent-browser get url
If needed:
agent-browser --cdp <port> screenshot /tmp/electron-target.png --annotate
agent-browser --cdp <port> console
agent-browser --cdp <port> errors
Fast Triage
Use this order when the Electron app has multiple windows:
curl /json/list- Find the renderer page target with the route or title you expect
- Ignore
workertargets unless the task is specifically about workers - Ignore
DevToolspage targets unless debugging DevTools itself agent-browser --cdp <port> tab- Switch with the stable tab ID, for example
agent-browser --cdp <port> tab t3 agent-browser --cdp <port> get urlagent-browser --cdp <port> snapshot -i- If the expected route is missing, trigger the lazy window from the UI and repeat from step 1
AIRI Example
In apps/stage-tamagotchi, some windows are lazy-created. The main window loads /#/; settings loads /#/settings; chat loads /#/chat; BeatSync loads /beat-sync.html.
The 9250 examples below assume the app was started by the person running it with:
APP_REMOTE_DEBUG=true APP_REMOTE_DEBUG_PORT=9250 pnpm dev:tamagotchi
That port is not intrinsic to AIRI or Electron. It depends on the current command and environment. Most stage-tamagotchi code lives under apps/stage-tamagotchi; inspect that app's Electron startup and window code when the port, routes, or remote-debug behavior differ.
Relevant files:
apps/stage-tamagotchi/src/main/windows/chat/index.tsapps/stage-tamagotchi/src/main/windows/main/index.tsapps/stage-tamagotchi/src/main/libs/electron/window-manager/reusable.tsapps/stage-tamagotchi/src/renderer/components/stage-islands/controls-island/index.vue
That means:
- chat does not exist in CDP until something calls
chatWindow() - settings and chat can be opened from the main window controls
- once created, raw CDP target discovery will show page targets such as
http://localhost:5173/#/settingsandhttp://localhost:5173/#/chat - the stable way to inspect a window is to enumerate raw CDP targets, map them to
agent-browserstable tab IDs, switch, and verify withget url
Example:
curl -sS http://127.0.0.1:9250/json/list
agent-browser --cdp 9250 tab
agent-browser --cdp 9250 tab t4
agent-browser --cdp 9250 get url
agent-browser --cdp 9250 snapshot -i
If settings or chat is missing, start from the main window:
agent-browser --cdp 9250 tab t2
agent-browser --cdp 9250 snapshot -i
# Click the main window control that opens the panel or launcher.
# In AIRI this is the arrow-up control in the bottom-right controls island.
# Re-snapshot after every click because refs are stale after UI changes.
agent-browser --cdp 9250 click '[i-solar\:alt-arrow-up-line-duotone]'
agent-browser --cdp 9250 snapshot -i
Then open the desired entry from the expanded controls and enumerate again:
agent-browser --cdp 9250 click '[i-solar\:settings-minimalistic-outline]'
agent-browser --cdp 9250 click '[i-solar\:chat-line-line-duotone]'
curl -sS http://127.0.0.1:9250/json/list
agent-browser --cdp 9250 tab
If the controls island is visible but the accessibility refs or CSS icon click do not expand it, inspect the Vue component as a diagnostic fallback. AIRI currently nests tooltip trigger buttons around icon buttons, so a CDP click can report success while landing on the wrapper instead of the Vue ControlButton listener. This fallback is for automation/debugging only; do not use it as evidence that end-user clicking works.
agent-browser --cdp 9250 eval '(() => {
const icon = document.querySelector("[i-solar\\:alt-arrow-up-line-duotone]")
let controls = icon.__vueParentComponent
for (let i = 0; i < 10; i++) controls = controls.parent
controls.devtoolsRawSetupState.expanded.value = true
controls.proxy.$nextTick()
return controls.devtoolsRawSetupState.expanded.value
})()'
Expected verification for chat:
agent-browser --cdp 9250 get urlreturnshttp://localhost:5173/#/chat- the snapshot exposes chat UI controls such as the message textbox or send button
Expected verification for settings:
agent-browser --cdp 9250 get urlreturnshttp://localhost:5173/#/settings- the snapshot exposes settings navigation or configuration controls
Failure Modes
agent-browser tabomits or flattens the target you need: use raw/json/list./json/listand browser-level target discovery both omit the window: the renderer target is not currently exposed. Trigger the window creation/loading path, then enumerate again.connect <webSocketDebuggerUrl>appears to succeed but later commands still point at another renderer: switch withagent-browser --cdp <port> tab tN, or runagent-browser close --all, reconnect, and verify withget url.- multiple windows share the same URL: use the target title, annotated screenshots, and app code to correlate them.
evalreturns{}for object values: preferget url,get title,snapshot -i, or primitive-only eval return values.- no chat or settings target appears: the window may not have been created yet, or may exist as an Electron object without an inspectable renderer target.
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核