markitect-main/markitect/prompts/resolver/__init__.py

32 lines
830 B
Python
Raw Normal View History

feat(prompts): implement Phase 3 - Resolver Engine (FR-3) Implement deterministic multi-space resolution with configurable search order. Core Features: - ResolutionContext and ResolutionResult for tracking resolution state - MultiSpaceResolutionStrategy implementing FR-3.1 search order: 1. Local InformationSpace 2. Explicitly included InformationSpaces 3. Default InformationSpace 4. Team/Shared InformationSpace - PromptResolver with macro resolution logic - ContextCompiler for assembling resolved prompts - ResolutionConfig for configurable resolution behavior Resolution Behavior: - Required macros fail if not found (FR-3.2) - Optional macros resolve to empty (FR-3.3) - Generate macros detected for deferred execution (FR-3.4) - Deterministic search order with duplicate removal - Partial compilation support for debugging Tests (31 passing): - 14 strategy tests (search order, duplicates, priority) - 9 resolver tests (required, optional, generate, multi-space) - 8 compiler tests (substitution, dependencies, digests) Implements: - FR-3.1: Deterministic resolution order - FR-3.2: Required macro validation - FR-3.3: Optional macro fallback - FR-3.4: Generate macro detection - FR-3.5: Max generation depth configuration Files Created: - markitect/prompts/resolver/models.py - markitect/prompts/resolver/strategy.py - markitect/prompts/resolver/resolver.py - markitect/prompts/resolver/compiler.py - migrations/prompts/002_create_resolution_config.sql - tests/unit/prompts/test_resolution_strategy.py - tests/unit/prompts/test_prompt_resolver.py - tests/unit/prompts/test_context_compiler.py Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 22:45:46 +01:00
"""
Resolution engine for Prompt Dependency Resolution.
This package provides the core resolution logic for resolving ContentMacros
across multiple InformationSpaces with deterministic search order.
"""
from markitect.prompts.resolver.models import (
ResolutionContext,
ResolutionResult,
ResolutionError,
ResolvedMacro,
)
from markitect.prompts.resolver.strategy import (
ResolutionStrategy,
MultiSpaceResolutionStrategy,
)
from markitect.prompts.resolver.resolver import PromptResolver
from markitect.prompts.resolver.compiler import ContextCompiler, CompiledPrompt
__all__ = [
"ResolutionContext",
"ResolutionResult",
"ResolutionError",
"ResolvedMacro",
"ResolutionStrategy",
"MultiSpaceResolutionStrategy",
"PromptResolver",
"ContextCompiler",
"CompiledPrompt",
]