@mcviseron/dsh-qq-bridge 0.3.10 → 0.3.11
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/bot/main.py +16 -3
- package/package.json +1 -1
package/bot/main.py
CHANGED
|
@@ -32,6 +32,9 @@ from viseron_qqbotpy import configure_logging, load_env, get_logger, load_panels
|
|
|
32
32
|
from bridge import BridgeClient, BridgeError, download_image
|
|
33
33
|
|
|
34
34
|
ROOT = Path(__file__).resolve().parent
|
|
35
|
+
# 机器人本身是无窗运行的;它再拉 tasklist / taskkill 时如果没带这个标志,Windows 会
|
|
36
|
+
# 给它分配一个新控制台(Win11 上就是弹出的 Windows Terminal 窗口),所以统一带上。
|
|
37
|
+
_NO_WINDOW = getattr(subprocess, "CREATE_NO_WINDOW", 0x08000000) if os.name == "nt" else 0
|
|
35
38
|
SG_GROUP_BASE_URL = "https://api.sgroup.qq.com"
|
|
36
39
|
STATE_FILE = ROOT / "state.json"
|
|
37
40
|
CURSOR_FILE = ROOT / "state" / "cursor.txt"
|
|
@@ -4015,7 +4018,12 @@ def _alive(pid: int) -> bool:
|
|
|
4015
4018
|
"""Whether the process still exists (Windows: tasklist, else signal 0)."""
|
|
4016
4019
|
try:
|
|
4017
4020
|
if os.name == "nt":
|
|
4018
|
-
result = subprocess.run(
|
|
4021
|
+
result = subprocess.run(
|
|
4022
|
+
["tasklist", "/FI", f"PID eq {pid}"],
|
|
4023
|
+
capture_output=True,
|
|
4024
|
+
text=True,
|
|
4025
|
+
creationflags=_NO_WINDOW,
|
|
4026
|
+
)
|
|
4019
4027
|
return str(pid) in (result.stdout or "")
|
|
4020
4028
|
os.kill(pid, 0)
|
|
4021
4029
|
return True
|
|
@@ -4029,7 +4037,12 @@ def _kill_tree(pid: int) -> None:
|
|
|
4029
4037
|
return
|
|
4030
4038
|
try:
|
|
4031
4039
|
if os.name == "nt":
|
|
4032
|
-
subprocess.run(
|
|
4040
|
+
subprocess.run(
|
|
4041
|
+
["taskkill", "/PID", str(pid), "/T", "/F"],
|
|
4042
|
+
capture_output=True,
|
|
4043
|
+
check=False,
|
|
4044
|
+
creationflags=_NO_WINDOW,
|
|
4045
|
+
)
|
|
4033
4046
|
else:
|
|
4034
4047
|
os.kill(pid, signal.SIGKILL)
|
|
4035
4048
|
except OSError as error:
|
|
@@ -4188,7 +4201,7 @@ def supervise() -> int:
|
|
|
4188
4201
|
state: Dict[str, Any] = {"child": None, "started_at": 0.0, "attempt": 0, "next_at": 0.0, "note": "starting", "log": []}
|
|
4189
4202
|
lock = threading.Lock()
|
|
4190
4203
|
log_path = STATE_DIR / "bot-output.log"
|
|
4191
|
-
no_window =
|
|
4204
|
+
no_window = _NO_WINDOW
|
|
4192
4205
|
|
|
4193
4206
|
def pump(stream: Any) -> None:
|
|
4194
4207
|
"""Mirror the child's console output into a ring buffer and a file."""
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcviseron/dsh-qq-bridge",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"description": "DeepSeek Harness plugin: bridge QQ conversations (driven by an external viseron-botpy bot) to DSH sessions — injects user messages, captures assistant replies, streams C2C answers, and relays tool approvals to the bot owner.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|