diff --git a/scheduler_tasks.json b/scheduler_tasks.json new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/scheduler_tasks.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/xcli_core/cli_base.py b/xcli_core/cli_base.py index 61d61b9..31f551f 100644 --- a/xcli_core/cli_base.py +++ b/xcli_core/cli_base.py @@ -355,7 +355,19 @@ class BaseAICLI: engine.max_history = self.max_history def handle_engine_command(self, command): - """处理引擎特定命令""" + """处理引擎特定命令(支持跨引擎调用,如 /engine.manual status)""" + # 先检查是否指定了引擎名(如 "manual status" → 引擎=manual, 命令=status) + parts = command.split(' ', 1) + target_name = parts[0] + rest = parts[1] if len(parts) > 1 else "" + + # 如果目标名是某个已加载的引擎,直接调用该引擎 + if target_name in self.engines: + target_engine = self.engines[target_name] + if hasattr(target_engine, 'handle_command'): + return target_engine.handle_command(rest) + + # 否则当作当前引擎的命令 if not hasattr(self.current_engine, 'handle_command'): return False engine_name = getattr(self.current_engine, 'name', '') diff --git a/xcli_core/cli_core.py b/xcli_core/cli_core.py index 7dd8b92..c0e8371 100644 --- a/xcli_core/cli_core.py +++ b/xcli_core/cli_core.py @@ -1102,6 +1102,22 @@ multi 操作支持一次修改多处: print(f"{Fore.RED}当前引擎不支持该命令或命令执行失败{Style.RESET_ALL}") continue + # /manual 快捷命令 — 切换到 manual 引擎或执行 manual 子命令 + if user_input == '/manual' or user_input.startswith('/manual '): + args = user_input[8:].strip() if user_input.startswith('/manual ') else '' + if 'manual' not in self.engines: + print(f"{Fore.RED}manual 引擎未加载{Style.RESET_ALL}") + elif not args: + # 无参数:切换到 manual 引擎 + self.switch_engine('manual') + print(f"{Fore.GREEN}已切换到 manual 引擎{Style.RESET_ALL}") + else: + # 有参数:执行 manual 引擎命令(如 status, restart) + result = self.engines['manual'].handle_command(args) + if result: + print(f"{Fore.GREEN}{result}{Style.RESET_ALL}") + continue + if user_input.startswith('/file.read '): args = user_input[11:].strip() parts = args.split(' ', 2) diff --git a/xcli_core/tui.py b/xcli_core/tui.py index 6b2fb33..33c4558 100644 --- a/xcli_core/tui.py +++ b/xcli_core/tui.py @@ -719,6 +719,7 @@ if TEXTUAL_AVAILABLE: 'tools': lambda: self._show_tools(), 'engines': lambda: self._show_engines(), 'tui': lambda: self._system("已在 TUI 模式中"), + 'manual': lambda: self._handle_manual(args), } handler = cmds.get(name) @@ -753,6 +754,24 @@ if TEXTUAL_AVAILABLE: Enter 换行 Tab 缩进""" self._system(help_text) + def _handle_manual(self, args): + """处理 /manual 命令""" + if 'manual' not in self.cli.engines: + self._error("manual 引擎未加载") + return + if not args: + # 切换到 manual 引擎 + if self.bridge.switch_engine('manual'): + self._system("已切换到 manual 引擎") + self._update_sidebar() + else: + self._error("切换失败") + else: + # 执行 manual 引擎子命令 + result = self.cli.engines['manual'].handle_command(args) + if result: + self._system(result) + def _switch_cli(self): self._system("切换到命令行模式...") self.cli.tui_output_callback = None