@adhdev/daemon-standalone 0.8.10 → 0.8.12

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
@@ -28432,14 +28432,12 @@ var require_dist2 = __commonJS({
28432
28432
  };
28433
28433
  }
28434
28434
  });
28435
- var os7;
28436
28435
  var pty;
28437
28436
  var NodePtyRuntimeTransport;
28438
28437
  var NodePtyTransportFactory;
28439
28438
  var init_pty_transport = __esm2({
28440
28439
  "src/cli-adapters/pty-transport.ts"() {
28441
28440
  "use strict";
28442
- os7 = __toESM2(require("os"));
28443
28441
  try {
28444
28442
  pty = require("node-pty");
28445
28443
  } catch {
@@ -28477,7 +28475,7 @@ var require_dist2 = __commonJS({
28477
28475
  spawn(command, args, options) {
28478
28476
  if (!pty) throw new Error("node-pty is not installed");
28479
28477
  const handle = pty.spawn(command, args, {
28480
- name: os7.platform() === "win32" ? "xterm-color" : "xterm-256color",
28478
+ name: "xterm-256color",
28481
28479
  cols: options.cols,
28482
28480
  rows: options.rows,
28483
28481
  cwd: options.cwd,
@@ -28502,6 +28500,17 @@ var require_dist2 = __commonJS({
28502
28500
  function sanitizeTerminalText(str) {
28503
28501
  return stripTerminalNoise(stripAnsi(str));
28504
28502
  }
28503
+ function applyPreferredTerminalColorEnv(env) {
28504
+ if (env.NO_COLOR) return;
28505
+ if (!env.TERM || env.TERM === "xterm-color") {
28506
+ env.TERM = "xterm-256color";
28507
+ }
28508
+ if (!env.COLORTERM) env.COLORTERM = "truecolor";
28509
+ if (process.platform === "win32") {
28510
+ if (!env.FORCE_COLOR) env.FORCE_COLOR = "1";
28511
+ if (!env.CLICOLOR) env.CLICOLOR = "1";
28512
+ }
28513
+ }
28505
28514
  function buildCliSpawnEnv(baseEnv, overrides) {
28506
28515
  const env = {};
28507
28516
  const source = { ...baseEnv, ...overrides || {} };
@@ -28510,10 +28519,11 @@ var require_dist2 = __commonJS({
28510
28519
  env[key] = value;
28511
28520
  }
28512
28521
  for (const key of Object.keys(env)) {
28513
- if (key === "INIT_CWD" || key === "NO_COLOR" || key === "FORCE_COLOR" || key === "npm_command" || key === "npm_execpath" || key === "npm_node_execpath" || key.startsWith("npm_") || key.startsWith("npm_config_") || key.startsWith("npm_package_") || key.startsWith("npm_lifecycle_") || key.startsWith("PNPM_") || key.startsWith("YARN_") || key.startsWith("BUN_")) {
28522
+ if (key === "INIT_CWD" || key === "npm_command" || key === "npm_execpath" || key === "npm_node_execpath" || key.startsWith("npm_") || key.startsWith("npm_config_") || key.startsWith("npm_package_") || key.startsWith("npm_lifecycle_") || key.startsWith("PNPM_") || key.startsWith("YARN_") || key.startsWith("BUN_")) {
28514
28523
  delete env[key];
28515
28524
  }
28516
28525
  }
28526
+ applyPreferredTerminalColorEnv(env);
28517
28527
  return env;
28518
28528
  }
28519
28529
  function computeTerminalQueryTail(buffer) {
@@ -28529,7 +28539,7 @@ var require_dist2 = __commonJS({
28529
28539
  return "";
28530
28540
  }
28531
28541
  function findBinary(name) {
28532
- const isWin = os8.platform() === "win32";
28542
+ const isWin = os7.platform() === "win32";
28533
28543
  try {
28534
28544
  const cmd = isWin ? `where ${name}` : `which ${name}`;
28535
28545
  return (0, import_child_process4.execSync)(cmd, { encoding: "utf-8", timeout: 5e3, stdio: ["pipe", "pipe", "pipe"] }).trim().split("\n")[0].trim();
@@ -28577,7 +28587,7 @@ var require_dist2 = __commonJS({
28577
28587
  }
28578
28588
  function shSingleQuote(arg) {
28579
28589
  if (/^[a-zA-Z0-9@%_+=:,./-]+$/.test(arg)) return arg;
28580
- if (os8.platform() === "win32") {
28590
+ if (os7.platform() === "win32") {
28581
28591
  return `"${arg.replace(/"/g, '""')}"`;
28582
28592
  }
28583
28593
  return `'${arg.replace(/'/g, `'\\''`)}'`;
@@ -28644,7 +28654,7 @@ var require_dist2 = __commonJS({
28644
28654
  }
28645
28655
  };
28646
28656
  }
28647
- var os8;
28657
+ var os7;
28648
28658
  var path7;
28649
28659
  var import_child_process4;
28650
28660
  var pty2;
@@ -28652,7 +28662,7 @@ var require_dist2 = __commonJS({
28652
28662
  var init_provider_cli_adapter = __esm2({
28653
28663
  "src/cli-adapters/provider-cli-adapter.ts"() {
28654
28664
  "use strict";
28655
- os8 = __toESM2(require("os"));
28665
+ os7 = __toESM2(require("os"));
28656
28666
  path7 = __toESM2(require("path"));
28657
28667
  import_child_process4 = require("child_process");
28658
28668
  init_logger();
@@ -28660,11 +28670,11 @@ var require_dist2 = __commonJS({
28660
28670
  init_pty_transport();
28661
28671
  try {
28662
28672
  pty2 = require("node-pty");
28663
- if (os8.platform() !== "win32") {
28673
+ if (os7.platform() !== "win32") {
28664
28674
  try {
28665
28675
  const fs15 = require("fs");
28666
28676
  const ptyDir = path7.resolve(path7.dirname(require.resolve("node-pty")), "..");
28667
- const platformArch = `${os8.platform()}-${os8.arch()}`;
28677
+ const platformArch = `${os7.platform()}-${os7.arch()}`;
28668
28678
  const helper = path7.join(ptyDir, "prebuilds", platformArch, "spawn-helper");
28669
28679
  if (fs15.existsSync(helper)) {
28670
28680
  const stat4 = fs15.statSync(helper);
@@ -28686,7 +28696,7 @@ var require_dist2 = __commonJS({
28686
28696
  this.transportFactory = transportFactory;
28687
28697
  this.cliType = provider.type;
28688
28698
  this.cliName = provider.name;
28689
- this.workingDir = workingDir.startsWith("~") ? workingDir.replace(/^~/, os8.homedir()) : workingDir;
28699
+ this.workingDir = workingDir.startsWith("~") ? workingDir.replace(/^~/, os7.homedir()) : workingDir;
28690
28700
  const t = provider.timeouts || {};
28691
28701
  this.timeouts = {
28692
28702
  ptyFlush: t.ptyFlush ?? 50,
@@ -28993,7 +29003,7 @@ var require_dist2 = __commonJS({
28993
29003
  if (this.ptyProcess) return;
28994
29004
  const { spawn: spawnConfig } = this.provider;
28995
29005
  const binaryPath = findBinary(spawnConfig.command);
28996
- const isWin = os8.platform() === "win32";
29006
+ const isWin = os7.platform() === "win32";
28997
29007
  const allArgs = [...spawnConfig.args, ...this.extraArgs];
28998
29008
  LOG2.info("CLI", `[${this.cliType}] Spawning in ${this.workingDir}`);
28999
29009
  this.resetTraceSession();
@@ -30466,18 +30476,18 @@ ${data.message || ""}`.trim();
30466
30476
  return null;
30467
30477
  }
30468
30478
  async function detectIDEs() {
30469
- const os18 = (0, import_os22.platform)();
30479
+ const os17 = (0, import_os22.platform)();
30470
30480
  const results = [];
30471
30481
  for (const def of getMergedDefinitions()) {
30472
30482
  const cliPath = findCliCommand(def.cli);
30473
- const appPath = checkPathExists(def.paths[os18] || []);
30483
+ const appPath = checkPathExists(def.paths[os17] || []);
30474
30484
  const installed = !!(cliPath || appPath);
30475
30485
  let resolvedCli = cliPath;
30476
- if (!resolvedCli && appPath && os18 === "darwin") {
30486
+ if (!resolvedCli && appPath && os17 === "darwin") {
30477
30487
  const bundledCli = `${appPath}/Contents/Resources/app/bin/${def.cli}`;
30478
30488
  if ((0, import_fs2.existsSync)(bundledCli)) resolvedCli = bundledCli;
30479
30489
  }
30480
- if (!resolvedCli && appPath && os18 === "win32") {
30490
+ if (!resolvedCli && appPath && os17 === "win32") {
30481
30491
  const { dirname: dirname7 } = await import("path");
30482
30492
  const appDir = dirname7(appPath);
30483
30493
  const candidates = [
@@ -30527,8 +30537,8 @@ ${data.message || ""}`.trim();
30527
30537
  });
30528
30538
  }
30529
30539
  async function detectCLIs(providerLoader) {
30530
- const platform10 = os22.platform();
30531
- const whichCmd = platform10 === "win32" ? "where" : "which";
30540
+ const platform9 = os22.platform();
30541
+ const whichCmd = platform9 === "win32" ? "where" : "which";
30532
30542
  const cliList = providerLoader ? providerLoader.getCliDetectionList() : [];
30533
30543
  const results = await Promise.all(
30534
30544
  cliList.map(async (cli) => {
@@ -34645,17 +34655,44 @@ ${data.message || ""}`.trim();
34645
34655
  const agents = await h.getCdp().discoverAgentWebviews();
34646
34656
  return { success: true, agents };
34647
34657
  }
34658
+ function normalizeWindowsRequestedPath(requestedPath) {
34659
+ const trimmed = requestedPath.trim();
34660
+ if (!trimmed) return ".";
34661
+ const slashDriveMatch = trimmed.match(/^[/\\]([A-Za-z])(?:[/\\](.*))?$/);
34662
+ if (slashDriveMatch) {
34663
+ const drive = slashDriveMatch[1].toUpperCase();
34664
+ const rest = (slashDriveMatch[2] || "").replace(/[/\\]+/g, "\\");
34665
+ return rest ? `${drive}:\\${rest}` : `${drive}:\\`;
34666
+ }
34667
+ if (/^[A-Za-z]:$/.test(trimmed)) {
34668
+ return `${trimmed[0].toUpperCase()}:\\`;
34669
+ }
34670
+ if (/^[A-Za-z]:[^/\\].*$/.test(trimmed)) {
34671
+ return `${trimmed[0].toUpperCase()}:\\${trimmed.slice(2).replace(/[/\\]+/g, "\\")}`;
34672
+ }
34673
+ if (/^[A-Za-z]:[/\\]/.test(trimmed)) {
34674
+ return `${trimmed[0].toUpperCase()}:${trimmed.slice(2)}`;
34675
+ }
34676
+ return trimmed;
34677
+ }
34648
34678
  function resolveSafePath(requestedPath) {
34679
+ const rawPath = typeof requestedPath === "string" ? requestedPath.trim() : "";
34680
+ const inputPath = rawPath || ".";
34649
34681
  const home = os62.homedir();
34650
- let resolved;
34651
- if (requestedPath.startsWith("~")) {
34652
- resolved = path6.join(home, requestedPath.slice(1));
34653
- } else if (path6.isAbsolute(requestedPath)) {
34654
- resolved = requestedPath;
34655
- } else {
34656
- resolved = path6.resolve(requestedPath);
34682
+ if (inputPath.startsWith("~")) {
34683
+ return path6.resolve(path6.join(home, inputPath.slice(1)));
34657
34684
  }
34658
- return resolved;
34685
+ if (process.platform === "win32") {
34686
+ const normalized = normalizeWindowsRequestedPath(inputPath);
34687
+ if (path6.win32.isAbsolute(normalized)) {
34688
+ return path6.win32.normalize(normalized);
34689
+ }
34690
+ return path6.win32.resolve(normalized);
34691
+ }
34692
+ if (path6.isAbsolute(inputPath)) {
34693
+ return path6.normalize(inputPath);
34694
+ }
34695
+ return path6.resolve(inputPath);
34659
34696
  }
34660
34697
  function listDirectoryEntriesSafe(dirPath) {
34661
34698
  const entries = fs42.readdirSync(dirPath, { withFileTypes: true });
@@ -35477,13 +35514,13 @@ ${data.message || ""}`.trim();
35477
35514
  }
35478
35515
  }
35479
35516
  };
35480
- var os10 = __toESM2(require("os"));
35517
+ var os9 = __toESM2(require("os"));
35481
35518
  var path9 = __toESM2(require("path"));
35482
35519
  var crypto4 = __toESM2(require("crypto"));
35483
35520
  var import_chalk = __toESM2(require("chalk"));
35484
35521
  init_provider_cli_adapter();
35485
35522
  init_config();
35486
- var os9 = __toESM2(require("os"));
35523
+ var os8 = __toESM2(require("os"));
35487
35524
  var path8 = __toESM2(require("path"));
35488
35525
  var crypto3 = __toESM2(require("crypto"));
35489
35526
  var fs5 = __toESM2(require("fs"));
@@ -35881,7 +35918,7 @@ ${data.message || ""}`.trim();
35881
35918
  LOG2.info("CLI", `[${this.type}] discovered provider session id: ${nextSessionId}`);
35882
35919
  }
35883
35920
  probeOpenCodeSessionId() {
35884
- const dbPath = path8.join(os9.homedir(), ".local", "share", "opencode", "opencode.db");
35921
+ const dbPath = path8.join(os8.homedir(), ".local", "share", "opencode", "opencode.db");
35885
35922
  if (!fs5.existsSync(dbPath)) return null;
35886
35923
  const minCreatedAt = Math.max(0, this.startedAt - 6e4);
35887
35924
  const directories = this.getProbeDirectories();
@@ -35889,7 +35926,7 @@ ${data.message || ""}`.trim();
35889
35926
  return this.querySqliteText(dbPath, query, [...directories, minCreatedAt]);
35890
35927
  }
35891
35928
  probeCodexSessionId() {
35892
- const dbPath = path8.join(os9.homedir(), ".codex", "state_5.sqlite");
35929
+ const dbPath = path8.join(os8.homedir(), ".codex", "state_5.sqlite");
35893
35930
  if (!fs5.existsSync(dbPath)) return null;
35894
35931
  const minCreatedAt = Math.max(0, Math.floor((this.startedAt - 6e4) / 1e3));
35895
35932
  const directories = this.getProbeDirectories();
@@ -35897,7 +35934,7 @@ ${data.message || ""}`.trim();
35897
35934
  return this.querySqliteText(dbPath, query, [...directories, minCreatedAt]);
35898
35935
  }
35899
35936
  probeGooseSessionId() {
35900
- const dbPath = path8.join(os9.homedir(), ".local", "share", "goose", "sessions", "sessions.db");
35937
+ const dbPath = path8.join(os8.homedir(), ".local", "share", "goose", "sessions", "sessions.db");
35901
35938
  if (!fs5.existsSync(dbPath)) return null;
35902
35939
  const minCreatedAtIso = new Date(Math.max(0, this.startedAt - 6e4)).toISOString().slice(0, 19).replace("T", " ");
35903
35940
  const directories = this.getProbeDirectories();
@@ -37084,7 +37121,7 @@ ${data.message || ""}`.trim();
37084
37121
  async startSession(cliType, workingDir, cliArgs, initialModel, options) {
37085
37122
  const trimmed = (workingDir || "").trim();
37086
37123
  if (!trimmed) throw new Error("working directory required");
37087
- const resolvedDir = trimmed.startsWith("~") ? trimmed.replace(/^~/, os10.homedir()) : path9.resolve(trimmed);
37124
+ const resolvedDir = trimmed.startsWith("~") ? trimmed.replace(/^~/, os9.homedir()) : path9.resolve(trimmed);
37088
37125
  const normalizedType = this.providerLoader.resolveAlias(cliType);
37089
37126
  const provider = this.providerLoader.getByAlias(cliType);
37090
37127
  const key = crypto4.randomUUID();
@@ -37518,11 +37555,11 @@ ${installInfo}`
37518
37555
  };
37519
37556
  var import_child_process6 = require("child_process");
37520
37557
  var net3 = __toESM2(require("net"));
37521
- var os12 = __toESM2(require("os"));
37558
+ var os11 = __toESM2(require("os"));
37522
37559
  var path11 = __toESM2(require("path"));
37523
37560
  var fs6 = __toESM2(require("fs"));
37524
37561
  var path10 = __toESM2(require("path"));
37525
- var os11 = __toESM2(require("os"));
37562
+ var os10 = __toESM2(require("os"));
37526
37563
  var chokidar = __toESM2((init_chokidar(), __toCommonJS(chokidar_exports)));
37527
37564
  init_logger();
37528
37565
  var ProviderLoader = class _ProviderLoader {
@@ -37542,7 +37579,7 @@ ${installInfo}`
37542
37579
  static META_FILE = ".meta.json";
37543
37580
  constructor(options) {
37544
37581
  this.logFn = options?.logFn || LOG2.forComponent("Provider").asLogFn();
37545
- const defaultProvidersDir = path10.join(os11.homedir(), ".adhdev", "providers");
37582
+ const defaultProvidersDir = path10.join(os10.homedir(), ".adhdev", "providers");
37546
37583
  if (options?.userDir) {
37547
37584
  this.userDir = options.userDir;
37548
37585
  this.log(`Config 'providerDir' applied: ${this.userDir}`);
@@ -38142,8 +38179,8 @@ ${installInfo}`
38142
38179
  return { updated: false };
38143
38180
  }
38144
38181
  this.log("Downloading latest providers from GitHub...");
38145
- const tmpTar = path10.join(os11.tmpdir(), `adhdev-providers-${Date.now()}.tar.gz`);
38146
- const tmpExtract = path10.join(os11.tmpdir(), `adhdev-providers-extract-${Date.now()}`);
38182
+ const tmpTar = path10.join(os10.tmpdir(), `adhdev-providers-${Date.now()}.tar.gz`);
38183
+ const tmpExtract = path10.join(os10.tmpdir(), `adhdev-providers-extract-${Date.now()}`);
38147
38184
  await this.downloadFile(_ProviderLoader.GITHUB_TARBALL_URL, tmpTar);
38148
38185
  fs6.mkdirSync(tmpExtract, { recursive: true });
38149
38186
  execSync7(`tar -xzf "${tmpTar}" -C "${tmpExtract}"`, { timeout: 3e4 });
@@ -38530,9 +38567,9 @@ ${installInfo}`
38530
38567
  }
38531
38568
  }
38532
38569
  compareVersions(a, b2) {
38533
- const normalize2 = (v2) => v2.split(/[-_+]/)[0].split(".").map((x) => parseInt(x, 10) || 0);
38534
- const pa2 = normalize2(a);
38535
- const pb = normalize2(b2);
38570
+ const normalize3 = (v2) => v2.split(/[-_+]/)[0].split(".").map((x) => parseInt(x, 10) || 0);
38571
+ const pa2 = normalize3(a);
38572
+ const pb = normalize3(b2);
38536
38573
  for (let i = 0; i < Math.max(pa2.length, pb.length); i++) {
38537
38574
  const va2 = pa2[i] || 0;
38538
38575
  const vb = pb[i] || 0;
@@ -38606,7 +38643,7 @@ ${installInfo}`
38606
38643
  });
38607
38644
  }
38608
38645
  async function killIdeProcess(ideId) {
38609
- const plat = os12.platform();
38646
+ const plat = os11.platform();
38610
38647
  const appName = getMacAppIdentifiers()[ideId];
38611
38648
  const winProcesses = getWinProcessNames()[ideId];
38612
38649
  try {
@@ -38665,7 +38702,7 @@ ${installInfo}`
38665
38702
  }
38666
38703
  }
38667
38704
  function isIdeRunning(ideId) {
38668
- const plat = os12.platform();
38705
+ const plat = os11.platform();
38669
38706
  try {
38670
38707
  if (plat === "darwin") {
38671
38708
  const appName = getMacAppIdentifiers()[ideId];
@@ -38701,7 +38738,7 @@ ${installInfo}`
38701
38738
  }
38702
38739
  }
38703
38740
  function detectCurrentWorkspace(ideId) {
38704
- const plat = os12.platform();
38741
+ const plat = os11.platform();
38705
38742
  if (plat === "darwin") {
38706
38743
  try {
38707
38744
  const appName = getMacAppIdentifiers()[ideId];
@@ -38721,7 +38758,7 @@ ${installInfo}`
38721
38758
  const appName = appNameMap[ideId];
38722
38759
  if (appName) {
38723
38760
  const storagePath = path11.join(
38724
- process.env.APPDATA || path11.join(os12.homedir(), "AppData", "Roaming"),
38761
+ process.env.APPDATA || path11.join(os11.homedir(), "AppData", "Roaming"),
38725
38762
  appName,
38726
38763
  "storage.json"
38727
38764
  );
@@ -38743,7 +38780,7 @@ ${installInfo}`
38743
38780
  return void 0;
38744
38781
  }
38745
38782
  async function launchWithCdp(options = {}) {
38746
- const platform10 = os12.platform();
38783
+ const platform9 = os11.platform();
38747
38784
  let targetIde;
38748
38785
  const ides = await detectIDEs();
38749
38786
  if (options.ideId) {
@@ -38812,9 +38849,9 @@ ${installInfo}`
38812
38849
  }
38813
38850
  const port = await findFreePort(portPair);
38814
38851
  try {
38815
- if (platform10 === "darwin") {
38852
+ if (platform9 === "darwin") {
38816
38853
  await launchMacOS(targetIde, port, workspace, options.newWindow);
38817
- } else if (platform10 === "win32") {
38854
+ } else if (platform9 === "win32") {
38818
38855
  await launchWindows(targetIde, port, workspace, options.newWindow);
38819
38856
  } else {
38820
38857
  await launchLinux(targetIde, port, workspace, options.newWindow);
@@ -38891,8 +38928,8 @@ ${installInfo}`
38891
38928
  init_logger();
38892
38929
  var fs7 = __toESM2(require("fs"));
38893
38930
  var path12 = __toESM2(require("path"));
38894
- var os13 = __toESM2(require("os"));
38895
- var LOG_DIR2 = process.platform === "win32" ? path12.join(process.env.LOCALAPPDATA || process.env.APPDATA || path12.join(os13.homedir(), "AppData", "Local"), "adhdev", "logs") : process.platform === "darwin" ? path12.join(os13.homedir(), "Library", "Logs", "adhdev") : path12.join(os13.homedir(), ".local", "share", "adhdev", "logs");
38931
+ var os12 = __toESM2(require("os"));
38932
+ var LOG_DIR2 = process.platform === "win32" ? path12.join(process.env.LOCALAPPDATA || process.env.APPDATA || path12.join(os12.homedir(), "AppData", "Local"), "adhdev", "logs") : process.platform === "darwin" ? path12.join(os12.homedir(), "Library", "Logs", "adhdev") : path12.join(os12.homedir(), ".local", "share", "adhdev", "logs");
38896
38933
  var MAX_FILE_SIZE = 5 * 1024 * 1024;
38897
38934
  var MAX_DAYS = 7;
38898
38935
  try {
@@ -39023,7 +39060,7 @@ ${installInfo}`
39023
39060
  }
39024
39061
  cleanOldFiles();
39025
39062
  init_logger();
39026
- var os14 = __toESM2(require("os"));
39063
+ var os13 = __toESM2(require("os"));
39027
39064
  init_config();
39028
39065
  init_terminal_screen();
39029
39066
  init_logger();
@@ -39139,16 +39176,16 @@ ${installInfo}`
39139
39176
  version: options.version,
39140
39177
  daemonMode: options.daemonMode,
39141
39178
  machine: {
39142
- hostname: os14.hostname(),
39143
- platform: os14.platform(),
39144
- arch: os14.arch(),
39145
- cpus: os14.cpus().length,
39179
+ hostname: os13.hostname(),
39180
+ platform: os13.platform(),
39181
+ arch: os13.arch(),
39182
+ cpus: os13.cpus().length,
39146
39183
  totalMem: memSnap.totalMem,
39147
39184
  freeMem: memSnap.freeMem,
39148
39185
  availableMem: memSnap.availableMem,
39149
- loadavg: os14.loadavg(),
39150
- uptime: os14.uptime(),
39151
- release: os14.release()
39186
+ loadavg: os13.loadavg(),
39187
+ uptime: os13.uptime(),
39188
+ release: os13.release()
39152
39189
  },
39153
39190
  machineNickname: options.machineNickname ?? cfg.machineNickname ?? null,
39154
39191
  timestamp: options.timestamp ?? Date.now(),
@@ -39166,11 +39203,11 @@ ${installInfo}`
39166
39203
  var import_child_process7 = require("child_process");
39167
39204
  var import_child_process8 = require("child_process");
39168
39205
  var fs8 = __toESM2(require("fs"));
39169
- var os15 = __toESM2(require("os"));
39206
+ var os14 = __toESM2(require("os"));
39170
39207
  var path13 = __toESM2(require("path"));
39171
39208
  var UPGRADE_HELPER_ENV = "ADHDEV_DAEMON_UPGRADE_HELPER";
39172
39209
  function getUpgradeLogPath() {
39173
- const home = os15.homedir();
39210
+ const home = os14.homedir();
39174
39211
  const dir = path13.join(home, ".adhdev");
39175
39212
  fs8.mkdirSync(dir, { recursive: true });
39176
39213
  return path13.join(dir, "daemon-upgrade.log");
@@ -39210,7 +39247,7 @@ ${installInfo}`
39210
39247
  }
39211
39248
  }
39212
39249
  function stopSessionHostProcesses(appName) {
39213
- const pidFile = path13.join(os15.homedir(), ".adhdev", `${appName}-session-host.pid`);
39250
+ const pidFile = path13.join(os14.homedir(), ".adhdev", `${appName}-session-host.pid`);
39214
39251
  try {
39215
39252
  if (fs8.existsSync(pidFile)) {
39216
39253
  const pid = Number.parseInt(fs8.readFileSync(pidFile, "utf8").trim(), 10);
@@ -39239,7 +39276,7 @@ ${installInfo}`
39239
39276
  }
39240
39277
  }
39241
39278
  function removeDaemonPidFile() {
39242
- const pidFile = path13.join(os15.homedir(), ".adhdev", "daemon.pid");
39279
+ const pidFile = path13.join(os14.homedir(), ".adhdev", "daemon.pid");
39243
39280
  try {
39244
39281
  fs8.unlinkSync(pidFile);
39245
39282
  } catch {
@@ -40729,10 +40766,10 @@ ${installInfo}`
40729
40766
  };
40730
40767
  var fs10 = __toESM2(require("fs"));
40731
40768
  var path14 = __toESM2(require("path"));
40732
- var os16 = __toESM2(require("os"));
40769
+ var os15 = __toESM2(require("os"));
40733
40770
  var import_child_process9 = require("child_process");
40734
40771
  var import_os3 = require("os");
40735
- var ARCHIVE_PATH = path14.join(os16.homedir(), ".adhdev", "version-history.json");
40772
+ var ARCHIVE_PATH = path14.join(os15.homedir(), ".adhdev", "version-history.json");
40736
40773
  var MAX_ENTRIES_PER_PROVIDER = 20;
40737
40774
  var VersionArchive = class {
40738
40775
  history = {};
@@ -40819,7 +40856,7 @@ ${installInfo}`
40819
40856
  function checkPathExists2(paths) {
40820
40857
  for (const p of paths) {
40821
40858
  if (p.includes("*")) {
40822
- const home = os16.homedir();
40859
+ const home = os15.homedir();
40823
40860
  const resolved = p.replace(/\*/g, home.split(path14.sep).pop() || "");
40824
40861
  if (fs10.existsSync(resolved)) return resolved;
40825
40862
  } else {
@@ -43135,7 +43172,7 @@ async (params) => {
43135
43172
  }
43136
43173
  var fs13 = __toESM2(require("fs"));
43137
43174
  var path17 = __toESM2(require("path"));
43138
- var os17 = __toESM2(require("os"));
43175
+ var os16 = __toESM2(require("os"));
43139
43176
  function getAutoImplPid(ctx) {
43140
43177
  const proc = ctx.autoImplProcess;
43141
43178
  return proc && typeof proc.pid === "number" && proc.pid > 0 ? proc.pid : null;
@@ -43338,7 +43375,7 @@ async (params) => {
43338
43375
  });
43339
43376
  const referenceScripts = loadAutoImplReferenceScripts(ctx, resolvedReference);
43340
43377
  const prompt = buildAutoImplPrompt(ctx, type, provider, providerDir, functions, domContext, referenceScripts, comment, resolvedReference, verification);
43341
- const tmpDir = path17.join(os17.tmpdir(), "adhdev-autoimpl");
43378
+ const tmpDir = path17.join(os16.tmpdir(), "adhdev-autoimpl");
43342
43379
  if (!fs13.existsSync(tmpDir)) fs13.mkdirSync(tmpDir, { recursive: true });
43343
43380
  const promptFile = path17.join(tmpDir, `prompt-${type}-${Date.now()}.md`);
43344
43381
  fs13.writeFileSync(promptFile, prompt, "utf-8");
@@ -43492,7 +43529,7 @@ async (params) => {
43492
43529
  const interactiveFlags = ["--yolo", "--interactive", "-i"];
43493
43530
  const baseArgs = [...spawn4.args || []].filter((a) => !interactiveFlags.includes(a));
43494
43531
  let shellCmd;
43495
- const isWin = os17.platform() === "win32";
43532
+ const isWin = os16.platform() === "win32";
43496
43533
  const escapeArg = (a) => isWin ? `"${a.replace(/"/g, '""')}"` : `'${a.replace(/'/g, "'\\''")}'`;
43497
43534
  if (command === "claude") {
43498
43535
  const args = [...baseArgs, "--dangerously-skip-permissions"];
@@ -43536,7 +43573,7 @@ async (params) => {
43536
43573
  try {
43537
43574
  const pty3 = require("node-pty");
43538
43575
  ctx.log(`Auto-implement spawn (PTY): ${shellCmd}`);
43539
- const isWin2 = os17.platform() === "win32";
43576
+ const isWin2 = os16.platform() === "win32";
43540
43577
  child = pty3.spawn(isWin2 ? "cmd.exe" : process.env.SHELL || "/bin/zsh", [isWin2 ? "/c" : "-c", shellCmd], {
43541
43578
  name: "xterm-256color",
43542
43579
  cols: 120,
@@ -46817,10 +46854,18 @@ function buildSessionHostEnv(baseEnv) {
46817
46854
  env[key] = value;
46818
46855
  }
46819
46856
  for (const key of Object.keys(env)) {
46820
- if (key === "INIT_CWD" || key === "NO_COLOR" || key === "FORCE_COLOR" || key === "npm_command" || key === "npm_execpath" || key === "npm_node_execpath" || key.startsWith("npm_") || key.startsWith("npm_config_") || key.startsWith("npm_package_") || key.startsWith("npm_lifecycle_") || key.startsWith("PNPM_") || key.startsWith("YARN_") || key.startsWith("BUN_")) {
46857
+ if (key === "INIT_CWD" || key === "npm_command" || key === "npm_execpath" || key === "npm_node_execpath" || key.startsWith("npm_") || key.startsWith("npm_config_") || key.startsWith("npm_package_") || key.startsWith("npm_lifecycle_") || key.startsWith("PNPM_") || key.startsWith("YARN_") || key.startsWith("BUN_")) {
46821
46858
  delete env[key];
46822
46859
  }
46823
46860
  }
46861
+ if (!env.NO_COLOR) {
46862
+ if (!env.TERM || env.TERM === "xterm-color") env.TERM = "xterm-256color";
46863
+ if (!env.COLORTERM) env.COLORTERM = "truecolor";
46864
+ if (process.platform === "win32") {
46865
+ if (!env.FORCE_COLOR) env.FORCE_COLOR = "1";
46866
+ if (!env.CLICOLOR) env.CLICOLOR = "1";
46867
+ }
46868
+ }
46824
46869
  env.ADHDEV_SESSION_HOST_NAME = SESSION_HOST_APP_NAME;
46825
46870
  return env;
46826
46871
  }