feat(lib): bundle MCP servers from .common/lib into factory/lib/
Copies source (no node_modules, dist, .tasks, .wiki, __pycache__) for: - projects-meta-mcp v2.25.0 (TypeScript/Node) - wiki-graph v0.3.1 (TypeScript/Node) - interns-mcp v0.3.3 (Python/FastMCP) .gitignore: exclude lib build artefacts (node_modules, dist, .venv, __pycache__, *.pyc) bootstrap.ps1: add MCP build step — npm install+build for TS servers, venv+pip for Python Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
52
lib/interns-mcp/interns_mcp/interns/base.py
Normal file
52
lib/interns-mcp/interns_mcp/interns/base.py
Normal file
@@ -0,0 +1,52 @@
|
||||
"""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
|
||||
Reference in New Issue
Block a user