Coverage for src / harnessutils / memory.py: 100%
3 statements
« prev ^ index » next coverage.py v7.13.2, created at 2026-03-10 19:23 -0600
« prev ^ index » next coverage.py v7.13.2, created at 2026-03-10 19:23 -0600
1"""SemanticMemoryBackend protocol for harness-utils.
3Consumers implement this protocol to provide semantic memory capabilities.
4harness-utils only holds a reference — it does not call the backend internally.
5"""
7from typing import Any, Protocol, runtime_checkable
10@runtime_checkable
11class SemanticMemoryBackend(Protocol):
12 async def add_artifact(
13 self,
14 content: str,
15 kind: str,
16 *,
17 namespace: str = "default",
18 metadata: dict[str, Any] | None = None,
19 ) -> Any: ...
21 async def search_artifacts(
22 self,
23 query: str,
24 *,
25 top_k: int = 10,
26 kind: str | None = None,
27 namespace: str | None = None,
28 min_similarity: float = 0.0,
29 ) -> list[Any]: ...
31 async def get_artifact(self, artifact_id: int) -> Any | None: ...
33 async def update_artifact(
34 self,
35 artifact_id: int,
36 *,
37 metadata: dict[str, Any] | None = None,
38 content: str | None = None,
39 ) -> Any: ...
41 async def delete_artifact(self, artifact_id: int) -> None: ...