Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .agents/plugins/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@
"authentication": "ON_USE"
},
"category": "Developer Tools"
},
{
"name": "electron-agent-debug",
"source": {
"source": "local",
"path": "./plugins/electron-agent-debug"
},
"policy": {
"installation": "AVAILABLE",
"authentication": "ON_USE"
},
"category": "Developer Tools"
}
]
}
36 changes: 36 additions & 0 deletions .github/workflows/electron-agent-debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Electron Agent Debug
on:
pull_request:
paths:
- 'plugins/electron-agent-debug/**'
- 'tests/electron-agent-debug/**'
- 'scripts/validate-electron-agent-debug.mjs'
- '.github/workflows/electron-agent-debug.yml'
- 'package.json'
push:
branches: [main]
paths:
- 'plugins/electron-agent-debug/**'
- 'tests/electron-agent-debug/**'
- 'scripts/validate-electron-agent-debug.mjs'
- '.github/workflows/electron-agent-debug.yml'
- 'package.json'
permissions:
contents: read
jobs:
master:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
- name: Run master suite on Node 22
run: npm run test:electron-agent-debug
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
- name: Run master suite on Node 24
run: npm run test:electron-agent-debug
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Public Codex plugins and their reproducible validation suites.",
"type": "module",
"scripts": {
"validate": "npm run validate:marketplace && node scripts/validate-grafana.mjs && npm run validate:reviewops-auditor-benchmark && npm run validate:react-native-to-swiftui && npm run validate:autodesk-fusion && npm run validate:pcba-engineering",
"validate": "npm run validate:marketplace && node scripts/validate-grafana.mjs && npm run validate:reviewops-auditor-benchmark && npm run validate:react-native-to-swiftui && npm run validate:autodesk-fusion && npm run validate:pcba-engineering && npm run validate:electron-agent-debug",
"validate:marketplace": "node scripts/validate-marketplace.mjs",
"validate:grafana": "node scripts/validate-grafana.mjs",
"validate:reviewops-auditor-benchmark": "node scripts/validate-reviewops-auditor-benchmark.mjs",
Expand Down Expand Up @@ -36,7 +36,9 @@
"build:autodesk-fusion": "npm --prefix plugins/autodesk-fusion run build",
"test:physical-engineering": "node tests/physical-engineering/run.mjs",
"test:pcba-engineering": "npm run validate:pcba-engineering && node --test --test-concurrency=1 tests/pcba-engineering/unit/*.test.mjs tests/pcba-engineering/integration/*.test.mjs tests/pcba-engineering/security/*.test.mjs && python3 tests/pcba-engineering/support/dataset-verify.py",
"validate:pcba-engineering": "node scripts/validate-pcba-engineering.mjs"
"validate:pcba-engineering": "node scripts/validate-pcba-engineering.mjs",
"test:electron-agent-debug": "npm run validate:electron-agent-debug && node --test --test-concurrency=1 tests/electron-agent-debug/package.test.mjs",
"validate:electron-agent-debug": "node scripts/validate-electron-agent-debug.mjs"
},
"engines": {
"node": ">=22.19.0"
Expand Down
37 changes: 37 additions & 0 deletions plugins/electron-agent-debug/.codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "electron-agent-debug",
"version": "1.0.4",
"description": "Diagnose running local Electron apps using a bundled, attach-only MCP runtime and Agent Skill.",
"author": {
"name": "longhun12346",
"url": "https://github.com/longhun12346"
},
"homepage": "https://github.com/openai/community-plugins/tree/main/plugins/electron-agent-debug",
"repository": "https://github.com/longhun12346/electron-agent-debug",
"license": "MIT",
"keywords": [
"electron",
"debugging",
"diagnostics",
"mcp",
"developer-tools"
],
"skills": "./skills/",
"interface": {
"displayName": "Electron Agent Debug",
"shortDescription": "Diagnose Electron with a bundled local MCP runtime.",
"longDescription": "Use the bundled Node.js MCP runtime to inspect main-process Inspector and renderer CDP state, targets, logs and exceptions. The Agent verifies the package, configures the local stdio entry and provides the running app, dynamic loopback endpoints and regression steps. Application lifecycle and final verification remain with the Agent.",
"developerName": "longhun12346",
"category": "Developer Tools",
"websiteURL": "https://github.com/longhun12346/electron-agent-debug",
"capabilities": [
"Read",
"Write",
"Execute"
],
"brandColor": "#478CBF",
"defaultPrompt": [
"Use $electron-debug after I provide the Electron project checks and dynamic Inspector/CDP endpoints. Collect runtime evidence and tell me what remains to verify."
]
}
}
21 changes: 21 additions & 0 deletions plugins/electron-agent-debug/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 longhun12346

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
37 changes: 37 additions & 0 deletions plugins/electron-agent-debug/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Electron Agent Debug

