From e7bc68f566d9a59d522cec2848408983dd17e988 Mon Sep 17 00:00:00 2001 From: zhzy0077 Date: Wed, 1 Apr 2026 00:57:48 +0800 Subject: [PATCH] fix(acp): parse shell command into command and args for terminal/create According to ACP spec, CreateTerminalRequest requires separate 'command' and 'args' fields. Previously, kimi-cli sent the entire command as a single string (e.g., 'ls -la'), causing acpx to fail with ENOENT when trying to spawn a non-existent binary named 'ls -la'. The fix uses shlex.split() to properly parse the command string into executable and arguments before sending to the ACP client. Fixes: acpx terminal tool failing with 'Internal error' for commands with arguments (e.g., 'ls -la', 'cat file.txt') --- src/kimi_cli/acp/tools.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/kimi_cli/acp/tools.py b/src/kimi_cli/acp/tools.py index 055c9edb3..ad757c1a1 100644 --- a/src/kimi_cli/acp/tools.py +++ b/src/kimi_cli/acp/tools.py @@ -1,5 +1,6 @@ import asyncio from contextlib import suppress +import shlex import acp from kaos import get_current_kaos @@ -88,8 +89,13 @@ async def __call__(self, params: ShellParams) -> ToolReturnValue: timed_out = False try: + # Parse command string into command and args for ACP + parts = shlex.split(params.command) + cmd = parts[0] if parts else "" + args = parts[1:] if len(parts) > 1 else [] resp = await self._acp_conn.create_terminal( - command=params.command, + command=cmd, + args=args, session_id=self._acp_session_id, output_byte_limit=builder.max_chars, )