Skip to content

Commit d1e2763

Browse files
authored
feat: 扩展后端 MCP 应用运行能力 + 加封装服务 + 外部agent测试结果 (#2460)
1 parent 24b1502 commit d1e2763

21 files changed

Lines changed: 2048 additions & 215 deletions

File tree

.github/workflows/test-check.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
.\.venv\Scripts\Activate.ps1
3232
uv sync --group dev
3333
34-
- name: Checkout test repo
34+
- name: Checkout test repo (fork, same branch)
3535
id: checkout-test-repo
3636
uses: actions/checkout@v5
3737
with:
@@ -41,10 +41,21 @@ jobs:
4141
fetch-depth: 1
4242
continue-on-error: true
4343

44-
- name: Checkout test repo (default branch)
45-
id: checkout-test-repo-default
44+
- name: Checkout test repo (upstream, same branch)
45+
id: checkout-test-repo-upstream
4646
if: steps.checkout-test-repo.outcome == 'failure'
4747
uses: actions/checkout@v5
48+
with:
49+
repository: OneDragon-Anything/zzz-od-test
50+
path: zzz-od-test
51+
ref: ${{ github.head_ref || 'main' }}
52+
fetch-depth: 1
53+
continue-on-error: true
54+
55+
- name: Checkout test repo (upstream, main)
56+
id: checkout-test-repo-default
57+
if: steps.checkout-test-repo-upstream.outcome == 'failure'
58+
uses: actions/checkout@v5
4859
with:
4960
repository: OneDragon-Anything/zzz-od-test
5061
path: zzz-od-test

deploy/module_manifest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import os.path
3636
import platform
3737
import polib
38+
import psutil
3839
import pyautogui
3940
import pyclipper
4041
import pyuac
@@ -53,6 +54,7 @@
5354
import threading
5455
import time
5556
import traceback
57+
import urllib.error
5658
import urllib.parse
5759
import urllib.request
5860
import uuid
@@ -70,7 +72,7 @@
7072
from PIL import Image, ImageDraw, ImageFont
7173
from PySide6 import QtCore
7274
from PySide6.QtCore import QEasingCurve, QEvent, QEventLoop, QMimeData, QObject, QPoint, QPointF, QPropertyAnimation, QRect, QRectF, QRegularExpression, QSize, QThread, QTimer, QUrl, Qt, Signal
73-
from PySide6.QtGui import QBrush, QCloseEvent, QColor, QDesktopServices, QDrag, QDragEnterEvent, QDragLeaveEvent, QDragMoveEvent, QDropEvent, QFont, QFontMetrics, QGuiApplication, QIcon, QImage, QIntValidator, QKeyEvent, QLinearGradient, QMouseEvent, QPaintEvent, QPainter, QPainterPath, QPen, QPixmap, QResizeEvent, QShowEvent, QSyntaxHighlighter, QTextCharFormat, QValidator, QWheelEvent, Qt
75+
from PySide6.QtGui import QBrush, QCloseEvent, QColor, QDesktopServices, QDrag, QDragEnterEvent, QDragLeaveEvent, QDragMoveEvent, QDropEvent, QFont, QFontMetrics, QGuiApplication, QIcon, QImage, QIntValidator, QKeyEvent, QKeySequence, QLinearGradient, QMouseEvent, QPaintEvent, QPainter, QPainterPath, QPen, QPixmap, QResizeEvent, QShowEvent, QSyntaxHighlighter, QTextCharFormat, QValidator, QWheelEvent, Qt
7476
from PySide6.QtMultimedia import QMediaPlayer
7577
from PySide6.QtMultimediaWidgets import QGraphicsVideoItem
7678
from PySide6.QtWidgets import QAbstractButton, QAbstractItemView, QAbstractScrollArea, QApplication, QComboBox, QCompleter, QDialog, QFileDialog, QFrame, QGraphicsDropShadowEffect, QGraphicsEffect, QGraphicsOpacityEffect, QGraphicsScene, QGraphicsView, QHBoxLayout, QHeaderView, QInputDialog, QLabel, QLineEdit, QListView, QListWidget, QListWidgetItem, QMessageBox, QPushButton, QScrollArea, QSizePolicy, QSpacerItem, QSpinBox, QStackedWidget, QStyle, QStyledItemDelegate, QTableWidget, QTableWidgetItem, QTextEdit, QToolButton, QVBoxLayout, QWidget

docs/develop/zzz/backend/README.md

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,49 @@
1414
| 收敛层 | `ZzzBackendContext`:持有 ctx、管生命周期、感知 / 操作方法 |
1515
| 适配器 | MCP(`@mcp.tool`)+ HTTP(`/game/*`),并行、共享 backend |
1616

17-
当前已实现:**4 个感知 / 操作方法**(窗口状态 / 截图 / OCR / 进游戏)+ MCP / HTTP 适配器 + 服务入口 + 远程 SSH daemon。其余(run-as-service、事件桥、多实例、GUI 收敛)见各文档的「路线图」。
17+
```mermaid
18+
flowchart LR
19+
GUI["GUI 开发工具<br/>MCP 服务页"] -->|启动/停止/探测| Entry["entry/server.py"]
20+
CLI["uv run ... server"] --> Entry
21+
Entry --> Backend["ZzzBackendContext"]
22+
Backend --> ZContext["ZContext"]
23+
Backend --> RunSlot["RunSlot(单跑道)<br/>app 路径委托 run_application / op 路径自管生命周期"]
24+
Backend --> Schemas["schemas.py"]
25+
Backend --> MCP["mcp/app.py<br/>mcp/service_app.py"]
26+
Backend --> HTTP["http/routes.py<br/>http/service_routes.py"]
27+
MCP --> Client["MCP 客户端"]
28+
HTTP --> Tooling["HTTP 客户端/skill/脚本"]
29+
```
30+
31+
当前已实现:
32+
33+
- 游戏感知与操作:窗口状态、截图、画面分析、进游戏、关闭游戏。
34+
- 应用运行:列出应用、一条龙运行、独立应用运行。
35+
- 自定义 operation 运行:`list_operations` / `describe_operation` / `run_operation`,按 `op_id` 定位运行任意 operation(调试定位 + 未来 agent 自由组合 op)。
36+
- 统一状态:`query_status` / `stop` 覆盖 app 路径与 op 路径两类后台运行(单槽 `RunSlot`)。
37+
- 对外协议:MCP streamable-http、MCP prompts 与 HTTP `/game/*` / `/health`
38+
- GUI 辅助:开发工具中的「MCP 服务」页可探测、启动、停止、重启本机 server,显示当前运行状态、滚动展示 server 日志并复制 MCP 地址。
1839

1940
## 怎么跑
2041

42+
命令行启动:
43+
2144
```shell
2245
uv run --env-file .env python -m zzz_od.backend.entry.server --port 23001
2346
```
2447

25-
启动后同时服务 `http://127.0.0.1:23001/mcp`(MCP)与 `/game/*`(HTTP)。详见 [entry.md](entry.md)
48+
如果项目根目录没有 `.env`,可省略 `--env-file .env`
49+
50+
```shell
51+
uv run python -m zzz_od.backend.entry.server --port 23001
52+
```
53+
54+
GUI 启动:打开「开发工具 -> MCP 服务」,使用同一条入口命令在本机启动 `zzz_od.backend.entry.server` 子进程。
55+
56+
启动后:
57+
58+
- MCP:`http://127.0.0.1:23001/mcp`
59+
- HTTP 探测:`http://127.0.0.1:23001/health`
2660

2761
## 文档索引(总—分)
2862

@@ -39,6 +73,6 @@ uv run --env-file .env python -m zzz_od.backend.entry.server --port 23001
3973
4074
## 相关文档
4175

42-
- [一条龙整体架构](../../one_dragon/one_dragon_architecture.md) Layer 0 运行层
43-
- [AI 编码助手接入](../../setup/ai_coding.md) MCP / skill 接入
44-
- [AI Coding Harness 工程](../../harness/README.md) 方向 B 路线图
76+
- [一条龙整体架构](../../one_dragon/one_dragon_architecture.md) - Layer 0 运行层
77+
- [AI 编码助手接入](../../setup/ai_coding.md) - MCP / skill 接入
78+
- [AI Coding Harness 工程](../../harness/README.md) - 方向 B 路线图

0 commit comments

Comments
 (0)