Version 1.0.4 provides an Agent Skill and its self-contained JavaScript MCP runtime for attach-only diagnosis of a running local Electron application. Four tools return main-process Inspector and renderer CDP state, targets, logs and exceptions. The Agent supplies the application, regression steps and dynamic loopback endpoints, then decides what the evidence proves.

## Install and prerequisites

After the PR is accepted, install the complete plugin from the community marketplace. Preserve the entire skills/electron-debug directory, including runtime, references, VERSION.md and third-party licenses. Node.js 22+ is required. Node, Electron, native binaries and optional native accelerators are not shipped.

Installing the plugin does not register or launch MCP. Normal use requires no source download, dependency installation or build. Verify the package origin through an approved installation channel before running package code.

## Safe first run

Use this prompt after preparing the project:

`Use $electron-debug to verify this Electron change. Use the project's existing commands and actual local Inspector/CDP endpoints. Verify the bundled runtime, configure the host as needed, collect evidence and run the project regression. Report BLOCKED if a necessary prerequisite cannot be supplied.`

The Agent determines the installed Skill's absolute path and runs:

```text
node <absolute-skill-directory>/runtime/launch.cjs --verify
```

On success, configure the host's local stdio MCP entry to run the same launcher without --verify. Refresh the host and confirm electron_attach, electron_status, electron_targets and electron_logs are visible. Host configuration paths, application commands, ports and target selectors remain environment-specific. Full setup, migration and provenance instructions are in [the bundled setup reference](skills/electron-debug/references/mcp-setup.md).

## Permissions, execution and data

The interface declares Read, Write and Execute to disclose the workflow: read project/configuration files; update the host's MCP configuration when authorized; launch the bundled Node.js stdio process; and use the project's existing commands for preparation and regression. These labels do not grant permissions or bypass host approval. The MCP server itself does not write project files, execute page code, inspect DOM, take screenshots, set breakpoints or manage Electron's lifecycle.

No install hooks, credentials, OAuth flow or remote service are included. No project files or diagnostic logs are uploaded. The runtime connects only to Agent-provided loopback HTTP(S) discovery endpoints and loopback WebSockets, and retains bounded events in memory. Do not supply production endpoints or private logs.

The launcher checks the manifest and SHA-256 hashes before loading MCP. Missing or inconsistent files produce PACKAGE_INTEGRITY_ERROR and no server launch. Same-package hashes detect inconsistency; they do not independently establish publisher identity or code safety. Missing application, endpoint, target or regression prerequisites produce BLOCKED rather than a code-failure verdict.

## Validation

Run `npm run test:electron-agent-debug` at the marketplace root. This master command validates metadata and exercises an archived package in isolated project/global layouts, all four MCP tools with network and external module loading prohibited, and corruption/missing-file rejection.

