refactor: opencode

This commit is contained in:
Apunkt 2026-05-12 16:45:15 +02:00
parent 09c5b30f15
commit 91d67b2e12
No known key found for this signature in database
12 changed files with 1843 additions and 77 deletions

View file

@ -222,7 +222,7 @@ def dispatch(store: MemoryStore, method: str, params: dict) -> dict:
# Plan 02 dispatch: non-empty store -> 5-stage pipeline;
# empty store -> baseline cosine recall (Plan 01 fallback).
records_count = store.db.open_table("records").count_rows()
records_count = store.count_rows("records")
if records_count == 0:
cue_embedding = params.get("cue_embedding") or [0.0] * EMBED_DIM
resp = retrieve.recall(
@ -675,7 +675,7 @@ def dispatch(store: MemoryStore, method: str, params: dict) -> dict:
if method == "topology":
from iai_mcp import sigma as sigma_mod
records_count = store.db.open_table("records").count_rows()
records_count = store.count_rows("records")
if records_count == 0:
return {
"N": 0, "C": 0.0, "L": 0.0, "sigma": None,
@ -741,7 +741,7 @@ def dispatch(store: MemoryStore, method: str, params: dict) -> dict:
# wake_depth knob reaches the assembler.
from iai_mcp.session import assemble_session_start, SessionStartPayload
sid = params.get("session_id", "-")
records_count = store.db.open_table("records").count_rows()
records_count = store.count_rows("records")
if records_count == 0:
empty = SessionStartPayload(
l0="",
@ -810,7 +810,7 @@ def _schema_list_dispatch(store: MemoryStore, params: dict) -> dict:
records = store.all_records()
schema_records = [r for r in records if "schema" in (r.tags or [])]
edges_df = store.db.open_table("edges").to_pandas()
edges_df = store.edges_as_dataframe()
if not edges_df.empty:
schema_edges = edges_df[edges_df["edge_type"] == "schema_instance_of"]
else: