mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-07-31 09:46:05 -04:00
fix(agent): keep streaming off for suppressed turns
Streaming wrote assistant deltas straight to stdout regardless of `suppress_answer`, so `--save`/capture turns (which set it to hide the answer) leaked model text past the `runTurn` guard. Pass a null stream hook when the turn's answer is suppressed.
This commit is contained in:
@@ -1703,7 +1703,9 @@ fn processUserMessage(self: *Agent, input: TurnInput) !?[]const u8 {
|
||||
// non-thinking models.
|
||||
.effort = self.effort,
|
||||
.cancel = .{ .context = @ptrCast(self), .checkFn = checkCancel },
|
||||
.stream = self.streamHook(),
|
||||
// Suppressed turns (e.g. `--save` capture) must keep stdout clean;
|
||||
// streaming would bypass the `suppress_answer` guard in `runTurn`.
|
||||
.stream = if (input.suppress_answer) null else self.streamHook(),
|
||||
},
|
||||
) catch |err| {
|
||||
self.endStreamedText();
|
||||
@@ -1790,7 +1792,7 @@ fn processUserMessage(self: *Agent, input: TurnInput) !?[]const u8 {
|
||||
// `.none` stays off to opt out on models that reject it.
|
||||
.effort = if (self.effort == .none) .none else .low,
|
||||
.cancel = .{ .context = @ptrCast(self), .checkFn = checkCancel },
|
||||
.stream = self.streamHook(),
|
||||
.stream = if (input.suppress_answer) null else self.streamHook(),
|
||||
},
|
||||
) catch |err| {
|
||||
self.endStreamedText();
|
||||
|
||||
Reference in New Issue
Block a user