Reason Network: your team's coding agents, talking to each other. The engine behind `reason network`.
Rust agent-to-agentai-agentsclaude-codecodexcoding-agentscursorgrokirohmcpmcp-servermulti-agentpeer-to-peerreason
Review fixes: the whole question shown, notes in any language on Windows
Lars Talian41fa7c831199
diff --git a/DESIGN.md b/DESIGN.mdindex fa123e2..ad29f03 100644--- a/DESIGN.md+++ b/DESIGN.md@@ -191,9 +191,8 @@ Three tools, none of which an agent has to call unless it wants to message someoyour machines that is on (an agent that needs its user).- `check_inbox(wait_secs?)`: unread messages; can block waiting for a reply.- `ask_user(question)`: asks the session's own person with a pop-up on its machine and waits (up to 10 minutes) for- Approve or Deny, with a note: on macOS a floating panel that doesn't take the keyboard (Return approves once it is- clicked into, Escape denies), on Windows a toast with a note box, on Linux a notification with buttons (no note;- libnotify 0.7.10+). The answer is the tool's result, not a message: only the pop-up on that machine gives it. One+ Approve or Deny, with a note: on macOS and Windows a floating panel that doesn't take the keyboard (Return approves+ once it is clicked into, Escape denies), on Linux a notification with buttons (no note; libnotify 0.7.10+). The answer is the tool's result, not a message: only the pop-up on that machine gives it. Onequestion per session is up at a time (asking it again waits for it, another is refused until then); it stays up anhour, and an answer after the call gave up comes as an ordinary message from `<person>/terminal`. No desktop: anerror, so the agent asks in its own session.diff --git a/src/daemon/ask.rs b/src/daemon/ask.rsindex 35707a7..a4b498e 100644--- a/src/daemon/ask.rs+++ b/src/daemon/ask.rs@@ -68,7 +68,8 @@ impl Daemon {let waiting = Waiting { daemon: self, key: &key };let deadline = tokio::time::Instant::now() + Duration::from_secs(MAX_WAIT);loop {- // The answer, and the client giving up on the call (`StopWaiting`), both wake `arrived`.+ // The answer, and the client giving up on the call (`StopWaiting`), both wake `arrived`. Giving up is per+ // session: its other waits end too, and their answer comes as a message.let woke = self.arrived.notified();tokio::pin!(woke);woke.as_mut().enable();@@ -225,6 +226,7 @@ function run([title, question, secs, icon]) {panel.title = titlepanel.level = 8panel.becomesKeyOnlyIfNeeded = true+ panel.collectionBehavior = 1 | 256 // on every Space, and over full-screen appsconst put = (view, x, y, w, vh) => { view.frame = $.NSMakeRect(x, y, w, vh); panel.contentView.addSubview(view) }put(label, 86, 84, 330, h)const image = icon && $.NSImage.alloc.initWithContentsOfFile(icon)@@ -252,12 +254,18 @@ function run([title, question, secs, icon]) {#[cfg(target_os = "macos")]fn dialog(title: &str, question: &str) -> Option<Command> {let mut cmd = Command::new(crate::agent::find_bin("osascript")?);- let question: String = util::printable(question).trim().chars().take(1500).collect();let icon = icon().map(|p| p.display().to_string()).unwrap_or_default();- cmd.args(["-l", "JavaScript", "-e", PANEL, title, &question, &OPEN_SECS.to_string(), &icon]);+ cmd.args(["-l", "JavaScript", "-e", PANEL, title, &clip(question), &OPEN_SECS.to_string(), &icon]);Some(cmd)}+/// What a panel shows of a question: as much as fits, marked where it is cut.+#[cfg(any(target_os = "macos", windows))]+fn clip(question: &str) -> String {+ let q = util::printable(question).trim().to_string();+ if q.chars().count() <= 900 { q } else { format!("{}…", q.chars().take(900).collect::<String>().trim_end()) }+}+/// Reason's icon for the panel, kept beside the network's database.#[cfg(target_os = "macos")]fn icon() -> Option<std::path::PathBuf> {@@ -286,14 +294,14 @@ fn dialog(title: &str, question: &str) -> Option<Command> {#[cfg(windows)]fn dialog(title: &str, question: &str) -> Option<Command> {const PANEL: &str = r#"$ErrorActionPreference = 'Stop'+[Console]::OutputEncoding = [Text.Encoding]::UTF8Add-Type -AssemblyName System.Windows.Forms, System.Drawing-# Shown on top without taking the keyboard: what's typed elsewhere can't answer it; once clicked into, Return approves.Add-Type -WarningAction SilentlyContinue -ReferencedAssemblies System.Windows.Forms -TypeDefinition 'public class AskPanel : System.Windows.Forms.Form { protected override bool ShowWithoutActivation { get { return true; } } }'$f = New-Object AskPanel$f.Text = $env:TINCAN_TITLE; $f.TopMost = $true; $f.StartPosition = 'CenterScreen'; $f.FormBorderStyle = 'FixedDialog'$f.MinimizeBox = $false; $f.MaximizeBox = $false; $f.AutoSize = $true; $f.AutoSizeMode = 'GrowAndShrink'; $f.Padding = 12$l = New-Object Windows.Forms.FlowLayoutPanel; $l.FlowDirection = 'TopDown'; $l.AutoSize = $true-$q = New-Object Windows.Forms.Label; $q.Text = $env:TINCAN_BODY; $q.AutoSize = $true; $q.MaximumSize = '420,320'+$q = New-Object Windows.Forms.Label; $q.UseMnemonic = $false; $q.Text = $env:TINCAN_BODY; $q.AutoSize = $true; $q.MaximumSize = '420,320'$note = New-Object Windows.Forms.TextBox; $note.Width = 420$b = New-Object Windows.Forms.FlowLayoutPanel; $b.FlowDirection = 'RightToLeft'; $b.Width = 420; $b.Height = 34$yes = New-Object Windows.Forms.Button; $yes.Text = 'Approve'; $no = New-Object Windows.Forms.Button; $no.Text = 'Deny'@@ -306,6 +314,6 @@ $t = New-Object Windows.Forms.Timer; $t.Interval = [int]$env:TINCAN_SECS * 1000;[Windows.Forms.Application]::Run($f)$script:choice"#;let mut cmd = super::notify::powershell(PANEL)?;- cmd.env("TINCAN_TITLE", title).env("TINCAN_BODY", question).env("TINCAN_SECS", OPEN_SECS.to_string());+ cmd.env("TINCAN_TITLE", title).env("TINCAN_BODY", clip(question)).env("TINCAN_SECS", OPEN_SECS.to_string());Some(cmd)}