The [source release](https://github.com/longhun12346/electron-agent-debug/releases/tag/skill-v1.0.4) supplies build-provenance verification, cross-platform CI and real Electron fixture evidence. These source checks are separate from marketplace package tests and do not prove an installed Codex session or a caller's business regression passed.
135 changes: 135 additions & 0 deletions plugins/electron-agent-debug/skills/electron-debug/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
---
name: electron-debug
description: Use when validating Electron main-process, BrowserWindow, renderer, preload, or IPC changes, or investigating a blank window or runtime error in a running local Electron app. Collect Inspector/CDP status, targets, logs, and exceptions using the bundled attach-only MCP runtime for Agent-led verification.
license: MIT
---

# Electron Agent Debug

为编码 Agent 提供轻量、attach-only 的 Electron 诊断能力。MCP 返回运行时事实;Agent 准备应用、执行业务回归并自行判断结果。

## 触发条件

| 场景 | 行为与通道 |
| --- | --- |
| 主进程、BrowserWindow 或窗口生命周期修改后需要运行时验证 | 检查主进程 Inspector、日志及项目回归结果 |
| renderer 白屏、页面加载或前端异常 | 检查 renderer CDP、正确的 page target、日志及项目回归结果 |
| preload、contextBridge 或 IPC 修改 | 同时检查主进程和 renderer,双方各需证据,并执行覆盖调用链的项目回归 |
| 用户明确要求诊断已经运行的本地 Electron 应用 | 根据问题选择最小必要通道 |
| 纯类型或构建问题,无运行时观察需求 | 优先使用项目已有检查,不必 attach |
| 需要截图、DOM、evaluate、断点或交互操作 | 使用项目已有测试或其他工具;本 MCP 不提供这些能力 |

## 核心能力

| 工具 | 返回内容 |
| --- | --- |
| `electron_attach` | 两个通道各自的连接结果、target 和结构化错误 |
| `electron_status` | 当前在线状态、endpoint 来源、selected target 和事件数量 |
| `electron_targets` | renderer page targets 与明确选择结果 |
| `electron_logs` | 有界缓存中的日志、异常、连接和协议事件 |

MCP 不启动、停止、重启或操作 Electron,不执行页面代码,不修改用户项目。业务测试、视觉验证和最终验收由 Agent 使用项目已有工具完成。

## 使用方法

### 1. 准备随包 MCP

本 Skill 包含 `runtime/launch.cjs`、MCP JavaScript bundle、版本清单及依赖许可证。Agent 使用当前已安装 Skill 的实际绝对目录,运行环境需要 Node.js 22 或更高版本。

先确认安装渠道及版本符合当前任务要求,再执行本地完整性检查:

```text
node <absolute-skill-directory>/runtime/launch.cjs --verify
```

校验通过后,以同一个入口配置本地 MCP stdio Server:

```json
{
"mcpServers": {
"electron-agent-debug": {
"command": "node",
"args": ["<absolute-skill-directory>/runtime/launch.cjs"]
}
}
}
```

这只是配置概念示例。Agent 根据实际宿主查找配置入口,避免重复注册,按宿主规则刷新,并验证四个工具可见。Skill 安装不会自动注册 MCP。全局和项目级安装均使用对应 Skill 目录中的运行文件,不写死用户目录或配置路径。

运行文件缺失或校验失败时报告 `BLOCKED`,从已获准的安装渠道重新安装完整版本。正常使用不下载额外源码、不安装依赖、不在本机构建 MCP,也不以远程执行作为备用路径。

宿主配置、版本更新和校验边界见 [MCP 接入说明](references/mcp-setup.md)。当前包版本见 [VERSION.md](VERSION.md)。

### 2. 由 Agent 提供诊断前提

- Electron 项目目录、本次修改要证明的预期行为。
- 项目已有启动、停止或重启命令,以及测试或业务回归步骤。
- 已运行的 Electron 应用及本次实际使用的 Inspector 和/或 CDP discovery endpoint。
- 多窗口时的 target 选择条件。

Agent 可以通过项目已有启动命令支持的参数暴露所需 endpoint。端口由 Agent 或项目动态决定,不扫描端口、不猜测入口,也不为了接入 MCP 改写项目启动脚本。只允许本地回环 HTTP(S) discovery endpoint,其返回的 WebSocket 地址也必须是回环地址。

缺少必要前提且无法补齐时报告 `BLOCKED`,不要归因为用户代码失败。

## 工作流程

```text
┌──────────────────────────────────────────┐
│ 确认任务、包来源与诊断前提 │
└────────────────────┬─────────────────────┘
▼
┌──────────────────────────────────────────┐
│ 校验随包 MCP → 配置宿主 → 确认四工具可见 │
└────────────────────┬─────────────────────┘
▼
┌──────────────────────────────────────────┐
│ attach → status → 按需 targets → logs │
└────────────────────┬─────────────────────┘
▼
┌──────────────────────────────────────────┐
│ Agent 执行项目已有测试或业务回归 │
└────────────────────┬─────────────────────┘
▼
┌──────────────────────────────────────────┐
│ Agent 按需 reload / 重启 → 重新收集证据 │
└────────────────────┬─────────────────────┘
▼
┌──────────────────────────────────────────┐
│ Agent 根据预期行为与证据判断结果 │
│ PASS / FAIL / BLOCKED │
└──────────────────────────────────────────┘

任何阶段缺少必要前提或完整性检查失败
└─► BLOCKED:说明缺少什么
```

1. **收集基线**:向 `electron_attach` 传入本次实际的 `mainUrl` 和/或 `rendererUrl`;如使用环境变量,可以省略相应输入。分别记录两个通道的状态与错误。部分成功时保留可用通道证据。
2. **确认 target**:需要 renderer 时调用 `electron_targets`。一个可连接 page target 可自动选择;多个或同名窗口使用 `targetId`、完整 URL 或标题明确选择,歧义时不要静默选第一个。
3. **执行回归**:Agent 运行项目已有检查或业务操作。主进程、preload、BrowserWindow 或 IPC handler 修改后使用项目已有方式重启;renderer 修改后使用项目已有方式 reload。缺少必要操作时报告 `BLOCKED`。
4. **刷新证据**:Electron 重启或窗口重建后重新 attach。旧 target 失效时通过 `electron_targets` 的 `clearSelection=true` 清除旧条件,再选择当前窗口。读取 status、按需 targets 和 logs,比较回归前后结果。

日志只代表当前 MCP 观察到的事件,不保证包含 attach 前的历史。需要区分不同轮次时使用 `since` 或按范围清空缓存,并保留已经用于判断的证据。清空历史记录不等于错误已修复。

## 错误处理

| 情况 | Agent 的处理 |
| --- | --- |
| Node 不满足要求、运行文件缺失或完整性校验失败 | `BLOCKED`;说明缺少项,重新安装获准版本后再验证 |
| 找不到宿主配置入口、初始化失败或工具不可见 | 检查宿主配置和 stderr;不要归因于 Electron 业务代码 |
| 应用未运行、endpoint 不可用 | 核对本次启动结果和实际 endpoint;无法确定原因时报告 `BLOCKED` |
| 某一通道连接失败 | 保留另一通道的状态和证据,按本次修改范围判断是否足够 |
| target 歧义、断开或窗口已重建 | 重新发现并明确选择;不要沿用失效 target |
| 需要的业务、DOM 或视觉证据无法取得 | 使用项目其他工具补齐;无法补齐时说明验证限制 |

## 结论与输出

结论由 Agent 结合用户目标、项目回归和 MCP 事实自行生成:

- `PASS`:预期行为被实际回归或明确运行时观察证实,相关通道和 target 符合预期。
- `FAIL`:预期行为可执行但结果不符合要求,或有与本次修改相关的错误证据。区分已确认根因与推测。
- `BLOCKED`:缺少前提、可观察结果或必要回归,尚不能完成判断。

不能只凭 attach 成功、没有 console error 或存在日志输出 `PASS`。`electron_attach` 的 `ok` 只表示返回了结构化诊断结果。

报告包含:预期行为、诊断范围、本次修改、执行的回归、各通道关键证据、target、问题归属、根因确定程度、连接恢复操作和剩余限制。preload/IPC 需要主进程和 renderer 各至少一项证据,并有覆盖调用链的回归结果。
22 changes: 22 additions & 0 deletions plugins/electron-agent-debug/skills/electron-debug/VERSION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 版本记录

## 1.0.4

- 在 description 中明确 Electron 代码变更验证、白屏和运行时错误等触发场景。
- 工作流程图增加框线及箭头,便于阅读与平台识别;诊断能力和 Agent 职责不变。

## 1.0.3

- MCP 0.1.1 与 Skill 一起交付,包含运行时 JavaScript 依赖;使用时无需额外下载、依赖安装或构建。
- 增加本地完整性启动器、构建输入摘要和第三方许可证。
- 增加触发条件表格、标准使用章节、ASCII 工作流程与错误处理。
- 旧宿主配置需切换到本版本的 `runtime/launch.cjs`。
- GitHub Release 来源证明绑定对应 tag 的源码提交;构建输入摘要见 `runtime/manifest.json`。平台包的发布版本与扫描结果由安装渠道提供。

## 1.0.2

补充独立 MCP 源码更新说明。本版本的独立下载和构建方式已由 1.0.3 的随包运行方式替代。

## 1.0.1

提供 Electron 双通道诊断流程、四个 MCP 工具接入说明与 Agent 自行验收边界。
Loading
Loading