Skip to content

feat(CodeactStateKeys): add constants#23

Merged
canfuu merged 3 commits intomainfrom
feature/add_conact_state_keys
Feb 4, 2026
Merged

feat(CodeactStateKeys): add constants#23
canfuu merged 3 commits intomainfrom
feature/add_conact_state_keys

Conversation

@canfuu
Copy link
Collaborator

@canfuu canfuu commented Feb 4, 2026

add constants

Copilot AI review requested due to automatic review settings February 4, 2026 08:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +70 to +81
/**
* 可用工具名称白名单
*
* <p>类型:List&lt;String&gt;
* <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";
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
    */

Copilot uses AI. Check for mistakes.
Comment on lines +127 to +133
* 编程语言
*
* <p>类型:String
* <p>示例:"python", "java"
* <p>由 CodeGeneratorSubAgent.init_context 节点注入
*/
public static final String LANGUAGE = "language";
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. These constants represent different concepts and should be named more distinctly
  2. One should be deprecated in favor of the other
  3. 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.

Suggested change
* 编程语言
*
* <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";

Copilot uses AI. Check for mistakes.
Comment on lines +83 to +91
/**
* 可用工具组白名单
*
* <p>类型:List&lt;String&gt;
* <p>示例:["search", "reply", "app_helper"]
* <p>用途:按工具组筛选,组名对应 CodeactToolMetadata.targetClassName()
* <p>为空或不存在时:不按组筛选
*/
public static final String AVAILABLE_TOOL_GROUPS = "available_tool_groups";
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +93 to +104
/**
* 白名单模式
*
* <p>类型:String
* <p>可选值:
* - "INTERSECTION"(默认):名称白名单和组白名单取交集
* - "UNION":名称白名单和组白名单取并集
* - "NAME_ONLY":仅使用名称白名单
* - "GROUP_ONLY":仅使用组白名单
* <p>为空或不存在时:默认为 INTERSECTION
*/
public static final String WHITELIST_MODE = "tool_whitelist_mode";
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +108 to +115
/**
* 注入的全部 codeact 工具列表
*
* <p>类型:List&lt;CodeactTool&gt;
* <p>由 CodeGeneratorSubAgent.init_context 节点注入
* <p>上层应用可读取此列表进行评估
*/
public static final String CODEACT_TOOLS = "codeact_tools";
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +117 to +124
/**
* 筛选后的 codeact 工具列表
*
* <p>类型:List&lt;CodeactTool&gt;
* <p>由 CodeGeneratorNode 筛选后写入(可选)
* <p>用于调试和审计
*/
public static final String FILTERED_CODEACT_TOOLS = "filtered_codeact_tools";
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@canfuu canfuu enabled auto-merge February 4, 2026 08:47
Copy link
Collaborator

@AQing-527 AQing-527 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@canfuu canfuu merged commit fc48570 into main Feb 4, 2026
1 check passed
@canfuu canfuu deleted the feature/add_conact_state_keys branch February 4, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants