feat(memory): add graph runtime import store

This commit is contained in:
tegwick 2026-05-15 01:56:51 +02:00
parent 5c450fcaa5
commit 8daab687b2
12 changed files with 1103 additions and 4 deletions

View file

@ -9,6 +9,7 @@ from .blob_storage import (
digest_storage_key,
)
from .ingestion import DirectorySourceConnector, FormatExtractor, SourceConnector
from .memory import MemoryGraphRepository
from .policy import AllowAllPolicyGateway, PolicyGateway
from .repositories import AssetRegistryRepository
@ -23,6 +24,7 @@ __all__ = [
"digest_storage_key",
"DirectorySourceConnector",
"FormatExtractor",
"MemoryGraphRepository",
"PolicyGateway",
"SourceConnector",
]

View file

@ -0,0 +1,47 @@
"""Ports for operational memory graph state."""
from __future__ import annotations
from typing import Protocol
from kontextual_engine.core import (
LifecycleState,
MemoryEdgeRecord,
MemoryEventRecord,
MemoryNodeRecord,
MemoryProfileRecord,
)
class MemoryGraphRepository(Protocol):
def save_memory_profile(self, profile: MemoryProfileRecord) -> MemoryProfileRecord: ...
def get_memory_profile(self, profile_id: str) -> MemoryProfileRecord: ...
def save_memory_node(self, node: MemoryNodeRecord) -> MemoryNodeRecord: ...
def get_memory_node(self, node_id: str) -> MemoryNodeRecord: ...
def list_memory_nodes(
self,
*,
graph_id: str | None = None,
kind: str | None = None,
lifecycle: LifecycleState | str | None = None,
) -> list[MemoryNodeRecord]: ...
def save_memory_edge(self, edge: MemoryEdgeRecord) -> MemoryEdgeRecord: ...
def get_memory_edge(self, edge_id: str) -> MemoryEdgeRecord: ...
def list_memory_edges(
self,
*,
graph_id: str | None = None,
source_node_id: str | None = None,
target_node_id: str | None = None,
) -> list[MemoryEdgeRecord]: ...
def append_memory_event(self, event: MemoryEventRecord) -> MemoryEventRecord: ...
def get_memory_event(self, event_id: str) -> MemoryEventRecord: ...
def list_memory_events(
self,
*,
graph_id: str | None = None,
kind: str | None = None,
) -> list[MemoryEventRecord]: ...