Skip to content

feat(agent-resources): Agent 资源 (Rules / Skills / Plugin) 的分级配置#705

Merged
yokowu merged 1 commit into
mainfrom
feat-team-bare-skill-repos
Jun 17, 2026
Merged

feat(agent-resources): Agent 资源 (Rules / Skills / Plugin) 的分级配置#705
yokowu merged 1 commit into
mainfrom
feat-team-bare-skill-repos

Conversation

@twursc

@twursc twursc commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

概要

引入 Agent 资源(Rules / Skills / Plugins)三级 scope 架构(global → team → user),支持团队管理员通过现有团队后台上传私有 Skill,并在用户创建任务时按 scope 优先级下发到 codingmatrix agent。

架构

┌─────────────────┐  sync/upload   ┌──────────────────┐
│  mcai-admin-new  │──────────────→│  agent_skill_repos │ (source_type: github/upload)
│  (系统管理员)     │               │  scope = global    │
└─────────────────┘               └────────┬─────────┘
                                           │
┌─────────────────┐  teams/skills  ┌───────┴──────────┐
│  mcai-gh 团队后台 │──────────────→│  agent_skill_repos │ (source_type: bare)
│  (团队管理员)     │               │  scope = team      │
└─────────────────┘               └────────┬─────────┘
                                           │
                                    ┌──────┴───────┐
                                    │  agent_skills  │──→ agent_skill_versions (S3 zip)
                                    └──────┬───────┘
                                           │
┌─────────────────┐  /api/v1/skills ┌──────┴───────┐  SkillRefsScoped   ┌──────────────┐
│  用户前端         │←───────────────│  Listing     │──────────────────→│  codingmatrix  │
│  (任务创建选择器)  │               │  覆盖: user  │  presigned URL     │  agent VM      │
└─────────────────┘               │  > team      │  via AgentResources │  .ai-ready/    │
                                  │  > global    │                    └──────────────┘
                                  └──────────────┘

主要改动

存储层

  • Migration 000019_agent_resources: 建 agent_rules/skills/plugins + repos + versions + sync_jobs + group_bindings,一步到位含三级 scope CHECK + bare source_type + enabled/admin_description/admin_tags/extension_package_id 列
  • 每个 team 自动 provision bare skill_repo + bare plugin_repo(InitTeam 钩子 + migration backfill)
  • 废弃旧 skills/team_skills/team_group_skills 表(000016 创建,000019 DROP)

团队管理员 CRUD/api/v1/teams/skills/*,5 端点)

  • 随团队创建删除,同步创建属于团队的 Skill Repo
  • Create:团队后台提交 JSON 或 multipart zip → 关联 Skill Repo → 创建 agent_skill → 创建 new skill version → 上传 S3
  • Update:D3 语义(content 非空→新版本,否则仅改元数据 name/description/tags/groups)
  • source_type/source_label 存入 parsed_meta 保持前端来源展示
  • 上一个 commit 的 extension package 导入改为内部调 TeamSkillUsecase.Add 复用标准流程

用户态查询/api/v1/skills/api/v1/plugins

  • 三级 scope 并集 + 遇到同名时覆盖(优先级:user > team > global)
  • disabled skill 仍返回(enabled=false),dispatch 时跳过,前端需要做一下处理
  • description 优先级:admin_description > skill.description > parsed_meta
  • tags 优先级:admin_tags > parsed_meta.tags
  • 从 team_members 表查用户 team(不依赖 session)

任务下发

  • getCodingConfigsSkillRefsScoped/PluginRefsScoped,scope 感知 + enabled 过滤
  • 输出 AgentResources.Skills[](JSON 对齐 proto agent.AgentResources_AssetRef

其他

  • pkg/oss: 新增 PresignGet(按 full key 签发)+ PutFile 加入 ObjectStore 接口,同步实现 AliyunClient 用于维持线上环境存取 Aliyun OSS 的 bucket 的能力
  • 前端 plugin picker + force-delivery chip

依赖

  • mcai-backend: 需同步 ent schema(enabled/admin_description/admin_tags/extension_package_id + scope 扩展 + bare source_type)
  • mcai-admin-new: 需同步 ent schema + 扩展 PUT /api/v1/admin/skills/:id 支持 admin_description/admin_tags 覆写

…-admin CRUD

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@twursc twursc force-pushed the feat-team-bare-skill-repos branch from 7fe1264 to db7943b Compare June 17, 2026 06:14
@yokowu yokowu merged commit 6de72a8 into main Jun 17, 2026
@yokowu yokowu deleted the feat-team-bare-skill-repos branch June 17, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants