feat: add pretty preview for LS tool in approval dialog (#13)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2025-10-27 14:58:45 -07:00
committed by GitHub
parent 8cc0464b48
commit 43483c77a5

View File

@@ -82,6 +82,23 @@ const DynamicPreview: React.FC<DynamicPreviewProps> = ({
);
}
if (t === "ls") {
const pathVal = parsedArgs?.path;
const path = typeof pathVal === "string" ? pathVal : "(current directory)";
const ignoreVal = parsedArgs?.ignore;
const ignore =
Array.isArray(ignoreVal) && ignoreVal.length > 0
? ` (ignoring: ${ignoreVal.join(", ")})`
: "";
return (
<Box flexDirection="column" paddingLeft={2}>
<Text>List files in: {path}</Text>
{ignore ? <Text dimColor>{ignore}</Text> : null}
</Box>
);
}
// File edit previews: write/edit/multi_edit
if ((t === "write" || t === "edit" || t === "multiedit") && parsedArgs) {
try {