fix: align engine task bootstrap scaffold
This commit is contained in:
parent
726e512603
commit
0c0c0d980f
@ -1,27 +1 @@
|
||||
from .models import (
|
||||
ArtifactsConfig,
|
||||
BudgetConfig,
|
||||
ConstraintConfig,
|
||||
LoggingConfig,
|
||||
MutationConfig,
|
||||
ObjectiveConfig,
|
||||
PolicyConfig,
|
||||
RunnerConfig,
|
||||
ScorerConfig,
|
||||
ScorerParseConfig,
|
||||
TaskConfig,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"ArtifactsConfig",
|
||||
"BudgetConfig",
|
||||
"ConstraintConfig",
|
||||
"LoggingConfig",
|
||||
"MutationConfig",
|
||||
"ObjectiveConfig",
|
||||
"PolicyConfig",
|
||||
"RunnerConfig",
|
||||
"ScorerConfig",
|
||||
"ScorerParseConfig",
|
||||
"TaskConfig",
|
||||
]
|
||||
"""Artifact Loop Engine package."""
|
||||
|
||||
@ -1,84 +1,115 @@
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Literal
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ArtifactsConfig:
|
||||
class ArtifactSpec:
|
||||
include: list[str] = field(default_factory=list)
|
||||
exclude: list[str] = field(default_factory=list)
|
||||
max_files_per_iteration: int = 0
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class MutationConfig:
|
||||
class MutationSpec:
|
||||
mode: str = ""
|
||||
allowed_file_types: list[str] = field(default_factory=list)
|
||||
max_changed_lines: int = 0
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RunnerConfig:
|
||||
class RunnerSpec:
|
||||
command: str = ""
|
||||
cwd: str = "."
|
||||
cwd: Path = Path(".")
|
||||
timeout_seconds: int = 0
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ScorerParseConfig:
|
||||
class ScorerParseSpec:
|
||||
format: str = ""
|
||||
score_field: str = ""
|
||||
metrics_field: str = ""
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ScorerConfig:
|
||||
class ScorerSpec:
|
||||
type: str = ""
|
||||
command: str = ""
|
||||
parse: ScorerParseConfig = field(default_factory=ScorerParseConfig)
|
||||
parse: ScorerParseSpec = field(default_factory=ScorerParseSpec)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ObjectiveConfig:
|
||||
class ObjectiveSpec:
|
||||
primary_metric: str = ""
|
||||
direction: Literal["maximize", "minimize"] = "maximize"
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ConstraintConfig:
|
||||
class ConstraintSpec:
|
||||
metric: str = ""
|
||||
op: str = ""
|
||||
value: int | float = 0
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class PolicyConfig:
|
||||
class PolicySpec:
|
||||
keep_if: str = ""
|
||||
tie_breakers: list[str] = field(default_factory=list)
|
||||
on_failure: str = ""
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class BudgetConfig:
|
||||
class BudgetSpec:
|
||||
max_iterations: int = 0
|
||||
max_failures: int = 0
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class LoggingConfig:
|
||||
results_file: str = ""
|
||||
candidate_dir: str = ""
|
||||
class LoggingSpec:
|
||||
results_file: Path = Path()
|
||||
candidate_dir: Path = Path()
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class TaskConfig:
|
||||
class TaskSpec:
|
||||
id: str = ""
|
||||
description: str = ""
|
||||
artifacts: ArtifactsConfig = field(default_factory=ArtifactsConfig)
|
||||
mutation: MutationConfig = field(default_factory=MutationConfig)
|
||||
runner: RunnerConfig = field(default_factory=RunnerConfig)
|
||||
scorer: ScorerConfig = field(default_factory=ScorerConfig)
|
||||
objective: ObjectiveConfig = field(default_factory=ObjectiveConfig)
|
||||
constraints: list[ConstraintConfig] = field(default_factory=list)
|
||||
policy: PolicyConfig = field(default_factory=PolicyConfig)
|
||||
budget: BudgetConfig = field(default_factory=BudgetConfig)
|
||||
logging: LoggingConfig = field(default_factory=LoggingConfig)
|
||||
root_dir: Path = Path(".")
|
||||
artifacts: ArtifactSpec = field(default_factory=ArtifactSpec)
|
||||
mutation: MutationSpec = field(default_factory=MutationSpec)
|
||||
runner: RunnerSpec = field(default_factory=RunnerSpec)
|
||||
scorer: ScorerSpec = field(default_factory=ScorerSpec)
|
||||
objective: ObjectiveSpec = field(default_factory=ObjectiveSpec)
|
||||
constraints: list[ConstraintSpec] = field(default_factory=list)
|
||||
policy: PolicySpec = field(default_factory=PolicySpec)
|
||||
budget: BudgetSpec = field(default_factory=BudgetSpec)
|
||||
logging: LoggingSpec = field(default_factory=LoggingSpec)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class BaselineSnapshot:
|
||||
root_dir: Path = Path(".")
|
||||
files: dict[str, str] = field(default_factory=dict)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ScoreResult:
|
||||
score: float = 0.0
|
||||
metrics: dict[str, float | int] = field(default_factory=dict)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class DecisionResult:
|
||||
keep: bool = False
|
||||
reason: str = ""
|
||||
primary_metric: str = ""
|
||||
primary_value: float = 0.0
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class RunResult:
|
||||
task_id: str = ""
|
||||
iteration: int = 0
|
||||
score: ScoreResult = field(default_factory=ScoreResult)
|
||||
decision: DecisionResult = field(default_factory=DecisionResult)
|
||||
baseline: BaselineSnapshot = field(default_factory=BaselineSnapshot)
|
||||
|
||||
@ -1 +1 @@
|
||||
|
||||
"""Unit tests for the artifact loop engine."""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user