[agent] feat: Skills 支持(per-user MinIO 懒加载 + GitHub skill store + 客户端商店)#40
Merged
Conversation
- skill 不落本地:zip 存 MinIO skills/{uid}/{skill_id}.zip,元数据存 installed_skills 表
- per-user:每个用户独立 skill 集合,agent 只用自己装的
- 懒加载:load_skill tool 从 MinIO 拉取 + LRU 缓存
- skill store:GitHub repo 搜索(list_repos + zipball 下载),repo 作为 1 个 skill 不拆分
- 目录浏览 get_contents + 已安装预览 preview_skill(inspect_zip 支持 zipball 前缀)
- 两层缓存:后端 per-query TTL(5min) + 前端切 tab 不重载
- 端点(get_current_uid 用户自主):/skills/installed|install|{id}|{id}/preview + /skills/store/list|contents|install
- 代码工具不执行(沙箱后续)
- 配置 SKILL_STORE__TOPIC/API_KEY,.env.example + default.yaml 同步
- 69 测试 passed
- 技能工坊 dock 面板:已安装 + 商店 tab - 商店:GitHub repo 搜索 + 卡片列表 + 目录浏览(RepoBrowser) + 一键安装 - 已安装:skill 卡片 + 预览(SKILL.md/manifest/文件列表) + 卸载 - Google × Apple 设计:Geist display + Roboto body + Google 蓝 accent(#4285F4) + 大圆角卡片(16px) + elevation 阴影 + spring 动效;实色 surface 无玻璃拟态 - 两层缓存(前端切 tab 不重载 + 后端 TTL) - lib/api.ts: skillsApi(listInstalled/uploadInstall/uninstall/storeList/storeInstall/storeContents/preview)
- frontend: 移除 RepoBrowser 未用 branch prop(eslint no-unused-vars warning) - backend: security.py / eval_ragas.py 既有 E402 加 noqa(非本次引入,ruff app/ 清零)
CI 的 pip install ruff 装最新版,默认规则集变严(含 BLE001/I001/UP045/SIM), 既有代码 ~1800 违规导致 ruff action 失败。加 ruff.toml 固定 select E4/E7/E9/F + ignore E501/E402,与项目历史 lint 表面一致,跨 ruff 版本稳定。 验证:ruff check app/ / ruff check . / CI 命令 均通过。 broader rules (B/I/UP/SIM) 后续逐步启用。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
完善 agent 能力:支持 Skills(指令包 + 工具混合),agent 按需加载技能扩展能力。skill 不落本地存 MinIO;来源是 GitHub repo 搜索(关键词 + topic 市场)。
核心设计
存储(不落本地)
skills/{uid}/{skill_id}.zipinstalled_skills(per-user:uid + UniqueConstraint(uid, skill_id))per-user
load_skilltool 通过 runtime_dispatch 注入的_uid定位用户skill store(GitHub repo 搜索)
list_repos(query): GitHub Search API(q=query,无 query 时 fallbacktopic:mindbase-skill)download_repo(repo, branch): GitHub zipball 整包下载,repo = 1 个 skill(不拆分子目录)get_contents(repo, path, branch): 浏览 repo 目录/文件SKILL_STORE__TOPIC/SKILL_STORE__API_KEY(GitHub token 可选)两层缓存
list_reposper-query TTL 缓存(5min,跨用户,应对 GitHub Search rate limit)代码工具
has_code_tools=true时load_skill返回指令 + "需沙箱支持"提示端点(get_current_uid 用户自主,非 admin)
/skills/installed/skills/install/skills/{skill_id}/skills/{skill_id}/preview/skills/store/list?q=/skills/store/contents?repo=&path=&branch=/skills/store/install前端(Google × Apple 风)
lib/api.ts: skillsApi 完整封装验证
ruff check app/All checks passed(含既有 E402 noqa 修复)owner-repo-sha/SKILL.md)范围外(后续)