用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/s1366560/agi-demos --skill vnc-browser-launcher命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Sandbox MCP Server 是一个隔离的代码执行环境,提供完整的文件系统操作、命令执行、 代码分析、测试运行和远程桌面能力。当你需要执行代码、操作文件、运行测试、 分析代码结构、或需要图形界面操作时使用此技能。支持 Python、Node.js、Java 等多语言环境。
Evidence-led triage and scoped recovery for local MemStack development runtime incidents. Use when FastAPI, React/Vite Web, Ray, the agent actor, Docker infrastructure, Redis, Postgres, Neo4j, the sandbox, or the Electron desktop sidecar fails to start, crashes, consumes abnormal resources, or becomes unresponsive.
Deliver and verify MemStack native desktop changes in agi-demos against the design-prototype or Web product surface while preserving the Electron shell, Rust sidecar, IPC, encrypted-vault, signing, and updater boundaries. Use for implementation, parity repair, or QA work scoped to agi-stack/apps/desktop; do not use for generic Web QA, mobile work, or unrelated desktop applications.
正在显示 SKILL.md
基于 SOC 职业分类
| name | vnc-browser-launcher |
| description | 在沙箱 VNC 远程桌面上启动可见的浏览器窗口 |
| triggers | ["在 VNC 上打开浏览器","看到浏览器 UI","Playwright 有头模式显示"] |
在沙箱远程桌面 (VNC/KasmVNC) 上启动可见的浏览器窗口。
xvfb-run 创建独立的虚拟 X 服务器 (:99 或动态分配)VNC 服务器使用 /root/.Xauthority 进行授权,但:
xauth 命令会连不上 X 服务器XAUTHORITY=/root/.Xauthority 环境变量访问/usr/local/bin/firefox 是 Playwright 的包装脚本headless=False 显示在真实 X 服务器上⚠️ 【关键】环境变量必须在 import Playwright 之前设置!
import os
# ⚠️ 关键:在 import 之前设置环境变量!
os.environ['DISPLAY'] = ':1'
os.environ['XAUTHORITY'] = '/root/.Xauthority'
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch(
headless=False, # 有头模式!
args=['--no-sandbox', '--disable-dev-shm-usage', '--disable-gpu']
)
page = browser.new_page()
page.goto("https://www.google.com")
page.wait_for_timeout(5000) # 等待页面加载
browser.close()
如果需要浏览器持续显示在 VNC 桌面上:
import os
import time
import signal
# ⚠️ 环境变量必须在 import 之前设置!
os.environ['DISPLAY'] = ':1'
os.environ['XAUTHORITY'] = '/root/.Xauthority'
from playwright.sync_api import sync_playwright
def cleanup():
try:
browser.close()
except:
pass
signal.signal(signal.SIGINT, lambda s,f: cleanup())
signal.signal(signal.SIGTERM, lambda s,f: cleanup())
with sync_playwright() as p:
browser = p.chromium.launch(
headless=False,
args=['--no-sandbox', '--disable-dev-shm-usage', '--disable-gpu']
)
page = browser.new_page()
page.goto("https://www.google.com", timeout=30000)
print("✅ 浏览器已在 VNC 桌面上运行!")
print("用户可在 http://localhost:6080 查看")
time.sleep(3600) # 保持运行 1 小时
# 1. 设置正确的环境变量
export DISPLAY=:1
export XAUTHORITY=/root/.Xauthority
# 2. 验证 X 连接
$DISPLAY xdpyinfo
# 3. 启动浏览器
chromium-browser --new-window https://www.google.com &
如果浏览器启动后立即退出:
export DISPLAY=:1
export XAUTHORITY=/root/.Xauthority
# 后台启动,不等待
nohup chromium-browser --new-window https://www.google.com > /tmp/browser.log 2>&1 &
# 验证进程
ps aux | grep chromium
| 项目 | 值 |
|---|---|
| VNC 端口 | 5900 |
| Web 访问 | http://localhost:6080 |
| 显示编号 | :1 |
| X Authority | /root/.Xauthority |
| 窗口管理器 | Openbox |
| 桌面环境 | KDE Plasma (plasmashell) |
| 浏览器 | 路径 | 可用性 |
|---|---|---|
| Chromium | /usr/bin/chromium-browser | ✅ 推荐 |
| Chrome | /usr/bin/google-chrome | ✅ |
| Firefox | /usr/local/bin/firefox | ❌ Playwright 包装,不可用 |
# 检查 VNC 状态
vncserver -list
# 检查 X 显示
w
# 输出示例:
# 15:40:13 2:01 0.00s 0.00s -bash
# 15:40:15 0:18 0.07s 0.07s xterm
# 15:40:27 1:01 0.00s 0.00s chromium-browser
# 检查 X 服务器
DISPLAY=:1 XAUTHORITY=/root/.Xauthority xdpyinfo
# 检查进程和显示对应关系
ps aux | grep -E 'chromium|firefox|Xvnc'
# 从 X 服务器截图(验证窗口是否存在)
DISPLAY=:1 XAUTHORITY=/root/.Xauthority scrot /tmp/screenshot.png
A: 可能是窗口在屏幕外。尝试:
DISPLAY=:1 wmctrl -l # 列出所有窗口
DISPLAY=:1 wmctrl -r "Chromium" -e 0,0,0,1280,800 # 移动到可见位置
A: 总是使用完整的命令前缀:
DISPLAY=:1 XAUTHORITY=/root/.Xauthority <command>
A: 可能需要重启 VNC 服务:
# 停止
vncserver -kill :1
# 启动
vncserver :1 -geometry 1920x1080 -depth 24
w 命令显示的进程不一定在正确的 DISPLAY 上