feat: agent加propose_skill自省handler(提skill化建议写提议表)

This commit is contained in:
ymq 2026-08-16 19:16:53 +08:00
parent f4b3994a52
commit 3f9ae7a08f

View File

@ -686,6 +686,7 @@ class AgentExecutor:
"load_skill": self._t_load_skill,
"list_packs": self._t_list_packs,
"install_pack": self._t_install_pack,
"propose_skill": self._t_propose_skill,
"write_file": self._t_write_file,
"list_files": self._t_list_files,
"search_files": self._t_search_files,
@ -901,6 +902,29 @@ class AgentExecutor:
except Exception as e:
return f"ERROR: {str(e)[:300]}"
async def _t_propose_skill(self, sor, p, pid):
name = (p.get("name") or "").strip()
description = (p.get("description") or "").strip()
content = (p.get("content") or "").strip()
if not name or not content:
return "FAIL: 需要技能名和内容content 为 SKILL.md 草稿正文)"
try:
from appPublic.uniqueID import getID
await sor.C("skill_proposals", {
"id": getID(),
"name": name,
"description": description,
"content": content,
"source": "agent",
"status": "pending",
"org_id": self.org_id or "",
"pipeline_id": self.pipeline_id or "",
"created_by": self.user_id or "",
})
return f"OK: 已提交技能提议 '{name}'(待审核,暂不生效)"
except Exception as e:
return f"ERROR: {str(e)[:300]}"
async def _t_write_file(self, sor, p, pid):
path = p.get("path", "")
content = p.get("content", "")