feat(skills): 增加自定义 Skill 管理与按 Bot 优先披露#211
Open
xiongz-c wants to merge 4 commits into
Open
Conversation
cea6b05 to
e31ef2a
Compare
bd2b006 to
67de15d
Compare
Owner
|
🐂🍺 我可能需要多花些时间review哈 |
67de15d to
7234695
Compare
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.
背景 / 动机
botmux 的 bot 已经承载了“某个入口 + 某个 CLI/模型/工作区/人设”的配置语义。对应地,团队或项目自定义 Skill 也需要成为可复用、CLI 无关、按 bot 选择的资产,而不是只能依赖某个 CLI 的全局 skill 目录。
本 PR 的边界是:botmux 管理一组 Skill 资产,并在会话启动时按全局注入策略和 bot 优先列表做 scoped delivery / priority disclosure;不把 botmux 扩展成通用 Agent 平台,也不接管底层 CLI 自己的全局 skill 发现机制。
Review Map
src/core/skills/*、src/services/skill-registry-store.ts、test/skill-*.test.ts。覆盖 Skill 包解析、registry、local/Git/GitHub 安装、更新、删除、doctor 和资源读取。src/core/skills/session-runtime.ts、src/core/skills/session-resolver.ts、src/core/worker-pool.ts、src/adapters/cli/*。覆盖 manifest、prompt catalog、Claude scoped plugin、sandbox readonly roots。src/services/bot-config-store.ts、src/core/command-handler.ts、src/core/skills/cli-admin-command.ts、src/core/skills/im-command.ts。bot 只维护 direct priority skill 列表;delivery 与工作区 Skill 注入方式是全局默认。src/dashboard.ts、src/core/dashboard-ipc-server.ts、src/dashboard/skill-install-request.ts、src/dashboard/web/skills.ts、src/dashboard/web/style.css。覆盖安装/更新/删除、后台 job、全局注入配置、bot 横向配置卡和分页列表。docs/setup/skills.md、README.md。说明默认行为、安装来源、delivery、Dashboard、sandbox 和排障。改动
skill:<name>优先披露列表。trustProjectSkills控制是否读取工作区.agents/skills/.botmux/skills,delivery控制auto | prompt | native。botmux skill show/read/resources读取命令。Skills页面,用于 registry 安装/更新/删除、全局注入配置、按 bot 配置优先披露列表。git时返回git_not_found、删除 in-use skill 前提示/阻止、resource 枚举防 symlink 越界。默认值 / 兼容性依据
BotConfig.skills时,不生成 manifest、不注入 prompt、不创建 runtime plugin,也不改变 CLI args;底层 Codex / Claude 等 CLI 保持原有默认行为。.agents/skills与.botmux/skills纳入候选。trusted作为旧配置兼容别名读取为all,但不再暴露成独立安全语义。delivery:auto优先使用 adapter 支持的 native/scoped delivery,不支持时走 prompt;delivery:native在目标 CLI 不支持时阻止新会话并给用户可见诊断。~/.botmux/skills;不会写入~/.codex/skills、~/.claude/skills等宿主 CLI 全局目录。本机 CLI skill 库目录会作为 local-link 引用,不复制。git。缺少git会给出明确错误;私有仓库认证应走系统 Git 凭证、SSH agent 或gh auth,不接受带 token 的 URL。测试覆盖
/botconfig set skillsJSON 文本路径、priority include diagnostics。botmux skill show/read/resources资源越界保护。验证
本次验证:
pnpm vitest run test/skill-*.test.ts test/dashboard-skill-install-request.test.ts test/session-skill*.test.ts test/session-lifecycle-start.test.ts test/command-handler.test.ts test/dashboard-ipc.test.ts test/dashboard-auth.test.ts test/global-config.test.ts test/bot-config-store.test.ts test/file-lock.test.ts(25 files,318 passed)。pnpm vitest run test/sandbox.test.ts -t "binds selected skill runtime roots"(1 passed,38 skipped)。pnpm build。git diff --check。补充:本次也跑过包含完整
test/sandbox.test.ts的同一套 focused 命令,仍有 1 个既有 sandbox opaque-dir landing 用例失败:a BRAND-NEW opaque dir is mkdir-only。该失败不在本 PR 的 Skill 注入路径上;Skill 相关 sandbox readonly roots 用例已单独通过。影响范围
未配置
skills的 bot 不受影响。已配置skills的 bot 只影响新会话;运行中的历史会话不会 retroactively 注入。Dashboard 新增管理入口仍在 token-gated 管理面内。安装/更新 Git/GitHub Skill 会调用系统git;没有git的环境会得到明确错误而不是静默失败。删除已被 bot 引用的 Skill 需要确认/force,避免无提示制造 dangling policy。