"""Base intern protocol and response types.""" from __future__ import annotations from dataclasses import dataclass, field from typing import Any @dataclass class InternResponse: text: str usage: dict[str, Any] = field(default_factory=dict) @dataclass class BlockedByPolicy: path: str pattern: str reason: str @dataclass class BudgetExceededError: tokens: int limit: int top_files: list[str] = field(default_factory=list) hint: str = "use compress=True or narrow paths" class Intern: id: str = "" description: str = "" endpoint: str | None = None model: str | None = None max_tokens: int = 4096 temperature: float = 0.2 system_prompt: str = "" context_budget: int = 120000 def __init__(self, config: dict[str, Any] | None = None, client: Any = None, safety: Any = None): self.client = client self.safety = safety if config: self._apply_config(config) def _apply_config(self, config: dict[str, Any]) -> None: for k, v in config.items(): if hasattr(self, k): setattr(self, k, v) def run(self, paths: list[str], question: str, **kwargs: Any) -> InternResponse | BlockedByPolicy | BudgetExceededError: raise NotImplementedError