feat(plugins): share native session handoff and soften memory search

This commit is contained in:
kartik-mem0
2026-09-10 18:20:36 +05:30
parent 02f7a9b2c4
commit 82c32f993e
130 changed files with 16430 additions and 379 deletions
@@ -4,12 +4,12 @@
from __future__ import annotations
import argparse
import json
import re
import time
from pathlib import Path
from typing import Any
CORE_ROOT = Path(__file__).resolve().parents[1]
INTEGRATIONS_ROOT = CORE_ROOT.parent
TYPESCRIPT_ARTIFACTS = {
@@ -21,6 +21,11 @@ TYPESCRIPT_ARTIFACTS = {
),
"deepseek": (INTEGRATIONS_ROOT / "deepseek-plugin", ("dist/index.js", "dist/index.d.ts")),
}
HANDOFF_RUNTIME_FILES = json.loads((CORE_ROOT / "build" / "handoff-runtime.json").read_text(encoding="utf-8"))
TYPESCRIPT_ARTIFACTS = {
host: (package, (*required, *(f"dist/{name}" for name in HANDOFF_RUNTIME_FILES)))
for host, (package, required) in TYPESCRIPT_ARTIFACTS.items()
}
MONOREPO_IMPORT = re.compile(
r"(?:from\s+|import\s*\(|require\s*\()\s*['\"][^'\"]*agent-plugin-core"
)
@@ -30,6 +35,11 @@ def verify_artifact(group: str, package: Path, required: tuple[str, ...]) -> dic
started = time.monotonic()
errors = [f"missing package artifact: {name}" for name in required if not (package / name).is_file()]
dist = package / "dist"
if group in TYPESCRIPT_ARTIFACTS:
for name in HANDOFF_RUNTIME_FILES:
artifact = dist / name
if artifact.is_file() and artifact.read_bytes() != (CORE_ROOT / "python" / name).read_bytes():
errors.append(f"handoff runtime differs from shared source: dist/{name}")
for pattern in ("*.js", "*.mjs", "*.cjs", "*.d.ts"):
for artifact in dist.rglob(pattern) if dist.is_dir() else ():
if MONOREPO_IMPORT.search(artifact.read_text(encoding="utf-8")):