docs(cyrene): cmd/cyrene 存量英文注释中文化(22 个非测试文件,仅注释)
- 四组并行完成:main/wire*.go、wire_capacity|channels|runtime、channels|persona_*|emotion|observability、 voice|plugins|stream|skills|vision|subagent_tool|extractor|mcp|sessionread_tool|terminal_tool。 - 机械校验(git diff -U0 去 // 行与空行)仅剩 wire_frontend.go:84 一处行尾注释:代码前缀 「\ta.gw = gw 」经 cat -A 与 HEAD 逐字节比对一致(allow 清单已声明)。 - 验收:隔离 worktree(HEAD + 本批 patch)go build/vet 绿、全树 58 包 ok、 linux/amd64 + darwin/arm64 交叉编译绿;gofmt -l 干净。 - 备注:整树两次红均为负载敏感 flake(backthink / orchestration 的 timeout 类用例单独 -count=20 全过)。
This commit is contained in:
1 parent
5c2189efb0
commit
52f08dc343
22 files changed
+455
-586
No files matched your search
+9
-11
@@ -12,15 +12,14 @@ import (
|
||||
"git.yeij.top/AskaEth/Cyrene_v2/internal/logger"
|
||||
)
|
||||
|
||||
// mcpConnectTimeout bounds each MCP server's connect+discover handshake so a hung
|
||||
// server degrades to a warning instead of blocking startup.
|
||||
// mcpConnectTimeout 约束每个 MCP server 的连接+发现握手,使挂死的 server 降级为
|
||||
// 一条告警,而不是阻塞启动。
|
||||
const mcpConnectTimeout = 15 * time.Second
|
||||
|
||||
// wireMCP reads cfg.MCP.ServersJSON, connects to every enabled server, registers
|
||||
// its discovered tools into the capability registry (KindTool so the agent can
|
||||
// call them), and surfaces a KindMCP capability so the admin plugin list
|
||||
// enumerates the server. A server that fails to connect or is unconfigured
|
||||
// degrades to a warning and never blocks startup.
|
||||
// wireMCP 读取 cfg.MCP.ServersJSON,连接每个已启用的 server,把发现到的工具注册进
|
||||
// 能力注册表(KindTool,使 agent 可调用它们),并暴露一个 KindMCP 能力,让管理面板
|
||||
// 的插件列表能枚举该 server。连接失败或未配置的 server 降级为一条告警,绝不阻塞
|
||||
// 启动。
|
||||
func (a *app) wireMCP() {
|
||||
log := logger.WithSource(a.log, "cmd/cyrene")
|
||||
servers, err := a.mcpServers()
|
||||
@@ -45,7 +44,7 @@ func (a *app) wireMCP() {
|
||||
}
|
||||
}
|
||||
|
||||
// mcpServers parses the configured MCP servers from cfg.MCP.ServersJSON.
|
||||
// mcpServers 从 cfg.MCP.ServersJSON 解析出已配置的 MCP server。
|
||||
func (a *app) mcpServers() ([]config.MCPServer, error) {
|
||||
raw := strings.TrimSpace(a.cfg.MCP.ServersJSON)
|
||||
if raw == "" {
|
||||
@@ -58,9 +57,8 @@ func (a *app) mcpServers() ([]config.MCPServer, error) {
|
||||
return servers, nil
|
||||
}
|
||||
|
||||
// registerMCPServer connects to one server, registers its tools, and publishes a
|
||||
// KindMCP capability under "mcp:<name>". It returns the first error so callers
|
||||
// can classify it; on partial registration it cleans up what it added.
|
||||
// registerMCPServer 连接单个 server,注册其工具,并以 "mcp:<name>" 发布一个
|
||||
// KindMCP 能力。它返回第一个错误以便调用方分类;注册中途失败时会清理已加入的内容。
|
||||
func (a *app) registerMCPServer(ctx context.Context, srv config.MCPServer) error {
|
||||
log := logger.WithSource(a.log, "cmd/cyrene")
|
||||
reg := mcp.NewRegistry(a.caps, mcp.MCPConfig{
|
||||
|
||||
Reference in new issue
Block a user