1
0
Fork 0

feat(okf): wire adapter into public API — import_bundle carries link graph, package exposes okf namespace (TDD, +2)

This commit is contained in:
Kjell Tore Guttormsen 2026-07-06 09:44:41 +02:00
commit 07e0b2153a
3 changed files with 31 additions and 2 deletions

View file

@ -56,6 +56,7 @@ from .grounding import (
no_grounding_check,
DEFAULT_GROUNDING_CHECK,
)
from . import okf
__version__ = "0.1.0"
@ -142,4 +143,6 @@ __all__ = [
"SourceGroundingCheck", "no_grounding_check", "DEFAULT_GROUNDING_CHECK",
# §6 bookends
"prepare_input", "screen_output", "PreparedInput",
# OKF adapter (v0.2) — the format-specific layer, as its own namespace
"okf",
]

View file

@ -315,10 +315,17 @@ class ConceptResult:
@dataclass(frozen=True)
class BundleResult:
"""Per-concept results plus the bundle's aggregate (most-severe) disposition."""
"""Per-concept results, the aggregate disposition, and the cross-link graph.
``links`` is the in-import :class:`LinkGraphResult` for the whole bundle
(dangling / rejected / resolved edges), so a mode-b import returns both halves
of the gate together. Whether a dangling or rejected link should block is the
caller's disposition call (design principle 4).
"""
concepts: tuple
disposition: Disposition
links: "LinkGraphResult"
def log(self):
"""The ``log.md`` body — one line per concept, rejected ones marked."""
@ -347,7 +354,7 @@ def import_bundle(bundle, *, origin=Origin.EXTERNAL, channel=Channel.AUTOMATIC):
for path in sorted(bundle)
)
aggregate = _most_severe(r.disposition for r in results)
return BundleResult(results, aggregate)
return BundleResult(results, aggregate, link_graph(bundle))
def _validate_concept(path, doc, origin, channel):