Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

local-shell-tool.ts

38 lines1005 Bytes

1import { openAIProviderTool } from './openai-provider-tool'
2import type { Tool as SDKTool } from 'openai/resources/responses/responses'
3import type { Tool } from '@tanstack/ai'
4​
5type LocalShellToolConfig = SDKTool.LocalShell
6​
7export type { LocalShellToolConfig }
8​
9/** @deprecated Renamed to `LocalShellToolConfig`. Will be removed in a future release. */
10export type LocalShellTool = LocalShellToolConfig
11​
12/**
13 * Converts a standard Tool to OpenAI LocalShellTool format
14 */
15export function convertLocalShellToolToAdapterFormat(
16 _tool: Tool,
17): LocalShellToolConfig {
18 return {
19 type: 'local_shell',
20 }
22​
23/**
24 * Creates a standard Tool from LocalShellTool parameters.
25 *
26 * Base (non-branded) factory. Providers that need branded return types should
27 * re-wrap this in their own package.
28 */
29export function localShellTool(): Tool {
30 return openAIProviderTool(
31 {
32 name: 'local_shell',
33 description: 'Execute local shell commands',
34 metadata: {},
35 },
36 'local_shell',
37 )