mirror of
https://github.com/val1813/kwcode.git
synced 2026-09-03 06:34:30 +08:00
Architecture upgrade to improve task completion for any model size: - SearchSubagent: independent context window, parallel file reads, clean results only - UpstreamManifest: deterministic AST extraction of signatures/constants, zero LLM - PENCIL-style compression: subtask results compacted to structured artifacts - Verifier pre-check: cross-file contract consistency before running tests - Generator context slimmed: upstream_constraints + retry_hint injection Code quality: - orchestrator.py run() split into 5 private methods (410->253 lines) - Full type annotations (Optional[DebugSubagent], Callable types) - __all__ added to 7 core modules - pyproject.toml: license fixed, ruff + mypy configured - TUI: 30+ event icons, Server: /api/manifest endpoint - STATUS.md rewritten: concise, English, professional format 451/451 tests green, 27 new tests for SearchSubagent+Manifest. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
71 lines
1.8 KiB
Python
71 lines
1.8 KiB
Python
"""
|
|
Pydantic models for kwcode server API.
|
|
"""
|
|
|
|
from typing import Optional
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class TaskRequest(BaseModel):
|
|
"""Request to submit a task."""
|
|
input: str = Field(..., description="Task description")
|
|
project_root: str = Field(".", description="Project root directory")
|
|
no_search: bool = Field(False, description="Disable search augmentation")
|
|
image_paths: list[str] = Field(default_factory=list, description="Image paths for vision tasks")
|
|
|
|
|
|
class TaskResponse(BaseModel):
|
|
"""Response after submitting a task."""
|
|
task_id: str
|
|
status: str = "accepted"
|
|
|
|
|
|
class TaskResult(BaseModel):
|
|
"""Final result of a completed task."""
|
|
task_id: str
|
|
success: bool
|
|
error: Optional[str] = None
|
|
elapsed: float = 0.0
|
|
files_modified: list[str] = Field(default_factory=list)
|
|
summary: str = ""
|
|
|
|
|
|
class HealthResponse(BaseModel):
|
|
"""Health check response."""
|
|
status: str = "ok"
|
|
version: str = "1.5.0"
|
|
model: str = ""
|
|
project_root: str = ""
|
|
|
|
|
|
class StatusResponse(BaseModel):
|
|
"""Server status response."""
|
|
model: str = ""
|
|
project_root: str = ""
|
|
experts_loaded: int = 0
|
|
search_enabled: bool = False
|
|
uptime_seconds: float = 0.0
|
|
|
|
|
|
class FileTreeItem(BaseModel):
|
|
"""A file or directory in the file tree."""
|
|
name: str
|
|
path: str
|
|
is_dir: bool = False
|
|
children: list["FileTreeItem"] = Field(default_factory=list)
|
|
|
|
|
|
class FileContent(BaseModel):
|
|
"""File content response."""
|
|
path: str
|
|
content: str
|
|
language: str = ""
|
|
lines: int = 0
|
|
|
|
|
|
class ManifestResponse(BaseModel):
|
|
"""UpstreamManifest state response."""
|
|
signatures: dict[str, dict[str, str]] = Field(default_factory=dict)
|
|
constants: dict[str, dict[str, str]] = Field(default_factory=dict)
|
|
file_count: int = 0
|