mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-09-22 00:32:49 +00:00
- Add file_graph import to component registry - Register FILE_GRAPH enum in ComponentEnum - Implement BaseFileGraph integration in LinkedFileParser - Replace FileEdge with FileLink for better semantic clarity - Add lazy resolution of file_graph from app_context - Update file watcher logging to reflect links instead of edges refactor: streamline MCP transport layer architecture - Remove redundant step shells from reme2/mcp/steps/ - Consolidate all @R.register components to reme2.memory package - Update server.py to import reme2.memory directly - Revise README.md to document new architecture - Simplify module dependencies and import structure
26 lines
826 B
Python
26 lines
826 B
Python
"""Helpers for serializing Step output onto `RuntimeContext.response`.
|
|
|
|
Lives next to `runtime_context.py` because both are about the BaseStep
|
|
interface — the response side, specifically. Used by every Step that
|
|
returns a JSON-shaped payload (memory_*, sync, the three memory
|
|
services).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
from datetime import date, datetime
|
|
|
|
|
|
def _to_jsonable(value):
|
|
if isinstance(value, (datetime, date)):
|
|
return value.isoformat()
|
|
if isinstance(value, dict):
|
|
return {k: _to_jsonable(v) for k, v in value.items()}
|
|
if isinstance(value, (list, tuple, set)):
|
|
return [_to_jsonable(v) for v in value]
|
|
return value
|
|
|
|
|
|
def _set_answer(context, payload) -> None:
|
|
context.response.answer = json.dumps(_to_jsonable(payload), ensure_ascii=False, indent=2)
|