From 679fafee1f0f52831dc0f9d11abea06d2c7c1f39 Mon Sep 17 00:00:00 2001 From: "jinli.yl" Date: Tue, 10 Feb 2026 23:15:30 +0800 Subject: [PATCH] chore(version): bump version to 0.3.0.0a4 and add logging --- reme/__init__.py | 2 +- reme/agent/chat/fs_cli.py | 5 +++++ reme/core/file_watcher/full_file_watcher.py | 10 +++++----- reme/core/llm/lite_llm.py | 4 ++-- reme/core/llm/lite_llm_sync.py | 4 ++-- reme/core/llm/openai_llm.py | 4 ++-- reme/core/llm/openai_llm_sync.py | 4 ++-- reme/reme_fs.py | 19 ++++++++++--------- 8 files changed, 29 insertions(+), 23 deletions(-) diff --git a/reme/__init__.py b/reme/__init__.py index 8100443f..de22976c 100644 --- a/reme/__init__.py +++ b/reme/__init__.py @@ -18,7 +18,7 @@ __all__ = [ "ReMeFs", ] -__version__ = "0.3.0.0a3" +__version__ = "0.3.0.0a4" """ diff --git a/reme/agent/chat/fs_cli.py b/reme/agent/chat/fs_cli.py index 19640fe9..e7794f59 100644 --- a/reme/agent/chat/fs_cli.py +++ b/reme/agent/chat/fs_cli.py @@ -3,6 +3,8 @@ from datetime import datetime from pathlib import Path +from loguru import logger + from ...core.enumeration import Role, ChunkEnum from ...core.op import BaseReactStream from ...core.schema import Message, StreamChunk @@ -164,6 +166,9 @@ class FsCli(BaseReactStream): _ = await self.compact(force_compact=False) messages = await self.build_messages() + for i, message in enumerate(messages): + role = message.name or message.role + logger.info(f"[{self.__class__.__name__}] role={role} {message.simple_dump(as_dict=False)}") t_tools, messages, success = await self.react(messages, self.tools) diff --git a/reme/core/file_watcher/full_file_watcher.py b/reme/core/file_watcher/full_file_watcher.py index 6065a15a..a172a4ed 100644 --- a/reme/core/file_watcher/full_file_watcher.py +++ b/reme/core/file_watcher/full_file_watcher.py @@ -6,6 +6,7 @@ on any change, ensuring complete synchronization. import asyncio import os +from pathlib import Path from loguru import logger from watchfiles import Change @@ -27,18 +28,17 @@ class FullFileWatcher(BaseFileWatcher): @staticmethod async def _build_file_metadata(path: str) -> FileMetadata: + file_path = Path(path) + def _read_file_sync(): - stat_t = os.stat(path) - with open(path, "r", encoding="utf-8") as f: - content_t = f.read() - return stat_t, content_t + return file_path.stat(), file_path.read_text(encoding="utf-8") stat, content = await asyncio.to_thread(_read_file_sync) return FileMetadata( hash=hash_text(content), mtime_ms=stat.st_mtime * 1000, size=stat.st_size, - path=path, + path=str(file_path.absolute()), content=content, ) diff --git a/reme/core/llm/lite_llm.py b/reme/core/llm/lite_llm.py index 7950a8c2..68404e4e 100644 --- a/reme/core/llm/lite_llm.py +++ b/reme/core/llm/lite_llm.py @@ -101,10 +101,10 @@ class LiteLLM(BaseLLM): delta = chunk.choices[0].delta - if hasattr(delta, "reasoning_content") and delta.reasoning_content is not None: + if hasattr(delta, "reasoning_content") and delta.reasoning_content: yield StreamChunk(chunk_type=ChunkEnum.THINK, chunk=delta.reasoning_content) - if delta.content is not None: + if delta.content: yield StreamChunk(chunk_type=ChunkEnum.ANSWER, chunk=delta.content) if hasattr(delta, "tool_calls") and delta.tool_calls is not None: diff --git a/reme/core/llm/lite_llm_sync.py b/reme/core/llm/lite_llm_sync.py index 9951d223..b44b9269 100644 --- a/reme/core/llm/lite_llm_sync.py +++ b/reme/core/llm/lite_llm_sync.py @@ -33,10 +33,10 @@ class LiteLLMSync(LiteLLM): delta = chunk.choices[0].delta - if hasattr(delta, "reasoning_content") and delta.reasoning_content is not None: + if hasattr(delta, "reasoning_content") and delta.reasoning_content: yield StreamChunk(chunk_type=ChunkEnum.THINK, chunk=delta.reasoning_content) - if delta.content is not None: + if delta.content: yield StreamChunk(chunk_type=ChunkEnum.ANSWER, chunk=delta.content) if hasattr(delta, "tool_calls") and delta.tool_calls is not None: diff --git a/reme/core/llm/openai_llm.py b/reme/core/llm/openai_llm.py index ea647e07..9c0ecc7d 100644 --- a/reme/core/llm/openai_llm.py +++ b/reme/core/llm/openai_llm.py @@ -95,10 +95,10 @@ class OpenAILLM(BaseLLM): delta = chunk.choices[0].delta - if hasattr(delta, "reasoning_content") and delta.reasoning_content is not None: + if hasattr(delta, "reasoning_content") and delta.reasoning_content: yield StreamChunk(chunk_type=ChunkEnum.THINK, chunk=delta.reasoning_content) - if delta.content is not None: + if delta.content: yield StreamChunk(chunk_type=ChunkEnum.ANSWER, chunk=delta.content) if delta.tool_calls is not None: diff --git a/reme/core/llm/openai_llm_sync.py b/reme/core/llm/openai_llm_sync.py index 86dd119d..e7e0291b 100644 --- a/reme/core/llm/openai_llm_sync.py +++ b/reme/core/llm/openai_llm_sync.py @@ -37,10 +37,10 @@ class OpenAILLMSync(OpenAILLM): delta = chunk.choices[0].delta - if hasattr(delta, "reasoning_content") and delta.reasoning_content is not None: + if hasattr(delta, "reasoning_content") and delta.reasoning_content: yield StreamChunk(chunk_type=ChunkEnum.THINK, chunk=delta.reasoning_content) - if delta.content is not None: + if delta.content: yield StreamChunk(chunk_type=ChunkEnum.ANSWER, chunk=delta.content) if delta.tool_calls is not None: diff --git a/reme/reme_fs.py b/reme/reme_fs.py index bb5df9eb..65f06c84 100644 --- a/reme/reme_fs.py +++ b/reme/reme_fs.py @@ -293,33 +293,34 @@ class ReMeFs(Application): while True: try: # Get user input (async) - user_input = await session.prompt_async("You: ", default="") - if not user_input.strip(): + user_input = await session.prompt_async("You: ") + user_input = user_input.strip() + if not user_input: continue # Handle commands - if user_input.strip() == "/exit": + if user_input == "/exit": break - if user_input.strip() == "/new": + if user_input == "/new": result = await fs_cli.reset() print(f"{result}\nConversation reset\n") continue - if user_input.strip() == "/compact": + if user_input == "/compact": result = await fs_cli.compact(force_compact=True) print(f"{result}\nHistory compacted.\n") continue - if user_input.strip() == "/clear": + if user_input == "/clear": fs_cli.messages.clear() print("History cleared.\n") continue - if user_input.strip() == "/help": + if user_input == "/help": print("\nCommands:") - for command in self.commands: - print(f" {command}") + for command, description in self.commands.items(): + print(f" {command}: {description}") continue # Stream processing state