@wolfx/oh-my-openagent 3.17.14 → 3.17.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2770,6 +2770,119 @@ var init_logger = __esm(() => {
2770
2770
  buffer = [];
2771
2771
  });
2772
2772
 
2773
+ // src/shared/bun-spawn-shim.ts
2774
+ import { spawn as nodeSpawn, spawnSync as nodeSpawnSync } from "child_process";
2775
+ import { Readable, Writable } from "stream";
2776
+ function emptyReadableStream() {
2777
+ return new ReadableStream({
2778
+ start(controller) {
2779
+ controller.close();
2780
+ }
2781
+ });
2782
+ }
2783
+ function toReadableStream(stream) {
2784
+ if (!stream)
2785
+ return emptyReadableStream();
2786
+ return Readable.toWeb(stream);
2787
+ }
2788
+ function emptyWritableStream() {
2789
+ return new Writable({
2790
+ write(_chunk, _encoding, callback) {
2791
+ callback();
2792
+ }
2793
+ });
2794
+ }
2795
+ function resolveCommand(cmdOrOpts, optsArg) {
2796
+ const isObj = !Array.isArray(cmdOrOpts);
2797
+ const opts = isObj ? cmdOrOpts : optsArg ?? {};
2798
+ return {
2799
+ cmd: isObj ? cmdOrOpts.cmd : cmdOrOpts,
2800
+ opts
2801
+ };
2802
+ }
2803
+ function resolveStdio(options) {
2804
+ if (options.stdio)
2805
+ return options.stdio;
2806
+ return [options.stdin ?? "ignore", options.stdout ?? "pipe", options.stderr ?? "inherit"];
2807
+ }
2808
+ function wrapNodeProcess(proc) {
2809
+ let exitCode = null;
2810
+ const exited = new Promise((resolve5, reject) => {
2811
+ proc.on("exit", (code) => {
2812
+ exitCode = code ?? 1;
2813
+ resolve5(exitCode);
2814
+ });
2815
+ proc.on("error", (error) => {
2816
+ if (exitCode === null) {
2817
+ exitCode = 1;
2818
+ reject(error);
2819
+ }
2820
+ });
2821
+ });
2822
+ return {
2823
+ get exitCode() {
2824
+ return exitCode;
2825
+ },
2826
+ exited,
2827
+ stdout: toReadableStream(proc.stdout),
2828
+ stderr: toReadableStream(proc.stderr),
2829
+ stdin: proc.stdin ?? emptyWritableStream(),
2830
+ kill(signal) {
2831
+ if (proc.killed || exitCode !== null)
2832
+ return;
2833
+ try {
2834
+ proc.kill(signal);
2835
+ } catch (error) {
2836
+ if (!String(error).includes("kill"))
2837
+ throw error;
2838
+ }
2839
+ },
2840
+ pid: proc.pid,
2841
+ ref() {
2842
+ proc.ref();
2843
+ },
2844
+ unref() {
2845
+ proc.unref();
2846
+ }
2847
+ };
2848
+ }
2849
+ function spawn2(cmdOrOpts, opts) {
2850
+ if (IS_BUN)
2851
+ return runtime.Bun.spawn(cmdOrOpts, opts);
2852
+ const { cmd, opts: options } = resolveCommand(cmdOrOpts, opts);
2853
+ const [bin, ...args] = cmd;
2854
+ const proc = nodeSpawn(bin, args, {
2855
+ cwd: options.cwd,
2856
+ env: options.env,
2857
+ stdio: resolveStdio(options),
2858
+ detached: options.detached
2859
+ });
2860
+ return wrapNodeProcess(proc);
2861
+ }
2862
+ function spawnSync(cmdOrOpts, opts) {
2863
+ if (IS_BUN)
2864
+ return runtime.Bun.spawnSync(cmdOrOpts, opts);
2865
+ const { cmd, opts: options } = resolveCommand(cmdOrOpts, opts);
2866
+ const [bin, ...args] = cmd;
2867
+ const result = nodeSpawnSync(bin, args, {
2868
+ cwd: options.cwd,
2869
+ env: options.env,
2870
+ stdio: resolveStdio(options)
2871
+ });
2872
+ return {
2873
+ exitCode: result.status ?? 1,
2874
+ stdout: result.stdout ?? undefined,
2875
+ stderr: result.stderr ?? undefined,
2876
+ success: (result.status ?? 1) === 0,
2877
+ pid: result.pid ?? -1
2878
+ };
2879
+ }
2880
+ var runtime, IS_BUN;
2881
+ var init_bun_spawn_shim = __esm(() => {
2882
+ runtime = globalThis;
2883
+ IS_BUN = typeof runtime.Bun !== "undefined";
2884
+ });
2885
+
2773
2886
  // src/shared/agent-display-names.ts
