infospace pipeline for wealth of nations example

This commit is contained in:
2026-05-14 18:04:38 +02:00
parent 8804461ca3
commit a729a7643e
26 changed files with 1124 additions and 32 deletions

View File

@@ -9,6 +9,7 @@ from pathlib import Path
from .checks import run_collection_checks
from .engine import engine_capability_contract, plan_asset_sync, sync_assets
from .errors import InfospaceError
from .evaluation_io import read_entity_evaluations
from .history import (
build_viability_report,
find_snapshot,
@@ -21,7 +22,12 @@ from .inspection import export_mermaid, relationship_summary
from .lifecycle import add_artifact, create_infospace, load_infospace
from .markdown_adapter import validate_infospace_artifacts
from .semantics import list_entities, list_relations
from .workflow import load_workflows, plan_workflow, run_workflow
from .workflow import (
FixtureAssistedGenerationAdapter,
load_workflows,
plan_workflow,
run_workflow,
)
def build_parser() -> argparse.ArgumentParser:
@@ -111,6 +117,11 @@ def build_parser() -> argparse.ArgumentParser:
)
workflow_run.add_argument("root")
workflow_run.add_argument("workflow_id")
workflow_run.add_argument(
"--fixture-responses",
default="",
help="Run assisted stages with deterministic fixture responses",
)
engine = sub.add_parser("engine", help="Inspect and sync engine boundary state")
engine_sub = engine.add_subparsers(dest="engine_command", required=True)
@@ -222,7 +233,11 @@ def main(argv: list[str] | None = None) -> int:
elif args.command == "check":
infospace = load_infospace(Path(args.root))
report = run_collection_checks(infospace.artifacts)
result = record_check_results(infospace.root, report)
result = record_check_results(
infospace.root,
report,
artifact_evaluations=_read_output_evaluations(infospace.root),
)
_write_json(
{
**result.to_dict(),
@@ -253,8 +268,19 @@ def main(argv: list[str] | None = None) -> int:
plan_workflow(Path(args.root), args.workflow_id).to_dict()
)
elif args.workflow_command == "run":
adapter = (
FixtureAssistedGenerationAdapter.from_file(
Path(args.fixture_responses)
)
if args.fixture_responses
else None
)
_write_json(
run_workflow(Path(args.root), args.workflow_id).to_dict()
run_workflow(
Path(args.root),
args.workflow_id,
assisted_adapter=adapter,
).to_dict()
)
else:
parser.error(f"Unhandled workflow command: {args.workflow_command}")
@@ -328,9 +354,14 @@ def _record_checks(root: Path):
return record_check_results(
infospace.root,
run_collection_checks(infospace.artifacts),
artifact_evaluations=_read_output_evaluations(infospace.root),
)
def _read_output_evaluations(root: Path):
return read_entity_evaluations(root / "output" / "evaluations")
def _relationship_summary_payload(summary) -> dict:
return {
"node_count": summary.node_count,