Conversation
* feat(agent): add AGENTS_DIR constant and agent data model * test(agent): add AgentConfig smoke tests, deduplicate permission test * feat(agent): add AgentManager singleton with frontmatter parser * fix(agent): add AgentManager tests, fix empty-permissions assertion, thread-safe loading * feat(agent): add /agent command with list, switch, copy * fix(agent): use parsed_input.source for args and copy_to_clipboard wrapper * feat(agent): /ws injects agent directive and filters tool definitions * feat(agent): add agent selector dropdown to TUI and init default agent on startup * refactor(core): 统一代码风格并优化工具权限逻辑 - 重构优化: 调整导入顺序与缩进格式 * 修正 `src/console/commands/workspaces/agent_cmd.py` 中 `AgentManager`、`copy_to_clipboard` 及 `AgentConfig` 的导入顺序,符合项目规范。 * 优化 `src/core/agent_manager.py` 中 `_parse_frontmatter` 函数的切片语法为 `lines[end_idx + 1 :]`。 * 简化 `src/console/ui/repl.py` 中 `title_right.update` 和 `tui_console.print` 的多行字符串拼接,改为单行形式。 - 修复问题: 统一中文标点符号使用 * 在 `src/core/agent_manager.py` 的默认 Agent 配置内容中,将全角逗号 `,` 替换为英文半角点号 `.`,确保输出格式一致性。 - 重构优化: 精简工具权限判断逻辑 * 重构 `src/models/agent.py` 中 `ToolPermissions.can_use_tool` 方法,将原有的多层 `if-else` 逻辑简化为 `return not self.whitelist or tool_name in self.whitelist`,提升可读性。 * feat(workspaces): 重构系统提示词组装逻辑与默认 Agent 配置 - 新增功能: 优化系统提示词生成流程,支持基于 Agent 配置的动态覆盖 * 修改 `_generate_tool_definitions_section` 签名,显式接收 `AgentConfig` 参数替代内部调用 `AgentManager().get_current()` * 修改 `_generate_agent_directive_section` 签名,移除 `CommandContext` 依赖,直接处理 `agent` 对象并增加 `precedence="OVERRIDES_BASE"` 属性 * 重构 `_assemble_full_prompt` 函数,明确定义提示词组装顺序:Role → Constraints → Agent Directive → Tool Rules → Tool Definitions → Workflow → Workspace Context → Augmentation → Extensions * 引入条件逻辑,当 Agent 自身定义了 `body_role` 或 `body_workflow` 时,跳过全局的 `SYSTEM_ROLE` 和 `WORKFLOW_GUIDELINES` 注入 - 重构优化: 分离常量定义与模板内容,提升代码可维护性 * 将 `src/constants/prompts.py` 中的 `SYSTEM_IDENTITY` 拆分为 `SYSTEM_ROLE` (仅包含身份描述) 和 `SYSTEM_CONSTRAINTS` (独立约束块) * 更新 `TOOL_RULES` 中的 `<anti_hallucination>` 标签,增加 `precedence="ABSOLUTE"` 属性以强化优先级 * 调整 `WORKFLOW_GUIDELINES` 步骤,在任务分解前增加“先通过搜索和读取了解项目结构”的步骤 * 更新 `src/core/agent_manager.py` 中 `write_default` 方法,使用 f-string 动态注入 `SYSTEM_ROLE` 和 `WORKFLOW_GUIDELINES` 常量至默认 `default.md` 文件 * feat(console): 新增 Agent 重置功能并重构默认配置写入逻辑 - 新增功能: 添加 `/agent reset` 子命令用于重写 default.md * 在 `AgentCommand` 中集成 `_reset_default` 函数,调用 `AgentManager.reset_default()` * 新增 `ArgumentParser` 解析器以支持子命令参数及帮助信息展示 (`-h`, `--help`) * 将原有的私有方法 `_show_current` 和 `_list_all` 提升为模块级函数供外部调用 - 修复问题: 解决工作区路径未保存导致重置失败的问题 * 在 `AgentManager.initialize` 中新增 `_root_path` 属性存储工作区根路径 * 修改 `write_default` 方法签名,增加 `force` 布尔参数控制是否覆盖现有文件 * 实现 `reset_default` 方法,强制重写 `default.md` 并清空内部缓存 (`_loaded`, `_agents`)
* feat(workspace): 重构排除与权限管理架构,统一安全策略 - 新增功能: 引入统一的文件排除与权限决策引擎 * 新增 `ExclusionManager` 类,聚合默认性能排除、.gitignore 规则及用户自定义忽略项 * 新增 `PermissionManager` 类,提供基于操作类型 (READ/WRITE/SEARCH) 的统一权限决策接口 * 新增 `SensitiveFileError` 异常类,用于在路径校验阶段拦截敏感文件访问 * 工具层集成:`ls_tool`, `glob_tool`, `regex_search_tool`, `exact_search_tool` 均接入 `exclusion_manager` 进行路径过滤 - 修复问题: 增强敏感文件保护机制 * 在 `PathValidator` 中增加 `_raise_if_sensitive` 逻辑,直接禁止访问 `.env`, `*.pem`, `id_rsa` 等敏感文件 * 在 `BaseTool` 的异常处理装饰器中捕获 `SensitiveFileError`,返回明确的拒绝访问提示 * 将原本硬编码的 `DEFAULT_EXCLUDED_DIRS` 替换为动态加载的 `ExclusionManager` 实例 - 重构优化: 简化搜索与遍历逻辑 * 移除 `workspace.py` 和各类 Search Tool 中重复的正则编译与排除逻辑 * 使用 `merge_ignore_regexes` 方法统一合并默认规则与用户传入的 ignore 模式 * 利用 `is_ignored_by_gitignore` 函数统一处理 .gitignore 规则的匹配与否定逻辑 - 文档更新: 补充模块设计说明 * 添加 `ExclusionManager` 和 `PermissionManager` 的类级文档字符串,明确区分性能排除与安全排除场景 * refactor(workspace): 重构权限与安全校验架构,统一敏感文件规则来源 - 破坏性变更: 移除 `PermissionManager` 及其相关 API * 删除 `src/workspace/permissions.py` 文件 * 移除 `Workspace` 类中的 `self.permission_manager` 属性及初始化逻辑 * 调用方需直接依赖 `PathValidator` 进行敏感文件拦截,不再通过 `workspace.permission_manager.is_allowed()` 查询 - 重构优化: 整合敏感文件规则至 `ExclusionManager` * 将 `SENSITIVE_FILE_PATTERNS` 从硬编码移至 `ExclusionManager.SENSITIVE_FILE_PATTERNS` * `PathValidator` 引入 `ExclusionManager` 作为唯一敏感文件模式来源 (`re.compile(p) for p in ExclusionManager.SENSITIVE_FILE_PATTERNS`) * 更新正则表达式前缀以支持路径边界匹配 (添加 `(^|/)`) - 代码清理: 移除冗余的排除检查逻辑 * 在 `Workspace._search_content` 中移除基于 `should_exclude_dir` 的父目录遍历检查 * 移除 `ExclusionManager` 中已废弃的 `_sensitive_file_res` 预编译缓存逻辑 * 移除 `ExclusionManager` 中不再使用的 `is_sensitive_file` 和 `should_exclude_dir` 方法 - 文档更新: 补充 `gitignore_loader` 已知局限性说明 * 明确标注不支持嵌套 `.gitignore`、行尾续行及字符类扩展语法 * 记录否定模式优先级处理与真实 Git 的差异及设计理由 * feat(utils): 扩展二进制文件检测器以支持Godot项目格式 - 新增功能: 在文件扩展名白名单中添加Godot相关后缀 * 添加 `.godot` 和 `.gd` 支持 * 添加 `.gd.uid` 和 `.tscn` 支持 * feat(utils): 扩展二进制文件检测后缀列表 - 新增功能: 在 binary_detector.py 的 FILE_EXTENSIONS 集合中增加对特定编译产物和数据库文件的识别 * 添加 .pdb (程序数据库) 后缀 * 添加 .pyd (Python 动态链接库) 后缀 * 添加 .o (目标文件) 后缀 * feat(workspace/tools): 优化文件搜索逻辑并增加二进制文件过滤 (#154) - 新增功能: 集成二进制文件检测机制 * 在 `regex_search_tool.py` 和 `exact_search_tool.py` 中导入 `src.utils.binary_detector.is_binary_file` * 在遍历文件列表时增加 `is_binary_file(file_path)` 判断,自动跳过二进制文件 - 重构优化: 增强文件路径筛选与排除逻辑 * 修改 `files_to_search` 生成逻辑,将简单的 `rglob` 转换为包含条件过滤的列表推导式 * 引入 `self._exclusion_manager.should_exclude_path(p)` 方法,支持自定义路径排除规则 * 确保仅处理 `p.is_file()` 且未被排除的有效文件
Feat: Add Skill System / 添加 Skill 系统
* fix(git_tool): preserve stdout when returncode != 0 Bug: When a git command exits with non-zero returncode but still produces stdout (e.g., 'git diff --exit-code' returns 1 when there are differences, but the diff content is on stdout), the previous code discarded stdout entirely and returned only the error info in the 'error' field with data=None. This caused the actual git output (the diff) to be lost, making it appear as if nothing happened. Fix: - Always capture both stdout and stderr into output_parts, regardless of returncode - When returncode != 0, still pass the combined output as 'data' (so it renders in <result_response>), while also setting 'error' with the exit code and stderr content - Applied the same fix to the fallback HACK path (bytes-mode re-run) The result is that commands like 'git diff --exit-code' now show their diff output in <result_response> alongside the exit code in <error_response>, matching user expectations. Closes #150 * refactor(git_tool): 更新注释以匹配实际的 stdout 保留逻辑 - 重构优化: 修正 `_execute_command` 方法中的行内注释描述 * 将原注释“处理输出”更新为“总是保留 stdout,即使 returncode != 0 (如 git diff --exit-code)" * 确保文档说明与代码中无条件追加 `result.stdout` 的逻辑保持一致 --------- Co-authored-by: Suntion <149924916+SunYanbox@users.noreply.github.com> Co-authored-by: Baima (Hermes Agent) <baima@hermes.agent>
* docs(core): 更新 v0.6.0 发布说明并同步 Agent 与 Skill 系统特性 - 文档更新: 同步 CHANGELOG 与 README 至新版本功能 * 新增 v0.6.0 版本日志,详细记录 `AgentManager`、`SkillManager`、`shell` 工具及 `ExclusionManager` 等核心组件的引入 * 更新 README 功能列表,将内置工具数量从 12 个扩展至 14 个,增加 Shell 执行与 Skill 系统支持 * 修订 TUI 界面描述,明确新增 Environment Config 和 Skill Config 标签页,以及六标签页布局 * 更新 `/agent` 命令说明及 Gitignore 支持、敏感文件保护 (`SensitiveFileError`) 的安全机制文档 * 修正审计工作流描述,明确写入、编辑及 Shell 命令均纳入两阶段审批流程 (Preview/Review/Decide) * 升级 Python 版本要求标识为 >=3.14,并同步中英文文档 (CHANGELOG.md, CHANGELOG_ZH.md, README.md, README_ZH.md) * chore(release): 升级项目版本至 v0.6.0 - 更新核心版本标识 * 修改 `pyproject.toml` 中的 `[project] version` 字段从 "0.5.0" 变更为 "0.6.0" * 更新 `src/constants/__init__.py` 中的 `__version__` 常量值以匹配新版本号
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.
No description provided.