Something went wrong. Try again.
source dump of claude code forked from oppi.li/claude-code
Something went wrong. Try again.
1.5 kB · 39 lines
TypeScript
at main
12345678910111213141516171819202122232425262728293031323334353637383940import type { Tool } from '../../Tool.js'import { AgentTool } from '../AgentTool/AgentTool.js'import { BashTool } from '../BashTool/BashTool.js'import { FileEditTool } from '../FileEditTool/FileEditTool.js'import { FileReadTool } from '../FileReadTool/FileReadTool.js'import { FileWriteTool } from '../FileWriteTool/FileWriteTool.js'import { GlobTool } from '../GlobTool/GlobTool.js'import { GrepTool } from '../GrepTool/GrepTool.js'import { NotebookEditTool } from '../NotebookEditTool/NotebookEditTool.js'
let _primitiveTools: readonly Tool[] | undefined
/** * Primitive tools hidden from direct model use when REPL mode is on * (REPL_ONLY_TOOLS) but still accessible inside the REPL VM context. * Exported so display-side code (collapseReadSearch, renderers) can * classify/render virtual messages for these tools even when they're * absent from the filtered execution tools list. * * Lazy getter — the import chain collapseReadSearch.ts → primitiveTools.ts * → FileReadTool.tsx → ... loops back through the tool registry, so a * top-level const hits "Cannot access before initialization". Deferring * to call time avoids the TDZ. * * Referenced directly rather than via getAllBaseTools() because that * excludes Glob/Grep when hasEmbeddedSearchTools() is true. */export function getReplPrimitiveTools(): readonly Tool[] { return (_primitiveTools ??= [ FileReadTool, FileWriteTool, FileEditTool, GlobTool, GrepTool, BashTool, NotebookEditTool, AgentTool, ])}