overlord-cli 0.2607161024.0 → 0.2607171335.0

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
@@ -3228,7 +3228,8 @@ function terminalProfileFromResponse(body) {
3228
3228
  return {
3229
3229
  launcher: profile.launcher ?? null,
3230
3230
  placement: profile.placement ?? "window",
3231
- chord: profile.chord ?? null
3231
+ chord: profile.chord ?? null,
3232
+ background: profile.background ?? false
3232
3233
  };
3233
3234
  }
3234
3235
  function readLegacyTerminalProfileFromToml() {
@@ -3273,7 +3274,8 @@ function terminalProfileToLaunchSettings(profile) {
3273
3274
  return {
3274
3275
  terminalLauncher: profile.launcher,
3275
3276
  terminalLaunchPlacement: profile.placement,
3276
- terminalLaunchChord: profile.chord
3277
+ terminalLaunchChord: profile.chord,
3278
+ terminalLaunchBackground: profile.background ?? false
3277
3279
  };
3278
3280
  }
3279
3281
  var init_terminal_profile = __esm({
@@ -13615,13 +13617,21 @@ function resolveItermSplitKind(chord) {
13615
13617
  }
13616
13618
  return "keystroke";
13617
13619
  }
13620
+ function shouldActivateTerminal(placement, background) {
13621
+ return !background || placement === "chord";
13622
+ }
13623
+ function backgroundLauncher(launcher) {
13624
+ if (!/^open(\s|$)/.test(launcher.trim()) || /\s-g(\s|$)/.test(launcher)) return launcher;
13625
+ return launcher.replace(/^(\s*open)\b/, "$1 -g");
13626
+ }
13618
13627
  function buildItermAppleScript({
13619
13628
  inner,
13620
13629
  placement,
13621
13630
  chordClause,
13622
- chord
13631
+ chord,
13632
+ background
13623
13633
  }) {
13624
- const lines2 = ['tell application "iTerm"', "activate"];
13634
+ const lines2 = shouldActivateTerminal(placement, background) ? ['tell application "iTerm"', "activate"] : ['tell application "iTerm"'];
13625
13635
  if (placement === "window") {
13626
13636
  lines2.push(
13627
13637
  "set newWindow to (create window with default profile)",
@@ -13675,9 +13685,10 @@ function buildItermAppleScript({
13675
13685
  function buildTerminalAppleScript({
13676
13686
  inner,
13677
13687
  placement,
13678
- chordClause
13688
+ chordClause,
13689
+ background
13679
13690
  }) {
13680
- const lines2 = ['tell application "Terminal"', "activate"];
13691
+ const lines2 = shouldActivateTerminal(placement, background) ? ['tell application "Terminal"', "activate"] : ['tell application "Terminal"'];
13681
13692
  if (placement === "window") {
13682
13693
  lines2.push(`do script ${appleScriptString(inner)}`);
13683
13694
  } else if (placement === "tab") {
@@ -13708,10 +13719,11 @@ function buildGenericPlacementShell({
13708
13719
  launcher,
13709
13720
  inner,
13710
13721
  placement,
13711
- chordClause
13722
+ chordClause,
13723
+ background
13712
13724
  }) {
13713
13725
  const appName = extractAppNameFromLauncher(launcher);
13714
- const launch = `${launcher} ${inner}`;
13726
+ const launch = `${background ? backgroundLauncher(launcher) : launcher} ${inner}`;
13715
13727
  if (placement === "window" || !appName) {
13716
13728
  return launch;
13717
13729
  }
@@ -13748,6 +13760,7 @@ function resolveLaunchExecution({
13748
13760
  terminalLaunchPlacement = "window",
13749
13761
  terminalLaunchChord,
13750
13762
  terminalScriptPath,
13763
+ terminalLaunchBackground = false,
13751
13764
  extraEnv = {}
13752
13765
  }) {
13753
13766
  const agentCommand = agentShellCommand({ command, args, preCommand });
@@ -13771,7 +13784,8 @@ function resolveLaunchExecution({
13771
13784
  const script = buildTerminalAppleScript({
13772
13785
  inner: terminalInner,
13773
13786
  placement,
13774
- chordClause
13787
+ chordClause,
13788
+ background: terminalLaunchBackground
13775
13789
  });
13776
13790
  return {
13777
13791
  command: "osascript",
@@ -13786,7 +13800,8 @@ function resolveLaunchExecution({
13786
13800
  inner: terminalInner,
13787
13801
  placement,
13788
13802
  chordClause,
13789
- chord: terminalLaunchChord
13803
+ chord: terminalLaunchChord,
13804
+ background: terminalLaunchBackground
13790
13805
  });
13791
13806
  return {
13792
13807
  command: "osascript",
@@ -13797,11 +13812,12 @@ function resolveLaunchExecution({
13797
13812
  };
13798
13813
  }
13799
13814
  const genericTerminalCommand = terminalScriptPath?.trim() ? terminalScriptCommand(terminalScriptPath.trim()) : genericAgentCommand;
13800
- const full = placement === "window" ? `${launcher} ${genericTerminalCommand}` : buildGenericPlacementShell({
13815
+ const full = placement === "window" ? `${terminalLaunchBackground ? backgroundLauncher(launcher) : launcher} ${genericTerminalCommand}` : buildGenericPlacementShell({
13801
13816
  launcher,
13802
13817
  inner: genericTerminalCommand,
13803
13818
  placement,
13804
- chordClause
13819
+ chordClause,
13820
+ background: terminalLaunchBackground
13805
13821
  });
13806
13822
  return { command: full, args: [], useShell: true, terminal: launcher, display: full };
13807
13823
  }
@@ -14020,6 +14036,7 @@ Execution request: ${options.executionRequestId}` : context.launchContext;
14020
14036
  terminalLauncher: options.terminalLauncher,
14021
14037
  terminalLaunchPlacement: options.terminalLaunchPlacement,
14022
14038
  terminalLaunchChord: options.terminalLaunchChord,
14039
+ terminalLaunchBackground: options.terminalLaunchBackground,
14023
14040
  terminalScriptPath,
14024
14041
  extraEnv: launchEnv
14025
14042
  });
@@ -16388,7 +16405,8 @@ async function resolveTerminalLaunchSettings({
16388
16405
  return {
16389
16406
  terminalLauncher: override,
16390
16407
  terminalLaunchPlacement: profile.placement,
16391
- terminalLaunchChord: profile.chord
16408
+ terminalLaunchChord: profile.chord,
16409
+ terminalLaunchBackground: profile.background ?? false
16392
16410
  };
16393
16411
  } catch {
16394
16412
  return { terminalLauncher: override };