feat(agents): implement Code Commander module (Phases 1-5)

- Phase 1: Infrastructure (state, prompts, registry)
- Phase 2: Execution engine (AI adapters, security classifier, executors)
- Phase 3: Agent integration (graph nodes, routing)
- Phase 4: Streaming interaction (PTY terminal, WebSocket)
- Phase 5: Frontend integration (Vue components)
This commit is contained in:
2026-04-05 14:56:45 +08:00
parent 11160ec4d2
commit 5667190abe
22 changed files with 2641 additions and 347 deletions

View File

@@ -4,7 +4,14 @@ from typing import Annotated, Any, Literal, TypedDict
from app.agents.schemas.event import AgentEvent
from app.agents.schemas.message import AgentMessage
from app.agents.schemas.task import AgentTask, CollaborationBudget, InterruptRecord, RecoveryRecord, TaskResult, VerificationStatus
from app.agents.schemas.task import (
AgentTask,
CollaborationBudget,
InterruptRecord,
RecoveryRecord,
TaskResult,
VerificationStatus,
)
from langchain_core.messages import AIMessage, BaseMessage, HumanMessage
from langgraph.graph.message import add_messages
@@ -23,6 +30,7 @@ class AgentRole(str, Enum):
EXECUTOR = "executor"
LIBRARIAN = "librarian"
ANALYST = "analyst"
CODE_COMMANDER = "code_commander"
@dataclass
@@ -141,6 +149,14 @@ class AgentState(TypedDict):
user_llm_config: dict[str, Any] | None
provider_capabilities: dict[str, Any] | None
# Code Commander state
code_task_type: Literal["demo", "project", "modification"] | None
code_ai_provider: Literal["claude", "gemini", "codex", "opencode"] | None
code_sandbox_mode: bool | None
code_workspace_path: str | None
code_execution_session_id: str | None
code_execution_result: dict[str, Any] | None
def initial_state(user_id: str, conversation_id: str) -> AgentState:
return AgentState(