init
This commit is contained in:
+63
@@ -0,0 +1,63 @@
|
||||
"""Load model-facing capability context from domain-owned catalogs."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
class CapabilityRegistry:
|
||||
"""Expose domain catalogs without embedding domain semantics in prompts or code."""
|
||||
|
||||
def __init__(self, repository_root: Path, executable_domains: set[str]) -> None:
|
||||
self.root = repository_root
|
||||
self.executable_domains = set(executable_domains)
|
||||
self._snapshot = self._load()
|
||||
|
||||
def snapshot(self) -> dict[str, Any]:
|
||||
return self._snapshot
|
||||
|
||||
def _load(self) -> dict[str, Any]:
|
||||
domains = []
|
||||
for catalog_path in sorted(
|
||||
(self.root / "domains").glob("*/config/capabilities.yaml")
|
||||
):
|
||||
if catalog_path.parts[-3] == "_template":
|
||||
continue
|
||||
catalog = yaml.safe_load(catalog_path.read_text(encoding="utf-8"))
|
||||
domain = catalog["spec"]["domain"]
|
||||
domains.append(
|
||||
{
|
||||
"domain": domain,
|
||||
"availability": (
|
||||
"executable" if domain in self.executable_domains else "catalog_only"
|
||||
),
|
||||
"capabilities": catalog["spec"]["capabilities"],
|
||||
}
|
||||
)
|
||||
return {
|
||||
"interaction_context": {
|
||||
"surface": "driver_console",
|
||||
"speaker_default_scope": "driver",
|
||||
},
|
||||
"execution_policy": {
|
||||
"executable_domains": sorted(self.executable_domains),
|
||||
"catalog_only_behavior": "return_as_deferred_request",
|
||||
"planning_environment": "dry_run_candidate_synthesis",
|
||||
"named_preset_required": False,
|
||||
"fuzzy_goal_behavior": (
|
||||
"decompose a commonly understood user goal into executable atomic "
|
||||
"capabilities and infer conservative absolute targets"
|
||||
),
|
||||
"capability_selection": (
|
||||
"prefer_executable_when_equally_suitable; never replace a clearly better "
|
||||
"capability solely because it is executable"
|
||||
),
|
||||
"executable_request_parameters": (
|
||||
"resolve relative intent against runtime state and return absolute target values"
|
||||
),
|
||||
},
|
||||
"domains": domains,
|
||||
}
|
||||
Reference in New Issue
Block a user