diff --git a/opencode_llm.py b/opencode_llm.py index adc2424..bd044dc 100644 --- a/opencode_llm.py +++ b/opencode_llm.py @@ -168,6 +168,17 @@ class OpenCodeLLM(FrameProcessor): cwd=str(self._cwd), ) + async def _read_stderr(stream): + while True: + line = await stream.readline() + if not line: + break + decoded = line.decode("utf-8").strip() + if decoded and not decoded.startswith(">"): + logger.info(f"OpenCode Tool: {decoded}") + + stderr_task = asyncio.create_task(_read_stderr(proc.stderr)) + while True: line = await proc.stdout.readline() if not line: @@ -179,6 +190,7 @@ class OpenCodeLLM(FrameProcessor): await self.push_frame(LLMTextFrame(cleaned)) await proc.wait() + await stderr_task except asyncio.CancelledError: logger.info("OpenCode turn cancelled mid-response.")