Use Claude Code, Codex, VSCode, Pi, and OpenCode (and 6 other harnesses) for free (1.3B+ free tokens) from your terminal, app, IDE, or phone, and now from the browser with native browser sessions (multi-harness + multi-model) like OpenClaw (voice supported + ToS friendly)
Python
add new template kwargs and fixed linter errors
Alishahryar13acabcb8e0df
diff --git a/cli/parser.py b/cli/parser.pyindex a3b215aa..b7f6bf13 100644--- a/cli/parser.py+++ b/cli/parser.py@@ -113,7 +113,9 @@ class CLIParser:else:# Non-zero exit is an errorerror_msg = stderr if stderr else f"Process exited with code {code}"- logger.warning(f"CLI_PARSER: Error exit (code={code}): {error_msg[:100]}")+ logger.warning(+ f"CLI_PARSER: Error exit (code={code}): {error_msg[:100]}"+ )return [{"type": "error", "message": error_msg},{"type": "complete", "status": "failed"},diff --git a/cli/session.py b/cli/session.pyindex 99746a02..812e19e5 100644--- a/cli/session.py+++ b/cli/session.py@@ -153,9 +153,13 @@ class CLISession:yield {"type": "error", "error": {"message": stderr_text}}return_code = await self.process.wait()- logger.info(f"Claude CLI exited with code {return_code}, stderr_present={bool(stderr_text)}")+ logger.info(+ f"Claude CLI exited with code {return_code}, stderr_present={bool(stderr_text)}"+ )if return_code != 0 and not stderr_text:- logger.warning(f"CLI_SESSION: Process exited with code {return_code} but no stderr captured")+ logger.warning(+ f"CLI_SESSION: Process exited with code {return_code} but no stderr captured"+ )yield {"type": "exit","code": return_code,diff --git a/messaging/base.py b/messaging/base.pyindex 4517d6b8..f147bf7d 100644--- a/messaging/base.py+++ b/messaging/base.py@@ -38,7 +38,9 @@ class SessionManagerInterface(Protocol):"""...- async def register_real_session_id(self, temp_id: str, real_session_id: str) -> bool:+ async def register_real_session_id(+ self, temp_id: str, real_session_id: str+ ) -> bool:"""Register the real session ID from CLI output."""...diff --git a/messaging/event_parser.py b/messaging/event_parser.pyindex 2b0da0b7..b609561b 100644--- a/messaging/event_parser.py+++ b/messaging/event_parser.py@@ -55,9 +55,7 @@ def parse_cli_event(event: Dict) -> List[Dict]:# Prioritize thinking firstif thinking_parts:- results.append(- {"type": "thinking", "text": "\n".join(thinking_parts)}- )+ results.append({"type": "thinking", "text": "\n".join(thinking_parts)})# Then tools or subagentsif tool_calls:diff --git a/providers/base.py b/providers/base.pyindex 84c6bacc..fe2b6107 100644--- a/providers/base.py+++ b/providers/base.py@@ -7,6 +7,7 @@ from pydantic import BaseModelclass ProviderConfig(BaseModel):"""Configuration for a provider."""+api_key: strbase_url: Optional[str] = Nonerate_limit: Optional[int] = None@@ -25,7 +26,9 @@ class BaseProvider(ABC):pass@abstractmethod- async def stream_response(self, request: Any, input_tokens: int = 0) -> AsyncIterator[str]:+ async def stream_response(+ self, request: Any, input_tokens: int = 0+ ) -> AsyncIterator[str]:"""Stream response in Anthropic SSE format."""passdiff --git a/providers/model_utils.py b/providers/model_utils.pyindex fa07ee83..3339ff7d 100644--- a/providers/model_utils.py+++ b/providers/model_utils.py@@ -25,7 +25,7 @@ def strip_provider_prefixes(model: str) -> str:"""for prefix in _PROVIDER_PREFIXES:if model.startswith(prefix):- return model[len(prefix):]+ return model[len(prefix) :]return modeldiff --git a/providers/nvidia_mixins.py b/providers/nvidia_mixins.pyindex 6e3610be..28156d24 100644--- a/providers/nvidia_mixins.py+++ b/providers/nvidia_mixins.py@@ -95,10 +95,10 @@ class RequestBuilderMixin:if request_data.thinking and getattr(request_data.thinking, "enabled", True):extra_body.setdefault("thinking", {"type": "enabled"})extra_body.setdefault("reasoning_split", True)-- # Handle DeepSeek-specific thinking mode- if "deepseek" in request_data.model.lower():- extra_body.setdefault("chat_template_kwargs", {"thinking": True})+ extra_body.setdefault(+ "chat_template_kwargs",+ {"thinking": True, "reasoning_split": True, "clear_thinking": False},+ )body.update(extra_body)diff --git a/tests/test_config.py b/tests/test_config.pyindex 70669b73..87148aa5 100644--- a/tests/test_config.py+++ b/tests/test_config.py@@ -1,7 +1,6 @@"""Tests for config/settings.py"""-class TestSettings:"""Test Settings configuration."""diff --git a/tests/test_request_utils.py b/tests/test_request_utils.pyindex cc66d2c1..a0df3d8e 100644--- a/tests/test_request_utils.py+++ b/tests/test_request_utils.py@@ -199,7 +199,10 @@ class TestExtractCommandPrefix:def test_with_env_vars(self):"""Test command with environment variables."""assert extract_command_prefix("DEBUG=1 python script.py") == "DEBUG=1 python"- assert extract_command_prefix("API_KEY=secret node app.js") == "API_KEY=secret node"+ assert (+ extract_command_prefix("API_KEY=secret node app.js")+ == "API_KEY=secret node"+ )def test_single_word_commands(self):"""Test single word commands."""@@ -211,7 +214,10 @@ class TestExtractCommandPrefix:"""Test detection of command injection attempts."""assert extract_command_prefix("`whoami`") == "command_injection_detected"assert extract_command_prefix("$(whoami)") == "command_injection_detected"- assert extract_command_prefix("echo $(cat /etc/passwd)") == "command_injection_detected"+ assert (+ extract_command_prefix("echo $(cat /etc/passwd)")+ == "command_injection_detected"+ )def test_empty_command(self):"""Test handling of empty commands."""@@ -221,7 +227,9 @@ class TestExtractCommandPrefix:def test_complex_git_command(self):"""Test complex git command extraction."""assert extract_command_prefix("git log --oneline --graph") == "git log"- assert extract_command_prefix("git checkout -b feature-branch") == "git checkout"+ assert (+ extract_command_prefix("git checkout -b feature-branch") == "git checkout"+ )def test_cargo_command(self):"""Test cargo command extraction."""