From 50fd416d49c86451462e8d49c9fea1b3f5584d93 Mon Sep 17 00:00:00 2001 From: Adam <2363879+adamdotdevin@users.noreply.github.com> Date: Thu, 27 Nov 2025 05:05:55 -0600 Subject: fix: simpler sanitize --- packages/ui/src/components/message-part.tsx | 36 +++++++++-------------------- 1 file changed, 11 insertions(+), 25 deletions(-) (limited to 'packages/ui/src') diff --git a/packages/ui/src/components/message-part.tsx b/packages/ui/src/components/message-part.tsx index 40740fa1f..74aa3d98a 100644 --- a/packages/ui/src/components/message-part.tsx +++ b/packages/ui/src/components/message-part.tsx @@ -17,7 +17,7 @@ import { Diff } from "./diff" import { DiffChanges } from "./diff-changes" import { Markdown } from "./markdown" import { getDirectory, getFilename } from "@opencode-ai/util/path" -import { sanitize, sanitizePart } from "@opencode-ai/util/sanitize" +import { sanitizePart } from "@opencode-ai/util/sanitize" export interface MessageProps { message: MessageType @@ -83,15 +83,10 @@ export function UserMessageDisplay(props: { message: UserMessage; parts: PartTyp export function Part(props: MessagePartProps) { const component = createMemo(() => PART_MAPPING[props.part.type]) + const part = createMemo(() => sanitizePart(props.part, props.sanitize)) return ( - + ) } @@ -102,7 +97,6 @@ export interface ToolProps { tool: string output?: string hideDetails?: boolean - sanitize?: RegExp } export type ToolComponent = Component @@ -170,7 +164,6 @@ PART_MAPPING["tool"] = function ToolPartDisplay(props) { metadata={metadata} output={part.state.status === "completed" ? part.state.output : undefined} hideDetails={props.hideDetails} - sanitize={props.sanitize} /> @@ -211,7 +204,7 @@ ToolRegistry.register({ icon="glasses" trigger={{ title: "Read", - subtitle: props.input.filePath ? getFilename(sanitize(props.input.filePath, props.sanitize)) : "", + subtitle: props.input.filePath ? getFilename(props.input.filePath) : "", }} /> ) @@ -222,12 +215,9 @@ ToolRegistry.register({ name: "list", render(props) { return ( - + -
{sanitize(props.output, props.sanitize)}
+
{props.output}
) @@ -335,7 +325,7 @@ ToolRegistry.register({ >
@@ -355,13 +345,9 @@ ToolRegistry.register({
Edit
- - {getDirectory(sanitize(props.input.filePath!, props.sanitize))} - + {getDirectory(props.input.filePath!)} - - {getFilename(sanitize(props.input.filePath ?? "", props.sanitize))} - + {getFilename(props.input.filePath ?? "")}
@@ -376,11 +362,11 @@ ToolRegistry.register({
-- cgit v1.2.3