Rename service launcher to service_manager.pyw
This commit is contained in:
1 parent
48123646bc
commit
9f358ea7f4
6 files changed
+15
-15
No files matched your search
@@ -1472,7 +1472,7 @@ hub = WsHub()
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Service management (hub.pyw core + WS notify)
|
||||
# Service management (service_manager.pyw core + WS notify)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
_SKIP = frozenset({"goal_mode.py", "chatapp_common.py", "tuiapp.py", "qtapp.py"})
|
||||
@@ -1624,7 +1624,7 @@ def _classify_log_error(line: str) -> tuple[str, str] | None:
|
||||
|
||||
|
||||
class ServiceManager:
|
||||
"""hub.pyw ServiceManager + HTTP/WS glue."""
|
||||
"""service_manager.pyw ServiceManager + HTTP/WS glue."""
|
||||
|
||||
def __init__(self, ga_root: str, emit_fn):
|
||||
self.lock = threading.RLock()
|
||||
|
||||
@@ -300,7 +300,7 @@ def list_reflect_tasks() -> list[dict]:
|
||||
return out
|
||||
|
||||
|
||||
# ----- hub.pyw parity: every launchable service ---------------------------
|
||||
# ----- service_manager.pyw parity: every launchable service ---------------------------
|
||||
|
||||
_HUB_EXCLUDES = {"goal_mode.py", "chatapp_common.py", "tuiapp.py"}
|
||||
|
||||
@@ -324,10 +324,10 @@ def _sniff_doc(p) -> str:
|
||||
|
||||
|
||||
def list_launchable_services() -> list[dict]:
|
||||
"""Mirror hub.pyw's discover_services() so `/scheduler` shows the *same*
|
||||
"""Mirror service_manager.pyw's discover_services() so `/scheduler` shows the *same*
|
||||
set of launchable services as the GUI launcher.
|
||||
|
||||
Sources (hub.pyw EXCLUDES = goal_mode.py / chatapp_common.py / tuiapp.py):
|
||||
Sources (service_manager.pyw EXCLUDES = goal_mode.py / chatapp_common.py / tuiapp.py):
|
||||
• reflect/*.py (not '_'-prefixed, not excluded)
|
||||
→ cmd = [python, agentmain.py, --reflect, reflect/<f>]
|
||||
• frontends/*app*.py (not excluded)
|
||||
@@ -412,7 +412,7 @@ def start_service(name: str) -> tuple[bool, str]:
|
||||
|
||||
# ----- running-state introspection (bug#4) --------------------------------
|
||||
# Why psutil cmdline-scan instead of a launched-by-us pid registry?
|
||||
# • Services launched by a previous TUI run, or by hub.pyw, must also be
|
||||
# • Services launched by a previous TUI run, or by service_manager.pyw, must also be
|
||||
# recognised — otherwise /scheduler would happily start a duplicate.
|
||||
# • A registry tied to this process dies when the TUI restarts, but the
|
||||
# services keep running (CREATE_NEW_PROCESS_GROUP). Cmdline scan is the
|
||||
|
||||
+1
-1
@@ -4714,7 +4714,7 @@ class SB:
|
||||
lines.append(('✅ ' if ok else '❌ ') + msg)
|
||||
self.commit(lines)
|
||||
else:
|
||||
# Mirror hub.pyw discover_services(): reflect tasks + frontend
|
||||
# Mirror service_manager.pyw discover_services(): reflect tasks + frontend
|
||||
# apps, so the picker shows the same set as the GUI launcher.
|
||||
services = slash_cmds.list_launchable_services()
|
||||
if not services:
|
||||
|
||||
@@ -6362,7 +6362,7 @@ class GenericAgentTUI(App[None]):
|
||||
running = slash_cmds.running_services() # {name: pid}
|
||||
except Exception:
|
||||
running = {}
|
||||
# Mirror hub.pyw: reflect tasks + frontend apps, grouped by kind so the
|
||||
# Mirror service_manager.pyw: reflect tasks + frontend apps, grouped by kind so the
|
||||
# picker reads like the GUI launcher. Picker value = hub-style path.
|
||||
choices = []
|
||||
preselected = [] # indices into `choices` that are running right now
|
||||
@@ -6384,7 +6384,7 @@ class GenericAgentTUI(App[None]):
|
||||
else:
|
||||
choices.append((label, s["name"]))
|
||||
sess = self.current
|
||||
hint = ("选择要启动的服务(与 hub.pyw 一致:reflect 任务 + frontend 应用)"
|
||||
hint = ("选择要启动的服务(与 service_manager.pyw 一致:reflect 任务 + frontend 应用)"
|
||||
" Space 勾选 · Enter 提交 · Esc 取消 — 提交后还需二次确认")
|
||||
if running:
|
||||
hint += f"\n 绿色 = 正在运行(已勾选);取消勾选即停止该服务(共 {len(running)} 个在运行)"
|
||||
|
||||
+3
-3
@@ -56,9 +56,9 @@ COMMANDS = {
|
||||
"cmd": ["python", "{PROJECT_DIR}/assets/configure_mykey.py"],
|
||||
},
|
||||
"hub": {
|
||||
"help": "启动 Hub 管理器 (launcher)",
|
||||
"desc": "启动 hub 前端管理面板(系统托盘 + 浏览器界面)",
|
||||
"cmd": ["python", "{PROJECT_DIR}/hub.pyw"],
|
||||
"help": "启动本机服务管理器 (service_manager)",
|
||||
"desc": "启动本机服务管理窗口(Tkinter)",
|
||||
"cmd": ["python", "{PROJECT_DIR}/service_manager.pyw"],
|
||||
},
|
||||
"tui": {
|
||||
"help": "启动终端 TUI (tuiapp)",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# launcher.pyw - GenericAgent 服务启动器
|
||||
# service_manager.pyw - GenericAgent 服务启动器
|
||||
# 纯 tkinter + 标准库,零第三方依赖,跨平台
|
||||
import os, sys, socket, subprocess, threading
|
||||
import tkinter as tk
|
||||
@@ -87,7 +87,7 @@ class ServiceManager:
|
||||
class LauncherApp:
|
||||
def __init__(self, root):
|
||||
self.root = root
|
||||
self.root.title('GenericAgent Launcher')
|
||||
self.root.title('GenericAgent Service Manager')
|
||||
self.root.geometry('720x740')
|
||||
self.root.protocol('WM_DELETE_WINDOW', self.on_close)
|
||||
|
||||
@@ -264,7 +264,7 @@ if __name__ == '__main__':
|
||||
import tkinter.messagebox as mb
|
||||
r = tk.Tk()
|
||||
r.withdraw()
|
||||
mb.showinfo('Launcher', 'Already running.')
|
||||
mb.showinfo('Service Manager', 'Already running.')
|
||||
r.destroy()
|
||||
except Exception:
|
||||
pass
|
||||
Reference in new issue
Block a user