Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,9 @@ frontends/conductor_im_plugins/*

# Beta 渠道:订阅门户插件(仅 beta 分发携带,不入库)
plugins/subscription_portal.py

# GAnet 由设备互联 SOP 从官方发布服务安装,不进入主仓。
/plugins/ganet/

# Tracked device-interconnect SOP.
!memory/ganet_pc_setup_sop.md
1 change: 1 addition & 0 deletions assets/global_mem_insight_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ L4: L4_raw_sessions/ 历史会话
UI操作/截图/视觉: computer_use.md | vision_sop | 窗口截图必用ljqCtrl
定时:scheduled_task_sop | 自主:autonomous_operation_sop | watchdog/反射:agentmain --reflect
手机:adb_ui.py
手机直连电脑/组网/让手机 GA 连接这台电脑: ganet_pc_setup_sop

[RULES]
1. 搜索先行: 搜文件名禁长时间递归, 网络搜索一定优先使用web工具的google, 优先看cwd,禁猜路径
Expand Down
1 change: 1 addition & 0 deletions assets/global_mem_insight_template_en.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Keyboard/Mouse: ljqCtrl_sop(no pyautogui/activate first)
UI/Screenshot/Vision: computer_use.md | vision_sop | window screenshot use ljqCtrl
Scheduling: scheduled_task_sop | Autonomous: autonomous_operation_sop | watchdog/reflect: agentmain --reflect
Mobile: adb_ui.py
Connect a phone to this computer / configure GAnet: ganet_pc_setup_sop

[RULES]
1. Search first: no huge PS recursion/no dir traversal for file search, prefer Google for web search, check cwd first, no guessing paths
Expand Down
11 changes: 11 additions & 0 deletions frontends/desktop_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,17 @@ def submit_prompt(self, sid: str, prompt: Any, images: Optional[list] = None, di
raise web.HTTPNotFound(text=json.dumps({"error": f"session not found: {sid}"}, ensure_ascii=False), content_type="application/json")
if sess.status == "running":
raise web.HTTPConflict(text=json.dumps({"error": "session is already running"}, ensure_ascii=False), content_type="application/json")
if prompt.strip() == "/user":
user_msg = self.add_message(sess, "user", prompt)
try:
from plugins.ganet import open_user_center
except ImportError:
result = "设备互联尚未安装,请先发送“阅读 ../memory/ganet_pc_setup_sop.md,帮我配置设备互联。”"
else:
result = open_user_center()
self.add_message(sess, "assistant", result)
return {"ok": True, "sessionId": sid, "accepted": False,
"userMessageId": user_msg["id"], "seq": sess.msg_seq}
extra = {}
if image_ids:
extra["image_ids"] = image_ids
Expand Down
9 changes: 8 additions & 1 deletion frontends/qtapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2032,7 +2032,14 @@ def _handle_command(self, cmd: str):
parts = cmd.split()
op = parts[0].lower() if parts else ""
if op == "/help":
self._add_system_notice(HELP_TEXT)
self._add_system_notice(HELP_TEXT + "\n/user - 打开账号与设备管理")
elif op == "/user":
try:
from plugins.ganet import open_user_center
except ImportError:
self._add_system_notice("设备互联尚未安装,请先发送“阅读 ../memory/ganet_pc_setup_sop.md,帮我配置设备互联。”")
else:
self._add_system_notice(open_user_center())
elif op == "/stop":
self._do_stop()
self._add_system_notice("⏹️ 已停止")
Expand Down
12 changes: 12 additions & 0 deletions frontends/stapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,18 @@ def _slash_missing(name):
{"role": "assistant", "content": f"❌ `{name}` 模块未安装", "time": ts},
])
_reset_and_rerun()
if cmd == "/user":
try:
from plugins.ganet import open_user_center
except ImportError:
result = "设备互联尚未安装,请先发送“阅读 ../memory/ganet_pc_setup_sop.md,帮我配置设备互联。”"
else:
result = open_user_center()
st.session_state.messages.extend([
{"role": "user", "content": cmd, "time": ts},
{"role": "assistant", "content": result, "time": ts},
])
_reset_and_rerun()
if cmd == "/new":
if not _SLASH: _slash_missing('continue_cmd')
st.session_state.messages[:] = [{"role": "assistant", "content": reset_conversation(agent), "time": ts}]
Expand Down
14 changes: 12 additions & 2 deletions frontends/stapp2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,17 @@ def render_streaming_area():
for msg in st.session_state.messages: render_message(msg["role"], msg["content"], ts=msg.get("time", ""), unsafe_allow_html=True)
if st.session_state.streaming: render_streaming_area()
if prompt := st.chat_input("请输入指令", disabled=st.session_state.streaming):
st.session_state.messages.append({"role": "user", "content": prompt, "time": datetime.now().strftime("%Y-%m-%d %H:%M:%S")})
start_agent_task(prompt)
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
st.session_state.messages.append({"role": "user", "content": prompt, "time": now})
if prompt.strip() == "/user":
try:
from plugins.ganet import open_user_center
except ImportError:
result = "设备互联尚未安装,请先发送“阅读 ../memory/ganet_pc_setup_sop.md,帮我配置设备互联。”"
else:
result = open_user_center()
st.session_state.messages.append({"role": "assistant", "content": result, "time": now})
else:
start_agent_task(prompt)
st.rerun()

8 changes: 8 additions & 0 deletions frontends/tui_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1893,6 +1893,7 @@ def _cmds() -> list[tuple[str, str, str]]:
return [
('/help', '', _t('cmd.help.desc')),
('/status', '', _t('cmd.status.desc')),
('/user', '', _t('cmd.user.desc', default='打开账号与设备管理')),
('/llm', _t('cmd.llm.arg'), _t('cmd.llm.desc')),
('/btw', _t('cmd.btw.arg'), _t('cmd.btw.desc')),
('/review', _t('cmd.review.arg'), _t('cmd.review.desc')),
Expand Down Expand Up @@ -4504,6 +4505,13 @@ def _cmd(self, raw: str) -> None:
rows.append(f' {_DIM}⚠ {self._bridge._init_error}{_RST}')
rows.append('')
self.commit(rows)
elif name == 'user':
try:
from plugins.ganet import open_user_center
except ImportError:
self.commit(['设备互联尚未安装,请先发送“阅读 ../memory/ganet_pc_setup_sop.md,帮我配置设备互联。”'])
else:
self.commit([open_user_center()])
elif name == 'new':
# New session = wipe the current conversation and start fresh.
# Keeping prior sessions around (multi-session) is a separate
Expand Down
14 changes: 12 additions & 2 deletions frontends/tuiapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def parse_local_command(raw: str) -> tuple[str, list[str]] | None:
name, *rest = text.split(maxsplit=1)
cmd = name[1:].lower()
args = rest[0].split() if rest else []
if cmd in {"help", "status", "new", "switch", "sessions", "stop", "llm", "branch", "rewind", "clear", "close", "quit", "exit"}:
if cmd in {"help", "status", "user", "new", "switch", "sessions", "stop", "llm", "branch", "rewind", "clear", "close", "quit", "exit"}:
return cmd, args
return None

Expand Down Expand Up @@ -238,7 +238,7 @@ def compose(self) -> ComposeResult:
with Vertical(id="main"):
yield Static("", id="status")
yield RichLog(id="log", wrap=True, highlight=True, markup=True)
yield PromptInput(placeholder="Message, or /help /new /branch /rewind /switch /clear /close /stop /llm /resume", id="prompt")
yield PromptInput(placeholder="Message, or /help /user /new /branch /rewind /switch /clear /close /stop /llm /resume", id="prompt")
yield Footer()

def on_mount(self) -> None:
Expand Down Expand Up @@ -321,6 +321,7 @@ def _dispatch_command(self, cmd: str, args: list[str]) -> None:
handlers = {
"help": self._cmd_help,
"status": self._cmd_status,
"user": self._cmd_user,
"new": self._cmd_new,
"switch": self._cmd_switch,
"sessions": self._cmd_sessions,
Expand Down Expand Up @@ -407,10 +408,19 @@ def _set_assistant_message(self, agent_id: int, task_id: int, text: str, *, done
else:
self._refresh_sidebar()

def _cmd_user(self, args: list[str]) -> None:
try:
from plugins.ganet import open_user_center
except ImportError:
self._system("设备互联尚未安装,请先发送“阅读 ../memory/ganet_pc_setup_sop.md,帮我配置设备互联。”")
return
self._system(open_user_center())

def _cmd_help(self, args: list[str]) -> None:
self._system(
"Commands:\n"
"/help - show this help\n"
"/user - open account and device management\n"
"/new [name] - create and switch to a new agent session\n"
"/branch [name] - fork current session (copies LLM history + display)\n"
"/rewind - list rewindable turns; /rewind <n> to truncate history\n"
Expand Down
10 changes: 10 additions & 0 deletions frontends/tuiapp_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2067,6 +2067,7 @@ def default_agent_factory() -> Any:
("/help", "", "显示帮助"),
("/status", "", "查看会话状态"),
("/sessions", "", "列出所有会话"),
("/user", "", "打开账号与设备管理"),
("/new", "[name]", "新建并切换到新会话"),
("/switch", "<id|name>", "切换到指定会话"),
("/close", "", "关闭当前会话"),
Expand Down Expand Up @@ -3605,6 +3606,7 @@ def __init__(self, agent_factory: Optional[AgentFactory] = None) -> None:
self._spinner_timer = None
self._handlers: dict = {
"help": self._cmd_help, "status": self._cmd_status, "sessions": self._cmd_status,
"user": self._cmd_user,
"new": self._cmd_new, "switch": self._cmd_switch, "close": self._cmd_close,
"rename": self._cmd_rename,
"branch": self._cmd_branch, "rewind": self._cmd_rewind, "clear": self._cmd_clear,
Expand Down Expand Up @@ -4998,6 +5000,14 @@ def _cmd_help(self, args, raw):
lines = [f"{c:<11} {a:<18} {d}" for c, a, d in COMMANDS]
self._system("命令列表:\n" + "\n".join(lines))

def _cmd_user(self, args, raw):
try:
from plugins.ganet import open_user_center
except ImportError:
self._system("设备互联尚未安装,请先发送“阅读 ../memory/ganet_pc_setup_sop.md,帮我配置设备互联。”")
return
self._system(open_user_center())

def _cmd_status(self, args, raw):
lines = []
for sid, s in self.sessions.items():
Expand Down
Loading