summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-06-19 14:53:03 -0600
committert <t@tjp.lol>2026-06-19 14:55:35 -0600
commit81ddb61dcfcc9bc85585f262bf303e1a9da507b0 (patch)
treeb38b39a937de047d35246a3e64df6fda5737850e /src
parent270cd00129551647e7c764a13836e03e0b2dc4e2 (diff)
libpanto fixes
- ensuring stream.next() sequences are interruptible - Agent.run() takes any user message, not just chat text
Diffstat (limited to 'src')
-rw-r--r--src/tui_app.zig10
1 files changed, 7 insertions, 3 deletions
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):