(input: Partial<PowerShellToolInput>, {
verbose,
theme: _theme
}: {
verbose: boolean;
theme: ThemeName;
})
| 17 | const MAX_COMMAND_DISPLAY_LINES = 2; |
| 18 | const MAX_COMMAND_DISPLAY_CHARS = 160; |
| 19 | export function renderToolUseMessage(input: Partial<PowerShellToolInput>, { |
| 20 | verbose, |
| 21 | theme: _theme |
| 22 | }: { |
| 23 | verbose: boolean; |
| 24 | theme: ThemeName; |
| 25 | }): React.ReactNode { |
| 26 | const { |
| 27 | command |
| 28 | } = input; |
| 29 | if (!command) { |
| 30 | return null; |
| 31 | } |
| 32 | const displayCommand = command; |
| 33 | if (!verbose) { |
| 34 | const lines = displayCommand.split('\n'); |
| 35 | const needsLineTruncation = lines.length > MAX_COMMAND_DISPLAY_LINES; |
| 36 | const needsCharTruncation = displayCommand.length > MAX_COMMAND_DISPLAY_CHARS; |
| 37 | if (needsLineTruncation || needsCharTruncation) { |
| 38 | let truncated = displayCommand; |
| 39 | if (needsLineTruncation) { |
| 40 | truncated = lines.slice(0, MAX_COMMAND_DISPLAY_LINES).join('\n'); |
| 41 | } |
| 42 | if (truncated.length > MAX_COMMAND_DISPLAY_CHARS) { |
| 43 | truncated = truncated.slice(0, MAX_COMMAND_DISPLAY_CHARS); |
| 44 | } |
| 45 | return <Text>{truncated.trim()}…</Text>; |
| 46 | } |
| 47 | } |
| 48 | return displayCommand; |
| 49 | } |
| 50 | export function renderToolUseProgressMessage(progressMessagesForMessage: ProgressMessage<PowerShellProgress>[], { |
| 51 | verbose, |
| 52 | tools: _tools, |
nothing calls this directly
no outgoing calls
no test coverage detected