@reconcrap/people-network-memory 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +476 -0
- package/docs/mcp_tools.md +138 -0
- package/harness_adapters/openclaw/mcp.managed.unix.template.json +25 -0
- package/harness_adapters/openclaw/mcp.managed.windows.template.json +26 -0
- package/harness_adapters/openclaw/mcp.template.json +14 -0
- package/harness_adapters/openclaw/ppl/SKILL.md +114 -0
- package/package.json +30 -0
- package/pyproject.toml +26 -0
- package/scripts/install_windows.ps1 +92 -0
- package/scripts/npm/people-memory.js +276 -0
- package/scripts/people_memory_bootstrap.py +247 -0
- package/scripts/run_graphiti_live_from_liepin.ps1 +87 -0
- package/scripts/run_tests_with_artifacts.ps1 +307 -0
- package/src/people_network_memory/__init__.py +6 -0
- package/src/people_network_memory/application/__init__.py +16 -0
- package/src/people_network_memory/application/normalization.py +1441 -0
- package/src/people_network_memory/application/services.py +921 -0
- package/src/people_network_memory/cli.py +1212 -0
- package/src/people_network_memory/config.py +268 -0
- package/src/people_network_memory/domain/__init__.py +55 -0
- package/src/people_network_memory/domain/identity.py +77 -0
- package/src/people_network_memory/domain/models.py +355 -0
- package/src/people_network_memory/fixtures/__init__.py +6 -0
- package/src/people_network_memory/fixtures/eval.py +398 -0
- package/src/people_network_memory/fixtures/extractor_eval.py +364 -0
- package/src/people_network_memory/fixtures/generator.py +290 -0
- package/src/people_network_memory/fixtures/report.py +252 -0
- package/src/people_network_memory/graphiti_adapter/__init__.py +9 -0
- package/src/people_network_memory/graphiti_adapter/episode_formatter.py +70 -0
- package/src/people_network_memory/graphiti_adapter/graphiti_store.py +655 -0
- package/src/people_network_memory/graphiti_adapter/indexer.py +194 -0
- package/src/people_network_memory/graphiti_adapter/ontology.py +68 -0
- package/src/people_network_memory/harness_adapters/__init__.py +2 -0
- package/src/people_network_memory/harness_adapters/openclaw/__init__.py +9 -0
- package/src/people_network_memory/harness_adapters/openclaw/installer.py +577 -0
- package/src/people_network_memory/harness_adapters/openclaw/integration_eval.py +508 -0
- package/src/people_network_memory/harness_adapters/openclaw/smoke.py +292 -0
- package/src/people_network_memory/infrastructure/__init__.py +2 -0
- package/src/people_network_memory/infrastructure/archive_backup.py +171 -0
- package/src/people_network_memory/infrastructure/diagnostics.py +171 -0
- package/src/people_network_memory/infrastructure/embeddings.py +155 -0
- package/src/people_network_memory/infrastructure/file_store.py +129 -0
- package/src/people_network_memory/infrastructure/graphiti_promotion.py +212 -0
- package/src/people_network_memory/infrastructure/id_generator.py +40 -0
- package/src/people_network_memory/infrastructure/in_memory_store.py +1008 -0
- package/src/people_network_memory/infrastructure/llm_extractor.py +476 -0
- package/src/people_network_memory/infrastructure/llm_identity_advisor.py +200 -0
- package/src/people_network_memory/infrastructure/llm_judge.py +162 -0
- package/src/people_network_memory/infrastructure/redaction.py +21 -0
- package/src/people_network_memory/infrastructure/release_check.py +186 -0
- package/src/people_network_memory/infrastructure/retrieval_intent.py +98 -0
- package/src/people_network_memory/infrastructure/semantic_index.py +262 -0
- package/src/people_network_memory/mcp_server/__init__.py +2 -0
- package/src/people_network_memory/mcp_server/contracts.py +85 -0
- package/src/people_network_memory/mcp_server/runtime.py +133 -0
- package/src/people_network_memory/mcp_server/tools.py +588 -0
- package/src/people_network_memory/ports/__init__.py +2 -0
- package/src/people_network_memory/ports/errors.py +25 -0
- package/src/people_network_memory/ports/interfaces.py +103 -0
- package/src/people_network_memory/projection/__init__.py +6 -0
- package/src/people_network_memory/projection/builders.py +46 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"""Ports consumed by application services."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Protocol
|
|
6
|
+
|
|
7
|
+
from people_network_memory.domain.models import (
|
|
8
|
+
IdentityAdvice,
|
|
9
|
+
IdentityCandidate,
|
|
10
|
+
PersonCard,
|
|
11
|
+
PersonMemoryRecord,
|
|
12
|
+
PersonRef,
|
|
13
|
+
RecordInteractionResult,
|
|
14
|
+
RetrievalItem,
|
|
15
|
+
ReviewItem,
|
|
16
|
+
SocialInteraction,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class IdentityIndex(Protocol):
|
|
21
|
+
def find_identity_candidates(self, ref: PersonRef) -> list[IdentityCandidate]:
|
|
22
|
+
...
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class IdentityAdvisor(Protocol):
|
|
26
|
+
def advise(
|
|
27
|
+
self,
|
|
28
|
+
*,
|
|
29
|
+
interaction: SocialInteraction,
|
|
30
|
+
ref: PersonRef,
|
|
31
|
+
candidates: list[IdentityCandidate],
|
|
32
|
+
) -> IdentityAdvice:
|
|
33
|
+
...
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class GraphMemoryStore(Protocol):
|
|
37
|
+
def save_interaction(
|
|
38
|
+
self, interaction: SocialInteraction, identity_map: dict[str, str | None]
|
|
39
|
+
) -> RecordInteractionResult:
|
|
40
|
+
...
|
|
41
|
+
|
|
42
|
+
def get_person_memory(self, person_id: str) -> PersonMemoryRecord | None:
|
|
43
|
+
...
|
|
44
|
+
|
|
45
|
+
def find_person_memory_by_name(self, name: str) -> list[PersonMemoryRecord]:
|
|
46
|
+
...
|
|
47
|
+
|
|
48
|
+
def merge_people(
|
|
49
|
+
self, *, source_person_id: str, target_person_id: str, note: str | None = None
|
|
50
|
+
) -> PersonMemoryRecord:
|
|
51
|
+
...
|
|
52
|
+
|
|
53
|
+
def export_data(self) -> dict[str, object]:
|
|
54
|
+
...
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class GraphSearch(Protocol):
|
|
58
|
+
def search(
|
|
59
|
+
self,
|
|
60
|
+
query: str,
|
|
61
|
+
*,
|
|
62
|
+
limit: int = 10,
|
|
63
|
+
include_sensitive: bool = False,
|
|
64
|
+
mode: str = "recall",
|
|
65
|
+
) -> list[RetrievalItem]:
|
|
66
|
+
...
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class RetrievalJudge(Protocol):
|
|
70
|
+
def judge(
|
|
71
|
+
self,
|
|
72
|
+
query: str,
|
|
73
|
+
candidates: list[RetrievalItem],
|
|
74
|
+
*,
|
|
75
|
+
limit: int,
|
|
76
|
+
) -> list[RetrievalItem]:
|
|
77
|
+
...
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class InteractionExtractor(Protocol):
|
|
81
|
+
def extract(self, interaction: SocialInteraction) -> SocialInteraction:
|
|
82
|
+
...
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class ReviewQueue(Protocol):
|
|
86
|
+
def add_review_item(self, item: ReviewItem) -> None:
|
|
87
|
+
...
|
|
88
|
+
|
|
89
|
+
def list_review_items(self, *, status: str | None = None) -> list[ReviewItem]:
|
|
90
|
+
...
|
|
91
|
+
|
|
92
|
+
def update_review_item(self, item: ReviewItem) -> ReviewItem:
|
|
93
|
+
...
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class PersonProjector(Protocol):
|
|
97
|
+
def build_card(self, record: PersonMemoryRecord) -> PersonCard:
|
|
98
|
+
...
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class IdGenerator(Protocol):
|
|
102
|
+
def new_id(self, prefix: str) -> str:
|
|
103
|
+
...
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""Read-model projection helpers."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from people_network_memory.domain.models import PersonCard, PersonMemoryRecord
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class DefaultPersonProjector:
|
|
9
|
+
def build_card(self, record: PersonMemoryRecord) -> PersonCard:
|
|
10
|
+
current_work = next(
|
|
11
|
+
(work for work in record.work_history if work.is_current),
|
|
12
|
+
record.work_history[0] if record.work_history else None,
|
|
13
|
+
)
|
|
14
|
+
headline = None
|
|
15
|
+
if current_work:
|
|
16
|
+
headline = " at ".join(
|
|
17
|
+
part for part in [current_work.role, current_work.organization] if part
|
|
18
|
+
)
|
|
19
|
+
recent_interactions = [
|
|
20
|
+
interaction.source_text for interaction in record.interactions[-5:]
|
|
21
|
+
]
|
|
22
|
+
summary_parts = []
|
|
23
|
+
if headline:
|
|
24
|
+
summary_parts.append(headline)
|
|
25
|
+
if record.interests:
|
|
26
|
+
summary_parts.append("Interests: " + ", ".join(record.interests[:5]))
|
|
27
|
+
return PersonCard(
|
|
28
|
+
person_id=record.person_id,
|
|
29
|
+
display_name=record.display_name,
|
|
30
|
+
aliases=record.aliases,
|
|
31
|
+
headline=headline,
|
|
32
|
+
summary="; ".join(summary_parts) if summary_parts else None,
|
|
33
|
+
work_history=record.work_history,
|
|
34
|
+
education=record.education,
|
|
35
|
+
interests=record.interests,
|
|
36
|
+
important_dates=record.important_dates,
|
|
37
|
+
contacts=record.contacts,
|
|
38
|
+
preferences=record.preferences,
|
|
39
|
+
recent_interactions=recent_interactions,
|
|
40
|
+
attributed_claims=record.attributed_claims,
|
|
41
|
+
relationships=record.relationships,
|
|
42
|
+
open_follow_ups=[
|
|
43
|
+
follow_up for follow_up in record.follow_ups if follow_up.status == "open"
|
|
44
|
+
],
|
|
45
|
+
evidence=record.evidence,
|
|
46
|
+
)
|