This commit is contained in:
Classic298 2026-09-30 11:11:12 -04:00 • committed by GitHub
commit fd13573ad3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1437,17 +1437,12 @@ async def get_terminal_tools(
function_name = spec['name']
tool_spec = clean_openai_tool_schema(add_terminal_display_file_inline_param(spec))
if function_name == 'run_command' and terminal_cwd:
tool_spec['description'] = (
tool_spec.get('description', '') + f'\n\nThe current working directory is: {terminal_cwd}'
)
async def make_tool_function(fn_name, srv_data, hdrs, cks):
async def tool_function(**kwargs):
params = dict(kwargs)
if fn_name == 'display_file':
params.pop('page', None)
return await execute_tool_server(
data, response_headers = await execute_tool_server(
url=srv_data['url'],
headers=hdrs,
cookies=cks,
@ -1455,6 +1450,11 @@ async def get_terminal_tools(
params=params,
server_data=srv_data,
)
# Reported with the result so the tool description, and the cached prompt prefix, stay the same
is_command_result = fn_name == 'run_command' and response_headers is not None and isinstance(data, dict)
if is_command_result and terminal_cwd and not params.get('cwd'):
data['cwd'] = terminal_cwd
return data, response_headers
return tool_function