myagent-ai 1.47.11 → 1.47.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/vnc_manager.py +46 -0
- package/main.py +19 -1
- package/package.json +1 -1
- package/start.js +5 -1
- package/tray_manager.py +20 -2
- package/web/api_server.py +15 -4
package/core/vnc_manager.py
CHANGED
|
@@ -877,6 +877,12 @@ class VNCManager:
|
|
|
877
877
|
logger.warning(f"后台升级 icewm 异常: {e}")
|
|
878
878
|
|
|
879
879
|
# 3. 启动 D-Bus 会话(Epiphany 等 GNOME 程序需要)
|
|
880
|
+
# [v1.47.12] 在启动 D-Bus 之前先修复 dbus-daemon-launch-helper
|
|
881
|
+
# 否则 D-Bus 激活服务时仍会触发 --shm-helper 错误
|
|
882
|
+
try:
|
|
883
|
+
self._fix_dbus_launch_helper()
|
|
884
|
+
except Exception:
|
|
885
|
+
pass
|
|
880
886
|
self._ensure_dbus_session()
|
|
881
887
|
|
|
882
888
|
# 3.5 如果 icewm 刚安装好,重新配置主题
|
|
@@ -1501,9 +1507,13 @@ class VNCManager:
|
|
|
1501
1507
|
解决方法:创建包装脚本,去掉 --shm-helper 参数。
|
|
1502
1508
|
"""
|
|
1503
1509
|
# 查找原始的 dbus-daemon-launch-helper
|
|
1510
|
+
# [v1.47.12] 扩展搜索路径,覆盖 ARM64 Ubuntu (aarch64-linux-gnu)
|
|
1504
1511
|
helper_paths = [
|
|
1505
1512
|
"/usr/lib/dbus-1.0/dbus-daemon-launch-helper",
|
|
1506
1513
|
"/usr/libexec/dbus-daemon-launch-helper",
|
|
1514
|
+
"/usr/lib/aarch64-linux-gnu/dbus-1.0/dbus-daemon-launch-helper",
|
|
1515
|
+
"/usr/lib/arm-linux-gnueabihf/dbus-1.0/dbus-daemon-launch-helper",
|
|
1516
|
+
"/usr/lib/x86_64-linux-gnu/dbus-1.0/dbus-daemon-launch-helper",
|
|
1507
1517
|
]
|
|
1508
1518
|
original_helper = None
|
|
1509
1519
|
for hp in helper_paths:
|
|
@@ -1519,6 +1529,29 @@ class VNCManager:
|
|
|
1519
1529
|
original_helper = hp
|
|
1520
1530
|
break
|
|
1521
1531
|
|
|
1532
|
+
# [v1.47.12] 兜底: 用 find 搜索所有 dbus-daemon-launch-helper
|
|
1533
|
+
if not original_helper:
|
|
1534
|
+
try:
|
|
1535
|
+
result = subprocess.run(
|
|
1536
|
+
["find", "/usr/lib", "-name", "dbus-daemon-launch-helper", "-type", "f"],
|
|
1537
|
+
capture_output=True, text=True, timeout=5,
|
|
1538
|
+
)
|
|
1539
|
+
if result.returncode == 0:
|
|
1540
|
+
for line in result.stdout.strip().split("\n"):
|
|
1541
|
+
path = line.strip()
|
|
1542
|
+
if path and os.path.isfile(path) and not os.path.islink(path):
|
|
1543
|
+
try:
|
|
1544
|
+
with open(path, "r", errors="replace") as f:
|
|
1545
|
+
head = f.read(100)
|
|
1546
|
+
if "MYAGENT_WRAPPER" in head:
|
|
1547
|
+
continue
|
|
1548
|
+
except Exception:
|
|
1549
|
+
pass
|
|
1550
|
+
original_helper = path
|
|
1551
|
+
break
|
|
1552
|
+
except Exception:
|
|
1553
|
+
pass
|
|
1554
|
+
|
|
1522
1555
|
if not original_helper:
|
|
1523
1556
|
logger.debug("dbus-daemon-launch-helper 未找到或已是包装脚本,跳过修复")
|
|
1524
1557
|
return
|
|
@@ -1782,6 +1815,9 @@ exec {backup_path} "${{args[@]}}"
|
|
|
1782
1815
|
env["DBUS_SESSION_BUS_ADDRESS"] = os.environ["DBUS_SESSION_BUS_ADDRESS"]
|
|
1783
1816
|
if not env.get("GSETTINGS_BACKEND"):
|
|
1784
1817
|
env["GSETTINGS_BACKEND"] = "memory"
|
|
1818
|
+
# [v1.47.12] proot 兼容: 避免浏览器启动时 dbus --shm-helper 错误
|
|
1819
|
+
if not env.get("G_SLICE"):
|
|
1820
|
+
env["G_SLICE"] = "always-malloc"
|
|
1785
1821
|
xdg_runtime = env.get("XDG_RUNTIME_DIR") or f"/run/user/{os.getuid()}"
|
|
1786
1822
|
env["XDG_RUNTIME_DIR"] = xdg_runtime
|
|
1787
1823
|
try:
|
|
@@ -4778,6 +4814,13 @@ chmod 700 "$XDG_RUNTIME_DIR" 2>/dev/null
|
|
|
4778
4814
|
export MOZ_DISABLE_CONTENT_SANDBOX=1
|
|
4779
4815
|
export MOZ_DISABLE_GPU_SANDBOX=1
|
|
4780
4816
|
|
|
4817
|
+
# [v1.47.12] proot 兼容环境变量 — 避免 dbus --shm-helper 错误
|
|
4818
|
+
# G_SLICE=always-malloc — 禁用 glib2 共享内存分配器
|
|
4819
|
+
# 避免 "error: expected absolute path: --shm-helper" 错误
|
|
4820
|
+
export G_SLICE=always-malloc
|
|
4821
|
+
# GSettings 内存后端 — 不依赖 dconf/gsettings 守护进程
|
|
4822
|
+
export GSETTINGS_BACKEND=memory
|
|
4823
|
+
|
|
4781
4824
|
# [v1.46.8] PulseAudio 音频 — 确保Firefox输出音频到PulseAudio
|
|
4782
4825
|
export PULSE_SERVER=unix:${{XDG_RUNTIME_DIR}}/pulse/native
|
|
4783
4826
|
if [ -z "$PULSE_SERVER" ]; then
|
|
@@ -4830,6 +4873,9 @@ chmod 700 "$XDG_RUNTIME_DIR" 2>/dev/null
|
|
|
4830
4873
|
# GSettings 内存后端
|
|
4831
4874
|
export GSETTINGS_BACKEND=memory
|
|
4832
4875
|
|
|
4876
|
+
# [v1.47.12] proot 兼容环境变量 — 避免 dbus --shm-helper 错误
|
|
4877
|
+
export G_SLICE=always-malloc
|
|
4878
|
+
|
|
4833
4879
|
# 启动 D-Bus 会话(如果还没有)
|
|
4834
4880
|
# [v1.43.3] proot 下跳过 dbus-launch,直接用 dbus-daemon
|
|
4835
4881
|
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
|
package/main.py
CHANGED
|
@@ -83,11 +83,23 @@ def _open_browser_kiosk(url: str):
|
|
|
83
83
|
"""打开浏览器窗口,使用系统已安装的 Chrome 或默认浏览器。
|
|
84
84
|
|
|
85
85
|
[v1.34.0] 优先使用系统已安装的 Chrome/Edge,而非 DrissionPage 控制的浏览器。
|
|
86
|
+
[v1.47.12] Termux 环境: 优先使用 termux-open-url(调用 Android 系统浏览器)。
|
|
86
87
|
"""
|
|
87
88
|
import shutil
|
|
88
89
|
import subprocess
|
|
89
90
|
import platform
|
|
90
91
|
|
|
92
|
+
# [v1.47.12] Termux 环境: 优先使用 termux-open-url 打开 Android 系统浏览器
|
|
93
|
+
# 在 Termux proot 环境下,xdg-open 无法工作(Permission denied),
|
|
94
|
+
# 但 termux-open-url 可以跨 proot 边界调用 Android 系统浏览器
|
|
95
|
+
termux_open = shutil.which("termux-open-url")
|
|
96
|
+
if termux_open:
|
|
97
|
+
try:
|
|
98
|
+
subprocess.Popen([termux_open, url], start_new_session=True)
|
|
99
|
+
return
|
|
100
|
+
except Exception:
|
|
101
|
+
pass
|
|
102
|
+
|
|
91
103
|
chrome_path = None
|
|
92
104
|
system = platform.system()
|
|
93
105
|
|
|
@@ -1056,6 +1068,7 @@ def create_tray_icon(app: MyAgentApp, web_port: int = 8767):
|
|
|
1056
1068
|
app.logger.warning(f"无法打开不存在的路径: {path}")
|
|
1057
1069
|
return
|
|
1058
1070
|
import subprocess
|
|
1071
|
+
import shutil
|
|
1059
1072
|
import platform as pf
|
|
1060
1073
|
system = pf.system()
|
|
1061
1074
|
try:
|
|
@@ -1064,7 +1077,12 @@ def create_tray_icon(app: MyAgentApp, web_port: int = 8767):
|
|
|
1064
1077
|
elif system == "Darwin":
|
|
1065
1078
|
subprocess.Popen(["open", path])
|
|
1066
1079
|
else:
|
|
1067
|
-
|
|
1080
|
+
# [v1.47.12] Termux 环境: 优先使用 termux-open-url
|
|
1081
|
+
termux_open = shutil.which("termux-open-url")
|
|
1082
|
+
if termux_open:
|
|
1083
|
+
subprocess.Popen([termux_open, path], start_new_session=True)
|
|
1084
|
+
else:
|
|
1085
|
+
subprocess.Popen(["xdg-open", path])
|
|
1068
1086
|
except Exception as e:
|
|
1069
1087
|
app.logger.warning(f"无法打开路径 {path}: {e}")
|
|
1070
1088
|
|
package/package.json
CHANGED
package/start.js
CHANGED
|
@@ -754,7 +754,11 @@ function cmdRun(pkgDir, userArgs) {
|
|
|
754
754
|
try {
|
|
755
755
|
if (IS_WIN) execSync(`start "" "${url}"`);
|
|
756
756
|
else if (process.platform === "darwin") execSync(`open "${url}"`);
|
|
757
|
-
else
|
|
757
|
+
else {
|
|
758
|
+
// [v1.47.12] Termux 环境: 优先使用 termux-open-url(Android 系统浏览器)
|
|
759
|
+
try { execSync(`termux-open-url "${url}"`); }
|
|
760
|
+
catch (_) { execSync(`xdg-open "${url}"`); }
|
|
761
|
+
}
|
|
758
762
|
} catch (_) {}
|
|
759
763
|
}
|
|
760
764
|
});
|
package/tray_manager.py
CHANGED
|
@@ -347,19 +347,37 @@ def restart_server() -> bool:
|
|
|
347
347
|
|
|
348
348
|
def open_dashboard():
|
|
349
349
|
"""Open chat dashboard in default browser"""
|
|
350
|
-
import
|
|
350
|
+
import shutil, subprocess
|
|
351
351
|
port = _read_port_from_env()
|
|
352
352
|
url = f"http://localhost:{port}"
|
|
353
353
|
log(f"Opening dashboard: {url}")
|
|
354
|
+
# [v1.47.12] Termux 环境: 优先使用 termux-open-url
|
|
355
|
+
termux_open = shutil.which("termux-open-url")
|
|
356
|
+
if termux_open:
|
|
357
|
+
try:
|
|
358
|
+
subprocess.Popen([termux_open, url], start_new_session=True)
|
|
359
|
+
return
|
|
360
|
+
except Exception:
|
|
361
|
+
pass
|
|
362
|
+
import webbrowser
|
|
354
363
|
webbrowser.open(url)
|
|
355
364
|
|
|
356
365
|
|
|
357
366
|
def open_admin():
|
|
358
367
|
"""Open admin dashboard in default browser"""
|
|
359
|
-
import
|
|
368
|
+
import shutil, subprocess
|
|
360
369
|
port = _read_port_from_env()
|
|
361
370
|
url = f"http://localhost:{port}/admin"
|
|
362
371
|
log(f"Opening admin panel: {url}")
|
|
372
|
+
# [v1.47.12] Termux 环境: 优先使用 termux-open-url
|
|
373
|
+
termux_open = shutil.which("termux-open-url")
|
|
374
|
+
if termux_open:
|
|
375
|
+
try:
|
|
376
|
+
subprocess.Popen([termux_open, url], start_new_session=True)
|
|
377
|
+
return
|
|
378
|
+
except Exception:
|
|
379
|
+
pass
|
|
380
|
+
import webbrowser
|
|
363
381
|
webbrowser.open(url)
|
|
364
382
|
|
|
365
383
|
|
package/web/api_server.py
CHANGED
|
@@ -6424,10 +6424,21 @@ window.addEventListener('beforeunload', function() {{
|
|
|
6424
6424
|
"message": message,
|
|
6425
6425
|
})
|
|
6426
6426
|
else:
|
|
6427
|
-
# 找不到 Chrome
|
|
6428
|
-
import
|
|
6429
|
-
|
|
6430
|
-
|
|
6427
|
+
# 找不到 Chrome,降级使用系统浏览器
|
|
6428
|
+
import shutil, subprocess as _sp
|
|
6429
|
+
_opened = False
|
|
6430
|
+
# [v1.47.12] Termux 环境: 优先使用 termux-open-url
|
|
6431
|
+
termux_open = shutil.which("termux-open-url")
|
|
6432
|
+
if termux_open and login_url:
|
|
6433
|
+
try:
|
|
6434
|
+
_sp.Popen([termux_open, login_url], start_new_session=True)
|
|
6435
|
+
_opened = True
|
|
6436
|
+
except Exception:
|
|
6437
|
+
pass
|
|
6438
|
+
if not _opened:
|
|
6439
|
+
import webbrowser
|
|
6440
|
+
if login_url:
|
|
6441
|
+
webbrowser.open(login_url)
|
|
6431
6442
|
logger.info(f"桌面环境: 未找到 Chrome,使用系统默认浏览器打开 {login_url}")
|
|
6432
6443
|
|
|
6433
6444
|
display_name = site.get('display_name', name)
|