constants.ts
tools/REPLTool/constants.ts
47
Lines
1799
Bytes
3
Exports
9
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file is part of the tool layer, which means it describes actions the system can perform for the user or model.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with tool-system. It contains 47 lines, 9 detected imports, and 3 detected exports.
Important relationships
- tools/REPLTool/primitiveTools.ts
- ink/constants.ts
- tools/AgentTool/constants.ts
- tools/ConfigTool/constants.ts
- tools/EnterPlanModeTool/constants.ts
- tools/EnterWorktreeTool/constants.ts
- tools/ExitPlanModeTool/constants.ts
- tools/ExitWorktreeTool/constants.ts
- tools/FileEditTool/constants.ts
- tools/NotebookEditTool/constants.ts
- tools/SendMessageTool/constants.ts
- tools/SkillTool/constants.ts
Detected exports
REPL_TOOL_NAMEisReplModeEnabledREPL_ONLY_TOOLS
Keywords
replmodepromptprocessconstantstoolsisenvdefinedfalsyisenvtruthyagent_tool_namebash_tool_name
Detected imports
../../utils/envUtils.js../AgentTool/constants.js../BashTool/toolName.js../FileEditTool/constants.js../FileReadTool/prompt.js../FileWriteTool/prompt.js../GlobTool/prompt.js../GrepTool/prompt.js../NotebookEditTool/constants.js
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
import { isEnvDefinedFalsy, isEnvTruthy } from '../../utils/envUtils.js'
import { AGENT_TOOL_NAME } from '../AgentTool/constants.js'
import { BASH_TOOL_NAME } from '../BashTool/toolName.js'
import { FILE_EDIT_TOOL_NAME } from '../FileEditTool/constants.js'
import { FILE_READ_TOOL_NAME } from '../FileReadTool/prompt.js'
import { FILE_WRITE_TOOL_NAME } from '../FileWriteTool/prompt.js'
import { GLOB_TOOL_NAME } from '../GlobTool/prompt.js'
import { GREP_TOOL_NAME } from '../GrepTool/prompt.js'
import { NOTEBOOK_EDIT_TOOL_NAME } from '../NotebookEditTool/constants.js'
export const REPL_TOOL_NAME = 'REPL'
/**
* REPL mode is default-on for ants in the interactive CLI (opt out with
* CLAUDE_CODE_REPL=0). The legacy CLAUDE_REPL_MODE=1 also forces it on.
*
* SDK entrypoints (sdk-ts, sdk-py, sdk-cli) are NOT defaulted on — SDK
* consumers script direct tool calls (Bash, Read, etc.) and REPL mode
* hides those tools. USER_TYPE is a build-time --define, so the ant-native
* binary would otherwise force REPL mode on every SDK subprocess regardless
* of the env the caller passes.
*/
export function isReplModeEnabled(): boolean {
if (isEnvDefinedFalsy(process.env.CLAUDE_CODE_REPL)) return false
if (isEnvTruthy(process.env.CLAUDE_REPL_MODE)) return true
return (
process.env.USER_TYPE === 'ant' &&
process.env.CLAUDE_CODE_ENTRYPOINT === 'cli'
)
}
/**
* Tools that are only accessible via REPL when REPL mode is enabled.
* When REPL mode is on, these tools are hidden from Claude's direct use,
* forcing Claude to use REPL for batch operations.
*/
export const REPL_ONLY_TOOLS = new Set([
FILE_READ_TOOL_NAME,
FILE_WRITE_TOOL_NAME,
FILE_EDIT_TOOL_NAME,
GLOB_TOOL_NAME,
GREP_TOOL_NAME,
BASH_TOOL_NAME,
NOTEBOOK_EDIT_TOOL_NAME,
AGENT_TOOL_NAME,
])