2774
2887
  function stripInvisibleAgentCharacters(agentName) {
2775
2888
  return agentName.replace(INVISIBLE_AGENT_CHARACTERS_REGEX, "");
@@ -2873,12 +2986,11 @@ __export(exports_tmux_path_resolver, {
2873
2986
  getTmuxPath: () => getTmuxPath,
2874
2987
  getCachedTmuxPath: () => getCachedTmuxPath
2875
2988
  });
2876
- var {spawn: spawn9 } = globalThis.Bun;
2877
2989
  async function findTmuxPath() {
2878
2990
  const isWindows = process.platform === "win32";
2879
2991
  const cmd = isWindows ? "where" : "which";
2880
2992
  try {
2881
- const proc = spawn9([cmd, "tmux"], {
2993
+ const proc = spawn2([cmd, "tmux"], {
2882
2994
  stdout: "pipe",
2883
2995
  stderr: "pipe"
2884
2996
  });
@@ -2892,7 +3004,7 @@ async function findTmuxPath() {
2892
3004
  if (!path6) {
2893
3005
  return null;
2894
3006
  }
2895
- const verifyProc = spawn9([path6, "-V"], {
3007
+ const verifyProc = spawn2([path6, "-V"], {
2896
3008
  stdout: "pipe",
2897
3009
  stderr: "pipe"
2898
3010
  });
@@ -2929,15 +3041,18 @@ function startBackgroundCheck() {
2929
3041
  }
2930
3042
  }
2931
3043
  var tmuxPath = null, initPromise = null;
2932
- var init_tmux_path_resolver = () => {};
3044
+ var init_tmux_path_resolver = __esm(() => {
3045
+ init_bun_spawn_shim();
3046
+ });
2933
3047
 
2934
3048
  // src/shared/tmux/tmux-utils/spawn-process.ts
2935
3049
  var exports_spawn_process = {};
2936
3050
  __export(exports_spawn_process, {
2937
- spawn: () => spawn11
3051
+ spawn: () => spawn2
3052
+ });
3053
+ var init_spawn_process = __esm(() => {
3054
+ init_bun_spawn_shim();
2938
3055
  });
2939
- var {spawn: spawn11 } = globalThis.Bun;
2940
- var init_spawn_process = () => {};
2941
3056
 
2942
3057
  // src/shared/tmux/tmux-utils/session-kill.ts
2943
3058
  var exports_session_kill = {};
@@ -2948,7 +3063,7 @@ async function readStream2(stream) {
2948
3063
  return stream ? new Response(stream).text() : "";
2949
3064
  }
2950
3065
  async function killTmuxSessionIfExists(sessionName) {
2951
- const [{ log: log2 }, { isInsideTmux: isInsideTmux2 }, { getTmuxPath: getTmuxPath2 }, { spawn: spawn15 }] = await Promise.all([
3066
+ const [{ log: log2 }, { isInsideTmux: isInsideTmux2 }, { getTmuxPath: getTmuxPath2 }, { spawn: spawn3 }] = await Promise.all([
2952
3067
  Promise.resolve().then(() => (init_logger(), exports_logger)),
2953
3068
  Promise.resolve().then(() => exports_environment),
2954
3069
  Promise.resolve().then(() => (init_tmux_path_resolver(), exports_tmux_path_resolver)),
@@ -2963,7 +3078,7 @@ async function killTmuxSessionIfExists(sessionName) {
2963
3078
  log2("[killTmuxSessionIfExists] SKIP: tmux not found", { sessionName });
2964
3079
  return false;
2965
3080
  }
2966
- const hasSessionProcess = spawn15([tmux, "has-session", "-t", sessionName], {
3081
+ const hasSessionProcess = spawn3([tmux, "has-session", "-t", sessionName], {
2967
3082
  stdout: "ignore",
2968
3083
  stderr: "ignore"
2969
3084
  });
@@ -2971,7 +3086,7 @@ async function killTmuxSessionIfExists(sessionName) {
2971
3086
  log2("[killTmuxSessionIfExists] SKIP: session not found", { sessionName });
2972
3087
  return false;
2973
3088
  }
2974
- const killSessionProcess = spawn15([tmux, "kill-session", "-t", sessionName], {
3089
+ const killSessionProcess = spawn3([tmux, "kill-session", "-t", sessionName], {
2975
3090
  stdout: "pipe",
2976
3091
  stderr: "pipe"
2977
3092
  });
@@ -15517,10 +15632,10 @@ var require_resolveCommand = __commonJS((exports, module) => {
15517
15632
  }
15518
15633
  return resolved;
15519
15634
  }
15520
- function resolveCommand(parsed) {
15635
+ function resolveCommand2(parsed) {
15521
15636
  return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
15522
15637
  }
15523
- module.exports = resolveCommand;
15638
+ module.exports = resolveCommand2;
15524
15639
  });
15525
15640
 
15526
15641
  // node_modules/cross-spawn/lib/util/escape.js
@@ -15588,19 +15703,19 @@ var require_readShebang = __commonJS((exports, module) => {
15588
15703
  // node_modules/cross-spawn/lib/parse.js
15589
15704
  var require_parse2 = __commonJS((exports, module) => {
15590
15705
  var path15 = __require("path");
15591
- var resolveCommand = require_resolveCommand();
15706
+ var resolveCommand2 = require_resolveCommand();
15592
15707
  var escape2 = require_escape();
15593
15708
  var readShebang = require_readShebang();
15594
15709
  var isWin = process.platform === "win32";
15595
15710
  var isExecutableRegExp = /\.(?:com|exe)$/i;
15596
15711
  var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
15597
15712
  function detectShebang(parsed) {
15598
- parsed.file = resolveCommand(parsed);
15713
+ parsed.file = resolveCommand2(parsed);
15599
15714
  const shebang = parsed.file && readShebang(parsed.file);
15600
15715
  if (shebang) {
15601
15716
  parsed.args.unshift(parsed.file);
15602
15717
  parsed.command = shebang;
15603
- return resolveCommand(parsed);
15718
+ return resolveCommand2(parsed);
15604
15719
  }
15605
15720
  return parsed.file;
15606
15721
  }
@@ -15696,21 +15811,21 @@ var require_cross_spawn = __commonJS((exports, module) => {
15696
15811
  var cp = __require("child_process");
15697
15812
  var parse11 = require_parse2();
15698
15813
  var enoent = require_enoent();
15699
- function spawn21(command, args, options) {
15814
+ function spawn4(command, args, options) {
15700
15815
  const parsed = parse11(command, args, options);
15701
15816
  const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
15702
15817
  enoent.hookChildProcess(spawned, parsed);
15703
15818
  return spawned;
15704
15819
  }
15705
- function spawnSync5(command, args, options) {
15820
+ function spawnSync3(command, args, options) {
15706
15821
  const parsed = parse11(command, args, options);
15707
15822
  const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
15708
15823
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
15709
15824
  return result;
15710
15825
  }
15711
- module.exports = spawn21;
15712
- module.exports.spawn = spawn21;
15713
- module.exports.sync = spawnSync5;
15826
+ module.exports = spawn4;
15827
+ module.exports.spawn = spawn4;
15828
+ module.exports.sync = spawnSync3;
15714
15829
  module.exports._parse = parse11;
15715
15830
  module.exports._enoent = enoent;
15716
15831
  });
@@ -18576,7 +18691,7 @@ Both ${PLUGIN_NAME} and ${pluginName} scan ~/.config/opencode/skills/ and regist
18576
18691
  3. Or uninstall ${PLUGIN_NAME} if you prefer ${pluginName}'s skill management`;
18577
18692
  }
18578
18693
  // src/shared/zip-extractor.ts
18579
- var {spawn: spawn7, spawnSync: spawnSync3 } = globalThis.Bun;
18694
+ init_bun_spawn_shim();
18580
18695
  import { release } from "os";
18581
18696
 
18582
18697
  // src/shared/archive-entry-validator.ts
@@ -18635,7 +18750,7 @@ function validateArchiveEntries(entries, destDir) {
18635
18750
  }
18636
18751
 
18637
18752
  // src/shared/zip-entry-listing/python-zip-entry-listing.ts
18638
- var {spawn: spawn2, spawnSync } = globalThis.Bun;
18753
+ init_bun_spawn_shim();
18639
18754
  function isPythonZipListingAvailable() {
18640
18755
  const proc = spawnSync(["python3", "--version"], {
18641
18756
  stdout: "ignore",
@@ -18681,7 +18796,7 @@ async function listZipEntriesWithPython(archivePath) {
18681
18796
  return JSON.parse(stdout);
18682
18797
  }
18683
18798
  // src/shared/zip-entry-listing/powershell-zip-entry-listing.ts
18684
- var {spawn: spawn3 } = globalThis.Bun;
18799
+ init_bun_spawn_shim();
18685
18800
  function isPowerShellZipEntryRecord(value) {
18686
18801
  if (!value || typeof value !== "object") {
18687
18802
  return false;
@@ -18707,7 +18822,7 @@ function parsePowerShellZipEntryLine(line) {
18707
18822
  };
18708
18823
  }
18709
18824
  async function listZipEntriesWithPowerShell(archivePath, escapePowerShellPath, extractor) {
18710
- const proc = spawn3([
18825
+ const proc = spawn2([
18711
18826
  extractor,
18712
18827
  "-Command",
18713
18828
  [
@@ -18746,8 +18861,8 @@ async function listZipEntriesWithPowerShell(archivePath, escapePowerShellPath, e
18746
18861
  return stdout.split(/\r?\n/).map((line) => line.trim()).filter(Boolean).map((line) => parsePowerShellZipEntryLine(line)).filter((entry) => entry !== null);
18747
18862
  }
18748
18863
  // src/shared/zip-entry-listing/tar-zip-entry-listing.ts
18864
+ init_bun_spawn_shim();
18749
18865
  init_logger();
18750
- var {spawn: spawn4 } = globalThis.Bun;
18751
18866
  function parseTarListedZipEntry(line) {
18752
18867
  const match = line.match(/^([^\s])\S*\s+\d+\s+\S+\s+\S+\s+\d+\s+\w+\s+\d+\s+(?:\d{2}:\d{2}|\d{4})\s+(.*)$/);
18753
18868
  if (!match) {
@@ -18793,7 +18908,7 @@ function parseTarListingOutput(stdout) {
18793
18908
  return parsedEntries;
18794
18909
  }
18795
18910
  async function listZipEntriesWithTar(archivePath) {
18796
- const proc = spawn4(["tar", "-tvf", archivePath], {
18911
+ const proc = spawn2(["tar", "-tvf", archivePath], {
18797
18912
  stdout: "pipe",
18798
18913
  stderr: "pipe"
18799
18914
  });
@@ -18808,12 +18923,12 @@ async function listZipEntriesWithTar(archivePath) {
18808
18923
  return parseTarListingOutput(stdout);
18809
18924
  }
18810
18925
  // src/shared/zip-entry-listing/zipinfo-zip-entry-listing.ts
18811
- var {spawn: spawn6, spawnSync: spawnSync2 } = globalThis.Bun;
18926
+ init_bun_spawn_shim();
18812
18927
 
18813
18928
  // src/shared/zip-entry-listing/read-zip-symlink-target.ts
18814
- var {spawn: spawn5 } = globalThis.Bun;
18929
+ init_bun_spawn_shim();
18815
18930
  async function readZipSymlinkTarget(archivePath, entryPath) {
18816
- const proc = spawn5(["unzip", "-p", archivePath, "--", entryPath], {
18931
+ const proc = spawn2(["unzip", "-p", archivePath, "--", entryPath], {
18817
18932
  stdout: "pipe",
18818
18933
  stderr: "pipe"
18819
18934
  });
@@ -18841,7 +18956,7 @@ function parseZipInfoListedEntry(line) {
18841
18956
  };
18842
18957
  }
18843
18958
  function isZipInfoZipListingAvailable() {
18844
- const proc = spawnSync2(["which", "zipinfo"], {
18959
+ const proc = spawnSync(["which", "zipinfo"], {
18845
18960
  stdout: "ignore",
18846
18961
  stderr: "ignore"
18847
18962
  });
@@ -18854,7 +18969,7 @@ async function listZipEntriesWithZipInfo(archivePath) {
18854
18969
  if (!isZipInfoZipListingAvailable()) {
18855
18970
  throw new Error("zip entry listing requires zipinfo, but zipinfo is not installed");
18856
18971
  }
18857
- const proc = spawn6(["zipinfo", "-l", archivePath], {
18972
+ const proc = spawn2(["zipinfo", "-l", archivePath], {
18858
18973
  stdout: "pipe",
18859
18974
  stderr: "pipe"
18860
18975
  });
@@ -18893,7 +19008,7 @@ function getWindowsBuildNumber() {
18893
19008
  function isPwshAvailable() {
18894
19009
  if (process.platform !== "win32")
18895
19010
  return false;
18896
- const result = spawnSync3(["where", "pwsh"], { stdout: "pipe", stderr: "pipe" });
19011
+ const result = spawnSync(["where", "pwsh"], { stdout: "pipe", stderr: "pipe" });
18897
19012
  return result.exitCode === 0;
18898
19013
  }
18899
19014
  function escapePowerShellPath(path5) {
@@ -18917,27 +19032,27 @@ async function extractZip(archivePath, destDir) {
18917
19032
  const extractor = getWindowsZipExtractor();
18918
19033
  switch (extractor) {
18919
19034
  case "tar":
18920
- proc = spawn7(["tar", "-xf", archivePath, "-C", destDir], {
19035
+ proc = spawn2(["tar", "-xf", archivePath, "-C", destDir], {
18921
19036
  stdout: "ignore",
18922
19037
  stderr: "pipe"
18923
19038
  });
18924
19039
  break;
18925
19040
  case "pwsh":
18926
- proc = spawn7(["pwsh", "-Command", `Expand-Archive -Path '${escapePowerShellPath(archivePath)}' -DestinationPath '${escapePowerShellPath(destDir)}' -Force`], {
19041
+ proc = spawn2(["pwsh", "-Command", `Expand-Archive -Path '${escapePowerShellPath(archivePath)}' -DestinationPath '${escapePowerShellPath(destDir)}' -Force`], {
18927
19042
  stdout: "ignore",
18928
19043
  stderr: "pipe"
18929
19044
  });
18930
19045
  break;
18931
19046
  case "powershell":
18932
19047
  default:
18933
- proc = spawn7(["powershell", "-Command", `Expand-Archive -Path '${escapePowerShellPath(archivePath)}' -DestinationPath '${escapePowerShellPath(destDir)}' -Force`], {
19048
+ proc = spawn2(["powershell", "-Command", `Expand-Archive -Path '${escapePowerShellPath(archivePath)}' -DestinationPath '${escapePowerShellPath(destDir)}' -Force`], {
18934
19049
  stdout: "ignore",
18935
19050
  stderr: "pipe"
18936
19051
  });
18937
19052
  break;
18938
19053
  }
18939
19054
  } else {
18940
- proc = spawn7(["unzip", "-o", archivePath, "-d", destDir], {
19055
+ proc = spawn2(["unzip", "-o", archivePath, "-d", destDir], {
18941
19056
  stdout: "ignore",
18942
19057
  stderr: "pipe"
18943
19058
  });
@@ -18965,9 +19080,9 @@ async function listZipEntries(archivePath) {
18965
19080
  throw new Error("zip entry listing requires either python3 or zipinfo to inspect the archive safely");
18966
19081
  }
18967
19082
  // src/shared/binary-downloader.ts
19083
+ init_bun_spawn_shim();
18968
19084
  import { chmodSync, existsSync as existsSync9, mkdirSync as mkdirSync3, unlinkSync as unlinkSync2 } from "fs";
18969
19085
  import * as path5 from "path";
18970
- var {spawn: spawn8 } = globalThis.Bun;
18971
19086
  function isTarTraversalErrorOutput(output) {
18972
19087
  return /path contains '\.\.'|member name contains '\.\.'|removing leading [`'\"]?\.\.\//i.test(output);
18973
19088
  }
@@ -18992,7 +19107,7 @@ async function extractTarGz(archivePath, destDir, options) {
18992
19107
  const entries = await listTarEntries(archivePath, options?.cwd);
18993
19108
  validateArchiveEntries(entries, destDir);
18994
19109
  const args = options?.args ?? ["tar", "-xzf", archivePath, "-C", destDir];
18995
- const proc = spawn8(args, {
19110
+ const proc = spawn2(args, {
18996
19111
  cwd: options?.cwd,
18997
19112
  stdout: "pipe",
18998
19113
  stderr: "pipe"
@@ -19042,7 +19157,7 @@ function parseTarEntry(line) {
19042
19157
  };
19043
19158
  }
19044
19159
  async function listTarEntries(archivePath, cwd) {
19045
- const proc = spawn8(["tar", "-tvzf", archivePath], {
19160
+ const proc = spawn2(["tar", "-tvzf", archivePath], {
19046
19161
  cwd,
19047
19162
  stdout: "pipe",
19048
19163
  stderr: "pipe"
@@ -63840,10 +63955,11 @@ async function isServerRunning(serverUrl) {
63840
63955
  return false;
63841
63956
  }
63842
63957
  // src/shared/tmux/tmux-utils/pane-dimensions.ts
63958
+ init_bun_spawn_shim();
63843
63959
  init_tmux_path_resolver();
63844
63960
  // src/shared/tmux/tmux-utils/pane-spawn.ts
63961
+ init_bun_spawn_shim();
63845
63962
  init_tmux_path_resolver();
63846
- var {spawn: spawn10 } = globalThis.Bun;
63847
63963
  async function spawnTmuxPane(sessionId, description, config, serverUrl, targetPaneId, splitDirection = "-h") {
63848
63964
  const { log: log2 } = await Promise.resolve().then(() => (init_logger(), exports_logger));
63849
63965
  log2("[spawnTmuxPane] called", {
@@ -63886,7 +64002,7 @@ async function spawnTmuxPane(sessionId, description, config, serverUrl, targetPa
63886
64002
  ...targetPaneId ? ["-t", targetPaneId] : [],
63887
64003
  opencodeCmd
63888
64004
  ];
63889
- const proc = spawn10([tmux, ...args], { stdout: "pipe", stderr: "pipe" });
64005
+ const proc = spawn2([tmux, ...args], { stdout: "pipe", stderr: "pipe" });
63890
64006
  const exitCode = await proc.exited;
63891
64007
  const stdout = await new Response(proc.stdout).text();
63892
64008
  const paneId = stdout.trim();
@@ -63894,7 +64010,7 @@ async function spawnTmuxPane(sessionId, description, config, serverUrl, targetPa
63894
64010
  return { success: false };
63895
64011
  }
63896
64012
  const title = `omo-subagent-${description.slice(0, 20)}`;
63897
- const titleProc = spawn10([tmux, "select-pane", "-t", paneId, "-T", title], {
64013
+ const titleProc = spawn2([tmux, "select-pane", "-t", paneId, "-T", title], {
63898
64014
  stdout: "ignore",
63899
64015
  stderr: "pipe"
63900
64016
  });
@@ -63919,7 +64035,7 @@ async function readStream(stream) {
63919
64035
  return stream ? new Response(stream).text() : "";
63920
64036
  }
63921
64037
  async function closeTmuxPane(paneId) {
63922
- const [{ log: log2 }, { isInsideTmux: isInsideTmux2 }, { getTmuxPath: getTmuxPath2 }, { spawn: spawn12 }] = await Promise.all([
64038
+ const [{ log: log2 }, { isInsideTmux: isInsideTmux2 }, { getTmuxPath: getTmuxPath2 }, { spawn: spawn3 }] = await Promise.all([
63923
64039
  Promise.resolve().then(() => (init_logger(), exports_logger)),
63924
64040
  Promise.resolve().then(() => exports_environment),
63925
64041
  Promise.resolve().then(() => (init_tmux_path_resolver(), exports_tmux_path_resolver)),
@@ -63935,14 +64051,14 @@ async function closeTmuxPane(paneId) {
63935
64051
  return false;
63936
64052
  }
63937
64053
  log2("[closeTmuxPane] sending Ctrl+C for graceful shutdown", { paneId });
63938
- const ctrlCProc = spawn12([tmux, "send-keys", "-t", paneId, "C-c"], {
64054
+ const ctrlCProc = spawn3([tmux, "send-keys", "-t", paneId, "C-c"], {
63939
64055
  stdout: "ignore",
63940
64056
  stderr: "ignore"
63941
64057
  });
63942
64058
  await ctrlCProc.exited;
63943
64059
  await delay2(250);
63944
64060
  log2("[closeTmuxPane] killing pane", { paneId });
63945
- const killPaneProc = spawn12([tmux, "kill-pane", "-t", paneId], {
64061
+ const killPaneProc = spawn3([tmux, "kill-pane", "-t", paneId], {
63946
64062
  stdout: "pipe",
63947
64063
  stderr: "pipe"
63948
64064
  });
@@ -63965,8 +64081,8 @@ async function closeTmuxPane(paneId) {
63965
64081
  return true;
63966
64082
  }
63967
64083
  // src/shared/tmux/tmux-utils/pane-replace.ts
64084
+ init_bun_spawn_shim();
63968
64085
  init_tmux_path_resolver();
63969
- var {spawn: spawn12 } = globalThis.Bun;
63970
64086
  async function replaceTmuxPane(paneId, sessionId, description, config, serverUrl) {
63971
64087
  const { log: log2 } = await Promise.resolve().then(() => (init_logger(), exports_logger));
63972
64088
  log2("[replaceTmuxPane] called", { paneId, sessionId, description });
@@ -63981,7 +64097,7 @@ async function replaceTmuxPane(paneId, sessionId, description, config, serverUrl
63981
64097
  return { success: false };
63982
64098
  }
63983
64099
  log2("[replaceTmuxPane] sending Ctrl+C for graceful shutdown", { paneId });
63984
- const ctrlCProc = spawn12([tmux, "send-keys", "-t", paneId, "C-c"], {
64100
+ const ctrlCProc = spawn2([tmux, "send-keys", "-t", paneId, "C-c"], {
63985
64101
  stdout: "pipe",
63986
64102
  stderr: "pipe"
63987
64103
  });
@@ -63989,7 +64105,7 @@ async function replaceTmuxPane(paneId, sessionId, description, config, serverUrl
63989
64105
  const shell = process.env.SHELL || "/bin/sh";
63990
64106
  const escapedUrl = shellEscapeForDoubleQuotedCommand(serverUrl);
63991
64107
  const opencodeCmd = `${shell} -c "opencode attach ${escapedUrl} --session ${sessionId}"`;
63992
- const proc = spawn12([tmux, "respawn-pane", "-k", "-t", paneId, opencodeCmd], {
64108
+ const proc = spawn2([tmux, "respawn-pane", "-k", "-t", paneId, opencodeCmd], {
63993
64109
  stdout: "pipe",
63994
64110
  stderr: "pipe"
63995
64111
  });
@@ -64000,7 +64116,7 @@ async function replaceTmuxPane(paneId, sessionId, description, config, serverUrl
64000
64116
  return { success: false };
64001
64117
  }
64002
64118
  const title = `omo-subagent-${description.slice(0, 20)}`;
64003
- const titleProc = spawn12([tmux, "select-pane", "-t", paneId, "-T", title], {
64119
+ const titleProc = spawn2([tmux, "select-pane", "-t", paneId, "-T", title], {
64004
64120
  stdout: "ignore",
64005
64121
  stderr: "pipe"
64006
64122
  });
@@ -64019,8 +64135,8 @@ async function replaceTmuxPane(paneId, sessionId, description, config, serverUrl
64019
64135
  return { success: true, paneId };
64020
64136
  }
64021
64137
  // src/shared/tmux/tmux-utils/window-spawn.ts
64138
+ init_bun_spawn_shim();
64022
64139
  init_tmux_path_resolver();
64023
- var {spawn: spawn13 } = globalThis.Bun;
64024
64140
  var ISOLATED_WINDOW_NAME = "omo-agents";
64025
64141
  async function spawnTmuxWindow(sessionId, description, config, serverUrl) {
64026
64142
  const { log: log2 } = await Promise.resolve().then(() => (init_logger(), exports_logger));
@@ -64063,7 +64179,7 @@ async function spawnTmuxWindow(sessionId, description, config, serverUrl) {
64063
64179
  "#{pane_id}",
64064
64180
  opencodeCmd
64065
64181
  ];
64066
- const proc = spawn13([tmux, ...args], { stdout: "pipe", stderr: "pipe" });
64182
+ const proc = spawn2([tmux, ...args], { stdout: "pipe", stderr: "pipe" });
64067
64183
  const exitCode = await proc.exited;
64068
64184
  const stdout = await new Response(proc.stdout).text();
64069
64185
  const paneId = stdout.trim();
@@ -64073,7 +64189,7 @@ async function spawnTmuxWindow(sessionId, description, config, serverUrl) {
64073
64189
  return { success: false };
64074
64190
  }
64075
64191
  const title = `omo-subagent-${description.slice(0, 20)}`;
64076
- const titleProc = spawn13([tmux, "select-pane", "-t", paneId, "-T", title], {
64192
+ const titleProc = spawn2([tmux, "select-pane", "-t", paneId, "-T", title], {
64077
64193
  stdout: "ignore",
64078
64194
  stderr: "pipe"
64079
64195
  });
@@ -64092,14 +64208,14 @@ async function spawnTmuxWindow(sessionId, description, config, serverUrl) {
64092
64208
  return { success: true, paneId };
64093
64209
  }
64094
64210
  // src/shared/tmux/tmux-utils/session-spawn.ts
64211
+ init_bun_spawn_shim();
64095
64212
  init_tmux_path_resolver();
64096
- var {spawn: spawn14 } = globalThis.Bun;
64097
64213
  var ISOLATED_SESSION_NAME_PREFIX = "omo-agents";
64098
64214
  function getIsolatedSessionName(pid = process.pid) {
64099
64215
  return `${ISOLATED_SESSION_NAME_PREFIX}-${pid}`;
64100
64216
  }
64101
64217
  async function getWindowDimensions(tmux, sourcePaneId) {
64102
- const proc = spawn14([tmux, "display", "-p", "-t", sourcePaneId, "#{window_width},#{window_height}"], { stdout: "pipe", stderr: "pipe" });
64218
+ const proc = spawn2([tmux, "display", "-p", "-t", sourcePaneId, "#{window_width},#{window_height}"], { stdout: "pipe", stderr: "pipe" });
64103
64219
  const exitCode = await proc.exited;
64104
64220
  const stdout = await new Response(proc.stdout).text();
64105
64221
  if (exitCode !== 0)
@@ -64110,7 +64226,7 @@ async function getWindowDimensions(tmux, sourcePaneId) {
64110
64226
  return { width, height };
64111
64227
  }
64112
64228
  async function sessionExists(tmux, sessionName) {
64113
- const proc = spawn14([tmux, "has-session", "-t", sessionName], {
64229
+ const proc = spawn2([tmux, "has-session", "-t", sessionName], {
64114
64230
  stdout: "ignore",
64115
64231
  stderr: "ignore"
64116
64232
  });
@@ -64179,7 +64295,7 @@ async function spawnTmuxSession(sessionId, description, config, serverUrl, sourc
64179
64295
  mode: sessionAlreadyExists ? "new-window" : "new-session",
64180
64296
  sessionName: isolatedSessionName
64181
64297
  });
64182
- const proc = spawn14([tmux, ...args], { stdout: "pipe", stderr: "pipe" });
64298
+ const proc = spawn2([tmux, ...args], { stdout: "pipe", stderr: "pipe" });
64183
64299
  const exitCode = await proc.exited;
64184
64300
  const stdout = await new Response(proc.stdout).text();
64185
64301
  const paneId = stdout.trim();
@@ -64189,7 +64305,7 @@ async function spawnTmuxSession(sessionId, description, config, serverUrl, sourc
64189
64305
  return { success: false };
64190
64306
  }
64191
64307
  const title = `omo-subagent-${description.slice(0, 20)}`;
64192
- const titleProc = spawn14([tmux, "select-pane", "-t", paneId, "-T", title], {
64308
+ const titleProc = spawn2([tmux, "select-pane", "-t", paneId, "-T", title], {
64193
64309
  stdout: "ignore",
64194
64310
  stderr: "pipe"
64195
64311
  });
@@ -64219,8 +64335,8 @@ function isProcessAlive(pid) {
64219
64335
  }
64220
64336
  }
64221
64337
  async function listOmoAgentSessionsViaTmux(tmux) {
64222
- const { spawn: spawn15 } = await Promise.resolve().then(() => (init_spawn_process(), exports_spawn_process));
64223
- const proc = spawn15([tmux, "list-sessions", "-F", "#{session_name}"], {
64338
+ const { spawn: spawn3 } = await Promise.resolve().then(() => (init_spawn_process(), exports_spawn_process));
64339
+ const proc = spawn3([tmux, "list-sessions", "-F", "#{session_name}"], {
64224
64340
  stdout: "pipe",
64225
64341
  stderr: "pipe"
64226
64342
  });
@@ -64286,8 +64402,8 @@ async function sweepStaleOmoAgentSessions() {
64286
64402
  return sweepStaleOmoAgentSessionsWith(deps);
64287
64403
  }
64288
64404
  // src/shared/tmux/tmux-utils/layout.ts
64405
+ init_bun_spawn_shim();
64289
64406
  init_tmux_path_resolver();
64290
- var {spawn: spawn15 } = globalThis.Bun;
64291
64407
  function clamp(value, min, max) {
64292
64408
  return Math.max(min, Math.min(max, value));
64293
64409
  }
@@ -64301,7 +64417,7 @@ function calculateMainPaneWidth(windowWidth, options) {
64301
64417
  return clamp(Math.max(desiredMainPaneWidth, minMainPaneWidth), 0, maxMainPaneWidth);
64302
64418
  }
64303
64419
  async function applyLayout(tmux, layout, mainPaneSize, deps) {
64304
- const spawnCommand = deps?.spawnCommand ?? spawn15;
64420
+ const spawnCommand = deps?.spawnCommand ?? spawn2;
64305
64421
  const layoutProc = spawnCommand([tmux, "select-layout", layout], {
64306
64422
  stdout: "ignore",
64307
64423
  stderr: "ignore"
@@ -64320,7 +64436,7 @@ async function enforceMainPaneWidth(mainPaneId, windowWidth, mainPaneSizeOrOptio
64320
64436
  return;
64321
64437
  const options = typeof mainPaneSizeOrOptions === "number" ? { mainPaneSize: mainPaneSizeOrOptions } : mainPaneSizeOrOptions ?? {};
64322
64438
  const mainWidth = calculateMainPaneWidth(windowWidth, options);
64323
- const proc = spawn15([tmux, "resize-pane", "-t", mainPaneId, "-x", String(mainWidth)], {
64439
+ const proc = spawn2([tmux, "resize-pane", "-t", mainPaneId, "-x", String(mainWidth)], {
64324
64440
  stdout: "ignore",
64325
64441
  stderr: "ignore"
64326
64442
  });
@@ -67670,6 +67786,14 @@ function getDefaultSoundPath(platform2) {
67670
67786
  return "";
67671
67787
  }
67672
67788
  }
67789
+ async function runQuietNothrow(command) {
67790
+ const safeCommand = typeof command.nothrow === "function" ? command.nothrow() : command;
67791
+ if (typeof safeCommand.quiet === "function") {
67792
+ await safeCommand.quiet();
67793
+ return;
67794
+ }
67795
+ await safeCommand;
67796
+ }
67673
67797
  async function sendSessionNotification(ctx, platform2, title, message) {
67674
67798
  switch (platform2) {
67675
67799
  case "darwin": {
@@ -67697,14 +67821,14 @@ async function sendSessionNotification(ctx, platform2, title, message) {
67697
67821
  return;
67698
67822
  const escapedTitle = escapeAppleScriptText(title);
67699
67823
  const escapedMessage = escapeAppleScriptText(message);
67700
- await ctx.$`${osascriptPath} -e ${'display notification "' + escapedMessage + '" with title "' + escapedTitle + '"'}`.nothrow().quiet();
67824
+ await runQuietNothrow(ctx.$`${osascriptPath} -e ${'display notification "' + escapedMessage + '" with title "' + escapedTitle + '"'}`);
67701
67825
  break;
67702
67826
  }
67703
67827
  case "linux": {
67704
67828
  const notifySendPath = await getNotifySendPath();
67705
67829
  if (!notifySendPath)
67706
67830
  return;
67707
- await ctx.$`${notifySendPath} ${title} ${message} 2>/dev/null`.nothrow().quiet();
67831
+ await runQuietNothrow(ctx.$`${notifySendPath} ${title} ${message} 2>/dev/null`);
67708
67832
  break;
67709
67833
  }
67710
67834
  case "win32": {
@@ -67712,7 +67836,7 @@ async function sendSessionNotification(ctx, platform2, title, message) {
67712
67836
  if (!powershellPath)
67713
67837
  return;
67714
67838
  const toastScript = buildWindowsToastScript(title, message);
67715
- await ctx.$`${powershellPath} -Command ${toastScript}`.nothrow().quiet();
67839
+ await runQuietNothrow(ctx.$`${powershellPath} -Command ${toastScript}`);
67716
67840
  break;
67717
67841
  }
67718
67842
  }
@@ -67723,17 +67847,17 @@ async function playSessionNotificationSound(ctx, platform2, soundPath) {
67723
67847
  const afplayPath = await getAfplayPath();
67724
67848
  if (!afplayPath)
67725
67849
  return;
67726
- ctx.$`${afplayPath} ${soundPath}`.nothrow().quiet();
67850
+ await runQuietNothrow(ctx.$`${afplayPath} ${soundPath}`);
67727
67851
  break;
67728
67852
  }
67729
67853
  case "linux": {
67730
67854
  const paplayPath = await getPaplayPath();
67731
67855
  if (paplayPath) {
67732
- ctx.$`${paplayPath} ${soundPath} 2>/dev/null`.nothrow().quiet();
67856
+ await runQuietNothrow(ctx.$`${paplayPath} ${soundPath} 2>/dev/null`);
67733
67857
  } else {
67734
67858
  const aplayPath = await getAplayPath();
67735
67859
  if (aplayPath) {
67736
- ctx.$`${aplayPath} ${soundPath} 2>/dev/null`.nothrow().quiet();
67860
+ await runQuietNothrow(ctx.$`${aplayPath} ${soundPath} 2>/dev/null`);
67737
67861
  }
67738
67862
  }
67739
67863
  break;
@@ -67743,7 +67867,7 @@ async function playSessionNotificationSound(ctx, platform2, soundPath) {
67743
67867
  if (!powershellPath)
67744
67868
  return;
67745
67869
  const escaped = escapePowerShellSingleQuotedText(soundPath);
67746
- ctx.$`${powershellPath} -Command ${"(New-Object Media.SoundPlayer '" + escaped + "').PlaySync()"}`.nothrow().quiet();
67870
+ await runQuietNothrow(ctx.$`${powershellPath} -Command ${"(New-Object Media.SoundPlayer '" + escaped + "').PlaySync()"}`);
67747
67871
  break;
67748
67872
  }
67749
67873
  }
@@ -82655,7 +82779,7 @@ var zod_default = exports_external;
82655
82779
  import { existsSync as existsSync33 } from "fs";
82656
82780
 
82657
82781
  // src/hooks/comment-checker/cli.ts
82658
- var {spawn: spawn16 } = globalThis.Bun;
82782
+ init_bun_spawn_shim();
82659
82783
  import { createRequire as createRequire2 } from "module";
82660
82784
  import { dirname as dirname6, join as join34 } from "path";
82661
82785
  import { existsSync as existsSync32 } from "fs";
@@ -82861,7 +82985,7 @@ async function runCommentChecker(input, cliPath, customPrompt) {
82861
82985
  if (customPrompt) {
82862
82986
  args.push("--prompt", customPrompt);
82863
82987
  }
82864
- const proc = spawn16(args, {
82988
+ const proc = spawn2(args, {
82865
82989
  stdin: "pipe",
82866
82990
  stdout: "pipe",
82867
82991
  stderr: "pipe"
@@ -88168,16 +88292,16 @@ import { join as join57 } from "path";
88168
88292
  init_logger();
88169
88293
 
88170
88294
  // src/shared/spawn-with-windows-hide.ts
88171
- var {spawn: bunSpawn } = globalThis.Bun;
88172
- import { spawn as nodeSpawn } from "child_process";
88173
- import { Readable } from "stream";
88174
- function toReadableStream(stream) {
88295
+ init_bun_spawn_shim();
88296
+ import { spawn as nodeSpawn2 } from "child_process";
88297
+ import { Readable as Readable2 } from "stream";
88298
+ function toReadableStream2(stream) {
88175
88299
  if (!stream) {
88176
88300
  return;
88177
88301
  }
88178
- return Readable.toWeb(stream);
88302
+ return Readable2.toWeb(stream);
88179
88303
  }
88180
- function wrapNodeProcess(proc) {
88304
+ function wrapNodeProcess2(proc) {
88181
88305
  let resolveExited;
88182
88306
  let exitCode = null;
88183
88307
  const exited = new Promise((resolve11) => {
@@ -88198,8 +88322,8 @@ function wrapNodeProcess(proc) {
88198
88322
  return exitCode;
88199
88323
  },
88200
88324
  exited,
88201
- stdout: toReadableStream(proc.stdout),
88202
- stderr: toReadableStream(proc.stderr),
88325
+ stdout: toReadableStream2(proc.stdout),
88326
+ stderr: toReadableStream2(proc.stderr),
88203
88327
  kill(signal) {
88204
88328
  try {
88205
88329
  if (!signal) {
@@ -88213,17 +88337,17 @@ function wrapNodeProcess(proc) {
88213
88337
  }
88214
88338
  function spawnWithWindowsHide(command, options) {
88215
88339
  if (process.platform !== "win32") {
88216
- return bunSpawn(command, options);
88340
+ return spawn2(command, options);
88217
88341
  }
88218
88342
  const [cmd, ...args] = command;
88219
- const proc = nodeSpawn(cmd, args, {
88343
+ const proc = nodeSpawn2(cmd, args, {
88220
88344
  cwd: options.cwd,
88221
88345
  env: options.env,
88222
- stdio: [options.stdin ?? "pipe", options.stdout ?? "pipe", options.stderr ?? "pipe"],
88346
+ stdio: [options.stdin ?? "ignore", options.stdout ?? "pipe", options.stderr ?? "inherit"],
88223
88347
  windowsHide: true,
88224
88348
  shell: true
88225
88349
  });
88226
- return wrapNodeProcess(proc);
88350
+ return wrapNodeProcess2(proc);
88227
88351
  }
88228
88352
 
88229
88353
  // src/shared/bun-install.ts
@@ -102175,6 +102299,10 @@ function isModelInCooldown(model, state3, cooldownSeconds) {
102175
102299
  function findNextAvailableFallback(state3, fallbackModels, cooldownSeconds) {
102176
102300
  for (let i2 = state3.fallbackIndex + 1;i2 < fallbackModels.length; i2++) {
102177
102301
  const candidate = fallbackModels[i2];
102302
+ if (candidate === state3.currentModel) {
102303
+ log(`[${HOOK_NAME11}] Skipping fallback model (same as current)`, { model: candidate, index: i2 });
102304
+ continue;
102305
+ }
102178
102306
  if (!isModelInCooldown(candidate, state3, cooldownSeconds)) {
102179
102307
  return candidate;
102180
102308
  }
@@ -105401,9 +105529,9 @@ function getLanguageId(ext) {
105401
105529
  return EXT_TO_LANG[ext] || "plaintext";
105402
105530
  }
105403
105531
  // src/tools/lsp/lsp-process.ts
105532
+ init_bun_spawn_shim();
105404
105533
  init_logger();
105405
- var {spawn: bunSpawn2 } = globalThis.Bun;
105406
- import { spawn as nodeSpawn2 } from "child_process";
105534
+ import { spawn as nodeSpawn3 } from "child_process";
105407
105535
  import { existsSync as existsSync67, statSync as statSync9 } from "fs";
105408
105536
  function shouldUseNodeSpawn() {
105409
105537
  return process.platform === "win32";
@@ -105422,7 +105550,7 @@ function validateCwd(cwd) {
105422
105550
  return { valid: false, error: `Cannot access working directory: ${cwd} (${err instanceof Error ? err.message : String(err)})` };
105423
105551
  }
105424
105552
  }
105425
- function wrapNodeProcess2(proc) {
105553
+ function wrapNodeProcess3(proc) {
105426
105554
  let resolveExited;
105427
105555
  let exitCode = null;
105428
105556
  const exitedPromise = new Promise((resolve14) => {
@@ -105523,16 +105651,16 @@ function spawnProcess(command, options) {
105523
105651
  if (shouldUseNodeSpawn()) {
105524
105652
  const [cmd, ...args] = command;
105525
105653
  log("[LSP] Using Node.js child_process on Windows to avoid Bun spawn segfault");
105526
- const proc2 = nodeSpawn2(cmd, args, {
105654
+ const proc2 = nodeSpawn3(cmd, args, {
105527
105655
  cwd: options.cwd,
105528
105656
  env: options.env,
105529
105657
  stdio: ["pipe", "pipe", "pipe"],
105530
105658
  windowsHide: true,
105531
105659
  shell: true
105532
105660
  });
105533
- return wrapNodeProcess2(proc2);
105661
+ return wrapNodeProcess3(proc2);
105534
105662
  }
105535
- const proc = bunSpawn2(command, {
105663
+ const proc = spawn2(command, {
105536
105664
  stdin: "pipe",
105537
105665
  stdout: "pipe",
105538
105666
  stderr: "pipe",
@@ -105551,7 +105679,7 @@ import { pathToFileURL } from "url";
105551
105679
 
105552
105680
  // src/tools/lsp/lsp-client-transport.ts
105553
105681
  var import_node = __toESM(require_main(), 1);
105554
- import { Readable as Readable2, Writable } from "stream";
105682
+ import { Readable as Readable3, Writable as Writable2 } from "stream";
105555
105683
  import { delimiter as delimiter2 } from "path";
105556
105684
  init_logger();
105557
105685
 
@@ -105595,7 +105723,7 @@ class LSPClientTransport {
105595
105723
  stderr: ${stderr}` : ""));
105596
105724
  }
105597
105725
  const stdoutReader = this.proc.stdout.getReader();
105598
- const nodeReadable = new Readable2({
105726
+ const nodeReadable = new Readable3({
105599
105727
  async read() {
105600
105728
  try {
105601
105729
  const { done, value } = await stdoutReader.read();
@@ -105610,7 +105738,7 @@ stderr: ${stderr}` : ""));
105610
105738
  }
105611
105739
  });
105612
105740
  const stdin = this.proc.stdin;
105613
- const nodeWritable = new Writable({
105741
+ const nodeWritable = new Writable2({
105614
105742
  write(chunk, _encoding, callback) {
105615
105743
  try {
105616
105744
  stdin.write(chunk);
@@ -119384,7 +119512,7 @@ function setSgCliPath(path13) {
119384
119512
  resolvedCliPath2 = path13;
119385
119513
  }
119386
119514
  // src/tools/ast-grep/cli.ts
119387
- var {spawn: spawn17 } = globalThis.Bun;
119515
+ init_bun_spawn_shim();
119388
119516
  import { existsSync as existsSync73 } from "fs";
119389
119517
 
119390
119518
  // src/tools/ast-grep/cli-binary-path-resolution.ts
@@ -119518,7 +119646,7 @@ async function runSg(options) {
119518
119646
  }
119519
119647
  }
119520
119648
  const timeout = DEFAULT_TIMEOUT_MS2;
119521
- const proc = spawn17([cliPath, ...args], {
119649
+ const proc = spawn2([cliPath, ...args], {
119522
119650
  stdout: "pipe",
119523
119651
  stderr: "pipe"
119524
119652
  });
@@ -119581,7 +119709,7 @@ async function runSg(options) {
119581
119709
  if (shouldSeparateWritePass && jsonResult.matches.length > 0) {
119582
119710
  const writeArgs = args.filter((a) => a !== "--json=compact");
119583
119711
  writeArgs.push("--update-all");
119584
- const writeProc = spawn17([cliPath, ...writeArgs], {
119712
+ const writeProc = spawn2([cliPath, ...writeArgs], {
119585
119713
  stdout: "pipe",
119586
119714
  stderr: "pipe"
119587
119715
  });
@@ -119750,7 +119878,7 @@ ${hint}`;
119750
119878
  import { resolve as resolve18 } from "path";
119751
119879
 
119752
119880
  // src/shared/ripgrep-cli.ts
119753
- import { spawnSync as spawnSync4 } from "child_process";
119881
+ import { spawnSync as spawnSync2 } from "child_process";
119754
119882
  import { existsSync as existsSync75 } from "fs";
119755
119883
  import { dirname as dirname23, join as join82 } from "path";
119756
119884
 
@@ -119860,7 +119988,7 @@ function findExecutable(name) {
119860
119988
  const isWindows2 = process.platform === "win32";
119861
119989
  const cmd = isWindows2 ? "where" : "which";
119862
119990
  try {
119863
- const result = spawnSync4(cmd, [name], { encoding: "utf-8", timeout: 5000 });
119991
+ const result = spawnSync2(cmd, [name], { encoding: "utf-8", timeout: 5000 });
119864
119992
  if (result.status === 0 && result.stdout.trim()) {
119865
119993
  return result.stdout.trim().split(`
119866
119994
  `)[0];
@@ -119936,7 +120064,7 @@ async function resolveGrepCliWithAutoInstall() {
119936
120064
  }
119937
120065
 
119938
120066
  // src/tools/grep/cli.ts
119939
- var {spawn: spawn18 } = globalThis.Bun;
120067
+ init_bun_spawn_shim();
119940
120068
 
119941
120069
  // src/tools/grep/constants.ts
119942
120070
  var DEFAULT_MAX_DEPTH = 20;
@@ -120125,7 +120253,7 @@ async function runRgInternal(options, resolvedCli) {
120125
120253
  }
120126
120254
  const paths = options.paths?.length ? options.paths : ["."];
120127
120255
  args.push(...paths);
120128
- const proc = spawn18([cli.path, ...args], {
120256
+ const proc = spawn2([cli.path, ...args], {
120129
120257
  stdout: "pipe",
120130
120258
  stderr: "pipe"
120131
120259
  });
@@ -120189,7 +120317,7 @@ async function runRgCountInternal(options, resolvedCli) {
120189
120317
  const paths = options.paths?.length ? options.paths : ["."];
120190
120318
  args.push(...paths);
120191
120319
  const timeout = Math.min(options.timeout ?? DEFAULT_TIMEOUT_MS3, DEFAULT_TIMEOUT_MS3);
120192
- const proc = spawn18([cli.path, ...args], {
120320
+ const proc = spawn2([cli.path, ...args], {
120193
120321
  stdout: "pipe",
120194
120322
  stderr: "pipe"
120195
120323
  });
@@ -120309,8 +120437,8 @@ function createGrepTools(ctx) {
120309
120437
  import { resolve as resolve20 } from "path";
120310
120438
 
120311
120439
  // src/tools/glob/cli.ts
120440
+ init_bun_spawn_shim();
120312
120441
  import { resolve as resolve19 } from "path";
120313
- var {spawn: spawn19 } = globalThis.Bun;
120314
120442
 
120315
120443
  // src/tools/glob/constants.ts
120316
120444
  var DEFAULT_TIMEOUT_MS4 = 60000;
@@ -120406,7 +120534,7 @@ async function runRgFilesInternal(options, resolvedCli) {
120406
120534
  cwd = paths[0] || ".";
120407
120535
  command = [cli.path, ...args];
120408
120536
  }
120409
- const proc = spawn19(command, {
120537
+ const proc = spawn2(command, {
120410
120538
  stdout: "pipe",
120411
120539
  stderr: "pipe",
120412
120540
  cwd
@@ -128619,6 +128747,7 @@ function normalizeHashlineEdits(rawEdits) {
128619
128747
 
128620
128748
  // src/tools/hashline-edit/formatter-trigger.ts
128621
128749
  import path14 from "path";
128750
+ init_bun_spawn_shim();
128622
128751
  var cachedFormattersByDirectory = new Map;
128623
128752
  function getFormatterCacheKey(directory) {
128624
128753
  return path14.resolve(directory);
@@ -128683,7 +128812,7 @@ async function runFormattersForFile(client2, directory, filePath) {
128683
128812
  const cmd = buildFormatterCommand(formatter.command, filePath);
128684
128813
  try {
128685
128814
  log("[formatter-trigger] Running formatter", { command: cmd, file: filePath });
128686
- const proc = Bun.spawn(cmd, {
128815
+ const proc = spawn2(cmd, {
128687
128816
  cwd: directory,
128688
128817
  env: { ...process.env, ...formatter.environment },
128689
128818
  stdout: "ignore",
@@ -130526,7 +130655,7 @@ async function checkAndInterruptStaleTasks(args) {
130526
130655
  const sessionStatus = sessionStatuses?.[sessionID]?.type;
130527
130656
  const sessionIsRunning = sessionStatus !== undefined && isActiveSessionStatus(sessionStatus);
130528
130657
  const sessionMissing = sessionStatuses !== undefined && sessionStatus === undefined;
130529
- const runtime = now - startedAt.getTime();
130658
+ const runtime2 = now - startedAt.getTime();
130530
130659
  if (sessionMissing) {
130531
130660
  task.consecutiveMissedPolls = (task.consecutiveMissedPolls ?? 0) + 1;
130532
130661
  } else if (sessionStatuses !== undefined) {
@@ -130539,13 +130668,13 @@ async function checkAndInterruptStaleTasks(args) {
130539
130668
  if (sessionMissing && !sessionGone)
130540
130669
  continue;
130541
130670
  const effectiveTimeout = sessionGone ? sessionGoneTimeoutMs : messageStalenessMs;
130542
- if (runtime <= effectiveTimeout)
130671
+ if (runtime2 <= effectiveTimeout)
130543
130672
  continue;
130544
130673
  if (sessionGone && await verifySessionExists(client2, sessionID, directory)) {
130545
130674
  task.consecutiveMissedPolls = 0;
130546
130675
  continue;
130547
130676
  }
130548
- const staleMinutes2 = Math.round(runtime / 60000);
130677
+ const staleMinutes2 = Math.round(runtime2 / 60000);
130549
130678
  const reason2 = sessionGone ? "session gone from status registry" : "no activity";
130550
130679
  task.status = "cancelled";
130551
130680
  task.error = `Stale timeout (${reason2} for ${staleMinutes2}min since start). This is a FINAL cancellation - do NOT create a replacement task. If the timeout is too short, increase 'background_task.${sessionGone ? "sessionGoneTimeoutMs" : "staleTimeoutMs"}' in .opencode/${CONFIG_BASENAME}.json.`;
@@ -130566,7 +130695,7 @@ async function checkAndInterruptStaleTasks(args) {
130566
130695
  }
130567
130696
  if (sessionIsRunning)
130568
130697
  continue;
130569
- if (runtime < MIN_RUNTIME_BEFORE_STALE_MS)
130698
+ if (runtime2 < MIN_RUNTIME_BEFORE_STALE_MS)
130570
130699
  continue;
130571
130700
  const timeSinceLastUpdate = now - task.progress.lastUpdate.getTime();
130572
130701
  const effectiveStaleTimeout = sessionGone ? sessionGoneTimeoutMs : staleTimeoutMs;
@@ -132874,7 +133003,7 @@ async function findAvailablePort2(startPort = DEFAULT_PORT) {
132874
133003
  }
132875
133004
 
132876
133005
  // src/features/mcp-oauth/oauth-authorization-flow.ts
132877
- import { spawn as spawn20 } from "child_process";
133006
+ import { spawn as spawn3 } from "child_process";
132878
133007
  import { createHash as createHash2, randomBytes as randomBytes2 } from "crypto";
132879
133008
  import { createServer } from "http";
132880
133009
  function generateCodeVerifier() {
@@ -132955,7 +133084,7 @@ function openBrowser(url3) {
132955
133084
  args = [url3];
132956
133085
  }
132957
133086
  try {
132958
- const child = spawn20(command, args, { stdio: "ignore", detached: true });
133087
+ const child = spawn3(command, args, { stdio: "ignore", detached: true });
132959
133088
  child.on("error", () => {});
132960
133089
  child.unref();
132961
133090
  } catch {}
@@ -137846,7 +137975,7 @@ function createModelFallbackControllerAccessor() {
137846
137975
  };
137847
137976
  }
137848
137977
  // src/features/tmux-subagent/pane-state-querier.ts
137849
- var {spawn: spawn22 } = globalThis.Bun;
137978
+ init_bun_spawn_shim();
137850
137979
 
137851
137980
  // src/features/tmux-subagent/pane-state-parser.ts
137852
137981
  var MANDATORY_PANE_FIELD_COUNT = 8;
@@ -137935,7 +138064,7 @@ async function queryWindowState(sourcePaneId) {
137935
138064
  const tmux3 = await getTmuxPath();
137936
138065
  if (!tmux3)
137937
138066
  return null;
137938
- const proc = spawn22([
138067
+ const proc = spawn2([
137939
138068
  tmux3,
137940
138069
  "list-panes",
137941
138070
  "-t",
@@ -139471,7 +139600,7 @@ function resolveGateway(config4, event) {
139471
139600
  }
139472
139601
 
139473
139602
  // src/openclaw/dispatcher.ts
139474
- var {spawn: spawn23 } = globalThis.Bun;
139603
+ init_bun_spawn_shim();
139475
139604
  var DEFAULT_HTTP_TIMEOUT_MS = 1e4;
139476
139605
  var DEFAULT_COMMAND_TIMEOUT_MS = 5000;
139477
139606
  var MIN_COMMAND_TIMEOUT_MS = 100;
@@ -139605,7 +139734,7 @@ async function wakeCommandGateway(gatewayName, gatewayConfig, variables) {
139605
139734
  return _match;
139606
139735
  return shellEscapeArg(value);
139607
139736
  });
139608
- const proc = spawn23(["sh", "-c", interpolated], {
139737
+ const proc = spawn2(["sh", "-c", interpolated], {
139609
139738
  env: { ...process.env },
139610
139739
  stdout: "pipe",
139611
139740
  stderr: "ignore",
@@ -139655,7 +139784,7 @@ function terminateCommandProcess(proc, signal) {
139655
139784
  }
139656
139785
 
139657
139786
  // src/openclaw/tmux.ts
139658
- var {spawn: spawn24 } = globalThis.Bun;
139787
+ init_bun_spawn_shim();
139659
139788
  function getCurrentTmuxSession() {
139660
139789
  const env = process.env.TMUX;
139661
139790
  if (!env)
@@ -139665,7 +139794,7 @@ function getCurrentTmuxSession() {
139665
139794
  }
139666
139795
  async function captureTmuxPane(paneId, lines = 15) {
139667
139796
  try {
139668
- const proc = spawn24(["tmux", "capture-pane", "-p", "-t", paneId, "-S", `-${lines}`], {
139797
+ const proc = spawn2(["tmux", "capture-pane", "-p", "-t", paneId, "-S", `-${lines}`], {
139669
139798
  stdout: "pipe",
139670
139799
  stderr: "ignore"
139671
139800
  });
@@ -139681,7 +139810,7 @@ async function captureTmuxPane(paneId, lines = 15) {
139681
139810
  }
139682
139811
  async function isTmuxAvailable() {
139683
139812
  try {
139684
- const proc = spawn24(["tmux", "-V"], {
139813
+ const proc = spawn2(["tmux", "-V"], {
139685
139814
  stdout: "ignore",
139686
139815
  stderr: "ignore"
139687
139816
  });
@@ -140146,8 +140275,8 @@ function markReplyListenerStopped(state3, error92) {
140146
140275
  }
140147
140276
 
140148
140277
  // src/openclaw/reply-listener-process.ts
140278
+ init_bun_spawn_shim();
140149
140279
  import { readFileSync as readFileSync61 } from "fs";
140150
- var {spawn: spawn25 } = globalThis.Bun;
140151
140280
  var REPLY_LISTENER_DAEMON_IDENTITY_MARKER = "--openclaw-reply-listener-daemon";
140152
140281
  var REPLY_LISTENER_DAEMON_ENV_ALLOWLIST = [
140153
140282
  "PATH",
@@ -140205,7 +140334,7 @@ async function isReplyListenerDaemonProcess(pid) {
140205
140334
  const cmdline = readFileSync61(`/proc/${pid}/cmdline`, "utf-8");
140206
140335
  return cmdline.includes(REPLY_LISTENER_DAEMON_IDENTITY_MARKER);
140207
140336
  }
140208
- const processInfo = spawn25(["ps", "-p", String(pid), "-o", "args="], {
140337
+ const processInfo = spawn2(["ps", "-p", String(pid), "-o", "args="], {
140209
140338
  stdout: "pipe",
140210
140339
  stderr: "ignore"
140211
140340
  });
@@ -140219,9 +140348,9 @@ async function isReplyListenerDaemonProcess(pid) {
140219
140348
  }
140220
140349
 
140221
140350
  // src/openclaw/reply-listener-spawn.ts
140222
- var {spawn: spawn26 } = globalThis.Bun;
140351
+ init_bun_spawn_shim();
140223
140352
  function spawnReplyListenerDaemon(daemonScript, startupToken) {
140224
- return spawn26(["bun", "run", daemonScript, REPLY_LISTENER_DAEMON_IDENTITY_MARKER], {
140353
+ return spawn2(["bun", "run", daemonScript, REPLY_LISTENER_DAEMON_IDENTITY_MARKER], {
140225
140354
  detached: true,
140226
140355
  stdio: ["ignore", "ignore", "ignore"],
140227
140356
  cwd: process.cwd(),
@@ -0,0 +1,39 @@
1
+ type StdioMode = "pipe" | "inherit" | "ignore";
2
+ type StdioTuple = [StdioMode, StdioMode, StdioMode];
3
+ export interface SpawnOptions {
4
+ cmd?: string[];
5
+ cwd?: string;
6
+ env?: NodeJS.ProcessEnv;
7
+ stdin?: StdioMode;
8
+ stdout?: StdioMode;
9
+ stderr?: StdioMode;
10
+ stdio?: StdioTuple;
11
+ detached?: boolean;
12
+ }
13
+ export interface SpawnedProcess {
14
+ readonly exitCode: number | null;
15
+ readonly exited: Promise<number>;
16
+ readonly stdout: ReadableStream<Uint8Array>;
17
+ readonly stderr: ReadableStream<Uint8Array>;
18
+ readonly stdin: NodeJS.WritableStream;
19
+ readonly pid: number | undefined;
20
+ kill(signal?: NodeJS.Signals): void;
21
+ ref(): void;
22
+ unref(): void;
23
+ }
24
+ export interface SpawnSyncResult {
25
+ readonly exitCode: number;
26
+ readonly stdout: Buffer | undefined;
27
+ readonly stderr: Buffer | undefined;
28
+ readonly success: boolean;
29
+ readonly pid: number;
30
+ }
31
+ export declare function spawn(command: string[], options?: SpawnOptions): SpawnedProcess;
32
+ export declare function spawn(options: SpawnOptions & {
33
+ cmd: string[];
34
+ }): SpawnedProcess;
35
+ export declare function spawnSync(command: string[], options?: SpawnOptions): SpawnSyncResult;
36
+ export declare function spawnSync(options: SpawnOptions & {
37
+ cmd: string[];
38
+ }): SpawnSyncResult;
39
+ export {};
@@ -1 +1 @@
1
- export { spawn } from "bun";
1
+ export { spawn } from "../../bun-spawn-shim";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wolfx/oh-my-openagent",
3
- "version": "3.17.14",
3
+ "version": "3.17.15",
4
4
  "description": "A fork of oh-my-openagent",
5
5
  "main": "./dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -70,6 +70,7 @@
70
70
  "typescript": "^5.7.3",
71
71
  "zod": "^4.3.0"
72
72
  },
73
+
73
74
  "overrides": {},
74
75
  "trustedDependencies": [
75
76
  "@ast-grep/cli",