- src: phase_z2 composition/mapper/pipeline/placement_planner/retry, ai_fallback(prompts/schema/validate), mdx_text_atoms 신규 - Front: PipelineTracePanel 신규, FramePanel/SlideCanvas/Home/designAgentApi 등 갱신 + 테스트 4종 추가 - templates/phase_z2: catalog(component_expansion_registry, node_slot_mapping 신규), frames, families, slide_base 갱신 - tests/matching: phase2~26 매칭 실험 스크립트·리포트·온톨로지 전체 (미커밋 진행분) - tests: b4_v4 evidence, task5~28.5 시리즈, regression(imp95 baseline) 등 신규 테스트 대량 추가 - docs/reference: MDX 구조 인벤토리, MDX→Frame 구조 계약 문서 - scripts: mdx 계약/parity/coverage/viewport 체크, gitea comment, run sync 유틸 - .gitignore: tmp*.json, chromedriver, .orchestrator, *.pkl, Front_test* 등 임시/스냅샷 제외 미완성 작업의 보존용 스냅샷 커밋 (2026-07-02) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
53 lines
1.8 KiB
Python
53 lines
1.8 KiB
Python
"""IMP-33 u2 — AI fallback proposal schema.
|
|
|
|
Whitelisted proposal kinds (Stage 2 plan):
|
|
- builder_options_patch : zone/frame builder option overrides
|
|
- partial_overrides : Internal Region / Frame Slot content overrides
|
|
- slot_mapping_proposal : restructuring proposal (content unit mapping)
|
|
- design_adaptation_plan : structure-only plan; code applies verbatim MDX
|
|
|
|
Forbidden output forms (rejected by validator):
|
|
- mdx_text (MDX read-only — `feedback_ai_isolation_contract`)
|
|
- frame_id_change (V4 rank-1 protected — `feedback_phase_z_spacing_direction`)
|
|
- raw_html (HTML structure is code-decided, not AI-generated)
|
|
- raw_css (same)
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from enum import Enum
|
|
from typing import Any
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
|
|
|
|
|
class ProposalKind(str, Enum):
|
|
BUILDER_OPTIONS_PATCH = "builder_options_patch"
|
|
PARTIAL_OVERRIDES = "partial_overrides"
|
|
SLOT_MAPPING_PROPOSAL = "slot_mapping_proposal"
|
|
DESIGN_ADAPTATION_PLAN = "design_adaptation_plan"
|
|
|
|
|
|
FORBIDDEN_KINDS: frozenset[str] = frozenset(
|
|
{"mdx_text", "frame_id_change", "raw_html", "raw_css"}
|
|
)
|
|
|
|
|
|
class AiFallbackProposal(BaseModel):
|
|
"""Single AI fallback proposal (output contract for u4 client)."""
|
|
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
proposal_kind: ProposalKind
|
|
payload: dict[str, Any] = Field(default_factory=dict)
|
|
rationale: str = ""
|
|
|
|
@field_validator("proposal_kind", mode="before")
|
|
@classmethod
|
|
def _reject_forbidden_kind(cls, value: Any) -> Any:
|
|
if isinstance(value, str) and value in FORBIDDEN_KINDS:
|
|
raise ValueError(
|
|
f"proposal_kind={value!r} is forbidden (MDX/frame/raw HTML/CSS "
|
|
"mutations are not permitted under IMP-33)."
|
|
)
|
|
return value
|