Skip to content

Commit 081ff9d

Browse files
committed
fix(core): keep Code Mode change to the prompt wording
1 parent 3082d6c commit 081ff9d

2 files changed

Lines changed: 0 additions & 32 deletions

File tree

‎packages/codemode/src/tool-runtime.ts‎

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -330,36 +330,11 @@ const namespaceKeys = <R>(root: ToolNode<R>, path: ReadonlyArray<string>): Reado
330330
return Array.from(node.children.keys())
331331
}
332332

333-
// Built-in tool names models reach for inside scripts.
334-
const TOP_LEVEL_TOOLS = new Set([
335-
"read",
336-
"write",
337-
"edit",
338-
"patch",
339-
"shell",
340-
"bash",
341-
"grep",
342-
"glob",
343-
"webfetch",
344-
"websearch",
345-
"todowrite",
346-
"question",
347-
"skill",
348-
"subagent",
349-
"task",
350-
])
351-
352333
const resolve = <R>(root: ToolNode<R>, path: ReadonlyArray<string>, index: ReadonlyArray<SearchEntry>): Tool<R> => {
353334
const segments = canonicalSegments(path)
354335
const node = lookup(root, segments)
355336
if (node === undefined) {
356337
const name = segments.join(".")
357-
if (!root.children.has(segments[0]) && TOP_LEVEL_TOOLS.has(segments[0])) {
358-
throw new ToolRuntimeError(
359-
"UnknownTool",
360-
`'${segments[0]}' is not a Code Mode tool. It is one of your regular tools: call ${segments[0]} directly as a normal tool call, outside \`execute\`. It does not exist inside \`execute\`.`,
361-
)
362-
}
363338
const ns = segments.length > 1 && root.children.has(segments[0]) ? segments[0] : undefined
364339
const closest = rank(
365340
ns ? index.filter((entry) => entry.description.path.startsWith(`${ns}.`)) : index,

‎packages/codemode/test/tool-paths.test.ts‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,6 @@ describe("callable namespaces", () => {
114114
expect(diagnostic.message).toBe("Unknown tool 'issues.get-list'. Did you mean tools.issues.list?")
115115
})
116116

117-
test("a built-in tool name points back to a direct call", async () => {
118-
const diagnostic = await failure(runtime, `return await tools.read({ path: "README.md" })`)
119-
expect(diagnostic.kind).toBe("UnknownTool")
120-
expect(diagnostic.message).toContain("call read directly as a normal tool call, outside `execute`")
121-
expect(diagnostic.suggestions).toBeUndefined()
122-
})
123-
124117
test("a namespace without its own tool stays non-callable", async () => {
125118
const nested = CodeMode.make({ tools: { "issues.list": echo("List issues", "list") } })
126119
const diagnostic = await failure(nested, `return await tools.issues({})`)

0 commit comments

Comments
 (0)