Skip to content

Reason Network: your team's coding agents, talking to each other. The engine behind `reason network`.

Plugin hooks run without a console window on Windows; Reason Network 0.12.4 (#97)

sven myhre8454a01af2f3
diff --git a/Cargo.lock b/Cargo.lock
index bdb35c4..39b9a1d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2756,7 +2756,7 @@ dependencies = [
[[package]]
name = "reason-network"
-version = "0.12.3"
+version = "0.12.4"
dependencies = [
"anyhow",
"blake3",
diff --git a/Cargo.toml b/Cargo.toml
index 31ded79..e83141b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "reason-network"
-version = "0.12.3"
+version = "0.12.4"
edition = "2024"
description = "Reason Network: the team directory and message bus behind reason network, for coding agents across machines"
license = "MIT OR Apache-2.0"
diff --git a/src/git.rs b/src/git.rs
index fa52026..7856cf8 100644
--- a/src/git.rs
+++ b/src/git.rs
@@ -10,7 +10,12 @@ pub struct GitInfo {
pub fn lookup(cwd: &str) -> GitInfo {
let run = |args: &[&str]| {
- let out = Command::new("git").arg("-C").arg(cwd).args(args).stderr(Stdio::null()).output().ok()?;
+ let mut cmd = Command::new("git");
+ cmd.arg("-C").arg(cwd).args(args).stderr(Stdio::null());
+ // CREATE_NO_WINDOW: `reason-network mcp` started by an agent without a console would flash one per lookup.
+ #[cfg(windows)]
+ std::os::windows::process::CommandExt::creation_flags(&mut cmd, 0x0800_0000);
+ let out = cmd.output().ok()?;
let s = String::from_utf8_lossy(&out.stdout).trim().to_string();
(out.status.success() && !s.is_empty()).then_some(s)
};
diff --git a/src/opencode-plugin.ts b/src/opencode-plugin.ts
index a157398..8c92b74 100644
--- a/src/opencode-plugin.ts
+++ b/src/opencode-plugin.ts
@@ -6,9 +6,13 @@ import { execFile } from "node:child_process"
const ENGINE = "__ENGINE_EXE__"
+// windowsHide: opencode's background server has no console on Windows, so each call (a poll every few seconds per
+// idle session) would open a console window of its own that closes at once.
const run = (args: string[], cwd: string) =>
new Promise<string>((resolve) =>
- execFile(ENGINE, args, { cwd, timeout: 10_000 }, (err, out) => resolve(err ? "" : String(out).trim())),
+ execFile(ENGINE, args, { cwd, timeout: 10_000, windowsHide: true }, (err, out) =>
+ resolve(err ? "" : String(out).trim()),
+ ),
)
// What both plugin formats share; `prompt` puts a teammate's message into a session.
diff --git a/src/pi-extension.ts b/src/pi-extension.ts
index 07b7070..8cfa1f8 100644
--- a/src/pi-extension.ts
+++ b/src/pi-extension.ts
@@ -13,10 +13,14 @@ export default function (pi: ExtensionAPI) {
let delivering = false
let timer: ReturnType<typeof setInterval> | undefined
+ // windowsHide: on Windows a pi without a console (started by an editor or a GUI) would flash a window per call.
const hook = (args: string[]) =>
new Promise<string>((resolve) =>
- execFile(ENGINE, ["hook", "pi", ...args, "--session", id], { cwd, timeout: 10_000 }, (err, out) =>
- resolve(err ? "" : String(out).trim()),
+ execFile(
+ ENGINE,
+ ["hook", "pi", ...args, "--session", id],
+ { cwd, timeout: 10_000, windowsHide: true },
+ (err, out) => resolve(err ? "" : String(out).trim()),
),
)
// Mid-run, only what should interrupt it ("post-tool-use"); once idle, everything ("poll").