feat(outlook): 添加Outlook集成功能支持
添加完整的Outlook MCP集成,包括邮件和日历功能,通过AuthZ模式进行认证和权限管理, 支持邮箱连接、断开、状态检查和数据同步等功能。 fix(config): 统一配置文件路径从.nanobot到.beaver 将配置文件路径从/root/.nanobot统一更改为/root/.beaver,更新Dockerfile中的环境变量定义, 确保所有组件使用一致的配置目录结构。 feat(agent): 添加代理删除功能和助手身份提示 为代理注册表添加delete_agent方法,实现代理的动态删除功能;同时添加海狸助手身份提示, 确保AI助手在交互中保持一致的身份认知。 feat(engine): 增强引擎循环并添加意图决策快照 扩展AgentLoop类,添加intent_agent_decision参数用于意图驱动的代理决策,并在会话中记录 决策快照,便于后续分析和调试。 feat(authz): 扩展认证客户端功能 为AuthzClient添加设置权限、用户注册、后端注册和Outlook设置管理等新方法,增强系统 的认证和授权能力。
This commit is contained in:
@ -0,0 +1,59 @@
|
||||
---
|
||||
name: intent-agent-router
|
||||
description: Internal routing guidance for the first-layer Intent Agent.
|
||||
internal: true
|
||||
---
|
||||
# Intent Agent Router
|
||||
|
||||
## Role
|
||||
|
||||
You are the first-layer Intent Agent. You are not the main assistant and you do not execute the user request.
|
||||
|
||||
Your only job is to classify the current user message into one routing decision:
|
||||
|
||||
- `simple_chat`
|
||||
- `continue_task`
|
||||
- `new_task`
|
||||
- `close_task`
|
||||
- `abandon_task`
|
||||
|
||||
Return compact JSON only. Never answer the user directly.
|
||||
|
||||
## Core Boundary
|
||||
|
||||
Choose `simple_chat` only when the message can be answered safely from ordinary language understanding without tools, external data, local files, user-private data, execution, validation, or multi-step work.
|
||||
|
||||
Choose `new_task` when the user asks for anything that needs the main Task agent's capabilities, including tools, skills, files, web/search, execution, iteration, planning, validation, or multi-agent work.
|
||||
|
||||
The Intent Agent has no tools. If a request needs a tool, do not apologize and do not say you cannot access it. Route it to Task mode so the main agent can use tools.
|
||||
|
||||
## Must Create Task
|
||||
|
||||
Choose `new_task` when there is no active task and the request asks to:
|
||||
|
||||
- look up, search, browse, fetch, verify, check, monitor, compare, or summarize current/external information
|
||||
- answer about today's weather, live conditions, latest news, prices, schedules, exchange rates, regulations, releases, or other changing facts
|
||||
- inspect, read, write, patch, run, test, build, deploy, debug, or modify local files or systems
|
||||
- use email, calendar, messages, databases, MCP tools, shell commands, web APIs, or other integrations
|
||||
- produce a deliverable that needs multiple steps, validation, or follow-up execution
|
||||
|
||||
Examples that must be `new_task`:
|
||||
|
||||
- "帮我查一下今天珠海天气"
|
||||
- "查一下最新的 OpenAI API 价格"
|
||||
- "看看这个项目测试为什么失败"
|
||||
- "帮我改一下登录页面"
|
||||
- "给我查一下明天的航班"
|
||||
|
||||
## Simple Chat
|
||||
|
||||
Choose `simple_chat` only for lightweight conversation or stable knowledge that does not need tools.
|
||||
|
||||
Examples:
|
||||
|
||||
- "你好"
|
||||
- "解释一下什么是递归"
|
||||
- "把这句话润色一下"
|
||||
- "给我一个学习 Python 的大纲"
|
||||
|
||||
If uncertain whether tools may be needed, prefer `new_task`.
|
||||
@ -67,7 +67,12 @@ class SkillsLoader:
|
||||
self.extra_dirs = [Path(item) for item in (extra_dirs or [])]
|
||||
self.skill_store = skill_store or SkillSpecStore(self.workspace)
|
||||
|
||||
def list_skills(self, *, filter_unavailable: bool = True) -> list[SkillRecord]:
|
||||
def list_skills(
|
||||
self,
|
||||
*,
|
||||
filter_unavailable: bool = True,
|
||||
include_internal: bool = False,
|
||||
) -> list[SkillRecord]:
|
||||
"""列出当前可见的 skills。
|
||||
|
||||
优先级:
|
||||
@ -80,9 +85,11 @@ class SkillsLoader:
|
||||
|
||||
found: dict[str, SkillRecord] = {}
|
||||
|
||||
for record in self.list_published_skills():
|
||||
for record in self.list_published_skills(filter_unavailable=filter_unavailable):
|
||||
if record.name in found:
|
||||
continue
|
||||
if not include_internal and self._record_internal(record):
|
||||
continue
|
||||
if filter_unavailable and not self._record_available(record):
|
||||
continue
|
||||
found[record.name] = record
|
||||
@ -101,6 +108,8 @@ class SkillsLoader:
|
||||
if name in found:
|
||||
continue
|
||||
frontmatter, body = parse_frontmatter(skill_file.read_text(encoding="utf-8"))
|
||||
if not include_internal and _truthy(frontmatter.get("internal")):
|
||||
continue
|
||||
normalized_frontmatter = dict(frontmatter)
|
||||
record = SkillRecord(
|
||||
name=name,
|
||||
@ -375,11 +384,15 @@ class SkillsLoader:
|
||||
return []
|
||||
|
||||
def _find_record(self, name: str) -> SkillRecord | None:
|
||||
for record in self.list_skills(filter_unavailable=False):
|
||||
for record in self.list_skills(filter_unavailable=False, include_internal=True):
|
||||
if record.name == name:
|
||||
return record
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def _record_internal(record: SkillRecord) -> bool:
|
||||
return _truthy((record.frontmatter or {}).get("internal"))
|
||||
|
||||
def _record_available(self, record: SkillRecord) -> bool:
|
||||
content = record.path.read_text(encoding="utf-8")
|
||||
frontmatter, _ = parse_frontmatter(content)
|
||||
@ -405,3 +418,9 @@ class SkillsLoader:
|
||||
def summarize_body(body: str) -> str:
|
||||
cleaned = " ".join(line.strip() for line in body.splitlines()[:3] if line.strip()).strip()
|
||||
return cleaned[:240]
|
||||
|
||||
|
||||
def _truthy(value: Any) -> bool:
|
||||
if isinstance(value, bool):
|
||||
return value
|
||||
return str(value or "").strip().lower() in {"1", "true", "yes", "y", "on"}
|
||||
|
||||
@ -181,7 +181,7 @@ class SkillLearningService:
|
||||
if candidate.kind == "new_skill":
|
||||
payload = await self.synthesizer.synthesize_new_skill(candidate, packet, provider, model)
|
||||
return self.draft_service.create_new_skill_draft(
|
||||
skill_name=self._suggest_skill_name(candidate, packet),
|
||||
skill_name=self._suggest_skill_name(candidate, packet, payload.get("frontmatter")),
|
||||
proposed_content=payload["content"],
|
||||
proposed_frontmatter=payload["frontmatter"],
|
||||
created_by="learning-loop",
|
||||
@ -382,15 +382,34 @@ class SkillLearningService:
|
||||
return " ".join(words[:8]).strip()
|
||||
|
||||
@staticmethod
|
||||
def _suggest_skill_name(candidate: SkillLearningCandidate, packet: EvidencePacket) -> str:
|
||||
def _suggest_skill_name(
|
||||
candidate: SkillLearningCandidate,
|
||||
packet: EvidencePacket,
|
||||
frontmatter: dict[str, Any] | None = None,
|
||||
) -> str:
|
||||
if candidate.related_skill_names:
|
||||
return candidate.related_skill_names[0]
|
||||
if packet.task_summaries:
|
||||
seed = re.sub(r"[^a-z0-9]+", "-", packet.task_summaries[0].lower()).strip("-")
|
||||
if isinstance(frontmatter, dict):
|
||||
description = str(frontmatter.get("description") or "")
|
||||
seed = SkillLearningService._slugify_skill_name(description)
|
||||
if seed:
|
||||
return seed[:48]
|
||||
return seed
|
||||
if packet.task_summaries:
|
||||
seed = SkillLearningService._slugify_skill_name(packet.task_summaries[0])
|
||||
if seed:
|
||||
return seed
|
||||
return f"generated-skill-{uuid4().hex[:8]}"
|
||||
|
||||
@staticmethod
|
||||
def _slugify_skill_name(value: str) -> str:
|
||||
seed = re.sub(r"[^a-z0-9]+", "-", value.lower()).strip("-")
|
||||
seed = re.sub(r"-+", "-", seed)
|
||||
if not seed or seed.isdigit() or len(seed) < 3:
|
||||
return ""
|
||||
words = [part for part in seed.split("-") if part and not part.isdigit()]
|
||||
seed = "-".join(words) or seed
|
||||
return seed[:48].strip("-")
|
||||
|
||||
@staticmethod
|
||||
def _parse_timestamp(value: str) -> datetime | None:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user