feat: 增加重插件分层加载、能力开关与 AGENTS.md 自动上下文 - #117
Open
A-m-o-r-F-a-t-i wants to merge 2 commits into
Open
A-m-o-r-F-a-t-i wants to merge 2 commits into
A-m-o-r-F-a-t-i wants to merge 2 commits into
Conversation
Make operator and project guidance available through MCP initialization and agentdock_context without requiring separate file reads, ACP, or Recall. Discover the explicit global instructions file or the default AGENTS.md, then load workspace guidance from the applicable root to the selected directory. Return ordered content with provenance, hashes, and explicit load/skip/error states. Read fresh files on each context request. Add an optional request-local workdir selector without changing command working directories or sharing workspace selection across clients. Keep empty-argument calls compatible and preserve the private Nexus context shape through the existing rules field. Bound discovery and content sizes, validate UTF-8, reject automatically discovered symlinks and non-regular files, and deduplicate physical files. Preserve explicit instructions-file behavior and provide an autoload opt-out through AGENTDOCK_AGENTS_AUTOLOAD. Cover discovery, refresh, scope boundaries, Windows path casing, file validation, concurrent workspace isolation, schema compatibility, and MCP initialization/live-context delivery with regression tests. Document the loading contract, configuration, and startup-snapshot limitations.
- 用逻辑插件封装同领域 Skill 与动态 MCP,保留现有注册表兼容性 - 在 agentdock_context 中仅公开插件摘要,并由 plugin_load 延迟展开成员与 MCP 工具 - 为插件、Skill 和 MCP 增加独立开关及有效可用性校验 - 在 Windows 控制面板增加能力管理页、分组展示和中英文界面 - 补充 Runtime API、持久化、协议契约、集成测试与使用文档
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.
背景
随着已安装 Skill 和动态 MCP 数量增加,当前扁平能力索引会重复暴露同一领域的 Skill、MCP 服务及工具描述,模型需要自行拼接领域上下文,也缺少统一的功能开关。与此同时,AgentDock 尚未原生加载全局和工作区
AGENTS.md,项目规则需要由客户端额外注入。本 PR 将两个已经完成并通过测试的能力一起提交:
AGENTS.md;主要改动
1. 原生 AGENTS.md 自动上下文
${AGENTDOCK_HOME}/AGENTS.md、工作区根目录及目标子目录链上的AGENTS.md;agentdock_context新增请求级workdir,每次调用重新读取规则文件,不修改命令默认工作目录;agentdock_context刷新;os.Root、文件身份校验、大小与层级预算限制读取范围;AGENTDOCK_AGENTS_AUTOLOAD=false关闭自动发现,显式AGENTDOCK_INSTRUCTIONS_FILE保持原语义;context.local保持既有协议结构,通过原有rules字段承载规则文本。2. 重插件与两层渐进式加载
~/.agentdock/plugins/plugins.json,插件只记录名称、领域描述、成员归属和总开关;agentdock_context第一层仅暴露启用插件的名称、描述和成员数量;skills、dynamic_mcp中重复显示;plugin_load,第二层按需返回插件包含的 Skill 入口、MCP 服务描述,并延迟执行 MCP 工具发现;mcp_tool_search不扫描插件成员,显式选择插件或服务后再展开完整工具描述。3. 插件、Skill 与 MCP 独立开关
有效可用性采用:
4. Windows 能力管理面板
新增“能力”页面:
兼容性
agentdock_context只增加可选字段,现有空参数调用继续有效;测试
已执行并通过:
go test ./...go test -count=1./scripts/test/check-scripts.sh(WSL POSIX 环境)go test ./scripts/test -run TestScriptGovernance -count=1go vet ./...agentdock二进制构建.NET 8 Release构建:0 警告、0 错误新增测试覆盖插件注册表迁移兼容、成员所有权冲突、开关持久化、顶层去重、
plugin_load延迟展开、MCP 工具发现失败降级、Runtime API、AGENTS.md 路径边界与 Windows 控制面板结构。