diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-15 17:16:08 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-15 17:16:08 +0100 |
| commit | 14e56289391ea95b493c2a20c87f8d88047aa051 (patch) | |
| tree | d0acf1cc35369688d92c781e31fb7afc30c38b7a /src/agent.rs | |
| parent | 0.5.3: session locking, UTF-8 and size guards for edit, correct character widths (diff) | |
| download | agent686-14e56289391ea95b493c2a20c87f8d88047aa051.tar.gz agent686-14e56289391ea95b493c2a20c87f8d88047aa051.zip | |
0.6.0: transcript viewer, turn summary, yolo floor, model/version records
- --show renders a session without locking it
- status line summarises writes, commands and denials per turn
- sessions record harness version; model switches are appended and listed
- --yolo refuses $HOME and / unless AGENT686_ALLOW_HOME=1
Diffstat (limited to '')
| -rw-r--r-- | src/agent.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/agent.rs b/src/agent.rs index d574934..4bf19ed 100644 --- a/src/agent.rs +++ b/src/agent.rs | |||
| @@ -9,7 +9,7 @@ use crate::config::Config; | |||
| 9 | use crate::provider::{self, Error, Outcome}; | 9 | use crate::provider::{self, Error, Outcome}; |
| 10 | use crate::session::Session; | 10 | use crate::session::Session; |
| 11 | use crate::tools::{self, Approval}; | 11 | use crate::tools::{self, Approval}; |
| 12 | use crate::ui::{self, Approver, Renderer}; | 12 | use crate::ui::{self, Approver, Renderer, Summary}; |
| 13 | 13 | ||
| 14 | /// Frozen for the life of the session. Anything session-varying added here | 14 | /// Frozen for the life of the session. Anything session-varying added here |
| 15 | /// invalidates the provider's prompt cache, so keep it boring. | 15 | /// invalidates the provider's prompt cache, so keep it boring. |
| @@ -128,6 +128,8 @@ pub struct TurnReport { | |||
| 128 | pub steps: usize, | 128 | pub steps: usize, |
| 129 | pub aborted: bool, | 129 | pub aborted: bool, |
| 130 | pub denied: usize, | 130 | pub denied: usize, |
| 131 | pub writes: usize, | ||
| 132 | pub commands: usize, | ||
| 131 | } | 133 | } |
| 132 | 134 | ||
| 133 | pub enum ToolOutcome { | 135 | pub enum ToolOutcome { |
| @@ -188,6 +190,7 @@ pub fn run_turn( | |||
| 188 | let mut last: Option<Outcome> = None; | 190 | let mut last: Option<Outcome> = None; |
| 189 | let mut aborted = false; | 191 | let mut aborted = false; |
| 190 | let mut denied = 0usize; | 192 | let mut denied = 0usize; |
| 193 | let mut summary = Summary::default(); | ||
| 191 | let mut truncated: Option<String> = None; | 194 | let mut truncated: Option<String> = None; |
| 192 | 195 | ||
| 193 | loop { | 196 | loop { |
| @@ -248,6 +251,13 @@ pub fn run_turn( | |||
| 248 | }; | 251 | }; |
| 249 | if result.denied() { | 252 | if result.denied() { |
| 250 | denied += 1; | 253 | denied += 1; |
| 254 | summary.denied += 1; | ||
| 255 | } else if !aborted { | ||
| 256 | match call.name.as_str() { | ||
| 257 | "write" | "edit" => summary.writes += 1, | ||
| 258 | "bash" => summary.commands += 1, | ||
| 259 | _ => {} | ||
| 260 | } | ||
| 251 | } | 261 | } |
| 252 | ui::tool_result(&result.summary(), aborted); | 262 | ui::tool_result(&result.summary(), aborted); |
| 253 | let message = json!({ | 263 | let message = json!({ |
| @@ -270,12 +280,14 @@ pub fn run_turn( | |||
| 270 | eprintln!("agent686: {note}"); | 280 | eprintln!("agent686: {note}"); |
| 271 | } | 281 | } |
| 272 | if let Some(outcome) = last { | 282 | if let Some(outcome) = last { |
| 273 | ui::status(steps, started.elapsed(), &outcome); | 283 | ui::status(steps, started.elapsed(), &outcome, &summary); |
| 274 | } | 284 | } |
| 275 | Ok(TurnReport { | 285 | Ok(TurnReport { |
| 276 | steps, | 286 | steps, |
| 277 | aborted, | 287 | aborted, |
| 278 | denied, | 288 | denied, |
| 289 | writes: summary.writes, | ||
| 290 | commands: summary.commands, | ||
| 279 | }) | 291 | }) |
| 280 | } | 292 | } |
| 281 | 293 | ||
