Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds new constants to the CodeactStateKeys class to support tool whitelist configuration and tool context management features in the CodeAct agent framework. These constants will be used to control which tools are available during code generation and execution.
Changes:
- Added tool whitelist configuration constants (AVAILABLE_TOOL_NAMES, AVAILABLE_TOOL_GROUPS, WHITELIST_MODE) to enable filtering of available tools
- Added tool context constants (CODEACT_TOOLS, FILTERED_CODEACT_TOOLS, LANGUAGE) for storing tool-related state information
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /** | ||
| * 可用工具名称白名单 | ||
| * | ||
| * <p>类型:List<String> | ||
| * <p>示例:["search_app", "reply_user", "get_project_info"] | ||
| * <p>用途:精确指定允许使用的工具,工具名称对应 CodeactTool.getName() | ||
| * <p>为空或不存在时:不按名称筛选 | ||
| * | ||
| * <p><b>注意</b>:这里存储的是工具的 name(CodeactTool.getName()),不是独立的 ID。 | ||
| * 如果评估时 LLM 输出的是缩写/简短 ID,上层应用需要在写入 state 前将 ID 转换为对应的工具 name。 | ||
| */ | ||
| public static final String AVAILABLE_TOOL_NAMES = "available_tool_names"; |
There was a problem hiding this comment.
Documentation format is inconsistent with existing constants in this file. The existing constants (lines 32-65) use a simple single-line Javadoc format with "Type:" notation, while the new constants use a multi-paragraph format with HTML paragraph tags. For consistency with the established pattern in this file, consider using the simpler format like the existing constants. For example:
/**
- Whitelist of available tool names
- Type: List<String>
*/
| * 编程语言 | ||
| * | ||
| * <p>类型:String | ||
| * <p>示例:"python", "java" | ||
| * <p>由 CodeGeneratorSubAgent.init_context 节点注入 | ||
| */ | ||
| public static final String LANGUAGE = "language"; |
There was a problem hiding this comment.
Potential semantic conflict with existing CURRENT_LANGUAGE constant. The file already defines CURRENT_LANGUAGE at line 53 (with Type: Language, not String), which may serve a similar purpose as this new LANGUAGE constant (Type: String). Consider whether:
- These constants represent different concepts and should be named more distinctly
- One should be deprecated in favor of the other
- They should be consolidated into a single constant
This could cause confusion for developers who need to choose between CURRENT_LANGUAGE and LANGUAGE when storing programming language information in the state.
| * 编程语言 | |
| * | |
| * <p>类型:String | |
| * <p>示例:"python", "java" | |
| * <p>由 CodeGeneratorSubAgent.init_context 节点注入 | |
| */ | |
| public static final String LANGUAGE = "language"; | |
| * 编程语言(字符串编码形式) | |
| * | |
| * <p>类型:String | |
| * <p>示例:"python", "java" | |
| * <p>由 CodeGeneratorSubAgent.init_context 节点注入 | |
| * | |
| * <p>说明:用于存储编程语言的字符串编码,与 {@link #CURRENT_LANGUAGE} | |
| * 存储的 Language 类型对象相对应,避免混淆。 | |
| */ | |
| public static final String LANGUAGE_CODE = "language"; |
| /** | ||
| * 可用工具组白名单 | ||
| * | ||
| * <p>类型:List<String> | ||
| * <p>示例:["search", "reply", "app_helper"] | ||
| * <p>用途:按工具组筛选,组名对应 CodeactToolMetadata.targetClassName() | ||
| * <p>为空或不存在时:不按组筛选 | ||
| */ | ||
| public static final String AVAILABLE_TOOL_GROUPS = "available_tool_groups"; |
There was a problem hiding this comment.
Documentation format is inconsistent with existing constants in this file. The existing constants (lines 32-65) use a simple single-line Javadoc format with "Type:" notation, while the new constants use a multi-paragraph format with HTML paragraph tags. For consistency with the established pattern in this file, consider using the simpler format.
| /** | ||
| * 白名单模式 | ||
| * | ||
| * <p>类型:String | ||
| * <p>可选值: | ||
| * - "INTERSECTION"(默认):名称白名单和组白名单取交集 | ||
| * - "UNION":名称白名单和组白名单取并集 | ||
| * - "NAME_ONLY":仅使用名称白名单 | ||
| * - "GROUP_ONLY":仅使用组白名单 | ||
| * <p>为空或不存在时:默认为 INTERSECTION | ||
| */ | ||
| public static final String WHITELIST_MODE = "tool_whitelist_mode"; |
There was a problem hiding this comment.
Documentation format is inconsistent with existing constants in this file. The existing constants (lines 32-65) use a simple single-line Javadoc format with "Type:" notation, while the new constants use a multi-paragraph format with HTML paragraph tags. For consistency with the established pattern in this file, consider using the simpler format.
| /** | ||
| * 注入的全部 codeact 工具列表 | ||
| * | ||
| * <p>类型:List<CodeactTool> | ||
| * <p>由 CodeGeneratorSubAgent.init_context 节点注入 | ||
| * <p>上层应用可读取此列表进行评估 | ||
| */ | ||
| public static final String CODEACT_TOOLS = "codeact_tools"; |
There was a problem hiding this comment.
Documentation format is inconsistent with existing constants in this file. The existing constants (lines 32-65) use a simple single-line Javadoc format with "Type:" notation, while the new constants use a multi-paragraph format with HTML paragraph tags. For consistency with the established pattern in this file, consider using the simpler format.
| /** | ||
| * 筛选后的 codeact 工具列表 | ||
| * | ||
| * <p>类型:List<CodeactTool> | ||
| * <p>由 CodeGeneratorNode 筛选后写入(可选) | ||
| * <p>用于调试和审计 | ||
| */ | ||
| public static final String FILTERED_CODEACT_TOOLS = "filtered_codeact_tools"; |
There was a problem hiding this comment.
Documentation format is inconsistent with existing constants in this file. The existing constants (lines 32-65) use a simple single-line Javadoc format with "Type:" notation, while the new constants use a multi-paragraph format with HTML paragraph tags. For consistency with the established pattern in this file, consider using the simpler format.
add constants