From 579802fbe69f70b090774682773d0eca75d40f26 Mon Sep 17 00:00:00 2001 From: cfdaily Date: Sat, 30 May 2026 10:50:09 +0800 Subject: [PATCH] auto-sync: 2026-05-30 10:50:09 --- src/daemon/spawner.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/daemon/spawner.py b/src/daemon/spawner.py index bcd1530..3c077a5 100644 --- a/src/daemon/spawner.py +++ b/src/daemon/spawner.py @@ -349,6 +349,33 @@ curl -X POST http://{self.api_host}:{self.api_port}/api/projects/{project_id}/ta api_port=self.api_port, ) + def _inject_agent_identity(self, agent_id: str) -> str: + """#03: 注入 Agent 身份+专长""" + caps = "通用" + router = getattr(self, '_router_ref', None) + if router: + profile = router.agent_profiles.get(agent_id) + if profile and getattr(profile, 'capabilities_zh', None): + caps = ", ".join(profile.capabilities_zh) + return f"你是 {agent_id},专长: {caps}。" + + def _get_guardrails_summary(self) -> str: + """#03: 从 GuardrailEngine 提取红线摘要""" + if not self.guardrails: + return "无特殊限制" + try: + return "、".join(r.get("name", r.get("rule_id", "")) for r in self.guardrails.rules[:6]) + except Exception: + return "无特殊限制" + + def _get_agent_profile(self, agent_id: str): + """获取 Agent 能力画像""" + router = getattr(self, '_router_ref', None) + if router: + return router.agent_profiles.get(agent_id) + return None + + def _build_mail_prompt(self, task_id: str, title: str, description: str, must_haves: str, agent_id: str) -> str: """构建 Mail 专用精简模板"""