From 81ddb61dcfcc9bc85585f262bf303e1a9da507b0 Mon Sep 17 00:00:00 2001 From: t Date: Fri, 19 Jun 2026 14:53:03 -0600 Subject: libpanto fixes - ensuring stream.next() sequences are interruptible - Agent.run() takes any user message, not just chat text --- src/tui_app.zig | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/tui_app.zig b/src/tui_app.zig index 4313556..88c2c66 100644 --- a/src/tui_app.zig +++ b/src/tui_app.zig @@ -1947,7 +1947,7 @@ fn handleSubmittedLine(app: *App, term: *Terminal, line: []const u8, opts: RunOp return; }; - driveTurn(app, term, opts, .{ .text = line }) catch |err| { + driveTurn(app, term, opts, line) catch |err| { try app.routeError(err); }; try app.renderNow(); @@ -2025,8 +2025,12 @@ fn tryAdaptiveFallback(app: *App, err: anyerror) bool { /// component state until it terminates, rendering coalesced frames as deltas /// arrive. The stream is always `deinit`ed (persisting the turn tail) on every /// exit path — agent persistence is untouched. -fn driveTurn(app: *App, term: *Terminal, opts: RunOptions, message: panto.UserMessage) !void { - var stream = try opts.agent.run(message); +fn driveTurn(app: *App, term: *Terminal, opts: RunOptions, message_text: []const u8) !void { + // Open the turn from a single user text block; `run` adopts the block. + var blocks = [_]panto.ContentBlock{ + .{ .Text = try panto.textualBlockFromSlice(app.alloc, message_text) }, + }; + var stream = try opts.agent.run(.{ .blocks = &blocks }); defer stream.deinit(); // Two single-shot fallbacks can re-open the SAME turn (no user-message // duplication): -- cgit v1.3