ACP / MCP

This commit is contained in:
2026-06-12 11:44:19 +08:00
parent 2a9661a6ef
commit 4ea4adfd8e
47 changed files with 2558 additions and 240 deletions
+31 -3
View File
@@ -18,9 +18,12 @@ type AgentKindAdminDTO struct {
EnvKeys []string `json:"env_keys"`
Enabled bool `json:"enabled"`
ToolAllowlist []string `json:"tool_allowlist"`
CreatedBy uuid.UUID `json:"created_by"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
ClientType string `json:"client_type"`
// MCPServers 明文返回(admin only,编辑所需);条目可能含 header/env 密钥。
MCPServers []McpServerSpec `json:"mcp_servers"`
CreatedBy uuid.UUID `json:"created_by"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
// AgentKindPublicDTO 是普通用户视图,不暴露 binary_path / args / env_keys。
@@ -41,6 +44,8 @@ type CreateAgentKindReq struct {
Env map[string]string `json:"env"`
Enabled *bool `json:"enabled"`
ToolAllowlist []string `json:"tool_allowlist"`
ClientType string `json:"client_type"`
MCPServers []McpServerSpec `json:"mcp_servers"`
}
type UpdateAgentKindReq struct {
@@ -51,6 +56,29 @@ type UpdateAgentKindReq struct {
Env map[string]string `json:"env,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
ToolAllowlist []string `json:"tool_allowlist,omitempty"`
ClientType *string `json:"client_type,omitempty"`
MCPServers []McpServerSpec `json:"mcp_servers,omitempty"` // nil = 不改;非 nil(含空)= 替换
}
// ConfigFileDTO 是 AgentKind 配置文件的对外视图(admin only,content 明文)。
type ConfigFileDTO struct {
RelPath string `json:"rel_path"`
Content string `json:"content"`
UpdatedAt string `json:"updated_at"`
}
// UpsertConfigFileReq 是 PUT config-files 请求体。
type UpsertConfigFileReq struct {
RelPath string `json:"rel_path"`
Content string `json:"content"`
}
func configFileToDTO(f *ConfigFileContent) ConfigFileDTO {
return ConfigFileDTO{
RelPath: f.RelPath,
Content: f.Content,
UpdatedAt: f.UpdatedAt.UTC().Format("2006-01-02T15:04:05Z"),
}
}
// PermissionRequestDTO 是权限请求的对外视图。