harness: markdown tool bubble (bold names, fenced outputs, --- separator) + streamed reply message; letta: structured tool_call/tool_return events, escaped-key arg extraction; matrix: editText with formatted_body

Fixes included: bubble body off-by-one, reply chunk duplication, use-after-free in escaped-key truncation, fence/header concatenation swallowing headers, Read file_path arg extraction.

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta Code <noreply@letta.com>
This commit is contained in:
pierreandLetta Code committed 2026-09-20 15:26:12 +03:00
1 parent 8d89e3baeb
commit 81fcbabefc
4 files changed
+209 -54

No files matched your search

+9 -2
View File
@@ -355,19 +355,26 @@ pub fn sendText(alloc: std.mem.Allocator, io: Io, token: []const u8, room: []con
}
/// Edit an existing m.text message in place (m.replace). `orig_event_id` is
/// the event being replaced; `new_body` is the full replacement text. The
/// plain-text `body` carries the "* " legacy-edit prefix for old clients.
/// the event being replaced; `new_body` is the full replacement text
/// (markdown — rendered via formatted_body, with plain-text fallback).
pub fn editText(alloc: std.mem.Allocator, io: Io, token: []const u8, room: []const u8, orig_event_id: []const u8, new_body: []const u8) ![]u8 {
const ts = Io.Clock.now(.real, io).nanoseconds;
const url = try std.fmt.allocPrint(alloc, "{s}/_matrix/client/v3/rooms/{s}/send/m.room.message/infr-edit-{d}", .{ HOMESERVER, room, ts });
defer alloc.free(url);
const html = markdownToHtml(alloc, new_body) catch |e| switch (e) {
error.OutOfMemory => return e,
};
defer alloc.free(html);
var payload: std.ArrayList(u8) = .empty;
defer payload.deinit(alloc);
try payload.appendSlice(alloc, "{\"msgtype\":\"m.text\",\"body\":\"* ");
try jsonEscape(alloc, &payload, new_body);
try payload.appendSlice(alloc, "\",\"m.new_content\":{\"msgtype\":\"m.text\",\"body\":\"");
try jsonEscape(alloc, &payload, new_body);
try payload.appendSlice(alloc, "\",\"format\":\"org.matrix.custom.html\",\"formatted_body\":\"");
try jsonEscape(alloc, &payload, html);
try payload.appendSlice(alloc, "\"},\"m.relates_to\":{\"rel_type\":\"m.replace\",\"event_id\":\"");
try jsonEscape(alloc, &payload, orig_event_id);
try payload.appendSlice(alloc, "\"}}");