Enhance MCP development features and introduce skills management
- Added configuration options for requiring human approval before applying LLM-generated MCP patches. - Updated Docker setup to include skills directory. - Integrated skills management into the backend, allowing for procedural guides and skill matching. - Refactored database initialization to apply Alembic migrations. - Enhanced task approval process to handle MCP patch applications with optional approval. - Introduced new schemas for skills and updated existing APIs to support skills functionality. This commit lays the groundwork for improved agent capabilities and better management of MCP development processes.
This commit is contained in:
@@ -80,6 +80,10 @@ async def process_mcp_command(cmd: dict) -> dict:
|
||||
if not server:
|
||||
raise ValueError("server name required")
|
||||
return await _execute_develop_command(cmd, manager)
|
||||
elif action == "apply_patch":
|
||||
if not server:
|
||||
raise ValueError("server name required")
|
||||
return await _execute_apply_patch_command(cmd, manager)
|
||||
else:
|
||||
raise ValueError(f"Unknown action: {action}")
|
||||
return {"ok": True, "action": action, "server": server}
|
||||
@@ -139,6 +143,7 @@ async def _finalize_develop_task(task_id: int, result: dict, server: str) -> Non
|
||||
"tools": result.get("tools"),
|
||||
"push": result.get("push"),
|
||||
"resolved": not has_pending,
|
||||
"pending_approval": result.get("pending_approval"),
|
||||
}
|
||||
task.error = None
|
||||
task.status = TaskStatus.waiting_approval if has_pending else TaskStatus.succeeded
|
||||
@@ -149,7 +154,9 @@ async def _finalize_develop_task(task_id: int, result: dict, server: str) -> Non
|
||||
|
||||
if result.get("ok"):
|
||||
msg = result.get("summary") or f"MCP develop finished for {server}"
|
||||
if has_pending:
|
||||
if result.get("pending_approval"):
|
||||
msg += " — approve MCP patch on this task."
|
||||
elif has_pending:
|
||||
msg += " — approve git push on this task."
|
||||
await publish_event(task_id, "report", msg, {"kind": "mcp_develop", **result}, persist=True)
|
||||
else:
|
||||
@@ -180,7 +187,7 @@ async def _develop_on_worker(cmd: dict, manager) -> dict:
|
||||
task_id=task_id,
|
||||
server=server,
|
||||
tool=cmd.get("tool") or "unknown",
|
||||
args={},
|
||||
args=cmd.get("args") or {},
|
||||
issue=cmd.get("issue") or "",
|
||||
error=cmd.get("error"),
|
||||
output=cmd.get("output"),
|
||||
@@ -189,3 +196,22 @@ async def _develop_on_worker(cmd: dict, manager) -> dict:
|
||||
task_title=cmd.get("title") or f"MCP develop: {server}",
|
||||
push=cmd.get("push"),
|
||||
)
|
||||
|
||||
|
||||
async def _execute_apply_patch_command(cmd: dict, manager) -> dict:
|
||||
from app.services.events import publish_event
|
||||
from app.services.mcp_approvals import execute_approved_patch
|
||||
|
||||
task_id = int(cmd.get("task_id") or 0)
|
||||
tool_args = cmd.get("tool_args") or {}
|
||||
|
||||
async def emit(tid: int, kind: str, message: str, payload: dict | None = None):
|
||||
if tid:
|
||||
await publish_event(tid, kind, message, payload)
|
||||
|
||||
return await execute_approved_patch(
|
||||
task_id=task_id,
|
||||
tool_args=tool_args,
|
||||
manager=manager,
|
||||
emit=emit,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user