File size: 1,532 Bytes
064bfd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | import 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,
])
}
|