refactor: spell the reserved web search name with a hyphen

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
hugocasa
2026-09-14 17:39:48 +02:00
co-authored by Claude Opus 5
parent 4e3426a0b2
commit b24707dc1b
12 changed files with 19 additions and 19 deletions
+5 -5
View File
@@ -248,10 +248,10 @@ fn overlay_tool_inputs(
/// editor's label is not one: a flow module tool could carry the same one, and enabling that tool
/// would then silently turn web search on with it.
///
/// The space is what makes the name unshareable. A flow module tool's name must match
/// `TOOL_NAME_REGEX`, and a resource path carries no spaces either, so nothing else in a roster can
/// answer to this.
const WEBSEARCH_ENABLED_NAME: &str = "web search";
/// The hyphen is what makes the name unshareable. A flow module tool's name must match
/// `TOOL_NAME_REGEX`, which allows only letters, digits and underscores, so nothing else in a
/// roster can answer to this.
const WEBSEARCH_ENABLED_NAME: &str = "web-search";
/// The name a run enables a roster entry by: the name the model is shown, except for an entry the
/// model is shown nothing of, which cannot be named by a label others may share. An MCP server is
@@ -2050,7 +2050,7 @@ mod tests {
// The reserved name is one nothing else in a roster can answer to, so enabling a tool
// cannot switch web search on beside it: a tool named after it would be rejected by
// `TOOL_NAME_REGEX`, which is what the space is there to stay outside of.
// `TOOL_NAME_REGEX`, which is what the hyphen is there to stay outside of.
assert!(!TOOL_NAME_REGEX.is_match(WEBSEARCH_ENABLED_NAME));
let mut collision = vec![named("t", "web_search")];
collision.push(websearch("w", None));
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -121,7 +121,7 @@ export const AGENT_FIELDS: AgentFieldSpec[] = [
group: 'tools',
label: 'Enabled tools',
tooltip:
'Which of the agent tools a run carries, so it costs no more than it needs. Selecting none leaves the agent with no tools, and unsetting the field gives it all of them. Set it to an expression to decide per run, naming each one the way this list does: a tool by its own name, an MCP server by its resource path, and web search by "web search". An MCP server carries every tool it exposes, which its own include and exclude lists decide.',
'Which of the agent tools a run carries, so it costs no more than it needs. Selecting none leaves the agent with no tools, and unsetting the field gives it all of them. Set it to an expression to decide per run, naming each one the way this list does: a tool by its own name, an MCP server by its resource path, and web search by "web-search". An MCP server carries every tool it exposes, which its own include and exclude lists decide.',
seed: [],
defaultHint: 'Default: all of them'
},
@@ -43,7 +43,7 @@ describe('toolEnabledName', () => {
it('reserves that name against every other kind', () => {
// A flow module tool cannot be called it, so enabling a tool never enables web search beside
// it. `getToolNameError` is the rule that holds, and the space is what stays outside it.
// it. `getToolNameError` is the rule that holds, and the hyphen is what stays outside it.
expect(getToolNameError(WEBSEARCH_ENABLED_NAME)).toBeDefined()
})
})
@@ -100,10 +100,10 @@ export function toolDisplayName(tool: AgentTool): string | undefined {
}
/** What every websearch entry is named by, mirroring `WEBSEARCH_ENABLED_NAME` in `ai_executor.rs`.
* The space is load-bearing: it is what stops a flow module tool, whose name `getToolNameError`
* The hyphen is load-bearing: it is what stops a flow module tool, whose name `getToolNameError`
* holds to letters, digits and underscores, from answering to the same name and being switched on
* with web search. */
export const WEBSEARCH_ENABLED_NAME = 'web search'
export const WEBSEARCH_ENABLED_NAME = 'web-search'
/** The name `enabled_tools` holds a tool by: the name the model is shown, except for an entry the
* model is shown nothing of, which is named by whatever identifies it instead. An MCP server is
@@ -158,7 +158,7 @@ export const AI_AGENT_SCHEMA: Schema = {
enabled_tools: {
type: 'array',
description:
'Which of the agent tools a run may call: a tool by the name the model is shown, an MCP server by its resource path, which carries every tool it exposes, and web search by "web search". Unset carries every tool.',
'Which of the agent tools a run may call: a tool by the name the model is shown, an MCP server by its resource path, which carries every tool it exposes, and web search by "web-search". Unset carries every tool.',
items: {
type: 'string'
}
+2 -2
View File
@@ -1077,8 +1077,8 @@ components:
A tool is named as the model is shown it. An entry the model is shown nothing of is
named by what identifies it instead: an MCP server by its resource path, carrying
every tool it exposes (which of them stays that entry's include_tools/exclude_tools),
and a websearch entry by the reserved name 'web search', whatever summary it carries.
Example: ['get_user', 'u/admin/github_mcp', 'web search']
and a websearch entry by the reserved name 'web-search', whatever summary it carries.
Example: ['get_user', 'u/admin/github_mcp', 'web-search']
max_completion_tokens:
allOf:
- $ref: '#/components/schemas/InputTransform'
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long