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:
46
lib/interns-mcp/interns_mcp/interns/bulk_text_read.py
Normal file
46
lib/interns-mcp/interns_mcp/interns/bulk_text_read.py
Normal file
@@ -0,0 +1,46 @@
|
||||
"""Bulk text read intern — read N files and answer a focused question."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from .base import BlockedByPolicy, Intern, InternResponse
|
||||
|
||||
|
||||
class BulkTextRead(Intern):
|
||||
id = "bulk_text_read"
|
||||
description = "Read N files and answer a focused question. Returns concise summary."
|
||||
|
||||
def run(self, paths: list[str], question: str, **kwargs: Any) -> InternResponse | BlockedByPolicy:
|
||||
contents: list[str] = []
|
||||
for p in paths:
|
||||
text = Path(p).read_text(encoding="utf-8", errors="replace")
|
||||
contents.append(f"--- {p} ---\n{text}")
|
||||
|
||||
combined = "\n\n".join(contents)
|
||||
prompt = f"Files:\n{combined}\n\nQuestion: {question}"
|
||||
|
||||
if self.client is None:
|
||||
return InternResponse(text="No client configured", usage={})
|
||||
|
||||
extra_body = kwargs.get("extra_body", {})
|
||||
resp = self.client.chat.completions.create(
|
||||
model=self.model or "deepseek-v4-flash",
|
||||
messages=[
|
||||
{"role": "system", "content": self.system_prompt},
|
||||
{"role": "user", "content": prompt},
|
||||
],
|
||||
max_tokens=kwargs.get("max_tokens", self.max_tokens),
|
||||
temperature=self.temperature,
|
||||
extra_body=extra_body if extra_body else None,
|
||||
)
|
||||
|
||||
choice = resp.choices[0]
|
||||
return InternResponse(
|
||||
text=choice.message.content or "",
|
||||
usage={
|
||||
"tokens_in": resp.usage.prompt_tokens if resp.usage else 0,
|
||||
"tokens_out": resp.usage.completion_tokens if resp.usage else 0,
|
||||
},
|
||||
)
|
||||
Reference in New Issue
Block a user