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

@@ -29,6 +29,7 @@ TOP_LEVEL_AGENT_DEFAULT_SUB_COMMANDERS: dict[str, tuple[str, ...]] = {
"analyst_progress",
"analyst_insights",
),
AgentRole.CODE_COMMANDER.value: (),
}
TOP_LEVEL_AGENT_DISPLAY_NAMES: dict[str, str] = {
@@ -37,6 +38,7 @@ TOP_LEVEL_AGENT_DISPLAY_NAMES: dict[str, str] = {
AgentRole.EXECUTOR.value: "Executor",
AgentRole.LIBRARIAN.value: "Librarian",
AgentRole.ANALYST.value: "Analyst",
AgentRole.CODE_COMMANDER.value: "Code Commander",
}
TOP_LEVEL_AGENT_ROUTING_HINTS: dict[str, tuple[str, ...]] = {
@@ -55,6 +57,9 @@ TOP_LEVEL_AGENT_ROUTING_HINTS: dict[str, tuple[str, ...]] = {
AgentRole.ANALYST.value: (
"Handle reporting and insight requests using analyst sub-commanders.",
),
AgentRole.CODE_COMMANDER.value: (
"Handle code writing and execution tasks using AI CLI adapters.",
),
}
TOP_LEVEL_AGENT_ALLOWED_SPAWN_ROLES: dict[str, tuple[str, ...]] = {
@@ -63,11 +68,13 @@ TOP_LEVEL_AGENT_ALLOWED_SPAWN_ROLES: dict[str, tuple[str, ...]] = {
AgentRole.EXECUTOR.value,
AgentRole.LIBRARIAN.value,
AgentRole.ANALYST.value,
AgentRole.CODE_COMMANDER.value,
),
AgentRole.SCHEDULE_PLANNER.value: (AgentRole.SCHEDULE_PLANNER.value,),
AgentRole.EXECUTOR.value: (AgentRole.EXECUTOR.value,),
AgentRole.LIBRARIAN.value: (AgentRole.LIBRARIAN.value,),
AgentRole.ANALYST.value: (AgentRole.ANALYST.value,),
AgentRole.CODE_COMMANDER.value: (),
}
SUB_COMMANDER_PARENT_AGENT_IDS: dict[str, str] = {
@@ -99,11 +106,7 @@ BUILTIN_AGENT_MANIFESTS: tuple[AgentManifest, ...] = tuple(
_capability_tool_names = tuple(
dict.fromkeys(
tool.name
for tools in SUB_COMMANDER_TOOLSETS.values()
for tool in tools
)
dict.fromkeys(tool.name for tools in SUB_COMMANDER_TOOLSETS.values() for tool in tools)
)
_CAPABILITY_METADATA_BY_TOOL_NAME: dict[str, dict[str, object]] = {
@@ -260,9 +263,7 @@ BUILTIN_SUB_COMMANDER_MANIFESTS: tuple[SubCommanderManifest, ...] = tuple(
sub_commander_id=sub_commander_id,
parent_agent_id=SUB_COMMANDER_PARENT_AGENT_IDS[sub_commander_id],
prompt_text=SUB_COMMANDER_PROMPTS_BY_KEY[sub_commander_id],
capability_ids=list(
dict.fromkeys(tool.name for tool in tools)
),
capability_ids=list(dict.fromkeys(tool.name for tool in tools)),
)
for sub_commander_id, tools in SUB_COMMANDER_TOOLSETS.items()
)