fix: patch TODO (#47)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2025-10-31 15:46:19 -07:00
committed by GitHub
parent bb6a41b490
commit 63d0034fd7
2 changed files with 8 additions and 5 deletions

View File

@@ -58,7 +58,8 @@ export const ToolCallMessage = memo(({ line }: { line: ToolCallLine }) => {
else if (displayName === "grep") displayName = "Grep";
else if (displayName === "glob") displayName = "Glob";
else if (displayName === "ls") displayName = "LS";
else if (displayName === "todo_write") displayName = "Update Todos";
else if (displayName === "todo_write") displayName = "TODO";
else if (displayName === "TodoWrite") displayName = "TODO";
else if (displayName === "ExitPlanMode") displayName = "Planning";
// Format arguments for display using the old formatting logic
@@ -128,11 +129,12 @@ export const ToolCallMessage = memo(({ line }: { line: ToolCallLine }) => {
const displayResultText = clipToolReturn(line.resultText);
// Check if this is a todo_write tool with successful result
// Check both the raw name and the display name since it might be "TodoWrite"
// Check both the raw name and the display name
const isTodoTool =
rawName === "todo_write" ||
rawName === "TodoWrite" ||
displayName === "Update Todos";
displayName === "TODO";
if (isTodoTool && line.resultOk !== false && line.argsText) {
try {
const parsedArgs = JSON.parse(line.argsText);

View File

@@ -367,10 +367,11 @@ export function onChunk(b: Buffers, chunk: LettaStreamingResponse) {
}
// if argsText is not empty, add it to the line (immutable update)
if (argsText !== undefined) {
// Skip if argsText is undefined or null (backend sometimes sends null)
if (argsText !== undefined && argsText !== null) {
const updatedLine = {
...line,
argsText: (line.argsText ?? "") + argsText,
argsText: (line.argsText || "") + argsText,
};
b.byId.set(id, updatedLine);
}