Skip to content

Commit 9f1a116

Browse files
committed
Only publish a subset of tool type definitions
1 parent 5017a87 commit 9f1a116

File tree

6 files changed

+26
-194
lines changed

6 files changed

+26
-194
lines changed

common/src/tools/compile-tool-definitions.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import z from 'zod/v4'
22

3-
import { llmToolCallSchema } from './list'
3+
import { llmToolCallSchema, publishedTools } from './list'
44

55
/**
66
* Compiles all tool definitions into a single TypeScript definition file content.
77
* This generates type definitions for all available tools and their parameters.
88
*/
99
export function compileToolDefinitions(): string {
10-
const toolEntries = Object.entries(llmToolCallSchema)
10+
const toolEntries = publishedTools.map(
11+
(toolName) => [toolName, llmToolCallSchema[toolName]] as const,
12+
)
1113

1214
const toolInterfaces = toolEntries
1315
.map(([toolName, toolDef]) => {

common/src/tools/list.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,26 @@ export const llmToolCallSchema = {
4848
[K in ToolName]: ToolParams<K>
4949
}
5050

51+
export const publishedTools = [
52+
'add_message',
53+
'code_search',
54+
'end_turn',
55+
'find_files',
56+
'read_docs',
57+
'read_files',
58+
'run_file_change_hooks',
59+
'run_terminal_command',
60+
'set_messages',
61+
'set_output',
62+
'spawn_agents',
63+
'str_replace',
64+
'think_deeply',
65+
'web_search',
66+
'write_file',
67+
// 'spawn_agents_async',
68+
// 'spawn_agent_inline',
69+
] as const
70+
5171
export const clientToolCallSchema = {
5272
// Tools that require an id and objective
5373
add_subgoal: ['id', 'objective', 'status', 'plan', 'log'],

common/src/util/types/agent-definition.d.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,13 @@ export type TerminalTools = 'run_terminal_command' | 'run_file_change_hooks'
231231
/**
232232
* Web and browser tools
233233
*/
234-
export type WebTools = 'browser_logs' | 'web_search' | 'read_docs'
234+
export type WebTools = 'web_search' | 'read_docs'
235235

236236
/**
237237
* Agent management tools
238238
*/
239239
export type AgentTools =
240240
| 'spawn_agents'
241-
| 'spawn_agents_async'
242-
| 'send_agent_message'
243241
| 'set_messages'
244242
| 'add_message'
245243

@@ -248,9 +246,6 @@ export type AgentTools =
248246
*/
249247
export type PlanningTools =
250248
| 'think_deeply'
251-
| 'create_plan'
252-
| 'add_subgoal'
253-
| 'update_subgoal'
254249

255250
/**
256251
* Output and control tools

common/src/util/types/tools.d.ts

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
*/
44
export type ToolName =
55
| 'add_message'
6-
| 'add_subgoal'
7-
| 'browser_logs'
86
| 'code_search'
9-
| 'create_plan'
107
| 'end_turn'
118
| 'find_files'
129
| 'read_docs'
@@ -16,11 +13,8 @@ export type ToolName =
1613
| 'set_messages'
1714
| 'set_output'
1815
| 'spawn_agents'
19-
| 'spawn_agents_async'
20-
| 'spawn_agent_inline'
2116
| 'str_replace'
2217
| 'think_deeply'
23-
| 'update_subgoal'
2418
| 'web_search'
2519
| 'write_file'
2620

@@ -29,10 +23,7 @@ export type ToolName =
2923
*/
3024
export interface ToolParamsMap {
3125
add_message: AddMessageParams
32-
add_subgoal: AddSubgoalParams
33-
browser_logs: BrowserLogsParams
3426
code_search: CodeSearchParams
35-
create_plan: CreatePlanParams
3627
end_turn: EndTurnParams
3728
find_files: FindFilesParams
3829
read_docs: ReadDocsParams
@@ -42,11 +33,8 @@ export interface ToolParamsMap {
4233
set_messages: SetMessagesParams
4334
set_output: SetOutputParams
4435
spawn_agents: SpawnAgentsParams
45-
spawn_agents_async: SpawnAgentsAsyncParams
46-
spawn_agent_inline: SpawnAgentInlineParams
4736
str_replace: StrReplaceParams
4837
think_deeply: ThinkDeeplyParams
49-
update_subgoal: UpdateSubgoalParams
5038
web_search: WebSearchParams
5139
write_file: WriteFileParams
5240
}
@@ -59,34 +47,6 @@ export interface AddMessageParams {
5947
content: string
6048
}
6149

62-
/**
63-
* Add a new subgoal for tracking progress. To be used for complex requests that can't be solved in a single step, as you may forget what happened!
64-
*/
65-
export interface AddSubgoalParams {
66-
/** A unique identifier for the subgoal. Try to choose the next sequential integer that is not already in use. */
67-
id: string
68-
/** The objective of the subgoal, concisely and clearly stated. */
69-
objective: string
70-
/** The status of the subgoal. */
71-
status: 'NOT_STARTED' | 'IN_PROGRESS' | 'COMPLETE' | 'ABORTED'
72-
/** A plan for the subgoal. */
73-
plan?: string
74-
/** A log message for the subgoal progress. */
75-
log?: string
76-
}
77-
78-
/**
79-
* Parameters for browser_logs tool
80-
*/
81-
export interface BrowserLogsParams {
82-
/** The type of browser action to perform (e.g., "navigate"). */
83-
type: string
84-
/** The URL to navigate to. */
85-
url: string
86-
/** When to consider navigation successful. Defaults to 'load'. */
87-
waitUntil?: 'load' | 'domcontentloaded' | 'networkidle0'
88-
}
89-
9050
/**
9151
* Search for string patterns in the project's files. This tool uses ripgrep (rg), a fast line-oriented search tool. Use this tool only when read_files is not sufficient to find the files you need.
9252
*/
@@ -99,16 +59,6 @@ export interface CodeSearchParams {
9959
cwd?: string
10060
}
10161

102-
/**
103-
* Generate a detailed markdown plan for complex tasks.
104-
*/
105-
export interface CreatePlanParams {
106-
/** The path including the filename of a markdown file that will be overwritten with the plan. */
107-
path: string
108-
/** A detailed plan to solve the user's request. */
109-
plan: string
110-
}
111-
11262
/**
11363
* End your turn, regardless of any new tool results that might be coming. This will allow the user to type another prompt.
11464
*/
@@ -193,32 +143,6 @@ export interface SpawnAgentsParams {
193143
}[]
194144
}
195145

196-
/**
197-
* Parameters for spawn_agents_async tool
198-
*/
199-
export interface SpawnAgentsAsyncParams {
200-
agents: {
201-
/** Agent to spawn */
202-
agent_type: string
203-
/** Prompt to send to the agent */
204-
prompt?: string
205-
/** Parameters object for the agent (if any) */
206-
params?: Record<string, any>
207-
}[]
208-
}
209-
210-
/**
211-
* Spawn a single agent that runs within the current message history.
212-
*/
213-
export interface SpawnAgentInlineParams {
214-
/** Agent to spawn */
215-
agent_type: string
216-
/** Prompt to send to the agent */
217-
prompt?: string
218-
/** Parameters object for the agent (if any) */
219-
params?: Record<string, any>
220-
}
221-
222146
/**
223147
* Replace strings in a file with new strings.
224148
*/
@@ -242,20 +166,6 @@ export interface ThinkDeeplyParams {
242166
thought: string
243167
}
244168

245-
/**
246-
* Update a subgoal in the context given the id, and optionally the status or plan, or a new log to append. Feel free to update any combination of the status, plan, or log in one invocation.
247-
*/
248-
export interface UpdateSubgoalParams {
249-
/** The id of the subgoal to update. */
250-
id: string
251-
/** Change the status of the subgoal. */
252-
status?: 'NOT_STARTED' | 'IN_PROGRESS' | 'COMPLETE' | 'ABORTED'
253-
/** Change the plan for the subgoal. */
254-
plan?: string
255-
/** Add a log message to the subgoal. This will create a new log entry and append it to the existing logs. Use this to record your progress and any new information you learned as you go. */
256-
log?: string
257-
}
258-
259169
/**
260170
* Search the web for current information using Linkup API.
261171
*/

sdk/src/types/agent-definition.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,13 @@ export type TerminalTools = 'run_terminal_command' | 'run_file_change_hooks'
231231
/**
232232
* Web and browser tools
233233
*/
234-
export type WebTools = 'browser_logs' | 'web_search' | 'read_docs'
234+
export type WebTools = 'web_search' | 'read_docs'
235235

236236
/**
237237
* Agent management tools
238238
*/
239239
export type AgentTools =
240240
| 'spawn_agents'
241-
| 'spawn_agents_async'
242-
| 'send_agent_message'
243241
| 'set_messages'
244242
| 'add_message'
245243

@@ -248,9 +246,6 @@ export type AgentTools =
248246
*/
249247
export type PlanningTools =
250248
| 'think_deeply'
251-
| 'create_plan'
252-
| 'add_subgoal'
253-
| 'update_subgoal'
254249

255250
/**
256251
* Output and control tools

0 commit comments

Comments
 (0)