oh-my-opencode 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
@@ -44,7 +44,8 @@ var __export = (target, all) => {
44
44
  });
45
45
  };
46
46
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
47
- var __require = import.meta.require;
47
+ import { createRequire as __omoCreateRequire } from "node:module";
48
+ var __require = typeof import.meta.require === "function" ? import.meta.require : __omoCreateRequire(import.meta.url);
48
49
 
49
50
  // node_modules/js-yaml/dist/js-yaml.mjs
50
51
  function isNothing(subject) {
@@ -2770,6 +2771,119 @@ var init_logger = __esm(() => {
2770
2771
  buffer = [];
2771
2772
  });
2772
2773
 
2774
+ // src/shared/bun-spawn-shim.ts
2775
+ import { spawn as nodeSpawn, spawnSync as nodeSpawnSync } from "child_process";
2776
+ import { Readable, Writable } from "stream";
2777
+ function emptyReadableStream() {
2778
+ return new ReadableStream({
2779
+ start(controller) {
2780
+ controller.close();
2781
+ }
2782
+ });
2783
+ }
2784
+ function toReadableStream(stream) {
2785
+ if (!stream)
2786
+ return emptyReadableStream();
2787
+ return Readable.toWeb(stream);
2788
+ }
2789
+ function emptyWritableStream() {
2790
+ return new Writable({
2791
+ write(_chunk, _encoding, callback) {
2792
+ callback();
2793
+ }
2794
+ });
2795
+ }
2796
+ function resolveCommand(cmdOrOpts, optsArg) {
2797
+ const isObj = !Array.isArray(cmdOrOpts);
2798
+ const opts = isObj ? cmdOrOpts : optsArg ?? {};
2799
+ return {
2800
+ cmd: isObj ? cmdOrOpts.cmd : cmdOrOpts,
2801
+ opts
2802
+ };
2803
+ }
2804
+ function resolveStdio(options) {
2805
+ if (options.stdio)
2806
+ return options.stdio;
2807
+ return [options.stdin ?? "ignore", options.stdout ?? "pipe", options.stderr ?? "inherit"];
2808
+ }
2809
+ function wrapNodeProcess(proc) {
2810
+ let exitCode = null;
2811
+ const exited = new Promise((resolve5, reject) => {
2812
+ proc.on("exit", (code) => {
2813
+ exitCode = code ?? 1;
2814
+ resolve5(exitCode);
2815
+ });
2816
+ proc.on("error", (error) => {
2817
+ if (exitCode === null) {
2818
+ exitCode = 1;
2819
+ reject(error);
2820
+ }
2821
+ });
2822
+ });
2823
+ return {
2824
+ get exitCode() {
2825
+ return exitCode;
2826
+ },
2827
+ exited,
2828
+ stdout: toReadableStream(proc.stdout),
2829
+ stderr: toReadableStream(proc.stderr),
2830
+ stdin: proc.stdin ?? emptyWritableStream(),
2831
+ kill(signal) {
2832
+ if (proc.killed || exitCode !== null)
2833
+ return;
2834
+ try {
2835
+ proc.kill(signal);
2836
+ } catch (error) {
2837
+ if (!String(error).includes("kill"))
2838
+ throw error;
2839
+ }
2840
+ },
2841
+ pid: proc.pid,
2842
+ ref() {
2843
+ proc.ref();
2844
+ },
2845
+ unref() {
2846
+ proc.unref();
2847
+ }
2848
+ };
2849
+ }
2850
+ function spawn2(cmdOrOpts, opts) {
2851
+ if (IS_BUN)
2852
+ return runtime.Bun.spawn(cmdOrOpts, opts);
2853
+ const { cmd, opts: options } = resolveCommand(cmdOrOpts, opts);
2854
+ const [bin, ...args] = cmd;
2855
+ const proc = nodeSpawn(bin, args, {
2856
+ cwd: options.cwd,
2857
+ env: options.env,
2858
+ stdio: resolveStdio(options),
2859
+ detached: options.detached
2860
+ });
2861
+ return wrapNodeProcess(proc);
2862
+ }
2863
+ function spawnSync(cmdOrOpts, opts) {
2864
+ if (IS_BUN)
2865
+ return runtime.Bun.spawnSync(cmdOrOpts, opts);
2866
+ const { cmd, opts: options } = resolveCommand(cmdOrOpts, opts);
2867
+ const [bin, ...args] = cmd;
2868
+ const result = nodeSpawnSync(bin, args, {
2869
+ cwd: options.cwd,
2870
+ env: options.env,
2871
+ stdio: resolveStdio(options)
2872
+ });
2873
+ return {
2874
+ exitCode: result.status ?? 1,
2875
+ stdout: result.stdout ?? undefined,
2876
+ stderr: result.stderr ?? undefined,
2877
+ success: (result.status ?? 1) === 0,
2878
+ pid: result.pid ?? -1
2879
+ };
2880
+ }
2881
+ var runtime, IS_BUN;
2882
+ var init_bun_spawn_shim = __esm(() => {
2883
+ runtime = globalThis;
2884
+ IS_BUN = typeof runtime.Bun !== "undefined";
2885
+ });
2886
+
2773
2887
  // src/shared/agent-display-names.ts
2774
2888
  function stripInvisibleAgentCharacters(agentName) {
2775
2889
  return agentName.replace(INVISIBLE_AGENT_CHARACTERS_REGEX, "");
@@ -2873,12 +2987,11 @@ __export(exports_tmux_path_resolver, {
2873
2987
  getTmuxPath: () => getTmuxPath,
2874
2988
  getCachedTmuxPath: () => getCachedTmuxPath
2875
2989
  });
2876
- var {spawn: spawn9 } = globalThis.Bun;
2877
2990
  async function findTmuxPath() {
2878
2991
  const isWindows = process.platform === "win32";
2879
2992
  const cmd = isWindows ? "where" : "which";
2880
2993
  try {
2881
- const proc = spawn9([cmd, "tmux"], {
2994
+ const proc = spawn2([cmd, "tmux"], {
2882
2995
  stdout: "pipe",
2883
2996
  stderr: "pipe"
2884
2997
  });
@@ -2892,7 +3005,7 @@ async function findTmuxPath() {
2892
3005
  if (!path6) {
2893
3006
  return null;
2894
3007
  }
2895
- const verifyProc = spawn9([path6, "-V"], {
3008
+ const verifyProc = spawn2([path6, "-V"], {
2896
3009
  stdout: "pipe",
2897
3010
  stderr: "pipe"
2898
3011
  });
@@ -2929,15 +3042,18 @@ function startBackgroundCheck() {
2929
3042
  }
2930
3043
  }
2931
3044
  var tmuxPath = null, initPromise = null;
2932
- var init_tmux_path_resolver = () => {};
3045
+ var init_tmux_path_resolver = __esm(() => {
3046
+ init_bun_spawn_shim();
3047
+ });
2933
3048
 
2934
3049
  // src/shared/tmux/tmux-utils/spawn-process.ts
2935
3050
  var exports_spawn_process = {};
2936
3051
  __export(exports_spawn_process, {
2937
- spawn: () => spawn11
3052
+ spawn: () => spawn2
3053
+ });
3054
+ var init_spawn_process = __esm(() => {
3055
+ init_bun_spawn_shim();
2938
3056
  });
2939
- var {spawn: spawn11 } = globalThis.Bun;
2940
- var init_spawn_process = () => {};
2941
3057
 
2942
3058
  // src/shared/tmux/tmux-utils/session-kill.ts
2943
3059
  var exports_session_kill = {};
@@ -2948,7 +3064,7 @@ async function readStream2(stream) {
2948
3064
  return stream ? new Response(stream).text() : "";
2949
3065
  }
2950
3066
  async function killTmuxSessionIfExists(sessionName) {
2951
- const [{ log: log2 }, { isInsideTmux: isInsideTmux2 }, { getTmuxPath: getTmuxPath2 }, { spawn: spawn15 }] = await Promise.all([
3067
+ const [{ log: log2 }, { isInsideTmux: isInsideTmux2 }, { getTmuxPath: getTmuxPath2 }, { spawn: spawn3 }] = await Promise.all([
2952
3068
  Promise.resolve().then(() => (init_logger(), exports_logger)),
2953
3069
  Promise.resolve().then(() => exports_environment),
2954
3070
  Promise.resolve().then(() => (init_tmux_path_resolver(), exports_tmux_path_resolver)),
@@ -2963,7 +3079,7 @@ async function killTmuxSessionIfExists(sessionName) {
2963
3079
  log2("[killTmuxSessionIfExists] SKIP: tmux not found", { sessionName });
2964
3080
  return false;
2965
3081
  }
2966
- const hasSessionProcess = spawn15([tmux, "has-session", "-t", sessionName], {
3082
+ const hasSessionProcess = spawn3([tmux, "has-session", "-t", sessionName], {
2967
3083
  stdout: "ignore",
2968
3084
  stderr: "ignore"
2969
3085
  });
@@ -2971,7 +3087,7 @@ async function killTmuxSessionIfExists(sessionName) {
2971
3087
  log2("[killTmuxSessionIfExists] SKIP: session not found", { sessionName });
2972
3088
  return false;
2973
3089
  }
2974
- const killSessionProcess = spawn15([tmux, "kill-session", "-t", sessionName], {
3090
+ const killSessionProcess = spawn3([tmux, "kill-session", "-t", sessionName], {
2975
3091
  stdout: "pipe",
2976
3092
  stderr: "pipe"
2977
3093
  });
@@ -15517,10 +15633,10 @@ var require_resolveCommand = __commonJS((exports, module) => {
15517
15633
  }
15518
15634
  return resolved;
15519
15635
  }
15520
- function resolveCommand(parsed) {
15636
+ function resolveCommand2(parsed) {
15521
15637
  return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
15522
15638
  }
15523
- module.exports = resolveCommand;
15639
+ module.exports = resolveCommand2;
15524
15640
  });
15525
15641
 
15526
15642
  // node_modules/cross-spawn/lib/util/escape.js
@@ -15588,19 +15704,19 @@ var require_readShebang = __commonJS((exports, module) => {
15588
15704
  // node_modules/cross-spawn/lib/parse.js
15589
15705
  var require_parse2 = __commonJS((exports, module) => {
15590
15706
  var path15 = __require("path");
15591
- var resolveCommand = require_resolveCommand();
15707
+ var resolveCommand2 = require_resolveCommand();
15592
15708
  var escape2 = require_escape();
15593
15709
  var readShebang = require_readShebang();
15594
15710
  var isWin = process.platform === "win32";
15595
15711
  var isExecutableRegExp = /\.(?:com|exe)$/i;
15596
15712
  var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
15597
15713
  function detectShebang(parsed) {
15598
- parsed.file = resolveCommand(parsed);
15714
+ parsed.file = resolveCommand2(parsed);
15599
15715
  const shebang = parsed.file && readShebang(parsed.file);
15600
15716
  if (shebang) {
15601
15717
  parsed.args.unshift(parsed.file);
15602
15718
  parsed.command = shebang;
15603
- return resolveCommand(parsed);
15719
+ return resolveCommand2(parsed);
15604
15720
  }
15605
15721
  return parsed.file;
15606
15722
  }
@@ -15696,21 +15812,21 @@ var require_cross_spawn = __commonJS((exports, module) => {
15696
15812
  var cp = __require("child_process");
15697
15813
  var parse3 = require_parse2();
15698
15814
  var enoent = require_enoent();
15699
- function spawn21(command, args, options) {
15815
+ function spawn4(command, args, options) {
15700
15816
  const parsed = parse3(command, args, options);
15701
15817
  const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
15702
15818
  enoent.hookChildProcess(spawned, parsed);
15703
15819
  return spawned;
15704
15820
  }
15705
- function spawnSync5(command, args, options) {
15821
+ function spawnSync3(command, args, options) {
15706
15822
  const parsed = parse3(command, args, options);
15707
15823
  const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
15708
15824
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
15709
15825
  return result;
15710
15826
  }
15711
- module.exports = spawn21;
15712
- module.exports.spawn = spawn21;
15713
- module.exports.sync = spawnSync5;
15827
+ module.exports = spawn4;
15828
+ module.exports.spawn = spawn4;
15829
+ module.exports.sync = spawnSync3;
15714
15830
  module.exports._parse = parse3;
15715
15831
  module.exports._enoent = enoent;
15716
15832
  });
@@ -18576,7 +18692,7 @@ Both ${PLUGIN_NAME} and ${pluginName} scan ~/.config/opencode/skills/ and regist
18576
18692
  3. Or uninstall ${PLUGIN_NAME} if you prefer ${pluginName}'s skill management`;
18577
18693
  }
18578
18694
  // src/shared/zip-extractor.ts
18579
- var {spawn: spawn7, spawnSync: spawnSync3 } = globalThis.Bun;
18695
+ init_bun_spawn_shim();
18580
18696
  import { release } from "os";
18581
18697
 
18582
18698
  // src/shared/archive-entry-validator.ts
@@ -18635,7 +18751,7 @@ function validateArchiveEntries(entries, destDir) {
18635
18751
  }
18636
18752
 
18637
18753
  // src/shared/zip-entry-listing/python-zip-entry-listing.ts
18638
- var {spawn: spawn2, spawnSync } = globalThis.Bun;
18754
+ init_bun_spawn_shim();
18639
18755
  function isPythonZipListingAvailable() {
18640
18756
  const proc = spawnSync(["python3", "--version"], {
18641
18757
  stdout: "ignore",
@@ -18681,7 +18797,7 @@ async function listZipEntriesWithPython(archivePath) {
18681
18797
  return JSON.parse(stdout);
18682
18798
  }
18683
18799
  // src/shared/zip-entry-listing/powershell-zip-entry-listing.ts
18684
- var {spawn: spawn3 } = globalThis.Bun;
18800
+ init_bun_spawn_shim();
18685
18801
  function isPowerShellZipEntryRecord(value) {
18686
18802
  if (!value || typeof value !== "object") {
18687
18803
  return false;
@@ -18707,7 +18823,7 @@ function parsePowerShellZipEntryLine(line) {
18707
18823
  };
18708
18824
  }
18709
18825
  async function listZipEntriesWithPowerShell(archivePath, escapePowerShellPath, extractor) {
18710
- const proc = spawn3([
18826
+ const proc = spawn2([
18711
18827
  extractor,
18712
18828
  "-Command",
18713
18829
  [
@@ -18746,8 +18862,8 @@ async function listZipEntriesWithPowerShell(archivePath, escapePowerShellPath, e
18746
18862
  return stdout.split(/\r?\n/).map((line) => line.trim()).filter(Boolean).map((line) => parsePowerShellZipEntryLine(line)).filter((entry) => entry !== null);
18747
18863
  }
18748
18864
  // src/shared/zip-entry-listing/tar-zip-entry-listing.ts
18865
+ init_bun_spawn_shim();
18749
18866
  init_logger();
18750
- var {spawn: spawn4 } = globalThis.Bun;
18751
18867
  function parseTarListedZipEntry(line) {
18752
18868
  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
18869
  if (!match) {
@@ -18793,7 +18909,7 @@ function parseTarListingOutput(stdout) {
18793
18909
  return parsedEntries;
18794
18910
  }
18795
18911
  async function listZipEntriesWithTar(archivePath) {
18796
- const proc = spawn4(["tar", "-tvf", archivePath], {
18912
+ const proc = spawn2(["tar", "-tvf", archivePath], {
18797
18913
  stdout: "pipe",
18798
18914
  stderr: "pipe"
18799
18915
  });
@@ -18808,12 +18924,12 @@ async function listZipEntriesWithTar(archivePath) {
18808
18924
  return parseTarListingOutput(stdout);
18809
18925
  }
18810
18926
  // src/shared/zip-entry-listing/zipinfo-zip-entry-listing.ts
18811
- var {spawn: spawn6, spawnSync: spawnSync2 } = globalThis.Bun;
18927
+ init_bun_spawn_shim();
18812
18928
 
18813
18929
  // src/shared/zip-entry-listing/read-zip-symlink-target.ts
18814
- var {spawn: spawn5 } = globalThis.Bun;
18930
+ init_bun_spawn_shim();
18815
18931
  async function readZipSymlinkTarget(archivePath, entryPath) {
18816
- const proc = spawn5(["unzip", "-p", archivePath, "--", entryPath], {
18932
+ const proc = spawn2(["unzip", "-p", archivePath, "--", entryPath], {
18817
18933
  stdout: "pipe",
18818
18934
  stderr: "pipe"
18819
18935
  });
@@ -18841,7 +18957,7 @@ function parseZipInfoListedEntry(line) {
18841
18957
  };
18842
18958
  }
18843
18959
  function isZipInfoZipListingAvailable() {
18844
- const proc = spawnSync2(["which", "zipinfo"], {
18960
+ const proc = spawnSync(["which", "zipinfo"], {
18845
18961
  stdout: "ignore",
18846
18962
  stderr: "ignore"
18847
18963
  });
@@ -18854,7 +18970,7 @@ async function listZipEntriesWithZipInfo(archivePath) {
18854
18970
  if (!isZipInfoZipListingAvailable()) {
18855
18971
  throw new Error("zip entry listing requires zipinfo, but zipinfo is not installed");
18856
18972
  }
18857
- const proc = spawn6(["zipinfo", "-l", archivePath], {
18973
+ const proc = spawn2(["zipinfo", "-l", archivePath], {
18858
18974
  stdout: "pipe",
18859
18975
  stderr: "pipe"
18860
18976
  });
@@ -18893,7 +19009,7 @@ function getWindowsBuildNumber() {
18893
19009
  function isPwshAvailable() {
18894
19010
  if (process.platform !== "win32")
18895
19011
  return false;
18896
- const result = spawnSync3(["where", "pwsh"], { stdout: "pipe", stderr: "pipe" });
19012
+ const result = spawnSync(["where", "pwsh"], { stdout: "pipe", stderr: "pipe" });
18897
19013
  return result.exitCode === 0;
18898
19014
  }
18899
19015
  function escapePowerShellPath(path5) {
@@ -18917,27 +19033,27 @@ async function extractZip(archivePath, destDir) {
18917
19033
  const extractor = getWindowsZipExtractor();
18918
19034
  switch (extractor) {
18919
19035
  case "tar":
18920
- proc = spawn7(["tar", "-xf", archivePath, "-C", destDir], {
19036
+ proc = spawn2(["tar", "-xf", archivePath, "-C", destDir], {
18921
19037
  stdout: "ignore",
18922
19038
  stderr: "pipe"
18923
19039
  });
18924
19040
  break;
18925
19041
  case "pwsh":
18926
- proc = spawn7(["pwsh", "-Command", `Expand-Archive -Path '${escapePowerShellPath(archivePath)}' -DestinationPath '${escapePowerShellPath(destDir)}' -Force`], {
19042
+ proc = spawn2(["pwsh", "-Command", `Expand-Archive -Path '${escapePowerShellPath(archivePath)}' -DestinationPath '${escapePowerShellPath(destDir)}' -Force`], {
18927
19043
  stdout: "ignore",
18928
19044
  stderr: "pipe"
18929
19045
  });
18930
19046
  break;
18931
19047
  case "powershell":
18932
19048
  default:
18933
- proc = spawn7(["powershell", "-Command", `Expand-Archive -Path '${escapePowerShellPath(archivePath)}' -DestinationPath '${escapePowerShellPath(destDir)}' -Force`], {
19049
+ proc = spawn2(["powershell", "-Command", `Expand-Archive -Path '${escapePowerShellPath(archivePath)}' -DestinationPath '${escapePowerShellPath(destDir)}' -Force`], {
18934
19050
  stdout: "ignore",
18935
19051
  stderr: "pipe"
18936
19052
  });
18937
19053
  break;
18938
19054
  }
18939
19055
  } else {
18940
- proc = spawn7(["unzip", "-o", archivePath, "-d", destDir], {
19056
+ proc = spawn2(["unzip", "-o", archivePath, "-d", destDir], {
18941
19057
  stdout: "ignore",
18942
19058
  stderr: "pipe"
18943
19059
  });
@@ -18965,9 +19081,9 @@ async function listZipEntries(archivePath) {
18965
19081
  throw new Error("zip entry listing requires either python3 or zipinfo to inspect the archive safely");
18966
19082
  }
18967
19083
  // src/shared/binary-downloader.ts
19084
+ init_bun_spawn_shim();
18968
19085
  import { chmodSync, existsSync as existsSync9, mkdirSync as mkdirSync3, unlinkSync as unlinkSync2 } from "fs";
18969
19086
  import * as path5 from "path";
18970
- var {spawn: spawn8 } = globalThis.Bun;
18971
19087
  function isTarTraversalErrorOutput(output) {
18972
19088
  return /path contains '\.\.'|member name contains '\.\.'|removing leading [`'\"]?\.\.\//i.test(output);
18973
19089
  }
@@ -18992,7 +19108,7 @@ async function extractTarGz(archivePath, destDir, options) {
18992
19108
  const entries = await listTarEntries(archivePath, options?.cwd);
18993
19109
  validateArchiveEntries(entries, destDir);
18994
19110
  const args = options?.args ?? ["tar", "-xzf", archivePath, "-C", destDir];
18995
- const proc = spawn8(args, {
19111
+ const proc = spawn2(args, {
18996
19112
  cwd: options?.cwd,
18997
19113
  stdout: "pipe",
18998
19114
  stderr: "pipe"
@@ -19042,7 +19158,7 @@ function parseTarEntry(line) {
19042
19158
  };
19043
19159
  }
19044
19160
  async function listTarEntries(archivePath, cwd) {
19045
- const proc = spawn8(["tar", "-tvzf", archivePath], {
19161
+ const proc = spawn2(["tar", "-tvzf", archivePath], {
19046
19162
  cwd,
19047
19163
  stdout: "pipe",
19048
19164
  stderr: "pipe"
@@ -63840,10 +63956,11 @@ async function isServerRunning(serverUrl) {
63840
63956
  return false;
63841
63957
  }
63842
63958
  // src/shared/tmux/tmux-utils/pane-dimensions.ts
63959
+ init_bun_spawn_shim();
63843
63960
  init_tmux_path_resolver();
63844
63961
  // src/shared/tmux/tmux-utils/pane-spawn.ts
63962
+ init_bun_spawn_shim();
63845
63963
  init_tmux_path_resolver();
63846
- var {spawn: spawn10 } = globalThis.Bun;
63847
63964
  async function spawnTmuxPane(sessionId, description, config, serverUrl, targetPaneId, splitDirection = "-h") {
63848
63965
  const { log: log2 } = await Promise.resolve().then(() => (init_logger(), exports_logger));
63849
63966
  log2("[spawnTmuxPane] called", {
@@ -63886,7 +64003,7 @@ async function spawnTmuxPane(sessionId, description, config, serverUrl, targetPa
63886
64003
  ...targetPaneId ? ["-t", targetPaneId] : [],
63887
64004
  opencodeCmd
63888
64005
  ];
63889
- const proc = spawn10([tmux, ...args], { stdout: "pipe", stderr: "pipe" });
64006
+ const proc = spawn2([tmux, ...args], { stdout: "pipe", stderr: "pipe" });
63890
64007
  const exitCode = await proc.exited;
63891
64008
  const stdout = await new Response(proc.stdout).text();
63892
64009
  const paneId = stdout.trim();
@@ -63894,7 +64011,7 @@ async function spawnTmuxPane(sessionId, description, config, serverUrl, targetPa
63894
64011
  return { success: false };
63895
64012
  }
63896
64013
  const title = `omo-subagent-${description.slice(0, 20)}`;
63897
- const titleProc = spawn10([tmux, "select-pane", "-t", paneId, "-T", title], {
64014
+ const titleProc = spawn2([tmux, "select-pane", "-t", paneId, "-T", title], {
63898
64015
  stdout: "ignore",
63899
64016
  stderr: "pipe"
63900
64017
  });
@@ -63919,7 +64036,7 @@ async function readStream(stream) {
63919
64036
  return stream ? new Response(stream).text() : "";
63920
64037
  }
63921
64038
  async function closeTmuxPane(paneId) {
63922
- const [{ log: log2 }, { isInsideTmux: isInsideTmux2 }, { getTmuxPath: getTmuxPath2 }, { spawn: spawn12 }] = await Promise.all([
64039
+ const [{ log: log2 }, { isInsideTmux: isInsideTmux2 }, { getTmuxPath: getTmuxPath2 }, { spawn: spawn3 }] = await Promise.all([
63923
64040
  Promise.resolve().then(() => (init_logger(), exports_logger)),
63924
64041
  Promise.resolve().then(() => exports_environment),
63925
64042
  Promise.resolve().then(() => (init_tmux_path_resolver(), exports_tmux_path_resolver)),
@@ -63935,14 +64052,14 @@ async function closeTmuxPane(paneId) {
63935
64052
  return false;
63936
64053
  }
63937
64054
  log2("[closeTmuxPane] sending Ctrl+C for graceful shutdown", { paneId });
63938
- const ctrlCProc = spawn12([tmux, "send-keys", "-t", paneId, "C-c"], {
64055
+ const ctrlCProc = spawn3([tmux, "send-keys", "-t", paneId, "C-c"], {
63939
64056
  stdout: "ignore",
63940
64057
  stderr: "ignore"
63941
64058
  });
63942
64059
  await ctrlCProc.exited;
63943
64060
  await delay2(250);
63944
64061
  log2("[closeTmuxPane] killing pane", { paneId });
63945
- const killPaneProc = spawn12([tmux, "kill-pane", "-t", paneId], {
64062
+ const killPaneProc = spawn3([tmux, "kill-pane", "-t", paneId], {
63946
64063
  stdout: "pipe",
63947
64064
  stderr: "pipe"
63948
64065
  });
@@ -63965,8 +64082,8 @@ async function closeTmuxPane(paneId) {
63965
64082
  return true;
63966
64083
  }
63967
64084
  // src/shared/tmux/tmux-utils/pane-replace.ts
64085
+ init_bun_spawn_shim();
63968
64086
  init_tmux_path_resolver();
63969
- var {spawn: spawn12 } = globalThis.Bun;
63970
64087
  async function replaceTmuxPane(paneId, sessionId, description, config, serverUrl) {
63971
64088
  const { log: log2 } = await Promise.resolve().then(() => (init_logger(), exports_logger));
63972
64089
  log2("[replaceTmuxPane] called", { paneId, sessionId, description });
@@ -63981,7 +64098,7 @@ async function replaceTmuxPane(paneId, sessionId, description, config, serverUrl
63981
64098
  return { success: false };
63982
64099
  }
63983
64100
  log2("[replaceTmuxPane] sending Ctrl+C for graceful shutdown", { paneId });
63984
- const ctrlCProc = spawn12([tmux, "send-keys", "-t", paneId, "C-c"], {
64101
+ const ctrlCProc = spawn2([tmux, "send-keys", "-t", paneId, "C-c"], {
63985
64102
  stdout: "pipe",
63986
64103
  stderr: "pipe"
63987
64104
  });
@@ -63989,7 +64106,7 @@ async function replaceTmuxPane(paneId, sessionId, description, config, serverUrl
63989
64106
  const shell = process.env.SHELL || "/bin/sh";
63990
64107
  const escapedUrl = shellEscapeForDoubleQuotedCommand(serverUrl);
63991
64108
  const opencodeCmd = `${shell} -c "opencode attach ${escapedUrl} --session ${sessionId}"`;
63992
- const proc = spawn12([tmux, "respawn-pane", "-k", "-t", paneId, opencodeCmd], {
64109
+ const proc = spawn2([tmux, "respawn-pane", "-k", "-t", paneId, opencodeCmd], {
63993
64110
  stdout: "pipe",
63994
64111
  stderr: "pipe"
63995
64112
  });
@@ -64000,7 +64117,7 @@ async function replaceTmuxPane(paneId, sessionId, description, config, serverUrl
64000
64117
  return { success: false };
64001
64118
  }
64002
64119
  const title = `omo-subagent-${description.slice(0, 20)}`;
64003
- const titleProc = spawn12([tmux, "select-pane", "-t", paneId, "-T", title], {
64120
+ const titleProc = spawn2([tmux, "select-pane", "-t", paneId, "-T", title], {
64004
64121
  stdout: "ignore",
64005
64122
  stderr: "pipe"
64006
64123
  });
@@ -64019,8 +64136,8 @@ async function replaceTmuxPane(paneId, sessionId, description, config, serverUrl
64019
64136
  return { success: true, paneId };
64020
64137
  }
64021
64138
  // src/shared/tmux/tmux-utils/window-spawn.ts
64139
+ init_bun_spawn_shim();
64022
64140
  init_tmux_path_resolver();
64023
- var {spawn: spawn13 } = globalThis.Bun;
64024
64141
  var ISOLATED_WINDOW_NAME = "omo-agents";
64025
64142
  async function spawnTmuxWindow(sessionId, description, config, serverUrl) {
64026
64143
  const { log: log2 } = await Promise.resolve().then(() => (init_logger(), exports_logger));
@@ -64063,7 +64180,7 @@ async function spawnTmuxWindow(sessionId, description, config, serverUrl) {
64063
64180
  "#{pane_id}",
64064
64181
  opencodeCmd
64065
64182
  ];
64066
- const proc = spawn13([tmux, ...args], { stdout: "pipe", stderr: "pipe" });
64183
+ const proc = spawn2([tmux, ...args], { stdout: "pipe", stderr: "pipe" });
64067
64184
  const exitCode = await proc.exited;
64068
64185
  const stdout = await new Response(proc.stdout).text();
64069
64186
  const paneId = stdout.trim();
@@ -64073,7 +64190,7 @@ async function spawnTmuxWindow(sessionId, description, config, serverUrl) {
64073
64190
  return { success: false };
64074
64191
  }
64075
64192
  const title = `omo-subagent-${description.slice(0, 20)}`;
64076
- const titleProc = spawn13([tmux, "select-pane", "-t", paneId, "-T", title], {
64193
+ const titleProc = spawn2([tmux, "select-pane", "-t", paneId, "-T", title], {
64077
64194
  stdout: "ignore",
64078
64195
  stderr: "pipe"
64079
64196
  });
@@ -64092,14 +64209,14 @@ async function spawnTmuxWindow(sessionId, description, config, serverUrl) {
64092
64209
  return { success: true, paneId };
64093
64210
  }
64094
64211
  // src/shared/tmux/tmux-utils/session-spawn.ts
64212
+ init_bun_spawn_shim();
64095
64213
  init_tmux_path_resolver();
64096
- var {spawn: spawn14 } = globalThis.Bun;
64097
64214
  var ISOLATED_SESSION_NAME_PREFIX = "omo-agents";
64098
64215
  function getIsolatedSessionName(pid = process.pid) {
64099
64216
  return `${ISOLATED_SESSION_NAME_PREFIX}-${pid}`;
64100
64217
  }
64101
64218
  async function getWindowDimensions(tmux, sourcePaneId) {
64102
- const proc = spawn14([tmux, "display", "-p", "-t", sourcePaneId, "#{window_width},#{window_height}"], { stdout: "pipe", stderr: "pipe" });
64219
+ const proc = spawn2([tmux, "display", "-p", "-t", sourcePaneId, "#{window_width},#{window_height}"], { stdout: "pipe", stderr: "pipe" });
64103
64220
  const exitCode = await proc.exited;
64104
64221
  const stdout = await new Response(proc.stdout).text();
64105
64222
  if (exitCode !== 0)
@@ -64110,7 +64227,7 @@ async function getWindowDimensions(tmux, sourcePaneId) {
64110
64227
  return { width, height };
64111
64228
  }
64112
64229
  async function sessionExists(tmux, sessionName) {
64113
- const proc = spawn14([tmux, "has-session", "-t", sessionName], {
64230
+ const proc = spawn2([tmux, "has-session", "-t", sessionName], {
64114
64231
  stdout: "ignore",
64115
64232
  stderr: "ignore"
64116
64233
  });
@@ -64179,7 +64296,7 @@ async function spawnTmuxSession(sessionId, description, config, serverUrl, sourc
64179
64296
  mode: sessionAlreadyExists ? "new-window" : "new-session",
64180
64297
  sessionName: isolatedSessionName
64181
64298
  });
64182
- const proc = spawn14([tmux, ...args], { stdout: "pipe", stderr: "pipe" });
64299
+ const proc = spawn2([tmux, ...args], { stdout: "pipe", stderr: "pipe" });
64183
64300
  const exitCode = await proc.exited;
64184
64301
  const stdout = await new Response(proc.stdout).text();
64185
64302
  const paneId = stdout.trim();
@@ -64189,7 +64306,7 @@ async function spawnTmuxSession(sessionId, description, config, serverUrl, sourc
64189
64306
  return { success: false };
64190
64307
  }
64191
64308
  const title = `omo-subagent-${description.slice(0, 20)}`;
64192
- const titleProc = spawn14([tmux, "select-pane", "-t", paneId, "-T", title], {
64309
+ const titleProc = spawn2([tmux, "select-pane", "-t", paneId, "-T", title], {
64193
64310
  stdout: "ignore",
64194
64311
  stderr: "pipe"
64195
64312
  });
@@ -64219,8 +64336,8 @@ function isProcessAlive(pid) {
64219
64336
  }
64220
64337
  }
64221
64338
  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}"], {
64339
+ const { spawn: spawn3 } = await Promise.resolve().then(() => (init_spawn_process(), exports_spawn_process));
64340
+ const proc = spawn3([tmux, "list-sessions", "-F", "#{session_name}"], {
64224
64341
  stdout: "pipe",
64225
64342
  stderr: "pipe"
64226
64343
  });
@@ -64286,8 +64403,8 @@ async function sweepStaleOmoAgentSessions() {
64286
64403
  return sweepStaleOmoAgentSessionsWith(deps);
64287
64404
  }
64288
64405
  // src/shared/tmux/tmux-utils/layout.ts
64406
+ init_bun_spawn_shim();
64289
64407
  init_tmux_path_resolver();
64290
- var {spawn: spawn15 } = globalThis.Bun;
64291
64408
  function clamp(value, min, max) {
64292
64409
  return Math.max(min, Math.min(max, value));
64293
64410
  }
@@ -64301,7 +64418,7 @@ function calculateMainPaneWidth(windowWidth, options) {
64301
64418
  return clamp(Math.max(desiredMainPaneWidth, minMainPaneWidth), 0, maxMainPaneWidth);
64302
64419
  }
64303
64420
  async function applyLayout(tmux, layout, mainPaneSize, deps) {
64304
- const spawnCommand = deps?.spawnCommand ?? spawn15;
64421
+ const spawnCommand = deps?.spawnCommand ?? spawn2;
64305
64422
  const layoutProc = spawnCommand([tmux, "select-layout", layout], {
64306
64423
  stdout: "ignore",
64307
64424
  stderr: "ignore"
@@ -64320,7 +64437,7 @@ async function enforceMainPaneWidth(mainPaneId, windowWidth, mainPaneSizeOrOptio
64320
64437
  return;
64321
64438
  const options = typeof mainPaneSizeOrOptions === "number" ? { mainPaneSize: mainPaneSizeOrOptions } : mainPaneSizeOrOptions ?? {};
64322
64439
  const mainWidth = calculateMainPaneWidth(windowWidth, options);
64323
- const proc = spawn15([tmux, "resize-pane", "-t", mainPaneId, "-x", String(mainWidth)], {
64440
+ const proc = spawn2([tmux, "resize-pane", "-t", mainPaneId, "-x", String(mainWidth)], {
64324
64441
  stdout: "ignore",
64325
64442
  stderr: "ignore"
64326
64443
  });
@@ -67670,6 +67787,14 @@ function getDefaultSoundPath(platform2) {
67670
67787
  return "";
67671
67788
  }
67672
67789
  }
67790
+ async function runQuietNothrow(command) {
67791
+ const safeCommand = typeof command.nothrow === "function" ? command.nothrow() : command;
67792
+ if (typeof safeCommand.quiet === "function") {
67793
+ await safeCommand.quiet();
67794
+ return;
67795
+ }
67796
+ await safeCommand;
67797
+ }
67673
67798
  async function sendSessionNotification(ctx, platform2, title, message) {
67674
67799
  switch (platform2) {
67675
67800
  case "darwin": {
@@ -67697,14 +67822,14 @@ async function sendSessionNotification(ctx, platform2, title, message) {
67697
67822
  return;
67698
67823
  const escapedTitle = escapeAppleScriptText(title);
67699
67824
  const escapedMessage = escapeAppleScriptText(message);
67700
- await ctx.$`${osascriptPath} -e ${'display notification "' + escapedMessage + '" with title "' + escapedTitle + '"'}`.nothrow().quiet();
67825
+ await runQuietNothrow(ctx.$`${osascriptPath} -e ${'display notification "' + escapedMessage + '" with title "' + escapedTitle + '"'}`);
67701
67826
  break;
67702
67827
  }
67703
67828
  case "linux": {
67704
67829
  const notifySendPath = await getNotifySendPath();
67705
67830
  if (!notifySendPath)
67706
67831
  return;
67707
- await ctx.$`${notifySendPath} ${title} ${message} 2>/dev/null`.nothrow().quiet();
67832
+ await runQuietNothrow(ctx.$`${notifySendPath} ${title} ${message} 2>/dev/null`);
67708
67833
  break;
67709
67834
  }
67710
67835
  case "win32": {
@@ -67712,7 +67837,7 @@ async function sendSessionNotification(ctx, platform2, title, message) {
67712
67837
  if (!powershellPath)
67713
67838
  return;
67714
67839
  const toastScript = buildWindowsToastScript(title, message);
67715
- await ctx.$`${powershellPath} -Command ${toastScript}`.nothrow().quiet();
67840
+ await runQuietNothrow(ctx.$`${powershellPath} -Command ${toastScript}`);
67716
67841
  break;
67717
67842
  }
67718
67843
  }
@@ -67723,17 +67848,17 @@ async function playSessionNotificationSound(ctx, platform2, soundPath) {
67723
67848
  const afplayPath = await getAfplayPath();
67724
67849
  if (!afplayPath)
67725
67850
  return;
67726
- ctx.$`${afplayPath} ${soundPath}`.nothrow().quiet();
67851
+ await runQuietNothrow(ctx.$`${afplayPath} ${soundPath}`);
67727
67852
  break;
67728
67853
  }
67729
67854
  case "linux": {
67730
67855
  const paplayPath = await getPaplayPath();
67731
67856
  if (paplayPath) {
67732
- ctx.$`${paplayPath} ${soundPath} 2>/dev/null`.nothrow().quiet();
67857
+ await runQuietNothrow(ctx.$`${paplayPath} ${soundPath} 2>/dev/null`);
67733
67858
  } else {
67734
67859
  const aplayPath = await getAplayPath();
67735
67860
  if (aplayPath) {
67736
- ctx.$`${aplayPath} ${soundPath} 2>/dev/null`.nothrow().quiet();
67861
+ await runQuietNothrow(ctx.$`${aplayPath} ${soundPath} 2>/dev/null`);
67737
67862
  }
67738
67863
  }
67739
67864
  break;
@@ -67743,7 +67868,7 @@ async function playSessionNotificationSound(ctx, platform2, soundPath) {
67743
67868
  if (!powershellPath)
67744
67869
  return;
67745
67870
  const escaped = escapePowerShellSingleQuotedText(soundPath);
67746
- ctx.$`${powershellPath} -Command ${"(New-Object Media.SoundPlayer '" + escaped + "').PlaySync()"}`.nothrow().quiet();
67871
+ await runQuietNothrow(ctx.$`${powershellPath} -Command ${"(New-Object Media.SoundPlayer '" + escaped + "').PlaySync()"}`);
67747
67872
  break;
67748
67873
  }
67749
67874
  }
@@ -69123,7 +69248,7 @@ import z from "zod";
69123
69248
  import { existsSync as existsSync33 } from "fs";
69124
69249
 
69125
69250
  // src/hooks/comment-checker/cli.ts
69126
- var {spawn: spawn16 } = globalThis.Bun;
69251
+ init_bun_spawn_shim();
69127
69252
  import { createRequire as createRequire2 } from "module";
69128
69253
  import { dirname as dirname6, join as join34 } from "path";
69129
69254
  import { existsSync as existsSync32 } from "fs";
@@ -69329,7 +69454,7 @@ async function runCommentChecker(input, cliPath, customPrompt) {
69329
69454
  if (customPrompt) {
69330
69455
  args.push("--prompt", customPrompt);
69331
69456
  }
69332
- const proc = spawn16(args, {
69457
+ const proc = spawn2(args, {
69333
69458
  stdin: "pipe",
69334
69459
  stdout: "pipe",
69335
69460
  stderr: "pipe"
@@ -74721,16 +74846,16 @@ function migrateLegacyConfigFile(legacyPath) {
74721
74846
  // src/cli/config-manager/write-omo-config.ts
74722
74847
  init_plugin_identity();
74723
74848
  // src/shared/spawn-with-windows-hide.ts
74724
- var {spawn: bunSpawn } = globalThis.Bun;
74725
- import { spawn as nodeSpawn } from "child_process";
74726
- import { Readable } from "stream";
74727
- function toReadableStream(stream) {
74849
+ init_bun_spawn_shim();
74850
+ import { spawn as nodeSpawn2 } from "child_process";
74851
+ import { Readable as Readable2 } from "stream";
74852
+ function toReadableStream2(stream) {
74728
74853
  if (!stream) {
74729
74854
  return;
74730
74855
  }
74731
- return Readable.toWeb(stream);
74856
+ return Readable2.toWeb(stream);
74732
74857
  }
74733
- function wrapNodeProcess(proc) {
74858
+ function wrapNodeProcess2(proc) {
74734
74859
  let resolveExited;
74735
74860
  let exitCode = null;
74736
74861
  const exited = new Promise((resolve11) => {
@@ -74751,8 +74876,8 @@ function wrapNodeProcess(proc) {
74751
74876
  return exitCode;
74752
74877
  },
74753
74878
  exited,
74754
- stdout: toReadableStream(proc.stdout),
74755
- stderr: toReadableStream(proc.stderr),
74879
+ stdout: toReadableStream2(proc.stdout),
74880
+ stderr: toReadableStream2(proc.stderr),
74756
74881
  kill(signal) {
74757
74882
  try {
74758
74883
  if (!signal) {
@@ -74766,17 +74891,17 @@ function wrapNodeProcess(proc) {
74766
74891
  }
74767
74892
  function spawnWithWindowsHide(command, options) {
74768
74893
  if (process.platform !== "win32") {
74769
- return bunSpawn(command, options);
74894
+ return spawn2(command, options);
74770
74895
  }
74771
74896
  const [cmd, ...args] = command;
74772
- const proc = nodeSpawn(cmd, args, {
74897
+ const proc = nodeSpawn2(cmd, args, {
74773
74898
  cwd: options.cwd,
74774
74899
  env: options.env,
74775
- stdio: [options.stdin ?? "pipe", options.stdout ?? "pipe", options.stderr ?? "pipe"],
74900
+ stdio: [options.stdin ?? "ignore", options.stdout ?? "pipe", options.stderr ?? "inherit"],
74776
74901
  windowsHide: true,
74777
74902
  shell: true
74778
74903
  });
74779
- return wrapNodeProcess(proc);
74904
+ return wrapNodeProcess2(proc);
74780
74905
  }
74781
74906
  // src/cli/config-manager/bun-install.ts
74782
74907
  import { existsSync as existsSync51 } from "fs";
@@ -88759,6 +88884,10 @@ function isModelInCooldown(model, state3, cooldownSeconds) {
88759
88884
  function findNextAvailableFallback(state3, fallbackModels, cooldownSeconds) {
88760
88885
  for (let i2 = state3.fallbackIndex + 1;i2 < fallbackModels.length; i2++) {
88761
88886
  const candidate = fallbackModels[i2];
88887
+ if (candidate === state3.currentModel) {
88888
+ log(`[${HOOK_NAME11}] Skipping fallback model (same as current)`, { model: candidate, index: i2 });
88889
+ continue;
88890
+ }
88762
88891
  if (!isModelInCooldown(candidate, state3, cooldownSeconds)) {
88763
88892
  return candidate;
88764
88893
  }
@@ -91985,9 +92114,9 @@ function getLanguageId(ext) {
91985
92114
  return EXT_TO_LANG[ext] || "plaintext";
91986
92115
  }
91987
92116
  // src/tools/lsp/lsp-process.ts
92117
+ init_bun_spawn_shim();
91988
92118
  init_logger();
91989
- var {spawn: bunSpawn2 } = globalThis.Bun;
91990
- import { spawn as nodeSpawn2 } from "child_process";
92119
+ import { spawn as nodeSpawn3 } from "child_process";
91991
92120
  import { existsSync as existsSync68, statSync as statSync9 } from "fs";
91992
92121
  function shouldUseNodeSpawn() {
91993
92122
  return process.platform === "win32";
@@ -92006,7 +92135,7 @@ function validateCwd(cwd) {
92006
92135
  return { valid: false, error: `Cannot access working directory: ${cwd} (${err instanceof Error ? err.message : String(err)})` };
92007
92136
  }
92008
92137
  }
92009
- function wrapNodeProcess2(proc) {
92138
+ function wrapNodeProcess3(proc) {
92010
92139
  let resolveExited;
92011
92140
  let exitCode = null;
92012
92141
  const exitedPromise = new Promise((resolve14) => {
@@ -92107,16 +92236,16 @@ function spawnProcess(command, options) {
92107
92236
  if (shouldUseNodeSpawn()) {
92108
92237
  const [cmd, ...args] = command;
92109
92238
  log("[LSP] Using Node.js child_process on Windows to avoid Bun spawn segfault");
92110
- const proc2 = nodeSpawn2(cmd, args, {
92239
+ const proc2 = nodeSpawn3(cmd, args, {
92111
92240
  cwd: options.cwd,
92112
92241
  env: options.env,
92113
92242
  stdio: ["pipe", "pipe", "pipe"],
92114
92243
  windowsHide: true,
92115
92244
  shell: true
92116
92245
  });
92117
- return wrapNodeProcess2(proc2);
92246
+ return wrapNodeProcess3(proc2);
92118
92247
  }
92119
- const proc = bunSpawn2(command, {
92248
+ const proc = spawn2(command, {
92120
92249
  stdin: "pipe",
92121
92250
  stdout: "pipe",
92122
92251
  stderr: "pipe",
@@ -92135,7 +92264,7 @@ import { pathToFileURL } from "url";
92135
92264
 
92136
92265
  // src/tools/lsp/lsp-client-transport.ts
92137
92266
  var import_node = __toESM(require_main(), 1);
92138
- import { Readable as Readable2, Writable } from "stream";
92267
+ import { Readable as Readable3, Writable as Writable2 } from "stream";
92139
92268
  import { delimiter as delimiter2 } from "path";
92140
92269
  init_logger();
92141
92270
 
@@ -92179,7 +92308,7 @@ class LSPClientTransport {
92179
92308
  stderr: ${stderr}` : ""));
92180
92309
  }
92181
92310
  const stdoutReader = this.proc.stdout.getReader();
92182
- const nodeReadable = new Readable2({
92311
+ const nodeReadable = new Readable3({
92183
92312
  async read() {
92184
92313
  try {
92185
92314
  const { done, value } = await stdoutReader.read();
@@ -92194,7 +92323,7 @@ stderr: ${stderr}` : ""));
92194
92323
  }
92195
92324
  });
92196
92325
  const stdin = this.proc.stdin;
92197
- const nodeWritable = new Writable({
92326
+ const nodeWritable = new Writable2({
92198
92327
  write(chunk, _encoding, callback) {
92199
92328
  try {
92200
92329
  stdin.write(chunk);
@@ -93654,7 +93783,7 @@ function setSgCliPath(path13) {
93654
93783
  resolvedCliPath2 = path13;
93655
93784
  }
93656
93785
  // src/tools/ast-grep/cli.ts
93657
- var {spawn: spawn17 } = globalThis.Bun;
93786
+ init_bun_spawn_shim();
93658
93787
  import { existsSync as existsSync74 } from "fs";
93659
93788
 
93660
93789
  // src/tools/ast-grep/cli-binary-path-resolution.ts
@@ -93788,7 +93917,7 @@ async function runSg(options) {
93788
93917
  }
93789
93918
  }
93790
93919
  const timeout = DEFAULT_TIMEOUT_MS2;
93791
- const proc = spawn17([cliPath, ...args], {
93920
+ const proc = spawn2([cliPath, ...args], {
93792
93921
  stdout: "pipe",
93793
93922
  stderr: "pipe"
93794
93923
  });
@@ -93851,7 +93980,7 @@ async function runSg(options) {
93851
93980
  if (shouldSeparateWritePass && jsonResult.matches.length > 0) {
93852
93981
  const writeArgs = args.filter((a) => a !== "--json=compact");
93853
93982
  writeArgs.push("--update-all");
93854
- const writeProc = spawn17([cliPath, ...writeArgs], {
93983
+ const writeProc = spawn2([cliPath, ...writeArgs], {
93855
93984
  stdout: "pipe",
93856
93985
  stderr: "pipe"
93857
93986
  });
@@ -94020,7 +94149,7 @@ ${hint}`;
94020
94149
  import { resolve as resolve18 } from "path";
94021
94150
 
94022
94151
  // src/shared/ripgrep-cli.ts
94023
- import { spawnSync as spawnSync4 } from "child_process";
94152
+ import { spawnSync as spawnSync2 } from "child_process";
94024
94153
  import { existsSync as existsSync76 } from "fs";
94025
94154
  import { dirname as dirname24, join as join83 } from "path";
94026
94155
 
@@ -94130,7 +94259,7 @@ function findExecutable(name) {
94130
94259
  const isWindows2 = process.platform === "win32";
94131
94260
  const cmd = isWindows2 ? "where" : "which";
94132
94261
  try {
94133
- const result = spawnSync4(cmd, [name], { encoding: "utf-8", timeout: 5000 });
94262
+ const result = spawnSync2(cmd, [name], { encoding: "utf-8", timeout: 5000 });
94134
94263
  if (result.status === 0 && result.stdout.trim()) {
94135
94264
  return result.stdout.trim().split(`
94136
94265
  `)[0];
@@ -94206,7 +94335,7 @@ async function resolveGrepCliWithAutoInstall() {
94206
94335
  }
94207
94336
 
94208
94337
  // src/tools/grep/cli.ts
94209
- var {spawn: spawn18 } = globalThis.Bun;
94338
+ init_bun_spawn_shim();
94210
94339
 
94211
94340
  // src/tools/grep/constants.ts
94212
94341
  var DEFAULT_MAX_DEPTH = 20;
@@ -94395,7 +94524,7 @@ async function runRgInternal(options, resolvedCli) {
94395
94524
  }
94396
94525
  const paths = options.paths?.length ? options.paths : ["."];
94397
94526
  args.push(...paths);
94398
- const proc = spawn18([cli.path, ...args], {
94527
+ const proc = spawn2([cli.path, ...args], {
94399
94528
  stdout: "pipe",
94400
94529
  stderr: "pipe"
94401
94530
  });
@@ -94459,7 +94588,7 @@ async function runRgCountInternal(options, resolvedCli) {
94459
94588
  const paths = options.paths?.length ? options.paths : ["."];
94460
94589
  args.push(...paths);
94461
94590
  const timeout = Math.min(options.timeout ?? DEFAULT_TIMEOUT_MS3, DEFAULT_TIMEOUT_MS3);
94462
- const proc = spawn18([cli.path, ...args], {
94591
+ const proc = spawn2([cli.path, ...args], {
94463
94592
  stdout: "pipe",
94464
94593
  stderr: "pipe"
94465
94594
  });
@@ -94579,8 +94708,8 @@ function createGrepTools(ctx) {
94579
94708
  import { resolve as resolve20 } from "path";
94580
94709
 
94581
94710
  // src/tools/glob/cli.ts
94711
+ init_bun_spawn_shim();
94582
94712
  import { resolve as resolve19 } from "path";
94583
- var {spawn: spawn19 } = globalThis.Bun;
94584
94713
 
94585
94714
  // src/tools/glob/constants.ts
94586
94715
  var DEFAULT_TIMEOUT_MS4 = 60000;
@@ -94676,7 +94805,7 @@ async function runRgFilesInternal(options, resolvedCli) {
94676
94805
  cwd = paths[0] || ".";
94677
94806
  command = [cli.path, ...args];
94678
94807
  }
94679
- const proc = spawn19(command, {
94808
+ const proc = spawn2(command, {
94680
94809
  stdout: "pipe",
94681
94810
  stderr: "pipe",
94682
94811
  cwd
@@ -102890,6 +103019,7 @@ function normalizeHashlineEdits(rawEdits) {
102890
103019
 
102891
103020
  // src/tools/hashline-edit/formatter-trigger.ts
102892
103021
  import path14 from "path";
103022
+ init_bun_spawn_shim();
102893
103023
  var cachedFormattersByDirectory = new Map;
102894
103024
  function getFormatterCacheKey(directory) {
102895
103025
  return path14.resolve(directory);
@@ -102954,7 +103084,7 @@ async function runFormattersForFile(client2, directory, filePath) {
102954
103084
  const cmd = buildFormatterCommand(formatter.command, filePath);
102955
103085
  try {
102956
103086
  log("[formatter-trigger] Running formatter", { command: cmd, file: filePath });
102957
- const proc = Bun.spawn(cmd, {
103087
+ const proc = spawn2(cmd, {
102958
103088
  cwd: directory,
102959
103089
  env: { ...process.env, ...formatter.environment },
102960
103090
  stdout: "ignore",
@@ -104797,7 +104927,7 @@ async function checkAndInterruptStaleTasks(args) {
104797
104927
  const sessionStatus = sessionStatuses?.[sessionID]?.type;
104798
104928
  const sessionIsRunning = sessionStatus !== undefined && isActiveSessionStatus(sessionStatus);
104799
104929
  const sessionMissing = sessionStatuses !== undefined && sessionStatus === undefined;
104800
- const runtime = now - startedAt.getTime();
104930
+ const runtime2 = now - startedAt.getTime();
104801
104931
  if (sessionMissing) {
104802
104932
  task.consecutiveMissedPolls = (task.consecutiveMissedPolls ?? 0) + 1;
104803
104933
  } else if (sessionStatuses !== undefined) {
@@ -104810,13 +104940,13 @@ async function checkAndInterruptStaleTasks(args) {
104810
104940
  if (sessionMissing && !sessionGone)
104811
104941
  continue;
104812
104942
  const effectiveTimeout = sessionGone ? sessionGoneTimeoutMs : messageStalenessMs;
104813
- if (runtime <= effectiveTimeout)
104943
+ if (runtime2 <= effectiveTimeout)
104814
104944
  continue;
104815
104945
  if (sessionGone && await verifySessionExists(client2, sessionID, directory)) {
104816
104946
  task.consecutiveMissedPolls = 0;
104817
104947
  continue;
104818
104948
  }
104819
- const staleMinutes2 = Math.round(runtime / 60000);
104949
+ const staleMinutes2 = Math.round(runtime2 / 60000);
104820
104950
  const reason2 = sessionGone ? "session gone from status registry" : "no activity";
104821
104951
  task.status = "cancelled";
104822
104952
  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.`;
@@ -104837,7 +104967,7 @@ async function checkAndInterruptStaleTasks(args) {
104837
104967
  }
104838
104968
  if (sessionIsRunning)
104839
104969
  continue;
104840
- if (runtime < MIN_RUNTIME_BEFORE_STALE_MS)
104970
+ if (runtime2 < MIN_RUNTIME_BEFORE_STALE_MS)
104841
104971
  continue;
104842
104972
  const timeSinceLastUpdate = now - task.progress.lastUpdate.getTime();
104843
104973
  const effectiveStaleTimeout = sessionGone ? sessionGoneTimeoutMs : staleTimeoutMs;
@@ -107145,7 +107275,7 @@ async function findAvailablePort2(startPort = DEFAULT_PORT) {
107145
107275
  }
107146
107276
 
107147
107277
  // src/features/mcp-oauth/oauth-authorization-flow.ts
107148
- import { spawn as spawn20 } from "child_process";
107278
+ import { spawn as spawn3 } from "child_process";
107149
107279
  import { createHash as createHash2, randomBytes as randomBytes2 } from "crypto";
107150
107280
  import { createServer } from "http";
107151
107281
  function generateCodeVerifier() {
@@ -107226,7 +107356,7 @@ function openBrowser(url) {
107226
107356
  args = [url];
107227
107357
  }
107228
107358
  try {
107229
- const child = spawn20(command, args, { stdio: "ignore", detached: true });
107359
+ const child = spawn3(command, args, { stdio: "ignore", detached: true });
107230
107360
  child.on("error", () => {});
107231
107361
  child.unref();
107232
107362
  } catch {}
@@ -112134,7 +112264,7 @@ function createModelFallbackControllerAccessor() {
112134
112264
  };
112135
112265
  }
112136
112266
  // src/features/tmux-subagent/pane-state-querier.ts
112137
- var {spawn: spawn22 } = globalThis.Bun;
112267
+ init_bun_spawn_shim();
112138
112268
 
112139
112269
  // src/features/tmux-subagent/pane-state-parser.ts
112140
112270
  var MANDATORY_PANE_FIELD_COUNT = 8;
@@ -112223,7 +112353,7 @@ async function queryWindowState(sourcePaneId) {
112223
112353
  const tmux3 = await getTmuxPath();
112224
112354
  if (!tmux3)
112225
112355
  return null;
112226
- const proc = spawn22([
112356
+ const proc = spawn2([
112227
112357
  tmux3,
112228
112358
  "list-panes",
112229
112359
  "-t",
@@ -113759,7 +113889,7 @@ function resolveGateway(config2, event) {
113759
113889
  }
113760
113890
 
113761
113891
  // src/openclaw/dispatcher.ts
113762
- var {spawn: spawn23 } = globalThis.Bun;
113892
+ init_bun_spawn_shim();
113763
113893
  var DEFAULT_HTTP_TIMEOUT_MS = 1e4;
113764
113894
  var DEFAULT_COMMAND_TIMEOUT_MS = 5000;
113765
113895
  var MIN_COMMAND_TIMEOUT_MS = 100;
@@ -113893,7 +114023,7 @@ async function wakeCommandGateway(gatewayName, gatewayConfig, variables) {
113893
114023
  return _match;
113894
114024
  return shellEscapeArg(value);
113895
114025
  });
113896
- const proc = spawn23(["sh", "-c", interpolated], {
114026
+ const proc = spawn2(["sh", "-c", interpolated], {
113897
114027
  env: { ...process.env },
113898
114028
  stdout: "pipe",
113899
114029
  stderr: "ignore",
@@ -113943,7 +114073,7 @@ function terminateCommandProcess(proc, signal) {
113943
114073
  }
113944
114074
 
113945
114075
  // src/openclaw/tmux.ts
113946
- var {spawn: spawn24 } = globalThis.Bun;
114076
+ init_bun_spawn_shim();
113947
114077
  function getCurrentTmuxSession() {
113948
114078
  const env = process.env.TMUX;
113949
114079
  if (!env)
@@ -113953,7 +114083,7 @@ function getCurrentTmuxSession() {
113953
114083
  }
113954
114084
  async function captureTmuxPane(paneId, lines = 15) {
113955
114085
  try {
113956
- const proc = spawn24(["tmux", "capture-pane", "-p", "-t", paneId, "-S", `-${lines}`], {
114086
+ const proc = spawn2(["tmux", "capture-pane", "-p", "-t", paneId, "-S", `-${lines}`], {
113957
114087
  stdout: "pipe",
113958
114088
  stderr: "ignore"
113959
114089
  });
@@ -113969,7 +114099,7 @@ async function captureTmuxPane(paneId, lines = 15) {
113969
114099
  }
113970
114100
  async function isTmuxAvailable() {
113971
114101
  try {
113972
- const proc = spawn24(["tmux", "-V"], {
114102
+ const proc = spawn2(["tmux", "-V"], {
113973
114103
  stdout: "ignore",
113974
114104
  stderr: "ignore"
113975
114105
  });
@@ -114434,8 +114564,8 @@ function markReplyListenerStopped(state3, error) {
114434
114564
  }
114435
114565
 
114436
114566
  // src/openclaw/reply-listener-process.ts
114567
+ init_bun_spawn_shim();
114437
114568
  import { readFileSync as readFileSync62 } from "fs";
114438
- var {spawn: spawn25 } = globalThis.Bun;
114439
114569
  var REPLY_LISTENER_DAEMON_IDENTITY_MARKER = "--openclaw-reply-listener-daemon";
114440
114570
  var REPLY_LISTENER_DAEMON_ENV_ALLOWLIST = [
114441
114571
  "PATH",
@@ -114493,7 +114623,7 @@ async function isReplyListenerDaemonProcess(pid) {
114493
114623
  const cmdline = readFileSync62(`/proc/${pid}/cmdline`, "utf-8");
114494
114624
  return cmdline.includes(REPLY_LISTENER_DAEMON_IDENTITY_MARKER);
114495
114625
  }
114496
- const processInfo = spawn25(["ps", "-p", String(pid), "-o", "args="], {
114626
+ const processInfo = spawn2(["ps", "-p", String(pid), "-o", "args="], {
114497
114627
  stdout: "pipe",
114498
114628
  stderr: "ignore"
114499
114629
  });
@@ -114507,9 +114637,9 @@ async function isReplyListenerDaemonProcess(pid) {
114507
114637
  }
114508
114638
 
114509
114639
  // src/openclaw/reply-listener-spawn.ts
114510
- var {spawn: spawn26 } = globalThis.Bun;
114640
+ init_bun_spawn_shim();
114511
114641
  function spawnReplyListenerDaemon(daemonScript, startupToken) {
114512
- return spawn26(["bun", "run", daemonScript, REPLY_LISTENER_DAEMON_IDENTITY_MARKER], {
114642
+ return spawn2(["bun", "run", daemonScript, REPLY_LISTENER_DAEMON_IDENTITY_MARKER], {
114513
114643
  detached: true,
114514
114644
  stdio: ["ignore", "ignore", "ignore"],
114515
114645
  cwd: process.cwd(),
@@ -133843,7 +133973,7 @@ class PostHog extends PostHogBackendClient {
133843
133973
  // package.json
133844
133974
  var package_default = {
133845
133975
  name: "oh-my-opencode",
133846
- version: "3.17.14",
133976
+ version: "3.17.15",
133847
133977
  description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
133848
133978
  main: "./dist/index.js",
133849
133979
  types: "dist/index.d.ts",
@@ -133865,7 +133995,8 @@ var package_default = {
133865
133995
  "./schema.json": "./dist/oh-my-opencode.schema.json"
133866
133996
  },
133867
133997
  scripts: {
133868
- build: "bun build src/index.ts --outdir dist --target bun --format esm --external @ast-grep/napi --external zod && tsc --emitDeclarationOnly && bun build src/cli/index.ts --outdir dist/cli --target bun --format esm --external @ast-grep/napi && bun run build:schema",
133998
+ build: "bun build src/index.ts --outdir dist --target bun --format esm --external @ast-grep/napi --external zod && bun run build:node-require-shim && tsc --emitDeclarationOnly && bun build src/cli/index.ts --outdir dist/cli --target bun --format esm --external @ast-grep/napi && bun run build:schema",
133999
+ "build:node-require-shim": "bun run script/patch-node-require-shim.ts",
133869
134000
  "build:all": "bun run build && bun run build:binaries",
133870
134001
  "build:binaries": "bun run script/build-binaries.ts",
133871
134002
  "build:schema": "bun run script/build-schema.ts",
@@ -133923,17 +134054,17 @@ var package_default = {
133923
134054
  zod: "^4.3.0"
133924
134055
  },
133925
134056
  optionalDependencies: {
133926
- "oh-my-opencode-darwin-arm64": "3.17.14",
133927
- "oh-my-opencode-darwin-x64": "3.17.14",
133928
- "oh-my-opencode-darwin-x64-baseline": "3.17.14",
133929
- "oh-my-opencode-linux-arm64": "3.17.14",
133930
- "oh-my-opencode-linux-arm64-musl": "3.17.14",
133931
- "oh-my-opencode-linux-x64": "3.17.14",
133932
- "oh-my-opencode-linux-x64-baseline": "3.17.14",
133933
- "oh-my-opencode-linux-x64-musl": "3.17.14",
133934
- "oh-my-opencode-linux-x64-musl-baseline": "3.17.14",
133935
- "oh-my-opencode-windows-x64": "3.17.14",
133936
- "oh-my-opencode-windows-x64-baseline": "3.17.14"
134057
+ "oh-my-opencode-darwin-arm64": "3.17.15",
134058
+ "oh-my-opencode-darwin-x64": "3.17.15",
134059
+ "oh-my-opencode-darwin-x64-baseline": "3.17.15",
134060
+ "oh-my-opencode-linux-arm64": "3.17.15",
134061
+ "oh-my-opencode-linux-arm64-musl": "3.17.15",
134062
+ "oh-my-opencode-linux-x64": "3.17.15",
134063
+ "oh-my-opencode-linux-x64-baseline": "3.17.15",
134064
+ "oh-my-opencode-linux-x64-musl": "3.17.15",
134065
+ "oh-my-opencode-linux-x64-musl-baseline": "3.17.15",
134066
+ "oh-my-opencode-windows-x64": "3.17.15",
134067
+ "oh-my-opencode-windows-x64-baseline": "3.17.15"
133937
134068
  },
133938
134069
  overrides: {},
133939
134070
  trustedDependencies: [