mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-09-22 00:32:49 +00:00
Add support for `paths=None` in `get_nodes` method to return all real nodes as the graph's "scan everything" entry point. When `paths` is explicitly passed as an empty list, returns empty list. Virtual placeholders are filtered out in both cases. BREAKING CHANGE: The `get_nodes` method signature changed from requiring a list of paths to accepting an optional list or None. refactor(memory): move runtime_response imports to steps package Move runtime_response imports from memory package to steps package to improve code organization and reduce circular dependencies. refactor(config): update obsidian configuration table structure Update the obsidian configuration markdown table to improve clarity and fix incorrect section headings. Change 'stat/list' to 'file' and 'return specific tag info' to 'tags' section with proper commands. chore(memory): remove deprecated toolkit modules Remove deprecated agent_toolkit.py, file_toolkit.py, and graph_toolkit.py modules as functionality has been moved to steps package. feat(steps): add new CRUD file operations Add new steps for file operations including file_download and file_list operations with proper path resolution and filtering capabilities.
55 lines
1.9 KiB
Python
55 lines
1.9 KiB
Python
from abc import abstractmethod
|
|
from pathlib import Path
|
|
|
|
from ..base_component import BaseComponent
|
|
from ...enumeration import ComponentEnum
|
|
from ...schema import FileLink, FileNode
|
|
|
|
|
|
class BaseFileGraph(BaseComponent):
|
|
component_type = ComponentEnum.FILE_GRAPH
|
|
|
|
def __init__(self, graph_name: str = "default", **kwargs):
|
|
super().__init__(**kwargs)
|
|
self.graph_name: str = graph_name or self.name
|
|
self.graph_path: Path = self.working_path / self.component_type.value
|
|
self.graph_path.mkdir(parents=True, exist_ok=True)
|
|
|
|
# -- Node CRUD ---------------------------------------------------------
|
|
|
|
@abstractmethod
|
|
async def upsert_nodes(self, nodes: list[FileNode]) -> None:
|
|
"""Upsert nodes into the graph."""
|
|
|
|
@abstractmethod
|
|
async def delete_nodes(self, paths: list[str]) -> None:
|
|
"""Delete nodes from the graph."""
|
|
|
|
@abstractmethod
|
|
async def get_nodes(self, paths: list[str] | None = None) -> list[FileNode]:
|
|
"""Get nodes from the graph.
|
|
|
|
``paths=None`` (the default) returns every real node — the
|
|
graph's "scan everything" entry point. Pass an explicit list
|
|
for path-known lookups; ``[]`` returns ``[]`` (empty input,
|
|
empty output). Virtual placeholders (nodes that exist only
|
|
because something links to them) are filtered out either way.
|
|
"""
|
|
|
|
@abstractmethod
|
|
async def rebuild_links(self) -> None:
|
|
"""Rebuild all links in the graph from each node's payload."""
|
|
|
|
@abstractmethod
|
|
async def clear(self):
|
|
"""Clear the graph."""
|
|
|
|
# -- Link access -------------------------------------------------------
|
|
|
|
@abstractmethod
|
|
async def get_outlinks(self, path: str) -> list[FileLink]:
|
|
"""Get outlinks from the graph."""
|
|
|
|
@abstractmethod
|
|
async def get_inlinks(self, path: str) -> list[FileLink]:
|
|
"""Get inlinks from the graph."""
|