mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-10-17 04:37:00 +00:00
* feat(file_io): add daily_write step for creating daily notes with conversation metadata - Add DailyWriteStep class that delegates to write job for creating daily notes - Register daily_write job in default configuration with proper parameters - Include validation for name and session_id path components - Add test coverage for daily_write functionality including metadata handling - Preserve existing job execution method in application.py after repositioning - Update base_step.py to use positional-only parameter syntax for job methods - Import and expose DailyWriteStep in file_io module initialization - Override reserved metadata keys (name, description, session_id, source_conversation) with fixed values - Refresh daily index after successful write operation - Generate proper source conversation links in markdown format * feat(daily): refactor daily note system with enhanced metadata handling - Introduce validate_filename_component function and export it - Add _INDEX_HIDDEN_METADATA_KEYS to hide conversation metadata from index - Update scan_notes to exclude hidden metadata keys from index rendering - Modify auto_memory to use daily_write tool and manage session frontmatter - Implement session note lookup and renaming based on frontmatter name - Update daily_list to return flattened note metadata including session info - Change daily_write to dispatch write step instead of running job - Add test cases for updated daily note functionality and metadata handling - Update version from 0.4.0.2 to 0.4.0.3 * fix(evolve): correct metadata update in auto memory response - Fixed trailing comma issue in metadata dictionary update - Ensured proper formatting of response metadata structure - Maintained existing functionality while fixing syntax error * refactor(auto_resource): replace daily_create with dynamic note management - Remove DailyCreateStep and related exports from file_io module - Replace static daily note creation with dynamic resource-linked card system - Implement LLM-suggested naming with frontmatter-driven file management - Add source_resource linking for tracking original files - Introduce collision handling with hash-based suffixes - Update documentation to reflect new resource card workflow - Modify auto_resource prompts to use write/edit tools instead of daily_create - Adjust test fixture comments to match new agent behavior - Update framework diagrams and quick start examples accordingly * feat(app): add version info to app initialization and update auto-memory logic - Include version number in application startup logging - Remove tool result truncation logic from auto-memory step - Update auto-memory to exclude tool_result blocks from saved history - Add test case to verify tool results are filtered out from message saving - Update YAML prompts to clarify filename naming rules without dates - Modify configuration to support new dispatch steps format with persistence control * feat(auto_memory): add note modification tracking and optimize frontmatter updates - Add _note_bytes and _note_modified methods to track actual file changes - Optimize frontmatter updates by checking existing metadata before update - Add modified flag to response metadata indicating actual note changes - Update logging to include modified status in various operations - Add comprehensive tests for modified/unmodified detection scenarios - Enhance result hook logic to skip when no actual changes occur - Refactor metadata handling to properly track creation vs modification status
69 lines
2.4 KiB
Python
69 lines
2.4 KiB
Python
"""Tests for shared evolve helpers."""
|
|
|
|
from agentscope.message import Msg
|
|
|
|
from reme.steps.evolve._evolve import agent_reply_result_text
|
|
from reme.steps.evolve.auto_memory import _sanitize_msg_for_save
|
|
|
|
|
|
def test_agent_reply_result_text_uses_last_text_block():
|
|
"""Agent reply text should be the last text block in the final message."""
|
|
reply = {
|
|
"result": "intermediate text\nfinal text",
|
|
"last_message": {
|
|
"content": [
|
|
{"type": "thinking", "thinking": "hidden"},
|
|
{"type": "text", "text": "intermediate text"},
|
|
{"type": "tool_call", "name": "write"},
|
|
{"type": "text", "text": "final text"},
|
|
],
|
|
},
|
|
}
|
|
|
|
assert agent_reply_result_text(reply) == "final text"
|
|
|
|
|
|
def test_agent_reply_result_text_falls_back_to_result():
|
|
"""Agent reply text falls back to result when no text block exists."""
|
|
reply = {"result": " fallback text \n", "last_message": {"content": [{"type": "thinking"}]}}
|
|
|
|
assert agent_reply_result_text(reply) == "fallback text"
|
|
|
|
|
|
def test_sanitize_msg_for_save_drops_tool_results_and_base64_data():
|
|
"""Saved history should keep conversation context without tool output pollution."""
|
|
msg = Msg.model_validate(
|
|
{
|
|
"name": "assistant",
|
|
"role": "assistant",
|
|
"content": [
|
|
{"type": "text", "text": "real conversation"},
|
|
{
|
|
"type": "tool_call",
|
|
"id": "call-1",
|
|
"name": "memory_search",
|
|
"input": "{}",
|
|
},
|
|
{
|
|
"type": "tool_result",
|
|
"id": "call-1",
|
|
"name": "memory_search",
|
|
"output": "retrieved memory that should not become conversation history",
|
|
},
|
|
{
|
|
"type": "data",
|
|
"source": {
|
|
"type": "base64",
|
|
"media_type": "image/png",
|
|
"data": "abc",
|
|
},
|
|
},
|
|
],
|
|
},
|
|
)
|
|
|
|
sanitized = _sanitize_msg_for_save(msg)
|
|
|
|
assert [block.type for block in sanitized.content] == ["text", "tool_call"]
|
|
assert sanitized.content[0].text == "real conversation"
|
|
assert sanitized.content[1].name == "memory_search"
|