@pentatonic-ai/ai-agent-sdk 0.10.0 → 0.10.2
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/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/packages/memory-engine-v2/compat/server.py +38 -6
- package/packages/memory-engine-v2/extractor-async/Dockerfile +5 -3
- package/packages/memory-engine-v2/extractor-async/entity_id.py +57 -0
- package/packages/memory-engine-v2/extractor-async/sensitive_filter.py +51 -0
- package/packages/memory-engine-v2/extractor-async/test_async_ent_parser.py +258 -0
- package/packages/memory-engine-v2/extractor-async/test_sensitive_filter.py +61 -0
- package/packages/memory-engine-v2/extractor-async/worker.py +307 -43
- package/packages/memory-engine-v2/extractor-sync/Dockerfile +1 -1
- package/packages/memory-engine-v2/extractor-sync/entity_id.py +57 -0
- package/packages/memory-engine-v2/extractor-sync/server.py +231 -55
- package/packages/memory-engine-v2/extractor-sync/test_entity_id.py +88 -0
- package/packages/memory-engine-v2/extractor-sync/test_paired_extraction.py +208 -0
- package/packages/memory-engine-v2/org-model/migrations/002_entity_merges_audit.sql +53 -0
- package/packages/memory-engine-v2/org-model/migrations/003_distillation_traces.sql +60 -0
- package/packages/memory-engine-v2/scripts/backfill_entity_reconciliation.py +581 -0
- package/packages/memory-engine-v2/tests/test_entity_id_parity.py +57 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""Parity guard: extractor-sync/entity_id.py and extractor-async/entity_id.py MUST
|
|
2
|
+
be byte-identical.
|
|
3
|
+
|
|
4
|
+
The two extractors run as separate Docker services with per-service build contexts
|
|
5
|
+
(docker-compose `context: ./extractor-sync` / `./extractor-async`), so they can't
|
|
6
|
+
import a single shared module — the file is duplicated. If the copies ever drift,
|
|
7
|
+
the two passes would key entities differently again and re-introduce the exact
|
|
8
|
+
fragmentation RFC-entity-reconciliation.md (step 1) fixes. This test fails loudly if
|
|
9
|
+
that happens. When you change one copy, copy it to the other.
|
|
10
|
+
|
|
11
|
+
Run: pytest packages/memory-engine-v2/tests/test_entity_id_parity.py
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import importlib.util
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
_PKG = Path(__file__).resolve().parent.parent
|
|
20
|
+
_SYNC = _PKG / "extractor-sync" / "entity_id.py"
|
|
21
|
+
_ASYNC = _PKG / "extractor-async" / "entity_id.py"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_both_copies_exist():
|
|
25
|
+
assert _SYNC.exists(), f"missing {_SYNC}"
|
|
26
|
+
assert _ASYNC.exists(), f"missing {_ASYNC}"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def test_byte_identical():
|
|
30
|
+
assert _SYNC.read_bytes() == _ASYNC.read_bytes(), (
|
|
31
|
+
"extractor-sync/entity_id.py and extractor-async/entity_id.py have drifted — "
|
|
32
|
+
"they must be byte-identical so the two extractors key entities the same way. "
|
|
33
|
+
"Copy one over the other."
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _load(path: Path, name: str):
|
|
38
|
+
spec = importlib.util.spec_from_file_location(name, path)
|
|
39
|
+
assert spec and spec.loader
|
|
40
|
+
mod = importlib.util.module_from_spec(spec)
|
|
41
|
+
spec.loader.exec_module(mod)
|
|
42
|
+
return mod
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def test_identical_output_across_copies():
|
|
46
|
+
a = _load(_SYNC, "entity_id_sync")
|
|
47
|
+
b = _load(_ASYNC, "entity_id_async")
|
|
48
|
+
cases = [
|
|
49
|
+
("arena1", "person", "Carly Snider"),
|
|
50
|
+
("arena1", "person", "carly@pactcollective.org"),
|
|
51
|
+
("arena1", "person", " Ben Gordon "),
|
|
52
|
+
("arena2", "org", "Pact Collective"),
|
|
53
|
+
("arena1", "person", ""),
|
|
54
|
+
]
|
|
55
|
+
for arena, etype, name in cases:
|
|
56
|
+
assert a.entity_id(arena, etype, name) == b.entity_id(arena, etype, name)
|
|
57
|
+
assert a.normalize_surface_form(name) == b.normalize_surface_form(name)
|